{"edges":[{"edgeType":"calls","source":15880,"target":15531},{"edgeType":"contains","source":11554,"target":12652},{"edgeType":"contains","source":13965,"target":14019},{"edgeType":"imports","source":15493,"target":15352},{"edgeType":"imports","source":2217,"target":1974},{"edgeType":"contains","source":15552,"target":15560},{"edgeType":"calls","source":6752,"target":6754},{"edgeType":"calls","source":14349,"target":14367},{"edgeType":"calls","source":2549,"target":1745},{"edgeType":"calls","source":15209,"target":15192},{"edgeType":"contains","source":11554,"target":12653},{"edgeType":"contains","source":13965,"target":14020},{"edgeType":"imports","source":9838,"target":389},{"edgeType":"calls","source":1731,"target":1732},{"edgeType":"calls","source":540,"target":600},{"edgeType":"calls","source":11514,"target":11348},{"edgeType":"calls","source":10791,"target":10506},{"edgeType":"contains","source":13244,"target":13113},{"edgeType":"calls","source":8143,"target":8029},{"edgeType":"calls","source":8998,"target":9009},{"edgeType":"contains","source":11554,"target":12650},{"edgeType":"calls","source":13133,"target":3438},{"edgeType":"calls","source":2672,"target":2158},{"edgeType":"contains","source":8676,"target":8852},{"edgeType":"calls","source":16468,"target":1533},{"edgeType":"calls","source":6991,"target":5690},{"edgeType":"contains","source":3264,"target":3265},{"edgeType":"contains","source":3330,"target":3333},{"edgeType":"calls","source":209,"target":292},{"edgeType":"contains","source":15263,"target":1267},{"edgeType":"contains","source":15552,"target":15563},{"edgeType":"contains","source":13173,"target":13198},{"edgeType":"calls","source":12507,"target":3817},{"edgeType":"calls","source":10390,"target":10251},{"edgeType":"calls","source":14349,"target":14372},{"edgeType":"contains","source":1216,"target":1221},{"edgeType":"contains","source":11554,"target":12648},{"edgeType":"calls","source":2462,"target":209},{"edgeType":"calls","source":3779,"target":3778},{"edgeType":"contains","source":1406,"target":1674},{"edgeType":"contains","source":8346,"target":8506},{"edgeType":"calls","source":9397,"target":9327},{"edgeType":"calls","source":14815,"target":14717},{"edgeType":"contains","source":11554,"target":12649},{"edgeType":"contains","source":3971,"target":4607},{"edgeType":"imports","source":5452,"target":5285},{"edgeType":"contains","source":15552,"target":15565},{"edgeType":"calls","source":3790,"target":3438},{"edgeType":"contains","source":1406,"target":1675},{"edgeType":"calls","source":14349,"target":14370},{"edgeType":"calls","source":10254,"target":10241},{"edgeType":"contains","source":8076,"target":8421},{"edgeType":"contains","source":7460,"target":2148},{"edgeType":"imports","source":12378,"target":10438},{"edgeType":"contains","source":11554,"target":12646},{"edgeType":"calls","source":15494,"target":2126},{"edgeType":"calls","source":3581,"target":3572},{"edgeType":"calls","source":2271,"target":1900},{"edgeType":"contains","source":3788,"target":3937},{"edgeType":"imports","source":2618,"target":2222},{"edgeType":"contains","source":27,"target":29},{"edgeType":"calls","source":11514,"target":11349},{"edgeType":"contains","source":2734,"target":2785},{"edgeType":"calls","source":9659,"target":9662},{"edgeType":"contains","source":11554,"target":12647},{"edgeType":"contains","source":15552,"target":15567},{"edgeType":"imports","source":12007,"target":801},{"edgeType":"contains","source":15289,"target":15264},{"edgeType":"calls","source":6025,"target":6028},{"edgeType":"imports","source":2618,"target":2221},{"edgeType":"contains","source":27,"target":28},{"edgeType":"contains","source":11852,"target":11864},{"edgeType":"calls","source":1342,"target":1104},{"edgeType":"calls","source":8544,"target":8288},{"edgeType":"calls","source":14363,"target":13934},{"edgeType":"calls","source":1004,"target":1012},{"edgeType":"contains","source":11852,"target":11879},{"edgeType":"contains","source":4975,"target":5200},{"edgeType":"contains","source":1876,"target":1906},{"edgeType":"calls","source":10786,"target":10668},{"edgeType":"contains","source":13962,"target":14104},{"edgeType":"calls","source":10521,"target":10427},{"edgeType":"calls","source":15691,"target":2372},{"edgeType":"calls","source":6582,"target":5690},{"edgeType":"contains","source":27,"target":31},{"edgeType":"contains","source":10069,"target":10072},{"edgeType":"contains","source":5973,"target":5974},{"edgeType":"imports","source":15712,"target":4326},{"edgeType":"calls","source":8439,"target":976},{"edgeType":"calls","source":12962,"target":12976},{"edgeType":"calls","source":1004,"target":1006},{"edgeType":"imports","source":7239,"target":612},{"edgeType":"calls","source":4639,"target":4596},{"edgeType":"calls","source":4398,"target":1497},{"edgeType":"calls","source":15039,"target":7786},{"edgeType":"contains","source":1406,"target":1679},{"edgeType":"contains","source":7460,"target":2159},{"edgeType":"contains","source":13173,"target":13209},{"edgeType":"contains","source":27,"target":30},{"edgeType":"imports","source":7775,"target":7254},{"edgeType":"calls","source":2986,"target":2989},{"edgeType":"contains","source":14954,"target":15064},{"edgeType":"contains","source":15552,"target":15554},{"edgeType":"contains","source":13173,"target":13208},{"edgeType":"contains","source":1876,"target":1904},{"edgeType":"contains","source":13313,"target":13096},{"edgeType":"contains","source":1406,"target":1676},{"edgeType":"contains","source":11554,"target":12658},{"edgeType":"contains","source":27,"target":33},{"edgeType":"calls","source":16136,"target":16061},{"edgeType":"calls","source":6293,"target":6195},{"edgeType":"contains","source":12378,"target":4028},{"edgeType":"contains","source":10069,"target":10070},{"edgeType":"contains","source":4392,"target":4244},{"edgeType":"contains","source":14954,"target":15065},{"edgeType":"calls","source":1004,"target":1008},{"edgeType":"contains","source":13173,"target":13207},{"edgeType":"contains","source":1876,"target":1905},{"edgeType":"contains","source":11554,"target":12659},{"edgeType":"imports","source":10142,"target":9980},{"edgeType":"contains","source":27,"target":32},{"edgeType":"contains","source":9275,"target":9312},{"edgeType":"contains","source":15552,"target":15556},{"edgeType":"calls","source":11237,"target":3033},{"edgeType":"contains","source":11852,"target":11875},{"edgeType":"contains","source":15483,"target":15581},{"edgeType":"contains","source":4916,"target":4919},{"edgeType":"contains","source":11192,"target":11194},{"edgeType":"contains","source":11554,"target":12656},{"edgeType":"contains","source":3971,"target":4617},{"edgeType":"contains","source":11059,"target":11088},{"edgeType":"contains","source":27,"target":35},{"edgeType":"imports","source":15843,"target":2375},{"edgeType":"calls","source":16070,"target":15987},{"edgeType":"contains","source":9275,"target":9311},{"edgeType":"contains","source":15552,"target":15557},{"edgeType":"calls","source":1072,"target":1008},{"edgeType":"imports","source":10142,"target":9986},{"edgeType":"contains","source":11554,"target":12657},{"edgeType":"contains","source":5183,"target":5097},{"edgeType":"contains","source":13173,"target":13204},{"edgeType":"contains","source":27,"target":34},{"edgeType":"imports","source":14033,"target":14089},{"edgeType":"contains","source":8553,"target":8438},{"edgeType":"contains","source":8676,"target":8853},{"edgeType":"contains","source":9275,"target":9314},{"edgeType":"contains","source":4916,"target":4917},{"edgeType":"imports","source":10142,"target":9985},{"edgeType":"calls","source":8546,"target":8235},{"edgeType":"contains","source":11554,"target":12654},{"edgeType":"calls","source":2208,"target":1731},{"edgeType":"contains","source":3971,"target":4615},{"edgeType":"contains","source":1876,"target":1909},{"edgeType":"contains","source":27,"target":37},{"edgeType":"contains","source":8676,"target":8856},{"edgeType":"calls","source":5571,"target":5296},{"edgeType":"contains","source":9275,"target":9313},{"edgeType":"contains","source":15552,"target":15559},{"edgeType":"calls","source":4711,"target":2358},{"edgeType":"contains","source":15263,"target":1263},{"edgeType":"imports","source":10142,"target":9984},{"edgeType":"contains","source":13965,"target":14018},{"edgeType":"calls","source":12561,"target":12726},{"edgeType":"contains","source":2734,"target":2794},{"edgeType":"contains","source":27,"target":36},{"edgeType":"contains","source":14954,"target":4500},{"edgeType":"calls","source":8073,"target":8068},{"edgeType":"contains","source":14492,"target":14578},{"edgeType":"calls","source":8469,"target":8477},{"edgeType":"contains","source":12759,"target":13334},{"edgeType":"contains","source":4981,"target":4989},{"edgeType":"calls","source":1533,"target":1545},{"edgeType":"contains","source":2535,"target":2593},{"edgeType":"contains","source":13962,"target":14096},{"edgeType":"contains","source":2336,"target":2420},{"edgeType":"calls","source":5299,"target":5302},{"edgeType":"contains","source":7157,"target":7299},{"edgeType":"calls","source":6854,"target":5690},{"edgeType":"contains","source":2734,"target":2768},{"edgeType":"imports","source":5256,"target":4998},{"edgeType":"calls","source":14279,"target":14406},{"edgeType":"contains","source":4640,"target":4988},{"edgeType":"calls","source":6296,"target":6076},{"edgeType":"contains","source":8076,"target":8406},{"edgeType":"calls","source":2260,"target":2265},{"edgeType":"calls","source":4393,"target":1677},{"edgeType":"contains","source":10133,"target":10178},{"edgeType":"calls","source":11718,"target":11349},{"edgeType":"calls","source":9862,"target":9688},{"edgeType":"contains","source":13963,"target":14066},{"edgeType":"contains","source":11554,"target":12636},{"edgeType":"calls","source":9822,"target":358},{"edgeType":"calls","source":15078,"target":15009},{"edgeType":"imports","source":14172,"target":3436},{"edgeType":"contains","source":4981,"target":4987},{"edgeType":"contains","source":6377,"target":6111},{"edgeType":"contains","source":9141,"target":9219},{"edgeType":"contains","source":13244,"target":13096},{"edgeType":"contains","source":3436,"target":4258},{"edgeType":"imports","source":1055,"target":2038},{"edgeType":"calls","source":16331,"target":16334},{"edgeType":"imports","source":9466,"target":1331},{"edgeType":"calls","source":4907,"target":540},{"edgeType":"calls","source":6365,"target":6052},{"edgeType":"imports","source":5256,"target":4999},{"edgeType":"contains","source":13437,"target":13455},{"edgeType":"contains","source":2734,"target":2764},{"edgeType":"calls","source":9196,"target":9197},{"edgeType":"imports","source":2217,"target":1956},{"edgeType":"contains","source":5774,"target":5778},{"edgeType":"contains","source":4981,"target":4986},{"edgeType":"imports","source":2939,"target":2828},{"edgeType":"contains","source":10522,"target":10801},{"edgeType":"imports","source":4323,"target":4326},{"edgeType":"calls","source":15605,"target":15586},{"edgeType":"calls","source":16331,"target":16335},{"edgeType":"contains","source":3383,"target":3786},{"edgeType":"contains","source":14492,"target":14581},{"edgeType":"calls","source":8465,"target":2261},{"edgeType":"imports","source":14695,"target":14705},{"edgeType":"contains","source":5467,"target":4718},{"edgeType":"contains","source":2535,"target":2592},{"edgeType":"contains","source":13965,"target":14006},{"edgeType":"calls","source":5171,"target":5040},{"edgeType":"calls","source":15661,"target":5394},{"edgeType":"contains","source":2336,"target":2419},{"edgeType":"imports","source":15493,"target":15336},{"edgeType":"imports","source":15620,"target":15627},{"edgeType":"calls","source":15357,"target":2134},{"edgeType":"imports","source":1055,"target":2036},{"edgeType":"imports","source":4323,"target":4327},{"edgeType":"calls","source":12635,"target":12523},{"edgeType":"contains","source":1410,"target":1533},{"edgeType":"calls","source":8144,"target":7985},{"edgeType":"contains","source":9275,"target":9287},{"edgeType":"contains","source":2734,"target":2771},{"edgeType":"contains","source":14492,"target":14582},{"edgeType":"contains","source":1,"target":11386},{"edgeType":"contains","source":13962,"target":14100},{"edgeType":"contains","source":2336,"target":2424},{"edgeType":"contains","source":12064,"target":11621},{"edgeType":"calls","source":11047,"target":11013},{"edgeType":"calls","source":12038,"target":12004},{"edgeType":"contains","source":10698,"target":1115},{"edgeType":"contains","source":3436,"target":4263},{"edgeType":"calls","source":2994,"target":647},{"edgeType":"contains","source":9275,"target":9286},{"edgeType":"calls","source":2993,"target":679},{"edgeType":"calls","source":8349,"target":7973},{"edgeType":"imports","source":15620,"target":15621},{"edgeType":"contains","source":2336,"target":2425},{"edgeType":"contains","source":13899,"target":13928},{"edgeType":"calls","source":9131,"target":9099},{"edgeType":"calls","source":15801,"target":3162},{"edgeType":"imports","source":6305,"target":6310},{"edgeType":"imports","source":7239,"target":611},{"edgeType":"calls","source":16450,"target":16869},{"edgeType":"contains","source":13437,"target":13451},{"edgeType":"contains","source":4640,"target":4992},{"edgeType":"contains","source":2535,"target":2595},{"edgeType":"calls","source":6884,"target":6880},{"edgeType":"contains","source":4640,"target":4991},{"edgeType":"contains","source":13963,"target":14071},{"edgeType":"imports","source":16487,"target":16227},{"edgeType":"contains","source":2336,"target":2422},{"edgeType":"calls","source":6786,"target":5690},{"edgeType":"calls","source":8800,"target":8793},{"edgeType":"contains","source":3971,"target":4590},{"edgeType":"calls","source":4717,"target":4311},{"edgeType":"imports","source":1055,"target":2035},{"edgeType":"calls","source":10523,"target":10343},{"edgeType":"contains","source":13963,"target":14072},{"edgeType":"imports","source":13922,"target":612},{"edgeType":"contains","source":11554,"target":12630},{"edgeType":"contains","source":14954,"target":4492},{"edgeType":"contains","source":2336,"target":2423},{"edgeType":"contains","source":7884,"target":8014},{"edgeType":"contains","source":5774,"target":5775},{"edgeType":"contains","source":13899,"target":13926},{"edgeType":"contains","source":11554,"target":12644},{"edgeType":"contains","source":1410,"target":1537},{"edgeType":"contains","source":13965,"target":13994},{"edgeType":"calls","source":819,"target":416},{"edgeType":"calls","source":6569,"target":6076},{"edgeType":"imports","source":2618,"target":2220},{"edgeType":"calls","source":1533,"target":1537},{"edgeType":"calls","source":3324,"target":3097},{"edgeType":"contains","source":10133,"target":10185},{"edgeType":"contains","source":2535,"target":2602},{"edgeType":"calls","source":11944,"target":2236},{"edgeType":"contains","source":15683,"target":15702},{"edgeType":"contains","source":1876,"target":1890},{"edgeType":"calls","source":9126,"target":9259},{"edgeType":"contains","source":11554,"target":12645},{"edgeType":"contains","source":13963,"target":14057},{"edgeType":"contains","source":2734,"target":2776},{"edgeType":"contains","source":15289,"target":15233},{"edgeType":"contains","source":2535,"target":2603},{"edgeType":"calls","source":4753,"target":1079},{"edgeType":"contains","source":14890,"target":14917},{"edgeType":"contains","source":8259,"target":9083},{"edgeType":"contains","source":11852,"target":11862},{"edgeType":"contains","source":14492,"target":14571},{"edgeType":"calls","source":12860,"target":3438},{"edgeType":"calls","source":16450,"target":16880},{"edgeType":"contains","source":13965,"target":13996},{"edgeType":"contains","source":9760,"target":609},{"edgeType":"calls","source":3449,"target":3448},{"edgeType":"calls","source":15691,"target":2357},{"edgeType":"contains","source":14492,"target":14572},{"edgeType":"imports","source":15048,"target":10097},{"edgeType":"imports","source":15740,"target":1330},{"edgeType":"contains","source":14890,"target":14918},{"edgeType":"contains","source":15267,"target":7460},{"edgeType":"calls","source":4523,"target":3980},{"edgeType":"imports","source":11788,"target":11790},{"edgeType":"contains","source":2336,"target":2426},{"edgeType":"calls","source":14349,"target":14357},{"edgeType":"contains","source":13173,"target":13191},{"edgeType":"contains","source":11554,"target":12641},{"edgeType":"contains","source":13437,"target":13463},{"edgeType":"calls","source":6755,"target":6655},{"edgeType":"contains","source":13963,"target":14059},{"edgeType":"contains","source":11554,"target":12643},{"edgeType":"contains","source":3436,"target":4265},{"edgeType":"calls","source":9679,"target":573},{"edgeType":"contains","source":14890,"target":14919},{"edgeType":"contains","source":2535,"target":2601},{"edgeType":"contains","source":2336,"target":2427},{"edgeType":"calls","source":15076,"target":15081},{"edgeType":"contains","source":13173,"target":13190},{"edgeType":"calls","source":6911,"target":6048},{"edgeType":"contains","source":13437,"target":13462},{"edgeType":"contains","source":13965,"target":13998},{"edgeType":"contains","source":13962,"target":14091},{"edgeType":"calls","source":16331,"target":16336},{"edgeType":"contains","source":2535,"target":2606},{"edgeType":"calls","source":5035,"target":5018},{"edgeType":"calls","source":1540,"target":1316},{"edgeType":"contains","source":8001,"target":8622},{"edgeType":"contains","source":1406,"target":1666},{"edgeType":"imports","source":1715,"target":612},{"edgeType":"contains","source":13962,"target":14092},{"edgeType":"calls","source":16875,"target":16384},{"edgeType":"contains","source":1876,"target":1895},{"edgeType":"calls","source":9791,"target":9788},{"edgeType":"contains","source":8681,"target":8682},{"edgeType":"calls","source":10027,"target":358},{"edgeType":"contains","source":10522,"target":10807},{"edgeType":"contains","source":14890,"target":14922},{"edgeType":"contains","source":13962,"target":14093},{"edgeType":"calls","source":14416,"target":14399},{"edgeType":"contains","source":8259,"target":9082},{"edgeType":"contains","source":15876,"target":16068},{"edgeType":"calls","source":5035,"target":5016},{"edgeType":"contains","source":2535,"target":2604},{"edgeType":"contains","source":882,"target":998},{"edgeType":"contains","source":13437,"target":13459},{"edgeType":"contains","source":5982,"target":5676},{"edgeType":"contains","source":11554,"target":12637},{"edgeType":"calls","source":14482,"target":14466},{"edgeType":"contains","source":13962,"target":14094},{"edgeType":"contains","source":3397,"target":3364},{"edgeType":"contains","source":3395,"target":3426},{"edgeType":"contains","source":8259,"target":9081},{"edgeType":"contains","source":2535,"target":2605},{"edgeType":"imports","source":3147,"target":612},{"edgeType":"contains","source":4385,"target":4447},{"edgeType":"contains","source":1,"target":11396},{"edgeType":"calls","source":15295,"target":8288},{"edgeType":"contains","source":13962,"target":14095},{"edgeType":"contains","source":5510,"target":5511},{"edgeType":"contains","source":11576,"target":11956},{"edgeType":"calls","source":5690,"target":5817},{"edgeType":"contains","source":620,"target":633},{"edgeType":"calls","source":4901,"target":4907},{"edgeType":"contains","source":16077,"target":16165},{"edgeType":"contains","source":13965,"target":13986},{"edgeType":"contains","source":7689,"target":7703},{"edgeType":"calls","source":12829,"target":12831},{"edgeType":"calls","source":5382,"target":4794},{"edgeType":"contains","source":818,"target":837},{"edgeType":"calls","source":6911,"target":6020},{"edgeType":"contains","source":1331,"target":1848},{"edgeType":"contains","source":2622,"target":1995},{"edgeType":"calls","source":8998,"target":8973},{"edgeType":"contains","source":16077,"target":16164},{"edgeType":"contains","source":13965,"target":13987},{"edgeType":"contains","source":13962,"target":14080},{"edgeType":"contains","source":15683,"target":15695},{"edgeType":"contains","source":15876,"target":16054},{"edgeType":"contains","source":7689,"target":7702},{"edgeType":"contains","source":5509,"target":5519},{"edgeType":"contains","source":742,"target":1078},{"edgeType":"contains","source":1331,"target":1849},{"edgeType":"contains","source":3436,"target":4243},{"edgeType":"contains","source":12908,"target":12926},{"edgeType":"contains","source":12907,"target":12957},{"edgeType":"calls","source":14279,"target":14389},{"edgeType":"contains","source":4583,"target":4624},{"edgeType":"contains","source":9275,"target":9277},{"edgeType":"calls","source":7013,"target":4974},{"edgeType":"calls","source":7124,"target":1533},{"edgeType":"contains","source":2721,"target":3151},{"edgeType":"contains","source":13965,"target":13988},{"edgeType":"contains","source":7689,"target":7705},{"edgeType":"calls","source":16875,"target":16367},{"edgeType":"calls","source":1964,"target":821},{"edgeType":"imports","source":4323,"target":4375},{"edgeType":"contains","source":12707,"target":12814},{"edgeType":"contains","source":1331,"target":1846},{"edgeType":"contains","source":3266,"target":3170},{"edgeType":"calls","source":13223,"target":13298},{"edgeType":"contains","source":4583,"target":4623},{"edgeType":"contains","source":2734,"target":2749},{"edgeType":"contains","source":2721,"target":3152},{"edgeType":"contains","source":13437,"target":13438},{"edgeType":"contains","source":13965,"target":13989},{"edgeType":"calls","source":6048,"target":1058},{"edgeType":"contains","source":7689,"target":7704},{"edgeType":"contains","source":5509,"target":5521},{"edgeType":"contains","source":2535,"target":2581},{"edgeType":"contains","source":13965,"target":13990},{"edgeType":"calls","source":14420,"target":14252},{"edgeType":"contains","source":3989,"target":4017},{"edgeType":"contains","source":3971,"target":4575},{"edgeType":"contains","source":13999,"target":4471},{"edgeType":"contains","source":742,"target":1083},{"edgeType":"contains","source":3436,"target":4248},{"edgeType":"contains","source":620,"target":637},{"edgeType":"contains","source":5112,"target":5143},{"edgeType":"calls","source":1007,"target":884},{"edgeType":"calls","source":6990,"target":5690},{"edgeType":"calls","source":11772,"target":11777},{"edgeType":"contains","source":13965,"target":13991},{"edgeType":"calls","source":9958,"target":358},{"edgeType":"calls","source":15080,"target":14926},{"edgeType":"calls","source":2028,"target":944},{"edgeType":"calls","source":10997,"target":10433},{"edgeType":"contains","source":11184,"target":11401},{"edgeType":"calls","source":6089,"target":6127},{"edgeType":"contains","source":15683,"target":15699},{"edgeType":"contains","source":620,"target":636},{"edgeType":"calls","source":6347,"target":6597},{"edgeType":"contains","source":5112,"target":5142},{"edgeType":"imports","source":8030,"target":7847},{"edgeType":"contains","source":15215,"target":611},{"edgeType":"contains","source":7885,"target":7967},{"edgeType":"contains","source":8259,"target":9057},{"edgeType":"calls","source":9201,"target":9029},{"edgeType":"calls","source":13436,"target":358},{"edgeType":"contains","source":742,"target":1085},{"edgeType":"contains","source":5112,"target":5141},{"edgeType":"contains","source":1331,"target":1850},{"edgeType":"contains","source":620,"target":639},{"edgeType":"calls","source":5237,"target":5055},{"edgeType":"contains","source":2535,"target":2580},{"edgeType":"calls","source":11772,"target":11775},{"edgeType":"contains","source":13965,"target":13993},{"edgeType":"calls","source":4506,"target":4460},{"edgeType":"contains","source":10329,"target":10421},{"edgeType":"contains","source":13899,"target":13910},{"edgeType":"contains","source":3436,"target":4245},{"edgeType":"calls","source":1491,"target":680},{"edgeType":"calls","source":6553,"target":6555},{"edgeType":"contains","source":15683,"target":15701},{"edgeType":"contains","source":2734,"target":2753},{"edgeType":"calls","source":739,"target":738},{"edgeType":"contains","source":620,"target":638},{"edgeType":"imports","source":1375,"target":2734},{"edgeType":"contains","source":4916,"target":4874},{"edgeType":"imports","source":9838,"target":413},{"edgeType":"calls","source":16450,"target":16863},{"edgeType":"calls","source":1003,"target":1005},{"edgeType":"contains","source":2336,"target":2412},{"edgeType":"contains","source":10522,"target":10794},{"edgeType":"imports","source":15828,"target":15562},{"edgeType":"contains","source":15683,"target":15686},{"edgeType":"contains","source":11059,"target":11060},{"edgeType":"calls","source":4042,"target":4044},{"edgeType":"contains","source":14470,"target":8893},{"edgeType":"contains","source":5443,"target":5457},{"edgeType":"contains","source":6104,"target":6108},{"edgeType":"imports","source":15489,"target":15500},{"edgeType":"calls","source":6347,"target":6600},{"edgeType":"calls","source":4966,"target":4998},{"edgeType":"contains","source":2667,"target":2721},{"edgeType":"contains","source":620,"target":641},{"edgeType":"contains","source":10133,"target":10169},{"edgeType":"contains","source":742,"target":1087},{"edgeType":"calls","source":4523,"target":3931},{"edgeType":"contains","source":15683,"target":15687},{"edgeType":"contains","source":2336,"target":2413},{"edgeType":"contains","source":15749,"target":15755},{"edgeType":"calls","source":3857,"target":3438},{"edgeType":"imports","source":8030,"target":7838},{"edgeType":"contains","source":11059,"target":11061},{"edgeType":"contains","source":3971,"target":4578},{"edgeType":"contains","source":3989,"target":4020},{"edgeType":"calls","source":12561,"target":12691},{"edgeType":"contains","source":5509,"target":5527},{"edgeType":"contains","source":5443,"target":5456},{"edgeType":"calls","source":14764,"target":14164},{"edgeType":"calls","source":2211,"target":1612},{"edgeType":"contains","source":13965,"target":13979},{"edgeType":"calls","source":1275,"target":1028},{"edgeType":"imports","source":7708,"target":7250},{"edgeType":"contains","source":742,"target":1086},{"edgeType":"contains","source":15683,"target":15688},{"edgeType":"contains","source":15749,"target":15756},{"edgeType":"contains","source":5112,"target":5146},{"edgeType":"contains","source":3989,"target":4019},{"edgeType":"calls","source":11098,"target":3075},{"edgeType":"contains","source":11554,"target":12625},{"edgeType":"contains","source":13245,"target":13057},{"edgeType":"contains","source":9472,"target":9520},{"edgeType":"contains","source":13899,"target":13923},{"edgeType":"contains","source":4458,"target":2165},{"edgeType":"contains","source":620,"target":643},{"edgeType":"calls","source":7872,"target":5836},{"edgeType":"contains","source":2734,"target":2756},{"edgeType":"contains","source":15683,"target":15689},{"edgeType":"contains","source":5112,"target":5145},{"edgeType":"calls","source":10185,"target":10240},{"edgeType":"contains","source":3263,"target":3271},{"edgeType":"contains","source":13173,"target":13174},{"edgeType":"contains","source":3989,"target":4018},{"edgeType":"calls","source":6922,"target":5690},{"edgeType":"contains","source":9472,"target":9519},{"edgeType":"contains","source":15749,"target":15757},{"edgeType":"contains","source":13437,"target":13446},{"edgeType":"contains","source":16077,"target":16158},{"edgeType":"contains","source":13965,"target":13981},{"edgeType":"contains","source":2080,"target":1891},{"edgeType":"contains","source":14492,"target":14557},{"edgeType":"calls","source":1267,"target":1278},{"edgeType":"contains","source":15683,"target":15690},{"edgeType":"contains","source":4981,"target":4985},{"edgeType":"calls","source":6849,"target":5840},{"edgeType":"contains","source":13437,"target":13445},{"edgeType":"calls","source":2940,"target":2263},{"edgeType":"contains","source":2336,"target":2416},{"edgeType":"contains","source":13437,"target":13444},{"edgeType":"calls","source":4570,"target":4584},{"edgeType":"contains","source":5047,"target":5052},{"edgeType":"calls","source":4108,"target":4109},{"edgeType":"calls","source":748,"target":448},{"edgeType":"contains","source":15749,"target":15759},{"edgeType":"contains","source":7689,"target":7706},{"edgeType":"contains","source":5443,"target":5460},{"edgeType":"contains","source":5509,"target":5523},{"edgeType":"calls","source":2940,"target":2264},{"edgeType":"contains","source":6172,"target":6111},{"edgeType":"contains","source":6104,"target":6105},{"edgeType":"calls","source":15604,"target":15603},{"edgeType":"contains","source":2336,"target":2417},{"edgeType":"imports","source":9838,"target":415},{"edgeType":"contains","source":2336,"target":2414},{"edgeType":"contains","source":5047,"target":5051},{"edgeType":"contains","source":10133,"target":10162},{"edgeType":"calls","source":1016,"target":600},{"edgeType":"imports","source":8030,"target":7839},{"edgeType":"contains","source":1406,"target":1647},{"edgeType":"contains","source":5443,"target":5459},{"edgeType":"contains","source":14560,"target":14566},{"edgeType":"calls","source":10520,"target":10427},{"edgeType":"contains","source":6104,"target":6106},{"edgeType":"contains","source":10850,"target":620},{"edgeType":"calls","source":3583,"target":3468},{"edgeType":"contains","source":2336,"target":2415},{"edgeType":"imports","source":3330,"target":1331},{"edgeType":"contains","source":4981,"target":4982},{"edgeType":"contains","source":10133,"target":10163},{"edgeType":"contains","source":13965,"target":13985},{"edgeType":"contains","source":3436,"target":4253},{"edgeType":"imports","source":14366,"target":14371},{"edgeType":"contains","source":13243,"target":13113},{"edgeType":"contains","source":6104,"target":6107},{"edgeType":"contains","source":1876,"target":1877},{"edgeType":"imports","source":15312,"target":4072},{"edgeType":"calls","source":1267,"target":1274},{"edgeType":"contains","source":1,"target":2923},{"edgeType":"contains","source":7688,"target":7717},{"edgeType":"contains","source":8481,"target":8503},{"edgeType":"calls","source":1268,"target":1271},{"edgeType":"contains","source":5509,"target":5501},{"edgeType":"contains","source":2721,"target":3137},{"edgeType":"contains","source":10992,"target":10998},{"edgeType":"contains","source":8812,"target":8813},{"edgeType":"contains","source":14890,"target":14892},{"edgeType":"contains","source":13965,"target":13970},{"edgeType":"contains","source":9869,"target":9872},{"edgeType":"imports","source":11788,"target":11833},{"edgeType":"calls","source":15625,"target":2246},{"edgeType":"calls","source":15209,"target":4572},{"edgeType":"contains","source":882,"target":950},{"edgeType":"contains","source":14492,"target":14546},{"edgeType":"contains","source":7688,"target":7716},{"edgeType":"imports","source":6305,"target":6336},{"edgeType":"contains","source":818,"target":820},{"edgeType":"contains","source":10329,"target":10411},{"edgeType":"contains","source":5509,"target":5502},{"edgeType":"contains","source":16013,"target":16019},{"edgeType":"calls","source":6099,"target":5838},{"edgeType":"contains","source":3436,"target":4226},{"edgeType":"contains","source":13009,"target":3436},{"edgeType":"imports","source":14366,"target":14365},{"edgeType":"calls","source":16198,"target":16195},{"edgeType":"contains","source":12378,"target":3971},{"edgeType":"contains","source":13965,"target":13971},{"edgeType":"contains","source":1715,"target":2613},{"edgeType":"imports","source":9838,"target":405},{"edgeType":"contains","source":8001,"target":8584},{"edgeType":"contains","source":5509,"target":5503},{"edgeType":"contains","source":7157,"target":7267},{"edgeType":"contains","source":1331,"target":1829},{"edgeType":"contains","source":8812,"target":8815},{"edgeType":"contains","source":14033,"target":13978},{"edgeType":"contains","source":13965,"target":13972},{"edgeType":"contains","source":11657,"target":11521},{"edgeType":"contains","source":9869,"target":9870},{"edgeType":"calls","source":12428,"target":4103},{"edgeType":"calls","source":1072,"target":1006},{"edgeType":"contains","source":10329,"target":10409},{"edgeType":"imports","source":15503,"target":2375},{"edgeType":"calls","source":14547,"target":14519},{"edgeType":"contains","source":1331,"target":1830},{"edgeType":"calls","source":2922,"target":734},{"edgeType":"contains","source":12907,"target":12939},{"edgeType":"calls","source":15362,"target":8288},{"edgeType":"contains","source":13965,"target":13973},{"edgeType":"calls","source":3846,"target":3801},{"edgeType":"imports","source":2434,"target":1603},{"edgeType":"calls","source":6636,"target":6076},{"edgeType":"calls","source":13055,"target":3698},{"edgeType":"contains","source":7094,"target":7100},{"edgeType":"contains","source":3436,"target":4231},{"edgeType":"calls","source":15009,"target":14995},{"edgeType":"contains","source":2622,"target":1982},{"edgeType":"contains","source":10992,"target":10994},{"edgeType":"contains","source":7458,"target":8500},{"edgeType":"contains","source":13965,"target":13974},{"edgeType":"contains","source":5905,"target":5906},{"edgeType":"calls","source":9813,"target":609},{"edgeType":"imports","source":7711,"target":808},{"edgeType":"imports","source":2434,"target":1602},{"edgeType":"contains","source":2205,"target":2225},{"edgeType":"contains","source":2668,"target":2671},{"edgeType":"contains","source":2734,"target":2739},{"edgeType":"contains","source":9141,"target":9179},{"edgeType":"calls","source":1004,"target":994},{"edgeType":"contains","source":13965,"target":13975},{"edgeType":"calls","source":6908,"target":1874},{"edgeType":"contains","source":5905,"target":5907},{"edgeType":"calls","source":9525,"target":9536},{"edgeType":"imports","source":2434,"target":1600},{"edgeType":"contains","source":15683,"target":15684},{"edgeType":"calls","source":2600,"target":2255},{"edgeType":"calls","source":3489,"target":2179},{"edgeType":"calls","source":1347,"target":934},{"edgeType":"contains","source":3436,"target":4229},{"edgeType":"contains","source":3383,"target":3758},{"edgeType":"contains","source":4716,"target":4717},{"edgeType":"contains","source":2734,"target":2736},{"edgeType":"calls","source":14150,"target":14147},{"edgeType":"contains","source":9472,"target":9491},{"edgeType":"calls","source":2391,"target":2392},{"edgeType":"contains","source":13965,"target":13976},{"edgeType":"contains","source":14954,"target":4458},{"edgeType":"contains","source":7885,"target":7951},{"edgeType":"contains","source":1715,"target":2614},{"edgeType":"contains","source":11906,"target":12254},{"edgeType":"contains","source":1422,"target":1127},{"edgeType":"contains","source":5509,"target":5500},{"edgeType":"calls","source":5298,"target":5294},{"edgeType":"contains","source":14492,"target":14552},{"edgeType":"contains","source":10992,"target":10993},{"edgeType":"calls","source":12037,"target":12000},{"edgeType":"calls","source":14150,"target":14146},{"edgeType":"calls","source":209,"target":272},{"edgeType":"contains","source":16083,"target":15968},{"edgeType":"contains","source":13965,"target":13977},{"edgeType":"imports","source":5256,"target":5037},{"edgeType":"contains","source":5516,"target":3170},{"edgeType":"contains","source":7885,"target":7950},{"edgeType":"calls","source":9195,"target":9198},{"edgeType":"contains","source":1331,"target":1839},{"edgeType":"calls","source":1470,"target":1343},{"edgeType":"calls","source":4637,"target":4643},{"edgeType":"imports","source":15800,"target":7957},{"edgeType":"contains","source":13899,"target":13909},{"edgeType":"contains","source":2668,"target":2674},{"edgeType":"contains","source":4716,"target":4723},{"edgeType":"calls","source":14041,"target":619},{"edgeType":"calls","source":8138,"target":8142},{"edgeType":"imports","source":2619,"target":2222},{"edgeType":"calls","source":6883,"target":6880},{"edgeType":"calls","source":15353,"target":4344},{"edgeType":"imports","source":16488,"target":16227},{"edgeType":"contains","source":7885,"target":7961},{"edgeType":"contains","source":7027,"target":7075},{"edgeType":"contains","source":3436,"target":4234},{"edgeType":"contains","source":13899,"target":13908},{"edgeType":"contains","source":4716,"target":4722},{"edgeType":"contains","source":2668,"target":2675},{"edgeType":"contains","source":742,"target":1070},{"edgeType":"calls","source":2126,"target":2146},{"edgeType":"contains","source":9539,"target":9541},{"edgeType":"contains","source":1410,"target":1502},{"edgeType":"contains","source":129,"target":1049},{"edgeType":"contains","source":13899,"target":13907},{"edgeType":"imports","source":2619,"target":2220},{"edgeType":"contains","source":14829,"target":14662},{"edgeType":"contains","source":4716,"target":4721},{"edgeType":"contains","source":2734,"target":2740},{"edgeType":"contains","source":8259,"target":9053},{"edgeType":"contains","source":12707,"target":12806},{"edgeType":"contains","source":15821,"target":15621},{"edgeType":"calls","source":9394,"target":3033},{"edgeType":"contains","source":9539,"target":9540},{"edgeType":"contains","source":3383,"target":3761},{"edgeType":"imports","source":5256,"target":5025},{"edgeType":"contains","source":8481,"target":8512},{"edgeType":"contains","source":10329,"target":10417},{"edgeType":"contains","source":2668,"target":2673},{"edgeType":"contains","source":4716,"target":4720},{"edgeType":"imports","source":5509,"target":1410},{"edgeType":"imports","source":14465,"target":9176},{"edgeType":"contains","source":12759,"target":13307},{"edgeType":"contains","source":16013,"target":16012},{"edgeType":"contains","source":16013,"target":16014},{"edgeType":"calls","source":6501,"target":6041},{"edgeType":"contains","source":5443,"target":5445},{"edgeType":"imports","source":2217,"target":1995},{"edgeType":"contains","source":10329,"target":10414},{"edgeType":"contains","source":13999,"target":4463},{"edgeType":"calls","source":15606,"target":15523},{"edgeType":"contains","source":10992,"target":11002},{"edgeType":"contains","source":14492,"target":14541},{"edgeType":"contains","source":8481,"target":8507},{"edgeType":"contains","source":742,"target":1075},{"edgeType":"calls","source":7959,"target":1011},{"edgeType":"calls","source":6127,"target":730},{"edgeType":"calls","source":13622,"target":13613},{"edgeType":"contains","source":1155,"target":956},{"edgeType":"contains","source":3436,"target":4240},{"edgeType":"calls","source":6089,"target":6136},{"edgeType":"calls","source":6883,"target":6884},{"edgeType":"calls","source":12561,"target":12677},{"edgeType":"contains","source":13965,"target":13966},{"edgeType":"contains","source":1331,"target":1844},{"edgeType":"contains","source":10329,"target":10415},{"edgeType":"contains","source":16013,"target":16015},{"edgeType":"contains","source":2721,"target":3150},{"edgeType":"contains","source":7027,"target":7072},{"edgeType":"contains","source":15352,"target":15365},{"edgeType":"calls","source":7283,"target":7169},{"edgeType":"contains","source":129,"target":1050},{"edgeType":"contains","source":8812,"target":8816},{"edgeType":"contains","source":4518,"target":4522},{"edgeType":"contains","source":742,"target":1074},{"edgeType":"contains","source":12980,"target":4339},{"edgeType":"calls","source":9593,"target":9550},{"edgeType":"contains","source":12707,"target":12803},{"edgeType":"contains","source":9275,"target":9261},{"edgeType":"imports","source":4456,"target":4458},{"edgeType":"contains","source":1331,"target":1845},{"edgeType":"contains","source":3436,"target":4239},{"edgeType":"contains","source":13962,"target":14060},{"edgeType":"contains","source":9876,"target":3314},{"edgeType":"contains","source":7689,"target":7690},{"edgeType":"contains","source":1331,"target":1841},{"edgeType":"calls","source":16133,"target":16101},{"edgeType":"contains","source":2734,"target":2744},{"edgeType":"contains","source":8259,"target":9049},{"edgeType":"contains","source":16013,"target":16016},{"edgeType":"contains","source":10992,"target":11000},{"edgeType":"contains","source":14492,"target":14543},{"edgeType":"contains","source":742,"target":1077},{"edgeType":"imports","source":1375,"target":612},{"edgeType":"contains","source":4583,"target":4620},{"edgeType":"contains","source":8677,"target":8776},{"edgeType":"calls","source":3449,"target":3411},{"edgeType":"contains","source":8481,"target":8509},{"edgeType":"calls","source":1072,"target":994},{"edgeType":"contains","source":818,"target":835},{"edgeType":"calls","source":1873,"target":1532},{"edgeType":"contains","source":15876,"target":16034},{"edgeType":"contains","source":1331,"target":1842},{"edgeType":"calls","source":16133,"target":16102},{"edgeType":"contains","source":10329,"target":10413},{"edgeType":"contains","source":2668,"target":2677},{"edgeType":"contains","source":6959,"target":7068},{"edgeType":"calls","source":5101,"target":5050},{"edgeType":"contains","source":8481,"target":8508},{"edgeType":"calls","source":3789,"target":3442},{"edgeType":"contains","source":818,"target":834},{"edgeType":"imports","source":2434,"target":1607},{"edgeType":"calls","source":209,"target":264},{"edgeType":"contains","source":13965,"target":13969},{"edgeType":"contains","source":1331,"target":1843},{"edgeType":"contains","source":3436,"target":4237},{"edgeType":"contains","source":14953,"target":15036},{"edgeType":"contains","source":9340,"target":9341},{"edgeType":"calls","source":15659,"target":5535},{"edgeType":"calls","source":1759,"target":931},{"edgeType":"contains","source":6212,"target":6946},{"edgeType":"imports","source":15763,"target":15504},{"edgeType":"contains","source":15418,"target":15420},{"edgeType":"contains","source":15484,"target":15488},{"edgeType":"contains","source":11906,"target":12245},{"edgeType":"contains","source":8259,"target":9027},{"edgeType":"calls","source":3847,"target":3854},{"edgeType":"contains","source":3436,"target":4211},{"edgeType":"calls","source":8150,"target":7877},{"edgeType":"calls","source":6504,"target":6052},{"edgeType":"contains","source":1331,"target":1815},{"edgeType":"contains","source":9002,"target":9248},{"edgeType":"contains","source":7027,"target":7050},{"edgeType":"contains","source":3262,"target":3263},{"edgeType":"imports","source":12007,"target":865},{"edgeType":"contains","source":16077,"target":16131},{"edgeType":"contains","source":15352,"target":15353},{"edgeType":"contains","source":8001,"target":8567},{"edgeType":"contains","source":1,"target":7103},{"edgeType":"contains","source":14492,"target":14530},{"edgeType":"contains","source":10328,"target":10426},{"edgeType":"contains","source":6212,"target":6948},{"edgeType":"contains","source":12379,"target":12380},{"edgeType":"calls","source":6163,"target":6050},{"edgeType":"contains","source":1331,"target":1816},{"edgeType":"contains","source":9002,"target":9247},{"edgeType":"imports","source":5256,"target":5082},{"edgeType":"contains","source":13447,"target":13096},{"edgeType":"calls","source":1535,"target":1535},{"edgeType":"contains","source":11906,"target":12243},{"edgeType":"contains","source":9002,"target":9250},{"edgeType":"contains","source":4419,"target":3333},{"edgeType":"contains","source":742,"target":1048},{"edgeType":"contains","source":1331,"target":1813},{"edgeType":"calls","source":2462,"target":2392},{"edgeType":"calls","source":14087,"target":14097},{"edgeType":"contains","source":3333,"target":3174},{"edgeType":"contains","source":8001,"target":8569},{"edgeType":"calls","source":3012,"target":2255},{"edgeType":"contains","source":2667,"target":2679},{"edgeType":"contains","source":9340,"target":9342},{"edgeType":"calls","source":11715,"target":11523},{"edgeType":"calls","source":15697,"target":2246},{"edgeType":"calls","source":1296,"target":487},{"edgeType":"contains","source":1,"target":7106},{"edgeType":"contains","source":11906,"target":12242},{"edgeType":"calls","source":3579,"target":1591},{"edgeType":"contains","source":742,"target":1047},{"edgeType":"contains","source":6212,"target":6950},{"edgeType":"contains","source":10328,"target":10424},{"edgeType":"calls","source":8681,"target":8331},{"edgeType":"contains","source":3436,"target":4208},{"edgeType":"contains","source":1331,"target":1814},{"edgeType":"imports","source":10919,"target":9222},{"edgeType":"calls","source":2988,"target":2996},{"edgeType":"contains","source":9668,"target":9739},{"edgeType":"calls","source":6938,"target":1058},{"edgeType":"contains","source":11906,"target":12241},{"edgeType":"contains","source":2205,"target":2208},{"edgeType":"calls","source":7878,"target":7857},{"edgeType":"contains","source":7885,"target":7932},{"edgeType":"contains","source":1331,"target":1819},{"edgeType":"imports","source":6109,"target":6125},{"edgeType":"calls","source":3340,"target":540},{"edgeType":"contains","source":9668,"target":9738},{"edgeType":"contains","source":15220,"target":15221},{"edgeType":"contains","source":8259,"target":9021},{"edgeType":"contains","source":11906,"target":12240},{"edgeType":"calls","source":12983,"target":3931},{"edgeType":"contains","source":8481,"target":8482},{"edgeType":"contains","source":12706,"target":12809},{"edgeType":"contains","source":1330,"target":1851},{"edgeType":"contains","source":3392,"target":3464},{"edgeType":"calls","source":2462,"target":2391},{"edgeType":"contains","source":9002,"target":9243},{"edgeType":"contains","source":7027,"target":7047},{"edgeType":"contains","source":7157,"target":7245},{"edgeType":"calls","source":10124,"target":10109},{"edgeType":"contains","source":9476,"target":3005},{"edgeType":"contains","source":13963,"target":14021},{"edgeType":"contains","source":9668,"target":9741},{"edgeType":"contains","source":8346,"target":8441},{"edgeType":"calls","source":5631,"target":5625},{"edgeType":"contains","source":15220,"target":15222},{"edgeType":"imports","source":9678,"target":9644},{"edgeType":"contains","source":10078,"target":3370},{"edgeType":"contains","source":8346,"target":8442},{"edgeType":"contains","source":9002,"target":9246},{"edgeType":"contains","source":6212,"target":6945},{"edgeType":"imports","source":9678,"target":3303},{"edgeType":"contains","source":1715,"target":2598},{"edgeType":"contains","source":15352,"target":15359},{"edgeType":"imports","source":9814,"target":3315},{"edgeType":"contains","source":11906,"target":12238},{"edgeType":"contains","source":10661,"target":10667},{"edgeType":"contains","source":3392,"target":3462},{"edgeType":"contains","source":9002,"target":9245},{"edgeType":"calls","source":7924,"target":2206},{"edgeType":"calls","source":7555,"target":7304},{"edgeType":"contains","source":11906,"target":12253},{"edgeType":"calls","source":15013,"target":14999},{"edgeType":"contains","source":7027,"target":7059},{"edgeType":"imports","source":8030,"target":7870},{"edgeType":"calls","source":12373,"target":12275},{"edgeType":"contains","source":9340,"target":9349},{"edgeType":"calls","source":209,"target":349},{"edgeType":"contains","source":1330,"target":1854},{"edgeType":"calls","source":6166,"target":5950},{"edgeType":"contains","source":1406,"target":1612},{"edgeType":"contains","source":14953,"target":4458},{"edgeType":"calls","source":4646,"target":2333},{"edgeType":"calls","source":15219,"target":14956},{"edgeType":"contains","source":8259,"target":9035},{"edgeType":"imports","source":15763,"target":15495},{"edgeType":"contains","source":11906,"target":12252},{"edgeType":"contains","source":5112,"target":5114},{"edgeType":"contains","source":7026,"target":7091},{"edgeType":"contains","source":14492,"target":14521},{"edgeType":"calls","source":4431,"target":540},{"edgeType":"contains","source":9340,"target":9348},{"edgeType":"contains","source":3436,"target":4218},{"edgeType":"contains","source":8291,"target":8042},{"edgeType":"contains","source":1331,"target":1824},{"edgeType":"contains","source":3392,"target":3468},{"edgeType":"contains","source":14953,"target":15029},{"edgeType":"contains","source":12706,"target":12820},{"edgeType":"contains","source":3129,"target":3163},{"edgeType":"contains","source":5112,"target":5113},{"edgeType":"contains","source":11906,"target":12251},{"edgeType":"contains","source":6959,"target":7055},{"edgeType":"calls","source":6093,"target":6097},{"edgeType":"contains","source":3436,"target":4217},{"edgeType":"contains","source":1331,"target":1821},{"edgeType":"contains","source":10133,"target":10134},{"edgeType":"contains","source":14952,"target":15061},{"edgeType":"contains","source":3129,"target":3164},{"edgeType":"calls","source":8869,"target":8853},{"edgeType":"imports","source":6109,"target":6113},{"edgeType":"imports","source":9814,"target":3303},{"edgeType":"contains","source":12706,"target":12819},{"edgeType":"contains","source":2336,"target":2378},{"edgeType":"contains","source":11906,"target":12250},{"edgeType":"contains","source":13962,"target":14041},{"edgeType":"contains","source":3436,"target":4216},{"edgeType":"contains","source":15503,"target":14893},{"edgeType":"imports","source":9814,"target":9644},{"edgeType":"calls","source":5036,"target":5038},{"edgeType":"contains","source":9340,"target":9345},{"edgeType":"contains","source":1715,"target":2607},{"edgeType":"calls","source":131,"target":649},{"edgeType":"calls","source":480,"target":400},{"edgeType":"contains","source":13379,"target":13096},{"edgeType":"contains","source":6212,"target":6951},{"edgeType":"contains","source":15220,"target":15211},{"edgeType":"contains","source":9340,"target":9344},{"edgeType":"imports","source":1167,"target":770},{"edgeType":"contains","source":11906,"target":12248},{"edgeType":"calls","source":8936,"target":8892},{"edgeType":"contains","source":15503,"target":14896},{"edgeType":"contains","source":13370,"target":13374},{"edgeType":"contains","source":2622,"target":1974},{"edgeType":"contains","source":9002,"target":9251},{"edgeType":"contains","source":5112,"target":5117},{"edgeType":"contains","source":9340,"target":9347},{"edgeType":"contains","source":11576,"target":11906},{"edgeType":"contains","source":15483,"target":15517},{"edgeType":"contains","source":11906,"target":12247},{"edgeType":"contains","source":3392,"target":3471},{"edgeType":"calls","source":16070,"target":16055},{"edgeType":"contains","source":6212,"target":6953},{"edgeType":"calls","source":7924,"target":2213},{"edgeType":"imports","source":15489,"target":15531},{"edgeType":"contains","source":3989,"target":3991},{"edgeType":"contains","source":2205,"target":2214},{"edgeType":"imports","source":15349,"target":9301},{"edgeType":"calls","source":7513,"target":156},{"edgeType":"contains","source":4385,"target":4399},{"edgeType":"calls","source":13675,"target":3627},{"edgeType":"calls","source":3216,"target":2261},{"edgeType":"contains","source":5189,"target":4843},{"edgeType":"contains","source":9596,"target":1410},{"edgeType":"contains","source":9340,"target":9346},{"edgeType":"contains","source":7157,"target":7256},{"edgeType":"contains","source":11906,"target":12246},{"edgeType":"contains","source":13370,"target":13372},{"edgeType":"contains","source":15484,"target":15487},{"edgeType":"calls","source":12304,"target":12303},{"edgeType":"calls","source":3519,"target":3438},{"edgeType":"contains","source":3392,"target":3470},{"edgeType":"contains","source":6212,"target":6954},{"edgeType":"contains","source":10329,"target":10377},{"edgeType":"calls","source":3914,"target":3908},{"edgeType":"calls","source":6852,"target":5817},{"edgeType":"contains","source":12759,"target":13268},{"edgeType":"contains","source":7027,"target":7034},{"edgeType":"contains","source":11451,"target":11534},{"edgeType":"calls","source":1337,"target":1345},{"edgeType":"contains","source":9668,"target":9726},{"edgeType":"calls","source":1271,"target":1277},{"edgeType":"contains","source":4120,"target":4131},{"edgeType":"contains","source":7027,"target":7035},{"edgeType":"contains","source":3788,"target":3851},{"edgeType":"contains","source":10616,"target":1481},{"edgeType":"contains","source":1331,"target":1799},{"edgeType":"contains","source":7157,"target":7233},{"edgeType":"contains","source":16986,"target":620},{"edgeType":"imports","source":15095,"target":2369},{"edgeType":"contains","source":11451,"target":11535},{"edgeType":"contains","source":8214,"target":8290},{"edgeType":"contains","source":6212,"target":6931},{"edgeType":"calls","source":3451,"target":3463},{"edgeType":"contains","source":15483,"target":15503},{"edgeType":"contains","source":4120,"target":4130},{"edgeType":"contains","source":13217,"target":13867},{"edgeType":"contains","source":7027,"target":7036},{"edgeType":"contains","source":742,"target":1032},{"edgeType":"contains","source":13369,"target":13383},{"edgeType":"contains","source":3788,"target":3850},{"edgeType":"imports","source":6681,"target":1058},{"edgeType":"calls","source":16070,"target":16035},{"edgeType":"contains","source":8677,"target":8738},{"edgeType":"calls","source":15080,"target":15014},{"edgeType":"contains","source":14952,"target":15053},{"edgeType":"contains","source":5774,"target":5712},{"edgeType":"calls","source":1647,"target":193},{"edgeType":"calls","source":3862,"target":3403},{"edgeType":"contains","source":9668,"target":9728},{"edgeType":"contains","source":4120,"target":4129},{"edgeType":"calls","source":1337,"target":1347},{"edgeType":"contains","source":14492,"target":14515},{"edgeType":"contains","source":7027,"target":7037},{"edgeType":"contains","source":13217,"target":13866},{"edgeType":"contains","source":13369,"target":13382},{"edgeType":"imports","source":4323,"target":4392},{"edgeType":"contains","source":8807,"target":8936},{"edgeType":"calls","source":10124,"target":10091},{"edgeType":"calls","source":14153,"target":14148},{"edgeType":"contains","source":1940,"target":1945},{"edgeType":"contains","source":12926,"target":12316},{"edgeType":"contains","source":8677,"target":8737},{"edgeType":"calls","source":1337,"target":1346},{"edgeType":"contains","source":9668,"target":9727},{"edgeType":"calls","source":3319,"target":3325},{"edgeType":"contains","source":742,"target":1034},{"edgeType":"contains","source":13369,"target":13381},{"edgeType":"contains","source":15781,"target":14725},{"edgeType":"contains","source":3392,"target":3448},{"edgeType":"contains","source":9002,"target":9228},{"edgeType":"contains","source":2667,"target":2668},{"edgeType":"contains","source":7027,"target":7030},{"edgeType":"calls","source":11946,"target":2236},{"edgeType":"calls","source":15870,"target":15886},{"edgeType":"contains","source":9668,"target":9722},{"edgeType":"contains","source":8214,"target":8287},{"edgeType":"calls","source":1271,"target":1272},{"edgeType":"calls","source":5458,"target":4663},{"edgeType":"contains","source":11906,"target":12223},{"edgeType":"contains","source":13369,"target":13380},{"edgeType":"contains","source":742,"target":1033},{"edgeType":"contains","source":5659,"target":7157},{"edgeType":"contains","source":1331,"target":1803},{"edgeType":"contains","source":7027,"target":7031},{"edgeType":"contains","source":14492,"target":14517},{"edgeType":"calls","source":14521,"target":9088},{"edgeType":"contains","source":9668,"target":9721},{"edgeType":"calls","source":6709,"target":6028},{"edgeType":"contains","source":8351,"target":8267},{"edgeType":"calls","source":3451,"target":3459},{"edgeType":"imports","source":15489,"target":15520},{"edgeType":"contains","source":4120,"target":4134},{"edgeType":"contains","source":3788,"target":3856},{"edgeType":"contains","source":3436,"target":4196},{"edgeType":"contains","source":5058,"target":4652},{"edgeType":"contains","source":13243,"target":13057},{"edgeType":"contains","source":9002,"target":9230},{"edgeType":"contains","source":9668,"target":9724},{"edgeType":"calls","source":6647,"target":5837},{"edgeType":"imports","source":15489,"target":15523},{"edgeType":"contains","source":8214,"target":8289},{"edgeType":"calls","source":11284,"target":1616},{"edgeType":"contains","source":12759,"target":13261},{"edgeType":"calls","source":15607,"target":15586},{"edgeType":"contains","source":1331,"target":1801},{"edgeType":"contains","source":9002,"target":9229},{"edgeType":"contains","source":7459,"target":2097},{"edgeType":"calls","source":2922,"target":2943},{"edgeType":"contains","source":7027,"target":7033},{"edgeType":"contains","source":9668,"target":9723},{"edgeType":"contains","source":4120,"target":4132},{"edgeType":"contains","source":12394,"target":3436},{"edgeType":"contains","source":8346,"target":8424},{"edgeType":"contains","source":14953,"target":15027},{"edgeType":"contains","source":3971,"target":4523},{"edgeType":"contains","source":9668,"target":9735},{"edgeType":"contains","source":1331,"target":1806},{"edgeType":"contains","source":7027,"target":7042},{"edgeType":"calls","source":3451,"target":3454},{"edgeType":"contains","source":4640,"target":4932},{"edgeType":"contains","source":4981,"target":4931},{"edgeType":"calls","source":13756,"target":13782},{"edgeType":"contains","source":14952,"target":15042},{"edgeType":"calls","source":1010,"target":904},{"edgeType":"contains","source":742,"target":1038},{"edgeType":"contains","source":10661,"target":10664},{"edgeType":"contains","source":7157,"target":7240},{"edgeType":"calls","source":2460,"target":2464},{"edgeType":"contains","source":1940,"target":1954},{"edgeType":"calls","source":6887,"target":6855},{"edgeType":"contains","source":11451,"target":11542},{"edgeType":"contains","source":13217,"target":13877},{"edgeType":"imports","source":16472,"target":4072},{"edgeType":"calls","source":10976,"target":600},{"edgeType":"contains","source":14033,"target":13935},{"edgeType":"contains","source":1331,"target":1807},{"edgeType":"contains","source":9668,"target":9734},{"edgeType":"calls","source":5499,"target":5502},{"edgeType":"calls","source":9688,"target":358},{"edgeType":"contains","source":10614,"target":5779},{"edgeType":"contains","source":2535,"target":2537},{"edgeType":"calls","source":3061,"target":2861},{"edgeType":"contains","source":10661,"target":10665},{"edgeType":"contains","source":7027,"target":7043},{"edgeType":"contains","source":14492,"target":14505},{"edgeType":"calls","source":10976,"target":601},{"edgeType":"contains","source":10522,"target":2286},{"edgeType":"contains","source":16801,"target":16920},{"edgeType":"contains","source":14050,"target":7079},{"edgeType":"calls","source":7151,"target":7129},{"edgeType":"contains","source":1331,"target":1804},{"edgeType":"calls","source":9133,"target":9110},{"edgeType":"contains","source":12907,"target":12915},{"edgeType":"imports","source":15489,"target":15519},{"edgeType":"contains","source":8001,"target":8562},{"edgeType":"contains","source":14953,"target":15013},{"edgeType":"contains","source":742,"target":1040},{"edgeType":"contains","source":10661,"target":10662},{"edgeType":"calls","source":15776,"target":12473},{"edgeType":"calls","source":10635,"target":601},{"edgeType":"contains","source":11451,"target":11540},{"edgeType":"contains","source":10329,"target":10384},{"edgeType":"contains","source":1331,"target":1805},{"edgeType":"contains","source":8807,"target":8944},{"edgeType":"contains","source":9668,"target":9736},{"edgeType":"contains","source":3392,"target":3449},{"edgeType":"contains","source":8346,"target":8436},{"edgeType":"imports","source":12469,"target":3436},{"edgeType":"contains","source":10661,"target":10663},{"edgeType":"calls","source":416,"target":292},{"edgeType":"contains","source":14492,"target":14507},{"edgeType":"calls","source":4311,"target":4275},{"edgeType":"imports","source":16018,"target":16031},{"edgeType":"contains","source":11451,"target":11541},{"edgeType":"contains","source":1331,"target":1810},{"edgeType":"contains","source":5448,"target":5257},{"edgeType":"imports","source":15489,"target":15513},{"edgeType":"contains","source":11184,"target":11359},{"edgeType":"calls","source":807,"target":850},{"edgeType":"calls","source":11715,"target":11520},{"edgeType":"contains","source":3735,"target":3394},{"edgeType":"contains","source":11451,"target":11538},{"edgeType":"imports","source":7780,"target":808},{"edgeType":"calls","source":8142,"target":8121},{"edgeType":"contains","source":1331,"target":1811},{"edgeType":"contains","source":9668,"target":9730},{"edgeType":"contains","source":3392,"target":3455},{"edgeType":"calls","source":9796,"target":9699},{"edgeType":"contains","source":10522,"target":2285},{"edgeType":"contains","source":13217,"target":13872},{"edgeType":"contains","source":14492,"target":14509},{"edgeType":"calls","source":15623,"target":4526},{"edgeType":"contains","source":4583,"target":4588},{"edgeType":"calls","source":13784,"target":12917},{"edgeType":"calls","source":3012,"target":2261},{"edgeType":"contains","source":16801,"target":16921},{"edgeType":"contains","source":15021,"target":15023},{"edgeType":"contains","source":14953,"target":15017},{"edgeType":"imports","source":7711,"target":832},{"edgeType":"calls","source":10652,"target":10649},{"edgeType":"contains","source":3436,"target":4206},{"edgeType":"contains","source":11451,"target":11539},{"edgeType":"contains","source":9668,"target":9729},{"edgeType":"contains","source":1331,"target":1812},{"edgeType":"calls","source":6665,"target":1058},{"edgeType":"imports","source":10291,"target":3303},{"edgeType":"contains","source":6212,"target":6936},{"edgeType":"contains","source":9668,"target":9733},{"edgeType":"contains","source":1331,"target":1808},{"edgeType":"calls","source":9126,"target":2989},{"edgeType":"calls","source":8934,"target":8941},{"edgeType":"calls","source":13756,"target":13784},{"edgeType":"calls","source":13099,"target":13010},{"edgeType":"contains","source":4640,"target":4934},{"edgeType":"contains","source":15021,"target":15024},{"edgeType":"contains","source":16801,"target":16924},{"edgeType":"contains","source":11451,"target":11536},{"edgeType":"contains","source":14954,"target":14987},{"edgeType":"contains","source":7688,"target":7691},{"edgeType":"contains","source":1331,"target":1809},{"edgeType":"contains","source":9668,"target":9732},{"edgeType":"contains","source":3436,"target":4203},{"edgeType":"contains","source":8259,"target":9015},{"edgeType":"contains","source":3401,"target":3174},{"edgeType":"imports","source":1375,"target":2758},{"edgeType":"contains","source":12378,"target":12396},{"edgeType":"calls","source":2870,"target":2433},{"edgeType":"contains","source":7027,"target":7041},{"edgeType":"contains","source":4640,"target":4933},{"edgeType":"imports","source":5256,"target":5062},{"edgeType":"contains","source":12907,"target":12910},{"edgeType":"contains","source":4583,"target":4586},{"edgeType":"contains","source":4517,"target":4518},{"edgeType":"contains","source":14953,"target":15019},{"edgeType":"contains","source":11451,"target":11537},{"edgeType":"calls","source":9993,"target":9936},{"edgeType":"calls","source":10730,"target":10343},{"edgeType":"contains","source":16078,"target":16082},{"edgeType":"imports","source":12063,"target":11790},{"edgeType":"contains","source":13792,"target":12957},{"edgeType":"contains","source":9668,"target":9731},{"edgeType":"contains","source":3315,"target":3700},{"edgeType":"contains","source":8677,"target":8720},{"edgeType":"contains","source":6297,"target":6392},{"edgeType":"contains","source":2336,"target":2338},{"edgeType":"contains","source":15876,"target":15987},{"edgeType":"contains","source":16013,"target":15968},{"edgeType":"calls","source":1285,"target":793},{"edgeType":"contains","source":3436,"target":4178},{"edgeType":"contains","source":10658,"target":10732},{"edgeType":"calls","source":8408,"target":8304},{"edgeType":"calls","source":10701,"target":642},{"edgeType":"calls","source":609,"target":609},{"edgeType":"calls","source":7152,"target":730},{"edgeType":"calls","source":6992,"target":5690},{"edgeType":"contains","source":3315,"target":3701},{"edgeType":"contains","source":617,"target":659},{"edgeType":"contains","source":15349,"target":15413},{"edgeType":"contains","source":8346,"target":8409},{"edgeType":"calls","source":10999,"target":10433},{"edgeType":"contains","source":6297,"target":6394},{"edgeType":"calls","source":4063,"target":3468},{"edgeType":"contains","source":10658,"target":10733},{"edgeType":"contains","source":8873,"target":8985},{"edgeType":"contains","source":15349,"target":15414},{"edgeType":"calls","source":15078,"target":15059},{"edgeType":"contains","source":11906,"target":12210},{"edgeType":"contains","source":7885,"target":7905},{"edgeType":"calls","source":6035,"target":5756},{"edgeType":"calls","source":6026,"target":6035},{"edgeType":"calls","source":1907,"target":540},{"edgeType":"calls","source":16137,"target":16055},{"edgeType":"contains","source":6212,"target":6916},{"edgeType":"contains","source":8807,"target":8920},{"edgeType":"contains","source":3314,"target":3728},{"edgeType":"contains","source":3315,"target":3697},{"edgeType":"contains","source":617,"target":661},{"edgeType":"contains","source":14952,"target":15037},{"edgeType":"contains","source":2798,"target":2813},{"edgeType":"contains","source":13962,"target":14016},{"edgeType":"contains","source":8259,"target":8994},{"edgeType":"calls","source":7509,"target":4464},{"edgeType":"contains","source":2336,"target":2337},{"edgeType":"contains","source":15483,"target":15489},{"edgeType":"contains","source":6297,"target":6396},{"edgeType":"contains","source":14492,"target":14499},{"edgeType":"contains","source":11848,"target":11893},{"edgeType":"contains","source":10658,"target":10731},{"edgeType":"contains","source":8807,"target":8919},{"edgeType":"contains","source":3314,"target":3729},{"edgeType":"contains","source":3194,"target":3227},{"edgeType":"contains","source":16801,"target":16914},{"edgeType":"contains","source":14952,"target":15038},{"edgeType":"contains","source":14954,"target":14976},{"edgeType":"contains","source":8744,"target":8753},{"edgeType":"contains","source":6297,"target":6388},{"edgeType":"calls","source":3842,"target":3972},{"edgeType":"contains","source":5979,"target":5676},{"edgeType":"calls","source":15390,"target":7495},{"edgeType":"contains","source":5769,"target":5844},{"edgeType":"imports","source":9678,"target":9679},{"edgeType":"contains","source":11848,"target":11892},{"edgeType":"calls","source":1203,"target":1217},{"edgeType":"contains","source":10658,"target":10728},{"edgeType":"contains","source":1331,"target":1786},{"edgeType":"imports","source":16488,"target":16314},{"edgeType":"calls","source":4509,"target":2323},{"edgeType":"contains","source":5375,"target":5380},{"edgeType":"contains","source":16801,"target":16913},{"edgeType":"contains","source":9668,"target":9705},{"edgeType":"contains","source":3315,"target":3705},{"edgeType":"contains","source":8744,"target":8752},{"edgeType":"contains","source":5448,"target":5231},{"edgeType":"contains","source":14952,"target":15039},{"edgeType":"calls","source":1469,"target":1427},{"edgeType":"contains","source":6377,"target":6023},{"edgeType":"contains","source":11848,"target":11891},{"edgeType":"imports","source":2939,"target":2941},{"edgeType":"contains","source":10658,"target":10729},{"edgeType":"contains","source":5769,"target":5845},{"edgeType":"imports","source":15095,"target":15099},{"edgeType":"contains","source":11184,"target":11335},{"edgeType":"contains","source":2924,"target":3141},{"edgeType":"contains","source":3315,"target":3702},{"edgeType":"contains","source":16801,"target":16916},{"edgeType":"contains","source":14953,"target":15009},{"edgeType":"calls","source":15148,"target":14999},{"edgeType":"contains","source":6297,"target":6390},{"edgeType":"contains","source":10328,"target":10385},{"edgeType":"contains","source":742,"target":1019},{"edgeType":"contains","source":11906,"target":12206},{"edgeType":"calls","source":2598,"target":2367},{"edgeType":"imports","source":900,"target":612},{"edgeType":"calls","source":6226,"target":6173},{"edgeType":"contains","source":10658,"target":10726},{"edgeType":"calls","source":8141,"target":8129},{"edgeType":"contains","source":15483,"target":15493},{"edgeType":"contains","source":3314,"target":3734},{"edgeType":"contains","source":8744,"target":8754},{"edgeType":"contains","source":16801,"target":16915},{"edgeType":"contains","source":6297,"target":6391},{"edgeType":"contains","source":742,"target":1018},{"edgeType":"contains","source":10658,"target":10727},{"edgeType":"calls","source":5501,"target":5392},{"edgeType":"contains","source":11848,"target":11889},{"edgeType":"contains","source":14492,"target":14503},{"edgeType":"calls","source":10204,"target":3370},{"edgeType":"contains","source":3788,"target":3844},{"edgeType":"contains","source":10658,"target":10740},{"edgeType":"contains","source":3194,"target":3231},{"edgeType":"contains","source":15747,"target":15750},{"edgeType":"contains","source":15945,"target":15954},{"edgeType":"contains","source":742,"target":1021},{"edgeType":"contains","source":9668,"target":9718},{"edgeType":"contains","source":4120,"target":4123},{"edgeType":"contains","source":2924,"target":3144},{"edgeType":"contains","source":14953,"target":14995},{"edgeType":"calls","source":5171,"target":5050},{"edgeType":"contains","source":8001,"target":8542},{"edgeType":"contains","source":7093,"target":7095},{"edgeType":"contains","source":15945,"target":15955},{"edgeType":"calls","source":3846,"target":3845},{"edgeType":"contains","source":3788,"target":3843},{"edgeType":"calls","source":10593,"target":10343},{"edgeType":"contains","source":742,"target":1020},{"edgeType":"contains","source":9668,"target":9717},{"edgeType":"imports","source":9814,"target":9679},{"edgeType":"contains","source":8807,"target":8925},{"edgeType":"contains","source":10658,"target":10738},{"edgeType":"contains","source":3129,"target":3130},{"edgeType":"contains","source":7093,"target":7096},{"edgeType":"calls","source":15745,"target":15531},{"edgeType":"calls","source":15078,"target":15067},{"edgeType":"imports","source":10142,"target":10080},{"edgeType":"contains","source":9141,"target":9145},{"edgeType":"contains","source":8807,"target":8928},{"edgeType":"contains","source":9668,"target":9720},{"edgeType":"calls","source":9065,"target":9088},{"edgeType":"contains","source":4120,"target":4121},{"edgeType":"contains","source":8001,"target":8546},{"edgeType":"calls","source":11599,"target":6637},{"edgeType":"contains","source":8259,"target":9004},{"edgeType":"contains","source":6212,"target":6924},{"edgeType":"contains","source":2924,"target":3142},{"edgeType":"contains","source":742,"target":1023},{"edgeType":"imports","source":8158,"target":8162},{"edgeType":"contains","source":3194,"target":3230},{"edgeType":"contains","source":7027,"target":7029},{"edgeType":"contains","source":12378,"target":12384},{"edgeType":"contains","source":16801,"target":16903},{"edgeType":"contains","source":9668,"target":9719},{"edgeType":"contains","source":15350,"target":15375},{"edgeType":"contains","source":15349,"target":15406},{"edgeType":"contains","source":3436,"target":4183},{"edgeType":"imports","source":2217,"target":2079},{"edgeType":"contains","source":2924,"target":3143},{"edgeType":"calls","source":1144,"target":929},{"edgeType":"contains","source":742,"target":1022},{"edgeType":"calls","source":10124,"target":10086},{"edgeType":"contains","source":3788,"target":3848},{"edgeType":"calls","source":8142,"target":8105},{"edgeType":"calls","source":14044,"target":13298},{"edgeType":"contains","source":3315,"target":3712},{"edgeType":"contains","source":15349,"target":15407},{"edgeType":"contains","source":4120,"target":4127},{"edgeType":"contains","source":1940,"target":1942},{"edgeType":"contains","source":6297,"target":6397},{"edgeType":"contains","source":7093,"target":7089},{"edgeType":"contains","source":742,"target":1025},{"edgeType":"contains","source":16801,"target":16906},{"edgeType":"imports","source":5256,"target":5108},{"edgeType":"contains","source":14953,"target":14999},{"edgeType":"contains","source":10658,"target":10736},{"edgeType":"calls","source":15080,"target":15000},{"edgeType":"imports","source":10142,"target":10085},{"edgeType":"calls","source":15035,"target":14281},{"edgeType":"imports","source":8158,"target":8168},{"edgeType":"contains","source":3315,"target":3713},{"edgeType":"contains","source":3436,"target":4189},{"edgeType":"contains","source":15349,"target":15408},{"edgeType":"contains","source":14492,"target":14493},{"edgeType":"contains","source":4280,"target":3394},{"edgeType":"calls","source":2986,"target":3018},{"edgeType":"contains","source":742,"target":1024},{"edgeType":"contains","source":10658,"target":10737},{"edgeType":"calls","source":9824,"target":358},{"edgeType":"calls","source":14296,"target":13940},{"edgeType":"contains","source":3788,"target":3846},{"edgeType":"contains","source":15483,"target":15484},{"edgeType":"contains","source":13369,"target":13371},{"edgeType":"imports","source":14470,"target":2758},{"edgeType":"calls","source":4374,"target":4383},{"edgeType":"contains","source":9668,"target":9716},{"edgeType":"contains","source":15349,"target":15409},{"edgeType":"contains","source":742,"target":1027},{"edgeType":"contains","source":8873,"target":8992},{"edgeType":"contains","source":10658,"target":10734},{"edgeType":"contains","source":16801,"target":16908},{"edgeType":"contains","source":3788,"target":3845},{"edgeType":"imports","source":16238,"target":801},{"edgeType":"imports","source":5256,"target":5112},{"edgeType":"calls","source":14351,"target":14348},{"edgeType":"contains","source":5910,"target":5712},{"edgeType":"contains","source":3129,"target":3135},{"edgeType":"imports","source":7708,"target":3091},{"edgeType":"calls","source":8141,"target":8139},{"edgeType":"contains","source":3315,"target":3711},{"edgeType":"contains","source":7885,"target":7908},{"edgeType":"imports","source":14172,"target":14109},{"edgeType":"contains","source":1940,"target":1941},{"edgeType":"contains","source":10616,"target":1467},{"edgeType":"calls","source":14404,"target":2134},{"edgeType":"contains","source":742,"target":1026},{"edgeType":"contains","source":10658,"target":10735},{"edgeType":"contains","source":12706,"target":12782},{"edgeType":"calls","source":15608,"target":15523},{"edgeType":"contains","source":3436,"target":4161},{"edgeType":"contains","source":1331,"target":1765},{"edgeType":"calls","source":8428,"target":3438},{"edgeType":"contains","source":3194,"target":3206},{"edgeType":"contains","source":9002,"target":9199},{"edgeType":"calls","source":609,"target":625},{"edgeType":"contains","source":3314,"target":3714},{"edgeType":"contains","source":8797,"target":9211},{"edgeType":"contains","source":9598,"target":9749},{"edgeType":"calls","source":9197,"target":9197},{"edgeType":"calls","source":5326,"target":271},{"edgeType":"calls","source":6565,"target":6226},{"edgeType":"calls","source":609,"target":624},{"edgeType":"contains","source":3392,"target":3410},{"edgeType":"calls","source":4646,"target":2323},{"edgeType":"contains","source":8797,"target":9210},{"edgeType":"contains","source":14953,"target":14988},{"edgeType":"contains","source":9598,"target":9748},{"edgeType":"imports","source":12063,"target":11833},{"edgeType":"contains","source":9668,"target":9692},{"edgeType":"contains","source":742,"target":995},{"edgeType":"contains","source":13827,"target":13951},{"edgeType":"calls","source":9465,"target":9344},{"edgeType":"contains","source":12256,"target":3459},{"edgeType":"contains","source":11848,"target":11877},{"edgeType":"calls","source":6714,"target":5836},{"edgeType":"contains","source":742,"target":999},{"edgeType":"calls","source":15964,"target":2375},{"edgeType":"contains","source":3510,"target":3979},{"edgeType":"contains","source":16404,"target":16518},{"edgeType":"contains","source":9271,"target":9318},{"edgeType":"contains","source":8807,"target":8904},{"edgeType":"contains","source":1331,"target":1763},{"edgeType":"calls","source":2261,"target":2264},{"edgeType":"calls","source":4310,"target":4282},{"edgeType":"contains","source":14954,"target":14958},{"edgeType":"contains","source":9598,"target":9751},{"edgeType":"contains","source":5771,"target":5772},{"edgeType":"contains","source":13827,"target":13950},{"edgeType":"contains","source":2621,"target":1940},{"edgeType":"contains","source":7885,"target":7889},{"edgeType":"contains","source":6297,"target":6379},{"edgeType":"contains","source":11848,"target":11876},{"edgeType":"contains","source":9271,"target":9317},{"edgeType":"contains","source":16404,"target":16517},{"edgeType":"calls","source":12368,"target":12371},{"edgeType":"contains","source":3385,"target":3625},{"edgeType":"contains","source":617,"target":644},{"edgeType":"imports","source":14172,"target":14105},{"edgeType":"imports","source":9678,"target":3315},{"edgeType":"contains","source":5771,"target":5773},{"edgeType":"contains","source":13827,"target":13949},{"edgeType":"calls","source":9131,"target":9130},{"edgeType":"contains","source":5903,"target":5909},{"edgeType":"calls","source":15359,"target":2097},{"edgeType":"calls","source":6565,"target":6229},{"edgeType":"contains","source":12707,"target":12729},{"edgeType":"calls","source":5300,"target":5301},{"edgeType":"imports","source":8158,"target":8159},{"edgeType":"contains","source":16404,"target":16520},{"edgeType":"contains","source":9598,"target":9745},{"edgeType":"contains","source":3314,"target":3718},{"edgeType":"contains","source":16801,"target":16898},{"edgeType":"contains","source":13827,"target":13948},{"edgeType":"contains","source":15349,"target":15399},{"edgeType":"contains","source":5969,"target":5970},{"edgeType":"calls","source":1759,"target":910},{"edgeType":"imports","source":7006,"target":5816},{"edgeType":"calls","source":1203,"target":1233},{"edgeType":"calls","source":5234,"target":5232},{"edgeType":"contains","source":15945,"target":15951},{"edgeType":"contains","source":4780,"target":4782},{"edgeType":"contains","source":16404,"target":16519},{"edgeType":"contains","source":2721,"target":3076},{"edgeType":"contains","source":10975,"target":11456},{"edgeType":"calls","source":8140,"target":8143},{"edgeType":"calls","source":2261,"target":2263},{"edgeType":"contains","source":9598,"target":9744},{"edgeType":"contains","source":16801,"target":16897},{"edgeType":"contains","source":3314,"target":3719},{"edgeType":"contains","source":8001,"target":8514},{"edgeType":"calls","source":6687,"target":6677},{"edgeType":"contains","source":13827,"target":13947},{"edgeType":"contains","source":5969,"target":5971},{"edgeType":"contains","source":8076,"target":8303},{"edgeType":"contains","source":6297,"target":6373},{"edgeType":"calls","source":12962,"target":12989},{"edgeType":"contains","source":15747,"target":15748},{"edgeType":"contains","source":11848,"target":11873},{"edgeType":"contains","source":15945,"target":15952},{"edgeType":"contains","source":617,"target":650},{"edgeType":"contains","source":9002,"target":9197},{"edgeType":"contains","source":1331,"target":1767},{"edgeType":"contains","source":1406,"target":1556},{"edgeType":"contains","source":4780,"target":4781},{"edgeType":"contains","source":13495,"target":13668},{"edgeType":"contains","source":3194,"target":3208},{"edgeType":"calls","source":16133,"target":16159},{"edgeType":"contains","source":9598,"target":9747},{"edgeType":"calls","source":4345,"target":1079},{"edgeType":"contains","source":13827,"target":13946},{"edgeType":"contains","source":5903,"target":5904},{"edgeType":"calls","source":1799,"target":1786},{"edgeType":"calls","source":3318,"target":3319},{"edgeType":"contains","source":3436,"target":4162},{"edgeType":"contains","source":9002,"target":9196},{"edgeType":"contains","source":15945,"target":15953},{"edgeType":"calls","source":12039,"target":12004},{"edgeType":"contains","source":9598,"target":9746},{"edgeType":"calls","source":2274,"target":1858},{"edgeType":"contains","source":1715,"target":2549},{"edgeType":"contains","source":6297,"target":6375},{"edgeType":"contains","source":15349,"target":15402},{"edgeType":"calls","source":16134,"target":16138},{"edgeType":"calls","source":1539,"target":1384},{"edgeType":"contains","source":617,"target":652},{"edgeType":"contains","source":8744,"target":8749},{"edgeType":"contains","source":552,"target":553},{"edgeType":"contains","source":4780,"target":4787},{"edgeType":"calls","source":4468,"target":3606},{"edgeType":"contains","source":11848,"target":11888},{"edgeType":"contains","source":3314,"target":3722},{"edgeType":"calls","source":10456,"target":10343},{"edgeType":"contains","source":5639,"target":5642},{"edgeType":"calls","source":6338,"target":601},{"edgeType":"calls","source":11321,"target":11013},{"edgeType":"calls","source":15142,"target":15180},{"edgeType":"contains","source":617,"target":651},{"edgeType":"calls","source":9595,"target":9550},{"edgeType":"imports","source":9090,"target":2510},{"edgeType":"contains","source":10658,"target":10725},{"edgeType":"contains","source":5769,"target":5841},{"edgeType":"calls","source":10704,"target":540},{"edgeType":"contains","source":3314,"target":3723},{"edgeType":"imports","source":8030,"target":7888},{"edgeType":"calls","source":6756,"target":6656},{"edgeType":"calls","source":6835,"target":6321},{"edgeType":"contains","source":3436,"target":4167},{"edgeType":"imports","source":7963,"target":7847},{"edgeType":"contains","source":1406,"target":1560},{"edgeType":"contains","source":552,"target":555},{"edgeType":"contains","source":14953,"target":14980},{"edgeType":"contains","source":617,"target":654},{"edgeType":"contains","source":2798,"target":2804},{"edgeType":"calls","source":2459,"target":2460},{"edgeType":"contains","source":12759,"target":13242},{"edgeType":"contains","source":12392,"target":3478},{"edgeType":"contains","source":3314,"target":3720},{"edgeType":"calls","source":15014,"target":14921},{"edgeType":"calls","source":3654,"target":3468},{"edgeType":"imports","source":230,"target":237},{"edgeType":"calls","source":2642,"target":1015},{"edgeType":"calls","source":6924,"target":5677},{"edgeType":"calls","source":13202,"target":3438},{"edgeType":"calls","source":14021,"target":13987},{"edgeType":"contains","source":3436,"target":4166},{"edgeType":"contains","source":8873,"target":8979},{"edgeType":"calls","source":2642,"target":1016},{"edgeType":"contains","source":552,"target":554},{"edgeType":"contains","source":6297,"target":6387},{"edgeType":"calls","source":11455,"target":11085},{"edgeType":"contains","source":2924,"target":3127},{"edgeType":"contains","source":15086,"target":15087},{"edgeType":"contains","source":5769,"target":5843},{"edgeType":"calls","source":10981,"target":10981},{"edgeType":"contains","source":3314,"target":3721},{"edgeType":"calls","source":3995,"target":3468},{"edgeType":"calls","source":8998,"target":9033},{"edgeType":"calls","source":8801,"target":8798},{"edgeType":"contains","source":7847,"target":612},{"edgeType":"contains","source":10328,"target":10379},{"edgeType":"calls","source":2986,"target":3033},{"edgeType":"calls","source":1418,"target":903},{"edgeType":"contains","source":552,"target":557},{"edgeType":"contains","source":1715,"target":2558},{"edgeType":"contains","source":11848,"target":11884},{"edgeType":"calls","source":15015,"target":2206},{"edgeType":"contains","source":6297,"target":6381},{"edgeType":"contains","source":15086,"target":15089},{"edgeType":"contains","source":552,"target":556},{"edgeType":"contains","source":14954,"target":14952},{"edgeType":"contains","source":617,"target":655},{"edgeType":"contains","source":8807,"target":8905},{"edgeType":"calls","source":6701,"target":6251},{"edgeType":"contains","source":9271,"target":9319},{"edgeType":"contains","source":16077,"target":16078},{"edgeType":"contains","source":3436,"target":4173},{"edgeType":"contains","source":1406,"target":1564},{"edgeType":"contains","source":4780,"target":4789},{"edgeType":"contains","source":15350,"target":15362},{"edgeType":"calls","source":894,"target":236},{"edgeType":"contains","source":10919,"target":11083},{"edgeType":"contains","source":14954,"target":14953},{"edgeType":"imports","source":9090,"target":2511},{"edgeType":"contains","source":9547,"target":9222},{"edgeType":"contains","source":5639,"target":5640},{"edgeType":"contains","source":11848,"target":11882},{"edgeType":"contains","source":4780,"target":4788},{"edgeType":"contains","source":10328,"target":10378},{"edgeType":"imports","source":15130,"target":5535},{"edgeType":"contains","source":4143,"target":3394},{"edgeType":"contains","source":15349,"target":15394},{"edgeType":"imports","source":9220,"target":597},{"edgeType":"contains","source":15072,"target":4954},{"edgeType":"calls","source":3690,"target":2349},{"edgeType":"calls","source":3656,"target":3403},{"edgeType":"calls","source":1534,"target":1536},{"edgeType":"contains","source":552,"target":558},{"edgeType":"contains","source":10658,"target":10718},{"edgeType":"contains","source":16801,"target":16890},{"edgeType":"calls","source":13029,"target":13032},{"edgeType":"imports","source":14172,"target":3523},{"edgeType":"contains","source":3314,"target":3725},{"edgeType":"contains","source":13963,"target":13965},{"edgeType":"calls","source":6367,"target":6037},{"edgeType":"imports","source":10292,"target":3303},{"edgeType":"contains","source":11848,"target":11881},{"edgeType":"contains","source":5639,"target":5641},{"edgeType":"contains","source":2734,"target":2651},{"edgeType":"calls","source":15219,"target":15013},{"edgeType":"contains","source":8677,"target":8687},{"edgeType":"calls","source":7653,"target":2210},{"edgeType":"contains","source":8001,"target":8502},{"edgeType":"contains","source":485,"target":491},{"edgeType":"contains","source":8076,"target":8291},{"edgeType":"contains","source":5769,"target":5815},{"edgeType":"contains","source":16473,"target":16475},{"edgeType":"calls","source":10636,"target":642},{"edgeType":"calls","source":5723,"target":730},{"edgeType":"contains","source":8677,"target":8686},{"edgeType":"contains","source":11386,"target":11387},{"edgeType":"calls","source":3328,"target":3098},{"edgeType":"calls","source":12570,"target":12569},{"edgeType":"calls","source":5328,"target":290},{"edgeType":"contains","source":485,"target":490},{"edgeType":"contains","source":16473,"target":16474},{"edgeType":"calls","source":3980,"target":4026},{"edgeType":"contains","source":3436,"target":4144},{"edgeType":"calls","source":2594,"target":2597},{"edgeType":"contains","source":14425,"target":14427},{"edgeType":"contains","source":3522,"target":3592},{"edgeType":"contains","source":3510,"target":3964},{"edgeType":"contains","source":10922,"target":10972},{"edgeType":"imports","source":15620,"target":15513},{"edgeType":"calls","source":11711,"target":11712},{"edgeType":"calls","source":1640,"target":460},{"edgeType":"calls","source":14753,"target":14663},{"edgeType":"contains","source":3788,"target":3801},{"edgeType":"contains","source":10808,"target":6047},{"edgeType":"contains","source":3510,"target":3963},{"edgeType":"calls","source":2392,"target":400},{"edgeType":"contains","source":16801,"target":16879},{"edgeType":"calls","source":6296,"target":6226},{"edgeType":"contains","source":14425,"target":14428},{"edgeType":"contains","source":16473,"target":16477},{"edgeType":"contains","source":1331,"target":1747},{"edgeType":"contains","source":1406,"target":1536},{"edgeType":"imports","source":5256,"target":4883},{"edgeType":"calls","source":14552,"target":14546},{"edgeType":"calls","source":12570,"target":12567},{"edgeType":"contains","source":15350,"target":15351},{"edgeType":"calls","source":11188,"target":11013},{"edgeType":"contains","source":3788,"target":3800},{"edgeType":"calls","source":10192,"target":10179},{"edgeType":"contains","source":16473,"target":16476},{"edgeType":"calls","source":6240,"target":5841},{"edgeType":"contains","source":1331,"target":1748},{"edgeType":"contains","source":11576,"target":11834},{"edgeType":"calls","source":4642,"target":4641},{"edgeType":"contains","source":10522,"target":10683},{"edgeType":"contains","source":1621,"target":1219},{"edgeType":"contains","source":10808,"target":6045},{"edgeType":"contains","source":11848,"target":11859},{"edgeType":"contains","source":3436,"target":4149},{"edgeType":"contains","source":1331,"target":1753},{"edgeType":"contains","source":11532,"target":11083},{"edgeType":"contains","source":14470,"target":8807},{"edgeType":"contains","source":15160,"target":4330},{"edgeType":"contains","source":10922,"target":10968},{"edgeType":"contains","source":2632,"target":1590},{"edgeType":"contains","source":8676,"target":8713},{"edgeType":"imports","source":6305,"target":6191},{"edgeType":"imports","source":14033,"target":13965},{"edgeType":"contains","source":11848,"target":11858},{"edgeType":"calls","source":6296,"target":6229},{"edgeType":"contains","source":16473,"target":16478},{"edgeType":"contains","source":2621,"target":1928},{"edgeType":"contains","source":9470,"target":9471},{"edgeType":"calls","source":10433,"target":600},{"edgeType":"contains","source":13659,"target":4339},{"edgeType":"contains","source":10808,"target":6043},{"edgeType":"contains","source":5659,"target":7109},{"edgeType":"contains","source":11848,"target":11857},{"edgeType":"calls","source":9202,"target":9164},{"edgeType":"contains","source":1331,"target":1751},{"edgeType":"contains","source":8797,"target":9192},{"edgeType":"contains","source":3788,"target":3804},{"edgeType":"calls","source":10596,"target":10343},{"edgeType":"contains","source":3436,"target":4146},{"edgeType":"contains","source":3385,"target":3613},{"edgeType":"contains","source":1331,"target":1752},{"edgeType":"contains","source":10658,"target":10707},{"edgeType":"calls","source":7425,"target":7172},{"edgeType":"contains","source":3315,"target":1561},{"edgeType":"contains","source":11848,"target":11871},{"edgeType":"imports","source":1768,"target":971},{"edgeType":"calls","source":1935,"target":1875},{"edgeType":"contains","source":13377,"target":13096},{"edgeType":"contains","source":9668,"target":9685},{"edgeType":"contains","source":3522,"target":3601},{"edgeType":"contains","source":13827,"target":13944},{"edgeType":"calls","source":6295,"target":6263},{"edgeType":"calls","source":744,"target":743},{"edgeType":"contains","source":9271,"target":9307},{"edgeType":"calls","source":6569,"target":6226},{"edgeType":"contains","source":9470,"target":9480},{"edgeType":"contains","source":11848,"target":11870},{"edgeType":"contains","source":9598,"target":9740},{"edgeType":"contains","source":11386,"target":11395},{"edgeType":"calls","source":13956,"target":14005},{"edgeType":"contains","source":3436,"target":4152},{"edgeType":"contains","source":14073,"target":14760},{"edgeType":"calls","source":1277,"target":1131},{"edgeType":"contains","source":13173,"target":13076},{"edgeType":"contains","source":13827,"target":13943},{"edgeType":"calls","source":807,"target":903},{"edgeType":"contains","source":2626,"target":1780},{"edgeType":"calls","source":4642,"target":4636},{"edgeType":"calls","source":5104,"target":5111},{"edgeType":"contains","source":11386,"target":11392},{"edgeType":"contains","source":12707,"target":12723},{"edgeType":"calls","source":14486,"target":14487},{"edgeType":"calls","source":8622,"target":8121},{"edgeType":"contains","source":11848,"target":11869},{"edgeType":"contains","source":9470,"target":9483},{"edgeType":"contains","source":16141,"target":16190},{"edgeType":"contains","source":9598,"target":9743},{"edgeType":"contains","source":8001,"target":8513},{"edgeType":"calls","source":15494,"target":2271},{"edgeType":"contains","source":10922,"target":10977},{"edgeType":"calls","source":6718,"target":5837},{"edgeType":"calls","source":5104,"target":5110},{"edgeType":"contains","source":7157,"target":7194},{"edgeType":"contains","source":7026,"target":7027},{"edgeType":"imports","source":14470,"target":8872},{"edgeType":"contains","source":11848,"target":11868},{"edgeType":"contains","source":1715,"target":2536},{"edgeType":"contains","source":16141,"target":16189},{"edgeType":"contains","source":9668,"target":9686},{"edgeType":"contains","source":10922,"target":10978},{"edgeType":"contains","source":1331,"target":1756},{"edgeType":"calls","source":11455,"target":11206},{"edgeType":"contains","source":8677,"target":8691},{"edgeType":"contains","source":2923,"target":3147},{"edgeType":"contains","source":9598,"target":9737},{"edgeType":"contains","source":12256,"target":3447},{"edgeType":"calls","source":6569,"target":6229},{"edgeType":"contains","source":3385,"target":3624},{"edgeType":"imports","source":15619,"target":15529},{"edgeType":"calls","source":15704,"target":2097},{"edgeType":"contains","source":14953,"target":14966},{"edgeType":"contains","source":8001,"target":8505},{"edgeType":"contains","source":8677,"target":8690},{"edgeType":"imports","source":11788,"target":11680},{"edgeType":"imports","source":15503,"target":4326},{"edgeType":"contains","source":16141,"target":16191},{"edgeType":"contains","source":1331,"target":1762},{"edgeType":"contains","source":1876,"target":1780},{"edgeType":"imports","source":15484,"target":15485},{"edgeType":"contains","source":8807,"target":8888},{"edgeType":"contains","source":14953,"target":14967},{"edgeType":"contains","source":1,"target":7053},{"edgeType":"contains","source":13495,"target":13660},{"edgeType":"contains","source":11386,"target":11388},{"edgeType":"contains","source":9470,"target":9479},{"edgeType":"contains","source":15349,"target":15376},{"edgeType":"contains","source":8807,"target":8891},{"edgeType":"contains","source":12759,"target":13221},{"edgeType":"calls","source":11455,"target":11205},{"edgeType":"contains","source":11386,"target":11389},{"edgeType":"calls","source":1418,"target":986},{"edgeType":"calls","source":10132,"target":1481},{"edgeType":"contains","source":13378,"target":13057},{"edgeType":"calls","source":1536,"target":1556},{"edgeType":"contains","source":8797,"target":9200},{"edgeType":"imports","source":12907,"target":2349},{"edgeType":"calls","source":14287,"target":14291},{"edgeType":"contains","source":10808,"target":6032},{"edgeType":"contains","source":3436,"target":4128},{"edgeType":"calls","source":11845,"target":11772},{"edgeType":"contains","source":3522,"target":3576},{"edgeType":"contains","source":3510,"target":3948},{"edgeType":"contains","source":10922,"target":10955},{"edgeType":"contains","source":10919,"target":11048},{"edgeType":"contains","source":1406,"target":1521},{"edgeType":"contains","source":6212,"target":6864},{"edgeType":"contains","source":16142,"target":16149},{"edgeType":"contains","source":16141,"target":16180},{"edgeType":"imports","source":882,"target":928},{"edgeType":"contains","source":8001,"target":8486},{"edgeType":"imports","source":2618,"target":2079},{"edgeType":"contains","source":13962,"target":13964},{"edgeType":"contains","source":1,"target":15478},{"edgeType":"contains","source":10522,"target":10671},{"edgeType":"contains","source":3510,"target":3947},{"edgeType":"contains","source":10815,"target":5816},{"edgeType":"contains","source":1406,"target":1522},{"edgeType":"calls","source":15676,"target":15629},{"edgeType":"calls","source":8411,"target":8292},{"edgeType":"contains","source":7157,"target":7167},{"edgeType":"contains","source":608,"target":888},{"edgeType":"calls","source":2070,"target":1945},{"edgeType":"contains","source":14953,"target":14955},{"edgeType":"contains","source":9598,"target":9715},{"edgeType":"calls","source":4929,"target":2106},{"edgeType":"calls","source":3982,"target":3978},{"edgeType":"contains","source":3522,"target":3574},{"edgeType":"contains","source":3510,"target":3946},{"edgeType":"contains","source":3596,"target":3394},{"edgeType":"calls","source":11978,"target":11875},{"edgeType":"contains","source":3436,"target":4126},{"edgeType":"contains","source":7157,"target":7168},{"edgeType":"imports","source":9472,"target":9469},{"edgeType":"contains","source":608,"target":891},{"edgeType":"contains","source":7458,"target":8407},{"edgeType":"calls","source":14552,"target":14530},{"edgeType":"contains","source":16142,"target":16151},{"edgeType":"contains","source":16141,"target":16182},{"edgeType":"contains","source":7884,"target":7887},{"edgeType":"contains","source":4640,"target":4855},{"edgeType":"contains","source":15876,"target":15941},{"edgeType":"calls","source":9866,"target":9699},{"edgeType":"imports","source":9472,"target":9470},{"edgeType":"contains","source":9091,"target":2180},{"edgeType":"contains","source":10922,"target":10954},{"edgeType":"contains","source":3522,"target":3573},{"edgeType":"calls","source":745,"target":738},{"edgeType":"contains","source":2070,"target":2077},{"edgeType":"contains","source":3986,"target":3988},{"edgeType":"contains","source":14073,"target":14754},{"edgeType":"contains","source":16141,"target":16181},{"edgeType":"calls","source":5115,"target":4794},{"edgeType":"contains","source":7884,"target":7886},{"edgeType":"contains","source":13962,"target":13967},{"edgeType":"calls","source":6756,"target":6749},{"edgeType":"calls","source":9067,"target":9099},{"edgeType":"contains","source":7885,"target":7849},{"edgeType":"calls","source":6166,"target":6037},{"edgeType":"contains","source":7026,"target":6995},{"edgeType":"imports","source":13506,"target":13373},{"edgeType":"contains","source":1331,"target":1736},{"edgeType":"calls","source":7687,"target":7486},{"edgeType":"contains","source":16801,"target":16864},{"edgeType":"contains","source":15562,"target":15105},{"edgeType":"contains","source":6164,"target":6234},{"edgeType":"contains","source":9598,"target":9712},{"edgeType":"contains","source":608,"target":893},{"edgeType":"contains","source":16141,"target":16184},{"edgeType":"calls","source":10772,"target":642},{"edgeType":"contains","source":6212,"target":6860},{"edgeType":"calls","source":1800,"target":1852},{"edgeType":"contains","source":3986,"target":3995},{"edgeType":"calls","source":10590,"target":10514},{"edgeType":"calls","source":5237,"target":5238},{"edgeType":"contains","source":1406,"target":1526},{"edgeType":"contains","source":11906,"target":12157},{"edgeType":"calls","source":14191,"target":13042},{"edgeType":"calls","source":1273,"target":1276},{"edgeType":"contains","source":12759,"target":13197},{"edgeType":"contains","source":1331,"target":1737},{"edgeType":"calls","source":11709,"target":11765},{"edgeType":"contains","source":10919,"target":11044},{"edgeType":"contains","source":16141,"target":16183},{"edgeType":"calls","source":2138,"target":1947},{"edgeType":"contains","source":608,"target":892},{"edgeType":"contains","source":14073,"target":14756},{"edgeType":"calls","source":6756,"target":6751},{"edgeType":"contains","source":3986,"target":3994},{"edgeType":"calls","source":6956,"target":6893},{"edgeType":"calls","source":10722,"target":10651},{"edgeType":"contains","source":7157,"target":7164},{"edgeType":"contains","source":3522,"target":3578},{"edgeType":"imports","source":13506,"target":13375},{"edgeType":"contains","source":608,"target":896},{"edgeType":"calls","source":2264,"target":2266},{"edgeType":"calls","source":2138,"target":1944},{"edgeType":"contains","source":608,"target":895},{"edgeType":"contains","source":3788,"target":3789},{"edgeType":"imports","source":882,"target":922},{"edgeType":"calls","source":11978,"target":11880},{"edgeType":"calls","source":1075,"target":1074},{"edgeType":"contains","source":1331,"target":1735},{"edgeType":"contains","source":1406,"target":1524},{"edgeType":"contains","source":3385,"target":3596},{"edgeType":"contains","source":7157,"target":7165},{"edgeType":"calls","source":4646,"target":4530},{"edgeType":"contains","source":1,"target":15483},{"edgeType":"contains","source":16141,"target":16185},{"edgeType":"calls","source":12532,"target":3162},{"edgeType":"contains","source":10130,"target":10133},{"edgeType":"calls","source":10722,"target":10649},{"edgeType":"contains","source":6212,"target":6872},{"edgeType":"calls","source":6096,"target":6089},{"edgeType":"contains","source":9668,"target":9669},{"edgeType":"contains","source":3510,"target":3956},{"edgeType":"contains","source":10922,"target":10963},{"edgeType":"calls","source":6370,"target":6035},{"edgeType":"contains","source":1406,"target":1529},{"edgeType":"calls","source":480,"target":487},{"edgeType":"calls","source":7152,"target":7162},{"edgeType":"contains","source":13922,"target":15195},{"edgeType":"contains","source":1331,"target":1740},{"edgeType":"calls","source":9134,"target":9143},{"edgeType":"contains","source":2924,"target":3095},{"edgeType":"contains","source":8677,"target":8679},{"edgeType":"contains","source":10659,"target":10660},{"edgeType":"contains","source":7157,"target":7174},{"edgeType":"contains","source":11848,"target":11855},{"edgeType":"contains","source":3788,"target":3795},{"edgeType":"contains","source":3510,"target":3955},{"edgeType":"contains","source":13922,"target":15196},{"edgeType":"contains","source":10922,"target":10964},{"edgeType":"contains","source":608,"target":897},{"edgeType":"calls","source":8124,"target":286},{"edgeType":"contains","source":1055,"target":1838},{"edgeType":"contains","source":15150,"target":15182},{"edgeType":"contains","source":8677,"target":8678},{"edgeType":"imports","source":14871,"target":2765},{"edgeType":"imports","source":3265,"target":3170},{"edgeType":"contains","source":12707,"target":12708},{"edgeType":"calls","source":15676,"target":15638},{"edgeType":"calls","source":8147,"target":8029},{"edgeType":"calls","source":12048,"target":11830},{"edgeType":"imports","source":2434,"target":1448},{"edgeType":"contains","source":11848,"target":11854},{"edgeType":"contains","source":3986,"target":3998},{"edgeType":"contains","source":1,"target":690},{"edgeType":"contains","source":9668,"target":9671},{"edgeType":"contains","source":13922,"target":15197},{"edgeType":"contains","source":1331,"target":1738},{"edgeType":"contains","source":10857,"target":10862},{"edgeType":"contains","source":10808,"target":6038},{"edgeType":"contains","source":7157,"target":7176},{"edgeType":"imports","source":1779,"target":612},{"edgeType":"contains","source":11848,"target":11853},{"edgeType":"contains","source":3986,"target":3997},{"edgeType":"contains","source":16142,"target":16143},{"edgeType":"contains","source":16141,"target":16172},{"edgeType":"contains","source":9668,"target":9670},{"edgeType":"contains","source":4210,"target":3394},{"edgeType":"contains","source":13922,"target":15198},{"edgeType":"contains","source":10922,"target":10962},{"edgeType":"contains","source":1331,"target":1739},{"edgeType":"contains","source":3522,"target":3581},{"edgeType":"contains","source":1406,"target":1528},{"edgeType":"calls","source":415,"target":389},{"edgeType":"contains","source":617,"target":620},{"edgeType":"calls","source":2946,"target":2261},{"edgeType":"calls","source":15557,"target":4530},{"edgeType":"contains","source":7157,"target":7177},{"edgeType":"contains","source":8001,"target":8495},{"edgeType":"contains","source":3986,"target":3996},{"edgeType":"contains","source":16141,"target":16173},{"edgeType":"imports","source":15619,"target":15513},{"edgeType":"contains","source":13922,"target":15199},{"edgeType":"calls","source":1471,"target":1473},{"edgeType":"contains","source":3971,"target":4468},{"edgeType":"contains","source":10922,"target":10959},{"edgeType":"contains","source":10857,"target":10860},{"edgeType":"imports","source":15762,"target":15308},{"edgeType":"contains","source":3788,"target":3799},{"edgeType":"contains","source":16472,"target":16485},{"edgeType":"contains","source":1406,"target":1534},{"edgeType":"calls","source":12308,"target":12229},{"edgeType":"contains","source":13922,"target":15200},{"edgeType":"calls","source":6166,"target":6028},{"edgeType":"contains","source":3436,"target":4139},{"edgeType":"contains","source":3971,"target":4467},{"edgeType":"contains","source":7157,"target":7171},{"edgeType":"contains","source":485,"target":486},{"edgeType":"contains","source":10922,"target":10960},{"edgeType":"contains","source":8807,"target":8872},{"edgeType":"contains","source":15240,"target":8168},{"edgeType":"contains","source":3788,"target":3798},{"edgeType":"calls","source":6756,"target":6759},{"edgeType":"contains","source":7458,"target":8410},{"edgeType":"contains","source":3508,"target":4022},{"edgeType":"contains","source":3436,"target":4138},{"edgeType":"contains","source":13922,"target":15201},{"edgeType":"contains","source":1331,"target":1742},{"edgeType":"calls","source":10994,"target":10680},{"edgeType":"contains","source":10922,"target":10957},{"edgeType":"contains","source":485,"target":489},{"edgeType":"contains","source":10857,"target":10858},{"edgeType":"contains","source":3788,"target":3797},{"edgeType":"contains","source":5108,"target":5158},{"edgeType":"calls","source":131,"target":734},{"edgeType":"contains","source":14073,"target":14749},{"edgeType":"contains","source":16142,"target":16147},{"edgeType":"contains","source":3508,"target":4021},{"edgeType":"contains","source":11848,"target":11849},{"edgeType":"contains","source":13922,"target":15202},{"edgeType":"calls","source":6241,"target":5815},{"edgeType":"imports","source":13506,"target":13368},{"edgeType":"contains","source":3510,"target":3957},{"edgeType":"contains","source":3436,"target":4137},{"edgeType":"contains","source":10522,"target":10673},{"edgeType":"calls","source":8936,"target":8944},{"edgeType":"contains","source":1,"target":693},{"edgeType":"calls","source":2741,"target":156},{"edgeType":"contains","source":2923,"target":3129},{"edgeType":"contains","source":485,"target":488},{"edgeType":"contains","source":15150,"target":15188},{"edgeType":"contains","source":10857,"target":10859},{"edgeType":"contains","source":3788,"target":3796},{"edgeType":"calls","source":286,"target":156},{"edgeType":"calls","source":2462,"target":2463},{"edgeType":"contains","source":8001,"target":8491},{"edgeType":"contains","source":7157,"target":7173},{"edgeType":"contains","source":9271,"target":9288},{"edgeType":"contains","source":16472,"target":16486},{"edgeType":"contains","source":16141,"target":16177},{"edgeType":"calls","source":14435,"target":13940},{"edgeType":"contains","source":3971,"target":4439},{"edgeType":"contains","source":14073,"target":14734},{"edgeType":"calls","source":9142,"target":8870},{"edgeType":"contains","source":11185,"target":11241},{"edgeType":"calls","source":8012,"target":7960},{"edgeType":"contains","source":16472,"target":16473},{"edgeType":"contains","source":1406,"target":1505},{"edgeType":"calls","source":8278,"target":8172},{"edgeType":"contains","source":5439,"target":5440},{"edgeType":"contains","source":2619,"target":1956},{"edgeType":"contains","source":3971,"target":4438},{"edgeType":"contains","source":11451,"target":11453},{"edgeType":"calls","source":15698,"target":2246},{"edgeType":"contains","source":8001,"target":8468},{"edgeType":"contains","source":11185,"target":11242},{"edgeType":"contains","source":11935,"target":11246},{"edgeType":"contains","source":3788,"target":3769},{"edgeType":"contains","source":15352,"target":15253},{"edgeType":"contains","source":3523,"target":3528},{"edgeType":"contains","source":1406,"target":1506},{"edgeType":"contains","source":14424,"target":14425},{"edgeType":"imports","source":1167,"target":600},{"edgeType":"calls","source":2354,"target":1548},{"edgeType":"contains","source":3971,"target":4437},{"edgeType":"contains","source":1,"target":13350},{"edgeType":"contains","source":8001,"target":8471},{"edgeType":"calls","source":13458,"target":4032},{"edgeType":"contains","source":5108,"target":5129},{"edgeType":"calls","source":413,"target":411},{"edgeType":"calls","source":11102,"target":3075},{"edgeType":"calls","source":6226,"target":6243},{"edgeType":"contains","source":1406,"target":1503},{"edgeType":"contains","source":11184,"target":11270},{"edgeType":"calls","source":744,"target":719},{"edgeType":"calls","source":10389,"target":10382},{"edgeType":"contains","source":14073,"target":14737},{"edgeType":"contains","source":9598,"target":9701},{"edgeType":"contains","source":3971,"target":4436},{"edgeType":"imports","source":10069,"target":10038},{"edgeType":"contains","source":8001,"target":8470},{"edgeType":"imports","source":15758,"target":15495},{"edgeType":"contains","source":10522,"target":10653},{"edgeType":"contains","source":5108,"target":5128},{"edgeType":"contains","source":13350,"target":13888},{"edgeType":"imports","source":4323,"target":4244},{"edgeType":"calls","source":9688,"target":402},{"edgeType":"contains","source":3853,"target":3866},{"edgeType":"contains","source":12759,"target":13183},{"edgeType":"calls","source":6227,"target":6211},{"edgeType":"imports","source":9529,"target":1410},{"edgeType":"contains","source":3523,"target":3526},{"edgeType":"contains","source":5307,"target":5309},{"edgeType":"contains","source":6760,"target":6768},{"edgeType":"contains","source":14073,"target":14738},{"edgeType":"calls","source":2338,"target":2038},{"edgeType":"contains","source":15349,"target":15350},{"edgeType":"calls","source":3724,"target":3468},{"edgeType":"contains","source":3853,"target":3873},{"edgeType":"calls","source":7152,"target":7141},{"edgeType":"calls","source":11978,"target":11864},{"edgeType":"calls","source":12635,"target":12639},{"edgeType":"contains","source":10522,"target":10650},{"edgeType":"contains","source":9799,"target":9808},{"edgeType":"calls","source":10125,"target":10112},{"edgeType":"imports","source":3263,"target":3270},{"edgeType":"contains","source":5307,"target":5308},{"edgeType":"contains","source":9002,"target":9144},{"edgeType":"contains","source":608,"target":876},{"edgeType":"contains","source":6760,"target":6769},{"edgeType":"contains","source":14073,"target":14739},{"edgeType":"contains","source":16141,"target":16166},{"edgeType":"calls","source":6636,"target":6226},{"edgeType":"contains","source":3853,"target":3872},{"edgeType":"calls","source":12635,"target":12638},{"edgeType":"contains","source":12041,"target":12184},{"edgeType":"contains","source":3523,"target":3532},{"edgeType":"contains","source":1406,"target":1510},{"edgeType":"contains","source":12706,"target":12710},{"edgeType":"contains","source":15150,"target":15177},{"edgeType":"contains","source":1331,"target":1721},{"edgeType":"contains","source":11185,"target":11238},{"edgeType":"calls","source":13403,"target":3627},{"edgeType":"contains","source":16142,"target":16138},{"edgeType":"contains","source":16141,"target":16169},{"edgeType":"imports","source":14470,"target":8910},{"edgeType":"calls","source":10403,"target":1497},{"edgeType":"contains","source":6760,"target":6770},{"edgeType":"calls","source":2338,"target":2036},{"edgeType":"contains","source":13922,"target":15193},{"edgeType":"contains","source":6212,"target":6845},{"edgeType":"calls","source":15358,"target":2213},{"edgeType":"contains","source":12706,"target":12709},{"edgeType":"contains","source":12041,"target":12183},{"edgeType":"contains","source":3523,"target":3531},{"edgeType":"contains","source":14424,"target":14430},{"edgeType":"contains","source":16472,"target":16479},{"edgeType":"contains","source":9598,"target":9697},{"edgeType":"calls","source":12075,"target":400},{"edgeType":"contains","source":16141,"target":16168},{"edgeType":"contains","source":13922,"target":15194},{"edgeType":"contains","source":6212,"target":6846},{"edgeType":"calls","source":10933,"target":10433},{"edgeType":"contains","source":10658,"target":10661},{"edgeType":"calls","source":3980,"target":3987},{"edgeType":"calls","source":15419,"target":15122},{"edgeType":"contains","source":3510,"target":3933},{"edgeType":"contains","source":1406,"target":1508},{"edgeType":"contains","source":13367,"target":13357},{"edgeType":"calls","source":1734,"target":1731},{"edgeType":"imports","source":3395,"target":3403},{"edgeType":"calls","source":6636,"target":6229},{"edgeType":"contains","source":4184,"target":4187},{"edgeType":"calls","source":4045,"target":4083},{"edgeType":"contains","source":4118,"target":4119},{"edgeType":"calls","source":3518,"target":3507},{"edgeType":"calls","source":3521,"target":3414},{"edgeType":"contains","source":1331,"target":1724},{"edgeType":"calls","source":10865,"target":10433},{"edgeType":"contains","source":8001,"target":8476},{"edgeType":"contains","source":15150,"target":15165},{"edgeType":"imports","source":15758,"target":15485},{"edgeType":"contains","source":5307,"target":5312},{"edgeType":"contains","source":12041,"target":12196},{"edgeType":"calls","source":10672,"target":1615},{"edgeType":"contains","source":13234,"target":13267},{"edgeType":"contains","source":13350,"target":13899},{"edgeType":"calls","source":6858,"target":5690},{"edgeType":"calls","source":6028,"target":6032},{"edgeType":"contains","source":4184,"target":4186},{"edgeType":"contains","source":1331,"target":1725},{"edgeType":"contains","source":8214,"target":8216},{"edgeType":"calls","source":13924,"target":12850},{"edgeType":"calls","source":1533,"target":1618},{"edgeType":"calls","source":3782,"target":3778},{"edgeType":"contains","source":7157,"target":7160},{"edgeType":"contains","source":5307,"target":5311},{"edgeType":"contains","source":12041,"target":12195},{"edgeType":"contains","source":8001,"target":8479},{"edgeType":"calls","source":16073,"target":16000},{"edgeType":"calls","source":2132,"target":2076},{"edgeType":"contains","source":9472,"target":9388},{"edgeType":"contains","source":3510,"target":3938},{"edgeType":"contains","source":4184,"target":4185},{"edgeType":"calls","source":9199,"target":9228},{"edgeType":"contains","source":13234,"target":13265},{"edgeType":"calls","source":5301,"target":5313},{"edgeType":"contains","source":1331,"target":1722},{"edgeType":"calls","source":3319,"target":3332},{"edgeType":"contains","source":2923,"target":3107},{"edgeType":"contains","source":5307,"target":5310},{"edgeType":"imports","source":15335,"target":7459},{"edgeType":"contains","source":8001,"target":8478},{"edgeType":"contains","source":5908,"target":5712},{"edgeType":"contains","source":12041,"target":12194},{"edgeType":"calls","source":9126,"target":3033},{"edgeType":"contains","source":3853,"target":3874},{"edgeType":"calls","source":1892,"target":1062},{"edgeType":"calls","source":4133,"target":3468},{"edgeType":"contains","source":8214,"target":8218},{"edgeType":"calls","source":3341,"target":2651},{"edgeType":"contains","source":1331,"target":1723},{"edgeType":"contains","source":5108,"target":5136},{"edgeType":"contains","source":8001,"target":8473},{"edgeType":"calls","source":8148,"target":7985},{"edgeType":"contains","source":12041,"target":12193},{"edgeType":"calls","source":3914,"target":3912},{"edgeType":"contains","source":6212,"target":6851},{"edgeType":"contains","source":3436,"target":4124},{"edgeType":"contains","source":3522,"target":3572},{"edgeType":"contains","source":3510,"target":3944},{"edgeType":"calls","source":9068,"target":9063},{"edgeType":"calls","source":6376,"target":5837},{"edgeType":"calls","source":10079,"target":976},{"edgeType":"imports","source":12378,"target":3987},{"edgeType":"contains","source":1331,"target":1728},{"edgeType":"imports","source":3786,"target":3971},{"edgeType":"contains","source":16801,"target":16840},{"edgeType":"contains","source":6212,"target":6852},{"edgeType":"contains","source":1940,"target":1876},{"edgeType":"contains","source":13234,"target":13263},{"edgeType":"contains","source":608,"target":885},{"edgeType":"calls","source":10786,"target":10772},{"edgeType":"contains","source":9598,"target":9703},{"edgeType":"contains","source":3510,"target":3943},{"edgeType":"contains","source":1331,"target":1729},{"edgeType":"imports","source":13919,"target":612},{"edgeType":"contains","source":7027,"target":6956},{"edgeType":"calls","source":1676,"target":1413},{"edgeType":"contains","source":11451,"target":11454},{"edgeType":"contains","source":3522,"target":3570},{"edgeType":"contains","source":3510,"target":3942},{"edgeType":"contains","source":3436,"target":4122},{"edgeType":"calls","source":15703,"target":2097},{"edgeType":"contains","source":1331,"target":1726},{"edgeType":"calls","source":1533,"target":1617},{"edgeType":"contains","source":9661,"target":1410},{"edgeType":"contains","source":11451,"target":11455},{"edgeType":"contains","source":10138,"target":9876},{"edgeType":"calls","source":3914,"target":3911},{"edgeType":"contains","source":5307,"target":5314},{"edgeType":"contains","source":15493,"target":15109},{"edgeType":"contains","source":14073,"target":14733},{"edgeType":"calls","source":6359,"target":6367},{"edgeType":"contains","source":13234,"target":13260},{"edgeType":"contains","source":1331,"target":1727},{"edgeType":"contains","source":3522,"target":3569},{"edgeType":"contains","source":10522,"target":10657},{"edgeType":"calls","source":14042,"target":7080},{"edgeType":"calls","source":9795,"target":9781},{"edgeType":"contains","source":4184,"target":4188},{"edgeType":"contains","source":10328,"target":10329},{"edgeType":"contains","source":10658,"target":10669},{"edgeType":"contains","source":608,"target":886},{"edgeType":"contains","source":5108,"target":5115},{"edgeType":"contains","source":3588,"target":3611},{"edgeType":"calls","source":6226,"target":6262},{"edgeType":"contains","source":10988,"target":10990},{"edgeType":"contains","source":11576,"target":11788},{"edgeType":"contains","source":87,"target":95},{"edgeType":"contains","source":2621,"target":1876},{"edgeType":"contains","source":1,"target":15445},{"edgeType":"contains","source":10459,"target":10477},{"edgeType":"imports","source":882,"target":963},{"edgeType":"contains","source":3510,"target":3914},{"edgeType":"contains","source":15150,"target":15157},{"edgeType":"contains","source":10922,"target":10923},{"edgeType":"contains","source":10988,"target":10991},{"edgeType":"contains","source":14952,"target":14953},{"edgeType":"calls","source":11650,"target":11442},{"edgeType":"contains","source":16141,"target":16146},{"edgeType":"calls","source":14842,"target":13968},{"edgeType":"contains","source":12041,"target":12172},{"edgeType":"calls","source":13099,"target":13032},{"edgeType":"contains","source":15150,"target":15158},{"edgeType":"calls","source":2003,"target":1875},{"edgeType":"calls","source":6300,"target":6052},{"edgeType":"contains","source":608,"target":858},{"edgeType":"calls","source":2070,"target":1909},{"edgeType":"contains","source":14073,"target":14720},{"edgeType":"contains","source":10459,"target":10474},{"edgeType":"contains","source":10616,"target":1379},{"edgeType":"contains","source":12041,"target":12171},{"edgeType":"contains","source":8015,"target":8021},{"edgeType":"calls","source":4511,"target":2344},{"edgeType":"imports","source":3435,"target":4272},{"edgeType":"contains","source":16479,"target":16240},{"edgeType":"calls","source":2341,"target":1965},{"edgeType":"calls","source":6307,"target":5836},{"edgeType":"contains","source":10988,"target":10989},{"edgeType":"contains","source":9002,"target":9134},{"edgeType":"calls","source":8142,"target":8145},{"edgeType":"contains","source":3510,"target":3912},{"edgeType":"calls","source":11650,"target":11440},{"edgeType":"calls","source":16876,"target":16451},{"edgeType":"contains","source":3510,"target":3919},{"edgeType":"calls","source":2026,"target":1156},{"edgeType":"imports","source":3435,"target":4273},{"edgeType":"contains","source":5174,"target":5187},{"edgeType":"contains","source":3383,"target":3628},{"edgeType":"contains","source":5108,"target":5119},{"edgeType":"imports","source":15503,"target":4352},{"edgeType":"contains","source":9002,"target":9128},{"edgeType":"contains","source":608,"target":860},{"edgeType":"contains","source":10459,"target":10472},{"edgeType":"calls","source":9133,"target":9137},{"edgeType":"contains","source":3853,"target":3857},{"edgeType":"contains","source":87,"target":99},{"edgeType":"imports","source":14470,"target":8892},{"edgeType":"contains","source":6561,"target":6578},{"edgeType":"calls","source":8934,"target":8964},{"edgeType":"imports","source":9754,"target":9222},{"edgeType":"calls","source":14190,"target":13040},{"edgeType":"calls","source":11181,"target":11187},{"edgeType":"contains","source":3588,"target":3614},{"edgeType":"contains","source":15150,"target":15161},{"edgeType":"calls","source":2735,"target":2433},{"edgeType":"contains","source":16801,"target":16830},{"edgeType":"calls","source":7928,"target":2097},{"edgeType":"calls","source":8142,"target":8147},{"edgeType":"calls","source":16010,"target":15809},{"edgeType":"contains","source":5108,"target":5118},{"edgeType":"calls","source":14525,"target":540},{"edgeType":"contains","source":12041,"target":12166},{"edgeType":"contains","source":9006,"target":9007},{"edgeType":"contains","source":9002,"target":9131},{"edgeType":"contains","source":11193,"target":10971},{"edgeType":"contains","source":11184,"target":11250},{"edgeType":"calls","source":2922,"target":2975},{"edgeType":"contains","source":5307,"target":5290},{"edgeType":"contains","source":13350,"target":13869},{"edgeType":"contains","source":1,"target":15451},{"edgeType":"contains","source":9598,"target":9681},{"edgeType":"imports","source":7775,"target":808},{"edgeType":"contains","source":15493,"target":15099},{"edgeType":"contains","source":87,"target":101},{"edgeType":"contains","source":12041,"target":12165},{"edgeType":"calls","source":14087,"target":14117},{"edgeType":"contains","source":12707,"target":12660},{"edgeType":"calls","source":1277,"target":1121},{"edgeType":"contains","source":12837,"target":12858},{"edgeType":"contains","source":9002,"target":9130},{"edgeType":"imports","source":15130,"target":7459},{"edgeType":"contains","source":8812,"target":8677},{"edgeType":"calls","source":2331,"target":2271},{"edgeType":"contains","source":8015,"target":8016},{"edgeType":"contains","source":87,"target":100},{"edgeType":"calls","source":8803,"target":8798},{"edgeType":"contains","source":6212,"target":6830},{"edgeType":"calls","source":15579,"target":5926},{"edgeType":"contains","source":6760,"target":6764},{"edgeType":"contains","source":5108,"target":5123},{"edgeType":"calls","source":2395,"target":2398},{"edgeType":"contains","source":15941,"target":15995},{"edgeType":"contains","source":14620,"target":14665},{"edgeType":"contains","source":5771,"target":5712},{"edgeType":"contains","source":6212,"target":6840},{"edgeType":"contains","source":9365,"target":2115},{"edgeType":"calls","source":7654,"target":6367},{"edgeType":"contains","source":608,"target":864},{"edgeType":"contains","source":6760,"target":6765},{"edgeType":"calls","source":10024,"target":2660},{"edgeType":"contains","source":10658,"target":10659},{"edgeType":"calls","source":3589,"target":3438},{"edgeType":"contains","source":14620,"target":14666},{"edgeType":"contains","source":3971,"target":4430},{"edgeType":"contains","source":87,"target":102},{"edgeType":"calls","source":6642,"target":6028},{"edgeType":"contains","source":4273,"target":3523},{"edgeType":"calls","source":2669,"target":2358},{"edgeType":"calls","source":1407,"target":1316},{"edgeType":"contains","source":9002,"target":9143},{"edgeType":"imports","source":15619,"target":15552},{"edgeType":"contains","source":6760,"target":6766},{"edgeType":"contains","source":10919,"target":8907},{"edgeType":"calls","source":3716,"target":3726},{"edgeType":"calls","source":1801,"target":1786},{"edgeType":"calls","source":9126,"target":3018},{"edgeType":"calls","source":6887,"target":6890},{"edgeType":"contains","source":5769,"target":5776},{"edgeType":"contains","source":3971,"target":4429},{"edgeType":"calls","source":10589,"target":10514},{"edgeType":"contains","source":5108,"target":5120},{"edgeType":"contains","source":5174,"target":5188},{"edgeType":"contains","source":6760,"target":6767},{"edgeType":"contains","source":2664,"target":2665},{"edgeType":"contains","source":10459,"target":10483},{"edgeType":"contains","source":15150,"target":15151},{"edgeType":"calls","source":13626,"target":13613},{"edgeType":"contains","source":12759,"target":13175},{"edgeType":"calls","source":2395,"target":2397},{"edgeType":"calls","source":10721,"target":10651},{"edgeType":"calls","source":6666,"target":1058},{"edgeType":"contains","source":10459,"target":10480},{"edgeType":"imports","source":12063,"target":11621},{"edgeType":"calls","source":4907,"target":4857},{"edgeType":"calls","source":16230,"target":540},{"edgeType":"contains","source":8015,"target":8023},{"edgeType":"contains","source":12041,"target":12177},{"edgeType":"calls","source":10592,"target":10427},{"edgeType":"calls","source":16876,"target":16454},{"edgeType":"contains","source":9799,"target":9800},{"edgeType":"calls","source":11001,"target":10433},{"edgeType":"contains","source":6760,"target":6761},{"edgeType":"imports","source":11600,"target":612},{"edgeType":"imports","source":3395,"target":3392},{"edgeType":"calls","source":2354,"target":1552},{"edgeType":"contains","source":11514,"target":11601},{"edgeType":"contains","source":7458,"target":8377},{"edgeType":"contains","source":3508,"target":3989},{"edgeType":"contains","source":8015,"target":8022},{"edgeType":"contains","source":8001,"target":8456},{"edgeType":"contains","source":3510,"target":3925},{"edgeType":"contains","source":15150,"target":15154},{"edgeType":"contains","source":6760,"target":6762},{"edgeType":"contains","source":10922,"target":10924},{"edgeType":"contains","source":10919,"target":11017},{"edgeType":"contains","source":5108,"target":5125},{"edgeType":"contains","source":1621,"target":1176},{"edgeType":"contains","source":16141,"target":16145},{"edgeType":"contains","source":10459,"target":10479},{"edgeType":"imports","source":882,"target":965},{"edgeType":"calls","source":15080,"target":2369},{"edgeType":"calls","source":15872,"target":15869},{"edgeType":"imports","source":15821,"target":15627},{"edgeType":"contains","source":6760,"target":6763},{"edgeType":"imports","source":3395,"target":3394},{"edgeType":"contains","source":3853,"target":3862},{"edgeType":"calls","source":2547,"target":1909},{"edgeType":"calls","source":1802,"target":1750},{"edgeType":"contains","source":5108,"target":5124},{"edgeType":"calls","source":13429,"target":698},{"edgeType":"calls","source":15358,"target":2206},{"edgeType":"calls","source":6094,"target":6110},{"edgeType":"calls","source":1893,"target":1043},{"edgeType":"contains","source":16141,"target":16144},{"edgeType":"contains","source":16075,"target":16076},{"edgeType":"calls","source":15629,"target":2369},{"edgeType":"calls","source":807,"target":978},{"edgeType":"contains","source":14073,"target":14701},{"edgeType":"contains","source":13827,"target":13870},{"edgeType":"calls","source":5328,"target":358},{"edgeType":"contains","source":14987,"target":5394},{"edgeType":"contains","source":1715,"target":2463},{"edgeType":"contains","source":8543,"target":8547},{"edgeType":"contains","source":3510,"target":3899},{"edgeType":"contains","source":9002,"target":9116},{"edgeType":"calls","source":5510,"target":5285},{"edgeType":"calls","source":13100,"target":13116},{"edgeType":"contains","source":6561,"target":6567},{"edgeType":"calls","source":3065,"target":2860},{"edgeType":"imports","source":14033,"target":14035},{"edgeType":"contains","source":15941,"target":15988},{"edgeType":"imports","source":14563,"target":14518},{"edgeType":"calls","source":2398,"target":2397},{"edgeType":"contains","source":12759,"target":13152},{"edgeType":"contains","source":3510,"target":3898},{"edgeType":"calls","source":9772,"target":2126},{"edgeType":"calls","source":1407,"target":1407},{"edgeType":"contains","source":1331,"target":1680},{"edgeType":"contains","source":4184,"target":4143},{"edgeType":"contains","source":6681,"target":7076},{"edgeType":"calls","source":12627,"target":6637},{"edgeType":"contains","source":6561,"target":6568},{"edgeType":"contains","source":5976,"target":5676},{"edgeType":"contains","source":15941,"target":15989},{"edgeType":"contains","source":8543,"target":8549},{"edgeType":"calls","source":2662,"target":2666},{"edgeType":"contains","source":14752,"target":14795},{"edgeType":"imports","source":9624,"target":611},{"edgeType":"contains","source":3588,"target":3593},{"edgeType":"contains","source":1778,"target":2622},{"edgeType":"calls","source":6178,"target":5716},{"edgeType":"contains","source":3510,"target":3897},{"edgeType":"contains","source":9002,"target":9118},{"edgeType":"contains","source":1331,"target":1681},{"edgeType":"contains","source":3397,"target":3170},{"edgeType":"calls","source":3593,"target":3403},{"edgeType":"calls","source":2929,"target":2846},{"edgeType":"calls","source":9662,"target":5535},{"edgeType":"contains","source":9529,"target":9693},{"edgeType":"contains","source":12392,"target":3386},{"edgeType":"calls","source":6711,"target":6112},{"edgeType":"contains","source":14073,"target":14704},{"edgeType":"imports","source":2616,"target":2221},{"edgeType":"calls","source":1275,"target":1270},{"edgeType":"contains","source":15941,"target":15990},{"edgeType":"contains","source":1715,"target":2462},{"edgeType":"contains","source":8543,"target":8548},{"edgeType":"contains","source":9002,"target":9117},{"edgeType":"contains","source":3510,"target":3896},{"edgeType":"contains","source":16801,"target":16812},{"edgeType":"contains","source":3971,"target":4410},{"edgeType":"contains","source":6031,"target":6079},{"edgeType":"contains","source":10789,"target":10796},{"edgeType":"contains","source":6561,"target":6562},{"edgeType":"contains","source":3510,"target":3903},{"edgeType":"calls","source":6372,"target":6052},{"edgeType":"contains","source":12837,"target":12845},{"edgeType":"calls","source":16345,"target":16108},{"edgeType":"contains","source":16801,"target":16815},{"edgeType":"contains","source":14752,"target":14797},{"edgeType":"contains","source":3971,"target":4409},{"edgeType":"contains","source":9598,"target":9662},{"edgeType":"calls","source":2929,"target":2844},{"edgeType":"calls","source":14488,"target":14488},{"edgeType":"calls","source":6860,"target":5723},{"edgeType":"contains","source":3510,"target":3902},{"edgeType":"calls","source":6174,"target":5837},{"edgeType":"calls","source":1029,"target":433},{"edgeType":"contains","source":16801,"target":16814},{"edgeType":"contains","source":16800,"target":16845},{"edgeType":"contains","source":13366,"target":13357},{"edgeType":"contains","source":14620,"target":14662},{"edgeType":"contains","source":1,"target":15435},{"edgeType":"contains","source":3971,"target":4408},{"edgeType":"contains","source":9534,"target":9535},{"edgeType":"calls","source":14291,"target":14252},{"edgeType":"calls","source":8151,"target":7985},{"edgeType":"contains","source":14073,"target":14707},{"edgeType":"contains","source":8001,"target":8434},{"edgeType":"calls","source":12840,"target":12723},{"edgeType":"contains","source":12150,"target":12999},{"edgeType":"contains","source":8543,"target":8545},{"edgeType":"contains","source":3588,"target":3597},{"edgeType":"contains","source":3510,"target":3901},{"edgeType":"contains","source":3971,"target":4407},{"edgeType":"calls","source":15531,"target":5406},{"edgeType":"calls","source":8143,"target":8234},{"edgeType":"contains","source":10789,"target":10795},{"edgeType":"calls","source":8344,"target":8345},{"edgeType":"calls","source":14892,"target":14645},{"edgeType":"contains","source":4381,"target":4382},{"edgeType":"calls","source":16079,"target":15901},{"edgeType":"contains","source":14620,"target":14664},{"edgeType":"contains","source":3510,"target":3900},{"edgeType":"contains","source":16801,"target":16816},{"edgeType":"contains","source":1331,"target":1686},{"edgeType":"contains","source":15810,"target":15812},{"edgeType":"contains","source":8001,"target":8444},{"edgeType":"contains","source":5174,"target":5175},{"edgeType":"contains","source":13234,"target":13235},{"edgeType":"contains","source":3971,"target":4414},{"edgeType":"calls","source":13924,"target":12950},{"edgeType":"contains","source":14073,"target":14693},{"edgeType":"contains","source":4072,"target":5512},{"edgeType":"contains","source":1331,"target":1691},{"edgeType":"contains","source":11184,"target":11247},{"edgeType":"imports","source":5256,"target":4939},{"edgeType":"contains","source":608,"target":848},{"edgeType":"contains","source":15810,"target":15813},{"edgeType":"contains","source":6561,"target":6575},{"edgeType":"contains","source":12837,"target":12856},{"edgeType":"contains","source":11185,"target":11218},{"edgeType":"contains","source":3510,"target":3906},{"edgeType":"contains","source":3522,"target":3534},{"edgeType":"contains","source":14752,"target":14786},{"edgeType":"calls","source":13103,"target":13032},{"edgeType":"contains","source":6561,"target":6576},{"edgeType":"calls","source":3727,"target":3468},{"edgeType":"calls","source":12321,"target":3447},{"edgeType":"calls","source":8146,"target":8144},{"edgeType":"calls","source":12561,"target":4463},{"edgeType":"calls","source":7987,"target":388},{"edgeType":"contains","source":87,"target":89},{"edgeType":"contains","source":14687,"target":14688},{"edgeType":"contains","source":3510,"target":3905},{"edgeType":"calls","source":6987,"target":6020},{"edgeType":"contains","source":14863,"target":15574},{"edgeType":"contains","source":1331,"target":1689},{"edgeType":"contains","source":5170,"target":5296},{"edgeType":"calls","source":14005,"target":4095},{"edgeType":"contains","source":12837,"target":12854},{"edgeType":"contains","source":15810,"target":15815},{"edgeType":"calls","source":14565,"target":1533},{"edgeType":"calls","source":6311,"target":5836},{"edgeType":"contains","source":87,"target":88},{"edgeType":"contains","source":9002,"target":9125},{"edgeType":"contains","source":10975,"target":11383},{"edgeType":"contains","source":14620,"target":14652},{"edgeType":"contains","source":11184,"target":11246},{"edgeType":"contains","source":3510,"target":3904},{"edgeType":"contains","source":14752,"target":14788},{"edgeType":"contains","source":14863,"target":15575},{"edgeType":"contains","source":6561,"target":6577},{"edgeType":"contains","source":12837,"target":12853},{"edgeType":"contains","source":15777,"target":14725},{"edgeType":"calls","source":1676,"target":1510},{"edgeType":"contains","source":6561,"target":6570},{"edgeType":"calls","source":2209,"target":1900},{"edgeType":"contains","source":13376,"target":13057},{"edgeType":"contains","source":15874,"target":15946},{"edgeType":"imports","source":14695,"target":4072},{"edgeType":"contains","source":3510,"target":3911},{"edgeType":"contains","source":14073,"target":14697},{"edgeType":"contains","source":3588,"target":3607},{"edgeType":"contains","source":6297,"target":6298},{"edgeType":"contains","source":1331,"target":1695},{"edgeType":"contains","source":11184,"target":11243},{"edgeType":"contains","source":13922,"target":15150},{"edgeType":"contains","source":14620,"target":14653},{"edgeType":"contains","source":87,"target":91},{"edgeType":"contains","source":14871,"target":15328},{"edgeType":"contains","source":14863,"target":15576},{"edgeType":"contains","source":8543,"target":8551},{"edgeType":"contains","source":9002,"target":9120},{"edgeType":"calls","source":7513,"target":286},{"edgeType":"contains","source":6561,"target":6571},{"edgeType":"imports","source":12315,"target":12316},{"edgeType":"contains","source":15941,"target":15984},{"edgeType":"calls","source":12322,"target":11879},{"edgeType":"contains","source":15874,"target":15947},{"edgeType":"imports","source":8259,"target":2758},{"edgeType":"contains","source":14073,"target":14698},{"edgeType":"calls","source":193,"target":972},{"edgeType":"calls","source":8212,"target":8215},{"edgeType":"contains","source":4841,"target":4930},{"edgeType":"contains","source":6297,"target":6299},{"edgeType":"contains","source":87,"target":90},{"edgeType":"contains","source":14752,"target":14790},{"edgeType":"contains","source":8543,"target":8550},{"edgeType":"contains","source":4072,"target":5515},{"edgeType":"contains","source":14871,"target":15329},{"edgeType":"calls","source":15696,"target":4526},{"edgeType":"contains","source":9002,"target":9119},{"edgeType":"contains","source":5108,"target":5109},{"edgeType":"contains","source":11576,"target":11774},{"edgeType":"calls","source":12321,"target":3451},{"edgeType":"contains","source":15941,"target":15985},{"edgeType":"contains","source":14073,"target":14699},{"edgeType":"contains","source":9002,"target":9122},{"edgeType":"contains","source":1331,"target":1693},{"edgeType":"contains","source":4072,"target":5514},{"edgeType":"contains","source":87,"target":93},{"edgeType":"calls","source":3328,"target":3148},{"edgeType":"contains","source":12759,"target":13155},{"edgeType":"contains","source":608,"target":854},{"edgeType":"contains","source":3971,"target":4415},{"edgeType":"contains","source":14073,"target":14700},{"edgeType":"contains","source":7239,"target":353},{"edgeType":"contains","source":3510,"target":3908},{"edgeType":"contains","source":87,"target":92},{"edgeType":"contains","source":4072,"target":5513},{"edgeType":"contains","source":6164,"target":6196},{"edgeType":"contains","source":8543,"target":8552},{"edgeType":"calls","source":15906,"target":2246},{"edgeType":"calls","source":1096,"target":492},{"edgeType":"contains","source":1088,"target":742},{"edgeType":"calls","source":8936,"target":540},{"edgeType":"contains","source":5871,"target":6798},{"edgeType":"contains","source":15470,"target":15773},{"edgeType":"contains","source":9002,"target":9100},{"edgeType":"contains","source":5258,"target":4660},{"edgeType":"imports","source":5256,"target":4931},{"edgeType":"contains","source":9466,"target":9514},{"edgeType":"contains","source":3917,"target":3950},{"edgeType":"contains","source":5871,"target":6799},{"edgeType":"calls","source":12046,"target":11950},{"edgeType":"contains","source":12837,"target":12831},{"edgeType":"contains","source":9002,"target":9099},{"edgeType":"contains","source":11053,"target":11057},{"edgeType":"calls","source":14487,"target":14498},{"edgeType":"contains","source":3917,"target":3949},{"edgeType":"contains","source":11576,"target":11756},{"edgeType":"contains","source":4242,"target":4444},{"edgeType":"contains","source":5871,"target":6800},{"edgeType":"contains","source":12150,"target":12988},{"edgeType":"calls","source":6643,"target":6088},{"edgeType":"contains","source":11053,"target":11054},{"edgeType":"contains","source":13034,"target":13066},{"edgeType":"contains","source":3510,"target":3880},{"edgeType":"contains","source":4071,"target":5516},{"edgeType":"contains","source":9466,"target":9516},{"edgeType":"contains","source":13034,"target":13065},{"edgeType":"contains","source":9400,"target":9448},{"edgeType":"contains","source":8744,"target":8643},{"edgeType":"calls","source":5403,"target":4389},{"edgeType":"contains","source":5871,"target":6801},{"edgeType":"contains","source":4242,"target":4443},{"edgeType":"contains","source":8001,"target":8422},{"edgeType":"calls","source":9204,"target":9146},{"edgeType":"contains","source":12168,"target":3971},{"edgeType":"contains","source":11053,"target":11055},{"edgeType":"calls","source":10027,"target":2660},{"edgeType":"contains","source":9002,"target":9101},{"edgeType":"contains","source":9400,"target":9447},{"edgeType":"calls","source":2033,"target":1043},{"edgeType":"calls","source":14879,"target":2344},{"edgeType":"contains","source":9466,"target":9515},{"edgeType":"contains","source":13034,"target":13064},{"edgeType":"contains","source":5871,"target":6802},{"edgeType":"calls","source":5239,"target":5243},{"edgeType":"contains","source":5871,"target":6794},{"edgeType":"contains","source":9869,"target":9702},{"edgeType":"imports","source":1167,"target":612},{"edgeType":"contains","source":4843,"target":4845},{"edgeType":"contains","source":9532,"target":9578},{"edgeType":"contains","source":1331,"target":1670},{"edgeType":"contains","source":13034,"target":13063},{"edgeType":"contains","source":14073,"target":14689},{"edgeType":"imports","source":9624,"target":601},{"edgeType":"contains","source":8080,"target":8081},{"edgeType":"calls","source":8412,"target":8331},{"edgeType":"calls","source":680,"target":698},{"edgeType":"imports","source":15636,"target":2375},{"edgeType":"calls","source":8012,"target":8048},{"edgeType":"calls","source":15848,"target":12473},{"edgeType":"contains","source":9532,"target":9577},{"edgeType":"contains","source":13034,"target":13062},{"edgeType":"contains","source":8259,"target":8873},{"edgeType":"contains","source":14073,"target":14690},{"edgeType":"imports","source":14240,"target":9712},{"edgeType":"calls","source":15084,"target":15017},{"edgeType":"contains","source":5871,"target":6796},{"edgeType":"contains","source":11185,"target":11186},{"edgeType":"contains","source":14597,"target":9017},{"edgeType":"contains","source":9532,"target":9580},{"edgeType":"contains","source":14073,"target":14691},{"edgeType":"imports","source":2939,"target":2758},{"edgeType":"calls","source":12787,"target":12236},{"edgeType":"contains","source":15810,"target":15811},{"edgeType":"contains","source":5871,"target":6797},{"edgeType":"calls","source":2408,"target":2097},{"edgeType":"contains","source":1331,"target":1669},{"edgeType":"contains","source":9400,"target":9443},{"edgeType":"contains","source":14863,"target":15571},{"edgeType":"contains","source":3917,"target":3951},{"edgeType":"calls","source":2948,"target":2270},{"edgeType":"contains","source":14073,"target":14692},{"edgeType":"calls","source":6890,"target":6893},{"edgeType":"calls","source":10460,"target":10381},{"edgeType":"contains","source":3510,"target":3890},{"edgeType":"contains","source":16800,"target":16817},{"edgeType":"calls","source":3269,"target":772},{"edgeType":"calls","source":747,"target":732},{"edgeType":"calls","source":2537,"target":209},{"edgeType":"contains","source":10789,"target":10792},{"edgeType":"calls","source":15629,"target":2361},{"edgeType":"contains","source":1778,"target":2616},{"edgeType":"contains","source":4640,"target":4799},{"edgeType":"contains","source":12448,"target":1645},{"edgeType":"contains","source":14620,"target":14632},{"edgeType":"contains","source":7684,"target":7685},{"edgeType":"contains","source":7027,"target":6911},{"edgeType":"contains","source":10789,"target":10793},{"edgeType":"contains","source":4843,"target":4848},{"edgeType":"contains","source":4975,"target":4984},{"edgeType":"contains","source":6681,"target":7067},{"edgeType":"contains","source":12837,"target":12840},{"edgeType":"calls","source":6916,"target":6089},{"edgeType":"contains","source":6031,"target":6076},{"edgeType":"calls","source":14555,"target":14512},{"edgeType":"contains","source":5659,"target":7038},{"edgeType":"contains","source":11185,"target":11198},{"edgeType":"contains","source":3510,"target":3888},{"edgeType":"contains","source":16800,"target":16819},{"edgeType":"contains","source":10919,"target":10988},{"edgeType":"contains","source":1331,"target":1672},{"edgeType":"contains","source":4843,"target":4847},{"edgeType":"contains","source":15215,"target":15216},{"edgeType":"contains","source":10789,"target":10790},{"edgeType":"contains","source":12759,"target":13142},{"edgeType":"contains","source":12837,"target":12839},{"edgeType":"calls","source":4333,"target":3726},{"edgeType":"contains","source":7458,"target":8349},{"edgeType":"contains","source":14620,"target":14634},{"edgeType":"calls","source":8422,"target":8029},{"edgeType":"calls","source":8412,"target":8337},{"edgeType":"contains","source":3510,"target":3887},{"edgeType":"contains","source":13234,"target":13215},{"edgeType":"calls","source":1077,"target":1074},{"edgeType":"contains","source":15215,"target":15217},{"edgeType":"contains","source":12837,"target":12838},{"edgeType":"contains","source":10133,"target":9986},{"edgeType":"contains","source":6031,"target":6078},{"edgeType":"contains","source":9529,"target":9684},{"edgeType":"contains","source":11576,"target":11762},{"edgeType":"imports","source":12378,"target":4011},{"edgeType":"contains","source":7684,"target":7686},{"edgeType":"calls","source":679,"target":722},{"edgeType":"contains","source":16800,"target":16821},{"edgeType":"contains","source":549,"target":551},{"edgeType":"contains","source":15215,"target":15218},{"edgeType":"contains","source":16404,"target":16413},{"edgeType":"calls","source":1559,"target":925},{"edgeType":"calls","source":2464,"target":2468},{"edgeType":"contains","source":13385,"target":12761},{"edgeType":"contains","source":3971,"target":4402},{"edgeType":"contains","source":9598,"target":9654},{"edgeType":"calls","source":8146,"target":8129},{"edgeType":"contains","source":1974,"target":772},{"edgeType":"calls","source":1804,"target":1786},{"edgeType":"calls","source":14778,"target":13940},{"edgeType":"contains","source":3522,"target":3523},{"edgeType":"contains","source":5871,"target":6803},{"edgeType":"calls","source":679,"target":721},{"edgeType":"calls","source":9667,"target":9602},{"edgeType":"calls","source":6890,"target":6899},{"edgeType":"calls","source":6929,"target":5690},{"edgeType":"contains","source":549,"target":550},{"edgeType":"imports","source":15619,"target":15578},{"edgeType":"calls","source":4402,"target":3698},{"edgeType":"contains","source":3971,"target":4401},{"edgeType":"calls","source":14457,"target":642},{"edgeType":"contains","source":1778,"target":2621},{"edgeType":"contains","source":5871,"target":6804},{"edgeType":"imports","source":882,"target":997},{"edgeType":"contains","source":3510,"target":3892},{"edgeType":"contains","source":11053,"target":11058},{"edgeType":"contains","source":608,"target":838},{"edgeType":"contains","source":8001,"target":8426},{"edgeType":"contains","source":15740,"target":15857},{"edgeType":"contains","source":8080,"target":8091},{"edgeType":"contains","source":14597,"target":9009},{"edgeType":"calls","source":2464,"target":2466},{"edgeType":"contains","source":11514,"target":11565},{"edgeType":"calls","source":14753,"target":14717},{"edgeType":"contains","source":3588,"target":3589},{"edgeType":"contains","source":5871,"target":6805},{"edgeType":"contains","source":1778,"target":2618},{"edgeType":"contains","source":3510,"target":3891},{"edgeType":"imports","source":16758,"target":1410},{"edgeType":"contains","source":11852,"target":11657},{"edgeType":"contains","source":1331,"target":1677},{"edgeType":"contains","source":15470,"target":15772},{"edgeType":"calls","source":9665,"target":9666},{"edgeType":"calls","source":11713,"target":11713},{"edgeType":"contains","source":14863,"target":15562},{"edgeType":"contains","source":8873,"target":8876},{"edgeType":"contains","source":8001,"target":8425},{"edgeType":"contains","source":8076,"target":8214},{"edgeType":"contains","source":8080,"target":8090},{"edgeType":"contains","source":1,"target":13311},{"edgeType":"calls","source":16230,"target":642},{"edgeType":"contains","source":1778,"target":2619},{"edgeType":"contains","source":5871,"target":6806},{"edgeType":"contains","source":9532,"target":9566},{"edgeType":"calls","source":5502,"target":5501},{"edgeType":"contains","source":6031,"target":6050},{"edgeType":"imports","source":9541,"target":9562},{"edgeType":"calls","source":13002,"target":3438},{"edgeType":"contains","source":9400,"target":9429},{"edgeType":"calls","source":4000,"target":3438},{"edgeType":"calls","source":8013,"target":7995},{"edgeType":"calls","source":13100,"target":13083},{"edgeType":"calls","source":11715,"target":11624},{"edgeType":"contains","source":6031,"target":6051},{"edgeType":"calls","source":944,"target":925},{"edgeType":"calls","source":9599,"target":9567},{"edgeType":"contains","source":8015,"target":7968},{"edgeType":"contains","source":4242,"target":4427},{"edgeType":"calls","source":16143,"target":16000},{"edgeType":"contains","source":13350,"target":13824},{"edgeType":"calls","source":2495,"target":1471},{"edgeType":"calls","source":15696,"target":2375},{"edgeType":"calls","source":6246,"target":5690},{"edgeType":"contains","source":3436,"target":4045},{"edgeType":"calls","source":3520,"target":3518},{"edgeType":"contains","source":3436,"target":4043},{"edgeType":"contains","source":6031,"target":6052},{"edgeType":"calls","source":14060,"target":4463},{"edgeType":"contains","source":3971,"target":4371},{"edgeType":"contains","source":9532,"target":9568},{"edgeType":"calls","source":15628,"target":2369},{"edgeType":"calls","source":14686,"target":14654},{"edgeType":"calls","source":3658,"target":3468},{"edgeType":"contains","source":350,"target":351},{"edgeType":"contains","source":8481,"target":8324},{"edgeType":"calls","source":10791,"target":10668},{"edgeType":"calls","source":12637,"target":12637},{"edgeType":"contains","source":12759,"target":13118},{"edgeType":"contains","source":3315,"target":3565},{"edgeType":"contains","source":15058,"target":3162},{"edgeType":"calls","source":14404,"target":2255},{"edgeType":"contains","source":6031,"target":6053},{"edgeType":"contains","source":9467,"target":9468},{"edgeType":"contains","source":1331,"target":1648},{"edgeType":"contains","source":4244,"target":4363},{"edgeType":"contains","source":13365,"target":13357},{"edgeType":"contains","source":14619,"target":14658},{"edgeType":"contains","source":3971,"target":4370},{"edgeType":"calls","source":7485,"target":7455},{"edgeType":"calls","source":1740,"target":1615},{"edgeType":"contains","source":10522,"target":10583},{"edgeType":"calls","source":1670,"target":1671},{"edgeType":"imports","source":2434,"target":1552},{"edgeType":"calls","source":4001,"target":3403},{"edgeType":"imports","source":9090,"target":2406},{"edgeType":"contains","source":14619,"target":14659},{"edgeType":"contains","source":5635,"target":5638},{"edgeType":"calls","source":10169,"target":358},{"edgeType":"calls","source":4468,"target":3726},{"edgeType":"contains","source":3917,"target":3936},{"edgeType":"contains","source":8873,"target":8849},{"edgeType":"contains","source":12957,"target":13319},{"edgeType":"calls","source":15700,"target":2246},{"edgeType":"imports","source":1055,"target":2020},{"edgeType":"calls","source":6241,"target":5841},{"edgeType":"contains","source":1331,"target":1655},{"edgeType":"contains","source":9400,"target":9424},{"edgeType":"contains","source":14619,"target":14660},{"edgeType":"imports","source":15642,"target":4352},{"edgeType":"contains","source":8805,"target":8846},{"edgeType":"contains","source":350,"target":355},{"edgeType":"contains","source":10522,"target":10581},{"edgeType":"contains","source":7027,"target":6883},{"edgeType":"contains","source":16404,"target":16407},{"edgeType":"contains","source":11250,"target":11268},{"edgeType":"contains","source":11449,"target":11441},{"edgeType":"contains","source":4843,"target":4825},{"edgeType":"calls","source":15294,"target":4264},{"edgeType":"contains","source":350,"target":354},{"edgeType":"calls","source":8277,"target":8275},{"edgeType":"calls","source":3454,"target":3447},{"edgeType":"calls","source":15696,"target":2372},{"edgeType":"calls","source":1267,"target":1481},{"edgeType":"contains","source":12041,"target":12116},{"edgeType":"contains","source":7027,"target":6884},{"edgeType":"contains","source":11250,"target":11269},{"edgeType":"imports","source":11788,"target":11776},{"edgeType":"contains","source":9532,"target":9574},{"edgeType":"contains","source":350,"target":357},{"edgeType":"contains","source":3971,"target":4381},{"edgeType":"contains","source":14619,"target":14646},{"edgeType":"calls","source":6818,"target":653},{"edgeType":"contains","source":14836,"target":14262},{"edgeType":"contains","source":7027,"target":6893},{"edgeType":"contains","source":16800,"target":16801},{"edgeType":"calls","source":7290,"target":7162},{"edgeType":"calls","source":4712,"target":4614},{"edgeType":"contains","source":9467,"target":9474},{"edgeType":"contains","source":14619,"target":14647},{"edgeType":"contains","source":350,"target":356},{"edgeType":"contains","source":9532,"target":9573},{"edgeType":"contains","source":14752,"target":14753},{"edgeType":"contains","source":6164,"target":6165},{"edgeType":"calls","source":13920,"target":13040},{"edgeType":"contains","source":5871,"target":6792},{"edgeType":"contains","source":3917,"target":3939},{"edgeType":"calls","source":2294,"target":1348},{"edgeType":"contains","source":15941,"target":15948},{"edgeType":"calls","source":10236,"target":402},{"edgeType":"contains","source":3785,"target":3803},{"edgeType":"contains","source":4233,"target":2599},{"edgeType":"calls","source":14866,"target":626},{"edgeType":"contains","source":13827,"target":13843},{"edgeType":"contains","source":4244,"target":4373},{"edgeType":"contains","source":5871,"target":6793},{"edgeType":"contains","source":3785,"target":3802},{"edgeType":"contains","source":4244,"target":4372},{"edgeType":"contains","source":4242,"target":4434},{"edgeType":"imports","source":15642,"target":2236},{"edgeType":"contains","source":3785,"target":3809},{"edgeType":"calls","source":11514,"target":11524},{"edgeType":"calls","source":14404,"target":156},{"edgeType":"calls","source":3850,"target":3848},{"edgeType":"calls","source":2031,"target":1042},{"edgeType":"contains","source":3662,"target":3394},{"edgeType":"calls","source":4136,"target":3438},{"edgeType":"contains","source":9797,"target":9812},{"edgeType":"contains","source":1331,"target":1662},{"edgeType":"contains","source":2924,"target":3016},{"edgeType":"imports","source":15779,"target":4326},{"edgeType":"calls","source":5328,"target":311},{"edgeType":"imports","source":15834,"target":15305},{"edgeType":"calls","source":10297,"target":626},{"edgeType":"calls","source":16880,"target":16411},{"edgeType":"contains","source":3785,"target":3808},{"edgeType":"imports","source":16488,"target":16174},{"edgeType":"contains","source":1331,"target":1663},{"edgeType":"imports","source":9220,"target":2597},{"edgeType":"contains","source":608,"target":818},{"edgeType":"contains","source":7027,"target":6890},{"edgeType":"imports","source":15834,"target":15308},{"edgeType":"contains","source":11449,"target":11450},{"edgeType":"contains","source":9467,"target":9473},{"edgeType":"contains","source":9466,"target":9504},{"edgeType":"contains","source":13827,"target":13839},{"edgeType":"contains","source":3785,"target":3807},{"edgeType":"imports","source":15493,"target":15308},{"edgeType":"contains","source":9797,"target":9810},{"edgeType":"imports","source":14172,"target":13978},{"edgeType":"contains","source":4116,"target":4117},{"edgeType":"calls","source":15877,"target":15795},{"edgeType":"contains","source":11382,"target":11412},{"edgeType":"calls","source":3842,"target":4095},{"edgeType":"contains","source":3315,"target":3579},{"edgeType":"calls","source":8486,"target":8145},{"edgeType":"calls","source":2031,"target":1043},{"edgeType":"contains","source":9797,"target":9811},{"edgeType":"contains","source":15418,"target":15253},{"edgeType":"imports","source":14033,"target":14058},{"edgeType":"calls","source":9600,"target":9550},{"edgeType":"imports","source":15779,"target":4327},{"edgeType":"contains","source":11250,"target":11258},{"edgeType":"contains","source":1692,"target":1012},{"edgeType":"contains","source":217,"target":227},{"edgeType":"imports","source":1768,"target":1045},{"edgeType":"contains","source":14619,"target":14638},{"edgeType":"calls","source":6042,"target":5690},{"edgeType":"contains","source":9002,"target":9067},{"edgeType":"contains","source":13034,"target":13035},{"edgeType":"calls","source":14021,"target":9886},{"edgeType":"contains","source":6031,"target":6034},{"edgeType":"calls","source":15684,"target":615},{"edgeType":"contains","source":151,"target":159},{"edgeType":"calls","source":15696,"target":2357},{"edgeType":"contains","source":14223,"target":14230},{"edgeType":"contains","source":11250,"target":11259},{"edgeType":"contains","source":14619,"target":14639},{"edgeType":"imports","source":1768,"target":1044},{"edgeType":"contains","source":5905,"target":5712},{"edgeType":"contains","source":217,"target":226},{"edgeType":"calls","source":1936,"target":1901},{"edgeType":"imports","source":10919,"target":2766},{"edgeType":"calls","source":679,"target":700},{"edgeType":"contains","source":1331,"target":1634},{"edgeType":"calls","source":2870,"target":433},{"edgeType":"contains","source":12957,"target":13306},{"edgeType":"calls","source":15018,"target":14920},{"edgeType":"contains","source":4230,"target":2669},{"edgeType":"contains","source":8805,"target":8830},{"edgeType":"contains","source":151,"target":158},{"edgeType":"contains","source":16007,"target":16008},{"edgeType":"contains","source":14987,"target":7460},{"edgeType":"contains","source":11250,"target":11256},{"edgeType":"contains","source":12957,"target":13305},{"edgeType":"calls","source":1474,"target":1427},{"edgeType":"imports","source":5452,"target":5232},{"edgeType":"calls","source":11949,"target":2236},{"edgeType":"contains","source":5899,"target":5900},{"edgeType":"contains","source":4984,"target":4662},{"edgeType":"contains","source":151,"target":161},{"edgeType":"contains","source":10378,"target":10805},{"edgeType":"imports","source":3435,"target":4338},{"edgeType":"contains","source":3971,"target":4353},{"edgeType":"contains","source":9004,"target":9006},{"edgeType":"calls","source":15956,"target":642},{"edgeType":"contains","source":11382,"target":11393},{"edgeType":"contains","source":11250,"target":11257},{"edgeType":"contains","source":14223,"target":14233},{"edgeType":"contains","source":12957,"target":13304},{"edgeType":"contains","source":8805,"target":8832},{"edgeType":"contains","source":151,"target":160},{"edgeType":"contains","source":15941,"target":15942},{"edgeType":"contains","source":4339,"target":3523},{"edgeType":"calls","source":12042,"target":12044},{"edgeType":"calls","source":679,"target":697},{"edgeType":"contains","source":3436,"target":4033},{"edgeType":"contains","source":11250,"target":11254},{"edgeType":"contains","source":1331,"target":1637},{"edgeType":"contains","source":9598,"target":9613},{"edgeType":"contains","source":2721,"target":2942},{"edgeType":"imports","source":5452,"target":5234},{"edgeType":"contains","source":151,"target":163},{"edgeType":"contains","source":4244,"target":4354},{"edgeType":"contains","source":10378,"target":10803},{"edgeType":"contains","source":10522,"target":10567},{"edgeType":"contains","source":12378,"target":12226},{"edgeType":"calls","source":8622,"target":8130},{"edgeType":"calls","source":6295,"target":6276},{"edgeType":"contains","source":1331,"target":1638},{"edgeType":"calls","source":807,"target":956},{"edgeType":"contains","source":11250,"target":11255},{"edgeType":"contains","source":13773,"target":13375},{"edgeType":"calls","source":5690,"target":6026},{"edgeType":"calls","source":8150,"target":7965},{"edgeType":"contains","source":12957,"target":13302},{"edgeType":"contains","source":151,"target":162},{"edgeType":"contains","source":10522,"target":10568},{"edgeType":"calls","source":15183,"target":7687},{"edgeType":"contains","source":10378,"target":10804},{"edgeType":"contains","source":15749,"target":15552},{"edgeType":"calls","source":8486,"target":8121},{"edgeType":"calls","source":16006,"target":16000},{"edgeType":"contains","source":11250,"target":11252},{"edgeType":"contains","source":13520,"target":12761},{"edgeType":"imports","source":5256,"target":4970},{"edgeType":"calls","source":15148,"target":15115},{"edgeType":"calls","source":2245,"target":774},{"edgeType":"contains","source":151,"target":165},{"edgeType":"calls","source":6037,"target":5838},{"edgeType":"calls","source":10591,"target":10514},{"edgeType":"contains","source":11184,"target":11185},{"edgeType":"contains","source":11250,"target":11253},{"edgeType":"contains","source":3436,"target":4030},{"edgeType":"calls","source":15847,"target":12473},{"edgeType":"contains","source":1331,"target":1636},{"edgeType":"contains","source":6031,"target":6033},{"edgeType":"contains","source":3917,"target":3918},{"edgeType":"contains","source":1,"target":586},{"edgeType":"imports","source":14033,"target":14050},{"edgeType":"contains","source":151,"target":164},{"edgeType":"contains","source":10378,"target":10802},{"edgeType":"contains","source":4244,"target":4358},{"edgeType":"calls","source":8411,"target":8334},{"edgeType":"contains","source":9004,"target":9013},{"edgeType":"contains","source":10639,"target":610},{"edgeType":"calls","source":1345,"target":1188},{"edgeType":"imports","source":11788,"target":3303},{"edgeType":"contains","source":10522,"target":10579},{"edgeType":"contains","source":8805,"target":8840},{"edgeType":"calls","source":15693,"target":4572},{"edgeType":"contains","source":6700,"target":6443},{"edgeType":"imports","source":2434,"target":1548},{"edgeType":"contains","source":15999,"target":16245},{"edgeType":"contains","source":5767,"target":5770},{"edgeType":"contains","source":9532,"target":9557},{"edgeType":"contains","source":3971,"target":4365},{"edgeType":"contains","source":14619,"target":14630},{"edgeType":"contains","source":13827,"target":13828},{"edgeType":"contains","source":9004,"target":9012},{"edgeType":"contains","source":4242,"target":4419},{"edgeType":"contains","source":12915,"target":4046},{"edgeType":"contains","source":5871,"target":6775},{"edgeType":"calls","source":349,"target":352},{"edgeType":"contains","source":15999,"target":16246},{"edgeType":"contains","source":11250,"target":11267},{"edgeType":"contains","source":14619,"target":14631},{"edgeType":"contains","source":13760,"target":13790},{"edgeType":"contains","source":3971,"target":4364},{"edgeType":"contains","source":15478,"target":15486},{"edgeType":"contains","source":4244,"target":4356},{"edgeType":"calls","source":3454,"target":3458},{"edgeType":"contains","source":13952,"target":14168},{"edgeType":"contains","source":1331,"target":1639},{"edgeType":"calls","source":15628,"target":2361},{"edgeType":"calls","source":10128,"target":10075},{"edgeType":"calls","source":14745,"target":2246},{"edgeType":"contains","source":15999,"target":16247},{"edgeType":"contains","source":14223,"target":14224},{"edgeType":"contains","source":5635,"target":5636},{"edgeType":"imports","source":14716,"target":1330},{"edgeType":"contains","source":9004,"target":9014},{"edgeType":"calls","source":6365,"target":6226},{"edgeType":"calls","source":9958,"target":2660},{"edgeType":"contains","source":7027,"target":6880},{"edgeType":"contains","source":9235,"target":6081},{"edgeType":"contains","source":13952,"target":14169},{"edgeType":"calls","source":5391,"target":4719},{"edgeType":"contains","source":6626,"target":6627},{"edgeType":"contains","source":3971,"target":4362},{"edgeType":"contains","source":9400,"target":9422},{"edgeType":"calls","source":3524,"target":3403},{"edgeType":"calls","source":14544,"target":2134},{"edgeType":"contains","source":14223,"target":14225},{"edgeType":"contains","source":15999,"target":16248},{"edgeType":"contains","source":14619,"target":14633},{"edgeType":"contains","source":9797,"target":9799},{"edgeType":"contains","source":14288,"target":14324},{"edgeType":"contains","source":5635,"target":5637},{"edgeType":"contains","source":1,"target":590},{"edgeType":"contains","source":11250,"target":11262},{"edgeType":"contains","source":13952,"target":14170},{"edgeType":"contains","source":13034,"target":13039},{"edgeType":"calls","source":3064,"target":2861},{"edgeType":"contains","source":8805,"target":8835},{"edgeType":"calls","source":10060,"target":10071},{"edgeType":"calls","source":3590,"target":3468},{"edgeType":"contains","source":3971,"target":4369},{"edgeType":"contains","source":14223,"target":14226},{"edgeType":"calls","source":6514,"target":5837},{"edgeType":"contains","source":5899,"target":5902},{"edgeType":"contains","source":15999,"target":16249},{"edgeType":"imports","source":6814,"target":1058},{"edgeType":"contains","source":8259,"target":8849},{"edgeType":"contains","source":14288,"target":14325},{"edgeType":"contains","source":12915,"target":4042},{"edgeType":"contains","source":13952,"target":14171},{"edgeType":"contains","source":11250,"target":11263},{"edgeType":"contains","source":4244,"target":4361},{"edgeType":"contains","source":12821,"target":13298},{"edgeType":"contains","source":7088,"target":7097},{"edgeType":"contains","source":9466,"target":9484},{"edgeType":"calls","source":9994,"target":10002},{"edgeType":"calls","source":2465,"target":2405},{"edgeType":"contains","source":3971,"target":4368},{"edgeType":"calls","source":15159,"target":2097},{"edgeType":"calls","source":6365,"target":6229},{"edgeType":"contains","source":14288,"target":14326},{"edgeType":"contains","source":5871,"target":6771},{"edgeType":"contains","source":14223,"target":14227},{"edgeType":"contains","source":6297,"target":6250},{"edgeType":"contains","source":11250,"target":11260},{"edgeType":"contains","source":14619,"target":14636},{"edgeType":"calls","source":3521,"target":3491},{"edgeType":"contains","source":1331,"target":1643},{"edgeType":"contains","source":7088,"target":7098},{"edgeType":"contains","source":8872,"target":8875},{"edgeType":"calls","source":16345,"target":16069},{"edgeType":"calls","source":2529,"target":2532},{"edgeType":"contains","source":9532,"target":9555},{"edgeType":"calls","source":1803,"target":1786},{"edgeType":"contains","source":3971,"target":4367},{"edgeType":"calls","source":4247,"target":4241},{"edgeType":"contains","source":5767,"target":5768},{"edgeType":"contains","source":13760,"target":13785},{"edgeType":"contains","source":14223,"target":14228},{"edgeType":"contains","source":4244,"target":4359},{"edgeType":"contains","source":9295,"target":2103},{"edgeType":"contains","source":13952,"target":14173},{"edgeType":"contains","source":11250,"target":11261},{"edgeType":"contains","source":12915,"target":4040},{"edgeType":"imports","source":15421,"target":610},{"edgeType":"contains","source":9004,"target":9010},{"edgeType":"contains","source":8872,"target":8874},{"edgeType":"contains","source":12957,"target":13309},{"edgeType":"calls","source":10325,"target":10313},{"edgeType":"contains","source":5659,"target":7003},{"edgeType":"contains","source":3785,"target":3790},{"edgeType":"contains","source":3971,"target":4366},{"edgeType":"contains","source":14223,"target":14229},{"edgeType":"contains","source":10763,"target":5726},{"edgeType":"contains","source":14695,"target":14908},{"edgeType":"contains","source":960,"target":961},{"edgeType":"contains","source":7828,"target":7919},{"edgeType":"contains","source":7038,"target":7040},{"edgeType":"contains","source":15098,"target":15100},{"edgeType":"contains","source":5452,"target":5467},{"edgeType":"contains","source":4796,"target":4662},{"edgeType":"calls","source":1011,"target":1062},{"edgeType":"contains","source":3999,"target":4001},{"edgeType":"calls","source":1806,"target":1786},{"edgeType":"contains","source":11657,"target":11837},{"edgeType":"calls","source":6299,"target":6263},{"edgeType":"contains","source":4197,"target":4205},{"edgeType":"calls","source":15880,"target":15795},{"edgeType":"contains","source":14695,"target":14909},{"edgeType":"calls","source":748,"target":758},{"edgeType":"imports","source":10436,"target":612},{"edgeType":"calls","source":1343,"target":1340},{"edgeType":"contains","source":9775,"target":413},{"edgeType":"contains","source":12316,"target":12549},{"edgeType":"contains","source":15758,"target":15781},{"edgeType":"contains","source":4197,"target":4204},{"edgeType":"contains","source":14371,"target":14383},{"edgeType":"contains","source":14365,"target":14569},{"edgeType":"contains","source":3999,"target":4000},{"edgeType":"contains","source":11657,"target":11838},{"edgeType":"contains","source":16082,"target":16307},{"edgeType":"contains","source":12783,"target":12869},{"edgeType":"imports","source":9754,"target":611},{"edgeType":"calls","source":14178,"target":903},{"edgeType":"imports","source":14425,"target":14371},{"edgeType":"calls","source":748,"target":760},{"edgeType":"contains","source":960,"target":962},{"edgeType":"imports","source":1375,"target":2440},{"edgeType":"contains","source":7301,"target":7346},{"edgeType":"contains","source":8158,"target":8261},{"edgeType":"contains","source":11657,"target":11836},{"edgeType":"contains","source":9775,"target":415},{"edgeType":"contains","source":10884,"target":10430},{"edgeType":"calls","source":5840,"target":5689},{"edgeType":"imports","source":1621,"target":1157},{"edgeType":"contains","source":5915,"target":5917},{"edgeType":"contains","source":12316,"target":12547},{"edgeType":"contains","source":4990,"target":4995},{"edgeType":"contains","source":12759,"target":13611},{"edgeType":"contains","source":13183,"target":13152},{"edgeType":"contains","source":1167,"target":890},{"edgeType":"contains","source":4924,"target":4927},{"edgeType":"calls","source":3489,"target":2462},{"edgeType":"calls","source":6808,"target":1058},{"edgeType":"calls","source":8422,"target":8105},{"edgeType":"calls","source":11860,"target":11459},{"edgeType":"contains","source":14954,"target":15340},{"edgeType":"calls","source":3936,"target":3403},{"edgeType":"contains","source":8756,"target":8744},{"edgeType":"contains","source":12257,"target":12261},{"edgeType":"contains","source":10763,"target":5723},{"edgeType":"contains","source":12783,"target":12866},{"edgeType":"imports","source":15821,"target":15485},{"edgeType":"contains","source":15366,"target":15253},{"edgeType":"contains","source":13248,"target":13250},{"edgeType":"contains","source":14365,"target":14573},{"edgeType":"contains","source":4924,"target":4926},{"edgeType":"calls","source":6962,"target":6855},{"edgeType":"calls","source":6893,"target":6880},{"edgeType":"imports","source":14425,"target":14365},{"edgeType":"imports","source":10329,"target":8161},{"edgeType":"contains","source":35,"target":42},{"edgeType":"contains","source":10884,"target":10428},{"edgeType":"contains","source":1,"target":3210},{"edgeType":"contains","source":16158,"target":16069},{"edgeType":"contains","source":10080,"target":9984},{"edgeType":"contains","source":12257,"target":12260},{"edgeType":"contains","source":16077,"target":16466},{"edgeType":"contains","source":12191,"target":12192},{"edgeType":"contains","source":12316,"target":12545},{"edgeType":"calls","source":7653,"target":4461},{"edgeType":"calls","source":14745,"target":2358},{"edgeType":"contains","source":5785,"target":5713},{"edgeType":"calls","source":11177,"target":3033},{"edgeType":"contains","source":4990,"target":4993},{"edgeType":"contains","source":4924,"target":4925},{"edgeType":"calls","source":3798,"target":3451},{"edgeType":"contains","source":5200,"target":4825},{"edgeType":"calls","source":2534,"target":2468},{"edgeType":"contains","source":3999,"target":4003},{"edgeType":"contains","source":15758,"target":15786},{"edgeType":"contains","source":12257,"target":12259},{"edgeType":"contains","source":12783,"target":12864},{"edgeType":"calls","source":11056,"target":11013},{"edgeType":"contains","source":7038,"target":7039},{"edgeType":"contains","source":14366,"target":14544},{"edgeType":"calls","source":10791,"target":10772},{"edgeType":"contains","source":7301,"target":7342},{"edgeType":"contains","source":11657,"target":11832},{"edgeType":"calls","source":14896,"target":12473},{"edgeType":"calls","source":10461,"target":10433},{"edgeType":"contains","source":9775,"target":411},{"edgeType":"imports","source":1244,"target":156},{"edgeType":"contains","source":3999,"target":4002},{"edgeType":"contains","source":12257,"target":12258},{"edgeType":"calls","source":11385,"target":11385},{"edgeType":"contains","source":1,"target":3212},{"edgeType":"contains","source":12316,"target":12543},{"edgeType":"calls","source":7290,"target":7260},{"edgeType":"calls","source":11452,"target":11422},{"edgeType":"calls","source":947,"target":924},{"edgeType":"contains","source":16082,"target":16299},{"edgeType":"imports","source":2721,"target":893},{"edgeType":"calls","source":8218,"target":8090},{"edgeType":"calls","source":8217,"target":8121},{"edgeType":"contains","source":2939,"target":3043},{"edgeType":"contains","source":14695,"target":14900},{"edgeType":"contains","source":1780,"target":919},{"edgeType":"contains","source":15204,"target":1235},{"edgeType":"calls","source":15700,"target":2357},{"edgeType":"calls","source":4420,"target":1079},{"edgeType":"calls","source":14838,"target":14281},{"edgeType":"contains","source":16088,"target":16112},{"edgeType":"contains","source":16082,"target":16298},{"edgeType":"imports","source":5662,"target":611},{"edgeType":"contains","source":960,"target":968},{"edgeType":"contains","source":15571,"target":15228},{"edgeType":"calls","source":8412,"target":8418},{"edgeType":"calls","source":4002,"target":3468},{"edgeType":"contains","source":14634,"target":14678},{"edgeType":"contains","source":3735,"target":3736},{"edgeType":"contains","source":1,"target":3214},{"edgeType":"calls","source":682,"target":682},{"edgeType":"contains","source":5659,"target":7517},{"edgeType":"calls","source":7289,"target":7293},{"edgeType":"contains","source":3999,"target":4008},{"edgeType":"contains","source":15483,"target":15843},{"edgeType":"contains","source":1,"target":3217},{"edgeType":"contains","source":16082,"target":16301},{"edgeType":"contains","source":6245,"target":6264},{"edgeType":"contains","source":630,"target":631},{"edgeType":"contains","source":12315,"target":12587},{"edgeType":"imports","source":15130,"target":965},{"edgeType":"contains","source":8756,"target":8759},{"edgeType":"contains","source":960,"target":971},{"edgeType":"contains","source":12849,"target":12946},{"edgeType":"contains","source":15758,"target":15774},{"edgeType":"contains","source":11657,"target":11843},{"edgeType":"contains","source":14695,"target":14902},{"edgeType":"contains","source":5651,"target":5652},{"edgeType":"calls","source":5042,"target":5050},{"edgeType":"contains","source":6245,"target":6265},{"edgeType":"contains","source":4990,"target":4996},{"edgeType":"imports","source":6305,"target":6049},{"edgeType":"contains","source":14695,"target":14903},{"edgeType":"contains","source":7038,"target":7051},{"edgeType":"contains","source":16082,"target":16300},{"edgeType":"contains","source":2828,"target":2255},{"edgeType":"contains","source":960,"target":970},{"edgeType":"contains","source":12849,"target":12945},{"edgeType":"contains","source":1,"target":9558},{"edgeType":"contains","source":14634,"target":14680},{"edgeType":"imports","source":1375,"target":2449},{"edgeType":"contains","source":16082,"target":16303},{"edgeType":"contains","source":1,"target":3219},{"edgeType":"contains","source":14695,"target":14904},{"edgeType":"contains","source":14836,"target":14761},{"edgeType":"calls","source":1409,"target":1396},{"edgeType":"contains","source":11657,"target":11841},{"edgeType":"contains","source":5849,"target":5850},{"edgeType":"contains","source":16082,"target":16302},{"edgeType":"calls","source":14892,"target":14717},{"edgeType":"contains","source":14695,"target":14905},{"edgeType":"contains","source":7301,"target":7348},{"edgeType":"contains","source":2939,"target":3048},{"edgeType":"contains","source":630,"target":632},{"edgeType":"contains","source":14365,"target":14565},{"edgeType":"contains","source":15758,"target":15777},{"edgeType":"contains","source":5849,"target":5851},{"edgeType":"calls","source":8809,"target":8800},{"edgeType":"contains","source":1,"target":9560},{"edgeType":"contains","source":3999,"target":4012},{"edgeType":"contains","source":11657,"target":11842},{"edgeType":"contains","source":1621,"target":1625},{"edgeType":"contains","source":8158,"target":8263},{"edgeType":"contains","source":3735,"target":3740},{"edgeType":"imports","source":13217,"target":13754},{"edgeType":"contains","source":16082,"target":16305},{"edgeType":"contains","source":14634,"target":14683},{"edgeType":"contains","source":15489,"target":15661},{"edgeType":"contains","source":1,"target":3221},{"edgeType":"contains","source":14695,"target":14906},{"edgeType":"contains","source":2828,"target":2258},{"edgeType":"contains","source":14366,"target":14535},{"edgeType":"calls","source":1302,"target":487},{"edgeType":"calls","source":2003,"target":2011},{"edgeType":"contains","source":11657,"target":11839},{"edgeType":"contains","source":12315,"target":12583},{"edgeType":"contains","source":12384,"target":12558},{"edgeType":"contains","source":6245,"target":6260},{"edgeType":"contains","source":15960,"target":15858},{"edgeType":"contains","source":14342,"target":8937},{"edgeType":"contains","source":16082,"target":16306},{"edgeType":"contains","source":14695,"target":14907},{"edgeType":"contains","source":16082,"target":16304},{"edgeType":"contains","source":6245,"target":6261},{"edgeType":"contains","source":14634,"target":14684},{"edgeType":"contains","source":960,"target":974},{"edgeType":"contains","source":2939,"target":3046},{"edgeType":"calls","source":7788,"target":286},{"edgeType":"contains","source":7301,"target":7350},{"edgeType":"calls","source":5393,"target":4735},{"edgeType":"contains","source":11657,"target":11840},{"edgeType":"calls","source":2862,"target":2863},{"edgeType":"contains","source":14172,"target":14208},{"edgeType":"calls","source":748,"target":748},{"edgeType":"calls","source":8813,"target":8678},{"edgeType":"contains","source":8158,"target":8265},{"edgeType":"contains","source":12191,"target":12198},{"edgeType":"contains","source":5915,"target":5921},{"edgeType":"contains","source":12315,"target":12564},{"edgeType":"contains","source":9681,"target":9654},{"edgeType":"contains","source":166,"target":189},{"edgeType":"imports","source":11756,"target":4072},{"edgeType":"contains","source":16088,"target":16105},{"edgeType":"contains","source":1768,"target":1266},{"edgeType":"contains","source":10539,"target":10540},{"edgeType":"imports","source":16164,"target":612},{"edgeType":"contains","source":14634,"target":14669},{"edgeType":"contains","source":1167,"target":869},{"edgeType":"contains","source":12783,"target":12855},{"edgeType":"calls","source":14780,"target":13940},{"edgeType":"calls","source":7329,"target":6028},{"edgeType":"contains","source":166,"target":188},{"edgeType":"contains","source":11657,"target":11822},{"edgeType":"calls","source":10131,"target":10070},{"edgeType":"contains","source":4527,"target":4528},{"edgeType":"calls","source":15019,"target":14988},{"edgeType":"contains","source":14634,"target":14670},{"edgeType":"contains","source":12587,"target":12588},{"edgeType":"contains","source":7828,"target":7902},{"edgeType":"contains","source":1422,"target":1423},{"edgeType":"calls","source":10799,"target":10506},{"edgeType":"contains","source":628,"target":668},{"edgeType":"calls","source":2558,"target":1744},{"edgeType":"contains","source":9613,"target":9650},{"edgeType":"calls","source":2607,"target":2339},{"edgeType":"contains","source":16088,"target":16107},{"edgeType":"contains","source":16082,"target":16293},{"edgeType":"contains","source":10992,"target":723},{"edgeType":"contains","source":15483,"target":15834},{"edgeType":"contains","source":12849,"target":12921},{"edgeType":"contains","source":13181,"target":13199},{"edgeType":"calls","source":5393,"target":4765},{"edgeType":"contains","source":7301,"target":7328},{"edgeType":"contains","source":9541,"target":9767},{"edgeType":"imports","source":14316,"target":2935},{"edgeType":"contains","source":9613,"target":9649},{"edgeType":"contains","source":2939,"target":3017},{"edgeType":"contains","source":6593,"target":6023},{"edgeType":"calls","source":14291,"target":14296},{"edgeType":"contains","source":628,"target":667},{"edgeType":"contains","source":6443,"target":6445},{"edgeType":"contains","source":7301,"target":7329},{"edgeType":"imports","source":10937,"target":10431},{"edgeType":"imports","source":15876,"target":15883},{"edgeType":"calls","source":947,"target":950},{"edgeType":"contains","source":8949,"target":9087},{"edgeType":"contains","source":628,"target":670},{"edgeType":"contains","source":6310,"target":6332},{"edgeType":"contains","source":16082,"target":16295},{"edgeType":"imports","source":15758,"target":15308},{"edgeType":"calls","source":2268,"target":2276},{"edgeType":"contains","source":15758,"target":15768},{"edgeType":"contains","source":11382,"target":11885},{"edgeType":"calls","source":7425,"target":7283},{"edgeType":"contains","source":8131,"target":620},{"edgeType":"contains","source":14634,"target":14673},{"edgeType":"contains","source":2939,"target":3022},{"edgeType":"contains","source":10010,"target":10022},{"edgeType":"contains","source":628,"target":669},{"edgeType":"contains","source":12384,"target":12534},{"edgeType":"contains","source":5452,"target":5454},{"edgeType":"contains","source":8949,"target":9086},{"edgeType":"contains","source":12908,"target":13203},{"edgeType":"contains","source":2080,"target":2169},{"edgeType":"contains","source":16082,"target":16294},{"edgeType":"contains","source":12849,"target":12918},{"edgeType":"contains","source":16487,"target":16424},{"edgeType":"calls","source":3762,"target":358},{"edgeType":"contains","source":3395,"target":3685},{"edgeType":"imports","source":4545,"target":1410},{"edgeType":"contains","source":14634,"target":14674},{"edgeType":"contains","source":9613,"target":9646},{"edgeType":"contains","source":628,"target":672},{"edgeType":"calls","source":1897,"target":1094},{"edgeType":"contains","source":2080,"target":2166},{"edgeType":"contains","source":13181,"target":13195},{"edgeType":"calls","source":1812,"target":1615},{"edgeType":"contains","source":16218,"target":16309},{"edgeType":"contains","source":16082,"target":16297},{"edgeType":"contains","source":6310,"target":6334},{"edgeType":"calls","source":4383,"target":2246},{"edgeType":"calls","source":9536,"target":9496},{"edgeType":"contains","source":1,"target":9539},{"edgeType":"imports","source":5227,"target":1410},{"edgeType":"contains","source":10010,"target":10020},{"edgeType":"calls","source":13371,"target":540},{"edgeType":"calls","source":14164,"target":14010},{"edgeType":"contains","source":14634,"target":14675},{"edgeType":"contains","source":1422,"target":1424},{"edgeType":"calls","source":8482,"target":8345},{"edgeType":"imports","source":2618,"target":1940},{"edgeType":"contains","source":628,"target":671},{"edgeType":"contains","source":2080,"target":2167},{"edgeType":"contains","source":16088,"target":16110},{"edgeType":"contains","source":16082,"target":16296},{"edgeType":"contains","source":6310,"target":6335},{"edgeType":"imports","source":9754,"target":600},{"edgeType":"contains","source":10010,"target":10021},{"edgeType":"contains","source":12783,"target":12848},{"edgeType":"contains","source":960,"target":949},{"edgeType":"calls","source":2072,"target":2009},{"edgeType":"contains","source":2939,"target":3021},{"edgeType":"calls","source":2102,"target":1079},{"edgeType":"contains","source":1768,"target":1269},{"edgeType":"calls","source":16345,"target":16161},{"edgeType":"calls","source":12723,"target":3715},{"edgeType":"contains","source":14695,"target":14899},{"edgeType":"contains","source":13390,"target":13057},{"edgeType":"contains","source":1422,"target":1425},{"edgeType":"contains","source":13447,"target":13420},{"edgeType":"contains","source":2479,"target":2488},{"edgeType":"contains","source":9350,"target":9353},{"edgeType":"contains","source":628,"target":674},{"edgeType":"calls","source":6338,"target":833},{"edgeType":"contains","source":11597,"target":11575},{"edgeType":"contains","source":6111,"target":6171},{"edgeType":"contains","source":11657,"target":11829},{"edgeType":"contains","source":2080,"target":2172},{"edgeType":"contains","source":7830,"target":7849},{"edgeType":"calls","source":2268,"target":2272},{"edgeType":"contains","source":6245,"target":6246},{"edgeType":"contains","source":12256,"target":12288},{"edgeType":"calls","source":9142,"target":9026},{"edgeType":"calls","source":1144,"target":1175},{"edgeType":"contains","source":628,"target":673},{"edgeType":"contains","source":9775,"target":405},{"edgeType":"calls","source":11715,"target":11715},{"edgeType":"contains","source":2479,"target":2489},{"edgeType":"calls","source":6931,"target":5690},{"edgeType":"calls","source":2405,"target":2254},{"edgeType":"contains","source":2080,"target":2173},{"edgeType":"contains","source":7239,"target":801},{"edgeType":"calls","source":15107,"target":5926},{"edgeType":"calls","source":1673,"target":1688},{"edgeType":"calls","source":16178,"target":15006},{"edgeType":"calls","source":13235,"target":13216},{"edgeType":"calls","source":15155,"target":15009},{"edgeType":"contains","source":5321,"target":5290},{"edgeType":"calls","source":1079,"target":1079},{"edgeType":"imports","source":12413,"target":612},{"edgeType":"contains","source":14470,"target":9176},{"edgeType":"contains","source":14694,"target":14916},{"edgeType":"contains","source":6179,"target":6180},{"edgeType":"contains","source":628,"target":676},{"edgeType":"contains","source":10763,"target":5716},{"edgeType":"imports","source":10919,"target":10982},{"edgeType":"calls","source":6300,"target":6226},{"edgeType":"calls","source":3325,"target":3329},{"edgeType":"contains","source":2479,"target":2487},{"edgeType":"contains","source":2080,"target":2171},{"edgeType":"contains","source":11657,"target":11828},{"edgeType":"imports","source":3786,"target":3788},{"edgeType":"contains","source":1,"target":9542},{"edgeType":"calls","source":15015,"target":15122},{"edgeType":"contains","source":2939,"target":3025},{"edgeType":"calls","source":2268,"target":2271},{"edgeType":"imports","source":2679,"target":61},{"edgeType":"contains","source":15229,"target":15245},{"edgeType":"calls","source":16009,"target":16012},{"edgeType":"contains","source":15758,"target":15760},{"edgeType":"calls","source":749,"target":732},{"edgeType":"contains","source":11657,"target":11825},{"edgeType":"calls","source":7651,"target":286},{"edgeType":"contains","source":16222,"target":16175},{"edgeType":"contains","source":15483,"target":15828},{"edgeType":"calls","source":1611,"target":1493},{"edgeType":"contains","source":2080,"target":2177},{"edgeType":"contains","source":6377,"target":6378},{"edgeType":"calls","source":3525,"target":3468},{"edgeType":"contains","source":7301,"target":7330},{"edgeType":"calls","source":2111,"target":793},{"edgeType":"imports","source":10937,"target":10430},{"edgeType":"contains","source":2939,"target":3030},{"edgeType":"calls","source":3325,"target":3327},{"edgeType":"contains","source":6111,"target":6168},{"edgeType":"imports","source":15484,"target":15336},{"edgeType":"calls","source":6643,"target":6166},{"edgeType":"calls","source":3866,"target":3468},{"edgeType":"calls","source":11526,"target":11236},{"edgeType":"contains","source":7301,"target":7331},{"edgeType":"contains","source":10922,"target":786},{"edgeType":"calls","source":6300,"target":6229},{"edgeType":"calls","source":2031,"target":1156},{"edgeType":"contains","source":9350,"target":9351},{"edgeType":"contains","source":11657,"target":11823},{"edgeType":"contains","source":9541,"target":9772},{"edgeType":"calls","source":14787,"target":3162},{"edgeType":"contains","source":2479,"target":2490},{"edgeType":"calls","source":4929,"target":2224},{"edgeType":"contains","source":6111,"target":6169},{"edgeType":"contains","source":2080,"target":2174},{"edgeType":"calls","source":6962,"target":6848},{"edgeType":"calls","source":2934,"target":2760},{"edgeType":"contains","source":4924,"target":4916},{"edgeType":"contains","source":4197,"target":4199},{"edgeType":"contains","source":14634,"target":14667},{"edgeType":"imports","source":10937,"target":10428},{"edgeType":"imports","source":10919,"target":10986},{"edgeType":"contains","source":15513,"target":4330},{"edgeType":"contains","source":2939,"target":3028},{"edgeType":"contains","source":7301,"target":7334},{"edgeType":"contains","source":11657,"target":11824},{"edgeType":"contains","source":2080,"target":2175},{"edgeType":"contains","source":6111,"target":6170},{"edgeType":"calls","source":2934,"target":2761},{"edgeType":"contains","source":4197,"target":4198},{"edgeType":"contains","source":2080,"target":2176},{"edgeType":"imports","source":10919,"target":10985},{"edgeType":"calls","source":16178,"target":15004},{"edgeType":"contains","source":14695,"target":14875},{"edgeType":"contains","source":960,"target":928},{"edgeType":"calls","source":10512,"target":358},{"edgeType":"contains","source":4999,"target":4679},{"edgeType":"calls","source":2669,"target":2484},{"edgeType":"calls","source":947,"target":899},{"edgeType":"imports","source":6305,"target":6089},{"edgeType":"contains","source":5717,"target":5676},{"edgeType":"contains","source":9283,"target":9291},{"edgeType":"contains","source":12316,"target":12517},{"edgeType":"contains","source":15034,"target":14936},{"edgeType":"contains","source":13772,"target":13890},{"edgeType":"contains","source":8949,"target":9074},{"edgeType":"contains","source":2939,"target":3001},{"edgeType":"contains","source":15959,"target":15858},{"edgeType":"contains","source":16282,"target":16417},{"edgeType":"contains","source":4724,"target":4747},{"edgeType":"contains","source":16088,"target":16089},{"edgeType":"calls","source":8016,"target":7968},{"edgeType":"contains","source":14695,"target":14876},{"edgeType":"calls","source":9233,"target":8294},{"edgeType":"contains","source":12316,"target":12516},{"edgeType":"contains","source":16352,"target":16360},{"edgeType":"contains","source":8949,"target":9073},{"edgeType":"contains","source":10010,"target":10011},{"edgeType":"contains","source":16282,"target":16416},{"edgeType":"contains","source":4724,"target":4746},{"edgeType":"contains","source":12256,"target":12262},{"edgeType":"calls","source":2070,"target":2028},{"edgeType":"calls","source":11457,"target":2772},{"edgeType":"imports","source":2618,"target":1995},{"edgeType":"contains","source":9283,"target":9293},{"edgeType":"imports","source":12469,"target":3162},{"edgeType":"contains","source":16352,"target":16363},{"edgeType":"contains","source":13118,"target":13021},{"edgeType":"calls","source":1805,"target":1786},{"edgeType":"calls","source":9402,"target":9401},{"edgeType":"contains","source":4724,"target":4745},{"edgeType":"contains","source":12316,"target":12515},{"edgeType":"contains","source":960,"target":929},{"edgeType":"contains","source":12759,"target":13579},{"edgeType":"contains","source":13181,"target":13182},{"edgeType":"contains","source":13313,"target":13318},{"edgeType":"imports","source":12392,"target":3436},{"edgeType":"contains","source":2079,"target":2178},{"edgeType":"contains","source":13772,"target":13887},{"edgeType":"contains","source":16352,"target":16362},{"edgeType":"calls","source":16668,"target":16706},{"edgeType":"contains","source":8949,"target":9075},{"edgeType":"contains","source":12316,"target":12514},{"edgeType":"contains","source":4724,"target":4744},{"edgeType":"contains","source":2939,"target":3006},{"edgeType":"contains","source":16488,"target":16377},{"edgeType":"contains","source":3435,"target":4543},{"edgeType":"contains","source":9613,"target":9627},{"edgeType":"contains","source":13772,"target":13886},{"edgeType":"contains","source":8949,"target":9070},{"edgeType":"contains","source":16352,"target":16365},{"edgeType":"contains","source":16282,"target":16421},{"edgeType":"contains","source":5714,"target":5766},{"edgeType":"calls","source":8279,"target":8277},{"edgeType":"contains","source":13313,"target":13316},{"edgeType":"contains","source":3435,"target":4542},{"edgeType":"imports","source":10832,"target":1058},{"edgeType":"contains","source":12384,"target":12518},{"edgeType":"contains","source":8949,"target":9069},{"edgeType":"calls","source":1277,"target":1234},{"edgeType":"imports","source":3330,"target":3174},{"edgeType":"calls","source":15809,"target":3162},{"edgeType":"contains","source":16282,"target":16420},{"edgeType":"contains","source":16352,"target":16364},{"edgeType":"contains","source":15483,"target":15821},{"edgeType":"imports","source":15779,"target":14705},{"edgeType":"contains","source":12316,"target":12512},{"edgeType":"contains","source":1,"target":15861},{"edgeType":"contains","source":9283,"target":9289},{"edgeType":"contains","source":960,"target":934},{"edgeType":"imports","source":9472,"target":9391},{"edgeType":"calls","source":15630,"target":2369},{"edgeType":"contains","source":7103,"target":7104},{"edgeType":"contains","source":11596,"target":11575},{"edgeType":"contains","source":3472,"target":3394},{"edgeType":"contains","source":3435,"target":4541},{"edgeType":"contains","source":5608,"target":4825},{"edgeType":"calls","source":6807,"target":1058},{"edgeType":"contains","source":8949,"target":9072},{"edgeType":"contains","source":16282,"target":16423},{"edgeType":"contains","source":13772,"target":13884},{"edgeType":"calls","source":3852,"target":3858},{"edgeType":"calls","source":15707,"target":2097},{"edgeType":"contains","source":12256,"target":12257},{"edgeType":"contains","source":12316,"target":12511},{"edgeType":"contains","source":15483,"target":15822},{"edgeType":"contains","source":166,"target":179},{"edgeType":"imports","source":6959,"target":6962},{"edgeType":"contains","source":6580,"target":6404},{"edgeType":"imports","source":8797,"target":9176},{"edgeType":"calls","source":7950,"target":7908},{"edgeType":"contains","source":13313,"target":13314},{"edgeType":"contains","source":11657,"target":11799},{"edgeType":"contains","source":13772,"target":13883},{"edgeType":"contains","source":3435,"target":4540},{"edgeType":"contains","source":14695,"target":14882},{"edgeType":"contains","source":16282,"target":16422},{"edgeType":"contains","source":8949,"target":9071},{"edgeType":"calls","source":10071,"target":1349},{"edgeType":"contains","source":16352,"target":16366},{"edgeType":"calls","source":615,"target":618},{"edgeType":"calls","source":2735,"target":433},{"edgeType":"contains","source":12316,"target":12510},{"edgeType":"imports","source":15800,"target":7714},{"edgeType":"imports","source":2619,"target":1974},{"edgeType":"contains","source":12316,"target":12525},{"edgeType":"calls","source":8292,"target":7877},{"edgeType":"contains","source":15493,"target":15498},{"edgeType":"contains","source":1,"target":15866},{"edgeType":"calls","source":7988,"target":388},{"edgeType":"contains","source":10010,"target":10018},{"edgeType":"contains","source":9775,"target":389},{"edgeType":"imports","source":9472,"target":9380},{"edgeType":"contains","source":5782,"target":5784},{"edgeType":"calls","source":6243,"target":5842},{"edgeType":"contains","source":16352,"target":16353},{"edgeType":"contains","source":11936,"target":11621},{"edgeType":"calls","source":4381,"target":4371},{"edgeType":"contains","source":166,"target":181},{"edgeType":"contains","source":2080,"target":2156},{"edgeType":"contains","source":14634,"target":14644},{"edgeType":"contains","source":6310,"target":6329},{"edgeType":"calls","source":8808,"target":8793},{"edgeType":"imports","source":12378,"target":12316},{"edgeType":"calls","source":6504,"target":6226},{"edgeType":"calls","source":8405,"target":2261},{"edgeType":"contains","source":12316,"target":12524},{"edgeType":"contains","source":10922,"target":773},{"edgeType":"contains","source":2939,"target":3011},{"edgeType":"contains","source":15493,"target":15499},{"edgeType":"contains","source":10010,"target":10019},{"edgeType":"contains","source":628,"target":656},{"edgeType":"calls","source":10238,"target":402},{"edgeType":"contains","source":14371,"target":14342},{"edgeType":"calls","source":2333,"target":2323},{"edgeType":"contains","source":15204,"target":1203},{"edgeType":"contains","source":166,"target":180},{"edgeType":"contains","source":14634,"target":14645},{"edgeType":"contains","source":166,"target":183},{"edgeType":"contains","source":8949,"target":9085},{"edgeType":"contains","source":15483,"target":15810},{"edgeType":"calls","source":10463,"target":10343},{"edgeType":"calls","source":681,"target":683},{"edgeType":"contains","source":2080,"target":2154},{"edgeType":"calls","source":7701,"target":831},{"edgeType":"contains","source":10010,"target":10016},{"edgeType":"contains","source":166,"target":182},{"edgeType":"contains","source":15493,"target":15501},{"edgeType":"contains","source":3395,"target":3670},{"edgeType":"contains","source":8949,"target":9084},{"edgeType":"contains","source":10459,"target":2440},{"edgeType":"contains","source":12316,"target":12522},{"edgeType":"contains","source":2080,"target":2155},{"edgeType":"calls","source":2465,"target":2457},{"edgeType":"contains","source":10010,"target":10017},{"edgeType":"contains","source":16282,"target":16410},{"edgeType":"calls","source":8019,"target":7888},{"edgeType":"contains","source":166,"target":185},{"edgeType":"contains","source":13313,"target":13325},{"edgeType":"calls","source":6504,"target":6229},{"edgeType":"contains","source":12988,"target":12830},{"edgeType":"contains","source":15229,"target":15230},{"edgeType":"calls","source":12507,"target":12518},{"edgeType":"calls","source":14357,"target":14363},{"edgeType":"contains","source":12316,"target":12521},{"edgeType":"contains","source":14634,"target":14648},{"edgeType":"imports","source":12378,"target":3855},{"edgeType":"contains","source":16352,"target":16357},{"edgeType":"contains","source":10010,"target":10014},{"edgeType":"calls","source":10594,"target":10514},{"edgeType":"contains","source":14695,"target":14872},{"edgeType":"contains","source":8949,"target":9078},{"edgeType":"imports","source":2622,"target":1876},{"edgeType":"calls","source":11789,"target":11523},{"edgeType":"contains","source":9283,"target":9294},{"edgeType":"contains","source":15229,"target":15231},{"edgeType":"calls","source":8140,"target":8366},{"edgeType":"contains","source":9376,"target":2183},{"edgeType":"calls","source":16341,"target":16275},{"edgeType":"calls","source":2735,"target":427},{"edgeType":"contains","source":12316,"target":12520},{"edgeType":"calls","source":8808,"target":8798},{"edgeType":"calls","source":2536,"target":2368},{"edgeType":"contains","source":14634,"target":14649},{"edgeType":"contains","source":16218,"target":16282},{"edgeType":"contains","source":10010,"target":10015},{"edgeType":"contains","source":16282,"target":16412},{"edgeType":"contains","source":16352,"target":16356},{"edgeType":"calls","source":15030,"target":14635},{"edgeType":"contains","source":14634,"target":14650},{"edgeType":"contains","source":10922,"target":766},{"edgeType":"contains","source":5676,"target":611},{"edgeType":"contains","source":10010,"target":10012},{"edgeType":"calls","source":2861,"target":2860},{"edgeType":"contains","source":5990,"target":5676},{"edgeType":"contains","source":166,"target":186},{"edgeType":"contains","source":14634,"target":14651},{"edgeType":"contains","source":14695,"target":14874},{"edgeType":"contains","source":8949,"target":9080},{"edgeType":"contains","source":2939,"target":3013},{"edgeType":"contains","source":9090,"target":8937},{"edgeType":"contains","source":13181,"target":13186},{"edgeType":"contains","source":15095,"target":15159},{"edgeType":"imports","source":9271,"target":9272},{"edgeType":"contains","source":10010,"target":10013},{"edgeType":"contains","source":5782,"target":5783},{"edgeType":"calls","source":8808,"target":8800},{"edgeType":"calls","source":975,"target":2134},{"edgeType":"contains","source":2080,"target":2131},{"edgeType":"contains","source":3395,"target":3648},{"edgeType":"calls","source":1011,"target":1046},{"edgeType":"contains","source":1406,"target":1884},{"edgeType":"contains","source":9613,"target":9615},{"edgeType":"contains","source":13772,"target":13874},{"edgeType":"contains","source":1,"target":3157},{"edgeType":"contains","source":8949,"target":9058},{"edgeType":"contains","source":11788,"target":11955},{"edgeType":"contains","source":882,"target":1215},{"edgeType":"contains","source":2939,"target":2985},{"edgeType":"contains","source":16747,"target":16784},{"edgeType":"contains","source":7829,"target":7839},{"edgeType":"calls","source":14892,"target":14663},{"edgeType":"contains","source":14832,"target":14840},{"edgeType":"contains","source":11063,"target":11175},{"edgeType":"contains","source":3676,"target":3394},{"edgeType":"contains","source":1406,"target":1885},{"edgeType":"calls","source":1012,"target":1014},{"edgeType":"calls","source":15532,"target":5394},{"edgeType":"contains","source":882,"target":1214},{"edgeType":"contains","source":8346,"target":8723},{"edgeType":"imports","source":9472,"target":9373},{"edgeType":"contains","source":10522,"target":464},{"edgeType":"contains","source":12316,"target":12499},{"edgeType":"calls","source":8936,"target":9029},{"edgeType":"contains","source":7829,"target":7838},{"edgeType":"contains","source":15483,"target":15800},{"edgeType":"calls","source":9137,"target":9140},{"edgeType":"contains","source":14832,"target":14841},{"edgeType":"calls","source":14161,"target":14066},{"edgeType":"contains","source":11788,"target":11953},{"edgeType":"contains","source":8346,"target":8726},{"edgeType":"contains","source":10522,"target":461},{"edgeType":"contains","source":628,"target":635},{"edgeType":"contains","source":12316,"target":12498},{"edgeType":"contains","source":12378,"target":12690},{"edgeType":"contains","source":12256,"target":3788},{"edgeType":"calls","source":13438,"target":540},{"edgeType":"calls","source":8280,"target":8226},{"edgeType":"calls","source":814,"target":813},{"edgeType":"contains","source":13379,"target":13370},{"edgeType":"contains","source":12378,"target":12689},{"edgeType":"contains","source":13772,"target":13871},{"edgeType":"contains","source":9613,"target":9616},{"edgeType":"contains","source":9547,"target":9548},{"edgeType":"contains","source":11788,"target":11954},{"edgeType":"calls","source":2291,"target":1533},{"edgeType":"contains","source":12316,"target":12497},{"edgeType":"contains","source":5714,"target":5756},{"edgeType":"contains","source":7829,"target":7840},{"edgeType":"contains","source":14832,"target":14843},{"edgeType":"calls","source":9142,"target":8987},{"edgeType":"calls","source":6136,"target":724},{"edgeType":"calls","source":13475,"target":3627},{"edgeType":"contains","source":8820,"target":8825},{"edgeType":"contains","source":12316,"target":12496},{"edgeType":"calls","source":7882,"target":7882},{"edgeType":"calls","source":6165,"target":6167},{"edgeType":"contains","source":12448,"target":12632},{"edgeType":"contains","source":14634,"target":14640},{"edgeType":"calls","source":2536,"target":2392},{"edgeType":"contains","source":16282,"target":16403},{"edgeType":"calls","source":16272,"target":16275},{"edgeType":"calls","source":4711,"target":4730},{"edgeType":"calls","source":9998,"target":9936},{"edgeType":"contains","source":12316,"target":12495},{"edgeType":"contains","source":14634,"target":14641},{"edgeType":"calls","source":11005,"target":10433},{"edgeType":"calls","source":2796,"target":2789},{"edgeType":"calls","source":5042,"target":5040},{"edgeType":"contains","source":16747,"target":16787},{"edgeType":"contains","source":16282,"target":16406},{"edgeType":"calls","source":5323,"target":4784},{"edgeType":"contains","source":12384,"target":12500},{"edgeType":"calls","source":3207,"target":615},{"edgeType":"calls","source":9005,"target":9011},{"edgeType":"contains","source":8820,"target":8827},{"edgeType":"contains","source":10868,"target":10872},{"edgeType":"contains","source":12316,"target":12494},{"edgeType":"contains","source":8346,"target":8722},{"edgeType":"calls","source":349,"target":425},{"edgeType":"imports","source":15636,"target":4327},{"edgeType":"contains","source":14502,"target":14506},{"edgeType":"contains","source":1406,"target":1887},{"edgeType":"contains","source":14634,"target":14642},{"edgeType":"contains","source":16747,"target":16790},{"edgeType":"contains","source":11063,"target":11170},{"edgeType":"calls","source":8410,"target":8428},{"edgeType":"calls","source":6298,"target":6251},{"edgeType":"contains","source":1982,"target":944},{"edgeType":"contains","source":16282,"target":16405},{"edgeType":"contains","source":13261,"target":4339},{"edgeType":"imports","source":15636,"target":4326},{"edgeType":"contains","source":12316,"target":12493},{"edgeType":"contains","source":8820,"target":8826},{"edgeType":"calls","source":12223,"target":156},{"edgeType":"contains","source":15493,"target":15497},{"edgeType":"contains","source":15834,"target":15496},{"edgeType":"contains","source":7458,"target":311},{"edgeType":"contains","source":13375,"target":13489},{"edgeType":"contains","source":14634,"target":14643},{"edgeType":"calls","source":16880,"target":16455},{"edgeType":"contains","source":1406,"target":1888},{"edgeType":"contains","source":15889,"target":15890},{"edgeType":"contains","source":16747,"target":16775},{"edgeType":"calls","source":9536,"target":9465},{"edgeType":"contains","source":6310,"target":6312},{"edgeType":"contains","source":11063,"target":11183},{"edgeType":"contains","source":8346,"target":8733},{"edgeType":"calls","source":10861,"target":10672},{"edgeType":"contains","source":12316,"target":12509},{"edgeType":"calls","source":6428,"target":6451},{"edgeType":"contains","source":7100,"target":7190},{"edgeType":"contains","source":12587,"target":12564},{"edgeType":"calls","source":15016,"target":2369},{"edgeType":"contains","source":1,"target":15849},{"edgeType":"contains","source":628,"target":640},{"edgeType":"contains","source":7829,"target":7846},{"edgeType":"contains","source":5852,"target":5712},{"edgeType":"imports","source":15758,"target":15336},{"edgeType":"calls","source":6701,"target":6445},{"edgeType":"contains","source":12316,"target":12508},{"edgeType":"contains","source":16077,"target":16404},{"edgeType":"calls","source":6428,"target":6452},{"edgeType":"contains","source":12316,"target":12506},{"edgeType":"contains","source":7301,"target":7304},{"edgeType":"contains","source":16747,"target":16777},{"edgeType":"contains","source":5714,"target":5763},{"edgeType":"contains","source":13772,"target":13880},{"edgeType":"contains","source":7780,"target":7254},{"edgeType":"contains","source":14832,"target":14834},{"edgeType":"contains","source":166,"target":167},{"edgeType":"calls","source":2399,"target":2404},{"edgeType":"contains","source":1495,"target":1246},{"edgeType":"contains","source":8949,"target":9068},{"edgeType":"imports","source":2434,"target":1348},{"edgeType":"calls","source":1700,"target":821},{"edgeType":"calls","source":10393,"target":10382},{"edgeType":"contains","source":12908,"target":13181},{"edgeType":"contains","source":12316,"target":12505},{"edgeType":"contains","source":15889,"target":15893},{"edgeType":"contains","source":9283,"target":9284},{"edgeType":"contains","source":16747,"target":16776},{"edgeType":"contains","source":5714,"target":5764},{"edgeType":"imports","source":7239,"target":366},{"edgeType":"contains","source":8346,"target":8734},{"edgeType":"calls","source":2138,"target":2040},{"edgeType":"contains","source":13114,"target":13136},{"edgeType":"contains","source":11063,"target":11182},{"edgeType":"contains","source":15571,"target":15180},{"edgeType":"calls","source":8545,"target":2134},{"edgeType":"contains","source":15489,"target":15608},{"edgeType":"contains","source":12316,"target":12504},{"edgeType":"contains","source":15889,"target":15894},{"edgeType":"contains","source":13772,"target":13878},{"edgeType":"contains","source":8346,"target":8728},{"edgeType":"contains","source":7829,"target":7843},{"edgeType":"contains","source":166,"target":169},{"edgeType":"contains","source":8949,"target":9062},{"edgeType":"contains","source":9481,"target":9482},{"edgeType":"contains","source":12316,"target":12503},{"edgeType":"contains","source":15889,"target":15895},{"edgeType":"calls","source":9824,"target":540},{"edgeType":"contains","source":8346,"target":8727},{"edgeType":"calls","source":14686,"target":14717},{"edgeType":"contains","source":16746,"target":16809},{"edgeType":"calls","source":947,"target":902},{"edgeType":"contains","source":7829,"target":7842},{"edgeType":"contains","source":15483,"target":15796},{"edgeType":"contains","source":166,"target":168},{"edgeType":"contains","source":13388,"target":13096},{"edgeType":"contains","source":4724,"target":4742},{"edgeType":"contains","source":1055,"target":2205},{"edgeType":"contains","source":2939,"target":2998},{"edgeType":"contains","source":960,"target":922},{"edgeType":"contains","source":12316,"target":12502},{"edgeType":"calls","source":1408,"target":1413},{"edgeType":"calls","source":3521,"target":3557},{"edgeType":"imports","source":1375,"target":2462},{"edgeType":"imports","source":15821,"target":15496},{"edgeType":"calls","source":1700,"target":817},{"edgeType":"contains","source":166,"target":171},{"edgeType":"contains","source":8346,"target":8731},{"edgeType":"contains","source":16746,"target":16813},{"edgeType":"contains","source":8949,"target":9064},{"edgeType":"contains","source":960,"target":925},{"edgeType":"contains","source":2939,"target":2995},{"edgeType":"contains","source":12316,"target":12501},{"edgeType":"contains","source":8346,"target":8729},{"edgeType":"contains","source":12384,"target":12507},{"edgeType":"contains","source":16352,"target":16341},{"edgeType":"contains","source":13375,"target":13497},{"edgeType":"contains","source":7829,"target":7844},{"edgeType":"contains","source":166,"target":170},{"edgeType":"calls","source":349,"target":416},{"edgeType":"contains","source":8346,"target":8730},{"edgeType":"contains","source":14634,"target":14635},{"edgeType":"calls","source":10506,"target":540},{"edgeType":"contains","source":8949,"target":9063},{"edgeType":"calls","source":11980,"target":11925},{"edgeType":"contains","source":628,"target":646},{"edgeType":"calls","source":4275,"target":3438},{"edgeType":"contains","source":7100,"target":7189},{"edgeType":"contains","source":4458,"target":4504},{"edgeType":"contains","source":16747,"target":16767},{"edgeType":"imports","source":12907,"target":12870},{"edgeType":"calls","source":6243,"target":5950},{"edgeType":"contains","source":9876,"target":9902},{"edgeType":"calls","source":6810,"target":1058},{"edgeType":"calls","source":12828,"target":540},{"edgeType":"contains","source":11061,"target":11221},{"edgeType":"contains","source":13114,"target":13115},{"edgeType":"contains","source":12316,"target":12484},{"edgeType":"contains","source":6111,"target":6114},{"edgeType":"contains","source":8949,"target":9041},{"edgeType":"calls","source":3937,"target":3442},{"edgeType":"contains","source":8291,"target":8299},{"edgeType":"imports","source":1375,"target":2510},{"edgeType":"contains","source":13375,"target":13479},{"edgeType":"contains","source":4458,"target":4503},{"edgeType":"contains","source":7828,"target":7852},{"edgeType":"contains","source":16747,"target":16766},{"edgeType":"contains","source":11061,"target":11222},{"edgeType":"calls","source":14965,"target":8288},{"edgeType":"contains","source":8949,"target":9040},{"edgeType":"contains","source":8291,"target":8298},{"edgeType":"contains","source":13114,"target":13113},{"edgeType":"contains","source":2080,"target":2116},{"edgeType":"calls","source":2402,"target":2405},{"edgeType":"contains","source":10078,"target":9984},{"edgeType":"contains","source":12378,"target":12675},{"edgeType":"contains","source":4458,"target":4502},{"edgeType":"imports","source":14871,"target":612},{"edgeType":"contains","source":15525,"target":6027},{"edgeType":"contains","source":13311,"target":13348},{"edgeType":"contains","source":13375,"target":13478},{"edgeType":"contains","source":11788,"target":11936},{"edgeType":"calls","source":3991,"target":3880},{"edgeType":"calls","source":4005,"target":3446},{"edgeType":"contains","source":5979,"target":5980},{"edgeType":"contains","source":2939,"target":2966},{"edgeType":"contains","source":12316,"target":12482},{"edgeType":"contains","source":8291,"target":8301},{"edgeType":"contains","source":12384,"target":12488},{"edgeType":"contains","source":12378,"target":12674},{"edgeType":"contains","source":16747,"target":16768},{"edgeType":"contains","source":15086,"target":610},{"edgeType":"contains","source":4458,"target":4501},{"edgeType":"contains","source":9876,"target":9901},{"edgeType":"imports","source":9090,"target":2236},{"edgeType":"contains","source":15205,"target":1149},{"edgeType":"imports","source":2924,"target":997},{"edgeType":"calls","source":975,"target":2246},{"edgeType":"contains","source":2080,"target":2114},{"edgeType":"calls","source":4570,"target":730},{"edgeType":"calls","source":7980,"target":730},{"edgeType":"calls","source":9206,"target":9233},{"edgeType":"contains","source":12915,"target":12938},{"edgeType":"contains","source":5979,"target":5981},{"edgeType":"calls","source":11460,"target":11236},{"edgeType":"contains","source":8291,"target":8300},{"edgeType":"contains","source":12316,"target":12481},{"edgeType":"contains","source":16018,"target":16113},{"edgeType":"contains","source":12256,"target":3769},{"edgeType":"calls","source":2870,"target":2690},{"edgeType":"contains","source":7460,"target":4458},{"edgeType":"imports","source":14954,"target":4375},{"edgeType":"contains","source":3268,"target":3344},{"edgeType":"contains","source":13375,"target":13476},{"edgeType":"contains","source":11595,"target":11575},{"edgeType":"contains","source":11063,"target":11154},{"edgeType":"contains","source":8224,"target":8258},{"edgeType":"contains","source":2080,"target":2119},{"edgeType":"contains","source":4197,"target":4143},{"edgeType":"contains","source":12915,"target":12937},{"edgeType":"contains","source":16747,"target":16770},{"edgeType":"contains","source":1651,"target":620},{"edgeType":"contains","source":12256,"target":3768},{"edgeType":"contains","source":960,"target":898},{"edgeType":"contains","source":7711,"target":7247},{"edgeType":"calls","source":8491,"target":8145},{"edgeType":"contains","source":15305,"target":4394},{"edgeType":"contains","source":13772,"target":13852},{"edgeType":"calls","source":15357,"target":15159},{"edgeType":"contains","source":2080,"target":2120},{"edgeType":"calls","source":11590,"target":11440},{"edgeType":"contains","source":15889,"target":15886},{"edgeType":"calls","source":8811,"target":8798},{"edgeType":"contains","source":5054,"target":5057},{"edgeType":"contains","source":12064,"target":11833},{"edgeType":"imports","source":11788,"target":11621},{"edgeType":"contains","source":3268,"target":3342},{"edgeType":"contains","source":13375,"target":13474},{"edgeType":"contains","source":16747,"target":16773},{"edgeType":"contains","source":16746,"target":16804},{"edgeType":"contains","source":6250,"target":6031},{"edgeType":"contains","source":8949,"target":9039},{"edgeType":"calls","source":11860,"target":11523},{"edgeType":"calls","source":2547,"target":2131},{"edgeType":"contains","source":8291,"target":8297},{"edgeType":"contains","source":8159,"target":8161},{"edgeType":"contains","source":10339,"target":10342},{"edgeType":"contains","source":2080,"target":2117},{"edgeType":"contains","source":6111,"target":6112},{"edgeType":"calls","source":2075,"target":1965},{"edgeType":"contains","source":5054,"target":5056},{"edgeType":"contains","source":7094,"target":7351},{"edgeType":"contains","source":15095,"target":15134},{"edgeType":"contains","source":7828,"target":7850},{"edgeType":"contains","source":13772,"target":13850},{"edgeType":"contains","source":8291,"target":8296},{"edgeType":"contains","source":2080,"target":2118},{"edgeType":"contains","source":13324,"target":12939},{"edgeType":"contains","source":12783,"target":12798},{"edgeType":"contains","source":13114,"target":13123},{"edgeType":"contains","source":12316,"target":12492},{"edgeType":"calls","source":1677,"target":1615},{"edgeType":"contains","source":8820,"target":8821},{"edgeType":"contains","source":10868,"target":10870},{"edgeType":"contains","source":3268,"target":3348},{"edgeType":"contains","source":2080,"target":2123},{"edgeType":"contains","source":13375,"target":13488},{"edgeType":"imports","source":13772,"target":13529},{"edgeType":"contains","source":2939,"target":2978},{"edgeType":"contains","source":960,"target":902},{"edgeType":"contains","source":13313,"target":13295},{"edgeType":"contains","source":12759,"target":13556},{"edgeType":"contains","source":10868,"target":10871},{"edgeType":"contains","source":13375,"target":13487},{"edgeType":"contains","source":2080,"target":2124},{"edgeType":"contains","source":882,"target":1209},{"edgeType":"contains","source":6443,"target":6402},{"edgeType":"contains","source":13375,"target":13486},{"edgeType":"contains","source":8949,"target":9052},{"edgeType":"contains","source":15426,"target":15430},{"edgeType":"calls","source":4648,"target":4647},{"edgeType":"calls","source":15506,"target":2097},{"edgeType":"contains","source":7829,"target":7833},{"edgeType":"contains","source":2080,"target":2121},{"edgeType":"contains","source":6111,"target":6124},{"edgeType":"contains","source":16282,"target":16378},{"edgeType":"calls","source":4516,"target":4511},{"edgeType":"calls","source":14783,"target":13940},{"edgeType":"contains","source":882,"target":1208},{"edgeType":"calls","source":4383,"target":4404},{"edgeType":"contains","source":13375,"target":13485},{"edgeType":"calls","source":8681,"target":2261},{"edgeType":"calls","source":1306,"target":433},{"edgeType":"contains","source":960,"target":904},{"edgeType":"contains","source":1055,"target":2187},{"edgeType":"contains","source":3268,"target":3347},{"edgeType":"contains","source":15562,"target":15443},{"edgeType":"contains","source":10868,"target":10869},{"edgeType":"contains","source":8820,"target":8822},{"edgeType":"calls","source":9802,"target":9791},{"edgeType":"contains","source":16747,"target":16760},{"edgeType":"contains","source":7829,"target":7832},{"edgeType":"imports","source":10329,"target":10334},{"edgeType":"contains","source":15483,"target":15779},{"edgeType":"contains","source":4931,"target":4652},{"edgeType":"calls","source":8886,"target":2251},{"edgeType":"contains","source":13375,"target":13484},{"edgeType":"contains","source":1406,"target":1880},{"edgeType":"contains","source":628,"target":629},{"edgeType":"calls","source":11520,"target":11503},{"edgeType":"contains","source":2939,"target":2981},{"edgeType":"contains","source":882,"target":1211},{"edgeType":"imports","source":882,"target":883},{"edgeType":"calls","source":684,"target":683},{"edgeType":"contains","source":13375,"target":13483},{"edgeType":"contains","source":1406,"target":1881},{"edgeType":"contains","source":5714,"target":5741},{"edgeType":"contains","source":882,"target":1210},{"edgeType":"contains","source":12316,"target":12487},{"edgeType":"contains","source":7562,"target":7647},{"edgeType":"imports","source":882,"target":884},{"edgeType":"calls","source":14530,"target":9098},{"edgeType":"contains","source":16747,"target":16762},{"edgeType":"contains","source":8291,"target":8302},{"edgeType":"calls","source":881,"target":920},{"edgeType":"calls","source":10739,"target":10343},{"edgeType":"contains","source":13375,"target":13482},{"edgeType":"contains","source":8346,"target":8714},{"edgeType":"contains","source":1406,"target":1878},{"edgeType":"contains","source":14694,"target":14871},{"edgeType":"calls","source":8018,"target":8020},{"edgeType":"contains","source":14954,"target":15267},{"edgeType":"contains","source":4724,"target":4725},{"edgeType":"contains","source":9628,"target":683},{"edgeType":"contains","source":882,"target":1213},{"edgeType":"contains","source":3268,"target":3350},{"edgeType":"calls","source":1015,"target":994},{"edgeType":"contains","source":5847,"target":5848},{"edgeType":"contains","source":12378,"target":12678},{"edgeType":"calls","source":13174,"target":13080},{"edgeType":"calls","source":8945,"target":8881},{"edgeType":"contains","source":13375,"target":13481},{"edgeType":"contains","source":1406,"target":1879},{"edgeType":"contains","source":628,"target":630},{"edgeType":"calls","source":14415,"target":2091},{"edgeType":"contains","source":7093,"target":7390},{"edgeType":"contains","source":2939,"target":2980},{"edgeType":"contains","source":882,"target":1212},{"edgeType":"contains","source":12316,"target":12485},{"edgeType":"calls","source":1287,"target":1017},{"edgeType":"imports","source":12256,"target":1331},{"edgeType":"contains","source":11657,"target":11755},{"edgeType":"contains","source":8096,"target":7985},{"edgeType":"contains","source":10133,"target":10375},{"edgeType":"contains","source":10522,"target":430},{"edgeType":"contains","source":13378,"target":13370},{"edgeType":"contains","source":4458,"target":4487},{"edgeType":"calls","source":8152,"target":8063},{"edgeType":"calls","source":1278,"target":1324},{"edgeType":"calls","source":2642,"target":1323},{"edgeType":"contains","source":12821,"target":13725},{"edgeType":"calls","source":7159,"target":7136},{"edgeType":"contains","source":15822,"target":15829},{"edgeType":"contains","source":13772,"target":13840},{"edgeType":"calls","source":15879,"target":15877},{"edgeType":"contains","source":4392,"target":4418},{"edgeType":"imports","source":15637,"target":4330},{"edgeType":"contains","source":16218,"target":16236},{"edgeType":"contains","source":4458,"target":4486},{"edgeType":"contains","source":12783,"target":12788},{"edgeType":"contains","source":16747,"target":16750},{"edgeType":"contains","source":5516,"target":5517},{"edgeType":"contains","source":8224,"target":8247},{"edgeType":"calls","source":9272,"target":9285},{"edgeType":"contains","source":4392,"target":4417},{"edgeType":"contains","source":15822,"target":15830},{"edgeType":"calls","source":11860,"target":11503},{"edgeType":"contains","source":10669,"target":10670},{"edgeType":"calls","source":3461,"target":3414},{"edgeType":"calls","source":7533,"target":6113},{"edgeType":"contains","source":16747,"target":16753},{"edgeType":"contains","source":5714,"target":5722},{"edgeType":"contains","source":12783,"target":12787},{"edgeType":"calls","source":12691,"target":540},{"edgeType":"contains","source":5516,"target":5518},{"edgeType":"contains","source":11657,"target":11752},{"edgeType":"contains","source":13375,"target":13461},{"edgeType":"calls","source":904,"target":236},{"edgeType":"calls","source":286,"target":366},{"edgeType":"contains","source":8224,"target":8246},{"edgeType":"calls","source":15705,"target":2246},{"edgeType":"contains","source":11657,"target":11754},{"edgeType":"calls","source":2599,"target":540},{"edgeType":"contains","source":14176,"target":14005},{"edgeType":"contains","source":15889,"target":15868},{"edgeType":"contains","source":15822,"target":15831},{"edgeType":"contains","source":5067,"target":4632},{"edgeType":"contains","source":10658,"target":6783},{"edgeType":"contains","source":12448,"target":12600},{"edgeType":"contains","source":16747,"target":16752},{"edgeType":"contains","source":12783,"target":12786},{"edgeType":"contains","source":7100,"target":7152},{"edgeType":"contains","source":7094,"target":7338},{"edgeType":"contains","source":4458,"target":4484},{"edgeType":"calls","source":2940,"target":540},{"edgeType":"contains","source":4061,"target":4107},{"edgeType":"calls","source":8689,"target":8331},{"edgeType":"calls","source":1015,"target":1017},{"edgeType":"contains","source":8224,"target":8241},{"edgeType":"contains","source":6771,"target":6774},{"edgeType":"imports","source":15822,"target":15504},{"edgeType":"contains","source":16020,"target":16036},{"edgeType":"calls","source":6946,"target":1058},{"edgeType":"contains","source":12783,"target":12785},{"edgeType":"contains","source":10138,"target":10216},{"edgeType":"calls","source":2996,"target":3029},{"edgeType":"contains","source":16747,"target":16755},{"edgeType":"contains","source":7762,"target":7765},{"edgeType":"calls","source":8426,"target":8029},{"edgeType":"contains","source":13772,"target":13836},{"edgeType":"calls","source":1081,"target":1084},{"edgeType":"calls","source":1015,"target":1016},{"edgeType":"contains","source":8224,"target":8240},{"edgeType":"contains","source":4458,"target":4491},{"edgeType":"calls","source":11608,"target":6637},{"edgeType":"calls","source":2134,"target":2269},{"edgeType":"contains","source":12919,"target":4339},{"edgeType":"contains","source":1155,"target":1178},{"edgeType":"calls","source":10330,"target":10313},{"edgeType":"contains","source":11657,"target":11751},{"edgeType":"calls","source":2997,"target":2999},{"edgeType":"contains","source":7762,"target":7764},{"edgeType":"calls","source":15698,"target":4572},{"edgeType":"calls","source":2006,"target":2009},{"edgeType":"calls","source":10864,"target":10672},{"edgeType":"contains","source":4458,"target":4489},{"edgeType":"contains","source":960,"target":884},{"edgeType":"contains","source":12849,"target":12851},{"edgeType":"contains","source":10138,"target":10214},{"edgeType":"calls","source":6852,"target":6088},{"edgeType":"contains","source":1155,"target":1181},{"edgeType":"calls","source":883,"target":883},{"edgeType":"contains","source":15095,"target":15116},{"edgeType":"contains","source":14694,"target":14863},{"edgeType":"contains","source":16747,"target":16757},{"edgeType":"calls","source":3856,"target":3851},{"edgeType":"contains","source":8224,"target":8242},{"edgeType":"contains","source":13311,"target":13326},{"edgeType":"contains","source":4997,"target":4692},{"edgeType":"contains","source":12316,"target":12460},{"edgeType":"contains","source":15426,"target":15427},{"edgeType":"contains","source":4458,"target":4488},{"edgeType":"contains","source":12849,"target":12850},{"edgeType":"calls","source":6710,"target":6263},{"edgeType":"calls","source":6643,"target":6226},{"edgeType":"calls","source":9113,"target":1533},{"edgeType":"contains","source":960,"target":883},{"edgeType":"contains","source":10522,"target":425},{"edgeType":"contains","source":1155,"target":1180},{"edgeType":"contains","source":7762,"target":7766},{"edgeType":"contains","source":16747,"target":16756},{"edgeType":"calls","source":14921,"target":5406},{"edgeType":"calls","source":8354,"target":8152},{"edgeType":"contains","source":16020,"target":16024},{"edgeType":"contains","source":9541,"target":9708},{"edgeType":"contains","source":13375,"target":13472},{"edgeType":"contains","source":9678,"target":9689},{"edgeType":"contains","source":13772,"target":13849},{"edgeType":"contains","source":12448,"target":12612},{"edgeType":"contains","source":5516,"target":5524},{"edgeType":"contains","source":10339,"target":10340},{"edgeType":"contains","source":15483,"target":15758},{"edgeType":"contains","source":12915,"target":12933},{"edgeType":"calls","source":7031,"target":6884},{"edgeType":"contains","source":9541,"target":9707},{"edgeType":"contains","source":2080,"target":2107},{"edgeType":"contains","source":13375,"target":13471},{"edgeType":"contains","source":8224,"target":8252},{"edgeType":"contains","source":10339,"target":10341},{"edgeType":"contains","source":5516,"target":5525},{"edgeType":"imports","source":15636,"target":4352},{"edgeType":"contains","source":13375,"target":13470},{"edgeType":"contains","source":3435,"target":4497},{"edgeType":"contains","source":1155,"target":1182},{"edgeType":"contains","source":12783,"target":12796},{"edgeType":"contains","source":12759,"target":13540},{"edgeType":"contains","source":7093,"target":7375},{"edgeType":"calls","source":975,"target":2255},{"edgeType":"contains","source":7458,"target":290},{"edgeType":"calls","source":2494,"target":1672},{"edgeType":"contains","source":9678,"target":9691},{"edgeType":"contains","source":5516,"target":5526},{"edgeType":"contains","source":8224,"target":8256},{"edgeType":"calls","source":13678,"target":12234},{"edgeType":"contains","source":8303,"target":7921},{"edgeType":"contains","source":7093,"target":7376},{"edgeType":"contains","source":12783,"target":12795},{"edgeType":"contains","source":12908,"target":13148},{"edgeType":"calls","source":5243,"target":5244},{"edgeType":"calls","source":6036,"target":6030},{"edgeType":"contains","source":11396,"target":11397},{"edgeType":"contains","source":11756,"target":237},{"edgeType":"contains","source":8224,"target":8254},{"edgeType":"contains","source":13772,"target":13846},{"edgeType":"calls","source":9475,"target":9342},{"edgeType":"calls","source":2468,"target":2479},{"edgeType":"contains","source":9678,"target":9690},{"edgeType":"contains","source":14176,"target":3436},{"edgeType":"contains","source":8291,"target":8292},{"edgeType":"calls","source":8927,"target":3075},{"edgeType":"calls","source":1543,"target":1558},{"edgeType":"calls","source":2010,"target":1875},{"edgeType":"calls","source":14498,"target":14303},{"edgeType":"imports","source":15822,"target":15496},{"edgeType":"contains","source":8030,"target":7921},{"edgeType":"imports","source":15758,"target":15366},{"edgeType":"calls","source":7954,"target":7871},{"edgeType":"imports","source":12090,"target":2236},{"edgeType":"calls","source":286,"target":353},{"edgeType":"imports","source":6305,"target":1874},{"edgeType":"calls","source":5186,"target":4896},{"edgeType":"calls","source":3802,"target":3403},{"edgeType":"contains","source":15483,"target":15762},{"edgeType":"contains","source":15822,"target":15825},{"edgeType":"contains","source":3268,"target":3337},{"edgeType":"contains","source":4458,"target":4499},{"edgeType":"calls","source":751,"target":735},{"edgeType":"imports","source":15822,"target":15495},{"edgeType":"contains","source":16020,"target":16029},{"edgeType":"contains","source":13772,"target":13844},{"edgeType":"contains","source":15483,"target":15763},{"edgeType":"contains","source":2080,"target":2112},{"edgeType":"contains","source":960,"target":889},{"edgeType":"calls","source":3592,"target":3572},{"edgeType":"contains","source":15100,"target":14953},{"edgeType":"contains","source":16018,"target":16092},{"edgeType":"imports","source":9472,"target":9399},{"edgeType":"contains","source":10522,"target":432},{"edgeType":"contains","source":10537,"target":10538},{"edgeType":"calls","source":5177,"target":5173},{"edgeType":"contains","source":5516,"target":5522},{"edgeType":"contains","source":8949,"target":9031},{"edgeType":"contains","source":12783,"target":12791},{"edgeType":"calls","source":5441,"target":5444},{"edgeType":"imports","source":9472,"target":9400},{"edgeType":"contains","source":8224,"target":8250},{"edgeType":"contains","source":4327,"target":4330},{"edgeType":"calls","source":2996,"target":3020},{"edgeType":"imports","source":15636,"target":2236},{"edgeType":"contains","source":5054,"target":5047},{"edgeType":"imports","source":12378,"target":8161},{"edgeType":"contains","source":1155,"target":1159},{"edgeType":"calls","source":15623,"target":540},{"edgeType":"contains","source":5779,"target":5802},{"edgeType":"contains","source":8949,"target":9008},{"edgeType":"imports","source":1768,"target":930},{"edgeType":"calls","source":13235,"target":13260},{"edgeType":"imports","source":1055,"target":1891},{"edgeType":"imports","source":14871,"target":2758},{"edgeType":"contains","source":4392,"target":4403},{"edgeType":"calls","source":9667,"target":9706},{"edgeType":"contains","source":12316,"target":12451},{"edgeType":"contains","source":1155,"target":1158},{"edgeType":"contains","source":4458,"target":4470},{"edgeType":"calls","source":8083,"target":8073},{"edgeType":"imports","source":10329,"target":10370},{"edgeType":"calls","source":15060,"target":1079},{"edgeType":"contains","source":11657,"target":11739},{"edgeType":"contains","source":13772,"target":13823},{"edgeType":"contains","source":10138,"target":10205},{"edgeType":"calls","source":11518,"target":11521},{"edgeType":"calls","source":13328,"target":4032},{"edgeType":"contains","source":10138,"target":10201},{"edgeType":"calls","source":6809,"target":1058},{"edgeType":"contains","source":13311,"target":13315},{"edgeType":"imports","source":2434,"target":1422},{"edgeType":"calls","source":2558,"target":1761},{"edgeType":"contains","source":2621,"target":2221},{"edgeType":"contains","source":4652,"target":4797},{"edgeType":"contains","source":5782,"target":5712},{"edgeType":"calls","source":6963,"target":6855},{"edgeType":"calls","source":1089,"target":793},{"edgeType":"imports","source":15762,"target":15305},{"edgeType":"contains","source":11460,"target":11502},{"edgeType":"contains","source":11063,"target":11124},{"edgeType":"contains","source":4392,"target":4400},{"edgeType":"contains","source":10436,"target":965},{"edgeType":"contains","source":2621,"target":2222},{"edgeType":"calls","source":6136,"target":774},{"edgeType":"calls","source":10131,"target":10125},{"edgeType":"calls","source":10987,"target":11072},{"edgeType":"calls","source":8349,"target":8286},{"edgeType":"contains","source":13389,"target":13009},{"edgeType":"contains","source":13375,"target":13443},{"edgeType":"contains","source":9611,"target":9623},{"edgeType":"contains","source":8224,"target":8225},{"edgeType":"contains","source":4458,"target":4475},{"edgeType":"contains","source":16020,"target":16021},{"edgeType":"contains","source":9281,"target":9282},{"edgeType":"contains","source":13311,"target":13312},{"edgeType":"calls","source":1638,"target":680},{"edgeType":"contains","source":9611,"target":9622},{"edgeType":"contains","source":13375,"target":13442},{"edgeType":"contains","source":1330,"target":2082},{"edgeType":"calls","source":16869,"target":16876},{"edgeType":"contains","source":5779,"target":5799},{"edgeType":"contains","source":15426,"target":610},{"edgeType":"contains","source":13181,"target":13113},{"edgeType":"imports","source":9466,"target":3303},{"edgeType":"imports","source":1768,"target":925},{"edgeType":"calls","source":2140,"target":2034},{"edgeType":"calls","source":7786,"target":2485},{"edgeType":"contains","source":4458,"target":4474},{"edgeType":"contains","source":4458,"target":4473},{"edgeType":"imports","source":12315,"target":12226},{"edgeType":"contains","source":16020,"target":16022},{"edgeType":"contains","source":13375,"target":13441},{"edgeType":"contains","source":13772,"target":13818},{"edgeType":"contains","source":5779,"target":5800},{"edgeType":"contains","source":2080,"target":2084},{"edgeType":"contains","source":4392,"target":4405},{"edgeType":"contains","source":4458,"target":4472},{"edgeType":"contains","source":13375,"target":13440},{"edgeType":"contains","source":5779,"target":5801},{"edgeType":"calls","source":2279,"target":1947},{"edgeType":"contains","source":2939,"target":2944},{"edgeType":"contains","source":4392,"target":4411},{"edgeType":"contains","source":5779,"target":5810},{"edgeType":"contains","source":6510,"target":6404},{"edgeType":"contains","source":7458,"target":271},{"edgeType":"calls","source":8149,"target":8148},{"edgeType":"contains","source":12915,"target":12917},{"edgeType":"contains","source":7100,"target":7141},{"edgeType":"calls","source":10037,"target":358},{"edgeType":"contains","source":2620,"target":2262},{"edgeType":"contains","source":10138,"target":10212},{"edgeType":"imports","source":9472,"target":9446},{"edgeType":"calls","source":1079,"target":1093},{"edgeType":"contains","source":2667,"target":2919},{"edgeType":"contains","source":12316,"target":12459},{"edgeType":"contains","source":4458,"target":4479},{"edgeType":"contains","source":8224,"target":8237},{"edgeType":"contains","source":7828,"target":7829},{"edgeType":"contains","source":16745,"target":16788},{"edgeType":"contains","source":9876,"target":9878},{"edgeType":"calls","source":3630,"target":2349},{"edgeType":"contains","source":5060,"target":4843},{"edgeType":"contains","source":1330,"target":2086},{"edgeType":"contains","source":12915,"target":12916},{"edgeType":"imports","source":14619,"target":12674},{"edgeType":"imports","source":5256,"target":4841},{"edgeType":"contains","source":10138,"target":10213},{"edgeType":"calls","source":1079,"target":1092},{"edgeType":"contains","source":13772,"target":13831},{"edgeType":"calls","source":4929,"target":2246},{"edgeType":"contains","source":5780,"target":5781},{"edgeType":"contains","source":8224,"target":8236},{"edgeType":"contains","source":4458,"target":4478},{"edgeType":"contains","source":14058,"target":7079},{"edgeType":"imports","source":15843,"target":4327},{"edgeType":"calls","source":2271,"target":2193},{"edgeType":"contains","source":16282,"target":16344},{"edgeType":"contains","source":2873,"target":2874},{"edgeType":"contains","source":7093,"target":7360},{"edgeType":"contains","source":6771,"target":6772},{"edgeType":"calls","source":5308,"target":5294},{"edgeType":"contains","source":12316,"target":12457},{"edgeType":"contains","source":5779,"target":5813},{"edgeType":"contains","source":8224,"target":8239},{"edgeType":"contains","source":7762,"target":7763},{"edgeType":"calls","source":352,"target":378},{"edgeType":"contains","source":5270,"target":4673},{"edgeType":"calls","source":5836,"target":5838},{"edgeType":"contains","source":6771,"target":6773},{"edgeType":"contains","source":10138,"target":10211},{"edgeType":"calls","source":15225,"target":15004},{"edgeType":"imports","source":5256,"target":4843},{"edgeType":"contains","source":14694,"target":14835},{"edgeType":"calls","source":11522,"target":833},{"edgeType":"contains","source":4458,"target":4476},{"edgeType":"contains","source":7828,"target":7830},{"edgeType":"calls","source":8870,"target":600},{"edgeType":"contains","source":13311,"target":13321},{"edgeType":"contains","source":5715,"target":5676},{"edgeType":"calls","source":8491,"target":8121},{"edgeType":"calls","source":6683,"target":4974},{"edgeType":"contains","source":11061,"target":11192},{"edgeType":"contains","source":12759,"target":13520},{"edgeType":"contains","source":1330,"target":2089},{"edgeType":"calls","source":5836,"target":5837},{"edgeType":"calls","source":8150,"target":8121},{"edgeType":"imports","source":960,"target":612},{"edgeType":"contains","source":1155,"target":1171},{"edgeType":"calls","source":1303,"target":487},{"edgeType":"imports","source":15349,"target":612},{"edgeType":"calls","source":10397,"target":10343},{"edgeType":"contains","source":4458,"target":4483},{"edgeType":"contains","source":4061,"target":4106},{"edgeType":"imports","source":9472,"target":9450},{"edgeType":"contains","source":1,"target":11576},{"edgeType":"contains","source":16746,"target":16761},{"edgeType":"contains","source":10138,"target":10208},{"edgeType":"contains","source":15483,"target":15747},{"edgeType":"contains","source":7100,"target":7138},{"edgeType":"contains","source":7093,"target":7355},{"edgeType":"contains","source":16282,"target":16345},{"edgeType":"calls","source":15682,"target":15629},{"edgeType":"contains","source":1330,"target":2090},{"edgeType":"contains","source":5779,"target":5807},{"edgeType":"calls","source":15852,"target":12473},{"edgeType":"contains","source":693,"target":694},{"edgeType":"contains","source":12316,"target":12454},{"edgeType":"contains","source":4458,"target":4482},{"edgeType":"imports","source":9472,"target":9451},{"edgeType":"calls","source":881,"target":887},{"edgeType":"contains","source":13375,"target":13449},{"edgeType":"imports","source":10329,"target":10365},{"edgeType":"imports","source":12378,"target":12379},{"edgeType":"calls","source":15159,"target":2246},{"edgeType":"contains","source":1330,"target":2087},{"edgeType":"calls","source":2111,"target":807},{"edgeType":"calls","source":5936,"target":4849},{"edgeType":"contains","source":1155,"target":1173},{"edgeType":"contains","source":12915,"target":12910},{"edgeType":"imports","source":7093,"target":7094},{"edgeType":"contains","source":4458,"target":4481},{"edgeType":"imports","source":15489,"target":15300},{"edgeType":"imports","source":15843,"target":4326},{"edgeType":"contains","source":10138,"target":10206},{"edgeType":"contains","source":10522,"target":416},{"edgeType":"contains","source":15483,"target":15749},{"edgeType":"calls","source":14359,"target":14364},{"edgeType":"contains","source":693,"target":696},{"edgeType":"imports","source":2622,"target":1940},{"edgeType":"contains","source":7093,"target":7357},{"edgeType":"calls","source":3854,"target":3855},{"edgeType":"contains","source":15350,"target":9301},{"edgeType":"calls","source":12322,"target":11976},{"edgeType":"calls","source":2399,"target":2480},{"edgeType":"contains","source":11063,"target":11109},{"edgeType":"contains","source":13781,"target":13529},{"edgeType":"contains","source":15821,"target":15826},{"edgeType":"contains","source":8807,"target":9166},{"edgeType":"calls","source":2134,"target":2239},{"edgeType":"calls","source":1971,"target":949},{"edgeType":"contains","source":10610,"target":10353},{"edgeType":"contains","source":12064,"target":11790},{"edgeType":"contains","source":1088,"target":1105},{"edgeType":"contains","source":11923,"target":11933},{"edgeType":"contains","source":16745,"target":16780},{"edgeType":"calls","source":816,"target":815},{"edgeType":"contains","source":9543,"target":9604},{"edgeType":"contains","source":13772,"target":13807},{"edgeType":"calls","source":3665,"target":3403},{"edgeType":"contains","source":15821,"target":15827},{"edgeType":"contains","source":8807,"target":9165},{"edgeType":"contains","source":10138,"target":10188},{"edgeType":"calls","source":7950,"target":7951},{"edgeType":"contains","source":1768,"target":1168},{"edgeType":"calls","source":684,"target":678},{"edgeType":"calls","source":14440,"target":13940},{"edgeType":"contains","source":7094,"target":7303},{"edgeType":"contains","source":11923,"target":11932},{"edgeType":"contains","source":16746,"target":16748},{"edgeType":"contains","source":16745,"target":16779},{"edgeType":"contains","source":15620,"target":15715},{"edgeType":"contains","source":9541,"target":9665},{"edgeType":"contains","source":9543,"target":9603},{"edgeType":"contains","source":13387,"target":13057},{"edgeType":"contains","source":13375,"target":13429},{"edgeType":"contains","source":3522,"target":3871},{"edgeType":"contains","source":13773,"target":13775},{"edgeType":"contains","source":8807,"target":9168},{"edgeType":"calls","source":2269,"target":2280},{"edgeType":"contains","source":6572,"target":6574},{"edgeType":"contains","source":1088,"target":1107},{"edgeType":"contains","source":11923,"target":11931},{"edgeType":"calls","source":8941,"target":8943},{"edgeType":"contains","source":11657,"target":11719},{"edgeType":"contains","source":13375,"target":13428},{"edgeType":"contains","source":9611,"target":9612},{"edgeType":"contains","source":14365,"target":14455},{"edgeType":"contains","source":13772,"target":13805},{"edgeType":"calls","source":3787,"target":3847},{"edgeType":"contains","source":15620,"target":15718},{"edgeType":"contains","source":8807,"target":9167},{"edgeType":"calls","source":4648,"target":4637},{"edgeType":"contains","source":15810,"target":7714},{"edgeType":"contains","source":12316,"target":12431},{"edgeType":"contains","source":1088,"target":1106},{"edgeType":"calls","source":8875,"target":8874},{"edgeType":"calls","source":14745,"target":2369},{"edgeType":"contains","source":11923,"target":11930},{"edgeType":"contains","source":9541,"target":9667},{"edgeType":"contains","source":9543,"target":9605},{"edgeType":"calls","source":8941,"target":8942},{"edgeType":"contains","source":1683,"target":1687},{"edgeType":"contains","source":14365,"target":14456},{"edgeType":"calls","source":12170,"target":3980},{"edgeType":"calls","source":7158,"target":7137},{"edgeType":"imports","source":5509,"target":5450},{"edgeType":"contains","source":12316,"target":12430},{"edgeType":"calls","source":626,"target":358},{"edgeType":"imports","source":1768,"target":909},{"edgeType":"contains","source":4458,"target":4459},{"edgeType":"calls","source":2856,"target":994},{"edgeType":"contains","source":10138,"target":10183},{"edgeType":"contains","source":11923,"target":11929},{"edgeType":"contains","source":3522,"target":3878},{"edgeType":"imports","source":14954,"target":4392},{"edgeType":"calls","source":15018,"target":2369},{"edgeType":"contains","source":7775,"target":3099},{"edgeType":"contains","source":14365,"target":14457},{"edgeType":"contains","source":4652,"target":4786},{"edgeType":"imports","source":5509,"target":5449},{"edgeType":"imports","source":1768,"target":908},{"edgeType":"contains","source":8950,"target":8956},{"edgeType":"calls","source":15783,"target":12473},{"edgeType":"contains","source":9541,"target":9661},{"edgeType":"contains","source":11923,"target":11928},{"edgeType":"contains","source":15620,"target":15721},{"edgeType":"contains","source":7100,"target":7114},{"edgeType":"contains","source":15483,"target":15740},{"edgeType":"calls","source":2009,"target":1883},{"edgeType":"imports","source":1768,"target":907},{"edgeType":"imports","source":5162,"target":1410},{"edgeType":"calls","source":6945,"target":1058},{"edgeType":"calls","source":8149,"target":8129},{"edgeType":"imports","source":7711,"target":612},{"edgeType":"contains","source":9541,"target":9664},{"edgeType":"contains","source":11923,"target":11927},{"edgeType":"imports","source":882,"target":889},{"edgeType":"contains","source":1683,"target":1690},{"edgeType":"contains","source":3522,"target":3876},{"edgeType":"imports","source":9598,"target":5535},{"edgeType":"contains","source":1088,"target":1110},{"edgeType":"contains","source":11657,"target":11716},{"edgeType":"imports","source":10329,"target":10356},{"edgeType":"contains","source":11923,"target":11926},{"edgeType":"imports","source":882,"target":904},{"edgeType":"calls","source":15032,"target":14625},{"edgeType":"contains","source":9611,"target":9619},{"edgeType":"calls","source":2399,"target":358},{"edgeType":"calls","source":4714,"target":4700},{"edgeType":"contains","source":13772,"target":13816},{"edgeType":"contains","source":15620,"target":15706},{"edgeType":"calls","source":8017,"target":7995},{"edgeType":"calls","source":10131,"target":10112},{"edgeType":"contains","source":4392,"target":4395},{"edgeType":"calls","source":2867,"target":649},{"edgeType":"contains","source":16078,"target":16308},{"edgeType":"contains","source":1088,"target":1113},{"edgeType":"contains","source":3401,"target":3405},{"edgeType":"calls","source":8287,"target":8081},{"edgeType":"imports","source":5256,"target":4825},{"edgeType":"calls","source":14558,"target":14519},{"edgeType":"contains","source":9611,"target":9618},{"edgeType":"contains","source":9607,"target":9742},{"edgeType":"contains","source":13772,"target":13815},{"edgeType":"contains","source":4458,"target":4462},{"edgeType":"calls","source":2269,"target":2275},{"edgeType":"contains","source":13386,"target":13096},{"edgeType":"contains","source":16282,"target":16325},{"edgeType":"contains","source":3401,"target":3404},{"edgeType":"calls","source":6307,"target":6041},{"edgeType":"imports","source":882,"target":902},{"edgeType":"contains","source":13465,"target":12761},{"edgeType":"contains","source":9611,"target":9621},{"edgeType":"contains","source":4458,"target":4461},{"edgeType":"contains","source":10138,"target":10193},{"edgeType":"contains","source":4392,"target":4393},{"edgeType":"contains","source":16282,"target":16328},{"edgeType":"contains","source":13375,"target":13436},{"edgeType":"contains","source":12980,"target":12997},{"edgeType":"contains","source":12908,"target":13114},{"edgeType":"contains","source":9611,"target":9620},{"edgeType":"imports","source":10329,"target":10343},{"edgeType":"calls","source":10939,"target":10433},{"edgeType":"contains","source":13772,"target":13813},{"edgeType":"contains","source":16282,"target":16327},{"edgeType":"contains","source":14829,"target":14862},{"edgeType":"contains","source":13375,"target":13435},{"edgeType":"contains","source":1088,"target":1114},{"edgeType":"calls","source":14028,"target":14034},{"edgeType":"contains","source":12783,"target":12761},{"edgeType":"contains","source":3401,"target":3402},{"edgeType":"contains","source":12908,"target":13113},{"edgeType":"contains","source":2621,"target":2219},{"edgeType":"contains","source":13772,"target":13812},{"edgeType":"calls","source":15551,"target":15444},{"edgeType":"contains","source":16282,"target":16330},{"edgeType":"contains","source":10339,"target":10302},{"edgeType":"imports","source":9834,"target":2440},{"edgeType":"contains","source":5779,"target":5790},{"edgeType":"contains","source":9432,"target":2479},{"edgeType":"contains","source":13375,"target":13434},{"edgeType":"calls","source":2269,"target":2270},{"edgeType":"contains","source":15821,"target":15823},{"edgeType":"contains","source":9611,"target":9614},{"edgeType":"calls","source":11880,"target":6637},{"edgeType":"calls","source":6864,"target":5690},{"edgeType":"contains","source":2621,"target":2220},{"edgeType":"calls","source":8349,"target":8279},{"edgeType":"contains","source":4458,"target":4466},{"edgeType":"calls","source":4649,"target":4596},{"edgeType":"calls","source":15704,"target":2246},{"edgeType":"contains","source":13375,"target":13433},{"edgeType":"contains","source":16282,"target":16329},{"edgeType":"imports","source":15637,"target":2236},{"edgeType":"contains","source":4392,"target":4398},{"edgeType":"contains","source":15620,"target":15711},{"edgeType":"contains","source":1088,"target":1116},{"edgeType":"contains","source":8807,"target":9172},{"edgeType":"contains","source":15821,"target":15824},{"edgeType":"contains","source":11593,"target":11594},{"edgeType":"imports","source":14954,"target":14956},{"edgeType":"imports","source":882,"target":898},{"edgeType":"contains","source":13773,"target":13779},{"edgeType":"contains","source":13772,"target":13810},{"edgeType":"calls","source":1344,"target":1349},{"edgeType":"calls","source":9538,"target":9475},{"edgeType":"contains","source":9611,"target":9617},{"edgeType":"contains","source":4458,"target":4465},{"edgeType":"imports","source":9854,"target":8161},{"edgeType":"contains","source":10138,"target":10189},{"edgeType":"contains","source":13377,"target":13370},{"edgeType":"contains","source":4392,"target":4397},{"edgeType":"calls","source":12641,"target":12641},{"edgeType":"calls","source":2076,"target":1909},{"edgeType":"contains","source":1088,"target":1119},{"edgeType":"contains","source":12980,"target":12992},{"edgeType":"contains","source":2621,"target":2218},{"edgeType":"contains","source":13773,"target":13778},{"edgeType":"contains","source":11790,"target":11830},{"edgeType":"calls","source":750,"target":735},{"edgeType":"contains","source":4458,"target":4464},{"edgeType":"calls","source":15032,"target":14624},{"edgeType":"contains","source":10138,"target":10190},{"edgeType":"contains","source":4392,"target":4396},{"edgeType":"calls","source":13992,"target":13040},{"edgeType":"contains","source":3401,"target":3406},{"edgeType":"contains","source":1088,"target":1089},{"edgeType":"contains","source":493,"target":507},{"edgeType":"contains","source":361,"target":371},{"edgeType":"contains","source":11852,"target":12003},{"edgeType":"calls","source":8562,"target":8121},{"edgeType":"calls","source":4420,"target":3335},{"edgeType":"contains","source":2079,"target":2080},{"edgeType":"contains","source":11657,"target":11705},{"edgeType":"contains","source":11790,"target":11810},{"edgeType":"calls","source":2404,"target":2408},{"edgeType":"imports","source":608,"target":718},{"edgeType":"contains","source":623,"target":705},{"edgeType":"calls","source":3925,"target":3880},{"edgeType":"calls","source":3329,"target":3331},{"edgeType":"calls","source":10204,"target":10070},{"edgeType":"contains","source":14036,"target":14065},{"edgeType":"contains","source":15489,"target":15532},{"edgeType":"contains","source":361,"target":370},{"edgeType":"contains","source":493,"target":506},{"edgeType":"imports","source":608,"target":720},{"edgeType":"contains","source":15571,"target":15104},{"edgeType":"contains","source":7561,"target":7608},{"edgeType":"contains","source":8949,"target":8974},{"edgeType":"contains","source":8346,"target":8641},{"edgeType":"contains","source":11063,"target":11093},{"edgeType":"contains","source":623,"target":704},{"edgeType":"calls","source":1906,"target":931},{"edgeType":"contains","source":10138,"target":10172},{"edgeType":"contains","source":361,"target":373},{"edgeType":"contains","source":7100,"target":7102},{"edgeType":"calls","source":6852,"target":6166},{"edgeType":"contains","source":11790,"target":11808},{"edgeType":"contains","source":15620,"target":15700},{"edgeType":"contains","source":8346,"target":8644},{"edgeType":"contains","source":493,"target":508},{"edgeType":"contains","source":361,"target":372},{"edgeType":"calls","source":1413,"target":1418},{"edgeType":"calls","source":6635,"target":6552},{"edgeType":"contains","source":11657,"target":11704},{"edgeType":"contains","source":15160,"target":15163},{"edgeType":"contains","source":10144,"target":9984},{"edgeType":"contains","source":623,"target":706},{"edgeType":"imports","source":2434,"target":1190},{"edgeType":"calls","source":4212,"target":3438},{"edgeType":"calls","source":11653,"target":11661},{"edgeType":"contains","source":8560,"target":8351},{"edgeType":"contains","source":361,"target":375},{"edgeType":"contains","source":9544,"target":9553},{"edgeType":"calls","source":2996,"target":3078},{"edgeType":"contains","source":13772,"target":13787},{"edgeType":"contains","source":3522,"target":3861},{"edgeType":"contains","source":11657,"target":11701},{"edgeType":"calls","source":9671,"target":9685},{"edgeType":"contains","source":8948,"target":9002},{"edgeType":"contains","source":623,"target":709},{"edgeType":"contains","source":361,"target":374},{"edgeType":"calls","source":15367,"target":4344},{"edgeType":"contains","source":14829,"target":14855},{"edgeType":"calls","source":3003,"target":748},{"edgeType":"calls","source":1611,"target":1616},{"edgeType":"contains","source":9544,"target":9552},{"edgeType":"calls","source":6583,"target":6052},{"edgeType":"calls","source":8487,"target":8335},{"edgeType":"contains","source":13772,"target":13786},{"edgeType":"contains","source":4061,"target":4064},{"edgeType":"contains","source":493,"target":510},{"edgeType":"contains","source":16282,"target":16321},{"edgeType":"calls","source":15551,"target":15553},{"edgeType":"calls","source":2864,"target":2940},{"edgeType":"contains","source":11657,"target":11699},{"edgeType":"contains","source":14829,"target":14856},{"edgeType":"contains","source":15204,"target":1117},{"edgeType":"contains","source":15160,"target":15166},{"edgeType":"contains","source":3537,"target":3394},{"edgeType":"contains","source":623,"target":711},{"edgeType":"contains","source":16282,"target":16324},{"edgeType":"calls","source":6044,"target":5836},{"edgeType":"calls","source":15816,"target":15795},{"edgeType":"calls","source":4399,"target":3980},{"edgeType":"contains","source":11063,"target":11086},{"edgeType":"contains","source":361,"target":377},{"edgeType":"calls","source":9143,"target":9143},{"edgeType":"contains","source":493,"target":513},{"edgeType":"contains","source":361,"target":376},{"edgeType":"calls","source":15685,"target":15629},{"edgeType":"imports","source":8327,"target":2440},{"edgeType":"contains","source":9544,"target":9554},{"edgeType":"contains","source":11657,"target":11700},{"edgeType":"contains","source":15204,"target":1118},{"edgeType":"calls","source":8683,"target":2261},{"edgeType":"contains","source":5849,"target":5712},{"edgeType":"calls","source":6301,"target":6340},{"edgeType":"contains","source":14829,"target":14857},{"edgeType":"contains","source":11852,"target":11996},{"edgeType":"calls","source":3137,"target":2934},{"edgeType":"calls","source":15606,"target":5394},{"edgeType":"contains","source":15620,"target":15705},{"edgeType":"contains","source":16282,"target":16323},{"edgeType":"contains","source":493,"target":512},{"edgeType":"contains","source":15788,"target":14725},{"edgeType":"contains","source":623,"target":710},{"edgeType":"contains","source":8950,"target":8953},{"edgeType":"contains","source":3522,"target":3865},{"edgeType":"calls","source":9976,"target":4463},{"edgeType":"contains","source":1088,"target":1097},{"edgeType":"contains","source":13114,"target":13057},{"edgeType":"contains","source":12980,"target":12983},{"edgeType":"calls","source":1810,"target":1786},{"edgeType":"contains","source":623,"target":713},{"edgeType":"calls","source":16346,"target":16288},{"edgeType":"contains","source":3810,"target":3394},{"edgeType":"contains","source":14433,"target":14434},{"edgeType":"contains","source":11657,"target":11713},{"edgeType":"contains","source":493,"target":515},{"edgeType":"imports","source":8076,"target":8096},{"edgeType":"contains","source":15620,"target":15691},{"edgeType":"contains","source":13375,"target":13421},{"edgeType":"contains","source":8950,"target":8952},{"edgeType":"contains","source":3522,"target":3864},{"edgeType":"contains","source":12980,"target":12982},{"edgeType":"contains","source":10866,"target":10867},{"edgeType":"contains","source":623,"target":712},{"edgeType":"calls","source":14444,"target":13940},{"edgeType":"contains","source":11657,"target":11714},{"edgeType":"contains","source":493,"target":514},{"edgeType":"contains","source":11923,"target":11924},{"edgeType":"calls","source":3597,"target":3468},{"edgeType":"contains","source":8498,"target":8168},{"edgeType":"imports","source":15379,"target":7913},{"edgeType":"contains","source":8807,"target":9160},{"edgeType":"contains","source":8950,"target":8955},{"edgeType":"contains","source":11063,"target":11099},{"edgeType":"contains","source":12980,"target":12981},{"edgeType":"contains","source":11657,"target":11711},{"edgeType":"calls","source":14830,"target":14663},{"edgeType":"calls","source":3598,"target":3438},{"edgeType":"contains","source":11852,"target":12008},{"edgeType":"contains","source":9432,"target":2468},{"edgeType":"contains","source":15483,"target":15712},{"edgeType":"imports","source":608,"target":726},{"edgeType":"contains","source":8950,"target":8954},{"edgeType":"imports","source":5509,"target":997},{"edgeType":"contains","source":623,"target":714},{"edgeType":"contains","source":15340,"target":7460},{"edgeType":"calls","source":1906,"target":925},{"edgeType":"contains","source":11790,"target":11817},{"edgeType":"contains","source":493,"target":516},{"edgeType":"contains","source":14433,"target":14437},{"edgeType":"contains","source":4456,"target":4505},{"edgeType":"contains","source":10223,"target":3315},{"edgeType":"contains","source":3522,"target":3869},{"edgeType":"imports","source":2621,"target":1743},{"edgeType":"contains","source":9543,"target":9592},{"edgeType":"contains","source":12908,"target":13096},{"edgeType":"calls","source":6112,"target":5836},{"edgeType":"contains","source":623,"target":717},{"edgeType":"contains","source":1683,"target":1684},{"edgeType":"contains","source":8346,"target":8646},{"edgeType":"contains","source":16745,"target":16759},{"edgeType":"calls","source":6962,"target":6995},{"edgeType":"contains","source":7775,"target":3091},{"edgeType":"calls","source":9672,"target":9662},{"edgeType":"contains","source":623,"target":716},{"edgeType":"contains","source":16745,"target":16758},{"edgeType":"contains","source":1683,"target":1685},{"edgeType":"calls","source":4386,"target":4376},{"edgeType":"contains","source":14433,"target":14439},{"edgeType":"calls","source":9095,"target":2180},{"edgeType":"contains","source":3522,"target":3867},{"edgeType":"calls","source":952,"target":899},{"edgeType":"calls","source":5296,"target":1533},{"edgeType":"contains","source":8950,"target":8951},{"edgeType":"contains","source":15620,"target":15696},{"edgeType":"contains","source":1088,"target":1103},{"edgeType":"calls","source":12210,"target":748},{"edgeType":"contains","source":4652,"target":4776},{"edgeType":"contains","source":11657,"target":11707},{"edgeType":"contains","source":11063,"target":11094},{"edgeType":"calls","source":14296,"target":14303},{"edgeType":"calls","source":6249,"target":5815},{"edgeType":"calls","source":6963,"target":6966},{"edgeType":"contains","source":10138,"target":10173},{"edgeType":"calls","source":952,"target":898},{"edgeType":"contains","source":14036,"target":14063},{"edgeType":"contains","source":11657,"target":11708},{"edgeType":"calls","source":10333,"target":10313},{"edgeType":"contains","source":14235,"target":14237},{"edgeType":"contains","source":16017,"target":16074},{"edgeType":"calls","source":952,"target":926},{"edgeType":"contains","source":11790,"target":11794},{"edgeType":"calls","source":6372,"target":6229},{"edgeType":"contains","source":10138,"target":10154},{"edgeType":"calls","source":7887,"target":7888},{"edgeType":"contains","source":4718,"target":4818},{"edgeType":"calls","source":6948,"target":1058},{"edgeType":"contains","source":16082,"target":16159},{"edgeType":"contains","source":8001,"target":8750},{"edgeType":"contains","source":16745,"target":16747},{"edgeType":"calls","source":8749,"target":8650},{"edgeType":"contains","source":9541,"target":9633},{"edgeType":"calls","source":833,"target":387},{"edgeType":"contains","source":5646,"target":5648},{"edgeType":"contains","source":4718,"target":4817},{"edgeType":"contains","source":4990,"target":4841},{"edgeType":"calls","source":9902,"target":389},{"edgeType":"calls","source":8881,"target":8785},{"edgeType":"contains","source":16745,"target":16746},{"edgeType":"contains","source":15620,"target":15682},{"edgeType":"contains","source":9607,"target":9700},{"edgeType":"calls","source":12313,"target":12327},{"edgeType":"contains","source":5646,"target":5649},{"edgeType":"contains","source":13772,"target":13773},{"edgeType":"contains","source":559,"target":561},{"edgeType":"contains","source":6377,"target":6243},{"edgeType":"contains","source":4718,"target":4816},{"edgeType":"contains","source":16020,"target":15968},{"edgeType":"contains","source":12759,"target":13465},{"edgeType":"contains","source":10138,"target":10152},{"edgeType":"calls","source":3003,"target":2881},{"edgeType":"calls","source":3000,"target":2974},{"edgeType":"calls","source":6962,"target":6969},{"edgeType":"contains","source":15620,"target":15685},{"edgeType":"contains","source":3407,"target":3174},{"edgeType":"calls","source":2209,"target":2126},{"edgeType":"contains","source":4718,"target":4815},{"edgeType":"contains","source":559,"target":560},{"edgeType":"calls","source":3792,"target":3791},{"edgeType":"calls","source":13944,"target":4044},{"edgeType":"contains","source":16077,"target":16315},{"edgeType":"calls","source":13040,"target":13042},{"edgeType":"contains","source":14761,"target":14831},{"edgeType":"contains","source":10138,"target":10153},{"edgeType":"contains","source":8001,"target":8751},{"edgeType":"calls","source":425,"target":352},{"edgeType":"contains","source":13375,"target":13394},{"edgeType":"imports","source":16759,"target":1058},{"edgeType":"contains","source":4718,"target":4822},{"edgeType":"contains","source":493,"target":495},{"edgeType":"contains","source":559,"target":563},{"edgeType":"calls","source":3990,"target":3992},{"edgeType":"contains","source":8001,"target":8746},{"edgeType":"imports","source":13217,"target":13611},{"edgeType":"contains","source":1167,"target":741},{"edgeType":"contains","source":7561,"target":7586},{"edgeType":"contains","source":559,"target":562},{"edgeType":"contains","source":493,"target":494},{"edgeType":"calls","source":4321,"target":4301},{"edgeType":"calls","source":2008,"target":2010},{"edgeType":"contains","source":4718,"target":4821},{"edgeType":"imports","source":15821,"target":15336},{"edgeType":"contains","source":5183,"target":5204},{"edgeType":"contains","source":8001,"target":8745},{"edgeType":"calls","source":8019,"target":8029},{"edgeType":"contains","source":1167,"target":740},{"edgeType":"contains","source":15204,"target":1100},{"edgeType":"contains","source":623,"target":695},{"edgeType":"contains","source":8346,"target":8623},{"edgeType":"calls","source":15155,"target":15129},{"edgeType":"contains","source":559,"target":565},{"edgeType":"imports","source":15822,"target":15308},{"edgeType":"contains","source":4718,"target":4820},{"edgeType":"calls","source":8681,"target":8650},{"edgeType":"contains","source":5183,"target":5203},{"edgeType":"contains","source":8001,"target":8748},{"edgeType":"contains","source":5986,"target":5676},{"edgeType":"calls","source":10728,"target":10726},{"edgeType":"contains","source":11393,"target":11410},{"edgeType":"contains","source":9541,"target":9631},{"edgeType":"calls","source":15226,"target":2358},{"edgeType":"contains","source":11657,"target":11682},{"edgeType":"calls","source":3269,"target":972},{"edgeType":"contains","source":1683,"target":1657},{"edgeType":"calls","source":15707,"target":2246},{"edgeType":"contains","source":3401,"target":3364},{"edgeType":"imports","source":12315,"target":3523},{"edgeType":"contains","source":493,"target":496},{"edgeType":"contains","source":4718,"target":4819},{"edgeType":"contains","source":559,"target":564},{"edgeType":"contains","source":8001,"target":8747},{"edgeType":"calls","source":10728,"target":10727},{"edgeType":"contains","source":1167,"target":742},{"edgeType":"calls","source":2864,"target":2958},{"edgeType":"contains","source":5646,"target":5647},{"edgeType":"calls","source":8482,"target":2134},{"edgeType":"contains","source":10069,"target":1718},{"edgeType":"calls","source":3131,"target":3134},{"edgeType":"contains","source":559,"target":567},{"edgeType":"contains","source":5448,"target":5451},{"edgeType":"contains","source":9544,"target":9549},{"edgeType":"calls","source":11196,"target":8908},{"edgeType":"contains","source":8001,"target":8758},{"edgeType":"contains","source":493,"target":499},{"edgeType":"calls","source":16213,"target":16166},{"edgeType":"contains","source":8553,"target":8559},{"edgeType":"calls","source":1278,"target":1382},{"edgeType":"calls","source":5244,"target":5281},{"edgeType":"contains","source":5448,"target":5450},{"edgeType":"calls","source":3926,"target":3859},{"edgeType":"contains","source":9541,"target":9641},{"edgeType":"contains","source":11657,"target":11698},{"edgeType":"contains","source":361,"target":362},{"edgeType":"calls","source":2206,"target":2213},{"edgeType":"imports","source":8076,"target":8080},{"edgeType":"contains","source":8001,"target":8757},{"edgeType":"contains","source":559,"target":566},{"edgeType":"contains","source":493,"target":498},{"edgeType":"contains","source":13248,"target":13113},{"edgeType":"contains","source":8553,"target":8558},{"edgeType":"contains","source":9491,"target":620},{"edgeType":"contains","source":559,"target":569},{"edgeType":"calls","source":12826,"target":658},{"edgeType":"contains","source":5448,"target":5449},{"edgeType":"contains","source":493,"target":501},{"edgeType":"contains","source":11657,"target":11695},{"edgeType":"contains","source":623,"target":699},{"edgeType":"contains","source":361,"target":365},{"edgeType":"contains","source":11790,"target":11800},{"edgeType":"calls","source":6922,"target":1874},{"edgeType":"contains","source":13772,"target":13781},{"edgeType":"imports","source":12164,"target":3971},{"edgeType":"calls","source":2206,"target":2210},{"edgeType":"calls","source":3329,"target":3336},{"edgeType":"contains","source":4718,"target":4823},{"edgeType":"contains","source":559,"target":568},{"edgeType":"calls","source":10398,"target":10392},{"edgeType":"contains","source":11657,"target":11696},{"edgeType":"contains","source":493,"target":500},{"edgeType":"contains","source":361,"target":364},{"edgeType":"imports","source":14611,"target":14791},{"edgeType":"imports","source":8035,"target":893},{"edgeType":"imports","source":3385,"target":3403},{"edgeType":"contains","source":15620,"target":15676},{"edgeType":"calls","source":15227,"target":15017},{"edgeType":"calls","source":15694,"target":540},{"edgeType":"calls","source":3934,"target":3606},{"edgeType":"calls","source":9902,"target":402},{"edgeType":"contains","source":9544,"target":9545},{"edgeType":"contains","source":9541,"target":9638},{"edgeType":"contains","source":623,"target":701},{"edgeType":"calls","source":12249,"target":12209},{"edgeType":"contains","source":361,"target":367},{"edgeType":"calls","source":15371,"target":2097},{"edgeType":"contains","source":10138,"target":10158},{"edgeType":"calls","source":15703,"target":2375},{"edgeType":"contains","source":13376,"target":13370},{"edgeType":"contains","source":8553,"target":8555},{"edgeType":"contains","source":14829,"target":14830},{"edgeType":"contains","source":14036,"target":14044},{"edgeType":"contains","source":15619,"target":15708},{"edgeType":"calls","source":15662,"target":1533},{"edgeType":"contains","source":493,"target":502},{"edgeType":"contains","source":9541,"target":9637},{"edgeType":"imports","source":7711,"target":2484},{"edgeType":"contains","source":16352,"target":16240},{"edgeType":"contains","source":229,"target":230},{"edgeType":"contains","source":8553,"target":8554},{"edgeType":"contains","source":12583,"target":12584},{"edgeType":"contains","source":16088,"target":15968},{"edgeType":"contains","source":15619,"target":15709},{"edgeType":"contains","source":9541,"target":9636},{"edgeType":"calls","source":1944,"target":1875},{"edgeType":"contains","source":361,"target":369},{"edgeType":"contains","source":493,"target":505},{"edgeType":"calls","source":3137,"target":2942},{"edgeType":"contains","source":10133,"target":10311},{"edgeType":"calls","source":15703,"target":2377},{"edgeType":"calls","source":2272,"target":2274},{"edgeType":"calls","source":12062,"target":11661},{"edgeType":"calls","source":4454,"target":2283},{"edgeType":"contains","source":8553,"target":8557},{"edgeType":"contains","source":623,"target":703},{"edgeType":"contains","source":5672,"target":620},{"edgeType":"contains","source":15619,"target":15710},{"edgeType":"calls","source":1560,"target":1094},{"edgeType":"contains","source":9544,"target":9546},{"edgeType":"contains","source":3268,"target":3269},{"edgeType":"contains","source":493,"target":504},{"edgeType":"calls","source":1278,"target":1379},{"edgeType":"calls","source":4523,"target":4371},{"edgeType":"contains","source":361,"target":368},{"edgeType":"calls","source":10465,"target":10433},{"edgeType":"contains","source":8001,"target":8755},{"edgeType":"imports","source":6109,"target":1410},{"edgeType":"calls","source":4982,"target":4941},{"edgeType":"contains","source":8553,"target":8556},{"edgeType":"calls","source":2206,"target":2207},{"edgeType":"imports","source":3435,"target":3971},{"edgeType":"calls","source":2106,"target":1079},{"edgeType":"contains","source":1330,"target":2039},{"edgeType":"contains","source":11393,"target":11400},{"edgeType":"calls","source":3328,"target":3328},{"edgeType":"contains","source":7458,"target":8653},{"edgeType":"contains","source":3971,"target":4703},{"edgeType":"imports","source":15095,"target":4072},{"edgeType":"calls","source":2403,"target":2406},{"edgeType":"calls","source":4321,"target":4257},{"edgeType":"contains","source":12583,"target":12564},{"edgeType":"calls","source":156,"target":184},{"edgeType":"contains","source":2621,"target":2157},{"edgeType":"calls","source":3859,"target":3779},{"edgeType":"contains","source":8001,"target":8732},{"edgeType":"imports","source":10628,"target":903},{"edgeType":"contains","source":5183,"target":5184},{"edgeType":"contains","source":5381,"target":5388},{"edgeType":"contains","source":5315,"target":5320},{"edgeType":"contains","source":3971,"target":4702},{"edgeType":"contains","source":7458,"target":8654},{"edgeType":"imports","source":8676,"target":8565},{"edgeType":"calls","source":2857,"target":1017},{"edgeType":"calls","source":1016,"target":1006},{"edgeType":"imports","source":6109,"target":5690},{"edgeType":"contains","source":10138,"target":10139},{"edgeType":"contains","source":10522,"target":349},{"edgeType":"calls","source":9737,"target":9715},{"edgeType":"imports","source":4242,"target":4375},{"edgeType":"contains","source":5315,"target":5319},{"edgeType":"imports","source":13772,"target":13375},{"edgeType":"contains","source":14695,"target":14745},{"edgeType":"contains","source":5381,"target":5387},{"edgeType":"contains","source":15619,"target":15698},{"edgeType":"contains","source":7458,"target":8655},{"edgeType":"contains","source":3971,"target":4701},{"edgeType":"imports","source":14288,"target":14292},{"edgeType":"contains","source":8948,"target":8975},{"edgeType":"calls","source":286,"target":384},{"edgeType":"imports","source":5256,"target":4652},{"edgeType":"calls","source":15898,"target":540},{"edgeType":"contains","source":12908,"target":13057},{"edgeType":"calls","source":3859,"target":3777},{"edgeType":"contains","source":11393,"target":11399},{"edgeType":"contains","source":5315,"target":5318},{"edgeType":"contains","source":5381,"target":5386},{"edgeType":"contains","source":14694,"target":14777},{"edgeType":"contains","source":14893,"target":14950},{"edgeType":"calls","source":8223,"target":8029},{"edgeType":"calls","source":16409,"target":16411},{"edgeType":"contains","source":14954,"target":15173},{"edgeType":"calls","source":1016,"target":1008},{"edgeType":"contains","source":7458,"target":8656},{"edgeType":"imports","source":11906,"target":12028},{"edgeType":"calls","source":11520,"target":11523},{"edgeType":"contains","source":10133,"target":10288},{"edgeType":"contains","source":15713,"target":4330},{"edgeType":"calls","source":15625,"target":540},{"edgeType":"contains","source":7458,"target":8649},{"edgeType":"calls","source":3328,"target":3324},{"edgeType":"imports","source":980,"target":1900},{"edgeType":"contains","source":14893,"target":14951},{"edgeType":"contains","source":10336,"target":10338},{"edgeType":"contains","source":14431,"target":14475},{"edgeType":"contains","source":15620,"target":15669},{"edgeType":"contains","source":14234,"target":14240},{"edgeType":"calls","source":3460,"target":3461},{"edgeType":"contains","source":10133,"target":10289},{"edgeType":"contains","source":9543,"target":9550},{"edgeType":"contains","source":3971,"target":4706},{"edgeType":"calls","source":14745,"target":4572},{"edgeType":"contains","source":3333,"target":3345},{"edgeType":"contains","source":3971,"target":4707},{"edgeType":"contains","source":16282,"target":16288},{"edgeType":"contains","source":14036,"target":14037},{"edgeType":"contains","source":5199,"target":4691},{"edgeType":"calls","source":16345,"target":16276},{"edgeType":"contains","source":11576,"target":12063},{"edgeType":"contains","source":3971,"target":4705},{"edgeType":"calls","source":4525,"target":4269},{"edgeType":"calls","source":11210,"target":6338},{"edgeType":"contains","source":623,"target":678},{"edgeType":"calls","source":2671,"target":2549},{"edgeType":"contains","source":5183,"target":5186},{"edgeType":"contains","source":3333,"target":3343},{"edgeType":"contains","source":3971,"target":4704},{"edgeType":"calls","source":10653,"target":352},{"edgeType":"contains","source":10336,"target":10337},{"edgeType":"contains","source":4392,"target":2224},{"edgeType":"contains","source":16156,"target":15968},{"edgeType":"contains","source":11852,"target":11978},{"edgeType":"calls","source":6589,"target":5836},{"edgeType":"contains","source":15621,"target":15626},{"edgeType":"contains","source":5713,"target":5676},{"edgeType":"contains","source":11393,"target":11408},{"edgeType":"contains","source":9015,"target":9019},{"edgeType":"calls","source":15892,"target":15531},{"edgeType":"contains","source":4718,"target":4809},{"edgeType":"calls","source":9011,"target":8976},{"edgeType":"contains","source":16612,"target":16617},{"edgeType":"calls","source":15623,"target":615},{"edgeType":"calls","source":4649,"target":4651},{"edgeType":"contains","source":9631,"target":8949},{"edgeType":"calls","source":8816,"target":8679},{"edgeType":"calls","source":619,"target":621},{"edgeType":"calls","source":9538,"target":9551},{"edgeType":"contains","source":14761,"target":14803},{"edgeType":"contains","source":5910,"target":5912},{"edgeType":"calls","source":7067,"target":5817},{"edgeType":"contains","source":8001,"target":8742},{"edgeType":"calls","source":11385,"target":3033},{"edgeType":"contains","source":15026,"target":15044},{"edgeType":"contains","source":14893,"target":14939},{"edgeType":"calls","source":13145,"target":3438},{"edgeType":"contains","source":15571,"target":15063},{"edgeType":"contains","source":9015,"target":9018},{"edgeType":"calls","source":1742,"target":1746},{"edgeType":"contains","source":16082,"target":16133},{"edgeType":"imports","source":2434,"target":1234},{"edgeType":"contains","source":3333,"target":3349},{"edgeType":"contains","source":4718,"target":4808},{"edgeType":"imports","source":9472,"target":9249},{"edgeType":"contains","source":16612,"target":16616},{"edgeType":"imports","source":14172,"target":965},{"edgeType":"calls","source":11264,"target":11013},{"edgeType":"contains","source":8001,"target":8741},{"edgeType":"contains","source":11998,"target":11680},{"edgeType":"imports","source":11906,"target":12018},{"edgeType":"imports","source":13217,"target":13659},{"edgeType":"contains","source":11852,"target":11976},{"edgeType":"contains","source":8346,"target":8619},{"edgeType":"calls","source":10730,"target":10651},{"edgeType":"contains","source":15423,"target":15424},{"edgeType":"contains","source":16077,"target":16291},{"edgeType":"contains","source":11393,"target":11406},{"edgeType":"calls","source":14363,"target":14303},{"edgeType":"contains","source":1167,"target":731},{"edgeType":"contains","source":3333,"target":3346},{"edgeType":"calls","source":10311,"target":389},{"edgeType":"calls","source":1809,"target":1786},{"edgeType":"contains","source":16612,"target":16619},{"edgeType":"contains","source":4718,"target":4807},{"edgeType":"contains","source":3971,"target":4710},{"edgeType":"contains","source":14431,"target":14465},{"edgeType":"contains","source":7826,"target":7827},{"edgeType":"calls","source":2534,"target":2563},{"edgeType":"contains","source":11852,"target":11975},{"edgeType":"contains","source":11393,"target":11407},{"edgeType":"contains","source":14068,"target":13034},{"edgeType":"contains","source":15423,"target":15425},{"edgeType":"calls","source":6299,"target":6373},{"edgeType":"contains","source":7100,"target":7078},{"edgeType":"contains","source":9015,"target":9020},{"edgeType":"contains","source":11063,"target":11067},{"edgeType":"contains","source":16612,"target":16618},{"edgeType":"calls","source":8217,"target":8223},{"edgeType":"contains","source":4718,"target":4806},{"edgeType":"contains","source":623,"target":681},{"edgeType":"contains","source":3971,"target":4709},{"edgeType":"contains","source":8001,"target":8743},{"edgeType":"calls","source":13407,"target":12234},{"edgeType":"contains","source":11852,"target":11974},{"edgeType":"contains","source":11063,"target":11064},{"edgeType":"calls","source":12395,"target":3438},{"edgeType":"contains","source":4718,"target":4814},{"edgeType":"contains","source":7458,"target":8657},{"edgeType":"calls","source":8020,"target":7989},{"edgeType":"contains","source":1167,"target":733},{"edgeType":"contains","source":13181,"target":13057},{"edgeType":"calls","source":3338,"target":3005},{"edgeType":"contains","source":623,"target":684},{"edgeType":"contains","source":4718,"target":4813},{"edgeType":"calls","source":817,"target":821},{"edgeType":"contains","source":14761,"target":14807},{"edgeType":"contains","source":10522,"target":352},{"edgeType":"calls","source":15155,"target":15119},{"edgeType":"calls","source":14457,"target":2938},{"edgeType":"imports","source":15489,"target":15099},{"edgeType":"calls","source":6372,"target":6226},{"edgeType":"calls","source":3632,"target":2349},{"edgeType":"contains","source":7458,"target":8658},{"edgeType":"contains","source":4718,"target":4812},{"edgeType":"contains","source":15950,"target":16002},{"edgeType":"calls","source":10466,"target":10383},{"edgeType":"calls","source":15104,"target":12473},{"edgeType":"contains","source":5976,"target":5977},{"edgeType":"contains","source":15099,"target":4330},{"edgeType":"contains","source":3971,"target":4715},{"edgeType":"imports","source":1715,"target":264},{"edgeType":"calls","source":8425,"target":8121},{"edgeType":"calls","source":4389,"target":2134},{"edgeType":"contains","source":11592,"target":11575},{"edgeType":"calls","source":5838,"target":5839},{"edgeType":"calls","source":10645,"target":609},{"edgeType":"imports","source":15619,"target":15300},{"edgeType":"contains","source":15950,"target":16003},{"edgeType":"contains","source":4718,"target":4811},{"edgeType":"imports","source":1621,"target":1063},{"edgeType":"contains","source":5976,"target":5978},{"edgeType":"contains","source":8001,"target":8740},{"edgeType":"contains","source":10138,"target":10140},{"edgeType":"contains","source":16612,"target":16623},{"edgeType":"contains","source":12384,"target":12393},{"edgeType":"contains","source":5780,"target":5712},{"edgeType":"calls","source":16011,"target":16069},{"edgeType":"contains","source":691,"target":692},{"edgeType":"contains","source":9015,"target":9016},{"edgeType":"calls","source":1481,"target":1379},{"edgeType":"contains","source":11393,"target":11403},{"edgeType":"calls","source":7723,"target":286},{"edgeType":"calls","source":11010,"target":10433},{"edgeType":"calls","source":10342,"target":10001},{"edgeType":"contains","source":4718,"target":4810},{"edgeType":"calls","source":2799,"target":2801},{"edgeType":"calls","source":10464,"target":10447},{"edgeType":"contains","source":14234,"target":14235},{"edgeType":"contains","source":8001,"target":8739},{"edgeType":"calls","source":619,"target":618},{"edgeType":"contains","source":14431,"target":14470},{"edgeType":"contains","source":8948,"target":8957},{"edgeType":"calls","source":2274,"target":2193},{"edgeType":"contains","source":4718,"target":4785},{"edgeType":"calls","source":8019,"target":7991},{"edgeType":"contains","source":5062,"target":4691},{"edgeType":"calls","source":10865,"target":10672},{"edgeType":"contains","source":5170,"target":5571},{"edgeType":"contains","source":8001,"target":8717},{"edgeType":"contains","source":12378,"target":4104},{"edgeType":"contains","source":14033,"target":14108},{"edgeType":"contains","source":11923,"target":11867},{"edgeType":"contains","source":13242,"target":13259},{"edgeType":"contains","source":9607,"target":9668},{"edgeType":"contains","source":8346,"target":8591},{"edgeType":"calls","source":15706,"target":2246},{"edgeType":"contains","source":4984,"target":4994},{"edgeType":"contains","source":14761,"target":14796},{"edgeType":"contains","source":8001,"target":8716},{"edgeType":"contains","source":14033,"target":14109},{"edgeType":"contains","source":9476,"target":9500},{"edgeType":"contains","source":5776,"target":5814},{"edgeType":"contains","source":3971,"target":4686},{"edgeType":"calls","source":3859,"target":3794},{"edgeType":"contains","source":1876,"target":1979},{"edgeType":"contains","source":14033,"target":14110},{"edgeType":"contains","source":8001,"target":8719},{"edgeType":"calls","source":16080,"target":16022},{"edgeType":"contains","source":3971,"target":4685},{"edgeType":"contains","source":13242,"target":13256},{"edgeType":"calls","source":15286,"target":15268},{"edgeType":"imports","source":15763,"target":2375},{"edgeType":"calls","source":13039,"target":13040},{"edgeType":"contains","source":8001,"target":8718},{"edgeType":"contains","source":9362,"target":2466},{"edgeType":"contains","source":14893,"target":14934},{"edgeType":"calls","source":10331,"target":10313},{"edgeType":"contains","source":1876,"target":1980},{"edgeType":"contains","source":15026,"target":15040},{"edgeType":"calls","source":9009,"target":9017},{"edgeType":"contains","source":13242,"target":13255},{"edgeType":"contains","source":15621,"target":15622},{"edgeType":"contains","source":4763,"target":3394},{"edgeType":"contains","source":9541,"target":9596},{"edgeType":"contains","source":16612,"target":16613},{"edgeType":"contains","source":5776,"target":5809},{"edgeType":"contains","source":1876,"target":1985},{"edgeType":"contains","source":6239,"target":6254},{"edgeType":"contains","source":15026,"target":15041},{"edgeType":"contains","source":1406,"target":1757},{"edgeType":"contains","source":8352,"target":8401},{"edgeType":"contains","source":13242,"target":13254},{"edgeType":"calls","source":6037,"target":6038},{"edgeType":"contains","source":1876,"target":1986},{"edgeType":"contains","source":3971,"target":4690},{"edgeType":"contains","source":8001,"target":8712},{"edgeType":"contains","source":13242,"target":13253},{"edgeType":"contains","source":6239,"target":6256},{"edgeType":"contains","source":15621,"target":15624},{"edgeType":"calls","source":2600,"target":2651},{"edgeType":"contains","source":16082,"target":16132},{"edgeType":"calls","source":5510,"target":5461},{"edgeType":"imports","source":15810,"target":15713},{"edgeType":"contains","source":9476,"target":9499},{"edgeType":"contains","source":3971,"target":4689},{"edgeType":"imports","source":10130,"target":9986},{"edgeType":"contains","source":1876,"target":1983},{"edgeType":"calls","source":5244,"target":5251},{"edgeType":"contains","source":13242,"target":13252},{"edgeType":"calls","source":2558,"target":1840},{"edgeType":"contains","source":6239,"target":6257},{"edgeType":"calls","source":15717,"target":12473},{"edgeType":"contains","source":9476,"target":9498},{"edgeType":"contains","source":1876,"target":1984},{"edgeType":"contains","source":3971,"target":4688},{"edgeType":"contains","source":15026,"target":15043},{"edgeType":"contains","source":5776,"target":5812},{"edgeType":"calls","source":10706,"target":806},{"edgeType":"imports","source":14611,"target":14828},{"edgeType":"calls","source":5244,"target":5249},{"edgeType":"contains","source":16017,"target":16018},{"edgeType":"contains","source":3971,"target":4695},{"edgeType":"calls","source":3791,"target":3782},{"edgeType":"contains","source":14893,"target":4352},{"edgeType":"contains","source":1982,"target":817},{"edgeType":"contains","source":9543,"target":9547},{"edgeType":"contains","source":1876,"target":1989},{"edgeType":"calls","source":2934,"target":2866},{"edgeType":"imports","source":10698,"target":2938},{"edgeType":"contains","source":8948,"target":8965},{"edgeType":"contains","source":16083,"target":16087},{"edgeType":"contains","source":9477,"target":9478},{"edgeType":"contains","source":1876,"target":1990},{"edgeType":"contains","source":3971,"target":4694},{"edgeType":"imports","source":8906,"target":1410},{"edgeType":"imports","source":10130,"target":9974},{"edgeType":"contains","source":14694,"target":14750},{"edgeType":"imports","source":8259,"target":2440},{"edgeType":"imports","source":15489,"target":15086},{"edgeType":"calls","source":1698,"target":1012},{"edgeType":"contains","source":16083,"target":16086},{"edgeType":"contains","source":4718,"target":4791},{"edgeType":"calls","source":1906,"target":910},{"edgeType":"contains","source":3971,"target":4693},{"edgeType":"imports","source":7711,"target":2516},{"edgeType":"contains","source":11657,"target":11662},{"edgeType":"calls","source":2735,"target":2690},{"edgeType":"calls","source":13690,"target":3438},{"edgeType":"contains","source":15026,"target":15030},{"edgeType":"calls","source":13679,"target":12236},{"edgeType":"contains","source":1876,"target":1987},{"edgeType":"contains","source":1406,"target":1759},{"edgeType":"contains","source":9015,"target":9004},{"edgeType":"contains","source":4718,"target":4790},{"edgeType":"contains","source":1876,"target":1988},{"edgeType":"contains","source":7711,"target":805},{"edgeType":"imports","source":15822,"target":15336},{"edgeType":"contains","source":15026,"target":15031},{"edgeType":"contains","source":10130,"target":10376},{"edgeType":"contains","source":14761,"target":14789},{"edgeType":"contains","source":15423,"target":610},{"edgeType":"contains","source":15786,"target":14725},{"edgeType":"contains","source":5315,"target":5317},{"edgeType":"contains","source":7561,"target":7562},{"edgeType":"contains","source":11657,"target":11660},{"edgeType":"contains","source":5381,"target":5385},{"edgeType":"contains","source":15026,"target":15032},{"edgeType":"contains","source":3971,"target":4699},{"edgeType":"contains","source":7957,"target":7971},{"edgeType":"contains","source":16082,"target":16122},{"edgeType":"contains","source":2758,"target":2134},{"edgeType":"contains","source":14035,"target":14042},{"edgeType":"contains","source":3971,"target":4698},{"edgeType":"contains","source":5381,"target":5384},{"edgeType":"contains","source":5315,"target":5316},{"edgeType":"contains","source":14828,"target":14829},{"edgeType":"contains","source":7957,"target":7970},{"edgeType":"contains","source":12759,"target":13437},{"edgeType":"contains","source":16082,"target":16121},{"edgeType":"imports","source":2924,"target":2935},{"edgeType":"contains","source":15439,"target":14914},{"edgeType":"contains","source":13457,"target":12939},{"edgeType":"contains","source":3333,"target":3334},{"edgeType":"calls","source":6036,"target":6060},{"edgeType":"imports","source":5256,"target":4632},{"edgeType":"contains","source":5381,"target":5383},{"edgeType":"contains","source":11657,"target":11658},{"edgeType":"calls","source":6811,"target":1058},{"edgeType":"imports","source":11906,"target":11998},{"edgeType":"contains","source":14893,"target":14929},{"edgeType":"calls","source":13671,"target":4032},{"edgeType":"calls","source":1480,"target":1427},{"edgeType":"calls","source":1500,"target":807},{"edgeType":"contains","source":5381,"target":5382},{"edgeType":"contains","source":11657,"target":11659},{"edgeType":"imports","source":5256,"target":4633},{"edgeType":"contains","source":3333,"target":3335},{"edgeType":"calls","source":15638,"target":2246},{"edgeType":"contains","source":4013,"target":3394},{"edgeType":"contains","source":4718,"target":4794},{"edgeType":"imports","source":9472,"target":9235},{"edgeType":"contains","source":4984,"target":5004},{"edgeType":"contains","source":10608,"target":10353},{"edgeType":"contains","source":14035,"target":14045},{"edgeType":"contains","source":14033,"target":14107},{"edgeType":"contains","source":7957,"target":7972},{"edgeType":"contains","source":10221,"target":3303},{"edgeType":"contains","source":8001,"target":8700},{"edgeType":"contains","source":14761,"target":14778},{"edgeType":"contains","source":11193,"target":11225},{"edgeType":"contains","source":13248,"target":13057},{"edgeType":"contains","source":7775,"target":7250},{"edgeType":"calls","source":16214,"target":16210},{"edgeType":"calls","source":10036,"target":2660},{"edgeType":"contains","source":4191,"target":4193},{"edgeType":"contains","source":8352,"target":8390},{"edgeType":"contains","source":8346,"target":8576},{"edgeType":"calls","source":14628,"target":14637},{"edgeType":"contains","source":16545,"target":16555},{"edgeType":"imports","source":12378,"target":3768},{"edgeType":"calls","source":4256,"target":4257},{"edgeType":"contains","source":11040,"target":9625},{"edgeType":"contains","source":11193,"target":11224},{"edgeType":"contains","source":15876,"target":16152},{"edgeType":"calls","source":1483,"target":1427},{"edgeType":"contains","source":12316,"target":12352},{"edgeType":"contains","source":14563,"target":14574},{"edgeType":"imports","source":16801,"target":4072},{"edgeType":"contains","source":8001,"target":8699},{"edgeType":"calls","source":8344,"target":2261},{"edgeType":"contains","source":12262,"target":3454},{"edgeType":"contains","source":3971,"target":4669},{"edgeType":"imports","source":8774,"target":1331},{"edgeType":"calls","source":3012,"target":540},{"edgeType":"contains","source":15822,"target":15713},{"edgeType":"contains","source":8352,"target":8389},{"edgeType":"contains","source":16545,"target":16554},{"edgeType":"contains","source":3596,"target":3610},{"edgeType":"contains","source":4191,"target":4192},{"edgeType":"imports","source":9607,"target":877},{"edgeType":"contains","source":9145,"target":9174},{"edgeType":"contains","source":12316,"target":12351},{"edgeType":"contains","source":1876,"target":1962},{"edgeType":"contains","source":14761,"target":14780},{"edgeType":"contains","source":12759,"target":13415},{"edgeType":"calls","source":1945,"target":1906},{"edgeType":"contains","source":8001,"target":8702},{"edgeType":"calls","source":3422,"target":511},{"edgeType":"calls","source":6405,"target":1058},{"edgeType":"calls","source":3331,"target":3332},{"edgeType":"contains","source":9476,"target":9487},{"edgeType":"calls","source":14179,"target":13756},{"edgeType":"calls","source":16355,"target":16069},{"edgeType":"contains","source":12448,"target":12486},{"edgeType":"calls","source":7761,"target":7650},{"edgeType":"contains","source":16545,"target":16557},{"edgeType":"calls","source":4389,"target":2246},{"edgeType":"imports","source":14871,"target":8937},{"edgeType":"contains","source":12316,"target":12350},{"edgeType":"contains","source":8352,"target":8392},{"edgeType":"imports","source":9598,"target":9609},{"edgeType":"contains","source":4975,"target":5255},{"edgeType":"contains","source":13506,"target":13512},{"edgeType":"calls","source":6643,"target":6370},{"edgeType":"contains","source":5847,"target":5712},{"edgeType":"contains","source":8001,"target":8701},{"edgeType":"contains","source":9476,"target":9486},{"edgeType":"contains","source":3596,"target":3608},{"edgeType":"calls","source":4388,"target":4390},{"edgeType":"contains","source":4975,"target":5254},{"edgeType":"calls","source":9806,"target":9791},{"edgeType":"calls","source":11281,"target":6347},{"edgeType":"contains","source":14431,"target":14441},{"edgeType":"contains","source":8352,"target":8391},{"edgeType":"contains","source":16545,"target":16556},{"edgeType":"calls","source":2411,"target":2256},{"edgeType":"contains","source":11193,"target":11223},{"edgeType":"contains","source":12316,"target":12349},{"edgeType":"contains","source":10815,"target":6029},{"edgeType":"calls","source":11459,"target":11399},{"edgeType":"calls","source":2670,"target":2680},{"edgeType":"calls","source":4147,"target":3403},{"edgeType":"calls","source":11391,"target":11398},{"edgeType":"contains","source":9476,"target":9481},{"edgeType":"contains","source":9410,"target":9413},{"edgeType":"contains","source":12316,"target":12347},{"edgeType":"contains","source":9607,"target":9648},{"edgeType":"calls","source":6678,"target":1058},{"edgeType":"contains","source":1876,"target":1968},{"edgeType":"contains","source":9145,"target":9171},{"edgeType":"contains","source":11193,"target":11220},{"edgeType":"contains","source":13113,"target":13009},{"edgeType":"calls","source":6858,"target":6049},{"edgeType":"contains","source":16545,"target":16559},{"edgeType":"contains","source":12316,"target":12348},{"edgeType":"calls","source":15694,"target":615},{"edgeType":"calls","source":6665,"target":5690},{"edgeType":"contains","source":16077,"target":16267},{"edgeType":"contains","source":7460,"target":2213},{"edgeType":"contains","source":14761,"target":14783},{"edgeType":"contains","source":9410,"target":9412},{"edgeType":"contains","source":12316,"target":12346},{"edgeType":"contains","source":3266,"target":3275},{"edgeType":"calls","source":4587,"target":4561},{"edgeType":"contains","source":5915,"target":5712},{"edgeType":"contains","source":8001,"target":8695},{"edgeType":"contains","source":13246,"target":13113},{"edgeType":"contains","source":1410,"target":1617},{"edgeType":"imports","source":7088,"target":7089},{"edgeType":"contains","source":16545,"target":16558},{"edgeType":"imports","source":2784,"target":974},{"edgeType":"imports","source":15821,"target":15418},{"edgeType":"imports","source":9472,"target":2952},{"edgeType":"contains","source":8001,"target":8698},{"edgeType":"calls","source":10003,"target":10032},{"edgeType":"contains","source":10142,"target":9974},{"edgeType":"contains","source":12316,"target":12345},{"edgeType":"contains","source":5315,"target":5290},{"edgeType":"calls","source":10743,"target":10343},{"edgeType":"contains","source":3266,"target":3272},{"edgeType":"contains","source":10336,"target":10302},{"edgeType":"imports","source":15048,"target":1331},{"edgeType":"imports","source":15130,"target":903},{"edgeType":"contains","source":15620,"target":15638},{"edgeType":"contains","source":6239,"target":6240},{"edgeType":"contains","source":4191,"target":4195},{"edgeType":"imports","source":15636,"target":4244},{"edgeType":"contains","source":14033,"target":14098},{"edgeType":"contains","source":10133,"target":10254},{"edgeType":"contains","source":12316,"target":12344},{"edgeType":"contains","source":3266,"target":3273},{"edgeType":"calls","source":14830,"target":14717},{"edgeType":"calls","source":4727,"target":2333},{"edgeType":"contains","source":3596,"target":3612},{"edgeType":"imports","source":14954,"target":4244},{"edgeType":"contains","source":4191,"target":4194},{"edgeType":"calls","source":10469,"target":10383},{"edgeType":"imports","source":12378,"target":3767},{"edgeType":"contains","source":6239,"target":6241},{"edgeType":"contains","source":8352,"target":8387},{"edgeType":"contains","source":16545,"target":16560},{"edgeType":"contains","source":16083,"target":16084},{"edgeType":"contains","source":13242,"target":13251},{"edgeType":"contains","source":5776,"target":5804},{"edgeType":"contains","source":16082,"target":16101},{"edgeType":"contains","source":1876,"target":1973},{"edgeType":"contains","source":15483,"target":15642},{"edgeType":"contains","source":7957,"target":7959},{"edgeType":"calls","source":10797,"target":10790},{"edgeType":"contains","source":8352,"target":8398},{"edgeType":"contains","source":16545,"target":16547},{"edgeType":"contains","source":8001,"target":8709},{"edgeType":"contains","source":960,"target":770},{"edgeType":"contains","source":5776,"target":5805},{"edgeType":"calls","source":10070,"target":10070},{"edgeType":"calls","source":1227,"target":898},{"edgeType":"calls","source":14369,"target":1533},{"edgeType":"contains","source":16082,"target":16100},{"edgeType":"contains","source":1406,"target":1745},{"edgeType":"calls","source":6858,"target":6054},{"edgeType":"contains","source":9476,"target":9492},{"edgeType":"contains","source":12316,"target":12359},{"edgeType":"calls","source":14960,"target":14926},{"edgeType":"calls","source":10467,"target":10447},{"edgeType":"contains","source":8352,"target":8397},{"edgeType":"contains","source":16545,"target":16546},{"edgeType":"contains","source":8001,"target":8708},{"edgeType":"contains","source":5712,"target":5676},{"edgeType":"contains","source":8352,"target":8400},{"edgeType":"contains","source":5776,"target":5806},{"edgeType":"contains","source":16082,"target":16103},{"edgeType":"contains","source":3266,"target":3276},{"edgeType":"calls","source":1283,"target":1279},{"edgeType":"contains","source":1410,"target":1618},{"edgeType":"contains","source":13242,"target":13249},{"edgeType":"calls","source":1079,"target":1261},{"edgeType":"contains","source":9476,"target":9495},{"edgeType":"contains","source":12316,"target":12358},{"edgeType":"contains","source":14497,"target":14500},{"edgeType":"calls","source":10647,"target":642},{"edgeType":"calls","source":6114,"target":5842},{"edgeType":"contains","source":6239,"target":6252},{"edgeType":"contains","source":14431,"target":14432},{"edgeType":"calls","source":1943,"target":1959},{"edgeType":"calls","source":6046,"target":5836},{"edgeType":"contains","source":12672,"target":3436},{"edgeType":"contains","source":16479,"target":16481},{"edgeType":"contains","source":16545,"target":16549},{"edgeType":"contains","source":2618,"target":2223},{"edgeType":"contains","source":8001,"target":8711},{"edgeType":"contains","source":14954,"target":15132},{"edgeType":"calls","source":2869,"target":2848},{"edgeType":"contains","source":2936,"target":2937},{"edgeType":"contains","source":1876,"target":1971},{"edgeType":"contains","source":8948,"target":8950},{"edgeType":"contains","source":3266,"target":3277},{"edgeType":"contains","source":16082,"target":16102},{"edgeType":"contains","source":12316,"target":12357},{"edgeType":"contains","source":16479,"target":16480},{"edgeType":"contains","source":14431,"target":14433},{"edgeType":"contains","source":5776,"target":5808},{"edgeType":"contains","source":8352,"target":8399},{"edgeType":"contains","source":16545,"target":16548},{"edgeType":"calls","source":6938,"target":5690},{"edgeType":"contains","source":8001,"target":8710},{"edgeType":"contains","source":8001,"target":8704},{"edgeType":"contains","source":13506,"target":13519},{"edgeType":"calls","source":7890,"target":7890},{"edgeType":"contains","source":15620,"target":15628},{"edgeType":"contains","source":12316,"target":12356},{"edgeType":"contains","source":15876,"target":16148},{"edgeType":"contains","source":11591,"target":11575},{"edgeType":"imports","source":5256,"target":4679},{"edgeType":"imports","source":15620,"target":15300},{"edgeType":"contains","source":8001,"target":8705},{"edgeType":"calls","source":16685,"target":16411},{"edgeType":"imports","source":12378,"target":12212},{"edgeType":"calls","source":15440,"target":4269},{"edgeType":"contains","source":16479,"target":16483},{"edgeType":"calls","source":6857,"target":6088},{"edgeType":"contains","source":3971,"target":4683},{"edgeType":"contains","source":16545,"target":16551},{"edgeType":"calls","source":14960,"target":14921},{"edgeType":"contains","source":12262,"target":3458},{"edgeType":"imports","source":15489,"target":15132},{"edgeType":"contains","source":8001,"target":8703},{"edgeType":"contains","source":3435,"target":4385},{"edgeType":"contains","source":16082,"target":16104},{"edgeType":"contains","source":13506,"target":13518},{"edgeType":"contains","source":9542,"target":9556},{"edgeType":"calls","source":14060,"target":2660},{"edgeType":"contains","source":15620,"target":15629},{"edgeType":"contains","source":16479,"target":16482},{"edgeType":"contains","source":8352,"target":8393},{"edgeType":"contains","source":16545,"target":16550},{"edgeType":"calls","source":14564,"target":14518},{"edgeType":"contains","source":12316,"target":12355},{"edgeType":"calls","source":2075,"target":2088},{"edgeType":"imports","source":9472,"target":2941},{"edgeType":"contains","source":690,"target":691},{"edgeType":"contains","source":9633,"target":2510},{"edgeType":"calls","source":16016,"target":16012},{"edgeType":"calls","source":7887,"target":7985},{"edgeType":"contains","source":15620,"target":15630},{"edgeType":"contains","source":15483,"target":15649},{"edgeType":"contains","source":1945,"target":1950},{"edgeType":"contains","source":15876,"target":16150},{"edgeType":"contains","source":16545,"target":16553},{"edgeType":"calls","source":3425,"target":405},{"edgeType":"contains","source":8352,"target":8396},{"edgeType":"contains","source":8001,"target":8707},{"edgeType":"contains","source":12316,"target":12354},{"edgeType":"contains","source":5776,"target":5803},{"edgeType":"contains","source":16082,"target":16106},{"edgeType":"calls","source":12075,"target":772},{"edgeType":"contains","source":15883,"target":15934},{"edgeType":"contains","source":1876,"target":1976},{"edgeType":"contains","source":1945,"target":1951},{"edgeType":"contains","source":8001,"target":8706},{"edgeType":"contains","source":16479,"target":16484},{"edgeType":"contains","source":12316,"target":12353},{"edgeType":"contains","source":14365,"target":14369},{"edgeType":"contains","source":6239,"target":6249},{"edgeType":"contains","source":12448,"target":12471},{"edgeType":"contains","source":15883,"target":15919},{"edgeType":"calls","source":286,"target":497},{"edgeType":"contains","source":15950,"target":15956},{"edgeType":"contains","source":12316,"target":12335},{"edgeType":"contains","source":6700,"target":6733},{"edgeType":"calls","source":15705,"target":2375},{"edgeType":"contains","source":8001,"target":8684},{"edgeType":"imports","source":6259,"target":1058},{"edgeType":"contains","source":3662,"target":3663},{"edgeType":"contains","source":12448,"target":12470},{"edgeType":"calls","source":1533,"target":2007},{"edgeType":"calls","source":15948,"target":15984},{"edgeType":"contains","source":1406,"target":1720},{"edgeType":"contains","source":15883,"target":15920},{"edgeType":"contains","source":15876,"target":16137},{"edgeType":"contains","source":12316,"target":12334},{"edgeType":"contains","source":12908,"target":13009},{"edgeType":"contains","source":6700,"target":6734},{"edgeType":"contains","source":3971,"target":4653},{"edgeType":"imports","source":14595,"target":9017},{"edgeType":"contains","source":1876,"target":1949},{"edgeType":"calls","source":2214,"target":2036},{"edgeType":"calls","source":13968,"target":13938},{"edgeType":"contains","source":12316,"target":12333},{"edgeType":"contains","source":6700,"target":6735},{"edgeType":"contains","source":14761,"target":14764},{"edgeType":"contains","source":3265,"target":3282},{"edgeType":"contains","source":15483,"target":15636},{"edgeType":"contains","source":16082,"target":16095},{"edgeType":"imports","source":4242,"target":4392},{"edgeType":"calls","source":2010,"target":2021},{"edgeType":"contains","source":10133,"target":10241},{"edgeType":"contains","source":9145,"target":9161},{"edgeType":"contains","source":13307,"target":13323},{"edgeType":"imports","source":14288,"target":14309},{"edgeType":"contains","source":2205,"target":2318},{"edgeType":"calls","source":13967,"target":13968},{"edgeType":"calls","source":13650,"target":540},{"edgeType":"contains","source":15883,"target":15922},{"edgeType":"contains","source":13307,"target":13322},{"edgeType":"contains","source":12316,"target":12332},{"edgeType":"calls","source":13755,"target":3627},{"edgeType":"calls","source":3464,"target":3455},{"edgeType":"contains","source":16282,"target":16236},{"edgeType":"contains","source":1876,"target":1947},{"edgeType":"contains","source":15483,"target":15637},{"edgeType":"contains","source":3265,"target":3283},{"edgeType":"contains","source":16082,"target":16094},{"edgeType":"calls","source":14232,"target":14209},{"edgeType":"contains","source":8001,"target":8685},{"edgeType":"calls","source":8484,"target":2134},{"edgeType":"contains","source":5711,"target":5676},{"edgeType":"imports","source":5293,"target":1410},{"edgeType":"contains","source":9145,"target":9155},{"edgeType":"calls","source":12075,"target":748},{"edgeType":"calls","source":14628,"target":14625},{"edgeType":"calls","source":1944,"target":1947},{"edgeType":"calls","source":3794,"target":3792},{"edgeType":"contains","source":16082,"target":16097},{"edgeType":"contains","source":6700,"target":6728},{"edgeType":"calls","source":12845,"target":12818},{"edgeType":"imports","source":12378,"target":12204},{"edgeType":"calls","source":6252,"target":5815},{"edgeType":"contains","source":12316,"target":12331},{"edgeType":"contains","source":3971,"target":4658},{"edgeType":"contains","source":6172,"target":6184},{"edgeType":"calls","source":4521,"target":4511},{"edgeType":"contains","source":7824,"target":7825},{"edgeType":"contains","source":8001,"target":8680},{"edgeType":"calls","source":2935,"target":2938},{"edgeType":"calls","source":14053,"target":7080},{"edgeType":"contains","source":9145,"target":9154},{"edgeType":"contains","source":13307,"target":13320},{"edgeType":"calls","source":14628,"target":14624},{"edgeType":"calls","source":3602,"target":3403},{"edgeType":"contains","source":15883,"target":15924},{"edgeType":"calls","source":3794,"target":3793},{"edgeType":"contains","source":16082,"target":16096},{"edgeType":"contains","source":10133,"target":10240},{"edgeType":"calls","source":10313,"target":402},{"edgeType":"contains","source":12316,"target":12330},{"edgeType":"imports","source":15517,"target":7913},{"edgeType":"contains","source":5776,"target":5777},{"edgeType":"calls","source":817,"target":944},{"edgeType":"contains","source":3596,"target":3598},{"edgeType":"contains","source":13246,"target":13096},{"edgeType":"contains","source":9754,"target":9301},{"edgeType":"contains","source":7094,"target":7201},{"edgeType":"contains","source":16082,"target":16099},{"edgeType":"imports","source":9472,"target":9275},{"edgeType":"contains","source":10522,"target":292},{"edgeType":"contains","source":12316,"target":12329},{"edgeType":"contains","source":11576,"target":12013},{"edgeType":"contains","source":14563,"target":14564},{"edgeType":"contains","source":3662,"target":3665},{"edgeType":"calls","source":10511,"target":609},{"edgeType":"contains","source":3971,"target":4656},{"edgeType":"calls","source":5049,"target":5053},{"edgeType":"calls","source":5842,"target":5838},{"edgeType":"contains","source":12448,"target":12464},{"edgeType":"calls","source":2254,"target":793},{"edgeType":"contains","source":623,"target":628},{"edgeType":"contains","source":6700,"target":6732},{"edgeType":"contains","source":16082,"target":16098},{"edgeType":"contains","source":6700,"target":6731},{"edgeType":"contains","source":12316,"target":12328},{"edgeType":"calls","source":887,"target":890},{"edgeType":"calls","source":3002,"target":2974},{"edgeType":"contains","source":9476,"target":9477},{"edgeType":"contains","source":14694,"target":14716},{"edgeType":"imports","source":15779,"target":12473},{"edgeType":"contains","source":12316,"target":12343},{"edgeType":"calls","source":6729,"target":5807},{"edgeType":"contains","source":5908,"target":5924},{"edgeType":"contains","source":12448,"target":12479},{"edgeType":"contains","source":8001,"target":8692},{"edgeType":"calls","source":14879,"target":4734},{"edgeType":"imports","source":13217,"target":13673},{"edgeType":"contains","source":5659,"target":7301},{"edgeType":"calls","source":953,"target":953},{"edgeType":"contains","source":14033,"target":14067},{"edgeType":"contains","source":16082,"target":16085},{"edgeType":"contains","source":7460,"target":2207},{"edgeType":"contains","source":9542,"target":9544},{"edgeType":"contains","source":15289,"target":15299},{"edgeType":"contains","source":4718,"target":4759},{"edgeType":"contains","source":12316,"target":12342},{"edgeType":"imports","source":9624,"target":2440},{"edgeType":"contains","source":8346,"target":8566},{"edgeType":"calls","source":3992,"target":3993},{"edgeType":"calls","source":4455,"target":2323},{"edgeType":"calls","source":2391,"target":772},{"edgeType":"contains","source":13307,"target":13332},{"edgeType":"contains","source":3596,"target":3602},{"edgeType":"calls","source":1679,"target":1700},{"edgeType":"calls","source":13929,"target":13042},{"edgeType":"contains","source":12316,"target":12341},{"edgeType":"contains","source":9410,"target":9411},{"edgeType":"contains","source":12448,"target":12477},{"edgeType":"contains","source":8001,"target":8694},{"edgeType":"contains","source":3662,"target":3669},{"edgeType":"contains","source":11193,"target":11214},{"edgeType":"contains","source":12316,"target":12340},{"edgeType":"contains","source":3971,"target":4659},{"edgeType":"contains","source":2873,"target":2759},{"edgeType":"contains","source":8346,"target":8568},{"edgeType":"contains","source":359,"target":360},{"edgeType":"calls","source":4125,"target":4096},{"edgeType":"contains","source":8001,"target":8693},{"edgeType":"calls","source":11281,"target":6338},{"edgeType":"calls","source":13174,"target":13190},{"edgeType":"calls","source":11062,"target":11013},{"edgeType":"contains","source":13384,"target":13057},{"edgeType":"calls","source":15608,"target":5394},{"edgeType":"calls","source":11391,"target":11385},{"edgeType":"calls","source":13929,"target":13040},{"edgeType":"calls","source":1909,"target":910},{"edgeType":"imports","source":14465,"target":8807},{"edgeType":"calls","source":6852,"target":6226},{"edgeType":"contains","source":12316,"target":12339},{"edgeType":"contains","source":3522,"target":3787},{"edgeType":"contains","source":8001,"target":8688},{"edgeType":"contains","source":3662,"target":3675},{"edgeType":"contains","source":1055,"target":2041},{"edgeType":"calls","source":15714,"target":14785},{"edgeType":"imports","source":5256,"target":4662},{"edgeType":"calls","source":1481,"target":1493},{"edgeType":"contains","source":13307,"target":13329},{"edgeType":"contains","source":3266,"target":3267},{"edgeType":"imports","source":2434,"target":1246},{"edgeType":"calls","source":6962,"target":7045},{"edgeType":"calls","source":11213,"target":6338},{"edgeType":"contains","source":12316,"target":12338},{"edgeType":"calls","source":2411,"target":2262},{"edgeType":"contains","source":14893,"target":14895},{"edgeType":"contains","source":3662,"target":3674},{"edgeType":"contains","source":16083,"target":16057},{"edgeType":"imports","source":8839,"target":1410},{"edgeType":"calls","source":16084,"target":16000},{"edgeType":"contains","source":15883,"target":15917},{"edgeType":"contains","source":9542,"target":9543},{"edgeType":"contains","source":12316,"target":12337},{"edgeType":"contains","source":8346,"target":8565},{"edgeType":"calls","source":14696,"target":14637},{"edgeType":"contains","source":3596,"target":3605},{"edgeType":"contains","source":16082,"target":16091},{"edgeType":"contains","source":13307,"target":13327},{"edgeType":"imports","source":10919,"target":10920},{"edgeType":"calls","source":15596,"target":1533},{"edgeType":"contains","source":9608,"target":9610},{"edgeType":"contains","source":1876,"target":1959},{"edgeType":"calls","source":1945,"target":1909},{"edgeType":"imports","source":11788,"target":893},{"edgeType":"contains","source":5973,"target":6022},{"edgeType":"contains","source":12316,"target":12336},{"edgeType":"calls","source":2670,"target":2687},{"edgeType":"calls","source":8567,"target":8029},{"edgeType":"calls","source":424,"target":436},{"edgeType":"contains","source":12448,"target":12472},{"edgeType":"contains","source":3662,"target":3672},{"edgeType":"contains","source":7460,"target":2206},{"edgeType":"calls","source":1285,"target":1190},{"edgeType":"contains","source":9409,"target":9415},{"edgeType":"contains","source":3199,"target":3200},{"edgeType":"contains","source":15289,"target":15290},{"edgeType":"contains","source":15421,"target":15426},{"edgeType":"contains","source":3788,"target":3968},{"edgeType":"calls","source":8426,"target":8142},{"edgeType":"contains","source":12448,"target":12455},{"edgeType":"contains","source":2205,"target":2303},{"edgeType":"contains","source":9035,"target":8324},{"edgeType":"calls","source":286,"target":448},{"edgeType":"imports","source":9472,"target":9322},{"edgeType":"contains","source":4718,"target":4735},{"edgeType":"contains","source":12316,"target":12319},{"edgeType":"imports","source":16018,"target":893},{"edgeType":"contains","source":15483,"target":15619},{"edgeType":"contains","source":9409,"target":9414},{"edgeType":"contains","source":13307,"target":13308},{"edgeType":"calls","source":819,"target":836},{"edgeType":"contains","source":2205,"target":2304},{"edgeType":"contains","source":6172,"target":6173},{"edgeType":"calls","source":3092,"target":2255},{"edgeType":"calls","source":7162,"target":7159},{"edgeType":"calls","source":2082,"target":1854},{"edgeType":"contains","source":12316,"target":12318},{"edgeType":"calls","source":7709,"target":772},{"edgeType":"calls","source":3803,"target":3468},{"edgeType":"contains","source":3265,"target":3266},{"edgeType":"calls","source":5444,"target":5447},{"edgeType":"contains","source":15483,"target":15620},{"edgeType":"calls","source":10134,"target":10162},{"edgeType":"calls","source":2040,"target":1042},{"edgeType":"calls","source":4651,"target":4661},{"edgeType":"contains","source":9409,"target":9417},{"edgeType":"calls","source":16011,"target":16130},{"edgeType":"contains","source":3971,"target":4635},{"edgeType":"calls","source":10536,"target":10381},{"edgeType":"imports","source":5256,"target":4718},{"edgeType":"imports","source":7239,"target":2440},{"edgeType":"contains","source":12316,"target":12317},{"edgeType":"contains","source":3971,"target":4634},{"edgeType":"contains","source":9409,"target":9416},{"edgeType":"calls","source":16875,"target":16828},{"edgeType":"contains","source":6172,"target":6175},{"edgeType":"contains","source":13245,"target":13113},{"edgeType":"calls","source":4125,"target":4052},{"edgeType":"contains","source":8807,"target":9046},{"edgeType":"calls","source":5502,"target":1533},{"edgeType":"contains","source":14832,"target":14662},{"edgeType":"contains","source":13703,"target":13713},{"edgeType":"calls","source":8495,"target":8121},{"edgeType":"calls","source":9078,"target":9075},{"edgeType":"contains","source":4058,"target":4059},{"edgeType":"calls","source":16146,"target":16166},{"edgeType":"contains","source":8352,"target":8353},{"edgeType":"contains","source":2205,"target":2307},{"edgeType":"imports","source":2434,"target":1288},{"edgeType":"calls","source":1903,"target":1054},{"edgeType":"calls","source":16346,"target":16310},{"edgeType":"calls","source":4125,"target":4053},{"edgeType":"contains","source":15421,"target":15431},{"edgeType":"contains","source":9409,"target":9410},{"edgeType":"contains","source":13703,"target":13712},{"edgeType":"contains","source":8352,"target":8351},{"edgeType":"calls","source":15159,"target":2369},{"edgeType":"imports","source":14620,"target":14629},{"edgeType":"contains","source":14365,"target":14342},{"edgeType":"contains","source":12448,"target":12450},{"edgeType":"calls","source":9805,"target":9791},{"edgeType":"calls","source":16015,"target":16000},{"edgeType":"contains","source":2667,"target":2784},{"edgeType":"contains","source":15421,"target":15432},{"edgeType":"contains","source":424,"target":439},{"edgeType":"contains","source":9476,"target":3108},{"edgeType":"contains","source":13703,"target":13711},{"edgeType":"contains","source":3788,"target":3970},{"edgeType":"calls","source":15705,"target":2357},{"edgeType":"contains","source":2205,"target":2305},{"edgeType":"contains","source":10522,"target":10846},{"edgeType":"contains","source":12448,"target":12449},{"edgeType":"contains","source":4385,"target":4490},{"edgeType":"contains","source":15883,"target":15908},{"edgeType":"calls","source":11390,"target":11394},{"edgeType":"calls","source":13477,"target":12234},{"edgeType":"calls","source":4125,"target":4049},{"edgeType":"contains","source":16077,"target":16238},{"edgeType":"calls","source":4125,"target":4051},{"edgeType":"contains","source":13703,"target":13710},{"edgeType":"contains","source":15421,"target":15433},{"edgeType":"contains","source":5470,"target":4679},{"edgeType":"calls","source":3338,"target":3079},{"edgeType":"contains","source":3788,"target":3969},{"edgeType":"contains","source":3971,"target":4638},{"edgeType":"contains","source":11192,"target":11217},{"edgeType":"contains","source":2205,"target":2306},{"edgeType":"contains","source":9476,"target":3106},{"edgeType":"contains","source":15883,"target":15909},{"edgeType":"contains","source":8807,"target":9047},{"edgeType":"imports","source":9472,"target":9325},{"edgeType":"calls","source":4125,"target":4050},{"edgeType":"calls","source":4849,"target":4859},{"edgeType":"imports","source":14620,"target":14626},{"edgeType":"contains","source":13307,"target":13317},{"edgeType":"imports","source":3786,"target":3768},{"edgeType":"contains","source":7691,"target":7715},{"edgeType":"contains","source":9754,"target":9299},{"edgeType":"calls","source":953,"target":903},{"edgeType":"contains","source":9145,"target":9151},{"edgeType":"calls","source":8094,"target":7871},{"edgeType":"contains","source":4058,"target":4063},{"edgeType":"contains","source":5465,"target":4841},{"edgeType":"calls","source":2039,"target":1062},{"edgeType":"calls","source":7162,"target":7166},{"edgeType":"contains","source":4385,"target":4496},{"edgeType":"contains","source":15619,"target":15623},{"edgeType":"calls","source":1611,"target":1645},{"edgeType":"calls","source":3456,"target":1533},{"edgeType":"calls","source":3092,"target":2246},{"edgeType":"contains","source":9145,"target":9150},{"edgeType":"contains","source":13175,"target":13180},{"edgeType":"contains","source":4058,"target":4062},{"edgeType":"calls","source":6027,"target":2165},{"edgeType":"contains","source":12316,"target":12326},{"edgeType":"contains","source":6700,"target":6725},{"edgeType":"contains","source":3971,"target":4645},{"edgeType":"contains","source":12448,"target":12462},{"edgeType":"contains","source":8001,"target":8675},{"edgeType":"contains","source":6172,"target":6181},{"edgeType":"contains","source":4385,"target":4495},{"edgeType":"calls","source":7030,"target":7031},{"edgeType":"contains","source":9145,"target":9153},{"edgeType":"contains","source":14958,"target":14974},{"edgeType":"contains","source":14954,"target":15098},{"edgeType":"calls","source":4281,"target":3438},{"edgeType":"calls","source":7163,"target":7137},{"edgeType":"calls","source":2076,"target":2028},{"edgeType":"contains","source":13175,"target":13179},{"edgeType":"contains","source":12316,"target":12325},{"edgeType":"contains","source":3971,"target":4644},{"edgeType":"contains","source":14694,"target":14702},{"edgeType":"contains","source":4385,"target":4494},{"edgeType":"contains","source":14958,"target":14975},{"edgeType":"calls","source":2867,"target":2877},{"edgeType":"calls","source":16451,"target":4613},{"edgeType":"calls","source":1615,"target":1523},{"edgeType":"calls","source":5444,"target":5438},{"edgeType":"contains","source":11061,"target":11063},{"edgeType":"contains","source":16156,"target":15889},{"edgeType":"calls","source":11789,"target":11715},{"edgeType":"contains","source":5462,"target":4931},{"edgeType":"imports","source":14620,"target":14627},{"edgeType":"contains","source":9145,"target":9152},{"edgeType":"calls","source":1285,"target":1183},{"edgeType":"contains","source":12316,"target":12324},{"edgeType":"calls","source":14445,"target":13940},{"edgeType":"contains","source":2076,"target":2081},{"edgeType":"calls","source":5841,"target":5815},{"edgeType":"contains","source":5908,"target":5911},{"edgeType":"calls","source":2008,"target":2024},{"edgeType":"contains","source":4385,"target":4493},{"edgeType":"contains","source":4718,"target":4740},{"edgeType":"calls","source":3003,"target":772},{"edgeType":"calls","source":6523,"target":5838},{"edgeType":"contains","source":14954,"target":15100},{"edgeType":"contains","source":10812,"target":6094},{"edgeType":"contains","source":1768,"target":1063},{"edgeType":"contains","source":13175,"target":13177},{"edgeType":"contains","source":11576,"target":12007},{"edgeType":"contains","source":3265,"target":3280},{"edgeType":"contains","source":9409,"target":9419},{"edgeType":"contains","source":1876,"target":1944},{"edgeType":"imports","source":14716,"target":1076},{"edgeType":"calls","source":1017,"target":1029},{"edgeType":"contains","source":4058,"target":4067},{"edgeType":"contains","source":10522,"target":10856},{"edgeType":"contains","source":2205,"target":2315},{"edgeType":"contains","source":12316,"target":12323},{"edgeType":"imports","source":6305,"target":6018},{"edgeType":"imports","source":7829,"target":1058},{"edgeType":"calls","source":6311,"target":6069},{"edgeType":"contains","source":9145,"target":9146},{"edgeType":"contains","source":13175,"target":13176},{"edgeType":"contains","source":15421,"target":15423},{"edgeType":"imports","source":14954,"target":14837},{"edgeType":"contains","source":9409,"target":9418},{"edgeType":"contains","source":11193,"target":11197},{"edgeType":"calls","source":3939,"target":3468},{"edgeType":"contains","source":3265,"target":3281},{"edgeType":"contains","source":15883,"target":15899},{"edgeType":"contains","source":4058,"target":4066},{"edgeType":"calls","source":11390,"target":11402},{"edgeType":"calls","source":5184,"target":5038},{"edgeType":"contains","source":7691,"target":7713},{"edgeType":"contains","source":9409,"target":9421},{"edgeType":"calls","source":1744,"target":1749},{"edgeType":"contains","source":9145,"target":9149},{"edgeType":"contains","source":9476,"target":3116},{"edgeType":"calls","source":1811,"target":1786},{"edgeType":"contains","source":4058,"target":4065},{"edgeType":"calls","source":3926,"target":3868},{"edgeType":"calls","source":10699,"target":1115},{"edgeType":"contains","source":10522,"target":10854},{"edgeType":"contains","source":12759,"target":13385},{"edgeType":"calls","source":3065,"target":3077},{"edgeType":"contains","source":3875,"target":3394},{"edgeType":"contains","source":11193,"target":11195},{"edgeType":"contains","source":9145,"target":9148},{"edgeType":"contains","source":7691,"target":7712},{"edgeType":"contains","source":3265,"target":3279},{"edgeType":"contains","source":9409,"target":9420},{"edgeType":"contains","source":1876,"target":1943},{"edgeType":"contains","source":12316,"target":12320},{"edgeType":"calls","source":14775,"target":12170},{"edgeType":"contains","source":10522,"target":10855},{"edgeType":"contains","source":12448,"target":12456},{"edgeType":"contains","source":4191,"target":4143},{"edgeType":"contains","source":4718,"target":4719},{"edgeType":"contains","source":2734,"target":2800},{"edgeType":"contains","source":4916,"target":4923},{"edgeType":"calls","source":13010,"target":3438},{"edgeType":"calls","source":424,"target":415},{"edgeType":"calls","source":4468,"target":4011},{"edgeType":"contains","source":27,"target":39},{"edgeType":"calls","source":424,"target":413},{"edgeType":"contains","source":12910,"target":12914},{"edgeType":"contains","source":6700,"target":6701},{"edgeType":"contains","source":4916,"target":4922},{"edgeType":"calls","source":12249,"target":12230},{"edgeType":"calls","source":14957,"target":14961},{"edgeType":"contains","source":14958,"target":14965},{"edgeType":"contains","source":27,"target":38},{"edgeType":"calls","source":1084,"target":1094},{"edgeType":"calls","source":6454,"target":5836},{"edgeType":"contains","source":15552,"target":15577},{"edgeType":"contains","source":7823,"target":7826},{"edgeType":"calls","source":3003,"target":2913},{"edgeType":"imports","source":2616,"target":1974},{"edgeType":"contains","source":12910,"target":12913},{"edgeType":"contains","source":4916,"target":4921},{"edgeType":"contains","source":8676,"target":8869},{"edgeType":"contains","source":980,"target":2209},{"edgeType":"calls","source":1611,"target":1673},{"edgeType":"calls","source":5468,"target":4719},{"edgeType":"calls","source":13308,"target":540},{"edgeType":"calls","source":6795,"target":5836},{"edgeType":"calls","source":3278,"target":2844},{"edgeType":"contains","source":1,"target":11417},{"edgeType":"contains","source":2734,"target":2797},{"edgeType":"calls","source":7954,"target":7960},{"edgeType":"calls","source":15159,"target":2358},{"edgeType":"contains","source":15130,"target":5406},{"edgeType":"contains","source":27,"target":41},{"edgeType":"contains","source":5643,"target":5644},{"edgeType":"contains","source":7691,"target":7693},{"edgeType":"calls","source":10799,"target":10668},{"edgeType":"contains","source":3971,"target":4619},{"edgeType":"contains","source":13901,"target":13902},{"edgeType":"calls","source":4393,"target":2104},{"edgeType":"calls","source":7162,"target":7144},{"edgeType":"contains","source":4916,"target":4920},{"edgeType":"contains","source":12910,"target":12912},{"edgeType":"contains","source":8676,"target":8868},{"edgeType":"calls","source":6795,"target":5837},{"edgeType":"calls","source":10943,"target":10433},{"edgeType":"contains","source":14694,"target":14695},{"edgeType":"calls","source":3425,"target":402},{"edgeType":"imports","source":12378,"target":3788},{"edgeType":"calls","source":1017,"target":1059},{"edgeType":"contains","source":27,"target":40},{"edgeType":"contains","source":7691,"target":7692},{"edgeType":"contains","source":27,"target":43},{"edgeType":"calls","source":2339,"target":2354},{"edgeType":"contains","source":13175,"target":13152},{"edgeType":"calls","source":1611,"target":1667},{"edgeType":"calls","source":14000,"target":4463},{"edgeType":"contains","source":9275,"target":9320},{"edgeType":"imports","source":15712,"target":12473},{"edgeType":"contains","source":12910,"target":12911},{"edgeType":"calls","source":6268,"target":1058},{"edgeType":"contains","source":11554,"target":12664},{"edgeType":"calls","source":1533,"target":1970},{"edgeType":"calls","source":8292,"target":8054},{"edgeType":"contains","source":10069,"target":10076},{"edgeType":"calls","source":1017,"target":1053},{"edgeType":"contains","source":13173,"target":13213},{"edgeType":"calls","source":13794,"target":12962},{"edgeType":"calls","source":16011,"target":16108},{"edgeType":"imports","source":2434,"target":1271},{"edgeType":"calls","source":1943,"target":1944},{"edgeType":"contains","source":10928,"target":10931},{"edgeType":"contains","source":10069,"target":10077},{"edgeType":"contains","source":16077,"target":16218},{"edgeType":"calls","source":1481,"target":1467},{"edgeType":"contains","source":11554,"target":12665},{"edgeType":"contains","source":27,"target":45},{"edgeType":"calls","source":2407,"target":2358},{"edgeType":"contains","source":4458,"target":2210},{"edgeType":"imports","source":13962,"target":9644},{"edgeType":"calls","source":10729,"target":10728},{"edgeType":"contains","source":11554,"target":12662},{"edgeType":"imports","source":16315,"target":4352},{"edgeType":"calls","source":2952,"target":2376},{"edgeType":"calls","source":819,"target":852},{"edgeType":"calls","source":3076,"target":2760},{"edgeType":"calls","source":975,"target":2358},{"edgeType":"contains","source":10069,"target":10074},{"edgeType":"contains","source":27,"target":44},{"edgeType":"contains","source":11852,"target":11880},{"edgeType":"imports","source":13217,"target":13714},{"edgeType":"contains","source":2734,"target":2803},{"edgeType":"contains","source":8807,"target":9030},{"edgeType":"imports","source":9543,"target":9222},{"edgeType":"contains","source":11554,"target":12663},{"edgeType":"calls","source":5406,"target":2408},{"edgeType":"contains","source":3971,"target":4622},{"edgeType":"contains","source":7823,"target":7824},{"edgeType":"calls","source":3076,"target":2761},{"edgeType":"contains","source":5930,"target":5200},{"edgeType":"imports","source":15421,"target":349},{"edgeType":"contains","source":3971,"target":4629},{"edgeType":"contains","source":27,"target":47},{"edgeType":"imports","source":12378,"target":12232},{"edgeType":"calls","source":6795,"target":5842},{"edgeType":"calls","source":14955,"target":4459},{"edgeType":"contains","source":12316,"target":3854},{"edgeType":"calls","source":15304,"target":2097},{"edgeType":"contains","source":10522,"target":10844},{"edgeType":"imports","source":2619,"target":1891},{"edgeType":"contains","source":7691,"target":7699},{"edgeType":"contains","source":15552,"target":15568},{"edgeType":"contains","source":5643,"target":5650},{"edgeType":"contains","source":3264,"target":3290},{"edgeType":"calls","source":1533,"target":1966},{"edgeType":"imports","source":5256,"target":4691},{"edgeType":"contains","source":27,"target":46},{"edgeType":"contains","source":2734,"target":2809},{"edgeType":"calls","source":4661,"target":2246},{"edgeType":"calls","source":2497,"target":1681},{"edgeType":"calls","source":12249,"target":12239},{"edgeType":"contains","source":3971,"target":4628},{"edgeType":"imports","source":15484,"target":15308},{"edgeType":"calls","source":7360,"target":7355},{"edgeType":"calls","source":4387,"target":2284},{"edgeType":"contains","source":10522,"target":10845},{"edgeType":"calls","source":15913,"target":2246},{"edgeType":"contains","source":7691,"target":7698},{"edgeType":"contains","source":9362,"target":2406},{"edgeType":"contains","source":9476,"target":3100},{"edgeType":"imports","source":5256,"target":4692},{"edgeType":"contains","source":2734,"target":2806},{"edgeType":"contains","source":27,"target":49},{"edgeType":"contains","source":3971,"target":4627},{"edgeType":"contains","source":6700,"target":6710},{"edgeType":"contains","source":13703,"target":13707},{"edgeType":"contains","source":15263,"target":1274},{"edgeType":"contains","source":3788,"target":3958},{"edgeType":"contains","source":7691,"target":7701},{"edgeType":"calls","source":6813,"target":1058},{"edgeType":"contains","source":15552,"target":15570},{"edgeType":"calls","source":11522,"target":11518},{"edgeType":"imports","source":7088,"target":7096},{"edgeType":"contains","source":13703,"target":13706},{"edgeType":"calls","source":3736,"target":3438},{"edgeType":"contains","source":2080,"target":1940},{"edgeType":"contains","source":27,"target":48},{"edgeType":"imports","source":10130,"target":10038},{"edgeType":"contains","source":10436,"target":2938},{"edgeType":"contains","source":10606,"target":10353},{"edgeType":"contains","source":14958,"target":14959},{"edgeType":"contains","source":16267,"target":16660},{"edgeType":"contains","source":7691,"target":7700},{"edgeType":"contains","source":9624,"target":628},{"edgeType":"contains","source":1216,"target":1242},{"edgeType":"calls","source":12223,"target":358},{"edgeType":"calls","source":1533,"target":1967},{"edgeType":"imports","source":7088,"target":7095},{"edgeType":"contains","source":13703,"target":13705},{"edgeType":"imports","source":5256,"target":4696},{"edgeType":"contains","source":2734,"target":2812},{"edgeType":"calls","source":12192,"target":11895},{"edgeType":"imports","source":7775,"target":600},{"edgeType":"imports","source":9797,"target":9798},{"edgeType":"contains","source":1,"target":11428},{"edgeType":"contains","source":6572,"target":6443},{"edgeType":"contains","source":9624,"target":623},{"edgeType":"contains","source":15552,"target":15572},{"edgeType":"contains","source":3670,"target":3394},{"edgeType":"contains","source":7691,"target":7695},{"edgeType":"contains","source":3264,"target":3294},{"edgeType":"calls","source":1964,"target":1285},{"edgeType":"contains","source":13703,"target":13704},{"edgeType":"calls","source":2040,"target":1043},{"edgeType":"contains","source":4652,"target":4662},{"edgeType":"calls","source":3962,"target":658},{"edgeType":"calls","source":2339,"target":2347},{"edgeType":"contains","source":8807,"target":9037},{"edgeType":"calls","source":4387,"target":4394},{"edgeType":"contains","source":4975,"target":5219},{"edgeType":"calls","source":6318,"target":5836},{"edgeType":"contains","source":3397,"target":3400},{"edgeType":"calls","source":9673,"target":9647},{"edgeType":"calls","source":11860,"target":11617},{"edgeType":"contains","source":7691,"target":7694},{"edgeType":"imports","source":13217,"target":13703},{"edgeType":"calls","source":16147,"target":16128},{"edgeType":"contains","source":3971,"target":4631},{"edgeType":"contains","source":2734,"target":2810},{"edgeType":"contains","source":1,"target":11430},{"edgeType":"calls","source":2802,"target":2789},{"edgeType":"contains","source":14958,"target":14962},{"edgeType":"imports","source":12821,"target":612},{"edgeType":"contains","source":7691,"target":7697},{"edgeType":"contains","source":3397,"target":3399},{"edgeType":"contains","source":2734,"target":2811},{"edgeType":"calls","source":3861,"target":3787},{"edgeType":"contains","source":27,"target":52},{"edgeType":"calls","source":754,"target":743},{"edgeType":"contains","source":9476,"target":3098},{"edgeType":"contains","source":12759,"target":13369},{"edgeType":"contains","source":14958,"target":14963},{"edgeType":"contains","source":12316,"target":3847},{"edgeType":"contains","source":7691,"target":7696},{"edgeType":"contains","source":3397,"target":3398},{"edgeType":"calls","source":11459,"target":11466},{"edgeType":"calls","source":492,"target":503},{"edgeType":"contains","source":13025,"target":13033},{"edgeType":"imports","source":1375,"target":2179},{"edgeType":"calls","source":6594,"target":5838},{"edgeType":"imports","source":9090,"target":1907},{"edgeType":"contains","source":4959,"target":5159},{"edgeType":"contains","source":16857,"target":16859},{"edgeType":"imports","source":15349,"target":2375},{"edgeType":"contains","source":9325,"target":9343},{"edgeType":"contains","source":1,"target":300},{"edgeType":"contains","source":13297,"target":13057},{"edgeType":"calls","source":15705,"target":4572},{"edgeType":"imports","source":9794,"target":9679},{"edgeType":"calls","source":1285,"target":1288},{"edgeType":"contains","source":11108,"target":11152},{"edgeType":"contains","source":8001,"target":8105},{"edgeType":"contains","source":9986,"target":9995},{"edgeType":"contains","source":16857,"target":16858},{"edgeType":"calls","source":3027,"target":2255},{"edgeType":"contains","source":11834,"target":11900},{"edgeType":"contains","source":1,"target":4527},{"edgeType":"calls","source":10006,"target":10001},{"edgeType":"contains","source":11108,"target":11149},{"edgeType":"contains","source":15071,"target":15146},{"edgeType":"calls","source":6962,"target":774},{"edgeType":"contains","source":10971,"target":11168},{"edgeType":"contains","source":13025,"target":13031},{"edgeType":"contains","source":5097,"target":5107},{"edgeType":"calls","source":6974,"target":6745},{"edgeType":"imports","source":9472,"target":9089},{"edgeType":"contains","source":13350,"target":13526},{"edgeType":"contains","source":15335,"target":15418},{"edgeType":"calls","source":3740,"target":3403},{"edgeType":"contains","source":11108,"target":11150},{"edgeType":"calls","source":14834,"target":14663},{"edgeType":"contains","source":801,"target":2984},{"edgeType":"contains","source":12559,"target":12677},{"edgeType":"contains","source":10698,"target":605},{"edgeType":"contains","source":7078,"target":7124},{"edgeType":"contains","source":3436,"target":3745},{"edgeType":"contains","source":5097,"target":5106},{"edgeType":"calls","source":8288,"target":8293},{"edgeType":"contains","source":11451,"target":11087},{"edgeType":"calls","source":10471,"target":10383},{"edgeType":"contains","source":8001,"target":8107},{"edgeType":"imports","source":4071,"target":3170},{"edgeType":"contains","source":9854,"target":9857},{"edgeType":"contains","source":11108,"target":11147},{"edgeType":"contains","source":801,"target":2987},{"edgeType":"calls","source":15291,"target":15288},{"edgeType":"calls","source":8288,"target":8294},{"edgeType":"contains","source":8259,"target":8560},{"edgeType":"contains","source":6540,"target":6882},{"edgeType":"contains","source":15620,"target":2357},{"edgeType":"contains","source":9986,"target":9990},{"edgeType":"calls","source":15357,"target":15356},{"edgeType":"contains","source":11108,"target":11148},{"edgeType":"contains","source":10378,"target":10523},{"edgeType":"calls","source":2549,"target":156},{"edgeType":"calls","source":3134,"target":3162},{"edgeType":"contains","source":2653,"target":2657},{"edgeType":"imports","source":15620,"target":15109},{"edgeType":"contains","source":1,"target":10873},{"edgeType":"calls","source":425,"target":461},{"edgeType":"contains","source":11451,"target":11085},{"edgeType":"contains","source":9986,"target":9991},{"edgeType":"calls","source":11018,"target":8230},{"edgeType":"calls","source":1349,"target":1417},{"edgeType":"calls","source":11649,"target":7692},{"edgeType":"contains","source":15866,"target":15874},{"edgeType":"calls","source":3209,"target":2948},{"edgeType":"contains","source":2653,"target":2654},{"edgeType":"contains","source":13025,"target":13027},{"edgeType":"contains","source":10378,"target":10520},{"edgeType":"contains","source":8001,"target":8104},{"edgeType":"contains","source":12225,"target":1886},{"edgeType":"calls","source":14789,"target":13940},{"edgeType":"contains","source":11108,"target":11146},{"edgeType":"calls","source":9940,"target":9936},{"edgeType":"calls","source":4390,"target":4390},{"edgeType":"contains","source":1,"target":10875},{"edgeType":"calls","source":11195,"target":11197},{"edgeType":"contains","source":10378,"target":10521},{"edgeType":"contains","source":10698,"target":601},{"edgeType":"calls","source":8881,"target":8940},{"edgeType":"contains","source":8001,"target":8103},{"edgeType":"contains","source":10379,"target":10503},{"edgeType":"contains","source":801,"target":2991},{"edgeType":"contains","source":4375,"target":4244},{"edgeType":"contains","source":7078,"target":7129},{"edgeType":"contains","source":11108,"target":11159},{"edgeType":"calls","source":1906,"target":1056},{"edgeType":"contains","source":14073,"target":14363},{"edgeType":"contains","source":1,"target":307},{"edgeType":"calls","source":8567,"target":8105},{"edgeType":"contains","source":2653,"target":2661},{"edgeType":"contains","source":12225,"target":1901},{"edgeType":"calls","source":2342,"target":2341},{"edgeType":"contains","source":3768,"target":4034},{"edgeType":"contains","source":16322,"target":16522},{"edgeType":"calls","source":12673,"target":3438},{"edgeType":"contains","source":11833,"target":11939},{"edgeType":"calls","source":6966,"target":7000},{"edgeType":"contains","source":12821,"target":13022},{"edgeType":"contains","source":11108,"target":11160},{"edgeType":"contains","source":9524,"target":9527},{"edgeType":"contains","source":10971,"target":11176},{"edgeType":"contains","source":6540,"target":6897},{"edgeType":"contains","source":1,"target":10881},{"edgeType":"contains","source":15072,"target":15107},{"edgeType":"contains","source":10379,"target":10501},{"edgeType":"contains","source":10581,"target":10582},{"edgeType":"contains","source":801,"target":2993},{"edgeType":"contains","source":16263,"target":16240},{"edgeType":"contains","source":11833,"target":11938},{"edgeType":"contains","source":11108,"target":11157},{"edgeType":"contains","source":9524,"target":9526},{"edgeType":"contains","source":1,"target":309},{"edgeType":"contains","source":1,"target":4537},{"edgeType":"contains","source":4569,"target":4570},{"edgeType":"calls","source":3134,"target":3155},{"edgeType":"imports","source":15749,"target":15336},{"edgeType":"imports","source":16165,"target":2440},{"edgeType":"contains","source":1779,"target":156},{"edgeType":"contains","source":1,"target":10879},{"edgeType":"calls","source":4729,"target":2333},{"edgeType":"contains","source":11108,"target":11158},{"edgeType":"contains","source":13351,"target":13502},{"edgeType":"contains","source":11108,"target":11155},{"edgeType":"calls","source":16011,"target":16231},{"edgeType":"contains","source":1,"target":10883},{"edgeType":"contains","source":11834,"target":11905},{"edgeType":"contains","source":5168,"target":5034},{"edgeType":"contains","source":13351,"target":13501},{"edgeType":"calls","source":2354,"target":1964},{"edgeType":"contains","source":3314,"target":3315},{"edgeType":"calls","source":3534,"target":3438},{"edgeType":"imports","source":1621,"target":898},{"edgeType":"contains","source":8,"target":94},{"edgeType":"contains","source":12419,"target":4339},{"edgeType":"imports","source":15763,"target":4326},{"edgeType":"contains","source":801,"target":2994},{"edgeType":"contains","source":9854,"target":9863},{"edgeType":"calls","source":10733,"target":10731},{"edgeType":"contains","source":12821,"target":13018},{"edgeType":"contains","source":9986,"target":9999},{"edgeType":"contains","source":11834,"target":11904},{"edgeType":"contains","source":11108,"target":11156},{"edgeType":"contains","source":3516,"target":3394},{"edgeType":"calls","source":6872,"target":5690},{"edgeType":"contains","source":11770,"target":11772},{"edgeType":"calls","source":2942,"target":2760},{"edgeType":"contains","source":11108,"target":11153},{"edgeType":"contains","source":8,"target":97},{"edgeType":"contains","source":801,"target":2997},{"edgeType":"contains","source":9986,"target":9996},{"edgeType":"calls","source":3341,"target":961},{"edgeType":"contains","source":12761,"target":12763},{"edgeType":"contains","source":12821,"target":13017},{"edgeType":"imports","source":14033,"target":9334},{"edgeType":"imports","source":9090,"target":1900},{"edgeType":"contains","source":11834,"target":11903},{"edgeType":"contains","source":11833,"target":11934},{"edgeType":"contains","source":9854,"target":9860},{"edgeType":"contains","source":3436,"target":3759},{"edgeType":"imports","source":14871,"target":2384},{"edgeType":"contains","source":2653,"target":2663},{"edgeType":"calls","source":9147,"target":9158},{"edgeType":"contains","source":10379,"target":10498},{"edgeType":"contains","source":15866,"target":15867},{"edgeType":"calls","source":11133,"target":11013},{"edgeType":"contains","source":2784,"target":2830},{"edgeType":"calls","source":2942,"target":2761},{"edgeType":"imports","source":14114,"target":8937},{"edgeType":"contains","source":4547,"target":5256},{"edgeType":"contains","source":1,"target":313},{"edgeType":"contains","source":8,"target":96},{"edgeType":"contains","source":9986,"target":9997},{"edgeType":"contains","source":12761,"target":12762},{"edgeType":"contains","source":4959,"target":5168},{"edgeType":"contains","source":8001,"target":8111},{"edgeType":"contains","source":5228,"target":5285},{"edgeType":"contains","source":13351,"target":13498},{"edgeType":"calls","source":4389,"target":4413},{"edgeType":"contains","source":3247,"target":3248},{"edgeType":"contains","source":6682,"target":6696},{"edgeType":"contains","source":6540,"target":6870},{"edgeType":"contains","source":2449,"target":2617},{"edgeType":"contains","source":9325,"target":9327},{"edgeType":"contains","source":12225,"target":12447},{"edgeType":"contains","source":1768,"target":473},{"edgeType":"contains","source":3768,"target":4010},{"edgeType":"contains","source":6021,"target":6046},{"edgeType":"contains","source":11108,"target":11134},{"edgeType":"contains","source":4375,"target":2106},{"edgeType":"contains","source":15071,"target":15127},{"edgeType":"contains","source":15072,"target":15096},{"edgeType":"calls","source":625,"target":625},{"edgeType":"contains","source":6682,"target":6697},{"edgeType":"contains","source":6540,"target":6871},{"edgeType":"contains","source":7407,"target":7477},{"edgeType":"contains","source":12225,"target":12446},{"edgeType":"contains","source":3768,"target":4009},{"edgeType":"calls","source":3076,"target":2866},{"edgeType":"contains","source":4230,"target":4485},{"edgeType":"imports","source":2434,"target":1044},{"edgeType":"contains","source":10378,"target":10511},{"edgeType":"contains","source":11108,"target":11135},{"edgeType":"calls","source":5411,"target":2358},{"edgeType":"contains","source":3709,"target":3724},{"edgeType":"imports","source":15762,"target":4352},{"edgeType":"calls","source":1091,"target":976},{"edgeType":"contains","source":5227,"target":5289},{"edgeType":"calls","source":16011,"target":16211},{"edgeType":"imports","source":14871,"target":15064},{"edgeType":"contains","source":4547,"target":5228},{"edgeType":"contains","source":12225,"target":12445},{"edgeType":"calls","source":3565,"target":389},{"edgeType":"contains","source":2449,"target":2615},{"edgeType":"contains","source":15740,"target":15531},{"edgeType":"contains","source":6021,"target":6048},{"edgeType":"contains","source":9984,"target":10037},{"edgeType":"contains","source":142,"target":143},{"edgeType":"imports","source":14871,"target":2380},{"edgeType":"contains","source":11108,"target":11132},{"edgeType":"calls","source":12561,"target":540},{"edgeType":"contains","source":6137,"target":6681},{"edgeType":"calls","source":3232,"target":2255},{"edgeType":"contains","source":10971,"target":11151},{"edgeType":"calls","source":8482,"target":2261},{"edgeType":"contains","source":10832,"target":11232},{"edgeType":"contains","source":5162,"target":5189},{"edgeType":"contains","source":14073,"target":14357},{"edgeType":"contains","source":6540,"target":6873},{"edgeType":"contains","source":12225,"target":12444},{"edgeType":"calls","source":7037,"target":6890},{"edgeType":"contains","source":4547,"target":5227},{"edgeType":"calls","source":14415,"target":2260},{"edgeType":"contains","source":9325,"target":9328},{"edgeType":"contains","source":13820,"target":13737},{"edgeType":"imports","source":15620,"target":15099},{"edgeType":"calls","source":10732,"target":10731},{"edgeType":"contains","source":3768,"target":4007},{"edgeType":"calls","source":15357,"target":15347},{"edgeType":"calls","source":10878,"target":10433},{"edgeType":"calls","source":12929,"target":3931},{"edgeType":"imports","source":15251,"target":1169},{"edgeType":"contains","source":5227,"target":5287},{"edgeType":"calls","source":6966,"target":6978},{"edgeType":"contains","source":12225,"target":12443},{"edgeType":"contains","source":11439,"target":11440},{"edgeType":"contains","source":5163,"target":5165},{"edgeType":"contains","source":6682,"target":6692},{"edgeType":"contains","source":9984,"target":10035},{"edgeType":"contains","source":8259,"target":8543},{"edgeType":"contains","source":15205,"target":15206},{"edgeType":"contains","source":3768,"target":4014},{"edgeType":"imports","source":14382,"target":2734},{"edgeType":"calls","source":7303,"target":7102},{"edgeType":"contains","source":15071,"target":15131},{"edgeType":"contains","source":5624,"target":5665},{"edgeType":"contains","source":7673,"target":7683},{"edgeType":"calls","source":6816,"target":1058},{"edgeType":"imports","source":9090,"target":1894},{"edgeType":"contains","source":11108,"target":11130},{"edgeType":"contains","source":998,"target":1091},{"edgeType":"calls","source":8482,"target":2263},{"edgeType":"contains","source":12225,"target":12442},{"edgeType":"imports","source":14288,"target":14103},{"edgeType":"contains","source":1,"target":10857},{"edgeType":"contains","source":6682,"target":6693},{"edgeType":"imports","source":7963,"target":893},{"edgeType":"contains","source":15205,"target":15207},{"edgeType":"contains","source":142,"target":144},{"edgeType":"contains","source":2205,"target":1730},{"edgeType":"contains","source":10379,"target":10476},{"edgeType":"contains","source":13350,"target":13506},{"edgeType":"contains","source":5624,"target":5666},{"edgeType":"contains","source":5493,"target":5499},{"edgeType":"calls","source":7768,"target":7486},{"edgeType":"calls","source":2407,"target":2461},{"edgeType":"contains","source":11108,"target":11131},{"edgeType":"calls","source":2673,"target":2671},{"edgeType":"contains","source":6021,"target":6044},{"edgeType":"contains","source":12225,"target":12441},{"edgeType":"contains","source":6682,"target":6694},{"edgeType":"contains","source":3247,"target":3250},{"edgeType":"contains","source":6540,"target":6868},{"edgeType":"calls","source":1449,"target":448},{"edgeType":"contains","source":9984,"target":10033},{"edgeType":"calls","source":7037,"target":6893},{"edgeType":"contains","source":15205,"target":15208},{"edgeType":"imports","source":10632,"target":601},{"edgeType":"contains","source":5624,"target":5667},{"edgeType":"imports","source":9472,"target":2734},{"edgeType":"contains","source":11108,"target":11128},{"edgeType":"calls","source":14415,"target":2265},{"edgeType":"contains","source":6682,"target":6695},{"edgeType":"imports","source":8076,"target":7958},{"edgeType":"contains","source":6540,"target":6869},{"edgeType":"calls","source":6714,"target":6337},{"edgeType":"contains","source":9984,"target":10034},{"edgeType":"contains","source":9985,"target":10003},{"edgeType":"contains","source":12225,"target":12440},{"edgeType":"imports","source":15762,"target":2236},{"edgeType":"contains","source":1,"target":4517},{"edgeType":"calls","source":10799,"target":10772},{"edgeType":"calls","source":15502,"target":15076},{"edgeType":"calls","source":6321,"target":5836},{"edgeType":"calls","source":5003,"target":2316},{"edgeType":"contains","source":11108,"target":11129},{"edgeType":"contains","source":5097,"target":5101},{"edgeType":"contains","source":7079,"target":7082},{"edgeType":"contains","source":9980,"target":10171},{"edgeType":"contains","source":15601,"target":15602},{"edgeType":"contains","source":11108,"target":11143},{"edgeType":"calls","source":16880,"target":16763},{"edgeType":"contains","source":3638,"target":3820},{"edgeType":"contains","source":1331,"target":1344},{"edgeType":"calls","source":6254,"target":5815},{"edgeType":"contains","source":6540,"target":6878},{"edgeType":"contains","source":4568,"target":4587},{"edgeType":"contains","source":8402,"target":8351},{"edgeType":"calls","source":11856,"target":11835},{"edgeType":"imports","source":15379,"target":9876},{"edgeType":"contains","source":5162,"target":5199},{"edgeType":"contains","source":5097,"target":5100},{"edgeType":"imports","source":4630,"target":4841},{"edgeType":"calls","source":6714,"target":6339},{"edgeType":"calls","source":4396,"target":2104},{"edgeType":"contains","source":10971,"target":11163},{"edgeType":"contains","source":3638,"target":3819},{"edgeType":"contains","source":11108,"target":11144},{"edgeType":"contains","source":3436,"target":3739},{"edgeType":"calls","source":8619,"target":8591},{"edgeType":"contains","source":10975,"target":11038},{"edgeType":"contains","source":14813,"target":14662},{"edgeType":"contains","source":6540,"target":6879},{"edgeType":"imports","source":7708,"target":2440},{"edgeType":"contains","source":12150,"target":12666},{"edgeType":"contains","source":15740,"target":15523},{"edgeType":"contains","source":1063,"target":1197},{"edgeType":"imports","source":10832,"target":730},{"edgeType":"imports","source":14871,"target":2371},{"edgeType":"contains","source":11108,"target":11141},{"edgeType":"contains","source":13579,"target":12761},{"edgeType":"calls","source":6962,"target":766},{"edgeType":"contains","source":11637,"target":11654},{"edgeType":"contains","source":8,"target":77},{"edgeType":"calls","source":5316,"target":5294},{"edgeType":"contains","source":15601,"target":15605},{"edgeType":"contains","source":5097,"target":5098},{"edgeType":"calls","source":3671,"target":3438},{"edgeType":"contains","source":11108,"target":11142},{"edgeType":"calls","source":2389,"target":898},{"edgeType":"contains","source":11637,"target":11655},{"edgeType":"contains","source":3436,"target":3737},{"edgeType":"contains","source":8,"target":76},{"edgeType":"contains","source":5890,"target":5891},{"edgeType":"contains","source":15246,"target":1241},{"edgeType":"calls","source":3027,"target":2261},{"edgeType":"contains","source":3638,"target":3824},{"edgeType":"calls","source":3137,"target":3076},{"edgeType":"calls","source":10148,"target":9821},{"edgeType":"contains","source":801,"target":2979},{"edgeType":"contains","source":11637,"target":11652},{"edgeType":"contains","source":5097,"target":5105},{"edgeType":"calls","source":11860,"target":11715},{"edgeType":"contains","source":11108,"target":11138},{"edgeType":"contains","source":14035,"target":7079},{"edgeType":"contains","source":1,"target":10866},{"edgeType":"contains","source":6540,"target":6875},{"edgeType":"contains","source":15601,"target":15607},{"edgeType":"contains","source":3638,"target":3823},{"edgeType":"calls","source":4389,"target":4431},{"edgeType":"calls","source":6966,"target":6987},{"edgeType":"contains","source":11108,"target":11140},{"edgeType":"calls","source":10402,"target":10402},{"edgeType":"calls","source":6321,"target":5842},{"edgeType":"contains","source":6109,"target":7552},{"edgeType":"contains","source":9980,"target":10165},{"edgeType":"contains","source":3638,"target":3822},{"edgeType":"imports","source":9794,"target":3315},{"edgeType":"contains","source":7079,"target":7080},{"edgeType":"imports","source":10436,"target":2440},{"edgeType":"calls","source":2408,"target":2418},{"edgeType":"contains","source":4061,"target":3394},{"edgeType":"contains","source":6109,"target":7553},{"edgeType":"calls","source":12425,"target":540},{"edgeType":"calls","source":15661,"target":5926},{"edgeType":"contains","source":11108,"target":11136},{"edgeType":"imports","source":7688,"target":7293},{"edgeType":"contains","source":12232,"target":12233},{"edgeType":"imports","source":9754,"target":2440},{"edgeType":"contains","source":12964,"target":4339},{"edgeType":"contains","source":1,"target":10868},{"edgeType":"contains","source":6540,"target":6876},{"edgeType":"contains","source":8001,"target":8094},{"edgeType":"contains","source":7079,"target":7081},{"edgeType":"contains","source":15740,"target":15528},{"edgeType":"contains","source":15601,"target":15609},{"edgeType":"contains","source":3436,"target":3741},{"edgeType":"contains","source":6109,"target":7554},{"edgeType":"calls","source":2225,"target":1750},{"edgeType":"contains","source":10379,"target":10482},{"edgeType":"contains","source":8259,"target":8553},{"edgeType":"contains","source":11108,"target":11137},{"edgeType":"contains","source":11108,"target":11118},{"edgeType":"contains","source":11044,"target":10988},{"edgeType":"contains","source":10379,"target":10462},{"edgeType":"contains","source":3436,"target":3715},{"edgeType":"contains","source":6814,"target":6816},{"edgeType":"contains","source":8796,"target":8797},{"edgeType":"contains","source":8994,"target":9001},{"edgeType":"contains","source":2619,"target":1558},{"edgeType":"calls","source":9080,"target":9075},{"edgeType":"contains","source":11431,"target":11675},{"edgeType":"imports","source":12378,"target":3603},{"edgeType":"contains","source":16856,"target":16857},{"edgeType":"contains","source":595,"target":879},{"edgeType":"contains","source":5425,"target":5478},{"edgeType":"calls","source":14629,"target":14639},{"edgeType":"calls","source":13770,"target":13785},{"edgeType":"contains","source":5757,"target":5758},{"edgeType":"imports","source":2434,"target":1094},{"edgeType":"contains","source":11762,"target":11984},{"edgeType":"imports","source":6109,"target":1331},{"edgeType":"contains","source":11762,"target":11986},{"edgeType":"contains","source":10379,"target":10463},{"edgeType":"contains","source":11108,"target":11119},{"edgeType":"contains","source":5659,"target":6682},{"edgeType":"contains","source":5162,"target":5174},{"edgeType":"calls","source":9807,"target":9791},{"edgeType":"contains","source":11431,"target":11676},{"edgeType":"calls","source":15224,"target":15223},{"edgeType":"contains","source":595,"target":878},{"edgeType":"contains","source":5293,"target":5341},{"edgeType":"calls","source":12449,"target":12455},{"edgeType":"calls","source":14629,"target":14638},{"edgeType":"contains","source":5425,"target":5477},{"edgeType":"contains","source":14015,"target":14023},{"edgeType":"contains","source":5757,"target":5759},{"edgeType":"contains","source":1,"target":10836},{"edgeType":"contains","source":11762,"target":11985},{"edgeType":"contains","source":11834,"target":11865},{"edgeType":"contains","source":11108,"target":11116},{"edgeType":"contains","source":8994,"target":9003},{"edgeType":"contains","source":998,"target":1073},{"edgeType":"contains","source":12706,"target":12316},{"edgeType":"contains","source":5425,"target":5476},{"edgeType":"calls","source":15025,"target":2361},{"edgeType":"contains","source":12225,"target":12429},{"edgeType":"contains","source":11431,"target":11673},{"edgeType":"contains","source":14015,"target":14024},{"edgeType":"contains","source":9980,"target":10145},{"edgeType":"calls","source":6666,"target":5690},{"edgeType":"imports","source":4242,"target":4244},{"edgeType":"contains","source":6109,"target":7533},{"edgeType":"contains","source":3768,"target":3990},{"edgeType":"contains","source":14609,"target":14637},{"edgeType":"contains","source":6682,"target":6683},{"edgeType":"calls","source":2275,"target":2277},{"edgeType":"calls","source":14629,"target":14636},{"edgeType":"contains","source":595,"target":880},{"edgeType":"contains","source":14015,"target":14025},{"edgeType":"contains","source":9460,"target":9354},{"edgeType":"contains","source":11431,"target":11674},{"edgeType":"contains","source":3841,"target":3842},{"edgeType":"contains","source":11762,"target":11983},{"edgeType":"contains","source":9980,"target":10146},{"edgeType":"calls","source":10005,"target":10001},{"edgeType":"contains","source":13364,"target":13057},{"edgeType":"contains","source":8994,"target":8997},{"edgeType":"contains","source":11108,"target":11114},{"edgeType":"contains","source":11431,"target":11671},{"edgeType":"contains","source":8259,"target":8527},{"edgeType":"contains","source":6540,"target":6849},{"edgeType":"contains","source":3971,"target":4047},{"edgeType":"contains","source":11762,"target":11980},{"edgeType":"imports","source":2621,"target":1635},{"edgeType":"contains","source":9838,"target":10317},{"edgeType":"contains","source":2652,"target":2655},{"edgeType":"contains","source":11108,"target":11115},{"edgeType":"contains","source":12957,"target":12989},{"edgeType":"calls","source":2870,"target":2856},{"edgeType":"calls","source":1027,"target":793},{"edgeType":"calls","source":286,"target":509},{"edgeType":"contains","source":11431,"target":11672},{"edgeType":"contains","source":4114,"target":3841},{"edgeType":"contains","source":15071,"target":15117},{"edgeType":"imports","source":2434,"target":1088},{"edgeType":"calls","source":4148,"target":3403},{"edgeType":"contains","source":1,"target":273},{"edgeType":"contains","source":12759,"target":12783},{"edgeType":"contains","source":11431,"target":11669},{"edgeType":"contains","source":6021,"target":6028},{"edgeType":"calls","source":10649,"target":609},{"edgeType":"calls","source":12449,"target":12456},{"edgeType":"contains","source":9980,"target":10141},{"edgeType":"contains","source":9838,"target":10315},{"edgeType":"contains","source":15740,"target":15520},{"edgeType":"contains","source":10833,"target":611},{"edgeType":"contains","source":3436,"target":3716},{"edgeType":"contains","source":11431,"target":11670},{"edgeType":"calls","source":5186,"target":5050},{"edgeType":"calls","source":1611,"target":1717},{"edgeType":"calls","source":3763,"target":540},{"edgeType":"imports","source":16267,"target":16227},{"edgeType":"contains","source":5425,"target":5479},{"edgeType":"calls","source":425,"target":430},{"edgeType":"imports","source":15484,"target":15132},{"edgeType":"contains","source":3709,"target":3710},{"edgeType":"contains","source":10832,"target":11226},{"edgeType":"contains","source":3971,"target":4051},{"edgeType":"contains","source":6682,"target":6688},{"edgeType":"contains","source":12225,"target":12439},{"edgeType":"imports","source":14350,"target":14342},{"edgeType":"contains","source":3709,"target":3717},{"edgeType":"calls","source":425,"target":425},{"edgeType":"contains","source":9984,"target":10031},{"edgeType":"calls","source":12449,"target":12462},{"edgeType":"calls","source":4587,"target":4591},{"edgeType":"calls","source":4010,"target":3450},{"edgeType":"contains","source":11108,"target":11126},{"edgeType":"contains","source":11439,"target":11435},{"edgeType":"calls","source":14629,"target":14647},{"edgeType":"calls","source":2254,"target":807},{"edgeType":"contains","source":5509,"target":4998},{"edgeType":"calls","source":2756,"target":2158},{"edgeType":"contains","source":10379,"target":10471},{"edgeType":"contains","source":6682,"target":6689},{"edgeType":"contains","source":9984,"target":10032},{"edgeType":"contains","source":12225,"target":12438},{"edgeType":"contains","source":2449,"target":2610},{"edgeType":"imports","source":15810,"target":15590},{"edgeType":"contains","source":15601,"target":15586},{"edgeType":"contains","source":3971,"target":4050},{"edgeType":"contains","source":11108,"target":11127},{"edgeType":"calls","source":14629,"target":14646},{"edgeType":"contains","source":7673,"target":7678},{"edgeType":"calls","source":9873,"target":9871},{"edgeType":"calls","source":3464,"target":3462},{"edgeType":"contains","source":11637,"target":11638},{"edgeType":"contains","source":6682,"target":6690},{"edgeType":"contains","source":14609,"target":14628},{"edgeType":"contains","source":4568,"target":4569},{"edgeType":"calls","source":10082,"target":1278},{"edgeType":"calls","source":1278,"target":1467},{"edgeType":"contains","source":12225,"target":12437},{"edgeType":"contains","source":16850,"target":4352},{"edgeType":"contains","source":3971,"target":4049},{"edgeType":"contains","source":5493,"target":5496},{"edgeType":"contains","source":9460,"target":9363},{"edgeType":"calls","source":11321,"target":3033},{"edgeType":"contains","source":16063,"target":16065},{"edgeType":"contains","source":6021,"target":6041},{"edgeType":"calls","source":8619,"target":8576},{"edgeType":"contains","source":6682,"target":6691},{"edgeType":"contains","source":15072,"target":15075},{"edgeType":"contains","source":12759,"target":4338},{"edgeType":"contains","source":10379,"target":10469},{"edgeType":"calls","source":358,"target":389},{"edgeType":"contains","source":5624,"target":5664},{"edgeType":"contains","source":5227,"target":5279},{"edgeType":"imports","source":1621,"target":934},{"edgeType":"contains","source":11108,"target":11125},{"edgeType":"contains","source":14015,"target":14017},{"edgeType":"imports","source":1779,"target":264},{"edgeType":"contains","source":10379,"target":10466},{"edgeType":"contains","source":10378,"target":10497},{"edgeType":"contains","source":11108,"target":11122},{"edgeType":"contains","source":2784,"target":2798},{"edgeType":"contains","source":7078,"target":7092},{"edgeType":"calls","source":1614,"target":1615},{"edgeType":"calls","source":1564,"target":1051},{"edgeType":"imports","source":13963,"target":965},{"edgeType":"calls","source":3992,"target":4004},{"edgeType":"contains","source":3768,"target":4006},{"edgeType":"contains","source":16063,"target":16067},{"edgeType":"contains","source":7673,"target":7675},{"edgeType":"contains","source":13363,"target":13096},{"edgeType":"contains","source":11108,"target":11123},{"edgeType":"imports","source":14871,"target":15098},{"edgeType":"contains","source":8259,"target":8534},{"edgeType":"calls","source":15722,"target":12473},{"edgeType":"contains","source":6682,"target":6685},{"edgeType":"calls","source":1909,"target":925},{"edgeType":"contains","source":3768,"target":4005},{"edgeType":"calls","source":12398,"target":3478},{"edgeType":"calls","source":2010,"target":2022},{"edgeType":"contains","source":998,"target":1082},{"edgeType":"contains","source":9984,"target":10028},{"edgeType":"contains","source":7673,"target":7674},{"edgeType":"contains","source":11762,"target":11987},{"edgeType":"contains","source":3971,"target":4053},{"edgeType":"contains","source":11108,"target":11120},{"edgeType":"calls","source":15589,"target":6027},{"edgeType":"contains","source":6682,"target":6686},{"edgeType":"contains","source":12225,"target":12433},{"edgeType":"contains","source":1,"target":10852},{"edgeType":"contains","source":14863,"target":15214},{"edgeType":"contains","source":2449,"target":2611},{"edgeType":"contains","source":9985,"target":9994},{"edgeType":"contains","source":11431,"target":11677},{"edgeType":"calls","source":14236,"target":14148},{"edgeType":"imports","source":15749,"target":15366},{"edgeType":"calls","source":2408,"target":2369},{"edgeType":"contains","source":7673,"target":7677},{"edgeType":"calls","source":12449,"target":12464},{"edgeType":"contains","source":3436,"target":3726},{"edgeType":"contains","source":11762,"target":11988},{"edgeType":"contains","source":1,"target":280},{"edgeType":"calls","source":2935,"target":2945},{"edgeType":"calls","source":15711,"target":2246},{"edgeType":"contains","source":6021,"target":6037},{"edgeType":"contains","source":3971,"target":4052},{"edgeType":"imports","source":1621,"target":929},{"edgeType":"contains","source":11108,"target":11121},{"edgeType":"contains","source":12617,"target":12964},{"edgeType":"imports","source":608,"target":623},{"edgeType":"calls","source":1564,"target":1052},{"edgeType":"contains","source":2449,"target":2612},{"edgeType":"contains","source":12225,"target":12432},{"edgeType":"contains","source":7673,"target":7676},{"edgeType":"calls","source":14696,"target":14685},{"edgeType":"contains","source":4632,"target":4676},{"edgeType":"contains","source":3971,"target":4026},{"edgeType":"contains","source":11451,"target":11039},{"edgeType":"contains","source":11497,"target":11727},{"edgeType":"calls","source":14628,"target":14654},{"edgeType":"contains","source":15402,"target":15404},{"edgeType":"contains","source":273,"target":275},{"edgeType":"calls","source":5573,"target":1533},{"edgeType":"contains","source":6285,"target":6286},{"edgeType":"contains","source":8259,"target":8515},{"edgeType":"contains","source":15335,"target":15366},{"edgeType":"calls","source":3160,"target":2342},{"edgeType":"contains","source":3436,"target":3699},{"edgeType":"calls","source":4852,"target":4857},{"edgeType":"imports","source":16821,"target":15954},{"edgeType":"contains","source":5108,"target":4718},{"edgeType":"contains","source":595,"target":862},{"edgeType":"calls","source":975,"target":311},{"edgeType":"contains","source":11497,"target":11728},{"edgeType":"contains","source":11306,"target":11307},{"edgeType":"contains","source":4632,"target":4675},{"edgeType":"contains","source":3768,"target":3976},{"edgeType":"contains","source":15336,"target":15337},{"edgeType":"contains","source":273,"target":274},{"edgeType":"contains","source":4959,"target":5108},{"edgeType":"contains","source":805,"target":2808},{"edgeType":"contains","source":3642,"target":3654},{"edgeType":"contains","source":3436,"target":3698},{"edgeType":"calls","source":4236,"target":698},{"edgeType":"calls","source":8223,"target":8142},{"edgeType":"contains","source":12957,"target":12976},{"edgeType":"imports","source":3253,"target":3170},{"edgeType":"calls","source":11465,"target":2772},{"edgeType":"calls","source":8881,"target":8887},{"edgeType":"contains","source":7458,"target":7978},{"edgeType":"contains","source":273,"target":277},{"edgeType":"contains","source":9980,"target":10128},{"edgeType":"contains","source":3642,"target":3653},{"edgeType":"contains","source":3768,"target":3975},{"edgeType":"contains","source":8267,"target":8269},{"edgeType":"calls","source":10516,"target":2597},{"edgeType":"contains","source":11497,"target":11726},{"edgeType":"contains","source":12225,"target":12411},{"edgeType":"contains","source":4633,"target":4642},{"edgeType":"imports","source":9472,"target":9107},{"edgeType":"contains","source":1,"target":251},{"edgeType":"imports","source":13217,"target":13520},{"edgeType":"contains","source":13683,"target":13723},{"edgeType":"contains","source":273,"target":276},{"edgeType":"contains","source":3768,"target":3974},{"edgeType":"imports","source":15363,"target":4072},{"edgeType":"calls","source":14435,"target":14291},{"edgeType":"calls","source":14794,"target":3162},{"edgeType":"calls","source":624,"target":624},{"edgeType":"contains","source":5227,"target":5262},{"edgeType":"contains","source":11497,"target":11723},{"edgeType":"contains","source":3642,"target":3659},{"edgeType":"contains","source":6540,"target":6833},{"edgeType":"calls","source":8881,"target":8889},{"edgeType":"contains","source":6292,"target":6064},{"edgeType":"contains","source":11833,"target":11878},{"edgeType":"calls","source":6729,"target":5836},{"edgeType":"calls","source":7887,"target":7991},{"edgeType":"contains","source":11431,"target":11656},{"edgeType":"contains","source":11497,"target":11724},{"edgeType":"imports","source":9472,"target":9113},{"edgeType":"contains","source":1,"target":10824},{"edgeType":"contains","source":273,"target":278},{"edgeType":"contains","source":1,"target":253},{"edgeType":"contains","source":3510,"target":3522},{"edgeType":"contains","source":10379,"target":10443},{"edgeType":"calls","source":6638,"target":6544},{"edgeType":"calls","source":4729,"target":2323},{"edgeType":"contains","source":11497,"target":11721},{"edgeType":"contains","source":7458,"target":7974},{"edgeType":"contains","source":10379,"target":10439},{"edgeType":"contains","source":9984,"target":10000},{"edgeType":"contains","source":1,"target":257},{"edgeType":"imports","source":1779,"target":236},{"edgeType":"calls","source":9343,"target":9368},{"edgeType":"contains","source":3642,"target":3657},{"edgeType":"calls","source":11533,"target":11239},{"edgeType":"calls","source":6815,"target":1058},{"edgeType":"calls","source":10111,"target":358},{"edgeType":"contains","source":11497,"target":11720},{"edgeType":"calls","source":8089,"target":8073},{"edgeType":"contains","source":805,"target":2815},{"edgeType":"contains","source":14073,"target":14328},{"edgeType":"contains","source":11497,"target":11722},{"edgeType":"contains","source":11637,"target":11610},{"edgeType":"contains","source":12378,"target":3436},{"edgeType":"contains","source":3768,"target":3978},{"edgeType":"contains","source":8001,"target":8053},{"edgeType":"imports","source":14183,"target":8937},{"edgeType":"contains","source":3971,"target":4027},{"edgeType":"contains","source":9838,"target":10299},{"edgeType":"contains","source":15071,"target":15101},{"edgeType":"imports","source":14611,"target":14696},{"edgeType":"contains","source":805,"target":2814},{"edgeType":"contains","source":5227,"target":5258},{"edgeType":"contains","source":1,"target":10829},{"edgeType":"calls","source":8506,"target":1491},{"edgeType":"contains","source":5227,"target":5266},{"edgeType":"contains","source":5871,"target":6443},{"edgeType":"contains","source":12225,"target":1852},{"edgeType":"calls","source":3669,"target":3468},{"edgeType":"contains","source":5030,"target":5031},{"edgeType":"contains","source":11108,"target":11110},{"edgeType":"contains","source":11431,"target":11667},{"edgeType":"calls","source":9144,"target":9196},{"edgeType":"contains","source":11497,"target":11735},{"edgeType":"calls","source":14629,"target":14631},{"edgeType":"calls","source":6041,"target":6043},{"edgeType":"contains","source":7458,"target":7984},{"edgeType":"calls","source":7887,"target":7995},{"edgeType":"imports","source":12151,"target":4273},{"edgeType":"contains","source":1991,"target":1992},{"edgeType":"calls","source":11925,"target":11777},{"edgeType":"contains","source":595,"target":871},{"edgeType":"calls","source":3002,"target":3004},{"edgeType":"contains","source":8259,"target":8523},{"edgeType":"contains","source":5162,"target":5166},{"edgeType":"calls","source":2388,"target":898},{"edgeType":"contains","source":9985,"target":9984},{"edgeType":"contains","source":5228,"target":5234},{"edgeType":"contains","source":5227,"target":5265},{"edgeType":"calls","source":10468,"target":10433},{"edgeType":"contains","source":11431,"target":11668},{"edgeType":"calls","source":14629,"target":14630},{"edgeType":"contains","source":11497,"target":11736},{"edgeType":"contains","source":5671,"target":6302},{"edgeType":"contains","source":5425,"target":5469},{"edgeType":"contains","source":9654,"target":9672},{"edgeType":"calls","source":11458,"target":11457},{"edgeType":"contains","source":805,"target":2816},{"edgeType":"contains","source":11306,"target":11312},{"edgeType":"contains","source":1,"target":10831},{"edgeType":"contains","source":5671,"target":6303},{"edgeType":"calls","source":10657,"target":349},{"edgeType":"contains","source":5227,"target":5264},{"edgeType":"contains","source":5381,"target":4718},{"edgeType":"contains","source":11497,"target":11733},{"edgeType":"calls","source":6729,"target":5842},{"edgeType":"contains","source":8994,"target":8995},{"edgeType":"contains","source":11431,"target":11665},{"edgeType":"contains","source":7458,"target":7986},{"edgeType":"contains","source":9654,"target":9675},{"edgeType":"contains","source":1,"target":261},{"edgeType":"calls","source":2672,"target":2662},{"edgeType":"calls","source":11526,"target":11460},{"edgeType":"imports","source":9472,"target":9097},{"edgeType":"calls","source":15579,"target":2097},{"edgeType":"contains","source":801,"target":2943},{"edgeType":"calls","source":1175,"target":448},{"edgeType":"calls","source":11925,"target":11775},{"edgeType":"contains","source":595,"target":873},{"edgeType":"contains","source":15071,"target":15088},{"edgeType":"calls","source":15554,"target":15556},{"edgeType":"contains","source":7078,"target":7083},{"edgeType":"contains","source":5671,"target":6304},{"edgeType":"contains","source":5228,"target":5232},{"edgeType":"contains","source":5227,"target":5263},{"edgeType":"contains","source":3642,"target":3660},{"edgeType":"contains","source":11497,"target":11734},{"edgeType":"contains","source":11834,"target":11856},{"edgeType":"contains","source":11431,"target":11666},{"edgeType":"contains","source":3768,"target":3982},{"edgeType":"contains","source":14543,"target":14545},{"edgeType":"calls","source":15964,"target":15531},{"edgeType":"calls","source":5113,"target":3097},{"edgeType":"imports","source":608,"target":610},{"edgeType":"contains","source":595,"target":872},{"edgeType":"contains","source":4633,"target":4650},{"edgeType":"contains","source":11306,"target":11310},{"edgeType":"contains","source":5227,"target":5270},{"edgeType":"calls","source":12449,"target":12450},{"edgeType":"calls","source":14164,"target":14252},{"edgeType":"contains","source":13683,"target":13730},{"edgeType":"contains","source":11431,"target":11663},{"edgeType":"contains","source":3298,"target":3760},{"edgeType":"contains","source":11497,"target":11731},{"edgeType":"contains","source":5425,"target":5474},{"edgeType":"contains","source":595,"target":875},{"edgeType":"contains","source":10247,"target":10314},{"edgeType":"contains","source":6292,"target":6073},{"edgeType":"calls","source":10043,"target":358},{"edgeType":"contains","source":11306,"target":11311},{"edgeType":"contains","source":5227,"target":5269},{"edgeType":"contains","source":11431,"target":11664},{"edgeType":"calls","source":4401,"target":4026},{"edgeType":"contains","source":11497,"target":11732},{"edgeType":"contains","source":5425,"target":5473},{"edgeType":"imports","source":12378,"target":3575},{"edgeType":"imports","source":14382,"target":2758},{"edgeType":"contains","source":10379,"target":10451},{"edgeType":"contains","source":595,"target":874},{"edgeType":"calls","source":10147,"target":9821},{"edgeType":"imports","source":3253,"target":3174},{"edgeType":"contains","source":9980,"target":10132},{"edgeType":"contains","source":11306,"target":11308},{"edgeType":"calls","source":1751,"target":1615},{"edgeType":"imports","source":2616,"target":1780},{"edgeType":"imports","source":2621,"target":1625},{"edgeType":"contains","source":9135,"target":8848},{"edgeType":"contains","source":5227,"target":5268},{"edgeType":"contains","source":14073,"target":14319},{"edgeType":"contains","source":11497,"target":11729},{"edgeType":"contains","source":5425,"target":5472},{"edgeType":"calls","source":358,"target":402},{"edgeType":"calls","source":14629,"target":14633},{"edgeType":"contains","source":10379,"target":10448},{"edgeType":"contains","source":595,"target":877},{"edgeType":"contains","source":10247,"target":10312},{"edgeType":"contains","source":1991,"target":1994},{"edgeType":"calls","source":16413,"target":16407},{"edgeType":"contains","source":5030,"target":5032},{"edgeType":"contains","source":9192,"target":9194},{"edgeType":"contains","source":5228,"target":5236},{"edgeType":"contains","source":5227,"target":5267},{"edgeType":"calls","source":14628,"target":14663},{"edgeType":"contains","source":11497,"target":11730},{"edgeType":"contains","source":5425,"target":5471},{"edgeType":"contains","source":3488,"target":4210},{"edgeType":"contains","source":15740,"target":15495},{"edgeType":"contains","source":4633,"target":4654},{"edgeType":"calls","source":10073,"target":10102},{"edgeType":"contains","source":3488,"target":4184},{"edgeType":"contains","source":10379,"target":10429},{"edgeType":"contains","source":10971,"target":11104},{"edgeType":"contains","source":12821,"target":12949},{"edgeType":"imports","source":2434,"target":1127},{"edgeType":"contains","source":11834,"target":11835},{"edgeType":"contains","source":998,"target":1037},{"edgeType":"calls","source":1261,"target":2098},{"edgeType":"contains","source":15071,"target":15079},{"edgeType":"contains","source":10971,"target":11105},{"edgeType":"calls","source":626,"target":642},{"edgeType":"calls","source":1559,"target":1316},{"edgeType":"imports","source":4630,"target":4931},{"edgeType":"calls","source":6853,"target":6333},{"edgeType":"imports","source":12271,"target":612},{"edgeType":"contains","source":13221,"target":13231},{"edgeType":"contains","source":6285,"target":6271},{"edgeType":"contains","source":801,"target":805},{"edgeType":"calls","source":4082,"target":3438},{"edgeType":"contains","source":3436,"target":3680},{"edgeType":"contains","source":5293,"target":5307},{"edgeType":"calls","source":10251,"target":358},{"edgeType":"contains","source":11431,"target":11640},{"edgeType":"contains","source":4632,"target":4657},{"edgeType":"contains","source":15335,"target":15352},{"edgeType":"contains","source":13221,"target":13230},{"edgeType":"contains","source":3769,"target":3926},{"edgeType":"calls","source":5251,"target":5252},{"edgeType":"imports","source":3384,"target":3392},{"edgeType":"contains","source":5227,"target":5238},{"edgeType":"contains","source":998,"target":1039},{"edgeType":"contains","source":13155,"target":13162},{"edgeType":"calls","source":10074,"target":10072},{"edgeType":"contains","source":6626,"target":6271},{"edgeType":"calls","source":6850,"target":6428},{"edgeType":"contains","source":595,"target":847},{"edgeType":"contains","source":11431,"target":11641},{"edgeType":"contains","source":13922,"target":14761},{"edgeType":"calls","source":14896,"target":14914},{"edgeType":"contains","source":13221,"target":13229},{"edgeType":"contains","source":11833,"target":11861},{"edgeType":"calls","source":15691,"target":15638},{"edgeType":"contains","source":15071,"target":15082},{"edgeType":"calls","source":1287,"target":1289},{"edgeType":"contains","source":4632,"target":4664},{"edgeType":"contains","source":4959,"target":5097},{"edgeType":"contains","source":10975,"target":10976},{"edgeType":"contains","source":13155,"target":13161},{"edgeType":"calls","source":890,"target":911},{"edgeType":"calls","source":9904,"target":2660},{"edgeType":"imports","source":8076,"target":8042},{"edgeType":"calls","source":10801,"target":10794},{"edgeType":"contains","source":9984,"target":9986},{"edgeType":"contains","source":10378,"target":10456},{"edgeType":"contains","source":3768,"target":3965},{"edgeType":"contains","source":10116,"target":10122},{"edgeType":"contains","source":15071,"target":15083},{"edgeType":"imports","source":1715,"target":156},{"edgeType":"imports","source":3384,"target":3394},{"edgeType":"contains","source":15740,"target":15485},{"edgeType":"imports","source":882,"target":612},{"edgeType":"contains","source":998,"target":1041},{"edgeType":"contains","source":13221,"target":13228},{"edgeType":"contains","source":11431,"target":11639},{"edgeType":"imports","source":9797,"target":3315},{"edgeType":"imports","source":14611,"target":14746},{"edgeType":"calls","source":10163,"target":976},{"edgeType":"calls","source":12480,"target":11594},{"edgeType":"contains","source":2619,"target":1527},{"edgeType":"contains","source":10379,"target":10423},{"edgeType":"contains","source":10378,"target":10454},{"edgeType":"contains","source":3769,"target":3932},{"edgeType":"contains","source":7870,"target":7871},{"edgeType":"contains","source":12413,"target":12906},{"edgeType":"calls","source":6969,"target":6970},{"edgeType":"contains","source":7684,"target":7293},{"edgeType":"calls","source":6308,"target":6321},{"edgeType":"calls","source":11860,"target":11789},{"edgeType":"contains","source":13155,"target":13158},{"edgeType":"contains","source":801,"target":2922},{"edgeType":"calls","source":14038,"target":14034},{"edgeType":"contains","source":13221,"target":13226},{"edgeType":"contains","source":16723,"target":16724},{"edgeType":"calls","source":209,"target":883},{"edgeType":"contains","source":10378,"target":10455},{"edgeType":"contains","source":12413,"target":12905},{"edgeType":"calls","source":16828,"target":16333},{"edgeType":"contains","source":12164,"target":12168},{"edgeType":"contains","source":4038,"target":4048},{"edgeType":"contains","source":3436,"target":3690},{"edgeType":"contains","source":15401,"target":15410},{"edgeType":"contains","source":14073,"target":14296},{"edgeType":"contains","source":1,"target":242},{"edgeType":"contains","source":4038,"target":4055},{"edgeType":"contains","source":10832,"target":11193},{"edgeType":"contains","source":4632,"target":4668},{"edgeType":"contains","source":12150,"target":12617},{"edgeType":"contains","source":595,"target":855},{"edgeType":"calls","source":3009,"target":2869},{"edgeType":"contains","source":7870,"target":7881},{"edgeType":"contains","source":8534,"target":8438},{"edgeType":"contains","source":10579,"target":10580},{"edgeType":"contains","source":8001,"target":8048},{"edgeType":"contains","source":11833,"target":11874},{"edgeType":"calls","source":6969,"target":6972},{"edgeType":"contains","source":11497,"target":11718},{"edgeType":"contains","source":11431,"target":11650},{"edgeType":"contains","source":16788,"target":16808},{"edgeType":"contains","source":3488,"target":4191},{"edgeType":"contains","source":10971,"target":11113},{"edgeType":"contains","source":13069,"target":13724},{"edgeType":"contains","source":15401,"target":15411},{"edgeType":"contains","source":4038,"target":4054},{"edgeType":"calls","source":15888,"target":15887},{"edgeType":"contains","source":6615,"target":6619},{"edgeType":"contains","source":4633,"target":4636},{"edgeType":"contains","source":4632,"target":4667},{"edgeType":"contains","source":9321,"target":9408},{"edgeType":"imports","source":9797,"target":3303},{"edgeType":"calls","source":12321,"target":12302},{"edgeType":"contains","source":12759,"target":12764},{"edgeType":"calls","source":4490,"target":3468},{"edgeType":"contains","source":13221,"target":13240},{"edgeType":"calls","source":1287,"target":1287},{"edgeType":"contains","source":1,"target":244},{"edgeType":"contains","source":3436,"target":3688},{"edgeType":"contains","source":13683,"target":13716},{"edgeType":"contains","source":15401,"target":15412},{"edgeType":"contains","source":16788,"target":16811},{"edgeType":"contains","source":9654,"target":9659},{"edgeType":"contains","source":8001,"target":8050},{"edgeType":"calls","source":15505,"target":15076},{"edgeType":"contains","source":6615,"target":6620},{"edgeType":"contains","source":14936,"target":15028},{"edgeType":"contains","source":15267,"target":15338},{"edgeType":"contains","source":5293,"target":5315},{"edgeType":"contains","source":3642,"target":3645},{"edgeType":"contains","source":11833,"target":11872},{"edgeType":"contains","source":13221,"target":13239},{"edgeType":"calls","source":14960,"target":2369},{"edgeType":"contains","source":3768,"target":3967},{"edgeType":"contains","source":7689,"target":808},{"edgeType":"contains","source":13069,"target":13722},{"edgeType":"contains","source":16788,"target":16810},{"edgeType":"calls","source":6385,"target":6052},{"edgeType":"contains","source":13469,"target":3436},{"edgeType":"contains","source":8001,"target":8049},{"edgeType":"calls","source":11463,"target":11415},{"edgeType":"calls","source":13510,"target":13493},{"edgeType":"contains","source":4632,"target":4665},{"edgeType":"imports","source":9466,"target":9334},{"edgeType":"contains","source":9980,"target":10121},{"edgeType":"contains","source":5624,"target":5631},{"edgeType":"contains","source":3769,"target":3935},{"edgeType":"contains","source":3768,"target":3966},{"edgeType":"contains","source":13069,"target":13721},{"edgeType":"contains","source":4633,"target":4641},{"edgeType":"contains","source":4632,"target":4672},{"edgeType":"imports","source":15048,"target":3303},{"edgeType":"contains","source":10247,"target":10297},{"edgeType":"contains","source":15071,"target":15074},{"edgeType":"calls","source":4523,"target":4556},{"edgeType":"calls","source":11459,"target":11545},{"edgeType":"calls","source":6929,"target":1874},{"edgeType":"contains","source":3768,"target":3973},{"edgeType":"contains","source":805,"target":2805},{"edgeType":"contains","source":3488,"target":4197},{"edgeType":"calls","source":14896,"target":14923},{"edgeType":"calls","source":2029,"target":1533},{"edgeType":"contains","source":5293,"target":5321},{"edgeType":"imports","source":12090,"target":10438},{"edgeType":"contains","source":2621,"target":1477},{"edgeType":"calls","source":10175,"target":609},{"edgeType":"contains","source":13069,"target":13720},{"edgeType":"contains","source":4632,"target":4671},{"edgeType":"imports","source":3384,"target":3386},{"edgeType":"calls","source":15029,"target":15029},{"edgeType":"imports","source":8906,"target":1331},{"edgeType":"contains","source":7139,"target":7283},{"edgeType":"contains","source":5624,"target":5625},{"edgeType":"contains","source":1330,"target":1331},{"edgeType":"contains","source":9654,"target":9655},{"edgeType":"calls","source":3599,"target":3600},{"edgeType":"calls","source":7102,"target":7083},{"edgeType":"calls","source":1481,"target":1611},{"edgeType":"contains","source":4038,"target":4057},{"edgeType":"contains","source":4632,"target":4670},{"edgeType":"calls","source":9490,"target":9163},{"edgeType":"contains","source":10777,"target":10778},{"edgeType":"imports","source":13217,"target":13556},{"edgeType":"contains","source":6615,"target":6616},{"edgeType":"contains","source":3769,"target":3940},{"edgeType":"contains","source":7870,"target":7879},{"edgeType":"calls","source":8093,"target":8073},{"edgeType":"contains","source":5894,"target":5712},{"edgeType":"calls","source":3877,"target":3438},{"edgeType":"contains","source":805,"target":2807},{"edgeType":"contains","source":9838,"target":10290},{"edgeType":"imports","source":8076,"target":8032},{"edgeType":"contains","source":1,"target":247},{"edgeType":"contains","source":10971,"target":11107},{"edgeType":"contains","source":4038,"target":4056},{"edgeType":"contains","source":15071,"target":15077},{"edgeType":"contains","source":12957,"target":12962},{"edgeType":"contains","source":10116,"target":10129},{"edgeType":"calls","source":14573,"target":14369},{"edgeType":"calls","source":14369,"target":14351},{"edgeType":"contains","source":3309,"target":3374},{"edgeType":"contains","source":13683,"target":13693},{"edgeType":"contains","source":1,"target":217},{"edgeType":"contains","source":5871,"target":6402},{"edgeType":"contains","source":8259,"target":8481},{"edgeType":"contains","source":470,"target":477},{"edgeType":"imports","source":2217,"target":1495},{"edgeType":"calls","source":6818,"target":1058},{"edgeType":"contains","source":4352,"target":4867},{"edgeType":"calls","source":6583,"target":6229},{"edgeType":"contains","source":3488,"target":4168},{"edgeType":"calls","source":427,"target":487},{"edgeType":"calls","source":16085,"target":16096},{"edgeType":"contains","source":3309,"target":3375},{"edgeType":"contains","source":15401,"target":15403},{"edgeType":"contains","source":470,"target":476},{"edgeType":"imports","source":14916,"target":3162},{"edgeType":"contains","source":4352,"target":4866},{"edgeType":"contains","source":3761,"target":4160},{"edgeType":"calls","source":358,"target":511},{"edgeType":"contains","source":9322,"target":9352},{"edgeType":"calls","source":16085,"target":16097},{"edgeType":"contains","source":5425,"target":5427},{"edgeType":"calls","source":4329,"target":4254},{"edgeType":"contains","source":470,"target":479},{"edgeType":"contains","source":13625,"target":13375},{"edgeType":"contains","source":14936,"target":15020},{"edgeType":"contains","source":9322,"target":9356},{"edgeType":"contains","source":4547,"target":5162},{"edgeType":"contains","source":15335,"target":15336},{"edgeType":"contains","source":4233,"target":4325},{"edgeType":"contains","source":4352,"target":4865},{"edgeType":"contains","source":6212,"target":6404},{"edgeType":"calls","source":9667,"target":1533},{"edgeType":"contains","source":3761,"target":4159},{"edgeType":"contains","source":9004,"target":8643},{"edgeType":"calls","source":10290,"target":9702},{"edgeType":"contains","source":3309,"target":3371},{"edgeType":"contains","source":5293,"target":5290},{"edgeType":"contains","source":3309,"target":3373},{"edgeType":"contains","source":470,"target":478},{"edgeType":"contains","source":14073,"target":14291},{"edgeType":"contains","source":4233,"target":4324},{"edgeType":"contains","source":5757,"target":5711},{"edgeType":"contains","source":15267,"target":15331},{"edgeType":"contains","source":15401,"target":15405},{"edgeType":"imports","source":15828,"target":2375},{"edgeType":"contains","source":4352,"target":4863},{"edgeType":"contains","source":3768,"target":3941},{"edgeType":"contains","source":10379,"target":10412},{"edgeType":"contains","source":15267,"target":15330},{"edgeType":"contains","source":8329,"target":8427},{"edgeType":"contains","source":470,"target":481},{"edgeType":"calls","source":8227,"target":8121},{"edgeType":"contains","source":4632,"target":4647},{"edgeType":"imports","source":15620,"target":15160},{"edgeType":"contains","source":16788,"target":16805},{"edgeType":"contains","source":5293,"target":5297},{"edgeType":"contains","source":15267,"target":15332},{"edgeType":"imports","source":1768,"target":612},{"edgeType":"calls","source":11459,"target":11520},{"edgeType":"contains","source":11437,"target":11435},{"edgeType":"imports","source":3265,"target":2828},{"edgeType":"calls","source":16350,"target":16333},{"edgeType":"contains","source":7517,"target":6111},{"edgeType":"contains","source":11431,"target":11623},{"edgeType":"contains","source":4434,"target":4442},{"edgeType":"contains","source":15402,"target":15376},{"edgeType":"contains","source":11431,"target":11622},{"edgeType":"contains","source":3309,"target":3376},{"edgeType":"contains","source":470,"target":483},{"edgeType":"contains","source":16788,"target":16807},{"edgeType":"calls","source":2146,"target":2158},{"edgeType":"contains","source":4434,"target":4441},{"edgeType":"imports","source":2618,"target":1743},{"edgeType":"contains","source":10379,"target":10406},{"edgeType":"calls","source":1882,"target":1889},{"edgeType":"calls","source":12934,"target":3847},{"edgeType":"calls","source":16085,"target":16094},{"edgeType":"contains","source":10971,"target":11082},{"edgeType":"contains","source":3309,"target":3377},{"edgeType":"contains","source":16788,"target":16806},{"edgeType":"contains","source":470,"target":482},{"edgeType":"contains","source":4434,"target":4440},{"edgeType":"contains","source":4233,"target":4328},{"edgeType":"calls","source":15167,"target":14956},{"edgeType":"calls","source":15164,"target":4479},{"edgeType":"contains","source":4352,"target":4868},{"edgeType":"calls","source":11461,"target":11457},{"edgeType":"calls","source":16085,"target":16095},{"edgeType":"contains","source":3786,"target":3394},{"edgeType":"contains","source":5821,"target":5846},{"edgeType":"calls","source":1882,"target":1883},{"edgeType":"contains","source":13155,"target":13157},{"edgeType":"calls","source":209,"target":894},{"edgeType":"contains","source":3488,"target":4176},{"edgeType":"contains","source":11431,"target":11634},{"edgeType":"contains","source":16063,"target":16013},{"edgeType":"contains","source":16788,"target":16793},{"edgeType":"contains","source":4038,"target":4039},{"edgeType":"contains","source":4170,"target":4175},{"edgeType":"contains","source":7038,"target":6172},{"edgeType":"calls","source":11522,"target":1115},{"edgeType":"calls","source":4588,"target":2562},{"edgeType":"contains","source":10116,"target":10118},{"edgeType":"calls","source":1089,"target":1097},{"edgeType":"contains","source":6540,"target":6812},{"edgeType":"calls","source":975,"target":2516},{"edgeType":"calls","source":1648,"target":680},{"edgeType":"contains","source":470,"target":484},{"edgeType":"contains","source":16788,"target":16792},{"edgeType":"imports","source":15489,"target":14987},{"edgeType":"calls","source":10151,"target":9788},{"edgeType":"calls","source":4943,"target":2126},{"edgeType":"contains","source":1778,"target":2217},{"edgeType":"imports","source":15843,"target":12473},{"edgeType":"calls","source":6596,"target":5836},{"edgeType":"calls","source":14925,"target":3438},{"edgeType":"calls","source":10406,"target":10343},{"edgeType":"contains","source":11431,"target":11632},{"edgeType":"calls","source":6450,"target":6134},{"edgeType":"calls","source":15846,"target":2375},{"edgeType":"imports","source":14350,"target":14359},{"edgeType":"calls","source":6596,"target":5837},{"edgeType":"calls","source":3930,"target":3931},{"edgeType":"calls","source":2339,"target":400},{"edgeType":"contains","source":13221,"target":13222},{"edgeType":"contains","source":9625,"target":6312},{"edgeType":"contains","source":11431,"target":11633},{"edgeType":"calls","source":12800,"target":12232},{"edgeType":"calls","source":4729,"target":4530},{"edgeType":"contains","source":5963,"target":5676},{"edgeType":"contains","source":4632,"target":4648},{"edgeType":"contains","source":12617,"target":12919},{"edgeType":"imports","source":5493,"target":1410},{"edgeType":"imports","source":9754,"target":389},{"edgeType":"contains","source":9322,"target":9358},{"edgeType":"contains","source":801,"target":2913},{"edgeType":"calls","source":6044,"target":6045},{"edgeType":"imports","source":1621,"target":949},{"edgeType":"contains","source":13355,"target":13295},{"edgeType":"contains","source":9838,"target":8161},{"edgeType":"contains","source":13683,"target":13697},{"edgeType":"calls","source":12320,"target":12320},{"edgeType":"calls","source":7768,"target":7559},{"edgeType":"contains","source":13155,"target":13152},{"edgeType":"calls","source":4657,"target":4647},{"edgeType":"calls","source":15557,"target":15556},{"edgeType":"contains","source":4352,"target":2765},{"edgeType":"calls","source":10075,"target":10035},{"edgeType":"contains","source":9322,"target":9357},{"edgeType":"calls","source":15698,"target":615},{"edgeType":"contains","source":11431,"target":11631},{"edgeType":"contains","source":13683,"target":13696},{"edgeType":"calls","source":14070,"target":13035},{"edgeType":"contains","source":1,"target":229},{"edgeType":"contains","source":14476,"target":14477},{"edgeType":"calls","source":7010,"target":5690},{"edgeType":"calls","source":9878,"target":3457},{"edgeType":"calls","source":3430,"target":402},{"edgeType":"contains","source":8001,"target":8029},{"edgeType":"contains","source":998,"target":1036},{"edgeType":"contains","source":9838,"target":8159},{"edgeType":"contains","source":13683,"target":13695},{"edgeType":"contains","source":10378,"target":10446},{"edgeType":"contains","source":16788,"target":16799},{"edgeType":"contains","source":9322,"target":9359},{"edgeType":"contains","source":998,"target":1035},{"edgeType":"contains","source":3303,"target":1457},{"edgeType":"contains","source":14073,"target":14287},{"edgeType":"calls","source":14834,"target":14717},{"edgeType":"contains","source":15621,"target":4352},{"edgeType":"calls","source":13493,"target":3438},{"edgeType":"calls","source":3341,"target":3159},{"edgeType":"imports","source":13217,"target":13540},{"edgeType":"contains","source":16788,"target":16798},{"edgeType":"calls","source":10074,"target":10038},{"edgeType":"contains","source":4352,"target":4850},{"edgeType":"calls","source":11467,"target":11251},{"edgeType":"contains","source":998,"target":1005},{"edgeType":"contains","source":10379,"target":10396},{"edgeType":"contains","source":10378,"target":10427},{"edgeType":"contains","source":13292,"target":13113},{"edgeType":"contains","source":2848,"target":2850},{"edgeType":"contains","source":1063,"target":1104},{"edgeType":"contains","source":5290,"target":5369},{"edgeType":"contains","source":16986,"target":16989},{"edgeType":"contains","source":7459,"target":7895},{"edgeType":"contains","source":14073,"target":14272},{"edgeType":"contains","source":5821,"target":5822},{"edgeType":"contains","source":4235,"target":4249},{"edgeType":"contains","source":4230,"target":4404},{"edgeType":"contains","source":4058,"target":3394},{"edgeType":"calls","source":10141,"target":10074},{"edgeType":"contains","source":10379,"target":10397},{"edgeType":"contains","source":10971,"target":11072},{"edgeType":"calls","source":16086,"target":16050},{"edgeType":"contains","source":14947,"target":14662},{"edgeType":"contains","source":16986,"target":16988},{"edgeType":"contains","source":7459,"target":7896},{"edgeType":"contains","source":7684,"target":921},{"edgeType":"contains","source":1,"target":200},{"edgeType":"contains","source":12293,"target":12370},{"edgeType":"contains","source":14073,"target":14273},{"edgeType":"contains","source":73,"target":82},{"edgeType":"contains","source":16127,"target":16134},{"edgeType":"imports","source":15834,"target":2236},{"edgeType":"contains","source":5953,"target":5959},{"edgeType":"contains","source":4233,"target":4310},{"edgeType":"contains","source":2319,"target":2334},{"edgeType":"contains","source":15267,"target":15313},{"edgeType":"calls","source":8697,"target":8331},{"edgeType":"contains","source":998,"target":1007},{"edgeType":"calls","source":10651,"target":609},{"edgeType":"contains","source":9321,"target":9370},{"edgeType":"contains","source":12293,"target":12369},{"edgeType":"contains","source":14073,"target":14274},{"edgeType":"contains","source":11657,"target":6715},{"edgeType":"contains","source":10379,"target":10394},{"edgeType":"calls","source":1419,"target":1398},{"edgeType":"contains","source":865,"target":901},{"edgeType":"imports","source":3385,"target":3394},{"edgeType":"contains","source":10379,"target":10395},{"edgeType":"calls","source":14449,"target":13940},{"edgeType":"calls","source":10141,"target":10076},{"edgeType":"calls","source":10470,"target":10447},{"edgeType":"contains","source":16986,"target":16990},{"edgeType":"contains","source":7459,"target":7898},{"edgeType":"contains","source":14073,"target":14275},{"edgeType":"contains","source":4547,"target":5144},{"edgeType":"calls","source":15203,"target":7486},{"edgeType":"contains","source":4434,"target":4419},{"edgeType":"contains","source":2319,"target":2335},{"edgeType":"imports","source":15834,"target":4352},{"edgeType":"contains","source":4352,"target":4854},{"edgeType":"calls","source":11459,"target":11503},{"edgeType":"calls","source":427,"target":433},{"edgeType":"contains","source":998,"target":1009},{"edgeType":"contains","source":11040,"target":11042},{"edgeType":"imports","source":14871,"target":15173},{"edgeType":"contains","source":1063,"target":1108},{"edgeType":"contains","source":16127,"target":16139},{"edgeType":"calls","source":14501,"target":14449},{"edgeType":"calls","source":9909,"target":358},{"edgeType":"contains","source":4235,"target":4252},{"edgeType":"calls","source":5411,"target":2371},{"edgeType":"calls","source":13828,"target":3600},{"edgeType":"contains","source":4352,"target":4853},{"edgeType":"imports","source":4630,"target":4969},{"edgeType":"calls","source":6315,"target":6069},{"edgeType":"calls","source":12425,"target":2699},{"edgeType":"contains","source":5290,"target":5372},{"edgeType":"contains","source":14073,"target":14277},{"edgeType":"contains","source":2449,"target":2539},{"edgeType":"contains","source":14936,"target":15007},{"edgeType":"calls","source":16763,"target":16199},{"edgeType":"contains","source":5871,"target":6383},{"edgeType":"contains","source":5953,"target":5955},{"edgeType":"calls","source":15029,"target":14988},{"edgeType":"contains","source":10379,"target":10393},{"edgeType":"calls","source":10948,"target":10433},{"edgeType":"contains","source":3971,"target":3980},{"edgeType":"contains","source":4235,"target":4251},{"edgeType":"calls","source":1349,"target":1450},{"edgeType":"calls","source":3430,"target":358},{"edgeType":"imports","source":15493,"target":2236},{"edgeType":"contains","source":11431,"target":11603},{"edgeType":"calls","source":10073,"target":10075},{"edgeType":"contains","source":865,"target":906},{"edgeType":"contains","source":11370,"target":11380},{"edgeType":"calls","source":12264,"target":3459},{"edgeType":"imports","source":14611,"target":14779},{"edgeType":"contains","source":14073,"target":14278},{"edgeType":"calls","source":15226,"target":15224},{"edgeType":"contains","source":5290,"target":5371},{"edgeType":"contains","source":16059,"target":16135},{"edgeType":"contains","source":16788,"target":16791},{"edgeType":"contains","source":5887,"target":5888},{"edgeType":"contains","source":5871,"target":6384},{"edgeType":"contains","source":8259,"target":8463},{"edgeType":"contains","source":4352,"target":4851},{"edgeType":"contains","source":8463,"target":8480},{"edgeType":"calls","source":492,"target":533},{"edgeType":"contains","source":16314,"target":16685},{"edgeType":"contains","source":11040,"target":11041},{"edgeType":"calls","source":14745,"target":540},{"edgeType":"contains","source":865,"target":905},{"edgeType":"calls","source":10073,"target":10074},{"edgeType":"contains","source":11370,"target":11381},{"edgeType":"contains","source":998,"target":1010},{"edgeType":"contains","source":14073,"target":14279},{"edgeType":"contains","source":16127,"target":16140},{"edgeType":"contains","source":2619,"target":1495},{"edgeType":"contains","source":5887,"target":5889},{"edgeType":"contains","source":4235,"target":4250},{"edgeType":"contains","source":4233,"target":4312},{"edgeType":"calls","source":4907,"target":1079},{"edgeType":"contains","source":16059,"target":16120},{"edgeType":"contains","source":4230,"target":4412},{"edgeType":"imports","source":12999,"target":3436},{"edgeType":"calls","source":11468,"target":2772},{"edgeType":"contains","source":4352,"target":4858},{"edgeType":"imports","source":2434,"target":1169},{"edgeType":"contains","source":6540,"target":6795},{"edgeType":"calls","source":8887,"target":8790},{"edgeType":"imports","source":15747,"target":15496},{"edgeType":"contains","source":5290,"target":5377},{"edgeType":"calls","source":10209,"target":10089},{"edgeType":"imports","source":6305,"target":5883},{"edgeType":"contains","source":14540,"target":14585},{"edgeType":"contains","source":7459,"target":7903},{"edgeType":"contains","source":16192,"target":16226},{"edgeType":"contains","source":6615,"target":6586},{"edgeType":"contains","source":10379,"target":10405},{"edgeType":"contains","source":5290,"target":5376},{"edgeType":"contains","source":7459,"target":7904},{"edgeType":"contains","source":16192,"target":16225},{"edgeType":"contains","source":14073,"target":14265},{"edgeType":"contains","source":3488,"target":4157},{"edgeType":"imports","source":14611,"target":14775},{"edgeType":"contains","source":11762,"target":11925},{"edgeType":"imports","source":10078,"target":965},{"edgeType":"contains","source":4352,"target":4856},{"edgeType":"contains","source":470,"target":471},{"edgeType":"contains","source":4632,"target":4633},{"edgeType":"contains","source":4547,"target":5153},{"edgeType":"calls","source":4376,"target":626},{"edgeType":"contains","source":14073,"target":14266},{"edgeType":"contains","source":16127,"target":16129},{"edgeType":"contains","source":7459,"target":7907},{"edgeType":"calls","source":1108,"target":460},{"edgeType":"contains","source":14936,"target":14996},{"edgeType":"contains","source":10378,"target":10434},{"edgeType":"calls","source":2343,"target":2341},{"edgeType":"contains","source":12418,"target":4273},{"edgeType":"contains","source":5290,"target":5374},{"edgeType":"contains","source":1928,"target":1780},{"edgeType":"contains","source":9283,"target":2099},{"edgeType":"contains","source":12225,"target":1800},{"edgeType":"calls","source":16085,"target":16091},{"edgeType":"calls","source":15027,"target":4486},{"edgeType":"contains","source":14073,"target":14267},{"edgeType":"contains","source":16127,"target":16128},{"edgeType":"contains","source":6292,"target":6023},{"edgeType":"contains","source":4230,"target":4416},{"edgeType":"contains","source":4434,"target":4435},{"edgeType":"contains","source":4352,"target":4862},{"edgeType":"contains","source":2449,"target":2547},{"edgeType":"calls","source":3232,"target":2261},{"edgeType":"contains","source":11431,"target":11613},{"edgeType":"contains","source":12418,"target":4272},{"edgeType":"contains","source":7459,"target":7899},{"edgeType":"contains","source":16059,"target":16125},{"edgeType":"contains","source":14073,"target":14268},{"edgeType":"contains","source":10379,"target":10401},{"edgeType":"calls","source":3763,"target":600},{"edgeType":"contains","source":470,"target":472},{"edgeType":"contains","source":4352,"target":4861},{"edgeType":"imports","source":1621,"target":998},{"edgeType":"contains","source":7459,"target":7900},{"edgeType":"contains","source":14073,"target":14269},{"edgeType":"calls","source":4457,"target":4454},{"edgeType":"calls","source":6583,"target":6226},{"edgeType":"contains","source":16059,"target":16124},{"edgeType":"contains","source":4632,"target":4637},{"edgeType":"contains","source":470,"target":475},{"edgeType":"contains","source":16986,"target":16987},{"edgeType":"calls","source":1948,"target":1899},{"edgeType":"contains","source":14073,"target":14270},{"edgeType":"calls","source":8484,"target":2261},{"edgeType":"contains","source":5290,"target":5379},{"edgeType":"contains","source":7459,"target":7901},{"edgeType":"contains","source":11762,"target":11922},{"edgeType":"contains","source":734,"target":746},{"edgeType":"calls","source":15694,"target":15523},{"edgeType":"contains","source":470,"target":474},{"edgeType":"contains","source":8001,"target":8012},{"edgeType":"calls","source":7961,"target":7905},{"edgeType":"contains","source":5290,"target":5378},{"edgeType":"contains","source":7517,"target":6104},{"edgeType":"contains","source":14073,"target":14271},{"edgeType":"calls","source":2943,"target":679},{"edgeType":"imports","source":14954,"target":10474},{"edgeType":"contains","source":4763,"target":4777},{"edgeType":"contains","source":2319,"target":2320},{"edgeType":"calls","source":1908,"target":1052},{"edgeType":"imports","source":15821,"target":15308},{"edgeType":"contains","source":13292,"target":13096},{"edgeType":"contains","source":10426,"target":11037},{"edgeType":"contains","source":801,"target":2867},{"edgeType":"contains","source":14409,"target":14410},{"edgeType":"contains","source":5290,"target":5352},{"edgeType":"imports","source":14863,"target":611},{"edgeType":"calls","source":626,"target":627},{"edgeType":"calls","source":16011,"target":16243},{"edgeType":"contains","source":3309,"target":3340},{"edgeType":"contains","source":9057,"target":9079},{"edgeType":"imports","source":5256,"target":4569},{"edgeType":"calls","source":11065,"target":11013},{"edgeType":"contains","source":16059,"target":16111},{"edgeType":"contains","source":2319,"target":2321},{"edgeType":"calls","source":6640,"target":6544},{"edgeType":"contains","source":4352,"target":4833},{"edgeType":"contains","source":8463,"target":8466},{"edgeType":"contains","source":987,"target":1328},{"edgeType":"contains","source":3436,"target":3632},{"edgeType":"contains","source":5290,"target":5351},{"edgeType":"contains","source":12957,"target":12910},{"edgeType":"contains","source":13616,"target":13621},{"edgeType":"imports","source":16758,"target":1058},{"edgeType":"contains","source":9322,"target":9323},{"edgeType":"imports","source":4071,"target":3251},{"edgeType":"contains","source":16059,"target":16114},{"edgeType":"contains","source":4352,"target":4832},{"edgeType":"calls","source":6817,"target":1058},{"edgeType":"calls","source":11526,"target":11518},{"edgeType":"contains","source":10426,"target":11035},{"edgeType":"calls","source":286,"target":599},{"edgeType":"contains","source":11436,"target":11435},{"edgeType":"contains","source":11431,"target":11590},{"edgeType":"contains","source":5290,"target":5350},{"edgeType":"calls","source":11321,"target":3075},{"edgeType":"calls","source":7769,"target":7486},{"edgeType":"contains","source":9460,"target":9272},{"edgeType":"contains","source":9451,"target":9551},{"edgeType":"calls","source":8883,"target":8890},{"edgeType":"calls","source":3467,"target":3461},{"edgeType":"contains","source":4352,"target":4830},{"edgeType":"calls","source":3319,"target":1706},{"edgeType":"contains","source":5290,"target":5349},{"edgeType":"contains","source":3436,"target":3630},{"edgeType":"contains","source":5290,"target":5357},{"edgeType":"calls","source":16011,"target":16239},{"edgeType":"contains","source":16059,"target":16116},{"edgeType":"contains","source":3758,"target":4225},{"edgeType":"contains","source":10426,"target":11032},{"edgeType":"contains","source":3853,"target":3394},{"edgeType":"contains","source":5688,"target":5696},{"edgeType":"calls","source":5317,"target":5302},{"edgeType":"contains","source":12559,"target":12561},{"edgeType":"contains","source":4352,"target":4838},{"edgeType":"calls","source":14895,"target":14896},{"edgeType":"contains","source":12625,"target":12629},{"edgeType":"calls","source":16552,"target":16380},{"edgeType":"contains","source":1779,"target":2152},{"edgeType":"contains","source":13021,"target":13036},{"edgeType":"contains","source":10971,"target":8937},{"edgeType":"contains","source":14761,"target":14073},{"edgeType":"calls","source":16552,"target":16382},{"edgeType":"contains","source":13616,"target":13618},{"edgeType":"contains","source":16059,"target":16115},{"edgeType":"contains","source":3758,"target":4224},{"edgeType":"contains","source":10426,"target":11033},{"edgeType":"imports","source":9472,"target":9179},{"edgeType":"imports","source":13217,"target":13579},{"edgeType":"contains","source":4235,"target":4236},{"edgeType":"contains","source":10426,"target":11034},{"edgeType":"contains","source":1063,"target":1090},{"edgeType":"imports","source":15493,"target":4330},{"edgeType":"calls","source":821,"target":919},{"edgeType":"contains","source":3310,"target":3312},{"edgeType":"contains","source":1196,"target":1199},{"edgeType":"contains","source":13616,"target":13617},{"edgeType":"contains","source":1779,"target":2149},{"edgeType":"calls","source":14499,"target":14493},{"edgeType":"contains","source":10426,"target":11030},{"edgeType":"contains","source":10435,"target":10751},{"edgeType":"contains","source":2319,"target":2322},{"edgeType":"contains","source":15552,"target":4352},{"edgeType":"contains","source":1,"target":190},{"edgeType":"contains","source":8463,"target":8465},{"edgeType":"contains","source":13360,"target":13096},{"edgeType":"contains","source":12625,"target":12627},{"edgeType":"contains","source":10643,"target":10646},{"edgeType":"calls","source":14060,"target":619},{"edgeType":"contains","source":4763,"target":4779},{"edgeType":"contains","source":9057,"target":9077},{"edgeType":"contains","source":16192,"target":16224},{"edgeType":"calls","source":1611,"target":1800},{"edgeType":"imports","source":12378,"target":3651},{"edgeType":"contains","source":5290,"target":5354},{"edgeType":"contains","source":1196,"target":1198},{"edgeType":"contains","source":1779,"target":2150},{"edgeType":"contains","source":4763,"target":4778},{"edgeType":"contains","source":1,"target":10760},{"edgeType":"contains","source":12625,"target":12626},{"edgeType":"contains","source":4352,"target":4835},{"edgeType":"contains","source":801,"target":758},{"edgeType":"calls","source":15491,"target":15450},{"edgeType":"contains","source":3436,"target":3634},{"edgeType":"contains","source":9057,"target":9076},{"edgeType":"contains","source":5290,"target":5353},{"edgeType":"contains","source":13418,"target":13411},{"edgeType":"calls","source":975,"target":2484},{"edgeType":"calls","source":8325,"target":2940},{"edgeType":"imports","source":15749,"target":15418},{"edgeType":"contains","source":1063,"target":1096},{"edgeType":"contains","source":1196,"target":1201},{"edgeType":"imports","source":13869,"target":8161},{"edgeType":"calls","source":1947,"target":1949},{"edgeType":"imports","source":1375,"target":156},{"edgeType":"calls","source":1418,"target":1435},{"edgeType":"contains","source":3488,"target":4143},{"edgeType":"imports","source":15503,"target":12473},{"edgeType":"contains","source":73,"target":75},{"edgeType":"contains","source":4235,"target":4241},{"edgeType":"contains","source":8838,"target":9534},{"edgeType":"contains","source":14661,"target":15046},{"edgeType":"contains","source":15267,"target":15286},{"edgeType":"contains","source":4352,"target":4842},{"edgeType":"contains","source":662,"target":842},{"edgeType":"contains","source":10379,"target":10388},{"edgeType":"contains","source":8463,"target":8475},{"edgeType":"contains","source":1,"target":10762},{"edgeType":"contains","source":15664,"target":15665},{"edgeType":"contains","source":11370,"target":11379},{"edgeType":"contains","source":3761,"target":4135},{"edgeType":"contains","source":73,"target":74},{"edgeType":"contains","source":801,"target":760},{"edgeType":"imports","source":14382,"target":2828},{"edgeType":"contains","source":3436,"target":3640},{"edgeType":"imports","source":15349,"target":15132},{"edgeType":"imports","source":2153,"target":1406},{"edgeType":"contains","source":13022,"target":13017},{"edgeType":"contains","source":14661,"target":15047},{"edgeType":"contains","source":8463,"target":8474},{"edgeType":"contains","source":662,"target":841},{"edgeType":"contains","source":8859,"target":8882},{"edgeType":"contains","source":4959,"target":5050},{"edgeType":"contains","source":10379,"target":10389},{"edgeType":"imports","source":14033,"target":965},{"edgeType":"contains","source":3310,"target":3316},{"edgeType":"contains","source":12095,"target":12156},{"edgeType":"contains","source":5290,"target":5359},{"edgeType":"contains","source":15664,"target":15666},{"edgeType":"contains","source":7517,"target":6091},{"edgeType":"contains","source":1,"target":195},{"edgeType":"calls","source":6175,"target":6181},{"edgeType":"imports","source":11906,"target":11936},{"edgeType":"contains","source":8859,"target":8885},{"edgeType":"calls","source":3340,"target":1046},{"edgeType":"contains","source":801,"target":2877},{"edgeType":"contains","source":662,"target":844},{"edgeType":"calls","source":286,"target":589},{"edgeType":"contains","source":10223,"target":424},{"edgeType":"contains","source":5290,"target":5358},{"edgeType":"contains","source":15664,"target":15667},{"edgeType":"contains","source":13295,"target":13009},{"edgeType":"calls","source":1349,"target":1461},{"edgeType":"contains","source":10247,"target":10251},{"edgeType":"contains","source":8859,"target":8884},{"edgeType":"contains","source":4352,"target":4839},{"edgeType":"contains","source":5102,"target":4843},{"edgeType":"contains","source":998,"target":1001},{"edgeType":"contains","source":15664,"target":15668},{"edgeType":"contains","source":16192,"target":16213},{"edgeType":"calls","source":6996,"target":6089},{"edgeType":"contains","source":3310,"target":3322},{"edgeType":"calls","source":2345,"target":2292},{"edgeType":"contains","source":662,"target":846},{"edgeType":"contains","source":1,"target":197},{"edgeType":"contains","source":73,"target":79},{"edgeType":"contains","source":4352,"target":4846},{"edgeType":"contains","source":998,"target":1000},{"edgeType":"calls","source":12847,"target":12862},{"edgeType":"contains","source":9322,"target":9324},{"edgeType":"contains","source":16192,"target":16212},{"edgeType":"contains","source":12152,"target":4044},{"edgeType":"contains","source":3310,"target":3323},{"edgeType":"contains","source":14073,"target":14252},{"edgeType":"calls","source":9809,"target":9791},{"edgeType":"contains","source":73,"target":78},{"edgeType":"calls","source":10037,"target":609},{"edgeType":"calls","source":7797,"target":286},{"edgeType":"contains","source":8838,"target":9529},{"edgeType":"contains","source":3785,"target":3394},{"edgeType":"contains","source":16315,"target":16630},{"edgeType":"contains","source":998,"target":1003},{"edgeType":"contains","source":3310,"target":3320},{"edgeType":"contains","source":10379,"target":10382},{"edgeType":"contains","source":73,"target":81},{"edgeType":"calls","source":15913,"target":2375},{"edgeType":"contains","source":8594,"target":8640},{"edgeType":"contains","source":9322,"target":9326},{"edgeType":"contains","source":801,"target":2881},{"edgeType":"contains","source":998,"target":1002},{"edgeType":"calls","source":8620,"target":8599},{"edgeType":"contains","source":3310,"target":3321},{"edgeType":"contains","source":10379,"target":10383},{"edgeType":"contains","source":73,"target":80},{"edgeType":"contains","source":8859,"target":8880},{"edgeType":"calls","source":14148,"target":2126},{"edgeType":"contains","source":8463,"target":8472},{"edgeType":"contains","source":8594,"target":8639},{"edgeType":"contains","source":10643,"target":10655},{"edgeType":"contains","source":9838,"target":10221},{"edgeType":"contains","source":14540,"target":14560},{"edgeType":"contains","source":10484,"target":9222},{"edgeType":"contains","source":865,"target":867},{"edgeType":"contains","source":15336,"target":15253},{"edgeType":"contains","source":1063,"target":1071},{"edgeType":"calls","source":209,"target":952},{"edgeType":"calls","source":695,"target":684},{"edgeType":"calls","source":11996,"target":11864},{"edgeType":"contains","source":12888,"target":12920},{"edgeType":"contains","source":14936,"target":14969},{"edgeType":"contains","source":7460,"target":7831},{"edgeType":"contains","source":14342,"target":14356},{"edgeType":"calls","source":14438,"target":14383},{"edgeType":"contains","source":4101,"target":4142},{"edgeType":"imports","source":13217,"target":13369},{"edgeType":"contains","source":865,"target":866},{"edgeType":"contains","source":987,"target":1312},{"edgeType":"calls","source":695,"target":683},{"edgeType":"contains","source":13021,"target":13024},{"edgeType":"calls","source":2161,"target":1750},{"edgeType":"contains","source":12551,"target":4339},{"edgeType":"contains","source":7459,"target":7863},{"edgeType":"contains","source":14276,"target":14289},{"edgeType":"calls","source":15362,"target":540},{"edgeType":"contains","source":4101,"target":4141},{"edgeType":"contains","source":9838,"target":10223},{"edgeType":"contains","source":10223,"target":402},{"edgeType":"contains","source":1657,"target":1682},{"edgeType":"contains","source":2979,"target":2982},{"edgeType":"contains","source":14342,"target":14358},{"edgeType":"calls","source":6189,"target":5838},{"edgeType":"contains","source":11431,"target":11574},{"edgeType":"contains","source":15003,"target":15008},{"edgeType":"contains","source":987,"target":1315},{"edgeType":"contains","source":5159,"target":5167},{"edgeType":"imports","source":12908,"target":12379},{"edgeType":"contains","source":13021,"target":13023},{"edgeType":"imports","source":16845,"target":2375},{"edgeType":"contains","source":4101,"target":4140},{"edgeType":"contains","source":6540,"target":6756},{"edgeType":"contains","source":2510,"target":2722},{"edgeType":"calls","source":15378,"target":2159},{"edgeType":"contains","source":12094,"target":12163},{"edgeType":"calls","source":6462,"target":5837},{"edgeType":"contains","source":10426,"target":11019},{"edgeType":"contains","source":15267,"target":15281},{"edgeType":"calls","source":6189,"target":5837},{"edgeType":"contains","source":8859,"target":8860},{"edgeType":"contains","source":7460,"target":7834},{"edgeType":"contains","source":7459,"target":7865},{"edgeType":"contains","source":9982,"target":9985},{"edgeType":"contains","source":2510,"target":2723},{"edgeType":"contains","source":5754,"target":5755},{"edgeType":"contains","source":12094,"target":12162},{"edgeType":"imports","source":2434,"target":925},{"edgeType":"contains","source":4233,"target":4282},{"edgeType":"contains","source":15267,"target":15282},{"edgeType":"contains","source":15928,"target":15932},{"edgeType":"contains","source":15003,"target":15010},{"edgeType":"contains","source":9057,"target":9059},{"edgeType":"contains","source":12094,"target":12161},{"edgeType":"contains","source":3761,"target":4116},{"edgeType":"contains","source":3769,"target":3868},{"edgeType":"contains","source":8330,"target":8341},{"edgeType":"contains","source":9838,"target":10218},{"edgeType":"contains","source":12624,"target":12642},{"edgeType":"contains","source":4230,"target":4374},{"edgeType":"contains","source":15796,"target":15797},{"edgeType":"contains","source":15003,"target":15011},{"edgeType":"contains","source":4763,"target":4764},{"edgeType":"imports","source":5227,"target":5257},{"edgeType":"calls","source":4262,"target":4264},{"edgeType":"contains","source":5290,"target":5339},{"edgeType":"imports","source":7458,"target":7973},{"edgeType":"calls","source":209,"target":947},{"edgeType":"contains","source":15267,"target":15283},{"edgeType":"contains","source":8330,"target":8340},{"edgeType":"imports","source":14015,"target":13997},{"edgeType":"contains","source":15796,"target":15798},{"edgeType":"contains","source":15003,"target":15012},{"edgeType":"contains","source":16315,"target":16622},{"edgeType":"contains","source":9057,"target":9061},{"edgeType":"calls","source":3007,"target":3000},{"edgeType":"calls","source":12983,"target":12981},{"edgeType":"calls","source":209,"target":950},{"edgeType":"contains","source":2510,"target":2726},{"edgeType":"contains","source":3761,"target":4114},{"edgeType":"contains","source":10426,"target":11014},{"edgeType":"contains","source":8330,"target":8343},{"edgeType":"contains","source":15267,"target":15284},{"edgeType":"contains","source":15796,"target":15799},{"edgeType":"contains","source":12624,"target":12640},{"edgeType":"contains","source":8594,"target":8614},{"edgeType":"contains","source":14661,"target":15045},{"edgeType":"imports","source":9541,"target":8937},{"edgeType":"calls","source":1756,"target":1615},{"edgeType":"contains","source":5961,"target":5676},{"edgeType":"contains","source":12094,"target":12158},{"edgeType":"imports","source":5509,"target":730},{"edgeType":"imports","source":7688,"target":832},{"edgeType":"calls","source":13117,"target":13061},{"edgeType":"calls","source":15168,"target":15017},{"edgeType":"contains","source":12624,"target":12655},{"edgeType":"contains","source":10378,"target":10402},{"edgeType":"calls","source":2876,"target":2830},{"edgeType":"contains","source":801,"target":2859},{"edgeType":"contains","source":10643,"target":10644},{"edgeType":"contains","source":9466,"target":2734},{"edgeType":"contains","source":5290,"target":5344},{"edgeType":"calls","source":8887,"target":8889},{"edgeType":"calls","source":3534,"target":3573},{"edgeType":"contains","source":3989,"target":3394},{"edgeType":"calls","source":6872,"target":5817},{"edgeType":"contains","source":16192,"target":16193},{"edgeType":"contains","source":3761,"target":4120},{"edgeType":"contains","source":14276,"target":14280},{"edgeType":"contains","source":14342,"target":14348},{"edgeType":"contains","source":12888,"target":12927},{"edgeType":"calls","source":15440,"target":2358},{"edgeType":"contains","source":4959,"target":5034},{"edgeType":"contains","source":15340,"target":15122},{"edgeType":"imports","source":1055,"target":1405},{"edgeType":"calls","source":1624,"target":1473},{"edgeType":"contains","source":5688,"target":5693},{"edgeType":"contains","source":3648,"target":3394},{"edgeType":"contains","source":7517,"target":6073},{"edgeType":"calls","source":16288,"target":16237},{"edgeType":"imports","source":12759,"target":12761},{"edgeType":"imports","source":9472,"target":8949},{"edgeType":"imports","source":15349,"target":2236},{"edgeType":"contains","source":801,"target":2861},{"edgeType":"contains","source":987,"target":1323},{"edgeType":"contains","source":5892,"target":5712},{"edgeType":"contains","source":5688,"target":5694},{"edgeType":"contains","source":5659,"target":6593},{"edgeType":"contains","source":3761,"target":4118},{"edgeType":"imports","source":6681,"target":6682},{"edgeType":"contains","source":10379,"target":10370},{"edgeType":"contains","source":13021,"target":13030},{"edgeType":"calls","source":5522,"target":3251},{"edgeType":"calls","source":1028,"target":925},{"edgeType":"contains","source":10435,"target":10748},{"edgeType":"contains","source":801,"target":2860},{"edgeType":"contains","source":14342,"target":14351},{"edgeType":"contains","source":2510,"target":2731},{"edgeType":"contains","source":1063,"target":1080},{"edgeType":"calls","source":6808,"target":5690},{"edgeType":"contains","source":5688,"target":5695},{"edgeType":"calls","source":16355,"target":16276},{"edgeType":"contains","source":16192,"target":16194},{"edgeType":"contains","source":11762,"target":11890},{"edgeType":"contains","source":12706,"target":3767},{"edgeType":"calls","source":3534,"target":3569},{"edgeType":"calls","source":9680,"target":9679},{"edgeType":"calls","source":11662,"target":11660},{"edgeType":"calls","source":3601,"target":3606},{"edgeType":"contains","source":8859,"target":8863},{"edgeType":"contains","source":12624,"target":12651},{"edgeType":"contains","source":4230,"target":4383},{"edgeType":"contains","source":12888,"target":12924},{"edgeType":"calls","source":3811,"target":3438},{"edgeType":"contains","source":987,"target":1325},{"edgeType":"calls","source":13507,"target":13660},{"edgeType":"calls","source":975,"target":2562},{"edgeType":"contains","source":14584,"target":8964},{"edgeType":"contains","source":7459,"target":7866},{"edgeType":"contains","source":5290,"target":5348},{"edgeType":"calls","source":14541,"target":9088},{"edgeType":"calls","source":4151,"target":3468},{"edgeType":"contains","source":9057,"target":9066},{"edgeType":"contains","source":16059,"target":16090},{"edgeType":"contains","source":3436,"target":3627},{"edgeType":"imports","source":9858,"target":9673},{"edgeType":"calls","source":12075,"target":972},{"edgeType":"calls","source":3534,"target":3570},{"edgeType":"contains","source":4959,"target":5038},{"edgeType":"contains","source":12888,"target":12923},{"edgeType":"contains","source":801,"target":748},{"edgeType":"contains","source":8859,"target":8862},{"edgeType":"contains","source":14342,"target":14353},{"edgeType":"contains","source":6540,"target":6759},{"edgeType":"contains","source":9451,"target":9536},{"edgeType":"contains","source":7459,"target":7867},{"edgeType":"contains","source":5290,"target":5347},{"edgeType":"imports","source":10832,"target":2734},{"edgeType":"contains","source":15993,"target":16023},{"edgeType":"contains","source":3436,"target":3626},{"edgeType":"calls","source":2877,"target":679},{"edgeType":"contains","source":15993,"target":16025},{"edgeType":"imports","source":1715,"target":2079},{"edgeType":"contains","source":8259,"target":8438},{"edgeType":"contains","source":10379,"target":10365},{"edgeType":"imports","source":15758,"target":4352},{"edgeType":"contains","source":14342,"target":14354},{"edgeType":"contains","source":987,"target":1327},{"edgeType":"calls","source":8500,"target":8208},{"edgeType":"contains","source":13361,"target":13057},{"edgeType":"calls","source":4109,"target":540},{"edgeType":"contains","source":15993,"target":16026},{"edgeType":"calls","source":16023,"target":15994},{"edgeType":"contains","source":13021,"target":13026},{"edgeType":"contains","source":8859,"target":8864},{"edgeType":"calls","source":2940,"target":2955},{"edgeType":"contains","source":15003,"target":15005},{"edgeType":"contains","source":987,"target":1326},{"edgeType":"calls","source":6513,"target":6383},{"edgeType":"contains","source":9451,"target":9538},{"edgeType":"calls","source":430,"target":432},{"edgeType":"contains","source":14342,"target":14355},{"edgeType":"imports","source":15758,"target":2236},{"edgeType":"calls","source":11996,"target":11875},{"edgeType":"contains","source":5688,"target":5691},{"edgeType":"contains","source":1,"target":151},{"edgeType":"calls","source":10028,"target":976},{"edgeType":"calls","source":14629,"target":12674},{"edgeType":"calls","source":2876,"target":2855},{"edgeType":"contains","source":16322,"target":16382},{"edgeType":"contains","source":16059,"target":16079},{"edgeType":"contains","source":534,"target":541},{"edgeType":"contains","source":801,"target":2834},{"edgeType":"contains","source":987,"target":1296},{"edgeType":"contains","source":3436,"target":3600},{"edgeType":"contains","source":14661,"target":15021},{"edgeType":"contains","source":16322,"target":16381},{"edgeType":"contains","source":4233,"target":4260},{"edgeType":"calls","source":2479,"target":2479},{"edgeType":"calls","source":12944,"target":3600},{"edgeType":"contains","source":10426,"target":11005},{"edgeType":"contains","source":3488,"target":4101},{"edgeType":"calls","source":11859,"target":11867},{"edgeType":"contains","source":3436,"target":3599},{"edgeType":"imports","source":14288,"target":13978},{"edgeType":"contains","source":8713,"target":9142},{"edgeType":"calls","source":1490,"target":1427},{"edgeType":"contains","source":534,"target":543},{"edgeType":"contains","source":4233,"target":4259},{"edgeType":"contains","source":15399,"target":15400},{"edgeType":"contains","source":10426,"target":11001},{"edgeType":"contains","source":10436,"target":2236},{"edgeType":"contains","source":534,"target":542},{"edgeType":"contains","source":12888,"target":12900},{"edgeType":"contains","source":4230,"target":4351},{"edgeType":"contains","source":4497,"target":4531},{"edgeType":"contains","source":15928,"target":15914},{"edgeType":"contains","source":12624,"target":12628},{"edgeType":"contains","source":9249,"target":9437},{"edgeType":"contains","source":11431,"target":11558},{"edgeType":"calls","source":1554,"target":1551},{"edgeType":"contains","source":5290,"target":5324},{"edgeType":"contains","source":534,"target":545},{"edgeType":"contains","source":12888,"target":12899},{"edgeType":"contains","source":10426,"target":10999},{"edgeType":"calls","source":10739,"target":10651},{"edgeType":"contains","source":930,"target":953},{"edgeType":"contains","source":3507,"target":3517},{"edgeType":"contains","source":534,"target":544},{"edgeType":"contains","source":3309,"target":3313},{"edgeType":"imports","source":7458,"target":7957},{"edgeType":"contains","source":12888,"target":12898},{"edgeType":"calls","source":8366,"target":8107},{"edgeType":"contains","source":10379,"target":10343},{"edgeType":"calls","source":3767,"target":600},{"edgeType":"contains","source":4230,"target":4357},{"edgeType":"imports","source":8036,"target":612},{"edgeType":"calls","source":7169,"target":7161},{"edgeType":"contains","source":8594,"target":8596},{"edgeType":"calls","source":358,"target":573},{"edgeType":"contains","source":14661,"target":15026},{"edgeType":"calls","source":10515,"target":680},{"edgeType":"contains","source":13417,"target":13411},{"edgeType":"calls","source":2211,"target":209},{"edgeType":"contains","source":12888,"target":12897},{"edgeType":"contains","source":534,"target":547},{"edgeType":"calls","source":6991,"target":6337},{"edgeType":"contains","source":15267,"target":15268},{"edgeType":"imports","source":3786,"target":3403},{"edgeType":"calls","source":6598,"target":5836},{"edgeType":"calls","source":10739,"target":10649},{"edgeType":"imports","source":12164,"target":12167},{"edgeType":"contains","source":10426,"target":10997},{"edgeType":"calls","source":8502,"target":8121},{"edgeType":"imports","source":10832,"target":611},{"edgeType":"contains","source":987,"target":1302},{"edgeType":"calls","source":14520,"target":13940},{"edgeType":"contains","source":534,"target":546},{"edgeType":"contains","source":4497,"target":4535},{"edgeType":"calls","source":15444,"target":2207},{"edgeType":"contains","source":4230,"target":4355},{"edgeType":"imports","source":10832,"target":610},{"edgeType":"imports","source":15401,"target":611},{"edgeType":"contains","source":930,"target":954},{"edgeType":"contains","source":5092,"target":5116},{"edgeType":"contains","source":1778,"target":2153},{"edgeType":"contains","source":15130,"target":15272},{"edgeType":"contains","source":9222,"target":8168},{"edgeType":"contains","source":5159,"target":5161},{"edgeType":"contains","source":9451,"target":9525},{"edgeType":"contains","source":14584,"target":8943},{"edgeType":"contains","source":4168,"target":4171},{"edgeType":"imports","source":5293,"target":5295},{"edgeType":"calls","source":1250,"target":400},{"edgeType":"contains","source":4233,"target":4270},{"edgeType":"contains","source":10692,"target":2766},{"edgeType":"calls","source":2913,"target":1700},{"edgeType":"calls","source":2876,"target":2847},{"edgeType":"contains","source":15130,"target":15273},{"edgeType":"contains","source":2510,"target":2717},{"edgeType":"contains","source":534,"target":548},{"edgeType":"calls","source":14783,"target":14252},{"edgeType":"imports","source":12378,"target":9756},{"edgeType":"contains","source":4101,"target":4133},{"edgeType":"calls","source":11019,"target":10433},{"edgeType":"contains","source":14936,"target":14945},{"edgeType":"contains","source":5092,"target":5122},{"edgeType":"contains","source":10379,"target":10356},{"edgeType":"contains","source":987,"target":1303},{"edgeType":"calls","source":9679,"target":9688},{"edgeType":"imports","source":15619,"target":14987},{"edgeType":"contains","source":1063,"target":1065},{"edgeType":"contains","source":8594,"target":8611},{"edgeType":"calls","source":1911,"target":1052},{"edgeType":"contains","source":4233,"target":4268},{"edgeType":"contains","source":9875,"target":611},{"edgeType":"contains","source":4168,"target":4169},{"edgeType":"contains","source":3436,"target":3606},{"edgeType":"contains","source":8838,"target":9503},{"edgeType":"contains","source":16719,"target":16754},{"edgeType":"calls","source":9533,"target":1533},{"edgeType":"contains","source":5092,"target":5121},{"edgeType":"contains","source":4696,"target":4713},{"edgeType":"contains","source":12888,"target":12909},{"edgeType":"contains","source":14936,"target":14946},{"edgeType":"contains","source":10426,"target":11010},{"edgeType":"contains","source":8330,"target":8339},{"edgeType":"contains","source":15130,"target":15274},{"edgeType":"contains","source":5290,"target":5325},{"edgeType":"calls","source":8939,"target":3033},{"edgeType":"contains","source":1063,"target":1064},{"edgeType":"contains","source":4497,"target":4539},{"edgeType":"calls","source":3540,"target":3403},{"edgeType":"calls","source":10650,"target":730},{"edgeType":"imports","source":14871,"target":4352},{"edgeType":"contains","source":16322,"target":16375},{"edgeType":"contains","source":4233,"target":4267},{"edgeType":"contains","source":6018,"target":6019},{"edgeType":"contains","source":8406,"target":8096},{"edgeType":"contains","source":15130,"target":15275},{"edgeType":"contains","source":10692,"target":2765},{"edgeType":"contains","source":3769,"target":3859},{"edgeType":"contains","source":1063,"target":1067},{"edgeType":"contains","source":11303,"target":11304},{"edgeType":"imports","source":6681,"target":2440},{"edgeType":"imports","source":5227,"target":5231},{"edgeType":"contains","source":8330,"target":8333},{"edgeType":"contains","source":12624,"target":12635},{"edgeType":"contains","source":4233,"target":4274},{"edgeType":"calls","source":7170,"target":7137},{"edgeType":"contains","source":2510,"target":2720},{"edgeType":"contains","source":15130,"target":15276},{"edgeType":"contains","source":5159,"target":5164},{"edgeType":"contains","source":1063,"target":1066},{"edgeType":"contains","source":987,"target":1308},{"edgeType":"contains","source":10118,"target":9986},{"edgeType":"contains","source":11303,"target":11305},{"edgeType":"imports","source":6305,"target":1410},{"edgeType":"calls","source":10473,"target":10447},{"edgeType":"contains","source":4168,"target":4174},{"edgeType":"contains","source":8330,"target":8332},{"edgeType":"contains","source":12624,"target":12634},{"edgeType":"contains","source":10966,"target":611},{"edgeType":"contains","source":14936,"target":14949},{"edgeType":"contains","source":15130,"target":15277},{"edgeType":"calls","source":7461,"target":4459},{"edgeType":"contains","source":9321,"target":9325},{"edgeType":"contains","source":16322,"target":16380},{"edgeType":"contains","source":987,"target":1311},{"edgeType":"calls","source":6046,"target":6047},{"edgeType":"imports","source":2153,"target":1169},{"edgeType":"contains","source":1657,"target":1678},{"edgeType":"imports","source":16747,"target":15954},{"edgeType":"calls","source":12322,"target":12322},{"edgeType":"contains","source":1,"target":166},{"edgeType":"contains","source":15130,"target":15278},{"edgeType":"contains","source":12624,"target":12633},{"edgeType":"contains","source":801,"target":734},{"edgeType":"imports","source":15649,"target":7714},{"edgeType":"contains","source":2510,"target":2718},{"edgeType":"contains","source":987,"target":1310},{"edgeType":"calls","source":10076,"target":10072},{"edgeType":"contains","source":16322,"target":16379},{"edgeType":"contains","source":1063,"target":1068},{"edgeType":"contains","source":7517,"target":6055},{"edgeType":"calls","source":6251,"target":6033},{"edgeType":"contains","source":3436,"target":3609},{"edgeType":"contains","source":4168,"target":4172},{"edgeType":"contains","source":15130,"target":15279},{"edgeType":"imports","source":9472,"target":8937},{"edgeType":"calls","source":1290,"target":1271},{"edgeType":"contains","source":15993,"target":15994},{"edgeType":"contains","source":987,"target":1280},{"edgeType":"contains","source":12821,"target":12849},{"edgeType":"calls","source":16090,"target":15991},{"edgeType":"contains","source":16719,"target":16743},{"edgeType":"contains","source":6080,"target":6183},{"edgeType":"contains","source":8838,"target":9476},{"edgeType":"imports","source":8,"target":61},{"edgeType":"contains","source":5885,"target":5886},{"edgeType":"calls","source":10806,"target":10668},{"edgeType":"imports","source":2618,"target":1600},{"edgeType":"calls","source":16828,"target":16367},{"edgeType":"contains","source":16719,"target":16742},{"edgeType":"contains","source":801,"target":2817},{"edgeType":"contains","source":930,"target":932},{"edgeType":"contains","source":987,"target":1279},{"edgeType":"contains","source":5671,"target":6178},{"edgeType":"calls","source":286,"target":645},{"edgeType":"imports","source":1375,"target":2079},{"edgeType":"contains","source":3436,"target":3582},{"edgeType":"contains","source":5290,"target":5302},{"edgeType":"calls","source":11737,"target":11404},{"edgeType":"contains","source":14936,"target":14937},{"edgeType":"contains","source":11431,"target":11544},{"edgeType":"calls","source":15233,"target":15076},{"edgeType":"calls","source":9316,"target":8232},{"edgeType":"imports","source":14033,"target":7132},{"edgeType":"contains","source":15993,"target":15996},{"edgeType":"contains","source":987,"target":1282},{"edgeType":"contains","source":15335,"target":15253},{"edgeType":"imports","source":15204,"target":15229},{"edgeType":"imports","source":15349,"target":4392},{"edgeType":"imports","source":15130,"target":610},{"edgeType":"calls","source":6854,"target":6336},{"edgeType":"calls","source":3166,"target":156},{"edgeType":"imports","source":15747,"target":15308},{"edgeType":"contains","source":2510,"target":2689},{"edgeType":"contains","source":6080,"target":6185},{"edgeType":"contains","source":987,"target":1281},{"edgeType":"calls","source":14866,"target":1079},{"edgeType":"contains","source":16719,"target":16744},{"edgeType":"contains","source":4168,"target":4143},{"edgeType":"calls","source":7709,"target":972},{"edgeType":"calls","source":4948,"target":4108},{"edgeType":"calls","source":13756,"target":12234},{"edgeType":"contains","source":6080,"target":6186},{"edgeType":"calls","source":8886,"target":8880},{"edgeType":"contains","source":15861,"target":15862},{"edgeType":"calls","source":7303,"target":7217},{"edgeType":"calls","source":4083,"target":3438},{"edgeType":"contains","source":12152,"target":3987},{"edgeType":"calls","source":15625,"target":15603},{"edgeType":"calls","source":2874,"target":2863},{"edgeType":"contains","source":9451,"target":9496},{"edgeType":"calls","source":10585,"target":609},{"edgeType":"contains","source":2510,"target":2695},{"edgeType":"contains","source":8789,"target":8877},{"edgeType":"contains","source":8838,"target":9472},{"edgeType":"contains","source":8158,"target":3070},{"edgeType":"calls","source":12918,"target":12851},{"edgeType":"imports","source":6087,"target":6113},{"edgeType":"calls","source":3601,"target":3581},{"edgeType":"contains","source":13152,"target":13154},{"edgeType":"contains","source":987,"target":1283},{"edgeType":"calls","source":1027,"target":925},{"edgeType":"imports","source":15318,"target":7459},{"edgeType":"calls","source":14440,"target":14291},{"edgeType":"contains","source":662,"target":787},{"edgeType":"contains","source":4497,"target":4520},{"edgeType":"contains","source":12095,"target":12096},{"edgeType":"contains","source":987,"target":1286},{"edgeType":"calls","source":6321,"target":5950},{"edgeType":"contains","source":11497,"target":11605},{"edgeType":"contains","source":16322,"target":16372},{"edgeType":"contains","source":13152,"target":13153},{"edgeType":"contains","source":14584,"target":8941},{"edgeType":"contains","source":8789,"target":8879},{"edgeType":"contains","source":4497,"target":4519},{"edgeType":"imports","source":14182,"target":2510},{"edgeType":"contains","source":2510,"target":2693},{"edgeType":"contains","source":5037,"target":4691},{"edgeType":"calls","source":9684,"target":1058},{"edgeType":"contains","source":9057,"target":9027},{"edgeType":"calls","source":2549,"target":2367},{"edgeType":"contains","source":14584,"target":8942},{"edgeType":"contains","source":6080,"target":6182},{"edgeType":"calls","source":2279,"target":2281},{"edgeType":"imports","source":8076,"target":7876},{"edgeType":"contains","source":8789,"target":8878},{"edgeType":"calls","source":15715,"target":2246},{"edgeType":"calls","source":4084,"target":3403},{"edgeType":"contains","source":9281,"target":2094},{"edgeType":"contains","source":16719,"target":16735},{"edgeType":"calls","source":15892,"target":15795},{"edgeType":"calls","source":9904,"target":2698},{"edgeType":"contains","source":4959,"target":5002},{"edgeType":"contains","source":10426,"target":10995},{"edgeType":"contains","source":998,"target":947},{"edgeType":"calls","source":3102,"target":2134},{"edgeType":"contains","source":1657,"target":1660},{"edgeType":"calls","source":2942,"target":2866},{"edgeType":"contains","source":987,"target":1287},{"edgeType":"calls","source":8887,"target":8855},{"edgeType":"imports","source":2618,"target":1607},{"edgeType":"contains","source":7460,"target":7807},{"edgeType":"contains","source":16719,"target":16734},{"edgeType":"contains","source":9451,"target":9507},{"edgeType":"contains","source":1657,"target":1661},{"edgeType":"contains","source":1,"target":142},{"edgeType":"contains","source":1,"target":145},{"edgeType":"contains","source":16719,"target":16737},{"edgeType":"calls","source":3003,"target":972},{"edgeType":"contains","source":4696,"target":4697},{"edgeType":"contains","source":534,"target":535},{"edgeType":"calls","source":3010,"target":2869},{"edgeType":"contains","source":8594,"target":8595},{"edgeType":"calls","source":6941,"target":1533},{"edgeType":"calls","source":14964,"target":14968},{"edgeType":"contains","source":2510,"target":2697},{"edgeType":"contains","source":1657,"target":1658},{"edgeType":"contains","source":15399,"target":15376},{"edgeType":"contains","source":16719,"target":16736},{"edgeType":"contains","source":3488,"target":4090},{"edgeType":"calls","source":9904,"target":2699},{"edgeType":"calls","source":7531,"target":156},{"edgeType":"imports","source":15204,"target":15220},{"edgeType":"imports","source":12759,"target":4339},{"edgeType":"contains","source":1657,"target":1659},{"edgeType":"calls","source":15711,"target":2375},{"edgeType":"contains","source":13290,"target":13113},{"edgeType":"contains","source":468,"target":469},{"edgeType":"contains","source":4230,"target":4350},{"edgeType":"contains","source":4564,"target":4567},{"edgeType":"contains","source":11431,"target":11547},{"edgeType":"contains","source":11497,"target":11615},{"edgeType":"calls","source":286,"target":634},{"edgeType":"calls","source":12478,"target":11699},{"edgeType":"contains","source":6080,"target":6187},{"edgeType":"contains","source":1657,"target":1664},{"edgeType":"contains","source":3507,"target":3509},{"edgeType":"calls","source":4150,"target":3468},{"edgeType":"contains","source":4230,"target":4349},{"edgeType":"contains","source":8329,"target":8346},{"edgeType":"contains","source":16719,"target":16738},{"edgeType":"contains","source":534,"target":536},{"edgeType":"imports","source":15828,"target":4326},{"edgeType":"contains","source":12888,"target":12890},{"edgeType":"imports","source":15800,"target":15764},{"edgeType":"contains","source":4564,"target":4566},{"edgeType":"contains","source":1657,"target":1665},{"edgeType":"contains","source":11497,"target":11616},{"edgeType":"calls","source":6807,"target":5690},{"edgeType":"contains","source":8259,"target":8402},{"edgeType":"imports","source":14609,"target":14632},{"edgeType":"contains","source":1406,"target":986},{"edgeType":"contains","source":16719,"target":16741},{"edgeType":"calls","source":15167,"target":15013},{"edgeType":"contains","source":4564,"target":4565},{"edgeType":"contains","source":12888,"target":12889},{"edgeType":"contains","source":534,"target":539},{"edgeType":"calls","source":2543,"target":2544},{"edgeType":"calls","source":8852,"target":1491},{"edgeType":"contains","source":7459,"target":7835},{"edgeType":"contains","source":10550,"target":803},{"edgeType":"imports","source":14954,"target":8168},{"edgeType":"contains","source":16059,"target":16061},{"edgeType":"contains","source":14661,"target":15003},{"edgeType":"calls","source":7067,"target":6088},{"edgeType":"calls","source":3600,"target":3603},{"edgeType":"calls","source":11737,"target":11415},{"edgeType":"contains","source":4233,"target":4254},{"edgeType":"contains","source":4973,"target":4569},{"edgeType":"contains","source":534,"target":538},{"edgeType":"calls","source":15913,"target":4572},{"edgeType":"contains","source":4696,"target":4700},{"edgeType":"imports","source":15204,"target":15215},{"edgeType":"contains","source":998,"target":952},{"edgeType":"calls","source":4525,"target":4524},{"edgeType":"calls","source":4657,"target":4660},{"edgeType":"contains","source":11431,"target":11546},{"edgeType":"contains","source":14584,"target":8934},{"edgeType":"imports","source":6305,"target":5690},{"edgeType":"imports","source":14609,"target":14634},{"edgeType":"contains","source":4691,"target":4829},{"edgeType":"contains","source":5422,"target":5423},{"edgeType":"contains","source":8838,"target":9460},{"edgeType":"contains","source":14208,"target":14232},{"edgeType":"contains","source":4825,"target":4903},{"edgeType":"contains","source":8659,"target":8667},{"edgeType":"calls","source":1618,"target":1652},{"edgeType":"imports","source":6305,"target":5676},{"edgeType":"contains","source":1719,"target":1827},{"edgeType":"contains","source":8527,"target":8531},{"edgeType":"contains","source":10435,"target":10692},{"edgeType":"calls","source":3933,"target":3880},{"edgeType":"calls","source":15604,"target":7786},{"edgeType":"imports","source":15204,"target":15210},{"edgeType":"contains","source":3436,"target":3567},{"edgeType":"contains","source":16719,"target":16727},{"edgeType":"contains","source":4691,"target":4828},{"edgeType":"contains","source":4825,"target":4902},{"edgeType":"contains","source":8659,"target":8666},{"edgeType":"contains","source":2510,"target":2676},{"edgeType":"calls","source":7237,"target":7129},{"edgeType":"contains","source":15858,"target":15935},{"edgeType":"contains","source":8527,"target":8530},{"edgeType":"contains","source":16719,"target":16726},{"edgeType":"imports","source":13217,"target":13385},{"edgeType":"contains","source":1719,"target":1828},{"edgeType":"contains","source":1127,"target":1150},{"edgeType":"contains","source":3488,"target":4068},{"edgeType":"contains","source":10707,"target":10717},{"edgeType":"calls","source":12198,"target":11895},{"edgeType":"contains","source":4691,"target":4827},{"edgeType":"contains","source":2449,"target":2450},{"edgeType":"contains","source":15858,"target":15936},{"edgeType":"contains","source":15856,"target":15998},{"edgeType":"contains","source":1719,"target":1825},{"edgeType":"calls","source":1112,"target":427},{"edgeType":"contains","source":998,"target":924},{"edgeType":"calls","source":8569,"target":8121},{"edgeType":"contains","source":8527,"target":8533},{"edgeType":"contains","source":10707,"target":10714},{"edgeType":"calls","source":2676,"target":2678},{"edgeType":"contains","source":9466,"target":2678},{"edgeType":"contains","source":13437,"target":12761},{"edgeType":"imports","source":15349,"target":4375},{"edgeType":"contains","source":16719,"target":16729},{"edgeType":"contains","source":3436,"target":3563},{"edgeType":"contains","source":9581,"target":9683},{"edgeType":"contains","source":4970,"target":4633},{"edgeType":"contains","source":4691,"target":4826},{"edgeType":"contains","source":4497,"target":4498},{"edgeType":"calls","source":15851,"target":2246},{"edgeType":"contains","source":1719,"target":1826},{"edgeType":"contains","source":8527,"target":8532},{"edgeType":"calls","source":1046,"target":358},{"edgeType":"contains","source":10971,"target":10987},{"edgeType":"contains","source":13416,"target":13411},{"edgeType":"contains","source":3436,"target":3564},{"edgeType":"contains","source":10550,"target":780},{"edgeType":"contains","source":10971,"target":10984},{"edgeType":"contains","source":1719,"target":1831},{"edgeType":"contains","source":2449,"target":2456},{"edgeType":"contains","source":8659,"target":8663},{"edgeType":"contains","source":6611,"target":6614},{"edgeType":"contains","source":15858,"target":15938},{"edgeType":"imports","source":14609,"target":14625},{"edgeType":"calls","source":6639,"target":6644},{"edgeType":"calls","source":15237,"target":2246},{"edgeType":"calls","source":1227,"target":1084},{"edgeType":"imports","source":10385,"target":8161},{"edgeType":"calls","source":4530,"target":2283},{"edgeType":"contains","source":3436,"target":3571},{"edgeType":"contains","source":16719,"target":16731},{"edgeType":"contains","source":998,"target":926},{"edgeType":"contains","source":11412,"target":12111},{"edgeType":"contains","source":11430,"target":11553},{"edgeType":"calls","source":14519,"target":13940},{"edgeType":"contains","source":6080,"target":6163},{"edgeType":"contains","source":1719,"target":1832},{"edgeType":"imports","source":10385,"target":8159},{"edgeType":"imports","source":14609,"target":14623},{"edgeType":"contains","source":8659,"target":8662},{"edgeType":"calls","source":3538,"target":3438},{"edgeType":"contains","source":12617,"target":12810},{"edgeType":"contains","source":15858,"target":15939},{"edgeType":"imports","source":14609,"target":14624},{"edgeType":"contains","source":4825,"target":4906},{"edgeType":"calls","source":349,"target":819},{"edgeType":"contains","source":11412,"target":12112},{"edgeType":"contains","source":11430,"target":11554},{"edgeType":"contains","source":14341,"target":14343},{"edgeType":"imports","source":15204,"target":15205},{"edgeType":"contains","source":16719,"target":16730},{"edgeType":"calls","source":2940,"target":2946},{"edgeType":"contains","source":8659,"target":8665},{"edgeType":"calls","source":1553,"target":1551},{"edgeType":"imports","source":1055,"target":1406},{"edgeType":"contains","source":8527,"target":8529},{"edgeType":"contains","source":10707,"target":10710},{"edgeType":"contains","source":11040,"target":387},{"edgeType":"imports","source":10832,"target":2758},{"edgeType":"contains","source":5890,"target":5712},{"edgeType":"contains","source":4825,"target":4905},{"edgeType":"calls","source":2411,"target":2433},{"edgeType":"calls","source":8094,"target":8050},{"edgeType":"contains","source":16719,"target":16733},{"edgeType":"contains","source":11412,"target":12109},{"edgeType":"contains","source":7459,"target":7810},{"edgeType":"contains","source":7460,"target":7781},{"edgeType":"contains","source":10971,"target":10983},{"edgeType":"contains","source":10550,"target":779},{"edgeType":"contains","source":8994,"target":8849},{"edgeType":"contains","source":4825,"target":4904},{"edgeType":"calls","source":3469,"target":3461},{"edgeType":"imports","source":12706,"target":3855},{"edgeType":"contains","source":8659,"target":8664},{"edgeType":"contains","source":12190,"target":11246},{"edgeType":"contains","source":2449,"target":2455},{"edgeType":"contains","source":2336,"target":1730},{"edgeType":"contains","source":10426,"target":10965},{"edgeType":"contains","source":8527,"target":8528},{"edgeType":"contains","source":7139,"target":7161},{"edgeType":"contains","source":12028,"target":12040},{"edgeType":"contains","source":10707,"target":10711},{"edgeType":"contains","source":11040,"target":388},{"edgeType":"calls","source":6318,"target":6028},{"edgeType":"contains","source":16719,"target":16732},{"edgeType":"calls","source":2856,"target":1323},{"edgeType":"calls","source":760,"target":764},{"edgeType":"contains","source":11412,"target":12110},{"edgeType":"contains","source":2510,"target":2683},{"edgeType":"contains","source":6080,"target":6174},{"edgeType":"calls","source":6998,"target":6089},{"edgeType":"contains","source":7517,"target":6023},{"edgeType":"contains","source":1719,"target":1835},{"edgeType":"contains","source":1,"target":126},{"edgeType":"imports","source":14340,"target":8161},{"edgeType":"calls","source":1418,"target":1501},{"edgeType":"contains","source":4825,"target":4911},{"edgeType":"contains","source":2510,"target":2684},{"edgeType":"contains","source":5290,"target":5294},{"edgeType":"contains","source":7139,"target":7172},{"edgeType":"contains","source":16322,"target":16340},{"edgeType":"contains","source":1719,"target":1836},{"edgeType":"contains","source":11497,"target":11604},{"edgeType":"contains","source":4230,"target":4329},{"edgeType":"contains","source":9350,"target":2051},{"edgeType":"contains","source":6080,"target":6176},{"edgeType":"contains","source":8838,"target":9467},{"edgeType":"contains","source":12293,"target":12296},{"edgeType":"contains","source":4825,"target":4910},{"edgeType":"calls","source":1619,"target":1615},{"edgeType":"calls","source":9490,"target":9175},{"edgeType":"calls","source":15249,"target":8230},{"edgeType":"contains","source":2510,"target":2681},{"edgeType":"calls","source":3605,"target":3468},{"edgeType":"contains","source":1719,"target":1833},{"edgeType":"calls","source":6850,"target":6451},{"edgeType":"contains","source":5754,"target":5712},{"edgeType":"contains","source":4233,"target":4235},{"edgeType":"contains","source":10435,"target":10698},{"edgeType":"contains","source":8131,"target":8133},{"edgeType":"contains","source":14671,"target":14672},{"edgeType":"contains","source":6080,"target":6177},{"edgeType":"contains","source":662,"target":778},{"edgeType":"contains","source":987,"target":1273},{"edgeType":"contains","source":4825,"target":4909},{"edgeType":"contains","source":801,"target":697},{"edgeType":"imports","source":5659,"target":2440},{"edgeType":"contains","source":15858,"target":15929},{"edgeType":"contains","source":1719,"target":1834},{"edgeType":"calls","source":6113,"target":6054},{"edgeType":"calls","source":7011,"target":5690},{"edgeType":"contains","source":16719,"target":16720},{"edgeType":"contains","source":14661,"target":14983},{"edgeType":"calls","source":2875,"target":2844},{"edgeType":"contains","source":12293,"target":12294},{"edgeType":"contains","source":4825,"target":4908},{"edgeType":"calls","source":13729,"target":13063},{"edgeType":"contains","source":9451,"target":9488},{"edgeType":"contains","source":10243,"target":10305},{"edgeType":"contains","source":13350,"target":13351},{"edgeType":"calls","source":4289,"target":3403},{"edgeType":"contains","source":15858,"target":15930},{"edgeType":"contains","source":4101,"target":4105},{"edgeType":"contains","source":10435,"target":10696},{"edgeType":"contains","source":1406,"target":972},{"edgeType":"contains","source":4825,"target":4915},{"edgeType":"contains","source":1244,"target":1766},{"edgeType":"calls","source":3076,"target":2952},{"edgeType":"contains","source":14340,"target":14365},{"edgeType":"calls","source":4526,"target":4511},{"edgeType":"contains","source":5092,"target":5094},{"edgeType":"contains","source":13369,"target":12761},{"edgeType":"calls","source":14041,"target":13968},{"edgeType":"contains","source":15858,"target":15931},{"edgeType":"contains","source":4825,"target":4914},{"edgeType":"calls","source":626,"target":680},{"edgeType":"contains","source":8329,"target":8330},{"edgeType":"contains","source":16719,"target":16722},{"edgeType":"calls","source":10811,"target":10506},{"edgeType":"contains","source":2510,"target":2685},{"edgeType":"contains","source":5092,"target":5093},{"edgeType":"contains","source":6540,"target":6711},{"edgeType":"contains","source":930,"target":931},{"edgeType":"contains","source":9322,"target":9261},{"edgeType":"calls","source":4015,"target":3438},{"edgeType":"contains","source":10243,"target":10303},{"edgeType":"contains","source":1719,"target":1837},{"edgeType":"contains","source":4825,"target":4913},{"edgeType":"contains","source":14671,"target":14676},{"edgeType":"calls","source":15294,"target":15288},{"edgeType":"contains","source":16719,"target":16725},{"edgeType":"calls","source":6966,"target":4974},{"edgeType":"contains","source":1,"target":133},{"edgeType":"contains","source":1244,"target":1764},{"edgeType":"contains","source":8838,"target":9466},{"edgeType":"imports","source":6087,"target":6089},{"edgeType":"contains","source":7301,"target":6376},{"edgeType":"contains","source":15858,"target":15933},{"edgeType":"contains","source":14208,"target":14231},{"edgeType":"contains","source":5659,"target":6540},{"edgeType":"contains","source":10426,"target":10974},{"edgeType":"imports","source":14871,"target":14952},{"edgeType":"contains","source":4101,"target":4102},{"edgeType":"imports","source":12378,"target":1331},{"edgeType":"calls","source":2757,"target":156},{"edgeType":"contains","source":4230,"target":4331},{"edgeType":"contains","source":7139,"target":7169},{"edgeType":"calls","source":15235,"target":15004},{"edgeType":"contains","source":2510,"target":2686},{"edgeType":"contains","source":801,"target":700},{"edgeType":"contains","source":4825,"target":4912},{"edgeType":"calls","source":1090,"target":1096},{"edgeType":"calls","source":1109,"target":601},{"edgeType":"contains","source":7139,"target":7146},{"edgeType":"contains","source":5025,"target":5029},{"edgeType":"contains","source":11412,"target":12099},{"edgeType":"contains","source":3436,"target":3550},{"edgeType":"contains","source":6080,"target":6150},{"edgeType":"contains","source":4825,"target":4886},{"edgeType":"contains","source":15529,"target":15546},{"edgeType":"calls","source":894,"target":924},{"edgeType":"contains","source":10046,"target":10050},{"edgeType":"contains","source":4352,"target":4751},{"edgeType":"contains","source":12028,"target":12031},{"edgeType":"calls","source":1027,"target":1028},{"edgeType":"contains","source":5025,"target":5028},{"edgeType":"contains","source":10971,"target":10973},{"edgeType":"contains","source":8848,"target":9132},{"edgeType":"contains","source":11412,"target":12100},{"edgeType":"contains","source":15529,"target":15547},{"edgeType":"contains","source":8907,"target":3075},{"edgeType":"calls","source":9880,"target":1417},{"edgeType":"calls","source":10801,"target":349},{"edgeType":"contains","source":2510,"target":2659},{"edgeType":"contains","source":882,"target":272},{"edgeType":"contains","source":12028,"target":12030},{"edgeType":"contains","source":15858,"target":15918},{"edgeType":"contains","source":15856,"target":15980},{"edgeType":"contains","source":8259,"target":8365},{"edgeType":"contains","source":10046,"target":10051},{"edgeType":"imports","source":16315,"target":4072},{"edgeType":"contains","source":5025,"target":5027},{"edgeType":"calls","source":2760,"target":156},{"edgeType":"contains","source":11412,"target":12097},{"edgeType":"calls","source":1952,"target":1953},{"edgeType":"contains","source":13415,"target":13427},{"edgeType":"contains","source":1127,"target":1137},{"edgeType":"contains","source":3436,"target":3548},{"edgeType":"calls","source":10091,"target":3336},{"edgeType":"calls","source":5004,"target":358},{"edgeType":"contains","source":15529,"target":15548},{"edgeType":"calls","source":14967,"target":14966},{"edgeType":"imports","source":8797,"target":8807},{"edgeType":"contains","source":16322,"target":16335},{"edgeType":"contains","source":8259,"target":8368},{"edgeType":"contains","source":10046,"target":10048},{"edgeType":"calls","source":3274,"target":3249},{"edgeType":"contains","source":12028,"target":12029},{"edgeType":"contains","source":15856,"target":15981},{"edgeType":"contains","source":3769,"target":3794},{"edgeType":"calls","source":16092,"target":16031},{"edgeType":"contains","source":5025,"target":5026},{"edgeType":"contains","source":10751,"target":9334},{"edgeType":"imports","source":13217,"target":13437},{"edgeType":"contains","source":11412,"target":12098},{"edgeType":"contains","source":7139,"target":7149},{"edgeType":"contains","source":7006,"target":7044},{"edgeType":"contains","source":3436,"target":3547},{"edgeType":"contains","source":15529,"target":15549},{"edgeType":"contains","source":1,"target":103},{"edgeType":"calls","source":14802,"target":3162},{"edgeType":"contains","source":16322,"target":16334},{"edgeType":"contains","source":10046,"target":10049},{"edgeType":"calls","source":11139,"target":11013},{"edgeType":"contains","source":10426,"target":10953},{"edgeType":"contains","source":15856,"target":15982},{"edgeType":"calls","source":13976,"target":13977},{"edgeType":"calls","source":15039,"target":2165},{"edgeType":"contains","source":15449,"target":7460},{"edgeType":"contains","source":3436,"target":3554},{"edgeType":"contains","source":1127,"target":1139},{"edgeType":"contains","source":13415,"target":13425},{"edgeType":"contains","source":595,"target":718},{"edgeType":"contains","source":15529,"target":15550},{"edgeType":"contains","source":2510,"target":2662},{"edgeType":"contains","source":4612,"target":5151},{"edgeType":"contains","source":12420,"target":4103},{"edgeType":"imports","source":14183,"target":2510},{"edgeType":"contains","source":12094,"target":12095},{"edgeType":"contains","source":15856,"target":15983},{"edgeType":"calls","source":1229,"target":1104},{"edgeType":"contains","source":987,"target":1250},{"edgeType":"contains","source":15130,"target":15236},{"edgeType":"contains","source":1127,"target":1138},{"edgeType":"contains","source":662,"target":754},{"edgeType":"contains","source":16322,"target":16336},{"edgeType":"contains","source":4612,"target":5150},{"edgeType":"contains","source":3768,"target":3832},{"edgeType":"contains","source":10046,"target":10047},{"edgeType":"calls","source":14571,"target":14557},{"edgeType":"calls","source":10807,"target":2285},{"edgeType":"calls","source":5322,"target":5294},{"edgeType":"contains","source":4352,"target":4753},{"edgeType":"contains","source":15130,"target":15237},{"edgeType":"calls","source":13843,"target":13870},{"edgeType":"contains","source":4825,"target":4889},{"edgeType":"contains","source":3436,"target":3552},{"edgeType":"contains","source":9451,"target":9465},{"edgeType":"contains","source":1127,"target":1141},{"edgeType":"contains","source":13415,"target":13423},{"edgeType":"contains","source":16192,"target":16141},{"edgeType":"calls","source":12941,"target":12235},{"edgeType":"contains","source":595,"target":720},{"edgeType":"contains","source":4612,"target":5149},{"edgeType":"contains","source":4825,"target":4888},{"edgeType":"contains","source":8907,"target":3074},{"edgeType":"calls","source":8691,"target":8687},{"edgeType":"contains","source":10426,"target":10948},{"edgeType":"contains","source":13415,"target":13422},{"edgeType":"calls","source":3207,"target":3209},{"edgeType":"contains","source":12150,"target":12469},{"edgeType":"contains","source":5871,"target":6285},{"edgeType":"contains","source":15993,"target":15968},{"edgeType":"calls","source":14062,"target":7080},{"edgeType":"imports","source":15620,"target":2361},{"edgeType":"contains","source":3436,"target":3551},{"edgeType":"calls","source":6810,"target":5690},{"edgeType":"calls","source":9488,"target":9347},{"edgeType":"contains","source":9642,"target":9885},{"edgeType":"contains","source":4612,"target":5148},{"edgeType":"contains","source":8906,"target":9446},{"edgeType":"calls","source":8098,"target":8043},{"edgeType":"calls","source":6907,"target":6911},{"edgeType":"contains","source":801,"target":679},{"edgeType":"calls","source":13214,"target":12234},{"edgeType":"contains","source":7006,"target":7049},{"edgeType":"calls","source":2023,"target":1856},{"edgeType":"calls","source":15961,"target":15869},{"edgeType":"contains","source":14073,"target":14164},{"edgeType":"contains","source":8789,"target":8857},{"edgeType":"contains","source":2647,"target":2648},{"edgeType":"imports","source":2924,"target":612},{"edgeType":"calls","source":3678,"target":3403},{"edgeType":"contains","source":10707,"target":10708},{"edgeType":"contains","source":11412,"target":12107},{"edgeType":"contains","source":12028,"target":12039},{"edgeType":"contains","source":3638,"target":3639},{"edgeType":"contains","source":9782,"target":9786},{"edgeType":"contains","source":9451,"target":9475},{"edgeType":"contains","source":987,"target":1254},{"edgeType":"contains","source":8906,"target":9457},{"edgeType":"contains","source":1127,"target":1142},{"edgeType":"calls","source":2293,"target":1944},{"edgeType":"contains","source":10707,"target":10709},{"edgeType":"contains","source":12028,"target":12038},{"edgeType":"contains","source":14208,"target":14209},{"edgeType":"contains","source":1719,"target":1820},{"edgeType":"contains","source":3768,"target":3836},{"edgeType":"contains","source":11412,"target":12108},{"edgeType":"contains","source":1,"target":109},{"edgeType":"calls","source":10031,"target":976},{"edgeType":"contains","source":14668,"target":14748},{"edgeType":"contains","source":6080,"target":6160},{"edgeType":"contains","source":3436,"target":3556},{"edgeType":"contains","source":16850,"target":16871},{"edgeType":"contains","source":3488,"target":4058},{"edgeType":"contains","source":10243,"target":10291},{"edgeType":"contains","source":10550,"target":774},{"edgeType":"contains","source":1244,"target":1743},{"edgeType":"contains","source":662,"target":762},{"edgeType":"contains","source":4825,"target":4893},{"edgeType":"contains","source":8659,"target":8661},{"edgeType":"contains","source":6611,"target":6612},{"edgeType":"contains","source":10046,"target":10056},{"edgeType":"contains","source":11412,"target":12105},{"edgeType":"contains","source":1127,"target":1145},{"edgeType":"contains","source":5871,"target":6297},{"edgeType":"calls","source":6669,"target":5836},{"edgeType":"calls","source":2238,"target":1532},{"edgeType":"contains","source":12028,"target":12037},{"edgeType":"contains","source":13289,"target":13113},{"edgeType":"contains","source":14208,"target":14210},{"edgeType":"contains","source":1719,"target":1817},{"edgeType":"contains","source":13359,"target":13057},{"edgeType":"calls","source":1506,"target":972},{"edgeType":"calls","source":11862,"target":11863},{"edgeType":"calls","source":11072,"target":10984},{"edgeType":"imports","source":14112,"target":8937},{"edgeType":"contains","source":10243,"target":10292},{"edgeType":"contains","source":8789,"target":8858},{"edgeType":"contains","source":3436,"target":3555},{"edgeType":"contains","source":662,"target":761},{"edgeType":"contains","source":15529,"target":15541},{"edgeType":"contains","source":6611,"target":6613},{"edgeType":"contains","source":987,"target":1256},{"edgeType":"contains","source":4612,"target":5152},{"edgeType":"calls","source":15237,"target":2377},{"edgeType":"calls","source":8101,"target":7954},{"edgeType":"contains","source":11412,"target":12106},{"edgeType":"calls","source":2282,"target":2283},{"edgeType":"contains","source":14208,"target":14211},{"edgeType":"calls","source":10924,"target":774},{"edgeType":"contains","source":1719,"target":1818},{"edgeType":"contains","source":3768,"target":3834},{"edgeType":"calls","source":5339,"target":4761},{"edgeType":"contains","source":4959,"target":4973},{"edgeType":"contains","source":15529,"target":15542},{"edgeType":"imports","source":3182,"target":3180},{"edgeType":"contains","source":2647,"target":2652},{"edgeType":"contains","source":7006,"target":7045},{"edgeType":"contains","source":1719,"target":1823},{"edgeType":"contains","source":10046,"target":10054},{"edgeType":"calls","source":12723,"target":12661},{"edgeType":"contains","source":7460,"target":7769},{"edgeType":"contains","source":1127,"target":1147},{"edgeType":"contains","source":11412,"target":12103},{"edgeType":"contains","source":14208,"target":14212},{"edgeType":"calls","source":4085,"target":3468},{"edgeType":"contains","source":7006,"target":7046},{"edgeType":"calls","source":14523,"target":13940},{"edgeType":"contains","source":3436,"target":3561},{"edgeType":"calls","source":11603,"target":11442},{"edgeType":"contains","source":14668,"target":14751},{"edgeType":"contains","source":4352,"target":4762},{"edgeType":"imports","source":3182,"target":3179},{"edgeType":"contains","source":662,"target":763},{"edgeType":"contains","source":10751,"target":9340},{"edgeType":"contains","source":2510,"target":2672},{"edgeType":"contains","source":4691,"target":4824},{"edgeType":"calls","source":3744,"target":3468},{"edgeType":"contains","source":3768,"target":3840},{"edgeType":"contains","source":11412,"target":12104},{"edgeType":"contains","source":1127,"target":1146},{"edgeType":"contains","source":10046,"target":10055},{"edgeType":"calls","source":2480,"target":2485},{"edgeType":"calls","source":2463,"target":898},{"edgeType":"imports","source":15204,"target":15246},{"edgeType":"contains","source":9782,"target":9783},{"edgeType":"contains","source":10550,"target":9226},{"edgeType":"contains","source":15529,"target":15544},{"edgeType":"contains","source":11040,"target":378},{"edgeType":"calls","source":8824,"target":8800},{"edgeType":"contains","source":8906,"target":9456},{"edgeType":"contains","source":8789,"target":8855},{"edgeType":"contains","source":15760,"target":14725},{"edgeType":"contains","source":16322,"target":16331},{"edgeType":"contains","source":11412,"target":12101},{"edgeType":"contains","source":12293,"target":12274},{"edgeType":"contains","source":13415,"target":13431},{"edgeType":"contains","source":10046,"target":10052},{"edgeType":"contains","source":9980,"target":9984},{"edgeType":"contains","source":7006,"target":7048},{"edgeType":"calls","source":14896,"target":2375},{"edgeType":"calls","source":5609,"target":4844},{"edgeType":"calls","source":11603,"target":11440},{"edgeType":"contains","source":13415,"target":13430},{"edgeType":"contains","source":8906,"target":9455},{"edgeType":"contains","source":4825,"target":4896},{"edgeType":"contains","source":1127,"target":1148},{"edgeType":"contains","source":2440,"target":611},{"edgeType":"calls","source":2593,"target":1094},{"edgeType":"contains","source":11412,"target":12102},{"edgeType":"calls","source":15226,"target":600},{"edgeType":"contains","source":15529,"target":15545},{"edgeType":"calls","source":9886,"target":9702},{"edgeType":"contains","source":10046,"target":10053},{"edgeType":"contains","source":5871,"target":6294},{"edgeType":"contains","source":1719,"target":1822},{"edgeType":"contains","source":14339,"target":14366},{"edgeType":"contains","source":4072,"target":4958},{"edgeType":"contains","source":4825,"target":4870},{"edgeType":"contains","source":15529,"target":15530},{"edgeType":"contains","source":10435,"target":10658},{"edgeType":"contains","source":4352,"target":4734},{"edgeType":"imports","source":14609,"target":14662},{"edgeType":"contains","source":16850,"target":16861},{"edgeType":"contains","source":15132,"target":15152},{"edgeType":"contains","source":9451,"target":9450},{"edgeType":"contains","source":14868,"target":14880},{"edgeType":"calls","source":4859,"target":4870},{"edgeType":"contains","source":14276,"target":14206},{"edgeType":"contains","source":5871,"target":6271},{"edgeType":"contains","source":6611,"target":6586},{"edgeType":"contains","source":10426,"target":10939},{"edgeType":"contains","source":15132,"target":15153},{"edgeType":"calls","source":11467,"target":11401},{"edgeType":"calls","source":13929,"target":13298},{"edgeType":"contains","source":6080,"target":6135},{"edgeType":"calls","source":13117,"target":13100},{"edgeType":"calls","source":1457,"target":402},{"edgeType":"contains","source":1,"target":87},{"edgeType":"contains","source":3986,"target":3394},{"edgeType":"calls","source":11605,"target":11348},{"edgeType":"contains","source":8259,"target":8351},{"edgeType":"contains","source":15463,"target":15464},{"edgeType":"contains","source":3769,"target":3779},{"edgeType":"calls","source":15956,"target":16001},{"edgeType":"calls","source":1886,"target":1901},{"edgeType":"contains","source":14668,"target":14740},{"edgeType":"contains","source":13290,"target":13057},{"edgeType":"calls","source":12431,"target":540},{"edgeType":"calls","source":15033,"target":15018},{"edgeType":"contains","source":9451,"target":9452},{"edgeType":"calls","source":9682,"target":9655},{"edgeType":"contains","source":15529,"target":15533},{"edgeType":"calls","source":11605,"target":11349},{"edgeType":"calls","source":9549,"target":9550},{"edgeType":"calls","source":14369,"target":14455},{"edgeType":"calls","source":1556,"target":1560},{"edgeType":"contains","source":15403,"target":15211},{"edgeType":"contains","source":10426,"target":10936},{"edgeType":"contains","source":3769,"target":3778},{"edgeType":"contains","source":9838,"target":10138},{"edgeType":"contains","source":9249,"target":9371},{"edgeType":"contains","source":14868,"target":14883},{"edgeType":"contains","source":10426,"target":10933},{"edgeType":"contains","source":15132,"target":15156},{"edgeType":"calls","source":9160,"target":8928},{"edgeType":"imports","source":10550,"target":965},{"edgeType":"calls","source":11861,"target":11874},{"edgeType":"contains","source":14868,"target":14885},{"edgeType":"contains","source":9854,"target":3295},{"edgeType":"calls","source":2155,"target":2014},{"edgeType":"contains","source":8848,"target":9112},{"edgeType":"contains","source":14073,"target":14161},{"edgeType":"contains","source":6540,"target":6669},{"edgeType":"calls","source":14979,"target":8230},{"edgeType":"imports","source":9090,"target":8171},{"edgeType":"calls","source":763,"target":768},{"edgeType":"contains","source":15529,"target":15536},{"edgeType":"contains","source":6212,"target":6267},{"edgeType":"contains","source":4825,"target":4872},{"edgeType":"calls","source":3095,"target":2468},{"edgeType":"contains","source":8848,"target":9115},{"edgeType":"contains","source":8838,"target":9425},{"edgeType":"imports","source":2668,"target":61},{"edgeType":"calls","source":3430,"target":540},{"edgeType":"contains","source":6540,"target":6670},{"edgeType":"calls","source":14011,"target":12873},{"edgeType":"contains","source":3488,"target":4038},{"edgeType":"calls","source":9976,"target":2660},{"edgeType":"imports","source":13217,"target":13415},{"edgeType":"imports","source":9090,"target":8168},{"edgeType":"calls","source":11861,"target":11872},{"edgeType":"contains","source":14868,"target":14887},{"edgeType":"imports","source":16238,"target":4327},{"edgeType":"contains","source":2510,"target":2645},{"edgeType":"calls","source":15033,"target":15014},{"edgeType":"contains","source":10426,"target":10932},{"edgeType":"contains","source":15463,"target":15469},{"edgeType":"contains","source":15856,"target":15970},{"edgeType":"imports","source":9090,"target":8169},{"edgeType":"contains","source":3769,"target":3782},{"edgeType":"contains","source":12420,"target":4083},{"edgeType":"calls","source":4859,"target":4864},{"edgeType":"calls","source":4794,"target":4765},{"edgeType":"contains","source":998,"target":894},{"edgeType":"contains","source":3436,"target":3535},{"edgeType":"contains","source":7459,"target":7778},{"edgeType":"contains","source":2510,"target":2650},{"edgeType":"contains","source":15132,"target":15144},{"edgeType":"imports","source":2434,"target":987},{"edgeType":"contains","source":15986,"target":16153},{"edgeType":"contains","source":7680,"target":937},{"edgeType":"contains","source":1719,"target":1802},{"edgeType":"contains","source":14276,"target":14197},{"edgeType":"calls","source":11861,"target":11878},{"edgeType":"contains","source":4352,"target":4743},{"edgeType":"contains","source":662,"target":743},{"edgeType":"contains","source":5163,"target":4970},{"edgeType":"contains","source":15264,"target":15280},{"edgeType":"contains","source":15986,"target":16154},{"edgeType":"imports","source":14609,"target":14652},{"edgeType":"calls","source":8294,"target":8295},{"edgeType":"calls","source":14074,"target":13040},{"edgeType":"contains","source":14661,"target":14947},{"edgeType":"calls","source":14504,"target":14508},{"edgeType":"calls","source":1952,"target":1958},{"edgeType":"contains","source":10244,"target":10247},{"edgeType":"imports","source":14871,"target":14987},{"edgeType":"contains","source":987,"target":1237},{"edgeType":"calls","source":15033,"target":15025},{"edgeType":"calls","source":2531,"target":925},{"edgeType":"calls","source":15718,"target":2246},{"edgeType":"contains","source":1127,"target":1129},{"edgeType":"imports","source":7006,"target":885},{"edgeType":"contains","source":13415,"target":13419},{"edgeType":"contains","source":15986,"target":16155},{"edgeType":"imports","source":8797,"target":2440},{"edgeType":"contains","source":1995,"target":1700},{"edgeType":"contains","source":13289,"target":13096},{"edgeType":"contains","source":16850,"target":16855},{"edgeType":"contains","source":8848,"target":9127},{"edgeType":"contains","source":987,"target":1240},{"edgeType":"contains","source":998,"target":899},{"edgeType":"calls","source":3014,"target":748},{"edgeType":"contains","source":15132,"target":15147},{"edgeType":"contains","source":15130,"target":15209},{"edgeType":"contains","source":2510,"target":2649},{"edgeType":"contains","source":3768,"target":3817},{"edgeType":"calls","source":9946,"target":9936},{"edgeType":"calls","source":6946,"target":5690},{"edgeType":"contains","source":3436,"target":3539},{"edgeType":"contains","source":662,"target":744},{"edgeType":"contains","source":8907,"target":3069},{"edgeType":"contains","source":987,"target":1239},{"edgeType":"contains","source":3769,"target":3793},{"edgeType":"calls","source":1761,"target":1534},{"edgeType":"contains","source":987,"target":1243},{"edgeType":"contains","source":1127,"target":1131},{"edgeType":"calls","source":15711,"target":4572},{"edgeType":"calls","source":5520,"target":5508},{"edgeType":"calls","source":3339,"target":3354},{"edgeType":"contains","source":1127,"target":1130},{"edgeType":"imports","source":7006,"target":886},{"edgeType":"calls","source":6457,"target":6052},{"edgeType":"contains","source":8259,"target":8352},{"edgeType":"contains","source":15858,"target":15898},{"edgeType":"contains","source":3769,"target":3792},{"edgeType":"contains","source":10426,"target":10943},{"edgeType":"contains","source":14668,"target":14735},{"edgeType":"contains","source":8838,"target":9430},{"edgeType":"contains","source":15132,"target":15149},{"edgeType":"contains","source":15264,"target":15285},{"edgeType":"calls","source":1093,"target":1100},{"edgeType":"contains","source":7459,"target":7786},{"edgeType":"contains","source":7680,"target":935},{"edgeType":"contains","source":5821,"target":5712},{"edgeType":"calls","source":6464,"target":5836},{"edgeType":"contains","source":11762,"target":11805},{"edgeType":"calls","source":14793,"target":3438},{"edgeType":"contains","source":5871,"target":6276},{"edgeType":"calls","source":1952,"target":1957},{"edgeType":"contains","source":3769,"target":3791},{"edgeType":"contains","source":14668,"target":14736},{"edgeType":"calls","source":16090,"target":16079},{"edgeType":"imports","source":9472,"target":9002},{"edgeType":"calls","source":702,"target":540},{"edgeType":"contains","source":11270,"target":1688},{"edgeType":"contains","source":8848,"target":9123},{"edgeType":"imports","source":15821,"target":15132},{"edgeType":"calls","source":15139,"target":5394},{"edgeType":"calls","source":14074,"target":13042},{"edgeType":"calls","source":4290,"target":3468},{"edgeType":"contains","source":3768,"target":3821},{"edgeType":"contains","source":15986,"target":16160},{"edgeType":"calls","source":1227,"target":1176},{"edgeType":"contains","source":5092,"target":5058},{"edgeType":"calls","source":10953,"target":10433},{"edgeType":"contains","source":15264,"target":15287},{"edgeType":"contains","source":8838,"target":9432},{"edgeType":"calls","source":1096,"target":971},{"edgeType":"calls","source":11860,"target":11885},{"edgeType":"contains","source":7006,"target":7008},{"edgeType":"calls","source":2350,"target":2265},{"edgeType":"contains","source":14339,"target":14350},{"edgeType":"calls","source":15035,"target":14937},{"edgeType":"contains","source":15858,"target":15884},{"edgeType":"contains","source":6540,"target":6655},{"edgeType":"contains","source":14075,"target":14078},{"edgeType":"contains","source":2319,"target":2205},{"edgeType":"contains","source":10435,"target":10643},{"edgeType":"contains","source":7680,"target":913},{"edgeType":"contains","source":13018,"target":13017},{"edgeType":"calls","source":15033,"target":15000},{"edgeType":"calls","source":11662,"target":11681},{"edgeType":"contains","source":9642,"target":9854},{"edgeType":"contains","source":8838,"target":9409},{"edgeType":"contains","source":14075,"target":14079},{"edgeType":"contains","source":15858,"target":15885},{"edgeType":"contains","source":6540,"target":6656},{"edgeType":"contains","source":862,"target":863},{"edgeType":"contains","source":11894,"target":11921},{"edgeType":"contains","source":5671,"target":6113},{"edgeType":"calls","source":2348,"target":2325},{"edgeType":"contains","source":15132,"target":15138},{"edgeType":"calls","source":10312,"target":680},{"edgeType":"contains","source":11232,"target":11302},{"edgeType":"imports","source":15636,"target":12473},{"edgeType":"contains","source":8848,"target":9102},{"edgeType":"contains","source":14339,"target":14352},{"edgeType":"contains","source":5883,"target":5884},{"edgeType":"contains","source":4612,"target":5112},{"edgeType":"contains","source":6540,"target":6657},{"edgeType":"imports","source":8259,"target":2264},{"edgeType":"calls","source":427,"target":570},{"edgeType":"imports","source":9794,"target":9644},{"edgeType":"imports","source":7608,"target":7647},{"edgeType":"calls","source":2678,"target":2666},{"edgeType":"imports","source":14777,"target":3162},{"edgeType":"calls","source":14508,"target":14357},{"edgeType":"contains","source":662,"target":719},{"edgeType":"contains","source":1406,"target":909},{"edgeType":"contains","source":6540,"target":6658},{"edgeType":"calls","source":3074,"target":3075},{"edgeType":"contains","source":14075,"target":14081},{"edgeType":"contains","source":15858,"target":15887},{"edgeType":"contains","source":15856,"target":15949},{"edgeType":"contains","source":6540,"target":6651},{"edgeType":"contains","source":15132,"target":15140},{"edgeType":"contains","source":1719,"target":1781},{"edgeType":"contains","source":7070,"target":7134},{"edgeType":"contains","source":13611,"target":13658},{"edgeType":"contains","source":7534,"target":7548},{"edgeType":"contains","source":4547,"target":5019},{"edgeType":"contains","source":1,"target":73},{"edgeType":"contains","source":14075,"target":14082},{"edgeType":"contains","source":15858,"target":15888},{"edgeType":"contains","source":7201,"target":7302},{"edgeType":"contains","source":5871,"target":6250},{"edgeType":"calls","source":9160,"target":8910},{"edgeType":"contains","source":15132,"target":15141},{"edgeType":"contains","source":7070,"target":7135},{"edgeType":"contains","source":13611,"target":13657},{"edgeType":"contains","source":11232,"target":11301},{"edgeType":"calls","source":7867,"target":2485},{"edgeType":"contains","source":7534,"target":7549},{"edgeType":"contains","source":14868,"target":14869},{"edgeType":"imports","source":15749,"target":15305},{"edgeType":"contains","source":14075,"target":14083},{"edgeType":"contains","source":14073,"target":14145},{"edgeType":"contains","source":10435,"target":10639},{"edgeType":"imports","source":6087,"target":6178},{"edgeType":"contains","source":12225,"target":12228},{"edgeType":"contains","source":6540,"target":6652},{"edgeType":"imports","source":13217,"target":13465},{"edgeType":"contains","source":15859,"target":15860},{"edgeType":"contains","source":15858,"target":15891},{"edgeType":"contains","source":13611,"target":13656},{"edgeType":"contains","source":7534,"target":7550},{"edgeType":"calls","source":3008,"target":3002},{"edgeType":"contains","source":6015,"target":6016},{"edgeType":"calls","source":8227,"target":8238},{"edgeType":"contains","source":10836,"target":10889},{"edgeType":"contains","source":4072,"target":4944},{"edgeType":"imports","source":15749,"target":15308},{"edgeType":"contains","source":6540,"target":6653},{"edgeType":"contains","source":15132,"target":15143},{"edgeType":"calls","source":4064,"target":4092},{"edgeType":"contains","source":7534,"target":7551},{"edgeType":"contains","source":6015,"target":6017},{"edgeType":"imports","source":2217,"target":1406},{"edgeType":"contains","source":6540,"target":6654},{"edgeType":"contains","source":10426,"target":10929},{"edgeType":"calls","source":7712,"target":7293},{"edgeType":"calls","source":8888,"target":8891},{"edgeType":"contains","source":15986,"target":16136},{"edgeType":"contains","source":13288,"target":13113},{"edgeType":"calls","source":10672,"target":10668},{"edgeType":"contains","source":3769,"target":3773},{"edgeType":"calls","source":6445,"target":6403},{"edgeType":"calls","source":3806,"target":3630},{"edgeType":"calls","source":12480,"target":11699},{"edgeType":"contains","source":801,"target":645},{"edgeType":"contains","source":15401,"target":15246},{"edgeType":"calls","source":15304,"target":2379},{"edgeType":"calls","source":6809,"target":5690},{"edgeType":"contains","source":6540,"target":6664},{"edgeType":"calls","source":3074,"target":3069},{"edgeType":"contains","source":14997,"target":15085},{"edgeType":"contains","source":3769,"target":3772},{"edgeType":"contains","source":801,"target":648},{"edgeType":"contains","source":10426,"target":10927},{"edgeType":"imports","source":12907,"target":4044},{"edgeType":"contains","source":15264,"target":15266},{"edgeType":"contains","source":4825,"target":4860},{"edgeType":"calls","source":15139,"target":7495},{"edgeType":"contains","source":15856,"target":15940},{"edgeType":"contains","source":3769,"target":3771},{"edgeType":"imports","source":10832,"target":2828},{"edgeType":"contains","source":4825,"target":4859},{"edgeType":"contains","source":862,"target":870},{"edgeType":"contains","source":15130,"target":15192},{"edgeType":"contains","source":3769,"target":3770},{"edgeType":"calls","source":5716,"target":5726},{"edgeType":"calls","source":16024,"target":16000},{"edgeType":"contains","source":4072,"target":4947},{"edgeType":"contains","source":3436,"target":3529},{"edgeType":"imports","source":1375,"target":2150},{"edgeType":"imports","source":12378,"target":1410},{"edgeType":"calls","source":3019,"target":540},{"edgeType":"calls","source":15891,"target":15888},{"edgeType":"contains","source":8848,"target":9105},{"edgeType":"contains","source":7006,"target":7012},{"edgeType":"contains","source":3769,"target":3777},{"edgeType":"contains","source":7680,"target":916},{"edgeType":"contains","source":7534,"target":7556},{"edgeType":"contains","source":6540,"target":6659},{"edgeType":"contains","source":13820,"target":13529},{"edgeType":"calls","source":14045,"target":9699},{"edgeType":"calls","source":6054,"target":5817},{"edgeType":"contains","source":4352,"target":4729},{"edgeType":"contains","source":8848,"target":9104},{"edgeType":"contains","source":15132,"target":15133},{"edgeType":"contains","source":801,"target":649},{"edgeType":"contains","source":7006,"target":7013},{"edgeType":"contains","source":8848,"target":9103},{"edgeType":"contains","source":7459,"target":7768},{"edgeType":"contains","source":7680,"target":917},{"edgeType":"contains","source":15858,"target":15881},{"edgeType":"contains","source":9642,"target":9858},{"edgeType":"imports","source":8259,"target":2263},{"edgeType":"contains","source":3769,"target":3776},{"edgeType":"contains","source":1,"target":83},{"edgeType":"calls","source":9026,"target":8847},{"edgeType":"calls","source":13930,"target":13262},{"edgeType":"contains","source":3436,"target":3527},{"edgeType":"imports","source":15335,"target":2765},{"edgeType":"calls","source":3012,"target":2869},{"edgeType":"contains","source":15264,"target":15270},{"edgeType":"contains","source":4825,"target":4864},{"edgeType":"calls","source":4460,"target":4492},{"edgeType":"calls","source":5716,"target":5723},{"edgeType":"contains","source":15858,"target":15882},{"edgeType":"contains","source":14075,"target":14076},{"edgeType":"contains","source":3769,"target":3775},{"edgeType":"contains","source":4352,"target":4727},{"edgeType":"contains","source":15264,"target":15271},{"edgeType":"contains","source":8848,"target":9106},{"edgeType":"contains","source":11270,"target":1673},{"edgeType":"calls","source":1687,"target":1665},{"edgeType":"contains","source":987,"target":1227},{"edgeType":"calls","source":6913,"target":358},{"edgeType":"contains","source":7460,"target":7739},{"edgeType":"imports","source":8259,"target":2261},{"edgeType":"contains","source":3769,"target":3774},{"edgeType":"contains","source":12028,"target":11999},{"edgeType":"contains","source":2,"target":21},{"edgeType":"contains","source":7534,"target":7536},{"edgeType":"calls","source":14503,"target":14499},{"edgeType":"imports","source":9432,"target":8168},{"edgeType":"contains","source":1982,"target":2064},{"edgeType":"contains","source":11762,"target":11770},{"edgeType":"contains","source":2511,"target":2578},{"edgeType":"calls","source":6753,"target":1058},{"edgeType":"contains","source":1719,"target":1761},{"edgeType":"contains","source":398,"target":429},{"edgeType":"contains","source":11894,"target":11907},{"edgeType":"calls","source":6513,"target":6384},{"edgeType":"contains","source":5816,"target":5828},{"edgeType":"imports","source":15489,"target":4327},{"edgeType":"calls","source":9813,"target":9788},{"edgeType":"calls","source":11794,"target":11800},{"edgeType":"calls","source":11996,"target":11880},{"edgeType":"contains","source":2,"target":20},{"edgeType":"calls","source":6907,"target":6855},{"edgeType":"contains","source":7534,"target":7537},{"edgeType":"contains","source":9642,"target":9838},{"edgeType":"calls","source":7807,"target":2210},{"edgeType":"contains","source":1982,"target":2065},{"edgeType":"contains","source":2511,"target":2579},{"edgeType":"contains","source":15858,"target":15869},{"edgeType":"contains","source":6540,"target":6640},{"edgeType":"calls","source":5004,"target":4570},{"edgeType":"contains","source":4692,"target":4731},{"edgeType":"calls","source":427,"target":585},{"edgeType":"contains","source":398,"target":428},{"edgeType":"contains","source":5816,"target":5829},{"edgeType":"calls","source":8502,"target":8147},{"edgeType":"imports","source":15489,"target":4326},{"edgeType":"contains","source":5480,"target":5675},{"edgeType":"contains","source":7460,"target":7718},{"edgeType":"contains","source":7534,"target":7538},{"edgeType":"contains","source":1982,"target":2062},{"edgeType":"imports","source":10949,"target":5535},{"edgeType":"contains","source":2,"target":23},{"edgeType":"calls","source":3166,"target":238},{"edgeType":"contains","source":6540,"target":6641},{"edgeType":"contains","source":2511,"target":2576},{"edgeType":"contains","source":14661,"target":14924},{"edgeType":"contains","source":5816,"target":5830},{"edgeType":"calls","source":9602,"target":1533},{"edgeType":"calls","source":11464,"target":11458},{"edgeType":"contains","source":7006,"target":6993},{"edgeType":"contains","source":7201,"target":7290},{"edgeType":"contains","source":3488,"target":3999},{"edgeType":"contains","source":13611,"target":13643},{"edgeType":"contains","source":1982,"target":2063},{"edgeType":"contains","source":7534,"target":7539},{"edgeType":"contains","source":1,"target":53},{"edgeType":"contains","source":2,"target":22},{"edgeType":"contains","source":6540,"target":6642},{"edgeType":"contains","source":398,"target":431},{"edgeType":"imports","source":8076,"target":7921},{"edgeType":"contains","source":2511,"target":2577},{"edgeType":"contains","source":15858,"target":15871},{"edgeType":"contains","source":5816,"target":5831},{"edgeType":"calls","source":6592,"target":6052},{"edgeType":"contains","source":11232,"target":11286},{"edgeType":"calls","source":14544,"target":540},{"edgeType":"contains","source":1982,"target":2068},{"edgeType":"contains","source":7006,"target":6987},{"edgeType":"calls","source":2942,"target":2952},{"edgeType":"contains","source":4612,"target":5102},{"edgeType":"contains","source":2511,"target":2582},{"edgeType":"contains","source":15858,"target":15872},{"edgeType":"contains","source":10639,"target":10640},{"edgeType":"contains","source":5816,"target":5824},{"edgeType":"calls","source":9513,"target":2180},{"edgeType":"calls","source":4794,"target":4735},{"edgeType":"contains","source":14997,"target":15080},{"edgeType":"calls","source":15956,"target":15962},{"edgeType":"contains","source":9642,"target":9834},{"edgeType":"calls","source":894,"target":902},{"edgeType":"contains","source":2,"target":24},{"edgeType":"contains","source":2511,"target":2583},{"edgeType":"contains","source":5816,"target":5825},{"edgeType":"contains","source":10639,"target":10641},{"edgeType":"contains","source":11894,"target":11902},{"edgeType":"imports","source":14611,"target":14628},{"edgeType":"imports","source":15620,"target":2375},{"edgeType":"contains","source":13611,"target":13640},{"edgeType":"contains","source":13215,"target":13232},{"edgeType":"contains","source":11762,"target":11764},{"edgeType":"contains","source":6080,"target":6098},{"edgeType":"contains","source":662,"target":708},{"edgeType":"calls","source":3162,"target":358},{"edgeType":"calls","source":15362,"target":15351},{"edgeType":"contains","source":4549,"target":4939},{"edgeType":"contains","source":11412,"target":12043},{"edgeType":"calls","source":1034,"target":793},{"edgeType":"contains","source":13611,"target":13639},{"edgeType":"contains","source":14339,"target":14340},{"edgeType":"contains","source":11894,"target":11901},{"edgeType":"contains","source":13287,"target":13113},{"edgeType":"calls","source":358,"target":609},{"edgeType":"contains","source":1982,"target":2067},{"edgeType":"contains","source":7534,"target":7535},{"edgeType":"contains","source":662,"target":707},{"edgeType":"contains","source":6080,"target":6099},{"edgeType":"calls","source":5520,"target":5481},{"edgeType":"contains","source":2,"target":26},{"edgeType":"contains","source":6540,"target":6638},{"edgeType":"contains","source":10426,"target":10899},{"edgeType":"contains","source":5816,"target":5827},{"edgeType":"calls","source":14044,"target":13930},{"edgeType":"calls","source":8425,"target":8426},{"edgeType":"calls","source":9316,"target":8288},{"edgeType":"imports","source":9466,"target":774},{"edgeType":"contains","source":14339,"target":14341},{"edgeType":"calls","source":7739,"target":2210},{"edgeType":"contains","source":9641,"target":1410},{"edgeType":"calls","source":9680,"target":9688},{"edgeType":"calls","source":427,"target":583},{"edgeType":"contains","source":6540,"target":6647},{"edgeType":"contains","source":5436,"target":4931},{"edgeType":"contains","source":2511,"target":2586},{"edgeType":"contains","source":7534,"target":7544},{"edgeType":"contains","source":14954,"target":7944},{"edgeType":"contains","source":13611,"target":13654},{"edgeType":"contains","source":5480,"target":5682},{"edgeType":"contains","source":6212,"target":6245},{"edgeType":"calls","source":1457,"target":358},{"edgeType":"contains","source":10243,"target":10244},{"edgeType":"calls","source":15102,"target":14966},{"edgeType":"calls","source":894,"target":899},{"edgeType":"contains","source":2511,"target":2587},{"edgeType":"contains","source":6540,"target":6648},{"edgeType":"contains","source":3174,"target":3175},{"edgeType":"contains","source":1,"target":59},{"edgeType":"contains","source":11232,"target":11297},{"edgeType":"contains","source":11894,"target":11914},{"edgeType":"contains","source":7534,"target":7545},{"edgeType":"calls","source":10476,"target":10383},{"edgeType":"contains","source":13611,"target":13653},{"edgeType":"contains","source":7006,"target":7000},{"edgeType":"contains","source":5480,"target":5683},{"edgeType":"contains","source":8259,"target":8324},{"edgeType":"imports","source":10426,"target":600},{"edgeType":"contains","source":15349,"target":2043},{"edgeType":"contains","source":4825,"target":4844},{"edgeType":"imports","source":15619,"target":15086},{"edgeType":"contains","source":15401,"target":15229},{"edgeType":"calls","source":894,"target":898},{"edgeType":"contains","source":3917,"target":3394},{"edgeType":"contains","source":6540,"target":6649},{"edgeType":"contains","source":2511,"target":2584},{"edgeType":"contains","source":10550,"target":724},{"edgeType":"contains","source":7534,"target":7546},{"edgeType":"calls","source":8360,"target":8331},{"edgeType":"contains","source":13611,"target":13652},{"edgeType":"contains","source":10435,"target":10632},{"edgeType":"imports","source":14088,"target":9699},{"edgeType":"contains","source":8848,"target":9094},{"edgeType":"calls","source":15595,"target":6027},{"edgeType":"contains","source":6540,"target":6650},{"edgeType":"calls","source":2463,"target":883},{"edgeType":"contains","source":2511,"target":2585},{"edgeType":"contains","source":7201,"target":7300},{"edgeType":"contains","source":10550,"target":725},{"edgeType":"contains","source":13611,"target":13651},{"edgeType":"contains","source":7534,"target":7547},{"edgeType":"contains","source":11762,"target":11777},{"edgeType":"imports","source":5256,"target":2316},{"edgeType":"contains","source":3436,"target":3506},{"edgeType":"contains","source":7070,"target":7132},{"edgeType":"calls","source":2421,"target":2182},{"edgeType":"contains","source":7460,"target":7720},{"edgeType":"contains","source":7534,"target":7540},{"edgeType":"contains","source":9648,"target":9657},{"edgeType":"contains","source":5816,"target":5832},{"edgeType":"contains","source":5480,"target":5678},{"edgeType":"imports","source":14112,"target":8949},{"edgeType":"contains","source":13611,"target":13649},{"edgeType":"contains","source":7534,"target":7541},{"edgeType":"calls","source":16552,"target":16522},{"edgeType":"contains","source":5439,"target":4841},{"edgeType":"contains","source":5816,"target":5833},{"edgeType":"contains","source":1,"target":63},{"edgeType":"contains","source":11762,"target":11775},{"edgeType":"calls","source":6945,"target":5690},{"edgeType":"contains","source":5480,"target":5679},{"edgeType":"calls","source":13004,"target":12356},{"edgeType":"calls","source":9551,"target":9465},{"edgeType":"contains","source":3174,"target":3176},{"edgeType":"contains","source":8907,"target":3033},{"edgeType":"contains","source":2511,"target":2588},{"edgeType":"contains","source":6540,"target":6645},{"edgeType":"contains","source":5816,"target":5834},{"edgeType":"contains","source":7534,"target":7542},{"edgeType":"contains","source":8259,"target":8322},{"edgeType":"contains","source":3488,"target":4013},{"edgeType":"contains","source":8259,"target":8323},{"edgeType":"contains","source":10435,"target":10628},{"edgeType":"contains","source":5480,"target":5680},{"edgeType":"contains","source":4352,"target":4712},{"edgeType":"calls","source":7555,"target":5807},{"edgeType":"imports","source":16238,"target":4352},{"edgeType":"contains","source":2511,"target":2589},{"edgeType":"imports","source":15620,"target":2369},{"edgeType":"contains","source":6540,"target":6646},{"edgeType":"contains","source":7534,"target":7543},{"edgeType":"contains","source":8259,"target":8321},{"edgeType":"contains","source":11894,"target":11908},{"edgeType":"contains","source":8327,"target":8328},{"edgeType":"contains","source":5480,"target":5681},{"edgeType":"contains","source":13414,"target":13411},{"edgeType":"contains","source":662,"target":715},{"edgeType":"contains","source":801,"target":634},{"edgeType":"contains","source":3385,"target":3479},{"edgeType":"calls","source":3737,"target":3763},{"edgeType":"contains","source":14288,"target":14312},{"edgeType":"contains","source":9532,"target":9533},{"edgeType":"contains","source":15610,"target":15612},{"edgeType":"calls","source":16161,"target":16069},{"edgeType":"contains","source":6212,"target":6748},{"edgeType":"contains","source":8329,"target":8772},{"edgeType":"calls","source":9551,"target":9569},{"edgeType":"imports","source":12908,"target":12244},{"edgeType":"contains","source":14619,"target":14622},{"edgeType":"contains","source":5871,"target":6749},{"edgeType":"imports","source":14871,"target":4244},{"edgeType":"contains","source":11756,"target":4011},{"edgeType":"calls","source":3804,"target":3801},{"edgeType":"contains","source":10850,"target":10958},{"edgeType":"contains","source":8805,"target":8814},{"edgeType":"calls","source":11547,"target":11117},{"edgeType":"contains","source":13952,"target":14159},{"edgeType":"contains","source":13364,"target":13357},{"edgeType":"contains","source":14619,"target":14623},{"edgeType":"contains","source":6681,"target":7010},{"edgeType":"contains","source":1331,"target":1614},{"edgeType":"calls","source":2317,"target":1271},{"edgeType":"contains","source":8329,"target":8774},{"edgeType":"calls","source":7966,"target":7968},{"edgeType":"calls","source":2352,"target":2300},{"edgeType":"calls","source":10121,"target":358},{"edgeType":"contains","source":10324,"target":10348},{"edgeType":"contains","source":4547,"target":5509},{"edgeType":"contains","source":13952,"target":14160},{"edgeType":"contains","source":14619,"target":14624},{"edgeType":"calls","source":8099,"target":8073},{"edgeType":"calls","source":13119,"target":13121},{"edgeType":"calls","source":2749,"target":2678},{"edgeType":"calls","source":12943,"target":12235},{"edgeType":"calls","source":10939,"target":10936},{"edgeType":"calls","source":9882,"target":9880},{"edgeType":"contains","source":1331,"target":1615},{"edgeType":"contains","source":10975,"target":11309},{"edgeType":"contains","source":6681,"target":7011},{"edgeType":"contains","source":15478,"target":15479},{"edgeType":"imports","source":12821,"target":12830},{"edgeType":"contains","source":10324,"target":10349},{"edgeType":"calls","source":13119,"target":13120},{"edgeType":"contains","source":14619,"target":14625},{"edgeType":"calls","source":10657,"target":653},{"edgeType":"contains","source":7027,"target":6855},{"edgeType":"imports","source":16238,"target":8377},{"edgeType":"contains","source":10324,"target":10346},{"edgeType":"calls","source":1781,"target":972},{"edgeType":"contains","source":15478,"target":15480},{"edgeType":"imports","source":11834,"target":11709},{"edgeType":"contains","source":14619,"target":14626},{"edgeType":"calls","source":8891,"target":8893},{"edgeType":"contains","source":8001,"target":8366},{"edgeType":"calls","source":11286,"target":2299},{"edgeType":"contains","source":14421,"target":14422},{"edgeType":"contains","source":1055,"target":1719},{"edgeType":"imports","source":10378,"target":10343},{"edgeType":"imports","source":14340,"target":14359},{"edgeType":"contains","source":13760,"target":13762},{"edgeType":"contains","source":10324,"target":10347},{"edgeType":"contains","source":14288,"target":14317},{"edgeType":"contains","source":15478,"target":15481},{"edgeType":"calls","source":2462,"target":1003},{"edgeType":"imports","source":5509,"target":611},{"edgeType":"contains","source":2924,"target":2976},{"edgeType":"calls","source":766,"target":725},{"edgeType":"contains","source":3436,"target":4016},{"edgeType":"contains","source":14421,"target":14423},{"edgeType":"contains","source":7458,"target":8286},{"edgeType":"contains","source":14619,"target":14627},{"edgeType":"contains","source":5436,"target":5437},{"edgeType":"contains","source":10324,"target":10344},{"edgeType":"calls","source":10033,"target":976},{"edgeType":"contains","source":13760,"target":13761},{"edgeType":"calls","source":7005,"target":6052},{"edgeType":"contains","source":15478,"target":15482},{"edgeType":"contains","source":11040,"target":833},{"edgeType":"calls","source":3409,"target":3354},{"edgeType":"contains","source":11906,"target":12041},{"edgeType":"contains","source":1331,"target":1619},{"edgeType":"contains","source":1406,"target":1408},{"edgeType":"calls","source":4596,"target":4610},{"edgeType":"contains","source":10324,"target":10345},{"edgeType":"contains","source":2721,"target":2925},{"edgeType":"calls","source":2020,"target":2020},{"edgeType":"calls","source":7532,"target":286},{"edgeType":"calls","source":14252,"target":13940},{"edgeType":"contains","source":15999,"target":16244},{"edgeType":"contains","source":8001,"target":8367},{"edgeType":"contains","source":14288,"target":14320},{"edgeType":"calls","source":15121,"target":6027},{"edgeType":"contains","source":1331,"target":1620},{"edgeType":"contains","source":14619,"target":14629},{"edgeType":"contains","source":3253,"target":3351},{"edgeType":"contains","source":9334,"target":9337},{"edgeType":"contains","source":10029,"target":2591},{"edgeType":"contains","source":3971,"target":4348},{"edgeType":"calls","source":10675,"target":10674},{"edgeType":"contains","source":16072,"target":16081},{"edgeType":"calls","source":10741,"target":10742},{"edgeType":"contains","source":3253,"target":3352},{"edgeType":"contains","source":9334,"target":9336},{"edgeType":"contains","source":1,"target":571},{"edgeType":"contains","source":11250,"target":11251},{"edgeType":"calls","source":699,"target":683},{"edgeType":"contains","source":217,"target":218},{"edgeType":"contains","source":3971,"target":4347},{"edgeType":"calls","source":14982,"target":8232},{"edgeType":"imports","source":15822,"target":2236},{"edgeType":"contains","source":16072,"target":16080},{"edgeType":"contains","source":9334,"target":9339},{"edgeType":"contains","source":3971,"target":4346},{"edgeType":"contains","source":15874,"target":15878},{"edgeType":"calls","source":11865,"target":11835},{"edgeType":"contains","source":151,"target":153},{"edgeType":"calls","source":766,"target":724},{"edgeType":"contains","source":3523,"target":3436},{"edgeType":"contains","source":10324,"target":10357},{"edgeType":"contains","source":13952,"target":14152},{"edgeType":"contains","source":5871,"target":6760},{"edgeType":"contains","source":9334,"target":9338},{"edgeType":"calls","source":425,"target":723},{"edgeType":"contains","source":151,"target":152},{"edgeType":"contains","source":10324,"target":10358},{"edgeType":"calls","source":12272,"target":3447},{"edgeType":"contains","source":1406,"target":1413},{"edgeType":"contains","source":1331,"target":1624},{"edgeType":"contains","source":9466,"target":9469},{"edgeType":"calls","source":3473,"target":3478},{"edgeType":"contains","source":9400,"target":9401},{"edgeType":"contains","source":217,"target":223},{"edgeType":"contains","source":1406,"target":1418},{"edgeType":"contains","source":151,"target":155},{"edgeType":"contains","source":2721,"target":2934},{"edgeType":"calls","source":1886,"target":1936},{"edgeType":"calls","source":15832,"target":15703},{"edgeType":"contains","source":13760,"target":13770},{"edgeType":"contains","source":6212,"target":6753},{"edgeType":"contains","source":5871,"target":6754},{"edgeType":"contains","source":1,"target":575},{"edgeType":"imports","source":10378,"target":10334},{"edgeType":"contains","source":151,"target":154},{"edgeType":"contains","source":1331,"target":1630},{"edgeType":"calls","source":4266,"target":4264},{"edgeType":"contains","source":4244,"target":4345},{"edgeType":"imports","source":15517,"target":7459},{"edgeType":"contains","source":12957,"target":13294},{"edgeType":"contains","source":1055,"target":1730},{"edgeType":"calls","source":6856,"target":6451},{"edgeType":"contains","source":9334,"target":9335},{"edgeType":"calls","source":8561,"target":8563},{"edgeType":"contains","source":818,"target":620},{"edgeType":"calls","source":6184,"target":6112},{"edgeType":"calls","source":13843,"target":13943},{"edgeType":"calls","source":3341,"target":3341},{"edgeType":"contains","source":9400,"target":9402},{"edgeType":"imports","source":9466,"target":2666},{"edgeType":"contains","source":9466,"target":9470},{"edgeType":"contains","source":15610,"target":15611},{"edgeType":"contains","source":1621,"target":1094},{"edgeType":"contains","source":6212,"target":6755},{"edgeType":"calls","source":975,"target":2696},{"edgeType":"calls","source":236,"target":236},{"edgeType":"contains","source":8329,"target":8778},{"edgeType":"calls","source":4410,"target":4026},{"edgeType":"calls","source":12661,"target":12532},{"edgeType":"contains","source":13922,"target":15071},{"edgeType":"contains","source":3189,"target":3196},{"edgeType":"contains","source":14750,"target":14772},{"edgeType":"contains","source":10029,"target":2566},{"edgeType":"contains","source":12821,"target":13262},{"edgeType":"contains","source":3315,"target":3518},{"edgeType":"calls","source":3077,"target":3099},{"edgeType":"contains","source":10975,"target":11293},{"edgeType":"imports","source":9472,"target":2468},{"edgeType":"calls","source":8501,"target":8278},{"edgeType":"contains","source":6292,"target":6366},{"edgeType":"contains","source":6681,"target":6991},{"edgeType":"contains","source":12372,"target":12383},{"edgeType":"contains","source":16072,"target":16073},{"edgeType":"contains","source":1715,"target":2381},{"edgeType":"contains","source":10522,"target":10539},{"edgeType":"contains","source":14750,"target":14773},{"edgeType":"contains","source":3189,"target":3197},{"edgeType":"contains","source":10975,"target":11295},{"edgeType":"contains","source":17,"target":51},{"edgeType":"contains","source":4072,"target":5420},{"edgeType":"contains","source":7458,"target":8274},{"edgeType":"calls","source":3804,"target":3817},{"edgeType":"contains","source":10975,"target":11294},{"edgeType":"contains","source":10324,"target":10335},{"edgeType":"contains","source":12372,"target":12382},{"edgeType":"contains","source":4547,"target":5493},{"edgeType":"contains","source":13495,"target":13507},{"edgeType":"contains","source":14750,"target":14774},{"edgeType":"contains","source":14890,"target":14662},{"edgeType":"contains","source":7458,"target":8275},{"edgeType":"contains","source":10975,"target":11291},{"edgeType":"contains","source":11657,"target":11290},{"edgeType":"contains","source":1,"target":2664},{"edgeType":"contains","source":2132,"target":2136},{"edgeType":"contains","source":10850,"target":10938},{"edgeType":"calls","source":11861,"target":11934},{"edgeType":"contains","source":14073,"target":14621},{"edgeType":"contains","source":10324,"target":10332},{"edgeType":"contains","source":12372,"target":12381},{"edgeType":"contains","source":6292,"target":6368},{"edgeType":"contains","source":13952,"target":14144},{"edgeType":"imports","source":13217,"target":13221},{"edgeType":"calls","source":1231,"target":1131},{"edgeType":"imports","source":12617,"target":4339},{"edgeType":"contains","source":14863,"target":15500},{"edgeType":"contains","source":10975,"target":11292},{"edgeType":"contains","source":12957,"target":13271},{"edgeType":"calls","source":6385,"target":6226},{"edgeType":"contains","source":1,"target":549},{"edgeType":"contains","source":2132,"target":2137},{"edgeType":"contains","source":5871,"target":6736},{"edgeType":"imports","source":1621,"target":612},{"edgeType":"contains","source":10522,"target":10537},{"edgeType":"contains","source":6292,"target":6369},{"edgeType":"calls","source":9816,"target":9795},{"edgeType":"imports","source":882,"target":264},{"edgeType":"imports","source":10832,"target":8937},{"edgeType":"calls","source":10685,"target":10343},{"edgeType":"contains","source":14750,"target":14776},{"edgeType":"imports","source":14340,"target":14342},{"edgeType":"contains","source":13297,"target":13301},{"edgeType":"contains","source":13350,"target":13772},{"edgeType":"contains","source":9597,"target":9611},{"edgeType":"contains","source":10616,"target":1278},{"edgeType":"contains","source":1,"target":552},{"edgeType":"contains","source":6292,"target":6362},{"edgeType":"contains","source":16267,"target":16374},{"edgeType":"calls","source":642,"target":358},{"edgeType":"calls","source":3606,"target":3609},{"edgeType":"contains","source":13297,"target":13300},{"edgeType":"calls","source":10251,"target":540},{"edgeType":"contains","source":6292,"target":6363},{"edgeType":"imports","source":15800,"target":15590},{"edgeType":"calls","source":11023,"target":10433},{"edgeType":"contains","source":2925,"target":2926},{"edgeType":"contains","source":3189,"target":3198},{"edgeType":"contains","source":13297,"target":13299},{"edgeType":"contains","source":3315,"target":3520},{"edgeType":"contains","source":13495,"target":13503},{"edgeType":"calls","source":6385,"target":6229},{"edgeType":"contains","source":14863,"target":15504},{"edgeType":"calls","source":15852,"target":2375},{"edgeType":"calls","source":11522,"target":5535},{"edgeType":"contains","source":10247,"target":10601},{"edgeType":"contains","source":6292,"target":6364},{"edgeType":"calls","source":9290,"target":7080},{"edgeType":"calls","source":11861,"target":11938},{"edgeType":"calls","source":4498,"target":3438},{"edgeType":"calls","source":6710,"target":6725},{"edgeType":"calls","source":15586,"target":2165},{"edgeType":"contains","source":9135,"target":9136},{"edgeType":"contains","source":3315,"target":3521},{"edgeType":"calls","source":3870,"target":3879},{"edgeType":"contains","source":13952,"target":14149},{"edgeType":"contains","source":1,"target":2667},{"edgeType":"contains","source":2621,"target":1780},{"edgeType":"contains","source":6292,"target":6374},{"edgeType":"contains","source":9027,"target":8267},{"edgeType":"contains","source":1715,"target":2389},{"edgeType":"contains","source":3971,"target":4332},{"edgeType":"calls","source":2225,"target":2020},{"edgeType":"calls","source":3077,"target":3091},{"edgeType":"calls","source":8230,"target":8231},{"edgeType":"contains","source":10850,"target":10950},{"edgeType":"contains","source":8805,"target":8806},{"edgeType":"contains","source":5373,"target":5264},{"edgeType":"calls","source":14080,"target":4463},{"edgeType":"imports","source":9854,"target":3303},{"edgeType":"contains","source":14750,"target":14765},{"edgeType":"contains","source":14750,"target":14766},{"edgeType":"contains","source":14073,"target":14612},{"edgeType":"contains","source":10975,"target":11300},{"edgeType":"contains","source":15345,"target":15348},{"edgeType":"contains","source":4841,"target":4843},{"edgeType":"calls","source":10146,"target":10145},{"edgeType":"calls","source":1494,"target":1427},{"edgeType":"calls","source":15707,"target":540},{"edgeType":"contains","source":1715,"target":2387},{"edgeType":"contains","source":2924,"target":2962},{"edgeType":"calls","source":10811,"target":10668},{"edgeType":"contains","source":14750,"target":14767},{"edgeType":"contains","source":13297,"target":13310},{"edgeType":"calls","source":2209,"target":400},{"edgeType":"contains","source":2734,"target":2510},{"edgeType":"contains","source":1715,"target":2388},{"edgeType":"contains","source":9597,"target":9624},{"edgeType":"calls","source":433,"target":492},{"edgeType":"contains","source":4841,"target":4849},{"edgeType":"contains","source":14750,"target":14768},{"edgeType":"imports","source":12151,"target":3971},{"edgeType":"contains","source":8937,"target":8939},{"edgeType":"calls","source":1510,"target":925},{"edgeType":"contains","source":10975,"target":11298},{"edgeType":"contains","source":7458,"target":8277},{"edgeType":"contains","source":14750,"target":14769},{"edgeType":"calls","source":15450,"target":2159},{"edgeType":"imports","source":15822,"target":4330},{"edgeType":"contains","source":10522,"target":10543},{"edgeType":"contains","source":10975,"target":11299},{"edgeType":"contains","source":8937,"target":8938},{"edgeType":"calls","source":4935,"target":4682},{"edgeType":"calls","source":6972,"target":724},{"edgeType":"contains","source":5871,"target":6738},{"edgeType":"calls","source":2533,"target":925},{"edgeType":"contains","source":6292,"target":6371},{"edgeType":"contains","source":1,"target":559},{"edgeType":"contains","source":13952,"target":14139},{"edgeType":"contains","source":9797,"target":9760},{"edgeType":"contains","source":14750,"target":14770},{"edgeType":"contains","source":4973,"target":4983},{"edgeType":"contains","source":12957,"target":13277},{"edgeType":"contains","source":10850,"target":10942},{"edgeType":"contains","source":7458,"target":8279},{"edgeType":"imports","source":15800,"target":15585},{"edgeType":"contains","source":1715,"target":2391},{"edgeType":"contains","source":13952,"target":14140},{"edgeType":"calls","source":2523,"target":1232},{"edgeType":"contains","source":14750,"target":14771},{"edgeType":"calls","source":11799,"target":11755},{"edgeType":"calls","source":9401,"target":1532},{"edgeType":"contains","source":3971,"target":4333},{"edgeType":"contains","source":5871,"target":6740},{"edgeType":"contains","source":1715,"target":2392},{"edgeType":"contains","source":12041,"target":12075},{"edgeType":"contains","source":3383,"target":3508},{"edgeType":"contains","source":11579,"target":11580},{"edgeType":"contains","source":12957,"target":13258},{"edgeType":"contains","source":6292,"target":6349},{"edgeType":"calls","source":15964,"target":15801},{"edgeType":"calls","source":6128,"target":5716},{"edgeType":"contains","source":12041,"target":12057},{"edgeType":"contains","source":744,"target":753},{"edgeType":"contains","source":5767,"target":5712},{"edgeType":"contains","source":5236,"target":5259},{"edgeType":"contains","source":7919,"target":8765},{"edgeType":"calls","source":5001,"target":4714},{"edgeType":"contains","source":9597,"target":9598},{"edgeType":"contains","source":11579,"target":11581},{"edgeType":"contains","source":12957,"target":13257},{"edgeType":"contains","source":10850,"target":10925},{"edgeType":"contains","source":4072,"target":5403},{"edgeType":"contains","source":6292,"target":6350},{"edgeType":"contains","source":10378,"target":10758},{"edgeType":"contains","source":805,"target":975},{"edgeType":"calls","source":4007,"target":3817},{"edgeType":"calls","source":9880,"target":1450},{"edgeType":"contains","source":14750,"target":14757},{"edgeType":"contains","source":7919,"target":8764},{"edgeType":"contains","source":12759,"target":13053},{"edgeType":"calls","source":962,"target":962},{"edgeType":"contains","source":10247,"target":10588},{"edgeType":"contains","source":15774,"target":14725},{"edgeType":"calls","source":16159,"target":16100},{"edgeType":"contains","source":1,"target":2647},{"edgeType":"contains","source":10918,"target":10928},{"edgeType":"contains","source":6292,"target":6351},{"edgeType":"calls","source":10226,"target":3412},{"edgeType":"contains","source":13952,"target":14127},{"edgeType":"contains","source":13001,"target":3436},{"edgeType":"contains","source":12041,"target":12055},{"edgeType":"contains","source":15470,"target":15692},{"edgeType":"contains","source":13624,"target":13719},{"edgeType":"contains","source":14750,"target":14758},{"edgeType":"calls","source":6934,"target":1874},{"edgeType":"contains","source":11447,"target":11441},{"edgeType":"contains","source":10975,"target":11276},{"edgeType":"contains","source":2131,"target":2151},{"edgeType":"calls","source":14319,"target":13940},{"edgeType":"calls","source":7967,"target":7905},{"edgeType":"calls","source":10079,"target":10082},{"edgeType":"contains","source":6292,"target":6352},{"edgeType":"imports","source":9472,"target":8859},{"edgeType":"contains","source":12041,"target":12054},{"edgeType":"contains","source":14750,"target":14759},{"edgeType":"contains","source":10247,"target":10586},{"edgeType":"contains","source":3841,"target":4113},{"edgeType":"calls","source":6124,"target":5836},{"edgeType":"imports","source":1715,"target":1974},{"edgeType":"contains","source":6682,"target":6940},{"edgeType":"calls","source":8824,"target":8823},{"edgeType":"contains","source":12041,"target":12053},{"edgeType":"contains","source":14552,"target":14556},{"edgeType":"contains","source":1715,"target":2368},{"edgeType":"calls","source":3166,"target":286},{"edgeType":"contains","source":5633,"target":5634},{"edgeType":"calls","source":14838,"target":14764},{"edgeType":"contains","source":1339,"target":1340},{"edgeType":"contains","source":3315,"target":3507},{"edgeType":"calls","source":6378,"target":6428},{"edgeType":"contains","source":10247,"target":10587},{"edgeType":"contains","source":1,"target":534},{"edgeType":"calls","source":2023,"target":1892},{"edgeType":"contains","source":10850,"target":10921},{"edgeType":"calls","source":4947,"target":4269},{"edgeType":"calls","source":6811,"target":5690},{"edgeType":"contains","source":3841,"target":4112},{"edgeType":"contains","source":12041,"target":12052},{"edgeType":"calls","source":3737,"target":3726},{"edgeType":"contains","source":1339,"target":1341},{"edgeType":"calls","source":3567,"target":540},{"edgeType":"calls","source":4661,"target":4677},{"edgeType":"contains","source":10698,"target":2945},{"edgeType":"contains","source":6682,"target":6942},{"edgeType":"calls","source":7967,"target":7908},{"edgeType":"contains","source":6771,"target":6297},{"edgeType":"contains","source":13952,"target":14131},{"edgeType":"calls","source":15893,"target":15886},{"edgeType":"calls","source":3603,"target":3649},{"edgeType":"calls","source":6715,"target":6553},{"edgeType":"calls","source":2317,"target":1234},{"edgeType":"contains","source":1715,"target":2366},{"edgeType":"contains","source":3841,"target":4111},{"edgeType":"calls","source":14565,"target":2091},{"edgeType":"calls","source":8856,"target":1491},{"edgeType":"contains","source":5236,"target":5261},{"edgeType":"imports","source":8647,"target":612},{"edgeType":"contains","source":14750,"target":14762},{"edgeType":"contains","source":14871,"target":15240},{"edgeType":"contains","source":8329,"target":8736},{"edgeType":"calls","source":1952,"target":1981},{"edgeType":"contains","source":6682,"target":6943},{"edgeType":"contains","source":6292,"target":6348},{"edgeType":"contains","source":13952,"target":14132},{"edgeType":"contains","source":12559,"target":12904},{"edgeType":"imports","source":13217,"target":13268},{"edgeType":"contains","source":7919,"target":8762},{"edgeType":"contains","source":1715,"target":2367},{"edgeType":"calls","source":8890,"target":8892},{"edgeType":"contains","source":3841,"target":4110},{"edgeType":"calls","source":14572,"target":14557},{"edgeType":"contains","source":14750,"target":14763},{"edgeType":"calls","source":14995,"target":7786},{"edgeType":"contains","source":10247,"target":10598},{"edgeType":"calls","source":6192,"target":5838},{"edgeType":"calls","source":4463,"target":4471},{"edgeType":"imports","source":1375,"target":1956},{"edgeType":"contains","source":9597,"target":9607},{"edgeType":"contains","source":1,"target":2653},{"edgeType":"contains","source":16472,"target":16332},{"edgeType":"contains","source":5973,"target":5676},{"edgeType":"contains","source":6292,"target":6358},{"edgeType":"calls","source":6670,"target":5836},{"edgeType":"contains","source":10324,"target":10326},{"edgeType":"calls","source":10674,"target":10672},{"edgeType":"contains","source":3384,"target":3486},{"edgeType":"contains","source":1331,"target":1592},{"edgeType":"contains","source":5659,"target":6955},{"edgeType":"calls","source":7531,"target":286},{"edgeType":"contains","source":4072,"target":5411},{"edgeType":"calls","source":2878,"target":2869},{"edgeType":"calls","source":6670,"target":5837},{"edgeType":"contains","source":10324,"target":10327},{"edgeType":"contains","source":12372,"target":12374},{"edgeType":"contains","source":13297,"target":13295},{"edgeType":"imports","source":13217,"target":13261},{"edgeType":"contains","source":14089,"target":14099},{"edgeType":"imports","source":9472,"target":2510},{"edgeType":"contains","source":3384,"target":3485},{"edgeType":"calls","source":1226,"target":1229},{"edgeType":"calls","source":9816,"target":9788},{"edgeType":"contains","source":11579,"target":11586},{"edgeType":"contains","source":11576,"target":11679},{"edgeType":"calls","source":4934,"target":4666},{"edgeType":"contains","source":12372,"target":12373},{"edgeType":"contains","source":14073,"target":14596},{"edgeType":"contains","source":6292,"target":6360},{"edgeType":"calls","source":2283,"target":2284},{"edgeType":"contains","source":12041,"target":12062},{"edgeType":"contains","source":9597,"target":9608},{"edgeType":"calls","source":2349,"target":2353},{"edgeType":"contains","source":6292,"target":6361},{"edgeType":"contains","source":8259,"target":8805},{"edgeType":"contains","source":13952,"target":14120},{"edgeType":"contains","source":10918,"target":10937},{"edgeType":"calls","source":2019,"target":2009},{"edgeType":"calls","source":9043,"target":8384},{"edgeType":"contains","source":11447,"target":11448},{"edgeType":"contains","source":11579,"target":11584},{"edgeType":"contains","source":5236,"target":5272},{"edgeType":"contains","source":12041,"target":12061},{"edgeType":"calls","source":15039,"target":2206},{"edgeType":"calls","source":9094,"target":8917},{"edgeType":"contains","source":8214,"target":8080},{"edgeType":"calls","source":3073,"target":1046},{"edgeType":"contains","source":6292,"target":6353},{"edgeType":"calls","source":10743,"target":10651},{"edgeType":"contains","source":4114,"target":4115},{"edgeType":"contains","source":13952,"target":14121},{"edgeType":"calls","source":13449,"target":13443},{"edgeType":"contains","source":10975,"target":11281},{"edgeType":"contains","source":11579,"target":11585},{"edgeType":"contains","source":13495,"target":13496},{"edgeType":"contains","source":7919,"target":8768},{"edgeType":"contains","source":12041,"target":12060},{"edgeType":"contains","source":2132,"target":2135},{"edgeType":"calls","source":6658,"target":6213},{"edgeType":"calls","source":3633,"target":600},{"edgeType":"calls","source":12476,"target":3438},{"edgeType":"contains","source":2924,"target":2951},{"edgeType":"imports","source":15349,"target":4244},{"edgeType":"contains","source":11579,"target":11582},{"edgeType":"calls","source":10412,"target":10343},{"edgeType":"calls","source":9036,"target":2261},{"edgeType":"contains","source":12631,"target":4339},{"edgeType":"contains","source":12150,"target":12908},{"edgeType":"contains","source":6292,"target":6355},{"edgeType":"contains","source":12041,"target":12059},{"edgeType":"contains","source":17,"target":50},{"edgeType":"contains","source":6292,"target":6356},{"edgeType":"calls","source":6670,"target":5842},{"edgeType":"calls","source":16159,"target":16104},{"edgeType":"calls","source":2084,"target":2107},{"edgeType":"imports","source":14871,"target":14837},{"edgeType":"calls","source":4859,"target":4872},{"edgeType":"contains","source":11579,"target":11583},{"edgeType":"calls","source":9156,"target":9110},{"edgeType":"contains","source":12041,"target":12058},{"edgeType":"contains","source":12150,"target":12907},{"edgeType":"contains","source":5633,"target":5645},{"edgeType":"imports","source":10379,"target":10334},{"edgeType":"contains","source":6292,"target":6357},{"edgeType":"contains","source":6294,"target":6295},{"edgeType":"contains","source":13363,"target":13357},{"edgeType":"contains","source":2132,"target":2133},{"edgeType":"contains","source":13952,"target":14124},{"edgeType":"calls","source":1556,"target":1564},{"edgeType":"contains","source":14750,"target":14755},{"edgeType":"imports","source":4630,"target":4632},{"edgeType":"contains","source":12559,"target":12895},{"edgeType":"calls","source":5392,"target":5294},{"edgeType":"calls","source":1557,"target":1561},{"edgeType":"calls","source":3341,"target":3338},{"edgeType":"contains","source":5509,"target":5237},{"edgeType":"contains","source":10247,"target":10574},{"edgeType":"calls","source":1095,"target":1084},{"edgeType":"calls","source":2350,"target":2348},{"edgeType":"calls","source":15851,"target":2375},{"edgeType":"calls","source":8505,"target":8121},{"edgeType":"contains","source":6682,"target":6927},{"edgeType":"contains","source":6681,"target":6958},{"edgeType":"contains","source":10698,"target":2935},{"edgeType":"contains","source":6294,"target":6271},{"edgeType":"contains","source":805,"target":959},{"edgeType":"contains","source":14089,"target":14090},{"edgeType":"calls","source":8212,"target":290},{"edgeType":"contains","source":742,"target":798},{"edgeType":"calls","source":7803,"target":286},{"edgeType":"imports","source":10329,"target":9759},{"edgeType":"contains","source":5871,"target":6700},{"edgeType":"contains","source":5236,"target":5242},{"edgeType":"calls","source":1062,"target":2106},{"edgeType":"contains","source":3436,"target":3962},{"edgeType":"contains","source":2721,"target":2873},{"edgeType":"calls","source":16769,"target":16199},{"edgeType":"contains","source":83,"target":86},{"edgeType":"calls","source":6601,"target":5837},{"edgeType":"contains","source":12559,"target":12894},{"edgeType":"contains","source":805,"target":958},{"edgeType":"contains","source":10247,"target":10575},{"edgeType":"contains","source":14073,"target":14587},{"edgeType":"imports","source":15619,"target":4326},{"edgeType":"calls","source":15696,"target":15638},{"edgeType":"contains","source":5236,"target":5241},{"edgeType":"contains","source":5162,"target":5421},{"edgeType":"contains","source":5170,"target":5173},{"edgeType":"calls","source":6711,"target":6656},{"edgeType":"contains","source":11497,"target":1419},{"edgeType":"contains","source":10247,"target":10572},{"edgeType":"contains","source":6095,"target":6100},{"edgeType":"contains","source":3436,"target":3961},{"edgeType":"contains","source":10125,"target":10126},{"edgeType":"contains","source":6681,"target":6960},{"edgeType":"contains","source":12559,"target":12893},{"edgeType":"contains","source":10378,"target":10739},{"edgeType":"contains","source":742,"target":800},{"edgeType":"calls","source":15357,"target":779},{"edgeType":"contains","source":5236,"target":5240},{"edgeType":"contains","source":4068,"target":3394},{"edgeType":"contains","source":14947,"target":14977},{"edgeType":"contains","source":10247,"target":10573},{"edgeType":"contains","source":3436,"target":3960},{"edgeType":"imports","source":2618,"target":1448},{"edgeType":"contains","source":6682,"target":6930},{"edgeType":"contains","source":12957,"target":13238},{"edgeType":"contains","source":12559,"target":12892},{"edgeType":"contains","source":14073,"target":14589},{"edgeType":"contains","source":4630,"target":4999},{"edgeType":"contains","source":9200,"target":9201},{"edgeType":"calls","source":3084,"target":2844},{"edgeType":"calls","source":5475,"target":4831},{"edgeType":"calls","source":3437,"target":358},{"edgeType":"contains","source":10247,"target":10570},{"edgeType":"imports","source":10949,"target":1115},{"edgeType":"contains","source":12957,"target":13237},{"edgeType":"calls","source":1952,"target":1996},{"edgeType":"contains","source":12559,"target":12891},{"edgeType":"calls","source":6048,"target":6094},{"edgeType":"contains","source":10850,"target":10903},{"edgeType":"calls","source":11688,"target":358},{"edgeType":"contains","source":6682,"target":6923},{"edgeType":"calls","source":1062,"target":2102},{"edgeType":"contains","source":6292,"target":6330},{"edgeType":"contains","source":1,"target":518},{"edgeType":"contains","source":2131,"target":2141},{"edgeType":"contains","source":12957,"target":13236},{"edgeType":"contains","source":5170,"target":5177},{"edgeType":"contains","source":805,"target":966},{"edgeType":"calls","source":3015,"target":2867},{"edgeType":"calls","source":8362,"target":8331},{"edgeType":"calls","source":15357,"target":774},{"edgeType":"contains","source":14947,"target":14981},{"edgeType":"contains","source":6292,"target":6331},{"edgeType":"calls","source":7011,"target":5817},{"edgeType":"contains","source":6095,"target":6096},{"edgeType":"contains","source":742,"target":804},{"edgeType":"contains","source":17,"target":25},{"edgeType":"contains","source":6682,"target":6925},{"edgeType":"contains","source":1,"target":11091},{"edgeType":"contains","source":5170,"target":5176},{"edgeType":"calls","source":6643,"target":6655},{"edgeType":"contains","source":13624,"target":13698},{"edgeType":"contains","source":10247,"target":10569},{"edgeType":"contains","source":805,"target":964},{"edgeType":"contains","source":2131,"target":2139},{"edgeType":"calls","source":4398,"target":4390},{"edgeType":"calls","source":10145,"target":10141},{"edgeType":"contains","source":16314,"target":16985},{"edgeType":"imports","source":15379,"target":3303},{"edgeType":"contains","source":12559,"target":12903},{"edgeType":"calls","source":10656,"target":642},{"edgeType":"contains","source":6682,"target":6935},{"edgeType":"imports","source":10244,"target":8159},{"edgeType":"calls","source":9947,"target":9936},{"edgeType":"calls","source":4798,"target":4673},{"edgeType":"calls","source":9697,"target":774},{"edgeType":"contains","source":12559,"target":12902},{"edgeType":"contains","source":805,"target":967},{"edgeType":"contains","source":16314,"target":16984},{"edgeType":"calls","source":10227,"target":3370},{"edgeType":"contains","source":8543,"target":8438},{"edgeType":"calls","source":3737,"target":3739},{"edgeType":"imports","source":9090,"target":1652},{"edgeType":"calls","source":1952,"target":1991},{"edgeType":"calls","source":3880,"target":3534},{"edgeType":"calls","source":1096,"target":1044},{"edgeType":"contains","source":12041,"target":12048},{"edgeType":"calls","source":2537,"target":772},{"edgeType":"contains","source":6292,"target":6343},{"edgeType":"contains","source":12559,"target":12901},{"edgeType":"contains","source":9002,"target":9011},{"edgeType":"imports","source":7711,"target":4230},{"edgeType":"imports","source":12908,"target":12255},{"edgeType":"contains","source":3315,"target":3491},{"edgeType":"contains","source":5963,"target":5972},{"edgeType":"contains","source":6682,"target":6937},{"edgeType":"calls","source":15033,"target":2369},{"edgeType":"calls","source":7557,"target":5807},{"edgeType":"calls","source":2935,"target":1115},{"edgeType":"calls","source":3019,"target":626},{"edgeType":"calls","source":10878,"target":10672},{"edgeType":"contains","source":14073,"target":14580},{"edgeType":"contains","source":6292,"target":6344},{"edgeType":"contains","source":16072,"target":16032},{"edgeType":"contains","source":6682,"target":6939},{"edgeType":"contains","source":12957,"target":13247},{"edgeType":"contains","source":10852,"target":10853},{"edgeType":"contains","source":3315,"target":3492},{"edgeType":"calls","source":15232,"target":15233},{"edgeType":"contains","source":15026,"target":14634},{"edgeType":"contains","source":3841,"target":4098},{"edgeType":"contains","source":12041,"target":12046},{"edgeType":"calls","source":4934,"target":4682},{"edgeType":"imports","source":15800,"target":15621},{"edgeType":"calls","source":6657,"target":6226},{"edgeType":"imports","source":10329,"target":9756},{"edgeType":"contains","source":8600,"target":2440},{"edgeType":"contains","source":4072,"target":5400},{"edgeType":"contains","source":13922,"target":15034},{"edgeType":"calls","source":3541,"target":3468},{"edgeType":"contains","source":9002,"target":9005},{"edgeType":"contains","source":13624,"target":13709},{"edgeType":"calls","source":9976,"target":2699},{"edgeType":"contains","source":5903,"target":5712},{"edgeType":"contains","source":5963,"target":5966},{"edgeType":"calls","source":15532,"target":5926},{"edgeType":"imports","source":12413,"target":4339},{"edgeType":"contains","source":3384,"target":3472},{"edgeType":"contains","source":14947,"target":14971},{"edgeType":"calls","source":6049,"target":6054},{"edgeType":"contains","source":10918,"target":10919},{"edgeType":"calls","source":2019,"target":2024},{"edgeType":"contains","source":612,"target":611},{"edgeType":"contains","source":12378,"target":12167},{"edgeType":"imports","source":15810,"target":15305},{"edgeType":"imports","source":13217,"target":13242},{"edgeType":"contains","source":1,"target":2643},{"edgeType":"calls","source":15176,"target":2165},{"edgeType":"contains","source":14947,"target":14972},{"edgeType":"calls","source":2085,"target":2092},{"edgeType":"calls","source":4794,"target":4791},{"edgeType":"contains","source":4630,"target":5012},{"edgeType":"calls","source":6124,"target":5842},{"edgeType":"calls","source":12523,"target":12532},{"edgeType":"contains","source":6682,"target":6933},{"edgeType":"imports","source":10244,"target":8161},{"edgeType":"contains","source":10378,"target":10743},{"edgeType":"imports","source":15810,"target":15308},{"edgeType":"imports","source":5509,"target":2734},{"edgeType":"calls","source":15783,"target":2375},{"edgeType":"contains","source":10247,"target":10576},{"edgeType":"imports","source":9260,"target":612},{"edgeType":"contains","source":12559,"target":12896},{"edgeType":"calls","source":4794,"target":4790},{"edgeType":"contains","source":9529,"target":9581},{"edgeType":"calls","source":6729,"target":6112},{"edgeType":"calls","source":11961,"target":358},{"edgeType":"calls","source":3073,"target":1062},{"edgeType":"contains","source":12957,"target":13225},{"edgeType":"contains","source":1331,"target":1550},{"edgeType":"contains","source":6292,"target":6316},{"edgeType":"contains","source":2923,"target":2936},{"edgeType":"contains","source":805,"target":943},{"edgeType":"calls","source":1967,"target":1618},{"edgeType":"contains","source":16314,"target":16977},{"edgeType":"contains","source":16315,"target":16946},{"edgeType":"contains","source":5144,"target":5964},{"edgeType":"contains","source":1063,"target":1401},{"edgeType":"calls","source":10299,"target":9702},{"edgeType":"calls","source":5325,"target":5339},{"edgeType":"contains","source":12759,"target":13021},{"edgeType":"calls","source":3091,"target":600},{"edgeType":"contains","source":10247,"target":10558},{"edgeType":"contains","source":1331,"target":1551},{"edgeType":"contains","source":3436,"target":3945},{"edgeType":"contains","source":4244,"target":4266},{"edgeType":"contains","source":11776,"target":11783},{"edgeType":"contains","source":13824,"target":13830},{"edgeType":"contains","source":6292,"target":6317},{"edgeType":"contains","source":6682,"target":6912},{"edgeType":"contains","source":14088,"target":14105},{"edgeType":"contains","source":14073,"target":14570},{"edgeType":"contains","source":16314,"target":16976},{"edgeType":"imports","source":3508,"target":3510},{"edgeType":"contains","source":805,"target":942},{"edgeType":"calls","source":6972,"target":794},{"edgeType":"calls","source":8893,"target":8892},{"edgeType":"contains","source":1063,"target":1400},{"edgeType":"contains","source":14752,"target":14662},{"edgeType":"contains","source":9794,"target":9803},{"edgeType":"contains","source":3315,"target":3469},{"edgeType":"contains","source":13624,"target":13687},{"edgeType":"contains","source":15740,"target":15746},{"edgeType":"contains","source":16314,"target":16979},{"edgeType":"contains","source":16315,"target":16948},{"edgeType":"contains","source":9529,"target":9562},{"edgeType":"contains","source":11776,"target":11780},{"edgeType":"contains","source":13824,"target":13829},{"edgeType":"contains","source":6292,"target":6318},{"edgeType":"contains","source":805,"target":945},{"edgeType":"contains","source":16267,"target":16322},{"edgeType":"contains","source":10378,"target":10722},{"edgeType":"contains","source":14088,"target":14106},{"edgeType":"contains","source":1,"target":11070},{"edgeType":"calls","source":14315,"target":14164},{"edgeType":"contains","source":5144,"target":5962},{"edgeType":"contains","source":1063,"target":1403},{"edgeType":"contains","source":3315,"target":3466},{"edgeType":"contains","source":13624,"target":13686},{"edgeType":"calls","source":9818,"target":9816},{"edgeType":"contains","source":16314,"target":16978},{"edgeType":"contains","source":16315,"target":16947},{"edgeType":"contains","source":1331,"target":1549},{"edgeType":"contains","source":6682,"target":6914},{"edgeType":"contains","source":16142,"target":15968},{"edgeType":"contains","source":8259,"target":8763},{"edgeType":"calls","source":15707,"target":615},{"edgeType":"contains","source":1063,"target":1402},{"edgeType":"calls","source":9488,"target":9475},{"edgeType":"contains","source":3315,"target":3467},{"edgeType":"imports","source":882,"target":349},{"edgeType":"contains","source":9794,"target":9801},{"edgeType":"calls","source":8570,"target":8337},{"edgeType":"calls","source":12872,"target":3931},{"edgeType":"contains","source":16314,"target":16981},{"edgeType":"contains","source":16315,"target":16950},{"edgeType":"contains","source":1331,"target":1554},{"edgeType":"contains","source":11776,"target":11778},{"edgeType":"contains","source":4630,"target":4990},{"edgeType":"contains","source":15470,"target":15662},{"edgeType":"contains","source":4244,"target":4271},{"edgeType":"calls","source":4261,"target":2380},{"edgeType":"imports","source":15072,"target":14987},{"edgeType":"contains","source":9926,"target":9934},{"edgeType":"calls","source":15236,"target":15209},{"edgeType":"contains","source":13624,"target":13684},{"edgeType":"calls","source":12436,"target":540},{"edgeType":"contains","source":1331,"target":1555},{"edgeType":"contains","source":7680,"target":7681},{"edgeType":"calls","source":6405,"target":5690},{"edgeType":"contains","source":16314,"target":16980},{"edgeType":"contains","source":16315,"target":16949},{"edgeType":"contains","source":10378,"target":10721},{"edgeType":"contains","source":3971,"target":4277},{"edgeType":"contains","source":4547,"target":5448},{"edgeType":"calls","source":4334,"target":4344},{"edgeType":"contains","source":805,"target":946},{"edgeType":"calls","source":6189,"target":6033},{"edgeType":"imports","source":13351,"target":13373},{"edgeType":"contains","source":5144,"target":5967},{"edgeType":"contains","source":12168,"target":12310},{"edgeType":"contains","source":1,"target":6843},{"edgeType":"contains","source":1063,"target":1404},{"edgeType":"calls","source":12726,"target":12691},{"edgeType":"imports","source":14609,"target":3971},{"edgeType":"contains","source":7679,"target":7711},{"edgeType":"calls","source":3079,"target":3083},{"edgeType":"contains","source":6292,"target":6314},{"edgeType":"contains","source":16314,"target":16983},{"edgeType":"contains","source":14073,"target":14575},{"edgeType":"contains","source":6682,"target":6909},{"edgeType":"contains","source":12168,"target":12309},{"edgeType":"contains","source":9926,"target":9932},{"edgeType":"contains","source":9794,"target":9796},{"edgeType":"calls","source":1303,"target":1059},{"edgeType":"contains","source":13624,"target":13682},{"edgeType":"contains","source":1331,"target":1553},{"edgeType":"calls","source":1765,"target":1535},{"edgeType":"imports","source":13351,"target":13375},{"edgeType":"calls","source":9159,"target":9108},{"edgeType":"contains","source":6292,"target":6315},{"edgeType":"imports","source":14871,"target":14877},{"edgeType":"contains","source":16314,"target":16982},{"edgeType":"contains","source":16315,"target":16951},{"edgeType":"contains","source":805,"target":948},{"edgeType":"imports","source":14695,"target":5535},{"edgeType":"calls","source":2088,"target":2091},{"edgeType":"contains","source":2923,"target":2939},{"edgeType":"calls","source":1580,"target":927},{"edgeType":"contains","source":9926,"target":9933},{"edgeType":"contains","source":7680,"target":7682},{"edgeType":"contains","source":6682,"target":6919},{"edgeType":"contains","source":3315,"target":3477},{"edgeType":"imports","source":13351,"target":13368},{"edgeType":"imports","source":15800,"target":15670},{"edgeType":"calls","source":7532,"target":353},{"edgeType":"imports","source":10379,"target":10366},{"edgeType":"contains","source":805,"target":951},{"edgeType":"contains","source":16314,"target":16969},{"edgeType":"contains","source":14073,"target":14561},{"edgeType":"calls","source":1303,"target":1053},{"edgeType":"calls","source":1618,"target":1858},{"edgeType":"contains","source":6682,"target":6920},{"edgeType":"contains","source":4547,"target":5452},{"edgeType":"contains","source":16004,"target":16009},{"edgeType":"contains","source":14609,"target":14858},{"edgeType":"calls","source":766,"target":786},{"edgeType":"calls","source":6605,"target":5837},{"edgeType":"contains","source":16314,"target":16968},{"edgeType":"contains","source":13350,"target":13733},{"edgeType":"calls","source":3739,"target":3759},{"edgeType":"contains","source":3436,"target":3954},{"edgeType":"calls","source":10149,"target":10131},{"edgeType":"calls","source":5551,"target":4666},{"edgeType":"contains","source":3315,"target":3475},{"edgeType":"calls","source":10482,"target":10382},{"edgeType":"contains","source":16314,"target":16971},{"edgeType":"contains","source":15205,"target":611},{"edgeType":"contains","source":14609,"target":14859},{"edgeType":"calls","source":8890,"target":540},{"edgeType":"calls","source":2163,"target":1875},{"edgeType":"contains","source":742,"target":792},{"edgeType":"contains","source":8259,"target":8773},{"edgeType":"contains","source":1331,"target":1557},{"edgeType":"imports","source":5144,"target":1410},{"edgeType":"contains","source":3315,"target":3474},{"edgeType":"contains","source":3315,"target":3476},{"edgeType":"contains","source":16314,"target":16970},{"edgeType":"contains","source":14609,"target":14860},{"edgeType":"imports","source":15800,"target":15671},{"edgeType":"contains","source":13350,"target":13731},{"edgeType":"contains","source":14863,"target":15443},{"edgeType":"contains","source":742,"target":791},{"edgeType":"contains","source":6292,"target":6328},{"edgeType":"calls","source":14544,"target":2844},{"edgeType":"contains","source":12964,"target":13013},{"edgeType":"contains","source":6682,"target":6915},{"edgeType":"contains","source":5162,"target":5419},{"edgeType":"contains","source":16314,"target":16973},{"edgeType":"contains","source":14609,"target":14861},{"edgeType":"contains","source":13824,"target":13835},{"edgeType":"contains","source":3436,"target":3959},{"edgeType":"contains","source":3383,"target":3488},{"edgeType":"calls","source":8104,"target":7994},{"edgeType":"imports","source":10378,"target":10401},{"edgeType":"calls","source":5612,"target":4886},{"edgeType":"calls","source":11800,"target":11808},{"edgeType":"calls","source":14449,"target":14252},{"edgeType":"contains","source":6681,"target":6947},{"edgeType":"calls","source":6268,"target":5690},{"edgeType":"contains","source":16314,"target":16972},{"edgeType":"calls","source":701,"target":683},{"edgeType":"calls","source":13391,"target":540},{"edgeType":"calls","source":10936,"target":540},{"edgeType":"contains","source":14088,"target":14101},{"edgeType":"calls","source":2291,"target":2134},{"edgeType":"calls","source":5000,"target":4831},{"edgeType":"contains","source":742,"target":793},{"edgeType":"contains","source":10378,"target":10730},{"edgeType":"contains","source":7679,"target":7719},{"edgeType":"contains","source":3383,"target":3487},{"edgeType":"contains","source":5144,"target":5975},{"edgeType":"contains","source":13824,"target":13833},{"edgeType":"calls","source":11280,"target":11013},{"edgeType":"contains","source":16314,"target":16975},{"edgeType":"contains","source":83,"target":85},{"edgeType":"contains","source":14088,"target":14102},{"edgeType":"contains","source":14073,"target":14567},{"edgeType":"calls","source":14839,"target":14842},{"edgeType":"contains","source":9794,"target":9804},{"edgeType":"calls","source":2286,"target":2286},{"edgeType":"contains","source":6682,"target":6918},{"edgeType":"calls","source":15832,"target":15771},{"edgeType":"calls","source":8102,"target":8060},{"edgeType":"contains","source":9596,"target":9602},{"edgeType":"calls","source":5325,"target":5324},{"edgeType":"calls","source":14448,"target":14281},{"edgeType":"contains","source":15740,"target":15743},{"edgeType":"contains","source":16314,"target":16974},{"edgeType":"contains","source":83,"target":84},{"edgeType":"contains","source":14088,"target":14103},{"edgeType":"contains","source":14073,"target":14568},{"edgeType":"calls","source":9686,"target":9692},{"edgeType":"calls","source":11603,"target":11544},{"edgeType":"contains","source":1063,"target":1385},{"edgeType":"contains","source":14609,"target":14849},{"edgeType":"calls","source":6673,"target":5817},{"edgeType":"contains","source":3315,"target":3452},{"edgeType":"contains","source":3436,"target":3930},{"edgeType":"imports","source":1715,"target":1995},{"edgeType":"contains","source":14352,"target":14360},{"edgeType":"contains","source":6212,"target":6666},{"edgeType":"calls","source":8562,"target":8567},{"edgeType":"contains","source":11048,"target":11078},{"edgeType":"contains","source":6682,"target":6894},{"edgeType":"contains","source":12559,"target":12862},{"edgeType":"contains","source":16314,"target":16961},{"edgeType":"contains","source":14609,"target":14850},{"edgeType":"contains","source":5871,"target":6667},{"edgeType":"contains","source":3315,"target":3453},{"edgeType":"contains","source":11048,"target":11080},{"edgeType":"contains","source":7458,"target":8208},{"edgeType":"contains","source":14352,"target":14361},{"edgeType":"contains","source":1331,"target":1535},{"edgeType":"contains","source":3436,"target":3929},{"edgeType":"contains","source":11048,"target":11079},{"edgeType":"calls","source":9289,"target":9284},{"edgeType":"contains","source":14088,"target":14089},{"edgeType":"contains","source":280,"target":291},{"edgeType":"contains","source":1063,"target":1387},{"edgeType":"contains","source":14609,"target":14851},{"edgeType":"imports","source":15800,"target":15664},{"edgeType":"calls","source":4938,"target":4666},{"edgeType":"contains","source":3436,"target":3928},{"edgeType":"contains","source":14352,"target":14362},{"edgeType":"imports","source":15740,"target":611},{"edgeType":"contains","source":11048,"target":11076},{"edgeType":"imports","source":13899,"target":601},{"edgeType":"contains","source":8406,"target":8419},{"edgeType":"contains","source":14073,"target":14555},{"edgeType":"contains","source":1063,"target":1386},{"edgeType":"contains","source":1,"target":11053},{"edgeType":"contains","source":14609,"target":14852},{"edgeType":"contains","source":12315,"target":3510},{"edgeType":"calls","source":8364,"target":8365},{"edgeType":"imports","source":4612,"target":3097},{"edgeType":"calls","source":6845,"target":6830},{"edgeType":"contains","source":3436,"target":3927},{"edgeType":"contains","source":11048,"target":11077},{"edgeType":"imports","source":9529,"target":9222},{"edgeType":"imports","source":15800,"target":15658},{"edgeType":"contains","source":14609,"target":14853},{"edgeType":"contains","source":15340,"target":15447},{"edgeType":"contains","source":5037,"target":5041},{"edgeType":"contains","source":280,"target":293},{"edgeType":"calls","source":10082,"target":10075},{"edgeType":"contains","source":2923,"target":2924},{"edgeType":"contains","source":11554,"target":12301},{"edgeType":"contains","source":11577,"target":11588},{"edgeType":"contains","source":11247,"target":11248},{"edgeType":"contains","source":3436,"target":3934},{"edgeType":"contains","source":16314,"target":16965},{"edgeType":"contains","source":3999,"target":3394},{"edgeType":"imports","source":10378,"target":10393},{"edgeType":"calls","source":15715,"target":4572},{"edgeType":"contains","source":6212,"target":6662},{"edgeType":"contains","source":4244,"target":4255},{"edgeType":"contains","source":16004,"target":16005},{"edgeType":"contains","source":15340,"target":15448},{"edgeType":"contains","source":1063,"target":1388},{"edgeType":"contains","source":13295,"target":13296},{"edgeType":"contains","source":11247,"target":11249},{"edgeType":"contains","source":9854,"target":10036},{"edgeType":"contains","source":13754,"target":13865},{"edgeType":"contains","source":3315,"target":3457},{"edgeType":"calls","source":14789,"target":14252},{"edgeType":"contains","source":16314,"target":16964},{"edgeType":"imports","source":2619,"target":1448},{"edgeType":"contains","source":1,"target":485},{"edgeType":"contains","source":14073,"target":14558},{"edgeType":"calls","source":4091,"target":3438},{"edgeType":"contains","source":16004,"target":16006},{"edgeType":"contains","source":5037,"target":5039},{"edgeType":"contains","source":2989,"target":2990},{"edgeType":"contains","source":15072,"target":4730},{"edgeType":"contains","source":1063,"target":1391},{"edgeType":"calls","source":1304,"target":1045},{"edgeType":"contains","source":13754,"target":13864},{"edgeType":"calls","source":8364,"target":8368},{"edgeType":"contains","source":8259,"target":8744},{"edgeType":"contains","source":10522,"target":6238},{"edgeType":"contains","source":14947,"target":14948},{"edgeType":"contains","source":16314,"target":16967},{"edgeType":"contains","source":12964,"target":12985},{"edgeType":"calls","source":4334,"target":2246},{"edgeType":"contains","source":4547,"target":5430},{"edgeType":"contains","source":12759,"target":12998},{"edgeType":"imports","source":15620,"target":4327},{"edgeType":"contains","source":1063,"target":1390},{"edgeType":"imports","source":10378,"target":10389},{"edgeType":"contains","source":11577,"target":11587},{"edgeType":"contains","source":13625,"target":13634},{"edgeType":"contains","source":13754,"target":13863},{"edgeType":"contains","source":3436,"target":3931},{"edgeType":"contains","source":6212,"target":6665},{"edgeType":"calls","source":9822,"target":9679},{"edgeType":"calls","source":11860,"target":12036},{"edgeType":"imports","source":15620,"target":4326},{"edgeType":"contains","source":742,"target":770},{"edgeType":"imports","source":2153,"target":1094},{"edgeType":"calls","source":4389,"target":540},{"edgeType":"contains","source":7679,"target":7707},{"edgeType":"contains","source":1063,"target":1393},{"edgeType":"contains","source":5144,"target":5956},{"edgeType":"contains","source":14086,"target":14141},{"edgeType":"contains","source":1331,"target":1542},{"edgeType":"contains","source":3253,"target":3268},{"edgeType":"contains","source":5037,"target":5045},{"edgeType":"contains","source":3315,"target":3460},{"edgeType":"contains","source":12168,"target":12307},{"edgeType":"calls","source":7045,"target":6978},{"edgeType":"contains","source":7458,"target":8215},{"edgeType":"contains","source":9926,"target":9930},{"edgeType":"calls","source":11271,"target":11274},{"edgeType":"imports","source":14350,"target":1410},{"edgeType":"contains","source":16466,"target":16469},{"edgeType":"contains","source":12315,"target":3522},{"edgeType":"contains","source":7944,"target":7949},{"edgeType":"contains","source":5037,"target":5044},{"edgeType":"contains","source":6292,"target":6309},{"edgeType":"contains","source":14086,"target":14142},{"edgeType":"calls","source":11860,"target":12043},{"edgeType":"contains","source":1063,"target":1392},{"edgeType":"contains","source":12837,"target":12707},{"edgeType":"contains","source":6682,"target":6903},{"edgeType":"contains","source":12168,"target":12306},{"edgeType":"contains","source":3315,"target":3461},{"edgeType":"contains","source":9926,"target":9931},{"edgeType":"contains","source":7944,"target":7948},{"edgeType":"contains","source":1,"target":11059},{"edgeType":"contains","source":5037,"target":5043},{"edgeType":"contains","source":9854,"target":10045},{"edgeType":"calls","source":9355,"target":9363},{"edgeType":"contains","source":8259,"target":8756},{"edgeType":"calls","source":15367,"target":15374},{"edgeType":"calls","source":10619,"target":10343},{"edgeType":"contains","source":5144,"target":5954},{"edgeType":"contains","source":8736,"target":8767},{"edgeType":"contains","source":6682,"target":6904},{"edgeType":"contains","source":12168,"target":12305},{"edgeType":"contains","source":16314,"target":16955},{"edgeType":"calls","source":11286,"target":2351},{"edgeType":"contains","source":9926,"target":9928},{"edgeType":"contains","source":6292,"target":6311},{"edgeType":"contains","source":7679,"target":7708},{"edgeType":"contains","source":16314,"target":16953},{"edgeType":"contains","source":14073,"target":14547},{"edgeType":"contains","source":1063,"target":1394},{"edgeType":"calls","source":16031,"target":15932},{"edgeType":"contains","source":6682,"target":6906},{"edgeType":"contains","source":8736,"target":8766},{"edgeType":"contains","source":6682,"target":6905},{"edgeType":"imports","source":15095,"target":7913},{"edgeType":"calls","source":5325,"target":5344},{"edgeType":"calls","source":9686,"target":9671},{"edgeType":"contains","source":16314,"target":16954},{"edgeType":"contains","source":9860,"target":9861},{"edgeType":"imports","source":15800,"target":15654},{"edgeType":"contains","source":16466,"target":16470},{"edgeType":"contains","source":4244,"target":4256},{"edgeType":"contains","source":9926,"target":9929},{"edgeType":"contains","source":805,"target":939},{"edgeType":"calls","source":6592,"target":6226},{"edgeType":"contains","source":1331,"target":1546},{"edgeType":"contains","source":1063,"target":1397},{"edgeType":"contains","source":9200,"target":9176},{"edgeType":"contains","source":13624,"target":13676},{"edgeType":"contains","source":4630,"target":4981},{"edgeType":"contains","source":5144,"target":5960},{"edgeType":"contains","source":5174,"target":5030},{"edgeType":"contains","source":6682,"target":6898},{"edgeType":"contains","source":16314,"target":16957},{"edgeType":"contains","source":5871,"target":6671},{"edgeType":"contains","source":14609,"target":14845},{"edgeType":"contains","source":7944,"target":7945},{"edgeType":"contains","source":4244,"target":4262},{"edgeType":"contains","source":805,"target":938},{"edgeType":"contains","source":9854,"target":10044},{"edgeType":"calls","source":15203,"target":7768},{"edgeType":"calls","source":15075,"target":5394},{"edgeType":"contains","source":12964,"target":12994},{"edgeType":"contains","source":7458,"target":8212},{"edgeType":"contains","source":14609,"target":14846},{"edgeType":"contains","source":9926,"target":9927},{"edgeType":"contains","source":8406,"target":8420},{"edgeType":"calls","source":2536,"target":898},{"edgeType":"contains","source":1,"target":493},{"edgeType":"calls","source":840,"target":619},{"edgeType":"imports","source":10378,"target":10382},{"edgeType":"calls","source":6321,"target":6173},{"edgeType":"contains","source":5144,"target":5958},{"edgeType":"contains","source":11048,"target":11081},{"edgeType":"contains","source":1331,"target":1544},{"edgeType":"calls","source":1496,"target":1427},{"edgeType":"contains","source":805,"target":941},{"edgeType":"calls","source":3819,"target":3403},{"edgeType":"contains","source":1063,"target":1399},{"edgeType":"imports","source":9982,"target":9974},{"edgeType":"contains","source":7944,"target":7947},{"edgeType":"contains","source":14609,"target":14847},{"edgeType":"calls","source":15718,"target":2375},{"edgeType":"contains","source":6292,"target":6306},{"edgeType":"contains","source":805,"target":940},{"edgeType":"contains","source":9854,"target":10042},{"edgeType":"calls","source":6592,"target":6229},{"edgeType":"calls","source":2211,"target":400},{"edgeType":"imports","source":12907,"target":12316},{"edgeType":"contains","source":5037,"target":5046},{"edgeType":"contains","source":7944,"target":7946},{"edgeType":"contains","source":6212,"target":6673},{"edgeType":"contains","source":6292,"target":6307},{"edgeType":"calls","source":6729,"target":6211},{"edgeType":"calls","source":11072,"target":11104},{"edgeType":"contains","source":14352,"target":14359},{"edgeType":"contains","source":13096,"target":13111},{"edgeType":"contains","source":13754,"target":13854},{"edgeType":"contains","source":610,"target":613},{"edgeType":"contains","source":1063,"target":1368},{"edgeType":"contains","source":13624,"target":13655},{"edgeType":"contains","source":10975,"target":11212},{"edgeType":"contains","source":13096,"target":13110},{"edgeType":"contains","source":12964,"target":12974},{"edgeType":"imports","source":9858,"target":9644},{"edgeType":"contains","source":12559,"target":12844},{"edgeType":"contains","source":808,"target":816},{"edgeType":"calls","source":7778,"target":7486},{"edgeType":"calls","source":15851,"target":4572},{"edgeType":"contains","source":16795,"target":16831},{"edgeType":"contains","source":1063,"target":1367},{"edgeType":"imports","source":6087,"target":6042},{"edgeType":"calls","source":11194,"target":3067},{"edgeType":"contains","source":10718,"target":10723},{"edgeType":"contains","source":5144,"target":5930},{"edgeType":"contains","source":9854,"target":10024},{"edgeType":"calls","source":15042,"target":2165},{"edgeType":"calls","source":6813,"target":5690},{"edgeType":"contains","source":13096,"target":13109},{"edgeType":"contains","source":12964,"target":12973},{"edgeType":"contains","source":12559,"target":12843},{"edgeType":"contains","source":10784,"target":10788},{"edgeType":"contains","source":610,"target":615},{"edgeType":"contains","source":14086,"target":14135},{"edgeType":"calls","source":1966,"target":1618},{"edgeType":"calls","source":2805,"target":975},{"edgeType":"contains","source":1063,"target":1370},{"edgeType":"calls","source":3606,"target":3626},{"edgeType":"calls","source":2946,"target":2946},{"edgeType":"imports","source":15800,"target":15713},{"edgeType":"calls","source":15006,"target":5394},{"edgeType":"contains","source":13096,"target":13108},{"edgeType":"contains","source":3436,"target":3910},{"edgeType":"contains","source":12964,"target":12972},{"edgeType":"contains","source":10975,"target":11210},{"edgeType":"contains","source":6561,"target":6404},{"edgeType":"contains","source":14086,"target":14136},{"edgeType":"contains","source":14073,"target":14539},{"edgeType":"imports","source":7688,"target":808},{"edgeType":"contains","source":1063,"target":1369},{"edgeType":"calls","source":5420,"target":2358},{"edgeType":"contains","source":7679,"target":7684},{"edgeType":"calls","source":1096,"target":1104},{"edgeType":"calls","source":1046,"target":540},{"edgeType":"calls","source":10034,"target":976},{"edgeType":"calls","source":3953,"target":3438},{"edgeType":"calls","source":6331,"target":5836},{"edgeType":"imports","source":7711,"target":4327},{"edgeType":"contains","source":1995,"target":2078},{"edgeType":"contains","source":13096,"target":13107},{"edgeType":"contains","source":12559,"target":12841},{"edgeType":"contains","source":14086,"target":14137},{"edgeType":"contains","source":10057,"target":10068},{"edgeType":"contains","source":1063,"target":1372},{"edgeType":"calls","source":10676,"target":10672},{"edgeType":"contains","source":3315,"target":3439},{"edgeType":"contains","source":16795,"target":16836},{"edgeType":"contains","source":1,"target":468},{"edgeType":"contains","source":10975,"target":11208},{"edgeType":"contains","source":13096,"target":13106},{"edgeType":"contains","source":8329,"target":8668},{"edgeType":"contains","source":12964,"target":12970},{"edgeType":"contains","source":14086,"target":14138},{"edgeType":"contains","source":10784,"target":10787},{"edgeType":"calls","source":6729,"target":6184},{"edgeType":"contains","source":10718,"target":10719},{"edgeType":"calls","source":6778,"target":6779},{"edgeType":"calls","source":16360,"target":16272},{"edgeType":"contains","source":1063,"target":1371},{"edgeType":"imports","source":4545,"target":997},{"edgeType":"contains","source":16795,"target":16835},{"edgeType":"contains","source":3315,"target":3440},{"edgeType":"contains","source":1375,"target":2273},{"edgeType":"contains","source":610,"target":619},{"edgeType":"contains","source":7608,"target":7767},{"edgeType":"contains","source":13096,"target":13105},{"edgeType":"contains","source":10378,"target":10685},{"edgeType":"contains","source":14073,"target":14542},{"edgeType":"contains","source":808,"target":823},{"edgeType":"contains","source":10057,"target":10066},{"edgeType":"contains","source":1063,"target":1374},{"edgeType":"contains","source":16466,"target":16467},{"edgeType":"contains","source":3315,"target":3437},{"edgeType":"calls","source":8238,"target":8029},{"edgeType":"contains","source":11576,"target":11600},{"edgeType":"imports","source":6087,"target":6049},{"edgeType":"calls","source":14546,"target":9088},{"edgeType":"contains","source":13754,"target":13847},{"edgeType":"contains","source":16795,"target":16838},{"edgeType":"contains","source":610,"target":618},{"edgeType":"contains","source":13096,"target":13104},{"edgeType":"contains","source":4244,"target":4235},{"edgeType":"calls","source":16031,"target":15903},{"edgeType":"contains","source":1,"target":470},{"edgeType":"contains","source":808,"target":822},{"edgeType":"calls","source":2021,"target":2022},{"edgeType":"contains","source":12759,"target":12980},{"edgeType":"imports","source":13217,"target":13334},{"edgeType":"contains","source":10784,"target":10785},{"edgeType":"contains","source":10057,"target":10067},{"edgeType":"calls","source":8103,"target":7987},{"edgeType":"contains","source":1063,"target":1373},{"edgeType":"contains","source":801,"target":3153},{"edgeType":"contains","source":14418,"target":14419},{"edgeType":"contains","source":1621,"target":987},{"edgeType":"calls","source":10482,"target":10343},{"edgeType":"contains","source":7679,"target":7680},{"edgeType":"contains","source":3315,"target":3444},{"edgeType":"calls","source":14447,"target":14278},{"edgeType":"contains","source":13625,"target":13633},{"edgeType":"contains","source":13754,"target":13862},{"edgeType":"contains","source":4230,"target":2562},{"edgeType":"contains","source":280,"target":281},{"edgeType":"contains","source":801,"target":3156},{"edgeType":"calls","source":12947,"target":3698},{"edgeType":"contains","source":808,"target":825},{"edgeType":"contains","source":3436,"target":3922},{"edgeType":"contains","source":1063,"target":1376},{"edgeType":"contains","source":7109,"target":6333},{"edgeType":"calls","source":1955,"target":1948},{"edgeType":"calls","source":3313,"target":2134},{"edgeType":"contains","source":15340,"target":15419},{"edgeType":"contains","source":16466,"target":16451},{"edgeType":"contains","source":13754,"target":13861},{"edgeType":"contains","source":8406,"target":8408},{"edgeType":"contains","source":6292,"target":6293},{"edgeType":"calls","source":8635,"target":8409},{"edgeType":"contains","source":808,"target":824},{"edgeType":"calls","source":3166,"target":349},{"edgeType":"contains","source":3436,"target":3921},{"edgeType":"calls","source":15801,"target":12473},{"edgeType":"calls","source":11072,"target":11082},{"edgeType":"contains","source":11445,"target":11446},{"edgeType":"contains","source":13754,"target":13860},{"edgeType":"imports","source":5430,"target":5262},{"edgeType":"calls","source":11205,"target":11187},{"edgeType":"contains","source":16466,"target":16454},{"edgeType":"contains","source":6212,"target":6660},{"edgeType":"contains","source":808,"target":827},{"edgeType":"contains","source":8406,"target":8411},{"edgeType":"contains","source":1063,"target":1378},{"edgeType":"contains","source":3436,"target":3920},{"edgeType":"calls","source":6458,"target":6134},{"edgeType":"contains","source":3315,"target":3441},{"edgeType":"contains","source":5433,"target":5434},{"edgeType":"calls","source":5325,"target":5295},{"edgeType":"contains","source":6682,"target":6889},{"edgeType":"calls","source":11297,"target":4108},{"edgeType":"calls","source":6911,"target":6890},{"edgeType":"contains","source":610,"target":622},{"edgeType":"calls","source":7806,"target":286},{"edgeType":"calls","source":9490,"target":9389},{"edgeType":"contains","source":10567,"target":611},{"edgeType":"contains","source":13754,"target":13859},{"edgeType":"imports","source":7963,"target":730},{"edgeType":"contains","source":808,"target":826},{"edgeType":"contains","source":13361,"target":13357},{"edgeType":"contains","source":6212,"target":6661},{"edgeType":"contains","source":14086,"target":14128},{"edgeType":"contains","source":1063,"target":1377},{"edgeType":"calls","source":16031,"target":15915},{"edgeType":"contains","source":13625,"target":13629},{"edgeType":"contains","source":5389,"target":4691},{"edgeType":"calls","source":11210,"target":11038},{"edgeType":"calls","source":9300,"target":2597},{"edgeType":"contains","source":9854,"target":10027},{"edgeType":"contains","source":4244,"target":4247},{"edgeType":"contains","source":808,"target":829},{"edgeType":"calls","source":3012,"target":3004},{"edgeType":"contains","source":14073,"target":14532},{"edgeType":"contains","source":1063,"target":1380},{"edgeType":"contains","source":7517,"target":6367},{"edgeType":"contains","source":13754,"target":13857},{"edgeType":"calls","source":9878,"target":1591},{"edgeType":"imports","source":16164,"target":14987},{"edgeType":"contains","source":280,"target":284},{"edgeType":"calls","source":5005,"target":4642},{"edgeType":"calls","source":5004,"target":4673},{"edgeType":"imports","source":7719,"target":4072},{"edgeType":"contains","source":1,"target":6819},{"edgeType":"contains","source":8329,"target":8676},{"edgeType":"calls","source":3679,"target":3468},{"edgeType":"contains","source":808,"target":828},{"edgeType":"calls","source":1720,"target":772},{"edgeType":"contains","source":10975,"target":11213},{"edgeType":"contains","source":13754,"target":13856},{"edgeType":"calls","source":6711,"target":6751},{"edgeType":"calls","source":6911,"target":6893},{"edgeType":"calls","source":2351,"target":2352},{"edgeType":"contains","source":808,"target":831},{"edgeType":"calls","source":3681,"target":3403},{"edgeType":"contains","source":7679,"target":7689},{"edgeType":"contains","source":3436,"target":3924},{"edgeType":"contains","source":3392,"target":3174},{"edgeType":"contains","source":11445,"target":11441},{"edgeType":"calls","source":7769,"target":7778},{"edgeType":"contains","source":4640,"target":4652},{"edgeType":"contains","source":9529,"target":9532},{"edgeType":"contains","source":11577,"target":11579},{"edgeType":"contains","source":13754,"target":13855},{"edgeType":"contains","source":8009,"target":8028},{"edgeType":"contains","source":12559,"target":12846},{"edgeType":"contains","source":16473,"target":16240},{"edgeType":"contains","source":4135,"target":3394},{"edgeType":"contains","source":14352,"target":14342},{"edgeType":"contains","source":808,"target":830},{"edgeType":"contains","source":12559,"target":12847},{"edgeType":"contains","source":7679,"target":7688},{"edgeType":"contains","source":3436,"target":3923},{"edgeType":"contains","source":1063,"target":1381},{"edgeType":"contains","source":13096,"target":13112},{"edgeType":"contains","source":801,"target":3161},{"edgeType":"contains","source":1063,"target":1352},{"edgeType":"contains","source":12631,"target":12711},{"edgeType":"contains","source":14073,"target":14519},{"edgeType":"contains","source":5102,"target":5103},{"edgeType":"contains","source":5168,"target":5171},{"edgeType":"contains","source":3315,"target":3419},{"edgeType":"contains","source":3648,"target":3667},{"edgeType":"contains","source":15210,"target":15212},{"edgeType":"contains","source":6212,"target":6633},{"edgeType":"contains","source":13754,"target":13837},{"edgeType":"contains","source":10247,"target":10508},{"edgeType":"contains","source":4244,"target":2104},{"edgeType":"imports","source":14871,"target":4327},{"edgeType":"contains","source":5034,"target":5096},{"edgeType":"contains","source":6819,"target":6842},{"edgeType":"calls","source":7967,"target":7951},{"edgeType":"contains","source":16314,"target":16928},{"edgeType":"contains","source":16332,"target":16370},{"edgeType":"imports","source":15484,"target":2236},{"edgeType":"contains","source":14086,"target":14117},{"edgeType":"contains","source":14073,"target":14520},{"edgeType":"contains","source":9858,"target":9883},{"edgeType":"contains","source":7084,"target":7085},{"edgeType":"contains","source":3315,"target":3420},{"edgeType":"contains","source":3648,"target":3666},{"edgeType":"contains","source":3971,"target":4223},{"edgeType":"contains","source":15210,"target":15213},{"edgeType":"contains","source":10244,"target":10602},{"edgeType":"contains","source":6212,"target":6634},{"edgeType":"contains","source":3516,"target":3530},{"edgeType":"imports","source":14871,"target":4326},{"edgeType":"contains","source":13242,"target":4339},{"edgeType":"contains","source":12559,"target":12828},{"edgeType":"contains","source":5034,"target":5095},{"edgeType":"contains","source":14086,"target":14118},{"edgeType":"contains","source":16314,"target":16927},{"edgeType":"contains","source":16332,"target":16369},{"edgeType":"contains","source":1063,"target":1354},{"edgeType":"contains","source":7084,"target":7086},{"edgeType":"contains","source":5168,"target":5169},{"edgeType":"contains","source":12150,"target":12821},{"edgeType":"contains","source":3315,"target":3417},{"edgeType":"calls","source":12322,"target":12475},{"edgeType":"contains","source":13624,"target":13637},{"edgeType":"contains","source":4244,"target":2102},{"edgeType":"imports","source":11906,"target":11680},{"edgeType":"imports","source":15740,"target":2758},{"edgeType":"contains","source":6212,"target":6635},{"edgeType":"contains","source":3436,"target":3895},{"edgeType":"calls","source":7175,"target":7137},{"edgeType":"contains","source":8713,"target":9439},{"edgeType":"imports","source":15484,"target":4352},{"edgeType":"contains","source":801,"target":3133},{"edgeType":"contains","source":16004,"target":15968},{"edgeType":"contains","source":8329,"target":8659},{"edgeType":"contains","source":1063,"target":1353},{"edgeType":"contains","source":3252,"target":3257},{"edgeType":"contains","source":3315,"target":3418},{"edgeType":"contains","source":9858,"target":9881},{"edgeType":"contains","source":3648,"target":3664},{"edgeType":"contains","source":9466,"target":9350},{"edgeType":"calls","source":5208,"target":4719},{"edgeType":"calls","source":6381,"target":6383},{"edgeType":"contains","source":13754,"target":13834},{"edgeType":"calls","source":2408,"target":615},{"edgeType":"calls","source":6445,"target":6513},{"edgeType":"contains","source":3436,"target":3894},{"edgeType":"contains","source":8713,"target":9438},{"edgeType":"contains","source":16332,"target":16371},{"edgeType":"imports","source":9624,"target":6310},{"edgeType":"contains","source":801,"target":3132},{"edgeType":"contains","source":14088,"target":14058},{"edgeType":"contains","source":14073,"target":14523},{"edgeType":"calls","source":2155,"target":2112},{"edgeType":"calls","source":6263,"target":5838},{"edgeType":"contains","source":6682,"target":6857},{"edgeType":"calls","source":15579,"target":4526},{"edgeType":"contains","source":1063,"target":1356},{"edgeType":"calls","source":1590,"target":600},{"edgeType":"contains","source":3315,"target":3423},{"edgeType":"contains","source":13624,"target":13635},{"edgeType":"calls","source":6445,"target":6514},{"edgeType":"contains","source":4072,"target":5326},{"edgeType":"calls","source":6381,"target":6384},{"edgeType":"imports","source":14871,"target":14893},{"edgeType":"contains","source":6819,"target":6838},{"edgeType":"contains","source":8713,"target":9433},{"edgeType":"contains","source":14073,"target":14524},{"edgeType":"contains","source":15340,"target":15415},{"edgeType":"contains","source":16795,"target":16818},{"edgeType":"contains","source":1063,"target":1355},{"edgeType":"contains","source":13754,"target":13832},{"edgeType":"calls","source":14389,"target":13940},{"edgeType":"imports","source":9854,"target":9756},{"edgeType":"contains","source":16314,"target":16931},{"edgeType":"contains","source":16332,"target":16373},{"edgeType":"contains","source":14073,"target":14525},{"edgeType":"contains","source":4375,"target":4388},{"edgeType":"contains","source":6819,"target":6839},{"edgeType":"contains","source":801,"target":3138},{"edgeType":"contains","source":1063,"target":1358},{"edgeType":"contains","source":3315,"target":3421},{"edgeType":"contains","source":3516,"target":3533},{"edgeType":"calls","source":7807,"target":4461},{"edgeType":"contains","source":3971,"target":4227},{"edgeType":"contains","source":10321,"target":10322},{"edgeType":"calls","source":4732,"target":4673},{"edgeType":"contains","source":15834,"target":4330},{"edgeType":"calls","source":1993,"target":793},{"edgeType":"contains","source":8713,"target":9435},{"edgeType":"calls","source":5777,"target":1874},{"edgeType":"contains","source":1063,"target":1357},{"edgeType":"contains","source":5102,"target":5104},{"edgeType":"contains","source":3315,"target":3422},{"edgeType":"contains","source":10069,"target":3336},{"edgeType":"contains","source":9858,"target":9877},{"edgeType":"contains","source":6212,"target":6632},{"edgeType":"contains","source":801,"target":3136},{"edgeType":"contains","source":4375,"target":4386},{"edgeType":"contains","source":6819,"target":6841},{"edgeType":"calls","source":12808,"target":12218},{"edgeType":"contains","source":801,"target":3140},{"edgeType":"contains","source":7608,"target":7761},{"edgeType":"contains","source":16332,"target":16361},{"edgeType":"contains","source":808,"target":809},{"edgeType":"contains","source":1063,"target":1360},{"edgeType":"contains","source":13096,"target":13103},{"edgeType":"calls","source":3439,"target":358},{"edgeType":"contains","source":12964,"target":12967},{"edgeType":"calls","source":1955,"target":1965},{"edgeType":"calls","source":4069,"target":4082},{"edgeType":"contains","source":1,"target":457},{"edgeType":"contains","source":10057,"target":10064},{"edgeType":"calls","source":11209,"target":11049},{"edgeType":"contains","source":14813,"target":14826},{"edgeType":"contains","source":801,"target":3139},{"edgeType":"contains","source":1063,"target":1359},{"edgeType":"contains","source":13096,"target":13102},{"edgeType":"contains","source":14073,"target":14512},{"edgeType":"calls","source":3780,"target":358},{"edgeType":"contains","source":10850,"target":10851},{"edgeType":"contains","source":10057,"target":10065},{"edgeType":"contains","source":13624,"target":13646},{"edgeType":"contains","source":8713,"target":9444},{"edgeType":"contains","source":4547,"target":5402},{"edgeType":"calls","source":9160,"target":9030},{"edgeType":"calls","source":15237,"target":4572},{"edgeType":"contains","source":4375,"target":4391},{"edgeType":"contains","source":2988,"target":2992},{"edgeType":"calls","source":766,"target":773},{"edgeType":"contains","source":808,"target":811},{"edgeType":"contains","source":13350,"target":13683},{"edgeType":"imports","source":10379,"target":10380},{"edgeType":"contains","source":1063,"target":1362},{"edgeType":"contains","source":13096,"target":13101},{"edgeType":"contains","source":3315,"target":3425},{"edgeType":"calls","source":12393,"target":12396},{"edgeType":"calls","source":642,"target":389},{"edgeType":"contains","source":10247,"target":10514},{"edgeType":"calls","source":11204,"target":11202},{"edgeType":"calls","source":15227,"target":2769},{"edgeType":"contains","source":5961,"target":5968},{"edgeType":"calls","source":9156,"target":9157},{"edgeType":"contains","source":10057,"target":10062},{"edgeType":"calls","source":2209,"target":433},{"edgeType":"contains","source":808,"target":810},{"edgeType":"contains","source":4970,"target":4972},{"edgeType":"contains","source":1063,"target":1361},{"edgeType":"contains","source":3516,"target":3536},{"edgeType":"calls","source":3739,"target":3741},{"edgeType":"calls","source":8428,"target":8469},{"edgeType":"contains","source":1204,"target":1218},{"edgeType":"contains","source":13624,"target":13644},{"edgeType":"calls","source":3941,"target":3821},{"edgeType":"contains","source":4072,"target":5327},{"edgeType":"calls","source":1035,"target":889},{"edgeType":"imports","source":7458,"target":7913},{"edgeType":"contains","source":13754,"target":13842},{"edgeType":"contains","source":10057,"target":10063},{"edgeType":"contains","source":7139,"target":7497},{"edgeType":"contains","source":9854,"target":10010},{"edgeType":"contains","source":808,"target":813},{"edgeType":"calls","source":2355,"target":2246},{"edgeType":"contains","source":16068,"target":16093},{"edgeType":"contains","source":14088,"target":14050},{"edgeType":"contains","source":11048,"target":11050},{"edgeType":"imports","source":4630,"target":4679},{"edgeType":"contains","source":4970,"target":4979},{"edgeType":"contains","source":1063,"target":1364},{"edgeType":"contains","source":13096,"target":13099},{"edgeType":"calls","source":2037,"target":1533},{"edgeType":"contains","source":13754,"target":13841},{"edgeType":"contains","source":8713,"target":9441},{"edgeType":"contains","source":10784,"target":10777},{"edgeType":"calls","source":7739,"target":4461},{"edgeType":"contains","source":8009,"target":8011},{"edgeType":"contains","source":10244,"target":10605},{"edgeType":"contains","source":10247,"target":10512},{"edgeType":"contains","source":1995,"target":2070},{"edgeType":"imports","source":13217,"target":13307},{"edgeType":"contains","source":808,"target":812},{"edgeType":"contains","source":14073,"target":14516},{"edgeType":"contains","source":16072,"target":15968},{"edgeType":"contains","source":11048,"target":11051},{"edgeType":"contains","source":5168,"target":5182},{"edgeType":"contains","source":1063,"target":1363},{"edgeType":"calls","source":1955,"target":1960},{"edgeType":"imports","source":12908,"target":12316},{"edgeType":"contains","source":4970,"target":4978},{"edgeType":"contains","source":1204,"target":1220},{"edgeType":"calls","source":9882,"target":1450},{"edgeType":"contains","source":8713,"target":9440},{"edgeType":"contains","source":10057,"target":10061},{"edgeType":"contains","source":4970,"target":4977},{"edgeType":"contains","source":808,"target":815},{"edgeType":"contains","source":9858,"target":9884},{"edgeType":"calls","source":4207,"target":4027},{"edgeType":"calls","source":11865,"target":11856},{"edgeType":"contains","source":801,"target":3146},{"edgeType":"contains","source":1063,"target":1366},{"edgeType":"contains","source":13096,"target":13097},{"edgeType":"contains","source":7139,"target":7499},{"edgeType":"contains","source":10244,"target":10603},{"edgeType":"calls","source":8234,"target":8145},{"edgeType":"contains","source":6682,"target":6867},{"edgeType":"calls","source":10523,"target":609},{"edgeType":"calls","source":15606,"target":7928},{"edgeType":"contains","source":10057,"target":10058},{"edgeType":"imports","source":13624,"target":13375},{"edgeType":"contains","source":16332,"target":16368},{"edgeType":"calls","source":3012,"target":3019},{"edgeType":"contains","source":808,"target":814},{"edgeType":"contains","source":4970,"target":4976},{"edgeType":"contains","source":5168,"target":5180},{"edgeType":"contains","source":11048,"target":11049},{"edgeType":"contains","source":3383,"target":3435},{"edgeType":"contains","source":1063,"target":1365},{"edgeType":"contains","source":801,"target":3145},{"edgeType":"contains","source":15210,"target":15211},{"edgeType":"contains","source":7139,"target":7500},{"edgeType":"contains","source":1204,"target":1222},{"edgeType":"contains","source":3315,"target":3430},{"edgeType":"contains","source":13754,"target":13838},{"edgeType":"contains","source":8713,"target":9442},{"edgeType":"contains","source":10057,"target":10059},{"edgeType":"contains","source":16314,"target":16925},{"edgeType":"contains","source":5961,"target":5965},{"edgeType":"contains","source":1995,"target":2069},{"edgeType":"contains","source":1,"target":462},{"edgeType":"contains","source":10244,"target":10604},{"edgeType":"imports","source":15800,"target":15683},{"edgeType":"calls","source":1661,"target":600},{"edgeType":"calls","source":9821,"target":9788},{"edgeType":"calls","source":7067,"target":6370},{"edgeType":"calls","source":10290,"target":1591},{"edgeType":"contains","source":12168,"target":12249},{"edgeType":"contains","source":6819,"target":6826},{"edgeType":"contains","source":10386,"target":10410},{"edgeType":"contains","source":801,"target":3115},{"edgeType":"contains","source":6621,"target":6622},{"edgeType":"imports","source":15856,"target":15858},{"edgeType":"contains","source":8001,"target":8238},{"edgeType":"contains","source":9858,"target":9866},{"edgeType":"calls","source":8102,"target":8110},{"edgeType":"contains","source":9985,"target":10157},{"edgeType":"calls","source":13225,"target":3627},{"edgeType":"contains","source":5430,"target":5488},{"edgeType":"contains","source":16472,"target":16240},{"edgeType":"contains","source":6819,"target":6827},{"edgeType":"contains","source":801,"target":3114},{"edgeType":"contains","source":4969,"target":4980},{"edgeType":"contains","source":16314,"target":16910},{"edgeType":"calls","source":2028,"target":1906},{"edgeType":"calls","source":6748,"target":5690},{"edgeType":"contains","source":14073,"target":14504},{"edgeType":"contains","source":14813,"target":14819},{"edgeType":"contains","source":3648,"target":3650},{"edgeType":"contains","source":3971,"target":4207},{"edgeType":"contains","source":5509,"target":5156},{"edgeType":"contains","source":6819,"target":6828},{"edgeType":"contains","source":3588,"target":3394},{"edgeType":"calls","source":967,"target":975},{"edgeType":"contains","source":11774,"target":11776},{"edgeType":"contains","source":1,"target":434},{"edgeType":"contains","source":10386,"target":10408},{"edgeType":"contains","source":8713,"target":9423},{"edgeType":"contains","source":801,"target":3117},{"edgeType":"contains","source":6621,"target":6624},{"edgeType":"contains","source":9985,"target":10155},{"edgeType":"contains","source":14813,"target":14820},{"edgeType":"contains","source":5509,"target":5157},{"edgeType":"contains","source":14350,"target":14375},{"edgeType":"contains","source":6819,"target":6829},{"edgeType":"imports","source":1779,"target":1940},{"edgeType":"contains","source":6621,"target":6625},{"edgeType":"imports","source":16018,"target":2381},{"edgeType":"calls","source":15606,"target":5926},{"edgeType":"contains","source":9985,"target":10156},{"edgeType":"imports","source":14075,"target":5535},{"edgeType":"contains","source":14813,"target":14821},{"edgeType":"contains","source":10378,"target":10654},{"edgeType":"contains","source":12764,"target":4339},{"edgeType":"contains","source":14350,"target":14376},{"edgeType":"calls","source":13834,"target":12235},{"edgeType":"contains","source":6819,"target":6822},{"edgeType":"contains","source":801,"target":3119},{"edgeType":"contains","source":8001,"target":8234},{"edgeType":"calls","source":10758,"target":10343},{"edgeType":"contains","source":9858,"target":9862},{"edgeType":"contains","source":16795,"target":16803},{"edgeType":"contains","source":3516,"target":3519},{"edgeType":"contains","source":3436,"target":3885},{"edgeType":"contains","source":10386,"target":10407},{"edgeType":"contains","source":3436,"target":3883},{"edgeType":"contains","source":14350,"target":14377},{"edgeType":"contains","source":8267,"target":8443},{"edgeType":"contains","source":801,"target":3118},{"edgeType":"calls","source":2090,"target":2097},{"edgeType":"contains","source":14073,"target":14508},{"edgeType":"contains","source":6819,"target":6823},{"edgeType":"calls","source":8697,"target":8696},{"edgeType":"calls","source":8104,"target":8053},{"edgeType":"contains","source":16795,"target":16802},{"edgeType":"contains","source":6540,"target":7015},{"edgeType":"contains","source":15470,"target":15596},{"edgeType":"contains","source":14813,"target":14823},{"edgeType":"calls","source":12159,"target":7080},{"edgeType":"contains","source":3436,"target":3884},{"edgeType":"contains","source":7876,"target":7880},{"edgeType":"contains","source":3436,"target":3882},{"edgeType":"contains","source":16332,"target":16359},{"edgeType":"calls","source":2421,"target":2403},{"edgeType":"calls","source":15623,"target":5394},{"edgeType":"contains","source":8267,"target":8446},{"edgeType":"contains","source":10378,"target":10652},{"edgeType":"contains","source":12631,"target":12688},{"edgeType":"calls","source":1958,"target":1961},{"edgeType":"contains","source":6819,"target":6824},{"edgeType":"contains","source":5871,"target":6615},{"edgeType":"contains","source":6540,"target":7016},{"edgeType":"calls","source":4954,"target":2102},{"edgeType":"contains","source":7876,"target":7883},{"edgeType":"contains","source":10565,"target":6970},{"edgeType":"contains","source":16332,"target":16358},{"edgeType":"contains","source":3436,"target":3881},{"edgeType":"contains","source":14350,"target":14379},{"edgeType":"contains","source":8267,"target":8445},{"edgeType":"calls","source":15925,"target":2375},{"edgeType":"contains","source":801,"target":3120},{"edgeType":"contains","source":12631,"target":12687},{"edgeType":"contains","source":6819,"target":6825},{"edgeType":"imports","source":11906,"target":893},{"edgeType":"contains","source":8001,"target":8235},{"edgeType":"calls","source":8635,"target":8506},{"edgeType":"calls","source":14870,"target":13940},{"edgeType":"contains","source":3971,"target":4209},{"edgeType":"contains","source":13714,"target":12939},{"edgeType":"calls","source":2537,"target":919},{"edgeType":"calls","source":1099,"target":1101},{"edgeType":"contains","source":6819,"target":6834},{"edgeType":"contains","source":6682,"target":6853},{"edgeType":"contains","source":1778,"target":2434},{"edgeType":"contains","source":11774,"target":11786},{"edgeType":"contains","source":345,"target":347},{"edgeType":"contains","source":16131,"target":16234},{"edgeType":"contains","source":3436,"target":3889},{"edgeType":"imports","source":595,"target":601},{"edgeType":"contains","source":3315,"target":3412},{"edgeType":"calls","source":11604,"target":11605},{"edgeType":"contains","source":8713,"target":9428},{"edgeType":"calls","source":2024,"target":2022},{"edgeType":"contains","source":12372,"target":12274},{"edgeType":"contains","source":5871,"target":6626},{"edgeType":"contains","source":8329,"target":8647},{"edgeType":"contains","source":345,"target":346},{"edgeType":"contains","source":4375,"target":4376},{"edgeType":"contains","source":3648,"target":3658},{"edgeType":"calls","source":3477,"target":3491},{"edgeType":"contains","source":1063,"target":1342},{"edgeType":"contains","source":13360,"target":13357},{"edgeType":"contains","source":16322,"target":16654},{"edgeType":"contains","source":16131,"target":16233},{"edgeType":"calls","source":16031,"target":16012},{"edgeType":"calls","source":15918,"target":8945},{"edgeType":"contains","source":8713,"target":9431},{"edgeType":"calls","source":14448,"target":14344},{"edgeType":"calls","source":11282,"target":11013},{"edgeType":"contains","source":11774,"target":11784},{"edgeType":"contains","source":10386,"target":10416},{"edgeType":"calls","source":11213,"target":11038},{"edgeType":"contains","source":801,"target":3125},{"edgeType":"calls","source":3615,"target":3438},{"edgeType":"calls","source":14565,"target":2260},{"edgeType":"contains","source":16322,"target":16657},{"edgeType":"calls","source":6393,"target":6134},{"edgeType":"contains","source":6819,"target":6836},{"edgeType":"contains","source":1331,"target":1491},{"edgeType":"contains","source":11774,"target":11785},{"edgeType":"contains","source":13888,"target":13900},{"edgeType":"contains","source":345,"target":348},{"edgeType":"imports","source":15986,"target":16049},{"edgeType":"contains","source":3648,"target":3656},{"edgeType":"contains","source":14073,"target":14498},{"edgeType":"contains","source":16322,"target":16656},{"edgeType":"contains","source":12631,"target":12700},{"edgeType":"contains","source":16131,"target":16235},{"edgeType":"contains","source":6819,"target":6837},{"edgeType":"contains","source":3436,"target":3886},{"edgeType":"contains","source":7084,"target":7078},{"edgeType":"contains","source":3315,"target":3409},{"edgeType":"contains","source":1204,"target":1205},{"edgeType":"contains","source":5234,"target":5235},{"edgeType":"contains","source":3315,"target":3415},{"edgeType":"contains","source":16322,"target":16659},{"edgeType":"calls","source":2354,"target":2360},{"edgeType":"contains","source":8267,"target":8452},{"edgeType":"calls","source":14800,"target":3438},{"edgeType":"contains","source":3436,"target":3893},{"edgeType":"contains","source":5871,"target":6621},{"edgeType":"contains","source":1331,"target":1497},{"edgeType":"imports","source":595,"target":597},{"edgeType":"contains","source":6819,"target":6831},{"edgeType":"contains","source":13888,"target":13898},{"edgeType":"calls","source":4998,"target":730},{"edgeType":"contains","source":8267,"target":8451},{"edgeType":"contains","source":3971,"target":4219},{"edgeType":"calls","source":15116,"target":2097},{"edgeType":"contains","source":801,"target":3126},{"edgeType":"calls","source":3606,"target":3716},{"edgeType":"contains","source":14813,"target":14815},{"edgeType":"contains","source":14086,"target":14097},{"edgeType":"contains","source":14088,"target":14035},{"edgeType":"calls","source":14565,"target":2265},{"edgeType":"contains","source":15340,"target":15390},{"edgeType":"contains","source":3315,"target":3413},{"edgeType":"contains","source":8713,"target":9427},{"edgeType":"calls","source":8103,"target":8094},{"edgeType":"contains","source":13624,"target":13625},{"edgeType":"contains","source":6819,"target":6832},{"edgeType":"contains","source":14073,"target":14501},{"edgeType":"contains","source":10583,"target":10648},{"edgeType":"contains","source":3516,"target":3525},{"edgeType":"contains","source":16795,"target":16797},{"edgeType":"contains","source":10069,"target":3327},{"edgeType":"calls","source":7905,"target":7889},{"edgeType":"calls","source":3911,"target":600},{"edgeType":"imports","source":15130,"target":15099},{"edgeType":"contains","source":3252,"target":3253},{"edgeType":"calls","source":1231,"target":1234},{"edgeType":"contains","source":11576,"target":11577},{"edgeType":"contains","source":3315,"target":3414},{"edgeType":"calls","source":5327,"target":5328},{"edgeType":"contains","source":8713,"target":9426},{"edgeType":"contains","source":15866,"target":15999},{"edgeType":"contains","source":16332,"target":16350},{"edgeType":"contains","source":8001,"target":8243},{"edgeType":"contains","source":14350,"target":14371},{"edgeType":"calls","source":6872,"target":6088},{"edgeType":"imports","source":14075,"target":13978},{"edgeType":"contains","source":8267,"target":8453},{"edgeType":"contains","source":7084,"target":7074},{"edgeType":"contains","source":801,"target":3128},{"edgeType":"calls","source":2354,"target":2359},{"edgeType":"contains","source":3516,"target":3524},{"edgeType":"contains","source":16795,"target":16796},{"edgeType":"imports","source":15581,"target":7459},{"edgeType":"contains","source":14073,"target":14486},{"edgeType":"contains","source":9260,"target":9360},{"edgeType":"contains","source":5969,"target":5676},{"edgeType":"calls","source":12661,"target":12638},{"edgeType":"calls","source":6867,"target":6211},{"edgeType":"contains","source":8267,"target":8432},{"edgeType":"imports","source":13869,"target":1331},{"edgeType":"contains","source":1063,"target":1318},{"edgeType":"contains","source":10378,"target":10642},{"edgeType":"contains","source":16322,"target":16647},{"edgeType":"contains","source":16332,"target":16337},{"edgeType":"imports","source":4228,"target":4230},{"edgeType":"contains","source":14073,"target":14487},{"edgeType":"contains","source":10324,"target":1746},{"edgeType":"contains","source":11575,"target":11589},{"edgeType":"calls","source":6729,"target":6262},{"edgeType":"contains","source":11451,"target":11205},{"edgeType":"contains","source":5509,"target":5139},{"edgeType":"contains","source":3436,"target":3863},{"edgeType":"contains","source":10122,"target":10123},{"edgeType":"imports","source":10130,"target":965},{"edgeType":"contains","source":1063,"target":1317},{"edgeType":"contains","source":12559,"target":4339},{"edgeType":"contains","source":16322,"target":16646},{"edgeType":"calls","source":14080,"target":358},{"edgeType":"calls","source":14973,"target":14961},{"edgeType":"contains","source":12168,"target":12230},{"edgeType":"contains","source":13952,"target":14011},{"edgeType":"contains","source":3303,"target":3756},{"edgeType":"contains","source":8001,"target":8223},{"edgeType":"contains","source":5430,"target":5470},{"edgeType":"contains","source":13952,"target":3436},{"edgeType":"contains","source":5509,"target":5140},{"edgeType":"calls","source":2355,"target":2356},{"edgeType":"contains","source":4176,"target":4177},{"edgeType":"contains","source":10386,"target":10392},{"edgeType":"contains","source":10247,"target":10473},{"edgeType":"contains","source":8074,"target":8075},{"edgeType":"contains","source":2784,"target":2932},{"edgeType":"contains","source":16322,"target":16649},{"edgeType":"contains","source":16332,"target":16339},{"edgeType":"calls","source":15720,"target":2375},{"edgeType":"contains","source":9260,"target":9361},{"edgeType":"contains","source":3303,"target":3757},{"edgeType":"contains","source":6137,"target":6814},{"edgeType":"imports","source":12392,"target":612},{"edgeType":"imports","source":12256,"target":600},{"edgeType":"contains","source":15866,"target":15986},{"edgeType":"contains","source":14086,"target":14087},{"edgeType":"contains","source":2784,"target":2933},{"edgeType":"contains","source":16332,"target":16338},{"edgeType":"contains","source":16131,"target":16227},{"edgeType":"contains","source":8001,"target":8217},{"edgeType":"contains","source":10247,"target":10470},{"edgeType":"contains","source":13754,"target":13800},{"edgeType":"contains","source":10378,"target":10638},{"edgeType":"contains","source":16322,"target":16651},{"edgeType":"contains","source":4175,"target":4214},{"edgeType":"calls","source":15602,"target":6027},{"edgeType":"calls","source":1727,"target":680},{"edgeType":"contains","source":12764,"target":12779},{"edgeType":"contains","source":15340,"target":15382},{"edgeType":"contains","source":1063,"target":1322},{"edgeType":"contains","source":10122,"target":10118},{"edgeType":"contains","source":15764,"target":4352},{"edgeType":"calls","source":8234,"target":8235},{"edgeType":"contains","source":12041,"target":11936},{"edgeType":"contains","source":13754,"target":13799},{"edgeType":"contains","source":1331,"target":1473},{"edgeType":"contains","source":10386,"target":10391},{"edgeType":"contains","source":16322,"target":16650},{"edgeType":"contains","source":4176,"target":4182},{"edgeType":"contains","source":4175,"target":4213},{"edgeType":"imports","source":6021,"target":5730},{"edgeType":"contains","source":801,"target":3105},{"edgeType":"imports","source":6021,"target":5733},{"edgeType":"contains","source":13754,"target":13798},{"edgeType":"contains","source":16322,"target":16653},{"edgeType":"contains","source":3383,"target":3395},{"edgeType":"calls","source":14970,"target":2369},{"edgeType":"calls","source":5790,"target":5799},{"edgeType":"contains","source":4176,"target":4181},{"edgeType":"contains","source":10385,"target":10419},{"edgeType":"contains","source":801,"target":3104},{"edgeType":"calls","source":1958,"target":1977},{"edgeType":"imports","source":2622,"target":1156},{"edgeType":"calls","source":704,"target":683},{"edgeType":"contains","source":13754,"target":13797},{"edgeType":"calls","source":12661,"target":12639},{"edgeType":"contains","source":16322,"target":16652},{"edgeType":"contains","source":16314,"target":16900},{"edgeType":"contains","source":1331,"target":1471},{"edgeType":"contains","source":13359,"target":13357},{"edgeType":"contains","source":8267,"target":8429},{"edgeType":"contains","source":4176,"target":4180},{"edgeType":"contains","source":801,"target":3103},{"edgeType":"contains","source":12764,"target":12776},{"edgeType":"contains","source":16068,"target":16070},{"edgeType":"calls","source":14588,"target":1533},{"edgeType":"contains","source":12631,"target":12686},{"edgeType":"imports","source":15749,"target":4352},{"edgeType":"calls","source":16037,"target":15809},{"edgeType":"calls","source":6464,"target":6028},{"edgeType":"imports","source":15828,"target":12473},{"edgeType":"contains","source":14609,"target":14775},{"edgeType":"contains","source":8267,"target":8440},{"edgeType":"calls","source":14973,"target":14968},{"edgeType":"calls","source":9026,"target":600},{"edgeType":"contains","source":7876,"target":7877},{"edgeType":"contains","source":5894,"target":5896},{"edgeType":"calls","source":7045,"target":7044},{"edgeType":"contains","source":9985,"target":10149},{"edgeType":"imports","source":14366,"target":2828},{"edgeType":"contains","source":10378,"target":10651},{"edgeType":"calls","source":3606,"target":3737},{"edgeType":"imports","source":3435,"target":3436},{"edgeType":"calls","source":15661,"target":2097},{"edgeType":"calls","source":4415,"target":4026},{"edgeType":"contains","source":8329,"target":8631},{"edgeType":"contains","source":801,"target":3109},{"edgeType":"contains","source":12709,"target":12380},{"edgeType":"contains","source":12631,"target":12684},{"edgeType":"contains","source":6819,"target":6820},{"edgeType":"contains","source":3436,"target":3870},{"edgeType":"imports","source":2622,"target":1169},{"edgeType":"calls","source":14449,"target":14296},{"edgeType":"calls","source":1851,"target":1062},{"edgeType":"calls","source":6743,"target":5838},{"edgeType":"contains","source":12168,"target":12239},{"edgeType":"contains","source":10247,"target":10481},{"edgeType":"contains","source":5871,"target":6611},{"edgeType":"contains","source":5894,"target":5898},{"edgeType":"contains","source":14073,"target":14481},{"edgeType":"contains","source":4969,"target":4970},{"edgeType":"contains","source":12631,"target":12683},{"edgeType":"contains","source":6819,"target":6821},{"edgeType":"imports","source":6021,"target":5720},{"edgeType":"calls","source":3816,"target":3567},{"edgeType":"contains","source":15340,"target":15371},{"edgeType":"calls","source":13717,"target":13732},{"edgeType":"calls","source":14016,"target":4463},{"edgeType":"contains","source":7876,"target":7878},{"edgeType":"calls","source":9159,"target":9162},{"edgeType":"calls","source":1958,"target":1972},{"edgeType":"contains","source":10378,"target":10649},{"edgeType":"contains","source":4175,"target":4215},{"edgeType":"calls","source":6816,"target":5690},{"edgeType":"calls","source":3027,"target":540},{"edgeType":"contains","source":14073,"target":14482},{"edgeType":"imports","source":980,"target":1330},{"edgeType":"calls","source":8697,"target":8689},{"edgeType":"contains","source":10386,"target":10398},{"edgeType":"contains","source":16322,"target":16643},{"edgeType":"contains","source":16332,"target":16333},{"edgeType":"contains","source":14609,"target":14779},{"edgeType":"calls","source":1761,"target":1731},{"edgeType":"calls","source":3112,"target":2134},{"edgeType":"contains","source":13922,"target":14936},{"edgeType":"contains","source":7608,"target":7723},{"edgeType":"contains","source":10980,"target":11012},{"edgeType":"imports","source":13824,"target":601},{"edgeType":"imports","source":16158,"target":4352},{"edgeType":"calls","source":14378,"target":14388},{"edgeType":"contains","source":10980,"target":11011},{"edgeType":"contains","source":8074,"target":8076},{"edgeType":"contains","source":16322,"target":16642},{"edgeType":"contains","source":10122,"target":10127},{"edgeType":"calls","source":2290,"target":2244},{"edgeType":"imports","source":15749,"target":2236},{"edgeType":"calls","source":4943,"target":4565},{"edgeType":"contains","source":801,"target":3113},{"edgeType":"contains","source":11451,"target":11206},{"edgeType":"contains","source":5871,"target":6607},{"edgeType":"imports","source":6021,"target":5725},{"edgeType":"contains","source":16131,"target":16222},{"edgeType":"contains","source":9854,"target":9976},{"edgeType":"calls","source":16031,"target":15994},{"edgeType":"calls","source":1561,"target":1591},{"edgeType":"imports","source":1779,"target":1928},{"edgeType":"contains","source":6682,"target":6835},{"edgeType":"calls","source":1037,"target":922},{"edgeType":"contains","source":8001,"target":8227},{"edgeType":"contains","source":10378,"target":10645},{"edgeType":"contains","source":8267,"target":8437},{"edgeType":"contains","source":8267,"target":8415},{"edgeType":"calls","source":16029,"target":16032},{"edgeType":"calls","source":6333,"target":5836},{"edgeType":"contains","source":7078,"target":7220},{"edgeType":"contains","source":8668,"target":8669},{"edgeType":"contains","source":960,"target":267},{"edgeType":"calls","source":14312,"target":14292},{"edgeType":"imports","source":15800,"target":15513},{"edgeType":"contains","source":12764,"target":12767},{"edgeType":"contains","source":7743,"target":7747},{"edgeType":"contains","source":7458,"target":8124},{"edgeType":"contains","source":11451,"target":11187},{"edgeType":"contains","source":8267,"target":8414},{"edgeType":"contains","source":7078,"target":7221},{"edgeType":"contains","source":998,"target":1202},{"edgeType":"contains","source":6540,"target":6986},{"edgeType":"contains","source":12764,"target":12766},{"edgeType":"contains","source":9854,"target":9958},{"edgeType":"contains","source":3303,"target":3742},{"edgeType":"contains","source":9985,"target":10125},{"edgeType":"calls","source":4938,"target":4684},{"edgeType":"calls","source":6849,"target":6754},{"edgeType":"contains","source":7743,"target":7746},{"edgeType":"contains","source":1,"target":398},{"edgeType":"imports","source":1779,"target":1974},{"edgeType":"contains","source":8267,"target":8417},{"edgeType":"contains","source":16263,"target":16347},{"edgeType":"contains","source":2655,"target":2687},{"edgeType":"calls","source":4209,"target":4027},{"edgeType":"contains","source":8668,"target":8671},{"edgeType":"contains","source":16314,"target":16880},{"edgeType":"contains","source":12764,"target":12765},{"edgeType":"contains","source":5871,"target":6586},{"edgeType":"contains","source":1063,"target":1304},{"edgeType":"contains","source":7078,"target":7222},{"edgeType":"calls","source":3546,"target":3438},{"edgeType":"contains","source":12225,"target":1991},{"edgeType":"contains","source":7743,"target":7749},{"edgeType":"calls","source":1040,"target":793},{"edgeType":"contains","source":8267,"target":8416},{"edgeType":"calls","source":9687,"target":9682},{"edgeType":"contains","source":8668,"target":8670},{"edgeType":"contains","source":14073,"target":14473},{"edgeType":"calls","source":1967,"target":1652},{"edgeType":"calls","source":2741,"target":912},{"edgeType":"contains","source":8006,"target":8051},{"edgeType":"contains","source":7078,"target":7223},{"edgeType":"contains","source":7743,"target":7748},{"edgeType":"contains","source":13350,"target":13624},{"edgeType":"contains","source":4175,"target":4190},{"edgeType":"contains","source":13754,"target":13784},{"edgeType":"calls","source":4938,"target":4682},{"edgeType":"calls","source":2287,"target":2298},{"edgeType":"contains","source":16263,"target":16349},{"edgeType":"contains","source":1063,"target":1306},{"edgeType":"contains","source":998,"target":1207},{"edgeType":"calls","source":3410,"target":3424},{"edgeType":"contains","source":13367,"target":13096},{"edgeType":"contains","source":6091,"target":6102},{"edgeType":"contains","source":3436,"target":3852},{"edgeType":"calls","source":1256,"target":433},{"edgeType":"calls","source":1093,"target":1257},{"edgeType":"contains","source":6212,"target":6580},{"edgeType":"contains","source":16263,"target":16348},{"edgeType":"calls","source":2027,"target":1900},{"edgeType":"contains","source":998,"target":1206},{"edgeType":"contains","source":6700,"target":6250},{"edgeType":"calls","source":15105,"target":15076},{"edgeType":"calls","source":901,"target":867},{"edgeType":"contains","source":6091,"target":6103},{"edgeType":"calls","source":8503,"target":8335},{"edgeType":"calls","source":6457,"target":6226},{"edgeType":"contains","source":13754,"target":13782},{"edgeType":"contains","source":5871,"target":6581},{"edgeType":"calls","source":6333,"target":5842},{"edgeType":"contains","source":3436,"target":3849},{"edgeType":"contains","source":10378,"target":10619},{"edgeType":"contains","source":16263,"target":16351},{"edgeType":"calls","source":13981,"target":13985},{"edgeType":"contains","source":8267,"target":8413},{"edgeType":"contains","source":11046,"target":11052},{"edgeType":"contains","source":16068,"target":16054},{"edgeType":"contains","source":2655,"target":2691},{"edgeType":"calls","source":2418,"target":349},{"edgeType":"contains","source":2721,"target":2759},{"edgeType":"contains","source":6621,"target":6586},{"edgeType":"contains","source":6540,"target":6983},{"edgeType":"contains","source":11451,"target":11181},{"edgeType":"contains","source":3303,"target":3743},{"edgeType":"calls","source":8649,"target":5926},{"edgeType":"contains","source":7743,"target":7745},{"edgeType":"calls","source":16030,"target":16000},{"edgeType":"calls","source":2287,"target":2297},{"edgeType":"calls","source":4402,"target":4381},{"edgeType":"calls","source":6053,"target":6052},{"edgeType":"calls","source":2392,"target":1156},{"edgeType":"contains","source":2655,"target":2692},{"edgeType":"contains","source":13556,"target":13576},{"edgeType":"contains","source":6540,"target":6984},{"edgeType":"contains","source":12168,"target":12209},{"edgeType":"contains","source":14877,"target":4352},{"edgeType":"calls","source":12710,"target":540},{"edgeType":"contains","source":11443,"target":11444},{"edgeType":"calls","source":7778,"target":7559},{"edgeType":"contains","source":8267,"target":8423},{"edgeType":"imports","source":14661,"target":12761},{"edgeType":"imports","source":7070,"target":7074},{"edgeType":"calls","source":14569,"target":2105},{"edgeType":"imports","source":3786,"target":3174},{"edgeType":"calls","source":2089,"target":2090},{"edgeType":"contains","source":14073,"target":14462},{"edgeType":"calls","source":5244,"target":1533},{"edgeType":"calls","source":6457,"target":6229},{"edgeType":"imports","source":2616,"target":1406},{"edgeType":"contains","source":3383,"target":3385},{"edgeType":"contains","source":15866,"target":15958},{"edgeType":"calls","source":14460,"target":13940},{"edgeType":"contains","source":14958,"target":8168},{"edgeType":"calls","source":4007,"target":3941},{"edgeType":"contains","source":8006,"target":8057},{"edgeType":"contains","source":10247,"target":10467},{"edgeType":"contains","source":13754,"target":13795},{"edgeType":"contains","source":16314,"target":16869},{"edgeType":"contains","source":14216,"target":14258},{"edgeType":"contains","source":10386,"target":10387},{"edgeType":"contains","source":10385,"target":10418},{"edgeType":"calls","source":2881,"target":2908},{"edgeType":"contains","source":7743,"target":7754},{"edgeType":"calls","source":8513,"target":8029},{"edgeType":"contains","source":14073,"target":14463},{"edgeType":"contains","source":3383,"target":3384},{"edgeType":"contains","source":5430,"target":5462},{"edgeType":"contains","source":11575,"target":11578},{"edgeType":"contains","source":15340,"target":15354},{"edgeType":"contains","source":10247,"target":10464},{"edgeType":"contains","source":5162,"target":5313},{"edgeType":"contains","source":7743,"target":7757},{"edgeType":"calls","source":12726,"target":12727},{"edgeType":"calls","source":4934,"target":4799},{"edgeType":"contains","source":12764,"target":12773},{"edgeType":"contains","source":12759,"target":12928},{"edgeType":"contains","source":14073,"target":14464},{"edgeType":"contains","source":11443,"target":11441},{"edgeType":"contains","source":10980,"target":10996},{"edgeType":"contains","source":9985,"target":10131},{"edgeType":"calls","source":2554,"target":358},{"edgeType":"contains","source":7743,"target":7756},{"edgeType":"calls","source":13162,"target":3438},{"edgeType":"contains","source":12764,"target":12772},{"edgeType":"contains","source":3303,"target":3754},{"edgeType":"contains","source":8668,"target":8673},{"edgeType":"calls","source":14383,"target":1533},{"edgeType":"contains","source":14073,"target":14466},{"edgeType":"calls","source":6745,"target":1533},{"edgeType":"contains","source":7743,"target":7751},{"edgeType":"calls","source":11405,"target":11402},{"edgeType":"contains","source":3436,"target":3860},{"edgeType":"contains","source":12764,"target":12771},{"edgeType":"contains","source":2784,"target":2930},{"edgeType":"calls","source":3412,"target":3354},{"edgeType":"contains","source":3303,"target":3755},{"edgeType":"contains","source":13754,"target":13791},{"edgeType":"calls","source":10481,"target":10447},{"edgeType":"contains","source":8668,"target":8672},{"edgeType":"calls","source":2537,"target":883},{"edgeType":"calls","source":238,"target":271},{"edgeType":"calls","source":9291,"target":9284},{"edgeType":"imports","source":4323,"target":1331},{"edgeType":"contains","source":12225,"target":1996},{"edgeType":"contains","source":7743,"target":7750},{"edgeType":"contains","source":2784,"target":2931},{"edgeType":"calls","source":14448,"target":14315},{"edgeType":"contains","source":16314,"target":16876},{"edgeType":"calls","source":14970,"target":2361},{"edgeType":"contains","source":16263,"target":16343},{"edgeType":"calls","source":4732,"target":4714},{"edgeType":"contains","source":12764,"target":12769},{"edgeType":"contains","source":16794,"target":16795},{"edgeType":"calls","source":2287,"target":2288},{"edgeType":"contains","source":3436,"target":3858},{"edgeType":"contains","source":15340,"target":15358},{"edgeType":"imports","source":15130,"target":15132},{"edgeType":"contains","source":13370,"target":13009},{"edgeType":"calls","source":3439,"target":402},{"edgeType":"contains","source":13754,"target":13789},{"edgeType":"contains","source":5430,"target":5465},{"edgeType":"contains","source":4175,"target":4202},{"edgeType":"contains","source":8668,"target":8674},{"edgeType":"calls","source":2287,"target":2289},{"edgeType":"contains","source":16263,"target":16342},{"edgeType":"contains","source":7743,"target":7752},{"edgeType":"calls","source":11469,"target":3075},{"edgeType":"contains","source":16131,"target":16192},{"edgeType":"imports","source":8259,"target":8261},{"edgeType":"contains","source":1,"target":13067},{"edgeType":"contains","source":5430,"target":5439},{"edgeType":"contains","source":1730,"target":1750},{"edgeType":"contains","source":13556,"target":13567},{"edgeType":"contains","source":15340,"target":15344},{"edgeType":"contains","source":1,"target":382},{"edgeType":"calls","source":3092,"target":619},{"edgeType":"contains","source":145,"target":147},{"edgeType":"contains","source":10247,"target":10442},{"edgeType":"contains","source":15021,"target":14662},{"edgeType":"contains","source":15866,"target":15950},{"edgeType":"contains","source":10186,"target":10219},{"edgeType":"contains","source":10832,"target":11333},{"edgeType":"calls","source":3609,"target":3618},{"edgeType":"contains","source":801,"target":3065},{"edgeType":"contains","source":9985,"target":10108},{"edgeType":"calls","source":703,"target":683},{"edgeType":"imports","source":595,"target":611},{"edgeType":"calls","source":6587,"target":6403},{"edgeType":"contains","source":1,"target":8838},{"edgeType":"calls","source":922,"target":236},{"edgeType":"contains","source":13556,"target":13566},{"edgeType":"contains","source":145,"target":146},{"edgeType":"contains","source":801,"target":3064},{"edgeType":"calls","source":8565,"target":8506},{"edgeType":"calls","source":2288,"target":2289},{"edgeType":"contains","source":998,"target":1185},{"edgeType":"contains","source":10832,"target":11334},{"edgeType":"contains","source":10186,"target":10220},{"edgeType":"calls","source":6089,"target":730},{"edgeType":"contains","source":6540,"target":6971},{"edgeType":"contains","source":5232,"target":5233},{"edgeType":"contains","source":4505,"target":4515},{"edgeType":"contains","source":2655,"target":2670},{"edgeType":"contains","source":13292,"target":13293},{"edgeType":"contains","source":4176,"target":4143},{"edgeType":"contains","source":1,"target":385},{"edgeType":"contains","source":145,"target":149},{"edgeType":"contains","source":6091,"target":6092},{"edgeType":"calls","source":9030,"target":8893},{"edgeType":"calls","source":11800,"target":11810},{"edgeType":"contains","source":10832,"target":11331},{"edgeType":"contains","source":5430,"target":5436},{"edgeType":"contains","source":4505,"target":4514},{"edgeType":"contains","source":10186,"target":10217},{"edgeType":"contains","source":1730,"target":1749},{"edgeType":"contains","source":145,"target":148},{"edgeType":"contains","source":15034,"target":14262},{"edgeType":"contains","source":6091,"target":6093},{"edgeType":"contains","source":10247,"target":10441},{"edgeType":"contains","source":10832,"target":11332},{"edgeType":"calls","source":7506,"target":7513},{"edgeType":"contains","source":998,"target":1187},{"edgeType":"contains","source":10583,"target":10595},{"edgeType":"contains","source":16314,"target":16863},{"edgeType":"contains","source":1730,"target":1754},{"edgeType":"contains","source":998,"target":1191},{"edgeType":"imports","source":8259,"target":8265},{"edgeType":"contains","source":5047,"target":4632},{"edgeType":"contains","source":9592,"target":9601},{"edgeType":"calls","source":4666,"target":4673},{"edgeType":"contains","source":10247,"target":10437},{"edgeType":"calls","source":10593,"target":609},{"edgeType":"calls","source":1323,"target":487},{"edgeType":"contains","source":5430,"target":5443},{"edgeType":"contains","source":12225,"target":1972},{"edgeType":"imports","source":3786,"target":3170},{"edgeType":"imports","source":1779,"target":1956},{"edgeType":"calls","source":4402,"target":4401},{"edgeType":"contains","source":8259,"target":8643},{"edgeType":"contains","source":9260,"target":9322},{"edgeType":"calls","source":13707,"target":3438},{"edgeType":"imports","source":12013,"target":8159},{"edgeType":"contains","source":10832,"target":11329},{"edgeType":"contains","source":1730,"target":1755},{"edgeType":"contains","source":13424,"target":13426},{"edgeType":"contains","source":9460,"target":9464},{"edgeType":"contains","source":3250,"target":3259},{"edgeType":"contains","source":9592,"target":9600},{"edgeType":"contains","source":145,"target":150},{"edgeType":"contains","source":1995,"target":1997},{"edgeType":"calls","source":11800,"target":11817},{"edgeType":"contains","source":10832,"target":11330},{"edgeType":"contains","source":998,"target":1189},{"edgeType":"contains","source":2622,"target":1586},{"edgeType":"contains","source":998,"target":1193},{"edgeType":"imports","source":8259,"target":8263},{"edgeType":"contains","source":10832,"target":11327},{"edgeType":"contains","source":6540,"target":6967},{"edgeType":"imports","source":13217,"target":13118},{"edgeType":"contains","source":5227,"target":5392},{"edgeType":"contains","source":14877,"target":4334},{"edgeType":"calls","source":1726,"target":680},{"edgeType":"calls","source":2558,"target":2368},{"edgeType":"contains","source":10385,"target":10386},{"edgeType":"contains","source":4175,"target":4179},{"edgeType":"contains","source":14073,"target":14460},{"edgeType":"calls","source":3477,"target":3477},{"edgeType":"calls","source":9445,"target":8715},{"edgeType":"contains","source":998,"target":1192},{"edgeType":"contains","source":6540,"target":6968},{"edgeType":"imports","source":6305,"target":3303},{"edgeType":"calls","source":6714,"target":358},{"edgeType":"contains","source":15204,"target":15339},{"edgeType":"contains","source":9854,"target":9935},{"edgeType":"contains","source":9985,"target":10102},{"edgeType":"calls","source":1036,"target":928},{"edgeType":"calls","source":12003,"target":11864},{"edgeType":"contains","source":7139,"target":7425},{"edgeType":"contains","source":14073,"target":14461},{"edgeType":"contains","source":15866,"target":15957},{"edgeType":"contains","source":608,"target":597},{"edgeType":"contains","source":805,"target":832},{"edgeType":"contains","source":10832,"target":11328},{"edgeType":"calls","source":15591,"target":14794},{"edgeType":"contains","source":1730,"target":1758},{"edgeType":"imports","source":14916,"target":611},{"edgeType":"contains","source":5227,"target":5398},{"edgeType":"contains","source":13424,"target":13439},{"edgeType":"contains","source":14073,"target":14445},{"edgeType":"imports","source":5659,"target":61},{"edgeType":"contains","source":12168,"target":12208},{"edgeType":"contains","source":2655,"target":2680},{"edgeType":"imports","source":1715,"target":1838},{"edgeType":"contains","source":13556,"target":13575},{"edgeType":"contains","source":15204,"target":15323},{"edgeType":"contains","source":15800,"target":15875},{"edgeType":"contains","source":5227,"target":5397},{"edgeType":"contains","source":12957,"target":13117},{"edgeType":"contains","source":12957,"target":13116},{"edgeType":"calls","source":2558,"target":2367},{"edgeType":"contains","source":1,"target":390},{"edgeType":"imports","source":14916,"target":610},{"edgeType":"imports","source":15856,"target":15865},{"edgeType":"calls","source":503,"target":533},{"edgeType":"contains","source":5227,"target":5396},{"edgeType":"contains","source":3250,"target":3260},{"edgeType":"contains","source":14073,"target":14447},{"edgeType":"calls","source":9686,"target":9705},{"edgeType":"contains","source":8805,"target":8643},{"edgeType":"contains","source":13556,"target":13573},{"edgeType":"contains","source":6540,"target":6979},{"edgeType":"contains","source":10186,"target":10225},{"edgeType":"contains","source":5166,"target":5172},{"edgeType":"contains","source":12225,"target":1981},{"edgeType":"contains","source":13350,"target":13616},{"edgeType":"contains","source":5034,"target":5036},{"edgeType":"calls","source":5004,"target":4758},{"edgeType":"calls","source":3741,"target":3745},{"edgeType":"contains","source":3250,"target":3261},{"edgeType":"contains","source":5227,"target":5395},{"edgeType":"calls","source":1561,"target":1562},{"edgeType":"contains","source":10980,"target":10981},{"edgeType":"contains","source":15866,"target":15945},{"edgeType":"calls","source":15104,"target":15105},{"edgeType":"calls","source":6852,"target":6655},{"edgeType":"contains","source":1,"target":392},{"edgeType":"contains","source":13556,"target":13572},{"edgeType":"calls","source":4093,"target":3403},{"edgeType":"contains","source":6091,"target":6101},{"edgeType":"calls","source":11206,"target":11207},{"edgeType":"calls","source":14973,"target":14930},{"edgeType":"contains","source":14073,"target":14449},{"edgeType":"contains","source":9275,"target":2524},{"edgeType":"calls","source":8102,"target":8073},{"edgeType":"calls","source":6856,"target":6532},{"edgeType":"contains","source":14609,"target":14746},{"edgeType":"calls","source":15387,"target":2097},{"edgeType":"contains","source":5871,"target":6572},{"edgeType":"contains","source":9985,"target":10112},{"edgeType":"contains","source":1063,"target":1297},{"edgeType":"contains","source":2721,"target":2754},{"edgeType":"contains","source":15340,"target":15341},{"edgeType":"contains","source":5034,"target":5042},{"edgeType":"calls","source":3441,"target":358},{"edgeType":"contains","source":3303,"target":3738},{"edgeType":"contains","source":6775,"target":6031},{"edgeType":"contains","source":1,"target":394},{"edgeType":"calls","source":6815,"target":5690},{"edgeType":"contains","source":10186,"target":10224},{"edgeType":"contains","source":4118,"target":3841},{"edgeType":"contains","source":10247,"target":10447},{"edgeType":"contains","source":16263,"target":16326},{"edgeType":"contains","source":1730,"target":1760},{"edgeType":"contains","source":14073,"target":14451},{"edgeType":"contains","source":13556,"target":13569},{"edgeType":"contains","source":15340,"target":15342},{"edgeType":"imports","source":595,"target":612},{"edgeType":"contains","source":5162,"target":5301},{"edgeType":"contains","source":10484,"target":3097},{"edgeType":"contains","source":6540,"target":6975},{"edgeType":"calls","source":6729,"target":6243},{"edgeType":"calls","source":12862,"target":12727},{"edgeType":"contains","source":5034,"target":5040},{"edgeType":"contains","source":10583,"target":10599},{"edgeType":"contains","source":998,"target":1200},{"edgeType":"contains","source":13556,"target":13568},{"edgeType":"contains","source":15340,"target":15343},{"edgeType":"contains","source":15740,"target":15627},{"edgeType":"contains","source":960,"target":264},{"edgeType":"contains","source":5227,"target":5399},{"edgeType":"contains","source":13424,"target":13432},{"edgeType":"calls","source":5344,"target":4784},{"edgeType":"calls","source":14443,"target":14452},{"edgeType":"contains","source":1,"target":396},{"edgeType":"contains","source":12150,"target":12759},{"edgeType":"contains","source":10186,"target":10222},{"edgeType":"calls","source":2290,"target":2308},{"edgeType":"contains","source":10378,"target":10592},{"edgeType":"contains","source":13754,"target":13755},{"edgeType":"contains","source":3436,"target":3814},{"edgeType":"contains","source":8267,"target":8382},{"edgeType":"contains","source":2655,"target":2656},{"edgeType":"contains","source":10832,"target":11317},{"edgeType":"contains","source":4959,"target":5225},{"edgeType":"contains","source":14340,"target":14616},{"edgeType":"contains","source":16263,"target":16312},{"edgeType":"calls","source":1961,"target":1936},{"edgeType":"contains","source":5227,"target":5373},{"edgeType":"contains","source":6540,"target":6952},{"edgeType":"calls","source":4471,"target":4463},{"edgeType":"calls","source":1053,"target":487},{"edgeType":"contains","source":1730,"target":1734},{"edgeType":"imports","source":13068,"target":877},{"edgeType":"contains","source":10378,"target":10593},{"edgeType":"calls","source":9227,"target":9240},{"edgeType":"contains","source":3436,"target":3813},{"edgeType":"contains","source":8267,"target":8381},{"edgeType":"contains","source":10832,"target":11318},{"edgeType":"contains","source":16263,"target":16311},{"edgeType":"calls","source":1789,"target":925},{"edgeType":"contains","source":4959,"target":5224},{"edgeType":"contains","source":5892,"target":5901},{"edgeType":"contains","source":12759,"target":12888},{"edgeType":"calls","source":639,"target":636},{"edgeType":"contains","source":16131,"target":16175},{"edgeType":"calls","source":2756,"target":2662},{"edgeType":"contains","source":9854,"target":9925},{"edgeType":"contains","source":1928,"target":1939},{"edgeType":"contains","source":5760,"target":5765},{"edgeType":"contains","source":6212,"target":6552},{"edgeType":"contains","source":8267,"target":8384},{"edgeType":"contains","source":13820,"target":13821},{"edgeType":"contains","source":5509,"target":5090},{"edgeType":"contains","source":3436,"target":3812},{"edgeType":"contains","source":960,"target":236},{"edgeType":"contains","source":10832,"target":11315},{"edgeType":"contains","source":801,"target":3051},{"edgeType":"contains","source":9984,"target":10120},{"edgeType":"contains","source":10186,"target":10200},{"edgeType":"contains","source":1730,"target":1732},{"edgeType":"contains","source":12225,"target":1958},{"edgeType":"contains","source":15204,"target":15317},{"edgeType":"contains","source":8267,"target":8383},{"edgeType":"contains","source":13096,"target":13009},{"edgeType":"imports","source":1715,"target":1876},{"edgeType":"contains","source":10832,"target":11316},{"edgeType":"contains","source":5227,"target":5370},{"edgeType":"contains","source":16263,"target":16313},{"edgeType":"contains","source":14073,"target":14440},{"edgeType":"calls","source":1175,"target":934},{"edgeType":"calls","source":12861,"target":12860},{"edgeType":"calls","source":4940,"target":4719},{"edgeType":"contains","source":12225,"target":1957},{"edgeType":"contains","source":1730,"target":1733},{"edgeType":"contains","source":1928,"target":1937},{"edgeType":"contains","source":3436,"target":3818},{"edgeType":"calls","source":2356,"target":2372},{"edgeType":"calls","source":8367,"target":8422},{"edgeType":"calls","source":3083,"target":3090},{"edgeType":"contains","source":7609,"target":7635},{"edgeType":"contains","source":4230,"target":4573},{"edgeType":"contains","source":10832,"target":11313},{"edgeType":"calls","source":1301,"target":1251},{"edgeType":"calls","source":8039,"target":8019},{"edgeType":"contains","source":9325,"target":9405},{"edgeType":"contains","source":1,"target":10940},{"edgeType":"contains","source":15072,"target":4613},{"edgeType":"contains","source":14877,"target":14886},{"edgeType":"contains","source":6087,"target":6193},{"edgeType":"contains","source":15204,"target":15319},{"edgeType":"calls","source":2356,"target":2373},{"edgeType":"calls","source":16035,"target":15942},{"edgeType":"calls","source":9095,"target":9108},{"edgeType":"contains","source":7609,"target":7634},{"edgeType":"contains","source":9325,"target":9404},{"edgeType":"contains","source":9261,"target":9274},{"edgeType":"contains","source":10832,"target":11314},{"edgeType":"contains","source":9984,"target":10119},{"edgeType":"contains","source":3436,"target":3816},{"edgeType":"contains","source":3488,"target":4318},{"edgeType":"contains","source":7609,"target":7637},{"edgeType":"contains","source":4230,"target":4571},{"edgeType":"contains","source":2655,"target":2658},{"edgeType":"contains","source":5227,"target":5375},{"edgeType":"contains","source":9325,"target":9407},{"edgeType":"contains","source":5760,"target":5762},{"edgeType":"contains","source":14877,"target":14888},{"edgeType":"imports","source":10378,"target":8161},{"edgeType":"contains","source":3488,"target":4317},{"edgeType":"contains","source":12225,"target":1952},{"edgeType":"calls","source":8964,"target":8943},{"edgeType":"calls","source":8367,"target":8425},{"edgeType":"contains","source":7609,"target":7636},{"edgeType":"contains","source":3436,"target":3815},{"edgeType":"contains","source":15800,"target":15873},{"edgeType":"contains","source":4959,"target":5226},{"edgeType":"contains","source":14073,"target":14444},{"edgeType":"calls","source":15608,"target":5926},{"edgeType":"calls","source":1384,"target":793},{"edgeType":"contains","source":9325,"target":9406},{"edgeType":"contains","source":3315,"target":3339},{"edgeType":"contains","source":15204,"target":15322},{"edgeType":"contains","source":9854,"target":9919},{"edgeType":"contains","source":12225,"target":1953},{"edgeType":"contains","source":9984,"target":10117},{"edgeType":"contains","source":10186,"target":10210},{"edgeType":"calls","source":15077,"target":13940},{"edgeType":"contains","source":10832,"target":11325},{"edgeType":"contains","source":14480,"target":14496},{"edgeType":"contains","source":4230,"target":4577},{"edgeType":"contains","source":8402,"target":8433},{"edgeType":"contains","source":1,"target":10944},{"edgeType":"contains","source":7038,"target":6321},{"edgeType":"calls","source":13985,"target":13966},{"edgeType":"contains","source":10832,"target":11326},{"edgeType":"contains","source":12957,"target":13100},{"edgeType":"calls","source":12679,"target":3715},{"edgeType":"contains","source":13556,"target":13558},{"edgeType":"contains","source":4230,"target":4576},{"edgeType":"calls","source":2290,"target":2301},{"edgeType":"contains","source":12164,"target":12314},{"edgeType":"contains","source":4505,"target":4508},{"edgeType":"contains","source":5162,"target":5281},{"edgeType":"imports","source":9466,"target":2597},{"edgeType":"contains","source":13952,"target":13953},{"edgeType":"contains","source":9460,"target":9463},{"edgeType":"contains","source":10832,"target":11323},{"edgeType":"imports","source":14661,"target":4339},{"edgeType":"contains","source":4505,"target":4507},{"edgeType":"contains","source":6292,"target":6194},{"edgeType":"contains","source":1,"target":8833},{"edgeType":"calls","source":9956,"target":9907},{"edgeType":"contains","source":13424,"target":13420},{"edgeType":"contains","source":13952,"target":13954},{"edgeType":"contains","source":15867,"target":15896},{"edgeType":"contains","source":10832,"target":11324},{"edgeType":"contains","source":6212,"target":6561},{"edgeType":"calls","source":12598,"target":12566},{"edgeType":"calls","source":2290,"target":2299},{"edgeType":"contains","source":13350,"target":13599},{"edgeType":"contains","source":8402,"target":8435},{"edgeType":"contains","source":1730,"target":1741},{"edgeType":"calls","source":9758,"target":9702},{"edgeType":"contains","source":15867,"target":15897},{"edgeType":"contains","source":9592,"target":9593},{"edgeType":"contains","source":5364,"target":5367},{"edgeType":"contains","source":4505,"target":4513},{"edgeType":"imports","source":9598,"target":623},{"edgeType":"contains","source":12164,"target":12311},{"edgeType":"contains","source":4230,"target":4581},{"edgeType":"calls","source":14557,"target":8923},{"edgeType":"contains","source":6540,"target":6957},{"edgeType":"calls","source":8645,"target":8269},{"edgeType":"contains","source":10378,"target":10596},{"edgeType":"contains","source":14877,"target":14878},{"edgeType":"contains","source":801,"target":3061},{"edgeType":"contains","source":4230,"target":4582},{"edgeType":"calls","source":8225,"target":2261},{"edgeType":"contains","source":13952,"target":13956},{"edgeType":"calls","source":13839,"target":3698},{"edgeType":"contains","source":3250,"target":3251},{"edgeType":"contains","source":5364,"target":5366},{"edgeType":"contains","source":10832,"target":11322},{"edgeType":"contains","source":14340,"target":14613},{"edgeType":"contains","source":4505,"target":4512},{"edgeType":"contains","source":4230,"target":4580},{"edgeType":"contains","source":10186,"target":10207},{"edgeType":"contains","source":10385,"target":10380},{"edgeType":"calls","source":919,"target":400},{"edgeType":"calls","source":9956,"target":9908},{"edgeType":"contains","source":14877,"target":14879},{"edgeType":"calls","source":3083,"target":3083},{"edgeType":"contains","source":5364,"target":5365},{"edgeType":"contains","source":15868,"target":15870},{"edgeType":"imports","source":2434,"target":733},{"edgeType":"contains","source":9592,"target":9595},{"edgeType":"contains","source":5430,"target":5433},{"edgeType":"imports","source":14619,"target":3523},{"edgeType":"contains","source":15800,"target":15864},{"edgeType":"contains","source":10832,"target":11319},{"edgeType":"imports","source":16238,"target":4072},{"edgeType":"contains","source":14340,"target":14614},{"edgeType":"contains","source":8402,"target":8431},{"edgeType":"contains","source":4230,"target":4579},{"edgeType":"calls","source":1497,"target":1511},{"edgeType":"imports","source":15349,"target":14718},{"edgeType":"calls","source":8434,"target":8470},{"edgeType":"calls","source":6333,"target":5950},{"edgeType":"contains","source":9854,"target":9926},{"edgeType":"contains","source":16131,"target":16174},{"edgeType":"contains","source":1730,"target":1744},{"edgeType":"contains","source":14073,"target":14435},{"edgeType":"contains","source":998,"target":1184},{"edgeType":"contains","source":15800,"target":15863},{"edgeType":"contains","source":5493,"target":5591},{"edgeType":"calls","source":3617,"target":3438},{"edgeType":"contains","source":9609,"target":611},{"edgeType":"contains","source":13754,"target":13756},{"edgeType":"contains","source":15204,"target":15314},{"edgeType":"contains","source":10832,"target":11320},{"edgeType":"contains","source":1,"target":379},{"edgeType":"contains","source":14340,"target":14615},{"edgeType":"contains","source":4505,"target":4510},{"edgeType":"contains","source":1,"target":8836},{"edgeType":"contains","source":8402,"target":8430},{"edgeType":"imports","source":2153,"target":987},{"edgeType":"contains","source":12225,"target":1961},{"edgeType":"contains","source":5493,"target":5592},{"edgeType":"calls","source":9449,"target":8715},{"edgeType":"imports","source":15470,"target":2510},{"edgeType":"contains","source":9325,"target":9393},{"edgeType":"contains","source":9984,"target":10105},{"edgeType":"contains","source":9261,"target":9263},{"edgeType":"contains","source":5454,"target":4662},{"edgeType":"contains","source":11243,"target":11244},{"edgeType":"calls","source":1058,"target":349},{"edgeType":"contains","source":3971,"target":4125},{"edgeType":"calls","source":4998,"target":5055},{"edgeType":"contains","source":7609,"target":7623},{"edgeType":"contains","source":10379,"target":10545},{"edgeType":"contains","source":998,"target":1153},{"edgeType":"calls","source":9496,"target":9342},{"edgeType":"contains","source":14480,"target":14488},{"edgeType":"imports","source":15800,"target":15529},{"edgeType":"calls","source":5328,"target":5394},{"edgeType":"contains","source":14863,"target":15300},{"edgeType":"calls","source":1175,"target":949},{"edgeType":"contains","source":9325,"target":9392},{"edgeType":"contains","source":9261,"target":9262},{"edgeType":"contains","source":11243,"target":11245},{"edgeType":"calls","source":14512,"target":14516},{"edgeType":"contains","source":7609,"target":7622},{"edgeType":"contains","source":10379,"target":10546},{"edgeType":"contains","source":13307,"target":4339},{"edgeType":"calls","source":2119,"target":1285},{"edgeType":"contains","source":998,"target":1152},{"edgeType":"contains","source":10186,"target":10187},{"edgeType":"contains","source":5297,"target":5299},{"edgeType":"calls","source":1237,"target":1144},{"edgeType":"contains","source":1063,"target":1255},{"edgeType":"contains","source":9261,"target":9265},{"edgeType":"contains","source":3315,"target":3318},{"edgeType":"contains","source":9325,"target":9395},{"edgeType":"contains","source":1768,"target":537},{"edgeType":"contains","source":9980,"target":10227},{"edgeType":"contains","source":7609,"target":7625},{"edgeType":"contains","source":4959,"target":5206},{"edgeType":"imports","source":13217,"target":13155},{"edgeType":"calls","source":2131,"target":910},{"edgeType":"contains","source":5112,"target":4691},{"edgeType":"contains","source":12759,"target":12870},{"edgeType":"imports","source":15130,"target":15160},{"edgeType":"contains","source":5297,"target":5298},{"edgeType":"contains","source":9984,"target":10104},{"edgeType":"contains","source":9985,"target":10073},{"edgeType":"contains","source":9261,"target":9264},{"edgeType":"contains","source":4547,"target":5293},{"edgeType":"contains","source":2522,"target":2533},{"edgeType":"contains","source":6021,"target":6115},{"edgeType":"contains","source":13357,"target":13358},{"edgeType":"calls","source":8513,"target":8105},{"edgeType":"calls","source":10536,"target":358},{"edgeType":"calls","source":14451,"target":14291},{"edgeType":"calls","source":12532,"target":12473},{"edgeType":"contains","source":1,"target":350},{"edgeType":"calls","source":15662,"target":2126},{"edgeType":"calls","source":2974,"target":2261},{"edgeType":"contains","source":15867,"target":15889},{"edgeType":"calls","source":2357,"target":2361},{"edgeType":"contains","source":1063,"target":1253},{"edgeType":"contains","source":12559,"target":12727},{"edgeType":"calls","source":15134,"target":7924},{"edgeType":"contains","source":998,"target":1154},{"edgeType":"contains","source":9325,"target":9389},{"edgeType":"contains","source":6540,"target":6932},{"edgeType":"contains","source":5297,"target":5305},{"edgeType":"contains","source":8267,"target":8361},{"edgeType":"contains","source":8402,"target":8405},{"edgeType":"imports","source":9432,"target":1532},{"edgeType":"contains","source":12559,"target":12726},{"edgeType":"contains","source":4230,"target":4557},{"edgeType":"contains","source":7609,"target":7619},{"edgeType":"contains","source":8534,"target":8541},{"edgeType":"contains","source":15800,"target":15853},{"edgeType":"contains","source":10379,"target":10541},{"edgeType":"calls","source":3619,"target":3403},{"edgeType":"contains","source":7078,"target":7166},{"edgeType":"calls","source":15707,"target":15523},{"edgeType":"contains","source":5297,"target":5304},{"edgeType":"calls","source":3575,"target":540},{"edgeType":"calls","source":15107,"target":15096},{"edgeType":"contains","source":8267,"target":8360},{"edgeType":"contains","source":8001,"target":8150},{"edgeType":"calls","source":1106,"target":970},{"edgeType":"calls","source":4998,"target":5049},{"edgeType":"contains","source":9854,"target":9904},{"edgeType":"contains","source":8402,"target":8404},{"edgeType":"contains","source":12564,"target":12570},{"edgeType":"contains","source":7609,"target":7618},{"edgeType":"calls","source":10099,"target":3336},{"edgeType":"contains","source":10379,"target":10542},{"edgeType":"calls","source":2291,"target":2291},{"edgeType":"contains","source":8534,"target":8540},{"edgeType":"contains","source":14216,"target":14221},{"edgeType":"calls","source":13940,"target":540},{"edgeType":"contains","source":15335,"target":15472},{"edgeType":"contains","source":5297,"target":5303},{"edgeType":"contains","source":11441,"target":11442},{"edgeType":"contains","source":1063,"target":1259},{"edgeType":"contains","source":9984,"target":10099},{"edgeType":"calls","source":2974,"target":2255},{"edgeType":"contains","source":12564,"target":12569},{"edgeType":"calls","source":16031,"target":16050},{"edgeType":"contains","source":7609,"target":7621},{"edgeType":"calls","source":12824,"target":3424},{"edgeType":"contains","source":8267,"target":8364},{"edgeType":"calls","source":3686,"target":3438},{"edgeType":"contains","source":14480,"target":14494},{"edgeType":"calls","source":15833,"target":3162},{"edgeType":"contains","source":15335,"target":15473},{"edgeType":"contains","source":9325,"target":9390},{"edgeType":"calls","source":14074,"target":13298},{"edgeType":"contains","source":8267,"target":8362},{"edgeType":"contains","source":6087,"target":6179},{"edgeType":"calls","source":8434,"target":8444},{"edgeType":"contains","source":10247,"target":10403},{"edgeType":"contains","source":12225,"target":1936},{"edgeType":"contains","source":7608,"target":7651},{"edgeType":"contains","source":7609,"target":7620},{"edgeType":"contains","source":8267,"target":8363},{"edgeType":"calls","source":1497,"target":1535},{"edgeType":"calls","source":11275,"target":11277},{"edgeType":"contains","source":14480,"target":14495},{"edgeType":"calls","source":6818,"target":5690},{"edgeType":"calls","source":2111,"target":1527},{"edgeType":"calls","source":16031,"target":16061},{"edgeType":"imports","source":14916,"target":2758},{"edgeType":"contains","source":7609,"target":7631},{"edgeType":"contains","source":3436,"target":3806},{"edgeType":"calls","source":15042,"target":15009},{"edgeType":"calls","source":1054,"target":464},{"edgeType":"contains","source":2784,"target":2876},{"edgeType":"contains","source":1928,"target":1930},{"edgeType":"contains","source":9984,"target":10114},{"edgeType":"contains","source":8006,"target":8009},{"edgeType":"contains","source":2919,"target":2921},{"edgeType":"contains","source":12564,"target":12582},{"edgeType":"contains","source":7609,"target":7630},{"edgeType":"contains","source":5227,"target":5364},{"edgeType":"contains","source":3436,"target":3805},{"edgeType":"contains","source":9261,"target":9270},{"edgeType":"contains","source":12957,"target":13083},{"edgeType":"contains","source":6087,"target":6190},{"edgeType":"contains","source":1928,"target":1931},{"edgeType":"contains","source":9984,"target":10115},{"edgeType":"contains","source":5899,"target":5676},{"edgeType":"calls","source":6057,"target":6041},{"edgeType":"contains","source":10378,"target":10585},{"edgeType":"contains","source":801,"target":3039},{"edgeType":"contains","source":15204,"target":15291},{"edgeType":"calls","source":9227,"target":9232},{"edgeType":"contains","source":12859,"target":3436},{"edgeType":"contains","source":7609,"target":7633},{"edgeType":"contains","source":9325,"target":9403},{"edgeType":"contains","source":10832,"target":11306},{"edgeType":"contains","source":8267,"target":8376},{"edgeType":"contains","source":4230,"target":4559},{"edgeType":"contains","source":6087,"target":6191},{"edgeType":"calls","source":2159,"target":2148},{"edgeType":"calls","source":1497,"target":1531},{"edgeType":"contains","source":801,"target":3042},{"edgeType":"calls","source":706,"target":683},{"edgeType":"contains","source":7609,"target":7632},{"edgeType":"contains","source":12821,"target":13069},{"edgeType":"calls","source":16378,"target":1079},{"edgeType":"contains","source":5297,"target":5306},{"edgeType":"contains","source":1,"target":359},{"edgeType":"contains","source":14480,"target":14483},{"edgeType":"contains","source":15335,"target":15460},{"edgeType":"contains","source":8267,"target":8375},{"edgeType":"contains","source":5892,"target":5895},{"edgeType":"contains","source":9984,"target":10113},{"edgeType":"contains","source":9980,"target":10237},{"edgeType":"calls","source":9888,"target":9887},{"edgeType":"calls","source":5006,"target":4794},{"edgeType":"contains","source":1063,"target":1265},{"edgeType":"contains","source":6021,"target":6116},{"edgeType":"contains","source":7609,"target":7627},{"edgeType":"contains","source":9325,"target":9397},{"edgeType":"contains","source":5493,"target":5572},{"edgeType":"contains","source":8267,"target":8370},{"edgeType":"contains","source":1928,"target":1934},{"edgeType":"contains","source":15204,"target":15294},{"edgeType":"contains","source":6021,"target":6117},{"edgeType":"calls","source":4094,"target":3468},{"edgeType":"calls","source":10681,"target":10674},{"edgeType":"calls","source":9227,"target":9236},{"edgeType":"calls","source":9954,"target":9954},{"edgeType":"contains","source":9325,"target":9396},{"edgeType":"contains","source":9984,"target":10110},{"edgeType":"contains","source":1063,"target":1264},{"edgeType":"imports","source":13217,"target":13142},{"edgeType":"contains","source":5227,"target":5368},{"edgeType":"contains","source":7609,"target":7626},{"edgeType":"contains","source":5493,"target":5573},{"edgeType":"contains","source":1928,"target":1935},{"edgeType":"contains","source":8267,"target":8369},{"edgeType":"contains","source":6021,"target":6118},{"edgeType":"contains","source":12168,"target":12170},{"edgeType":"contains","source":1730,"target":1731},{"edgeType":"contains","source":8402,"target":8412},{"edgeType":"contains","source":1,"target":361},{"edgeType":"contains","source":4228,"target":4626},{"edgeType":"contains","source":9984,"target":10107},{"edgeType":"contains","source":15768,"target":14725},{"edgeType":"contains","source":7609,"target":7629},{"edgeType":"contains","source":9261,"target":9269},{"edgeType":"contains","source":1928,"target":1932},{"edgeType":"calls","source":15179,"target":14988},{"edgeType":"calls","source":4735,"target":4737},{"edgeType":"imports","source":15800,"target":15519},{"edgeType":"contains","source":8267,"target":8372},{"edgeType":"contains","source":1,"target":8820},{"edgeType":"contains","source":10379,"target":10547},{"edgeType":"imports","source":1779,"target":1995},{"edgeType":"contains","source":4228,"target":4625},{"edgeType":"calls","source":2285,"target":352},{"edgeType":"imports","source":15130,"target":349},{"edgeType":"contains","source":9261,"target":9268},{"edgeType":"calls","source":4271,"target":4321},{"edgeType":"contains","source":3788,"target":3465},{"edgeType":"contains","source":805,"target":808},{"edgeType":"contains","source":7609,"target":7628},{"edgeType":"contains","source":5509,"target":5079},{"edgeType":"contains","source":15204,"target":15297},{"edgeType":"contains","source":10832,"target":11303},{"edgeType":"calls","source":2339,"target":793},{"edgeType":"contains","source":10379,"target":10548},{"edgeType":"contains","source":8267,"target":8371},{"edgeType":"contains","source":10379,"target":10528},{"edgeType":"contains","source":14479,"target":14502},{"edgeType":"contains","source":5509,"target":5055},{"edgeType":"contains","source":12957,"target":13060},{"edgeType":"contains","source":7078,"target":7154},{"edgeType":"contains","source":10780,"target":10782},{"edgeType":"imports","source":10379,"target":8161},{"edgeType":"contains","source":9984,"target":10089},{"edgeType":"imports","source":16845,"target":4326},{"edgeType":"contains","source":15740,"target":15578},{"edgeType":"contains","source":13365,"target":13096},{"edgeType":"calls","source":6659,"target":6367},{"edgeType":"contains","source":3768,"target":4060},{"edgeType":"calls","source":4800,"target":4801},{"edgeType":"imports","source":15822,"target":4326},{"edgeType":"contains","source":801,"target":3015},{"edgeType":"contains","source":10379,"target":10529},{"edgeType":"contains","source":7078,"target":7155},{"edgeType":"contains","source":10780,"target":10783},{"edgeType":"contains","source":8001,"target":8138},{"edgeType":"imports","source":15421,"target":4072},{"edgeType":"contains","source":3182,"target":3199},{"edgeType":"contains","source":4116,"target":3841},{"edgeType":"contains","source":10379,"target":10526},{"edgeType":"contains","source":1063,"target":1238},{"edgeType":"contains","source":9325,"target":9378},{"edgeType":"contains","source":14073,"target":14406},{"edgeType":"contains","source":15470,"target":15494},{"edgeType":"contains","source":6540,"target":6921},{"edgeType":"imports","source":10379,"target":8159},{"edgeType":"contains","source":12150,"target":12706},{"edgeType":"contains","source":10247,"target":10390},{"edgeType":"contains","source":9984,"target":10087},{"edgeType":"contains","source":1995,"target":1940},{"edgeType":"contains","source":12783,"target":3652},{"edgeType":"contains","source":7714,"target":4352},{"edgeType":"contains","source":10379,"target":10527},{"edgeType":"contains","source":3488,"target":4280},{"edgeType":"calls","source":7045,"target":4974},{"edgeType":"calls","source":2314,"target":1530},{"edgeType":"contains","source":10780,"target":10781},{"edgeType":"calls","source":3820,"target":3468},{"edgeType":"contains","source":8001,"target":8140},{"edgeType":"contains","source":12378,"target":3523},{"edgeType":"contains","source":9984,"target":10088},{"edgeType":"contains","source":5659,"target":6751},{"edgeType":"contains","source":10118,"target":1706},{"edgeType":"calls","source":4730,"target":626},{"edgeType":"calls","source":14869,"target":3438},{"edgeType":"contains","source":11108,"target":11180},{"edgeType":"calls","source":4536,"target":4524},{"edgeType":"contains","source":10379,"target":10524},{"edgeType":"contains","source":12706,"target":12380},{"edgeType":"imports","source":14350,"target":1331},{"edgeType":"contains","source":9325,"target":9372},{"edgeType":"contains","source":10780,"target":10777},{"edgeType":"calls","source":8893,"target":540},{"edgeType":"contains","source":3182,"target":3202},{"edgeType":"contains","source":8267,"target":8345},{"edgeType":"contains","source":8001,"target":8135},{"edgeType":"contains","source":15740,"target":15584},{"edgeType":"calls","source":14462,"target":13940},{"edgeType":"calls","source":6848,"target":6855},{"edgeType":"contains","source":10379,"target":10525},{"edgeType":"calls","source":4277,"target":4096},{"edgeType":"contains","source":12706,"target":12379},{"edgeType":"contains","source":12957,"target":13055},{"edgeType":"contains","source":15999,"target":16011},{"edgeType":"contains","source":2522,"target":2523},{"edgeType":"contains","source":4549,"target":5221},{"edgeType":"contains","source":12821,"target":13042},{"edgeType":"contains","source":7078,"target":7151},{"edgeType":"contains","source":7691,"target":832},{"edgeType":"calls","source":3437,"target":540},{"edgeType":"contains","source":5162,"target":5244},{"edgeType":"contains","source":3182,"target":3203},{"edgeType":"contains","source":9260,"target":9275},{"edgeType":"contains","source":11108,"target":11178},{"edgeType":"calls","source":6054,"target":6088},{"edgeType":"contains","source":10832,"target":11277},{"edgeType":"contains","source":9325,"target":9374},{"edgeType":"contains","source":5162,"target":5243},{"edgeType":"contains","source":6540,"target":6917},{"edgeType":"contains","source":15204,"target":15288},{"edgeType":"imports","source":10116,"target":9974},{"edgeType":"contains","source":14863,"target":15289},{"edgeType":"calls","source":8288,"target":2383},{"edgeType":"contains","source":3788,"target":3442},{"edgeType":"calls","source":6089,"target":774},{"edgeType":"contains","source":12821,"target":13040},{"edgeType":"contains","source":11108,"target":11179},{"edgeType":"contains","source":14216,"target":14206},{"edgeType":"contains","source":2784,"target":2855},{"edgeType":"contains","source":3182,"target":3201},{"edgeType":"contains","source":12957,"target":13052},{"edgeType":"contains","source":6682,"target":6744},{"edgeType":"calls","source":3698,"target":903},{"edgeType":"contains","source":8259,"target":8594},{"edgeType":"imports","source":15821,"target":2236},{"edgeType":"contains","source":9982,"target":10159},{"edgeType":"contains","source":6540,"target":6928},{"edgeType":"contains","source":8001,"target":8147},{"edgeType":"contains","source":10247,"target":10400},{"edgeType":"contains","source":8534,"target":8537},{"edgeType":"contains","source":7079,"target":7131},{"edgeType":"contains","source":7078,"target":7162},{"edgeType":"contains","source":5162,"target":5249},{"edgeType":"contains","source":12617,"target":13038},{"edgeType":"contains","source":12564,"target":12567},{"edgeType":"contains","source":7609,"target":7615},{"edgeType":"calls","source":3016,"target":3016},{"edgeType":"imports","source":12907,"target":12234},{"edgeType":"contains","source":2522,"target":2527},{"edgeType":"contains","source":9984,"target":10098},{"edgeType":"contains","source":801,"target":3023},{"edgeType":"contains","source":1,"target":8796},{"edgeType":"contains","source":12564,"target":12566},{"edgeType":"contains","source":12617,"target":13037},{"edgeType":"calls","source":8103,"target":8121},{"edgeType":"contains","source":7609,"target":7614},{"edgeType":"imports","source":12907,"target":12235},{"edgeType":"contains","source":8267,"target":8359},{"edgeType":"imports","source":15821,"target":4352},{"edgeType":"contains","source":10379,"target":10534},{"edgeType":"calls","source":2451,"target":1502},{"edgeType":"imports","source":6021,"target":5836},{"edgeType":"calls","source":3549,"target":3403},{"edgeType":"contains","source":801,"target":3026},{"edgeType":"contains","source":3182,"target":3204},{"edgeType":"contains","source":8534,"target":8539},{"edgeType":"contains","source":7609,"target":7617},{"edgeType":"calls","source":968,"target":969},{"edgeType":"contains","source":5297,"target":5290},{"edgeType":"calls","source":11738,"target":11710},{"edgeType":"contains","source":14479,"target":14497},{"edgeType":"calls","source":14557,"target":8883},{"edgeType":"contains","source":10379,"target":10535},{"edgeType":"calls","source":2025,"target":2026},{"edgeType":"contains","source":10522,"target":1874},{"edgeType":"contains","source":8534,"target":8538},{"edgeType":"contains","source":3182,"target":3205},{"edgeType":"contains","source":16263,"target":16272},{"edgeType":"imports","source":13217,"target":13197},{"edgeType":"contains","source":7609,"target":7616},{"edgeType":"calls","source":8103,"target":8123},{"edgeType":"contains","source":11356,"target":1389},{"edgeType":"calls","source":5424,"target":2358},{"edgeType":"contains","source":14609,"target":14696},{"edgeType":"contains","source":2522,"target":2530},{"edgeType":"calls","source":16881,"target":2375},{"edgeType":"contains","source":6682,"target":6750},{"edgeType":"contains","source":1,"target":345},{"edgeType":"contains","source":10379,"target":10532},{"edgeType":"imports","source":6021,"target":5838},{"edgeType":"calls","source":10683,"target":10595},{"edgeType":"contains","source":3488,"target":4296},{"edgeType":"contains","source":7079,"target":7127},{"edgeType":"contains","source":8001,"target":8143},{"edgeType":"contains","source":1063,"target":1248},{"edgeType":"contains","source":7609,"target":7611},{"edgeType":"contains","source":11441,"target":11435},{"edgeType":"contains","source":3315,"target":3317},{"edgeType":"contains","source":2522,"target":2531},{"edgeType":"contains","source":6023,"target":6039},{"edgeType":"contains","source":1715,"target":2179},{"edgeType":"calls","source":6730,"target":6293},{"edgeType":"contains","source":10379,"target":10533},{"edgeType":"calls","source":6465,"target":6052},{"edgeType":"contains","source":8001,"target":8142},{"edgeType":"contains","source":7078,"target":7159},{"edgeType":"contains","source":7079,"target":7128},{"edgeType":"contains","source":1063,"target":1247},{"edgeType":"contains","source":5162,"target":5252},{"edgeType":"contains","source":7609,"target":7610},{"edgeType":"contains","source":10379,"target":10530},{"edgeType":"contains","source":15867,"target":15868},{"edgeType":"calls","source":10596,"target":609},{"edgeType":"contains","source":6023,"target":6040},{"edgeType":"contains","source":1,"target":10918},{"edgeType":"calls","source":15313,"target":4475},{"edgeType":"contains","source":8001,"target":8145},{"edgeType":"contains","source":2522,"target":2528},{"edgeType":"imports","source":7680,"target":921},{"edgeType":"calls","source":8567,"target":8542},{"edgeType":"imports","source":1621,"target":600},{"edgeType":"contains","source":8534,"target":8535},{"edgeType":"calls","source":2289,"target":2292},{"edgeType":"contains","source":16131,"target":16141},{"edgeType":"contains","source":14216,"target":14197},{"edgeType":"contains","source":998,"target":1151},{"edgeType":"contains","source":7609,"target":7613},{"edgeType":"calls","source":1618,"target":1955},{"edgeType":"contains","source":5162,"target":5251},{"edgeType":"contains","source":15866,"target":15900},{"edgeType":"imports","source":6109,"target":997},{"edgeType":"contains","source":12957,"target":13061},{"edgeType":"contains","source":10379,"target":10531},{"edgeType":"contains","source":10658,"target":6110},{"edgeType":"contains","source":7079,"target":7130},{"edgeType":"calls","source":4269,"target":4334},{"edgeType":"contains","source":1063,"target":1249},{"edgeType":"contains","source":7609,"target":7612},{"edgeType":"calls","source":8102,"target":8127},{"edgeType":"contains","source":9260,"target":9261},{"edgeType":"contains","source":13290,"target":13291},{"edgeType":"calls","source":8564,"target":2261},{"edgeType":"contains","source":1,"target":4544},{"edgeType":"contains","source":11108,"target":11167},{"edgeType":"contains","source":3436,"target":3765},{"edgeType":"calls","source":5296,"target":2126},{"edgeType":"contains","source":12957,"target":13043},{"edgeType":"calls","source":11276,"target":11210},{"edgeType":"contains","source":8001,"target":8121},{"edgeType":"imports","source":3508,"target":3394},{"edgeType":"contains","source":5228,"target":5292},{"edgeType":"contains","source":8,"target":98},{"edgeType":"imports","source":882,"target":236},{"edgeType":"contains","source":10379,"target":10513},{"edgeType":"contains","source":3436,"target":3764},{"edgeType":"contains","source":14609,"target":14685},{"edgeType":"contains","source":6682,"target":6730},{"edgeType":"contains","source":14073,"target":14389},{"edgeType":"contains","source":3768,"target":4041},{"edgeType":"contains","source":15620,"target":2372},{"edgeType":"contains","source":13648,"target":12761},{"edgeType":"calls","source":16031,"target":16022},{"edgeType":"contains","source":11833,"target":11946},{"edgeType":"contains","source":9838,"target":10368},{"edgeType":"contains","source":1,"target":4547},{"edgeType":"contains","source":11108,"target":11165},{"edgeType":"contains","source":3436,"target":3763},{"edgeType":"calls","source":14984,"target":14654},{"edgeType":"contains","source":16332,"target":16240},{"edgeType":"contains","source":8001,"target":8123},{"edgeType":"calls","source":8238,"target":8142},{"edgeType":"imports","source":13888,"target":13529},{"edgeType":"contains","source":9838,"target":10369},{"edgeType":"contains","source":11108,"target":11166},{"edgeType":"calls","source":2290,"target":2291},{"edgeType":"calls","source":3413,"target":3414},{"edgeType":"contains","source":1063,"target":1224},{"edgeType":"contains","source":3971,"target":4096},{"edgeType":"contains","source":10247,"target":10371},{"edgeType":"contains","source":9838,"target":10366},{"edgeType":"contains","source":7109,"target":6172},{"edgeType":"contains","source":11833,"target":11944},{"edgeType":"calls","source":4348,"target":4027},{"edgeType":"calls","source":11604,"target":11616},{"edgeType":"imports","source":2153,"target":998},{"edgeType":"contains","source":4569,"target":4585},{"edgeType":"contains","source":16322,"target":16552},{"edgeType":"contains","source":801,"target":3003},{"edgeType":"calls","source":705,"target":683},{"edgeType":"contains","source":4569,"target":4584},{"edgeType":"contains","source":1063,"target":1223},{"edgeType":"imports","source":13217,"target":13183},{"edgeType":"contains","source":9524,"target":9528},{"edgeType":"calls","source":10998,"target":806},{"edgeType":"contains","source":9838,"target":10367},{"edgeType":"calls","source":2356,"target":2357},{"edgeType":"contains","source":11108,"target":11164},{"edgeType":"contains","source":10379,"target":10509},{"edgeType":"calls","source":4271,"target":4299},{"edgeType":"calls","source":2179,"target":1502},{"edgeType":"imports","source":2434,"target":742},{"edgeType":"contains","source":1063,"target":1226},{"edgeType":"contains","source":15335,"target":15439},{"edgeType":"contains","source":5760,"target":5712},{"edgeType":"contains","source":10379,"target":10505},{"edgeType":"calls","source":12265,"target":12264},{"edgeType":"contains","source":12559,"target":12691},{"edgeType":"contains","source":8267,"target":8331},{"edgeType":"contains","source":14479,"target":14492},{"edgeType":"contains","source":12821,"target":13025},{"edgeType":"contains","source":11108,"target":11161},{"edgeType":"contains","source":1063,"target":1225},{"edgeType":"contains","source":11770,"target":11781},{"edgeType":"imports","source":16315,"target":16506},{"edgeType":"calls","source":8418,"target":2566},{"edgeType":"contains","source":3788,"target":3424},{"edgeType":"calls","source":1695,"target":1706},{"edgeType":"contains","source":4228,"target":4583},{"edgeType":"calls","source":2537,"target":972},{"edgeType":"contains","source":3436,"target":3766},{"edgeType":"contains","source":10379,"target":10507},{"edgeType":"imports","source":7006,"target":7007},{"edgeType":"calls","source":11604,"target":11615},{"edgeType":"contains","source":11108,"target":11162},{"edgeType":"contains","source":7078,"target":7136},{"edgeType":"calls","source":11276,"target":11213},{"edgeType":"contains","source":13366,"target":13057},{"edgeType":"contains","source":15866,"target":15876},{"edgeType":"contains","source":9325,"target":9368},{"edgeType":"calls","source":8103,"target":8104},{"edgeType":"contains","source":12957,"target":13051},{"edgeType":"imports","source":15763,"target":12473},{"edgeType":"contains","source":10385,"target":10334},{"edgeType":"contains","source":998,"target":1128},{"edgeType":"contains","source":5170,"target":4984},{"edgeType":"calls","source":6830,"target":1058},{"edgeType":"calls","source":4749,"target":4275},{"edgeType":"contains","source":4959,"target":5183},{"edgeType":"contains","source":1,"target":324},{"edgeType":"contains","source":12957,"target":13050},{"edgeType":"contains","source":8001,"target":8130},{"edgeType":"contains","source":9984,"target":10082},{"edgeType":"contains","source":11770,"target":11795},{"edgeType":"calls","source":6817,"target":5690},{"edgeType":"contains","source":6212,"target":6510},{"edgeType":"imports","source":6212,"target":6238},{"edgeType":"calls","source":3034,"target":358},{"edgeType":"contains","source":11108,"target":11174},{"edgeType":"contains","source":5509,"target":5049},{"edgeType":"calls","source":5260,"target":5345},{"edgeType":"contains","source":11770,"target":11792},{"edgeType":"contains","source":14479,"target":14480},{"edgeType":"calls","source":11208,"target":11210},{"edgeType":"imports","source":15712,"target":7714},{"edgeType":"calls","source":2286,"target":292},{"edgeType":"contains","source":15072,"target":15123},{"edgeType":"contains","source":1063,"target":1229},{"edgeType":"contains","source":9984,"target":10079},{"edgeType":"contains","source":3182,"target":3189},{"edgeType":"contains","source":15821,"target":15160},{"edgeType":"contains","source":9325,"target":9369},{"edgeType":"contains","source":11044,"target":11045},{"edgeType":"calls","source":9887,"target":9882},{"edgeType":"calls","source":12396,"target":3980},{"edgeType":"contains","source":12957,"target":13048},{"edgeType":"calls","source":9094,"target":9096},{"edgeType":"contains","source":15072,"target":15124},{"edgeType":"contains","source":9980,"target":10204},{"edgeType":"contains","source":9838,"target":10374},{"edgeType":"contains","source":11833,"target":11952},{"edgeType":"contains","source":11108,"target":11172},{"edgeType":"contains","source":13922,"target":14836},{"edgeType":"calls","source":3337,"target":1533},{"edgeType":"contains","source":8267,"target":8337},{"edgeType":"calls","source":11011,"target":10981},{"edgeType":"contains","source":12957,"target":13047},{"edgeType":"contains","source":11108,"target":11171},{"edgeType":"calls","source":2030,"target":1882},{"edgeType":"contains","source":2784,"target":2847},{"edgeType":"contains","source":10971,"target":11190},{"edgeType":"calls","source":4855,"target":3100},{"edgeType":"contains","source":15072,"target":15125},{"edgeType":"contains","source":8001,"target":8125},{"edgeType":"contains","source":12821,"target":13034},{"edgeType":"contains","source":7079,"target":7112},{"edgeType":"contains","source":11833,"target":11951},{"edgeType":"contains","source":11108,"target":11173},{"edgeType":"imports","source":13217,"target":13175},{"edgeType":"imports","source":15379,"target":7460},{"edgeType":"contains","source":8267,"target":8336},{"edgeType":"contains","source":10247,"target":10381},{"edgeType":"contains","source":10522,"target":1856},{"edgeType":"contains","source":11770,"target":11791},{"edgeType":"calls","source":3821,"target":3443},{"edgeType":"contains","source":1,"target":328},{"edgeType":"contains","source":12957,"target":13046},{"edgeType":"contains","source":15072,"target":15126},{"edgeType":"contains","source":801,"target":3014},{"edgeType":"contains","source":14863,"target":15264},{"edgeType":"contains","source":7078,"target":7144},{"edgeType":"calls","source":1100,"target":1117},{"edgeType":"contains","source":6023,"target":6024},{"edgeType":"contains","source":12957,"target":13045},{"edgeType":"contains","source":11108,"target":11169},{"edgeType":"contains","source":15204,"target":15263},{"edgeType":"imports","source":15800,"target":15552},{"edgeType":"calls","source":2355,"target":2377},{"edgeType":"contains","source":9984,"target":10075},{"edgeType":"imports","source":12706,"target":3649},{"edgeType":"imports","source":15821,"target":4330},{"edgeType":"contains","source":11833,"target":11949},{"edgeType":"calls","source":10366,"target":3493},{"edgeType":"contains","source":6023,"target":6025},{"edgeType":"contains","source":10971,"target":11189},{"edgeType":"contains","source":12957,"target":13044},{"edgeType":"contains","source":6540,"target":6910},{"edgeType":"calls","source":6664,"target":6211},{"edgeType":"calls","source":9205,"target":1533},{"edgeType":"contains","source":11554,"target":11595},{"edgeType":"contains","source":9835,"target":1461},{"edgeType":"calls","source":16827,"target":16828},{"edgeType":"calls","source":15419,"target":7624},{"edgeType":"contains","source":15649,"target":15724},{"edgeType":"contains","source":2828,"target":3040},{"edgeType":"calls","source":8635,"target":8633},{"edgeType":"contains","source":5543,"target":5554},{"edgeType":"contains","source":13068,"target":13285},{"edgeType":"contains","source":10242,"target":9986},{"edgeType":"contains","source":10550,"target":11008},{"edgeType":"contains","source":2762,"target":2972},{"edgeType":"contains","source":1246,"target":1345},{"edgeType":"calls","source":2285,"target":416},{"edgeType":"contains","source":5279,"target":5280},{"edgeType":"calls","source":11613,"target":11450},{"edgeType":"contains","source":11554,"target":11596},{"edgeType":"calls","source":5400,"target":5326},{"edgeType":"contains","source":11083,"target":11398},{"edgeType":"contains","source":5543,"target":5555},{"edgeType":"contains","source":15779,"target":15923},{"edgeType":"contains","source":13068,"target":13284},{"edgeType":"imports","source":12706,"target":1331},{"edgeType":"contains","source":1246,"target":1346},{"edgeType":"contains","source":16510,"target":16516},{"edgeType":"calls","source":2293,"target":2279},{"edgeType":"imports","source":2618,"target":1169},{"edgeType":"contains","source":11554,"target":11593},{"edgeType":"contains","source":15649,"target":15726},{"edgeType":"contains","source":11621,"target":11630},{"edgeType":"contains","source":126,"target":127},{"edgeType":"contains","source":5543,"target":5556},{"edgeType":"imports","source":1055,"target":997},{"edgeType":"contains","source":10550,"target":11006},{"edgeType":"contains","source":13068,"target":13283},{"edgeType":"contains","source":12810,"target":12825},{"edgeType":"contains","source":15452,"target":15492},{"edgeType":"calls","source":15527,"target":2165},{"edgeType":"contains","source":11356,"target":11390},{"edgeType":"calls","source":11613,"target":11448},{"edgeType":"contains","source":5543,"target":5557},{"edgeType":"contains","source":10426,"target":10623},{"edgeType":"contains","source":15779,"target":15925},{"edgeType":"contains","source":2762,"target":2971},{"edgeType":"contains","source":11554,"target":11591},{"edgeType":"imports","source":10379,"target":1591},{"edgeType":"contains","source":7919,"target":8001},{"edgeType":"imports","source":2622,"target":1043},{"edgeType":"contains","source":15649,"target":15728},{"edgeType":"contains","source":7852,"target":7964},{"edgeType":"contains","source":126,"target":129},{"edgeType":"calls","source":10757,"target":10506},{"edgeType":"contains","source":16510,"target":16521},{"edgeType":"contains","source":4090,"target":4091},{"edgeType":"contains","source":4072,"target":4649},{"edgeType":"contains","source":10426,"target":10620},{"edgeType":"calls","source":6655,"target":6594},{"edgeType":"contains","source":13068,"target":13281},{"edgeType":"contains","source":14257,"target":14485},{"edgeType":"contains","source":2828,"target":3044},{"edgeType":"contains","source":8837,"target":9139},{"edgeType":"calls","source":10420,"target":10381},{"edgeType":"contains","source":11554,"target":11592},{"edgeType":"contains","source":3165,"target":3169},{"edgeType":"contains","source":5279,"target":5284},{"edgeType":"contains","source":13469,"target":13534},{"edgeType":"imports","source":2622,"target":1042},{"edgeType":"calls","source":1791,"target":925},{"edgeType":"calls","source":15181,"target":14999},{"edgeType":"imports","source":14340,"target":1410},{"edgeType":"calls","source":641,"target":636},{"edgeType":"contains","source":126,"target":128},{"edgeType":"contains","source":15649,"target":15729},{"edgeType":"calls","source":5424,"target":349},{"edgeType":"imports","source":15251,"target":2765},{"edgeType":"contains","source":11336,"target":1437},{"edgeType":"imports","source":10949,"target":833},{"edgeType":"calls","source":3112,"target":2255},{"edgeType":"contains","source":4618,"target":4633},{"edgeType":"calls","source":9919,"target":2660},{"edgeType":"contains","source":14792,"target":14814},{"edgeType":"contains","source":14595,"target":14579},{"edgeType":"contains","source":5279,"target":5283},{"edgeType":"contains","source":6137,"target":6164},{"edgeType":"contains","source":15649,"target":15730},{"edgeType":"contains","source":16510,"target":16523},{"edgeType":"contains","source":5543,"target":5552},{"edgeType":"contains","source":1246,"target":1347},{"edgeType":"contains","source":11083,"target":11391},{"edgeType":"contains","source":3165,"target":3167},{"edgeType":"contains","source":5279,"target":5282},{"edgeType":"calls","source":16339,"target":2358},{"edgeType":"contains","source":6125,"target":6537},{"edgeType":"contains","source":1,"target":6119},{"edgeType":"calls","source":2132,"target":925},{"edgeType":"calls","source":1962,"target":1968},{"edgeType":"contains","source":5543,"target":5553},{"edgeType":"contains","source":6402,"target":6407},{"edgeType":"calls","source":8506,"target":8409},{"edgeType":"contains","source":10550,"target":11003},{"edgeType":"contains","source":15649,"target":15731},{"edgeType":"calls","source":773,"target":774},{"edgeType":"contains","source":1,"target":6122},{"edgeType":"contains","source":12810,"target":12835},{"edgeType":"contains","source":5659,"target":6194},{"edgeType":"contains","source":5543,"target":5562},{"edgeType":"calls","source":2090,"target":2224},{"edgeType":"calls","source":15382,"target":15122},{"edgeType":"contains","source":15517,"target":15579},{"edgeType":"contains","source":10459,"target":9609},{"edgeType":"contains","source":9775,"target":9673},{"edgeType":"contains","source":9754,"target":10324},{"edgeType":"contains","source":15585,"target":15587},{"edgeType":"contains","source":15849,"target":15859},{"edgeType":"contains","source":4090,"target":4094},{"edgeType":"contains","source":8906,"target":9126},{"edgeType":"contains","source":6271,"target":6250},{"edgeType":"contains","source":10036,"target":10039},{"edgeType":"calls","source":2952,"target":2986},{"edgeType":"contains","source":6402,"target":6417},{"edgeType":"imports","source":13217,"target":12964},{"edgeType":"calls","source":3825,"target":3403},{"edgeType":"contains","source":6402,"target":6418},{"edgeType":"calls","source":14317,"target":14309},{"edgeType":"contains","source":15585,"target":15588},{"edgeType":"contains","source":9754,"target":10321},{"edgeType":"calls","source":2378,"target":1750},{"edgeType":"calls","source":11013,"target":8914},{"edgeType":"calls","source":16431,"target":16430},{"edgeType":"contains","source":4024,"target":4025},{"edgeType":"calls","source":11630,"target":358},{"edgeType":"contains","source":4072,"target":4651},{"edgeType":"contains","source":4090,"target":4093},{"edgeType":"contains","source":10693,"target":2353},{"edgeType":"contains","source":16510,"target":16511},{"edgeType":"contains","source":7921,"target":7954},{"edgeType":"contains","source":14924,"target":14938},{"edgeType":"contains","source":6259,"target":6623},{"edgeType":"contains","source":15649,"target":15719},{"edgeType":"contains","source":15519,"target":15521},{"edgeType":"contains","source":5227,"target":4784},{"edgeType":"contains","source":5402,"target":5701},{"edgeType":"calls","source":2358,"target":2371},{"edgeType":"calls","source":10178,"target":976},{"edgeType":"contains","source":11017,"target":9222},{"edgeType":"contains","source":12150,"target":12152},{"edgeType":"contains","source":2828,"target":3047},{"edgeType":"calls","source":9692,"target":9700},{"edgeType":"calls","source":8046,"target":7877},{"edgeType":"calls","source":1962,"target":1959},{"edgeType":"calls","source":15079,"target":13940},{"edgeType":"contains","source":5543,"target":5558},{"edgeType":"calls","source":4966,"target":1856},{"edgeType":"imports","source":5871,"target":6029},{"edgeType":"contains","source":8784,"target":8677},{"edgeType":"contains","source":12150,"target":12151},{"edgeType":"contains","source":16510,"target":16513},{"edgeType":"contains","source":230,"target":3255},{"edgeType":"calls","source":1235,"target":1241},{"edgeType":"calls","source":1564,"target":1612},{"edgeType":"contains","source":4090,"target":4099},{"edgeType":"calls","source":16431,"target":16425},{"edgeType":"calls","source":10948,"target":10936},{"edgeType":"imports","source":15986,"target":15911},{"edgeType":"contains","source":4883,"target":4884},{"edgeType":"contains","source":5543,"target":5559},{"edgeType":"contains","source":1778,"target":1779},{"edgeType":"calls","source":14191,"target":5535},{"edgeType":"calls","source":5571,"target":2126},{"edgeType":"contains","source":16510,"target":16512},{"edgeType":"contains","source":230,"target":3254},{"edgeType":"calls","source":16431,"target":16426},{"edgeType":"contains","source":11554,"target":11597},{"edgeType":"imports","source":15986,"target":15914},{"edgeType":"calls","source":15323,"target":4264},{"edgeType":"calls","source":6599,"target":6226},{"edgeType":"contains","source":5543,"target":5560},{"edgeType":"calls","source":11278,"target":11274},{"edgeType":"contains","source":4090,"target":4097},{"edgeType":"contains","source":16510,"target":16515},{"edgeType":"imports","source":6087,"target":5676},{"edgeType":"contains","source":14924,"target":14943},{"edgeType":"imports","source":608,"target":61},{"edgeType":"contains","source":5543,"target":5561},{"edgeType":"contains","source":11554,"target":11598},{"edgeType":"contains","source":15649,"target":15723},{"edgeType":"imports","source":15335,"target":14953},{"edgeType":"contains","source":16510,"target":16514},{"edgeType":"contains","source":230,"target":3256},{"edgeType":"contains","source":2828,"target":3024},{"edgeType":"contains","source":15849,"target":15850},{"edgeType":"contains","source":13068,"target":13269},{"edgeType":"calls","source":15507,"target":15450},{"edgeType":"contains","source":16309,"target":16389},{"edgeType":"imports","source":5227,"target":611},{"edgeType":"contains","source":12810,"target":12811},{"edgeType":"contains","source":4679,"target":4837},{"edgeType":"contains","source":6125,"target":6522},{"edgeType":"contains","source":6109,"target":7018},{"edgeType":"contains","source":6179,"target":620},{"edgeType":"contains","source":7789,"target":7791},{"edgeType":"contains","source":13760,"target":12957},{"edgeType":"contains","source":11092,"target":11103},{"edgeType":"contains","source":5662,"target":6077},{"edgeType":"calls","source":15997,"target":2375},{"edgeType":"contains","source":10550,"target":10992},{"edgeType":"calls","source":1038,"target":1034},{"edgeType":"calls","source":12962,"target":3438},{"edgeType":"contains","source":2762,"target":2957},{"edgeType":"contains","source":9176,"target":9188},{"edgeType":"contains","source":5227,"target":4761},{"edgeType":"contains","source":10762,"target":10763},{"edgeType":"contains","source":14792,"target":14793},{"edgeType":"contains","source":16309,"target":16388},{"edgeType":"contains","source":4679,"target":4836},{"edgeType":"calls","source":2954,"target":2949},{"edgeType":"contains","source":3769,"target":3450},{"edgeType":"contains","source":15779,"target":15906},{"edgeType":"contains","source":7789,"target":7790},{"edgeType":"calls","source":15288,"target":1100},{"edgeType":"calls","source":6066,"target":5836},{"edgeType":"contains","source":2762,"target":2954},{"edgeType":"contains","source":8647,"target":8677},{"edgeType":"contains","source":6125,"target":6524},{"edgeType":"contains","source":5659,"target":6172},{"edgeType":"contains","source":9760,"target":10111},{"edgeType":"contains","source":6259,"target":6599},{"edgeType":"contains","source":9176,"target":9190},{"edgeType":"contains","source":16309,"target":16390},{"edgeType":"calls","source":642,"target":627},{"edgeType":"calls","source":14383,"target":14351},{"edgeType":"contains","source":4679,"target":4834},{"edgeType":"calls","source":14579,"target":14617},{"edgeType":"calls","source":4942,"target":4740},{"edgeType":"calls","source":14190,"target":5535},{"edgeType":"calls","source":5819,"target":5035},{"edgeType":"contains","source":9775,"target":9647},{"edgeType":"contains","source":11885,"target":11886},{"edgeType":"contains","source":9835,"target":9897},{"edgeType":"calls","source":509,"target":517},{"edgeType":"calls","source":3249,"target":2255},{"edgeType":"contains","source":5662,"target":6072},{"edgeType":"contains","source":14262,"target":14313},{"edgeType":"contains","source":14195,"target":14276},{"edgeType":"contains","source":855,"target":768},{"edgeType":"contains","source":2758,"target":3084},{"edgeType":"contains","source":2762,"target":2960},{"edgeType":"imports","source":11756,"target":1169},{"edgeType":"calls","source":4302,"target":3438},{"edgeType":"contains","source":5873,"target":5874},{"edgeType":"contains","source":12028,"target":11680},{"edgeType":"contains","source":15253,"target":15303},{"edgeType":"contains","source":5939,"target":5942},{"edgeType":"contains","source":6259,"target":6592},{"edgeType":"contains","source":9835,"target":9898},{"edgeType":"contains","source":9775,"target":9644},{"edgeType":"calls","source":9890,"target":9882},{"edgeType":"contains","source":2762,"target":2961},{"edgeType":"contains","source":5227,"target":4765},{"edgeType":"contains","source":8906,"target":9097},{"edgeType":"contains","source":11554,"target":11575},{"edgeType":"calls","source":1503,"target":1413},{"edgeType":"imports","source":2621,"target":1056},{"edgeType":"calls","source":1481,"target":2095},{"edgeType":"contains","source":14924,"target":14933},{"edgeType":"contains","source":1,"target":10328},{"edgeType":"contains","source":5873,"target":5875},{"edgeType":"imports","source":15986,"target":15902},{"edgeType":"contains","source":9835,"target":9899},{"edgeType":"imports","source":10751,"target":611},{"edgeType":"contains","source":9835,"target":9895},{"edgeType":"contains","source":15849,"target":15856},{"edgeType":"contains","source":4352,"target":4406},{"edgeType":"calls","source":8514,"target":8145},{"edgeType":"contains","source":4679,"target":4840},{"edgeType":"calls","source":7810,"target":2485},{"edgeType":"contains","source":2828,"target":3027},{"edgeType":"calls","source":7908,"target":7905},{"edgeType":"contains","source":9835,"target":9896},{"edgeType":"contains","source":15779,"target":15913},{"edgeType":"calls","source":4678,"target":2349},{"edgeType":"calls","source":12008,"target":11875},{"edgeType":"contains","source":9176,"target":9186},{"edgeType":"contains","source":11092,"target":11097},{"edgeType":"calls","source":2436,"target":2088},{"edgeType":"contains","source":14924,"target":14935},{"edgeType":"imports","source":2621,"target":1054},{"edgeType":"contains","source":2762,"target":2964},{"edgeType":"contains","source":13932,"target":13960},{"edgeType":"calls","source":8514,"target":8147},{"edgeType":"contains","source":15229,"target":1236},{"edgeType":"contains","source":8714,"target":8721},{"edgeType":"calls","source":11613,"target":11440},{"edgeType":"contains","source":7852,"target":7960},{"edgeType":"calls","source":4303,"target":3403},{"edgeType":"contains","source":11336,"target":1432},{"edgeType":"imports","source":15986,"target":15899},{"edgeType":"contains","source":14262,"target":14301},{"edgeType":"contains","source":13932,"target":13961},{"edgeType":"imports","source":12378,"target":903},{"edgeType":"contains","source":6125,"target":6531},{"edgeType":"contains","source":1246,"target":1337},{"edgeType":"contains","source":8837,"target":9135},{"edgeType":"contains","source":5948,"target":5676},{"edgeType":"calls","source":8041,"target":8012},{"edgeType":"contains","source":15253,"target":15292},{"edgeType":"contains","source":7459,"target":7460},{"edgeType":"contains","source":8837,"target":9138},{"edgeType":"contains","source":6109,"target":7028},{"edgeType":"contains","source":15253,"target":15293},{"edgeType":"contains","source":8906,"target":9113},{"edgeType":"calls","source":3548,"target":3550},{"edgeType":"contains","source":15452,"target":15466},{"edgeType":"contains","source":4352,"target":2296},{"edgeType":"contains","source":10762,"target":10768},{"edgeType":"calls","source":14056,"target":9699},{"edgeType":"contains","source":390,"target":391},{"edgeType":"contains","source":16309,"target":16383},{"edgeType":"contains","source":9840,"target":9753},{"edgeType":"calls","source":1663,"target":680},{"edgeType":"contains","source":13999,"target":14000},{"edgeType":"contains","source":2762,"target":2963},{"edgeType":"calls","source":772,"target":817},{"edgeType":"contains","source":15452,"target":15467},{"edgeType":"contains","source":2828,"target":3031},{"edgeType":"contains","source":6402,"target":6403},{"edgeType":"contains","source":12018,"target":11999},{"edgeType":"contains","source":5402,"target":5684},{"edgeType":"contains","source":13999,"target":14001},{"edgeType":"calls","source":15116,"target":2206},{"edgeType":"contains","source":8906,"target":9107},{"edgeType":"contains","source":11083,"target":11385},{"edgeType":"contains","source":11092,"target":11106},{"edgeType":"contains","source":2762,"target":2968},{"edgeType":"contains","source":2758,"target":3092},{"edgeType":"calls","source":13838,"target":12235},{"edgeType":"contains","source":324,"target":325},{"edgeType":"imports","source":1055,"target":987},{"edgeType":"contains","source":12469,"target":12815},{"edgeType":"contains","source":4385,"target":3394},{"edgeType":"contains","source":16309,"target":16385},{"edgeType":"contains","source":15452,"target":15468},{"edgeType":"calls","source":14573,"target":2134},{"edgeType":"calls","source":6851,"target":6852},{"edgeType":"contains","source":13999,"target":14002},{"edgeType":"contains","source":13067,"target":13303},{"edgeType":"contains","source":15253,"target":15296},{"edgeType":"contains","source":4072,"target":4639},{"edgeType":"contains","source":2762,"target":2969},{"edgeType":"calls","source":3687,"target":3468},{"edgeType":"calls","source":3341,"target":1510},{"edgeType":"contains","source":14924,"target":14925},{"edgeType":"contains","source":15649,"target":15704},{"edgeType":"calls","source":1240,"target":1101},{"edgeType":"contains","source":9840,"target":9752},{"edgeType":"calls","source":15596,"target":2126},{"edgeType":"contains","source":2828,"target":3037},{"edgeType":"contains","source":5662,"target":6082},{"edgeType":"contains","source":9775,"target":9653},{"edgeType":"contains","source":1410,"target":2600},{"edgeType":"calls","source":2179,"target":1589},{"edgeType":"contains","source":6259,"target":6602},{"edgeType":"contains","source":2828,"target":3034},{"edgeType":"calls","source":3689,"target":3403},{"edgeType":"imports","source":13869,"target":3303},{"edgeType":"contains","source":324,"target":327},{"edgeType":"contains","source":10815,"target":7007},{"edgeType":"calls","source":11616,"target":11349},{"edgeType":"contains","source":12810,"target":12813},{"edgeType":"contains","source":16309,"target":16387},{"edgeType":"contains","source":14262,"target":14307},{"edgeType":"imports","source":8158,"target":2765},{"edgeType":"calls","source":12690,"target":3424},{"edgeType":"imports","source":5871,"target":6015},{"edgeType":"contains","source":5543,"target":5544},{"edgeType":"contains","source":9639,"target":9640},{"edgeType":"contains","source":2762,"target":2967},{"edgeType":"contains","source":15253,"target":15298},{"edgeType":"imports","source":11774,"target":600},{"edgeType":"imports","source":13888,"target":601},{"edgeType":"contains","source":14594,"target":14586},{"edgeType":"contains","source":324,"target":326},{"edgeType":"calls","source":15706,"target":15630},{"edgeType":"contains","source":10696,"target":10697},{"edgeType":"contains","source":12810,"target":12812},{"edgeType":"contains","source":5025,"target":4691},{"edgeType":"calls","source":6196,"target":6020},{"edgeType":"contains","source":5402,"target":5688},{"edgeType":"calls","source":2358,"target":2384},{"edgeType":"contains","source":6125,"target":6505},{"edgeType":"contains","source":4419,"target":4425},{"edgeType":"contains","source":13922,"target":14262},{"edgeType":"contains","source":15386,"target":15388},{"edgeType":"imports","source":6087,"target":5712},{"edgeType":"calls","source":11285,"target":11013},{"edgeType":"contains","source":4072,"target":4611},{"edgeType":"contains","source":9834,"target":9916},{"edgeType":"contains","source":5608,"target":5620},{"edgeType":"contains","source":7722,"target":7737},{"edgeType":"contains","source":2828,"target":3007},{"edgeType":"contains","source":14329,"target":14330},{"edgeType":"calls","source":14464,"target":13940},{"edgeType":"imports","source":12821,"target":12597},{"edgeType":"calls","source":2286,"target":352},{"edgeType":"imports","source":12151,"target":12226},{"edgeType":"contains","source":6125,"target":6506},{"edgeType":"contains","source":4419,"target":4424},{"edgeType":"calls","source":15322,"target":4257},{"edgeType":"imports","source":6087,"target":5711},{"edgeType":"contains","source":9834,"target":9917},{"edgeType":"contains","source":257,"target":258},{"edgeType":"contains","source":5608,"target":5621},{"edgeType":"contains","source":5662,"target":6061},{"edgeType":"contains","source":4352,"target":4387},{"edgeType":"contains","source":2828,"target":3008},{"edgeType":"contains","source":7722,"target":7736},{"edgeType":"contains","source":8515,"target":8522},{"edgeType":"contains","source":1246,"target":1313},{"edgeType":"calls","source":1720,"target":986},{"edgeType":"contains","source":15649,"target":15693},{"edgeType":"contains","source":4419,"target":4423},{"edgeType":"contains","source":5662,"target":6062},{"edgeType":"calls","source":5818,"target":5018},{"edgeType":"contains","source":9834,"target":9914},{"edgeType":"calls","source":9367,"target":9164},{"edgeType":"contains","source":5608,"target":5622},{"edgeType":"calls","source":2952,"target":2959},{"edgeType":"contains","source":14197,"target":14196},{"edgeType":"contains","source":11356,"target":11357},{"edgeType":"calls","source":7114,"target":7129},{"edgeType":"contains","source":10244,"target":9889},{"edgeType":"contains","source":10543,"target":620},{"edgeType":"imports","source":6087,"target":5713},{"edgeType":"contains","source":4419,"target":4422},{"edgeType":"contains","source":9834,"target":9915},{"edgeType":"contains","source":257,"target":260},{"edgeType":"contains","source":5662,"target":6063},{"edgeType":"contains","source":7722,"target":7738},{"edgeType":"contains","source":5608,"target":5623},{"edgeType":"contains","source":15779,"target":15892},{"edgeType":"contains","source":4939,"target":5214},{"edgeType":"calls","source":15589,"target":15009},{"edgeType":"contains","source":6259,"target":6583},{"edgeType":"calls","source":2870,"target":1273},{"edgeType":"calls","source":2528,"target":1301},{"edgeType":"imports","source":2619,"target":1169},{"edgeType":"calls","source":1895,"target":1897},{"edgeType":"calls","source":5818,"target":5016},{"edgeType":"calls","source":11409,"target":11402},{"edgeType":"contains","source":9834,"target":9912},{"edgeType":"contains","source":7850,"target":7993},{"edgeType":"calls","source":573,"target":598},{"edgeType":"contains","source":8515,"target":8519},{"edgeType":"contains","source":10431,"target":10432},{"edgeType":"contains","source":7722,"target":7733},{"edgeType":"contains","source":1246,"target":1316},{"edgeType":"contains","source":14197,"target":14198},{"edgeType":"calls","source":1895,"target":1896},{"edgeType":"imports","source":6087,"target":5715},{"edgeType":"calls","source":2131,"target":925},{"edgeType":"contains","source":6125,"target":6502},{"edgeType":"contains","source":9835,"target":9882},{"edgeType":"contains","source":9834,"target":9913},{"edgeType":"contains","source":10431,"target":10433},{"edgeType":"contains","source":7722,"target":7732},{"edgeType":"contains","source":16309,"target":16376},{"edgeType":"contains","source":14197,"target":14199},{"edgeType":"contains","source":2828,"target":3012},{"edgeType":"contains","source":11554,"target":11556},{"edgeType":"contains","source":15452,"target":15462},{"edgeType":"contains","source":7722,"target":7735},{"edgeType":"contains","source":9835,"target":9879},{"edgeType":"contains","source":9834,"target":9910},{"edgeType":"contains","source":2828,"target":3009},{"edgeType":"contains","source":15649,"target":15697},{"edgeType":"contains","source":8515,"target":8521},{"edgeType":"contains","source":14197,"target":14200},{"edgeType":"contains","source":1246,"target":1314},{"edgeType":"contains","source":13932,"target":13959},{"edgeType":"calls","source":8370,"target":8365},{"edgeType":"contains","source":4419,"target":4426},{"edgeType":"imports","source":6087,"target":5717},{"edgeType":"calls","source":15174,"target":15185},{"edgeType":"contains","source":59,"target":60},{"edgeType":"contains","source":9835,"target":9880},{"edgeType":"contains","source":9834,"target":9911},{"edgeType":"contains","source":2828,"target":3010},{"edgeType":"contains","source":7722,"target":7734},{"edgeType":"contains","source":8515,"target":8520},{"edgeType":"contains","source":3494,"target":3504},{"edgeType":"calls","source":16033,"target":16039},{"edgeType":"contains","source":13069,"target":13214},{"edgeType":"contains","source":16377,"target":16384},{"edgeType":"imports","source":12821,"target":12595},{"edgeType":"contains","source":7850,"target":8005},{"edgeType":"contains","source":2449,"target":2080},{"edgeType":"calls","source":4440,"target":3334},{"edgeType":"contains","source":9835,"target":9893},{"edgeType":"contains","source":9834,"target":9924},{"edgeType":"contains","source":5662,"target":6068},{"edgeType":"contains","source":3494,"target":3511},{"edgeType":"contains","source":16049,"target":15968},{"edgeType":"contains","source":2762,"target":2947},{"edgeType":"contains","source":10431,"target":10444},{"edgeType":"contains","source":4352,"target":2282},{"edgeType":"contains","source":7850,"target":8004},{"edgeType":"imports","source":15796,"target":15496},{"edgeType":"contains","source":9835,"target":9894},{"edgeType":"contains","source":11092,"target":11095},{"edgeType":"imports","source":14502,"target":2758},{"edgeType":"contains","source":14262,"target":14285},{"edgeType":"contains","source":16046,"target":16060},{"edgeType":"contains","source":59,"target":62},{"edgeType":"contains","source":2762,"target":2948},{"edgeType":"imports","source":15747,"target":4330},{"edgeType":"contains","source":6125,"target":6515},{"edgeType":"calls","source":12008,"target":11864},{"edgeType":"contains","source":1246,"target":1321},{"edgeType":"contains","source":4023,"target":4024},{"edgeType":"calls","source":2952,"target":2953},{"edgeType":"calls","source":3439,"target":540},{"edgeType":"contains","source":9835,"target":9891},{"edgeType":"contains","source":9834,"target":9922},{"edgeType":"contains","source":9838,"target":9798},{"edgeType":"calls","source":15374,"target":540},{"edgeType":"calls","source":8370,"target":8368},{"edgeType":"contains","source":16238,"target":16453},{"edgeType":"contains","source":15914,"target":15926},{"edgeType":"contains","source":8838,"target":9090},{"edgeType":"contains","source":2041,"target":2042},{"edgeType":"contains","source":14725,"target":14732},{"edgeType":"calls","source":573,"target":596},{"edgeType":"contains","source":6267,"target":6342},{"edgeType":"contains","source":5939,"target":5940},{"edgeType":"imports","source":13217,"target":12998},{"edgeType":"contains","source":9835,"target":9892},{"edgeType":"contains","source":9834,"target":9923},{"edgeType":"imports","source":1715,"target":1719},{"edgeType":"contains","source":15914,"target":15927},{"edgeType":"calls","source":2357,"target":2369},{"edgeType":"contains","source":13346,"target":13096},{"edgeType":"calls","source":2159,"target":2165},{"edgeType":"contains","source":11356,"target":11365},{"edgeType":"contains","source":1246,"target":1319},{"edgeType":"calls","source":2625,"target":400},{"edgeType":"contains","source":2966,"target":2970},{"edgeType":"calls","source":14315,"target":14344},{"edgeType":"contains","source":3769,"target":3446},{"edgeType":"contains","source":9176,"target":9177},{"edgeType":"contains","source":3494,"target":3515},{"edgeType":"contains","source":9760,"target":10100},{"edgeType":"calls","source":6054,"target":6148},{"edgeType":"contains","source":9834,"target":9920},{"edgeType":"contains","source":9834,"target":1463},{"edgeType":"contains","source":13469,"target":13510},{"edgeType":"calls","source":2093,"target":2094},{"edgeType":"contains","source":6137,"target":6138},{"edgeType":"contains","source":1876,"target":821},{"edgeType":"contains","source":2828,"target":3019},{"edgeType":"contains","source":10692,"target":2349},{"edgeType":"calls","source":9684,"target":5690},{"edgeType":"calls","source":14328,"target":13940},{"edgeType":"contains","source":3769,"target":3445},{"edgeType":"contains","source":3494,"target":3514},{"edgeType":"contains","source":9835,"target":9890},{"edgeType":"contains","source":9834,"target":9921},{"edgeType":"contains","source":7850,"target":8000},{"edgeType":"contains","source":13922,"target":14259},{"edgeType":"contains","source":7722,"target":7740},{"edgeType":"contains","source":7850,"target":8003},{"edgeType":"contains","source":9835,"target":9887},{"edgeType":"contains","source":9834,"target":9918},{"edgeType":"contains","source":3494,"target":3513},{"edgeType":"contains","source":12413,"target":12419},{"edgeType":"calls","source":2226,"target":2197},{"edgeType":"contains","source":2762,"target":2949},{"edgeType":"contains","source":4679,"target":4831},{"edgeType":"contains","source":1909,"target":1910},{"edgeType":"contains","source":6125,"target":6512},{"edgeType":"contains","source":13069,"target":13223},{"edgeType":"calls","source":3480,"target":3490},{"edgeType":"contains","source":3769,"target":3443},{"edgeType":"contains","source":7850,"target":8002},{"edgeType":"contains","source":9176,"target":9178},{"edgeType":"contains","source":9835,"target":9888},{"edgeType":"contains","source":5662,"target":6067},{"edgeType":"contains","source":7722,"target":7742},{"edgeType":"contains","source":3494,"target":3512},{"edgeType":"contains","source":6209,"target":6023},{"edgeType":"imports","source":12821,"target":12587},{"edgeType":"contains","source":12810,"target":4339},{"edgeType":"contains","source":4939,"target":5201},{"edgeType":"contains","source":7719,"target":7813},{"edgeType":"contains","source":15914,"target":15916},{"edgeType":"calls","source":2453,"target":1533},{"edgeType":"calls","source":8237,"target":8236},{"edgeType":"calls","source":4801,"target":4852},{"edgeType":"imports","source":2621,"target":1094},{"edgeType":"contains","source":13932,"target":13936},{"edgeType":"contains","source":15451,"target":15470},{"edgeType":"contains","source":1974,"target":1982},{"edgeType":"contains","source":9834,"target":9900},{"edgeType":"calls","source":1235,"target":1236},{"edgeType":"contains","source":10952,"target":611},{"edgeType":"calls","source":12675,"target":3847},{"edgeType":"calls","source":8569,"target":8514},{"edgeType":"calls","source":8514,"target":8105},{"edgeType":"calls","source":8434,"target":8471},{"edgeType":"contains","source":16309,"target":16355},{"edgeType":"imports","source":6212,"target":6048},{"edgeType":"contains","source":6259,"target":6565},{"edgeType":"contains","source":9840,"target":9711},{"edgeType":"contains","source":13068,"target":13234},{"edgeType":"imports","source":12759,"target":8161},{"edgeType":"calls","source":12236,"target":540},{"edgeType":"contains","source":14791,"target":14792},{"edgeType":"contains","source":16117,"target":15968},{"edgeType":"calls","source":15694,"target":5394},{"edgeType":"calls","source":1501,"target":1449},{"edgeType":"contains","source":7719,"target":7814},{"edgeType":"imports","source":9260,"target":2466},{"edgeType":"calls","source":8434,"target":8473},{"edgeType":"imports","source":12821,"target":12583},{"edgeType":"contains","source":13932,"target":13939},{"edgeType":"calls","source":9228,"target":9228},{"edgeType":"contains","source":9840,"target":9713},{"edgeType":"contains","source":9840,"target":9709},{"edgeType":"contains","source":15779,"target":15877},{"edgeType":"contains","source":12474,"target":12619},{"edgeType":"contains","source":7719,"target":7809},{"edgeType":"calls","source":774,"target":725},{"edgeType":"contains","source":11412,"target":11715},{"edgeType":"imports","source":1244,"target":1495},{"edgeType":"contains","source":2762,"target":2927},{"edgeType":"contains","source":4939,"target":5205},{"edgeType":"calls","source":1662,"target":680},{"edgeType":"contains","source":14725,"target":14726},{"edgeType":"contains","source":13932,"target":13940},{"edgeType":"contains","source":6125,"target":6485},{"edgeType":"calls","source":9162,"target":9163},{"edgeType":"contains","source":9840,"target":9710},{"edgeType":"contains","source":15914,"target":15921},{"edgeType":"calls","source":6746,"target":5838},{"edgeType":"contains","source":14262,"target":14281},{"edgeType":"calls","source":774,"target":724},{"edgeType":"contains","source":2762,"target":2928},{"edgeType":"contains","source":2620,"target":987},{"edgeType":"contains","source":5341,"target":5426},{"edgeType":"contains","source":11621,"target":11579},{"edgeType":"calls","source":2435,"target":2088},{"edgeType":"contains","source":16046,"target":16056},{"edgeType":"contains","source":6259,"target":6560},{"edgeType":"contains","source":7719,"target":7811},{"edgeType":"imports","source":6305,"target":1058},{"edgeType":"contains","source":15779,"target":15879},{"edgeType":"contains","source":14262,"target":14282},{"edgeType":"contains","source":13731,"target":13817},{"edgeType":"contains","source":6125,"target":6487},{"edgeType":"contains","source":15779,"target":15880},{"edgeType":"calls","source":6602,"target":6076},{"edgeType":"contains","source":14262,"target":14283},{"edgeType":"contains","source":4072,"target":4596},{"edgeType":"calls","source":9162,"target":9164},{"edgeType":"contains","source":12474,"target":12616},{"edgeType":"imports","source":15796,"target":15485},{"edgeType":"contains","source":15449,"target":15524},{"edgeType":"imports","source":12759,"target":12379},{"edgeType":"calls","source":4998,"target":5079},{"edgeType":"contains","source":4939,"target":5209},{"edgeType":"calls","source":6544,"target":1533},{"edgeType":"contains","source":14912,"target":15258},{"edgeType":"imports","source":16164,"target":4072},{"edgeType":"contains","source":5227,"target":4737},{"edgeType":"contains","source":5019,"target":4843},{"edgeType":"contains","source":5608,"target":5612},{"edgeType":"contains","source":7722,"target":7729},{"edgeType":"contains","source":5341,"target":5431},{"edgeType":"contains","source":11091,"target":11108},{"edgeType":"contains","source":9834,"target":1450},{"edgeType":"contains","source":11554,"target":11555},{"edgeType":"contains","source":15385,"target":15395},{"edgeType":"contains","source":15451,"target":15463},{"edgeType":"contains","source":2828,"target":3000},{"edgeType":"contains","source":15253,"target":15259},{"edgeType":"calls","source":9096,"target":9098},{"edgeType":"contains","source":7722,"target":7728},{"edgeType":"calls","source":14873,"target":13940},{"edgeType":"calls","source":9824,"target":9788},{"edgeType":"contains","source":15253,"target":15260},{"edgeType":"contains","source":2762,"target":2929},{"edgeType":"calls","source":14143,"target":626},{"edgeType":"imports","source":6087,"target":5690},{"edgeType":"contains","source":8515,"target":8517},{"edgeType":"contains","source":7722,"target":7731},{"edgeType":"contains","source":10247,"target":1331},{"edgeType":"contains","source":5341,"target":5429},{"edgeType":"calls","source":6872,"target":6166},{"edgeType":"contains","source":15318,"target":15360},{"edgeType":"calls","source":2090,"target":2206},{"edgeType":"contains","source":15385,"target":15397},{"edgeType":"contains","source":14912,"target":15261},{"edgeType":"contains","source":8515,"target":8516},{"edgeType":"imports","source":6212,"target":6042},{"edgeType":"contains","source":7722,"target":7730},{"edgeType":"contains","source":15318,"target":15361},{"edgeType":"calls","source":9823,"target":9821},{"edgeType":"imports","source":7963,"target":388},{"edgeType":"contains","source":15385,"target":15398},{"edgeType":"contains","source":10166,"target":10182},{"edgeType":"contains","source":8713,"target":8715},{"edgeType":"contains","source":4419,"target":4421},{"edgeType":"contains","source":14912,"target":15262},{"edgeType":"contains","source":15649,"target":15670},{"edgeType":"contains","source":4939,"target":5213},{"edgeType":"calls","source":1892,"target":1998},{"edgeType":"imports","source":15986,"target":15928},{"edgeType":"contains","source":9835,"target":9873},{"edgeType":"contains","source":13469,"target":13493},{"edgeType":"contains","source":7722,"target":7725},{"edgeType":"contains","source":3362,"target":3363},{"edgeType":"contains","source":5341,"target":5435},{"edgeType":"calls","source":13985,"target":13986},{"edgeType":"calls","source":11806,"target":11772},{"edgeType":"contains","source":4549,"target":4618},{"edgeType":"contains","source":4419,"target":4420},{"edgeType":"contains","source":15649,"target":15671},{"edgeType":"calls","source":2028,"target":2009},{"edgeType":"imports","source":14366,"target":612},{"edgeType":"calls","source":9034,"target":8910},{"edgeType":"calls","source":4029,"target":3403},{"edgeType":"contains","source":6015,"target":5676},{"edgeType":"contains","source":5608,"target":5609},{"edgeType":"contains","source":16046,"target":16048},{"edgeType":"contains","source":7722,"target":7724},{"edgeType":"calls","source":8436,"target":8424},{"edgeType":"contains","source":6259,"target":6569},{"edgeType":"contains","source":6125,"target":6495},{"edgeType":"contains","source":15649,"target":15672},{"edgeType":"contains","source":10166,"target":10180},{"edgeType":"contains","source":16309,"target":16354},{"edgeType":"contains","source":7722,"target":7727},{"edgeType":"calls","source":10668,"target":540},{"edgeType":"calls","source":1962,"target":1944},{"edgeType":"contains","source":9835,"target":9871},{"edgeType":"contains","source":13932,"target":13934},{"edgeType":"calls","source":8514,"target":8121},{"edgeType":"calls","source":10682,"target":10674},{"edgeType":"contains","source":15914,"target":15915},{"edgeType":"contains","source":4939,"target":5210},{"edgeType":"contains","source":2828,"target":3002},{"edgeType":"calls","source":11615,"target":11349},{"edgeType":"calls","source":1962,"target":1943},{"edgeType":"calls","source":10089,"target":10032},{"edgeType":"contains","source":10166,"target":10181},{"edgeType":"contains","source":11184,"target":12448},{"edgeType":"contains","source":7722,"target":7726},{"edgeType":"contains","source":5341,"target":5432},{"edgeType":"calls","source":12782,"target":540},{"edgeType":"calls","source":4743,"target":4521},{"edgeType":"contains","source":13469,"target":13473},{"edgeType":"calls","source":15662,"target":2271},{"edgeType":"contains","source":15385,"target":15386},{"edgeType":"contains","source":9838,"target":9759},{"edgeType":"contains","source":15649,"target":15658},{"edgeType":"contains","source":6125,"target":6472},{"edgeType":"calls","source":16910,"target":16436},{"edgeType":"contains","source":15914,"target":15899},{"edgeType":"contains","source":7719,"target":7797},{"edgeType":"contains","source":13276,"target":13113},{"edgeType":"contains","source":2828,"target":2974},{"edgeType":"calls","source":11817,"target":3077},{"edgeType":"calls","source":1059,"target":433},{"edgeType":"imports","source":3435,"target":3394},{"edgeType":"calls","source":14399,"target":13940},{"edgeType":"imports","source":14609,"target":12168},{"edgeType":"contains","source":3295,"target":3297},{"edgeType":"contains","source":13731,"target":13806},{"edgeType":"imports","source":1779,"target":1876},{"edgeType":"calls","source":13131,"target":13080},{"edgeType":"imports","source":14609,"target":12167},{"edgeType":"contains","source":12474,"target":12606},{"edgeType":"contains","source":12412,"target":12414},{"edgeType":"contains","source":2766,"target":2783},{"edgeType":"contains","source":2762,"target":2907},{"edgeType":"contains","source":5144,"target":5170},{"edgeType":"contains","source":10474,"target":611},{"edgeType":"contains","source":1,"target":16620},{"edgeType":"contains","source":14912,"target":15252},{"edgeType":"calls","source":5003,"target":5013},{"edgeType":"contains","source":9307,"target":9309},{"edgeType":"contains","source":6125,"target":6474},{"edgeType":"contains","source":190,"target":191},{"edgeType":"contains","source":6267,"target":6301},{"edgeType":"contains","source":9835,"target":9850},{"edgeType":"contains","source":9838,"target":9757},{"edgeType":"imports","source":9432,"target":1410},{"edgeType":"contains","source":10678,"target":6972},{"edgeType":"contains","source":980,"target":3183},{"edgeType":"imports","source":1055,"target":1063},{"edgeType":"contains","source":11306,"target":2302},{"edgeType":"imports","source":14577,"target":8934},{"edgeType":"contains","source":6125,"target":6475},{"edgeType":"contains","source":13731,"target":13804},{"edgeType":"contains","source":5662,"target":6030},{"edgeType":"contains","source":9838,"target":9758},{"edgeType":"calls","source":16910,"target":16437},{"edgeType":"contains","source":8447,"target":8485},{"edgeType":"contains","source":4939,"target":5181},{"edgeType":"calls","source":710,"target":683},{"edgeType":"contains","source":3361,"target":3362},{"edgeType":"contains","source":6125,"target":6468},{"edgeType":"contains","source":8778,"target":8789},{"edgeType":"contains","source":14912,"target":15254},{"edgeType":"contains","source":13731,"target":13803},{"edgeType":"imports","source":13888,"target":13373},{"edgeType":"contains","source":9838,"target":9755},{"edgeType":"contains","source":15058,"target":14956},{"edgeType":"calls","source":11213,"target":11235},{"edgeType":"contains","source":14262,"target":14264},{"edgeType":"contains","source":2766,"target":2786},{"edgeType":"contains","source":980,"target":3185},{"edgeType":"contains","source":13068,"target":13215},{"edgeType":"contains","source":9505,"target":9506},{"edgeType":"contains","source":3314,"target":598},{"edgeType":"calls","source":8317,"target":7991},{"edgeType":"contains","source":16046,"target":16039},{"edgeType":"contains","source":14912,"target":15255},{"edgeType":"contains","source":52,"target":241},{"edgeType":"contains","source":190,"target":192},{"edgeType":"contains","source":15385,"target":15391},{"edgeType":"contains","source":9838,"target":9756},{"edgeType":"calls","source":11213,"target":11236},{"edgeType":"calls","source":14569,"target":2331},{"edgeType":"contains","source":11306,"target":2301},{"edgeType":"contains","source":1246,"target":1284},{"edgeType":"contains","source":2766,"target":2787},{"edgeType":"contains","source":2765,"target":2818},{"edgeType":"calls","source":4743,"target":4614},{"edgeType":"contains","source":980,"target":3184},{"edgeType":"contains","source":980,"target":3188},{"edgeType":"contains","source":13731,"target":13801},{"edgeType":"contains","source":1,"target":14510},{"edgeType":"contains","source":14912,"target":15256},{"edgeType":"contains","source":15649,"target":15664},{"edgeType":"contains","source":6125,"target":6470},{"edgeType":"calls","source":15181,"target":15066},{"edgeType":"calls","source":15183,"target":15004},{"edgeType":"imports","source":11756,"target":7592},{"edgeType":"contains","source":10658,"target":1245},{"edgeType":"contains","source":15385,"target":15392},{"edgeType":"contains","source":15318,"target":15355},{"edgeType":"imports","source":13888,"target":13375},{"edgeType":"calls","source":11975,"target":6637},{"edgeType":"contains","source":13414,"target":13057},{"edgeType":"contains","source":980,"target":3187},{"edgeType":"contains","source":5341,"target":5408},{"edgeType":"contains","source":3314,"target":596},{"edgeType":"contains","source":4724,"target":3394},{"edgeType":"contains","source":4549,"target":4591},{"edgeType":"contains","source":190,"target":194},{"edgeType":"calls","source":15579,"target":615},{"edgeType":"imports","source":9643,"target":9673},{"edgeType":"contains","source":6125,"target":6471},{"edgeType":"contains","source":15253,"target":15257},{"edgeType":"contains","source":4939,"target":5185},{"edgeType":"contains","source":10678,"target":6969},{"edgeType":"contains","source":980,"target":3186},{"edgeType":"contains","source":980,"target":3190},{"edgeType":"calls","source":15357,"target":3278},{"edgeType":"contains","source":11091,"target":11092},{"edgeType":"calls","source":4741,"target":4673},{"edgeType":"contains","source":6125,"target":6481},{"edgeType":"contains","source":15449,"target":15507},{"edgeType":"contains","source":13069,"target":13196},{"edgeType":"contains","source":11336,"target":1382},{"edgeType":"contains","source":10166,"target":10170},{"edgeType":"calls","source":14980,"target":14966},{"edgeType":"calls","source":5820,"target":5048},{"edgeType":"imports","source":6212,"target":6089},{"edgeType":"calls","source":9752,"target":1562},{"edgeType":"contains","source":12090,"target":11833},{"edgeType":"contains","source":5877,"target":5713},{"edgeType":"contains","source":5662,"target":6036},{"edgeType":"calls","source":9037,"target":8928},{"edgeType":"contains","source":13469,"target":13480},{"edgeType":"calls","source":14590,"target":14369},{"edgeType":"contains","source":6125,"target":6482},{"edgeType":"contains","source":2762,"target":2915},{"edgeType":"contains","source":13731,"target":13814},{"edgeType":"contains","source":6004,"target":6005},{"edgeType":"contains","source":1,"target":16625},{"edgeType":"calls","source":973,"target":976},{"edgeType":"contains","source":980,"target":3192},{"edgeType":"calls","source":14913,"target":14930},{"edgeType":"contains","source":3295,"target":3302},{"edgeType":"contains","source":14195,"target":14216},{"edgeType":"calls","source":6668,"target":6263},{"edgeType":"contains","source":6004,"target":6006},{"edgeType":"contains","source":1246,"target":1285},{"edgeType":"contains","source":12148,"target":12149},{"edgeType":"contains","source":15251,"target":15305},{"edgeType":"calls","source":1059,"target":427},{"edgeType":"contains","source":2765,"target":2819},{"edgeType":"contains","source":12474,"target":12613},{"edgeType":"contains","source":5227,"target":4718},{"edgeType":"contains","source":980,"target":3191},{"edgeType":"calls","source":1639,"target":1473},{"edgeType":"contains","source":9840,"target":9704},{"edgeType":"contains","source":7719,"target":7806},{"edgeType":"calls","source":10355,"target":10354},{"edgeType":"contains","source":15779,"target":15851},{"edgeType":"contains","source":7458,"target":5328},{"edgeType":"contains","source":4352,"target":2246},{"edgeType":"contains","source":4352,"target":4360},{"edgeType":"contains","source":1,"target":14513},{"edgeType":"contains","source":15251,"target":15306},{"edgeType":"contains","source":6125,"target":6476},{"edgeType":"calls","source":8241,"target":8240},{"edgeType":"calls","source":16910,"target":16440},{"edgeType":"calls","source":8505,"target":8513},{"edgeType":"contains","source":3295,"target":3308},{"edgeType":"calls","source":1435,"target":1449},{"edgeType":"contains","source":11306,"target":2308},{"edgeType":"contains","source":13731,"target":13811},{"edgeType":"contains","source":15251,"target":15307},{"edgeType":"contains","source":2762,"target":2918},{"edgeType":"contains","source":6125,"target":6477},{"edgeType":"calls","source":15727,"target":2375},{"edgeType":"contains","source":801,"target":286},{"edgeType":"contains","source":9307,"target":9310},{"edgeType":"contains","source":980,"target":3193},{"edgeType":"calls","source":10289,"target":10288},{"edgeType":"contains","source":5659,"target":6125},{"edgeType":"contains","source":15251,"target":15308},{"edgeType":"contains","source":6125,"target":6478},{"edgeType":"contains","source":10166,"target":10167},{"edgeType":"calls","source":3228,"target":2948},{"edgeType":"contains","source":14912,"target":15247},{"edgeType":"contains","source":7719,"target":7803},{"edgeType":"contains","source":15451,"target":15452},{"edgeType":"calls","source":10747,"target":10888},{"edgeType":"contains","source":3295,"target":3306},{"edgeType":"contains","source":13731,"target":13809},{"edgeType":"contains","source":15251,"target":15309},{"edgeType":"contains","source":6125,"target":6479},{"edgeType":"calls","source":4998,"target":5156},{"edgeType":"contains","source":1,"target":16632},{"edgeType":"calls","source":1107,"target":1048},{"edgeType":"calls","source":10091,"target":10086},{"edgeType":"contains","source":13413,"target":13096},{"edgeType":"imports","source":15874,"target":8881},{"edgeType":"calls","source":15074,"target":14164},{"edgeType":"imports","source":13888,"target":13368},{"edgeType":"contains","source":3295,"target":3307},{"edgeType":"calls","source":14524,"target":14303},{"edgeType":"contains","source":13731,"target":13808},{"edgeType":"contains","source":15251,"target":15310},{"edgeType":"calls","source":2096,"target":2099},{"edgeType":"contains","source":6125,"target":6480},{"edgeType":"contains","source":5662,"target":6010},{"edgeType":"contains","source":8447,"target":8467},{"edgeType":"contains","source":2762,"target":2890},{"edgeType":"contains","source":13001,"target":13166},{"edgeType":"contains","source":1167,"target":1596},{"edgeType":"contains","source":5227,"target":4696},{"edgeType":"contains","source":1246,"target":1262},{"edgeType":"contains","source":10892,"target":10894},{"edgeType":"contains","source":14195,"target":14206},{"edgeType":"contains","source":2765,"target":2796},{"edgeType":"contains","source":9835,"target":9836},{"edgeType":"contains","source":6125,"target":6456},{"edgeType":"contains","source":5659,"target":6104},{"edgeType":"contains","source":13276,"target":13096},{"edgeType":"contains","source":15318,"target":15333},{"edgeType":"contains","source":2766,"target":2767},{"edgeType":"contains","source":3488,"target":3638},{"edgeType":"contains","source":1167,"target":1595},{"edgeType":"calls","source":11203,"target":3069},{"edgeType":"contains","source":9835,"target":9837},{"edgeType":"contains","source":5662,"target":6012},{"edgeType":"calls","source":10227,"target":10070},{"edgeType":"contains","source":13142,"target":13021},{"edgeType":"contains","source":16630,"target":16944},{"edgeType":"contains","source":1167,"target":1598},{"edgeType":"contains","source":1246,"target":1260},{"edgeType":"contains","source":8643,"target":8735},{"edgeType":"calls","source":16367,"target":16341},{"edgeType":"contains","source":6125,"target":6458},{"edgeType":"contains","source":5739,"target":5740},{"edgeType":"contains","source":13731,"target":13788},{"edgeType":"contains","source":7852,"target":7888},{"edgeType":"calls","source":6340,"target":5837},{"edgeType":"contains","source":1167,"target":1597},{"edgeType":"contains","source":3359,"target":3407},{"edgeType":"contains","source":6682,"target":6104},{"edgeType":"contains","source":2765,"target":2795},{"edgeType":"contains","source":2762,"target":2888},{"edgeType":"contains","source":15781,"target":15782},{"edgeType":"contains","source":2766,"target":2770},{"edgeType":"contains","source":2762,"target":2894},{"edgeType":"contains","source":1167,"target":1600},{"edgeType":"contains","source":10949,"target":11236},{"edgeType":"contains","source":7157,"target":6172},{"edgeType":"contains","source":8579,"target":8598},{"edgeType":"contains","source":5662,"target":6007},{"edgeType":"contains","source":10550,"target":10922},{"edgeType":"calls","source":1304,"target":1306},{"edgeType":"contains","source":13203,"target":13241},{"edgeType":"contains","source":2765,"target":2802},{"edgeType":"contains","source":16630,"target":16945},{"edgeType":"contains","source":1167,"target":1599},{"edgeType":"calls","source":3553,"target":3468},{"edgeType":"contains","source":8447,"target":8462},{"edgeType":"calls","source":9099,"target":9100},{"edgeType":"imports","source":15986,"target":15968},{"edgeType":"calls","source":15594,"target":2246},{"edgeType":"contains","source":15781,"target":15784},{"edgeType":"contains","source":586,"target":587},{"edgeType":"contains","source":2765,"target":2799},{"edgeType":"contains","source":8910,"target":8911},{"edgeType":"contains","source":4748,"target":4749},{"edgeType":"contains","source":1167,"target":1602},{"edgeType":"contains","source":230,"target":3166},{"edgeType":"calls","source":7513,"target":7530},{"edgeType":"calls","source":12534,"target":12546},{"edgeType":"calls","source":6673,"target":6088},{"edgeType":"contains","source":7852,"target":7884},{"edgeType":"contains","source":8447,"target":8464},{"edgeType":"calls","source":15168,"target":2769},{"edgeType":"calls","source":3269,"target":1700},{"edgeType":"calls","source":14319,"target":14291},{"edgeType":"contains","source":2766,"target":2769},{"edgeType":"calls","source":12678,"target":3855},{"edgeType":"contains","source":15449,"target":15506},{"edgeType":"contains","source":1167,"target":1601},{"edgeType":"calls","source":9037,"target":8910},{"edgeType":"contains","source":4072,"target":4563},{"edgeType":"contains","source":6125,"target":6455},{"edgeType":"contains","source":2766,"target":2774},{"edgeType":"calls","source":11950,"target":11630},{"edgeType":"calls","source":15172,"target":540},{"edgeType":"contains","source":15449,"target":15491},{"edgeType":"contains","source":13733,"target":13737},{"edgeType":"calls","source":5335,"target":5302},{"edgeType":"calls","source":3232,"target":2844},{"edgeType":"contains","source":4748,"target":4755},{"edgeType":"calls","source":7525,"target":7160},{"edgeType":"calls","source":7513,"target":7532},{"edgeType":"contains","source":10628,"target":10630},{"edgeType":"imports","source":11906,"target":801},{"edgeType":"contains","source":1167,"target":1604},{"edgeType":"contains","source":15740,"target":14926},{"edgeType":"contains","source":5144,"target":5163},{"edgeType":"calls","source":10488,"target":10441},{"edgeType":"contains","source":13268,"target":13353},{"edgeType":"contains","source":9834,"target":1417},{"edgeType":"calls","source":3341,"target":1580},{"edgeType":"calls","source":1525,"target":793},{"edgeType":"contains","source":14723,"target":14743},{"edgeType":"contains","source":6682,"target":6111},{"edgeType":"contains","source":586,"target":588},{"edgeType":"contains","source":4748,"target":4754},{"edgeType":"contains","source":15318,"target":15325},{"edgeType":"calls","source":15795,"target":2369},{"edgeType":"calls","source":1048,"target":782},{"edgeType":"contains","source":14502,"target":8910},{"edgeType":"contains","source":10628,"target":10631},{"edgeType":"contains","source":14987,"target":15015},{"edgeType":"contains","source":1167,"target":1603},{"edgeType":"contains","source":7719,"target":7788},{"edgeType":"contains","source":16630,"target":16933},{"edgeType":"contains","source":5662,"target":6020},{"edgeType":"calls","source":2115,"target":1533},{"edgeType":"contains","source":13268,"target":13352},{"edgeType":"contains","source":6125,"target":6466},{"edgeType":"calls","source":14787,"target":12473},{"edgeType":"imports","source":15747,"target":2236},{"edgeType":"contains","source":15318,"target":15326},{"edgeType":"contains","source":11040,"target":6312},{"edgeType":"contains","source":14723,"target":14744},{"edgeType":"contains","source":1,"target":16612},{"edgeType":"contains","source":2766,"target":2772},{"edgeType":"contains","source":16309,"target":16317},{"edgeType":"contains","source":1167,"target":1606},{"edgeType":"contains","source":6125,"target":6467},{"edgeType":"calls","source":13988,"target":13986},{"edgeType":"contains","source":2828,"target":2965},{"edgeType":"imports","source":8259,"target":8153},{"edgeType":"imports","source":9643,"target":9644},{"edgeType":"contains","source":1167,"target":1605},{"edgeType":"calls","source":10423,"target":10343},{"edgeType":"contains","source":16309,"target":16316},{"edgeType":"contains","source":4072,"target":4574},{"edgeType":"calls","source":11214,"target":11195},{"edgeType":"contains","source":16630,"target":16938},{"edgeType":"contains","source":2766,"target":2778},{"edgeType":"contains","source":13001,"target":13170},{"edgeType":"contains","source":11040,"target":6310},{"edgeType":"contains","source":16309,"target":16319},{"edgeType":"contains","source":11575,"target":6637},{"edgeType":"contains","source":15581,"target":15631},{"edgeType":"contains","source":5739,"target":5742},{"edgeType":"calls","source":14937,"target":14164},{"edgeType":"contains","source":1167,"target":1608},{"edgeType":"contains","source":14195,"target":14202},{"edgeType":"contains","source":5662,"target":6015},{"edgeType":"calls","source":12209,"target":3606},{"edgeType":"contains","source":2766,"target":2779},{"edgeType":"contains","source":16630,"target":16937},{"edgeType":"imports","source":14366,"target":2758},{"edgeType":"contains","source":15312,"target":4945},{"edgeType":"calls","source":4475,"target":4474},{"edgeType":"contains","source":15581,"target":15632},{"edgeType":"imports","source":11756,"target":7568},{"edgeType":"contains","source":4939,"target":5179},{"edgeType":"contains","source":1167,"target":1607},{"edgeType":"contains","source":1410,"target":2534},{"edgeType":"contains","source":13731,"target":13793},{"edgeType":"calls","source":14517,"target":14505},{"edgeType":"contains","source":16630,"target":16940},{"edgeType":"contains","source":11306,"target":2290},{"edgeType":"calls","source":11943,"target":11849},{"edgeType":"contains","source":4939,"target":5178},{"edgeType":"calls","source":1612,"target":209},{"edgeType":"calls","source":9298,"target":9284},{"edgeType":"calls","source":1040,"target":1028},{"edgeType":"contains","source":15581,"target":15633},{"edgeType":"contains","source":1167,"target":1610},{"edgeType":"imports","source":16315,"target":16332},{"edgeType":"calls","source":14467,"target":13940},{"edgeType":"contains","source":4748,"target":4756},{"edgeType":"contains","source":11306,"target":2291},{"edgeType":"contains","source":2766,"target":2777},{"edgeType":"contains","source":16630,"target":16939},{"edgeType":"contains","source":10951,"target":611},{"edgeType":"contains","source":10760,"target":10761},{"edgeType":"calls","source":8044,"target":7991},{"edgeType":"contains","source":16309,"target":16320},{"edgeType":"calls","source":8110,"target":8059},{"edgeType":"imports","source":15740,"target":15132},{"edgeType":"contains","source":5662,"target":6018},{"edgeType":"contains","source":5659,"target":6111},{"edgeType":"contains","source":9835,"target":9839},{"edgeType":"contains","source":1167,"target":1609},{"edgeType":"calls","source":2184,"target":1502},{"edgeType":"calls","source":14517,"target":14503},{"edgeType":"contains","source":14916,"target":15093},{"edgeType":"contains","source":2699,"target":2712},{"edgeType":"imports","source":1715,"target":1780},{"edgeType":"contains","source":1,"target":10243},{"edgeType":"contains","source":5662,"target":5994},{"edgeType":"contains","source":8579,"target":8587},{"edgeType":"contains","source":13067,"target":13217},{"edgeType":"calls","source":774,"target":779},{"edgeType":"contains","source":14987,"target":15006},{"edgeType":"imports","source":16801,"target":1330},{"edgeType":"calls","source":14516,"target":14508},{"edgeType":"contains","source":2699,"target":2713},{"edgeType":"contains","source":7852,"target":7868},{"edgeType":"contains","source":8447,"target":8450},{"edgeType":"calls","source":2030,"target":2009},{"edgeType":"calls","source":12096,"target":7080},{"edgeType":"contains","source":11270,"target":11844},{"edgeType":"contains","source":7250,"target":7504},{"edgeType":"calls","source":2294,"target":2281},{"edgeType":"contains","source":2699,"target":2710},{"edgeType":"calls","source":8850,"target":8345},{"edgeType":"contains","source":15740,"target":14920},{"edgeType":"contains","source":13827,"target":12910},{"edgeType":"contains","source":4549,"target":4555},{"edgeType":"contains","source":6267,"target":6268},{"edgeType":"calls","source":10685,"target":10651},{"edgeType":"calls","source":1100,"target":1245},{"edgeType":"contains","source":12474,"target":12572},{"edgeType":"contains","source":7250,"target":7505},{"edgeType":"contains","source":12939,"target":12955},{"edgeType":"contains","source":11083,"target":11296},{"edgeType":"contains","source":13001,"target":13147},{"edgeType":"calls","source":2286,"target":416},{"edgeType":"contains","source":12939,"target":12954},{"edgeType":"contains","source":6682,"target":6088},{"edgeType":"calls","source":774,"target":780},{"edgeType":"contains","source":2699,"target":2711},{"edgeType":"imports","source":5227,"target":730},{"edgeType":"imports","source":2153,"target":883},{"edgeType":"contains","source":15740,"target":14921},{"edgeType":"calls","source":12140,"target":12056},{"edgeType":"contains","source":5662,"target":5997},{"edgeType":"contains","source":12474,"target":12571},{"edgeType":"calls","source":6521,"target":6552},{"edgeType":"contains","source":8315,"target":8316},{"edgeType":"contains","source":1167,"target":1580},{"edgeType":"calls","source":2559,"target":2524},{"edgeType":"contains","source":5433,"target":4632},{"edgeType":"contains","source":8975,"target":8996},{"edgeType":"contains","source":12939,"target":12953},{"edgeType":"calls","source":14080,"target":2660},{"edgeType":"contains","source":5227,"target":4684},{"edgeType":"contains","source":15318,"target":15320},{"edgeType":"contains","source":6593,"target":6726},{"edgeType":"calls","source":10965,"target":10433},{"edgeType":"contains","source":5662,"target":5990},{"edgeType":"calls","source":3341,"target":1533},{"edgeType":"calls","source":2470,"target":1052},{"edgeType":"contains","source":8975,"target":8991},{"edgeType":"calls","source":708,"target":707},{"edgeType":"calls","source":11974,"target":6637},{"edgeType":"contains","source":12999,"target":13206},{"edgeType":"contains","source":8975,"target":8990},{"edgeType":"contains","source":6593,"target":6727},{"edgeType":"calls","source":9495,"target":9492},{"edgeType":"contains","source":15318,"target":15321},{"edgeType":"imports","source":14502,"target":2828},{"edgeType":"contains","source":12474,"target":12568},{"edgeType":"calls","source":14119,"target":14134},{"edgeType":"calls","source":6456,"target":6455},{"edgeType":"contains","source":7719,"target":7759},{"edgeType":"calls","source":3341,"target":1534},{"edgeType":"contains","source":10890,"target":366},{"edgeType":"contains","source":3359,"target":3397},{"edgeType":"contains","source":16309,"target":16310},{"edgeType":"contains","source":2762,"target":2878},{"edgeType":"calls","source":906,"target":913},{"edgeType":"contains","source":12939,"target":12951},{"edgeType":"contains","source":6012,"target":5712},{"edgeType":"contains","source":12999,"target":13205},{"edgeType":"contains","source":2699,"target":2714},{"edgeType":"calls","source":1765,"target":1767},{"edgeType":"contains","source":15581,"target":15625},{"edgeType":"contains","source":10164,"target":10184},{"edgeType":"contains","source":8447,"target":8449},{"edgeType":"contains","source":7054,"target":7235},{"edgeType":"contains","source":5662,"target":5992},{"edgeType":"contains","source":8975,"target":8993},{"edgeType":"contains","source":16630,"target":16932},{"edgeType":"contains","source":2762,"target":2875},{"edgeType":"contains","source":14195,"target":14196},{"edgeType":"contains","source":7250,"target":7501},{"edgeType":"contains","source":1,"target":14476},{"edgeType":"contains","source":15449,"target":15490},{"edgeType":"contains","source":1906,"target":1929},{"edgeType":"calls","source":14398,"target":13940},{"edgeType":"contains","source":6593,"target":6729},{"edgeType":"calls","source":1897,"target":1902},{"edgeType":"calls","source":15115,"target":14966},{"edgeType":"imports","source":15986,"target":16020},{"edgeType":"contains","source":8447,"target":8448},{"edgeType":"contains","source":7250,"target":7502},{"edgeType":"contains","source":2699,"target":2715},{"edgeType":"contains","source":14195,"target":14197},{"edgeType":"calls","source":10171,"target":3336},{"edgeType":"calls","source":12270,"target":12264},{"edgeType":"contains","source":7250,"target":7512},{"edgeType":"contains","source":1,"target":14479},{"edgeType":"contains","source":5662,"target":6002},{"edgeType":"contains","source":16630,"target":16917},{"edgeType":"contains","source":14502,"target":8892},{"edgeType":"contains","source":15449,"target":15474},{"edgeType":"calls","source":6562,"target":1058},{"edgeType":"contains","source":4072,"target":4554},{"edgeType":"contains","source":16630,"target":16918},{"edgeType":"imports","source":7850,"target":1856},{"edgeType":"contains","source":8643,"target":8725},{"edgeType":"contains","source":8447,"target":8459},{"edgeType":"contains","source":2765,"target":2788},{"edgeType":"calls","source":4947,"target":4596},{"edgeType":"calls","source":12270,"target":12265},{"edgeType":"contains","source":4549,"target":4564},{"edgeType":"calls","source":5820,"target":5015},{"edgeType":"contains","source":7852,"target":7876},{"edgeType":"contains","source":15779,"target":15816},{"edgeType":"imports","source":1621,"target":473},{"edgeType":"contains","source":2765,"target":2789},{"edgeType":"contains","source":15449,"target":15475},{"edgeType":"contains","source":3359,"target":3401},{"edgeType":"imports","source":10884,"target":2935},{"edgeType":"contains","source":14723,"target":14727},{"edgeType":"imports","source":2619,"target":1246},{"edgeType":"contains","source":8447,"target":8458},{"edgeType":"contains","source":14916,"target":15086},{"edgeType":"contains","source":10099,"target":10101},{"edgeType":"contains","source":8643,"target":8724},{"edgeType":"contains","source":980,"target":3159},{"edgeType":"imports","source":14777,"target":2758},{"edgeType":"contains","source":15648,"target":15650},{"edgeType":"contains","source":5659,"target":6097},{"edgeType":"contains","source":5662,"target":6004},{"edgeType":"contains","source":6125,"target":6450},{"edgeType":"contains","source":6312,"target":653},{"edgeType":"calls","source":14438,"target":2134},{"edgeType":"contains","source":13731,"target":13780},{"edgeType":"contains","source":15449,"target":15476},{"edgeType":"contains","source":8781,"target":8677},{"edgeType":"contains","source":14723,"target":14728},{"edgeType":"calls","source":11281,"target":11210},{"edgeType":"contains","source":1246,"target":1252},{"edgeType":"contains","source":8447,"target":8461},{"edgeType":"contains","source":2762,"target":2879},{"edgeType":"contains","source":1167,"target":1589},{"edgeType":"contains","source":15648,"target":15651},{"edgeType":"calls","source":1897,"target":1898},{"edgeType":"contains","source":4072,"target":4550},{"edgeType":"calls","source":16105,"target":16000},{"edgeType":"contains","source":14259,"target":14314},{"edgeType":"contains","source":1906,"target":1933},{"edgeType":"contains","source":15449,"target":15477},{"edgeType":"contains","source":14723,"target":14729},{"edgeType":"contains","source":2762,"target":2880},{"edgeType":"contains","source":8447,"target":8460},{"edgeType":"contains","source":14987,"target":15002},{"edgeType":"contains","source":15648,"target":15652},{"edgeType":"contains","source":7250,"target":7508},{"edgeType":"imports","source":1244,"target":1586},{"edgeType":"contains","source":5227,"target":4692},{"edgeType":"contains","source":5659,"target":6091},{"edgeType":"calls","source":15134,"target":5926},{"edgeType":"calls","source":8584,"target":8145},{"edgeType":"contains","source":4072,"target":4558},{"edgeType":"contains","source":8975,"target":8999},{"edgeType":"calls","source":11213,"target":11210},{"edgeType":"contains","source":16630,"target":16922},{"edgeType":"contains","source":1246,"target":1258},{"edgeType":"contains","source":2765,"target":2792},{"edgeType":"contains","source":13203,"target":13233},{"edgeType":"contains","source":14723,"target":14730},{"edgeType":"contains","source":8447,"target":8455},{"edgeType":"calls","source":9919,"target":2699},{"edgeType":"contains","source":15648,"target":15653},{"edgeType":"contains","source":3314,"target":573},{"edgeType":"contains","source":5662,"target":5999},{"edgeType":"contains","source":2765,"target":2793},{"edgeType":"contains","source":8447,"target":8454},{"edgeType":"calls","source":3441,"target":540},{"edgeType":"calls","source":9919,"target":2698},{"edgeType":"contains","source":12907,"target":13952},{"edgeType":"contains","source":14723,"target":14731},{"edgeType":"contains","source":4547,"target":4630},{"edgeType":"contains","source":4549,"target":4568},{"edgeType":"contains","source":14916,"target":15090},{"edgeType":"contains","source":7250,"target":7510},{"edgeType":"calls","source":3249,"target":2261},{"edgeType":"contains","source":11270,"target":11846},{"edgeType":"contains","source":1167,"target":1594},{"edgeType":"imports","source":15986,"target":16013},{"edgeType":"calls","source":10636,"target":1615},{"edgeType":"contains","source":2765,"target":2790},{"edgeType":"calls","source":906,"target":905},{"edgeType":"contains","source":8447,"target":8457},{"edgeType":"contains","source":14987,"target":15004},{"edgeType":"contains","source":14916,"target":15091},{"edgeType":"calls","source":1104,"target":1108},{"edgeType":"contains","source":14916,"target":15092},{"edgeType":"contains","source":7250,"target":7511},{"edgeType":"calls","source":16178,"target":3162},{"edgeType":"contains","source":11270,"target":11847},{"edgeType":"contains","source":1167,"target":1593},{"edgeType":"contains","source":2765,"target":2791},{"edgeType":"contains","source":8975,"target":9000},{"edgeType":"contains","source":1906,"target":1938},{"edgeType":"contains","source":237,"target":796},{"edgeType":"contains","source":16630,"target":16909},{"edgeType":"imports","source":10550,"target":597},{"edgeType":"calls","source":378,"target":387},{"edgeType":"contains","source":12939,"target":12941},{"edgeType":"contains","source":14987,"target":14990},{"edgeType":"calls","source":8372,"target":8345},{"edgeType":"calls","source":2130,"target":1042},{"edgeType":"contains","source":6593,"target":6713},{"edgeType":"calls","source":9891,"target":9880},{"edgeType":"contains","source":237,"target":795},{"edgeType":"calls","source":6599,"target":6229},{"edgeType":"calls","source":2030,"target":2026},{"edgeType":"contains","source":2762,"target":2858},{"edgeType":"contains","source":5227,"target":4662},{"edgeType":"contains","source":8975,"target":8978},{"edgeType":"contains","source":14987,"target":14991},{"edgeType":"imports","source":5162,"target":612},{"edgeType":"contains","source":13001,"target":13132},{"edgeType":"contains","source":12939,"target":12940},{"edgeType":"contains","source":15581,"target":15603},{"edgeType":"calls","source":16275,"target":2246},{"edgeType":"calls","source":2130,"target":1043},{"edgeType":"contains","source":6593,"target":6714},{"edgeType":"calls","source":9230,"target":9230},{"edgeType":"contains","source":9834,"target":9835},{"edgeType":"calls","source":11212,"target":11213},{"edgeType":"contains","source":5662,"target":5979},{"edgeType":"contains","source":10426,"target":10506},{"edgeType":"contains","source":14987,"target":14992},{"edgeType":"contains","source":8975,"target":8981},{"edgeType":"contains","source":12999,"target":13193},{"edgeType":"calls","source":15906,"target":15801},{"edgeType":"contains","source":15581,"target":15604},{"edgeType":"imports","source":16315,"target":16377},{"edgeType":"calls","source":14369,"target":2134},{"edgeType":"contains","source":5659,"target":6073},{"edgeType":"imports","source":10876,"target":1058},{"edgeType":"contains","source":14987,"target":14993},{"edgeType":"contains","source":12999,"target":13192},{"edgeType":"contains","source":8975,"target":8980},{"edgeType":"contains","source":11336,"target":1324},{"edgeType":"contains","source":7250,"target":7490},{"edgeType":"contains","source":6593,"target":6716},{"edgeType":"contains","source":11679,"target":11831},{"edgeType":"contains","source":15779,"target":15809},{"edgeType":"contains","source":237,"target":797},{"edgeType":"calls","source":7252,"target":7129},{"edgeType":"contains","source":10550,"target":10888},{"edgeType":"calls","source":6795,"target":156},{"edgeType":"contains","source":7719,"target":7743},{"edgeType":"contains","source":2699,"target":2700},{"edgeType":"contains","source":11083,"target":11278},{"edgeType":"contains","source":5662,"target":5973},{"edgeType":"contains","source":7250,"target":7483},{"edgeType":"contains","source":11680,"target":11797},{"edgeType":"contains","source":13731,"target":13753},{"edgeType":"calls","source":4269,"target":2380},{"edgeType":"contains","source":6593,"target":6709},{"edgeType":"contains","source":8643,"target":8696},{"edgeType":"contains","source":10426,"target":10504},{"edgeType":"contains","source":3971,"target":3436},{"edgeType":"calls","source":14557,"target":540},{"edgeType":"calls","source":10684,"target":10672},{"edgeType":"contains","source":11306,"target":2252},{"edgeType":"contains","source":2699,"target":2701},{"edgeType":"imports","source":10550,"target":600},{"edgeType":"contains","source":7250,"target":7484},{"edgeType":"contains","source":13001,"target":13127},{"edgeType":"calls","source":1588,"target":925},{"edgeType":"contains","source":11937,"target":1717},{"edgeType":"contains","source":11680,"target":11798},{"edgeType":"contains","source":12469,"target":12707},{"edgeType":"contains","source":237,"target":799},{"edgeType":"calls","source":5820,"target":5035},{"edgeType":"contains","source":12212,"target":12218},{"edgeType":"contains","source":8515,"target":8438},{"edgeType":"contains","source":8975,"target":8977},{"edgeType":"contains","source":2758,"target":2983},{"edgeType":"contains","source":2765,"target":2766},{"edgeType":"contains","source":7250,"target":7485},{"edgeType":"contains","source":12999,"target":13188},{"edgeType":"calls","source":1612,"target":184},{"edgeType":"contains","source":11679,"target":11826},{"edgeType":"contains","source":14723,"target":14724},{"edgeType":"contains","source":13599,"target":13615},{"edgeType":"calls","source":2146,"target":540},{"edgeType":"contains","source":12212,"target":12217},{"edgeType":"imports","source":15986,"target":16004},{"edgeType":"calls","source":3477,"target":1561},{"edgeType":"contains","source":5662,"target":5976},{"edgeType":"contains","source":5659,"target":6069},{"edgeType":"imports","source":13217,"target":13053},{"edgeType":"calls","source":1061,"target":352},{"edgeType":"contains","source":8975,"target":8976},{"edgeType":"contains","source":13599,"target":13614},{"edgeType":"contains","source":12999,"target":13187},{"edgeType":"contains","source":11680,"target":11796},{"edgeType":"contains","source":11679,"target":11827},{"edgeType":"calls","source":2294,"target":2295},{"edgeType":"imports","source":2618,"target":1246},{"edgeType":"contains","source":6593,"target":6712},{"edgeType":"contains","source":8643,"target":8697},{"edgeType":"calls","source":6753,"target":5690},{"edgeType":"contains","source":12212,"target":12216},{"edgeType":"contains","source":1,"target":1778},{"edgeType":"contains","source":13001,"target":13141},{"edgeType":"imports","source":2621,"target":1169},{"edgeType":"contains","source":12212,"target":12231},{"edgeType":"contains","source":15581,"target":15594},{"edgeType":"contains","source":2699,"target":2704},{"edgeType":"contains","source":12474,"target":12565},{"edgeType":"contains","source":2762,"target":2865},{"edgeType":"contains","source":6593,"target":6722},{"edgeType":"calls","source":12929,"target":12960},{"edgeType":"contains","source":5662,"target":5986},{"edgeType":"calls","source":2161,"target":2187},{"edgeType":"contains","source":16175,"target":16208},{"edgeType":"contains","source":13731,"target":13765},{"edgeType":"contains","source":8975,"target":8986},{"edgeType":"contains","source":11680,"target":11811},{"edgeType":"contains","source":16175,"target":16206},{"edgeType":"contains","source":4072,"target":4536},{"edgeType":"contains","source":13001,"target":13140},{"edgeType":"calls","source":11416,"target":2783},{"edgeType":"contains","source":12939,"target":12948},{"edgeType":"imports","source":2619,"target":1230},{"edgeType":"contains","source":6593,"target":6723},{"edgeType":"calls","source":4943,"target":4735},{"edgeType":"contains","source":2699,"target":2705},{"edgeType":"contains","source":15312,"target":4907},{"edgeType":"calls","source":13466,"target":540},{"edgeType":"calls","source":3620,"target":3468},{"edgeType":"contains","source":13203,"target":13220},{"edgeType":"calls","source":6135,"target":5836},{"edgeType":"contains","source":14128,"target":14129},{"edgeType":"contains","source":16175,"target":16207},{"edgeType":"contains","source":13731,"target":13764},{"edgeType":"contains","source":8975,"target":8989},{"edgeType":"contains","source":12939,"target":12947},{"edgeType":"contains","source":11083,"target":11288},{"edgeType":"contains","source":2699,"target":2702},{"edgeType":"contains","source":12474,"target":12563},{"edgeType":"imports","source":15130,"target":2369},{"edgeType":"contains","source":6593,"target":6724},{"edgeType":"contains","source":15363,"target":5441},{"edgeType":"calls","source":11014,"target":11014},{"edgeType":"contains","source":8579,"target":8581},{"edgeType":"imports","source":14577,"target":8942},{"edgeType":"contains","source":13203,"target":13219},{"edgeType":"contains","source":11680,"target":11807},{"edgeType":"contains","source":14128,"target":14130},{"edgeType":"imports","source":10305,"target":10296},{"edgeType":"contains","source":11680,"target":11809},{"edgeType":"contains","source":13001,"target":13138},{"edgeType":"contains","source":8975,"target":8988},{"edgeType":"contains","source":2699,"target":2703},{"edgeType":"calls","source":1047,"target":782},{"edgeType":"contains","source":2758,"target":2988},{"edgeType":"imports","source":10305,"target":10295},{"edgeType":"contains","source":15779,"target":15801},{"edgeType":"contains","source":7250,"target":7498},{"edgeType":"contains","source":16175,"target":16209},{"edgeType":"contains","source":2699,"target":2708},{"edgeType":"contains","source":8975,"target":8983},{"edgeType":"contains","source":2762,"target":2869},{"edgeType":"contains","source":13001,"target":13137},{"edgeType":"contains","source":15363,"target":5444},{"edgeType":"contains","source":6593,"target":6717},{"edgeType":"contains","source":4939,"target":5147},{"edgeType":"imports","source":16315,"target":16367},{"edgeType":"contains","source":5662,"target":5982},{"edgeType":"contains","source":3426,"target":3427},{"edgeType":"contains","source":2699,"target":2709},{"edgeType":"calls","source":709,"target":683},{"edgeType":"contains","source":13068,"target":13173},{"edgeType":"calls","source":972,"target":986},{"edgeType":"calls","source":4998,"target":5140},{"edgeType":"contains","source":7054,"target":7226},{"edgeType":"contains","source":12939,"target":12944},{"edgeType":"contains","source":8975,"target":8982},{"edgeType":"calls","source":9886,"target":1591},{"edgeType":"contains","source":6682,"target":6073},{"edgeType":"contains","source":6593,"target":6718},{"edgeType":"calls","source":2561,"target":2468},{"edgeType":"calls","source":10750,"target":10749},{"edgeType":"contains","source":9581,"target":9222},{"edgeType":"imports","source":15986,"target":15993},{"edgeType":"contains","source":7852,"target":7856},{"edgeType":"contains","source":16630,"target":16907},{"edgeType":"calls","source":4998,"target":5139},{"edgeType":"contains","source":7054,"target":7227},{"edgeType":"contains","source":12939,"target":12943},{"edgeType":"contains","source":13001,"target":13135},{"edgeType":"contains","source":2699,"target":2706},{"edgeType":"contains","source":6593,"target":6719},{"edgeType":"contains","source":15581,"target":15600},{"edgeType":"contains","source":7250,"target":7493},{"edgeType":"contains","source":5672,"target":5674},{"edgeType":"contains","source":2699,"target":2707},{"edgeType":"contains","source":8975,"target":8984},{"edgeType":"contains","source":6259,"target":6504},{"edgeType":"calls","source":16453,"target":3077},{"edgeType":"contains","source":13001,"target":13134},{"edgeType":"contains","source":15363,"target":5447},{"edgeType":"calls","source":9694,"target":9659},{"edgeType":"contains","source":4547,"target":4612},{"edgeType":"contains","source":12939,"target":12942},{"edgeType":"contains","source":14987,"target":14989},{"edgeType":"contains","source":6593,"target":6721},{"edgeType":"contains","source":7254,"target":7370},{"edgeType":"contains","source":7250,"target":7494},{"edgeType":"contains","source":6593,"target":6720},{"edgeType":"calls","source":8103,"target":8243},{"edgeType":"contains","source":3488,"target":3616},{"edgeType":"contains","source":5739,"target":5712},{"edgeType":"contains","source":5658,"target":6109},{"edgeType":"contains","source":2762,"target":2840},{"edgeType":"contains","source":12013,"target":12033},{"edgeType":"contains","source":13731,"target":13741},{"edgeType":"contains","source":15449,"target":15450},{"edgeType":"contains","source":10296,"target":10293},{"edgeType":"contains","source":518,"target":525},{"edgeType":"calls","source":1449,"target":1094},{"edgeType":"contains","source":16630,"target":16893},{"edgeType":"contains","source":5662,"target":5961},{"edgeType":"contains","source":11083,"target":11265},{"edgeType":"contains","source":3291,"target":3353},{"edgeType":"calls","source":13131,"target":13146},{"edgeType":"calls","source":2097,"target":2148},{"edgeType":"contains","source":8643,"target":8683},{"edgeType":"contains","source":2762,"target":2841},{"edgeType":"contains","source":16175,"target":16198},{"edgeType":"contains","source":696,"target":1348},{"edgeType":"calls","source":11216,"target":11204},{"edgeType":"contains","source":518,"target":524},{"edgeType":"calls","source":9101,"target":9116},{"edgeType":"contains","source":12013,"target":12032},{"edgeType":"contains","source":5659,"target":6055},{"edgeType":"contains","source":13334,"target":13362},{"edgeType":"calls","source":645,"target":648},{"edgeType":"contains","source":11083,"target":11266},{"edgeType":"contains","source":13599,"target":13603},{"edgeType":"imports","source":15385,"target":600},{"edgeType":"contains","source":518,"target":527},{"edgeType":"contains","source":2762,"target":2838},{"edgeType":"calls","source":15596,"target":2271},{"edgeType":"calls","source":9740,"target":4109},{"edgeType":"contains","source":16175,"target":16201},{"edgeType":"contains","source":696,"target":1351},{"edgeType":"imports","source":5871,"target":5903},{"edgeType":"calls","source":12865,"target":12935},{"edgeType":"contains","source":5662,"target":5963},{"edgeType":"contains","source":5658,"target":6087},{"edgeType":"calls","source":6673,"target":6166},{"edgeType":"contains","source":3488,"target":3588},{"edgeType":"contains","source":13412,"target":13057},{"edgeType":"contains","source":3290,"target":3382},{"edgeType":"contains","source":1167,"target":1548},{"edgeType":"contains","source":6682,"target":6055},{"edgeType":"calls","source":14519,"target":14512},{"edgeType":"contains","source":518,"target":526},{"edgeType":"contains","source":16175,"target":16200},{"edgeType":"contains","source":2762,"target":2839},{"edgeType":"contains","source":9503,"target":9508},{"edgeType":"contains","source":13599,"target":13602},{"edgeType":"contains","source":696,"target":1350},{"edgeType":"contains","source":237,"target":781},{"edgeType":"contains","source":10949,"target":620},{"edgeType":"contains","source":5227,"target":4643},{"edgeType":"contains","source":9544,"target":1894},{"edgeType":"calls","source":2302,"target":2134},{"edgeType":"imports","source":15311,"target":779},{"edgeType":"contains","source":10228,"target":10283},{"edgeType":"contains","source":518,"target":529},{"edgeType":"imports","source":15796,"target":15336},{"edgeType":"contains","source":16175,"target":16203},{"edgeType":"calls","source":8317,"target":8056},{"edgeType":"contains","source":2434,"target":2442},{"edgeType":"contains","source":237,"target":784},{"edgeType":"contains","source":15581,"target":15590},{"edgeType":"contains","source":7647,"target":7845},{"edgeType":"contains","source":2762,"target":2844},{"edgeType":"imports","source":15311,"target":774},{"edgeType":"contains","source":518,"target":528},{"edgeType":"calls","source":1612,"target":264},{"edgeType":"contains","source":16175,"target":16202},{"edgeType":"contains","source":11680,"target":11782},{"edgeType":"calls","source":6669,"target":6293},{"edgeType":"calls","source":8584,"target":8235},{"edgeType":"contains","source":12013,"target":12028},{"edgeType":"contains","source":15779,"target":15795},{"edgeType":"contains","source":7054,"target":7201},{"edgeType":"imports","source":12759,"target":12236},{"edgeType":"contains","source":3359,"target":3364},{"edgeType":"contains","source":2762,"target":2845},{"edgeType":"contains","source":9503,"target":9505},{"edgeType":"contains","source":11680,"target":11779},{"edgeType":"contains","source":5341,"target":5343},{"edgeType":"imports","source":14502,"target":8942},{"edgeType":"contains","source":16175,"target":16205},{"edgeType":"calls","source":12273,"target":12264},{"edgeType":"calls","source":13131,"target":13149},{"edgeType":"contains","source":518,"target":531},{"edgeType":"calls","source":7017,"target":6076},{"edgeType":"calls","source":14651,"target":14653},{"edgeType":"contains","source":11270,"target":11804},{"edgeType":"imports","source":2616,"target":1094},{"edgeType":"imports","source":2622,"target":908},{"edgeType":"calls","source":11426,"target":8924},{"edgeType":"contains","source":16238,"target":16367},{"edgeType":"contains","source":5341,"target":5342},{"edgeType":"contains","source":16175,"target":16204},{"edgeType":"contains","source":1167,"target":1552},{"edgeType":"contains","source":518,"target":530},{"edgeType":"contains","source":8643,"target":8681},{"edgeType":"contains","source":237,"target":785},{"edgeType":"contains","source":15363,"target":5438},{"edgeType":"imports","source":15517,"target":15529},{"edgeType":"contains","source":9838,"target":9688},{"edgeType":"calls","source":712,"target":683},{"edgeType":"contains","source":2762,"target":2843},{"edgeType":"contains","source":13334,"target":13356},{"edgeType":"contains","source":7250,"target":7479},{"edgeType":"calls","source":8780,"target":8506},{"edgeType":"contains","source":15713,"target":15714},{"edgeType":"contains","source":16238,"target":16352},{"edgeType":"contains","source":5671,"target":5690},{"edgeType":"contains","source":5662,"target":5969},{"edgeType":"contains","source":11680,"target":11793},{"edgeType":"calls","source":6197,"target":6112},{"edgeType":"contains","source":10164,"target":10166},{"edgeType":"contains","source":12212,"target":12215},{"edgeType":"contains","source":12146,"target":12147},{"edgeType":"calls","source":13131,"target":13156},{"edgeType":"calls","source":712,"target":678},{"edgeType":"contains","source":2762,"target":2848},{"edgeType":"contains","source":6593,"target":6705},{"edgeType":"calls","source":6752,"target":5838},{"edgeType":"calls","source":10819,"target":10835},{"edgeType":"contains","source":7250,"target":7480},{"edgeType":"contains","source":13995,"target":14007},{"edgeType":"contains","source":16174,"target":16221},{"edgeType":"calls","source":6195,"target":6173},{"edgeType":"contains","source":12212,"target":12214},{"edgeType":"contains","source":2762,"target":2849},{"edgeType":"contains","source":2758,"target":2973},{"edgeType":"contains","source":6593,"target":6706},{"edgeType":"imports","source":15517,"target":15523},{"edgeType":"contains","source":7250,"target":7481},{"edgeType":"contains","source":15713,"target":15716},{"edgeType":"contains","source":9838,"target":9699},{"edgeType":"contains","source":5659,"target":6064},{"edgeType":"contains","source":5658,"target":6095},{"edgeType":"contains","source":11306,"target":2244},{"edgeType":"calls","source":2042,"target":1731},{"edgeType":"contains","source":13995,"target":14008},{"edgeType":"contains","source":12999,"target":13184},{"edgeType":"contains","source":11083,"target":11271},{"edgeType":"contains","source":1331,"target":698},{"edgeType":"contains","source":10890,"target":10912},{"edgeType":"contains","source":2762,"target":2846},{"edgeType":"contains","source":6593,"target":6707},{"edgeType":"calls","source":11612,"target":11618},{"edgeType":"contains","source":7250,"target":7482},{"edgeType":"contains","source":13995,"target":14009},{"edgeType":"calls","source":9036,"target":9028},{"edgeType":"contains","source":6002,"target":6003},{"edgeType":"contains","source":1,"target":16561},{"edgeType":"contains","source":6593,"target":6708},{"edgeType":"calls","source":11612,"target":11619},{"edgeType":"calls","source":1059,"target":487},{"edgeType":"calls","source":2405,"target":1043},{"edgeType":"contains","source":1,"target":8108},{"edgeType":"imports","source":2618,"target":1043},{"edgeType":"calls","source":15461,"target":4344},{"edgeType":"contains","source":7517,"target":7654},{"edgeType":"contains","source":16175,"target":16195},{"edgeType":"calls","source":4236,"target":3477},{"edgeType":"contains","source":4072,"target":4525},{"edgeType":"contains","source":2762,"target":2852},{"edgeType":"imports","source":15517,"target":15520},{"edgeType":"contains","source":6593,"target":6702},{"edgeType":"imports","source":2618,"target":1042},{"edgeType":"imports","source":2621,"target":949},{"edgeType":"calls","source":8904,"target":8893},{"edgeType":"contains","source":13335,"target":13336},{"edgeType":"contains","source":13344,"target":13057},{"edgeType":"contains","source":4072,"target":4524},{"edgeType":"contains","source":2758,"target":2977},{"edgeType":"contains","source":2762,"target":2853},{"edgeType":"calls","source":4740,"target":4765},{"edgeType":"contains","source":10890,"target":10911},{"edgeType":"imports","source":12087,"target":7691},{"edgeType":"calls","source":13131,"target":13159},{"edgeType":"calls","source":3160,"target":3005},{"edgeType":"contains","source":6593,"target":6703},{"edgeType":"calls","source":10299,"target":1591},{"edgeType":"contains","source":10472,"target":611},{"edgeType":"contains","source":11353,"target":11354},{"edgeType":"calls","source":14059,"target":13987},{"edgeType":"contains","source":11680,"target":11787},{"edgeType":"contains","source":12013,"target":12035},{"edgeType":"imports","source":14502,"target":8934},{"edgeType":"contains","source":16175,"target":16197},{"edgeType":"contains","source":16046,"target":15968},{"edgeType":"contains","source":8643,"target":8689},{"edgeType":"contains","source":6593,"target":6704},{"edgeType":"contains","source":2434,"target":2449},{"edgeType":"contains","source":15581,"target":15585},{"edgeType":"calls","source":3882,"target":3879},{"edgeType":"contains","source":11353,"target":11355},{"edgeType":"contains","source":16175,"target":16196},{"edgeType":"contains","source":12013,"target":12034},{"edgeType":"calls","source":10671,"target":6969},{"edgeType":"calls","source":2405,"target":1042},{"edgeType":"contains","source":2762,"target":2851},{"edgeType":"calls","source":6855,"target":6880},{"edgeType":"contains","source":6259,"target":6488},{"edgeType":"calls","source":2551,"target":774},{"edgeType":"contains","source":10426,"target":10475},{"edgeType":"imports","source":3290,"target":1331},{"edgeType":"contains","source":5430,"target":4679},{"edgeType":"contains","source":649,"target":675},{"edgeType":"contains","source":2762,"target":2823},{"edgeType":"contains","source":16174,"target":16214},{"edgeType":"contains","source":1838,"target":1871},{"edgeType":"contains","source":5869,"target":5870},{"edgeType":"contains","source":2168,"target":2211},{"edgeType":"contains","source":5935,"target":5938},{"edgeType":"contains","source":10228,"target":10271},{"edgeType":"contains","source":1,"target":14421},{"edgeType":"imports","source":980,"target":1063},{"edgeType":"calls","source":9437,"target":9254},{"edgeType":"contains","source":16630,"target":16875},{"edgeType":"contains","source":12474,"target":12523},{"edgeType":"imports","source":5871,"target":5883},{"edgeType":"contains","source":7250,"target":7455},{"edgeType":"imports","source":3290,"target":1330},{"edgeType":"calls","source":14057,"target":14021},{"edgeType":"contains","source":1307,"target":1420},{"edgeType":"contains","source":1838,"target":1872},{"edgeType":"contains","source":2762,"target":2824},{"edgeType":"contains","source":13465,"target":13513},{"edgeType":"imports","source":12413,"target":12379},{"edgeType":"calls","source":13269,"target":13080},{"edgeType":"contains","source":2168,"target":2212},{"edgeType":"contains","source":6259,"target":6465},{"edgeType":"imports","source":6212,"target":5883},{"edgeType":"contains","source":15911,"target":15912},{"edgeType":"contains","source":848,"target":851},{"edgeType":"contains","source":1838,"target":1868},{"edgeType":"contains","source":980,"target":3101},{"edgeType":"contains","source":13001,"target":13098},{"edgeType":"contains","source":1410,"target":2452},{"edgeType":"contains","source":16630,"target":16878},{"edgeType":"imports","source":15095,"target":7459},{"edgeType":"contains","source":2762,"target":2821},{"edgeType":"imports","source":8778,"target":8785},{"edgeType":"contains","source":5869,"target":5872},{"edgeType":"calls","source":976,"target":977},{"edgeType":"calls","source":11358,"target":11011},{"edgeType":"contains","source":237,"target":765},{"edgeType":"contains","source":2511,"target":2146},{"edgeType":"calls","source":9373,"target":9126},{"edgeType":"calls","source":9667,"target":2126},{"edgeType":"calls","source":16038,"target":16037},{"edgeType":"contains","source":13465,"target":13511},{"edgeType":"contains","source":1838,"target":1869},{"edgeType":"calls","source":646,"target":635},{"edgeType":"calls","source":12008,"target":12003},{"edgeType":"calls","source":2352,"target":600},{"edgeType":"contains","source":1410,"target":2453},{"edgeType":"calls","source":12470,"target":12479},{"edgeType":"calls","source":14518,"target":14526},{"edgeType":"contains","source":2762,"target":2822},{"edgeType":"contains","source":1838,"target":1870},{"edgeType":"calls","source":10806,"target":642},{"edgeType":"contains","source":3952,"target":3985},{"edgeType":"contains","source":6125,"target":6393},{"edgeType":"contains","source":10228,"target":10270},{"edgeType":"calls","source":11236,"target":6338},{"edgeType":"contains","source":848,"target":853},{"edgeType":"imports","source":15779,"target":3162},{"edgeType":"calls","source":12008,"target":12008},{"edgeType":"contains","source":1410,"target":2458},{"edgeType":"calls","source":11281,"target":11290},{"edgeType":"contains","source":11088,"target":11090},{"edgeType":"calls","source":6370,"target":4974},{"edgeType":"calls","source":13842,"target":12235},{"edgeType":"contains","source":10228,"target":10267},{"edgeType":"contains","source":16175,"target":16187},{"edgeType":"contains","source":3290,"target":3372},{"edgeType":"contains","source":3292,"target":3310},{"edgeType":"calls","source":11612,"target":11599},{"edgeType":"calls","source":2296,"target":2333},{"edgeType":"calls","source":4934,"target":3005},{"edgeType":"calls","source":8317,"target":8039},{"edgeType":"calls","source":13072,"target":12850},{"edgeType":"contains","source":8907,"target":8935},{"edgeType":"contains","source":10029,"target":10094},{"edgeType":"contains","source":237,"target":767},{"edgeType":"imports","source":2621,"target":925},{"edgeType":"contains","source":2168,"target":2215},{"edgeType":"contains","source":15601,"target":14953},{"edgeType":"contains","source":13334,"target":13342},{"edgeType":"contains","source":2168,"target":2216},{"edgeType":"calls","source":12075,"target":12046},{"edgeType":"contains","source":1410,"target":2459},{"edgeType":"contains","source":980,"target":3102},{"edgeType":"calls","source":8041,"target":8140},{"edgeType":"contains","source":11412,"target":11617},{"edgeType":"contains","source":13465,"target":13509},{"edgeType":"contains","source":1331,"target":680},{"edgeType":"contains","source":5662,"target":5941},{"edgeType":"contains","source":4878,"target":4882},{"edgeType":"contains","source":5227,"target":4633},{"edgeType":"contains","source":13995,"target":14003},{"edgeType":"contains","source":16175,"target":16186},{"edgeType":"contains","source":16174,"target":16217},{"edgeType":"contains","source":8774,"target":8829},{"edgeType":"contains","source":1,"target":14424},{"edgeType":"contains","source":696,"target":1339},{"edgeType":"contains","source":7913,"target":5926},{"edgeType":"contains","source":2762,"target":2826},{"edgeType":"contains","source":4878,"target":4881},{"edgeType":"contains","source":1307,"target":1421},{"edgeType":"contains","source":13465,"target":13508},{"edgeType":"contains","source":5227,"target":4632},{"edgeType":"contains","source":11412,"target":11614},{"edgeType":"contains","source":13334,"target":13341},{"edgeType":"calls","source":4331,"target":2669},{"edgeType":"contains","source":10228,"target":10265},{"edgeType":"contains","source":16174,"target":16220},{"edgeType":"contains","source":2762,"target":2825},{"edgeType":"calls","source":2134,"target":1011},{"edgeType":"calls","source":10422,"target":10437},{"edgeType":"calls","source":5296,"target":2351},{"edgeType":"contains","source":237,"target":769},{"edgeType":"calls","source":15703,"target":3162},{"edgeType":"contains","source":3562,"target":3394},{"edgeType":"contains","source":5662,"target":5943},{"edgeType":"contains","source":10029,"target":10092},{"edgeType":"calls","source":7653,"target":7486},{"edgeType":"contains","source":2762,"target":2827},{"edgeType":"calls","source":6262,"target":6229},{"edgeType":"contains","source":4878,"target":4880},{"edgeType":"contains","source":13334,"target":13340},{"edgeType":"contains","source":16175,"target":16188},{"edgeType":"contains","source":16174,"target":16219},{"edgeType":"contains","source":10228,"target":10266},{"edgeType":"contains","source":13068,"target":13129},{"edgeType":"calls","source":778,"target":768},{"edgeType":"contains","source":8774,"target":8831},{"edgeType":"calls","source":2097,"target":2159},{"edgeType":"calls","source":5207,"target":5109},{"edgeType":"contains","source":15671,"target":4330},{"edgeType":"contains","source":10029,"target":10093},{"edgeType":"contains","source":5935,"target":5937},{"edgeType":"calls","source":16706,"target":16465},{"edgeType":"contains","source":12469,"target":12672},{"edgeType":"contains","source":10228,"target":10279},{"edgeType":"calls","source":1473,"target":358},{"edgeType":"contains","source":2632,"target":2634},{"edgeType":"imports","source":14088,"target":612},{"edgeType":"calls","source":13131,"target":13139},{"edgeType":"contains","source":2762,"target":2832},{"edgeType":"contains","source":10692,"target":10694},{"edgeType":"contains","source":11270,"target":11802},{"edgeType":"calls","source":2297,"target":2298},{"edgeType":"calls","source":16170,"target":16178},{"edgeType":"contains","source":14259,"target":14262},{"edgeType":"contains","source":7647,"target":7841},{"edgeType":"contains","source":5662,"target":5953},{"edgeType":"contains","source":3494,"target":3394},{"edgeType":"calls","source":6987,"target":6993},{"edgeType":"contains","source":12939,"target":12915},{"edgeType":"contains","source":14792,"target":14652},{"edgeType":"contains","source":1063,"target":533},{"edgeType":"contains","source":2762,"target":2833},{"edgeType":"calls","source":10819,"target":10819},{"edgeType":"contains","source":11270,"target":11803},{"edgeType":"contains","source":10692,"target":10695},{"edgeType":"contains","source":13334,"target":13354},{"edgeType":"contains","source":7719,"target":7722},{"edgeType":"contains","source":696,"target":1343},{"edgeType":"contains","source":16630,"target":16870},{"edgeType":"contains","source":10824,"target":10828},{"edgeType":"contains","source":518,"target":519},{"edgeType":"contains","source":1,"target":14431},{"edgeType":"contains","source":10166,"target":10085},{"edgeType":"calls","source":12470,"target":12486},{"edgeType":"calls","source":6948,"target":6089},{"edgeType":"imports","source":12315,"target":612},{"edgeType":"contains","source":10228,"target":10278},{"edgeType":"contains","source":1,"target":16545},{"edgeType":"contains","source":2762,"target":2831},{"edgeType":"contains","source":10692,"target":10693},{"edgeType":"calls","source":974,"target":1030},{"edgeType":"contains","source":11270,"target":11801},{"edgeType":"contains","source":13725,"target":13915},{"edgeType":"contains","source":16175,"target":16176},{"edgeType":"contains","source":5662,"target":5948},{"edgeType":"contains","source":2762,"target":2836},{"edgeType":"contains","source":7647,"target":7836},{"edgeType":"contains","source":518,"target":521},{"edgeType":"contains","source":2632,"target":2638},{"edgeType":"contains","source":10824,"target":10826},{"edgeType":"contains","source":11412,"target":11624},{"edgeType":"imports","source":13217,"target":12810},{"edgeType":"contains","source":16175,"target":16179},{"edgeType":"contains","source":16174,"target":16210},{"edgeType":"calls","source":8317,"target":8047},{"edgeType":"contains","source":3426,"target":3394},{"edgeType":"calls","source":6633,"target":1058},{"edgeType":"contains","source":13725,"target":13914},{"edgeType":"calls","source":14181,"target":3847},{"edgeType":"contains","source":2762,"target":2837},{"edgeType":"calls","source":4945,"target":540},{"edgeType":"contains","source":10228,"target":10276},{"edgeType":"calls","source":15122,"target":2159},{"edgeType":"contains","source":518,"target":520},{"edgeType":"contains","source":10824,"target":10827},{"edgeType":"calls","source":3024,"target":3012},{"edgeType":"contains","source":13465,"target":13517},{"edgeType":"contains","source":14502,"target":8848},{"edgeType":"contains","source":7850,"target":7885},{"edgeType":"contains","source":3290,"target":3381},{"edgeType":"contains","source":11680,"target":11773},{"edgeType":"contains","source":13725,"target":13913},{"edgeType":"contains","source":518,"target":523},{"edgeType":"calls","source":10819,"target":10820},{"edgeType":"contains","source":237,"target":777},{"edgeType":"contains","source":14723,"target":1998},{"edgeType":"contains","source":2511,"target":2158},{"edgeType":"calls","source":4614,"target":2344},{"edgeType":"contains","source":3290,"target":3378},{"edgeType":"contains","source":13725,"target":13912},{"edgeType":"calls","source":2296,"target":2323},{"edgeType":"contains","source":9834,"target":1349},{"edgeType":"contains","source":12013,"target":12019},{"edgeType":"contains","source":9838,"target":9679},{"edgeType":"contains","source":7647,"target":7837},{"edgeType":"contains","source":2762,"target":2835},{"edgeType":"contains","source":16630,"target":16873},{"edgeType":"calls","source":4998,"target":5237},{"edgeType":"contains","source":518,"target":522},{"edgeType":"contains","source":10890,"target":10893},{"edgeType":"contains","source":2632,"target":2637},{"edgeType":"contains","source":10824,"target":10825},{"edgeType":"contains","source":13465,"target":13515},{"edgeType":"contains","source":237,"target":776},{"edgeType":"contains","source":980,"target":3112},{"edgeType":"contains","source":13725,"target":13911},{"edgeType":"contains","source":3290,"target":3379},{"edgeType":"contains","source":10228,"target":10274},{"edgeType":"contains","source":12013,"target":12018},{"edgeType":"imports","source":2621,"target":930},{"edgeType":"calls","source":1502,"target":1532},{"edgeType":"contains","source":8838,"target":8948},{"edgeType":"contains","source":15712,"target":15720},{"edgeType":"calls","source":1612,"target":236},{"edgeType":"imports","source":12090,"target":9756},{"edgeType":"contains","source":16630,"target":16860},{"edgeType":"calls","source":4031,"target":3468},{"edgeType":"contains","source":1410,"target":2438},{"edgeType":"contains","source":9365,"target":9523},{"edgeType":"contains","source":3358,"target":3359},{"edgeType":"contains","source":8841,"target":8854},{"edgeType":"calls","source":15184,"target":15009},{"edgeType":"contains","source":8907,"target":8922},{"edgeType":"contains","source":8774,"target":8817},{"edgeType":"contains","source":8643,"target":8650},{"edgeType":"calls","source":1306,"target":1265},{"edgeType":"contains","source":385,"target":386},{"edgeType":"contains","source":12013,"target":11999},{"edgeType":"contains","source":237,"target":745},{"edgeType":"calls","source":1239,"target":1227},{"edgeType":"contains","source":1,"target":8061},{"edgeType":"calls","source":2560,"target":2561},{"edgeType":"contains","source":9365,"target":9522},{"edgeType":"contains","source":1410,"target":2439},{"edgeType":"calls","source":711,"target":683},{"edgeType":"imports","source":10385,"target":9756},{"edgeType":"contains","source":12469,"target":12660},{"edgeType":"contains","source":12013,"target":11998},{"edgeType":"contains","source":237,"target":749},{"edgeType":"contains","source":15712,"target":15722},{"edgeType":"contains","source":10228,"target":10252},{"edgeType":"contains","source":5659,"target":6023},{"edgeType":"calls","source":9449,"target":8869},{"edgeType":"calls","source":9437,"target":9241},{"edgeType":"contains","source":13001,"target":13081},{"edgeType":"contains","source":1410,"target":2436},{"edgeType":"calls","source":7557,"target":6213},{"edgeType":"calls","source":7513,"target":7577},{"edgeType":"calls","source":11613,"target":11547},{"edgeType":"contains","source":5943,"target":5676},{"edgeType":"contains","source":10228,"target":10253},{"edgeType":"contains","source":237,"target":747},{"edgeType":"contains","source":5662,"target":5931},{"edgeType":"contains","source":7647,"target":7817},{"edgeType":"imports","source":15636,"target":5535},{"edgeType":"contains","source":8907,"target":8924},{"edgeType":"contains","source":1410,"target":2437},{"edgeType":"calls","source":929,"target":264},{"edgeType":"contains","source":10228,"target":10250},{"edgeType":"contains","source":1,"target":14409},{"edgeType":"contains","source":8841,"target":8851},{"edgeType":"contains","source":253,"target":255},{"edgeType":"contains","source":237,"target":751},{"edgeType":"imports","source":7919,"target":7987},{"edgeType":"contains","source":13335,"target":13295},{"edgeType":"calls","source":10030,"target":9886},{"edgeType":"calls","source":8044,"target":8029},{"edgeType":"contains","source":6125,"target":6370},{"edgeType":"contains","source":8907,"target":8918},{"edgeType":"contains","source":13001,"target":13078},{"edgeType":"contains","source":1838,"target":1859},{"edgeType":"contains","source":253,"target":254},{"edgeType":"contains","source":237,"target":750},{"edgeType":"contains","source":15654,"target":610},{"edgeType":"contains","source":980,"target":3085},{"edgeType":"calls","source":2539,"target":1094},{"edgeType":"contains","source":9365,"target":9518},{"edgeType":"calls","source":9113,"target":2376},{"edgeType":"contains","source":13001,"target":13077},{"edgeType":"contains","source":10228,"target":10248},{"edgeType":"contains","source":9838,"target":3315},{"edgeType":"contains","source":8907,"target":8921},{"edgeType":"contains","source":4679,"target":4691},{"edgeType":"calls","source":11215,"target":11203},{"edgeType":"calls","source":1502,"target":1530},{"edgeType":"calls","source":1267,"target":358},{"edgeType":"contains","source":11270,"target":11771},{"edgeType":"contains","source":848,"target":838},{"edgeType":"contains","source":15911,"target":15899},{"edgeType":"calls","source":2084,"target":400},{"edgeType":"contains","source":9365,"target":9521},{"edgeType":"contains","source":10228,"target":10249},{"edgeType":"contains","source":9838,"target":3314},{"edgeType":"contains","source":1838,"target":1857},{"edgeType":"calls","source":4416,"target":2097},{"edgeType":"imports","source":10385,"target":9759},{"edgeType":"contains","source":8643,"target":8648},{"edgeType":"contains","source":15712,"target":15727},{"edgeType":"contains","source":237,"target":752},{"edgeType":"imports","source":5871,"target":5939},{"edgeType":"calls","source":1243,"target":1101},{"edgeType":"contains","source":7157,"target":6091},{"edgeType":"contains","source":12672,"target":12705},{"edgeType":"contains","source":5662,"target":5927},{"edgeType":"contains","source":1410,"target":2441},{"edgeType":"contains","source":3358,"target":3360},{"edgeType":"calls","source":2561,"target":2524},{"edgeType":"calls","source":238,"target":540},{"edgeType":"imports","source":2621,"target":987},{"edgeType":"imports","source":8906,"target":9089},{"edgeType":"calls","source":15358,"target":5394},{"edgeType":"contains","source":15312,"target":4857},{"edgeType":"contains","source":237,"target":755},{"edgeType":"calls","source":6602,"target":6226},{"edgeType":"contains","source":13334,"target":13339},{"edgeType":"contains","source":16240,"target":16257},{"edgeType":"contains","source":1838,"target":1862},{"edgeType":"calls","source":12470,"target":12472},{"edgeType":"contains","source":1410,"target":2446},{"edgeType":"contains","source":8907,"target":8931},{"edgeType":"contains","source":1307,"target":1411},{"edgeType":"calls","source":4938,"target":4941},{"edgeType":"contains","source":15311,"target":15458},{"edgeType":"contains","source":13410,"target":13096},{"edgeType":"contains","source":3291,"target":3330},{"edgeType":"calls","source":511,"target":532},{"edgeType":"contains","source":13334,"target":13338},{"edgeType":"contains","source":16240,"target":16256},{"edgeType":"calls","source":14389,"target":14291},{"edgeType":"contains","source":13465,"target":13505},{"edgeType":"contains","source":1838,"target":1863},{"edgeType":"contains","source":10228,"target":10264},{"edgeType":"contains","source":6259,"target":6457},{"edgeType":"contains","source":1307,"target":1412},{"edgeType":"calls","source":7160,"target":5842},{"edgeType":"calls","source":12008,"target":11996},{"edgeType":"contains","source":8907,"target":8930},{"edgeType":"contains","source":10426,"target":10468},{"edgeType":"contains","source":15670,"target":4330},{"edgeType":"contains","source":1838,"target":1860},{"edgeType":"contains","source":13465,"target":13504},{"edgeType":"calls","source":14946,"target":13940},{"edgeType":"contains","source":237,"target":757},{"edgeType":"contains","source":13334,"target":13337},{"edgeType":"contains","source":3952,"target":3977},{"edgeType":"contains","source":16240,"target":16259},{"edgeType":"contains","source":8907,"target":8933},{"edgeType":"contains","source":10426,"target":10465},{"edgeType":"contains","source":1307,"target":1409},{"edgeType":"contains","source":8774,"target":8828},{"edgeType":"calls","source":3034,"target":540},{"edgeType":"contains","source":1838,"target":1861},{"edgeType":"contains","source":237,"target":756},{"edgeType":"contains","source":5662,"target":5939},{"edgeType":"calls","source":12470,"target":12471},{"edgeType":"calls","source":8242,"target":8241},{"edgeType":"calls","source":8439,"target":2134},{"edgeType":"calls","source":6602,"target":6229},{"edgeType":"contains","source":8907,"target":8932},{"edgeType":"imports","source":5871,"target":5927},{"edgeType":"contains","source":11083,"target":11239},{"edgeType":"calls","source":1469,"target":433},{"edgeType":"contains","source":3488,"target":3562},{"edgeType":"contains","source":8643,"target":8660},{"edgeType":"contains","source":6682,"target":6023},{"edgeType":"contains","source":237,"target":759},{"edgeType":"calls","source":14389,"target":14296},{"edgeType":"contains","source":3952,"target":3983},{"edgeType":"contains","source":16240,"target":16261},{"edgeType":"contains","source":1838,"target":1866},{"edgeType":"calls","source":2031,"target":2033},{"edgeType":"contains","source":16309,"target":16236},{"edgeType":"calls","source":8500,"target":2358},{"edgeType":"contains","source":1307,"target":1415},{"edgeType":"contains","source":5662,"target":5932},{"edgeType":"contains","source":3952,"target":3984},{"edgeType":"calls","source":3027,"target":2869},{"edgeType":"contains","source":8907,"target":8927},{"edgeType":"contains","source":15712,"target":15717},{"edgeType":"contains","source":12533,"target":4339},{"edgeType":"contains","source":1,"target":8074},{"edgeType":"contains","source":16240,"target":16260},{"edgeType":"contains","source":1838,"target":1867},{"edgeType":"calls","source":3881,"target":3879},{"edgeType":"contains","source":1410,"target":2451},{"edgeType":"contains","source":2762,"target":2820},{"edgeType":"contains","source":7647,"target":7819},{"edgeType":"contains","source":1307,"target":1416},{"edgeType":"contains","source":4883,"target":4718},{"edgeType":"calls","source":12470,"target":12477},{"edgeType":"calls","source":8018,"target":388},{"edgeType":"imports","source":7919,"target":7980},{"edgeType":"imports","source":15517,"target":15552},{"edgeType":"imports","source":9598,"target":2440},{"edgeType":"imports","source":2619,"target":1043},{"edgeType":"contains","source":13465,"target":13500},{"edgeType":"contains","source":10295,"target":10293},{"edgeType":"contains","source":3952,"target":3981},{"edgeType":"contains","source":1838,"target":1864},{"edgeType":"calls","source":4938,"target":4935},{"edgeType":"contains","source":10426,"target":10461},{"edgeType":"imports","source":11679,"target":7691},{"edgeType":"contains","source":8907,"target":8929},{"edgeType":"contains","source":8774,"target":8824},{"edgeType":"calls","source":3826,"target":3468},{"edgeType":"imports","source":2619,"target":1042},{"edgeType":"calls","source":8869,"target":1491},{"edgeType":"contains","source":13465,"target":13499},{"edgeType":"contains","source":980,"target":3096},{"edgeType":"calls","source":10965,"target":10506},{"edgeType":"calls","source":6127,"target":6128},{"edgeType":"contains","source":16240,"target":16262},{"edgeType":"calls","source":16631,"target":16668},{"edgeType":"contains","source":1838,"target":1865},{"edgeType":"contains","source":5662,"target":5935},{"edgeType":"calls","source":14518,"target":14522},{"edgeType":"calls","source":6326,"target":6333},{"edgeType":"calls","source":1525,"target":807},{"edgeType":"contains","source":1307,"target":1414},{"edgeType":"contains","source":1,"target":14418},{"edgeType":"contains","source":8774,"target":8823},{"edgeType":"imports","source":15712,"target":3162},{"edgeType":"contains","source":12672,"target":12695},{"edgeType":"contains","source":5873,"target":5712},{"edgeType":"imports","source":15810,"target":4352},{"edgeType":"contains","source":9090,"target":9576},{"edgeType":"contains","source":1410,"target":2421},{"edgeType":"contains","source":1331,"target":642},{"edgeType":"contains","source":8839,"target":8900},{"edgeType":"contains","source":8774,"target":8801},{"edgeType":"contains","source":4545,"target":4598},{"edgeType":"imports","source":9754,"target":8161},{"edgeType":"imports","source":2621,"target":962},{"edgeType":"contains","source":16165,"target":16460},{"edgeType":"contains","source":10353,"target":10591},{"edgeType":"calls","source":10686,"target":10672},{"edgeType":"contains","source":237,"target":729},{"edgeType":"contains","source":1063,"target":492},{"edgeType":"contains","source":5341,"target":5290},{"edgeType":"calls","source":8041,"target":8103},{"edgeType":"contains","source":9090,"target":9575},{"edgeType":"contains","source":13069,"target":13072},{"edgeType":"contains","source":8839,"target":8899},{"edgeType":"contains","source":14912,"target":15136},{"edgeType":"contains","source":8774,"target":8800},{"edgeType":"imports","source":2621,"target":961},{"edgeType":"contains","source":4545,"target":4597},{"edgeType":"imports","source":9754,"target":8162},{"edgeType":"contains","source":16165,"target":16459},{"edgeType":"contains","source":237,"target":732},{"edgeType":"calls","source":9449,"target":8852},{"edgeType":"imports","source":7919,"target":7964},{"edgeType":"contains","source":847,"target":849},{"edgeType":"calls","source":4740,"target":4759},{"edgeType":"contains","source":9307,"target":7079},{"edgeType":"contains","source":8839,"target":8903},{"edgeType":"contains","source":13069,"target":13071},{"edgeType":"calls","source":14057,"target":13987},{"edgeType":"contains","source":8774,"target":8803},{"edgeType":"contains","source":14912,"target":15137},{"edgeType":"contains","source":8839,"target":8902},{"edgeType":"imports","source":9754,"target":8159},{"edgeType":"contains","source":3952,"target":3953},{"edgeType":"contains","source":10353,"target":10589},{"edgeType":"contains","source":6125,"target":6359},{"edgeType":"calls","source":9034,"target":9033},{"edgeType":"calls","source":9038,"target":8909},{"edgeType":"imports","source":4323,"target":3170},{"edgeType":"contains","source":15311,"target":15453},{"edgeType":"contains","source":12672,"target":12692},{"edgeType":"contains","source":8907,"target":8908},{"edgeType":"contains","source":15312,"target":4852},{"edgeType":"contains","source":3488,"target":3537},{"edgeType":"contains","source":13069,"target":13070},{"edgeType":"contains","source":11083,"target":11215},{"edgeType":"calls","source":10091,"target":10090},{"edgeType":"imports","source":7458,"target":7459},{"edgeType":"contains","source":8839,"target":8901},{"edgeType":"contains","source":16240,"target":16250},{"edgeType":"calls","source":6755,"target":5690},{"edgeType":"contains","source":10353,"target":10590},{"edgeType":"calls","source":3444,"target":540},{"edgeType":"imports","source":2618,"target":1052},{"edgeType":"contains","source":4545,"target":4595},{"edgeType":"calls","source":9100,"target":9100},{"edgeType":"calls","source":14945,"target":13940},{"edgeType":"contains","source":15311,"target":15454},{"edgeType":"contains","source":9090,"target":9572},{"edgeType":"contains","source":16630,"target":16847},{"edgeType":"calls","source":2230,"target":2232},{"edgeType":"contains","source":4545,"target":4602},{"edgeType":"contains","source":8839,"target":8896},{"edgeType":"contains","source":7157,"target":6073},{"edgeType":"imports","source":12907,"target":3436},{"edgeType":"calls","source":6403,"target":6033},{"edgeType":"contains","source":9090,"target":9571},{"edgeType":"contains","source":5662,"target":5908},{"edgeType":"calls","source":13989,"target":13986},{"edgeType":"contains","source":8839,"target":8895},{"edgeType":"contains","source":4545,"target":4601},{"edgeType":"calls","source":3518,"target":358},{"edgeType":"contains","source":15311,"target":15455},{"edgeType":"calls","source":9038,"target":8910},{"edgeType":"imports","source":15810,"target":2236},{"edgeType":"calls","source":6465,"target":6226},{"edgeType":"calls","source":15589,"target":15119},{"edgeType":"calls","source":9449,"target":8856},{"edgeType":"calls","source":16169,"target":16166},{"edgeType":"contains","source":980,"target":3072},{"edgeType":"contains","source":13741,"target":13375},{"edgeType":"contains","source":1838,"target":1840},{"edgeType":"contains","source":11083,"target":11209},{"edgeType":"calls","source":14854,"target":4082},{"edgeType":"contains","source":8839,"target":8898},{"edgeType":"calls","source":6668,"target":6276},{"edgeType":"contains","source":4545,"target":4600},{"edgeType":"contains","source":15311,"target":15456},{"edgeType":"imports","source":2622,"target":925},{"edgeType":"contains","source":237,"target":736},{"edgeType":"contains","source":5662,"target":5910},{"edgeType":"contains","source":9955,"target":10239},{"edgeType":"contains","source":12288,"target":3451},{"edgeType":"calls","source":9437,"target":9227},{"edgeType":"contains","source":11083,"target":11211},{"edgeType":"contains","source":11417,"target":11427},{"edgeType":"calls","source":2957,"target":2949},{"edgeType":"imports","source":4549,"target":2510},{"edgeType":"contains","source":8774,"target":8798},{"edgeType":"contains","source":8839,"target":8897},{"edgeType":"contains","source":14912,"target":15142},{"edgeType":"contains","source":15311,"target":15457},{"edgeType":"contains","source":4545,"target":4599},{"edgeType":"contains","source":237,"target":735},{"edgeType":"calls","source":6955,"target":5836},{"edgeType":"imports","source":5871,"target":5923},{"edgeType":"contains","source":12469,"target":12639},{"edgeType":"contains","source":11680,"target":11744},{"edgeType":"imports","source":11679,"target":1331},{"edgeType":"calls","source":6069,"target":5836},{"edgeType":"imports","source":7919,"target":7958},{"edgeType":"contains","source":10228,"target":10246},{"edgeType":"contains","source":10522,"target":1132},{"edgeType":"calls","source":9437,"target":774},{"edgeType":"contains","source":13001,"target":13075},{"edgeType":"imports","source":2618,"target":1063},{"edgeType":"calls","source":2231,"target":2197},{"edgeType":"contains","source":1,"target":16510},{"edgeType":"calls","source":4238,"target":3403},{"edgeType":"contains","source":237,"target":738},{"edgeType":"contains","source":11680,"target":11743},{"edgeType":"calls","source":6729,"target":6501},{"edgeType":"contains","source":10353,"target":10600},{"edgeType":"calls","source":6465,"target":6229},{"edgeType":"contains","source":13001,"target":13074},{"edgeType":"contains","source":1307,"target":1395},{"edgeType":"contains","source":8907,"target":8914},{"edgeType":"contains","source":8774,"target":8809},{"edgeType":"contains","source":980,"target":3073},{"edgeType":"contains","source":4545,"target":4605},{"edgeType":"calls","source":1590,"target":925},{"edgeType":"imports","source":16315,"target":16174},{"edgeType":"contains","source":237,"target":737},{"edgeType":"contains","source":14192,"target":14193},{"edgeType":"contains","source":1838,"target":1847},{"edgeType":"contains","source":10353,"target":10597},{"edgeType":"calls","source":7028,"target":5690},{"edgeType":"contains","source":13001,"target":13073},{"edgeType":"contains","source":8643,"target":8645},{"edgeType":"contains","source":1063,"target":503},{"edgeType":"contains","source":12805,"target":12807},{"edgeType":"contains","source":4545,"target":4604},{"edgeType":"calls","source":1506,"target":1418},{"edgeType":"contains","source":9365,"target":9517},{"edgeType":"contains","source":11680,"target":11741},{"edgeType":"contains","source":16174,"target":16175},{"edgeType":"imports","source":16315,"target":16171},{"edgeType":"contains","source":2168,"target":2185},{"edgeType":"imports","source":5871,"target":5910},{"edgeType":"contains","source":8907,"target":8916},{"edgeType":"contains","source":3488,"target":3545},{"edgeType":"calls","source":12008,"target":11978},{"edgeType":"contains","source":8774,"target":8811},{"edgeType":"calls","source":13461,"target":13443},{"edgeType":"contains","source":4612,"target":4640},{"edgeType":"imports","source":15452,"target":2758},{"edgeType":"contains","source":11270,"target":11768},{"edgeType":"calls","source":14854,"target":14663},{"edgeType":"contains","source":4545,"target":4603},{"edgeType":"contains","source":237,"target":739},{"edgeType":"contains","source":14192,"target":14195},{"edgeType":"contains","source":5662,"target":5923},{"edgeType":"contains","source":11680,"target":11742},{"edgeType":"contains","source":5662,"target":5915},{"edgeType":"calls","source":2866,"target":1534},{"edgeType":"calls","source":1437,"target":1437},{"edgeType":"contains","source":16630,"target":16839},{"edgeType":"contains","source":12672,"target":12699},{"edgeType":"calls","source":1107,"target":1097},{"edgeType":"contains","source":4547,"target":4549},{"edgeType":"contains","source":9365,"target":9511},{"edgeType":"imports","source":8906,"target":2734},{"edgeType":"contains","source":12288,"target":3463},{"edgeType":"contains","source":7784,"target":7785},{"edgeType":"contains","source":16165,"target":16456},{"edgeType":"contains","source":9090,"target":9579},{"edgeType":"contains","source":12672,"target":12698},{"edgeType":"calls","source":15905,"target":15901},{"edgeType":"contains","source":5021,"target":4652},{"edgeType":"contains","source":4547,"target":4548},{"edgeType":"contains","source":8841,"target":8842},{"edgeType":"contains","source":9838,"target":3303},{"edgeType":"contains","source":5736,"target":5737},{"edgeType":"calls","source":14842,"target":4463},{"edgeType":"contains","source":1410,"target":2435},{"edgeType":"contains","source":11680,"target":11740},{"edgeType":"contains","source":1410,"target":2431},{"edgeType":"imports","source":7919,"target":7960},{"edgeType":"contains","source":11270,"target":11763},{"edgeType":"contains","source":4545,"target":4609},{"edgeType":"contains","source":8907,"target":8913},{"edgeType":"contains","source":8774,"target":8808},{"edgeType":"contains","source":9365,"target":9513},{"edgeType":"calls","source":10100,"target":9824},{"edgeType":"calls","source":4476,"target":4475},{"edgeType":"contains","source":16165,"target":16458},{"edgeType":"contains","source":5736,"target":5738},{"edgeType":"calls","source":6632,"target":1058},{"edgeType":"contains","source":7784,"target":7787},{"edgeType":"imports","source":3758,"target":3768},{"edgeType":"contains","source":1410,"target":2432},{"edgeType":"calls","source":14914,"target":4344},{"edgeType":"contains","source":10353,"target":10594},{"edgeType":"contains","source":10426,"target":10445},{"edgeType":"contains","source":9176,"target":9029},{"edgeType":"contains","source":12672,"target":12696},{"edgeType":"calls","source":2983,"target":2134},{"edgeType":"calls","source":9300,"target":9254},{"edgeType":"calls","source":11415,"target":11338},{"edgeType":"calls","source":15532,"target":2097},{"edgeType":"contains","source":13467,"target":13420},{"edgeType":"contains","source":16165,"target":16457},{"edgeType":"contains","source":4072,"target":2358},{"edgeType":"contains","source":11680,"target":11738},{"edgeType":"calls","source":10356,"target":10343},{"edgeType":"calls","source":9857,"target":2660},{"edgeType":"contains","source":2828,"target":2842},{"edgeType":"contains","source":15843,"target":15854},{"edgeType":"contains","source":10492,"target":10494},{"edgeType":"calls","source":448,"target":480},{"edgeType":"contains","source":16630,"target":16827},{"edgeType":"contains","source":12672,"target":12679},{"edgeType":"calls","source":11286,"target":11214},{"edgeType":"contains","source":9365,"target":9490},{"edgeType":"imports","source":14661,"target":14652},{"edgeType":"contains","source":7254,"target":7280},{"edgeType":"contains","source":14912,"target":15118},{"edgeType":"contains","source":1331,"target":626},{"edgeType":"contains","source":2759,"target":2868},{"edgeType":"imports","source":14502,"target":9009},{"edgeType":"calls","source":15180,"target":15232},{"edgeType":"calls","source":14653,"target":14654},{"edgeType":"contains","source":693,"target":1375},{"edgeType":"contains","source":15843,"target":15855},{"edgeType":"contains","source":10492,"target":10495},{"edgeType":"calls","source":4574,"target":1533},{"edgeType":"contains","source":15484,"target":7957},{"edgeType":"calls","source":1110,"target":1097},{"edgeType":"calls","source":6406,"target":6052},{"edgeType":"calls","source":238,"target":647},{"edgeType":"calls","source":2347,"target":807},{"edgeType":"calls","source":2368,"target":156},{"edgeType":"contains","source":1331,"target":627},{"edgeType":"contains","source":7254,"target":7281},{"edgeType":"contains","source":11083,"target":11200},{"edgeType":"contains","source":8774,"target":8787},{"edgeType":"contains","source":14912,"target":15120},{"edgeType":"contains","source":8839,"target":8886},{"edgeType":"contains","source":11680,"target":11717},{"edgeType":"imports","source":14133,"target":14109},{"edgeType":"contains","source":15513,"target":15516},{"edgeType":"calls","source":6660,"target":6635},{"edgeType":"calls","source":1109,"target":1132},{"edgeType":"contains","source":16630,"target":16829},{"edgeType":"contains","source":3158,"target":3180},{"edgeType":"calls","source":4611,"target":4613},{"edgeType":"contains","source":5658,"target":6021},{"edgeType":"contains","source":7254,"target":7282},{"edgeType":"contains","source":14954,"target":7476},{"edgeType":"contains","source":1410,"target":2403},{"edgeType":"contains","source":14916,"target":14997},{"edgeType":"contains","source":2759,"target":2866},{"edgeType":"calls","source":3489,"target":3456},{"edgeType":"calls","source":1506,"target":1508},{"edgeType":"contains","source":14256,"target":14316},{"edgeType":"calls","source":6961,"target":1533},{"edgeType":"imports","source":14075,"target":1109},{"edgeType":"contains","source":16630,"target":16828},{"edgeType":"contains","source":10492,"target":10493},{"edgeType":"contains","source":3158,"target":3181},{"edgeType":"contains","source":12672,"target":12676},{"edgeType":"contains","source":7250,"target":7407},{"edgeType":"calls","source":15672,"target":2097},{"edgeType":"contains","source":1375,"target":3489},{"edgeType":"imports","source":1375,"target":1580},{"edgeType":"imports","source":13932,"target":5535},{"edgeType":"contains","source":3291,"target":3292},{"edgeType":"contains","source":15513,"target":15518},{"edgeType":"calls","source":4900,"target":4108},{"edgeType":"imports","source":8158,"target":611},{"edgeType":"calls","source":3159,"target":3112},{"edgeType":"contains","source":2759,"target":2871},{"edgeType":"calls","source":9471,"target":8288},{"edgeType":"contains","source":14954,"target":7478},{"edgeType":"contains","source":1,"target":16489},{"edgeType":"calls","source":15180,"target":15228},{"edgeType":"contains","source":14256,"target":14318},{"edgeType":"imports","source":16315,"target":16227},{"edgeType":"calls","source":6840,"target":1058},{"edgeType":"contains","source":12469,"target":12624},{"edgeType":"calls","source":8777,"target":8660},{"edgeType":"contains","source":5736,"target":5712},{"edgeType":"contains","source":7254,"target":7277},{"edgeType":"calls","source":1319,"target":956},{"edgeType":"contains","source":1375,"target":3495},{"edgeType":"contains","source":2759,"target":2872},{"edgeType":"contains","source":5662,"target":5892},{"edgeType":"contains","source":11083,"target":11196},{"edgeType":"calls","source":4479,"target":4474},{"edgeType":"contains","source":12870,"target":12877},{"edgeType":"imports","source":14133,"target":14105},{"edgeType":"contains","source":12672,"target":12673},{"edgeType":"calls","source":3160,"target":3079},{"edgeType":"calls","source":9368,"target":9369},{"edgeType":"contains","source":7254,"target":7278},{"edgeType":"contains","source":13526,"target":13681},{"edgeType":"contains","source":1,"target":16491},{"edgeType":"contains","source":10522,"target":1102},{"edgeType":"contains","source":6010,"target":5676},{"edgeType":"contains","source":12870,"target":12876},{"edgeType":"calls","source":1175,"target":1194},{"edgeType":"contains","source":5662,"target":5894},{"edgeType":"contains","source":696,"target":1288},{"edgeType":"contains","source":7254,"target":7279},{"edgeType":"contains","source":13526,"target":13680},{"edgeType":"contains","source":1,"target":14380},{"edgeType":"contains","source":15777,"target":15778},{"edgeType":"contains","source":7254,"target":7289},{"edgeType":"calls","source":16108,"target":16069},{"edgeType":"contains","source":4038,"target":3394},{"edgeType":"contains","source":5662,"target":5903},{"edgeType":"contains","source":2168,"target":2170},{"edgeType":"calls","source":14653,"target":14663},{"edgeType":"contains","source":1375,"target":3498},{"edgeType":"imports","source":9754,"target":10318},{"edgeType":"contains","source":12474,"target":12483},{"edgeType":"contains","source":12469,"target":12638},{"edgeType":"contains","source":8774,"target":8793},{"edgeType":"calls","source":3034,"target":642},{"edgeType":"contains","source":4545,"target":4589},{"edgeType":"calls","source":10690,"target":10672},{"edgeType":"contains","source":9303,"target":9306},{"edgeType":"contains","source":15843,"target":15847},{"edgeType":"contains","source":11417,"target":11425},{"edgeType":"contains","source":1375,"target":3499},{"edgeType":"imports","source":16801,"target":15956},{"edgeType":"contains","source":10353,"target":10584},{"edgeType":"calls","source":4247,"target":1092},{"edgeType":"calls","source":9368,"target":9370},{"edgeType":"calls","source":15604,"target":2097},{"edgeType":"contains","source":15777,"target":15780},{"edgeType":"contains","source":1063,"target":487},{"edgeType":"imports","source":2622,"target":987},{"edgeType":"calls","source":3095,"target":2976},{"edgeType":"calls","source":6686,"target":5837},{"edgeType":"contains","source":15843,"target":15848},{"edgeType":"contains","source":9090,"target":9570},{"edgeType":"contains","source":11680,"target":11725},{"edgeType":"contains","source":5662,"target":5905},{"edgeType":"calls","source":10573,"target":1615},{"edgeType":"calls","source":9038,"target":9033},{"edgeType":"contains","source":1375,"target":3496},{"edgeType":"contains","source":8839,"target":8894},{"edgeType":"calls","source":9170,"target":9169},{"edgeType":"contains","source":8579,"target":8498},{"edgeType":"contains","source":12672,"target":12685},{"edgeType":"contains","source":13531,"target":13538},{"edgeType":"calls","source":14654,"target":14629},{"edgeType":"calls","source":14060,"target":14016},{"edgeType":"contains","source":1375,"target":3497},{"edgeType":"calls","source":11943,"target":11994},{"edgeType":"imports","source":16801,"target":15954},{"edgeType":"contains","source":5019,"target":4691},{"edgeType":"calls","source":714,"target":683},{"edgeType":"calls","source":8047,"target":8044},{"edgeType":"contains","source":13531,"target":13537},{"edgeType":"calls","source":2347,"target":793},{"edgeType":"calls","source":2241,"target":1965},{"edgeType":"calls","source":1968,"target":1971},{"edgeType":"contains","source":5662,"target":5899},{"edgeType":"contains","source":11083,"target":11203},{"edgeType":"contains","source":1375,"target":3502},{"edgeType":"calls","source":1319,"target":949},{"edgeType":"imports","source":5871,"target":5963},{"edgeType":"contains","source":14912,"target":15114},{"edgeType":"contains","source":4545,"target":4594},{"edgeType":"calls","source":11233,"target":2299},{"edgeType":"contains","source":12870,"target":12887},{"edgeType":"imports","source":15999,"target":2758},{"edgeType":"contains","source":13556,"target":12761},{"edgeType":"contains","source":11417,"target":11421},{"edgeType":"contains","source":7254,"target":7286},{"edgeType":"calls","source":6663,"target":6553},{"edgeType":"contains","source":6125,"target":6345},{"edgeType":"imports","source":16845,"target":12473},{"edgeType":"contains","source":12087,"target":11790},{"edgeType":"imports","source":15130,"target":4327},{"edgeType":"calls","source":9038,"target":9034},{"edgeType":"calls","source":9042,"target":8910},{"edgeType":"calls","source":2696,"target":2660},{"edgeType":"contains","source":10426,"target":10431},{"edgeType":"calls","source":14654,"target":14635},{"edgeType":"contains","source":14954,"target":7471},{"edgeType":"contains","source":12672,"target":12682},{"edgeType":"calls","source":1242,"target":1221},{"edgeType":"contains","source":1,"target":16497},{"edgeType":"calls","source":11284,"target":11289},{"edgeType":"contains","source":7254,"target":7285},{"edgeType":"contains","source":4545,"target":4593},{"edgeType":"contains","source":12870,"target":12886},{"edgeType":"contains","source":13531,"target":13535},{"edgeType":"contains","source":4545,"target":4592},{"edgeType":"contains","source":11417,"target":11418},{"edgeType":"contains","source":6540,"target":6166},{"edgeType":"contains","source":237,"target":728},{"edgeType":"contains","source":3291,"target":3298},{"edgeType":"contains","source":9303,"target":9305},{"edgeType":"calls","source":16173,"target":16166},{"edgeType":"contains","source":15843,"target":15852},{"edgeType":"contains","source":10522,"target":1109},{"edgeType":"contains","source":7849,"target":7869},{"edgeType":"contains","source":1375,"target":3500},{"edgeType":"calls","source":2070,"target":925},{"edgeType":"imports","source":9564,"target":1410},{"edgeType":"contains","source":10492,"target":10496},{"edgeType":"imports","source":9754,"target":10320},{"edgeType":"calls","source":6755,"target":5817},{"edgeType":"contains","source":12672,"target":12681},{"edgeType":"contains","source":11083,"target":11201},{"edgeType":"contains","source":237,"target":727},{"edgeType":"contains","source":9303,"target":9304},{"edgeType":"contains","source":13465,"target":13466},{"edgeType":"imports","source":10751,"target":2666},{"edgeType":"contains","source":1375,"target":3501},{"edgeType":"contains","source":12474,"target":12476},{"edgeType":"imports","source":9754,"target":10319},{"edgeType":"contains","source":8576,"target":8586},{"edgeType":"calls","source":15625,"target":7786},{"edgeType":"calls","source":9042,"target":8912},{"edgeType":"imports","source":14340,"target":1331},{"edgeType":"contains","source":15443,"target":15553},{"edgeType":"contains","source":9696,"target":9784},{"edgeType":"contains","source":1063,"target":460},{"edgeType":"contains","source":5206,"target":5215},{"edgeType":"calls","source":10683,"target":292},{"edgeType":"contains","source":8773,"target":8799},{"edgeType":"imports","source":7919,"target":8000},{"edgeType":"contains","source":5074,"target":5078},{"edgeType":"contains","source":11226,"target":10979},{"edgeType":"imports","source":14661,"target":14634},{"edgeType":"contains","source":13203,"target":13113},{"edgeType":"contains","source":5402,"target":5480},{"edgeType":"contains","source":15318,"target":2516},{"edgeType":"calls","source":1449,"target":1175},{"edgeType":"contains","source":53,"target":58},{"edgeType":"contains","source":14492,"target":9096},{"edgeType":"calls","source":11085,"target":11087},{"edgeType":"contains","source":5662,"target":5880},{"edgeType":"contains","source":12672,"target":12660},{"edgeType":"contains","source":14954,"target":7459},{"edgeType":"imports","source":15318,"target":612},{"edgeType":"calls","source":5404,"target":5415},{"edgeType":"imports","source":5871,"target":5953},{"edgeType":"contains","source":10029,"target":10030},{"edgeType":"contains","source":6125,"target":6326},{"edgeType":"calls","source":978,"target":981},{"edgeType":"contains","source":11937,"target":12189},{"edgeType":"calls","source":10758,"target":10651},{"edgeType":"calls","source":9371,"target":9254},{"edgeType":"contains","source":3158,"target":3165},{"edgeType":"calls","source":4681,"target":4572},{"edgeType":"calls","source":4416,"target":4331},{"edgeType":"contains","source":14954,"target":7460},{"edgeType":"calls","source":4105,"target":3403},{"edgeType":"calls","source":716,"target":646},{"edgeType":"calls","source":14388,"target":14394},{"edgeType":"contains","source":14492,"target":9098},{"edgeType":"calls","source":10558,"target":10514},{"edgeType":"calls","source":3831,"target":3438},{"edgeType":"contains","source":11937,"target":12188},{"edgeType":"calls","source":15603,"target":14782},{"edgeType":"imports","source":15517,"target":15578},{"edgeType":"calls","source":16011,"target":2134},{"edgeType":"imports","source":3292,"target":1331},{"edgeType":"calls","source":238,"target":660},{"edgeType":"contains","source":3158,"target":3170},{"edgeType":"calls","source":3962,"target":3606},{"edgeType":"contains","source":11937,"target":12187},{"edgeType":"calls","source":6196,"target":6229},{"edgeType":"contains","source":5206,"target":5218},{"edgeType":"contains","source":5470,"target":5485},{"edgeType":"calls","source":2101,"target":2103},{"edgeType":"calls","source":12143,"target":12118},{"edgeType":"calls","source":14870,"target":14252},{"edgeType":"contains","source":5074,"target":5081},{"edgeType":"contains","source":11937,"target":12186},{"edgeType":"calls","source":15603,"target":14784},{"edgeType":"calls","source":6329,"target":6313},{"edgeType":"contains","source":5206,"target":5217},{"edgeType":"contains","source":5662,"target":5876},{"edgeType":"contains","source":5470,"target":5486},{"edgeType":"calls","source":1506,"target":1521},{"edgeType":"calls","source":10536,"target":627},{"edgeType":"contains","source":5999,"target":6000},{"edgeType":"contains","source":12907,"target":13827},{"edgeType":"contains","source":912,"target":918},{"edgeType":"contains","source":5074,"target":5080},{"edgeType":"contains","source":11937,"target":12185},{"edgeType":"contains","source":2828,"target":2829},{"edgeType":"contains","source":15150,"target":14073},{"edgeType":"calls","source":9371,"target":9258},{"edgeType":"contains","source":5206,"target":5216},{"edgeType":"contains","source":5662,"target":5877},{"edgeType":"contains","source":9696,"target":9779},{"edgeType":"contains","source":5470,"target":5487},{"edgeType":"contains","source":5999,"target":6001},{"edgeType":"calls","source":15180,"target":15214},{"edgeType":"calls","source":14925,"target":14663},{"edgeType":"calls","source":5404,"target":5410},{"edgeType":"contains","source":6259,"target":6406},{"edgeType":"contains","source":15263,"target":2098},{"edgeType":"calls","source":6196,"target":6226},{"edgeType":"contains","source":12870,"target":12875},{"edgeType":"calls","source":2763,"target":2716},{"edgeType":"contains","source":3158,"target":3174},{"edgeType":"calls","source":15225,"target":7486},{"edgeType":"contains","source":7254,"target":7272},{"edgeType":"contains","source":12007,"target":12145},{"edgeType":"calls","source":8046,"target":8054},{"edgeType":"contains","source":16632,"target":16740},{"edgeType":"calls","source":6635,"target":1058},{"edgeType":"contains","source":5662,"target":5887},{"edgeType":"calls","source":1840,"target":1731},{"edgeType":"contains","source":9696,"target":9793},{"edgeType":"contains","source":11680,"target":11710},{"edgeType":"calls","source":1308,"target":1310},{"edgeType":"contains","source":8838,"target":8906},{"edgeType":"contains","source":13922,"target":14073},{"edgeType":"contains","source":12870,"target":12874},{"edgeType":"imports","source":5871,"target":5941},{"edgeType":"contains","source":5206,"target":5222},{"edgeType":"contains","source":12007,"target":12144},{"edgeType":"contains","source":7254,"target":7273},{"edgeType":"calls","source":12075,"target":12116},{"edgeType":"contains","source":14323,"target":14327},{"edgeType":"contains","source":14492,"target":9088},{"edgeType":"calls","source":9925,"target":2660},{"edgeType":"contains","source":12870,"target":12873},{"edgeType":"calls","source":2960,"target":2949},{"edgeType":"contains","source":7254,"target":7274},{"edgeType":"contains","source":13526,"target":13677},{"edgeType":"contains","source":12007,"target":12143},{"edgeType":"calls","source":238,"target":658},{"edgeType":"imports","source":5871,"target":5943},{"edgeType":"calls","source":3521,"target":358},{"edgeType":"contains","source":13068,"target":13076},{"edgeType":"calls","source":9037,"target":9046},{"edgeType":"imports","source":12908,"target":3436},{"edgeType":"contains","source":6740,"target":6297},{"edgeType":"contains","source":2762,"target":2765},{"edgeType":"contains","source":5206,"target":5220},{"edgeType":"contains","source":5227,"target":4569},{"edgeType":"contains","source":12870,"target":12872},{"edgeType":"contains","source":7254,"target":7275},{"edgeType":"contains","source":3290,"target":3309},{"edgeType":"calls","source":14785,"target":14787},{"edgeType":"contains","source":5662,"target":5890},{"edgeType":"contains","source":9696,"target":9792},{"edgeType":"contains","source":2759,"target":2863},{"edgeType":"contains","source":4878,"target":4825},{"edgeType":"contains","source":2168,"target":2157},{"edgeType":"calls","source":9698,"target":9699},{"edgeType":"calls","source":2894,"target":2879},{"edgeType":"contains","source":7254,"target":7268},{"edgeType":"contains","source":2510,"target":2126},{"edgeType":"calls","source":1059,"target":570},{"edgeType":"contains","source":7003,"target":6593},{"edgeType":"contains","source":12870,"target":12871},{"edgeType":"contains","source":9434,"target":9453},{"edgeType":"calls","source":9367,"target":9390},{"edgeType":"calls","source":6673,"target":6226},{"edgeType":"calls","source":15776,"target":15770},{"edgeType":"contains","source":3158,"target":3178},{"edgeType":"contains","source":7849,"target":7851},{"edgeType":"contains","source":1780,"target":1501},{"edgeType":"imports","source":14661,"target":14623},{"edgeType":"contains","source":5662,"target":5883},{"edgeType":"calls","source":14460,"target":14291},{"edgeType":"contains","source":10628,"target":2038},{"edgeType":"contains","source":7254,"target":7269},{"edgeType":"calls","source":2894,"target":2880},{"edgeType":"contains","source":8773,"target":8802},{"edgeType":"contains","source":13526,"target":13674},{"edgeType":"imports","source":2621,"target":998},{"edgeType":"contains","source":3158,"target":3179},{"edgeType":"contains","source":6540,"target":6148},{"edgeType":"imports","source":10658,"target":5535},{"edgeType":"contains","source":11945,"target":11948},{"edgeType":"imports","source":7919,"target":7993},{"edgeType":"calls","source":4271,"target":358},{"edgeType":"imports","source":16315,"target":16199},{"edgeType":"calls","source":2037,"target":1965},{"edgeType":"imports","source":5871,"target":5948},{"edgeType":"contains","source":15443,"target":15551},{"edgeType":"contains","source":7254,"target":7270},{"edgeType":"calls","source":2562,"target":2599},{"edgeType":"imports","source":14661,"target":14625},{"edgeType":"contains","source":10628,"target":2035},{"edgeType":"calls","source":4268,"target":2566},{"edgeType":"contains","source":11945,"target":11947},{"edgeType":"contains","source":3488,"target":3516},{"edgeType":"contains","source":5662,"target":5885},{"edgeType":"contains","source":10628,"target":2036},{"edgeType":"contains","source":13411,"target":13009},{"edgeType":"contains","source":2759,"target":2862},{"edgeType":"contains","source":3158,"target":3177},{"edgeType":"contains","source":8773,"target":8804},{"edgeType":"contains","source":7254,"target":7271},{"edgeType":"contains","source":9434,"target":9454},{"edgeType":"imports","source":14661,"target":14624},{"edgeType":"contains","source":16238,"target":16275},{"edgeType":"calls","source":6872,"target":6370},{"edgeType":"contains","source":11680,"target":11686},{"edgeType":"contains","source":1,"target":14339},{"edgeType":"contains","source":4330,"target":4871},{"edgeType":"contains","source":5662,"target":5862},{"edgeType":"calls","source":6678,"target":6042},{"edgeType":"calls","source":8244,"target":8233},{"edgeType":"contains","source":12271,"target":12391},{"edgeType":"contains","source":6125,"target":6308},{"edgeType":"contains","source":11680,"target":11687},{"edgeType":"contains","source":10291,"target":10350},{"edgeType":"contains","source":14058,"target":14077},{"edgeType":"calls","source":3159,"target":3085},{"edgeType":"contains","source":5199,"target":5414},{"edgeType":"contains","source":5019,"target":4652},{"edgeType":"calls","source":11744,"target":11782},{"edgeType":"imports","source":12907,"target":3523},{"edgeType":"contains","source":13203,"target":13096},{"edgeType":"contains","source":8108,"target":8259},{"edgeType":"calls","source":11744,"target":11779},{"edgeType":"calls","source":646,"target":653},{"edgeType":"contains","source":11680,"target":11684},{"edgeType":"contains","source":16238,"target":16263},{"edgeType":"calls","source":12826,"target":3606},{"edgeType":"imports","source":2621,"target":1043},{"edgeType":"contains","source":4330,"target":4869},{"edgeType":"contains","source":12271,"target":12390},{"edgeType":"contains","source":12007,"target":12118},{"edgeType":"contains","source":11812,"target":11821},{"edgeType":"calls","source":8442,"target":8441},{"edgeType":"contains","source":15312,"target":4801},{"edgeType":"contains","source":11680,"target":11685},{"edgeType":"contains","source":6671,"target":6297},{"edgeType":"imports","source":2621,"target":1042},{"edgeType":"calls","source":6670,"target":6293},{"edgeType":"contains","source":16165,"target":16411},{"edgeType":"calls","source":5323,"target":1533},{"edgeType":"contains","source":12271,"target":12389},{"edgeType":"contains","source":5662,"target":5865},{"edgeType":"contains","source":11812,"target":11820},{"edgeType":"contains","source":1167,"target":1448},{"edgeType":"contains","source":5470,"target":5475},{"edgeType":"calls","source":4478,"target":4474},{"edgeType":"contains","source":1375,"target":3456},{"edgeType":"calls","source":8904,"target":8919},{"edgeType":"contains","source":4545,"target":4553},{"edgeType":"contains","source":12271,"target":12388},{"edgeType":"calls","source":14653,"target":14626},{"edgeType":"contains","source":6593,"target":6594},{"edgeType":"contains","source":7913,"target":7956},{"edgeType":"contains","source":3685,"target":3730},{"edgeType":"contains","source":5662,"target":5858},{"edgeType":"contains","source":11812,"target":11819},{"edgeType":"calls","source":778,"target":783},{"edgeType":"contains","source":11680,"target":11683},{"edgeType":"contains","source":4545,"target":4552},{"edgeType":"contains","source":6593,"target":6595},{"edgeType":"contains","source":12271,"target":12387},{"edgeType":"contains","source":8641,"target":8642},{"edgeType":"contains","source":7913,"target":7955},{"edgeType":"calls","source":14369,"target":2288},{"edgeType":"calls","source":713,"target":683},{"edgeType":"contains","source":11812,"target":11818},{"edgeType":"contains","source":9696,"target":9765},{"edgeType":"contains","source":3488,"target":3494},{"edgeType":"calls","source":16367,"target":16453},{"edgeType":"contains","source":12271,"target":12386},{"edgeType":"contains","source":6593,"target":6596},{"edgeType":"contains","source":4330,"target":4873},{"edgeType":"calls","source":14925,"target":14645},{"edgeType":"calls","source":6333,"target":6173},{"edgeType":"contains","source":1410,"target":2374},{"edgeType":"contains","source":5662,"target":5860},{"edgeType":"contains","source":5658,"target":5984},{"edgeType":"contains","source":3157,"target":3182},{"edgeType":"contains","source":9696,"target":9762},{"edgeType":"contains","source":3356,"target":3357},{"edgeType":"contains","source":11852,"target":6347},{"edgeType":"calls","source":14016,"target":2660},{"edgeType":"contains","source":10353,"target":10536},{"edgeType":"contains","source":12274,"target":12292},{"edgeType":"contains","source":12271,"target":12385},{"edgeType":"calls","source":3817,"target":3821},{"edgeType":"calls","source":5799,"target":5800},{"edgeType":"contains","source":251,"target":252},{"edgeType":"contains","source":3685,"target":3727},{"edgeType":"calls","source":1968,"target":1947},{"edgeType":"calls","source":9300,"target":9329},{"edgeType":"contains","source":11937,"target":12169},{"edgeType":"contains","source":14256,"target":14288},{"edgeType":"contains","source":11812,"target":11816},{"edgeType":"calls","source":15595,"target":15017},{"edgeType":"contains","source":5206,"target":5207},{"edgeType":"contains","source":15525,"target":15100},{"edgeType":"calls","source":7058,"target":6955},{"edgeType":"contains","source":8839,"target":8859},{"edgeType":"calls","source":6941,"target":2126},{"edgeType":"contains","source":9235,"target":9267},{"edgeType":"contains","source":11226,"target":10971},{"edgeType":"contains","source":3685,"target":3733},{"edgeType":"calls","source":8020,"target":388},{"edgeType":"contains","source":9235,"target":9266},{"edgeType":"imports","source":2621,"target":1052},{"edgeType":"contains","source":11937,"target":12182},{"edgeType":"calls","source":2694,"target":2690},{"edgeType":"contains","source":9696,"target":9774},{"edgeType":"contains","source":5470,"target":5482},{"edgeType":"contains","source":3685,"target":3732},{"edgeType":"calls","source":3354,"target":3370},{"edgeType":"contains","source":10293,"target":10294},{"edgeType":"calls","source":11744,"target":11787},{"edgeType":"calls","source":3159,"target":3073},{"edgeType":"contains","source":15401,"target":14718},{"edgeType":"contains","source":11412,"target":11545},{"edgeType":"calls","source":8111,"target":8140},{"edgeType":"calls","source":8905,"target":8893},{"edgeType":"calls","source":15603,"target":14781},{"edgeType":"contains","source":11937,"target":12181},{"edgeType":"calls","source":1902,"target":1875},{"edgeType":"contains","source":5662,"target":5873},{"edgeType":"calls","source":14653,"target":14627},{"edgeType":"calls","source":4102,"target":3438},{"edgeType":"calls","source":9037,"target":9030},{"edgeType":"imports","source":14871,"target":8168},{"edgeType":"calls","source":15530,"target":2246},{"edgeType":"imports","source":13683,"target":601},{"edgeType":"contains","source":5074,"target":5075},{"edgeType":"contains","source":14983,"target":14994},{"edgeType":"contains","source":7517,"target":7555},{"edgeType":"contains","source":10291,"target":10353},{"edgeType":"imports","source":14871,"target":8162},{"edgeType":"contains","source":6259,"target":6385},{"edgeType":"contains","source":11937,"target":12180},{"edgeType":"imports","source":15251,"target":611},{"edgeType":"calls","source":5607,"target":5404},{"edgeType":"calls","source":11744,"target":11793},{"edgeType":"contains","source":16632,"target":16728},{"edgeType":"calls","source":11019,"target":11014},{"edgeType":"imports","source":13932,"target":1331},{"edgeType":"contains","source":9434,"target":9436},{"edgeType":"calls","source":8641,"target":8623},{"edgeType":"contains","source":3157,"target":3194},{"edgeType":"calls","source":14059,"target":14021},{"edgeType":"contains","source":11937,"target":12179},{"edgeType":"contains","source":53,"target":54},{"edgeType":"contains","source":9696,"target":9773},{"edgeType":"calls","source":3159,"target":3072},{"edgeType":"imports","source":3298,"target":3315},{"edgeType":"imports","source":2721,"target":61},{"edgeType":"contains","source":7517,"target":7557},{"edgeType":"contains","source":5404,"target":5413},{"edgeType":"contains","source":11680,"target":11688},{"edgeType":"imports","source":1779,"target":1780},{"edgeType":"contains","source":11937,"target":12178},{"edgeType":"contains","source":10522,"target":1076},{"edgeType":"contains","source":53,"target":57},{"edgeType":"calls","source":15579,"target":15520},{"edgeType":"calls","source":8938,"target":1532},{"edgeType":"contains","source":5941,"target":5676},{"edgeType":"calls","source":646,"target":640},{"edgeType":"contains","source":53,"target":56},{"edgeType":"contains","source":5662,"target":5869},{"edgeType":"contains","source":9696,"target":9771},{"edgeType":"contains","source":10628,"target":2020},{"edgeType":"calls","source":975,"target":1011},{"edgeType":"calls","source":4480,"target":4431},{"edgeType":"contains","source":16632,"target":16715},{"edgeType":"calls","source":2373,"target":2097},{"edgeType":"contains","source":12274,"target":12283},{"edgeType":"contains","source":6259,"target":6365},{"edgeType":"contains","source":4280,"target":4291},{"edgeType":"contains","source":2223,"target":2521},{"edgeType":"calls","source":5001,"target":3079},{"edgeType":"contains","source":10522,"target":1058},{"edgeType":"calls","source":9367,"target":9343},{"edgeType":"contains","source":16632,"target":16714},{"edgeType":"contains","source":7711,"target":7862},{"edgeType":"imports","source":1375,"target":1600},{"edgeType":"contains","source":13067,"target":13068},{"edgeType":"contains","source":13197,"target":13266},{"edgeType":"contains","source":12274,"target":12282},{"edgeType":"calls","source":9170,"target":9108},{"edgeType":"contains","source":5932,"target":5933},{"edgeType":"contains","source":4280,"target":4290},{"edgeType":"contains","source":1,"target":14321},{"edgeType":"contains","source":6540,"target":6111},{"edgeType":"calls","source":3159,"target":3101},{"edgeType":"calls","source":4611,"target":4596},{"edgeType":"contains","source":16632,"target":16717},{"edgeType":"contains","source":5662,"target":5847},{"edgeType":"imports","source":16164,"target":12473},{"edgeType":"contains","source":14983,"target":14984},{"edgeType":"contains","source":15318,"target":2484},{"edgeType":"calls","source":184,"target":193},{"edgeType":"contains","source":6064,"target":6070},{"edgeType":"calls","source":6855,"target":6883},{"edgeType":"contains","source":4280,"target":4289},{"edgeType":"contains","source":10754,"target":10776},{"edgeType":"contains","source":14058,"target":14062},{"edgeType":"contains","source":5932,"target":5934},{"edgeType":"calls","source":1109,"target":1115},{"edgeType":"contains","source":12274,"target":12281},{"edgeType":"contains","source":16632,"target":16716},{"edgeType":"contains","source":12204,"target":3879},{"edgeType":"calls","source":6470,"target":6134},{"edgeType":"contains","source":11412,"target":11520},{"edgeType":"contains","source":14983,"target":14985},{"edgeType":"contains","source":9235,"target":9244},{"edgeType":"calls","source":1449,"target":1144},{"edgeType":"contains","source":6064,"target":6071},{"edgeType":"contains","source":4874,"target":4900},{"edgeType":"imports","source":13869,"target":1169},{"edgeType":"contains","source":14492,"target":9065},{"edgeType":"contains","source":4070,"target":4456},{"edgeType":"contains","source":2223,"target":2520},{"edgeType":"contains","source":12274,"target":12280},{"edgeType":"contains","source":9235,"target":9239},{"edgeType":"calls","source":3159,"target":3096},{"edgeType":"contains","source":11937,"target":12155},{"edgeType":"contains","source":3157,"target":3168},{"edgeType":"contains","source":7711,"target":7859},{"edgeType":"contains","source":14983,"target":14986},{"edgeType":"calls","source":4929,"target":1079},{"edgeType":"contains","source":10754,"target":10774},{"edgeType":"contains","source":12274,"target":12279},{"edgeType":"contains","source":12271,"target":12372},{"edgeType":"contains","source":16632,"target":16718},{"edgeType":"contains","source":9235,"target":9238},{"edgeType":"calls","source":1175,"target":1176},{"edgeType":"contains","source":5662,"target":5842},{"edgeType":"calls","source":15711,"target":15630},{"edgeType":"calls","source":8046,"target":8018},{"edgeType":"imports","source":13217,"target":12919},{"edgeType":"contains","source":6064,"target":6065},{"edgeType":"contains","source":10754,"target":10775},{"edgeType":"contains","source":12274,"target":12278},{"edgeType":"contains","source":10658,"target":5295},{"edgeType":"contains","source":4280,"target":4294},{"edgeType":"contains","source":12761,"target":3523},{"edgeType":"contains","source":5939,"target":5712},{"edgeType":"contains","source":1063,"target":433},{"edgeType":"contains","source":5199,"target":5401},{"edgeType":"contains","source":7711,"target":7861},{"edgeType":"imports","source":9090,"target":1331},{"edgeType":"contains","source":10292,"target":10296},{"edgeType":"calls","source":8904,"target":8905},{"edgeType":"contains","source":6064,"target":6066},{"edgeType":"contains","source":12274,"target":12277},{"edgeType":"contains","source":4280,"target":4293},{"edgeType":"contains","source":9301,"target":9308},{"edgeType":"contains","source":7711,"target":7860},{"edgeType":"calls","source":448,"target":460},{"edgeType":"calls","source":2100,"target":2099},{"edgeType":"contains","source":10160,"target":10161},{"edgeType":"contains","source":12274,"target":12276},{"edgeType":"contains","source":10754,"target":10773},{"edgeType":"calls","source":14854,"target":14717},{"edgeType":"imports","source":9529,"target":2510},{"edgeType":"calls","source":15107,"target":540},{"edgeType":"contains","source":12274,"target":12291},{"edgeType":"calls","source":11744,"target":11773},{"edgeType":"contains","source":4805,"target":4937},{"edgeType":"contains","source":8773,"target":8775},{"edgeType":"calls","source":2298,"target":2300},{"edgeType":"contains","source":5199,"target":5407},{"edgeType":"contains","source":11812,"target":11815},{"edgeType":"imports","source":10832,"target":2285},{"edgeType":"imports","source":14133,"target":14116},{"edgeType":"contains","source":16630,"target":16769},{"edgeType":"contains","source":16632,"target":16707},{"edgeType":"calls","source":5403,"target":5406},{"edgeType":"calls","source":16178,"target":5394},{"edgeType":"contains","source":4805,"target":4936},{"edgeType":"calls","source":15184,"target":15067},{"edgeType":"contains","source":15379,"target":15383},{"edgeType":"contains","source":13526,"target":13645},{"edgeType":"contains","source":1,"target":14329},{"edgeType":"imports","source":3298,"target":3303},{"edgeType":"calls","source":6889,"target":5836},{"edgeType":"contains","source":14256,"target":14257},{"edgeType":"contains","source":5662,"target":5855},{"edgeType":"contains","source":11812,"target":11814},{"edgeType":"contains","source":9696,"target":9761},{"edgeType":"contains","source":10291,"target":10339},{"edgeType":"imports","source":14661,"target":14662},{"edgeType":"calls","source":16631,"target":16721},{"edgeType":"contains","source":8773,"target":8777},{"edgeType":"contains","source":15379,"target":15384},{"edgeType":"contains","source":5199,"target":5405},{"edgeType":"contains","source":12274,"target":12289},{"edgeType":"calls","source":5535,"target":5541},{"edgeType":"contains","source":16632,"target":16709},{"edgeType":"contains","source":11812,"target":11813},{"edgeType":"calls","source":6634,"target":1058},{"edgeType":"imports","source":5871,"target":5976},{"edgeType":"calls","source":5535,"target":5540},{"edgeType":"imports","source":12759,"target":12316},{"edgeType":"calls","source":14060,"target":13967},{"edgeType":"contains","source":7054,"target":7100},{"edgeType":"contains","source":7913,"target":7953},{"edgeType":"contains","source":16632,"target":16708},{"edgeType":"calls","source":1524,"target":925},{"edgeType":"contains","source":5659,"target":5950},{"edgeType":"contains","source":696,"target":1246},{"edgeType":"calls","source":5535,"target":5539},{"edgeType":"contains","source":5662,"target":5849},{"edgeType":"contains","source":9301,"target":9315},{"edgeType":"calls","source":1110,"target":1070},{"edgeType":"calls","source":15527,"target":14999},{"edgeType":"contains","source":13526,"target":13642},{"edgeType":"contains","source":12274,"target":12287},{"edgeType":"contains","source":16632,"target":16711},{"edgeType":"calls","source":2034,"target":2022},{"edgeType":"imports","source":4612,"target":612},{"edgeType":"calls","source":14520,"target":14512},{"edgeType":"calls","source":5535,"target":5538},{"edgeType":"calls","source":8904,"target":8910},{"edgeType":"contains","source":9362,"target":9537},{"edgeType":"contains","source":7054,"target":7094},{"edgeType":"calls","source":3762,"target":3422},{"edgeType":"contains","source":13526,"target":13641},{"edgeType":"contains","source":16632,"target":16710},{"edgeType":"contains","source":13754,"target":12915},{"edgeType":"calls","source":10794,"target":1061},{"edgeType":"calls","source":7781,"target":7786},{"edgeType":"calls","source":5535,"target":5537},{"edgeType":"contains","source":16632,"target":16713},{"edgeType":"contains","source":11412,"target":11523},{"edgeType":"contains","source":8839,"target":8841},{"edgeType":"contains","source":5199,"target":5409},{"edgeType":"contains","source":12274,"target":12285},{"edgeType":"calls","source":2562,"target":2566},{"edgeType":"contains","source":7782,"target":7783},{"edgeType":"contains","source":10522,"target":1060},{"edgeType":"imports","source":14502,"target":9017},{"edgeType":"contains","source":6259,"target":6372},{"edgeType":"contains","source":5662,"target":5852},{"edgeType":"calls","source":4946,"target":540},{"edgeType":"contains","source":16630,"target":16774},{"edgeType":"contains","source":16632,"target":16712},{"edgeType":"calls","source":15119,"target":14966},{"edgeType":"contains","source":13001,"target":13002},{"edgeType":"contains","source":12274,"target":12284},{"edgeType":"contains","source":10291,"target":10336},{"edgeType":"contains","source":10522,"target":1061},{"edgeType":"imports","source":10832,"target":2286},{"edgeType":"contains","source":13349,"target":13295},{"edgeType":"contains","source":15401,"target":15220},{"edgeType":"contains","source":10658,"target":10038},{"edgeType":"contains","source":16845,"target":16966},{"edgeType":"contains","source":9053,"target":9055},{"edgeType":"imports","source":16165,"target":16454},{"edgeType":"contains","source":3488,"target":3986},{"edgeType":"contains","source":15065,"target":15066},{"edgeType":"contains","source":15064,"target":15097},{"edgeType":"contains","source":2,"target":5},{"edgeType":"contains","source":12288,"target":12361},{"edgeType":"calls","source":4468,"target":658},{"edgeType":"contains","source":1982,"target":2048},{"edgeType":"imports","source":5659,"target":5999},{"edgeType":"contains","source":12419,"target":12528},{"edgeType":"contains","source":10550,"target":702},{"edgeType":"calls","source":12118,"target":286},{"edgeType":"contains","source":398,"target":412},{"edgeType":"calls","source":1508,"target":1510},{"edgeType":"contains","source":200,"target":208},{"edgeType":"contains","source":5023,"target":5024},{"edgeType":"contains","source":11431,"target":11445},{"edgeType":"contains","source":15065,"target":15067},{"edgeType":"contains","source":2,"target":4},{"edgeType":"contains","source":9754,"target":4235},{"edgeType":"contains","source":12288,"target":12360},{"edgeType":"contains","source":12907,"target":14311},{"edgeType":"contains","source":11657,"target":6553},{"edgeType":"contains","source":13611,"target":13628},{"edgeType":"calls","source":4416,"target":4383},{"edgeType":"contains","source":1982,"target":2049},{"edgeType":"contains","source":5948,"target":5949},{"edgeType":"contains","source":12419,"target":12527},{"edgeType":"imports","source":7719,"target":1331},{"edgeType":"contains","source":4692,"target":4714},{"edgeType":"imports","source":11679,"target":3303},{"edgeType":"contains","source":3107,"target":3110},{"edgeType":"contains","source":200,"target":211},{"edgeType":"calls","source":14696,"target":702},{"edgeType":"contains","source":1982,"target":2045},{"edgeType":"contains","source":11184,"target":12757},{"edgeType":"contains","source":15065,"target":15068},{"edgeType":"calls","source":3160,"target":3149},{"edgeType":"contains","source":14206,"target":14214},{"edgeType":"contains","source":15758,"target":14725},{"edgeType":"contains","source":1982,"target":2046},{"edgeType":"contains","source":12907,"target":14310},{"edgeType":"calls","source":11362,"target":8922},{"edgeType":"contains","source":2,"target":7},{"edgeType":"contains","source":8713,"target":9026},{"edgeType":"calls","source":9391,"target":2376},{"edgeType":"calls","source":15184,"target":15176},{"edgeType":"contains","source":2511,"target":2559},{"edgeType":"contains","source":2510,"target":2590},{"edgeType":"contains","source":12419,"target":12526},{"edgeType":"calls","source":15715,"target":15628},{"edgeType":"contains","source":200,"target":210},{"edgeType":"contains","source":11431,"target":11443},{"edgeType":"contains","source":9053,"target":9056},{"edgeType":"imports","source":10522,"target":1115},{"edgeType":"contains","source":13611,"target":13626},{"edgeType":"contains","source":7006,"target":6978},{"edgeType":"calls","source":1062,"target":540},{"edgeType":"calls","source":6756,"target":5840},{"edgeType":"calls","source":2462,"target":1534},{"edgeType":"contains","source":14206,"target":14215},{"edgeType":"calls","source":8456,"target":8105},{"edgeType":"contains","source":1982,"target":2047},{"edgeType":"contains","source":2,"target":6},{"edgeType":"contains","source":12158,"target":12160},{"edgeType":"contains","source":12151,"target":12377},{"edgeType":"contains","source":398,"target":414},{"edgeType":"contains","source":2511,"target":2560},{"edgeType":"contains","source":200,"target":213},{"edgeType":"contains","source":15130,"target":15169},{"edgeType":"contains","source":11184,"target":12755},{"edgeType":"calls","source":5424,"target":615},{"edgeType":"contains","source":1982,"target":2052},{"edgeType":"contains","source":2,"target":9},{"edgeType":"contains","source":2511,"target":2565},{"edgeType":"contains","source":12158,"target":12159},{"edgeType":"contains","source":12151,"target":12376},{"edgeType":"contains","source":398,"target":417},{"edgeType":"calls","source":5690,"target":2938},{"edgeType":"calls","source":8119,"target":7985},{"edgeType":"contains","source":200,"target":212},{"edgeType":"calls","source":3697,"target":3414},{"edgeType":"contains","source":13215,"target":13216},{"edgeType":"contains","source":11184,"target":12756},{"edgeType":"contains","source":11431,"target":11441},{"edgeType":"calls","source":3160,"target":3148},{"edgeType":"calls","source":1874,"target":730},{"edgeType":"imports","source":16165,"target":16451},{"edgeType":"contains","source":1982,"target":2053},{"edgeType":"calls","source":14955,"target":7476},{"edgeType":"contains","source":2,"target":8},{"edgeType":"calls","source":1798,"target":972},{"edgeType":"imports","source":5659,"target":6002},{"edgeType":"contains","source":13148,"target":13178},{"edgeType":"contains","source":11303,"target":610},{"edgeType":"contains","source":12151,"target":12375},{"edgeType":"imports","source":8906,"target":8937},{"edgeType":"contains","source":10426,"target":10885},{"edgeType":"contains","source":200,"target":215},{"edgeType":"contains","source":11431,"target":11438},{"edgeType":"calls","source":10400,"target":698},{"edgeType":"contains","source":11184,"target":12753},{"edgeType":"contains","source":1982,"target":2050},{"edgeType":"calls","source":9766,"target":9781},{"edgeType":"contains","source":9642,"target":9820},{"edgeType":"calls","source":7018,"target":6178},{"edgeType":"contains","source":2510,"target":2594},{"edgeType":"contains","source":398,"target":419},{"edgeType":"contains","source":2,"target":11},{"edgeType":"contains","source":13287,"target":13096},{"edgeType":"calls","source":8644,"target":8623},{"edgeType":"contains","source":11184,"target":12754},{"edgeType":"contains","source":11431,"target":11439},{"edgeType":"contains","source":13611,"target":13622},{"edgeType":"contains","source":8906,"target":9380},{"edgeType":"contains","source":6080,"target":6083},{"edgeType":"imports","source":5659,"target":6004},{"edgeType":"contains","source":398,"target":418},{"edgeType":"calls","source":13542,"target":540},{"edgeType":"contains","source":12949,"target":13003},{"edgeType":"contains","source":2511,"target":2564},{"edgeType":"contains","source":2,"target":10},{"edgeType":"calls","source":2378,"target":2020},{"edgeType":"calls","source":3629,"target":3403},{"edgeType":"contains","source":4296,"target":4315},{"edgeType":"calls","source":14873,"target":14252},{"edgeType":"imports","source":10426,"target":10428},{"edgeType":"contains","source":12888,"target":4339},{"edgeType":"imports","source":5430,"target":4632},{"edgeType":"calls","source":9042,"target":8973},{"edgeType":"calls","source":14745,"target":5535},{"edgeType":"contains","source":2511,"target":2569},{"edgeType":"contains","source":2,"target":13},{"edgeType":"contains","source":398,"target":421},{"edgeType":"contains","source":11894,"target":11899},{"edgeType":"contains","source":5816,"target":5820},{"edgeType":"contains","source":5871,"target":6229},{"edgeType":"calls","source":10175,"target":9788},{"edgeType":"imports","source":9754,"target":10118},{"edgeType":"contains","source":4296,"target":4314},{"edgeType":"calls","source":2988,"target":2134},{"edgeType":"contains","source":8789,"target":8790},{"edgeType":"contains","source":8906,"target":9391},{"edgeType":"calls","source":6331,"target":6337},{"edgeType":"contains","source":15525,"target":15597},{"edgeType":"calls","source":10070,"target":358},{"edgeType":"contains","source":3310,"target":3170},{"edgeType":"contains","source":9534,"target":8949},{"edgeType":"contains","source":12150,"target":12418},{"edgeType":"contains","source":2511,"target":2570},{"edgeType":"contains","source":2,"target":12},{"edgeType":"contains","source":11894,"target":11898},{"edgeType":"contains","source":5684,"target":5685},{"edgeType":"contains","source":13611,"target":13636},{"edgeType":"contains","source":1982,"target":2057},{"edgeType":"contains","source":4296,"target":4313},{"edgeType":"imports","source":5659,"target":5992},{"edgeType":"contains","source":8906,"target":9394},{"edgeType":"contains","source":13215,"target":13227},{"edgeType":"contains","source":15525,"target":15598},{"edgeType":"calls","source":4678,"target":4708},{"edgeType":"imports","source":12821,"target":12293},{"edgeType":"contains","source":2511,"target":2567},{"edgeType":"contains","source":398,"target":423},{"edgeType":"contains","source":3768,"target":3769},{"edgeType":"contains","source":1982,"target":2054},{"edgeType":"contains","source":11894,"target":11897},{"edgeType":"contains","source":5684,"target":5686},{"edgeType":"contains","source":5671,"target":6089},{"edgeType":"contains","source":2,"target":15},{"edgeType":"calls","source":7260,"target":7136},{"edgeType":"contains","source":10435,"target":10616},{"edgeType":"contains","source":16845,"target":16959},{"edgeType":"calls","source":6331,"target":6339},{"edgeType":"contains","source":12949,"target":13016},{"edgeType":"contains","source":15525,"target":15599},{"edgeType":"contains","source":15401,"target":15215},{"edgeType":"contains","source":11431,"target":11451},{"edgeType":"contains","source":398,"target":422},{"edgeType":"imports","source":12378,"target":658},{"edgeType":"contains","source":2511,"target":2568},{"edgeType":"calls","source":14955,"target":7478},{"edgeType":"contains","source":14206,"target":14207},{"edgeType":"contains","source":11894,"target":11896},{"edgeType":"contains","source":1982,"target":2055},{"edgeType":"calls","source":2562,"target":540},{"edgeType":"contains","source":5816,"target":5823},{"edgeType":"contains","source":2,"target":14},{"edgeType":"contains","source":5684,"target":5687},{"edgeType":"contains","source":5671,"target":6090},{"edgeType":"contains","source":11232,"target":11275},{"edgeType":"contains","source":16845,"target":16962},{"edgeType":"contains","source":12949,"target":13015},{"edgeType":"calls","source":10030,"target":10060},{"edgeType":"calls","source":14474,"target":13940},{"edgeType":"contains","source":2511,"target":2573},{"edgeType":"contains","source":12150,"target":12415},{"edgeType":"contains","source":1982,"target":2060},{"edgeType":"calls","source":15527,"target":15115},{"edgeType":"contains","source":5948,"target":5952},{"edgeType":"calls","source":2965,"target":2842},{"edgeType":"contains","source":2,"target":17},{"edgeType":"contains","source":11894,"target":11895},{"edgeType":"contains","source":13215,"target":13224},{"edgeType":"contains","source":12419,"target":12531},{"edgeType":"contains","source":10435,"target":10614},{"edgeType":"contains","source":2511,"target":2575},{"edgeType":"calls","source":5802,"target":5800},{"edgeType":"contains","source":13611,"target":13632},{"edgeType":"contains","source":2511,"target":2574},{"edgeType":"contains","source":12288,"target":12364},{"edgeType":"contains","source":9642,"target":9825},{"edgeType":"contains","source":11431,"target":11449},{"edgeType":"contains","source":1982,"target":2061},{"edgeType":"contains","source":2,"target":16},{"edgeType":"calls","source":15606,"target":2097},{"edgeType":"imports","source":5659,"target":5994},{"edgeType":"imports","source":10426,"target":10430},{"edgeType":"contains","source":2,"target":19},{"edgeType":"contains","source":14668,"target":14686},{"edgeType":"contains","source":8463,"target":8324},{"edgeType":"contains","source":13611,"target":13631},{"edgeType":"contains","source":2511,"target":2571},{"edgeType":"contains","source":15064,"target":15094},{"edgeType":"contains","source":12949,"target":13012},{"edgeType":"contains","source":11497,"target":11514},{"edgeType":"contains","source":1982,"target":2058},{"edgeType":"contains","source":5816,"target":5818},{"edgeType":"contains","source":12419,"target":12530},{"edgeType":"contains","source":1586,"target":1650},{"edgeType":"calls","source":9040,"target":9041},{"edgeType":"contains","source":12150,"target":12413},{"edgeType":"imports","source":5659,"target":5997},{"edgeType":"calls","source":15121,"target":15019},{"edgeType":"calls","source":11087,"target":11117},{"edgeType":"contains","source":16127,"target":15968},{"edgeType":"contains","source":2,"target":18},{"edgeType":"contains","source":4296,"target":4316},{"edgeType":"contains","source":10658,"target":10041},{"edgeType":"contains","source":595,"target":662},{"edgeType":"contains","source":987,"target":1194},{"edgeType":"calls","source":13929,"target":13920},{"edgeType":"contains","source":15263,"target":15269},{"edgeType":"contains","source":398,"target":426},{"edgeType":"contains","source":2511,"target":2572},{"edgeType":"contains","source":12288,"target":12362},{"edgeType":"contains","source":11431,"target":11447},{"edgeType":"contains","source":11412,"target":12036},{"edgeType":"contains","source":11657,"target":6555},{"edgeType":"contains","source":13611,"target":13630},{"edgeType":"contains","source":12419,"target":12529},{"edgeType":"contains","source":1982,"target":2059},{"edgeType":"contains","source":5816,"target":5819},{"edgeType":"contains","source":9642,"target":9827},{"edgeType":"calls","source":14794,"target":12473},{"edgeType":"calls","source":2598,"target":1534},{"edgeType":"contains","source":12150,"target":12412},{"edgeType":"contains","source":9581,"target":9583},{"edgeType":"contains","source":10832,"target":10970},{"edgeType":"contains","source":1982,"target":2031},{"edgeType":"contains","source":13611,"target":13613},{"edgeType":"imports","source":15058,"target":4244},{"edgeType":"imports","source":5659,"target":5982},{"edgeType":"calls","source":1971,"target":1973},{"edgeType":"calls","source":3993,"target":600},{"edgeType":"contains","source":2511,"target":2545},{"edgeType":"contains","source":12151,"target":12363},{"edgeType":"contains","source":11959,"target":11973},{"edgeType":"contains","source":11184,"target":12742},{"edgeType":"calls","source":3034,"target":2846},{"edgeType":"calls","source":4944,"target":4945},{"edgeType":"contains","source":9581,"target":9582},{"edgeType":"contains","source":10832,"target":10971},{"edgeType":"contains","source":10836,"target":10847},{"edgeType":"calls","source":2530,"target":1558},{"edgeType":"contains","source":15525,"target":15589},{"edgeType":"calls","source":2040,"target":1947},{"edgeType":"contains","source":14206,"target":14196},{"edgeType":"contains","source":2511,"target":2546},{"edgeType":"calls","source":6199,"target":6206},{"edgeType":"contains","source":14661,"target":14890},{"edgeType":"contains","source":11184,"target":12743},{"edgeType":"contains","source":7680,"target":865},{"edgeType":"contains","source":10949,"target":11569},{"edgeType":"contains","source":12150,"target":12392},{"edgeType":"contains","source":5019,"target":5130},{"edgeType":"contains","source":2511,"target":2543},{"edgeType":"contains","source":398,"target":399},{"edgeType":"contains","source":3106,"target":3124},{"edgeType":"contains","source":2511,"target":2542},{"edgeType":"contains","source":15401,"target":15205},{"edgeType":"contains","source":5871,"target":6206},{"edgeType":"contains","source":16845,"target":16952},{"edgeType":"contains","source":11184,"target":12740},{"edgeType":"calls","source":4943,"target":4974},{"edgeType":"contains","source":8838,"target":9362},{"edgeType":"contains","source":1982,"target":2030},{"edgeType":"contains","source":9647,"target":9652},{"edgeType":"contains","source":801,"target":589},{"edgeType":"imports","source":9885,"target":8161},{"edgeType":"contains","source":2511,"target":2544},{"edgeType":"contains","source":4692,"target":4696},{"edgeType":"contains","source":5097,"target":4825},{"edgeType":"calls","source":2699,"target":2660},{"edgeType":"contains","source":14470,"target":14471},{"edgeType":"contains","source":3309,"target":3174},{"edgeType":"calls","source":8500,"target":4611},{"edgeType":"contains","source":11184,"target":12741},{"edgeType":"calls","source":11880,"target":11880},{"edgeType":"imports","source":5659,"target":5986},{"edgeType":"contains","source":10949,"target":11567},{"edgeType":"calls","source":2040,"target":1944},{"edgeType":"contains","source":9090,"target":1545},{"edgeType":"calls","source":2367,"target":264},{"edgeType":"contains","source":398,"target":401},{"edgeType":"contains","source":1586,"target":1627},{"edgeType":"contains","source":9249,"target":9300},{"edgeType":"contains","source":14470,"target":14472},{"edgeType":"contains","source":13286,"target":13113},{"edgeType":"contains","source":15064,"target":15084},{"edgeType":"contains","source":9643,"target":9770},{"edgeType":"calls","source":15801,"target":2369},{"edgeType":"imports","source":12152,"target":5535},{"edgeType":"contains","source":10949,"target":11568},{"edgeType":"contains","source":2511,"target":2550},{"edgeType":"calls","source":9445,"target":9142},{"edgeType":"imports","source":15452,"target":8937},{"edgeType":"contains","source":7201,"target":7252},{"edgeType":"imports","source":9838,"target":1169},{"edgeType":"contains","source":15683,"target":4352},{"edgeType":"contains","source":11184,"target":12739},{"edgeType":"contains","source":9643,"target":9769},{"edgeType":"imports","source":15843,"target":3162},{"edgeType":"contains","source":10426,"target":10865},{"edgeType":"calls","source":4680,"target":4666},{"edgeType":"contains","source":1982,"target":2033},{"edgeType":"contains","source":15401,"target":15210},{"edgeType":"contains","source":398,"target":403},{"edgeType":"contains","source":6740,"target":6746},{"edgeType":"contains","source":1719,"target":1730},{"edgeType":"calls","source":1255,"target":912},{"edgeType":"contains","source":1982,"target":2034},{"edgeType":"contains","source":15525,"target":15595},{"edgeType":"contains","source":10949,"target":11566},{"edgeType":"contains","source":9053,"target":9035},{"edgeType":"contains","source":2511,"target":2548},{"edgeType":"contains","source":6740,"target":6747},{"edgeType":"contains","source":15401,"target":15211},{"edgeType":"contains","source":11431,"target":11436},{"edgeType":"contains","source":11497,"target":11504},{"edgeType":"calls","source":3160,"target":3160},{"edgeType":"contains","source":2511,"target":2553},{"edgeType":"contains","source":12225,"target":12191},{"edgeType":"contains","source":1,"target":27},{"edgeType":"contains","source":11959,"target":11981},{"edgeType":"imports","source":12090,"target":11680},{"edgeType":"contains","source":9642,"target":9814},{"edgeType":"contains","source":200,"target":201},{"edgeType":"contains","source":7006,"target":6966},{"edgeType":"contains","source":16845,"target":16942},{"edgeType":"contains","source":14863,"target":14961},{"edgeType":"contains","source":11184,"target":12750},{"edgeType":"contains","source":12617,"target":12724},{"edgeType":"calls","source":14462,"target":14291},{"edgeType":"calls","source":8444,"target":8468},{"edgeType":"imports","source":8906,"target":8907},{"edgeType":"contains","source":5287,"target":5288},{"edgeType":"contains","source":11431,"target":11437},{"edgeType":"contains","source":9354,"target":8171},{"edgeType":"imports","source":14777,"target":2375},{"edgeType":"contains","source":2511,"target":2554},{"edgeType":"contains","source":15064,"target":15073},{"edgeType":"contains","source":11184,"target":12752},{"edgeType":"calls","source":15390,"target":15122},{"edgeType":"contains","source":11554,"target":11852},{"edgeType":"contains","source":398,"target":404},{"edgeType":"contains","source":11497,"target":11505},{"edgeType":"contains","source":1982,"target":2040},{"edgeType":"contains","source":4072,"target":4899},{"edgeType":"contains","source":16845,"target":16941},{"edgeType":"imports","source":5659,"target":5973},{"edgeType":"contains","source":11184,"target":12751},{"edgeType":"contains","source":6740,"target":6757},{"edgeType":"calls","source":15692,"target":1533},{"edgeType":"contains","source":5443,"target":4679},{"edgeType":"contains","source":2511,"target":2551},{"edgeType":"imports","source":1715,"target":1406},{"edgeType":"contains","source":398,"target":407},{"edgeType":"calls","source":1972,"target":1936},{"edgeType":"imports","source":15620,"target":7957},{"edgeType":"contains","source":13611,"target":13619},{"edgeType":"contains","source":14954,"target":7913},{"edgeType":"calls","source":2562,"target":2669},{"edgeType":"contains","source":4296,"target":4297},{"edgeType":"contains","source":10426,"target":10878},{"edgeType":"contains","source":5019,"target":5138},{"edgeType":"contains","source":11184,"target":12748},{"edgeType":"calls","source":2235,"target":2236},{"edgeType":"contains","source":6740,"target":6758},{"edgeType":"contains","source":11431,"target":11435},{"edgeType":"contains","source":12151,"target":12368},{"edgeType":"contains","source":398,"target":406},{"edgeType":"contains","source":2511,"target":2552},{"edgeType":"calls","source":6198,"target":6227},{"edgeType":"contains","source":200,"target":202},{"edgeType":"calls","source":15051,"target":15063},{"edgeType":"calls","source":13756,"target":2349},{"edgeType":"contains","source":16845,"target":16943},{"edgeType":"contains","source":11184,"target":12749},{"edgeType":"contains","source":3758,"target":4061},{"edgeType":"contains","source":8848,"target":9060},{"edgeType":"calls","source":12534,"target":10635},{"edgeType":"contains","source":6740,"target":6752},{"edgeType":"contains","source":2511,"target":2557},{"edgeType":"contains","source":398,"target":409},{"edgeType":"calls","source":6198,"target":6226},{"edgeType":"contains","source":11497,"target":11500},{"edgeType":"contains","source":5887,"target":5712},{"edgeType":"contains","source":5871,"target":6208},{"edgeType":"calls","source":9507,"target":9344},{"edgeType":"contains","source":14600,"target":14661},{"edgeType":"calls","source":10030,"target":10043},{"edgeType":"contains","source":11184,"target":12746},{"edgeType":"imports","source":10379,"target":9759},{"edgeType":"contains","source":13355,"target":13096},{"edgeType":"contains","source":4296,"target":4303},{"edgeType":"calls","source":6741,"target":6298},{"edgeType":"calls","source":2301,"target":2302},{"edgeType":"calls","source":15979,"target":15886},{"edgeType":"contains","source":8848,"target":9054},{"edgeType":"contains","source":398,"target":408},{"edgeType":"contains","source":1982,"target":2044},{"edgeType":"imports","source":3628,"target":3403},{"edgeType":"calls","source":3076,"target":1533},{"edgeType":"calls","source":1706,"target":1718},{"edgeType":"contains","source":11184,"target":12747},{"edgeType":"calls","source":11286,"target":11277},{"edgeType":"calls","source":13715,"target":3627},{"edgeType":"calls","source":2103,"target":2099},{"edgeType":"contains","source":13413,"target":13411},{"edgeType":"contains","source":7201,"target":7260},{"edgeType":"contains","source":987,"target":1175},{"edgeType":"contains","source":2511,"target":2555},{"edgeType":"calls","source":4081,"target":4200},{"edgeType":"contains","source":15064,"target":15078},{"edgeType":"imports","source":15581,"target":15504},{"edgeType":"calls","source":6203,"target":6069},{"edgeType":"calls","source":1251,"target":1028},{"edgeType":"contains","source":15758,"target":14705},{"edgeType":"contains","source":9775,"target":3575},{"edgeType":"contains","source":11184,"target":12744},{"edgeType":"contains","source":13288,"target":13057},{"edgeType":"contains","source":4230,"target":4233},{"edgeType":"contains","source":2,"target":3},{"edgeType":"calls","source":3688,"target":3698},{"edgeType":"calls","source":6674,"target":6263},{"edgeType":"calls","source":6662,"target":6635},{"edgeType":"contains","source":8326,"target":8327},{"edgeType":"contains","source":8527,"target":8438},{"edgeType":"contains","source":8906,"target":9373},{"edgeType":"calls","source":1535,"target":680},{"edgeType":"contains","source":801,"target":602},{"edgeType":"contains","source":398,"target":410},{"edgeType":"calls","source":14523,"target":14516},{"edgeType":"contains","source":2511,"target":2556},{"edgeType":"contains","source":4547,"target":4975},{"edgeType":"contains","source":10836,"target":10849},{"edgeType":"contains","source":11497,"target":11499},{"edgeType":"contains","source":4072,"target":4901},{"edgeType":"imports","source":16165,"target":16424},{"edgeType":"imports","source":5659,"target":5979},{"edgeType":"contains","source":11184,"target":12745},{"edgeType":"imports","source":10379,"target":9756},{"edgeType":"contains","source":4352,"target":4678},{"edgeType":"calls","source":4485,"target":2246},{"edgeType":"contains","source":14863,"target":14968},{"edgeType":"contains","source":662,"target":682},{"edgeType":"calls","source":14201,"target":9699},{"edgeType":"contains","source":13148,"target":13168},{"edgeType":"calls","source":2763,"target":2741},{"edgeType":"calls","source":3423,"target":3422},{"edgeType":"imports","source":15779,"target":15768},{"edgeType":"contains","source":7921,"target":8174},{"edgeType":"contains","source":13148,"target":13151},{"edgeType":"calls","source":6661,"target":6635},{"edgeType":"calls","source":7014,"target":6262},{"edgeType":"contains","source":6209,"target":6280},{"edgeType":"contains","source":8848,"target":9034},{"edgeType":"contains","source":133,"target":139},{"edgeType":"contains","source":9090,"target":1532},{"edgeType":"contains","source":8259,"target":8267},{"edgeType":"contains","source":12150,"target":12378},{"edgeType":"contains","source":5871,"target":6188},{"edgeType":"contains","source":11091,"target":11382},{"edgeType":"calls","source":6854,"target":653},{"edgeType":"contains","source":3488,"target":3952},{"edgeType":"calls","source":1310,"target":1273},{"edgeType":"calls","source":6947,"target":6226},{"edgeType":"contains","source":15064,"target":15065},{"edgeType":"contains","source":1,"target":2},{"edgeType":"calls","source":12075,"target":12157},{"edgeType":"contains","source":133,"target":138},{"edgeType":"contains","source":8061,"target":8062},{"edgeType":"contains","source":595,"target":614},{"edgeType":"contains","source":6209,"target":6281},{"edgeType":"contains","source":12420,"target":12463},{"edgeType":"contains","source":2511,"target":2529},{"edgeType":"calls","source":4083,"target":4103},{"edgeType":"contains","source":2511,"target":2526},{"edgeType":"contains","source":7921,"target":8176},{"edgeType":"contains","source":5159,"target":5002},{"edgeType":"contains","source":1196,"target":1013},{"edgeType":"calls","source":6601,"target":6383},{"edgeType":"imports","source":12617,"target":12316},{"edgeType":"contains","source":133,"target":141},{"edgeType":"contains","source":7921,"target":8177},{"edgeType":"contains","source":595,"target":617},{"edgeType":"contains","source":10961,"target":611},{"edgeType":"contains","source":7921,"target":8175},{"edgeType":"calls","source":6601,"target":6384},{"edgeType":"contains","source":1651,"target":1704},{"edgeType":"imports","source":2616,"target":998},{"edgeType":"contains","source":133,"target":140},{"edgeType":"contains","source":8061,"target":8064},{"edgeType":"contains","source":595,"target":616},{"edgeType":"calls","source":14060,"target":14041},{"edgeType":"contains","source":12420,"target":12461},{"edgeType":"contains","source":7921,"target":8170},{"edgeType":"contains","source":12152,"target":3855},{"edgeType":"calls","source":1670,"target":680},{"edgeType":"contains","source":11184,"target":12722},{"edgeType":"calls","source":6995,"target":6855},{"edgeType":"calls","source":6672,"target":6298},{"edgeType":"calls","source":12470,"target":12600},{"edgeType":"contains","source":1982,"target":2019},{"edgeType":"calls","source":10169,"target":1481},{"edgeType":"contains","source":2511,"target":2532},{"edgeType":"contains","source":8713,"target":8987},{"edgeType":"contains","source":12419,"target":12491},{"edgeType":"calls","source":12561,"target":3438},{"edgeType":"contains","source":1063,"target":909},{"edgeType":"contains","source":16845,"target":16936},{"edgeType":"contains","source":13357,"target":13009},{"edgeType":"calls","source":8576,"target":8582},{"edgeType":"contains","source":5671,"target":6042},{"edgeType":"contains","source":6209,"target":6277},{"edgeType":"contains","source":4072,"target":2765},{"edgeType":"contains","source":12419,"target":12490},{"edgeType":"imports","source":3292,"target":3295},{"edgeType":"contains","source":13152,"target":13021},{"edgeType":"calls","source":12012,"target":12000},{"edgeType":"contains","source":7201,"target":7237},{"edgeType":"contains","source":14997,"target":15033},{"edgeType":"calls","source":8576,"target":8585},{"edgeType":"contains","source":12420,"target":12458},{"edgeType":"contains","source":12419,"target":12489},{"edgeType":"imports","source":7919,"target":7853},{"edgeType":"contains","source":9090,"target":1530},{"edgeType":"contains","source":7003,"target":7032},{"edgeType":"contains","source":11306,"target":8937},{"edgeType":"imports","source":10949,"target":601},{"edgeType":"contains","source":12949,"target":12971},{"edgeType":"calls","source":2696,"target":2698},{"edgeType":"contains","source":1651,"target":1708},{"edgeType":"contains","source":13495,"target":12957},{"edgeType":"calls","source":4945,"target":4857},{"edgeType":"contains","source":11232,"target":11233},{"edgeType":"contains","source":6209,"target":6279},{"edgeType":"imports","source":1244,"target":1246},{"edgeType":"contains","source":12288,"target":12321},{"edgeType":"calls","source":2696,"target":2699},{"edgeType":"contains","source":10426,"target":10863},{"edgeType":"contains","source":11184,"target":12734},{"edgeType":"contains","source":15394,"target":15396},{"edgeType":"calls","source":16372,"target":16374},{"edgeType":"calls","source":5408,"target":5302},{"edgeType":"contains","source":5749,"target":5750},{"edgeType":"contains","source":14997,"target":15018},{"edgeType":"contains","source":9642,"target":9797},{"edgeType":"contains","source":6209,"target":6288},{"edgeType":"imports","source":980,"target":987},{"edgeType":"contains","source":15132,"target":2377},{"edgeType":"contains","source":10426,"target":10864},{"edgeType":"contains","source":6209,"target":6289},{"edgeType":"contains","source":11184,"target":12735},{"edgeType":"contains","source":6740,"target":6741},{"edgeType":"calls","source":1903,"target":1908},{"edgeType":"contains","source":15460,"target":15465},{"edgeType":"contains","source":8848,"target":9042},{"edgeType":"calls","source":10497,"target":10343},{"edgeType":"contains","source":1982,"target":2024},{"edgeType":"contains","source":6209,"target":6290},{"edgeType":"contains","source":10426,"target":10861},{"edgeType":"calls","source":10683,"target":352},{"edgeType":"contains","source":6740,"target":6742},{"edgeType":"calls","source":10427,"target":10402},{"edgeType":"contains","source":1982,"target":2021},{"edgeType":"imports","source":10244,"target":9759},{"edgeType":"contains","source":13424,"target":13057},{"edgeType":"contains","source":5749,"target":5752},{"edgeType":"contains","source":15132,"target":2379},{"edgeType":"contains","source":9643,"target":9768},{"edgeType":"contains","source":4120,"target":3394},{"edgeType":"contains","source":16845,"target":16926},{"edgeType":"contains","source":6209,"target":6291},{"edgeType":"contains","source":12706,"target":3603},{"edgeType":"calls","source":8576,"target":8588},{"edgeType":"calls","source":8649,"target":2097},{"edgeType":"contains","source":8906,"target":3018},{"edgeType":"contains","source":6740,"target":6743},{"edgeType":"contains","source":10836,"target":10837},{"edgeType":"contains","source":4691,"target":4718},{"edgeType":"contains","source":5871,"target":6199},{"edgeType":"imports","source":15800,"target":15109},{"edgeType":"imports","source":15779,"target":15760},{"edgeType":"contains","source":1982,"target":2022},{"edgeType":"calls","source":9173,"target":9108},{"edgeType":"calls","source":15297,"target":1079},{"edgeType":"contains","source":5671,"target":6049},{"edgeType":"calls","source":14925,"target":14717},{"edgeType":"calls","source":2233,"target":2246},{"edgeType":"calls","source":3818,"target":3849},{"edgeType":"calls","source":5801,"target":5799},{"edgeType":"contains","source":2511,"target":2540},{"edgeType":"calls","source":5571,"target":2358},{"edgeType":"imports","source":7919,"target":7847},{"edgeType":"contains","source":8848,"target":9038},{"edgeType":"contains","source":3106,"target":3122},{"edgeType":"contains","source":15064,"target":15059},{"edgeType":"contains","source":7921,"target":8179},{"edgeType":"contains","source":14661,"target":14868},{"edgeType":"calls","source":994,"target":487},{"edgeType":"contains","source":14668,"target":14652},{"edgeType":"calls","source":8576,"target":8590},{"edgeType":"contains","source":1244,"target":1651},{"edgeType":"contains","source":5034,"target":4662},{"edgeType":"contains","source":662,"target":664},{"edgeType":"contains","source":11345,"target":1398},{"edgeType":"contains","source":2511,"target":2541},{"edgeType":"contains","source":3106,"target":3123},{"edgeType":"calls","source":15913,"target":15801},{"edgeType":"calls","source":6269,"target":6088},{"edgeType":"contains","source":1982,"target":2028},{"edgeType":"contains","source":7921,"target":8178},{"edgeType":"calls","source":1059,"target":585},{"edgeType":"contains","source":5019,"target":5126},{"edgeType":"contains","source":4547,"target":4959},{"edgeType":"calls","source":3491,"target":3413},{"edgeType":"contains","source":2511,"target":2538},{"edgeType":"contains","source":1651,"target":1716},{"edgeType":"imports","source":7850,"target":7870},{"edgeType":"calls","source":1112,"target":1059},{"edgeType":"contains","source":8259,"target":8273},{"edgeType":"contains","source":7921,"target":8181},{"edgeType":"contains","source":1982,"target":2025},{"edgeType":"contains","source":15460,"target":15471},{"edgeType":"calls","source":14016,"target":619},{"edgeType":"contains","source":16845,"target":16930},{"edgeType":"calls","source":8444,"target":8456},{"edgeType":"contains","source":3106,"target":3121},{"edgeType":"contains","source":7070,"target":7079},{"edgeType":"contains","source":14997,"target":15025},{"edgeType":"calls","source":10429,"target":10343},{"edgeType":"calls","source":14948,"target":3438},{"edgeType":"calls","source":3491,"target":3414},{"edgeType":"contains","source":9642,"target":9794},{"edgeType":"contains","source":9643,"target":9763},{"edgeType":"contains","source":1982,"target":2026},{"edgeType":"contains","source":7921,"target":8180},{"edgeType":"calls","source":1197,"target":537},{"edgeType":"calls","source":1175,"target":1219},{"edgeType":"contains","source":12420,"target":12465},{"edgeType":"contains","source":5480,"target":5607},{"edgeType":"contains","source":2758,"target":3311},{"edgeType":"calls","source":5223,"target":4719},{"edgeType":"contains","source":15658,"target":15660},{"edgeType":"calls","source":2243,"target":1965},{"edgeType":"contains","source":2511,"target":2512},{"edgeType":"contains","source":6607,"target":6610},{"edgeType":"calls","source":6066,"target":6069},{"edgeType":"imports","source":13217,"target":12724},{"edgeType":"contains","source":14601,"target":14602},{"edgeType":"calls","source":15154,"target":13940},{"edgeType":"contains","source":1780,"target":1918},{"edgeType":"contains","source":1982,"target":1999},{"edgeType":"calls","source":16107,"target":16109},{"edgeType":"contains","source":2511,"target":2513},{"edgeType":"imports","source":8906,"target":8949},{"edgeType":"imports","source":15800,"target":15099},{"edgeType":"contains","source":7921,"target":8157},{"edgeType":"contains","source":14601,"target":14603},{"edgeType":"imports","source":15712,"target":15713},{"edgeType":"contains","source":1780,"target":1919},{"edgeType":"calls","source":10756,"target":10749},{"edgeType":"contains","source":7680,"target":832},{"edgeType":"contains","source":9642,"target":9775},{"edgeType":"contains","source":2643,"target":2646},{"edgeType":"contains","source":14075,"target":13997},{"edgeType":"contains","source":987,"target":1133},{"edgeType":"contains","source":8523,"target":8525},{"edgeType":"contains","source":7921,"target":8160},{"edgeType":"contains","source":14601,"target":14604},{"edgeType":"contains","source":1586,"target":1588},{"edgeType":"contains","source":7003,"target":7020},{"edgeType":"contains","source":14799,"target":14808},{"edgeType":"contains","source":1780,"target":1916},{"edgeType":"imports","source":7919,"target":7833},{"edgeType":"contains","source":7460,"target":7653},{"edgeType":"contains","source":11628,"target":11629},{"edgeType":"calls","source":6132,"target":6134},{"edgeType":"contains","source":8523,"target":8524},{"edgeType":"calls","source":2763,"target":2757},{"edgeType":"contains","source":14601,"target":14605},{"edgeType":"calls","source":15051,"target":15022},{"edgeType":"contains","source":14799,"target":14809},{"edgeType":"contains","source":3565,"target":3661},{"edgeType":"contains","source":1780,"target":1917},{"edgeType":"contains","source":11437,"target":11207},{"edgeType":"contains","source":7003,"target":7014},{"edgeType":"contains","source":14075,"target":13999},{"edgeType":"contains","source":14601,"target":14606},{"edgeType":"imports","source":15503,"target":3162},{"edgeType":"contains","source":7921,"target":8154},{"edgeType":"calls","source":2102,"target":2104},{"edgeType":"contains","source":987,"target":1135},{"edgeType":"contains","source":1780,"target":1922},{"edgeType":"contains","source":5219,"target":5245},{"edgeType":"contains","source":14799,"target":14810},{"edgeType":"contains","source":3565,"target":3668},{"edgeType":"contains","source":13268,"target":13638},{"edgeType":"contains","source":14997,"target":15014},{"edgeType":"calls","source":1111,"target":1112},{"edgeType":"imports","source":5659,"target":6018},{"edgeType":"calls","source":1970,"target":1966},{"edgeType":"contains","source":15460,"target":15461},{"edgeType":"contains","source":2511,"target":2517},{"edgeType":"contains","source":4427,"target":4428},{"edgeType":"contains","source":987,"target":1134},{"edgeType":"imports","source":10244,"target":9756},{"edgeType":"contains","source":3642,"target":3394},{"edgeType":"contains","source":1780,"target":1923},{"edgeType":"calls","source":9038,"target":9042},{"edgeType":"contains","source":6080,"target":6031},{"edgeType":"contains","source":3436,"target":3438},{"edgeType":"contains","source":14799,"target":14811},{"edgeType":"calls","source":15527,"target":15059},{"edgeType":"contains","source":14208,"target":3523},{"edgeType":"contains","source":1982,"target":2000},{"edgeType":"contains","source":16314,"target":16471},{"edgeType":"calls","source":6198,"target":6199},{"edgeType":"contains","source":2511,"target":2514},{"edgeType":"contains","source":6607,"target":6608},{"edgeType":"contains","source":14601,"target":14608},{"edgeType":"contains","source":15386,"target":9299},{"edgeType":"calls","source":715,"target":707},{"edgeType":"calls","source":4958,"target":2358},{"edgeType":"imports","source":980,"target":3070},{"edgeType":"contains","source":1780,"target":1920},{"edgeType":"contains","source":14997,"target":15016},{"edgeType":"contains","source":14799,"target":14812},{"edgeType":"calls","source":2562,"target":2641},{"edgeType":"imports","source":1244,"target":1230},{"edgeType":"contains","source":7003,"target":7017},{"edgeType":"contains","source":1982,"target":2001},{"edgeType":"contains","source":12288,"target":12304},{"edgeType":"contains","source":2511,"target":2515},{"edgeType":"contains","source":6607,"target":6609},{"edgeType":"contains","source":8906,"target":2989},{"edgeType":"contains","source":7921,"target":8155},{"edgeType":"calls","source":13003,"target":12971},{"edgeType":"contains","source":862,"target":783},{"edgeType":"calls","source":9126,"target":2088},{"edgeType":"calls","source":15602,"target":2165},{"edgeType":"calls","source":12144,"target":12118},{"edgeType":"contains","source":1780,"target":1921},{"edgeType":"imports","source":7919,"target":7838},{"edgeType":"imports","source":980,"target":3071},{"edgeType":"calls","source":9926,"target":2660},{"edgeType":"contains","source":1780,"target":1926},{"edgeType":"imports","source":14195,"target":14109},{"edgeType":"contains","source":9838,"target":1591},{"edgeType":"contains","source":4427,"target":4433},{"edgeType":"contains","source":13346,"target":13347},{"edgeType":"contains","source":1982,"target":2006},{"edgeType":"calls","source":849,"target":774},{"edgeType":"contains","source":128,"target":285},{"edgeType":"contains","source":7921,"target":8166},{"edgeType":"imports","source":5659,"target":6007},{"edgeType":"calls","source":4348,"target":4353},{"edgeType":"contains","source":12624,"target":12474},{"edgeType":"calls","source":6406,"target":6076},{"edgeType":"contains","source":1780,"target":1927},{"edgeType":"imports","source":1375,"target":1410},{"edgeType":"contains","source":4427,"target":4432},{"edgeType":"contains","source":7921,"target":8165},{"edgeType":"contains","source":14661,"target":14848},{"edgeType":"contains","source":10426,"target":10848},{"edgeType":"calls","source":15185,"target":2418},{"edgeType":"calls","source":10399,"target":680},{"edgeType":"imports","source":14835,"target":611},{"edgeType":"contains","source":5219,"target":5248},{"edgeType":"contains","source":1982,"target":2004},{"edgeType":"calls","source":7651,"target":7650},{"edgeType":"contains","source":1780,"target":1924},{"edgeType":"contains","source":11628,"target":11636},{"edgeType":"imports","source":7850,"target":7849},{"edgeType":"contains","source":14799,"target":14800},{"edgeType":"contains","source":11091,"target":11370},{"edgeType":"contains","source":5219,"target":5247},{"edgeType":"contains","source":1982,"target":2005},{"edgeType":"contains","source":2511,"target":2519},{"edgeType":"calls","source":6960,"target":5817},{"edgeType":"contains","source":1780,"target":1925},{"edgeType":"calls","source":13072,"target":12950},{"edgeType":"calls","source":4485,"target":4331},{"edgeType":"contains","source":7921,"target":8167},{"edgeType":"contains","source":9642,"target":9782},{"edgeType":"contains","source":13268,"target":13647},{"edgeType":"calls","source":2234,"target":2235},{"edgeType":"contains","source":6209,"target":6275},{"edgeType":"contains","source":12420,"target":12453},{"edgeType":"contains","source":16054,"target":16062},{"edgeType":"contains","source":5219,"target":5246},{"edgeType":"contains","source":13412,"target":13411},{"edgeType":"calls","source":3833,"target":3403},{"edgeType":"contains","source":987,"target":1140},{"edgeType":"contains","source":1982,"target":2010},{"edgeType":"imports","source":16218,"target":4244},{"edgeType":"contains","source":1651,"target":1701},{"edgeType":"calls","source":2961,"target":2949},{"edgeType":"contains","source":12420,"target":12452},{"edgeType":"calls","source":2366,"target":2368},{"edgeType":"contains","source":12949,"target":12965},{"edgeType":"contains","source":987,"target":1143},{"edgeType":"contains","source":5219,"target":5253},{"edgeType":"contains","source":2511,"target":2525},{"edgeType":"contains","source":11430,"target":11431},{"edgeType":"contains","source":11628,"target":11635},{"edgeType":"contains","source":15986,"target":16059},{"edgeType":"imports","source":5659,"target":6010},{"edgeType":"imports","source":1375,"target":1406},{"edgeType":"contains","source":16845,"target":16912},{"edgeType":"contains","source":133,"target":134},{"edgeType":"contains","source":8523,"target":8526},{"edgeType":"calls","source":3027,"target":3019},{"edgeType":"contains","source":16054,"target":16064},{"edgeType":"contains","source":7003,"target":7023},{"edgeType":"calls","source":14260,"target":14181},{"edgeType":"calls","source":2773,"target":2433},{"edgeType":"contains","source":7459,"target":7687},{"edgeType":"contains","source":1651,"target":1699},{"edgeType":"contains","source":7921,"target":8164},{"edgeType":"contains","source":1982,"target":2008},{"edgeType":"contains","source":133,"target":137},{"edgeType":"contains","source":4352,"target":4646},{"edgeType":"calls","source":14004,"target":976},{"edgeType":"imports","source":2618,"target":925},{"edgeType":"contains","source":7003,"target":7024},{"edgeType":"calls","source":9699,"target":9702},{"edgeType":"calls","source":8469,"target":3438},{"edgeType":"calls","source":14461,"target":14291},{"edgeType":"contains","source":7921,"target":8163},{"edgeType":"contains","source":1982,"target":2009},{"edgeType":"imports","source":5659,"target":6012},{"edgeType":"contains","source":3565,"target":3673},{"edgeType":"calls","source":2366,"target":2367},{"edgeType":"contains","source":16054,"target":16066},{"edgeType":"contains","source":5219,"target":5250},{"edgeType":"imports","source":16795,"target":15954},{"edgeType":"contains","source":7003,"target":7025},{"edgeType":"contains","source":987,"target":1144},{"edgeType":"calls","source":16375,"target":16372},{"edgeType":"calls","source":11280,"target":3075},{"edgeType":"calls","source":4550,"target":4524},{"edgeType":"calls","source":4884,"target":4740},{"edgeType":"calls","source":2369,"target":2370},{"edgeType":"contains","source":10438,"target":10450},{"edgeType":"contains","source":5019,"target":5082},{"edgeType":"contains","source":12090,"target":12091},{"edgeType":"contains","source":10385,"target":1523},{"edgeType":"contains","source":16314,"target":16449},{"edgeType":"calls","source":15602,"target":14966},{"edgeType":"contains","source":12288,"target":12295},{"edgeType":"calls","source":11145,"target":3033},{"edgeType":"contains","source":10218,"target":358},{"edgeType":"contains","source":8594,"target":8418},{"edgeType":"calls","source":1312,"target":1310},{"edgeType":"contains","source":9249,"target":9254},{"edgeType":"contains","source":16845,"target":16899},{"edgeType":"calls","source":12425,"target":9863},{"edgeType":"contains","source":1780,"target":1902},{"edgeType":"contains","source":10949,"target":11522},{"edgeType":"calls","source":387,"target":388},{"edgeType":"calls","source":11883,"target":11866},{"edgeType":"imports","source":8676,"target":1331},{"edgeType":"contains","source":6012,"target":6013},{"edgeType":"imports","source":8035,"target":61},{"edgeType":"contains","source":12151,"target":12313},{"edgeType":"calls","source":9372,"target":9370},{"edgeType":"calls","source":15608,"target":2097},{"edgeType":"contains","source":16314,"target":16448},{"edgeType":"contains","source":5285,"target":5291},{"edgeType":"contains","source":5153,"target":5155},{"edgeType":"contains","source":5219,"target":5223},{"edgeType":"calls","source":2964,"target":2949},{"edgeType":"contains","source":7003,"target":7004},{"edgeType":"calls","source":11289,"target":11251},{"edgeType":"imports","source":5871,"target":5837},{"edgeType":"contains","source":6012,"target":6014},{"edgeType":"contains","source":13873,"target":13895},{"edgeType":"contains","source":12151,"target":12312},{"edgeType":"contains","source":4612,"target":5013},{"edgeType":"calls","source":9900,"target":1461},{"edgeType":"contains","source":16054,"target":16055},{"edgeType":"contains","source":8324,"target":8335},{"edgeType":"contains","source":5153,"target":5154},{"edgeType":"contains","source":14600,"target":14619},{"edgeType":"contains","source":7003,"target":7005},{"edgeType":"contains","source":16845,"target":16901},{"edgeType":"calls","source":6663,"target":6675},{"edgeType":"contains","source":3488,"target":3917},{"edgeType":"contains","source":16314,"target":16450},{"edgeType":"calls","source":3690,"target":3699},{"edgeType":"imports","source":5871,"target":5836},{"edgeType":"contains","source":13873,"target":13894},{"edgeType":"contains","source":4352,"target":4616},{"edgeType":"contains","source":12420,"target":12428},{"edgeType":"contains","source":2758,"target":3293},{"edgeType":"contains","source":14600,"target":14620},{"edgeType":"contains","source":16845,"target":16904},{"edgeType":"contains","source":5219,"target":5229},{"edgeType":"contains","source":15130,"target":2418},{"edgeType":"calls","source":6663,"target":6676},{"edgeType":"contains","source":9838,"target":1562},{"edgeType":"contains","source":14997,"target":14998},{"edgeType":"contains","source":12420,"target":12427},{"edgeType":"contains","source":13873,"target":13893},{"edgeType":"contains","source":13148,"target":13113},{"edgeType":"contains","source":16377,"target":16614},{"edgeType":"calls","source":9900,"target":1463},{"edgeType":"calls","source":3492,"target":3493},{"edgeType":"calls","source":6663,"target":6677},{"edgeType":"contains","source":5153,"target":5160},{"edgeType":"calls","source":3626,"target":3567},{"edgeType":"contains","source":12151,"target":12308},{"edgeType":"contains","source":15394,"target":15376},{"edgeType":"imports","source":5871,"target":5838},{"edgeType":"contains","source":11628,"target":11610},{"edgeType":"contains","source":12420,"target":12426},{"edgeType":"contains","source":16314,"target":16452},{"edgeType":"calls","source":4483,"target":4482},{"edgeType":"contains","source":13873,"target":13892},{"edgeType":"contains","source":2758,"target":3299},{"edgeType":"contains","source":10949,"target":11518},{"edgeType":"contains","source":12288,"target":12290},{"edgeType":"calls","source":8183,"target":8182},{"edgeType":"contains","source":3303,"target":3314},{"edgeType":"contains","source":1780,"target":1903},{"edgeType":"contains","source":14997,"target":15000},{"edgeType":"contains","source":9642,"target":9754},{"edgeType":"contains","source":2758,"target":3296},{"edgeType":"contains","source":13873,"target":13891},{"edgeType":"contains","source":4352,"target":4621},{"edgeType":"contains","source":5021,"target":5022},{"edgeType":"contains","source":16845,"target":16905},{"edgeType":"contains","source":12420,"target":12424},{"edgeType":"contains","source":10426,"target":10817},{"edgeType":"contains","source":16377,"target":16615},{"edgeType":"imports","source":3362,"target":3270},{"edgeType":"calls","source":12015,"target":12004},{"edgeType":"contains","source":8848,"target":8998},{"edgeType":"imports","source":15251,"target":15253},{"edgeType":"calls","source":15527,"target":15176},{"edgeType":"calls","source":11419,"target":11459},{"edgeType":"calls","source":6673,"target":6370},{"edgeType":"calls","source":6663,"target":6680},{"edgeType":"contains","source":16314,"target":16440},{"edgeType":"contains","source":3565,"target":3655},{"edgeType":"calls","source":2962,"target":3005},{"edgeType":"contains","source":10385,"target":1531},{"edgeType":"contains","source":12288,"target":12303},{"edgeType":"contains","source":16845,"target":16892},{"edgeType":"imports","source":7919,"target":7876},{"edgeType":"calls","source":11087,"target":11181},{"edgeType":"contains","source":14863,"target":14912},{"edgeType":"contains","source":16314,"target":16439},{"edgeType":"contains","source":1330,"target":1062},{"edgeType":"contains","source":2758,"target":3304},{"edgeType":"calls","source":1309,"target":1395},{"edgeType":"contains","source":1780,"target":1911},{"edgeType":"calls","source":12726,"target":540},{"edgeType":"contains","source":12288,"target":12302},{"edgeType":"contains","source":14600,"target":14609},{"edgeType":"calls","source":2254,"target":1700},{"edgeType":"contains","source":14661,"target":14832},{"edgeType":"imports","source":2784,"target":61},{"edgeType":"calls","source":4943,"target":5015},{"edgeType":"calls","source":10168,"target":10074},{"edgeType":"imports","source":14502,"target":8872},{"edgeType":"calls","source":1447,"target":1348},{"edgeType":"contains","source":8906,"target":2986},{"edgeType":"contains","source":2758,"target":3300},{"edgeType":"contains","source":1780,"target":1908},{"edgeType":"contains","source":7921,"target":8152},{"edgeType":"contains","source":15130,"target":2408},{"edgeType":"contains","source":16314,"target":16441},{"edgeType":"calls","source":4943,"target":5014},{"edgeType":"contains","source":12420,"target":12436},{"edgeType":"contains","source":8324,"target":8342},{"edgeType":"contains","source":10435,"target":10550},{"edgeType":"contains","source":5219,"target":5230},{"edgeType":"contains","source":8523,"target":8515},{"edgeType":"calls","source":10099,"target":10098},{"edgeType":"contains","source":8838,"target":9321},{"edgeType":"contains","source":12949,"target":12950},{"edgeType":"contains","source":12288,"target":12300},{"edgeType":"contains","source":7201,"target":7217},{"edgeType":"contains","source":2758,"target":3301},{"edgeType":"calls","source":6274,"target":6034},{"edgeType":"contains","source":14600,"target":14611},{"edgeType":"contains","source":5749,"target":5712},{"edgeType":"calls","source":2308,"target":2134},{"edgeType":"calls","source":6663,"target":6684},{"edgeType":"imports","source":12413,"target":12316},{"edgeType":"imports","source":14863,"target":12473},{"edgeType":"contains","source":2643,"target":2644},{"edgeType":"calls","source":7723,"target":7650},{"edgeType":"calls","source":10168,"target":10076},{"edgeType":"contains","source":10949,"target":11526},{"edgeType":"contains","source":1780,"target":1914},{"edgeType":"contains","source":12288,"target":12299},{"edgeType":"imports","source":15581,"target":15584},{"edgeType":"contains","source":12420,"target":12435},{"edgeType":"calls","source":11019,"target":609},{"edgeType":"imports","source":15779,"target":15788},{"edgeType":"contains","source":10967,"target":10969},{"edgeType":"contains","source":9249,"target":9258},{"edgeType":"contains","source":1780,"target":1915},{"edgeType":"contains","source":12288,"target":12298},{"edgeType":"contains","source":4427,"target":4419},{"edgeType":"contains","source":5880,"target":5881},{"edgeType":"contains","source":12420,"target":12434},{"edgeType":"contains","source":16314,"target":16444},{"edgeType":"contains","source":1586,"target":1587},{"edgeType":"calls","source":10702,"target":10433},{"edgeType":"calls","source":7304,"target":5842},{"edgeType":"calls","source":16278,"target":358},{"edgeType":"contains","source":2758,"target":3305},{"edgeType":"calls","source":13072,"target":13071},{"edgeType":"contains","source":12288,"target":12297},{"edgeType":"contains","source":1780,"target":1912},{"edgeType":"calls","source":6663,"target":6687},{"edgeType":"contains","source":12090,"target":12093},{"edgeType":"calls","source":2566,"target":2591},{"edgeType":"contains","source":5880,"target":5882},{"edgeType":"calls","source":14988,"target":14980},{"edgeType":"contains","source":16314,"target":16447},{"edgeType":"calls","source":15364,"target":5438},{"edgeType":"imports","source":13217,"target":12764},{"edgeType":"contains","source":5019,"target":5092},{"edgeType":"calls","source":15186,"target":15185},{"edgeType":"contains","source":1780,"target":1913},{"edgeType":"calls","source":4039,"target":3438},{"edgeType":"contains","source":12090,"target":12092},{"edgeType":"contains","source":8324,"target":8338},{"edgeType":"imports","source":7852,"target":7842},{"edgeType":"calls","source":6981,"target":1058},{"edgeType":"contains","source":2758,"target":3278},{"edgeType":"calls","source":3029,"target":3067},{"edgeType":"contains","source":12152,"target":12266},{"edgeType":"calls","source":10032,"target":10035},{"edgeType":"contains","source":8906,"target":2959},{"edgeType":"contains","source":8323,"target":8347},{"edgeType":"contains","source":987,"target":1098},{"edgeType":"contains","source":16314,"target":16432},{"edgeType":"calls","source":2773,"target":433},{"edgeType":"contains","source":9466,"target":2511},{"edgeType":"contains","source":16845,"target":16884},{"edgeType":"calls","source":4721,"target":3468},{"edgeType":"calls","source":2980,"target":358},{"edgeType":"imports","source":2619,"target":925},{"edgeType":"imports","source":10069,"target":411},{"edgeType":"contains","source":10426,"target":10806},{"edgeType":"calls","source":2105,"target":2115},{"edgeType":"contains","source":2510,"target":2511},{"edgeType":"contains","source":9466,"target":2510},{"edgeType":"calls","source":4040,"target":3438},{"edgeType":"contains","source":14600,"target":14601},{"edgeType":"contains","source":16845,"target":16883},{"edgeType":"imports","source":15649,"target":15585},{"edgeType":"calls","source":2565,"target":540},{"edgeType":"imports","source":14916,"target":2369},{"edgeType":"contains","source":3709,"target":3394},{"edgeType":"contains","source":6209,"target":6232},{"edgeType":"contains","source":16314,"target":16434},{"edgeType":"calls","source":9046,"target":8892},{"edgeType":"contains","source":462,"target":463},{"edgeType":"contains","source":4612,"target":4997},{"edgeType":"contains","source":15986,"target":16031},{"edgeType":"contains","source":1780,"target":1883},{"edgeType":"calls","source":11623,"target":11450},{"edgeType":"contains","source":7921,"target":8127},{"edgeType":"contains","source":16845,"target":16886},{"edgeType":"imports","source":15779,"target":15786},{"edgeType":"calls","source":916,"target":921},{"edgeType":"calls","source":1643,"target":1638},{"edgeType":"calls","source":9309,"target":7080},{"edgeType":"calls","source":4354,"target":4271},{"edgeType":"calls","source":15053,"target":15059},{"edgeType":"contains","source":6209,"target":6233},{"edgeType":"contains","source":6540,"target":6543},{"edgeType":"contains","source":16314,"target":16433},{"edgeType":"contains","source":8323,"target":8348},{"edgeType":"contains","source":16780,"target":16786},{"edgeType":"contains","source":987,"target":1099},{"edgeType":"calls","source":10165,"target":10141},{"edgeType":"contains","source":16845,"target":16885},{"edgeType":"contains","source":16314,"target":16436},{"edgeType":"contains","source":10435,"target":10522},{"edgeType":"contains","source":462,"target":465},{"edgeType":"contains","source":396,"target":397},{"edgeType":"contains","source":4352,"target":4606},{"edgeType":"contains","source":5019,"target":5070},{"edgeType":"calls","source":8581,"target":8511},{"edgeType":"contains","source":15376,"target":7460},{"edgeType":"contains","source":1780,"target":1889},{"edgeType":"calls","source":3029,"target":3063},{"edgeType":"contains","source":16780,"target":16789},{"edgeType":"contains","source":16314,"target":16435},{"edgeType":"contains","source":13873,"target":13876},{"edgeType":"contains","source":15525,"target":15527},{"edgeType":"contains","source":6209,"target":6227},{"edgeType":"calls","source":9042,"target":9017},{"edgeType":"contains","source":13148,"target":13096},{"edgeType":"contains","source":12094,"target":11945},{"edgeType":"contains","source":987,"target":1101},{"edgeType":"contains","source":8906,"target":2953},{"edgeType":"contains","source":14661,"target":14828},{"edgeType":"calls","source":6941,"target":2271},{"edgeType":"contains","source":16845,"target":16887},{"edgeType":"contains","source":10426,"target":10799},{"edgeType":"contains","source":16314,"target":16438},{"edgeType":"calls","source":2039,"target":2043},{"edgeType":"contains","source":462,"target":467},{"edgeType":"calls","source":14021,"target":540},{"edgeType":"calls","source":10974,"target":10433},{"edgeType":"imports","source":11679,"target":11812},{"edgeType":"contains","source":15130,"target":2404},{"edgeType":"calls","source":916,"target":917},{"edgeType":"imports","source":7919,"target":7870},{"edgeType":"contains","source":14661,"target":14829},{"edgeType":"contains","source":16314,"target":16437},{"edgeType":"contains","source":8323,"target":8344},{"edgeType":"contains","source":10768,"target":10769},{"edgeType":"contains","source":462,"target":466},{"edgeType":"calls","source":11075,"target":3075},{"edgeType":"calls","source":4943,"target":5035},{"edgeType":"contains","source":5019,"target":5067},{"edgeType":"imports","source":15779,"target":15781},{"edgeType":"imports","source":10244,"target":1331},{"edgeType":"contains","source":16845,"target":16889},{"edgeType":"contains","source":1780,"target":1893},{"edgeType":"contains","source":5885,"target":5712},{"edgeType":"contains","source":5019,"target":5074},{"edgeType":"contains","source":8324,"target":8325},{"edgeType":"contains","source":2758,"target":3286},{"edgeType":"imports","source":2434,"target":2440},{"edgeType":"calls","source":6341,"target":6076},{"edgeType":"calls","source":3899,"target":3573},{"edgeType":"contains","source":6607,"target":6586},{"edgeType":"calls","source":11296,"target":8914},{"edgeType":"contains","source":13741,"target":13752},{"edgeType":"imports","source":13995,"target":13999},{"edgeType":"imports","source":15810,"target":4244},{"edgeType":"imports","source":14916,"target":2361},{"edgeType":"contains","source":4352,"target":4610},{"edgeType":"contains","source":5659,"target":6377},{"edgeType":"contains","source":12420,"target":12422},{"edgeType":"contains","source":1330,"target":1046},{"edgeType":"calls","source":3492,"target":3505},{"edgeType":"calls","source":10807,"target":819},{"edgeType":"calls","source":7653,"target":7687},{"edgeType":"contains","source":13741,"target":13751},{"edgeType":"contains","source":9642,"target":9750},{"edgeType":"contains","source":13286,"target":13057},{"edgeType":"contains","source":10438,"target":10440},{"edgeType":"contains","source":12420,"target":12421},{"edgeType":"calls","source":9702,"target":9704},{"edgeType":"contains","source":5417,"target":5418},{"edgeType":"calls","source":3958,"target":3856},{"edgeType":"imports","source":15779,"target":15777},{"edgeType":"calls","source":11432,"target":8924},{"edgeType":"contains","source":4352,"target":4608},{"edgeType":"calls","source":11420,"target":11411},{"edgeType":"calls","source":4886,"target":4684},{"edgeType":"calls","source":3492,"target":3503},{"edgeType":"contains","source":1780,"target":1897},{"edgeType":"contains","source":1651,"target":1668},{"edgeType":"contains","source":13741,"target":13749},{"edgeType":"contains","source":6540,"target":6544},{"edgeType":"contains","source":693,"target":1768},{"edgeType":"calls","source":9371,"target":9398},{"edgeType":"contains","source":16780,"target":16781},{"edgeType":"imports","source":10949,"target":611},{"edgeType":"contains","source":1780,"target":1898},{"edgeType":"calls","source":12862,"target":540},{"edgeType":"contains","source":6209,"target":6235},{"edgeType":"contains","source":8323,"target":8350},{"edgeType":"contains","source":10385,"target":1511},{"edgeType":"contains","source":12152,"target":12269},{"edgeType":"contains","source":11232,"target":11193},{"edgeType":"calls","source":12675,"target":12678},{"edgeType":"contains","source":10426,"target":10811},{"edgeType":"contains","source":4352,"target":4614},{"edgeType":"imports","source":4456,"target":3170},{"edgeType":"contains","source":11091,"target":11336},{"edgeType":"imports","source":15779,"target":15774},{"edgeType":"contains","source":12152,"target":12268},{"edgeType":"calls","source":15419,"target":7944},{"edgeType":"contains","source":6209,"target":6236},{"edgeType":"calls","source":2962,"target":3016},{"edgeType":"calls","source":14921,"target":14926},{"edgeType":"calls","source":982,"target":977},{"edgeType":"calls","source":9372,"target":9369},{"edgeType":"contains","source":16845,"target":16882},{"edgeType":"contains","source":16780,"target":16783},{"edgeType":"contains","source":2758,"target":3288},{"edgeType":"contains","source":9260,"target":2561},{"edgeType":"contains","source":987,"target":1112},{"edgeType":"contains","source":1780,"target":1896},{"edgeType":"contains","source":5285,"target":5286},{"edgeType":"contains","source":7460,"target":7624},{"edgeType":"calls","source":14525,"target":14520},{"edgeType":"contains","source":6209,"target":6237},{"edgeType":"contains","source":16314,"target":16429},{"edgeType":"contains","source":12152,"target":12267},{"edgeType":"imports","source":13995,"target":13997},{"edgeType":"contains","source":16845,"target":16881},{"edgeType":"contains","source":2758,"target":3289},{"edgeType":"contains","source":987,"target":1111},{"edgeType":"calls","source":8909,"target":8892},{"edgeType":"calls","source":10315,"target":9702},{"edgeType":"calls","source":2963,"target":2949},{"edgeType":"contains","source":6209,"target":6214},{"edgeType":"contains","source":16377,"target":16577},{"edgeType":"contains","source":987,"target":1081},{"edgeType":"contains","source":6593,"target":6994},{"edgeType":"calls","source":730,"target":292},{"edgeType":"calls","source":10359,"target":4109},{"edgeType":"contains","source":12815,"target":12836},{"edgeType":"calls","source":7062,"target":6955},{"edgeType":"contains","source":6209,"target":6215},{"edgeType":"calls","source":11297,"target":10973},{"edgeType":"calls","source":12014,"target":12000},{"edgeType":"calls","source":4447,"target":3455},{"edgeType":"contains","source":16314,"target":16415},{"edgeType":"contains","source":987,"target":1084},{"edgeType":"contains","source":7921,"target":8110},{"edgeType":"contains","source":13616,"target":13373},{"edgeType":"calls","source":3821,"target":3832},{"edgeType":"contains","source":16377,"target":16579},{"edgeType":"contains","source":6209,"target":6216},{"edgeType":"contains","source":16314,"target":16418},{"edgeType":"imports","source":15489,"target":7913},{"edgeType":"contains","source":5019,"target":5047},{"edgeType":"contains","source":8224,"target":2946},{"edgeType":"contains","source":12617,"target":12631},{"edgeType":"calls","source":1937,"target":931},{"edgeType":"contains","source":3170,"target":3173},{"edgeType":"calls","source":1311,"target":1310},{"edgeType":"contains","source":12815,"target":12834},{"edgeType":"calls","source":14993,"target":2097},{"edgeType":"calls","source":15059,"target":2165},{"edgeType":"imports","source":15796,"target":15308},{"edgeType":"contains","source":16377,"target":16578},{"edgeType":"calls","source":6075,"target":5836},{"edgeType":"contains","source":6593,"target":6997},{"edgeType":"contains","source":6209,"target":6217},{"edgeType":"contains","source":12815,"target":12833},{"edgeType":"contains","source":5019,"target":5054},{"edgeType":"contains","source":14871,"target":4072},{"edgeType":"calls","source":2962,"target":2976},{"edgeType":"imports","source":2621,"target":909},{"edgeType":"contains","source":12419,"target":12425},{"edgeType":"contains","source":6404,"target":6507},{"edgeType":"contains","source":801,"target":509},{"edgeType":"calls","source":11623,"target":11440},{"edgeType":"contains","source":12815,"target":12832},{"edgeType":"contains","source":12152,"target":12244},{"edgeType":"calls","source":16310,"target":16237},{"edgeType":"contains","source":16377,"target":16580},{"edgeType":"contains","source":16314,"target":16419},{"edgeType":"calls","source":4680,"target":4684},{"edgeType":"contains","source":6209,"target":6211},{"edgeType":"contains","source":6404,"target":6508},{"edgeType":"contains","source":10426,"target":10786},{"edgeType":"contains","source":13344,"target":13345},{"edgeType":"calls","source":8652,"target":8409},{"edgeType":"contains","source":15204,"target":4321},{"edgeType":"imports","source":9754,"target":10229},{"edgeType":"contains","source":12469,"target":12987},{"edgeType":"imports","source":3298,"target":3174},{"edgeType":"contains","source":10305,"target":10306},{"edgeType":"contains","source":6404,"target":6509},{"edgeType":"calls","source":1942,"target":772},{"edgeType":"contains","source":16845,"target":16872},{"edgeType":"contains","source":13616,"target":13368},{"edgeType":"contains","source":14661,"target":14813},{"edgeType":"imports","source":12315,"target":600},{"edgeType":"contains","source":12469,"target":12986},{"edgeType":"calls","source":10071,"target":358},{"edgeType":"contains","source":3368,"target":3380},{"edgeType":"calls","source":4680,"target":4682},{"edgeType":"imports","source":12617,"target":12379},{"edgeType":"calls","source":11023,"target":11013},{"edgeType":"contains","source":5019,"target":5058},{"edgeType":"calls","source":8183,"target":8151},{"edgeType":"calls","source":1672,"target":680},{"edgeType":"calls","source":10683,"target":416},{"edgeType":"calls","source":3954,"target":3931},{"edgeType":"calls","source":15846,"target":15833},{"edgeType":"contains","source":6671,"target":6698},{"edgeType":"contains","source":6209,"target":6222},{"edgeType":"contains","source":7993,"target":7999},{"edgeType":"contains","source":12418,"target":12467},{"edgeType":"contains","source":6671,"target":6699},{"edgeType":"contains","source":9450,"target":9340},{"edgeType":"calls","source":6211,"target":5842},{"edgeType":"calls","source":2761,"target":2862},{"edgeType":"contains","source":6209,"target":6223},{"edgeType":"contains","source":7993,"target":7998},{"edgeType":"contains","source":1,"target":16856},{"edgeType":"contains","source":11956,"target":11991},{"edgeType":"contains","source":14661,"target":14799},{"edgeType":"calls","source":4485,"target":4383},{"edgeType":"calls","source":2346,"target":925},{"edgeType":"calls","source":9371,"target":9379},{"edgeType":"contains","source":16314,"target":16409},{"edgeType":"contains","source":13346,"target":13295},{"edgeType":"contains","source":12418,"target":12466},{"edgeType":"contains","source":14036,"target":13034},{"edgeType":"contains","source":8906,"target":2952},{"edgeType":"calls","source":15157,"target":13940},{"edgeType":"calls","source":2037,"target":2051},{"edgeType":"calls","source":9173,"target":9175},{"edgeType":"contains","source":5747,"target":5748},{"edgeType":"contains","source":6209,"target":6224},{"edgeType":"calls","source":4753,"target":4530},{"edgeType":"calls","source":11419,"target":11424},{"edgeType":"contains","source":11956,"target":11990},{"edgeType":"calls","source":14793,"target":14654},{"edgeType":"calls","source":2211,"target":883},{"edgeType":"contains","source":16314,"target":16408},{"edgeType":"contains","source":1780,"target":1875},{"edgeType":"contains","source":6738,"target":6739},{"edgeType":"contains","source":14987,"target":15265},{"edgeType":"contains","source":11956,"target":11989},{"edgeType":"calls","source":2698,"target":2699},{"edgeType":"contains","source":12152,"target":12255},{"edgeType":"calls","source":4614,"target":4610},{"edgeType":"calls","source":10701,"target":10433},{"edgeType":"contains","source":9984,"target":3354},{"edgeType":"contains","source":2758,"target":3274},{"edgeType":"contains","source":5019,"target":5062},{"edgeType":"imports","source":13217,"target":4338},{"edgeType":"calls","source":11623,"target":11448},{"edgeType":"contains","source":6209,"target":6218},{"edgeType":"contains","source":10305,"target":10316},{"edgeType":"contains","source":801,"target":517},{"edgeType":"contains","source":13703,"target":4339},{"edgeType":"calls","source":7959,"target":4530},{"edgeType":"contains","source":1780,"target":1882},{"edgeType":"calls","source":5342,"target":5294},{"edgeType":"contains","source":6593,"target":6999},{"edgeType":"contains","source":7993,"target":7994},{"edgeType":"contains","source":12150,"target":12315},{"edgeType":"contains","source":13021,"target":4339},{"edgeType":"imports","source":6681,"target":6125},{"edgeType":"imports","source":12821,"target":12387},{"edgeType":"contains","source":5019,"target":5060},{"edgeType":"imports","source":12821,"target":12388},{"edgeType":"calls","source":3424,"target":3442},{"edgeType":"contains","source":9643,"target":9698},{"edgeType":"contains","source":10426,"target":10791},{"edgeType":"contains","source":6209,"target":6220},{"edgeType":"contains","source":16314,"target":16414},{"edgeType":"calls","source":8052,"target":7991},{"edgeType":"contains","source":987,"target":1095},{"edgeType":"imports","source":12821,"target":12389},{"edgeType":"contains","source":8848,"target":8973},{"edgeType":"calls","source":6211,"target":5836},{"edgeType":"calls","source":6199,"target":6208},{"edgeType":"contains","source":6209,"target":6221},{"edgeType":"contains","source":7993,"target":7996},{"edgeType":"calls","source":649,"target":679},{"edgeType":"contains","source":1410,"target":2751},{"edgeType":"contains","source":12153,"target":12202},{"edgeType":"contains","source":4549,"target":4805},{"edgeType":"contains","source":6671,"target":6674},{"edgeType":"contains","source":10426,"target":10772},{"edgeType":"contains","source":3830,"target":3839},{"edgeType":"calls","source":10163,"target":10169},{"edgeType":"contains","source":15204,"target":4299},{"edgeType":"calls","source":6597,"target":6555},{"edgeType":"contains","source":1410,"target":2752},{"edgeType":"calls","source":12244,"target":626},{"edgeType":"contains","source":12153,"target":12201},{"edgeType":"contains","source":12152,"target":12232},{"edgeType":"calls","source":9902,"target":3461},{"edgeType":"contains","source":3830,"target":3838},{"edgeType":"contains","source":14661,"target":14791},{"edgeType":"contains","source":16845,"target":16850},{"edgeType":"calls","source":915,"target":916},{"edgeType":"calls","source":12823,"target":3817},{"edgeType":"contains","source":1780,"target":1853},{"edgeType":"contains","source":9838,"target":3633},{"edgeType":"contains","source":13733,"target":13958},{"edgeType":"calls","source":7260,"target":7144},{"edgeType":"calls","source":15527,"target":15129},{"edgeType":"contains","source":6760,"target":6031},{"edgeType":"contains","source":10426,"target":10770},{"edgeType":"contains","source":6593,"target":6980},{"edgeType":"calls","source":1906,"target":1909},{"edgeType":"contains","source":7301,"target":6172},{"edgeType":"contains","source":12153,"target":12200},{"edgeType":"contains","source":14661,"target":14792},{"edgeType":"contains","source":15204,"target":4301},{"edgeType":"contains","source":5659,"target":6337},{"edgeType":"calls","source":3029,"target":3032},{"edgeType":"imports","source":2618,"target":987},{"edgeType":"contains","source":3830,"target":3837},{"edgeType":"contains","source":1410,"target":2750},{"edgeType":"calls","source":8587,"target":8288},{"edgeType":"contains","source":13733,"target":13957},{"edgeType":"contains","source":14725,"target":4352},{"edgeType":"calls","source":8456,"target":8121},{"edgeType":"calls","source":2600,"target":1533},{"edgeType":"contains","source":15590,"target":15591},{"edgeType":"contains","source":1246,"target":1492},{"edgeType":"calls","source":13929,"target":13924},{"edgeType":"contains","source":5019,"target":5030},{"edgeType":"contains","source":10426,"target":10771},{"edgeType":"contains","source":12815,"target":12818},{"edgeType":"contains","source":12153,"target":12199},{"edgeType":"contains","source":7921,"target":8093},{"edgeType":"imports","source":6844,"target":1058},{"edgeType":"contains","source":13673,"target":13702},{"edgeType":"contains","source":15065,"target":14953},{"edgeType":"contains","source":10436,"target":10458},{"edgeType":"calls","source":4485,"target":4404},{"edgeType":"contains","source":2758,"target":3249},{"edgeType":"calls","source":4714,"target":1533},{"edgeType":"contains","source":15590,"target":15592},{"edgeType":"calls","source":5571,"target":4563},{"edgeType":"contains","source":6593,"target":6973},{"edgeType":"contains","source":12815,"target":12817},{"edgeType":"calls","source":15053,"target":15019},{"edgeType":"contains","source":5019,"target":5037},{"edgeType":"calls","source":12872,"target":12873},{"edgeType":"contains","source":7517,"target":7926},{"edgeType":"contains","source":13733,"target":13955},{"edgeType":"calls","source":3095,"target":3098},{"edgeType":"contains","source":3488,"target":3875},{"edgeType":"contains","source":13673,"target":13701},{"edgeType":"contains","source":16314,"target":16402},{"edgeType":"contains","source":15590,"target":15593},{"edgeType":"calls","source":13929,"target":13930},{"edgeType":"contains","source":4352,"target":4572},{"edgeType":"contains","source":12815,"target":12816},{"edgeType":"calls","source":16440,"target":16418},{"edgeType":"contains","source":12153,"target":12197},{"edgeType":"contains","source":13673,"target":13700},{"edgeType":"imports","source":5871,"target":5855},{"edgeType":"calls","source":6332,"target":6319},{"edgeType":"calls","source":7124,"target":7136},{"edgeType":"contains","source":8838,"target":9260},{"edgeType":"contains","source":6671,"target":6672},{"edgeType":"contains","source":13714,"target":3972},{"edgeType":"contains","source":13673,"target":13699},{"edgeType":"calls","source":14406,"target":13940},{"edgeType":"imports","source":5871,"target":5858},{"edgeType":"contains","source":10436,"target":10457},{"edgeType":"contains","source":6593,"target":6977},{"edgeType":"contains","source":6593,"target":6976},{"edgeType":"contains","source":7921,"target":8089},{"edgeType":"contains","source":5953,"target":5676},{"edgeType":"calls","source":3095,"target":3097},{"edgeType":"contains","source":1410,"target":2755},{"edgeType":"contains","source":6404,"target":6503},{"edgeType":"contains","source":12551,"target":12557},{"edgeType":"contains","source":801,"target":497},{"edgeType":"contains","source":12815,"target":12829},{"edgeType":"contains","source":15850,"target":15975},{"edgeType":"contains","source":7921,"target":8099},{"edgeType":"calls","source":2371,"target":2284},{"edgeType":"contains","source":4072,"target":4800},{"edgeType":"calls","source":9758,"target":1591},{"edgeType":"contains","source":12551,"target":12556},{"edgeType":"calls","source":6604,"target":6347},{"edgeType":"contains","source":987,"target":1072},{"edgeType":"contains","source":15850,"target":15976},{"edgeType":"calls","source":9860,"target":2660},{"edgeType":"contains","source":10305,"target":10301},{"edgeType":"imports","source":7852,"target":7853},{"edgeType":"contains","source":7921,"target":8102},{"edgeType":"contains","source":12551,"target":12555},{"edgeType":"imports","source":13217,"target":12783},{"edgeType":"contains","source":10426,"target":10779},{"edgeType":"imports","source":15800,"target":15160},{"edgeType":"contains","source":11438,"target":11117},{"edgeType":"contains","source":12815,"target":12827},{"edgeType":"contains","source":15850,"target":15977},{"edgeType":"contains","source":3368,"target":3369},{"edgeType":"contains","source":6593,"target":6989},{"edgeType":"contains","source":11428,"target":11429},{"edgeType":"calls","source":11280,"target":3033},{"edgeType":"contains","source":8323,"target":8324},{"edgeType":"contains","source":12551,"target":12554},{"edgeType":"contains","source":8838,"target":9271},{"edgeType":"contains","source":1330,"target":1011},{"edgeType":"contains","source":9643,"target":9680},{"edgeType":"contains","source":6593,"target":6982},{"edgeType":"contains","source":197,"target":199},{"edgeType":"calls","source":8850,"target":2261},{"edgeType":"contains","source":5659,"target":6339},{"edgeType":"contains","source":12551,"target":12553},{"edgeType":"calls","source":1322,"target":971},{"edgeType":"contains","source":3170,"target":3171},{"edgeType":"imports","source":14133,"target":13978},{"edgeType":"contains","source":10305,"target":10300},{"edgeType":"calls","source":4681,"target":4661},{"edgeType":"contains","source":197,"target":198},{"edgeType":"contains","source":12152,"target":12236},{"edgeType":"contains","source":12551,"target":12552},{"edgeType":"contains","source":15788,"target":15790},{"edgeType":"contains","source":12152,"target":12235},{"edgeType":"calls","source":12674,"target":12675},{"edgeType":"calls","source":14328,"target":14252},{"edgeType":"imports","source":12821,"target":12372},{"edgeType":"calls","source":3456,"target":2468},{"edgeType":"contains","source":6593,"target":6985},{"edgeType":"contains","source":12153,"target":12203},{"edgeType":"contains","source":12152,"target":12234},{"edgeType":"contains","source":7921,"target":8097},{"edgeType":"contains","source":10305,"target":10298},{"edgeType":"contains","source":127,"target":256},{"edgeType":"imports","source":9696,"target":9679},{"edgeType":"contains","source":2041,"target":2200},{"edgeType":"calls","source":2962,"target":3079},{"edgeType":"imports","source":16165,"target":16322},{"edgeType":"contains","source":2041,"target":2201},{"edgeType":"contains","source":8324,"target":8267},{"edgeType":"contains","source":13673,"target":13689},{"edgeType":"contains","source":11083,"target":11529},{"edgeType":"contains","source":14997,"target":14927},{"edgeType":"contains","source":14202,"target":14204},{"edgeType":"contains","source":2758,"target":3228},{"edgeType":"imports","source":3488,"target":3403},{"edgeType":"calls","source":6211,"target":5950},{"edgeType":"contains","source":11083,"target":11531},{"edgeType":"contains","source":13673,"target":13688},{"edgeType":"imports","source":16238,"target":16174},{"edgeType":"imports","source":2619,"target":742},{"edgeType":"contains","source":3488,"target":3853},{"edgeType":"contains","source":2041,"target":2202},{"edgeType":"calls","source":1678,"target":600},{"edgeType":"contains","source":13733,"target":13942},{"edgeType":"contains","source":11083,"target":11530},{"edgeType":"contains","source":1246,"target":1478},{"edgeType":"contains","source":14202,"target":14205},{"edgeType":"calls","source":3565,"target":3414},{"edgeType":"calls","source":15623,"target":5926},{"edgeType":"contains","source":8859,"target":2251},{"edgeType":"contains","source":10426,"target":10757},{"edgeType":"contains","source":328,"target":339},{"edgeType":"contains","source":15610,"target":14953},{"edgeType":"contains","source":2041,"target":2198},{"edgeType":"contains","source":13733,"target":13941},{"edgeType":"imports","source":3359,"target":3170},{"edgeType":"contains","source":127,"target":228},{"edgeType":"calls","source":9047,"target":8944},{"edgeType":"contains","source":11083,"target":11527},{"edgeType":"contains","source":1410,"target":2733},{"edgeType":"contains","source":1246,"target":1475},{"edgeType":"contains","source":4687,"target":4736},{"edgeType":"imports","source":5659,"target":5869},{"edgeType":"calls","source":1314,"target":1316},{"edgeType":"imports","source":13922,"target":13978},{"edgeType":"contains","source":10142,"target":532},{"edgeType":"contains","source":2041,"target":2199},{"edgeType":"contains","source":6010,"target":6011},{"edgeType":"contains","source":11083,"target":11528},{"edgeType":"contains","source":1246,"target":1476},{"edgeType":"contains","source":14073,"target":13978},{"edgeType":"contains","source":6593,"target":6964},{"edgeType":"contains","source":328,"target":341},{"edgeType":"contains","source":987,"target":1053},{"edgeType":"contains","source":5019,"target":5021},{"edgeType":"calls","source":8652,"target":8506},{"edgeType":"calls","source":11558,"target":11440},{"edgeType":"calls","source":2651,"target":2146},{"edgeType":"contains","source":12152,"target":12212},{"edgeType":"contains","source":5883,"target":5712},{"edgeType":"contains","source":13673,"target":13685},{"edgeType":"contains","source":11083,"target":11525},{"edgeType":"contains","source":2758,"target":3232},{"edgeType":"calls","source":16048,"target":16000},{"edgeType":"imports","source":14195,"target":13965},{"edgeType":"contains","source":10568,"target":10578},{"edgeType":"contains","source":12907,"target":14176},{"edgeType":"contains","source":10832,"target":10850},{"edgeType":"calls","source":7987,"target":7981},{"edgeType":"calls","source":1473,"target":609},{"edgeType":"contains","source":8647,"target":8819},{"edgeType":"calls","source":1256,"target":994},{"edgeType":"calls","source":10434,"target":10343},{"edgeType":"contains","source":7921,"target":8070},{"edgeType":"calls","source":3032,"target":3020},{"edgeType":"contains","source":1246,"target":1482},{"edgeType":"contains","source":15850,"target":15972},{"edgeType":"calls","source":13180,"target":3438},{"edgeType":"contains","source":328,"target":343},{"edgeType":"contains","source":7921,"target":8073},{"edgeType":"contains","source":12086,"target":12142},{"edgeType":"contains","source":13733,"target":13937},{"edgeType":"contains","source":2041,"target":2203},{"edgeType":"contains","source":1410,"target":2737},{"edgeType":"imports","source":696,"target":1155},{"edgeType":"contains","source":1246,"target":1479},{"edgeType":"contains","source":127,"target":232},{"edgeType":"contains","source":15850,"target":15973},{"edgeType":"imports","source":5659,"target":5873},{"edgeType":"calls","source":6270,"target":6229},{"edgeType":"calls","source":10111,"target":9788},{"edgeType":"contains","source":12150,"target":12271},{"edgeType":"contains","source":328,"target":342},{"edgeType":"calls","source":8909,"target":540},{"edgeType":"contains","source":1410,"target":2738},{"edgeType":"contains","source":2041,"target":2204},{"edgeType":"imports","source":3761,"target":3403},{"edgeType":"contains","source":12418,"target":12420},{"edgeType":"contains","source":127,"target":231},{"edgeType":"contains","source":10568,"target":10577},{"edgeType":"contains","source":15850,"target":15974},{"edgeType":"contains","source":5019,"target":5025},{"edgeType":"imports","source":14584,"target":14586},{"edgeType":"contains","source":5747,"target":5712},{"edgeType":"calls","source":11558,"target":11444},{"edgeType":"contains","source":15796,"target":15519},{"edgeType":"contains","source":1410,"target":2743},{"edgeType":"calls","source":1645,"target":1616},{"edgeType":"imports","source":3488,"target":3394},{"edgeType":"contains","source":15850,"target":15959},{"edgeType":"contains","source":1246,"target":1485},{"edgeType":"contains","source":7517,"target":7922},{"edgeType":"imports","source":6681,"target":5887},{"edgeType":"contains","source":3830,"target":3831},{"edgeType":"contains","source":127,"target":234},{"edgeType":"contains","source":11956,"target":11959},{"edgeType":"contains","source":14202,"target":14196},{"edgeType":"imports","source":15072,"target":7913},{"edgeType":"contains","source":8906,"target":9259},{"edgeType":"contains","source":15850,"target":15960},{"edgeType":"contains","source":1246,"target":1486},{"edgeType":"imports","source":9754,"target":1531},{"edgeType":"contains","source":7921,"target":8083},{"edgeType":"contains","source":127,"target":233},{"edgeType":"contains","source":328,"target":344},{"edgeType":"calls","source":2374,"target":2274},{"edgeType":"calls","source":9246,"target":9122},{"edgeType":"calls","source":6270,"target":6226},{"edgeType":"contains","source":5019,"target":5023},{"edgeType":"contains","source":10436,"target":10452},{"edgeType":"calls","source":10704,"target":10433},{"edgeType":"contains","source":12910,"target":3523},{"edgeType":"imports","source":5659,"target":5860},{"edgeType":"contains","source":987,"target":1059},{"edgeType":"calls","source":2374,"target":2271},{"edgeType":"calls","source":7487,"target":4459},{"edgeType":"calls","source":4241,"target":1473},{"edgeType":"calls","source":8978,"target":8977},{"edgeType":"contains","source":7921,"target":8086},{"edgeType":"imports","source":696,"target":1169},{"edgeType":"calls","source":3626,"target":3627},{"edgeType":"contains","source":10436,"target":10453},{"edgeType":"contains","source":10435,"target":10484},{"edgeType":"contains","source":1410,"target":2742},{"edgeType":"contains","source":1246,"target":1484},{"edgeType":"calls","source":1895,"target":209},{"edgeType":"contains","source":7517,"target":7925},{"edgeType":"calls","source":8783,"target":8679},{"edgeType":"contains","source":693,"target":1715},{"edgeType":"imports","source":3356,"target":3270},{"edgeType":"contains","source":127,"target":235},{"edgeType":"imports","source":5659,"target":5862},{"edgeType":"contains","source":13268,"target":13564},{"edgeType":"calls","source":4313,"target":3468},{"edgeType":"contains","source":1410,"target":2747},{"edgeType":"imports","source":14716,"target":14718},{"edgeType":"contains","source":9049,"target":9051},{"edgeType":"contains","source":1246,"target":1489},{"edgeType":"calls","source":7987,"target":7988},{"edgeType":"calls","source":4616,"target":4646},{"edgeType":"calls","source":11623,"target":11547},{"edgeType":"contains","source":9754,"target":4108},{"edgeType":"contains","source":6593,"target":6965},{"edgeType":"contains","source":3830,"target":3835},{"edgeType":"calls","source":11518,"target":6347},{"edgeType":"calls","source":4947,"target":4954},{"edgeType":"contains","source":3628,"target":3753},{"edgeType":"contains","source":1410,"target":2748},{"edgeType":"calls","source":5079,"target":5090},{"edgeType":"contains","source":9049,"target":9050},{"edgeType":"contains","source":5144,"target":5381},{"edgeType":"calls","source":7987,"target":7989},{"edgeType":"contains","source":13410,"target":13389},{"edgeType":"contains","source":10949,"target":11460},{"edgeType":"calls","source":2339,"target":1237},{"edgeType":"contains","source":10565,"target":10677},{"edgeType":"contains","source":3628,"target":3752},{"edgeType":"calls","source":11558,"target":11446},{"edgeType":"contains","source":1410,"target":2745},{"edgeType":"contains","source":1246,"target":1487},{"edgeType":"contains","source":7517,"target":7920},{"edgeType":"contains","source":5430,"target":4970},{"edgeType":"contains","source":6738,"target":6700},{"edgeType":"contains","source":9642,"target":9696},{"edgeType":"contains","source":13733,"target":13945},{"edgeType":"contains","source":14987,"target":15235},{"edgeType":"imports","source":3761,"target":3394},{"edgeType":"imports","source":3359,"target":3174},{"edgeType":"calls","source":4485,"target":4477},{"edgeType":"contains","source":3830,"target":3833},{"edgeType":"contains","source":6137,"target":6305},{"edgeType":"calls","source":15133,"target":2097},{"edgeType":"contains","source":3628,"target":3751},{"edgeType":"contains","source":1410,"target":2746},{"edgeType":"calls","source":10035,"target":10038},{"edgeType":"contains","source":1246,"target":1488},{"edgeType":"calls","source":15783,"target":15770},{"edgeType":"calls","source":3631,"target":3468},{"edgeType":"contains","source":9754,"target":4109},{"edgeType":"contains","source":13673,"target":13690},{"edgeType":"contains","source":5430,"target":4969},{"edgeType":"contains","source":15850,"target":15966},{"edgeType":"contains","source":8784,"target":8810},{"edgeType":"calls","source":10510,"target":1655},{"edgeType":"contains","source":14202,"target":14203},{"edgeType":"imports","source":13922,"target":13965},{"edgeType":"imports","source":16165,"target":16309},{"edgeType":"contains","source":13733,"target":13927},{"edgeType":"contains","source":15779,"target":16038},{"edgeType":"contains","source":5480,"target":5508},{"edgeType":"contains","source":11083,"target":11513},{"edgeType":"contains","source":592,"target":593},{"edgeType":"calls","source":2105,"target":2180},{"edgeType":"contains","source":9775,"target":9780},{"edgeType":"contains","source":7517,"target":7897},{"edgeType":"calls","source":10638,"target":10343},{"edgeType":"contains","source":1410,"target":2719},{"edgeType":"contains","source":1448,"target":1541},{"edgeType":"calls","source":3032,"target":3041},{"edgeType":"contains","source":3426,"target":3644},{"edgeType":"contains","source":8784,"target":8788},{"edgeType":"imports","source":9754,"target":1523},{"edgeType":"calls","source":15669,"target":2369},{"edgeType":"imports","source":5659,"target":5849},{"edgeType":"calls","source":8384,"target":8337},{"edgeType":"contains","source":3761,"target":3830},{"edgeType":"calls","source":3032,"target":3038},{"edgeType":"contains","source":13733,"target":13925},{"edgeType":"contains","source":10484,"target":2597},{"edgeType":"contains","source":11083,"target":11511},{"edgeType":"contains","source":15779,"target":16040},{"edgeType":"contains","source":3426,"target":3643},{"edgeType":"contains","source":590,"target":657},{"edgeType":"contains","source":8784,"target":8791},{"edgeType":"imports","source":5659,"target":5852},{"edgeType":"contains","source":12151,"target":12229},{"edgeType":"contains","source":1,"target":14687},{"edgeType":"calls","source":1315,"target":1302},{"edgeType":"contains","source":8158,"target":2828},{"edgeType":"contains","source":9775,"target":9778},{"edgeType":"contains","source":15779,"target":16041},{"edgeType":"contains","source":11083,"target":11512},{"edgeType":"calls","source":9066,"target":8337},{"edgeType":"contains","source":592,"target":594},{"edgeType":"contains","source":10435,"target":10459},{"edgeType":"contains","source":14598,"target":14599},{"edgeType":"contains","source":1,"target":16800},{"edgeType":"imports","source":14584,"target":14579},{"edgeType":"contains","source":14927,"target":14970},{"edgeType":"contains","source":9759,"target":8161},{"edgeType":"contains","source":2041,"target":2188},{"edgeType":"contains","source":11083,"target":11509},{"edgeType":"contains","source":14987,"target":15225},{"edgeType":"contains","source":2758,"target":3216},{"edgeType":"contains","source":15779,"target":16042},{"edgeType":"calls","source":9863,"target":2660},{"edgeType":"calls","source":11422,"target":11411},{"edgeType":"calls","source":2107,"target":2114},{"edgeType":"contains","source":8848,"target":8915},{"edgeType":"calls","source":11292,"target":11213},{"edgeType":"contains","source":12151,"target":12227},{"edgeType":"contains","source":7517,"target":7893},{"edgeType":"contains","source":9775,"target":9776},{"edgeType":"calls","source":3032,"target":3036},{"edgeType":"contains","source":11083,"target":11510},{"edgeType":"contains","source":1246,"target":1465},{"edgeType":"calls","source":9047,"target":8928},{"edgeType":"contains","source":2041,"target":2189},{"edgeType":"contains","source":2442,"target":2443},{"edgeType":"contains","source":6736,"target":6737},{"edgeType":"calls","source":6215,"target":5838},{"edgeType":"contains","source":8713,"target":8870},{"edgeType":"contains","source":7517,"target":7894},{"edgeType":"contains","source":9775,"target":9777},{"edgeType":"contains","source":1410,"target":2724},{"edgeType":"contains","source":13733,"target":13921},{"edgeType":"contains","source":11083,"target":11507},{"edgeType":"contains","source":3426,"target":3647},{"edgeType":"contains","source":12413,"target":12559},{"edgeType":"contains","source":6404,"target":6459},{"edgeType":"contains","source":13344,"target":13295},{"edgeType":"contains","source":10632,"target":10689},{"edgeType":"contains","source":8848,"target":8917},{"edgeType":"contains","source":8906,"target":9233},{"edgeType":"contains","source":394,"target":395},{"edgeType":"calls","source":2107,"target":2112},{"edgeType":"contains","source":12150,"target":12256},{"edgeType":"imports","source":10291,"target":10247},{"edgeType":"calls","source":8514,"target":8542},{"edgeType":"calls","source":5014,"target":5015},{"edgeType":"calls","source":787,"target":754},{"edgeType":"contains","source":13670,"target":13759},{"edgeType":"imports","source":3290,"target":3174},{"edgeType":"contains","source":10142,"target":511},{"edgeType":"calls","source":1761,"target":156},{"edgeType":"contains","source":3426,"target":3646},{"edgeType":"contains","source":11083,"target":11508},{"edgeType":"calls","source":5807,"target":5800},{"edgeType":"imports","source":15843,"target":15713},{"edgeType":"contains","source":8784,"target":8786},{"edgeType":"contains","source":10832,"target":10833},{"edgeType":"calls","source":14205,"target":9699},{"edgeType":"contains","source":13670,"target":13758},{"edgeType":"calls","source":3032,"target":3035},{"edgeType":"contains","source":7921,"target":8056},{"edgeType":"calls","source":10647,"target":1615},{"edgeType":"contains","source":7460,"target":7559},{"edgeType":"imports","source":230,"target":801},{"edgeType":"contains","source":2041,"target":2192},{"edgeType":"contains","source":7517,"target":7906},{"edgeType":"contains","source":14531,"target":14550},{"edgeType":"contains","source":5871,"target":6080},{"edgeType":"contains","source":7921,"target":8067},{"edgeType":"contains","source":328,"target":329},{"edgeType":"contains","source":15204,"target":4257},{"edgeType":"calls","source":2371,"target":2382},{"edgeType":"contains","source":1,"target":14694},{"edgeType":"contains","source":6209,"target":6172},{"edgeType":"imports","source":5659,"target":5842},{"edgeType":"contains","source":10436,"target":10438},{"edgeType":"contains","source":10753,"target":611},{"edgeType":"contains","source":16117,"target":16123},{"edgeType":"contains","source":1410,"target":2727},{"edgeType":"imports","source":15251,"target":2349},{"edgeType":"calls","source":3098,"target":3100},{"edgeType":"contains","source":5415,"target":5416},{"edgeType":"contains","source":8848,"target":8926},{"edgeType":"contains","source":14531,"target":14551},{"edgeType":"contains","source":7460,"target":7560},{"edgeType":"contains","source":2442,"target":2447},{"edgeType":"contains","source":127,"target":216},{"edgeType":"contains","source":12153,"target":12176},{"edgeType":"calls","source":10974,"target":10506},{"edgeType":"contains","source":14927,"target":14960},{"edgeType":"contains","source":15654,"target":15677},{"edgeType":"calls","source":6846,"target":1058},{"edgeType":"calls","source":11284,"target":11467},{"edgeType":"contains","source":1410,"target":2728},{"edgeType":"imports","source":13217,"target":12551},{"edgeType":"contains","source":1246,"target":1470},{"edgeType":"contains","source":592,"target":603},{"edgeType":"calls","source":9704,"target":9709},{"edgeType":"contains","source":8647,"target":8818},{"edgeType":"contains","source":2041,"target":2190},{"edgeType":"calls","source":2371,"target":2380},{"edgeType":"calls","source":16318,"target":16085},{"edgeType":"contains","source":13733,"target":13933},{"edgeType":"calls","source":1976,"target":1944},{"edgeType":"contains","source":12153,"target":12175},{"edgeType":"contains","source":12151,"target":12237},{"edgeType":"calls","source":8912,"target":8892},{"edgeType":"contains","source":2442,"target":2444},{"edgeType":"calls","source":1665,"target":1014},{"edgeType":"imports","source":9754,"target":1511},{"edgeType":"contains","source":15654,"target":15678},{"edgeType":"contains","source":11083,"target":11519},{"edgeType":"contains","source":1448,"target":1547},{"edgeType":"contains","source":1410,"target":2725},{"edgeType":"imports","source":2619,"target":733},{"edgeType":"contains","source":14531,"target":14553},{"edgeType":"contains","source":2041,"target":2191},{"edgeType":"contains","source":7517,"target":7909},{"edgeType":"contains","source":2442,"target":2445},{"edgeType":"contains","source":12153,"target":12174},{"edgeType":"contains","source":6404,"target":6473},{"edgeType":"calls","source":9374,"target":9368},{"edgeType":"contains","source":5480,"target":5520},{"edgeType":"calls","source":786,"target":780},{"edgeType":"calls","source":8649,"target":2246},{"edgeType":"contains","source":3628,"target":3731},{"edgeType":"contains","source":15654,"target":15679},{"edgeType":"imports","source":1768,"target":1743},{"edgeType":"contains","source":14531,"target":14554},{"edgeType":"calls","source":11282,"target":3075},{"edgeType":"contains","source":9642,"target":9678},{"edgeType":"contains","source":8848,"target":8923},{"edgeType":"contains","source":2041,"target":2196},{"edgeType":"contains","source":6593,"target":6949},{"edgeType":"contains","source":8647,"target":8812},{"edgeType":"calls","source":787,"target":743},{"edgeType":"calls","source":786,"target":774},{"edgeType":"calls","source":2642,"target":2433},{"edgeType":"contains","source":12153,"target":12173},{"edgeType":"contains","source":12152,"target":12204},{"edgeType":"contains","source":14661,"target":14752},{"edgeType":"contains","source":11083,"target":11517},{"edgeType":"calls","source":9704,"target":9711},{"edgeType":"contains","source":15654,"target":15680},{"edgeType":"contains","source":592,"target":604},{"edgeType":"calls","source":1190,"target":934},{"edgeType":"imports","source":14584,"target":14564},{"edgeType":"calls","source":12962,"target":3847},{"edgeType":"contains","source":10568,"target":10571},{"edgeType":"contains","source":1410,"target":2732},{"edgeType":"contains","source":16117,"target":16126},{"edgeType":"calls","source":1396,"target":890},{"edgeType":"calls","source":1382,"target":1324},{"edgeType":"calls","source":9704,"target":9710},{"edgeType":"contains","source":15654,"target":15681},{"edgeType":"calls","source":16113,"target":16092},{"edgeType":"contains","source":592,"target":607},{"edgeType":"contains","source":4687,"target":4732},{"edgeType":"contains","source":3761,"target":3841},{"edgeType":"contains","source":2041,"target":2194},{"edgeType":"contains","source":2442,"target":2448},{"edgeType":"calls","source":4485,"target":2379},{"edgeType":"contains","source":15204,"target":4264},{"edgeType":"calls","source":2239,"target":2240},{"edgeType":"imports","source":15828,"target":7714},{"edgeType":"contains","source":5624,"target":5279},{"edgeType":"contains","source":11083,"target":11515},{"edgeType":"contains","source":1410,"target":2729},{"edgeType":"calls","source":9704,"target":9713},{"edgeType":"contains","source":15132,"target":14953},{"edgeType":"contains","source":15779,"target":16037},{"edgeType":"contains","source":7460,"target":7558},{"edgeType":"contains","source":592,"target":606},{"edgeType":"imports","source":9696,"target":3315},{"edgeType":"contains","source":2041,"target":2195},{"edgeType":"calls","source":787,"target":744},{"edgeType":"imports","source":5659,"target":5847},{"edgeType":"contains","source":6404,"target":6469},{"edgeType":"contains","source":1410,"target":2730},{"edgeType":"calls","source":1812,"target":680},{"edgeType":"contains","source":9049,"target":9035},{"edgeType":"contains","source":11083,"target":11516},{"edgeType":"contains","source":1246,"target":1472},{"edgeType":"contains","source":1120,"target":1121},{"edgeType":"contains","source":11356,"target":11490},{"edgeType":"contains","source":9179,"target":9212},{"edgeType":"contains","source":13922,"target":14394},{"edgeType":"contains","source":9797,"target":624},{"edgeType":"contains","source":3628,"target":3709},{"edgeType":"contains","source":13276,"target":13279},{"edgeType":"calls","source":916,"target":935},{"edgeType":"contains","source":13540,"target":13551},{"edgeType":"contains","source":5543,"target":5653},{"edgeType":"contains","source":129,"target":131},{"edgeType":"contains","source":8849,"target":8871},{"edgeType":"calls","source":11817,"target":11830},{"edgeType":"calls","source":15602,"target":14999},{"edgeType":"contains","source":2758,"target":3195},{"edgeType":"contains","source":987,"target":1015},{"edgeType":"contains","source":11356,"target":11491},{"edgeType":"contains","source":7132,"target":7133},{"edgeType":"contains","source":7792,"target":7812},{"edgeType":"contains","source":261,"target":266},{"edgeType":"contains","source":1,"target":8326},{"edgeType":"contains","source":7517,"target":7882},{"edgeType":"imports","source":696,"target":1196},{"edgeType":"imports","source":15517,"target":15300},{"edgeType":"calls","source":5161,"target":4642},{"edgeType":"calls","source":12021,"target":11849},{"edgeType":"calls","source":12016,"target":12004},{"edgeType":"contains","source":9192,"target":8807},{"edgeType":"contains","source":1246,"target":1445},{"edgeType":"contains","source":6404,"target":6446},{"edgeType":"imports","source":5659,"target":5899},{"edgeType":"contains","source":7921,"target":8044},{"edgeType":"contains","source":1120,"target":1123},{"edgeType":"calls","source":1395,"target":887},{"edgeType":"contains","source":9179,"target":9214},{"edgeType":"contains","source":1,"target":14671},{"edgeType":"contains","source":1,"target":8329},{"edgeType":"contains","source":261,"target":269},{"edgeType":"calls","source":787,"target":708},{"edgeType":"calls","source":9198,"target":2115},{"edgeType":"contains","source":7792,"target":7815},{"edgeType":"contains","source":13540,"target":13549},{"edgeType":"calls","source":3031,"target":3019},{"edgeType":"contains","source":15264,"target":15076},{"edgeType":"contains","source":63,"target":65},{"edgeType":"calls","source":15531,"target":2404},{"edgeType":"contains","source":6404,"target":6447},{"edgeType":"calls","source":1908,"target":1896},{"edgeType":"contains","source":657,"target":677},{"edgeType":"contains","source":987,"target":1017},{"edgeType":"imports","source":15619,"target":7913},{"edgeType":"contains","source":10698,"target":10745},{"edgeType":"contains","source":10698,"target":10746},{"edgeType":"contains","source":1120,"target":1122},{"edgeType":"contains","source":11356,"target":11489},{"edgeType":"contains","source":9179,"target":9213},{"edgeType":"contains","source":261,"target":268},{"edgeType":"calls","source":787,"target":707},{"edgeType":"contains","source":13540,"target":13548},{"edgeType":"calls","source":850,"target":868},{"edgeType":"contains","source":9797,"target":625},{"edgeType":"contains","source":63,"target":64},{"edgeType":"calls","source":14066,"target":13987},{"edgeType":"calls","source":9047,"target":8910},{"edgeType":"contains","source":6404,"target":6448},{"edgeType":"contains","source":987,"target":1016},{"edgeType":"calls","source":11616,"target":11718},{"edgeType":"contains","source":13540,"target":13547},{"edgeType":"contains","source":11356,"target":11486},{"edgeType":"contains","source":1120,"target":1125},{"edgeType":"contains","source":5430,"target":4931},{"edgeType":"contains","source":11852,"target":6680},{"edgeType":"imports","source":10291,"target":10298},{"edgeType":"contains","source":13733,"target":13906},{"edgeType":"calls","source":6378,"target":4974},{"edgeType":"contains","source":6404,"target":6441},{"edgeType":"contains","source":63,"target":67},{"edgeType":"calls","source":4616,"target":4621},{"edgeType":"contains","source":10303,"target":10304},{"edgeType":"imports","source":696,"target":1190},{"edgeType":"contains","source":9179,"target":9207},{"edgeType":"contains","source":16117,"target":16119},{"edgeType":"contains","source":8849,"target":8867},{"edgeType":"calls","source":2109,"target":2003},{"edgeType":"calls","source":15718,"target":15628},{"edgeType":"contains","source":13540,"target":13546},{"edgeType":"calls","source":8861,"target":8335},{"edgeType":"contains","source":1120,"target":1124},{"edgeType":"contains","source":11356,"target":11487},{"edgeType":"contains","source":7792,"target":7808},{"edgeType":"contains","source":9840,"target":9859},{"edgeType":"contains","source":13733,"target":13905},{"edgeType":"contains","source":10678,"target":794},{"edgeType":"contains","source":63,"target":66},{"edgeType":"contains","source":10426,"target":10720},{"edgeType":"contains","source":15654,"target":15673},{"edgeType":"contains","source":6404,"target":6442},{"edgeType":"imports","source":14195,"target":13997},{"edgeType":"contains","source":8849,"target":8866},{"edgeType":"contains","source":10698,"target":10744},{"edgeType":"contains","source":16117,"target":16118},{"edgeType":"contains","source":13540,"target":13545},{"edgeType":"contains","source":6593,"target":6926},{"edgeType":"contains","source":922,"target":923},{"edgeType":"contains","source":11356,"target":11484},{"edgeType":"contains","source":14531,"target":14548},{"edgeType":"contains","source":13733,"target":13904},{"edgeType":"contains","source":15654,"target":15674},{"edgeType":"imports","source":696,"target":1188},{"edgeType":"contains","source":1246,"target":1446},{"edgeType":"contains","source":63,"target":69},{"edgeType":"contains","source":9179,"target":9209},{"edgeType":"contains","source":11356,"target":11483},{"edgeType":"calls","source":4416,"target":4477},{"edgeType":"contains","source":10698,"target":10741},{"edgeType":"contains","source":13540,"target":13544},{"edgeType":"contains","source":15264,"target":15081},{"edgeType":"contains","source":14531,"target":14549},{"edgeType":"contains","source":1120,"target":1126},{"edgeType":"contains","source":11356,"target":11485},{"edgeType":"contains","source":13733,"target":13903},{"edgeType":"contains","source":10302,"target":10333},{"edgeType":"contains","source":7921,"target":8039},{"edgeType":"contains","source":15654,"target":15675},{"edgeType":"calls","source":4484,"target":4482},{"edgeType":"contains","source":63,"target":68},{"edgeType":"contains","source":5480,"target":5491},{"edgeType":"contains","source":1246,"target":1447},{"edgeType":"contains","source":4352,"target":4521},{"edgeType":"contains","source":6404,"target":6444},{"edgeType":"imports","source":5659,"target":5905},{"edgeType":"contains","source":9179,"target":9208},{"edgeType":"contains","source":10698,"target":10742},{"edgeType":"contains","source":7792,"target":7821},{"edgeType":"calls","source":14793,"target":14717},{"edgeType":"contains","source":10632,"target":10687},{"edgeType":"contains","source":15452,"target":15580},{"edgeType":"calls","source":1853,"target":1477},{"edgeType":"contains","source":8838,"target":9220},{"edgeType":"imports","source":15712,"target":15590},{"edgeType":"contains","source":13670,"target":13757},{"edgeType":"calls","source":10037,"target":1481},{"edgeType":"calls","source":14467,"target":14252},{"edgeType":"contains","source":5877,"target":5878},{"edgeType":"contains","source":63,"target":71},{"edgeType":"contains","source":7792,"target":7820},{"edgeType":"imports","source":5659,"target":5890},{"edgeType":"contains","source":10678,"target":806},{"edgeType":"contains","source":10632,"target":10688},{"edgeType":"contains","source":11083,"target":11506},{"edgeType":"contains","source":1246,"target":1453},{"edgeType":"contains","source":8848,"target":8909},{"edgeType":"calls","source":4557,"target":4331},{"edgeType":"contains","source":7517,"target":7890},{"edgeType":"contains","source":63,"target":70},{"edgeType":"imports","source":6109,"target":2511},{"edgeType":"contains","source":5877,"target":5879},{"edgeType":"contains","source":5943,"target":5947},{"edgeType":"contains","source":9840,"target":9868},{"edgeType":"calls","source":6663,"target":6715},{"edgeType":"calls","source":4943,"target":5048},{"edgeType":"calls","source":6406,"target":6226},{"edgeType":"contains","source":11356,"target":11496},{"edgeType":"contains","source":15452,"target":15582},{"edgeType":"contains","source":657,"target":685},{"edgeType":"contains","source":14465,"target":14468},{"edgeType":"contains","source":7517,"target":7891},{"edgeType":"contains","source":127,"target":203},{"edgeType":"calls","source":9047,"target":8919},{"edgeType":"contains","source":4352,"target":4526},{"edgeType":"contains","source":7792,"target":7822},{"edgeType":"imports","source":5659,"target":5892},{"edgeType":"contains","source":15452,"target":15583},{"edgeType":"contains","source":8848,"target":8912},{"edgeType":"contains","source":9090,"target":1410},{"edgeType":"contains","source":15654,"target":15663},{"edgeType":"imports","source":8837,"target":8848},{"edgeType":"imports","source":5402,"target":5404},{"edgeType":"contains","source":1246,"target":1451},{"edgeType":"contains","source":8838,"target":9221},{"edgeType":"contains","source":14465,"target":14469},{"edgeType":"contains","source":7517,"target":7892},{"edgeType":"contains","source":63,"target":72},{"edgeType":"contains","source":7921,"target":8052},{"edgeType":"contains","source":9179,"target":9216},{"edgeType":"contains","source":11083,"target":11501},{"edgeType":"contains","source":3426,"target":3641},{"edgeType":"calls","source":8294,"target":2666},{"edgeType":"calls","source":7835,"target":2097},{"edgeType":"contains","source":11356,"target":11494},{"edgeType":"contains","source":1246,"target":1456},{"edgeType":"contains","source":657,"target":687},{"edgeType":"contains","source":12087,"target":12089},{"edgeType":"contains","source":16314,"target":16346},{"edgeType":"contains","source":6404,"target":6449},{"edgeType":"contains","source":10171,"target":10176},{"edgeType":"contains","source":127,"target":205},{"edgeType":"calls","source":4730,"target":1079},{"edgeType":"calls","source":4621,"target":2344},{"edgeType":"imports","source":5659,"target":5894},{"edgeType":"contains","source":9179,"target":9215},{"edgeType":"contains","source":7792,"target":7816},{"edgeType":"contains","source":9840,"target":9867},{"edgeType":"contains","source":16117,"target":16109},{"edgeType":"calls","source":6406,"target":6229},{"edgeType":"calls","source":9449,"target":9142},{"edgeType":"contains","source":2758,"target":3209},{"edgeType":"contains","source":11356,"target":11495},{"edgeType":"contains","source":13276,"target":13282},{"edgeType":"calls","source":11620,"target":11608},{"edgeType":"contains","source":1,"target":16794},{"edgeType":"contains","source":657,"target":686},{"edgeType":"contains","source":10678,"target":802},{"edgeType":"contains","source":12087,"target":12088},{"edgeType":"contains","source":127,"target":204},{"edgeType":"contains","source":127,"target":207},{"edgeType":"contains","source":9179,"target":9218},{"edgeType":"contains","source":4352,"target":4530},{"edgeType":"contains","source":9840,"target":9864},{"edgeType":"calls","source":10034,"target":10037},{"edgeType":"contains","source":15747,"target":4327},{"edgeType":"contains","source":11356,"target":11492},{"edgeType":"contains","source":1246,"target":1454},{"edgeType":"calls","source":5675,"target":5607},{"edgeType":"contains","source":11083,"target":11498},{"edgeType":"imports","source":3292,"target":3170},{"edgeType":"calls","source":10452,"target":5535},{"edgeType":"calls","source":730,"target":349},{"edgeType":"contains","source":5943,"target":5944},{"edgeType":"contains","source":12413,"target":12551},{"edgeType":"contains","source":5030,"target":4652},{"edgeType":"contains","source":9179,"target":9217},{"edgeType":"contains","source":7921,"target":8047},{"edgeType":"contains","source":9840,"target":9865},{"edgeType":"contains","source":5659,"target":6292},{"edgeType":"contains","source":7792,"target":7818},{"edgeType":"contains","source":657,"target":689},{"edgeType":"calls","source":10404,"target":680},{"edgeType":"contains","source":987,"target":1029},{"edgeType":"contains","source":2758,"target":3207},{"edgeType":"contains","source":11356,"target":11493},{"edgeType":"contains","source":11852,"target":6687},{"edgeType":"contains","source":657,"target":688},{"edgeType":"contains","source":14987,"target":15203},{"edgeType":"calls","source":2874,"target":1533},{"edgeType":"contains","source":12153,"target":12154},{"edgeType":"contains","source":12707,"target":3436},{"edgeType":"contains","source":127,"target":206},{"edgeType":"contains","source":13076,"target":13120},{"edgeType":"calls","source":11880,"target":11975},{"edgeType":"contains","source":11756,"target":11758},{"edgeType":"contains","source":10235,"target":10285},{"edgeType":"contains","source":1448,"target":1507},{"edgeType":"contains","source":7157,"target":6340},{"edgeType":"contains","source":5023,"target":4843},{"edgeType":"contains","source":8447,"target":8632},{"edgeType":"contains","source":8713,"target":8843},{"edgeType":"calls","source":13534,"target":13553},{"edgeType":"contains","source":4549,"target":4738},{"edgeType":"calls","source":14724,"target":2032},{"edgeType":"contains","source":11356,"target":11473},{"edgeType":"calls","source":16577,"target":16468},{"edgeType":"contains","source":9840,"target":9846},{"edgeType":"contains","source":10302,"target":10323},{"edgeType":"contains","source":11756,"target":11759},{"edgeType":"contains","source":13076,"target":13119},{"edgeType":"contains","source":6404,"target":6429},{"edgeType":"contains","source":11356,"target":11474},{"edgeType":"calls","source":6149,"target":5741},{"edgeType":"contains","source":1780,"target":1787},{"edgeType":"calls","source":1396,"target":869},{"edgeType":"contains","source":7792,"target":7796},{"edgeType":"contains","source":9840,"target":9847},{"edgeType":"calls","source":14815,"target":3438},{"edgeType":"contains","source":9642,"target":9643},{"edgeType":"contains","source":10426,"target":10704},{"edgeType":"imports","source":10291,"target":8161},{"edgeType":"contains","source":8447,"target":8634},{"edgeType":"contains","source":8713,"target":8845},{"edgeType":"contains","source":10831,"target":10834},{"edgeType":"imports","source":5659,"target":5885},{"edgeType":"calls","source":12075,"target":1700},{"edgeType":"contains","source":1780,"target":1784},{"edgeType":"calls","source":14408,"target":13940},{"edgeType":"imports","source":15712,"target":15584},{"edgeType":"contains","source":11356,"target":11471},{"edgeType":"contains","source":6018,"target":5712},{"edgeType":"contains","source":9840,"target":9844},{"edgeType":"calls","source":11087,"target":11187},{"edgeType":"contains","source":7792,"target":7799},{"edgeType":"calls","source":719,"target":719},{"edgeType":"calls","source":4966,"target":2246},{"edgeType":"contains","source":11756,"target":11757},{"edgeType":"calls","source":11880,"target":11974},{"edgeType":"contains","source":15654,"target":15655},{"edgeType":"contains","source":10235,"target":10284},{"edgeType":"calls","source":15847,"target":3162},{"edgeType":"contains","source":6404,"target":6431},{"edgeType":"contains","source":8713,"target":8844},{"edgeType":"contains","source":11356,"target":11472},{"edgeType":"contains","source":1780,"target":1785},{"edgeType":"imports","source":16164,"target":7913},{"edgeType":"contains","source":9840,"target":9845},{"edgeType":"contains","source":14868,"target":14652},{"edgeType":"contains","source":7792,"target":7798},{"edgeType":"contains","source":10426,"target":10702},{"edgeType":"calls","source":14527,"target":14486},{"edgeType":"contains","source":1246,"target":1431},{"edgeType":"contains","source":8447,"target":8628},{"edgeType":"contains","source":5543,"target":5632},{"edgeType":"contains","source":15654,"target":15656},{"edgeType":"imports","source":5659,"target":5887},{"edgeType":"calls","source":9701,"target":5535},{"edgeType":"contains","source":14068,"target":14084},{"edgeType":"contains","source":657,"target":663},{"edgeType":"contains","source":10831,"target":10832},{"edgeType":"contains","source":16054,"target":15941},{"edgeType":"calls","source":12676,"target":12673},{"edgeType":"contains","source":10235,"target":10281},{"edgeType":"contains","source":11852,"target":6663},{"edgeType":"imports","source":14497,"target":8848},{"edgeType":"contains","source":1448,"target":1512},{"edgeType":"contains","source":1780,"target":1790},{"edgeType":"calls","source":8500,"target":4711},{"edgeType":"contains","source":7792,"target":7793},{"edgeType":"contains","source":9840,"target":9842},{"edgeType":"contains","source":10426,"target":10703},{"edgeType":"contains","source":6404,"target":6425},{"edgeType":"contains","source":15779,"target":16010},{"edgeType":"contains","source":8447,"target":8627},{"edgeType":"calls","source":15129,"target":2165},{"edgeType":"contains","source":15654,"target":15657},{"edgeType":"contains","source":4352,"target":4506},{"edgeType":"contains","source":14068,"target":14085},{"edgeType":"calls","source":2179,"target":1964},{"edgeType":"contains","source":8849,"target":8850},{"edgeType":"contains","source":4687,"target":4692},{"edgeType":"calls","source":6913,"target":1058},{"edgeType":"contains","source":12086,"target":12094},{"edgeType":"contains","source":11356,"target":11470},{"edgeType":"contains","source":10235,"target":10282},{"edgeType":"contains","source":1780,"target":1791},{"edgeType":"contains","source":1448,"target":1513},{"edgeType":"contains","source":9840,"target":9843},{"edgeType":"contains","source":657,"target":665},{"edgeType":"contains","source":1448,"target":1509},{"edgeType":"contains","source":8447,"target":8630},{"edgeType":"contains","source":10426,"target":10700},{"edgeType":"contains","source":6404,"target":6426},{"edgeType":"calls","source":4416,"target":2379},{"edgeType":"calls","source":2392,"target":1700},{"edgeType":"contains","source":8778,"target":8940},{"edgeType":"contains","source":15321,"target":612},{"edgeType":"contains","source":14089,"target":7079},{"edgeType":"contains","source":1780,"target":1788},{"edgeType":"contains","source":7792,"target":7795},{"edgeType":"contains","source":15654,"target":15659},{"edgeType":"contains","source":8447,"target":8629},{"edgeType":"contains","source":6404,"target":6427},{"edgeType":"contains","source":1246,"target":1430},{"edgeType":"contains","source":10426,"target":10701},{"edgeType":"calls","source":11282,"target":3033},{"edgeType":"imports","source":5534,"target":5535},{"edgeType":"contains","source":8848,"target":8883},{"edgeType":"contains","source":987,"target":1004},{"edgeType":"calls","source":4943,"target":5068},{"edgeType":"contains","source":1,"target":8315},{"edgeType":"calls","source":15151,"target":14164},{"edgeType":"calls","source":1262,"target":793},{"edgeType":"contains","source":3628,"target":3694},{"edgeType":"contains","source":10235,"target":10280},{"edgeType":"contains","source":9840,"target":9841},{"edgeType":"contains","source":7792,"target":7794},{"edgeType":"contains","source":1780,"target":1789},{"edgeType":"contains","source":7517,"target":7873},{"edgeType":"contains","source":11412,"target":11860},{"edgeType":"contains","source":11852,"target":6676},{"edgeType":"contains","source":10302,"target":10330},{"edgeType":"contains","source":4555,"target":4561},{"edgeType":"contains","source":4352,"target":4511},{"edgeType":"calls","source":787,"target":715},{"edgeType":"contains","source":7792,"target":7805},{"edgeType":"contains","source":10435,"target":10436},{"edgeType":"contains","source":10426,"target":10715},{"edgeType":"calls","source":15707,"target":5394},{"edgeType":"contains","source":1448,"target":1516},{"edgeType":"contains","source":4883,"target":4963},{"edgeType":"contains","source":13076,"target":13128},{"edgeType":"contains","source":1780,"target":1794},{"edgeType":"contains","source":13418,"target":13096},{"edgeType":"contains","source":11356,"target":11481},{"edgeType":"calls","source":12425,"target":9886},{"edgeType":"contains","source":9260,"target":2464},{"edgeType":"contains","source":3366,"target":3367},{"edgeType":"calls","source":3427,"target":3438},{"edgeType":"contains","source":9179,"target":9203},{"edgeType":"contains","source":11083,"target":11488},{"edgeType":"calls","source":16415,"target":358},{"edgeType":"contains","source":657,"target":666},{"edgeType":"contains","source":1246,"target":1436},{"edgeType":"contains","source":13670,"target":13740},{"edgeType":"calls","source":1908,"target":1902},{"edgeType":"contains","source":13540,"target":13542},{"edgeType":"contains","source":4555,"target":4560},{"edgeType":"contains","source":11852,"target":6677},{"edgeType":"calls","source":4753,"target":4613},{"edgeType":"contains","source":13737,"target":13777},{"edgeType":"contains","source":10302,"target":10331},{"edgeType":"contains","source":6137,"target":6258},{"edgeType":"contains","source":987,"target":1006},{"edgeType":"contains","source":7792,"target":7804},{"edgeType":"contains","source":6404,"target":6438},{"edgeType":"calls","source":6759,"target":5836},{"edgeType":"contains","source":10426,"target":10716},{"edgeType":"contains","source":1780,"target":1795},{"edgeType":"contains","source":11356,"target":11482},{"edgeType":"contains","source":1448,"target":1517},{"edgeType":"contains","source":15779,"target":15997},{"edgeType":"contains","source":1246,"target":1433},{"edgeType":"contains","source":8647,"target":8785},{"edgeType":"contains","source":13737,"target":13776},{"edgeType":"calls","source":15604,"target":2246},{"edgeType":"contains","source":13670,"target":13739},{"edgeType":"calls","source":11291,"target":11213},{"edgeType":"calls","source":6759,"target":5837},{"edgeType":"contains","source":14661,"target":14717},{"edgeType":"contains","source":4352,"target":4509},{"edgeType":"contains","source":6137,"target":6259},{"edgeType":"contains","source":1,"target":10435},{"edgeType":"contains","source":9840,"target":9852},{"edgeType":"contains","source":13268,"target":13516},{"edgeType":"contains","source":14927,"target":14928},{"edgeType":"contains","source":6404,"target":6439},{"edgeType":"contains","source":1780,"target":1792},{"edgeType":"contains","source":14068,"target":14074},{"edgeType":"contains","source":8849,"target":8865},{"edgeType":"contains","source":11356,"target":11479},{"edgeType":"contains","source":13922,"target":14372},{"edgeType":"contains","source":1448,"target":1514},{"edgeType":"contains","source":13076,"target":13126},{"edgeType":"contains","source":1246,"target":1434},{"edgeType":"imports","source":14195,"target":13978},{"edgeType":"contains","source":8647,"target":8784},{"edgeType":"contains","source":11852,"target":6675},{"edgeType":"contains","source":10426,"target":10713},{"edgeType":"contains","source":14987,"target":15183},{"edgeType":"contains","source":1,"target":8319},{"edgeType":"contains","source":6404,"target":6440},{"edgeType":"contains","source":987,"target":1008},{"edgeType":"imports","source":5659,"target":5876},{"edgeType":"contains","source":1780,"target":1793},{"edgeType":"contains","source":11356,"target":11480},{"edgeType":"contains","source":13076,"target":13125},{"edgeType":"contains","source":9179,"target":9204},{"edgeType":"contains","source":1448,"target":1515},{"edgeType":"calls","source":15672,"target":2246},{"edgeType":"contains","source":1780,"target":1798},{"edgeType":"contains","source":8778,"target":8946},{"edgeType":"imports","source":10291,"target":8159},{"edgeType":"contains","source":8848,"target":8890},{"edgeType":"contains","source":8906,"target":9206},{"edgeType":"contains","source":13737,"target":13774},{"edgeType":"contains","source":3761,"target":3810},{"edgeType":"contains","source":8713,"target":8847},{"edgeType":"imports","source":12418,"target":3523},{"edgeType":"imports","source":14609,"target":11709},{"edgeType":"contains","source":261,"target":263},{"edgeType":"contains","source":6404,"target":6432},{"edgeType":"contains","source":8447,"target":8636},{"edgeType":"calls","source":2299,"target":349},{"edgeType":"calls","source":2322,"target":1750},{"edgeType":"contains","source":4352,"target":4516},{"edgeType":"contains","source":1448,"target":1520},{"edgeType":"contains","source":7792,"target":7801},{"edgeType":"contains","source":9260,"target":2460},{"edgeType":"contains","source":13076,"target":13124},{"edgeType":"contains","source":11356,"target":11477},{"edgeType":"contains","source":13268,"target":13514},{"edgeType":"calls","source":1315,"target":1254},{"edgeType":"contains","source":8778,"target":8945},{"edgeType":"contains","source":6404,"target":6433},{"edgeType":"contains","source":261,"target":262},{"edgeType":"imports","source":696,"target":1183},{"edgeType":"contains","source":7792,"target":7800},{"edgeType":"contains","source":3638,"target":3394},{"edgeType":"contains","source":11356,"target":11478},{"edgeType":"calls","source":1908,"target":1897},{"edgeType":"contains","source":5480,"target":5481},{"edgeType":"contains","source":8849,"target":8861},{"edgeType":"contains","source":1982,"target":1876},{"edgeType":"contains","source":11756,"target":11760},{"edgeType":"contains","source":1780,"target":1796},{"edgeType":"calls","source":14328,"target":14319},{"edgeType":"contains","source":8647,"target":8781},{"edgeType":"contains","source":261,"target":265},{"edgeType":"contains","source":2041,"target":2161},{"edgeType":"contains","source":6404,"target":6434},{"edgeType":"imports","source":14350,"target":2828},{"edgeType":"contains","source":11356,"target":11475},{"edgeType":"contains","source":9840,"target":9848},{"edgeType":"contains","source":1448,"target":1518},{"edgeType":"calls","source":1344,"target":358},{"edgeType":"contains","source":15452,"target":15569},{"edgeType":"calls","source":3835,"target":3468},{"edgeType":"calls","source":1511,"target":1523},{"edgeType":"contains","source":1246,"target":1438},{"edgeType":"contains","source":10302,"target":10325},{"edgeType":"contains","source":13076,"target":13121},{"edgeType":"contains","source":15786,"target":15787},{"edgeType":"contains","source":7517,"target":7872},{"edgeType":"contains","source":8778,"target":8947},{"edgeType":"calls","source":8122,"target":7985},{"edgeType":"contains","source":11756,"target":11761},{"edgeType":"contains","source":1780,"target":1797},{"edgeType":"contains","source":4555,"target":4562},{"edgeType":"calls","source":12890,"target":3931},{"edgeType":"calls","source":6759,"target":5842},{"edgeType":"contains","source":195,"target":196},{"edgeType":"contains","source":12413,"target":12533},{"edgeType":"imports","source":5659,"target":5880},{"edgeType":"contains","source":9840,"target":9849},{"edgeType":"contains","source":7792,"target":7802},{"edgeType":"contains","source":1448,"target":1519},{"edgeType":"contains","source":3366,"target":3368},{"edgeType":"contains","source":1246,"target":1439},{"edgeType":"contains","source":11356,"target":11476},{"edgeType":"contains","source":6593,"target":6895},{"edgeType":"contains","source":14133,"target":14162},{"edgeType":"contains","source":3233,"target":3236},{"edgeType":"calls","source":1316,"target":1319},{"edgeType":"calls","source":7989,"target":7980},{"edgeType":"contains","source":10118,"target":3325},{"edgeType":"contains","source":3628,"target":3676},{"edgeType":"contains","source":9760,"target":10195},{"edgeType":"contains","source":15452,"target":15555},{"edgeType":"imports","source":15251,"target":2440},{"edgeType":"contains","source":10235,"target":10269},{"edgeType":"contains","source":6259,"target":6679},{"edgeType":"contains","source":6404,"target":6412},{"edgeType":"contains","source":10426,"target":10690},{"edgeType":"contains","source":6593,"target":6896},{"edgeType":"contains","source":13420,"target":13009},{"edgeType":"contains","source":14133,"target":14163},{"edgeType":"contains","source":9760,"target":10196},{"edgeType":"calls","source":10747,"target":702},{"edgeType":"contains","source":7921,"target":8008},{"edgeType":"calls","source":14573,"target":2600},{"edgeType":"imports","source":16238,"target":16240},{"edgeType":"contains","source":10302,"target":10307},{"edgeType":"contains","source":14987,"target":15172},{"edgeType":"contains","source":11083,"target":11464},{"edgeType":"imports","source":12821,"target":12234},{"edgeType":"contains","source":6404,"target":6413},{"edgeType":"contains","source":10426,"target":10691},{"edgeType":"contains","source":3233,"target":3234},{"edgeType":"contains","source":9179,"target":9181},{"edgeType":"contains","source":13733,"target":13875},{"edgeType":"calls","source":14844,"target":540},{"edgeType":"contains","source":11083,"target":11461},{"edgeType":"calls","source":3895,"target":3817},{"edgeType":"imports","source":5659,"target":5935},{"edgeType":"contains","source":6404,"target":6414},{"edgeType":"calls","source":1382,"target":1389},{"edgeType":"contains","source":14133,"target":14165},{"edgeType":"contains","source":14330,"target":14400},{"edgeType":"contains","source":7301,"target":6091},{"edgeType":"contains","source":15452,"target":15558},{"edgeType":"contains","source":3233,"target":3235},{"edgeType":"contains","source":7921,"target":8010},{"edgeType":"contains","source":9760,"target":10194},{"edgeType":"contains","source":11621,"target":11697},{"edgeType":"contains","source":9641,"target":9656},{"edgeType":"imports","source":12378,"target":600},{"edgeType":"contains","source":1448,"target":1490},{"edgeType":"contains","source":10235,"target":10268},{"edgeType":"contains","source":6404,"target":6415},{"edgeType":"contains","source":14133,"target":14166},{"edgeType":"contains","source":14330,"target":14401},{"edgeType":"contains","source":16314,"target":16318},{"edgeType":"contains","source":3761,"target":3785},{"edgeType":"contains","source":11554,"target":11657},{"edgeType":"calls","source":6278,"target":6050},{"edgeType":"contains","source":3233,"target":3240},{"edgeType":"calls","source":5346,"target":5345},{"edgeType":"contains","source":9641,"target":9651},{"edgeType":"contains","source":11621,"target":11694},{"edgeType":"imports","source":15130,"target":4072},{"edgeType":"contains","source":10426,"target":10686},{"edgeType":"contains","source":9760,"target":10191},{"edgeType":"contains","source":14330,"target":14402},{"edgeType":"calls","source":4520,"target":3468},{"edgeType":"contains","source":1,"target":4070},{"edgeType":"contains","source":6404,"target":6408},{"edgeType":"calls","source":14785,"target":2375},{"edgeType":"contains","source":5543,"target":5616},{"edgeType":"calls","source":14896,"target":3162},{"edgeType":"contains","source":14133,"target":14167},{"edgeType":"contains","source":6593,"target":6892},{"edgeType":"calls","source":8847,"target":8868},{"edgeType":"calls","source":3460,"target":389},{"edgeType":"contains","source":3233,"target":3241},{"edgeType":"contains","source":1448,"target":1496},{"edgeType":"contains","source":14330,"target":14403},{"edgeType":"calls","source":15322,"target":15319},{"edgeType":"contains","source":128,"target":132},{"edgeType":"contains","source":5543,"target":5617},{"edgeType":"contains","source":6404,"target":6409},{"edgeType":"calls","source":2373,"target":2375},{"edgeType":"calls","source":14995,"target":2206},{"edgeType":"calls","source":8847,"target":8869},{"edgeType":"contains","source":590,"target":608},{"edgeType":"contains","source":3233,"target":3238},{"edgeType":"contains","source":11621,"target":11692},{"edgeType":"contains","source":15452,"target":15561},{"edgeType":"calls","source":10638,"target":10427},{"edgeType":"contains","source":7921,"target":8007},{"edgeType":"contains","source":10235,"target":10262},{"edgeType":"contains","source":10118,"target":3319},{"edgeType":"contains","source":1876,"target":909},{"edgeType":"calls","source":10037,"target":10035},{"edgeType":"calls","source":10371,"target":10251},{"edgeType":"contains","source":5543,"target":5618},{"edgeType":"calls","source":13802,"target":13819},{"edgeType":"contains","source":10426,"target":10684},{"edgeType":"calls","source":4485,"target":4551},{"edgeType":"contains","source":6404,"target":6410},{"edgeType":"calls","source":11047,"target":10433},{"edgeType":"contains","source":11083,"target":11457},{"edgeType":"contains","source":8906,"target":9183},{"edgeType":"contains","source":14068,"target":14070},{"edgeType":"calls","source":6670,"target":6594},{"edgeType":"contains","source":3233,"target":3239},{"edgeType":"contains","source":11621,"target":11693},{"edgeType":"contains","source":4072,"target":4711},{"edgeType":"contains","source":10235,"target":10263},{"edgeType":"contains","source":13737,"target":13746},{"edgeType":"contains","source":9838,"target":9886},{"edgeType":"contains","source":6259,"target":6678},{"edgeType":"contains","source":1448,"target":1494},{"edgeType":"contains","source":5543,"target":5619},{"edgeType":"contains","source":14330,"target":14405},{"edgeType":"contains","source":6404,"target":6411},{"edgeType":"calls","source":15494,"target":1533},{"edgeType":"contains","source":11083,"target":11458},{"edgeType":"contains","source":6404,"target":6420},{"edgeType":"contains","source":8447,"target":8624},{"edgeType":"contains","source":14257,"target":14538},{"edgeType":"contains","source":9760,"target":10203},{"edgeType":"contains","source":987,"target":991},{"edgeType":"contains","source":3233,"target":3244},{"edgeType":"contains","source":5543,"target":5628},{"edgeType":"contains","source":1448,"target":1499},{"edgeType":"contains","source":7460,"target":7509},{"edgeType":"calls","source":5926,"target":2159},{"edgeType":"contains","source":11621,"target":11706},{"edgeType":"contains","source":5871,"target":6031},{"edgeType":"contains","source":13733,"target":13885},{"edgeType":"imports","source":14182,"target":12316},{"edgeType":"contains","source":7919,"target":8080},{"edgeType":"contains","source":13869,"target":13897},{"edgeType":"contains","source":10235,"target":10277},{"edgeType":"contains","source":15320,"target":612},{"edgeType":"calls","source":16774,"target":16827},{"edgeType":"contains","source":987,"target":990},{"edgeType":"contains","source":16377,"target":16468},{"edgeType":"contains","source":14330,"target":14390},{"edgeType":"contains","source":5543,"target":5629},{"edgeType":"contains","source":1448,"target":1500},{"edgeType":"contains","source":13408,"target":13389},{"edgeType":"calls","source":1384,"target":1316},{"edgeType":"imports","source":7054,"target":7074},{"edgeType":"contains","source":3233,"target":3245},{"edgeType":"calls","source":11688,"target":11710},{"edgeType":"calls","source":10313,"target":9936},{"edgeType":"imports","source":12013,"target":1331},{"edgeType":"contains","source":128,"target":136},{"edgeType":"calls","source":3975,"target":3446},{"edgeType":"calls","source":656,"target":629},{"edgeType":"contains","source":7921,"target":8017},{"edgeType":"contains","source":13869,"target":13896},{"edgeType":"contains","source":14987,"target":15164},{"edgeType":"contains","source":12086,"target":12090},{"edgeType":"contains","source":8447,"target":8626},{"edgeType":"contains","source":10118,"target":3331},{"edgeType":"contains","source":14259,"target":14478},{"edgeType":"calls","source":4943,"target":5147},{"edgeType":"calls","source":3566,"target":3438},{"edgeType":"contains","source":14330,"target":14391},{"edgeType":"contains","source":3233,"target":3242},{"edgeType":"calls","source":6341,"target":6226},{"edgeType":"contains","source":5543,"target":5630},{"edgeType":"contains","source":11356,"target":11463},{"edgeType":"contains","source":6736,"target":6700},{"edgeType":"contains","source":10235,"target":10275},{"edgeType":"contains","source":8447,"target":8625},{"edgeType":"contains","source":10118,"target":3332},{"edgeType":"contains","source":6404,"target":6423},{"edgeType":"contains","source":9760,"target":10202},{"edgeType":"contains","source":987,"target":992},{"edgeType":"contains","source":14330,"target":14392},{"edgeType":"contains","source":3233,"target":3243},{"edgeType":"contains","source":1448,"target":1498},{"edgeType":"calls","source":4553,"target":4552},{"edgeType":"contains","source":13733,"target":13882},{"edgeType":"contains","source":7921,"target":8019},{"edgeType":"contains","source":10302,"target":10313},{"edgeType":"contains","source":14799,"target":14652},{"edgeType":"contains","source":7201,"target":7078},{"edgeType":"contains","source":855,"target":859},{"edgeType":"contains","source":14133,"target":14158},{"edgeType":"calls","source":15605,"target":15009},{"edgeType":"contains","source":7921,"target":8013},{"edgeType":"contains","source":14330,"target":14393},{"edgeType":"contains","source":10118,"target":3329},{"edgeType":"contains","source":9760,"target":10199},{"edgeType":"imports","source":14916,"target":14926},{"edgeType":"contains","source":11083,"target":11468},{"edgeType":"calls","source":1786,"target":1535},{"edgeType":"contains","source":10235,"target":10273},{"edgeType":"contains","source":11621,"target":11702},{"edgeType":"contains","source":1780,"target":1782},{"edgeType":"contains","source":13733,"target":13881},{"edgeType":"contains","source":12086,"target":12087},{"edgeType":"imports","source":16238,"target":16227},{"edgeType":"contains","source":6404,"target":6416},{"edgeType":"contains","source":10302,"target":10310},{"edgeType":"contains","source":8447,"target":8620},{"edgeType":"imports","source":7054,"target":7078},{"edgeType":"contains","source":987,"target":994},{"edgeType":"contains","source":1448,"target":1504},{"edgeType":"calls","source":6341,"target":6229},{"edgeType":"calls","source":9300,"target":5404},{"edgeType":"contains","source":11083,"target":11469},{"edgeType":"contains","source":11356,"target":11462},{"edgeType":"contains","source":11621,"target":11703},{"edgeType":"contains","source":9641,"target":9658},{"edgeType":"contains","source":1780,"target":1783},{"edgeType":"contains","source":8848,"target":8872},{"edgeType":"contains","source":4547,"target":4795},{"edgeType":"contains","source":4528,"target":3270},{"edgeType":"calls","source":6210,"target":6034},{"edgeType":"contains","source":6593,"target":6900},{"edgeType":"calls","source":4487,"target":4482},{"edgeType":"contains","source":9179,"target":9185},{"edgeType":"contains","source":855,"target":861},{"edgeType":"contains","source":9760,"target":10197},{"edgeType":"imports","source":13217,"target":12631},{"edgeType":"contains","source":3233,"target":3246},{"edgeType":"contains","source":5543,"target":5626},{"edgeType":"contains","source":7460,"target":7507},{"edgeType":"contains","source":5166,"target":4632},{"edgeType":"calls","source":13717,"target":12234},{"edgeType":"contains","source":10302,"target":10308},{"edgeType":"contains","source":13733,"target":13879},{"edgeType":"imports","source":15649,"target":15460},{"edgeType":"contains","source":6137,"target":6239},{"edgeType":"contains","source":11083,"target":11465},{"edgeType":"contains","source":2758,"target":3172},{"edgeType":"calls","source":2468,"target":1533},{"edgeType":"contains","source":6593,"target":6901},{"edgeType":"contains","source":12152,"target":12153},{"edgeType":"contains","source":14330,"target":14396},{"edgeType":"imports","source":5659,"target":5931},{"edgeType":"calls","source":6346,"target":6076},{"edgeType":"contains","source":9760,"target":10198},{"edgeType":"contains","source":5543,"target":5627},{"edgeType":"contains","source":10302,"target":10309},{"edgeType":"contains","source":10235,"target":10272},{"edgeType":"calls","source":5347,"target":5302},{"edgeType":"contains","source":9641,"target":9660},{"edgeType":"contains","source":14330,"target":14397},{"edgeType":"contains","source":6593,"target":6902},{"edgeType":"contains","source":14259,"target":14484},{"edgeType":"calls","source":2462,"target":1720},{"edgeType":"contains","source":6404,"target":6419},{"edgeType":"imports","source":8158,"target":2440},{"edgeType":"contains","source":5543,"target":5603},{"edgeType":"contains","source":13869,"target":13873},{"edgeType":"contains","source":1448,"target":1474},{"edgeType":"calls","source":193,"target":209},{"edgeType":"contains","source":3364,"target":3387},{"edgeType":"contains","source":8447,"target":8599},{"edgeType":"contains","source":16377,"target":16461},{"edgeType":"contains","source":14133,"target":14146},{"edgeType":"imports","source":4242,"target":3333},{"edgeType":"contains","source":5743,"target":5746},{"edgeType":"contains","source":9838,"target":9875},{"edgeType":"contains","source":11184,"target":12544},{"edgeType":"contains","source":6073,"target":6086},{"edgeType":"contains","source":15452,"target":15538},{"edgeType":"contains","source":5543,"target":5604},{"edgeType":"contains","source":13009,"target":13049},{"edgeType":"contains","source":15058,"target":15069},{"edgeType":"imports","source":14916,"target":14921},{"edgeType":"contains","source":10426,"target":10674},{"edgeType":"contains","source":10698,"target":10699},{"edgeType":"contains","source":14133,"target":14147},{"edgeType":"contains","source":16049,"target":16058},{"edgeType":"calls","source":14463,"target":14449},{"edgeType":"contains","source":9838,"target":9876},{"edgeType":"contains","source":7921,"target":7992},{"edgeType":"contains","source":13539,"target":13531},{"edgeType":"contains","source":15452,"target":15539},{"edgeType":"contains","source":5543,"target":5605},{"edgeType":"contains","source":15058,"target":15070},{"edgeType":"contains","source":590,"target":591},{"edgeType":"imports","source":9854,"target":600},{"edgeType":"contains","source":16377,"target":16463},{"edgeType":"contains","source":6593,"target":6881},{"edgeType":"contains","source":7301,"target":6073},{"edgeType":"contains","source":15452,"target":15540},{"edgeType":"calls","source":1316,"target":1337},{"edgeType":"contains","source":8158,"target":2762},{"edgeType":"contains","source":7460,"target":7486},{"edgeType":"contains","source":9754,"target":10363},{"edgeType":"contains","source":13733,"target":13858},{"edgeType":"calls","source":16118,"target":16000},{"edgeType":"imports","source":2616,"target":883},{"edgeType":"contains","source":5543,"target":5606},{"edgeType":"contains","source":10426,"target":10672},{"edgeType":"calls","source":3033,"target":3074},{"edgeType":"contains","source":10291,"target":10629},{"edgeType":"contains","source":15003,"target":14662},{"edgeType":"contains","source":5227,"target":4825},{"edgeType":"contains","source":14257,"target":14533},{"edgeType":"contains","source":14330,"target":14384},{"edgeType":"contains","source":16377,"target":16462},{"edgeType":"contains","source":13539,"target":13529},{"edgeType":"contains","source":14662,"target":14663},{"edgeType":"contains","source":9838,"target":9874},{"edgeType":"contains","source":7460,"target":7487},{"edgeType":"contains","source":9754,"target":10364},{"edgeType":"imports","source":16238,"target":16222},{"edgeType":"contains","source":5676,"target":5704},{"edgeType":"contains","source":9754,"target":10360},{"edgeType":"contains","source":16377,"target":16465},{"edgeType":"calls","source":13761,"target":12962},{"edgeType":"contains","source":5543,"target":5599},{"edgeType":"calls","source":7165,"target":6028},{"edgeType":"imports","source":7054,"target":7071},{"edgeType":"calls","source":3626,"target":3715},{"edgeType":"contains","source":14133,"target":14150},{"edgeType":"contains","source":14330,"target":14385},{"edgeType":"contains","source":14257,"target":14534},{"edgeType":"imports","source":6212,"target":5690},{"edgeType":"contains","source":6593,"target":6874},{"edgeType":"calls","source":1251,"target":1232},{"edgeType":"contains","source":6137,"target":6212},{"edgeType":"contains","source":5676,"target":5705},{"edgeType":"contains","source":9760,"target":10175},{"edgeType":"contains","source":9754,"target":10361},{"edgeType":"contains","source":14330,"target":14386},{"edgeType":"contains","source":13142,"target":13150},{"edgeType":"contains","source":5543,"target":5600},{"edgeType":"contains","source":590,"target":592},{"edgeType":"contains","source":16377,"target":16464},{"edgeType":"contains","source":14133,"target":14151},{"edgeType":"calls","source":1382,"target":1398},{"edgeType":"calls","source":14201,"target":14119},{"edgeType":"contains","source":15452,"target":15543},{"edgeType":"contains","source":13469,"target":13583},{"edgeType":"imports","source":13922,"target":14021},{"edgeType":"calls","source":6272,"target":6251},{"edgeType":"calls","source":8847,"target":8852},{"edgeType":"calls","source":6848,"target":1058},{"edgeType":"calls","source":6762,"target":5838},{"edgeType":"imports","source":10244,"target":3315},{"edgeType":"calls","source":794,"target":600},{"edgeType":"contains","source":1448,"target":1480},{"edgeType":"contains","source":7993,"target":7870},{"edgeType":"contains","source":9754,"target":10362},{"edgeType":"calls","source":3100,"target":3106},{"edgeType":"contains","source":14330,"target":14387},{"edgeType":"calls","source":14921,"target":2369},{"edgeType":"calls","source":16048,"target":16052},{"edgeType":"contains","source":8447,"target":8597},{"edgeType":"contains","source":5543,"target":5601},{"edgeType":"imports","source":14916,"target":14920},{"edgeType":"calls","source":4428,"target":2106},{"edgeType":"contains","source":590,"target":595},{"edgeType":"contains","source":14259,"target":14474},{"edgeType":"contains","source":14257,"target":14536},{"edgeType":"imports","source":11679,"target":11680},{"edgeType":"contains","source":8158,"target":2758},{"edgeType":"contains","source":1974,"target":2083},{"edgeType":"contains","source":3628,"target":3662},{"edgeType":"contains","source":5743,"target":5744},{"edgeType":"calls","source":14383,"target":2134},{"edgeType":"contains","source":7921,"target":7991},{"edgeType":"contains","source":6073,"target":6084},{"edgeType":"calls","source":3033,"target":3069},{"edgeType":"contains","source":14987,"target":15162},{"edgeType":"contains","source":9838,"target":9869},{"edgeType":"contains","source":14257,"target":14537},{"edgeType":"contains","source":9754,"target":10359},{"edgeType":"contains","source":5543,"target":5602},{"edgeType":"contains","source":10426,"target":10668},{"edgeType":"contains","source":13076,"target":13080},{"edgeType":"calls","source":6152,"target":5741},{"edgeType":"imports","source":9754,"target":1591},{"edgeType":"calls","source":3977,"target":3403},{"edgeType":"contains","source":6593,"target":6877},{"edgeType":"contains","source":7852,"target":8015},{"edgeType":"contains","source":6073,"target":6085},{"edgeType":"imports","source":8906,"target":2510},{"edgeType":"contains","source":13733,"target":13853},{"edgeType":"calls","source":6346,"target":6052},{"edgeType":"calls","source":5016,"target":5018},{"edgeType":"contains","source":7921,"target":7990},{"edgeType":"contains","source":15058,"target":2375},{"edgeType":"contains","source":11621,"target":11690},{"edgeType":"contains","source":13539,"target":13541},{"edgeType":"calls","source":6750,"target":6213},{"edgeType":"contains","source":10426,"target":10681},{"edgeType":"contains","source":15058,"target":15060},{"edgeType":"contains","source":392,"target":393},{"edgeType":"imports","source":10244,"target":3303},{"edgeType":"contains","source":10426,"target":10682},{"edgeType":"contains","source":7852,"target":8026},{"edgeType":"contains","source":9754,"target":10373},{"edgeType":"imports","source":5659,"target":5908},{"edgeType":"calls","source":10241,"target":10038},{"edgeType":"contains","source":16049,"target":16051},{"edgeType":"contains","source":1448,"target":1483},{"edgeType":"contains","source":3364,"target":3396},{"edgeType":"contains","source":11621,"target":11691},{"edgeType":"contains","source":2758,"target":3155},{"edgeType":"contains","source":13733,"target":13868},{"edgeType":"contains","source":11852,"target":6644},{"edgeType":"contains","source":6593,"target":6888},{"edgeType":"imports","source":15762,"target":7714},{"edgeType":"calls","source":8847,"target":8856},{"edgeType":"imports","source":6212,"target":5676},{"edgeType":"imports","source":10291,"target":10301},{"edgeType":"contains","source":6404,"target":6405},{"edgeType":"contains","source":7852,"target":8025},{"edgeType":"calls","source":3627,"target":3680},{"edgeType":"contains","source":5543,"target":5613},{"edgeType":"contains","source":15779,"target":15964},{"edgeType":"calls","source":1620,"target":358},{"edgeType":"contains","source":16238,"target":16533},{"edgeType":"contains","source":16049,"target":16050},{"edgeType":"contains","source":10235,"target":10258},{"edgeType":"contains","source":3364,"target":3393},{"edgeType":"contains","source":7460,"target":7495},{"edgeType":"contains","source":13009,"target":13056},{"edgeType":"imports","source":4170,"target":1330},{"edgeType":"imports","source":10291,"target":10300},{"edgeType":"imports","source":4228,"target":3760},{"edgeType":"calls","source":6600,"target":6637},{"edgeType":"contains","source":16377,"target":16455},{"edgeType":"calls","source":15997,"target":15531},{"edgeType":"contains","source":5543,"target":5614},{"edgeType":"contains","source":16049,"target":16053},{"edgeType":"calls","source":986,"target":989},{"edgeType":"calls","source":11817,"target":7692},{"edgeType":"contains","source":11621,"target":11689},{"edgeType":"calls","source":4762,"target":4431},{"edgeType":"calls","source":1977,"target":1978},{"edgeType":"contains","source":10291,"target":10637},{"edgeType":"contains","source":7852,"target":8027},{"edgeType":"contains","source":16238,"target":16535},{"edgeType":"contains","source":5543,"target":5615},{"edgeType":"calls","source":13967,"target":4463},{"edgeType":"contains","source":10291,"target":10634},{"edgeType":"contains","source":10235,"target":10256},{"edgeType":"contains","source":11852,"target":6639},{"edgeType":"imports","source":13733,"target":13529},{"edgeType":"contains","source":11184,"target":1978},{"edgeType":"calls","source":6600,"target":6639},{"edgeType":"calls","source":4223,"target":4227},{"edgeType":"contains","source":7921,"target":7997},{"edgeType":"contains","source":15452,"target":15534},{"edgeType":"imports","source":15318,"target":15132},{"edgeType":"contains","source":7460,"target":7488},{"edgeType":"contains","source":1246,"target":1407},{"edgeType":"contains","source":10235,"target":10257},{"edgeType":"contains","source":1,"target":16745},{"edgeType":"calls","source":2286,"target":852},{"edgeType":"contains","source":10632,"target":10635},{"edgeType":"contains","source":15517,"target":15634},{"edgeType":"contains","source":14257,"target":14527},{"edgeType":"contains","source":11083,"target":11452},{"edgeType":"contains","source":15452,"target":15535},{"edgeType":"contains","source":7460,"target":7489},{"edgeType":"contains","source":9641,"target":9645},{"edgeType":"contains","source":6593,"target":6885},{"edgeType":"contains","source":10426,"target":10675},{"edgeType":"contains","source":15517,"target":15635},{"edgeType":"contains","source":8841,"target":620},{"edgeType":"contains","source":7852,"target":8024},{"edgeType":"imports","source":15636,"target":3162},{"edgeType":"contains","source":5543,"target":5610},{"edgeType":"contains","source":10291,"target":10633},{"edgeType":"contains","source":7460,"target":7492},{"edgeType":"contains","source":10235,"target":10255},{"edgeType":"contains","source":11184,"target":1977},{"edgeType":"contains","source":5941,"target":5957},{"edgeType":"contains","source":14259,"target":14467},{"edgeType":"contains","source":6593,"target":6886},{"edgeType":"contains","source":10426,"target":10676},{"edgeType":"calls","source":3702,"target":1349},{"edgeType":"calls","source":2178,"target":2084},{"edgeType":"contains","source":5543,"target":5611},{"edgeType":"imports","source":15649,"target":2758},{"edgeType":"contains","source":15452,"target":15537},{"edgeType":"contains","source":7460,"target":7491},{"edgeType":"contains","source":6593,"target":6862},{"edgeType":"contains","source":11554,"target":11628},{"edgeType":"calls","source":2462,"target":1700},{"edgeType":"calls","source":14066,"target":14057},{"edgeType":"contains","source":15452,"target":15522},{"edgeType":"calls","source":850,"target":933},{"edgeType":"contains","source":6271,"target":6274},{"edgeType":"contains","source":6267,"target":6398},{"edgeType":"calls","source":6336,"target":6338},{"edgeType":"contains","source":4352,"target":4454},{"edgeType":"calls","source":7129,"target":7124},{"edgeType":"contains","source":10895,"target":10916},{"edgeType":"contains","source":10832,"target":2299},{"edgeType":"contains","source":14502,"target":9033},{"edgeType":"contains","source":6593,"target":6863},{"edgeType":"imports","source":14257,"target":14259},{"edgeType":"contains","source":11226,"target":11227},{"edgeType":"contains","source":4352,"target":4453},{"edgeType":"contains","source":3628,"target":3642},{"edgeType":"contains","source":1448,"target":1459},{"edgeType":"contains","source":6267,"target":6399},{"edgeType":"contains","source":14987,"target":15139},{"edgeType":"contains","source":13009,"target":13032},{"edgeType":"contains","source":10895,"target":10917},{"edgeType":"imports","source":15581,"target":15496},{"edgeType":"contains","source":10762,"target":10812},{"edgeType":"contains","source":5880,"target":5712},{"edgeType":"contains","source":9376,"target":9383},{"edgeType":"contains","source":1,"target":16719},{"edgeType":"calls","source":1316,"target":1288},{"edgeType":"contains","source":4549,"target":4687},{"edgeType":"contains","source":9503,"target":9674},{"edgeType":"contains","source":11556,"target":11564},{"edgeType":"calls","source":5014,"target":5035},{"edgeType":"contains","source":5543,"target":5589},{"edgeType":"contains","source":12469,"target":12859},{"edgeType":"contains","source":4352,"target":4452},{"edgeType":"contains","source":6267,"target":6400},{"edgeType":"imports","source":14871,"target":7913},{"edgeType":"contains","source":10291,"target":10612},{"edgeType":"calls","source":5741,"target":5753},{"edgeType":"contains","source":10895,"target":10914},{"edgeType":"calls","source":3460,"target":358},{"edgeType":"contains","source":9376,"target":9382},{"edgeType":"contains","source":15740,"target":2369},{"edgeType":"contains","source":5543,"target":5590},{"edgeType":"contains","source":10426,"target":10656},{"edgeType":"contains","source":4352,"target":4451},{"edgeType":"calls","source":11233,"target":10973},{"edgeType":"contains","source":3694,"target":3708},{"edgeType":"contains","source":10291,"target":10613},{"edgeType":"contains","source":6267,"target":6401},{"edgeType":"contains","source":10895,"target":10915},{"edgeType":"contains","source":6593,"target":6865},{"edgeType":"contains","source":12810,"target":12857},{"edgeType":"contains","source":14330,"target":14368},{"edgeType":"contains","source":15452,"target":15526},{"edgeType":"contains","source":5082,"target":5083},{"edgeType":"contains","source":9376,"target":9377},{"edgeType":"contains","source":11556,"target":11562},{"edgeType":"calls","source":656,"target":601},{"edgeType":"contains","source":15740,"target":2370},{"edgeType":"contains","source":3760,"target":3783},{"edgeType":"contains","source":6402,"target":6437},{"edgeType":"contains","source":12415,"target":12417},{"edgeType":"calls","source":9704,"target":9752},{"edgeType":"contains","source":4352,"target":2344},{"edgeType":"contains","source":13009,"target":13029},{"edgeType":"imports","source":3628,"target":3394},{"edgeType":"calls","source":5741,"target":5751},{"edgeType":"contains","source":11083,"target":11426},{"edgeType":"calls","source":9243,"target":9245},{"edgeType":"contains","source":8778,"target":8887},{"edgeType":"contains","source":10762,"target":10808},{"edgeType":"contains","source":8838,"target":9141},{"edgeType":"contains","source":6593,"target":6859},{"edgeType":"contains","source":11556,"target":11563},{"edgeType":"calls","source":12679,"target":12661},{"edgeType":"contains","source":13416,"target":13096},{"edgeType":"contains","source":10291,"target":10610},{"edgeType":"contains","source":13670,"target":13678},{"edgeType":"calls","source":5094,"target":4666},{"edgeType":"contains","source":2758,"target":3134},{"edgeType":"contains","source":127,"target":130},{"edgeType":"contains","source":6259,"target":6643},{"edgeType":"contains","source":6267,"target":6395},{"edgeType":"contains","source":4072,"target":4681},{"edgeType":"contains","source":1246,"target":1383},{"edgeType":"calls","source":14000,"target":5535},{"edgeType":"contains","source":12415,"target":12416},{"edgeType":"contains","source":4352,"target":4457},{"edgeType":"imports","source":12151,"target":3436},{"edgeType":"imports","source":5659,"target":5969},{"edgeType":"contains","source":8906,"target":9147},{"edgeType":"contains","source":13009,"target":13028},{"edgeType":"contains","source":10895,"target":10913},{"edgeType":"contains","source":16238,"target":16529},{"edgeType":"contains","source":11556,"target":11560},{"edgeType":"contains","source":7856,"target":7875},{"edgeType":"calls","source":15192,"target":2404},{"edgeType":"contains","source":3760,"target":3781},{"edgeType":"contains","source":1448,"target":1460},{"edgeType":"contains","source":10499,"target":10502},{"edgeType":"contains","source":6271,"target":6272},{"edgeType":"contains","source":13349,"target":13057},{"edgeType":"contains","source":1,"target":16723},{"edgeType":"calls","source":9511,"target":9395},{"edgeType":"contains","source":16238,"target":16532},{"edgeType":"contains","source":2758,"target":3131},{"edgeType":"contains","source":6593,"target":6861},{"edgeType":"contains","source":8778,"target":8889},{"edgeType":"contains","source":11556,"target":11561},{"edgeType":"contains","source":7743,"target":808},{"edgeType":"contains","source":7856,"target":7874},{"edgeType":"contains","source":10291,"target":10608},{"edgeType":"contains","source":3760,"target":3780},{"edgeType":"calls","source":12216,"target":12215},{"edgeType":"contains","source":6271,"target":6273},{"edgeType":"contains","source":4157,"target":4158},{"edgeType":"contains","source":8319,"target":8320},{"edgeType":"contains","source":4352,"target":4455},{"edgeType":"calls","source":9704,"target":9753},{"edgeType":"calls","source":3974,"target":3446},{"edgeType":"contains","source":16238,"target":16531},{"edgeType":"calls","source":1847,"target":1734},{"edgeType":"imports","source":15649,"target":15500},{"edgeType":"calls","source":9111,"target":9110},{"edgeType":"contains","source":14067,"target":14069},{"edgeType":"contains","source":5082,"target":5087},{"edgeType":"imports","source":13922,"target":14066},{"edgeType":"calls","source":3627,"target":3630},{"edgeType":"calls","source":850,"target":925},{"edgeType":"contains","source":16510,"target":16541},{"edgeType":"contains","source":3562,"target":3583},{"edgeType":"contains","source":13469,"target":13580},{"edgeType":"contains","source":5543,"target":5595},{"edgeType":"contains","source":12810,"target":12868},{"edgeType":"calls","source":1190,"target":956},{"edgeType":"calls","source":10102,"target":10103},{"edgeType":"contains","source":1448,"target":1466},{"edgeType":"calls","source":7759,"target":286},{"edgeType":"contains","source":6271,"target":6282},{"edgeType":"contains","source":127,"target":135},{"edgeType":"contains","source":16510,"target":16542},{"edgeType":"contains","source":4157,"target":4165},{"edgeType":"contains","source":5082,"target":5086},{"edgeType":"imports","source":13922,"target":14067},{"edgeType":"contains","source":10426,"target":10666},{"edgeType":"contains","source":16510,"target":16540},{"edgeType":"contains","source":12810,"target":12867},{"edgeType":"contains","source":5543,"target":5596},{"edgeType":"contains","source":13009,"target":13041},{"edgeType":"contains","source":11554,"target":11637},{"edgeType":"contains","source":4157,"target":4164},{"edgeType":"contains","source":13733,"target":13851},{"edgeType":"calls","source":2372,"target":2369},{"edgeType":"contains","source":6271,"target":6283},{"edgeType":"calls","source":4246,"target":3468},{"edgeType":"calls","source":850,"target":927},{"edgeType":"contains","source":5082,"target":5085},{"edgeType":"calls","source":5741,"target":5745},{"edgeType":"contains","source":5676,"target":5702},{"edgeType":"contains","source":5543,"target":5597},{"edgeType":"contains","source":13142,"target":13145},{"edgeType":"contains","source":11556,"target":11572},{"edgeType":"contains","source":14661,"target":14668},{"edgeType":"contains","source":4157,"target":4163},{"edgeType":"contains","source":1246,"target":1384},{"edgeType":"contains","source":1974,"target":2071},{"edgeType":"calls","source":3958,"target":3937},{"edgeType":"contains","source":16510,"target":16544},{"edgeType":"calls","source":7160,"target":6173},{"edgeType":"contains","source":4352,"target":4460},{"edgeType":"calls","source":2239,"target":2261},{"edgeType":"contains","source":6271,"target":6284},{"edgeType":"contains","source":3760,"target":3784},{"edgeType":"calls","source":6745,"target":2126},{"edgeType":"calls","source":11289,"target":11359},{"edgeType":"contains","source":5082,"target":5084},{"edgeType":"contains","source":5543,"target":5598},{"edgeType":"contains","source":13142,"target":13144},{"edgeType":"calls","source":7988,"target":7989},{"edgeType":"contains","source":3562,"target":3580},{"edgeType":"calls","source":10173,"target":1561},{"edgeType":"contains","source":11556,"target":11573},{"edgeType":"contains","source":1974,"target":2072},{"edgeType":"contains","source":10762,"target":10818},{"edgeType":"calls","source":9111,"target":9114},{"edgeType":"contains","source":16510,"target":16543},{"edgeType":"calls","source":6175,"target":4974},{"edgeType":"calls","source":15096,"target":5394},{"edgeType":"contains","source":5941,"target":5945},{"edgeType":"calls","source":4486,"target":4482},{"edgeType":"imports","source":15649,"target":15496},{"edgeType":"imports","source":5659,"target":5961},{"edgeType":"contains","source":3562,"target":3587},{"edgeType":"contains","source":854,"target":857},{"edgeType":"contains","source":16291,"target":16992},{"edgeType":"contains","source":13142,"target":13143},{"edgeType":"contains","source":11226,"target":11230},{"edgeType":"contains","source":5082,"target":5091},{"edgeType":"contains","source":9376,"target":9385},{"edgeType":"contains","source":11556,"target":11570},{"edgeType":"contains","source":9503,"target":9676},{"edgeType":"contains","source":13733,"target":13848},{"edgeType":"calls","source":5441,"target":2358},{"edgeType":"contains","source":6271,"target":6278},{"edgeType":"contains","source":11083,"target":11434},{"edgeType":"contains","source":6073,"target":6074},{"edgeType":"contains","source":15740,"target":2361},{"edgeType":"contains","source":10762,"target":10815},{"edgeType":"calls","source":10817,"target":626},{"edgeType":"calls","source":2716,"target":156},{"edgeType":"contains","source":6593,"target":6866},{"edgeType":"contains","source":3562,"target":3586},{"edgeType":"contains","source":12810,"target":12863},{"edgeType":"calls","source":3032,"target":3045},{"edgeType":"contains","source":854,"target":856},{"edgeType":"contains","source":14259,"target":14448},{"edgeType":"contains","source":16291,"target":16991},{"edgeType":"contains","source":9376,"target":9384},{"edgeType":"calls","source":11622,"target":11613},{"edgeType":"contains","source":6073,"target":6075},{"edgeType":"calls","source":3907,"target":3403},{"edgeType":"contains","source":8120,"target":8153},{"edgeType":"calls","source":11285,"target":3033},{"edgeType":"contains","source":3841,"target":3394},{"edgeType":"calls","source":15164,"target":5394},{"edgeType":"calls","source":2456,"target":1875},{"edgeType":"contains","source":5082,"target":5089},{"edgeType":"contains","source":12815,"target":12707},{"edgeType":"contains","source":1448,"target":1468},{"edgeType":"contains","source":5676,"target":5698},{"edgeType":"contains","source":11226,"target":11228},{"edgeType":"contains","source":5543,"target":5593},{"edgeType":"contains","source":9376,"target":9387},{"edgeType":"contains","source":13469,"target":13574},{"edgeType":"contains","source":8120,"target":8156},{"edgeType":"contains","source":6007,"target":6008},{"edgeType":"contains","source":11083,"target":11432},{"edgeType":"contains","source":11091,"target":11184},{"edgeType":"contains","source":5082,"target":5088},{"edgeType":"contains","source":16291,"target":16993},{"edgeType":"contains","source":693,"target":1621},{"edgeType":"contains","source":1448,"target":1469},{"edgeType":"contains","source":3562,"target":3584},{"edgeType":"contains","source":5676,"target":5699},{"edgeType":"contains","source":11226,"target":11229},{"edgeType":"contains","source":9503,"target":9677},{"edgeType":"contains","source":5543,"target":5594},{"edgeType":"contains","source":9376,"target":9386},{"edgeType":"calls","source":6916,"target":1058},{"edgeType":"contains","source":1974,"target":2076},{"edgeType":"contains","source":13733,"target":13845},{"edgeType":"contains","source":11083,"target":11433},{"edgeType":"contains","source":6007,"target":6009},{"edgeType":"contains","source":2041,"target":2113},{"edgeType":"contains","source":10762,"target":10814},{"edgeType":"calls","source":6562,"target":5690},{"edgeType":"contains","source":4352,"target":2323},{"edgeType":"calls","source":12008,"target":12301},{"edgeType":"contains","source":6402,"target":6424},{"edgeType":"contains","source":10550,"target":11024},{"edgeType":"calls","source":11289,"target":11335},{"edgeType":"contains","source":10763,"target":10764},{"edgeType":"calls","source":13789,"target":3600},{"edgeType":"calls","source":1786,"target":1531},{"edgeType":"contains","source":8781,"target":8783},{"edgeType":"calls","source":9507,"target":9496},{"edgeType":"contains","source":12018,"target":12027},{"edgeType":"contains","source":14195,"target":14305},{"edgeType":"contains","source":11621,"target":11648},{"edgeType":"contains","source":3694,"target":3695},{"edgeType":"contains","source":6138,"target":6152},{"edgeType":"contains","source":6267,"target":6382},{"edgeType":"imports","source":5871,"target":5718},{"edgeType":"contains","source":8781,"target":8782},{"edgeType":"contains","source":10763,"target":10765},{"edgeType":"calls","source":1892,"target":358},{"edgeType":"imports","source":10378,"target":9760},{"edgeType":"contains","source":13469,"target":13554},{"edgeType":"contains","source":12018,"target":12026},{"edgeType":"contains","source":14195,"target":14306},{"edgeType":"contains","source":230,"target":3258},{"edgeType":"contains","source":15649,"target":15741},{"edgeType":"contains","source":6138,"target":6153},{"edgeType":"contains","source":3760,"target":3762},{"edgeType":"contains","source":5676,"target":5677},{"edgeType":"contains","source":9760,"target":10147},{"edgeType":"contains","source":11621,"target":11649},{"edgeType":"contains","source":13733,"target":13826},{"edgeType":"contains","source":9760,"target":10143},{"edgeType":"contains","source":6138,"target":6154},{"edgeType":"contains","source":8713,"target":8779},{"edgeType":"contains","source":6667,"target":6668},{"edgeType":"contains","source":10895,"target":10898},{"edgeType":"contains","source":10829,"target":10830},{"edgeType":"imports","source":10378,"target":9759},{"edgeType":"contains","source":12810,"target":12842},{"edgeType":"contains","source":13469,"target":13553},{"edgeType":"contains","source":11554,"target":11609},{"edgeType":"contains","source":11356,"target":11405},{"edgeType":"contains","source":13922,"target":14314},{"edgeType":"contains","source":15649,"target":15742},{"edgeType":"contains","source":11621,"target":11646},{"edgeType":"contains","source":12018,"target":12025},{"edgeType":"contains","source":13733,"target":13825},{"edgeType":"contains","source":15517,"target":15606},{"edgeType":"contains","source":9838,"target":9840},{"edgeType":"contains","source":16510,"target":16534},{"edgeType":"contains","source":6138,"target":6155},{"edgeType":"calls","source":6958,"target":6069},{"edgeType":"contains","source":14195,"target":14308},{"edgeType":"contains","source":5430,"target":4841},{"edgeType":"calls","source":6812,"target":6367},{"edgeType":"contains","source":11621,"target":11647},{"edgeType":"contains","source":12018,"target":12024},{"edgeType":"contains","source":11554,"target":11610},{"edgeType":"contains","source":11852,"target":6600},{"edgeType":"contains","source":4090,"target":4100},{"edgeType":"contains","source":16510,"target":16537},{"edgeType":"calls","source":2361,"target":615},{"edgeType":"calls","source":13746,"target":13394},{"edgeType":"contains","source":10426,"target":10636},{"edgeType":"calls","source":2450,"target":2084},{"edgeType":"calls","source":11745,"target":1432},{"edgeType":"calls","source":6748,"target":6238},{"edgeType":"contains","source":11621,"target":11644},{"edgeType":"contains","source":11554,"target":11607},{"edgeType":"contains","source":11852,"target":6597},{"edgeType":"contains","source":12018,"target":12023},{"edgeType":"contains","source":7856,"target":7857},{"edgeType":"contains","source":15649,"target":15744},{"edgeType":"imports","source":4518,"target":3270},{"edgeType":"contains","source":4157,"target":4143},{"edgeType":"contains","source":4883,"target":4892},{"edgeType":"contains","source":6402,"target":6421},{"edgeType":"contains","source":11083,"target":11411},{"edgeType":"contains","source":16510,"target":16536},{"edgeType":"contains","source":2828,"target":3062},{"edgeType":"calls","source":6151,"target":5741},{"edgeType":"calls","source":6761,"target":5836},{"edgeType":"contains","source":11356,"target":11404},{"edgeType":"contains","source":9838,"target":3493},{"edgeType":"contains","source":12018,"target":12022},{"edgeType":"contains","source":11621,"target":11645},{"edgeType":"calls","source":4725,"target":3438},{"edgeType":"calls","source":5015,"target":5018},{"edgeType":"contains","source":6138,"target":6149},{"edgeType":"contains","source":4883,"target":4891},{"edgeType":"contains","source":6402,"target":6422},{"edgeType":"contains","source":16510,"target":16539},{"edgeType":"calls","source":4557,"target":4416},{"edgeType":"contains","source":15850,"target":15858},{"edgeType":"contains","source":16291,"target":16986},{"edgeType":"calls","source":6761,"target":5837},{"edgeType":"contains","source":11621,"target":11642},{"edgeType":"calls","source":5094,"target":4682},{"edgeType":"contains","source":8120,"target":8131},{"edgeType":"contains","source":10036,"target":10040},{"edgeType":"calls","source":2391,"target":1798},{"edgeType":"contains","source":6267,"target":6380},{"edgeType":"contains","source":16510,"target":16538},{"edgeType":"contains","source":12469,"target":12837},{"edgeType":"contains","source":11356,"target":11402},{"edgeType":"contains","source":13009,"target":13010},{"edgeType":"contains","source":2828,"target":3060},{"edgeType":"contains","source":14662,"target":14634},{"edgeType":"contains","source":11621,"target":11643},{"edgeType":"contains","source":13733,"target":13820},{"edgeType":"contains","source":11554,"target":11606},{"edgeType":"calls","source":5015,"target":5016},{"edgeType":"contains","source":6138,"target":6151},{"edgeType":"contains","source":7856,"target":7858},{"edgeType":"calls","source":793,"target":600},{"edgeType":"contains","source":5743,"target":5712},{"edgeType":"contains","source":12018,"target":12020},{"edgeType":"contains","source":13221,"target":4339},{"edgeType":"contains","source":13922,"target":14303},{"edgeType":"contains","source":4883,"target":4897},{"edgeType":"contains","source":13670,"target":13675},{"edgeType":"contains","source":457,"target":459},{"edgeType":"contains","source":6267,"target":6389},{"edgeType":"contains","source":14792,"target":14816},{"edgeType":"contains","source":4352,"target":4445},{"edgeType":"contains","source":10499,"target":10500},{"edgeType":"contains","source":3694,"target":3703},{"edgeType":"imports","source":5659,"target":5941},{"edgeType":"contains","source":15649,"target":15732},{"edgeType":"contains","source":16510,"target":16525},{"edgeType":"contains","source":13469,"target":13563},{"edgeType":"contains","source":11083,"target":11422},{"edgeType":"contains","source":12810,"target":12852},{"edgeType":"contains","source":11356,"target":11415},{"edgeType":"contains","source":7460,"target":7461},{"edgeType":"contains","source":11556,"target":11559},{"edgeType":"contains","source":9503,"target":9663},{"edgeType":"contains","source":6138,"target":6161},{"edgeType":"contains","source":1,"target":4023},{"edgeType":"calls","source":6744,"target":6367},{"edgeType":"contains","source":4618,"target":4655},{"edgeType":"contains","source":2828,"target":3066},{"edgeType":"contains","source":457,"target":458},{"edgeType":"contains","source":14792,"target":14817},{"edgeType":"contains","source":10291,"target":10606},{"edgeType":"contains","source":15649,"target":15733},{"edgeType":"calls","source":7492,"target":2206},{"edgeType":"calls","source":6600,"target":6603},{"edgeType":"contains","source":16510,"target":16524},{"edgeType":"contains","source":1,"target":6137},{"edgeType":"contains","source":3562,"target":3566},{"edgeType":"calls","source":13603,"target":13602},{"edgeType":"contains","source":5543,"target":5580},{"edgeType":"contains","source":13469,"target":13562},{"edgeType":"calls","source":15851,"target":15795},{"edgeType":"contains","source":11083,"target":11423},{"edgeType":"calls","source":9863,"target":2699},{"edgeType":"contains","source":4883,"target":4895},{"edgeType":"contains","source":6593,"target":6856},{"edgeType":"contains","source":16510,"target":16527},{"edgeType":"contains","source":6138,"target":6162},{"edgeType":"calls","source":2379,"target":2165},{"edgeType":"contains","source":6402,"target":6435},{"edgeType":"contains","source":15649,"target":15734},{"edgeType":"contains","source":10565,"target":10566},{"edgeType":"contains","source":10550,"target":11031},{"edgeType":"contains","source":12152,"target":3651},{"edgeType":"calls","source":6600,"target":6604},{"edgeType":"contains","source":854,"target":838},{"edgeType":"contains","source":16238,"target":16503},{"edgeType":"calls","source":9310,"target":9272},{"edgeType":"contains","source":5543,"target":5581},{"edgeType":"calls","source":15602,"target":15059},{"edgeType":"calls","source":15605,"target":14966},{"edgeType":"contains","source":13469,"target":13561},{"edgeType":"contains","source":11083,"target":11420},{"edgeType":"contains","source":11356,"target":11413},{"edgeType":"calls","source":14383,"target":2105},{"edgeType":"contains","source":11556,"target":11557},{"edgeType":"contains","source":4883,"target":4894},{"edgeType":"contains","source":9529,"target":6745},{"edgeType":"calls","source":12865,"target":540},{"edgeType":"contains","source":16510,"target":16526},{"edgeType":"contains","source":10426,"target":10647},{"edgeType":"calls","source":15337,"target":2134},{"edgeType":"calls","source":15268,"target":2159},{"edgeType":"calls","source":2347,"target":1044},{"edgeType":"calls","source":1456,"target":1183},{"edgeType":"contains","source":14195,"target":14300},{"edgeType":"contains","source":6402,"target":6436},{"edgeType":"contains","source":15649,"target":15735},{"edgeType":"contains","source":5543,"target":5582},{"edgeType":"contains","source":11356,"target":11414},{"edgeType":"calls","source":3324,"target":2468},{"edgeType":"contains","source":5543,"target":5574},{"edgeType":"contains","source":11621,"target":11653},{"edgeType":"contains","source":13670,"target":13671},{"edgeType":"contains","source":6138,"target":6156},{"edgeType":"calls","source":4110,"target":3468},{"edgeType":"contains","source":10550,"target":11028},{"edgeType":"imports","source":12378,"target":601},{"edgeType":"contains","source":6593,"target":6850},{"edgeType":"contains","source":4352,"target":4450},{"edgeType":"contains","source":15649,"target":15736},{"edgeType":"contains","source":3694,"target":3707},{"edgeType":"contains","source":12152,"target":3649},{"edgeType":"contains","source":16238,"target":16505},{"edgeType":"contains","source":15460,"target":15253},{"edgeType":"calls","source":1322,"target":1104},{"edgeType":"contains","source":11412,"target":11789},{"edgeType":"contains","source":13469,"target":13559},{"edgeType":"contains","source":5543,"target":5575},{"edgeType":"calls","source":10043,"target":1349},{"edgeType":"contains","source":13417,"target":13057},{"edgeType":"calls","source":15661,"target":540},{"edgeType":"contains","source":6267,"target":6386},{"edgeType":"contains","source":6138,"target":6157},{"edgeType":"contains","source":16510,"target":16528},{"edgeType":"contains","source":8907,"target":2766},{"edgeType":"contains","source":10550,"target":11029},{"edgeType":"contains","source":1,"target":14598},{"edgeType":"calls","source":14995,"target":2165},{"edgeType":"contains","source":4352,"target":4449},{"edgeType":"contains","source":7856,"target":7864},{"edgeType":"imports","source":10378,"target":9756},{"edgeType":"contains","source":3694,"target":3706},{"edgeType":"contains","source":16238,"target":16504},{"edgeType":"contains","source":9760,"target":10151},{"edgeType":"contains","source":1448,"target":1455},{"edgeType":"contains","source":15649,"target":15737},{"edgeType":"contains","source":5543,"target":5576},{"edgeType":"contains","source":6138,"target":6158},{"edgeType":"contains","source":11852,"target":6604},{"edgeType":"contains","source":11083,"target":11416},{"edgeType":"contains","source":4352,"target":2333},{"edgeType":"contains","source":10763,"target":10766},{"edgeType":"contains","source":6402,"target":6430},{"edgeType":"contains","source":10550,"target":11026},{"edgeType":"contains","source":4352,"target":4448},{"edgeType":"calls","source":2240,"target":2242},{"edgeType":"contains","source":11356,"target":11409},{"edgeType":"calls","source":2170,"target":184},{"edgeType":"imports","source":6212,"target":5717},{"edgeType":"contains","source":1448,"target":1452},{"edgeType":"contains","source":5659,"target":6209},{"edgeType":"contains","source":9760,"target":10148},{"edgeType":"contains","source":5543,"target":5577},{"edgeType":"contains","source":15649,"target":15738},{"edgeType":"contains","source":3364,"target":3365},{"edgeType":"contains","source":13469,"target":13557},{"edgeType":"calls","source":3627,"target":3640},{"edgeType":"contains","source":6138,"target":6159},{"edgeType":"calls","source":1117,"target":1118},{"edgeType":"contains","source":4883,"target":4898},{"edgeType":"contains","source":6259,"target":6636},{"edgeType":"contains","source":8778,"target":8881},{"edgeType":"contains","source":10763,"target":10767},{"edgeType":"contains","source":1,"target":14600},{"edgeType":"contains","source":16510,"target":16530},{"edgeType":"contains","source":4352,"target":4446},{"edgeType":"contains","source":10550,"target":11027},{"edgeType":"contains","source":3694,"target":3704},{"edgeType":"contains","source":16238,"target":16506},{"edgeType":"contains","source":14792,"target":14824},{"edgeType":"contains","source":12150,"target":12164},{"edgeType":"contains","source":14195,"target":14304},{"edgeType":"contains","source":2828,"target":3068},{"edgeType":"contains","source":11621,"target":11651},{"edgeType":"contains","source":5543,"target":5578},{"edgeType":"contains","source":15779,"target":15937},{"edgeType":"contains","source":15649,"target":15739},{"edgeType":"imports","source":14514,"target":14518},{"edgeType":"contains","source":1410,"target":2074},{"edgeType":"contains","source":9226,"target":9241},{"edgeType":"calls","source":10185,"target":1278},{"edgeType":"contains","source":35,"target":303},{"edgeType":"contains","source":109,"target":123},{"edgeType":"contains","source":9820,"target":9855},{"edgeType":"imports","source":9090,"target":9307},{"edgeType":"contains","source":1410,"target":2075},{"edgeType":"contains","source":14954,"target":15601},{"edgeType":"calls","source":8652,"target":8633},{"edgeType":"contains","source":14694,"target":15204},{"edgeType":"imports","source":9955,"target":9974},{"edgeType":"contains","source":9820,"target":9856},{"edgeType":"contains","source":35,"target":302},{"edgeType":"contains","source":1891,"target":1963},{"edgeType":"contains","source":109,"target":122},{"edgeType":"contains","source":109,"target":125},{"edgeType":"calls","source":6670,"target":6655},{"edgeType":"contains","source":4931,"target":4968},{"edgeType":"imports","source":5659,"target":5736},{"edgeType":"contains","source":770,"target":775},{"edgeType":"calls","source":6075,"target":6069},{"edgeType":"calls","source":10569,"target":10514},{"edgeType":"calls","source":10447,"target":1615},{"edgeType":"contains","source":9365,"target":9162},{"edgeType":"calls","source":2392,"target":1853},{"edgeType":"contains","source":5725,"target":5728},{"edgeType":"contains","source":9754,"target":1331},{"edgeType":"contains","source":9820,"target":9853},{"edgeType":"contains","source":35,"target":305},{"edgeType":"calls","source":14928,"target":14920},{"edgeType":"contains","source":4931,"target":4967},{"edgeType":"contains","source":15899,"target":15905},{"edgeType":"contains","source":10944,"target":10949},{"edgeType":"contains","source":13057,"target":13095},{"edgeType":"contains","source":1410,"target":2073},{"edgeType":"contains","source":14837,"target":4431},{"edgeType":"calls","source":10370,"target":10343},{"edgeType":"calls","source":14207,"target":14010},{"edgeType":"contains","source":10812,"target":10813},{"edgeType":"contains","source":11063,"target":3032},{"edgeType":"contains","source":12821,"target":14068},{"edgeType":"contains","source":16821,"target":16919},{"edgeType":"contains","source":15048,"target":4233},{"edgeType":"imports","source":696,"target":1028},{"edgeType":"contains","source":9226,"target":9242},{"edgeType":"calls","source":7559,"target":4466},{"edgeType":"contains","source":35,"target":304},{"edgeType":"calls","source":14928,"target":14921},{"edgeType":"contains","source":109,"target":124},{"edgeType":"contains","source":5725,"target":5729},{"edgeType":"contains","source":8427,"target":8637},{"edgeType":"contains","source":5816,"target":5014},{"edgeType":"contains","source":13057,"target":13094},{"edgeType":"contains","source":10459,"target":612},{"edgeType":"calls","source":3103,"target":3065},{"edgeType":"calls","source":14532,"target":14512},{"edgeType":"contains","source":14848,"target":14662},{"edgeType":"imports","source":5659,"target":5739},{"edgeType":"calls","source":1979,"target":1968},{"edgeType":"contains","source":9820,"target":9851},{"edgeType":"contains","source":5816,"target":5015},{"edgeType":"calls","source":14800,"target":14654},{"edgeType":"calls","source":8123,"target":8125},{"edgeType":"contains","source":13057,"target":13093},{"edgeType":"imports","source":15251,"target":2236},{"edgeType":"calls","source":1194,"target":934},{"edgeType":"contains","source":7107,"target":7276},{"edgeType":"imports","source":14316,"target":14309},{"edgeType":"calls","source":460,"target":433},{"edgeType":"contains","source":5816,"target":5016},{"edgeType":"contains","source":1495,"target":1559},{"edgeType":"calls","source":3698,"target":1533},{"edgeType":"contains","source":35,"target":306},{"edgeType":"calls","source":1316,"target":1383},{"edgeType":"contains","source":13057,"target":13092},{"edgeType":"imports","source":8158,"target":2261},{"edgeType":"calls","source":2465,"target":1700},{"edgeType":"calls","source":1450,"target":1457},{"edgeType":"contains","source":5791,"target":5792},{"edgeType":"contains","source":1891,"target":1964},{"edgeType":"contains","source":10085,"target":10090},{"edgeType":"contains","source":9091,"target":9195},{"edgeType":"contains","source":8427,"target":8638},{"edgeType":"imports","source":13919,"target":13935},{"edgeType":"contains","source":6843,"target":7006},{"edgeType":"contains","source":10944,"target":10945},{"edgeType":"contains","source":13057,"target":13091},{"edgeType":"contains","source":10459,"target":611},{"edgeType":"contains","source":1167,"target":1155},{"edgeType":"contains","source":9365,"target":9157},{"edgeType":"calls","source":10747,"target":774},{"edgeType":"contains","source":13520,"target":13536},{"edgeType":"contains","source":16821,"target":16923},{"edgeType":"contains","source":11959,"target":620},{"edgeType":"contains","source":5791,"target":5793},{"edgeType":"contains","source":5816,"target":5018},{"edgeType":"calls","source":4026,"target":4047},{"edgeType":"contains","source":10085,"target":10091},{"edgeType":"calls","source":13407,"target":13452},{"edgeType":"contains","source":11063,"target":3041},{"edgeType":"contains","source":1230,"target":1320},{"edgeType":"calls","source":14455,"target":2105},{"edgeType":"contains","source":2223,"target":2248},{"edgeType":"calls","source":15607,"target":15017},{"edgeType":"calls","source":11641,"target":11117},{"edgeType":"contains","source":7107,"target":7287},{"edgeType":"contains","source":3545,"target":3549},{"edgeType":"calls","source":7028,"target":6134},{"edgeType":"calls","source":10502,"target":10486},{"edgeType":"contains","source":15968,"target":15868},{"edgeType":"imports","source":9090,"target":9299},{"edgeType":"calls","source":1117,"target":1203},{"edgeType":"contains","source":14246,"target":14286},{"edgeType":"contains","source":7107,"target":7288},{"edgeType":"contains","source":9091,"target":9205},{"edgeType":"contains","source":3479,"target":3480},{"edgeType":"contains","source":9491,"target":9493},{"edgeType":"contains","source":11606,"target":11575},{"edgeType":"calls","source":3630,"target":3634},{"edgeType":"contains","source":12378,"target":4556},{"edgeType":"contains","source":16821,"target":16911},{"edgeType":"calls","source":1072,"target":487},{"edgeType":"imports","source":9090,"target":9295},{"edgeType":"calls","source":4480,"target":540},{"edgeType":"contains","source":5461,"target":5464},{"edgeType":"calls","source":2113,"target":2038},{"edgeType":"calls","source":15985,"target":15987},{"edgeType":"contains","source":35,"target":312},{"edgeType":"calls","source":3564,"target":3567},{"edgeType":"imports","source":9090,"target":9297},{"edgeType":"contains","source":770,"target":782},{"edgeType":"contains","source":12597,"target":12564},{"edgeType":"contains","source":693,"target":1055},{"edgeType":"contains","source":2620,"target":2625},{"edgeType":"calls","source":7654,"target":7872},{"edgeType":"calls","source":11221,"target":2996},{"edgeType":"calls","source":6833,"target":5840},{"edgeType":"calls","source":15602,"target":15176},{"edgeType":"contains","source":10678,"target":10747},{"edgeType":"imports","source":14186,"target":14109},{"edgeType":"contains","source":3545,"target":3546},{"edgeType":"contains","source":9091,"target":9202},{"edgeType":"calls","source":5094,"target":4758},{"edgeType":"contains","source":35,"target":315},{"edgeType":"calls","source":9935,"target":2699},{"edgeType":"contains","source":5862,"target":5711},{"edgeType":"contains","source":4338,"target":4339},{"edgeType":"contains","source":9365,"target":9164},{"edgeType":"contains","source":3545,"target":3553},{"edgeType":"contains","source":987,"target":400},{"edgeType":"contains","source":1495,"target":1566},{"edgeType":"calls","source":2403,"target":1502},{"edgeType":"calls","source":4223,"target":4277},{"edgeType":"contains","source":12926,"target":12934},{"edgeType":"contains","source":15300,"target":15441},{"edgeType":"contains","source":11063,"target":3038},{"edgeType":"calls","source":1449,"target":1477},{"edgeType":"contains","source":10614,"target":10615},{"edgeType":"contains","source":9365,"target":9163},{"edgeType":"imports","source":15251,"target":14912},{"edgeType":"contains","source":1495,"target":1567},{"edgeType":"contains","source":7107,"target":7284},{"edgeType":"contains","source":1410,"target":2088},{"edgeType":"imports","source":1715,"target":1156},{"edgeType":"contains","source":16034,"target":15941},{"edgeType":"calls","source":10502,"target":10493},{"edgeType":"contains","source":15300,"target":15442},{"edgeType":"calls","source":14090,"target":7080},{"edgeType":"contains","source":11063,"target":3035},{"edgeType":"imports","source":11756,"target":647},{"edgeType":"contains","source":35,"target":317},{"edgeType":"contains","source":242,"target":243},{"edgeType":"calls","source":2084,"target":821},{"edgeType":"contains","source":10353,"target":10247},{"edgeType":"contains","source":15899,"target":15901},{"edgeType":"contains","source":35,"target":316},{"edgeType":"imports","source":9362,"target":9325},{"edgeType":"contains","source":11063,"target":3036},{"edgeType":"contains","source":7247,"target":832},{"edgeType":"imports","source":12907,"target":903},{"edgeType":"calls","source":10311,"target":10070},{"edgeType":"imports","source":14186,"target":14105},{"edgeType":"contains","source":1495,"target":1565},{"edgeType":"imports","source":10305,"target":9688},{"edgeType":"contains","source":13520,"target":13527},{"edgeType":"calls","source":14151,"target":3048},{"edgeType":"contains","source":15300,"target":15428},{"edgeType":"contains","source":15658,"target":4330},{"edgeType":"calls","source":8715,"target":8779},{"edgeType":"calls","source":3909,"target":3468},{"edgeType":"contains","source":3676,"target":3691},{"edgeType":"contains","source":7107,"target":7262},{"edgeType":"contains","source":11061,"target":3078},{"edgeType":"contains","source":3214,"target":3215},{"edgeType":"imports","source":15637,"target":15627},{"edgeType":"imports","source":16165,"target":16174},{"edgeType":"contains","source":15300,"target":15429},{"edgeType":"contains","source":9952,"target":9975},{"edgeType":"contains","source":1495,"target":1538},{"edgeType":"contains","source":9091,"target":9180},{"edgeType":"contains","source":1448,"target":881},{"edgeType":"calls","source":6764,"target":5838},{"edgeType":"calls","source":6083,"target":5838},{"edgeType":"imports","source":14382,"target":14365},{"edgeType":"contains","source":7107,"target":7263},{"edgeType":"contains","source":12998,"target":4339},{"edgeType":"contains","source":10678,"target":10724},{"edgeType":"imports","source":11679,"target":7250},{"edgeType":"contains","source":13520,"target":13525},{"edgeType":"contains","source":9226,"target":9227},{"edgeType":"contains","source":5725,"target":5711},{"edgeType":"contains","source":7442,"target":7450},{"edgeType":"contains","source":35,"target":288},{"edgeType":"contains","source":9952,"target":9972},{"edgeType":"imports","source":9825,"target":9758},{"edgeType":"calls","source":6083,"target":5837},{"edgeType":"contains","source":13057,"target":13079},{"edgeType":"contains","source":7107,"target":7264},{"edgeType":"contains","source":14247,"target":14248},{"edgeType":"contains","source":1230,"target":1294},{"edgeType":"contains","source":13520,"target":13524},{"edgeType":"calls","source":9113,"target":9126},{"edgeType":"contains","source":16821,"target":16902},{"edgeType":"calls","source":4430,"target":4227},{"edgeType":"calls","source":11219,"target":3033},{"edgeType":"contains","source":35,"target":287},{"edgeType":"contains","source":9952,"target":9973},{"edgeType":"calls","source":9378,"target":9368},{"edgeType":"contains","source":900,"target":955},{"edgeType":"contains","source":9091,"target":9182},{"edgeType":"imports","source":9825,"target":9757},{"edgeType":"contains","source":15071,"target":14073},{"edgeType":"calls","source":2775,"target":2682},{"edgeType":"contains","source":7107,"target":7265},{"edgeType":"calls","source":658,"target":660},{"edgeType":"contains","source":14183,"target":14119},{"edgeType":"contains","source":6844,"target":6962},{"edgeType":"contains","source":1230,"target":1295},{"edgeType":"imports","source":9090,"target":9288},{"edgeType":"contains","source":12908,"target":13469},{"edgeType":"imports","source":8040,"target":8018},{"edgeType":"contains","source":5130,"target":5131},{"edgeType":"contains","source":13520,"target":13523},{"edgeType":"contains","source":9952,"target":9970},{"edgeType":"contains","source":12384,"target":12799},{"edgeType":"calls","source":1945,"target":925},{"edgeType":"contains","source":7107,"target":7258},{"edgeType":"calls","source":4095,"target":4040},{"edgeType":"contains","source":2157,"target":2160},{"edgeType":"contains","source":109,"target":111},{"edgeType":"imports","source":15311,"target":15159},{"edgeType":"contains","source":14247,"target":14250},{"edgeType":"contains","source":9503,"target":9089},{"edgeType":"contains","source":12908,"target":13467},{"edgeType":"contains","source":7442,"target":7445},{"edgeType":"imports","source":14316,"target":14292},{"edgeType":"contains","source":13520,"target":13522},{"edgeType":"contains","source":9952,"target":9971},{"edgeType":"calls","source":5625,"target":5234},{"edgeType":"contains","source":35,"target":289},{"edgeType":"contains","source":109,"target":110},{"edgeType":"contains","source":9874,"target":8161},{"edgeType":"calls","source":10700,"target":10672},{"edgeType":"calls","source":4282,"target":358},{"edgeType":"calls","source":8651,"target":8652},{"edgeType":"contains","source":1230,"target":1301},{"edgeType":"contains","source":900,"target":957},{"edgeType":"contains","source":16229,"target":16230},{"edgeType":"contains","source":7107,"target":7259},{"edgeType":"contains","source":14247,"target":14251},{"edgeType":"calls","source":12483,"target":12476},{"edgeType":"calls","source":15984,"target":15988},{"edgeType":"contains","source":13520,"target":13521},{"edgeType":"calls","source":1456,"target":1288},{"edgeType":"contains","source":3676,"target":3693},{"edgeType":"contains","source":9952,"target":9968},{"edgeType":"contains","source":12384,"target":12797},{"edgeType":"contains","source":15300,"target":15434},{"edgeType":"contains","source":15590,"target":4330},{"edgeType":"contains","source":109,"target":113},{"edgeType":"calls","source":1320,"target":1275},{"edgeType":"contains","source":1495,"target":1539},{"edgeType":"calls","source":1118,"target":1195},{"edgeType":"contains","source":3676,"target":3692},{"edgeType":"contains","source":9952,"target":9969},{"edgeType":"calls","source":5625,"target":5232},{"edgeType":"contains","source":10436,"target":5535},{"edgeType":"contains","source":5658,"target":5671},{"edgeType":"contains","source":109,"target":112},{"edgeType":"contains","source":1495,"target":1540},{"edgeType":"calls","source":15720,"target":15717},{"edgeType":"contains","source":9365,"target":9140},{"edgeType":"contains","source":7107,"target":7261},{"edgeType":"contains","source":10937,"target":11145},{"edgeType":"contains","source":14247,"target":14253},{"edgeType":"contains","source":5130,"target":5135},{"edgeType":"contains","source":15958,"target":16162},{"edgeType":"imports","source":6681,"target":5739},{"edgeType":"contains","source":13057,"target":13090},{"edgeType":"contains","source":4070,"target":4170},{"edgeType":"calls","source":1458,"target":1219},{"edgeType":"contains","source":35,"target":295},{"edgeType":"contains","source":6055,"target":6058},{"edgeType":"contains","source":109,"target":115},{"edgeType":"contains","source":2157,"target":2164},{"edgeType":"contains","source":4931,"target":4961},{"edgeType":"imports","source":9090,"target":9281},{"edgeType":"calls","source":5300,"target":4735},{"edgeType":"contains","source":8631,"target":8651},{"edgeType":"contains","source":5130,"target":5134},{"edgeType":"imports","source":14133,"target":3050},{"edgeType":"contains","source":9091,"target":9189},{"edgeType":"calls","source":9180,"target":9169},{"edgeType":"contains","source":13057,"target":13089},{"edgeType":"contains","source":15958,"target":16163},{"edgeType":"contains","source":6055,"target":6059},{"edgeType":"contains","source":35,"target":294},{"edgeType":"contains","source":13916,"target":13929},{"edgeType":"contains","source":13057,"target":13088},{"edgeType":"calls","source":9182,"target":9108},{"edgeType":"contains","source":109,"target":114},{"edgeType":"calls","source":6339,"target":6337},{"edgeType":"contains","source":16625,"target":16626},{"edgeType":"contains","source":4931,"target":4960},{"edgeType":"contains","source":5130,"target":5133},{"edgeType":"contains","source":13520,"target":13533},{"edgeType":"calls","source":4027,"target":4028},{"edgeType":"contains","source":1495,"target":1543},{"edgeType":"calls","source":2773,"target":2735},{"edgeType":"contains","source":13057,"target":13087},{"edgeType":"imports","source":15796,"target":2236},{"edgeType":"contains","source":2157,"target":2162},{"edgeType":"contains","source":35,"target":297},{"edgeType":"contains","source":109,"target":117},{"edgeType":"contains","source":10085,"target":10086},{"edgeType":"contains","source":16821,"target":16895},{"edgeType":"calls","source":2516,"target":2246},{"edgeType":"contains","source":5130,"target":5132},{"edgeType":"contains","source":13520,"target":13532},{"edgeType":"contains","source":9091,"target":9191},{"edgeType":"calls","source":6154,"target":5741},{"edgeType":"contains","source":15300,"target":15422},{"edgeType":"contains","source":13057,"target":13086},{"edgeType":"contains","source":35,"target":296},{"edgeType":"calls","source":5496,"target":4998},{"edgeType":"contains","source":16625,"target":16628},{"edgeType":"contains","source":109,"target":116},{"edgeType":"contains","source":2157,"target":2163},{"edgeType":"contains","source":5923,"target":5925},{"edgeType":"contains","source":8631,"target":8652},{"edgeType":"contains","source":16821,"target":16894},{"edgeType":"calls","source":10171,"target":10165},{"edgeType":"contains","source":4939,"target":4718},{"edgeType":"imports","source":6681,"target":5743},{"edgeType":"calls","source":14532,"target":14504},{"edgeType":"contains","source":13057,"target":13085},{"edgeType":"calls","source":14800,"target":14645},{"edgeType":"calls","source":1525,"target":1252},{"edgeType":"imports","source":14183,"target":14180},{"edgeType":"contains","source":8169,"target":8171},{"edgeType":"contains","source":3875,"target":3877},{"edgeType":"contains","source":35,"target":299},{"edgeType":"calls","source":3704,"target":3468},{"edgeType":"contains","source":7107,"target":7266},{"edgeType":"calls","source":11522,"target":6338},{"edgeType":"contains","source":109,"target":119},{"edgeType":"contains","source":6844,"target":6963},{"edgeType":"contains","source":15504,"target":15443},{"edgeType":"contains","source":4931,"target":4965},{"edgeType":"contains","source":5999,"target":5676},{"edgeType":"calls","source":13002,"target":626},{"edgeType":"imports","source":9825,"target":9755},{"edgeType":"contains","source":35,"target":298},{"edgeType":"contains","source":13057,"target":13084},{"edgeType":"contains","source":16821,"target":16896},{"edgeType":"contains","source":109,"target":118},{"edgeType":"calls","source":9533,"target":2459},{"edgeType":"calls","source":1748,"target":680},{"edgeType":"imports","source":9598,"target":4108},{"edgeType":"contains","source":5130,"target":5137},{"edgeType":"contains","source":4931,"target":4964},{"edgeType":"contains","source":770,"target":771},{"edgeType":"calls","source":12865,"target":642},{"edgeType":"calls","source":14590,"target":2134},{"edgeType":"calls","source":2974,"target":2842},{"edgeType":"contains","source":6055,"target":6056},{"edgeType":"imports","source":9090,"target":9283},{"edgeType":"calls","source":11360,"target":11358},{"edgeType":"contains","source":109,"target":121},{"edgeType":"contains","source":8498,"target":8544},{"edgeType":"imports","source":14133,"target":3048},{"edgeType":"contains","source":9091,"target":9187},{"edgeType":"contains","source":13520,"target":13528},{"edgeType":"contains","source":3352,"target":3174},{"edgeType":"calls","source":14802,"target":12473},{"edgeType":"calls","source":1536,"target":912},{"edgeType":"contains","source":6055,"target":6057},{"edgeType":"contains","source":13057,"target":13082},{"edgeType":"calls","source":7000,"target":6993},{"edgeType":"contains","source":4931,"target":4962},{"edgeType":"contains","source":109,"target":120},{"edgeType":"contains","source":15379,"target":2407},{"edgeType":"imports","source":5659,"target":5767},{"edgeType":"calls","source":12680,"target":12693},{"edgeType":"contains","source":10678,"target":10706},{"edgeType":"contains","source":7107,"target":7246},{"edgeType":"contains","source":12859,"target":12861},{"edgeType":"contains","source":3147,"target":3160},{"edgeType":"imports","source":1244,"target":987},{"edgeType":"calls","source":2242,"target":2244},{"edgeType":"contains","source":11382,"target":12137},{"edgeType":"calls","source":9245,"target":9245},{"edgeType":"contains","source":35,"target":270},{"edgeType":"contains","source":13916,"target":13920},{"edgeType":"contains","source":7772,"target":7773},{"edgeType":"contains","source":9820,"target":9822},{"edgeType":"imports","source":15649,"target":15305},{"edgeType":"calls","source":12155,"target":12056},{"edgeType":"calls","source":1942,"target":972},{"edgeType":"imports","source":9090,"target":9340},{"edgeType":"calls","source":1382,"target":1419},{"edgeType":"contains","source":3685,"target":3394},{"edgeType":"contains","source":13330,"target":13057},{"edgeType":"calls","source":8912,"target":540},{"edgeType":"contains","source":6844,"target":6944},{"edgeType":"contains","source":12859,"target":12860},{"edgeType":"calls","source":12218,"target":12217},{"edgeType":"contains","source":11382,"target":12138},{"edgeType":"calls","source":6960,"target":6088},{"edgeType":"contains","source":14246,"target":14261},{"edgeType":"contains","source":9952,"target":9959},{"edgeType":"imports","source":2217,"target":2535},{"edgeType":"calls","source":3563,"target":3575},{"edgeType":"calls","source":1781,"target":1734},{"edgeType":"contains","source":4997,"target":5003},{"edgeType":"calls","source":8056,"target":8052},{"edgeType":"contains","source":4931,"target":4935},{"edgeType":"contains","source":10350,"target":10302},{"edgeType":"contains","source":15958,"target":16156},{"edgeType":"calls","source":6286,"target":5837},{"edgeType":"contains","source":7107,"target":7248},{"edgeType":"contains","source":9365,"target":9129},{"edgeType":"contains","source":12821,"target":14036},{"edgeType":"contains","source":11382,"target":12135},{"edgeType":"contains","source":8158,"target":8493},{"edgeType":"contains","source":4072,"target":4081},{"edgeType":"calls","source":11284,"target":11571},{"edgeType":"calls","source":5677,"target":5689},{"edgeType":"calls","source":12218,"target":12215},{"edgeType":"calls","source":1118,"target":1149},{"edgeType":"contains","source":7107,"target":7249},{"edgeType":"contains","source":10937,"target":11133},{"edgeType":"imports","source":980,"target":2828},{"edgeType":"contains","source":10678,"target":10705},{"edgeType":"contains","source":14246,"target":14263},{"edgeType":"calls","source":1615,"target":540},{"edgeType":"imports","source":16165,"target":16222},{"edgeType":"contains","source":11382,"target":12136},{"edgeType":"calls","source":1449,"target":1458},{"edgeType":"calls","source":7461,"target":7471},{"edgeType":"imports","source":15779,"target":15504},{"edgeType":"contains","source":4072,"target":4080},{"edgeType":"contains","source":5658,"target":5659},{"edgeType":"calls","source":15477,"target":2097},{"edgeType":"calls","source":9377,"target":9382},{"edgeType":"contains","source":9952,"target":9957},{"edgeType":"imports","source":15581,"target":15300},{"edgeType":"contains","source":7107,"target":7242},{"edgeType":"contains","source":15379,"target":2396},{"edgeType":"contains","source":13388,"target":13370},{"edgeType":"contains","source":11382,"target":12133},{"edgeType":"imports","source":16801,"target":15529},{"edgeType":"contains","source":832,"target":936},{"edgeType":"contains","source":4931,"target":4941},{"edgeType":"calls","source":2374,"target":2376},{"edgeType":"contains","source":13916,"target":13924},{"edgeType":"calls","source":7761,"target":286},{"edgeType":"imports","source":3758,"target":3394},{"edgeType":"contains","source":1448,"target":868},{"edgeType":"calls","source":8786,"target":8678},{"edgeType":"contains","source":1495,"target":1525},{"edgeType":"calls","source":787,"target":833},{"edgeType":"calls","source":6338,"target":6347},{"edgeType":"contains","source":7107,"target":7243},{"edgeType":"calls","source":14404,"target":1534},{"edgeType":"contains","source":16821,"target":16888},{"edgeType":"contains","source":1167,"target":1120},{"edgeType":"contains","source":11382,"target":12134},{"edgeType":"contains","source":1562,"target":1563},{"edgeType":"imports","source":5659,"target":5771},{"edgeType":"calls","source":15611,"target":2165},{"edgeType":"calls","source":15661,"target":615},{"edgeType":"contains","source":12000,"target":12002},{"edgeType":"calls","source":15602,"target":15129},{"edgeType":"contains","source":9951,"target":9982},{"edgeType":"contains","source":12939,"target":4032},{"edgeType":"contains","source":11382,"target":12131},{"edgeType":"calls","source":9844,"target":9709},{"edgeType":"contains","source":7107,"target":7244},{"edgeType":"contains","source":16821,"target":16891},{"edgeType":"imports","source":5659,"target":5774},{"edgeType":"calls","source":9380,"target":2952},{"edgeType":"contains","source":3676,"target":3677},{"edgeType":"contains","source":12384,"target":12781},{"edgeType":"contains","source":12000,"target":12001},{"edgeType":"contains","source":4931,"target":4938},{"edgeType":"calls","source":2773,"target":2690},{"edgeType":"contains","source":8498,"target":8518},{"edgeType":"contains","source":571,"target":572},{"edgeType":"contains","source":11382,"target":12132},{"edgeType":"contains","source":9027,"target":9032},{"edgeType":"contains","source":13648,"target":13763},{"edgeType":"calls","source":4356,"target":4354},{"edgeType":"contains","source":12384,"target":12780},{"edgeType":"imports","source":15779,"target":15500},{"edgeType":"calls","source":9047,"target":9046},{"edgeType":"contains","source":1958,"target":1969},{"edgeType":"contains","source":12908,"target":13464},{"edgeType":"contains","source":12907,"target":13495},{"edgeType":"contains","source":8763,"target":8771},{"edgeType":"imports","source":10949,"target":2440},{"edgeType":"imports","source":9432,"target":9299},{"edgeType":"contains","source":8631,"target":8635},{"edgeType":"contains","source":12396,"target":12423},{"edgeType":"contains","source":5794,"target":5676},{"edgeType":"imports","source":15779,"target":15495},{"edgeType":"contains","source":9952,"target":9966},{"edgeType":"calls","source":7461,"target":7476},{"edgeType":"contains","source":9091,"target":9173},{"edgeType":"calls","source":10642,"target":10343},{"edgeType":"contains","source":8158,"target":8498},{"edgeType":"calls","source":5502,"target":4765},{"edgeType":"contains","source":1958,"target":1975},{"edgeType":"contains","source":571,"target":574},{"edgeType":"contains","source":8763,"target":8770},{"edgeType":"contains","source":12384,"target":12794},{"edgeType":"calls","source":10170,"target":1718},{"edgeType":"contains","source":7107,"target":7255},{"edgeType":"contains","source":12595,"target":12596},{"edgeType":"contains","source":15379,"target":2384},{"edgeType":"calls","source":9935,"target":2660},{"edgeType":"contains","source":9952,"target":9967},{"edgeType":"contains","source":1,"target":7673},{"edgeType":"calls","source":9380,"target":2953},{"edgeType":"calls","source":7990,"target":7992},{"edgeType":"calls","source":10038,"target":10041},{"edgeType":"calls","source":9844,"target":9713},{"edgeType":"contains","source":12384,"target":12793},{"edgeType":"calls","source":5230,"target":4740},{"edgeType":"contains","source":15379,"target":2385},{"edgeType":"calls","source":7461,"target":7478},{"edgeType":"contains","source":9952,"target":9964},{"edgeType":"contains","source":1167,"target":1127},{"edgeType":"contains","source":9365,"target":9137},{"edgeType":"calls","source":2308,"target":2302},{"edgeType":"calls","source":4271,"target":642},{"edgeType":"contains","source":3676,"target":3681},{"edgeType":"calls","source":7858,"target":7857},{"edgeType":"contains","source":35,"target":279},{"edgeType":"calls","source":15984,"target":15985},{"edgeType":"imports","source":5659,"target":5760},{"edgeType":"contains","source":16821,"target":16877},{"edgeType":"contains","source":12384,"target":12792},{"edgeType":"contains","source":4748,"target":4273},{"edgeType":"contains","source":7107,"target":7257},{"edgeType":"contains","source":9952,"target":9965},{"edgeType":"calls","source":3976,"target":3446},{"edgeType":"contains","source":35,"target":282},{"edgeType":"contains","source":9091,"target":9169},{"edgeType":"contains","source":12859,"target":12865},{"edgeType":"calls","source":11558,"target":11547},{"edgeType":"contains","source":3676,"target":3687},{"edgeType":"contains","source":9952,"target":9962},{"edgeType":"contains","source":11382,"target":12141},{"edgeType":"contains","source":11184,"target":11937},{"edgeType":"calls","source":15235,"target":7486},{"edgeType":"calls","source":14531,"target":14518},{"edgeType":"contains","source":12384,"target":12790},{"edgeType":"contains","source":10937,"target":11139},{"edgeType":"calls","source":7994,"target":7871},{"edgeType":"contains","source":9952,"target":9963},{"edgeType":"contains","source":10678,"target":10712},{"edgeType":"contains","source":7107,"target":7251},{"edgeType":"contains","source":13916,"target":13917},{"edgeType":"calls","source":3627,"target":3690},{"edgeType":"contains","source":12384,"target":12789},{"edgeType":"contains","source":11184,"target":11935},{"edgeType":"contains","source":8763,"target":8769},{"edgeType":"contains","source":8631,"target":8633},{"edgeType":"contains","source":11382,"target":12139},{"edgeType":"contains","source":9952,"target":9960},{"edgeType":"calls","source":14345,"target":13940},{"edgeType":"contains","source":5658,"target":5662},{"edgeType":"contains","source":15899,"target":15868},{"edgeType":"calls","source":9380,"target":2959},{"edgeType":"contains","source":9091,"target":9170},{"edgeType":"contains","source":35,"target":283},{"edgeType":"contains","source":307,"target":308},{"edgeType":"imports","source":9090,"target":9334},{"edgeType":"contains","source":1,"target":7679},{"edgeType":"calls","source":10170,"target":10180},{"edgeType":"contains","source":9952,"target":9961},{"edgeType":"imports","source":592,"target":61},{"edgeType":"contains","source":7107,"target":7253},{"edgeType":"contains","source":14176,"target":14299},{"edgeType":"calls","source":4412,"target":2641},{"edgeType":"calls","source":4886,"target":4860},{"edgeType":"contains","source":11382,"target":12121},{"edgeType":"calls","source":11887,"target":11890},{"edgeType":"calls","source":1382,"target":1437},{"edgeType":"contains","source":15435,"target":15438},{"edgeType":"calls","source":11289,"target":11401},{"edgeType":"contains","source":832,"target":915},{"edgeType":"contains","source":4796,"target":4877},{"edgeType":"calls","source":723,"target":725},{"edgeType":"contains","source":12660,"target":12671},{"edgeType":"contains","source":7107,"target":7229},{"edgeType":"contains","source":16821,"target":16868},{"edgeType":"calls","source":8518,"target":8511},{"edgeType":"calls","source":12425,"target":10010},{"edgeType":"contains","source":11382,"target":12122},{"edgeType":"calls","source":4416,"target":2516},{"edgeType":"contains","source":5652,"target":5826},{"edgeType":"contains","source":12384,"target":12770},{"edgeType":"contains","source":832,"target":914},{"edgeType":"contains","source":8498,"target":8504},{"edgeType":"contains","source":12660,"target":12670},{"edgeType":"contains","source":4796,"target":4876},{"edgeType":"calls","source":15725,"target":15531},{"edgeType":"contains","source":14983,"target":14652},{"edgeType":"contains","source":7107,"target":7230},{"edgeType":"contains","source":16821,"target":16867},{"edgeType":"calls","source":723,"target":724},{"edgeType":"contains","source":11382,"target":12119},{"edgeType":"contains","source":4796,"target":4875},{"edgeType":"contains","source":10295,"target":9876},{"edgeType":"calls","source":1454,"target":1321},{"edgeType":"contains","source":9220,"target":9379},{"edgeType":"contains","source":7107,"target":7231},{"edgeType":"contains","source":12660,"target":12669},{"edgeType":"calls","source":4429,"target":4227},{"edgeType":"contains","source":6843,"target":6959},{"edgeType":"contains","source":14176,"target":14302},{"edgeType":"contains","source":11382,"target":12120},{"edgeType":"calls","source":15389,"target":15378},{"edgeType":"calls","source":15225,"target":7778},{"edgeType":"calls","source":1251,"target":1270},{"edgeType":"calls","source":6600,"target":6663},{"edgeType":"contains","source":12384,"target":12768},{"edgeType":"contains","source":12660,"target":12668},{"edgeType":"contains","source":7107,"target":7232},{"edgeType":"contains","source":14246,"target":14247},{"edgeType":"contains","source":3147,"target":3148},{"edgeType":"calls","source":14921,"target":2404},{"edgeType":"calls","source":8915,"target":8892},{"edgeType":"contains","source":7107,"target":7225},{"edgeType":"calls","source":14134,"target":14116},{"edgeType":"contains","source":8498,"target":8501},{"edgeType":"contains","source":12660,"target":12667},{"edgeType":"calls","source":1382,"target":1432},{"edgeType":"contains","source":1410,"target":2029},{"edgeType":"calls","source":1071,"target":503},{"edgeType":"contains","source":3147,"target":3149},{"edgeType":"contains","source":1165,"target":1166},{"edgeType":"calls","source":14663,"target":14629},{"edgeType":"contains","source":12724,"target":4339},{"edgeType":"imports","source":5659,"target":5754},{"edgeType":"calls","source":14207,"target":13966},{"edgeType":"calls","source":6755,"target":6088},{"edgeType":"contains","source":15379,"target":2380},{"edgeType":"contains","source":15958,"target":16142},{"edgeType":"contains","source":11382,"target":12117},{"edgeType":"contains","source":5258,"target":5356},{"edgeType":"contains","source":8763,"target":8744},{"edgeType":"contains","source":10937,"target":11111},{"edgeType":"imports","source":6021,"target":877},{"edgeType":"contains","source":16821,"target":16874},{"edgeType":"imports","source":5659,"target":5757},{"edgeType":"calls","source":9047,"target":9030},{"edgeType":"calls","source":9533,"target":2421},{"edgeType":"contains","source":1410,"target":2027},{"edgeType":"contains","source":11382,"target":12114},{"edgeType":"calls","source":12223,"target":12046},{"edgeType":"contains","source":13648,"target":13747},{"edgeType":"calls","source":3109,"target":2861},{"edgeType":"contains","source":5258,"target":5355},{"edgeType":"contains","source":10937,"target":11112},{"edgeType":"calls","source":6891,"target":1874},{"edgeType":"imports","source":13733,"target":13375},{"edgeType":"contains","source":1448,"target":850},{"edgeType":"contains","source":11382,"target":12115},{"edgeType":"imports","source":6681,"target":5785},{"edgeType":"contains","source":7107,"target":7228},{"edgeType":"contains","source":13611,"target":4339},{"edgeType":"contains","source":7107,"target":7238},{"edgeType":"contains","source":5258,"target":5362},{"edgeType":"contains","source":11382,"target":12129},{"edgeType":"contains","source":1330,"target":2399},{"edgeType":"calls","source":3563,"target":3582},{"edgeType":"contains","source":12908,"target":13447},{"edgeType":"contains","source":4072,"target":4075},{"edgeType":"imports","source":5659,"target":5743},{"edgeType":"contains","source":8036,"target":8037},{"edgeType":"calls","source":8126,"target":7985},{"edgeType":"calls","source":921,"target":921},{"edgeType":"contains","source":5258,"target":5361},{"edgeType":"contains","source":1,"target":5543},{"edgeType":"contains","source":9091,"target":9156},{"edgeType":"contains","source":11382,"target":12130},{"edgeType":"calls","source":1978,"target":1978},{"edgeType":"calls","source":6153,"target":5741},{"edgeType":"contains","source":3351,"target":3170},{"edgeType":"contains","source":4072,"target":4074},{"edgeType":"calls","source":3565,"target":3521},{"edgeType":"contains","source":12384,"target":12778},{"edgeType":"calls","source":11890,"target":11806},{"edgeType":"calls","source":3840,"target":3450},{"edgeType":"contains","source":5258,"target":5360},{"edgeType":"imports","source":13922,"target":1169},{"edgeType":"contains","source":5652,"target":5835},{"edgeType":"contains","source":11184,"target":11923},{"edgeType":"contains","source":9091,"target":9159},{"edgeType":"contains","source":11382,"target":12127},{"edgeType":"contains","source":14176,"target":14293},{"edgeType":"contains","source":3760,"target":3174},{"edgeType":"contains","source":4072,"target":4073},{"edgeType":"contains","source":16821,"target":16862},{"edgeType":"contains","source":12384,"target":12777},{"edgeType":"calls","source":4557,"target":4477},{"edgeType":"contains","source":7107,"target":7241},{"edgeType":"contains","source":15637,"target":15513},{"edgeType":"contains","source":9027,"target":9028},{"edgeType":"calls","source":4026,"target":4027},{"edgeType":"calls","source":3966,"target":3773},{"edgeType":"contains","source":14176,"target":14294},{"edgeType":"contains","source":11382,"target":12128},{"edgeType":"contains","source":1230,"target":1270},{"edgeType":"contains","source":14510,"target":14511},{"edgeType":"contains","source":10084,"target":10085},{"edgeType":"contains","source":900,"target":930},{"edgeType":"contains","source":8036,"target":8038},{"edgeType":"contains","source":6593,"target":6262},{"edgeType":"contains","source":10321,"target":620},{"edgeType":"contains","source":4997,"target":5001},{"edgeType":"contains","source":11382,"target":12125},{"edgeType":"contains","source":8036,"target":8032},{"edgeType":"calls","source":1979,"target":1944},{"edgeType":"calls","source":2085,"target":772},{"edgeType":"contains","source":14176,"target":14295},{"edgeType":"calls","source":2308,"target":2316},{"edgeType":"imports","source":10160,"target":9974},{"edgeType":"contains","source":1410,"target":2037},{"edgeType":"contains","source":11600,"target":11709},{"edgeType":"calls","source":4343,"target":540},{"edgeType":"contains","source":12384,"target":12775},{"edgeType":"contains","source":1230,"target":1275},{"edgeType":"contains","source":4072,"target":4079},{"edgeType":"imports","source":5659,"target":5747},{"edgeType":"contains","source":8168,"target":8169},{"edgeType":"calls","source":3101,"target":3102},{"edgeType":"contains","source":15379,"target":2371},{"edgeType":"contains","source":9365,"target":9114},{"edgeType":"calls","source":5810,"target":5800},{"edgeType":"contains","source":5816,"target":4974},{"edgeType":"contains","source":11382,"target":12126},{"edgeType":"contains","source":12384,"target":12774},{"edgeType":"contains","source":4072,"target":4078},{"edgeType":"calls","source":15694,"target":5926},{"edgeType":"contains","source":7107,"target":7234},{"edgeType":"contains","source":11382,"target":12123},{"edgeType":"contains","source":14176,"target":14297},{"edgeType":"contains","source":3147,"target":3154},{"edgeType":"contains","source":7107,"target":7236},{"edgeType":"contains","source":15435,"target":15436},{"edgeType":"calls","source":6552,"target":6048},{"edgeType":"calls","source":6627,"target":5837},{"edgeType":"contains","source":4072,"target":4077},{"edgeType":"imports","source":2217,"target":2522},{"edgeType":"imports","source":5659,"target":5749},{"edgeType":"contains","source":10522,"target":730},{"edgeType":"calls","source":14180,"target":2126},{"edgeType":"calls","source":16051,"target":16000},{"edgeType":"contains","source":8498,"target":8511},{"edgeType":"contains","source":16821,"target":16866},{"edgeType":"contains","source":14176,"target":14298},{"edgeType":"calls","source":9061,"target":2261},{"edgeType":"contains","source":11382,"target":12124},{"edgeType":"contains","source":15435,"target":15437},{"edgeType":"contains","source":5258,"target":5363},{"edgeType":"calls","source":14663,"target":14635},{"edgeType":"contains","source":4072,"target":4076},{"edgeType":"calls","source":2211,"target":1094},{"edgeType":"contains","source":8498,"target":8510},{"edgeType":"contains","source":12724,"target":12802},{"edgeType":"contains","source":16821,"target":16865},{"edgeType":"contains","source":6377,"target":6588},{"edgeType":"calls","source":6635,"target":5690},{"edgeType":"contains","source":7638,"target":7665},{"edgeType":"contains","source":10484,"target":8231},{"edgeType":"contains","source":10937,"target":11101},{"edgeType":"contains","source":7107,"target":7213},{"edgeType":"contains","source":12724,"target":12784},{"edgeType":"contains","source":14113,"target":14122},{"edgeType":"contains","source":14112,"target":14153},{"edgeType":"contains","source":15764,"target":15792},{"edgeType":"contains","source":7638,"target":7664},{"edgeType":"contains","source":10937,"target":11102},{"edgeType":"contains","source":7107,"target":7214},{"edgeType":"contains","source":14113,"target":14123},{"edgeType":"contains","source":14176,"target":14284},{"edgeType":"calls","source":11231,"target":11202},{"edgeType":"contains","source":11999,"target":12004},{"edgeType":"calls","source":1624,"target":358},{"edgeType":"contains","source":900,"target":907},{"edgeType":"contains","source":7638,"target":7667},{"edgeType":"contains","source":6377,"target":6590},{"edgeType":"contains","source":5452,"target":5668},{"edgeType":"contains","source":13387,"target":13370},{"edgeType":"contains","source":960,"target":1161},{"edgeType":"contains","source":7109,"target":7153},{"edgeType":"contains","source":7107,"target":7215},{"edgeType":"calls","source":10108,"target":10076},{"edgeType":"imports","source":14350,"target":2758},{"edgeType":"contains","source":14112,"target":14155},{"edgeType":"contains","source":14111,"target":14186},{"edgeType":"contains","source":35,"target":239},{"edgeType":"calls","source":9116,"target":9117},{"edgeType":"contains","source":7638,"target":7666},{"edgeType":"contains","source":9091,"target":9133},{"edgeType":"contains","source":5652,"target":5811},{"edgeType":"contains","source":5452,"target":5669},{"edgeType":"contains","source":6377,"target":6591},{"edgeType":"calls","source":8127,"target":8065},{"edgeType":"contains","source":1410,"target":2007},{"edgeType":"contains","source":960,"target":1160},{"edgeType":"contains","source":7107,"target":7216},{"edgeType":"calls","source":9847,"target":9710},{"edgeType":"contains","source":10876,"target":10877},{"edgeType":"contains","source":1330,"target":2373},{"edgeType":"contains","source":12908,"target":13420},{"edgeType":"contains","source":10937,"target":11100},{"edgeType":"contains","source":14113,"target":14125},{"edgeType":"contains","source":14112,"target":14156},{"edgeType":"contains","source":16821,"target":16853},{"edgeType":"imports","source":2621,"target":612},{"edgeType":"contains","source":13648,"target":13734},{"edgeType":"calls","source":15676,"target":2369},{"edgeType":"calls","source":9182,"target":9184},{"edgeType":"contains","source":693,"target":980},{"edgeType":"contains","source":9951,"target":9955},{"edgeType":"contains","source":12257,"target":4004},{"edgeType":"contains","source":7109,"target":7147},{"edgeType":"contains","source":7107,"target":7209},{"edgeType":"imports","source":9090,"target":9376},{"edgeType":"contains","source":960,"target":1163},{"edgeType":"contains","source":7638,"target":7661},{"edgeType":"contains","source":900,"target":909},{"edgeType":"contains","source":12908,"target":13418},{"edgeType":"contains","source":1167,"target":1088},{"edgeType":"contains","source":14113,"target":14126},{"edgeType":"contains","source":14112,"target":14157},{"edgeType":"contains","source":10937,"target":11096},{"edgeType":"calls","source":9116,"target":9119},{"edgeType":"contains","source":9951,"target":9952},{"edgeType":"calls","source":15703,"target":7867},{"edgeType":"imports","source":15712,"target":15495},{"edgeType":"calls","source":3738,"target":358},{"edgeType":"contains","source":6377,"target":6585},{"edgeType":"contains","source":7109,"target":7148},{"edgeType":"contains","source":7107,"target":7210},{"edgeType":"contains","source":7638,"target":7660},{"edgeType":"contains","source":960,"target":1162},{"edgeType":"contains","source":1230,"target":1251},{"edgeType":"imports","source":12666,"target":12674},{"edgeType":"contains","source":900,"target":908},{"edgeType":"contains","source":10937,"target":11098},{"edgeType":"calls","source":15260,"target":15259},{"edgeType":"contains","source":12908,"target":13417},{"edgeType":"calls","source":9116,"target":9118},{"edgeType":"contains","source":35,"target":240},{"edgeType":"contains","source":11999,"target":12000},{"edgeType":"imports","source":15779,"target":15531},{"edgeType":"contains","source":7638,"target":7663},{"edgeType":"contains","source":15958,"target":16127},{"edgeType":"calls","source":8125,"target":8130},{"edgeType":"contains","source":7107,"target":7211},{"edgeType":"contains","source":960,"target":1165},{"edgeType":"contains","source":11184,"target":11894},{"edgeType":"contains","source":12908,"target":13416},{"edgeType":"contains","source":6844,"target":6907},{"edgeType":"contains","source":5855,"target":5856},{"edgeType":"contains","source":8035,"target":8041},{"edgeType":"contains","source":12928,"target":4339},{"edgeType":"contains","source":7638,"target":7662},{"edgeType":"contains","source":14176,"target":14290},{"edgeType":"contains","source":11008,"target":11009},{"edgeType":"contains","source":9224,"target":9234},{"edgeType":"contains","source":7107,"target":7212},{"edgeType":"contains","source":7109,"target":7150},{"edgeType":"contains","source":960,"target":1164},{"edgeType":"calls","source":2186,"target":1960},{"edgeType":"contains","source":14837,"target":14940},{"edgeType":"imports","source":10130,"target":389},{"edgeType":"contains","source":5855,"target":5857},{"edgeType":"contains","source":1,"target":7638},{"edgeType":"contains","source":12595,"target":12564},{"edgeType":"contains","source":14954,"target":15525},{"edgeType":"contains","source":5258,"target":5345},{"edgeType":"calls","source":10121,"target":9679},{"edgeType":"calls","source":10680,"target":806},{"edgeType":"imports","source":12418,"target":1331},{"edgeType":"calls","source":14383,"target":2288},{"edgeType":"calls","source":16053,"target":16057},{"edgeType":"contains","source":14694,"target":15130},{"edgeType":"calls","source":7927,"target":7929},{"edgeType":"imports","source":9090,"target":9365},{"edgeType":"calls","source":10143,"target":540},{"edgeType":"calls","source":15676,"target":2375},{"edgeType":"contains","source":5860,"target":5712},{"edgeType":"calls","source":461,"target":464},{"edgeType":"calls","source":15344,"target":2097},{"edgeType":"contains","source":15764,"target":15785},{"edgeType":"calls","source":2377,"target":2379},{"edgeType":"calls","source":3565,"target":3604},{"edgeType":"imports","source":12759,"target":1331},{"edgeType":"calls","source":10771,"target":10672},{"edgeType":"contains","source":11382,"target":12113},{"edgeType":"contains","source":14113,"target":14115},{"edgeType":"calls","source":3408,"target":2126},{"edgeType":"contains","source":2618,"target":2620},{"edgeType":"contains","source":12384,"target":12760},{"edgeType":"contains","source":8498,"target":8499},{"edgeType":"calls","source":8852,"target":8853},{"edgeType":"contains","source":10678,"target":10680},{"edgeType":"contains","source":12660,"target":12661},{"edgeType":"contains","source":3616,"target":3394},{"edgeType":"contains","source":16821,"target":16844},{"edgeType":"calls","source":2694,"target":1006},{"edgeType":"calls","source":4498,"target":4275},{"edgeType":"contains","source":7107,"target":7224},{"edgeType":"contains","source":1,"target":5528},{"edgeType":"contains","source":16227,"target":16232},{"edgeType":"contains","source":12384,"target":12758},{"edgeType":"imports","source":5144,"target":2734},{"edgeType":"contains","source":7638,"target":7669},{"edgeType":"contains","source":7003,"target":6213},{"edgeType":"contains","source":5452,"target":5670},{"edgeType":"calls","source":11624,"target":11715},{"edgeType":"calls","source":10973,"target":2299},{"edgeType":"calls","source":8919,"target":8892},{"edgeType":"calls","source":6089,"target":5690},{"edgeType":"contains","source":7638,"target":7670},{"edgeType":"contains","source":7638,"target":7668},{"edgeType":"calls","source":723,"target":794},{"edgeType":"contains","source":12907,"target":13457},{"edgeType":"contains","source":7109,"target":7156},{"edgeType":"contains","source":7107,"target":7218},{"edgeType":"calls","source":15661,"target":15520},{"edgeType":"contains","source":10678,"target":10679},{"edgeType":"calls","source":11778,"target":600},{"edgeType":"calls","source":10702,"target":10701},{"edgeType":"contains","source":12158,"target":7079},{"edgeType":"calls","source":12024,"target":12000},{"edgeType":"contains","source":15958,"target":16117},{"edgeType":"calls","source":1056,"target":1044},{"edgeType":"contains","source":7107,"target":7219},{"edgeType":"contains","source":14111,"target":14182},{"edgeType":"calls","source":2245,"target":2236},{"edgeType":"contains","source":7638,"target":7672},{"edgeType":"contains","source":10658,"target":726},{"edgeType":"contains","source":12908,"target":13424},{"edgeType":"calls","source":14005,"target":3438},{"edgeType":"contains","source":1,"target":5532},{"edgeType":"contains","source":14111,"target":14183},{"edgeType":"calls","source":1877,"target":961},{"edgeType":"imports","source":4612,"target":2316},{"edgeType":"contains","source":5258,"target":5346},{"edgeType":"contains","source":7638,"target":7671},{"edgeType":"contains","source":1228,"target":1291},{"edgeType":"imports","source":12418,"target":3436},{"edgeType":"imports","source":3285,"target":3270},{"edgeType":"contains","source":4662,"target":4770},{"edgeType":"contains","source":35,"target":220},{"edgeType":"contains","source":12384,"target":12738},{"edgeType":"contains","source":7638,"target":7649},{"edgeType":"calls","source":1079,"target":358},{"edgeType":"contains","source":5454,"target":5588},{"edgeType":"contains","source":16491,"target":16495},{"edgeType":"contains","source":1228,"target":1292},{"edgeType":"contains","source":7107,"target":7196},{"edgeType":"contains","source":4662,"target":4769},{"edgeType":"contains","source":35,"target":219},{"edgeType":"calls","source":15015,"target":5926},{"edgeType":"contains","source":7638,"target":7648},{"edgeType":"contains","source":6377,"target":6573},{"edgeType":"contains","source":1692,"target":1707},{"edgeType":"contains","source":12384,"target":12737},{"edgeType":"calls","source":726,"target":730},{"edgeType":"contains","source":16491,"target":16494},{"edgeType":"contains","source":7107,"target":7197},{"edgeType":"contains","source":3147,"target":3111},{"edgeType":"contains","source":1228,"target":1293},{"edgeType":"contains","source":1,"target":16075},{"edgeType":"contains","source":4662,"target":4768},{"edgeType":"contains","source":16821,"target":16837},{"edgeType":"calls","source":4889,"target":4864},{"edgeType":"contains","source":13978,"target":14064},{"edgeType":"contains","source":35,"target":222},{"edgeType":"contains","source":11998,"target":12017},{"edgeType":"calls","source":6604,"target":6637},{"edgeType":"contains","source":9750,"target":9826},{"edgeType":"contains","source":12384,"target":12736},{"edgeType":"calls","source":6698,"target":5837},{"edgeType":"contains","source":9224,"target":9222},{"edgeType":"contains","source":7107,"target":7198},{"edgeType":"contains","source":1330,"target":2356},{"edgeType":"contains","source":1228,"target":1290},{"edgeType":"contains","source":4662,"target":4767},{"edgeType":"contains","source":13648,"target":13718},{"edgeType":"imports","source":12013,"target":3303},{"edgeType":"contains","source":35,"target":221},{"edgeType":"contains","source":11998,"target":12016},{"edgeType":"imports","source":9090,"target":9354},{"edgeType":"imports","source":5659,"target":5785},{"edgeType":"contains","source":965,"target":988},{"edgeType":"contains","source":1692,"target":1705},{"edgeType":"calls","source":8720,"target":8691},{"edgeType":"contains","source":7107,"target":7199},{"edgeType":"calls","source":12023,"target":12000},{"edgeType":"calls","source":14686,"target":3438},{"edgeType":"contains","source":16491,"target":16496},{"edgeType":"calls","source":9644,"target":9647},{"edgeType":"contains","source":1,"target":16077},{"edgeType":"contains","source":6580,"target":6617},{"edgeType":"contains","source":35,"target":224},{"edgeType":"contains","source":11998,"target":12015},{"edgeType":"imports","source":5659,"target":5788},{"edgeType":"calls","source":9205,"target":2115},{"edgeType":"contains","source":15500,"target":15508},{"edgeType":"contains","source":7107,"target":7192},{"edgeType":"calls","source":14457,"target":2088},{"edgeType":"calls","source":11296,"target":11288},{"edgeType":"contains","source":3479,"target":3394},{"edgeType":"contains","source":7638,"target":7645},{"edgeType":"contains","source":4662,"target":4774},{"edgeType":"contains","source":9091,"target":9111},{"edgeType":"contains","source":5454,"target":5584},{"edgeType":"contains","source":1055,"target":2429},{"edgeType":"contains","source":12262,"target":12286},{"edgeType":"contains","source":14111,"target":14172},{"edgeType":"imports","source":14257,"target":14073},{"edgeType":"contains","source":4662,"target":4773},{"edgeType":"contains","source":6580,"target":6618},{"edgeType":"imports","source":7711,"target":7714},{"edgeType":"contains","source":11998,"target":12014},{"edgeType":"contains","source":7107,"target":7193},{"edgeType":"calls","source":3370,"target":3327},{"edgeType":"contains","source":7638,"target":7644},{"edgeType":"contains","source":4795,"target":4878},{"edgeType":"calls","source":1072,"target":570},{"edgeType":"contains","source":9091,"target":9110},{"edgeType":"contains","source":1055,"target":2428},{"edgeType":"contains","source":5454,"target":5585},{"edgeType":"contains","source":4662,"target":4772},{"edgeType":"contains","source":16821,"target":16841},{"edgeType":"contains","source":15500,"target":15510},{"edgeType":"calls","source":6623,"target":6052},{"edgeType":"contains","source":5130,"target":5062},{"edgeType":"calls","source":4578,"target":3931},{"edgeType":"contains","source":5454,"target":5586},{"edgeType":"contains","source":13057,"target":13009},{"edgeType":"calls","source":2907,"target":2879},{"edgeType":"contains","source":1230,"target":1232},{"edgeType":"contains","source":965,"target":993},{"edgeType":"contains","source":3212,"target":3213},{"edgeType":"contains","source":14111,"target":14174},{"edgeType":"contains","source":4662,"target":4771},{"edgeType":"contains","source":35,"target":225},{"edgeType":"contains","source":11998,"target":12012},{"edgeType":"contains","source":7638,"target":7646},{"edgeType":"calls","source":4578,"target":3930},{"edgeType":"contains","source":5454,"target":5587},{"edgeType":"contains","source":11336,"target":11394},{"edgeType":"calls","source":12155,"target":12140},{"edgeType":"contains","source":16227,"target":16228},{"edgeType":"contains","source":1055,"target":2430},{"edgeType":"contains","source":7107,"target":7195},{"edgeType":"contains","source":5062,"target":5063},{"edgeType":"contains","source":7109,"target":7143},{"edgeType":"contains","source":7107,"target":7205},{"edgeType":"imports","source":11788,"target":8159},{"edgeType":"imports","source":15581,"target":15308},{"edgeType":"contains","source":9091,"target":9124},{"edgeType":"calls","source":8500,"target":4947},{"edgeType":"calls","source":6670,"target":6711},{"edgeType":"calls","source":2113,"target":2122},{"edgeType":"contains","source":7638,"target":7657},{"edgeType":"contains","source":4795,"target":4883},{"edgeType":"contains","source":13978,"target":14054},{"edgeType":"contains","source":12908,"target":13414},{"edgeType":"contains","source":1228,"target":1300},{"edgeType":"contains","source":11061,"target":3020},{"edgeType":"contains","source":15169,"target":15186},{"edgeType":"calls","source":15816,"target":2246},{"edgeType":"contains","source":6593,"target":6226},{"edgeType":"contains","source":6580,"target":6629},{"edgeType":"contains","source":7107,"target":7206},{"edgeType":"calls","source":2244,"target":2290},{"edgeType":"contains","source":5997,"target":5676},{"edgeType":"contains","source":7638,"target":7656},{"edgeType":"imports","source":1715,"target":1209},{"edgeType":"imports","source":696,"target":1088},{"edgeType":"calls","source":14383,"target":2271},{"edgeType":"contains","source":13978,"target":14055},{"edgeType":"calls","source":1456,"target":1346},{"edgeType":"contains","source":16821,"target":16826},{"edgeType":"contains","source":12908,"target":13413},{"edgeType":"contains","source":6580,"target":6630},{"edgeType":"calls","source":924,"target":926},{"edgeType":"contains","source":15169,"target":15187},{"edgeType":"contains","source":9224,"target":9231},{"edgeType":"contains","source":7109,"target":7145},{"edgeType":"contains","source":7107,"target":7207},{"edgeType":"contains","source":11936,"target":11833},{"edgeType":"calls","source":14800,"target":14717},{"edgeType":"contains","source":7638,"target":7659},{"edgeType":"contains","source":12908,"target":13412},{"edgeType":"contains","source":14837,"target":14910},{"edgeType":"contains","source":1228,"target":1298},{"edgeType":"calls","source":5302,"target":4737},{"edgeType":"contains","source":6580,"target":6631},{"edgeType":"contains","source":7106,"target":7239},{"edgeType":"contains","source":7107,"target":7208},{"edgeType":"contains","source":11852,"target":12322},{"edgeType":"contains","source":7638,"target":7658},{"edgeType":"contains","source":8267,"target":2958},{"edgeType":"contains","source":1228,"target":1299},{"edgeType":"contains","source":15169,"target":15189},{"edgeType":"contains","source":15173,"target":15065},{"edgeType":"contains","source":12908,"target":13411},{"edgeType":"contains","source":4662,"target":4775},{"edgeType":"calls","source":3249,"target":2844},{"edgeType":"contains","source":14837,"target":14911},{"edgeType":"contains","source":965,"target":996},{"edgeType":"calls","source":7654,"target":5807},{"edgeType":"contains","source":9224,"target":9225},{"edgeType":"contains","source":13611,"target":4302},{"edgeType":"calls","source":2244,"target":2285},{"edgeType":"contains","source":5791,"target":5715},{"edgeType":"calls","source":794,"target":725},{"edgeType":"imports","source":5659,"target":5780},{"edgeType":"calls","source":12058,"target":358},{"edgeType":"contains","source":12908,"target":13410},{"edgeType":"calls","source":1679,"target":772},{"edgeType":"calls","source":3340,"target":2134},{"edgeType":"contains","source":15169,"target":15190},{"edgeType":"contains","source":7107,"target":7200},{"edgeType":"contains","source":5062,"target":5066},{"edgeType":"calls","source":8125,"target":8121},{"edgeType":"contains","source":12257,"target":3993},{"edgeType":"calls","source":2244,"target":2286},{"edgeType":"contains","source":9750,"target":9833},{"edgeType":"contains","source":1228,"target":1305},{"edgeType":"imports","source":5659,"target":5779},{"edgeType":"contains","source":10937,"target":11089},{"edgeType":"calls","source":794,"target":724},{"edgeType":"contains","source":15169,"target":15191},{"edgeType":"imports","source":15649,"target":15308},{"edgeType":"calls","source":13082,"target":13010},{"edgeType":"contains","source":15318,"target":4230},{"edgeType":"imports","source":9090,"target":893},{"edgeType":"contains","source":13754,"target":4095},{"edgeType":"imports","source":11788,"target":8161},{"edgeType":"contains","source":15500,"target":15502},{"edgeType":"contains","source":960,"target":1157},{"edgeType":"contains","source":5062,"target":5065},{"edgeType":"contains","source":7107,"target":7203},{"edgeType":"calls","source":14474,"target":14252},{"edgeType":"calls","source":2641,"target":2660},{"edgeType":"contains","source":14112,"target":14134},{"edgeType":"contains","source":12257,"target":3992},{"edgeType":"calls","source":10642,"target":10427},{"edgeType":"contains","source":7638,"target":7655},{"edgeType":"imports","source":5659,"target":5782},{"edgeType":"contains","source":6119,"target":6120},{"edgeType":"contains","source":9091,"target":9121},{"edgeType":"contains","source":7109,"target":7140},{"edgeType":"contains","source":7107,"target":7202},{"edgeType":"contains","source":12908,"target":13408},{"edgeType":"contains","source":16491,"target":16493},{"edgeType":"contains","source":960,"target":1156},{"edgeType":"contains","source":5062,"target":5064},{"edgeType":"contains","source":7109,"target":7142},{"edgeType":"contains","source":7107,"target":7204},{"edgeType":"calls","source":6156,"target":5741},{"edgeType":"contains","source":13978,"target":14061},{"edgeType":"contains","source":9750,"target":9831},{"edgeType":"contains","source":6119,"target":6121},{"edgeType":"contains","source":16491,"target":16492},{"edgeType":"contains","source":6377,"target":6579},{"edgeType":"imports","source":9090,"target":9350},{"edgeType":"contains","source":6580,"target":6628},{"edgeType":"contains","source":14837,"target":14915},{"edgeType":"contains","source":15958,"target":16088},{"edgeType":"contains","source":14441,"target":14491},{"edgeType":"calls","source":8788,"target":8679},{"edgeType":"calls","source":723,"target":774},{"edgeType":"calls","source":4413,"target":2660},{"edgeType":"contains","source":10875,"target":10876},{"edgeType":"contains","source":12908,"target":13390},{"edgeType":"calls","source":4575,"target":3980},{"edgeType":"contains","source":7109,"target":7118},{"edgeType":"contains","source":7107,"target":7180},{"edgeType":"contains","source":10937,"target":11068},{"edgeType":"calls","source":14466,"target":14473},{"edgeType":"calls","source":4887,"target":4879},{"edgeType":"contains","source":13386,"target":13370},{"edgeType":"contains","source":13978,"target":14046},{"edgeType":"calls","source":15743,"target":2370},{"edgeType":"calls","source":12818,"target":12708},{"edgeType":"contains","source":832,"target":865},{"edgeType":"calls","source":6755,"target":6166},{"edgeType":"calls","source":4830,"target":4530},{"edgeType":"contains","source":10937,"target":11069},{"edgeType":"contains","source":13385,"target":13400},{"edgeType":"calls","source":6274,"target":6276},{"edgeType":"contains","source":7109,"target":7119},{"edgeType":"contains","source":7107,"target":7181},{"edgeType":"calls","source":4416,"target":2566},{"edgeType":"contains","source":12908,"target":13389},{"edgeType":"imports","source":14584,"target":14560},{"edgeType":"calls","source":3565,"target":3579},{"edgeType":"contains","source":4662,"target":4752},{"edgeType":"contains","source":11061,"target":2996},{"edgeType":"imports","source":7458,"target":801},{"edgeType":"calls","source":995,"target":798},{"edgeType":"contains","source":11336,"target":11384},{"edgeType":"calls","source":6988,"target":1058},{"edgeType":"calls","source":15672,"target":4572},{"edgeType":"contains","source":5788,"target":5789},{"edgeType":"contains","source":13978,"target":14047},{"edgeType":"contains","source":15763,"target":15791},{"edgeType":"contains","source":1631,"target":1464},{"edgeType":"contains","source":6250,"target":6266},{"edgeType":"contains","source":15519,"target":4330},{"edgeType":"imports","source":696,"target":1127},{"edgeType":"contains","source":13385,"target":13399},{"edgeType":"contains","source":16424,"target":16443},{"edgeType":"contains","source":965,"target":973},{"edgeType":"contains","source":7109,"target":7120},{"edgeType":"contains","source":7107,"target":7182},{"edgeType":"contains","source":10937,"target":11066},{"edgeType":"contains","source":12908,"target":13388},{"edgeType":"calls","source":460,"target":473},{"edgeType":"contains","source":12908,"target":13387},{"edgeType":"contains","source":12262,"target":12273},{"edgeType":"contains","source":13978,"target":14048},{"edgeType":"contains","source":7770,"target":7771},{"edgeType":"calls","source":9047,"target":9109},{"edgeType":"imports","source":5659,"target":5836},{"edgeType":"calls","source":1980,"target":1976},{"edgeType":"calls","source":4048,"target":3403},{"edgeType":"contains","source":7109,"target":7121},{"edgeType":"contains","source":7107,"target":7183},{"edgeType":"calls","source":2376,"target":2383},{"edgeType":"contains","source":13385,"target":13398},{"edgeType":"calls","source":14438,"target":540},{"edgeType":"contains","source":16424,"target":16442},{"edgeType":"contains","source":12908,"target":13386},{"edgeType":"contains","source":12262,"target":12272},{"edgeType":"contains","source":4662,"target":4750},{"edgeType":"calls","source":2178,"target":2179},{"edgeType":"contains","source":13978,"target":14049},{"edgeType":"contains","source":15366,"target":15416},{"edgeType":"calls","source":3741,"target":2349},{"edgeType":"imports","source":9696,"target":9644},{"edgeType":"contains","source":15763,"target":15793},{"edgeType":"calls","source":3565,"target":3577},{"edgeType":"calls","source":1319,"target":1321},{"edgeType":"contains","source":4662,"target":4758},{"edgeType":"contains","source":13385,"target":13397},{"edgeType":"contains","source":9091,"target":9095},{"edgeType":"contains","source":16424,"target":16445},{"edgeType":"imports","source":10426,"target":8161},{"edgeType":"contains","source":16821,"target":16823},{"edgeType":"imports","source":13526,"target":13529},{"edgeType":"contains","source":9541,"target":9943},{"edgeType":"contains","source":4662,"target":4757},{"edgeType":"calls","source":12708,"target":3438},{"edgeType":"calls","source":6759,"target":6046},{"edgeType":"imports","source":5659,"target":5838},{"edgeType":"contains","source":1692,"target":1694},{"edgeType":"contains","source":15366,"target":15417},{"edgeType":"calls","source":15523,"target":15528},{"edgeType":"contains","source":15763,"target":15794},{"edgeType":"contains","source":11998,"target":11999},{"edgeType":"contains","source":6377,"target":6551},{"edgeType":"contains","source":7109,"target":7115},{"edgeType":"contains","source":15764,"target":15765},{"edgeType":"calls","source":7338,"target":7124},{"edgeType":"contains","source":10937,"target":11065},{"edgeType":"contains","source":9541,"target":9942},{"edgeType":"contains","source":12262,"target":12270},{"edgeType":"calls","source":11222,"target":2996},{"edgeType":"contains","source":12908,"target":13384},{"edgeType":"contains","source":16821,"target":16822},{"edgeType":"contains","source":5986,"target":5989},{"edgeType":"calls","source":7560,"target":4470},{"edgeType":"contains","source":13978,"target":14051},{"edgeType":"contains","source":6593,"target":6198},{"edgeType":"imports","source":5659,"target":5837},{"edgeType":"contains","source":7109,"target":7116},{"edgeType":"contains","source":7107,"target":7178},{"edgeType":"imports","source":12469,"target":12473},{"edgeType":"imports","source":13922,"target":13940},{"edgeType":"calls","source":3269,"target":2178},{"edgeType":"contains","source":965,"target":977},{"edgeType":"contains","source":13978,"target":14052},{"edgeType":"contains","source":9541,"target":9945},{"edgeType":"contains","source":16821,"target":16825},{"edgeType":"imports","source":5659,"target":5840},{"edgeType":"contains","source":15764,"target":15767},{"edgeType":"contains","source":965,"target":976},{"edgeType":"calls","source":13936,"target":5535},{"edgeType":"contains","source":7109,"target":7117},{"edgeType":"contains","source":7107,"target":7179},{"edgeType":"contains","source":16424,"target":16446},{"edgeType":"contains","source":16821,"target":16824},{"edgeType":"contains","source":10937,"target":11062},{"edgeType":"contains","source":9541,"target":9944},{"edgeType":"calls","source":14844,"target":642},{"edgeType":"calls","source":8720,"target":8679},{"edgeType":"contains","source":15169,"target":15185},{"edgeType":"contains","source":6250,"target":6263},{"edgeType":"calls","source":723,"target":766},{"edgeType":"contains","source":5454,"target":5579},{"edgeType":"calls","source":3563,"target":3632},{"edgeType":"contains","source":8267,"target":2940},{"edgeType":"contains","source":14837,"target":14891},{"edgeType":"contains","source":6377,"target":6563},{"edgeType":"contains","source":965,"target":979},{"edgeType":"contains","source":11998,"target":12011},{"edgeType":"contains","source":7301,"target":7516},{"edgeType":"contains","source":7109,"target":7126},{"edgeType":"contains","source":7107,"target":7188},{"edgeType":"contains","source":7638,"target":7641},{"edgeType":"contains","source":1692,"target":1698},{"edgeType":"contains","source":13385,"target":13409},{"edgeType":"contains","source":13978,"target":14038},{"edgeType":"contains","source":6377,"target":6564},{"edgeType":"calls","source":6818,"target":6336},{"edgeType":"contains","source":11998,"target":12010},{"edgeType":"calls","source":2456,"target":2011},{"edgeType":"contains","source":15763,"target":15783},{"edgeType":"contains","source":15762,"target":15814},{"edgeType":"imports","source":16165,"target":16282},{"edgeType":"contains","source":7638,"target":7640},{"edgeType":"imports","source":13922,"target":13934},{"edgeType":"contains","source":7722,"target":808},{"edgeType":"contains","source":6844,"target":6887},{"edgeType":"contains","source":35,"target":214},{"edgeType":"calls","source":3565,"target":3568},{"edgeType":"contains","source":10937,"target":11074},{"edgeType":"contains","source":4662,"target":4760},{"edgeType":"contains","source":6581,"target":6584},{"edgeType":"calls","source":1655,"target":1473},{"edgeType":"contains","source":960,"target":1136},{"edgeType":"calls","source":14347,"target":13940},{"edgeType":"contains","source":11998,"target":12009},{"edgeType":"contains","source":7638,"target":7643},{"edgeType":"contains","source":1692,"target":1696},{"edgeType":"contains","source":7503,"target":7598},{"edgeType":"contains","source":13978,"target":14040},{"edgeType":"imports","source":696,"target":1136},{"edgeType":"imports","source":8837,"target":2440},{"edgeType":"contains","source":10937,"target":11075},{"edgeType":"contains","source":14837,"target":14894},{"edgeType":"contains","source":12908,"target":13395},{"edgeType":"contains","source":6377,"target":6566},{"edgeType":"contains","source":7107,"target":7191},{"edgeType":"contains","source":13395,"target":13096},{"edgeType":"contains","source":13385,"target":13406},{"edgeType":"contains","source":1,"target":7609},{"edgeType":"contains","source":9091,"target":9108},{"edgeType":"calls","source":3978,"target":3450},{"edgeType":"contains","source":7638,"target":7642},{"edgeType":"calls","source":12826,"target":4011},{"edgeType":"calls","source":4358,"target":4354},{"edgeType":"calls","source":1981,"target":1936},{"edgeType":"contains","source":1692,"target":1697},{"edgeType":"contains","source":5454,"target":5583},{"edgeType":"contains","source":4662,"target":4766},{"edgeType":"contains","source":1956,"target":1974},{"edgeType":"contains","source":15169,"target":15174},{"edgeType":"contains","source":7109,"target":7122},{"edgeType":"contains","source":7107,"target":7184},{"edgeType":"calls","source":9699,"target":1591},{"edgeType":"contains","source":965,"target":983},{"edgeType":"contains","source":1692,"target":1702},{"edgeType":"calls","source":8720,"target":8686},{"edgeType":"contains","source":13385,"target":13405},{"edgeType":"contains","source":15762,"target":15817},{"edgeType":"calls","source":2085,"target":821},{"edgeType":"imports","source":14954,"target":965},{"edgeType":"contains","source":15958,"target":16083},{"edgeType":"contains","source":13648,"target":13708},{"edgeType":"calls","source":6511,"target":1058},{"edgeType":"contains","source":1891,"target":1876},{"edgeType":"contains","source":10937,"target":11073},{"edgeType":"calls","source":2775,"target":2688},{"edgeType":"contains","source":1,"target":3383},{"edgeType":"calls","source":6960,"target":6166},{"edgeType":"contains","source":7109,"target":7123},{"edgeType":"contains","source":7107,"target":7185},{"edgeType":"calls","source":13791,"target":3698},{"edgeType":"calls","source":4556,"target":4556},{"edgeType":"contains","source":5927,"target":5712},{"edgeType":"contains","source":965,"target":982},{"edgeType":"contains","source":1692,"target":1703},{"edgeType":"contains","source":13385,"target":13404},{"edgeType":"imports","source":2434,"target":2220},{"edgeType":"imports","source":10291,"target":10223},{"edgeType":"contains","source":15762,"target":15818},{"edgeType":"contains","source":1330,"target":2355},{"edgeType":"contains","source":13978,"target":14043},{"edgeType":"contains","source":1448,"target":807},{"edgeType":"contains","source":14441,"target":14489},{"edgeType":"calls","source":16119,"target":16089},{"edgeType":"contains","source":7107,"target":7186},{"edgeType":"contains","source":14837,"target":14897},{"edgeType":"calls","source":1117,"target":1235},{"edgeType":"calls","source":8715,"target":8843},{"edgeType":"contains","source":965,"target":985},{"edgeType":"calls","source":16250,"target":16256},{"edgeType":"contains","source":15762,"target":15819},{"edgeType":"contains","source":7638,"target":7639},{"edgeType":"contains","source":14441,"target":14490},{"edgeType":"calls","source":15604,"target":4572},{"edgeType":"contains","source":693,"target":960},{"edgeType":"contains","source":14837,"target":14898},{"edgeType":"imports","source":13217,"target":12533},{"edgeType":"imports","source":15636,"target":965},{"edgeType":"contains","source":965,"target":984},{"edgeType":"imports","source":2618,"target":742},{"edgeType":"calls","source":3773,"target":3459},{"edgeType":"contains","source":7109,"target":7125},{"edgeType":"contains","source":7107,"target":7187},{"edgeType":"contains","source":15763,"target":15789},{"edgeType":"contains","source":15762,"target":15820},{"edgeType":"calls","source":4402,"target":903},{"edgeType":"contains","source":5389,"target":5455},{"edgeType":"contains","source":6586,"target":6402},{"edgeType":"contains","source":35,"target":187},{"edgeType":"contains","source":1,"target":3355},{"edgeType":"imports","source":11679,"target":11579},{"edgeType":"imports","source":9090,"target":9388},{"edgeType":"contains","source":6377,"target":6539},{"edgeType":"contains","source":10550,"target":6136},{"edgeType":"contains","source":12394,"target":12395},{"edgeType":"contains","source":16424,"target":16425},{"edgeType":"contains","source":7107,"target":7163},{"edgeType":"imports","source":2622,"target":600},{"edgeType":"contains","source":15958,"target":16072},{"edgeType":"imports","source":5659,"target":5816},{"edgeType":"contains","source":4928,"target":4946},{"edgeType":"contains","source":1410,"target":1960},{"edgeType":"contains","source":14837,"target":14884},{"edgeType":"calls","source":15923,"target":15801},{"edgeType":"contains","source":5389,"target":5453},{"edgeType":"contains","source":16158,"target":16216},{"edgeType":"calls","source":15005,"target":14663},{"edgeType":"contains","source":4466,"target":4469},{"edgeType":"contains","source":15763,"target":15776},{"edgeType":"contains","source":11184,"target":11848},{"edgeType":"calls","source":13966,"target":358},{"edgeType":"calls","source":7935,"target":7624},{"edgeType":"contains","source":6377,"target":6541},{"edgeType":"contains","source":12724,"target":12733},{"edgeType":"contains","source":16424,"target":16427},{"edgeType":"contains","source":12908,"target":13370},{"edgeType":"contains","source":16158,"target":16215},{"edgeType":"calls","source":15717,"target":3162},{"edgeType":"contains","source":6250,"target":6251},{"edgeType":"contains","source":6377,"target":6542},{"edgeType":"contains","source":12724,"target":12732},{"edgeType":"contains","source":16424,"target":16426},{"edgeType":"contains","source":10937,"target":11047},{"edgeType":"calls","source":12690,"target":3980},{"edgeType":"contains","source":8036,"target":7958},{"edgeType":"calls","source":1521,"target":1418},{"edgeType":"calls","source":3868,"target":540},{"edgeType":"imports","source":5659,"target":5821},{"edgeType":"contains","source":2079,"target":2364},{"edgeType":"contains","source":4928,"target":4951},{"edgeType":"contains","source":11936,"target":11790},{"edgeType":"calls","source":14869,"target":14645},{"edgeType":"contains","source":12724,"target":12731},{"edgeType":"calls","source":1319,"target":1337},{"edgeType":"imports","source":12666,"target":12690},{"edgeType":"contains","source":5454,"target":5551},{"edgeType":"calls","source":8128,"target":7985},{"edgeType":"imports","source":13919,"target":1331},{"edgeType":"contains","source":8096,"target":8211},{"edgeType":"calls","source":14531,"target":14559},{"edgeType":"contains","source":13978,"target":14034},{"edgeType":"imports","source":15800,"target":4327},{"edgeType":"calls","source":15000,"target":2134},{"edgeType":"contains","source":2079,"target":2365},{"edgeType":"contains","source":1,"target":3358},{"edgeType":"contains","source":12378,"target":12885},{"edgeType":"contains","source":15439,"target":15253},{"edgeType":"contains","source":4928,"target":4950},{"edgeType":"calls","source":10701,"target":10674},{"edgeType":"calls","source":5285,"target":5236},{"edgeType":"imports","source":15800,"target":4326},{"edgeType":"contains","source":5858,"target":5712},{"edgeType":"contains","source":12724,"target":12730},{"edgeType":"contains","source":14244,"target":14245},{"edgeType":"contains","source":16424,"target":16428},{"edgeType":"contains","source":12908,"target":13367},{"edgeType":"contains","source":14837,"target":14889},{"edgeType":"contains","source":13714,"target":13750},{"edgeType":"contains","source":2079,"target":2362},{"edgeType":"imports","source":15800,"target":4330},{"edgeType":"contains","source":12378,"target":12884},{"edgeType":"contains","source":6377,"target":6536},{"edgeType":"contains","source":4928,"target":4949},{"edgeType":"contains","source":14244,"target":14246},{"edgeType":"calls","source":794,"target":702},{"edgeType":"contains","source":16424,"target":16431},{"edgeType":"contains","source":8096,"target":8213},{"edgeType":"contains","source":14694,"target":15095},{"edgeType":"contains","source":12908,"target":13366},{"edgeType":"contains","source":2079,"target":2363},{"edgeType":"contains","source":12384,"target":12697},{"edgeType":"contains","source":12378,"target":12883},{"edgeType":"contains","source":1,"target":3361},{"edgeType":"contains","source":6377,"target":6538},{"edgeType":"contains","source":4928,"target":4948},{"edgeType":"contains","source":15385,"target":4244},{"edgeType":"contains","source":12724,"target":12728},{"edgeType":"contains","source":908,"target":612},{"edgeType":"contains","source":16424,"target":16430},{"edgeType":"calls","source":16367,"target":8377},{"edgeType":"contains","source":7109,"target":7110},{"edgeType":"contains","source":15958,"target":16063},{"edgeType":"contains","source":14366,"target":14677},{"edgeType":"imports","source":696,"target":1120},{"edgeType":"contains","source":1410,"target":1967},{"edgeType":"contains","source":4070,"target":4071},{"edgeType":"contains","source":6377,"target":6547},{"edgeType":"calls","source":16382,"target":16379},{"edgeType":"imports","source":15800,"target":14893},{"edgeType":"contains","source":7109,"target":7111},{"edgeType":"contains","source":12759,"target":13771},{"edgeType":"calls","source":14995,"target":14980},{"edgeType":"calls","source":11084,"target":3033},{"edgeType":"contains","source":13464,"target":13057},{"edgeType":"contains","source":1228,"target":1268},{"edgeType":"contains","source":15109,"target":4330},{"edgeType":"contains","source":6377,"target":6548},{"edgeType":"calls","source":15879,"target":2375},{"edgeType":"contains","source":13385,"target":13391},{"edgeType":"contains","source":14366,"target":14679},{"edgeType":"imports","source":14257,"target":14105},{"edgeType":"contains","source":10085,"target":9986},{"edgeType":"contains","source":9091,"target":9093},{"edgeType":"calls","source":4396,"target":1079},{"edgeType":"contains","source":13648,"target":13694},{"edgeType":"calls","source":16382,"target":16380},{"edgeType":"calls","source":16384,"target":16318},{"edgeType":"calls","source":14074,"target":13930},{"edgeType":"contains","source":9541,"target":9941},{"edgeType":"contains","source":15229,"target":611},{"edgeType":"contains","source":1,"target":3366},{"edgeType":"contains","source":1410,"target":1965},{"edgeType":"contains","source":14705,"target":14741},{"edgeType":"contains","source":12908,"target":13379},{"edgeType":"contains","source":12262,"target":12265},{"edgeType":"contains","source":6377,"target":6549},{"edgeType":"contains","source":7109,"target":7113},{"edgeType":"contains","source":7107,"target":7175},{"edgeType":"contains","source":12759,"target":13769},{"edgeType":"calls","source":2244,"target":2255},{"edgeType":"contains","source":9091,"target":9092},{"edgeType":"contains","source":1410,"target":1966},{"edgeType":"contains","source":5986,"target":5987},{"edgeType":"contains","source":14705,"target":14742},{"edgeType":"contains","source":12908,"target":13378},{"edgeType":"contains","source":12262,"target":12264},{"edgeType":"imports","source":12666,"target":12689},{"edgeType":"contains","source":6377,"target":6550},{"edgeType":"contains","source":4928,"target":4952},{"edgeType":"contains","source":7301,"target":7496},{"edgeType":"contains","source":12759,"target":13768},{"edgeType":"contains","source":14366,"target":14681},{"edgeType":"imports","source":15712,"target":15504},{"edgeType":"contains","source":15763,"target":15770},{"edgeType":"calls","source":1980,"target":1979},{"edgeType":"calls","source":4028,"target":4028},{"edgeType":"calls","source":10570,"target":10514},{"edgeType":"calls","source":2244,"target":2252},{"edgeType":"contains","source":13648,"target":13692},{"edgeType":"contains","source":12262,"target":12263},{"edgeType":"contains","source":12908,"target":13377},{"edgeType":"contains","source":14835,"target":14941},{"edgeType":"imports","source":15581,"target":15336},{"edgeType":"calls","source":9839,"target":1463},{"edgeType":"calls","source":9379,"target":9381},{"edgeType":"calls","source":7769,"target":2210},{"edgeType":"contains","source":12759,"target":13767},{"edgeType":"calls","source":8123,"target":8150},{"edgeType":"contains","source":11337,"target":11341},{"edgeType":"contains","source":14366,"target":14682},{"edgeType":"calls","source":16382,"target":16375},{"edgeType":"contains","source":13648,"target":13691},{"edgeType":"calls","source":8987,"target":8847},{"edgeType":"imports","source":14584,"target":14531},{"edgeType":"calls","source":14869,"target":14654},{"edgeType":"contains","source":13978,"target":14026},{"edgeType":"calls","source":6155,"target":5741},{"edgeType":"contains","source":6250,"target":6253},{"edgeType":"contains","source":16622,"target":16624},{"edgeType":"contains","source":12908,"target":13376},{"edgeType":"contains","source":14835,"target":14942},{"edgeType":"contains","source":10937,"target":11056},{"edgeType":"contains","source":14371,"target":14528},{"edgeType":"contains","source":11337,"target":11338},{"edgeType":"contains","source":16027,"target":16045},{"edgeType":"contains","source":12394,"target":12397},{"edgeType":"calls","source":16055,"target":15942},{"edgeType":"contains","source":6377,"target":6545},{"edgeType":"calls","source":11361,"target":11360},{"edgeType":"contains","source":12759,"target":13766},{"edgeType":"contains","source":11337,"target":11339},{"edgeType":"contains","source":14371,"target":14529},{"edgeType":"imports","source":12821,"target":3651},{"edgeType":"contains","source":14111,"target":14133},{"edgeType":"contains","source":1410,"target":1970},{"edgeType":"contains","source":13978,"target":14028},{"edgeType":"contains","source":5452,"target":5624},{"edgeType":"contains","source":6250,"target":6255},{"edgeType":"contains","source":7107,"target":7170},{"edgeType":"contains","source":14835,"target":14944},{"edgeType":"imports","source":9825,"target":9644},{"edgeType":"imports","source":12469,"target":12244},{"edgeType":"calls","source":4485,"target":2641},{"edgeType":"contains","source":14837,"target":14866},{"edgeType":"contains","source":7301,"target":7475},{"edgeType":"contains","source":12988,"target":12991},{"edgeType":"contains","source":12908,"target":13357},{"edgeType":"calls","source":4890,"target":4885},{"edgeType":"calls","source":15682,"target":2246},{"edgeType":"calls","source":3705,"target":3565},{"edgeType":"imports","source":16466,"target":4613},{"edgeType":"calls","source":3106,"target":3108},{"edgeType":"contains","source":13978,"target":14013},{"edgeType":"contains","source":8096,"target":8200},{"edgeType":"contains","source":1692,"target":1657},{"edgeType":"calls","source":5815,"target":5806},{"edgeType":"calls","source":6582,"target":1058},{"edgeType":"contains","source":14694,"target":15072},{"edgeType":"contains","source":11270,"target":11283},{"edgeType":"contains","source":12988,"target":12990},{"edgeType":"contains","source":8096,"target":8199},{"edgeType":"contains","source":5994,"target":5712},{"edgeType":"contains","source":12908,"target":13355},{"edgeType":"contains","source":13714,"target":13738},{"edgeType":"contains","source":13978,"target":14014},{"edgeType":"contains","source":16027,"target":16030},{"edgeType":"calls","source":9118,"target":9118},{"edgeType":"calls","source":4700,"target":2316},{"edgeType":"contains","source":4928,"target":4929},{"edgeType":"calls","source":10043,"target":10043},{"edgeType":"contains","source":1426,"target":1444},{"edgeType":"contains","source":16227,"target":16175},{"edgeType":"calls","source":11630,"target":11580},{"edgeType":"calls","source":5815,"target":5804},{"edgeType":"contains","source":16027,"target":16033},{"edgeType":"contains","source":35,"target":173},{"edgeType":"calls","source":3565,"target":1561},{"edgeType":"calls","source":5550,"target":5563},{"edgeType":"contains","source":8096,"target":8202},{"edgeType":"contains","source":12063,"target":12067},{"edgeType":"calls","source":1058,"target":1060},{"edgeType":"contains","source":10543,"target":10563},{"edgeType":"calls","source":6345,"target":6293},{"edgeType":"contains","source":6844,"target":6847},{"edgeType":"calls","source":6158,"target":5741},{"edgeType":"contains","source":10940,"target":10941},{"edgeType":"contains","source":14893,"target":4677},{"edgeType":"contains","source":14836,"target":14901},{"edgeType":"calls","source":14928,"target":2361},{"edgeType":"contains","source":13714,"target":13736},{"edgeType":"contains","source":16158,"target":16199},{"edgeType":"contains","source":35,"target":172},{"edgeType":"contains","source":12063,"target":12066},{"edgeType":"calls","source":5815,"target":5803},{"edgeType":"contains","source":13781,"target":13773},{"edgeType":"imports","source":15503,"target":15439},{"edgeType":"imports","source":14114,"target":14103},{"edgeType":"contains","source":8096,"target":8201},{"edgeType":"imports","source":14133,"target":2944},{"edgeType":"contains","source":1410,"target":1946},{"edgeType":"calls","source":2773,"target":2856},{"edgeType":"contains","source":2679,"target":2775},{"edgeType":"contains","source":8096,"target":8196},{"edgeType":"contains","source":5389,"target":5442},{"edgeType":"calls","source":10514,"target":1786},{"edgeType":"contains","source":13714,"target":13735},{"edgeType":"contains","source":35,"target":175},{"edgeType":"contains","source":2153,"target":2168},{"edgeType":"contains","source":11006,"target":11007},{"edgeType":"contains","source":4796,"target":4798},{"edgeType":"calls","source":2642,"target":2690},{"edgeType":"calls","source":2246,"target":2282},{"edgeType":"contains","source":15210,"target":1195},{"edgeType":"contains","source":8096,"target":8195},{"edgeType":"contains","source":35,"target":174},{"edgeType":"contains","source":12063,"target":12064},{"edgeType":"imports","source":16291,"target":16377},{"edgeType":"contains","source":4135,"target":4148},{"edgeType":"calls","source":15067,"target":14966},{"edgeType":"calls","source":2645,"target":2594},{"edgeType":"contains","source":13268,"target":12761},{"edgeType":"contains","source":8096,"target":8198},{"edgeType":"calls","source":3040,"target":3034},{"edgeType":"contains","source":35,"target":177},{"edgeType":"contains","source":10543,"target":10559},{"edgeType":"imports","source":15095,"target":600},{"edgeType":"calls","source":4833,"target":4530},{"edgeType":"contains","source":11336,"target":11345},{"edgeType":"contains","source":13714,"target":13732},{"edgeType":"calls","source":2313,"target":2317},{"edgeType":"contains","source":8096,"target":8197},{"edgeType":"calls","source":999,"target":771},{"edgeType":"imports","source":1375,"target":3097},{"edgeType":"contains","source":12908,"target":13349},{"edgeType":"imports","source":12821,"target":1331},{"edgeType":"contains","source":35,"target":176},{"edgeType":"contains","source":2079,"target":2347},{"edgeType":"calls","source":7807,"target":7486},{"edgeType":"contains","source":13714,"target":13748},{"edgeType":"contains","source":4135,"target":4153},{"edgeType":"contains","source":5452,"target":5608},{"edgeType":"contains","source":13978,"target":14004},{"edgeType":"contains","source":12908,"target":13365},{"edgeType":"contains","source":12378,"target":12882},{"edgeType":"contains","source":15300,"target":15304},{"edgeType":"contains","source":5170,"target":5893},{"edgeType":"calls","source":13964,"target":2660},{"edgeType":"contains","source":15958,"target":16046},{"edgeType":"contains","source":5389,"target":5446},{"edgeType":"contains","source":1625,"target":1628},{"edgeType":"contains","source":14172,"target":14333},{"edgeType":"contains","source":13648,"target":13679},{"edgeType":"contains","source":7562,"target":7848},{"edgeType":"contains","source":12378,"target":12881},{"edgeType":"calls","source":11233,"target":11214},{"edgeType":"imports","source":15072,"target":5535},{"edgeType":"contains","source":12908,"target":13364},{"edgeType":"imports","source":9885,"target":9889},{"edgeType":"imports","source":1375,"target":997},{"edgeType":"contains","source":4662,"target":4728},{"edgeType":"contains","source":2679,"target":2780},{"edgeType":"contains","source":10610,"target":10611},{"edgeType":"contains","source":8096,"target":8207},{"edgeType":"contains","source":14172,"target":14334},{"edgeType":"calls","source":10656,"target":1615},{"edgeType":"calls","source":6670,"target":6795},{"edgeType":"contains","source":1625,"target":1629},{"edgeType":"contains","source":35,"target":178},{"edgeType":"contains","source":12384,"target":12694},{"edgeType":"contains","source":12378,"target":12880},{"edgeType":"contains","source":15366,"target":15374},{"edgeType":"calls","source":6088,"target":5790},{"edgeType":"contains","source":10484,"target":8171},{"edgeType":"contains","source":13781,"target":13783},{"edgeType":"contains","source":8096,"target":8210},{"edgeType":"contains","source":1448,"target":770},{"edgeType":"contains","source":1410,"target":1948},{"edgeType":"contains","source":12908,"target":13363},{"edgeType":"contains","source":6377,"target":6532},{"edgeType":"contains","source":6580,"target":6582},{"edgeType":"calls","source":11631,"target":11558},{"edgeType":"calls","source":11629,"target":11620},{"edgeType":"contains","source":12724,"target":12725},{"edgeType":"contains","source":11336,"target":11356},{"edgeType":"contains","source":2619,"target":2522},{"edgeType":"contains","source":1167,"target":1028},{"edgeType":"calls","source":8920,"target":8925},{"edgeType":"contains","source":1625,"target":1626},{"edgeType":"contains","source":14172,"target":14335},{"edgeType":"contains","source":5655,"target":5660},{"edgeType":"contains","source":14441,"target":14452},{"edgeType":"contains","source":13714,"target":13745},{"edgeType":"contains","source":14111,"target":14112},{"edgeType":"imports","source":14186,"target":13978},{"edgeType":"imports","source":16472,"target":14987},{"edgeType":"calls","source":9363,"target":1533},{"edgeType":"calls","source":2694,"target":1072},{"edgeType":"contains","source":12378,"target":12879},{"edgeType":"contains","source":12988,"target":12996},{"edgeType":"contains","source":8096,"target":8209},{"edgeType":"contains","source":14705,"target":14725},{"edgeType":"calls","source":15063,"target":15104},{"edgeType":"contains","source":4662,"target":4726},{"edgeType":"contains","source":16424,"target":16401},{"edgeType":"contains","source":11270,"target":11289},{"edgeType":"calls","source":2247,"target":2245},{"edgeType":"contains","source":7107,"target":7158},{"edgeType":"contains","source":1,"target":13918},{"edgeType":"calls","source":14928,"target":2369},{"edgeType":"contains","source":14441,"target":14453},{"edgeType":"contains","source":15958,"target":16049},{"edgeType":"contains","source":4135,"target":4150},{"edgeType":"contains","source":13714,"target":13744},{"edgeType":"contains","source":14111,"target":14113},{"edgeType":"contains","source":10484,"target":8169},{"edgeType":"contains","source":12378,"target":12878},{"edgeType":"contains","source":12988,"target":12995},{"edgeType":"contains","source":12908,"target":13361},{"edgeType":"contains","source":4296,"target":3394},{"edgeType":"contains","source":4662,"target":4733},{"edgeType":"contains","source":10808,"target":10810},{"edgeType":"contains","source":6844,"target":6848},{"edgeType":"calls","source":8132,"target":7985},{"edgeType":"contains","source":5170,"target":5897},{"edgeType":"contains","source":6593,"target":6172},{"edgeType":"contains","source":14441,"target":14454},{"edgeType":"contains","source":8096,"target":8204},{"edgeType":"contains","source":1410,"target":1955},{"edgeType":"contains","source":13714,"target":13743},{"edgeType":"contains","source":14111,"target":14114},{"edgeType":"calls","source":793,"target":804},{"edgeType":"contains","source":12908,"target":13360},{"edgeType":"calls","source":9194,"target":8888},{"edgeType":"calls","source":11239,"target":8918},{"edgeType":"contains","source":8096,"target":8203},{"edgeType":"calls","source":5950,"target":5836},{"edgeType":"calls","source":12026,"target":12004},{"edgeType":"contains","source":13714,"target":13742},{"edgeType":"contains","source":13978,"target":14010},{"edgeType":"contains","source":2079,"target":2354},{"edgeType":"calls","source":12223,"target":1666},{"edgeType":"calls","source":7739,"target":7486},{"edgeType":"contains","source":4135,"target":4155},{"edgeType":"contains","source":12988,"target":12993},{"edgeType":"contains","source":11270,"target":11284},{"edgeType":"calls","source":13083,"target":13060},{"edgeType":"contains","source":12908,"target":13359},{"edgeType":"contains","source":2679,"target":2781},{"edgeType":"contains","source":9354,"target":9375},{"edgeType":"contains","source":8096,"target":8206},{"edgeType":"contains","source":15958,"target":16052},{"edgeType":"contains","source":4135,"target":4154},{"edgeType":"contains","source":10484,"target":8168},{"edgeType":"calls","source":16056,"target":16028},{"edgeType":"contains","source":2679,"target":2782},{"edgeType":"contains","source":10808,"target":10809},{"edgeType":"contains","source":11336,"target":11353},{"edgeType":"calls","source":4360,"target":4387},{"edgeType":"contains","source":8096,"target":8205},{"edgeType":"contains","source":13978,"target":14012},{"edgeType":"contains","source":16027,"target":16028},{"edgeType":"contains","source":8096,"target":8183},{"edgeType":"imports","source":15637,"target":15496},{"edgeType":"calls","source":15063,"target":15076},{"edgeType":"contains","source":1,"target":16007},{"edgeType":"contains","source":7828,"target":8035},{"edgeType":"imports","source":14577,"target":14531},{"edgeType":"imports","source":15517,"target":14987},{"edgeType":"contains","source":14836,"target":14881},{"edgeType":"contains","source":9466,"target":1652},{"edgeType":"contains","source":8096,"target":8182},{"edgeType":"calls","source":794,"target":802},{"edgeType":"calls","source":9006,"target":8345},{"edgeType":"calls","source":10315,"target":1591},{"edgeType":"contains","source":10543,"target":10549},{"edgeType":"contains","source":14441,"target":14443},{"edgeType":"contains","source":5652,"target":5727},{"edgeType":"contains","source":16489,"target":16490},{"edgeType":"contains","source":8948,"target":9253},{"edgeType":"calls","source":12223,"target":12210},{"edgeType":"imports","source":15130,"target":7957},{"edgeType":"contains","source":4068,"target":4089},{"edgeType":"contains","source":10937,"target":11016},{"edgeType":"calls","source":15444,"target":7495},{"edgeType":"contains","source":9354,"target":9355},{"edgeType":"contains","source":4916,"target":3170},{"edgeType":"calls","source":11634,"target":11440},{"edgeType":"contains","source":2434,"target":1891},{"edgeType":"contains","source":8096,"target":8185},{"edgeType":"calls","source":13080,"target":13124},{"edgeType":"contains","source":10477,"target":10478},{"edgeType":"calls","source":2286,"target":1060},{"edgeType":"contains","source":1426,"target":1428},{"edgeType":"calls","source":10311,"target":1718},{"edgeType":"calls","source":9976,"target":9989},{"edgeType":"contains","source":4068,"target":4088},{"edgeType":"calls","source":15532,"target":540},{"edgeType":"calls","source":4945,"target":1079},{"edgeType":"calls","source":3467,"target":389},{"edgeType":"contains","source":15366,"target":15367},{"edgeType":"contains","source":7828,"target":8036},{"edgeType":"contains","source":8096,"target":8184},{"edgeType":"calls","source":11562,"target":11559},{"edgeType":"calls","source":12025,"target":12004},{"edgeType":"contains","source":14893,"target":4661},{"edgeType":"contains","source":1426,"target":1429},{"edgeType":"contains","source":14694,"target":15058},{"edgeType":"contains","source":6377,"target":6501},{"edgeType":"calls","source":1564,"target":184},{"edgeType":"imports","source":9885,"target":9886},{"edgeType":"contains","source":10543,"target":10544},{"edgeType":"imports","source":15642,"target":15336},{"edgeType":"calls","source":4485,"target":540},{"edgeType":"calls","source":664,"target":601},{"edgeType":"contains","source":3210,"target":3211},{"edgeType":"contains","source":15500,"target":15443},{"edgeType":"contains","source":13648,"target":13650},{"edgeType":"contains","source":10937,"target":11015},{"edgeType":"contains","source":12908,"target":13335},{"edgeType":"contains","source":693,"target":900},{"edgeType":"contains","source":35,"target":157},{"edgeType":"contains","source":15300,"target":15301},{"edgeType":"calls","source":15676,"target":4526},{"edgeType":"calls","source":9066,"target":2261},{"edgeType":"contains","source":12256,"target":12406},{"edgeType":"contains","source":237,"target":238},{"edgeType":"contains","source":2079,"target":2332},{"edgeType":"contains","source":7828,"target":8030},{"edgeType":"contains","source":1228,"target":1231},{"edgeType":"calls","source":4428,"target":4420},{"edgeType":"calls","source":1536,"target":1054},{"edgeType":"calls","source":2313,"target":2332},{"edgeType":"contains","source":13714,"target":13717},{"edgeType":"calls","source":8920,"target":8904},{"edgeType":"calls","source":16452,"target":16411},{"edgeType":"calls","source":14970,"target":3162},{"edgeType":"contains","source":15300,"target":15302},{"edgeType":"contains","source":12256,"target":12405},{"edgeType":"calls","source":3801,"target":600},{"edgeType":"contains","source":15828,"target":15846},{"edgeType":"contains","source":3545,"target":3394},{"edgeType":"calls","source":11616,"target":1432},{"edgeType":"calls","source":9185,"target":9146},{"edgeType":"contains","source":8948,"target":9252},{"edgeType":"imports","source":10949,"target":10725},{"edgeType":"imports","source":1715,"target":998},{"edgeType":"contains","source":10937,"target":11013},{"edgeType":"calls","source":2246,"target":2296},{"edgeType":"contains","source":14172,"target":14331},{"edgeType":"contains","source":2679,"target":2757},{"edgeType":"contains","source":12821,"target":13916},{"edgeType":"calls","source":1675,"target":972},{"edgeType":"calls","source":1257,"target":1245},{"edgeType":"contains","source":14172,"target":14332},{"edgeType":"contains","source":11554,"target":6684},{"edgeType":"contains","source":11336,"target":11342},{"edgeType":"contains","source":15762,"target":15764},{"edgeType":"calls","source":3106,"target":3116},{"edgeType":"contains","source":5126,"target":5127},{"edgeType":"contains","source":1,"target":13901},{"edgeType":"contains","source":8096,"target":8191},{"edgeType":"calls","source":2115,"target":2126},{"edgeType":"imports","source":12821,"target":5535},{"edgeType":"contains","source":14836,"target":14873},{"edgeType":"contains","source":14837,"target":14842},{"edgeType":"contains","source":6188,"target":6031},{"edgeType":"contains","source":8096,"target":8192},{"edgeType":"calls","source":2842,"target":2844},{"edgeType":"calls","source":4758,"target":4757},{"edgeType":"contains","source":12384,"target":12680},{"edgeType":"contains","source":10543,"target":10556},{"edgeType":"contains","source":9288,"target":9292},{"edgeType":"contains","source":15828,"target":15833},{"edgeType":"contains","source":8096,"target":8190},{"edgeType":"calls","source":9052,"target":9041},{"edgeType":"contains","source":14694,"target":15048},{"edgeType":"contains","source":4135,"target":4136},{"edgeType":"contains","source":5454,"target":5531},{"edgeType":"calls","source":6342,"target":6376},{"edgeType":"contains","source":12821,"target":13930},{"edgeType":"contains","source":10543,"target":10557},{"edgeType":"contains","source":2679,"target":2763},{"edgeType":"contains","source":11270,"target":11272},{"edgeType":"contains","source":1,"target":7561},{"edgeType":"contains","source":5389,"target":5428},{"edgeType":"calls","source":10573,"target":10514},{"edgeType":"contains","source":8096,"target":8194},{"edgeType":"contains","source":14837,"target":14844},{"edgeType":"calls","source":1256,"target":1273},{"edgeType":"contains","source":12908,"target":13346},{"edgeType":"contains","source":10543,"target":10554},{"edgeType":"contains","source":1,"target":16017},{"edgeType":"contains","source":15300,"target":15289},{"edgeType":"contains","source":5258,"target":5260},{"edgeType":"calls","source":3701,"target":3697},{"edgeType":"contains","source":1768,"target":1405},{"edgeType":"calls","source":14404,"target":14369},{"edgeType":"contains","source":11270,"target":11273},{"edgeType":"contains","source":9636,"target":2734},{"edgeType":"calls","source":1851,"target":1854},{"edgeType":"imports","source":14113,"target":14109},{"edgeType":"contains","source":8096,"target":8193},{"edgeType":"contains","source":10543,"target":10555},{"edgeType":"calls","source":4360,"target":4406},{"edgeType":"calls","source":6991,"target":1058},{"edgeType":"calls","source":4481,"target":2769},{"edgeType":"calls","source":10123,"target":3329},{"edgeType":"contains","source":1426,"target":1442},{"edgeType":"contains","source":8096,"target":8187},{"edgeType":"imports","source":900,"target":903},{"edgeType":"imports","source":5256,"target":5389},{"edgeType":"contains","source":10937,"target":11022},{"edgeType":"contains","source":12908,"target":13344},{"edgeType":"contains","source":16424,"target":16386},{"edgeType":"calls","source":15377,"target":7461},{"edgeType":"calls","source":13939,"target":5535},{"edgeType":"imports","source":4071,"target":4072},{"edgeType":"contains","source":7514,"target":2975},{"edgeType":"imports","source":15312,"target":14987},{"edgeType":"contains","source":1426,"target":1443},{"edgeType":"contains","source":8096,"target":8186},{"edgeType":"calls","source":1257,"target":1235},{"edgeType":"calls","source":860,"target":858},{"edgeType":"contains","source":10937,"target":11023},{"edgeType":"calls","source":992,"target":994},{"edgeType":"contains","source":14954,"target":15449},{"edgeType":"imports","source":9220,"target":893},{"edgeType":"imports","source":12087,"target":808},{"edgeType":"contains","source":5060,"target":5061},{"edgeType":"contains","source":9222,"target":9223},{"edgeType":"calls","source":3981,"target":3468},{"edgeType":"contains","source":8096,"target":8189},{"edgeType":"calls","source":9849,"target":9711},{"edgeType":"contains","source":1426,"target":1440},{"edgeType":"imports","source":8040,"target":7876},{"edgeType":"contains","source":4780,"target":3170},{"edgeType":"contains","source":10937,"target":11020},{"edgeType":"imports","source":15637,"target":15485},{"edgeType":"contains","source":9288,"target":9290},{"edgeType":"contains","source":11336,"target":11337},{"edgeType":"contains","source":8096,"target":8188},{"edgeType":"contains","source":9541,"target":9903},{"edgeType":"calls","source":16318,"target":16346},{"edgeType":"contains","source":7828,"target":8040},{"edgeType":"calls","source":8325,"target":8331},{"edgeType":"contains","source":1426,"target":1441},{"edgeType":"imports","source":14113,"target":14105},{"edgeType":"imports","source":15318,"target":4233},{"edgeType":"contains","source":2079,"target":2339},{"edgeType":"contains","source":10937,"target":11021},{"edgeType":"contains","source":7107,"target":7137},{"edgeType":"imports","source":16315,"target":808},{"edgeType":"contains","source":1621,"target":1710},{"edgeType":"contains","source":6377,"target":6489},{"edgeType":"contains","source":15585,"target":4330},{"edgeType":"contains","source":1,"target":7534},{"edgeType":"contains","source":5652,"target":5709},{"edgeType":"contains","source":8957,"target":8959},{"edgeType":"calls","source":6488,"target":6052},{"edgeType":"calls","source":6346,"target":6226},{"edgeType":"calls","source":14457,"target":2134},{"edgeType":"imports","source":5256,"target":5443},{"edgeType":"contains","source":5984,"target":5988},{"edgeType":"contains","source":434,"target":453},{"edgeType":"contains","source":12392,"target":12407},{"edgeType":"contains","source":13978,"target":13980},{"edgeType":"imports","source":4170,"target":3170},{"edgeType":"calls","source":9117,"target":9117},{"edgeType":"contains","source":6377,"target":6490},{"edgeType":"contains","source":15960,"target":15961},{"edgeType":"contains","source":1621,"target":1711},{"edgeType":"calls","source":9485,"target":8278},{"edgeType":"contains","source":8560,"target":8580},{"edgeType":"imports","source":14577,"target":14579},{"edgeType":"calls","source":1059,"target":994},{"edgeType":"contains","source":5652,"target":5710},{"edgeType":"calls","source":6157,"target":5741},{"edgeType":"contains","source":8957,"target":8958},{"edgeType":"calls","source":3641,"target":3403},{"edgeType":"contains","source":5852,"target":5853},{"edgeType":"contains","source":434,"target":452},{"edgeType":"calls","source":11500,"target":11349},{"edgeType":"contains","source":6377,"target":6491},{"edgeType":"contains","source":8560,"target":8583},{"edgeType":"contains","source":6843,"target":6844},{"edgeType":"calls","source":2775,"target":2763},{"edgeType":"contains","source":8957,"target":8961},{"edgeType":"imports","source":7442,"target":7444},{"edgeType":"calls","source":10372,"target":10381},{"edgeType":"contains","source":693,"target":882},{"edgeType":"contains","source":5852,"target":5854},{"edgeType":"contains","source":434,"target":455},{"edgeType":"contains","source":1621,"target":1709},{"edgeType":"contains","source":6377,"target":6492},{"edgeType":"contains","source":15960,"target":15963},{"edgeType":"calls","source":1057,"target":1058},{"edgeType":"contains","source":8957,"target":8960},{"edgeType":"calls","source":14011,"target":13843},{"edgeType":"calls","source":6346,"target":6229},{"edgeType":"contains","source":13053,"target":13054},{"edgeType":"imports","source":7442,"target":7443},{"edgeType":"calls","source":10619,"target":609},{"edgeType":"calls","source":6670,"target":6756},{"edgeType":"contains","source":9948,"target":9949},{"edgeType":"contains","source":12392,"target":12404},{"edgeType":"contains","source":434,"target":454},{"edgeType":"contains","source":10144,"target":10215},{"edgeType":"contains","source":2223,"target":2079},{"edgeType":"contains","source":1621,"target":1714},{"edgeType":"calls","source":4033,"target":3931},{"edgeType":"contains","source":3407,"target":3429},{"edgeType":"calls","source":2876,"target":1744},{"edgeType":"imports","source":16315,"target":865},{"edgeType":"calls","source":264,"target":267},{"edgeType":"contains","source":2679,"target":2741},{"edgeType":"contains","source":12392,"target":12403},{"edgeType":"contains","source":5720,"target":5712},{"edgeType":"calls","source":13477,"target":13490},{"edgeType":"contains","source":15960,"target":15965},{"edgeType":"contains","source":15958,"target":16027},{"edgeType":"contains","source":4795,"target":4796},{"edgeType":"contains","source":5652,"target":5706},{"edgeType":"calls","source":4832,"target":4530},{"edgeType":"contains","source":3407,"target":3428},{"edgeType":"calls","source":14041,"target":4463},{"edgeType":"contains","source":14836,"target":14870},{"edgeType":"contains","source":14837,"target":14839},{"edgeType":"imports","source":9854,"target":2440},{"edgeType":"contains","source":6377,"target":6486},{"edgeType":"contains","source":12392,"target":12402},{"edgeType":"contains","source":434,"target":456},{"edgeType":"calls","source":14667,"target":14653},{"edgeType":"imports","source":14183,"target":14105},{"edgeType":"imports","source":9825,"target":9679},{"edgeType":"calls","source":1255,"target":1259},{"edgeType":"contains","source":1621,"target":1712},{"edgeType":"calls","source":3341,"target":2126},{"edgeType":"contains","source":5652,"target":5707},{"edgeType":"contains","source":16158,"target":16171},{"edgeType":"contains","source":13334,"target":4339},{"edgeType":"contains","source":8267,"target":2864},{"edgeType":"calls","source":2179,"target":2209},{"edgeType":"contains","source":2762,"target":2280},{"edgeType":"contains","source":2079,"target":2313},{"edgeType":"imports","source":12087,"target":865},{"edgeType":"contains","source":12392,"target":12401},{"edgeType":"contains","source":5652,"target":5708},{"edgeType":"contains","source":1621,"target":1713},{"edgeType":"calls","source":12229,"target":3554},{"edgeType":"contains","source":10080,"target":10081},{"edgeType":"calls","source":6960,"target":6226},{"edgeType":"contains","source":4090,"target":3394},{"edgeType":"calls","source":15066,"target":14966},{"edgeType":"calls","source":10772,"target":10668},{"edgeType":"contains","source":12392,"target":12400},{"edgeType":"imports","source":16165,"target":16082},{"edgeType":"calls","source":6238,"target":1109},{"edgeType":"contains","source":13714,"target":13715},{"edgeType":"contains","source":3407,"target":3433},{"edgeType":"contains","source":6377,"target":6497},{"edgeType":"imports","source":9754,"target":9756},{"edgeType":"contains","source":8560,"target":8589},{"edgeType":"contains","source":15489,"target":15754},{"edgeType":"imports","source":14133,"target":2966},{"edgeType":"calls","source":4498,"target":4311},{"edgeType":"calls","source":8123,"target":8227},{"edgeType":"contains","source":15958,"target":16013},{"edgeType":"calls","source":10645,"target":10382},{"edgeType":"calls","source":15004,"target":2097},{"edgeType":"contains","source":5720,"target":5724},{"edgeType":"calls","source":6211,"target":6173},{"edgeType":"contains","source":3407,"target":3432},{"edgeType":"contains","source":6377,"target":6498},{"edgeType":"calls","source":1617,"target":600},{"edgeType":"contains","source":5389,"target":5412},{"edgeType":"contains","source":14176,"target":14177},{"edgeType":"calls","source":6854,"target":1058},{"edgeType":"calls","source":16318,"target":16331},{"edgeType":"contains","source":9854,"target":4413},{"edgeType":"calls","source":9847,"target":9752},{"edgeType":"contains","source":3407,"target":3431},{"edgeType":"contains","source":12908,"target":13330},{"edgeType":"contains","source":15349,"target":1069},{"edgeType":"contains","source":6377,"target":6499},{"edgeType":"contains","source":15034,"target":15062},{"edgeType":"calls","source":14406,"target":14291},{"edgeType":"imports","source":15843,"target":15495},{"edgeType":"calls","source":3962,"target":4011},{"edgeType":"contains","source":14176,"target":14178},{"edgeType":"contains","source":2079,"target":2317},{"edgeType":"calls","source":10150,"target":358},{"edgeType":"calls","source":15358,"target":5926},{"edgeType":"contains","source":6377,"target":6500},{"edgeType":"calls","source":3172,"target":3134},{"edgeType":"contains","source":14176,"target":14179},{"edgeType":"imports","source":15251,"target":4244},{"edgeType":"contains","source":6377,"target":6493},{"edgeType":"contains","source":4068,"target":4087},{"edgeType":"contains","source":9221,"target":9235},{"edgeType":"imports","source":9754,"target":9760},{"edgeType":"contains","source":8957,"target":8963},{"edgeType":"contains","source":13384,"target":13370},{"edgeType":"imports","source":696,"target":934},{"edgeType":"calls","source":2248,"target":2178},{"edgeType":"calls","source":4413,"target":600},{"edgeType":"calls","source":8469,"target":3847},{"edgeType":"contains","source":3613,"target":3394},{"edgeType":"contains","source":16158,"target":16161},{"edgeType":"calls","source":6359,"target":5836},{"edgeType":"contains","source":1307,"target":887},{"edgeType":"contains","source":6377,"target":6494},{"edgeType":"contains","source":12392,"target":12410},{"edgeType":"calls","source":3565,"target":3633},{"edgeType":"contains","source":5454,"target":5510},{"edgeType":"imports","source":9754,"target":9759},{"edgeType":"contains","source":8957,"target":8962},{"edgeType":"contains","source":13540,"target":12761},{"edgeType":"contains","source":9362,"target":9091},{"edgeType":"contains","source":10436,"target":1169},{"edgeType":"calls","source":10704,"target":10672},{"edgeType":"imports","source":6305,"target":6745},{"edgeType":"contains","source":5720,"target":5721},{"edgeType":"contains","source":1426,"target":1427},{"edgeType":"contains","source":4068,"target":4085},{"edgeType":"contains","source":12392,"target":12409},{"edgeType":"contains","source":13053,"target":13059},{"edgeType":"contains","source":10873,"target":10874},{"edgeType":"calls","source":10109,"target":10090},{"edgeType":"calls","source":4553,"target":2600},{"edgeType":"calls","source":131,"target":156},{"edgeType":"calls","source":13216,"target":13131},{"edgeType":"calls","source":2907,"target":2888},{"edgeType":"contains","source":4068,"target":4084},{"edgeType":"contains","source":3407,"target":3434},{"edgeType":"contains","source":6377,"target":6496},{"edgeType":"contains","source":12392,"target":12408},{"edgeType":"calls","source":13080,"target":13119},{"edgeType":"contains","source":13053,"target":13058},{"edgeType":"calls","source":6786,"target":1058},{"edgeType":"calls","source":9667,"target":2651},{"edgeType":"calls","source":5926,"target":4431},{"edgeType":"contains","source":15958,"target":16020},{"edgeType":"calls","source":5550,"target":5549},{"edgeType":"calls","source":3504,"target":3438},{"edgeType":"contains","source":7503,"target":7506},{"edgeType":"contains","source":2079,"target":2294},{"edgeType":"calls","source":10512,"target":10251},{"edgeType":"contains","source":434,"target":437},{"edgeType":"contains","source":12378,"target":12824},{"edgeType":"contains","source":960,"target":1043},{"edgeType":"imports","source":14577,"target":14564},{"edgeType":"contains","source":10937,"target":10985},{"edgeType":"contains","source":11061,"target":11369},{"edgeType":"calls","source":7040,"target":5837},{"edgeType":"contains","source":8096,"target":8149},{"edgeType":"imports","source":12617,"target":1331},{"edgeType":"contains","source":13670,"target":12939},{"edgeType":"calls","source":3467,"target":358},{"edgeType":"contains","source":2079,"target":2295},{"edgeType":"calls","source":9508,"target":9663},{"edgeType":"contains","source":12378,"target":12823},{"edgeType":"calls","source":3134,"target":2224},{"edgeType":"contains","source":960,"target":1042},{"edgeType":"contains","source":8560,"target":8564},{"edgeType":"contains","source":5279,"target":4569},{"edgeType":"contains","source":15100,"target":15121},{"edgeType":"contains","source":10937,"target":10986},{"edgeType":"contains","source":3407,"target":3408},{"edgeType":"contains","source":1,"target":3291},{"edgeType":"contains","source":12378,"target":12822},{"edgeType":"calls","source":14869,"target":14717},{"edgeType":"imports","source":14183,"target":1410},{"edgeType":"contains","source":16620,"target":16627},{"edgeType":"contains","source":960,"target":1045},{"edgeType":"contains","source":11061,"target":11367},{"edgeType":"imports","source":11679,"target":808},{"edgeType":"contains","source":1621,"target":1692},{"edgeType":"contains","source":8096,"target":8151},{"edgeType":"calls","source":2247,"target":2236},{"edgeType":"contains","source":2079,"target":2293},{"edgeType":"contains","source":16222,"target":16279},{"edgeType":"calls","source":15507,"target":7624},{"edgeType":"imports","source":14114,"target":14119},{"edgeType":"contains","source":434,"target":438},{"edgeType":"contains","source":960,"target":1044},{"edgeType":"contains","source":10751,"target":8294},{"edgeType":"contains","source":11061,"target":11368},{"edgeType":"contains","source":5389,"target":5393},{"edgeType":"contains","source":8096,"target":8146},{"edgeType":"contains","source":434,"target":441},{"edgeType":"imports","source":14172,"target":12316},{"edgeType":"contains","source":8560,"target":8561},{"edgeType":"calls","source":2097,"target":540},{"edgeType":"imports","source":14577,"target":14560},{"edgeType":"contains","source":15034,"target":15056},{"edgeType":"calls","source":2876,"target":1761},{"edgeType":"imports","source":15379,"target":2382},{"edgeType":"contains","source":16620,"target":16629},{"edgeType":"contains","source":10937,"target":10982},{"edgeType":"contains","source":15489,"target":15751},{"edgeType":"contains","source":4662,"target":4674},{"edgeType":"contains","source":434,"target":440},{"edgeType":"contains","source":11061,"target":11366},{"edgeType":"calls","source":2322,"target":2020},{"edgeType":"contains","source":15489,"target":15752},{"edgeType":"contains","source":5389,"target":5391},{"edgeType":"contains","source":434,"target":443},{"edgeType":"contains","source":8096,"target":8148},{"edgeType":"contains","source":11061,"target":11363},{"edgeType":"contains","source":13118,"target":13133},{"edgeType":"calls","source":3832,"target":3834},{"edgeType":"calls","source":6331,"target":358},{"edgeType":"calls","source":4889,"target":4893},{"edgeType":"calls","source":13082,"target":13032},{"edgeType":"contains","source":434,"target":442},{"edgeType":"calls","source":7557,"target":6729},{"edgeType":"contains","source":11061,"target":11364},{"edgeType":"contains","source":10937,"target":10980},{"edgeType":"calls","source":2118,"target":2003},{"edgeType":"imports","source":6305,"target":2510},{"edgeType":"calls","source":3766,"target":3767},{"edgeType":"contains","source":15489,"target":15753},{"edgeType":"contains","source":10608,"target":10609},{"edgeType":"contains","source":5652,"target":5692},{"edgeType":"calls","source":11571,"target":11251},{"edgeType":"calls","source":793,"target":798},{"edgeType":"contains","source":434,"target":445},{"edgeType":"contains","source":3295,"target":2660},{"edgeType":"contains","source":16218,"target":16394},{"edgeType":"calls","source":10572,"target":10514},{"edgeType":"contains","source":16817,"target":16852},{"edgeType":"contains","source":12392,"target":12399},{"edgeType":"calls","source":4096,"target":4104},{"edgeType":"contains","source":10919,"target":11551},{"edgeType":"contains","source":960,"target":1051},{"edgeType":"imports","source":15421,"target":1076},{"edgeType":"calls","source":3700,"target":3697},{"edgeType":"contains","source":434,"target":444},{"edgeType":"calls","source":4282,"target":2566},{"edgeType":"contains","source":1,"target":9639},{"edgeType":"calls","source":10504,"target":10506},{"edgeType":"calls","source":3766,"target":3765},{"edgeType":"calls","source":14892,"target":3438},{"edgeType":"contains","source":12392,"target":12398},{"edgeType":"contains","source":16817,"target":16851},{"edgeType":"contains","source":16218,"target":16393},{"edgeType":"contains","source":10919,"target":11552},{"edgeType":"contains","source":10144,"target":10209},{"edgeType":"calls","source":2979,"target":679},{"edgeType":"contains","source":1,"target":9642},{"edgeType":"contains","source":434,"target":447},{"edgeType":"contains","source":7106,"target":7139},{"edgeType":"calls","source":16450,"target":16452},{"edgeType":"calls","source":1874,"target":1109},{"edgeType":"contains","source":16218,"target":16396},{"edgeType":"contains","source":5652,"target":5703},{"edgeType":"calls","source":12097,"target":11860},{"edgeType":"contains","source":1410,"target":1899},{"edgeType":"contains","source":16817,"target":16854},{"edgeType":"contains","source":10919,"target":11549},{"edgeType":"contains","source":6377,"target":6483},{"edgeType":"contains","source":12908,"target":13313},{"edgeType":"contains","source":1055,"target":2336},{"edgeType":"calls","source":6755,"target":6226},{"edgeType":"contains","source":12759,"target":13703},{"edgeType":"calls","source":10174,"target":10168},{"edgeType":"contains","source":15100,"target":15115},{"edgeType":"contains","source":9221,"target":9224},{"edgeType":"contains","source":434,"target":446},{"edgeType":"contains","source":15958,"target":16000},{"edgeType":"imports","source":12469,"target":12255},{"edgeType":"contains","source":16218,"target":16395},{"edgeType":"calls","source":10877,"target":1058},{"edgeType":"contains","source":6377,"target":6484},{"edgeType":"contains","source":2762,"target":2269},{"edgeType":"contains","source":10919,"target":11550},{"edgeType":"imports","source":15642,"target":15366},{"edgeType":"contains","source":960,"target":1052},{"edgeType":"calls","source":6673,"target":6655},{"edgeType":"contains","source":960,"target":1056},{"edgeType":"contains","source":434,"target":449},{"edgeType":"calls","source":14417,"target":13940},{"edgeType":"contains","source":16218,"target":16398},{"edgeType":"contains","source":7828,"target":8006},{"edgeType":"contains","source":1956,"target":1891},{"edgeType":"contains","source":5652,"target":5697},{"edgeType":"contains","source":16620,"target":16621},{"edgeType":"calls","source":1257,"target":1203},{"edgeType":"calls","source":15579,"target":5394},{"edgeType":"contains","source":9220,"target":9249},{"edgeType":"calls","source":5090,"target":4998},{"edgeType":"calls","source":2462,"target":1903},{"edgeType":"imports","source":9825,"target":3315},{"edgeType":"calls","source":5815,"target":5777},{"edgeType":"calls","source":14037,"target":13035},{"edgeType":"contains","source":16218,"target":16397},{"edgeType":"calls","source":5550,"target":5535},{"edgeType":"contains","source":12392,"target":12394},{"edgeType":"contains","source":6443,"target":6546},{"edgeType":"contains","source":960,"target":1054},{"edgeType":"contains","source":4662,"target":4682},{"edgeType":"contains","source":7301,"target":7432},{"edgeType":"calls","source":8939,"target":1948},{"edgeType":"calls","source":6990,"target":1058},{"edgeType":"calls","source":7927,"target":5837},{"edgeType":"contains","source":16218,"target":16400},{"edgeType":"calls","source":8123,"target":8217},{"edgeType":"contains","source":13952,"target":8428},{"edgeType":"calls","source":10240,"target":10241},{"edgeType":"contains","source":4068,"target":4069},{"edgeType":"contains","source":434,"target":451},{"edgeType":"contains","source":960,"target":1057},{"edgeType":"contains","source":15489,"target":15745},{"edgeType":"contains","source":16218,"target":16399},{"edgeType":"imports","source":6259,"target":6042},{"edgeType":"contains","source":5652,"target":5700},{"edgeType":"contains","source":5788,"target":5712},{"edgeType":"contains","source":15958,"target":16004},{"edgeType":"contains","source":12378,"target":12826},{"edgeType":"contains","source":1228,"target":1204},{"edgeType":"contains","source":838,"target":610},{"edgeType":"calls","source":1266,"target":925},{"edgeType":"contains","source":4662,"target":4680},{"edgeType":"contains","source":2547,"target":2596},{"edgeType":"contains","source":8560,"target":8570},{"edgeType":"contains","source":434,"target":450},{"edgeType":"contains","source":15100,"target":15119},{"edgeType":"contains","source":16817,"target":16843},{"edgeType":"contains","source":12908,"target":13290},{"edgeType":"contains","source":8096,"target":8134},{"edgeType":"imports","source":15318,"target":4327},{"edgeType":"contains","source":9484,"target":9501},{"edgeType":"contains","source":11192,"target":3063},{"edgeType":"contains","source":2079,"target":2278},{"edgeType":"contains","source":13999,"target":610},{"edgeType":"contains","source":12378,"target":12808},{"edgeType":"imports","source":15503,"target":15504},{"edgeType":"imports","source":6305,"target":6783},{"edgeType":"contains","source":6443,"target":6525},{"edgeType":"calls","source":8591,"target":8608},{"edgeType":"contains","source":15098,"target":15167},{"edgeType":"calls","source":10109,"target":1718},{"edgeType":"contains","source":16817,"target":16842},{"edgeType":"calls","source":10125,"target":3336},{"edgeType":"contains","source":13118,"target":13122},{"edgeType":"calls","source":1456,"target":1470},{"edgeType":"imports","source":15318,"target":4326},{"edgeType":"contains","source":12908,"target":13289},{"edgeType":"contains","source":2522,"target":1230},{"edgeType":"contains","source":2079,"target":2279},{"edgeType":"calls","source":12488,"target":12534},{"edgeType":"contains","source":7038,"target":7108},{"edgeType":"contains","source":6443,"target":6526},{"edgeType":"contains","source":15098,"target":15168},{"edgeType":"calls","source":2246,"target":2349},{"edgeType":"contains","source":12908,"target":13288},{"edgeType":"contains","source":11532,"target":11548},{"edgeType":"contains","source":16222,"target":16264},{"edgeType":"calls","source":928,"target":929},{"edgeType":"contains","source":7963,"target":8031},{"edgeType":"calls","source":8856,"target":8853},{"edgeType":"contains","source":8096,"target":8136},{"edgeType":"calls","source":9979,"target":9978},{"edgeType":"contains","source":6443,"target":6527},{"edgeType":"calls","source":15925,"target":15923},{"edgeType":"imports","source":1167,"target":1160},{"edgeType":"contains","source":13053,"target":13021},{"edgeType":"contains","source":9484,"target":9502},{"edgeType":"contains","source":12908,"target":13287},{"edgeType":"imports","source":12087,"target":893},{"edgeType":"calls","source":14670,"target":14653},{"edgeType":"calls","source":8675,"target":8121},{"edgeType":"contains","source":12378,"target":12805},{"edgeType":"imports","source":15779,"target":15405},{"edgeType":"contains","source":6510,"target":6557},{"edgeType":"contains","source":7913,"target":7460},{"edgeType":"contains","source":2944,"target":2950},{"edgeType":"contains","source":15958,"target":15993},{"edgeType":"contains","source":960,"target":1031},{"edgeType":"imports","source":980,"target":612},{"edgeType":"contains","source":15098,"target":15170},{"edgeType":"calls","source":14158,"target":3050},{"edgeType":"contains","source":9484,"target":9497},{"edgeType":"contains","source":12908,"target":13286},{"edgeType":"calls","source":15684,"target":2246},{"edgeType":"calls","source":2857,"target":2433},{"edgeType":"contains","source":7038,"target":7101},{"edgeType":"calls","source":5156,"target":5157},{"edgeType":"contains","source":10144,"target":10179},{"edgeType":"contains","source":14837,"target":4235},{"edgeType":"imports","source":15048,"target":4235},{"edgeType":"calls","source":5424,"target":1076},{"edgeType":"contains","source":15098,"target":15171},{"edgeType":"calls","source":13216,"target":13224},{"edgeType":"contains","source":5652,"target":5673},{"edgeType":"contains","source":11070,"target":11071},{"edgeType":"contains","source":16817,"target":16846},{"edgeType":"calls","source":4297,"target":4302},{"edgeType":"imports","source":9564,"target":893},{"edgeType":"contains","source":8096,"target":8129},{"edgeType":"imports","source":15642,"target":15418},{"edgeType":"contains","source":16222,"target":16265},{"edgeType":"contains","source":16027,"target":15968},{"edgeType":"contains","source":6377,"target":6453},{"edgeType":"contains","source":6510,"target":6558},{"edgeType":"calls","source":1060,"target":1061},{"edgeType":"calls","source":14145,"target":14021},{"edgeType":"contains","source":16218,"target":16392},{"edgeType":"contains","source":8096,"target":8132},{"edgeType":"contains","source":14836,"target":14838},{"edgeType":"contains","source":10144,"target":10177},{"edgeType":"calls","source":15237,"target":5535},{"edgeType":"contains","source":6377,"target":6454},{"edgeType":"contains","source":6510,"target":6559},{"edgeType":"contains","source":6443,"target":6523},{"edgeType":"contains","source":7038,"target":7105},{"edgeType":"contains","source":16817,"target":16848},{"edgeType":"imports","source":1779,"target":1209},{"edgeType":"calls","source":11632,"target":11590},{"edgeType":"contains","source":12378,"target":12801},{"edgeType":"contains","source":16218,"target":16391},{"edgeType":"contains","source":16817,"target":16849},{"edgeType":"calls","source":12534,"target":540},{"edgeType":"contains","source":6377,"target":6464},{"edgeType":"contains","source":4662,"target":4663},{"edgeType":"calls","source":6703,"target":5837},{"edgeType":"imports","source":1167,"target":1169},{"edgeType":"contains","source":7301,"target":7417},{"edgeType":"calls","source":8334,"target":8127},{"edgeType":"contains","source":16817,"target":16834},{"edgeType":"calls","source":5420,"target":5424},{"edgeType":"contains","source":10658,"target":600},{"edgeType":"contains","source":13118,"target":13130},{"edgeType":"contains","source":10144,"target":10192},{"edgeType":"contains","source":13197,"target":4339},{"edgeType":"contains","source":6443,"target":6533},{"edgeType":"calls","source":2246,"target":2344},{"edgeType":"contains","source":8096,"target":8141},{"edgeType":"imports","source":14183,"target":14134},{"edgeType":"imports","source":5256,"target":5470},{"edgeType":"calls","source":9715,"target":9715},{"edgeType":"calls","source":16455,"target":16413},{"edgeType":"contains","source":8096,"target":8144},{"edgeType":"contains","source":1621,"target":1683},{"edgeType":"contains","source":6443,"target":6534},{"edgeType":"contains","source":12919,"target":12956},{"edgeType":"contains","source":12908,"target":13297},{"edgeType":"contains","source":12224,"target":11246},{"edgeType":"calls","source":12359,"target":3854},{"edgeType":"calls","source":1456,"target":1465},{"edgeType":"calls","source":6293,"target":5842},{"edgeType":"contains","source":6443,"target":6535},{"edgeType":"calls","source":9187,"target":9169},{"edgeType":"calls","source":4835,"target":4530},{"edgeType":"contains","source":1055,"target":2319},{"edgeType":"imports","source":1167,"target":1168},{"edgeType":"calls","source":7932,"target":7908},{"edgeType":"contains","source":12256,"target":12367},{"edgeType":"imports","source":9090,"target":774},{"edgeType":"imports","source":6681,"target":5690},{"edgeType":"contains","source":6377,"target":6460},{"edgeType":"contains","source":6443,"target":6528},{"edgeType":"contains","source":8427,"target":8447},{"edgeType":"imports","source":980,"target":2734},{"edgeType":"contains","source":15489,"target":15725},{"edgeType":"contains","source":12908,"target":13295},{"edgeType":"contains","source":12256,"target":12366},{"edgeType":"contains","source":16222,"target":16258},{"edgeType":"contains","source":5785,"target":5786},{"edgeType":"calls","source":12304,"target":3451},{"edgeType":"contains","source":1,"target":3284},{"edgeType":"contains","source":6377,"target":6461},{"edgeType":"contains","source":6443,"target":6529},{"edgeType":"contains","source":10919,"target":11532},{"edgeType":"contains","source":4662,"target":4666},{"edgeType":"contains","source":2620,"target":2433},{"edgeType":"imports","source":15900,"target":15868},{"edgeType":"contains","source":12256,"target":12365},{"edgeType":"contains","source":5785,"target":5787},{"edgeType":"contains","source":6125,"target":5817},{"edgeType":"contains","source":8096,"target":8137},{"edgeType":"contains","source":6377,"target":6462},{"edgeType":"imports","source":8040,"target":7958},{"edgeType":"imports","source":8259,"target":1169},{"edgeType":"contains","source":6443,"target":6530},{"edgeType":"contains","source":2944,"target":2956},{"edgeType":"contains","source":434,"target":435},{"edgeType":"contains","source":12919,"target":12952},{"edgeType":"contains","source":12907,"target":13324},{"edgeType":"contains","source":15100,"target":15102},{"edgeType":"calls","source":15727,"target":15722},{"edgeType":"calls","source":15997,"target":15809},{"edgeType":"contains","source":6377,"target":6463},{"edgeType":"imports","source":9090,"target":9235},{"edgeType":"contains","source":2679,"target":2716},{"edgeType":"calls","source":13086,"target":13032},{"edgeType":"contains","source":12908,"target":13292},{"edgeType":"contains","source":11192,"target":3067},{"edgeType":"imports","source":13869,"target":612},{"edgeType":"contains","source":15034,"target":15035},{"edgeType":"imports","source":657,"target":61},{"edgeType":"calls","source":14802,"target":14801},{"edgeType":"contains","source":8096,"target":8139},{"edgeType":"contains","source":2679,"target":2688},{"edgeType":"calls","source":15069,"target":14956},{"edgeType":"contains","source":9484,"target":9485},{"edgeType":"contains","source":15562,"target":15564},{"edgeType":"calls","source":16931,"target":16429},{"edgeType":"calls","source":1337,"target":949},{"edgeType":"calls","source":8591,"target":8593},{"edgeType":"contains","source":3670,"target":3679},{"edgeType":"calls","source":6543,"target":6544},{"edgeType":"calls","source":15937,"target":15531},{"edgeType":"contains","source":12919,"target":12932},{"edgeType":"contains","source":6775,"target":6787},{"edgeType":"calls","source":10706,"target":10680},{"edgeType":"contains","source":8493,"target":8494},{"edgeType":"contains","source":1,"target":9597},{"edgeType":"contains","source":3670,"target":3678},{"edgeType":"contains","source":7038,"target":7090},{"edgeType":"calls","source":8591,"target":8592},{"edgeType":"contains","source":1330,"target":2227},{"edgeType":"contains","source":8096,"target":8119},{"edgeType":"contains","source":12919,"target":12931},{"edgeType":"contains","source":15562,"target":15566},{"edgeType":"contains","source":14172,"target":14260},{"edgeType":"contains","source":6775,"target":6788},{"edgeType":"contains","source":2939,"target":3082},{"edgeType":"contains","source":8602,"target":3004},{"edgeType":"contains","source":8493,"target":8497},{"edgeType":"calls","source":1626,"target":448},{"edgeType":"contains","source":5454,"target":5458},{"edgeType":"contains","source":1410,"target":1858},{"edgeType":"contains","source":3472,"target":3473},{"edgeType":"contains","source":8096,"target":8118},{"edgeType":"contains","source":11532,"target":11533},{"edgeType":"contains","source":12919,"target":12930},{"edgeType":"contains","source":6775,"target":6789},{"edgeType":"contains","source":5855,"target":5712},{"edgeType":"calls","source":7138,"target":7129},{"edgeType":"contains","source":8493,"target":8496},{"edgeType":"contains","source":15300,"target":15232},{"edgeType":"contains","source":5652,"target":5663},{"edgeType":"contains","source":13579,"target":13610},{"edgeType":"calls","source":6287,"target":6052},{"edgeType":"contains","source":6775,"target":6782},{"edgeType":"contains","source":10692,"target":7973},{"edgeType":"contains","source":3670,"target":3683},{"edgeType":"calls","source":4782,"target":4083},{"edgeType":"contains","source":5652,"target":5656},{"edgeType":"contains","source":1330,"target":2230},{"edgeType":"contains","source":13579,"target":13609},{"edgeType":"calls","source":13876,"target":13889},{"edgeType":"calls","source":6083,"target":6033},{"edgeType":"contains","source":11598,"target":11597},{"edgeType":"calls","source":4388,"target":1497},{"edgeType":"contains","source":11598,"target":11599},{"edgeType":"calls","source":10177,"target":10168},{"edgeType":"contains","source":5923,"target":5712},{"edgeType":"contains","source":3670,"target":3682},{"edgeType":"calls","source":11362,"target":3033},{"edgeType":"contains","source":5652,"target":5657},{"edgeType":"contains","source":13579,"target":13608},{"edgeType":"calls","source":10010,"target":2660},{"edgeType":"contains","source":16817,"target":16833},{"edgeType":"contains","source":1,"target":3262},{"edgeType":"contains","source":12759,"target":13659},{"edgeType":"contains","source":15098,"target":15155},{"edgeType":"contains","source":7038,"target":7087},{"edgeType":"contains","source":13579,"target":13607},{"edgeType":"contains","source":14371,"target":14438},{"edgeType":"contains","source":3395,"target":3750},{"edgeType":"contains","source":1330,"target":2228},{"edgeType":"contains","source":6775,"target":6785},{"edgeType":"contains","source":3952,"target":3394},{"edgeType":"contains","source":8096,"target":8114},{"edgeType":"calls","source":4958,"target":4966},{"edgeType":"imports","source":5256,"target":5467},{"edgeType":"imports","source":14114,"target":14148},{"edgeType":"calls","source":3469,"target":389},{"edgeType":"calls","source":4034,"target":4014},{"edgeType":"contains","source":3395,"target":3749},{"edgeType":"contains","source":16817,"target":16832},{"edgeType":"calls","source":2354,"target":1129},{"edgeType":"contains","source":1330,"target":2229},{"edgeType":"contains","source":13579,"target":13606},{"edgeType":"contains","source":7963,"target":8020},{"edgeType":"contains","source":12759,"target":13673},{"edgeType":"contains","source":2616,"target":2535},{"edgeType":"contains","source":10144,"target":10174},{"edgeType":"calls","source":8591,"target":8601},{"edgeType":"contains","source":1,"target":3264},{"edgeType":"contains","source":12378,"target":12800},{"edgeType":"contains","source":3472,"target":3483},{"edgeType":"contains","source":6443,"target":6516},{"edgeType":"calls","source":2844,"target":2848},{"edgeType":"contains","source":5126,"target":5060},{"edgeType":"calls","source":4760,"target":4761},{"edgeType":"calls","source":928,"target":934},{"edgeType":"contains","source":15760,"target":15761},{"edgeType":"contains","source":6510,"target":6554},{"edgeType":"contains","source":4505,"target":3170},{"edgeType":"contains","source":11532,"target":11543},{"edgeType":"contains","source":8259,"target":3071},{"edgeType":"calls","source":10443,"target":10382},{"edgeType":"contains","source":14365,"target":14610},{"edgeType":"calls","source":6213,"target":6226},{"edgeType":"contains","source":3472,"target":3482},{"edgeType":"contains","source":6443,"target":6517},{"edgeType":"contains","source":2939,"target":3093},{"edgeType":"calls","source":10112,"target":10076},{"edgeType":"calls","source":999,"target":850},{"edgeType":"calls","source":14420,"target":13940},{"edgeType":"contains","source":103,"target":105},{"edgeType":"contains","source":3472,"target":3481},{"edgeType":"contains","source":8096,"target":8128},{"edgeType":"contains","source":7038,"target":7099},{"edgeType":"contains","source":1330,"target":2232},{"edgeType":"calls","source":13954,"target":903},{"edgeType":"imports","source":15489,"target":7459},{"edgeType":"contains","source":6510,"target":6556},{"edgeType":"contains","source":7106,"target":7107},{"edgeType":"contains","source":9484,"target":9494},{"edgeType":"contains","source":8096,"target":8126},{"edgeType":"contains","source":16817,"target":16820},{"edgeType":"contains","source":103,"target":104},{"edgeType":"calls","source":11234,"target":11231},{"edgeType":"calls","source":9120,"target":9116},{"edgeType":"contains","source":16158,"target":16108},{"edgeType":"contains","source":3670,"target":3684},{"edgeType":"calls","source":2881,"target":1700},{"edgeType":"contains","source":1330,"target":2233},{"edgeType":"contains","source":6377,"target":6451},{"edgeType":"contains","source":15489,"target":15707},{"edgeType":"calls","source":15532,"target":615},{"edgeType":"contains","source":15095,"target":15238},{"edgeType":"contains","source":15098,"target":15145},{"edgeType":"contains","source":12378,"target":4339},{"edgeType":"contains","source":5058,"target":5059},{"edgeType":"contains","source":6775,"target":6790},{"edgeType":"calls","source":8591,"target":8605},{"edgeType":"contains","source":9484,"target":9489},{"edgeType":"calls","source":16931,"target":16433},{"edgeType":"contains","source":7830,"target":7911},{"edgeType":"contains","source":15958,"target":15968},{"edgeType":"imports","source":14350,"target":8937},{"edgeType":"contains","source":103,"target":107},{"edgeType":"calls","source":14579,"target":9017},{"edgeType":"calls","source":11631,"target":11613},{"edgeType":"contains","source":6593,"target":6091},{"edgeType":"contains","source":7830,"target":7910},{"edgeType":"contains","source":103,"target":106},{"edgeType":"contains","source":1410,"target":1873},{"edgeType":"contains","source":6443,"target":6513},{"edgeType":"contains","source":5454,"target":5461},{"edgeType":"contains","source":6775,"target":6791},{"edgeType":"calls","source":2778,"target":2777},{"edgeType":"contains","source":15095,"target":15239},{"edgeType":"imports","source":15843,"target":15504},{"edgeType":"contains","source":12919,"target":12936},{"edgeType":"contains","source":10144,"target":10168},{"edgeType":"contains","source":10142,"target":10230},{"edgeType":"contains","source":7301,"target":7399},{"edgeType":"contains","source":15760,"target":15766},{"edgeType":"imports","source":696,"target":949},{"edgeType":"imports","source":14577,"target":14586},{"edgeType":"contains","source":7963,"target":8018},{"edgeType":"calls","source":1852,"target":1886},{"edgeType":"contains","source":6443,"target":6514},{"edgeType":"contains","source":2762,"target":2239},{"edgeType":"contains","source":2939,"target":3094},{"edgeType":"contains","source":12908,"target":13276},{"edgeType":"contains","source":10142,"target":10231},{"edgeType":"calls","source":4436,"target":4227},{"edgeType":"calls","source":16931,"target":16434},{"edgeType":"contains","source":7830,"target":7912},{"edgeType":"contains","source":8096,"target":8122},{"edgeType":"contains","source":3472,"target":3484},{"edgeType":"contains","source":103,"target":108},{"edgeType":"contains","source":15095,"target":15241},{"edgeType":"contains","source":15098,"target":15148},{"edgeType":"contains","source":7038,"target":7073},{"edgeType":"imports","source":11679,"target":893},{"edgeType":"contains","source":12759,"target":13648},{"edgeType":"contains","source":11003,"target":11004},{"edgeType":"contains","source":5189,"target":5197},{"edgeType":"contains","source":9021,"target":9023},{"edgeType":"contains","source":13183,"target":13189},{"edgeType":"contains","source":15095,"target":15226},{"edgeType":"contains","source":8096,"target":8101},{"edgeType":"calls","source":6911,"target":5690},{"edgeType":"calls","source":12488,"target":12500},{"edgeType":"contains","source":14371,"target":14415},{"edgeType":"contains","source":13579,"target":13597},{"edgeType":"imports","source":14352,"target":8937},{"edgeType":"contains","source":7964,"target":7965},{"edgeType":"calls","source":999,"target":807},{"edgeType":"contains","source":12448,"target":12719},{"edgeType":"contains","source":8030,"target":8033},{"edgeType":"contains","source":8036,"target":7847},{"edgeType":"imports","source":14075,"target":610},{"edgeType":"contains","source":10144,"target":10150},{"edgeType":"contains","source":6312,"target":6324},{"edgeType":"contains","source":4497,"target":3394},{"edgeType":"calls","source":12036,"target":11715},{"edgeType":"contains","source":5718,"target":5712},{"edgeType":"contains","source":9021,"target":9022},{"edgeType":"contains","source":15099,"target":15103},{"edgeType":"contains","source":13447,"target":13460},{"edgeType":"contains","source":8096,"target":8100},{"edgeType":"contains","source":5982,"target":5985},{"edgeType":"calls","source":7769,"target":4461},{"edgeType":"calls","source":10440,"target":10450},{"edgeType":"contains","source":10949,"target":6336},{"edgeType":"contains","source":13579,"target":13596},{"edgeType":"contains","source":12448,"target":12718},{"edgeType":"calls","source":14669,"target":14653},{"edgeType":"contains","source":10078,"target":10083},{"edgeType":"contains","source":6312,"target":6325},{"edgeType":"contains","source":12999,"target":4092},{"edgeType":"contains","source":5189,"target":5195},{"edgeType":"calls","source":13496,"target":12962},{"edgeType":"contains","source":15098,"target":15135},{"edgeType":"contains","source":9021,"target":9025},{"edgeType":"calls","source":2248,"target":2254},{"edgeType":"contains","source":13673,"target":4339},{"edgeType":"contains","source":7459,"target":2480},{"edgeType":"contains","source":9484,"target":9470},{"edgeType":"contains","source":5992,"target":5676},{"edgeType":"contains","source":13579,"target":13595},{"edgeType":"contains","source":10890,"target":8162},{"edgeType":"contains","source":6581,"target":6443},{"edgeType":"contains","source":12448,"target":12717},{"edgeType":"contains","source":10078,"target":10080},{"edgeType":"calls","source":6830,"target":6089},{"edgeType":"contains","source":9021,"target":9024},{"edgeType":"contains","source":13579,"target":13594},{"edgeType":"contains","source":11192,"target":3029},{"edgeType":"contains","source":2157,"target":1940},{"edgeType":"calls","source":6674,"target":6698},{"edgeType":"contains","source":12448,"target":12716},{"edgeType":"contains","source":7964,"target":7966},{"edgeType":"calls","source":3115,"target":2861},{"edgeType":"contains","source":8030,"target":8034},{"edgeType":"contains","source":6312,"target":6327},{"edgeType":"contains","source":13183,"target":13185},{"edgeType":"contains","source":3395,"target":3735},{"edgeType":"contains","source":15099,"target":15106},{"edgeType":"contains","source":5321,"target":5337},{"edgeType":"contains","source":6312,"target":6320},{"edgeType":"contains","source":12448,"target":12715},{"edgeType":"calls","source":15001,"target":14930},{"edgeType":"calls","source":7111,"target":5837},{"edgeType":"calls","source":6159,"target":5741},{"edgeType":"calls","source":7932,"target":7869},{"edgeType":"contains","source":5321,"target":5336},{"edgeType":"contains","source":12315,"target":12609},{"edgeType":"contains","source":14314,"target":14073},{"edgeType":"contains","source":7038,"target":7069},{"edgeType":"contains","source":12448,"target":12714},{"edgeType":"contains","source":15099,"target":15108},{"edgeType":"calls","source":16318,"target":16386},{"edgeType":"contains","source":14365,"target":14607},{"edgeType":"contains","source":5321,"target":5335},{"edgeType":"contains","source":12315,"target":12608},{"edgeType":"contains","source":14240,"target":14254},{"edgeType":"contains","source":6312,"target":6322},{"edgeType":"contains","source":10658,"target":2666},{"edgeType":"contains","source":12448,"target":12713},{"edgeType":"imports","source":980,"target":2758},{"edgeType":"contains","source":12191,"target":12222},{"edgeType":"contains","source":5189,"target":5198},{"edgeType":"contains","source":5321,"target":5334},{"edgeType":"contains","source":12315,"target":12607},{"edgeType":"contains","source":14835,"target":14837},{"edgeType":"calls","source":2182,"target":2183},{"edgeType":"contains","source":8096,"target":8098},{"edgeType":"contains","source":14240,"target":14255},{"edgeType":"contains","source":5982,"target":5983},{"edgeType":"contains","source":14172,"target":14249},{"edgeType":"contains","source":6312,"target":6323},{"edgeType":"contains","source":12448,"target":12712},{"edgeType":"calls","source":3565,"target":1591},{"edgeType":"contains","source":16077,"target":16487},{"edgeType":"imports","source":5256,"target":5501},{"edgeType":"contains","source":6775,"target":6778},{"edgeType":"contains","source":12919,"target":12925},{"edgeType":"contains","source":15758,"target":15805},{"edgeType":"calls","source":1686,"target":642},{"edgeType":"contains","source":1167,"target":927},{"edgeType":"calls","source":11498,"target":11488},{"edgeType":"calls","source":3042,"target":3003},{"edgeType":"calls","source":2976,"target":2935},{"edgeType":"calls","source":2179,"target":2273},{"edgeType":"contains","source":3670,"target":3671},{"edgeType":"contains","source":13579,"target":13605},{"edgeType":"calls","source":9849,"target":9753},{"edgeType":"imports","source":5256,"target":5502},{"edgeType":"calls","source":15722,"target":3162},{"edgeType":"contains","source":6775,"target":6779},{"edgeType":"contains","source":5321,"target":5340},{"edgeType":"contains","source":15758,"target":15806},{"edgeType":"contains","source":9814,"target":9819},{"edgeType":"imports","source":16218,"target":8161},{"edgeType":"contains","source":12191,"target":1667},{"edgeType":"calls","source":16452,"target":16471},{"edgeType":"contains","source":1,"target":3247},{"edgeType":"calls","source":7864,"target":7868},{"edgeType":"calls","source":3371,"target":3372},{"edgeType":"imports","source":5256,"target":5503},{"edgeType":"contains","source":15363,"target":15368},{"edgeType":"contains","source":6775,"target":6780},{"edgeType":"contains","source":12064,"target":11945},{"edgeType":"contains","source":15758,"target":15807},{"edgeType":"contains","source":7828,"target":7963},{"edgeType":"calls","source":14696,"target":11709},{"edgeType":"contains","source":16222,"target":16223},{"edgeType":"contains","source":13183,"target":13194},{"edgeType":"contains","source":16077,"target":16488},{"edgeType":"imports","source":15318,"target":4352},{"edgeType":"contains","source":6775,"target":6781},{"edgeType":"contains","source":12919,"target":12922},{"edgeType":"calls","source":9489,"target":8230},{"edgeType":"contains","source":15363,"target":15369},{"edgeType":"contains","source":5321,"target":5338},{"edgeType":"contains","source":15758,"target":15808},{"edgeType":"calls","source":8723,"target":8722},{"edgeType":"calls","source":2446,"target":2451},{"edgeType":"contains","source":14240,"target":14243},{"edgeType":"contains","source":14174,"target":14175},{"edgeType":"contains","source":7828,"target":7962},{"edgeType":"contains","source":9814,"target":9817},{"edgeType":"calls","source":12488,"target":12507},{"edgeType":"contains","source":7038,"target":7077},{"edgeType":"contains","source":1,"target":3252},{"edgeType":"contains","source":2939,"target":3080},{"edgeType":"contains","source":15571,"target":15264},{"edgeType":"contains","source":15363,"target":15370},{"edgeType":"contains","source":14371,"target":14411},{"edgeType":"contains","source":13579,"target":13601},{"edgeType":"contains","source":15098,"target":15128},{"edgeType":"contains","source":6593,"target":6073},{"edgeType":"contains","source":7964,"target":7969},{"edgeType":"contains","source":16156,"target":16157},{"edgeType":"contains","source":1621,"target":1657},{"edgeType":"calls","source":14628,"target":11709},{"edgeType":"contains","source":6377,"target":6428},{"edgeType":"calls","source":794,"target":806},{"edgeType":"contains","source":2939,"target":3081},{"edgeType":"contains","source":15095,"target":15223},{"edgeType":"contains","source":14371,"target":14412},{"edgeType":"contains","source":15098,"target":15129},{"edgeType":"calls","source":10317,"target":1591},{"edgeType":"imports","source":2618,"target":612},{"edgeType":"calls","source":16188,"target":16195},{"edgeType":"contains","source":9814,"target":9815},{"edgeType":"contains","source":15363,"target":15372},{"edgeType":"calls","source":3565,"target":3696},{"edgeType":"contains","source":12448,"target":12721},{"edgeType":"contains","source":2679,"target":2682},{"edgeType":"contains","source":6775,"target":6776},{"edgeType":"contains","source":15489,"target":15694},{"edgeType":"contains","source":15095,"target":15224},{"edgeType":"calls","source":11365,"target":11384},{"edgeType":"imports","source":15796,"target":4330},{"edgeType":"contains","source":8036,"target":7853},{"edgeType":"contains","source":14371,"target":14413},{"edgeType":"calls","source":1720,"target":1700},{"edgeType":"imports","source":9624,"target":9625},{"edgeType":"calls","source":16931,"target":16419},{"edgeType":"contains","source":1167,"target":933},{"edgeType":"contains","source":15363,"target":15373},{"edgeType":"contains","source":12448,"target":12720},{"edgeType":"contains","source":4330,"target":4352},{"edgeType":"imports","source":7902,"target":8042},{"edgeType":"contains","source":6775,"target":6777},{"edgeType":"contains","source":7459,"target":2485},{"edgeType":"contains","source":10949,"target":6338},{"edgeType":"contains","source":14371,"target":14414},{"edgeType":"calls","source":14455,"target":2271},{"edgeType":"contains","source":5718,"target":5719},{"edgeType":"calls","source":2187,"target":2020},{"edgeType":"contains","source":8096,"target":8106},{"edgeType":"calls","source":16386,"target":16401},{"edgeType":"calls","source":10179,"target":10099},{"edgeType":"calls","source":3570,"target":3572},{"edgeType":"imports","source":14620,"target":612},{"edgeType":"contains","source":12315,"target":12597},{"edgeType":"contains","source":12191,"target":12213},{"edgeType":"contains","source":7038,"target":7056},{"edgeType":"contains","source":14702,"target":14708},{"edgeType":"contains","source":4984,"target":5193},{"edgeType":"contains","source":3537,"target":3541},{"edgeType":"imports","source":14257,"target":13978},{"edgeType":"contains","source":10937,"target":10920},{"edgeType":"imports","source":15517,"target":15086},{"edgeType":"calls","source":1588,"target":1590},{"edgeType":"imports","source":10305,"target":9644},{"edgeType":"contains","source":3735,"target":3744},{"edgeType":"contains","source":2939,"target":3052},{"edgeType":"contains","source":7038,"target":7057},{"edgeType":"contains","source":14702,"target":14709},{"edgeType":"calls","source":1721,"target":1695},{"edgeType":"contains","source":4984,"target":5192},{"edgeType":"contains","source":15204,"target":1261},{"edgeType":"contains","source":3537,"target":3540},{"edgeType":"imports","source":9466,"target":8169},{"edgeType":"calls","source":12486,"target":12544},{"edgeType":"contains","source":6593,"target":6055},{"edgeType":"contains","source":5002,"target":4633},{"edgeType":"contains","source":4984,"target":5191},{"edgeType":"calls","source":10510,"target":10381},{"edgeType":"contains","source":2939,"target":3049},{"edgeType":"contains","source":7963,"target":7981},{"edgeType":"contains","source":4528,"target":4529},{"edgeType":"contains","source":12315,"target":12595},{"edgeType":"contains","source":7038,"target":7058},{"edgeType":"contains","source":14702,"target":14710},{"edgeType":"calls","source":8334,"target":8073},{"edgeType":"contains","source":7963,"target":7980},{"edgeType":"contains","source":2939,"target":3050},{"edgeType":"imports","source":13731,"target":13375},{"edgeType":"calls","source":1058,"target":1109},{"edgeType":"calls","source":10179,"target":10070},{"edgeType":"contains","source":9681,"target":9687},{"edgeType":"contains","source":14702,"target":14711},{"edgeType":"contains","source":3537,"target":3538},{"edgeType":"calls","source":6218,"target":6044},{"edgeType":"contains","source":11657,"target":11850},{"edgeType":"calls","source":12950,"target":12965},{"edgeType":"imports","source":13731,"target":13368},{"edgeType":"contains","source":14365,"target":14588},{"edgeType":"imports","source":2217,"target":2449},{"edgeType":"calls","source":5817,"target":5790},{"edgeType":"contains","source":8756,"target":8761},{"edgeType":"contains","source":7038,"target":7052},{"edgeType":"calls","source":1349,"target":540},{"edgeType":"contains","source":12474,"target":3436},{"edgeType":"contains","source":300,"target":301},{"edgeType":"calls","source":10645,"target":10427},{"edgeType":"contains","source":2939,"target":3055},{"edgeType":"contains","source":7830,"target":7870},{"edgeType":"calls","source":3834,"target":3840},{"edgeType":"contains","source":960,"target":981},{"edgeType":"contains","source":10296,"target":3303},{"edgeType":"contains","source":14702,"target":14712},{"edgeType":"calls","source":9647,"target":9653},{"edgeType":"contains","source":5651,"target":5654},{"edgeType":"contains","source":11657,"target":11851},{"edgeType":"imports","source":14183,"target":14154},{"edgeType":"contains","source":8756,"target":8760},{"edgeType":"contains","source":4528,"target":4534},{"edgeType":"calls","source":3469,"target":358},{"edgeType":"contains","source":2939,"target":3056},{"edgeType":"contains","source":10606,"target":10607},{"edgeType":"contains","source":4984,"target":5196},{"edgeType":"contains","source":3735,"target":3748},{"edgeType":"contains","source":7301,"target":7356},{"edgeType":"contains","source":14702,"target":14713},{"edgeType":"contains","source":5651,"target":5655},{"edgeType":"contains","source":14365,"target":14590},{"edgeType":"calls","source":15659,"target":15657},{"edgeType":"contains","source":3537,"target":3544},{"edgeType":"calls","source":1522,"target":1521},{"edgeType":"contains","source":12316,"target":12560},{"edgeType":"calls","source":8410,"target":3606},{"edgeType":"contains","source":9021,"target":9004},{"edgeType":"calls","source":2124,"target":1882},{"edgeType":"contains","source":4528,"target":4533},{"edgeType":"contains","source":15363,"target":15364},{"edgeType":"calls","source":10508,"target":10447},{"edgeType":"contains","source":15758,"target":15803},{"edgeType":"contains","source":3735,"target":3747},{"edgeType":"imports","source":6109,"target":6540},{"edgeType":"contains","source":2939,"target":3053},{"edgeType":"calls","source":11296,"target":11385},{"edgeType":"contains","source":3537,"target":3543},{"edgeType":"contains","source":9681,"target":9682},{"edgeType":"contains","source":14702,"target":14714},{"edgeType":"imports","source":5256,"target":5500},{"edgeType":"contains","source":2828,"target":2267},{"edgeType":"contains","source":4528,"target":4532},{"edgeType":"imports","source":11679,"target":9334},{"edgeType":"contains","source":15758,"target":15804},{"edgeType":"contains","source":6510,"target":6511},{"edgeType":"contains","source":3735,"target":3746},{"edgeType":"contains","source":1621,"target":1631},{"edgeType":"calls","source":6150,"target":6034},{"edgeType":"contains","source":4984,"target":5194},{"edgeType":"contains","source":2939,"target":3054},{"edgeType":"calls","source":6088,"target":5842},{"edgeType":"contains","source":3537,"target":3542},{"edgeType":"contains","source":13248,"target":13264},{"edgeType":"calls","source":2465,"target":1883},{"edgeType":"contains","source":14702,"target":14715},{"edgeType":"contains","source":7963,"target":7987},{"edgeType":"contains","source":6510,"target":6520},{"edgeType":"contains","source":12191,"target":12221},{"edgeType":"calls","source":3834,"target":3836},{"edgeType":"imports","source":16801,"target":2758},{"edgeType":"imports","source":14716,"target":1856},{"edgeType":"calls","source":4032,"target":4040},{"edgeType":"contains","source":9288,"target":7079},{"edgeType":"contains","source":2939,"target":3059},{"edgeType":"contains","source":7038,"target":7064},{"edgeType":"contains","source":15758,"target":15788},{"edgeType":"calls","source":14999,"target":14988},{"edgeType":"contains","source":6510,"target":6521},{"edgeType":"contains","source":12191,"target":12220},{"edgeType":"calls","source":14801,"target":14784},{"edgeType":"calls","source":16452,"target":16455},{"edgeType":"calls","source":6226,"target":5790},{"edgeType":"calls","source":11701,"target":11521},{"edgeType":"imports","source":9090,"target":9249},{"edgeType":"contains","source":12908,"target":13248},{"edgeType":"contains","source":7038,"target":7065},{"edgeType":"imports","source":9090,"target":7132},{"edgeType":"contains","source":5321,"target":5323},{"edgeType":"contains","source":7963,"target":7989},{"edgeType":"calls","source":6992,"target":1058},{"edgeType":"contains","source":12191,"target":12219},{"edgeType":"calls","source":2381,"target":2367},{"edgeType":"calls","source":15878,"target":8881},{"edgeType":"contains","source":9681,"target":9694},{"edgeType":"imports","source":12087,"target":7250},{"edgeType":"contains","source":2939,"target":3057},{"edgeType":"contains","source":7038,"target":7066},{"edgeType":"contains","source":5321,"target":5322},{"edgeType":"contains","source":7963,"target":7988},{"edgeType":"contains","source":6593,"target":6064},{"edgeType":"contains","source":13447,"target":13450},{"edgeType":"calls","source":2381,"target":2368},{"edgeType":"contains","source":1,"target":3233},{"edgeType":"contains","source":9681,"target":9695},{"edgeType":"contains","source":2939,"target":3058},{"edgeType":"contains","source":14702,"target":14703},{"edgeType":"calls","source":10124,"target":3327},{"edgeType":"imports","source":11679,"target":865},{"edgeType":"contains","source":6312,"target":6319},{"edgeType":"contains","source":16077,"target":16472},{"edgeType":"contains","source":1621,"target":1635},{"edgeType":"contains","source":12908,"target":13246},{"edgeType":"contains","source":7038,"target":7060},{"edgeType":"contains","source":4061,"target":4222},{"edgeType":"imports","source":14340,"target":2938},{"edgeType":"contains","source":12908,"target":13245},{"edgeType":"contains","source":13447,"target":13448},{"edgeType":"contains","source":12378,"target":12761},{"edgeType":"contains","source":4061,"target":4220},{"edgeType":"contains","source":7038,"target":7061},{"edgeType":"contains","source":6312,"target":6313},{"edgeType":"contains","source":4061,"target":4221},{"edgeType":"contains","source":15204,"target":1257},{"edgeType":"contains","source":5070,"target":4652},{"edgeType":"contains","source":12908,"target":13244},{"edgeType":"imports","source":1244,"target":907},{"edgeType":"contains","source":12908,"target":13243},{"edgeType":"contains","source":6510,"target":6518},{"edgeType":"calls","source":2252,"target":2134},{"edgeType":"imports","source":12469,"target":12316},{"edgeType":"contains","source":14702,"target":14706},{"edgeType":"contains","source":14694,"target":14954},{"edgeType":"calls","source":15203,"target":15004},{"edgeType":"contains","source":7038,"target":7062},{"edgeType":"calls","source":9119,"target":9119},{"edgeType":"calls","source":2458,"target":2091},{"edgeType":"contains","source":5189,"target":5190},{"edgeType":"contains","source":6510,"target":6519},{"edgeType":"contains","source":13579,"target":13582},{"edgeType":"calls","source":2250,"target":2197},{"edgeType":"calls","source":14539,"target":14449},{"edgeType":"calls","source":1564,"target":209},{"edgeType":"calls","source":2843,"target":2841},{"edgeType":"imports","source":13526,"target":13375},{"edgeType":"contains","source":7038,"target":7063},{"edgeType":"calls","source":1079,"target":540},{"edgeType":"imports","source":16801,"target":15236},{"edgeType":"contains","source":8108,"target":8224},{"edgeType":"contains","source":4874,"target":4887},{"edgeType":"contains","source":16236,"target":16290},{"edgeType":"contains","source":2620,"target":2882},{"edgeType":"contains","source":16632,"target":16699},{"edgeType":"calls","source":3507,"target":3493},{"edgeType":"calls","source":2846,"target":2844},{"edgeType":"contains","source":11336,"target":11746},{"edgeType":"contains","source":5534,"target":5569},{"edgeType":"calls","source":6846,"target":5690},{"edgeType":"calls","source":8858,"target":8855},{"edgeType":"calls","source":3573,"target":3563},{"edgeType":"imports","source":15636,"target":15410},{"edgeType":"contains","source":16236,"target":16289},{"edgeType":"imports","source":5256,"target":5279},{"edgeType":"contains","source":2620,"target":2883},{"edgeType":"calls","source":3918,"target":3438},{"edgeType":"contains","source":4544,"target":4546},{"edgeType":"contains","source":16632,"target":16698},{"edgeType":"calls","source":1287,"target":433},{"edgeType":"contains","source":5534,"target":5570},{"edgeType":"contains","source":7714,"target":7753},{"edgeType":"contains","source":13526,"target":13620},{"edgeType":"contains","source":11336,"target":11747},{"edgeType":"contains","source":1410,"target":2340},{"edgeType":"calls","source":6961,"target":2126},{"edgeType":"contains","source":4874,"target":4885},{"edgeType":"contains","source":7517,"target":7520},{"edgeType":"contains","source":16236,"target":16292},{"edgeType":"calls","source":2317,"target":2328},{"edgeType":"contains","source":4544,"target":4545},{"edgeType":"contains","source":382,"target":383},{"edgeType":"contains","source":16630,"target":16763},{"edgeType":"contains","source":16632,"target":16701},{"edgeType":"calls","source":1259,"target":1304},{"edgeType":"calls","source":1062,"target":1069},{"edgeType":"contains","source":9564,"target":9599},{"edgeType":"contains","source":7517,"target":7521},{"edgeType":"calls","source":3507,"target":3492},{"edgeType":"imports","source":15379,"target":4352},{"edgeType":"contains","source":16632,"target":16700},{"edgeType":"calls","source":11038,"target":11039},{"edgeType":"contains","source":7714,"target":7755},{"edgeType":"contains","source":7913,"target":7928},{"edgeType":"contains","source":11937,"target":12140},{"edgeType":"calls","source":15209,"target":2246},{"edgeType":"calls","source":2984,"target":679},{"edgeType":"contains","source":11412,"target":11503},{"edgeType":"contains","source":11336,"target":11745},{"edgeType":"contains","source":5534,"target":5564},{"edgeType":"contains","source":2620,"target":2886},{"edgeType":"calls","source":16129,"target":16000},{"edgeType":"calls","source":4510,"target":4108},{"edgeType":"contains","source":15445,"target":15446},{"edgeType":"calls","source":16061,"target":15994},{"edgeType":"calls","source":2479,"target":1532},{"edgeType":"calls","source":6147,"target":6213},{"edgeType":"contains","source":7913,"target":7923},{"edgeType":"contains","source":16632,"target":16703},{"edgeType":"calls","source":12294,"target":12275},{"edgeType":"imports","source":7719,"target":808},{"edgeType":"calls","source":12165,"target":12046},{"edgeType":"calls","source":8136,"target":7985},{"edgeType":"contains","source":1410,"target":2343},{"edgeType":"contains","source":5534,"target":5565},{"edgeType":"contains","source":2620,"target":2887},{"edgeType":"imports","source":1715,"target":883},{"edgeType":"contains","source":16632,"target":16702},{"edgeType":"calls","source":2846,"target":2841},{"edgeType":"contains","source":3786,"target":4793},{"edgeType":"contains","source":4874,"target":4890},{"edgeType":"calls","source":1259,"target":1297},{"edgeType":"contains","source":1307,"target":1309},{"edgeType":"contains","source":5534,"target":5566},{"edgeType":"contains","source":3355,"target":3356},{"edgeType":"contains","source":2620,"target":2884},{"edgeType":"contains","source":6259,"target":6346},{"edgeType":"calls","source":13223,"target":13072},{"edgeType":"contains","source":14262,"target":14067},{"edgeType":"contains","source":15379,"target":15380},{"edgeType":"calls","source":4254,"target":1471},{"edgeType":"contains","source":6540,"target":6091},{"edgeType":"imports","source":15636,"target":610},{"edgeType":"contains","source":3786,"target":4792},{"edgeType":"contains","source":9432,"target":9459},{"edgeType":"contains","source":11184,"target":12224},{"edgeType":"contains","source":1410,"target":2341},{"edgeType":"contains","source":5535,"target":5536},{"edgeType":"contains","source":5534,"target":5567},{"edgeType":"contains","source":16632,"target":16705},{"edgeType":"contains","source":2620,"target":2885},{"edgeType":"contains","source":10160,"target":10144},{"edgeType":"contains","source":15379,"target":15381},{"edgeType":"contains","source":7913,"target":7924},{"edgeType":"contains","source":1410,"target":2342},{"edgeType":"contains","source":14723,"target":1892},{"edgeType":"contains","source":9432,"target":9458},{"edgeType":"contains","source":11184,"target":12225},{"edgeType":"contains","source":5534,"target":5568},{"edgeType":"contains","source":16632,"target":16704},{"edgeType":"contains","source":9301,"target":9303},{"edgeType":"calls","source":2383,"target":2390},{"edgeType":"contains","source":9564,"target":9606},{"edgeType":"contains","source":7913,"target":7935},{"edgeType":"contains","source":11680,"target":11661},{"edgeType":"contains","source":16632,"target":16690},{"edgeType":"contains","source":7711,"target":7855},{"edgeType":"contains","source":5662,"target":5837},{"edgeType":"calls","source":6488,"target":6226},{"edgeType":"contains","source":12274,"target":12275},{"edgeType":"contains","source":12907,"target":13792},{"edgeType":"contains","source":5199,"target":5390},{"edgeType":"imports","source":5256,"target":5269},{"edgeType":"contains","source":1167,"target":1422},{"edgeType":"contains","source":9301,"target":9302},{"edgeType":"contains","source":2620,"target":2891},{"edgeType":"contains","source":15048,"target":15057},{"edgeType":"contains","source":14718,"target":2032},{"edgeType":"contains","source":5662,"target":5838},{"edgeType":"contains","source":7913,"target":7934},{"edgeType":"contains","source":16630,"target":16751},{"edgeType":"contains","source":16632,"target":16689},{"edgeType":"contains","source":7711,"target":7854},{"edgeType":"contains","source":10292,"target":10295},{"edgeType":"contains","source":1410,"target":2348},{"edgeType":"imports","source":5256,"target":5270},{"edgeType":"calls","source":1852,"target":1936},{"edgeType":"contains","source":6540,"target":6104},{"edgeType":"calls","source":7040,"target":6028},{"edgeType":"contains","source":9235,"target":9237},{"edgeType":"contains","source":11336,"target":11753},{"edgeType":"contains","source":16632,"target":16692},{"edgeType":"contains","source":16236,"target":16284},{"edgeType":"calls","source":2581,"target":2592},{"edgeType":"contains","source":5662,"target":5839},{"edgeType":"imports","source":9885,"target":9756},{"edgeType":"contains","source":4280,"target":4281},{"edgeType":"calls","source":4299,"target":4301},{"edgeType":"contains","source":10353,"target":10515},{"edgeType":"contains","source":4805,"target":4918},{"edgeType":"contains","source":11008,"target":9236},{"edgeType":"contains","source":1410,"target":2345},{"edgeType":"calls","source":12809,"target":540},{"edgeType":"contains","source":13526,"target":13627},{"edgeType":"contains","source":13408,"target":13057},{"edgeType":"contains","source":2620,"target":2889},{"edgeType":"imports","source":1167,"target":970},{"edgeType":"contains","source":16632,"target":16691},{"edgeType":"contains","source":5662,"target":5840},{"edgeType":"contains","source":14718,"target":14719},{"edgeType":"contains","source":16236,"target":16283},{"edgeType":"contains","source":10292,"target":10293},{"edgeType":"calls","source":12822,"target":12822},{"edgeType":"imports","source":9220,"target":774},{"edgeType":"calls","source":6488,"target":6229},{"edgeType":"calls","source":1562,"target":358},{"edgeType":"calls","source":3680,"target":2349},{"edgeType":"contains","source":7517,"target":7522},{"edgeType":"contains","source":16632,"target":16694},{"edgeType":"calls","source":4831,"target":4719},{"edgeType":"contains","source":16236,"target":16286},{"edgeType":"contains","source":1410,"target":2351},{"edgeType":"contains","source":7714,"target":7758},{"edgeType":"calls","source":2467,"target":1896},{"edgeType":"calls","source":11501,"target":11498},{"edgeType":"calls","source":8466,"target":8335},{"edgeType":"contains","source":11336,"target":11750},{"edgeType":"contains","source":1167,"target":1426},{"edgeType":"imports","source":12378,"target":10693},{"edgeType":"contains","source":7517,"target":7523},{"edgeType":"calls","source":1458,"target":1462},{"edgeType":"contains","source":7913,"target":7930},{"edgeType":"contains","source":16632,"target":16693},{"edgeType":"calls","source":2994,"target":358},{"edgeType":"contains","source":16236,"target":16285},{"edgeType":"contains","source":14718,"target":14721},{"edgeType":"contains","source":1410,"target":2352},{"edgeType":"calls","source":2979,"target":2938},{"edgeType":"calls","source":1630,"target":358},{"edgeType":"calls","source":3134,"target":2361},{"edgeType":"calls","source":15663,"target":15657},{"edgeType":"contains","source":2223,"target":2518},{"edgeType":"contains","source":1780,"target":1449},{"edgeType":"contains","source":8773,"target":8756},{"edgeType":"contains","source":3157,"target":3158},{"edgeType":"calls","source":2649,"target":2594},{"edgeType":"imports","source":14182,"target":13965},{"edgeType":"contains","source":7517,"target":7524},{"edgeType":"contains","source":10353,"target":10510},{"edgeType":"imports","source":9885,"target":9760},{"edgeType":"contains","source":6259,"target":6354},{"edgeType":"contains","source":7913,"target":7933},{"edgeType":"contains","source":10751,"target":2401},{"edgeType":"contains","source":52,"target":55},{"edgeType":"contains","source":7714,"target":7760},{"edgeType":"contains","source":14652,"target":14654},{"edgeType":"contains","source":14718,"target":14722},{"edgeType":"contains","source":16632,"target":16697},{"edgeType":"contains","source":2620,"target":2892},{"edgeType":"contains","source":11336,"target":11748},{"edgeType":"contains","source":13529,"target":13530},{"edgeType":"contains","source":13526,"target":13623},{"edgeType":"contains","source":7517,"target":7525},{"edgeType":"contains","source":4072,"target":4389},{"edgeType":"contains","source":16632,"target":16695},{"edgeType":"imports","source":7719,"target":801},{"edgeType":"contains","source":16236,"target":16287},{"edgeType":"contains","source":1410,"target":2350},{"edgeType":"contains","source":696,"target":1230},{"edgeType":"contains","source":5662,"target":5836},{"edgeType":"contains","source":10424,"target":10425},{"edgeType":"contains","source":16632,"target":16696},{"edgeType":"contains","source":11336,"target":11749},{"edgeType":"contains","source":14916,"target":14927},{"edgeType":"contains","source":14912,"target":15051},{"edgeType":"calls","source":7930,"target":5926},{"edgeType":"calls","source":3438,"target":3535},{"edgeType":"calls","source":4282,"target":626},{"edgeType":"contains","source":16632,"target":16682},{"edgeType":"imports","source":2217,"target":2222},{"edgeType":"imports","source":15503,"target":15289},{"edgeType":"contains","source":5997,"target":5998},{"edgeType":"calls","source":2185,"target":2211},{"edgeType":"imports","source":8158,"target":8321},{"edgeType":"contains","source":10751,"target":2383},{"edgeType":"contains","source":7053,"target":7088},{"edgeType":"imports","source":2217,"target":2221},{"edgeType":"contains","source":16632,"target":16681},{"edgeType":"contains","source":5270,"target":5278},{"edgeType":"calls","source":14544,"target":14383},{"edgeType":"contains","source":13526,"target":13604},{"edgeType":"calls","source":9060,"target":8917},{"edgeType":"contains","source":15048,"target":15049},{"edgeType":"calls","source":2384,"target":2385},{"edgeType":"imports","source":5256,"target":5262},{"edgeType":"calls","source":4431,"target":4463},{"edgeType":"contains","source":16632,"target":16684},{"edgeType":"calls","source":3573,"target":3576},{"edgeType":"imports","source":2217,"target":2220},{"edgeType":"contains","source":5270,"target":5277},{"edgeType":"imports","source":8158,"target":8318},{"edgeType":"contains","source":15048,"target":15050},{"edgeType":"calls","source":10716,"target":10433},{"edgeType":"calls","source":10785,"target":8294},{"edgeType":"calls","source":402,"target":405},{"edgeType":"contains","source":16236,"target":16276},{"edgeType":"contains","source":2223,"target":2486},{"edgeType":"imports","source":15581,"target":14987},{"edgeType":"calls","source":4435,"target":2224},{"edgeType":"imports","source":5256,"target":5263},{"edgeType":"imports","source":2217,"target":2219},{"edgeType":"calls","source":7709,"target":2178},{"edgeType":"contains","source":5270,"target":5276},{"edgeType":"contains","source":16632,"target":16683},{"edgeType":"calls","source":10245,"target":10238},{"edgeType":"contains","source":3694,"target":3394},{"edgeType":"imports","source":9472,"target":1410},{"edgeType":"calls","source":11304,"target":11233},{"edgeType":"imports","source":5256,"target":5264},{"edgeType":"contains","source":16632,"target":16686},{"edgeType":"calls","source":3573,"target":3574},{"edgeType":"imports","source":2217,"target":2218},{"edgeType":"calls","source":3738,"target":573},{"edgeType":"contains","source":1410,"target":2326},{"edgeType":"imports","source":8259,"target":965},{"edgeType":"contains","source":15048,"target":15052},{"edgeType":"contains","source":9696,"target":9714},{"edgeType":"contains","source":5534,"target":5548},{"edgeType":"contains","source":10353,"target":10488},{"edgeType":"calls","source":1062,"target":1079},{"edgeType":"contains","source":16236,"target":16278},{"edgeType":"imports","source":5256,"target":5265},{"edgeType":"imports","source":1779,"target":998},{"edgeType":"calls","source":6148,"target":6198},{"edgeType":"calls","source":11505,"target":11349},{"edgeType":"calls","source":3507,"target":3507},{"edgeType":"imports","source":7775,"target":1169},{"edgeType":"calls","source":10323,"target":9936},{"edgeType":"contains","source":12007,"target":12065},{"edgeType":"contains","source":15311,"target":15356},{"edgeType":"contains","source":1410,"target":2327},{"edgeType":"contains","source":13526,"target":13600},{"edgeType":"contains","source":2620,"target":2870},{"edgeType":"contains","source":5534,"target":5549},{"edgeType":"calls","source":1133,"target":991},{"edgeType":"calls","source":12628,"target":12476},{"edgeType":"contains","source":16236,"target":16277},{"edgeType":"imports","source":5256,"target":5266},{"edgeType":"contains","source":12870,"target":4339},{"edgeType":"imports","source":8158,"target":8322},{"edgeType":"calls","source":1525,"target":1527},{"edgeType":"contains","source":15311,"target":15357},{"edgeType":"calls","source":734,"target":679},{"edgeType":"contains","source":15048,"target":15054},{"edgeType":"calls","source":5156,"target":5237},{"edgeType":"contains","source":5534,"target":5550},{"edgeType":"contains","source":1410,"target":2324},{"edgeType":"contains","source":16632,"target":16688},{"edgeType":"contains","source":5402,"target":5417},{"edgeType":"contains","source":16236,"target":16280},{"edgeType":"imports","source":696,"target":742},{"edgeType":"contains","source":7053,"target":7084},{"edgeType":"imports","source":5256,"target":5267},{"edgeType":"imports","source":8158,"target":8323},{"edgeType":"contains","source":16630,"target":16749},{"edgeType":"contains","source":16632,"target":16687},{"edgeType":"imports","source":980,"target":2510},{"edgeType":"contains","source":15048,"target":15055},{"edgeType":"contains","source":13526,"target":13598},{"edgeType":"contains","source":1410,"target":2325},{"edgeType":"imports","source":9220,"target":9226},{"edgeType":"calls","source":9122,"target":9116},{"edgeType":"contains","source":11017,"target":11043},{"edgeType":"calls","source":15707,"target":7928},{"edgeType":"contains","source":2828,"target":2762},{"edgeType":"contains","source":12907,"target":13760},{"edgeType":"imports","source":5256,"target":5268},{"edgeType":"contains","source":2223,"target":2496},{"edgeType":"calls","source":2321,"target":2214},{"edgeType":"contains","source":1410,"target":2330},{"edgeType":"contains","source":10751,"target":2390},{"edgeType":"imports","source":15379,"target":4327},{"edgeType":"contains","source":4874,"target":4879},{"edgeType":"calls","source":8465,"target":8345},{"edgeType":"calls","source":10179,"target":10177},{"edgeType":"contains","source":15636,"target":15838},{"edgeType":"contains","source":14321,"target":14322},{"edgeType":"calls","source":11633,"target":11613},{"edgeType":"contains","source":5733,"target":5734},{"edgeType":"contains","source":16632,"target":16674},{"edgeType":"calls","source":3573,"target":3571},{"edgeType":"contains","source":6259,"target":6341},{"edgeType":"contains","source":5662,"target":5821},{"edgeType":"contains","source":7714,"target":7744},{"edgeType":"contains","source":1410,"target":2331},{"edgeType":"calls","source":8924,"target":8913},{"edgeType":"imports","source":15379,"target":4326},{"edgeType":"contains","source":10754,"target":10755},{"edgeType":"contains","source":15636,"target":15839},{"edgeType":"contains","source":13464,"target":13420},{"edgeType":"contains","source":13526,"target":13612},{"edgeType":"contains","source":5402,"target":5422},{"edgeType":"contains","source":5733,"target":5735},{"edgeType":"contains","source":11545,"target":11602},{"edgeType":"contains","source":14321,"target":14323},{"edgeType":"contains","source":7913,"target":7918},{"edgeType":"contains","source":13792,"target":13822},{"edgeType":"contains","source":16632,"target":16673},{"edgeType":"calls","source":8792,"target":8780},{"edgeType":"contains","source":15636,"target":15840},{"edgeType":"contains","source":1769,"target":1770},{"edgeType":"imports","source":14113,"target":13978},{"edgeType":"contains","source":3786,"target":4780},{"edgeType":"contains","source":16632,"target":16676},{"edgeType":"contains","source":7647,"target":7709},{"edgeType":"contains","source":9696,"target":9725},{"edgeType":"calls","source":2354,"target":1190},{"edgeType":"contains","source":1657,"target":1014},{"edgeType":"contains","source":6125,"target":6269},{"edgeType":"calls","source":12363,"target":12237},{"edgeType":"contains","source":15636,"target":15841},{"edgeType":"contains","source":15312,"target":15315},{"edgeType":"contains","source":15311,"target":15346},{"edgeType":"contains","source":1410,"target":2329},{"edgeType":"contains","source":7458,"target":2999},{"edgeType":"contains","source":11336,"target":11737},{"edgeType":"imports","source":14382,"target":1410},{"edgeType":"contains","source":14652,"target":14634},{"edgeType":"contains","source":16632,"target":16675},{"edgeType":"contains","source":2223,"target":2500},{"edgeType":"contains","source":7714,"target":7741},{"edgeType":"contains","source":15246,"target":15248},{"edgeType":"contains","source":15636,"target":15842},{"edgeType":"contains","source":15312,"target":15316},{"edgeType":"contains","source":15311,"target":15347},{"edgeType":"contains","source":1780,"target":1435},{"edgeType":"calls","source":9254,"target":803},{"edgeType":"contains","source":11185,"target":1616},{"edgeType":"contains","source":5865,"target":5866},{"edgeType":"contains","source":7913,"target":7915},{"edgeType":"contains","source":16632,"target":16678},{"edgeType":"contains","source":13792,"target":13819},{"edgeType":"contains","source":3685,"target":3689},{"edgeType":"calls","source":13968,"target":540},{"edgeType":"contains","source":2223,"target":2501},{"edgeType":"calls","source":1855,"target":1856},{"edgeType":"calls","source":14866,"target":4413},{"edgeType":"calls","source":15068,"target":15059},{"edgeType":"contains","source":7913,"target":7914},{"edgeType":"contains","source":16630,"target":16739},{"edgeType":"contains","source":16632,"target":16677},{"edgeType":"calls","source":11010,"target":9791},{"edgeType":"contains","source":16632,"target":16680},{"edgeType":"contains","source":8838,"target":8839},{"edgeType":"calls","source":1852,"target":1952},{"edgeType":"calls","source":16258,"target":16223},{"edgeType":"contains","source":7053,"target":7093},{"edgeType":"contains","source":15246,"target":15250},{"edgeType":"contains","source":15636,"target":15844},{"edgeType":"calls","source":14473,"target":14481},{"edgeType":"contains","source":5402,"target":5425},{"edgeType":"contains","source":5865,"target":5868},{"edgeType":"imports","source":16780,"target":1058},{"edgeType":"contains","source":10291,"target":10302},{"edgeType":"contains","source":7913,"target":7917},{"edgeType":"contains","source":2223,"target":2499},{"edgeType":"imports","source":2217,"target":2223},{"edgeType":"calls","source":2383,"target":2401},{"edgeType":"calls","source":12227,"target":12229},{"edgeType":"contains","source":14924,"target":14662},{"edgeType":"contains","source":15636,"target":15845},{"edgeType":"contains","source":7913,"target":7916},{"edgeType":"contains","source":16632,"target":16679},{"edgeType":"contains","source":3685,"target":3686},{"edgeType":"calls","source":11105,"target":11072},{"edgeType":"calls","source":798,"target":800},{"edgeType":"imports","source":9820,"target":9644},{"edgeType":"contains","source":5467,"target":5498},{"edgeType":"imports","source":1779,"target":1051},{"edgeType":"contains","source":15642,"target":15644},{"edgeType":"contains","source":2223,"target":2471},{"edgeType":"contains","source":10751,"target":10822},{"edgeType":"calls","source":11499,"target":11514},{"edgeType":"contains","source":2618,"target":2911},{"edgeType":"calls","source":10311,"target":10288},{"edgeType":"contains","source":16632,"target":16666},{"edgeType":"contains","source":7250,"target":3077},{"edgeType":"contains","source":7053,"target":7070},{"edgeType":"imports","source":14183,"target":13978},{"edgeType":"contains","source":5662,"target":5796},{"edgeType":"contains","source":7714,"target":7721},{"edgeType":"contains","source":13526,"target":13588},{"edgeType":"contains","source":15311,"target":15334},{"edgeType":"calls","source":3160,"target":1533},{"edgeType":"calls","source":4437,"target":4227},{"edgeType":"imports","source":8631,"target":8506},{"edgeType":"calls","source":4431,"target":4413},{"edgeType":"contains","source":15642,"target":15645},{"edgeType":"contains","source":10751,"target":10823},{"edgeType":"imports","source":9750,"target":9755},{"edgeType":"contains","source":2223,"target":2472},{"edgeType":"calls","source":8130,"target":8135},{"edgeType":"contains","source":2618,"target":2912},{"edgeType":"calls","source":10134,"target":976},{"edgeType":"calls","source":3507,"target":3461},{"edgeType":"contains","source":16632,"target":16665},{"edgeType":"calls","source":6858,"target":1058},{"edgeType":"calls","source":6623,"target":6229},{"edgeType":"contains","source":15642,"target":15646},{"edgeType":"contains","source":15636,"target":15832},{"edgeType":"contains","source":9564,"target":9567},{"edgeType":"contains","source":2223,"target":2469},{"edgeType":"contains","source":5930,"target":5946},{"edgeType":"contains","source":2618,"target":2909},{"edgeType":"calls","source":7810,"target":7486},{"edgeType":"calls","source":10178,"target":10185},{"edgeType":"calls","source":11362,"target":3075},{"edgeType":"contains","source":1768,"target":1776},{"edgeType":"contains","source":15642,"target":15647},{"edgeType":"imports","source":16472,"target":4326},{"edgeType":"contains","source":13792,"target":13796},{"edgeType":"contains","source":2223,"target":2470},{"edgeType":"calls","source":1612,"target":898},{"edgeType":"contains","source":10884,"target":10926},{"edgeType":"contains","source":10751,"target":10821},{"edgeType":"contains","source":2618,"target":2910},{"edgeType":"contains","source":5733,"target":5712},{"edgeType":"calls","source":2845,"target":2841},{"edgeType":"contains","source":16632,"target":16667},{"edgeType":"calls","source":10311,"target":10289},{"edgeType":"contains","source":1768,"target":1777},{"edgeType":"contains","source":14912,"target":15022},{"edgeType":"contains","source":5467,"target":5494},{"edgeType":"calls","source":1070,"target":782},{"edgeType":"contains","source":2223,"target":2475},{"edgeType":"imports","source":5256,"target":5315},{"edgeType":"calls","source":11571,"target":11401},{"edgeType":"contains","source":16632,"target":16670},{"edgeType":"calls","source":3643,"target":3468},{"edgeType":"calls","source":8130,"target":8138},{"edgeType":"contains","source":1410,"target":2310},{"edgeType":"contains","source":15529,"target":4352},{"edgeType":"calls","source":1259,"target":1265},{"edgeType":"contains","source":15318,"target":4551},{"edgeType":"contains","source":13526,"target":13584},{"edgeType":"contains","source":2618,"target":2916},{"edgeType":"contains","source":5467,"target":5495},{"edgeType":"calls","source":1259,"target":1264},{"edgeType":"contains","source":13792,"target":13794},{"edgeType":"calls","source":13223,"target":13040},{"edgeType":"contains","source":13197,"target":13212},{"edgeType":"imports","source":15636,"target":15439},{"edgeType":"calls","source":4040,"target":3847},{"edgeType":"contains","source":2223,"target":2476},{"edgeType":"calls","source":464,"target":540},{"edgeType":"calls","source":11434,"target":11420},{"edgeType":"calls","source":13967,"target":2660},{"edgeType":"contains","source":12801,"target":12804},{"edgeType":"contains","source":16632,"target":16669},{"edgeType":"contains","source":1410,"target":2311},{"edgeType":"contains","source":10426,"target":10320},{"edgeType":"contains","source":13197,"target":13211},{"edgeType":"imports","source":9750,"target":9758},{"edgeType":"contains","source":11184,"target":12191},{"edgeType":"calls","source":13558,"target":540},{"edgeType":"contains","source":2223,"target":2473},{"edgeType":"contains","source":6305,"target":7001},{"edgeType":"calls","source":6755,"target":6370},{"edgeType":"imports","source":9090,"target":2734},{"edgeType":"calls","source":1524,"target":1508},{"edgeType":"contains","source":5662,"target":5794},{"edgeType":"contains","source":16632,"target":16672},{"edgeType":"contains","source":5467,"target":5497},{"edgeType":"contains","source":2618,"target":2914},{"edgeType":"contains","source":9035,"target":9048},{"edgeType":"imports","source":14777,"target":12473},{"edgeType":"imports","source":9750,"target":9757},{"edgeType":"contains","source":13197,"target":13210},{"edgeType":"contains","source":6305,"target":7002},{"edgeType":"calls","source":6226,"target":5842},{"edgeType":"contains","source":2223,"target":2474},{"edgeType":"contains","source":15636,"target":15837},{"edgeType":"contains","source":16632,"target":16671},{"edgeType":"calls","source":8857,"target":8858},{"edgeType":"contains","source":13526,"target":13581},{"edgeType":"contains","source":11412,"target":11466},{"edgeType":"contains","source":3830,"target":3394},{"edgeType":"calls","source":8923,"target":8926},{"edgeType":"contains","source":9432,"target":3083},{"edgeType":"imports","source":10084,"target":9974},{"edgeType":"contains","source":1410,"target":2309},{"edgeType":"contains","source":1838,"target":1730},{"edgeType":"contains","source":5270,"target":5271},{"edgeType":"contains","source":9299,"target":9332},{"edgeType":"contains","source":2620,"target":2857},{"edgeType":"calls","source":6944,"target":6855},{"edgeType":"calls","source":9851,"target":9758},{"edgeType":"imports","source":10291,"target":9889},{"edgeType":"contains","source":13330,"target":13331},{"edgeType":"contains","source":2434,"target":2281},{"edgeType":"contains","source":1410,"target":2314},{"edgeType":"calls","source":13678,"target":13739},{"edgeType":"imports","source":15517,"target":4326},{"edgeType":"contains","source":10884,"target":10935},{"edgeType":"calls","source":6161,"target":5741},{"edgeType":"contains","source":9299,"target":9331},{"edgeType":"contains","source":10223,"target":10286},{"edgeType":"contains","source":9854,"target":2696},{"edgeType":"contains","source":2223,"target":2481},{"edgeType":"contains","source":5534,"target":5545},{"edgeType":"contains","source":10223,"target":10287},{"edgeType":"contains","source":9299,"target":9330},{"edgeType":"contains","source":2618,"target":2917},{"edgeType":"contains","source":3786,"target":4763},{"edgeType":"contains","source":9854,"target":2699},{"edgeType":"contains","source":16630,"target":16721},{"edgeType":"contains","source":2223,"target":2477},{"edgeType":"contains","source":5534,"target":5546},{"edgeType":"contains","source":16236,"target":16251},{"edgeType":"contains","source":1410,"target":2312},{"edgeType":"calls","source":15833,"target":12473},{"edgeType":"imports","source":10522,"target":611},{"edgeType":"calls","source":13223,"target":13042},{"edgeType":"contains","source":15774,"target":15775},{"edgeType":"contains","source":2620,"target":2856},{"edgeType":"calls","source":6226,"target":5838},{"edgeType":"contains","source":9299,"target":9333},{"edgeType":"contains","source":9854,"target":2698},{"edgeType":"contains","source":14716,"target":14747},{"edgeType":"contains","source":16632,"target":16658},{"edgeType":"contains","source":2223,"target":2478},{"edgeType":"contains","source":5534,"target":5547},{"edgeType":"calls","source":2250,"target":2251},{"edgeType":"imports","source":15517,"target":4327},{"edgeType":"calls","source":1857,"target":1750},{"edgeType":"contains","source":10884,"target":10934},{"edgeType":"imports","source":1715,"target":925},{"edgeType":"calls","source":4032,"target":4086},{"edgeType":"calls","source":6226,"target":5837},{"edgeType":"calls","source":12738,"target":601},{"edgeType":"contains","source":5270,"target":5275},{"edgeType":"imports","source":5256,"target":5307},{"edgeType":"calls","source":2534,"target":1900},{"edgeType":"contains","source":16632,"target":16661},{"edgeType":"imports","source":9460,"target":8171},{"edgeType":"contains","source":16236,"target":16253},{"edgeType":"imports","source":15484,"target":7459},{"edgeType":"calls","source":131,"target":286},{"edgeType":"contains","source":11017,"target":11036},{"edgeType":"contains","source":9432,"target":3090},{"edgeType":"contains","source":12907,"target":13754},{"edgeType":"contains","source":6007,"target":5676},{"edgeType":"calls","source":10446,"target":10343},{"edgeType":"imports","source":1779,"target":1054},{"edgeType":"calls","source":14407,"target":14398},{"edgeType":"calls","source":6226,"target":5836},{"edgeType":"contains","source":5270,"target":5274},{"edgeType":"calls","source":15604,"target":540},{"edgeType":"contains","source":13792,"target":13802},{"edgeType":"contains","source":13869,"target":13529},{"edgeType":"contains","source":16236,"target":16252},{"edgeType":"calls","source":2281,"target":1288},{"edgeType":"calls","source":2250,"target":2249},{"edgeType":"calls","source":1588,"target":1627},{"edgeType":"contains","source":1331,"target":540},{"edgeType":"calls","source":3439,"target":3440},{"edgeType":"contains","source":5270,"target":5273},{"edgeType":"contains","source":1167,"target":1396},{"edgeType":"calls","source":15139,"target":14956},{"edgeType":"contains","source":16632,"target":16663},{"edgeType":"contains","source":12469,"target":12532},{"edgeType":"imports","source":14340,"target":2758},{"edgeType":"calls","source":928,"target":949},{"edgeType":"contains","source":16236,"target":16255},{"edgeType":"contains","source":2223,"target":2482},{"edgeType":"contains","source":5534,"target":5542},{"edgeType":"contains","source":16632,"target":16664},{"edgeType":"calls","source":4299,"target":4264},{"edgeType":"imports","source":9090,"target":612},{"edgeType":"contains","source":9432,"target":9434},{"edgeType":"imports","source":1779,"target":1052},{"edgeType":"contains","source":10884,"target":10930},{"edgeType":"contains","source":15642,"target":15643},{"edgeType":"contains","source":16632,"target":16662},{"edgeType":"contains","source":5930,"target":5951},{"edgeType":"contains","source":16236,"target":16254},{"edgeType":"calls","source":11717,"target":540},{"edgeType":"contains","source":2223,"target":2483},{"edgeType":"contains","source":13197,"target":13218},{"edgeType":"contains","source":11852,"target":12614},{"edgeType":"contains","source":1,"target":14256},{"edgeType":"contains","source":5199,"target":5333},{"edgeType":"contains","source":7053,"target":7054},{"edgeType":"calls","source":14929,"target":4530},{"edgeType":"contains","source":11083,"target":11084},{"edgeType":"contains","source":1635,"target":1656},{"edgeType":"contains","source":13197,"target":13201},{"edgeType":"contains","source":10223,"target":10261},{"edgeType":"contains","source":13827,"target":8469},{"edgeType":"contains","source":6194,"target":6200},{"edgeType":"contains","source":1410,"target":2289},{"edgeType":"contains","source":10818,"target":10842},{"edgeType":"calls","source":16255,"target":16276},{"edgeType":"calls","source":533,"target":537},{"edgeType":"contains","source":16236,"target":16241},{"edgeType":"imports","source":13932,"target":600},{"edgeType":"calls","source":11056,"target":10433},{"edgeType":"contains","source":5199,"target":5332},{"edgeType":"contains","source":9760,"target":9816},{"edgeType":"contains","source":16632,"target":16648},{"edgeType":"contains","source":13526,"target":13571},{"edgeType":"calls","source":1612,"target":912},{"edgeType":"contains","source":3221,"target":3229},{"edgeType":"contains","source":13197,"target":13200},{"edgeType":"contains","source":5662,"target":5780},{"edgeType":"contains","source":5467,"target":5483},{"edgeType":"calls","source":2383,"target":2383},{"edgeType":"contains","source":11184,"target":1611},{"edgeType":"contains","source":9057,"target":8351},{"edgeType":"contains","source":10818,"target":10843},{"edgeType":"contains","source":6305,"target":6988},{"edgeType":"contains","source":6259,"target":6300},{"edgeType":"contains","source":10353,"target":10460},{"edgeType":"contains","source":2618,"target":2895},{"edgeType":"calls","source":2119,"target":2107},{"edgeType":"imports","source":12013,"target":893},{"edgeType":"contains","source":3221,"target":3226},{"edgeType":"contains","source":7902,"target":8220},{"edgeType":"imports","source":8158,"target":8351},{"edgeType":"contains","source":5199,"target":5331},{"edgeType":"contains","source":13526,"target":13570},{"edgeType":"contains","source":1635,"target":1654},{"edgeType":"calls","source":9121,"target":9110},{"edgeType":"imports","source":9090,"target":600},{"edgeType":"contains","source":9760,"target":9813},{"edgeType":"contains","source":5467,"target":5484},{"edgeType":"contains","source":1410,"target":2287},{"edgeType":"calls","source":6560,"target":6052},{"edgeType":"contains","source":10223,"target":10259},{"edgeType":"calls","source":1689,"target":642},{"edgeType":"contains","source":4210,"target":4279},{"edgeType":"contains","source":7978,"target":7979},{"edgeType":"contains","source":10818,"target":10840},{"edgeType":"contains","source":6194,"target":6202},{"edgeType":"contains","source":5199,"target":5330},{"edgeType":"contains","source":5662,"target":5782},{"edgeType":"imports","source":8158,"target":8352},{"edgeType":"contains","source":14694,"target":15421},{"edgeType":"calls","source":8130,"target":8121},{"edgeType":"contains","source":9951,"target":10235},{"edgeType":"contains","source":9035,"target":9036},{"edgeType":"contains","source":11852,"target":12611},{"edgeType":"contains","source":15251,"target":2382},{"edgeType":"contains","source":9220,"target":5415},{"edgeType":"contains","source":1410,"target":2288},{"edgeType":"contains","source":10223,"target":10260},{"edgeType":"contains","source":9637,"target":9400},{"edgeType":"contains","source":4210,"target":4278},{"edgeType":"contains","source":2223,"target":2454},{"edgeType":"contains","source":10818,"target":10841},{"edgeType":"imports","source":5256,"target":5297},{"edgeType":"contains","source":2618,"target":2893},{"edgeType":"contains","source":16236,"target":16242},{"edgeType":"calls","source":12169,"target":11867},{"edgeType":"contains","source":6194,"target":6203},{"edgeType":"calls","source":6148,"target":6166},{"edgeType":"contains","source":6305,"target":6990},{"edgeType":"contains","source":13395,"target":13401},{"edgeType":"calls","source":13613,"target":13619},{"edgeType":"contains","source":11852,"target":12610},{"edgeType":"calls","source":3365,"target":1533},{"edgeType":"calls","source":15527,"target":15586},{"edgeType":"contains","source":2618,"target":2898},{"edgeType":"contains","source":10937,"target":11377},{"edgeType":"contains","source":10818,"target":10838},{"edgeType":"contains","source":1,"target":12146},{"edgeType":"contains","source":909,"target":910},{"edgeType":"contains","source":4939,"target":4940},{"edgeType":"imports","source":9885,"target":1331},{"edgeType":"calls","source":10377,"target":10343},{"edgeType":"calls","source":1723,"target":1695},{"edgeType":"contains","source":13659,"target":13672},{"edgeType":"contains","source":7824,"target":61},{"edgeType":"contains","source":2618,"target":2899},{"edgeType":"contains","source":10937,"target":11378},{"edgeType":"calls","source":11103,"target":11095},{"edgeType":"contains","source":6259,"target":6296},{"edgeType":"calls","source":1061,"target":1076},{"edgeType":"contains","source":6194,"target":6197},{"edgeType":"contains","source":10818,"target":10839},{"edgeType":"imports","source":15763,"target":15713},{"edgeType":"calls","source":400,"target":427},{"edgeType":"imports","source":7239,"target":7247},{"edgeType":"calls","source":11633,"target":11574},{"edgeType":"contains","source":16632,"target":16655},{"edgeType":"calls","source":5502,"target":5049},{"edgeType":"contains","source":9760,"target":9809},{"edgeType":"calls","source":10183,"target":1561},{"edgeType":"contains","source":2223,"target":2457},{"edgeType":"contains","source":10937,"target":11375},{"edgeType":"calls","source":11499,"target":11500},{"edgeType":"contains","source":2618,"target":2896},{"edgeType":"contains","source":1,"target":12148},{"edgeType":"contains","source":13526,"target":13565},{"edgeType":"calls","source":15068,"target":15019},{"edgeType":"contains","source":909,"target":912},{"edgeType":"calls","source":6981,"target":5690},{"edgeType":"contains","source":1410,"target":2292},{"edgeType":"contains","source":15220,"target":1233},{"edgeType":"calls","source":7931,"target":5837},{"edgeType":"contains","source":9220,"target":5410},{"edgeType":"imports","source":1715,"target":898},{"edgeType":"imports","source":9220,"target":803},{"edgeType":"contains","source":10937,"target":11376},{"edgeType":"contains","source":12998,"target":13020},{"edgeType":"contains","source":2618,"target":2897},{"edgeType":"contains","source":4716,"target":3394},{"edgeType":"contains","source":10751,"target":10800},{"edgeType":"contains","source":10426,"target":10318},{"edgeType":"contains","source":9035,"target":9043},{"edgeType":"contains","source":9760,"target":9823},{"edgeType":"contains","source":14848,"target":14864},{"edgeType":"calls","source":4282,"target":2699},{"edgeType":"calls","source":11089,"target":3075},{"edgeType":"contains","source":5467,"target":5490},{"edgeType":"calls","source":14753,"target":3652},{"edgeType":"contains","source":2759,"target":2760},{"edgeType":"contains","source":1410,"target":2297},{"edgeType":"imports","source":14114,"target":13978},{"edgeType":"contains","source":2618,"target":2902},{"edgeType":"contains","source":13827,"target":8477},{"edgeType":"contains","source":1,"target":12150},{"edgeType":"contains","source":11852,"target":12623},{"edgeType":"contains","source":14584,"target":14592},{"edgeType":"contains","source":5930,"target":5936},{"edgeType":"contains","source":9760,"target":9824},{"edgeType":"contains","source":16632,"target":16641},{"edgeType":"contains","source":14848,"target":14865},{"edgeType":"contains","source":6305,"target":6996},{"edgeType":"contains","source":9090,"target":9451},{"edgeType":"contains","source":10426,"target":10319},{"edgeType":"contains","source":5662,"target":5788},{"edgeType":"contains","source":11017,"target":11025},{"edgeType":"contains","source":1410,"target":2298},{"edgeType":"contains","source":11184,"target":12190},{"edgeType":"contains","source":2759,"target":2761},{"edgeType":"imports","source":7239,"target":893},{"edgeType":"contains","source":3221,"target":3237},{"edgeType":"contains","source":5402,"target":5389},{"edgeType":"imports","source":5256,"target":5287},{"edgeType":"calls","source":3341,"target":2273},{"edgeType":"contains","source":1768,"target":1771},{"edgeType":"contains","source":15972,"target":15960},{"edgeType":"contains","source":15246,"target":15211},{"edgeType":"contains","source":2618,"target":2903},{"edgeType":"contains","source":3786,"target":4748},{"edgeType":"calls","source":13044,"target":12235},{"edgeType":"contains","source":11852,"target":12622},{"edgeType":"contains","source":14584,"target":14593},{"edgeType":"contains","source":16632,"target":16640},{"edgeType":"contains","source":9035,"target":9045},{"edgeType":"contains","source":4939,"target":4943},{"edgeType":"calls","source":2979,"target":2922},{"edgeType":"contains","source":9760,"target":9821},{"edgeType":"contains","source":5467,"target":5492},{"edgeType":"contains","source":4928,"target":3170},{"edgeType":"calls","source":14539,"target":14512},{"edgeType":"calls","source":1524,"target":1521},{"edgeType":"contains","source":2618,"target":2900},{"edgeType":"contains","source":13526,"target":13578},{"edgeType":"calls","source":15685,"target":2246},{"edgeType":"calls","source":3341,"target":156},{"edgeType":"calls","source":16820,"target":15684},{"edgeType":"calls","source":11499,"target":11504},{"edgeType":"contains","source":11852,"target":12621},{"edgeType":"contains","source":9035,"target":9044},{"edgeType":"calls","source":11499,"target":11505},{"edgeType":"contains","source":14848,"target":14867},{"edgeType":"contains","source":4939,"target":4942},{"edgeType":"contains","source":6305,"target":6998},{"edgeType":"contains","source":5219,"target":4718},{"edgeType":"imports","source":9541,"target":1410},{"edgeType":"contains","source":9432,"target":3079},{"edgeType":"calls","source":14457,"target":2255},{"edgeType":"imports","source":2434,"target":1876},{"edgeType":"contains","source":2618,"target":2901},{"edgeType":"imports","source":5256,"target":5289},{"edgeType":"calls","source":11103,"target":11097},{"edgeType":"contains","source":6540,"target":6055},{"edgeType":"contains","source":9299,"target":9316},{"edgeType":"contains","source":1768,"target":1769},{"edgeType":"contains","source":13526,"target":13577},{"edgeType":"calls","source":12223,"target":1745},{"edgeType":"contains","source":5662,"target":5791},{"edgeType":"contains","source":11852,"target":12620},{"edgeType":"contains","source":11852,"target":12618},{"edgeType":"contains","source":2223,"target":2467},{"edgeType":"calls","source":2320,"target":2208},{"edgeType":"calls","source":1854,"target":1855},{"edgeType":"contains","source":11412,"target":11459},{"edgeType":"contains","source":12999,"target":13001},{"edgeType":"imports","source":5256,"target":5290},{"edgeType":"contains","source":1768,"target":1774},{"edgeType":"calls","source":4588,"target":3780},{"edgeType":"contains","source":16632,"target":16645},{"edgeType":"calls","source":8923,"target":8917},{"edgeType":"contains","source":16236,"target":16237},{"edgeType":"contains","source":6194,"target":6204},{"edgeType":"imports","source":10436,"target":9609},{"edgeType":"contains","source":7902,"target":8221},{"edgeType":"calls","source":4351,"target":2669},{"edgeType":"imports","source":10522,"target":601},{"edgeType":"contains","source":1768,"target":1775},{"edgeType":"imports","source":9221,"target":9222},{"edgeType":"contains","source":9951,"target":10242},{"edgeType":"contains","source":7902,"target":8222},{"edgeType":"contains","source":16630,"target":16706},{"edgeType":"contains","source":16632,"target":16644},{"edgeType":"calls","source":1272,"target":869},{"edgeType":"contains","source":6305,"target":6992},{"edgeType":"contains","source":6194,"target":6205},{"edgeType":"contains","source":9090,"target":9450},{"edgeType":"contains","source":2223,"target":2465},{"edgeType":"contains","source":5662,"target":5785},{"edgeType":"contains","source":11017,"target":11018},{"edgeType":"contains","source":1768,"target":1772},{"edgeType":"contains","source":2618,"target":2904},{"edgeType":"contains","source":13737,"target":13375},{"edgeType":"imports","source":1167,"target":981},{"edgeType":"calls","source":11632,"target":11613},{"edgeType":"calls","source":15192,"target":615},{"edgeType":"calls","source":3249,"target":3004},{"edgeType":"calls","source":1060,"target":1102},{"edgeType":"contains","source":7978,"target":7983},{"edgeType":"contains","source":9760,"target":9818},{"edgeType":"contains","source":11852,"target":12615},{"edgeType":"contains","source":1410,"target":2300},{"edgeType":"calls","source":6623,"target":6226},{"edgeType":"calls","source":400,"target":420},{"edgeType":"contains","source":5467,"target":5489},{"edgeType":"contains","source":14912,"target":15001},{"edgeType":"contains","source":2618,"target":2906},{"edgeType":"contains","source":13197,"target":13202},{"edgeType":"contains","source":1768,"target":1773},{"edgeType":"contains","source":2618,"target":2905},{"edgeType":"contains","source":6194,"target":6207},{"edgeType":"contains","source":5869,"target":5712},{"edgeType":"contains","source":15972,"target":15966},{"edgeType":"contains","source":7978,"target":7982},{"edgeType":"contains","source":693,"target":1244},{"edgeType":"imports","source":9432,"target":2734},{"edgeType":"contains","source":12998,"target":13011},{"edgeType":"contains","source":9562,"target":9594},{"edgeType":"contains","source":13659,"target":13661},{"edgeType":"contains","source":1410,"target":2272},{"edgeType":"contains","source":4013,"target":4029},{"edgeType":"contains","source":8108,"target":8158},{"edgeType":"contains","source":13725,"target":13729},{"edgeType":"calls","source":16010,"target":15531},{"edgeType":"calls","source":1554,"target":680},{"edgeType":"contains","source":10751,"target":10789},{"edgeType":"calls","source":15625,"target":2097},{"edgeType":"calls","source":11641,"target":11440},{"edgeType":"contains","source":12271,"target":12293},{"edgeType":"calls","source":2087,"target":1069},{"edgeType":"imports","source":9090,"target":2765},{"edgeType":"contains","source":3786,"target":4724},{"edgeType":"contains","source":10550,"target":10678},{"edgeType":"contains","source":12018,"target":11680},{"edgeType":"imports","source":14661,"target":5535},{"edgeType":"calls","source":12363,"target":12312},{"edgeType":"imports","source":16291,"target":16314},{"edgeType":"contains","source":3147,"target":3391},{"edgeType":"calls","source":5424,"target":5441},{"edgeType":"contains","source":16632,"target":16633},{"edgeType":"contains","source":13526,"target":13555},{"edgeType":"contains","source":1635,"target":1640},{"edgeType":"contains","source":10223,"target":10245},{"edgeType":"contains","source":13725,"target":13728},{"edgeType":"imports","source":16780,"target":15954},{"edgeType":"imports","source":15379,"target":14987},{"edgeType":"contains","source":987,"target":585},{"edgeType":"calls","source":1134,"target":1014},{"edgeType":"contains","source":1410,"target":2274},{"edgeType":"contains","source":7647,"target":7650},{"edgeType":"contains","source":1635,"target":1641},{"edgeType":"contains","source":11677,"target":11678},{"edgeType":"contains","source":13725,"target":13727},{"edgeType":"contains","source":2626,"target":2628},{"edgeType":"contains","source":3147,"target":3389},{"edgeType":"imports","source":14695,"target":2369},{"edgeType":"contains","source":7254,"target":808},{"edgeType":"contains","source":16632,"target":16635},{"edgeType":"calls","source":1461,"target":1450},{"edgeType":"calls","source":14481,"target":14303},{"edgeType":"contains","source":5467,"target":5468},{"edgeType":"contains","source":1410,"target":2271},{"edgeType":"contains","source":4244,"target":1093},{"edgeType":"contains","source":13725,"target":13726},{"edgeType":"contains","source":2626,"target":2629},{"edgeType":"calls","source":4386,"target":1677},{"edgeType":"calls","source":1342,"target":910},{"edgeType":"contains","source":3147,"target":3390},{"edgeType":"imports","source":8158,"target":8402},{"edgeType":"calls","source":12229,"target":12237},{"edgeType":"contains","source":14716,"target":14723},{"edgeType":"contains","source":16632,"target":16634},{"edgeType":"calls","source":5424,"target":5438},{"edgeType":"contains","source":7647,"target":7652},{"edgeType":"contains","source":13526,"target":13552},{"edgeType":"contains","source":10937,"target":11361},{"edgeType":"contains","source":12998,"target":13007},{"edgeType":"contains","source":1,"target":14244},{"edgeType":"contains","source":7107,"target":7473},{"edgeType":"contains","source":12907,"target":13714},{"edgeType":"contains","source":1635,"target":1644},{"edgeType":"contains","source":16632,"target":16637},{"edgeType":"contains","source":6540,"target":6023},{"edgeType":"contains","source":11852,"target":12594},{"edgeType":"contains","source":9827,"target":9832},{"edgeType":"calls","source":14746,"target":3980},{"edgeType":"contains","source":9562,"target":9589},{"edgeType":"calls","source":5296,"target":5177},{"edgeType":"contains","source":9760,"target":9795},{"edgeType":"imports","source":9885,"target":9835},{"edgeType":"contains","source":15636,"target":15802},{"edgeType":"calls","source":16194,"target":16166},{"edgeType":"contains","source":10937,"target":11362},{"edgeType":"contains","source":12998,"target":13006},{"edgeType":"contains","source":16165,"target":16314},{"edgeType":"contains","source":7107,"target":7474},{"edgeType":"contains","source":16632,"target":16636},{"edgeType":"contains","source":8042,"target":8085},{"edgeType":"contains","source":9562,"target":9588},{"edgeType":"contains","source":11852,"target":12593},{"edgeType":"calls","source":5296,"target":5176},{"edgeType":"contains","source":13526,"target":13550},{"edgeType":"contains","source":5662,"target":5760},{"edgeType":"imports","source":12706,"target":600},{"edgeType":"contains","source":13129,"target":13172},{"edgeType":"contains","source":4013,"target":4031},{"edgeType":"contains","source":15443,"target":15444},{"edgeType":"contains","source":12998,"target":13005},{"edgeType":"contains","source":10818,"target":10820},{"edgeType":"imports","source":15349,"target":7460},{"edgeType":"imports","source":15349,"target":7459},{"edgeType":"contains","source":16632,"target":16639},{"edgeType":"calls","source":8662,"target":8661},{"edgeType":"contains","source":8042,"target":8088},{"edgeType":"calls","source":1592,"target":1613},{"edgeType":"contains","source":10223,"target":10238},{"edgeType":"contains","source":11852,"target":12592},{"edgeType":"contains","source":9562,"target":9591},{"edgeType":"contains","source":1779,"target":1406},{"edgeType":"calls","source":14588,"target":2534},{"edgeType":"contains","source":9827,"target":9830},{"edgeType":"contains","source":1635,"target":1642},{"edgeType":"contains","source":13129,"target":13171},{"edgeType":"calls","source":7986,"target":2134},{"edgeType":"calls","source":6093,"target":5836},{"edgeType":"contains","source":10937,"target":11360},{"edgeType":"calls","source":2211,"target":1449},{"edgeType":"contains","source":10751,"target":10784},{"edgeType":"contains","source":16632,"target":16638},{"edgeType":"contains","source":14584,"target":14591},{"edgeType":"contains","source":8042,"target":8087},{"edgeType":"contains","source":13415,"target":12761},{"edgeType":"contains","source":9889,"target":10023},{"edgeType":"contains","source":9562,"target":9590},{"edgeType":"contains","source":11852,"target":12591},{"edgeType":"contains","source":1410,"target":2276},{"edgeType":"calls","source":14143,"target":3651},{"edgeType":"calls","source":1883,"target":1043},{"edgeType":"contains","source":10751,"target":10797},{"edgeType":"contains","source":9365,"target":9367},{"edgeType":"calls","source":11641,"target":11448},{"edgeType":"imports","source":16472,"target":4352},{"edgeType":"calls","source":4107,"target":3978},{"edgeType":"contains","source":13659,"target":13669},{"edgeType":"contains","source":4013,"target":4037},{"edgeType":"calls","source":12890,"target":12897},{"edgeType":"contains","source":9951,"target":10228},{"edgeType":"contains","source":9760,"target":9807},{"edgeType":"contains","source":5662,"target":5771},{"edgeType":"calls","source":7935,"target":7944},{"edgeType":"contains","source":10937,"target":11373},{"edgeType":"contains","source":12998,"target":13019},{"edgeType":"calls","source":6370,"target":5722},{"edgeType":"contains","source":5269,"target":5268},{"edgeType":"calls","source":10488,"target":680},{"edgeType":"contains","source":10751,"target":10798},{"edgeType":"calls","source":1883,"target":1042},{"edgeType":"contains","source":4013,"target":4036},{"edgeType":"contains","source":9365,"target":9366},{"edgeType":"contains","source":13395,"target":13396},{"edgeType":"imports","source":9754,"target":3315},{"edgeType":"calls","source":8926,"target":8934},{"edgeType":"calls","source":2392,"target":2178},{"edgeType":"calls","source":3580,"target":3403},{"edgeType":"contains","source":9220,"target":5404},{"edgeType":"contains","source":10658,"target":997},{"edgeType":"contains","source":1635,"target":1649},{"edgeType":"contains","source":15376,"target":15393},{"edgeType":"contains","source":10937,"target":11374},{"edgeType":"contains","source":13375,"target":1331},{"edgeType":"contains","source":5269,"target":5267},{"edgeType":"calls","source":1612,"target":986},{"edgeType":"contains","source":10818,"target":10835},{"edgeType":"calls","source":6944,"target":6956},{"edgeType":"imports","source":15503,"target":15366},{"edgeType":"contains","source":4013,"target":4035},{"edgeType":"calls","source":1079,"target":600},{"edgeType":"contains","source":9299,"target":9301},{"edgeType":"contains","source":13659,"target":13667},{"edgeType":"contains","source":11852,"target":12604},{"edgeType":"contains","source":1635,"target":1646},{"edgeType":"contains","source":9760,"target":9805},{"edgeType":"contains","source":10353,"target":10449},{"edgeType":"contains","source":13330,"target":13295},{"edgeType":"contains","source":6305,"target":6981},{"edgeType":"contains","source":15664,"target":4352},{"edgeType":"contains","source":11006,"target":9232},{"edgeType":"contains","source":10937,"target":11371},{"edgeType":"contains","source":13659,"target":13666},{"edgeType":"calls","source":8411,"target":7990},{"edgeType":"calls","source":3988,"target":3438},{"edgeType":"calls","source":4764,"target":4749},{"edgeType":"contains","source":5662,"target":5774},{"edgeType":"contains","source":9760,"target":9806},{"edgeType":"contains","source":9035,"target":9027},{"edgeType":"contains","source":6194,"target":6195},{"edgeType":"calls","source":3442,"target":3451},{"edgeType":"contains","source":5269,"target":5265},{"edgeType":"contains","source":10937,"target":11372},{"edgeType":"calls","source":8067,"target":8083},{"edgeType":"contains","source":5199,"target":5329},{"edgeType":"contains","source":3221,"target":3224},{"edgeType":"contains","source":13659,"target":13665},{"edgeType":"contains","source":13526,"target":13560},{"edgeType":"calls","source":2549,"target":1534},{"edgeType":"contains","source":8035,"target":8311},{"edgeType":"contains","source":6305,"target":6974},{"edgeType":"contains","source":11852,"target":12602},{"edgeType":"contains","source":5662,"target":5767},{"edgeType":"contains","source":3221,"target":3225},{"edgeType":"imports","source":5256,"target":5341},{"edgeType":"contains","source":13659,"target":13664},{"edgeType":"contains","source":1635,"target":1653},{"edgeType":"calls","source":4972,"target":4641},{"edgeType":"contains","source":6259,"target":6287},{"edgeType":"contains","source":4210,"target":4276},{"edgeType":"contains","source":11852,"target":12601},{"edgeType":"contains","source":12998,"target":13014},{"edgeType":"calls","source":1856,"target":1874},{"edgeType":"contains","source":3221,"target":3222},{"edgeType":"calls","source":11039,"target":11085},{"edgeType":"calls","source":11641,"target":11450},{"edgeType":"contains","source":13659,"target":13663},{"edgeType":"calls","source":6998,"target":1058},{"edgeType":"calls","source":8479,"target":8000},{"edgeType":"contains","source":14848,"target":14854},{"edgeType":"calls","source":1851,"target":2032},{"edgeType":"contains","source":13659,"target":13662},{"edgeType":"contains","source":3221,"target":3223},{"edgeType":"calls","source":3438,"target":3571},{"edgeType":"contains","source":11679,"target":11621},{"edgeType":"contains","source":8035,"target":8312},{"edgeType":"contains","source":14694,"target":15401},{"edgeType":"calls","source":10722,"target":10343},{"edgeType":"contains","source":9760,"target":9802},{"edgeType":"contains","source":13918,"target":14088},{"edgeType":"calls","source":16061,"target":16071},{"edgeType":"calls","source":3906,"target":3861},{"edgeType":"calls","source":3640,"target":3651},{"edgeType":"contains","source":5206,"target":5108},{"edgeType":"contains","source":13395,"target":13389},{"edgeType":"contains","source":14694,"target":15385},{"edgeType":"contains","source":7239,"target":7597},{"edgeType":"calls","source":8926,"target":8910},{"edgeType":"contains","source":5070,"target":5071},{"edgeType":"contains","source":1,"target":14223},{"edgeType":"contains","source":5199,"target":5300},{"edgeType":"contains","source":11852,"target":12581},{"edgeType":"contains","source":3616,"target":3635},{"edgeType":"contains","source":13526,"target":13539},{"edgeType":"calls","source":2848,"target":2864},{"edgeType":"calls","source":14542,"target":14512},{"edgeType":"contains","source":1375,"target":3341},{"edgeType":"contains","source":11610,"target":11626},{"edgeType":"calls","source":6367,"target":5790},{"edgeType":"contains","source":2217,"target":2608},{"edgeType":"imports","source":9090,"target":9091},{"edgeType":"calls","source":1395,"target":1396},{"edgeType":"calls","source":8926,"target":8909},{"edgeType":"contains","source":7107,"target":7462},{"edgeType":"contains","source":8042,"target":8072},{"edgeType":"contains","source":11852,"target":12580},{"edgeType":"imports","source":2153,"target":2157},{"edgeType":"imports","source":15636,"target":15460},{"edgeType":"calls","source":5394,"target":2159},{"edgeType":"contains","source":5662,"target":5747},{"edgeType":"contains","source":5658,"target":5871},{"edgeType":"contains","source":4244,"target":1079},{"edgeType":"contains","source":1410,"target":2257},{"edgeType":"contains","source":11610,"target":11627},{"edgeType":"contains","source":13129,"target":13160},{"edgeType":"calls","source":7076,"target":7067},{"edgeType":"contains","source":2217,"target":2609},{"edgeType":"contains","source":7107,"target":7463},{"edgeType":"contains","source":9889,"target":10009},{"edgeType":"contains","source":5227,"target":2316},{"edgeType":"calls","source":803,"target":724},{"edgeType":"contains","source":11852,"target":12579},{"edgeType":"contains","source":7239,"target":7599},{"edgeType":"calls","source":932,"target":953},{"edgeType":"calls","source":12036,"target":11860},{"edgeType":"contains","source":9854,"target":2641},{"edgeType":"contains","source":8109,"target":8113},{"edgeType":"contains","source":10223,"target":10226},{"edgeType":"contains","source":13129,"target":13159},{"edgeType":"contains","source":4210,"target":4246},{"edgeType":"contains","source":6004,"target":5717},{"edgeType":"contains","source":8438,"target":8484},{"edgeType":"imports","source":9754,"target":3303},{"edgeType":"calls","source":1729,"target":1615},{"edgeType":"contains","source":13918,"target":14075},{"edgeType":"contains","source":15376,"target":15387},{"edgeType":"contains","source":7107,"target":7464},{"edgeType":"calls","source":3443,"target":3445},{"edgeType":"calls","source":2997,"target":358},{"edgeType":"contains","source":5425,"target":4633},{"edgeType":"contains","source":11852,"target":12578},{"edgeType":"contains","source":5662,"target":5749},{"edgeType":"contains","source":9760,"target":9781},{"edgeType":"contains","source":13324,"target":13456},{"edgeType":"contains","source":7239,"target":7600},{"edgeType":"contains","source":11610,"target":11625},{"edgeType":"calls","source":9391,"target":2953},{"edgeType":"contains","source":3487,"target":3403},{"edgeType":"calls","source":14415,"target":1533},{"edgeType":"contains","source":8109,"target":8112},{"edgeType":"contains","source":10937,"target":11347},{"edgeType":"contains","source":10949,"target":10975},{"edgeType":"contains","source":12271,"target":12274},{"edgeType":"contains","source":987,"target":570},{"edgeType":"contains","source":8438,"target":8483},{"edgeType":"contains","source":8042,"target":8069},{"edgeType":"imports","source":11600,"target":11621},{"edgeType":"contains","source":7239,"target":7593},{"edgeType":"calls","source":951,"target":358},{"edgeType":"contains","source":9889,"target":10007},{"edgeType":"contains","source":11937,"target":12056},{"edgeType":"calls","source":2959,"target":1533},{"edgeType":"contains","source":11852,"target":12577},{"edgeType":"calls","source":14044,"target":13042},{"edgeType":"contains","source":11805,"target":11920},{"edgeType":"contains","source":14912,"target":14973},{"edgeType":"contains","source":1410,"target":2260},{"edgeType":"calls","source":5101,"target":4896},{"edgeType":"contains","source":10353,"target":10422},{"edgeType":"contains","source":14716,"target":2023},{"edgeType":"contains","source":10302,"target":9889},{"edgeType":"contains","source":7107,"target":7456},{"edgeType":"imports","source":15828,"target":3162},{"edgeType":"contains","source":8042,"target":8068},{"edgeType":"contains","source":11412,"target":11419},{"edgeType":"contains","source":15376,"target":15389},{"edgeType":"calls","source":10716,"target":10506},{"edgeType":"contains","source":7239,"target":7594},{"edgeType":"contains","source":11852,"target":12576},{"edgeType":"contains","source":13324,"target":13454},{"edgeType":"contains","source":9889,"target":10008},{"edgeType":"contains","source":11805,"target":11919},{"edgeType":"contains","source":5662,"target":5743},{"edgeType":"contains","source":13129,"target":13156},{"edgeType":"calls","source":14044,"target":13040},{"edgeType":"contains","source":7107,"target":7457},{"edgeType":"contains","source":7250,"target":7254},{"edgeType":"contains","source":7239,"target":7595},{"edgeType":"contains","source":8042,"target":8071},{"edgeType":"calls","source":1461,"target":1463},{"edgeType":"contains","source":5070,"target":5073},{"edgeType":"contains","source":9889,"target":10005},{"edgeType":"contains","source":11610,"target":11620},{"edgeType":"contains","source":13324,"target":13453},{"edgeType":"contains","source":12013,"target":11812},{"edgeType":"contains","source":7514,"target":7526},{"edgeType":"contains","source":11852,"target":12575},{"edgeType":"contains","source":7711,"target":7762},{"edgeType":"contains","source":3616,"target":3637},{"edgeType":"contains","source":11805,"target":11918},{"edgeType":"contains","source":10353,"target":10420},{"edgeType":"contains","source":4013,"target":4015},{"edgeType":"contains","source":7239,"target":7596},{"edgeType":"contains","source":5070,"target":5072},{"edgeType":"calls","source":8926,"target":8915},{"edgeType":"contains","source":13324,"target":13452},{"edgeType":"contains","source":9889,"target":10006},{"edgeType":"calls","source":1017,"target":427},{"edgeType":"contains","source":11852,"target":12574},{"edgeType":"contains","source":7514,"target":7527},{"edgeType":"contains","source":1410,"target":2259},{"edgeType":"contains","source":5659,"target":7952},{"edgeType":"contains","source":11805,"target":11917},{"edgeType":"contains","source":3616,"target":3636},{"edgeType":"calls","source":12263,"target":600},{"edgeType":"contains","source":12469,"target":12474},{"edgeType":"imports","source":15379,"target":2284},{"edgeType":"contains","source":5662,"target":5754},{"edgeType":"contains","source":9760,"target":9790},{"edgeType":"contains","source":8438,"target":8490},{"edgeType":"imports","source":15452,"target":4244},{"edgeType":"contains","source":7239,"target":7605},{"edgeType":"calls","source":1262,"target":1284},{"edgeType":"contains","source":7107,"target":7469},{"edgeType":"contains","source":8836,"target":8837},{"edgeType":"contains","source":10884,"target":10886},{"edgeType":"contains","source":8042,"target":8082},{"edgeType":"contains","source":10751,"target":10780},{"edgeType":"calls","source":15692,"target":2126},{"edgeType":"contains","source":9562,"target":9585},{"edgeType":"contains","source":10223,"target":10236},{"edgeType":"contains","source":3786,"target":4716},{"edgeType":"contains","source":2041,"target":1730},{"edgeType":"contains","source":11852,"target":12590},{"edgeType":"contains","source":8438,"target":8489},{"edgeType":"contains","source":9760,"target":9791},{"edgeType":"contains","source":13129,"target":13169},{"edgeType":"calls","source":2915,"target":2894},{"edgeType":"calls","source":10585,"target":10343},{"edgeType":"calls","source":5817,"target":5950},{"edgeType":"contains","source":15376,"target":15377},{"edgeType":"contains","source":10937,"target":11358},{"edgeType":"contains","source":1410,"target":2265},{"edgeType":"contains","source":7239,"target":7606},{"edgeType":"contains","source":7107,"target":7470},{"edgeType":"contains","source":10884,"target":10887},{"edgeType":"contains","source":10818,"target":10819},{"edgeType":"contains","source":9562,"target":9584},{"edgeType":"calls","source":9391,"target":2959},{"edgeType":"contains","source":11852,"target":12589},{"edgeType":"contains","source":9760,"target":9788},{"edgeType":"contains","source":8438,"target":8492},{"edgeType":"calls","source":10779,"target":10668},{"edgeType":"contains","source":15376,"target":15378},{"edgeType":"imports","source":5256,"target":5321},{"edgeType":"contains","source":8042,"target":8084},{"edgeType":"contains","source":12420,"target":3436},{"edgeType":"contains","source":7239,"target":7607},{"edgeType":"contains","source":9301,"target":9222},{"edgeType":"calls","source":15693,"target":2097},{"edgeType":"contains","source":9562,"target":9587},{"edgeType":"contains","source":10223,"target":10234},{"edgeType":"calls","source":2452,"target":2446},{"edgeType":"contains","source":14694,"target":15379},{"edgeType":"contains","source":11852,"target":12586},{"edgeType":"contains","source":5662,"target":5757},{"edgeType":"contains","source":9760,"target":9789},{"edgeType":"contains","source":14912,"target":14964},{"edgeType":"calls","source":6632,"target":6042},{"edgeType":"contains","source":7107,"target":7472},{"edgeType":"contains","source":7106,"target":7503},{"edgeType":"calls","source":12229,"target":12229},{"edgeType":"contains","source":13129,"target":13167},{"edgeType":"calls","source":1477,"target":962},{"edgeType":"contains","source":12998,"target":13000},{"edgeType":"calls","source":11107,"target":11072},{"edgeType":"calls","source":3336,"target":411},{"edgeType":"imports","source":9885,"target":1349},{"edgeType":"contains","source":9562,"target":9586},{"edgeType":"contains","source":7107,"target":7465},{"edgeType":"imports","source":14954,"target":2765},{"edgeType":"contains","source":4244,"target":1092},{"edgeType":"contains","source":11852,"target":12585},{"edgeType":"calls","source":3076,"target":2126},{"edgeType":"contains","source":1410,"target":2268},{"edgeType":"calls","source":3442,"target":3465},{"edgeType":"contains","source":2758,"target":2762},{"edgeType":"contains","source":7239,"target":7601},{"edgeType":"contains","source":8109,"target":8115},{"edgeType":"contains","source":13526,"target":13543},{"edgeType":"contains","source":6259,"target":6270},{"edgeType":"contains","source":8042,"target":8078},{"edgeType":"contains","source":10223,"target":10232},{"edgeType":"contains","source":10522,"target":963},{"edgeType":"contains","source":7107,"target":7466},{"edgeType":"calls","source":1624,"target":627},{"edgeType":"contains","source":9760,"target":9787},{"edgeType":"contains","source":4738,"target":4804},{"edgeType":"contains","source":11017,"target":10988},{"edgeType":"contains","source":2626,"target":2627},{"edgeType":"contains","source":7239,"target":7602},{"edgeType":"contains","source":13129,"target":13165},{"edgeType":"contains","source":1,"target":14234},{"edgeType":"contains","source":3147,"target":3388},{"edgeType":"contains","source":10751,"target":10777},{"edgeType":"calls","source":11176,"target":8939},{"edgeType":"contains","source":8042,"target":8077},{"edgeType":"contains","source":10223,"target":10233},{"edgeType":"contains","source":6194,"target":6172},{"edgeType":"calls","source":12827,"target":12723},{"edgeType":"contains","source":8438,"target":8488},{"edgeType":"contains","source":7239,"target":7603},{"edgeType":"calls","source":8067,"target":8070},{"edgeType":"contains","source":13129,"target":13164},{"edgeType":"contains","source":11412,"target":11424},{"edgeType":"contains","source":4738,"target":4803},{"edgeType":"contains","source":7107,"target":7467},{"edgeType":"calls","source":5502,"target":5139},{"edgeType":"calls","source":6226,"target":5950},{"edgeType":"calls","source":9124,"target":9129},{"edgeType":"calls","source":12828,"target":12691},{"edgeType":"contains","source":8109,"target":8117},{"edgeType":"contains","source":6305,"target":6961},{"edgeType":"calls","source":10652,"target":10382},{"edgeType":"contains","source":8438,"target":8487},{"edgeType":"calls","source":271,"target":290},{"edgeType":"imports","source":10292,"target":9876},{"edgeType":"contains","source":9760,"target":9785},{"edgeType":"contains","source":7239,"target":7604},{"edgeType":"contains","source":13129,"target":13163},{"edgeType":"contains","source":4738,"target":4802},{"edgeType":"calls","source":1725,"target":1726},{"edgeType":"contains","source":987,"target":583},{"edgeType":"contains","source":7107,"target":7468},{"edgeType":"contains","source":8109,"target":8116},{"edgeType":"imports","source":15637,"target":15418},{"edgeType":"imports","source":6212,"target":1058},{"edgeType":"contains","source":8042,"target":8079},{"edgeType":"imports","source":1715,"target":987},{"edgeType":"contains","source":9628,"target":9629},{"edgeType":"contains","source":10883,"target":10892},{"edgeType":"contains","source":2223,"target":2405},{"edgeType":"contains","source":1307,"target":1204},{"edgeType":"calls","source":4431,"target":4480},{"edgeType":"contains","source":4323,"target":4956},{"edgeType":"calls","source":11634,"target":11623},{"edgeType":"contains","source":7239,"target":7580},{"edgeType":"contains","source":10678,"target":10905},{"edgeType":"calls","source":1470,"target":1136},{"edgeType":"contains","source":5662,"target":5730},{"edgeType":"calls","source":7009,"target":7012},{"edgeType":"contains","source":9760,"target":9766},{"edgeType":"contains","source":5659,"target":7937},{"edgeType":"contains","source":10949,"target":10961},{"edgeType":"calls","source":11900,"target":11835},{"edgeType":"contains","source":11610,"target":11611},{"edgeType":"imports","source":1167,"target":1063},{"edgeType":"contains","source":4323,"target":4955},{"edgeType":"contains","source":6305,"target":6938},{"edgeType":"calls","source":2001,"target":1587},{"edgeType":"contains","source":7239,"target":7581},{"edgeType":"calls","source":3511,"target":3403},{"edgeType":"contains","source":10678,"target":10906},{"edgeType":"imports","source":12378,"target":2349},{"edgeType":"contains","source":13261,"target":13280},{"edgeType":"contains","source":5659,"target":7938},{"edgeType":"calls","source":8660,"target":8683},{"edgeType":"contains","source":5532,"target":5533},{"edgeType":"contains","source":9562,"target":9563},{"edgeType":"calls","source":7868,"target":7868},{"edgeType":"contains","source":1410,"target":2237},{"edgeType":"calls","source":1553,"target":680},{"edgeType":"contains","source":8042,"target":8059},{"edgeType":"contains","source":10883,"target":10890},{"edgeType":"contains","source":10751,"target":10754},{"edgeType":"contains","source":7957,"target":4352},{"edgeType":"calls","source":6293,"target":5950},{"edgeType":"contains","source":5659,"target":7939},{"edgeType":"contains","source":7239,"target":7582},{"edgeType":"contains","source":9889,"target":9993},{"edgeType":"contains","source":11937,"target":12042},{"edgeType":"contains","source":7107,"target":7446},{"edgeType":"contains","source":12072,"target":12085},{"edgeType":"contains","source":3616,"target":3617},{"edgeType":"contains","source":9760,"target":9764},{"edgeType":"contains","source":5532,"target":5534},{"edgeType":"calls","source":6706,"target":5837},{"edgeType":"contains","source":1410,"target":2238},{"edgeType":"imports","source":5144,"target":2510},{"edgeType":"contains","source":7514,"target":7515},{"edgeType":"contains","source":9628,"target":9630},{"edgeType":"calls","source":12031,"target":12000},{"edgeType":"contains","source":4323,"target":4953},{"edgeType":"contains","source":8042,"target":8058},{"edgeType":"calls","source":15532,"target":15520},{"edgeType":"contains","source":9951,"target":10186},{"edgeType":"calls","source":3438,"target":3550},{"edgeType":"contains","source":5659,"target":7940},{"edgeType":"contains","source":7107,"target":7447},{"edgeType":"contains","source":10678,"target":10904},{"edgeType":"contains","source":12072,"target":12084},{"edgeType":"contains","source":11852,"target":12562},{"edgeType":"contains","source":13261,"target":13278},{"edgeType":"contains","source":5662,"target":5733},{"edgeType":"contains","source":7239,"target":7583},{"edgeType":"contains","source":5662,"target":5725},{"edgeType":"calls","source":16092,"target":2381},{"edgeType":"contains","source":2223,"target":2409},{"edgeType":"contains","source":7107,"target":7440},{"edgeType":"contains","source":10949,"target":10956},{"edgeType":"imports","source":5256,"target":5381},{"edgeType":"calls","source":2384,"target":2396},{"edgeType":"contains","source":10678,"target":10900},{"edgeType":"contains","source":10751,"target":10752},{"edgeType":"calls","source":402,"target":415},{"edgeType":"contains","source":12072,"target":12083},{"edgeType":"contains","source":7239,"target":7576},{"edgeType":"calls","source":10786,"target":10433},{"edgeType":"contains","source":5730,"target":5732},{"edgeType":"calls","source":1227,"target":209},{"edgeType":"contains","source":14912,"target":14957},{"edgeType":"contains","source":8009,"target":620},{"edgeType":"contains","source":6305,"target":6934},{"edgeType":"contains","source":7107,"target":7441},{"edgeType":"calls","source":10973,"target":10979},{"edgeType":"contains","source":2223,"target":2410},{"edgeType":"contains","source":10751,"target":10753},{"edgeType":"contains","source":10678,"target":10901},{"edgeType":"calls","source":4896,"target":4859},{"edgeType":"contains","source":10678,"target":10902},{"edgeType":"contains","source":12072,"target":12082},{"edgeType":"calls","source":8925,"target":8928},{"edgeType":"imports","source":15779,"target":15300},{"edgeType":"contains","source":13335,"target":13096},{"edgeType":"contains","source":8108,"target":8120},{"edgeType":"contains","source":9889,"target":9992},{"edgeType":"calls","source":3051,"target":2861},{"edgeType":"calls","source":8408,"target":8043},{"edgeType":"contains","source":1410,"target":2245},{"edgeType":"imports","source":7902,"target":7921},{"edgeType":"contains","source":13129,"target":13139},{"edgeType":"contains","source":1375,"target":3326},{"edgeType":"contains","source":1410,"target":2241},{"edgeType":"calls","source":461,"target":702},{"edgeType":"contains","source":13261,"target":13275},{"edgeType":"contains","source":379,"target":381},{"edgeType":"contains","source":16630,"target":16668},{"edgeType":"contains","source":12072,"target":12081},{"edgeType":"imports","source":16315,"target":801},{"edgeType":"contains","source":8042,"target":8055},{"edgeType":"calls","source":15235,"target":7810},{"edgeType":"contains","source":7239,"target":7578},{"edgeType":"calls","source":8599,"target":8467},{"edgeType":"imports","source":8158,"target":8438},{"edgeType":"contains","source":15636,"target":15771},{"edgeType":"contains","source":13261,"target":13274},{"edgeType":"contains","source":10353,"target":10404},{"edgeType":"contains","source":4323,"target":4957},{"edgeType":"contains","source":693,"target":1216},{"edgeType":"contains","source":379,"target":380},{"edgeType":"contains","source":7239,"target":7579},{"edgeType":"contains","source":12072,"target":12080},{"edgeType":"contains","source":8042,"target":8054},{"edgeType":"contains","source":1410,"target":2243},{"edgeType":"contains","source":5659,"target":7936},{"edgeType":"calls","source":10445,"target":10433},{"edgeType":"contains","source":13526,"target":13531},{"edgeType":"contains","source":11610,"target":11618},{"edgeType":"contains","source":8042,"target":8065},{"edgeType":"contains","source":11852,"target":12573},{"edgeType":"calls","source":9679,"target":358},{"edgeType":"contains","source":11805,"target":11916},{"edgeType":"contains","source":7239,"target":7588},{"edgeType":"contains","source":5268,"target":5266},{"edgeType":"contains","source":7107,"target":7452},{"edgeType":"contains","source":10937,"target":11340},{"edgeType":"calls","source":10448,"target":10343},{"edgeType":"contains","source":13531,"target":13375},{"edgeType":"calls","source":6246,"target":1058},{"edgeType":"calls","source":10000,"target":976},{"edgeType":"calls","source":7918,"target":2097},{"edgeType":"contains","source":313,"target":314},{"edgeType":"contains","source":4210,"target":4238},{"edgeType":"contains","source":9889,"target":10004},{"edgeType":"contains","source":11937,"target":12051},{"edgeType":"contains","source":5662,"target":5739},{"edgeType":"contains","source":11805,"target":11915},{"edgeType":"contains","source":7239,"target":7589},{"edgeType":"contains","source":1410,"target":2249},{"edgeType":"contains","source":7107,"target":7453},{"edgeType":"contains","source":7239,"target":7591},{"edgeType":"imports","source":14340,"target":2828},{"edgeType":"contains","source":2223,"target":2411},{"edgeType":"contains","source":247,"target":249},{"edgeType":"contains","source":9889,"target":10001},{"edgeType":"calls","source":402,"target":413},{"edgeType":"contains","source":11937,"target":12050},{"edgeType":"imports","source":3147,"target":997},{"edgeType":"calls","source":1526,"target":1508},{"edgeType":"calls","source":13194,"target":3438},{"edgeType":"contains","source":7239,"target":7590},{"edgeType":"contains","source":7107,"target":7454},{"edgeType":"contains","source":10949,"target":10966},{"edgeType":"calls","source":3639,"target":3652},{"edgeType":"contains","source":8042,"target":8066},{"edgeType":"contains","source":7239,"target":7592},{"edgeType":"contains","source":11937,"target":12049},{"edgeType":"contains","source":14694,"target":15363},{"edgeType":"contains","source":247,"target":248},{"edgeType":"contains","source":11805,"target":11913},{"edgeType":"contains","source":1410,"target":2247},{"edgeType":"contains","source":10949,"target":10967},{"edgeType":"contains","source":9562,"target":9565},{"edgeType":"calls","source":3438,"target":3539},{"edgeType":"contains","source":15318,"target":4477},{"edgeType":"contains","source":4101,"target":3394},{"edgeType":"calls","source":9124,"target":9110},{"edgeType":"imports","source":1375,"target":961},{"edgeType":"contains","source":6305,"target":6941},{"edgeType":"calls","source":2337,"target":1731},{"edgeType":"contains","source":5659,"target":7941},{"edgeType":"contains","source":7107,"target":7448},{"edgeType":"contains","source":3616,"target":3631},{"edgeType":"contains","source":11805,"target":11912},{"edgeType":"contains","source":12666,"target":12704},{"edgeType":"contains","source":10678,"target":10909},{"edgeType":"contains","source":4805,"target":4825},{"edgeType":"contains","source":7239,"target":7584},{"edgeType":"contains","source":13129,"target":13149},{"edgeType":"contains","source":9628,"target":9632},{"edgeType":"contains","source":8042,"target":8060},{"edgeType":"calls","source":16875,"target":16171},{"edgeType":"contains","source":247,"target":250},{"edgeType":"calls","source":8925,"target":8936},{"edgeType":"calls","source":10721,"target":10343},{"edgeType":"calls","source":9058,"target":9041},{"edgeType":"contains","source":5659,"target":7942},{"edgeType":"contains","source":7107,"target":7449},{"edgeType":"calls","source":1679,"target":986},{"edgeType":"contains","source":11937,"target":12047},{"edgeType":"contains","source":11805,"target":11911},{"edgeType":"contains","source":1375,"target":3338},{"edgeType":"contains","source":1410,"target":2253},{"edgeType":"calls","source":5344,"target":1533},{"edgeType":"contains","source":12666,"target":12703},{"edgeType":"contains","source":10678,"target":10910},{"edgeType":"contains","source":7239,"target":7585},{"edgeType":"contains","source":11610,"target":11612},{"edgeType":"calls","source":1261,"target":1263},{"edgeType":"calls","source":4054,"target":3468},{"edgeType":"contains","source":7514,"target":7518},{"edgeType":"contains","source":8042,"target":8063},{"edgeType":"imports","source":15636,"target":15500},{"edgeType":"contains","source":1410,"target":2250},{"edgeType":"contains","source":10678,"target":10907},{"edgeType":"contains","source":3616,"target":3629},{"edgeType":"contains","source":5662,"target":5736},{"edgeType":"contains","source":11805,"target":11910},{"edgeType":"contains","source":12666,"target":12702},{"edgeType":"contains","source":5659,"target":7943},{"edgeType":"contains","source":9090,"target":9400},{"edgeType":"contains","source":10883,"target":10895},{"edgeType":"calls","source":540,"target":358},{"edgeType":"calls","source":6088,"target":5950},{"edgeType":"contains","source":7514,"target":7519},{"edgeType":"contains","source":9889,"target":9998},{"edgeType":"contains","source":11937,"target":12045},{"edgeType":"contains","source":12666,"target":12701},{"edgeType":"calls","source":13967,"target":619},{"edgeType":"contains","source":10678,"target":10908},{"edgeType":"contains","source":11805,"target":11909},{"edgeType":"contains","source":7239,"target":7587},{"edgeType":"contains","source":13129,"target":13146},{"edgeType":"contains","source":5082,"target":4691},{"edgeType":"contains","source":9090,"target":9399},{"edgeType":"contains","source":7107,"target":7451},{"edgeType":"contains","source":7239,"target":7564},{"edgeType":"contains","source":11345,"target":11352},{"edgeType":"contains","source":9889,"target":9978},{"edgeType":"imports","source":15642,"target":15308},{"edgeType":"contains","source":7107,"target":7428},{"edgeType":"calls","source":793,"target":999},{"edgeType":"contains","source":5662,"target":5713},{"edgeType":"contains","source":8171,"target":8270},{"edgeType":"contains","source":8108,"target":8109},{"edgeType":"contains","source":12821,"target":14220},{"edgeType":"contains","source":14186,"target":14188},{"edgeType":"contains","source":12204,"target":12207},{"edgeType":"contains","source":7239,"target":7565},{"edgeType":"contains","source":7107,"target":7429},{"edgeType":"contains","source":9889,"target":9979},{"edgeType":"calls","source":14921,"target":615},{"edgeType":"calls","source":2469,"target":1897},{"edgeType":"calls","source":8473,"target":8121},{"edgeType":"contains","source":14186,"target":14189},{"edgeType":"contains","source":12821,"target":14219},{"edgeType":"contains","source":6305,"target":6922},{"edgeType":"calls","source":6996,"target":1058},{"edgeType":"calls","source":6229,"target":5837},{"edgeType":"contains","source":7239,"target":7566},{"edgeType":"calls","source":8925,"target":8910},{"edgeType":"contains","source":11345,"target":11350},{"edgeType":"contains","source":1,"target":14192},{"edgeType":"contains","source":7107,"target":7430},{"edgeType":"imports","source":14112,"target":14116},{"edgeType":"contains","source":5662,"target":5715},{"edgeType":"contains","source":12204,"target":12205},{"edgeType":"contains","source":6667,"target":6271},{"edgeType":"contains","source":8042,"target":8043},{"edgeType":"contains","source":12821,"target":14218},{"edgeType":"calls","source":3442,"target":3443},{"edgeType":"contains","source":11345,"target":11351},{"edgeType":"contains","source":7107,"target":7431},{"edgeType":"calls","source":4839,"target":4530},{"edgeType":"contains","source":9889,"target":9977},{"edgeType":"contains","source":9470,"target":8169},{"edgeType":"contains","source":4070,"target":4323},{"edgeType":"contains","source":4072,"target":4261},{"edgeType":"contains","source":7239,"target":7567},{"edgeType":"imports","source":6305,"target":2440},{"edgeType":"contains","source":4210,"target":4212},{"edgeType":"calls","source":4499,"target":4500},{"edgeType":"contains","source":8171,"target":8271},{"edgeType":"contains","source":5994,"target":5995},{"edgeType":"calls","source":2253,"target":2249},{"edgeType":"calls","source":2302,"target":730},{"edgeType":"contains","source":12821,"target":14217},{"edgeType":"contains","source":6402,"target":6031},{"edgeType":"calls","source":8868,"target":8565},{"edgeType":"calls","source":13046,"target":12235},{"edgeType":"contains","source":11345,"target":11348},{"edgeType":"calls","source":793,"target":995},{"edgeType":"contains","source":11805,"target":11887},{"edgeType":"contains","source":15421,"target":5504},{"edgeType":"contains","source":4072,"target":4269},{"edgeType":"contains","source":14382,"target":14458},{"edgeType":"calls","source":7141,"target":7136},{"edgeType":"calls","source":601,"target":605},{"edgeType":"contains","source":2223,"target":2393},{"edgeType":"contains","source":7107,"target":7423},{"edgeType":"imports","source":6814,"target":5690},{"edgeType":"contains","source":11345,"target":11349},{"edgeType":"contains","source":9297,"target":9298},{"edgeType":"contains","source":8171,"target":8264},{"edgeType":"calls","source":10652,"target":10343},{"edgeType":"calls","source":6501,"target":5836},{"edgeType":"calls","source":2517,"target":2519},{"edgeType":"contains","source":14382,"target":14459},{"edgeType":"contains","source":2223,"target":2394},{"edgeType":"contains","source":7107,"target":7424},{"edgeType":"contains","source":11345,"target":11346},{"edgeType":"calls","source":10314,"target":10251},{"edgeType":"contains","source":11937,"target":12021},{"edgeType":"contains","source":5662,"target":5711},{"edgeType":"contains","source":9951,"target":10164},{"edgeType":"calls","source":6501,"target":5837},{"edgeType":"contains","source":9885,"target":10096},{"edgeType":"calls","source":464,"target":626},{"edgeType":"contains","source":8171,"target":8268},{"edgeType":"contains","source":5002,"target":5033},{"edgeType":"calls","source":6234,"target":5677},{"edgeType":"contains","source":7239,"target":7563},{"edgeType":"contains","source":7107,"target":7427},{"edgeType":"contains","source":7106,"target":7458},{"edgeType":"imports","source":15642,"target":15305},{"edgeType":"contains","source":9885,"target":10097},{"edgeType":"contains","source":8171,"target":8266},{"edgeType":"contains","source":1410,"target":2226},{"edgeType":"calls","source":3438,"target":3563},{"edgeType":"contains","source":5662,"target":5712},{"edgeType":"calls","source":14830,"target":3438},{"edgeType":"contains","source":8303,"target":8403},{"edgeType":"contains","source":7107,"target":7426},{"edgeType":"calls","source":609,"target":358},{"edgeType":"calls","source":2019,"target":1043},{"edgeType":"imports","source":1779,"target":1094},{"edgeType":"contains","source":12821,"target":14213},{"edgeType":"contains","source":6305,"target":6929},{"edgeType":"calls","source":2847,"target":2854},{"edgeType":"contains","source":13261,"target":13273},{"edgeType":"contains","source":1410,"target":2231},{"edgeType":"contains","source":7239,"target":7572},{"edgeType":"contains","source":10678,"target":10896},{"edgeType":"contains","source":11270,"target":11571},{"edgeType":"contains","source":1167,"target":1307},{"edgeType":"contains","source":10883,"target":10884},{"edgeType":"calls","source":1592,"target":1591},{"edgeType":"contains","source":7107,"target":7436},{"edgeType":"contains","source":10949,"target":10952},{"edgeType":"contains","source":12072,"target":12079},{"edgeType":"contains","source":2223,"target":2397},{"edgeType":"contains","source":9889,"target":9987},{"edgeType":"contains","source":13261,"target":13272},{"edgeType":"contains","source":15507,"target":15511},{"edgeType":"contains","source":7239,"target":7573},{"edgeType":"contains","source":10678,"target":10897},{"edgeType":"contains","source":7107,"target":7437},{"edgeType":"calls","source":14541,"target":14517},{"edgeType":"imports","source":14112,"target":14105},{"edgeType":"contains","source":14694,"target":15345},{"edgeType":"calls","source":7525,"target":5807},{"edgeType":"contains","source":5796,"target":5797},{"edgeType":"calls","source":6222,"target":6046},{"edgeType":"calls","source":10974,"target":10936},{"edgeType":"contains","source":12072,"target":12078},{"edgeType":"contains","source":2223,"target":2398},{"edgeType":"contains","source":9889,"target":9988},{"edgeType":"calls","source":2913,"target":2920},{"edgeType":"contains","source":14912,"target":14930},{"edgeType":"contains","source":11812,"target":11680},{"edgeType":"contains","source":7239,"target":7574},{"edgeType":"contains","source":13918,"target":14033},{"edgeType":"contains","source":7107,"target":7438},{"edgeType":"contains","source":5796,"target":5798},{"edgeType":"contains","source":1,"target":12086},{"edgeType":"contains","source":14314,"target":14442},{"edgeType":"calls","source":11634,"target":11613},{"edgeType":"calls","source":2384,"target":2407},{"edgeType":"contains","source":5659,"target":7931},{"edgeType":"contains","source":10353,"target":10399},{"edgeType":"contains","source":2223,"target":2395},{"edgeType":"contains","source":12072,"target":12077},{"edgeType":"contains","source":13261,"target":13270},{"edgeType":"contains","source":14912,"target":14931},{"edgeType":"calls","source":6501,"target":5842},{"edgeType":"contains","source":7107,"target":7439},{"edgeType":"contains","source":10949,"target":10951},{"edgeType":"contains","source":2620,"target":2773},{"edgeType":"contains","source":7239,"target":7575},{"edgeType":"calls","source":9850,"target":9839},{"edgeType":"contains","source":5730,"target":5731},{"edgeType":"contains","source":4235,"target":1331},{"edgeType":"contains","source":5862,"target":5867},{"edgeType":"contains","source":12072,"target":12076},{"edgeType":"contains","source":9885,"target":10106},{"edgeType":"contains","source":14912,"target":14932},{"edgeType":"contains","source":1410,"target":2235},{"edgeType":"calls","source":14287,"target":13940},{"edgeType":"contains","source":5662,"target":5717},{"edgeType":"calls","source":3438,"target":3556},{"edgeType":"contains","source":7239,"target":7568},{"edgeType":"contains","source":5994,"target":5996},{"edgeType":"contains","source":10024,"target":10026},{"edgeType":"calls","source":402,"target":424},{"edgeType":"contains","source":8042,"target":8045},{"edgeType":"contains","source":14382,"target":14450},{"edgeType":"calls","source":7141,"target":7144},{"edgeType":"contains","source":12204,"target":12211},{"edgeType":"calls","source":7115,"target":5836},{"edgeType":"contains","source":7107,"target":7433},{"edgeType":"calls","source":13052,"target":3600},{"edgeType":"contains","source":9889,"target":9983},{"edgeType":"contains","source":2223,"target":2402},{"edgeType":"contains","source":5662,"target":5718},{"edgeType":"contains","source":10937,"target":11321},{"edgeType":"imports","source":2434,"target":1940},{"edgeType":"calls","source":14151,"target":9699},{"edgeType":"contains","source":7239,"target":7569},{"edgeType":"calls","source":12478,"target":6597},{"edgeType":"imports","source":8035,"target":8001},{"edgeType":"contains","source":5935,"target":5712},{"edgeType":"contains","source":12072,"target":12074},{"edgeType":"calls","source":6860,"target":1058},{"edgeType":"calls","source":8876,"target":8325},{"edgeType":"contains","source":14694,"target":15349},{"edgeType":"contains","source":7107,"target":7434},{"edgeType":"calls","source":8660,"target":8681},{"edgeType":"contains","source":13129,"target":13131},{"edgeType":"calls","source":1855,"target":1892},{"edgeType":"calls","source":1526,"target":1521},{"edgeType":"contains","source":7239,"target":7570},{"edgeType":"contains","source":12907,"target":13670},{"edgeType":"contains","source":12821,"target":14222},{"edgeType":"contains","source":12072,"target":12073},{"edgeType":"contains","source":14314,"target":14446},{"edgeType":"calls","source":8793,"target":8787},{"edgeType":"contains","source":9889,"target":9981},{"edgeType":"contains","source":2223,"target":2400},{"edgeType":"contains","source":1410,"target":2234},{"edgeType":"calls","source":2457,"target":2254},{"edgeType":"contains","source":10678,"target":10891},{"edgeType":"contains","source":5662,"target":5720},{"edgeType":"contains","source":5659,"target":7927},{"edgeType":"contains","source":998,"target":209},{"edgeType":"contains","source":7239,"target":7571},{"edgeType":"contains","source":11083,"target":8907},{"edgeType":"contains","source":7107,"target":7435},{"edgeType":"calls","source":9815,"target":358},{"edgeType":"contains","source":5862,"target":5863},{"edgeType":"contains","source":14186,"target":14187},{"edgeType":"contains","source":10024,"target":10025},{"edgeType":"contains","source":8042,"target":8046},{"edgeType":"contains","source":6125,"target":6142},{"edgeType":"contains","source":8171,"target":8253},{"edgeType":"calls","source":2379,"target":540},{"edgeType":"contains","source":6784,"target":6854},{"edgeType":"contains","source":8631,"target":8792},{"edgeType":"contains","source":7107,"target":7411},{"edgeType":"contains","source":7106,"target":7442},{"edgeType":"calls","source":15802,"target":15703},{"edgeType":"calls","source":802,"target":803},{"edgeType":"calls","source":3269,"target":433},{"edgeType":"calls","source":4700,"target":4697},{"edgeType":"contains","source":8303,"target":8388},{"edgeType":"imports","source":10142,"target":10122},{"edgeType":"contains","source":6125,"target":6143},{"edgeType":"calls","source":14515,"target":9088},{"edgeType":"contains","source":7107,"target":7412},{"edgeType":"contains","source":8171,"target":8255},{"edgeType":"contains","source":6125,"target":6144},{"edgeType":"contains","source":4738,"target":4741},{"edgeType":"calls","source":1435,"target":209},{"edgeType":"contains","source":8631,"target":8794},{"edgeType":"calls","source":5690,"target":5716},{"edgeType":"calls","source":1858,"target":1894},{"edgeType":"contains","source":14318,"target":14309},{"edgeType":"imports","source":9090,"target":8907},{"edgeType":"imports","source":15452,"target":4072},{"edgeType":"calls","source":3512,"target":3468},{"edgeType":"contains","source":7107,"target":7413},{"edgeType":"contains","source":16630,"target":16631},{"edgeType":"calls","source":12813,"target":540},{"edgeType":"contains","source":13324,"target":13407},{"edgeType":"contains","source":15240,"target":15324},{"edgeType":"contains","source":6125,"target":6145},{"edgeType":"imports","source":15493,"target":15485},{"edgeType":"imports","source":12988,"target":2236},{"edgeType":"calls","source":2255,"target":2269},{"edgeType":"calls","source":2014,"target":1285},{"edgeType":"contains","source":3147,"target":3324},{"edgeType":"contains","source":7107,"target":7414},{"edgeType":"imports","source":15958,"target":15868},{"edgeType":"calls","source":5424,"target":5504},{"edgeType":"calls","source":680,"target":358},{"edgeType":"calls","source":16339,"target":5394},{"edgeType":"calls","source":12558,"target":12680},{"edgeType":"contains","source":8303,"target":8385},{"edgeType":"contains","source":10353,"target":10372},{"edgeType":"calls","source":7781,"target":2210},{"edgeType":"contains","source":8906,"target":2376},{"edgeType":"calls","source":15554,"target":2246},{"edgeType":"calls","source":8664,"target":8663},{"edgeType":"contains","source":8171,"target":8249},{"edgeType":"contains","source":13326,"target":13343},{"edgeType":"contains","source":9825,"target":9828},{"edgeType":"contains","source":14314,"target":14436},{"edgeType":"calls","source":2255,"target":2267},{"edgeType":"contains","source":7107,"target":7408},{"edgeType":"calls","source":11062,"target":10433},{"edgeType":"calls","source":6286,"target":6263},{"edgeType":"contains","source":1,"target":9948},{"edgeType":"contains","source":9825,"target":9829},{"edgeType":"contains","source":6125,"target":6139},{"edgeType":"contains","source":8171,"target":8248},{"edgeType":"contains","source":8169,"target":8310},{"edgeType":"calls","source":5098,"target":5038},{"edgeType":"contains","source":15240,"target":15327},{"edgeType":"calls","source":14544,"target":14535},{"edgeType":"contains","source":8171,"target":8251},{"edgeType":"contains","source":13324,"target":13403},{"edgeType":"contains","source":7107,"target":7409},{"edgeType":"contains","source":5002,"target":5017},{"edgeType":"contains","source":1,"target":9951},{"edgeType":"calls","source":868,"target":869},{"edgeType":"contains","source":6125,"target":6140},{"edgeType":"imports","source":3194,"target":1410},{"edgeType":"contains","source":9889,"target":9956},{"edgeType":"contains","source":4175,"target":3170},{"edgeType":"contains","source":6125,"target":6141},{"edgeType":"contains","source":13324,"target":13402},{"edgeType":"contains","source":8303,"target":8386},{"edgeType":"contains","source":16164,"target":16281},{"edgeType":"calls","source":3990,"target":3446},{"edgeType":"contains","source":4323,"target":4924},{"edgeType":"contains","source":7107,"target":7410},{"edgeType":"calls","source":6627,"target":6276},{"edgeType":"contains","source":3147,"target":3328},{"edgeType":"contains","source":9297,"target":9283},{"edgeType":"calls","source":12675,"target":601},{"edgeType":"imports","source":14340,"target":8937},{"edgeType":"contains","source":1,"target":12068},{"edgeType":"calls","source":6287,"target":6229},{"edgeType":"contains","source":11805,"target":11883},{"edgeType":"contains","source":6305,"target":6913},{"edgeType":"contains","source":16164,"target":16268},{"edgeType":"calls","source":3048,"target":3048},{"edgeType":"contains","source":7107,"target":7419},{"edgeType":"contains","source":13919,"target":13984},{"edgeType":"contains","source":13918,"target":14015},{"edgeType":"calls","source":10383,"target":10343},{"edgeType":"calls","source":13800,"target":12235},{"edgeType":"contains","source":14513,"target":14597},{"edgeType":"imports","source":16845,"target":3162},{"edgeType":"calls","source":15507,"target":7944},{"edgeType":"calls","source":2388,"target":2368},{"edgeType":"contains","source":9885,"target":10095},{"edgeType":"contains","source":8171,"target":8260},{"edgeType":"contains","source":14912,"target":14913},{"edgeType":"contains","source":5730,"target":5712},{"edgeType":"imports","source":5402,"target":612},{"edgeType":"contains","source":7107,"target":7420},{"edgeType":"calls","source":9713,"target":3633},{"edgeType":"contains","source":1,"target":12070},{"edgeType":"contains","source":9951,"target":10160},{"edgeType":"contains","source":16164,"target":16270},{"edgeType":"calls","source":10422,"target":680},{"edgeType":"contains","source":7107,"target":7421},{"edgeType":"calls","source":1273,"target":994},{"edgeType":"contains","source":14314,"target":14426},{"edgeType":"calls","source":4765,"target":4784},{"edgeType":"contains","source":4323,"target":4928},{"edgeType":"calls","source":6287,"target":6226},{"edgeType":"contains","source":8171,"target":8262},{"edgeType":"contains","source":8040,"target":8095},{"edgeType":"contains","source":15253,"target":4344},{"edgeType":"contains","source":5002,"target":5020},{"edgeType":"contains","source":16164,"target":16269},{"edgeType":"calls","source":1612,"target":1054},{"edgeType":"contains","source":7107,"target":7422},{"edgeType":"contains","source":3219,"target":3220},{"edgeType":"contains","source":6125,"target":6146},{"edgeType":"contains","source":8171,"target":8257},{"edgeType":"contains","source":6305,"target":6908},{"edgeType":"calls","source":9126,"target":9147},{"edgeType":"calls","source":4765,"target":4783},{"edgeType":"contains","source":1,"target":12072},{"edgeType":"calls","source":16869,"target":16455},{"edgeType":"imports","source":11788,"target":11945},{"edgeType":"calls","source":2255,"target":2258},{"edgeType":"contains","source":7107,"target":7415},{"edgeType":"contains","source":10763,"target":6127},{"edgeType":"contains","source":14425,"target":8872},{"edgeType":"contains","source":5465,"target":5466},{"edgeType":"calls","source":2600,"target":2134},{"edgeType":"imports","source":10142,"target":10118},{"edgeType":"contains","source":6125,"target":6147},{"edgeType":"calls","source":12368,"target":12237},{"edgeType":"calls","source":6089,"target":6020},{"edgeType":"contains","source":8631,"target":8795},{"edgeType":"contains","source":2223,"target":2386},{"edgeType":"contains","source":7107,"target":7416},{"edgeType":"contains","source":10763,"target":6128},{"edgeType":"calls","source":13223,"target":13214},{"edgeType":"imports","source":8676,"target":600},{"edgeType":"contains","source":16164,"target":16271},{"edgeType":"calls","source":6961,"target":2271},{"edgeType":"calls","source":14417,"target":14252},{"edgeType":"contains","source":8303,"target":8395},{"edgeType":"calls","source":6293,"target":6037},{"edgeType":"contains","source":14314,"target":14429},{"edgeType":"contains","source":8040,"target":8092},{"edgeType":"contains","source":4070,"target":4320},{"edgeType":"contains","source":10426,"target":10229},{"edgeType":"calls","source":2367,"target":898},{"edgeType":"calls","source":10585,"target":10427},{"edgeType":"contains","source":8438,"target":8439},{"edgeType":"contains","source":16164,"target":16274},{"edgeType":"calls","source":16065,"target":16012},{"edgeType":"contains","source":5267,"target":5266},{"edgeType":"contains","source":3285,"target":3287},{"edgeType":"calls","source":14834,"target":3438},{"edgeType":"contains","source":8303,"target":8394},{"edgeType":"imports","source":10078,"target":9986},{"edgeType":"contains","source":16164,"target":16273},{"edgeType":"contains","source":7107,"target":7418},{"edgeType":"contains","source":15169,"target":610},{"edgeType":"contains","source":14694,"target":15335},{"edgeType":"contains","source":7239,"target":7531},{"edgeType":"imports","source":10426,"target":9759},{"edgeType":"contains","source":7107,"target":7395},{"edgeType":"calls","source":8333,"target":8332},{"edgeType":"calls","source":15209,"target":2358},{"edgeType":"contains","source":4143,"target":4145},{"edgeType":"contains","source":8303,"target":8373},{"edgeType":"contains","source":16497,"target":16507},{"edgeType":"contains","source":4072,"target":4232},{"edgeType":"contains","source":10937,"target":11282},{"edgeType":"calls","source":5109,"target":4719},{"edgeType":"contains","source":15968,"target":15992},{"edgeType":"contains","source":7107,"target":7394},{"edgeType":"contains","source":10551,"target":10564},{"edgeType":"contains","source":5200,"target":5202},{"edgeType":"contains","source":7239,"target":7532},{"edgeType":"contains","source":9889,"target":9946},{"edgeType":"contains","source":7107,"target":7396},{"edgeType":"contains","source":15642,"target":15529},{"edgeType":"imports","source":5256,"target":5130},{"edgeType":"calls","source":11240,"target":11237},{"edgeType":"calls","source":1858,"target":1907},{"edgeType":"imports","source":7779,"target":7254},{"edgeType":"calls","source":3650,"target":3438},{"edgeType":"contains","source":14314,"target":14416},{"edgeType":"contains","source":14318,"target":14292},{"edgeType":"calls","source":6931,"target":1058},{"edgeType":"calls","source":6089,"target":6048},{"edgeType":"contains","source":7107,"target":7397},{"edgeType":"contains","source":11852,"target":12513},{"edgeType":"contains","source":10658,"target":903},{"edgeType":"calls","source":1632,"target":460},{"edgeType":"contains","source":16497,"target":16509},{"edgeType":"calls","source":6946,"target":6936},{"edgeType":"contains","source":10551,"target":10562},{"edgeType":"contains","source":10937,"target":11280},{"edgeType":"contains","source":14314,"target":14417},{"edgeType":"imports","source":15779,"target":2375},{"edgeType":"contains","source":7107,"target":7398},{"edgeType":"imports","source":10426,"target":9756},{"edgeType":"calls","source":1265,"target":1266},{"edgeType":"contains","source":15251,"target":2283},{"edgeType":"calls","source":14016,"target":13968},{"edgeType":"contains","source":8303,"target":8374},{"edgeType":"imports","source":10078,"target":9974},{"edgeType":"contains","source":16497,"target":16508},{"edgeType":"calls","source":7017,"target":6850},{"edgeType":"contains","source":3479,"target":3585},{"edgeType":"contains","source":6305,"target":6891},{"edgeType":"contains","source":12533,"target":12542},{"edgeType":"calls","source":3445,"target":3446},{"edgeType":"contains","source":13457,"target":13494},{"edgeType":"imports","source":15779,"target":2369},{"edgeType":"contains","source":9362,"target":9365},{"edgeType":"contains","source":15251,"target":2284},{"edgeType":"contains","source":8171,"target":8232},{"edgeType":"contains","source":5662,"target":5676},{"edgeType":"contains","source":13556,"target":4082},{"edgeType":"contains","source":10551,"target":10560},{"edgeType":"contains","source":12533,"target":12541},{"edgeType":"calls","source":4059,"target":3438},{"edgeType":"contains","source":13529,"target":13375},{"edgeType":"contains","source":7239,"target":7528},{"edgeType":"contains","source":9362,"target":9364},{"edgeType":"contains","source":14514,"target":14562},{"edgeType":"contains","source":3479,"target":3591},{"edgeType":"contains","source":12533,"target":12540},{"edgeType":"contains","source":14314,"target":14420},{"edgeType":"contains","source":10551,"target":10561},{"edgeType":"contains","source":7107,"target":7391},{"edgeType":"contains","source":10937,"target":11279},{"edgeType":"contains","source":12928,"target":12979},{"edgeType":"contains","source":16167,"target":16170},{"edgeType":"contains","source":13457,"target":13492},{"edgeType":"contains","source":7239,"target":7529},{"edgeType":"contains","source":14513,"target":14594},{"edgeType":"contains","source":1167,"target":1272},{"edgeType":"contains","source":9889,"target":9939},{"edgeType":"contains","source":3479,"target":3590},{"edgeType":"contains","source":12533,"target":12539},{"edgeType":"contains","source":10353,"target":10354},{"edgeType":"contains","source":10485,"target":10490},{"edgeType":"contains","source":4143,"target":4147},{"edgeType":"contains","source":2620,"target":2735},{"edgeType":"contains","source":7107,"target":7392},{"edgeType":"contains","source":16164,"target":16266},{"edgeType":"contains","source":12928,"target":12978},{"edgeType":"contains","source":693,"target":1167},{"edgeType":"calls","source":2124,"target":2114},{"edgeType":"calls","source":4271,"target":1092},{"edgeType":"contains","source":13919,"target":13982},{"edgeType":"calls","source":6634,"target":6042},{"edgeType":"contains","source":13457,"target":13491},{"edgeType":"contains","source":14513,"target":14595},{"edgeType":"calls","source":1529,"target":1534},{"edgeType":"contains","source":1167,"target":1271},{"edgeType":"contains","source":8171,"target":8233},{"edgeType":"imports","source":8259,"target":2946},{"edgeType":"calls","source":8140,"target":7980},{"edgeType":"contains","source":9889,"target":9940},{"edgeType":"contains","source":12533,"target":12538},{"edgeType":"calls","source":7013,"target":6978},{"edgeType":"contains","source":1410,"target":2193},{"edgeType":"contains","source":10485,"target":10491},{"edgeType":"contains","source":10353,"target":10355},{"edgeType":"contains","source":7107,"target":7393},{"edgeType":"imports","source":7711,"target":7250},{"edgeType":"contains","source":12928,"target":12977},{"edgeType":"contains","source":13919,"target":13983},{"edgeType":"contains","source":1,"target":7823},{"edgeType":"contains","source":11805,"target":11866},{"edgeType":"contains","source":5200,"target":5211},{"edgeType":"imports","source":15335,"target":1330},{"edgeType":"contains","source":7107,"target":7403},{"edgeType":"calls","source":16452,"target":16685},{"edgeType":"calls","source":1858,"target":1900},{"edgeType":"calls","source":4742,"target":3403},{"edgeType":"calls","source":9193,"target":9164},{"edgeType":"contains","source":14694,"target":15311},{"edgeType":"contains","source":16497,"target":16499},{"edgeType":"contains","source":6125,"target":6134},{"edgeType":"contains","source":8171,"target":8245},{"edgeType":"contains","source":8169,"target":8307},{"edgeType":"contains","source":9889,"target":9954},{"edgeType":"calls","source":9061,"target":9028},{"edgeType":"calls","source":6286,"target":6276},{"edgeType":"calls","source":4842,"target":4530},{"edgeType":"contains","source":14314,"target":14407},{"edgeType":"contains","source":5662,"target":5689},{"edgeType":"contains","source":3479,"target":3595},{"edgeType":"contains","source":9362,"target":9376},{"edgeType":"contains","source":13919,"target":13968},{"edgeType":"contains","source":7107,"target":7404},{"edgeType":"imports","source":15251,"target":8162},{"edgeType":"calls","source":1854,"target":2023},{"edgeType":"calls","source":1858,"target":1899},{"edgeType":"contains","source":12821,"target":14194},{"edgeType":"contains","source":8937,"target":1410},{"edgeType":"calls","source":4043,"target":3931},{"edgeType":"contains","source":8303,"target":8380},{"edgeType":"contains","source":14694,"target":15312},{"edgeType":"contains","source":16497,"target":16498},{"edgeType":"contains","source":14647,"target":14655},{"edgeType":"contains","source":8171,"target":8244},{"edgeType":"contains","source":8169,"target":8306},{"edgeType":"contains","source":5002,"target":5005},{"edgeType":"calls","source":868,"target":881},{"edgeType":"contains","source":14314,"target":14408},{"edgeType":"contains","source":14316,"target":14346},{"edgeType":"contains","source":7107,"target":7405},{"edgeType":"contains","source":3479,"target":3594},{"edgeType":"calls","source":10151,"target":609},{"edgeType":"contains","source":14583,"target":14526},{"edgeType":"calls","source":15138,"target":15140},{"edgeType":"contains","source":8169,"target":8309},{"edgeType":"contains","source":4143,"target":4151},{"edgeType":"contains","source":16497,"target":16501},{"edgeType":"contains","source":14647,"target":14656},{"edgeType":"calls","source":6560,"target":6226},{"edgeType":"imports","source":9432,"target":2510},{"edgeType":"calls","source":9259,"target":9233},{"edgeType":"contains","source":12533,"target":12550},{"edgeType":"calls","source":6627,"target":6263},{"edgeType":"contains","source":5199,"target":5239},{"edgeType":"contains","source":7107,"target":7406},{"edgeType":"contains","source":1410,"target":2197},{"edgeType":"contains","source":14513,"target":14583},{"edgeType":"calls","source":6225,"target":6050},{"edgeType":"contains","source":16497,"target":16500},{"edgeType":"contains","source":9889,"target":9953},{"edgeType":"contains","source":8169,"target":8308},{"edgeType":"calls","source":7012,"target":7013},{"edgeType":"contains","source":14647,"target":14657},{"edgeType":"calls","source":2385,"target":358},{"edgeType":"contains","source":11852,"target":12519},{"edgeType":"calls","source":5113,"target":2468},{"edgeType":"calls","source":3456,"target":3097},{"edgeType":"contains","source":4738,"target":4739},{"edgeType":"contains","source":11003,"target":9240},{"edgeType":"contains","source":14513,"target":14584},{"edgeType":"contains","source":5287,"target":4632},{"edgeType":"contains","source":12821,"target":14191},{"edgeType":"calls","source":14279,"target":14287},{"edgeType":"calls","source":1627,"target":600},{"edgeType":"contains","source":9889,"target":9950},{"edgeType":"contains","source":7107,"target":7400},{"edgeType":"contains","source":9951,"target":10142},{"edgeType":"contains","source":1167,"target":1277},{"edgeType":"calls","source":3456,"target":3098},{"edgeType":"contains","source":10937,"target":11287},{"edgeType":"contains","source":12821,"target":14190},{"edgeType":"contains","source":12533,"target":12548},{"edgeType":"contains","source":16497,"target":16502},{"edgeType":"contains","source":4143,"target":4156},{"edgeType":"contains","source":7107,"target":7401},{"edgeType":"contains","source":5002,"target":5009},{"edgeType":"calls","source":6560,"target":6229},{"edgeType":"calls","source":3195,"target":615},{"edgeType":"contains","source":9889,"target":9947},{"edgeType":"contains","source":9885,"target":10071},{"edgeType":"imports","source":2622,"target":2222},{"edgeType":"contains","source":5068,"target":5077},{"edgeType":"contains","source":13326,"target":13333},{"edgeType":"contains","source":6125,"target":6132},{"edgeType":"calls","source":7407,"target":7455},{"edgeType":"contains","source":8303,"target":8379},{"edgeType":"calls","source":13223,"target":13196},{"edgeType":"calls","source":14998,"target":2566},{"edgeType":"contains","source":5927,"target":5928},{"edgeType":"calls","source":9060,"target":9065},{"edgeType":"calls","source":271,"target":358},{"edgeType":"imports","source":4228,"target":3170},{"edgeType":"contains","source":8169,"target":8305},{"edgeType":"contains","source":4323,"target":4916},{"edgeType":"contains","source":7107,"target":7402},{"edgeType":"contains","source":14694,"target":15318},{"edgeType":"imports","source":2622,"target":2221},{"edgeType":"imports","source":1055,"target":61},{"edgeType":"contains","source":5068,"target":5076},{"edgeType":"contains","source":5200,"target":5212},{"edgeType":"contains","source":10937,"target":11285},{"edgeType":"imports","source":15095,"target":15109},{"edgeType":"imports","source":2622,"target":2220},{"edgeType":"contains","source":15968,"target":15991},{"edgeType":"contains","source":5927,"target":5929},{"edgeType":"contains","source":8631,"target":8780},{"edgeType":"contains","source":14186,"target":14154},{"edgeType":"calls","source":10713,"target":10672},{"edgeType":"contains","source":1,"target":7828},{"edgeType":"contains","source":8303,"target":8378},{"edgeType":"contains","source":8303,"target":8356},{"edgeType":"contains","source":12928,"target":12968},{"edgeType":"contains","source":8169,"target":8282},{"edgeType":"contains","source":8168,"target":8313},{"edgeType":"contains","source":7107,"target":7378},{"edgeType":"contains","source":14314,"target":14398},{"edgeType":"contains","source":14316,"target":14336},{"edgeType":"contains","source":14382,"target":14404},{"edgeType":"contains","source":9466,"target":1900},{"edgeType":"contains","source":7239,"target":7514},{"edgeType":"calls","source":3269,"target":400},{"edgeType":"calls","source":14543,"target":14530},{"edgeType":"contains","source":8303,"target":8355},{"edgeType":"calls","source":4611,"target":1079},{"edgeType":"contains","source":8169,"target":8281},{"edgeType":"contains","source":8171,"target":8219},{"edgeType":"calls","source":16355,"target":642},{"edgeType":"contains","source":1406,"target":184},{"edgeType":"contains","source":12908,"target":13587},{"edgeType":"calls","source":6026,"target":5838},{"edgeType":"calls","source":11939,"target":2236},{"edgeType":"contains","source":14314,"target":14399},{"edgeType":"contains","source":14316,"target":14337},{"edgeType":"calls","source":3774,"target":3773},{"edgeType":"contains","source":1169,"target":1186},{"edgeType":"contains","source":12095,"target":7079},{"edgeType":"contains","source":16034,"target":16044},{"edgeType":"contains","source":7107,"target":7379},{"edgeType":"contains","source":11609,"target":11575},{"edgeType":"calls","source":14929,"target":4677},{"edgeType":"contains","source":8303,"target":8358},{"edgeType":"calls","source":15996,"target":16000},{"edgeType":"contains","source":8169,"target":8284},{"edgeType":"calls","source":4435,"target":4420},{"edgeType":"contains","source":6125,"target":6111},{"edgeType":"contains","source":11184,"target":1493},{"edgeType":"contains","source":12908,"target":13586},{"edgeType":"contains","source":12928,"target":12966},{"edgeType":"calls","source":6026,"target":5837},{"edgeType":"contains","source":15902,"target":15910},{"edgeType":"contains","source":15968,"target":15978},{"edgeType":"contains","source":575,"target":577},{"edgeType":"contains","source":10937,"target":11264},{"edgeType":"calls","source":11570,"target":11557},{"edgeType":"contains","source":14316,"target":14338},{"edgeType":"calls","source":14948,"target":14663},{"edgeType":"contains","source":16034,"target":16047},{"edgeType":"contains","source":4583,"target":3170},{"edgeType":"contains","source":7107,"target":7380},{"edgeType":"contains","source":13129,"target":13076},{"edgeType":"calls","source":6367,"target":5842},{"edgeType":"contains","source":8303,"target":8357},{"edgeType":"contains","source":8169,"target":8283},{"edgeType":"contains","source":8168,"target":8314},{"edgeType":"calls","source":7144,"target":7124},{"edgeType":"contains","source":575,"target":576},{"edgeType":"calls","source":6026,"target":5836},{"edgeType":"contains","source":14583,"target":14518},{"edgeType":"contains","source":12908,"target":13585},{"edgeType":"contains","source":15968,"target":15979},{"edgeType":"calls","source":16326,"target":16341},{"edgeType":"contains","source":7107,"target":7381},{"edgeType":"calls","source":16178,"target":12473},{"edgeType":"imports","source":15821,"target":7459},{"edgeType":"calls","source":15707,"target":5926},{"edgeType":"contains","source":6784,"target":6817},{"edgeType":"contains","source":8965,"target":8971},{"edgeType":"contains","source":575,"target":579},{"edgeType":"contains","source":7107,"target":7374},{"edgeType":"contains","source":10815,"target":10816},{"edgeType":"imports","source":15636,"target":15308},{"edgeType":"contains","source":13457,"target":13477},{"edgeType":"calls","source":2849,"target":2846},{"edgeType":"calls","source":11574,"target":11440},{"edgeType":"contains","source":8169,"target":8278},{"edgeType":"contains","source":5860,"target":5864},{"edgeType":"calls","source":14213,"target":14194},{"edgeType":"calls","source":2470,"target":1911},{"edgeType":"imports","source":14172,"target":14181},{"edgeType":"contains","source":15636,"target":15703},{"edgeType":"imports","source":7830,"target":7840},{"edgeType":"contains","source":6784,"target":6818},{"edgeType":"contains","source":14513,"target":14576},{"edgeType":"contains","source":575,"target":578},{"edgeType":"contains","source":10944,"target":11046},{"edgeType":"contains","source":8833,"target":8834},{"edgeType":"contains","source":8965,"target":8970},{"edgeType":"contains","source":13918,"target":13995},{"edgeType":"calls","source":15608,"target":540},{"edgeType":"calls","source":5491,"target":5506},{"edgeType":"calls","source":6747,"target":6749},{"edgeType":"contains","source":14513,"target":14577},{"edgeType":"contains","source":8158,"target":8618},{"edgeType":"contains","source":8303,"target":8354},{"edgeType":"contains","source":10881,"target":10882},{"edgeType":"calls","source":2254,"target":2262},{"edgeType":"contains","source":575,"target":581},{"edgeType":"imports","source":15581,"target":4330},{"edgeType":"contains","source":13457,"target":13475},{"edgeType":"contains","source":9220,"target":9524},{"edgeType":"contains","source":14583,"target":14522},{"edgeType":"calls","source":6812,"target":6849},{"edgeType":"contains","source":8169,"target":8280},{"edgeType":"contains","source":8158,"target":8621},{"edgeType":"contains","source":15240,"target":15295},{"edgeType":"calls","source":1076,"target":730},{"edgeType":"contains","source":7107,"target":7377},{"edgeType":"imports","source":11906,"target":10438},{"edgeType":"contains","source":575,"target":580},{"edgeType":"contains","source":8965,"target":8972},{"edgeType":"calls","source":2074,"target":1502},{"edgeType":"calls","source":2224,"target":1079},{"edgeType":"contains","source":7239,"target":7513},{"edgeType":"contains","source":9638,"target":9249},{"edgeType":"contains","source":5865,"target":5712},{"edgeType":"contains","source":9951,"target":10116},{"edgeType":"calls","source":1135,"target":1014},{"edgeType":"contains","source":14513,"target":14563},{"edgeType":"contains","source":13457,"target":13490},{"edgeType":"contains","source":9889,"target":9937},{"edgeType":"imports","source":15779,"target":15099},{"edgeType":"contains","source":8171,"target":8228},{"edgeType":"contains","source":12533,"target":12537},{"edgeType":"contains","source":10484,"target":10519},{"edgeType":"contains","source":7107,"target":7386},{"edgeType":"imports","source":15649,"target":4330},{"edgeType":"calls","source":6565,"target":6052},{"edgeType":"contains","source":5662,"target":5672},{"edgeType":"calls","source":11574,"target":11444},{"edgeType":"contains","source":1410,"target":2182},{"edgeType":"contains","source":15902,"target":15899},{"edgeType":"calls","source":4639,"target":4431},{"edgeType":"contains","source":9560,"target":9564},{"edgeType":"contains","source":16561,"target":16611},{"edgeType":"contains","source":9951,"target":10130},{"edgeType":"calls","source":8928,"target":8905},{"edgeType":"contains","source":9889,"target":9938},{"edgeType":"imports","source":10291,"target":9756},{"edgeType":"contains","source":575,"target":582},{"edgeType":"calls","source":2387,"target":2366},{"edgeType":"calls","source":13117,"target":12234},{"edgeType":"calls","source":2179,"target":358},{"edgeType":"calls","source":2987,"target":679},{"edgeType":"contains","source":10485,"target":10489},{"edgeType":"contains","source":12533,"target":12536},{"edgeType":"contains","source":1406,"target":193},{"edgeType":"contains","source":7107,"target":7387},{"edgeType":"contains","source":9466,"target":1907},{"edgeType":"calls","source":15606,"target":615},{"edgeType":"imports","source":1779,"target":925},{"edgeType":"imports","source":14470,"target":2828},{"edgeType":"contains","source":8171,"target":8230},{"edgeType":"contains","source":10485,"target":10486},{"edgeType":"contains","source":10484,"target":10517},{"edgeType":"contains","source":10617,"target":10622},{"edgeType":"calls","source":10720,"target":10433},{"edgeType":"contains","source":12533,"target":12535},{"edgeType":"imports","source":15581,"target":4326},{"edgeType":"contains","source":7107,"target":7388},{"edgeType":"contains","source":575,"target":584},{"edgeType":"contains","source":15902,"target":15903},{"edgeType":"contains","source":12908,"target":13593},{"edgeType":"imports","source":9885,"target":3315},{"edgeType":"calls","source":271,"target":311},{"edgeType":"contains","source":2223,"target":2346},{"edgeType":"calls","source":9006,"target":2261},{"edgeType":"contains","source":8171,"target":8229},{"edgeType":"calls","source":2464,"target":2091},{"edgeType":"contains","source":10485,"target":10487},{"edgeType":"contains","source":10484,"target":10518},{"edgeType":"contains","source":9889,"target":9936},{"edgeType":"contains","source":9885,"target":10060},{"edgeType":"imports","source":9362,"target":8957},{"edgeType":"calls","source":8138,"target":8029},{"edgeType":"contains","source":7107,"target":7389},{"edgeType":"contains","source":1410,"target":2181},{"edgeType":"contains","source":9560,"target":9561},{"edgeType":"contains","source":12908,"target":13592},{"edgeType":"contains","source":15902,"target":15904},{"edgeType":"calls","source":1131,"target":1129},{"edgeType":"contains","source":8042,"target":7995},{"edgeType":"calls","source":8913,"target":3033},{"edgeType":"contains","source":9220,"target":9530},{"edgeType":"calls","source":2254,"target":2256},{"edgeType":"contains","source":10551,"target":10552},{"edgeType":"contains","source":1410,"target":2186},{"edgeType":"contains","source":7107,"target":7382},{"edgeType":"calls","source":3443,"target":3450},{"edgeType":"imports","source":15649,"target":4326},{"edgeType":"imports","source":15763,"target":15590},{"edgeType":"contains","source":8169,"target":8285},{"edgeType":"contains","source":12908,"target":13591},{"edgeType":"contains","source":14314,"target":14395},{"edgeType":"contains","source":10551,"target":10553},{"edgeType":"calls","source":2915,"target":2907},{"edgeType":"contains","source":7107,"target":7383},{"edgeType":"calls","source":4399,"target":3411},{"edgeType":"calls","source":2354,"target":1271},{"edgeType":"contains","source":10484,"target":10516},{"edgeType":"contains","source":10617,"target":10621},{"edgeType":"contains","source":11805,"target":11845},{"edgeType":"contains","source":15439,"target":15459},{"edgeType":"contains","source":8169,"target":8288},{"edgeType":"contains","source":8171,"target":8226},{"edgeType":"calls","source":1263,"target":1267},{"edgeType":"imports","source":16164,"target":3162},{"edgeType":"contains","source":12908,"target":13590},{"edgeType":"contains","source":15058,"target":12473},{"edgeType":"imports","source":10291,"target":9759},{"edgeType":"calls","source":14543,"target":14541},{"edgeType":"contains","source":10617,"target":10618},{"edgeType":"contains","source":7107,"target":7384},{"edgeType":"imports","source":15712,"target":2375},{"edgeType":"contains","source":16034,"target":16043},{"edgeType":"contains","source":1410,"target":2184},{"edgeType":"calls","source":11574,"target":11446},{"edgeType":"contains","source":5266,"target":5264},{"edgeType":"calls","source":11708,"target":11521},{"edgeType":"contains","source":3284,"target":3285},{"edgeType":"calls","source":1342,"target":931},{"edgeType":"contains","source":15902,"target":15907},{"edgeType":"contains","source":12908,"target":13589},{"edgeType":"contains","source":12928,"target":12969},{"edgeType":"calls","source":1084,"target":473},{"edgeType":"imports","source":15958,"target":15889},{"edgeType":"contains","source":7107,"target":7385},{"edgeType":"contains","source":9220,"target":9531},{"edgeType":"imports","source":15649,"target":4327},{"edgeType":"contains","source":14777,"target":14827},{"edgeType":"imports","source":4975,"target":3303},{"edgeType":"contains","source":14114,"target":14239},{"edgeType":"contains","source":9955,"target":9980},{"edgeType":"contains","source":11936,"target":11992},{"edgeType":"calls","source":6163,"target":5837},{"edgeType":"contains","source":7247,"target":7250},{"edgeType":"calls","source":13048,"target":12235},{"edgeType":"contains","source":1,"target":7782},{"edgeType":"calls","source":13059,"target":3438},{"edgeType":"contains","source":5688,"target":4841},{"edgeType":"contains","source":1956,"target":2143},{"edgeType":"imports","source":9362,"target":8950},{"edgeType":"calls","source":8464,"target":8467},{"edgeType":"calls","source":10128,"target":1278},{"edgeType":"calls","source":6354,"target":6226},{"edgeType":"contains","source":9091,"target":9280},{"edgeType":"contains","source":4323,"target":4874},{"edgeType":"contains","source":8158,"target":8607},{"edgeType":"contains","source":7107,"target":7361},{"edgeType":"calls","source":11460,"target":10725},{"edgeType":"calls","source":3579,"target":3491},{"edgeType":"calls","source":15142,"target":14973},{"edgeType":"contains","source":16561,"target":16604},{"edgeType":"imports","source":1779,"target":903},{"edgeType":"contains","source":8676,"target":9461},{"edgeType":"contains","source":1169,"target":1170},{"edgeType":"contains","source":6586,"target":6601},{"edgeType":"contains","source":7107,"target":7363},{"edgeType":"calls","source":14948,"target":14645},{"edgeType":"contains","source":1956,"target":2144},{"edgeType":"calls","source":5039,"target":4740},{"edgeType":"calls","source":10654,"target":10343},{"edgeType":"contains","source":11756,"target":660},{"edgeType":"calls","source":4899,"target":4852},{"edgeType":"calls","source":9125,"target":9116},{"edgeType":"contains","source":9091,"target":9279},{"edgeType":"contains","source":4273,"target":4309},{"edgeType":"contains","source":8158,"target":8606},{"edgeType":"contains","source":7107,"target":7362},{"edgeType":"contains","source":2622,"target":2639},{"edgeType":"contains","source":12859,"target":12975},{"edgeType":"calls","source":15073,"target":14999},{"edgeType":"contains","source":16561,"target":16603},{"edgeType":"contains","source":3217,"target":3218},{"edgeType":"contains","source":14114,"target":14241},{"edgeType":"contains","source":7107,"target":7364},{"edgeType":"contains","source":1,"target":7784},{"edgeType":"calls","source":405,"target":411},{"edgeType":"contains","source":11852,"target":12480},{"edgeType":"contains","source":15636,"target":15683},{"edgeType":"contains","source":4273,"target":4308},{"edgeType":"imports","source":11756,"target":271},{"edgeType":"contains","source":13869,"target":13375},{"edgeType":"contains","source":8158,"target":8609},{"edgeType":"calls","source":2519,"target":2524},{"edgeType":"contains","source":16561,"target":16606},{"edgeType":"contains","source":10484,"target":10492},{"edgeType":"contains","source":14114,"target":14242},{"edgeType":"contains","source":16164,"target":16229},{"edgeType":"calls","source":8134,"target":8129},{"edgeType":"contains","source":1169,"target":1172},{"edgeType":"contains","source":1167,"target":1234},{"edgeType":"contains","source":11756,"target":658},{"edgeType":"contains","source":7107,"target":7365},{"edgeType":"calls","source":6697,"target":6166},{"edgeType":"contains","source":1956,"target":2142},{"edgeType":"calls","source":10650,"target":6238},{"edgeType":"calls","source":6354,"target":6229},{"edgeType":"imports","source":8030,"target":7960},{"edgeType":"contains","source":4273,"target":4307},{"edgeType":"contains","source":1448,"target":978},{"edgeType":"contains","source":6305,"target":6858},{"edgeType":"contains","source":16561,"target":16605},{"edgeType":"contains","source":6784,"target":6807},{"edgeType":"contains","source":8676,"target":9462},{"edgeType":"contains","source":5067,"target":5069},{"edgeType":"contains","source":8158,"target":8602},{"edgeType":"imports","source":10142,"target":10144},{"edgeType":"contains","source":1956,"target":2147},{"edgeType":"contains","source":11852,"target":12478},{"edgeType":"contains","source":15109,"target":15110},{"edgeType":"contains","source":9889,"target":9908},{"edgeType":"calls","source":14212,"target":14209},{"edgeType":"contains","source":9091,"target":9276},{"edgeType":"contains","source":3352,"target":3268},{"edgeType":"calls","source":6945,"target":6936},{"edgeType":"contains","source":16561,"target":16608},{"edgeType":"contains","source":10616,"target":10626},{"edgeType":"imports","source":15493,"target":15496},{"edgeType":"contains","source":1169,"target":1174},{"edgeType":"calls","source":2600,"target":2126},{"edgeType":"contains","source":9889,"target":9909},{"edgeType":"imports","source":15470,"target":1410},{"edgeType":"contains","source":8303,"target":8334},{"edgeType":"contains","source":15109,"target":15111},{"edgeType":"imports","source":1779,"target":898},{"edgeType":"contains","source":16561,"target":16607},{"edgeType":"contains","source":10616,"target":10627},{"edgeType":"imports","source":15493,"target":15495},{"edgeType":"contains","source":12926,"target":13008},{"edgeType":"contains","source":7107,"target":7358},{"edgeType":"calls","source":10848,"target":10672},{"edgeType":"contains","source":6586,"target":6598},{"edgeType":"contains","source":16561,"target":16610},{"edgeType":"contains","source":1169,"target":1177},{"edgeType":"contains","source":8158,"target":8604},{"edgeType":"contains","source":1956,"target":2145},{"edgeType":"contains","source":14777,"target":14833},{"edgeType":"calls","source":8134,"target":8132},{"edgeType":"contains","source":9889,"target":9906},{"edgeType":"contains","source":15109,"target":15112},{"edgeType":"contains","source":5658,"target":5769},{"edgeType":"contains","source":9091,"target":9278},{"edgeType":"contains","source":14314,"target":14388},{"edgeType":"contains","source":4072,"target":4201},{"edgeType":"calls","source":2694,"target":1323},{"edgeType":"contains","source":2622,"target":2640},{"edgeType":"contains","source":10616,"target":10624},{"edgeType":"calls","source":1858,"target":1873},{"edgeType":"contains","source":7107,"target":7359},{"edgeType":"imports","source":15763,"target":15584},{"edgeType":"contains","source":16034,"target":16035},{"edgeType":"contains","source":8849,"target":8324},{"edgeType":"contains","source":9295,"target":9296},{"edgeType":"calls","source":1462,"target":1464},{"edgeType":"calls","source":6812,"target":6833},{"edgeType":"contains","source":13457,"target":13458},{"edgeType":"contains","source":14514,"target":14531},{"edgeType":"contains","source":16561,"target":16609},{"edgeType":"calls","source":5103,"target":4864},{"edgeType":"contains","source":15109,"target":15113},{"edgeType":"contains","source":8158,"target":8603},{"edgeType":"contains","source":6002,"target":5676},{"edgeType":"contains","source":15349,"target":1330},{"edgeType":"contains","source":9889,"target":9907},{"edgeType":"calls","source":16061,"target":16079},{"edgeType":"calls","source":4501,"target":4500},{"edgeType":"contains","source":10616,"target":10625},{"edgeType":"calls","source":1991,"target":1977},{"edgeType":"contains","source":14314,"target":14373},{"edgeType":"calls","source":8680,"target":8121},{"edgeType":"calls","source":5756,"target":5761},{"edgeType":"contains","source":8965,"target":8967},{"edgeType":"calls","source":999,"target":1013},{"edgeType":"contains","source":1169,"target":1179},{"edgeType":"contains","source":12928,"target":12960},{"edgeType":"contains","source":13916,"target":14027},{"edgeType":"contains","source":12859,"target":12984},{"edgeType":"contains","source":16561,"target":16596},{"edgeType":"calls","source":15694,"target":2097},{"edgeType":"calls","source":9191,"target":9193},{"edgeType":"contains","source":7974,"target":7977},{"edgeType":"contains","source":15173,"target":15227},{"edgeType":"calls","source":2260,"target":2091},{"edgeType":"contains","source":8158,"target":8615},{"edgeType":"calls","source":6633,"target":6042},{"edgeType":"contains","source":1,"target":7789},{"edgeType":"imports","source":8676,"target":612},{"edgeType":"contains","source":14314,"target":14374},{"edgeType":"calls","source":6776,"target":5837},{"edgeType":"calls","source":5445,"target":4831},{"edgeType":"contains","source":5199,"target":5208},{"edgeType":"calls","source":12480,"target":6597},{"edgeType":"contains","source":8965,"target":8966},{"edgeType":"contains","source":7107,"target":7371},{"edgeType":"contains","source":16561,"target":16595},{"edgeType":"contains","source":6784,"target":6813},{"edgeType":"contains","source":5860,"target":5861},{"edgeType":"contains","source":7974,"target":7976},{"edgeType":"contains","source":12004,"target":12006},{"edgeType":"contains","source":1,"target":7792},{"edgeType":"calls","source":2193,"target":2051},{"edgeType":"contains","source":15439,"target":15440},{"edgeType":"contains","source":8965,"target":8969},{"edgeType":"contains","source":13916,"target":14029},{"edgeType":"contains","source":7107,"target":7372},{"edgeType":"contains","source":16561,"target":16598},{"edgeType":"imports","source":1779,"target":909},{"edgeType":"contains","source":8158,"target":2275},{"edgeType":"contains","source":8169,"target":8276},{"edgeType":"contains","source":8158,"target":8617},{"edgeType":"contains","source":12004,"target":12005},{"edgeType":"contains","source":11936,"target":11997},{"edgeType":"contains","source":14186,"target":14116},{"edgeType":"contains","source":9885,"target":10043},{"edgeType":"contains","source":987,"target":480},{"edgeType":"calls","source":10158,"target":358},{"edgeType":"contains","source":8965,"target":8968},{"edgeType":"contains","source":7107,"target":7373},{"edgeType":"contains","source":10944,"target":11040},{"edgeType":"contains","source":13916,"target":14030},{"edgeType":"imports","source":1779,"target":908},{"edgeType":"contains","source":16561,"target":16597},{"edgeType":"contains","source":6784,"target":6815},{"edgeType":"calls","source":4011,"target":660},{"edgeType":"contains","source":7902,"target":8096},{"edgeType":"contains","source":5794,"target":5795},{"edgeType":"contains","source":8158,"target":8616},{"edgeType":"contains","source":6125,"target":6104},{"edgeType":"contains","source":14777,"target":14822},{"edgeType":"contains","source":7107,"target":7366},{"edgeType":"contains","source":13916,"target":14031},{"edgeType":"contains","source":13919,"target":13938},{"edgeType":"contains","source":16561,"target":16600},{"edgeType":"imports","source":1779,"target":907},{"edgeType":"contains","source":6784,"target":6808},{"edgeType":"calls","source":12480,"target":6600},{"edgeType":"calls","source":12828,"target":12726},{"edgeType":"contains","source":14314,"target":14378},{"edgeType":"contains","source":12070,"target":12071},{"edgeType":"calls","source":6299,"target":5836},{"edgeType":"imports","source":9885,"target":3303},{"edgeType":"contains","source":7107,"target":7367},{"edgeType":"contains","source":9432,"target":2941},{"edgeType":"calls","source":2185,"target":184},{"edgeType":"contains","source":11936,"target":11995},{"edgeType":"contains","source":14114,"target":14236},{"edgeType":"contains","source":5684,"target":4970},{"edgeType":"contains","source":13916,"target":14032},{"edgeType":"contains","source":13457,"target":13468},{"edgeType":"contains","source":16561,"target":16599},{"edgeType":"contains","source":6784,"target":6809},{"edgeType":"contains","source":8158,"target":8610},{"edgeType":"calls","source":2013,"target":1285},{"edgeType":"contains","source":5992,"target":5993},{"edgeType":"contains","source":10484,"target":10499},{"edgeType":"contains","source":6586,"target":6605},{"edgeType":"contains","source":15095,"target":4966},{"edgeType":"calls","source":8928,"target":8893},{"edgeType":"calls","source":14147,"target":14116},{"edgeType":"contains","source":14777,"target":14825},{"edgeType":"contains","source":7107,"target":7368},{"edgeType":"calls","source":3579,"target":3477},{"edgeType":"contains","source":6784,"target":6810},{"edgeType":"contains","source":8169,"target":8272},{"edgeType":"contains","source":8158,"target":8613},{"edgeType":"calls","source":8139,"target":7985},{"edgeType":"contains","source":7974,"target":7975},{"edgeType":"contains","source":6586,"target":6606},{"edgeType":"calls","source":7111,"target":6028},{"edgeType":"contains","source":16561,"target":16602},{"edgeType":"contains","source":7107,"target":7369},{"edgeType":"contains","source":14114,"target":14238},{"edgeType":"contains","source":11936,"target":11993},{"edgeType":"contains","source":1928,"target":909},{"edgeType":"contains","source":6784,"target":6811},{"edgeType":"contains","source":8158,"target":8612},{"edgeType":"imports","source":10142,"target":10133},{"edgeType":"contains","source":15173,"target":15234},{"edgeType":"calls","source":15685,"target":2375},{"edgeType":"imports","source":14609,"target":612},{"edgeType":"contains","source":8158,"target":2270},{"edgeType":"contains","source":8040,"target":8042},{"edgeType":"contains","source":10550,"target":10565},{"edgeType":"contains","source":16561,"target":16601},{"edgeType":"calls","source":4397,"target":1471},{"edgeType":"contains","source":838,"target":845},{"edgeType":"contains","source":15173,"target":15219},{"edgeType":"contains","source":1330,"target":2506},{"edgeType":"imports","source":1621,"target":1622},{"edgeType":"contains","source":7107,"target":7345},{"edgeType":"contains","source":10748,"target":10750},{"edgeType":"contains","source":16561,"target":16587},{"edgeType":"contains","source":8676,"target":9445},{"edgeType":"contains","source":1631,"target":1632},{"edgeType":"calls","source":10584,"target":10514},{"edgeType":"contains","source":1,"target":5651},{"edgeType":"calls","source":804,"target":807},{"edgeType":"contains","source":1956,"target":2127},{"edgeType":"contains","source":4273,"target":4292},{"edgeType":"contains","source":5480,"target":4931},{"edgeType":"contains","source":1330,"target":2507},{"edgeType":"contains","source":10937,"target":11234},{"edgeType":"contains","source":12859,"target":12959},{"edgeType":"imports","source":9750,"target":3315},{"edgeType":"contains","source":16561,"target":16586},{"edgeType":"contains","source":1956,"target":2128},{"edgeType":"contains","source":1631,"target":1633},{"edgeType":"calls","source":7807,"target":7810},{"edgeType":"calls","source":11039,"target":11205},{"edgeType":"contains","source":10937,"target":11231},{"edgeType":"contains","source":1330,"target":2504},{"edgeType":"contains","source":16561,"target":16589},{"edgeType":"contains","source":12859,"target":12958},{"edgeType":"contains","source":14513,"target":14540},{"edgeType":"contains","source":7107,"target":7347},{"edgeType":"contains","source":4070,"target":4242},{"edgeType":"contains","source":11937,"target":11943},{"edgeType":"calls","source":15802,"target":15771},{"edgeType":"contains","source":1956,"target":2125},{"edgeType":"calls","source":11705,"target":11701},{"edgeType":"calls","source":3856,"target":3442},{"edgeType":"calls","source":11039,"target":11206},{"edgeType":"contains","source":1330,"target":2505},{"edgeType":"contains","source":16561,"target":16588},{"edgeType":"contains","source":10748,"target":10749},{"edgeType":"contains","source":6586,"target":6587},{"edgeType":"contains","source":9295,"target":9283},{"edgeType":"contains","source":11937,"target":11942},{"edgeType":"contains","source":11805,"target":11806},{"edgeType":"imports","source":7239,"target":2938},{"edgeType":"imports","source":15312,"target":4244},{"edgeType":"contains","source":16561,"target":16591},{"edgeType":"contains","source":7107,"target":7341},{"edgeType":"contains","source":1,"target":14111},{"edgeType":"calls","source":2598,"target":156},{"edgeType":"contains","source":11937,"target":11941},{"edgeType":"contains","source":11936,"target":11972},{"edgeType":"calls","source":817,"target":400},{"edgeType":"imports","source":12378,"target":10635},{"edgeType":"contains","source":9951,"target":10084},{"edgeType":"imports","source":16488,"target":16413},{"edgeType":"contains","source":1956,"target":2132},{"edgeType":"calls","source":2399,"target":2097},{"edgeType":"contains","source":15637,"target":15639},{"edgeType":"contains","source":16561,"target":16590},{"edgeType":"imports","source":2217,"target":2168},{"edgeType":"contains","source":13918,"target":13962},{"edgeType":"contains","source":11937,"target":11940},{"edgeType":"contains","source":11936,"target":11971},{"edgeType":"contains","source":15637,"target":15640},{"edgeType":"contains","source":4273,"target":4295},{"edgeType":"contains","source":1330,"target":2508},{"edgeType":"imports","source":12063,"target":11945},{"edgeType":"contains","source":6784,"target":6786},{"edgeType":"contains","source":7107,"target":7343},{"edgeType":"contains","source":15900,"target":15943},{"edgeType":"contains","source":12928,"target":12929},{"edgeType":"contains","source":13918,"target":13963},{"edgeType":"contains","source":8643,"target":8351},{"edgeType":"contains","source":11607,"target":11597},{"edgeType":"contains","source":16561,"target":16594},{"edgeType":"contains","source":3613,"target":3615},{"edgeType":"contains","source":1956,"target":2129},{"edgeType":"contains","source":7775,"target":7777},{"edgeType":"contains","source":11936,"target":11970},{"edgeType":"contains","source":15637,"target":15641},{"edgeType":"imports","source":8631,"target":8409},{"edgeType":"contains","source":15571,"target":15573},{"edgeType":"contains","source":1330,"target":2509},{"edgeType":"contains","source":16561,"target":16592},{"edgeType":"contains","source":7107,"target":7344},{"edgeType":"calls","source":11168,"target":2983},{"edgeType":"contains","source":15900,"target":15944},{"edgeType":"imports","source":5256,"target":5219},{"edgeType":"calls","source":9126,"target":9206},{"edgeType":"imports","source":16238,"target":7250},{"edgeType":"contains","source":1,"target":7770},{"edgeType":"contains","source":16561,"target":16593},{"edgeType":"contains","source":1956,"target":2130},{"edgeType":"contains","source":14777,"target":14818},{"edgeType":"contains","source":11936,"target":11969},{"edgeType":"contains","source":7775,"target":7776},{"edgeType":"contains","source":15251,"target":4352},{"edgeType":"contains","source":15421,"target":5424},{"edgeType":"calls","source":1068,"target":1071},{"edgeType":"calls","source":1666,"target":1560},{"edgeType":"contains","source":14777,"target":14802},{"edgeType":"calls","source":14815,"target":14663},{"edgeType":"contains","source":7107,"target":7353},{"edgeType":"contains","source":3613,"target":3621},{"edgeType":"calls","source":1002,"target":1003},{"edgeType":"contains","source":15900,"target":15928},{"edgeType":"contains","source":12926,"target":13004},{"edgeType":"contains","source":15240,"target":15249},{"edgeType":"contains","source":16759,"target":16782},{"edgeType":"calls","source":8336,"target":8331},{"edgeType":"contains","source":10748,"target":10759},{"edgeType":"imports","source":9432,"target":8937},{"edgeType":"calls","source":6089,"target":6090},{"edgeType":"contains","source":4273,"target":4300},{"edgeType":"contains","source":9885,"target":10029},{"edgeType":"contains","source":9889,"target":9905},{"edgeType":"contains","source":10522,"target":852},{"edgeType":"calls","source":2131,"target":1945},{"edgeType":"contains","source":7107,"target":7354},{"edgeType":"contains","source":1,"target":7772},{"edgeType":"contains","source":1,"target":5658},{"edgeType":"contains","source":1768,"target":1622},{"edgeType":"imports","source":15204,"target":1245},{"edgeType":"contains","source":3613,"target":3620},{"edgeType":"calls","source":5100,"target":5038},{"edgeType":"contains","source":16561,"target":16581},{"edgeType":"contains","source":10748,"target":10756},{"edgeType":"imports","source":1167,"target":903},{"edgeType":"contains","source":14777,"target":14804},{"edgeType":"calls","source":4107,"target":4108},{"edgeType":"contains","source":2620,"target":2690},{"edgeType":"contains","source":8158,"target":8600},{"edgeType":"contains","source":14976,"target":14978},{"edgeType":"imports","source":15637,"target":15308},{"edgeType":"contains","source":16759,"target":16785},{"edgeType":"contains","source":6188,"target":6247},{"edgeType":"contains","source":11936,"target":11982},{"edgeType":"contains","source":5796,"target":5715},{"edgeType":"calls","source":9394,"target":3018},{"edgeType":"calls","source":936,"target":937},{"edgeType":"calls","source":3050,"target":3050},{"edgeType":"calls","source":15693,"target":2246},{"edgeType":"contains","source":3613,"target":3619},{"edgeType":"contains","source":10937,"target":11240},{"edgeType":"calls","source":15183,"target":7486},{"edgeType":"contains","source":12821,"target":14143},{"edgeType":"contains","source":4273,"target":4298},{"edgeType":"contains","source":6188,"target":6248},{"edgeType":"contains","source":14976,"target":14979},{"edgeType":"imports","source":8030,"target":8001},{"edgeType":"contains","source":14777,"target":14805},{"edgeType":"contains","source":10484,"target":10485},{"edgeType":"contains","source":1,"target":7774},{"edgeType":"calls","source":6367,"target":5950},{"edgeType":"calls","source":7217,"target":7083},{"edgeType":"calls","source":1273,"target":1059},{"edgeType":"imports","source":5256,"target":5206},{"edgeType":"contains","source":9091,"target":9273},{"edgeType":"calls","source":11176,"target":2744},{"edgeType":"contains","source":10937,"target":11237},{"edgeType":"calls","source":1858,"target":1946},{"edgeType":"contains","source":16561,"target":16583},{"edgeType":"contains","source":11607,"target":11608},{"edgeType":"calls","source":3919,"target":3592},{"edgeType":"calls","source":15420,"target":2246},{"edgeType":"contains","source":8676,"target":9449},{"edgeType":"contains","source":244,"target":245},{"edgeType":"contains","source":14777,"target":14806},{"edgeType":"contains","source":4272,"target":4337},{"edgeType":"contains","source":4273,"target":4306},{"edgeType":"calls","source":2132,"target":1909},{"edgeType":"contains","source":7107,"target":7349},{"edgeType":"contains","source":5074,"target":4843},{"edgeType":"contains","source":5265,"target":5264},{"edgeType":"contains","source":1167,"target":1228},{"edgeType":"calls","source":11574,"target":11547},{"edgeType":"contains","source":9625,"target":9626},{"edgeType":"contains","source":6188,"target":6242},{"edgeType":"contains","source":16561,"target":16582},{"edgeType":"calls","source":6097,"target":5838},{"edgeType":"calls","source":15692,"target":2271},{"edgeType":"contains","source":12859,"target":12963},{"edgeType":"contains","source":1956,"target":2140},{"edgeType":"contains","source":6586,"target":6589},{"edgeType":"calls","source":4590,"target":3931},{"edgeType":"contains","source":4272,"target":4335},{"edgeType":"contains","source":4273,"target":4304},{"edgeType":"contains","source":4273,"target":4305},{"edgeType":"contains","source":4272,"target":4336},{"edgeType":"imports","source":16801,"target":15159},{"edgeType":"contains","source":10550,"target":10551},{"edgeType":"contains","source":11936,"target":11979},{"edgeType":"calls","source":2857,"target":2690},{"edgeType":"contains","source":2620,"target":2694},{"edgeType":"contains","source":2622,"target":2632},{"edgeType":"calls","source":11640,"target":11613},{"edgeType":"calls","source":6097,"target":5837},{"edgeType":"calls","source":1858,"target":1948},{"edgeType":"imports","source":230,"target":349},{"edgeType":"contains","source":14976,"target":14982},{"edgeType":"contains","source":16561,"target":16585},{"edgeType":"contains","source":3613,"target":3623},{"edgeType":"contains","source":1768,"target":1623},{"edgeType":"contains","source":16561,"target":16584},{"edgeType":"contains","source":1956,"target":2138},{"edgeType":"calls","source":6840,"target":6089},{"edgeType":"imports","source":1621,"target":1623},{"edgeType":"contains","source":12859,"target":12961},{"edgeType":"contains","source":244,"target":246},{"edgeType":"contains","source":6188,"target":6244},{"edgeType":"contains","source":10616,"target":10617},{"edgeType":"contains","source":3613,"target":3622},{"edgeType":"contains","source":7107,"target":7352},{"edgeType":"contains","source":11936,"target":11977},{"edgeType":"calls","source":12210,"target":286},{"edgeType":"contains","source":14777,"target":14794},{"edgeType":"contains","source":2621,"target":2636},{"edgeType":"contains","source":15636,"target":15648},{"edgeType":"contains","source":1891,"target":2011},{"edgeType":"contains","source":1,"target":5635},{"edgeType":"contains","source":1956,"target":2110},{"edgeType":"contains","source":5816,"target":5068},{"edgeType":"contains","source":15504,"target":15512},{"edgeType":"contains","source":14314,"target":14349},{"edgeType":"contains","source":10937,"target":11216},{"edgeType":"contains","source":16561,"target":16571},{"edgeType":"contains","source":15215,"target":1217},{"edgeType":"calls","source":6166,"target":5842},{"edgeType":"contains","source":11936,"target":11958},{"edgeType":"contains","source":1891,"target":2012},{"edgeType":"calls","source":8335,"target":8337},{"edgeType":"contains","source":1956,"target":2111},{"edgeType":"calls","source":2258,"target":2261},{"edgeType":"calls","source":2271,"target":1858},{"edgeType":"calls","source":2991,"target":679},{"edgeType":"contains","source":1330,"target":2491},{"edgeType":"calls","source":5169,"target":5038},{"edgeType":"imports","source":7963,"target":7958},{"edgeType":"contains","source":16561,"target":16570},{"edgeType":"contains","source":11342,"target":11344},{"edgeType":"contains","source":13390,"target":13393},{"edgeType":"imports","source":7239,"target":805},{"edgeType":"contains","source":11936,"target":11957},{"edgeType":"contains","source":15240,"target":15242},{"edgeType":"contains","source":3810,"target":3829},{"edgeType":"contains","source":1956,"target":2108},{"edgeType":"contains","source":9951,"target":10069},{"edgeType":"calls","source":15697,"target":2097},{"edgeType":"contains","source":4273,"target":4275},{"edgeType":"contains","source":8171,"target":8173},{"edgeType":"contains","source":14183,"target":14184},{"edgeType":"contains","source":16561,"target":16573},{"edgeType":"contains","source":14837,"target":4480},{"edgeType":"contains","source":2621,"target":2635},{"edgeType":"calls","source":6779,"target":5837},{"edgeType":"contains","source":13390,"target":13392},{"edgeType":"contains","source":7107,"target":7332},{"edgeType":"contains","source":15240,"target":15243},{"edgeType":"contains","source":3810,"target":3828},{"edgeType":"contains","source":1956,"target":2109},{"edgeType":"calls","source":14546,"target":14517},{"edgeType":"contains","source":4339,"target":4342},{"edgeType":"contains","source":8171,"target":8172},{"edgeType":"contains","source":14183,"target":14185},{"edgeType":"contains","source":16561,"target":16572},{"edgeType":"calls","source":3585,"target":3403},{"edgeType":"imports","source":15581,"target":2236},{"edgeType":"contains","source":1167,"target":1204},{"edgeType":"contains","source":14777,"target":14798},{"edgeType":"calls","source":6511,"target":5690},{"edgeType":"contains","source":1891,"target":2015},{"edgeType":"contains","source":1,"target":5639},{"edgeType":"calls","source":8137,"target":8136},{"edgeType":"contains","source":15240,"target":15244},{"edgeType":"contains","source":5652,"target":5920},{"edgeType":"contains","source":1330,"target":2494},{"edgeType":"calls","source":7986,"target":2246},{"edgeType":"contains","source":16561,"target":16575},{"edgeType":"contains","source":4338,"target":4380},{"edgeType":"imports","source":5256,"target":5199},{"edgeType":"contains","source":6844,"target":7021},{"edgeType":"contains","source":12597,"target":12605},{"edgeType":"contains","source":7107,"target":7324},{"edgeType":"calls","source":8914,"target":3075},{"edgeType":"imports","source":15649,"target":2236},{"edgeType":"contains","source":11342,"target":11343},{"edgeType":"contains","source":1891,"target":2016},{"edgeType":"imports","source":14695,"target":4327},{"edgeType":"calls","source":8269,"target":8273},{"edgeType":"contains","source":1330,"target":2495},{"edgeType":"contains","source":4272,"target":4311},{"edgeType":"imports","source":7780,"target":7293},{"edgeType":"contains","source":6844,"target":7022},{"edgeType":"imports","source":9750,"target":9644},{"edgeType":"contains","source":13390,"target":13389},{"edgeType":"contains","source":4338,"target":4379},{"edgeType":"contains","source":16561,"target":16574},{"edgeType":"contains","source":9362,"target":9297},{"edgeType":"contains","source":7107,"target":7325},{"edgeType":"calls","source":3652,"target":3438},{"edgeType":"imports","source":9564,"target":612},{"edgeType":"contains","source":9624,"target":9635},{"edgeType":"calls","source":9987,"target":9983},{"edgeType":"contains","source":1891,"target":2013},{"edgeType":"contains","source":12013,"target":11680},{"edgeType":"contains","source":5652,"target":5922},{"edgeType":"contains","source":12597,"target":12603},{"edgeType":"contains","source":1330,"target":2492},{"edgeType":"calls","source":4438,"target":4439},{"edgeType":"contains","source":15636,"target":15654},{"edgeType":"imports","source":1779,"target":930},{"edgeType":"calls","source":3994,"target":3403},{"edgeType":"contains","source":4338,"target":4378},{"edgeType":"contains","source":7107,"target":7326},{"edgeType":"contains","source":4738,"target":4662},{"edgeType":"calls","source":8798,"target":8787},{"edgeType":"contains","source":4070,"target":4228},{"edgeType":"contains","source":9624,"target":9634},{"edgeType":"calls","source":14016,"target":14039},{"edgeType":"contains","source":14777,"target":14801},{"edgeType":"contains","source":6188,"target":6219},{"edgeType":"contains","source":1891,"target":2014},{"edgeType":"calls","source":4590,"target":3954},{"edgeType":"contains","source":8303,"target":8304},{"edgeType":"contains","source":1330,"target":2493},{"edgeType":"contains","source":4338,"target":4377},{"edgeType":"contains","source":16561,"target":16576},{"edgeType":"contains","source":7107,"target":7327},{"edgeType":"imports","source":15649,"target":4352},{"edgeType":"contains","source":7107,"target":7337},{"edgeType":"calls","source":10715,"target":10672},{"edgeType":"contains","source":11936,"target":11967},{"edgeType":"calls","source":6711,"target":5836},{"edgeType":"contains","source":1,"target":5643},{"edgeType":"calls","source":16070,"target":15909},{"edgeType":"contains","source":1330,"target":2498},{"edgeType":"contains","source":9091,"target":9256},{"edgeType":"calls","source":10976,"target":11038},{"edgeType":"contains","source":13918,"target":13932},{"edgeType":"calls","source":2462,"target":156},{"edgeType":"contains","source":16561,"target":16563},{"edgeType":"contains","source":14513,"target":14514},{"edgeType":"calls","source":9136,"target":8883},{"edgeType":"calls","source":6711,"target":5837},{"edgeType":"contains","source":8158,"target":2240},{"edgeType":"contains","source":4273,"target":4285},{"edgeType":"contains","source":11936,"target":11968},{"edgeType":"contains","source":4338,"target":4384},{"edgeType":"calls","source":7052,"target":5836},{"edgeType":"calls","source":4260,"target":1497},{"edgeType":"contains","source":11936,"target":11966},{"edgeType":"contains","source":15504,"target":15505},{"edgeType":"calls","source":8546,"target":8145},{"edgeType":"calls","source":8140,"target":8048},{"edgeType":"contains","source":9091,"target":9255},{"edgeType":"imports","source":10937,"target":10887},{"edgeType":"contains","source":16561,"target":16562},{"edgeType":"calls","source":15145,"target":14988},{"edgeType":"calls","source":3653,"target":3403},{"edgeType":"contains","source":14777,"target":14787},{"edgeType":"contains","source":4273,"target":4284},{"edgeType":"contains","source":16821,"target":16958},{"edgeType":"contains","source":10522,"target":836},{"edgeType":"contains","source":6188,"target":6230},{"edgeType":"calls","source":6234,"target":5839},{"edgeType":"contains","source":11936,"target":11965},{"edgeType":"calls","source":14148,"target":14180},{"edgeType":"contains","source":838,"target":839},{"edgeType":"calls","source":819,"target":352},{"edgeType":"contains","source":987,"target":448},{"edgeType":"calls","source":16137,"target":15948},{"edgeType":"contains","source":1891,"target":2017},{"edgeType":"imports","source":9090,"target":8949},{"edgeType":"contains","source":7107,"target":7339},{"edgeType":"calls","source":1070,"target":1028},{"edgeType":"contains","source":15900,"target":15914},{"edgeType":"contains","source":3351,"target":3268},{"edgeType":"contains","source":16561,"target":16565},{"edgeType":"calls","source":209,"target":236},{"edgeType":"contains","source":8303,"target":8317},{"edgeType":"contains","source":4273,"target":4283},{"edgeType":"contains","source":8158,"target":2242},{"edgeType":"contains","source":6188,"target":6231},{"edgeType":"contains","source":11936,"target":11964},{"edgeType":"contains","source":9951,"target":10078},{"edgeType":"calls","source":6347,"target":6553},{"edgeType":"calls","source":1268,"target":1231},{"edgeType":"contains","source":1891,"target":2018},{"edgeType":"calls","source":937,"target":921},{"edgeType":"contains","source":14114,"target":14201},{"edgeType":"contains","source":9091,"target":9257},{"edgeType":"contains","source":7107,"target":7340},{"edgeType":"contains","source":1330,"target":2497},{"edgeType":"contains","source":16561,"target":16564},{"edgeType":"contains","source":16821,"target":16960},{"edgeType":"calls","source":6711,"target":5840},{"edgeType":"contains","source":5932,"target":5712},{"edgeType":"calls","source":8467,"target":8485},{"edgeType":"contains","source":7107,"target":7333},{"edgeType":"contains","source":11936,"target":11963},{"edgeType":"contains","source":14314,"target":14344},{"edgeType":"contains","source":1330,"target":2502},{"edgeType":"contains","source":9322,"target":2091},{"edgeType":"calls","source":8864,"target":8863},{"edgeType":"contains","source":5461,"target":5507},{"edgeType":"contains","source":6188,"target":6225},{"edgeType":"contains","source":16561,"target":16567},{"edgeType":"calls","source":4062,"target":3403},{"edgeType":"contains","source":16759,"target":16771},{"edgeType":"calls","source":2260,"target":2186},{"edgeType":"contains","source":16821,"target":16963},{"edgeType":"contains","source":4997,"target":5099},{"edgeType":"contains","source":1,"target":5646},{"edgeType":"contains","source":15504,"target":15509},{"edgeType":"contains","source":14314,"target":14345},{"edgeType":"contains","source":838,"target":840},{"edgeType":"contains","source":11936,"target":11962},{"edgeType":"contains","source":1330,"target":2503},{"edgeType":"calls","source":15937,"target":15801},{"edgeType":"contains","source":16561,"target":16566},{"edgeType":"imports","source":10078,"target":10038},{"edgeType":"contains","source":4273,"target":4288},{"edgeType":"calls","source":6711,"target":5842},{"edgeType":"contains","source":838,"target":843},{"edgeType":"contains","source":7107,"target":7335},{"edgeType":"calls","source":1531,"target":1531},{"edgeType":"contains","source":15251,"target":4326},{"edgeType":"contains","source":11936,"target":11961},{"edgeType":"calls","source":13223,"target":13262},{"edgeType":"calls","source":16367,"target":358},{"edgeType":"contains","source":14314,"target":14347},{"edgeType":"contains","source":14694,"target":15251},{"edgeType":"contains","source":4273,"target":4287},{"edgeType":"calls","source":14815,"target":14645},{"edgeType":"contains","source":16561,"target":16569},{"edgeType":"contains","source":11270,"target":11467},{"edgeType":"contains","source":7107,"target":7336},{"edgeType":"calls","source":16070,"target":15908},{"edgeType":"contains","source":11936,"target":11960},{"edgeType":"calls","source":937,"target":917},{"edgeType":"contains","source":13324,"target":13328},{"edgeType":"calls","source":11573,"target":11560},{"edgeType":"imports","source":10142,"target":10166},{"edgeType":"contains","source":16561,"target":16568},{"edgeType":"contains","source":8158,"target":8579},{"edgeType":"contains","source":10937,"target":11219},{"edgeType":"calls","source":2023,"target":1076},{"edgeType":"contains","source":6188,"target":6228},{"edgeType":"contains","source":4273,"target":4286},{"edgeType":"imports","source":7830,"target":7847},{"edgeType":"contains","source":15834,"target":15836},{"edgeType":"contains","source":4271,"target":4322},{"edgeType":"calls","source":15892,"target":2375},{"edgeType":"contains","source":7107,"target":7312},{"edgeType":"contains","source":6844,"target":7009},{"edgeType":"contains","source":1167,"target":1183},{"edgeType":"contains","source":9365,"target":9193},{"edgeType":"calls","source":10460,"target":1639},{"edgeType":"calls","source":3403,"target":540},{"edgeType":"contains","source":35,"target":336},{"edgeType":"contains","source":15768,"target":15769},{"edgeType":"imports","source":16845,"target":15954},{"edgeType":"contains","source":7107,"target":7313},{"edgeType":"imports","source":4024,"target":3270},{"edgeType":"contains","source":987,"target":420},{"edgeType":"contains","source":4999,"target":5008},{"edgeType":"calls","source":2042,"target":448},{"edgeType":"contains","source":3875,"target":3913},{"edgeType":"contains","source":35,"target":335},{"edgeType":"contains","source":5660,"target":5661},{"edgeType":"imports","source":696,"target":733},{"edgeType":"contains","source":1495,"target":1584},{"edgeType":"calls","source":8998,"target":8910},{"edgeType":"contains","source":7107,"target":7314},{"edgeType":"contains","source":1410,"target":2105},{"edgeType":"contains","source":4999,"target":5007},{"edgeType":"calls","source":4040,"target":4046},{"edgeType":"contains","source":1891,"target":1993},{"edgeType":"calls","source":3477,"target":358},{"edgeType":"contains","source":7774,"target":7779},{"edgeType":"contains","source":1956,"target":2092},{"edgeType":"contains","source":35,"target":338},{"edgeType":"contains","source":4999,"target":5006},{"edgeType":"contains","source":4271,"target":4319},{"edgeType":"contains","source":1495,"target":1585},{"edgeType":"calls","source":6947,"target":6955},{"edgeType":"contains","source":15379,"target":2461},{"edgeType":"calls","source":8998,"target":8909},{"edgeType":"contains","source":10937,"target":11199},{"edgeType":"calls","source":6166,"target":5790},{"edgeType":"calls","source":6097,"target":5815},{"edgeType":"contains","source":16164,"target":16178},{"edgeType":"contains","source":7107,"target":7315},{"edgeType":"contains","source":14777,"target":14781},{"edgeType":"calls","source":14148,"target":14154},{"edgeType":"imports","source":696,"target":731},{"edgeType":"calls","source":2918,"target":2890},{"edgeType":"contains","source":35,"target":337},{"edgeType":"contains","source":7708,"target":7710},{"edgeType":"contains","source":35,"target":340},{"edgeType":"calls","source":8998,"target":8912},{"edgeType":"contains","source":15385,"target":4390},{"edgeType":"contains","source":7239,"target":7444},{"edgeType":"contains","source":2621,"target":2624},{"edgeType":"contains","source":10879,"target":10880},{"edgeType":"contains","source":7107,"target":7308},{"edgeType":"imports","source":15828,"target":15764},{"edgeType":"calls","source":2757,"target":1536},{"edgeType":"calls","source":15142,"target":15051},{"edgeType":"contains","source":14777,"target":14782},{"edgeType":"calls","source":1273,"target":1029},{"edgeType":"contains","source":5816,"target":5048},{"edgeType":"calls","source":14279,"target":14328},{"edgeType":"imports","source":1167,"target":925},{"edgeType":"contains","source":9362,"target":9281},{"edgeType":"contains","source":7107,"target":7309},{"edgeType":"contains","source":2434,"target":2079},{"edgeType":"contains","source":9491,"target":9510},{"edgeType":"calls","source":4954,"target":1079},{"edgeType":"calls","source":5520,"target":4673},{"edgeType":"contains","source":6188,"target":6201},{"edgeType":"contains","source":6122,"target":6133},{"edgeType":"contains","source":15385,"target":4392},{"edgeType":"calls","source":2257,"target":2235},{"edgeType":"calls","source":11639,"target":11603},{"edgeType":"contains","source":4999,"target":5011},{"edgeType":"contains","source":7107,"target":7310},{"edgeType":"contains","source":10945,"target":10946},{"edgeType":"calls","source":4040,"target":4042},{"edgeType":"calls","source":15669,"target":15629},{"edgeType":"contains","source":987,"target":427},{"edgeType":"contains","source":13916,"target":13992},{"edgeType":"contains","source":14777,"target":14784},{"edgeType":"calls","source":10654,"target":10427},{"edgeType":"contains","source":7774,"target":7775},{"edgeType":"contains","source":3875,"target":3916},{"edgeType":"contains","source":14976,"target":14958},{"edgeType":"contains","source":11184,"target":11994},{"edgeType":"imports","source":14609,"target":702},{"edgeType":"calls","source":10384,"target":10343},{"edgeType":"calls","source":2257,"target":2236},{"edgeType":"contains","source":2621,"target":2623},{"edgeType":"contains","source":7107,"target":7311},{"edgeType":"contains","source":15900,"target":15911},{"edgeType":"contains","source":4999,"target":5010},{"edgeType":"calls","source":6028,"target":5836},{"edgeType":"contains","source":10945,"target":10947},{"edgeType":"contains","source":16759,"target":16764},{"edgeType":"contains","source":13918,"target":13931},{"edgeType":"contains","source":16821,"target":16956},{"edgeType":"contains","source":1167,"target":1188},{"edgeType":"contains","source":9362,"target":9283},{"edgeType":"contains","source":9491,"target":9512},{"edgeType":"contains","source":14777,"target":14785},{"edgeType":"calls","source":14016,"target":14022},{"edgeType":"contains","source":10085,"target":10124},{"edgeType":"contains","source":3875,"target":3915},{"edgeType":"calls","source":15142,"target":15063},{"edgeType":"calls","source":2539,"target":1947},{"edgeType":"contains","source":12859,"target":12935},{"edgeType":"imports","source":9838,"target":611},{"edgeType":"contains","source":1891,"target":2003},{"edgeType":"contains","source":15443,"target":15264},{"edgeType":"calls","source":10402,"target":9788},{"edgeType":"contains","source":15173,"target":15178},{"edgeType":"contains","source":7107,"target":7320},{"edgeType":"contains","source":5652,"target":5916},{"edgeType":"imports","source":696,"target":740},{"edgeType":"contains","source":7528,"target":611},{"edgeType":"calls","source":9956,"target":358},{"edgeType":"calls","source":10995,"target":10433},{"edgeType":"calls","source":10683,"target":1076},{"edgeType":"contains","source":9624,"target":9628},{"edgeType":"calls","source":10451,"target":10382},{"edgeType":"contains","source":15173,"target":15179},{"edgeType":"calls","source":4357,"target":2669},{"edgeType":"calls","source":6988,"target":5690},{"edgeType":"contains","source":10522,"target":819},{"edgeType":"contains","source":7107,"target":7321},{"edgeType":"contains","source":11936,"target":11950},{"edgeType":"imports","source":696,"target":741},{"edgeType":"calls","source":11661,"target":358},{"edgeType":"contains","source":1167,"target":1190},{"edgeType":"contains","source":11336,"target":11524},{"edgeType":"contains","source":5256,"target":5505},{"edgeType":"calls","source":1695,"target":626},{"edgeType":"imports","source":5256,"target":5237},{"edgeType":"contains","source":14050,"target":14053},{"edgeType":"calls","source":3972,"target":4032},{"edgeType":"calls","source":2019,"target":1156},{"edgeType":"calls","source":9128,"target":9116},{"edgeType":"contains","source":10085,"target":10135},{"edgeType":"calls","source":6226,"target":6037},{"edgeType":"calls","source":2090,"target":1069},{"edgeType":"contains","source":2621,"target":2626},{"edgeType":"calls","source":10712,"target":10747},{"edgeType":"contains","source":7107,"target":7322},{"edgeType":"contains","source":12597,"target":12599},{"edgeType":"calls","source":2131,"target":1909},{"edgeType":"contains","source":2434,"target":2080},{"edgeType":"contains","source":8500,"target":8536},{"edgeType":"contains","source":5652,"target":5918},{"edgeType":"calls","source":15703,"target":12473},{"edgeType":"contains","source":15251,"target":14877},{"edgeType":"contains","source":15966,"target":15967},{"edgeType":"contains","source":15173,"target":15181},{"edgeType":"calls","source":8335,"target":8331},{"edgeType":"contains","source":10085,"target":10136},{"edgeType":"calls","source":6643,"target":5817},{"edgeType":"contains","source":4537,"target":4538},{"edgeType":"contains","source":6125,"target":6054},{"edgeType":"calls","source":16668,"target":16384},{"edgeType":"calls","source":2389,"target":2368},{"edgeType":"calls","source":2856,"target":2690},{"edgeType":"contains","source":12597,"target":12598},{"edgeType":"calls","source":12831,"target":12708},{"edgeType":"imports","source":9750,"target":9679},{"edgeType":"contains","source":5652,"target":5919},{"edgeType":"contains","source":9362,"target":9295},{"edgeType":"contains","source":1891,"target":2002},{"edgeType":"calls","source":3049,"target":3049},{"edgeType":"contains","source":13918,"target":13919},{"edgeType":"contains","source":7107,"target":7323},{"edgeType":"imports","source":15636,"target":15366},{"edgeType":"contains","source":10937,"target":11204},{"edgeType":"contains","source":3810,"target":3827},{"edgeType":"imports","source":1167,"target":934},{"edgeType":"calls","source":2918,"target":2879},{"edgeType":"contains","source":14936,"target":14073},{"edgeType":"contains","source":4339,"target":4341},{"edgeType":"contains","source":7107,"target":7316},{"edgeType":"contains","source":14050,"target":14056},{"edgeType":"calls","source":1538,"target":1262},{"edgeType":"contains","source":15900,"target":15899},{"edgeType":"calls","source":11639,"target":11613},{"edgeType":"contains","source":15966,"target":15969},{"edgeType":"contains","source":2621,"target":2633},{"edgeType":"calls","source":8137,"target":8129},{"edgeType":"contains","source":3810,"target":3826},{"edgeType":"calls","source":10720,"target":10506},{"edgeType":"contains","source":4458,"target":2765},{"edgeType":"contains","source":309,"target":310},{"edgeType":"calls","source":2539,"target":1944},{"edgeType":"calls","source":2465,"target":2124},{"edgeType":"contains","source":4339,"target":4340},{"edgeType":"contains","source":7107,"target":7317},{"edgeType":"contains","source":5652,"target":5913},{"edgeType":"contains","source":7774,"target":7780},{"edgeType":"contains","source":5528,"target":5529},{"edgeType":"contains","source":9558,"target":9559},{"edgeType":"calls","source":13051,"target":12235},{"edgeType":"contains","source":6188,"target":6210},{"edgeType":"contains","source":2621,"target":2630},{"edgeType":"contains","source":10617,"target":2095},{"edgeType":"calls","source":15608,"target":615},{"edgeType":"contains","source":15900,"target":15902},{"edgeType":"contains","source":10937,"target":11202},{"edgeType":"contains","source":15173,"target":15184},{"edgeType":"calls","source":11096,"target":3075},{"edgeType":"contains","source":1,"target":5633},{"edgeType":"calls","source":9394,"target":2989},{"edgeType":"contains","source":9951,"target":10057},{"edgeType":"contains","source":11936,"target":11945},{"edgeType":"contains","source":7107,"target":7318},{"edgeType":"calls","source":9126,"target":9183},{"edgeType":"contains","source":3810,"target":3825},{"edgeType":"contains","source":5652,"target":5914},{"edgeType":"contains","source":13918,"target":13922},{"edgeType":"contains","source":5528,"target":5530},{"edgeType":"contains","source":2621,"target":2631},{"edgeType":"imports","source":15637,"target":15336},{"edgeType":"contains","source":15834,"target":15835},{"edgeType":"contains","source":15966,"target":15971},{"edgeType":"contains","source":7107,"target":7319},{"edgeType":"calls","source":2131,"target":1906},{"edgeType":"calls","source":15685,"target":4572},{"edgeType":"calls","source":15669,"target":15638},{"edgeType":"contains","source":1167,"target":1196},{"edgeType":"contains","source":9365,"target":9198},{"edgeType":"contains","source":5462,"target":5463},{"edgeType":"calls","source":4041,"target":4034},{"edgeType":"contains","source":8224,"target":2266},{"edgeType":"contains","source":16821,"target":16934},{"edgeType":"contains","source":14183,"target":14148},{"edgeType":"contains","source":6125,"target":6026},{"edgeType":"imports","source":2668,"target":893},{"edgeType":"contains","source":5816,"target":5035},{"edgeType":"calls","source":10712,"target":10724},{"edgeType":"calls","source":868,"target":920},{"edgeType":"contains","source":35,"target":319},{"edgeType":"contains","source":1495,"target":1570},{"edgeType":"contains","source":770,"target":789},{"edgeType":"contains","source":4338,"target":4343},{"edgeType":"contains","source":1635,"target":1458},{"edgeType":"contains","source":8498,"target":8571},{"edgeType":"contains","source":14954,"target":15616},{"edgeType":"contains","source":7107,"target":7295},{"edgeType":"calls","source":3507,"target":1561},{"edgeType":"contains","source":1230,"target":1329},{"edgeType":"contains","source":14182,"target":14180},{"edgeType":"calls","source":6165,"target":5840},{"edgeType":"calls","source":10354,"target":680},{"edgeType":"contains","source":35,"target":318},{"edgeType":"contains","source":770,"target":788},{"edgeType":"contains","source":6188,"target":6189},{"edgeType":"contains","source":1495,"target":1571},{"edgeType":"calls","source":2132,"target":1906},{"edgeType":"contains","source":14954,"target":15617},{"edgeType":"contains","source":14716,"target":1855},{"edgeType":"contains","source":16758,"target":16772},{"edgeType":"contains","source":7107,"target":7296},{"edgeType":"imports","source":1779,"target":968},{"edgeType":"calls","source":1266,"target":1269},{"edgeType":"contains","source":14182,"target":14181},{"edgeType":"contains","source":11336,"target":11497},{"edgeType":"contains","source":11600,"target":11769},{"edgeType":"calls","source":10449,"target":10422},{"edgeType":"contains","source":2223,"target":2254},{"edgeType":"contains","source":35,"target":321},{"edgeType":"contains","source":4272,"target":4273},{"edgeType":"contains","source":1495,"target":1568},{"edgeType":"contains","source":10350,"target":10352},{"edgeType":"contains","source":14954,"target":15618},{"edgeType":"contains","source":7107,"target":7297},{"edgeType":"calls","source":15073,"target":15066},{"edgeType":"imports","source":9838,"target":600},{"edgeType":"contains","source":12939,"target":4086},{"edgeType":"contains","source":8498,"target":8573},{"edgeType":"contains","source":12821,"target":14086},{"edgeType":"contains","source":16821,"target":16935},{"edgeType":"contains","source":35,"target":320},{"edgeType":"imports","source":1055,"target":156},{"edgeType":"calls","source":2773,"target":1059},{"edgeType":"contains","source":1495,"target":1569},{"edgeType":"contains","source":2223,"target":2256},{"edgeType":"contains","source":12464,"target":12468},{"edgeType":"contains","source":770,"target":790},{"edgeType":"contains","source":6122,"target":6123},{"edgeType":"contains","source":4795,"target":4971},{"edgeType":"contains","source":7107,"target":7298},{"edgeType":"contains","source":8498,"target":8572},{"edgeType":"calls","source":9391,"target":9394},{"edgeType":"contains","source":6843,"target":7026},{"edgeType":"contains","source":11063,"target":3045},{"edgeType":"contains","source":11600,"target":11767},{"edgeType":"contains","source":1635,"target":1462},{"edgeType":"calls","source":14291,"target":13940},{"edgeType":"contains","source":15503,"target":15514},{"edgeType":"contains","source":6305,"target":6784},{"edgeType":"calls","source":7013,"target":7008},{"edgeType":"contains","source":1495,"target":1574},{"edgeType":"imports","source":14112,"target":13978},{"edgeType":"contains","source":1230,"target":1333},{"edgeType":"contains","source":7107,"target":7291},{"edgeType":"contains","source":10085,"target":10109},{"edgeType":"imports","source":8030,"target":8032},{"edgeType":"contains","source":1495,"target":1575},{"edgeType":"contains","source":15503,"target":15515},{"edgeType":"contains","source":8224,"target":2261},{"edgeType":"contains","source":35,"target":322},{"edgeType":"contains","source":15173,"target":15175},{"edgeType":"contains","source":6125,"target":6023},{"edgeType":"contains","source":35,"target":323},{"edgeType":"contains","source":1410,"target":2096},{"edgeType":"contains","source":3545,"target":3560},{"edgeType":"calls","source":7028,"target":6544},{"edgeType":"contains","source":10350,"target":10351},{"edgeType":"contains","source":1230,"target":1334},{"edgeType":"calls","source":11638,"target":11620},{"edgeType":"imports","source":5671,"target":2938},{"edgeType":"calls","source":7522,"target":6028},{"edgeType":"contains","source":7107,"target":7292},{"edgeType":"contains","source":8224,"target":2264},{"edgeType":"calls","source":6864,"target":1058},{"edgeType":"contains","source":9365,"target":9175},{"edgeType":"calls","source":16196,"target":16188},{"edgeType":"contains","source":10084,"target":10137},{"edgeType":"imports","source":1167,"target":907},{"edgeType":"contains","source":15173,"target":15176},{"edgeType":"contains","source":15385,"target":4375},{"edgeType":"contains","source":3545,"target":3559},{"edgeType":"contains","source":1495,"target":1572},{"edgeType":"contains","source":1410,"target":2093},{"edgeType":"calls","source":15932,"target":15915},{"edgeType":"calls","source":2368,"target":925},{"edgeType":"contains","source":10937,"target":11177},{"edgeType":"contains","source":16164,"target":16167},{"edgeType":"calls","source":3446,"target":3447},{"edgeType":"calls","source":12426,"target":4103},{"edgeType":"contains","source":16758,"target":16778},{"edgeType":"contains","source":11600,"target":11766},{"edgeType":"calls","source":14041,"target":2660},{"edgeType":"imports","source":1167,"target":908},{"edgeType":"contains","source":8224,"target":2263},{"edgeType":"contains","source":3545,"target":3558},{"edgeType":"contains","source":1495,"target":1573},{"edgeType":"contains","source":1230,"target":1332},{"edgeType":"calls","source":2254,"target":2346},{"edgeType":"contains","source":7107,"target":7294},{"edgeType":"contains","source":9951,"target":10046},{"edgeType":"contains","source":3083,"target":3088},{"edgeType":"contains","source":1495,"target":1578},{"edgeType":"contains","source":10937,"target":11191},{"edgeType":"contains","source":6125,"target":6035},{"edgeType":"contains","source":16758,"target":16765},{"edgeType":"contains","source":2620,"target":2642},{"edgeType":"contains","source":7107,"target":7305},{"edgeType":"contains","source":8498,"target":8578},{"edgeType":"contains","source":5658,"target":5714},{"edgeType":"contains","source":3083,"target":3089},{"edgeType":"imports","source":14835,"target":4244},{"edgeType":"contains","source":4999,"target":5000},{"edgeType":"contains","source":13467,"target":13096},{"edgeType":"calls","source":3341,"target":358},{"edgeType":"contains","source":1410,"target":2100},{"edgeType":"contains","source":1495,"target":1579},{"edgeType":"contains","source":9365,"target":9184},{"edgeType":"contains","source":6122,"target":6129},{"edgeType":"contains","source":1230,"target":1338},{"edgeType":"contains","source":8438,"target":8324},{"edgeType":"contains","source":3083,"target":3086},{"edgeType":"contains","source":7107,"target":7306},{"edgeType":"calls","source":2962,"target":1533},{"edgeType":"contains","source":1495,"target":1576},{"edgeType":"contains","source":9491,"target":9509},{"edgeType":"calls","source":3335,"target":540},{"edgeType":"contains","source":1230,"target":1335},{"edgeType":"contains","source":35,"target":330},{"edgeType":"contains","source":12068,"target":12069},{"edgeType":"calls","source":6710,"target":5837},{"edgeType":"contains","source":6122,"target":6130},{"edgeType":"contains","source":14954,"target":15610},{"edgeType":"contains","source":3083,"target":3087},{"edgeType":"contains","source":7239,"target":7443},{"edgeType":"calls","source":8070,"target":8073},{"edgeType":"contains","source":1495,"target":1577},{"edgeType":"contains","source":1448,"target":920},{"edgeType":"contains","source":7107,"target":7307},{"edgeType":"imports","source":15318,"target":4072},{"edgeType":"contains","source":1956,"target":2085},{"edgeType":"contains","source":1230,"target":1336},{"edgeType":"contains","source":5858,"target":5859},{"edgeType":"contains","source":6122,"target":6131},{"edgeType":"calls","source":16668,"target":16367},{"edgeType":"contains","source":7458,"target":647},{"edgeType":"imports","source":7919,"target":893},{"edgeType":"calls","source":9258,"target":9300},{"edgeType":"contains","source":1495,"target":1582},{"edgeType":"contains","source":15900,"target":15883},{"edgeType":"contains","source":6188,"target":6192},{"edgeType":"calls","source":15623,"target":2246},{"edgeType":"imports","source":5256,"target":5224},{"edgeType":"contains","source":35,"target":332},{"edgeType":"contains","source":3810,"target":3811},{"edgeType":"calls","source":748,"target":400},{"edgeType":"contains","source":8498,"target":8575},{"edgeType":"contains","source":10484,"target":8318},{"edgeType":"contains","source":1495,"target":1583},{"edgeType":"calls","source":11572,"target":11560},{"edgeType":"contains","source":3875,"target":3909},{"edgeType":"calls","source":14279,"target":14319},{"edgeType":"contains","source":10937,"target":11188},{"edgeType":"contains","source":35,"target":331},{"edgeType":"contains","source":14380,"target":14381},{"edgeType":"contains","source":14954,"target":15613},{"edgeType":"contains","source":8498,"target":8574},{"edgeType":"contains","source":16821,"target":16929},{"edgeType":"calls","source":1759,"target":772},{"edgeType":"contains","source":1410,"target":2101},{"edgeType":"contains","source":6122,"target":6126},{"edgeType":"contains","source":35,"target":334},{"edgeType":"contains","source":14380,"target":14382},{"edgeType":"contains","source":14954,"target":15614},{"edgeType":"contains","source":8498,"target":8577},{"edgeType":"calls","source":14948,"target":14717},{"edgeType":"calls","source":10779,"target":10772},{"edgeType":"calls","source":7013,"target":7019},{"edgeType":"contains","source":1495,"target":1581},{"edgeType":"calls","source":7739,"target":7768},{"edgeType":"contains","source":5990,"target":5991},{"edgeType":"calls","source":4127,"target":3468},{"edgeType":"contains","source":3875,"target":3907},{"edgeType":"contains","source":14314,"target":14315},{"edgeType":"contains","source":14954,"target":15615},{"edgeType":"contains","source":35,"target":333},{"edgeType":"contains","source":14577,"target":14618},{"edgeType":"calls","source":6642,"target":5836}],"nodes":[{"groupName":"","id":1,"nodeType":"Repo","repoName":"astropy#astropy#d16bfe05a744909de4b27f5875fe0d4ed41ce607"},{"id":2,"name":"","nodeType":"Package"},{"id":3,"name":"azure-pipelines.yml","nodeType":"TextFile","path":"","text":"# NOTE: this Azure configuration is used only for building the sdist and wheels.\n# It uses the OpenAstronomy azure template described in detail at\n# https://openastronomy-azure-pipelines.readthedocs.io/en/latest/\nresources:\n  repositories:\n  - repository: OpenAstronomy\n    type: github\n    endpoint: astropy\n    name: OpenAstronomy/azure-pipelines-templates\n    ref: master\n\n# NOTE: for now we only use Azure Pipelines on v* branches, tags, and main\n# only on a cron for building the source and wheel distributions. If you want to\n# make changes to this configuration via a pull request, you can *temporarily*\n# change the pr branches include trigger to just '*'\ntrigger:\n  branches:\n    include:\n    - 'v*'\n    - main\n  tags:\n    include:\n    - 'v*'\npr:\n  branches:\n    include:\n    - '*'\n\nschedules:\n  - cron: \"0 0 * * *\"\n    displayName: Daily Build for Nightly Wheels\n    branches:\n      include:\n        - main\n    always: true\n\n# Build Linux wheels using manylinux1 for compatibility with old versions\n# of pip and old platforms.\nvariables:\n  CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010\n  CIBW_MANYLINUX_I686_IMAGE: manylinux2010\n  CIBW_ARCHS_LINUX: \"auto, aarch64\"\n  CIBW_ARCHS_MACOS: \"x86_64 arm64\"\n  # Numpy 1.22 doesn't have wheels for i386, so we pin Numpy to an older version\n  # that does - this pin can be removed once we drop support for 32-bit wheels.\n  CIBW_TEST_REQUIRES: \"numpy==1.21.*\"\n  CI: true\n\njobs:\n  - template: publish.yml@OpenAstronomy\n    parameters:\n      # FIXME: we exclude the test_data_out_of_range test since it\n      # currently fails, see https://github.com/astropy/astropy/issues/10409\n      test_command: pytest -p no:warnings --astropy-header -m \"not hypothesis\" -k \"not test_data_out_of_range and not test_wcsapi_extension\" --pyargs astropy\n      test_extras: test\n\n      # NOTE: for v* tags, we auto-release to PyPI. See\n      # https://openastronomy-azure-pipelines.readthedocs.io/en/latest/publish.html\n      # for information on how to configure things on the Azure Pipelines side\n      ${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/v') }}:\n        pypi_connection_name : 'pypi_endpoint'\n\n      # If the build has run on main then upload the artifacts to the nightly feed\n      ${{ if eq(variables['Build.SourceBranchName'], 'main') }}:\n        artifact_project : 'astropy'\n        artifact_feed : 'nightly'\n        remove_local_scheme: true\n\n      targets:\n      # These builds are run always, to test PRs\n      # Only run one job on PRs, so exclude musllinux here\n      - wheels_cp39-manylinux_x86_64\n      - ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:\n\n        - sdist\n\n        # Linux wheels\n        - wheels_cp38-manylinux_i686\n        - wheels_cp39-manylinux_i686\n        # - wheels_cp310*linux_i686  # We can't build this as PyYAML doesn't have i686 wheels for 3.10 yet so the build takes too long\n        - wheels_cp38-manylinux_x86_64\n        - wheels_cp310-manylinux_x86_64\n\n        # MacOS X wheels - as noted in https://github.com/astropy/astropy/pull/12379 we deliberately\n        # do not build universal2 wheels. Note that the arm64 wheels are not actually tested so we\n        # rely on local manual testing of these to make sure they are ok.\n        - wheels_cp38*macosx_x86_64\n        - wheels_cp39*macosx_x86_64\n        - wheels_cp310*macosx_x86_64\n        - wheels_cp38*macosx_arm64\n        - wheels_cp39*macosx_arm64\n        - wheels_cp310*macosx_arm64\n\n        # Windows wheels\n        - wheels_cp38*win32\n        - wheels_cp38*win_amd64\n        - wheels_cp39*win32\n        - wheels_cp39*win_amd64\n        - wheels_cp310*win32\n        - wheels_cp310*win_amd64\n\n        # TODO: Add support for musllinux here (which seems to be new in cibuildwheel 2.2)\n        # This seems to introduce real numerical issues\n        # - wheels_cp38-musllinux_x86_64\n        # - wheels_cp39-musllinux_x86_64\n        # - wheels_cp310-musllinux_x86_64\n        # TODO: The aarch64 builds take longer than an hour to complete so get killed\n        # - wheels_cp38-manylinux_aarch64\n        # - wheels_cp39-manylinux_aarch64\n        # - wheels_cp310-manylinux_aarch64\n"},{"id":4,"name":"CHANGES.rst","nodeType":"TextFile","path":"","text":"5.0.1 (2022-01-26)\n==================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Trying to create an instance of ``astropy.coordinates.Distance`` by providing\n  both ``z`` and ``parallax`` now raises the expected ``ValueError``. [#12531]\n\n- Fixed a bug where changing the wrap angle of the longitude component of a\n  representation could raise a warning or error in certain situations. [#12556]\n\n- ``astropy.coordinates.Distance`` constructor no longer ignores the ``unit``\n  keyword when ``parallax`` is provided. [#12569]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- ``astropy.cosmology.utils.aszarr`` can now convert ``Column`` objects. [#12525]\n\n- Reading a cosmology from an ECSV will load redshift and Hubble parameter units\n  from the cosmology units module. [#12636]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fix formatting issue in ``_dump_coldefs`` and add tests for ``tabledump`` and\n  ``tableload`` convenience functions. [#12526]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- YAML can now also represent quantities and arrays with structured dtype,\n  as well as structured scalars based on ``np.void``. [#12509]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixes error when fitting multiplication or division based compound models\n  where the sub-models have different output units. [#12475]\n\n- Bugfix for incorrectly initialized and filled ``parameters`` data for ``Spline1D`` model. [#12523]\n\n- Bugfix for ``keyerror`` thrown by ``Model.input_units_equivalencies`` when\n  used on ``fix_inputs`` models which have no set unit equivalencies. [#12597]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- ``astropy.table.Table.keep_columns()`` and\n  ``astropy.table.Table.remove_columns()`` now work with generators of column\n  names. [#12529]\n\n- Avoid duplicate storage of info in serialized columns if the column\n  used to serialize already can hold that information. [#12607]\n\nastropy.timeseries\n^^^^^^^^^^^^^^^^^^\n\n- Fixed edge case bugs which emerged when using ``aggregate_downsample`` with custom bins. [#12527]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Structured units can be serialized to/from yaml. [#12492]\n\n- Fix bad typing problems by removing interaction with ``NDArray.__class_getitem__``. [#12511]\n\n- Ensure that ``Quantity.to_string(format='latex')`` properly typesets exponents\n  also when ``u.quantity.conf.latex_array_threshold = -1`` (i.e., when the threshold\n  is taken from numpy). [#12573]\n\n- Structured units can now be copied with ``copy.copy`` and ``copy.deepcopy``\n  and also pickled and unpicked also for ``protocol`` >= 2.\n  This does not work for big-endian architecture with older ``numpy<1.21.1``. [#12583]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Ensure that a ``Masked`` instance can be used to initialize (or viewed\n  as) a ``numpy.ma.Maskedarray``. [#12482]\n\n- Ensure ``Masked`` also works with numpy >=1.22, which has a keyword argument\n  name change for ``np.quantile``. [#12511]\n\n- ``astropy.utils.iers.LeapSeconds.auto_open()`` no longer emits unnecessary\n  warnings when ``astropy.utils.iers.conf.auto_max_age`` is set to ``None``. [#12713]\n\n\n5.0 (2021-11-15)\n================\n\n\nNew Features\n------------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Added dealiasing support to ``convolve_fft``. [#11495]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Added missing coordinate transformations where the starting and ending frames\n  are the same (i.e., loopback transformations). [#10909]\n\n- Allow negation, multiplication and division also of representations that\n  include a differential (e.g., ``SphericalRepresentation`` with a\n  ``SphericalCosLatDifferential``).  For all operations, the outcome is\n  equivalent to transforming the representation and differential to cartesian,\n  then operating on those, and transforming back to the original representation\n  (except for ``UnitSphericalRepresentation``, which will return a\n  ``SphericalRepresentation`` if there is a scale change). [#11470]\n\n- ``RadialRepresentation.transform`` can work with a multiplication matrix only.\n  All other matrices still raise an exception. [#11576]\n\n- ``transform`` methods are added to ``BaseDifferential`` and ``CartesianDifferential``.\n  All transform methods on Representations now delegate transforming differentials\n  to the differential objects. [#11654]\n\n- Adds new ``HADec`` built-in frame with transformations to/from ``ICRS`` and ``CIRS``.\n  This frame complements ``AltAz`` to give observed coordinates (hour angle and declination)\n  in the ``ITRS`` for an equatorially mounted telescope. [#11676]\n\n- ``SkyCoord`` objects now have a ``to_table()`` method, which allows them to be\n  converted to a ``QTable``. [#11743]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Cosmologies now store metadata in a mutable parameter ``meta``.\n  The initialization arguments ``name`` and ``meta`` are keyword-only. [#11542]\n\n- A new unit, ``redshift``, is defined. It is a dimensionless unit to distinguish\n  redshift quantities from other non-redshift values. For compatibility with\n  dimensionless quantities the equivalency ``dimensionless_redshift`` is added.\n  This equivalency is enabled by default. [#11786]\n\n- Add equality operator for comparing Cosmology instances. Comparison is done on\n  all immutable fields (this excludes 'meta').\n\n  Now the following will work:\n\n  .. code-block:: python\n\n      >>> from astropy.cosmology import Planck13, Planck18\n      >>> Planck13 == Planck18\n      False\n\n      >>> Planck18 == Planck18\n      True [#11813]\n\n- Added ``read/write`` methods to Cosmology using the Unified I/O registry.\n  Now custom file format readers, writers, and format-identifier functions\n  can be registered to read, write, and identify, respectively, Cosmology\n  objects. Details are discussed in an addition to the docs. [#11948]\n\n- Added ``to_format/from_format`` methods to Cosmology using the Unified I/O\n  registry. Now custom format converters and format-identifier functions\n  can be registered to transform Cosmology objects.\n  The transformation between Cosmology and dictionaries is pre-registered.\n  Details are discussed in an addition to the docs. [#11998]\n\n- Added units module for defining and collecting cosmological units and\n  equivalencies. [#12092]\n\n- Flat cosmologies are now set by a mixin class, ``FlatCosmologyMixin`` and its\n  FLRW-specific subclass ``FlatFLRWMixin``. All ``FlatCosmologyMixin`` are flat,\n  but not all flat cosmologies are instances of ``FlatCosmologyMixin``. As\n  example, ``LambdaCDM`` **may** be flat (for the a specific set of parameter\n  values),  but ``FlatLambdaCDM`` **will** be flat.\n\n  Cosmology parameters are now descriptors. When accessed from a class they\n  transparently stores information, like the units and accepted equivalencies.\n  On a cosmology instance, the descriptor will return the parameter value.\n  Parameters can have custom ``getter`` methods.\n\n  Cosmological equality is refactored to check Parameters (and the name)\n  A new method, ``is_equivalent``, is added to check Cosmology equivalence, so\n  a ``FlatLambdaCDM`` and flat ``LambdaCDM`` are equivalent. [#12136]\n\n- Replaced ``z = np.asarray(z)`` with ``z = u.Quantity(z, u.dimensionless_unscaled).value``\n  in Cosmology methods. Input of values with incorrect units raises a UnitConversionError\n  or TypeError. [#12145]\n\n- Cosmology Parameters allow for custom value setters.\n  Values can be set once, but will error if set a second time.\n  If not specified, the default setter is used, which will assign units\n  using the Parameters ``units`` and ``equivalencies`` (if present).\n  Alternate setters may be registered with Parameter to be specified by a str,\n  not a decorator on the Cosmology. [#12190]\n\n- Cosmology instance conversion to dict now accepts keyword argument ``cls`` to\n  determine dict type, e.g. ``OrderedDict``. [#12209]\n\n- A new equivalency is added between redshift and the Hubble parameter and values\n  with units of little-h.\n  This equivalency is also available in the catch-all equivalency ``with_redshift``. [#12211]\n\n- A new equivalency is added between redshift and distance -- comoving, lookback,\n  and luminosity. This equivalency is also available in the catch-all equivalency\n  ``with_redshift``. [#12212]\n\n- Register Astropy Table into Cosmology's ``to/from_format`` I/O, allowing\n  a Cosmology instance to be parsed from or converted to a Table instance.\n  Also adds the ``__astropy_table__`` method allowing ``Table(cosmology)``. [#12213]\n\n- The WMAP1 and WMAP3 are accessible as builtin cosmologies. [#12248]\n\n- Register Astropy Model into Cosmology's ``to/from_format`` I/O, allowing\n  a Cosmology instance to be parsed from or converted to a Model instance. [#12269]\n\n- Register an ECSV reader and writer into Cosmology's I/O, allowing a Cosmology\n  instance to be read from from or written to an ECSV file. [#12321]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Added new way to specify the dtype for tables that are read: ``converters``\n  can specify column names with wildcards. [#11892]\n\n- Added a new ``astropy.io.ascii.Mrt`` class to write tables in the American\n  Astronomical Society Machine-Readable Table format,\n  including documentation and tests for the same. [#11897, #12301, #12302]\n\n- When writing, the input data are no longer copied, improving performance.\n  Metadata that might be changed, such as format and serialization\n  information, is copied, hence users can continue to count on no\n  changes being made to the input data. [#11919]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Add Parquet serialization of Tables with pyarrow, including metadata support and\n  columnar access. [#12215]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Added fittable spline models to ``modeling``. [#11634]\n\n- Extensive refactor of ``BoundingBox`` for better usability and maintainability. [#11930]\n\n- Added ``CompoundBoundingBox`` feature to ``~astropy.modeling``, which allows more flexibility in\n  defining bounding boxes for models that are applied to images with many slices. [#11942]\n\n- Improved parameter support for ``astropy.modeling.core.custom_model`` created models. [#11984]\n\n- Added the following trigonometric models and linked them to their appropriate inverse models:\n    * ``Cosine1D`` [#12158]\n    * ``Tangent1D``\n    * ``ArcSine1D``\n    * ``ArcCosine1D``\n    * ``ArcTangent1D`` [#12185]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Added a new method ``Table.update()`` which does a dictionary-style update of a\n  ``Table`` by adding or replacing columns. [#11904]\n\n- Masked quantities are now fully supported in tables.  This includes ``QTable``\n  automatically converting ``MaskedColumn`` instances to ``MaskedQuantity``,\n  and ``Table`` doing the reverse. [#11914]\n\n- Added new keyword arguments ``keys_left`` and ``keys_right`` to the table ``join``\n  function to support joining tables on key columns with different names. In\n  addition the new keywords can accept a list of column-like objects which are\n  used as the match keys. This allows joining on arbitrary data which are not part\n  of the tables being joined. [#11954]\n\n- Formatting of any numerical values in the output of ``Table.info()`` and\n  ``Column.info()`` has been improved. [#12022]\n\n- It is now possible to add dask arrays as columns in tables\n  and have them remain as dask arrays rather than be converted\n  to Numpy arrays. [#12219]\n\n- Added a new registry for mixin handlers, which can be used\n  to automatically convert array-like Python objects into\n  mixin columns when assigned to a table column. [#12219]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Adds a new method ``earth_rotation_angle`` to calculate the Local Earth Rotation Angle.\n  Also adjusts Local Sidereal Time for the Terrestrial Intermediate Origin (``TIO``)\n  and adds a rigorous correction for polar motion. The ``TIO`` adjustment is approximately\n  3 microseconds per century from ``J2000`` and the polar motion correction is at most\n  about +/-50 nanoseconds. For models ``IAU1982`` and ``IAU1994``, no such adjustments are\n  made as they pre-date the TIO concept. [#11680]\n\nastropy.timeseries\n^^^^^^^^^^^^^^^^^^\n\n- A custom binning scheme is now available in ``aggregate_downsample``.\n  It allows ``time_bin_start`` and ``time_bin_size`` to be arrays, and adds\n  an optional ``time_bin_end``.\n  This scheme mirrors the API for ``BinnedTimeSeries``. [#11266]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- ``Quantity`` gains a ``__class_getitem__`` to create unit-aware annotations\n   with the syntax ``Quantity[unit or physical_type, shape, numpy.dtype]``.\n   If the python version is 3.9+ or ``typing_extensions`` is installed,\n   these are valid static type annotations. [#10662]\n\n- Each physical type is added to ``astropy.units.physical``\n  (e.g., ``physical.length`` or ``physical.electrical_charge_ESU``).\n  The attribute-accessible names (underscored, without parenthesis) also\n  work with ``astropy.units.physical.get_physical_type``. [#11691]\n\n- It is now possible to have quantities based on structured arrays in\n  which the unit has matching structure, giving each field its own unit,\n  using units constructed like ``Unit('AU,AU/day')``. [#11775]\n\n- The milli- prefix has been added to ``astropy.units.Angstrom``. [#11788]\n\n- Added attributes ``base``, ``coords``, and ``index`` and method ``copy()`` to\n  ``QuantityIterator`` to match ``numpy.ndarray.flatiter``. [#11796]\n\n- Added \"angular frequency\" and \"angular velocity\" as aliases for the \"angular\n  speed\" physical type. [#11865]\n\n- Add light-second to units of length [#12128]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- The ``astropy.utils.deprecated_renamed_argument()`` decorator now supports\n  custom warning messages. [#12305]\n\n- The NaN-aware numpy functions such as ``np.nansum`` now work on Masked\n  arrays, with masked values being treated as NaN, but without raising\n  warnings or exceptions. [#12454]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Added a feature so that SphericalCircle will accept center parameter as a SkyCoord object. [#11790]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- ``astropy.wcs.utils.obsgeo_to_frame`` has been added to convert the obsgeo coordinate\n  array on ``astropy.wcs.WCS`` objects to an ``ITRS`` coordinate frame instance. [#11716]\n\n- Updated bundled ``WCSLIB`` to version 7.7 with several bugfixes. [#12034]\n\n\nAPI Changes\n-----------\n\nastropy.config\n^^^^^^^^^^^^^^\n\n- ``update_default_config`` and ``ConfigurationMissingWarning`` are deprecated. [#11502]\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\n- Removed deprecated ``astropy.constants.set_enabled_constants`` context manager. [#12105]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Positions for the Moon using the 'builtin' ephemeris now use the new\n  ``erfa.moon98`` function instead of our own implementation of the Meeus\n  algorithm. As this also corrects a misunderstanding of the frame returned by\n  the Meeus, this improves the agreement with the JPL ephemeris from about 30 to\n  about 6 km rms. [#11753]\n\n- Removed deprecated ``representation`` attribute from\n  ``astropy.coordinates.BaseCoordinateFrame`` class. [#12257]\n\n- ``SpectralQuantity`` and ``SpectralCoord`` ``.to_value`` method can now be called without\n  ``unit`` argument in order to maintain a consistent interface with ``Quantity.to_value`` [#12440]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- ``z_at_value`` now works with arrays for all arguments (except ``func``,\n  ``verbose``, and ``method``). Consequently, ``coordinates.Distance.z`` can\n  be used when Distance is an array. [#11778]\n\n- Remove deprecation warning and error remapping in ``Cosmology.clone``.\n  Now unknown arguments will raise a ``TypeError``, not an ``AttributeError``. [#11785]\n\n- The ``read/write`` and ``to/from_format`` Unified I/O registries are separated\n  and apply only to ``Cosmology``. [#12015]\n\n- Cosmology parameters in ``cosmology.parameters.py`` now have units,\n  where applicable. [#12116]\n\n- The function ``astropy.cosmology.utils.inf_like()`` is deprecated. [#12175]\n\n- The function ``astropy.cosmology.utils.vectorize_if_needed()`` is deprecated.\n  A new function ``astropy.cosmology.utils.vectorize_redshift_method()`` is added\n  as replacement. [#12176]\n\n- Cosmology base class constructor now only accepts arguments ``name`` and ``meta``.\n  Subclasses should add relevant arguments and not pass them to the base class. [#12191]\n\nastropy.io\n^^^^^^^^^^\n\n- When ``astropy`` raises an ``OSError`` because a file it was told to write\n  already exists, the error message now always suggests the use of the\n  ``overwrite=True`` argument. The wording is now consistent for all I/O formats. [#12179]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Removed deprecated ``overwrite=None`` option for\n  ``astropy.io.ascii.ui.write()``. Overwriting existing files now only happens if\n  ``overwrite=True``. [#12171]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- The internal class _CardAccessor is no longer registered as a subclass of\n  the Sequence or Mapping ABCs. [#11923]\n\n- The deprecated ``clobber`` argument will be removed from the\n  ``astropy.io.fits`` functions in version 5.1, and the deprecation warnings now\n  announce that too. [#12311]\n\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\n- The ``write`` function now is allowed to return possible content results, which\n  means that custom writers could, for example, create and return an instance of\n  some container class rather than a file on disk. [#11916]\n\n- The registry functions are refactored into a class-based system.\n  New Read-only, write-only, and read/write registries can be created.\n  All functions accept a new argument ``registry``, which if not specified,\n  defaults to the global default registry. [#12015]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Deprecated the ``pedantic`` keyword argument in the\n  ``astropy.io.votable.table.parse`` function and the corresponding configuration\n  setting. It has been replaced by the ``verify`` option. [#12129]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Refactored how ``astropy.modeling.Model`` handles model evaluation in order to better\n  organize the code. [#11931]\n\n- Removed the following deprecated modeling features:\n      ``astropy.modeling.utils.ExpressionTree`` class,\n      ``astropy.modeling.functional_models.MexicanHat1D`` model,\n      ``astropy.modeling.functional_models.MexicanHat2D`` model,\n      ``astropy.modeling.core.Model.inputs`` setting in model initialize,\n      ``astropy.modeling.core.CompoundModel.inverse`` setting in model initialize, and\n      ``astropy.modeling.core.CompoundModel.both_inverses_exist()`` method. [#11978]\n\n- Deprecated the ``AliasDict`` class in ``modeling.utils``. [#12411]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Removed ``block_reduce`` and ``block_replicate`` functions from\n  ``nddata.utils``. These deprecated functions in ``nddata.utils`` were\n  moved to ``nddata.blocks``. [#12288]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Removed the following deprecated features from ``astropy.stats``:\n\n  * ``conf`` argument for ``funcs.binom_conf_interval()`` and\n    ``funcs.binned_binom_proportion()``,\n  * ``conflevel`` argument for ``funcs.poisson_conf_interval()``, and\n  * ``conf_lvl`` argument for ``jackknife.jackknife_stats()``. [#12200]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Printing a ``Table`` now shows the qualified class name of mixin columns in the\n  dtype header row  instead of \"object\". This applies to all the ``Table`` formatted output\n  methods whenever ``show_dtype=True`` is selected. [#11660]\n\n- The 'overwrite' argument has been added to the jsviewer table writer.\n  Overwriting an existing file requires 'overwrite' to be True. [#11853]\n\n- The 'overwrite' argument has been added to the pandas table writers.\n  Overwriting an existing file requires 'overwrite' to be True. [#11854]\n\n- The table ``join`` function now accepts only the first four arguments ``left``,\n  ``right``, ``keys``, and ``join_type`` as positional arguments. All other\n  arguments must be supplied as keyword arguments. [#11954]\n\n- Adding a dask array to a Table will no longer convert\n  that dask to a Numpy array, so accessing t['dask_column']\n  will now return a dask array instead of a Numpy array. [#12219]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Along with the new method ``earth_rotation_angle``, ``sidereal_time`` now accepts\n  an ``EarthLocation`` as the ``longitude`` argument. [#11680]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Unit ``littleh`` and equivalency ``with_H0`` have been moved to the\n  ``cosmology`` module and are deprecated from ``astropy.units``. [#12092]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- ``astropy.utils.introspection.minversion()`` now uses\n  ``importlib.metadata.version()``. Therefore, its ``version_path`` keyword is no\n  longer used and deprecated. This keyword will be removed in a future release. [#11714]\n\n- Updated ``utils.console.Spinner`` to better resemble the API of\n  ``utils.console.ProgressBar``, including an ``update()`` method and\n  iterator support. [#11772]\n\n- Removed deprecated ``check_hashes`` in ``check_download_cache()``. The function also\n  no longer returns anything. [#12293]\n\n- Removed unused ``download_cache_lock_attempts`` configuration item in\n  ``astropy.utils.data``. Deprecation was not possible. [#12293]\n\n- Removed deprecated ``hexdigest`` keyword from ``import_file_to_cache()``. [#12293]\n\n- Setting ``remote_timeout`` configuration item in ``astropy.utils.data`` to 0 will\n  no longer disable download from the Internet; Set ``allow_internet`` configuration\n  item to ``False`` instead. [#12293]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Removed deprecated ``imshow_only_kwargs`` keyword from ``imshow_norm``. [#12290]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Move complex logic from ``HighLevelWCSMixin.pixel_to_world`` and\n  ``HighLevelWCSMixin.world_to_pixel`` into the helper functions\n  ``astropy.wcs.wcsapi.high_level_api.high_level_objects_to_values`` and\n  ``astropy.wcs.wcsapi.high_level_api.values_to_high_level_objects`` to allow\n  reuse in other places. [#11950]\n\n\nBug Fixes\n---------\n\nastropy.config\n^^^^^^^^^^^^^^\n\n- ``generate_config`` no longer outputs wrong syntax for list type. [#12037]\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\n- Fixed a bug where an older constants version cannot be set directly after\n  astropy import. [#12084]\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Passing an ``array`` argument for any Kernel1D or Kernel2D subclasses (with the\n  exception of CustomKernel) will now raise a ``TypeError``. [#11969]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- If a ``Table`` containing a ``SkyCoord`` object as a column is written to a\n  FITS, ECSV or HDF5 file then any velocity information that might be present\n  will be retained. [#11750]\n\n- The output of ``SkyCoord.apply_space_motion()`` now always has the same\n  differential type as the ``SkyCoord`` itself. [#11932]\n\n- Fixed bug where Angle, Latitude and Longitude with NaN values could not be printed. [#11943]\n\n- Fixed a bug with the transformation from ``PrecessedGeocentric`` to ``GCRS``\n  where changes in ``obstime``, ``obsgeoloc``, or ``obsgeovel`` were ignored.\n  This bug would also affect loopback transformations from one ``PrecessedGeocentric``\n  frame to another ``PrecessedGeocentric`` frame. [#12152]\n\n- Fixed a bug with the transformations between ``TEME`` and ``ITRS`` or between ``TEME``\n  and itself where a change in ``obstime`` was ignored. [#12152]\n\n- Avoid unnecessary transforms through CIRS for AltAz and HADec and\n  use ICRS as intermediate frame for these transformations instead. [#12203]\n\n- Fixed a bug where instantiating a representation with a longitude component\n  could mutate input provided for that component even when copying is specified. [#12307]\n\n- Wrapping an ``Angle`` array will now ignore NaN values instead of attempting to wrap\n  them, which would produce unexpected warnings/errors when working with coordinates\n  and representations due to internal broadcasting. [#12317]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Dictionaries for in-built cosmology realizations are not altered by creating\n  the realization and are also made immutable. [#12278]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Prevent zero-byte writes for FITS binary tables to\n  speed up writes on the Lustre filesystem. [#11955]\n\n- Enable ``json.dump`` for FITS_rec with variable length (VLF) arrays. [#11957]\n\n- Add support for reading and writing int8 images [#11996]\n\n- Ensure header passed to ``astropy.io.fits.CompImageHDU`` does not need to contain\n  standard cards that can be automatically generated, such as ``BITPIX`` and ``NAXIS``. [#12061]\n\n- Fixed a bug where ``astropy.io.fits.HDUDiff`` would ignore the ``ignore_blank_cards``\n  keyword argument. [#12122]\n\n- Open uncompressed file even if extension says it's compressed [#12135]\n\n- Fix the computation of the DATASUM in a ``CompImageHDU`` when the data is >1D. [#12138]\n\n- Reading files where the SIMPLE card is present but with an invalid format now\n  issues a warning instead of raising an exception [#12234]\n\n- Convert UNDEFINED to None when iterating over card values. [#12310]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Update ASDF tag versions in ExtensionType subclasses to match ASDF Standard 1.5.0. [#11986]\n\n- Fix ASDF serialization of model inputs and outputs and add relevant assertion to\n  test helper. [#12381]\n\n- Fix bug preventing ASDF serialization of bounding box for models with only one input. [#12385]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Now accepting UCDs containing phot.color. [#11982]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Added ``Parameter`` descriptions to the implemented models which were\n  missing. [#11232]\n\n- The ``separable`` property is now correctly set on models constructed with\n  ``astropy.modeling.custom_model``. [#11744]\n\n- Minor bugfixes and improvements to modeling including the following:\n      * Fixed typos and clarified several errors and their messages throughout\n        modeling.\n      * Removed incorrect try/except blocks around scipy code in\n        ``convolution.py`` and ``functional_models.py``.\n      * Fixed ``Ring2D`` model's init to properly accept all combinations\n        of ``r_in``, ``r_out``, and ``width``.\n      * Fixed bug in ``tau`` validator for the ``Logarithmic1D`` and\n        ``Exponential1D`` models when using them as model sets.\n      * Fixed ``copy`` method for ``Parameter`` in order to prevent an\n        automatic ``KeyError``, and fixed ``bool`` for ``Parameter`` so\n        that it functions with vector values.\n      * Removed unreachable code from ``Parameter``, the ``_Tabular`` model,\n        and the ``Drude1D`` model.\n      * Fixed validators in ``Drude1D`` model so that it functions in a\n        model set.\n      * Removed duplicated code from ``polynomial.py`` for handing of\n        ``domain`` and ``window``.\n      * Fixed the ``Pix2Sky_HEALPixPolar`` and ``Sky2Pix_HEALPixPolar`` modes\n        so that their ``evaluate`` and ``inverse`` methods actually work\n        without raising an error. [#12232]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Ensure that the ``wcs=`` argument to ``NDData`` is always parsed into a high\n  level WCS object. [#11985]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Fixed a bug in sigma clipping where the bounds would not be returned for\n  completely empty or masked data. [#11994]\n\n- Fixed a bug in ``biweight_midvariance`` and ``biweight_scale`` where\n  output data units would be dropped for constant data and where the\n  result was a scalar NaN. [#12146]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Ensured that ``MaskedColumn.info`` is propagated in all cases, so that when\n  tables are sliced, writing will still be as requested on\n  ``info.serialize_method``. [#11917]\n\n- ``table.conf.replace_warnings`` and ``table.jsviewer.conf.css_urls`` configuration\n  items now have correct ``'string_list'`` type. [#12037]\n\n- Fixed an issue where initializing from a list of dict-like rows (Mappings) did\n  not work unless the row values were instances of ``dict``. Now any object that\n  is an instance of the more general ``collections.abc.Mapping`` will work. [#12417]\n\nastropy.uncertainty\n^^^^^^^^^^^^^^^^^^^\n\n- Ensure that scalar ``QuantityDistribution`` unit conversion in ufuncs\n  works properly again. [#12471]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Add quantity support for ``scipy.special`` dimensionless functions\n  erfinv, erfcinv, gammaln and loggamma. [#10934]\n\n- ``VOUnit.to_string`` output is now compliant with IVOA VOUnits 1.0 standards. [#11565]\n\n- Units initialization with unicode has been expanded to include strings such as\n  'M☉' and 'e⁻'. [#11827]\n\n- Give a more informative ``NotImplementedError`` when trying to parse a unit\n  using an output-only format such as 'unicode' or 'latex'. [#11829]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Fixed a bug in ``get_readable_fileobj`` that prevented the unified file read\n  interface from closing ASCII files. [#11809]\n\n- The function ``astropy.utils.decorators.deprecated_attribute()`` no longer\n  ignores its ``message``, ``alternative``, and ``pending`` arguments. [#12184]\n\n- Ensure that when taking the minimum or maximum of a ``Masked`` array,\n  any masked NaN values are ignored. [#12454]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- The tick labelling for radians has been fixed to remove a redundant ``.0`` in\n  the label for integer multiples of pi at 2pi and above. [#12221]\n\n- Fix a bug where non-``astropy.wcs.WCS`` WCS instances were not accepted in\n  ``WCSAxes.get_transform``. [#12286]\n\n- Fix compatibility with Matplotlib 3.5 when using the ``grid_type='contours'``\n  mode for drawing grid lines. [#12447]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Enabled ``SlicedLowLevelWCS.pixel_to_world_values`` to handle slices including\n  non-``int`` integers, e.g. ``numpy.int64``. [#11980]\n\n\nOther Changes and Additions\n---------------------------\n\n- In docstrings, Sphinx cross-reference targets now use intersphinx, even if the\n  target is an internal link (``link`` is now ``'astropy:link``).\n  When built in Astropy these links are interpreted as internal links. When built\n  in affiliate packages, the link target is set by the key 'astropy' in the\n  intersphinx mapping. [#11690]\n\n- Made PyYaml >= 3.13 a strict runtime dependency. [#11903]\n\n- Minimum version of required Python is now 3.8. [#11934]\n\n- Minimum version of required Scipy is now 1.3. [#11934]\n\n- Minimum version of required Matplotlib is now 3.1. [#11934]\n\n- Minimum version of required Numpy is now 1.18. [#11935]\n\n- Fix deprecation warnings with Python 3.10 [#11962]\n\n- Speed up ``minversion()`` in cases where a module with a ``__version__``\n  attribute is passed. [#12174]\n\n- ``astropy`` now requires ``packaging``. [#12199]\n\n- Updated the bundled CFITSIO library to 4.0.0. When compiling with an external\n  library, version 3.35 or later is required. [#12272]\n\n\n4.3.1 (2021-08-11)\n==================\n\nBug Fixes\n---------\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- In ``fits.io.getdata`` do not fall back to first non-primary extension when\n  user explicitly specifies an extension. [#11860]\n\n- Ensure multidimensional masked columns round-trip properly to FITS. [#11911]\n\n- Ensure masked times round-trip to FITS, even if multi-dimensional. [#11913]\n\n- Raise ``ValueError`` if an ``np.float32`` NaN/Inf value is assigned to a\n  header keyword. [#11922]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed bug in ``fix_inputs`` handling of bounding boxes. [#11908]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix an error when converting to pandas any ``Table`` subclass that\n  automatically adds a table index when the table is created. An example is a\n  binned ``TimeSeries`` table. [#12018]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Ensure that unpickling quantities and units in new sessions does not change\n  hashes and thus cause problems with (de)composition such as getting different\n  answers from the ``.si`` attribute. [#11879]\n\n- Fixed cannot import name imperial from astropy.units namespace. [#11977]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Ensure any ``.info`` on ``Masked`` instances is propagated correctly when\n  viewing or slicing. As a consequence, ``MaskedQuantity`` can now be correctly\n  written to, e.g., ECSV format with ``serialize_method='data_mask'``. [#11910]\n\n\n4.3 (2021-07-26)\n================\n\nNew Features\n------------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Change padding sizes for ``fft_pad`` in ``convolve_fft`` from powers of\n  2 only to scipy-optimized numbers, applied separately to each dimension;\n  yielding some performance gains and avoiding potential large memory\n  impact for certain multi-dimensional inputs. [#11533]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Adds the ability to create topocentric ``CIRS`` frames. Using these,\n  ``AltAz`` calculations are now accurate down to the milli-arcsecond\n  level. [#10994]\n\n- Adds a direct transformation from ``ICRS`` to ``AltAz`` frames. This\n  provides a modest speedup of approximately 10 percent. [#11079]\n\n- Adds new ``WGS84GeodeticRepresentation``, ``WGS72GeodeticRepresentation``,\n  and ``GRS80GeodeticRepresentation``. These are mostly for use inside\n  ``EarthLocation`` but can also be used to convert between geocentric\n  (cartesian) and different geodetic representations directly. [#11086]\n\n- ``SkyCoord.guess_from_table`` now also searches for differentials in the table.\n  In addition, multiple regex matches can be resolved when they are exact\n  component names, e.g. having both columns “dec” and “pm_dec” no longer errors\n  and will be included in the SkyCoord. [#11417]\n\n- All representations now have a ``transform`` method, which allows them to be\n  transformed by a 3x3 matrix in a Cartesian basis. By default, transformations\n  are routed through ``CartesianRepresentation``. ``SphericalRepresentation`` and\n  ``PhysicssphericalRepresentation`` override this for speed and to prevent NaN\n  leakage from the distance to the angular components.\n  Also, the functions ``is_O3`` and ``is_rotation`` have been added to\n  ``matrix_utities`` for checking whether a matrix is in the O(3) group or is a\n  rotation (proper or improper), respectively. [#11444]\n\n- Moved angle formatting and parsing utilities to\n  ``astropy.coordinates.angle_formats``.\n  Added new functionality to ``astropy.coordinates.angle_utilities`` for\n  generating points on or in spherical surfaces, either randomly or on a grid. [#11628]\n\n- Added a new method to ``SkyCoord``, ``spherical_offsets_by()``, which is the\n  conceptual inverse of ``spherical_offsets_to()``: Given angular offsets in\n  longitude and latitude, this method returns a new coordinate with the offsets\n  applied. [#11635]\n\n- Refactor conversions between ``GCRS`` and ``CIRS,TETE`` for better accuracy\n  and substantially improved speed. [#11069]\n\n- Also refactor ``EarthLocation.get_gcrs`` for an increase in performance of\n  an order of magnitude, which enters as well in getting observed positions of\n  planets using ``get_body``. [#11073]\n\n- Refactored the usage of metaclasses in ``astropy.coordinates`` to instead use\n  ``__init_subclass__`` where possible. [#11090]\n\n- Removed duplicate calls to ```transform_to``` from ```match_to_catalog_sky```\n  and ```match_to_catalog_3d```, improving their performance. [#11449]\n\n- The new DE440 and DE440s ephemerides are now available via shortcuts 'de440'\n  and 'de440s'.  The DE 440s ephemeris will probably become the default\n  ephemeris when chosing 'jpl' in 5.0. [#11601]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Cosmology parameter dictionaries now also specify the Cosmology class to which\n  the parameters correspond. For example, the dictionary for\n  ``astropy.cosmology.parameters.Planck18`` has the added key-value pair\n  (\"cosmology\", \"FlatLambdaCDM\"). [#11530]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Added support for reading and writing ASCII tables in QDP (Quick and Dandy\n  Plotter) format. [#11256]\n\n- Added support for reading and writing multidimensional column data (masked and\n  unmasked) to ECSV. Also added formal support for reading and writing object-type\n  column data which can contain items consisting of lists, dicts, and basic scalar\n  types. This can be used to store columns of variable-length arrays. Both of\n  these features use JSON to convert the object to a string that is stored in the\n  ECSV output. [#11569, #11662, #11720]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Added ``append`` keyword to append table objects to an existing FITS file [#2632, #11149]\n\n- Check that the SIMPLE card is present when opening a file, to ensure that the\n  file is a valid FITS file and raise a better error when opening a non FITS\n  one. ``ignore_missing_simple`` can be used to skip this verification. [#10895]\n\n- Expose ``Header.strip`` as a public method, to remove the most common\n  structural keywords. [#11174]\n\n- Enable the use of ``os.PathLike`` objects when dealing with (mainly FITS) files. [#11580]\n\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\n- Readers and writers can now set a priority, to assist with resolving which\n  format to use. [#11214]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Version 1.4 VOTables now use the VOUnit format specification. [#11032]\n\n- When reading VOTables using the Unified File Read/Write Interface (i.e. using\n  the ``Table.read()`` or ``QTable.read()`` functions) it is now possible to\n  specify all keyword arguments that are valid for\n  ``astropy.io.votable.table.parse()``. [#11643]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Added a state attribute to models to allow preventing the synching of\n  constraint values from the constituent models. This synching can\n  greatly slow down fitting if there are large numbers of fit parameters.\n  model.sync_constraints = True means check constituent model constraints\n  for compound models every time the constraint is accessed, False, do not.\n  Fitters that support constraints will set this to False on the model copy\n  and then set back to True when the fit is complete before returning. [#11365]\n\n- The ``convolve_models_fft`` function implements model convolution so that one\n  insures that the convolution remains consistent across multiple different\n  inputs. [#11456]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Prevent unnecessary copies of the data during ``NDData`` arithmetic when units\n  need to be added. [#11107]\n\n- NDData str representations now show units, if present. [#11553]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Added the ability to specify stdfunc='mad_std' when doing sigma clipping,\n  which will use a built-in function and lead to significant performance\n  improvements if cenfunc is 'mean' or 'median'. [#11664]\n\n\n- Significantly improved the performance of sigma clipping when cenfunc and\n  stdfunc are passed as strings and the ``grow`` option is not used. [#11219]\n\n- Improved performance of ``bayesian_blocks()`` by removing one ``np.log()``\n  call [#11356]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Add table attributes to include or exclude columns from the output when\n  printing a table. This functionality includes a context manager to\n  include/exclude columns temporarily. [#11190]\n\n- Improved the string representation of objects related to ``Table.indices`` so\n  they now indicate the object type and relevant attributes. [#11333]\n\nastropy.timeseries\n^^^^^^^^^^^^^^^^^^\n\n- An exception is raised when ``n_bins`` is passed as an argument while\n  any of the parameters ``time_bin_start`` or ``time_bin_size`` is not\n  scalar. [#11463]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- The ``physical_type`` attributes of each unit are now objects of the (new)\n  ``astropy.units.physical.PhysicalType`` class instead of strings and the\n  function ``astropy.units.physical.get_physical_type`` can now translate\n  strings to these objects. [#11204]\n\n-  The function ``astropy.units.physical.def_physical_type`` was created to\n   either define entirely new physical types, or to add more physical type\n   names to an existing physical types. [#11204]\n\n- ``PhysicalType``'s can be operated on using operations multiplication,\n  division, and exponentiation are to facilitate dimensional analysis. [#11204]\n\n- It is now possible to define aliases for units using\n  ``astropy.units.set_enabled_aliases``. This can be used when reading files\n  that have misspelled units. [#11258]\n\n- Add a new \"DN\" unit, ``units.dn`` or ``units.DN``, representing data number\n  for a detector. [#11591]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Added ``ssl_context`` and ``allow_insecure`` options to ``download_file``,\n  as well as the ability to optionally use the ``certifi`` package to provide\n  root CA certificates when downloading from sites secured with\n  TLS/SSL. [#10434]\n\n- ``astropy.utils.data.get_pkg_data_path`` is publicly scoped (previously the\n  private function ``_find_pkg_data_path``) for obtaining file paths without\n  checking if the file/directory exists, as long as the package and module\n  do. [#11006]\n\n- Deprecated ``astropy.utils.OrderedDescriptor`` and\n  ``astropy.utils.OrderedDescriptorContainer``, as new features in Python 3\n  make their use less compelling. [#11094, #11099]\n\n- ``astropy.utils.masked`` provides a new ``Masked`` class/factory that can be\n  used to represent masked ``ndarray`` and all its subclasses, including\n  ``Quantity`` and its subclasses.  These classes can be used inside\n  coordinates, but the mask is not yet exposed.  Generally, the interface should\n  be considered experimental. [#11127, #11792]\n\n- Add new ``utils.parsing`` module to with helper wrappers around\n  ``ply``. [#11227]\n\n- Change the Time and IERS leap second handling so that the leap second table is\n  updated only when a Time transform involving UTC is performed. Previously this\n  update check was done the first time a ``Time`` object was created, which in\n  practice occured when importing common astropy subpackages like\n  ``astropy.coordinates``. Now you can prevent querying internet resources (for\n  instance on a cluster) by setting ``iers.conf.auto_download = False``. This\n  can  be done after importing astropy but prior to performing any ``Time``\n  scale transformations related to UTC. [#11638]\n\n\n- Added a new module at ``astropy.utils.compat.optional_deps`` to consolidate\n  the definition of ``HAS_x`` optional dependency flag variables,\n  like ``HAS_SCIPY``. [#11490]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Add IVOA UCD mappings for some FITS WCS keywords commonly used in solar\n  physics. [#10965]\n\n- Add ``STOKES`` FITS WCS keyword to the IVOA UCD mapping. [#11236]\n\n- Updated bundled version of WCSLIB to version 7.6. See\n  https://www.atnf.csiro.au/people/mcalabre/WCS/CHANGES for a list of\n  included changes. [#11549]\n\n\nAPI Changes\n-----------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- For input to representations, subclasses of the class required for a\n  given attribute will now be allowed in. [#11113]\n\n- Except for ``UnitSphericalRepresentation``, shortcuts in representations now\n  allow for attached differentials. [#11467]\n\n- Allow coordinate name strings as input to\n  ``SkyCoord.is_transformable_to``. [#11552]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Change ``z_at_value`` to use ``scipy.optimize.minimize_scalar`` with default\n  method ``Brent`` (other options ``Bounded`` and ``Golden``) and accept\n  ``bracket`` option to set initial search region. [#11080]\n\n- Clarified definition of inputs to ``angular_diameter_distance_z1z2``.\n  The function now emits ``AstropyUserWarning`` when ``z2`` is less than\n  ``z1``. [#11197]\n\n- Split cosmology realizations from core classes, moving the former to new file\n  ``realizations``. [#11345]\n\n- Since cosmologies are immutable, the initialization signature and values can\n  be stored, greatly simplifying cloning logic and extending it to user-defined\n  cosmology classes that do not have attributes with the same name as each\n  initialization argument.  [#11515]\n\n- Cloning a cosmology with changed parameter(s) now appends \"(modified)\" to the\n  new instance's name, unless a name is explicitly passed to ``clone``. [#11536]\n\n- Allow ``m_nu`` to be input as any quantity-like or array-like -- Quantity,\n  array, float, str, etc. Input is passed to the Quantity constructor and\n  converted to eV, still with the prior mass-energy equivalence\n  enabled. [#11640]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- For conversion between FITS tables and astropy ``Table``, the standard mask\n  values of ``NaN`` for float and null string for string are now properly\n  recognized, leading to a ``MaskedColumn`` with appropriately set mask\n  instead of a ``Column`` with those values exposed. Conversely, when writing\n  an astropy ``Table`` to a FITS tables, masked values are now consistently\n  converted to the standard FITS mask values of ``NaN`` for float and null\n  string for string (i.e., not just for tables with ``masked=True``, which no\n  longer is guaranteed to signal the presence of ``MaskedColumn``). [#11222]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- The use of ``version='1.0'`` is now fully deprecated in constructing\n  a ``astropy.io.votable.tree.VOTableFile``. [#11659]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Removed deprecated ``astropy.modeling.blackbody`` module. [#10972]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Added ``Column.value`` as an alias for the existing ``Column.data`` attribute.\n  This makes accessing a column's underlying data array consistent with the\n  ``.value`` attribute available for ``Time`` and ``Quantity`` objects. [#10962]\n\n- In reading from a FITS tables, the standard mask values of ``NaN`` for float\n  and null string for string are properly recognized, leading to a\n  ``MaskedColumn`` with appropriately set mask. [#11222]\n\n- Changed the implementation of the ``table.index.Index`` class so instantiating\n  from this class now returns an ``Index`` object as expected instead of a\n  ``SlicedIndex`` object. [#11333]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- The ``physical_type`` attribute of units now returns an instance of\n  ``astropy.units.physical.PhysicalType`` instead of a string.  Because\n  ``PhysicalType`` instances can be compared to strings, no code changes\n  should be necessary when making comparisons.  The string representations\n  of different physical types will differ from previous releases. [#11204]\n\n- Calling ``Unit()`` with no argument now returns a dimensionless unit,\n  as was documented but not implemented. [#11295]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Removed deprecated ``utils.misc.InheritDocstrings`` and ``utils.timer``. [#10281]\n\n- Removed usage of deprecated ``ipython`` stream in ``utils.console``. [#10942]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Deprecate ``accuracy`` argument in ``all_world2pix`` which was mistakenly\n  *documented*, in the case ``accuracy`` was ever used. [#11055]\n\n\nBug Fixes\n---------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Fixes for ``convolve_fft`` documentation examples. [#11510]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Allow ``Distance`` instances with negative distance values as input for\n  ``SphericalRepresentation``.  This was always noted as allowed in an\n  exception message when a negative ``Quantity`` with length units was\n  passed in, but was not actually possible to do. [#11113]\n\n- Makes the ``Angle.to_string`` method to follow the format described in the\n  docstring with up to 8 significant decimals instead of 4. [#11153]\n\n- Ensure that proper motions can be calculated when converting a ``SkyCoord``\n  with cartesian representation to unit-spherical, by fixing the conversion of\n  ``CartesianDifferential`` to ``UnitSphericalDifferential``. [#11469]\n\n- When re-representing coordinates from spherical to unit-spherical and vice\n  versa, the type of differential will now be preserved. For instance, if only a\n  radial velocity was present, that will remain the case (previously, a zero\n  proper motion component was added). [#11482]\n\n- Ensure that wrapping of ``Angle`` does not raise a warning even if ``nan`` are\n  present.  Also try to make sure that the result is within the wrapped range\n  even in the presence of rounding errors. [#11568]\n\n- Comparing a non-SkyCoord object to a ``SkyCoord`` using ``==`` no longer\n  raises an error. [#11666]\n\n- Different ``SkyOffsetFrame`` classes no longer interfere with each other,\n  causing difficult to debug problems with the ``origin`` attribute. The\n  ``origin`` attribute now no longer is propagated, so while it remains\n  available on a ``SkyCoord`` that is an offset, it no longer is available once\n  that coordinate is transformed to another frame. [#11730] [#11730]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Cosmology instance names are now immutable. [#11535]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fixed bug where writing a table that has comments defined (via\n  ``tbl.meta['comments']``) with the 'csv' format was failing. Since the\n  formally defined CSV format does not support comments, the comments are now\n  just ignored unless ``comment=<comment prefix>`` is supplied to the\n  ``write()`` call. [#11475]\n\n- Fixed the issue where the CDS reader failed to treat columns\n  as nullable if the ReadMe file contains a limits specifier. [#11531]\n\n- Made sure that the CDS reader does not ignore an order specifier that\n  may be present after the null specifier '?'. Also made sure that it\n  checks null values only when an '=' symbol is present and reads\n  description text even if there is no whitespace after '?'. [#11593]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fix ``ColDefs.add_col/del_col`` to allow in-place addition or removal of\n  a column. [#11338]\n\n- Fix indexing of ``fits.Header`` with Numpy integers. [#11387]\n\n- Do not delete ``EXTNAME`` for compressed image header if a default and\n  non-default ``EXTNAME`` are present. [#11396]\n\n- Prevent warnings about ``HIERARCH`` with ``CompImageHeader`` class. [#11404]\n\n- Fixed regression introduced in Astropy 4.0.5 and 4.2.1 with verification of\n  FITS headers with HISTORY or COMMENT cards with long (> 72 characters)\n  values. [#11487]\n\n- Fix reading variable-length arrays when there is a gap between the data and the\n  heap. [#11688]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- ``NumericArray`` converter now properly broadcasts scalar mask to array. [#11157]\n\n- VOTables are now written with the correct namespace and schema location\n  attributes. [#11659]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixes the improper propagation of ``bounding_box`` from\n  ``astropy.modeling.models`` to their inverses. For cases in which the inverses\n  ``bounding_box`` can be determined, the proper calculation has been\n  implemented. [#11414]\n\n- Bugfix to allow rotation models to accept arbitrarily-shaped inputs. [#11435]\n\n- Bugfixes for ``astropy.modeling`` to allow ``fix_inputs`` to accept empty\n  dictionaries and dictionaries with ``numpy`` integer keys. [#11443]\n\n- Bugfix for how ``SPECIAL_OPERATORS`` are handled. [#11512]\n\n- Fixes ``Model`` crashes when some inputs are scalars and during some types of\n  output reshaping. [#11548]\n\n- Fixed bug in ``LevMarLSQFitter`` when using weights and vector inputs. [#11603]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Fixed a bug with the ``copy=False`` option when carrying out sigma\n  clipping - previously if ``masked=False`` this still copied the data,\n  but this will now change the array in-place. [#11219]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Ensure that adding a ``Quantity`` or other mixin column to a ``Table``\n  does not have side effects, such as creating an associated ``info``\n  instance (which would lead to slow-down of, e.g., slicing afterwards). [#11077]\n\n- When writing to a FITS tables, masked values are again always converted to\n  the standard FITS mask values of ``NaN`` for float and null string\n  for string, not just for table with ``masked=True``. [#11222]\n\n- Using ``Table.to_pandas()`` on an indexed ``Table`` with masked integer values\n  now correctly construct the ``pandas.DataFrame``. [#11432]\n\n- Fixed ``Table`` HTML representation in Jupyter notebooks so that it is\n  horizontally scrollable within Visual Studio Code. This was done by wrapping\n  the ``<table>`` in a ``<div>`` element. [#11476]\n\n- Fix a bug where a string-valued ``Column`` that happened to have a ``unit``\n  attribute could not be added to a ``QTable``.  Such columns are now simply\n  kept as ``Column`` instances (with a warning). [#11585]\n\n- Fix an issue in ``Table.to_pandas(index=<colname>)`` where the index column name\n  was not being set properly for the ``DataFrame`` index. This was introduced by\n  an API change in pandas version 1.3.0. Previously when creating a ``DataFrame``\n  with the index set to an astropy ``Column``, the ``DataFrame`` index name was\n  automatically set to the column name. [#11921]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Fix a thread-safety issue with initialization of the leap-second table\n  (which is only an issue when ERFA's built-in table is out of date). [#11234]\n\n- Fixed converting a zero-length time object from UTC to\n  UT1 when an empty array is passed. [#11516]\n\nastropy.uncertainty\n^^^^^^^^^^^^^^^^^^^\n\n- ``Distribution`` instances can now be used as input to ``Quantity`` to\n  initialize ``QuantityDistribution``.  Hence, ``distribution * unit``\n  and ``distribution << unit`` will work too. [#11210]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Move non-astronomy units from astrophys.py to a new misc.py file. [#11142]\n\n- The physical type of ``astropy.units.mol / astropy.units.m ** 3`` is now\n  defined as molar concentration.  It was previously incorrectly defined\n  as molar volume. [#11204]\n\n- Make ufunc helper lookup thread-safe. [#11226]\n\n- Make ``Unit`` string parsing (as well as ``Angle`` parsing) thread-safe. [#11227]\n\n- Decorator ``astropy.units.decorators.quantity_input`` now only evaluates\n  return type annotations based on ``UnitBase`` or ``FunctionUnitBase`` types.\n  Other annotations are skipped over and are not attempted to convert to the\n  correct type. [#11506]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Make ``lazyproperty`` and ``classdecorator`` thread-safe. This should fix a\n  number of thread safety issues. [#11224]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug that resulted in some parts of grid lines being visible when they\n  should have been hidden. [#11380]\n\n- Fixed a bug that resulted in ``time_support()`` failing for intervals of\n  a few months if one of the ticks was the month December. [#11615]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- ``fit_wcs_from_points`` now produces a WCS with integer ``NAXIXn``\n  values. [#10865]\n\n- Updated bundled version of ``WCSLIB`` to v7.4, fixing a bug that caused\n  the coefficients of the TPD distortion function to not be written to the\n  header. [#11260]\n\n- Fixed a bug in assigning type when converting ``colsel`` to\n  ``numpy.ndarray``. [#11431]\n\n- Added ``WCSCOMPARE_*`` constants to the list of WCSLIB constants\n  available/exposed through the ``astropy.wcs`` module. [#11647]\n\n- Fix a bug that caused APE 14 WCS transformations for FITS WCS with ZOPT, BETA,\n  VELO, VOPT, or VRAD CTYPE to not work correctly. [#11781]\n\n\nOther Changes and Additions\n---------------------------\n\n- The configuration file is no longer created by default when importing astropy\n  and its existence is no longer required. Affiliated packages should update their\n  ``__init__.py`` module to remove the block using ``update_default_config`` and\n  ``ConfigurationDefaultMissingWarning``. [#10877]\n\n- Replace ``pkg_resources`` (from setuptools) with ``importlib.metadata`` which\n  comes from the stdlib, except for Python 3.7 where the backport package is added\n  as a new dependency. [#11091]\n\n- Turn on numpydoc's ``numpydoc_xref_param_type``  to create cross-references\n  for the parameter types in the Parameters, Other Parameters, Returns and Yields\n  sections of the docstrings. [#11118]\n\n- Docstrings across the package are standardized to enable references.\n  Also added is an Astropy glossary-of-terms to define standard inputs,\n  e.g. ``quantity-like`` indicates an input that can be interpreted by\n  ``astropy.units.Quantity``. [#11118]\n\n- Binary wheels are now built to the manylinux2010 specification. These wheels\n  should be supported on all versions of pip shipped with Python 3.7+. [#11377]\n\n- The name of the default branch for the astropy git repository has been renamed\n  to ``main``, and the documentation and tooling has been updated accordingly.\n  If you have made a local clone you may wish to update it following the\n  instructions in the repository's README. [#11379]\n\n- Sphinx cross-reference link targets are added for every ``PhysicalType``.\n  Now in the parameter types in the Parameters, Other Parameters, Returns and\n  Yields sections of the docstring, the physical type of a quantity can be\n  annotated in square brackets.\n  E.g. `` distance : `~astropy.units.Quantity` ['length'] `` [#11595]\n\n- The minimum supported version of ``ipython`` is now 4.2. [#10942]\n\n- The minimum supported version of ``pyerfa`` is now 1.7.3. [#11637]\n\n\n4.2.1 (2021-04-01)\n==================\n\nBug Fixes\n---------\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Fixed an issue where specializations of the comoving distance calculation\n  for certain cosmologies could not handle redshift arrays. [#10980]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fix bug where manual fixes to invalid header cards were not preserved when\n  saving a FITS file. [#11108]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- ``NumericArray`` converter now properly broadcasts scalar mask to array.\n  [#11157]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix bug when initializing a ``Table`` subclass that uses ``TableAttribute``'s.\n  If the data were an instance of the table then attributes provided in the\n  table initialization call could be ignored. [#11217]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Change epoch of ``TimeUnixTAI`` (``\"unix_tai\"``) from ``1970-01-01T00:00:00 UTC``\n  to ``1970-01-01T00:00:00 TAI`` to match the intended and documented behaviour.\n  This essentially changes the resulting times by 8.000082 seconds, the initial\n  offset between TAI and UTC. [#11249]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Fixed a bug with the ``quantity_input`` decorator where allowing\n  dimensionless inputs for an argument inadvertently disabled any checking of\n  compatible units for that argument. [#11283]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Fix a bug so that ``np.shape``, ``np.ndim`` and ``np.size`` again work on\n  classes that use ``ShapedLikeNDArray``, like representations, frames,\n  sky coordinates, and times. [#11133]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Fix error when a user defined ``proj_point`` parameter is passed to ``fit_wcs_from_points``. [#11139]\n\n\nOther Changes and Additions\n---------------------------\n\n\n- Change epoch of ``TimeUnixTAI`` (``\"unix_tai\"``) from ``1970-01-01T00:00:00 UTC``\n  to ``1970-01-01T00:00:00 TAI`` to match the intended and documented behaviour.\n  This essentially changes the resulting times by 8.000082 seconds, the initial\n  offset between TAI and UTC. [#11249]\n\n\n4.2 (2020-11-24)\n================\n\nNew Features\n------------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Methods ``convolve`` and ``convolve_fft`` both now return Quantity arrays\n  if user input is given in one. [#10822]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Numpy functions that broadcast, change shape, or index (like\n  ``np.broadcast_to``, ``np.rot90``, or ``np.roll``) now work on\n  coordinates, frames, and representations. [#10337]\n\n- Add a new science state ``astropy.coordinates.erfa_astrom.erfa_astrom`` and\n  two classes ``ErfaAstrom``, ``ErfaAstromInterpolator`` as wrappers to\n  the ``pyerfa`` astrometric functions used in the coordinate transforms.\n  Using ``ErfaAstromInterpolator``, which interpolates astrometric properties for\n  ``SkyCoord`` instances with arrays of obstime, can dramatically speed up\n  coordinate transformations while keeping microarcsecond resolution.\n  Depending on needed precision and the obstime array in question, speed ups\n  reach factors of 10x to >100x. [#10647]\n\n- ``galactocentric_frame_defaults`` can now also be used as a registry, with\n  user-defined parameter values and metadata. [#10624]\n\n- Method ``.realize_frame`` from coordinate frames now accepts ``**kwargs``,\n  including ``representation_type``. [#10727]\n\n- Avoid an unnecessary call to ``erfa.epv00`` in transformations between\n  ``CIRS`` and ``ICRS``, improving performance by 50 %. [#10814]\n\n- A new equatorial coordinate frame, with RA and Dec measured w.r.t to the True\n  Equator and Equinox (TETE). This frame is commonly known as \"apparent place\"\n  and is the correct frame for coordinates returned from JPL Horizons. [#10867]\n\n- Added a context manager ``impose_finite_difference_dt`` to the\n  ``TransformGraph`` class to override the finite-difference time step\n  attribute (``finite_difference_dt``) for all transformations in the graph\n  with that attribute. [#10341]\n\n- Improve performance of ``SpectralCoord`` by refactoring internal\n  implementation. [#10398]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- The final version of the Planck 2018 cosmological parameters are included\n  as the ``Planck18`` object, which is now the default cosmology.  The\n  parameters are identical to those of the ``Planck18_arXiv_v2`` object,\n  which is now deprecated and will be removed in a future release. [#10915]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Added NFW profile and tests to modeling package [#10505]\n\n- Added missing logic for evaluate to compound models [#10002]\n\n- Stop iteration in ``FittingWithOutlierRemoval`` before reaching ``niter`` if\n  the masked points are no longer changing. [#10642]\n\n- Keep a (shallow) copy of ``fit_info`` from the last iteration of the wrapped\n  fitter in ``FittingWithOutlierRemoval`` and also record the actual number of\n  iterations performed in it. [#10642]\n\n- Added attributes for fitting uncertainties (covariance matrix, standard\n  deviations) to models. Parameter covariance matrix can be accessed via\n  ``model.cov_matrix``, standard deviations by ``model.stds`` or individually\n  for each parameter by ``parameter.std``. Currently implemented for\n  ``LinearLSQFitter`` and ``LevMarLSQFitter``. [#10552]\n\n- N-dimensional least-squares statistic and specific 1,2,3-D methods [#10670]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Added ``circstd`` function to obtain a circular standard deviation. [#10690]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Allow initializing a ``Table`` using a list of ``names`` in conjunction with\n  a ``dtype`` from a numpy structured array. The list of ``names`` overrides the\n  names specified in the ``dtype``. [#10419]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Add new ``isclose()`` method to ``Time`` and ``TimeDelta`` classes to allow\n  comparison of time objects to within a specified tolerance. [#10646]\n\n- Improve initialization time by a factor of four when creating a scalar ``Time``\n  object in a format like ``unix`` or ``cxcsec`` (time delta from a reference\n  epoch time). [#10406]\n\n- Improve initialization time by a factor of ~25 or more for large arrays of\n  string times in ISO, ISOT or year day-of-year formats. This is done with a new\n  C-based time parser that can be adapted for other fixed-format custom time\n  formats. [#10360]\n\n- Numpy functions that broadcast, change shape, or index (like\n  ``np.broadcast_to``, ``np.rot90``, or ``np.roll``) now work on times.\n  [#10337, #10502]\n\nastropy.timeseries\n^^^^^^^^^^^^^^^^^^\n\n- Improve memory and speed performance when iterating over the entire time\n  column of a ``TimeSeries`` object. Previously this involved O(N^2) operations\n  and memory. [#10889]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- ``Quantity.to`` has gained a ``copy`` option to allow copies to be avoided\n  when the units do not change. [#10517]\n\n- Added the ``spat`` unit of solid angle that represents the full sphere.\n  [#10726]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- ``ShapedLikeNDArray`` has gained the capability to use numpy functions\n  that broadcast, change shape, or index. [#10337]\n\n- ``get_free_space_in_dir`` now takes a new ``unit`` keyword and\n  ``check_free_space_in_dir`` takes ``size`` defined as ``Quantity``. [#10627]\n\n- New ``astropy.utils.data.conf.allow_internet`` configuration item to\n  control downloading data from the Internet. Setting ``allow_internet=False``\n  is the same as ``remote_timeout=0``. Using ``remote_timeout=0`` to control\n  internet access will stop working in a future release. [#10632]\n\n- New ``is_url`` function so downstream packages do not have to secretly use\n  the hidden ``_is_url`` anymore. [#10684]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Added the ``Quadrangle`` patch for ``WCSAxes`` for a latitude-longitude\n  quadrangle.  Unlike ``matplotlib.patches.Rectangle``, the edges of this\n  patch will be rendered as curved lines if appropriate for the WCS\n  transformation. [#10862]\n\n- The position of tick labels are now only calculated when needed. If any text\n  parameters are changed (color, font weight, size etc.) that don't effect the\n  tick label position, the positions are not recomputed, improving performance.\n  [#10806]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- ``WCS.to_header()`` now appends comments to SIP coefficients. [#10480]\n\n- A new property ``dropped_world_dimensions`` has been added to\n  ``SlicedLowLevelWCS`` to record information about any world axes removed by\n  slicing a WCS. [#10195]\n\n- New ``WCS.proj_plane_pixel_scales()`` and ``WCS.proj_plane_pixel_area()``\n  methods to return pixel scales and area, respectively, as Quantity. [#10872]\n\n\nAPI Changes\n-----------\n\nastropy.config\n^^^^^^^^^^^^^^\n\n- ``set_temp_config`` now preserves the existing cache rather than deleting\n  it and relying on reloading it from the previous config file. This ensures\n  that any programmatically made changes are preserved as well. [#10474]\n\n- Configuration path detection logic has changed: Now, it looks for ``~`` first\n  before falling back to older logic. In addition, ``HOMESHARE`` is no longer\n  used in Windows. [#10705]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- The passing of frame classes (as opposed to frame instances) to the\n  ``transform_to()`` methods of low-level coordinate-frame classes has been\n  deprecated.  Frame classes can still be passed to the ``transform_to()``\n  method of the high-level ``SkyCoord`` class, and using ``SkyCoord`` is\n  recommended for all typical use cases of transforming coordinates. [#10475]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Added a ``grow`` parameter to ``SigmaClip``, ``sigma_clip`` and\n  ``sigma_clipped_stats``, to allow expanding the masking of each deviant\n  value to its neighbours within a specified radius. [#10613]\n\n- Passing float ``n`` to ``poisson_conf_interval`` when using\n  ``interval='kraft-burrows-nousek'`` now raises ``TypeError`` as its value\n  must be an integer. [#10838]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Change ``Table.columns.keys()`` and ``Table.columns.values()`` to both return\n  generators instead of a list. This matches the behavior for Python ``dict``\n  objects. [#10543]\n\n- Removed the ``FastBST`` and ``FastRBT`` indexing engines because they depend\n  on the ``bintrees`` package, which is no longer maintained and is deprecated.\n  Instead, use the ``SCEngine`` indexing engine, which is similar in\n  performance and relies on the ``sortedcontainers`` package. [#10622]\n\n- When slicing a mixin column in a table that had indices, the indices are no\n  longer copied since they generally are not useful, having the wrong shape.\n  With this, the behaviour becomes the same as that for a regular ``Column``.\n  (Note that this does not affect slicing of a table; sliced columns in those\n  will continue to carry a sliced version of any indices). [#10890]\n\n- Change behavior so that when getting a single item out of a mixin column such\n  as ``Time``, ``TimeDelta``, ``SkyCoord`` or ``Quantity``, the ``info``\n  attribute is no longer copied. This improves performance, especially when the\n  object is an indexed column in a ``Table``. [#10889]\n\n- Raise a TypeError when a scalar column is added to an unsized table. [#10476]\n\n- The order of columns when creating a table from a ``list`` of ``dict`` may be\n  changed. Previously, the order was alphabetical because the ``dict`` keys\n  were assumed to be in random order. Since Python 3.7, the keys are always in\n  order of insertion, so ``Table`` now uses the order of keys in the first row\n  to set the column order. To alphabetize the columns to match the previous\n  behavior, use ``t = t[sorted(t.colnames)]``. [#10900]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Refactor ``Time`` and ``TimeDelta`` classes to inherit from a common\n  ``TimeBase`` class. The ``TimeDelta`` class no longer inherits from ``Time``.\n  A number of methods that only apply to ``Time`` (e.g. ``light_travel_time``)\n  are no longer available in the ``TimeDelta`` class. [#10656]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- The ``bar`` unit is no longer wrongly considered an SI unit, meaning that\n  SI decompositions like ``(u.kg*u.s**-2* u.sr**-1 * u.nm**-1).si`` will\n  no longer include it. [#10586]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Shape-related items from ``astropy.utils.misc`` -- ``ShapedLikeNDArray``,\n  ``check_broadcast``, ``unbroadcast``, and ``IncompatibleShapeError`` --\n  have been moved to their own module, ``astropy.utils.shapes``. They remain\n  importable from ``astropy.utils``. [#10337]\n\n- ``check_hashes`` keyword in ``check_download_cache`` is deprecated and will\n  be removed in a future release. [#10628]\n\n- ``hexdigest`` keyword in ``import_file_to_cache`` is deprecated and will\n  be removed in a future release. [#10628]\n\n\nBug Fixes\n---------\n\nastropy.config\n^^^^^^^^^^^^^^\n\n- Fix a few issues with ``generate_config`` when used with other packages.\n  [#10893]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug in the coordinate-frame attribute ``CoordinateAttribute`` where\n  the internal transformation could behave differently depending on whether\n  the input was a low-level coordinate frame or a high-level ``SkyCoord``.\n  ``CoordinateAttribute`` now always performs a ``SkyCoord``-style internal\n  transformation, including the by-default merging of frame attributes. [#10475]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed an issue of ``Model.render`` when the input ``out`` datatype is not\n  float64. [#10542]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Fix support for referencing WCSAxes coordinates by their world axes names.\n  [#10484]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Objective functions called by ``astropy.wcs.fit_wcs_from_points`` were\n  treating longitude and latitude distances equally. Now longitude scaled\n  properly. [#10759]\n\n\nOther Changes and Additions\n---------------------------\n\n- Minimum version of required Python is now 3.7. [#10900]\n\n- Minimum version of required Numpy is now 1.17. [#10664]\n\n- Minimum version of required Scipy is now 1.1. [#10900]\n\n- Minimum version of required PyYAML is now 3.13. [#10900]\n\n- Minimum version of required Matplotlib is now 3.0. [#10900]\n\n- The private ``_erfa`` module has been converted to its own package,\n  ``pyerfa``, which is a required dependency for astropy, and can be imported\n  with ``import erfa``.  Importing ``_erfa`` from ``astropy`` will give a\n  deprecation warning.  [#10329]\n\n- Added ``optimize=True`` flag to calls of ``yacc.yacc`` (as already done for\n  ``lex.lex``) to allow running in ``python -OO`` session without raising an\n  exception in ``astropy.units.format``. [#10379]\n\n- Shortened FITS comment strings for some D2IM and CPDIS FITS keywords to\n  reduce the number of FITS ``VerifyWarning`` warnings when working with WCSes\n  containing lookup table distortions. [#10513]\n\n- When importing astropy without first building the extension modules first,\n  raise an error directly instead of trying to auto-build. [#10883]\n\n\n\n4.1 (2020-10-21)\n================\n\nNew Features\n------------\n\nastropy.config\n^^^^^^^^^^^^^^\n\n- Add new function ``generate_config`` to generate the configuration file and\n  include it in the documentation. [#10148]\n\n- ``ConfigNamespace.__iter__`` and ``ConfigNamespace.keys`` now yield ``ConfigItem``\n  names defined within it. Similarly, ``items`` and ``values`` would yield like a\n  Python dictionary would. [#10139]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Added a new ``SpectralCoord`` class that can be used to define spectral\n  coordinates and transform them between different velocity frames. [#10185]\n\n- Angle parsing now supports ``cardinal direction`` in the cases\n  where angles are initialized as ``string`` instances. eg ``\"17°53'27\"W\"``.[#9859]\n\n- Allow in-place modification of array-valued ``Frame`` and ``SkyCoord`` objects.\n  This provides limited support for updating coordinate data values from another\n  coordinate object of the same class and equivalent frame attributes. [#9857]\n\n- Added a robust equality operator for comparing ``SkyCoord``, frame, and\n  representation objects. A comparison like ``sc1 == sc2`` will now return a\n  boolean or boolean array where the objects are strictly equal in all relevant\n  frame attributes and coordinate representation values. [#10154]\n\n- Added the True Equator Mean Equinox (TEME) frame. [#10149]\n\n- The ``Galactocentric`` frame will now use the \"latest\" parameter definitions\n  by default. This currently corresponds to the values defined in v4.0, but will\n  change with future releases. [#10238]\n\n- The ``SkyCoord.from_name()`` and Sesame name resolving functionality now is\n  able to cache results locally and will do so by default. [#9162]\n\n- Allow in-place modification of array-valued ``Representation`` and ``Differential``\n  objects, including of representations with attached differentials. [#10210]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Functional Units can now be processed in CDS-tables. [#9971]\n\n- Allow reading in ASCII tables which have duplicate column names. [#9939]\n\n- Fixed failure of ASCII ``fast_reader`` to handle ``names``, ``include_names``,\n  ``exclude_names`` arguments for ``RDB`` formatted tables. Homogenised checks\n  and exceptions for invalid ``names`` arguments. Improved performance when\n  parsing \"wide\" tables with many columns. [#10306]\n\n- Added type validation of key arguments in calls to ``io.ascii.read()`` and\n  ``io.ascii.write()`` functions. [#10005]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n- Added serialization of parameter constraints fixed and bounds.  [#10082]\n\n- Added 'functional_models.py' and 'physical_models.py' to asdf/tags/transform,\n  with to allow serialization of all functional and physical models. [#10028, #10293]\n\n- Fix ASDF serialization of circular model inverses, and remove explicit calls\n  to ``asdf.yamlutil`` functions that became unnecessary in asdf 2.6.0. [#10189, #10384]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Added support for writing Dask arrays to disk efficiently for ``ImageHDU`` and\n  ``PrimaryHDU``. [#9742]\n\n- Add HDU name and ver to FITSDiff report where appropriate [#10197]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- New ``exceptions.conf.max_warnings`` configuration item to control the number of times a\n  type of warning appears before being suppressed. [#10152]\n\n- No longer ignore attributes whose values were specified as empty\n  strings. [#10583]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n- Added Plummer1D model to ``functional_models``. [#9896]\n\n- Added ``UnitsMapping`` model and ``Model.coerce_units`` to support units on otherwise\n  unitless models. [#9936]\n\n- Added ``domain`` and ``window`` attributes to ``repr`` and ``str``. Fixed bug with\n  ``_format_repr`` in core.py. [#9941]\n\n- Polynomial attributes ``domain`` and ``window`` are now tuples of size 2 and are\n  validated. `repr` and `print` show only their non-default values. [#10145]\n\n- Added ``replace_submodel()`` method to ``CompoundModel`` to modify an\n  existing instance. [#10176]\n\n- Delay construction of ``CompoundModel`` inverse until property is accessed,\n  to support ASDF deserialization of circular inverses in component models. [#10384]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Added support in the ``bitmask`` module for using mnemonic bit flag names\n  when specifying the bit flags to be used or ignored when converting a bit\n  field to a boolean. [#10095, #10208]\n\n- Added ``reshape_as_blocks`` function to reshape a data array into\n  blocks, which is useful to efficiently apply functions on block\n  subsets of the data instead of using loops.  The reshaped array is a\n  view of the input data array. [#10214]\n\n- Added a ``cache`` keyword option to allow caching for ``CCDData.read`` if\n  filename is a URL. [#10265]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Added ability to specify a custom matching function for table joins.  In\n  particular this makes it possible to do cross-match table joins on ``SkyCoord``,\n  ``Quantity``, or standard columns, where column entries within a specified\n  distance are considered to be matched. [#10169]\n\n- Added ``units`` and ``descriptions`` keyword arguments to the Table object\n  initialization and ``Table.read()`` methods.  This allows directly setting\n  the ``unit`` and ``description`` for the table columns at the time of\n  creating or reading the table. [#9671]\n\n- Make table ``Row`` work as mappings, by adding ``.keys()`` and ``.values()``\n  methods. With this ``**row`` becomes possible, as does, more simply, turning\n  a ``Row`` into a dictionary with ``dict(row)``. [#9712]\n\n- Added two new ``Table`` methods ``.items()`` and ``.values()``, which return\n  respectively ``tbl.columns.items()`` (iterator over name, column tuples)  and\n  ``tbl.columns.values()`` (list of columns) for a ``Table`` object ``tbl``. [#9780]\n\n- Added new ``Table`` method ``.round()``, which rounds numeric columns to the\n  specified number of decimals. [#9862]\n\n- Updated ``to_pandas()`` and ``from_pandas()`` to use and support Pandas\n  nullable integer data type for masked integer data. [#9541]\n\n- The HDF5 writer, ``write_table_hdf5()``, now allows passing through\n  additional keyword arguments to the ``h5py.Group.create_dataset()``. [#9602]\n\n- Added capability to add custom table attributes to a ``Table`` subclass.\n  These attributes are persistent and can be set during table creation. [#10097]\n\n- Added support for ``SkyCoord`` mixin columns in ``dstack``, ``vstack`` and\n  ``insert_row`` functions. [#9857]\n\n- Added support for coordinate ``Representation`` and ``Differential`` mixin\n  columns. [#10210]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Added a new time format ``unix_tai`` which is essentially Unix time but with\n  leap seconds included.  More precisely, this is the number of seconds since\n  ``1970-01-01 00:00:08 TAI`` and corresponds to the ``CLOCK_TAI`` clock\n  available on some linux platforms. [#10081]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Added ``torr`` pressure unit. [#9787]\n\n- Added the ``equal_nan`` keyword argument to ``isclose`` and ``allclose``, and\n  updated the docstrings. [#9849]\n\n- Added ``Rankine`` temperature unit. [#9916]\n\n- Added integrated flux unit conversion to ``spectral_density`` equivalency.\n  [#10015]\n\n- Changed ``pixel_scale`` equivalency to allow scales defined in any unit.\n  [#10123]\n\n- The ``quantity_input`` decorator now optionally allows passing through\n  numeric values or numpy arrays with numeric dtypes to arguments where\n  ``dimensionless_unscaled`` is an allowed unit. [#10232]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Added a new ``MetaAttribute`` class to support easily adding custom attributes\n  to a subclass of classes like ``Table`` or ``NDData`` that have a ``meta``\n  attribute. [#10097]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Added ``invalid`` keyword to ``SqrtStretch``, ``LogStretch``,\n  ``PowerStretch``, and ``ImageNormalize`` classes and the\n  ``simple_norm`` function.  This keyword is used to replace generated\n  NaN values. [#10182]\n\n- Fixed an issue where ticks were sometimes not drawn at the edges of a spherical\n  projection on a WCSAxes. [#10442]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- WCS objects with a spectral axis will now return ``SpectralCoord``\n  objects when calling ``pixel_to_world`` instead of ``Quantity``,\n  and can now take either ``Quantity`` or ``SpectralCoord`` as input\n  to ``pixel_to_world``. [#10185]\n\n- Implemented support for the ``-TAB`` algorithm (WCS Paper III). [#9641]\n\n- Added an ``_as_mpl_axes`` method to the ``HightLevelWCSWrapper`` class. [#10138]\n\n- Add .upper() to ctype or ctype names to wcsapi/fitwcs.py to mitigate bugs from\n  unintended lower/upper case issues [#10557]\n\nAPI Changes\n-----------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- The equality operator for comparing ``SkyCoord``, frame, and representation\n  objects was changed. A comparison like ``sc1 == sc2`` was previously\n  equivalent to ``sc1 is sc2``. It will now return a boolean or boolean array\n  where the objects are strictly equal in all relevant frame attributes and\n  coordinate representation values. If the objects have different frame\n  attributes or representation types then an exception will be raised. [#10154]\n\n- ```SkyCoord.radial_velocity_correction``` now allows you to pass an ```obstime``` directly\n  when the ```SkyCoord``` also has an ```obstime``` set. In this situation, the position of the\n  ```SkyCoord``` has space motion applied to correct to the passed ```obstime```. This allows\n  mm/s radial velocity precision for objects with large space motion. [#10094]\n\n- For consistency with other astropy classes, coordinate ``Representations``\n  and ``Differentials`` can now be initialized with an instance of their own class\n  if that instance is passed in as the first argument. [#10210]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Changed the behavior when reading a table where both the ``names`` argument\n  is provided (to specify the output column names) and the ``converters``\n  argument is provided (to specify column conversion functions). Previously the\n  ``converters`` dict names referred to the *input* table column names, but now\n  they refer to the *output* table column names. [#9739]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- For FIELDs with datatype=\"char\", store the values as strings instead\n  of bytes. [#9505]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- ``Table.from_pandas`` now supports a ``units`` dictionary as argument to pass units\n  for columns in the ``DataFrame``. [#9472]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Require that ``in_subfmt`` and ``out_subfmt`` properties of a ``Time`` object\n  have allowed values at the time of being set, either when creating the object\n  or when setting those properties on an existing ``Time`` instance.  Previously\n  the validation of those properties was not strictly enforced. [#9868]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Changed the exception raised by ``get_readable_fileobj`` on missing\n  compression modules (for ``bz2`` or ``lzma``/``xz`` support) to\n  ``ModuleNotFoundError``, consistent with ``io.fits`` file handlers. [#9761]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Deprecated the ``imshow_only_kwargs`` keyword in ``imshow_norm``.\n  [#9915]\n\n- Non-finite input values are now automatically excluded in\n  ``HistEqStretch`` and ``InvertedHistEqStretch``. [#10177]\n\n- The ``PowerDistStretch`` and ``InvertedPowerDistStretch`` ``a``\n  value is restricted to be ``a >= 0`` in addition to ``a != 1``.\n  [#10177]\n\n- The ``PowerStretch``, ``LogStretch``, and ``InvertedLogStretch``\n  ``a`` value is restricted to be ``a > 0``. [#10177]\n\n- The ``AsinhStretch`` and ``SinhStretch`` ``a`` value is restricted\n  to be ``0 < a <= 1``. [#10177]\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Fix a bug where for light deflection by the Sun it was always assumed that the\n  source was at infinite distance, which in the (rare and) absolute worst-case\n  scenario could lead to errors up to 3 arcsec. [#10666]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- For FIELDs with datatype=\"char\", store the values as strings instead\n  of bytes. [#9505]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix a bug that prevented ``Time`` columns from being used to sort a table.\n  [#10824]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- WCS objects with a spectral axis will now return ``SpectralCoord``\n  objects when calling ``pixel_to_world`` instead of ``Quantity``\n  (note that ``SpectralCoord`` is a sub-class of ``Quantity``). [#10185]\n\n- Add .upper() to ctype or ctype names to wcsapi/fitwcs.py to mitigate bugs from\n  unintended lower/upper case issues [#10557]\n\n- Added bounds to ``fit_wcs_from_points`` to ensure CRPIX is on\n  input image. [#10346]\n\n\nOther Changes and Additions\n---------------------------\n\n- The way in which users can specify whether to build astropy against\n  existing installations of C libraries rather than the bundled one\n  has changed, and should now be done via environment variables rather\n  than setup.py flags (e.g. --use-system-erfa). The available variables\n  are ``ASTROPY_USE_SYSTEM_CFITSIO``, ``ASTROPY_USE_SYSTEM_ERFA``,\n  ``ASTROPY_USE_SYSTEM_EXPAT``, ``ASTROPY_USE_SYSTEM_WCSLIB``, and\n  ``ASTROPY_USE_SYSTEM_ALL``. These should be set to ``1`` to build\n  against the system libraries. [#9730]\n\n- The infrastructure of the package has been updated in line with the\n  APE 17 roadmap (https://github.com/astropy/astropy-APEs/blob/master/APE17.rst).\n  The main changes are that the ``python setup.py test`` and\n  ``python setup.py build_docs`` commands will no longer work. The easiest\n  way to replicate these commands is to install the tox\n  (https://tox.readthedocs.io) package and run ``tox -e test`` and\n  ``tox -e build_docs``. It is also possible to run pytest and sphinx\n  directly. Other significant changes include switching to setuptools_scm to\n  manage the version number, and adding a ``pyproject.toml`` to opt in to\n  isolated builds as described in PEP 517/518. [#9726]\n\n- Bundled ``expat`` is updated to version 2.2.9. [#10038]\n\n- Increase minimum asdf version to 2.6.0. [#10189]\n\n- The bundled version of PLY was updated to 3.11. [#10258]\n\n- Removed dependency on scikit-image. [#10214]\n\n4.0.5 (2021-03-26)\n==================\n\nBug Fixes\n---------\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fix bug where manual fixes to invalid header cards were not preserved when\n  saving a FITS file. [#11108]\n\n- Fix parsing of RVKC header card patterns that were not recognised\n  where multiple spaces were separating field-specifier and value like\n  \"DP1.AXIS.1:   1\". [#11301]\n\n- Fix misleading missing END card error when extra data are found at the end\n  of the file. [#11285]\n\n- Fix incorrect wrapping of long card values as CONTINUE cards when some\n  words in the value are longer than a single card. [#11304]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Fixed problem when writing serialized metadata to HDF5 using h5py >= 3.0.\n  With the newer h5py this was writing the metadata table as a variable-length\n  string array instead of the previous fixed-length bytes array. Fixed astropy\n  to force using a fixed-length bytes array. [#11359]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Change ``Voigt1D`` function to use Humlicek's approximation to avoid serious\n  inaccuracies + option to use (compiled) ``scipy.special.wofz`` error function\n  for yet more accurate results. [#11177]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fixed bug when initializing a ``Table`` with a column as list of ``Quantity``,\n  for example ``Table({'x': [1*u.m, 2*u.m]})``. Previously this resulted in an\n  ``object`` dtype with no column ``unit`` set, but now gives a float array with\n  the correct unit. [#11329]\n\n- Fixed byteorder conversion in ``to_pandas()``, which had incorrectly\n  triggered swapping when native endianness was stored with explicit\n  ``dtype`` code ``'<'`` (or ``'>'``) instead of ``'='``. [#11288, #11294]\n\n- Fixed a compatibility issue with numpy 1.21. Initializing a Table with a\n  column like ``['str', np.ma.masked]`` was failing in tests due to a change in\n  numpy. [#11364]\n\n- Fixed bug when validating the inputs to ``table.hstack``, ``table.vstack``,\n  and ``table.dstack``. Previously, mistakenly calling ``table.hstack(t1, t2)``\n  (instead of ``table.hstack([t1, t2]))`` would return ``t1`` instead of raising\n  an exception. [#11336]\n\n- Fixed byteorder conversion in ``to_pandas()``, which had incorrectly\n  triggered swapping when native endianness was stored with explicit\n  ``dtype`` code ``'<'`` (or ``'>'``) instead of ``'='``. [#11288]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Fix leap second update when using a non english locale. [#11062]\n\n- Fix default assumed location to be the geocenter when transforming times\n  to and from solar-system barycenter scales. [#11134]\n\n- Fix inability to write masked times with ``formatted_value``. [#11195]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Ensure ``keepdims`` works for taking ``mean``, ``std``, and ``var`` of\n  ``Quantity``. [#11198]\n\n- For ``Quantity.to_string()``, ensure that the precision argument is also\n  used when the format is not latex. [#11145]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Allow \"un-setting\" of auxiliary WCS parameters in the ``aux`` attribute of\n  ``Wcsprm``. [#11166]\n\n\n\n\n\n4.0.4 (2020-11-24)\n==================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- The ``norm()`` method for ``RadialDifferential`` no longer requires ``base``\n  to be specified.  The ``norm()`` method for other non-Cartesian differential\n  classes now gives a clearer error message if ``base`` is not specified. [#10969]\n\n- The transformations between ``ICRS`` and any of the heliocentric ecliptic\n  frames (``HeliocentricMeanEcliptic``, ``HeliocentricTrueEcliptic``, and\n  ``HeliocentricEclipticIAU76``) now correctly account for the small motion of\n  the Sun when transforming a coordinate with velocity information. [#10970]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Partially fixed a performance issue when reading in parallel mode. Parallel\n  reading currently has substantially worse performance than the default serial\n  reading, so we now ignore the parallel option and fall back to serial reading.\n  [#10880]\n\n- Fixed a bug where \"\" (blank string) as input data for a boolean type column\n  was causing an exception instead of indicating a masked value. As a\n  consequence of the fix, the values \"0\" and \"1\" are now also allowed as valid\n  inputs for boolean type columns. These new allowed values apply for both ECSV\n  and for basic character-delimited data files ('basic' format with appropriate\n  ``converters`` specified). [#10995]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed use of weights with ``LinearLSQFitter``. [#10687]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Fixed an issue in biweight stats when MAD=0 to give the same output\n  with and without an input ``axis``. [#10912]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Fix a problem with the ``plot_date`` format for matplotlib >= 3.3 caused by\n  a change in the matplotlib plot date default reference epoch in that release.\n  [#10876]\n\n- Improve initialization time by a factor of four when creating a scalar ``Time``\n  object in a format like ``unix`` or ``cxcsec`` (time delta from a reference\n  epoch time). [#10406]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Fixed the calculation of the tight bounding box of a ``WCSAxes``. This should\n  also significantly improve the application of ``tight_layout()`` to figures\n  containing ``WCSAxes``. [#10797]\n\n\n4.0.3 (2020-10-14)\n==================\n\nBug Fixes\n---------\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fixed a small bug where initializing an empty ``Column`` with a structured dtype\n  with a length and a shape failed to give the requested dtype. [#10819]\n\nOther Changes and Additions\n---------------------------\n\n- Fixed installation of the source distribution with pip<19. [#10837, #10852]\n\n\n4.0.2 (2020-10-10)\n==================\n\nNew Features\n------------\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- ``astropy.utils.data.download_file`` now supports FTPS/FTP over TLS. [#9964]\n\n- ``astropy.utils.data`` now uses a lock-free mechanism for caching. This new\n  mechanism uses a new cache layout and so ignores caches created using earlier\n  mechanisms (which were causing lockups on clusters). The two cache formats can\n  coexist but do not share any files. [#10437, #10683]\n\n- ``astropy.utils.data`` now ignores the config item\n  ``astropy.utils.data.conf.download_cache_lock_attempts`` since no locking is\n  done. [#10437, #10683]\n\n- ``astropy.utils.data.download_file`` and related functions now interpret the\n  parameter or config file setting ``timeout=0`` to mean they should make no\n  attempt to download files. [#10437, #10683]\n\n- ``astropy.utils.import_file_to_cache`` now accepts a keyword-only argument\n  ``replace``, defaulting to True, to determine whether it should replace existing\n  files in the cache, in a way as close to atomic as possible. [#10437, #10683]\n\n- ``astropy.utils.data.download_file`` and related functions now treat\n  ``http://example.com`` and ``http://example.com/`` as equivalent. [#10631]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- The new auxiliary WCS parameters added in WCSLIB 7.1 are now exposed as\n  the ``aux`` attribute of ``Wcsprm``. [#10333]\n\n- Updated bundled version of ``WCSLIB`` to v7.3. [#10433]\n\n\nBug fixes\n---------\n\nastropy.config\n^^^^^^^^^^^^^^\n\n- Added an extra fallback to ``os.expanduser('~')`` when trying to find the\n  user home directory. [#10570]\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\n- Corrected definition of parsec to 648 000 / pi AU following IAU 2015 B2 [#10569]\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug where a float-typed integers in the argument ``x_range`` of\n  ``astropy.convolution.utils.discretize_oversample_1D`` (and the 2D version as\n  well) fails because it uses ``numpy.linspace``, which requires an ``int``.\n  [#10696]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Ensure that for size-1 array ``SkyCoord`` and coordinate frames\n  the attributes also properly become scalars when indexed with 0.\n  [#10113]\n\n- Fixed a bug where ``SkyCoord.separation()`` and ``SkyCoord.separation_3d``\n  were not accepting a frame object. [#10332]\n\n- Ensure that the ``lon`` values in ``SkyOffsetFrame`` are wrapped correctly at\n  180 degree regardless of how the underlying data is represented. [#10163]\n\n- Fixed an error in the obliquity of the ecliptic when transforming to/from the\n  ``*TrueEcliptic`` coordinate frames. The error would primarily result in an\n  inaccuracy in the ecliptic latitude on the order of arcseconds. [#10129]\n\n- Fixed an error in the computation of the location of solar system bodies where the\n  Earth location of the observer was ignored during the correction for light travel\n  time. [#10292]\n\n- Ensure that coordinates with proper motion that are transformed to other\n  coordinate frames still can be represented properly. [#10276]\n\n- Improve the error message given when trying to get a cartesian representation\n  for coordinates that have both proper motion and radial velocity, but no\n  distance. [#10276]\n\n- Fixed an error where ``SkyCoord.apply_space_motion`` would return incorrect\n  results when no distance is set and proper motion is high. [#10296]\n\n- Make the parsing of angles thread-safe so that ``Angle`` can be used in\n  Python multithreading. [#10556]\n\n- Fixed reporting of ``EarthLocation.info`` which previously raised an exception.\n  [#10592]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fixed a bug with the C ``fast_reader`` not correctly parsing newlines when\n  ``delimiter`` was also set to ``\\n`` or ``\\r``; ensured consistent handling\n  of input strings without newline characters. [#9929]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fix integer formats of ``TFORMn=Iw`` columns in ASCII tables to correctly read\n  values exceeding int32 - setting int16, int32 or int64 according to ``w``. [#9901]\n\n- Fix unclosed memory-mapped FITS files in ``FITSDiff`` when difference found.\n  [#10159]\n\n- Fix crash when reading an invalid table file. [#10171]\n\n- Fix duplication issue when setting a keyword ending with space. [#10482]\n\n- Fix ResourceWarning with ``fits.writeto`` and ``pathlib.Path`` object.\n  [#10599]\n\n- Fix repr for commentary cards and strip spaces for commentary keywords.\n  [#10640]\n\n- Fix compilation of cfitsio with Xcode 12. [#10772]\n\n- Fix handling of 1-dimensional arrays with a single element in ``BinTableHDU`` [#10768]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Fix id URL in ``baseframe-1.0.0`` ASDF schema. [#10223]\n\n- Write keys to ASDF only if the value is present, to account\n  for a change in behavior in asdf 2.8. [#10674]\n\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\n- Fix ``Table.(read|write).help`` when reader or writer has no docstring. [#10460]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Fixed parsing failure of VOTable with no fields. When detecting a non-empty\n  table with no fields, the following warning/exception is issued:\n  E25 \"No FIELDs are defined; DATA section will be ignored.\" [#10192]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed a problem with mapping ``input_units`` and ``return_units``\n  of a ``CompoundModel`` to the units of the constituent models. [#10158]\n\n- Removed hard-coded names of inputs and outputs. [#10174]\n\n- Fixed a problem where slicing a ``CompoundModel`` by name will crash if\n  there ``fix_inputs`` operators are present. [#10224]\n\n- Removed a limitation of fitting of data with units with compound models\n  without units when the expression involves operators other than addition\n  and subtraction. [#10415]\n\n- Fixed a problem with fitting ``Linear1D`` and ``Planar2D`` in model sets. [#10623]\n\n- Fixed reported module name of ``math_functions`` model classes. [#10694]\n\n- Fixed reported module name of ``tabular`` model classes. [#10709]\n\n- Do not create new ``math_functions`` models for ufuncs that are\n  only aliases (divide and mod). [#10697]\n\n- Fix calculation of the ``Moffat2D`` derivative with respect to gamma. [#10784]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Fixed an API regression where ``SigmaClip.__call__`` would convert masked\n  elements to ``nan`` and upcast the dtype to ``float64`` in its output\n  ``MaskedArray`` when using the ``axis`` parameter along with the defaults\n  ``masked=True`` and ``copy=True``. [#10610]\n\n- Fixed an issue where fully masked ``MaskedArray`` input to\n  ``sigma_clipped_stats`` gave incorrect results. [#10099]\n\n- Fixed an issue where ``sigma_clip`` and ``SigmaClip.__call__``\n  would return a masked array instead of a ``ndarray`` when\n  ``masked=False`` and the input was a full-masked ``MaskedArray``.\n  [#10099]\n\n- Fixed bug with ``funcs.poisson_conf_interval`` where an integer for N\n  with ``interval='kraft-burrows-nousek'`` would throw an error with\n  mpmath backend. [#10427]\n\n- Fixed bug in ``funcs.poisson_conf_interval`` with\n  ``interval='kraft-burrows-nousek'`` where certain combinations of source\n  and background count numbers led to ``ValueError`` due to the choice of\n  starting value for numerical optimization. [#10618]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fixed a bug when writing a table with mixin columns to FITS, ECSV or HDF5.\n  If one of the data attributes of the mixin (e.g. ``skycoord.ra``) had the\n  same name as one of the table column names (``ra``), the column (``ra``)\n  would be dropped when reading the table back. [#10222]\n\n- Fixed a bug when sorting an indexed table on the indexed column after first\n  sorting on another column. [#10103]\n\n- Fixed a bug in table argsort when called with ``reverse=True`` for an\n  indexed table. [#10103]\n\n- Fixed a performance regression introduced in #9048 when initializing a table\n  from Python lists. Also fixed incorrect behavior (for data types other than\n  float) when those lists contain ``np.ma.masked`` elements to indicate masked\n  data. [#10636]\n\n- Avoid modifying ``.meta`` when serializing columns to FITS. [#10485]\n\n- Avoid crash when reading a FITS table that contains mixin info and PyYAML\n  is missing. [#10485]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Ensure that for size-1 array ``Time``, the location also properly becomes\n  a scalar when indexed with 0. [#10113]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Refined test_parallax to resolve difference between 2012 and 2015 definitions. [#10569]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- The default IERS server has been updated to use the FTPS server hosted by\n  CDDIS. [#9964]\n\n- Fixed memory allocation on 64-bit systems within ``xml.iterparse`` [#10076]\n\n- Fix case where ``None`` could be used in a numerical computation. [#10126]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug where the ``ImageNormalize`` ``clip`` keyword was\n  ignored when used with calling the object on data. [#10098]\n\n- Fixed a bug where ``axes.xlabel``/``axes.ylabel`` where not correctly set\n  nor returned on an ``EllipticalFrame`` class ``WCSAxes`` plot. [#10446]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Handled WCS 360 -> 0 deg crossover in ``fit_wcs_from_points`` [#10155]\n\n- Do not issue ``DATREF`` warning when ``MJDREF`` has default value. [#10440]\n\n- Fixed a bug due to which ``naxis`` argument was ignored if ``header``\n  was supplied during the initialization of a WCS object. [#10532]\n\nOther Changes and Additions\n---------------------------\n\n- Improved the speed of sorting a large ``Table`` on a single column by a factor\n  of around 5. [#10103]\n\n- Ensure that astropy can be used inside Application bundles built with\n  pyinstaller. [#8795]\n\n- Updated the bundled CFITSIO library to 3.49. See\n  ``cextern/cfitsio/docs/changes.txt`` for additional information.\n  [#10256, #10665]\n\n- ``extract_array`` raises a ``ValueError`` if the data type of the\n  input array is inconsistent with the ``fill_value``. [#10602]\n\n\n4.0.1 (2020-03-27)\n==================\n\nBug fixes\n---------\n\nastropy.config\n^^^^^^^^^^^^^^\n\n- Fixed a bug where importing a development version of a package that uses\n  ``astropy`` configuration system can result in a\n  ``~/.astropy/config/package..cfg`` file. [#9975]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug where a vestigal trace of a frame class could persist in the\n  transformation graph even after the removal of all transformations involving\n  that frame class. [#9815]\n\n- Fixed a bug with ``TransformGraph.remove_transform()`` when the \"from\" and\n  \"to\" frame classes are not explicitly specified. [#9815]\n\n- Read-only longitudes can now be passed in to ``EarthLocation`` even if\n  they include angles outside of the range of -180 to 180 degrees. [#9900]\n\n- ```SkyCoord.radial_velocity_correction``` no longer raises an Exception\n  when space motion information is present on the SkyCoord. [#9980]\n\nastropy.io\n^^^^^^^^^^\n\n- Fixed a bug that prevented the unified I/O infrastructure from working with\n  datasets that are represented by directories rather than files. [#9866]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fixed a bug in the ``fast_reader`` C parsers incorrectly returning entries\n  of isolated positive/negative signs as ``float`` instead of ``str``. [#9918]\n\n- Fixed a segmentation fault in the ``fast_reader`` C parsers when parsing an\n  invalid file with ``guess=True`` and the file contains inconsistent column\n  numbers in combination with a quoted field; e.g., ``\"1  2\\n 3  4 '5'\"``.\n  [#9923]\n\n- Magnitude, decibel, and dex can now be stored in ``ecsv`` files. [#9933]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Magnitude, decibel, and dex can now be stored in ``hdf5`` files. [#9933]\n\n- Fixed serialization of polynomial models to include non default values of\n  domain and window values. [#9956, #9961]\n\n- Fixed a bug which affected overwriting tables within ``hdf5`` files.\n  Overwriting an existing path with associated column meta data now also\n  overwrites the meta data associated with the table. [#9950]\n\n- Fixed serialization of Time objects with location under time-1.0.0\n  ASDF schema. [#9983]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fix regression with ``GroupsHDU`` which needs to modify the header to handle\n  invalid headers, and fix accessing ``.data`` for empty HDU. [#9711, #9934]\n\n- Fix ``fitsdiff`` when its arguments are directories that contain other\n  directories. [#9711]\n\n- Fix writing noncontiguous data to a compressed HDU. [#9958]\n\n- Added verification of ``disp`` (``TDISP``) keyword to ``fits.Column`` and\n  extended tests for ``TFORM`` and ``TDISP`` validation. [#9978]\n\n- Fix checksum verification to process all HDUs instead of only the first one\n  because of the lazy loading feature. [#10012]\n\n- Allow passing ``output_verify`` to ``.close`` when using the context manager.\n  [#10030]\n\n- Prevent instantiation of ``PrimaryHDU`` and ``ImageHDU`` with a scalar.\n  [#10041]\n\n- Fix column access by attribute with FITS_rec: columns with scaling or columns\n  from ASCII tables where not properly converted when accessed by attribute\n  name. [#10069]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Magnitude, decibel, and dex can now be stored in ``hdf5`` files. [#9933]\n\n- Fixed serialization of polynomial models to include non default values of\n  domain and window values. [#9956, #9961]\n\n- Fixed a bug which affected overwriting tables within ``hdf5`` files.\n  Overwriting an existing path with associated column meta data now also\n  overwrites the meta data associated with the table. [#9950]\n\n- Fixed serialization of Time objects with location under time-1.0.0\n  ASDF schema. [#9983]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed a bug in setting default values of parameters of orthonormal\n  polynomials when constructing a model set. [#9987]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fixed bug in ``Table.reverse`` for tables that contain non-mutable mixin columns\n  (like ``SkyCoord``) for which in-place item update is not allowed. [#9839]\n\n- Tables containing Magnitude, decibel, and dex columns can now be saved to\n  ``ecsv`` files. [#9933]\n\n- Fixed bug where adding or inserting a row fails on a table with an index\n  defined on a column that is not the first one. [#10027]\n\n- Ensured that ``table.show_in_browser`` also worked for mixin columns like\n  ``Time`` and ``SkyCoord``. [#10068]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Fix inaccuracy when converting between TimeDelta and datetime.timedelta. [#9679]\n\n- Fixed exception when changing ``format`` in the case when ``out_subfmt`` is\n  defined and is incompatible with the new format. [#9812]\n\n- Fixed exceptions in ``Time.to_value()``: when supplying any ``subfmt`` argument\n  for string-based formats like 'iso', and for ``subfmt='long'`` for the formats\n  'byear', 'jyear', and 'decimalyear'. [#9812]\n\n- Fixed bug where the location attribute was lost when creating a new ``Time``\n  object from an existing ``Time`` or list of ``Time`` objects. [#9969]\n\n- Fixed a bug where an exception occurred when creating a ``Time`` object\n  if the ``val1`` argument was a regular double and the ``val2`` argument\n  was a ``longdouble``. [#10034]\n\nastropy.timeseries\n^^^^^^^^^^^^^^^^^^\n\n- Fixed issue with reference time for the ``transit_time`` parameter returned by\n  the ``BoxLeastSquares`` periodogram. Now, the ``transit_time`` will be within\n  the range of the input data and arbitrary time offsets/zero points no longer\n  affect results. [#10013]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Fix for ``quantity_input`` annotation raising an exception on iterable\n  types that don't define a general ``__contains__`` for checking if ``None``\n  is contained (e.g. Enum as of python3.8), by instead checking for instance of\n  Sequence. [#9948]\n\n- Fix for ``u.Quantity`` not taking into account ``ndmin`` if constructed from\n  another ``u.Quantity`` instance with different but convertible unit [#10066]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Fixed ``deprecated_renamed_argument`` not passing in user value to\n  deprecated keyword when the keyword has no new name. [#9981]\n\n- Fixed ``deprecated_renamed_argument`` not issuing a deprecation warning when\n  deprecated keyword without new name is passed in as positional argument.\n  [#9985]\n\n- Fixed detection of read-only filesystems in the caching code. [#10007]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Fixed bug from matplotlib >=3.1 where an empty Quantity array is\n  sent for unit conversion as an empty list. [#9848]\n\n- Fix bug in ``ZScaleInterval`` to return the array minimum and\n  maximum when there are less then ``min_npixels`` in the input array. [#9913]\n\n- Fix a bug in simplifying axis labels that affected non-rectangular frames.\n  [#8004, #9991]\n\n\nOther Changes and Additions\n---------------------------\n\n- Increase minimum asdf version to 2.5.2. [#9996, #9819]\n\n- Updated bundled version of ``WCSLIB`` to v7.2. [#10021]\n\n\n\n4.0 (2019-12-16)\n================\n\nNew Features\n------------\n\nastropy.config\n^^^^^^^^^^^^^^\n\n- The config and cache directories and the name of the config file are now\n  customizable. This allows affiliated packages to put their configuration\n  files in locations other than ``CONFIG_DIR/.astropy/``. [#8237]\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\n- The version of constants can be specified via ScienceState in a way\n  that ``constants`` and ``units`` will be consistent. [#8517]\n\n- Default constants now use CODATA 2018 and IAU 2015 definitions. [#8761]\n\n- Constants can be pickled and unpickled. [#9377]\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug [#9168] where having a kernel defined using unitless astropy\n  quantity objects would result in a crash [#9300]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Changed ``coordinates.solar_system_ephemeris`` to also accept local files\n  as input. The ephemeris can now be selected by either keyword (e.g. 'jpl',\n  'de430'), URL or file path. [#8767]\n\n- Added a ``cylindrical`` property to ``SkyCoord`` for shorthand access to a\n  ``CylindricalRepresentation`` of the coordinate, as is already available\n  for other common representations. [#8857]\n\n- The default parameters for the ``Galactocentric`` frame are now controlled by\n  a ``ScienceState`` subclass, ``galactocentric_frame_defaults``. New\n  parameter sets will be added to this object periodically to keep up with\n  ever-improved measurements of the solar position and motion. [#9346]\n\n- Coordinate frame classes can now have multiple aliases by assigning a list\n  of aliases to the class variable ``name``.  Any of the aliases can be used\n  for attribute-style access or as the target of ``tranform_to()`` calls.\n  [#8834]\n\n- Passing a NaN to ``Distance`` no longer raises a warning. [#9598]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- The pre-publication Planck 2018 cosmological parameters are included as the\n  ``Planck2018_arXiv_v2`` object.  Please note that the values are preliminary,\n  and when the paper is accepted a final version will be included as\n  ``Planck18``. [#8111]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Removed incorrect warnings on ``Overflow`` when reading in\n  ``FloatType`` 0.0 with ``use_fast_converter``; synchronised\n  ``IntType`` ``Overflow`` warning messages. [#9082]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Eliminate deprecated compatibility mode when writing ``Table`` metadata to\n  HDF5 format. [#8899]\n\n- Add support for orthogonal polynomial models to ASDF. [#9107]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Changed the ``fitscheck`` and ``fitsdiff`` script to use the ``argparse``\n  module instead of ``optparse``. [#9148]\n\n- Allow writing of ``Table`` objects with ``Time`` columns that are also table\n  indices to FITS files. [#8077]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Support VOTable version 1.4.  The main addition is the new element, TIMESYS,\n  which allows defining of metadata for temporal coordinates much like COOSYS\n  defines metadata for celestial coordinates. [#9475]\n\nastropy.logger\n^^^^^^^^^^^^^^\n\n- Added a configuration option to specify the text encoding of the log file,\n  with the default behavior being the platform-preferred encoding. [#9203]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Major rework of modeling internals. `See modeling documentation for details.\n  <https://docs.astropy.org/en/v4.0.x/modeling/changes_for_4.html>`_ . [#8769]\n\n- Add ``Tabular1D.inverse``. [#9083]\n\n- ``Model.rename`` was changed to add the ability to rename ``Model.inputs``\n  and ``Model.outputs``. [#9220]\n\n- New function ``fix_inputs`` to generate new models from others by fixing\n  specific inputs variable values to constants. [#9135]\n\n- ``inputs`` and ``outputs`` are now model instance attributes, and ``n_inputs``\n  and ``n_outputs`` are class attributes. Backwards compatible default\n  values of ``inputs`` and ``outputs`` are generated. ``Model.inputs`` and\n  ``Model.outputs`` are now settable which allows renaming them on per user\n  case. [#9298]\n\n- Add a new model representing a sequence of rotations in 3D around an\n  arbitrary number of axes. [#9369]\n\n- Add many of the numpy ufunc functions as models. [#9401]\n\n- Add ``BlackBody`` model. [#9282]\n\n- Add ``Drude1D`` model. [#9452]\n\n- Added analytical King model (KingProjectedAnalytic1D). [#9084]\n\n- Added Exponential1D and Logarithmic1D models. [#9351]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Add a way for technically invalid but unambiguous units in a fits header\n  to be parsed by ``CCDData``. [#9397]\n\n- ``NDData`` now only accepts WCS objects which implement either the high, or\n  low level APE 14 WCS API. All WCS objects are converted to a high level WCS\n  object, so ``NDData.wcs`` now always returns a high level APE 14 object. Not\n  all array slices are valid for wcs objects, so some slicing operations which\n  used to work may now fail. [#9067]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- The ``biweight_location``, ``biweight_scale``, and\n  ``biweight_midvariance`` functions now allow for the ``axis``\n  keyword to be a tuple of integers. [#9309]\n\n- Added an ``ignore_nan`` option to the ``biweight_location``,\n  ``biweight_scale``, and ``biweight_midvariance`` functions. [#9457]\n\n- A numpy ``MaskedArray`` can now be input to the ``biweight_location``,\n  ``biweight_scale``, and ``biweight_midvariance`` functions. [#9466]\n\n- Removed the warning related to p0 in the Bayesian blocks algorithm. The\n  caveat related to p0 is described in the docstring for ``Events``. [#9567]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Improved the implementation of ``Table.replace_column()`` to provide\n  a speed-up of 5 to 10 times for wide tables.  The method can now accept\n  any input which convertible to a column of the correct length, not just\n  ``Column`` subclasses. [#8902]\n\n- Improved the implementation of ``Table.add_column()`` to provide a speed-up\n  of 2 to 10 (or more) when adding a column to tables, with increasing benefit\n  as the number of columns increases.  The method can now accept any input\n  which is convertible to a column of the correct length, not just ``Column``\n  subclasses. [#8933]\n\n- Changed the implementation of ``Table.add_columns()`` to use the new\n  ``Table.add_column()`` method.  In most cases the performance is similar\n  or slightly faster to the previous implementation. [#8933]\n\n- ``MaskedColumn.data`` will now return a plain ``MaskedArray`` rather than\n  the previous (unintended) ``masked_BaseColumn``. [#8855]\n\n- Added depth-wise stacking ``dstack()`` in higher level table operation.\n  It help will in stacking table column depth-wise. [#8939]\n\n- Added a new table equality method ``values_equal()`` which allows comparison\n  table values to another table, list, or value, and returns an\n  element-by-element equality table. [#9068]\n\n- Added new ``join_type='cartesian'`` option to the ``join`` operation. [#9288]\n\n- Allow adding a table column as a list of mixin-type objects, for instance\n  ``t['q'] = [1 * u.m, 2 * u.m]``. [#9165]\n\n- Allow table ``join()`` using any sortable key column (e.g. Time), not\n  just ndarray subclasses. A column is considered sortable if there is a\n  ``<column>.info.get_sortable_arrays()`` method that is implemented. [#9340]\n\n- Added ``Table.iterrows()`` for making row-wise iteration faster. [#8969]\n\n- Allow table to be initialized with a list of dict where the dict keys\n  are not the same in every row. The table column names are the set of all keys\n  found in the input data, and any missing key/value pairs are turned into\n  missing data in the table. [#9425]\n\n- Prevent unnecessary ERFA warnings when indexing by ``Time`` columns. [#9545]\n\n- Added support for sorting tables which contain non-mutable mixin columns\n  (like ``SkyCoord``) for which in-place item update is not allowed. [#9549]\n\n- Ensured that inserting ``np.ma.masked`` (or any other value with a mask) into\n  a ``MaskedColumn`` causes a masked entry to be inserted. [#9623]\n\n- Fixed a bug that caused an exception when initializing a ``MaskedColumn`` from\n  another ``MaskedColumn`` that has a structured dtype. [#9651]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- The plugin that handles the custom header in the test output has been\n  moved to the ``pytest-astropy-header plugin`` package. `See the README at\n  <https://github.com/astropy/pytest-astropy-header>`__ for information about\n  using this new plugin. [#9214]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Added a new time format ``ymdhms`` for representing times via year, month,\n  day, hour, minute, and second attributes. [#7644]\n\n- ``TimeDelta`` gained a ``to_value`` method, so that it becomes easier to\n  use it wherever a ``Quantity`` with units of time could be used. [#8762]\n\n- Made scalar ``Time`` and ``TimeDelta`` objects hashable based on JD, time\n  scale, and location attributes. [#8912]\n\n- Improved error message when bad input is used to initialize a ``Time`` or\n  ``TimeDelta`` object and the format is specified. [#9296]\n\n- Allow numeric time formats to be initialized with numpy ``longdouble``,\n  ``Decimal`` instances, and strings.  One can select just one of these\n  using ``in_subfmt``.  The output can be similarly set using ``out_subfmt``.\n  [#9361]\n\n- Introduce a new ``.to_value()`` method for ``Time`` (and adjusted the\n  existing method for ``TimeDelta``) so that one can get values in a given\n  ``format`` and possible ``subfmt`` (e.g., ``to_value('mjd', 'str')``. [#9361]\n\n- Prevent unnecessary ERFA warnings when sorting ``Time`` objects. [#9545]\n\nastropy.timeseries\n^^^^^^^^^^^^^^^^^^\n\n- Adding ``epoch_phase``, ``wrap_phase`` and ``normalize_phase`` keywords to\n  ``TimeSeries.fold()`` to control the phase of the epoch and to return\n  normalized phase rather than time for the folded TimeSeries. [#9455]\n\nastropy.uncertainty\n^^^^^^^^^^^^^^^^^^^\n\n- ``Distribution`` was rewritten such that it deals better with subclasses.\n  As a result, Quantity distributions now behave correctly with ``to`` methods\n  yielding new distributions of the kind expected for the starting\n  distribution, and ``to_value`` yielding ``NdarrayDistribution`` instances.\n  [#9429, #9442]\n\n- The ``pdf_*`` properties that were used to calculate statistical properties\n  of ``Distrubution`` instances were changed into methods. This allows one\n  to pass parameters such as ``ddof`` to ``pdf_std`` and ``pdf_var`` (which\n  generally should equal 1 instead of the default 0), and reflects that these\n  are fairly involved calculations, not just \"properties\". [#9613]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Support for unicode parsing. Currently supported are superscripts, Ohm,\n  Ångström, and the micro-sign. [#9348]\n\n- Accept non-unit type annotations in @quantity_input. [#8984]\n\n- For numpy 1.17 and later, the new ``__array_function__`` protocol is used to\n  ensure that all top-level numpy functions interact properly with\n  ``Quantity``, preserving units also in operations like ``np.concatenate``.\n  [#8808]\n\n- Add equivalencies for surface brightness units to spectral_density. [#9282]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- ``astropy.utils.data.download_file`` and\n  ``astropy.utils.data.get_readable_fileobj`` now provides an ``http_headers``\n  keyword to pass in specific request headers for the download. It also now\n  defaults to providing ``User-Agent: Astropy`` and ``Accept: */*``\n  headers. The default ``User-Agent`` value can be set with a new\n  ``astropy.data.conf.default_http_user_agent`` configuration item.\n  [#9508, #9564]\n\n- Added a new ``astropy.utils.misc.unbroadcast`` function which can be used\n  to return the smallest array that can be broadcasted back to the initial\n  array. [#9209]\n\n- The specific IERS Earth rotation parameter table used for time and\n  coordinate transformations can now be set, either in a context or per\n  session, using ``astropy.utils.iers.earth_rotation_table``. [#9244]\n\n- Added ``export_cache`` and ``import_cache`` to permit transporting\n  downloaded data to machines with no Internet connection. Several new\n  functions are available to investigate the cache contents; e.g.,\n  ``check_download_cache`` can be used to confirm that the persistent\n  cache has not become damaged. [#9182]\n\n- A new ``astropy.utils.iers.LeapSeconds`` class has been added to track\n  leap seconds. [#9365]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Added a new ``time_support`` context manager/function for making it easy to\n  plot and format ``Time`` objects in Matplotlib. [#8782]\n\n- Added support for plotting any WCS compliant with the generalized (APE 14)\n  WCS API with WCSAxes. [#8885, #9098]\n\n- Improved display of information when inspecting ``WCSAxes.coords``. [#9098]\n\n- Improved error checking for the ``slices=`` argument to ``WCSAxes``. [#9098]\n\n- Added support for more solar frames in WCSAxes. [#9275]\n\n- Add support for one dimensional plots to ``WCSAxes``. [#9266]\n\n- Add a ``get_format_unit`` to ``wcsaxes.CoordinateHelper``. [#9392]\n\n- ``WCSAxes`` now, by default, sets a default label for plot axes which is the\n  WCS physical type (and unit) for that axis. This can be disabled using the\n  ``coords[i].set_auto_axislabel(False)`` or by explicitly setting an axis\n  label. [#9392]\n\n- Fixed the display of tick labels when plotting all sky images that have a\n  coord_wrap less than 360. [#9542]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Added a ``astropy.wcs.wcsapi.pixel_to_pixel`` function that can be used to\n  transform pixel coordinates in one dataset with a WCS to pixel coordinates\n  in another dataset with a different WCS. This function is designed to be\n  efficient when the input arrays are broadcasted views of smaller\n  arrays. [#9209]\n\n- Added a ``local_partial_pixel_derivatives`` function that can be used to\n  determine a matrix of partial derivatives of each world coordinate with\n  respect to each pixel coordinate. [#9392]\n\n- Updated wcslib to v6.4. [#9125]\n\n- Improved the  ``SlicedLowLevelWCS`` class in ``astropy.wcs.wcsapi`` to avoid\n  storing chains of nested ``SlicedLowLevelWCS`` objects when applying multiple\n  slicing operations in turn. [#9210]\n\n- Added a ``wcs_info_str`` function to ``astropy.wcs.wcsapi`` to show a summary\n  of an APE-14-compliant WCS as a string. [#8546, #9207]\n\n- Added two new optional attributes to the APE 14 low-level WCS:\n  ``pixel_axis_names`` and ``world_axis_names``. [#9156]\n\n- Updated the WCS class to now correctly take and return ``Time`` objects in\n  the high-level APE 14 API (e.g. ``pixel_to_world``. [#9376]\n\n- ``SlicedLowLevelWCS`` now raises ``IndexError`` rather than ``ValueError`` on\n  an invalid slice. [#9067]\n\n- Added ``fit_wcs_from_points`` function to ``astropy.wcs.utils``. Fits a WCS\n  object to set of matched detector/sky coordinates. [#9469]\n\n- Fix various bugs in ``SlicedLowLevelWCS`` when the WCS being sliced was one\n  dimensional. [#9693]\n\n\nAPI Changes\n-----------\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\n- Deprecated ``set_enabled_constants`` context manager. Use\n  ``astropy.physical_constants`` and ``astropy.astronomical_constants``.\n  [#9025]\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Removed the deprecated keyword argument ``interpolate_nan`` from\n  ``convolve_fft``. [#9356]\n\n- Removed the deprecated keyword argument ``stddev`` from\n  ``Gaussian2DKernel``. [#9356]\n\n- Deprecated and renamed ``MexicanHat1DKernel`` and ``MexicanHat2DKernel``\n  to ``RickerWavelet1DKernel`` and ``RickerWavelet2DKernel``. [#9445]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Removed the ``recommended_units`` attribute from Representations; it was\n  deprecated since 3.0. [#8892]\n\n- Removed the deprecated frame attribute classes, ``FrameAttribute``,\n  ``TimeFrameAttribute``, ``QuantityFrameAttribute``,\n  ``CartesianRepresentationFrameAttribute``; deprecated since 3.0. [#9326]\n\n- Removed ``longitude`` and ``latitude`` attributes from ``EarthLocation``;\n  deprecated since 2.0. [#9326]\n\n- The ``DifferentialAttribute`` for frame classes now passes through any input\n  to the ``allowed_classes`` if only one allowed class is specified, i.e. this\n  now allows passing a quantity in for frame attributes that use\n  ``DifferentialAttribute``. [#9325]\n\n- Removed the deprecated ``galcen_ra`` and ``galcen_dec`` attributes from the\n  ``Galactocentric`` frame. [#9346]\n\nastropy.extern\n^^^^^^^^^^^^^^\n\n- Remove the bundled ``six`` module. [#8315]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Masked column handling has changed, see ``astropy.table`` entry below.\n  [#8789]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Masked column handling has changed, see ``astropy.table`` entry below.\n  [#8789]\n\n- Removed deprecated ``usecPickle`` kwarg from ``fnunpickle`` and\n  ``fnpickle``. [#8890]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Masked column handling has changed, see ``astropy.table`` entry below.\n  [#8789]\n\n- ``io.fits.Header`` has been made safe for subclasses for copying and slicing.\n  As a result of this change, the private subclass ``CompImageHeader``\n  now always should be passed an explicit ``image_header``. [#9229]\n\n- Removed the deprecated ``tolerance`` option in ``fitsdiff`` and\n  ``io.fits.diff`` classes. [#9520]\n\n- Removed deprecated keyword arguments for ``CompImageHDU``:\n  ``compressionType``, ``tileSize``, ``hcompScale``, ``hcompSmooth``,\n  ``quantizeLevel``. [#9520]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Changed ``pedantic`` argument to ``verify`` and change it to have three\n  string-based options (``ignore``, ``warn``, and ``exception``) instead of\n  just being a boolean. In addition, changed default to ``ignore``, which means\n  that warnings will not be shown by default when loading VO tables. [#8715]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Eliminates support for compound classes (but not compound instances!) [#8769]\n\n- Slicing compound models more restrictive. [#8769]\n\n- Shape of parameters now includes n_models as dimension. [#8769]\n\n- Parameter instances now hold values instead of models. [#8769]\n\n- Compound model parameters now share instance and value with\n  constituent models. [#8769]\n\n- No longer possible to assign slices of parameter values to model parameters\n  attribute (it is possible to replace it with a complete array). [#8769]\n\n- Many private attributes and methods have changed (see documentation). [#8769]\n\n- Deprecated ``BlackBody1D`` model and ``blackbody_nu`` and\n  ``blackbody_lambda`` functions. [#9282]\n\n- The deprecated ``rotations.rotation_matrix_from_angle`` was removed. [#9363]\n\n- Deprecated and renamed ``MexicanHat1D`` and ``MexicanHat2D``\n  to ``RickerWavelet1D`` and ``RickerWavelet2D``. [#9445]\n\n- Deprecated ``modeling.utils.ExpressionTree``. [#9576]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Removed the ``iters`` keyword from sigma clipping stats functions. [#8948]\n\n- Renamed the ``a`` parameter to ``data`` in biweight stat functions. [#8948]\n\n- Renamed the ``a`` parameter to ``data`` in ``median_absolute_deviation``.\n  [#9011]\n\n- Renamed the ``conflevel`` keyword to ``confidence_level`` in\n  ``poisson_conf_interval``. Usage of ``conflevel`` now issues\n  ``AstropyDeprecationWarning``. [#9408]\n\n- Renamed the ``conf`` keyword to ``confidence_level`` in\n  ``binom_conf_interval`` and ``binned_binom_proportion``. Usage of ``conf``\n  now issues ``AstropyDeprecationWarning``. [#9408]\n\n- Renamed the ``conf_lvl`` keyword to ``confidence_level`` in\n  ``jackknife_stats``. Usage of ``conf_lvl`` now issues\n  ``AstropyDeprecationWarning``. [#9408]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- The handling of masked columns in the ``Table`` class has changed in a way\n  that may impact program behavior. Now a ``Table`` with ``masked=False``\n  may contain both ``Column`` and ``MaskedColumn`` objects, and adding a\n  masked column or row to a table no longer \"upgrades\" the table and columns\n  to masked.  This means that tables with masked data which are read via\n  ``Table.read()`` will now always have ``masked=False``, though specific\n  columns will be masked as needed. Two new table properties\n  ``has_masked_columns`` and ``has_masked_values`` were added. See the\n  `Masking change in astropy 4.0 section within\n  <https://docs.astropy.org/en/v4.0.x/table/masking.html>`_ for\n  details. [#8789]\n\n- Table operation functions such as ``join``, ``vstack``, ``hstack``, etc now\n  always return a table with ``masked=False``, though the individual columns\n  may be masked as necessary. [#8957]\n\n- Changed implementation of ``Table.add_column()`` and ``Table.add_columns()``\n  methods.  Now it is possible add any object(s) which can be converted or\n  broadcasted to a valid column for the table.  ``Table.__setitem__`` now\n  just calls ``add_column``. [#8933]\n\n- Changed default table configuration setting ``replace_warnings`` from\n  ``['slice']`` to ``[]``.  This removes the default warning when replacing\n  a table column that is a slice of another column. [#9144]\n\n- Removed the non-public method\n  ``astropy.table.np_utils.recarray_fromrecords``. [#9165]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- In addition to ``DeprecationWarning``, now ``FutureWarning`` and\n  ``ImportWarning`` would also be turned into exceptions. [#8506]\n\n- ``warnings_to_ignore_by_pyver`` option in\n  ``enable_deprecations_as_exceptions()`` has changed. Please refer to API\n  documentation. [#8506]\n\n- Default settings for ``warnings_to_ignore_by_pyver`` are updated to remove\n  very old warnings that are no longer relevant and to add a new warning\n  caused by ``pytest-doctestplus``. [#8506]\n\nastropy.time\n^^^^^^^^^^^^\n\n- ``Time.get_ut1_utc`` now uses the auto-updated ``IERS_Auto`` by default,\n  instead of the bundled ``IERS_B`` file. [#9226]\n\n- Time formats that do not use ``val2`` now raise ValueError instead of\n  silently ignoring a provided value. [#9373]\n\n- Custom time formats can now accept floating-point types with extended\n  precision. Existing time formats raise exceptions rather than discarding\n  extended precision through conversion to ordinary floating-point. [#9368]\n\n- Time formats (implemented in subclasses of ``TimeFormat``) now have\n  their input and output routines more thoroughly validated, making it more\n  difficult to create damaged ``Time`` objects. [#9375]\n\n- The ``TimeDelta.to_value()`` method now can also take the ``format`` name\n  as its argument, in which case the value will be calculated using the\n  ``TimeFormat`` machinery. For this case, one can also pass a ``subfmt``\n  argument to retrieve the value in another form than ``float``. [#9361]\n\nastropy.timeseries\n^^^^^^^^^^^^^^^^^^\n\n- Keyword ``midpoint_epoch`` is renamed to ``epoch_time``. [#9455]\n\nastropy.uncertainty\n^^^^^^^^^^^^^^^^^^^\n\n- ``Distribution`` was rewritten such that it deals better with subclasses.\n  As a result, Quantity distributions now behave correctly with ``to`` methods\n  yielding new distributions of the kind expected for the starting distribution,\n  and ``to_value`` yielding ``NdarrayDistribution`` instances. [#9442]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- For consistency with ``ndarray``, scalar ``Quantity.value`` will now return\n  a numpy scalar rather than a python one.  This should help keep track of\n  precision better, but may lead to unexpected results for the rare cases\n  where numpy scalars behave differently than python ones (e.g., taking the\n  square root of a negative number). [#8876]\n\n- Removed the ``magnitude_zero_points`` module, which was deprecated in\n  favour of ``astropy.units.photometric`` since 3.1. [#9353]\n\n- ``EquivalentUnitsList`` now has a ``_repr_html_`` method to output a HTML\n  table on a call to ``find_equivalent_units`` in Jupyter notebooks. [#9495]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- ``download_file`` and related functions now accept a list of fallback\n  sources, and they are able to update the cache at the user's request. [#9182]\n\n- Allow ``astropy.utils.console.ProgressBarOrSpinner.map`` and\n  ``.map_unordered`` to take an argument ``multiprocessing_start_method`` to\n  control how subprocesses are started; the different methods (``fork``,\n  ``spawn``, and ``forkserver``) have different implications in terms of\n  security, efficiency, and behavioural anomalies. The option is useful in\n  particular for cross-platform testing because Windows supports only ``spawn``\n  while Linux defaults to ``fork``. [#9182]\n\n- All operations that act on the astropy download cache now take an argument\n  ``pkgname`` that allows one to specify which package's cache to use.\n  [#8237, #9182]\n\n- Removed deprecated ``funcsigs`` and ``futures`` from\n  ``astropy.utils.compat``. [#8909]\n\n- Removed the deprecated ``astropy.utils.compat.numpy`` module. [#8910]\n\n- Deprecated ``InheritDocstrings`` as it is natively supported by\n  Sphinx 1.7 or higher. [#8881]\n\n- Deprecated ``astropy.utils.timer`` module, which has been moved to\n  ``astroquery.utils.timer`` and will be part of ``astroquery`` 0.4.0. [#9038]\n\n- Deprecated ``astropy.utils.misc.set_locale`` function, as it is meant for\n  internal use only. [#9471]\n\n- The implementation of ``data_info.DataInfo`` has changed (for a considerable\n  performance boost). Generally, this should not affect simple subclasses, but\n  because the class now uses ``__slots__`` any attributes on the class have to\n  be explicitly given a slot. [#8998]\n\n- ``IERS`` tables now use ``nan`` to mark missing values\n  (rather than ``1e20``). [#9226]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- The default ``clip`` value is now ``False`` in ``ImageNormalize``. [#9478]\n\n- The default ``clip`` value is now ``False`` in ``simple_norm``.\n  [#9698]\n\n- Infinite values are now excluded when calculating limits in\n  ``ManualInterval`` and ``MinMaxInterval``.  They were already excluded in\n  all other interval classes. [#9480]\n\n\nBug Fixes\n---------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed ``nan_treatment='interpolate'`` option to ``convolve_fft`` to properly\n  take into account ``fill_value``. [#8122]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- The ``QuantityAttribute`` class now supports a None default value if a unit\n  is specified. [#9345]\n\n- When ``Representation`` classes with the same name are defined, this no\n  longer leads to a ``ValueError``, but instead to a warning and the removal\n  of both from the name registry (i.e., one either has to use the class itself\n  to set, e.g., ``representation_type``, or refer to the class by its fully\n  qualified name). [#8561]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Implemented skip (after warning) of header cards with reserved\n  keywords in ``table_to_hdu``. [#9390]\n\n- Add ``AstropyDeprecationWarning`` to ``read_table_fits`` when ``hdu=`` is\n  selected, but does not match single present table HDU. [#9512]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Address issue #8995 by ignoring BINARY2 null mask bits for string values\n  on parsing a VOTable.  In this way, the reader should never create masked\n  values for string types. [#9057]\n\n- Corrected a spurious warning issued for the ``value`` attribute of the\n  ``<OPTION>`` element in VOTable, as well as a test that erroneously\n  treated the warning as acceptable.  [#9470]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- ``Cutout2D`` will now get the WCS from its first argument if that argument\n  has with WCS property. [#9492]\n\n- ``overlap_slices`` will now raise a ``ValueError`` if the input\n  position contains any non-finite values (e.g. NaN or inf). [#9648]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Fixed a bug where ``bayesian_blocks`` returned a single edge. [#8560]\n\n- Fixed input data type validation for ``bayesian_blocks`` to work int\n  arrays. [#9513]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix bug where adding a column consisting of a list of masked arrays was\n  dropping the masks. [#9048]\n\n- ``Quantity`` columns with custom units can now round-trip via FITS tables,\n  as long as the custom unit is enabled during reading (otherwise, the unit\n  will become an ``UnrecognizedUnit``). [#9015]\n\n- Fix bug where string values could be truncated when inserting into a\n  ``Column`` or ``MaskedColumn``, or when adding or inserting a row containing\n  string values. [#9559]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Fix bug when ``Time`` object is created with only masked elements. [#9624]\n\n- Fix inaccuracy when converting between TimeDelta and datetime.timedelta.\n  [#9679]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Ensure that output from test functions of and comparisons between quantities\n  can be stored into pre-allocated output arrays (using ``out=array``) [#9273]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- For the default ``IERS_Auto`` table, which combines IERS A and B values, the\n  IERS nutation parameters \"dX_2000A\" and \"dY_2000A\" are now also taken from\n  the actual IERS B file rather than from the B values stored in the IERS A\n  file.  Any differences should be negligible for any practical application,\n  but this may help exactly reproducing results. [#9237]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Calling ``WCSAxes.set_axis_off()`` now correctly turns off drawing the Axes.\n  [#9411]\n\n- Fix incorrect transformation behavior in ``WCSAxes.plot_coord`` and correctly\n  handle when input coordinates are not already in spherical representations.\n  [#8927]\n\n- Fixed ``ImageNormalize`` so that when it is initialized without\n  ``data`` it will still use the input ``interval`` class. [#9698]\n\n- Fixed ``ImageNormalize`` to handle input data with non-finite\n  values. [#9698]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Fix incorrect value returned by\n  ``wcsapi.HighLevelWCSWrapper.axis_correlation_matrix``. [#9554]\n\n- Fix NaN-masking of world coordinates when some but not all of the coordinates\n  were flagged as invalid by WCSLIB. This occurred for example with WCS with >2\n  dimensions where two of the dimensions were celestial coordinates and pixel\n  coordinates outside of the 'sky' were converted to world coordinates -\n  previously all world coordinates were masked even if uncorrelated with the\n  celestial axes, but this is no longer the case. [#9688]\n\n- The default WCS to celestial frame mapping for world coordinate systems that\n  specify ``TLON`` and ``TLAT`` coordinates will now return an ITRS frame with\n  the representation class set to ``SphericalRepresentation``. This fixes a bug\n  that caused ``WCS.pixel_to_world`` to raise an error for such world\n  coordinate systems. [#9609]\n\n- ``FITSWCSAPIMixin`` now returns tuples not lists from ``pixel_to_world`` and\n  ``world_to_pixel``. [#9678]\n\n\nOther Changes and Additions\n---------------------------\n\n- Versions of Python <3.6 are no longer supported. [#8955]\n\n- Matplotlib 2.1 and later is now required. [#8787]\n\n- Versions of Numpy <1.16 are no longer supported. [#9292]\n\n- Updated the bundled CFITSIO library to 3.470. See\n  ``cextern/cfitsio/docs/changes.txt`` for additional information. [#9233]\n\n- The bundled ERFA was updated to version 1.7.0. This is based on\n  SOFA 20190722. This includes a fix to avoid precision loss for negative\n  JDs, and also includes additional routines to allow updates to the\n  leap-second table. [#9323, #9734]\n\n- The default server for the IERS data files has been updated to reflect\n  long-term downtime of the canonical USNO server. [#9487, #9508]\n\n\n\n3.2.3 (2019-10-27)\n==================\n\nOther Changes and Additions\n---------------------------\n\n- Updated IERS A URLs due to USNO prolonged maintenance. [#9443]\n\n\n\n3.2.2 (2019-10-07)\n==================\n\nBug fixes\n---------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug in ``discretize_oversample_1D/2D()`` from\n  ``astropy.convolution.utils``, which might occasionally introduce unexpected\n  oversampling grid dimensions due to a numerical precision issue. [#9293]\n\n- Fixed a bug [#9168] where having a kernel defined using unitless astropy\n  quantity objects would result in a crash [#9300]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Fix concatenation of representations for cases where the units were different.\n  [#8877]\n\n- Check for NaN values in catalog and match coordinates before building and\n  querying the ``KDTree`` for coordinate matching. [#9007]\n\n- Fix sky coordinate matching when a dimensionless distance is provided. [#9008]\n\n- Raise a faster and more meaningful error message when differential data units\n  are not compatible with a containing representation's units. [#9064]\n\n- Changed the timescale in ICRS to CIRS from 'tdb' to 'tt' conversion and\n  vice-versa, as the erfa function that gets called in the process, pnm06a\n  accepts time in TT. [#9079]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fixed the fast reader when used in parallel and with the multiprocessing\n  'spawn' method (which is the default on MacOS X with Python 3.8 and later),\n  and enable parallel fast reader on Windows. [#8853]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fixes bug where an invalid TRPOS<n> keyword was being generated for FITS\n  time column when no location was available. [#8784]\n\n- Fixed a wrong exception when converting a Table with a unit that is not FITS\n  compliant and not convertible to a string using ``format='fits'``. [#8906]\n\n- Fixed an issue with A3DTABLE extension that could not be read. [#9012]\n\n- Fixed the update of the header when creating GroupsHDU from data. [#9216]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Fix to ``add_array``, which now accepts ``array_small`` having dimensions\n  equal to ``array_large``, instead of only allowing smaller sizes of\n  arrays. [#9118]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Fixed ``median_absolute_deviation`` for the case where ``ignore_nan=True``\n  and an input masked array contained both NaNs and infs. [#9307]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Comparisons between ``Column`` instances and ``Quantity`` will now\n  correctly take into account the unit (as was already the case for\n  regular operations such as addition). [#8904]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Allow ``Time`` to be initialized with an empty value for all formats. [#8854]\n\n- Fixed a troubling bug in which ``Time`` could loose precision, with deviations\n  of 300 ns. [#9328]\n\nastropy.timeseries\n^^^^^^^^^^^^^^^^^^\n\n- Fixed handling of ``Quantity`` input data for all methods of\n  ``LombScarge.false_alarm_probabilty``. [#9246]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Allow conversion of ``Column`` with logarithmic units to a suitable\n  ``Quantity`` subclass if ``subok=True``. [#9188]\n\n- Ensured that we simplify powers to smaller denominators if that is\n  consistent within rounding precision. [#9267]\n\n- Ensured that the powers shown in a unit's repr are always correct,\n  not oversimplified. [#9267]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Fixed ``find_api_page`` access by using custom request headers and HTTPS\n  when version is specified. [#9032]\n\n- Make ``download_file`` (and by extension ``get_readable_fileobj`` and others)\n  check the size of downloaded files against the size claimed by the server.\n  [#9302]\n\n- Fix ``find_current_module`` so that it works properly if astropy is being used\n  inside a bundle such as that produced by PyInstaller. [#8845]\n\n- Fix path to renamed classes, which previously included duplicate path/module\n  information under certain circumstances. [#8845]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Silence numpy runtime warnings in ``WCSAxes`` when drawing grids. [#8882]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Fixed equality test between ``cunit`` where the first element was equal but\n  the following elements differed. [#9154]\n\n- Fixed a crash while loading a WCS from headers containing duplicate SIP\n  keywords. [#8893]\n\n- Fixed a possible buffer overflow when using too large negative indices for\n  ``cunit`` or ``ctype`` [#9151]\n\n- Fixed reference counting in ``WCSBase.__init__`` [#9166]\n\n- Fix ``SlicedLowLevelWCS`` ``world_to_pixel_values`` and\n  ``pixel_to_world_values`` when inputs need broadcasting to the same shape.\n  (i.e. when one input is sliced out) [#9250]\n\n- Fixed a bug that caused ``WCS.array_shape``, ``WCS.pixel_shape`` and\n  ``WCS.pixel_bounds`` to be incorrect after using ``WCS.sub``. [#9095]\n\n\nOther Changes and Additions\n---------------------------\n\n- Fixed a bug that caused files outside of the astropy module directory to be\n  included as package data, resulting in some cases in errors when doing\n  repeated builds. [#9039]\n\n\n\n3.2.1 (2019-06-14)\n==================\n\nBug fixes\n---------\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Avoid reporting a warning with ``BinTableHDU.from_columns`` with keywords that\n  are not provided by the user.  [#8838]\n\n- Fix ``Header.fromfile`` to work on FITS files. [#8713]\n\n- Fix reading of empty ``BinTableHDU`` when stored in a gzip-compressed file.\n  [#8848]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix a problem where mask was dropped when creating a ``MaskedColumn``\n  from a list of ``MaskedArray`` objects. [#8826]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Added ``None`` to be displayed as a ``world_axis_physical_types`` in\n  the ``WCS`` repr, as ``None`` values are now supported in ``APE14``. [#8811]\n\n\n\n3.2 (2019-06-10)\n================\n\nNew Features\n------------\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\n- Add CODATA 2018 constants but not make them default because the\n  redefinition of SI units that will follow has not been implemented\n  yet. [#8595]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- New ``BarycentricMeanEcliptic``, ``HeliocentricTrueEcliptic`` and\n  ``GeocentricTrueEcliptic`` frames.\n  The ecliptic frames are no longer considered experimental. [#8394]\n\n- The default time scale for epochs like 'J2000' or 'B1975' is now \"tt\",\n  which is the correct one for 'J2000' and avoids leap-second warnings\n  for epochs in the far future or past. [#8600]\n\nastropy.extern\n^^^^^^^^^^^^^^\n\n- Bundled ``six`` now emits ``AstropyDeprecationWarning``. It will be removed\n  in 4.0. [#8323]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- IPAC tables now output data types of ``float`` instead of ``double``, or\n  ``int`` instead of ``long``, based on the column ``dtype.itemsize``. [#8216]\n\n- Update handling of MaskedColumn columns when using the 'data_mask' serialization\n  method.  This can make writing ECSV significantly faster if the data do not\n  actually have any masked values. [#8447]\n\n- Fixed a bug that caused newlines to be incorrect when writing out ASCII tables\n  on Windows (they were ``\\r\\r\\n`` instead of ``\\r\\n``). [#8659]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Implement serialization of ``TimeDelta`` in ASDF. [#8285]\n\n- Implement serialization of ``EarthLocation`` in ASDF. [#8286]\n\n- Implement serialization of ``SkyCoord`` in ASDF. [#8284]\n\n- Support serialization of Astropy tables with mixin columns in ASDF. [#8337]\n\n- No warnings when reading HDF5 files with only one table and no ``path=``\n  argument [#8483]\n\n- The HDF5 writer will now create a default table instead of raising an\n  exception when ``path=`` is not specified and when writing to empty/new HDF5\n  files. [#8553]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Optimize parsing of cards within the ``Header`` class. [#8428]\n\n- Optimize the parsing of headers to get the structural keywords that are\n  needed to find extensions. Thanks to this, getting a random HDU from a file\n  with many extensions is much faster than before, in particular when the\n  extension headers contain many keywords. [#8502]\n\n-  Change behavior of FITS undefined value in ``Header`` such that ``None``\n   is used in Python to represent FITS undefined when using dict interface.\n   ``Undefined`` can also be assigned and is translated to ``None``.\n   Previously setting a header card value to ``None`` resulted in an\n   empty string field rather than a FITS undefined value. [#8572]\n\n- Allow ``Header.fromstring`` and ``Card.fromstring`` to accept ``bytes``.\n  [#8707]\n\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\n- Implement ``Table`` reader and writer for ``ASDF``. [#8261]\n\n- Implement ``Table`` reader and writer methods to wrap ``pandas`` I/O methods\n  for CSV, Fixed width format, HTML, and JSON. [#8381]\n\n- Add ``help()`` and ``list_formats()`` methods to unified I/O ``read`` and\n  ``write`` methods. For example ``Table.read.help()`` gives help on available\n  ``Table`` read formats and ``Table.read.help('fits')`` gives detailed\n  help on the arguments for reading FITS table file. [#8255]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Initializing a table with ``Table(rows=...)``, if the first item is an ``OrderedDict``,\n  now uses the column order of the first row. [#8587]\n\n- Added new pprint_all() and pformat_all() methods to Table. These two new\n  methods print the entire table by default. [#8577]\n\n- Removed restriction of initializing a Table from a dict with copy=False. [#8541]\n\n- Improved speed of table row access by a factor of about 2-3.  Improved speed\n  of Table len() by a factor of around 3-10 (depending on the number of columns).\n  [#8494]\n\n- Improved the Table - pandas ``DataFrame`` interface (``to_pandas()`` and\n  ``from_pandas()``).  Mixin columns like ``Time`` and ``Quantity`` can now be\n  converted to pandas by flattening the columns as necessary to plain\n  columns.  ``Time`` and ``TimeDelta`` columns get converted to\n  corresponding pandas date or time delta types.  The ``DataFrame``\n  index is now handled in the conversion methods. [#8247]\n\n- Added ``rename_columns`` method to rename multiple columns in one call.\n  [#5159, #8070]\n\n- Improved Table performance by reducing unnecessary calls to copy and deepcopy,\n  especially as related to the table and column ``meta`` attributes.  Changed the\n  behavior when slicing a table (either in rows or with a list of column names)\n  so now the sliced output gets a light (key-only) copy of ``meta`` instead of a\n  deepcopy.  Changed the ``Table.meta`` class-level descriptor so that assigning\n  directly to ``meta``, e.g. ``tbl.meta = new_meta`` no longer does a deepcopy\n  and instead just directly assigns the ``new_meta`` object reference.  Changed\n  Table initialization so that input ``meta`` is copied only if ``copy=True``.\n  [#8404]\n\n- Improved Table slicing performance with internal implementation changes\n  related to column attribute access and certain input validation. [#8493]\n\n- Added ``reverse`` argument to the ``sort`` and ``argsort`` methods to allow\n  sorting in reverse order. [#8528]\n\n- Improved ``Table.sort()`` performance by removing ``self[keys]`` from code\n  which is creating deep copies of ``meta`` attribute and adding a new keyword\n  ``names`` in ``get_index()`` to get index by using a list or tuple containing\n  names of columns. [#8570]\n\n- Expose ``represent_mixins_as_columns`` as a public function in the\n  ``astropy.table`` subpackage.  This previously-private function in the\n  ``table.serialize`` module is used to represent mixin columns in a Table as\n  one or more plain Column objects. [#7729]\n\nastropy.timeseries\n^^^^^^^^^^^^^^^^^^\n\n- Added a new astropy.timeseries sub-package to represent and manipulate\n  sampled and binned time series. [#8540]\n\n- The ``BoxLeastSquares`` and ``LombScargle`` classes have been moved to\n  ``astropy.timeseries.periodograms`` from ``astropy.stats``. [#8591]\n\n- Added the ability to provide absolute ``Time`` objects to the\n  ``BoxLeastSquares`` and ``LombScargle`` periodogram classes. [#8599]\n\n- Added model inspection methods (``model_parameters()``, ``design_matrix()``,\n  and ``offset()``) to ``astropy.timeseries.LombScargle`` class [#8397].\n\nastropy.units\n^^^^^^^^^^^^^\n\n- ``Quantity`` overrides of ``ndarray`` methods such as ``sum``, ``min``,\n  ``max``, which are implemented via reductions, have been removed since they\n  are dealt with in ``Quantity.__array_ufunc__``. This should not affect\n  subclasses, but they may consider doing similarly. [#8316]  Note that this\n  does not include methods that use more complicated python code such as\n  ``mean``, ``std`` and ``var``. [#8370]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n- Added ``CompositeStretch``, which inherits from ``CompositeTransform`` and\n  also ``BaseStretch`` so that it can be used with ``ImageNormalize``. [#8564]\n\n- Added a ``log_a`` argument to the ``simple_norm`` method. Similar to the\n  exposing of the ``asinh_a`` argument for ``AsinhStretch``, the new\n  ``log_a`` argument is now exposed for ``LogStretch``. [#8436]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- WCSLIB was updated to v 6.2.\n  This adds support for time-related WCS keywords (WCS Paper VII).\n  FITS headers containing ``Time`` axis are parsed and the axis is included in\n  the WCS object. [#8592]\n\n- The ``OBSGEO`` attribute as expanded to 6 members - ``XYZLBH``. [#8592]\n\n- Added a new class ``SlicedLowLevelWCS`` in ``astropy.wcs.wcsapi`` that can be\n  used to slice any WCS that conforms to the ``BaseLowLevelWCS`` API. [#8546]\n\n- Updated implementation of ``WCS.__getitem__`` and ``WCS.slice`` to now return\n  a ``SlicedLowLevelWCS`` rather than raising an error when reducing the\n  dimensionality of the WCS. [#8546]\n\n\nAPI Changes\n-----------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- ``QuantityAttribute`` no longer has a default value for ``default``.  The\n  previous value of None was misleading as it always was an error. [#8450]\n\n- The default J2000 has been changed to use be January 1, 2000 12:00 TT instead\n  of UTC.  This is more in line with convention. [#8594]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- IPAC tables now output data types of ``float`` instead of ``double``, or\n  ``int`` instead of ``long``, based on the column ``dtype.itemsize``. [#8216]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Unit equivalencies can now be serialized to ASDF. [#8252]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Composition of model classes is deprecated and will be removed in 4.0.\n  Composition of model instances remain unaffected. [#8234, #8408]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- The ``BoxLeastSquares`` and ``LombScargle`` classes have been moved to the\n  ``astropy.timeseries.periodograms`` module and will now emit a deprecation\n  warning when imported from ``astropy.stats``. [#8591]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Converting an empty table to an array using ``as_array`` method now returns\n  an empty array instead of ``None``. [#8647]\n\n- Changed the behavior when slicing a table (either in rows or with a list of column\n  names) so now the sliced output gets a light (key-only) copy of ``meta`` instead of\n  a deepcopy.  Changed the ``Table.meta`` class-level descriptor so that assigning\n  directly to ``meta``, e.g. ``tbl.meta = new_meta`` no longer does a deepcopy\n  and instead just directly assigns the ``new_meta`` object reference. Changed\n  Table initialization so that input ``meta`` is copied only if ``copy=True``.\n  [#8404]\n\n- Added a keyword ``names`` in ``Table.as_array()``.  If provided this specifies\n  a list of column names to include for the returned structured array. [#8532]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- Removed ``pytest_plugins`` as they are completely broken for ``pytest>=4``.\n  [#7786]\n\n- Removed the ``astropy.tests.plugins.config`` plugin and removed the\n  ``--astropy-config-dir`` and ``--astropy-cache-dir`` options from\n  testing. Please use caching functionality that is natively in ``pytest``.\n  [#7787, #8489]\n\nastropy.time\n^^^^^^^^^^^^\n\n- The default time scale for epochs like 'J2000' or 'B1975' is now \"tt\",\n  which is the correct one for 'J2000' and avoids leap-second warnings\n  for epochs in the far future or past. [#8600]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Unit equivalencies can now be introspected. [#8252]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- The ``world_to_pixel``, ``world_to_array_index*``, ``pixel_to_world*`` and\n  ``array_index_to_world*`` methods now all consistently return scalars, arrays,\n  or objects not wrapped in a one-element tuple/list when only one scalar,\n  array, or object (as was previously already the case for ``WCS.pixel_to_world``\n  and ``WCS.array_index_to_world``). [#8663]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- It is now possible to control the number of cores used by ``ProgressBar.map``\n  by passing a positive integer as the ``multiprocess`` keyword argument. Use\n  ``True`` to use all cores. [#8083]\n\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- ``BarycentricTrueEcliptic``, ``HeliocentricTrueEcliptic`` and\n  ``GeocentricTrueEcliptic`` now use the correct transformation\n  (including nutation), whereas the new ``*MeanEcliptic`` classes\n  use the nutation-free transformation. [#8394]\n\n- Representations with ``float32`` coordinates can now be transformed,\n  although the output will always be ``float64``. [#8759]\n\n- Fixed bug that prevented using differentials with HCRS<->ICRS\n  transformations. [#8794]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fixed a bug where an exception was raised when writing a table which includes\n  mixin columns (e.g. a Quantity column) and the output format was specified\n  using the ``formats`` keyword. [#8681]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Fixed bug in ASDF tag that inadvertently introduced dependency on ``pytest``.\n  [#8456]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed slowness for certain compound models consisting of large numbers\n  of multi-input models [#8338, #8349]\n\n- Fixed bugs in fitting of compound models with units. [#8369]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Fixed bug in reading multi-extension FITS files written by earlier versions\n  of ``CCDData``. [#8534]\n\n- Fixed two errors in the way ``CCDData`` handles FITS files with WCS in the\n  header. Some of the WCS keywords that should have been removed from the\n  header were not, potentially leading to FITS files with inconsistent\n  WCS. [#8602]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fixed a bug when initializing from an empty list: ``Table([])`` no longer\n  results in a crash. [#8647]\n\n- Fixed a bug when initializing from an existing ``Table``.  In this case the\n  input ``meta`` argument was being ignored.  Now the input ``meta``, if\n  supplied, will be used as the ``meta`` for the new ``Table``. [#8404]\n\n- Fix the conversion of bytes values to Python ``str`` with ``Table.tolist``.\n  [#8739]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Fixed a number of issues to ensure a consistent output type resulting from\n  multiplication or division involving a ``TimeDelta`` instance. The output is\n  now always a ``TimeDelta`` if the result is a time unit (like u.s or u.d),\n  otherwise it will be a ``Quantity``. [#8356]\n\n- Multiplication between two ``TimeDelta`` instances is now possible, resulting\n  in a ``Quantity`` with units of time squared (division already correctly\n  resulted in a dimensionless ``Quantity``). [#8356]\n\n- Like for comparisons, addition, and subtraction of ``Time`` instances with\n  with non-time instances, multiplication and division of ``TimeDelta``\n  instances with incompatible other instances no longer immediately raise an\n  ``UnitsError`` or ``TypeError`` (depending on the other instance), but\n  rather go through the regular Python mechanism of ``TimeDelta`` returning\n  ``NotImplemented`` (which will lead to a regular ``TypeError`` unless the\n  other instance can handle ``TimeDelta``). [#8356]\n\n- Corrected small rounding errors that could cause the ``jd2`` values in\n  ``Time`` to fall outside the range of -0.5 to 0.5. [#8763]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Added a ``Quantity.to_string`` method to add flexibility to the string formatting\n  of quantities. It produces unadorned or LaTeX strings, and accepts two different\n  sets of delimiters in the latter case: ``inline`` and ``display``. [#8313]\n\n- Ensure classes that mimic quantities by having a ``unit`` attribute and/or\n  ``to`` and ``to_value`` methods can be properly used to initialize ``Quantity``\n  or set ``Quantity`` instance items. [#8535]\n\n- Add support for ``<<`` to create logarithmic units. [#8290]\n\n- Add support for the ``clip`` ufunc, which in numpy 1.17 is used to implement\n  ``np.clip``.  As part of that, remove the ``Quantity.clip`` method under\n  numpy 1.17. [#8747]\n\n- Fix parsing of numerical powers in FITS-compatible units. [#8251]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Added a ``PyUnitListProxy_richcmp`` method in ``UnitListProxy`` class to enable\n  ``WCS.wcs.cunit`` equality testing. It helps to check whether the two instances of\n  ``WCS.wcs.cunit`` are equal or not by comparing the data members of\n  ``UnitListProxy`` class [#8480]\n\n- Fixed ``SlicedLowLevelWCS`` when ``array_shape`` is ``None``. [#8649]\n\n- Do not attempt to delete repeated distortion keywords multiple times when\n  loading distortions with ``_read_distortion_kw`` and\n  ``_read_det2im_kw``. [#8777]\n\n\nOther Changes and Additions\n---------------------------\n\n- Update bundled expat to 2.2.6. [#8343]\n\n- Added instructions for uploading releases to Zenodo. [#8395]\n\n- The bug fixes to the behaviour of ``TimeDelta`` for multiplcation and\n  division, which ensure that the output is now always a ``TimeDelta`` if the\n  result is a time unit (like u.s or u.d) and otherwise a ``Quantity``, imply\n  that sometimes the output type will be different than it was before. [#8356]\n\n- For types unrecognized by ``TimeDelta``, multiplication and division now\n  will consistently return a ``TypeError`` if the other instance cannot handle\n  ``TimeDelta`` (rather than ``UnitsError`` or ``TypeError`` depending on\n  presumed abilities of the other instance). [#8356]\n\n- Multiplication between two ``TimeDelta`` instances will no longer result in\n  an ``OperandTypeError``, but rather result in a ``Quantity`` with units of\n  time squared (division already correctly resulted in a dimensionless\n  ``Quantity``). [#8356]\n\n- Made running the tests insensitive to local user configuration when running\n  the tests in parallel mode or directly with pytest. [#8727]\n\n- Added a narrative style guide to the documentation for contributor reference.\n  [#8588]\n\n- Ensure we call numpy equality functions in a way that reduces the number\n  of ``DeprecationWarning``. [#8755]\n\nInstallation\n^^^^^^^^^^^^\n\n- We now require setuptools 30.3.0 or later to install the core astropy\n  package. [#8240]\n\n- We now define groups of dependencies that can be installed with pip, e.g.\n  ``pip install astropy[all]`` (to install all optional dependencies). [#8198]\n\n\n\n3.1.2 (2019-02-23)\n==================\n\nBug fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Convert the default of ``QuantityAttribute``, thereby catching the error case\n  case of it being set to None at attribute creation, and giving a more useful\n  error message in the process. [#8300]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Fix elliptic analytical solution for comoving distance. Only\n  relevant for non-flat cosmologies without radiation and ``Om0`` > ``Ode0``.\n  [#8391]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed slowness for certain compound models consisting of large numbers\n  of multi-input models [#8338, #8349]\n\nastropy.visualization.wcsaxes\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n- Fix a bug that caused an error when passing an array with all values the same\n  to contour or contourf. [#8321]\n\n- Fix a bug that caused contour and contourf to return None instead of the\n  contour set. [#8321]\n\n\n3.1.1 (2018-12-31)\n==================\n\nBug fixes\n---------\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fix error when writing out empty table. [#8279]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- ``fitsdiff --ignore-hdus`` now prints input filenames in the diff report\n  instead of ``<HDUList object at 0x1150f9778>``. [#8295]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Ensure correctness of units when raising to a negative power. [#8263]\n\n- Fix ``with_H0`` equivalency to use the correct direction of\n  conversion. [#8292]\n\n\n\n3.1 (2018-12-06)\n================\n\nNew Features\n------------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- ``convolve`` now accepts any array-like input, not just ``numpy.ndarray`` or\n  lists. [#7303]\n\n- ``convolve`` Now raises AstropyUserWarning if nan_treatment='interpolate' and\n  preserve_nan=False and NaN values are present post convolution. [#8088]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- The ``SkyCoord.from_name`` constructor now has the ability to create\n  coordinate objects by parsing object catalogue names that have embedded\n  J-coordinates. [#7830]\n\n- The new function ``make_transform_graph_docs`` can be used to create a\n  docstring graph from a custom ``TransformGraph`` object. [#7135]\n\n- ``KDTree`` for catalog matching is now built with sliding midpoint rule\n  rather than standard.  In code, this means setting ``compact_nodes=False``\n  and ``balanced_tree=False`` in ``cKDTree``. The sliding midpoint rule is much\n  more suitable for catalog matching, and results in 1000x speedup in some\n  cases. [#7324]\n\n- Additional information about a site loaded from the Astropy sites registry is\n  now available in ``EarthLocation.info.meta``. [#7857]\n\n- Added a ``concatenate_representations`` function to combine coordinate\n  representation data and any associated differentials. [#7922]\n\n- ``BaseCoordinateFrame`` will now check for a method named\n  ``_astropy_repr_in_frame`` when constructing the string forms of attributes.\n  Allowing any class to control how ``BaseCoordinateFrame`` represents it when\n  it is an attribute of a frame. [#7745]\n\n- Some rarely-changed attributes of frame classes are now cached, resulting in\n  speedups (up to 50% in some cases) when creating new scalar frame or\n  ``SkyCoord`` objects. [#7949, #5952]\n\n- Added a ``directional_offset_by`` method to ``SkyCoord`` that computes a new\n  coordinate given a coordinate, position angle, and angular separation [#5727]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- The default cosmology has been changed from ``WMAP9`` to ``Planck15``. [#8123]\n\n- Distance calculations with ``LambaCDM`` with no radiation (T_CMB0=0)\n  are now 20x faster by using elliptic integrals for non-flat cases. [#7155]\n\n- Distance calculations with ``FlatLambaCDM`` with no radiation (T_CMB0=0)\n  are now 20x faster by using the hypergeometric function solution\n  for this special case. [#7087]\n\n- Age calculations with ``FlatLambdaCDM`` with no radiation (Tcmb0=0)\n  are now 1000x faster by using analytic solutions instead of integrating.\n  [#7117]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Latex reader now ignores ``\\toprule``, ``\\midrule``, and ``\\bottomrule``\n  commands. [#7349]\n\n- Added the RST (Restructured-text) table format and the fast version of the\n  RDB reader to the set of formats that are guessed by default. [#5578]\n\n- The read trace (used primarily for debugging) now includes guess argument\n  sets that were skipped entirely e.g. for not supporting user-supplied kwargs.\n  All guesses thus removed from ``filtered_guess_kwargs`` are now listed as\n  \"Disabled\" at the beginning of the trace. [#5578]\n\n- Emit a warning when reading an ECSV file without specifying the ``format``\n  and without PyYAML installed.  Previously this silently fell through to\n  parsing as a basic format file and the file metadata was lost. [#7580]\n\n- Optionally allow writing masked columns to ECSV with the mask explicitly\n  specified as a separate column instead of marking masked elements with \"\"\n  (empty string).  This allows handling the case of a masked string column\n  with \"\" data rows.  [#7481]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Added support for saving all representation classes and many coordinate\n  frames to the asdf format. [#7079]\n\n- Added support for saving models with units to the asdf format. [#7237]\n\n- Added a new ``character_as_bytes`` keyword to the HDF5 Table reading\n  function to control whether byte string columns in the HDF5 file\n  are left as bytes or converted to unicode.  The default is to read\n  as bytes (``character_as_bytes=True``). [#7024, #8017]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- ``HDUList.pop()`` now accepts string and tuple extension name\n  specifications. [#7236]\n\n- Add an ``ignore_hdus`` keyword to ``FITSDiff`` to allow ignoring HDUs by\n  NAME when diffing two FITS files [#7538]\n\n- Optionally allow writing masked columns to FITS with the mask explicitly\n  specified as a separate column instead of using the FITS standard of\n  certain embedded null values (``NaN`` for float, ``TNULL`` for integers).\n  This can be used to work around limitations in the FITS standard. [#7481]\n\n- All time coordinates can now be written to and read from FITS binary tables,\n  including those with vectorized locations. [#7430]\n\n- The ``fitsheader`` command line tool now supports a ``dfits+fitsort`` mode,\n  and the dotted notation for keywords (e.g. ``ESO.INS.ID``). [#7240]\n\n- Fall back to reading arrays using mode='denywrite' if mode='readonly' fails\n  when using memory-mapping. This solves cases on some platforms when the\n  available address space was less than the file size (even when using memory\n  mapping). [#7926]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Add a ``Multiply`` model which preserves unit through evaluate, unlike\n  ``Scale`` which is dimensionless. [#7210]\n\n- Add a ``uses_quantity`` property to ``Model`` which allows introspection of if\n  the ``Model`` can accept ``Quantity`` objects. [#7417]\n\n- Add a ``separability_matrix`` function which returns the correlation matrix\n  of inputs and outputs. [#7803]\n\n- Fixed compatibility of ``JointFitter`` with the latest version of Numpy. [#7984]\n\n- Add ``prior`` and ``posterior`` constraints to modeling parameters. These are\n  not used by any current fitters, but are provided to allow user code to\n  experiment with Bayesian fitters.  [#7558]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- ``NDUncertainty`` objects now have a ``quantity`` attribute for simple\n  conversion to quantities. [#7704]\n\n- Add a ``bitmask`` module that provides functions for manipulating bitmasks\n  and data quality (DQ) arrays. [#7944]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Add an ``astropy.stats.bls`` module with an implementation of the \"box least\n  squares\" periodogram that is commonly used for discovering transiting\n  exoplanets and eclipsing binaries. [#7391]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Added support for full use of ``Time`` mixin column for join, hstack, and\n  vstack table operations. [#6888]\n\n- Added a new table index engine, ``SCEngine``, based on the Sorted Containers\n  package. [#7574]\n\n- Add a new keyword argument ``serialize_method`` to ``Table.write`` to\n  control how ``Time`` and ``MaskedColumn`` columns are written. [#7481]\n\n- Allow mixin columns to be used in table ``group`` and ``unique``\n  functions. This applies to both the key columns and the other data\n  columns. [#7712]\n\n- Added support for stacking ``Column``, mixin column (e.g. ``Quantity``,\n  ``Time``) or column-like objects. [#7674]\n\n- Added support for inserting a row into a Table that has ``Time`` or\n  ``TimeDelta`` column(s). [#7897]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- Added an option ``--readonly`` to the test command to change the\n  permissions on the temporary installation location to read-only. [#7598]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Allow array-valued ``Time`` object to be modified in place. [#6028]\n\n- Added support for missing values (masking) to the ``Time`` class. [#6028]\n\n- Added supper for a 'local' time scale (for free-running clocks, etc.),\n  and round-tripping to the corresponding FITS time scale. [#7122]\n\n- Added `datetime.timedelta` format class for ``TimeDelta``. [#7441]\n\n- Added ``strftime`` and ``strptime`` methods to ``Time`` class.\n  These methods are similar to those in the Python standard library\n  `time` package and provide flexible input and output formatting. [#7323]\n\n- Added ``datetime64`` format to the ``Time`` class to support working with\n  ``numpy.datetime64`` dtype arrays. [#7361]\n\n- Add fractional second support for ``strftime`` and ``strptime`` methods\n  of ``Time`` class. [#7705]\n\n- Added an ``insert`` method to allow inserting one or more values into a\n  ``Time`` or ``TimeDelta`` object. [#7897]\n\n- Remove timescale from string version of FITS format time string.\n  The timescale is not part of the FITS standard and should not be included.\n  This change may cause some compatibility issues for code that relies on\n  round-tripping a FITS format string with a timescale. Strings generated\n  from previous versions of this package are still understood but a\n  DeprecationWarning will be issued. [#7870]\n\nastropy.uncertainty\n^^^^^^^^^^^^^^^^^^^\n\n- This sub-package was added as a \"preview\" (i.e. API unstable), containing\n  the ``Distribution`` class and associated convenience functions. [#6945]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Add complex numbers support for ``Quantity._repr_latex_``. [#7676]\n\n- Add ``thermodynamic_temperature`` equivalency to convert between\n  Jy/sr and \"thermodynamic temperature\" for cosmology. [#7054]\n\n- Add millibar unit. [#7863]\n\n- Add maggy and nanomaggy unit, as well as associated ``zero_point_flux``\n  equivalency. [#7891]\n\n- ``AB`` and ``ST`` are now enabled by default, and have alternate names\n  ``ABflux`` and ``STflux``. [#7891]\n\n- Added ``littleh`` unit and associated ``with_H0`` equivalency. [#7970]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Added ``imshow_norm`` function, which combines imshow and creation of a\n  ``ImageNormalize`` object. [#7785]\n\nastropy.visualization.wcsaxes\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n- Add support for setting ``set_separator(None)`` in WCSAxes to use default\n  separators. [#7570]\n\n- Added two keyword argument options to ``CoordinateHelper.set_format_unit``:\n  ``decimal`` can be used to specify whether to use decimal formatting for the\n  labels (by default this is False for degrees and hours and True otherwise),\n  and ``show_decimal_unit`` can be used to determine whether the units should be\n  shown for decimal labels. [#7318]\n\n- Added documentation for ``transform=`` and ``coord_meta=``. [#7698]\n\n- Allow ``coord_meta=`` to optionally include ``format_unit=``. [#7848]\n\n- Add support for more rcParams related to the grid, ticks, and labels, and\n  should work with most built-in Matplotlib styles. [#7961]\n\n- Improved rendering of outward-facing ticks. [#7961]\n\n- Add support for ``tick_params`` (which is a standard Matplotlib\n  function/method) on both the ``WCSAxes`` class and the individual\n  ``CoordinateHelper`` classes. Note that this is provided for compatibility\n  with Matplotlib syntax users may be familiar with, but it is not the\n  preferred way to change settings. Instead, methods such as ``set_ticks``\n  should be preferred. [#7969]\n\n- Moved the argument ``exclude_overlapping`` from ``set_ticks`` to\n  ``set_ticklabel``. [#7969]\n\n- Added a ``pad=`` argument to ``set_ticklabel`` to provide a way to control\n  the padding between ticks and tick labels. [#7969]\n\n- Added support for setting the tick direction in ``set_ticks`` using the\n  ``direction=`` keyword argument. [#7969]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Map ITRS frames to terrestrial WCS coordinates. This will make it possible to\n  use WCSAxes to make figures that combine both celestial and terrestrial\n  features. An example is plotting the coordinates of an astronomical transient\n  over an all- sky satellite image to illustrate the position relative to the\n  Earth at the time of the event. The ITRS frame is identified with WCSs that\n  use the ``TLON-`` and ``TLAT-`` coordinate types. There are several examples\n  of WCSs where this syntax is used to describe terrestrial coordinate systems:\n  Section 7.4.1 of `WCS in FITS \"Paper II\" <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1077C>`_\n  and the `WCSTools documentation <http://tdc-www.harvard.edu/software/wcstools/wcstools.multiwcs.html>`_.\n  [#6990]\n\n- Added the abstract base class for the low-level WCS API described in APE 14\n  (https://doi.org/10.5281/zenodo.1188875). [#7325]\n\n- Add ``WCS.footprint_contains()`` function to check if the WCS footprint contains a given sky coordinate. [#7273]\n\n- Added the abstract base class for the high-level WCS API described in APE 14\n  (https://doi.org/10.5281/zenodo.1188875). [#7325]\n\n- Added the high-level wrapper class for low-level WCS objects as described in\n  APE 14 (https://doi.org/10.5281/zenodo.1188875). [#7326]\n\n- Added a new property ``WCS.has_distortion``. [#7326]\n\n- Deprecated ``_naxis1`` and ``_naxis2`` in favor of ``pixel_shape``. [#7973]\n\n- Added compatibility to wcslib version 6. [#8093]\n\n\nAPI Changes\n-----------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- ``kernel`` can now be a tuple. [#7561]\n\n- Not technically an API changes, however, the doc string indicated that ``boundary=None``\n  was the default when actually it is ``boundary='fill'``. The doc string has been corrected,\n  however, someone may interpret this as an API change not realising that nothing has actually\n  changed. [#7293]\n\n- ``interpolate_replace_nans()`` can no longer accept the keyword argument\n  ``preserve_nan``. It is explicitly set to ``False``. [#8088]\n\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed ``astropy.coordinates.concatenate`` to include velocity data in the\n  concatenation. [#7922]\n\n- Changed the name of the single argument to ``Frame.realize_frame()`` from the\n  (incorrect) ``representation_type`` to ``data``. [#7923]\n\n- Negative parallaxes passed to ``Distance()`` now raise an error by default\n  (``allow_negative=False``), or are converted to NaN values with a warning\n  (``allow_negative=True``). [#7988]\n\n- Negating a ``SphericalRepresentation`` object now changes the angular\n  coordinates (by rotating 180º) instead of negating the distance. [#7988]\n\n- Creation of new frames now generally creates copies of frame attributes,\n  rather than inconsistently either copying or making references. [#8204]\n\n- The frame class method ``is_equivalent_frame`` now checks for equality of\n  components to determine if a frame is the same when it has frame attributes\n  that are representations, rather than checking if they are the same\n  object. [#8218]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- If a fast reader is explicitly selected (e.g. ``fast_reader='force'``) and\n  options which are incompatible with the fast reader are provided\n  (e.g. ``quotechar='##'``) then now a ``ParameterError`` exception will be\n  raised. [#5578]\n\n- The fast readers will now raise ``InconsistentTableError`` instead of\n  ``CParserError`` if the number of data and header columns do not match.\n  [#5578]\n\n- Changed a number of ``ValueError`` exceptions to ``InconsistentTableError``\n  in places where the exception is related to parsing a table which is\n  inconsistent with the specified table format.  Note that\n  ``InconsistentTableError`` inherits from ``ValueError`` so no user code\n  changes are required. [#7425]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- The ``fits.table_to_hdu()`` function will translate any column ``format``\n  attributes to a TDISPn format string, if possible, and store it as a TDISPn\n  keyword in the ``HDU`` header. [#7226]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Change the order of the return values from ``FittingWithOutlierRemoval``,\n  such that ``fitted_model`` comes first, for consistency with other fitters.\n  For the second value, return only a boolean outlier ``mask``, instead of the\n  previous ``MaskedArray`` (which included a copy of the input data that was\n  both redundant and inadvertently corrupted at masked points). Return a\n  consistent type for the second value when ``niter=0``. [#7407]\n\n- Set the minimum value for the ``bolometric_flux`` parameter of the\n  ``BlackBody1D`` model to zero. [#7045]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Add two new uncertainty classes, ``astropy.nddata.VarianceUncertainty`` and\n  ``astropy.nddata.InverseVariance``. [#6971]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- String values can now be used for the ``cenfunc`` and ``stdfunc``\n  keywords in the ``SigmaClip`` class and ``sigma_clip`` and\n  ``sigma_clipped_stats`` functions. [#7478]\n\n- The ``SigmaClip`` class and ``sigma_clip`` and\n  ``sigma_clipped_stats`` functions now have a ``masked`` keyword,\n  which can be used to return either a masked array (default) or an\n  ndarray with the min/max values. [#7478]\n\n- The ``iters`` keyword has been renamed (and deprecated) to\n  ``maxiters`` in the ``SigmaClip`` class and ``sigma_clip`` and\n  ``sigma_clipped_stats`` functions. [#7478]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- ``Table.read()`` on a FITS binary table file will convert any TDISPn header\n  keywords to a Python formatting string when possible, and store it in the\n  column ``format`` attribute. [#7226]\n\n- No values provided to stack will now raise ``ValueError`` rather than\n  ``TypeError``. [#7674]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- ``from astropy.tests.helper import *`` no longer includes\n  ``quantity_allclose``. However,\n  ``from astropy.tests.helper import quantity_allclose`` would still work.\n  [#7381]\n\n- ``warnings_to_ignore_by_pyver`` option in\n  ``enable_deprecations_as_exceptions()`` now takes ``None`` as key.\n  Any deprecation message that is mapped to ``None`` will be ignored\n  regardless of the Python version. [#7790]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Added the ability to use ``local`` as time scale in ``Time`` and\n  ``TimeDelta``. [#6487]\n\n- Comparisons, addition, and subtraction of ``Time`` instances with non-time\n  instances will now return ``NotImplemented`` rather than raise the\n  ``Time``-specific ``OperandTypeError``.  This will generally lead to a\n  regular ``TypeError``.  As a result, ``OperandTypeError`` now only occurs if\n  the operation is between ``Time`` instances of incompatible type or scale.\n  [#7584]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- In ``UnitBase.compose()``, if a sequence (list|tuple) is passed in to\n  ``units``, the default for ``include_prefix_units`` is set to\n  `True`, so that no units get ignored. [#6957]\n\n- Negative parallaxes are now converted to NaN values when using the\n  ``parallax`` equivalency. [#7988]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- ``InheritDocstrings`` now also works on class properties. [#7166]\n\n- ``diff_values()``, ``report_diff_values()``, and ``where_not_allclose()``\n  utility functions are moved from ``astropy.io.fits.diff``. [#7444]\n\n- ``invalidate_caches()`` has been removed from the\n  ``astropy.utils.compat`` namespace, use it directly from ``importlib``. [#7872]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- In ``ImageNormalize``, the default for ``clip`` is set to ``True``. [#7800]\n\n- Changed ``AsymmetricPercentileInterval`` and ``MinMaxInterval`` to\n  ignore NaN values in arrays. [#7360]\n\n- Automatically default to using ``grid_type='contours'`` in WCSAxes when using\n  a custom ``Transform`` object if the transform has no inverse. [#7847]\n\n\nPerformance Improvements\n------------------------\n\n- Reduced import time by more cautious use of the standard library. [#7647]\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Major performance overhaul to ``convolve()``. [#7293]\n\n- ``convolve()``: Boundaries ``fill``, ``extend``, and ``wrap`` now use a single\n  implementation that pads the image with the correct boundary values before convolving.\n  The runtimes of these three were significantly skewed. They now have\n  equivalent runtimes that are also faster than before due to performant contiguous\n  memory access. However, this does increase the memory footprint as an entire\n  new image array is required plus that needed for the padded region.[#7293]\n\n- ``convolve()``: Core computation ported from Cython to C. Several optimization\n  techniques have been implemented to achieve performance gains, e.g. compiler\n  hoisting, and vectorization, etc. Compiler optimization level ``-O2`` required for\n  hoisting and ``-O3`` for vectorization. [#7293]\n\n- ``convolve()``: ``nan_treatment=‘interpolate’`` was slow to compute irrespective of\n  whether any NaN values exist within the array. The input array is now\n  checked for NaN values and interpolation is disabled if non are found. This is a\n  significant performance boost for arrays without NaN values. [#7293]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Sped up creating SkyCoord objects by a factor of ~2 in some cases. [#7615]\n\n- Sped up getting xyz vectors from ``CartesianRepresentation`` (which\n  is used a lot internally). [#7638]\n\n- Sped up transformations and some representation methods by replacing\n  python code with (compiled) ``erfa`` ufuncs. [#7639]\n\n- Sped up adding differential (velocity) data to representations by a factor of\n  ~20, which improves the speed of frame and SkyCoord initialization. [#7924]\n\n- Refactored ``SkyCoord`` initializer to improve performance and code clarity.\n  [#7958]\n\n- Sped up initialization of ``Longitude`` by ~40%. [#7616]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- The ``SigmaClip`` class and ``sigma_clip`` and\n  ``sigma_clipped_stats`` functions are now significantly faster. [#7478]\n\n- A Cython implementation for `astropy.stats.kuiper_two` and a vectorized\n  implementation for `astropy.stats.kuiper_false_positive_probability` have\n  been added, speeding up both functions.  [#8104]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Sped up creating new composite units, and raising units to some power\n  [#7549, #7649]\n\n- Sped up Unit.to when target unit is the same as the original unit. [#7643]\n\n- Lazy-load ``scipy.special`` to shorten ``astropy.units`` import time. [#7636]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Significantly sped up drawing of contours in WCSAxes. [#7568]\n\n\nBug Fixes\n---------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed bug in ``convolve_fft`` where masked input was copied with\n  ``numpy.asarray`` instead of ``numpy.asanyarray``.\n  ``numpy.asarray`` removes the mask subclass causing\n  ``numpy.ma.ismasked(input)`` to fail, causing ``convolve_fft``\n  to ignore all masked input. [#8137]\n\n- Remove function side-effects of input data from ``convolve_fft``.\n  It was possible for input data to remain modified if particular exceptions\n  were raised. [#8152]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- ``EarthLocation.of_address`` now uses the OpenStreetMap geocoding API by\n  default to retrieve coordinates, with the Google API (which now requires an\n  API key) as an option. [#7918]\n\n- Fixed a bug that caused frame objects with NaN distances to have NaN sky\n  positions, even if valid sky coordinates were specified. [#7988]\n\n- Fixed ``represent_as()`` to not round-trip through cartesian if the same\n  representation class as the instance is passed in. [#7988]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fixed a problem when ``guess=True`` that ``fast_reader`` options\n  could be dropped after the first fast reader class was tried. [#5578]\n\n- Units in CDS-formatted tables are now parsed correctly by the units\n  module. [#7348]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Fixed bug when writing a table with masked columns to HDF5. Previously\n  the mask was being silently dropped.  If the ``serialize_meta`` option is\n  enabled the data mask will now be written as an additional column and the\n  masked columns will round-trip correctly. [#7481]\n\n- Fixed a bug where writing to HDF5 failed for for tables with columns of\n  unicode strings.  Now those columns are first encoded to UTF-8 and\n  written as byte strings. [#7024, #8017]\n\n- Fixed a bug with serializing the bounding_box of models initialized\n  with ``Quantities`` . [#8052]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Added support for ``copy.copy`` and ``copy.deepcopy`` for ``HDUList``. [#7218]\n\n- Override ``HDUList.copy()`` to return a shallow HDUList instance. [#7218]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fix behaviour of certain models with units, by making certain unit-related\n  attributes readonly. [#7210]\n\n- Fixed an issue with validating a ``bounding_box`` whose items are\n  ``Quantities``. [#8052]\n\n- Fix ``Moffat1D`` and ``Moffat2D`` derivatives. [#8108]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Fixed rounding behavior in ``overlap_slices`` for even-sized small\n  arrays. [#7859]\n\n- Added support for pickling ``NDData`` instances that have an uncertainty.\n  [#7383]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Fix errors in ``kuiper_false_positive_probability``. [#7975]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- Fixing bug that prevented to run the doctests on only a single rst documentation\n  file rather than all of them. [#8055]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Fix a bug when setting a ``TimeDelta`` array item with plain float value(s).\n  This was always interpreted as a JD (day) value regardless of the\n  ``TimeDelta`` format. [#7990]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- To simplify fast creation of ``Quantity`` instances from arrays, one can now\n  write ``array << unit`` (equivalent to ``Quantity(array, unit, copy=False)``).\n  If ``array`` is already a ``Quantity``, this will convert the quantity to the\n  requested units; in-place conversion can be done with ``quantity <<= unit``.\n  [#7734]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Fixed a bug due to which ``report_diff_values()`` was reporting incorrect\n  number of differences when comparing two ``numpy.ndarray``. [#7470]\n\n- The download progress bar is now only displayed in terminals, to avoid\n  polluting piped output. [#7577]\n\n- Ignore URL mirror caching when there is no internet. [#8163]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Right ascension coordinates are now shown in hours by default, and the\n  ``set_format_unit`` method on ``CoordinateHelper`` now works correctly\n  with angle coordinates. [#7215]\n\n\nOther Changes and Additions\n---------------------------\n\n- The documentation build now uses the Sphinx configuration from sphinx-astropy\n  rather than from astropy-helpers. [#7139]\n\n- Versions of Numpy <1.13 are no longer supported. [#7058]\n\n- Running tests now suppresses the output of the installation stage by default,\n  to allow easier viewing of the test results. To re-enable the output as\n  before, use ``python setup.py test --verbose-install``. [#7512]\n\n- The ERFA functions are now wrapped in ufuncs instead of custom C code,\n  leading to some speed improvements, and setting the stage for allowing\n  overrides with ``__array_ufunc__``. [#7502]\n\n- Updated the bundled CFITSIO library to 3.450. See\n  ``cextern/cfitsio/docs/changes.txt`` for additional information. [#8014]\n\n- The ``representation`` keywords in coordinate frames are now deprecated in\n  favor of the ``representation_type`` keywords (which are less\n  ambiguously named). [#8119]\n\n\n\n3.0.5 (2018-10-14)\n==================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed bug in which consecutive ``StaticMatrixTransform``'s in a frame\n  transform path would be combined in the incorrect order. [#7707]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- Fixing bug that doctests were not picked up from the narrative\n  documentation when tests were run for all modules. [#7767]\n\n\n\n3.0.4 (2018-08-02)\n==================\n\nAPI Changes\n-----------\n\nastropy.table\n^^^^^^^^^^^^^\n\n- The private ``_parent`` attribute in the ``info`` attribute of table\n  columns was changed from a direct reference to the parent column to a weak\n  reference.  This was in response to a memory leak caused by having a\n  circular reference cycle.  This change means that expressions like\n  ``col[3:5].info`` will now fail because at the point of the ``info``\n  property being evaluated the ``col[3:5]`` weak reference is dead.  Instead\n  force a reference with ``c = col[3:5]`` followed by\n  ``c.info.indices``. [#6277, #7448]\n\n\nBug Fixes\n---------\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Fixed an bug when creating the ``WCS`` of a cutout (see ``nddata.Cutout2D``)\n  when input image's ``WCS`` contains ``SIP`` distortion corrections by\n  adjusting the ``crpix`` of the ``astropy.wcs.Sip`` (in addition to\n  adjusting the ``crpix`` of the ``astropy.wcs.WCS`` object). This bug\n  had the potential to produce large errors in ``WCS`` coordinate\n  transformations depending on the position of the cutout relative\n  to the input image's ``crpix``. [#7556, #7550]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix memory leak where updating a table column or deleting a table\n  object was not releasing the memory due to a reference cycle\n  in the column ``info`` attributes. [#6277, #7448]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Fixed an bug when creating the ``WCS`` slice (see ``WCS.slice()``)\n  when ``WCS`` contains ``SIP`` distortion corrections by\n  adjusting the ``WCS.sip.crpix`` in addition to adjusting\n  ``WCS.wcs.crpix``. This bug had the potential to produce large errors in\n  ``WCS`` coordinate transformations depending on the position of the slice\n  relative to ``WCS.wcs.crpix``. [#7556, #7550]\n\n\nOther Changes and Additions\n---------------------------\n\n- Updated bundled wcslib to v 5.19.1 [#7688]\n\n\n3.0.3 (2018-06-01)\n==================\n\nBug Fixes\n---------\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fix stripping correct (header) comment line from ``meta['comments']``\n  in the ``CommentedHeader`` reader for all ``header_start`` settings. [#7508]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Raise error when attempting to open gzipped FITS file in 'append' mode.\n  [#7473]\n\n- Fix a bug when writing to FITS a table that has a column description\n  with embedded blank lines. [#7482]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- Enabling running tests for multiple packages when specified comma\n  separated. [#7463]\n\n\n3.0.2 (2018-04-23)\n==================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Computing a 3D separation between two ``SkyCoord`` objects (with the\n  ``separation_3d`` method) now works with or without velocity data attached to\n  the objects. [#7387]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Fix validate with xmllint=True. [#7255, #7283]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- ``FittingWithOutlierRemoval`` now handles model sets, as long as the\n  underlying fitter supports masked values. [#7199]\n\n- Remove assumption that ``model_set_axis == 0`` for 2D models in\n  ``LinearLSQFitter``. [#7317, #7199]\n\n- Fix the shape of the outputs when a model set is evaluated with\n  ``model_set_axis=False`` . [#7317]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Accept a tuple for the ``axis`` parameter in ``sigma_clip``, like the\n  underlying ``numpy`` functions and some other functions in ``stats``. [#7199]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- The function ``quantity_allclose`` was moved to the ``units`` package with\n  the new, shorter name ``allclose``. This eliminates a runtime dependency on\n  ``pytest`` which was causing issues for some affiliated packages. The old\n  import will continue to work but may be deprecated in the future. [#7252]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Added a units-aware ``allclose`` function (this was previously available in\n  the ``tests`` module as ``quantity_allclose``). To complement ``allclose``,\n  a new ``isclose`` function is also added and backported. [#7252]\n\n\n3.0.1 (2018-03-12)\n==================\n\nBug Fixes\n---------\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fix a unicode decode error when reading a table with non-ASCII characters.\n  The fast C reader cannot handle unicode so the code now uses the pure-Python\n  reader in this case. [#7103]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Updated the bundled CFITSIO library to 3.430. This is to remedy a critical\n  security vulnerability that was identified by NASA. See\n  ``cextern/cfitsio/docs/changes.txt`` for additional information. [#7274]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Make sure that a sufficiently recent version of ASDF is installed when\n  running test suite against ASDF tags and schemas. [#7205]\n\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\n- Fix reading files with serialized metadata when using a Table subclass. [#7213]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Fix lookup fields by ID. [#7208]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fix model set evaluation over common input when model_set_axis > 0. [#7222]\n\n- Fixed the evaluation of compound models with units. This required adding the\n  ability to have ``input_units_strict`` and ``input_units_allow_dimensionless``\n  be dictionaries with input names as keys. [#6952]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- ``quantity_helper`` no longer requires ``scipy>=0.18``. [#7219]\n\n\n3.0 (2018-02-12)\n================\n\nNew Features\n------------\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\n- New context manager ``set_enabled_constants`` to temporarily use an older\n  version. [#7008]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- The ``Distance`` object now accepts ``parallax`` as a keyword in the\n  initializer, and supports retrieving a parallax (as an ``Angle``) via\n  the ``.parallax`` attributes. [#6855]\n\n- The coordinate frame classes (subclasses of ``BaseCoordinateFrame``) now\n  always have ``.velocity``, ``.proper_motion``, and ``.radial_velocity``\n  properties that provide shorthands to the full-space Cartesian velocity as\n  a ``CartesianDifferential``, the 2D proper motion as a ``Quantity``, and the\n  radial or line-of-sight velocity as a ``Quantity``. [#6869]\n\n- ``SkyCoord`` objects now support storing and transforming differentials - i.e.,\n  both radial velocities and proper motions. [#6944]\n\n- All frame classes now automatically get sensible representation mappings for\n  velocity components. For example, ``d_x``, ``d_y``, ``d_z`` are all\n  automatically mapped to frame component namse ``v_x``, ``v_y``, ``v_z``.\n  [#6856]\n\n- ``SkyCoord`` objects now support updating the position of a source given its\n  space motion and a new time or time difference. [#6872]\n\n- The frame classes now accept a representation class or differential class, or\n  string names for either, through the keyword arguments ``representation_type``\n  and ``differential_type`` instead of ``representation`` and\n  ``differential_cls``. [#6873]\n\n- The frame classes (and ``SkyCoord``) now give more useful error messages when\n  incorrect attribute names are given.  Instead of using the representation\n  attribute names, they use the frame attribute names. [#7106]\n\n- ``EarthLocation`` now has a method to compute the  gravitational redshift due\n  due to solar system bodies.  [#6861, #6935]\n\n- ``EarthLocation`` now has a ``get_gcrs`` convenience method to get the\n  location in GCRS coordinates.  [#6861, #6935]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Expanded the FITS ``Column`` interface to accept attributes pertaining to the FITS\n  World Coordinate System, which includes spatial(celestial) and time coordinates. [#6359]\n\n- Added ``ver`` attribute to set the ``EXTVER`` header keyword to ``ImageHDU``\n  and ``TableHDU``. [#6454]\n\n- The performance for reading FITS tables has been significantly improved,\n  in particular for cases where the tables contain one or more string columns\n  and when done through ``Table.read``. [#6821]\n\n- The performance for writing tables from ``Table.write`` has now been\n  significantly improved for tables containing one or more string columns. [#6920]\n\n- The ``Table.read`` now supports a ``memmap=`` keyword argument to control\n  whether or not to use  memory mapping when reading the table. [#6821]\n\n- When reading FITS tables with ``fits.open``, a new keyword argument\n  ``character_as_bytes`` can be passed - when set to `True`, character columns\n  are returned as Numpy byte arrays (Numpy type S) while when set to `False`,\n  the same columns are decoded to Unicode strings (Numpy type U) which uses more\n  memory. [#6821]\n\n- The ``table_to_hdu`` function and the ``BinTableHDU.from_columns`` and\n  ``FITS_rec.from_columns`` methods now include a ``character_as_bytes``\n  keyword argument - if set to `True`, then when string columns are accessed,\n  byte columns will be returned, which can provide significantly improved\n  performance. [#6920]\n\n- Added support for writing and reading back a table which has \"mixin columns\"\n  such as ``SkyCoord`` or ``EarthLocation`` with no loss of information. [#6912]\n\n- Enable tab-completion for ``FITS_rec`` column names and ``Header`` keywords\n  with IPython 5 and later. [#7071]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- When writing to HDF5 files, the serialized metadata are now saved in a new\n  dataset, instead of the HDF5 dataset attributes. This allows for metadata of\n  any dimensions. [#6304]\n\n- Added support in HDF5 for writing and reading back a table which has \"mixin\n  columns\" such as ``SkyCoord`` or ``EarthLocation`` with no loss of\n  information. [#7007]\n\n- Add implementations of astropy-specific ASDF tag types. [#6790]\n\n- Add ASDF tag and schema for ICRSCoord. [#6904]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Add unit support for tabular models. [#6529]\n\n- A ``deepcopy()`` method was added to models. [#6515]\n\n- Added units support to ``AffineTransformation``. [#6853]\n\n- Added ``is_separable`` function to modeling to test the\n  separability of a model. [#6746]\n\n- Added ``Model.separable`` property. It returns a boolean value or\n  ``None`` if not set. [#6746]\n\n- Support masked array values in ``LinearLSQFitter`` (instead of silently\n  ignoring the mask). [#6927]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Added false alarm probability computation to ``astropy.stats.LombScargle``\n  [#6488]\n\n- Implemented Kuiper functions in ``astropy.stats`` [#3724, #6565]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Added support for reading and writing ``astropy.time.Time`` Table columns\n  to and from FITS tables, to the extent supported by the FITS standard. [#6176]\n\n- Improved exception handling and error messages when column ``format``\n  attribute is incorrect for the column type. [#6385]\n\n- Allow to pass ``htmldict`` option to the jsviewer writer. [#6551]\n\n- Added new table operation ``astropy.table.setdiff`` that returns the set\n  difference of table rows for two tables. [#6443]\n\n- Added support for reading time columns in FITS compliant binary tables\n  as ``astropy.time.Time`` Table columns. [#6442]\n\n- Allowed to remove table rows through the ``__delitem__`` method. [#5839]\n\n- Added a new ``showtable`` command-line script to view binary or ASCII table\n  files. [#6859]\n\n- Added new table property ``astropy.table.Table.loc_indices`` that returns the\n  location of rows by indexes. [#6831]\n\n- Allow updating of table by indices through the property ``astropy.table.Table.loc``. [#6831]\n\n- Enable tab-completion for column names with IPython 5 and later. [#7071]\n\n- Allow getting and setting a table Row using multiple column names. [#7107]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- Split pytest plugins into separate modules. Move remotedata, openfiles,\n  doctestplus plugins to standalone repositories. [#6384, #6606]\n\n- When testing, astropy (or the package being tested) is now installed to\n  a temporary directory instead of copying the build. This allows\n  entry points to work correctly. [#6890]\n\n- The tests_require setting in setup.py now works properly when running\n  'python setup.py test'. [#6892]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Deprecated conversion of quantities to truth values. Currently, the expression\n  ``bool(0 * u.dimensionless_unscaled)`` evaluates to ``True``. In the future,\n  attempting to convert a ``Quantity`` to a ``bool`` will raise ``ValueError``.\n  [#6580, #6590]\n\n- Modify the ``brightness_temperature`` equivalency to provide a surface\n  brightness equivalency instead of the awkward assumed-per-beam equivalency\n  that previously existed [#5173, #6663]\n\n- Support was added for a number of ``scipy.special`` functions. [#6852]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- The ``astropy.utils.console.ProgressBar.map`` class method now supports the\n  ``ipython_widget`` option. You can now pass it both ``multiprocess=True`` and\n  ``ipython_widget=True`` to get both multiprocess speedup and a progress bar\n  widget in an IPython Notebook. [#6368]\n\n- The ``astropy.utils.compat.funcsigs`` module has now been deprecated. Use the\n  Python 'inspect' module directly instead. [#6598]\n\n- The ``astropy.utils.compat.futures`` module has now been deprecated. Use the\n  Python 'concurrent.futures' module directly instead. [#6598]\n\n- ``JsonCustomEncoder`` is expanded to handle ``Quantity`` and ``UnitBase``.\n  [#5471]\n\n- Added a ``dcip_xy`` method to IERS that interpolates along the dX_2000A and\n  dY_2000A columns of the IERS table.  Hence, the data for the CIP offsets is\n  now available for use in coordinate frame conversion. [#5837]\n\n- The functions ``matmul``, ``broadcast_arrays``, ``broadcast_to`` of the\n  ``astropy.utils.compat.numpy`` module have been deprecated. Use the\n  NumPy functions directly. [#6691]\n\n- The ``astropy.utils.console.ProgressBar.map`` class method now returns\n  results in sequential order. Previously, if you set ``multiprocess=True``,\n  then the results could arrive in any arbitrary order, which could be a nasty\n  shock. Although the function will still be evaluated on the items in\n  arbitrary order, the return values will arrive in the same order in which the\n  input items were provided. The method is now a thin wrapper around\n  ``astropy.utils.console.ProgressBar.map_unordered``, which preserves the old\n  behavior. [#6439]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Enable Matplotlib's subtraction shorthand syntax for composing and\n  inverting transformations for the ``WCSWorld2PixelTransform`` and\n  ``WCSPixel2WorldTransform`` classes by setting ``has_inverse`` to ``True``.\n  In order to implement a unit test, also implement the equality comparison\n  operator for both classes. [#6531]\n\n- Added automatic hiding of axes labels when no tick labels are drawn on that\n  axis. This parameter can be configured with\n  ``WCSAxes.coords[*].set_axislabel_visibility_rule`` so that labels are automatically\n  hidden when no ticks are drawn or always shown. [#6774]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Added a new function ``celestial_frame_to_wcs`` to convert from\n  coordinate frames to WCS (the opposite of what ``wcs_to_celestial_frame``\n  currently does. [#6481]\n\n- ``wcslib`` was updated to v 5.18. [#7066]\n\n\nAPI Changes\n-----------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- ``Gaussian2DKernel`` now accepts ``x_stddev`` in place of ``stddev`` with\n  an option for ``y_stddev``, if different. It also accepts ``theta`` like\n  ``Gaussian2D`` model. [#3605, #6748]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Deprecated ``recommended_units`` for representations. These were used to\n  ensure that any angle was presented in degrees in sky coordinates and\n  frames. This is more logically done in the frame itself. [#6858]\n\n- As noted above, the frame class attributes ``representation`` and\n  ``differential_cls`` are being replaced by ``representation_type`` and\n  ``differential_type``. In the next version, using ``representation`` will raise\n  a deprecation warning. [#6873]\n\n- Coordinate frame classes now can't be added to the frame transform graph if\n  they have frame attribute names that conflict with any component names. This\n  is so ``SkyCoord`` can uniquely identify and distinguish frame attributes from\n  frame components. [#6871]\n\n- Slicing and reshaping of ``SkyCoord`` and coordinate frames no longer passes\n  the new object through ``__init__``, but directly sets attributes on a new\n  instance. This speeds up those methods by an order of magnitude, but means\n  that any customization done in ``__init__`` is by-passed. [#6941]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Allow ECSV files to be auto-identified by ``Table.read`` or\n  ``Table.write`` based on the ``.ecsv`` file name suffix. In this case it\n  is not required to provide the ``format`` keyword. [#6552]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Automatically detect and handle compression in FITS files that are opened by\n  passing a file handle to ``fits.open`` [#6373]\n\n- Remove the ``nonstandard`` checksum option. [#6571]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- When writing to HDF5 files, the serialized metadata are now saved in a new\n  dataset instead of the HDF5 dataset attributes. This allows for metadata of\n  any dimensions. [#6304]\n\n- Deprecated the ``usecPickle`` kwarg of ``fnunpickle`` and ``fnpickle`` as\n  it was needed only for Python2 usage. [#6655]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Add handling of ``tree.Group`` elements to ``tree.Resource``.  Unified I/O\n  or conversion to astropy tables is not affected. [#6262]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Removed deprecated ``GaussianAbsorption1D`` model.\n  Use ``Const1D - Gaussian1D`` instead. [#6542]\n\n- Removed the registry from modeling. [#6706]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- When setting the column ``format`` attribute the value is now immediately\n  validated. Previously one could set to any value and it was only checked\n  when actually formatting the column. [#6385]\n\n- Deprecated the ``python3_only`` kwarg of the\n  ``convert_bytestring_to_unicode`` and ``convert_unicode_to_bytestring``\n  methods it was needed only for Python2 usage. [#6655]\n\n- When reading in FITS tables with ``Table.read``, string columns are now\n  represented using Numpy byte (dtype ``S``) arrays rather than Numpy\n  unicode arrays (dtype ``U``). The ``Column`` class then ensures the\n  bytes are automatically converted to string as needed. [#6821]\n\n- When getting a table row using multiple column names, if one of the\n  names is not a valid column name then a ``KeyError`` exception is\n  now raised (previously ``ValueError``).  When setting a table row,\n  if the right hand side is not a sequence with the correct length\n  then a ``ValueError`` is now raised (previously in certain cases\n  a ``TypeError`` was raised). [#7107]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- ``download_files_in_parallel`` now always uses ``cache=True`` to make the\n  function work on Windows. [#6671]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- The Astropy matplotlib plot style has been deprecated. It will continue to\n  work in future but is no longer documented. [#6991]\n\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Frame objects now use the default differential even if the representation is\n  explicitly provided as long as the representation provided is the same type as\n  the default representation. [#6944]\n\n- Coordinate frame classes now raise an error when they are added to the frame\n  transform graph if they have frame attribute names that conflict with any\n  component names. [#6871]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Added support for reading very large tables in chunks to reduce memory\n  usage. [#6458]\n\n- Strip leading/trailing white-space from latex lines to avoid issues when\n  matching ``\\begin{tabular}`` statements.  This is done by introducing a new\n  ``LatexInputter`` class to override the ``BaseInputter``. [#6311]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Properly handle opening of FITS files from ``http.client.HTTPResponse`` (i.e.\n  it now works correctly when passing the results of ``urllib.request.urlopen``\n  to ``fits.open``). [#6378]\n\n- Fix the ``fitscheck`` script for updating invalid checksums, or removing\n  checksums. [#6571]\n\n- Fixed potential problems with the compression module [#6732]\n\n- Always use the 'D' format for floating point values in ascii tables. [#6938]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix getting a table row when using multiple column names (for example\n  ``t[3]['a', 'b', 'c']``).  Also fix a problem when setting an entire row:\n  if setting one of the right-hand side values failed this could result in\n  a partial update of the referenced parent table before the exception is\n  raised. [#7107]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Initialization of ``Time`` instances with bytes or arrays with dtype ``S``\n  will now automatically attempt to decode as ASCII. This ensures ``Column``\n  instances with ASCII strings stored with dtype ``S`` can be used.\n  [#6823, #6903]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Fixed a bug that caused PLY files to not be generated correctly in Python 3.\n  [#7174]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- The ``deprecated`` decorator applied to a class will now modify the class\n  itself, rather than to create a class that just looks and behave like the\n  original. This is needed so that the Python 3 ``super`` without arguments\n  works for decorated classes. [#6615]\n\n- Fixed ``HomogeneousList`` when setting one item or a slice. [#6773]\n\n- Also check the type when creating a new instance of\n  ``HomogeneousList``. [#6773]\n\n- Make ``HomogeneousList`` work with iterators and generators when creating the\n  instance, extending it, or using when setting a slice. [#6773]\n\n\nOther Changes and Additions\n---------------------------\n\n- Versions of Python <3.5 are no longer supported. [#6556]\n\n- Versions of Pytest <3.1 are no longer supported. [#6419]\n\n- Versions of Numpy <1.10 are no longer supported. [#6593]\n\n- The bundled CFITSIO was updated to version 3.41 [#6477]\n\n- ``analytic_functions`` sub-package is removed.\n  Use ``astropy.modeling.blackbody``. [#6541]\n\n- ``astropy.vo`` sub-package is removed. Use ``astropy.samp`` for SAMP and\n  ``astroquery`` for VO cone search. [#6540]\n\n- The guide to setting up Emacs for code development was simplified, and\n  updated to recommend ``flycheck`` and ``flake8`` for syntax checks. [#6692]\n\n- The bundled version of PLY was updated to 3.10. [#7174]\n\n\n\n2.0.16 (2019-10-27)\n===================\n\nBug Fixes\n---------\n\nastropy.time\n^^^^^^^^^^^^\n\n- Fixed a troubling bug in which ``Time`` could loose precision, with deviations\n  of 300 ns. [#9328]\n\n\nOther Changes and Additions\n---------------------------\n\n- Updated IERS A URLs due to USNO prolonged maintenance. [#9443]\n\n\n\n2.0.15 (2019-10-06)\n===================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug where the string representation of a ``BaseCoordinateFrame``\n  object could become garbled under specific circumstances when the frame\n  defines custom component names via ``RepresentationMapping``. [#8869]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fix uint conversion in ``FITS_rec`` when slicing a table. [#8982]\n\n- Fix reading of unsigned 8-bit integer with compressed fits. [#9219]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Fixed a bug in ``overlap_slices`` where the ``\"strict\"`` mode was\n  too strict for a small array along the upper edge of the large array.\n  [#8901]\n\n- Fixed a bug in ``overlap_slices`` where a ``NoOverlapError`` would\n  be incorrectly raised for a 0-shaped small array at the origin.\n  [#8901]\n\nastropy.samp\n^^^^^^^^^^^^\n\n- Fixed a bug that caused an incorrectly constructed warning message\n  to raise an error. [#8966]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix ``FixedWidthNoHeader`` to pay attention to ``data_start`` keyword when\n  finding first data line to split columns [#8485, #8511]\n\n- Fix bug when initializing ``Table`` with ``rows`` as a generator. [#9315]\n\n- Fix ``join`` when there are multiple mixin (Quantity) columns as keys. [#9313]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- ``Quantity`` now preserves the ``dtype`` for anything that is floating\n  point, including ``float16``. [#8872]\n\n- ``Unit()`` now accepts units with fractional exponents such as ``m(3/2)``\n  in the default/``fits`` and ``vounit`` formats that would previously\n  have been rejected for containing multiple solidi (``/``). [#9000]\n\n- Fixed the LaTeX representation of units containing a superscript. [#9218]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Fixed compatibility issues with latest versions of Matplotlib. [#8961]\n\n\nOther Changes and Additions\n---------------------------\n\n- Updated required version of Cython to v0.29.13 to make sure that\n  generated C files are compatible with the upcoming Python 3.8 release\n  as well as earlier supported versions of Python. [#9198]\n\n\n\n2.0.14 (2019-06-14)\n===================\n\nBug Fixes\n---------\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fix ``Header.update`` which was dropping the comments when passed\n  a ``Header`` object. [#8840]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- ``Moffat1D.fwhm`` and ``Moffat2D.fwhm`` will return a positive value when\n  ``gamma`` is negative. [#8801, #8815]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Fixed a bug that prevented ``EarthLocation`` from being initialized with\n  numpy >=1.17. [#8849]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Fixed ``quantity_support`` to work around the fact that matplotlib\n  does not detect subclasses in its ``units`` framework. With this,\n  ``Angle`` and other subclasses work correctly. [#8818]\n\n- Fixed ``quantity_support`` to work properly if multiple context managers\n  are nested. [#8844]\n\n\n2.0.13 (2019-06-08)\n===================\n\nBug Fixes\n---------\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n- Fixed bug in ``ColDefs._init_from_array()`` that caused unsigned datatypes\n  with the opposite endianness as the host architecture to fail the\n  TestColumnFunctions.test_coldefs_init_from_array unit test. [#8460]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Explicitly set PyYAML default flow style to None to ensure consistent\n  astropy YAML output for PyYAML version 5.1 and later. [#8500]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Block floating-point columns from using repr format when converted to Table\n  [#8358]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Fixed issue in ``bayesian_blocks`` when called with the ``ncp_prior``\n  keyword. [#8339]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Fix ``take`` when one gets only a single element from a ``Quantity``,\n  ensuring it returns a ``Quantity`` rather than a scalar. [#8617]\n\n\n\n2.0.12 (2019-02-23)\n===================\n\nNew Features\n------------\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- The ``deprecated_renamed_argument`` decorator now capable deprecating an\n  argument without renaming it. It also got a new ``alternative`` keyword\n  argument to suggest alternative functionality instead of the removed\n  one. [#8324]\n\n\nBug Fixes\n---------\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fixed bug in ``ColDefs._init_from_array()`` that caused non-scalar unsigned\n  entries to not have the correct bzero value set. [#8353]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed compatibility of ``JointFitter`` with the latest version of Numpy.\n  [#7984]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix ``.quantity`` property of ``Column`` class for function-units (e.g.,\n  ``dex``). Previously setting this was possible, but getting raised\n  an error. [#8425]\n\n- Fixes a bug where initializing a new ``Table`` from the final row of an\n  existing ``Table`` failed.  This happened when that row was generated using\n  the item index ``[-1]``. [#8422]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Fix bug that caused ``WCS.has_celestial``, ``wcs_to_celestial_frame``, and\n  other functionality depending on it to fail in the presence of correlated\n  celestial and other axes. [#8420]\n\n\nOther Changes and Additions\n---------------------------\n\n- Fixed ``make clean`` for the documentation on Windows to ensure it\n  properly removes the ``api`` and ``generated`` directories. [#8346]\n\n- Updating bundled ``pytest-openfiles`` to v0.3.2. [#8434]\n\n- Making ``ErfaWarning`` and ``ErfaError`` available via\n  ``astropy.utils.exceptions``. [#8441]\n\n\n\n2.0.11 (2018-12-31)\n===================\n\nBug Fixes\n---------\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fix fast reader C tokenizer to handle double quotes in quoted field.\n  [#8283]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fix a bug in ``io.fits`` with writing Fortran-ordered arrays to file\n  objects. [#8282]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Add support for ``np.matmul`` as a ``ufunc`` (new in numpy 1.16).\n  [#8264, #8305]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Fix failures caused by IERS_A_URL being unavailable by introducing\n  IERS_A_URL_MIRROR. [#8308]\n\n\n\n2.0.10 (2018-12-04)\n===================\n\nBug Fixes\n---------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Fix Moffat2DKernel's FWHM computation, which has an influence on the default\n  size of the kernel when no size is given. [#8105]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Disable ``of_address`` usage due to Google API now requiring API key. [#7993]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- ``fits.append`` now correctly handles file objects with valid modes other\n  than ``ostream``. [#7856]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix ``Table.show_in_notebook`` failure when mixin columns are present. [#8069]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- Explicitly disallow incompatible versions of ``pytest`` when using the test\n  runner. [#8188]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Fixed the spelling of the 'luminous emittance/illuminance' physical\n  property. [#7942]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug that caused origin to be incorrect if not specified. [#7927]\n\n- Fixed a bug that caused an error when plotting grids multiple times\n  with grid_type='contours'. [#7927]\n\n- Put an upper limit on the number of bins in ``hist`` and ``histogram`` and\n  factor out calculation of bin edges into public function\n  ``calculate_bin_edges``. [#7991]\n\n\nOther Changes and Additions\n---------------------------\n\n- Fixing ``astropy.__citation__`` to provide the full bibtex entry of the 2018\n  paper. [#8110]\n\n- Pytest 4.0 is not supported by the 2.0.x LTS releases. [#8173]\n\n- Updating bundled ``pytest-remotedata`` to v0.3.1. [#8174]\n\n- Updating bundled ``pytest-doctestplus`` to v0.2.0. [#8175]\n\n- Updating bundled ``pytest-openfiles`` to v0.3.0. [#8176]\n\n- Adding ``warning_type`` keyword argument to the \"deprecated\" decorators to\n  allow issuing custom warning types instead of the default\n  ``AstropyDeprecationWarning``. [#8178]\n\n\n2.0.9 (2018-10-14)\n==================\n\nBug Fixes\n---------\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fix reading of big files with the fast reader. [#7885]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- ``HDUList.__contains__()`` now works with ``HDU`` arguments. That is,\n  ``hdulist[0] in hdulist`` now works as expected. [#7282]\n\n- ``HDUList`` s can now be written to streams in Python 3 [#7850]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Fixed the bug in CCData.read when the HDU is not specified and the first one\n  is empty so the function searches for the first HDU with data which may not\n  have an image extension. [#7739]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Fixed bugs in biweight statistics functions where a constant data\n  array (or if using the axis keyword, constant along an axis) would\n  return NaN. [#7737]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fixed a bug in ``to_pandas()`` where integer type masked columns were always\n  getting converted to float. This could cause loss of precision. Now this only\n  occurs if there are actually masked data values, in which case ``pandas``\n  does require the values to be float so that ``NaN`` can be used to mark the\n  masked values. [#7741, #7747]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- Change the name of the configuration variable controlling the location of the\n  Astropy cache in the Pytest plugin from ``cache_dir`` to\n  ``astropy_cache_dir``. The command line flag also changed to\n  ``--astropy-cache-dir``.  This prevents a conflict with the ``cache_dir``\n  variable provided by pytest itself. Also made similar change to\n  ``config_dir`` option as a precaution. [#7721]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- ``UnrecognizedUnit`` instances can now be compared to any other object\n  without raising `TypeError`. [#7606]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Fix compatibility with Matplotlib 3.0. [#7839]\n\n- Fix an issue that caused a crash when using WCSAxes with a custom Transform\n  object and when using ``grid_type='contours'`` to plot a grid. [#7846]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Instead of raising an error ``astropy.wcs`` now returns the input when\n  the input has zero size.                                       [#7746]\n\n- Fix ``malloc(0)`` bug in ``pipeline_all_pixel2world()`` and\n  ``pipeline_pix2foc()``. They now raise an exception for input with\n  zero coordinates, i.e. shape = (0, n). [#7806]\n\n- Fixed an issue with scalar input when WCS.naxis is one. [#7858]\n\nOther Changes and Additions\n---------------------------\n\n- Added a new ``astropy.__citation__`` attribute which gives a citation\n  for Astropy in bibtex format. Made sure that both this and\n  ``astropy.__bibtex__`` works outside the source environment, too. [#7718]\n\n\n\n2.0.8 (2018-08-02)\n==================\n\nBug Fixes\n---------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Correct data type conversion for non-float masked kernels. [#7542]\n\n- Fix non-float or masked, zero sum kernels when ``normalize_kernel=False``.\n  Non-floats would yield a type error and masked kernels were not being filled.\n  [#7541]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Ensure that relative humidities can be given as Quantities, rather than take\n  any quantity and just strip its unit. [#7668]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Fixed ``Cutout2D`` output WCS NAXIS values to reflect the cutout\n  image size. [#7552]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fixed a bug in ``add_columns`` method where ``rename_duplicate=True`` would\n  cause an error if there were no duplicates. [#7540]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- Fixed bug in ``python setup.py test --coverage`` on Windows machines. [#7673]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Avoid rounding errors when converting ``Quantity`` to ``TimeDelta``. [#7625]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug that caused the position of the tick values in decimal mode\n  to be incorrectly determined. [#7332]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Fixed a bug that caused ``wcs_to_celestial_frame``, ``skycoord_to_pixel``, and\n  ``pixel_to_skycoord`` to raise an error if the axes of the celestial WCS were\n  swapped. [#7691]\n\n\n2.0.7 (2018-06-01)\n==================\n\nBug Fixes\n---------\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed ``Tabular`` models to not change the shape of data. [#7411]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- In ``freedman_bin_width``, if the data has too small IQR,\n  raise ``ValueError``. [#7248, #7402]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix a performance issue in ``MaskedColumn`` where initialization was\n  extremely slow for large arrays with the default ``mask=None``. [#7422]\n\n- Fix printing table row indexed with unsigned integer. [#7469]\n\n- Fix copy of mask when copying a Table, as this is no more done systematically\n  by Numpy since version 1.14. Also fixed a problem when MaskedColumn was\n  initialized with ``mask=np.ma.nomask``. [#7486]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Fixed a bug in Time that raised an error when initializing a subclass of Time\n  with a Time object. [#7453]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Fixed a bug that improperly handled unicode case of URL mirror in Python 2.\n  [#7493]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug that prevented legends from being added to plots done with\n  units. [#7510]\n\n\nOther Changes and Additions\n---------------------------\n\n- Bundled ``pytest-remotedata`` plugin is upgraded to 0.3. [#7493]\n\n\n2.0.6 (2018-04-23)\n==================\n\nBug Fixes\n---------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- convolve(boundary=None) requires the kernel to be smaller than the image.\n  This was never actually checked, it now is and an exception is raised.\n  [#7313]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- ``u.quantity_input`` no longer errors if the return annotation for a\n  function is ``None``. [#7336, #7380]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Explicitly default to origin='lower' in WCSAxes. [#7331]\n\n- Lists of units are now converted in the Matplotlib unit converter. This means\n  that for Matplotlib versions later than 2.2, more plotting functions now work\n  with units (e.g. errorbar). [#7037]\n\n\nOther Changes and Additions\n---------------------------\n\n- Updated the bundled CFITSIO library to 3.44. This is to remedy another\n  critical security vulnerability that was identified by NASA. See\n  ``cextern/cfitsio/docs/changes.txt`` for additional information. [#7370]\n\n\n2.0.5 (2018-03-12)\n==================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Add a workaround for a bug in the einsum function in Numpy 1.14.0. [#7187]\n\n- Fix problems with printing ``Angle`` instances under numpy 1.14.1. [#7234]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fixed the ``fitsdiff`` script for matching fits file with one in a\n  directory path. [#7085]\n\n- Make sure that lazily-loaded ``HDUList`` is automatically loaded when calling\n  ``hdulist.pop``. [#7186]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Propagate weights to underlying fitter in ``FittingWithOutlierRemoval`` [#7249]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- Support dotted package names as namespace packages when gathering test\n  coverage. [#7170]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Matplotlib axes have the ``axisbelow`` property to control the z-order of\n  ticks, tick labels, and grid lines. WCSAxes will now respect this property.\n  This is useful for drawing scale bars or inset boxes, which should have a\n  z-order that places them above all ticks and gridlines. [#7098]\n\n\nOther Changes and Additions\n---------------------------\n\n- Updated the bundled CFITSIO library to 3.430. This is to remedy a critical\n  security vulnerability that was identified by NASA. See\n  ``cextern/cfitsio/docs/changes.txt`` for additional information. [#7274, #7275]\n\n\n2.0.4 (2018-02-06)\n==================\n\nBug Fixes\n---------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed IndexError when ``preserve_nan=True`` in ``convolve_fft``. Added\n  testing with ``preserve_nan=True``. [#7000]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- The ``sites.json`` file is now parsed explicitly with a UTF-8 encoding. This\n  means that future revisions to the file with unicode observatory names can\n  be done without breaking the site registry parser.  [#7082]\n\n- Working around a bug in Numpy 1.14.0 that broke some coordinate\n  transformations. [#7105]\n\n- Fixed a bug where negative angles could be rounded wrongly when converting\n  to a string with seconds omitted. [#7148]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- When datafile is missing, fits.tabledump uses input file name to build\n  output file name. Fixed how it gets input file name from HDUList. [#6976]\n\n- Fix in-place updates to scaled columns. [#6956]\n\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed bug in identifying inherited registrations from multiple ancestors [#7156]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed a bug in ``LevMarLSQFitter`` when fitting 2D models with constraints. [#6705]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- ``download_file`` function will check for cache downloaded from mirror URL\n  first before attempting actual download if primary URL is unavailable. [#6987]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Fixed test failures for ``astropy.visualization.wcsaxes`` which were due to\n  local matplotlibrc files being taken into account. [#7132]\n\n\nOther Changes and Additions\n---------------------------\n\n- Fixed broken links in the documentation. [#6745]\n\n- Substantial performance improvement (potentially >1000x for some cases) when\n  converting non-scalar ``coordinates.Angle`` objects to strings. [#7004]\n\n\n2.0.3 (2017-12-13)\n==================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Ecliptic frame classes now support attributes ``v_x``, ``v_y``, ``v_z`` when\n  using with a Cartesian representation. [#6569]\n\n- Added a nicer error message when accidentally calling ``frame.representation``\n  instead of ``frame.data`` in the context of methods that use ``._apply()``.\n  [#6561]\n\n- Creating a new ``SkyCoord`` from a list of multiple ``SkyCoord`` objects now\n  yield the correct type of frame, and works at all for non-equatorial frames.\n  [#6612]\n\n- Improved accuracy of velocity calculation in ``EarthLocation.get_gcrs_posvel``.\n  [#6699]\n\n- Improved accuracy of radial velocity corrections in\n  ``SkyCoord.radial_velocity_correction```. [#6861]\n\n- The precision of ecliptic frames is now much better, after removing the\n  nutation from the rotation and fixing the computation of the position of the\n  Sun. [#6508]\n\nastropy.extern\n^^^^^^^^^^^^^^\n\n- Version 0.2.1 of ``pytest-astropy`` is included as an external package.\n  [#6918]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fix writing the result of ``fitsdiff`` to file with ``--output-file``. [#6621]\n\n- Fix a minor bug where ``FITS_rec`` instances can not be indexed with tuples\n  and other sequences that end up with a scalar. [#6955, #6966]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Fix ``ImportError`` when ``hdf5`` is imported first in a fresh Python\n  interpreter in Python 3. [#6604, #6610]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Suppress errors during WCS creation in CCDData.read(). [#6500]\n\n- Fixed a problem with ``CCDData.read`` when the extension wasn't given and the\n  primary HDU contained no ``data`` but another HDU did. In that case the header\n  were not correctly combined. [#6489]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Fixed an issue where the biweight statistics functions would\n  sometimes cause runtime underflow/overflow errors for float32 input\n  arrays. [#6905]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fixed a problem when printing a table when a column is deleted and\n  garbage-collected, and the format function caching mechanism happens\n  to re-use the same cache key. [#6714]\n\n- Fixed a problem when comparing a unicode masked column (on left side) to\n  a bytes masked column (on right side). [#6899]\n\n- Fixed a problem in comparing masked columns in bytes and unicode when the\n  unicode had masked entries. [#6899]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- Fixed a bug that causes tests for rst files to not be run on certain\n  platforms. [#6555, #6608]\n\n- Fixed a bug that caused the doctestplus plugin to not work nicely with the\n  hypothesis package. [#6605, #6609]\n\n- Fixed a bug that meant that the data.astropy.org mirror could not be used when\n  using --remote-data=astropy. [#6724]\n\n- Support compatibility with new ``pytest-astropy`` plugins. [#6918]\n\n- When testing, astropy (or the package being tested) is now installed to\n  a temporary directory instead of copying the build. This allows\n  entry points to work correctly. [#6890]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Initialization of Time instances now is consistent for all formats to\n  ensure that ``-0.5 <= jd2 < 0.5``. [#6653]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Ensure that ``Quantity`` slices can be set with objects that have a ``unit``\n  attribute (such as ``Column``). [#6123]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- ``download_files_in_parallel`` now respects the given ``timeout`` value.\n  [#6658]\n\n- Fixed bugs in remote data handling and also in IERS unit test related to path\n  URL, and URI normalization on Windows. [#6651]\n\n- Fixed a bug that caused ``get_pkg_data_fileobj`` to not work correctly when\n  used with non-local data from inside packages. [#6724]\n\n- Make sure ``get_pkg_data_fileobj`` fails if the URL can not be read, and\n  correctly falls back on the mirror if necessary. [#6767]\n\n- Fix the ``finddiff`` option in ``find_current_module`` to properly deal\n  with submodules. [#6767]\n\n- Fixed ``pyreadline`` import in ``utils.console.isatty`` for older IPython\n  versions on Windows. [#6800]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Fixed the vertical orientation of the ``fits2bitmap`` output bitmap\n  image to match that of the FITS image. [#6844, #6969]\n\n- Added a workaround for a bug in matplotlib so that the ``fits2bitmap``\n  script generates the correct output file type. [#6969]\n\n\nOther Changes and Additions\n---------------------------\n\n- No longer require LaTeX to build the documentation locally and\n  use mathjax instead. [#6701]\n\n- Ensured that all tests use the Astropy data mirror if needed. [#6767]\n\n\n2.0.2 (2017-09-08)\n==================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Ensure transformations via ICRS also work for coordinates that use cartesian\n  representations. [#6440]\n\n- Fixed a bug that was preventing ``SkyCoord`` objects made from lists of other\n  coordinate objects from being written out to ECSV files. [#6448]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Support the ``GZIP_2`` FITS image compression algorithm as claimed\n  in docs. [#6486]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug that wrote out VO table as version 1.2 instead of 1.3. [#6521]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix a bug when combining unicode columns via join or vstack.  The character\n  width of the output column was a factor of 4 larger than needed. [#6459]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- Fixed running the test suite using --parallel. [#6415]\n\n- Added error handling for attempting to run tests in parallel without having\n  the ``pytest-xdist`` package installed. [#6416]\n\n- Fixed issue running doctests with pytest>=3.2. [#6423, #6430]\n\n- Fixed issue caused by antivirus software in response to malformed compressed\n  files used for testing. [#6522]\n\n- Updated top-level config file to properly ignore top-level directories.\n  [#6449]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Quantity._repr_latex_ now respects precision option from numpy\n  printoptions. [#6412]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- For the ``deprecated_renamed_argument`` decorator, refer to the deprecation‘s\n  caller instead of ``astropy.utils.decorators``, to makes it easier to find\n  where the deprecation warnings comes from. [#6422]\n\n\n2.0.1 (2017-07-30)\n==================\n\nBug Fixes\n---------\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\n- Fixed Earth radius to be the IAU2015 value for the equatorial radius.\n  The polar value had erroneously been used in 2.0. [#6400]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Added old frame attribute classes back to top-level namespace of\n  ``astropy.coordinates``. [#6357]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Scaling an image always uses user-supplied values when given. Added\n  defaults for scaling when bscale/bzero are not present (float images).\n  Fixed a small bug in when to reset ``_orig_bscale``. [#5955]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed a bug in initializing compound models with units. [#6398]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Updating CCDData.read() to be more flexible with inputs, don't try to\n  delete keywords that are missing from the header. [#6388]\n\nastropy.tests\n^^^^^^^^^^^^^\n- Fixed the test command that is run from ``setuptools`` to allow it to\n  gracefully handle keyboard interrupts and pass them on to the ``pytest``\n  subprocess. This prompts ``pytest`` to teardown and display useful traceback\n  and test information [#6369]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Ticks and tick labels are now drawn in front of, rather than behind,\n  gridlines in WCS axes. This improves legibility in situations where\n  tick labels may be on the interior of the axes frame, such as the right\n  ascension axis of an all-sky Aitoff or Mollweide projection. [#6361]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Fix the missing wcskey part in _read_sip_kw, this will cause error when\n  reading sip wcs while there is no default CRPIX1 CRPIX2 keywords and only\n  CRPIX1n CRPIX2n in header. [#6372]\n\n\n\n2.0 (2017-07-07)\n================\n\nNew Features\n------------\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\n- Constants are now organized into version modules, with physical CODATA\n  constants in the ``codata2010`` and ``codata2014`` sub-modules,\n  and astronomical constants defined by the IAU in the ``iau2012`` and\n  ``iau2015`` sub-modules. The default constants in ``astropy.constants``\n  in Astropy 2.0 have been updated from ``iau2012`` to ``iau2015`` and\n  from ``codata2010`` to ``codata2014``. The constants for 1.3 can be\n  accessed in the ``astropyconst13`` sub-module and the constants for 2.0\n  (the default in ``astropy.constants``) can also be accessed in the\n  ``astropyconst20`` sub-module [#6083]\n\n- The GM mass parameters recommended by IAU 2015 Resolution B 3 have been\n  added as ``GM_sun``, ``GM_jup``, and ``GM_earth``, for the Sun,\n  Jupiter and the Earth. [#6083]\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Major change in convolution behavior and keyword arguments. Additional\n  details are in the API section. [#5782]\n\n- Convolution with un-normalized and un-normalizable kernels is now possible.\n  [#5782]\n\n- Add a new argument, ``normalization_rtol``, to ``convolve_fft``, allowing\n  the user to specify the relative error tolerance in the normalization of\n  the convolution kernel. [#5649, #5177]\n\n- Models can now be convoluted using ``convolve`` or ``convolve_fft``,\n  which generates a regular compound model. [#6015]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Frame attributes set on ``SkyCoord`` are now always validated, and any\n  ndarray-like operation (like slicing) will also be done on those. [#5751]\n\n- Caching of  all possible frame attributes was implemented. This greatly\n  speeds up many ``SkyCoord`` operations. [#5703, #5751]\n\n- A class hierarchy was added to allow the representation layer to store\n  differentials (i.e., finite derivatives) of coordinates.  This is intended\n  to enable support for velocities in coordinate frames. [#5871]\n\n- ``replicate_without_data`` and ``replicate`` methods were added to\n  coordinate frames that allow copying an existing frame object with various\n  reference or copy behaviors and possibly overriding frame attributes. [#6182]\n\n- The representation class instances can now contain differential objects.\n  This is primarily useful for internal operations that will provide support\n  for transforming velocity components in coordinate frames. [#6169]\n\n- ``EarthLocation.to_geodetic()`` (and ``EarthLocation.geodetic``) now return\n  namedtuples instead of regular tuples. [#6237]\n\n- ``EarthLocation`` now has ``lat`` and ``lon`` properties (equivalent to, but\n  preferred over, the previous ``latitude`` and ``longitude``). [#6237]\n\n- Added a ``radial_velocity_correction`` method to ``SkyCoord`` to do compute\n  barycentric and heliocentric velocity corrections. [#5752]\n\n- Added a new ``AffineTransform`` class for coordinate frame transformations.\n  This class supports matrix operations with vector offsets in position or\n  any differential quantities (so far, only velocity is supported). The\n  matrix transform classes now subclass from the base affine transform.\n  [#6218]\n\n- Frame objects now have experimental support for velocity components. Most\n  frames default to accepting proper motion components and radial velocity,\n  and the velocities transform correctly for any transformation that uses\n  one of the ``AffineTransform``-type transformations.  For other\n  transformations a finite-difference velocity transformation is available,\n  although it is not as numerically stable as those that use\n  ``AffineTransform``-type transformations. [#6219, #6226]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Allow to specify encoding in ``ascii.read``, only for Python 3 and with the\n  pure-Python readers. [#5448]\n\n- Writing latex tables with only a ``tabular`` environment is now possible by\n  setting ``latexdict['tabletyle']`` to ``None``. [#6205]\n\n- Allow ECSV format to support reading and writing mixin columns like\n  ``Time``, ``SkyCoord``, ``Latitude``, and ``EarthLocation``. [#6181]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Checking available disk space before writing out file. [#5550, #4065]\n\n- Change behavior to warn about units that are not FITS-compliant when\n  writing a FITS file but not when reading. [#5675]\n\n- Added absolute tolerance parameter when comparing FITS files. [#4729]\n\n- New convenience function ``printdiff`` to print out diff reports. [#5759]\n\n- Allow to instantiate a ``BinTableHDU`` directly from a ``Table`` object.\n  [#6139]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- YAML representer now also accepts numpy types. [#6077]\n\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\n- New functions to unregister readers, writers, and identifiers. [#6217]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Added ``SmoothlyBrokenPowerLaw1D`` model. [#5656]\n\n- Add ``n_submodels`` shared method to single and compound models, which\n  allows users to get the number of components of a given single (compound)\n  model. [#5747]\n\n- Added a ``name`` setter for instances of ``_CompoundModel``. [#5741]\n\n- Added FWHM properties to Gaussian and Moffat models. [#6027]\n\n- Added support for evaluating models and setting the results for inputs\n  outside the bounding_box to a user specified ``fill_value``. This\n  is controlled by a new optional boolean keyword ``with_bounding_box``. [#6081]\n\n- Added infrastructure support for units on parameters and during\n  model evaluation and fitting, added support for units on all\n  functional, power-law, polynomial, and rotation models where this\n  is appropriate. A new BlackBody1D model has been added.\n  [#4855, #6183, #6204, #6235]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Added an image class, ``CCDData``. [#6173]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Added ``biweight_midcovariance`` function. [#5777]\n\n- Added ``biweight_scale`` and ``biweight_midcorrelation``\n  functions. [#5991]\n\n- ``median_absolute_deviation`` and ``mad_std`` have ``ignore_nan`` option\n  that will use ``np.ma.median`` with nans masked out or ``np.nanmedian``\n  instead of ``np.median`` when computing the median. [#5232]\n\n- Implemented statistical estimators for Ripley's K Function. [#5712]\n\n- Added ``SigmaClip`` class. [#6206]\n\n- Added ``std_ddof`` keyword option to ``sigma_clipped_stats``.\n  [#6066, #6207]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Issue a warning when assigning a string value to a column and\n  the string gets truncated.  This can occur because numpy string\n  arrays are fixed-width and silently drop characters which do not\n  fit within the fixed width. [#5624, #5819]\n\n- Added functionality to allow ``astropy.units.Quantity`` to be written\n  as a normal column to FITS files. [#5910]\n\n- Add support for Quantity columns (within a ``QTable``) in table\n  ``join()``, ``hstack()`` and ``vstack()`` operations. [#5841]\n\n- Allow unicode strings to be stored in a Table bytestring column in\n  Python 3 using UTF-8 encoding.  Allow comparison and assignment of\n  Python 3 ``str`` object in a bytestring column (numpy ``'S'`` dtype).\n  If comparison with ``str`` instead of ``bytes`` is a problem\n  (and ``bytes`` is really more logical), please open an issue on GitHub.\n  [#5700]\n\n- Added functionality to allow ``astropy.units.Quantity`` to be read\n  from and written to a VOtable file. [#6132]\n\n- Added support for reading and writing a table with mixin columns like\n  ``Time``, ``SkyCoord``, ``Latitude``, and ``EarthLocation`` via the\n  ASCII ECSV format. [#6181]\n\n- Bug fix for ``MaskedColumn`` insert method, where ``fill_value`` attribute\n  was not being passed along to the copy of the ``MaskedColumn`` that was\n  returned. [#7585]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- ``enable_deprecations_as_exceptions`` function now accepts additional\n  user-defined module imports and warning messages to ignore. [#6223, #6334]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- The ``astropy.units.quantity_input`` decorator will now convert the output to\n  the unit specified as a return annotation under Python 3. [#5606]\n\n- Passing a logarithmic unit to the ``Quantity`` constructor now returns the\n  appropriate logarithmic quantity class if ``subok=True``. For instance,\n  ``Quantity(1, u.dex(u.m), subok=True)`` yields ``<Dex 1.0 dex(m)>``. [#5928]\n\n- The ``quantity_input`` decorator now accepts a string physical type in\n  addition to of a unit object to specify the expected input ``Quantity``'s\n  physical type. For example, ``@u.quantity_input(x='angle')`` is now\n  functionally the same as ``@u.quantity_input(x=u.degree)``. [#3847]\n\n- The ``quantity_input`` decorator now also supports unit checking for\n  optional keyword arguments and accepts iterables of units or physical types\n  for specifying multiple valid equivalent inputs. For example,\n  ``@u.quantity_input(x=['angle', 'angular speed'])`` or\n  ``@u.quantity_input(x=[u.radian, u.radian/u.yr])`` would both allow either\n  a ``Quantity`` angle or angular speed passed in to the argument ``x``.\n  [#5653]\n\n- Added a new equivalence ``molar_mass_amu`` between g/mol to\n  atomic mass units. [#6040, #6113]\n\n- ``Quantity`` has gained a new ``to_value`` method which returns the value\n  of the quantity in a given unit. [#6127]\n\n- ``Quantity`` now supports the ``@`` operator for matrix multiplication that\n  was introduced in Python 3.5, for all supported versions of numpy. [#6144]\n\n- ``Quantity`` supports the new ``__array_ufunc__`` protocol introduced in\n  numpy 1.13.  As a result, operations that involve unit conversion will be\n  sped up considerably (by up to a factor of two for costly operations such\n  as trigonometric ones). [#2583]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Added a new ``dataurl_mirror`` configuration item in ``astropy.utils.data``\n  that is used to indicate a mirror for the astropy data server. [#5547]\n\n- Added a new convenience method ``get_cached_urls`` to ``astropy.utils.data``\n  for getting a list of the URLs in your cache. [#6242]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Upgraded the included wcslib to version 5.16. [#6225]\n\n  The minimum required version of wcslib in is 5.14.\n\n\nAPI Changes\n-----------\n\nastropy.analytic_functions\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n- This entire sub-package is deprecated because blackbody has been moved to\n  ``astropy.modeling.blackbody``. [#6191]\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Major change in convolution behavior and keyword arguments.\n  ``astropy.convolution.convolve_fft`` replaced ``interpolate_nan`` with\n  ``nan_treatment``, and ``astropy.convolution.convolve`` received a new\n  ``nan_treatment`` argument. ``astropy.convolution.convolve`` also no longer\n  double-interpolates interpolates over NaNs, although that is now available\n  as a separate ``astropy.convolution.interpolate_replace_nans`` function. See\n  `the backwards compatibility note\n  <https://docs.astropy.org/en/v2.0.16/convolution/index.html#a-note-on-backward-compatibility-pre-v2-0>`_\n  for more on how to get the old behavior (and why you probably don't want to.)\n  [#5782]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- The ``astropy.coordinates.Galactic`` frame previously was had the cartesian\n  ordering 'w', 'u', 'v' (for 'x', 'y', and 'z', respectively).  This was an\n  error and against the common convention.  The 'x', 'y', and 'z' axes now\n  map to 'u', 'v', and 'w', following the right-handed ('u' points to\n  the Galactic center) convention. [#6330]\n\n- Removed deprecated ``angles.rotation_matrix`` and\n  ``angles.angle_axis``. Use the routines in\n  ``coordinates.matrix_utilities`` instead. [#6170]\n\n- ``EarthLocation.latitude`` and ``EarthLocation.longitude`` are now\n  deprecated in favor of ``EarthLocation.lat`` and ``EarthLocation.lon``.\n  They former will be removed in a future version. [#6237]\n\n- The ``FrameAttribute`` class and subclasses have been renamed to just contain\n  ``Attribute``. For example, ``QuantityFrameAttribute`` is now\n  ``QuantityAttribute``. [#6300]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Cosmological models do not include any contribution from neutrinos or photons\n  by default -- that is, the default value of Tcmb0 is 0.  This does not affect\n  built in models (such as WMAP or Planck). [#6112]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Remove deprecated ``NumCode`` and ``ImgCode`` properties on FITS\n  ``_ImageBaseHDU``.  Use module-level constants ``BITPIX2DTYPE`` and\n  ``DTYPE2BITPIX`` instead. [#4993]\n\n- ``comments`` meta key (which is ``io.ascii``'s table convention) is output\n  to ``COMMENT`` instead of ``COMMENTS`` header. Similarly, ``COMMENT``\n  headers are read into ``comments`` meta [#6097]\n\n- Remove compatibility code which forced loading all HDUs on close. The old\n  behavior can be used with ``lazy_load_hdus=False``. Because of this change,\n  trying to access the ``.data`` attribute from an HDU which is not loaded\n  now raises a ``IndexError`` instead of a ``ValueError``. [#6082]\n\n- Deprecated ``clobber`` keyword; use ``overwrite``. [#6203]\n\n- Add EXTVER column to the output of ``HDUList.info()``. [#6124]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Removed deprecated ``Redshift`` model; Use ``RedshiftScaleFactor``. [#6053]\n\n- Removed deprecated ``Pix2Sky_AZP.check_mu`` and ``Pix2Sky_SZP.check_mu``\n  methods. [#6170]\n\n- Deprecated ``GaussianAbsorption1D`` model, as it can be better represented\n  by subtracting ``Gaussian1D`` from ``Const1D``. [#6200]\n\n- Added method ``sum_of_implicit_terms`` to ``Model``, needed when performing\n  a linear fit to a model that has built-in terms with no corresponding\n  parameters (primarily the ``1*x`` term of ``Shift``). [#6174]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Removed deprecated usage of parameter ``propagate_uncertainties`` as a\n  positional keyword. [#6170]\n\n- Removed deprecated ``support_correlated`` attribute. [#6170]\n\n- Removed deprecated ``propagate_add``, ``propagate_subtract``,\n  ``propagate_multiply`` and ``propagate_divide`` methods. [#6170]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Removed the deprecated ``sig`` and ``varfunc`` keywords in the\n  ``sigma_clip`` function. [#5715]\n\n- Added ``modify_sample_size`` keyword to ``biweight_midvariance``\n  function. [#5991]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- In Python 3, when getting an item from a bytestring Column it is now\n  converted to ``str``.  This means comparing a single item to a ``bytes``\n  object will always fail, and instead one must compare with a ``str``\n  object. [#5700]\n\n- Removed the deprecated ``data`` property of Row. [#5729]\n\n- Removed the deprecated functions ``join``, ``hstack``, ``vstack`` and\n  ``get_groups`` from np_utils. [#5729]\n\n- Added ``name`` parameter to method ``astropy.table.Table.add_column`` and\n  ``names`` parameter to method ``astropy.table.Table.add_columns``, to\n  provide the flexibility to add unnamed columns, mixin objects and also to\n  specify explicit names. Default names will be used if not\n  specified. [#5996]\n\n- Added optional ``axis`` parameter to ``insert`` method for ``Column`` and\n  ``MaskedColumn`` classes. [#6092]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Moved ``units.cgs.emu`` to ``units.deprecated.emu`` due to ambiguous\n  definition of \"emu\". [#4918, #5906]\n\n- ``jupiterMass``, ``earthMass``, ``jupiterRad``, and ``earthRad`` no longer\n  have their prefixed units included in the standard units.  If needed, they\n  can still  be found in ``units.deprecated``. [#5661]\n\n- ``solLum``,``solMass``, and ``solRad`` no longer have  their prefixed units\n  included in the standard units.  If needed, they can still be found in\n  ``units.required_by_vounit``, and are enabled by default. [#5661]\n\n- Removed deprecated ``Unit.get_converter``. [#6170]\n\n- Internally, astropy replaced use of ``.to(unit).value`` with the new\n  ``to_value(unit)`` method, since this is somewhat faster. Any subclasses\n  that overwrote ``.to``, should also overwrite ``.to_value`` (or\n  possibly just the private ``._to_value`` method.  (If you did this,\n  please let us know what was lacking that made this necessary!). [#6137]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Removed the deprecated compatibility modules for Python 2.6 (``argparse``,\n  ``fractions``, ``gzip``, ``odict``, ``subprocess``) [#5975,#6157,#6164]\n\n- Removed the deprecated ``zest.releaser`` machinery. [#6282]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Removed the deprecated ``scale_image`` function. [#6170]\n\nastropy.vo\n^^^^^^^^^^\n\n- Cone Search now issues deprecation warning because it is moved to\n  Astroquery 0.3.5 and will be removed from Astropy in a future version.\n  [#5558, #5904]\n\n- The ``astropy.vo.samp`` package has been moved to ``astropy.samp``, and no\n  longer supports HTTPS/SSL. [#6201, #6213]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Removed deprecated ``wcs.rotateCD``. [#6170]\n\n\nBug Fixes\n---------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Major change in convolution behavior and keyword arguments:\n  ``astropy.convolution.convolve`` was not performing normalized convolution\n  in earlier versions of astropy. [#5782]\n\n- Direct convolution previously implemented the wrong definition of\n  convolution.  This error only affects *asymmetric* kernels. [#6267]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- The ``astropy.coordinates.Galactic`` frame had an incorrect ording for the\n  'u', 'v', and 'w' cartesian coordinates. [#6330]\n\n- The ``astropy.coordinates.search_around_sky``,\n  ``astropy.coordinates.search_around_3d``, and ``SkyCoord`` equivalent methods\n  now correctly yield an ``astropy.coordinates.Angle`` as the third return type\n  even if there are no matches (previously it returned a raw Quantity). [#6347]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fix an issue where the fast C-reader was dropping table comments for a\n  table with no data lines. [#8274]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- ``comments`` meta key (which is ``io.ascii``'s table convention) is output\n  to ``COMMENT`` instead of ``COMMENTS`` header. Similarly, ``COMMENT``\n  headers are read into ``comments`` meta [#6097]\n\n- Use more sensible fix values for invalid NAXISj header values. [#5935]\n\n- Close file on error to avoid creating a ``ResourceWarning`` warning\n  about an unclosed file. [#6168, #6177]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Creating a compound model where one of the submodels is\n  a compound model whose parameters were changed now uses the\n  updated parameters and not the parameters of the original model. [#5741]\n\n- Allow ``Mapping`` and ``Identity`` to be fittable. [#6018]\n\n- Gaussian models now impose positive ``stddev`` in fitting. [#6019]\n\n- OrthoPolynomialBase (Chebyshev2D / Legendre2D) models were being evaluated\n  incorrectly when part of a compound model (using the parameters from the\n  original model), which in turn caused fitting to fail as a no-op. [#6085]\n\n- Allow ``Ring2D`` to be defined using ``r_out``. [#6192]\n\n- Make ``LinearLSQFitter`` produce correct results with fixed model\n  parameters and allow ``Shift`` and ``Scale`` to be fitted with\n  ``LinearLSQFitter`` and ``LevMarLSQFitter``. [#6174]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Allow to choose which median function is used in ``mad_std`` and\n  ``median_absolute_deviation``. And allow to use these functions with\n  a multi-dimensional ``axis``. [#5835]\n\n- Fixed ``biweight_midvariance`` so that by default it returns a\n  variance that agrees with the standard definition. [#5991]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix a problem with vstack for bytes columns in Python 3. [#5628]\n\n- Fix QTable add/insert row for multidimensional Quantity. [#6092]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Fixed the initial condition of ``TimeFITS`` to allow scale, FITS scale\n  and FITS realization to be checked and equated properly. [#6202]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug that caused the default WCS to return coordinates offset by\n  one. [#6339]\n\nastropy.vo\n^^^^^^^^^^\n\n- Fixed a bug in vo.samp when stopping a hub for which a lockfile was\n  not created. [#6211]\n\n\nOther Changes and Additions\n---------------------------\n\n- Numpy 1.7 and 1.8 are no longer supported. [#6006]\n\n- Python 3.3 is no longer supported. [#6020]\n\n- The bundled ERFA was updated to version 1.4.0. [#6239]\n\n- The bundled version of pytest has now been removed, but the\n  astropy.tests.helper.pytest import will continue to work properly.\n  Affiliated packages should nevertheless transition to importing pytest\n  directly rather than from astropy.tests.helper. This also means that\n  pytest is now a formal requirement for testing for both Astropy and\n  for affiliated packages. [#5694]\n\n\n1.3.3 (2017-05-29)\n==================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug where ``StaticMatrixTransform`` erroneously copied frame\n  attributes from the input coordinate to the output frame. In practice, this\n  didn't actually affect any transforms in Astropy but may change behavior for\n  users who explicitly used the ``StaticMatrixTransform`` in their own code.\n  [#6045]\n\n- Fixed ``get_icrs_coordinates`` to loop through all the urls in case one\n  raises an exception. [#5864]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fix table header not written out properly when ``fits.writeto()``\n  convenience function is used. [#6042]\n\n- Fix writing out read-only arrays. [#6036]\n\n- Extension headers are written out properly when the ``fits.update()``\n  convenience function is used. [#6058]\n\n- Angstrom, erg, G, and barn are no more reported as deprecated FITS units.\n  [#5929]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix problem with Table pprint/pformat raising an exception for\n  non-UTF-8 compliant bytestring data. [#6117]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Allow strings 'nan' and 'inf' as Quantity inputs. [#5958]\n\n- Add support for ``positive`` and ``divmod`` ufuncs (new in numpy 1.13).\n  [#5998, #6020, #6116]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- On systems that do not have ``pkg_resources`` non-numerical additions to\n  version numbers like ``dev`` or ``rc1`` are stripped in ``minversion`` to\n  avoid a ``TypeError`` in ``distutils.version.LooseVersion`` [#5944]\n\n- Fix ``auto_download`` setting ignored in ``Time.ut1``. [#6033]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Fix bug in ManualInterval which caused the limits to be returned incorrectly\n  if set to zero, and fix defaults for ManualInterval in the presence of NaNs.\n  [#6088]\n\n- Get rid of warnings that occurred when slicing a cube due to the tick\n  locator trying to find ticks for the sliced axis. [#6104]\n\n- Accept normal Matplotlib keyword arguments in set_xlabel and set_ylabel\n  functions. [#5686, #5692, #6060]\n\n- Fix a bug that caused labels to be missing from frames with labels that\n  could change direction mid-axis, such as EllipticalFrame. Also ensure\n  that empty tick labels do not cause any warnings. [#6063]\n\n\n1.3.2 (2017-03-30)\n==================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Ensure that checking equivalence of ``SkyCoord`` objects works with\n  non-scalar attributes [#5884, #5887]\n\n- Ensure that transformation to frames with multi-dimensional attributes\n  works as expected [#5890, #5897]\n\n- Make sure all ``BaseRepresentation`` objects can be output as strings.\n  [#5889, #5897]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Add support for ``heaviside`` ufunc (new in numpy 1.13). [#5920]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Fix to allow the C-based _fast_iterparse() VOTable XML parser to\n  relloc() its buffers instead of overflowing them. [#5824, #5869]\n\n\nOther Changes and Additions\n---------------------------\n\n- File permissions are revised in the released source distribution. [#5912]\n\n\n1.3.1 (2017-03-18)\n==================\n\nNew Features\n------------\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- The ``deprecated_renamed_argument`` decorator got a new ``pending``\n  parameter to suppress the deprecation warnings. [#5761]\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Changed ``SkyCoord`` so that frame attributes which are not valid for the\n  current ``frame`` (but are valid for other frames) are stored on the\n  ``SkyCoord`` instance instead of the underlying ``frame`` instance (e.g.,\n  setting ``relative_humidity`` on an ICRS ``SkyCoord`` instance.) [#5750]\n\n- Ensured that ``position_angle`` and ``separation`` give correct answers for\n  frames with different equinox (see #5722). [#5762]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fix problem with padding bytes written for BinTable columns converted\n  from unicode [#5280, #5287, #5288, #5296].\n\n- Fix out-of-order TUNITn cards when writing tables to FITS. [#5720]\n\n- Recognize PrimaryHDU when non boolean values are present for the\n  'GROUPS' header keyword. [#5808]\n\n- Fix the insertion of new keywords in compressed image headers\n  (``CompImageHeader``). [#5866]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed a problem with setting ``bounding_box`` on 1D models. [#5718]\n\n- Fixed a broadcasting problem with weighted fitting of 2D models\n  with ``LevMarLSQFitter``. [#5788]\n\n- Fixed a problem with passing kwargs to fitters, specifically ``verblevel``. [#5815]\n\n- Changed FittingWithOutlierRemoval to reject on the residual to the fit [#5831]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Fix the psd normalization for Lomb-Scargle periodograms in the presence\n  of noise. [#5713]\n\n- Fix bug in the autofrequency range when ``minimum_frequency`` is specified\n  but ``maximum_frequency`` is not. [#5738]\n\n- Ensure that a masked array is returned when sigma clipping fully masked\n  data. [#5711]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix problem where key for caching column format function was not\n  sufficiently unique. [#5803]\n\n- Handle sorting NaNs and masked values in jsviewer. [#4052, #5572]\n\n- Ensure mixin columns can be added to a table using a scalar value for the\n  right-hand side if the type supports broadcasting. E.g., for an existing\n  ``QTable``, ``t['q'] = 3*u.m`` will now add a column as expected. [#5820]\n\n- Fixes the bug of setting/getting values from rows/columns of a table using\n  numpy array scalars. [#5772]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Fixed problem where IrreducibleUnits could fail to unpickle. [#5868]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Avoid importing ``ipython`` in ``utils.console`` until it is necessary, to\n  prevent deprecation warnings when importing, e.g., ``Column``. [#5755]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Avoid importing matplotlib.pyplot when importing\n  astropy.visualization.wcsaxes. [#5680, #5684]\n\n- Ignore Numpy warnings that happen in coordinate transforms in WCSAxes.\n  [#5792]\n\n- Fix compatibility issues between WCSAxes and Matplotlib 2.x. [#5786]\n\n- Fix a bug that caused WCSAxes frame visual properties to not be copied\n  over when resetting the WCS. [#5791]\n\nastropy.extern\n^^^^^^^^^^^^^^\n\n- Fixed a bug where PLY was overwriting its generated files. [#5728]\n\nOther Changes and Additions\n---------------------------\n\n- Fixed a deprecation warning that occurred when running tests with\n  astropy.test(). [#5689]\n\n- The deprecation of the ``clobber`` argument (originally deprecated in 1.3.0)\n  in the ``io.fits`` write functions was changed to a \"pending\" deprecation\n  (without displaying warnings) for now. [#5761]\n\n- Updated bundled astropy-helpers to v1.3.1. [#5880]\n\n\n1.3 (2016-12-22)\n================\n\nNew Features\n------------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- The ``convolve`` and ``convolve_fft`` arguments now support a ``mask`` keyword,\n  which allows them to also support ``NDData`` objects as inputs. [#5554]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Added an ``of_address`` classmethod to ``EarthLocation`` to enable fast creation of\n  ``EarthLocation`` objects given an address by querying the Google maps API [#5154].\n\n- A new routine, ``get_body_barycentric_posvel`` has been added that allows\n  one to calculate positions as well as velocities for solar system bodies.\n  For JPL kernels, this roughly doubles the execution time, so if one requires\n  only the positions, one should use ``get_body_barycentric``. [#5231]\n\n- Transformations between coordinate systems can use the more accurate JPL\n  ephemerides. [#5273, #5436]\n\n- Arithmetic on representations, such as addition of two representations,\n  multiplication with a ``Quantity``, or calculating the norm via ``abs``,\n  has now become possible. Furthermore, there are new methods ``mean``,\n  ``sum``, ``dot``, and ``cross``. For all these, the representations are\n  treated as vectors in cartesian space (temporarily converting to\n  ``CartesianRepresentation`` if necessary).  [#5301]\n  has now become possible. Furthermore, there are news methods ``mean``,\n  ``sum``, ``dot``, and ``cross`` with obvious meaning. [#5301]\n  multiplication with a ``Quantity`` has now become possible. Furthermore,\n  there are new methods ``norm``, ``mean``, ``sum``, ``dot``, and ``cross``.\n  In all operations, the representations are treated as vectors. They are\n  temporarily converted to ``CartesianRepresentation`` if necessary.  [#5301]\n\n- ``CartesianRepresentation`` can be initialized with plain arrays by passing\n  in a ``unit``. Furthermore, for input with a vector array, the coordinates\n  no longer have to be in the first dimension, but can be at any ``xyz_axis``.\n  To complement the latter, a new ``get_xyz(xyz_axis)`` method allows one to\n  get a vector array out along a given axis. [#5439]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Files with \"Fortran-style\" columns (i.e. double-precision scientific notation\n  with a character other than \"e\", like ``1.495978707D+13``) can now be parsed by\n  the fast reader natively. [#5552]\n\n- Allow round-tripping masked data tables in most formats by using an\n  empty string ``''`` as the default representation of masked values\n  when writing. [#5347]\n\n- Allow reading HTML tables with unicode column values in Python 2.7. [#5410]\n\n- Check for self-consistency of ECSV header column names. [#5463]\n\n- Produce warnings when writing an IPAC table from an astropy table that\n  contains metadata not supported by the IPAC format. [#4700]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- \"Lazy\" loading of HDUs now occurs - when an HDU is requested, the file is\n  only read up to the point where that HDU is found.  This can mean a\n  substantial speedup when accessing files that have many HDUs. [#5065]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Added ``io.misc.yaml`` module to support serializing core astropy objects\n  using the YAML protocol. [#5486]\n\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\n- Added ``delay_doc_updates`` contextmanager to postpone the formatting of\n  the documentation for the ``read`` and ``write`` methods of the class to\n  optionally reduce the import time. [#5275]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Added a class to combine astropy fitters and functions to remove outliers\n  e. g., sigma clip. [#4760]\n\n- Added a ``Tabular`` model. [#5105]\n\n- Added ``Hermite1D`` and ``Hermite2D`` polynomial models [#5242]\n\n- Added the injection of EntryPoints into astropy.modeling.fitting if\n  they inherit from Fitters class. [#5241]\n\n- Added bounding box to ``Lorentz1D`` and ``MexicanHat1D`` models. [#5393]\n\n- Added ``Planar2D`` functional model. [#5456]\n\n- Updated ``Gaussian2D`` to accept no arguments (will use default x/y_stddev\n  and theta). [#5537]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Added ``keep`` and ``**kwargs`` parameter to ``support_nddata``. [#5477]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Added ``axis`` keyword to ``biweight_location`` and\n  ``biweight_midvariance``. [#5127, #5158]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Allow renaming mixin columns. [#5469]\n\n- Support generalized value formatting for mixin columns in tables. [#5274]\n\n- Support persistence of table indices when pickling and copying table. [#5468]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- Install both runtime and test dependencies when running the\n  ./setup.py test command. These dependencies are specified by the\n  install_requires and tests_require keywords via setuptools. [#5092]\n\n- Enable easier subclassing of the TestRunner class. [#5505]\n\nastropy.time\n^^^^^^^^^^^^\n\n- ``light_travel_time`` can now use more accurate JPL ephemerides. [#5273, #5436]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Added ``pixel_scale`` and ``plate_scale`` equivalencies. [#4987]\n\n- The ``spectral_density`` equivalency now supports transformations of\n  luminosity density. [#5151]\n\n- ``Quantity`` now accepts strings consisting of a number and unit such\n  as '10 km/s'. [#5245]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Added a new decorator: ``deprecated_renamed_argument``. This can be used to\n  rename a function argument, while it still allows for the use of the older\n  argument name. [#5214]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Added a ``make_lupton_rgb`` function to generate color images from three\n  greyscale images, following the algorithm of Lupton et al. (2004). [#5535]\n\n- Added ``data`` and ``interval`` inputs to the ``ImageNormalize``\n  class. [#5206]\n\n- Added a new ``simple_norm`` convenience function. [#5206]\n\n- Added a default stretch for the ``Normalization`` class. [#5206].\n\n- Added a default ``vmin/vmax`` for the ``ManualInterval`` class.\n  [#5206].\n\n- The ``wcsaxes`` subpackage has now been integrated in astropy as\n  ``astropy.visualization.wcsaxes``.  This allows plotting of astronomical\n  data/coordinate systems in Matplotlib. [#5496]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Improved ``footprint_to_file``: allow to specify the coordinate system, and\n  use by default the one from ``RADESYS``. Overwrite the file instead of\n  appending to it. [#5494]\n\n\nAPI Changes\n-----------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- ``discretize_model`` now raises an exception if non-integer ranges are used.\n  Previously it had incorrect behavior but did not raise an exception. [#5538]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- ``SkyCoord``, ``ICRS``, and other coordinate objects, as well as the\n  underlying representations such as ``SphericalRepresentation`` and\n  ``CartesianRepresentation`` can now be reshaped using methods named like the\n  numpy ones for ``ndarray`` (``reshape``, ``swapaxes``, etc.)\n  [#4123, #5254, #5482]\n\n- The ``obsgeoloc`` and ``obsgeovel`` attributes of ``GCRS`` and\n  ``PrecessedGeocentric`` frames are now stored and returned as\n  ``CartesianRepresentation`` objects, rather than ``Quantity`` objects.\n  Similarly, ``EarthLocation.get_gcrs_posvel`` now returns a tuple of\n  ``CartesianRepresentation`` objects. [#5253]\n\n- ``search_around_3d`` and ``search_around_sky`` now return units\n  for the distance matching their input argument when no match is\n  found, instead of ``dimensionless_unscaled``. [#5528]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- ASCII writers now accept an 'overwrite' argument.\n  The default behavior is changed so that a warning will be\n  issued when overwriting an existing file unless ``overwrite=True``.\n  In a future version this will be changed from a warning to an\n  exception to prevent accidentally overwriting a file. [#5007]\n\n- The default representation of masked values when writing tables was\n  changed from ``'--'`` to the empty string ``''``.  Previously any\n  user-supplied ``fill_values`` parameter would overwrite the class\n  default, but now the values are prepended to the class default. [#5347]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- The old ``Header`` interface, deprecated since Astropy 0.1 (PyFITS 3.1), has\n  been removed entirely. See :ref:`header-transition-guide` for explanations\n  on this change and help on the transition. [#5310]\n\n- The following functions, classes and methods have been removed:\n  ``CardList``, ``Card.key``, ``Card.cardimage``, ``Card.ascardimage``,\n  ``create_card``, ``create_card_from_string``, ``upper_key``,\n  ``Header.ascard``, ``Header.rename_key``, ``Header.get_history``,\n  ``Header.get_comment``, ``Header.toTxtFile``, ``Header.fromTxtFile``,\n  ``new_table``, ``tdump``, ``tcreate``, ``BinTableHDU.tdump``,\n  ``BinTableHDU.tcreate``.\n\n- Removed ``txtfile`` argument to the ``Header`` constructor.\n\n- Removed usage of ``Header.update`` with ``Header.update(keyword, value,\n  comment)`` arguments.\n\n- Removed ``startColumn`` and ``endColumn`` arguments to the ``FITS_record``\n  constructor.\n\n- The ``clobber`` argument in FITS writers has been renamed to\n  ``overwrite``. This change affects the following functions and\n  methods: ``tabledump``, ``writeto``, ``Header.tofile``,\n  ``Header.totextfile``, ``_BaseDiff.report``,\n  ``_BaseHDU.overwrite``, ``BinTableHDU.dump`` and\n  ``HDUList.writeto``. [#5171]\n\n- Added an optional ``copy`` parameter to ``fits.Header`` which controls if\n  a copy is made when creating an ``Header`` from another ``Header``.\n  [#5005, #5326]\n\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\n- ``.fts`` and ``.fts.gz`` files will be automatically identified as\n  ``io.fits`` files if no explicit ``format`` is given. [#5211]\n\n- Added an optional ``readwrite`` parameter for ``get_formats`` to filter\n  formats for read or write. [#5275]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- ``Gaussian2D`` now raises an error if ``theta`` is set at the same time as\n  ``cov_matrix`` (previously ``theta`` was silently ignored). [#5537]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Setting an existing table column (e.g. ``t['a'] = [1, 2, 3]``) now defaults\n  to *replacing* the column with a column corresponding to the new value\n  (using ``t.replace_column()``) instead of doing an in-place update.  Any\n  existing meta-data in the column (e.g. the unit) is discarded.  An\n  in-place update is still done when the new value is not a valid column,\n  e.g. ``t['a'] = 0``.  To force an in-place update use the pattern\n  ``t['a'][:] = [1, 2, 3]``. [#5556]\n\n- Allow ``collections.Mapping``-like ``data`` attribute when initializing a\n  ``Table`` object (``dict``-like was already possible). [#5213]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- The inputs to the ``TestRunner.run_tests()`` method now must be\n  keyword arguments (no positional arguments).  This applies to the\n  ``astropy.test()`` function as well. [#5505]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Renamed ``ignored`` context manager in ``compat.misc`` to ``suppress``\n  to be consistent with https://bugs.python.org/issue19266 . [#5003]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Deprecated the ``scale_image`` function. [#5206]\n\n- The ``mpl_normalize`` module (containing the ``ImageNormalize``\n  class) is now automatically imported with the ``visualization``\n  subpackage. [#5491]\n\nastropy.vo\n^^^^^^^^^^\n\n- The ``clobber`` argument in ``VOSDatabase.to_json()`` has been\n  renamed to ``overwrite``. [#5171]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- ``wcs.rotateCD()`` was deprecated without a replacement. [#5240]\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Transformations between CIRS and AltAz now correctly account for the\n  location of the observer. [#5591]\n\n- GCRS frames representing a location on Earth with multiple obstimes are now\n  allowed. This means that the solar system routines ``get_body``,\n  ``get_moon`` and ``get_sun`` now work with non-scalar times and a\n  non-geocentric observer. [#5253]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fix issue with units or other astropy core classes stored in table meta.\n  [#5605]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Copying a ``fits.Header`` using ``copy`` or ``deepcopy`` from the ``copy``\n  module will use ``Header.copy`` to ensure that modifying the copy will\n  not alter the other original Header and vice-versa. [#4990, #5323]\n\n- ``HDUList.info()`` no longer raises ``AttributeError`` in presence of\n  ``BZERO``. [#5508]\n\n- Avoid exceptions with numpy 1.10 and up when using scaled integer data\n  where ``BZERO`` has float type but integer value. [#4639, #5527]\n\n- Converting a header card to a string now calls ``self.verify('fix+warn')``\n  instead of ``self.verify('fix')`` so headers with invalid keywords will\n  not raise a ``VerifyError`` on printing. [#887,#5054]\n\n- ``FITS_Record._convert_ascii`` now converts blank fields to 0 when a\n  non-blank null column value is set. [#5134, #5394]\n\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\n- ``read`` now correctly raises an IOError if a file with an unknown\n  extension can't be found, instead of raising IORegistryError:\n  \"Format could not be identified.\" [#4779]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Ensure ``Time`` instances holding a single ``delta_ut1_utc`` can be copied,\n  flattened, etc. [#5225]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Operations involving ``Angle`` or ``Distance``, or any other\n  ``SpecificTypeQuantity`` instance, now also keep return an instance of the\n  same type if the instance was the second argument (if the resulting unit\n  is consistent with the specific type). [#5327]\n\n- Inplace operations on ``Angle`` and ``Distance`` instances now raise an\n  exception if the final unit is not equivalent to radian and meter, resp.\n  Similarly, views as ``Angle`` and ``Distance`` can now only be taken\n  from quantities with appropriate units, and views as ``Quantity`` can only\n  be taken from logarithmic quanties such as ``Magnitude`` if the physical\n  unit is dimensionless. [#5070]\n\n- Conversion from quantities to logarithmic units now correctly causes a\n  logarithmic quantity such as ``Magnitude`` to be returned. [#5183]\n\n\nastropy.wcs\n^^^^^^^^^^^\n\n- SIP distortion for an alternate WCS is correctly initialized now by\n  looking at the \"CTYPE\" values matching the alternate WCS. [#5443]\n\nOther Changes and Additions\n---------------------------\n\n- The bundled ERFA was updated to version 1.3.0.  This includes the\n  leap second planned for 2016 Dec 31.\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Initialization of ``Angle`` has been sped up for ``Quantity`` and ``Angle``\n  input. [#4970]\n\n- The use of ``np.matrix`` instances in the transformations has been\n  deprecated, since this class does not allow stacks of matrices.  As a\n  result, the semi-public functions ``angles.rotation_matrix`` and\n  ``angles.angle_axis`` are also deprecated, in favour of the new routines\n  with the same name in ``coordinates.matrix_utilities``. [#5104]\n\n- A new ``BaseCoordinateFrame.cache`` dictionary has been created to expose\n  the internal cache. This is useful when modifying representation data\n  in-place without using ``realize_frame``. Additionally, documentation for\n  in-place operations on coordinates were added. [#5575]\n\n- Coordinates and their representations are printed with a slightly different\n  format, following how numpy >= 1.12 prints structured arrays. [#5423]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- The default cosmological model has been changed to Planck 2015,\n  and the citation strings have been updated. [#5372]\n\nastropy.extern\n^^^^^^^^^^^^^^\n\n- Updated the bundled ``six`` module to version 1.10.0. [#5521]\n\n- Updated the astropy shipped version of ``PLY`` to version 3.9. [#5526]\n\n- Updated the astropy shipped version of jQuery to v3.3.1, and dataTables\n  to v1.10.12. [#5564]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Performance improvements for tables with many columns. [#4985]\n\n- Removed obsolete code that was previously needed to properly\n  implement the append mode. [#4793]\n\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\n- Reduced the time spent in the ``get_formats`` function. This also reduces\n  the time it takes to import astropy subpackages, i.e.\n  ``astropy.coordinates``. [#5262]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- The functions ``add_enabled_units``, ``set_enabled_equivalencies`` and\n  ``add_enabled_equivalencies`` have been sped up by copying the current\n  ``_UnitRegistry`` instead of building it from scratch. [#5306]\n\n- To build the documentation, the ``build_sphinx`` command has been deprecated\n  in favor of ``build_docs``. [#5179]\n\n- The ``--remote-data`` option to ``python setup.py test`` can now take\n  different arguments: ``--remote-data=none`` is the same as not specifying\n  ``--remote-data`` (skip all tests that require the internet),\n  ``--remote-data=astropy`` skips all tests that need remote data except those\n  that require only data from data.astropy.org, and ``--remote-data=any`` is\n  the same as ``--remote-data`` (run all tests that use remote data). [#5506]\n\n- The pytest ``recwarn`` fixture has been removed from the tests in favor of\n  ``utils.catch_warnings``. [#5489]\n\n- Deprecated escape sequences in strings (Python 3.6) have been removed. [#5489]\n\n\n1.2.2 (2016-12-22)\n==================\n\nBug Fixes\n---------\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fix a bug where the ``fill_values`` parameter was ignored when writing a\n  table to HTML format. [#5379]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Handle unicode FITS BinTable column names on Python 2 [#5204, #4805]\n\n- Fix reading of float values from ASCII tables, that could be read as\n  float32 instead of float64 (with the E and F formats). These values are now\n  always read as float64. [#5362]\n\n- Fixed memoryleak when using the compression module. [#5399, #5464]\n\n- Able to insert and remove lower case HIERARCH keywords in a consistent\n  manner [#5313, #5321]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Fixed broadcasting in ``sigma_clip`` when using negative ``axis``. [#4988]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Assigning a logarithmic unit to a ``QTable`` column that did not have a\n  unit yet now correctly turns it into the appropriate function quantity\n  subclass (such as ``Magnitude`` or ``Dex``). [#5345]\n\n- Fix default value for ``show_row_index`` in ``Table.show_in_browser``.\n  [#5562]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- For inverse trig functions that operate on quantities, catch any warnings\n  that occur from evaluating the function on the unscaled quantity value\n  between __array_prepare__ and __array_wrap__. [#5153]\n\n- Ensure ``!=`` also works for function units such as ``MagUnit`` [#5345]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Fix use of the ``relax`` keyword in ``to_header`` when used to change the\n  output precision. [#5164]\n\n- ``wcs.to_header(relax=True)`` adds a \"-SIP\" suffix to ``CTYPE`` when SIP\n  distortion is present in the WCS object. [#5239]\n\n- Improved log messages in ``to_header``. [#5239]\n\nOther Changes and Additions\n---------------------------\n\n- The bundled ERFA was updated to version 1.3.0.  This includes the\n  leap second planned for 2016 Dec 31.\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- ``poisson_conf_interval`` with ``'kraft-burrows-nousek'`` interval is now\n  faster and usable with SciPy versions < 0.14. [#5064, #5290]\n\n\n\n1.2.1 (2016-06-22)\n==================\n\nBug Fixes\n---------\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fixed a bug that caused TFIELDS to not be in the correct position in\n  compressed image HDU headers under certain circumstances, which created\n  invalid FITS files. [#5118, #5125]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Fixed an  ``ImportError`` that occurred whenever ``astropy.constants`` was\n  imported before ``astropy.units``. [#5030, #5121]\n\n- Magnitude zero points used to define ``STmag``, ``ABmag``, ``M_bol`` and\n  ``m_bol`` are now collected in ``astropy.units.magnitude_zero_points``.\n  They are not enabled as regular units by default, but can be included\n  using ``astropy.units.magnitude_zero_points.enable()``. This makes it\n  possible to round-trip magnitudes as originally intended.  [#5030]\n\n1.2 (2016-06-19)\n================\n\nGeneral\n-------\n\n- Astropy now requires Numpy 1.7.0 or later. [#4784]\n\nNew Features\n------------\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\n- Add ``L_bol0``, the luminosity corresponding to absolute bolometric\n  magnitude zero. [#4262]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- ``CartesianRepresentation`` now includes a transform() method that can take\n  a 3x3 matrix to transform coordinates. [#4860]\n\n- Solar system and lunar ephemerides accessible via ``get_body``,\n  ``get_body_barycentric`` and ``get_moon`` functions. [#4890]\n\n- Added astrometric frames (i.e., a frame centered on a particular\n  point/object specified in another frame). [#4909, #4941]\n\n- Added ``SkyCoord.spherical_offsets_to`` method. [#4338]\n\n- Recent Earth rotation (IERS) data are now auto-downloaded so that AltAz\n  transformations for future dates now use the most accurate available\n  rotation values. [#4436]\n\n- Add support for heliocentric coordinate frames. [#4314]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- ``angular_diameter_distance_z1z2`` now supports the computation of\n  the angular diameter distance between a scalar and an array like\n  argument. [#4593] The method now supports models with negative\n  Omega_k0 (positive curvature universes) [#4661] and allows z2 < z1.\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- File name could be passed as ``Path`` object. [#4606]\n\n- Check that columns in ``formats`` specifier exist in the output table\n  when writing. [#4508, #4511]\n\n- Allow trailing whitespace in the IPAC header lines. [#4758]\n\n- Updated to filter out the default parser warning of BeautifulSoup.\n  [#4551]\n\n- Added support for reading and writing reStructuredText simple tables.\n  [#4812]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- File name could be passed as ``Path`` object. [#4606]\n\n- Header allows a dictionary-like cards argument during creation. [#4663]\n\n- New function ``convenience.table_to_hdu`` to allow creating a FITS\n  HDU object directly from an astropy ``Table``. [#4778]\n\n- New optional arguments ``ignore_missing`` and ``remove_all`` are added\n  to ``astropy.io.fits.header.remove()``. [#5020]\n\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\n- Added custom ``IORegistryError``. [#4833]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- File name could be passed as ``Path`` object. [#4606]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Added the fittable=True attribute to the Scale and Shift models with tests. [#4718]\n\n- Added example plots to docstrings for some built-in models. [#4008]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- ``UnknownUncertainty`` new subclass of ``NDUncertainty`` that can be used to\n  save uncertainties that cannot be used for error propagation. [#4272]\n\n- ``NDArithmeticMixin``: ``add``, ``subtract``, ``multiply`` and ``divide``\n  can be used as classmethods but require that two operands are given. These\n  operands don't need to be NDData instances but they must be convertible to\n  NDData. This conversion is done internally. Using it on the instance does\n  not require (but also allows) two operands. [#4272, #4851]\n\n- ``NDDataRef`` new subclass that implements ``NDData`` together with all\n  currently available mixins. This class does not implement additional\n  attributes, methods or a numpy.ndarray-like interface like ``NDDataArray``.\n  attributes, methods or a numpy.ndarray-like interface like ``NDDataArray``.\n  [#4797]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Added ``axis`` keyword for ``mad_std`` function. [#4688, #4689]\n\n- Added Bayesian and Akaike Information Criteria. [#4716]\n\n- Added Bayesian upper limits for Poisson count rates. [#4622]\n\n- Added ``circstats``; a module for computing circular statistics. [#3705, #4472]\n\n- Added ``jackknife`` resampling method. [#3708, #4439]\n\n- Updated ``bootstrap`` to allow bootstrapping statistics with multiple\n  outputs. [#3601]\n\n- Added ``LombScargle`` class to compute Lomb-Scargle periodograms [#4811]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- ``Table.show_in_notebook`` and ``Table.show_in_browser(jsviewer=True)`` now\n  yield tables with an \"idx\" column, allowing easy identification of the index\n  of a row even when the table is re-sorted in the browser. [#4404]\n\n- Added ``AttributeError`` when trying to set mask on non-masked table. [#4637]\n\n- Allow to use a tuple of keys in ``Table.sort``.  [#4671]\n\n- Added ``itercols``; a way to iterate through columns of a table. [#3805,\n  #4888]\n\n- ``Table.show_in_notebook`` and the default notebook display (i.e.,\n  ``Table._repr_html_``) now use consistent table styles which can be set\n  using the ``astropy.table.default_notebook_table_class`` configuration\n  item. [#4886]\n\n- Added interface to create ``Table`` directly from any table-like object\n  that has an ``__astropy_table__`` method.  [#4885]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- Enable test runner to obtain documentation source files from directory\n  other than \"docs\". [#4748]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Added caching of scale and format transformations for improved performance.\n  [#4422]\n\n- Recent Earth rotation (IERS) data are now auto-downloaded so that UT1\n  transformations for future times now work out of the box. [#4436]\n\n- Add support for barycentric/heliocentric time corrections. [#4314]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- The option to use tuples to indicate fractional powers of units,\n  deprecated in 0.3.1, has been removed. [#4449]\n\n- Added slug to imperial units. [#4670]\n\n- Added Earth radius (``R_earth``) and Jupiter radius (``R_jup``) to units.\n  [#4818]\n\n- Added a ``represents`` property to allow access to the definition of a\n  named unit (e.g., ``u.kpc.represents`` yields ``1000 pc``). [#4806]\n\n- Add bolometric absolute and apparent magnitudes, ``M_bol`` and ``m_bol``.\n  [#4262]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- ``Path`` object could be passed to ``get_readable_fileobj``. [#4606]\n\n- Implemented a generic and extensible way of merging metadata. [#4459]\n\n- Added ``format_doc`` decorator which allows to replace and/or format the\n  current docstring of an object. [#4242]\n\n- Added a new context manager ``set_locale`` to temporarily set the\n  current locale. [#4363]\n\n- Added new IERS_Auto class to auto-download recent IERS (Earth rotation)\n  data when required by coordinate or time transformations. [#4436]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Add zscale interval based on Numdisplay's implementation. [#4776]\n\nAPI changes\n-----------\n\nastropy.config\n^^^^^^^^^^^^^^\n\n- The deprecated ``ConfigurationItem`` and ``ConfigAlias`` classes and the\n  ``save_config``, ``get_config_items``, and ``generate_all_config_items``\n  functions have now been removed. [#2767, #4446]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Removed compatibility layer for pre-v0.4 API. [#4447]\n\n- Added ``copy`` keyword-only argument to allow initialization without\n  copying the (possibly large) input coordinate arrays. [#4883]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Improve documentation of z validity range of cosmology objects [#4882, #4949]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Add a way to control HTML escaping when writing a table as an HTML file. [#4423]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Two optional boolean arguments ``ignore_missing`` and ``remove_all`` are\n  added to ``Header.remove``. [#5020]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Renamed ``Redshift`` model to ``RedshiftScaleFactor``. [#3672]\n\n- Inputs (``coords`` and ``out``) to ``render`` function in ``Model`` are\n  converted to float. [#4697]\n\n- ``RotateNative2Celestial`` and ``RotateCelestial2Native`` are now\n  implemented as subclasses of ``EulerAngleRotation``. [#4881, #4940]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- ``NDDataBase`` does not set the private uncertainty property anymore. This\n  only affects you if you subclass ``NDDataBase`` directly. [#4270]\n\n- ``NDDataBase``: the ``uncertainty``-setter is removed. A similar one is\n  added in ``NDData`` so this also only affects you if you subclassed\n  ``NDDataBase`` directly. [#4270]\n\n- ``NDDataBase``: ``uncertainty``-getter returns ``None`` instead of the\n  private uncertainty and is now abstract. This getter is moved to\n  ``NDData`` so it only affects direct subclasses of ``NDDataBase``. [#4270]\n\n- ``NDData`` accepts a Quantity-like data and an explicitly given unit.\n  Before a ValueError was raised in this case. The final instance will use the\n  explicitly given unit-attribute but doesn't check if the units are\n  convertible and the data will not be scaled. [#4270]\n\n- ``NDData`` : the given mask, explicit or implicit if the data was masked,\n  will be saved by the setter. It will not be saved directly as the private\n  attribute. [#4879]\n\n- ``NDData`` accepts an additional argument ``copy`` which will copy every\n  parameter before it is saved as attribute of the instance. [#4270]\n\n- ``NDData``: added an ``uncertainty.getter`` that returns the private\n  attribute. It is equivalent to the old ``NDDataBase.uncertainty``-getter.\n  [#4270]\n\n- ``NDData``: added an ``uncertainty.setter``. It is slightly modified with\n  respect to the old ``NDDataBase.uncertainty``-setter. The changes include:\n\n- if the uncertainty has no uncertainty_type an info message is printed\n  instead of a TypeError and the uncertainty is saved as\n  ``UnknownUncertainty`` except the uncertainty is None. [#4270]\n\n- the requirement that the uncertainty_type of the uncertainty needs to be a\n  string was removed. [#4270]\n\n- if the uncertainty is a subclass of NDUncertainty the parent_nddata\n  attribute will be set so the uncertainty knows to which data it belongs.\n  This is also a Bugfix. [#4152, #4270]\n\n- ``NDData``: added a ``meta``-getter, which will set and return an empty\n  OrderedDict if no meta was previously set. [#4509, #4469]\n\n- ``NDData``: added an ``meta``-setter. It requires that the meta is\n  dictionary-like (it also accepts Headers or ordered dictionaries and others)\n  or None. [#4509, #4469, #4921]\n\n- ``NDArithmeticMixin``: The operand in arithmetic methods (``add``, ...)\n  doesn't need to be a subclass of ``NDData``. It is sufficient if it can be\n  converted to one. This conversion is done internally. [#4272]\n\n- ``NDArithmeticMixin``: The arithmetic methods allow several new arguments to\n  control how or if different attributes of the class will be processed during\n  the operation. [#4272]\n\n- ``NDArithmeticMixin``: Giving the parameter ``propagate_uncertainties`` as\n  positional keyword is deprecated and will be removed in the future. You now\n  need to specify it as keyword-parameter. Besides ``True`` and ``False`` also\n  ``None`` is now a valid value for this parameter. [#4272, #4851]\n\n- ``NDArithmeticMixin``: The wcs attribute of the operands is not compared and\n  thus raises no ValueError if they differ, except if a ``compare_wcs``\n  parameter is specified. [#4272]\n\n- ``NDArithmeticMixin``: The arithmetic operation was split from a general\n  ``_arithmetic`` method to different specialized private methods to allow\n  subclasses more control on how the attributes are processed without\n  overriding ``_arithmetic``. The ``_arithmetic`` method is now used to call\n  these other methods. [#4272]\n\n- ``NDSlicingMixin``: If the attempt at slicing the mask, wcs or uncertainty\n  fails with a ``TypeError`` a Warning is issued instead of the TypeError. [#4271]\n\n- ``NDUncertainty``: ``support_correlated`` attribute is deprecated in favor of\n  ``supports_correlated`` which is a property. Also affects\n  ``StdDevUncertainty``. [#4272]\n\n- ``NDUncertainty``: added the ``__init__`` that was previously implemented in\n  ``StdDevUncertainty`` and takes an additional ``unit`` parameter. [#4272]\n\n- ``NDUncertainty``: added a ``unit`` property without setter that returns the\n  set unit or if not set the unit of the parent. [#4272]\n\n- ``NDUncertainty``: included a ``parent_nddata`` property similar to the one\n  previously implemented in StdDevUncertainty. [#4272]\n\n- ``NDUncertainty``: added an ``array`` property with setter. The setter will\n  convert the value to a plain numpy array if it is a list or a subclass of a\n  numpy array. [#4272]\n\n- ``NDUncertainty``: ``propagate_multiply`` and similar were removed. Before\n  they were abstract properties and replaced by methods with the same name but\n  with a leading underscore. The entry point for propagation is a method\n  called ``propagate``. [#4272]\n\n- ``NDUncertainty`` and subclasses: implement a representation (``__repr__``).\n  [#4787]\n\n- ``StdDevUncertainty``: error propagation allows an explicitly given\n  correlation factor, which may be a scalar or an array which will be taken\n  into account during propagation.\n  This correlation must be determined manually and is not done by the\n  uncertainty! [#4272]\n\n- ``StdDevUncertainty``: the ``array`` is converted to a plain numpy array\n  only if it's a list or a subclass of numpy.ndarray. Previously it was always\n  cast to a numpy array but also allowed subclasses. [#4272]\n\n- ``StdDevUncertainty``: setting the ``parent_nddata`` does not compare if the\n  shape of it's array is identical to the parents data shape. [#4272]\n\n- ``StdDevUncertainty``: the ``array.setter`` doesn't compare if the array has\n  the same shape as the parents data. [#4272]\n\n- ``StdDevUncertainty``: deprecated ``support_correlated`` in favor of\n  ``supports_correlated``. [#4272, #4828]\n\n- ``StdDevUncertainty``: deprecated ``propagate_add`` and similar methods in\n  favor of ``propagate``. [#4272, #4828]\n\n- Allow ``data`` to be a named argument in ``NDDataArray``. [#4626]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- ``operations.unique`` now has a ``keep`` parameter, which allows\n  one to select whether to keep the first or last row in a set of\n  duplicate rows, or to remove all rows that are duplicates. [#4632]\n\n- ``QTable`` now behaves more consistently by making columns act as a\n  ``Quantity`` even if they are assigned a unit after the table is\n  created. [#4497, #4884]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Remove deprecated ``register`` argument for Unit classes. [#4448]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- The astropy.utils.compat.argparse module has now been deprecated. Use the\n  Python 'argparse' module directly instead. [#4462]\n\n- The astropy.utils.compat.odict module has now been deprecated. Use the\n  Python 'collections' module directly instead. [#4466]\n\n- The astropy.utils.compat.gzip module has now been deprecated. Use the\n  Python 'gzip' module directly instead. [#4464]\n\n- The deprecated ``ScienceStateAlias`` class has been removed. [#2767, #4446]\n\n- The astropy.utils.compat.subprocess module has now been deprecated. Use the\n  Python 'subprocess' module instead. [#4483]\n\n- The astropy.utils.xml.unescaper module now also unescapes ``'%2F'`` to\n  ``'/'`` and ``'&&'`` to ``'&'`` in a given URL. [#4699]\n\n- The astropy.utils.metadata.MetaData descriptor has now two optional\n  parameters: doc and copy. [#4921]\n\n- The default IERS (Earth rotation) data now is now auto-downloaded via a\n  new class IERS_Auto.  When extrapolating UT1-UTC or polar motion values\n  outside the available time range, the values are now clipped at the last\n  available value instead of being linearly extrapolated. [#4436]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- WCS objects can now be initialized with an ImageHDU or\n  PrimaryHDU object. [#4493, #4505]\n\n- astropy.wcs now issues an INFO message when the header has SIP coefficients but\n  \"-SIP\" is missing from CTYPE. [#4814]\n\nBug fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Ameliorate a problem with ``get_sun`` not round-tripping due to\n  approximations in the light deflection calculation. [#4952]\n\n- Ensure that ``angle_utilities.position_angle`` accepts floats, as stated\n  in the docstring. [#3800]\n\n- Ensured that transformations for ``GCRS`` frames are correct for\n  non-geocentric observers. [#4986]\n\n- Fixed a problem with the ``Quantity._repr_latex_`` method causing errors\n  when showing an ``EarthLocation`` in a Jupyter notebook. [#4542, #5068]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fix a problem where the fast reader (with use_fast_converter=False) can\n  fail on non-US locales. [#4363]\n\n- Fix astropy.io.ascii.read handling of units for IPAC formatted files.\n  Columns with no unit are treated as unitless not dimensionless.\n  [#4867, #4947]\n\n- Fix problems the header parsing in the sextractor reader. [#4603, #4910]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- ``GroupsHDU.is_image`` property is now set to ``False``. [#4742]\n\n- Ensure scaling keywords are removed from header when unsigned integer data\n  is converted to signed type. [#4974, #5053]\n\n- Made TFORMx keyword check more flexible in test of compressed images to\n  enable compatibility of the test with cfitsio 3.380. [#4646, #4653]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- The astropy.io.votable.validator.html module is updated to handle division\n  by zero when generating validation report. [#4699]\n\n- KeyError when converting Table v1.2 numeric arrays fixed. [#4782]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Refactored ``AiryDisk2D``, ``Sersic1D``, and ``Sersic2D`` models\n  to be able to combine them as classes as well as instances. [#4720]\n\n- Modified the \"LevMarLSQFitter\" class to use the weights in the\n  calculation of the Jacobian. [#4751]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- ``NDData`` giving masked_Quantities as data-argument will use the\n  implicitly passed mask, unit and value. [#4270]\n\n- ``NDData`` using a subclass implementing ``NDData`` with\n  ``NDArithmeticMixin`` now allows error propagation. [#4270]\n\n- Fixed memory leak that happened when uncertainty of ``NDDataArray`` was\n  set. [#4825, #4862]\n\n- ``StdDevUncertainty``: During error propagation the unit of the uncertainty\n  is taken into account. [#4272]\n\n- ``NDArithmeticMixin``: ``divide`` and ``multiply`` yield correct\n  uncertainties if only one uncertainty is set. [#4152, #4272]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Fix ``sigma_clipped_stats`` to use the ``axis`` argument. [#4726, #4808]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fixed bug where Tables created from existing Table objects were not\n  inheriting the ``primary_key`` attribute. [#4672, #4930]\n\n- Provide more detail in the error message when reading a table fails due to a\n  problem converting column string values. [#4759]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Exponentiation using a ``Quantity`` with a unit equivalent to dimensionless\n  as base and an ``array``-like exponent yields the correct result. [#4770]\n\n- Ensured that with ``spectral_density`` equivalency one could also convert\n  between ``photlam`` and ``STmag``/``ABmag``. [#5017]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- The astropy.utils.compat.fractions module has now been deprecated. Use the\n  Python 'fractions' module directly instead. [#4463]\n\n- Added ``format_doc`` decorator which allows to replace and/or format the\n  current docstring of an object. [#4242]\n\n- Attributes using the astropy.utils.metadata.MetaData descriptor are now\n  included in the sphinx documentation. [#4921]\n\nastropy.vo\n^^^^^^^^^^\n\n- Relaxed expected accuracy of Cone Search prediction test to reduce spurious\n  failures. [#4382]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- astropy.wcs.to_header removes \"-SIP\" from CTYPE when SIP coefficients\n  are not written out, i.e. ``relax`` is either ``False`` or ``None``.\n  astropy.wcs.to_header appends \"-SIP\" to CTYPE when SIP coefficients\n  are written out, i.e. ``relax=True``. [#4814]\n\n- Made ``wcs.bounds_check`` call ``wcsprm_python2c``, which means it\n  works even if ``wcs.set`` has not been called yet. [#4957, #4966].\n\n- WCS objects can no longer be reverse-indexed, which was technically\n  permitted but incorrectly implemented previously [#4962]\n\nOther Changes and Additions\n---------------------------\n\n- Python 2.6 is no longer supported. [#4486]\n\n- The bundled version of py.test has been updated to 2.8.3. [#4349]\n\n- Reduce Astropy's import time (``import astropy``) by almost a factor 2. [#4649]\n\n- Cython prerequisite for building changed to v0.19 in install.rst [#4705,\n  #4710, #4719]\n\n- All astropy.modeling functionality that was deprecated in Astropy 1.0 has\n  been removed. [#4857]\n\n- Added instructions for installing Astropy into CASA. [#4840]\n\n- Added an example gallery to the docs demonstrating short\n  snippets/examples. [#4734]\n\n\n1.1.2 (2016-03-10)\n==================\n\nNew Features\n------------\n\nastropy.wcs\n^^^^^^^^^^^\n\n- The ``astropy.wcs`` module now exposes ``WCSHDO_P*`` constants that can be\n  used to allow more control over output precision when using the ``relax``\n  keyword argument. [#4616]\n\nBug Fixes\n---------\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fixed handling of CDS data file when no description is given and also\n  included stripping out of markup for missing value from description. [#4437, #4474]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fixed possible segfault during error handling in FITS tile\n  compression. [#4489]\n\n- Fixed crash on pickling of binary table columns with the 'X', 'P', or\n  'Q' format. [#4514]\n\n- Fixed memory / reference leak that could occur when copying a ``FITS_rec``\n  object (the ``.data`` for table HDUs). [#520]\n\n- Fixed a memory / reference leak in ``FITS_rec`` that occurred in a wide\n  range of cases, especially after writing FITS tables to a file, but in\n  other cases as well. [#4539]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fix a bug to allow instantiation of a modeling class having a parameter\n  with a custom setter that takes two parameters ``(value, model)`` [#4656]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fixed bug when replacing a table column with a mixin column like\n  Quantity or Time. [#4601]\n\n- Disable initial ordering in jsviewer (``show_in_browser``,\n  ``show_in_notebook``) to respect the order from the Table. [#4628]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Fixed sphinx issues on plotting quantities. [#4527]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Fixed latex representation of function units. [#4563]\n\n- The ``zest.releaser`` hooks included in Astropy are now injected locally to\n  Astropy, rather than being global. [#4650]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Fixed ``fits2bitmap`` script to allow ext flag to contain extension\n  names or numbers. [#4468]\n\n- Fixed ``fits2bitmap`` default output filename generation for\n  compressed FITS files. [#4468]\n\n- Fixed ``quantity_support`` to ensure its conversion returns ndarray\n  instances (needed for numpy >=1.10). [#4654]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Fixed possible exception in handling of SIP headers that was introduced in\n  v1.1.1. [#4492]\n\n- Fixed a bug that caused WCS objects with a high dynamic range of values for\n  certain parameters to lose precision when converted to a header. This\n  occurred for example in cases of spectral cubes, where a spectral axis in\n  Hz might have a CRVAL3 value greater than 1e10 but the spatial coordinates\n  would have CRVAL1/2 values 8 to 10 orders of magnitude smaller. This bug\n  was present in Astropy 1.1 and 1.1.1 but not 1.0.x. This has now been fixed\n  by ensuring that all WCS keywords are output with 14 significant figures by\n  default. [#4616]\n\nOther Changes and Additions\n---------------------------\n\n- Updated bundled astropy-helpers to v1.1.2. [#4678]\n\n- Updated bundled copy of WCSLIB to 5.14. [#4579]\n\n\n1.1.1 (2016-01-08)\n==================\n\nNew Features\n------------\n\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\n- Allow ``pathlib.Path`` objects (available in Python 3.4 and later) for\n  specifying the file name in registry read / write functions. [#4405]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- ``console.human_file_size`` now accepts quantities with byte-equivalent\n  units [#4373]\n\nBug Fixes\n---------\n\nastropy.analytic_functions\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n- Fixed the blackbody functions' handling of overflows on some platforms\n  (Windows with MSVC, older Linux versions) with a buggy ``expm1`` function.\n  [#4393]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fixed an bug where updates to string columns in FITS tables were not saved\n  on Python 3. [#4452]\n\nOther Changes and Additions\n---------------------------\n\n- Updated bundled astropy-helpers to v1.1.1. [#4413]\n\n\n1.1 (2015-12-11)\n================\n\nNew Features\n------------\n\nastropy.config\n^^^^^^^^^^^^^^\n\n- Added new tools ``set_temp_config`` and ``set_temp_cache`` which can be\n  used either as function decorators or context managers to temporarily\n  use alternative directories in which to read/write the Astropy config\n  files and download caches respectively.  This is especially useful for\n  testing, though ``set_temp_cache`` may also be used as a way to provide\n  an alternative (application specific) download cache for large data files,\n  rather than relying on the default cache location in users' home\n  directories. [#3975]\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\n- Added the Thomson scattering cross-section. [#3839]\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Added Moffat2DKernel. [#3965]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Added ``get_constellation`` function and ``SkyCoord.get_constellation``\n  convenience method to determine the constellation that a coordinate\n  is in. [#3758]\n\n- Added ``PrecessedGeocentric`` frame, which is based on GCRS, but precessed\n  to a specific requested mean equinox. [#3758]\n\n- Added ``Supergalactic`` frame to support de Vaucouleurs supergalactic\n  coordinates. [#3892]\n\n- ``SphericalRepresentation`` now has a ``._unit_representation`` class attribute to specify\n  an equivalent UnitSphericalRepresentation. This allows subclasses of\n  representations to pair up correctly. [#3757]\n\n- Added functionality to support getting the locations of observatories by\n  name. See ``astropy.coordinates.EarthLocation.of_site``. [#4042]\n\n- Added ecliptic coordinates, including ``GeocentricTrueEcliptic``,\n  ``BarycentricTrueEcliptic``, and ``HeliocentricTrueEcliptic``. [#3749]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Add Planck 2015 cosmology [#3476]\n\n- Distance calculations now > 20-40x faster for the supplied\n  cosmologies due to implementing Cython scalar versions of\n  ``FLRW.inv_efunc``.[#4127]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Automatically use ``guess=False`` when reading if the file ``format`` is\n  provided and the format parameters are uniquely specified.  This update\n  also removes duplicate format guesses to improve performance. [#3418]\n\n- Calls to ascii.read() for fixed-width tables may now omit one of the keyword\n  arguments ``col_starts`` or ``col_ends``. Columns will be assumed to begin and\n  end immediately adjacent to each other. [#3657]\n\n- Add a function ``get_read_trace()`` that returns a traceback of the\n  attempted read formats for the last call to ``astropy.io.ascii.read``. [#3688]\n\n- Supports LZMA decompression via ``get_readable_fileobj`` [#3667]\n\n- Allow ``-`` character is Sextractor format column names. [#4168]\n\n- Improve DAOphot reader to read multi-aperture files [#3535, #4207]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Support reading and writing from bzip2 compressed files. i.e. ``.fits.bz2``\n  files. [#3789]\n\n- Included a new command-line script called ``fitsinfo`` to display\n  a summary of the HDUs in one or more FITS files. [#3677]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Support saving all meta information, description and units of tables and columns\n  in HDF5 files [#4103]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- A new method was added to ``astropy.io.votable.VOTable``,\n  ``get_info_by_id`` to conveniently find an ``INFO`` element by its\n  ``ID`` attribute. [#3633]\n\n- Instances in the votable tree now have better ``__repr__`` methods. [#3639]\n\nastropy.logger.py\n^^^^^^^^^^^^^^^^^\n\n- Added log levels (e.g., DEBUG, INFO, CRITICAL) to ``astropy.log`` [#3947]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Added a new ``Parameter.validator`` interface for setting a validation\n  method on individual model parameters.  See the ``Parameter``\n  documentation for more details. [#3910]\n\n- The projection classes that are named based on the 3-letter FITS\n  WCS projections (e.g. ``Pix2Sky_TAN``) now have aliases using\n  longer, more descriptive names (e.g. ``Pix2Sky_Gnomonic``).\n  [#3583]\n\n- All of the standard FITS WCS projection types have been\n  implemented in ``astropy.modeling.projections`` (by wrapping\n  WCSLIB). [#3906]\n\n- Added ``Sersic1D`` and ``Sersic2D`` model classes. [#3889]\n\n- Added the Voigt profile to existing models. [#3901]\n\n- Added ``bounding_box`` property and ``render_model`` function [#3909]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Added ``block_reduce`` and ``block_replicate`` functions. [#3453]\n\n- ``extract_array`` now offers different options to deal with array\n  boundaries [#3727]\n\n- Added a new ``Cutout2D`` class to create postage stamp image cutouts\n  with optional WCS propagation. [#3823]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Added ``sigma_lower`` and ``sigma_upper`` keywords to\n  ``sigma_clip`` to allow for non-symmetric clipping. [#3595]\n\n- Added ``cenfunc``, ``stdfunc``, and ``axis`` keywords to\n  ``sigma_clipped_stats``. [#3792]\n\n- ``sigma_clip`` automatically masks invalid input values (NaNs, Infs) before\n  performing the clipping [#4051]\n\n- Added the ``histogram`` routine, which is similar to ``np.histogram`` but\n  includes several additional options for automatic determination of optimal\n  histogram bins. Associated helper routines include ``bayesian_blocks``,\n  ``friedman_bin_width``, ``scott_bin_width``, and ``knuth_bin_width``.\n  This functionality was ported from the astroML library. [#3756]\n\n- Added the ``bayesian_blocks`` routine, which implements a dynamic algorithm\n  for locating change-points in various time series. [#3756]\n\n- A new function ``poisson_conf_interval()`` was added to allow easy calculation\n  of several standard formulae for the error bars on the mean of a Poisson variable\n  estimated from a single sample.\n\nastropy.table\n^^^^^^^^^^^^^\n\n- ``add_column()`` and ``add_columns()`` now have ``rename_duplicate``\n  option to rename new column(s) rather than raise exception when its name\n  already exists. [#3592]\n\n- Added ``Table.to_pandas`` and ``Table.from_pandas`` for converting to/from\n  pandas dataframes. [#3504]\n\n- Initializing a ``Table`` with ``Column`` objects no longer requires\n  that the column ``name`` attribute be defined. [#3781]\n\n- Added an ``info`` property to ``Table`` objects which provides configurable\n  summary information about the table and its columns. [#3731]\n\n- Added an ``info`` property to column classes (``Column`` or mixins).  This\n  serves a dual function of providing configurable summary information about\n  the column, and acting as a manager of column attributes such as\n  name, format, or description. [#3731]\n\n- Updated table and column representation to use the ``dtype_info_name``\n  function for the dtype value.  Removed the default \"masked=False\"\n  from the table representation. [#3868, #3869]\n\n- Updated row representation to be consistent with the corresponding\n  table representation for that row.  Added HTML representation so a\n  row displays nicely in IPython notebook.\n\n- Added a new table indexing engine allowing for the creation of\n  indices on one or more columns of a table using ``add_index``. These\n  indices enable new functionality such as searching for rows by value\n  using ``loc`` and ``iloc``, as well as increased performance for\n  certain operations. [#3915, #4202]\n\n- Added capability to include a structured array or recarray in a table\n  as a mixin column.  This allows for an approximation of nested tables.\n  [#3925]\n\n- Added ``keep_byteorder`` option to ``Table.as_array()``.  See the\n  \"API Changes\" section below. [#4080]\n\n- Added a new method ``Table.replace_column()`` to replace an existing\n  column with a new data column. [#4090]\n\n- Added a ``tableclass`` option to ``Table.pformat()`` to allow specifying\n  a list of CSS classes added to the HTML table. [#4131]\n\n- New CSS for jsviewer table [#2917, #2982, #4174]\n\n- Added a new ``Table.show_in_notebook`` method that shows an interactive view\n  of a Table (similar to ``Table.show_in_browser(jsviewer=True)``) in an\n  Python/Jupyter notebook. [#4197]\n\n- Added column alignment formatting for better pprint viewing\n  experience. [#3644]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- Added new test config options, ``config_dir`` and ``cache_dir``  (these\n  can be edited in ``setup.cfg`` or as extra command-line options to\n  py.test) for setting the locations to use for the Astropy config files\n  and download caches (see also the related ``set_temp_config/cache``\n  features added in ``astropy.config``). [#3975]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Add support for FITS standard time strings. [#3547]\n\n- Allow the ``format`` attribute to be updated in place to change the\n  default representation of a ``Time`` object. [#3673]\n\n- Add support for shape manipulation (reshape, ravel, etc.). [#3224]\n\n- Add argmin, argmax, argsort, min, max, ptp, sort methods. [#3681]\n\n- Add ``Time.to_datetime`` method for converting ``Time`` objects to\n  timezone-aware datetimes. [#4119, #4124]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Added furlong to imperial units. [#3529]\n\n- Added mil to imperial units. [#3716]\n\n- Added stone to imperial units. [#4192]\n\n- Added Earth Mass (``M_earth``) and Jupiter mass (``M_jup``) to units [#3907]\n\n- Added support for functional units, in particular the logarithmic ones\n  ``Magnitude``, ``Decibel``, and ``Dex``. [#1894]\n\n- Quantities now work with the unit support in matplotlib.  See\n  :ref:`plotting-quantities`. [#3981]\n\n- Clarified imperial mass measurements and added pound force (lbf),\n  kilopound (kip), and pound per square inch (psi). [#3409]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Added new ``OrderedDescriptor`` and ``OrderedDescriptorContainer`` utility\n  classes that make it easier to implement classes with declarative APIs,\n  wherein class-level attributes have an inherit \"ordering\" to them that is\n  specified by the order in which those attributes are defined in the class\n  declaration (by defining them using special descriptors that have\n  ``OrderedDescriptor`` as a base class).  See the API documentation for\n  these classes for more details. Coordinate frames and models now use this\n  interface. [#3679]\n\n- The ``get_pkg_data_*`` functions now take an optional ``package`` argument\n  which allows specifying any package to read package data filenames or\n  content out of, as opposed to only being able to use data from the package\n  that the function is called from. [#4079]\n\n- Added function ``dtype_info_name`` to the ``data_info`` module to provide\n  the name of a ``dtype`` for human-readable informational purposes. [#3868]\n\n- Added ``classproperty`` decorator--this is to ``property`` as\n  ``classmethod`` is to normal instance methods. [#3982]\n\n- ``iers.open`` now handles network URLs, as well as local paths. [#3850]\n\n- The ``astropy.utils.wraps`` decorator now takes an optional\n  ``exclude_args`` argument not shared by the standard library ``wraps``\n  decorator (as it is unique to the Astropy version's ability of copying\n  the wrapped function's argument signature).  ``exclude_args`` allows\n  certain arguments on the wrapped function to be excluded from the signature\n  of the wrapper function.  This is particularly useful when wrapping an\n  instance method as a function (to exclude the ``self`` argument). [#4017]\n\n- ``get_readable_fileobj`` can automatically decompress LZMA ('.xz')\n  files using the ``lzma`` module of Python 3.3+ or, when available, the\n  ``backports.lzma`` package on earlier versions. [#3667]\n\n- The ``resolve_name`` utility now accepts any number of additional\n  positional arguments that are automatically dotted together with the\n  first ``name`` argument. [#4083]\n\n- Added ``is_url_in_cache`` for resolving paths to cached files via URLS\n  and checking if files exist. [#4095]\n\n- Added a ``step`` argument to the ``ProgressBar.map`` method to give\n  users control over the update frequency of the progress bar. [#4191]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Added a function / context manager ``quantity_support`` for enabling\n  seamless plotting of ``Quantity`` instances in matplotlib. [#3981]\n\n- Added the ``hist`` function, which is similar to ``plt.hist`` but\n  includes several additional options for automatic determination of optimal\n  histogram bins. This functionality was ported from the astroML library.\n  [#3756]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- The included version of wcslib has been upgraded to 5.10. [#3992, #4239]\n\n  The minimum required version of wcslib in the 4.x series remains 4.24.\n\n  The minimum required version of wcslib in the 5.x series is\n  5.8.  Building astropy against a wcslib 5.x prior to 5.8\n  will raise an ``ImportError`` when ``astropy.wcs`` is imported.\n\n  The wcslib changes relevant to astropy are:\n\n- The FITS headers returned by ``astropy.wcs.WCS.to_header`` and\n  ``astropy.wcs.WCS.to_header_string`` now include values with\n  more precision.  This will result in numerical differences in\n  your results if you convert ``astropy.wcs.WCS`` objects to FITS\n  headers and use the results.\n\n- ``astropy.wcs.WCS`` now recognises the ``TPV``, ``TPD``,\n  ``TPU``, ``DSS``, ``TNX`` and ``ZPX`` polynomial distortions.\n\n- Added relaxation flags to allow ``PC0i_0ja``, ``PV0j_0ma``, and\n  ``PS0j_0ma`` (i.e. with leading zeroes on the index).\n\n- Tidied up error reporting, particularly relating to translating\n  status returns from lower-level functions.\n\n- Changed output formatting of floating point values in\n  ``to_header``.\n\n- Enhanced text representation of ``WCS`` objects. [#3604]\n\n- The ``astropy.tests.helper`` module is now part of the public API (and has a\n  documentation page).  This module was in previous releases of astropy,\n  but was not considered part of the public API until now. [#3890]\n\n- There is a new function ``astropy.online_help`` to search the\n  astropy documentation and display the result in a web\n  browser. [#3642]\n\nAPI changes\n-----------\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- ``FLRW._tfunc`` and ``FLRW._xfunc`` are marked as deprecated.  Users\n  should use the new public interfaces ``FLRW.lookback_time_integrand``\n  and ``FLRW.abs_distance_integrand`` instead. [#3767]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- The default header line processing was made to be consistent with data line\n  processing in that it now ignores blank lines that may have whitespace\n  characters.  Any code that explicitly specifies a ``header_start`` value\n  for parsing a file with blank lines in the header containing whitespace will\n  need to be updated. [#2654]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- The ``uint`` argument to ``fits.open`` is now True by default; that is,\n  arrays using the FITS unsigned integer convention will be detected, and\n  read as unsigned integers by default.  A new config option for\n  ``io.fits``, ``enable_uint``, can be changed to False to revert to the\n  original behavior of ignoring the ``uint`` convention unless it is\n  explicitly requested with ``uint=True``. [#3916]\n\n- The ``ImageHDU.NumCode`` and ``ImageHDU.ImgCode`` attributes (and same\n  for other classes derived from ``_ImageBaseHDU``) are deprecated.  Instead,\n  the ``astropy.io.fits`` module-level constants ``BITPIX2DTYPE`` and\n  ``DTYPE2BITPIX`` can be used. [#3916]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Note: Comparisons of model parameters with array-like values now\n  yields a Numpy boolean array as one would get with normal Numpy\n  array comparison.  Previously this returned a scalar True or False,\n  with True only if the comparison was true for all elements compared,\n  which could lead to confusing circumstances. [#3912]\n\n- Using ``model.inverse = None`` to reset a model's inverse to its\n  default is deprecated.  In the future this syntax will explicitly make\n  a model not have an inverse (even if it has a default).  Instead, use\n  ``del model.inverse`` to reset a model's inverse to its default (if it\n  has a default, otherwise this just deletes any custom inverse that has\n  been assigned to the model and is still equivalent to setting\n  ``model.inverse = None``). [#4236]\n\n- Adds a ``model.has_user_inverse`` attribute which indicates whether or not\n  a user has assigned a custom inverse to ``model.inverse``.  This is just\n  for informational purposes, for example, for software that introspects\n  model objects. [#4236]\n\n- Renamed the parameters of ``RotateNative2Celestial`` and\n  ``RotateCelestial2Native`` from ``phi``, ``theta``, ``psi`` to\n  ``lon``, ``lat`` and ``lon_pole``. [#3578]\n\n- Deprecated the ``Pix2Sky_AZP.check_mu`` and ``Sky2Pix_AZP.check_mu``\n  methods (these were obscure \"accidentally public\" methods that were\n  probably not used by anyone). [#3910]\n\n- Added a phase parameter to the Sine1D model. [#3807]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Renamed the ``sigma_clip`` ``sig`` keyword as ``sigma``. [#3595]\n\n- Changed the ``sigma_clip`` ``varfunc`` keyword to ``stdfunc``. [#3595]\n\n- Renamed the ``sigma_clipped_stats`` ``mask_val`` keyword to\n  ``mask_value``. [#3595]\n\n- Changed the default ``iters`` keyword value to 5 in both the\n  ``sigma_clip`` and ``sigma_clipped_stats`` functions. [#4067]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- ``Table.as_array()`` always returns a structured array with each column in\n  the system's native byte order.  The optional ``keep_byteorder=True``\n  option will keep each column's data in its original byteorder. [#4080]\n\n- ``Table.simple_table()`` now creates tables with int64 and float64 types\n  instead of int32 and float64. [#4114]\n\n- An empty table can now be initialized without a ``names`` argument as long\n  as a valid ``dtype`` argument (with names embedded) is supplied. [#3977]\n\nastropy.time\n^^^^^^^^^^^^\n\n- The ``astropy_time`` attribute and time format has been removed from the\n  public interface.  Existing code that instantiates a new time object using\n  ``format='astropy_time'`` can simply omit the ``format``\n  specification. [#3857]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Single-item ``Quantity`` instances with record ``dtype`` will now have\n  their ``isscalar`` property return ``True``, consistent with behaviour for\n  numpy arrays, where ``np.void`` records are considered scalar. [#3899]\n\n- Three changes relating to the FITS unit format [#3993]:\n\n- The FITS unit format will no longer parse an arbitrary number as a\n  scale value.  It must be a power of 10 of the form ``10^^k``,\n  ``10^k``, ``10+k``, ``10-k`` and ``10(k)``. [#3993]\n\n- Scales that are powers of 10 can be written out.  Previously, any\n  non-1.0 scale was rejected.\n\n- The ``*`` character is accepted as a separator between the scale\n  and the units.\n\n- Unit formatter classes now require the ``parse`` and ``to_string``\n  methods are now required to be classmethods (and the formatter\n  classes themselves are assumed to be singletons that are not\n  instantiated).  As unit formatters are mostly an internal implementation\n  detail this is not likely to affect any users. [#4001]\n\n- CGS E&M units are now defined separately from SI E&M units, and have\n  distinct physical types. [#4255, #4355]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- All of the ``get_pkg_data_*`` functions take an optional ``package``\n  argument as their second positional argument.  So any code that previously\n  passed other arguments to these functions as positional arguments might\n  break.  Use keyword argument passing instead to mitigate this. [#4079]\n\n- ``astropy.utils.iers`` now uses a ``QTable`` internally, which means that\n  the numerical columns are stored as ``Quantity``, with full support for\n  units.  Furthermore, the ``ut1_utc`` method now returns a ``Quantity``\n  instead of a float or an array (as did ``pm_xy`` already). [#3223]\n\n- ``astropy.utils.iers`` now throws an ``IERSRangeError``, a subclass\n  of ``IndexError``, rather than a raw ``IndexError``.  This allows more\n  fine-grained catching of situations where a ``Time`` is beyond the range\n  of the loaded IERS tables. [#4302]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- When compiled with wcslib 5.9 or later, the FITS headers returned\n  by ``astropy.wcs.WCS.to_header`` and\n  ``astropy.wcs.WCS.to_header_string`` now include values with more\n  precision.  This will result in numerical differences in your\n  results if you convert ``astropy.wcs.WCS`` objects to FITS headers\n  and use the results.\n\n- If NAXIS1 or NAXIS2 is not passed with the header object to\n  WCS.calc_footprint, a ValueError is raised. [#3557]\n\nBug fixes\n---------\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\n- The constants ``Ry`` and ``u`` are now properly used inside the\n  corresponding units.  The latter have changed slightly as a result. [#4229]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Internally, ``coordinates`` now consistently uses the appropriate time\n  scales for using ERFA functions. [#4302]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fix a segfault in the fast C parser when one of the column headers\n  is empty [#3545].\n\n- Fix several bugs that prevented the fast readers from being used\n  when guessing the file format.  Also improved the read trace\n  information to better understand format guessing. [#4115]\n\n- Fix an underlying problem that resulted in an uncaught TypeError\n  exception when reading a CDS-format file with guessing enabled. [#4120]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- ``Simplex`` fitter now correctly passes additional keywords arguments to\n  the scipy solver. [#3966]\n\n- The keyword ``acc`` (for accuracy) is now correctly accepted by\n  ``Simplex``. [#3966]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- The units ``Ryd`` and ``u`` are no longer hard-coded numbers, but depend\n  on the appropriate values in the ``constants`` module.  As a result, these\n  units now imply slightly different conversions.  [#4229]\n\nOther Changes and Additions\n---------------------------\n\n- The ``./setup.py test`` command is now implemented in the ``astropy.tests``\n  module again (previously its implementation had been moved into\n  astropy-helpers).  However, that made it difficult to synchronize changes\n  to the Astropy test runner with changes to the ``./setup.py test`` UI.\n  astropy-helpers v1.1 and above will detect this implementation of the\n  ``test`` command, when present, and use it instead of the old version that\n  was included in astropy-helpers (most users will not notice any difference\n  as a result of this change). [#4020]\n\n- The repr for ``Table`` no longer displays ``masked=False`` since tables\n  are not masked by default anyway. [#3869]\n\n- The version of ``PLY`` that ships with astropy has been updated to 3.6.\n\n- WCSAxes is now required for doc builds. [#4074]\n\n- The migration guide from pre-v0.4 coordinates has been removed to avoid\n  cluttering the ``astropy.coordinates`` documentation with increasingly\n  irrelevant material.  To see the migration guide, we recommend you simply look\n  to the archived documentation for previous versions, e.g.\n  https://docs.astropy.org/en/v1.0/coordinates/index.html#migrating-from-pre-v0-4-coordinates\n  [#4203]\n\n- In ``astropy.coordinates``, the transformations between GCRS, CIRS,\n  and ITRS have been adjusted to more logically reflect the order in\n  which they actually apply.  This should not affect most coordinate\n  transformations, but may affect code that is especially sensitive to\n  machine precision effects that change when the order in which\n  transformations occur is changed. [#4255]\n\n- Astropy v1.1.0 will be the last release series to officially support\n  Python 2.6.  A deprecation warning will now be issued when using Astropy\n  in Python 2.6 (this warning can be disabled through the usual Python warning\n  filtering mechanisms). [#3779]\n\n\n1.0.13 (2017-05-29)\n===================\n\nBug Fixes\n---------\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fix use of quantize level parameter for ``CompImageHDU``. [#6029]\n\n- Prevent crash when a header contains non-ASCII (e.g. UTF-8) characters, to\n  allow fixing the problematic cards. [#6084]\n\n\n1.0.12 (2017-03-05)\n===================\n\nBug Fixes\n---------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed bug in ``discretize_integrate_2D`` in which x and y coordinates\n  where swapped. [#5634]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug where ``get_transform`` could sometimes produce confusing errors\n  because of a typo in the input validation. [#5645]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Guard against extremely unlikely problems in compressed images, which\n  could lead to memory unmapping errors. [#5775]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug where stdlib ``realloc()`` was used instead of\n  ``PyMem_Realloc()`` [#5696, #4739, #2100]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Fixed ImportError with NumPy < 1.7 and Python 3.x in\n  ``_register_patched_dtype_reduce``. [#5848]\n\n\n1.0.11 (2016-12-22)\n===================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Initialising a SkyCoord from a list containing a single SkyCoord no longer removes\n  the distance from the coordinate. [#5270]\n\n- Fix errors in the implementation of the conversion to and from FK4 frames\n  without e-terms, which will have affected coordinates not on the unit\n  sphere (i.e., with distances). [#4293]\n\n- Fix bug where with cds units enabled it was no longer possible to initialize\n  an ``Angle``. [#5483]\n\n- Ensure that ``search_around_sky`` and ``search_around_3d`` return\n  integer type index arrays for empty (non) matches. [#4877, #5083]\n\n- Return an empty set of matches for ``search_around_sky`` and\n  ``search_around_3d`` when one or both of the input coordinate\n  arrays is empty. [#4875, #5083]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fix a bug with empty value at end of tab-delimited table on Windows. [#5370]\n\n- Fix reading of big ASCII tables (more than 2Gb) with the fast reader.\n  [#5319]\n\n- Fix segfault with FastCsv and row with too many columns. [#5534]\n\n- Fix problem reading an AASTex format table that does not have ``\\\\``\n  at the end of the last table row. [#5427]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Removed raising of AssertionError that could occur after closing or\n  deleting compressed image data. [#4690, #4694, #4948]\n\n- Fixed bug that caused an ignored exception to be displayed under certain\n  conditions when terminating a script after using fits.getdata(). [#4977]\n\n- Fixed usage of inplace operations that were raising an exception with\n  recent versions of Numpy due to implicit casting. [#5250]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Fixed bug of ``Resource.__repr__()`` having undefined attributes and\n  variables. [#5382]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- CompoundModel now correctly inherits _n_models, allowing the use of model sets [#5358]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Fixed bug in Ci definition. [#5106]\n\n- Non-ascii cds unit strings are now correctly represented using ``str`` also\n  on python2. This solves bugs in parsing coordinates involving strings too.\n  [#5355]\n\n- Ensure ``Quantity`` supports ``np.float_power``, which is new in numpy 1.12.\n  [#5480]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Fixed AttributeError when calling ``utils.misc.signal_number_to_name`` with\n  Python3 [#5430].\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Update the ``_naxis{x}`` attributes when calling ``WCS.slice``. [#5411]\n\n\nOther Changes and Additions\n---------------------------\n\n- The bundled ERFA was updated to version 1.3.0.  This includes the\n  leap second planned for 2016 Dec 31. [#5418]\n\n1.0.10 (2016-06-09)\n===================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- ``SkyCoord`` objects created before a new frame which has frame attributes\n  is created no longer raise ``AttributeError`` when the new attributes are\n  accessed [#5021]\n\n- Fix some errors in the implementation of aberration  for ``get_sun``. [#4979]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fix problem reading a zero-length ECSV table with a bool type column. [#5010]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fix convenience functions (``getdata``, ``getheader``, ``append``,\n  ``update``) to close files. [#4786]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- The astropy.io.votable.validator.html module is updated to handle division\n  by zero when generating validation report. [#4699]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fixed a bug where ``pprint()`` sometimes raises ``UnicodeDecodeError``\n  in Python 2. [#4946]\n\n- Fix bug when doing outer join on multi-dimensional columns. [#4060]\n\n- Fixed bug where Tables created from existing Table objects were not\n  inheriting the ``primary_key`` attribute. [#4672]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- Fix coverage reporting in Python 3. [#4822]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Duplicates between long and short names are now removed in the ``names``\n  and ``aliases`` properties of units. [#5036]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- The astropy.utils.xml.unescaper module now also unescapes ``'%2F'`` to\n  ``'/'`` and ``'&&'`` to ``'&'`` in a given URL. [#4699]\n\n- Fix two problems related to the download cache: clear_download_cache() does\n  not work in Python 2.7 and downloading in Python 2.7 and then Python 3\n  can result in an exception. [#4810]\n\nastropy.vo\n^^^^^^^^^^\n\n- Cache option now properly caches both downloaded JSON database and XML VO\n  tables. [#4699]\n\n- The astropy.vo.validator.conf.conesearch_urls listing is updated to reflect\n  external changes to some VizieR Cone Search services. [#4699]\n\n- VOSDatabase decodes byte-string to UTF-8 instead of ASCII to avoid\n  UnicodeDecodeError for some rare cases. Fixed a Cone Search test that is\n  failing as a side-effect of #4699. [#4757]\n\nOther Changes and Additions\n---------------------------\n\n- Updated ``astropy.tests`` test runner code to work with Coverage v4.0 when\n  generating test coverage reports. [#4176]\n\n\n1.0.9 (2016-03-10)\n==================\n\nNew Features\n------------\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- ``NDArithmeticMixin`` check for matching WCS now works with\n  ``astropy.wcs.WCS`` objects [#4499, #4503]\n\nBug Fixes\n---------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Correct a bug in which ``psf_pad`` and ``fft_pad`` would be ignored [#4366]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fixed addition of new line characters after last row of data in\n  ascii.latex.AASTex. [#4561]\n\n- Fixed reading of Latex tables where the ``\\tabular`` tag is in the first\n  line. [#4595]\n\n- Fix use of plain format strings with the fast writer. [#4517]\n\n- Fix bug writing space-delimited file when table has empty fields. [#4417]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fixed possible segfault during error handling in FITS tile\n  compression. [#4489]\n\n- Fixed crash on pickling of binary table columns with the 'X', 'P', or\n  'Q' format. [#4514]\n\n- Fixed memory / reference leak that could occur when copying a ``FITS_rec``\n  object (the ``.data`` for table HDUs). [#520]\n\n- Fixed a memory / reference leak in ``FITS_rec`` that occurred in a wide\n  range of cases, especially after writing FITS tables to a file, but in\n  other cases as well. [#4539]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed display of compound model expressions and components when printing\n  compound model instances. [#4414, #4482]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- the input for median_absolute_deviation will not be cast to plain numpy\n  arrays when given subclasses of numpy arrays\n  (like Quantity, numpy.ma.MaskedArray, etc.) [#4658]\n\n- Fixed incorrect results when using median_absolute_deviation with masked\n  arrays. [#4658]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- The ``zest.releaser`` hooks included in Astropy are now injected locally to\n  Astropy, rather than being global. [#4650]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Fixed ``fits2bitmap`` script to allow ext flag to contain extension\n  names or numbers. [#4468]\n\n- Fixed ``fits2bitmap`` default output filename generation for\n  compressed FITS files. [#4468]\n\n\n1.0.8 (2016-01-08)\n==================\n\nBug Fixes\n---------\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fixed an bug where updates to string columns in FITS tables were not saved\n  on Python 3. [#4452]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- In-place peak-to-peak calculations now work on ``Quantity``. [#4442]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Fixed ``find_api_page`` to work correctly on python 3.x [#4378, #4379]\n\n\n1.0.7 (2015-12-04)\n==================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Pickling of ``EarthLocation`` instances now also works on Python 2. [#4304]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fix fast writer so bytestring column output is not prefixed by 'b' in\n  Python 3. [#4350]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fixed a regression that could cause writes of large FITS files to be\n  truncated. [#4307]\n\n- Astropy v1.0.6 included a fix (#4228) for an obscure case where the TDIM\n  of a table column is smaller than the repeat count of its data format.\n  This updates that fix in such a way that it works with Numpy 1.10 as well.\n  [#4266]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix a bug when pickling a Table with mixin columns (e.g. Time). [#4098]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Fix incorrect ``value`` attribute for epoch formats like \"unix\"\n  when ``scale`` is different from the class ``epoch_scale``. [#4312]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Fixed an issue where if ipython is installed but ipykernel is not\n  installed then importing astropy from the ipython console gave an\n  IPython.kernel deprecation warning. [#4279]\n\n- Fixed crash that could occur in ``ProgressBar`` when ``astropy`` is\n  imported in an IPython startup script. [#4274]\n\nOther Changes and Additions\n---------------------------\n\n- Updated bundled astropy-helpers to v1.0.6. [#4372]\n\n\n1.0.6 (2015-10-22)\n==================\n\nBug Fixes\n---------\n\nastropy.analytic_functions\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n- Fixed blackbody analytic functions to properly support arrays of\n  temperatures. [#4251]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed errors in transformations for objects within a few AU of the\n  Earth.  Included substantive changes to transformation machinery\n  that may change distances at levels ~machine precision for other\n  objects. [#4254]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- ``fitsdiff`` and related functions now do a better job reporting differences\n  between values that are different types but have the same representation\n  (ex: the string '0' versus the number 0). [#4122]\n\n- Miscellaneous fixes for supporting Numpy 1.10. [#4228]\n\n- Fixed an issue where writing a column of unicode strings to a FITS table\n  resulted in a quadrupling of size of the column (i.e. the format of the\n  FITS column was 4 characters for every one in the original strings).\n  [#4228]\n\n- Added support for an obscure case (but nonetheless allowed by the FITS\n  standard) where a column has some TDIMn keyword, but a repeat count in\n  the TFORMn column greater than the number of elements implied by the\n  TDIMn.  For example TFORMn = 100I, but TDIMn = '(5,5)'.  In this case\n  the TDIMn implies 5x5 arrays in the column, but the TFORMn implies\n  a 100 element 1-D array in the column.  In this case the TDIM takes\n  precedence, and the remaining bytes in the column are ignored. [#4228]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Fixed crash with Python compiler optimization level = 2. [#4231]\n\nastropy.vo\n^^^^^^^^^^\n\n- Fixed ``check_conesearch_sites`` with ``parallel=True`` on Python >= 3.3\n  and on Windows (it was broken in both those cases for separate reasons).\n  [#2970]\n\nOther Changes and Additions\n---------------------------\n\n- All tests now pass against Numpy v1.10.x. This implies nominal support for\n  Numpy 1.10.x moving forward (but there may still be unknown issues). For\n  example, there is already a known performance issue with tables containing\n  large multi-dimensional columns--for example, tables that contain entire\n  images in one or more of their columns.  This is a known upstream issue in\n  Numpy. [#4259]\n\n\n1.0.5 (2015-10-05)\n==================\n\nBug Fixes\n---------\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\n- Rename units -> unit and error -> uncertainty in the ``repr`` and ``str``\n  of constants to match attribute names. [#4147]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Fix string representation of ``SkyCoord`` objects transformed into\n  the ``AltAz`` frame [#4055, #4057]\n\n- Fix the ``search_around_sky`` function to allow ``storekdtree`` to be\n  ``False`` as was intended. [#4082, #4212]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fix bug when extending one header (without comments) with another\n  (with comments). [#3967]\n\n- Somewhat improved resource usage for FITS data--previously a new ``mmap``\n  was opened for each HDU of a FITS file accessed through an ``HDUList``.\n  Each ``mmap`` used up a single file descriptor, causing problems with\n  system resource limits for some users.  Now only a single ``mmap`` is\n  opened, and shared for the data of all HDUs.  Note: The problem still\n  persists with using the \"convenience\" functions.  For example using\n  ``fits.getdata`` will create one ``mmap`` per HDU read this way (as\n  opposed to opening the file with ``fits.open`` and accessing the HDUs\n  through the ``HDUList`` object). [#4097]\n\n- Fix bug where reading a file without a newline failed with an\n  unrelated / unhelpful exception. [#4160]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Cleaned up ``repr`` of models that have no parameters. [#4076]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Initializing ``NDDataArray`` from another instance now sets ``flags`` as\n  expected and no longer fails when ``uncertainty`` is set [#4129].\n  Initializing an ``NDData`` subclass from a parent instance\n  (eg. ``NDDataArray`` from ``NDData``) now sets the attributes other than\n  ``data`` as it should [#4130, #4137].\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix an issue with setting fill value when column dtype is changed. [#4088]\n\n- Fix bug when unpickling a bare Column where the _parent_table\n  attribute was not set.  This impacted the Column representation. [#4099]\n\n- Fix issue with the web browser opening with an empty page, and ensure that\n  the url is correctly formatted for Windows. [#4132]\n\n- Fix NameError in table stack exception message. [#4213]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- ``resolve_name`` no longer causes ``sys.modules`` to be cluttered with\n  additional copies of modules under a package imported like\n  ``resolve_name('numpy')``. [#4084]\n\n- ``console`` was updated to support IPython 4.x and Jupyter 1.x.\n  This should suppress a ShimWarning that was appearing at\n  import of astropy with IPython 4.0 or later. [#4078]\n\n- Temporary downloaded files created by ``get_readable_fileobj`` when passed\n  a URL are now deleted immediately after the file is closed. [#4198]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- The color for axes labels was set to white. Since white labels on white\n  background are hard to read, the label color has been changed to black.\n  [#4143]\n\n- ``ImageNormalize`` now automatically determines ``vmin``/``vmax``\n  (via the ``autoscale_None`` method) when they have not been set\n  explicitly. [#4117]\n\nastropy.vo\n^^^^^^^^^^\n\n- Cone Search validation no longer crashes when the provider gives an\n  incomplete test query. It also ensures search radius for a test query\n  is not too large to avoid timeout. [#4158, #4159]\n\nOther Changes and Additions\n---------------------------\n\n- Astropy now supports Python 3.5. [#4027]\n\n- Updated bundled version of astropy-helpers to 1.0.5. [#4215]\n\n- Updated tests to support py.test 2.7, and upgraded the bundled copy of\n  py.test to v2.7.3. [#4027]\n\n\n1.0.4 (2015-08-11)\n==================\n\nNew Features\n------------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Modified Cython functions to release the GIL. This enables convolution\n  to be parallelized effectively and gives large speedups when used with\n  multithreaded task schedulers such as Dask. [#3949]\n\nAPI Changes\n-----------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Some transformations for an input coordinate that's a scalar now correctly\n  return a scalar.  This was always the intended behavior, but it may break\n  code that has been written to work-around this bug, so it may be viewed as\n  an unplanned API change [#3920, #4039]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- The ``astropy_mpl_style`` no longer sets ``interactive`` to ``True``, but\n  instead leaves it at the user preference.  This makes using the style\n  compatible with building docs with Sphinx, and other non-interactive\n  contexts. [#4030]\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Fix bug where coordinate representation setting gets reset to default value\n  when coordinate array is indexed or sliced. [#3824]\n\n- Fixed confusing warning message shown when using dates outside current IERS\n  data. [#3844]\n\n- ``get_sun`` now yields a scalar when the input time is a scalar (this was a\n  regression in v1.0.3 from v1.0.2) [#3998, #4039]\n\n- Fixed bug where some scalar coordinates were incorrectly being changed to\n  length-1 array coordinates after transforming through certain frames.\n  [#3920, #4039]\n\n- Fixed bug causing the ``separation`` methods of ``SkyCoord`` and frame\n  classes to fail due to infinite recursion [#4033, #4039]\n\n- Made it so that passing in a list of ``SkyCoord`` objects that are in\n  UnitSphericalRepresentation to the ``SkyCoord`` constructor appropriately\n  yields a new object in UnitSphericalRepresentation [#3938, #4039]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Fixed wCDM to not ignore the Ob0 parameter on initialization. [#3934]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fixed crash when updating data in a random groups HDU opened in update\n  mode. [#3730]\n\n- Fixed incorrect checksum / datasum being written when re-writing a scaled\n  HDU (i.e. non-trivial BSCALE and/or BZERO) with\n  ``do_not_scale_image_data=False``. [#3883]\n\n- Fixed stray deprecation warning in ``BinTableHDU.copy()``. [#3798]\n\n- Better handling of the ``BLANK`` keyword when auto-scaling scaled image\n  data.  The ``BLANK`` keyword is now removed from the header after\n  auto-scaling is applied, and it is restored properly (with floating point\n  NaNs replaced by the filler value) when updating a file opened with the\n  ``scale_back=True`` argument.  Invalid usage of the ``BLANK`` keyword is\n  also better warned about during validation. [#3865]\n\n- Reading memmaped scaled images won't fail when\n  ``do_not_scale_image_data=True`` (that is, since we're just reading the raw\n  / physical data there is no reason mmap can't be used). [#3766]\n\n- Fixed a reference cycle that could sometimes cause FITS table-related\n  objects (``BinTableHDU``, ``ColDefs``, etc.) to hang around in memory\n  longer than expected. [#4012]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Improved support for pickling of compound models, including both compound\n  model instances, and new compound model classes. [#3867]\n\n- Added missing default values for ``Ellipse2D`` parameters. [#3903]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Fixed iteration of scalar ``Time`` objects so that ``iter()`` correctly\n  raises a ``TypeError`` on them (while still allowing ``Time`` arrays to be\n  iterated). [#4048]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Added frequency-equivalency check when declaring doppler equivalencies\n  [#3728]\n\n- Define ``floor_divide`` (``//``) for ``Quantity`` to be consistent\n  ``divmod``, such that it only works where the quotient is dimensionless.\n  This guarantees that ``(q1 // q2) * q2 + (q1 % q2) == q1``. [#3817]\n\n- Fixed the documentation of supported units to correctly report support for\n  SI prefixes.  Previously the table of supported units incorrectly showed\n  several derived unit as not supporting prefixes, when in fact they do.\n  [#3835]\n\n- Fix a crash when calling ``astropy.units.cds.enable()``.  This will now\n  \"set\" rather than \"add\" units to the active set to avoid the namespace\n  clash with the default units. [#3873]\n\n- Ensure in-place operations on ``float32`` quantities work. [#4007]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- The ``deprecated`` decorator did not correctly wrap classes that have a\n  custom metaclass--the metaclass could be dropped from the deprecated\n  version of the class. [#3997]\n\n- The ``wraps`` decorator would copy the wrapped function's name to the\n  wrapper function even when ``'__name__'`` is excluded from the ``assigned``\n  argument. [#4016]\n\nMisc\n^^^^\n\n- ``fitscheck`` no longer causes scaled image data to be rescaled when\n  adding checksums to existing files. [#3884]\n\n- Fixed an issue where running ``import astropy`` from within the source\n  tree did not automatically build the extension modules if the source is\n  from a source distribution (as opposed to a git repository). [#3932]\n\n- Fixed multiple instances of a bug that prevented Astropy from being used\n  when compiled with the ``python -OO`` flag, due to it causing all\n  docstrings to be stripped out. [#3923]\n\n- Removed source code template files that were being installed\n  accidentally alongside installed Python modules. [#4014]\n\n- Fixed a bug in the exception logging that caused a crash in the exception\n  handler itself on Python 3 when exceptions do not include a message.\n  [#4056]\n\n\n1.0.3 (2015-06-05)\n==================\n\nNew Features\n------------\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Greatly improved the speed of printing a large table to the screen when\n  only a few rows are being displayed. [#3796]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Add support for the 2015-Jun-30 leap second. [#3794]\n\nAPI Changes\n-----------\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Note that HTML formatted tables will not always be found with guess mode\n  unless it passes certain heuristics that strongly suggest the presence of\n  HTML in the input.  Code that expects to read tables from HTML should\n  specify ``format='html'`` explicitly. See bug fixes below for more\n  details. [#3693]\n\nBug Fixes\n---------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Fix issue with repeated normalizations of ``Kernels``. [#3747]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed ``get_sun`` to yield frames with the ``obstime`` set to what's passed into the function (previously it incorrectly always had J2000). [#3750]\n\n- Fixed ``get_sun`` to account for aberration of light. [#3750]\n\n- Fixed error in the GCRS->ICRS transformation that gave incorrect distances. [#3750]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Remove HTML from the list of automatically-guessed formats when reading if\n  the file does not appear to be HTML.  This was necessary to avoid a\n  commonly-encountered segmentation fault occurring in the libxml parser on\n  MacOSX. [#3693]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fixes to support the upcoming Numpy 1.10. [#3419]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Polynomials are now scaled when used in a compound model. [#3702]\n\n- Fixed the ``Ellipse2D`` model to be consistent with ``Disk2D`` in\n  how pixels are included. [#3736]\n\n- Fixed crash when evaluating a model that accepts no inputs. [#3772]\n\nastropy.testing\n^^^^^^^^^^^^^^^\n\n- The Astropy py.test plugins that disable unintentional internet access\n  in tests were also blocking use of local UNIX sockets in tests, which\n  prevented testing some multiprocessing code--fixed. [#3713]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Supported full SI prefixes for the barn unit (\"picobarn\", \"femtobarn\",\n  etc.)  [#3753]\n\n- Fix loss of precision when multiplying non-whole-numbered powers\n  of units together.  For example, before this change, ``(u.m **\n  1.5) ** Fraction(4, 5)`` resulted in an inaccurate floating-point\n  power of ``1.2000000000000002``.  After this change, the exact\n  rational number of ``Fraction(6, 5)`` is maintained. [#3790]\n\n- Fixed printing of object ndarrays containing multiple Quantity\n  objects with differing / incompatible units. Note: Unit conversion errors\n  now cause a ``UnitConversionError`` exception to be raised.  However, this\n  is a subclass of the ``UnitsError`` exception used previously, so existing\n  code that catches ``UnitsError`` should still work. [#3778]\n\nOther Changes and Additions\n---------------------------\n\n- Added a new ``astropy.__bibtex__`` attribute which gives a citation\n  for Astropy in bibtex format. [#3697]\n\n- The bundled version of ERFA was updated to v1.2.0 to address leapsecond\n  updates. [#3802]\n\n\n0.4.6 (2015-05-29)\n==================\n\nBug Fixes\n---------\n\nastropy.time\n^^^^^^^^^^^^\n\n- Fixed ERFA code to handle the 2015-Jun-30 leap second. [#3795]\n\n\n1.0.2 (2015-04-16)\n==================\n\nNew Features\n------------\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Added support for polynomials with degree 0 or degree greater than 15.\n  [#3574, 3589]\n\nBug Fixes\n---------\n\nastropy.config\n^^^^^^^^^^^^^^\n\n- The pre-astropy-0.4 configuration API has been fixed. It was\n  inadvertently broken in 1.0.1. [#3627]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fixed a severe memory leak that occurred when reading tile compressed\n  images. [#3680]\n\n- Fixed bug where column data could be unintentionally byte-swapped when\n  copying data from an existing FITS file to a new FITS table with a\n  TDIMn keyword for that column. [#3561]\n\n- The ``ColDefs.change_attrib``, ``ColDefs.change_name``, and\n  ``ColDefs.change_unit`` methods now work as advertised.  It is also\n  possible (and preferable) to update attributes directly on ``Column``\n  objects (for example setting ``column.name``), and the change will be\n  accurately reflected in any associated table data and its FITS header.\n  [#3283, #1539, #2618]\n\n- Fixes an issue with the ``FITS_rec`` interface to FITS table data, where a\n  ``FITS_rec`` created by copying an existing FITS table but adding new rows\n  could not be sliced or masked correctly.  [#3641]\n\n- Fixed handling of BINTABLE with TDIMn of size 1. [#3580]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Loading a ``TABLE`` element without any ``DATA`` now correctly\n  creates a 0-row array. [#3636]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Added workaround to support inverses on compound models when one of the\n  sub-models is itself a compound model with a manually-assigned custom\n  inverse. [#3542]\n\n- Fixed instantiation of polynomial models with constraints for parameters\n  (constraints could still be assigned after instantiation, but not during).\n  [#3606]\n\n- Fixed fitting of 2D polynomial models with the ``LeVMarLSQFitter``. [#3606]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Ensure ``QTable`` can be pickled [#3590]\n\n- Some corner cases when instantiating an ``astropy.table.Table``\n  with a Numpy array are handled [#3637]. Notably:\n\n- a zero-length array is the same as passing ``None``\n\n- a scalar raises a ``ValueError``\n\n- a one-dimensional array is treated as a single row of a table.\n\n- Ensure a ``Column`` without units is treated as an ``array``, not as an\n  dimensionless ``Quantity``. [#3648]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Ensure equivalencies that do more than just scale a ``Quantity`` are\n  properly handled also in ``ufunc`` evaluations. [#2496, #3586]\n\n- The LaTeX representation of the Angstrom unit has changed from\n  ``\\overset{\\circ}{A}`` to ``\\mathring{A}``, which should have\n  better support across regular LaTeX, MathJax and matplotlib (as of\n  version 1.5) [#3617]\n\nastropy.vo\n^^^^^^^^^^\n\n- Using HTTPS/SSL for communication between SAMP hubs now works\n  correctly on all supported versions of Python [#3613]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- When no ``relax`` argument is passed to ``WCS.to_header()`` and\n  the result omits non-standard WCS keywords, a warning is\n  emitted. [#3652]\n\nOther Changes and Additions\n---------------------------\n\nastropy.vo\n^^^^^^^^^^\n\n- The number of retries for connections in ``astropy.vo.samp`` can now be\n  configured by a ``n_retries`` configuration option. [#3612]\n\n- Testing\n\n- Running ``astropy.test()`` from within the IPython prompt has been\n  provisionally re-enabled. [#3184]\n\n\n1.0.1 (2015-03-06)\n==================\n\nBug Fixes\n---------\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\n- Ensure constants can be turned into ``Quantity`` safely. [#3537, #3538]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fix a segfault in the fast C parser when one of the column headers\n  is empty [#3545].\n\n- Fixed support for reading inf and nan values with the fast reader in\n  Windows.  Also fixed in the case of using ``use_fast_converter=True``\n  with the fast reader. [#3525]\n\n- Fixed use of mmap in the fast reader on Windows. [#3525]\n\n- Fixed issue where commented header would treat comments defining the table\n  (i.e. column headers) as purely information comments, leading to problems\n  when trying to round-trip the table. [#3562]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed propagation of parameter constraints ('fixed', 'bounds', 'tied')\n  between compound models and their components.  There is may still be some\n  difficulty defining 'tied' constraints properly for use with compound\n  models, however. [#3481]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Restore several properties to the compatibility class ``NDDataArray`` that\n  were inadvertently omitted [#3466].\n\nastropy.time\n^^^^^^^^^^^^\n\n- Time objects now always evaluate to ``True``, except when empty. [#3530]\n\nMiscellaneous\n-------------\n\n- The ERFA wrappers are now written directly in the Python/C API\n  rather than using Cython, for greater performance. [#3521]\n\n- Improve import time of astropy [#3488].\n\nOther Changes and Additions\n---------------------------\n\n- Updated bundled astropy-helpers version to v1.0.1 to address installation\n  issues with some packages that depend on Astropy. [#3541]\n\n\n1.0 (2015-02-18)\n================\n\nGeneral\n-------\n\n- Astropy now requires Numpy 1.6.0 or later.\n\nNew Features\n------------\n\nastropy.analytic_functions\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n- The ``astropy.analytic_functions`` was added to contain analytic functions\n  useful for astronomy [#3077].\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- ``astropy.coordinates`` now has a full stack of frames allowing\n  transformations from ICRS or other celestial systems down to Alt/Az\n  coordinates. [#3217]\n\n- ``astropy.coordinates`` now has a ``get_sun`` function that gives\n  the coordinates  of the Sun at a specified time. [#3217]\n\n- ``SkyCoord`` now has ``to_pixel`` and ``from_pixel`` methods that convert\n  between celestial coordinates as ``SkyCoord`` objects and pixel coordinates\n  given an ``astropy.wcs.WCS`` object. [#3002]\n\n- ``SkyCoord`` now has ``search_around_sky`` and ``search_around_3d``\n  convenience methods that allow searching for all coordinates within\n  a certain distance of another ``SkyCoord``. [#2953]\n\n- ``SkyCoord`` can now accept a frame instance for the ``frame=`` keyword\n  argument. [#3063]\n\n- ``SkyCoord`` now has a ``guess_from_table`` method that can be used to\n  quickly create ``SkyCoord`` objects from an ``astropy.table.Table``\n  object. [#2951]\n\n- ``astropy.coordinates`` now has a ``Galactocentric`` frame, a coordinate\n  frame centered on a (user specified) center of the Milky Way. [#2761, #3286]\n\n- ``SkyCoord`` now accepts more formats of the coordinate string when the\n  representation has ``ra`` and ``dec`` attributes. [#2920]\n\n- ``SkyCoord`` can now accept lists of ``SkyCoord`` objects, frame objects,\n  or representation objects and will combine them into a single object.\n  [#3285]\n\n- Frames and ``SkyCoord`` instances now have a method ``is_equivalent_frame``\n  that can be used to check that two frames are equivalent (ignoring the\n  data).  [#3330]\n\n- The ``__repr__`` of coordinate objects now shows scalar coordinates in the\n  same format as vector coordinates. [#3350, 3448]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Added ``lookback_distance``, which is ``c * lookback_time``. [#3145]\n\n- Add baryonic matter density and dark matter only density parameters\n  to cosmology objects [#2757].\n\n- Add a ``clone`` method to cosmology objects to allow copies\n  of cosmological objects to be created with the specified variables\n  modified [#2592].\n\n- Increase default numerical precision of ``z_at_value`` following\n  the accurate by default, fast by explicit request model [#3074].\n\n- Cosmology functions that take a single (redshift) input now\n  broadcast like numpy ufuncs.  So, passing an arbitrarily shaped\n  array of inputs will produce an output of the same shape. [#3178, #3194]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Simplify the way new Reader classes are defined, allowing custom behavior\n  entirely by overriding inherited class attributes instead of setting\n  instance attributes in the Reader ``__init__`` method. [#2812]\n\n- There is now a faster C/Cython engine available for reading and writing\n  simple ASCII formats like CSV. Both are enabled by default, and fast\n  reading will fall back on an ordinary reader in case of a parsing\n  failure. Their behavior can be altered with the parameter ``fast_reader``\n  in ``read`` and ``fast_writer`` in ``write``. [#2716]\n\n- Make Latex/AASTex tables use unit attribute of Column for output. [#3064]\n\n- Store comment lines encountered during reading in metadata of the\n  output table via ``meta['comment_lines']``. [#3222]\n\n- Write comment lines in Table metadata during output for all basic formats,\n  IPAC, and fast writers. This functionality can be disabled with\n  ``comment=False``. [#3255]\n\n- Add reader / writer for the Enhanced CSV format which stores table and\n  column meta data, in particular data type and unit. [#2319]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- The ``fitsdiff`` script ignores some things by default when comparing fits\n  files (e.g. empty header lines). This adds a ``--exact`` option where\n  nothing is ignored. [#2782, #3110]\n\n- The ``fitsheader`` script now takes a ``--keyword`` option to extract a\n  specific keyword from the header of a FITS file, and a ``--table`` option\n  to export headers into any of the data formats supported by\n  ``astropy.table``. [#2555, #2588]\n\n- ``Section`` now supports all advanced indexing features ``ndarray`` does\n  (slices with any steps, integer arrays, boolean arrays, None, Ellipsis).\n  It also properly returns scalars when this is appropriate. [#3148]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- ``astropy.io.votable.parse`` now takes a ``datatype_mapping``\n  keyword argument to map invalid datatype names to valid ones in\n  order to support non-compliant files. [#2675]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Added the capability of creating new \"compound\" models by combining\n  existing models using arithmetic operators.  See the \"What's New in 1.0\"\n  page in the Astropy documentation for more details. [#3231]\n\n- A new ``custom_model`` decorator/factory function has been added for\n  converting normal functions to ``Model`` classes that can work within\n  the Astropy modeling framework.  This replaces the old ``custom_model_1d``\n  function which is now deprecated.  The new function works the same as\n  the old one but is less limited in the types of models it can be used to\n  created.  [#1763]\n\n- The ``Model`` and ``Fitter`` classes have ``.registry`` attributes which\n  provide sets of all loaded ``Model`` and ``Fitter`` classes (this is\n  useful for building UIs for models and fitting). [#2725]\n\n- A dict-like ``meta`` member was added to ``Model``. it is to be used to\n  store any optional information which is relevant to a project and is not\n  in the standard ``Model`` class. [#2189]\n\n- Added ``Ellipse2D`` model. [#3124]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- New array-related utility functions in ``astropy.nddata.utils`` for adding\n  and removing arrays from other arrays with different sizes/shapes. [#3201]\n\n- New metaclass ``NDDataBase`` for enforcing the nddata interface in\n  subclasses without restricting implementation of the data storage. [#2905]\n\n- New mixin classes ``NDSlicingMixin`` for slicing, ``NDArithmeticMixin``\n  for arithmetic operations, and ``NDIOMixin`` for input/output in NDData. [#2905]\n\n- Added a decorator ``support_nddata`` that can be used to write functions\n  that can either take separate arguments or NDData objects. [#2855]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Added ``mad_std()`` function. [#3208]\n\n- Added ``gaussian_fwhm_to_sigma`` and ``gaussian_sigma_to_fwhm``\n  constants. [#3208]\n\n- New function ``sigma_clipped_stats`` which can be used to quickly get\n  common statistics for an array, using sigma clipping at the same time.\n  [#3201]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Changed the internal implementation of the ``Table`` class changed so that\n  it no longer uses numpy structured arrays as the core table data container.\n  [#2790, #3179]\n\n- Tables can now be written to an html file that includes interactive\n  browsing capabilities. To write out to this format, use\n  ``Table.write('filename.html', format='jsviewer')``. [#2875]\n\n- A ``quantity`` property and ``to`` method were added to ``Table``\n  columns that allow the column values to be easily converted to\n  ``astropy.units.Quantity`` objects. [#2950]\n\n- Add ``unique`` convenience method to table. [#3185]\n\nastropy.tests\n^^^^^^^^^^^^^\n\n- Added a new Quantity-aware ``assert_quantity_allclose``. [#3273]\n\nastropy.time\n^^^^^^^^^^^^\n\n- ``Time`` can now handle arbitrary array dimensions, with operations\n  following standard numpy broadcasting rules. [#3138]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Support for VOUnit has been updated to be compliant with version\n  1.0 of the standard. [#2901]\n\n- Added an ``insert`` method to insert values into a ``Quantity`` object.\n  This is similar to the ``numpy.insert`` function. [#3049]\n\n- When viewed in IPython, ``Quantity`` objects with array values now render\n  using LaTeX and scientific notation. [#2271]\n\n- Added ``units.quantity_input`` decorator to validate quantity inputs to a\n  function for unit compatibility. [#3072]\n\n- Added ``units.astronomical_unit`` as a long form for ``units.au``. [#3303]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Added a new decorator ``astropy.utils.wraps`` which acts as a replacement\n  for the standard library's ``functools.wraps``, the only difference being\n  that the decorated function also preserves the wrapped function's call\n  signature. [#2849]\n\n- ``astropy.utils.compat.numpy`` has been revised such that it can include\n  patched versions of routines from newer ``numpy`` versions.  The first\n  addition is a version of ``broadcast_arrays`` that can be used with\n  ``Quantity`` and other ``ndarray`` subclasses (using the ``subok=True``\n  flag). [#2327]\n\n- Added ``astropy.utils.resolve_name`` which returns a member of a module\n  or class given the fully qualified dotted name of that object as a\n  string. [#3389]\n\n- Added ``astropy.utils.minversion`` which can be used to check minimum\n  version requirements of Python modules (to test for specific features and/\n  or bugs and the like). [#3389]\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\n- Created ``astropy.visualization`` module and added functionality relating\n  to image normalization (i.e. stretching and scaling) as well as a new\n  script ``fits2bitmap`` that can produce a bitmap image from a FITS file.\n  [#3201]\n\n- Added dictionary ``astropy.visualization.mpl_style.astropy_mpl_style``\n  which can be used to set a uniform plotstyle specifically for tutorials\n  that is improved compared to matplotlib defaults. [#2719, #2787, #3200]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- ``wcslib`` has been upgraded to version 4.25.  This brings a\n  single new feature:\n\n- ``equinox`` and ``radesys`` will now be given default values\n  conforming with the WCS specification if ``EQUINOXa`` and\n  ``RADESYSa``, respectively, are not present in the header.\n\n- The minimum required version of ``wcslib`` is now 4.24. [#2503]\n\n- Added a new function ``wcs_to_celestial_frame`` that can be used to find\n  the astropy.coordinates celestial frame corresponding to a particular WCS.\n  [#2730]\n\n- ``astropy.wcs.WCS.compare`` now supports a ``tolerance`` keyword argument\n  to allow for approximate comparison of floating-point values. [#2503]\n\n- added ``pixel_scale_matrix``, ``celestial``, ``is_celestial``, and\n  ``has_celestial`` convenience attributes. Added\n  ``proj_plane_pixel_scales``, ``proj_plane_pixel_area``, and\n  ``non_celestial_pixel_scales`` utility functions for retrieving WCS pixel\n  scale and area information [#2832, #3304]\n\n- Added two functions ``pixel_to_skycoord`` and\n  ``skycoord_to_pixel`` that make it easy to convert between\n  SkyCoord objects and pixel coordinates. [#2885]\n\n- ``all_world2pix`` now uses a much more sophisticated and complete\n  algorithm to iteratively compute the inverse WCS transform. [#2816]\n\n- Add ability to use ``WCS`` object to define projections in Matplotlib,\n  using the ``WCSAxes`` package. [#3183]\n\n- Added ``is_proj_plane_distorted`` for testing if pixels are\n  distorted. [#3329]\n\nMisc\n^^^^\n\n- ``astropy._erfa`` was added as a new subpackage wrapping the functionality\n  of the ERFA library in python.  This is primarily of use for other astropy\n  subpackages, but the API may be made more public in the future. [#2992]\n\n\nAPI Changes\n-----------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Subclasses of ``BaseCoordinateFrame`` which define a custom ``repr`` should\n  be aware of the format expected in ``SkyCoord.__repr__()``, which changed in\n  this release. [#2704, #2882]\n\n- The ``CartesianPoints`` class (deprecated in v0.4) has now been removed.\n  [#2990]\n\n- The previous ``astropy.coordinates.builtin_frames`` module is now a\n  subpackage.  Everything that was in the\n  ``astropy.coordinates.builtin_frames`` module is still accessible from the\n  new package, but the classes are now in separate modules.  This should have\n  no direct impact at the user level. [#3120]\n\n- Support for passing a frame as a positional argument in the ``SkyCoord``\n  class has now been deprecated, except in the case where a frame with data\n  is passed as the sole positional argument. [#3152]\n\n- Improved ``__repr__`` of coordinate objects representing a single\n  coordinate point for the sake of easier copy/pasting. [#3350]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- The functional interface to the cosmological routines as well as\n  ``set_current`` and ``get_current`` (deprecated in v0.4) have now been\n  removed. [#2990]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Added a new argument to ``htmldict`` in the HTML reader named\n  ``parser``, which allows the user to specify which parser\n  BeautifulSoup should use as a backend. [#2815]\n\n- Add ``FixedWidthTwoLine`` reader to guessing. This will allows to read\n  tables that a copied from screen output like ``print my_table`` to be read\n  automatically. Discussed in #3025 and #3099 [#3109]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- A new optional argument ``cache`` has been added to\n  ``astropy.io.fits.open()``.  When opening a FITS file from a URL,\n  ``cache`` is a boolean value specifying whether or not to save the\n  file locally in Astropy's download cache (``True`` by default). [#3041]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Model classes should now specify ``inputs`` and ``outputs`` class\n  attributes instead of the old ``n_inputs`` and ``n_outputs``.  These\n  should be tuples providing human-readable *labels* for all inputs and\n  outputs of the model.  The length of the tuple indicates the numbers\n  of inputs and outputs.  See \"What's New in Astropy 1.0\" for more\n  details. [#2835]\n\n- It is no longer necessary to include ``__init__`` or ``__call__``\n  definitions in ``Model`` subclasses if all they do is wrap the\n  super-method in order to provide a nice call signature to the docs.\n  The ``inputs`` class attribute is now used to generate a nice call\n  signature, so these methods should only be overridden by ``Model``\n  subclasses in order to provide new functionality. [#2835]\n\n- Most models included in Astropy now have sensible default values for most\n  or all of their parameters.  Call ``help(ModelClass)`` on any model to\n  check what those defaults are.  Most of them time they should be\n  overridden, but some of them are useful (for example spatial offsets are\n  always set at the origin by default). Another rule of thumb is that, where\n  possible, default parameters are set so that the model is a no-op, or\n  close to it, by default. [#2932]\n\n- The ``Model.inverse`` method has been changed to a *property*, so that\n  now accessing ``model.inverse`` on a model returns a new model that\n  implements that model's inverse, and *calling* ``model.inverse(...)``` on\n  some independent variable computes the value of the inverse (similar to what\n  the old ``Model.invert()`` method was meant to do).  [#3024]\n\n- The ``Model.invert()`` method has been removed entirely (it was never\n  implemented and there should not be any existing code that relies on it).\n  [#3024]\n\n- ``custom_model_1d`` is deprecated in favor of the new ``custom_model``\n  (see \"New Features\" above).  [#1763]\n\n- The ``Model.param_dim`` property (deprecated in v0.4) has now been removed.\n  [#2990]\n\n- The ``Beta1D`` and ``Beta2D`` models have been renamed to ``Moffat1D`` and\n  ``Moffat2D``. [#3029]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- ``flags``, ``shape``, ``size``, ``dtype`` and ``ndim`` properties removed\n  from ``astropy.nddata.NDData``. [#2905]\n\n- Arithmetic operations, uncertainty propagation, slicing and automatic\n  conversion to a numpy array removed from ``astropy.nddata.NDData``. The\n  class ``astropy.nddata.NDDataArray`` is functionally equivalent to the\n  old ``NDData``.  [#2905]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- The ``Column.units`` property (deprecated in v0.3) has now been removed.\n  [#2990]\n\n- The ``Row.data`` and ``Table._data`` attributes have been deprecated\n  related to the change in Table implementation.  They are replaced by\n  ``Row.as_void()`` and ``Table.as_array()`` methods, respectively. [#2790]\n\n- The ``Table.create_mask`` method has been removed.  This undocumented\n  method was a development orphan and would cause corruption of the\n  table if called. [#2790]\n\n- The return type for integer item access to a Column (e.g. col[12] or\n  t['a'][12]) is now always a numpy scalar, numpy ``ndarray``, or numpy\n  ``MaskedArray``.  Previously if the column was multidimensional then a\n  Column object would be returned. [#3095]\n\n- The representation of Table and Column objects has been changed to\n  be formatted similar to the print output. [#3239]\n\nastropy.time\n^^^^^^^^^^^^\n\n- The ``Time.val`` and ``Time.vals`` properties (deprecated in v0.3) and the\n  ``Time.lon``, and ``Time.lat`` properties (deprecated in v0.4) have now\n  been removed. [#2990]\n\n- Add ``decimalyear`` format that represents time as a decimal year. [#3265]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Support for VOUnit has been updated to be compliant with version\n  1.0 of the standard. This means that some VOUnit strings that were\n  rejected before are now acceptable. [#2901] Notably:\n\n- SI prefixes are supported on most units\n\n- Binary prefixes are supported on \"bits\" and \"bytes\"\n\n- Custom units can be defined \"inline\" by placing them between single\n  quotes.\n\n- ``Unit.get_converter`` has been deprecated.  It is not strictly\n  necessary for end users, and it was confusing due to lack of\n  support for ``Quantity`` objects. [#3456]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Some members of ``astropy.utils.misc`` were moved into new submodules.\n  Specifically:\n\n- ``deprecated``, ``deprecated_attribute``, and ``lazyproperty`` ->\n  ``astropy.utils.decorators``\n\n- ``find_current_module``, ``find_mod_objs`` ->\n  ``astropy.utils.introspection``\n\n  All of these functions can be imported directly from ``astropy.utils``\n  which should be preferred over referencing individual submodules of\n  ``astropy.utils``.  [#2857]\n\n- The ProgressBar.iterate class method (deprecated in v0.3) has now been\n  removed. [#2990]\n\n- Updated ``astropy/utils/console.py`` ProgressBar() module to\n  display output to IPython notebook with the addition of an\n  ``interactive`` kwarg. [#2658, #2789]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- The ``WCS.calcFootprint`` method (deprecated in v0.4) has now been removed.\n  [#2990]\n\n- An invalid unit in a ``CUNITn`` keyword now displays a warning and\n  returns a ``UnrecognizedUnit`` instance rather than raising an\n  exception [#3190]\n\nBug Fixes\n---------\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- ``astropy.convolution.discretize_model`` now handles arbitrary callables\n  correctly [#2274].\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- ``Angle.to_string`` now outputs unicode arrays instead of object arrays.\n  [#2981]\n\n- ``SkyCoord.to_string`` no longer gives an error when used with an array\n  coordinate with more than one dimension. [#3340]\n\n- Fixed support for subclasses of ``UnitSphericalRepresentation`` and\n  ``SphericalRepresentation`` [#3354, #3366]\n\n- Fixed latex display of array angles in IPython notebook. [#3480]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- In the ``CommentedHeader`` the ``data_start`` parameter now defaults to\n  ``0``, which is the first uncommented line. Discussed in #2692. [#3054]\n\n- Position lines in ``FixedWidthTwoLine`` reader could consist of many characters.\n  Now, only one character in addition to the delimiter is allowed. This bug was\n  discovered as part of [#3109]\n\n- The IPAC table writer now consistently uses the ``fill_values`` keyword to\n  specify the output null values.  Previously the behavior was inconsistent\n  or incorrect. [#3259]\n\n- The IPAC table reader now correctly interprets abbreviated column types.\n  [#3279]\n\n- Tables that look almost, but not quite like DAOPhot tables could cause\n  guessing to fail. [#3342]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fixed the problem in ``fits.open`` of some filenames with colon (``:``) in\n  the name being recognized as URLs instead of file names. [#3122]\n\n- Setting ``memmap=True`` in ``fits.open`` and related functions now raises\n  a ValueError if opening a file in memory-mapped mode is impossible. [#2298]\n\n- CONTINUE cards no longer end the value of the final card in the series with\n  an ampersand, per the specification of the CONTINUE card convention. [#3282]\n\n- Fixed a crash that occurred when reading an ASCII table containing\n  zero-precision floating point fields. [#3422]\n\n- When a float field for an ASCII table has zero-precision a decimal point\n  (with no digits following it) is still written to the field as long as\n  there is space for it, as recommended by the FITS standard.  This makes it\n  less ambiguous that these columns should be interpreted as floats. [#3422]\n\nastropy.logger\n^^^^^^^^^^^^^^\n\n- Fix a bug that occurred when displaying warnings that produced an error\n  message ``dictionary changed size during iteration``. [#3353]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed a bug in ``SLSQPLSQFitter`` where the ``maxiter`` argument was not\n  passed correctly to the optimizer. [#3339]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix a problem where ``table.hstack`` fails to stack multiple references to\n  the same table, e.g. ``table.hstack([t, t])``. [#2995]\n\n- Fixed a problem where ``table.vstack`` and ``table.hstack`` failed to stack\n  a single table, e.g. ``table.vstack([t])``. [#3313]\n\n- Fix a problem when doing nested iterators on a single table. [#3358]\n\n- Fix an error when an empty list, tuple, or ndarray is used for item access\n  within a table.  This now returns the table with no rows. [#3442]\n\nastropy.time\n^^^^^^^^^^^^\n\n- When creating a Time object from a datetime object the time zone\n  info is now correctly used. [#3160]\n\n- For Time objects, it is now checked that numerical input is finite. [#3396]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Added a ``latex_inline`` unit format that returns the units in LaTeX math\n  notation with negative exponents instead of fractions [#2622].\n\n- When using a unit that is deprecated in a given unit format,\n  non-deprecated alternatives will be suggested. [#2806] For\n  example::\n\n      >>> import astropy.units as u\n      >>> u.Unit('Angstrom', format='fits')\n      WARNING: UnitsWarning: The unit 'Angstrom' has been deprecated\n      in the FITS standard. Suggested: nm (with data multiplied by\n      0.1).  [astropy.units.format.utils]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- ``treat_deprecations_as_exceptions`` has been fixed to recognize Astropy\n  deprecation warnings. [#3015]\n\n- Converted representation of progress bar units without suffix\n  from float to int in console.human_file_size. [#2201, #2202, #2721, #3299]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- ``astropy.wcs.WCS.sub`` now accepts unicode strings as input on\n  Python 2.x [#3356]\n\nMisc\n^^^^\n\n- Some modules and tests that would crash upon import when using a non-final\n  release of Numpy (e.g. 1.9.0rc1). [#3471]\n\nOther Changes and Additions\n---------------------------\n\n- The bundled copy of astropy-helpers has been updated to v1.0. [#3515]\n\n- Updated ``astropy.extern.configobj`` to Version 5. Version 5 uses ``six``\n  and the same code covers both Python 2 and Python 3. [#3149]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- The ``repr`` of ``SkyCoord`` and coordinate frame classes now separate\n  frame attributes and coordinate information.  [#2704, #2882]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Overwriting an existing file using the ``clobber=True`` option no longer\n  displays a warning message. [#1963]\n\n- ``fits.open`` no longer catches ``OSError`` exceptions on missing or\n  unreadable files-- instead it raises the standard Python exceptions in such\n  cases. [#2756, #2785]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Sped up setting of ``Column`` slices by an order of magnitude. [#2994, #3020]\n\n- Updated the bundled ``six`` module to version 1.7.3 and made 1.7.3 the\n  minimum acceptable version of ``six``. [#2814]\n\n- The version of ERFA included with Astropy is now v1.1.1 [#2971]\n\n- The code base is now fully Python 2 and 3 compatible and no longer requires\n  2to3. [#2033]\n\n- `funcsigs <https://pypi.org/project/funcsigs>`_ is included in\n  utils.compat, but defaults to the inspect module components where available\n  (3.3+) [#3151].\n\n- The list of modules displayed in the pytest header can now be customized.\n  [#3157]\n\n- `jinja2 <http://jinja.pocoo.org/docs/dev/>`_>=2.7 is now required to build the\n  source code from the git repository, in order to allow the ERFA wrappers to\n  be generated. [#3166]\n\n\n0.4.5 (2015-02-16)\n==================\n\nBug Fixes\n---------\n\n- Fixed unnecessary attempt to run ``git`` when importing astropy.  In\n  particular, fixed a crash in Python 3 that could result from this when\n  importing Astropy when the the current working directory is an empty git\n  repository. [#3475]\n\nOther Changes and Additions\n---------------------------\n\n- Updated bundled copy of astropy-helpers to v0.4.6. [#3508]\n\n\n0.4.4 (2015-01-21)\n==================\n\nBug Fixes\n---------\n\nastropy.vo.samp\n^^^^^^^^^^^^^^^\n\n- ``astropy.vo.samp`` is now usable on Python builds that do not\n  support the SSLv3 protocol (which depends both on the version of\n  Python and the version of OpenSSL or LibreSSL that it is built\n  against.) [#3308]\n\nAPI Changes\n-----------\n\nastropy.vo.samp\n^^^^^^^^^^^^^^^\n\n- The default SSL protocol used is now determined from the default\n  used in the Python ``ssl`` standard library.  This default may be\n  different depending on the exact version of Python you are using.\n  [#3308]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- WCS allows slices of the form slice(None, x, y), which previously resulted\n  in an unsliced copy being returned (note: this was previously incorrectly\n  reported as fixed in v0.4.3) [#2909]\n\n\n0.4.3 (2015-01-15)\n==================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- The ``Distance`` class has been fixed to no longer rely on the deprecated\n  cosmology functions. [#2991]\n\n- Ensure ``float32`` values can be used in coordinate representations. [#2983]\n\n- Fix frame attribute inheritance in ``SkyCoord.transform_to()`` method so\n  that the default attribute value (e.g. equinox) for the destination frame\n  gets used if no corresponding value was explicitly specified. [#3106]\n\n- ``Angle`` accepts hours:mins or deg:mins initializers (without\n  seconds). In these cases float minutes are also accepted. [#2843]\n\n- ``astropy.coordinates.SkyCoord`` objects are now copyable. [#2888]\n\n- ``astropy.coordinates.SkyCoord`` object attributes are now\n  immutable.  It is still technically possible to change the\n  internal data for an array-valued coordinate object but this leads\n  to inconsistencies [#2889] and should not be done. [#2888]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- The ``ztol`` keyword argument to z_at_value now works correctly [#2993].\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fix a bug in Python 3 when guessing file format using a file object as\n  input.  Also improve performance in same situation for Python 2. [#3132]\n\n- Fix a problem where URL was being downloaded for each guess. [#2001]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- The ``in`` operator now works correctly for checking if an extension\n  is in an ``HDUList`` (as given via EXTNAME, (EXTNAME, EXTVER) tuples,\n  etc.) [#3060]\n\n- Added workaround for bug in MacOS X <= 10.8 that caused np.fromfile to\n  fail. [#3078]\n\n- Added support for the ``RICE_ONE`` compression type synonym. [#3115]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed a test failure on Debian/PowerPC and Debian/s390x. [#2708]\n\n- Fixed crash in evaluating models that have more outputs than inputs--this\n  case may not be handled as desired for all conceivable models of this\n  format (some may have to implement custom ``prepare_inputs`` and\n  ``prepare_outputs`` methods).  But as long as all outputs can be assumed\n  to have a shape determined from the broadcast of all inputs with all\n  parameters then this can be used safely. [#3250]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fix a bug that caused join to fail for multi-dimensional columns. [#2984]\n\n- Fix a bug where MaskedColumn attributes which had been changed since\n  the object was created were not being carried through when slicing. [#3023]\n\n- Fix a bug that prevented initializing a table from a structured array\n  with multi-dimensional columns with copy=True. [#3034]\n\n- Fixed unnecessarily large unicode columns when instantiating a table from\n  row data on Python 3. [#3052]\n\n- Improved the warning message when unable to aggregate non-numeric\n  columns. [#2700]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Operations on quantities with incompatible types now raises a much\n  more informative ``TypeError``. [#2934]\n\n- ``Quantity.tolist`` now overrides the ``ndarray`` method to give a\n  ``NotImplementedError`` (by renaming the previous ``list`` method). [#3050]\n\n- ``Quantity.round`` now always returns a ``Quantity`` (previously it\n  returned an ``ndarray`` for ``decimals>0``). [#3062]\n\n- Ensured ``np.squeeze`` always returns a ``Quantity`` (it only worked if\n  no dimensions were removed). [#3045]\n\n- Input to ``Quantity`` with a ``unit`` attribute no longer can get mangled\n  with ``copy=False``. [#3051]\n\n- Remove trailing space in ``__format__`` calls for dimensionless quantities.\n  [#3097]\n\n- Comparisons between units and non-unit-like objects now works\n  correctly. [#3108]\n\n- Units with fractional powers are now correctly multiplied together\n  by using rational arithmetic.  [#3121]\n\n- Removed a few entries from spectral density equivalencies which did not\n  make sense. [#3153]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Fixed an issue with the ``deprecated`` decorator on classes that invoke\n  ``super()`` in their ``__init__`` method. [#3004]\n\n- Fixed a bug which caused the ``metadata_conflicts`` parameter to be\n  ignored in the ``astropy.utils.metadata.merge`` function. [#3294]\n\nastropy.vo\n^^^^^^^^^^\n\n- Fixed an issue with reconnecting to a SAMP Hub. [#2674]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Invalid or out of range values passed to ``wcs_world2pix`` will\n  now be correctly identified and returned as ``nan``\n  values. [#2965]\n\n- Fixed an issue which meant that Python thought ``WCS`` objects were\n  iterable. [#3066]\n\nMisc\n^^^^\n\n- Astropy will now work if your Python interpreter does not have the\n  ``bz2`` module installed. [#3104]\n\n- Fixed ``ResourceWarning`` for ``astropy/extern/bundled/six.py`` that could\n  occur sometimes after using Astropy in Python 3.4. [#3156]\n\nOther Changes and Additions\n---------------------------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Improved the agreement of the FK5 <-> Galactic conversion with other\n  codes, and with the FK5 <-> FK4 <-> Galactic route. [#3107]\n\n\n0.4.2 (2014-09-23)\n==================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- ``Angle`` accepts hours:mins or deg:mins initializers (without\n  seconds). In these cases float minutes are also accepted.\n\n- The ``repr`` for coordinate frames now displays the frame attributes\n  (ex: ra, dec) in a consistent order.  It should be noted that as part of\n  this fix, the ``BaseCoordinateFrame.get_frame_attr_names()`` method now\n  returns an ``OrderedDict`` instead of just a ``dict``. [#2845]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Fixed a crash when reading scaled float data out of a FITS file that was\n  loaded from a string (using ``HDUList.fromfile``) rather than from a file.\n  [#2710]\n\n- Fixed a crash when reading data from an HDU whose header contained in\n  invalid value for the BLANK keyword (e.g., a string value instead of an\n  integer as required by the FITS Standard). Invalid BLANK keywords are now\n  warned about, but are otherwise ignored. [#2711]\n\n- Fixed a crash when reading the header of a tile-compressed HDU if that\n  header contained invalid duplicate keywords resulting in a ``KeyError``\n  [#2750]\n\n- Fixed crash when reading gzip-compressed FITS tables through the Astropy\n  ``Table`` interface. [#2783]\n\n- Fixed corruption when writing new FITS files through to gzipped files.\n  [#2794]\n\n- Fixed crash when writing HDUs made with non-contiguous data arrays to\n  file-like objects. [#2794]\n\n- It is now possible to create ``astropy.io.fits.BinTableHDU``\n  objects with a table with zero rows. [#2916]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Fixed a bug that prevented h5py ``Dataset`` objects from being\n  automatically recognized by ``Table.read``. [#2831]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Make ``LevMarLSQFitter`` work with ``weights`` keyword. [#2900]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fixed reference cycle in tables that could prevent ``Table`` objects\n  from being freed from memory. [#2879]\n\n- Fixed an issue where ``Table.pprint()`` did not print the header to\n  ``stdout`` when ``stdout`` is redirected (say, to a file). [#2878]\n\n- Fixed printing of masked values when a format is specified. [#1026]\n\n- Ensured that numpy ufuncs that return booleans return plain ``ndarray``\n  instances, just like the comparison operators. [#2963]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Ensure bigendian input to Time works on a little-endian machine\n  (and vice versa).  [#2942]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Ensure unit is kept when adding 0 to quantities. [#2968]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Fixed color printing on Windows with IPython 2.0. [#2878]\n\nastropy.vo\n^^^^^^^^^^\n\n- Improved error message on Cone Search time out. [#2687]\n\nOther Changes and Additions\n---------------------------\n\n- Fixed a couple issues with files being inappropriately included and/or\n  excluded from the source archive distributions of Astropy. [#2843, #2854]\n\n- As part of fixing the fact that masked elements of table columns could not be\n  printed when a format was specified, the column format string options were\n  expanded to allow simple specifiers such as ``'5.2f'``. [#2898]\n\n- Ensure numpy 1.9 is supported. [#2917]\n\n- Ensure numpy master is supported, by making ``np.cbrt`` work with quantities.\n  [#2937]\n\n0.4.1 (2014-08-08)\n==================\n\nBug Fixes\n---------\n\nastropy.config\n^^^^^^^^^^^^^^\n\n- Fixed a bug where an unedited configuration file from astropy\n  0.3.2 would not be correctly identified as unedited. [#2772] This\n  resulted in the warning::\n\n      WARNING: ConfigurationChangedWarning: The configuration options\n      in astropy 0.4 may have changed, your configuration file was not\n      updated in order to preserve local changes.  A new configuration\n      template has been saved to\n      '~/.astropy/config/astropy.0.4.cfg'. [astropy.config.configuration]\n\n- Fixed the error message that is displayed when an old\n  configuration item has moved.  Before, the destination\n  section was wrong.  [#2772]\n\n- Added configuration settings for ``io.fits``, ``io.votable`` and\n  ``table.jsviewer`` that were missing from the configuration file\n  template. [#2772]\n\n- The configuration template is no longer rewritten on every import\n  of astropy, causing race conditions. [#2805]\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed the multiplication of ``Kernel`` with numpy floats. [#2174]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- ``Distance`` can now take a list of quantities. [#2261]\n\n- For in-place operations for ``Angle`` instances in which the result unit\n  is not an angle, an exception is raised before the instance is corrupted.\n  [#2718]\n\n- ``CartesianPoints`` are now deprecated in favor of\n  ``CartesianRepresentation``. [#2727]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- An existing table within an HDF5 file can be overwritten without affecting\n  other datasets in the same HDF5 file by simultaneously using\n  ``overwrite=True`` and ``append=True`` arguments to the ``Table.write``\n  method. [#2624]\n\nastropy.logger\n^^^^^^^^^^^^^^\n\n- Fixed a crash that could occur in rare cases when (such as in bundled\n  apps) where submodules of the ``email`` package are not importable. [#2671]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- ``astropy.nddata.NDData()`` no longer raises a ``ValueError`` when passed\n  a numpy masked array which has no masked entries. [#2784]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- When saving a table to a FITS file containing a unit that is not\n  supported by the FITS standard, a warning rather than an exception\n  is raised. [#2797]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- By default, ``Quantity`` and its subclasses will now convert to float also\n  numerical types such as ``decimal.Decimal``, which are stored as objects\n  by numpy. [#1419]\n\n- The units ``count``, ``pixel``, ``voxel`` and ``dbyte`` now output\n  to FITS, OGIP and VOUnit formats correctly. [#2798]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Restored missing information from deprecation warning messages\n  from the ``deprecated`` decorator. [#2811]\n\n- Fixed support for ``staticmethod`` deprecation in the ``deprecated``\n  decorator. [#2811]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Fixed a memory leak when ``astropy.wcs.WCS`` objects are copied\n  [#2754]\n\n- Fixed a crash when passing ``ra_dec_order=True`` to any of the\n  ``*2world`` methods. [#2791]\n\nOther Changes and Additions\n---------------------------\n\n- Bundled copy of astropy-helpers upgraded to v0.4.1. [#2825]\n\n- General improvements to documentation and docstrings [#2722, #2728, #2742]\n\n- Made it easier for third-party packagers to have Astropy use their own\n  version of the ``six`` module (so long as it meets the minimum version\n  requirement) and remove the copy bundled with Astropy.  See the\n  astropy/extern/README file in the source tree.  [#2623]\n\n\n0.4 (2014-07-16)\n================\n\nNew Features\n------------\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\n- Added ``b_wien`` to represent Wien wavelength displacement law constant.\n  [#2194]\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Changed the input parameter in ``Gaussian1DKernel`` and\n  ``Gaussian2DKernel`` from ``width`` to ``stddev`` [#2085].\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- The coordinates package has undergone major changes to implement\n  `APE5 <https://github.com/astropy/astropy-APEs/blob/master/APE5.rst>`_ .\n  These include backwards-incompatible changes, as the underlying framework\n  has changed substantially. See the APE5 text and the package documentation\n  for more details. [#2422]\n\n- A ``position_angle`` method has been added to the new ``SkyCoord``. [#2487]\n\n- Updated ``Angle.dms`` and ``Angle.hms`` to return ``namedtuple`` -s instead\n  of regular tuples, and added ``Angle.signed_dms`` attribute that gives the\n  absolute value of the ``d``, ``m``, and ``s`` along with the sign.  [#1988]\n\n- By default, ``Distance`` objects are now required to be positive. To\n  allow negative values, set ``allow_negative=True`` in the ``Distance``\n  constructor when creating a ``Distance`` instance.\n\n- ``Longitude`` (resp. ``Latitude``) objects cannot be used any more to\n  initialize or set ``Latitude`` (resp. ``Longitude``) objects. An explicit\n  conversion to ``Angle`` is now required. [#2461]\n\n- The deprecated functions for pre-0.3 coordinate object names like\n  ``ICRSCoordinates`` have been removed. [#2422]\n\n- The ``rotation_matrix`` and ``angle_axis`` functions in\n  ``astropy.coordinates.angles`` were made more numerically consistent and\n  are now tested explicitly [#2619]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Added ``z_at_value`` function to find the redshift at which a cosmology\n  function matches a desired value. [#1909]\n\n- Added ``FLRW.differential_comoving_volume`` method to give the differential\n  comoving volume at redshift z. [#2103]\n\n- The functional interface is now deprecated in favor of the more-explicit\n  use of methods on cosmology objects. [#2343]\n\n- Updated documentation to reflect the removal of the functional\n  interface. [#2507]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- The ``astropy.io.ascii`` output formats ``latex`` and ``aastex`` accept a\n  dictionary called ``latex_dict`` to specify options for LaTeX output.  It is\n  now possible to specify the table alignment within the text via the\n  ``tablealign`` keyword. [#1838]\n\n- If ``header_start`` is specified in a call to ``ascii.get_reader`` or any\n  method that calls ``get_reader`` (e.g. ``ascii.read``) but ``data_start``\n  is not specified at the same time, then ``data_start`` is calculated so\n  that the data starts after the header. Before this, the default was\n  that the header line was read again as the first data line\n  [#855 and #1844].\n\n- A new ``csv`` format was added as a convenience for handling CSV (comma-\n  separated values) data. [#1935]\n  This format also recognises rows with an inconsistent number of elements.\n  [#1562]\n\n- An option was added to guess the start of data for CDS format files when\n  they do not strictly conform to the format standard. [#2241]\n\n- Added an HTML reader and writer to the ``astropy.io.ascii`` package.\n  Parsing requires the installation of BeautifulSoup and is therefore\n  an optional feature. [#2160]\n\n- Added support for inputting column descriptions and column units\n  with the ``io.ascii.SExtractor`` reader. [#2372]\n\n- Allow the use of non-local ReadMe files in the CDS reader. [#2329]\n\n- Provide a mechanism to select how masked values are printed. [#2424]\n\n- Added support for reading multi-aperture daophot file. [#2656]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Included a new command-line script called ``fitsheader`` to display the\n  header(s) of a FITS file from the command line. [#2092]\n\n- Added new verification options ``fix+ignore``, ``fix+warn``,\n  ``fix+exception``, ``silentfix+ignore``, ``silentfix+warn``, and\n  ``silentfix+exception`` which give more control over how to report fixable\n  errors as opposed to unfixable errors.\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Prototype implementation of fitters that treat optimization algorithms\n  separately from fit statistics, allowing new fitters to be created by\n  mixing and matching optimizers and statistic functions. [#1914]\n\n- Slight overhaul to how inputs to and outputs from models are handled with\n  respect to array-valued parameters and variables, as well as sets of\n  multiple models.  See the associated PR and the modeling section of the\n  v0.4 documentation for more details. [#2634]\n\n- Added a new ``SimplexLSQFitter`` which uses a downhill simplex optimizer\n  with a least squares statistic. [#1914]\n\n- Changed ``Gaussian2D`` model such that ``theta`` now increases\n  counterclockwise. [#2199]\n\n- Replaced the ``MatrixRotation2D`` model with a new model called simply\n  ``Rotation2D`` which requires only an angle to specify the rotation.\n  The new ``Rotation2D`` rotates in a counter-clockwise sense whereas\n  the old ``MatrixRotation2D`` increased the angle clockwise.\n  [#2266, #2269]\n\n- Added a new ``AffineTransformation2D`` model which serves as a\n  replacement for the capability of ``MatrixRotation2D`` to accept an\n  arbitrary matrix, while also adding a translation capability. [#2269]\n\n- Added ``GaussianAbsorption1D`` model. [#2215]\n\n- New ``Redshift`` model [#2176].\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Allow initialization ``NDData`` or ``StdDevUncertainty`` with a\n  ``Quantity``. [#2380]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Added flat prior to binom_conf_interval and binned_binom_proportion\n\n- Change default in ``sigma_clip`` from ``np.median`` to ``np.ma.median``.\n  [#2582]\n\nastropy.sphinx\n^^^^^^^^^^^^^^\n\n- Note, the following new features are included in astropy-helpers as well:\n\n- The ``automodapi`` and ``automodsumm`` extensions now include sphinx\n  configuration options to write out what ``automodapi`` and ``automodsumm``\n  generate, mainly for debugging purposes. [#1975, #2022]\n\n- Reference documentation now shows functions/class docstrings at the\n  intended user-facing API location rather than the actual file where\n  the implementation is found. [#1826]\n\n- The ``automodsumm`` extension configuration was changed to generate\n  documentation of class ``__call__`` member functions. [#1817, #2135]\n\n- ``automodapi`` and ``automodsumm`` now have an ``:allowed-package-names:``\n  option that make it possible to document functions and classes that\n  are in a different namespace.  [#2370]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Improved grouped table aggregation by using the numpy ``reduceat()`` method\n  when possible. This can speed up the operation by a factor of at least 10\n  to 100 for large unmasked tables and columns with relatively small\n  group sizes.  [#2625]\n\n- Allow row-oriented data input using a new ``rows`` keyword argument.\n  [#850]\n\n- Allow subclassing of ``Table`` and the component classes ``Row``, ``Column``,\n  ``MaskedColumn``, ``TableColumns``, and ``TableFormatter``. [#2287]\n\n- Fix to allow numpy integer types as valid indices into tables in\n  Python 3.x [#2477]\n\n- Remove transition code related to the order change in ``Column`` and\n  ``MaskedColumn`` arguments ``name`` and ``data`` from Astropy 0.2\n  to 0.3. [#2511]\n\n- Change HTML table representation in IPython notebook to show all\n  table columns instead of restricting to 80 column width.  [#2651]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Mean and apparent sidereal time can now be calculated using the\n  ``sidereal_time`` method [#1418].\n\n- The time scale now defaults to UTC if no scale is provided. [#2091]\n\n- ``TimeDelta`` objects can have all scales but UTC, as well as, for\n  consistency with time-like quantities, undefined scale (where the\n  scale is taken from the object one adds to or subtracts from).\n  This allows, e.g., to work consistently in TDB.  [#1932]\n\n- ``Time`` now supports ISO format strings that end in \"Z\". [#2211, #2203]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Support for the unit format `Office of Guest Investigator Programs (OGIP)\n  FITS files\n  <https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/general/ogip_93_001/>`__\n  has been added. [#377]\n\n- The ``spectral`` equivalency can now handle angular wave number. [#1306 and\n  #1899]\n\n- Added ``one`` as a shorthand for ``dimensionless_unscaled``. [#1980]\n\n- Added ``dex`` and ``dB`` units. [#1628]\n\n- Added ``temperature()`` equivalencies to support conversion between\n  Kelvin, Celsius, and Fahrenheit. [#2209]\n\n- Added ``temperature_energy()`` equivalencies to support conversion\n  between electron-volt and Kelvin. [#2637]\n\n- The runtime of ``astropy.units.Unit.compose`` is greatly improved\n  (by a factor of 2 in most cases) [#2544]\n\n- Added ``electron`` unit. [#2599]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- ``timer.RunTimePredictor`` now uses ``astropy.modeling`` in its\n  ``do_fit()`` method. [#1896]\n\nastropy.vo\n^^^^^^^^^^\n\n- A new sub-package, ``astropy.vo.samp``, is now available (this was\n  previously the SAMPy package, which has been refactored for use in\n  Astropy). [#1907]\n\n- Enhanced functionalities for ``VOSCatalog`` and ``VOSDatabase``. [#1206]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- astropy now requires wcslib version 4.23.  The version of wcslib\n  included with astropy has been updated to version 4.23.\n\n- Bounds checking is now performed on native spherical\n  coordinates.  Any out-of-bounds values will be returned as\n  ``NaN``, and marked in the ``stat`` array, if using the\n  low-level ``wcslib`` interface such as\n  ``astropy.wcs.Wcsprm.p2s``. [#2107]\n\n- A new method, ``astropy.wcs.WCS.compare()``, compares two wcsprm\n  structs for equality with varying degrees of strictness. [#2361]\n\n- New ``astropy.wcs.utils`` module, with a handful of tools for manipulating\n  WCS objects, including dropping, swapping, and adding axes.\n\nMisc\n^^^^\n\n- Includes the new astropy-helpers package which separates some of Astropy's\n  build, installation, and documentation infrastructure out into an\n  independent package, making it easier for Affiliated Packages to depend on\n  these features.  astropy-helpers replaces/deprecates some of the submodules\n  in the ``astropy`` package (see API Changes below).  See also\n  `APE 4 <https://github.com/astropy/astropy-APEs/blob/master/APE4.rst>`_\n  for more details on the motivation behind and implementation of\n  astropy-helpers.  [#1563]\n\n\nAPI Changes\n-----------\n\nastropy.config\n^^^^^^^^^^^^^^\n\n- The configuration system received a major overhaul, as part of APE3.  It is\n  no longer possible to save configuration items from Python, but instead\n  users must edit the configuration file directly.  The locations of\n  configuration items have moved, and some have been changed to science state\n  values.  The old locations should continue to work until astropy 0.5, but\n  deprecation warnings will be displayed.  See the `Configuration transition\n  <https://docs.astropy.org/en/v0.4/config/config_0_4_transition.html>`_\n  docs for a detailed description of the changes and how to update existing\n  code. [#2094]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- The ``astropy.io.fits.new_table`` function is now fully deprecated (though\n  will not be removed for a long time, considering how widely it is used).\n\n  Instead please use the more explicit ``BinTableHDU.from_columns`` to create\n  a new binary table HDU, and the similar ``TableHDU.from_columns`` to create\n  a new ASCII table.  These otherwise accept the same arguments as\n  ``new_table`` which is now just a wrapper for these.\n\n- The ``.fromstring`` classmethod of each HDU type has been simplified such\n  that, true to its namesake, it only initializes an HDU from a string\n  containing its header *and* data.\n\n- Fixed an issue where header wildcard matching (for example\n  ``header['DATE*']``) can be used to match *any* characters that might\n  appear in a keyword.  Previously this only matched keywords containing\n  characters in the set ``[0-9A-Za-z_]``.  Now this can also match a hyphen\n  ``-`` and any other characters, as some conventions like ``HIERARCH`` and\n  record-valued keyword cards allow a wider range of valid characters than\n  standard FITS keywords.\n\n- This will be the *last* release to support the following APIs that have\n  been marked deprecated since Astropy v0.1/PyFITS v3.1:\n\n- The ``CardList`` class, which was part of the old header implementation.\n\n- The ``Card.key`` attribute.  Use ``Card.keyword`` instead.\n\n- The ``Card.cardimage`` and ``Card.ascardimage`` attributes.  Use simply\n  ``Card.image`` or ``str(card)`` instead.\n\n- The ``create_card`` factory function.  Simply use the normal ``Card``\n  constructor instead.\n\n- The ``create_card_from_string`` factory function.  Use ``Card.fromstring``\n  instead.\n\n- The ``upper_key`` function.  Use ``Card.normalize_keyword`` method\n  instead (this is not unlikely to be used outside of PyFITS itself, but it\n  was technically public API).\n\n- The usage of ``Header.update`` with ``Header.update(keyword, value,\n  comment)`` arguments.  ``Header.update`` should only be used analogously\n  to ``dict.update``.  Use ``Header.set`` instead.\n\n- The ``Header.ascard`` attribute.  Use ``Header.cards`` instead for a list\n  of all the ``Card`` objects in the header.\n\n- The ``Header.rename_key`` method.  Use ``Header.rename_keyword`` instead.\n\n- The ``Header.get_history`` method.  Use ``header['HISTORY']`` instead\n  (normal keyword lookup).\n\n- The ``Header.get_comment`` method.  Use ``header['COMMENT']`` instead.\n\n- The ``Header.toTxtFile`` method.  Use ``header.totextfile`` instead.\n\n- The ``Header.fromTxtFile`` method.  Use ``Header.fromtextfile`` instead.\n\n- The ``tdump`` and ``tcreate`` functions.  Use ``tabledump`` and\n  ``tableload`` respectively.\n\n- The ``BinTableHDU.tdump`` and ``tcreate`` methods.  Use\n  ``BinTableHDU.dump`` and ``BinTableHDU.load`` respectively.\n\n- The ``txtfile`` argument to the ``Header`` constructor.  Use\n  ``Header.fromfile`` instead.\n\n- The ``startColumn`` and ``endColumn`` arguments to the ``FITS_record``\n  constructor.  These are unlikely to be used by any user code.\n\n  These deprecated interfaces will be removed from the development version of\n  Astropy following the v0.4 release (they will still be available in any\n  v0.4.x bugfix releases, however).\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- The method computing the derivative of the model with respect\n  to parameters was renamed from ``deriv`` to ``fit_deriv``. [#1739]\n\n- ``ParametricModel`` and the associated ``Parametric1DModel`` and\n  ``Parametric2DModel`` classes have been renamed ``FittableModel``,\n  ``Fittable1DModel``, and ``Fittable2DModel`` respectively.  The base\n  ``Model`` class has subsumed the functionality of the old\n\n  ``ParametricModel`` class so that all models support parameter constraints.\n  The only distinction of ``FittableModel`` is that anything which subclasses\n  it is assumed \"safe\" to use with Astropy fitters. [#2276]\n\n- ``NonLinearLSQFitter`` has been renamed ``LevMarLSQFitter`` to emphasise\n  that it uses the Levenberg-Marquardt optimization algorithm with a\n  least squares statistic function. [#1914]\n\n- The ``SLSQPFitter`` class has been renamed ``SLSQPLSQFitter`` to emphasize\n  that it uses the Sequential Least Squares Programming optimization\n  algorithm with a least squares statistic function. [#1914]\n\n- The ``Fitter.errorfunc`` method has been renamed to the more general\n  ``Fitter.objective_function``. [#1914]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Issue warning if unit is changed from a non-trivial value by directly\n  setting ``NDData.unit``. [#2411]\n\n- The ``mask`` and ``flag`` attributes of ``astropy.nddata.NDData`` can now\n  be set with any array-like object instead of requiring that they be set\n  with a ``numpy.ndarray``. [#2419]\n\nastropy.sphinx\n^^^^^^^^^^^^^^\n\n- Use of the ``astropy.sphinx`` module is deprecated; all new development of\n  this module is in ``astropy_helpers.sphinx`` which should be used instead\n  (therefore documentation builds that made use of any of the utilities in\n  ``astropy.sphinx`` now have ``astropy_helpers`` as a documentation\n  dependency).\n\nastropy.table\n^^^^^^^^^^^^^\n\n- The default table printing function now shows a table header row for units\n  if any columns have the unit attribute set.  [#1282]\n\n- Before, an unmasked ``Table`` was automatically converted to a masked\n  table if generated from a masked Table or a ``MaskedColumn``.\n  Now, this conversion is only done if explicitly requested or if any\n  of the input values is actually masked. [#1185]\n\n- The repr() function of ``astropy.table.Table`` now shows the units\n  if any columns have the unit attribute set.  [#2180]\n\n- The semantics of the config options ``table.max_lines`` and\n  ``table.max_width`` has changed slightly.  If these values are not\n  set in the config file, astropy will try to determine the size\n  automatically from the terminal. [#2683]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Correct use of UT in TDB calculation [#1938, #1939].\n\n- ``TimeDelta`` objects can have scales other than TAI [#1932].\n\n- Location information should now be passed on via an ``EarthLocation``\n  instance or anything that initialises it, e.g., a tuple containing\n  either geocentric or geodetic coordinates. [#1928]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- ``Quantity`` now converts input to float by default, as this is physically\n  most sensible for nearly all units [#1776].\n\n- ``Quantity`` comparisons with ``==`` or ``!=`` now always return ``True``\n  or ``False``, even if units do not match (for which case a ``UnitsError``\n  used to be raised).  [#2328]\n\n- Applying ``float`` or ``int`` to a ``Quantity`` now works for all\n  dimensionless quantities; they are automatically converted to unscaled\n  dimensionless. [#2249]\n\n- The exception ``astropy.units.UnitException``, which was\n  deprecated in astropy 0.2, has been removed.  Use\n  ``astropy.units.UnitError`` instead [#2386]\n\n- Initializing a ``Quantity`` with a valid number/array with a ``unit``\n  attribute now interprets that attribute as the units of the input value.\n  This makes it possible to initialize a ``Quantity`` from an Astropy\n  ``Table`` column and have it correctly pick up the units from the column.\n  [#2486]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- ``calcFootprint`` was deprecated. It is replaced by\n  ``calc_footprint``.  An optional boolean keyword ``center`` was\n  added to ``calc_footprint``.  It controls whether the centers or\n  the corners of the pixels are used in the computation. [#2384]\n\n- ``astropy.wcs.WCS.sip_pix2foc`` and\n  ``astropy.wcs.WCS.sip_foc2pix`` formerly did not conform to the\n  ``SIP`` standard: ``CRPIX`` was added to the ``foc`` result so\n  that it could be used as input to \"core FITS WCS\".  As of astropy\n  0.4, ``CRPIX`` is no longer added to the result, so the ``foc``\n  space is correct as defined in the `SIP convention\n  <https://ui.adsabs.harvard.edu/abs/2005ASPC..347..491S>`__. [#2360]\n\n- ``astropy.wcs.UnitConverter``, which was deprecated in astropy\n  0.2, has been removed.  Use the ``astropy.units`` module\n  instead. [#2386]\n\n- The following methods on ``astropy.wcs.WCS``, which were\n  deprecated in astropy 0.1, have been removed [#2386]:\n\n- ``all_pix2sky`` -> ``all_pix2world``\n\n- ``wcs_pix2sky`` -> ``wcs_pix2world``\n\n- ``wcs_sky2pix`` -> ``wcs_world2pix``\n\n- The ``naxis1`` and ``naxis2`` attributes and the ``get_naxis``\n  method of ``astropy.wcs.WCS``, which were deprecated in astropy\n  0.2, have been removed.  Use the shape of the underlying FITS data\n  array instead.  [#2386]\n\nMisc\n^^^^\n\n- The ``astropy.setup_helpers`` and ``astropy.version_helpers`` modules are\n  deprecated; any non-critical fixes and development to those modules should\n  be in ``astropy_helpers`` instead.  Packages that use these modules in\n  their ``setup.py`` should depend on ``astropy_helpers`` following the same\n  pattern as in the Astropy package template.\n\n\nBug Fixes\n---------\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\n- ``astropy.constants.Contant`` objects can now be deep\n  copied. [#2601]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- The distance modulus function in ``astropy.cosmology`` can now handle\n  negative distances, which can occur in certain closed cosmologies. [#2008]\n\n- Removed accidental imports of some extraneous variables in\n  ``astropy.cosmology`` [#2025]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- ``astropy.io.ascii.read`` would fail to read lists of strings where some of\n  the strings consisted of just a newline (\"\\n\"). [#2648]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Use NaN for missing values in FITS when using Table.write for float\n  columns. Earlier the default fill value was close to 1e20.[#2186]\n\n- Fixes for checksums on 32-bit platforms.  Results may be different\n  if writing or checking checksums in \"nonstandard\" mode.  [#2484]\n\n- Additional minor bug fixes ported from PyFITS.  [#2575]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- It is now possible to save an ``astropy.table.Table`` object as a\n  VOTable with any of the supported data formats, ``tabledata``,\n  ``binary`` and ``binary2``, by using the ``tabledata_format``\n  kwarg. [#2138]\n\n- Fixed a crash writing out variable length arrays. [#2577]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Indexing ``NDData`` in a way that results in a single element returns that\n  element. [#2170]\n\n- Change construction of result of arithmetic and unit conversion to allow\n  subclasses to require the presence of attribute like unit. [#2300]\n\n- Scale uncertainties to correct units in arithmetic operations and unit\n  conversion. [#2393]\n\n- Ensure uncertainty and mask members are copied in arithmetic and\n  convert_unit_to. [#2394]\n\n- Mask result of arithmetic if either of the operands is masked. [#2403]\n\n- Copy all attributes of input object if ``astropy.nddata.NDData`` is\n  initialized with an ``NDData`` object. [#2406]\n\n- Copy ``flags`` to new object in ``convert_unit_to``. [#2409]\n\n- Result of ``NDData`` arithmetic makes a copy of any WCS instead of using\n  a reference. [#2410]\n\n- Fix unit handling for multiplication/division and use\n  ``astropy.units.Quantity`` for units arithmetic. [#2413]\n\n- A masked ``NDData`` is now converted to a masked array when used in an\n  operation or ufunc with a numpy array. [#2414]\n\n- An unmasked ``NDData`` now uses an internal representation of its mask\n  state that ``numpy.ma`` expects so that an ``NDData`` behaves as an\n  unmasked array. [#2417]\n\nastropy.sphinx\n^^^^^^^^^^^^^^\n\n- Fix crash in smart resolver when the resolution doesn't work. [#2591]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- The ``astropy.table.Column`` object can now use both functions and callable\n  objects as formats. [#2313]\n\n- Fixed a problem on 64 bit windows that caused errors\n  \"expected 'DTYPE_t' but got 'long long'\" [#2490]\n\n- Fix initialisation of ``TableColumns`` with lists or tuples.  [#2647]\n\n- Fix removal of single column using ``remove_columns``. [#2699]\n\n- Fix a problem that setting a row element within a masked table did not\n  update the corresponding table element. [#2734]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Correct UT1->UTC->UT1 round-trip being off by 1 second if UT1 is\n  on a leap second. [#2077]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- ``Quantity.copy`` now behaves identically to ``ndarray.copy``, and thus\n  supports the ``order`` argument (for numpy >=1.6). [#2284]\n\n- Composing base units into identical composite units now works. [#2382]\n\n- Creating and composing/decomposing units is now substantially faster [#2544]\n\n- ``Quantity`` objects now are able to be assigned NaN [#2695]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Astropy now requires wcslib version 4.23.  The version of wcslib\n  included with astropy has been updated to version 4.23.\n\n- Bug fixes in the projection routines: in ``hpxx2s`` [the\n  cartesian-to-spherical operation of the ``HPX`` projection]\n  relating to bounds checking, bug introduced at wcslib 4.20; in\n  ``parx2s`` and molx2s`` [the cartesion-to-spherical operation of\n  the ``PAR`` and ``MOL`` projections respectively] relating to\n  setting the stat vector; in ``hpxx2s`` relating to implementation\n  of the vector API; and in ``xphx2s`` relating to setting an\n  out-of-bounds value of *phi*.\n\n- In the ``PCO`` projection, use alternative projection equations\n  for greater numerical precision near theta == 0.  In the ``COP``\n  projection, return an exact result for theta at the poles.\n  Relaxed the tolerance for bounds checking a little in ``SFL``\n  projection.\n\n- Fix a bug allocating insufficient memory in\n  ``astropy.wcs.WCS.sub`` [#2468]\n\n- A new method, ``Wcsprm.bounds_check`` (corresponding to wcslib's\n  ``wcsbchk``) has been added to control what bounds checking is performed by\n  wcslib.\n\n- ``WCS.to_header`` will now raise a more meaningful exception when the WCS\n  information is invalid or inconsistent in some way. [#1854]\n\n- In ``WCS.to_header``, ``RESTFRQ`` and ``RESTWAV`` are no longer\n  rewritten if zero. [#2468]\n\n- In ``WCS.to_header``, floating point values will now always be written\n  with an exponent or fractional part, i.e. ``.0`` being appended if necessary\n  to achieve this. [#2468]\n\n- If the C extension for ``astropy.wcs`` was not built or fails to import for\n  any reason, ``import astropy.wcs`` will result in an ``ImportError``,\n  rather than getting obscure errors once the ``astropy.wcs`` is used.\n  [#2061]\n\n- When the C extension for ``astropy.wcs`` is built using a version of\n  ``wscslib`` already present in the system, the package does not try\n  to install ``wcslib`` headers under ``astropy/wcs/include``. [#2536]\n\n- Fixes an unresolved external symbol error in the\n  ``astropy.wcs._wcs`` C extension on Microsoft Windows when built\n  with a Microsoft compiler. [#2478]\n\nMisc\n^^^^\n\n- Running the test suite with ``python setup.py test`` now works if\n  the path to the source contains spaces. [#2488]\n\n- The version of ERFA included with Astropy is now v1.1.0 [#2497]\n\n- Removed deprecated option from travis configuration and force use of\n  wheels rather than allowing build from source. [#2576]\n\n- The short option ``-n`` to run tests in parallel was broken\n  (conflicts with the distutils built-in option of \"dry-run\").\n  Changed to ``-j``. [#2566]\n\nOther Changes and Additions\n---------------------------\n\n- python setup.py test --coverage will now give more accurate\n  results, because the coverage analysis will include early imports of\n  astropy.  There doesn't seem to be a way to get this to work when\n  doing ``import astropy; astropy.test()``, so the ``coverage``\n  keyword to ``astropy.test`` has been removed.  Coverage testing now\n  depends only on `coverage.py\n  <http://coverage.readthedocs.io/en/latest/>`__, not\n  ``pytest-cov``. [#2112]\n\n- The included version of py.test has been upgraded to 2.5.1. [#1970]\n\n- The included version of six.py has been upgraded to 1.5.2. [#2006]\n\n- Where appropriate, tests are now run both with and without the\n  ``unicode_literals`` option to ensure that we support both cases. [#1962]\n\n- Running the Astropy test suite from within the IPython REPL is disabled for\n  now due to bad interaction between the test runner and IPython's logging\n  and I/O handler.  For now, run the Astropy tests should be run in the basic\n  Python interpreter. [#2684]\n\n- Added support for numerical comparison of floating point values appearing in\n  the output of doctests using a ``+FLOAT_CMP`` doctest flag. [#2087]\n\n- A monkey patch is performed to fix a bug in Numpy version 1.7 and\n  earlier where unicode fill values on masked arrays are not\n  supported.  This may cause unintended side effects if your\n  application also monkey patches ``numpy.ma`` or relies on the broken\n  behavior.  If unicode support of masked arrays is important to your\n  application, upgrade to Numpy 1.8 or later for best results. [#2059]\n\n- The developer documentation has been extensively rearranged and\n  rewritten. [#1712]\n\n- The ``human_time`` function in ``astropy.utils`` now returns strings\n  without zero padding. [#2420]\n\n- The ``bdist_dmg`` command for ``setup.py`` has now been removed. [#2553]\n\n- Many broken API links have been fixed in the documentation, and the\n  ``nitpick`` Sphinx option is now used to avoid broken links in future.\n  [#1221, #2019, #2109, #2161, #2162, #2192, #2200, #2296, #2448, #2456,\n  #2460, #2467, #2476, #2508, #2509]\n\n\n0.3.2 (2014-05-13)\n==================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- if ``sep`` argument is specified to be a single character in\n  ``sexagisimal_to_string``, it now includes separators only between\n  items [#2183]\n\n- Ensure comparisons involving ``Distance`` objects do not raise exceptions;\n  also ensure operations that lead to units other than length return\n  ``Quantity``. [#2206, #2250]\n\n- Multiplication and division of ``Angle`` objects is now\n  supported. [#2273]\n\n- Fixed ``Angle.to_string`` functionality so that negative angles have the\n  correct amount of padding when ``pad=True``. [#2337]\n\n- Mixing strings and quantities in the ``Angle`` constructor now\n  works.  For example: ``Angle(['1d', 1. * u.d])``.  [#2398]\n\n- If ``Longitude`` is given a ``Longitude`` as input, use its ``wrap_angle``\n  by default [#2705]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Fixed ``format()`` compatibility with Python 2.6. [#2129]\n\n- Be more careful about converting to floating point internally [#1815, #1818]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- The CDS reader in ``astropy.io.ascii`` can now handle multiple\n  description lines in ReadMe files. [#2225]\n\n- When reading a table with values that generate an overflow error during\n  type conversion (e.g. overflowing the native C long type), fall through to\n  using string. Previously this generated an exception [#2234].\n\n- Recognize any string with one to four dashes as null value. [#1335]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Allow pickling of ``FITS_rec`` objects. [#1597]\n\n- Improved behavior when writing large compressed images on OSX by removing\n  an unnecessary check for platform architecture. [#2345]\n\n- Fixed an issue where Astropy ``Table`` objects containing boolean columns\n  were not correctly written out to FITS files. [#1953]\n\n- Several other bug fixes ported from PyFITS v3.2.3 [#2368]\n\n- Fixed a crash on Python 2.x when writing a FITS file directly to a\n  ``StringIO.StringIO`` object. [#2463]\n\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\n- Allow readers/writers with the same name to be attached to different\n  classes. [#2312]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- By default, floating point values are now written out using\n  ``repr`` rather than ``str`` to preserve precision [#2137]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed the ``SIP`` and ``InverseSIP`` models both so that they work in the\n  first place, and so that they return results consistent with the SIP\n  functions in ``astropy.wcs``. [#2177]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Ensure the ``axis`` keyword in ``astropy.stats.funcs`` can now be used for\n  all axes. [#2173]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Ensure nameless columns can be printed, using 'None' for the header. [#2213]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Fixed pickling of ``Time`` objects. [#2123]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- ``Quantity._repr_latex_()`` returns ``NotImplementedError`` for quantity\n  arrays instead of an uninformative formatting exception. [#2258]\n\n- Ensure ``Quantity.flat`` always returns ``Quantity``. [#2251]\n\n- Angstrom unit renders better in MathJax [#2286]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Progress bars will now be displayed inside the IPython\n  qtconsole. [#2230]\n\n- ``data.download_file()`` now evaluates ``REMOTE_TIMEOUT()`` at runtime\n  rather than import time. Previously, setting ``REMOTE_TIMEOUT`` after\n  import had no effect on the function's behavior. [#2302]\n\n- Progressbar will be limited to 100% so that the bar does not exceed the\n  terminal width.  The numerical display can still exceed 100%, however.\n\nastropy.vo\n^^^^^^^^^^\n\n- Fixed ``format()`` compatibility with Python 2.6. [#2129]\n\n- Cone Search validation no longer raises ``ConeSearchError`` for positive RA.\n  [#2240, #2242]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Fixed a bug where calling ``astropy.wcs.Wcsprm.sub`` with\n  ``WCSSUB_CELESTIAL`` may cause memory corruption due to\n  underallocation of a temporary buffer. [#2350]\n\n- Fixed a memory allocation bug in ``astropy.wcs.Wcsprm.sub`` and\n  ``astropy.wcs.Wcsprm.copy``.  [#2439]\n\nMisc\n^^^^\n\n- Fixes for compatibility with Python 3.4. [#1945]\n\n- ``import astropy; astropy.test()`` now correctly uses the same test\n  configuration as ``python setup.py test`` [#1811]\n\n\n0.3.1 (2014-03-04)\n==================\n\nBug Fixes\n---------\n\nastropy.config\n^^^^^^^^^^^^^^\n\n- Fixed a bug where ``ConfigurationItem.set_temp()`` does not reset to\n  default value when exception is raised within ``with`` block. [#2117]\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug where ``_truncation`` was left undefined for ``CustomKernel``.\n  [#2016]\n\n- Fixed a bug with ``_normalization`` when ``CustomKernel`` input array\n  sums to zero. [#2016]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed a bug where using ``==`` on two array coordinates wouldn't\n  work. [#1832]\n\n- Fixed bug which caused ``len()`` not to work for coordinate objects and\n  added a ``.shape`` property to get appropriately array-like behavior.\n  [#1761, #2014]\n\n- Fixed a bug where sexagesimal notation would sometimes include\n  exponential notation in the last field. [#1908, #1913]\n\n- ``CompositeStaticMatrixTransform`` no longer attempts to reference the\n  undefined variable ``self.matrix`` during instantiation. [#1944]\n\n- Fixed pickling of ``Longitude``, ensuring ``wrap_angle`` is preserved\n  [#1961]\n\n- Allow ``sep`` argument in ``Angle.to_string`` to be empty (resulting in no\n  separators) [#1989]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Allow passing unicode delimiters when reading or writing tables.  The\n  delimiter must be convertible to pure ASCII.  [#1949]\n\n- Fix a problem when reading a table and renaming the columns to names that\n  already exist. [#1991]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Ported all bug fixes from PyFITS 3.2.1.  See the PyFITS changelog at\n  https://pyfits.readthedocs.io/en/v3.2.1/ [#2056]\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- Fixed issues in the HDF5 Table reader/writer functions that occurred on\n  Windows. [#2099]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- The ``write_null_values`` kwarg to ``VOTable.to_xml``, when set to `False`\n  (the default) would produce non-standard VOTable files.  Therefore, this\n  functionality has been replaced by a better understanding that knows which\n  fields in a VOTable may be left empty (only ``char``, ``float`` and\n  ``double`` in VOTable 1.1 and 1.2, and all fields in VOTable 1.3).  The\n  kwarg is still accepted but it will be ignored, and a warning is emitted.\n  [#1809]\n\n- Printing out a ``astropy.io.votable.tree.Table`` object using `repr` or\n  `str` now uses the pretty formatting in ``astropy.table``, so it's possible\n  to easily preview the contents of a ``VOTable``. [#1766]\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Fixed bug in computation of model derivatives in ``LinearLSQFitter``.\n  [#1903]\n\n- Raise a ``NotImplementedError`` when fitting composite models. [#1915]\n\n- Fixed bug in the computation of the ``Gaussian2D`` model. [#2038]\n\n- Fixed bug in the computation of the ``AiryDisk2D`` model. [#2093]\n\nastropy.sphinx\n^^^^^^^^^^^^^^\n\n- Added slightly more useful debug info for AstropyAutosummary. [#2024]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- The column string representation for n-dimensional cells with only\n  one element has been fixed. [#1522]\n\n- Fix a problem that caused ``MaskedColumn.__getitem__`` to not preserve\n  column metadata. [#1471, #1872]\n\n- With Numpy prior to version 1.6.2, tables with Unicode columns now\n  sort correctly. [#1867]\n\n- ``astropy.table`` can now print out tables with Unicode columns containing\n  non-ascii characters. [#1864]\n\n- Columns can now be named with Unicode strings, as long as they contain only\n  ascii characters.  This makes using ``astropy.table`` easier on Python 2\n  when ``from __future__ import unicode_literals`` is used. [#1864]\n\n- Allow pickling of ``Table``, ``Column``, and ``MaskedColumn`` objects. [#792]\n\n- Fix a problem where it was not possible to rename columns after sorting or\n  adding a row. [#2039]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Fix a problem where scale conversion problem in TimeFromEpoch\n  was not showing a useful error [#2046]\n\n- Fix a problem when converting to one of the formats ``unix``, ``cxcsec``,\n  ``gps`` or ``plot_date`` when the time scale is ``UT1``, ``TDB`` or ``TCB``\n  [#1732]\n\n- Ensure that ``delta_ut1_utc`` gets calculated when accessed directly,\n  instead of failing and giving a rather obscure error message [#1925]\n\n- Fix a bug when computing the TDB to TT offset.  The transform routine was\n  using meters instead of kilometers for the Earth vector.  [#1929]\n\n- Increase ``__array_priority__`` so that ``TimeDelta`` can convert itself\n  to a ``Quantity`` also in reverse operations [#1940]\n\n- Correct hop list from TCG to TDB to ensure that conversion is\n  possible [#2074]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- ``Quantity`` initialisation rewritten for speed [#1775]\n\n- Fixed minor string formatting issue for dimensionless quantities. [#1772]\n\n- Fix error for inplace operations on non-contiguous quantities [#1834].\n\n- The definition of the unit ``bar`` has been corrected to \"1e5\n  Pascal\" from \"100 Pascal\" [#1910]\n\n- For units that are close to known units, but not quite, for\n  example due to differences in case, the exception will now include\n  recommendations. [#1870]\n\n- The generic and FITS unit parsers now accept multiple slashes in\n  the unit string.  There are multiple ways to interpret them, but\n  the approach taken here is to convert \"m/s/kg\" to \"m s-1 kg-1\".\n  Multiple slashes are accepted, but discouraged, by the FITS\n  standard, due to the ambiguity of parsing, so a warning is raised\n  when it is encountered. [#1911]\n\n- The use of \"angstrom\" (with a lower case \"a\") is now accepted in FITS unit\n  strings, since it is in common usage.  However, since it is not officially\n  part of the FITS standard, a warning will be issued when it is encountered.\n  [#1911]\n\n- Pickling unrecognized units will not raise a ``AttributeError``. [#2047]\n\n- ``astropy.units`` now correctly preserves the precision of\n  fractional powers. [#2070]\n\n- If a ``Unit`` or ``Quantity`` is raised to a floating point power\n  that is very close to a rational number with a denominator less\n  than or equal to 10, it is converted to a ``Fraction`` object to\n  preserve its precision through complex unit conversion operations.\n  [#2070]\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Fixed crash in ``timer.RunTimePredictor.do_fit``. [#1905]\n\n- Fixed ``astropy.utils.compat.argparse`` for Python 3.1. [#2017]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- ``astropy.wcs.WCS``, ``astropy.wcs.WCS.fix`` and\n  ``astropy.wcs.find_all_wcs`` now have a ``translate_units`` keyword\n  argument that is passed down to ``astropy.wcs.Wcsprm.fix``.  This can be\n  used to specify any unsafe translations of units from rarely used ones to\n  more commonly used ones.\n\n  Although ``\"S\"`` is commonly used to represent seconds, its translation to\n  ``\"s\"`` is potentially unsafe since the standard recognizes ``\"S\"``\n  formally as Siemens, however rarely that may be used.  The same applies to\n  ``\"H\"`` for hours (Henry), and ``\"D\"`` for days (Debye).\n\n  When these sorts of changes are performed, a warning is emitted.\n  [#1854]\n\n- When a unit is \"fixed\" by ``astropy.wcs.WCS.fix`` or\n  ``astropy.wcs.Wcsprm.unitfix``, it now correctly reports the ``CUNIT``\n  field that was changed. [#1854]\n\n- ``astropy.wcs.Wcs.printwcs`` will no longer warn that ``cdelt`` is being\n  ignored when none was present in the FITS file. [#1845]\n\n- ``astropy.wcs.Wcsprm.set`` is called from within the ``astropy.wcs.WCS``\n  constructor, therefore any invalid information in the keywords will be\n  raised from the constructor, rather than on a subsequent call to a\n  transformation method. [#1918]\n\n- Fix a memory corruption bug when using ``astropy.wcs.Wcs.sub`` with\n  ``astropy.wcs.WCSSUB_CELESTIAL``. [#1960]\n\n- Fixed the ``AttributeError`` exception that was raised when using\n  ``astropy.wcs.WCS.footprint_to_file``. [#1912]\n\n- Fixed a ``NameError`` exception that was raised when using\n  ``astropy.wcs.validate`` or the ``wcslint`` script. [#2053]\n\n- Fixed a bug where named WCSes may be erroneously reported as ``' '`` when\n  using ``astropy.wcs.validate`` or the ``wcslint`` script. [#2053]\n\n- Fixed a bug where error messages about incorrect header keywords\n  may not be propagated correctly, resulting in a \"NULL error object\n  in wcslib\" message. [#2106]\n\nMisc\n^^^^\n\n- There are a number of improvements to make Astropy work better on big\n  endian platforms, such as MIPS, PPC, s390x and SPARC. [#1849]\n\n- The test suite will now raise exceptions when a deprecated feature of\n  Python or Numpy is used.  [#1948]\n\nOther Changes and Additions\n---------------------------\n\n- A new function, ``astropy.wcs.get_include``, has been added to get the\n  location of the ``astropy.wcs`` C header files. [#1755]\n\n- The doctests in the ``.rst`` files in the ``docs`` folder are now\n  tested along with the other unit tests.  This is in addition to the\n  testing of doctests in docstrings that was already being performed.\n  See ``docs/development/testguide.rst`` for more information. [#1771]\n\n- Fix a problem where import fails on Python 3 if setup.py exists\n  in current directory. [#1877]\n\n\n0.3 (2013-11-20)\n================\n\nNew Features\n------------\n\n- General\n\n- A top-level configuration item, ``unicode_output`` has been added to\n  control whether the Unicode string representation of certain\n  objects will contain Unicode characters.  For example, when\n  ``use_unicode`` is `False` (default)::\n\n      >>> from astropy import units as u\n      >>> print(unicode(u.degree))\n      deg\n\n  When ``use_unicode`` is `True`::\n\n      >>> from astropy import units as u\n      >>> print(unicode(u.degree))\n      °\n\n  See `handling-unicode\n  <https://docs.astropy.org/en/v0.3/development/codeguide.html#unicode-guidelines>`_\n  for more information. [#1441]\n\n- ``astropy.utils.misc.find_api_page`` is now imported into the top-level.\n  This allows usage like ``astropy.find_api_page(astropy.units.Quantity)``.\n  [#1779]\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\n- New class-based system for generating kernels, replacing ``make_kernel``.\n  [#1255] The ``astropy.nddata.convolution`` sub-package has now been moved\n  to ``astropy.convolution``. [#1451]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Two classes ``astropy.coordinates.Longitude`` and\n  ``astropy.coordinates.Latitude`` have been added.  These are derived from\n  the new ``Angle`` class and used for all longitude-like (RA, azimuth,\n  galactic L) and latitude-like coordinates (Dec, elevation, galactic B)\n  respectively.  The ``Longitude`` class provides auto-wrapping capability\n  and ``Latitude`` performs bounds checking.\n\n- ``astropy.coordinates.Distance`` supports conversion to and from distance\n  modulii. [#1472]\n\n- ``astropy.coordinates.SphericalCoordinateBase`` and derived classes now\n  support arrays of coordinates, enabling large speed-ups for some operations\n  on multiple coordinates at the same time. These coordinates can also be\n  indexed using standard slicing or any Numpy-compatible indexing. [#1535,\n  #1615]\n\n- Array coordinates can be matched to other array coordinates, finding the\n  closest matches between the two sets of coordinates (see the\n  ``astropy.coordinates.matching.match_coordinates_3d`` and\n  ``astropy.coordinates.matching.match_coordinates_sky`` functions). [#1535]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Added support for including massive Neutrinos in the cosmology classes. The\n  Planck (2013) cosmology has been updated to use this. [#1364]\n\n- Calculations now use and return ``Quantity`` objects where appropriate.\n  [#1237]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Added support for writing IPAC format tables [#1152].\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Added initial support for table columns containing pseudo-unsigned\n  integers.  This is currently enabled by using the ``uint=True`` option when\n  opening files; any table columns with the correct BZERO value will be\n  interpreted and returned as arrays of unsigned integers. [#906]\n\n- Upgraded vendored copy of CFITSIO to v3.35, though backwards compatibility\n  back to version v3.28 is maintained.\n\n- Added support for reading and writing tables using the Q format for columns.\n  The Q format is identical to the P format (variable-length arrays) except\n  that it uses 64-bit integers for the data descriptors, allowing more than\n  4 GB of variable-length array data in a single table.\n\n- Some refactoring of the table and ``FITS_rec`` modules in order to better\n  separate the details of the FITS binary and ASCII table data structures from\n  the HDU data structures that encapsulate them.  Most of these changes should\n  not be apparent to users (but see API Changes below).\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Updated to support the VOTable 1.3 draft. [#433]\n\n- Added the ability to look up and group elements by their utype attribute.\n  [#622]\n\n- The format of the units of a VOTable file can be specified using the\n  ``unit_format`` parameter.  Note that units are still always written out\n  using the CDS format, to ensure compatibility with the standard.\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\n- Added a new framework for representing and evaluating mathematical models\n  and for fitting data to models.  See \"What's New in Astropy 0.3\" in the\n  documentation for further details. [#493]\n\nastropy.stats\n^^^^^^^^^^^^^\n\n- Added robust statistics functions\n  ``astropy.stats.funcs.median_absolute_deviation``,\n  ``astropy.stats.funcs.biweight_location``, and\n  ``astropy.stats.funcs.biweight_midvariance``. [#621]\n\n- Added ``astropy.stats.funcs.signal_to_noise_oir_ccd`` for computing the\n  signal to noise ratio for source being observed in the optical/IR using a\n  CCD. [#870]\n\n- Add ``axis=int`` option to ``stropy.stats.funcs.sigma_clip`` to allow\n  clipping along a given axis for multidimensional data. [#1083]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- New columns can be added to a table via assignment to a non-existing\n  column by name. [#726]\n\n- Added ``join`` function to perform a database-like join on two tables. This\n  includes support for inner, left, right, and outer joins as well as\n  metadata merging.  [#903]\n\n- Added ``hstack`` and ``vstack`` functions to stack two or more tables.\n  [#937]\n\n- Tables now have a ``.copy`` method and include support for ``copy`` and\n  ``deepcopy``. [#1208]\n\n- Added support for selecting and manipulating groups within a table with\n  a database style ``group_by`` method. [#1424]\n\n- Table ``read`` and ``write`` functions now include rudimentary support\n  reading and writing of FITS tables via the unified reading/writing\n  interface. [#591]\n\n- The ``units`` and ``dtypes`` attributes and keyword arguments in Column,\n  MaskedColumn, Row, and Table are now deprecated in favor of the\n  single-tense ``unit`` and ``dtype``. [#1174]\n\n- Setting a column from a Quantity now correctly sets the unit on the Column\n  object. [#732]\n\n- Add ``remove_row`` and ``remove_rows`` to remove table rows. [#1230]\n\n- Added a new ``Table.show_in_browser`` method that opens a web browser\n  and displays the table rendered as HTML. [#1342]\n\n- New tables can now be instantiated using a single row from an existing\n  table. [#1417]\n\nastropy.time\n^^^^^^^^^^^^\n\n- New ``Time`` objects can be instantiated from existing ``Time`` objects\n  (but with different format, scale, etc.) [#889]\n\n- Added a ``Time.now`` classmethod that returns the current UTC time,\n  similarly to Python's ``datetime.now``. [#1061]\n\n- Update internal time manipulations so that arithmetic with Time and\n  TimeDelta objects maintains sub-nanosecond precision over a time span\n  longer than the age of the universe. [#1189]\n\n- Use ``astropy.utils.iers`` to provide ``delta_ut1_utc``, so that\n  automatic calculation of UT1 becomes possible. [#1145]\n\n- Add ``datetime`` format which allows converting to and from standard\n  library ``datetime.datetime`` objects. [#860]\n\n- Add ``plot_date`` format which allows converting to and from the date\n  representation used when plotting dates with matplotlib via the\n  ``matplotlib.pyplot.plot_date`` function. [#860]\n\n- Add ``gps`` format (seconds since 1980-01-01 00:00:00 UTC,\n  including leap seconds) [#1164]\n\n- Add array indexing to Time objects [#1132]\n\n- Allow for arithmetic of multi-element and single-element Time and TimeDelta\n  objects. [#1081]\n\n- Allow multiplication and division of TimeDelta objects by\n  constants and arrays, as well as changing sign (negation) and\n  taking the absolute value of TimeDelta objects. [#1082]\n\n- Allow comparisons of Time and TimeDelta objects. [#1171]\n\n- Support interaction of Time and Quantity objects that represent a time\n  interval. [#1431]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Added parallax equivalency for length-angle. [#985]\n\n- Added mass-energy equivalency. [#1333]\n\n- Added a new-style format method which will use format specifiers\n  (like ``0.03f``) in new-style format strings for the Quantity's value.\n  Specifiers which can't be applied to the value will fall back to the\n  entire string representation of the quantity. [#1383]\n\n- Added support for complex number values in quantities. [#1384]\n\n- Added new spectroscopic equivalencies for velocity conversions\n  (relativistic, optical, and radio conventions are supported) [#1200]\n\n- The ``spectral`` equivalency now also handles wave number.\n\n- The ``spectral_density`` equivalency now also accepts a Quantity for the\n  frequency or wavelength. It also handles additional flux units.\n\n- Added Brightness Temperature (antenna gain) equivalency for conversion\n  between :math:`T_B` and flux density. [#1327]\n\n- Added percent unit, and allowed any string containing just a number to be\n  interpreted as a scaled dimensionless unit. [#1409]\n\n- New-style format strings can be used to set the unit output format.  For\n  example, ``\"{0:latex}\".format(u.km)`` will print with the latex formatter.\n  [#1462]\n\n- The ``Unit.is_equivalent`` method can now take a tuple. In this case, the\n  method returns ``True`` if the unit is equivalent to any of the units\n  listed in the tuple. [#1521]\n\n- ``def_unit`` can now take a 2-tuple of names of the form (short, long),\n  where each entry is a list.  This allows for handling strange units that\n  might have multiple short names. [#1543]\n\n- Added ``dimensionless_angles`` equivalency, which allows conversion of any\n  power of radian to dimensionless. [#1161]\n\n- Added the ability to enable set of units, or equivalencies that are used by\n  default.  Also provided context managers for these cases. [#1268]\n\n- Imperial units are disabled by default. [#1593, #1662]\n\n- Added an ``astropy.units.add_enabled_units`` context manager, which allows\n  creating a temporary context with additional units temporarily enabled in\n  the global units namespace. [#1662]\n\n- ``Unit`` instances now have ``.si`` and ``.cgs`` properties a la\n  ``Quantity``.  These serve as shortcuts for ``Unit.to_system(cgs)[0]``\n  etc. [#1610]\n\nastropy.vo\n^^^^^^^^^^\n\n- New package added to support Virtual Observatory Simple Cone Search query\n  and service validation. [#552]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Fixed attribute error in ``astropy.wcs.Wcsprm`` (lattype->lattyp) [#1463]\n\n- Included a new command-line script called ``wcslint`` and accompanying API\n  for validating the WCS in a given FITS file or header. [#580]\n\n- Upgraded included version of WCSLIB to 4.19.\n\nastropy.utils\n^^^^^^^^^^^^^\n\n- Added a new set of utilities in ``astropy.utils.timer`` for analyzing the\n  runtime of functions and making runtime predections for larger inputs.\n  [#743]\n\n- ``ProgressBar`` and ``Spinner`` classes can now be used directly to return\n  generator expressions. [#771]\n\n- Added ``astropy.utils.iers`` which allows reading in of IERS A or IERS B\n  bulletins and interpolation in UT1-UTC.\n\n- Added a function ``astropy.utils.find_api_page``--given a class or object\n  from the ``astropy`` package, this will open that class's API documentation\n  in a web browser. [#663]\n\n- Data download functions such as ``download_file`` now accept a\n  ``show_progress`` argument to suppress console output, and a ``timeout``\n  argument. [#865, #1258]\n\nastropy.extern.six\n^^^^^^^^^^^^^^^^^^\n\n- Added `six <https://pypi.org/project/six/>`_ for python2/python3\n  compatibility\n\n- Astropy now uses the ERFA library instead of the IAU SOFA library for\n  fundamental time transformation routines.  The ERFA library is derived, with\n  permission, from the IAU SOFA library but is distributed under a BSD license.\n  See ``license/ERFA.rst`` for details. [#1293]\n\nastropy.logger\n^^^^^^^^^^^^^^\n\n- The Astropy logger now no longer catches exceptions by default, and also\n  only captures warnings emitted by Astropy itself (prior to this change,\n  following an import of Astropy, any warning got re-directed through the\n  Astropy logger). Logging to the Astropy log file has also been disabled by\n  default. However, users of Astropy 0.2 will likely still see the previous\n  behavior with Astropy 0.3 for exceptions and logging to file since the\n  default configuration file installed by 0.2 set the exception logging to be\n  on by default. To get the new behavior, set the ``log_exceptions`` and\n  ``log_to_file`` configuration items to ``False`` in the ``astropy.cfg``\n  file. [#1331]\n\nAPI Changes\n-----------\n\n- General\n\n- The configuration option ``utils.console.use_unicode`` has been\n  moved to the top level and renamed to ``unicode_output``.  It now\n  not only affects console widgets, such as progress bars, but also\n  controls whether calling `unicode` on certain classes will return a\n  string containing unicode characters.\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- The ``astropy.coordinates.Angle`` class is now a subclass of\n  ``astropy.units.Quantity``. This means it has all of the methods of a\n  `numpy.ndarray`. [#1006]\n\n- The ``astropy.coordinates.Distance`` class is now a subclass of\n  ``astropy.units.Quantity``. This means it has all of the methods of a\n  `numpy.ndarray`. [#1472]\n\n- All angular units are now supported, not just ``radian``, ``degree`` and\n  ``hour``, but now ``arcsecond`` and ``arcminute`` as well.  The object\n  will retain its native unit, so when printing out a value initially\n  provided in hours, its ``to_string()`` will, by default, also be\n  expressed in hours.\n\n- The ``Angle`` class now supports arrays of angles.\n\n- To be consistent with ``units.Unit``, ``Angle.format`` has been\n  deprecated and renamed to ``Angle.to_string``.\n\n- To be consistent with ``astropy.units``, all plural forms of unit names\n  have been removed.  Therefore, the following properties of\n  ``astropy.coordinates.Angle`` should be renamed:\n\n- ``radians`` -> ``radian``\n\n- ``degrees`` -> ``degree``\n\n- ``hours`` -> ``hour``\n\n- Multiplication and division of two ``Angle`` objects used to raise\n  ``NotImplementedError``.  Now they raise ``TypeError``.\n\n- The ``astropy.coordinates.Angle`` class no longer has a ``bounds``\n  attribute so there is no bounds-checking or auto-wrapping at this level.\n  This allows ``Angle`` objects to be used in arbitrary arithmetic\n  expressions (e.g. coordinate distance computation).\n\n- The ``astropy.coordinates.RA`` and ``astropy.coordinates.Dec`` classes have\n  been removed and replaced with ``astropy.coordinates.Longitude`` and\n  ``astropy.coordinates.Latitude`` respectively.  These are now used for the\n  components of Galactic and Horizontal (Alt-Az) coordinates as well instead\n  of plain ``Angle`` objects.\n\n- ``astropy.coordinates.angles.rotation_matrix`` and\n  ``astropy.coordinates.angles.angle_axis`` now take a ``unit`` kwarg instead\n  of ``degrees`` kwarg to specify the units of the angles.\n  ``rotation_matrix`` will also take the unit from the given ``Angle`` object\n  if no unit is provided.\n\n- The ``AngularSeparation`` class has been removed.  The output of the\n  coordinates ``separation()`` method is now an\n  ``astropy.coordinates.Angle``.  [#1007]\n\n- The coordinate classes have been renamed in a way that remove the\n  ``Coordinates`` at the end of the class names.  E.g., ``ICRSCoordinates``\n  from previous versions is now called ``ICRS``. [#1614]\n\n- ``HorizontalCoordinates`` are now named ``AltAz``, to reflect more common\n  terminology.\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- The Planck (2013) cosmology will likely give slightly different (and more\n  accurate) results due to the inclusion of Neutrino masses. [#1364]\n\n- Cosmology class properties now return ``Quantity`` objects instead of\n  simple floating-point values. [#1237]\n\n- The names of cosmology instances are now truly optional, and are set to\n  ``None`` rather than the name of the class if the user does not provide\n  them.  [#1705]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- In the ``read`` method of ``astropy.io.ascii``, empty column values in an\n  ASCII table are now treated as missing values instead of the previous\n  treatment as a zero-length string \"\".  This now corresponds to the behavior\n  of other table readers like ``numpy.genfromtxt``.  To restore the previous\n  behavior set ``fill_values=None`` in the call to ``ascii.read()``. [#919]\n\n- The ``read`` and ``write`` methods of ``astropy.io.ascii`` now have a\n  ``format`` argument for specifying the file format.  This is the preferred\n  way to choose the format instead of the ``Reader`` and ``Writer``\n  arguments. [#961]\n\n- The ``include_names`` and ``exclude_names`` arguments were removed from\n  the ``BaseHeader`` initializer, and now instead handled by the reader and\n  writer classes directly. [#1350]\n\n- Allow numeric and otherwise unusual column names when reading a table\n  where the ``format`` argument is specified, but other format details such\n  as the delimiter or quote character are being guessed. [#1692]\n\n- When reading an ASCII table using the ``Table.read()`` method, the default\n  has changed from ``guess=False`` to ``guess=True`` to allow auto-detection\n  of file format.  This matches the default behavior of ``ascii.read()``.\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- The ``astropy.io.fits.new_table`` function is marked \"pending deprecation\".\n  This does not mean it will be removed outright or that its functionality\n  has changed.  It will likely be replaced in the future for a function with\n  similar, if not subtly different functionality.  A better, if not slightly\n  more verbose approach is to use ``pyfits.FITS_rec.from_columns`` to create\n  a new ``FITS_rec`` table--this has the same interface as\n  ``pyfits.new_table``.  The difference is that it returns a plan\n  ``FITS_rec`` array, and not an HDU instance.  This ``FITS_rec`` object can\n  then be used as the data argument in the constructors for ``BinTableHDU``\n  (for binary tables) or ``TableHDU`` (for ASCII tables).  This is analogous\n  to creating an ``ImageHDU`` by passing in an image array.\n  ``pyfits.FITS_rec.from_columns`` is just a simpler way of creating a\n  FITS-compatible recarray from a FITS column specification.\n\n- The ``updateHeader``, ``updateHeaderData``, and ``updateCompressedData``\n  methods of the ``CompDataHDU`` class are pending deprecation and moved to\n  internal methods.  The operation of these methods depended too much on\n  internal state to be used safely by users; instead they are invoked\n  automatically in the appropriate places when reading/writing compressed\n  image HDUs.\n\n- The ``CompDataHDU.compData`` attribute is pending deprecation in favor of\n  the clearer and more PEP-8 compatible ``CompDataHDU.compressed_data``.\n\n- The constructor for ``CompDataHDU`` has been changed to accept new keyword\n  arguments.  The new keyword arguments are essentially the same, but are in\n  underscore_separated format rather than camelCase format.  The old\n  arguments are still pending deprecation.\n\n- The internal attributes of HDU classes ``_hdrLoc``, ``_datLoc``, and\n  ``_datSpan`` have been replaced with ``_header_offset``, ``_data_offset``,\n  and ``_data_size`` respectively.  The old attribute names are still pending\n  deprecation.  This should only be of interest to advanced users who have\n  created their own HDU subclasses.\n\n- The following previously deprecated functions and methods have been removed\n  entirely: ``createCard``, ``createCardFromString``, ``upperKey``,\n  ``ColDefs.data``, ``setExtensionNameCaseSensitive``, ``_File.getfile``,\n  ``_TableBaseHDU.get_coldefs``, ``Header.has_key``, ``Header.ascardlist``.\n\n- Interfaces that were pending deprecation are now fully deprecated.  These\n  include: ``create_card``, ``create_card_from_string``, ``upper_key``,\n  ``Header.get_history``, and ``Header.get_comment``.\n\n- The ``.name`` attribute on HDUs is now directly tied to the HDU's header, so\n  that if ``.header['EXTNAME']`` changes so does ``.name`` and vice-versa.\n\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\n- Identifier functions for reading/writing Table and NDData objects should\n  now accept ``(origin, *args, **kwargs)`` instead of ``(origin, args,\n  kwargs)``. [#591]\n\n- Added a new ``astropy.io.registry.get_formats`` function for listing\n  registered I/O formats and details about the their readers/writers. [#1669]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Added a new option ``use_names_over_ids`` option to use when converting\n  from VOTable objects to Astropy Tables. This can prevent a situation where\n  column names are not preserved when converting from a VOTable. [#609]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- The ``astropy.nddata.convolution`` sub-package has now been moved to\n  ``astropy.convolution``, and the ``make_kernel`` function has been removed.\n  (the kernel classes should be used instead) [#1451]\n\nastropy.stats.funcs\n^^^^^^^^^^^^^^^^^^^\n\n- For ``sigma_clip``, the ``maout`` optional parameter has been removed, and\n  the function now always returns a masked array.  A new boolean parameter\n  ``copy`` can be used to indicated whether the input data should be copied\n  (``copy=True``, default) or used by reference (``copy=False``) in the\n  output masked array. [#1083]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- The first argument to the ``Column`` and ``MaskedColumn`` classes is now\n  the data array--the ``name`` argument has been changed to an optional\n  keyword argument. [#840]\n\n- Added support for instantiating a ``Table`` from a list of dict, each one\n  representing a single row with the keys mapping to column names. [#901]\n\n- The plural 'units' and 'dtypes' have been switched to 'unit' and 'dtype'\n  where appropriate. The original attributes are still present in this\n  version as deprecated attributes, but will be removed in the next version.\n  [#1174]\n\n- The ``copy`` methods of ``Column`` and ``MaskedColumn`` were changed so\n  that the first argument is now ``order='C'``.  This is required for\n  compatibility with Numpy 1.8 which is currently in development. [#1250]\n\n- Comparing a column (with == or !=) to a scalar, an array, or another column\n  now always returns a boolean Numpy array (which is a masked array if either\n  of the arguments in the comparison was masked). This is in contrast to the\n  previous behavior, which in some cases returned a boolean Numpy array, and\n  in some cases returned a boolean Column object. [#1446]\n\nastropy.time\n^^^^^^^^^^^^\n\n- For consistency with ``Quantity``, the attributes ``val`` and\n  ``is_scalar`` have been renamed to ``value`` and ``isscalar``,\n  respectively, and the attribute ``vals`` has been dropped. [#767]\n\n- The double-float64 internal representation of time is used more\n  efficiently to enable better accuracy. [#366]\n\n- Format and scale arguments are now allowed to be case-insensitive. [#1128]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- The ``Quantity`` class now inherits from the Numpy array class, and\n  includes the following API changes [#929]:\n\n- Using ``float(...)``, ``int(...)``, and ``long(...)`` on a quantity will\n  now only work if the quantity is dimensionless and unscaled.\n\n- All Numpy ufuncs should now treat units correctly (or raise an exception\n  if not supported), rather than extract the value of quantities and\n  operate on this, emitting a warning about the implicit loss of units.\n\n- When using relevant Numpy ufuncs on dimensionless quantities (e.g.\n  ``np.exp(h * nu / (k_B * T))``), or combining dimensionless quantities\n  with Python scalars or plain Numpy arrays ``1 + v / c``, the\n  dimensionless Quantity will automatically be converted to an unscaled\n  dimensionless Quantity.\n\n- When initializing a quantity from a value with no unit, it is now set to\n  be dimensionless and unscaled by default. When initializing a Quantity\n  from another Quantity and with no unit specified in the initializer, the\n  unit is now taken from the unit of the Quantity being initialized from.\n\n- Strings are no longer allowed as the values for Quantities. [#1005]\n\n- Quantities are always comparable with zero regardless of their units.\n  [#1254]\n\n- The exception ``astropy.units.UnitsException`` has been renamed to\n  ``astropy.units.UnitsError`` to be more consistent with the naming\n  of built-in Python exceptions. [#1406]\n\n- Multiplication with and division by a string now always returns a Unit\n  (rather than a Quantity when the string was first) [#1408]\n\n- Imperial units are disabled by default.\n\nastropy.wcs\n^^^^^^^^^^^\n\n- For those including the ``astropy.wcs`` C headers in their project, they\n  should now include it as:\n\n  #include \"astropy_wcs/astropy_wcs_api.h\"\n\n  instead of:\n\n  #include \"astropy_wcs_api.h\"\n\n  [#1631]\n\n- The ``--enable-legacy`` option for ``setup.py`` has been removed. [#1493]\n\nBug Fixes\n---------\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- The ``write()`` function was ignoring the ``fill_values`` argument. [#910]\n\n- Fixed an issue in ``DefaultSplitter.join`` where the delimiter attribute\n  was ignored when writing the CSV. [#1020]\n\n- Fixed writing of IPAC tables containing null values. [#1366]\n\n- When a table with no header row was read without specifying the format and\n  using the ``names`` argument, then the first row could be dropped. [#1692]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Binary tables containing compressed images may, optionally, contain other\n  columns unrelated to the tile compression convention. Although this is an\n  uncommon use case, it is permitted by the standard.\n\n- Reworked some of the file I/O routines to allow simpler, more consistent\n  mapping between OS-level file modes ('rb', 'wb', 'ab', etc.) and the more\n  \"PyFITS-specific\" modes used by PyFITS like \"readonly\" and \"update\".  That\n  is, if reading a FITS file from an open file object, it doesn't matter as\n  much what \"mode\" it was opened in so long as it has the right capabilities\n  (read/write/etc.)  Also works around bugs in the Python io module in 2.6+\n  with regard to file modes.\n\n- Fixed a long-standing issue where writing binary tables did not correctly\n  write the TFORMn keywords for variable-length array columns (they omitted\n  the max array length parameter of the format).  This was thought fixed in\n  an earlier version, but it was only fixed for compressed image HDUs and\n  not for binary tables in general.\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- Fixed crash when trying to multiple or divide ``NDData`` objects with\n  uncertainties. [#1547]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Using a list of strings to index a table now correctly returns a new table\n  with the columns named in the list. [#1454]\n\n- Inequality operators now work properly with ``Column`` objects. [#1685]\n\nastropy.time\n^^^^^^^^^^^^\n\n- ``Time`` scale and format attributes are now shown when calling ``dir()``\n  on a ``Time`` object. [#1130]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Fixed assignment to string-like WCS attributes on Python 3. [#956]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Fixed a bug that caused the order of multiplication/division of plain\n  Numpy arrays with Quantities to matter (i.e. if the plain array comes\n  first the units were not preserved in the output). [#899]\n\n- Directly instantiated ``CompositeUnits`` were made printable without\n  crashing. [#1576]\n\nMisc\n^^^^\n\n- Fixed various modules that hard-coded ``sys.stdout`` as default arguments\n  to functions at import time, rather than using the runtime value of\n  ``sys.stdout``. [#1648]\n\n- Minor documentation fixes and enhancements [#922, #1034, #1210, #1217,\n  #1491, #1492, #1498, #1582, #1608, #1621, #1646, #1670, #1756]\n\n- Fixed a crash that could sometimes occur when running the test suite on\n  systems with platform names containing non-ASCII characters. [#1698]\n\nOther Changes and Additions\n---------------------------\n\n- General\n\n- Astropy now follows the PSF Code of Conduct. [#1216]\n\n- Astropy's test suite now tests all doctests in inline docstrings.  Support\n  for running doctests in the reST documentation is planned to follow in\n  v0.3.1.\n\n- Astropy's test suite can be run on multiple CPUs in parallel, often\n  greatly improving runtime, using the ``--parallel`` option. [#1040]\n\n- A warning is now issued when using Astropy with Numpy < 1.5--much of\n  Astropy may still work in this case but it shouldn't be expected to\n  either. [#1479]\n\n- Added automatic download/build/installation of Numpy during Astropy\n  installation if not already found. [#1483]\n\n- Handling of metadata for the ``NDData`` and ``Table`` classes has been\n  unified by way of a common ``MetaData`` descriptor--it allows instantiating\n  an object with metadata of any mapping type, and subsequently prevents\n  replacing the mapping stored in the ``.meta`` attribute (only direct\n  updates to that object are allowed). [#1686]\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Angles containing out of bounds minutes or seconds (e.g. 60) can be\n  parsed--the value modulo 60 is used with carry to the hours/minutes, and a\n  warning is issued rather than raising an exception. [#990]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- The new compression code also adds support for the ZQUANTIZ and ZDITHER0\n  keywords added in more recent versions of this FITS Tile Compression spec.\n  This includes support for lossless compression with GZIP. (#198) By default\n  no dithering is used, but the ``SUBTRACTIVE_DITHER_1`` and\n  ``SUBTRACTIVE_DITHER_2`` methods can be enabled by passing the correct\n  constants to the ``quantize_method`` argument to the ``CompImageHDU``\n  constructor.  A seed can be manually specified, or automatically generated\n  using either the system clock or checksum-based methods via the\n  ``dither_seed`` argument.  See the documentation for ``CompImageHDU`` for\n  more details.\n\n- Images compressed with the Tile Compression standard can now be larger than\n  4 GB through support of the Q format.\n\n- All HDUs now have a ``.ver`` ``.level`` attribute that returns the value of\n  the EXTVAL and EXTLEVEL keywords from that HDU's header, if the exist.\n  This was added for consistency with the ``.name`` attribute which returns\n  the EXTNAME value from the header.\n\n- Then ``Column`` and ``ColDefs`` classes have new ``.dtype`` attributes\n  which give the Numpy dtype for the column data in the first case, and the\n  full Numpy compound dtype for each table row in the latter case.\n\n- There was an issue where new tables created defaulted the values in all\n  string columns to '0.0'.  Now string columns are filled with empty strings\n  by default--this seems a less surprising default, but it may cause\n  differences with tables created with older versions of PyFITS or Astropy.\n\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\n- The HDF5 reader can now refer to groups in the path as well as datasets;\n  if given a group, the first dataset in that group is read. [#1159]\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\n- ``NDData`` objects have more helpful, though still rudimentary ``__str__`\n  and ``__repr__`` displays. [#1313]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Added 'cycle' unit. [#1160]\n\n- Extended units supported by the CDS formatter/parser. [#1468]\n\n- Added unicode an LaTeX symbols for liter. [#1618]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Redundant SCAMP distortion parameters are removed with SIP distortions are\n  also present. [#1278]\n\n- Added iterative implementation of ``all_world2pix`` that can be reliably\n  inverted. [#1281]\n\n\n0.2.5 (2013-10-25)\n==================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed incorrect string formatting of Angles using ``precision=0``. [#1319]\n\n- Fixed string formatting of Angles using ``decimal=True`` which ignored the\n  ``precision`` argument. [#1323]\n\n- Fixed parsing of format strings using appropriate unicode characters\n  instead of the ASCII ``-`` for minus signs. [#1429]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fixed a crash in the IPAC table reader when the ``include/exclude_names``\n  option is set. [#1348]\n\n- Fixed writing AASTex tables to honor the ``tabletype`` option. [#1372]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Improved round-tripping and preservation of manually assigned column\n  attributes (``TNULLn``, ``TSCALn``, etc.) in table HDU headers. (Note: This\n  issue was previously reported as fixed in Astropy v0.2.2 by mistake; it is\n  not fixed until v0.3.) [#996]\n\n- Fixed a bug that could cause a segfault when trying to decompress an\n  compressed HDU whose contents are truncated (due to a corrupt file, for\n  example). This still causes a Python traceback but better that than a\n  segfault. [#1332]\n\n- Newly created ``CompImageHDU`` HDUs use the correct value of the\n  ``DEFAULT_COMPRESSION_TYPE`` module-level constant instead of hard-coding\n  \"RICE_1\" in the header.\n\n- Fixed a corner case where when extra memory is allocated to compress an\n  image, it could lead to unnecessary in-memory copying of the compressed\n  image data and a possible memory leak through Numpy.\n\n- Fixed a bug where assigning from an mmap'd array in one FITS file over\n  the old (also mmap'd) array in another FITS file failed to update the\n  destination file. Corresponds to PyFITS issue 25.\n\n- Some miscellaneous documentation fixes.\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Added a warning for when a VOTable 1.2 file contains no ``RESOURCES``\n  elements (at least one should be present). [#1337]\n\n- Fixed a test failure specific to MIPS architecture caused by an errant\n  floating point warning. [#1179]\n\nastropy.nddata.convolution\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n- Prevented in-place modification of the input arrays to ``convolve()``.\n  [#1153]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Added HTML escaping for string values in tables when outputting the table\n  as HTML. [#1347]\n\n- Added a workaround in a bug in Numpy that could cause a crash when\n  accessing a table row in a masked table containing ``dtype=object``\n  columns. [#1229]\n\n- Fixed an issue similar to the one in #1229, but specific to unmasked\n  tables. [#1403]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Improved error handling for unparsable units and fixed parsing CDS units\n  without mantissas in the exponent. [#1288]\n\n- Added a physical type for spectral flux density. [#1410]\n\n- Normalized conversions that should result in a scale of exactly 1.0 to\n  round off slight floating point imprecisions. [#1407]\n\n- Added support in the CDS unit parser/formatter for unusual unit prefixes\n  that are nonetheless required to be supported by that convention. [#1426]\n\n- Fixed the parsing of ``sqrt()`` in unit format strings which was returning\n  ``unit ** 2`` instead of ``unit ** 0.5``. [#1458]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- When passing a single array to the wcs transformation functions,\n  (``astropy.wcs.Wcs.all_pix2world``, etc.), its second dimension must now\n  exactly match the number of dimensions in the transformation. [#1395]\n\n- Improved error message when incorrect arguments are passed to\n  ``WCS.wcs_world2pix``. [#1394]\n\n- Fixed a crash when trying to read WCS from FITS headers on Python 3.3\n  in Windows. [#1363]\n\n- Only headers that are required as part of the WCSLIB C API are installed\n  by the package, per request of system packagers. [#1666]\n\nMisc\n^^^^\n\n- Fixed crash when the ``COLUMNS`` environment variable is set to a\n  non-integer value. [#1291]\n\n- Fixed a bug in ``ProgressBar.map`` where ``multiprocess=True`` could cause\n  it to hang on waiting for the process pool to be destroyed. [#1381]\n\n- Fixed a crash on Python 3.2 when affiliated packages try to use the\n  ``astropy.utils.data.get_pkg_data_*`` functions. [#1256]\n\n- Fixed a minor path normalization issue that could occur on Windows in\n  ``astropy.utils.data.get_pkg_data_filename``. [#1444]\n\n- Fixed an annoyance where configuration items intended only for testing\n  showed up in users' astropy.cfg files. [#1477]\n\n- Prevented crashes in exception logging in unusual cases where no traceback\n  is associated with the exception. [#1518]\n\n- Fixed a crash when running the tests in unusual environments where\n  ``sys.stdout.encoding`` is ``None``. [#1530]\n\n- Miscellaneous documentation fixes and improvements [#1308, #1317, #1377,\n  #1393, #1362, #1516]\n\nOther Changes and Additions\n---------------------------\n\n- Astropy installation now requests setuptools >= 0.7 during build/installation\n  if neither distribute or setuptools >= 0.7 is already installed.  In other\n  words, if ``import setuptools`` fails, ``ez_setup.py`` is used to bootstrap\n  the latest setuptools (rather than using ``distribute_setup.py`` to bootstrap\n  the now obsolete distribute package). [#1197]\n\n- When importing Astropy from a source checkout without having built the\n  extension modules first an ``ImportError`` is raised rather than a\n  ``SystemExit`` exception. [#1269]\n\n\n0.2.4 (2013-07-24)\n==================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed the angle parser to support parsing the string \"1 degree\". [#1168]\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Fixed a crash in the ``comoving_volume`` method on non-flat cosmologies\n  when passing it an array of redshifts.\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fixed a bug that prevented saving changes to the comment symbol when\n  writing changes to a table. [#1167]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Added a workaround for a bug in 64-bit OSX that could cause truncation when\n  writing files greater than 2^32 bytes in size. [#839]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Fixed incorrect reading of tables containing multiple ``<RESOURCE>``\n  elements. [#1223]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fixed a bug where ``Table.remove_column`` and ``Table.rename_column``\n  could cause a masked table to lose its masking. [#1120]\n\n- Fixed bugs where subclasses of ``Table`` did not preserver their class in\n  certain operations. [#1142]\n\n- Fixed a bug where slicing a masked table did not preserve the mask. [#1187]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Fixed a bug where the ``.si`` and ``.cgs`` properties of dimensionless\n  ``Quantity`` objects raised a ``ZeroDivisionError``. [#1150]\n\n- Fixed a bug where multiple subsequent calls to the ``.decompose()`` method\n  on array quantities applied a scale factor each time. [#1163]\n\nMisc\n^^^^\n\n- Fixed an installation crash that could occur sometimes on Debian/Ubuntu\n  and other \\*NIX systems where ``pkg_resources`` can be installed without\n  installing ``setuptools``. [#1150]\n\n- Updated the ``distribute_setup.py`` bootstrapper to use setuptools >= 0.7\n  when installing on systems that don't already have an up to date version\n  of distribute/setuptools. [#1180]\n\n- Changed the ``version.py`` template so that Astropy affiliated packages can\n  (and they should) use their own ``cython_version.py`` and\n  ``utils._compiler`` modules where appropriate. This issue only pertains to\n  affiliated package maintainers. [#1198]\n\n- Fixed a corner case where the default config file generation could crash\n  if building with matplotlib but *not* Sphinx installed in a virtualenv.\n  [#1225]\n\n- Fixed a crash that could occur in the logging module on systems that\n  don't have a default preferred encoding (in particular this happened\n  in some versions of PyCharm). [#1244]\n\n- The Astropy log now supports passing non-string objects (and calling\n  ``str()`` on them by default) to the logging methods, in line with Python's\n  standard logging API. [#1267]\n\n- Minor documentation fixes [#582, #696, #1154, #1194, #1212, #1213, #1246,\n  #1252]\n\nOther Changes and Additions\n---------------------------\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Added a new ``Plank13`` object representing the Plank 2013 results. [#895]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Performance improvements in initialization of ``Quantity`` objects with\n  a large number of elements. [#1231]\n\n\n0.2.3 (2013-05-30)\n==================\n\nBug Fixes\n---------\n\nastropy.time\n^^^^^^^^^^^^\n\n- Fixed inaccurate handling of leap seconds when converting from UTC to UNIX\n  timestamps. [#1118]\n\n- Tightened required accuracy in many of the time conversion tests. [#1121]\n\nMisc\n^^^^\n\n- Fixed a regression that was introduced in v0.2.2 by the fix to issue #992\n  that was preventing installation of Astropy affiliated packages that use\n  Astropy's setup framework. [#1124]\n\n\n0.2.2 (2013-05-21)\n==================\n\nBug Fixes\n---------\n\nastropy.io\n^^^^^^^^^^\n\n- Fixed issues in both the ``fits`` and ``votable`` sub-packages where array\n  byte order was not being handled consistently, leading to possible crashes\n  especially on big-endian systems. [#1003]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- When an error occurs opening a file in fitsdiff the exception message will\n  now at least mention which file had the error.\n\n- Fixed a couple cases where creating a new table using TDIMn in some of the\n  columns could cause a crash.\n\n- Slightly refactored how tables containing variable-length array columns are\n  handled to add two improvements: Fixes an issue where accessing the data\n  after a call to the ``astropy.io.fits.getdata`` convenience function caused\n  an exception, and allows the VLA data to be read from an existing mmap of\n  the FITS file.\n\n- Fixed a bug on Python 3 where attempting to open a non-existent file on\n  Python 3 caused a seemingly unrelated traceback.\n\n- Fixed an issue in the tests that caused some tests to fail if Astropy is\n  installed with read-only permissions.\n\n- Fixed a bug where instantiating a ``BinTableHDU`` from a numpy array\n  containing boolean fields converted all the values to ``False``.\n\n- Fixed an issue where passing an array of integers into the constructor of\n  ``Column()`` when the column type is floats of the same byte width caused\n  the column array to become garbled.\n\n- Fixed inconsistent behavior in creating CONTINUE cards from byte strings\n  versus unicode strings in Python 2--CONTINUE cards can now be created\n  properly from unicode strings (so long as they are convertible to ASCII).\n\n- Fixed a bug in parsing HIERARCH keywords that do not have a space after the\n  first equals sign (before the value).\n\n- Prevented extra leading whitespace on HIERARCH keywords from being treated\n  as part of the keyword.\n\n- Fixed a bug where HIERARCH keywords containing lower-case letters was\n  mistakenly marked as invalid during header validation along with an\n  ancillary issue where the ``Header.index()`` method id not work correctly\n  with HIERARCH keywords containing lower-case letters.\n\n- Disallowed assigning NaN and Inf floating point values as header values,\n  since the FITS standard does not define a way to represent them in. Because\n  this is undefined, the previous behavior did not make sense and produced\n  invalid FITS files. [#954]\n\n- Fixed an obscure issue that can occur on systems that don't have flush to\n  memory-mapped files implemented (namely GNU Hurd). [#968]\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Stopped deprecation warnings from the ``astropy.io.votable`` package that\n  could occur during setup. [#970]\n\n- Fixed an issue where INFO elements were being incorrectly dropped when\n  occurring inside a TABLE element. [#1000]\n\n- Fixed obscure test failures on MIPS platforms. [#1010]\n\nastropy.nddata.convolution\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n- Fixed an issue in ``make_kernel()`` when using an Airy function kernel.\n  Also removed the superfluous 'brickwall' option. [#939]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fixed a crash that could occur when adding a row to an empty (rowless)\n  table with masked columns. [#973]\n\n- Made it possible to assign to one table row from the value of another row,\n  effectively making it easier to copy rows, for example. [#1019]\n\nastropy.time\n^^^^^^^^^^^^\n\n- Added appropriate ``__copy__`` and ``__deepcopy__`` behavior; this\n  omission caused a seemingly unrelated error in FK5 coordinate separation.\n  [#891]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Fixed an issue where the ``isiterable()`` utility returned ``True`` for\n  quantities with scalar values.  Added an ``__iter__`` method for the\n  ``Quantity`` class and fixed ``isiterable()`` to catch false positives.\n  [#878]\n\n- Fixed previously undefined behavior when multiplying a unit by a string.\n  [#949]\n\n- Added 'time' as a physical type--this was a simple omission. [#959]\n\n- Fixed issues with pickling unit objects so as to play nicer with the\n  multiprocessing module. [#974]\n\n- Made it more difficult to accidentally override existing units with a new\n  unit of the same name. [#1070]\n\n- Added several more physical types and units that were previously omitted,\n  including 'mass density', 'specific volume', 'molar volume', 'momentum',\n  'angular momentum', 'angular speed', 'angular acceleration', 'electric\n  current', 'electric current density', 'electric field strength', 'electric\n  flux density', 'electric charge density', 'permittivity', 'electromagnetic\n  field strength', 'radiant intensity', 'data quantity', 'bandwidth'; and\n  'knots', 'nautical miles', 'becquerels', and 'curies' respectively. [#1072]\n\nMisc\n^^^^\n\n- Fixed a permission error that could occur when running ``astropy.test()``\n  on Python 3 when Astropy is installed as root. [#811]\n\n- Made it easier to filter warnings from the ``convolve()`` function and\n  from ``Quantity`` objects. [#853]\n\n- Fixed a crash that could occur in Python 3 when generation of the default\n  config file fails during setup. [#952]\n\n- Fixed an unrelated error message that could occur when trying to import\n  astropy from a source checkout without having build the extension modules\n  first. This issue was claimed to be fixed in v0.2.1, but the fix itself had\n  a bug. [#971]\n\n- Fixed a crash that could occur when running the ``build_sphinx`` setup\n  command in Python 3. [#977]\n\n- Added a more helpful error message when trying to run the\n  ``setup.py build_sphinx`` command when Sphinx is not installed. [#1027]\n\n- Minor documentation fixes and restructuring.\n  [#935, #967, #978, #1004, #1028, #1047]\n\nOther Changes and Additions\n---------------------------\n\n- Some performance improvements to the ``astropy.units`` package, in particular\n  improving the time it takes to import the sub-package. [#1015]\n\n\n0.2.1 (2013-04-03)\n==================\n\nBug Fixes\n---------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- Fixed encoding errors that could occur when formatting coordinate objects\n  in code using ``from __future__ import unicode_literals``. [#817]\n\n- Fixed a bug where the minus sign was dropped when string formatting dms\n  coordinates with -0 degrees. [#875]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Properly supports the ZQUANTIZ keyword used to support quantization\n  level--this includes working support for lossless GZIP compression of\n  images.\n\n- Fixed support for opening gzipped FITS files in a writeable mode. [#256]\n\n- Added a more helpful exception message when trying to read invalid values\n  from a table when the required ``TNULLn`` keyword is missing. [#309]\n\n- More refactoring of the tile compression handling to work around a\n  potential memory access violation that was particularly prevalent on\n  Windows. [#507]\n\n- Fixed an integer size mismatch in the compression module that could affect\n  32-bit systems. [#786]\n\n- Fixed malformatting of the ``TFORMn`` keywords when writing compressed\n  image tables (they omitted the max array length parameter from the\n  variable-length array format).\n\n- Fixed a crash that could occur when writing a table containing multi-\n  dimensional array columns from an existing file into a new file.\n\n- Fixed a bug in fitsdiff that reported two header keywords containing NaN\n  as having different values.\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- Fixed links to the ``astropy.io.votable`` documentation in the VOTable\n  validator output. [#806]\n\n- When reading VOTables containing integers that are out of range for their\n  column type, display a warning rather than raising an exception. [#825]\n\n- Changed the default string format for floating point values for better\n  round-tripping. [#856]\n\n- Fixed opening VOTables through the ``Table.read()`` interface for tables\n  that have no names. [#927]\n\n- Fixed creation of VOTables from an Astropy table that does not have a data\n  mask. [#928]\n\n- Minor documentation fixes. [#932]\n\nastropy.nddata.convolution\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n- Added better handling of ``inf`` values to the ``convolve_fft`` family of\n  functions. [#893]\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Fixed silent failure to assign values to a row on multiple columns. [#764]\n\n- Fixed various buggy behavior when viewing a table after sorting by one of\n  its columns. [#829]\n\n- Fixed using ``numpy.where()`` with table indexing. [#838]\n\n- Fixed a bug where opening a remote table with ``Table.read()`` could cause\n  the entire table to be downloaded twice. [#845]\n\n- Fixed a bug where ``MaskedColumn`` no longer worked if the column being\n  masked is renamed. [#916]\n\nastropy.units\n^^^^^^^^^^^^^\n\n- Added missing capability for array ``Quantity``\\s to be initializable by\n  a list of ``Quantity``\\s. [#835]\n\n- Fixed the definition of year and lightyear to be in terms of Julian year\n  per the IAU definition. [#861]\n\n- \"degree\" was removed from the list of SI base units. [#863]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Fixed ``TypeError`` when calling ``WCS.to_header_string()``. [#822]\n\n- Added new method ``WCS.all_world2pix`` for converting from world\n  coordinates to pixel space, including inversion of the astrometric\n  distortion correction. [#1066, #1281]\n\nMisc\n^^^^\n\n- Fixed a minor issue when installing with ``./setup.py develop`` on a fresh\n  git clone.  This is likely only of interest to developers on Astropy.\n  [#725]\n\n- Fixes a crash with ``ImportError: No module named 'astropy.version'`` when\n  running setup.py from a source checkout for the first time on OSX with\n  Python 3.3. [#820]\n\n- Fixed an installation issue where running ``./setup.py install`` or when\n  installing with pip the ``.astropy`` directory gets created in the home\n  directory of the user running the command.  The user's ``.astropy``\n  directory should only be created when they use Astropy, not when they\n  install it. [#867]\n\n- Fixed an exception when creating a ``ProgressBar`` with a \"total\" of 0.\n  [#752]\n\n- Added better documentation of behavior that can occur when trying to import\n  the astropy package from within a source checkout without first building\n  the extension modules. [#795, #864]\n\n- Added link to the installation instructions in the README. [#797]\n\n- Catches segfaults in xmllint which can occur sometimes and is otherwise out\n  of our control. [#803]\n\n- Minor changes to the documentation template. [#805]\n\n- Fixed a minor exception handling bug in ``download_file()``. [#808]\n\n- Added cleanup of any temporary files if an error occurs in\n  ``download_file()``. [#857]\n\n- Filesystem free space is checked for before attempting to download a file\n  with ``download_file()``. [#858]\n\n- Fixed package data locating to work across symlinks--required to work with\n  some OS packaging layouts. [#827]\n\n- Fixed a bug when building Cython extensions where hidden files containing\n  ``.pyx`` extensions could cause the build to crash. This can be an issue\n  with software and filesystems that autogenerate hidden files. [#834]\n\n- Fixed bug that could cause a \"script\" called README.rst to be installed\n  in a bin directory. [#852]\n\n- Fixed some miscellaneous and mostly rare reference leaks caught by\n  cpychecker. [#914]\n\nOther Changes and Additions\n---------------------------\n\n- Added logo and branding for Windows binary installers. [#741]\n\n- Upgraded included version libexpat to 2.1.0. [#781]\n\n- ~25% performance improvement in unit composition/decomposition. [#836]\n\n- Added previously missing LaTeX formatting for ``L_sun`` and ``R_sun``. [#841]\n\n- ConfigurationItem\\s now have a more useful and informative __repr__\n  and improved documentation for how to use them. [#855]\n\n- Added a friendlier error message when trying to import astropy from a source\n  checkout without first building the extension modules inplace. [#864]\n\n- py.test now outputs more system information for help in debugging issues\n  from users. [#869]\n\n- Added unit definitions \"mas\" and \"uas\" for \"milliarcsecond\" and\n  \"microarcsecond\" respectively. [#892]\n\n\n0.2 (2013-02-19)\n================\n\nNew Features\n------------\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\n- This new subpackage contains a representation of celestial coordinates,\n  and provides a wide range of related functionality.  While\n  fully-functional, it is a work in progress and parts of the API may\n  change in subsequent releases.\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\n- Update to include cosmologies with variable dark energy equations of state.\n  (This introduces some API incompatibilities with the older Cosmology\n  objects).\n\n- Added parameters for relativistic species (photons, neutrinos) to the\n  astropy.cosmology classes. The current treatment assumes that neutrinos are\n  massless. [#365]\n\n- Add a WMAP9 object using the final (9-year) WMAP parameters from\n  Hinshaw et al. 2013. It has also been made the default cosmology.\n  [#629, #724]\n\n- astropy.table I/O infrastructure for custom readers/writers\n  implemented. [#305]\n\n- Added support for reading/writing HDF5 files [#461]\n\n- Added support for masked tables with missing or invalid data [#451]\n\n- New ``astropy.time`` sub-package. [#332]\n\n- New ``astropy.units`` sub-package that includes a class for units\n  (``astropy.units.Unit``) and scalar quantities that have units\n  (``astropy.units.Quantity``). [#370, #445]\n\n  This has the following effects on other sub-packages:\n\n- In ``astropy.wcs``, the ``wcs.cunit`` list now takes and returns\n  ``astropy.units.Unit`` objects. [#379]\n\n- In ``astropy.nddata``, units are now stored as ``astropy.units.Unit``\n  objects. [#382]\n\n- In ``astropy.table``, units on columns are now stored as\n  ``astropy.units.Unit`` objects. [#380]\n\n- In ``astropy.constants``, constants are now stored as\n  ``astropy.units.Quantity`` objects. [#529]\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Improved integration with the ``astropy.table`` Table class so that\n  table and column metadata (e.g. keywords, units, description,\n  formatting) are directly available in the output table object.  The\n  CDS, DAOphot, and IPAC format readers now provide this type of\n  integrated metadata.\n\n- Changed to using ``astropy.table`` masked tables instead of NumPy\n  masked arrays for tables with missing values.\n\n- Added SExtractor table reader to ``astropy.io.ascii`` [#420]\n\n- Removed the Memory reader class which was used to convert data input\n  passed to the ``write`` function into an internal table.  Instead\n  ``write`` instantiates an astropy Table object using the data\n  input to ``write``.\n\n- Removed the NumpyOutputter as the output of reading a table is now\n  always a ``Table`` object.\n\n- Removed the option of supplying a function as a column output\n  formatter.\n\n- Added a new ``strip_whitespace`` keyword argument to the ``write``\n  function.  This controls whether whitespace is stripped from\n  the left and right sides of table elements before writing.\n  Default is True.\n\n- Fixed a bug in reading IPAC tables with null values.\n\n- Generalized I/O infrastructure so that ``astropy.nddata`` can also have\n  custom readers/writers [#659]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- From updating the underlying wcslib 4.16:\n\n- When ``astropy.wcs.WCS`` constructs a default coordinate representation\n  it will give it the special name \"DEFAULTS\", and will not report \"Found\n  one coordinate representation\".\n\nOther Changes and Additions\n---------------------------\n\n- A configuration file with all options set to their defaults is now generated\n  when astropy is installed.  This file will be pulled in as the users'\n  astropy configuration file the first time they ``import astropy``.  [#498]\n\n- Astropy doc themes moved into ``astropy.sphinx`` to allow affiliated packages\n  to access them.\n\n- Added expanded documentation for the ``astropy.cosmology`` sub-package.\n  [#272]\n\n- Added option to disable building of \"legacy\" packages (pyfits, vo, etc.).\n\n- The value of the astronomical unit (au) has been updated to that adopted by\n  IAU 2012 Resolution B2, and the values of the pc and kpc constants have been\n  updated to reflect this. [#368]\n\n- Added links to the documentation pages to directly edit the documentation on\n  GitHub. [#347]\n\n- Several updates merged from ``pywcs`` into ``astropy.wcs`` [#384]:\n\n- Improved the reading of distortion images.\n\n- Added a new option to choose whether or not to write SIP coefficients.\n\n- Uses the ``relax`` option by default so that non-standard keywords are\n  allowed. [#585]\n\n\n- Added HTML representation of tables in IPython notebook [#409]\n\n- Rewrote CFITSIO-based backend for handling tile compression of FITS files.\n  It now uses a standard CFITSIO instead of heavily modified pieces of CFITSIO\n  as before.  Astropy ships with its own copy of CFITSIO v3.30, but system\n  packagers may choose instead to strip this out in favor of a\n  system-installed version of CFITSIO.  This corresponds to PyFITS ticket 169.\n  [#318]\n\n- Moved ``astropy.config.data`` to ``astropy.utils.data`` and re-factored the\n  I/O routines to separate out the generic I/O code that can be used to open\n  any file or resource from the code used to access Astropy-related data. The\n  'core' I/O routine is now ``get_readable_fileobj``, which can be used to\n  access any local as well as remote data, supports caching, and can decompress\n  gzip and bzip2 files on-the-fly. [#425]\n\n- Added a classmethod to\n  ``astropy.coordinates.coordsystems.SphericalCoordinatesBase`` that performs a\n  name resolve query using Sesame to retrieve coordinates for the requested\n  object. This works for any subclass of ``SphericalCoordinatesBase``, but\n  requires an internet connection. [#556]\n\n- astropy.nddata.convolution removed requirement of PyFFTW3; uses Numpy's\n  FFT by default instead with the added ability to specify an FFT\n  implementation to use. [#660]\n\n\nBug Fixes\n---------\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Fixed crash when pprinting a row with INDEF values. [#511]\n\n- Fixed failure when reading DAOphot files with empty keyword values. [#666]\n\nastropy.io.fits\n^^^^^^^^^^^^^^^\n\n- Improved handling of scaled images and pseudo-unsigned integer images in\n  compressed image HDUs.  They now work more transparently like normal image\n  HDUs with support for the ``do_not_scale_image_data`` and ``uint`` options,\n  as well as ``scale_back`` and ``save_backup``.  The ``.scale()`` method\n  works better too. Corresponds to PyFITS ticket 88.\n\n- Permits non-string values for the EXTNAME keyword when reading in a file,\n  rather than throwing an exception due to the malformatting.  Added\n  verification for the format of the EXTNAME keyword when writing.\n  Corresponds to PyFITS ticket 96.\n\n- Added support for EXTNAME and EXTVER in PRIMARY HDUs.  That is, if EXTNAME\n  is specified in the header, it will also be reflected in the ``.name``\n  attribute and in ``fits.info()``.  These keywords used to be verboten in\n  PRIMARY HDUs, but the latest version of the FITS standard allows them.\n  Corresponds to PyFITS ticket 151.\n\n- HCOMPRESS can again be used to compress data cubes (and higher-dimensional\n  arrays) so long as the tile size is effectively 2-dimensional. In fact,\n  compatible tile sizes will automatically be used even if they're not\n  explicitly specified. Corresponds to PyFITS ticket 171.\n\n- Fixed a bug that could cause a deadlock in the filesystem on OSX when\n  reading the data from certain types of FITS files. This only occurred\n  when used in conjunction with Numpy 1.7. [#369]\n\n- Added support for the optional ``endcard`` parameter in the\n  ``Header.fromtextfile()`` and ``Header.totextfile()`` methods.  Although\n  ``endcard=False`` was a reasonable default assumption, there are still text\n  dumps of FITS headers that include the END card, so this should have been\n  more flexible. Corresponds to PyFITS ticket 176.\n\n- Fixed a crash when running fitsdiff on two empty (that is, zero row) tables.\n  Corresponds to PyFITS ticket 178.\n\n- Fixed an issue where opening a FITS file containing a random group HDU in\n  update mode could result in an unnecessary rewriting of the file even if\n  no changes were made. This corresponds to PyFITS ticket 179.\n\n- Fixed a crash when generating diff reports from diffs using the\n  ``ignore_comments`` options. Corresponds to PyFITS ticket 181.\n\n- Fixed some bugs with WCS distortion paper record-valued keyword cards:\n\n- Cards that looked kind of like RVKCs but were not intended to be were\n  over-permissively treated as such--commentary keywords like COMMENT and\n  HISTORY were particularly affected. Corresponds to PyFITS ticket 183.\n\n- Looking up a card in a header by its standard FITS keyword only should\n  always return the raw value of that card.  That way cards containing\n  values that happen to valid RVKCs but were not intended to be will still\n  be treated like normal cards. Corresponds to PyFITS ticket 184.\n\n- Looking up a RVKC in a header with only part of the field-specifier (for\n  example \"DP1.AXIS\" instead of \"DP1.AXIS.1\") was implicitly treated as a\n  wildcard lookup. Corresponds to PyFITS ticket 184.\n\n- Fixed a crash when diffing two FITS files where at least one contains a\n  compressed image HDU which was not recognized as an image instead of a\n  table. Corresponds to PyFITS ticket 187.\n\n- Fixed a bug where opening a file containing compressed image HDUs in\n  'update' mode and then immediately closing it without making any changes\n  caused the file to be rewritten unnecessarily.\n\n- Fixed two memory leaks that could occur when writing compressed image data,\n  or in some cases when opening files containing compressed image HDUs in\n  'update' mode.\n\n- Fixed a bug where ``ImageHDU.scale(option='old')`` wasn't working at\n  all--it was not restoring the image to its original BSCALE and BZERO\n  values.\n\n- Fixed a bug when writing out files containing zero-width table columns,\n  where the TFIELDS keyword would be updated incorrectly, leaving the table\n  largely unreadable.\n\n- Fixed a minor string formatting issue.\n\n- Fixed bugs in the backwards compatibility layer for the ``CardList.index``\n  and ``CardList.count`` methods. Corresponds to PyFITS ticket 190.\n\n- Improved ``__repr__`` and text file representation of cards with long\n  values that are split into CONTINUE cards. Corresponds to PyFITS ticket\n  193.\n\n- Fixed a crash when trying to assign a long (> 72 character) value to blank\n  ('') keywords. This also changed how blank keywords are represented--there\n  are still exactly 8 spaces before any commentary content can begin; this\n  *may* affect the exact display of header cards that assumed there could be\n  fewer spaces in a blank keyword card before the content begins. However,\n  the current approach is more in line with the requirements of the FITS\n  standard. Corresponds to PyFITS ticket 194.\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\n- The ``Table`` class now maintains a single array object which is a\n  Numpy masked array.  For variable-length columns, the object that\n  is stored there is also a Numpy masked array.\n\n- Changed the ``pedantic`` configuration option to be ``False`` by default\n  due to the vast proliferation of non-compliant VO Tables. [#296]\n\n- Renamed ``astropy.io.vo`` to ``astropy.io.votable``.\n\nastropy.table\n^^^^^^^^^^^^^\n\n- Added a workaround for an upstream bug in Numpy 1.6.2 that could cause\n  a maximum recursion depth RuntimeError when printing table rows. [#341]\n\nastropy.wcs\n^^^^^^^^^^^\n\n- Updated to wcslib 4.15 [#418]\n\n- Fixed a problem with handling FITS headers on locales that do not use\n  dot as a decimal separator. This required an upstream fix to wcslib which\n  is included in wcslib 4.14. [#313]\n\n- Fixed some tests that could fail due to missing/incorrect logging\n  configuration--ensures that tests don't have any impact on the default log\n  location or contents. [#291]\n\n- Various minor documentation fixes [#293 and others]\n\n- Fixed a bug where running the tests with the ``py.test`` command still tried\n  to replace the system-installed pytest with the one bundled with Astropy.\n  [#454]\n\n- Improved multiprocessing compatibility for file downloads. [#615]\n\n- Fixed handling of Cython modules when building from a source checkout of a\n  tagged release version. [#594]\n\n- Added a workaround for a bug in Sphinx that could occur when using the\n  ``:tocdepth:`` directive. [#595]\n\n- Minor VOTable fixes [#596]\n\n- Fixed how ``setup.py`` uses ``distribute_setup.py`` to prevent possible\n  ``VersionConflict`` errors when an older version of distribute is already\n  installed on the user's system. [#616, #640]\n\n- Changed use of ``log.warn`` in the logging module to ``log.warning`` since\n  the former is deprecated. [#624]\n\n\n0.1 (2012-06-19)\n================\n\n- Initial release.\n"},{"id":5,"name":"CITATION","nodeType":"TextFile","path":"","text":"See https://github.com/astropy/astropy/blob/main/astropy/CITATION\n"},{"id":6,"name":"CODE_OF_CONDUCT.md","nodeType":"TextFile","path":"","text":"All Astropy community members are expected to abide by the [Astropy Project Code of Conduct](http://www.astropy.org/code_of_conduct.html).\n"},{"id":7,"name":"codecov.yml","nodeType":"TextFile","path":"","text":"comment: off\n"},{"fileName":"conftest.py","filePath":"","id":8,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# This file is the main file used when running tests with pytest directly,\n# in particular if running e.g. ``pytest docs/``.\n\nimport os\nimport tempfile\n\nimport hypothesis\n\nfrom astropy import __version__\n\ntry:\n    from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS\nexcept ImportError:\n    PYTEST_HEADER_MODULES = {}\n    TESTED_VERSIONS = {}\n\n\n# This has to be in the root dir or it will not display in CI.\ndef pytest_configure(config):\n    PYTEST_HEADER_MODULES['PyERFA'] = 'erfa'\n    PYTEST_HEADER_MODULES['Cython'] = 'cython'\n    PYTEST_HEADER_MODULES['Scikit-image'] = 'skimage'\n    PYTEST_HEADER_MODULES['asdf'] = 'asdf'\n    PYTEST_HEADER_MODULES['pyarrow'] = 'pyarrow'\n    TESTED_VERSIONS['Astropy'] = __version__\n\n\n# This has to be in the root dir or it will not display in CI.\ndef pytest_report_header(config):\n    # This gets added after the pytest-astropy-header output.\n    return (f'ARCH_ON_CI: {os.environ.get(\"ARCH_ON_CI\", \"undefined\")}\\n'\n            f'IS_CRON: {os.environ.get(\"IS_CRON\", \"undefined\")}\\n')\n\n\n# Tell Hypothesis that we might be running slow tests, to print the seed blob\n# so we can easily reproduce failures from CI, and derive a fuzzing profile\n# to try many more inputs when we detect a scheduled build or when specifically\n# requested using the HYPOTHESIS_PROFILE=fuzz environment variable or\n# `pytest --hypothesis-profile=fuzz ...` argument.\n\nhypothesis.settings.register_profile(\n    'ci', deadline=None, print_blob=True, derandomize=True\n)\nhypothesis.settings.register_profile(\n    'fuzzing', deadline=None, print_blob=True, max_examples=1000\n)\ndefault = 'fuzzing' if (os.environ.get('IS_CRON') == 'true' and os.environ.get('ARCH_ON_CI') not in ('aarch64', 'ppc64le')) else 'ci'  # noqa: E501\nhypothesis.settings.load_profile(os.environ.get('HYPOTHESIS_PROFILE', default))\n\n# Make sure we use temporary directories for the config and cache\n# so that the tests are insensitive to local configuration.\n\nos.environ['XDG_CONFIG_HOME'] = tempfile.mkdtemp('astropy_config')\nos.environ['XDG_CACHE_HOME'] = tempfile.mkdtemp('astropy_cache')\n\nos.mkdir(os.path.join(os.environ['XDG_CONFIG_HOME'], 'astropy'))\nos.mkdir(os.path.join(os.environ['XDG_CACHE_HOME'], 'astropy'))\n\n# Note that we don't need to change the environment variables back or remove\n# them after testing, because they are only changed for the duration of the\n# Python process, and this configuration only matters if running pytest\n# directly, not from e.g. an IPython session.\n"},{"id":9,"name":"CONTRIBUTING.md","nodeType":"TextFile","path":"","text":"Contributing to Astropy\n=======================\n\nReporting Issues\n----------------\n\nWhen opening an issue to report a problem, please try to provide a minimal code\nexample that reproduces the issue along with details of the operating\nsystem and the Python, NumPy, and `astropy` versions you are using.\n\nContributing Code and Documentation\n-----------------------------------\n\nSo you are interested in contributing to the Astropy Project?  Excellent!\nWe love contributions! Astropy is open source, built on open source, and\nwe'd love to have you hang out in our community.\n\nAnti Imposter Syndrome Reassurance\n----------------------------------\n\nWe want your help. No, really.\n\nThere may be a little voice inside your head that is telling you that you're not\nready to be an open source contributor; that your skills aren't nearly good\nenough to contribute. What could you possibly offer a project like this one?\n\nWe assure you - the little voice in your head is wrong. If you can write code or\ndocumentation, you can contribute code to open source.\nContributing to open source projects is a fantastic way to advance one's coding\nand open source workflow skills. Writing perfect code isn't the measure of a good\ndeveloper (that would disqualify all of us!); it's trying to create something,\nmaking mistakes, and learning from those mistakes. That's how we all improve,\nand we are happy to help others learn.\n\nBeing an open source contributor doesn't just mean writing code, either. You can\nhelp out by writing documentation, tests, or even giving feedback about the\nproject (and yes - that includes giving feedback about the contribution\nprocess). Some of these contributions may be the most valuable to the project as\na whole, because you're coming to the project with fresh eyes, so you can see\nthe errors and assumptions that seasoned contributors have glossed over.\n\nNote: This text was originally written by\n[Adrienne Lowe](https://github.com/adriennefriend) for a\n[PyCon talk](https://www.youtube.com/watch?v=6Uj746j9Heo), and was adapted by\nAstropy based on its use in the README file for the\n[MetPy project](https://github.com/Unidata/MetPy).\n\nHow to Contribute, Best Practices\n---------------------------------\n\nMost contributions to Astropy are done via [pull\nrequests](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests)\nfrom GitHub users' forks of the [astropy\nrepository](https://github.com/astropy/astropy). If you are new to this\nstyle of development, you will want to read over our [development\nworkflow](https://docs.astropy.org/en/latest/development/workflow/development_workflow.html).\n\nYou may also/instead be interested in contributing to an\n[astropy affiliated package](https://www.astropy.org/affiliated/).\nAffiliated packages are astronomy-related software packages that are not a part\nof the `astropy` core package, but build on it for more specialized applications\nand follow the Astropy guidelines for reuse, interoperability, and interfacing.\nEach affiliated package has its own developers/maintainers and its own specific\nguidelines for contributions, so be sure to read their docs.\n\nOnce you open a pull request (which should be opened against the ``main``\nbranch, not against any of the other branches), please make sure to\ninclude the following:\n\n- **Code**: the code you are adding, which should follow\n  our [coding guidelines](https://docs.astropy.org/en/latest/development/codeguide.html) as much as possible.\n\n- **Tests**: these are usually tests to ensure code that previously\n  failed now works (regression tests), or tests that cover as much as possible\n  of the new functionality to make sure it does not break in the future and\n  also returns consistent results on all platforms (since we run these tests on\n  many platforms/configurations). For more information about how to write\n  tests, see our [testing guidelines](https://docs.astropy.org/en/latest/development/testguide.html).\n\n- **Documentation**: if you are adding new functionality, be sure to include a\n  description in the main documentation (in ``docs/``). Again, we have some\n  detailed [documentation guidelines](https://docs.astropy.org/en/latest/development/docguide.html) to help you out.\n\n- **Performance improvements**: if you are making changes that impact `astropy`\n  performance, consider adding a performance benchmark in the\n  [astropy-benchmarks](https://github.com/astropy/astropy-benchmarks)\n  repository. You can find out more about how to do this\n  [in the README for that repository](https://github.com/astropy/astropy-benchmarks#contributing-benchmarks).\n\n- **Changelog entry**: whether you are fixing a bug or adding new\n  functionality, you should add a changelog fragment in the ``docs/changes/``\n  directory. See ``docs/changes/README.rst`` for some guidance on the creation\n  of this file.\n\n  If you are opening a pull request you may not know\n  the PR number yet, but you can add it once the pull request is open. If you\n  are not sure where to put the changelog entry, wait until a maintainer\n  has reviewed your PR and assigned it to a milestone.\n\n  You do not need to include a changelog entry for fixes to bugs introduced in\n  the developer version and therefore are not present in the stable releases. In\n  general you do not need to include a changelog entry for minor documentation\n  or test updates. Only user-visible changes (new features/API changes, fixed\n  issues) need to be mentioned. If in doubt, ask the core maintainer reviewing\n  your changes.\n\nChecklist for Contributed Code\n------------------------------\n\nBefore being merged, a pull request for a new feature will be reviewed to see if\nit meets the following requirements. If you are unsure about how to meet all of these\nrequirements, please submit the PR and ask for help and/or guidance. An Astropy\nmaintainer will collaborate with you to make sure that the pull request meets the\nrequirements for inclusion in the package:\n\n**Scientific Quality** (when applicable)\n  * Is the submission relevant to astronomy?\n  * Are references included to the origin source for the algorithm?\n  * Does the code perform as expected?\n  * Has the code been tested against previously existing implementations?\n\n**Code Quality**\n  * Are the [coding guidelines](https://docs.astropy.org/en/latest/development/codeguide.html) followed?\n  * Is the code compatible with Python >=3.8?\n  * Are there dependencies other than the `astropy` core, the Python Standard\n    Library, and NumPy 1.18.0 or later?\n    * Is the package importable even if the C-extensions are not built?\n    * Are additional dependencies handled appropriately?\n    * Do functions that require additional dependencies raise an `ImportError`\n      if they are not present?\n\n**Testing**\n  * Are the [testing guidelines](https://docs.astropy.org/en/latest/development/testguide.html) followed?\n  * Are the inputs to the functions sufficiently tested?\n  * Are there tests for any exceptions raised?\n  * Are there tests for the expected performance?\n  * Are the sources for the tests documented?\n  * Have tests that require an [optional dependency](https://docs.astropy.org/en/latest/development/testguide.html#tests-requiring-optional-dependencies)\n    been marked as such?\n  * Does ``tox -e test`` run without failures?\n\n**Documentation**\n  * Are the [documentation guidelines](https://docs.astropy.org/en/latest/development/docguide.html) followed?\n  * Is there a docstring in [numpydoc format](https://numpydoc.readthedocs.io/en/latest/format.html) in the function describing:\n    * What the code does?\n    * The format of the inputs of the function?\n    * The format of the outputs of the function?\n    * References to the original algorithms?\n    * Any exceptions which are raised?\n    * An example of running the code?\n  * Is there any information needed to be added to the docs to describe the\n    function?\n  * Does the documentation build without errors or warnings?\n\n**License**\n  * Is the `astropy` license included at the top of the file?\n  * Are there any conflicts with this code and existing codes?\n\n**Astropy requirements**\n  * Do all the GitHub Actions and CircleCI tests pass? If not, are they allowed to fail?\n  * If applicable, has an entry been added into the changelog?\n  * Can you check out the pull request and repeat the examples and tests?\n\nOther Tips\n----------\n\n- Behind the scenes, we conduct a number of tests or checks with new pull requests.\n  This is a technique that is called continuous integration, and we use GitHub Actions\n  and CircleCI. To prevent the automated tests from running, you can add ``[ci skip]``\n  to your commit message. This is useful if your PR is a work in progress (WIP) and\n  you are not yet ready for the tests to run. For example:\n\n      $ git commit -m \"WIP widget [ci skip]\"\n\n  - If you already made the commit without including this string, you can edit\n    your existing commit message by running:\n\n        $ git commit --amend\n\n- If your commit makes substantial changes to the documentation but none of\n  those changes include code snippets, then you can use ``[ci skip]``,\n  which will skip all CI except RTD, where the documentation is built.\n\n- When contributing trivial documentation fixes (i.e., fixes to typos, spelling,\n  grammar) that don't contain any special markup and are not associated with\n  code changes, please include the string ``[ci skip]`` in your commit\n  message.\n\n      $ git commit -m \"Fixed typo [ci skip]\"\n\n- ``[ci skip]`` and ``[skip ci]`` are the same and can be used interchangeably.\n"},{"id":10,"name":"GOVERNANCE.md","nodeType":"TextFile","path":"","text":"# Astropy Project Governance\n\nPlease visit our website to learn more about the [Astropy Team](http://www.astropy.org/team.html).\n"},{"id":11,"name":"LICENSE.rst","nodeType":"TextFile","path":"","text":"Copyright (c) 2011-2021, Astropy Developers\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n* Redistributions in binary form must reproduce the above copyright notice, this\n  list of conditions and the following disclaimer in the documentation and/or\n  other materials provided with the distribution.\n* Neither the name of the Astropy Team nor the names of its contributors may be\n  used to endorse or promote products derived from this software without\n  specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"},{"id":12,"name":"MANIFEST.in","nodeType":"TextFile","path":"","text":"include .astropy-root\ninclude LICENSE.rst\ninclude README.rst\ninclude CHANGES.rst\ninclude pip-requirements*\ninclude CITATION\ninclude astropy/CITATION\ninclude pyproject.toml\n\ninclude setup.cfg\nrecursive-include astropy *.pyx *.c *.h *.map *.templ\n\ninclude astropy/astropy.cfg\n\ninclude astropy/extern/configobj/*.py\nrecursive-include astropy/utils/compat *.py\n\nrecursive-include docs *\nrecursive-include examples *\nrecursive-include licenses *\nrecursive-include cextern *\nrecursive-include scripts *\nrecursive-include static *\n\n# This subpckage is only used in development checkouts and should not be\n# included in built tarballs\nprune astropy/_dev\n\nprune docs/_build\nprune build\n\nglobal-exclude *.pyc *.o\n"},{"id":13,"name":"pip-requirements","nodeType":"TextFile","path":"","text":"# The pip-requirements file should no longer be used. Instead, to install\n# astropy along with its dependencies, you can use:\n#\n#   pip install .\n#\n# to install only the minimal dependencies, or e.g.:\n#\n#   pip install .[all]\n#\n# to install all optional dependencies.\n"},{"id":14,"name":"pyproject.toml","nodeType":"TextFile","path":"","text":"[build-system]\nrequires = [\"setuptools\",\n            \"setuptools_scm>=6.2\",\n            \"wheel\",\n            \"cython==0.29.22\",\n            \"oldest-supported-numpy\",\n            \"extension-helpers\"]\nbuild-backend = 'setuptools.build_meta'\n\n[tool.setuptools_scm]\nwrite_to = \"astropy/_version.py\"\n\n[tool.astropy-bot]\n    [tool.astropy-bot.autolabel]\n        # Comment this out to re-enable but then labeler Action needs to be disabled.\n        enabled = false\n\n    [tool.astropy-bot.changelog_checker]\n        enabled = false\n\n[tool.towncrier]\n    package = \"astropy\"\n    filename = \"CHANGES.rst\"\n    directory = \"docs/changes\"\n    underlines = \"=-^\"\n    template = \"docs/changes/template.rst\"\n    title_format = \"{version} ({project_date})\"\n\n    [[tool.towncrier.type]]\n        directory = \"feature\"\n        name = \"New Features\"\n        showcontent = true\n\n    [[tool.towncrier.type]]\n        directory = \"api\"\n        name = \"API Changes\"\n        showcontent = true\n\n    [[tool.towncrier.type]]\n        directory = \"bugfix\"\n        name = \"Bug Fixes\"\n        showcontent = true\n\n    [[tool.towncrier.type]]\n        directory = \"other\"\n        name = \"Other Changes and Additions\"\n        showcontent = true\n\n    [[tool.towncrier.section]]\n        name = \"\"\n        path = \"\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.config\"\n        path = \"config\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.constants\"\n        path = \"constants\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.convolution\"\n        path = \"convolution\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.coordinates\"\n        path = \"coordinates\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.cosmology\"\n        path = \"cosmology\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.extern\"\n        path = \"extern\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.io.ascii\"\n        path = \"io.ascii\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.io.fits\"\n        path = \"io.fits\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.io.misc\"\n        path = \"io.misc\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.io.registry\"\n        path = \"io.registry\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.io.votable\"\n        path = \"io.votable\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.modeling\"\n        path = \"modeling\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.nddata\"\n        path = \"nddata\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.samp\"\n        path = \"samp\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.stats\"\n        path = \"stats\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.table\"\n        path = \"table\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.tests\"\n        path = \"tests\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.time\"\n        path = \"time\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.timeseries\"\n        path = \"timeseries\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.uncertainty\"\n        path = \"uncertainty\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.units\"\n        path = \"units\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.utils\"\n        path = \"utils\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.visualization\"\n        path = \"visualization\"\n\n    [[tool.towncrier.section]]\n        name = \"astropy.wcs\"\n        path = \"wcs\"\n\n[tool.gilesbot]\n    [tool.gilesbot.circleci_artifacts]\n        enabled = false\n\n    [tool.gilesbot.pull_requests]\n        enabled = true\n\n    [tool.gilesbot.towncrier_changelog]\n        enabled = true\n        verify_pr_number = true\n        changelog_skip_label = \"no-changelog-entry-needed\"\n        help_url = \"https://github.com/astropy/astropy/blob/main/docs/changes/README.rst\"\n        changelog_missing_long = \"There isn't a changelog file in this pull request. Please add a changelog file to the `changelog/` directory following the instructions in the changelog [README](https://github.com/astropy/astropy/blob/main/docs/changes/README.rst).\"\n        type_incorrect_long = \"The changelog file you added is not one of the allowed types. Please use one of the types described in the changelog [README](https://github.com/astropy/astropy/blob/main/docs/changes/README.rst)\"\n        number_incorrect_long = \"The number in the changelog file you added does not match the number of this pull request. Please rename the file.\"\n"},{"id":15,"name":"README.rst","nodeType":"TextFile","path":"","text":"=======\nAstropy\n=======\n\n|Actions Status| |CircleCI Status| |Azure Status| |Coverage Status| |PyPI Status| |Documentation Status| |Zenodo|\n\nThe Astropy Project (http://astropy.org/) is a community effort to develop a\nsingle core package for Astronomy in Python and foster interoperability between\nPython astronomy packages. This repository contains the core package which is\nintended to contain much of the core functionality and some common tools needed\nfor performing astronomy and astrophysics with Python.\n\nReleases are `registered on PyPI <https://pypi.org/project/astropy>`_,\nand development is occurring at the\n`project's GitHub page <http://github.com/astropy/astropy>`_.\n\nFor installation instructions, see the `online documentation <https://docs.astropy.org/>`_\nor  `docs/install.rst <docs/install.rst>`_ in this source distribution.\n\nContributing Code, Documentation, or Feedback\n---------------------------------------------\n\nThe Astropy Project is made both by and for its users, so we welcome and\nencourage contributions of many kinds. Our goal is to keep this a positive,\ninclusive, successful, and growing community by abiding with the\n`Astropy Community Code of Conduct <http://www.astropy.org/about.html#codeofconduct>`_.\n\nMore detailed information on contributing to the project or submitting feedback\ncan be found on the `contributions <http://www.astropy.org/contribute.html>`_\npage. A `summary of contribution guidelines <CONTRIBUTING.md>`_ can also be\nused as a quick reference when you are ready to start writing or validating\ncode for submission.\n\nSupporting the Project\n----------------------\n\n|NumFOCUS| |Donate|\n\nThe Astropy Project is sponsored by NumFOCUS, a 501(c)(3) nonprofit in the\nUnited States. You can donate to the project by using the link above, and this\ndonation will support our mission to promote sustainable, high-level code base\nfor the astronomy community, open code development, educational materials, and\nreproducible scientific research.\n\nLicense\n-------\n\nAstropy is licensed under a 3-clause BSD style license - see the\n`LICENSE.rst <LICENSE.rst>`_ file.\n\n.. |Actions Status| image:: https://github.com/astropy/astropy/workflows/CI/badge.svg\n    :target: https://github.com/astropy/astropy/actions\n    :alt: Astropy's GitHub Actions CI Status\n\n.. |CircleCI Status| image::  https://img.shields.io/circleci/build/github/astropy/astropy/main?logo=circleci&label=CircleCI\n    :target: https://circleci.com/gh/astropy/astropy\n    :alt: Astropy's CircleCI Status\n\n.. |Azure Status| image:: https://dev.azure.com/astropy-project/astropy/_apis/build/status/astropy.astropy?repoName=astropy%2Fastropy&branchName=main\n    :target: https://dev.azure.com/astropy-project/astropy\n    :alt: Astropy's Azure Pipelines Status\n\n.. |Coverage Status| image:: https://codecov.io/gh/astropy/astropy/branch/main/graph/badge.svg\n    :target: https://codecov.io/gh/astropy/astropy\n    :alt: Astropy's Coverage Status\n\n.. |PyPI Status| image:: https://img.shields.io/pypi/v/astropy.svg\n    :target: https://pypi.org/project/astropy\n    :alt: Astropy's PyPI Status\n\n.. |Zenodo| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.4670728.svg\n   :target: https://doi.org/10.5281/zenodo.4670728\n   :alt: Zenodo DOI\n\n.. |Documentation Status| image:: https://img.shields.io/readthedocs/astropy/latest.svg?logo=read%20the%20docs&logoColor=white&label=Docs&version=stable\n    :target: https://docs.astropy.org/en/stable/?badge=stable\n    :alt: Documentation Status\n\n.. |NumFOCUS| image:: https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A\n    :target: http://numfocus.org\n    :alt: Powered by NumFOCUS\n\n.. |Donate| image:: https://img.shields.io/badge/Donate-to%20Astropy-brightgreen.svg\n    :target: https://numfocus.salsalabs.org/donate-to-astropy/index.html\n\n\nIf you locally cloned this repo before 7 Apr 2021\n-------------------------------------------------\n\nThe primary branch for this repo has been transitioned from ``master`` to\n``main``.  If you have a local clone of this repository and want to keep your\nlocal branch in sync with this repo, you'll need to do the following in your\nlocal clone from your terminal::\n\n   git fetch --all --prune\n   # you can stop here if you don't use your local \"master\"/\"main\" branch\n   git branch -m master main\n   git branch -u origin/main main\n\nIf you are using a GUI to manage your repos you'll have to find the equivalent\ncommands as it's different for different programs. Alternatively, you can just\ndelete your local clone and re-clone!\n"},{"id":16,"name":"setup.cfg","nodeType":"TextFile","path":"","text":"[metadata]\nname = astropy\nauthor = The Astropy Developers\nauthor_email = astropy.team@gmail.com\nlicense = BSD 3-Clause License\nlicense_file = LICENSE.rst\nurl = http://astropy.org\ndescription = Astronomy and astrophysics core library\nlong_description = file: README.rst\nkeywords = astronomy, astrophysics, cosmology, space, science,units, table, wcs, samp, coordinate, fits, modeling, models, fitting, ascii\nclassifiers =\n    Intended Audience :: Science/Research\n    License :: OSI Approved :: BSD License\n    Operating System :: OS Independent\n    Programming Language :: C\n    Programming Language :: Cython\n    Programming Language :: Python :: 3\n    Programming Language :: Python :: Implementation :: CPython\n    Topic :: Scientific/Engineering :: Astronomy\n    Topic :: Scientific/Engineering :: Physics\n\n[options]\n# We set packages to find: to automatically find all sub-packages\npackages = find:\nzip_safe = False\ntests_require = pytest-astropy\ninstall_requires =\n    numpy>=1.18\n    pyerfa>=2.0\n    PyYAML>=3.13\n    packaging>=19.0\npython_requires = >=3.8\n\n[options.packages.find]\nexclude = astropy._dev\n\n[options.entry_points]\nconsole_scripts =\n    fits2bitmap = astropy.visualization.scripts.fits2bitmap:main\n    fitscheck = astropy.io.fits.scripts.fitscheck:main\n    fitsdiff = astropy.io.fits.scripts.fitsdiff:main\n    fitsheader = astropy.io.fits.scripts.fitsheader:main\n    fitsinfo = astropy.io.fits.scripts.fitsinfo:main\n    samp_hub = astropy.samp.hub_script:hub_script\n    showtable = astropy.table.scripts.showtable:main\n    volint = astropy.io.votable.volint:main\n    wcslint = astropy.wcs.wcslint:main\nasdf_extensions =\n    astropy = astropy.io.misc.asdf.extension:AstropyExtension\n    astropy-asdf = astropy.io.misc.asdf.extension:AstropyAsdfExtension\n\n[options.extras_require]\ntest =  # Required to run the astropy test suite.\n    pytest-astropy>=0.9\n    pytest-astropy-header!=0.2.0\n    pytest-xdist\ntest_all =  # Required for testing, plus packages used by particular tests.\n    pytest-astropy>=0.9\n    pytest-xdist\n    objgraph\n    ipython>=4.2\n    coverage\n    skyfield>=1.20\n    sgp4>=2.3\nrecommended =\n    scipy>=1.3\n    matplotlib>=3.1,!=3.4.0\nall =\n    scipy>=1.3\n    matplotlib>=3.1,!=3.4.0\n    certifi\n    dask[array]\n    h5py\n    pyarrow>=5.0.0\n    beautifulsoup4\n    html5lib\n    bleach\n    pandas\n    sortedcontainers\n    pytz\n    jplephem\n    mpmath\n    asdf>=2.10.0\n    bottleneck\n    ipython>=4.2\n    pytest\n    typing_extensions>=3.10.0.1\ndocs =\n    sphinx<4\n    sphinx-astropy>=1.6\n    pytest\n    scipy>=1.3\n    matplotlib>=3.1,!=3.4.0\n    sphinx-changelog>=1.1.0\n\n[options.package_data]\n* = data/*, data/*/*, data/*/*/*, data/*/*/*/*, data/*/*/*/*/*, data/*/*/*/*/*/*\nastropy = astropy.cfg, CITATION\nastropy.cosmology = data/*.ecsv\nastropy.utils.tests = data/.hidden_file.txt\nastropy.wcs = include/*/*.h\nastropy.wcs.tests = extension/*.c\n\n[tool:pytest]\nminversion = 7.0\ntestpaths = \"astropy\" \"docs\"\nnorecursedirs =\n    \"docs[\\/]_build\"\n    \"docs[\\/]generated\"\n    \"astropy[\\/]extern\"\n    \"astropy[\\/]_erfa\"\n    \"astropy[\\/]_dev\"\nastropy_header = true\ndoctest_plus = enabled\ntext_file_format = rst\nopen_files_ignore = \"astropy.log\" \"/etc/hosts\" \"*.ttf\"\nremote_data_strict = true\naddopts = --doctest-rst\nasdf_schema_root = astropy/io/misc/asdf/data/schemas\nasdf_schema_tests_enabled = true\nxfail_strict = true\nqt_no_exception_capture = 1\nfilterwarnings =\n    error\n    ignore:unclosed <socket:ResourceWarning\n    ignore:unclosed <ssl.SSLSocket:ResourceWarning\n    ignore:numpy\\.ufunc size changed:RuntimeWarning\n    ignore:numpy\\.ndarray size changed:RuntimeWarning\n    ignore:Importing from numpy:DeprecationWarning:scipy\n    ignore:Conversion of the second argument:FutureWarning:scipy\n    ignore:Using a non-tuple sequence:FutureWarning:scipy\n    ignore:Using or importing the ABCs from 'collections':DeprecationWarning\n    ignore:Unknown pytest\\.mark\\.mpl_image_compare:pytest.PytestUnknownMarkWarning\n    ignore:Unknown config option:pytest.PytestConfigWarning\n    ignore:matplotlibrc text\\.usetex:UserWarning:matplotlib\n    # Triggered by ProgressBar > ipykernel.iostream\n    ignore:the imp module is deprecated:DeprecationWarning\n    # toolz internal deprecation warning https://github.com/pytoolz/toolz/issues/500\n    ignore:The toolz\\.compatibility module is no longer needed:DeprecationWarning\n    # Ignore a warning we emit about not supporting the parallel\n    # reading option for now, can be removed once the issue is fixed\n    ignore:parallel reading does not currently work, so falling back to serial\n    # numpy configurable allocator now wants memory policy set\n    ignore:Trying to dealloc data, but a memory policy is not set.\ndoctest_norecursedirs =\n    */setup_package.py\ndoctest_subpackage_requires =\n    astropy/io/misc/asdf/* = asdf\n    astropy/table/mixins/dask.py = dask\n\n[flake8]\nmax-line-length = 100\nexclude = extern,*parsetab.py,*lextab.py,astropy/_erfa/core.py\n\n[pycodestyle]\nmax-line-length = 100\nexclude = extern,*parsetab.py,*lextab.py,astropy/_erfa/core.py\n\n[isort]\nline_length = 99\nsections = FUTURE,STDLIB,THIRDPARTY,NUMPY,FIRSTPARTY,LOCALFOLDER\ndefault_section = THIRDPARTY\nknown_first_party = astropy\nknown_numpy = numpy\nmulti_line_output = 0\nbalanced_wrapping = True\ninclude_trailing_comma = false\n\n[coverage:run]\nomit =\n  astropy/__init__*\n  astropy/conftest.py\n  astropy/*setup*\n  astropy/*/tests/*\n  astropy/tests/test_*\n  astropy/extern/*\n  astropy/utils/compat/*\n  astropy/version*\n  astropy/wcs/docstrings*\n  astropy/_erfa/*\n  */astropy/__init__*\n  */astropy/conftest.py\n  */astropy/*setup*\n  */astropy/*/tests/*\n  */astropy/tests/test_*\n  */astropy/extern/*\n  */astropy/utils/compat/*\n  */astropy/version*\n  */astropy/wcs/docstrings*\n  */astropy/_erfa/*\n\n[coverage:report]\nexclude_lines =\n  # Have to re-enable the standard pragma\n  pragma: no cover\n  # Don't complain about packages we have installed\n  except ImportError\n  # Don't complain if tests don't hit assertions\n  raise AssertionError\n  raise NotImplementedError\n  # Don't complain about script hooks\n  def main\\(.*\\):\n  # Ignore branches that don't pertain to this version of Python\n  pragma: py{ignore_python_version}\n  # Don't complain about IPython completion helper\n  def _ipython_key_completions_\n"},{"fileName":"setup.py","filePath":"","id":17,"nodeType":"File","text":"#!/usr/bin/env python\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# NOTE: The configuration for the package, including the name, version, and\n# other information are set in the setup.cfg file.\n\nimport sys\n\n# First provide helpful messages if contributors try and run legacy commands\n# for tests or docs.\n\nTEST_HELP = \"\"\"\nNote: running tests is no longer done using 'python setup.py test'. Instead\nyou will need to run:\n\n    tox -e test\n\nIf you don't already have tox installed, you can install it with:\n\n    pip install tox\n\nIf you only want to run part of the test suite, you can also use pytest\ndirectly with::\n\n    pip install -e .[test]\n    pytest\n\nFor more information, see:\n\n  https://docs.astropy.org/en/latest/development/testguide.html#running-tests\n\"\"\"\n\nif 'test' in sys.argv:\n    print(TEST_HELP)\n    sys.exit(1)\n\nDOCS_HELP = \"\"\"\nNote: building the documentation is no longer done using\n'python setup.py build_docs'. Instead you will need to run:\n\n    tox -e build_docs\n\nIf you don't already have tox installed, you can install it with:\n\n    pip install tox\n\nYou can also build the documentation with Sphinx directly using::\n\n    pip install -e .[docs]\n    cd docs\n    make html\n\nFor more information, see:\n\n  https://docs.astropy.org/en/latest/install.html#builddocs\n\"\"\"\n\nif 'build_docs' in sys.argv or 'build_sphinx' in sys.argv:\n    print(DOCS_HELP)\n    sys.exit(1)\n\n\n# Only import these if the above checks are okay\n# to avoid masking the real problem with import error.\nfrom setuptools import setup  # noqa\nfrom extension_helpers import get_extensions  # noqa\n\nsetup(ext_modules=get_extensions())\n"},{"id":18,"name":"tox.ini","nodeType":"TextFile","path":"","text":"[tox]\nenvlist =\n    py{38,39,310,dev}-test{,-image,-recdeps,-alldeps,-oldestdeps,-devdeps,-numpy118,-numpy119,-numpy120,-numpy121,-mpl311}{,-cov}{,-clocale}\n    build_docs\n    linkcheck\n    codestyle\nrequires =\n    setuptools >= 30.3.0\n    pip >= 19.3.1\n    tox-pypi-filter >= 0.12\nisolated_build = true\n\n[testenv]\n\n# The following option combined with the use of the tox-pypi-filter above allows\n# project-wide pinning of dependencies, e.g. if new versions of pytest do not\n# work correctly with pytest-astropy plugins. Most of the time the pinnings file\n# should be empty.\npypi_filter = https://raw.githubusercontent.com/astropy/ci-helpers/main/pip_pinnings.txt\n\n# Pass through the following environment variables which are needed for the CI\npassenv = HOME WINDIR LC_ALL LC_CTYPE CC CI IS_CRON ARCH_ON_CI TEST_READ_HUGE_FILE\n\n# For coverage, we need to pass extra options to the C compiler\nsetenv =\n    cov: CFLAGS = --coverage -fno-inline-functions -O0\n    image: MPLFLAGS = --mpl\n    !image: MPLFLAGS =\n    clocale: LC_CTYPE = C.ascii\n    clocale: LC_ALL = C\n\n# Run the tests in a temporary directory to make sure that we don't import\n# astropy from the source tree\nchangedir = .tmp/{envname}\n\n# tox environments are constructed with so-called 'factors' (or terms)\n# separated by hyphens, e.g. test-devdeps-cov. Lines below starting with factor:\n# will only take effect if that factor is included in the environment name. To\n# see a list of example environments that can be run, along with a description,\n# run:\n#\n#     tox -l -v\n#\ndescription =\n    run tests\n    recdeps: with recommended optional dependencies\n    alldeps: with all optional and test dependencies\n    devdeps: with the latest developer version of key dependencies\n    oldestdeps: with the oldest supported version of key dependencies\n    cov: and test coverage\n    numpy118: with numpy 1.18.*\n    numpy119: with numpy 1.19.*\n    numpy120: with numpy 1.20.*\n    numpy121: with numpy 1.21.*\n    image: with image tests\n    mpl311: with matplotlib 3.1.1\n    mpldev: with the latest developer version of matplotlib\n    double: twice in a row to check for global state changes\n\ndeps =\n    numpy118: numpy==1.18.*\n    numpy119: numpy==1.19.*\n    numpy120: numpy==1.20.*\n    numpy121: numpy==1.21.*\n\n    mpl311: matplotlib==3.1.1\n\n    image: latex\n    image: scipy\n    image: pytest-mpl\n\n    # Temporary pin pytest-astropy-header\n    test: pytest-astropy-header==0.1.2\n\n    # The oldestdeps factor is intended to be used to install the oldest versions of all\n    # dependencies that have a minimum version.\n    oldestdeps: numpy==1.18.*\n    oldestdeps: matplotlib==3.1.*\n    oldestdeps: asdf==2.9.2\n    oldestdeps: scipy==1.3.*\n    oldestdeps: pyyaml==3.13\n    oldestdeps: ipython==4.2.*\n    # ipython did not pin traitlets, so we have to\n    oldestdeps: traitlets<4.1\n\n    # pytest-openfiles pinned because of https://github.com/astropy/astropy/issues/10160 (takes too long)\n    alldeps: pytest-openfiles==0.4.0\n\n    # The devdeps factor is intended to be used to install the latest developer version\n    # or nightly wheel of key dependencies.\n    devdeps,mpldev: git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib\n    devdeps: git+https://github.com/asdf-format/asdf.git#egg=asdf\n    devdeps: git+https://github.com/liberfa/pyerfa.git#egg=pyerfa\n\n# The following indicates which extras_require from setup.cfg will be installed\nextras =\n    test: test\n    recdeps: recommended\n    alldeps: all\n    alldeps: test_all\n\ncommands =\n    devdeps: pip install -U --pre -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy\n    pip freeze\n    !cov-!double: pytest --pyargs astropy {toxinidir}/docs {env:MPLFLAGS} {posargs}\n    cov-!double: pytest --pyargs astropy {toxinidir}/docs {env:MPLFLAGS} --cov astropy --cov-config={toxinidir}/setup.cfg {posargs}\n    double: python -c 'import sys; from astropy import test; test(); sys.exit(test())'\n    cov: coverage xml -o {toxinidir}/coverage.xml\n\n# This lets developers to use tox to build docs and ignores warnings.\n# This is not used in CI; For that, we have RTD PR builder.\n[testenv:build_docs]\nchangedir = docs\ndescription = invoke sphinx-build to build the HTML docs\nextras = docs\ncommands =\n    pip freeze\n    sphinx-build -b html . _build/html {posargs:-j auto}\n\n[testenv:linkcheck]\nchangedir = docs\ndescription = check the links in the HTML docs\nextras = docs\ncommands =\n    pip freeze\n    sphinx-build -b linkcheck . _build/html {posargs:-W}\n\n[testenv:codestyle]\nskip_install = true\ndescription = Run all style and file checks with pre-commit\ndeps =\n    pre-commit\ncommands =\n    pre-commit install-hooks\n    pre-commit run {posargs:--color always --all-files --show-diff-on-failure}\n\n[testenv:pyinstaller]\n# Check that astropy can be included in a PyInstaller bundle without any issues. This\n# also serves as a test that tests do not import anything from outside the tests\n# directories with relative imports, since we copy the tests out to a separate directory\n# to run them.\ndescription = check that astropy can be included in a pyinstaller bundle\nchangedir = .pyinstaller\ndeps =\n    pyinstaller\n    pytest-mpl\n    matplotlib\nextras = test\ncommands =\n    pyinstaller --onefile run_astropy_tests.py \\\n                --distpath . \\\n                --additional-hooks-dir hooks \\\n                --exclude-module tkinter \\\n                --collect-submodules=py \\\n                --hidden-import pytest \\\n                --hidden-import pytest_openfiles.plugin \\\n                --hidden-import pytest_remotedata.plugin \\\n                --hidden-import pytest_doctestplus.plugin \\\n                --hidden-import pytest_mpl.plugin\n    ./run_astropy_tests --astropy-root {toxinidir}\n"},{"id":19,"name":".pep8speaks.yml","nodeType":"TextFile","path":"","text":"scanner:\n    diff_only: True\n    linter: flake8\n\nflake8:\n    max-line-length: 100\n    select:\n        - E101 # mix of tabs and spaces\n        - W191 # use of tabs\n        - E201 # whitespace after '('\n        - E202 # whitespace before ')'\n        - W291 # trailing whitespace\n        - W292 # no newline at end of file\n        - W293 # trailing whitespace\n        - W391 # blank line at end of file\n        - E111 # 4 spaces per indentation level\n        - E112 # 4 spaces per indentation level\n        - E113 # 4 spaces per indentation level\n        - E301 # expected 1 blank line, found 0\n        - E302 # expected 2 blank lines, found 0\n        - E303 # too many blank lines (3)\n        - E304 # blank lines found after function decorator\n        - E305 # expected 2 blank lines after class or function definition\n        - E306 # expected 1 blank line before a nested definition\n        - E502 # the backslash is redundant between brackets\n        - E722 # do not use bare except\n        - E901 # SyntaxError or IndentationError\n        - E902 # IOError\n        - E999 # SyntaxError -- failed to compile a file into an Abstract Syntax Tree\n        - F822 # undefined name in __all__\n        - F823 # local variable name referenced before assignment\n\nno_blank_comment: True\ndescending_issues_order: False\n\nmessage:\n    opened:\n        header: >\n          Hello @{name} :wave:! Thanks for opening this pull request, we are\n          very grateful for your contribution! I'm a friendly :robot: that\n          checks for style issues in this pull request, since this project\n          follows the [PEP8](https://www.python.org/dev/peps/pep-0008/) style\n          guidelines. I've listed some small issues I found below, but please\n          don't hesitate to ask if any of them are unclear!\n    updated:\n        header: >\n          Hello @{name} :wave:! It looks like you've made some changes in your\n          pull request, so I've checked the code again for style.\n    no_errors: \"There are no PEP8 style issues with this pull request - thanks! :tada:\"\n"},{"id":20,"name":".gitattributes","nodeType":"TextFile","path":"","text":"*.fits    -text\n"},{"id":21,"name":".pre-commit-config.yaml","nodeType":"TextFile","path":"","text":"repos:\n\n- repo: https://github.com/pre-commit/pre-commit-hooks\n  rev: v4.0.1\n  hooks:\n  - id: check-added-large-files\n  - id: check-case-conflict\n  - id: check-yaml\n  - id: debug-statements\n  - id: end-of-file-fixer\n    exclude: \".*(data.*|extern.*|licenses.*|_parsetab.py)$\"\n  - id: trailing-whitespace\n    exclude: \".*(data.*|extern.*|licenses.*|_parsetab.py|test_cds.py)$\"\n\n# - repo: https://github.com/timothycrosley/isort\n#   rev: 5.9.2\n#   hooks:\n#   - id: isort\n# - repo: https://github.com/asottile/pyupgrade\n#   rev: v2.21.0\n#   hooks:\n#     - id: pyupgrade\n\n# We list the warnings/errors to check for here rather than in setup.cfg because\n# we don't want these options to apply whenever anyone calls flake8 from the\n# command-line or their code editor - in this case all warnings/errors should be\n# checked for. The warnings/errors we check for here are:\n# E101 - mix of tabs and spaces\n# W191 - use of tabs\n# E201 - whitespace after '('\n# E202 - whitespace before ')'\n# W291 - trailing whitespace\n# W292 - no newline at end of file\n# W293 - trailing whitespace\n# W391 - blank line at end of file\n# E111 - 4 spaces per indentation level\n# E112 - 4 spaces per indentation level\n# E113 - 4 spaces per indentation level\n# E301 - expected 1 blank line, found 0\n# E302 - expected 2 blank lines, found 0\n# E303 - too many blank lines (3)\n# E304 - blank lines found after function decorator\n# E305 - expected 2 blank lines after class or function definition\n# E306 - expected 1 blank line before a nested definition\n# E502 - the backslash is redundant between brackets\n# E722 - do not use bare except\n# E901 - SyntaxError or IndentationError\n# E902 - IOError\n# E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree\n# F822: undefined name in __all__\n# F823: local variable name referenced before assignment\n- repo: https://gitlab.com/pycqa/flake8\n  rev: 3.9.2\n  hooks:\n    - id: flake8\n      args: ['--count', '--select', 'E101,W191,E201,E202,W291,W292,W293,W391,E111,E112,E113,E30,E502,E722,E901,E902,E999,F822,F823']\n      exclude: \".*(data.*|extern.*|cextern)$\"\n\n- repo: local\n  hooks:\n    - id: changelogs-rst\n      name: changelog filenames\n      language: fail\n      entry: >-\n        changelog files must be named <sub-package>/####.(bugfix|feature|api).rst\n        or ####.other.rst (in the root directory only)\n      exclude: >-\n        ^docs/changes/[\\w\\.]+/(\\d+\\.(bugfix|feature|api)(\\.\\d)?.rst|.gitkeep)\n      files: ^docs/changes/[\\w\\.]+/\n    - id: changelogs-rst-other\n      name: changelog filenames for other category\n      language: fail\n      entry: >-\n        only \"other\" changelog files must be placed in the root directory\n      exclude: >-\n        ^docs/changes/(\\d+\\.other.rst|README.rst|template.rst)\n      files: ^docs/changes/\\d+.\\w+.rst\n"},{"id":22,"name":".readthedocs.yml","nodeType":"TextFile","path":"","text":"version: 2\n\nbuild:\n  os: ubuntu-20.04\n  apt_packages:\n    - graphviz\n  tools:\n    python: \"3.9\"\n\nsphinx:\n  builder: html\n  configuration: docs/conf.py\n  fail_on_warning: true\n\n# Install regular dependencies.\n# Then, install special pinning for RTD.\npython:\n  system_packages: false\n  install:\n    - method: pip\n      path: .\n      extra_requirements:\n        - docs\n        - all\n\n# Don't build any extra formats\nformats: []\n"},{"id":23,"name":".mailmap","nodeType":"TextFile","path":"","text":"Aarya Patil                  <aaryapatil1996@gmail.com>\nAarya Patil                  <aaryapatil1996@gmail.com> <root@aaryas-MacBook-Pro.local>\nAdam Ginsburg                <keflavich@gmail.com>\nAdam Ginsburg                <keflavich@gmail.com> <adam.g.ginsburg@gmail.com>\nAdam Ginsburg                <keflavich@gmail.com> <keflavich@yahoo.com>\nAdele Plunkett               <aplunket@eso.org>\nAdrian Price-Whelan          <adrian.prw@gmail.com>\nAdrian Price-Whelan          <adrian.prw@gmail.com> <adrianmpw@gmail.com>\nAlbert Y. Shih               <ayshih@gmail.com>\nAleh Khvalko                 <algerdnazgul@gmail.com>\nAleksi Suutarinen            <aleksi.suutarinen@iki.fi> <aleksi.suutarinen@gmail.com>\nAlex Conley                  <alexander.conley@colorado.edu>\nAlex Conley                  <alexander.conley@colorado.edu> <alexanderconley@gmail.com>\nAlex Hagen                   <mr.alex.hagen@gmail.com>\nAlex Rudy                    <alex.rudy@gmail.com>\nAlexander Bakanov            <bakanov.aleksandr@gmail.com>  <aleksandr_bakanov@epam.com>\nAlexandre Beelen             <alexandre.beelen@ias.u-psud.fr>\nAlexandre Beelen             <alexandre.beelen@ias.u-psud.fr> <alexandre.beelen@lam.fr>\nAmit Kumar                   <dtu.amit@gmail.com>\nAna Posses                   <anaposses@gmail.com>\nAnany Shrey Jain             <ananyashreyjain1998@gmail.com>  <31594632+ananyashreyjain@users.noreply.github.com>\nAndy Casey                   <andycasey@gmail.com>\nAniket Kulkarni              <kaniket21@gmail.com>\nAniket Sanghi                <asanghi01@gmail.com>\nAnirudh Katipally            <akatipally@abiomed.com>\nAnne Archibald               <peridot.faceted@gmail.com> <archibald@astron.nl>\nAnne Archibald               <peridot.faceted@gmail.com> <anne.archibald@ncl.ac.uk>\nAnthony Horton               <anthony.horton@aao.gov.au>\nAsish Panda                  <asishrocks95@gmail.com>\nAsra Nizami                  <anizami@macalester.edu> <anizami@itsd-summer18.local>\nAsra Nizami                  <anizami@macalester.edu> <anizami@itsd-summer18.stsci.edu>\nAusten Groener               <Austen.Groener@gmail.com> <amg338@drexel.edu>\nAusten Groener               <Austen.Groener@gmail.com> <rocketboyausten@gmail.com>\nAxel Donath                  <axel.donath@mpi-hd.mpg.de>\nAxel Donath                  <axel.donath@mpi-hd.mpg.de> <donath@stud.uni-heidelberg.de>\nBenjamin Alan Weaver         <weaver@noao.edu> <baweaver@lbl.gov>\nBenjamin Alan Weaver         <weaver@noao.edu> <benjamin.weaver@nyu.edu>\nBenjamin Roulston            <benjamin.roulston@protonmail.com>\nBenjamin Winkel              <bwinkel@mpifr.de>  <bwinkel78@gmail.com>\nBhavya Khandelwal            <khandelwalbhavya7@gmail.com>\nBogdan Nicula                <bogdan@nicula.net>\nBrett Morris                 <brettmorris21@gmail.com>\nBrett Morris                 <brettmorris21@gmail.com> <bmmorris@uw.edu>\nBrett Morris                 <brettmorris21@gmail.com> <morrisbrettm@gmail.com>\nBrian Soto                   <iambriansoto@gmail.com>\nBrian Svoboda                <bones253@gmail.com> <bsvo@lavabit.com>\nBrigitta Sipőcz              <bsipocz@gmail.com>\nBrigitta Sipőcz              <bsipocz@gmail.com> <b.sipocz@gmail.com>\nBrigitta Sipőcz              <bsipocz@gmail.com> <bsipocz@users.noreply.github.com>\nBruce Merry                  <bmerry@ska.ac.za>\nBruce Merry                  <bmerry@ska.ac.za> <bmerry@gmail.com>\nBryce Nordgren               <bnordgren@gmail.com>\nChris Osborne                <2087801o@student.gla.ac.uk>\nChris Simpson                <csimpson@gemini.edu>\nChristian Clauss             <cclauss@bluewin.ch>\nChristoph Gohlke             <cgohlke@uci.edu>\nChristopher Bonnett          <c.bonnett@gmail.com>\nClara Brasseur               <cbrasseur@stsci.edu>\nCraig Jones                  <craig@brechmos.org>\nCraig Jones                  <craig@brechmos.org> <crjones@stsci.edu>\nCurtis McCully               <cmccully@lcogt.net>\nDan Foreman-Mackey           <foreman.mackey@gmail.com>\nDan Foreman-Mackey           <foreman.mackey@gmail.com>  <danfm@nyu.edu>\nDan P. Cunningham            <dan.p.cunningham@gmail.com>\nDan Taranu                   <dtaranu@astro.princeton.edu>\nDaniel Bell                  <stampsrule@gmail.com>\nDaniel Bell                  <stampsrule@gmail.com> <idaniel@me.com>\nDaniel D'Avella              <ddavella@stsci.edu>\nDaniel D'Avella              <ddavella@stsci.edu> <drdavella@gmail.com>\nDaniel Datsev                <dan.datsev@gmail.com>\nDaniel Datsev                <dan.datsev@gmail.com> <fabled@vortex.(none)>\nDaniel Lenz                  <dlenz.bonn@gmail.com>\nDaniel Ryan <ryand5@tcd.ie> Dan Ryan <ryand5@tcd.ie>\nDaniel Ryan <ryand5@tcd.ie> DanRyanIrish <ryand5@tcd.ie>\nDaria Cara                   <daria.cara.2@gmail.com>\nDaria Cara                   <daria.cara.2@gmail.com> <36781821+daria-cara@users.noreply.github.com>\nDavid Collom                 <dmcollom@gmail.com> <david.m.collom@gmail.com>\nDavid Collom                 <dmcollom@gmail.com> <dcollom@dcollom-linux.lco.gtn>\nDavid Collom                 <dmcollom@gmail.com> <dcollom@lco.global>\nDavid Collom                 <dmcollom@gmail.com> <dcollom@localhost.localdomain>\nDavid Grant                  <david.grant@physics.ox.ac.uk> <33813984+DavoGrant@users.noreply.github.com>\nDavid Kirkby                 <dkirkby@uci.edu>\nDavid Pérez-Suárez           <dps.helio@gmail.com>\nDavid Shupe                  <shupe@ipac.caltech.edu> <dave.shupe@gmail.com>\nDemitri Muna                 <demitri.muna@gmail.com> <beswiftly@gmail.com>\nDemitri Muna                 <demitri.muna@gmail.com> <demitri@me.com>\nDemitri Muna                 <demitri.muna@gmail.com> <github@demitri.com>\nDerek Homeier                <dhomeie@gwdg.de> <derek.homeier@ens-lyon.fr>\nDiego Asterio de Zaballa     <diegoasterio@correo.ugr.es>\nDouglas Burke                <dburke.gw@gmail.com>\nDylan Gregersen              <gregersen.dylan@gmail.com>\nEdward Gomez                 <edward@gomez.me.uk>\nElijah Bernstein-Cooper      <e.bernsteincooper@gmail.com> <ezbc@astro.wisc.edu>\nEmily Deibert                <emilydeibert@gmail.com>\nEmma Hogan                   <ehogan@gemini.edu>\nEric Depagne                 <eric@depagne.org>\nEric Koch                    <koch.eric.w@gmail.com> <koch.eric.w@gmail.com>\nE. Madison Bray              <erik.m.bray@gmail.com>\nE. Madison Bray              <erik.m.bray@gmail.com> <embray@stsci.edu>\nE. Madison Bray              <erik.m.bray@gmail.com> <erik.bray@lri.fr>\nE. Rykoff                    <erykoff@stanford.edu>\nEsteban Pardo Sánchez        <stbnps@users.noreply.github.com>\nFrancesco Montesano          <franz.bergesund@gmail.com>\nGabriel Perren               <gabrielperren@gmail.com>\nGabriel Perren               <gabrielperren@gmail.com> <Gabriel-p@users.noreply.github.com>\nGeert Barentsen              <geert@barentsen.be> <hello@geert.io>\nGeorge Galvin                <george.galvin1996@gmail.com>\nGerrit Schellenberger        <gerrit@uni-bonn.de>\nGiorgio Calderone            <giorgio.calderone@gmail.com> <gcalderone@users.noreply.github.com>\nGraham Kanarek               <graykanarek@gmail.com>\nGuillaume Pernot             <gpernot@praksys.org>\nGuillaume Pernot             <gpernot@praksys.org> <guillaume.pernot@lam.fr>\nGustavo Bragança             <ga.braganca@gmail.com>\nHannes Breytenbach           <hannes@saao.ac.za>\nHans Moritz Günther          <moritz.guenther@gmx.de>\nHans Moritz Günther          <moritz.guenther@gmx.de> <hgunther@mit.edu>\nHarry Ferguson               <ferguson@stsci.edu>\nHenrik Norman                <Honke.norman@gmail.com> <hnorma@kth.se>\nHenrik Norman                <Honke.norman@gmail.com> <honke.norman@gmail.com>\nHimanshu Pathak              <hpathak336@gmail.com>\nHumna Awan                   <humna.awan@rutgers.edu>\nIvo Busko                    <busko@stsci.edu>\nIvo Busko                    <busko@stsci.edu> <New1trilha>\nJaime Andrés                 <jaime-andres.alvarado-montes@students.mq.edu.au>\nJake VanderPlas              <jakevdp@gmail.com>\nJake VanderPlas              <jakevdp@gmail.com> <jakevdp@google.com>\nJake VanderPlas              <jakevdp@gmail.com> <jakevdp@uw.edu>\nJames McCormac               <jmccormac001@gmail.com>\nJames Tocknell               <aragilar@gmail.com>\nJames Tocknell               <aragilar@gmail.com> <aragilar+github@gmail.com>\nJames Turner                 <jturner@gemini.edu>\nJane Rigby                   <jane.rigby@gmail.com>\nJani Šumak                   <jani.sumak@gmail.com>\nJason Segnini                <47617351+JasonS09@users.noreply.github.com>\nJavier Blasco                <atreo1@hotmail.com>\nJavier Duran                 <javier.duran@sciops.esa.int> <jduran@dhcp-10-66-197-109.esac.esa.int>\nJavier Duran                 <javier.duran@sciops.esa.int> <jduran@dhcp-10-66-197-144.esac.esa.int>\nJavier Duran                 <javier.duran@sciops.esa.int> <jduran@dhcp-10-66-197-161.esac.esa.int>\nJavier Duran                 <javier.duran@sciops.esa.int> <jduran@dhcp-10-66-197-218.esac.esa.int>\nJavier Duran                 <javier.duran@sciops.esa.int> <jduran@dhcp-10-66-197-221.esac.esa.int>\nJavier Duran                 <javier.duran@sciops.esa.int> <jduran@dhcp-10-66-197-53.esac.esa.int>\nJavier Duran                 <javier.duran@sciops.esa.int> <jduran@sciops.esa.int>\nJavier Pascual Granado       <javier@iaa.es>\nJeff Taylor                  <jeff.c.taylor@gmail.com>\nJennifer Karr                <karr@l-145-118-237-197.leidenuniv.nl>\nJoe Hunkeler                 <jhunk@stsci.edu> <jhunkeler@gmail.com>\nJohannes Zeman               <johannes.zeman@googlemail.com> <zeman@icp.uni-stuttgart.de>\nJohn Parejko                 <parejkoj@uw.edu>\nJohn Parejko                 <parejkoj@uw.edu> <parejkoj@gmail.com>\nJohnny Greco                 <jgreco@astro.princeton.edu>\nJohnny Greco                 <jgreco@astro.princeton.edu>  <jgreco.astro@gmail.com>\nJonathan Foster              <jonathan.bruce.foster@gmail.com>\nJonathan Foster              <jonathan.bruce.foster@gmail.com>  <jonathan.b.foster@yale.edu>\nJonathan Gagne               <jonathan.gagne.1@gmail.com>\nJordan Mirocha               <mirochaj@gmail.com> <mirocha@rl1-140-39-dhcp.int.colorado.edu>\nJoseph Long                  <josephoenix@gmail.com> <jlong@stsci.edu>\nJoseph Long                  <josephoenix@gmail.com> <me@joseph-long.com>\nJoseph Schlitz               <jrschlitz0725@gmail.com>\nJuan Carlos Segovia          <juancarlos.segovia@gmail.com>\nJuan Luis Cano Rodríguez     <juanlu001@gmail.com>  <Juanlu001@users.noreply.github.com>\nJuan Luis Cano Rodríguez     <juanlu001@gmail.com>  <juanlu@satellogic.com>\nJuan Luis Cano Rodríguez     <juanlu001@gmail.com>  <jcano@faculty.ie.edu>\nJuan Luis Cano Rodríguez     <juanlu001@gmail.com>  <hello@juanlu.space>\nJulien Woillez               <jwoillez@gmail.com> <jwoillez@eso.org>\nJulien Woillez               <jwoillez@gmail.com> <jwoillez@gmail.org>\nJurien Huisman               <huisman@strw.leidenuniv.nl>\nKacper Kowalik               <xarthisius.kk@gmail.com>\nKacper Kowalik               <xarthisius.kk@gmail.com> <xarthisius@gentoo.org>\nKaran Grover                 <karan@karan-HP-Pavilion-dm4-Notebook-PC.(none)>\nKarl Vyhmeister              <kvyh@users.noreply.github.com>\nKelle Cruz                   <kellecruz@gmail.com>\nKevin Gullikson              <kevin.gullikson@gmail.com>\nKirill Tchernyshyov          <ktchernyshyov@pha.jhu.edu>\nKris Stern                   <krisastern@gmail.com> <kakirastern@users.noreply.github.com>\nKris Stern                   <krisastern@gmail.com> <krisastern@gobuddy.asia>\nKyle Barbary                 <kylebarbary@gmail.com> <kbarbary@lbl.gov>\nKyle Oman                    <koman@astro.rug.nl>\nLarry Bradley                <larry.bradley@gmail.com>\nLarry Bradley                <larry.bradley@gmail.com> <larrybradley@users.noreply.github.com>\nLaura Watkins                <lauralwatkins@gmail.com>\nLauren Glattly               <laurenglattly@gmail.com> <44421608+lglattly@users.noreply.github.com>\nLennard Kiehl                <luzuku@gmail.com>\nLeo Singer                   <leo.singer@ligo.org> <leo.singer@nasa.gov>\nLeonardo Ferreira            <leonardo.ferreira.furg@gmail.com> <[leonardo.ferreira.furg@gmail.com]>\nLia Corrales                 <liac@umich.edu>\nLingyi Hu                    <hulingyi1995@yahoo.com.sg>\nLisa Martin                  <48742903+lisamartin72@users.noreply.github.com>\nLisa Walter                  <lisa@stsci.edu>\nLoïc Séguin-C                <loicseguin@gmail.com> <lsc@loicseguin.com>\nLuke G. Bouma                <lgbouma@users.noreply.github.com>\nLuke Kelley                  <lkelley@cfa.harvard.edu>\nMadhura Parikh               <madhuraparikh@gmail.com>\nMagali Mebsout               <magalimebsout@gmail.com>\nMagnus Persson               <vilhelmp@gmail.com>\nManeesh Yadav                <maneesh.yadav@sri.com>\nMangala Gowri Krishnamoorthy <mangalagb@gmail.com>\nMarten van Kerkwijk          <mhvk@astro.utoronto.ca> <mhvk@swan.astro.utoronto.ca>\nMatt Davis                   <jiffyclub.programatic@gmail.com>\nMatteo Bachetti              <matteo@matteobachetti.it> <matteo.bachetti@irap.omp.eu>\nMatthew Craig                <mattwcraig@gmail.com>\nMatthieu Baumann             <baumannmatthieu0@gmail.com> <matthieu.baumann@astro.unistra.fr>\nMavani Bhautik               <mavanibhautik@gmail.com>\nMichael Brewer               <brewer@astro.umass.edu>\nMichael Brewer               <brewer@astro.umass.edu> <mkbrewer@users.noreply.github.com>\nMichael Hirsch               <scienceopen@users.noreply.github.com>\nMichael Lindner-D'Addario    <38199062+MDAddario@users.noreply.github.com>\nMichael Mommert              <mommermiscience@gmail.com> <michael.mommert@nau.edu>\nMichael Mommert              <mommermiscience@gmail.com> <mommermi@users.noreply.github.com>\nMichael Seifert              <michaelseifert04@yahoo.de>\nMichele Costa                <thenocturnalastrostudent@gmail.com>\nMichele Costa                <thenocturnalastrostudent@gmail.com> <michele.costa@unipart.io>\nMiguel de Val-Borro          <miguel.deval@gmail.com>  <miguel@archlinux.net>\nMihai Cara                   <mihail.cara@gmail.com> <mcara@itsd-osx22.home>\nMihai Cara                   <mihail.cara@gmail.com> <mcara@users.noreply.github.com>\nMike Alexandersen            <mikea@asiaa.sinica.edu.tw>\nMikhail Minin                <mminin2010@gmail.com>\nMoataz Hisham                <mtzhisham@gmail.com>\nNabil Freij                  <nabil.freij@gmail.com>\nNadia Dencheva               <nadia.astropy@gmail.com> <dencheva@itsd-osx13.local>\nNadia Dencheva               <nadia.astropy@gmail.com> <nadia.dencheva@gmail.com>\nNathaniel Starkman           <nstarkman@protonmail.com>\nNathaniel Starkman           <nstarkman@protonmail.com> <nstarman@users.noreply.github.com>\nNeil Crighton                <neilcrighton@gmail.com>\nNicholas Earl                <contact@nicholasearl.me>\nNicholas Earl                <contact@nicholasearl.me> <nchlsearl@gmail.com>\nNicholas Earl                <contact@nicholasearl.me> <nmearl@localhost.localdomain>\nNick Lloyd                   <nick.lloyd@usask.ca>\nNora Luetzgendorf            <nluetzge@gmail.com>\nOle Streicher                <ole@aip.de> <debian@liska.ath.cx>\nOle Streicher                <ole@aip.de> <olebole@debian.org>\nParikshit Sakurikar          <parikshit.sakurikar@research.iiit.ac.in>\nPatricio Rojo                <pato@das.uchile.cl> <pato@oan.cl>\nPauline Barmby               <pbarmby@uwo.ca> <pbarmby@uwo.ca>\nPerry Greenfield             <perry@stsci.edu>\nPey Lian Lim                 <lim@stsci.edu>\nPey Lian Lim                 <lim@stsci.edu> <2090236+pllim@users.noreply.github.com>\nPratik Patel                 <pratikpatel15133@gmail.com>\nPritish Chakraborty          <chakrabortypritish@gmail.com>\nRicardo Fonseca              <ricardopfonseca95@gmail.com>\nRicardo Fonseca              <ricardopfonseca95@gmail.com> <ricardopfonseca@tecnico.ulisboa.pt>\nRichard R <rrjbca@users.noreply.github.com>\nRichard R <rrjbca@users.noreply.github.com> <58728519+rrjbca@users.noreply.github.com>\nRicky O'Steen                <rosteen@stsci.edu> <39831871+rosteen@users.noreply.github.com>\nRitiek Malhotra              <ritiekmalhotra123@gmail.com>\nRitwick DSouza               <ritwick.dsouza@outlook.com>\nRohan Rajpal                 <rohan17089@iiitd.ac.in>\nRohit Kapoor                 <algorithm059@gmail.com>\nRohit Patil                  <rohit4change@yahoo.in>\nRohit Patil                  <rohit4change@yahoo.in> <Quan@Aries.(none)>\nRoman Tolesnikov             <rtolesnikov@yahoo.com>\nRyan Cooke                   <ryancooke86@gmail.com>\nSam Verstocken               <sam.verstocken@gmail.com>\nSanjeev Dubey                <getsanjeevdubey@gmail.com>\nSara Ogaz                    <ogaz@stsci.edu>\nSarah Graves                 <s.graves@eaobservatory.org>\nSergio Pascual               <sergio.pasra@gmail.com> <sergiopr@fis.ucm.es>\nShantanu Srivastava          <shan_mbic@rediffmail.com>\nShilpi Jain                  <shilpi1958@gmail.com>\nShivansh Mishra              <dHoneysh@gmail.com>\nShivansh Mishra              <dHoneysh@gmail.com> <shivanshmishra@shivanshs-MacBook-Pro.local>\nSimon Conseil                <contact@saimon.org>\nSimon Conseil                <contact@saimon.org> <simon.conseil@univ-lyon1.fr>\nSimon Conseil                <contact@saimon.org> <sconseil@gemini.edu>\nSimon Conseil                <contact@saimon.org> <s.conseil@ip2i.in2p3.fr>\nSimon Liedtke                <liedtke.simon@googlemail.com>\nSourabh Cheedella            <cheedella.sourabh@gmail.com>\nSteve Crawford               <crawfordsm@gmail.com>\nSteve Crawford               <crawfordsm@gmail.com> <crawfodsm@gmail.com>\nSteve Crawford               <crawfordsm@gmail.com> <scrawford@stsci.edu>\nStuart Littlefair            <s.littlefair@shef.ac.uk>  <s.littlefair@shef.ac.uk>\nStuart Mumford               <stuart@mumford.me.uk> <stuart@cadair.com>\nSudheesh Singanamalla        <sudheesh1995@outlook.com>\nSudheesh Singanamalla        <sudheesh1995@outlook.com> <t-sus@microsoft.com>\nSushobhana Patra             <sushobhanapatra@gmail.com>\nThomas Erben                 <terben@astro.uni-bonn.de> <thomas@astro.uni-bonn.de>\nThompson Le Blanc            <leblanc@stsci.edu>\nThompson Le Blanc            <leblanc@stsci.edu> <tlcommodore@gmail.com>\nTim Jenness                  <tjenness@lsst.org>\nTim Jenness                  <tjenness@lsst.org> <tim.jenness@gmail.com>\nTom Aldcroft                 <taldcroft@gmail.com> <aldcroft@dhcp-131-142-152-173.cfa.harvard.edu>\nTom Donaldson                <tdonaldson@stsci.edu>\nTom J Wilson                 <towilson@stsci.edu>\nTyler Finethy                <tylfin@gmail.com>\nVSN Reddy Janga              <janga1997@gmail.com>\nVishnunarayan K I            <appukuttancr@gmail.com>\nVital Fernández              <vital.fernandez@gmail.com>   <lativmail@gmail.com>\nYannick Copin                <y.copin@ipnl.in2p3.fr> <yannick.copin@laposte.net>\nYash Kumar                   <yash.kmr.99@gmail.com>\nYash Sharma                  <yashrsharma44@gmail.com>\nYingqi Ying                  <33911276+dyq0811@users.noreply.github.com>\nZach Edwards                 <Zachary.Astro@Gmail.com>\nZac Hatfield-Dodds           <zac.hatfield.dodds@gmail.com>\nZé Vinicius                  <jvmirca@gmail.com>\n"},{"id":24,"name":".gitignore","nodeType":"TextFile","path":"","text":"# Compiled files\n*.py[cod]\n*.a\n*.o\n*.so\n*.pyd\n*.dll\n__pycache__\n\n# Ignore .c files by default to avoid including generated code. If you want to\n# add a non-generated .c extension, put that into the src/ subdirectory of a\n# package or else use `git add -f filename.c`.\n*.c\n!astropy/*/src/*.c\nastropy/modeling/src/projections.c\n\n# Other generated files\nMANIFEST\nastropy/cython_version.py\nastropy/wcs/include/wcsconfig.h\nastropy/_erfa/core.py\nastropy/_version.py\n\n# Sphinx\n_build\n_generated\ndocs/api\ndocs/generated\ndocs/visualization/ngc6976.jpeg\ndocs/visualization/ngc6976-default.jpeg\n\n# Packages/installer info\n*.egg\n*.egg-info\ndist\nbuild\neggs\n.eggs\nparts\nbin\nvar\nsdist\ndevelop-eggs\n.installed.cfg\ndistribute-*.tar.gz\n.venv\nvenv\n# we are not currently using pipenv directly, but people who\n# install astropy with pipenv will have these files generated\nPipfile\nPipfile.lock\n\n# pyinstaller files\n.pyinstaller/astropy_tests/\n.pyinstaller/run_astropy_tests\n.pyinstaller/run_astropy_tests.spec\n\n\n# Other\n.cache\n.tox\n.*.swp\n.*.swo\n*~\n.project\n.pydevproject\n.settings\n.coverage\ncover\nhtmlcov\n.hypothesis\n.github_cache\n\n# Mac OSX\n.DS_Store\n\n# PyCharm\n.idea\n\n# Pytest\nv\n.pytest_cache\n\n# VSCode\n.vscode\n\n.tmp\npip-wheel-metadata\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":25,"name":"TEST_HELP","nodeType":"Attribute","startLoc":12,"text":"TEST_HELP"},{"id":26,"name":".astropy-root","nodeType":"TextFile","path":"","text":""},{"id":27,"name":"docs","nodeType":"Package"},{"id":28,"name":"changelog.rst","nodeType":"TextFile","path":"docs","text":".. _changelog:\n\n**************\nFull Changelog\n**************\n\n.. changelog::\n   :towncrier: ../\n   :towncrier-skip-if-empty:\n   :changelog_file: ../CHANGES.rst\n"},{"id":29,"name":"credits.rst","nodeType":"TextFile","path":"docs","text":"*******************\nAuthors and Credits\n*******************\n\nCore Package Contributors\n=========================\n\n* Aaron Meisner\n* Aarya Patil\n* Abhinuv Nitin Pitale\n* Abigail Stevens\n* Adam Ginsburg\n* Adele Plunkett\n* Aditya Sharma\n* Adrian Price-Whelan\n* Akash Deshpande\n* Akeem\n* Akshat Dixit\n* Akshat1Nar\n* Al Niessner\n* Albert Y. Shih\n* Aleh Khvalko\n* Alex Conley\n* Alex de la Vega\n* Alex Drlica-Wagner\n* Alex Hagen\n* Alex Rudy\n* Alexander Bakanov\n* Alexandre Beelen\n* Amit Kumar\n* Ana Posses\n* Anany Shrey Jain\n* Anchit Jain\n* Andreas Baumbach\n* Andrej Rode\n* Andrew Hearin\n* Aniket Kulkarni\n* Aniket Sanghi\n* Anirudh Katipally\n* Anne Archibald\n* Antetokounpo\n* Anthony Horton\n* Antony Lee\n* Arfon Smith\n* Arie Kurniawan\n* Arne de Laat\n* Arthur Eigenbrot\n* Asish Panda\n* Asra Nizami\n* athul\n* Austen Groener\n* Axel Donath\n* Azalee Bostroem\n* Bastian Beischer\n* Ben Greiner\n* Benjamin Alan Weaver\n* Benjamin Roulston\n* Benjamin Winkel\n* Bernardo Sulzbach\n* Bernie Simon\n* Bhavya Khandelwal\n* Bili Dong\n* Bogdan Nicula\n* Bojan Nikolic\n* Brett Morris\n* Brian Soto\n* Brigitta Sipőcz\n* britgit\n* Bruce Merry\n* Bruno Oliveira\n* Bryce Kalmbach\n* Bryce Nordgren\n* Carl Osterwisch\n* Carl Schaffer\n* Chiara Marmo\n* Chris Beaumont\n* Chris Hanley\n* Chris Osborne\n* Chris Simpson\n* Christian Clauss\n* Christian Hettlage\n* Christoph Deil\n* Christoph Gohlke\n* Christopher Bonnett\n* Chun Ly\n* Clara Brasseur\n* Clare Shanahan\n* Clément Robert\n* Conor MacBride\n* Cristian Ardelean\n* Curtis McCully\n* Dan Foreman-Mackey\n* Dan P. Cunningham\n* Dan Taranu\n* Daniel Bell\n* Daniel D'Avella\n* Daniel Datsev\n* Daniel Lenz\n* Daniel Ruschel Dutra\n* Daniel Ryan\n* Danny Goldstein\n* Daria Cara\n* David Kirkby\n* David M. Palmer\n* David Pérez-Suárez\n* David Shiga\n* David Shupe\n* David Stansby\n* Demitri Muna\n* Derek Homeier\n* Devin Crichton\n* Diego Alonso\n* Diego Asterio de Zaballa\n* disha\n* Dominik Klaes\n* Douglas Burke\n* Drew Leonard\n* Duncan Macleod\n* Dylan Gregersen\n* E\\. Madison Bray\n* E\\. Rykoff\n* Ed Slavich\n* Edward Betts\n* Edward Slavich\n* Eero Vaher\n* Eli Bressert\n* Elijah Bernstein-Cooper\n* Eloy Salinas\n* Emily Deibert\n* Emir\n* Emma Hogan\n* Eric Depagne\n* Eric Jeschke\n* Eric Koch\n* Erik Tollerud\n* Erin Allard\n* Esteban Pardo Sánchez\n* Even Rouault\n* Evert Rol\n* Felix Yan\n* fockez\n* Francesco Biscani\n* Francesco Montanari\n* Francesco Montesano\n* Frédéric Chapoton\n* Frédéric Grollier\n* Gabriel Brammer\n* Gabriel Perren\n* Geert Barentsen\n* George Galvin\n* Georgiana Ogrean\n* Gerrit Schellenberger\n* Giang Nguyen\n* Giorgio Calderone\n* Graham Kanarek\n* Grant Jenks\n* Gregory Dubois-Felsmann\n* Gregory Simonian\n* Griffin Hosseinzadeh\n* Gustavo Bragança\n* Gyanendra Shukla\n* Hannes Breytenbach\n* Hans Moritz Günther\n* Harry Ferguson\n* Helen Sherwood-Taylor\n* Himanshu Pathak\n* homeboy445\n* Hugo Buddelmeijer\n* Humna Awan\n* iamsoto\n* ikkamens\n* Inada Naoki\n* J\\. Goutin\n* J\\. Xavier Prochaska\n* Jake VanderPlas\n* Jakob Maljaars\n* James Davies\n* James Dearman\n* James Noss\n* James Taylor\n* James Tocknell\n* James Turner\n* Jan Skowron\n* Jane Rigby\n* Jani Šumak\n* Jason Segnini\n* Javier Pascual Granado\n* JC Hsu\n* Jean Connelly\n* Jeff Taylor\n* Jeffrey McBeth\n* Jero Bado\n* jimboH\n* Joanna Power\n* Joe Hunkeler\n* Joe Lyman\n* Joe Philip Ninan\n* John Fisher\n* John Parejko\n* Johnny Greco\n* Jonas Große Sundrup\n* Jonathan Eisenhamer\n* Jonathan Foster\n* Jonathan Sick\n* Jonathan Whitmore\n* Jörg Dietrich\n* Jose Sabater\n* Joseph Jon Booker\n* Joseph Long\n* Joseph Ryan\n* Joseph Schlitz\n* José Sabater Montes\n* Juan Luis Cano Rodríguez\n* Juanjo Bazán\n* Julien Woillez\n* Jurien Huisman\n* Kacper Kowalik\n* Karan Grover\n* Karl Gordon\n* Karl Vyhmeister\n* Karl Wessel\n* Katrin Leinweber\n* Kelle Cruz\n* Kevin Gullikson\n* Kevin Sooley\n* Kewei Li\n* Kieran Leschinski\n* Kirill Tchernyshyov\n* Kris Stern\n* Kristin Berry\n* Kyle Barbary\n* Kyle Oman\n* Larry Bradley\n* Laura Hayes\n* Laura Watkins\n* Lauren Glattly\n* Laurie Stephey\n* Leah Fulmer\n* Lee Spitler\n* Lehman Garrison\n* Lennard Kiehl\n* Leo Singer\n* Leonardo Ferreira\n* Lia Corrales\n* Lingyi Hu\n* Lisa Martin\n* Lisa Walter\n* Ludwig Schwardt\n* Luigi Paioro\n* Luke G. Bouma\n* Luke Kelley\n* luz paz\n* Léni Gauffier\n* M Atakan Gürkan\n* M S R Dinesh\n* Mabry Cervin\n* Madhura Parikh\n* Magali Mebsout\n* maggiesam\n* Maik Nijhuis\n* Manas Satish Bedmutha\n* Maneesh Yadav\n* Mangala Gowri Krishnamoorthy\n* Manish Biswas\n* Manodeep Sinha\n* Mark Fardal\n* Mark Taylor\n* Markus Demleitner\n* Marten van Kerkwijk\n* Martin Glatzle\n* Matej Stuchlik\n* Mathieu Servillat\n* Matt Davis\n* Matteo Bachetti\n* Matthew Bourque\n* Matthew Brett\n* Matthew Craig\n* Matthew Petroff\n* Matthew Turk\n* Matthias Bussonnier\n* Mavani Bhautik\n* Max Silbiger\n* Max Voronkov\n* Maximilian Nöthe\n* Médéric Boquien\n* Megan Sosey\n* Michael Brewer\n* Michael Droettboom\n* Michael Hirsch\n* Michael Hoenig\n* Michael Lindner-D'Addario\n* Michael Mueller\n* Michael Seifert\n* Michael Wood-Vasey\n* Michael Zhang\n* Michele Costa\n* Michele Mastropietro\n* Miguel de Val-Borro\n* Mihai Cara\n* Mike Alexandersen\n* Mike McCarty\n* Mikhail Minin\n* Mikołaj\n* Miruna Oprescu\n* Moataz Hisham\n* Mohan Agrawal\n* Molly Peeples\n* Nabil Freij\n* Nadia Dencheva\n* Nathanial Hendler\n* Nathaniel Starkman\n* Neal McBurnett\n* Neil Crighton\n* Neil Parley\n* Nicholas Earl\n* Nicholas S. Kern\n* Nicholas Saunders\n* Nick Lloyd\n* Nick Murphy\n* Nicolas Tessore\n* Nikita Saxena\n* Nikita Tewary\n* Nimit Bhardwaj\n* Noah Zuckman\n* Nora Luetzgendorf\n* odidev\n* Ole Streicher\n* Orion Poplawski\n* orionlee\n* Param Patidar\n* Parikshit Sakurikar\n* Patricio Rojo\n* Patti Carroll\n* Paul Barrett\n* Paul Hirst\n* Paul Huwe\n* Paul Price\n* Paul Sladen\n* Pauline Barmby\n* Perry Greenfield\n* Peter Cock\n* Peter Teuben\n* Peter Yoachim\n* Pey Lian Lim\n* Prasanth Nair\n* Pratik Patel\n* Pritish Chakraborty\n* Pushkar Kopparla\n* Ralf Gommers\n* Rashid Khan\n* Rasmus Handberg\n* Ray Plante\n* Régis Terrier\n* Ricardo Fonseca\n* Ricardo Ogando\n* Richard R\n* Ricky O'Steen\n* Rik van Lieshout\n* Ritiek Malhotra\n* Ritwick DSouza\n* Roban Hultman Kramer\n* Robel Geda\n* Robert Cross\n* Rocio Kiman\n* Rohan Rajpal\n* Rohit Kapoor\n* Rohit Patil\n* Roman Tolesnikov\n* Roy Smart\n* Rui Xue\n* Ryan Abernathey\n* Ryan Cooke\n* Ryan Fox\n* Sadie Bartholomew\n* Sam Van Kooten\n* Sam Verstocken\n* Samuel Brice\n* Sanjeev Dubey\n* Sara Ogaz\n* Sarah Graves\n* Sarah Kendrew\n* Sashank Mishra\n* sashmish\n* Saurav Sachidanand\n* Scott Thomas\n* Semyeong Oh\n* Serge Montagnac\n* Sergio Pascual\n* Shailesh Ahuja\n* Shankar Kulumani\n* Shantanu Srivastava\n* Shilpi Jain\n* Shivan Sornarajah\n* Shivansh Mishra\n* Shresth Verma\n* Shreyas Bapat\n* Sigurd Næss\n* Simon Conseil\n* Simon Gibbons\n* Simon Liedtke\n* Simon Torres\n* Sourabh Cheedella\n* Srikrishna Sekhar\n* srirajshukla\n* Stefan Becker\n* Stefan Nelson\n* Stephen Portillo\n* Steve Crawford\n* Steve Guest\n* Steven Bamford\n* Stuart Littlefair\n* Stuart Mumford\n* Sudheesh Singanamalla\n* Sushobhana Patra\n* Suyog Garg\n* Swapnil Sharma\n* T\\. Carl Beery\n* Tanuj Rastogi\n* Thomas Erben\n* Thomas Robitaille\n* Thompson Le Blanc\n* Tiffany Jansen\n* Tim Gates\n* Tim Jenness\n* Tim Plummer\n* Tito Dal Canton\n* Tom Aldcroft\n* Tom Donaldson\n* Tom J Wilson\n* Tom Kooij\n* Tomas Babej\n* Tyler Finethy\n* Vatsala Swaroop\n* Victoria Dye\n* Vinayak Mehta\n* Vishnunarayan K I\n* Vital Fernández\n* Volodymyr Savchenko\n* VSN Reddy Janga\n* Víctor Terrón\n* Víctor Zabalza\n* Wilfred Tyler Gee\n* William Jamieson\n* Wolfgang Kerzendorf\n* Yannick Copin\n* Yash Kumar\n* Yash Sharma\n* Yingqi Ying\n* Zac Hatfield-Dodds\n* Zach Edwards\n* Zachary Kurtz\n* Zeljko Ivezic\n* Zhiyuan Ma\n* Zlatan Vasović\n* Zé Vinicius\n\nOther Credits\n=============\n\n* Kyle Barbary for designing the Astropy logos and documentation themes.\n* Andrew Pontzen and the `pynbody <https://github.com/pynbody/pynbody>`_ team\n  (For code that grew into :mod:`astropy.units`)\n* Everyone on the `astropy-dev mailing list`_ and the `Astropy mailing list`_\n  for contributing to many discussions and decisions!\n\n(If you have contributed to the ``astropy`` core package and your name is missing,\nplease send an email to the coordinators, or\n`open a pull request for this page <https://github.com/astropy/astropy/edit/main/docs/credits.rst>`_\nin the `astropy repository <https://github.com/astropy/astropy>`_)\n\nFor how to acknowledge Astropy, please see `the Acknowledging or Citing Astropy page <https://www.astropy.org/acknowledging.html>`_.\n"},{"id":30,"name":"make.bat","nodeType":"TextFile","path":"docs","text":"@ECHO OFF\n\nREM Command file for Sphinx documentation\n\nif \"%SPHINXBUILD%\" == \"\" (\n\tset SPHINXBUILD=sphinx-build\n)\nset BUILDDIR=_build\nset ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .\nif NOT \"%PAPER%\" == \"\" (\n\tset ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%\n)\n\nif \"%1\" == \"\" goto help\n\nif \"%1\" == \"help\" (\n\t:help\n\techo.Please use `make ^<target^>` where ^<target^> is one of\n\techo.  html       to make standalone HTML files\n\techo.  dirhtml    to make HTML files named index.html in directories\n\techo.  singlehtml to make a single large HTML file\n\techo.  pickle     to make pickle files\n\techo.  json       to make JSON files\n\techo.  htmlhelp   to make HTML files and a HTML help project\n\techo.  qthelp     to make HTML files and a qthelp project\n\techo.  devhelp    to make HTML files and a Devhelp project\n\techo.  epub       to make an epub\n\techo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter\n\techo.  text       to make text files\n\techo.  man        to make manual pages\n\techo.  changes    to make an overview over all changed/added/deprecated items\n\techo.  linkcheck  to check all external links for integrity\n\techo.  doctest    to run all doctests embedded in the documentation if enabled\n\tgoto end\n)\n\nif \"%1\" == \"clean\" (\n\tfor /d %%i in (%BUILDDIR%\\*) do rmdir /q /s %%i\n\tdel /q /s %BUILDDIR%\\*\n\tdel /q /s api\n\tdel /q /s generated\n\tgoto end\n)\n\nif \"%1\" == \"html\" (\n\t%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html\n\tif errorlevel 1 exit /b 1\n\techo.\n\techo.Build finished. The HTML pages are in %BUILDDIR%/html.\n\tgoto end\n)\n\nif \"%1\" == \"dirhtml\" (\n\t%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml\n\tif errorlevel 1 exit /b 1\n\techo.\n\techo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.\n\tgoto end\n)\n\nif \"%1\" == \"singlehtml\" (\n\t%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml\n\tif errorlevel 1 exit /b 1\n\techo.\n\techo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.\n\tgoto end\n)\n\nif \"%1\" == \"pickle\" (\n\t%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle\n\tif errorlevel 1 exit /b 1\n\techo.\n\techo.Build finished; now you can process the pickle files.\n\tgoto end\n)\n\nif \"%1\" == \"json\" (\n\t%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json\n\tif errorlevel 1 exit /b 1\n\techo.\n\techo.Build finished; now you can process the JSON files.\n\tgoto end\n)\n\nif \"%1\" == \"htmlhelp\" (\n\t%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp\n\tif errorlevel 1 exit /b 1\n\techo.\n\techo.Build finished; now you can run HTML Help Workshop with the ^\n.hhp project file in %BUILDDIR%/htmlhelp.\n\tgoto end\n)\n\nif \"%1\" == \"qthelp\" (\n\t%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp\n\tif errorlevel 1 exit /b 1\n\techo.\n\techo.Build finished; now you can run \"qcollectiongenerator\" with the ^\n.qhcp project file in %BUILDDIR%/qthelp, like this:\n\techo.^> qcollectiongenerator %BUILDDIR%\\qthelp\\Astropy.qhcp\n\techo.To view the help file:\n\techo.^> assistant -collectionFile %BUILDDIR%\\qthelp\\Astropy.ghc\n\tgoto end\n)\n\nif \"%1\" == \"devhelp\" (\n\t%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp\n\tif errorlevel 1 exit /b 1\n\techo.\n\techo.Build finished.\n\tgoto end\n)\n\nif \"%1\" == \"epub\" (\n\t%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub\n\tif errorlevel 1 exit /b 1\n\techo.\n\techo.Build finished. The epub file is in %BUILDDIR%/epub.\n\tgoto end\n)\n\nif \"%1\" == \"latex\" (\n\t%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex\n\tif errorlevel 1 exit /b 1\n\techo.\n\techo.Build finished; the LaTeX files are in %BUILDDIR%/latex.\n\tgoto end\n)\n\nif \"%1\" == \"text\" (\n\t%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text\n\tif errorlevel 1 exit /b 1\n\techo.\n\techo.Build finished. The text files are in %BUILDDIR%/text.\n\tgoto end\n)\n\nif \"%1\" == \"man\" (\n\t%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man\n\tif errorlevel 1 exit /b 1\n\techo.\n\techo.Build finished. The manual pages are in %BUILDDIR%/man.\n\tgoto end\n)\n\nif \"%1\" == \"changes\" (\n\t%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes\n\tif errorlevel 1 exit /b 1\n\techo.\n\techo.The overview file is in %BUILDDIR%/changes.\n\tgoto end\n)\n\nif \"%1\" == \"linkcheck\" (\n\t%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck\n\tif errorlevel 1 exit /b 1\n\techo.\n\techo.Link check complete; look for any errors in the above output ^\nor in %BUILDDIR%/linkcheck/output.txt.\n\tgoto end\n)\n\nif \"%1\" == \"doctest\" (\n\t%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest\n\tif errorlevel 1 exit /b 1\n\techo.\n\techo.Testing of doctests in the sources finished, look at the ^\nresults in %BUILDDIR%/doctest/output.txt.\n\tgoto end\n)\n\n:end\n"},{"id":31,"name":"known_issues.rst","nodeType":"TextFile","path":"docs","text":"************\nKnown Issues\n************\n\n.. contents::\n   :local:\n   :depth: 2\n\nWhile most bugs and issues are managed using the `astropy issue\ntracker <https://github.com/astropy/astropy/issues>`_, this document\nlists issues that are too difficult to fix, may require some\nintervention from the user to work around, or are caused by bugs in other\nprojects or packages.\n\nIssues listed on this page are grouped into two categories: The first is known\nissues and shortcomings in actual algorithms and interfaces that currently do\nnot have fixes or workarounds, and that users should be aware of when writing\ncode that uses ``astropy``. Some of those issues are still platform-specific,\nwhile others are very general. The second category is of common issues that come\nup when configuring, building, or installing ``astropy``. This also includes\ncases where the test suite can report false negatives depending on the context/\nplatform on which it was run.\n\nKnown Deficiencies\n==================\n\n.. _quantity_issues:\n\nQuantities Lose Their Units with Some Operations\n------------------------------------------------\n\nQuantities are subclassed from ``numpy``'s `~numpy.ndarray` and while we have\nensured that ``numpy`` functions will work well with them, they do not always\nwork in functions from ``scipy`` or other packages that use ``numpy``\ninternally, but ignore the subclass. Furthermore, at a few places in ``numpy``\nitself we cannot control the behaviour. For instance, care must be taken when\nsetting array slices using Quantities::\n\n    >>> import astropy.units as u\n    >>> import numpy as np\n    >>> a = np.ones(4)\n    >>> a[2:3] = 2*u.kg\n    >>> a # doctest: +FLOAT_CMP\n    array([1., 1., 2., 1.])\n\n::\n\n    >>> a = np.ones(4)\n    >>> a[2:3] = 1*u.cm/u.m\n    >>> a # doctest: +FLOAT_CMP\n    array([1., 1., 1., 1.])\n\nEither set single array entries or use lists of Quantities::\n\n    >>> a = np.ones(4)\n    >>> a[2] = 1*u.cm/u.m\n    >>> a # doctest: +FLOAT_CMP\n    array([1.  , 1.  , 0.01, 1.  ])\n\n::\n\n    >>> a = np.ones(4)\n    >>> a[2:3] = [1*u.cm/u.m]\n    >>> a # doctest: +FLOAT_CMP\n    array([1.  , 1.  , 0.01, 1.  ])\n\nBoth will throw an exception if units do not cancel, e.g.::\n\n    >>> a = np.ones(4)\n    >>> a[2] = 1*u.cm # doctest: +SKIP\n    Traceback (most recent call last):\n    ...\n    TypeError: only dimensionless scalar quantities can be converted to Python scalars\n\n\nSee: https://github.com/astropy/astropy/issues/7582\n\nNumpy array creation functions cannot be used to initialize Quantity\n--------------------------------------------------------------------\nTrying the following example will throw an UnitConversionError\non NumPy before version 1.20 and ignore the unit in later versions:\n\n.. doctest-requires:: numpy<1.20\n\n    >>> my_quantity = u.Quantity(1, u.m)\n    >>> np.full(10, my_quantity)  # doctest: +IGNORE_EXCEPTION_DETAIL\n    Traceback (most recent call last):\n    ...\n    UnitConversionError: 'm' (length) and '' (dimensionless) are not convertible\n\nA workaround for this at the moment would be to do::\n\n    >>> np.full(10, 1) << u.m\n    <Quantity [1., 1., 1., 1., 1., 1., 1., 1., 1., 1.] m>\n\nAs well as with `~numpy.full` one cannot do `~numpy.zeros`, `~numpy.ones`, and `~numpy.empty`.\n\nThe `~numpy.arange` function does not work either::\n\n    >>> np.arange(0 * u.m, 10 * u.m, 1 * u.m)  # doctest: +IGNORE_EXCEPTION_DETAIL\n    Traceback (most recent call last):\n    ...\n    TypeError: only dimensionless scalar quantities can be converted to Python scalars\n\nWorkarounds include moving the units outside of the call to\n`~numpy.arange`::\n\n    >>> np.arange(0, 10, 1) * u.m\n    <Quantity [0., 1., 2., 3., 4., 5., 6., 7., 8., 9.] m>\n\nAlso, `~numpy.linspace` does work:\n\n    >>> np.linspace(0 * u.m, 9 * u.m, 10)\n    <Quantity [0., 1., 2., 3., 4., 5., 6., 7., 8., 9.] m>\n\n\nQuantities Lose Their Units When Broadcasted\n--------------------------------------------\n\nWhen broadcasting Quantities, it is necessary to pass ``subok=True`` to\n`~numpy.broadcast_to`, or else a bare `~numpy.ndarray` will be returned::\n\n   >>> q = u.Quantity(np.arange(10.), u.m)\n   >>> b = np.broadcast_to(q, (2, len(q)))\n   >>> b # doctest: +FLOAT_CMP\n   array([[0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],\n          [0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]])\n   >>> b2 = np.broadcast_to(q, (2, len(q)), subok=True)\n   >>> b2 # doctest: +FLOAT_CMP\n   <Quantity [[0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],\n              [0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]] m>\n\nThis is analogous to the case of passing a Quantity to `~numpy.array`::\n\n   >>> a = np.array(q)\n   >>> a # doctest: +FLOAT_CMP\n   array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])\n   >>> a2 = np.array(q, subok=True)\n   >>> a2 # doctest: +FLOAT_CMP\n   <Quantity [0., 1., 2., 3., 4., 5., 6., 7., 8., 9.] m>\n\nSee: https://github.com/astropy/astropy/issues/7832\n\nmmap Support for ``astropy.io.fits`` on GNU Hurd\n------------------------------------------------\n\nOn Hurd and possibly other platforms, ``flush()`` on memory-mapped files are not\nimplemented, so writing changes to a mmap'd FITS file may not be reliable and is\nthus disabled. Attempting to open a FITS file in writeable mode with mmap will\nresult in a warning (and mmap will be disabled on the file automatically).\n\nSee: https://github.com/astropy/astropy/issues/968\n\n\nColor Printing on Windows\n-------------------------\n\nColored printing of log messages and other colored text does work in Windows,\nbut only when running in the IPython console. Colors are not currently\nsupported in the basic Python command-line interpreter on Windows.\n\n``numpy.int64`` does not decompose input ``Quantity`` objects\n-------------------------------------------------------------\n\nPython's ``int()`` goes through ``__index__``\nwhile ``numpy.int64`` or ``numpy.int_`` do not go through ``__index__``. This\nmeans that an upstream fix in NumPy is required in order for\n``astropy.units`` to control decomposing the input in these functions::\n\n    >>> np.int64((15 * u.km) / (15 * u.imperial.foot))\n    1\n    >>> np.int_((15 * u.km) / (15 * u.imperial.foot))\n    1\n    >>> int((15 * u.km) / (15 * u.imperial.foot))\n    3280\n\nTo convert a dimensionless `~astropy.units.Quantity` to an integer, it is\ntherefore recommended to use ``int(...)``.\n\nInconsistent behavior when converting complex numbers to floats\n---------------------------------------------------------------\n\nAttempting to use `float` or NumPy's ``numpy.float`` on a standard\ncomplex number (e.g., ``5 + 6j``) results in a `TypeError`.  In\ncontrast, using `float` or ``numpy.float`` on a complex number from\nNumPy (e.g., ``numpy.complex128``) drops the imaginary component and\nissues a ``numpy.ComplexWarning``.  This inconsistency persists between\n`~astropy.units.Quantity` instances based on standard and NumPy\ncomplex numbers.  To get the real part of a complex number, it is\nrecommended to use ``numpy.real``.\n\n.. _structured_unit_deserialization_segfault:\n\nStructured units deserialization segfaults in big-endian\n--------------------------------------------------------\n\nStructured units deserialization with ``pickle`` may cause segmentation\nfault in big-endian machine with ``numpy<1.21.1``.\n\nBuild/Installation/Test Issues\n==============================\n\nAnaconda Users Should Upgrade with ``conda``, Not ``pip``\n---------------------------------------------------------\n\nUpgrading ``astropy`` in the Anaconda Python distribution using ``pip`` can result\nin a corrupted install with a mix of files from the old version and the new\nversion. Anaconda users should update with ``conda update astropy``. There\nmay be a brief delay between the release of ``astropy`` on PyPI and its release\nvia the ``conda`` package manager; users can check the availability of new\nversions with ``conda search astropy``.\n\n\nLocale Errors in MacOS X and Linux\n----------------------------------\n\nOn MacOS X, you may see the following error when running ``pip``::\n\n    ...\n    ValueError: unknown locale: UTF-8\n\nThis is due to the ``LC_CTYPE`` environment variable being incorrectly set to\n``UTF-8`` by default, which is not a valid locale setting.\n\nOn MacOS X or Linux (or other platforms) you may also encounter the following\nerror::\n\n    ...\n      stderr = stderr.decode(stdio_encoding)\n    TypeError: decode() argument 1 must be str, not None\n\nThis also indicates that your locale is not set correctly.\n\nTo fix either of these issues, set this environment variable, as well as the\n``LANG`` and ``LC_ALL`` environment variables to e.g. ``en_US.UTF-8`` using, in\nthe case of ``bash``::\n\n    export LANG=\"en_US.UTF-8\"\n    export LC_ALL=\"en_US.UTF-8\"\n    export LC_CTYPE=\"en_US.UTF-8\"\n\nTo avoid any issues in future, you should add this line to your e.g.\n``~/.bash_profile`` or ``.bashrc`` file.\n\nTo test these changes, open a new terminal and type ``locale``, and you should\nsee something like::\n\n    $ locale\n    LANG=\"en_US.UTF-8\"\n    LC_COLLATE=\"en_US.UTF-8\"\n    LC_CTYPE=\"en_US.UTF-8\"\n    LC_MESSAGES=\"en_US.UTF-8\"\n    LC_MONETARY=\"en_US.UTF-8\"\n    LC_NUMERIC=\"en_US.UTF-8\"\n    LC_TIME=\"en_US.UTF-8\"\n    LC_ALL=\"en_US.UTF-8\"\n\nIf so, you can go ahead and try running ``pip`` again (in the new\nterminal).\n\n\nFailing Logging Tests When Running the Tests in IPython\n-------------------------------------------------------\n\nWhen running the Astropy tests using ``astropy.test()`` in an IPython\ninterpreter, some of the tests in the ``astropy/tests/test_logger.py`` *might*\nfail depending on the version of IPython or other factors.\nThis is due to mutually incompatible behaviors in IPython and pytest, and is\nnot due to a problem with the test itself or the feature being tested.\n\nSee: https://github.com/astropy/astropy/issues/717\n"},{"id":32,"name":"overview.rst","nodeType":"TextFile","path":"docs","text":":orphan:\n\n********\nOverview\n********\n\nThis page has been removed. For an overview, see the `<http://www.astropy.org>`_ page.\n"},{"id":33,"name":"nitpick-exceptions","nodeType":"TextFile","path":"docs","text":"# astropy.cosmology\npy:class astropy.cosmology.Cosmology\npy:class astropy.cosmology.core.Cosmology\n\n# astropy.io.votable\npy:class astropy.io.votable.tree.Element\npy:class astropy.io.votable.tree.SimpleElement\npy:class astropy.io.votable.tree.SimpleElementWithContent\n\n# astropy.modeling\npy:class astropy.modeling.projections.Zenithal\npy:class astropy.modeling.projections.Cylindrical\npy:class astropy.modeling.polynomial.PolynomialBase\npy:class astropy.modeling.rotations.EulerAngleRotation\npy:class astropy.modeling.projections.Projection\n\n# astropy.io.fits\npy:class astropy.io.fits.hdu.base.ExtensionHDU\npy:class astropy.io.fits.util.NotifierMixin\n\n# astropy.io.misc.yaml\npy:class yaml.dumper.SafeDumper\npy:class yaml.loader.SafeLoader\npy:class yaml.representer.SafeRepresenter\npy:class yaml.scanner.Scanner\npy:class yaml.constructor.SafeConstructor\npy:class yaml.constructor.BaseConstructor\npy:class yaml.parser.Parser\npy:class yaml.dumper.SafeDumper\npy:class yaml.representer.BaseRepresenter\npy:class yaml.reader.Reader\npy:class yaml.resolver.BaseResolver\npy:class yaml.serializer.Serializer\npy:class yaml.composer.Composer\npy:class yaml.resolver.Resolver\npy:class yaml.emitter.Emitter\n\n# astropy.units\npy:obj astropy.units.function.logarithmic.m_bol\n\n# astropy.utils\npy:class astropy.extern.six.Iterator\npy:class type\npy:class json.encoder.JSONEncoder\n\n# astropy.table\npy:class astropy.table.column.BaseColumn\npy:class astropy.table.groups.BaseGroups\npy:class astropy.table.bst.FastBase\n\n# astropy.time\npy:class astropy.time.core.TimeUnique\n\n# astropy.visualization\npy:class matplotlib.axes._subplots.WCSAxesSubplot\npy:obj Bbox\npy:obj Transform\npy:obj Patch\npy:obj Figure\npy:obj AbstractPathEffect\npy:obj ScaleBase\npy:obj matplotlib.axis.Axes.get_window_extent\npy:obj matplotlib.spines.get_window_extent\n\n# astropy.wcs\npy:class astropy.wcs.wcsapi.fitswcs.FITSWCSAPIMixin\npy:class astropy.wcs.wcsapi.fitswcs.custom_ctype_to_ucd_mapping\n\n# numpy inherited docstrings\npy:obj dtype\npy:obj a\npy:obj a.size == 1\npy:obj n\npy:obj ndarray\npy:obj args\n\n# other classes and functions that cannot be linked to\npy:class numpy.ma.core.MaskedArray\npy:class numpy.ma.mvoid\npy:class numpy.void\npy:class numpy.core.records.recarray\npy:class xmlrpclib.Fault\npy:class xmlrpclib.Error\npy:class xmlrpc.client.Fault\npy:class xmlrpc.client.Error\npy:obj pkg_resources.parse_version\npy:class pandas.DataFrame\n\n# Pending on python docs links issue #11975\npy:class list\npy:obj list.append\npy:obj list.append\npy:obj list.count\npy:obj list.extend\npy:obj list.index\npy:obj list.insert\npy:meth list.pop\npy:obj list.remove\npy:class classmethod\npy:obj RuntimeError\npy:obj NotImplementedError\npy:obj AttributeError\npy:obj NotImplementedError\npy:obj RendererBase\npy:obj Artist\npy:obj BboxBase\npy:obj Text\npy:obj text\n\n# This list is from https://github.com/numpy/numpydoc/issues/275\npy:class None.  Remove all items from D.\npy:class a set-like object providing a view on D's items\npy:class a set-like object providing a view on D's keys\npy:class v, remove specified key and return the corresponding value.\npy:class None.  Update D from dict/iterable E and F.\npy:class an object providing a view on D's values\npy:class a shallow copy of D\n\n# This extends the numpydoc list above to fix lincheck warning\npy:class reference target not found: (k, v)\n"},{"id":34,"name":"_pkgtemplate.rst","nodeType":"TextFile","path":"docs","text":"****************************************************\nA description of the package (`astropy.packagename`)\n****************************************************\n\nWhen creating a new subpackage's documentation, this file should be\ncopied to a file \"index.rst\" in a directory corresponding to the name of\nthe package. E.g., ``docs/packagename/index.rst``. And don't forget to\ndelete this paragraph.\n\nIntroduction\n============\n\nInclude general content that might be useful for understanding the\npackage here, as well as general scientific or mathematical background\nthat might be necessary for the \"big-picture\" of this package.\n\n\nGetting Started\n===============\n\nShort tutorial-like examples of how to do common-tasks - should be\nfairly quick, with any more detailed examples in the next section.\n\n\nUsing `packagename`\n===================\n\n.. THIS SECTION SHOULD BE EITHER\n\n\nThis section is for the detailed documentation.  For simpler packages, this\nshould either by paragraphs or sub-divided into sub-sections like:\n\nSub-topic 1\n-----------\n\nContent if needed\n\nA Complex example\n-----------------\n\nContent if needed\n\nSub-sub topic 1\n^^^^^^^^^^^^^^^^\n\nContent if needed (note the use of ^^^^ at this level).\n\nSub-sub-sub topic 1\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nContent if needed (note the use of \"\"\"\"\" at this level).\nThis is probably the deepest level that is practical.  However,\njust in case, the next levels of detail should use the +, :, and ~\ncharacters respectively.\n\n\n.. OR IF MORE COMPLICATED,\n\nFor more complicated packages that require multiple documents, this\nshould just be a table of contents referencing those documents:\n\n.. toctree::\n    subdoc1\n    subdoc2\n    subdoc3\n\n\nEither a toctree or sub-sections should be used, *not* both.\n\nFor example, if your toctree looks like the above example, this document\nshould be ``docs/packagename/index.rst``, and the other documents should\nbe ``docs/packagename/subdoc1.rst``, ``docs/packagename/subdoc2.rst``,\nand ``docs/packagename/subdoc3.rst``.\n\nIn the \"more complicated\" case of using ``subdoc.rst`` files, each of those\nshould likewise use the section character header order of ``* = - ^ \" + : ~``.\n\n\nSee Also (optional)\n===================\n\nInclude here any references to related packages, articles, or texts.\n\n\nReference/API\n=============\n\n.. automodapi:: packagename\n\n\nAcknowledgments and Licenses (optional)\n=======================================\n\nAny acknowledgements or licenses needed for this package - remove the\nsection if none are necessary.\n"},{"fileName":"conf.py","filePath":"docs","id":35,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n#\n# Astropy documentation build configuration file.\n#\n# This file is execfile()d with the current directory set to its containing dir.\n#\n# Note that not all possible configuration values are present in this file.\n#\n# All configuration values have a default. Some values are defined in\n# the global Astropy configuration which is loaded here before anything else.\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n# sys.path.insert(0, os.path.abspath('..'))\n# IMPORTANT: the above commented section was generated by sphinx-quickstart, but\n# is *NOT* appropriate for astropy or Astropy affiliated packages. It is left\n# commented out with this explanation to make it clear why this should not be\n# done. If the sys.path entry above is added, when the astropy.sphinx.conf\n# import occurs, it will import the *source* version of astropy instead of the\n# version installed (if invoked as \"make html\" or directly with sphinx), or the\n# version in the build directory.\n# Thus, any C-extensions that are needed to build the documentation will *not*\n# be accessible, and the documentation will not build correctly.\n# See sphinx_astropy.conf for which values are set there.\n\nimport os\nimport sys\nimport configparser\nfrom datetime import datetime\nfrom importlib import metadata\n\nimport doctest\nfrom packaging.requirements import Requirement\nfrom packaging.specifiers import SpecifierSet\n\n# -- Check for missing dependencies -------------------------------------------\nmissing_requirements = {}\nfor line in metadata.requires('astropy'):\n    if 'extra == \"docs\"' in line:\n        req = Requirement(line.split(';')[0])\n        req_package = req.name.lower()\n        req_specifier = str(req.specifier)\n\n        try:\n            version = metadata.version(req_package)\n        except metadata.PackageNotFoundError:\n            missing_requirements[req_package] = req_specifier\n\n        if version not in SpecifierSet(req_specifier, prereleases=True):\n            missing_requirements[req_package] = req_specifier\n\nif missing_requirements:\n    print('The following packages could not be found and are required to '\n          'build the documentation:')\n    for key, val in missing_requirements.items():\n        print(f'    * {key} {val}')\n    print('Please install the \"docs\" requirements.')\n    sys.exit(1)\n\nfrom sphinx_astropy.conf.v1 import *  # noqa\n\n# -- Plot configuration -------------------------------------------------------\nplot_rcparams = {}\nplot_rcparams['figure.figsize'] = (6, 6)\nplot_rcparams['savefig.facecolor'] = 'none'\nplot_rcparams['savefig.bbox'] = 'tight'\nplot_rcparams['axes.labelsize'] = 'large'\nplot_rcparams['figure.subplot.hspace'] = 0.5\n\nplot_apply_rcparams = True\nplot_html_show_source_link = False\nplot_formats = ['png', 'svg', 'pdf']\n# Don't use the default - which includes a numpy and matplotlib import\nplot_pre_code = \"\"\n\n# -- General configuration ----------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\nneeds_sphinx = '1.7'\n\n# To perform a Sphinx version check that needs to be more specific than\n# major.minor, call `check_sphinx_version(\"X.Y.Z\")` here.\ncheck_sphinx_version(\"1.2.1\")  # noqa: F405\n\n# The intersphinx_mapping in sphinx_astropy.sphinx refers to astropy for\n# the benefit of other packages who want to refer to objects in the\n# astropy core.  However, we don't want to cyclically reference astropy in its\n# own build so we remove it here.\ndel intersphinx_mapping['astropy']  # noqa: F405\n\n# add any custom intersphinx for astropy\nintersphinx_mapping['astropy-dev'] = ('https://docs.astropy.org/en/latest/', None)  # noqa: F405\nintersphinx_mapping['pyerfa'] = ('https://pyerfa.readthedocs.io/en/stable/', None)  # noqa: F405\nintersphinx_mapping['pytest'] = ('https://docs.pytest.org/en/stable/', None)  # noqa: F405\nintersphinx_mapping['ipython'] = ('https://ipython.readthedocs.io/en/stable/', None)  # noqa: F405\nintersphinx_mapping['pandas'] = ('https://pandas.pydata.org/pandas-docs/stable/', None)  # noqa: F405, E501\nintersphinx_mapping['sphinx_automodapi'] = ('https://sphinx-automodapi.readthedocs.io/en/stable/', None)  # noqa: F405, E501\nintersphinx_mapping['packagetemplate'] = ('https://docs.astropy.org/projects/package-template/en/latest/', None)  # noqa: F405, E501\nintersphinx_mapping['h5py'] = ('https://docs.h5py.org/en/stable/', None)  # noqa: F405\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\nexclude_patterns.append('_templates')  # noqa: F405\nexclude_patterns.append('changes')  # noqa: F405\nexclude_patterns.append('_pkgtemplate.rst')  # noqa: F405\nexclude_patterns.append('**/*.inc.rst')  # .inc.rst mean *include* files, don't have sphinx process them  # noqa: F405, E501\n\n# Add any paths that contain templates here, relative to this directory.\nif 'templates_path' not in locals():  # in case parent conf.py defines it\n    templates_path = []\ntemplates_path.append('_templates')\n\n\nextensions += [\"sphinx_changelog\"]  # noqa: F405\n\n# Grab minversion from setup.cfg\nsetup_cfg = configparser.ConfigParser()\nsetup_cfg.read(os.path.join(os.path.pardir, 'setup.cfg'))\n__minimum_python_version__ = setup_cfg['options']['python_requires'].replace('>=', '')\nproject = u'Astropy'\n\nmin_versions = {}\nfor line in metadata.requires('astropy'):\n    req = Requirement(line.split(';')[0])\n    min_versions[req.name.lower()] = str(req.specifier)\n\n\n# This is added to the end of RST files - a good place to put substitutions to\n# be used globally.\nwith open(\"common_links.txt\", \"r\") as cl:\n    rst_epilog += cl.read().format(minimum_python=__minimum_python_version__,\n                                   **min_versions)\n\n# Manually register doctest options since matplotlib 3.5 messed up allowing them\n# from pytest-doctestplus\nIGNORE_OUTPUT = doctest.register_optionflag('IGNORE_OUTPUT')\nREMOTE_DATA = doctest.register_optionflag('REMOTE_DATA')\nFLOAT_CMP = doctest.register_optionflag('FLOAT_CMP')\n\n# Whether to create cross-references for the parameter types in the\n# Parameters, Other Parameters, Returns and Yields sections of the docstring.\nnumpydoc_xref_param_type = True\n\n# Words not to cross-reference. Most likely, these are common words used in\n# parameter type descriptions that may be confused for classes of the same\n# name. The base set comes from sphinx-astropy. We add more here.\nnumpydoc_xref_ignore.update({\n    \"mixin\",\n    \"Any\",  # aka something that would be annotated with `typing.Any`\n    # needed in subclassing numpy  # TODO! revisit\n    \"Arguments\", \"Path\",\n    # TODO! not need to ignore.\n    \"flag\", \"bits\",\n})\n\n# Mappings to fully qualified paths (or correct ReST references) for the\n# aliases/shortcuts used when specifying the types of parameters.\n# Numpy provides some defaults\n# https://github.com/numpy/numpydoc/blob/b352cd7635f2ea7748722f410a31f937d92545cc/numpydoc/xref.py#L62-L94\n# and a base set comes from sphinx-astropy.\n# so here we mostly need to define Astropy-specific x-refs\nnumpydoc_xref_aliases.update({\n    # python & adjacent\n    \"Any\": \"`~typing.Any`\",\n    \"file-like\": \":term:`python:file-like object`\",\n    \"file\": \":term:`python:file object`\",\n    \"path-like\": \":term:`python:path-like object`\",\n    \"module\": \":term:`python:module`\",\n    \"buffer-like\": \":term:buffer-like\",\n    \"hashable\": \":term:`python:hashable`\",\n    # for matplotlib\n    \"color\": \":term:`color`\",\n    # for numpy\n    \"ints\": \":class:`python:int`\",\n    # for astropy\n    \"number\": \":term:`number`\",\n    \"Representation\": \":class:`~astropy.coordinates.BaseRepresentation`\",\n    \"writable\": \":term:`writable file-like object`\",\n    \"readable\": \":term:`readable file-like object`\",\n    \"BaseHDU\": \":doc:`HDU </io/fits/api/hdus>`\"\n})\n# Add from sphinx-astropy 1) glossary aliases 2) physical types.\nnumpydoc_xref_aliases.update(numpydoc_xref_astropy_aliases)\n\n\n# -- Project information ------------------------------------------------------\n\nauthor = u'The Astropy Developers'\ncopyright = f'2011–{datetime.utcnow().year}, ' + author\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n\n# The full version, including alpha/beta/rc tags.\nrelease = metadata.version(project)\n# The short X.Y version.\nversion = '.'.join(release.split('.')[:2])\n\n# Only include dev docs in dev version.\ndev = 'dev' in release\nif not dev:\n    exclude_patterns.append('development/*')  # noqa: F405\n    exclude_patterns.append('testhelpers.rst')  # noqa: F405\n\n# -- Options for the module index ---------------------------------------------\n\nmodindex_common_prefix = ['astropy.']\n\n\n# -- Options for HTML output ---------------------------------------------------\n\n# A NOTE ON HTML THEMES\n#\n# The global astropy configuration uses a custom theme,\n# 'bootstrap-astropy', which is installed along with astropy. The\n# theme has options for controlling the text of the logo in the upper\n# left corner. This is how you would specify the options in order to\n# override the theme defaults (The following options *are* the\n# defaults, so we do not actually need to set them here.)\n\n# html_theme_options = {\n#    'logotext1': 'astro',  # white,  semi-bold\n#    'logotext2': 'py',     # orange, light\n#    'logotext3': ':docs'   # white,  light\n#    }\n\n# A different theme can be used, or other parts of this theme can be\n# modified, by overriding some of the variables set in the global\n# configuration. The variables set in the global configuration are\n# listed below, commented out.\n\n# Add any paths that contain custom themes here, relative to this directory.\n# To use a different custom theme, add the directory containing the theme.\n# html_theme_path = []\n\n# The theme to use for HTML and HTML Help pages.  See the documentation for\n# a list of builtin themes. To override the custom theme, set this to the\n# name of a builtin theme or the name of a custom theme in html_theme_path.\n# html_theme = None\n\n# Custom sidebar templates, maps document names to template names.\n# html_sidebars = {}\n\n# The name of an image file (within the static path) to use as favicon of the\n# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32\n# pixels large.\n# html_favicon = ''\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\n# html_last_updated_fmt = ''\n\n# The name for this set of Sphinx documents.  If None, it defaults to\n# \"<project> v<release> documentation\".\nhtml_title = f'{project} v{release}'\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = project + 'doc'\n\n# A dictionary of values to pass into the template engine’s context for all pages.\nhtml_context = {\n    'to_be_indexed': ['stable', 'latest'],\n    'is_development': dev\n}\n\n# -- Options for LaTeX output --------------------------------------------------\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title, author, documentclass [howto/manual]).\nlatex_documents = [('index', project + '.tex', project + u' Documentation',\n                    author, 'manual')]\n\nlatex_logo = '_static/astropy_logo.pdf'\n\n\n# -- Options for manual page output --------------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [('index', project.lower(), project + u' Documentation',\n              [author], 1)]\n\n# Setting this URL is requited by sphinx-astropy\ngithub_issues_url = 'https://github.com/astropy/astropy/issues/'\nedit_on_github_branch = 'main'\n\n# Enable nitpicky mode - which ensures that all references in the docs\n# resolve.\n\nnitpicky = True\n# This is not used. See docs/nitpick-exceptions file for the actual listing.\nnitpick_ignore = []\n\nfor line in open('nitpick-exceptions'):\n    if line.strip() == \"\" or line.startswith(\"#\"):\n        continue\n    dtype, target = line.split(None, 1)\n    target = target.strip()\n    nitpick_ignore.append((dtype, target))\n\n# -- Options for the Sphinx gallery -------------------------------------------\n\ntry:\n    import warnings\n\n    import sphinx_gallery  # noqa: F401\n    extensions += [\"sphinx_gallery.gen_gallery\"]  # noqa: F405\n\n    sphinx_gallery_conf = {\n        'backreferences_dir': 'generated/modules',  # path to store the module using example template  # noqa: E501\n        'filename_pattern': '^((?!skip_).)*$',  # execute all examples except those that start with \"skip_\"  # noqa: E501\n        'examples_dirs': f'..{os.sep}examples',  # path to the examples scripts\n        'gallery_dirs': 'generated/examples',  # path to save gallery generated examples\n        'reference_url': {\n            'astropy': None,\n            'matplotlib': 'https://matplotlib.org/stable/',\n            'numpy': 'https://numpy.org/doc/stable/',\n        },\n        'abort_on_example_error': True\n    }\n\n    # Filter out backend-related warnings as described in\n    # https://github.com/sphinx-gallery/sphinx-gallery/pull/564\n    warnings.filterwarnings(\"ignore\", category=UserWarning,\n                            message='Matplotlib is currently using agg, which is a'\n                                    ' non-GUI backend, so cannot show the figure.')\n\nexcept ImportError:\n    sphinx_gallery = None\n\n\n# -- Options for linkcheck output -------------------------------------------\nlinkcheck_retry = 5\nlinkcheck_ignore = ['https://journals.aas.org/manuscript-preparation/',\n                    'https://maia.usno.navy.mil/',\n                    'https://www.usno.navy.mil/USNO/time/gps/usno-gps-time-transfer',\n                    'https://aa.usno.navy.mil/publications/docs/Circular_179.php',\n                    'http://data.astropy.org',\n                    'https://doi.org/10.1017/S0251107X00002406',  # internal server error\n                    'https://doi.org/10.1017/pasa.2013.31',  # internal server error\n                    r'https://github\\.com/astropy/astropy/(?:issues|pull)/\\d+']\nlinkcheck_timeout = 180\nlinkcheck_anchors = False\n\n# Add any extra paths that contain custom files (such as robots.txt or\n# .htaccess) here, relative to this directory. These files are copied\n# directly to the root of the documentation.\nhtml_extra_path = ['robots.txt']\n\n\ndef rstjinja(app, docname, source):\n    \"\"\"Render pages as a jinja template to hide/show dev docs. \"\"\"\n    # Make sure we're outputting HTML\n    if app.builder.format != 'html':\n        return\n    files_to_render = [\"index\", \"install\"]\n    if docname in files_to_render:\n        print(f\"Jinja rendering {docname}\")\n        rendered = app.builder.templates.render_string(\n            source[0], app.config.html_context)\n        source[0] = rendered\n\n\ndef resolve_astropy_and_dev_reference(app, env, node, contnode):\n    \"\"\"\n    Reference targets for ``astropy:`` and ``astropy-dev:`` are special cases.\n\n    Documentation links in astropy can be set up as intersphinx links so that\n    affiliate packages do not have to override the docstrings when building\n    the docs.\n\n    If we are building the development docs it is a local ref targeting the\n    label ``astropy-dev:<label>``, but for stable docs it should be an\n    intersphinx resolution to the development docs.\n\n    See https://github.com/astropy/astropy/issues/11366\n    \"\"\"\n    # should the node be processed?\n    reftarget = node.get('reftarget')  # str or None\n    if str(reftarget).startswith('astropy:'):\n        # This allows Astropy to use intersphinx links to itself and have\n        # them resolve to local links. Downstream packages will see intersphinx.\n        # TODO! deprecate this if sphinx-doc/sphinx/issues/9169 is implemented.\n        process, replace = True, 'astropy:'\n    elif dev and str(reftarget).startswith('astropy-dev:'):\n        process, replace = True, 'astropy-dev:'\n    else:\n        process, replace = False, ''\n\n    # make link local\n    if process:\n        reftype = node.get('reftype')\n        refdoc = node.get('refdoc', app.env.docname)\n        # convert astropy intersphinx targets to local links.\n        # there are a few types of intersphinx link patters, as described in\n        # https://docs.readthedocs.io/en/stable/guides/intersphinx.html\n        reftarget = reftarget.replace(replace, '')\n        if reftype == \"doc\":  # also need to replace the doc link\n            node.replace_attr(\"reftarget\", reftarget)\n        # Delegate to the ref node's original domain/target (typically :ref:)\n        try:\n            domain = app.env.domains[node['refdomain']]\n            return domain.resolve_xref(app.env, refdoc, app.builder,\n                                       reftype, reftarget, node, contnode)\n        except Exception:\n            pass\n\n        # Otherwise return None which should delegate to intersphinx\n\n\ndef setup(app):\n    if sphinx_gallery is None:\n        msg = ('The sphinx_gallery extension is not installed, so the '\n               'gallery will not be built.  You will probably see '\n               'additional warnings about undefined references due '\n               'to this.')\n        try:\n            app.warn(msg)\n        except AttributeError:\n            # Sphinx 1.6+\n            from sphinx.util import logging\n            logger = logging.getLogger(__name__)\n            logger.warning(msg)\n\n    # Generate the page from Jinja template\n    app.connect(\"source-read\", rstjinja)\n    # Set this to higher priority than intersphinx; this way when building\n    # dev docs astropy-dev: targets will go to the local docs instead of the\n    # intersphinx mapping\n    app.connect(\"missing-reference\", resolve_astropy_and_dev_reference,\n                priority=400)\n"},{"id":36,"name":"install.rst","nodeType":"TextFile","path":"docs","text":"************\nInstallation\n************\n\nInstalling ``astropy``\n======================\n\nIf you are new to Python and/or do not have familiarity with `Python virtual\nenvironments <https://docs.python.org/3/tutorial/venv.html>`_, then we recommend\nstarting by installing the `Anaconda Distribution\n<https://www.anaconda.com/distribution/>`_. This works on all platforms (linux,\nMac, Windows) and installs a full-featured scientific Python in a user directory\nwithout requiring root permissions.\n\nUsing pip\n---------\n\n.. warning::\n\n    Users of the Anaconda Python distribution should follow the instructions\n    for :ref:`anaconda_install`.\n\nTo install ``astropy`` with `pip`_, run::\n\n    pip install astropy\n\nIf you want to make sure none of your existing dependencies get upgraded, you\ncan also do::\n\n    pip install astropy --no-deps\n\nOn the other hand, if you want to install ``astropy`` along with recommended\nor even all of the available optional :ref:`dependencies <astropy-main-req>`,\nyou can do::\n\n    pip install astropy[recommended]\n\nor::\n\n    pip install astropy[all]\n\nIn most cases, this will install a pre-compiled version (called a *wheel*) of\nastropy, but if you are using a very recent version of Python, if a new version\nof astropy has just been released, or if you are building astropy for a platform\nthat is not common, astropy will be installed from a source file. Note that in\nthis case you will need a C compiler (e.g., ``gcc`` or ``clang``) to be installed\n(see `Building from source`_ below) for the installation to succeed.\n\nIf you get a ``PermissionError`` this means that you do not have the required\nadministrative access to install new packages to your Python installation. In\nthis case you may consider using the ``--user`` option to install the package\ninto your home directory. You can read more about how to do this in the `pip\ndocumentation <https://pip.pypa.io/en/stable/user_guide/#user-installs>`_.\n\nAlternatively, if you intend to do development on other software that uses\n``astropy``, such as an affiliated package, consider installing ``astropy``\ninto a :ref:`virtualenv <astropy-dev:virtual_envs>`.\n\nDo **not** install ``astropy`` or other third-party packages using ``sudo``\nunless you are fully aware of the risks.\n\n.. _anaconda_install:\n\nUsing Conda\n-----------\n\nTo install ``astropy`` using conda run::\n\n    conda install astropy\n\n``astropy`` is installed by default with the `Anaconda Distribution\n<https://www.anaconda.com/distribution/>`_. To update to the latest version run::\n\n    conda update astropy\n\nThere may be a delay of a day or two between when a new version of ``astropy``\nis released and when a package is available for conda. You can check\nfor the list of available versions with ``conda search astropy``.\n\nIf you want to install ``astropy`` along with recommended or all of the\navailable optional :ref:`dependencies <astropy-main-req>`, you can do::\n\n    conda install -c conda-forge -c defaults scipy matplotlib\n\nor::\n\n    conda install -c conda-forge -c defaults scipy matplotlib \\\n      h5py beautifulsoup4 html5lib bleach pandas sortedcontainers \\\n      pytz setuptools mpmath bottleneck jplephem asdf pyarrow\n\nTo also be able to run tests (see below) and support :ref:`builddocs` use the\nfollowing. We use ``pip`` for these packages to ensure getting the latest\nreleases which are compatible with the latest ``pytest`` and ``sphinx`` releases::\n\n    pip install pytest-astropy sphinx-astropy\n\n.. warning::\n\n    Attempting to use `pip <https://pip.pypa.io>`__ to upgrade your installation\n    of ``astropy`` itself may result in a corrupted installation.\n\n.. _testing_installed_astropy:\n\nTesting an Installed ``astropy``\n--------------------------------\n\n{% if is_development %}\n\nThe easiest way to test if your installed version of ``astropy`` is running\ncorrectly is to use the :ref:`astropy.test()` function::\n\n    import astropy\n    astropy.test()\n\nThe tests should run and print out any failures, which you can report at\nthe `Astropy issue tracker <https://github.com/astropy/astropy/issues>`_.\n\nThis way of running the tests may not work if you do it in the ``astropy`` source\ndistribution. See :ref:`sourcebuildtest` for how to run the tests from the\nsource code directory, or :ref:`running-tests` for more details.\n\n{%else%}\n\nSee the :ref:`latest documentation on how to test your installed version of\nastropy <astropy-dev:testing_installed_astropy>`.\n\n{%endif%}\n\n.. _astropy-main-req:\n\nRequirements\n============\n\n``astropy`` has the following strict requirements:\n\n- `Python`_ |minimum_python_version| or later\n\n- `Numpy`_ |minimum_numpy_version| or later\n\n- `PyERFA`_ |minimum_pyerfa_version| or later\n\n- `PyYAML <https://pyyaml.org>`_ |minimum_pyyaml_version| or later\n\n- `packaging`_ |minimum_packaging_version| or later\n\n``astropy`` also depends on a number of other packages for optional features.\nThe following are particularly recommended:\n\n- `scipy`_ |minimum_scipy_version| or later: To power a variety of features\n  in several modules.\n\n- `matplotlib <https://matplotlib.org/>`_ |minimum_matplotlib_version| or later: To provide plotting\n  functionality that `astropy.visualization` enhances.\n\nThe further dependencies provide more specific features:\n\n- `h5py <http://www.h5py.org/>`_: To read/write\n  :class:`~astropy.table.Table` objects from/to HDF5 files.\n\n- `BeautifulSoup <https://www.crummy.com/software/BeautifulSoup/>`_: To read\n  :class:`~astropy.table.table.Table` objects from HTML files.\n\n- `html5lib <https://html5lib.readthedocs.io/en/stable/>`_: To read\n  :class:`~astropy.table.table.Table` objects from HTML files using the\n  `pandas <https://pandas.pydata.org/>`_ reader.\n\n- `bleach <https://bleach.readthedocs.io/>`_: Used to sanitize text when\n  disabling HTML escaping in the :class:`~astropy.table.Table` HTML writer.\n\n- `xmllint <http://www.xmlsoft.org/>`_: To validate VOTABLE XML files.\n  This is a command line tool installed outside of Python.\n\n- `pandas <https://pandas.pydata.org/>`_: To convert\n  :class:`~astropy.table.Table` objects from/to pandas DataFrame objects.\n  Version 0.14 or higher is required to use the :ref:`table_io_pandas`\n  I/O functions to read/write :class:`~astropy.table.Table` objects.\n\n- `sortedcontainers <https://pypi.org/project/sortedcontainers/>`_ for faster\n  ``SCEngine`` indexing engine with ``Table``, although this may still be\n  slower in some cases than the default indexing engine.\n\n- `pytz <https://pythonhosted.org/pytz/>`_: To specify and convert between\n  timezones.\n\n- `jplephem <https://pypi.org/project/jplephem/>`_: To retrieve JPL\n  ephemeris of Solar System objects.\n\n- `setuptools <https://setuptools.readthedocs.io>`_: Used for discovery of\n  entry points which are used to insert fitters into `astropy.modeling.fitting`.\n\n- `mpmath <http://mpmath.org/>`_: Used for the 'kraft-burrows-nousek'\n  interval in `~astropy.stats.poisson_conf_interval`.\n\n- `asdf <https://github.com/spacetelescope/asdf>`_ |minimum_asdf_version| or later: Enables the\n  serialization of various Astropy classes into a portable, hierarchical,\n  human-readable representation.\n\n- `bottleneck <https://pypi.org/project/Bottleneck/>`_: Improves the performance\n  of sigma-clipping and other functionality that may require computing\n  statistics on arrays with NaN values.\n\n- `certifi <https://pypi.org/project/certifi/>`_: Useful when downloading\n  files from HTTPS or FTP+TLS sites in case Python is not able to locate\n  up-to-date root CA certificates on your system; this package is usually\n  already included in many Python installations (e.g., as a dependency of\n  the ``requests`` package).\n\n- `pyarrow <https://arrow.apache.org/docs/python/>`_ |minimum_pyarrow_version| or later:\n  To read/write :class:`~astropy.table.Table` objects from/to Parquet files.\n\nHowever, note that these packages require installation only if those particular\nfeatures are needed. ``astropy`` will import even if these dependencies are not\ninstalled.\n\nThe following packages can optionally be used when testing:\n\n- `pytest-astropy`_: See :ref:`sourcebuildtest`\n\n- `pytest-xdist <https://pypi.org/project/pytest-xdist/>`_: Used for\n  distributed testing.\n\n- `pytest-mpl <https://github.com/matplotlib/pytest-mpl>`_: Used for testing\n  with Matplotlib figures.\n\n- `objgraph <https://mg.pov.lt/objgraph/>`_: Used only in tests to test for reference leaks.\n\n- `IPython`_ |minimum_ipython_version| or later:\n  Used for testing the notebook interface of `~astropy.table.Table`.\n\n- `coverage <https://coverage.readthedocs.io/>`_: Used for code coverage\n  measurements.\n\n- `skyfield <https://rhodesmill.org/skyfield/>`_: Used for testing Solar System\n  coordinates.\n\n- `spgp4 <https://pypi.org/project/sgp4/>`_: Used for testing satellite positions.\n\n- `tox <https://tox.readthedocs.io/en/latest/>`_: Used to automate testing\n  and documentation builds.\n\nBuilding from Source\n====================\n\nPrerequisites\n-------------\n\nYou will need a compiler suite and the development headers for Python in order\nto build ``astropy``. You do not need to install any other specific build\ndependencies (such as `Cython <https://cython.org/>`_) since these are\ndeclared in the ``pyproject.toml`` file and will be automatically installed into\na temporary build environment by pip.\n\nPrerequisites for Linux\n-----------------------\n\nOn Linux, using the package manager for your distribution will usually be the\neasiest route to making sure you have the prerequisites to build ``astropy``. In\norder to build from source, you will need the Python development\npackage for your Linux distribution, as well as pip.\n\nFor Debian/Ubuntu::\n\n    sudo apt-get install python3-dev python3-numpy-dev python3-setuptools cython3 python3-pytest-astropy\n\nFor Fedora/RHEL::\n\n    sudo yum install python3-devel python3-numpy python3-setuptools python3-Cython python3-pytest-astropy\n\n.. note:: Building the developer version of ``astropy`` may require\n          newer versions of the above packages than are available in\n          your distribution's repository.  If so, you could either try\n          a more up-to-date distribution (such as Debian ``testing``),\n          or install more up-to-date versions of the packages using\n          ``pip`` or ``conda`` in a virtual environment.\n\nPrerequisites for Mac OS X\n--------------------------\n\nOn MacOS X you will need the XCode command line tools which can be installed\nusing::\n\n    xcode-select --install\n\nFollow the onscreen instructions to install the command line tools required.\nNote that you do **not** need to install the full XCode distribution (assuming\nyou are using MacOS X 10.9 or later).\n\nThe `instructions for building NumPy from source\n<https://numpy.org/doc/stable/user/building.html>`_ are a good\nresource for setting up your environment to build Python packages.\n\nObtaining the Source Packages\n-----------------------------\n\nSource Packages\n^^^^^^^^^^^^^^^\n\nThe latest stable source package for ``astropy`` can be `downloaded here\n<https://pypi.org/project/astropy>`_.\n\nDevelopment Repository\n^^^^^^^^^^^^^^^^^^^^^^\n\nThe latest development version of ``astropy`` can be cloned from GitHub\nusing this command::\n\n   git clone git://github.com/astropy/astropy.git\n\nIf you wish to participate in the development of ``astropy``, see the\n:ref:`developer-docs`. The present document covers only the basics necessary to\ninstalling ``astropy``.\n\nBuilding and Installing\n-----------------------\n\nTo build and install ``astropy`` (from the root of the source tree)::\n\n    pip install .\n\nIf you install in this way and you make changes to the code, you will need to\nre-run the install command for changes to be reflected. Alternatively, you can\nuse::\n\n    pip install -e .\n\nwhich installs ``astropy`` in develop/editable mode -- this then means that\nchanges in the code are immediately reflected in the installed version.\n\nTroubleshooting\n---------------\n\nIf you get an error mentioning that you do not have the correct permissions to\ninstall ``astropy`` into the default ``site-packages`` directory, you can try\ninstalling with::\n\n    pip install . --user\n\nwhich will install into a default directory in your home directory.\n\n.. _external_c_libraries:\n\nExternal C Libraries\n^^^^^^^^^^^^^^^^^^^^\n\nThe ``astropy`` source ships with the C source code of a number of\nlibraries. By default, these internal copies are used to build\n``astropy``. However, if you wish to use the system-wide installation of\none of those libraries, you can set environment variables with the\npattern ``ASTROPY_USE_SYSTEM_???`` to ``1`` when building/installing\nthe package.\n\nFor example, to build ``astropy`` using the system's expat parser\nlibrary, use::\n\n    ASTROPY_USE_SYSTEM_EXPAT=1 pip install -e .\n\nTo build using all of the system libraries, use::\n\n    ASTROPY_USE_SYSTEM_ALL=1 pip install -e .\n\nThe C libraries currently bundled with ``astropy`` include:\n\n- `wcslib <https://www.atnf.csiro.au/people/mcalabre/WCS/>`_ see\n  ``cextern/wcslib/README`` for the bundled version. To use the\n  system version, set ``ASTROPY_USE_SYSTEM_WCSLIB=1``.\n\n- `cfitsio <https://heasarc.gsfc.nasa.gov/fitsio/fitsio.html>`_ see\n  ``cextern/cfitsio/changes.txt`` for the bundled version. To use the\n  system version, set ``ASTROPY_USE_SYSTEM_CFITSIO=1``.\n\n- `expat <https://libexpat.github.io/>`_ see ``cextern/expat/README`` for the\n  bundled version. To use the system version, set ``ASTROPY_USE_SYSTEM_EXPAT=1``.\n\n\nInstalling ``astropy`` into CASA\n--------------------------------\n\nIf you want to be able to use ``astropy`` inside `CASA\n<https://casa.nrao.edu/>`_, the easiest way is to do so from inside CASA.\n\nFirst, we need to make sure `pip <https://pip.pypa.io>`__ is\ninstalled. Start up CASA as normal, and then type::\n\n    CASA <2>: from setuptools.command import easy_install\n\n    CASA <3>: easy_install.main(['--user', 'pip'])\n\nNow, quit CASA and re-open it, then type the following to install ``astropy``::\n\n    CASA <2>: import subprocess, sys\n\n    CASA <3>: subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--user', 'astropy'])\n\nThen close CASA again and open it, and you should be able to import ``astropy``::\n\n    CASA <2>: import astropy\n\nAny ``astropy`` affiliated package can be installed the same way (e.g. the\n`spectral-cube <https://spectral-cube.readthedocs.io>`_ or other\npackages that may be useful for radio astronomy).\n\n.. note:: The above instructions have not been tested on all systems.\n   We know of a few examples that do work, but that is not a guarantee\n   that this will work on all systems. If you install ``astropy`` and begin to\n   encounter issues with CASA, please look at the `known CASA issues\n   <https://github.com/astropy/astropy/issues?q=+label%3ACASA-Installation+>`_\n   and if you do not encounter your issue there, please post a new one.\n\n\nInstalling pre-built Development Versions of ``astropy``\n--------------------------------------------------------\n\nMost nights a development snapshot of ``astropy`` will be compiled.\nThis is useful if you want to test against a development version of astropy but\ndo not want to have to build it yourselves. You can see the\n`available astropy dev snapshots page <https://dev.azure.com/astropy-project/astropy/_packaging?_a=package&feed=nightly&package=astropy&protocolType=PyPI&view=versions>`_\nto find out what is currently being offered.\n\nInstalling these \"nightlies\" of ``astropy`` can be achieved by using ``pip``::\n\n  $ pip install --extra-index-url=https://pkgs.dev.azure.com/astropy-project/astropy/_packaging/nightly/pypi/simple/ --pre astropy\n\nThe extra index URL tells ``pip`` to check the ``pip`` index on Azure Pipelines, where the\nnightlies are built, and the ``--pre`` command tells ``pip`` to install pre-release\nversions (in this case ``.dev`` releases).\n\n.. _builddocs:\n\nBuilding Documentation\n----------------------\n\n.. note::\n\n    Building the documentation is in general not necessary unless you are\n    writing new documentation or do not have internet access, because\n    the latest (and archive) versions of Astropy's documentation should\n    be available at `docs.astropy.org <https://docs.astropy.org>`_ .\n\nDependencies\n^^^^^^^^^^^^\n\nBuilding the documentation requires the ``astropy`` source code and some\nadditional packages. The easiest way to build the documentation is to use `tox\n<https://tox.readthedocs.io/en/latest/>`_ as detailed in\n:ref:`astropy-doc-building`. If you are happy to do this, you can skip the rest\nof this section.\n\nOn the other hand, if you wish to call Sphinx manually to build the\ndocumentation, you will need to make sure that a number of dependencies are\ninstalled. If you use conda, the easiest way to install the dependencies is\nwith::\n\n    conda install -c conda-forge sphinx-astropy\n\nWithout conda, you install the dependencies by specifying ``[docs]`` when\ninstalling ``astropy`` with pip::\n\n    pip install -e '.[docs]'\n\nYou can alternatively install the `sphinx-astropy\n<https://github.com/astropy/sphinx-astropy>`_ package with pip::\n\n    pip install sphinx-astropy\n\nIn addition to providing configuration common to packages in the Astropy\necosystem, this package also serves as a way to automatically get the main\ndependencies, including:\n\n* `Sphinx <http://www.sphinx-doc.org>`_ - the main package we use to build\n  the documentation\n* `astropy-sphinx-theme <https://github.com/astropy/astropy-sphinx-theme>`_ -\n  the default 'bootstrap' theme used by ``astropy`` and a number of affiliated\n  packages\n* `sphinx-automodapi <https://sphinx-automodapi.readthedocs.io>`_ - an extension\n  that makes it easy to automatically generate API documentation\n* `sphinx-gallery <https://sphinx-gallery.readthedocs.io/en/latest/>`_ - an\n  extension to generate example galleries\n* `numpydoc`_ - an extension to parse\n  docstrings in NumPyDoc format\n* `pillow <https://pillow.readthedocs.io>`_ - used in one of the examples\n* `Graphviz <http://www.graphviz.org>`_ - generate inheritance graphs (available\n  as a conda package or a system install but not in pip)\n\n.. Note::\n    Both of the ``pip`` install methods above do not include `Graphviz\n    <http://www.graphviz.org>`_.  If you do not install this package separately\n    then the documentation build process will produce a very large number of\n    lengthy warnings (which can obscure bona fide warnings) and also not\n    generate inheritance graphs.\n\n.. _astropy-doc-building:\n\nBuilding\n^^^^^^^^\n\nThere are two ways to build the Astropy documentation. The easiest way is to\nexecute the following tox command (from the ``astropy`` source directory)::\n\n    tox -e build_docs\n\nIf you do this, you do not need to install any of the documentation dependencies\nas this will be done automatically. The documentation will be built in the\n``docs/_build/html`` directory, and can be read by pointing a web browser to\n``docs/_build/html/index.html``.\n\nAlternatively, you can do::\n\n    cd docs\n    make html\n\nAnd the documentation will be generated in the same location. Note that\nthis uses the installed version of astropy, so if you want to make sure\nthe current repository version is used, you will need to install it with\ne.g.::\n\n    pip install -e .[docs]\n\nbefore changing to the ``docs`` directory.\n\nIn the second way, LaTeX documentation can be generated by using the command::\n\n    make latex\n\nThe LaTeX file ``Astropy.tex`` will be created in the ``docs/_build/latex``\ndirectory, and can be compiled using ``pdflatex``.\n\nReporting Issues/Requesting Features\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nAs mentioned above, building the documentation depends on a number of Sphinx\nextensions and other packages. Since it is not always possible to know which\npackage is causing issues or would need to have a new feature implemented, you\ncan open an issue in the `core astropy package issue\ntracker <https://github.com/astropy/astropy/issues>`_. However, if you wish, you\ncan also open issues in the repositories for some of the dependencies:\n\n* For requests/issues related to the appearance of the docs (e.g. related to\n  the CSS), you can open an issue in the `astropy-sphinx-theme issue tracker\n  <https://github.com/astropy/astropy-sphinx-theme/issues>`_.\n\n* For requests/issues related to the auto-generated API docs which appear to\n  be general issues rather than an issue with a specific docstring, you can use\n  the `sphinx-automodapi issue tracker\n  <https://github.com/astropy/sphinx-automodapi/issues>`_.\n\n* For issues related to the default configuration (e.g which extensions are\n  enabled by default), you can use the `sphinx-astropy issue tracker\n  <https://github.com/astropy/sphinx-astropy/issues>`_.\n\n.. _sourcebuildtest:\n\nTesting a Source Code Build of ``astropy``\n------------------------------------------\n\n{% if is_development %}\n\nThe easiest way to run the tests in a source checkout of ``astropy``\nis to use `tox <https://tox.readthedocs.io/en/latest/>`_::\n\n    tox -e test-alldeps\n\nThere are also alternative methods of :ref:`running-tests` if you\nwould like more control over the testing process.\n\n{%else%}\n\nSee the :ref:`latest documentation on how to run the tests in a source\ncheckout of astropy <astropy-dev:sourcebuildtest>`\n\n{%endif%}\n"},{"id":37,"name":"index.rst","nodeType":"TextFile","path":"docs","text":".. Astropy documentation index file, created by\n   sphinx-quickstart on Tue Jul 26 02:59:34 2011.\n   You can adapt this file completely to your liking, but it should at least\n   contain the root `toctree` directive.\n\n:tocdepth: 3\n\n.. the \"raw\" directive below is used to hide the title in favor of just the logo being visible\n.. raw:: html\n\n    <style media=\"screen\" type=\"text/css\">\n      h1 { display:none; }\n    </style>\n\n#####################\nAstropy Documentation\n#####################\n\n.. |logo_svg| image:: _static/astropy_banner.svg\n\n.. |logo_png| image:: _static/astropy_banner_96.png\n\n.. raw:: html\n\n   <img src=\"_static/astropy_banner.svg\" onerror=\"this.src='_static/astropy_banner_96.png'; this.onerror=null;\" width=\"485\"/>\n\n.. only:: latex\n\n    .. image:: _static/astropy_logo.pdf\n\nThe ``astropy`` package contains key functionality and common tools needed for\nperforming astronomy and astrophysics with Python.  It is at the core of the\n`Astropy Project <http://www.astropy.org/about.html>`_, which aims to enable\nthe community to develop a robust ecosystem of `affiliated packages`_\ncovering a broad range of needs for astronomical research, data\nprocessing, and data analysis.\n\n.. Important:: If you use Astropy for work presented in a publication or talk\n   please help the project via proper `citation or acknowledgement\n   <https://www.astropy.org/acknowledging.html>`_.  This also applies to use of\n   software or `affiliated packages`_ that depend on the astropy\n   core package.\n\n.. _getting-started:\n\n***************\nGetting Started\n***************\n\n.. toctree::\n   :maxdepth: 1\n\n   install\n   whatsnew/5.1\n   importing_astropy\n   Example Gallery <generated/examples/index>\n   Tutorials <https://learn.astropy.org/>\n   Get Help <http://www.astropy.org/help.html>\n   Contribute and Report Problems <http://www.astropy.org/contribute.html>\n   About the Astropy Project <http://www.astropy.org/about.html>\n\n.. _user-docs:\n\n******************\nUser Documentation\n******************\n\nData structures and transformations\n-----------------------------------\n\n.. toctree::\n   :maxdepth: 1\n\n   constants/index\n   units/index\n   nddata/index\n   table/index\n   time/index\n   timeseries/index\n   coordinates/index\n   wcs/index\n   modeling/index\n   uncertainty/index\n\nFiles, I/O, and Communication\n-----------------------------\n\n.. toctree::\n   :maxdepth: 1\n\n   io/unified\n   io/fits/index\n   io/ascii/index\n   io/votable/index\n   io/misc\n   samp/index\n\nComputations and utilities\n--------------------------\n\n.. toctree::\n   :maxdepth: 1\n\n   cosmology/index\n   convolution/index\n   visualization/index\n   stats/index\n\nNuts and bolts\n--------------\n\n.. toctree::\n   :maxdepth: 1\n\n   config/index\n   io/registry\n   logging\n   warnings\n   utils/index\n   glossary\n\n.. _developer-docs:\n\n***********************\nDeveloper Documentation\n***********************\n\nThe developer documentation contains instructions for how to contribute to\nAstropy or affiliated packages, install and test the development version,\nas well as coding, documentation, and testing guidelines.\n\n{% if is_development %}\n\nFor the guiding vision of this process and the project\nas a whole, see :doc:`development/vision`.\n\n.. toctree::\n   :maxdepth: 1\n\n   development/workflow/development_workflow\n   development/workflow/get_devel_version\n   development/when_to_rebase\n   development/codeguide\n   development/docguide\n   development/style-guide\n   development/testguide\n   testhelpers\n   development/scripts\n   development/building\n   development/ccython\n   development/releasing\n   development/workflow/maintainer_workflow\n   development/astropy-package-template\n   changelog\n\nThere are some additional tools, mostly of use for maintainers, in the\n`astropy/astropy-tools repository\n<https://github.com/astropy/astropy-tools>`__.\n\n{%else%}\n\nTo read the developer documentation, you will need to go to the :ref:`latest\ndeveloper version of the documentation\n<astropy-dev:developer-docs>`.\n\n.. toctree::\n   :maxdepth: 1\n\n   changelog\n\n{%endif%}\n\n.. _project-details:\n\n***************\nProject details\n***************\n\n.. toctree::\n   :maxdepth: 1\n\n   whatsnew/index\n   lts_policy\n   known_issues\n   credits\n   license\n\n*****\nIndex\n*****\n\n* :ref:`genindex`\n* :ref:`modindex`\n* :ref:`search`\n\n.. _feedback@astropy.org: mailto:feedback@astropy.org\n.. _affiliated packages: https://www.astropy.org/affiliated/\n"},{"id":38,"name":"license.rst","nodeType":"TextFile","path":"docs","text":"********\nLicenses\n********\n\nAstropy License\n===============\n\nAstropy is licensed under a 3-clause BSD style license:\n\n.. include:: ../LICENSE.rst\n\nOther Licenses\n==============\n\nFull licenses for third-party software astropy is derived from or included\nwith Astropy can be found in the ``'licenses/'`` directory of the source\ncode distribution.\n"},{"id":39,"name":"testhelpers.rst","nodeType":"TextFile","path":"docs","text":".. _testhelpers:\n\n*********************\nAstropy Testing Tools\n*********************\n\nThis section is primarily a reference for developers that want to understand or\nadd to the Astropy testing machinery. See :doc:`/development/testguide` for an\noverview of running or writing the tests.\n\n\n`astropy.tests.helper` Module\n=============================\n\nTo ease development of tests that work with Astropy, the\n`astropy.tests.helper` module provides some utility functions to make\ntests that use Astropy conventions or classes easier to work with, e.g.,\nfunctions to test for near-equality of `~astropy.units.Quantity` objects.\n\nThe functionality here is not exhaustive, because\nmuch of the useful tools are either in the standard\nlibrary, `pytest`_, or `numpy.testing\n<https://numpy.org/doc/stable/reference/routines.testing.html>`_.  This module\ncontains primarily functionality specific to the astropy core package or\npackages that follow the Astropy package template.\n\nConversion Guide\n----------------\n\nSome long-standing functionality has been deprecated/removed since ``astropy`` 5.1.\nThe following table maps them to what you should use instead.\n\n========================================================== ===============================================\nDeprecated                                                 Use this\n========================================================== ===============================================\n``astropy.io.ascii.tests.common.raises``                   ``pytest.raises``\n``astropy.tests.helper.raises``                            ``pytest.raises``\n``astropy.tests.helper.catch_warnings``                    ``pytest.warns``\n``astropy.tests.helper.ignore_warnings``                   https://docs.pytest.org/en/stable/warnings.html\n``astropy.tests.helper.enable_deprecations_as_exceptions`` https://docs.pytest.org/en/stable/warnings.html\n``astropy.tests.helper.treat_deprecations_as_exceptions``  https://docs.pytest.org/en/stable/warnings.html\n========================================================== ===============================================\n\n========================================================== ===============================================\nRemoved                                                    Use this\n========================================================== ===============================================\n``astropy.tests.disable_internet``                         ``pytest_remotedata.disable_internet``\n``astropy.tests.helper.remote_data``                       ``pytest.mark.remote_data``\n``astropy.tests.plugins.display``                          ``pytest-astropy-header`` package\n========================================================== ===============================================\n\nReference/API\n-------------\n\n.. module:: astropy.tests.helper\n\n.. automodapi:: astropy.tests.helper\n    :no-main-docstr:\n    :no-inheritance-diagram:\n\n\nAstropy Test Runner\n===================\n\nWhen executing tests with `astropy.test` the call to pytest is controlled\nby the `astropy.tests.runner.TestRunner` class.\n\nThe `~astropy.tests.runner.TestRunner` class is used to generate the\n`astropy.test` function, the test function generates a set of command line\narguments to pytest. The arguments to pytest are defined in the\n``run_tests`` method, the arguments to\n``run_tests`` and their respective logic are defined in methods of\n`~astropy.tests.runner.TestRunner` decorated with the\n`~astropy.tests.runner.keyword` decorator. For an example of this see\n`~astropy.tests.runner.TestRunnerBase`. This design makes it easy for\npackages to add or remove keyword arguments to their test runners, or define a\nwhole new set of arguments by subclassing from\n`~astropy.tests.runner.TestRunnerBase`.\n\nReference/API\n-------------\n\n.. module:: astropy.tests.runner\n\n.. autoclass:: astropy.tests.runner.keyword\n    :no-undoc-members:\n\n.. autoclass:: astropy.tests.runner.TestRunnerBase\n\n.. autoclass:: astropy.tests.runner.TestRunner\n"},{"id":40,"name":"warnings.rst","nodeType":"TextFile","path":"docs","text":".. _python-warnings:\n\n**********************\nPython warnings system\n**********************\n\n.. doctest-skip-all\n\nAstropy uses the Python :mod:`warnings` module to issue warning messages.  The\ndetails of using the warnings module are general to Python, and apply to any\nPython software that uses this system.  The user can suppress the warnings\nusing the python command line argument ``-W\"ignore\"`` when starting an\ninteractive python session.  For example::\n\n     $ python -W\"ignore\"\n\nThe user may also use the command line argument when running a python script as\nfollows::\n\n     $ python -W\"ignore\" myscript.py\n\nIt is also possible to suppress warnings from within a python script.  For\ninstance, the warnings issued from a single call to the\n`astropy.io.fits.writeto` function may be suppressed from within a Python\nscript using the `warnings.filterwarnings` function as follows::\n\n     >>> import warnings\n     >>> from astropy.io import fits\n     >>> warnings.filterwarnings('ignore', category=UserWarning, append=True)\n     >>> fits.writeto(filename, data, overwrite=True)\n\nAn equivalent way to insert an entry into the list of warning filter specifications\nfor simple call `warnings.simplefilter`::\n\n    >>> warnings.simplefilter('ignore', UserWarning)\n\nAstropy includes its own warning classes,\n`~astropy.utils.exceptions.AstropyWarning` and\n`~astropy.utils.exceptions.AstropyUserWarning`.  All warnings from Astropy are\nbased on these warning classes (see below for the distinction between them). One\ncan thus ignore all warnings from Astropy (while still allowing through\nwarnings from other libraries like Numpy) by using something like::\n\n    >>> from astropy.utils.exceptions import AstropyWarning\n    >>> warnings.simplefilter('ignore', category=AstropyWarning)\n\nWarning filters may also be modified just within a certain context using the\n`warnings.catch_warnings` context manager::\n\n    >>> with warnings.catch_warnings():\n    ...     warnings.simplefilter('ignore', AstropyWarning)\n    ...     fits.writeto(filename, data, overwrite=True)\n\nAs mentioned above, there are actually *two* base classes for Astropy warnings.\nThe main distinction is that `~astropy.utils.exceptions.AstropyUserWarning` is\nfor warnings that are *intended* for typical users (e.g. \"Warning: Ambiguous\nunit\", something that might be because of improper input).  In contrast,\n`~astropy.utils.exceptions.AstropyWarning` warnings that are *not*\n`~astropy.utils.exceptions.AstropyUserWarning` may be for lower-level warnings\nmore useful for developers writing code that *uses* Astropy (e.g., the\ndeprecation warnings discussed below).  So if you're a user that just wants to\nsilence everything, the code above will suffice, but if you are a developer and\nwant to hide development-related warnings from your users, you may wish to still\nallow through `~astropy.utils.exceptions.AstropyUserWarning`.\n\nAstropy also issues warnings when deprecated API features are used.  If you\nwish to *squelch* deprecation warnings, you can start Python with\n``-Wi::Deprecation``.  This sets all deprecation warnings to ignored.  There is\nalso an Astropy-specific `~astropy.utils.exceptions.AstropyDeprecationWarning`\nwhich can be used to disable deprecation warnings from Astropy only.\n\nSee `the CPython documentation\n<https://docs.python.org/3/using/cmdline.html#cmdoption-W>`__ for more\ninformation on the -W argument.\n"},{"id":41,"name":"common_links.txt","nodeType":"TextFile","path":"docs","text":".. These are ReST substitutions and links that can be used throughout the docs\n.. (and docstrings) because they are added to ``docs/conf.py::rst_epilog``.\n.. Some of the links are in curly braces for ``.format`` substitutions.\n\n.. ------------------------------------------------------------------\n.. RST SUBSITUTIONS\n\n..                                 NumPy\n.. |ndarray| replace:: :class:`numpy.ndarray`\n\n..                                Astropy\n.. Coordinates\n.. |EarthLocation| replace:: :class:`~astropy.coordinates.EarthLocation`\n.. |Angle| replace:: `~astropy.coordinates.Angle`\n.. |Latitude| replace:: `~astropy.coordinates.Latitude`\n.. |Longitude| replace:: :class:`~astropy.coordinates.Longitude`\n.. |BaseFrame| replace:: `~astropy.coordinates.BaseCoordinateFrame`\n.. |SkyCoord| replace:: :class:`~astropy.coordinates.SkyCoord`\n.. |SpectralCoord| replace:: `~astropy.coordinates.SpectralCoord`\n\n.. Cosmology\n.. |Cosmology| replace:: :class:`~astropy.cosmology.Cosmology`\n.. |Cosmology.read| replace:: :meth:`~astropy.cosmology.Cosmology.read`\n.. |Cosmology.write| replace:: :meth:`~astropy.cosmology.Cosmology.write`\n.. |Cosmology.from_format| replace:: :meth:`~astropy.cosmology.Cosmology.from_format`\n.. |Cosmology.to_format| replace:: :meth:`~astropy.cosmology.Cosmology.to_format`\n\n.. |FLRW| replace:: :class:`~astropy.cosmology.FLRW`\n.. |LambdaCDM| replace:: :class:`~astropy.cosmology.LambdaCDM`\n.. |FlatLambdaCDM| replace:: :class:`~astropy.cosmology.FlatLambdaCDM`\n\n.. |Planck18| replace:: :ref:`Planck18 <astropy:Planck18>`\n\n.. |FlatCosmologyMixin| replace:: :class:`~astropy.cosmology.FlatCosmologyMixin`\n.. |FlatFLRWMixin| replace:: :class:`~astropy.cosmology.FlatFLRWMixin`\n\n.. |default_cosmology| replace:: :class:`~astropy.cosmology.default_cosmology`\n\n.. SAMP\n.. |SAMPClient| replace:: :class:`~astropy.samp.SAMPClient`\n.. |SAMPIntegratedClient| replace:: :class:`~astropy.samp.SAMPIntegratedClient`\n.. |SAMPHubServer| replace:: :class:`~astropy.samp.SAMPHubServer`\n.. |SAMPHubProxy| replace:: :class:`~astropy.samp.SAMPHubProxy`\n.. |SAMPMsgReplierWrapper| replace:: :class:`~astropy.samp.SAMPMsgReplierWrapper`\n\n.. Table\n.. |Column| replace:: :class:`~astropy.table.Column`\n.. |MaskedColumn| replace:: :class:`~astropy.table.MaskedColumn`\n.. |TableColumns| replace:: :class:`~astropy.table.TableColumns`\n.. |Row| replace:: :class:`~astropy.table.Row`\n.. |Table| replace:: :class:`~astropy.table.Table`\n.. |QTable| replace:: :class:`~astropy.table.QTable`\n\n.. Time\n.. |Time| replace:: :class:`~astropy.time.Time`\n.. |TimeDelta| replace:: :class:`~astropy.time.TimeDelta`\n\n.. Timeseries\n.. |TimeSeries| replace:: :class:`~astropy.timeseries.TimeSeries`\n.. |BinnedTimeSeries| replace:: :class:`~astropy.timeseries.BinnedTimeSeries`\n\n.. Distribution\n.. |Distribution| replace:: :class:`~astropy.uncertainty.Distribution`\n\n.. Units\n.. |PhysicalType| replace:: :class:`~astropy.units.PhysicalType`\n.. |Quantity| replace:: :class:`~astropy.units.Quantity`\n.. |Unit| replace:: :class:`~astropy.units.UnitBase`\n.. |StructuredUnit| replace:: :class:`~astropy.units.StructuredUnit`\n\n.. Utils\n.. |Masked| replace:: :class:`~astropy.utils.masked.Masked`\n\n.. ------------------------------------------------------------------\n.. KNOWN PROJECTS\n\n.. _Python: https://www.python.org/\n.. |minimum_python_version| replace:: {minimum_python}\n\n.. Astropy\n.. _`Astropy mailing list`: https://mail.python.org/mailman/listinfo/astropy\n.. _`astropy-dev mailing list`: http://groups.google.com/group/astropy-dev\n\n.. NumPy\n.. _NumPy: https://numpy.org/\n.. _`numpy github`: https://github.com/numpy/numpy\n.. _`numpy mailing list`: http://mail.python.org/mailman/listinfo/numpy-discussion\n.. |minimum_numpy_version| replace:: {numpy}\n\n.. _numpydoc: https://pypi.org/project/numpydoc/\n\n.. erfa\n.. _ERFA: https://github.com/liberfa/erfa\n.. _PyErfa: http://pyerfa.readthedocs.org/\n.. _`pyerfa github`: https://github.com/liberfa/pyerfa/\n.. |minimum_pyerfa_version| replace:: {pyerfa}\n\n.. matplotlib\n.. _Matplotlib: https://matplotlib.org/\n.. |minimum_matplotlib_version| replace:: {matplotlib}\n\n.. sofa\n.. _SOFA: http://www.iausofa.org/index.html\n\n.. scipy\n.. _scipy: https://www.scipy.org/\n.. _`scipy github`: https://github.com/scipy/scipy\n.. _`scipy mailing list`: http://mail.python.org/mailman/listinfo/scipy-dev\n.. |minimum_scipy_version| replace:: {scipy}\n\n.. asdf\n.. |minimum_asdf_version| replace:: {asdf}\n\n.. pyyaml\n.. |minimum_pyyaml_version| replace:: {pyyaml}\n\n.. packaging\n.. _packaging: https://packaging.pypa.io/\n.. |minimum_packaging_version| replace:: {packaging}\n\n.. IPython\n.. _IPython: http://ipython.org/\n.. _`ipython github`: https://github.com/ipython/ipython\n.. _`ipython mailing list`: http://mail.python.org/mailman/listinfo/IPython-dev\n.. |minimum_ipython_version| replace:: {ipython}\n\n.. pip\n.. _pip: https://pip.pypa.io\n\n.. pipenv\n.. _pipenv: https://pipenv.pypa.io/en/latest/\n\n.. pyarrow\n.. |minimum_pyarrow_version| replace:: {pyarrow}\n\n.. virtualenv\n.. _virtualenv: https://pypi.org/project/virtualenv\n.. _virtualenvwrapper: https://pypi.org/project/virtualenvwrapper\n.. _virtualenvwrapper-win: https://github.com/davidmarble/virtualenvwrapper-win\n.. _venv: https://docs.python.org/dev/library/venv.html\n\n.. conda\n.. _conda: https://conda.io/docs/\n\n.. py.test\n.. _pytest: https://pytest.org/en/latest/index.html\n.. _pytest-astropy: https://github.com/astropy/pytest-astropy\n.. _pytest-doctestplus: https://github.com/astropy/pytest-doctestplus\n.. _pytest-openfiles: https://github.com/astropy/pytest-openfiles\n.. _pytest-remotedata: https://github.com/astropy/pytest-remotedata\n"},{"col":0,"comment":"Render pages as a jinja template to hide/show dev docs. ","endLoc":364,"header":"def rstjinja(app, docname, source)","id":42,"name":"rstjinja","nodeType":"Function","startLoc":354,"text":"def rstjinja(app, docname, source):\n    \"\"\"Render pages as a jinja template to hide/show dev docs. \"\"\"\n    # Make sure we're outputting HTML\n    if app.builder.format != 'html':\n        return\n    files_to_render = [\"index\", \"install\"]\n    if docname in files_to_render:\n        print(f\"Jinja rendering {docname}\")\n        rendered = app.builder.templates.render_string(\n            source[0], app.config.html_context)\n        source[0] = rendered"},{"id":43,"name":"lts_policy.rst","nodeType":"TextFile","path":"docs","text":"*******************\nLTS Backport Policy\n*******************\n\nStarting from astropy 5.0, backports to Long-Term Stable (LTS) releases\nwill only cover:\n\n* Critical security fixes.\n* Bug fixes where backporting is straightforward (e.g., no conflicts).\n* More complex fixes are permissible only as resources allow, ideally with\n  backports done by the original author, users, or institutions who are on LTS\n  and need the fix.\n* New \"features\" that are absolutely necessary to accomplish the above.\n* Other critical additions absolutely necessary for users stuck to the LTS.\n  In this case, the users themselves (e.g., developers from affected institutions)\n  would perform the needed backports or implementation.\n\nThis is because LTS lasts for about 2 years. During that time frame, as the\nLTS branch diverges from the development branch, backports will become\nincreasingly difficult due to merge conflicts. When conflicts arise,\nautomation is not possible, therefore driving up the maintenance cost.\n"},{"id":44,"name":"getting_started.rst","nodeType":"TextFile","path":"docs","text":":orphan:\n\n****************************\nGetting Started with Astropy\n****************************\n\nThis page has been moved to :ref:`getting-started`. Please update your links.\n"},{"id":45,"name":"Makefile","nodeType":"TextFile","path":"docs","text":"# Makefile for Sphinx documentation\n#\n\n# You can set these variables from the command line.\nSPHINXOPTS    =\nSPHINXBUILD   = sphinx-build\nPAPER         =\nBUILDDIR      = _build\n\n# Internal variables.\nPAPEROPT_a4     = -D latex_paper_size=a4\nPAPEROPT_letter = -D latex_paper_size=letter\nALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .\n\n.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest\n\n#This is needed with git because git doesn't create a dir if it's empty\n$(shell [ -d \"_static\" ] || mkdir -p _static)\n\nhelp:\n\t@echo \"Please use \\`make <target>' where <target> is one of\"\n\t@echo \"  html       to make standalone HTML files\"\n\t@echo \"  dirhtml    to make HTML files named index.html in directories\"\n\t@echo \"  singlehtml to make a single large HTML file\"\n\t@echo \"  pickle     to make pickle files\"\n\t@echo \"  json       to make JSON files\"\n\t@echo \"  htmlhelp   to make HTML files and a HTML help project\"\n\t@echo \"  qthelp     to make HTML files and a qthelp project\"\n\t@echo \"  devhelp    to make HTML files and a Devhelp project\"\n\t@echo \"  epub       to make an epub\"\n\t@echo \"  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter\"\n\t@echo \"  latexpdf   to make LaTeX files and run them through pdflatex\"\n\t@echo \"  text       to make text files\"\n\t@echo \"  man        to make manual pages\"\n\t@echo \"  changes    to make an overview of all changed/added/deprecated items\"\n\t@echo \"  linkcheck  to check all external links for integrity\"\n\nclean:\n\t-rm -rf $(BUILDDIR)\n\t-rm -rf api\n\t-rm -rf generated\n\nhtml:\n\t$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html\n\t@echo\n\t@echo \"Build finished. The HTML pages are in $(BUILDDIR)/html.\"\n\ndirhtml:\n\t$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml\n\t@echo\n\t@echo \"Build finished. The HTML pages are in $(BUILDDIR)/dirhtml.\"\n\nsinglehtml:\n\t$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml\n\t@echo\n\t@echo \"Build finished. The HTML page is in $(BUILDDIR)/singlehtml.\"\n\npickle:\n\t$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle\n\t@echo\n\t@echo \"Build finished; now you can process the pickle files.\"\n\njson:\n\t$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json\n\t@echo\n\t@echo \"Build finished; now you can process the JSON files.\"\n\nhtmlhelp:\n\t$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp\n\t@echo\n\t@echo \"Build finished; now you can run HTML Help Workshop with the\" \\\n\t      \".hhp project file in $(BUILDDIR)/htmlhelp.\"\n\nqthelp:\n\t$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp\n\t@echo\n\t@echo \"Build finished; now you can run \"qcollectiongenerator\" with the\" \\\n\t      \".qhcp project file in $(BUILDDIR)/qthelp, like this:\"\n\t@echo \"# qcollectiongenerator $(BUILDDIR)/qthelp/Astropy.qhcp\"\n\t@echo \"To view the help file:\"\n\t@echo \"# assistant -collectionFile $(BUILDDIR)/qthelp/Astropy.qhc\"\n\ndevhelp:\n\t$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp\n\t@echo\n\t@echo \"Build finished.\"\n\t@echo \"To view the help file:\"\n\t@echo \"# mkdir -p $$HOME/.local/share/devhelp/Astropy\"\n\t@echo \"# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Astropy\"\n\t@echo \"# devhelp\"\n\nepub:\n\t$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub\n\t@echo\n\t@echo \"Build finished. The epub file is in $(BUILDDIR)/epub.\"\n\nlatex:\n\t$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex\n\t@echo\n\t@echo \"Build finished; the LaTeX files are in $(BUILDDIR)/latex.\"\n\t@echo \"Run \\`make' in that directory to run these through (pdf)latex\" \\\n\t      \"(use \\`make latexpdf' here to do that automatically).\"\n\nlatexpdf:\n\t$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex\n\t@echo \"Running LaTeX files through pdflatex...\"\n\tmake -C $(BUILDDIR)/latex all-pdf\n\t@echo \"pdflatex finished; the PDF files are in $(BUILDDIR)/latex.\"\n\ntext:\n\t$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text\n\t@echo\n\t@echo \"Build finished. The text files are in $(BUILDDIR)/text.\"\n\nman:\n\t$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man\n\t@echo\n\t@echo \"Build finished. The manual pages are in $(BUILDDIR)/man.\"\n\nchanges:\n\t$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes\n\t@echo\n\t@echo \"The overview file is in $(BUILDDIR)/changes.\"\n\nlinkcheck:\n\t$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck\n\t@echo\n\t@echo \"Link check complete; look for any errors in the above output \" \\\n\t      \"or in $(BUILDDIR)/linkcheck/output.txt.\"\n\ndoctest:\n\t@echo \"Run 'pytest' in the root directory to run doctests \" \\\n\t@echo \"in the documentation.\"\n"},{"id":46,"name":"robots.txt","nodeType":"TextFile","path":"docs","text":"User-agent: *\nAllow: /*/latest/\nAllow: /en/latest/   # Fallback for bots that don't understand wildcards\nAllow: /*/stable/\nAllow: /en/stable/   # Fallback for bots that don't understand wildcards\nDisallow: /\n"},{"id":47,"name":"importing_astropy.rst","nodeType":"TextFile","path":"docs","text":"**************************************\nImporting ``astropy`` and Sub-packages\n**************************************\n\nIn order to encourage consistency among users in importing and using Astropy\nfunctionality, we have put together the following guidelines.\n\nSince most of the functionality in Astropy resides in sub-packages, importing\n``astropy`` as::\n\n    >>> import astropy\n\nis not very useful. Instead, it's best to import the desired sub-package\nwith the syntax::\n\n    >>> from astropy import subpackage  # doctest: +SKIP\n\nFor example, to access the FITS-related functionality, you can import\n`astropy.io.fits` with::\n\n    >>> from astropy.io import fits\n    >>> hdulist = fits.open('data.fits')  # doctest: +SKIP\n\nIn specific cases, we have recommended shortcuts in the documentation for\nspecific sub-packages. For example::\n\n    >>> from astropy import units as u\n    >>> from astropy import coordinates as coord\n    >>> coord.SkyCoord(ra=10.68458*u.deg, dec=41.26917*u.deg, frame='icrs')  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        ( 10.68458,  41.26917)>\n\nFinally, in some cases, most of the required functionality is contained in a\nsingle class (or a few classes). In those cases, the class can be directly\nimported::\n\n    >>> from astropy.cosmology import WMAP7\n    >>> from astropy.table import Table\n    >>> from astropy.wcs import WCS\n\nNote that for clarity, and to avoid any issues, we recommend **never**\nimporting any Astropy functionality using ``*``, for example::\n\n    >>> from astropy.io.fits import *  # NOT recommended\n\nSome components of Astropy started off as standalone packages (e.g. PyFITS,\nPyWCS), so in cases where Astropy needs to be used as a drop-in replacement,\nthe following syntax is also acceptable::\n\n    >>> from astropy.io import fits as pyfits\n\n*********************************\nGetting Started with Sub-packages\n*********************************\n\nBecause different sub-packages have very different functionalities, each\nsub-package has its own getting started guide. These can be found by browsing\nthe sections listed in the :ref:`user-docs`.\n\nYou can also look at docstrings for a particular package or object, or access\ntheir documentation using the `~astropy.utils.misc.find_api_page` function. For\nexample, ::\n\n    >>> from astropy import find_api_page\n    >>> from astropy.units import Quantity\n    >>> find_api_page(Quantity)  # doctest: +SKIP\n\nwill bring up the documentation for the `~astropy.units.Quantity` class\nin your browser.\n"},{"id":48,"name":"glossary.rst","nodeType":"TextFile","path":"docs","text":".. currentmodule:: astropy\n\n****************\nAstropy Glossary\n****************\n\n.. glossary::\n\n   (`n`,)\n      A parenthesized number followed by a comma denotes a tuple with one\n      element. The trailing comma distinguishes a one-element tuple from a\n      parenthesized ``n``.\n      This is from NumPy; see https://numpy.org/doc/stable/glossary.html.\n\n   number\n      Any numeric type. eg float or int or any of the ``numpy.number``.\n\n   -like\n      Used to indicate on object of that type or that can instantiate the type.\n      E.g. :class:`~astropy.units.Quantity`-like includes ``\"2 * u.km\"``\n      because ``astropy.units.Quantity(\"2 * u.km\")`` works.\n\n   unit-like\n      Must be an :class:`~astropy.units.UnitBase` (subclass) instance or a\n      string or other instance parseable by :class:`~astropy.units.Unit`.\n\n   quantity-like\n      Must be an `~astropy.units.Quantity` (or subclass) instance or a string\n      parseable by `~astropy.units.Quantity`.\n      Note that the interpretation of units in strings depends on the class --\n      ``Quantity(\"180d\")`` is 180 **days**, while ``Angle(\"180d\")`` is 180\n      **degrees** -- so check the string parses as intended for ``Quantity``.\n\n   ['physical type']\n       The physical type of a quantity can be annotated in square brackets\n       following a `~astropy.units.Quantity` (or similar :term:`quantity-like`).\n\n       For example, ``distance : quantity-like ['length']``\n\n   angle-like\n      :term:`quantity-like`, but interpreted by an angular\n      `~astropy.units.SpecificTypeQuantity`, like `~astropy.coordinates.Angle`\n      or `~astropy.coordinates.Longitude` or `~astropy.coordinates.Latitude`.\n      Note that the interpretation of units in strings depends on the class --\n      ``Quantity(\"180d\")`` is 180 days, while ``Angle(\"180d\")`` is 180 degrees\n      -- so make sure the string parses as intended for ``Angle``.\n\n   length-like\n      :term:`quantity-like`, but interpretable by\n      :class:`~astropy.coordinates.Distance`.\n\n   frame-like\n      A :class:`~astropy.coordinates.BaseCoordinateFrame` subclass instance or a\n      string that can be converted to a Frame by\n      :class:`~astropy.coordinates.sky_coordinate_parsers._get_frame_class`.\n\n   coordinate-like\n      A Coordinate-type object such as a\n      :class:`~astropy.coordinates.BaseCoordinateFrame` subclass instance or a\n      :class:`~astropy.coordinates.SkyCoord` (or subclass) instance.\n\n   table-like\n      An astropy :class:`~astropy.table.Table` or any object that can\n      initialize one. Anything marked as table-like will be processed through\n      a :class:`~astropy.table.Table`.\n\n   time-like\n      :class:`~astropy.time.Time` or any valid initializer.\n\n   buffer-like\n      Anything that implements Python's buffer protocol. See\n      https://docs.python.org/3/c-api/buffer.html#bufferobjects\n\n   writable file-like object\n      In the context of a :term:`python:file-like object` object, anything\n      that supports writing with a method ``write``.\n\n   readable file-like object\n      In the context of a :term:`python:file-like object` object, anything\n      that supports writing with a method ``read``.\n\n\n***************************\nOptional Packages' Glossary\n***************************\n\n.. currentmodule:: matplotlib.pyplot\n\n.. glossary::\n\n   color\n      Any valid Matplotlib color.\n"},{"id":49,"name":"logging.rst","nodeType":"TextFile","path":"docs","text":"**************\nLogging system\n**************\n\n.. note::\n\n    The Astropy logging system is meant for internal ``astropy`` usage. For use\n    in other packages, we recommend implementing your own logger instead.\n\nOverview\n========\n\nThe Astropy logging system is designed to give users flexibility in deciding\nwhich log messages to show, to capture them, and to send them to a file.\n\nAll messages printed by Astropy routines should use the built-in logging\nfacility (normal ``print()`` calls should only be done by routines that are\nexplicitly requested to print output). Messages can have one of several\nlevels:\n\n* DEBUG: Detailed information, typically of interest only when diagnosing\n  problems.\n\n* INFO: An message conveying information about the current task, and\n  confirming that things are working as expected\n\n* WARNING: An indication that something unexpected happened, and that user\n  action may be required.\n\n* ERROR: indicates a more serious issue, including exceptions\n\nBy default, INFO, WARNING and ERROR messages are displayed, and are sent to a\nlog file located at ``~/.astropy/astropy.log`` (if the file is writeable).\n\nConfiguring the logging system\n==============================\n\nFirst, import the logger::\n\n    from astropy import log\n\nThe threshold level (defined above) for messages can be set with e.g.::\n\n    log.setLevel('DEBUG')\n\nColor (enabled by default) can be disabled with::\n\n    log.disable_color()\n\nand enabled with::\n\n    log.enable_color()\n\nWarnings from ``warnings.warn`` can be logged with::\n\n    log.enable_warnings_logging()\n\nwhich can be disabled with::\n\n    log.disable_warnings_logging()\n\nand exceptions can be included in the log with::\n\n    log.enable_exception_logging()\n\nwhich can be disabled with::\n\n    log.disable_exception_logging()\n\nIt is also possible to set these settings from the Astropy configuration file,\nwhich also allows an overall log file to be specified. See\n`Using the configuration file`_ for more information.\n\nContext managers\n================\n\nIn some cases, you may want to capture the log messages, for example to check\nwhether a specific message was output, or to log the messages from a specific\nsection of code to a file. Both of these are possible using context managers.\n\nTo add the log messages to a list, first import the logger if you have not\nalready done so::\n\n    from astropy import log\n\nthen enclose the code in which you want to log the messages to a list in a\n``with`` statement::\n\n    with log.log_to_list() as log_list:\n        # your code here\n\nIn the above example, once the block of code has executed, ``log_list`` will\nbe a Python list containing all the Astropy logging messages that were raised.\nNote that messages continue to be output as normal.\n\nSimilarly, you can output the log messages of a specific section of code to a\nfile using::\n\n    with log.log_to_file('myfile.log'):\n        # your code here\n\nwhich will add all the messages to ``myfile.log`` (this is in addition to the\noverall log file mentioned in `Using the configuration file`_).\n\nWhile these context managers will include all the messages emitted by the\nlogger (using the global level set by ``log.setLevel``), it is possible to\nfilter a subset of these using ``filter_level=``, and specifying one of\n``'DEBUG'``, ``'INFO'``, ``'WARN'``, ``'ERROR'``. Note that if\n``filter_level`` is a lower level than that set via ``setLevel``, only\nmessages with the level set by ``setLevel`` or higher will be included (i.e.\n``filter_level`` is only filtering a subset of the messages normally emitted\nby the logger).\n\nSimilarly, it is possible to filter a subset of the messages by origin by\nspecifying ``filter_origin=`` followed by a string. If the origin of a message\nstarts with that string, the message will be included in the context manager.\nFor example, ``filter_origin='astropy.wcs'`` will include only messages\nemitted in the ``astropy.wcs`` sub-package.\n\nUsing the configuration file\n============================\n\nOptions for the logger can be set in the ``[logger]`` section\nof the Astropy configuration file::\n\n    [logger]\n\n    # Threshold for the logging messages. Logging messages that are less severe\n    # than this level will be ignored. The levels are 'DEBUG', 'INFO', 'WARNING',\n    # 'ERROR'\n    log_level = 'INFO'\n\n    # Whether to use color for the level names\n    use_color = True\n\n    # Whether to log warnings.warn calls\n    log_warnings = False\n\n    # Whether to log exceptions before raising them\n    log_exceptions = False\n\n    # Whether to always log messages to a log file\n    log_to_file = True\n\n    # The file to log messages to. If empty string is given, it defaults to a\n    # file `astropy.log` in the astropy config directory.\n    log_file_path = '~/.astropy/astropy.log'\n\n    # Threshold for logging messages to log_file_path\n    log_file_level = 'INFO'\n\n    # Format for log file entries\n    log_file_format = '%(asctime)s, %(origin)s, %(levelname)s, %(message)s'\n\n    # The encoding (e.g., UTF-8) to use for the log file.  If empty string is\n    # given, it defaults to the platform-preferred encoding.\n    log_file_encoding = \"\"\n\n\nReference/API\n=============\n\n.. automodapi:: astropy.logger\n    :no-inheritance-diagram:\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":50,"name":"DOCS_HELP","nodeType":"Attribute","startLoc":37,"text":"DOCS_HELP"},{"col":0,"comment":"","endLoc":7,"header":"setup.py#<anonymous>","id":51,"name":"<anonymous>","nodeType":"Function","startLoc":7,"text":"TEST_HELP = \"\"\"\nNote: running tests is no longer done using 'python setup.py test'. Instead\nyou will need to run:\n\n    tox -e test\n\nIf you don't already have tox installed, you can install it with:\n\n    pip install tox\n\nIf you only want to run part of the test suite, you can also use pytest\ndirectly with::\n\n    pip install -e .[test]\n    pytest\n\nFor more information, see:\n\n  https://docs.astropy.org/en/latest/development/testguide.html#running-tests\n\"\"\"\n\nif 'test' in sys.argv:\n    print(TEST_HELP)\n    sys.exit(1)\n\nDOCS_HELP = \"\"\"\nNote: building the documentation is no longer done using\n'python setup.py build_docs'. Instead you will need to run:\n\n    tox -e build_docs\n\nIf you don't already have tox installed, you can install it with:\n\n    pip install tox\n\nYou can also build the documentation with Sphinx directly using::\n\n    pip install -e .[docs]\n    cd docs\n    make html\n\nFor more information, see:\n\n  https://docs.astropy.org/en/latest/install.html#builddocs\n\"\"\"\n\nif 'build_docs' in sys.argv or 'build_sphinx' in sys.argv:\n    print(DOCS_HELP)\n    sys.exit(1)\n\nsetup(ext_modules=get_extensions())"},{"fileName":"conftest.py","filePath":"docs","id":52,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# This file needs to be included here to make sure commands such\n# as ``pytest docs/...`` works, since this\n# will ignore the conftest.py file at the root of the repository\n# and the one in astropy/conftest.py\n\nimport os\nimport tempfile\nimport pytest\n\n# Make sure we use temporary directories for the config and cache\n# so that the tests are insensitive to local configuration.\n\nos.environ['XDG_CONFIG_HOME'] = tempfile.mkdtemp('astropy_config')\nos.environ['XDG_CACHE_HOME'] = tempfile.mkdtemp('astropy_cache')\n\nos.mkdir(os.path.join(os.environ['XDG_CONFIG_HOME'], 'astropy'))\nos.mkdir(os.path.join(os.environ['XDG_CACHE_HOME'], 'astropy'))\n\n# Note that we don't need to change the environment variables back or remove\n# them after testing, because they are only changed for the duration of the\n# Python process, and this configuration only matters if running pytest\n# directly, not from e.g. an IPython session.\n\n\n@pytest.fixture(autouse=True)\ndef _docdir(request):\n    \"\"\"Run doctests in isolated tmpdir so outputs do not end up in repo\"\"\"\n    # Trigger ONLY for doctestplus\n    doctest_plugin = request.config.pluginmanager.getplugin(\"doctestplus\")\n    if isinstance(request.node.parent, doctest_plugin._doctest_textfile_item_cls):\n        # Don't apply this fixture to io.rst.  It reads files and doesn't write\n        if \"io.rst\" not in request.node.name:\n            tmpdir = request.getfixturevalue('tmpdir')\n            with tmpdir.as_cwd():\n                yield\n        else:\n            yield\n    else:\n        yield\n"},{"id":53,"name":"docs/io","nodeType":"Package"},{"id":54,"name":"unified.rst","nodeType":"TextFile","path":"docs/io","text":".. _table_io:\n\nUnified File Read/Write Interface\n*********************************\n\n``astropy`` provides a unified interface for reading and writing data in\ndifferent formats. For many common cases this will streamline the process of\nfile I/O and reduce the need to learn the separate details of all of the I/O\npackages within ``astropy``. For details on the implementation see\n:ref:`io_registry`.\n\nGetting Started with Image I/O\n==============================\n\nReading and writing image data in the unified I/O interface is supported\nthough the `~astropy.nddata.CCDData` class using FITS file format:\n\n.. doctest-skip::\n\n    >>> # Read CCD image\n    >>> ccd = CCDData.read('image.fits')\n\n.. doctest-skip::\n\n    >>> # Write back CCD image\n    >>> ccd.write('new_image.fits')\n\nNote that the unit is stored in the ``BUNIT`` keyword in the header on saving,\nand is read from the header if it is present.\n\nDetailed help on the available keyword arguments for reading and writing\ncan be obtained via the ``help()`` method as follows:\n\n.. doctest-skip::\n\n    >>> CCDData.read.help('fits')  # Get help on the CCDData FITS reader\n    >>> CCDData.writer.help('fits')  # Get help on the CCDData FITS writer\n\nGetting Started with Table I/O\n==============================\n\nThe :class:`~astropy.table.Table` class includes two methods,\n:meth:`~astropy.table.Table.read` and\n:meth:`~astropy.table.Table.write`, that make it possible to read from\nand write to files. A number of formats are automatically supported (see\n`Built-in table readers/writers`_) and new file formats and extensions can be\nregistered with the :class:`~astropy.table.Table` class (see\n:ref:`io_registry`).\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Reading a DAOPhot Table\n\nTo use this interface, first import the :class:`~astropy.table.Table` class,\nthen call the :class:`~astropy.table.Table`\n:meth:`~astropy.table.Table.read` method with the name of the file and\nthe file format, for instance ``'ascii.daophot'``:\n\n.. doctest-skip::\n\n    >>> from astropy.table import Table\n    >>> t = Table.read('photometry.dat', format='ascii.daophot')\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Reading a Table Directly from the Internet\n\nIt is possible to load tables directly from the Internet using URLs. For\nexample, download tables from Vizier catalogues in CDS format\n(``'ascii.cds'``)::\n\n    >>> t = Table.read(\"ftp://cdsarc.u-strasbg.fr/pub/cats/VII/253/snrs.dat\",\n    ...         readme=\"ftp://cdsarc.u-strasbg.fr/pub/cats/VII/253/ReadMe\",\n    ...         format=\"ascii.cds\")  # doctest: +SKIP\n\nFor certain file formats the format can be automatically detected, for\nexample, from the filename extension::\n\n    >>> t = Table.read('table.tex')  # doctest: +SKIP\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Writing a LaTeX Table\n\nFor writing a table, the format can be explicitly specified::\n\n    >>> t.write(filename, format='latex')  # doctest: +SKIP\n\nAs for the :meth:`~astropy.table.Table.read` method, the format may\nbe automatically identified in some cases.\n\nThe underlying file handler will also automatically detect various\ncompressed data formats and transparently uncompress them as far as\nsupported by the Python installation (see\n:meth:`~astropy.utils.data.get_readable_fileobj`).\n\nFor writing, you can also specify details about the `Table serialization\nmethods`_ via the ``serialize_method`` keyword argument. This allows\nfine control of the way to write out certain columns, for instance\nwriting an ISO format Time column as a pair of JD1/JD2 floating\npoint values (for full resolution) or as a formatted ISO date string.\n\n..\n  EXAMPLE END\n\nGetting Help on Readers and Writers\n-----------------------------------\n\nEach file format is handled by a specific reader or writer, and each of those\nfunctions will have its own set of arguments. For examples of\nthis see the section `Built-in table readers/writers`_. This section also\nprovides the full list of choices for the ``format`` argument.\n\nTo get help on the available arguments for each format, use the ``help()``\nmethod of the `~astropy.table.Table.read` or `~astropy.table.Table.write`\nmethods. Each of these calls prints a long help document which is divided\ninto two sections, the generic read/write documentation (common to any\ncall) and the format-specific documentation. For ASCII tables, the\nformat-specific documentation includes the generic `astropy.io.ascii` package\ninterface and then a description of the particular ASCII sub-format.\n\nIn the examples below we do not show the long output:\n\n.. doctest-skip::\n\n    >>> Table.read.help('fits')\n    >>> Table.read.help('ascii')\n    >>> Table.read.help('ascii.latex')\n    >>> Table.write.help('hdf5')\n    >>> Table.write.help('csv')\n\nCommand-Line Utility\n--------------------\n\nFor convenience, the command-line tool ``showtable`` can be used to print the\ncontent of tables for the formats supported by the unified I/O interface.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Viewing the Contents of a Table on the Command Line\n\nTo view the contents of a table on the command line::\n\n    $ showtable astropy/io/fits/tests/data/table.fits\n\n     target V_mag\n    ------- -----\n    NGC1001  11.1\n    NGC1002  12.3\n    NGC1003  15.2\n\nTo get full documentation on the usage and available options, do ``showtable\n--help``.\n\n..\n  EXAMPLE END\n\n.. _built_in_readers_writers:\n\nBuilt-In Table Readers/Writers\n==============================\n\nThe :class:`~astropy.table.Table` class has built-in support for various input\nand output formats including :ref:`table_io_ascii`,\n-:ref:`table_io_fits`, :ref:`table_io_hdf5`, :ref:`table_io_pandas`,\n:ref:`table_io_parquet`, and :ref:`table_io_votable`.\n\nA full list of the supported formats and corresponding classes is shown in the\ntable below. The ``Write`` column indicates those formats that support write\nfunctionality, and the ``Suffix`` column indicates the filename suffix\nindicating a particular format. If the value of ``Suffix`` is ``auto``, the\nformat is auto-detected from the file itself. Not all formats support auto-\ndetection.\n\n===========================  =====  ======  ============================================================================================\n           Format            Write  Suffix                                          Description\n===========================  =====  ======  ============================================================================================\n                      ascii    Yes          ASCII table in any supported format (uses guessing)\n               ascii.aastex    Yes          :class:`~astropy.io.ascii.AASTex`: AASTeX deluxetable used for AAS journals\n                ascii.basic    Yes          :class:`~astropy.io.ascii.Basic`: Basic table with custom delimiters\n                  ascii.cds     No          :class:`~astropy.io.ascii.Cds`: CDS format table\n     ascii.commented_header    Yes          :class:`~astropy.io.ascii.CommentedHeader`: Column names in a commented line\n                  ascii.csv    Yes    .csv  :class:`~astropy.io.ascii.Csv`: Basic table with comma-separated values\n              ascii.daophot     No          :class:`~astropy.io.ascii.Daophot`: IRAF DAOphot format table\n                 ascii.ecsv    Yes   .ecsv  :class:`~astropy.io.ascii.Ecsv`: Basic table with Enhanced CSV (supporting metadata)\n          ascii.fixed_width    Yes          :class:`~astropy.io.ascii.FixedWidth`: Fixed width\nascii.fixed_width_no_header    Yes          :class:`~astropy.io.ascii.FixedWidthNoHeader`: Fixed width with no header\n ascii.fixed_width_two_line    Yes          :class:`~astropy.io.ascii.FixedWidthTwoLine`: Fixed width with second header line\n                 ascii.html    Yes   .html  :class:`~astropy.io.ascii.HTML`: HTML table\n                 ascii.ipac    Yes          :class:`~astropy.io.ascii.Ipac`: IPAC format table\n                ascii.latex    Yes    .tex  :class:`~astropy.io.ascii.Latex`: LaTeX table\n                  ascii.mrt    Yes          :class:`~astropy.io.ascii.Mrt`: AAS Machine-Readable Table format\n            ascii.no_header    Yes          :class:`~astropy.io.ascii.NoHeader`: Basic table with no headers\n                  ascii.qdp    Yes    .qdp   :class:`~astropy.io.ascii.QDP`: Quick and Dandy Plotter files\n                  ascii.rdb    Yes    .rdb  :class:`~astropy.io.ascii.Rdb`: Tab-separated with a type definition header line\n                  ascii.rst    Yes    .rst  :class:`~astropy.io.ascii.RST`: reStructuredText simple format table\n           ascii.sextractor     No          :class:`~astropy.io.ascii.SExtractor`: SExtractor format table\n                  ascii.tab    Yes          :class:`~astropy.io.ascii.Tab`: Basic table with tab-separated values\n                       fits    Yes    auto  :mod:`~astropy.io.fits`: Flexible Image Transport System file\n                       hdf5    Yes    auto  HDF5_: Hierarchical Data Format binary file\n                    parquet    Yes    auto  Parquet_: Apache Parquet binary file\n                 pandas.csv    Yes          Wrapper around ``pandas.read_csv()`` and ``pandas.to_csv()``\n                 pandas.fwf     No          Wrapper around ``pandas.read_fwf()`` (fixed width format)\n                pandas.html    Yes          Wrapper around ``pandas.read_html()`` and ``pandas.to_html()``\n                pandas.json    Yes          Wrapper around ``pandas.read_json()`` and ``pandas.to_json()``\n                    votable    Yes    auto  :mod:`~astropy.io.votable`: Table format used by Virtual Observatory (VO) initiative\n===========================  =====  ======  ============================================================================================\n\n.. _table_io_ascii:\n\nASCII Formats\n-------------\n\nThe :meth:`~astropy.table.Table.read` and\n:meth:`~astropy.table.Table.write` methods can be used to read and write formats\nsupported by `astropy.io.ascii`.\n\nUse ``format='ascii'`` in order to interface to the generic\n:func:`~astropy.io.ascii.read` and :func:`~astropy.io.ascii.write`\nfunctions from `astropy.io.ascii`. When reading a table, this means\nthat all supported ASCII table formats will be tried in order to successfully\nparse the input.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Reading and Writing ASCII Formats\n\nTo read and write formats supported by `astropy.io.ascii`:\n\n.. doctest-skip::\n\n  >>> t = Table.read('astropy/io/ascii/tests/t/latex1.tex', format='ascii')\n  >>> print(t)\n  cola colb colc\n  ---- ---- ----\n     a    1    2\n     b    3    4\n\nWhen writing a table with ``format='ascii'`` the output is a basic\ncharacter-delimited file with a single header line containing the\ncolumn names.\n\nAll additional arguments are passed to the `astropy.io.ascii`\n:func:`~astropy.io.ascii.read` and :func:`~astropy.io.ascii.write`\nfunctions. Further details are available in the sections on\n:ref:`io_ascii_read_parameters` and :ref:`io_ascii_write_parameters`. For\nexample, to change the column delimiter and the output format for the ``colc``\ncolumn use:\n\n.. doctest-skip::\n\n  >>> t.write(sys.stdout, format='ascii', delimiter='|', formats={'colc': '%0.2f'})\n  cola|colb|colc\n  a|1|2.00\n  b|3|4.00\n\n\n.. note::\n\n   When specifying an ASCII table format using the unified interface, the\n   format name is prefixed with ``ascii`` in order to identify the format as\n   ASCII-based. Compare the table above to the `astropy.io.ascii` list of\n   :ref:`supported formats <supported_formats>` where the prefix is not\n   needed. Therefore the following are equivalent:\n\n.. doctest-skip::\n\n     >>> dat = ascii.read('file.dat', format='daophot')\n     >>> dat = Table.read('file.dat', format='ascii.daophot')\n\n.. attention:: **ECSV is recommended**\n\n   For writing and reading tables to ASCII in a way that fully reproduces the\n   table data, types, and metadata (i.e., the table will \"round-trip\"), we\n   highly recommend using the :ref:`ecsv_format`. This writes the actual data\n   in a space-delimited format (the ``basic`` format) that any ASCII table\n   reader can parse, but also includes metadata encoded in a comment block that\n   allows full reconstruction of the original columns. This includes support\n   for :ref:`ecsv_format_mixin_columns` (such as\n   `~astropy.coordinates.SkyCoord` or `~astropy.time.Time`) and\n   :ref:`ecsv_format_masked_columns`.\n\n..\n  EXAMPLE END\n\n.. _table_io_fits:\n\nFITS\n----\n\nReading and writing tables in `FITS <https://fits.gsfc.nasa.gov/>`_ format is\nsupported with ``format='fits'``. In most cases, existing FITS files should be\nautomatically identified as such based on the header of the file, but if not,\nor if writing to disk, then the format should be explicitly specified.\n\nReading\n^^^^^^^\n\nIf a FITS table file contains only a single table, then it can be read in\nwith:\n\n.. doctest-skip::\n\n    >>> from astropy.table import Table\n    >>> t = Table.read('data.fits')\n\nIf more than one table is present in the file, you can select the HDU\nas follows::\n\n    >>> t = Table.read('data.fits', hdu=3)  # doctest: +SKIP\n\nIn this case if the ``hdu`` argument is omitted, then the first table found\nwill be read in and a warning will be emitted::\n\n    >>> t = Table.read('data.fits')  # doctest: +SKIP\n    WARNING: hdu= was not specified but multiple tables are present, reading in first available table (hdu=1) [astropy.io.fits.connect]\n\nYou can also read a table from the HDUs of an in-memory FITS file. This will\nround-trip any :ref:`mixin_columns` that were written to that HDU, using the\nheader information to reconstruct them::\n\n    >>> hdulist = astropy.io.fits.open('data.fits') # doctest: +SKIP\n    >>> t = Table.read(hdulist[1])  # doctest: +SKIP\n\nWriting\n^^^^^^^\n\nTo write a table ``t`` to a new file::\n\n    >>> t.write('new_table.fits')  # doctest: +SKIP\n\nIf the file already exists and you want to overwrite it, then set the\n``overwrite`` keyword::\n\n    >>> t.write('existing_table.fits', overwrite=True)  # doctest: +SKIP\n\nIf you want to append a table to an existing file, set the ``append``\nkeyword::\n\n    >>> t.write('existing_table.fits', append=True)  # doctest: +SKIP\n\nAlternatively, you can use the convenience function\n:func:`~astropy.io.fits.table_to_hdu` to create a single\nbinary table HDU and insert or append that to an existing\n:class:`~astropy.io.fits.HDUList`.\n\nThere is support for writing a table which contains :ref:`mixin_columns` such\nas `~astropy.time.Time` or `~astropy.coordinates.SkyCoord`. This uses FITS\n``COMMENT`` cards to capture additional information needed order to fully\nreconstruct the mixin columns when reading back from FITS. The information is a\nPython `dict` structure which is serialized using YAML.\n\nKeywords\n^^^^^^^^\n\nThe FITS keywords associated with an HDU table are represented in the ``meta``\nordered dictionary attribute of a :ref:`Table <astropy-table>`. After reading\na table you can view the available keywords in a readable format using:\n\n.. doctest-skip::\n\n  >>> for key, value in t.meta.items():\n  ...     print(f'{key} = {value}')\n\nThis does not include the \"internal\" FITS keywords that are required to specify\nthe FITS table properties (e.g., ``NAXIS``, ``TTYPE1``). ``HISTORY`` and\n``COMMENT`` keywords are treated specially and are returned as a list of\nvalues.\n\nConversely, the following shows examples of setting user keyword values for a\ntable ``t``:\n\n.. doctest-skip::\n\n  >>> t.meta['MY_KEYWD'] = 'my value'\n  >>> t.meta['COMMENT'] = ['First comment', 'Second comment', 'etc']\n  >>> t.write('my_table.fits', overwrite=True)\n\nThe keyword names (e.g., ``MY_KEYWD``) will be automatically capitalized prior\nto writing.\n\nAt this time, the ``meta`` attribute of the :class:`~astropy.table.Table` class\nis an ordered dictionary and does not fully represent the structure of a\nFITS header (for example, keyword comments are dropped).\n\n.. _fits_astropy_native:\n\n\nTDISPn Keyword\n^^^^^^^^^^^^^^\n\nTDISPn FITS keywords will map to and from the `~astropy.table.Column` ``format``\nattribute if the display format is convertible to and from a Python display\nformat. Below are the rules used for both conversion directions.\n\nTDISPn to Python format string\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nTDISPn format characters are defined in the table below.\n\n============   ================================================================\n   Format                              Description\n============   ================================================================\nAw             Character\nLw             Logical\nIw.m           Integer\nBw.m           Binary, integers only\nOw.m           Octal, integers only\nZw.m           Hexadecimal, integers only\nFw.d           Floating-point, fixed decimal notation\nEw.dEe         Floating-point, exponential notation\nENw.d          Engineering; E format with exponent multiple of three\nESw.d          Scientific; same as EN but non-zero leading digit if not zero\nGw.dEe         General; appears as F if significance not lost, also E\nDw.dEe         Floating-point, exponential notation, double precision\n============   ================================================================\n\nWhere w is the width in characters of displayed values, m is the minimum number\nof digits displayed, d is the number of digits to the right of decimal, and e\nis the number of digits in the exponent. The .m and Ee fields are optional.\n\nThe A (character), L (logical), F (floating point), and G (general) display\nformats can be directly translated to Python format strings. The other formats\nneed to be modified to match Python display formats.\n\nFor the integer formats (I, B, O, and Z), the width (w) value is used to add\nspace padding to the left of the column value. The minimum number (m) value is\nnot used. For the E, G, D, EN, and ES formats (floating point exponential) the\nwidth (w) and precision (d) are both used, but the exponential (e) is not used.\n\nPython format string to TDISPn\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe conversion from Python format strings back to TDISPn is slightly more\ncomplicated.\n\nPython strings map to the TDISP format A if the Python formatting string does\nnot contain right space padding. It will accept left space padding. The same\napplies to the logical format L.\n\nThe integer formats (decimal integer, binary, octal, hexadecimal) map to the\nI, B, O, and Z TDISP formats respectively. Integer formats do not accept a\nzero padded format string or a format string with no left padding defined (a\nwidth is required in the TDISP format standard for the Integer formats).\n\nFor all float and exponential values, zero padding is not accepted. There\nmust be at least a width or precision defined. If only a width is defined,\nthere is no precision set for the TDISPn format. If only a precision is\ndefined, the width is set to the precision plus an extra padding value\ndepending on format type, and both are set in the TDISPn format. Otherwise,\nif both a width and precision are present they are both set in the TDISPn\nformat. A Python ``f`` or ``F`` map to TDISP F format. The Python ``g`` or\n``G`` map to TDISP G format. The Python ``e`` and ``E`` map to TDISP E format.\n\nMasked Columns\n^^^^^^^^^^^^^^\n\nTables that contain `~astropy.table.MaskedColumn` columns can be written to\nFITS. By default this will replace the masked data elements with certain\nsentinel values according to the FITS standard:\n\n- ``NaN`` for float columns.\n- Value of ``TNULLn`` for integer columns, as defined by the column\n  ``fill_value`` attribute.\n- Null string for string columns (not currently implemented).\n\nWhen the file is read back those elements are marked as masked in the returned\ntable, but see `issue #4708 <https://github.com/astropy/astropy/issues/4708>`_\nfor problems in all three cases.\n\nThe FITS standard has a few limitations:\n\n- Not all data types are supported (e.g., logical / boolean).\n- Integer columns require picking one value as the NULL indicator. If\n  all possible values are represented in valid data (e.g., an unsigned\n  int columns with all 256 possible values in valid data), then there\n  is no way to represent missing data.\n- The masked data values are permanently lost, precluding the possibility\n  of later unmasking the values.\n\n``astropy`` provides a work-around for this limitation that users can choose to\nuse. The key part is to use the ``serialize_method='data_mask'`` keyword\nargument when writing the table. This tells the FITS writer to split each masked\ncolumn into two separate columns, one for the data and one for the mask.\nWhen it gets read back that process is reversed and the two columns are\nmerged back into one masked column.\n\n.. doctest-skip::\n\n  >>> from astropy.table.table_helpers import simple_table\n  >>> t = simple_table(masked=True)\n  >>> t['d'] = [False, False, True]\n  >>> t['d'].mask = [True, False, False]\n  >>> t\n  <Table masked=True length=3>\n    a      b     c     d\n  int64 float64 str1  bool\n  ----- ------- ---- -----\n     --     1.0    c    --\n      2     2.0   -- False\n      3      --    e  True\n\n.. doctest-skip::\n\n  >>> t.write('data.fits', serialize_method='data_mask', overwrite=True)\n  >>> Table.read('data.fits')\n  <Table masked=True length=3>\n    a      b      c      d\n  int64 float64 bytes1  bool\n  ----- ------- ------ -----\n     --     1.0      c    --\n      2     2.0     -- False\n      3      --      e  True\n\n.. warning:: This option goes outside of the established FITS standard for\n   representing missing data, so users should be careful about choosing this\n   option, especially if other (non-``astropy``) users will be reading the\n   file(s). Behind the scenes, ``astropy`` is converting the masked columns\n   into two distinct data and mask columns, then writing metadata into\n   ``COMMENT`` cards to allow reconstruction of the original data.\n\n``astropy`` Native Objects (Mixin Columns)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nIt is possible to store not only standard `~astropy.table.Column` objects to a\nFITS table HDU, but also any ``astropy`` native objects\n(:ref:`mixin_columns`) within a `~astropy.table.Table` or\n`~astropy.table.QTable`. This includes `~astropy.time.Time`,\n`~astropy.units.Quantity`, `~astropy.coordinates.SkyCoord`, and many others.\n\nIn general, a mixin column may contain multiple data components as well as\nobject attributes beyond the standard Column attributes like ``format`` or\n``description``. Abiding by the rules set by the FITS standard requires the\nmapping of these data components and object attributes to the appropriate FITS\ntable columns and keywords. Thus, a well defined protocol has been developed\nto allow the storage of these mixin columns in FITS while allowing the object to\n\"round-trip\" through the file with no loss of data or attributes.\n\nQuantity\n~~~~~~~~\n\nA `~astropy.units.Quantity` mixin column in a `~astropy.table.QTable` is\nrepresented in a FITS table using the ``TUNITn`` FITS column keyword to\nincorporate the unit attribute of Quantity. For example:\n\n.. doctest-skip::\n\n    >>> from astropy.table import QTable\n    >>> import astropy.units as u\n    >>> t = QTable([[1, 2] * u.angstrom)])\n    >>> t.write('my_table.fits', overwrite=True)\n    >>> qt = QTable.read('my_table.fits')\n    >>> qt\n    <QTable length=2>\n      col0\n    Angstrom\n    float64\n    --------\n         1.0\n         2.0\n\nTime\n~~~~\n\n``astropy`` provides the following features for reading and writing ``Time``:\n\n- Writing and reading `~astropy.time.Time` Table columns to and from FITS\n  tables.\n- Reading time coordinate columns in FITS tables (compliant with the time\n  standard) as `~astropy.time.Time` Table columns.\n\nWriting and reading ``astropy`` Time columns\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nBy default, a `~astropy.time.Time` mixin column within a `~astropy.table.Table`\nor `~astropy.table.QTable` will be written to FITS in full precision. This will\nbe done using the FITS time standard by setting the necessary FITS header\nkeywords.\n\nThe default behavior for reading a FITS table into a `~astropy.table.Table`\nhas historically been to convert all FITS columns to `~astropy.table.Column`\nobjects, which have closely matching properties. For some columns, however,\ncloser native ``astropy`` representations are possible, and you can indicate\nthese should be used by passing ``astropy_native=True`` (for backwards\ncompatibility, this is not done by default). This will convert columns\nconforming to the FITS time standard to `~astropy.time.Time` instances,\navoiding any loss of precision.\n\nExample\n~~~~~~~\n\n..\n  EXAMPLE START\n  Writing and Reading Time Columns to/from FITS Tables\n\nTo read a FITS table into `~astropy.table.Table`:\n\n.. doctest-skip::\n\n    >>> from astropy.time import Time\n    >>> from astropy.table import Table\n    >>> from astropy.coordinates import EarthLocation\n    >>> t = Table()\n    >>> t['a'] = Time([100.0, 200.0], scale='tt', format='mjd',\n    ...               location=EarthLocation(-2446354, 4237210, 4077985, unit='m'))\n    >>> t.write('my_table.fits', overwrite=True)\n    >>> tm = Table.read('my_table.fits', astropy_native=True)\n    >>> tm['a']\n    <Time object: scale='tt' format='jd' value=[ 2400100.5  2400200.5]>\n    >>> tm['a'].location\n    <EarthLocation (-2446354.,  4237210.,  4077985.) m>\n    >>> all(tm['a'] == t['a'])\n    True\n\nThe same will work with ``QTable``.\n\n..\n  EXAMPLE END\n\nIn addition to binary table columns, various global time informational FITS\nkeywords are treated specially with ``astropy_native=True``. In particular,\nthe keywords ``DATE``, ``DATE-*`` (ISO 8601 datetime strings), and the ``MJD-*``\n(MJD date values) will be returned as ``Time`` objects in the Table ``meta``.\nFor more details regarding the FITS time paper and the implementation,\nrefer to :ref:`fits_time_column`.\n\nSince not all FITS readers are able to use the FITS time standard, it is also\npossible to store `~astropy.time.Time` instances using the `_time_format`.\nFor this case, none of the special header keywords associated with the\nFITS time standard will be set. When reading this back into ``astropy``, the\ncolumn will be an ordinary Column instead of a `~astropy.time.Time` object.\nSee the `Details`_ section below for an example.\n\nReading FITS standard compliant time coordinate columns in binary tables\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nReading FITS files which are compliant with the FITS time standard is supported\nby ``astropy`` by following the multifarious rules and conventions set by the\nstandard. The standard was devised in order to describe time coordinates in\nan unambiguous and comprehensive manner and also to provide flexibility for its\nmultiple use cases. Thus, while reading time coordinate columns in FITS-\ncompliant files, multiple aspects of the standard are taken into consideration.\n\nTime coordinate columns strictly compliant with the two-vector JD subset of the\nstandard (described in the `Details`_ section below) can be read as native\n`~astropy.time.Time` objects. The other subsets of the standard are also\nsupported by ``astropy``; a thorough examination of the FITS standard time-\nrelated keywords is done and the time data is interpreted accordingly.\n\nThe standard describes the various components in the specification of time:\n\n- Time coordinate frame\n- Time unit\n- Corrections, errors, etc.\n- Durations\n\nThe keywords used to specify times define these components. Using these\nkeywords, time coordinate columns are identified and read as\n`~astropy.time.Time` objects. Refer to :ref:`fits_time_column` for the\nspecification of these keywords and their description.\n\nThere are two aspects of the standard that require special attention due to the\nsubtleties involved while handling them. These are:\n\n* Column named TIME with time unit\n\nA common convention found in existing FITS files is that a FITS binary\ntable column with ``TTYPEn = ‘TIME’`` represents a time coordinate column.\nMany astronomical data files, including official data products from major\nobservatories, follow this convention that predates the FITS standard.\nThe FITS time standard states that such a column will be controlled by\nthe global time reference frame keywords, and this will still be compliant\nwith the present standard.\n\nUsing this convention which has been incorporated into the standard, ``astropy``\ncan read time coordinate columns from all such FITS tables as native\n`~astropy.time.Time` objects. Common examples of FITS files following\nthis convention are Chandra, XMM, and HST files.\n\nExamples\n~~~~~~~~\n\n..\n  EXAMPLE START\n  Reading FITS Standard Compliant Time Coordinate Columns in Binary Tables\n\nThe following is an example of a Header extract of a Chandra event list:\n\n.. parsed-literal::\n\n    COMMENT      ---------- Globally valid key words ----------------\n    DATE    = '2016-01-27T12:34:24' / Date and time of file creation\n    TIMESYS = 'TT      '           / Time system\n    MJDREF  =  5.0814000000000E+04 / [d] MJD zero point for times\n    TIMEUNIT= 's       '           / Time unit\n    TIMEREF = 'LOCAL   '           / Time reference (barycenter/local)\n\n    COMMENT      ---------- Time Column -----------------------\n    TTYPE1  = 'time    '           / S/C TT corresponding to mid-exposure\n    TFORM1  = '1D      '           / format of field\n    TUNIT1  = 's       '\n\nWhen reading such a FITS table with ``astropy_native=True``, ``astropy`` checks\nwhether the name of a column is \"TIME\"/ \"time\" (``TTYPEn = ‘TIME’``) and\nwhether its unit is a FITS recognized time unit (``TUNITn`` is a time unit).\n\nFor example, reading a Chandra event list which has the above mentioned header\nand the time coordinate column ``time`` as ``[1, 2]`` will give::\n\n    >>> from astropy.table import Table\n    >>> from astropy.time import Time, TimeDelta\n    >>> from astropy.utils.data import get_pkg_data_filename\n    >>> chandra_events = get_pkg_data_filename('data/chandra_time.fits',\n    ...                                        package='astropy.io.fits.tests')\n    >>> native = Table.read(chandra_events, astropy_native=True)  # doctest: +IGNORE_WARNINGS\n    >>> native['time']  # doctest: +FLOAT_CMP\n    <Time object: scale='tt' format='mjd' value=[57413.76033393 57413.76033393]>\n    >>> non_native = Table.read(chandra_events)\n    >>> # MJDREF  =  5.0814000000000E+04, TIMESYS = 'TT'\n    >>> ref_time = Time(non_native.meta['MJDREF'], format='mjd',\n    ...                 scale=non_native.meta['TIMESYS'].lower())\n    >>> # TTYPE1  = 'time', TUNIT1 = 's'\n    >>> delta_time = TimeDelta(non_native['time'])\n    >>> all(ref_time + delta_time == native['time'])\n    True\n\nBy default, FITS table columns will be read as standard `~astropy.table.Column`\nobjects without taking the FITS time standard into consideration.\n\n..\n  EXAMPLE END\n\n* String time column in ISO 8601 Datetime format\n\nFITS uses a subset of ISO 8601 (which in itself does not imply a particular\ntimescale) for several time-related keywords, such as DATE-xxx. Following the\nFITS standard, its values must be written as a character string in the\nfollowing ``datetime`` format:\n\n.. parsed-literal::\n\n    [+/-C]CCYY-MM-DD[Thh:mm:ss[.s...]]\n\nA time coordinate column can be constructed using this representation of time.\nThe following is an example of an ISO 8601 ``datetime`` format time column:\n\n.. parsed-literal::\n\n    TIME\n    ----\n    1999-01-01T00:00:00\n    1999-01-01T00:00:40\n    1999-01-01T00:01:06\n    .\n    .\n    .\n    1999-01-20T01:10:00\n\nThe criteria for identifying a time coordinate column in ISO 8601 format is as\nfollows:\n\nA time column is identified using the time coordinate frame keywords as\ndescribed in :ref:`fits_time_column`. Once it has been identified, its datatype\nis checked in order to determine its representation format. Since ISO 8601\n``datetime`` format is the only string representation of time, a time\ncoordinate column having string datatype will be automatically read as a\n`~astropy.time.Time` object with ``format='fits'`` ('fits' represents the FITS\nISO 8601 format).\n\nAs this format does not imply a particular timescale, it is determined using\nthe timescale keywords in the header (``TCTYP`` or ``TIMESYS``) or their\ndefaults. The other time coordinate information is also determined in the same\nway, using the time coordinate frame keywords. All ISO 8601 times are relative\nto a globally accepted zero point (year 0 corresponds to 1 BCE) and are thus\nnot relative to the reference time keywords (MJDREF, JDREF, or DATEREF).\nHence, these keywords will be ignored while dealing with ISO 8601 time columns.\n\n.. note::\n\n   Reading FITS files with time coordinate columns *may* fail. ``astropy``\n   supports a large subset of these files, but there are still some FITS files\n   which are not compliant with any aspect of the standard. If you have such a\n   file, please do not hesitate to let us know (by opening an issue in the\n   `issue tracker <https://github.com/astropy/astropy/issues>`_).\n\n   Also, reading a column having ``TTYPEn = ‘TIME’`` as `~astropy.time.Time`\n   will fail if ``TUNITn`` for the column is not a FITS-recognized time unit.\n\nDetails\n~~~~~~~\n\nTime as a dimension in astronomical data presents challenges in its\nrepresentation in FITS files. The standard has therefore been extended to\ndescribe rigorously the time coordinate in the ``World Coordinate System``\nframework. Refer to `FITS WCS paper IV\n<https://ui.adsabs.harvard.edu/abs/2015A%26A...574A..36R/>`_ for details.\n\nAllowing ``Time`` columns to be written as time coordinate\ncolumns in FITS tables thus involves storing time values in a way that\nensures retention of precision and mapping the associated metadata to the\nrelevant FITS keywords.\n\nIn accordance with the standard, which states that in binary tables one may use\npairs of doubles, the ``astropy`` Time column is written in such a table as a\nvector of two doubles ``(TFORMn = ‘2D’) (jd1, jd2)`` where ``JD = jd1 + jd2``.\nThis reproduces the time values to double-double precision and is the\n\"lossless\" version, exploiting the higher precision provided in binary tables.\nNote that ``jd1`` is always a half-integer or integer, while ``abs(jd2) < 1``.\n\"Round-tripping\" of ``astropy``-written FITS binary tables containing time\ncoordinate columns has been partially achieved by mapping selected metadata,\n``scale`` and singular ``location`` of `~astropy.time.Time`, to corresponding\nkeywords. Note that the arbitrary metadata allowed in `~astropy.table.Table`\nobjects within the ``meta`` dict is not written and will be lost.\n\nExamples\n~~~~~~~~\n\n..\n  EXAMPLE START\n  Time Columns in FITS Files\n\nConsider the following Time column:\n\n    >>> t['a'] = Time([100.0, 200.0], scale='tt', format='mjd')  # doctest: +SKIP\n\nThe FITS standard requires an additional translation layer back into\nthe desired format. The Time column ``t['a']`` will undergo the translation\n``Astropy Time --> FITS --> Astropy Time`` which corresponds to the format\nconversion ``mjd --> (jd1, jd2) --> jd``. Thus, the final conversion from\n``(jd1, jd2)`` will require a software implementation which is fully compliant\nwith the FITS time standard.\n\nTaking this into consideration, the functionality to read/write Time\nfrom/to FITS can be explicitly turned off, by opting to store the time\nrepresentation values in the format specified by the ``format`` attribute\nof the `~astropy.time.Time` column, instead of the ``(jd1, jd2)`` format, with\nno extra metadata in the header. This is the \"lossy\" version, but can help\nwith portability. For the above example, the FITS column corresponding\nto ``t['a']`` will then store ``[100.0 200.0]`` instead of\n``[[ 2400100.5, 0. ], [ 2400200.5, 0. ]]``. This is done by setting the\n`Table serialization methods`_ for Time columns when writing, as in the\nfollowing example:\n\n.. doctest-skip::\n\n    >>> from astropy.time import Time\n    >>> from astropy.table import Table\n    >>> from astropy.coordinates import EarthLocation\n    >>> t = Table()\n    >>> t['a'] = Time([100.0, 200.0], scale='tt', format='mjd')\n    >>> t.write('my_table.fits', overwrite=True,\n    ...         serialize_method={Time: 'formatted_value'})\n    >>> tm = Table.read('my_table.fits')\n    >>> tm['a']\n    <Column name='a' dtype='float64' length=2>\n    100.0\n    200.0\n    >>> all(tm['a'] == t['a'].value)\n    True\n\nBy default, ``serialize_method`` for Time columns is equal to\n``'jd1_jd2'``, that is, Time columns will be written in full precision.\n\n.. note::\n\n   The ``astropy`` `~astropy.time.Time` object does not precisely map to the\n   FITS time standard.\n\n   * FORMAT\n\n     The FITS format considers only three formats: ISO 8601, JD, and MJD.\n     ``astropy`` Time allows for many other formats like ``unix`` or ``cxcsec``\n     for representing the values.\n\n     Hence, the ``format`` attribute of Time is not stored. After reading from\n     FITS the user must set the ``format`` as desired.\n\n   * LOCATION\n\n     In the FITS standard, the reference position for a time coordinate is a\n     scalar expressed via keywords. However, vectorized reference position or\n     location can be supported by the `Green Bank Keyword Convention\n     <https://fits.gsfc.nasa.gov/registry/greenbank.html>`_ which is a\n     Registered FITS Convention. In ``astropy`` Time, location can be an array\n     which is broadcastable to the Time values.\n\n     Hence, vectorized ``location`` attribute of Time is stored and read\n     following this convention.\n\n..\n  EXAMPLE END\n\n.. doctest-skip-all\n\n.. _table_io_hdf5:\n\nHDF5\n----\n\n.. _HDF5: https://www.hdfgroup.org/HDF5/\n.. _h5py: http://www.h5py.org/\n\nReading/writing from/to HDF5_ files is supported with ``format='hdf5'`` (this\nrequires h5py_ to be installed). However, the ``.hdf5`` file extension is\nautomatically recognized when writing files, and HDF5 files are automatically\nidentified (even with a different extension) when reading in (using the first\nfew bytes of the file to identify the format), so in most cases you will not\nneed to explicitly specify ``format='hdf5'``.\n\nSince HDF5 files can contain multiple tables, the full path to the table\nshould be specified via the ``path=`` argument when reading and writing.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Reading from and Writing to HDF5 Files\n\nTo read a table called ``data`` from an HDF5 file named ``observations.hdf5``,\nyou can do::\n\n    >>> t = Table.read('observations.hdf5', path='data')\n\nTo read a table nested in a group in the HDF5 file, you can do::\n\n    >>> t = Table.read('observations.hdf5', path='group/data')\n\nTo write a table to a new file, the path should also be specified::\n\n    >>> t.write('new_file.hdf5', path='updated_data')\n\nIt is also possible to write a table to an existing file using ``append=True``::\n\n    >>> t.write('observations.hdf5', path='updated_data', append=True)\n\nAs with other formats, the ``overwrite=True`` argument is supported for\noverwriting existing files. To overwrite only a single table within an HDF5\nfile that has multiple datasets, use *both* the ``overwrite=True`` and\n``append=True`` arguments.\n\nFinally, when writing to HDF5 files, the ``compression=`` argument can be\nused to ensure that the data is compressed on disk::\n\n    >>> t.write('new_file.hdf5', path='updated_data', compression=True)\n\n..\n  EXAMPLE END\n\n.. doctest-skip-all\n\n.. _table_io_parquet:\n\nParquet\n-------\n\n.. _Parquet: https://parquet.apache.org/\n.. _pyarrow: https://arrow.apache.org/docs/python/\n\nReading and writing Parquet_ files is supported with ``format='parquet'``\nif the pyarrow_ package is installed. For writing, the file extensions ``.parquet`` or\n``.parq`` will automatically imply the ``'parquet'`` format. For reading,\nParquet files are automatically identified regardless of the extension\nif the first four bytes of the file are ``b'PAR1'``.\nIn many cases you do not need to explicitly specify ``format='parquet'``,\nbut it may be a good idea anyway if there is any ambiguity about the\nfile format.\n\nMultiple-file Parquet datasets are not supported for reading and writing.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Reading from and Writing to Parquet Files\n\nTo read a table from a Parquet file named ``observations.parquet``, you can do::\n\n    >>> t = Table.read('observations.parquet')\n\nTo write a table to a new file, simply do::\n\n    >>> t.write('new_file.parquet')\n\nAs with other formats, the ``overwrite=True`` argument is supported for\noverwriting existing files.\n\nOne big advantage of the Parquet files is that each column is stored independently,\nand thus reading a subset of columns is fast and efficient.  To find out which\ncolumns are stored in a table without reading the data, use the ``schema_only=True``\nas shown below. This returns a zero-length table with the appropriate columns::\n\n    >>> schema = Table.read('observations.parquet', schema_only=True)\n\nTo read only a subset of the columns, use the ``include_names`` and/or ``exclude_names`` keywords::\n\n    >>> t_sub = Table.read('observations.parquet', include_names=['mjd', 'airmass'])\n\n..\n  EXAMPLE END\n\nMetadata and Mixin Columns\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n``astropy`` tables can contain metadata, both in the table ``meta`` attribute\n(which is an ordered dictionary of arbitrary key/value pairs), and within the\ncolumns, which each have attributes ``unit``, ``format``, ``description``,\nand ``meta``.\n\nBy default, when writing a table to HDF5 the code will attempt to store each\nkey/value pair within the table ``meta`` as HDF5 attributes of the table\ndataset. This will fail if the values within ``meta`` are not objects that can\nbe stored as HDF5 attributes. In addition, if the table columns being stored\nhave defined values for any of the above-listed column attributes, these\nmetadata will *not* be stored and a warning will be issued.\n\nserialize_meta\n~~~~~~~~~~~~~~\n\nTo enable storing all table and column metadata to the HDF5 file, call\nthe ``write()`` method with ``serialize_meta=True``. This will store metadata\nin a separate HDF5 dataset, contained in the same file, which is named\n``<path>.__table_column_meta__``. Here ``path`` is the argument provided in\nthe call to ``write()``::\n\n    >>> t.write('observations.hdf5', path='data', serialize_meta=True)\n\nThe table metadata are stored as a dataset of strings by serializing the\nmetadata in YAML following the `ECSV header format\n<https://github.com/astropy/astropy-APEs/blob/main/APE6.rst#header-details>`_\ndefinition. Since there are YAML parsers for most common languages, one can\neasily access and use the table metadata if reading the HDF5 in a non-astropy\napplication.\n\nAs of ``astropy`` 3.0, by specifying ``serialize_meta=True`` one can also store\nto HDF5 tables that contain :ref:`mixin_columns` such as `~astropy.time.Time` or\n`~astropy.coordinates.SkyCoord` columns.\n\n.. _table_io_pandas:\n\nPandas\n------\n\n.. _pandas: https://pandas.pydata.org/pandas-docs/stable/index.html\n\n``astropy`` `~astropy.table.Table` supports the ability to read or write tables\nusing some of the `I/O methods <https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html>`_\navailable within pandas_. This interface thus provides convenient wrappers to\nthe following functions / methods:\n\n.. csv-table::\n    :header: \"Format name\", \"Data Description\", \"Reader\", \"Writer\"\n    :widths: 25, 25, 25, 25\n    :delim: ;\n\n    ``pandas.csv``;`CSV <https://en.wikipedia.org/wiki/Comma-separated_values>`__;`read_csv() <https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#io-read-csv-table>`_;`to_csv() <https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#io-store-in-csv>`_\n    ``pandas.json``;`JSON <http://www.json.org/>`__;`read_json() <https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#io-json-reader>`_;`to_json() <https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#io-json-writer>`_\n    ``pandas.html``;`HTML <https://en.wikipedia.org/wiki/HTML>`__;`read_html() <https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#io-read-html>`_;`to_html() <https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#io-html>`_\n    ``pandas.fwf``;Fixed Width;`read_fwf() <https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_fwf.html#pandas.read_fwf>`_;\n\n**Notes**:\n\n- There is no fixed-width writer in pandas_.\n- Reading HTML requires `BeautifulSoup4 <https://pypi.org/project/beautifulsoup4/>`_ and\n  `html5lib <https://pypi.org/project/html5lib/>`_ to be installed.\n\nWhen reading or writing a table, any keyword arguments apart from the\n``format`` and file name are passed through to pandas, for instance:\n\n.. doctest-skip::\n\n  >>> t.write('data.csv', format='pandas.csv', sep=' ', header=False)\n  >>> t2 = Table.read('data.csv', format='pandas.csv', sep=' ', names=['a', 'b', 'c'])\n\n.. _table_io_jsviewer:\n\nJSViewer\n--------\n\nProvides an interactive HTML export of a Table, like the\n:class:`~astropy.io.ascii.HTML` writer but using the DataTables_ library, which\nallow to visualize interactively an HTML table (with columns sorting, search,\nand pagination).\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  JSViewer to Provide an Interactive HTML Export of a Table\n\nTo write a table ``t`` to a new file::\n\n    >>> t.write('new_table.html', format='jsviewer')\n\nSeveral additional parameters can be used:\n\n- *table_id*: the HTML ID of the ``<table>`` tag, defaults to ``'table{id}'``\n  where ``id`` is the ID of the Table object.\n- *max_lines*: maximum number of lines.\n- *table_class*: HTML classes added to the ``<table>`` tag, can be useful to\n  customize the style of the table.\n- *jskwargs*: additional arguments passed to :class:`~astropy.table.JSViewer`.\n- *css*: CSS style, default to ``astropy.table.jsviewer.DEFAULT_CSS``.\n- *htmldict*: additional arguments passed to :class:`~astropy.io.ascii.HTML`.\n\n.. _Datatables: https://www.datatables.net/\n\n..\n  EXAMPLE END\n\n.. _table_io_votable:\n\nVO Tables\n---------\n\nReading/writing from/to `VO table <http://www.ivoa.net/documents/VOTable/>`_\nfiles is supported with ``format='votable'``. In most cases, existing VO\ntables should be automatically identified as such based on the header of the\nfile, but if not, or if writing to disk, then the format should be explicitly\nspecified.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Reading from and Writing to VO Tables\n\nIf a VO table file contains only a single table, then it can be read in with::\n\n    >>> t = Table.read('aj285677t3_votable.xml')\n\nIf more than one table is present in the file, an error will be raised,\nunless the table ID is specified via the ``table_id=`` argument::\n\n    >>> t = Table.read('catalog.xml')\n    Traceback (most recent call last):\n    ...\n    ValueError: Multiple tables found: table id should be set via the table_id= argument. The available tables are twomass, spitzer\n\n    >>> t = Table.read('catalog.xml', table_id='twomass')\n\nTo write to a new file, the ID of the table should also be specified (unless\n``t.meta['ID']`` is defined)::\n\n    >>> t.write('new_catalog.xml', table_id='updated_table', format='votable')\n\nWhen writing, the ``compression=True`` argument can be used to force\ncompression of the data on disk, and the ``overwrite=True`` argument can be\nused to overwrite an existing file.\n\n..\n  EXAMPLE END\n\n.. _table_serialization_methods:\n\nTable Serialization Methods\n===========================\n\n``astropy`` supports fine-grained control of the way to write out (serialize)\nthe columns in a Table. For instance, if you are writing an ISO format\nTime column to an ECSV ASCII table file, you may want to write this as a pair\nof JD1/JD2 floating point values for full resolution (perfect \"round-trip\"),\nor as a formatted ISO date string so that the values are easily readable by\nyour other applications.\n\nThe default method for serialization depends on the format (FITS, ECSV, HDF5).\nFor instance HDF5 is a binary format and so it would make sense to store a Time\nobject as JD1/JD2, while ECSV is a flat ASCII format and commonly you\nwould want to see the date in the same format as the Time object. The defaults\nalso reflect an attempt to minimize compatibility issues between ``astropy``\nversions. For instance, it was possible to write Time columns to ECSV as\nformatted strings in a version prior to the ability to write as JD1/JD2\npairs, so the current default for ECSV is to write as formatted strings.\n\nThe two classes which have configurable serialization methods are\n`~astropy.time.Time` and `~astropy.table.MaskedColumn`. See the sections\non Time `Details`_ and `Masked columns`_, respectively, for additional\ninformation. The defaults for each format are listed below:\n\n====== ==================== ===============\nFormat    Time                MaskedColumn\n====== ==================== ===============\nFITS    ``jd1_jd2``          ``null_value``\nECSV    ``formatted_value``  ``null_value``\nHDF5    ``jd1_jd2``          ``data_mask``\nYAML    ``jd2_jd2``            ---\n====== ==================== ===============\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Table Serialization Methods in astropy.io\n\nStart by making a table with a Time column and masked column:\n\n  >>> import sys\n  >>> from astropy.time import Time\n  >>> from astropy.table import Table, MaskedColumn\n\n  >>> t = Table(masked=True)\n  >>> t['tm'] = Time(['2000-01-01', '2000-01-02'])\n  >>> t['mc1'] = MaskedColumn([1.0, 2.0], mask=[True, False])\n  >>> t['mc2'] = MaskedColumn([3.0, 4.0], mask=[False, True])\n  >>> t\n  <Table masked=True length=2>\n             tm             mc1     mc2\n           object         float64 float64\n  ----------------------- ------- -------\n  2000-01-01 00:00:00.000      --     3.0\n  2000-01-02 00:00:00.000     2.0      --\n\nNow specify that you want all `~astropy.time.Time` columns written as JD1/JD2\nand the ``mc1`` column written as a data/mask pair and write to ECSV:\n\n.. doctest-skip::\n\n  >>> serialize_method = {Time: 'jd1_jd2', 'mc1': 'data_mask'}\n  >>> t.write(sys.stdout, format='ascii.ecsv', serialize_method=serialize_method)\n  # %ECSV 0.9\n   ...\n  # schema: astropy-2.0\n   tm.jd1    tm.jd2  mc1  mc1.mask  mc2\n  2451544.0    0.5   1.0   True     3.0\n  2451546.0   -0.5   2.0   False     \"\"\n\n(Spaces added for clarity)\n\nNotice that the ``tm`` column has been replaced by the ``tm.jd1`` and ``tm.jd2``\ncolumns, and likewise a new column ``mc1.mask`` has appeared and it explicitly\ncontains the mask values. When this table is read back with the ``ascii.ecsv``\nreader then the original columns are reconstructed.\n\nThe ``serialize_method`` argument can be set in two different ways:\n\n- As a single string like ``data_mask``. This value then applies to every\n  column, and is a convenient strategy for a masked table with no Time columns.\n- As a `dict`, where the key can be either a single column name or a class (as\n  shown in the example above), and the value is the corresponding serialization\n  method.\n\n..\n  EXAMPLE END\n"},{"col":0,"comment":"Run doctests in isolated tmpdir so outputs do not end up in repo","endLoc":41,"header":"@pytest.fixture(autouse=True)\ndef _docdir(request)","id":55,"name":"_docdir","nodeType":"Function","startLoc":27,"text":"@pytest.fixture(autouse=True)\ndef _docdir(request):\n    \"\"\"Run doctests in isolated tmpdir so outputs do not end up in repo\"\"\"\n    # Trigger ONLY for doctestplus\n    doctest_plugin = request.config.pluginmanager.getplugin(\"doctestplus\")\n    if isinstance(request.node.parent, doctest_plugin._doctest_textfile_item_cls):\n        # Don't apply this fixture to io.rst.  It reads files and doesn't write\n        if \"io.rst\" not in request.node.name:\n            tmpdir = request.getfixturevalue('tmpdir')\n            with tmpdir.as_cwd():\n                yield\n        else:\n            yield\n    else:\n        yield"},{"id":56,"name":"asdf-schemas.rst","nodeType":"TextFile","path":"docs/io","text":".. _asdf_schemas:\n\nSchemas\n=======\n\nDocumentation for each of the individual ASDF schemas defined by ``astropy`` can\nbe found at the links below.\n\nDocumentation for the schemas defined in the ASDF Standard can be found `here\n<https://asdf-standard.readthedocs.io/en/latest/schemas/index.html>`__.\n\n.. contents::\n\nCoordinates\n-----------\n\nThe following schemas are associated with ``astropy`` types from the\n:ref:`astropy-coordinates` submodule:\n\ncoordinates/angle-1.0.0\n^^^^^^^^^^^^^^^^^^^^^^^\n\n.. literalinclude:: ../../astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/angle-1.0.0.yaml\n   :language: yaml\n\ncoordinates/earthlocation-1.0.0\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. literalinclude:: ../../astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/earthlocation-1.0.0.yaml\n   :language: yaml\n\ncoordinates/latitude-1.0.0\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. literalinclude:: ../../astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/latitude-1.0.0.yaml\n   :language: yaml\n\ncoordinates/longitude-1.0.0\n^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. literalinclude:: ../../astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/longitude-1.0.0.yaml\n   :language: yaml\n\ncoordinates/representation-1.0.0\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. literalinclude:: ../../astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/representation-1.0.0.yaml\n   :language: yaml\n\ncoordinates/skycoord-1.0.0\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. literalinclude:: ../../astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/skycoord-1.0.0.yaml\n   :language: yaml\n\nFITS\n----\n\nThe following schemas are associated with ``astropy`` types from the\n:ref:`astropy-io-fits` submodule:\n\nfits/fits-1.0.0\n^^^^^^^^^^^^^^^\n\n.. literalinclude:: ../../astropy/io/misc/asdf/data/schemas/astropy.org/astropy/fits/fits-1.0.0.yaml\n   :language: yaml\n\n\nTable\n-----\n\nThe following schemas are associated with ``astropy`` types from the\n:ref:`astropy-table` submodule:\n\ntable/table-1.0.0\n^^^^^^^^^^^^^^^^^\n\n.. literalinclude:: ../../astropy/io/misc/asdf/data/schemas/astropy.org/astropy/table/table-1.0.0.yaml\n   :language: yaml\n\n\nTime\n----\n\nThe following schemas are associated with ``astropy`` types from the\n:ref:`astropy-time` submodule:\n\ntime/timedelta-1.0.0\n^^^^^^^^^^^^^^^^^^^^\n\n.. literalinclude:: ../../astropy/io/misc/asdf/data/schemas/astropy.org/astropy/time/timedelta-1.0.0.yaml\n   :language: yaml\n\n\nUnits\n-----\n\nThe following schemas are associated with ``astropy`` types from the\n:ref:`astropy-units` submodule:\n\nunits/equivalency-1.0.0\n^^^^^^^^^^^^^^^^^^^^^^^\n\n.. literalinclude:: ../../astropy/io/misc/asdf/data/schemas/astropy.org/astropy/units/equivalency-1.0.0.yaml\n   :language: yaml\n"},{"id":57,"name":"misc.rst","nodeType":"TextFile","path":"docs/io","text":"********************************************************************\nMiscellaneous: HDF5, YAML, ASDF, Parquet, pickle (`astropy.io.misc`)\n********************************************************************\n\nThe `astropy.io.misc` module contains miscellaneous input/output routines that\ndo not fit elsewhere, and are often used by other ``astropy`` sub-packages. For\nexample, `astropy.io.misc.hdf5` contains functions to read/write\n:class:`~astropy.table.Table` objects from/to HDF5 files, but these\nshould not be imported directly by users. Instead, users can access this\nfunctionality via the :class:`~astropy.table.Table` class itself (see\n:ref:`table_io`). Routines that are intended to be used directly by users are\nlisted in the `astropy.io.misc` section.\n\n.. automodapi:: astropy.io.misc\n   :headings: =-\n\n.. automodapi:: astropy.io.misc.hdf5\n   :headings: =-\n\n.. automodapi:: astropy.io.misc.yaml\n   :headings: =-\n\n.. automodapi:: astropy.io.misc.parquet\n   :headings: =-\n\nastropy.io.misc.asdf Package\n============================\n\nThe **asdf** sub-package contains code that is used to serialize ``astropy``\ntypes so that they can be represented and stored using the Advanced Scientific\nData Format (ASDF).\n\nIf both **asdf** and **astropy** are installed, no further configuration is\nrequired in order to process ASDF files that contain **astropy** types. The\n**asdf** package has been designed to automatically detect the presence of the\ntags defined by **astropy**.\n\nFor convenience, users can write `~astropy.table.Table` objects to ASDF files\nusing the :ref:`table_io`. See :ref:`asdf_io` below.\n\nDocumentation on the ASDF Standard can be found `here\n<https://asdf-standard.readthedocs.io>`__. Documentation on the ASDF Python\nmodule can be found `here <https://asdf.readthedocs.io>`__. Additional details\nfor Astropy developers can be found in :ref:`asdf_dev`.\n\n.. _asdf_io:\n\nUsing ASDF With Table I/O\n-------------------------\n\nASDF provides readers and writers for `~astropy.table.Table` using the\n:ref:`table_io`. This makes it convenient to read and write ASDF files with\n`~astropy.table.Table` data.\n\nBasic Usage\n^^^^^^^^^^^\n\nGiven a table, it is possible to write it out to an ASDF file::\n\n    from astropy.table import Table\n\n    # Create a simple table\n    t = Table(dtype=[('a', 'f4'), ('b', 'i4'), ('c', 'S2')])\n    # Write the table to an ASDF file\n    t.write('table.asdf')\n\nThe I/O registry automatically selects the appropriate writer function to use\nbased on the ``.asdf`` extension of the output file.\n\nReading a file generated in this way is also possible using\n`~astropy.table.Table.read`::\n\n    t2 = Table.read('table.asdf')\n\nThe I/O registry automatically selects the appropriate reader function based on\nthe extension of the input file.\n\nIn the case of both reading and writing, if the file extension is not ``.asdf``\nit is possible to explicitly specify the reader/writer function to be used::\n\n    t3 = Table.read('table.zxcv', format='asdf')\n\nAdvanced Usage\n^^^^^^^^^^^^^^\n\nThe fundamental ASDF data structure is the tree, which is a nested\ncombination of basic data structures (see `this\n<https://asdf.readthedocs.io/en/latest/asdf/features.html#data-model>`_\nfor a more detailed description). At the top level, the tree is a `dict`.\n\nThe consequence of this is that a `~astropy.table.Table` object (or any object,\nfor that matter) can be stored at any arbitrary location within an ASDF tree.\nThe basic writer use case described above stores the given\n`~astropy.table.Table` at the top of the tree using a default key. The basic\nreader case assumes that a `~astropy.table.Table` is stored in the same place.\n\nHowever, it may sometimes be useful for users to specify a different top-level\nkey to be used for storage and retrieval of a `~astropy.table.Table` from an\nASDF file. For this reason, the ASDF I/O interface provides ``data_key`` as an\noptional keyword when writing and reading::\n\n    from astropy.table import Table\n\n    t = Table(dtype=[('a', 'f4'), ('b', 'i4'), ('c', 'S2')])\n    # Write the table to an ASDF file using a non-default key\n    t.write('foo.asdf', data_key='foo')\n\nA `~astropy.table.Table` stored using a custom data key can be retrieved by\npassing the same argument to `~astropy.table.Table.read`::\n\n    foo = Table.read('foo.asdf', data_key='foo')\n\nThe ``data_key`` option only applies to `~astropy.table.Table` objects that are\nstored at the top of the ASDF tree. For full generality, users may pass a\ncallback when writing or reading ASDF files to define precisely where the\n`~astropy.table.Table` object should be placed in the tree. The option for the\nwrite case is ``make_tree``. The function callback should accept exactly one\nargument, which is the `~astropy.table.Table` object, and should return a\n`dict` representing the tree to be stored::\n\n    def make_custom_tree(table):\n        # Return a nested tree where the table is stored at the second level\n        return dict(foo=dict(bar=table))\n\n    t = Table(dtype=[('a', 'f4'), ('b', 'i4'), ('c', 'S2')])\n    # Write the table to an ASDF file using a non-default key\n    t.write('foobar.asdf', make_tree=make_custom_tree)\n\nSimilarly, when reading an ASDF file, the user can pass a custom callback to\nlocate the table within the ASDF tree. The option in this case is\n``find_table``. The callback should accept exactly one argument, which is an\n`dict` representing the ASDF tree, and it should return a\n`~astropy.table.Table` object::\n\n    def find_table(tree):\n        # This returns the Table that was stored by the example above\n        return tree['foo']['bar']\n\n    foo = Table.read('foobar.asdf', find_table=find_table)\n\n.. _asdf_dev:\n\nDetails\n-------\n\nThe **asdf** sub-package defines classes, referred to as **tags**, that\nimplement the logic for serialization and deserialization of ``astropy`` types.\nUsers should never need to refer to tag implementations directly. Their\npresence should be entirely transparent when processing ASDF files.\n\nASDF makes use of abstract data type definitions called **schemas**. The tag\nclasses provided here are specific implementations of particular schemas. Some\nof the tags in ``astropy`` (e.g., those related to transforms) implement schemas\nthat are defined by the ASDF Standard. In other cases, both the tags and\nschemas are defined within ``astropy`` (e.g., those related to many of the\ncoordinate frames). Documentation of the individual schemas defined by\n``astropy`` can be found below in the :ref:`asdf_schemas` section.\n\nNot all ``astropy`` types are currently serializable by ASDF. Attempting to\nwrite unsupported types to an ASDF file will lead to a ``RepresenterError``. In\norder to support new types, new tags and schemas must be created. See `Writing\nASDF Extensions <https://asdf.readthedocs.io/en/latest/asdf/extending/legacy.html>`_\nfor additional details, as well as the following example.\n\nExample: Adding a New Object to the Astropy ASDF Extension\n----------------------------------------------------------\n\nIn this example, we will show how to implement serialization for a new\n`~astropy.modeling.Model` object, but the basic principles apply to\nserialization of other ``astropy`` objects. As mentioned, adding a new object\nto the ``astropy``  ASDF extension requires both a tag and a schema.\n\nAll schemas for transforms are currently defined within the ASDF standard.\nAny new serializable transforms must have a corresponding new\nschema here. Let's consider a new model called ``MyModel``, a new model in\n``astropy.modeling.functional_models`` that has two parameters ``amplitude``\nand ``x_0``. We would like to strictly require both of these parameters be set.\nWe would also like to specify that these parameters can either be numeric type,\nor ``astropy.units.quantity`` type. A schema describing this\nmodel would look like::\n\n    %YAML 1.1\n    ---\n    $schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\n    id: \"http://stsci.edu/schemas/asdf/transform/mymodel-1.0.0\"\n    tag: \"tag:stsci.edu:asdf/transform/mymodel-1.0.0\"\n    title: >\n      Example new model.\n\n    description: >\n      Example new model, which describes the distribution of ABC.\n\n    allOf:\n      - $ref: \"transform-1.2.0\"\n      - type: object\n        properties:\n          amplitude:\n            anyOf:\n              - $ref: \"../unit/quantity-1.1.0\"\n              - type: number\n            description: Amplitude of distribution.\n          x_0:\n            anyOf:\n              - $ref: \"../unit/quantity-1.1.0\"\n              - type: number\n            description: X center position.\n\n        required: ['amplitude', 'x_0]\n    ...\n\nAll new transform schemas reference the base transform schema of the latest\ntype. This schema describes the other model attributes that are common to all\nor many models, so that individual schemas only handle the parameters specific\nto that model. Additionally, this schema references the latest version\nof the ``quantity`` schema, so that models can retain information about units\nand quantities. References allow previously defined objects to be used inside\nnew custom types.\n\nThe next component is the tag class. This class must have a ``to_tree`` method\nin which the required attributes of the object in question are obtained, and a\n``from_tree`` method which reconstructs the object based on the parameters\nwritten to the ASDF file. ``astropy`` Models inherit from the\n``TransformType`` base class tag, which takes care of attributes (e.g ``name``,\n``bounding_box``, ``n_inputs``) that are common to all or many Model classes to\nlimit redundancy in individual tags. Each individual model tag then only has\nto obtain and set model-specific parameters::\n\n    from .basic import TransformType\n    from . import _parameter_to_value\n\n    class MyModelType(TransformType):\n    name = 'transform/mymodel'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.MyModel']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.MyModel(amplitude=node['amplitude'],\n                                         x_0=node['x_0'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(amplitude),\n                'x_0': _parameter_to_value(x_0)}\n        return node\n\nThis tag class contains all the machinery to deconstruct objects to and\nreconstruct them from ASDF files. The tag class - by convention named by the\nobject name appended with 'Type' - references the schema and version, and the\nobject in ``astropy.modeling.functional_models``. The basic model parameters\nare handled in the ``to_tree_transform`` and ``from_tree_transform`` of the\nbase ``TransformType`` class, while model-specific parameters are handled here\nin ``MyModelType``. Since this model can take units and quantities with input\nparameters, the imported``_parameter_to_value`` allows this to flexibly work\nwith both basic numeric values as well as quantities.\n\n\nSchemas\n-------\n\nDocumentation for each of the individual ASDF schemas defined by ``astropy``\ncan be found below.\n\n.. toctree::\n   :maxdepth: 2\n\n   asdf-schemas\n"},{"id":58,"name":"registry.rst","nodeType":"TextFile","path":"docs/io","text":".. _io_registry:\n\n************************************\nI/O Registry (`astropy.io.registry`)\n************************************\n\n.. note::\n\n   The I/O registry is only meant to be used directly by users who want to\n   define their own custom readers/writers. Users who want to find out more\n   about what built-in formats are supported by :class:`~astropy.table.Table`\n   by default should see :ref:`table_io`.\n   Likewise :ref:`cosmology_io` for built-in formats supported by\n   :class:`~astropy.cosmology.Cosmology`.\n   No built-in formats are currently defined for\n   :class:`~astropy.nddata.NDData`, but this will be added in future.\n\nIntroduction\n============\n\nThe I/O registry is a submodule used to define the readers/writers available\nfor the :class:`~astropy.table.Table`, :class:`~astropy.nddata.NDData`,\nand :class:`~astropy.cosmology.Cosmology` classes.\n\n\nCustom Read/Write Functions\n===========================\n\nThis section demonstrates how to create a custom reader/writer. A reader is\nwritten as a function that can take any arguments except ``format`` (which is\nneeded when manually specifying the format — see below) and returns an\ninstance of the :class:`~astropy.table.Table` or\n:class:`~astropy.nddata.NDData` classes (or subclasses).\n\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Using astropy.io.registry to Create a Custom Reader/Writer\n\nHere we assume that we are trying to write a reader/writer for the\n:class:`~astropy.table.Table` class::\n\n    >>> from astropy.table import Table\n\n    >>> def my_table_reader(filename, some_option=1):\n    ...     # Read in the table by any means necessary\n    ...     return table  # should be an instance of Table\n\nSuch a function can then be registered with the I/O registry::\n\n    from astropy.io import registry\n    registry.register_reader('my-table-format', Table, my_table_reader)\n\nwhere the first argument is the name of the format, the second argument is the\nclass that the function returns an instance for, and the third argument is the\nreader itself.\n\nWe can then read in a table with::\n\n    d = Table.read('my_table_file.mtf', format='my-table-format')\n\nIn practice, it would be nice to have the ``read`` method automatically\nidentify that this file is in the ``my-table-format`` format, so we can\nconstruct a function that can recognize these files, which we refer to here as\nan *identifier* function.\n\nAn identifier function should take a first argument that is a string\nwhich indicates whether the identifier is being called from ``read`` or\n``write``, and should then accept an arbitrary number of positional and keyword\narguments via ``*args`` and ``**kwargs``, which are the arguments passed to\nthe ``read`` method.\n\nIn the above case, we can write a function that only looks at\nfilenames (but in practice, this function could even look at the first few\nbytes of the file, for example). The only requirement for the identifier\nfunction is that it return a boolean indicating whether the input matches that\nexpected for the format. In our example, we want to automatically recognize\nfiles with filenames ending in ``.mtf`` as being in the ``my-table-format``\nformat::\n\n    import os\n\n    def identify_mtf(origin, *args, **kwargs):\n        return (isinstance(args[0], str) and\n                os.path.splitext(args[0].lower())[1] == '.mtf')\n\n.. note::\n\n    Identifier functions should be prepared for arbitrary input — in\n    particular, the first argument may not be a filename or file object, so it\n    should not assume that this is the case.\n\nWe then register this identifier function, similarly to the reader function::\n\n    registry.register_identifier('my-table-format', Table, identify_mtf)\n\nHaving registered this function, we can then do::\n\n    t = Table.read('catalog.mtf')\n\nIf multiple formats match the current input, then an exception is\nraised, and similarly if no format matches the current input. In that\ncase, the format should be explicitly given with the ``format=``\nkeyword argument.\n\nIt is also possible to create custom writers. To go with our custom reader\nabove, we can write a custom writer::\n\n   def my_table_writer(table, filename, overwrite=False):\n       ...  # Write the table out to a file\n       return ...  # generally None, but other values are not forbidden.\n\nWriter functions should take a dataset object (either an instance of the\n:class:`~astropy.table.Table` or :class:`~astropy.nddata.NDData`\nclasses or subclasses), and any number of subsequent positional and keyword\narguments — although as for the reader, the ``format`` keyword argument cannot\nbe used.\n\nWe then register the writer::\n\n   registry.register_writer('my-custom-format', Table, my_table_writer)\n\nWe can write the table out to a file::\n\n   t.write('catalog_new.mtf', format='my-table-format')\n\nSince we have already registered the identifier function, we can also do::\n\n   t.write('catalog_new.mtf')\n\n..\n  EXAMPLE END\n\n\nRegistries, local and default\n=============================\n\n.. versionchanged:: 5.0\n\nAs of Astropy 5.0 the I/O registry submodule has switched to a class-based\narchitecture, allowing for the creation of custom registries.\nThe three supported registry types are read-only --\n:class:`~astropy.io.registry.UnifiedInputRegistry` --\nwrite-only -- :class:`~astropy.io.registry.UnifiedOutputRegistry` --\nand read/write -- :class:`~astropy.io.registry.UnifiedIORegistry`.\n\n    >>> from astropy.io.registry import UnifiedIORegistry\n    >>> example_reg = UnifiedIORegistry()\n    >>> print([m for m in dir(example_reg) if not m.startswith(\"_\")])\n    ['available_registries', 'delay_doc_updates', 'get_formats', 'get_reader',\n     'get_writer', 'identify_format', 'read', 'register_identifier',\n     'register_reader', 'register_writer', 'unregister_identifier',\n     'unregister_reader', 'unregister_writer', 'write']\n\nFor backward compatibility all the methods on this registry have corresponding\nmodule-level functions, which work with the default global read/write registry.\nThese functions were used in the previous examples. This new registry is empty.\n\n    >>> example_reg.get_formats()\n    <Table length=0>\n    Data class  Format   Read   Write  Auto-identify\n     float64   float64 float64 float64    float64\n    ---------- ------- ------- ------- -------------\n\nWe can register read / write / identify methods with this registry object:\n\n    >>> example_reg.register_reader('my-table-format', Table, my_table_reader)\n    >>> example_reg.get_formats()\n    <Table length=1>\n    Data class      Format     Read Write Auto-identify\n       str5         str15      str3  str2      str2\n    ---------- --------------- ---- ----- -------------\n         Table my-table-format  Yes    No            No\n\n\nWhat is the use of a custom registries?\n\n    1. To make read-only or write-only registries.\n    2. To allow for different readers for the same format.\n    3. To allow for an object to have different *kinds* of readers and writers.\n       E.g. |Cosmology| which supports both file I/O and object conversion.\n\n\nReference/API\n=============\n\n.. automodapi:: astropy.io.registry\n"},{"id":59,"name":"docs/io/fits","nodeType":"Package"},{"id":60,"name":"performance.inc.rst","nodeType":"TextFile","path":"docs/io/fits","text":".. note that if this is changed from the default approach of using an *include*\n   (in index.rst) to a separate performance page, the header needs to be changed\n   from === to ***, the filename extension needs to be changed from .inc.rst to\n   .rst, and a link needs to be added in the subpackage toctree\n\n.. _astropy-io-fits-performance:\n\nPerformance Tips\n================\n\nIt is possible to set the data array for :class:`~astropy.io.fits.PrimaryHDU`\nand :class:`~astropy.io.fits.ImageHDU` to a `dask <https://dask.org/>`_ array.\nIf this is written to disk, the dask array will be computed as it is being\nwritten, which will avoid using excessive memory:\n\n.. doctest-requires:: dask\n\n    >>> import dask.array as da\n    >>> array = da.random.random((1000, 1000))\n    >>> from astropy.io import fits\n    >>> hdu = fits.PrimaryHDU(data=array)\n    >>> hdu.writeto('test_dask.fits')\n\n.. TODO: determine whether the following is quantitatively true, and either\n.. uncomment or remove.\n\n.. Performance Tips\n.. ================\n..\n.. By default, :func:`astropy.io.fits.open` will open files using memory-mapping,\n.. which means that the data is not necessarily read into memory until it is\n.. needed. While memory-efficient, if memory is not a concern for you, you may\n.. find that you can get better performance by turning memory mapping off, which\n.. forces the data to be read into memory immediately:\n..\n.. .. doctest-skip::\n..\n..     >>> fits.open('example.fits', memmap=False)\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":7,"id":61,"name":"version","nodeType":"Attribute","startLoc":7,"text":"version"},{"id":62,"name":"index.rst","nodeType":"TextFile","path":"docs/io/fits","text":".. currentmodule:: astropy.io.fits\n\n.. _astropy-io-fits:\n\n**************************************\nFITS File Handling (`astropy.io.fits`)\n**************************************\n\nIntroduction\n============\n\nThe :mod:`astropy.io.fits` package provides access to FITS files. FITS\n(Flexible Image Transport System) is a portable file standard widely used in\nthe astronomy community to store images and tables. This subpackage was\noriginally developed as PyFITS.\n\n.. _tutorial:\n\nGetting Started\n===============\n\nThis section provides a quick introduction of using :mod:`astropy.io.fits`. The\ngoal is to demonstrate the package's basic features without getting into too\nmuch detail. If you are a first time user or have never used ``astropy`` or\nPyFITS, this is where you should start. See also the :ref:`FAQ <io-fits-faq>`\nfor answers to common questions and issues.\n\n.. note::\n\n    If you want to read or write a single table in FITS format, the\n    recommended method is via the high-level :ref:`table_io`. In particular\n    see the :ref:`Unified I/O FITS <table_io_fits>` section.\n\nReading and Updating Existing FITS Files\n----------------------------------------\n\nOpening a FITS File\n^^^^^^^^^^^^^^^^^^^\n\n.. note::\n\n    The ``astropy.io.fits.util.get_testdata_filepath()`` function,\n    used in the examples here, is for accessing data shipped with ``astropy``.\n    To work with your own data instead, please use :func:`astropy.io.fits.open`,\n    which takes either the relative or absolute path.\n\nOnce the `astropy.io.fits` package is loaded using the standard convention\n[#f1]_, we can open an existing FITS file::\n\n    >>> from astropy.io import fits\n    >>> fits_image_filename = fits.util.get_testdata_filepath('test0.fits')\n\n    >>> hdul = fits.open(fits_image_filename)\n\nThe :func:`open` function has several optional arguments which will be\ndiscussed in a later chapter. The default mode, as in the above example, is\n\"readonly\". The open function returns an object called an :class:`HDUList`\nwhich is a `list`-like collection of HDU objects. An HDU (Header Data Unit) is\nthe highest level component of the FITS file structure, consisting of a header\nand (typically) a data array or table.\n\nAfter the above open call, ``hdul[0]`` is the primary HDU, ``hdul[1]`` is\nthe first extension HDU, etc. (if there are any extensions), and so on. It\nshould be noted that ``astropy`` uses zero-based indexing when referring to\nHDUs and header cards, though the FITS standard (which was designed with\nFortran in mind) uses one-based indexing.\n\nThe :class:`HDUList` has a useful method :meth:`HDUList.info`, which\nsummarizes the content of the opened FITS file:\n\n    >>> hdul.info()\n    Filename: ...test0.fits\n    No.    Name      Ver    Type      Cards   Dimensions   Format\n      0  PRIMARY       1 PrimaryHDU     138   ()\n      1  SCI           1 ImageHDU        61   (40, 40)   int16\n      2  SCI           2 ImageHDU        61   (40, 40)   int16\n      3  SCI           3 ImageHDU        61   (40, 40)   int16\n      4  SCI           4 ImageHDU        61   (40, 40)   int16\n\nAfter you are done with the opened file, close it with the\n:meth:`HDUList.close` method:\n\n    >>> hdul.close()\n\nYou can avoid closing the file manually by using :func:`open` as context\nmanager::\n\n    >>> with fits.open(fits_image_filename) as hdul:\n    ...     hdul.info()\n    Filename: ...test0.fits\n    No.    Name      Ver    Type      Cards   Dimensions   Format\n      0  PRIMARY       1 PrimaryHDU     138   ()\n      1  SCI           1 ImageHDU        61   (40, 40)   int16\n      2  SCI           2 ImageHDU        61   (40, 40)   int16\n      3  SCI           3 ImageHDU        61   (40, 40)   int16\n      4  SCI           4 ImageHDU        61   (40, 40)   int16\n\nAfter exiting the ``with`` scope the file will be closed automatically. That is\n(generally) the preferred way to open a file in Python, because it will close\nthe file even if an exception happens.\n\nIf the file is opened with ``lazy_load_hdus=False``, all of the headers will\nstill be accessible after the HDUList is closed. The headers and data may or\nmay not be accessible depending on whether the data are touched and if they\nare memory-mapped; see later chapters for detail.\n\n.. _fits-large-files:\n\nWorking with large files\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nThe :func:`open` function supports a ``memmap=True`` argument that allows the\narray data of each HDU to be accessed with mmap, rather than being read into\nmemory all at once. This is particularly useful for working with very large\narrays that cannot fit entirely into physical memory. Here ``memmap=True`` by\ndefault, and this value is obtained from the configuration item ``astropy.io.fits.Conf.use_memmap``.\n\nThis has minimal impact on smaller files as well, though some operations, such\nas reading the array data sequentially, may incur some additional overhead. On\n32-bit systems, arrays larger than 2 to 3 GB cannot be mmap'd (which is fine,\nbecause by that point you are likely to run out of physical memory anyways), but\n64-bit systems are much less limited in this respect.\n\n.. warning::\n    When opening a file with ``memmap=True``, because of how mmap works this\n    means that when the HDU data is accessed (i.e., ``hdul[0].data``) another\n    handle to the FITS file is opened by mmap. This means that even after\n    calling ``hdul.close()`` the mmap still holds an open handle to the data so\n    that it can still be accessed by unwary programs that were built with the\n    assumption that the .data attribute has all of the data in-memory.\n\n    In order to force the mmap to close, either wait for the containing\n    ``HDUList`` object to go out of scope, or manually call\n    ``del hdul[0].data``. (This works so long as there are no other references\n    held to the data array.)\n\nUnsigned integers\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nDue to the FITS format's Fortran origins, FITS does not natively support\nunsigned integer data in images or tables. However, there is a common\nconvention to store unsigned integers as signed integers, along with a\n*shift* instruction (a ``BZERO`` keyword with value ``2 ** (BITPIX - 1)``) to\nshift up all signed integers to unsigned integers. For example, when writing\nthe value ``0`` as an unsigned 32-bit integer, it is stored in the FITS\nfile as ``-32768``, along with the header keyword ``BZERO = 32768``.\n\n``astropy`` recognizes and applies this convention by default, so that all data\nthat looks like it should be interpreted as unsigned integers is automatically\nconverted (this applies to both images and tables).\n\nEven with ``uint=False``, the ``BZERO`` shift is still applied, but the\nreturned array is of \"float64\" type. To disable scaling/shifting entirely, use\n``do_not_scale_image_data=True`` (see :ref:`fits-scaled-data-faq` in the FAQ\nfor more details).\n\nWorking with compressed files\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\n.. note::\n\n    Files that use compressed HDUs within the FITS file are discussed\n    in :ref:`Compressed Image Data <astropy-io-fits-compressedImageData>`.\n\n\nThe :func:`open` function will seamlessly open FITS files that have been\ncompressed with gzip, bzip2 or pkzip. Note that in this context we are talking\nabout a FITS file that has been compressed with one of these utilities (e.g., a\n.fits.gz file).\n\nThere are some limitations when working with compressed files. For example,\nwith Zip files that contain multiple compressed files, only the first file will\nbe accessible. Also bzip2 does not support the append or update access modes.\n\nWhen writing a file (e.g., with the :func:`writeto` function), compression will\nbe determined based on the filename extension given, or the compression used in\na pre-existing file that is being written to.\n\n\nWorking with non-standard files\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\nWhen `astropy.io.fits` reads a FITS file which does not conform to the FITS\nstandard it will try to make an educated interpretation of non-compliant fields.\nThis may not always succeed and may trigger warnings when accessing headers or\nexceptions when writing to file. Verification of fields written to an output\nfile can be controlled with the ``output_verify`` parameter of :func:`open`.\nFiles opened for reading can be verified and fixed with method\n``HDUList.verify``. This method is typically invoked after opening the file\nbut before accessing any headers or data::\n\n    >>> with fits.open(fits_image_filename) as hdul:\n    ...    hdul.verify('fix')\n    ...    data = hdul[1].data\n\nIn the above example, the call to ``hdul.verify(\"fix\")`` requests that `astropy.io.fits`\nfix non-compliant fields and print informative messages. Other options in addition to ``\"fix\"``\nare described under FITS :ref:`fits_io_verification`\n\n.. seealso:: FITS :ref:`fits_io_verification`.\n\nWorking with FITS Headers\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\nAs mentioned earlier, each element of an :class:`HDUList` is an HDU object with\n``.header`` and ``.data`` attributes, which can be used to access the header\nand data portions of the HDU.\n\nFor those unfamiliar with FITS headers, they consist of a list of 80 byte\n\"cards\", where a card contains a keyword, a value, and a comment. The keyword\nand comment must both be strings, whereas the value can be a string or an\ninteger, floating point number, complex number, or ``True``/``False``. Keywords\nare usually unique within a header, except in a few special cases.\n\nThe header attribute is a Header instance, another ``astropy`` object. To get\nthe value associated with a header keyword, do (à la Python dicts)::\n\n    >>> hdul = fits.open(fits_image_filename)\n    >>> hdul[0].header['DATE']\n    '01/04/99'\n\nto get the value of the keyword \"DATE\", which is a string '01/04/99'.\n\nAlthough keyword names are always in upper case inside the FITS file,\nspecifying a keyword name with ``astropy`` is case-insensitive for the user's\nconvenience. If the specified keyword name does not exist, it will raise a\n`KeyError` exception.\n\nWe can also get the keyword value by indexing (à la Python lists)::\n\n    >>> hdul[0].header[7]\n    32768.0\n\nThis example returns the eighth (like Python lists, it is 0-indexed) keyword's\nvalue — a float — 32768.0.\n\nSimilarly, it is possible to update a keyword's value in ``astropy``, either\nthrough keyword name or index::\n\n    >>> hdr = hdul[0].header\n    >>> hdr['targname'] = 'NGC121-a'\n    >>> hdr[27] = 99\n\nPlease note however that almost all application code should update header\nvalues via their keyword name and not via their positional index. This is\nbecause most FITS keywords may appear at any position in the header.\n\nIt is also possible to update both the value and comment associated with a\nkeyword by assigning them as a tuple::\n\n    >>> hdr = hdul[0].header\n    >>> hdr['targname'] = ('NGC121-a', 'the observation target')\n    >>> hdr['targname']\n    'NGC121-a'\n    >>> hdr.comments['targname']\n    'the observation target'\n\nLike a dict, you may also use the above syntax to add a new keyword/value pair\n(and optionally a comment as well). In this case the new card is appended to\nthe end of the header (unless it is a commentary keyword such as COMMENT or\nHISTORY, in which case it is appended after the last card with that keyword).\n\nAnother way to either update an existing card or append a new one is to use the\n:meth:`Header.set` method::\n\n    >>> hdr.set('observer', 'Edwin Hubble')\n\nComment or history records are added like normal cards, though in their case a\nnew card is always created, rather than updating an existing HISTORY or COMMENT\ncard::\n\n    >>> hdr['history'] = 'I updated this file 2/26/09'\n    >>> hdr['comment'] = 'Edwin Hubble really knew his stuff'\n    >>> hdr['comment'] = 'I like using HST observations'\n    >>> hdr['history']\n    I updated this file 2/26/09\n    >>> hdr['comment']\n    Edwin Hubble really knew his stuff\n    I like using HST observations\n\nNote: Be careful not to confuse COMMENT cards with the comment value for normal\ncards.\n\nTo update existing COMMENT or HISTORY cards, reference them by index::\n\n    >>> hdr['history'][0] = 'I updated this file on 2/27/09'\n    >>> hdr['history']\n    I updated this file on 2/27/09\n    >>> hdr['comment'][1] = 'I like using JWST observations'\n    >>> hdr['comment']\n    Edwin Hubble really knew his stuff\n    I like using JWST observations\n\n\nTo see the entire header as it appears in the FITS file (with the END card and\npadding stripped), enter the header object by itself, or\n``print(repr(hdr))``::\n\n    >>> hdr  # doctest: +ELLIPSIS\n    SIMPLE  =                    T / file does conform to FITS standard\n    BITPIX  =                   16 / number of bits per data pixel\n    NAXIS   =                    0 / number of data axes\n    ...\n    >>> print(repr(hdr))  # doctest: +ELLIPSIS\n    SIMPLE  =                    T / file does conform to FITS standard\n    BITPIX  =                   16 / number of bits per data pixel\n    NAXIS   =                    0 / number of data axes\n    ...\n\nEntering only ``print(hdr)`` will also work, but may not be very legible\non most displays, as this displays the header as it is written in the FITS file\nitself, which means there are no line breaks between cards. This is a common\nsource of confusion for new users.\n\nIt is also possible to view a slice of the header::\n\n   >>> hdr[:2]\n   SIMPLE  =                    T / file does conform to FITS standard\n   BITPIX  =                   16 / number of bits per data pixel\n\nOnly the first two cards are shown above.\n\nTo get a list of all keywords, use the :meth:`Header.keys` method just as you\nwould with a dict::\n\n    >>> list(hdr.keys())  # doctest: +ELLIPSIS\n    ['SIMPLE', 'BITPIX', 'NAXIS', ...]\n\n.. topic:: Examples:\n\n    See also :ref:`sphx_glr_generated_examples_io_modify-fits-header.py`.\n\n.. _structural_keywords:\n\nStructural Keywords\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nFITS keywords mix up both metadata and critical information about the file structure\nthat is needed to parse the file. These *structural* keywords are managed internally by\n:mod:`astropy.io.fits` and, in general, should not be touched by the user. Instead one\nshould use  the related attributes of the `astropy.io.fits` classes (see examples below).\n\nThe specific set of structural keywords used by the FITS standard varies with HDU type.\nThe following table lists which keywords are associated with each HDU type:\n\n.. csv-table:: Structural Keywords\n   :header: \"HDU Type\", \"Structural Keywords\"\n   :widths: 20, 20\n\n   \"All\", \"``SIMPLE``, ``BITPIX``, ``NAXIS``\"\n   \":class:`PrimaryHDU`\", \"``EXTEND``\"\n   \":class:`ImageHDU`, :class:`TableHDU`, :class:`BinTableHDU`\",  \"``PCOUNT``, ``GCOUNT``\"\n   \":class:`GroupsHDU`\", \"``NAXIS1``, ``GCOUNT``, ``PCOUNT``, ``GROUPS``\"\n   \":class:`TableHDU`, :class:`BinTableHDU`\", \"``TFIELDS``, ``TFORM``, ``TBCOL``\"\n\nThere are many other reserved keywords, for instance for the data scaling, or for table's column\nattributes, as described in the  `FITS Standard <https://fits.gsfc.nasa.gov/fits_standard.html>`__.\nMost of these are accessible via attributes of the :class:`Column` or HDU objects, for instance\n``hdu.name`` to set ``EXTNAME``, or ``hdu.ver`` for ``EXTVER``. Structural keywords are checked\nand/or updated as a consequence of common operations. For example, when:\n\n1. Setting the data. The ``NAXIS*`` keywords are set from the data shape (``.data.shape``), and ``BITPIX``\n   from the data type (``.data.dtype``).\n2. Setting the header. Its keywords are updated based on the data properties (as above).\n3. Writing a file. All the necessary keywords are deleted, updated or added to the header.\n4. Calling an HDU's verify method (e.g., :func:`PrimaryHDU.verify`). Some keywords can be fixed automatically.\n\nIn these cases any hand-written values users might assign to those keywords will be overwrittten.\n\nWorking with Image Data\n^^^^^^^^^^^^^^^^^^^^^^^\n\nIf an HDU's data is an image, the data attribute of the HDU object will return\na ``numpy`` `~numpy.ndarray` object. Refer to the ``numpy`` documentation for\ndetails on manipulating these numerical arrays::\n\n    >>> data = hdul[1].data\n\nHere, ``data`` points to the data object in the second HDU (the first HDU,\n``hdul[0]``, being the primary HDU) which corresponds to the 'SCI'\nextension. Alternatively, you can access the extension by its extension name\n(specified in the EXTNAME keyword)::\n\n    >>> data = hdul['SCI'].data\n\nIf there is more than one extension with the same EXTNAME, the EXTVER value\nneeds to be specified along with the EXTNAME as a tuple; for example::\n\n    >>> data = hdul['sci',2].data\n\nNote that the EXTNAME is also case-insensitive.\n\nThe returned ``numpy`` object has many attributes and methods for a user to get\ninformation about the array, for example::\n\n    >>> data.shape\n    (40, 40)\n    >>> data.dtype.name\n    'int16'\n\nSince image data is a ``numpy`` object, we can slice it, view it, and perform\nmathematical operations on it. To see the pixel value at x=5, y=2::\n\n    >>> print(data[1, 4])\n    348\n\nNote that, like C (and unlike Fortran), Python is 0-indexed and the indices\nhave the slowest axis first and fastest changing axis last; that is, for a 2D\nimage, the fast axis (X-axis) which corresponds to the FITS NAXIS1 keyword, is\nthe second index. Similarly, the 1-indexed subsection of x=11 to 20\n(inclusive) and y=31 to 40 (inclusive) would be given in Python as::\n\n    >>> data[30:40, 10:20]\n    array([[350, 349, 349, 348, 349, 348, 349, 347, 350, 348],\n           [348, 348, 348, 349, 348, 349, 347, 348, 348, 349],\n           [348, 348, 347, 349, 348, 348, 349, 349, 349, 349],\n           [349, 348, 349, 349, 350, 349, 349, 347, 348, 348],\n           [348, 348, 348, 348, 349, 348, 350, 349, 348, 349],\n           [348, 347, 349, 349, 350, 348, 349, 348, 349, 347],\n           [347, 348, 347, 348, 349, 349, 350, 349, 348, 348],\n           [349, 349, 350, 348, 350, 347, 349, 349, 349, 348],\n           [349, 348, 348, 348, 348, 348, 349, 347, 349, 348],\n           [349, 349, 349, 348, 350, 349, 349, 350, 348, 350]], dtype=int16)\n\nTo update the value of a pixel or a subsection::\n\n    >>> data[30:40, 10:20] = data[1, 4] = 999\n\nThis example changes the values of both the pixel \\[1, 4] and the subsection\n\\[30:40, 10:20] to the new value of 999. See the `Numpy documentation`_ for\nmore details on Python-style array indexing and slicing.\n\nThe next example of array manipulation is to convert the image data from counts\nto flux::\n\n    >>> photflam = hdul[1].header['photflam']\n    >>> exptime = hdr['exptime']\n    >>> data = data * photflam / exptime\n    >>> hdul.close()\n\nNote that performing an operation like this on an entire image requires holding\nthe entire image in memory. This example performs the multiplication in-place\nso that no copies are made, but the original image must first be able to fit in\nmain memory. For most observations this should not be an issue on modern\npersonal computers.\n\nIf at this point you want to preserve all of the changes you made and write it\nto a new file, you can use the :meth:`HDUList.writeto` method (see below).\n\n.. _Numpy documentation: https://numpy.org/doc/stable/reference/arrays.indexing.html\n\n.. topic:: Examples:\n\n    See also :ref:`sphx_glr_generated_examples_io_plot_fits-image.py`.\n\nWorking with Table Data\n^^^^^^^^^^^^^^^^^^^^^^^\n\nThis section describes reading and writing table data in the FITS format using\nthe `~astropy.io.fits` package directly. For some cases, however, the\nhigh-level :ref:`table_io` will often suffice and is somewhat more convenient\nto use. See the :ref:`Unified I/O FITS <table_io_fits>` section for details.\n\nLike images, the data portion of a FITS table extension is in the ``.data``\nattribute::\n\n    >>> fits_table_filename = fits.util.get_testdata_filepath('tb.fits')\n    >>> hdul = fits.open(fits_table_filename)\n    >>> data = hdul[1].data # assuming the first extension is a table\n    >>> hdul.close()\n\nIf you are familiar with ``numpy`` `~numpy.recarray` (record array) objects, you\nwill find the table data is basically a record array with some extra\nproperties. But familiarity with record arrays is not a prerequisite for this\nguide.\n\nTo see the first row of the table::\n\n    >>> print(data[0])\n    (1, 'abc', 3.7000000715255736, False)\n\nEach row in the table is a :class:`FITS_record` object which looks like a\n(Python) tuple containing elements of heterogeneous data types. In this\nexample: an integer, a string, a floating point number, and a Boolean value. So\nthe table data are just an array of such records. More commonly, a user is\nlikely to access the data in a column-wise way. This is accomplished by using\nthe :meth:`~FITS_rec.field` method. To get the first column (or \"field\" in\nNumPy parlance — it is used here interchangeably with \"column\") of the table,\nuse::\n\n    >>> data.field(0)\n    array([1, 2]...)\n\nA ``numpy`` object with the data type of the specified field is returned.\n\nLike header keywords, a column can be referred either by index, as above, or by\nname::\n\n    >>> data.field('c1')\n    array([1, 2]...)\n\nWhen accessing a column by name, dict-like access is also possible (and even\npreferable)::\n\n    >>> data['c1']\n    array([1, 2]...)\n\nIn most cases it is preferable to access columns by their name, as the column\nname is entirely independent of its physical order in the table. As with\nheader keywords, column names are case-insensitive.\n\nBut how do we know what columns we have in a table? First, we will introduce\nanother attribute of the table HDU: the :attr:`~BinTableHDU.columns`\nattribute::\n\n    >>> cols = hdul[1].columns\n\nThis attribute is a :class:`ColDefs` (column definitions) object. If we use the\n:meth:`ColDefs.info` method from the interactive prompt::\n\n    >>> cols.info()\n    name:\n        ['c1', 'c2', 'c3', 'c4']\n    format:\n        ['1J', '3A', '1E', '1L']\n    unit:\n        ['', '', '', '']\n    null:\n        [-2147483647, '', '', '']\n    bscale:\n        ['', '', 3, '']\n    bzero:\n        ['', '', 0.4, '']\n    disp:\n        ['I11', 'A3', 'G15.7', 'L6']\n    start:\n        ['', '', '', '']\n    dim:\n        ['', '', '', '']\n    coord_type:\n        ['', '', '', '']\n    coord_unit:\n        ['', '', '', '']\n    coord_ref_point:\n        ['', '', '', '']\n    coord_ref_value:\n        ['', '', '', '']\n    coord_inc:\n        ['', '', '', '']\n    time_ref_pos:\n        ['', '', '', '']\n\nit will show the attributes of all columns in the table, such as their names,\nformats, bscales, bzeros, etc. A similar output that will display the column\nnames and their formats can be printed from within a script with::\n\n    >>> hdul[1].columns\n    ColDefs(\n        name = 'c1'; format = '1J'; null = -2147483647; disp = 'I11'\n        name = 'c2'; format = '3A'; disp = 'A3'\n        name = 'c3'; format = '1E'; bscale = 3; bzero = 0.4; disp = 'G15.7'\n        name = 'c4'; format = '1L'; disp = 'L6'\n    )\n\nWe can also get these properties individually; for example::\n\n    >>> cols.names\n    ['c1', 'c2', 'c3', 'c4']\n\nreturns a (Python) list of field names.\n\nSince each field is a ``numpy`` object, we will have the entire arsenal of\n``numpy`` tools to use. We can reassign (update) the values::\n\n    >>> data['c4'][:] = 0\n\ntake the mean of a column::\n\n    >>> data['c3'].mean()  # doctest: +FLOAT_CMP\n    5.19999989271164\n\nand so on.\n\n.. topic:: Examples:\n\n    See also :ref:`sphx_glr_generated_examples_io_fits-tables.py`.\n\nSave File Changes\n^^^^^^^^^^^^^^^^^\n\nAs mentioned earlier, after a user opened a file, made a few changes to either\nheader or data, the user can use :meth:`HDUList.writeto` to save the changes.\nThis takes the version of headers and data in memory and writes them to a new\nFITS file on disk. Subsequent operations can be performed to the data in memory\nand written out to yet another different file, all without recopying the\noriginal data to (more) memory:\n\n.. code:: python\n\n    hdul.writeto('newtable.fits')\n\nwill write the current content of ``hdulist`` to a new disk file newfile.fits.\nIf a file was opened with the update mode, the :meth:`HDUList.flush` method can\nalso be used to write all of the changes made since :func:`open`, back to the\noriginal file. The :meth:`~HDUList.close` method will do the same for a FITS\nfile opened with update mode:\n\n.. code:: python\n\n    with fits.open('original.fits', mode='update') as hdul:\n        # Change something in hdul.\n        hdul.flush()  # changes are written back to original.fits\n\n    # closing the file will also flush any changes and prevent further writing\n\n\nCreating a New FITS File\n------------------------\n\nCreating a New Image File\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\nSo far we have demonstrated how to read and update an existing FITS file. But\nhow about creating a new FITS file from scratch? Such tasks are very convenient\nin ``astropy`` for an image HDU. We will first demonstrate how to create a FITS\nfile consisting of only the primary HDU with image data.\n\nFirst, we create a ``numpy`` object for the data part::\n\n    >>> import numpy as np\n    >>> n = np.arange(100.0) # a simple sequence of floats from 0.0 to 99.9\n\nNext, we create a :class:`PrimaryHDU` object to encapsulate the data::\n\n    >>> hdu = fits.PrimaryHDU(n)\n\nWe then create an :class:`HDUList` to contain the newly created primary HDU, and write to\na new file::\n\n    >>> hdul = fits.HDUList([hdu])\n    >>> hdul.writeto('new1.fits')\n\nThat is it! In fact, ``astropy`` even provides a shortcut for the last two\nlines to accomplish the same behavior::\n\n    >>> hdu.writeto('new2.fits')\n\nThis will write a single HDU to a FITS file without having to manually\nencapsulate it in an :class:`HDUList` object first.\n\n\nCreating a New Table File\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. note::\n\n    If you want to create a **binary** FITS table with no other HDUs,\n    you can use :class:`~astropy.table.Table` instead and then write to FITS.\n    This is less complicated than \"lower-level\" FITS interface::\n\n    >>> from astropy.table import Table\n    >>> t = Table([[1, 2], [4, 5], [7, 8]], names=('a', 'b', 'c'))\n    >>> t.write('table1.fits', format='fits')\n\n    The equivalent code using ``astropy.io.fits`` would look like this:\n\n    >>> from astropy.io import fits\n    >>> import numpy as np\n    >>> c1 = fits.Column(name='a', array=np.array([1, 2]), format='K')\n    >>> c2 = fits.Column(name='b', array=np.array([4, 5]), format='K')\n    >>> c3 = fits.Column(name='c', array=np.array([7, 8]), format='K')\n    >>> t = fits.BinTableHDU.from_columns([c1, c2, c3])\n    >>> t.writeto('table2.fits')\n\nTo create a table HDU is a little more involved than an image HDU, because a\ntable's structure needs more information. First of all, tables can only be an\nextension HDU, not a primary. There are two kinds of FITS table extensions:\nASCII and binary. We will use binary table examples here.\n\nTo create a table from scratch, we need to define columns first, by\nconstructing the :class:`Column` objects and their data. Suppose we have two\ncolumns, the first containing strings, and the second containing floating point\nnumbers::\n\n    >>> import numpy as np\n    >>> a1 = np.array(['NGC1001', 'NGC1002', 'NGC1003'])\n    >>> a2 = np.array([11.1, 12.3, 15.2])\n    >>> col1 = fits.Column(name='target', format='20A', array=a1)\n    >>> col2 = fits.Column(name='V_mag', format='E', array=a2)\n\n.. note::\n\n    It is not necessary to create a :class:`Column` object explicitly\n    if the data is stored in a\n    `structured array <https://numpy.org/doc/stable/user/basics.rec.html>`_.\n\nNext, create a :class:`ColDefs` (column-definitions) object for all columns::\n\n    >>> cols = fits.ColDefs([col1, col2])\n\nNow, create a new binary table HDU object by using the\n:func:`BinTableHDU.from_columns` function::\n\n    >>> hdu = fits.BinTableHDU.from_columns(cols)\n\nThis function returns (in this case) a :class:`BinTableHDU`.\n\nThe data structure used to represent FITS tables is called a :class:`FITS_rec`\nand is derived from the :class:`numpy.recarray` interface. When creating\na new table HDU the individual column arrays will be assembled into a single\n:class:`FITS_rec` array.\n\nYou can create a :class:`BinTableHDU` more concisely without creating intermediate\nvariables for the individual columns and without manually creating a\n:class:`ColDefs` object::\n\n    >>> hdu = fits.BinTableHDU.from_columns(\n    ...     [fits.Column(name='target', format='20A', array=a1),\n    ...      fits.Column(name='V_mag', format='E', array=a2)])\n\nNow you may write this new table HDU directly to a FITS file like so::\n\n    >>> hdu.writeto('table3.fits')\n\nThis shortcut will automatically create a minimal primary HDU with no data and\nprepend it to the table HDU to create a valid FITS file. If you require\nadditional data or header keywords in the primary HDU you may still create a\n:class:`PrimaryHDU` object and build up the FITS file manually using an\n:class:`HDUList`, as described in the next section.\n\nCreating a File with Multiple Extensions\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nIn the previous examples we created files with a single meaningful extension (a\n:class:`PrimaryHDU` or :class:`BinTableHDU`). To create a file with multiple\nextensions we need to create extension HDUs and append them to an :class:`HDUList`.\n\nFirst, we create some data for Image extensions::\n\n    >>> import numpy as np\n    >>> n = np.ones((3, 3))\n    >>> n2 = np.ones((100, 100))\n    >>> n3 = np.ones((10, 10, 10))\n\nNote that the data shapes of the different extensions do not need to be the same.\nNext, place the data into separate :class:`PrimaryHDU` and :class:`ImageHDU`\nobjects::\n\n    >>> primary_hdu = fits.PrimaryHDU(n)\n    >>> image_hdu = fits.ImageHDU(n2)\n    >>> image_hdu2 = fits.ImageHDU(n3)\n\nA multi-extension FITS file is not constrained to be only imaging or table data, we\ncan mix them. To show this we'll use the example from the previous section to make a\n:class:`BinTableHDU`::\n\n    >>> c1 = fits.Column(name='a', array=np.array([1, 2]), format='K')\n    >>> c2 = fits.Column(name='b', array=np.array([4, 5]), format='K')\n    >>> c3 = fits.Column(name='c', array=np.array([7, 8]), format='K')\n    >>> table_hdu = fits.BinTableHDU.from_columns([c1, c2, c3])\n\nNow when we create the :class:`HDUList` we list all extensions we want to\ninclude::\n\n    >>> hdul = fits.HDUList([primary_hdu, image_hdu, table_hdu])\n\nBecause :class:`HDUList` acts like a :class:`list` we can also append, for example,\nan :class:`ImageHDU` to an already existing :class:`HDUList`::\n\n    >>> hdul.append(image_hdu2)\n\nMulti-extension :class:`HDUList` are treated just like those with only a\n:class:`PrimaryHDU`, so to save the file use :func:`HDUList.writeto` as shown above.\n\n.. note::\n\n    The FITS standard enforces all files to have exactly one :class:`PrimaryHDU` that\n    is the first HDU present in the file. This standard is enforced during the call to\n    :func:`HDUList.writeto` and an error will be raised if it is not met. See the\n    ``output_verify`` option in :func:`HDUList.writeto` for ways to fix or ignore these\n    warnings.\n\nIn the previous example the :class:`PrimaryHDU` contained actual data. In some cases it\nis desirable to have a minimal :class:`PrimaryHDU` with only basic header information.\nTo do this, first create a new :class:`Header` object to encapsulate any keywords you want\nto include in the primary HDU, then as before create a :class:`PrimaryHDU`::\n\n    >>> hdr = fits.Header()\n    >>> hdr['OBSERVER'] = 'Edwin Hubble'\n    >>> hdr['COMMENT'] = \"Here's some commentary about this FITS file.\"\n    >>> empty_primary = fits.PrimaryHDU(header=hdr)\n\nWhen we create a new primary HDU with a custom header as in the above example,\nthis will automatically include any additional header keywords that are\n*required* by the FITS format (keywords such as ``SIMPLE`` and ``NAXIS`` for\nexample). In general, users should not have to manually manage such keywords,\nand should only create and modify observation-specific informational keywords.\n\nWe then create an HDUList containing both the primary HDU and any other HDUs want::\n\n    >>> hdul = fits.HDUList([empty_primary, image_hdu2, table_hdu])\n\n.. topic:: Examples:\n\n    See also :ref:`sphx_glr_generated_examples_io_create-mef.py`.\n\nConvenience Functions\n---------------------\n\n`astropy.io.fits` also provides several high-level (\"convenience\") functions.\nSuch a convenience function is a \"canned\" operation to achieve one task.\nBy using these \"convenience\" functions, a user does not have to worry about\nopening or closing a file; all of the housekeeping is done implicitly.\n\n.. warning::\n\n    These functions are useful for interactive Python sessions and less complex\n    analysis scripts, but should not be used for application code, as they\n    are highly inefficient. For example, each call to :func:`getval`\n    requires re-parsing the entire FITS file. Code that makes repeated use\n    of these functions should instead open the file with :func:`open`\n    and access the data structures directly.\n\nThe first of these functions is :func:`getheader`, to get the header of an HDU.\nHere are several examples of getting the header. Only the file name is required\nfor this function. The rest of the arguments are optional and flexible to\nspecify which HDU the user wants to access::\n\n    >>> from astropy.io.fits import getheader\n    >>> hdr = getheader(fits_image_filename)  # get default HDU (=0), i.e. primary HDU's header\n    >>> hdr = getheader(fits_image_filename, 0)  # get primary HDU's header\n    >>> hdr = getheader(fits_image_filename, 2)  # the second extension\n    >>> hdr = getheader(fits_image_filename, 'sci')  # the first HDU with EXTNAME='SCI'\n    >>> hdr = getheader(fits_image_filename, 'sci', 2)  # HDU with EXTNAME='SCI' and EXTVER=2\n    >>> hdr = getheader(fits_image_filename, ('sci', 2))  # use a tuple to do the same\n    >>> hdr = getheader(fits_image_filename, ext=2)  # the second extension\n    >>> hdr = getheader(fits_image_filename, extname='sci')  # first HDU with EXTNAME='SCI'\n    >>> hdr = getheader(fits_image_filename, extname='sci', extver=2)\n\nAmbiguous specifications will raise an exception::\n\n    >>> getheader(fits_image_filename, ext=('sci', 1), extname='err', extver=2)\n    Traceback (most recent call last):\n        ...\n    TypeError: Redundant/conflicting extension arguments(s): ...\n\nAfter you get the header, you can access the information in it, such as getting\nand modifying a keyword value::\n\n    >>> fits_image_2_filename = fits.util.get_testdata_filepath('o4sp040b0_raw.fits')\n    >>> hdr = getheader(fits_image_2_filename, 0)    # get primary hdu's header\n    >>> filter = hdr['filter']                       # get the value of the keyword \"filter'\n    >>> val = hdr[10]                                # get the 11th keyword's value\n    >>> hdr['filter'] = 'FW555'                      # change the keyword value\n\nFor the header keywords, the header is like a dictionary, as well as a list.\nThe user can access the keywords either by name or by numeric index, as\nexplained earlier in this chapter.\n\nIf a user only needs to read one keyword, the  :func:`getval` function can\nfurther simplify to just one call, instead of two as shown in the above\nexamples::\n\n    >>> from astropy.io.fits import getval\n    >>> # get 0th extension's keyword FILTER's value\n    >>> flt = getval(fits_image_2_filename, 'filter', 0)\n    >>> flt\n    'Clear'\n\n    >>> # get the 2nd sci extension's 11th keyword's value\n    >>> val = getval(fits_image_2_filename, 10, 'sci', 2)\n    >>> val\n    False\n\nThe function :func:`getdata` gets the data of an HDU. Similar to\n:func:`getheader`, it only requires the input FITS file name while the\nextension is specified through the optional arguments. It does have one extra\noptional argument header. If header is set to True, this function will return\nboth data and header, otherwise only data is returned::\n\n    >>> from astropy.io.fits import getdata\n    >>> # get 3rd sci extension's data:\n    >>> data = getdata(fits_image_filename, 'sci', 3)\n    >>> # get 1st extension's data AND header:\n    >>> data, hdr = getdata(fits_image_filename, 1, header=True)\n\nThe functions introduced above are for reading. The next few functions\ndemonstrate convenience functions for writing::\n\n    >>> fits.writeto('out.fits', data, hdr)\n\nThe :func:`writeto` function uses the provided data and an optional header to\nwrite to an output FITS file.\n\n::\n\n    >>> fits.append('out.fits', data, hdr)\n\nThe :func:`append` function will use the provided data and the optional header\nto append to an existing FITS file. If the specified output file does not\nexist, it will create one.\n\n.. code:: python\n\n    from astropy.io.fits import update\n    update(filename, dat, hdr, 'sci')         # update the 'sci' extension\n    update(filename, dat, 3)                  # update the 3rd extension\n    update(filename, dat, hdr, 3)             # update the 3rd extension\n    update(filename, dat, 'sci', 2)           # update the 2nd SCI extension\n    update(filename, dat, 3, header=hdr)      # update the 3rd extension\n    update(filename, dat, header=hdr, ext=5)  # update the 5th extension\n\nThe :func:`update` function will update the specified extension with the input\ndata/header. The third argument can be the header associated with the data. If\nthe third argument is not a header, it (and other positional arguments) are\nassumed to be the extension specification(s). Header and extension specs can\nalso be keyword arguments.\n\nThe :func:`printdiff` function will print a difference report of two FITS files,\nincluding headers and data. The first two arguments must be two FITS\nfilenames or FITS file objects with matching data types (i.e., if using strings\nto specify filenames, both inputs must be strings). The third\nargument is an optional extension specification, with the same call format\nof :func:`getheader` and :func:`getdata`. In addition you can add any keywords\naccepted by the :class:`FITSDiff` class.\n\n.. code:: python\n\n    from astropy.io.fits import printdiff\n    # get a difference report of ext 2 of inA and inB\n    printdiff('inA.fits', 'inB.fits', ext=2)\n    # ignore HISTORY and COMMENT keywords\n    printdiff('inA.fits', 'inB.fits', ignore_keywords=('HISTORY','COMMENT')\n\nFinally, the :func:`info` function will print out information of the specified\nFITS file::\n\n    >>> fits.info(fits_image_filename)\n    Filename: ...test0.fits\n    No.    Name      Ver    Type      Cards   Dimensions   Format\n      0  PRIMARY       1 PrimaryHDU     138   ()\n      1  SCI           1 ImageHDU        61   (40, 40)   int16\n      2  SCI           2 ImageHDU        61   (40, 40)   int16\n      3  SCI           3 ImageHDU        61   (40, 40)   int16\n      4  SCI           4 ImageHDU        61   (40, 40)   int16\n\nThis is one of the most useful convenience functions for getting an overview of\nwhat a given file contains without looking at any of the details.\n\n\nUsing `astropy.io.fits`\n=======================\n.. toctree::\n   :maxdepth: 2\n\n   usage/headers\n   usage/image\n   usage/table\n   usage/verification\n   usage/unfamiliar\n   usage/scripts\n   usage/misc\n\nCommand-Line Utilities\n======================\n\nFor convenience, several of ``astropy``'s sub-packages install utility programs\non your system which allow common tasks to be performed without having\nto open a Python interpreter. These utilities include:\n\n- `~astropy.io.fits.scripts.fitsheader`: prints the headers of a FITS file.\n\n- `~astropy.io.fits.scripts.fitscheck`: verifies and optionally rewrites\n  the CHECKSUM and DATASUM keywords of a FITS file.\n\n- :ref:`fitsdiff`: compares two FITS files and reports the differences.\n\n- :ref:`fits2bitmap`: converts FITS images to bitmaps, including scaling and\n  stretching.\n\n- :ref:`wcslint <wcslint>`: checks the :ref:`WCS <astropy-wcs>` keywords in a\n  FITS file for compliance against the standards.\n\nOther Information\n=================\n\n.. toctree::\n    :maxdepth: 1\n\n    appendix/faq\n    appendix/header_transition\n    appendix/history\n\n.. note that if this section gets too long, it should be moved to a separate\n   doc page - see the top of performance.inc.rst for the instructions on how to do\n   that\n\n.. include:: performance.inc.rst\n\nReference/API\n=============\n\n.. automodule:: astropy.io.fits\n\n.. toctree::\n    :maxdepth: 3\n\n    api/files.rst\n    api/hdulists.rst\n    api/hdus.rst\n    api/headers.rst\n    api/cards.rst\n    api/tables.rst\n    api/images.rst\n    api/diff.rst\n    api/verification.rst\n\n.. rubric:: Footnotes\n\n.. [#f1]  For legacy code only that already depends on PyFITS, it's acceptable to continue using \"from astropy.io import fits as pyfits\".\n"},{"id":63,"name":"docs/io/fits/api","nodeType":"Package"},{"id":64,"name":"cards.rst","nodeType":"TextFile","path":"docs/io/fits/api","text":".. currentmodule:: astropy.io.fits\n\nCards\n*****\n\n:class:`Card`\n=============\n\n.. autoclass:: Card\n   :members:\n   :inherited-members:\n   :undoc-members:\n   :show-inheritance:\n"},{"id":65,"name":"verification.rst","nodeType":"TextFile","path":"docs/io/fits/api","text":".. currentmodule:: astropy.io.fits\n\n.. _verify:\n\nVerification Options\n********************\n\nThere are five options for the ``output_verify`` argument of the following\nmethods of :class:`HDUList`: :meth:`~HDUList.close`, :meth:`~HDUList.writeto`,\nand :meth:`~HDUList.flush`, or the ``_BaseHDU.writeto`` method on any HDU\nobject. In these cases, the verification option is passed to a ``verify``\ncall within these methods.\n\n``'exception'``\n===============\n\nThis option will raise an exception if any FITS standard is violated. This is\nthe default option for output (i.e., when :meth:`~HDUList.writeto`,\n:meth:`~HDUList.close`, or :meth:`~HDUList.flush` is called). If a user wants to\noverwrite this default on output, the other options listed below can be used.\n\n``'ignore'``\n============\n\nThis option will ignore any FITS standard violation. On output, it will write\nthe HDU List content to the output FITS file, whether or not it is conforming\nto FITS standard.\n\nThe ``ignore`` option is useful in these situations, for example:\n\n  1. An input FITS file with non-standard is read and the user wants to copy or\n     write out after some modification to an output file. The non-standard will\n     be preserved in such output file.\n\n  2. A user wants to create a non-standard FITS file on purpose, possibly for\n     testing purpose.\n\nNo warning message will be printed out. This is like a silent warn (see below)\noption.\n\n``'fix'``\n=========\n\nThis option will try to fix any FITS standard violations. It is not always\npossible to fix such violations. In general, there are two kinds of FITS\nstandard violations: fixable and not fixable. For example, if a keyword has a\nfloating number with an exponential notation in lower case 'e' (e.g., 1.23e11)\ninstead of the upper case 'E' as required by the FITS standard, it is a fixable\nviolation. On the other hand, a keyword name like ``P.I.`` is not fixable,\nsince it will not know what to use to replace the disallowed periods. If a\nviolation is fixable, this option will print out a message noting it is fixed.\nIf it is not fixable, it will throw an exception.\n\nThe principle behind the fixing is do no harm. For example, it is plausible to\n'fix' a :class:`Card` with a keyword name like ``P.I.`` by deleting it, but\n``astropy`` will not take such action to hurt the integrity of the data.\n\nNot all fixes may be the \"correct\" fix, but at least ``astropy`` will try to\nmake the fix in such a way that it will not throw off other FITS readers.\n\n``'silentfix'``\n===============\n\nSame as fix, but will not print out informative messages. This may be useful in\na large script where the the user does not want excessive harmless messages. If\nthe violation is not fixable, it will still throw an exception.\n\n``'warn'``\n==========\n\nThis option is the same as the ignore option but will send warning messages. It\nwill not try to fix any FITS standard violations whether fixable or not.\n"},{"id":66,"name":"tables.rst","nodeType":"TextFile","path":"docs/io/fits/api","text":".. currentmodule:: astropy.io.fits\n\n.. _tables:\n\nTables\n******\n\n:class:`BinTableHDU`\n====================\n.. autoclass:: BinTableHDU\n   :members:\n   :inherited-members:\n   :show-inheritance:\n\n:class:`TableHDU`\n=================\n.. autoclass:: TableHDU\n   :members:\n   :inherited-members:\n   :show-inheritance:\n\n:class:`Column`\n===============\n.. autoclass:: Column\n   :members:\n   :inherited-members:\n   :show-inheritance:\n\n:class:`ColDefs`\n================\n.. autoclass:: ColDefs\n   :members:\n   :inherited-members:\n   :show-inheritance:\n\n:class:`FITS_rec`\n=================\n.. autoclass:: FITS_rec\n   :members:\n   :show-inheritance:\n\n:class:`FITS_record`\n====================\n.. autoclass:: FITS_record\n   :members:\n   :inherited-members:\n   :show-inheritance:\n\n\nTable Functions\n===============\n\n:func:`tabledump`\n-----------------\n.. autofunction:: tabledump\n\n:func:`tableload`\n-----------------\n.. autofunction:: tableload\n\n:func:`table_to_hdu`\n--------------------\n.. autofunction:: table_to_hdu\n"},{"id":67,"name":"hdus.rst","nodeType":"TextFile","path":"docs/io/fits/api","text":".. currentmodule:: astropy.io.fits\n\nHeader Data Unit\n****************\n\nHeader Data Units are the fundamental container structure of the FITS format\nconsisting of a ``data`` member and its associated metadata in a ``header``.\nThey are defined in ``astropy.io.fits.hdu``.\n\nThe :class:`ImageHDU` and :class:`CompImageHDU` classes are discussed in the\nsection on :ref:`Images`.\n\nThe :class:`TableHDU` and :class:`BinTableHDU` classes are discussed in the\nsection on :ref:`Tables`.\n\n:class:`PrimaryHDU`\n===================\n.. autoclass:: PrimaryHDU\n   :members:\n   :inherited-members:\n   :show-inheritance:\n\n:class:`GroupsHDU`\n==================\n.. autoclass:: GroupsHDU\n   :members:\n   :inherited-members:\n   :show-inheritance:\n\n:class:`GroupData`\n==================\n.. autoclass:: GroupData\n   :members:\n   :show-inheritance:\n\n:class:`Group`\n--------------\n.. autoclass:: Group\n   :members:\n   :show-inheritance:\n\n:class:`StreamingHDU`\n=====================\n.. autoclass:: StreamingHDU\n   :members:\n   :inherited-members:\n   :show-inheritance:\n"},{"id":68,"name":"files.rst","nodeType":"TextFile","path":"docs/io/fits/api","text":".. currentmodule:: astropy.io.fits\n\nFile Handling and Convenience Functions\n***************************************\n\n:func:`open`\n============\n.. autofunction:: open\n\n:func:`writeto`\n===============\n.. autofunction:: writeto\n\n:func:`info`\n============\n.. autofunction:: info\n\n:func:`printdiff`\n=================\n.. autofunction:: printdiff\n\n:func:`append`\n==============\n.. autofunction:: append\n\n:func:`update`\n==============\n.. autofunction:: update\n\n:func:`getdata`\n===============\n.. autofunction:: getdata\n\n:func:`getheader`\n=================\n.. autofunction:: getheader\n\n:func:`getval`\n==============\n.. autofunction:: getval\n\n:func:`setval`\n==============\n.. autofunction:: setval\n\n:func:`delval`\n==============\n.. autofunction:: delval\n"},{"id":69,"name":"diff.rst","nodeType":"TextFile","path":"docs/io/fits/api","text":"Differs\n*******\n\n.. automodule:: astropy.io.fits.diff\n.. currentmodule:: astropy.io.fits\n\n:class:`FITSDiff`\n=================\n.. autoclass:: FITSDiff\n   :members:\n   :inherited-members:\n   :show-inheritance:\n\n:class:`HDUDiff`\n================\n.. autoclass:: HDUDiff\n   :members:\n   :inherited-members:\n   :show-inheritance:\n\n:class:`HeaderDiff`\n===================\n.. autoclass:: HeaderDiff\n   :members:\n   :inherited-members:\n   :show-inheritance:\n\n:class:`ImageDataDiff`\n======================\n.. autoclass:: ImageDataDiff\n   :members:\n   :inherited-members:\n   :show-inheritance:\n\n:class:`RawDataDiff`\n====================\n.. autoclass:: RawDataDiff\n   :members:\n   :inherited-members:\n   :show-inheritance:\n\n:class:`TableDataDiff`\n======================\n.. autoclass:: TableDataDiff\n   :members:\n   :inherited-members:\n   :show-inheritance:\n"},{"id":70,"name":"headers.rst","nodeType":"TextFile","path":"docs/io/fits/api","text":".. currentmodule:: astropy.io.fits\n\nHeaders\n*******\n\n:class:`Header`\n===============\n\n.. autoclass:: Header\n   :members:\n   :inherited-members:\n   :undoc-members:\n   :show-inheritance:\n"},{"id":71,"name":"hdulists.rst","nodeType":"TextFile","path":"docs/io/fits/api","text":".. currentmodule:: astropy.io.fits\n\nHDU Lists\n*********\n\n.. inheritance-diagram:: HDUList\n\n:class:`HDUList`\n================\n\n.. autoclass:: HDUList\n   :members:\n   :undoc-members:\n   :show-inheritance:\n"},{"id":72,"name":"images.rst","nodeType":"TextFile","path":"docs/io/fits/api","text":".. currentmodule:: astropy.io.fits\n\n.. _images:\n\nImages\n******\n\n`ImageHDU`\n==========\n\n.. autoclass:: ImageHDU\n   :members:\n   :inherited-members:\n   :show-inheritance:\n\n`CompImageHDU`\n==============\n\n.. autoclass:: CompImageHDU\n   :members:\n   :inherited-members:\n   :show-inheritance:\n\n`Section`\n---------\n\n.. autoclass:: Section\n   :members:\n   :inherited-members:\n   :show-inheritance:\n"},{"id":73,"name":"docs/io/fits/usage","nodeType":"Package"},{"id":74,"name":"scripts.rst","nodeType":"TextFile","path":"docs/io/fits/usage","text":"Executable Scripts\n******************\n\n``astropy`` installs a couple of useful utility programs on your system that are\nbuilt with ``astropy``.\n\nfitsinfo\n========\n.. automodule:: astropy.io.fits.scripts.fitsinfo\n\nfitsheader\n==========\n.. automodule:: astropy.io.fits.scripts.fitsheader\n\nfitscheck\n=========\n.. automodule:: astropy.io.fits.scripts.fitscheck\n\nWith ``astropy`` installed, please run ``fitscheck --help`` to see the full\nprogram usage documentation.\n\n.. _fitsdiff:\n\nfitsdiff\n========\n\n.. currentmodule:: astropy.io.fits\n\n``fitsdiff`` provides a thin command-line wrapper around the :class:`FITSDiff`\ninterface. It outputs the report from a :class:`FITSDiff` of two FITS files,\nand like common diff-like commands returns a 0 status code if no differences\nwere found, and 1 if differences were found:\n\nWith ``astropy`` installed, please run ``fitsdiff --help`` to see the full\nprogram usage documentation.\n"},{"id":75,"name":"table.rst","nodeType":"TextFile","path":"docs/io/fits/usage","text":"\n.. currentmodule:: astropy.io.fits\n\nTable Data\n**********\n\nIn this chapter, we will discuss the data component in a table HDU. A table will\nalways be in an extension HDU, never in a primary HDU.\n\nThere are two kinds of tables in the FITS standard: binary tables and ASCII\ntables. Binary tables are more economical in storage and faster in data access\nand manipulation. ASCII tables store the data in a \"human readable\" form and\ntherefore take up more storage space as well as more processing time since the\nASCII text needs to be parsed into numerical values.\n\n.. note::\n\n    If you want to read or write a single table in FITS format then the\n    most convenient method is often via the high-level :ref:`table_io`. In\n    particular see the :ref:`Unified I/O FITS <table_io_fits>` section.\n\nTable Data as a Record Array\n============================\n\n\nWhat is a Record Array?\n-----------------------\n\nA record array is an array which contains records (i.e., rows) of heterogeneous\ndata types. Record arrays are available through the records module in the NumPy\nlibrary.\n\nHere is a sample record array::\n\n    >>> import numpy as np\n    >>> bright = np.rec.array([(1,'Sirius', -1.45, 'A1V'),\n    ...                        (2,'Canopus', -0.73, 'F0Ib'),\n    ...                        (3,'Rigil Kent', -0.1, 'G2V')],\n    ...                       formats='int16,a20,float32,a10',\n    ...                       names='order,name,mag,Sp')\n\nIn this example, there are three records (rows) and four fields (columns). The\nfirst field is a short integer, the second a character string (of length 20),\nthe third a floating point number, and the fourth a character string (of length\n10). Each record has the same (heterogeneous) data structure.\n\nThe underlying data structure used for FITS tables is a class called\n:class:`FITS_rec` which is a specialized subclass of `numpy.recarray`. A\n:class:`FITS_rec` can be instantiated directly using the same initialization\nformat presented for plain recarrays as in the example above. You may also\ninstantiate a new :class:`FITS_rec` from a list of `astropy.io.fits.Column`\nobjects using the :meth:`FITS_rec.from_columns` class method. This has the\nexact same semantics as :meth:`BinTableHDU.from_columns` and\n:meth:`TableHDU.from_columns`, except that it only returns an actual FITS_rec\narray and not a whole HDU object.\n\n\nMetadata of a Table\n-------------------\n\nThe data in a FITS table HDU is basically a record array with added\nattributes. The metadata (i.e., information about the table data) are stored in\nthe header. For example, the keyword TFORM1 contains the format of the first\nfield, TTYPE2 the name of the second field, etc. NAXIS2 gives the number of\nrecords (rows) and TFIELDS gives the number of fields (columns). For FITS\ntables, the maximum number of fields is 999. The data type specified in TFORM\nis represented by letter codes for binary tables and a Fortran-like format\nstring for ASCII tables. Note that this is different from the format\nspecifications when constructing a record array.\n\n\nReading a FITS Table\n--------------------\n\nLike images, the ``.data`` attribute of a table HDU contains the data of the\ntable.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Reading a FITS Table with astropy.io.fits\n\nTo read a FITS Table::\n\n\n    >>> from astropy.io import fits\n    >>> fits_table_filename = fits.util.get_testdata_filepath('btable.fits')\n\n    >>> hdul = fits.open(fits_table_filename)  # open a FITS file\n    >>> data = hdul[1].data  # assume the first extension is a table\n    >>> # show the first two rows\n    >>> first_two_rows = data[:2]\n    >>> first_two_rows  # doctest: +SKIP\n    [(1, 'Sirius', -1.45000005, 'A1V') (2, 'Canopus', -0.73000002, 'F0Ib')]\n    >>> # show the values in field \"mag\"\n    >>> magnitudes = data['mag']\n    >>> magnitudes  # doctest: +SKIP\n    array([-1.45000005, -0.73000002, -0.1       ], dtype=float32)\n    >>> # columns can be referenced by index too\n    >>> names = data.field(1)\n    >>> names.tolist() # doctest: +SKIP\n    ['Sirius', 'Canopus', 'Rigil Kent']\n    >>> hdul.close()\n\nNote that in ``astropy``, when using the ``field()`` method, it is 0-indexed\nwhile the suffixes in header keywords such as TFORM is 1-indexed. So,\n``data.field(0)`` is the data in the column with the name specified in TTYPE1\nand format in TFORM1.\n\n.. warning::\n\n    The FITS format allows table columns with a zero-width data format, such as\n    ``'0D'``. This is probably intended as a space-saving measure on files in\n    which that column contains no data. In such files, the zero-width columns\n    are omitted when accessing the table data, so the indexes of fields might\n    change when using the ``field()`` method. For this reason, if you expect\n    to encounter files containing zero-width columns it is recommended to access\n    fields by name rather than by index.\n\n..\n  EXAMPLE END\n\n\nTable Operations\n================\n\n\nSelecting Records in a Table\n----------------------------\n\nLike image data, we can use the same \"mask array\" idea to pick out desired\nrecords from a table and make a new table out of it.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Selecting Records in a Table Using a \"Mask Array\"\n\nAssuming the table's second field as having the name 'magnitude', an output\ntable containing all the records of magnitude > -0.5 from the input table is\ngenerated::\n\n    >>> with fits.open(fits_table_filename) as hdul:\n    ...     data = hdul[1].data\n    ...     mask = data['mag'] > -0.5\n    ...     newdata = data[mask]\n    ...     hdu = fits.BinTableHDU(data=newdata)\n    ...     hdu.writeto('newtable.fits')\n\nIt is also possible to update the data from the HDU object in-place::\n\n    >>> with fits.open(fits_table_filename) as hdul:\n    ...     hdu = hdul[1]\n    ...     mask = hdu.data['mag'] > -0.5\n    ...     hdu.data = hdu.data[mask]\n    ...     hdu.writeto('newtable2.fits')\n\n..\n  EXAMPLE END\n\nMerging Tables\n--------------\n\nMerging different tables is very convenient in ``astropy``.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Merging FITS Tables\n\nTo merge the column definitions of the input tables::\n\n    >>> fits_other_table_filename = fits.util.get_testdata_filepath('table.fits')\n\n    >>> with fits.open(fits_table_filename) as hdul1:\n    ...     with fits.open(fits_other_table_filename) as hdul2:\n    ...         new_columns = hdul1[1].columns + hdul2[1].columns\n    ...         new_hdu = fits.BinTableHDU.from_columns(new_columns)\n    >>> new_columns\n    ColDefs(\n            name = 'order'; format = 'I'\n            name = 'name'; format = '20A'\n            name = 'mag'; format = 'E'\n            name = 'Sp'; format = '10A'\n            name = 'target'; format = '20A'\n            name = 'V_mag'; format = 'E'\n        )\n\nThe number of fields in the output table will be the sum of numbers of fields\nof the input tables. Users have to make sure the input tables do not share any\ncommon field names. The number of records in the output table will be the\nlargest number of records of all input tables. The expanded slots for the\noriginally shorter table(s) will be zero (or blank) filled.\n\nAnother version of this example can be used to append a new column to a\ntable. Updating an existing table with a new column is generally more\ndifficult than it is worth, but you can \"append\" a column to a table by creating\na new table with columns from the existing table plus the new column(s)::\n\n    >>> with fits.open(fits_table_filename) as hdul:\n    ...     orig_table = hdul[1].data\n    ...     orig_cols = orig_table.columns\n    >>> new_cols = fits.ColDefs([\n    ...     fits.Column(name='NEWCOL1', format='D',\n    ...                 array=np.zeros(len(orig_table))),\n    ...     fits.Column(name='NEWCOL2', format='D',\n    ...                 array=np.zeros(len(orig_table)))])\n    >>> hdu = fits.BinTableHDU.from_columns(orig_cols + new_cols)\n\nNow ``newtable.fits`` contains a new table with the original table, plus the\ntwo new columns filled with zeros.\n\n..\n  EXAMPLE END\n\nAppending Tables\n----------------\n\nAppending one table after another is slightly trickier, since the two tables\nmay have different field attributes.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Appending to FITS Tables\n\nHere, the first example is to append by field indices, and the second one is to\nappend by field names. In both cases, the output table will inherit the column\nattributes (name, format, etc.) of the first table::\n\n    >>> with fits.open(fits_table_filename) as hdul1:\n    ...     with fits.open(fits_table_filename) as hdul2:\n    ...         nrows1 = hdul1[1].data.shape[0]\n    ...         nrows2 = hdul2[1].data.shape[0]\n    ...         nrows = nrows1 + nrows2\n    ...         hdu = fits.BinTableHDU.from_columns(hdul1[1].columns, nrows=nrows)\n    ...         for colname in hdul1[1].columns.names:\n    ...             hdu.data[colname][nrows1:] = hdul2[1].data[colname]\n\n..\n  EXAMPLE END\n\nScaled Data in Tables\n=====================\n\nA table field's data, like an image, can also be scaled. Scaling in a table has\na more generalized meaning than in images. In images, the physical data is a\nsimple linear transformation from the storage data. The table fields do have\nsuch a construct too, where BSCALE and BZERO are stored in the header as TSCALn\nand TZEROn. In addition, boolean columns and ASCII tables' numeric fields are\nalso generalized \"scaled\" fields, but without TSCAL and TZERO.\n\nAll scaled fields, like the image case, will take extra memory space as well as\nprocessing. So, if high performance is desired, try to minimize the use of\nscaled fields.\n\nAll of the scalings are done for the user, so the user only sees the physical\ndata. Thus, there is no need to worry about scaling back and forth between the\nphysical and storage column values.\n\n\nCreating a FITS Table\n=====================\n\n.. _column_creation:\n\nColumn Creation\n---------------\n\nTo create a table from scratch, it is necessary to create individual columns\nfirst. A :class:`Column` constructor needs the minimal information of column\nname and format. Here is a summary of all allowed formats for a binary table:\n\n.. parsed-literal::\n\n    **FITS format code         Description                     8-bit bytes**\n\n    L                        logical (Boolean)               1\n    X                        bit                             \\*\n    B                        Unsigned byte                   1\n    I                        16-bit integer                  2\n    J                        32-bit integer                  4\n    K                        64-bit integer                  8\n    A                        character                       1\n    E                        single precision float (32-bit) 4\n    D                        double precision float (64-bit) 8\n    C                        single precision complex        8\n    M                        double precision complex        16\n    P                        array descriptor                8\n    Q                        array descriptor                16\n\nWe will concentrate on binary tables in this chapter. ASCII tables will be\ndiscussed in a later chapter. The less frequently used X format (bit array) and\nP format (used in variable length tables) will also be discussed in a later\nchapter.\n\nBesides the required name and format arguments in constructing a\n:class:`Column`, there are many optional arguments which can be used in\ncreating a column. Here is a list of these arguments and their corresponding\nheader keywords and descriptions:\n\n.. parsed-literal::\n\n    **Argument        Corresponding         Description**\n    **in Column()     header keyword**\n\n    name            TTYPE                 column name\n    format          TFORM                 column format\n    unit            TUNIT                 unit\n    null            TNULL                 null value (only for B, I, and J)\n    bscale          TSCAL                 scaling factor for data\n    bzero           TZERO                 zero point for data scaling\n    disp            TDISP                 display format\n    dim             TDIM                  multi-dimensional array spec\n    start           TBCOL                 starting position for ASCII table\n    coord_type      TCTYP                 coordinate/axis type\n    coord_unit      TCUNI                 coordinate/axis unit\n    coord_ref_point TCRPX                 pixel coordinate of the reference point\n    coord_ref_value TCRVL                 coordinate value at reference point\n    coord_inc       TCDLT                 coordinate increment at reference point\n    time_ref_pos    TRPOS                 reference position for a time coordinate column\n    ascii                                 specifies a column for an ASCII table\n    array                                 the data of the column\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Creating a FITS Table\n\nHere are a few Columns using various combinations of the optional arguments::\n\n    >>> counts = np.array([312, 334, 308, 317])\n    >>> names = np.array(['NGC1', 'NGC2', 'NGC3', 'NGC4'])\n    >>> values = np.arange(2*2*4).reshape(4, 2, 2)\n    >>> col1 = fits.Column(name='target', format='10A', array=names)\n    >>> col2 = fits.Column(name='counts', format='J', unit='count', array=counts)\n    >>> col3 = fits.Column(name='notes', format='A10')\n    >>> col4 = fits.Column(name='spectrum', format='10E')\n    >>> col5 = fits.Column(name='flag', format='L', array=[True, False, True, True])\n    >>> col6 = fits.Column(name='intarray', format='4I', dim='(2, 2)', array=values)\n\nIn this example, formats are specified with the FITS letter codes. When there\nis a number (>1) preceding a (numeric type) letter code, it means each cell in\nthat field is a one-dimensional array. In the case of column \"col4\", each cell\nis an array (a NumPy array) of 10 elements. And in the case of column \"col6\",\nwith the use of the \"dim\" argument, each cell is a multi-dimensional array of\n2x2 elements.\n\nFor character string fields, the number should be to the *left* of the letter\n'A' when creating binary tables, and should be to the *right* when creating\nASCII tables. However, as this is a common confusion, both formats are\nunderstood when creating binary tables (note, however, that upon writing to a\nfile the correct format will be written in the header). So, for columns \"col1\"\nand \"col3\", they both have 10 characters in each of their cells. For numeric\ndata type, the dimension number must be before the letter code, not after.\n\nAfter the columns are constructed, the :meth:`BinTableHDU.from_columns` class\nmethod can be used to construct a table HDU. We can either go through the\ncolumn definition object::\n\n    >>> coldefs = fits.ColDefs([col1, col2, col3, col4, col5, col6])\n    >>> hdu = fits.BinTableHDU.from_columns(coldefs)\n    >>> coldefs\n    ColDefs(\n        name = 'target'; format = '10A'\n        name = 'counts'; format = 'J'; unit = 'count'\n        name = 'notes'; format = '10A'\n        name = 'spectrum'; format = '10E'\n        name = 'flag'; format = 'L'\n        name = 'intarray'; format = '4I'; dim = '(2, 2)'\n    )\n\nor directly use the :meth:`BinTableHDU.from_columns` method::\n\n    >>> hdu = fits.BinTableHDU.from_columns([col1, col2, col3, col4, col5, col6])\n    >>> hdu.columns\n    ColDefs(\n        name = 'target'; format = '10A'\n        name = 'counts'; format = 'J'; unit = 'count'\n        name = 'notes'; format = '10A'\n        name = 'spectrum'; format = '10E'\n        name = 'flag'; format = 'L'\n        name = 'intarray'; format = '4I'; dim = '(2, 2)'\n    )\n\n.. note::\n\n    Users familiar with older versions of ``astropy`` will wonder what\n    happened to ``astropy.io.fits.new_table``. :meth:`BinTableHDU.from_columns`\n    and its companion for ASCII tables :meth:`TableHDU.from_columns` are the\n    same in the arguments they accept and their behavior, but make it\n    more explicit as to what type of table HDU they create.\n\nA look at the newly created HDU's header will show that relevant keywords are\nproperly populated::\n\n    >>> hdu.header\n    XTENSION= 'BINTABLE'           / binary table extension\n    BITPIX  =                    8 / array data type\n    NAXIS   =                    2 / number of array dimensions\n    NAXIS1  =                   73 / length of dimension 1\n    NAXIS2  =                    4 / length of dimension 2\n    PCOUNT  =                    0 / number of group parameters\n    GCOUNT  =                    1 / number of groups\n    TFIELDS =                    6 / number of table fields\n    TTYPE1  = 'target  '\n    TFORM1  = '10A     '\n    TTYPE2  = 'counts  '\n    TFORM2  = 'J       '\n    TUNIT2  = 'count   '\n    TTYPE3  = 'notes   '\n    TFORM3  = '10A     '\n    TTYPE4  = 'spectrum'\n    TFORM4  = '10E     '\n    TTYPE5  = 'flag    '\n    TFORM5  = 'L       '\n    TTYPE6  = 'intarray'\n    TFORM6  = '4I      '\n    TDIM6   = '(2, 2)  '\n\n.. warning::\n\n    It should be noted that when creating a new table with\n    :meth:`BinTableHDU.from_columns`, an in-memory copy of all of the input\n    column arrays is created. This is because it is not guaranteed that the\n    columns are arranged contiguously in memory in row-major order (in fact,\n    they are most likely not), so they have to be combined into a new array.\n\nHowever, if the array data *is* already contiguous in memory, such as in an\nexisting record array, a kludge can be used to create a new table HDU without\nany copying. First, create the Columns as before, but without using the\n``array=`` argument::\n\n    >>> col1 = fits.Column(name='target', format='10A')\n\nThen call :meth:`BinTableHDU.from_columns`::\n\n    >>> hdu = fits.BinTableHDU.from_columns([col1, col2, col3, col4, col5])\n\nThis will create a new table HDU as before, with the correct column\ndefinitions, but an empty data section. Now you can assign your array directly\nto the HDU's data attribute:\n\n.. doctest-skip::\n\n    >>> hdu.data = mydata\n\nIn a future version of ``astropy``, table creation will be simplified and this\nprocess will not be necessary.\n\n..\n  EXAMPLE END\n\n.. _fits_time_column:\n\nFITS Tables with Time Columns\n=============================\n\nThe `FITS Time standard paper\n<https://ui.adsabs.harvard.edu/abs/2015A%26A...574A..36R/>`_ defines the formats\nand keywords used to represent timing information in FITS files. The ``astropy``\nFITS package provides support for reading and writing native\n`~astropy.time.Time` columns and objects using this format. This is done\nwithin the :ref:`table_io_fits` unified I/O interface and examples of usage can\nbe found in the :ref:`fits_astropy_native` section. The support is not\ncomplete and only a subset of the full standard is implemented.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  FITS Tables with Time Columns\n\nThe following is an example of a Header extract of a binary table (event list)\nwith a time column:\n\n.. parsed-literal::\n\n    COMMENT      ---------- Globally valid key words ----------------\n    TIMESYS = ’TT      ’          / Time system\n    MJDREF  = 50814.000000000000  / MJD zero point for (native) TT (= 1998-01-01)\n    MJD-OBS = 53516.257939301￼￼     / MJD for observation in (native) TT\n\n    COMMENT      ---------- Time Column -----------------------\n    TTYPE1  = ’Time    ’          / S/C TT corresponding to mid-exposure\n    TFORM1  = ’2D      ’          / format of field\n    TUNIT1  = ’s       ’\n    TCTYP1  = ’TT      ’\n    TCNAM1  = ’Terrestrial Time’  / This is TT\n    TCUNI1  = ’s       ’\n\n..\n  EXAMPLE END\n\nHowever, the FITS standard and the ``astropy`` Time object are not perfectly\nmapped and some compromises must be made. To help the user understand how the\n``astropy`` code deals with these situations, the following text describes the\napproach that ``astropy`` takes in some detail.\n\nTo create FITS columns which adhere to the FITS Time standard, we have taken\ninto account the following important points stated in the `FITS Time paper\n<https://ui.adsabs.harvard.edu/abs/2015A%26A...574A..36R/>`_.\n\nThe strategy used to store `~astropy.time.Time` columns in FITS tables is to\ncreate a `~astropy.io.fits.Header` with the appropriate time coordinate\nglobal reference keywords and the column-specific override keywords. The\nmodule ``astropy.io.fits.fitstime`` deals with the reading and writing of\nTime columns.\n\nThe following keywords set the Time Coordinate Frame:\n\n* TIME SCALE\n\n  The most important of all of the metadata is the time scale which is a\n  specification for measuring time.\n\n  .. parsed-literal::\n\n      **TIMESYS** (string-valued)\n      Time scale; default UTC\n\n      **TCTYPn** (string-valued)\n      Column-specific override keyword\n\n  The global time scale may be overridden by a time scale recorded in the table\n  equivalent keyword ``TCTYPn`` for time coordinates in FITS table columns.\n  ``TCTYna`` is used for alternate coordinates.\n\n* TIME REFERENCE\n\n  The reference point in time to which all times in the HDU are relative.\n  Since there are no context-specific reference times in case there are\n  multiple time columns in the same table, we need to adjust the reference\n  times for the columns using some other keywords.\n\n  The reference point in time shall be specified through one of the three\n  following keywords, which are listed in decreasing order of preference:\n\n  .. parsed-literal::\n\n      **MJDREF** (floating-valued)\n      Reference time in MJD\n\n      **JDREF** (floating-valued)\n      Reference time in JD\n\n      **DATEREF** (datetime-valued)\n      Reference time in ISO-8601\n\n  The time reference keywords (MJDREF, JDREF, DATEREF) are interpreted using the\n  time scale specified in ``TIMESYS``.\n\n  .. note::\n\n     If none of the three keywords are present, there is no problem as long as\n     all times in the HDU are expressed in ISO-8601 ``Datetime Strings`` format:\n     ``CCYY-MM-DD[Thh:mm:ss[.s...]]`` (e.g., ``\"2015-04-05T12:22:33.8\"``);\n     otherwise MJDREF = 0.0 must be assumed.\n\n     The value of the reference time has global validity for all time values,\n     but it does not have a particular time scale associated with it. Thus we\n     need to use ``TCRVLn`` (time coordinate reference value) keyword to\n     compensate for the time scale differences.\n\n* TIME REFERENCE POSITION\n\n  The reference position, specified by the keyword ``TREFPOS``, specifies the\n  spatial location at which the time is valid, either where the observation was\n  made or the point in space for which light-time corrections have been applied.\n  This may be a standard location (such as ``GEOCENTER`` or ``TOPOCENTER``) or\n  a point in space defined by specific coordinates.\n\n  .. parsed-literal::\n\n      **TREFPOS** (string-valued)\n      Time reference position; default TOPOCENTER\n\n      **TRPOSn** (string-valued)\n      Column-specific override keyword\n\n  .. note::\n\n     For TOPOCENTER, we need to specify the observatory location\n     (ITRS Cartesian coordinates or geodetic latitude/longitude/height) in the\n     ``OBSGEO-*`` keywords.\n\n* TIME REFERENCE DIRECTION\n\n  If any pathlength corrections have been applied to the time stamps (i.e., if\n  the reference position is not ``TOPOCENTER`` for observational data), the\n  reference direction that is used in calculating the pathlength delay should\n  be provided in order to maintain a proper analysis trail of the data.\n  However, this is useful only if there is also information available on the\n  location from where the observation was made (the observatory location).\n\n  The reference direction is indicated through a reference to specific keywords.\n  These keywords may explicitly hold the direction or indicate columns holding\n  the coordinates.\n\n  .. parsed-literal::\n\n      **TREFDIR** (string-valued)\n      Pointer to time reference direction\n\n      **TRDIRn** (string-valued)\n      Column-specific override keyword\n\n* TIME UNIT\n\n  The FITS standard recommends the time unit to be one of the allowed ones\n  in the specification.\n\n  .. parsed-literal::\n\n      **TIMEUNIT** (string-valued)\n      Time unit; default s\n\n      **TCUNIn** (string-valued)\n      Column-specific override\n\n* TIME OFFSET\n\n  It is sometimes convenient to be able to apply a uniform clock correction\n  in bulk by putting that number in a single keyword. A second use\n  for a time offset is to set a zero offset to a relative time series,\n  allowing zero-relative times, or higher precision, in the time stamps.\n  Its default value is zero.\n\n  .. parsed-literal::\n\n      **TIMEOFFS** (floating-valued)\n      This has global validity\n\n* The absolute, relative errors and time resolution, time binning can be used\n  when needed.\n\n\nThe following keywords define the global time informational keywords:\n\n* DATE and DATE-* keywords\n\n  These define the date of HDU creation and observation in ISO-8601.\n  ``DATE`` is in UTC if the file is constructed on the Earth’s surface\n  and others are in the time scale given by ``TIMESYS``.\n\n* MJD-* keywords\n\n  These define the same as above, but in ``MJD`` (Modified Julian Date).\n\nThe implementation writes a subset of the above FITS keywords, which map\nto the Time metadata. Time is intrinsically a coordinate and hence shares\nkeywords with the ``World Coordinate System`` specification for spatial\ncoordinates. Therefore, while reading FITS tables with time columns,\nthe verification that a coordinate column is indeed time is done using\nthe FITS WCS standard rules and suggestions.\n"},{"col":0,"comment":"null","endLoc":27,"header":"def pytest_configure(config)","id":76,"name":"pytest_configure","nodeType":"Function","startLoc":21,"text":"def pytest_configure(config):\n    PYTEST_HEADER_MODULES['PyERFA'] = 'erfa'\n    PYTEST_HEADER_MODULES['Cython'] = 'cython'\n    PYTEST_HEADER_MODULES['Scikit-image'] = 'skimage'\n    PYTEST_HEADER_MODULES['asdf'] = 'asdf'\n    PYTEST_HEADER_MODULES['pyarrow'] = 'pyarrow'\n    TESTED_VERSIONS['Astropy'] = __version__"},{"col":0,"comment":"null","endLoc":34,"header":"def pytest_report_header(config)","id":77,"name":"pytest_report_header","nodeType":"Function","startLoc":31,"text":"def pytest_report_header(config):\n    # This gets added after the pytest-astropy-header output.\n    return (f'ARCH_ON_CI: {os.environ.get(\"ARCH_ON_CI\", \"undefined\")}\\n'\n            f'IS_CRON: {os.environ.get(\"IS_CRON\", \"undefined\")}\\n')"},{"id":78,"name":"verification.rst","nodeType":"TextFile","path":"docs/io/fits/usage","text":".. currentmodule:: astropy.io.fits\n\n..  _fits_io_verification:\n\nVerification\n************\n\n``astropy`` has built in a flexible scheme to verify FITS data conforming to\nthe FITS standard. The basic verification philosophy in ``astropy`` is to be\ntolerant with input and strict with output.\n\nWhen ``astropy`` reads a FITS file which does not conform to FITS standard, it\nwill not raise an error and exit. It will try to make the best educated\ninterpretation and only gives up when the offending data is accessed and no\nunambiguous interpretation can be reached.\n\nOn the other hand, when writing to an output FITS file, the content to be\nwritten must be strictly compliant to the FITS standard by default. This\ndefault behavior can be overwritten by several other options, so the user will\nnot be held up because of a minor standard violation.\n\n\nFITS Standard\n=============\n\nSince FITS standard is a \"loose\" standard, there are many places the violation\ncan occur and to enforce them all will be almost impossible. It is not uncommon\nfor major observatories to generate data products which are not 100% FITS\ncompliant. Some observatories have also developed their own nonstandard\ndialect and some of these are so prevalent that they have become de facto\nstandards. Examples include the long string value and the use of the CONTINUE\ncard.\n\nThe violation of the standard can happen at different levels of the data\nstructure. ``astropy``'s verification scheme is developed on these hierarchical\nlevels. Here are the three ``astropy`` verification levels:\n\n1. The HDU List\n\n2. Each HDU\n\n3. Each Card in the HDU Header\n\nThese three levels correspond to the three categories of objects:\n:class:`HDUList`, any HDU (e.g., :class:`PrimaryHDU`, :class:`ImageHDU`, etc.),\nand :class:`Card`. They are the only objects having the ``verify()`` method.\nMost other classes in `astropy.io.fits` do not have a ``verify()`` method.\n\nIf ``verify()`` is called at the HDU List level, it verifies standard\ncompliance at all three levels, but a call of ``verify()`` at the Card level\nwill only check the compliance of that Card. Since ``astropy`` is tolerant when\nreading a FITS file, no ``verify()`` is called on input. On output,\n``verify()`` is called with the most restrictive option as the default.\n\n\nVerification Options\n====================\n\nThere are several options accepted by all verify(option) calls in ``astropy``.\nIn addition, they available for the ``output_verify`` argument of the following\nmethods: ``close()``, ``writeto()``, and ``flush()``. In these cases, they are\npassed to a ``verify()`` call within these methods. The available options are:\n\n**exception**\n\nThis option will raise an exception if any FITS standard is violated. This is\nthe default option for output (i.e., when ``writeto()``, ``close()``, or\n``flush()`` is called). If a user wants to overwrite this default on output, the\nother options listed below can be used.\n\n**warn**\n\nThis option is the same as the ignore option but will send warning messages. It\nwill not try to fix any FITS standard violations whether fixable or not.\n\n**ignore**\n\nThis option will ignore any FITS standard violation. On output, it will write\nthe HDU List content to the output FITS file, whether or not it is conforming\nto the FITS standard.\n\nThe ignore option is useful in the following situations:\n\n1. An input FITS file with nonstandard formatting is read and the user wants\n   to copy or write out to an output file. The nonstandard formatting will be\n   preserved in the output file.\n\n2. A user wants to create a nonstandard FITS file on purpose, possibly for\n   testing or consistency.\n\nNo warning message will be printed out. This is like a silent warning option\n(see below).\n\n**fix**\n\nThis option will try to fix any FITS standard violations. It is not always\npossible to fix such violations. In general, there are two kinds of FITS\nstandard violations: fixable and non-fixable. For example, if a keyword has a\nfloating number with an exponential notation in lower case 'e' (e.g., 1.23e11)\ninstead of the upper case 'E' as required by the FITS standard, it is a fixable\nviolation. On the other hand, a keyword name like 'P.I.' is not fixable, since\nit will not know what to use to replace the disallowed periods. If a violation\nis fixable, this option will print out a message noting it is fixed. If it is\nnot fixable, it will throw an exception.\n\nThe principle behind fixing is to do no harm. For example, it is plausible to\n'fix' a Card with a keyword name like 'P.I.' by deleting it, but ``astropy``\nwill not take such action to hurt the integrity of the data.\n\nNot all fixes may be the \"correct\" fix, but at least ``astropy`` will try to\nmake the fix in such a way that it will not throw off other FITS readers.\n\n**silentfix**\n\nSame as fix, but will not print out informative messages. This may be useful in\na large script where the user does not want excessive harmless messages. If the\nviolation is not fixable, it will still throw an exception.\n\nIn addition the following combined options are available:\n\n * **fix+ignore**\n * **fix+warn**\n * **fix+exception**\n * **silentfix+ignore**\n * **silentfix+warn**\n * **silentfix+exception**\n\nThese options combine the semantics of the basic options. For example,\n``silentfix+exception`` is actually equivalent to just ``silentfix`` in that\nfixable errors will be fixed silently, but any unfixable errors will raise an\nexception. On the other hand, ``silentfix+warn`` will issue warnings for\nunfixable errors, but will stay silent about any fixed errors.\n\n\nVerifications at Different Data Object Levels\n=============================================\n\nWe will examine what ``astropy``'s verification does at the three different\nlevels:\n\n\nVerification at HDUList\n-----------------------\n\nAt the HDU List level, the verification is only for two simple cases:\n\n1. Verify that the first HDU in the HDU list is a primary HDU. This is a\n   fixable case. The fix is to insert a minimal primary HDU into the HDU list.\n\n2. Verify the second or later HDU in the HDU list is not a primary HDU.\n   Violation will not be fixable.\n\n\nVerification at Each HDU\n------------------------\n\nFor each HDU, the mandatory keywords, their locations in the header, and their\nvalues will be verified. Each FITS HDU has a fixed set of required keywords in\na fixed order. For example, the primary HDU's header must at least have the\nfollowing keywords:\n\n.. parsed-literal::\n\n    SIMPLE =                     T /\n    BITPIX =                     8 /\n    NAXIS  =                     0\n\nIf any of the mandatory keywords are missing or in the wrong order, the fix\noption will fix them::\n\n    >>> from astropy.io import fits\n    >>> filename = fits.util.get_testdata_filepath('verify.fits')\n    >>> hdul = fits.open(filename)\n    >>> hdul[0].header\n    SIMPLE  =                    T / conforms to FITS standard\n    NAXIS   =                    0 / NUMBER OF AXES\n    BITPIX  =                    8 / BITS PER PIXEL\n    >>> hdul[0].verify('fix') # doctest: +SHOW_WARNINGS\n    VerifyWarning: Verification reported errors:\n    VerifyWarning: 'BITPIX' card at the wrong place (card 2).\n      Fixed by moving it to the right place (card 1).\n    VerifyWarning: Note: astropy.io.fits uses zero-based indexing.\n    >>> hdul[0].header           # voila!\n    SIMPLE  =                    T / conforms to FITS standard\n    BITPIX  =                    8 / BITS PER PIXEL\n    NAXIS   =                    0 / NUMBER OF AXES\n    >>> hdul.close()\n\nVerification at Each Card\n-------------------------\n\nThe lowest level, the Card, also has the most complicated verification\npossibilities.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Verification at Each Card in astropy.io.fits\n\nHere is a list of fixable and not fixable Cards:\n\nFixable Cards:\n\n1. Floating point numbers with lower case 'e' or 'd'::\n\n    >>> from astropy.io import fits\n    >>> c = fits.Card.fromstring('FIX1    = 2.1e23')\n    >>> c.verify('silentfix')\n    >>> print(c)\n    FIX1    =               2.1E23\n\n2. The equal sign is before column nine in the card image::\n\n    >>> c = fits.Card.fromstring('FIX2= 2')\n    >>> c.verify('silentfix')\n    >>> print(c)\n    FIX2    =                    2\n\n3. String value without enclosing quotes::\n\n    >>> c = fits.Card.fromstring('FIX3    = string value without quotes')\n    >>> c.verify('silentfix')\n    >>> print(c)\n    FIX3    = 'string value without quotes'\n\n4. Missing equal sign before column nine in the card image.\n\n5. Space between numbers and E or D in floating point values::\n\n    >>> c = fits.Card.fromstring('FIX5    = 2.4 e 03')\n    >>> c.verify('silentfix')\n    >>> print(c)\n    FIX5    =               2.4E03\n\n6. Unparsable values will be \"fixed\" as a string::\n\n    >>> c = fits.Card.fromstring('FIX6    = 2 10 ')\n    >>> c.verify('fix+warn') # doctest: +SHOW_WARNINGS\n    VerifyWarning: Verification reported errors:\n    VerifyWarning: Card 'FIX6' is not FITS standard\n     (invalid value string: '2 10').\n       Fixed 'FIX6' card to meet the FITS standard.\n    VerifyWarning: Note: astropy.io.fits uses zero-based indexing.\n    >>> print(c)\n    FIX6    = '2 10    '\n\nUnfixable Cards:\n\n1. Illegal characters in keyword name.\n\nWe will summarize the verification with a \"life-cycle\" example::\n\n    >>> h = fits.PrimaryHDU()  # create a PrimaryHDU\n    >>> # Try to add an non-standard FITS keyword 'P.I.' (FITS does no allow\n    >>> # '.' in the keyword), if using the update() method - doesn't work!\n    >>> h.header['P.I.'] = 'Hubble' # doctest: +SHOW_WARNINGS\n    VerifyWarning: Keyword name 'P.I.' is greater than 8 characters or\n     contains characters not allowed by the FITS standard;\n      a HIERARCH card will be created.\n    >>> # Have to do it the hard way (so a user will not do this by accident)\n    >>> # First, create a card image and give verbatim card content (including\n    >>> # the proper spacing, but no need to add the trailing blanks)\n    >>> c = fits.Card.fromstring(\"P.I. = 'Hubble'\")\n    >>> h.header.append(c)  # then append it to the header\n    >>> # Now if we try to write to a FITS file, the default output\n    >>> # verification will not take it.\n    >>> h.writeto('pi.fits')  # doctest: +IGNORE_EXCEPTION_DETAIL\n    Traceback (most recent call last):\n     ...\n    VerifyError: HDU 0:\n        Card 5:\n            Card 'P.I. ' is not FITS standard (equal sign not at column 8).\n            Illegal keyword name 'P.I. '\n    >>> # Must set the output_verify argument to 'ignore', to force writing a\n    >>> # non-standard FITS file\n    >>> h.writeto('pi.fits', output_verify='ignore')\n    >>> # Now reading a non-standard FITS file\n    >>> # astropy.io.fits is magnanimous in reading non-standard FITS files\n    >>> hdul = fits.open('pi.fits')\n    >>> hdul[0].header # doctest: +SHOW_WARNINGS\n    SIMPLE  =            T / conforms to FITS standard\n    BITPIX  =            8 / array data type\n    NAXIS   =            0 / number of array dimensions\n    EXTEND  =            T\n    HIERARCH P.I. = 'Hubble  '\n    P.I.    = 'Hubble  '\n    VerifyWarning: Verification reported errors:\n    VerifyWarning: Card 'P.I. ' is not FITS standard (equal sign\n     not at column 8).  Fixed 'P.I. ' card to meet the FITS standard.\n    VerifyWarning: Unfixable error: Illegal keyword name 'P.I. '\n    VerifyWarning: Note: astropy.io.fits uses zero-based indexing.\n    >>> # even when you try to access the offending keyword, it does NOT\n    >>> # complain\n    >>> hdul[0].header['p.i.']\n    'Hubble'\n    >>> # But if you want to make sure if there is anything wrong/non-standard,\n    >>> # use the verify() method\n    >>> hdul.verify() # doctest: +SHOW_WARNINGS\n    VerifyWarning: Verification reported errors:\n    VerifyWarning: HDU 0:\n    VerifyWarning:     Card 5:\n    VerifyWarning:         Illegal keyword name 'P.I. '\n    VerifyWarning: Note: astropy.io.fits uses zero-based indexing.\n    >>> hdul.close()\n\n..\n  EXAMPLE END\n\nVerification Using the FITS Checksum Keyword Convention\n=======================================================\n\nThe North American FITS committee has reviewed the FITS Checksum Keyword\nConvention for possible adoption as a FITS Standard. This convention provides\nan integrity check on information contained in FITS HDUs. The convention\nconsists of two header keyword cards: CHECKSUM and DATASUM. The CHECKSUM\nkeyword is defined as an ASCII character string whose value forces the 32-bit\n1's complement checksum accumulated over all the 2880-byte FITS logical records\nin the HDU to equal negative zero. The DATASUM keyword is defined as a\ncharacter string containing the unsigned integer value of the 32-bit 1's\ncomplement checksum of the data records in the HDU. Verifying the\naccumulated checksum is still equal to negative zero provides a fairly reliable\nway to determine that the HDU has not been modified by subsequent data\nprocessing operations or corrupted while copying or storing the file on\nphysical media.\n\nIn order to avoid any impact on performance, by default ``astropy`` will not\nverify HDU checksums when a file is opened or generate checksum values when a\nfile is written. In fact, CHECKSUM and DATASUM cards are automatically removed\nfrom HDU headers when a file is opened, and any CHECKSUM or DATASUM cards are\nstripped from headers when an HDU is written to a file. In order to verify the\nchecksum values for HDUs when opening a file, the user must supply the checksum\nkeyword argument in the call to the open convenience function with a value of\nTrue. When this is done, any checksum verification failure will cause a\nwarning to be issued (via the warnings module). If checksum verification is\nrequested in the open, and no CHECKSUM or DATASUM cards exist in the HDU\nheader, the file will open without comment. Similarly, in order to output the\nCHECKSUM and DATASUM cards in an HDU header when writing to a file, the user\nmust supply the checksum keyword argument with a value of True in the call to\nthe ``writeto()`` function. It is possible to write only the DATASUM card to the\nheader by supplying the checksum keyword argument with a value of 'datasum'.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Verification Using the FITS Checksum Keyword Convention\n\nTo verify the checksum values for HDUs when opening a file::\n\n    >>> # Open the file checksum.fits verifying the checksum values for all HDUs\n    >>> filename = fits.util.get_testdata_filepath('checksum.fits')\n    >>> hdul = fits.open(filename, checksum=True)\n    >>> hdul.close()\n    >>> # Open the file in.fits where checksum verification fails\n    >>> filename = fits.util.get_testdata_filepath('checksum_false.fits')\n    >>> hdul = fits.open(filename, checksum=True) # doctest: +SHOW_WARNINGS\n    AstropyUserWarning: Checksum verification failed for HDU ('PRIMARY', 1).\n    AstropyUserWarning: Datasum verification failed for HDU ('PRIMARY', 1).\n    AstropyUserWarning: Checksum verification failed for HDU ('RATE', 1).\n    AstropyUserWarning: Datasum verification failed for HDU ('RATE', 1).\n    >>> # Create file out.fits containing an HDU constructed from data\n    >>> # containing both CHECKSUM and DATASUM cards.\n    >>> data = hdul[0].data\n    >>> fits.writeto('out.fits', data=data, checksum=True)\n    >>> hdun = fits.open('out.fits', checksum=True)\n    >>> hdun.close()\n\n    >>> # Create file out.fits containing all the HDUs in the HDULIST\n    >>> # hdul with each HDU header containing only the DATASUM card\n    >>> hdul.writeto('out2.fits', checksum='datasum')\n\n    >>> # Create file out.fits containing the HDU hdu with both CHECKSUM\n    >>> # and DATASUM cards in the header\n    >>> hdu = hdul[1]\n    >>> hdu.writeto('out3.fits', checksum=True)\n\n    >>> # Append a new HDU constructed from array data to the end of\n    >>> # the file existingfile.fits with only the appended HDU\n    >>> # containing both CHECKSUM and DATASUM cards.\n    >>> fits.append('out3.fits', data, checksum=True)\n    >>> hdul.close()\n\n..\n  EXAMPLE END\n"},{"id":79,"name":"image.rst","nodeType":"TextFile","path":"docs/io/fits/usage","text":".. currentmodule:: astropy.io.fits\n\nImage Data\n**********\n\nIn this chapter, we will discuss the data component in an image HDU.\n\n\nImage Data as an Array\n======================\n\nA FITS primary HDU or an image extension HDU may contain image data. The\nfollowing discussions apply to both of these HDU classes. For most cases in\n``astropy``, it is a ``numpy`` array, having the shape specified by the NAXIS\nkeywords and the data type specified by the BITPIX keyword — unless the data is\nscaled, in which case see the next section. Here is a quick cross reference\nbetween allowed BITPIX values in FITS images and the ``numpy`` data types:\n\n.. parsed-literal::\n\n    **BITPIX**    **Numpy Data Type**\n    8         numpy.uint8 (note it is UNsigned integer)\n    16        numpy.int16\n    32        numpy.int32\n    64        numpy.int64\n    -32       numpy.float32\n    -64       numpy.float64\n\nTo recap, in ``numpy`` the arrays are 0-indexed and the axes are\nordered from slow to fast. So, if a FITS image has NAXIS1=300 and NAXIS2=400,\nthe ``numpy`` array of its data will have the shape of (400, 300).\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Image Data as an Array in astropy.io.fits\n\nHere is a summary of reading and updating image data values::\n\n    >>> from astropy.io import fits\n    >>> fits_image_filename = fits.util.get_testdata_filepath('test0.fits')\n\n    >>> with fits.open(fits_image_filename) as hdul:  # open a FITS file\n    ...     data = hdul[1].data  # assume the first extension is an image\n    >>> print(data[1, 4])   # get the pixel value at x=5, y=2\n    313\n    >>> # get values of the subsection from x=11 to 20, y=31 to 40 (inclusive)\n    >>> data[30:40, 10:20]\n    array([[314, 314, 313, 312, 313, 313, 313, 313, 313, 312],\n           [314, 314, 312, 313, 313, 311, 313, 312, 312, 314],\n           [314, 315, 313, 313, 313, 313, 315, 312, 314, 312],\n           [314, 313, 313, 314, 311, 313, 313, 313, 313, 313],\n           [313, 314, 312, 314, 312, 314, 314, 315, 313, 313],\n           [312, 311, 311, 312, 312, 312, 312, 313, 311, 312],\n           [314, 314, 314, 314, 312, 313, 314, 314, 314, 311],\n           [314, 313, 312, 313, 313, 314, 312, 312, 311, 314],\n           [313, 313, 313, 314, 313, 313, 315, 313, 312, 313],\n           [314, 313, 313, 314, 313, 312, 312, 314, 310, 314]], dtype=int16)\n    >>> data[1,4] = 999  # update a pixel value\n    >>> data[30:40, 10:20] = 0  # update values of a subsection\n    >>> data[3] = data[2]    # copy the 3rd row to the 4th row\n\nHere are some more complicated examples by using the concept of the \"mask\narray.\" The first example is to change all negative pixel values in ``data`` to\nzero. The second one is to take logarithm of the pixel values which are\npositive::\n\n    >>> data[data < 0] = 0\n    >>> import numpy as np\n    >>> data[data > 0] = np.log(data[data > 0])\n\nThese examples show the concise nature of ``numpy`` array operations.\n\n..\n  EXAMPLE END\n\n\nScaled Data\n===========\n\nSometimes an image is scaled; that is, the data stored in the file is not the\nimage's physical (true) values, but linearly transformed according to the\nequation:\n\n.. parsed-literal::\n\n    physical value = BSCALE \\* (storage value) + BZERO\n\nBSCALE and BZERO are stored as keywords of the same names in the header of the\nsame HDU. The most common use of a scaled image is to store unsigned 16-bit\ninteger data because the FITS standard does not allow it. In this case, the\nstored data is signed 16-bit integer (BITPIX=16) with BZERO=32768\n(:math:`2^{15}`), BSCALE=1.\n\n\nReading Scaled Image Data\n-------------------------\n\nImages are scaled only when either of the BSCALE/BZERO keywords are present in\nthe header and either of their values is not the default value (BSCALE=1,\nBZERO=0).\n\nFor unscaled data, the data attribute of an HDU in ``astropy`` is a ``numpy``\narray of the same data type specified by the BITPIX keyword. For a scaled\nimage, the ``.data`` attribute will be the physical data (i.e., already\ntransformed from the storage data and may not be the same data type as\nprescribed in BITPIX). This means an extra step of copying is needed and thus\nthe corresponding memory requirement. This also means that the advantage of\nmemory mapping is reduced for scaled data.\n\nFor floating point storage data, the scaled data will have the same data type.\nFor integer data type, the scaled data will always be single precision floating\npoint (``numpy.float32``).\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Reading Scaled Image Data with astropy.io.fits\n\nHere is an example of what happens to scaled data, before and after the data is\ntouched::\n\n    >>> fits_scaledimage_filename = fits.util.get_testdata_filepath('scale.fits')\n\n    >>> hdul = fits.open(fits_scaledimage_filename)\n    >>> hdu = hdul[0]\n    >>> hdu.header['bitpix']\n    16\n    >>> hdu.header['bzero']\n    1500.0\n    >>> hdu.data[0, 0]  # once data is touched, it is scaled  #  doctest: +FLOAT_CMP\n    557.7563\n    >>> hdu.data.dtype.name\n    'float32'\n    >>> hdu.header['bitpix']  # BITPIX is also updated\n    -32\n    >>> # BZERO and BSCALE are removed after the scaling\n    >>> hdu.header['bzero']\n    Traceback (most recent call last):\n        ...\n    KeyError: \"Keyword 'BZERO' not found.\"\n\n.. warning::\n\n    An important caveat to be aware of when dealing with scaled data in\n    ``astropy``, is that when accessing the data via the ``.data`` attribute,\n    the data is automatically scaled with the BZERO and BSCALE parameters. If\n    the file was opened in \"update\" mode, it will be saved with the rescaled\n    data. This surprising behavior is a compromise to err on the side of not\n    losing data: if some floating point calculations were made on the data,\n    rescaling it when saving could result in a loss of information.\n\n    To prevent this automatic scaling, open the file with the\n    ``do_not_scale_image_data=True`` argument to ``fits.open()``. This is\n    especially useful for updating some header values, while ensuring that the\n    data is not modified.\n\n    You may also manually reapply scale parameters by using ``hdu.scale()``\n    (see below). Alternately, you may open files with the ``scale_back=True``\n    argument. This assures that the original scaling is preserved when saving\n    even when the physical values are updated. In other words, it reapplies\n    the scaling to the new physical values upon saving.\n\n..\n  EXAMPLE END\n\n\nWriting Scaled Image Data\n-------------------------\n\nWith the extra processing and memory requirement, we discourage the use of\nscaled data as much as possible. However, ``astropy`` does provide ways to\nwrite scaled data with the `~ImageHDU.scale` method.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Writing Scaled Image Data in astropy.io.fits\n\nTo write scaled data with the `~ImageHDU.scale` method::\n\n    >>> # scale the data to Int16 with user specified bscale/bzero\n    >>> hdu.scale('int16', bzero=32768)\n    >>> # scale the data to Int32 with the min/max of the data range, emits\n    >>> # RuntimeWarning: overflow encountered in short_scalars\n    >>> hdu.scale('int32', 'minmax')  # doctest: +SKIP\n    >>> # scale the data, using the original BSCALE/BZERO, emits\n    >>> # RuntimeWarning: invalid value encountered in add\n    >>> hdu.scale('int32', 'old')  # doctest: +SKIP\n    >>> hdul.close()\n\nThe first example above shows how to store an unsigned short integer array.\n\nCaution must be exercised when using the :meth:`~ImageHDU.scale` method.\nThe :attr:`~ImageHDU.data` attribute of an image HDU, after the\n:meth:`~ImageHDU.scale` call, will become the storage values, not the physical\nvalues. So, only call :meth:`~ImageHDU.scale` just before writing out to FITS\nfiles (i.e., calls of :meth:`~HDUList.writeto`, :meth:`~HDUList.flush`, or\n:meth:`~HDUList.close`). No further use of the data should be exercised. Here is\nan example of what happens to the :attr:`~ImageHDU.data` attribute after the\n:meth:`~ImageHDU.scale` call::\n\n    >>> hdu = fits.PrimaryHDU(np.array([0., 1, 2, 3]))\n    >>> print(hdu.data)  # doctest: +FLOAT_CMP\n    [0. 1. 2. 3.]\n    >>> hdu.scale('int16', bzero=32768)\n    >>> print(hdu.data)  # now the data has storage values\n    [-32768 -32767 -32766 -32765]\n    >>> hdu.writeto('new.fits')\n\n..\n  EXAMPLE END\n\n.. _data-sections:\n\nData Sections\n=============\n\nWhen a FITS image HDU's :attr:`~ImageHDU.data` is accessed, either the whole\ndata is copied into memory (in cases of NOT using memory mapping or if the data\nis scaled) or a virtual memory space equivalent to the data size is allocated\n(in the case of memory mapping of non-scaled data). If there are several very\nlarge image HDUs being accessed at the same time, the system may run out of\nmemory.\n\nIf a user does not need the entire image(s) at the same time (e.g., processing\nthe images(s) ten rows at a time), the :attr:`~ImageHDU.section` attribute of an\nHDU can be used to alleviate such memory problems.\n\nWith ``astropy``'s improved support for memory-mapping, the sections feature is\nnot as necessary as it used to be for handling very large images. However, if\nthe image's data is scaled with non-trivial BSCALE/BZERO values, accessing the\ndata in sections may still be necessary under the current implementation.\nMemmap is also insufficient for loading images larger than 2 to 4 GB on a 32-bit\nsystem — in such cases it may be necessary to use sections.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Data Sections in astropy.io.fits\n\nHere is an example of getting the median image from three input images of the\nsize 5000x5000.\n\n.. code:: python\n\n    hdul1 = fits.open('file1.fits')\n    hdul2 = fits.open('file2.fits')\n    hdul3 = fits.open('file3.fits')\n    output = np.zeros((5000, 5000))\n    for i in range(50):\n        j = i * 100\n        k = j + 100\n        x1 = hdul1[0].section[j:k,:]\n        x2 = hdul2[0].section[j:k,:]\n        x3 = hdul3[0].section[j:k,:]\n        output[j:k, :] = np.median([x1, x2, x3], axis=0)\n\nData in each :attr:`~ImageHDU.section` does not need to be contiguous for\nmemory savings to be possible. ``astropy`` will do its best to join together\ndiscontiguous sections of the array while reading as little as possible into\nmain memory.\n\nSections cannot currently be assigned. Any modifications made to a data\nsection are not saved back to the original file.\n\n..\n  EXAMPLE END\n"},{"id":80,"name":"misc.rst","nodeType":"TextFile","path":"docs/io/fits/usage","text":".. currentmodule:: astropy.io.fits\n\nMiscellaneous Features\n**********************\n\nThis section describes some of the miscellaneous features of :mod:`astropy.io.fits`.\n\n.. _io-fits-differs:\n\nDiffers\n=======\n\nThe :mod:`astropy.io.fits.diff` module contains several facilities for\ngenerating and reporting the differences between two FITS files, or two\ncomponents of a FITS file.\n\nThe :class:`FITSDiff` class can be used to generate and represent the\ndifferences between either two FITS files on disk, or two existing\n:class:`HDUList` objects (or some combination thereof).\n\nLikewise, the :class:`HeaderDiff` class can be used to find the differences\njust between two :class:`Header` objects. Other available differs include\n:class:`HDUDiff`, :class:`ImageDataDiff`, :class:`TableDataDiff`, and\n:class:`RawDataDiff`.\n\nEach of these classes are instantiated with two instances of the objects that\nthey diff. The returned diff instance has a number of attributes starting with\n``.diff_`` that describe differences between the two objects.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Generating Differences Between FITS Files Using astropy.io.fits.diff\n\nThe :class:`HeaderDiff` class can be used to find the differences\nbetween two :class:`Header` objects like so::\n\n    >>> from astropy.io import fits\n    >>> header1 = fits.Header([('KEY_A', 1), ('KEY_B', 2)])\n    >>> header2 = fits.Header([('KEY_A', 3), ('KEY_C', 4)])\n    >>> diff = fits.diff.HeaderDiff(header1, header2)\n    >>> diff.identical\n    False\n    >>> diff.diff_keywords\n    (['KEY_B'], ['KEY_C'])\n    >>> diff.diff_keyword_values\n    defaultdict(..., {'KEY_A': [(1, 3)]})\n\nSee the API documentation for details on the different differ classes.\n\n..\n  EXAMPLE END\n"},{"id":81,"name":"headers.rst","nodeType":"TextFile","path":"docs/io/fits/usage","text":".. currentmodule:: astropy.io.fits\n\nFITS Headers\n************\n\nIn the next three chapters, more detailed information including examples will\nbe explained for manipulating FITS headers, image/array data, and table data\nrespectively.\n\n\nHeader of an HDU\n================\n\nEvery Header Data Unit (HDU) normally has two components: header and data. In\n``astropy`` these two components are accessed through the two attributes of the\nHDU, ``hdu.header`` and ``hdu.data``.\n\nWhile an HDU may have empty data (i.e., the ``.data`` attribute is `None`), any\nHDU will always have a header. When an HDU is created with a constructor (e.g.,\n``hdu = PrimaryHDU(data, header)``), the user may supply the header value from\nan existing HDU's header and the data value from a ``numpy`` array. If the\ndefaults (None) are used, the new HDU will have the minimal required keywords\nfor an HDU of that type::\n\n    >>> from astropy.io import fits\n    >>> hdu = fits.PrimaryHDU()\n    >>> hdu.header  # show the all of the header cards\n    SIMPLE  =                    T / conforms to FITS standard\n    BITPIX  =                    8 / array data type\n    NAXIS   =                    0 / number of array dimensions\n    EXTEND  =                    T\n\nA user can use any header and any data to construct a new HDU. ``astropy`` will\nstrip any keywords that describe the data structure leaving only your\ninformational keywords. Later it will add back in the required structural\nkeywords for compatibility with the new HDU and any data added to it. So, a\nuser can use a table HDU's header to construct an image HDU and vice versa. The\nconstructor will also ensure the data type and dimension information in the\nheader agree with the data.\n\n\nThe Header Attribute\n====================\n\nValue Access, Updating, and Creating\n------------------------------------\n\nAs shown in the :ref:`Getting Started <tutorial>` tutorial, keyword values can\nbe accessed via keyword name or index of an HDU's header attribute. You can\nalso use the wildcard character ``*`` to get the keyword value pairs that match\nyour search string. Here is a quick summary::\n\n    >>> fits_image_filename = fits.util.get_testdata_filepath('test0.fits')\n    >>> hdul = fits.open(fits_image_filename)  # open a FITS file\n    >>> hdr = hdul[0].header  # the primary HDU header\n    >>> print(hdr[34])  # get the 2nd keyword's value\n    96\n    >>> hdr[34] = 20  # change its value\n    >>> hdr['DARKCORR']  # get the value of the keyword 'darkcorr'\n    'OMIT'\n    >>> hdr['DARKCOR*']  # get keyword values using wildcard matching\n    DARKCORR= 'OMIT              ' / Do dark correction: PERFORM, OMIT, COMPLETE\n    >>> hdr['darkcorr'] = 'PERFORM'  # change darkcorr's value\n\nKeyword names are case-insensitive except in a few special cases (see the\nsections on HIERARCH card and record-valued cards). Thus, ``hdr['abc']``,\n``hdr['ABC']``, or ``hdr['aBc']`` are all equivalent.\n\nAs with Python's :class:`dict` type, new keywords can also be added to the\nheader using assignment syntax::\n\n    >>> hdr = hdul[1].header\n    >>> 'DARKCORR' in hdr  # Check for existence\n    False\n    >>> hdr['DARKCORR'] = 'OMIT'  # Add a new DARKCORR keyword\n\nYou can also add a new value *and* comment by assigning them as a tuple::\n\n    >>> hdr['DARKCORR'] = ('OMIT', 'Dark Image Subtraction')\n\n.. note::\n\n    An important point to note when adding new keywords to a header is that by\n    default they are not appended *immediately* to the end of the file.\n    Rather, they are appended to the last non-commentary keyword. This is in\n    order to support the common use case of always having all HISTORY keywords\n    grouped together at the end of a header. A new non-commentary keyword will\n    be added at the end of the existing keywords, but before any\n    HISTORY/COMMENT keywords at the end of the header.\n\n    There are a couple of ways to override this functionality:\n\n    * Use the :meth:`Header.append` method with the ``end=True`` argument:\n\n        >>> hdr.append(('DARKCORR', 'OMIT', 'Dark Image Subtraction'), end=True)\n\n      This forces the new keyword to be added at the actual end of the header.\n\n    * The :meth:`Header.insert` method will always insert a new keyword exactly\n      where you ask for it:\n\n        >>> del hdr['DARKCORR']  # Delete previous insertion for doctest\n        >>> hdr.insert(20, ('DARKCORR', 'OMIT', 'Dark Image Subtraction'))\n\n      This inserts the DARKCORR keyword before the 20th keyword in the\n      header no matter what it is.\n\nA keyword (and its corresponding card) can be deleted using the same index/name\nsyntax::\n\n    >>> del hdr[3]  # delete the 2nd keyword\n    >>> del hdr['DARKCORR']  # delete the value of the keyword 'DARKCORR'\n\nNote that, like a regular Python list, the indexing updates after each delete,\nso if ``del hdr[3]`` is done two times in a row, the fourth and fifth keywords\nare removed from the original header. Likewise, ``del hdr[-1]`` will delete\nthe last card in the header.\n\nIt is also possible to delete an entire range of cards using the slice syntax::\n\n    >>> del hdr[3:5]\n\nThe method :meth:`Header.set` is another way to update the value or comment\nassociated with an existing keyword, or to create a new keyword. Most of its\nfunctionality can be duplicated with the dict-like syntax shown above. But in\nsome cases it might be more clear. It also has the advantage of allowing a user\nto either move cards within the header or specify the location of a new card\nrelative to existing cards::\n\n    >>> hdr.set('target', 'NGC1234', 'target name')\n    >>> # place the next new keyword before the 'TARGET' keyword\n    >>> hdr.set('newkey', 666, before='TARGET')  # comment is optional\n    >>> # place the next new keyword after the 21st keyword\n    >>> hdr.set('newkey2', 42.0, 'another new key', after=20)\n\nIn FITS headers, each keyword may also have a comment associated with it\nexplaining its purpose. The comments associated with each keyword are accessed\nthrough the :attr:`~Header.comments` attribute::\n\n    >>> hdr['NAXIS']\n    2\n    >>> hdr.comments['NAXIS']\n    'number of data axes'\n    >>> hdr.comments['NAXIS'] = 'The number of image axes'  # Update\n    >>> hdul.close()  # close the HDUList again\n\nComments can be accessed in all of the same ways that values are accessed,\nwhether by keyword name or card index. Slices are also possible. The only\ndifference is that you go through ``hdr.comments`` instead of just ``hdr`` by\nitself.\n\n\nCOMMENT, HISTORY, and Blank Keywords\n------------------------------------\n\nMost keywords in a FITS header have unique names. If there are more than two\ncards sharing the same name, it is the first one accessed when referred by\nname. The duplicates can only be accessed by numeric indexing.\n\nThere are three special keywords (their associated cards are sometimes referred\nto as commentary cards), which commonly appear in FITS headers more than once.\nThey are (1) blank keyword, (2) HISTORY, and (3) COMMENT. Unlike other\nkeywords, when accessing these keywords they are returned as a list::\n\n    >>> filename = fits.util.get_testdata_filepath('history_header.fits')\n    >>> with fits.open(filename) as hdul:  # open a FITS file\n    ...     hdr = hdul[0].header\n\n    >>> hdr['HISTORY']\n    I updated this file on 02/03/2011\n    I updated this file on 02/04/2011\n\nThese lists can be sliced like any other list. For example, to display just the\nlast HISTORY entry, use ``hdr['history'][-1]``. Existing commentary cards\ncan also be updated by using the appropriate index number for that card.\n\nNew commentary cards can be added like any other card by using the dict-like\nkeyword assignment syntax, or by using the :meth:`Header.set` method. However,\nunlike with other keywords, a new commentary card is always added and appended\nto the last commentary card with the same keyword, rather than to the end of\nthe header.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Manipulating FITS Headers in astropy.io.fits\n\nTo add a new commentary card::\n\n    >>> hdu.header['HISTORY'] = 'history 1'\n    >>> hdu.header[''] = 'blank 1'\n    >>> hdu.header['COMMENT'] = 'comment 1'\n    >>> hdu.header['HISTORY'] = 'history 2'\n    >>> hdu.header[''] = 'blank 2'\n    >>> hdu.header['COMMENT'] = 'comment 2'\n\nand the part in the modified header becomes:\n\n.. parsed-literal::\n\n    HISTORY history 1\n    HISTORY history 2\n            blank 1\n            blank 2\n    COMMENT comment 1\n    COMMENT comment 2\n\n\nUsers can also directly control exactly where in the header to add a new\ncommentary card by using the :meth:`Header.insert` method.\n\n.. note::\n\n    Ironically, there is no comment in a commentary card, only a string\n    value.\n\n..\n  EXAMPLE END\n\nUndefined Values\n----------------\n\nFITS headers can have undefined values and these are represented in Python\nwith the special value `None`. `None` can be used when assigning values\nto a `~astropy.io.fits.Header` or `~astropy.io.fits.Card`.\n\n    >>> hdr = fits.Header()\n    >>> hdr['UNDEF'] = None\n    >>> hdr['UNDEF'] is None\n    True\n    >>> repr(hdr)\n    'UNDEF   =                                                                       '\n    >>> hdr.append('UNDEF2')\n    >>> hdr['UNDEF2'] is None\n    True\n    >>> hdr.append(('UNDEF3', None, 'Undefined value'))\n    >>> str(hdr.cards[-1])\n    'UNDEF3  =  / Undefined value                                                    '\n\n\nCard Images\n===========\n\nA FITS header consists of card images.\n\nA card image in a FITS header consists of a keyword name, a value, and\noptionally a comment. Physically, it takes 80 columns (bytes) — without carriage\nreturn — in a FITS file's storage format. In ``astropy``, each card image is\nmanifested by a :class:`Card` object. There are also special kinds of cards:\ncommentary cards (see above) and card images taking more than one 80-column\ncard image. The latter will be discussed later.\n\nMost of the time the details of dealing with cards are handled by the\n:class:`Header` object, and it is not necessary to directly manipulate cards.\nIn fact, most :class:`Header` methods that accept a ``(keyword, value)`` or\n``(keyword, value, comment)`` tuple as an argument can also take a\n:class:`Card` object as an argument. :class:`Card` objects are just wrappers\naround such tuples that provide the logic for parsing and formatting individual\ncards in a header. There is usually nothing gained by manually using a\n:class:`Card` object, except to examine how a card might appear in a header\nbefore actually adding it to the header.\n\nA new Card object is created with the :class:`Card` constructor:\n``Card(key, value, comment)``.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Card Images in FITS Headers in astropy.io.fits\n\nTo create a new Card object::\n\n    >>> c1 = fits.Card('TEMP', 80.0, 'temperature, floating value')\n    >>> c2 = fits.Card('DETECTOR', 1)  # comment is optional\n    >>> c3 = fits.Card('MIR_REVR', True,\n    ...                'mirror reversed? Boolean value')\n    >>> c4 = fits.Card('ABC', 2+3j, 'complex value')\n    >>> c5 = fits.Card('OBSERVER', 'Hubble', 'string value')\n\n    >>> print(c1); print(c2); print(c3); print(c4); print(c5)  # show the cards\n    TEMP    =                 80.0 / temperature, floating value\n    DETECTOR=                    1\n    MIR_REVR=                    T / mirror reversed? Boolean value\n    ABC     =           (2.0, 3.0) / complex value\n    OBSERVER= 'Hubble  '           / string value\n\nCards have the attributes ``.keyword``, ``.value``, and ``.comment``. Both\n``.value`` and ``.comment`` can be changed but not the ``.keyword`` attribute.\nIn other words, once a card is created, it is created for a specific, immutable\nkeyword.\n\nThe :meth:`Card` constructor will check if the arguments given are conforming\nto the FITS standard and has a fixed card image format. If the user wants to\ncreate a card with a customized format or even a card which is not conforming\nto the FITS standard (e.g., for testing purposes), the :meth:`Card.fromstring`\nclass method can be used.\n\nCards can be verified with :meth:`Card.verify`. The nonstandard card ``c2`` in\nthe example below is flagged by such verification. More about verification in\n``astropy`` will be discussed in a later chapter.\n\n::\n\n    >>> c1 = fits.Card.fromstring('ABC     = 3.456D023')\n    >>> c2 = fits.Card.fromstring(\"P.I. ='Hubble'\")\n    >>> print(c1)\n    ABC     = 3.456D023\n    >>> print(c2)  # doctest: +SKIP\n    P.I. ='Hubble'\n    >>> c2.verify()  # doctest: +SKIP\n    Output verification result:\n    Unfixable error: Illegal keyword name 'P.I.'\n\nA list of the :class:`Card` objects underlying a :class:`Header` object can be\naccessed with the :attr:`Header.cards` attribute. This list is only meant for\nobserving, and should not be directly manipulated. In fact, it is only a\ncopy — modifications to it will not affect the header from which it came. Use\nthe methods provided by the :class:`Header` class instead.\n\n..\n  EXAMPLE END\n\n\nCONTINUE Cards\n==============\n\nThe fact that the FITS standard only allows up to eight characters for the\nkeyword name and 80 characters to contain the keyword, the value, and the\ncomment is restrictive for certain applications. To allow long string values\nfor keywords, a proposal was made in:\n\n    https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/ofwg_recomm/r13.html\n\nby using the CONTINUE keyword after the regular 80 column containing the\nkeyword. ``astropy`` does support this convention, which is a part of the FITS\nstandard since version 4.0.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  CONTINUE Cards for Long String Values in astropy.io.fits\n\nThe examples below show that the use of CONTINUE is automatic for long\nstring values::\n\n    >>> hdr = fits.Header()\n    >>> hdr['abc'] = 'abcdefg' * 20\n    >>> hdr\n    ABC     = 'abcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcd&'\n    CONTINUE  'efgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefga&'\n    CONTINUE  'bcdefg'\n    >>> hdr['abc']\n    'abcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefg'\n    >>> # both value and comments are long\n    >>> hdr['abc'] = ('abcdefg' * 10, 'abcdefg' * 10)\n    >>> hdr\n    ABC     = 'abcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcd&'\n    CONTINUE  'efg&'\n    CONTINUE  '&' / abcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefga\n    CONTINUE  '' / bcdefg\n\nNote that when a CONTINUE card is used, at the end of each 80-character card\nimage, an ampersand is present. The ampersand is not part of the string value.\nAlso, there is no \"=\" at the ninth column after CONTINUE. In the first example,\nthe entire 240 characters is treated by ``astropy`` as a single card. So, if it\nis the nth card in a header, the (n+1)th card refers to the next keyword, not\nthe next CONTINUE card. As such, CONTINUE cards are transparently handled by\n``astropy`` as a single logical card, and it is generally not necessary to worry\nabout the details of the format. Keywords that resolve to a set of CONTINUE\ncards can be accessed and updated just like regular keywords.\n\n..\n  EXAMPLE END\n\n\nHIERARCH Cards\n==============\n\nFor keywords longer than eight characters, there is a convention originated at\nthe European Southern Observatory (ESO) to facilitate such use. It uses a\nspecial keyword HIERARCH with the actual long keyword following. ``astropy``\nsupports this convention as well.\n\nIf a keyword contains more than eight characters ``astropy`` will automatically\nuse a HIERARCH card, but will also issue a warning in case this is in error.\nHowever, you may explicitly request a HIERARCH card by prepending the keyword\nwith 'HIERARCH ' (just as it would appear in the header). For example,\n``hdr['HIERARCH abcdefghi']`` will create the keyword ``abcdefghi`` without\ndisplaying a warning. Once created, HIERARCH keywords can be accessed like any\nother: ``hdr['abcdefghi']``, without prepending 'HIERARCH' to the keyword.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  HIERARCH Cards for Keywords Longer than Eight Characters in astropy.io.fits\n\n``astropy`` will use a HIERARCH card and issue a warning when keywords contain\nmore than eight characters::\n\n    >>> # this will result in a Warning because a HIERARCH card is implicitly created\n    >>> c = fits.Card('abcdefghi', 10)  # doctest: +SKIP\n    >>> print(c)  # doctest: +SKIP\n    HIERARCH abcdefghi = 10\n    >>> c = fits.Card('hierarch abcdefghi', 10)\n    >>> print(c)\n    HIERARCH abcdefghi = 10\n    >>> hdu = fits.PrimaryHDU()\n    >>> hdu.header['hierarch abcdefghi'] =  99\n    >>> hdu.header['abcdefghi']\n    99\n    >>> hdu.header['abcdefghi'] = 10\n    >>> hdu.header['abcdefghi']\n    10\n    >>> hdu.header\n    SIMPLE  =                    T / conforms to FITS standard\n    BITPIX  =                    8 / array data type\n    NAXIS   =                    0 / number of array dimensions\n    EXTEND  =                    T\n    HIERARCH abcdefghi = 10\n\n..\n  EXAMPLE END\n\n.. note::\n\n    A final point to keep in mind about the :class:`Header` class is that much\n    of its design is intended to abstract away quirks about the FITS format.\n    This is why, for example, it will automatically create CONTINUE and\n    HIERARCH cards. The Header is just a data structure, and as a user you\n    should not have to worry about how it ultimately gets serialized to a header\n    in a FITS file.\n\n    Though there are some areas where it is almost impossible to hide away the\n    quirks of the FITS format, ``astropy`` tries to make it so that you have to\n    think about it as little as possible. If there are any areas that are left\n    vague or difficult to understand about how the header is constructed, please\n    let us know, as there are probably areas where this can be\n    improved on even more.\n"},{"id":82,"name":"unfamiliar.rst","nodeType":"TextFile","path":"docs/io/fits/usage","text":".. currentmodule:: astropy.io.fits\n\nLess Familiar Objects\n*********************\n\nIn this chapter, we will discuss less frequently used FITS data structures. They\ninclude ASCII tables, variable length tables, and random access group FITS\nfiles.\n\n\nASCII Tables\n============\n\nFITS standard supports both binary and ASCII tables. In ASCII tables, all of the\ndata are stored in a human-readable text form, so it takes up more space and\nextra processing to parse the text for numeric data. Depending on how the\ncolumns are formatted, floating point data may also lose precision.\n\nIn ``astropy``, the interface for ASCII tables and binary tables is basically\nthe same (i.e., the data is in the ``.data`` attribute and the ``field()``\nmethod is used to refer to the columns and returns a ``numpy`` array). When\nreading the table, ``astropy`` will automatically detect what kind of table it\nis.\n\n::\n\n    >>> from astropy.io import fits\n    >>> filename = fits.util.get_testdata_filepath('ascii.fits')\n    >>> hdul = fits.open(filename)\n    >>> hdul[1].data[:1]  # doctest: +SKIP\n    FITS_rec([(10.123, 37)],\n             dtype=(numpy.record, {'names':['a','b'], 'formats':['S10','S5'], 'offsets':[0,11], 'itemsize':16}))\n    >>> hdul[1].data['a']\n    array([  10.123,    5.2  ,   15.61 ,    0.   ,  345.   ])\n    >>> hdul[1].data.formats\n    ['E10.4', 'I5']\n    >>> hdul.close()\n\nNote that the formats in the record array refer to the raw data which are ASCII\nstrings (therefore 'a11' and 'a5'), but the ``.formats`` attribute of data\nretains the original format specifications ('E10.4' and 'I5').\n\n.. _creating_ascii_table:\n\nCreating an ASCII Table\n-----------------------\n\nCreating an ASCII table from scratch is similar to creating a binary table. The\ndifference is in the Column definitions. The columns/fields in an ASCII table\nare more limited than in a binary table. It does not allow more than one\nnumerical value in a cell. Also, it only supports a subset of what is allowed\nin a binary table, namely character strings, integer, and (single and double\nprecision) floating point numbers. Boolean and complex numbers are not allowed.\n\nThe format syntax (the values of the TFORM keywords) is different from that of a\nbinary table. They are:\n\n.. parsed-literal::\n\n    Aw         Character string\n    Iw         (Decimal) Integer\n    Fw.d       Double precision real\n    Ew.d       Double precision real, in exponential notation\n    Dw.d       Double precision real, in exponential notation\n\nwhere w is the width, and d the number of digits after the decimal point. The\nsyntax difference between ASCII and binary tables can be confusing. For example,\na field of 3-character string is specified as '3A' in a binary table and as\n'A3' in an ASCII table.\n\nThe other difference is the need to specify the table type when using the\n:meth:`TableHDU.from_columns` method, and that `Column` should be provided the\n``ascii=True`` argument in order to be unambiguous.\n\n.. note::\n\n    Although binary tables are more common in most FITS files, earlier versions\n    of the FITS format only supported ASCII tables. That is why the class\n    :class:`TableHDU` is used for representing ASCII tables specifically,\n    whereas :class:`BinTableHDU` is more explicit that it represents a binary\n    table. These names come from the value ``XTENSION`` keyword in the tables'\n    headers, which is ``TABLE`` for ASCII tables and ``BINTABLE`` for binary\n    tables.\n\n:meth:`TableHDU.from_columns` can be used like so::\n\n    >>> import numpy as np\n\n    >>> a1 = np.array(['abcd', 'def'])\n    >>> r1 = np.array([11., 12.])\n    >>> col1 = fits.Column(name='abc', format='A3', array=a1, ascii=True)\n    >>> col2 = fits.Column(name='def', format='E', array=r1, bscale=2.3,\n    ...                    bzero=0.6, ascii=True)\n    >>> col3 = fits.Column(name='t1', format='I', array=[91, 92, 93], ascii=True)\n    >>> hdu = fits.TableHDU.from_columns([col1, col2, col3])\n    >>> hdu.data\n    FITS_rec([('abc', 11.0, 91), ('def', 12.0, 92), ('', 0.0, 93)],\n             dtype=(numpy.record, [('abc', 'S3'), ('def', 'S15'), ('t1', 'S10')]))\n\nIt should be noted that when the formats of the columns are unambiguously\nspecific to ASCII tables it is not necessary to specify ``ascii=True`` in\nthe :class:`ColDefs` constructor. In this case there *is* ambiguity because\nthe format code ``'I'`` represents a 16-bit integer in binary tables, while in\nASCII tables it is not technically a valid format. ASCII table format codes\ntechnically require a character width for each column, such as ``'I10'`` to\ncreate a column that can hold integers up to 10 characters wide.\n\nHowever, ``astropy`` allows the width specification to be omitted in some cases.\nWhen it is omitted from ``'I'`` format columns the minimum width needed to\naccurately represent all integers in the column is used. The only problem with\nusing this shortcut is its ambiguity with the binary table ``'I'`` format, so\nspecifying ``ascii=True`` is a good practice (though ``astropy`` will still\nfigure out what you meant in most cases).\n\n\nVariable Length Array Tables\n============================\n\nThe FITS standard also supports variable length array tables. The basic idea is\nthat sometimes it is desirable to have tables with cells in the same field\n(column) that have the same data type but have different lengths/dimensions.\nCompared with the standard table data structure, the variable length table can\nsave storage space if there is a large dynamic range of data lengths in\ndifferent cells.\n\nA variable length array table can have one or more fields (columns) which are\nvariable length. The rest of the fields (columns) in the same table can still\nbe regular, fixed-length ones. ``astropy`` will automatically detect what kind\nof field it is during reading; no special action is needed from the user. The\ndata type specification (i.e., the value of the TFORM keyword) uses an extra\nletter 'P' and the format is:\n\n.. parsed-literal::\n\n    rPt(max)\n\nwhere ``r`` may be 0 or 1 (typically omitted, as it is not applicable to\nvariable length arrays), ``t`` is one of the letter codes for basic data types\n(L, B, I, J, etc.; currently, the X format is not supported for variable length\narray field in ``astropy``), and ``max`` is the maximum number of elements of\nany array in the column. So, for a variable length field of int16, the\ncorresponding format spec is, for example, 'PJ(100)'.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Accessing Variable Length Array Columns in FITS Tables\n\nThis example shows a variable length array field of data type int16::\n\n    >>> filename = fits.util.get_testdata_filepath('variable_length_table.fits')\n    >>> hdul = fits.open(filename)\n    >>> hdul[1].header['tform1']\n    'PI(3)'\n    >>> print(hdul[1].data.field(0))\n    [array([45, 56], dtype=int16) array([11, 12, 13], dtype=int16)]\n    >>> hdul.close()\n\nIn this field the first row has one element, the second row has two elements,\netc. Accessing variable length fields is almost identical to regular fields,\nexcept that operations on the whole field simultaneously are usually not\npossible. A user has to process the field row by row as though they are\nindependent arrays.\n\n..\n  EXAMPLE END\n\n\nCreating a Variable Length Array Table\n--------------------------------------\n\nCreating a variable length table is almost identical to creating a regular\ntable. The only difference is in the creation of field definitions which are\nvariable length arrays. First, the data type specification will need the 'P'\nletter, and secondly, the field data must be an objects array (as included in\nthe ``numpy`` module).\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Creating a Variable Length Array Column in a FITS Table\n\nHere is an example of creating a table with two fields; one is regular and the\nother a variable length array::\n\n    >>> col1 = fits.Column(\n    ...    name='var', format='PI()',\n    ...    array=np.array([[45, 56], [11, 12, 13]], dtype=np.object_))\n    >>> col2 = fits.Column(name='xyz', format='2I', array=[[11, 3], [12, 4]])\n    >>> hdu = fits.BinTableHDU.from_columns([col1, col2])\n    >>> data = hdu.data\n    >>> data  # doctest: +SKIP\n    FITS_rec([([45, 56], [11,  3]), ([11, 12, 13], [12,  4])],\n             dtype=(numpy.record, [('var', '<i4', (2,)), ('xyz', '<i2', (2,))]))\n    >>> hdu.writeto('variable_length_table.fits')\n    >>> with fits.open('variable_length_table.fits') as hdul:\n    ...     print(repr(hdul[1].header))\n    XTENSION= 'BINTABLE'           / binary table extension\n    BITPIX  =                    8 / array data type\n    NAXIS   =                    2 / number of array dimensions\n    NAXIS1  =                   12 / length of dimension 1\n    NAXIS2  =                    2 / length of dimension 2\n    PCOUNT  =                   10 / number of group parameters\n    GCOUNT  =                    1 / number of groups\n    TFIELDS =                    2 / number of table fields\n    TTYPE1  = 'var     '\n    TFORM1  = 'PI(3)   '\n    TTYPE2  = 'xyz     '\n    TFORM2  = '2I      '\n\n..\n  EXAMPLE END\n\n.. _random-groups:\n\nRandom Access Groups\n====================\n\nAnother less familiar data structure supported by the FITS standard is the\nrandom access group. This convention was established before the binary table\nextension was introduced. In most cases its use can now be superseded by the\nbinary table. It is mostly used in radio interferometry.\n\nLike primary HDUs, a Random Access Group HDU is always the first HDU of a FITS\nfile. Its data has one or more groups. Each group may have any number\n(including 0) of parameters, together with an image. The parameters and the\nimage have the same data type.\n\nAll groups in the same HDU have the same data structure, that is, same data type\n(specified by the keyword BITPIX, as in image HDU), same number of parameters\n(specified by PCOUNT), and the same size and shape (specified by NAXISn\nkeywords) of the image data. The number of groups is specified by GCOUNT and\nthe keyword NAXIS1 is always 0. Thus the total data size for a Random Access\nGroup HDU is:\n\n.. parsed-literal::\n\n    \\|BITPIX\\| \\* GCOUNT \\* (PCOUNT + NAXIS2 \\* NAXIS3 \\* ... \\* NAXISn)\n\n\nHeader and Summary\n------------------\n\nAccessing the header of a Random Access Group HDU is no different from any\nother HDU; you can use the .header attribute.\n\nThe content of the HDU can similarly be summarized by using the\n:meth:`HDUList.info` method::\n\n    >>> filename = fits.util.get_testdata_filepath('group.fits')\n    >>> hdul = fits.open(filename)\n    >>> hdul[0].header['groups']\n    True\n    >>> hdul[0].header['gcount']\n    10\n    >>> hdul[0].header['pcount']\n    3\n    >>> hdul.info()\n    Filename: ...group.fits\n    No.    Name      Ver    Type      Cards   Dimensions   Format\n      0  PRIMARY       1 GroupsHDU       15   (5, 3, 1, 1)   float32   10 Groups  3 Parameters\n\n\nData: Group Parameters\n----------------------\n\nThe data part of a Random Access Group HDU is, like other HDUs, in the\n``.data`` attribute. It includes both parameter(s) and image array(s).\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Group Parameters in Random Access Group HDUs\n\nTo show the contents of the third group, including parameters and data::\n\n    >>> hdul[0].data[2]  # doctest: +FLOAT_CMP\n    (2.0999999, 42.0, 42.0, array([[[[30., 31., 32., 33., 34.],\n             [35., 36., 37., 38., 39.],\n             [40., 41., 42., 43., 44.]]]], dtype=float32))\n\nThe data first lists all of the parameters, then the image array, for the\nspecified group(s). As a reminder, the image data in this file has the shape of\n(1,1,1,4,3) in Python or C convention, or (3,4,1,1,1) in IRAF or Fortran\nconvention.\n\nTo access the parameters, first find out what the parameter names are, with the\n``.parnames`` attribute::\n\n    >>> hdul[0].data.parnames # get the parameter names\n    ['abc', 'xyz', 'xyz']\n\nThe group parameter can be accessed by the :meth:`~GroupData.par` method. Like\nthe table :meth:`~FITS_rec.field` method, the argument can be either index or\nname::\n\n    >>> hdul[0].data.par(0)[8]  # Access group parameter by name or by index  # doctest: +FLOAT_CMP\n    8.1\n    >>> hdul[0].data.par('abc')[8]  # doctest: +FLOAT_CMP\n    8.1\n\nNote that the parameter name 'xyz' appears twice. This is a feature in the\nrandom access group, and it means to add the values together. Thus::\n\n    >>> hdul[0].data.parnames  # get the parameter names\n    ['abc', 'xyz', 'xyz']\n    >>> hdul[0].data.par(1)[8]  # Duplicate parameter name 'xyz'\n    42.0\n    >>> hdul[0].data.par(2)[8]\n    42.0\n    >>> # When accessed by name, it adds the values together if the name is\n    >>> # shared by more than one parameter\n    >>> hdul[0].data.par('xyz')[8]\n    84.0\n\nThe :meth:`~GroupData.par` is a method for either the entire data object or one\ndata item (a group). So there are two possible ways to get a group parameter\nfor a certain group, this is similar to the situation in table data (with its\n:meth:`~FITS_rec.field` method)::\n\n    >>> hdul[0].data.par(0)[8]  # doctest: +FLOAT_CMP\n    8.1\n    >>> hdul[0].data[8].par(0)  # doctest: +FLOAT_CMP\n    8.1\n\nOn the other hand, to modify a group parameter, we can either assign the new\nvalue directly (if accessing the row/group number last) or use the\n:meth:`~Group.setpar` method (if accessing the row/group number first). The\nmethod :meth:`~Group.setpar` is also needed for updating by name if the\nparameter is shared by more than one parameters::\n\n    >>> # Update group parameter when selecting the row (group) number last\n    >>> hdul[0].data.par(0)[8] = 99.\n    >>> # Update group parameter when selecting the row (group) number first\n    >>> hdul[0].data[8].setpar(0, 99.)  # or:\n    >>> hdul[0].data[8].setpar('abc', 99.)\n    >>> # Update group parameter by name when the name is shared by more than\n    >>> # one parameters, the new value must be a tuple of constants or\n    >>> # sequences\n    >>> hdul[0].data[8].setpar('xyz', (2445729., 0.3))\n    >>> hdul[0].data[8:].par('xyz')  # doctest: +FLOAT_CMP\n    array([2.44572930e+06, 8.40000000e+01])\n\n..\n  EXAMPLE END\n\nData: Image Data\n----------------\n\nThe image array of the data portion is accessible by the\n:attr:`~GroupData.data` attribute of the data object. A ``numpy`` array is\nreturned::\n\n    >>> print(hdul[0].data.data[8])  # doctest: +FLOAT_CMP\n    [[[[120. 121. 122. 123. 124.]\n       [125. 126. 127. 128. 129.]\n       [130. 131. 132. 133. 134.]]]]\n    >>> hdul.close()\n\n\nCreating a Random Access Group HDU\n----------------------------------\n\nTo create a Random Access Group HDU from scratch, use :class:`GroupData` to\nencapsulate the data into the group data structure, and use :class:`GroupsHDU`\nto create the HDU itself.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Creating a Random Access Group HDU in a FITS File\n\nTo create a Random Access Group HDU::\n\n    >>> # Create the image arrays. The first dimension is the number of groups.\n    >>> imdata = np.arange(150.0).reshape(10, 1, 1, 3, 5)\n    >>> # Next, create the group parameter data, we'll have two parameters.\n    >>> # Note that the size of each parameter's data is also the number of\n    >>> # groups.\n    >>> # A parameter's data can also be a numeric constant.\n    >>> pdata1 = np.arange(10) + 0.1\n    >>> pdata2 = 42\n    >>> # Create the group data object, put parameter names and parameter data\n    >>> # in lists assigned to their corresponding arguments.\n    >>> # If the data type (bitpix) is not specified, the data type of the\n    >>> # image will be used.\n    >>> x = fits.GroupData(imdata, bitpix=-32,\n    ...                    parnames=['abc', 'xyz', 'xyz'],\n    ...                    pardata=[pdata1, pdata2, pdata2])\n    >>> # Now, create the GroupsHDU and write to a FITS file.\n    >>> hdu = fits.GroupsHDU(x)\n    >>> hdu.writeto('test_group.fits')\n    >>> hdu.header\n    SIMPLE  =                    T / conforms to FITS standard\n    BITPIX  =                  -32 / array data type\n    NAXIS   =                    5 / number of array dimensions\n    NAXIS1  =                    0\n    NAXIS2  =                    5\n    NAXIS3  =                    3\n    NAXIS4  =                    1\n    NAXIS5  =                    1\n    EXTEND  =                    T\n    GROUPS  =                    T / has groups\n    PCOUNT  =                    3 / number of parameters\n    GCOUNT  =                   10 / number of groups\n    PTYPE1  = 'abc     '\n    PTYPE2  = 'xyz     '\n    PTYPE3  = 'xyz     '\n    >>> data = hdu.data\n    >>> hdu.data  # doctest: +SKIP\n    GroupData([ (0.1       , 42., 42., [[[[  0.,   1.,   2.,   3.,   4.], [  5.,   6.,   7.,   8.,   9.], [ 10.,  11.,  12.,  13.,  14.]]]]),\n               (1.10000002, 42., 42., [[[[ 15.,  16.,  17.,  18.,  19.], [ 20.,  21.,  22.,  23.,  24.], [ 25.,  26.,  27.,  28.,  29.]]]]),\n               (2.0999999 , 42., 42., [[[[ 30.,  31.,  32.,  33.,  34.], [ 35.,  36.,  37.,  38.,  39.], [ 40.,  41.,  42.,  43.,  44.]]]]),\n               (3.0999999 , 42., 42., [[[[ 45.,  46.,  47.,  48.,  49.], [ 50.,  51.,  52.,  53.,  54.], [ 55.,  56.,  57.,  58.,  59.]]]]),\n               (4.0999999 , 42., 42., [[[[ 60.,  61.,  62.,  63.,  64.], [ 65.,  66.,  67.,  68.,  69.], [ 70.,  71.,  72.,  73.,  74.]]]]),\n               (5.0999999 , 42., 42., [[[[ 75.,  76.,  77.,  78.,  79.], [ 80.,  81.,  82.,  83.,  84.], [ 85.,  86.,  87.,  88.,  89.]]]]),\n               (6.0999999 , 42., 42., [[[[ 90.,  91.,  92.,  93.,  94.], [ 95.,  96.,  97.,  98.,  99.], [100., 101., 102., 103., 104.]]]]),\n               (7.0999999 , 42., 42., [[[[105., 106., 107., 108., 109.], [110., 111., 112., 113., 114.], [115., 116., 117., 118., 119.]]]]),\n               (8.10000038, 42., 42., [[[[120., 121., 122., 123., 124.], [125., 126., 127., 128., 129.], [130., 131., 132., 133., 134.]]]]),\n               (9.10000038, 42., 42., [[[[135., 136., 137., 138., 139.], [140., 141., 142., 143., 144.], [145., 146., 147., 148., 149.]]]])],\n               dtype=(numpy.record, [('abc', '<f4'), ('xyz', '<f4'), ('_xyz', '<f4'), ('DATA', '<f4', (1, 1, 3, 5))]))\n\n..\n  EXAMPLE END\n\nCompressed Image Data\n=====================\n.. _astropy-io-fits-compressedImageData:\n\nA general technique has been developed for storing compressed image data in\nFITS binary tables. The principle used in this convention is to first divide\nthe n-dimensional image into a rectangular grid of sub-images or 'tiles'.\nEach tile is then compressed as a continuous block of data, and the resulting\ncompressed byte stream is stored in a row of a variable length column in a\nFITS binary table. Several commonly used algorithms for compressing image\ntiles are supported. These include Gzip, Rice, IRAF Pixel List (PLIO), and\nHcompress.\n\nFor more details, reference \"A FITS Image Compression Proposal\" from:\n\n    https://www.adass.org/adass/proceedings/adass99/P2-42/\n\nand \"Registered FITS Convention, Tiled Image Compression Convention\":\n\n    https://fits.gsfc.nasa.gov/registry/tilecompression.html\n\nCompressed image data is accessed, in ``astropy``, using the optional\n``astropy.io.fits.compression`` module contained in a C shared library\n(compression.so). If an attempt is made to access an HDU containing compressed\nimage data when the compression module is not available, the user is notified\nof the problem and the HDU is treated like a standard binary table HDU. This\nnotification will only be made the first time compressed image data is\nencountered. In this way, the compression module is not required in order for\n``astropy`` to work.\n\n\nHeader and Summary\n------------------\n\nIn ``astropy``, the header of a compressed image HDU appears to the user like\nany image header. The actual header stored in the FITS file is that of a binary\ntable HDU with a set of special keywords, defined by the convention, to\ndescribe the structure of the compressed image. The conversion between binary\ntable HDU header and image HDU header is all performed behind the scenes.\nSince the HDU is actually a binary table, it may not appear as a primary HDU in\na FITS file.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Accessing Compressed FITS Image HDU Headers\n\nThe content of the HDU header may be accessed using the ``.header`` attribute::\n\n    >>> filename = fits.util.get_testdata_filepath('compressed_image.fits')\n\n    >>> hdul = fits.open(filename)\n    >>> hdul[1].header\n    XTENSION= 'IMAGE   '           / Image extension\n    BITPIX  =                   16 / data type of original image\n    NAXIS   =                    2 / dimension of original image\n    NAXIS1  =                   10 / length of original image axis\n    NAXIS2  =                   10 / length of original image axis\n    PCOUNT  =                    0 / number of parameters\n    GCOUNT  =                    1 / number of groups\n\nThe contents of the corresponding binary table HDU may be accessed using the\nhidden ``._header`` attribute. However, all user interface with the HDU header\nshould be accomplished through the image header (the ``.header`` attribute)::\n\n    >>> hdul[1]._header\n    XTENSION= 'BINTABLE'           / binary table extension\n    BITPIX  =                    8 / array data type\n    NAXIS   =                    2 / number of array dimensions\n    NAXIS1  =                    8 / width of table in bytes\n    NAXIS2  =                   10 / number of rows in table\n    PCOUNT  =                   60 / number of group parameters\n    GCOUNT  =                    1 / number of groups\n    TFIELDS =                    1 / number of fields in each row\n    TTYPE1  = 'COMPRESSED_DATA'    / label for field 1\n    TFORM1  = '1PB(6)  '           / data format of field: variable length array\n    ZIMAGE  =                    T / extension contains compressed image\n    ZTENSION= 'IMAGE   '           / Image extension\n    ZBITPIX =                   16 / data type of original image\n    ZNAXIS  =                    2 / dimension of original image\n    ZNAXIS1 =                   10 / length of original image axis\n    ZNAXIS2 =                   10 / length of original image axis\n    ZPCOUNT =                    0 / number of parameters\n    ZGCOUNT =                    1 / number of groups\n    ZTILE1  =                   10 / size of tiles to be compressed\n    ZTILE2  =                    1 / size of tiles to be compressed\n    ZCMPTYPE= 'RICE_1  '           / compression algorithm\n    ZNAME1  = 'BLOCKSIZE'          / compression block size\n    ZVAL1   =                   32 / pixels per block\n    ZNAME2  = 'BYTEPIX '           / bytes per pixel (1, 2, 4, or 8)\n    ZVAL2   =                    2 / bytes per pixel (1, 2, 4, or 8)\n    EXTNAME = 'COMPRESSED_IMAGE'   / name of this binary table extension\n\nThe contents of the HDU can be summarized by using either the :func:`info`\nconvenience function or method::\n\n    >>> fits.info(filename)\n    Filename: ...compressed_image.fits\n    No.    Name      Ver    Type      Cards   Dimensions   Format\n      0  PRIMARY       1 PrimaryHDU       4   ()\n      1  COMPRESSED_IMAGE    1 CompImageHDU      7   (10, 10)   int16\n\n    >>> hdul.info()\n    Filename: ...compressed_image.fits\n    No.    Name      Ver    Type      Cards   Dimensions   Format\n      0  PRIMARY       1 PrimaryHDU       4   ()\n      1  COMPRESSED_IMAGE    1 CompImageHDU      7   (10, 10)   int16\n\n..\n  EXAMPLE END\n\nData\n----\n\nAs with the header, the data of a compressed image HDU appears to the user as\nstandard uncompressed image data. The actual data is stored in the FITS file\nas Binary Table data containing at least one column (COMPRESSED_DATA). Each\nrow of this variable length column contains the byte stream that was generated\nas a result of compressing the corresponding image tile. Several optional\ncolumns may also appear. These include UNCOMPRESSED_DATA to hold the\nuncompressed pixel values for tiles that cannot be compressed, ZSCALE and ZZERO\nto hold the linear scale factor and zero point offset which may be needed to\ntransform the raw uncompressed values back to the original image pixel values,\nand ZBLANK to hold the integer value used to represent undefined pixels (if\nany) in the image.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Accessing Compressed FITS Image HDU Data\n\nThe contents of the uncompressed HDU data may be accessed using the ``.data``\nattribute::\n\n    >>> hdul[1].data\n    array([[ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9],\n           [10, 11, 12, 13, 14, 15, 16, 17, 18, 19],\n           [20, 21, 22, 23, 24, 25, 26, 27, 28, 29],\n           [30, 31, 32, 33, 34, 35, 36, 37, 38, 39],\n           [40, 41, 42, 43, 44, 45, 46, 47, 48, 49],\n           [50, 51, 52, 53, 54, 55, 56, 57, 58, 59],\n           [60, 61, 62, 63, 64, 65, 66, 67, 68, 69],\n           [70, 71, 72, 73, 74, 75, 76, 77, 78, 79],\n           [80, 81, 82, 83, 84, 85, 86, 87, 88, 89],\n           [90, 91, 92, 93, 94, 95, 96, 97, 98, 99]], dtype=int16)\n    >>> hdul.close()\n\nThe compressed data can be accessed via the ``.compressed_data`` attribute, but\nthis rarely needs be accessed directly. It may be useful for performing direct\ncopies of the compressed data without needing to decompress it first.\n\n..\n  EXAMPLE END\n\n\nCreating a Compressed Image HDU\n-------------------------------\n\nTo create a compressed image HDU from scratch, construct a\n:class:`CompImageHDU` object from an uncompressed image data array and its\nassociated image header. From there, the HDU can be treated just like any\nother image HDU.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Creating a Compressed FITS Image HDU\n\nTo create a compressed image HDU::\n\n    >>> imageData = np.arange(100).astype('i2').reshape(10, 10)\n    >>> imageHeader = fits.Header()\n    >>> hdu = fits.CompImageHDU(imageData, imageHeader)\n    >>> hdu.writeto('compressed_image.fits')\n\nThe API documentation for the :class:`CompImageHDU` initializer method\ndescribes the possible options for constructing a :class:`CompImageHDU` object.\n\n..\n  EXAMPLE END\n"},{"id":83,"name":"docs/io/fits/appendix","nodeType":"Package"},{"id":84,"name":"header_transition.rst","nodeType":"TextFile","path":"docs/io/fits/appendix","text":".. currentmodule:: astropy.io.fits\n.. doctest-skip-all\n\n.. _header-transition-guide:\n\n*********************************\nHeader Interface Transition Guide\n*********************************\n\n.. note::\n\n    This guide was originally included with the release of PyFITS 3.1, and\n    still references PyFITS in many places, though the examples have been\n    updated for ``astropy.io.fits``. It is still useful here for informational\n    purposes, though Astropy has always used the PyFITS 3.1 Header interface.\n\nPyFITS v3.1 included an almost complete rewrite of the :class:`Header`\ninterface. Although the new interface is largely compatible with the old\ninterface (whether due to similarities in the design, or backwards-compatibility\nsupport), there are enough differences that a full explanation of the new\ninterface is merited.\n\nBackground\n==========\n\nPrior to 3.1, PyFITS users interacted with FITS headers by way of three\ndifferent classes: :class:`Card`, ``CardList``, and :class:`Header`.\n\nThe Card class represents a single header card with a keyword, value, and\ncomment. It also contains all of the machinery for parsing FITS header cards,\ngiven the 80-character string, or \"card image\" read from the header.\n\nThe CardList class is actually a subclass of Python's `list` built-in. It was\nmeant to represent the actual list of cards that make up a header. That is, it\nrepresents an ordered list of cards in the physical order that they appear in\nthe header. It supports the usual list methods for inserting and appending new\ncards into the list. It also supports `dict`-like keyword access, where\n``cardlist['KEYWORD']`` would return the first card in the list with the given\nkeyword.\n\nA lot of the functionality for manipulating headers was actually buried in the\nCardList class. The Header class was more of a wrapper around CardList that\nadded a little bit of abstraction. It also implemented a partial dict-like\ninterface, though for Headers a keyword lookup returned the header value\nassociated with that keyword, not the Card object, and almost every\nmethod on the Header class was just performing some operations on the\nunderlying CardList.\n\nThe problem was that there were certain things a user could *only* do by\ndirectly accessing the CardList, such as look up the comments on a card or\naccess cards that have duplicate keywords, such as HISTORY. Another long-\nstanding misfeature was that slicing a Header object actually returned a\nCardList object, rather than a new Header. For all but the simplest use cases,\nworking with CardList objects was largely unavoidable.\n\nBut it was realized that CardList is really an implementation detail\nnot representing any element of a FITS file distinct from the header itself.\nUsers familiar with the FITS format know what a header is, but it is not clear\nhow a \"card list\" is distinct from that, or why operations go through the\nHeader object, while some have to be performed through the CardList.\n\nSo the primary goal of this redesign was to eliminate the ``CardList`` class\naltogether, and make it possible for users to perform all header manipulations\ndirectly through :class:`Header` objects. It also tried to present headers as\nsimilarly as possible to a more familiar data structure — an ordered mapping\n(or :class:`~collections.OrderedDict` in Python) for ease of use by new users\nless familiar with the FITS format, though there are still many added\ncomplexities for dealing with the idiosyncrasies of the FITS format.\n\n\nDeprecation Warnings\n====================\n\nA few older methods on the :class:`Header` class have been marked as deprecated,\neither because they have been renamed to a more `PEP 8`_-compliant name, or\nbecause have become redundant due to new features. To check if your code is\nusing any deprecated methods or features, run your code with ``python -Wd``.\nThis will output any deprecation warnings to the console.\n\nTwo of the most common deprecation warnings related to Headers are:\n\n- ``Header.has_key``: this has been deprecated since PyFITS 3.0,\n  just as Python's `dict.has_key` is deprecated. To check a key's presence\n  in a mapping object like `dict` or :class:`Header`, use the ``key in d``\n  syntax. This has long been the preference in Python.\n\n- ``Header.ascardlist`` and ``Header.ascard``: these were used to\n  access the ``CardList`` object underlying a header. They should still\n  work, and return a skeleton CardList implementation that should support most\n  of the old CardList functionality. But try removing as much of this as\n  possible. If direct access to the :class:`Card` objects making up a header\n  is necessary, use :attr:`Header.cards`, which returns an iterator over the\n  cards. More on that below.\n\n.. _PEP 8: https://www.python.org/dev/peps/pep-0008/\n\nNew Header Design\n=================\n\nThe new :class:`Header` class is designed to work as a drop-in replacement for\na `dict` via `duck typing`_. That is, although it is not a subclass of `dict`,\nit implements all of the same methods and interfaces. In particular, it is\nsimilar to an :class:`~collections.OrderedDict` in that the order of insertions\nis preserved. However, Header also supports many additional features and\nbehaviors specific to the FITS format. It should also be noted that while the\nold Header implementation also had a dict-like interface, it did not implement\nthe *entire* dict interface as the new Header does.\n\nAlthough the new Header is used like a dict/mapping in most cases, it also\nsupports a `list` interface. The list-like interface is a bit idiosyncratic in\nthat in some contexts the Header acts like a list of values, in others like a\nlist of keywords, and in a few contexts like a list of :class:`Card` objects.\nThis may be the most difficult aspect of the new design, but there is a logic\nto it.\n\nAs with the old Header implementation, integer index access is supported:\n``header[0]`` returns the value of the first keyword. However, the\n:meth:`Header.index` method treats the header as though it is a list of\nkeywords and returns the index of a given keyword. For example::\n\n    >>> header.index('BITPIX')\n    2\n\n:meth:`Header.count` is similar to `list.count` and also takes a keyword as\nits argument::\n\n    >>> header.count('HISTORY')\n    20\n\nA good rule of thumb is that any item access using square brackets ``[]``\nreturns *value* in the header, whether using keyword or index lookup. Methods\nlike :meth:`~Header.index` and :meth:`~Header.count` that deal with the order\nand quantity of items in the Header generally work on keywords. Finally,\nmethods like :meth:`~Header.insert` and :meth:`~Header.append` that add new\nitems to the header work on cards.\n\nAside from the list-like methods, the new Header class works very similarly to\nthe old implementation for most basic use cases and should not present too many\nsurprises. There are differences, however:\n\n- As before, the Header() initializer can take a list of :class:`Card` objects\n  with which to fill the header. However, now any iterable may be used. It is\n  also important to note that *any* Header method that accepts :class:`Card`\n  objects can also accept 2-tuples or 3-tuples in place of Cards. That is,\n  either a ``(keyword, value, comment)`` tuple or a ``(keyword, value)`` tuple\n  (comment is assumed blank) may be used anywhere in place of a Card object.\n  This is even preferred, as it involves less typing. For example::\n\n      >>> from astropy.io import fits\n      >>> header = fits.Header([('A', 1), ('B', 2), ('C', 3, 'A comment')])\n      >>> header\n      A       =                    1\n      B       =                    2\n      C       =                    3 / A comment\n\n- As demonstrated in the previous example, the ``repr()`` for a Header (that is,\n  the text that is displayed when entering a Header object in the Python\n  console as an expression), shows the header as it would appear in a FITS file.\n  This inserts newlines after each card so that it is readable regardless of\n  terminal width. It is *not* necessary to use ``print header`` to view this.\n  Entering ``header`` displays the header contents as it would appear in the\n  file (sans the END card).\n\n- ``len(header)`` is now supported (previously it was necessary to do\n  ``len(header.ascard)``). This returns the total number of cards in the\n  header, including blank cards, but excluding the END card.\n\n- FITS supports having duplicate keywords, although they are generally in error\n  except for commentary keywords like COMMENT and HISTORY. PyFITS now supports\n  reading, updating, and deleting duplicate keywords; instead of using the\n  keyword by itself, use a ``(keyword, index)`` tuple. For example,\n  ``('HISTORY', 0)`` represents the first HISTORY card, ``('HISTORY', 1)``\n  represents the second HISTORY card, and so on. In fact, when a keyword is\n  used by itself, it is shorthand for ``(keyword, 0)``. It is now possible to\n  delete an accidental duplicate like so::\n\n      >>> del header[('NAXIS', 1)]\n\n  This will remove an accidental duplicate NAXIS card from the header.\n\n- Even if there are duplicate keywords, keyword lookups like\n  ``header['NAXIS']`` will always return the value associated with the first\n  copy of that keyword, with one exception: commentary keywords like COMMENT\n  and HISTORY are expected to have duplicates. So ``header['HISTORY']``, for\n  example, returns the whole sequence of HISTORY values in the correct order.\n  This list of values can be sliced arbitrarily. For example, to view the last\n  three history entries in a header::\n\n      >>> hdulist[0].header['HISTORY'][-3:]\n        reference table oref$laf13367o_pct.fits\n        reference table oref$laf13369o_apt.fits\n      Heliocentric correction = 16.225 km/s\n\n- Subscript assignment can now be used to add new keywords to the header. Just\n  as with a normal `dict`, ``header['NAXIS'] = 1`` will either update the NAXIS\n  keyword if it already exists, or add a new NAXIS keyword with a value of\n  ``1`` if it does not exist. In the old interface this would return a\n  `KeyError` if NAXIS did not exist, and the only way to add a new\n  keyword was through the update() method.\n\n  By default, new keywords added in this manner are added to the end of the\n  header, with a few FITS-specific exceptions:\n\n  * If the header contains extra blank cards at the end, new keywords are added\n    before the blanks.\n\n  * If the header ends with a list of commentary cards — for example, a sequence\n    of HISTORY cards — those are kept at the end, and new keywords are inserted\n    before the commentary cards.\n\n  * If the keyword is a commentary keyword like COMMENT or HISTORY (or an empty\n    string for blank keywords), a *new* commentary keyword is always added and\n    appended to the last commentary keyword of the same type. For example,\n    HISTORY keywords are always placed after the last history keyword::\n\n        >>> header = fits.Header()\n        >>> header['COMMENT'] = 'Comment 1'\n        >>> header['HISTORY'] = 'History 1'\n        >>> header['COMMENT'] = 'Comment 2'\n        >>> header['HISTORY'] = 'History 2'\n        >>> header\n        COMMENT Comment 1\n        COMMENT Comment 2\n        HISTORY History 1\n        HISTORY History 2\n\n  These behaviors represent a sensible default behavior for keyword assignment,\n  and the same behavior as :meth:`~Header.update` in the old Header\n  implementation. The default behaviors may still be bypassed through the use\n  of other assignment methods like the :meth:`Header.set` and\n  :meth:`Header.append` methods described later.\n\n- It is now also possible to assign a value and a comment to a keyword\n  simultaneously using a tuple::\n\n      >>> header['NAXIS'] = (2, 'Number of axis')\n\n  This will update the value and comment of an existing keyword, or add a new\n  keyword with the given value and comment.\n\n- There is a new :attr:`Header.comments` attribute which lists all of the\n  comments associated with keywords in the header (not to be confused with\n  COMMENT cards). This allows viewing and updating the comments on specific\n  cards::\n\n      >>> header.comments['NAXIS']\n      Number of axis\n      >>> header.comments['NAXIS'] = 'Number of axes'\n      >>> header.comments['NAXIS']\n      Number of axes\n\n- When deleting a keyword from a header, do not assume that the keyword already\n  exists. In the old Header implementation, this action would silently do\n  nothing. For backwards-compatibility, it is still okay to delete a\n  nonexistent keyword, but a warning will be raised. In the future this\n  *will* be changed so that trying to delete a nonexistent keyword raises a\n  `KeyError`. This is for consistency with the behavior of Python dicts. So\n  unless you know for certain that a keyword exists before deleting it, it is\n  best to do something like::\n\n      >>> try:\n      ...     del header['BITPIX']\n      ... except KeyError:\n      ...     pass\n\n  Or if you prefer to look before you leap::\n\n      >>> if 'BITPIX' in header:\n      ...     del header['BITPIX']\n\n- ``del header`` now supports slices. For example, to delete the last three\n  keywords from a header::\n\n      >>> del header[-3:]\n\n- Two headers can now be compared for equality — previously no two Header\n  objects were the same. Now they compare as equal if they contain the exact\n  same content. That is, this requires strict equality.\n\n- Two headers can now be added with the '+' operator, which returns a copy of\n  the left header extended by the right header with :meth:`~Header.extend`.\n  Assignment addition is also possible.\n\n- The Header.update() method used commonly with the old Header API has been\n  renamed to :meth:`Header.set`. The primary reason for this change is very\n  simple: Header implements the `dict` interface, which already has a method\n  called update(), but that behaves differently from the old Header.update().\n\n  The details of the new update() can be read in the API docs, but it is very\n  similar to `dict.update`. It also supports backwards compatibility with the\n  old update() by analysis of the arguments passed to it, so existing code will\n  not break immediately. However, this *will* cause a deprecation warning to\n  be output if they are enabled. It is best, for starters, to replace all\n  update() calls with set(). Recall, also, that direct assignment is now\n  possible for adding new keywords to a header. So by and large the only\n  reason to prefer using :meth:`Header.set` is its capability of inserting or\n  moving a keyword to a specific location using the ``before`` or ``after``\n  arguments.\n\n- Slicing a Header with a slice index returns a new Header containing only\n  those cards contained in the slice. As mentioned earlier, it used to be that\n  slicing a Header returned a card list — something of a misfeature. In\n  general, objects that support slicing ought to return an object of the same\n  type when you slice them.\n\n  Likewise, wildcard keywords used to return a CardList object — now they\n  return a new Header similarly to a slice. For example::\n\n      >>> header['NAXIS*']\n\n  returns a new header containing only the NAXIS and NAXISn cards from the\n  original header.\n\n.. _duck typing: https://en.wikipedia.org/wiki/Duck_typing\n\n\nTransition Tips\n===============\n\nThe above may seem like a lot, but the majority of existing code using PyFITS\nto manipulate headers should not need to be updated, at least not immediately.\nThe most common operations still work the same.\n\nAs mentioned above, it would be helpful to run your code with ``python -Wd`` to\nenable deprecation warnings — that should be a good idea of where to look to\nupdate your code.\n\nIf your code needs to be able to support older versions of PyFITS\nsimultaneously with PyFITS 3.1, things are slightly trickier, but not by\nmuch — the deprecated interfaces will not be removed for several more versions\nbecause of this.\n\n- The first change worth making, which is supported by any PyFITS version in\n  the last several years, is to remove any use of ``Header.has_key`` and\n  replace it with ``keyword in header`` syntax. It is worth making this change\n  for any dict as well, since `dict.has_key` is deprecated. Running the\n  following regular expression over your code may help with most (but not all)\n  cases::\n\n      s/([^ ]+)\\.has_key\\(([^)]+)\\)/\\2 in \\1/\n\n- If possible, replace any calls to Header.update() with Header.set() (though\n  do not bother with this if you need to support older PyFITS versions). Also,\n  if you have any calls to Header.update() that can be replaced with simple\n  subscript assignments (e.g., ``header['NAXIS'] = (2, 'Number of axes')``) do\n  that too, if possible.\n\n- Find any code that uses ``header.ascard`` or ``header.ascardlist()``. First\n  ascertain whether that code really needs to work directly on Card objects.\n  If that is definitely the case, go ahead and replace those with\n  ``header.cards`` — that should work without too much fuss. If you do need to\n  support older versions, you may keep using ``header.ascard`` for now.\n\n- In the off chance that you have any code that slices a header, it is best to\n  take the result of that and create a new Header object from it. For\n  example::\n\n      >>> new_header = fits.Header(old_header[2:])\n\n  This avoids the problem that in PyFITS <= 3.0 slicing a Header returns a\n  CardList by using the result to initialize a new Header object. This will\n  work in both cases (in PyFITS 3.1, initializing a Header with an existing\n  Header just copies it, à la `list`).\n\n- As mentioned earlier, locate any code that deletes keywords with ``del`` and\n  make sure they either look before they leap (``if keyword in header:``) or\n  ask forgiveness (``try/except KeyError:``).\n\nOther Gotchas\n-------------\n\n- As mentioned above, it is not necessary to enter ``print header`` to display\n  a header in an interactive Python prompt. Entering ``>>> header``\n  by itself is sufficient. Using ``print`` usually will *not* display the\n  header readably, because it does not include line breaks between the header\n  cards. The reason is that Python has two types of string representations.\n  One is returned when a user calls ``str(header)``, which happens automatically\n  when you ``print`` a variable. In the case of the Header class this actually\n  returns the string value of the header as it is written literally in the\n  FITS file, which includes no line breaks.\n\n  The other type of string representation happens when one calls\n  ``repr(header)``. The `repr` of an object is meant to be a useful\n  string \"representation\" of the object; in this case the contents of the\n  header but with line breaks between the cards and with the END card and\n  trailing padding stripped off. This happens automatically when\n  a user enters a variable at the Python prompt by itself without a ``print``\n  call.\n\n- The current version of the FITS Standard (3.0) states in section 4.2.1\n  that trailing spaces in string values in headers are not significant and\n  should be ignored. PyFITS < 3.1 *did* treat trailing spaces as significant.\n  For example, if a header contained:\n\n      KEYWORD1= 'Value    '\n\n  then ``header['KEYWORD1']`` would return the string ``'Value    '`` exactly,\n  with the trailing spaces intact. The new Header interface fixes this by\n  automatically stripping trailing spaces, so that ``header['KEYWORD1']`` would\n  return just ``'Value'``.\n\n  There is, however, one convention used by the IRAF CCD mosaic task for\n  representing its TNX World Coordinate System and ZPX World Coordinate System\n  nonstandard WCS that uses a series of keywords in the form ``WATj_nnn``,\n  which store a text description of coefficients for a nonlinear distortion\n  projection. It uses its own microformat for listing the coefficients as a\n  string, but the string is long, and thus broken up into several of these\n  ``WATj_nnn`` keywords. Correct recombination of these keywords requires\n  treating all whitespace literally. This convention either overlooked or\n  predated the prescribed treatment of whitespace in the FITS standard.\n\n  To get around this issue, a global variable ``fits.STRIP_HEADER_WHITESPACE``\n  was introduced. Temporarily setting\n  ``fits.STRIP_HEADER_WHITESPACE.set(False)`` before reading keywords affected\n  by this issue will return their values with all trailing whitespace intact.\n\n  A future version of PyFITS may be able to detect use of conventions like this\n  contextually and behave according to the convention, but in most cases the\n  default behavior of PyFITS is to behave according to the FITS Standard.\n"},{"id":85,"name":"faq.rst","nodeType":"TextFile","path":"docs/io/fits/appendix","text":".. _io-fits-faq:\n\nastropy.io.fits FAQ\n*******************\n\n.. contents::\n\nGeneral Questions\n=================\n\nWhat is PyFITS and how does it relate to ``astropy``?\n-----------------------------------------------------\n\nPyFITS_ is a library written in, and for use with the Python_ programming\nlanguage for reading, writing, and manipulating FITS_ formatted files. It\nincludes a high-level interface to FITS headers with the ability for high- and\nlow-level manipulation of headers, and it supports reading image and table\ndata as Numpy_ arrays. It also supports more obscure and nonstandard formats\nfound in some FITS files.\n\nThe `astropy.io.fits` module is identical to PyFITS but with the names changed.\nWhen the development of ``astropy`` began, it was clear that one of the core\nrequirements would be a FITS reader. Rather than starting from scratch,\nPyFITS — being the most flexible FITS reader available for Python — was ported\ninto ``astropy``. There are plans to gradually phase out PyFITS as a stand-alone\nmodule and deprecate it in favor of `astropy.io.fits`. See more about this in\nthe next question.\n\nAlthough PyFITS is written mostly in Python, it includes an optional module\nwritten in C that is required to read/write compressed image data. However,\nthe rest of PyFITS functions without this extension module.\n\n.. _PyFITS: https://github.com/spacetelescope/pyfits\n.. _FITS: https://fits.gsfc.nasa.gov/\n\n\nWhat is the development status of PyFITS?\n-----------------------------------------\n\nPyFITS was written and maintained by the Science Software Branch at the `Space\nTelescope Science Institute`_, and is licensed by AURA_ under a `3-clause BSD\nlicense`_.\n\nIt is now exclusively developed as a component of ``astropy``\n(`astropy.io.fits`) rather than as a stand-alone module. There are a few\nreasons for this: The first is simply to reduce development effort; the\noverhead of maintaining both PyFITS *and* `astropy.io.fits` in separate code\nbases is nontrivial. The second is that there are many features of ``astropy``\n(units, tables, etc.) from which the `astropy.io.fits` module can benefit\ngreatly. Since PyFITS is already integrated into ``astropy``, it makes more\nsense to continue development there rather than make ``astropy`` a dependency\nof PyFITS.\n\nPyFITS' past primary developer and active maintainer was Erik Bray. There\nis a `GitHub project`_ for PyFITS, but PyFITS is not actively developed anymore\nso patches and issue reports should be posted on the Astropy issue tracker.\n\nThe current (and last) stable release is 3.4.0.\n\n.. _Space Telescope Science Institute: https://www.stsci.edu/\n.. _AURA: https://www.aura-astronomy.org/\n.. _3-clause BSD license: https://en.wikipedia.org/wiki/BSD_licenses#3-clause_license_.28.22New_BSD_License.22_or_.22Modified_BSD_License.22.29\n.. _GitHub project: https://github.com/spacetelescope/PyFITS\n\n\nUsage Questions\n===============\n\nSomething did not work as I expected. Did I do something wrong?\n---------------------------------------------------------------\n\nPossibly. But if you followed the documentation and things still did not work\nas expected, it is entirely possible that there is a mistake in the\ndocumentation, a bug in the code, or both. So feel free to report it as a bug.\nThere are also many, many corner cases in FITS files, with new ones discovered\nalmost every week. `astropy.io.fits` is always improving, but does not support\nall cases perfectly. There are some features of the FITS format (scaled data,\nfor example) that are difficult to support correctly and can sometimes cause\nunexpected behavior.\n\nFor the most common cases, however, such as reading and updating FITS headers,\nimages, and tables, `astropy.io.fits` is very stable and well-tested. Before\nevery ``astropy`` release it is ensured that all of its tests pass on a variety\nof platforms, and those tests cover the majority of use cases (until new corner\ncases are discovered).\n\n\n``astropy`` crashed and output a long string of code. What do I do?\n-------------------------------------------------------------------\n\nThis listing of code is what is known as a `stack trace`_ (or in Python\nparlance a \"traceback\"). When an unhandled exception occurs in the code\ncausing the program to end, this is a way of displaying where the exception\noccurred and the path through the code that led to it.\n\nAs ``astropy`` is meant to be used as a piece in other software projects, some\nexceptions raised by ``astropy`` are by design. For example, one of the most\ncommon exceptions is a `KeyError` when an attempt is made to read\nthe value of a nonexistent keyword in a header::\n\n    >>> from astropy.io import fits\n    >>> h = fits.Header()\n    >>> h['NAXIS']\n    Traceback (most recent call last):\n        ...\n    KeyError: \"Keyword 'NAXIS' not found.\"\n\nThis indicates that something was looking for a keyword called \"NAXIS\" that\ndoes not exist. If an error like this occurs in some other software that uses\n``astropy``, it may indicate a bug in that software, in that it expected to\nfind a keyword that did not exist in a file.\n\nMost \"expected\" exceptions will output a message at the end of the traceback\ngiving some idea of why the exception occurred and what to do about it. The\nmore vague and mysterious the error message in an exception appears, the more\nlikely that it was caused by a bug in ``astropy``. So if you are getting an\nexception and you really do not know why or what to do about it, feel free to\nreport it as a bug.\n\n.. _stack trace: https://en.wikipedia.org/wiki/Stack_trace\n\n\nWhy does opening a file work in CFITSIO, ds9, etc., but not in ``astropy``?\n---------------------------------------------------------------------------\n\nAs mentioned elsewhere in this FAQ, there are many unusual corner cases when\ndealing with FITS files. It is possible that a file should work, but is not\nsupported due to a bug. Sometimes it is even possible for a file to work in an\nolder version of ``astropy``, but not a newer version due to a regression\nthat has not been tested for yet.\n\nAnother problem with the FITS format is that, as old as it is, there are many\nconventions that appear in files from certain sources that do not meet the FITS\nstandard. And yet they are so commonplace that it is necessary to support\nthem in any FITS readers. CONTINUE cards are one such example. There are\nnonstandard conventions supported by ``astropy`` that are not supported by\nCFITSIO and possibly vice versa. You may have hit one of those cases.\n\nIf ``astropy`` is having trouble opening a file, a good way to rule out whether\nnot the problem is with ``astropy`` is to run the file through the `fitsverify`_\nprogram. For smaller files you can even use the `online FITS verifier`_.\nThese use CFITSIO under the hood, and should give a good indication of whether\nor not there is something erroneous about the file. If the file is\nmalformatted, fitsverify will output errors and warnings.\n\nIf fitsverify confirms no problems with a file, and ``astropy`` is still having\ntrouble opening it (especially if it produces a traceback), then it is possible\nthere is a bug in ``astropy``.\n\n.. _fitsverify: https://heasarc.gsfc.nasa.gov/docs/software/ftools/fitsverify/\n.. _online FITS verifier: https://fits.gsfc.nasa.gov/fits_verify.html\n\n\nHow do I turn off the warning messages ``astropy`` outputs to my console?\n-------------------------------------------------------------------------\n\n``astropy`` uses Python's built-in `warnings`_ subsystem for informing about\nexceptional conditions in the code that are recoverable, but that the user may\nwant to be informed of. One of the most common warnings in `astropy.io.fits`\noccurs when updating a header value in such a way that the comment must be\ntruncated to preserve space::\n\n    Card is too long, comment is truncated.\n\nAny console output generated by ``astropy`` can be assumed to be from the\nwarnings subsystem. See Astropy's documentation on the :ref:`python-warnings`\nfor more information on how to control and quiet warnings.\n\n.. _warnings: https://docs.python.org/3/library/warnings.html\n\n\nWhat convention does ``astropy`` use for indexing, such as of image coordinates?\n--------------------------------------------------------------------------------\n\nAll arrays and sequences in ``astropy`` use a zero-based indexing scheme. For\nexample, the first keyword in a header is ``header[0]``, not ``header[1]``.\nThis is in accordance with Python itself, as well as C, on which Python is\nbased.\n\nThis may come as a surprise to veteran FITS users coming from IRAF, where\n1-based indexing is typically used, due to its origins in Fortran.\n\nLikewise, the top-left pixel in an N x N array is ``data[0,0]``. The indices\nfor 2-dimensional arrays are row-major order, in that the first index is the\nrow number, and the second index is the column number. Or put in terms of\naxes, the first axis is the y-axis, and the second axis is the x-axis. This is\nthe opposite of column-major order, which is used by Fortran and hence FITS.\nFor example, the second index refers to the axis specified by NAXIS1 in the\nFITS header.\n\nIn general, for N-dimensional arrays, row-major orders means that the\nright-most axis is the one that varies the fastest while moving over the\narray data linearly. For example, the 3-dimensional array::\n\n    [[[1, 2],\n      [3, 4]],\n     [[5, 6],\n      [7, 8]]]\n\nis represented linearly in row-major order as::\n\n    [1, 2, 3, 4, 5, 6, 7, 8]\n\nSince 2 immediately follows 1, you can see that the right-most (or inner-most)\naxis is the one that varies the fastest.\n\nThe discrepancy in axis-ordering may take some getting used to, but it is a\nnecessary evil. Since most other Python and C software assumes row-major\nordering, trying to enforce column-major ordering in arrays returned by\n``astropy`` is likely to cause more difficulties than it is worth.\n\n\nHow do I open a very large image that will not fit in memory?\n-------------------------------------------------------------\n\n`astropy.io.fits.open` has an option to access the data portion of an\nHDU by memory mapping using `mmap`_. In ``astropy`` this is used by default.\n\nWhat this means is that accessing the data as in the example above only reads\nportions of the data into memory on demand. For example, if we request just a\nslice of the image, such as ``hdul[0].data[100:200]``, then only rows 100-200\nwill be read into memory. This happens transparently, as though the entire\nimage were already in memory. This works the same way for tables. For most\ncases this is your best bet for working with large files.\n\nTo ensure use of memory mapping, add the ``memmap=True`` argument to\n:func:`fits.open <astropy.io.fits.open>`. Likewise, using ``memmap=False`` will\nforce data to be read entirely into memory.\n\nThe default can also be controlled through a configuration option called\n``USE_MEMMAP``. Setting this to ``0`` will disable mmap by default.\n\nUnfortunately, memory mapping does not currently work as well with scaled\nimage data, where BSCALE and BZERO factors need to be applied to the data to\nyield physical values. Currently this requires enough memory to hold the\nentire array, though this is an area that will see improvement in the future.\n\nAn alternative, which currently only works for image data (that is, non-tables)\nis the sections interface. It is largely replaced by the better support for\nmmap, but may still be useful on systems with more limited virtual memory\nspace, such as on 32-bit systems. Support for scaled image data is flaky with\nsections too, though that will be fixed. See the documentation on :ref:`image\nsections <data-sections>` for more details on using this interface.\n\n.. _mmap: https://en.wikipedia.org/wiki/Mmap\n\n\nHow can I create a very large FITS file from scratch?\n-----------------------------------------------------\n\nSee :ref:`sphx_glr_generated_examples_io_skip_create-large-fits.py`.\n\nFor creating very large tables, this method may also be used, though it can be\ndifficult to determine ahead of time how many rows a table will need. In\ngeneral, use of the `astropy.io.fits` module is currently discouraged for the\ncreation and manipulation of large tables. The FITS format itself is not\ndesigned for efficient on-disk or in-memory manipulation of table structures.\nFor large, heavy-duty table data it might be better too look into using `HDF5`_\nthrough the `PyTables`_ library. The :ref:`Astropy Table <astropy-table>`\ninterface can provide an abstraction layer between different on-disk table\nformats as well (for example, for converting a table between FITS and HDF5).\n\nPyTables makes use of NumPy under the hood, and can be used to write binary\ntable data to disk in the same format required by FITS. It is then possible\nto serialize your table to the FITS format for distribution. At some point\nthis FAQ might provide an example of how to do this.\n\n.. _HDF5: https://www.hdfgroup.org/HDF5/\n.. _PyTables: http://www.pytables.org/\n\n\nHow do I create a multi-extension FITS file from scratch?\n---------------------------------------------------------\n\nSee :ref:`sphx_glr_generated_examples_io_create-mef.py`.\n\n\n.. _fits-scaled-data-faq:\n\nWhy is an image containing integer data being converted unexpectedly to floats?\n-------------------------------------------------------------------------------\n\nIf the header for your image contains nontrivial values for the optional\nBSCALE and/or BZERO keywords (that is, BSCALE != 1 and/or BZERO != 0), then\nthe raw data in the file must be rescaled to its physical values according to\nthe formula::\n\n    physical_value = BZERO + BSCALE * array_value\n\nAs BZERO and BSCALE are floating point values, the resulting value must be a\nfloat as well. If the original values were 16-bit integers, the resulting\nvalues are single-precision (32-bit) floats. If the original values were\n32-bit integers, the resulting values are double-precision (64-bit floats).\n\nThis automatic scaling can easily catch you off guard if you are not expecting\nit, because it does not happen until the data portion of the HDU is accessed\n(to allow for things like updating the header without rescaling the data). For\nexample::\n\n    >>> fits_scaledimage_filename = fits.util.get_testdata_filepath('scale.fits')\n\n    >>> hdul = fits.open(fits_scaledimage_filename)\n    >>> image = hdul[0]\n    >>> image.header['BITPIX']\n    16\n    >>> image.header['BSCALE']\n    0.045777764213996\n    >>> data = image.data  # Read the data into memory\n    >>> data.dtype.name    # Got float32 despite BITPIX = 16 (16-bit int)\n    'float32'\n    >>> image.header['BITPIX']  # The BITPIX will automatically update too\n    -32\n    >>> 'BSCALE' in image.header  # And the BSCALE keyword removed\n    False\n\nThe reason for this is that once a user accesses the data they may also\nmanipulate it and perform calculations on it. If the data were forced to\nremain as integers, a great deal of precision is lost. So it is best to err\non the side of not losing data, at the cost of causing some confusion at\nfirst.\n\nIf the data must be returned to integers before saving, use the\n`~astropy.io.fits.ImageHDU.scale` method::\n\n    >>> image.scale('int32')\n    >>> image.header['BITPIX']\n    32\n    >>> hdul.close()\n\nAlternatively, if a file is opened with ``mode='update'`` along with the\n``scale_back=True`` argument, the original BSCALE and BZERO scaling will\nbe automatically reapplied to the data before saving. Usually this is\nnot desirable, especially when converting from floating point values back to\nunsigned integer values. But this may be useful in cases where the raw\ndata needs to be modified corresponding to changes in the physical values.\n\nTo prevent rescaling from occurring at all (which is good for updating headers\n— even if you do not intend for the code to access the data, it is good to err\non the side of caution here), use the ``do_not_scale_image_data`` argument when\nopening the file::\n\n    >>> hdul = fits.open(fits_scaledimage_filename, do_not_scale_image_data=True)\n    >>> image = hdul[0]\n    >>> image.data.dtype.name\n    'int16'\n    >>> hdul.close()\n\n\nWhy am I losing precision when I assign floating point values in the header?\n----------------------------------------------------------------------------\n\nThe FITS standard allows two formats for storing floating point numbers in a\nheader value. The \"fixed\" format requires the ASCII representation of the\nnumber to be in bytes 11 through 30 of the header card, and to be\nright-justified. This leaves a standard number of characters for any comment\nstring.\n\nThe fixed format is not wide enough to represent the full range of values that\ncan be stored in a 64-bit float with full precision. So FITS also supports a\n\"free\" format in which the ASCII representation can be stored anywhere, using\nthe full 70 bytes of the card (after the keyword).\n\nCurrently ``astropy`` only supports writing fixed format (it can read both\nformats), so all floating point values assigned to a header are stored in the\nfixed format. There are plans to add support for more flexible formatting.\n\nIn the meantime, it is possible to add or update cards by manually formatting\nthe card image from a string, as it should appear in the FITS file::\n\n    >>> c = fits.Card.fromstring('FOO     = 1234567890.123456789')\n    >>> h = fits.Header()\n    >>> h.append(c)\n    >>> h\n    FOO     = 1234567890.123456789\n\nAs long as you do not assign new values to 'FOO' via ``h['FOO'] = 123``, will\nmaintain the header value exactly as you formatted it (as long as it is valid\naccording to the FITS standard).\n\n\nWhy is reading rows out of a FITS table so slow?\n------------------------------------------------\n\nUnderlying every table data array returned by `astropy.io.fits` is a ``numpy``\n`~numpy.recarray` which is a ``numpy`` array type specifically for representing\nstructured array data (i.e., a table). As with normal image arrays, ``astropy``\naccesses the underlying binary data from the FITS file via mmap (see the\nquestion \"`What performance differences are there between astropy.io.fits and\nfitsio?`_\" for a deeper explanation of this). The underlying mmap is then\nexposed as a `~numpy.recarray` and in general this is a very efficient way to\nread the data.\n\nHowever, for many (if not most) FITS tables it is not all that simple. For\nmany columns there are conversions that have to take place between the actual\ndata that is \"on disk\" (in the FITS file) and the data values that are returned\nto the user. For example, FITS binary tables represent boolean values\ndifferently from how ``numpy`` expects them to be represented, \"Logical\" columns\nneed to be converted on the fly to a format ``numpy`` (and hence the user) can\nunderstand. This issue also applies to data that is linearly scaled via the\n``TSCALn`` and ``TZEROn`` header keywords.\n\nSupporting all of these \"FITS-isms\" introduces a lot of overhead that might\nnot be necessary for all tables, but are still common nonetheless. That is\nnot to say it cannot be faster even while supporting the peculiarities of\nFITS — CFITSIO, for example, supports all of the same features but is orders of\nmagnitude faster. ``astropy`` could do much better here too, and there are many\nknown issues causing slowdown. There are plenty of opportunities for speedups,\nand patches are welcome. In the meantime, for high-performance applications\nwith FITS tables some users might find the ``fitsio`` library more to their\nliking.\n\n\nI am opening many FITS files in a loop and getting OSError: Too many open files\n-------------------------------------------------------------------------------\n\nSay you have some code like:\n\n.. code:: python\n\n    from astropy.io import fits\n\n    for filename in filenames:\n        with fits.open(filename) as hdul:\n            for hdu in hdul:\n                hdu_data = hdul.data\n                # Do some stuff with the data\n\n\nThe details may differ, but the qualitative point is that the data to many\nHDUs and/or FITS files are being accessed in a loop. This may result in\nan exception like::\n\n    Traceback (most recent call last):\n      File \"<stdin>\", line 2, in <module>\n    OSError: [Errno 24] Too many open files: 'my_data.fits'\n\nAs explained in the :ref:`note on working with large files <fits-large-files>`,\nbecause ``astropy`` uses mmap by default to read the data in a FITS file, even\nif you correctly close a file with :meth:`HDUList.close\n<astropy.io.fits.HDUList.close>` a handle is kept open to that file so\nthat the memory-mapped data array can still continue to be read transparently.\n\nThe way ``numpy`` supports mmap is such that the file mapping is not closed\nuntil the overlying `~numpy.ndarray` object has no references to it and is freed\nmemory. However, when looping over a large number of files (or even just HDUs)\nrapidly, this may not happen immediately. Or in some cases if the HDU object\npersists, the data array attached to it may persist too. The recommended\nworkaround is to *manually* delete the ``.data`` attribute on the HDU object so\nthat the `~numpy.ndarray` reference is freed and the mmap can be closed:\n\n.. code:: python\n\n    from astropy.io import fits\n\n    for filename in filenames:\n        with fits.open(filename) as hdul:\n            for hdu in hdul:\n                hdu_data = hdul.data\n                # Do some stuff with the data\n                # ...\n                # Don't need the data anymore; delete all references to it\n                # so that it can be garbage collected\n                del hdu_data\n                del hdu.data\n\n\nIn some extreme cases files are opened and closed fast enough that Python's\ngarbage collector does not free them (and hence free the file handles) often\nenough. To mitigate this, your code can manually force a garbage collection\nby calling :func:`gc.collect` at the end of the loop.\n\nIn a future release it will be more convenient to automatically perform this\nsort of cleanup when closing FITS files, where needed.\n\nUsing header['NAXIS2'] += 1 does not add another row to my Table\n----------------------------------------------------------------\n\n``NAXIS`` and similar keywords are FITS *structural* keywords and should not be\nmodified by the user. They are automatically updated by :mod:`astropy.io.fits`\nwhen checking the validity of the data and headers. See :ref:`structural_keywords`\nfor more information.\n\nTo add rows to a table, you can modify the actual data.\n\nComparison with Other FITS Readers\n==================================\n\nWhat is the difference between astropy.io.fits and fitsio?\n----------------------------------------------------------\n\nThe `astropy.io.fits` module (originally PyFITS) is a \"pure Python\" FITS\nreader in that all of the code for parsing the FITS file format is in Python,\nthough ``numpy`` is used to provide access to the FITS data via the\n`~numpy.ndarray` interface. `astropy.io.fits` currently also accesses the\n`CFITSIO <https://heasarc.gsfc.nasa.gov/fitsio/fitsio.html>`_ to support the\nFITS Tile Compression convention, but this feature is optional. It does not\nuse CFITSIO outside of reading compressed images.\n\n`fitsio <https://github.com/esheldon/fitsio>`_, on the other hand, is a Python\nwrapper for the CFITSIO library. All of the heavy lifting of reading the FITS\nformat is handled by CFITSIO, while ``fitsio`` provides a better way to use\nobject-oriented API, including providing a ``numpy`` interface to FITS files\nread from CFITSIO. Much of it is written in C (to provide the interface between\nPython and CFITSIO), and the rest is in Python. The Python end mostly\nprovides the documentation and user-level API.\n\nBecause ``fitsio`` wraps CFITSIO it inherits most of its strengths and\nweaknesses, though it has an added strength of providing a more convenient\nAPI than if one were to use CFITSIO directly.\n\n\nWhy did Astropy adopt PyFITS as its FITS reader instead of fitsio?\n------------------------------------------------------------------\n\nWhen the Astropy Project was first started it was clear from the start that\none of its core components should be a submodule for reading and writing FITS\nfiles, as many other components would be likely to depend on this\nfunctionality. At the time, the ``fitsio`` package was in its infancy (it\ngoes back to roughly 2011) while PyFITS had already been established (going\nback to before the year 2000). It was already a mature package with support\nfor the vast majority of FITS files found in the wild, including outdated\nformats such as \"Random Groups\" FITS files still used extensively in the\nradio astronomy community.\n\nAlthough many aspects of PyFITS' interface have evolved over the years, much\nof it has also remained the same, and is already familiar to astronomers\nworking with FITS files in Python. Most of if not all existing training\nmaterials were also based around PyFITS. PyFITS was developed at STScI, which\nalso put forward significant resources to develop Astropy, with an eye toward\nintegrating Astropy into STScI's own software stacks. As most of the Python\nsoftware at STScI uses PyFITS, it was the only practical choice for making that\ntransition.\n\nFinally, although CFITSIO (and by extension ``fitsio``) can read any FITS files\nthat conform to the FITS standard, it does not support all of the nonstandard\nconventions that have been added to FITS files in the wild. While it does have\nsome support for some of these conventions (such as CONTINUE cards and, to a\nlimited extent, HIERARCH cards), it is not easy to add support for other\nconventions to a large and complex C codebase.\n\nPyFITS' object-oriented design makes supporting nonstandard conventions\nsomewhat easier in most cases, and as such PyFITS can be more flexible in the\ntypes of FITS files it can read and return *useful* data from. This includes\nbetter support for files that fail to meet the FITS standard, but still contain\nuseful data that should be readable enough to correct any violations of the\nFITS standard. For example, a common error in non-English speaking regions is\nto insert non-ASCII characters into FITS headers. This is not a valid FITS\nfile, but should still be readable in some sense. Supporting structural errors\nsuch as this is more difficult in CFITSIO which assumes a more rigid structure.\n\n\nWhat performance differences are there between astropy.io.fits and fitsio?\n--------------------------------------------------------------------------\n\nThere are two main performance areas to look at: reading/parsing FITS headers\nand reading FITS data (image-like arrays as well as tables).\n\nIn the area of headers, ``fitsio`` is significantly faster in most cases. This\nis due in large part to the (almost) pure C implementation (due to the use of\nCFITSIO), but also due to fact that it is more rigid and does not support as\nmany local conventions and other special cases as `astropy.io.fits` tries to\nsupport in its pure Python implementation.\n\nThat said, the difference is small and only likely to be a bottleneck either\nwhen opening files containing thousands of HDUs, or reading the headers out\nof thousands of FITS files in succession (in either case the difference is\nnot even an order of magnitude).\n\nWhere data is concerned the situation is a little more complicated, and\nrequires some understanding of how `astropy.io.fits` is implemented versus\nCFITSIO and ``fitsio``. First, it is important to understand how they differ in\nterms of memory management.\n\n`astropy.io.fits` uses mmap, by default, to provide access to the raw\nbinary data in FITS files. Mmap is a system call (or in most cases these days\na wrapper in your libc for a lower-level system call) which allows user-space\napplications to essentially do the same thing your OS is doing when it uses a\npagefile (swap space) for virtual memory: it allows data in a file on disk to\nbe paged into physical memory one page (or in practice usually several pages)\nat a time on an as-needed basis. These cached pages of the file are also\naccessible from all processes on the system, so multiple processes can read\nfrom the same file with little additional overhead. In the case of reading\nover all of the data in the file, the performance difference between using mmap\nversus reading the entire data into physical memory at once can vary widely\nbetween systems, hardware, and depending on what else is happening on the\nsystem at the moment, but mmap is almost always going to be better.\n\nIn principle, it requires more overhead since accessing each page will result in\na page fault and the system requires more requests to the disk. But in\npractice, the OS will optimize this pretty aggressively, especially for the most\ncommon case of sequential access — also in reality, reading the entire thing\ninto memory is still going to result in a whole lot of page faults too. For\nrandom access, having all of the data in physical memory is always going to be\nbest, though with mmap it is usually going to be pretty good too. (Most users\ndo not normally access all of the data in a file in a totally random order —\nusually a few sections of it will be accessed most frequently, so the OS will\nkeep those pages in physical memory as best it can.) For the most general case\nof reading FITS files (or most large data on disk) this is therefore the best\nchoice, especially for casual users, and is hence enabled by default.\n\nCFITSIO/``fitsio``, on the other hand, does not assume the existence of\ntechnologies like mmap and page caching. Thus it implements its own LRU cache\nof I/O buffers that store sections of FITS files read from disk in memory in\nFITS' famous 2880 byte chunk size. The I/O buffers are used heavily in\nparticular for keeping the headers in memory. Though for large data reads (for\nexample, reading an entire image from a file), it *does* bypass the cache and\ninstead does a read directly from disk into a user-provided memory buffer.\n\nHowever, even when CFITSIO reads direct from the file, this is still largely\nless efficient than using mmap. Normally when your OS reads a file from disk,\nit caches as much of that read as it can in physical memory (in its page cache)\nso that subsequent access to those same pages does not require a subsequent\nexpensive disk read. This happens when using mmap too, since the data has to\nbe copied from disk into RAM at some point. The difference is that when using\nmmap to access the data, the program is able to read that data *directly* out\nof the OS's page cache (as long as it is only being read). On the other hand,\nwhen reading data from a file into a local buffer such as with fread(), the\ndata is first read into the page cache (if not already present) and then copied\nfrom the page cache into the local buffer. So every read performs at least one\nadditional memory copy per page read (requiring twice as much physical memory,\nand possibly lots of paging if the file is large and pages need to dropped from\nthe cache).\n\nThe user API for CFITSIO usually works by having the user allocate a memory\nbuffer large enough to hold the image/table they want to read (or at least the\nsection they are interested in). There are some helper functions for\ndetermining the appropriate amount of space to allocate. Then you pass in\na pointer to your buffer and CFITSIO handles all of the reading (usually using\nthe process described above), and copies the results into your user buffer. For\nlarge reads, it reads directly from the file into your buffer, though if the\ndata needs to be scaled it makes a stop in CFITSIO's own buffer first, then\nwrites the rescaled values out to the user buffer (if rescaling has been\nrequested). Regardless, this means that if your program wishes to hold an\nentire image in memory at once it will use as much RAM as the size of the\ndata. For most applications it is better (and sufficient) to work on\nsmaller sections of the data, but this requires extra complexity. Using mmap\non the other hand makes managing this complexity more efficient.\n\nAn informal test demonstrates this difference. This test was performed on four\nsimple FITS images (one of which is a cube) of dimensions 256x256, 1024x1024,\n4096x4096, and 256x1024x1024. Each image was generated before the test and\nfilled with randomized 64-bit floating point values. A similar test was\nperformed using both `astropy.io.fits` and ``fitsio``. A handle to the FITS\nfile is opened using each library's basic semantics, and then the entire data\narray of the files is copied into a temporary array in memory (for example, if\nwe were blitting the image to a video buffer). For ``astropy`` the test is\nwritten:\n\n.. code:: python\n\n    def read_test_astropy(filename):\n        with fits.open(filename, memmap=True) as hdul:\n            data = hdul[0].data\n            c = data.copy()\n\nThe test was timed in IPython on a Linux system with kernel version 2.6.32, a\n6-core Intel Xeon X5650 CPU clocked at 2.67 GHz per core, and 11.6 GB of RAM\nusing:\n\n.. code:: python\n\n    for filename in filenames:\n        print(filename)\n        %timeit read_test_astropy(filename)\n\nwhere ``filenames`` is just a list of the aforementioned generated sample\nfiles. The results were::\n\n    256x256.fits\n    1000 loops, best of 3: 1.28 ms per loop\n    1024x1024.fits\n    100 loops, best of 3: 4.24 ms per loop\n    4096x4096.fits\n    10 loops, best of 3: 60.6 ms per loop\n    256x1024x1024.fits\n    1 loops, best of 3: 1.15 s per loop\n\nFor ``fitsio`` the test was:\n\n.. code:: python\n\n    def read_test_fitsio(filename):\n        with fitsio.FITS(filename) as f:\n            data = f[0].read()\n            c = data.copy()\n\nThis was also run in a loop over all of the sample files, producing the\nresults::\n\n    256x256.fits\n    1000 loops, best of 3: 476 µs per loop\n    1024x1024.fits\n    100 loops, best of 3: 12.2 ms per loop\n    4096x4096.fits\n    10 loops, best of 3: 136 ms per loop\n    256x1024x1024.fits\n    1 loops, best of 3: 3.65 s per loop\n\nIt should be made clear that the sample files were rewritten with new random\ndata between the ``astropy`` test and the fitsio test, so they were not reading\nthe same data from the OS's page cache. Fitsio was much faster on the small\n(256x256) image because in that case the time is dominated by parsing the\nheaders. As already explained, this is much faster in CFITSIO. However, as\nthe data size goes up and the header parsing no longer dominates the time,\n`astropy.io.fits` using mmap is roughly twice as fast. This discrepancy is\nalmost entirely due to it requiring roughly half as many in-memory copies\nto read the data, as explained earlier. That said, more extensive benchmarking\ncould be very interesting.\n\nThis is also not to say that `astropy.io.fits` does better in all cases. There\nare some cases where it is currently blown away by fitsio. See the subsequent\nquestion.\n\n\nWhy is fitsio so much faster than ``astropy`` at reading tables?\n----------------------------------------------------------------\n\nIn many cases it is not: there is either no difference, or it may be a little\nfaster in ``astropy`` depending on what you are trying to do with the table and\nwhat types of columns or how many columns the table has. There are some\ncases, however, where ``fitsio`` can be radically faster, mostly for reasons\nexplained above in \"`Why is reading rows out of a FITS table so slow?`_\"\n\nIn principle a table is no different from, say, an array of pixels. But\ninstead of pixels each element of the array is some kind of record structure\n(for example, two floats, a boolean, and a 20-character string field). Just as\na 64-bit float is an 8 byte record in an array, a row in such a table can be\nthought of as a 37 byte (in the case of the previous example) record in a 1D\narray of rows. So in principle everything that was explained in the answer to\nthe question \"`What performance differences are there between astropy.io.fits\nand fitsio?`_\" applies just as well to tables as it does to any other array.\n\nHowever, FITS tables have many additional complexities that sometimes preclude\nstreaming the data directly from disk, and instead require transformation from\nthe on-disk FITS format to a format more immediately useful to the user. A\ncommon example is how FITS represents boolean values in binary tables.\nAnother significantly more complicated example, is variable length arrays.\n\nAs explained in \"`Why is reading rows out of a FITS table so slow?`_\",\n`astropy.io.fits` does not currently handle some of these cases as\nefficiently as it could, in particular in cases where a user only wishes to\nread a few rows out of a table. Fitsio, on the other hand, has a better\ninterface for copying one row at a time out of a table and performing the\nnecessary transformations on that row *only*, rather than on the entire column\nor columns that the row is taken from. As such, for many cases ``fitsio`` gets\nmuch better performance and should be preferred for many performance-critical\ntable operations.\n\nFitsio also exposes a microlanguage (implemented in CFITSIO) for making\nefficient SQL-like queries of tables (single tables only though — no joins or\nanything like that). This format, described in the `CFITSIO documentation\n<https://heasarc.gsfc.nasa.gov/docs/software/fitsio/c/c_user/node97.html>`_ can\nin some cases perform more efficient selections of rows than might be possible\nwith ``numpy`` alone, which requires creating an intermediate mask array in\norder to perform row selection.\n"},{"id":86,"name":"history.rst","nodeType":"TextFile","path":"docs/io/fits/appendix","text":".. doctest-skip-all\n\nastropy.io.fits History\n***********************\n\nPrior to its inclusion in Astropy, the `astropy.io.fits` package was a stand-\nalone package called `PyFITS`_.  PyFITS is no longer actively maintained, and\nits development is now solely in Astropy.\nThis page documents the release history of PyFITS prior to its merge into\nAstropy.\n\n.. contents:: PyFITS Changelog\n   :depth: 2\n   :local:\n\n\n3.4.0 (2016-01-29)\n==================\n\nThis is the last released version of PyFITS as a standalone package.\n\n\n3.3.0 (2014-07-17)\n==================\n\nNew Features\n------------\n\n- Added new verification options ``fix+ignore``, ``fix+warn``,\n  ``fix+exception``, ``silentfix+ignore``, ``silentfix+warn``, and\n  ``silentfix+exception`` which give more control over how to report fixable\n  errors as opposed to unfixable errors.  See the \"Verification\" section in\n  the PyFITS documentation for more details.\n\nAPI Changes\n-----------\n\n- The ``pyfits.new_table`` function is now fully deprecated (though will not\n  be removed for a long time, considering how widely it is used).\n\n  Instead please use the more explicit ``pyfits.BinTableHDU.from_columns`` to\n  create a new binary table HDU, and the similar\n  ``pyfits.TableHDU.from_columns`` to create a new ASCII table.  These\n  otherwise accept the same arguments as ``pyfits.new_table`` which is now\n  just a wrapper for these.\n\n- The ``.fromstring`` classmethod of each HDU type has been simplified such\n  that, true to its namesake, it only initializes an HDU from a string\n  containing its header *and* data. (spacetelescope/PyFITS#64)\n\n- Fixed an issue where header wildcard matching (for example\n  ``header['DATE*']``) can be used to match *any* characters that might appear\n  in a keyword.  Previously this only matched keywords containing characters\n  in the set ``[0-9A-Za-z_]``.  Now this can also match a hyphen ``-`` and any\n  other characters, as some conventions like ``HIERARCH`` and record-valued\n  keyword cards allow a wider range of valid characters than standard FITS\n  keywords.\n\n- This will be the *last* release to support the following APIs that have been\n  marked deprecated since PyFITS v3.1:\n\n  - The ``CardList`` class, which was part of the old header implementation.\n\n  - The ``Card.key`` attribute.  Use ``Card.keyword`` instead.\n\n  - The ``Card.cardimage`` and ``Card.ascardimage`` attributes.  Use simply\n    ``Card.image`` or ``str(card)`` instead.\n\n  - The ``create_card`` factory function.  Simply use the normal ``Card``\n    constructor instead.\n\n  - The ``create_card_from_string`` factory function.  Use ``Card.fromstring``\n    instead.\n\n  - The ``upper_key`` function.  Use ``Card.normalize_keyword`` method instead\n    (this is not unlikely to be used outside of PyFITS itself, but it was\n    technically public API).\n\n  - The usage of ``Header.update`` with ``Header.update(keyword, value,\n    comment)`` arguments.  ``Header.update`` should only be used analogously\n    to ``dict.update``.  Use ``Header.set`` instead.\n\n  - The ``Header.ascard`` attribute.  Use ``Header.cards`` instead for a list\n    of all the ``Card`` objects in the header.\n\n  - The ``Header.rename_key`` method.  Use ``Header.rename_keyword`` instead.\n\n  - The ``Header.get_history`` method.  Use ``header['HISTORY']`` instead\n    (normal keyword lookup).\n\n  - The ``Header.get_comment`` method.  Use ``header['COMMENT']`` instead.\n\n  - The ``Header.toTxtFile`` method.  Use ``header.totextfile`` instead.\n\n  - The ``Header.fromTxtFile`` method.  Use ``Header.fromtextfile`` instead.\n\n  - The ``pyfits.tdump`` and ``tcreate`` functions.  Use ``pyfits.tabledump``\n    and ``pyfits.tableload`` respectively.\n\n  - The ``BinTableHDU.tdump`` and ``tcreate`` methods.  Use\n    ``BinTableHDU.dump`` and ``BinTableHDU.load`` respectively.\n\n  - The ``txtfile`` argument to the ``Header`` constructor.  Use\n    ``Header.fromfile`` instead.\n\n  - The ``startColumn`` and ``endColumn`` arguments to the ``FITS_record``\n    constructor.  These are unlikely to be used by any user code.\n\n  These deprecated interfaces will be removed from the development version of\n  PyFITS following the v3.3 release (they will still be available in any\n  v3.3.x bugfix releases, however).\n\nOther Changes and Additions\n---------------------------\n\n- PyFITS has switched to a unified code base which supports Python 2.5 through\n  3.4 simultaneously without translation.  This *shouldn't* have any\n  significant performance impacts, but please report if anything seems\n  noticeably slower.  As a reminder, support for Python 2.5 will be ended\n  after PyFITS 3.3.x.\n\n- Warnings for deprecated APIs in PyFITS are now always displayed by default.\n  This is in line with a similar change made recently to Astropy:\n  https://github.com/astropy/astropy/pull/1871\n  To disable PyFITS deprecation warnings in scripts one may call\n  ``pyfits.ignore_deprecation_warnings()`` after importing PyFITS.\n\n- ``Card`` objects have a new ``is_blank`` attribute which returns ``True`` if\n  the card represents a blank card (no keyword, value, or comment) and\n  ``False`` otherwise.\n\nBug Fixes\n---------\n\n- Fixed a regression where it was not possible to save an empty \"compressed\"\n  image to a file (in this case there is nothing to compress, hence the\n  quotes, but trying to do so caused a crash). (spacetelescope/PyFITS#69)\n\n- Fixed a regression that may have been introduced in v3.2.1 with writing\n  compressed image HDUs, particularly compressed images using a non-empty\n  GZIP_COMPRESSED_DATA column. (spacetelescope/#71)\n\n\n3.2.4 (2014-06-02)\n==================\n\n- Fixed a regression where multiple consecutive calls of the ``writeto``\n  method on the same HDU but to different files could lead to corrupt data or\n  crashes on the subsequent calls after the first. (spacetelescope/PyFITS#40)\n\n\n3.2.3 (2014-05-14)\n==================\n\n- Nominal support for Python 3.4.\n\n- Fixed a bug with using the ``tabledump`` and ``tableload`` functions with\n  tables containing array columns (columns in which each element is an array\n  instead of a single scalar value). (spacetelescope/PyFITS#22)\n\n- Fixed an issue where PyFITS allowed newline characters in header values and\n  comments. (spacetelescope/PyFITS#51)\n\n- Fixed pickling of ``FITS_rec`` (table data) objects.\n  (spacetelescope/PyFITS#53)\n\n- Improved behavior when writing large compressed images on OSX by removing an\n  unnecessary check for platform architecture. (spacetelescope/PyFITS#57)\n\n- Allow reading FITS files from file-like objects that do not have a\n  ``.closed`` attribute (and as such may not even have an \"open\" vs. \"closed\"\n  concept). (spacetelescope/PyFITS#56)\n\n- Fixed duplicate insertion of commentary keywords on compressed image\n  headers. (spacetelescope/PyFITS#58)\n\n- Fixed minor issue with comparison of header commentary card values.\n  (spacetelescope/PyFITS#59)\n\n\n3.1.6 (2014-05-14)\n==================\n\n- Nominal support for Python 3.4.\n\n- Fixed a bug with using the ``tabledump`` and ``tableload`` functions with\n  tables containing array columns (columns in which each element is an array\n  instead of a single scalar value). (Backported from 3.2.3)\n\n- Fixed an issue where PyFITS allowed newline characters in header values and\n  comments. (Backported from 3.2.3)\n\n- Fixed pickling of ``FITS_rec`` (table data) objects.\n  (Backported from 3.2.3)\n\n- Improved behavior when writing large compressed images on OSX by removing an\n  unnecessary check for platform architecture. (Backported from 3.2.3)\n\n- Allow reading FITS files from file-like objects that do not have a\n  ``.closed`` attribute (and as such may not even have an \"open\" vs. \"closed\"\n  concept). (Backported from 3.2.3)\n\n- Fixed minor issue with comparison of header commentary card values.\n  (Backported from 3.2.3)\n\n\n3.2.2 (2014-03-25)\n==================\n\n- Fixed a regression on deletion of record-valued keyword cards using\n  the Header wildcard syntax.  This was intended to be fixed before the\n  v3.2.1 release.\n\n\n3.1.5 (2014-03-25)\n==================\n\n- Fixed a regression on deletion of record-valued keyword cards using\n  the Header wildcard syntax.  This was intended to be fixed before the\n  v3.1.4 release.\n\n\n3.2.1 (2014-03-04)\n==================\n\n- Nominal support for the upcoming Python 3.4.\n\n- Added missing features from the ``Header.insert()`` method that were\n  intended for inclusion in the original 3.1 release:  In addition to\n  accepting an integer index as the first argument, it also supports supplying\n  a keyword name as the first argument for insertion relative to a specific\n  keyword.  It also now supports an optional ``after`` argument.  If\n  ``after=True`` the insertion is made below the insertion point instead\n  of above it. (spacetelescope/PyFITS#12)\n\n- Fixed support for broadcasting of values assigned to table columns.\n  (spacetelescope/PyFITS#48)\n\n- A grab bag of minor performance improvements in headers.\n  (spacetelescope/PyFITS#46)\n\n- Fix an unrelated error that occurred when instantiating a ``ColDefs`` object\n  with invalid input.\n\n- Fixed an issue where opening an image containing pseudo-unsigned integers\n  and immediately writing it to a new file using the ``writeto`` method would\n  drop the scale factors that identified the data as unsigned.\n\n- Fixed a bug where writing a file with ``checksum=True`` did not add the\n  checksum on new files. (spacetelescope/PyFITS#8)\n\n- Fixed an issue where validating an HDU's checksums removed the checksum from\n  that HDU's header entirely (even if it was valid.)\n\n- Fixed checksums on compressed images, so that the ``ZHECKSUM`` and\n  ``ZDATASUM`` contain a checksum of the original image HDU, while\n  ``CHECKSUM`` and ``DATASUM`` contain checksums of the compressed image HDU.\n  This feature was supposed to be supported in 3.2, but the support was buggy.\n\n- Fixed an issue where the size of the heap was sometimes not computed\n  properly when writing an existing table containing variable-length array\n  columns to a new FITS file.  This could result in corruption in the new FITS\n  file. (spacetelescope/PyFITS#47)\n\n- Fixed issue with updates to the header of ``CompImageHDU`` objects not being\n  preserved on save. (spacetelescope/PyFITS#23)\n\n- Fixed a bug where a boolean value of ``True`` in a header could not be\n  replaced with the integer 1, and likewise for ``False`` and 0 and vice\n  versa.\n\n- Fixed an issue similar to the above one but for numeric values--now\n  replacing a header value with an equivalent numeric value will up/downcast\n  that value.  For example replacing '0' with '0.0' will write '0.0' to the\n  header so that it is returned as a floating point value.  Likewise a float\n  can be downcast to an integer. (spacetelescope/PyFITS#49)\n\n- A handful of Python 3 compatibility fixes, especially for compatibility\n  with the upcoming Python 3.4.\n\n- Fixed unrelated crash when a header contains an invalid END card (for\n  example \"END = \").  This resulted in a cryptic traceback.  Now headers like\n  this will detect \"clearly intended\" END cards and produce a warning about\n  their invalidity and fix them. (#217)\n\n- Allowed a sequence of ``Column`` objects to be passed in as the main\n  argument to ``FITS_rec.from_columns`` as the documentation suggests should\n  be possible.\n\n- Fixed a display formatting issue with fitsdiff where sometimes it did not\n  show the difference between two floating point numbers if they were the same\n  up to some low number of digits. (spacetelescope/PyFITS#21)\n\n- Fixed an issue where Python 2 sometimes allowed non-ASCII strings to be\n  assigned as header values if they were assigned as old-style ``str`` objects\n  and not ``unicode`` objects. (spacetelescope/PyFITS#37)\n\n\n3.1.4 (2014-03-04)\n==================\n\n- Added missing features from the ``Header.insert()`` method that were\n  intended for inclusion in the original 3.1 release:  In addition to\n  accepting an integer index as the first argument, it also supports supplying\n  a keyword name as the first argument for insertion relative to a specific\n  keyword.  It also now supports an optional ``after`` argument.  If\n  ``after=True`` the insertion is made below the insertion point instead\n  of above it. (Backported from 3.2.1)\n\n- A grab bag of minor performance improvements in headers.\n  (Backported from 3.2.1)\n\n- Fixed an issue where opening an image containing pseudo-unsigned integers\n  and immediately writing it to a new file using the ``writeto`` method would\n  drop the scale factors that identified the data as unsigned.\n  (Backported from 3.2.1)\n\n- Fixed a bug where writing a file with ``checksum=True`` did not add the\n  checksum on new files. (Backported from 3.2.1)\n\n- Fixed an issue where validating an HDU's checksums removed the checksum from\n  that HDU's header entirely (even if it was valid.)\n  (Backported from 3.2.1)\n\n- Fixed an issue where the size of the heap was sometimes not computed\n  properly when writing an existing table containing variable-length array\n  columns to a new FITS file.  This could result in corruption in the new FITS\n  file. (Backported from 3.2.1)\n\n- Fixed a bug where a boolean value of ``True`` in a header could not be\n  replaced with the integer 1, and likewise for ``False`` and 0 and vice\n  versa. (Backported from 3.2.1)\n\n- Fixed an issue similar to the above one but for numeric values--now\n  replacing a header value with an equivalent numeric value will up/downcast\n  that value.  For example replacing '0' with '0.0' will write '0.0' to the\n  header so that it is returned as a floating point value.  Likewise a float\n  can be downcast to an integer. (Backported from 3.2.1)\n\n- Fixed unrelated crash when a header contains an invalid END card (for\n  example \"END = \").  This resulted in a cryptic traceback.  Now headers like\n  this will detect \"clearly intended\" END cards and produce a warning about\n  their invalidity and fix them. (Backported from 3.2.1)\n\n- Fixed a display formatting issue with fitsdiff where sometimes it did not\n  show the difference between two floating point numbers if they were the same\n  up to some low number of digits. (Backported from 3.2.1)\n\n- Fixed an issue where Python 2 sometimes allowed non-ASCII strings to be\n  assigned as header values if they were assigned as old-style ``str`` objects\n  and not ``unicode`` objects. (Backported from 3.2.1)\n\n\n3.0.13 (2014-03-04)\n===================\n\n- Fixed a bug where writing a file with ``checksum=True`` did not add the\n  checksum on new files. (Backported from 3.2.1)\n\n- Fixed an issue where validating an HDU's checksums removed the checksum from\n  that HDU's header entirely (even if it was valid.)\n  (Backported from 3.2.1)\n\n\n3.2 (2013-11-26)\n================\n\nHighlights\n----------\n\n- Rewrote CFITSIO-based backend for handling tile compression of FITS files.\n  It now uses a standard CFITSIO instead of heavily modified pieces of CFITSIO\n  as before.  PyFITS ships with its own copy of CFITSIO v3.35 which supports\n  the latest version of the Tiled Image Convention (v2.3), but system\n  packagers may choose instead to strip this out in favor of a\n  system-installed version of CFITSIO.  Earlier versions may work, but nothing\n  earlier than 3.28 has been tested yet. (#169)\n\n- Added support for reading and writing tables using the Q format for columns.\n  The Q format is identical to the P format (variable-length arrays) except\n  that it uses 64-bit integers for the data descriptors, allowing more than\n  4 GB of variable-length array data in a single table. (#160)\n\n- Added initial support for table columns containing pseudo-unsigned integers.\n  This is currently enabled by using the ``uint=True`` option when opening\n  files; any table columns with the correct BZERO value will be interpreted\n  and returned as arrays of unsigned integers.\n\n- Some refactoring of the table and ``FITS_rec`` modules in order to better\n  separate the details of the FITS binary and ASCII table data structures from\n  the HDU data structures that encapsulate them.  Most of these changes should\n  not be apparent to users (but see API Changes below).\n\n\nAPI Changes\n-----------\n\n- Assigning to values in ``ColDefs.names``, ``ColDefs.formats``,\n  ``ColDefs.nulls`` and other attributes of ``ColDefs`` instances that return\n  lists of column properties is no longer supported.  Assigning to those lists\n  will no longer update the corresponding columns.  Instead, please just\n  modify the ``Column`` instances directly (``Column.name``, ``Column.null``,\n  etc.)\n\n- The ``pyfits.new_table`` function is marked \"pending deprecation\".  This\n  does not mean it will be removed outright or that its functionality has\n  changed.  It will likely be replaced in the future for a function with\n  similar, if not subtly different functionality.  A better, if not slightly\n  more verbose approach is to use ``pyfits.FITS_rec.from_columns`` to create\n  a new ``FITS_rec`` table--this has the same interface as\n  ``pyfits.new_table``.  The difference is that it returns a plan ``FITS_rec``\n  array, and not an HDU instance.  This ``FITS_rec`` object can then be used\n  as the data argument in the constructors for ``BinTableHDU`` (for binary\n  tables) or ``TableHDU`` (for ASCII tables).  This is analogous to creating\n  an ``ImageHDU`` by passing in an image array.\n  ``pyfits.FITS_rec.from_columns`` is just a simpler way of creating a\n  FITS-compatible recarray from a FITS column specification.\n\n- The ``updateHeader``, ``updateHeaderData``, and ``updateCompressedData``\n  methods of the ``CompDataHDU`` class are pending deprecation and moved to\n  internal methods.  The operation of these methods depended too much on\n  internal state to be used safely by users; instead they are invoked\n  automatically in the appropriate places when reading/writing compressed image\n  HDUs.\n\n- The ``CompDataHDU.compData`` attribute is pending deprecation in favor of\n  the clearer and more PEP-8 compatible ``CompDataHDU.compressed_data``.\n\n- The constructor for ``CompDataHDU`` has been changed to accept new keyword\n  arguments.  The new keyword arguments are essentially the same, but are in\n  underscore_separated format rather than camelCase format.  The old arguments\n  are still pending deprecation.\n\n- The internal attributes of HDU classes ``_hdrLoc``, ``_datLoc``, and\n  ``_datSpan`` have been replaced with ``_header_offset``, ``_data_offset``,\n  and ``_data_size`` respectively.  The old attribute names are still pending\n  deprecation.  This should only be of interest to advanced users who have\n  created their own HDU subclasses.\n\n- The following previously deprecated functions and methods have been removed\n  entirely: ``createCard``, ``createCardFromString``, ``upperKey``,\n  ``ColDefs.data``, ``setExtensionNameCaseSensitive``, ``_File.getfile``,\n  ``_TableBaseHDU.get_coldefs``, ``Header.has_key``, ``Header.ascardlist``.\n\n  If you run your code with a previous version of PyFITS (>= 3.0, < 3.2) with\n  the ``python -Wd`` argument, warnings for all deprecated interfaces still in\n  use will be displayed.\n\n- Interfaces that were pending deprecation are now fully deprecated.  These\n  include: ``create_card``, ``create_card_from_string``, ``upper_key``,\n  ``Header.get_history``, and ``Header.get_comment``.\n\n- The ``.name`` attribute on HDUs is now directly tied to the HDU's header, so\n  that if ``.header['EXTNAME']`` changes so does ``.name`` and vice-versa.\n\n- The ``pyfits.file.PYTHON_MODES`` constant dict was renamed to\n  ``pyfits.file.PYFITS_MODES`` which better reflects its purpose.  This is\n  rarely used by client code, however.  Support for the old name will be\n  removed by PyFITS 3.4.\n\n\nOther Changes and Additions\n---------------------------\n\n- The new compression code also adds support for the ZQUANTIZ and ZDITHER0\n  keywords added in more recent versions of this FITS Tile Compression spec.\n  This includes support for lossless compression with GZIP. (#198) By default\n  no dithering is used, but the ``SUBTRACTIVE_DITHER_1`` and\n  ``SUBTRACTIVE_DITHER_2`` methods can be enabled by passing the correct\n  constants to the ``quantize_method`` argument to the ``CompImageHDU``\n  constructor.  A seed can be manually specified, or automatically generated\n  using either the system clock or checksum-based methods via the\n  ``dither_seed`` argument.  See the documentation for ``CompImageHDU`` for\n  more details. (#198) (spacetelescope/PYFITS#32)\n\n- Images compressed with the Tile Compression standard can now be larger than\n  4 GB through support of the Q format. (#159)\n\n- All HDUs now have a ``.ver`` ``.level`` attribute that returns the value of\n  the EXTVAL and EXTLEVEL keywords from that HDU's header, if the exist.  This\n  was added for consistency with the ``.name`` attribute which returns the\n  EXTNAME value from the header.\n\n- Then ``Column`` and ``ColDefs`` classes have new ``.dtype`` attributes\n  which give the Numpy dtype for the column data in the first case, and the\n  full Numpy compound dtype for each table row in the latter case.\n\n- There was an issue where new tables created defaulted the values in all\n  string columns to '0.0'.  Now string columns are filled with empty strings\n  by default--this seems a less surprising default, but it may cause\n  differences with tables created with older versions of PyFITS.\n\n- Improved round-tripping and preservation of manually assigned column\n  attributes (``TNULLn``, ``TSCALn``, etc.) in table HDU headers.\n  (astropy/astropy#996)\n\n\nBug Fixes\n---------\n\n- Binary tables containing compressed images may, optionally, contain other\n  columns unrelated to the tile compression convention. Although this is an\n  uncommon use case, it is permitted by the standard. (#159)\n\n- Reworked some of the file I/O routines to allow simpler, more consistent\n  mapping between OS-level file modes ('rb', 'wb', 'ab', etc.) and the more\n  \"PyFITS-specific\" modes used by PyFITS like \"readonly\" and \"update\".\n  That is, if reading a FITS file from an open file object, it doesn't matter\n  as much what \"mode\" it was opened in so long as it has the right\n  capabilities (read/write/etc.)  Also works around bugs in the Python io\n  module in 2.6+ with regard to file modes. (spacetelescope/PyFITS#33)\n\n- Fixed an obscure issue that can occur on systems that don't have flush to\n  memory-mapped files implemented (namely GNU Hurd). (astropy/astropy#968)\n\n\n3.1.3 (2013-11-26)\n==================\n\n- Disallowed assigning NaN and Inf floating point values as header values,\n  since the FITS standard does not define a way to represent them in. Because\n  this is undefined, the previous behavior did not make sense and produced\n  invalid FITS files. (spacetelescope/PyFITS#11)\n\n- Added a workaround for a bug in 64-bit OSX that could cause truncation when\n  writing files greater than 2^32 bytes in size. (spacetelescope/PyFITS#28)\n\n- Fixed a long-standing issue where writing binary tables did not correctly\n  write the TFORMn keywords for variable-length array columns (they omitted\n  the max array length parameter of the format).  This was thought fixed in\n  v3.1.2, but it was only fixed there for compressed image HDUs and not for\n  binary tables in general.\n\n- Fixed an obscure issue that can occur on systems that don't have flush to\n  memory-mapped files implemented (namely GNU Hurd). (Backported from 3.2)\n\n\n3.0.12 (2013-11-26)\n===================\n\n- Disallowed assigning NaN and Inf floating point values as header values,\n  since the FITS standard does not define a way to represent them in. Because\n  this is undefined, the previous behavior did not make sense and produced\n  invalid FITS files. (Backported from 3.1.3)\n\n- Added a workaround for a bug in 64-bit OSX that could cause truncation when\n  writing files greater than 2^32 bytes in size. (Backported from 3.1.3)\n\n- Fixed a long-standing issue where writing binary tables did not correctly\n  write the TFORMn keywords for variable-length array columns (they omitted\n  the max array length parameter of the format).  This was thought fixed in\n  v3.1.2, but it was only fixed there for compressed image HDUs and not for\n  binary tables in general. (Backported from 3.1.3)\n\n- Fixed an obscure issue that can occur on systems that don't have flush to\n  memory-mapped files implemented (namely GNU Hurd). (Backported from 3.2)\n\n\n3.1.3 (unreleased)\n==================\n\n- Disallowed assigning NaN and Inf floating point values as header values,\n  since the FITS standard does not define a way to represent them in. Because\n  this is undefined, the previous behavior did not make sense and produced\n  invalid FITS files. (spacetelescope/PyFITS#11)\n\n\n3.0.12 (unreleased)\n===================\n\n- Disallowed assigning NaN and Inf floating point values as header values,\n  since the FITS standard does not define a way to represent them in. Because\n  this is undefined, the previous behavior did not make sense and produced\n  invalid FITS files. (Backported from 3.1.3)\n\n- Added a workaround for a bug in 64-bit OSX that could cause truncation when\n  writing files greater than 2^32 bytes in size. (Backported from 3.1.3)\n\n\n3.1.2 (2013-04-22)\n==================\n\n- When an error occurs opening a file in fitsdiff the exception message will\n  now at least mention which file had the error. (#168)\n\n- Fixed support for opening gzipped FITS files by filename in a writeable mode\n  (PyFITS has supported writing to gzip files for some time now, but only\n  enabled it when GzipFile objects were passed to ``pyfits.open()`` due to\n  some legacy code preventing full gzip support. (#195)\n\n- Added a more helpful error message in the case of malformatted FITS files\n  that contain non-float NULL values in an ASCII table but are missing the\n  required TNULLn keywords in the header. (#197)\n\n- Fixed an (apparently long-standing) issue where writing compressed images\n  did not correctly write the TFORMn keywords for variable-length array\n  columns (they omitted the max array length parameter of the format). (#199)\n\n- Slightly refactored how tables containing variable-length array columns are\n  handled to add two improvements: Fixes an issue where accessing the data\n  after a call to the ``pyfits.getdata`` convenience function caused an\n  exception, and allows the VLA data to be read from an existing mmap of the\n  FITS file. (#200)\n\n- Fixed a bug that could occur when opening a table containing\n  multi-dimensional columns (i.e. via the TDIMn keyword) and then writing it\n  out to a new file. (#201)\n\n- Added use of the console_scripts entry point to install the fitsdiff and\n  fitscheck scripts, which if nothing else provides better Windows support.\n  The generated scripts now override the ones explicitly defined in the\n  scripts/ directory (which were just trivial stubs to begin with). (#202)\n\n- Fixed a bug on Python 3 where attempting to open a non-existent file on\n  Python 3 caused a seemingly unrelated traceback. (#203)\n\n- Fixed a bug in fitsdiff that reported two header keywords containing NaN\n  as value as different. (#204)\n\n- Fixed an issue in the tests that caused some tests to fail if pyfits is\n  installed with read-only permissions. (#208)\n\n- Fixed a bug where instantiating a ``BinTableHDU`` from a numpy array\n  containing boolean fields converted all the values to ``False``. (#215)\n\n- Fixed an issue where passing an array of integers into the constructor of\n  ``Column()`` when the column type is floats of the same byte width caused the\n  column array to become garbled. (#218)\n\n- Fixed inconsistent behavior in creating CONTINUE cards from byte strings\n  versus Unicode strings in Python 2--CONTINUE cards can now be created\n  properly from Unicode strings (so long as they are convertible to ASCII).\n  (spacetelescope/PyFITS#1)\n\n- Fixed a couple cases where creating a new table using TDIMn in some of the\n  columns could caused a crash. (spacetelescope/PyFITS#3)\n\n- Fixed a bug in parsing HIERARCH keywords that do not have a space after\n  the first equals sign (before the value). (spacetelescope/PyFITS#5)\n\n- Prevented extra leading whitespace on HIERARCH keywords from being treated\n  as part of the keyword. (spacetelescope/PyFITS#6)\n\n- Fixed a bug where HIERARCH keywords containing lower-case letters was\n  mistakenly marked as invalid during header validation.\n  (spacetelescope/PyFITS#7)\n\n- Fixed an issue that was ancillary to (spacetelescope/PyFITS#7) where the\n  ``Header.index()`` method did not work correctly with HIERARCH keywords\n  containing lower-case letters.\n\n\n3.0.11 (2013-04-17)\n===================\n\n- Fixed support for opening gzipped FITS files by filename in a writeable mode\n  (PyFITS has supported writing to gzip files for some time now, but only\n  enabled it when GzipFile objects were passed to ``pyfits.open()`` due to\n  some legacy code preventing full gzip support. Backported from 3.1.2. (#195)\n\n- Added a more helpful error message in the case of malformatted FITS files\n  that contain non-float NULL values in an ASCII table but are missing the\n  required TNULLn keywords in the header. Backported from 3.1.2. (#197)\n\n- Fixed an (apparently long-standing) issue where writing compressed images did\n  not correctly write the TFORMn keywords for variable-length array columns\n  (they omitted the max array length parameter of the format). Backported from\n  3.1.2. (#199)\n\n- Slightly refactored how tables containing variable-length array columns are\n  handled to add two improvements: Fixes an issue where accessing the data\n  after a call to the ``pyfits.getdata`` convenience function caused an\n  exception, and allows the VLA data to be read from an existing mmap of the\n  FITS file. Backported from 3.1.2. (#200)\n\n- Fixed a bug that could occur when opening a table containing\n  multi-dimensional columns (i.e. via the TDIMn keyword) and then writing it\n  out to a new file. Backported from 3.1.2. (#201)\n\n- Fixed a bug on Python 3 where attempting to open a non-existent file on\n  Python 3 caused a seemingly unrelated traceback. Backported from 3.1.2.\n  (#203)\n\n- Fixed a bug in fitsdiff that reported two header keywords containing NaN\n  as value as different. Backported from 3.1.2. (#204)\n\n- Fixed an issue in the tests that caused some tests to fail if pyfits is\n  installed with read-only permissions. Backported from 3.1.2. (#208)\n\n- Fixed a bug where instantiating a ``BinTableHDU`` from a numpy array\n  containing boolean fields converted all the values to ``False``. Backported\n  from 3.1.2. (#215)\n\n- Fixed an issue where passing an array of integers into the constructor of\n  ``Column()`` when the column type is floats of the same byte width caused the\n  column array to become garbled. Backported from 3.1.2. (#218)\n\n- Fixed a couple cases where creating a new table using TDIMn in some of the\n  columns could caused a crash. Backported from 3.1.2.\n  (spacetelescope/PyFITS#3)\n\n\n3.1.1 (2013-01-02)\n==================\n\nThis is a bug fix release for the 3.1.x series.\n\nBug Fixes\n---------\n\n- Improved handling of scaled images and pseudo-unsigned integer images in\n  compressed image HDUs.  They now work more transparently like normal image\n  HDUs with support for the ``do_not_scale_image_data`` and ``uint`` options,\n  as well as ``scale_back`` and ``save_backup``.  The ``.scale()`` method\n  works better too. (#88)\n\n- Permits non-string values for the EXTNAME keyword when reading in a file,\n  rather than throwing an exception due to the malformatting.  Added\n  verification for the format of the EXTNAME keyword when writing. (#96)\n\n- Added support for EXTNAME and EXTVER in PRIMARY HDUs.  That is, if EXTNAME\n  is specified in the header, it will also be reflected in the ``.name``\n  attribute and in ``pyfits.info()``.  These keywords used to be verboten in\n  PRIMARY HDUs, but the latest version of the FITS standard allows them.\n  (#151)\n\n- HCOMPRESS can again be used to compress data cubes (and higher-dimensional\n  arrays) so long as the tile size is effectively 2-dimensional. In fact,\n  PyFITS will automatically use compatible tile sizes even if they're not\n  explicitly specified. (#171)\n\n- Added support for the optional ``endcard`` parameter in the\n  ``Header.fromtextfile()`` and ``Header.totextfile()`` methods.  Although\n  ``endcard=False`` was a reasonable default assumption, there are still text\n  dumps of FITS headers that include the END card, so this should have been\n  more flexible. (#176)\n\n- Fixed a crash when running fitsdiff on two empty (that is, zero row) tables.\n  (#178)\n\n- Fixed an issue where opening files containing random groups HDUs in update\n  mode could cause an unnecessary rewrite of the file even if none of the\n  data is modified. (#179)\n\n- Fixed a bug that could caused a deadlock in the filesystem on OSX if PyFITS\n  is used with Numpy 1.7 in some cases. (#180)\n\n- Fixed a crash when generating diff reports from diffs using the\n  ``ignore_comments`` options. (#181)\n\n- Fixed some bugs with FITS WCS distortion paper record-valued keyword cards:\n\n  - Cards that looked kind of like RVKCs but were not intended to be were\n    over-permissively treated as such--commentary keywords like COMMENT and\n    HISTORY were particularly affected. (#183)\n\n  - Looking up a card in a header by its standard FITS keyword only should\n    always return the raw value of that card.  That way cards containing\n    values that happen to valid RVKCs but were not intended to be will still\n    be treated like normal cards. (#184)\n\n  - Looking up a RVKC in a header with only part of the field-specifier (for\n    example \"DP1.AXIS\" instead of \"DP1.AXIS.1\") was implicitly treated as a\n    wildcard lookup. (#184)\n\n- Fixed a crash when diffing two FITS files where at least one contains a\n  compressed image HDU which was not recognized as an image instead of a\n  table. (#187)\n\n- Fixed bugs in the backwards compatibility layer for the ``CardList.index``\n  and ``CardList.count`` methods. (#190)\n\n- Improved ``__repr__`` and text file representation of cards with long values\n  that are split into CONTINUE cards. (#193)\n\n- Fixed a crash when trying to assign a long (> 72 character) value to blank\n  ('') keywords. This also changed how blank keywords are represented--there\n  are still exactly 8 spaces before any commentary content can begin; this\n  *may* affect the exact display of header cards that assumed there could be\n  fewer spaces in a blank keyword card before the content begins. However, the\n  current approach is more in line with the requirements of the FITS standard.\n  (#194)\n\n\n3.0.10 (2013-01-02)\n===================\n\n- Improved handling of scaled images and pseudo-unsigned integer images in\n  compressed image HDUs.  They now work more transparently like normal image\n  HDUs with support for the ``do_not_scale_image_data`` and ``uint`` options,\n  as well as ``scale_back`` and ``save_backup``.  The ``.scale()`` method\n  works better too.  Backported from 3.1.1. (#88)\n\n- Permits non-string values for the EXTNAME keyword when reading in a file,\n  rather than throwing an exception due to the malformatting.  Added\n  verification for the format of the EXTNAME keyword when writing.  Backported\n  from 3.1.1. (#96)\n\n- Added support for EXTNAME and EXTVER in PRIMARY HDUs.  That is, if EXTNAME\n  is specified in the header, it will also be reflected in the ``.name``\n  attribute and in ``pyfits.info()``.  These keywords used to be verbotten in\n  PRIMARY HDUs, but the latest version of the FITS standard allows them.\n  Backported from 3.1.1. (#151)\n\n- HCOMPRESS can again be used to compress data cubes (and higher-dimensional\n  arrays) so long as the tile size is effectively 2-dimensional. In fact,\n  PyFITS will not automatically use compatible tile sizes even if they're not\n  explicitly specified.  Backported from 3.1.1. (#171)\n\n- Fixed a bug when writing out files containing zero-width table columns,\n  where the TFIELDS keyword would be updated incorrectly, leaving the table\n  largely unreadable.  Backported from 3.1.0. (#174)\n\n- Fixed an issue where opening files containing random groups HDUs in update\n  mode could cause an unnecessary rewrite of the file even if none of the\n  data is modified.  Backported from 3.1.1. (#179)\n\n- Fixed a bug that could caused a deadlock in the filesystem on OSX if PyFITS\n  is used with Numpy 1.7 in some cases. Backported from 3.1.1. (#180)\n\n\n3.1 (2012-08-08)\n================\n\nHighlights\n----------\n\n- The ``Header`` object has been significantly reworked, and ``CardList``\n  objects are now deprecated (their functionality folded into the ``Header``\n  class).  See API Changes below for more details.\n\n- Memory maps are now used by default to access HDU data.  See API Changes\n  below for more details.\n\n- Now includes a new version of the ``fitsdiff`` program for comparing two\n  FITS files, and a new FITS comparison API used by ``fitsdiff``.  See New\n  Features below.\n\nAPI Changes\n-----------\n\n- The ``Header`` class has been rewritten, and the ``CardList`` class is\n  deprecated.  Most of the basic details of working with FITS headers are\n  unchanged, and will not be noticed by most users.  But there are differences\n  in some areas that will be of interest to advanced users, and to application\n  developers.  For full details of the changes, see the \"Header Interface\n  Transition Guide\" section in the PyFITS documentation.  See ticket #64 on\n  the PyFITS Trac for further details and background. Some highlights are\n  listed below:\n\n  * The Header class now fully implements the Python dict interface, and can\n    be used interchangeably with a dict, where the keys are header keywords.\n\n  * New keywords can be added to the header using normal keyword assignment\n    (previously it was necessary to use ``Header.update`` to add new\n    keywords).  For example::\n\n        >>> header['NAXIS'] = 2\n\n    will update the existing 'FOO' keyword if it already exists, or add a new\n    one if it doesn't exist, just like a dict.\n\n  * It is possible to assign both a value and a comment at the same time using\n    a tuple::\n\n        >>> header['NAXIS'] = (2, 'Number of axes')\n\n  * To add/update a new card and ensure it's added in a specific location, use\n    ``Header.set()``::\n\n        >>> header.set('NAXIS', 2, 'Number of axes', after='BITPIX')\n\n    This works the same as the old ``Header.update()``.  ``Header.update()``\n    still works in the old way too, but is deprecated.\n\n  * Although ``Card`` objects still exist, it generally is not necessary to\n    work with them directly.  ``Header.ascardlist()``/``Header.ascard`` are\n    deprecated and should not be used.  To directly access the ``Card``\n    objects in a header, use ``Header.cards``.\n\n  * To access card comments, it is still possible to either go through the\n    card itself, or through ``Header.comments``.  For example::\n\n       >>> header.cards['NAXIS'].comment\n       Number of axes\n       >>> header.comments['NAXIS']\n       Number of axes\n\n  * ``Card`` objects can now be used interchangeably with\n    ``(keyword, value, comment)`` 3-tuples.  They still have ``.value`` and\n    ``.comment`` attributes as well.  The ``.key`` attribute has been renamed\n    to ``.keyword`` for consistency, though ``.key`` is still supported (but\n    deprecated).\n\n- Memory mapping is now used by default to access HDU data.  That is,\n  ``pyfits.open()`` uses ``memmap=True`` as the default.  This provides better\n  performance in the majority of use cases--there are only some I/O intensive\n  applications where it might not be desirable.  Enabling mmap by default also\n  enabled finding and fixing a large number of bugs in PyFITS' handling of\n  memory-mapped data (most of these bug fixes were backported to PyFITS\n  3.0.5). (#85)\n\n  * A new ``pyfits.USE_MEMMAP`` global variable was added.  Set\n    ``pyfits.USE_MEMMAP = False`` to change the default memmap setting for\n    opening files.  This is especially useful for controlling the behavior in\n    applications where pyfits is deeply embedded.\n\n  * Likewise, a new ``PYFITS_USE_MEMMAP`` environment variable is supported.\n    Set ``PYFITS_USE_MEMMAP = 0`` in your environment to change the default\n    behavior.\n\n- The ``size()`` method on HDU objects is now a ``.size`` property--this\n  returns the size in bytes of the data portion of the HDU, and in most cases\n  is equivalent to ``hdu.data.nbytes`` (#83)\n\n- ``BinTableHDU.tdump`` and ``BinTableHDU.tcreate`` are deprecated--use\n  ``BinTableHDU.dump`` and ``BinTableHDU.load`` instead.  The new methods\n  output the table data in a slightly different format from previous versions,\n  which places quotes around each value.  This format is compatible with data\n  dumps from previous versions of PyFITS, but not vice-versa due to a parsing\n  bug in older versions.\n\n- Likewise the ``pyfits.tdump`` and ``pyfits.tcreate`` convenience function\n  versions of these methods have been renamed ``pyfits.tabledump`` and\n  ``pyfits.tableload``.  The old deprecated, but currently retained for\n  backwards compatibility. (r1125)\n\n- A new global variable ``pyfits.EXTENSION_NAME_CASE_SENSITIVE`` was added.\n  This serves as a replacement for ``pyfits.setExtensionNameCaseSensitive``\n  which is not deprecated and may be removed in a future version.  To enable\n  case-sensitivity of extension names (i.e. treat 'sci' as distinct from 'SCI')\n  set ``pyfits.EXTENSION_NAME_CASE_SENSITIVE = True``.  The default is\n  ``False``. (r1139)\n\n- A new global configuration variable ``pyfits.STRIP_HEADER_WHITESPACE`` was\n  added.  By default, if a string value in a header contains trailing\n  whitespace, that whitespace is automatically removed when the value is read.\n  Now if you set ``pyfits.STRIP_HEADER_WHITESPACE = False`` all whitespace is\n  preserved. (#146)\n\n- The old ``classExtensions`` extension mechanism (which was deprecated in\n  PyFITS 3.0) is removed outright.  To our knowledge it was no longer used\n  anywhere. (r1309)\n\n- Warning messages from PyFITS issued through the Python warnings API are now\n  output to stderr instead of stdout, as is the default.  PyFITS no longer\n  modifies the default behavior of the warnings module with respect to which\n  stream it outputs to. (r1319)\n\n- The ``checksum`` argument to ``pyfits.open()`` now accepts a value of\n  'remove', which causes any existing CHECKSUM/DATASUM keywords to be ignored,\n  and removed when the file is saved.\n\nNew Features\n------------\n\n- Added support for the proposed \"FITS\" extension HDU type. FITS\n  HDUs contain an entire FITS file embedded in their data section.  ``FitsHDU``\n  objects work like other HDU types in PyFITS.  Their ``.data`` attribute\n  returns the raw data array.  However, they have a special ``.hdulist``\n  attribute which processes the data as a FITS file and returns it as an\n  in-memory HDUList object.  FitsHDU objects also support a\n  ``FitsHDU.fromhdulist()`` classmethod which returns a new ``FitsHDU`` object\n  that embeds the supplied HDUList. (#80)\n\n- Added a new ``.is_image`` attribute on HDU objects, which is True if the HDU\n  data is an 'image' as opposed to a table or something else.  Here the\n  meaning of 'image' is fairly loose, and mostly just means a Primary or Image\n  extension HDU, or possibly a compressed image HDU (#71)\n\n- Added an ``HDUList.fromstring`` classmethod which can parse a FITS file\n  already in memory and instantiate and ``HDUList`` object from it.  This\n  could be useful for integrating PyFITS with other libraries that work on\n  FITS file, such as CFITSIO.  It may also be useful in streaming\n  applications.  The name is a slight misnomer, in that it actually accepts\n  any Python object that implements the buffer interface, which includes\n  ``bytes``, ``bytearray``, ``memoryview``, ``numpy.ndarray``, etc. (#90)\n\n- Added a new ``pyfits.diff`` module which contains facilities for comparing\n  FITS files.  One can use the ``pyfits.diff.FITSDiff`` class to compare two\n  FITS files in their entirety.  There is also a ``pyfits.diff.HeaderDiff``\n  class for just comparing two FITS headers, and other similar interfaces.\n  See the PyFITS Documentation for more details on this interface.  The\n  ``pyfits.diff`` module powers the new ``fitsdiff`` program installed with\n  PyFITS.  After installing PyFITS, run ``fitsdiff --help`` for usage details.\n\n- ``pyfits.open()`` now accepts a ``scale_back`` argument.  If set to\n  ``True``, this automatically scales the data using the original BZERO and\n  BSCALE parameters the file had when it was first opened, if any, as well as\n  the original BITPIX.  For example, if the original BITPIX were 16, this\n  would be equivalent to calling ``hdu.scale('int16', 'old')`` just before\n  calling ``flush()`` or ``close()`` on the file.  This option applies to all\n  HDUs in the file. (#120)\n\n- ``pyfits.open()`` now accepts a ``save_backup`` argument.  If set to\n  ``True``, this automatically saves a backup of the original file before\n  flushing any changes to it (this of course only applies to update and append\n  mode).  This may be especially useful when working with scaled image data.\n  (#121)\n\nChanges in Behavior\n-------------------\n\n- Warnings from PyFITS are not output to stderr by default, instead of stdout\n  as it has been for some time.  This is contrary to most users' expectations\n  and makes it more difficult for them to separate output from PyFITS from the\n  desired output for their scripts. (r1319)\n\nBug Fixes\n---------\n\n- Fixed ``pyfits.tcreate()`` (now ``pyfits.tableload()``) to be more robust\n  when encountering blank lines in a column definition file (#14)\n\n- Fixed a fairly rare crash that could occur in the handling of CONTINUE cards\n  when using Numpy 1.4 or lower (though 1.4 is the oldest version supported by\n  PyFITS). (r1330)\n\n- Fixed ``_BaseHDU.fromstring`` to actually correctly instantiate an HDU\n  object from a string/buffer containing the header and data of that HDU.\n  This allowed for the implementation of ``HDUList.fromstring`` described\n  above. (#90)\n\n- Fixed a rare corner case where, in some use cases, (mildly, recoverable)\n  malformatted float values in headers were not properly returned as floats.\n  (#137)\n\n- Fixed a corollary to the previous bug where float values with a leading zero\n  before the decimal point had the leading zero unnecessarily removed when\n  saving changes to the file (eg. \"0.001\" would be written back as \".001\" even\n  if no changes were otherwise made to the file). (#137)\n\n- When opening a file containing CHECKSUM and/or DATASUM keywords in update\n  mode, the CHECKSUM/DATASUM are updated and preserved even if the file was\n  opened with checksum=False.  This change in behavior prevents checksums from\n  being unintentionally removed. (#148)\n\n- Fixed a bug where ``ImageHDU.scale(option='old')`` wasn't working at all--it\n  was not restoring the image to its original BSCALE and BZERO values. (#162)\n\n- Fixed a bug when writing out files containing zero-width table columns,\n  where the TFIELDS keyword would be updated incorrectly, leaving the table\n  largely unreadable.  This fix will be backported to the 3.0.x series in\n  version 3.0.10.  (#174)\n\n\n3.0.9 (2012-08-06)\n==================\n\nThis is a bug fix release for the 3.0.x series.\n\nBug Fixes\n---------\n\n- Fixed ``Header.values()``/``Header.itervalues()`` and ``Header.items()``/\n  ``Header.iteritems()`` to correctly return the different values for\n  duplicate keywords (particularly commentary keywords like HISTORY and\n  COMMENT).  This makes the old Header implementation slightly more compatible\n  with the new implementation in PyFITS 3.1. (#127)\n\n  .. note::\n      This fix did not change the existing behavior from earlier PyFITS\n      versions where ``Header.keys()`` returns all keywords in the header with\n      duplicates removed.  PyFITS 3.1 changes that behavior, so that\n      ``Header.keys()`` includes duplicates.\n\n- Fixed a bug where ``ImageHDU.scale(option='old')`` wasn't working at all--it\n  was not restoring the image to its original BSCALE and BZERO values. (#162)\n\n- Fixed a bug where opening a file containing compressed image HDUs in\n  'update' mode and then immediately closing it without making any changes\n  caused the file to be rewritten unnecessarily. (#167)\n\n- Fixed two memory leaks that could occur when writing compressed image data,\n  or in some cases when opening files containing compressed image HDUs in\n  'update' mode. (#168)\n\n\n3.0.8 (2012-06-04)\n==================\n\nChanges in Behavior\n-------------------\n\n- Prior to this release, image data sections did not work with scaled\n  data--that is, images with non-trivial BSCALE and/or BZERO values.\n  Previously, in order to read such images in sections, it was necessary to\n  manually apply the BSCALE+BZERO to each section.  It's worth noting that\n  sections *did* support pseudo-unsigned ints (flakily).  This change just\n  extends that support for general BSCALE+BZERO values.\n\nBug Fixes\n---------\n\n- Fixed a bug that prevented updates to values in boolean table columns from\n  being saved.  This turned out to be a symptom of a deeper problem that could\n  prevent other table updates from being saved as well. (#139)\n\n- Fixed a corner case in which a keyword comment ending with the string \"END\"\n  could, in some circumstances, cause headers (and the rest of the file after\n  that point) to be misread. (#142)\n\n- Fixed support for scaled image data and pseudo-unsigned ints in image data\n  sections (``hdu.section``).  Previously this was not supported at all.  At\n  some point support was supposedly added, but it was buggy and incomplete.\n  Now the feature seems to work much better. (#143)\n\n- Fixed the documentation to point out that image data sections *do* support\n  non-contiguous slices (and have for a long time).  The documentation was\n  never updated to reflect this, and misinformed users that only contiguous\n  slices were supported, leading to some confusion. (#144)\n\n- Fixed a bug where creating an ``HDUList`` object containing multiple PRIMARY\n  HDUs caused an infinite recursion when validating the object prior to\n  writing to a file. (#145)\n\n- Fixed a rare but serious case where saving an update to a file that\n  previously had a CHECKSUM and/or DATASUM keyword, but removed the checksum\n  in saving, could cause the file to be slightly corrupted and unreadable.\n  (#147)\n\n- Fixed problems with reading \"non-standard\" FITS files with primary headers\n  containing SIMPLE = F.  PyFITS has never made many guarantees as to how such\n  files are handled.  But it should at least be possible to read their\n  headers, and the data if possible.  Saving changes to such a file should not\n  try to prepend an unwanted valid PRIMARY HDU. (#157)\n\n- Fixed a bug where opening an image with ``disable_image_compression = True``\n  caused compression to be disabled for all subsequent ``pyfits.open()`` calls.\n  (r1651)\n\n\n3.0.7 (2012-04-10)\n==================\n\nChanges in Behavior\n-------------------\n\n- Slices of GroupData objects now return new GroupData objects instead of\n  extended multi-row _Group objects. This is analogous to how PyFITS 3.0 fixed\n  FITS_rec slicing, and should have been fixed for GroupData at the same time.\n  The old behavior caused bugs where functions internal to Numpy expected that\n  slicing an ndarray would return a new ndarray.  As this is a rare use case\n  with a rare feature most users are unlikely to be affected by this change.\n\n- The previously internal _Group object for representing individual group\n  records in a GroupData object are renamed Group and are now a public\n  interface.  However, there's almost no good reason to create Group objects\n  directly, so it shouldn't be considered a \"new feature\".\n\n- An annoyance from PyFITS 3.0.6 was fixed, where the value of the EXTEND\n  keyword was always being set to F if there are not actually any extension\n  HDUs.  It was unnecessary to modify this value.\n\nBug Fixes\n---------\n\n- Fixed GroupData objects to return new GroupData objects when sliced instead\n  of _Group record objects.  See \"Changes in behavior\" above for more details.\n\n- Fixed slicing of Group objects--previously it was not possible to slice\n  slice them at all.\n\n- Made it possible to assign ``np.bool_`` objects as header values. (#123)\n\n- Fixed overly strict handling of the EXTEND keyword; see \"Changes in\n  behavior\" above. (#124)\n\n- Fixed many cases where an HDU's header would be marked as \"modified\" by\n  PyFITS and rewritten, even when no changes to the header are necessary.\n  (#125)\n\n- Fixed a bug where the values of the PTYPEn keywords in a random groups HDU\n  were forced to be all lower-case when saving the file. (#130)\n\n- Removed an unnecessary inline import in ``ExtensionHDU.__setattr__`` that was\n  causing some slowdown when opening files containing a large number of\n  extensions, plus a few other small (but not insignificant) performance\n  improvements thanks to Julian Taylor. (#133)\n\n- Fixed a regression where header blocks containing invalid end-of-header\n  padding (i.e. null bytes instead of spaces) couldn't be parsed by PyFITS.\n  Such headers can be parsed again, but a warning is raised, as such headers\n  are not valid FITS. (#136)\n\n- Fixed a memory leak where table data in random groups HDUs weren't being\n  garbage collected. (#138)\n\n\n3.0.6 (2012-02-29)\n==================\n\nHighlights\n----------\n\nThe main reason for this release is to fix an issue that was introduced in\nPyFITS 3.0.5 where merely opening a file containing scaled data (that is, with\nnon-trivial BSCALE and BZERO keywords) in 'update' mode would cause the data\nto be automatically rescaled--possibly converting the data from ints to\nfloats--as soon as the file is closed, even if the application did not touch\nthe data.  Now PyFITS will only rescale the data in an extension when the data\nis actually accessed by the application.  So opening a file in 'update' mode\nin order to modify the header or append new extensions will not cause any\nchange to the data in existing extensions.\n\nThis release also fixes a few Windows-specific bugs found through more\nextensive Windows testing, and other miscellaneous bugs.\n\nBug Fixes\n---------\n\n- More accurate error messages when opening files containing invalid header\n  cards. (#109)\n\n- Fixed a possible reference cycle/memory leak that was caught through more\n  extensive testing on Windows. (#112)\n\n- Fixed 'ostream' mode to open the underlying file in 'wb' mode instead of 'w'\n  mode. (#112)\n\n- Fixed a Windows-only issue where trying to save updates to a resized FITS\n  file could result in a crash due to there being open mmaps on that file.\n  (#112)\n\n- Fixed a crash when trying to create a FITS table (i.e. with new_table())\n  from a Numpy array containing bool fields. (#113)\n\n- Fixed a bug where manually initializing an ``HDUList`` with a list of of\n  HDUs wouldn't set the correct EXTEND keyword value on the primary HDU.\n  (#114)\n\n- Fixed a crash that could occur when trying to deepcopy a Header in Python <\n  2.7. (#115)\n\n- Fixed an issue where merely opening a scaled image in 'update' mode would\n  cause the data to be converted to floats when the file is closed. (#119)\n\n\n3.0.5 (2012-01-30)\n==================\n\n- Fixed a crash that could occur when accessing image sections of files\n  opened with memmap=True. (r1211)\n\n- Fixed the inconsistency in the behavior of files opened in 'readonly' mode\n  when memmap=True vs. when memmap=False.  In the latter case, although\n  changes to array data were not saved to disk, it was possible to update the\n  array data in memory.  On the other hand with memmap=True, 'readonly' mode\n  prevented even in-memory modification to the data.  This is what\n  'copyonwrite' mode was for, but difference in behavior was confusing.  Now\n  'readonly' is equivalent to 'copyonwrite' when using memmap.  If the old\n  behavior of denying changes to the array data is necessary, a new\n  'denywrite' mode may be used, though it is only applicable to files opened\n  with memmap. (r1275)\n\n- Fixed an issue where files opened with memmap=True would return image data\n  as a raw numpy.memmap object, which can cause some unexpected\n  behaviors--instead memmap object is viewed as a numpy.ndarray. (r1285)\n\n- Fixed an issue in Python 3 where a workaround for a bug in Numpy on Python 3\n  interacted badly with some other software, namely to vo.table package (and\n  possibly others). (r1320, r1337, and #110)\n\n- Fixed buggy behavior in the handling of SIGINTs (i.e. Ctrl-C keyboard\n  interrupts) while flushing changes to a FITS file.  PyFITS already prevented\n  SIGINTs from causing an incomplete flush, but did not clean up the signal\n  handlers properly afterwards, or reraise the keyboard interrupt once the\n  flush was complete. (r1321)\n\n- Fixed a crash that could occur in Python 3 when opening files with checksum\n  checking enabled. (r1336)\n\n- Fixed a small bug that could cause a crash in the ``StreamingHDU`` interface\n  when using Numpy below version 1.5.\n\n- Fixed a crash that could occur when creating a new ``CompImageHDU`` from an\n  array of big-endian data. (#104)\n\n- Fixed a crash when opening a file with extra zero padding at the end.\n  Though FITS files should not have such padding, it's not explicitly forbidden\n  by the format either, and PyFITS shouldn't stumble over it. (#106)\n\n- Fixed a major slowdown in opening tables containing large columns of string\n  values.  (#111)\n\n\n3.0.4 (2011-11-22)\n==================\n\n- Fixed a crash when writing HCOMPRESS compressed images that could happen on\n  Python 2.5 and 2.6. (r1217)\n\n- Fixed a crash when slicing an table in a file opened in 'readonly' mode with\n  memmap=True. (r1230)\n\n- Writing changes to a file or writing to a new file verifies the output in\n  'fix' mode by default instead of 'exception'--that is, PyFITS will\n  automatically fix common FITS format errors rather than raising an\n  exception. (r1243)\n\n- Fixed a bug where convenience functions such as getval() and getheader()\n  crashed when specifying just 'PRIMARY' as the extension to use (r1263).\n\n- Fixed a bug that prevented passing keyword arguments (beyond the standard\n  data and header arguments) as positional arguments to the constructors of\n  extension HDU classes.\n\n- Fixed some tests that were failing on Windows--in this case the tests\n  themselves failed to close some temp files and Windows refused to delete them\n  while there were still open handles on them. (r1295)\n\n- Fixed an issue with floating point formatting in header values on Python 2.5\n  for Windows (and possibly other platforms).  The exponent was zero-padded to\n  3 digits; although the FITS standard makes no specification on this, the\n  formatting is now normalized to always pad the exponent to two digits.\n  (r1295)\n\n- Fixed a bug where long commentary cards (such as HISTORY and COMMENT) were\n  broken into multiple CONTINUE cards.  However, commentary cards are not\n  expected to be found in CONTINUE cards.  Instead these long cards are broken\n  into multiple commentary cards. (#97)\n\n- GZIP/ZIP-compressed FITS files can be detected and opened regardless of\n  their filename extension. (#99)\n\n- Fixed a serious bug where opening scaled images in 'update' mode and then\n  closing the file without touching the data would cause the file to be\n  corrupted. (#101)\n\n\n3.0.3 (2011-10-05)\n==================\n\n- Fixed several small bugs involving corner cases in record-valued keyword\n  cards (#70)\n\n- In some cases HDU creation failed if the first keyword value in the header\n  was not a string value (#89)\n\n- Fixed a crash when trying to compute the HDU checksum when the data array\n  contains an odd number of bytes (#91)\n\n- Disabled an unnecessary warning that was displayed on opening compressed\n  HDUs with disable_image_compression = True (#92)\n\n- Fixed a typo in code for handling HCOMPRESS compressed images.\n\n\n3.0.2 (2011-09-23)\n==================\n\n- The ``BinTableHDU.tcreate`` method and by extension the ``pyfits.tcreate``\n  function don't get tripped up by blank lines anymore (#14)\n\n- The presence, value, and position of the EXTEND keyword in Primary HDUs is\n  verified when reading/writing a FITS file (#32)\n\n- Improved documentation (in warning messages as well as in the handbook) that\n  PyFITS uses zero-based indexing (as one would expect for C/Python code, but\n  contrary to the PyFITS standard which was written with FORTRAN in mind)\n  (#68)\n\n- Fixed a bug where updating a header card comment could cause the value to be\n  lost if it had not already been read from the card image string.\n\n- Fixed a related bug where changes made directly to Card object in a header\n  (i.e. assigning directly to card.value or card.comment) would not propagate\n  when flushing changes to the file (#69) [Note: This and the bug above it\n  were originally reported as being fixed in version 3.0.1, but the fix was\n  never included in the release.]\n\n- Improved file handling, particularly in Python 3 which had a few small file\n  I/O-related bugs (#76)\n\n- Fixed a bug where updating a FITS file would sometimes cause it to lose its\n  original file permissions (#79)\n\n- Fixed the handling of TDIMn keywords; 3.0 added support for them, but got\n  the axis order backwards (they were treated as though they were row-major)\n  (#82)\n\n- Fixed a crash when a FITS file containing scaled data is opened and\n  immediately written to a new file without explicitly viewing the data first\n  (#84)\n\n- Fixed a bug where creating a table with columns named either 'names' or\n  'formats' resulted in an infinite recursion (#86)\n\n\n3.0.1 (2011-09-12)\n==================\n\n- Fixed a bug where updating a header card comment could cause the value to be\n  lost if it had not already been read from the card image string.\n\n- Changed ``_TableBaseHDU.data`` so that if the data contain an empty table a\n  ``FITS_rec`` object with zero rows is returned rather than ``None``.\n\n- The ``.key`` attribute of ``RecordValuedKeywordCards`` now returns the full\n  keyword+field-specifier value, instead of just the plain keyword (#46)\n\n- Fixed a related bug where changes made directly to Card object in a header\n  (i.e. assigning directly to card.value or card.comment) would not propagate\n  when flushing changes to the file (#69)\n\n- Fixed a bug where writing a table with zero rows could fail in some cases\n  (#72)\n\n- Miscellaneous small bug fixes that were causing some tests to fail,\n  particularly on Python 3 (#74, #75)\n\n- Fixed a bug where creating a table column from an array in non-native byte\n  order would not preserve the byte order, thus interpreting the column array\n  using the wrong byte order (#77)\n\n\n3.0.0 (2011-08-23)\n====================\n\n- Contains major changes, bumping the version to 3.0\n\n- Large amounts of refactoring and reorganization of the code; tried to\n  preserve public API backwards-compatibility with older versions (private API\n  has many changes and is not guaranteed to be backwards-compatible).  There\n  are a few small public API changes to be aware of:\n\n  * The pyfits.rec module has been removed completely.  If your version of\n    numpy does not have the numpy.core.records module it is too old to be used\n    with PyFITS.\n\n  * The ``Header.ascardlist()`` method is deprecated--use the ``.ascard``\n    attribute instead.\n\n  * ``Card`` instances have a new ``.cardimage`` attribute that should be used\n    rather than ``.ascardimage()``, which may become deprecated.\n\n  * The ``Card.fromstring()`` method is now a classmethod.  It returns a new\n    ``Card`` instance rather than modifying an existing instance.\n\n  * The ``req_cards()`` method on HDU instances has changed:  The ``pos``\n    argument is not longer a string.  It is either an integer value (meaning\n    the card's position must match that value) or it can be a function that\n    takes the card's position as it's argument, and returns True if the\n    position is valid.  Likewise, the ``test`` argument no longer takes a\n    string, but instead a function that validates the card's value and returns\n    True or False.\n\n  * The ``get_coldefs()`` method of table HDUs is deprecated.  Use the\n    ``.columns`` attribute instead.\n\n  * The ``ColDefs.data`` attribute is deprecated--use ``ColDefs.columns``\n    instead (though in general you shouldn't mess with it directly--it might\n    become internal at some point).\n\n  * ``FITS_record`` objects take ``start`` and ``end`` as arguments instead of\n    ``startColumn`` and ``endColumn`` (these are rarely created manually, so\n    it's unlikely that this change will affect anyone).\n\n  * ``BinTableHDU.tcreate()`` is now a classmethod, and returns a new\n    ``BinTableHDU`` instance.\n\n  * Use ``ExtensionHDU`` and ``NonstandardExtHDU`` for making new extension HDU\n    classes.  They are now public interfaces, wheres previously they were\n    private and prefixed with underscores.\n\n  * Possibly others--please report if you find any changes that cause\n    difficulties.\n\n- Calls to deprecated functions will display a Deprecation warning.  However,\n  in Python 2.7 and up Deprecation warnings are ignored by default, so run\n  Python with the ``-Wd`` option to see if you're using any deprecated\n  functions.  If we get close to actually removing any functions, we might\n  make the Deprecation warnings display by default.\n\n- Added basic Python 3 support\n\n- Added support for multi-dimensional columns in tables as specified by the\n  TDIMn keywords (#47)\n\n- Fixed a major memory leak that occurred when creating new tables with the\n  ``new_table()`` function (#49)\n  be padded with zero-bytes) vs ASCII tables (where strings are padded with\n  spaces) (#15)\n\n- Fixed a bug in which the case of Random Access Group parameters names was not\n  preserved when writing (#41)\n\n- Added support for binary table fields with zero width (#42)\n\n- Added support for wider integer types in ASCII tables; although this is non-\n  standard, some GEIS images require it (#45)\n\n- Fixed a bug that caused the index_of() method of HDULists to crash when the\n  HDUList object is created from scratch (#48)\n\n- Fixed the behavior of string padding in binary tables (where strings should\n  be padded with nulls instead of spaces)\n\n- Fixed a rare issue that caused excessive memory usage when computing\n  checksums using a non-standard block size (see r818)\n\n- Add support for forced uint data in image sections (#53)\n\n- Fixed an issue where variable-length array columns were not extended when\n  creating a new table with more rows than the original (#54)\n\n- Fixed tuple and list-based indexing of FITS_rec objects (#55)\n\n- Fixed an issue where BZERO and BSCALE keywords were appended to headers in\n  the wrong location (#56)\n\n- ``FITS_record`` objects (table rows) have full slicing support, including\n  stepping, etc. (#59)\n\n- Fixed a bug where updating multiple files simultaneously (such as when\n  running parallel processes) could lead to a race condition with mktemp()\n  (#61)\n\n- Fixed a bug where compressed image headers were not in the order expected by\n  the funpack utility (#62)\n\n\n2.4.0 (2011-01-10)\n====================\nThe following enhancements were added:\n\n- Checksum support now correctly conforms to the FITS standard.  pyfits\n  supports reading and writing both the old checksums and new\n  standard-compliant checksums.  The ``fitscheck`` command-line utility is\n  provided to verify and update checksums.\n\n- Added a new optional keyword argument ``do_not_scale_image_data``\n  to the ``pyfits.open`` convenience function.  When this argument\n  is provided as True, and an ImageHDU is read that contains scaled\n  data, the data is not automatically scaled when it is read.  This\n  option may be used when opening a fits file for update, when you only\n  want to update some header data.  Without the use of this argument, if\n  the header updates required the size of the fits file to change, then\n  when writing the updated information, the data would be read, scaled,\n  and written back out in its scaled format (usually with a different\n  data type) instead of in its non-scaled format.\n\n- Added a new optional keyword argument ``disable_image_compression`` to the\n  ``pyfits.open`` function.  When ``True``, any compressed image HDU's will\n  be read in like they are binary table HDU's.\n\n- Added a ``verify`` keyword argument to the ``pyfits.append`` function.  When\n  ``False``, ``append`` will assume the existing FITS file is already valid\n  and simply append new content to the end of the file, resulting in a large\n  speed up appending to large files.\n\n- Added HDU methods ``update_ext_name`` and ``update_ext_version`` for\n  updating the name and version of an HDU.\n\n- Added HDU method ``filebytes`` to calculate the number of bytes that will be\n  written to the file associated with the HDU.\n\n- Enhanced the section class to allow reading non-contiguous image data.\n  Previously, the section class could only be used to read contiguous data.\n  (CNSHD781626)\n\n- Added method ``HDUList.fileinfo()`` that returns a dictionary with\n  information about the location of header and data in the file associated\n  with the HDU.\n\nThe following bugs were fixed:\n\n- Reading in some malformed FITS headers would cause a ``NameError``\n  exception, rather than information about the cause of the error.\n\n- pyfits can now handle non-compliant ``CONTINUE`` cards produced by Java\n  FITS.\n\n- ``BinTable`` columns with ``TSCALn`` are now byte-swapped correctly.\n\n- Ensure that floating-point card values are no longer than 20 characters.\n\n- Updated ``flush`` so that when the data has changed in an HDU for a file\n  opened in update mode, the header will be updated to match the changed data\n  before writing out the HDU.\n\n- Allow ``HIERARCH`` cards to contain a keyword and value whose total\n  character length is 69 characters.  Previous length was limited at 68\n  characters.\n\n- Calls to ``FITS_rec['columnName']`` now return an ``ndarray``. exactly the\n  same as a call to ``FITS_rec.field('columnName')`` or\n  ``FITS_rec.columnName``.  Previously, ``FITS_rec['columnName']`` returned a\n  much less useful ``fits_record`` object. (CNSHD789053)\n\n- Corrected the ``append`` convenience function to eliminate the reading of\n  the HDU data from the file that is being appended to.  (CNSHD794738)\n\n- Eliminated common symbols between the pyfitsComp module and the cfitsio and\n  zlib libraries.  These can cause problems on systems that use both PyFITS\n  and cfitsio or zlib. (CNSHD795046)\n\n\n2.3.1 (2010-06-03)\n====================\n\nThe following bugs were fixed:\n\n- Replaced code in the Compressed Image HDU extension which was covered under\n  a GNU General Public License with code that is covered under a BSD License.\n  This change allows the distribution of pyfits under a BSD License.\n\n\n2.3 (2010-05-11)\n==================\n\nThe following enhancements were made:\n\n- Completely eliminate support for numarray.\n\n- Rework pyfits documentation to use Sphinx.\n\n- Support python 2.6 and future division.\n\n- Added a new method to get the file name associated with an HDUList object.\n  The method HDUList.filename() returns the name of an associated file.  It\n  returns None if no file is associated with the HDUList.\n\n- Support the python 2.5 'with' statement when opening fits files.\n  (CNSHD766308)  It is now possible to use the following construct:\n\n    >>> from __future__ import with_statement import pyfits\n    >>> with pyfits.open(\"input.fits\") as hdul:\n    ...    #process hdul\n    >>>\n\n- Extended the support for reading unsigned integer 16 values from an ImageHDU\n  to include unsigned integer 32 and unsigned integer 64 values.  ImageHDU\n  data is considered to be unsigned integer 16 when the data type is signed\n  integer 16 and BZERO is equal to 2**15 (32784) and BSCALE is equal to 1.\n  ImageHDU data is considered to be unsigned integer 32 when the data type is\n  signed integer 32 and BZERO is equal to 2**31 and BSCALE is equal to 1.\n  ImageHDU data is considered to be unsigned integer 64 when the data type is\n  signed integer 64 and BZERO is equal to 2**63 and BSCALE is equal to 1.  An\n  optional keyword argument (uint) was added to the open convenience function\n  for this purpose.  Supplying a value of True for this argument will cause\n  data of any of these types to be read in and scaled into the appropriate\n  unsigned integer array (uint16, uint32, or uint64) instead of into the\n  normal float 32 or float 64 array.  If an HDU associated with a file that\n  was opened with the 'int' option and containing unsigned integer 16, 32, or\n  64 data is written to a file, the data will be reverse scaled into a signed\n  integer 16, 32, or 64 array and written out to the file along with the\n  appropriate BSCALE/BZERO header cards.  Note that for backward\n  compatibility, the 'uint16' keyword argument will still be accepted in the\n  open function when handling unsigned integer 16 conversion.\n\n- Provided the capability to access the data for a column of a fits table by\n  indexing the table using the column name.  This is consistent with Record\n  Arrays in numpy (array with fields).  (CNSHD763378)  The following example\n  will illustrate this:\n\n    >>> import pyfits\n    >>> hdul = pyfits.open('input.fits')\n    >>> table = hdul[1].data\n    >>> table.names\n    ['c1','c2','c3','c4']\n    >>> print table.field('c2') # this is the data for column 2\n    ['abc' 'xy']\n    >>> print table['c2'] # this is also the data for column 2\n    array(['abc', 'xy '], dtype='|S3')\n    >>> print table[1] # this is the data for row 1\n    (2, 'xy', 6.6999997138977054, True)\n\n- Provided capabilities to create a BinaryTableHDU directly from a numpy\n  Record Array (array with fields). The new capabilities include table\n  creation, writing a numpy Record Array directly to a fits file using the\n  pyfits.writeto and pyfits.append convenience functions.  Reading the data\n  for a BinaryTableHDU from a fits file directly into a numpy Record Array\n  using the pyfits.getdata convenience function.  (CNSHD749034)  Thanks to\n  Erin Sheldon at Brookhaven National Laboratory for help with this.\n\n  The following should illustrate these new capabilities:\n\n    >>> import pyfits\n    >>> import numpy\n    >>> t=numpy.zeros(5,dtype=[('x','f4'),('y','2i4')]) \\\n    ... # Create a numpy Record Array with fields\n    >>> hdu = pyfits.BinTableHDU(t) \\\n    ... # Create a Binary Table HDU directly from the Record Array\n    >>> print hdu.data\n    [(0.0, array([0, 0], dtype=int32))\n     (0.0, array([0, 0], dtype=int32))\n     (0.0, array([0, 0], dtype=int32))\n     (0.0, array([0, 0], dtype=int32))\n     (0.0, array([0, 0], dtype=int32))]\n    >>> hdu.writeto('test1.fits',clobber=True) \\\n    ... # Write the HDU to a file\n    >>> pyfits.info('test1.fits')\n    Filename: test1.fits\n    No.    Name         Type      Cards   Dimensions   Format\n    0    PRIMARY     PrimaryHDU       4  ()            uint8\n    1                BinTableHDU     12  5R x 2C       [E, 2J]\n    >>> pyfits.writeto('test.fits', t, clobber=True) \\\n    ... # Write the Record Array directly to a file\n    >>> pyfits.append('test.fits', t) \\\n    ... # Append another Record Array to the file\n    >>> pyfits.info('test.fits')\n    Filename: test.fits\n    No.    Name         Type      Cards   Dimensions   Format\n    0    PRIMARY     PrimaryHDU       4  ()            uint8\n    1                BinTableHDU     12  5R x 2C       [E, 2J]\n    2                BinTableHDU     12  5R x 2C       [E, 2J]\n    >>> d=pyfits.getdata('test.fits',ext=1) \\\n    ... # Get the first extension from the file as a FITS_rec\n    >>> print type(d)\n    <class 'pyfits.core.FITS_rec'>\n    >>> print d\n    [(0.0, array([0, 0], dtype=int32))\n     (0.0, array([0, 0], dtype=int32))\n     (0.0, array([0, 0], dtype=int32))\n     (0.0, array([0, 0], dtype=int32))\n     (0.0, array([0, 0], dtype=int32))]\n    >>> d=pyfits.getdata('test.fits',ext=1,view=numpy.ndarray) \\\n    ... # Get the first extension from the file as a numpy Record\n          Array\n    >>> print type(d)\n    <type 'numpy.ndarray'>\n    >>> print d\n    [(0.0, [0, 0]) (0.0, [0, 0]) (0.0, [0, 0]) (0.0, [0, 0])\n     (0.0, [0, 0])]\n    >>> print d.dtype\n    [('x', '>f4'), ('y', '>i4', 2)]\n    >>> d=pyfits.getdata('test.fits',ext=1,upper=True,\n    ...                  view=pyfits.FITS_rec) \\\n    ... # Force the Record Array field names to be in upper case\n          regardless of how they are stored in the file\n    >>> print d.dtype\n    [('X', '>f4'), ('Y', '>i4', 2)]\n\n- Provided support for writing fits data to file-like objects that do not\n  support the random access methods seek() and tell().  Most pyfits functions\n  or methods will treat these file-like objects as an empty file that cannot\n  be read, only written.  It is also expected that the file-like object is in\n  a writable condition (ie. opened) when passed into a pyfits function or\n  method.  The following methods and functions will allow writing to a\n  non-random access file-like object: HDUList.writeto(), HDUList.flush(),\n  pyfits.writeto(), and pyfits.append().  The pyfits.open() convenience\n  function may be used to create an HDUList object that is associated with the\n  provided file-like object.  (CNSHD770036)\n\n  An illustration of the new capabilities follows.  In this example fits data\n  is written to standard output which is associated with a file opened in\n  write-only mode:\n\n    >>> import pyfits\n    >>> import numpy as np\n    >>> import sys\n    >>>\n    >>> hdu = pyfits.PrimaryHDU(np.arange(100,dtype=np.int32))\n    >>> hdul = pyfits.HDUList()\n    >>> hdul.append(hdu)\n    >>> tmpfile = open('tmpfile.py','w')\n    >>> sys.stdout = tmpfile\n    >>> hdul.writeto(sys.stdout, clobber=True)\n    >>> sys.stdout = sys.__stdout__\n    >>> tmpfile.close()\n    >>> pyfits.info('tmpfile.py')\n    Filename: tmpfile.py\n    No.    Name         Type      Cards   Dimensions   Format\n    0    PRIMARY     PrimaryHDU       5  (100,)        int32\n    >>>\n\n- Provided support for slicing a FITS_record object.  The FITS_record object\n  represents the data from a row of a table.  Pyfits now supports the slice\n  syntax to retrieve values from the row.  The following illustrates this new\n  syntax:\n\n    >>> hdul = pyfits.open('table.fits')\n    >>> row = hdul[1].data[0]\n    >>> row\n    ('clear', 'nicmos', 1, 30, 'clear', 'idno= 100')\n    >>> a, b, c, d, e = row[0:5]\n    >>> a\n    'clear'\n    >>> b\n    'nicmos'\n    >>> c\n    1\n    >>> d\n    30\n    >>> e\n    'clear'\n    >>>\n\n- Allow the assignment of a row value for a pyfits table using a tuple or a\n  list as input.  The following example illustrates this new feature:\n\n    >>> c1=pyfits.Column(name='target',format='10A')\n    >>> c2=pyfits.Column(name='counts',format='J',unit='DN')\n    >>> c3=pyfits.Column(name='notes',format='A10')\n    >>> c4=pyfits.Column(name='spectrum',format='5E')\n    >>> c5=pyfits.Column(name='flag',format='L')\n    >>> coldefs=pyfits.ColDefs([c1,c2,c3,c4,c5])\n    >>>\n    >>> tbhdu=pyfits.new_table(coldefs, nrows = 5)\n    >>>\n    >>> # Assigning data to a table's row using a tuple\n    >>> tbhdu.data[2] = ('NGC1',312,'A Note',\n    ... num.array([1.1,2.2,3.3,4.4,5.5],dtype=num.float32),\n    ... True)\n    >>>\n    >>> # Assigning data to a tables row using a list\n    >>> tbhdu.data[3] = ['JIM1','33','A Note',\n    ... num.array([1.,2.,3.,4.,5.],dtype=num.float32),True]\n\n- Allow the creation of a Variable Length Format (P format) column from a list\n  of data.  The following example illustrates this new feature:\n\n    >>> a = [num.array([7.2e-20,7.3e-20]),num.array([0.0]),\n    ... num.array([0.0])]\n    >>> acol = pyfits.Column(name='testa',format='PD()',array=a)\n    >>> acol.array\n    _VLF([[  7.20000000e-20   7.30000000e-20], [ 0.], [ 0.]],\n    dtype=object)\n    >>>\n\n- Allow the assignment of multiple rows in a table using the slice syntax. The\n  following example illustrates this new feature:\n\n    >>> counts = num.array([312,334,308,317])\n    >>> names = num.array(['NGC1','NGC2','NGC3','NCG4'])\n    >>> c1=pyfits.Column(name='target',format='10A',array=names)\n    >>> c2=pyfits.Column(name='counts',format='J',unit='DN',\n    ... array=counts)\n    >>> c3=pyfits.Column(name='notes',format='A10')\n    >>> c4=pyfits.Column(name='spectrum',format='5E')\n    >>> c5=pyfits.Column(name='flag',format='L',array=[1,0,1,1])\n    >>> coldefs=pyfits.ColDefs([c1,c2,c3,c4,c5])\n    >>>\n    >>> tbhdu1=pyfits.new_table(coldefs)\n    >>>\n    >>> counts = num.array([112,134,108,117])\n    >>> names = num.array(['NGC5','NGC6','NGC7','NCG8'])\n    >>> c1=pyfits.Column(name='target',format='10A',array=names)\n    >>> c2=pyfits.Column(name='counts',format='J',unit='DN',\n    ... array=counts)\n    >>> c3=pyfits.Column(name='notes',format='A10')\n    >>> c4=pyfits.Column(name='spectrum',format='5E')\n    >>> c5=pyfits.Column(name='flag',format='L',array=[0,1,0,0])\n    >>> coldefs=pyfits.ColDefs([c1,c2,c3,c4,c5])\n    >>>\n    >>> tbhdu=pyfits.new_table(coldefs)\n    >>> tbhdu.data[0][3] = num.array([1.,2.,3.,4.,5.],\n    ... dtype=num.float32)\n    >>>\n    >>> tbhdu2=pyfits.new_table(tbhdu1.data, nrows=9)\n    >>>\n    >>> # Assign the 4 rows from the second table to rows 5 thru\n    ...   8 of the new table.  Note that the last row of the new\n    ...   table will still be initialized to the default values.\n    >>> tbhdu2.data[4:] = tbhdu.data\n    >>>\n    >>> print tbhdu2.data\n    [ ('NGC1', 312, '0.0', array([ 0.,  0.,  0.,  0.,  0.],\n    dtype=float32), True)\n      ('NGC2', 334, '0.0', array([ 0.,  0.,  0.,  0.,  0.],\n    dtype=float32), False)\n      ('NGC3', 308, '0.0', array([ 0.,  0.,  0.,  0.,  0.],\n    dtype=float32), True)\n      ('NCG4', 317, '0.0', array([ 0.,  0.,  0.,  0.,  0.],\n    dtype=float32), True)\n      ('NGC5', 112, '0.0', array([ 1.,  2.,  3.,  4.,  5.],\n    dtype=float32), False)\n      ('NGC6', 134, '0.0', array([ 0.,  0.,  0.,  0.,  0.],\n    dtype=float32), True)\n      ('NGC7', 108, '0.0', array([ 0.,  0.,  0.,  0.,  0.],\n    dtype=float32), False)\n      ('NCG8', 117, '0.0', array([ 0.,  0.,  0.,  0.,  0.],\n    dtype=float32), False)\n      ('0.0', 0, '0.0', array([ 0.,  0.,  0.,  0.,  0.],\n    dtype=float32), False)]\n    >>>\n\nThe following bugs were fixed:\n\n- Corrected bugs in HDUList.append and HDUList.insert to correctly handle the\n  situation where you want to insert or append a Primary HDU as something\n  other than the first HDU in an HDUList and the situation where you want to\n  insert or append an Extension HDU as the first HDU in an HDUList.\n\n- Corrected a bug involving scaled images (both compressed and not compressed)\n  that include a BLANK, or ZBLANK card in the header.  When the image values\n  match the BLANK or ZBLANK value, the value should be replaced with NaN after\n  scaling.  Instead, pyfits was scaling the BLANK or ZBLANK value and\n  returning it. (CNSHD766129)\n\n- Corrected a byteswapping bug that occurs when writing certain column data.\n  (CNSHD763307)\n\n- Corrected a bug that occurs when creating a column from a chararray when one\n  or more elements are shorter than the specified format length.  The bug\n  wrote nulls instead of spaces to the file. (CNSHD695419)\n\n- Corrected a bug in the HDU verification software to ensure that the header\n  contains no NAXISn cards where n > NAXIS.\n\n- Corrected a bug involving reading and writing compressed image data.  When\n  written, the header keyword card ZTENSION will always have the value 'IMAGE'\n  and when read, if the ZTENSION value is not 'IMAGE' the user will receive a\n  warning, but the data will still be treated as image data.\n\n- Corrected a bug that restricted the ability to create a custom HDU class and\n  use it with pyfits.  The bug fix will allow something like this:\n\n    >>> import pyfits\n    >>> class MyPrimaryHDU(pyfits.PrimaryHDU):\n    ...     def __init__(self, data=None, header=None):\n    ...         pyfits.PrimaryHDU.__init__(self, data, header)\n    ...     def _summary(self):\n    ...         \"\"\"\n    ...         Reimplement a method of the class.\n    ...         \"\"\"\n    ...         s = pyfits.PrimaryHDU._summary(self)\n    ...         # change the behavior to suit me.\n    ...         s1 = 'MyPRIMARY ' + s[11:]\n    ...         return s1\n    ...\n    >>> hdul=pyfits.open(\"pix.fits\",\n    ... classExtensions={pyfits.PrimaryHDU: MyPrimaryHDU})\n    >>> hdul.info()\n    Filename: pix.fits\n    No.    Name         Type      Cards   Dimensions   Format\n    0    MyPRIMARY  MyPrimaryHDU     59  (512, 512)    int16\n    >>>\n\n- Modified ColDefs.add_col so that instead of returning a new ColDefs object\n  with the column added to the end, it simply appends the new column to the\n  current ColDefs object in place.  (CNSHD768778)\n\n- Corrected a bug in ColDefs.del_col which raised a KeyError exception when\n  deleting a column from a ColDefs object.\n\n- Modified the open convenience function so that when a file is opened in\n  readonly mode and the file contains no HDU's an IOError is raised.\n\n- Modified _TableBaseHDU to ensure that all locations where data is referenced\n  in the object actually reference the same ndarray, instead of copies of the\n  array.\n\n- Corrected a bug in the Column class that failed to initialize data when the\n  data is a boolean array.  (CNSHD779136)\n\n- Corrected a bug that caused an exception to be raised when creating a\n  variable length format column from character data (PA format).\n\n- Modified installation code so that when installing on Windows, when a C++\n  compiler compatible with the Python binary is not found, the installation\n  completes with a warning that all optional extension modules failed to\n  build.  Previously, an Error was issued and the installation stopped.\n\n\n2.2.2 (2009-10-12)\n====================\n\nUpdates described in this release are only supported in the NUMPY version of\npyfits.\n\nThe following bugs were fixed:\n\n- Corrected a bug that caused an exception to be raised when creating a\n  CompImageHDU using an initial header that does not match the image data in\n  terms of the number of axis.\n\n\n2.2.1 (2009-10-06)\n====================\n\nUpdates described in this release are only supported in the NUMPY version of\npyfits.\n\nThe following bugs were fixed:\n\n- Corrected a bug that prevented the opening of a fits file where a header\n  contained a CHECKSUM card but no DATASUM card.\n\n- Corrected a bug that caused NULLs to be written instead of blanks when an\n  ASCII table was created using a numpy chararray in which the original data\n  contained trailing blanks.  (CNSHD695419)\n\n\n2.2 (2009-09-23)\n==================\n\nUpdates described in this release are only supported in the NUMPY version of\npyfits.\n\nThe following enhancements were made:\n\n- Provide support for the FITS Checksum Keyword Convention.  (CNSHD754301)\n\n- Adding the checksum=True keyword argument to the open convenience function\n  will cause checksums to be verified on file open:\n\n    >>> hdul=pyfits.open('in.fits', checksum=True)\n\n- On output, CHECKSUM and DATASUM cards may be output to all HDU's in a fits\n  file by using the keyword argument checksum=True in calls to the writeto\n  convenience function, the HDUList.writeto method, the writeto methods of all\n  of the HDU classes, and the append convenience function:\n\n    >>> hdul.writeto('out.fits', checksum=True)\n\n- Implemented a new insert method to the HDUList class that allows for the\n  insertion of a HDU into a HDUList at a given index:\n\n    >>> hdul.insert(2,hdu)\n\n- Provided the capability to handle Unicode input for file names.\n\n- Provided support for integer division required by Python 3.0.\n\nThe following bugs were fixed:\n\n- Corrected a bug that caused an index out of bounds exception to be raised\n  when iterating over the rows of a binary table HDU using the syntax  \"for\n  row in tbhdu.data:   \".  (CNSHD748609)\n\n- Corrected a bug that prevented the use of the writeto convenience function\n  for writing table data to a file.  (CNSHD749024)\n\n- Modified the code to raise an IOError exception with the comment \"Header\n  missing END card.\" when pyfits can't find a valid END card for a header when\n  opening a file.\n\n  - This change addressed a problem with a non-standard fits file that\n    contained several new-line characters at the end of each header and at the\n    end of the file.  However, since some people want to be able to open these\n    non-standard files anyway, an option was added to the open convenience\n    function to allow these files to be opened without exception:\n\n      >>> pyfits.open('infile.fits',ignore_missing_end=True)\n\n- Corrected a bug that prevented the use of StringIO objects as fits files\n  when reading and writing table data.  Previously, only image data was\n  supported.  (CNSHD753698)\n\n- Corrected a bug that caused a bus error to be generated when compressing\n  image data using GZIP_1 under the Solaris operating system.\n\n- Corrected bugs that prevented pyfits from properly reading Random Groups\n  HDU's using numpy.  (CNSHD756570)\n\n- Corrected a bug that can occur when writing a fits file.  (CNSHD757508)\n\n  - If no default SIGINT signal handler has not been assigned, before the\n    write, a TypeError exception is raised in the _File.flush() method when\n    attempting to return the signal handler to its previous state.  Notably\n    this occurred when using mod_python.  The code was changed to use SIG_DFL\n    when no old handler was defined.\n\n- Corrected a bug in CompImageHDU that prevented rescaling the image data\n  using hdu.scale(option='old').\n\n\n2.1.1 (2009-04-22)\n===================\n\nUpdates described in this release are only supported in the NUMPY version of\npyfits.\n\nThe following bugs were fixed:\n\n- Corrected a bug that caused an exception to be raised when closing a file\n  opened for append, where an HDU was appended to the file, after data was\n  accessed from the file.  This exception was only raised when running on a\n  Windows platform.\n\n- Updated the installation scripts, compression source code, and benchmark\n  test scripts to properly install, build, and execute on a Windows platform.\n\n\n2.1 (2009-04-14)\n==================\n\nUpdates described in this release are only supported in the NUMPY version of\npyfits.\n\nThe following enhancements were made:\n\n- Added new tdump and tcreate capabilities to pyfits.\n\n  - The new tdump convenience function allows the contents of a binary table\n    HDU to be dumped to a set of three files in ASCII format.  One file will\n    contain column definitions, the second will contain header parameters, and\n    the third will contain header data.\n\n  - The new tcreate convenience function allows the creation of a binary table\n    HDU from the three files dumped by the tdump convenience function.\n\n  - The primary use for the tdump/tcreate methods are to allow editing in a\n    standard text editor of the binary table data and parameters.\n\n- Added support for case sensitive values of the EXTNAME card in an extension\n  header.  (CNSHD745784)\n\n  - By default, pyfits converts the value of EXTNAME cards to upper case when\n    reading from a file.  A new convenience function\n    (setExtensionNameCaseSensitive) was implemented to allow a user to\n    circumvent this behavior so that the EXTNAME value remains in the same\n    case as it is in the file.\n\n  - With the following function call, pyfits will maintain the case of all\n    characters in the EXTNAME card values of all extension HDU's during the\n    entire python session, or until another call to the function is made:\n\n      >>> import pyfits\n      >>> pyfits.setExtensionNameCaseSensitive()\n\n  - The following function call will return pyfits to its default (all upper\n    case) behavior:\n\n      >>> pyfits.setExtensionNameCaseSensitive(False)\n\n\n- Added support for reading and writing FITS files in which the value of the\n  first card in the header is 'SIMPLE=F'.  In this case, the pyfits open\n  function returns an HDUList object that contains a single HDU of the new\n  type _NonstandardHDU.  The header for this HDU is like a normal header (with\n  the exception that the first card contains SIMPLE=F instead of SIMPLE=T).\n  Like normal HDU's the reading of the data is delayed until actually\n  requested.  The data is read from the file into a string starting from the\n  first byte after the header END card and continuing till the end of the\n  file.  When written, the header is written, followed by the data string.  No\n  attempt is made to pad the data string so that it fills into a standard 2880\n  byte FITS block.  (CNSHD744730)\n\n- Added support for FITS files containing  extensions with unknown XTENSION\n  card values.  (CNSHD744730)  Standard FITS files support extension HDU's of\n  types TABLE, IMAGE, BINTABLE, and A3DTABLE.  Accessing a nonstandard\n  extension from a FITS file will now create a _NonstandardExtHDU object.\n  Accessing the data of this object will cause the data to be read from the\n  file into a string.  If the HDU is written back to a file the string data is\n  written after the Header and padded to fill a standard 2880 byte FITS block.\n\nThe following bugs were fixed:\n\n- Extensive changes were made to the tiled image compression code to support\n  the latest enhancements made in CFITSIO version 3.13 to support this\n  convention.\n\n- Eliminated a memory leak in the tiled image compression code.\n\n- Corrected a bug in the FITS_record.__setitem__ method which raised a\n  NameError exception when attempting to set a value in a FITS_record object.\n  (CNSHD745844)\n\n- Corrected a bug that caused a TypeError exception to be raised when reading\n  fits files containing large table HDU's (>2Gig).  (CNSHD745522)\n\n- Corrected a bug that caused a TypeError exception to be raised for all calls\n  to the warnings module when running under Python 2.6.  The formatwarning\n  method in the warnings module was changed in Python 2.6 to include a new\n  argument.  (CNSHD746592)\n\n- Corrected the behavior of the membership (in) operator in the Header class\n  to check against header card keywords instead of card values.  (CNSHD744730)\n\n- Corrected the behavior of iteration on a Header object.  The new behavior\n  iterates over the unique card keywords instead of the card values.\n\n\n2.0.1 (2009-02-03)\n====================\n\nUpdates described in this release are only supported in the NUMPY version of\npyfits.\n\nThe following bugs were fixed:\n\n- Eliminated a memory leak when reading Table HDU's from a fits file.\n  (CNSHD741877)\n\n\n2.0 (2009-01-30)\n==================\n\nUpdates described in this release are only supported in the NUMPY version of\npyfits.\n\nThe following enhancements were made:\n\n- Provide initial support for an image compression convention known as the\n  \"Tiled Image Compression Convention\" `[1]`_.\n\n  - The principle used in this convention is to first divide the n-dimensional\n    image into a rectangular grid of subimages or \"tiles\".  Each tile is then\n    compressed as a continuous block of data, and the resulting compressed\n    byte stream is stored in a row of a variable length column in a FITS\n    binary table.  Several commonly used algorithms for compressing image\n    tiles are supported.  These include, GZIP, RICE, H-Compress and IRAF pixel\n    list (PLIO).\n\n  - Support for compressed image data is provided using the optional\n    \"pyfitsComp\" module contained in a C shared library (pyfitsCompmodule.so).\n\n  - The header of a compressed image HDU appears to the user like any image\n    header.  The actual header stored in the FITS file is that of a binary\n    table HDU with a set of special keywords, defined by the convention, to\n    describe the structure of the compressed image.  The conversion between\n    binary table HDU header and image HDU header is all performed behind the\n    scenes.  Since the HDU is actually a binary table, it may not appear as a\n    primary HDU in a FITS file.\n\n  - The data of a compressed image HDU appears to the user as standard\n    uncompressed image data.  The actual data is stored in the fits file as\n    Binary Table data containing at least one column (COMPRESSED_DATA).  Each\n    row of this variable-length column contains the byte stream that was\n    generated as a result of compressing the corresponding image tile.\n    Several optional columns may also appear.  These include,\n    UNCOMPRESSED_DATA to hold the uncompressed pixel values for tiles that\n    cannot be compressed, ZSCALE and ZZERO to hold the linear scale factor and\n    zero point offset which may be needed to transform the raw uncompressed\n    values back to the original image pixel values, and ZBLANK to hold the\n    integer value used to represent undefined pixels (if any) in the image.\n\n  - To create a compressed image HDU from scratch, simply construct a\n    CompImageHDU object from an uncompressed image data array and its\n    associated image header.  From there, the HDU can be treated just like any\n    image HDU:\n\n      >>> hdu=pyfits.CompImageHDU(imageData,imageHeader)\n      >>> hdu.writeto('compressed_image.fits')\n\n  - The signature for the CompImageHDU initializer method describes the\n    possible options for constructing a CompImageHDU object::\n\n      def __init__(self, data=None, header=None, name=None,\n                   compressionType='RICE_1',\n                   tileSize=None,\n                   hcompScale=0.,\n                   hcompSmooth=0,\n                   quantizeLevel=16.):\n          \"\"\"\n              data:            data of the image\n              header:          header to be associated with the\n                               image\n              name:            the EXTNAME value; if this value\n                               is None, then the name from the\n                               input image header will be used;\n                               if there is no name in the input\n                               image header then the default name\n                               'COMPRESSED_IMAGE' is used\n              compressionType: compression algorithm 'RICE_1',\n                               'PLIO_1', 'GZIP_1', 'HCOMPRESS_1'\n              tileSize:        compression tile sizes default\n                               treats each row of image as a tile\n              hcompScale:      HCOMPRESS scale parameter\n              hcompSmooth:     HCOMPRESS smooth parameter\n              quantizeLevel:   floating point quantization level;\n          \"\"\"\n\n- Added two new convenience functions.  The setval function allows the setting\n  of the value of a single header card in a fits file.  The delval function\n  allows the deletion of a single header card in a fits file.\n\n- A modification was made to allow the reading of data from a fits file\n  containing a Table HDU that has duplicate field names.  It is normally a\n  requirement that the field names in a Table HDU be unique.  Prior to this\n  change a ValueError was raised, when the data was accessed, to indicate that\n  the HDU contained duplicate field names.  Now, a warning is issued and the\n  field names are made unique in the internal record array.  This will not\n  change the TTYPEn header card values.  You will be able to get the data from\n  all fields using the field name, including the first field containing the\n  name that is duplicated.  To access the data of the other fields with the\n  duplicated names you will need to use the field number instead of the field\n  name.  (CNSHD737193)\n\n- An enhancement was made to allow the reading of unsigned integer 16 values\n  from an ImageHDU when the data is signed integer 16 and BZERO is equal to\n  32784 and BSCALE is equal to 1 (the standard way for scaling unsigned\n  integer 16 data).  A new optional keyword argument (uint16) was added to the\n  open convenience function.  Supplying a value of True for this argument will\n  cause data of this type to be read in and scaled into an unsigned integer 16\n  array, instead of a float 32 array.  If a HDU associated with a file that\n  was opened with the uint16 option and containing unsigned integer 16 data is\n  written to a file, the data will be reverse scaled into an integer 16 array\n  and written out to the file and the BSCALE/BZERO header cards will be\n  written with the values 1 and 32768 respectively.  (CHSHD736064) Reference\n  the following example:\n\n    >>> import pyfits\n    >>> hdul=pyfits.open('o4sp040b0_raw.fits',uint16=1)\n    >>> hdul[1].data\n    array([[1507, 1509, 1505, ..., 1498, 1500, 1487],\n           [1508, 1507, 1509, ..., 1498, 1505, 1490],\n           [1505, 1507, 1505, ..., 1499, 1504, 1491],\n           ...,\n           [1505, 1506, 1507, ..., 1497, 1502, 1487],\n           [1507, 1507, 1504, ..., 1495, 1499, 1486],\n           [1515, 1507, 1504, ..., 1492, 1498, 1487]], dtype=uint16)\n    >>> hdul.writeto('tmp.fits')\n    >>> hdul1=pyfits.open('tmp.fits',uint16=1)\n    >>> hdul1[1].data\n    array([[1507, 1509, 1505, ..., 1498, 1500, 1487],\n           [1508, 1507, 1509, ..., 1498, 1505, 1490],\n           [1505, 1507, 1505, ..., 1499, 1504, 1491],\n           ...,\n           [1505, 1506, 1507, ..., 1497, 1502, 1487],\n           [1507, 1507, 1504, ..., 1495, 1499, 1486],\n           [1515, 1507, 1504, ..., 1492, 1498, 1487]], dtype=uint16)\n    >>> hdul1=pyfits.open('tmp.fits')\n    >>> hdul1[1].data\n    array([[ 1507.,  1509.,  1505., ...,  1498.,  1500.,  1487.],\n           [ 1508.,  1507.,  1509., ...,  1498.,  1505.,  1490.],\n           [ 1505.,  1507.,  1505., ...,  1499.,  1504.,  1491.],\n           ...,\n           [ 1505.,  1506.,  1507., ...,  1497.,  1502.,  1487.],\n           [ 1507.,  1507.,  1504., ...,  1495.,  1499.,  1486.],\n           [ 1515.,  1507.,  1504., ...,  1492.,  1498.,  1487.]], dtype=float32)\n\n- Enhanced the message generated when a ValueError exception is raised when\n  attempting to access a header card with an unparsable value.  The message\n  now includes the Card name.\n\nThe following bugs were fixed:\n\n- Corrected a bug that occurs when appending a binary table HDU to a fits\n  file.  Data was not being byteswapped on little endian machines.\n  (CNSHD737243)\n\n- Corrected a bug that occurs when trying to write an ImageHDU that is missing\n  the required PCOUNT card in the header.  An UnboundLocalError exception\n  complaining that the local variable 'insert_pos' was referenced before\n  assignment was being raised in the method _ValidHDU.req_cards.  The code was\n  modified so that it would properly issue a more meaningful ValueError\n  exception with a description of what required card is missing in the header.\n\n- Eliminated a redundant warning message about the PCOUNT card when validating\n  an ImageHDU header with a PCOUNT card that is missing or has a value other\n  than 0.\n\n.. _[1]: https://fits.gsfc.nasa.gov/registry/tilecompression.html\n\n\n1.4.1 (2008-11-04)\n====================\n\nUpdates described in this release are only supported in the NUMPY version of\npyfits.\n\nThe following enhancements were made:\n\n- Enhanced the way import errors are reported to provide more information.\n\nThe following bugs were fixed:\n\n- Corrected a bug that occurs when a card value is a string and contains a\n  colon but is not a record-valued keyword card.\n\n- Corrected a bug where pyfits fails to properly handle a record-valued\n  keyword card with values using exponential notation and trailing blanks.\n\n\n1.4 (2008-07-07)\n==================\n\nUpdates described in this release are only supported in the NUMPY version of\npyfits.\n\nThe following enhancements were made:\n\n- Added support for file objects and file like objects.\n\n  - All convenience functions and class methods that take a file name will now\n    also accept a file object or file like object.  File like objects\n    supported are StringIO and GzipFile objects.  Other file like objects will\n    work only if they implement all of the standard file object methods.\n\n  - For the most part, file or file like objects may be either opened or\n    closed at function call.  An opened object must be opened with the proper\n    mode depending on the function or method called.  Whenever possible, if\n    the object is opened before the method is called, it will remain open\n    after the call.  This will not be possible when writing a HDUList that has\n    been resized or when writing to a GzipFile object regardless of whether it\n    is resized.  If the object is closed at the time of the function call,\n    only the name from the object is used, not the object itself.  The pyfits\n    code will extract the file name used by the object and use that to create\n    an underlying file object on which the function will be performed.\n\n- Added support for record-valued keyword cards as introduced in the \"FITS WCS\n  proposal for representing a more general distortion model\".\n\n  - Record-valued keyword cards are string-valued cards where the string is\n    interpreted as a definition giving a record field name, and its floating\n    point value.  In a FITS header they have the following syntax::\n\n      keyword= 'field-specifier: float'\n\n    where keyword is a standard eight-character FITS keyword name, float is\n    the standard FITS ASCII representation of a floating point number, and\n    these are separated by a colon followed by a single blank.\n\n    The grammar for field-specifier is::\n\n      field-specifier:\n          field\n          field-specifier.field\n\n      field:\n          identifier\n          identifier.index\n\n    where identifier is a sequence of letters (upper or lower case),\n    underscores, and digits of which the first character must not be a digit,\n    and index is a sequence of digits.  No blank characters may occur in the\n    field-specifier.  The index is provided primarily for defining array\n    elements though it need not be used for that purpose.\n\n    Multiple record-valued keywords of the same name but differing values may\n    be present in a FITS header.  The field-specifier may be viewed as part of\n    the keyword name.\n\n    Some examples follow::\n\n      DP1     = 'NAXIS: 2'\n      DP1     = 'AXIS.1: 1'\n      DP1     = 'AXIS.2: 2'\n      DP1     = 'NAUX: 2'\n      DP1     = 'AUX.1.COEFF.0: 0'\n      DP1     = 'AUX.1.POWER.0: 1'\n      DP1     = 'AUX.1.COEFF.1: 0.00048828125'\n      DP1     = 'AUX.1.POWER.1: 1'\n\n  - As with standard header cards, the value of a record-valued keyword card\n    can be accessed using either the index of the card in a HDU's header or\n    via the keyword name.  When accessing using the keyword name, the user may\n    specify just the card keyword or the card keyword followed by a period\n    followed by the field-specifier.  Note that while the card keyword is case\n    insensitive, the field-specifier is not.  Thus, hdu['abc.def'],\n    hdu['ABC.def'], or hdu['aBc.def'] are all equivalent but hdu['ABC.DEF'] is\n    not.\n\n  - When accessed using the card index of the HDU's header the value returned\n    will be the entire string value of the card.  For example:\n\n      >>> print hdr[10]\n      NAXIS: 2\n      >>> print hdr[11]\n      AXIS.1: 1\n\n  - When accessed using the keyword name exclusive of the field-specifier, the\n    entire string value of the header card with the lowest index having that\n    keyword name will be returned.  For example:\n\n      >>> print hdr['DP1']\n      NAXIS: 2\n\n  - When accessing using the keyword name and the field-specifier, the value\n    returned will be the floating point value associated with the\n    record-valued keyword card.  For example:\n\n      >>> print hdr['DP1.NAXIS']\n      2.0\n\n  - Any attempt to access a non-existent record-valued keyword card value will\n    cause an exception to be raised (IndexError exception for index access or\n    KeyError for keyword name access).\n\n  - Updating the value of a record-valued keyword card can also be\n    accomplished using either index or keyword name.  For example:\n\n      >>> print hdr['DP1.NAXIS']\n      2.0\n      >>> hdr['DP1.NAXIS'] = 3.0\n      >>> print hdr['DP1.NAXIS']\n      3.0\n\n  - Adding a new record-valued keyword card to an existing header is\n    accomplished using the Header.update() method just like any other card.\n    For example:\n\n      >>> hdr.update('DP1', 'AXIS.3: 1', 'a comment', after='DP1.AXIS.2')\n\n  - Deleting a record-valued keyword card from an existing header is\n    accomplished using the standard list deletion syntax just like any other\n    card.  For example:\n\n      >>> del hdr['DP1.AXIS.1']\n\n  - In addition to accessing record-valued keyword cards individually using a\n    card index or keyword name, cards can be accessed in groups using a set of\n    special pattern matching keys.  This access is made available via the\n    standard list indexing operator providing a keyword name string that\n    contains one or more of the special pattern matching keys.  Instead of\n    returning a value, a CardList object will be returned containing shared\n    instances of the Cards in the header that match the given keyword\n    specification.\n\n  - There are three special pattern matching keys.  The first key '*' will\n    match any string of zero or more characters within the current level of\n    the field-specifier.  The second key '?' will match a single character.\n    The third key '...' must appear at the end of the keyword name string and\n    will match all keywords that match the preceding pattern down all levels\n    of the field-specifier.  All combinations of ?, \\*, and ... are permitted\n    (though ... is only permitted at the end).  Some examples follow:\n\n      >>> cl=hdr['DP1.AXIS.*']\n      >>> print cl\n      DP1     = 'AXIS.1: 1'\n      DP1     = 'AXIS.2: 2'\n      >>> cl=hdr['DP1.*']\n      >>> print cl\n      DP1     = 'NAXIS: 2'\n      DP1     = 'NAUX: 2'\n      >>> cl=hdr['DP1.AUX...']\n      >>> print cl\n      DP1     = 'AUX.1.COEFF.0: 0'\n      DP1     = 'AUX.1.POWER.0: 1'\n      DP1     = 'AUX.1.COEFF.1: 0.00048828125'\n      DP1     = 'AUX.1.POWER.1: 1'\n      >>> cl=hdr['DP?.NAXIS']\n      >>> print cl\n      DP1     = 'NAXIS: 2'\n      DP2     = 'NAXIS: 2'\n      DP3     = 'NAXIS: 2'\n      >>> cl=hdr['DP1.A*S.*']\n      >>> print cl\n      DP1     = 'AXIS.1: 1'\n      DP1     = 'AXIS.2: 2'\n\n  - The use of the special pattern matching keys for adding or updating header\n    cards in an existing header is not allowed.  However, the deletion of\n    cards from the header using the special keys is allowed.  For example:\n\n      >>> del hdr['DP3.A*...']\n\n- As noted above, accessing pyfits Header object using the special pattern\n  matching keys will return a CardList object.  This CardList object can\n  itself be searched in order to further refine the list of Cards.  For\n  example:\n\n      >>> cl=hdr['DP1...']\n      >>> print cl\n      DP1     = 'NAXIS: 2'\n      DP1     = 'AXIS.1: 1'\n      DP1     = 'AXIS.2: 2'\n      DP1     = 'NAUX: 2'\n      DP1     = 'AUX.1.COEFF.1: 0.000488'\n      DP1     = 'AUX.2.COEFF.2: 0.00097656'\n      >>> cl1=cl['*.*AUX...']\n      >>> print cl1\n      DP1     = 'NAUX: 2'\n      DP1     = 'AUX.1.COEFF.1: 0.000488'\n      DP1     = 'AUX.2.COEFF.2: 0.00097656'\n\n  - The CardList keys() method will allow the retrieval of all of the key\n    values in the CardList.  For example:\n\n      >>> cl=hdr['DP1.AXIS.*']\n      >>> print cl\n      DP1     = 'AXIS.1: 1'\n      DP1     = 'AXIS.2: 2'\n      >>> cl.keys()\n      ['DP1.AXIS.1', 'DP1.AXIS.2']\n\n  - The CardList values() method will allow the retrieval of all of the values\n    in the CardList.  For example:\n\n      >>> cl=hdr['DP1.AXIS.*']\n      >>> print cl\n      DP1     = 'AXIS.1: 1'\n      DP1     = 'AXIS.2: 2'\n      >>> cl.values()\n      [1.0, 2.0]\n\n  - Individual cards can be retrieved from the list using standard list\n    indexing.  For example:\n\n      >>> cl=hdr['DP1.AXIS.*']\n      >>> c=cl[0]\n      >>> print c\n      DP1     = 'AXIS.1: 1'\n      >>> c=cl['DP1.AXIS.2']\n      >>> print c\n      DP1     = 'AXIS.2: 2'\n\n  - Individual card values can be retrieved from the list using the value\n    attribute of the card.  For example:\n\n      >>> cl=hdr['DP1.AXIS.*']\n      >>> cl[0].value\n      1.0\n\n  - The cards in the CardList are shared instances of the cards in the source\n    header.  Therefore, modifying a card in the CardList also modifies it in\n    the source header.  However, making an addition or a deletion to the\n    CardList will not affect the source header.  For example:\n\n      >>> hdr['DP1.AXIS.1']\n      1.0\n      >>> cl=hdr['DP1.AXIS.*']\n      >>> cl[0].value = 4.0\n      >>> hdr['DP1.AXIS.1']\n      4.0\n      >>> del cl[0]\n      >>> print cl['DP1.AXIS.1']\n      Traceback (most recent call last):\n      ...\n      KeyError: \"Keyword 'DP1.AXIS.1' not found.\"\n      >>> hdr['DP1.AXIS.1']\n      4.0\n\n  - A FITS header consists of card images.  In pyfits each card image is\n    manifested by a Card object.  A pyfits Header object contains a list of\n    Card objects in the form of a CardList object.  A record-valued keyword\n    card image is represented in pyfits by a RecordValuedKeywordCard object.\n    This object inherits from a Card object and has all of the methods and\n    attributes of a Card object.\n\n  - A new RecordValuedKeywordCard object is created with the\n    RecordValuedKeywordCard constructor: RecordValuedKeywordCard(key, value,\n    comment).  The key and value arguments may be specified in two ways.  The\n    key value may be given as the 8 character keyword only, in which case the\n    value must be a character string containing the field-specifier, a colon\n    followed by a space, followed by the actual value.  The second option is\n    to provide the key as a string containing the keyword and field-specifier,\n    in which case the value must be the actual floating point value.  For\n    example:\n\n      >>> c1 = pyfits.RecordValuedKeywordCard('DP1', 'NAXIS: 2', 'Number of variables')\n      >>> c2 = pyfits.RecordValuedKeywordCard('DP1.AXIS.1', 1.0, 'Axis number')\n\n  - RecordValuedKeywordCards have attributes .key, .field_specifier, .value,\n    and .comment.  Both .value and .comment can be changed but not .key or\n    .field_specifier.  The constructor will extract the field-specifier from\n    the input key or value, whichever is appropriate.  The .key attribute is\n    the 8 character keyword.\n\n  - Just like standard Cards, a RecordValuedKeywordCard may be constructed\n    from a string using the fromstring() method or verified using the verify()\n    method.  For example:\n\n      >>> c1 = pyfits.RecordValuedKeywordCard().fromstring(\n               \"DP1     = 'NAXIS: 2' / Number of independent variables\")\n      >>> c2 = pyfits.RecordValuedKeywordCard().fromstring(\n               \"DP1     = 'AXIS.1: X' / Axis number\")\n      >>> print c1; print c2\n      DP1     = 'NAXIS: 2' / Number of independent variables\n      DP1     = 'AXIS.1: X' / Axis number\n      >>> c2.verify()\n      Output verification result:\n      Card image is not FITS standard (unparsable value string).\n\n  - A standard card that meets the criteria of a RecordValuedKeywordCard may\n    be turned into a RecordValuedKeywordCard using the class method coerce.\n    If the card object does not meet the required criteria then the original\n    card object is just returned.\n\n      >>> c1 = pyfits.Card('DP1','AUX: 1','comment')\n      >>> c2 = pyfits.RecordValuedKeywordCard.coerce(c1)\n      >>> print type(c2)\n      <'pyfits.NP_pyfits.RecordValuedKeywordCard'>\n\n  - Two other card creation methods are also available as\n    RecordVauedKeywordCard class methods.  These are createCard() which will\n    create the appropriate card object (Card or RecordValuedKeywordCard) given\n    input key, value, and comment, and createCardFromString which will create\n    the appropriate card object given an input string.  These two methods are\n    also available as convenience functions:\n\n      >>> c1 = pyfits.RecordValuedKeywordCard.createCard('DP1','AUX: 1','comment')\n\n    or\n\n      >>> c1 = pyfits.createCard('DP1','AUX: 1','comment')\n      >>> print type(c1)\n      <'pyfits.NP_pyfits.RecordValuedKeywordCard'>\n\n      >>> c1 = pyfits.RecordValuedKeywordCard.createCard('DP1','AUX 1','comment')\n\n    or\n\n      >>> c1 = pyfits.createCard('DP1','AUX 1','comment')\n      >>> print type(c1)\n      <'pyfits.NP_pyfits.Card'>\n\n      >>> c1 = pyfits.RecordValuedKeywordCard.createCardFromString \\\n               (\"DP1 = 'AUX: 1.0' / comment\")\n\n    or\n\n      >>> c1 = pyfits.createCardFromString(\"DP1     = 'AUX: 1.0' / comment\")\n      >>> print type(c1)\n      <'pyfits.NP_pyfits.RecordValuedKeywordCard'>\n\nThe following bugs were fixed:\n\n- Corrected a bug that occurs when writing a HDU out to a file.  During the\n  write, any Keyboard Interrupts are trapped so that the write completes\n  before the interrupt is handled.  Unfortunately, the Keyboard Interrupt was\n  not properly reinstated after the write completed.  This was fixed.\n  (CNSHD711138)\n\n- Corrected a bug when using ipython, where temporary files created with the\n  tempFile.NamedTemporaryFile method are not automatically removed.  This can\n  happen for instance when opening a Gzipped fits file or when open a fits\n  file over the internet.  The files will now be removed.  (CNSHD718307)\n\n- Corrected a bug in the append convenience function's call to the writeto\n  convenience function.  The classExtensions argument must be passed as a\n  keyword argument.\n\n- Corrected a bug that occurs when retrieving variable length character arrays\n  from binary table HDUs (PA() format) and using slicing to obtain rows of\n  data containing variable length arrays.  The code issued a TypeError\n  exception.  The data can now be accessed with no exceptions. (CNSHD718749)\n\n- Corrected a bug that occurs when retrieving data from a fits file opened in\n  memory map mode when the file contains multiple image extensions or ASCII\n  table or binary table HDUs.  The code issued a TypeError exception.  The\n  data can now be accessed with no exceptions.  (CNSHD707426)\n\n- Corrected a bug that occurs when attempting to get a subset of data from a\n  Binary Table HDU and then use the data to create a new Binary Table HDU\n  object.  A TypeError exception was raised.  The data can now be subsetted\n  and used to create a new HDU.  (CNSHD723761)\n\n- Corrected a bug that occurs when attempting to scale an Image HDU back to\n  its original data type using the _ImageBaseHDU.scale method.  The code was\n  not resetting the BITPIX header card back to the original data type.  This\n  has been corrected.\n\n- Changed the code to issue a KeyError exception instead of a NameError\n  exception when accessing a non-existent field in a table.\n\n\n1.3 (2008-02-22)\n==================\n\nUpdates described in this release are only supported in the NUMPY version of\npyfits.\n\nThe following enhancements were made:\n\n- Provided support for a new extension to pyfits called *stpyfits*.\n\n  - The *stpyfits* module is a wrapper around pyfits.  It provides all of the\n    features and functions of pyfits along with some STScI specific features.\n    Currently, the only new feature supported by stpyfits is the ability to\n    read and write fits files that contain image data quality extensions with\n    constant data value arrays.  See stpyfits `[2]`_ for more details on\n    stpyfits.\n\n- Added a new feature to allow trailing HDUs to be deleted from a fits file\n  without actually reading the data from the file.\n\n  - This supports a JWST requirement to delete a trailing HDU from a file\n    whose primary Image HDU is too large to be read on a 32 bit machine.\n\n- Updated pyfits to use the warnings module to issue warnings.  All warnings\n  will still be issued to stdout, exactly as they were before, however, you\n  may now suppress warnings with the -Wignore command line option.  For\n  example, to run a script that will ignore warnings use the following command\n  line syntax:\n\n    python -Wignore yourscript.py\n\n- Updated the open convenience function to allow the input of an already\n  opened file object in place of a file name when opening a fits file.\n\n- Updated the writeto convenience function to allow it to accept the\n  output_verify option.\n\n  - In this way, the user can use the argument output_verify='fix' to allow\n    pyfits to correct any errors it encounters in the provided header before\n    writing the data to the file.\n\n- Updated the verification code to provide additional detail with a\n  VerifyError exception.\n\n- Added the capability to create a binary table HDU directly from a\n  numpy.ndarray.  This may be done using either the new_table convenience\n  function or the BinTableHDU constructor.\n\n\nThe following performance improvements were made:\n\n- Modified the import logic to dramatically decrease the time it takes to\n  import pyfits.\n\n- Modified the code to provide performance improvements when copying and\n  examining header cards.\n\nThe following bugs were fixed:\n\n- Corrected a bug that occurs when reading the data from a fits file that\n  includes BZERO/BSCALE scaling.  When the data is read in from the file,\n  pyfits automatically scales the data using the BZERO/BSCALE values in the\n  header.  In the previous release, pyfits created a 32 bit floating point\n  array to hold the scaled data.  This could cause a problem when the value of\n  BZERO is so large that the scaled value will not fit into the float 32.  For\n  this release, when the input data is 32 bit integer, a 64 bit floating point\n  array is used for the scaled data.\n\n- Corrected a bug that caused an exception to be raised when attempting to\n  scale image data using the ImageHDU.scale method.\n\n- Corrected a bug in the new_table convenience function that occurred when a\n  binary table was created using a ColDefs object as input and supplying an\n  nrows argument for a number of rows that is greater than the number of rows\n  present in the input ColDefs object.  The previous version of pyfits failed\n  to allocate the necessary memory for the additional rows.\n\n- Corrected a bug in the new_table convenience function that caused an\n  exception to be thrown when creating an ASCII table.\n\n- Corrected a bug in the new_table convenience function that will allow the\n  input of a ColDefs object that was read from a file as a binary table with a\n  data value equal to None.\n\n- Corrected a bug in the construction of ASCII tables from Column objects that\n  are created with noncontinuous start columns.\n\n- Corrected bugs in a number of areas that would sometimes cause a failure to\n  improperly raise an exception when an error occurred.\n\n- Corrected a bug where attempting to open a non-existent fits file on a\n  windows platform using a drive letter in the file specification caused a\n  misleading IOError exception to be raised.\n\n.. _[2]: https://stscitools.readthedocs.io/en/latest/stpyfits.html\n\n\n1.1 (2007-06-15)\n==================\n\n- Modified to use either NUMPY or NUMARRAY.\n\n- New file writing modes have been provided to allow streaming data to\n  extensions without requiring the whole output extension image in memory. See\n  documentation on StreamingHDU.\n\n- Improvements to minimize byteswapping and memory usage by byteswapping in\n  place.\n\n- Now supports ':' characters in filenames.\n\n- Handles keyboard interrupts during long operations.\n\n- Preserves the byte order of the input image arrays.\n\n\n1.0.1 (2006-03-24)\n====================\n\nThe changes to PyFITS were primarily to improve the docstrings and to\nreclassify some public functions and variables as private. Readgeis and\nfitsdiff which were distributed with PyFITS in previous releases were moved to\npytools. This release of PyFITS is v1.0.1. The next release of PyFITS will\nsupport both numarray and numpy (and will be available separately from\nstsci_python, as are all the python packages contained within stsci_python).\nAn alpha release for PyFITS numpy support will be made around the time of this\nstsci_python release.\n\n- Updated docstrings for public functions.\n\n- Made some previously public functions private.\n\n\n1.0 (2005-11-01)\n==================\n\nMajor Changes since v0.9.6:\n\n- Added support for the HIERARCH convention\n\n- Added support for iteration and slicing for HDU lists\n\n- PyFITS now uses the standard setup.py installation script\n\n- Add utility functions at the module level, they include:\n\n  - getheader\n  - getdata\n  - getval\n  - writeto\n  - append\n  - update\n  - info\n\nMinor changes since v0.9.6:\n\n- Fix a bug to make single-column ASCII table work.\n\n- Fix a bug so a new table constructed from an existing table with X-formatted\n  columns will work.\n\n- Fix a problem in verifying HDUList right after the open statement.\n\n- Verify that elements in an HDUList, besides the first one, are ExtensionHDU.\n\n- Add output verification in methods flush() and close().\n\n- Modify the design of the open() function to remove the output_verify\n  argument.\n\n- Remove the groups argument in GroupsHDU's constructor.\n\n- Redesign the column definition class to make its column components more\n  accessible.  Also to make it conducive for higher level functionalities,\n  e.g. combining two column definitions.\n\n- Replace the Boolean class with the Python Boolean type.  The old TRUE/FALSE\n  will still work.\n\n- Convert classes to the new style.\n\n- Better format when printing card or card list.\n\n- Add the optional argument clobber to all writeto() functions and methods.\n\n- If adding a blank card, will not use existing blank card's space.\n\nPyFITS Version 1.0 REQUIRES Python 2.3 or later.\n\n\n0.9.6 (2004-11-11)\n====================\n\nMajor changes since v0.9.3:\n\n- Support for variable length array tables.\n\n- Support for writing ASCII table extensions.\n\n- Support for random groups, both reading and writing.\n\nSome minor changes:\n\n- Support for numbers with leading zeros in an ASCII table extension.\n\n- Changed scaled columns' data type from Float32 to Float64 to preserve\n  precision.\n\n- Made Column constructor more flexible in accepting format specification.\n\n\n0.9.3 (2004-07-02)\n====================\n\nChanges since v0.9.0:\n\n- Lazy instantiation of full Headers/Cards for all HDU's when the file is\n  opened.  At the open, only extracts vital info (e.g. NAXIS's) from the\n  header parts.  This change will speed up the performance if the user only\n  needs to access one extension in a multi-extension FITS file.\n\n- Support the X format (bit flags) columns, both reading and writing, in a\n  binary table.  At the user interface, they are converted to Boolean arrays\n  for easy manipulation.  For example, if the column's TFORM is \"11X\",\n  internally the data is stored in 2 bytes, but the user will see, at each row\n  of this column, a Boolean array of 11 elements.\n\n- Fix a bug such that when a table extension has no data, it will not try to\n  scale the data when updating/writing the HDU list.\n\n\n0.9 (2004-04-27)\n==================\n\nChanges since v0.8.0:\n\n- Rewriting of the Card class to separate the parsing and verification of\n  header cards\n\n- Restructure the keyword indexing scheme which speed up certain applications\n  (update large number of new keywords and reading a header with larger\n  numbers of cards) by a factor of 30 or more\n\n- Change the default to be lenient FITS standard checking on input and strict\n  FITS standard checking on output\n\n- Support CONTINUE cards, both reading and writing\n\n- Verification can now be performed at any of the HDUList, HDU, and Card\n  levels\n\n- Support (contiguous) subsection (attribute .section) of images to reduce\n  memory usage for large images\n\n\n0.8.0 (2003-08-19)\n====================\n\n**NOTE:** This version will only work with numarray Version 0.6.  In addition,\nearlier versions of PyFITS will not work with numarray 0.6.  Therefore, both\nmust be updated simultaneously.\n\nChanges since 0.7.6:\n\n- Compatible with numarray 0.6/records 2.0\n\n- For binary tables, now it is possible to update the original array if a\n  scaled field is updated.\n\n- Support of complex columns\n\n- Modify the __getitem__ method in FITS_rec.  In order to make sure the scaled\n  quantities are also viewing the same data as the original FITS_rec, all\n  fields need to be \"touched\" when __getitem__ is called.\n\n- Add a new attribute mmobject for HDUList, and close the memmap object when\n  close HDUList object.  Earlier version does not close memmap object and can\n  cause memory lockup.\n\n- Enable 'update' as a legitimate memmap mode.\n\n- Do not print message when closing an HDUList object which is not created\n  from reading a FITS file.  Such message is confusing.\n\n- remove the internal attribute \"closed\" and related method (__getattr__ in\n  HDUList).  It is redundant.\n\n\n0.7.6 (2002-11-22)\n\n**NOTE:** This version will only work with numarray Version 0.4.\n\nChanges since 0.7.5:\n\n- Change x*=n to numarray.multiply(x, n, x) where n is a floating number, in\n  order to make pyfits to work under Python 2.2. (2 occurrences)\n\n- Modify the \"update\" method in the Header class to use the \"fixed-format\"\n  card even if the card already exists.  This is to avoid the misalignment as\n  shown below:\n\n  After running drizzle on ACS images it creates a CD matrix whose elements\n  have very many digits, *e.g.*:\n\n    CD1_1   =  1.1187596304411E-05 / partial of first axis coordinate w.r.t. x\n    CD1_2   = -8.502767249350019E-06 / partial of first axis coordinate w.r.t. y\n\n  with pyfits, an \"update\" on these header items and write in new values which\n  has fewer digits, *e.g.*:\n\n    CD1_1   =        1.0963011E-05 / partial of first axis coordinate w.r.t. x\n    CD1_2   =          -8.527229E-06 / partial of first axis coordinate w.r.t. y\n\n- Change some internal variables to make their appearance more consistent:\n\n    old name                new name\n\n    __octalRegex            _octalRegex\n    __readblock()           _readblock()\n    __formatter()           _formatter().\n    __value_RE              _value_RE\n    __numr                  _numr\n    __comment_RE            _comment_RE\n    __keywd_RE              _keywd_RE\n    __number_RE             _number_RE.\n    tmpName()               _tmpName()\n    dimShape                _dimShape\n    ErrList                 _ErrList\n\n- Move up the module description.  Move the copyright statement to the bottom\n  and assign to the variable __credits__.\n\n- change the following line:\n\n    self.__dict__ = input.__dict__\n\n  to\n\n    self.__setstate__(input.__getstate__())\n\n  in order for pyfits to run under numarray 0.4.\n\n- edit _readblock to add the (optional) firstblock argument and raise IOError\n  if the first 8 characters in the first block is not 'SIMPLE  ' or\n  'XTENSION'.  Edit the function open to check for IOError to skip the last\n  null filled block(s).  Edit readHDU to add the firstblock argument.\n\n\n0.7.5 (2002-08-16)\n====================\n\nChanges since v0.7.3:\n\n- Memory mapping now works for readonly mode, both for images and binary\n  tables.\n\n  Usage:  pyfits.open('filename', memmap=1)\n\n- Edit the field method in FITS_rec class to make the column scaling for\n  numbers use less temporary memory.  (does not work under 2.2, due to Python\n  \"bug\" of array \\*=)\n\n- Delete bscale/bzero in the ImageBaseHDU constructor.\n\n- Update bitpix in BaseImageHDU.__getattr__  after deleting bscale/bzero. (bug\n  fix)\n\n- In BaseImageHDU.__getattr__  point self.data to raw_data if float and if not\n  memmap.  (bug fix).\n\n- Change the function get_tbdata() to private: _get_tbdata().\n\n\n0.7.3 (2002-07-12)\n====================\n\nChanges since v0.7.2:\n\n- It will scale all integer image data to Float32, if BSCALE/BZERO != 1/0.  It\n  will also expunge the BSCALE/BZERO keywords.\n\n- Add the scale() method for ImageBaseHDU, so data can be scaled just before\n  being written to the file.  It has the following arguments:\n\n  type: destination data type (string), e.g. Int32, Float32, UInt8, etc.\n\n  option: scaling scheme. if 'old', use the old BSCALE/BZERO values.  if\n  'minmax', use the data range to fit into the full range of specified integer\n  type.  Float destination data type will not be scaled for this option.\n\n  bscale/bzero: user specifiable BSCALE/BZERO values.  They overwrite the\n  \"option\".\n\n- Deal with data area resizing in 'update' mode.\n\n- Make the data scaling (both input and output) faster and use less memory.\n\n- Bug fix to make column name change takes effect for field.\n\n- Bug fix to avoid exception if the key is not present in the header already.\n  This affects (fixes) add_history(), add_comment(), and add_blank().\n\n- Bug fix in __getattr__() in Card class.  The change made in 0.7.2 to rstrip\n  the comment must be string type to avoid exception.\n\n0.7.2.1 (2002-06-25)\n======================\n\nA couple of bugs were addressed in this version.\n\n- Fix a bug in _add_commentary(). Due to a change in index_of() during version\n  0.6.5.5, _add_commentary needs to be modified to avoid exception if the key\n  is not present in the header already. This affects (fixes) add_history(),\n  add_comment(), and add_blank().\n\n- Fix a bug in __getattr__() in Card class. The change made in 0.7.2 to rstrip\n  the comment must be string type to avoid exception.\n\n\n0.7.2 (2002-06-19)\n====================\n\nThe two major improvements from Version 0.6.2 are:\n\n- support reading tables  with \"scaled\" columns (e.g.  tscal/tzero, Boolean,\n  and ASCII tables)\n\n- a prototype output verification.\n\nThis version of PyFITS requires numarray version 0.3.4.\n\nOther changes include:\n\n- Implement the new HDU hierarchy proposed earlier this year.  This in turn\n  reduces some of the redundant methods common to several HDU classes.\n\n- Add 3 new methods to the Header class: add_history, add_comment, and\n  add_blank.\n\n- The table attributes _columns are now .columns and the attributes in ColDefs\n  are now all without the underscores.  So, a user can get a list of column\n  names by: hdu.columns.names.\n\n- The \"fill\" argument in the new_table method now has a new meaning:<br> If\n  set to true (=1), it will fill the entire new table with zeros/blanks.\n  Otherwise (=0), just the extra rows/cells are filled with zeros/blanks.\n  Fill values other than zero/blank are now not possible.\n\n- Add the argument output_verify to the open method and writeto method.  Not\n  in the flush or close methods yet, due to possible complication.\n\n- A new copy method for tables, the copy is totally independent from the table\n  it copies from.\n\n- The tostring() call in writeHDUdata takes up extra space to store the string\n  object.  Use tofile() instead, to save space.\n\n- Make changes from _byteswap to _byteorder, following corresponding changes\n  in numarray and recarray.\n\n- Insert(update) EXTEND in PrimaryHDU only when header is None.\n\n- Strip the trailing blanks for the comment value of a card.\n\n- Add seek(0) right after the __buildin__.open(0), because for the 'ab+' mode,\n  the pointer is at the end after open in Linux, but it is at the beginning in\n  Solaris.\n\n- Add checking of data against header, update header keywords (NAXIS's,\n  BITPIX) when they don't agree with the data.\n\n- change version to __version__.\n\nThere are also many other minor internal bug fixes and\ntechnical changes.\n\n\n0.6.2 (2002-02-12)\n====================\n\nThis version requires numarray version 0.2.\n\nThings not yet supported but are part of future development:\n\n- Verification and/or correction of FITS objects being written to disk so that\n  they are legal FITS. This is being added now and should be available in\n  about a month.  Currently, one may construct FITS headers that are\n  inconsistent with the data and write such FITS objects to disk. Future\n  versions will provide options to either a) correct discrepancies and warn,\n  b) correct discrepancies silently, c) throw a Python exception, or d) write\n  illegal FITS (for test purposes!).\n\n- Support for ascii tables or random groups format. Support for ASCII tables\n  will be done soon (~1 month). When random group support is added is\n  uncertain.\n\n- Support for memory mapping FITS data (to reduce memory demands). We expect\n  to provide this capability in about 3 months.\n\n- Support for columns in binary tables having scaled values (e.g. BSCALE or\n  BZERO) or boolean values. Currently booleans are stored as Int8 arrays and\n  users must explicitly convert them into a boolean array. Likewise, scaled\n  columns must be copied with scaling and offset by testing for those\n  attributes explicitly. Future versions will produce such copies\n  automatically.\n\n- Support for tables with TNULL values. This awaits an enhancement to numarray\n  to support mask arrays (planned).  (At least a couple of months off).\n\n.. _PyFITS: https://github.com/spacetelescope/pyfits\n"},{"id":87,"name":"docs/io/ascii","nodeType":"Package"},{"id":88,"name":"read.rst","nodeType":"TextFile","path":"docs/io/ascii","text":".. include:: references.txt\n\n.. _astropy.io.ascii_read:\n\nReading Tables\n**************\n\nThe majority of commonly encountered ASCII tables can be read with the |read|\nfunction::\n\n  >>> from astropy.io import ascii\n  >>> data = ascii.read(table)  # doctest: +SKIP\n\nHere ``table`` is the name of a file, a string representation of a table, or a\nlist of table lines. The return value (``data`` in this case) is a :ref:`Table\n<astropy-table>` object.\n\nBy default, |read| will try to `guess the table format <#guess-table-format>`_\nby trying all of the supported formats.\n\n.. Warning::\n\n   Guessing the file format is often slow for large files because the reader\n   tries parsing the file with every allowed format until one succeeds.\n   For large files it is recommended to disable guessing with ``guess=False``.\n\n..\n  EXAMPLE START\n  Reading ASCII Tables Using astropy.io.ascii\n\nFor unusually formatted tables where guessing does not work, give additional\nhints about the format::\n\n   >>> lines = ['objID                   & osrcid            & xsrcid       ',\n   ...          '----------------------- & ----------------- & -------------',\n   ...          '              277955213 & S000.7044P00.7513 & XS04861B6_005',\n   ...          '              889974380 & S002.9051P14.7003 & XS03957B7_004']\n   >>> data = ascii.read(lines, data_start=2, delimiter='&')\n   >>> print(data)\n     objID         osrcid          xsrcid\n   --------- ----------------- -------------\n   277955213 S000.7044P00.7513 XS04861B6_005\n   889974380 S002.9051P14.7003 XS03957B7_004\n\nOther examples are as follows::\n\n   >>> data = astropy.io.ascii.read('data/nls1_stackinfo.dbout', data_start=2, delimiter='|')  # doctest: +SKIP\n   >>> data = astropy.io.ascii.read('data/simple.txt', quotechar=\"'\")  # doctest: +SKIP\n   >>> data = astropy.io.ascii.read('data/simple4.txt', format='no_header', delimiter='|')  # doctest: +SKIP\n   >>> data = astropy.io.ascii.read('data/tab_and_space.txt', delimiter=r'\\s')  # doctest: +SKIP\n\nIf the format of a file is known (e.g., it is a fixed-width table or an IPAC\ntable), then it is more efficient and reliable to provide a value for the\n``format`` argument from one of the values in the :ref:`supported_formats`. For\nexample::\n\n   >>> data = ascii.read(lines, format='fixed_width_two_line', delimiter='&')\n\nSee the :ref:`guess_formats` section for additional details on format guessing.\n\n..\n  EXAMPLE END\n\nFor simpler formats such as CSV, |read| will automatically try reading with the\nCython/C parsing engine, which is significantly faster than the ordinary Python\nimplementation (described in :ref:`fast_ascii_io`). If the fast engine fails,\n|read| will fall back on the Python reader by default. The argument\n``fast_reader`` can be specified to control this behavior. For example, to\ndisable the fast engine::\n\n   >>> data = ascii.read(lines, format='csv', fast_reader=False)\n\nFor reading very large tables see the section on :ref:`chunk_reading` or\nuse `pandas <https://pandas.pydata.org/>`_ (see Note below).\n\n.. Note::\n\n   Reading a table which contains unicode characters is supported with the\n   pure Python readers by specifying the ``encoding`` parameter. The fast\n   C-readers do not support unicode. For large data files containing unicode,\n   we recommend reading the file using `pandas <https://pandas.pydata.org/>`_\n   and converting to a :ref:`Table <astropy-table>` via the :ref:`Table -\n   Pandas interface <pandas>`.\n\nThe |read| function accepts a number of parameters that specify the detailed\ntable format. Different formats can define different defaults, so the\ndescriptions below sometimes mention \"typical\" default values. This refers to\nthe :class:`~astropy.io.ascii.Basic` format reader and other similar character-separated formats.\n\n.. _io_ascii_read_parameters:\n\nParameters for ``read()``\n=========================\n\n**table** : input table\n  There are four ways to specify the table to be read:\n\n  - Path to a file (string)\n  - Single string containing all table lines separated by newlines\n  - File-like object with a callable read() method\n  - List of strings where each list element is a table line\n\n  The first two options are distinguished by the presence of a newline in the\n  string. This assumes that valid file names will not normally contain a\n  newline, and a valid table input will at least contain two rows.\n  Note that a table read in ``no_header`` format can legitimately consist\n  of a single row; in this case passing the string as a list with a single\n  item will ensure that it is not interpreted as a file name.\n\n**format** : file format (default='basic')\n  This specifies the top-level format of the ASCII table; for example,\n  if it is a basic character delimited table, fixed format table, or\n  a CDS-compatible table, etc. The value of this parameter must\n  be one of the :ref:`supported_formats`.\n\n**guess** : try to guess table format (default=None)\n  If set to True, then |read| will try to guess the table format by cycling\n  through a number of possible table format permutations and attempting to read\n  the table in each case. See the `Guess table format`_ section for further details.\n\n**delimiter** : column delimiter string\n  A one-character string used to separate fields which typically defaults to\n  the space character. Other common values might be \"\\\\s\" (whitespace), \",\" or\n  \"|\" or \"\\\\t\" (tab). A value of \"\\\\s\" allows any combination of the tab and\n  space characters to delimit columns.\n\n**comment** : regular expression defining a comment line in table\n  If the ``comment`` regular expression matches the beginning of a table line\n  then that line will be discarded from header or data processing.  For the\n  ``basic`` format this defaults to \"\\\\s*#\" (any whitespace followed by #).\n\n**quotechar** : one-character string to quote fields containing special characters\n  This specifies the quote character and will typically be either the single or\n  double quote character. This is can be useful for reading text fields with\n  spaces in a space-delimited table. The default is typically the double quote.\n\n**header_start** : line index for the header line\n  This includes only significant non-comment lines and counting starts at 0. If\n  set to None this indicates that there is no header line and the column names\n  will be auto-generated. See `Specifying header and data location`_ for more\n  details.\n\n**data_start** : line index for the start of data counting\n  This includes only significant non-comment lines and counting starts at 0.\n  See `Specifying header and data location`_ for more details.\n\n**data_end** : line index for the end of data\n  This includes only significant non-comment lines and can be negative to count\n  from end. See `Specifying header and data location`_ for more details.\n\n**encoding**: encoding to read the file (``default=None``)\n  When `None` use `locale.getpreferredencoding` as an encoding. This matches\n  the default behavior of the built-in `open` when no ``mode`` argument is\n  provided.\n\n**converters** : ``dict`` of data type converters\n  See the `Converters`_ section for more information.\n\n**names** : list of names corresponding to each data column\n  Define the complete list of names for each data column. This will override\n  names found in the header (if it exists). If not supplied then\n  use names from the header or auto-generated names if there is no header.\n\n**include_names** : list of names to include in output\n  From the list of column names found from the header or the ``names``\n  parameter, select for output only columns within this list. If not supplied,\n  then include all names.\n\n**exclude_names** : list of names to exclude from output\n  Exclude these names from the list of output columns. This is applied *after*\n  the ``include_names`` filtering. If not specified then no columns are excluded.\n\n**fill_values** : list of fill value specifiers\n  Specify input table entries which should be masked in the output table\n  because they are bad or missing. See the `Bad or missing values`_ section\n  for more information and examples. The default is that any blank table\n  values are treated as missing.\n\n**fill_include_names** : list of column names affected by ``fill_values``\n  This is a list of column names (found from the header or the ``names``\n  parameter) for all columns where values will be filled. `None` (the default) will\n  apply ``fill_values`` to all columns.\n\n**fill_exclude_names** : list of column names not affected by ``fill_values``\n  This is a list of column names (found from the header or the ``names``\n  parameter) for all columns where values will be **not** be filled.\n  This parameter takes precedence over ``fill_include_names``.  A value\n  of `None` (default) does not exclude any columns.\n\n**Outputter** : Outputter class\n  This converts the raw data tables value into the\n  output object that gets returned by |read|. The default is\n  :class:`~astropy.io.ascii.TableOutputter`, which returns a\n  :class:`~astropy.table.Table` object (see :ref:`Data Tables <astropy-table>`).\n\n**Inputter** : Inputter class\n  This is generally not specified.\n\n**data_Splitter** : Splitter class to split data columns\n\n**header_Splitter** : Splitter class to split header columns\n\n**fast_reader** : whether to use the C engine\n  This can be ``True`` or ``False``, and also be a ``dict`` with options.\n  (see :ref:`fast_ascii_io`)\n\n**Reader** : Reader class (*deprecated* in favor of ``format``)\n  This specifies the top-level format of the ASCII table; for example,\n  if it is a basic character delimited table, fixed format table, or\n  a CDS-compatible table, etc. The value of this parameter must\n  be a Reader class. For basic usage this means one of the\n  built-in :ref:`extension_reader_classes`.\n\nSpecifying Header and Data Location\n===================================\n\nThe three parameters ``header_start``, ``data_start``, and ``data_end`` make it\npossible to read a table file that has extraneous non-table data included.\nThis is a case where you need to help out `astropy.io.ascii` and tell it where\nto find the header and data.\n\nWhen a file is processed into a header and data components, any blank lines\n(which might have whitespace characters) and commented lines (starting with the\ncomment character, typically ``#``) are stripped out *before* the header and\ndata parsing code sees the table content.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Specifying Header and Data Location for ASCII Tables\n\nTo use the parameters ``header_start``, ``data_start``, and ``data_end``\nto read a table with non-table data included, take the file below. The column\non the left is not part of the file but instead shows how `astropy.io.ascii` is\nviewing each line and the line count index.  ::\n\n  Index    Table content\n  ------ ----------------------------------------------------------------\n     -  | # This is the start of my data file\n     -  |\n     0  | Automatically generated by my_script.py at 2012-01-01T12:13:14\n     1  | Run parameters: None\n     2  | Column header line:\n     -  |\n     3  | x y z\n     -  |\n     4  | Data values section:\n     -  |\n     5  | 1 2 3\n     6  | 4 5 6\n     -  |\n     7  | Run completed at 2012:01-01T12:14:01\n\nIn this case you would have ``header_start=3``, ``data_start=5``, and\n``data_end=7``. The convention for ``data_end`` follows the normal Python\nslicing convention where to select data rows 5 and 6 you would do\n``rows[5:7]``. For ``data_end`` you can also supply a negative index to\ncount backward from the end, so ``data_end=-1`` (like ``rows[5:-1]``) would\nwork in this case.\n\n..\n  EXAMPLE END\n\n.. _replace_bad_or_missing_values:\n\nBad or Missing Values\n=====================\n\nASCII data tables can contain bad or missing values. A common case is when a\ntable contains blank entries with no available data.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  ASCII Tables with Bad or Missing Values\n\nTake this example of a table with blank entries::\n\n  >>> weather_data = \"\"\"\n  ...   day,precip,type\n  ...   Mon,1.5,rain\n  ...   Tues,,\n  ...   Wed,1.1,snow\n  ...   \"\"\"\n\nBy default, |read| will interpret blank entries as being bad/missing and output\na masked Table with those entries masked out by setting the corresponding mask\nvalue set to ``True``::\n\n  >>> dat = ascii.read(weather_data)\n  >>> print(dat)\n  day  precip type\n  ---- ------ ----\n   Mon    1.5 rain\n  Tues     --   --\n   Wed    1.1 snow\n\nIf you want to replace the masked (missing) values with particular values, set\nthe masked column ``fill_value`` attribute and then get the \"filled\" version of\nthe table. This looks like the following::\n\n  >>> dat['precip'].fill_value = -999\n  >>> dat['type'].fill_value = 'N/A'\n  >>> print(dat.filled())\n  day  precip type\n  ---- ------ ----\n   Mon    1.5 rain\n  Tues -999.0  N/A\n   Wed    1.1 snow\n\nASCII tables may have other indicators of bad or missing data as well. For\nexample, a table may contain string values that are not a valid representation\nof a number (e.g., ``\"...\"``), or a table may have special values like ``-999``\nthat are chosen to indicate missing data. The |read| function has a flexible\nsystem to accommodate these cases by marking specified character sequences in\nthe input data as \"missing data\" during the conversion process. Whenever\nmissing data is found the output will be a masked table.\n\nThis is done with the ``fill_values`` keyword argument, which can be set to a\nsingle missing-value specification ``<missing_spec>`` or a list of ``<missing_spec>`` tuples::\n\n  fill_values = <missing_spec> | [<missing_spec1>, <missing_spec2>, ...]\n  <missing_spec> = (<match_string>, '0', <optional col name 1>, <optional col name 2>, ...)\n\nWhen reading a table, the second element of a ``<missing_spec>`` should always\nbe the string ``'0'``, otherwise you may get unexpected behavior [#f1]_. By\ndefault, the ``<missing_spec>`` is applied to all columns unless column name\nstrings are supplied. An alternate way to limit the columns is via the\n``fill_include_names`` and ``fill_exclude_names`` keyword arguments in |read|.\n\nIn the example below we read back the weather table after filling the missing\nvalues in with typical placeholders::\n\n  >>> table = ['day   precip  type',\n  ...          ' Mon     1.5  rain',\n  ...          'Tues  -999.0   N/A',\n  ...          ' Wed     1.1  snow']\n  >>> t = ascii.read(table, fill_values=[('-999.0', '0', 'precip'), ('N/A', '0', 'type')])\n  >>> print(t)\n  day  precip type\n  ---- ------ ----\n   Mon    1.5 rain\n  Tues     --   --\n   Wed    1.1 snow\n\n.. note::\n\n   The default in |read| is ``fill_values=('','0')``. This marks blank entries as being\n   missing for any data type (int, float, or string). If ``fill_values`` is explicitly\n   set in the call to |read| then the default behavior of marking blank entries as missing\n   no longer applies. For instance setting ``fill_values=None`` will disable this\n   auto-masking without setting any other fill values. This can be useful for a string\n   column where one of values happens to be ``\"\"``.\n\n\n.. [#f1] The requirement to put the ``'0'`` there is the legacy of an old\n         interface which is maintained for backward compatibility and also to\n         match the format of ``fill_value`` for reading with the format of\n         ``fill_value`` used for writing tables. On reading, the second\n         element of the ``<missing_spec>`` tuple can actually be an arbitrary\n         string value which replaces occurrences of the ``<match_string>``\n         string in the input stream prior to type conversion. This ends up\n         being the value \"behind the mask\", which should never be directly\n         accessed. Only the value ``'0'`` is neutral when attempting to detect\n         the column data type and perform type conversion. For instance if you\n         used ``'nan'`` for the ``<match_string>`` value then integer columns\n         would wind up as float.\n\n..\n  EXAMPLE END\n\nSelecting columns for masking\n-----------------------------\nThe |read| function provides the parameters ``fill_include_names`` and ``fill_exclude_names``\nto select which columns will be used in the ``fill_values`` masking process described above.\n\n..\n  EXAMPLE START\n  Using the ``fill_include_names`` and ``fill_exclude_names`` parameters for ASCII tables\n\nThe use of these parameters is not common but in some cases can considerably simplify\nthe code required to read a table. The following gives a simple example to illustrate how\n``fill_include_names`` and ``fill_exclude_names`` can be used\nin the most basic and typical cases::\n\n  >>> from astropy.io import ascii\n  >>> lines = ['a,b,c,d', '1.0,2.0,3.0,4.0', ',,,']\n  >>> ascii.read(lines)\n  <Table length=2>\n     a       b       c       d\n  float64 float64 float64 float64\n  ------- ------- ------- -------\n      1.0     2.0     3.0     4.0\n       --      --      --      --\n\n  >>> ascii.read(lines, fill_include_names=['a', 'c'])\n  <Table length=2>\n     a     b      c     d\n  float64 str3 float64 str3\n  ------- ---- ------- ----\n      1.0  2.0     3.0  4.0\n       --           --\n\n  >>> ascii.read(lines, fill_exclude_names=['a', 'c'])\n  <Table length=2>\n   a      b     c      d\n  str3 float64 str3 float64\n  ---- ------- ---- -------\n   1.0     2.0  3.0     4.0\n            --           --\n\n..\n  EXAMPLE END\n\n.. _guess_formats:\n\nGuess Table Format\n==================\n\nIf the ``guess`` parameter in |read| is set to True, then\n|read| will try to guess the table format by cycling through a number of\npossible table format permutations and attempting to read the table in each\ncase. The first format which succeeds and will be used to read the table. To\nsucceed, the table must be successfully parsed by the Reader and satisfy the\nfollowing column requirements:\n\n * At least two table columns.\n * No column names are a float or int number.\n * No column names begin or end with space, comma, tab, single quote, double\n   quote, or a vertical bar (|).\n\nThese requirements reduce the chance for a false positive where a table is\nsuccessfully parsed with the wrong format. A common situation is a table\nwith numeric columns but no header row, and in this case `astropy.io.ascii` will\nauto-assign column names because of the restriction on column names that\nlook like a number.\n\nGuess Order\n-----------\n\nThe order of guessing is shown by this Python code, where ``Reader`` is the\nclass which actually implements reading the different file formats::\n\n  for Reader in (Ecsv, FixedWidthTwoLine, Rst, FastBasic, Basic,\n                 FastRdb, Rdb, FastTab, Tab, Cds, Daophot, SExtractor,\n                 Ipac, Latex, AASTex):\n      read(Reader=Reader)\n\n  for Reader in (CommentedHeader, FastBasic, Basic, FastNoHeader, NoHeader):\n      for delimiter in (\"|\", \",\", \" \", \"\\\\s\"):\n          for quotechar in ('\"', \"'\"):\n              read(Reader=Reader, delimiter=delimiter, quotechar=quotechar)\n\nNote that the :class:`~astropy.io.ascii.FixedWidth` derived-readers are not\nincluded in the default guess sequence (this causes problems), so to read such\ntables you must explicitly specify the format with the ``format`` keyword. Also\nnotice that formats compatible with the fast reading engine attempt to use the\nfast engine before the ordinary reading engine.\n\nIf none of the guesses succeed in reading the table (subject to the column\nrequirements), a final try is made using just the user-supplied parameters but\nwithout checking the column requirements. In this way, a table with only one\ncolumn or column names that look like a number can still be successfully read.\n\nThe guessing process respects any values of the Reader, delimiter, and\nquotechar parameters as well as options for the fast reader that were\nsupplied to the read() function. Any guesses that would conflict are\nskipped. For example, the call::\n\n >>> data = ascii.read(table, Reader=ascii.NoHeader, quotechar=\"'\")\n\nwould only try the four delimiter possibilities, skipping all the conflicting\nReader and quotechar combinations. Similarly, with any setting of\n``fast_reader`` that requires use of the fast engine, only the fast\nvariants in the Reader list above will be tried.\n\nDisabling\n---------\n\nGuessing can be disabled in two ways::\n\n  import astropy.io.ascii\n  data = astropy.io.ascii.read(table)               # guessing enabled by default\n  data = astropy.io.ascii.read(table, guess=False)  # disable for this call\n  astropy.io.ascii.set_guess(False)                 # set default to False globally\n  data = astropy.io.ascii.read(table)               # guessing disabled\n\nDebugging\n---------\n\nIn order to get more insight into the guessing process and possibly debug if\nsomething is not working as expected, use the\n`~astropy.io.ascii.get_read_trace()` function. This returns a traceback of the\nattempted read formats for the last call to `~astropy.io.ascii.read()`.\n\nComments and Metadata\n=====================\n\nAny comment lines detected during reading are inserted into the output table\nvia the ``comments`` key in the table's ``.meta`` dictionary.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Comments and Metadata in ASCII Tables\n\nComment lines detected during reading are inserted into the output table as\nsuch::\n\n >>> table='''# TELESCOPE = 30 inch\n ...          # TARGET = PV Ceph\n ...          # BAND = V\n ...          MJD mag\n ...          55555 12.3\n ...          55556 12.4'''\n >>> dat = ascii.read(table)\n >>> print(dat.meta['comments'])\n ['TELESCOPE = 30 inch', 'TARGET = PV Ceph', 'BAND = V']\n\nWhile :mod:`astropy.io.ascii` will not do any post-processing on comment lines,\ncustom post-processing can be accomplished by rereading with the metadata line\ncomments. Here is one example, where comments are of the form \"# KEY = VALUE\"::\n\n >>> header = ascii.read(dat.meta['comments'], delimiter='=',\n ...                     format='no_header', names=['key', 'val'])\n >>> print(header)\n    key      val\n --------- -------\n TELESCOPE 30 inch\n    TARGET PV Ceph\n      BAND       V\n\n..\n  EXAMPLE END\n\nConverters\n==========\n\n:mod:`astropy.io.ascii` converts the raw string values from the table into\nnumeric data types by using converter functions such as the Python ``int`` and\n``float`` functions. For example, ``int(\"5.0\")`` will fail while float(\"5.0\")\nwill succeed and return 5.0 as a Python float.\n\nThe default converters are::\n\n    default_converters = [astropy.io.ascii.convert_numpy(numpy.int),\n                          astropy.io.ascii.convert_numpy(numpy.float),\n                          astropy.io.ascii.convert_numpy(numpy.str)]\n\nThese take advantage of the :func:`~astropy.io.ascii.convert_numpy`\nfunction which returns a two-element tuple ``(converter_func, converter_type)``\nas described in the previous section. The type provided to\n:func:`~astropy.io.ascii.convert_numpy` must be a valid `NumPy type\n<https://numpy.org/doc/stable/user/basics.types.html>`_ such as\n``numpy.int``, ``numpy.uint``, ``numpy.int8``, ``numpy.int64``,\n``numpy.float``, ``numpy.float64``, or ``numpy.str``.\n\nThe default converters for each column can be overridden with the\n``converters`` keyword::\n\n  >>> import numpy as np\n  >>> converters = {'col1': [ascii.convert_numpy(np.uint)],\n  ...               'col2': [ascii.convert_numpy(np.float32)]}\n  >>> ascii.read('file.dat', converters=converters)  # doctest: +SKIP\n\nIn addition to single column names you can use wildcards via `fnmatch` to\nselect multiple columns. For example, we can set the format for all columns\nwith a name starting with \"col\" to an unsigned integer while applying default\nconverters to all other columns in the table::\n\n  >>> import numpy as np\n  >>> converters = {'col*': [ascii.convert_numpy(np.uint)]}\n  >>> ascii.read('file.dat', converters=converters)  # doctest: +SKIP\n\n\n.. _fortran_style_exponents:\n\nFortran-Style Exponents\n=======================\n\nThe :ref:`fast converter <fast_conversion_opts>` available with the C\ninput parser provides an ``exponent_style`` option to define a custom\ncharacter instead of the standard ``'e'`` for exponential formats in\nthe input file, to read, for example, Fortran-style double precision\nnumbers like ``'1.495978707D+13'``:\n\n  >>> ascii.read('double.dat', format='basic', guess=False,\n  ...            fast_reader={'exponent_style': 'D'})  # doctest: +SKIP\n\nThe special setting ``'fortran'`` is provided to allow for the\nauto-detection of any valid Fortran exponent character (``'E'``,\n``'D'``, ``'Q'``), as well as of triple-digit exponents prefixed with no\ncharacter at all (e.g., ``'2.1127123261674622-107'``).\nAll values and exponent characters in the input data are\ncase-insensitive; any value other than the default ``'E'`` implies the\nautomatic setting of ``'use_fast_converter': True``.\n\nAdvanced Customization\n======================\n\nHere we provide a few examples that demonstrate how to extend the base\nfunctionality to handle special cases. To go beyond these examples, the\nbest reference is to read the code for the existing\n:ref:`extension_reader_classes`.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Advanced Customization to Extend Base Functionality of astropy.io.ascii\n\nFor special cases, these examples demonstrate how to extend the base\nfunctionality of `astropy.io.ascii`.\n\n**Define custom readers by class inheritance**\n\nThe most useful way to define a new reader class is by inheritance.\nThis is the way all of the built-in readers are defined, so there are plenty\nof examples in the code.\n\nIn most cases, you will define one class to handle the header,\none class that handles the data, and a reader class that ties it all together.\nHere is an example from the code that defines a reader that is just like\nthe basic reader, but header and data start in different lines of the file::\n\n  # Note: NoHeader is already included in astropy.io.ascii for convenience.\n  class NoHeaderHeader(BasicHeader):\n      '''Reader for table header without a header\n\n      Set the start of header line number to `None`, which tells the basic\n      reader there is no header line.\n      '''\n      start_line = None\n\n  class NoHeaderData(BasicData):\n      '''Reader for table data without a header\n\n      Data starts at first uncommented line since there is no header line.\n      '''\n      start_line = 0\n\n  class NoHeader(Basic):\n      \"\"\"Read a table with no header line.  Columns are autonamed using\n      header.auto_format which defaults to \"col%d\".  Otherwise this reader\n      the same as the :class:`Basic` class from which it is derived.  Example::\n\n        # Table data\n        1 2 \"hello there\"\n        3 4 world\n      \"\"\"\n      _format_name = 'no_header'\n      _description = 'Basic table with no headers'\n      header_class = NoHeaderHeader\n      data_class = NoHeaderData\n\nIn a slightly more involved case, the implementation can also override some of\nthe methods in the base class::\n\n  # Note: CommentedHeader is already included in astropy.io.ascii for convenience.\n  class CommentedHeaderHeader(BasicHeader):\n      \"\"\"Header class for which the column definition line starts with the\n      comment character.  See the :class:`CommentedHeader` class  for an example.\n      \"\"\"\n      def process_lines(self, lines):\n          \"\"\"Return only lines that start with the comment regexp.  For these\n          lines strip out the matching characters.\"\"\"\n          re_comment = re.compile(self.comment)\n          for line in lines:\n              match = re_comment.match(line)\n              if match:\n                  yield line[match.end():]\n\n      def write(self, lines):\n          lines.append(self.write_comment + self.splitter.join(self.colnames))\n\n\n  class CommentedHeader(Basic):\n      \"\"\"Read a file where the column names are given in a line that begins with\n      the header comment character. ``header_start`` can be used to specify the\n      line index of column names, and it can be a negative index (for example -1\n      for the last commented line).  The default delimiter is the <space>\n      character.::\n\n        # col1 col2 col3\n        # Comment line\n        1 2 3\n        4 5 6\n      \"\"\"\n      _format_name = 'commented_header'\n      _description = 'Column names in a commented line'\n\n      header_class = CommentedHeaderHeader\n      data_class = NoHeaderData\n\n\n**Define a custom reader functionally**\n\nInstead of defining a new class, it is also possible to obtain an instance\nof a reader, and then to modify the properties of this one reader instance\nin a function::\n\n   def read_rdb_table(table):\n       reader = astropy.io.ascii.Basic()\n       reader.header.splitter.delimiter = '\\t'\n       reader.data.splitter.delimiter = '\\t'\n       reader.header.splitter.process_line = None\n       reader.data.splitter.process_line = None\n       reader.data.start_line = 2\n\n       return reader.read(table)\n\n\n**Create a custom splitter.process_val function**\n::\n\n   # The default process_val() normally just strips whitespace.\n   # In addition have it replace empty fields with -999.\n   def process_val(x):\n       \"\"\"Custom splitter process_val function: Remove whitespace at the beginning\n       or end of value and substitute -999 for any blank entries.\"\"\"\n       x = x.strip()\n       if x == '':\n           x = '-999'\n       return x\n\n   # Create an RDB reader and override the splitter.process_val function\n   rdb_reader = astropy.io.ascii.get_reader(Reader=astropy.io.ascii.Rdb)\n   rdb_reader.data.splitter.process_val = process_val\n\n..\n  EXAMPLE END\n\n.. _chunk_reading:\n\nReading Large Tables in Chunks\n==============================\n\nThe default process for reading ASCII tables is not memory efficient and may\ntemporarily require much more memory than the size of the file (up to a factor\nof 5 to 10). In cases where the temporary memory requirement exceeds available\nmemory this can cause significant slowdown when disk cache gets used.\n\nIn this situation, there is a way to read the table in smaller chunks which are\nlimited in size. There are two possible ways to do this:\n\n- Read the table in chunks and aggregate the final table along the way. This\n  uses only somewhat more memory than the final table requires.\n- Use a Python generator function to return a `~astropy.table.Table` object for\n  each chunk of the input table. This allows for scanning through arbitrarily\n  large tables since it never returns the final aggregate table.\n\nThe chunk reading functionality is most useful for very large tables, so this is\navailable only for the :ref:`fast_ascii_io` readers. The following formats are\nsupported: ``tab``, ``csv``, ``no_header``, ``rdb``, and ``basic``. The\n``commented_header`` format is not directly supported, but as a workaround one\ncan read using the ``no_header`` format and explicitly supply the column names\nusing the ``names`` argument.\n\nIn order to read a table in chunks you must provide the ``fast_reader`` keyword\nargument with a ``dict`` that includes the ``chunk_size`` key with the value\nbeing the approximate size (in bytes) of each chunk of the input table to read.\nIn addition, if you provide a ``chunk_generator`` key which is set to\n``True``, then instead of returning a single table for the whole input it\nreturns an iterator that provides a table for each chunk of the input.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Reading Large Tables in Chunks with astropy.io.ascii\n\nTo read an entire table while limiting peak memory usage:\n::\n\n  # Read a large CSV table in 100 Mb chunks.\n\n  tbl = ascii.read('large_table.csv', format='csv', guess=False,\n                   fast_reader={'chunk_size': 100 * 1000000})\n\nTo read the table in chunks with an iterator, we iterate over a CSV table and\nselect all rows where the ``Vmag`` column is less than 8.0 (e.g., all stars in\ntable brighter than 8.0 mag). We collect all of these subtables and then stack\nthem at the end.\n::\n\n  from astropy.table import vstack\n\n  # tbls is an iterator over the chunks (no actual reading done yet)\n  tbls = ascii.read('large_table.csv', format='csv', guess=False,\n                    fast_reader={'chunk_size': 100 * 1000000,\n                                 'chunk_generator': True})\n\n  out_tbls = []\n\n  # At this point the file is actually read in chunks.\n  for tbl in tbls:\n      bright = tbl['Vmag'] < 8.0\n      if np.count_nonzero(bright):\n          out_tbls.append(tbl[bright])\n\n  out_tbl = vstack(out_tbls)\n\n.. Note:: **Performance**\n\n  Specifying the ``format`` explicitly and using ``guess=False`` is a good idea\n  for large tables. This prevents unnecessary guessing in the typical case\n  where the format is already known.\n\n  The ``chunk_size`` should generally be set to the largest value that is\n  reasonable given available system memory. There is overhead associated\n  with processing each chunk, so the fewer chunks the better.\n\n  ..\n    EXAMPLE END\n"},{"id":89,"name":"toc.txt","nodeType":"TextFile","path":"docs/io/ascii","text":".. toctree::\n   :maxdepth: 2\n\n   read\n   write\n   base_classes\n   fixed_width_gallery\n   fast_ascii_io\n   ascii_api\n"},{"id":90,"name":"ecsv.rst","nodeType":"TextFile","path":"docs/io/ascii","text":".. _ecsv_format:\n\nECSV Format\n===========\n\nThe `Enhanced Character-Separated Values (ECSV) format\n<https://github.com/astropy/astropy-APEs/blob/main/APE6.rst>`_ can be used to\nwrite ``astropy`` `~astropy.table.Table` or `~astropy.table.QTable` datasets to\na text-only human readable data file and then read the table back without loss\nof information. The format stores column specifications like unit and data type\nalong with table metadata by using a YAML header data structure. The\nactual tabular data are stored in a standard character separated values (CSV)\nformat, giving compatibility with a wide variety of non-specialized CSV table\nreaders.\n\n.. attention::\n\n    The ECSV format is the recommended way to store Table data in a\n    human-readable ASCII file. This includes use cases from informal\n    use in science research to production pipelines and data systems.\n\n    In addition to Python, ECSV is supported in `TOPCAT\n    <http://www.star.bris.ac.uk/~mbt/topcat/>`_ and in the java `STIL\n    <http://www.star.bris.ac.uk/~mbt/topcat/sun253/inEcsv.html>`_ library. .\n\nUsage\n-----\n\nWhen writing in the ECSV format there are only two choices for the delimiter,\neither space or comma, with space being the default. Any other value of\n``delimiter`` will give an error. For reading the delimiter is specified within\nthe file itself.\n\nApart from the delimiter, the only other applicable read/write arguments are\n``names``, ``include_names``, and ``exclude_names``. All other arguments will be\neither ignored or raise an error.\n\nSimple Table\n------------\n..\n  EXAMPLE START\n  Writing Data Tables as ECSV: Simple Table\n\nThe following writes a table as a simple space-delimited file. The\nECSV format is auto-selected due to ``.ecsv`` suffix::\n\n  >>> import numpy as np\n  >>> from astropy.table import Table\n  >>> data = Table()\n  >>> data['a'] = np.array([1, 2], dtype=np.int8)\n  >>> data['b'] = np.array([1, 2], dtype=np.float32)\n  >>> data['c'] = np.array(['hello', 'world'])\n  >>> data.write('my_data.ecsv')  # doctest: +SKIP\n\nThe contents of ``my_data.ecsv`` are shown below::\n\n  # %ECSV 1.0\n  # ---\n  # datatype:\n  # - {name: a, datatype: int8}\n  # - {name: b, datatype: float32}\n  # - {name: c, datatype: string}\n  # schema: astropy-2.0\n  a b c\n  1 1.0 hello\n  2 2.0 world\n\nThe ECSV header is the section prefixed by the ``#`` comment character. An ECSV\nfile must start with the ``%ECSV <version>`` line. The ``datatype`` element\ndefines the list of columns and the ``schema`` relates to astropy-specific\nextensions that are used for writing `Mixin Columns`_.\n\n..\n  EXAMPLE END\n\nMasked Data\n-----------\n\nYou can write masked (or \"missing\") data in the ECSV format in two different\nways, either using an empty string to represent missing values or by splitting\nthe masked columns into separate data and mask columns.\n\nEmpty String\n\"\"\"\"\"\"\"\"\"\"\"\"\n\nThe first (default) way uses an empty string as a marker in place of\nmasked values. This is a bit more common outside of ``astropy`` and does not\nrequire any astropy-specific extensions.\n\n  >>> from astropy.table import MaskedColumn\n  >>> t = Table()\n  >>> t['x'] = MaskedColumn([1.0, 2.0, 3.0], unit='m', dtype='float32')\n  >>> t['x'][1] = np.ma.masked\n  >>> t['y'] = MaskedColumn([False, True, False], dtype='bool')\n  >>> t['y'][0] = np.ma.masked\n\n  >>> t.write('my_data.ecsv', format='ascii.ecsv', overwrite=True)  # doctest: +SKIP\n\nThe contents of ``my_data.ecsv`` are shown below::\n\n  # %ECSV 1.0\n  # ---\n  # datatype:\n  # - {name: x, unit: m, datatype: float32}\n  # - {name: y, datatype: bool}\n  # schema: astropy-2.0\n  x y\n  1.0 \"\"\n  \"\" True\n  3.0 False\n\nTo read this back, you would run the following::\n\n  >>> Table.read('my_data.ecsv')  # doctest: +SKIP\n  <Table length=3>\n     x      y\n     m\n  float32  bool\n  ------- -----\n      1.0    --\n       --  True\n      3.0 False\n\nData + Mask\n\"\"\"\"\"\"\"\"\"\"\"\n\nThe second way is to tell the writer to break any masked column into a data\ncolumn and a mask column by supplying the ``serialize_method='data_mask'``\nargument::\n\n  >>> t.write('my_data.ecsv', serialize_method='data_mask', overwrite=True)  # doctest: +SKIP\n\nThere are two main reasons you might want to do this:\n\n- Storing the data \"under the mask\" instead of replacing it with an empty string.\n- Writing a string column that contains empty strings which are not masked.\n\nThe contents of ``my_data.ecsv`` are shown below. First notice that there are\ntwo new columns ``x.mask`` and ``y.mask`` that have been added, and these explicitly\nrecord the mask values for those columns. Next notice now that the ECSV\nheader is a bit more complex and includes the astropy-specific extensions that\ntell the reader how to interpret the plain CSV columns ``x, x.mask, y, y.mask``\nand reassemble them back into the appropriate masked columns.\n::\n\n  # %ECSV 1.0\n  # ---\n  # datatype:\n  # - {name: x, unit: m, datatype: float32}\n  # - {name: x.mask, datatype: bool}\n  # - {name: y, datatype: bool}\n  # - {name: y.mask, datatype: bool}\n  # meta: !!omap\n  # - __serialized_columns__:\n  #     x:\n  #       __class__: astropy.table.column.MaskedColumn\n  #       data: !astropy.table.SerializedColumn {name: x}\n  #       mask: !astropy.table.SerializedColumn {name: x.mask}\n  #     y:\n  #       __class__: astropy.table.column.MaskedColumn\n  #       data: !astropy.table.SerializedColumn {name: y}\n  #       mask: !astropy.table.SerializedColumn {name: y.mask}\n  # schema: astropy-2.0\n  x x.mask y y.mask\n  1.0 False False True\n  2.0 True True False\n  3.0 False False False\n\n.. note::\n\n   For the security minded, the ``__class__`` value must within an allowed list\n   of astropy classes that are trusted by the reader. You cannot use an\n   arbitrary class here.\n\n..\n  EXAMPLE START\n  Using ECSV Format to Write Astropy Tables with Masked or Missing Data\n\nPer-column control\n@@@@@@@@@@@@@@@@@@\n\nIn rare cases it may be necessary to specify the serialization method for each\ncolumn individually. This is shown in the example below::\n\n  >>> from astropy.table.table_helpers import simple_table\n  >>> t = simple_table(masked=True)\n  >>> t['c'][0] = \"\"  # Valid empty string in data\n  >>> t\n  <Table masked=True length=3>\n    a      b     c\n  int64 float64 str1\n  ----- ------- ----\n     --     1.0\n      2     2.0   --\n      3      --    e\n\nNow we tell ECSV writer to output separate data and mask columns for the\nstring column ``'c'``:\n\n.. doctest-skip::\n\n  >>> t['c'].info.serialize_method['ecsv'] = 'data_mask'\n  >>> ascii.write(t, format='ecsv')\n  # %ECSV 1.0\n  # ---\n  # datatype:\n  # - {name: a, datatype: int64}\n  # - {name: b, datatype: float64}\n  # - {name: c, datatype: string}\n  # - {name: c.mask, datatype: bool}\n  # meta: !!omap\n  # - __serialized_columns__:\n  #     c:\n  #       __class__: astropy.table.column.MaskedColumn\n  #       data: !astropy.table.SerializedColumn {name: c}\n  #       mask: !astropy.table.SerializedColumn {name: c.mask}\n  # schema: astropy-2.0\n  a b c c.mask\n  \"\" 1.0 \"\" False\n  2 2.0 d True\n  3 \"\" e False\n\nWhen you read this back in, both the empty (zero-length) string and the masked\n``'d'`` value in the column ``'c'`` will be preserved.\n\n..\n  EXAMPLE END\n\n.. _ecsv_format_mixin_columns:\n\nMixin Columns\n-------------\n\nIt is possible to store not only standard `~astropy.table.Column` and\n`~astropy.table.MaskedColumn` objects to ECSV but also the following\n:ref:`mixin_columns`:\n\n- `astropy.time.Time`\n- `astropy.time.TimeDelta`\n- `astropy.units.Quantity`\n- `astropy.coordinates.Latitude`\n- `astropy.coordinates.Longitude`\n- `astropy.coordinates.Angle`\n- `astropy.coordinates.Distance`\n- `astropy.coordinates.EarthLocation`\n- `astropy.coordinates.SkyCoord`\n- `astropy.table.NdarrayMixin`\n- Coordinate representation types such as `astropy.coordinates.SphericalRepresentation`\n\nIn general, a mixin column may contain multiple data components as well as\nobject attributes beyond the standard `~astropy.table.Column` attributes like\n``format`` or ``description``. Storing such mixin columns is done by replacing\nthe mixin column with column(s) representing the underlying data component(s)\nand then inserting metadata which informs the reader of how to reconstruct the\noriginal column. For example, a `~astropy.coordinates.SkyCoord` mixin column in\n``'spherical'`` representation would have data attributes ``ra``, ``dec``,\n``distance``, along with object attributes like ``representation_type`` or\n``frame``.\n\n..\n  EXAMPLE START\n  Writing a Table with a SkyCoord Column in ECSV Format\n\nThis example demonstrates writing a `~astropy.table.QTable` that has `~astropy.time.Time`\nand `~astropy.coordinates.SkyCoord` mixin columns::\n\n  >>> from astropy.coordinates import SkyCoord\n  >>> import astropy.units as u\n  >>> from astropy.table import QTable\n\n  >>> sc = SkyCoord(ra=[1, 2] * u.deg, dec=[3, 4] * u.deg)\n  >>> sc.info.description = 'flying circus'\n  >>> q = [1, 2] * u.m\n  >>> q.info.format = '.2f'\n  >>> t = QTable()\n  >>> t['c'] = [1, 2]\n  >>> t['q'] = q\n  >>> t['sc'] = sc\n\n  >>> t.write('my_data.ecsv')  # doctest: +SKIP\n\nThe contents of ``my_data.ecsv`` are below::\n\n  # %ECSV 1.0\n  # ---\n  # datatype:\n  # - {name: c, datatype: int64}\n  # - {name: q, unit: m, datatype: float64, format: .2f}\n  # - {name: sc.ra, unit: deg, datatype: float64}\n  # - {name: sc.dec, unit: deg, datatype: float64}\n  # meta: !!omap\n  # - __serialized_columns__:\n  #     q:\n  #       __class__: astropy.units.quantity.Quantity\n  #       __info__: {format: .2f}\n  #       unit: !astropy.units.Unit {unit: m}\n  #       value: !astropy.table.SerializedColumn {name: q}\n  #     sc:\n  #       __class__: astropy.coordinates.sky_coordinate.SkyCoord\n  #       __info__: {description: flying circus}\n  #       dec: !astropy.table.SerializedColumn\n  #         __class__: astropy.coordinates.angles.Latitude\n  #         unit: &id001 !astropy.units.Unit {unit: deg}\n  #         value: !astropy.table.SerializedColumn {name: sc.dec}\n  #       frame: icrs\n  #       ra: !astropy.table.SerializedColumn\n  #         __class__: astropy.coordinates.angles.Longitude\n  #         unit: *id001\n  #         value: !astropy.table.SerializedColumn {name: sc.ra}\n  #         wrap_angle: !astropy.coordinates.Angle\n  #           unit: *id001\n  #           value: 360.0\n  #       representation_type: spherical\n  # schema: astropy-2.0\n  c q sc.ra sc.dec\n  1 1.0 1.0 3.0\n  2 2.0 2.0 4.0\n\nThe ``'__class__'`` keyword gives the fully-qualified class name and must be\none of the specifically allowed ``astropy`` classes. There is no option to add\nuser-specified allowed classes. The ``'__info__'`` keyword contains values for\nstandard `~astropy.table.Column` attributes like ``description`` or ``format``,\nfor any mixin columns that are represented by more than one serialized column.\n\n..\n  EXAMPLE END\n\n.. _ecsv_format_masked_columns:\n\nMultidimensional Columns\n------------------------\n\nUsing ECSV it is possible to write a table that contains multidimensional\ncolumns (both masked and unmasked). This is done by encoding each element as a\nstring using JSON. This functionality works for all column types that are\nsupported by ECSV including :ref:`mixin_columns`. This capability is added in\nastropy 4.3 and ECSV version 1.0.\n\n..\n  EXAMPLE START\n  Using ECSV Format to Write Astropy Tables with Multidimensional Columns\n\nWe start by defining a table with 2 rows where each element in the second column\n``'b'`` is itself a 3x2 array::\n\n  >>> t = Table()\n  >>> t['a'] = ['x', 'y']\n  >>> t['b'] = np.arange(12, dtype=np.float64).reshape(2, 3, 2)\n  >>> t\n  <Table length=2>\n   a     b [3,2]\n  str1   float64\n  ---- -----------\n     x  0.0 .. 5.0\n     y 6.0 .. 11.0\n\n  >>> t['b'][0]\n  array([[0., 1.],\n        [2., 3.],\n        [4., 5.]])\n\nNow we can write this to ECSV and observe how the N-d column ``'b'`` has been\nwritten as a string with ``datatype: string``. Notice also that the column\ndescriptor for the column includes the new ``subtype: float64[3,2]`` attribute\nspecifying the type and shape of each item.\n\n.. doctest-skip::\n\n  >>> ascii.write(t, format='ecsv')  # doctest: +SKIP\n  # %ECSV 1.0\n  # ---\n  # datatype:\n  # - {name: a, datatype: string}\n  # - {name: b, datatype: string, subtype: 'float64[3,2]'}\n  # schema: astropy-2.0\n  a b\n  x [[0.0,1.0],[2.0,3.0],[4.0,5.0]]\n  y [[6.0,7.0],[8.0,9.0],[10.0,11.0]]\n\nWhen you read this back in, the sequence of JSON-encoded column items are then\ndecoded using JSON back into the original N-d column.\n\n..\n  EXAMPLE END\n\nVariable-length arrays\n----------------------\n\nECSV supports storing multidimensional columns is when the length of each array\nelement may vary. This data structure is supported in the `FITS standard\n<https://fits.gsfc.nasa.gov/fits_standard.html>`_. While ``numpy`` does not\nnatively support variable-length arrays, it is possible to represent such a\nstructure using an object-type array of typed ``np.ndarray`` objects. This is how\nthe ``astropy`` FITS reader outputs a variable-length array.\n\nThis capability is added in astropy 4.3 and ECSV version 1.0.\n\nMost commonly variable-length arrays have a 1-d array in each cell of the\ncolumn. You might a column with 1-d ``np.ndarray`` cells having lengths of 2, 5,\nand 3 respectively.\n\nThe ECSV standard and ``astropy`` also supports arbitrary N-d arrays in each\ncell, where all dimensions except the last one must match. For instance you\ncould have a column with ``np.ndarray`` cells having shapes of ``(4,4,2)``,\n``(4,4,5)``, and ``(4,4,3)`` respectively.\n\n..\n  EXAMPLE START\n  Using ECSV Format to Write Astropy Tables with Variable-Length Arrays\n\nThe example below shows writing a variable-length 1-d array to ECSV. Notice the\nnew ECSV column attribute ``subtype: 'int64[null]'``. The ``[null]`` indicates a\nvariable length for the one dimension. If we had been writing the N-d example\nabove the subtype would have been ``int64[4,4,null]``.\n\n.. doctest-skip::\n\n  >>> t = Table()\n  >>> t['a'] = np.empty(3, dtype=object)\n  >>> t['a'] = [np.array([1, 2], dtype=np.int64),\n  ...           np.array([3, 4, 5], dtype=np.int64),\n  ...           np.array([6, 7, 8, 9], dtype=np.int64)]\n  >>> ascii.write(t, format='ecsv')\n  # %ECSV 1.0\n  # ---\n  # datatype:\n  # - {name: a, datatype: string, subtype: 'int64[null]'}\n  # schema: astropy-2.0\n  a\n  [1,2]\n  [3,4,5]\n  [6,7,8,9]\n\n..\n  EXAMPLE END\n\nObject arrays\n-------------\n\nECSV can store object-type columns with simple Python objects consisting of\n``dict``, ``list``, ``str``, ``int``, ``float``, ``bool`` and ``None`` elements.\nMore precisely, any object that can be serialized to `JSON\n<https://www.json.org/>`__ using the standard library `json\n<https://docs.python.org/3/library/json.html>`__ package is supported.\n\n..\n  EXAMPLE START\n  Using ECSV Format to Write Astropy Tables with Object Arrays\n\nThe example below shows writing an object array to ECSV. Because JSON requires\na double-quote around strings, and because ECSV requires ``\"\"`` to represent\na double-quote within a string, one tends to get double-double quotes in this\nrepresentation.\n\n.. doctest-skip::\n\n  >>> t = Table()\n  >>> t['a'] = np.array([{'a': 1},\n  ...                    {'b': [2.5, None]},\n  ...                    True], dtype=object)\n  >>> ascii.write(t, format='ecsv')\n  # %ECSV 1.0\n  # ---\n  # datatype:\n  # - {name: a, datatype: string, subtype: json}\n  # schema: astropy-2.0\n  a\n  \"{\"\"a\"\":1}\"\n  \"{\"\"b\"\":[2.5,null]}\"\n  true\n\n..\n  EXAMPLE END\n"},{"id":91,"name":"index.rst","nodeType":"TextFile","path":"docs/io/ascii","text":".. include:: references.txt\n\n.. _io-ascii:\n\n*********************************\nASCII Tables (`astropy.io.ascii`)\n*********************************\n\nIntroduction\n============\n\n`astropy.io.ascii` provides methods for reading and writing a wide range of\nASCII data table formats via built-in :ref:`extension_reader_classes`. The\nemphasis is on flexibility and convenience of use, although readers can\noptionally use a less flexible C-based engine for reading and writing for\nimproved performance. This subpackage was originally developed as ``asciitable``.\n\nThe following shows a few of the ASCII formats that are available, while the\nsection on `Supported formats`_ contains the full list.\n\n* :class:`~astropy.io.ascii.Basic`: basic table with customizable delimiters and header configurations\n* :class:`~astropy.io.ascii.Cds`: `CDS format table <http://vizier.u-strasbg.fr/doc/catstd.htx>`_ (also Vizier)\n* :class:`~astropy.io.ascii.Daophot`: table from the IRAF DAOphot package\n* :class:`~astropy.io.ascii.Ecsv`: :ref:`ecsv_format` for lossless round-trip of data tables (**recommended**)\n* :class:`~astropy.io.ascii.FixedWidth`: table with fixed-width columns (see also :ref:`fixed_width_gallery`)\n* :class:`~astropy.io.ascii.Ipac`: `IPAC format table <https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html>`_\n* :class:`~astropy.io.ascii.HTML`: HTML format table contained in a <table> tag\n* :class:`~astropy.io.ascii.Latex`: LaTeX table with datavalue in the ``tabular`` environment\n* :class:`~astropy.io.ascii.Mrt`: AAS `Machine-Readable Tables (MRT) <https://journals.aas.org/mrt-standards/>`_)\n* :class:`~astropy.io.ascii.SExtractor`: `SExtractor format table <https://sextractor.readthedocs.io/en/latest/>`_\n\nThe strength of `astropy.io.ascii` is the support for astronomy-specific\nformats (often with metadata) and specialized data types such as\n:ref:`SkyCoord <astropy-coordinates-high-level>`, :ref:`Time\n<astropy-time>`, and :ref:`Quantity <quantity>`. For reading or writing large\ndata tables in a generic format such as CSV, using the :ref:`Table - Pandas\ninterface <pandas>` is an option to consider.\n\n.. note::\n\n    It is also possible and encouraged to use the functionality from\n    :mod:`astropy.io.ascii` through a higher level interface in the\n    :ref:`Data Tables <astropy-table>` package. See :ref:`table_io` for more details.\n\nGetting Started\n===============\n\nReading Tables\n--------------\n\nThe majority of commonly encountered ASCII tables can be read with the\n|read| function. Assume you have a file named ``sources.dat`` with the\nfollowing contents::\n\n  obsid redshift  X      Y     object\n  3102  0.32      4167  4085   Q1250+568-A\n  877   0.22      4378  3892   \"Source 82\"\n\nThis table can be read with the following::\n\n  >>> from astropy.io import ascii\n  >>> data = ascii.read(\"sources.dat\")  # doctest: +SKIP\n  >>> print(data)                       # doctest: +SKIP\n  obsid redshift  X    Y      object\n  ----- -------- ---- ---- -----------\n   3102     0.32 4167 4085 Q1250+568-A\n    877     0.22 4378 3892   Source 82\n\nThe first argument to the |read| function can be the name of a file, a string\nrepresentation of a table, or a list of table lines. The return value\n(``data`` in this case) is a :ref:`Table <astropy-table>` object.\n\nBy default, |read| will try to :ref:`guess the table format <guess_formats>`\nby trying all of the `supported formats`_.\n\n.. Warning::\n\n   Guessing the file format is often slow for large files because the reader\n   tries parsing the file with every allowed format until one succeeds.\n   For large files it is recommended to disable guessing with ``guess=False``.\n\nIf guessing the format does not work, as in the case for unusually formatted\ntables, you may need to give `astropy.io.ascii` additional hints about\nthe format.\n\nWriting Tables\n--------------\n\nThe |write| function provides a way to write a data table as a formatted ASCII\ntable.  Most of the input table :ref:`supported_formats` for reading are also\navailable for writing. This provides a great deal of flexibility in the format\nfor writing.\n\n..\n  EXAMPLE START\n  Writing Data Tables as Formatted ASCII Tables\n\nThe following shows how to write a formatted ASCII table using the |write|\nfunction::\n\n  >>> import numpy as np\n  >>> from astropy.io import ascii\n  >>> from astropy.table import Table\n  >>> data = Table()\n  >>> data['x'] = np.array([1, 2, 3], dtype=np.int32)\n  >>> data['y'] = data['x'] ** 2\n  >>> ascii.write(data, 'values.dat', overwrite=True)\n\nThe ``values.dat`` file will then contain::\n\n  x y\n  1 1\n  2 4\n  3 9\n\nIt is also possible and encouraged to use the write functionality from\n:mod:`astropy.io.ascii` through a higher level interface in the :ref:`Data\nTables <astropy-table>` package (see :ref:`table_io` for more details). For\nexample::\n\n  >>> data.write('values.dat', format='ascii', overwrite=True)\n\n.. attention:: **ECSV is recommended**\n\n   For a reproducible ASCII version of your table, we recommend using the\n   :ref:`ecsv_format`. This stores all the table meta-data (in particular the\n   column types and units) to a comment section at the beginning while\n   maintaining compatibility with most plain CSV readers. It also allows storing\n   richer data like `~astropy.coordinates.SkyCoord` or multidimensional or\n   variable-length columns. ECSV is also supported in java by `STIL\n   <http://www.star.bristol.ac.uk/~mbt/stil/>`_ and `TOPCAT\n   <http://www.star.bris.ac.uk/~mbt/topcat/>`_,\n\nTo write our simple example table to ECSV we use::\n\n  >>> data.write('values.ecsv', overwrite=True)  # doctest: +SKIP\n\nThe ``.ecsv`` extension is recognized and implies using ECSV (equivalent to\n``format='ascii.ecsv'``). The ``values.ecsv`` file will then contain::\n\n  # %ECSV 1.0\n  # ---\n  # datatype:\n  # - {name: x, datatype: int32}\n  # - {name: y, datatype: int32}\n  # schema: astropy-2.0\n  x y\n  1 1\n  2 4\n  3 9\n\n..\n  EXAMPLE END\n\n.. _supported_formats:\n\nSupported Formats\n=================\n\nA full list of the supported ``format`` values and corresponding format types\nfor ASCII tables is given below. The ``Write`` column indicates which formats\nsupport write functionality, and the ``Fast`` column indicates which formats\nare compatible with the fast Cython/C engine for reading and writing.\n\n========================= ===== ==== ============================================================================================\n           Format         Write Fast                                          Description\n========================= ===== ==== ============================================================================================\n``aastex``                  Yes      :class:`~astropy.io.ascii.AASTex`: AASTeX deluxetable used for AAS journals\n``basic``                   Yes  Yes :class:`~astropy.io.ascii.Basic`: Basic table with custom delimiters\n``cds``                     Yes      :class:`~astropy.io.ascii.Cds`: CDS format table\n``commented_header``        Yes  Yes :class:`~astropy.io.ascii.CommentedHeader`: Column names in a commented line\n``csv``                     Yes  Yes :class:`~astropy.io.ascii.Csv`: Basic table with comma-separated values\n``daophot``                          :class:`~astropy.io.ascii.Daophot`: IRAF DAOphot format table\n``ecsv``                    Yes      :class:`~astropy.io.ascii.Ecsv`: Enhanced CSV format (**recommended**)\n``fixed_width``             Yes      :class:`~astropy.io.ascii.FixedWidth`: Fixed width\n``fixed_width_no_header``   Yes      :class:`~astropy.io.ascii.FixedWidthNoHeader`: Fixed-width with no header\n``fixed_width_two_line``    Yes      :class:`~astropy.io.ascii.FixedWidthTwoLine`: Fixed-width with second header line\n``html``                    Yes      :class:`~astropy.io.ascii.HTML`: HTML format table\n``ipac``                    Yes      :class:`~astropy.io.ascii.Ipac`: IPAC format table\n``latex``                   Yes      :class:`~astropy.io.ascii.Latex`: LaTeX table\n``mrt``                     Yes      :class:`~astropy.io.ascii.Mrt`: AAS Machine-Readable Table format\n``no_header``               Yes  Yes :class:`~astropy.io.ascii.NoHeader`: Basic table with no headers\n``qdp``                     Yes      :class:`~astropy.io.ascii.QDP`: Quick and Dandy Plotter files\n``rdb``                     Yes  Yes :class:`~astropy.io.ascii.Rdb`: Tab-separated with a type definition header line\n``rst``                     Yes      :class:`~astropy.io.ascii.RST`: reStructuredText simple format table\n``sextractor``                       :class:`~astropy.io.ascii.SExtractor`: SExtractor format table\n``tab``                     Yes  Yes :class:`~astropy.io.ascii.Tab`: Basic table with tab-separated values\n========================= ===== ==== ============================================================================================\n\n\nUsing `astropy.io.ascii`\n========================\n\nThe details of using `astropy.io.ascii` are provided in the following sections:\n\nReading tables\n---------------\n\n.. toctree::\n   :maxdepth: 2\n\n   read\n\nWriting tables\n---------------\n\n.. toctree::\n   :maxdepth: 2\n\n   write\n\nECSV Format\n-----------\n\n.. toctree::\n   :maxdepth: 2\n\n   ecsv\n\nFixed-Width Gallery\n--------------------\n\n.. toctree::\n   :maxdepth: 2\n\n   fixed_width_gallery\n\nFast ASCII Engine\n-----------------\n\n.. toctree::\n   :maxdepth: 2\n\n   fast_ascii_io\n\nBase Class Elements\n-------------------\n\n.. toctree::\n   :maxdepth: 2\n\n   base_classes\n\nExtension Reader Classes\n------------------------\n\n.. toctree::\n   :maxdepth: 2\n\n   extension_classes\n\n.. note that if this section gets too long, it should be moved to a separate\n   doc page - see the top of performance.inc.rst for the instructions on how to do\n   that\n.. include:: performance.inc.rst\n\nReference/API\n=============\n\n.. automodapi:: astropy.io.ascii\n"},{"id":92,"name":"base_classes.rst","nodeType":"TextFile","path":"docs/io/ascii","text":".. include:: references.txt\n\n.. _base_class_elements:\n\nBase Class Elements\n*******************\n\nThe key elements in :mod:`astropy.io.ascii` are:\n\n* :class:`~astropy.io.ascii.Column`: internal storage of column properties and data.\n* :class:`Reader <astropy.io.ascii.BaseReader>`: base class to handle reading and writing tables.\n* :class:`Inputter <astropy.io.ascii.BaseInputter>`: gets the lines from the table input.\n* :class:`Splitter <astropy.io.ascii.BaseSplitter>`: splits the lines into string column values.\n* :class:`Header <astropy.io.ascii.BaseHeader>`: initializes output columns based on the table header or user input.\n* :class:`Data <astropy.io.ascii.BaseData>`: populates column data from the table.\n* :class:`Outputter <astropy.io.ascii.BaseOutputter>`: converts column data to the specified output format (e.g., ``numpy`` structured array).\n\nEach of these elements is an inheritable class with attributes that control the\ncorresponding functionality. In this way, the large number of tunable\nparameters are modularized into manageable groups. In certain places these\nattributes are actually functions for handling special cases.\n"},{"id":93,"name":"fixed_width_gallery.rst","nodeType":"TextFile","path":"docs/io/ascii","text":".. include:: references.txt\n\n.. _fixed_width_gallery:\n\nFixed-Width Gallery\n*******************\n\nFixed-width tables are those where each column has the same width for every row\nin the table. This is commonly used to make tables easy to read for humans or\nFortran codes. It also reduces issues with quoting and special characters,\nfor example::\n\n  Col1   Col2    Col3 Col4\n  ---- --------- ---- ----\n   1.2   \"hello\"    1    a\n   2.4 's worlds    2    2\n\nThere are a number of common variations in the formatting of fixed-width tables\nwhich :mod:`astropy.io.ascii` can read and write. The most significant\ndifference is whether there is no header line (:class:`~astropy.io.ascii.FixedWidthNoHeader`), one\nheader line (:class:`~astropy.io.ascii.FixedWidth`), or two header lines\n(:class:`~astropy.io.ascii.FixedWidthTwoLine`). Next, there are variations in\nthe delimiter character, like whether the delimiter appears on either end\n(\"bookends\"), or if there is padding around the delimiter.\n\nDetails are available in the class API documentation, but the easiest way to\nunderstand all of the options and their interactions is by example.\n\nReading\n=======\n\n..\n  EXAMPLE START\n  Reading Fixed-Width Tables\n\nFixedWidth\n----------\n\n**Nice, typical, fixed-format table:**\n::\n\n  >>> from astropy.io import ascii\n  >>> table = \"\"\"\n  ... # comment (with blank line above)\n  ... |  Col1  |  Col2   |\n  ... |  1.2   | \"hello\" |\n  ... |  2.4   |'s worlds|\n  ... \"\"\"\n  >>> ascii.read(table, format='fixed_width')\n  <Table length=2>\n    Col1     Col2\n  float64    str9\n  ------- ---------\n      1.2   \"hello\"\n      2.4 's worlds\n\n**Typical fixed-format table with col names provided:**\n::\n\n  >>> table = \"\"\"\n  ... # comment (with blank line above)\n  ... |  Col1  |  Col2   |\n  ... |  1.2   | \"hello\" |\n  ... |  2.4   |'s worlds|\n  ... \"\"\"\n  >>> ascii.read(table, format='fixed_width', names=['name1', 'name2'])\n  <Table length=2>\n   name1    name2\n  float64    str9\n  ------- ---------\n      1.2   \"hello\"\n      2.4 's worlds\n\n**Weird input table with data values chopped by col extent:**\n::\n\n  >>> table = \"\"\"\n  ...   Col1  |  Col2 |\n  ...   1.2       \"hello\"\n  ...   2.4   sdf's worlds\n  ... \"\"\"\n  >>> ascii.read(table, format='fixed_width')\n  <Table length=2>\n    Col1    Col2\n  float64   str7\n  ------- -------\n      1.2    \"hel\n      2.4 df's wo\n\n**Table with double delimiters:**\n::\n\n  >>> table = \"\"\"\n  ... || Name ||   Phone ||         TCP||\n  ... |  John  | 555-1234 |192.168.1.10X|\n  ... |  Mary  | 555-2134 |192.168.1.12X|\n  ... |   Bob  | 555-4527 | 192.168.1.9X|\n  ... \"\"\"\n  >>> ascii.read(table, format='fixed_width')\n  <Table length=3>\n  Name  Phone       TCP\n  str4   str8      str12\n  ---- -------- ------------\n  John 555-1234 192.168.1.10\n  Mary 555-2134 192.168.1.12\n   Bob 555-4527  192.168.1.9\n\n**Table with space delimiter:**\n::\n\n  >>> table = \"\"\"\n  ...  Name  --Phone-    ----TCP-----\n  ...  John  555-1234    192.168.1.10\n  ...  Mary  555-2134    192.168.1.12\n  ...   Bob  555-4527     192.168.1.9\n  ... \"\"\"\n  >>> ascii.read(table, format='fixed_width', delimiter=' ')\n  <Table length=3>\n  Name --Phone- ----TCP-----\n  str4   str8      str12\n  ---- -------- ------------\n  John 555-1234 192.168.1.10\n  Mary 555-2134 192.168.1.12\n   Bob 555-4527  192.168.1.9\n\n**Table with no header row and auto-column naming:**\n\nUse ``header_start`` and ``data_start`` keywords to indicate no header line.\n::\n\n  >>> table = \"\"\"\n  ... |  John  | 555-1234 |192.168.1.10|\n  ... |  Mary  | 555-2134 |192.168.1.12|\n  ... |   Bob  | 555-4527 | 192.168.1.9|\n  ... \"\"\"\n  >>> ascii.read(table, format='fixed_width',\n  ...            header_start=None, data_start=0)\n  <Table length=3>\n  col1   col2       col3\n  str4   str8      str12\n  ---- -------- ------------\n  John 555-1234 192.168.1.10\n  Mary 555-2134 192.168.1.12\n   Bob 555-4527  192.168.1.9\n\n**Table with no header row and with col names provided:**\n\nSecond and third rows also have hanging spaces after final \"|\". Use\nheader_start and data_start keywords to indicate no header line.\n::\n\n  >>> table = [\"|  John  | 555-1234 |192.168.1.10|\",\n  ...          \"|  Mary  | 555-2134 |192.168.1.12|  \",\n  ...          \"|   Bob  | 555-4527 | 192.168.1.9|  \"]\n  >>> ascii.read(table, format='fixed_width',\n  ...            header_start=None, data_start=0,\n  ...            names=('Name', 'Phone', 'TCP'))\n  <Table length=3>\n  Name  Phone       TCP\n  str4   str8      str12\n  ---- -------- ------------\n  John 555-1234 192.168.1.10\n  Mary 555-2134 192.168.1.12\n   Bob 555-4527  192.168.1.9\n\n\nFixedWidthNoHeader\n------------------\n\n**Table with no header row and auto-column naming. Use the\n``fixed_width_no_header`` format for convenience:**\n::\n\n  >>> table = \"\"\"\n  ... |  John  | 555-1234 |192.168.1.10|\n  ... |  Mary  | 555-2134 |192.168.1.12|\n  ... |   Bob  | 555-4527 | 192.168.1.9|\n  ... \"\"\"\n  >>> ascii.read(table, format='fixed_width_no_header')\n  <Table length=3>\n  col1   col2       col3\n  str4   str8      str12\n  ---- -------- ------------\n  John 555-1234 192.168.1.10\n  Mary 555-2134 192.168.1.12\n   Bob 555-4527  192.168.1.9\n\n**Table with no delimiter with column start and end values specified:**\n\nThis uses the col_starts and col_ends keywords. Note that the\ncol_ends values are inclusive so a position range of zero to five\nwill select the first six characters.\n::\n\n  >>> table = \"\"\"\n  ... #    5   9     17  18      28    <== Column start / end indexes\n  ... #    |   |       ||         |    <== Column separation positions\n  ...   John   555- 1234 192.168.1.10\n  ...   Mary   555- 2134 192.168.1.12\n  ...    Bob   555- 4527  192.168.1.9\n  ... \"\"\"\n  >>> ascii.read(table, format='fixed_width_no_header',\n  ...                 names=('Name', 'Phone', 'TCP'),\n  ...                 col_starts=(0, 9, 18),\n  ...                 col_ends=(5, 17, 28),\n  ...                 )\n  <Table length=3>\n  Name   Phone      TCP\n  str4    str9     str10\n  ---- --------- ----------\n  John 555- 1234 192.168.1.\n  Mary 555- 2134 192.168.1.\n   Bob 555- 4527  192.168.1\n\n**Table with no delimiter with only column start or end values specified:**\n\nIf only the col_starts keyword is given, it is assumed that each column\nends where the next column starts, and the final column ends at the same\nposition as the longest line of data.\n\nConversely, if only the col_ends keyword is given, it is assumed that the first\ncolumn starts at position zero and that each successive column starts\nimmediately after the previous one.\n\nThe two examples below read the same table and produce the same result.\n::\n\n  >>> table = \"\"\"\n  ... #1       9        19                <== Column start indexes\n  ... #|       |         |                <== Column start positions\n  ... #<------><--------><------------->  <== Inferred column positions\n  ...   John   555- 1234 192.168.1.10\n  ...   Mary   555- 2134 192.168.1.123\n  ...    Bob   555- 4527  192.168.1.9\n  ...    Bill  555-9875  192.255.255.255\n  ... \"\"\"\n  >>> ascii.read(table,\n  ...                 format='fixed_width_no_header',\n  ...                 names=('Name', 'Phone', 'TCP'),\n  ...                 col_starts=(1, 9, 19),\n  ...                 )\n  <Table length=4>\n  Name   Phone         TCP\n  str4    str9        str15\n  ---- --------- ---------------\n  John 555- 1234    192.168.1.10\n  Mary 555- 2134   192.168.1.123\n   Bob 555- 4527     192.168.1.9\n  Bill  555-9875 192.255.255.255\n\n  >>> ascii.read(table,\n  ...                 format='fixed_width_no_header',\n  ...                 names=('Name', 'Phone', 'TCP'),\n  ...                 col_ends=(8, 18, 32),\n  ...                 )\n  <Table length=4>\n  Name   Phone        TCP\n  str4    str9       str14\n  ---- --------- --------------\n  John 555- 1234   192.168.1.10\n  Mary 555- 2134  192.168.1.123\n   Bob 555- 4527    192.168.1.9\n  Bill  555-9875 192.255.255.25\n\n\nFixedWidthTwoLine\n-----------------\n\n**Typical fixed-format table with two header lines with some cruft:**\n::\n\n  >>> table = \"\"\"\n  ...   Col1    Col2\n  ...   ----  ---------\n  ...    1.2xx\"hello\"\n  ...   2.4   's worlds\n  ... \"\"\"\n  >>> ascii.read(table, format='fixed_width_two_line')\n  <Table length=2>\n    Col1     Col2\n  float64    str9\n  ------- ---------\n      1.2   \"hello\"\n      2.4 's worlds\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Reading a reStructuredText Table\n\n**reStructuredText table:**\n::\n\n  >>> table = \"\"\"\n  ... ======= ===========\n  ...   Col1    Col2\n  ... ======= ===========\n  ...   1.2   \"hello\"\n  ...   2.4   's worlds\n  ... ======= ===========\n  ... \"\"\"\n  >>> ascii.read(table, format='fixed_width_two_line',\n  ...                 header_start=1, position_line=2, data_end=-1)\n  <Table length=2>\n    Col1     Col2\n  float64    str9\n  ------- ---------\n      1.2   \"hello\"\n      2.4 's worlds\n\n..\n  EXAMPLE END\n\n**Text table designed for humans and test having position line before the header line:**\n::\n\n  >>> table = \"\"\"\n  ... +------+----------+\n  ... | Col1 |   Col2   |\n  ... +------|----------+\n  ... |  1.2 | \"hello\"  |\n  ... |  2.4 | 's worlds|\n  ... +------+----------+\n  ... \"\"\"\n  >>> ascii.read(table, format='fixed_width_two_line', delimiter='+',\n  ...                 header_start=1, position_line=0, data_start=3, data_end=-1)\n  <Table length=2>\n    Col1     Col2\n  float64    str9\n  ------- ---------\n      1.2   \"hello\"\n      2.4 's worlds\n\nWriting\n=======\n\n..\n  EXAMPLE START\n  Writing Fixed-Width Tables\n\nFixedWidth\n----------\n\n**Define input values ``dat`` for all write examples:**\n::\n\n  >>> table = \"\"\"\n  ... | Col1 |  Col2     |  Col3 | Col4 |\n  ... | 1.2  | \"hello\"   |  1    | a    |\n  ... | 2.4  | 's worlds |  2    | 2    |\n  ... \"\"\"\n  >>> dat = ascii.read(table, format='fixed_width')\n\n**Write a table as a normal fixed-width table:**\n::\n\n  >>> ascii.write(dat, format='fixed_width')\n  | Col1 |      Col2 | Col3 | Col4 |\n  |  1.2 |   \"hello\" |    1 |    a |\n  |  2.4 | 's worlds |    2 |    2 |\n\n**Write a table as a fixed-width table with no padding:**\n::\n\n  >>> ascii.write(dat, format='fixed_width', delimiter_pad=None)\n  |Col1|     Col2|Col3|Col4|\n  | 1.2|  \"hello\"|   1|   a|\n  | 2.4|'s worlds|   2|   2|\n\n**Write a table as a fixed-width table with no bookend:**\n::\n\n  >>> ascii.write(dat, format='fixed_width', bookend=False)\n  Col1 |      Col2 | Col3 | Col4\n   1.2 |   \"hello\" |    1 |    a\n   2.4 | 's worlds |    2 |    2\n\n**Write a table as a fixed-width table with no delimiter:**\n::\n\n  >>> ascii.write(dat, format='fixed_width', bookend=False, delimiter=None)\n  Col1       Col2  Col3  Col4\n   1.2    \"hello\"     1     a\n   2.4  's worlds     2     2\n\n**Write a table as a fixed-width table with no delimiter and formatting:**\n::\n\n  >>> ascii.write(dat, format='fixed_width',\n  ...                  formats={'Col1': '%-8.3f', 'Col2': '%-15s'})\n  |     Col1 |            Col2 | Col3 | Col4 |\n  | 1.200    | \"hello\"         |    1 |    a |\n  | 2.400    | 's worlds       |    2 |    2 |\n\nFixedWidthNoHeader\n------------------\n\n**Write a table as a normal fixed-width table:**\n::\n\n  >>> ascii.write(dat, format='fixed_width_no_header')\n  | 1.2 |   \"hello\" | 1 | a |\n  | 2.4 | 's worlds | 2 | 2 |\n\n**Write a table as a fixed-width table with no padding:**\n::\n\n  >>> ascii.write(dat, format='fixed_width_no_header', delimiter_pad=None)\n  |1.2|  \"hello\"|1|a|\n  |2.4|'s worlds|2|2|\n\n**Write a table as a fixed-width table with no bookend:**\n::\n\n  >>> ascii.write(dat, format='fixed_width_no_header', bookend=False)\n  1.2 |   \"hello\" | 1 | a\n  2.4 | 's worlds | 2 | 2\n\n**Write a table as a fixed-width table with no delimiter:**\n::\n\n  >>> ascii.write(dat, format='fixed_width_no_header', bookend=False,\n  ...                  delimiter=None)\n  1.2    \"hello\"  1  a\n  2.4  's worlds  2  2\n\nFixedWidthTwoLine\n-----------------\n\n**Write a table as a normal fixed-width table:**\n::\n\n  >>> ascii.write(dat, format='fixed_width_two_line')\n  Col1      Col2 Col3 Col4\n  ---- --------- ---- ----\n   1.2   \"hello\"    1    a\n   2.4 's worlds    2    2\n\n**Write a table as a fixed width table with space padding and '=' position_char:**\n::\n\n  >>> ascii.write(dat, format='fixed_width_two_line',\n  ...                  delimiter_pad=' ', position_char='=')\n  Col1        Col2   Col3   Col4\n  ====   =========   ====   ====\n   1.2     \"hello\"      1      a\n   2.4   's worlds      2      2\n\n**Write a table as a fixed-width table with no bookend:**\n::\n\n  >>> ascii.write(dat, format='fixed_width_two_line', bookend=True, delimiter='|')\n  |Col1|     Col2|Col3|Col4|\n  |----|---------|----|----|\n  | 1.2|  \"hello\"|   1|   a|\n  | 2.4|'s worlds|   2|   2|\n\n..\n  EXAMPLE END\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":94,"name":"PYTEST_HEADER_MODULES","nodeType":"Attribute","startLoc":16,"text":"PYTEST_HEADER_MODULES"},{"id":95,"name":"performance.inc.rst","nodeType":"TextFile","path":"docs/io/ascii","text":".. note that if this is changed from the default approach of using an *include*\n   (in index.rst) to a separate performance page, the header needs to be changed\n   from === to ***, the filename extension needs to be changed from .inc.rst to\n   .rst, and a link needs to be added in the subpackage toctree\n\n.. _astropy-io-ascii-performance:\n\nPerformance Tips\n================\n\nBy default, when trying to read a file the reader will guess the format, which\ninvolves trying to read it with many different readers. For better performance\nwhen dealing with large tables, it is recommended to specify the format and any\noptions explicitly, and turn off guessing as well.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Performance Tips for Reading Large Tables with astropy.io.ascii\n\nIf you are reading a simple CSV file with a one-line header with column names,\nthe following::\n\n    read('example.csv', format='basic', delimiter=',', guess=False)  # doctest: +SKIP\n\ncan be at least an order of magnitude faster than::\n\n    read('example.csv')  # doctest: +SKIP\n\n..\n  EXAMPLE END\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":96,"name":"TESTED_VERSIONS","nodeType":"Attribute","startLoc":17,"text":"TESTED_VERSIONS"},{"attributeType":"null","col":0,"comment":"null","endLoc":49,"id":97,"name":"default","nodeType":"Attribute","startLoc":49,"text":"default"},{"col":0,"comment":"","endLoc":6,"header":"conftest.py#<anonymous>","id":98,"name":"<anonymous>","nodeType":"Function","startLoc":6,"text":"try:\n    from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS\nexcept ImportError:\n    PYTEST_HEADER_MODULES = {}\n    TESTED_VERSIONS = {}\n\nhypothesis.settings.register_profile(\n    'ci', deadline=None, print_blob=True, derandomize=True\n)\n\nhypothesis.settings.register_profile(\n    'fuzzing', deadline=None, print_blob=True, max_examples=1000\n)\n\ndefault = 'fuzzing' if (os.environ.get('IS_CRON') == 'true' and os.environ.get('ARCH_ON_CI') not in ('aarch64', 'ppc64le')) else 'ci'  # noqa: E501\n\nhypothesis.settings.load_profile(os.environ.get('HYPOTHESIS_PROFILE', default))\n\nos.environ['XDG_CONFIG_HOME'] = tempfile.mkdtemp('astropy_config')\n\nos.environ['XDG_CACHE_HOME'] = tempfile.mkdtemp('astropy_cache')\n\nos.mkdir(os.path.join(os.environ['XDG_CONFIG_HOME'], 'astropy'))\n\nos.mkdir(os.path.join(os.environ['XDG_CACHE_HOME'], 'astropy'))"},{"id":99,"name":"references.txt","nodeType":"TextFile","path":"docs/io/ascii","text":".. |read| replace:: :func:`~astropy.io.ascii.read`\n.. |write| replace:: :func:`~astropy.io.ascii.write`\n.. _structured array: https://numpy.org/doc/stable/user/basics.rec.html\n"},{"id":100,"name":"write.rst","nodeType":"TextFile","path":"docs/io/ascii","text":".. include:: references.txt\n\n.. _astropy.io.ascii_write:\n\nWriting Tables\n==============\n\n:mod:`astropy.io.ascii` is able to write ASCII tables out to a file or file-like\nobject using the same class structure and basic user interface as for reading\ntables.\n\nThe |write| function provides a way to write a data table as a\nformatted ASCII table.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Writing ASCII Tables Using astropy.io.ascii\n\nTo write a formatted ASCII table using the |write| function::\n\n  >>> import numpy as np\n  >>> from astropy.io import ascii\n  >>> from astropy.table import Table\n  >>> data = Table()\n  >>> data['x'] = np.array([1, 2, 3], dtype=np.int32)\n  >>> data['y'] = data['x'] ** 2\n  >>> ascii.write(data, 'values.dat', overwrite=True)  # doctest: +SKIP\n\nThe ``values.dat`` file will then contain::\n\n  x y\n  1 1\n  2 4\n  3 9\n\nIt is also possible and encouraged to use the write functionality from\n:mod:`astropy.io.ascii` through a higher level interface in the :ref:`Data\nTables <astropy-table>` package (see :ref:`table_io` for more details). For\nexample::\n\n  >>> data.write('values.dat', format='ascii', overwrite=True)  # doctest: +SKIP\n\nFor a more reproducible ASCII version of your table, we recommend using the\n:ref:`ecsv_format`. This stores all the table meta-data (in particular the\ncolumn types and units) to a comment section at the beginning while still\nmaintaining compatibility with most plain CSV readers. It also allows storing\nricher data like `~astropy.coordinates.SkyCoord` or multidimensional or\nvariable-length columns. For our simple example::\n\n  >>> data.write('values.ecsv', overwrite=True)  # doctest: +SKIP\n\nThe ``.ecsv`` extension is recognized and implies using ECSV (equivalent to\n``format='ascii.ecsv'``). The ``values.ecsv`` file will then contain::\n\n  # %ECSV 1.0\n  # ---\n  # datatype:\n  # - {name: x, datatype: int32}\n  # - {name: y, datatype: int32}\n  # schema: astropy-2.0\n  x y\n  1 1\n  2 4\n  3 9\n\nMost of the input table :ref:`supported_formats` for\nreading are also available for writing. This provides a great deal of\nflexibility in the format for writing. The example below writes the data as a\nLaTeX table, using the option to send the output to ``sys.stdout`` instead of a\nfile::\n\n  >>> ascii.write(data, format='latex')  # doctest: +SKIP\n  \\begin{table}\n  \\begin{tabular}{cc}\n  x & y \\\\\n  1 & 1 \\\\\n  2 & 4 \\\\\n  3 & 9 \\\\\n  \\end{tabular}\n  \\end{table}\n\nThere is also a faster Cython engine for writing simple formats,\nwhich is enabled by default for these formats (see :ref:`fast_ascii_io`).\nTo disable this engine, use the parameter ``fast_writer``::\n\n   >>> ascii.write(data, 'values.csv', format='csv', fast_writer=False)  # doctest: +SKIP\n\n..\n  EXAMPLE END\n\n.. Note::\n\n   For most supported formats one can write a masked table and then read it back\n   without losing information about the masked table entries. This is\n   accomplished by using a blank string entry to indicate a masked (missing)\n   value. See the :ref:`replace_bad_or_missing_values` section for more\n   information.\n\n.. _io_ascii_write_parameters:\n\nParameters for ``write()``\n--------------------------\n\nThe |write| function accepts a number of parameters that specify the detailed\noutput table format. Each of the :ref:`supported_formats` is handled by a\ncorresponding Writer class that can define different defaults, so the\ndescriptions below sometimes mention \"typical\" default values. This refers to\nthe :class:`~astropy.io.ascii.Basic` writer and other similar Writer classes.\n\nSome output format Writer classes (e.g., :class:`~astropy.io.ascii.Latex` or\n:class:`~astropy.io.ascii.AASTex`) accept additional keywords that can\ncustomize the output further. See the documentation of these classes for\ndetails.\n\n**output**: output specifier\n  There are two ways to specify the output for the write operation:\n\n  - Name of a file (string)\n  - File-like object (from open(), StringIO, etc.)\n\n**table**: input table\n  Any value that is supported for initializing a |Table| object (see\n  :ref:`construct_table`). This includes a table with a list of columns, a\n  dictionary of columns, or from `numpy` arrays (either structured or\n  homogeneous).\n\n**format**: output format (default='basic')\n  This specifies the format of the ASCII table to be written, such as a basic\n  character delimited table, fixed-format table, or a CDS-compatible table,\n  etc. The value of this parameter must be one of the :ref:`supported_formats`.\n\n**delimiter**: column delimiter string\n  A one-character string used to separate fields which typically defaults to\n  the space character. Other common values might be \",\" or \"|\" or \"\\\\t\".\n\n**comment**: string defining start of a comment line in output table\n  For the :class:`~astropy.io.ascii.Basic` Writer this defaults to \"# \".\n  Which comments are written and how depends on the format chosen.\n  The comments are defined as a list of strings in the input table\n  ``meta['comments']`` element. Comments in the metadata of the given\n  |Table| will normally be written before the header, although\n  :class:`~astropy.io.ascii.CommentedHeader` writes table comments after the\n  commented header. To disable writing comments, set ``comment=False``.\n\n**formats**: dict of data type converters\n  For each key (column name) use the given value to convert the column data to\n  a string. If the format value is string-like, then it is used as a Python\n  format statement (e.g., '%0.2f' % value). If it is a callable function, then\n  that function is called with a single argument containing the column value to\n  be converted. Example::\n\n    astropy.io.ascii.write(table, sys.stdout, formats={'XCENTER': '%12.1f',\n                                                 'YCENTER': lambda x: round(x, 1)},\n\n**names**: list of output column names\n  Define the complete list of output column names to write for the data table,\n  overriding the existing column names.\n\n**include_names**: list of names to include in output\n  From the list of column names found from the data table or the ``names``\n  parameter, select for output only columns within this list. If not supplied\n  then include all names.\n\n**exclude_names**: list of names to exclude from output\n  Exclude these names from the list of output columns. This is applied *after*\n  the ``include_names`` filtering. If not specified then no columns are excluded.\n\n**fill_values**: list of fill value specifiers\n  This can be used to fill missing values in the table or replace values with special meaning.\n\n  See the :ref:`replace_bad_or_missing_values` section for more information on\n  the syntax. The syntax is almost the same as when reading a table.\n  There is a special value ``astropy.io.ascii.masked`` that is used to say\n  \"output this string for all masked values in a masked table\" (the default is\n  to use an empty string ``\"\"``)::\n\n      >>> import sys\n      >>> from astropy.table import Table, Column, MaskedColumn\n      >>> from astropy.io import ascii\n      >>> t = Table([(1, 2), (3, 4)], names=('a', 'b'), masked=True)\n      >>> t['a'].mask = [True, False]\n      >>> ascii.write(t, sys.stdout)\n      a b\n      \"\" 3\n      2 4\n      >>> ascii.write(t, sys.stdout, fill_values=[(ascii.masked, 'N/A')])\n      a b\n      N/A 3\n      2 4\n\n  Note that when writing a table, all values are converted to strings before\n  any value is replaced. Because ``fill_values`` only replaces cells that\n  are an exact match to the specification, you need to provide the string\n  representation (stripped of whitespace) for each value. For example, in\n  the following commands ``-99`` is formatted with two digits after the\n  comma, so we need to replace ``-99.00`` and not ``-99``::\n\n      >>> t = Table([(-99, 2), (3, 4)], names=('a', 'b'))\n      >>> ascii.write(t, sys.stdout, fill_values = [('-99.00', 'no data')],\n      ...             formats={'a': '%4.2f'})\n      a b\n      \"no data\" 3\n      2.00 4\n\n  Similarly, if you replace a value in a column that has a fixed length format\n  (e.g., ``'f4.2'``), then the string you want to replace must have the same\n  number of characters. In the example above, ``fill_values=[(' nan',' N/A')]``\n  would work.\n\n**fill_include_names**: list of column names, which are affected by ``fill_values``\n  If not supplied, then ``fill_values`` can affect all columns.\n\n**fill_exclude_names**: list of column names, which are not affected by ``fill_values``\n  If not supplied, then ``fill_values`` can affect all columns.\n\n**fast_writer**: whether to use the fast Cython writer\n  If this parameter is ``None`` (which it is by default), |write| will attempt\n  to use the faster writer (described in :ref:`fast_ascii_io`) if possible.\n  Specifying ``fast_writer=False`` disables this behavior.\n\n**Writer** : Writer class (*deprecated* in favor of ``format``)\n  This specifies the top-level format of the ASCII table to be written, such as\n  a basic character delimited table, fixed-format table, or a CDS-compatible\n  table, etc. The value of this parameter must be a Writer class. For basic\n  usage this means one of the built-in :ref:`extension_reader_classes`.\n  Note that Reader classes and Writer classes are synonymous; in other\n  words, Reader classes can also write, but for historical reasons they are\n  often called Reader classes.\n\n.. _cds_mrt_format:\n\nMachine-Readable Table Format\n-----------------------------\n\nThe American Astronomical Society Journals' `Machine-Readable Table (MRT)\n<https://journals.aas.org/mrt-standards/>`_ format consists of single file with\nthe table description header and the table data itself. MRT is similar to the\n`CDS <http://vizier.u-strasbg.fr/doc/catstd.htx>`_ format standard, but differs\nin the table description sections and the lack of a separate ``ReadMe`` file.\nAstropy does not support writing in the CDS format.\n\nThe :class:`~astropy.io.ascii.Mrt` writer supports writing tables to MRT format.\n\n.. note::\n\n    The metadata of the table, apart from column ``unit``, ``name`` and\n    ``description``, are not written in the output file. Placeholders for\n    the title, authors, and table name fields are put into the output file and\n    can be edited after writing.\n\nExamples\n\"\"\"\"\"\"\"\"\n\n..\n  EXAMPLE START\n  Writing MRT Format Tables Using astropy.io.ascii\n\nThe command ``ascii.write(format='mrt')`` writes an ``astropy`` `~astropy.table.Table`\nto the MRT format. Section dividers ``---`` and ``===`` are used to divide the table\ninto different sections, with the last section always been the actual data.\n\nAs the MRT standard requires,\nfor columns that have a ``unit`` attribute not set to ``None``,\nthe unit names are tabulated in the Byte-By-Byte\ndescription of the column. When columns do not contain any units, ``---`` is put instead.\nA ``?`` is prefixed to the column description in the Byte-By-Byte for ``Masked``\ncolumns or columns that have null values, indicating them as such.\n\nThe example below initializes a table with columns that have a ``unit`` attribute and\nhas masked values.\n\n  >>> from astropy.io import ascii\n  >>> from astropy.table import Table, Column, MaskedColumn\n  >>> from astropy import units as u\n  >>> table = Table()\n  >>> table['Name'] = ['ASASSN-15lh', 'ASASSN-14li']\n  >>> # MRT Standard requires all quantities in SI units.\n  >>> temperature = [0.0334, 0.297] * u.K\n  >>> table['Temperature'] = temperature.to(u.keV, equivalencies=u.temperature_energy())\n  >>> table['nH'] = Column([0.025, 0.0188], unit=u.Unit(10**22))\n  >>> table['Flux'] = ([2.044 * 10**-11] * u.erg * u.cm**-2).to(u.Jy * u.Unit(10**12))\n  >>> table['Flux'] = MaskedColumn(table['Flux'], mask=[True, False])\n  >>> table['magnitude'] = [u.Magnitude(25), u.Magnitude(-9)]\n\nNote that for columns with `~astropy.time.Time`, `~astropy.time.TimeDelta` and related values,\nthe writer does not do any internal conversion or modification. These columns should be\nconverted to regular columns with proper ``unit`` and ``name`` attribute before writing\nthe table. Thus::\n\n  >>> from astropy.time import Time, TimeDelta\n  >>> from astropy.timeseries import TimeSeries\n  >>> ts = TimeSeries(time_start=Time('2019-01-01'), time_delta=2*u.day, n_samples=1)\n  >>> table['Obs'] = Column(ts.time.decimalyear, description='Time of Observation')\n  >>> table['Cadence'] = Column(TimeDelta(100.0, format='sec').datetime.seconds,\n  ...                           unit=u.s)\n\nColumns that are `~astropy.coordinates.SkyCoord` objects or columns with\nvalues that are such objects are recognized as such, and some predefined labels and\ndescription is used for them. Coordinate columns that have `~astropy.coordinates.SphericalRepresentation`\nare additionally sub-divided into their coordinate component columns. Representations that have\n``ra`` and ``dec`` components are divided into their ``hour``-``min``-``sec``\nand ``deg``-``arcmin``-``arcsec`` components respectively. Whereas columns with\n``SkyCoord`` objects in the ``Galactic`` or any of the ``Ecliptic`` frames are divided\ninto their latitude(``ELAT``/``GLAT``) and longitude components (``ELON``/``GLAT``) only.\nThe original table remains accessible as such, while the file is written from a modified\ncopy of the table. The new coordinate component columns are appended to the end of the table.\n\nIt should be noted that the default precision of the latitude, longitude and seconds (of arc)\ncolumns is set at a default number of 12, 10 and 9 digits after the decimal for ``deg``, ``sec``\nand ``arcsec`` values, respectively. This default is set to match a machine precision of 1e-15\nrelative to the original ``SkyCoord`` those columns were extracted from.\nAs all other columns, the format can be expliclty set by passing the ``formats`` keyword to the\n``write`` function or by setting the ``format`` attribute of individual columns (the latter\nwill only work for columns that are not decomposed).\nTo customize the number of significant digits, presicions should therefore be specified in the\n``formats`` dictionary for the *output* column names, such as\n``formats={'RAs': '07.4f', 'DEs': '06.3f'}`` or ``formats={'GLAT': '+10.6f', 'GLON': '9.6f'}``\nfor milliarcsecond accuracy. Note that the forms with leading zeros for the seconds and\nincluding the sign for latitudes are recommended for better consistency and readability.\n\nThe following code illustrates the above.\n\n  >>> from astropy.coordinates import SkyCoord\n  >>> table['coord'] = [SkyCoord.from_name('ASASSN-15lh'),\n  ...                   SkyCoord.from_name('ASASSN-14li')]  # doctest: +REMOTE_DATA\n  >>> table.write('coord_cols.dat', format='ascii.mrt')     # doctest: +SKIP\n  >>> table['coord'] = table['coord'].geocentrictrueecliptic  # doctest: +REMOTE_DATA\n  >>> table['Temperature'].format = '.5E' # Set default column format.\n  >>> table.write('ecliptic_cols.dat', format='ascii.mrt')    # doctest: +SKIP\n\nAfter execution, the contents of ``coords_cols.dat`` will be::\n\n  Title:\n  Authors:\n  Table:\n  ================================================================================\n  Byte-by-byte Description of file: table.dat\n  --------------------------------------------------------------------------------\n   Bytes Format Units  Label     Explanations\n  --------------------------------------------------------------------------------\n   1-11  A11     ---    Name        Description of Name\n  13-23  E11.6   keV    Temperature [0.0/0.01] Description of Temperature\n  25-30  F6.4    10+22  nH          [0.01/0.03] Description of nH\n  32-36  F5.3   10+12Jy Flux        ? Description of Flux\n  38-42  E5.1    mag    magnitude   [0.0/3981.08] Description of magnitude\n  44-49  F6.1    ---    Obs         [2019.0/2019.0] Time of Observation\n  51-53  I3      s      Cadence     [100] Description of Cadence\n  55-56  I2     h      RAh           Right Ascension (hour)\n  58-59  I2     min    RAm           Right Ascension (minute)\n  61-73  F13.10 s      RAs           Right Ascension (second)\n     75  A1     ---    DE-           Sign of Declination\n  76-77  I2     deg    DEd           Declination (degree)\n  79-80  I2     arcmin DEm           Declination (arcmin)\n  82-93  F12.9  arcsec DEs           Declination (arcsec)\n  --------------------------------------------------------------------------------\n  Notes:\n  --------------------------------------------------------------------------------\n  ASASSN-15lh 2.87819e-09 0.0250       1e-10 2019.0 100 22 02 15.4500000000 -61 39 34.599996000\n  ASASSN-14li 2.55935e-08 0.0188 2.044 4e+03 2019.0 100 12 48 15.2244072000 +17 46 26.496624000\n\nAnd the file ``ecliptic_cols.dat`` will look like::\n\n  Title:\n  Authors:\n  Table:\n  ================================================================================\n  Byte-by-byte Description of file: table.dat\n  --------------------------------------------------------------------------------\n   Bytes Format Units  Label     Explanations\n  --------------------------------------------------------------------------------\n   1- 11  A11     ---    Name        Description of Name\n  13- 23  E11.6   keV    Temperature [0.0/0.01] Description of Temperature\n  25- 30  F6.4    10+22  nH          [0.01/0.03] Description of nH\n  32- 36  F5.3   10+12Jy Flux        ? Description of Flux\n  38- 42  E5.1    mag    magnitude   [0.0/3981.08] Description of magnitude\n  44- 49  F6.1    ---    Obs         [2019.0/2019.0] Time of Observation\n  51- 53  I3      s      Cadence     [100] Description of Cadence\n  55- 70  F16.12  deg    ELON        Ecliptic Longitude (geocentrictrueecliptic)\n  72- 87  F16.12  deg    ELAT        Ecliptic Latitude (geocentrictrueecliptic)\n  --------------------------------------------------------------------------------\n  Notes:\n  --------------------------------------------------------------------------------\n  ASASSN-15lh 2.87819e-09 0.0250       1e-10 2019.0 100 306.224208650096 -45.621789850825\n  ASASSN-14li 2.55935e-08 0.0188 2.044 4e+03 2019.0 100 183.754980099243  21.051410763027\n\nFinally, MRT has some specific naming conventions for columns\n(`<https://journals.aas.org/mrt-labels/#reflab>`_). For example, if a column contains\nthe mean error for the data in a column named ``label``, then this column should be named ``e_label``.\nThese kinds of relative column naming cannot be enforced by the MRT writer\nbecause it does not know what the column data means and thus, the relation between the\ncolumns cannot be figured out. Therefore, it is up to the user to use ``Table.rename_columns``\nto appropriately rename any columns before writing the table to MRT format.\nThe following example shows a similar situation, using the option to send the output to\n``sys.stdout`` instead of a file::\n\n  >>> table['error'] = [1e4, 450] * u.Jy  # Error in the Flux values.\n  >>> outtab = table.copy()  # So that changes don't affect the original table.\n  >>> outtab.rename_column('error', 'e_Flux')\n  >>> # re-order so that related columns are placed next to eachother.\n  >>> outtab = outtab['Name', 'Obs', 'coord', 'Cadence', 'nH', 'magnitude',\n  ...                 'Temperature', 'Flux', 'e_Flux']  # doctest: +REMOTE_DATA\n\n  >>> ascii.write(outtab, format='mrt')  # doctest: +SKIP\n  Title:\n  Authors:\n  Table:\n  ================================================================================\n  Byte-by-byte Description of file: table.dat\n  --------------------------------------------------------------------------------\n   Bytes Format Units  Label     Explanations\n  --------------------------------------------------------------------------------\n   1- 11  A11     ---    Name        Description of Name\n  13- 18  F6.1    ---    Obs         [2019.0/2019.0] Time of Observation\n  20- 22  I3      s      Cadence     [100] Description of Cadence\n  24- 29  F6.4    10+22  nH          [0.01/0.03] Description of nH\n  31- 35  E5.1    mag    magnitude   [0.0/3981.08] Description of magnitude\n  37- 47  E11.6   keV    Temperature [0.0/0.01] Description of Temperature\n  49- 53  F5.3   10+12Jy Flux        ? Description of Flux\n  55- 61  F7.1    Jy     e_Flux      [450.0/10000.0] Description of e_Flux\n  63- 78  F16.12  deg    ELON        Ecliptic Longitude (geocentrictrueecliptic)\n  80- 95  F16.12  deg    ELAT        Ecliptic Latitude (geocentrictrueecliptic)\n  --------------------------------------------------------------------------------\n  Notes:\n  --------------------------------------------------------------------------------\n  ASASSN-15lh 2019.0 100 0.0250 1e-10 2.87819e-09       10000.0 306.224208650096 -45.621789850825\n  ASASSN-14li 2019.0 100 0.0188 4e+03 2.55935e-08 2.044   450.0 183.754980099243  21.051410763027\n\n..\n  EXAMPLE END\n\n.. attention::\n\n    The MRT writer currently supports automatic writing of a single coordinate column\n    in ``Tables``. For tables with more than one coordinate column of a given kind\n    (e.g. equatorial, galactic or ecliptic), only the first found coordinate column\n    will be decomposed into its component columns, and the rest of the coordinate\n    columns of the same type will be converted to string columns. Thus users should take\n    care that the additional coordinate columns are dealt with (e.g. by converting them\n    to unique ``float``-valued columns) before using ``SkyCoord`` methods.\n"},{"id":101,"name":"extension_classes.rst","nodeType":"TextFile","path":"docs/io/ascii","text":".. include:: references.txt\n\n.. _extension_reader_classes:\n\nExtension Reader Classes\n************************\n\nThe following classes extend the base :class:`~astropy.io.ascii.BaseReader` functionality to handle reading and writing\ndifferent table formats. Some, such as the :class:`~astropy.io.ascii.Basic` Reader class\nare fairly general and include a number of configurable attributes. Others\nsuch as :class:`~astropy.io.ascii.Cds` or :class:`~astropy.io.ascii.Daophot` are specialized to read certain\nwell-defined but idiosyncratic formats.\n\n* :class:`~astropy.io.ascii.AASTex`: AASTeX `deluxetable <https://fits.gsfc.nasa.gov/standard30/deluxetable.sty>`_ used for AAS journals.\n* :class:`~astropy.io.ascii.Basic`: basic table with customizable delimiters and header configurations.\n* :class:`~astropy.io.ascii.Cds`: `CDS format table <http://vizier.u-strasbg.fr/doc/catstd.htx>`_ (also Vizier and ApJ machine readable tables).\n* :class:`~astropy.io.ascii.CommentedHeader`: column names given in a line that begins with the comment character.\n* :class:`~astropy.io.ascii.Csv`: comma-separated values.\n* :class:`~astropy.io.ascii.Daophot`: table from the IRAF DAOphot package.\n* :class:`~astropy.io.ascii.FixedWidth`: table with fixed-width columns (see also :ref:`fixed_width_gallery`).\n* :class:`~astropy.io.ascii.FixedWidthNoHeader`: table with fixed-width columns and no header.\n* :class:`~astropy.io.ascii.FixedWidthTwoLine`: table with fixed-width columns and a two-line header.\n* :class:`~astropy.io.ascii.HTML`: HTML format table contained in a <table> tag.\n* :class:`~astropy.io.ascii.Ipac`: `IPAC format table <https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html>`_.\n* :class:`~astropy.io.ascii.Latex`: LaTeX table with datavalue in the ``tabular`` environment.\n* :class:`~astropy.io.ascii.Mrt`: `AAS Machine-Readable Table format <https://journals.aas.org/mrt-standards/>`_.\n* :class:`~astropy.io.ascii.NoHeader`: basic table with no header where columns are auto-named.\n* :class:`~astropy.io.ascii.Rdb`: tab-separated values with an extra line after the column definition line.\n* :class:`~astropy.io.ascii.RST`: `reStructuredText simple format table <https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#simple-tables>`_.\n* :class:`~astropy.io.ascii.SExtractor`: `SExtractor format table <https://sextractor.readthedocs.io/en/latest/>`_.\n* :class:`~astropy.io.ascii.Tab`: tab-separated values.\n"},{"id":102,"name":"fast_ascii_io.rst","nodeType":"TextFile","path":"docs/io/ascii","text":".. include:: references.txt\n\n.. _fast_ascii_io:\n\nFast ASCII I/O\n**************\n\nWhile :mod:`astropy.io.ascii` was designed with flexibility and extensibility\nin mind, there is also a less flexible but significantly faster Cython/C engine\nfor reading and writing ASCII files. By default, |read| and |write| will\nattempt to use this engine when dealing with compatible formats. The following\nformats are currently compatible with the fast engine:\n\n * ``basic``\n * ``commented_header``\n * ``csv``\n * ``no_header``\n * ``rdb``\n * ``tab``\n\nThe fast engine can also be enabled through the format parameter by prefixing\na compatible format with \"fast\" and then an underscore. In this case, or\nwhen enforcing the fast engine by either setting ``fast_reader='force'``\nor explicitly setting any of the :ref:`fast_conversion_opts`, |read|\nwill not fall back on an ordinary reader if fast reading fails.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Read and Write a CSV File Using Fast ASCII\n\nTo open a CSV file and write it back out::\n\n   >>> from astropy.table import Table\n   >>> t = ascii.read('file.csv', format='fast_csv')  # doctest: +SKIP\n   >>> t.write('output.csv', format='ascii.fast_csv')  # doctest: +SKIP\n\nTo disable the fast engine, specify ``fast_reader=False`` or\n``fast_writer=False``. For example::\n\n   >>> t = ascii.read('file.csv', format='csv', fast_reader=False) # doctest: +SKIP\n   >>> t.write('file.csv', format='csv', fast_writer=False) # doctest: +SKIP\n\n.. Note:: Guessing and Fast reading\n\n   By default |read| will try to guess the format of the input data by\n   successively trying different formats until one succeeds\n   (see the section on :ref:`guess_formats`). For each supported\n   format it will first try the fast, then the slow version of that\n   reader. Without any additional options this means that both some pure\n   Python readers with no fast implementation and the Python versions\n   of some readers will be tried before getting to some of the fast\n   readers. To bypass them entirely, a fast reader should be explicitly\n   requested as above.\n\n   **For optimum performance** however, it is recommended to turn off\n   guessing entirely (``guess=False``) or narrow down the format options\n   as much as possible by specifying the format (e.g., ``format='csv'``)\n   and/or other options such as the delimiter.\n\n..\n  EXAMPLE END\n\nReading\n=======\n\nSince the fast engine is not part of the ordinary :mod:`astropy.io.ascii`\ninfrastructure, fast readers raise an error when passed certain\nparameters which are not implemented in the fast reader infrastructure.\nIn this case |read| will fall back on the ordinary reader, unless the\nfast reader has been explicitly requested (see above).\nThese parameters are:\n\n * Negative ``header_start`` (except for commented-header format)\n * Negative ``data_start``\n * ``data_start=None``\n * ``comment`` string not of length 1\n * ``delimiter`` string not of length 1\n * ``quotechar`` string not of length 1\n * ``converters``\n * ``Outputter``\n * ``Inputter``\n * ``data_Splitter``\n * ``header_Splitter``\n\n.. _fast_conversion_opts:\n\nParallel and Fast Conversion Options\n------------------------------------\n\nIn addition to ``True`` and ``False``, the parameter ``fast_reader`` can also\nbe a ``dict`` specifying any of three additional parameters, ``parallel``,\n``use_fast_converter`` and ``exponent_style``.\n\nExample\n=======\n\n..\n  EXAMPLE START\n  Parallel and Fast Conversion Options for Faster Table Reading\n\nTo specify additional parameters using ``fast_reader``::\n\n   >>> ascii.read('data.txt', format='basic',\n   ...            fast_reader={'parallel': True, 'use_fast_converter': True}) # doctest: +SKIP\n\n..\n  EXAMPLE END\n\nThese options allow for even faster table reading when enabled, but both are\ndisabled by default because they come with some caveats.\n\nThe ``parallel`` parameter can be used to enable multiprocessing via\nthe ``multiprocessing`` module, and can either be set to a number (the number\nof processes to use) or ``True``, in which case the number of processes will be\n``multiprocessing.cpu_count()``. Note that this can cause issues within the\nIPython Notebook and so enabling multiprocessing in this context is discouraged.\n\nSetting ``use_fast_converter`` to be ``True`` enables a faster but\nslightly imprecise conversion method for floating-point values, as described\nbelow.\n\nThe ``exponent_style`` parameter allows to define a different character\nfrom the default ``'e'`` for exponential formats in the input file.\nThe special setting ``'fortran'`` enables auto-detection of any valid\nexponent character under Fortran notation. For details see the section on\n:ref:`fortran_style_exponents`.\n\nFast Converter\n--------------\n\nInput floating-point values should ideally be converted to the\nnearest possible floating-point approximation; that is, the conversion\nshould be correct within half of the distance between the two closest\nrepresentable values, or 0.5 `ULP\n<https://en.wikipedia.org/wiki/Unit_in_the_last_place>`__. The ordinary readers,\nas well as the default fast reader, are guaranteed to convert floating-point\nvalues within 0.5 ULP, but there is also a faster and less accurate\nconversion method accessible via ``use_fast_converter``. If the input\ndata has less than about fifteen significant figures, or if accuracy is\nrelatively unimportant, this converter might be the best option in\nperformance-critical scenarios.\n\nFor values with a reasonably small number of\nsignificant figures, the fast converter is guaranteed to produce an optimal\nconversion (within 0.5 ULP). Once the number of significant figures exceeds\nthe precision of 64-bit floating-point values, the fast converter is no\nlonger guaranteed to be within 0.5 ULP, but about 60% of values end up\nwithin 0.5 ULP and about 90% within 1.0 ULP.\n\nReading Large Tables\n--------------------\n\nFor reading very large tables using the fast reader, see the section on\n:ref:`chunk_reading`.\n\nWriting\n=======\n\nThe fast engine supports the same functionality as the ordinary writing engine\nand is generally about two to four times faster than the ordinary engine.\nThe speed advantage of the faster engine is greatest for integer data and least\nfor floating-point data; the fast engine is around 3.6 times faster for a\nsample file including a mixture of floating-point, integer, and text data.\nAlso note that stripping string values slows down the writing process, so\nspecifying ``strip_whitespace=False`` can improve performance.\n\nSpeed Gains\n===========\n\nThe fast ASCII engine was designed based on the general parsing strategy\nused in the `Pandas <https://pandas.pydata.org/>`__ data analysis library, so\nits performance is generally comparable (although slightly slower by\ndefault) to the Pandas ``read_csv`` method.\n\nThe ``genfromtxt`` and the ordinary :mod:`astropy.io.ascii` reader\nare very similar in terms of speed, while ``read_csv`` is slightly faster\nthan the fast engine for integer and floating-point data; for pure\nfloating-point data, enabling the fast converter yields a speedup of about\n50%. Also note that Pandas uses the exact same method as the fast\nconverter in Astropy when converting floating-point data.\n\nThe difference in performance between the fast engine and Pandas for\ntext data depends on the extent to which data values are repeated, as\nPandas is almost twice as fast as the fast engine when every value is\nidentical and the reverse is true when values are randomized. This is\nbecause the fast engine uses fixed-size NumPy string arrays for\ntext data, while Pandas uses variable-size object arrays and uses an\nunderlying set to avoid copying repeated values.\n\nOverall, the fast engine tends to be around four or five times faster than\nthe ordinary ASCII engine. If the input data is very large (generally\nabout 100,000 rows or greater), and particularly if the data does not\ncontain primarily integer data or repeated string values, specifying\n``parallel`` as ``True`` can yield further performance gains. Although\nIPython does not work well with ``multiprocessing``, there is a\n`script <https://github.com/mdmueller/ascii-profiling/blob/master/parallel.py>`__\navailable for testing the performance of the fast engine in parallel,\nand a sample result may be viewed `here\n<http://mdmueller.github.io/ascii-profiling/>`__. This profile uses the\nfast converter for both the serial and parallel Astropy\nreaders.\n\nAnother point worth noting is that the fast engine uses memory mapping\nif a filename is supplied as input. If you want to avoid this for whatever\nreason, supply an open file object instead. However, this will generally\nbe less efficient from both a time and a memory perspective, as the entire\nfile input will have to be read at once.\n"},{"id":103,"name":"docs/io/votable","nodeType":"Package"},{"id":104,"name":"index.rst","nodeType":"TextFile","path":"docs/io/votable","text":".. doctest-skip-all\n\n.. include:: references.txt\n\n.. _astropy-io-votable:\n\n*******************************************\nVOTable XML Handling (`astropy.io.votable`)\n*******************************************\n\nIntroduction\n============\n\nThe `astropy.io.votable` sub-package converts VOTable XML files to and\nfrom ``numpy`` record arrays. This subpackage was originally developed\nas ``vo.table``.\n\nGetting Started\n===============\n\nThis section provides a quick introduction of using :mod:`astropy.io.votable`. The\ngoal is to demonstrate the package's basic features without getting into too\nmuch detail.\n\n.. note::\n\n    If you want to read or write a single table in VOTable format, the\n    recommended method is via the high-level :ref:`table_io`. In particular\n    see the :ref:`Unified I/O VOTables <table_io_votable>` section.\n\nReading a VOTable File\n----------------------\n\nTo read in a VOTable file, pass a file path to\n`~astropy.io.votable.parse`::\n\n    from astropy.io.votable import parse\n    votable = parse(\"votable.xml\")\n\n``votable`` is a `~astropy.io.votable.tree.VOTableFile` object, which\ncan be used to retrieve and manipulate the data and save it back out\nto disk.\n\nVOTable files are made up of nested ``RESOURCE`` elements, each of\nwhich may contain one or more ``TABLE`` elements. The ``TABLE``\nelements contain the arrays of data.\n\nTo get at the ``TABLE`` elements, you can write a loop over the\nresources in the ``VOTABLE`` file::\n\n    for resource in votable.resources:\n        for table in resource.tables:\n            # ... do something with the table ...\n            pass\n\nHowever, if the nested structure of the resources is not important,\nyou can use `~astropy.io.votable.tree.VOTableFile.iter_tables` to\nreturn a flat list of all tables::\n\n    for table in votable.iter_tables():\n        # ... do something with the table ...\n        pass\n\nFinally, if you expect only one table in the file, it might be most convenient\nto use `~astropy.io.votable.tree.VOTableFile.get_first_table`::\n\n  table = votable.get_first_table()\n\nAlternatively, there is a convenience method to parse a VOTable file and\nreturn the first table all in one step::\n\n  from astropy.io.votable import parse_single_table\n  table = parse_single_table(\"votable.xml\")\n\nFrom a `~astropy.io.votable.tree.Table` object, you can get the data itself\nin the ``array`` member variable::\n\n  data = table.array\n\nThis data is a ``numpy`` record array.\n\nThe columns get their names from both the ``ID`` and ``name``\nattributes of the ``FIELD`` elements in the ``VOTABLE`` file.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Reading a VOTable File with astropy.io.votable\n\nSuppose we had a ``FIELD`` specified as follows:\n\n.. code-block:: xml\n\n   <FIELD ID=\"Dec\" name=\"dec_targ\" datatype=\"char\" ucd=\"POS_EQ_DEC_MAIN\"\n          unit=\"deg\">\n    <DESCRIPTION>\n     representing the ICRS declination of the center of the image.\n    </DESCRIPTION>\n   </FIELD>\n\n.. note::\n\n    The mapping from VOTable ``name`` and ``ID`` attributes to ``numpy``\n    dtype ``names`` and ``titles`` is highly confusing.\n\n    In VOTable, ``ID`` is guaranteed to be unique, but is not\n    required. ``name`` is not guaranteed to be unique, but is\n    required.\n\n    In ``numpy`` record dtypes, ``names`` are required to be unique and\n    are required. ``titles`` are not required, and are not required\n    to be unique.\n\n    Therefore, VOTable's ``ID`` most closely maps to ``numpy``'s\n    ``names``, and VOTable's ``name`` most closely maps to ``numpy``'s\n    ``titles``. However, in some cases where a VOTable ``ID`` is not\n    provided, a ``numpy`` ``name`` will be generated based on the VOTable\n    ``name``. Unfortunately, VOTable fields do not have an attribute\n    that is both unique and required, which would be the most\n    convenient mechanism to uniquely identify a column.\n\n    When converting from an `astropy.io.votable.tree.Table` object to\n    an `astropy.table.Table` object, you can specify whether to give\n    preference to ``name`` or ``ID`` attributes when naming the\n    columns. By default, ``ID`` is given preference. To give\n    ``name`` preference, pass the keyword argument\n    ``use_names_over_ids=True``::\n\n      >>> votable.get_first_table().to_table(use_names_over_ids=True)\n\nThis column of data can be extracted from the record array using::\n\n  >>> table.array['dec_targ']\n  array([17.15153360566, 17.15153360566, 17.15153360566, 17.1516686826,\n         17.1516686826, 17.1516686826, 17.1536197136, 17.1536197136,\n         17.1536197136, 17.15375479055, 17.15375479055, 17.15375479055,\n         17.1553884541, 17.15539736932, 17.15539752176,\n         17.25736014763,\n         # ...\n         17.2765703], dtype=object)\n\nor equivalently::\n\n  >>> table.array['Dec']\n  array([17.15153360566, 17.15153360566, 17.15153360566, 17.1516686826,\n         17.1516686826, 17.1516686826, 17.1536197136, 17.1536197136,\n         17.1536197136, 17.15375479055, 17.15375479055, 17.15375479055,\n         17.1553884541, 17.15539736932, 17.15539752176,\n         17.25736014763,\n         # ...\n         17.2765703], dtype=object)\n\n..\n  EXAMPLE END\n\nBuilding a New Table from Scratch\n---------------------------------\n\nIt is also possible to build a new table, define some field datatypes,\nand populate it with data.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Building a New Table from a VOTable File\n\nTo build a new table from a VOTable file::\n\n  from astropy.io.votable.tree import VOTableFile, Resource, Table, Field\n\n  # Create a new VOTable file...\n  votable = VOTableFile()\n\n  # ...with one resource...\n  resource = Resource()\n  votable.resources.append(resource)\n\n  # ... with one table\n  table = Table(votable)\n  resource.tables.append(table)\n\n  # Define some fields\n  table.fields.extend([\n          Field(votable, name=\"filename\", datatype=\"char\", arraysize=\"*\"),\n          Field(votable, name=\"matrix\", datatype=\"double\", arraysize=\"2x2\")])\n\n  # Now, use those field definitions to create the numpy record arrays, with\n  # the given number of rows\n  table.create_arrays(2)\n\n  # Now table.array can be filled with data\n  table.array[0] = ('test1.xml', [[1, 0], [0, 1]])\n  table.array[1] = ('test2.xml', [[0.5, 0.3], [0.2, 0.1]])\n\n  # Now write the whole thing to a file.\n  # Note, we have to use the top-level votable file object\n  votable.to_xml(\"new_votable.xml\")\n\n..\n  EXAMPLE END\n\nOutputting a VOTable File\n-------------------------\n\nThis section describes writing table data in the VOTable format using the\n`~astropy.io.votable` package directly. For some cases, however, the high-level\n:ref:`table_io` will often suffice and is somewhat more convenient to use. See\nthe :ref:`Unified I/O VOTable <table_io_votable>` section for details.\n\nTo save a VOTable file, call the\n`~astropy.io.votable.tree.VOTableFile.to_xml` method. It accepts\neither a string or Unicode path, or a Python file-like object::\n\n  votable.to_xml('output.xml')\n\nThere are a number of data storage formats supported by\n`astropy.io.votable`. The ``TABLEDATA`` format is XML-based and\nstores values as strings representing numbers. The ``BINARY`` format\nis more compact, and stores numbers in base64-encoded binary. VOTable\nversion 1.3 adds the ``BINARY2`` format, which allows for masking of\nany data type, including integers and bit fields which cannot be\nmasked in the older ``BINARY`` format. The storage format can be set\non a per-table basis using the `~astropy.io.votable.tree.Table.format`\nattribute, or globally using the\n`~astropy.io.votable.tree.VOTableFile.set_all_tables_format` method::\n\n  votable.get_first_table().format = 'binary'\n  votable.set_all_tables_format('binary')\n  votable.to_xml('binary.xml')\n\nUsing `astropy.io.votable`\n==========================\n\nStandard Compliance\n-------------------\n\n`astropy.io.votable.tree.Table` supports the `VOTable Format Definition\nVersion 1.1\n<https://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html>`_,\n`Version 1.2\n<https://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html>`_,\n`Version 1.3\n<https://www.ivoa.net/documents/VOTable/20130920/REC-VOTable-1.3-20130920.html>`_,\nand `Version 1.4\n<https://www.ivoa.net/documents/VOTable/20191021/REC-VOTable-1.4-20191021.html>`_.\nSome flexibility is provided to support the 1.0 draft version and\nother nonstandard usage in the wild, see :ref:`verifying-votables` for more\ndetails.\n\n.. note::\n\n  Each warning and VOTABLE-specific exception emitted has a number and\n  is documented in more detail in :ref:`warnings` and\n  :ref:`exceptions`.\n\nOutput always conforms to the 1.1, 1.2, 1.3, or 1.4 spec, depending on the\ninput.\n\n.. _verifying-votables:\n\nVerifying VOTables\n^^^^^^^^^^^^^^^^^^\n\nMany VOTable files in the wild do not conform to the VOTable specification. You\ncan set what should happen when a violation is encountered with the ``verify``\nkeyword, which can take three values:\n\n    * ``'ignore'`` - Attempt to parse the VOTable silently. This is the default\n      setting.\n    * ``'warn'`` - Attempt to parse the VOTable, but raise appropriate\n      :ref:`warnings`. It is possible to limit the number of warnings of the\n      same type to a maximum value using the\n      `astropy.io.votable.exceptions.conf.max_warnings\n      <astropy.io.votable.exceptions.Conf.max_warnings>` item in the\n      :ref:`astropy_config`.\n    * ``'exception'`` - Do not parse the VOTable and raise an exception.\n\nThe ``verify`` keyword can be used with the :func:`~astropy.io.votable.parse`\nor :func:`~astropy.io.votable.parse_single_table` functions::\n\n  from astropy.io.votable import parse\n  votable = parse(\"votable.xml\", verify='warn')\n\nIt is possible to change the default ``verify`` value through the\n`astropy.io.votable.conf.verify <astropy.io.votable.Conf.verify>` item in the\n:ref:`astropy_config`.\n\nNote that ``'ignore'`` or ``'warn'``  mean that ``astropy`` will attempt to\nparse the VOTable, but if the specification has been violated then success\ncannot be guaranteed.\n\nIt is good practice to report any errors to the author of the application that\ngenerated the VOTable file to bring the file into compliance with the\nspecification.\n\nMissing Values\n--------------\n\nAny value in the table may be \"missing\". `astropy.io.votable` stores\na  ``numpy`` masked array in each `~astropy.io.votable.tree.Table`\ninstance. This behaves like an ordinary ``numpy`` masked array, except\nfor variable-length fields. For those fields, the datatype of the\ncolumn is \"object\" and another ``numpy`` masked array is stored there.\nTherefore, operations on variable-length columns will not work — this\nis because variable-length columns are not directly supported\nby ``numpy`` masked arrays.\n\nDatatype Mappings\n-----------------\n\nThe datatype specified by a ``FIELD`` element is mapped to a ``numpy``\ntype according to the following table:\n\n  ================================ =========================\n  VOTABLE type                     NumPy type\n  ================================ =========================\n  boolean                          b1\n  -------------------------------- -------------------------\n  bit                              b1\n  -------------------------------- -------------------------\n  unsignedByte                     u1\n  -------------------------------- -------------------------\n  char (*variable length*)         O - A ``bytes()`` object.\n  -------------------------------- -------------------------\n  char (*fixed length*)            S\n  -------------------------------- -------------------------\n  unicodeChar (*variable length*)  O - A `str` object\n  -------------------------------- -------------------------\n  unicodeChar (*fixed length*)     U\n  -------------------------------- -------------------------\n  short                            i2\n  -------------------------------- -------------------------\n  int                              i4\n  -------------------------------- -------------------------\n  long                             i8\n  -------------------------------- -------------------------\n  float                            f4\n  -------------------------------- -------------------------\n  double                           f8\n  -------------------------------- -------------------------\n  floatComplex                     c8\n  -------------------------------- -------------------------\n  doubleComplex                    c16\n  ================================ =========================\n\nIf the field is a fixed-size array, the data is stored as a ``numpy``\nfixed-size array.\n\nIf the field is a variable-size array (that is, ``arraysize`` contains\na '*'), the cell will contain a Python list of ``numpy`` values. Each\nvalue may be either an array or scalar depending on the ``arraysize``\nspecifier.\n\nExamining Field Types\n---------------------\n\nTo look up more information about a field in a table, you can use the\n`~astropy.io.votable.tree.Table.get_field_by_id` method, which returns\nthe `~astropy.io.votable.tree.Field` object with the given ID.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Examining Field Types in VOTables with astropy.io.votable\n\nTo look up more information about a field::\n\n  >>> field = table.get_field_by_id('Dec')\n  >>> field.datatype\n  'char'\n  >>> field.unit\n  'deg'\n\n.. note::\n   Field descriptors should not be mutated. To change the set of\n   columns, convert the Table to an `astropy.table.Table`, make the\n   changes, and then convert it back.\n\n..\n  EXAMPLE END\n\n.. _votable-serialization:\n\nData Serialization Formats\n--------------------------\n\nVOTable supports a number of different serialization formats.\n\n- `TABLEDATA\n  <http://www.ivoa.net/documents/VOTable/20130920/REC-VOTable-1.3-20130920.html#ToC36>`__\n  stores the data in pure XML, where the numerical values are written\n  as human-readable strings.\n\n- `BINARY\n  <http://www.ivoa.net/documents/VOTable/20130920/REC-VOTable-1.3-20130920.html#ToC38>`__\n  is a binary representation of the data, stored in the XML as an\n  opaque ``base64``-encoded blob.\n\n- `BINARY2\n  <http://www.ivoa.net/documents/VOTable/20130920/REC-VOTable-1.3-20130920.html#ToC39>`__\n  was added in VOTable 1.3, and is identical to \"BINARY\", except that\n  it explicitly records the position of missing values rather than\n  identifying them by a special value.\n\n- `FITS\n  <http://www.ivoa.net/documents/VOTable/20130920/REC-VOTable-1.3-20130920.html#ToC37>`__\n  stores the data in an external FITS file. This serialization is not\n  supported by the `astropy.io.votable` writer, since it requires\n  writing multiple files.\n\nThe serialization format can be selected in two ways:\n\n    1) By setting the ``format`` attribute of a\n    `astropy.io.votable.tree.Table` object::\n\n        votable.get_first_table().format = \"binary\"\n        votable.to_xml(\"new_votable.xml\")\n\n    2) By overriding the format of all tables using the\n    ``tabledata_format`` keyword argument when writing out a VOTable\n    file::\n\n        votable.to_xml(\"new_votable.xml\", tabledata_format=\"binary\")\n\nConverting to/from an `astropy.table.Table`\n-------------------------------------------\n\nThe VOTable standard does not map conceptually to an\n`astropy.table.Table`. However, a single table within the ``VOTable``\nfile may be converted to and from an `astropy.table.Table`::\n\n  from astropy.io.votable import parse_single_table\n  table = parse_single_table(\"votable.xml\").to_table()\n\nAs a convenience, there is also a function to create an entire VOTable\nfile with just a single table::\n\n  from astropy.io.votable import from_table, writeto\n  votable = from_table(table)\n  writeto(votable, \"output.xml\")\n\n.. note::\n\n  By default, ``to_table`` will use the ``ID`` attribute from the files to\n  create the column names for the `~astropy.table.Table` object. However,\n  it may be that you want to use the ``name`` attributes instead. For this,\n  set the ``use_names_over_ids`` keyword to `True`. Note that since field\n  ``names`` are not guaranteed to be unique in the VOTable specification,\n  but column names are required to be unique in ``numpy`` structured arrays (and\n  thus `astropy.table.Table` objects), the names may be renamed by appending\n  numbers to the end in some cases.\n\nPerformance Considerations\n--------------------------\n\nFile reads will be moderately faster if the ``TABLE`` element includes\nan nrows_ attribute. If the number of rows is not specified, the\nrecord array must be resized repeatedly during load.\n\n.. _nrows: http://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html#ToC10\n\nSee Also\n========\n\n- `VOTable Format Definition Version 1.1\n  <https://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html>`_\n\n- `VOTable Format Definition Version 1.2\n  <https://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html>`_\n\n- `VOTable Format Definition Version 1.3\n  <https://www.ivoa.net/documents/VOTable/20130920/REC-VOTable-1.3-20130920.html>`_\n\n- `VOTable Format Definition Version 1.4\n  <https://www.ivoa.net/documents/VOTable/20191021/REC-VOTable-1.4-20191021.html>`_\n\n.. note that if this section gets too long, it should be moved to a separate\n   doc page - see the top of performance.inc.rst for the instructions on how to do\n   that\n.. include:: performance.inc.rst\n\nReference/API\n=============\n\n.. automodapi:: astropy.io.votable\n   :no-inheritance-diagram:\n   :skip: VOWarning\n   :skip: VOTableChangeWarning\n   :skip: VOTableSpecWarning\n   :skip: UnimplementedWarning\n   :skip: IOWarning\n   :skip: VOTableSpecError\n\n.. automodapi:: astropy.io.votable.tree\n   :no-inheritance-diagram:\n\n.. automodapi:: astropy.io.votable.converters\n   :no-inheritance-diagram:\n\n.. automodapi:: astropy.io.votable.ucd\n   :no-inheritance-diagram:\n\n.. automodapi:: astropy.io.votable.util\n   :no-inheritance-diagram:\n\n.. automodapi:: astropy.io.votable.validator\n   :no-inheritance-diagram:\n\n.. automodapi:: astropy.io.votable.xmlutil\n   :no-inheritance-diagram:\n\n\nastropy.io.votable.exceptions Module\n------------------------------------\n\n.. toctree::\n   :maxdepth: 1\n\n   api_exceptions.rst\n"},{"id":105,"name":"api_exceptions.rst","nodeType":"TextFile","path":"docs/io/votable","text":".. include:: references.txt\n\n`astropy.io.votable.exceptions`\n*******************************\n\n.. contents::\n\n.. automodule:: astropy.io.votable.exceptions\n\nException Utilities\n===================\n\n.. currentmodule:: astropy.io.votable.exceptions\n\n.. autoclass:: Conf\n   :members:\n\n.. autofunction:: warn_or_raise\n\n.. autofunction:: vo_raise\n\n.. autofunction:: vo_reraise\n\n.. autofunction:: vo_warn\n\n.. autofunction:: parse_vowarning\n\n.. autoclass:: VOWarning\n   :show-inheritance:\n\n.. autoclass:: VOTableChangeWarning\n   :show-inheritance:\n\n.. autoclass:: VOTableSpecWarning\n   :show-inheritance:\n\n.. autoclass:: UnimplementedWarning\n   :show-inheritance:\n\n.. autoclass:: IOWarning\n   :show-inheritance:\n\n.. autoclass:: VOTableSpecError\n   :show-inheritance:\n"},{"id":106,"name":".gitignore","nodeType":"TextFile","path":"docs/io/votable","text":"warnings.rst\nexceptions.rst\n"},{"id":107,"name":"references.txt","nodeType":"TextFile","path":"docs/io/votable","text":".. _BINARY: http://www.ivoa.net/documents/PR/VOTable/VOTable-20040322.html#ToC27\n.. _BINARY2: http://www.ivoa.net/documents/VOTable/20130315/PR-VOTable-1.3-20130315.html#sec:BIN2\n.. _COOSYS: http://www.ivoa.net/documents/VOTable/20191021/REC-VOTable-1.4-20191021.html#ToC20\n.. _DESCRIPTION: http://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html#ToC19\n.. _FIELD: http://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html#ToC24\n.. _FIELDref: http://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html#ToC31\n.. _FITS: https://fits.gsfc.nasa.gov/fits_documentation.html\n.. _GROUP: http://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html#ToC31\n.. _ID: http://www.w3.org/TR/REC-xml/#id\n.. _INFO: http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC19\n.. _LINK: http://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html#ToC22\n.. _multidimensional arrays: http://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html#ToC12\n.. _numerical accuracy: http://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html#ToC26\n.. _PARAM: http://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html#ToC24\n.. _PARAMref: http://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html#ToC31\n.. _RESOURCE: http://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html#ToC21\n.. _TABLE: http://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html#ToC23\n.. _TABLEDATA: http://www.ivoa.net/documents/PR/VOTable/VOTable-20040322.html#ToC25\n.. _TIMESYS: http://www.ivoa.net/documents/VOTable/20191021/REC-VOTable-1.4-20191021.html#ToC21\n.. _unified content descriptor: http://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html#ToC28\n.. _unique type: http://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html#ToC29\n.. _units: http://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html#ToC27\n.. _VALUES: http://www.ivoa.net/documents/REC/VOTable/VOTable-20040811.html#ToC30\n.. _VOTABLE: http://www.ivoa.net/documents/PR/VOTable/VOTable-20040322.html#ToC9\n"},{"id":108,"name":"performance.inc.rst","nodeType":"TextFile","path":"docs/io/votable","text":".. note that if this is changed from the default approach of using an *include*\n   (in index.rst) to a separate performance page, the header needs to be changed\n   from === to ***, the filename extension needs to be changed from .inc.rst to\n   .rst, and a link needs to be added in the subpackage toctree\n\n.. _astropy-io-votable-performance:\n\n.. Performance Tips\n.. ================\n..\n.. Here we provide some tips and tricks for how to optimize performance of code\n.. using `astropy.io.votable`.\n"},{"id":109,"name":"docs/wcs","nodeType":"Package"},{"id":110,"name":"loading_from_fits.rst","nodeType":"TextFile","path":"docs/wcs","text":"Loading WCS Information from a FITS File\n----------------------------------------\n\nThis example loads a FITS file (supplied on the command line) and uses\nthe FITS keywords in its primary header to create a WCS and transform.\n\n.. literalinclude:: examples/from_file.py\n   :language: python\n"},{"id":111,"name":"relax.rst","nodeType":"TextFile","path":"docs/wcs","text":".. _relax:\n\nThe ``relax`` keyword argument controls the handling of non-standard\nFITS WCS keywords.\n\nNote that the default value of ``relax`` is `True` for reading (to\naccept all non standard keywords), and `False` for writing (to write\nout only standard keywords), in accordance with `Postel's prescription\n<http://catb.org/jargon/html/P/Postels-Prescription.html>`_:\n\n    “Be liberal in what you accept, and conservative in what you send.”\n\n.. _relaxread:\n\nHeader-reading relaxation constants\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n`~astropy.wcs.WCS`, `~astropy.wcs.Wcsprm` and\n`~astropy.wcs.find_all_wcs` have a *relax* argument, which may be\neither `True`, `False` or an `int`.\n\n- If `True`, (default), all non-standard WCS extensions recognized by the parser\n  will be handled.\n\n- If `False`, none of the extensions (even those in the\n  errata) will be handled.  Non-conformant keywords will be handled in\n  the same way as non-WCS keywords in the header, i.e. by simply\n  ignoring them.\n\n- If an `int`, is is a bit field to provide fine-grained control over\n  what non-standard WCS keywords to accept.  The flag bits are subject\n  to change in future and should be set by using the constants\n  beginning with ``WCSHDR_`` in the `astropy.wcs` module.\n\n  For example, to accept ``CD00i00j`` and ``PC00i00j`` use::\n\n      relax = astropy.wcs.WCSHDR_CD00i00j | astropy.wcs.WCSHDR_PC00i00j\n\n  The parser always treats ``EPOCH`` as subordinate to ``EQUINOXa`` if\n  both are present, and ``VSOURCEa`` is always subordinate to\n  ``ZSOURCEa``.\n\n  Likewise, ``VELREF`` is subordinate to the formalism of WCS Paper\n  III.\n\nThe flag bits are:\n\n- ``WCSHDR_none``: Don't accept any extensions (not even those in the\n  errata).  Treat non-conformant keywords in the same way as non-WCS\n  keywords in the header, i.e. simply ignore them.  (This is\n  equivalent to passing `False`)\n\n- ``WCSHDR_all``: Accept all extensions recognized by the parser.  (This\n  is equivalent to the default behavior or passing `True`).\n\n- ``WCSHDR_reject``: Reject non-standard keyrecords (that are not\n  otherwise explicitly accepted by one of the flags below).  A warning\n  will be displayed by default.\n\n  This flag may be used to signal the presence of non-standard\n  keywords, otherwise they are simply passed over as though they did\n  not exist in the header.  It is mainly intended for testing\n  conformance of a FITS header to the WCS standard.\n\n  Keyrecords may be non-standard in several ways:\n\n  - The keyword may be syntactically valid but with keyvalue of\n    incorrect type or invalid syntax, or the keycomment may be\n    malformed.\n\n  - The keyword may strongly resemble a WCS keyword but not, in fact,\n    be one because it does not conform to the standard.  For example,\n    ``CRPIX01`` looks like a ``CRPIXja`` keyword, but in fact the\n    leading zero on the axis number violates the basic FITS standard.\n    Likewise, ``LONPOLE2`` is not a valid ``LONPOLEa`` keyword in the\n    WCS standard, and indeed there is nothing the parser can sensibly\n    do with it.\n\n  - Use of the keyword may be deprecated by the standard.  Such will\n    be rejected if not explicitly accepted via one of the flags below.\n\n- ``WCSHDR_CROTAia``: Accept ``CROTAia``, ``iCROTna``, ``TCROTna``\n- ``WCSHDR_EPOCHa``:  Accept ``EPOCHa``.\n- ``WCSHDR_VELREFa``: Accept ``VELREFa``.\n\n        The constructor always recognizes the AIPS-convention\n        keywords, ``CROTAn``, ``EPOCH``, and ``VELREF`` for the\n        primary representation ``(a = ' ')`` but alternates are\n        non-standard.\n\n        The constructor accepts ``EPOCHa`` and ``VELREFa`` only if\n        ``WCSHDR_AUXIMG`` is also enabled.\n\n- ``WCSHDR_CD00i00j``: Accept ``CD00i00j``.\n- ``WCSHDR_PC00i00j``: Accept ``PC00i00j``.\n- ``WCSHDR_PROJPn``: Accept ``PROJPn``.\n\n        These appeared in early drafts of WCS Paper I+II (before they\n        were split) and are equivalent to ``CDi_ja``, ``PCi_ja``, and\n        ``PVi_ma`` for the primary representation ``(a = ' ')``.\n        ``PROJPn`` is equivalent to ``PVi_ma`` with ``m`` = ``n`` <=\n        9, and is associated exclusively with the latitude axis.\n\n\n- ``WCSHDR_CD0i_0ja``: Accept ``CD0i_0ja`` (wcspih()).\n- ``WCSHDR_PC0i_0ja``: Accept ``PC0i_0ja`` (wcspih()).\n- ``WCSHDR_PV0i_0ma``: Accept ``PV0i_0ja`` (wcspih()).\n- ``WCSHDR_PS0i_0ma``: Accept ``PS0i_0ja`` (wcspih()).\n\n        Allow the numerical index to have a leading zero in doubly-\n        parameterized keywords, for example, ``PC01_01``.  WCS Paper I\n        (Sects 2.1.2 & 2.1.4) explicitly disallows leading zeroes.\n        The FITS 3.0 standard document (Sect. 4.1.2.1) states that the\n        index in singly-parameterized keywords (e.g. ``CTYPEia``) \"shall\n        not have leading zeroes\", and later in Sect. 8.1 that \"leading\n        zeroes must not be used\" on ``PVi_ma`` and ``PSi_ma``.  However, by an\n        oversight, it is silent on ``PCi_ja`` and ``CDi_ja``.\n\n        Only available if built with wcslib 5.0 or later.\n\n- ``WCSHDR_RADECSYS``: Accept ``RADECSYS``.  This appeared in early\n  drafts of WCS Paper I+II and was subsequently replaced by\n  ``RADESYSa``.  The constructor accepts ``RADECSYS`` only if\n  ``WCSHDR_AUXIMG`` is also enabled.\n\n- ``WCSHDR_VSOURCE``: Accept ``VSOURCEa`` or ``VSOUna``.  This appeared\n  in early drafts of WCS Paper III and was subsequently dropped in\n  favor of ``ZSOURCEa`` and ``ZSOUna``.  The constructor accepts\n  ``VSOURCEa`` only if ``WCSHDR_AUXIMG`` is also enabled.\n\n- ``WCSHDR_DOBSn``: Allow ``DOBSn``, the column-specific analogue of\n  ``DATE-OBS``.  By an oversight this was never formally defined in\n  the standard.\n\n- ``WCSHDR_LONGKEY``: Accept long forms of the alternate binary table\n  and pixel list WCS keywords, i.e. with \"a\" non- blank.\n  Specifically::\n\n        jCRPXna  TCRPXna  :  jCRPXn  jCRPna  TCRPXn  TCRPna  CRPIXja\n           -     TPCn_ka  :    -     ijPCna    -     TPn_ka  PCi_ja\n           -     TCDn_ka  :    -     ijCDna    -     TCn_ka  CDi_ja\n        iCDLTna  TCDLTna  :  iCDLTn  iCDEna  TCDLTn  TCDEna  CDELTia\n        iCUNIna  TCUNIna  :  iCUNIn  iCUNna  TCUNIn  TCUNna  CUNITia\n        iCTYPna  TCTYPna  :  iCTYPn  iCTYna  TCTYPn  TCTYna  CTYPEia\n        iCRVLna  TCRVLna  :  iCRVLn  iCRVna  TCRVLn  TCRVna  CRVALia\n        iPVn_ma  TPVn_ma  :    -     iVn_ma    -     TVn_ma  PVi_ma\n        iPSn_ma  TPSn_ma  :    -     iSn_ma    -     TSn_ma  PSi_ma\n\n  where the primary and standard alternate forms together with the\n  image-header equivalent are shown rightwards of the colon.\n\n  The long form of these keywords could be described as quasi-\n  standard.  ``TPCn_ka``, ``iPVn_ma``, and ``TPVn_ma`` appeared by\n  mistake in the examples in WCS Paper II and subsequently these and\n  also ``TCDn_ka``, ``iPSn_ma`` and ``TPSn_ma`` were legitimized by\n  the errata to the WCS papers.\n\n  Strictly speaking, the other long forms are non-standard and in fact\n  have never appeared in any draft of the WCS papers nor in the\n  errata.  However, as natural extensions of the primary form they are\n  unlikely to be written with any other intention.  Thus it should be\n  safe to accept them provided, of course, that the resulting keyword\n  does not exceed the 8-character limit.\n\n  If ``WCSHDR_CNAMn`` is enabled then also accept::\n\n        iCNAMna  TCNAMna  :   ---   iCNAna    ---   TCNAna  CNAMEia\n        iCRDEna  TCRDEna  :   ---   iCRDna    ---   TCRDna  CRDERia\n        iCSYEna  TCSYEna  :   ---   iCSYna    ---   TCSYna  CSYERia\n\n  Note that ``CNAMEia``, ``CRDERia``, ``CSYERia``, and their variants\n  are not used by `astropy.wcs` but are stored as auxiliary information.\n\n- ``WCSHDR_CNAMn``: Accept ``iCNAMn``, ``iCRDEn``, ``iCSYEn``,\n  ``TCNAMn``, ``TCRDEn``, and ``TCSYEn``, i.e. with ``a`` blank.\n  While non-standard, these are the analogues of ``iCTYPn``,\n  ``TCTYPn``, etc.\n\n- ``WCSHDR_AUXIMG``: Allow the image-header form of an auxiliary WCS\n  keyword with representation-wide scope to provide a default value\n  for all images.  This default may be overridden by the\n  column-specific form of the keyword.\n\n  For example, a keyword like ``EQUINOXa`` would apply to all image\n  arrays in a binary table, or all pixel list columns with alternate\n  representation ``a`` unless overridden by ``EQUIna``.\n\n  Specifically the keywords are::\n\n        LATPOLEa  for LATPna\n        LONPOLEa  for LONPna\n        RESTFREQ  for RFRQna\n        RESTFRQa  for RFRQna\n        RESTWAVa  for RWAVna\n\n  whose keyvalues are actually used by WCSLIB, and also keywords that\n  provide auxiliary information that is simply stored in the wcsprm\n  struct::\n\n        EPOCH         -       ... (No column-specific form.)\n        EPOCHa        -       ... Only if WCSHDR_EPOCHa is set.\n        EQUINOXa  for EQUIna\n        RADESYSa  for RADEna\n        RADECSYS  for RADEna  ... Only if WCSHDR_RADECSYS is set.\n        SPECSYSa  for SPECna\n        SSYSOBSa  for SOBSna\n        SSYSSRCa  for SSRCna\n        VELOSYSa  for VSYSna\n        VELANGLa  for VANGna\n        VELREF        -       ... (No column-specific form.)\n        VELREFa       -       ... Only if WCSHDR_VELREFa is set.\n        VSOURCEa  for VSOUna  ... Only if WCSHDR_VSOURCE is set.\n        WCSNAMEa  for WCSNna  ... Or TWCSna (see below).\n        ZSOURCEa  for ZSOUna\n\n        DATE-AVG  for DAVGn\n        DATE-OBS  for DOBSn\n        MJD-AVG   for MJDAn\n        MJD-OBS   for MJDOBn\n        OBSGEO-X  for OBSGXn\n        OBSGEO-Y  for OBSGYn\n        OBSGEO-Z  for OBSGZn\n\n  where the image-header keywords on the left provide default values\n  for the column specific keywords on the right.\n\n  Keywords in the last group, such as ``MJD-OBS``, apply to all\n  alternate representations, so ``MJD-OBS`` would provide a default\n  value for all images in the header.\n\n  This auxiliary inheritance mechanism applies to binary table image\n  arrays and pixel lists alike.  Most of these keywords have no\n  default value, the exceptions being ``LONPOLEa`` and ``LATPOLEa``,\n  and also ``RADESYSa`` and ``EQUINOXa`` which provide defaults for\n  each other.  Thus the only potential difficulty in using\n  ``WCSHDR_AUXIMG`` is that of erroneously inheriting one of these four\n  keywords.\n\n  Unlike ``WCSHDR_ALLIMG``, the existence of one (or all) of these\n  auxiliary WCS image header keywords will not by itself cause a\n  `~astropy.wcs.Wcsprm` object to be created for alternate\n  representation ``a``.  This is because they do not provide\n  sufficient information to create a non-trivial coordinate\n  representation when used in conjunction with the default values of\n  those keywords, such as ``CTYPEia``, that are parameterized by axis\n  number.\n\n- ``WCSHDR_ALLIMG``: Allow the image-header form of *all* image header\n  WCS keywords to provide a default value for all image arrays in a\n  binary table (n.b. not pixel list).  This default may be overridden\n  by the column-specific form of the keyword.\n\n  For example, a keyword like ``CRPIXja`` would apply to all image\n  arrays in a binary table with alternate representation ``a``\n  unless overridden by ``jCRPna``.\n\n  Specifically the keywords are those listed above for ``WCSHDR_AUXIMG``\n  plus::\n\n        WCSAXESa  for WCAXna\n\n  which defines the coordinate dimensionality, and the following\n  keywords which are parameterized by axis number::\n\n        CRPIXja   for jCRPna\n        PCi_ja    for ijPCna\n        CDi_ja    for ijCDna\n        CDELTia   for iCDEna\n        CROTAi    for iCROTn\n        CROTAia        -      ... Only if WCSHDR_CROTAia is set.\n        CUNITia   for iCUNna\n        CTYPEia   for iCTYna\n        CRVALia   for iCRVna\n        PVi_ma    for iVn_ma\n        PSi_ma    for iSn_ma\n\n        CNAMEia   for iCNAna\n        CRDERia   for iCRDna\n        CSYERia   for iCSYna\n\n  where the image-header keywords on the left provide default values\n  for the column specific keywords on the right.\n\n  This full inheritance mechanism only applies to binary table image\n  arrays, not pixel lists, because in the latter case there is no\n  well-defined association between coordinate axis number and column\n  number.\n\n  Note that ``CNAMEia``, ``CRDERia``, ``CSYERia``, and their variants\n  are not used by pywcs but are stored in the `~astropy.wcs.Wcsprm`\n  object as auxiliary information.\n\n  Note especially that at least one `~astropy.wcs.Wcsprm` object will\n  be returned for each ``a`` found in one of the image header keywords\n  listed above:\n\n    - If the image header keywords for ``a`` **are not** inherited by\n      a binary table, then the struct will not be associated with any\n      particular table column number and it is up to the user to\n      provide an association.\n\n    - If the image header keywords for ``a`` **are** inherited by a\n      binary table image array, then those keywords are considered to\n      be \"exhausted\" and do not result in a separate\n      `~astropy.wcs.Wcsprm` object.\n\n.. _relaxwrite:\n\nHeader-writing relaxation constants\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n`~astropy.wcs.wcs.WCS.to_header` and `~astropy.wcs.wcs.WCS.to_header_string`\nhas a *relax* argument which may be either `True`, `False` or an\n`int`.\n\n- If `True`, write all recognized extensions.\n\n- If `False` (default), write all extensions that are considered to be\n  safe and recommended, equivalent to ``WCSHDO_safe`` (described below).\n\n- If an `int`, is is a bit field to provide fine-grained control over\n  what non-standard WCS keywords to accept.  The flag bits are subject\n  to change in future and should be set by using the constants\n  beginning with ``WCSHDO_`` in the `astropy.wcs` module.\n\nThe flag bits are:\n\n- ``WCSHDO_none``: Don't use any extensions.\n\n- ``WCSHDO_all``: Write all recognized extensions, equivalent to setting\n  each flag bit.\n\n- ``WCSHDO_safe``: Write all extensions that are considered to be safe\n  and recommended.\n\n- ``WCSHDO_DOBSn``: Write ``DOBSn``, the column-specific analogue of\n  ``DATE-OBS`` for use in binary tables and pixel lists.  WCS Paper\n  III introduced ``DATE-AVG`` and ``DAVGn`` but by an oversight\n  ``DOBSn`` was never formally defined by the\n  standard.  The alternative to using ``DOBSn`` is to write\n  ``DATE-OBS`` which applies to the whole table.  This usage is\n  considered to be safe and is recommended.\n\n- ``WCSHDO_TPCn_ka``: WCS Paper I defined\n\n  - ``TPn_ka`` and ``TCn_ka`` for pixel lists\n\n    but WCS Paper II uses ``TPCn_ka`` in one example and subsequently\n    the errata for the WCS papers legitimized the use of\n\n  - ``TPCn_ka`` and ``TCDn_ka`` for pixel lists\n\n    provided that the keyword does not exceed eight characters.  This\n    usage is considered to be safe and is recommended because of the\n    non-mnemonic terseness of the shorter forms.\n\n- ``WCSHDO_PVn_ma``: WCS Paper I defined\n\n  - ``iVn_ma`` and ``iSn_ma`` for bintables and\n  - ``TVn_ma`` and ``TSn_ma`` for pixel lists\n\n    but WCS Paper II uses ``iPVn_ma`` and ``TPVn_ma`` in the examples\n    and subsequently the errata for the WCS papers legitimized the use\n    of\n\n  - ``iPVn_ma`` and ``iPSn_ma`` for bintables and\n  - ``TPVn_ma`` and ``TPSn_ma`` for pixel lists\n\n    provided that the keyword does not exceed eight characters.  This\n    usage is considered to be safe and is recommended because of the\n    non-mnemonic terseness of the shorter forms.\n\n- ``WCSHDO_CRPXna``: For historical reasons WCS Paper I defined\n\n  - ``jCRPXn``, ``iCDLTn``, ``iCUNIn``, ``iCTYPn``, and ``iCRVLn`` for\n    bintables and\n  - ``TCRPXn``, ``TCDLTn``, ``TCUNIn``, ``TCTYPn``, and ``TCRVLn`` for\n    pixel lists\n\n    for use without an alternate version specifier.  However, because\n    of the eight-character keyword constraint, in order to accommodate\n    column numbers greater than 99 WCS Paper I also defined\n\n  - ``jCRPna``, ``iCDEna``, ``iCUNna``, ``iCTYna`` and ``iCRVna`` for\n    bintables and\n  - ``TCRPna``, ``TCDEna``, ``TCUNna``, ``TCTYna`` and ``TCRVna`` for\n    pixel lists\n\n    for use with an alternate version specifier (the ``a``).  Like the\n    ``PC``, ``CD``, ``PV``, and ``PS`` keywords there is a\n    tendency to confuse these two forms for column numbers up to 99.\n    It is very unlikely that any parser would reject keywords in the\n    first set with a non-blank alternate version specifier so this\n    usage is considered to be safe and is recommended.\n\n- ``WCSHDO_CNAMna``: WCS Papers I and III defined\n\n  - ``iCNAna``,  ``iCRDna``,  and ``iCSYna``  for bintables and\n  - ``TCNAna``,  ``TCRDna``,  and ``TCSYna``  for pixel lists\n\n    By analogy with the above, the long forms would be\n\n  - ``iCNAMna``, ``iCRDEna``, and ``iCSYEna`` for bintables and\n  - ``TCNAMna``, ``TCRDEna``, and ``TCSYEna`` for pixel lists\n\n    Note that these keywords provide auxiliary information only, none\n    of them are needed to compute world coordinates.  This usage is\n    potentially unsafe and is not recommended at this time.\n\n- ``WCSHDO_WCSNna``: Write ``WCSNna`` instead of ``TWCSna`` for pixel\n  lists.  While the constructor treats ``WCSNna`` and ``TWCSna`` as\n  equivalent, other parsers may not.  Consequently, this usage is\n  potentially unsafe and is not recommended at this time.\n\n- ``WCSHDO_SIP``: Write out Simple Imaging Polynomial (SIP) keywords.\n\n- ``WCSHDO_P12``, ``WCSHDO_P13``, ``WCSHDO_P14``, ``WCSHDO_P15``, ``WCSHDO_P16``, ``WCSHDO_P17``, ``WCSHDO_EFMT``\n\n  These constants control the precision of the WCS keywords returned by `~astropy.wcs.WCS.to_header`.\n\n  - ``WCSHDO_P12`` : Use \"%20.12G\" format for all floating-point keyvalues (12 significant digits)\n  - ``WCSHDO_P13`` : Use \"%21.13G\" format for all floating-point keyvalues (13 significant digits)\n  - ``WCSHDO_P14`` : Use \"%22.14G\" format for all floating-point keyvalues (14 significant digits)\n  - ``WCSHDO_P15`` : Use \"%23.15G\" format for all floating-point keyvalues (15 significant digits)\n  - ``WCSHDO_P16`` : Use \"%24.16G\" format for all floating-point keyvalues (16 significant digits)\n  - ``WCSHDO_P17`` : Use \"%25.17G\" format for all floating-point keyvalues (17 significant digits)\n  - ``WCSHDO_EFMT`` : Use \"%E\" format instead of the default \"%G\" format above\n"},{"id":112,"name":"references.txt","nodeType":"TextFile","path":"docs/wcs","text":".. _wcslib: https://www.atnf.csiro.au/people/mcalabre/WCS/wcslib/index.html\n.. _distortion paper: https://www.atnf.csiro.au/people/mcalabre/WCS/dcs_20040422.pdf\n.. _SIP: https://irsa.ipac.caltech.edu/data/SPITZER/docs/files/spitzer/shupeADASS.pdf\n.. _ds9: http://ds9.si.edu/\n.. _FITS WCS standard: https://fits.gsfc.nasa.gov/fits_wcs.html\n.. _paper_I: https://arxiv.org/pdf/astro-ph/0207407.pdf\n.. _paper_II: https://arxiv.org/pdf/astro-ph/0207413.pdf\n.. _paper_III: https://arxiv.org/pdf/astro-ph/0507293.pdf\n.. _paper_IV: https://arxiv.org/pdf/1409.7583.pdf\n"},{"id":113,"name":"legacy_interface.rst","nodeType":"TextFile","path":"docs/wcs","text":".. include:: references.txt\n.. _legacy_interface:\n\nLegacy Interface\n****************\n\nastropy.wcs API\n^^^^^^^^^^^^^^^\n\nThe ``Low Level API`` or ``Legacy Interface`` is the original `astropy.wcs` API.\nIt supports three types of transforms:\n\n- Core WCS, as defined in the `FITS WCS standard`_, based on Mark\n  Calabretta's `wcslib`_.  (Also includes ``TPV`` and ``TPD``\n  distortion, but not ``SIP``).\n\n- Simple Imaging Polynomial (`SIP`_) convention. (See :doc:`note about SIP in headers <note_sip>`.)\n\n- Table lookup distortions as defined in the FITS WCS `distortion paper`_.\n\nEach of these transformations can be used independently or together in a standard pipeline.\nAll methods support scalar and array inputs. Note, that all methods require an additional\npositional argument which is the ``origin`` of the inputs. It has two possible values - ``0`` -\nfor zero-based coordinates like numpy arrays or ``1`` - for 1-based coordinates, like\nthe FITS standard, or those coming from ds9.\n\nThe basic workflow is to create a WCS object calling the WCS constructor with an\n`~astropy.io.fits.Header` and/or `~astropy.io.fits.HDUList` object and calling\none of the methods below::\n\n    >>> from astropy import wcs\n    >>> from astropy.io import fits\n    >>> from astropy.utils.data import get_pkg_data_filename\n    >>> fn = get_pkg_data_filename('data/j94f05bgq_flt.fits', package='astropy.wcs.tests')\n    >>> f = fits.open(fn)\n    >>> wcsobj = wcs.WCS(f[1].header)\n    >>> f.close()\n\nOptionally, if the FITS file uses any deprecated or non-standard features, you may need\nto call one of the `~astropy.wcs.wcs.WCS.fix` methods on the object.\n\nUse one of the following transformation methods.\n\n1. Between pixels and world coordinates using all distortions:\n\n  - `~astropy.wcs.wcs.WCS.all_pix2world`: Perform all three\n    transformations in series (core WCS, SIP and table lookup\n    distortions) from pixel to world coordinates.  Use this one\n    if you're not sure which to use.\n\n    >>> lon, lat = wcsobj.all_pix2world(30, 40, 0)\n    >>> print(lon, lat)  # doctest: +FLOAT_CMP\n    5.528442425094046 -72.05207808966726\n\n  - `~astropy.wcs.wcs.WCS.all_world2pix`: Perform all three\n     transformations (core WCS, SIP and table lookup\n     distortions) from world to pixel coordinates, using an\n     iterative method if necessary.\n\n     >>> x, y = wcsobj.all_world2pix(lon, lat, 0)\n     >>> print(x, y) # # doctest: +FLOAT_CMP\n     30.00000214673885 39.999999958235094\n\n 2. Performing `SIP`_ transformations only:\n\n     - `~astropy.wcs.wcs.WCS.sip_pix2foc`: Convert from pixel to\n        focal plane coordinates using the `SIP`_ polynomial\n        coefficients.\n\n        >>> xsip, ysip = wcsobj.sip_pix2foc(30, 40, 0)\n        >>> print(xsip, ysip)  # doctest: +FLOAT_CMP\n        -1985.8600487630586 -984.4223711273145\n\n     - `~astropy.wcs.wcs.WCS.sip_foc2pix`: Convert from focal\n        plane to pixel coordinates using the `SIP`_ polynomial\n        coefficients. Note that this method only works if the\n        inverse SIP distortion is specified in the header.\n\n 3. Performing `distortion paper`_ transformations only:\n\n     - `~astropy.wcs.wcs.WCS.p4_pix2foc`: Convert from pixel to\n        focal plane coordinates using the table lookup distortion\n        method described in the FITS WCS `distortion paper`_.\n\n     - `~astropy.wcs.wcs.WCS.det2im`: Convert from detector\n        coordinates to image coordinates.  Commonly used for narrow\n        column correction.\n\nCore wcslib API\n^^^^^^^^^^^^^^^\n\nThe core wcslib API supports the FITS WCS standard defined in WCS\npapers, I, II, III, IV. Note that distortions are not applied if\nthe functions in the core library are used.\n\n1. From pixels to world coordinates:\n\n    - `~astropy.wcs.wcs.WCS.wcs_pix2world`: Perform just the core WCS\n       transformation from pixel to world coordinates.\n\n        >>> lon, lat = wcsobj.wcs_pix2world(30, 40, 0)\n        >>> print(lon, lat)  # doctest: +FLOAT_CMP\n        5.527103615238458 -72.0522441352217\n\n2. From world to pixel coordinates:\n\n    - `~astropy.wcs.wcs.WCS.wcs_world2pix`: Perform the core WCS transformation\n       from world to pixel coordinates.\n\n        >>> x, y = wcsobj.wcs_world2pix(lon, lat, 0)\n        >>> print(x, y)  # doctest: +FLOAT_CMP\n        30.000000000223267 40.0000000003696\n"},{"id":114,"name":"validation.rst","nodeType":"TextFile","path":"docs/wcs","text":".. _validation:\n\nValidation and Bounds checking\n******************************\n\nBounds checking is enabled by default, and any computed world\ncoordinates outside of [-180°, 180°] for longitude and [-90°, 90°] in\nlatitude are marked as invalid.  To disable this behavior, use\n`astropy.wcs.Wcsprm.bounds_check`.\n"},{"id":115,"name":"references.rst","nodeType":"TextFile","path":"docs/wcs","text":":orphan:\n\n.. _wcslib: https://www.atnf.csiro.au/people/mcalabre/WCS/wcslib/index.html\n.. _distortion paper: https://www.atnf.csiro.au/people/mcalabre/WCS/dcs_20040422.pdf\n.. _SIP: https://irsa.ipac.caltech.edu/data/SPITZER/docs/files/spitzer/shupeADASS.pdf\n.. _ds9: http://hea-www.harvard.edu/RD/ds9/\n.. _FITS WCS standard: http://fits.gsfc.nasa.gov/fits_wcs.html\n.. _paper_I: https://arxiv.org/pdf/astro-ph/0207407.pdf\n.. _paper_II: https://arxiv.org/pdf/astro-ph/0207413.pdf\n.. _paper_III: https://arxiv.org/pdf/astro-ph/0507293.pdf\n.. _paper_IV: https://arxiv.org/pdf/1409.7583.pdf\n"},{"id":116,"name":"supported_projections.rst","nodeType":"TextFile","path":"docs/wcs","text":".. include:: references.txt\n\n.. supported_projections:\n\nSupported projections\n---------------------\n\nAs `astropy.wcs` is based on `wcslib`_, it supports the standard\nprojections defined in the `FITS WCS standard`_.  These projection\ncodes are three letter strings specified in the second part of the ``CTYPEn`` keywords\n(accessible through `Wcsprm.ctype <astropy.wcs.Wcsprm.ctype>`). For\nexample, a tangent projection with RA, DEC coordinates is defined by\n``CTYPE1 = RA---TAN`` and ``CTYPE2 = DEC--TAN``. If a SIP distortion is present the\nkeywords become ``CTYPE1 = RA---TAN-SIP`` and ``CTYPE2 = DEC--TAN-SIP``.\n\nThe supported projection codes are:\n\n- ``AZP``: zenithal/azimuthal perspective\n- ``SZP``: slant zenithal perspective\n- ``TAN``: gnomonic\n- ``STG``: stereographic\n- ``SIN``: orthographic/synthesis\n- ``ARC``: zenithal/azimuthal equidistant\n- ``ZPN``: zenithal/azimuthal polynomial\n- ``ZEA``: zenithal/azimuthal equal area\n- ``AIR``: Airy's projection\n- ``CYP``: cylindrical perspective\n- ``CEA``: cylindrical equal area\n- ``CAR``: plate carrée\n- ``MER``: Mercator's projection\n- ``COP``: conic perspective\n- ``COE``: conic equal area\n- ``COD``: conic equidistant\n- ``COO``: conic orthomorphic\n- ``SFL``: Sanson-Flamsteed (\"global sinusoid\")\n- ``PAR``: parabolic\n- ``MOL``: Mollweide's projection\n- ``AIT``: Hammer-Aitoff\n- ``BON``: Bonne's projection\n- ``PCO``: polyconic\n- ``TSC``: tangential spherical cube\n- ``CSC``: COBE quadrilateralized spherical cube\n- ``QSC``: quadrilateralized spherical cube\n- ``HPX``: HEALPix\n- ``XPH``: HEALPix polar, aka \"butterfly\"\n\nAnd, if built with wcslib 5.0 or later, the following polynomial\ndistortions are supported:\n\n- ``TPV``: Polynomial distortion\n- ``TUV``: Polynomial distortion\n\n.. note::\n\n    Though wcslib 5.4 and later handles ``SIP`` polynomial distortion,\n    for backward compatibility, ``SIP`` is handled by astropy itself\n    and methods exist to handle it specially.\n"},{"id":117,"name":"example_create_imaging.rst","nodeType":"TextFile","path":"docs/wcs","text":".. _example_create_imaging:\n\nFirst Example\n^^^^^^^^^^^^^\n\nThis example, rather than starting from a FITS header, sets WCS values\nprogrammatically, uses those settings to transform some points, and then\nsaves those settings to a new FITS header.\n\n.. literalinclude:: examples/programmatic.py\n   :language: python\n\n.. note::\n    The members of the WCS object correspond roughly to the key/value\n    pairs in the FITS header.  However, they are adjusted and\n    normalized in a number of ways that make performing the WCS\n    transformation easier.  Therefore, they can not be relied upon to\n    get the original values in the header.  To build up a FITS header\n    directly and specifically, use `astropy.io.fits.Header` directly.\n"},{"id":118,"name":"wcsapi.rst","nodeType":"TextFile","path":"docs/wcs","text":".. _wcsapi:\n\nShared Python Interface for World Coordinate Systems\n****************************************************\n\nBackground\n^^^^^^^^^^\n\nThe :class:`~astropy.wcs.WCS` class implements what is considered the\nmost common 'standard' for representing world coordinate systems in\nFITS files, but it cannot represent arbitrarily complex transformations\nand there is no agreement on how to use the standard beyond FITS files.\nTherefore, other world coordinate system transformation approaches exist,\nsuch as the `gwcs <https://gwcs.readthedocs.io/>`_ package being developed\nfor the James Webb Space Telescope (which is also applicable to other data).\n\nSince one of the goals of the Astropy Project is to improve interoperability\nbetween packages, we have collaboratively defined a standardized application\nprogramming interface (API) for world coordinate system objects to be used\nin Python. This API is described in the Astropy Proposal for Enhancements (APE) 14:\n`A shared Python interface for World Coordinate Systems\n<https://doi.org/10.5281/zenodo.1188874>`_.\n\nThe core astropy package provides base classes that define the low- and high-\nlevel APIs described in APE 14 in the :mod:`astropy.wcs.wcsapi` module, and\nthese are listed in the :ref:`wcs-reference-api` section below.\n\nOverview\n^^^^^^^^\n\nWhile the full  details and motivation for the API are detailed in APE 14,  this\ndocumentation summarizes the elements that are implemented directly in the\nastropy core package.  The high-level interface is likely of most interest to\nthe average user.  In particular, the most important methods are the\n:meth:`~astropy.wcs.wcsapi.BaseHighLevelWCS.pixel_to_world` and\n:meth:`~astropy.wcs.wcsapi.BaseHighLevelWCS.world_to_pixel` methods. These\nprovide the essential elements of WCS: mapping to and from world coordinates.\nThe remainder generally provide information about the *kind* of world\ncoordinates or similar information about the structure of the WCS.\n\nIn a bit more detail, the key classes implemented here are a high-level that\nprovides the main user interface (:class:`~astropy.wcs.wcsapi.BaseHighLevelWCS` and\nsubclasses), and a lower-level interface (:class:`~astropy.wcs.wcsapi.BaseLowLevelWCS`\nand subclasses).  These can be distinct objects *or* the same one.  For\nFITS-WCS, the `~astropy.wcs.WCS` object meant for FITS-WCS follows both\ninterfaces, allowing immediate use of this API with files that already contain\nFITS-WCS. More concrete examples are outlined below.\n\nBasic usage\n^^^^^^^^^^^\n\nLet's start off by looking at the shared Python interface for WCS by using a\nsimple image with two celestial axes (Right Ascension and Declination)::\n\n    >>> from astropy.wcs import WCS\n    >>> from astropy.utils.data import get_pkg_data_filename\n    >>> from astropy.io import fits\n    >>> filename = get_pkg_data_filename('galactic_center/gc_2mass_k.fits')  # doctest: +REMOTE_DATA\n    >>> hdulist = fits.open(filename)  # doctest: +REMOTE_DATA\n    >>> hdu = hdulist[0]  # doctest: +REMOTE_DATA\n    >>> wcs = WCS(hdu.header)  # doctest: +REMOTE_DATA\n    >>> wcs  # doctest: +REMOTE_DATA\n    WCS Keywords\n    Number of WCS axes: 2\n    CTYPE : 'RA---TAN'  'DEC--TAN'\n    CRVAL : 266.4  -28.93333\n    CRPIX : 361.0  360.5\n    NAXIS : 721  720\n\nWe can check how many pixel and world axes are in the transformation as well\nas the shape of the data the WCS applies to::\n\n    >>> wcs.pixel_n_dim  # doctest: +REMOTE_DATA\n    2\n    >>> wcs.world_n_dim  # doctest: +REMOTE_DATA\n    2\n    >>> wcs.array_shape  # doctest: +REMOTE_DATA\n    (720, 721)\n\nNote that the array shape should match that of the data::\n\n    >>> hdu.data.shape  # doctest: +REMOTE_DATA\n    (720, 721)\n\nAs mentioned in :ref:`pixel_conventions`, what would normally be\nconsidered the 'y-axis' of the image (when looking at it visually) is the first\ndimension, while the 'x-axis' of the image is the second dimension. Thus\n:attr:`~astropy.wcs.WCS.array_shape` returns the shape in the *opposite* order\nto the NAXIS keywords in the FITS header (in the case of FITS-WCS). If you are\ninterested in the data shape in the reverse order (which would match the NAXIS\norder in the case of FITS-WCS), then you can use\n:attr:`~astropy.wcs.WCS.pixel_shape`::\n\n    >>> wcs.pixel_shape  # doctest: +REMOTE_DATA\n    (721, 720)\n\nLet's now check what the physical type of each axis is::\n\n    >>> wcs.world_axis_physical_types  # doctest: +REMOTE_DATA\n    ['pos.eq.ra', 'pos.eq.dec']\n\nThis is indeed an image with two celestial axes.\n\nThe main part of the new interface defines standard methods for transforming\ncoordinates. The most convenient way is to use the high-level methods\n:meth:`~astropy.wcs.wcsapi.BaseHighLevelWCS.pixel_to_world` and\n:meth:`~astropy.wcs.wcsapi.BaseHighLevelWCS.world_to_pixel`, which can\ntransform directly to astropy objects::\n\n    >>> coord = wcs.pixel_to_world([1, 2], [4, 3])  # doctest: +REMOTE_DATA\n    >>> coord  # doctest: +REMOTE_DATA\n    <SkyCoord (FK5: equinox=2000.0): (ra, dec) in deg\n        [(266.97242993, -29.42584415), (266.97084321, -29.42723968)]>\n\nSimilarly, we can transform astropy objects back - we can test this by creating\nGalactic coordinates and these will automatically be converted::\n\n    >>> from astropy.coordinates import SkyCoord\n    >>> coord = SkyCoord('00h00m00s +00d00m00s', frame='galactic')\n    >>> pixels = wcs.world_to_pixel(coord)  # doctest: +REMOTE_DATA\n    >>> pixels  # doctest: +REMOTE_DATA\n    (array(356.85179997), array(357.45340331))\n\nIf you are looking to index the original data using these pixel coordinates,\nbe sure to instead use\n:meth:`~astropy.wcs.wcsapi.BaseHighLevelWCS.world_to_array_index` which returns\nthe coordinates in the correct order to index Numpy arrays, and also rounds to\nthe nearest integer values::\n\n    >>> index = wcs.world_to_array_index(coord)  # doctest: +REMOTE_DATA\n    >>> index  # doctest: +REMOTE_DATA\n    (357, 357)\n    >>> hdu.data[index]  # doctest: +REMOTE_DATA +FLOAT_CMP\n    563.7532\n    >>> hdulist.close()  # doctest: +REMOTE_DATA\n\nAdvanced usage\n^^^^^^^^^^^^^^\n\nLet's now take a look at a WCS for a spectral cube (two celestial axes and one\nspectral axis)::\n\n    >>> filename = get_pkg_data_filename('l1448/l1448_13co.fits')  # doctest: +REMOTE_DATA\n    >>> hdulist = fits.open(filename)  # doctest: +REMOTE_DATA\n    >>> hdu = hdulist[0]  # doctest: +REMOTE_DATA\n    >>> wcs = WCS(hdu.header)  # doctest: +REMOTE_DATA\n    >>> wcs  # doctest: +REMOTE_DATA\n    WCS Keywords\n    Number of WCS axes: 3\n    CTYPE : 'RA---SFL'  'DEC--SFL'  'VOPT'\n    CRVAL : 57.6599999999  0.0  -9959.44378305\n    CRPIX : -799.0  -4741.913  -187.0\n    PC1_1 PC1_2 PC1_3  : 1.0  0.0  0.0\n    PC2_1 PC2_2 PC2_3  : 0.0  1.0  0.0\n    PC3_1 PC3_2 PC3_3  : 0.0  0.0  1.0\n    CDELT : -0.006388889  0.006388889  66.42361\n    NAXIS : 105  105  53\n\nAs before we can check how many pixel and world axes are in the transformation\nas well as the shape of the data the WCS applies to, as well as the physical\ntypes of each axis::\n\n    >>> wcs.pixel_n_dim  # doctest: +REMOTE_DATA\n    3\n    >>> wcs.world_n_dim  # doctest: +REMOTE_DATA\n    3\n    >>> wcs.array_shape  # doctest: +REMOTE_DATA\n    (53, 105, 105)\n    >>> wcs.world_axis_physical_types  # doctest: +REMOTE_DATA\n    ['pos.eq.ra', 'pos.eq.dec', 'spect.dopplerVeloc.opt']\n\nThis is indeed a spectral cube, with RA/Dec and a velocity axis.\n\nAs before, we can convert between pixels and high-level Astropy objects::\n\n    >>> celestial, spectral = wcs.pixel_to_world([1, 2], [4, 3], [2, 3])  # doctest: +REMOTE_DATA\n    >>> celestial  # doctest: +REMOTE_DATA\n    <SkyCoord (ICRS): (ra, dec) in deg\n        [(51.73115731, 30.32750025), (51.72414268, 30.32111136)]>\n    >>> spectral  # doctest: +REMOTE_DATA\n    <SpectralCoord\n       (target: <ICRS Coordinate: (ra, dec, distance) in (deg, deg, kpc)\n                    (57.66, 0., 1000.)\n                 (pm_ra_cosdec, pm_dec, radial_velocity) in (mas / yr, mas / yr, km / s)\n                    (0., 0., 0.)>)\n      [2661.04211695, 2727.46572695] m / s>\n\nand back::\n\n    >>> from astropy import units as u\n    >>> coord = SkyCoord('03h26m36.4901s +30d45m22.2012s')\n    >>> pixels = wcs.world_to_pixel(coord, 3000 * u.m / u.s)  # doctest: +REMOTE_DATA +IGNORE_WARNINGS\n    >>> pixels  # doctest: +REMOTE_DATA\n    (array(8.11341207), array(71.0956641), array(7.10297292))\n\nAnd as before we can index array values using::\n\n    >>> index = wcs.world_to_array_index(coord, 3000 * u.m / u.s)  # doctest: +REMOTE_DATA +IGNORE_WARNINGS\n    >>> index  # doctest: +REMOTE_DATA\n    (7, 71, 8)\n    >>> hdu.data[index]  # doctest: +REMOTE_DATA +FLOAT_CMP\n    0.22262384\n    >>> hdulist.close()  # doctest: +REMOTE_DATA\n\nIf you are interested in converting to/from world values as simple Python scalars\nor Numpy arrays without using high-level astropy objects, there are methods\nsuch as :meth:`~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values` to\ndo this - see :ref:`wcs-reference-api` section for more details.\n\nExtending the physical types in FITS-WCS\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nAs shown above, the :attr:`~astropy.wcs.WCS.world_axis_physical_types` property\nreturns the list of physical types for each axis. For FITS-WCS, this is\ndetermined from the CTYPE values in the header. In cases where the physical\ntype is not known, `None` is returned. However, it is possible to override the\nphysical types returned by using the\n:class:`~astropy.wcs.wcsapi.fitswcs.custom_ctype_to_ucd_mapping` context\nmanager. Consider a WCS with the following CTYPE::\n\n    >>> from astropy.wcs import WCS\n    >>> wcs = WCS(naxis=1)\n    >>> wcs.wcs.ctype = ['SPAM']\n    >>> wcs.world_axis_physical_types\n    [None]\n\nWe can specify that for this CTYPE, the physical type should be\n``'food.spam'``::\n\n    >>> from astropy.wcs.wcsapi.fitswcs import custom_ctype_to_ucd_mapping\n    >>> with custom_ctype_to_ucd_mapping({'SPAM': 'food.spam'}):\n    ...     wcs.world_axis_physical_types\n    ['food.spam']\n\nSlicing of WCS objects\n^^^^^^^^^^^^^^^^^^^^^^\n\nA common operation when dealing with data with WCS information attached is to\nslice the WCS - this can be either to extract the WCS for a sub-region of the\ndata, preserving the overall number of dimensions (e.g. a cutout from an image)\nor it can be reducing the dimensionality of the data and associated WCS (e.g.\nextracting a slice from a spectral cube).\n\nThe :class:`~astropy.wcs.wcsapi.SlicedLowLevelWCS` class can be used to slice\nany WCS object that conforms to the :class:`~astropy.wcs.wcsapi.BaseLowLevelWCS`\nAPI. To demonstrate this, let's start off by reading in a spectral cube file::\n\n    >>> filename = get_pkg_data_filename('l1448/l1448_13co.fits')  # doctest: +REMOTE_DATA\n    >>> wcs = WCS(fits.getheader(filename, ext=0))  # doctest: +REMOTE_DATA\n\nThe ``wcs`` object is an instance of :class:`~astropy.wcs.WCS` which conforms to the\n:class:`~astropy.wcs.wcsapi.BaseLowLevelWCS` API. We can then use the\n:class:`~astropy.wcs.wcsapi.SlicedLowLevelWCS` class to slice the cube::\n\n    >>> from astropy.wcs.wcsapi import SlicedLowLevelWCS\n    >>> slices = [10, slice(30, 100), slice(30, 100)]  # doctest: +REMOTE_DATA\n    >>> subwcs = SlicedLowLevelWCS(wcs, slices=slices)  # doctest: +REMOTE_DATA\n\nThe ``slices`` argument takes any combination of slices, integer values, and\nellipsis which would normally slice a Numpy array. In the above case, we are\nextracting a spectral slice, and in that slice we are extracting a sub-region\non the sky.\n\nIf you are implementing your own WCS class, you could choose to implement\n``__getitem__`` and have it internally use\n:class:`~astropy.wcs.wcsapi.SlicedLowLevelWCS`. In fact, the\n:class:`~astropy.wcs.WCS` class does this - the example above can be written\nmore succinctly as::\n\n    >>> wcs[10, 30:100, 30:100]  # doctest: +REMOTE_DATA +ELLIPSIS\n    <...>\n    SlicedFITSWCS Transformation\n    <BLANKLINE>\n    This transformation has 2 pixel and 2 world dimensions\n    <BLANKLINE>\n    Array shape (Numpy order): (70, 70)\n    <BLANKLINE>\n    Pixel Dim  Axis Name  Data size  Bounds\n            0  None              70  None\n            1  None              70  None\n    <BLANKLINE>\n    World Dim  Axis Name  Physical Type  Units\n            0  None       pos.eq.ra      deg\n            1  None       pos.eq.dec     deg\n    <BLANKLINE>\n    Correlation between pixel and world axes:\n    <BLANKLINE>\n               Pixel Dim\n    World Dim    0    1\n            0  yes  yes\n            1  yes  yes\n\nThis slicing infrastructure is able to deal with slicing of WCS objects which\nhave correlated axes - in this case, you may end up with a WCS that has a\ndifferent number of pixel and world coordinates. For example, if we slice\na spectral cube to extract a 1D dataset corresponding to a row in the\nimage plane of a spectral slice, the final WCS will have one pixel dimension\nand two world dimensions (since both RA/Dec vary over the extracted 1D slice)::\n\n    >>> wcs[10, 40, :]  # doctest: +REMOTE_DATA +ELLIPSIS\n    <...>\n    SlicedFITSWCS Transformation\n    <BLANKLINE>\n    This transformation has 1 pixel and 2 world dimensions\n    <BLANKLINE>\n    Array shape (Numpy order): (105,)\n    <BLANKLINE>\n    Pixel Dim  Axis Name  Data size  Bounds\n            0  None             105  None\n    <BLANKLINE>\n    World Dim  Axis Name  Physical Type  Units\n            0  None       pos.eq.ra      deg\n            1  None       pos.eq.dec     deg\n    <BLANKLINE>\n    Correlation between pixel and world axes:\n    <BLANKLINE>\n               Pixel Dim\n    World Dim    0\n            0  yes\n            1  yes\n"},{"id":119,"name":"example_cube_wcs.rst","nodeType":"TextFile","path":"docs/wcs","text":".. _example_cube_wcs:\n\nSecond Example\n^^^^^^^^^^^^^^\n\nAnother way of creating a WCS object is via the use of a Python\ndictionary. This affords us more control over the ``NAXISn``\nFITS header keyword which is otherwise automatically default to zero\nas in the case of the First Example shown above.\n\n.. literalinclude:: examples/cube_wcs.py\n   :language: python\n"},{"id":120,"name":"index.rst","nodeType":"TextFile","path":"docs/wcs","text":".. include:: references.txt\n.. _astropy-wcs:\n\n***************************************\nWorld Coordinate System (`astropy.wcs`)\n***************************************\n\nIntroduction\n============\n\nWorld Coordinate Systems (WCSs) describe the geometric transformations\nbetween one set of coordinates and another. A common application is to\nmap the pixels in an image onto the celestial sphere. Another common\napplication is to map pixels to wavelength in a spectrum.\n\n`astropy.wcs` contains utilities for managing World Coordinate System\n(WCS) transformations defined in several elaborate `FITS WCS standard`_ conventions.\nThese transformations work both forward (from pixel to world) and backward\n(from world to pixel).\n\nFor historical reasons and to support legacy software, `astropy.wcs` maintains\ntwo separate application interfaces. The ``High-Level API`` should be used by\nmost applications. It abstracts out the underlying object and works transparently\nwith other packages which support the\n`Common Python Interface for WCS <https://zenodo.org/record/1188875#.XnpOtJNKjyI>`_,\nallowing for a more flexible approach to the problem and avoiding the `limitations\nof the FITS WCS standard <https://ui.adsabs.harvard.edu/abs/2015A%26C....12..133T/abstract>`_.\n\nThe ``Low Level API`` is the original `astropy.wcs` API and originally developed as ``pywcs``.\nIt ties applications to the `astropy.wcs` package and limits the transformations to the three distinct\ntypes supported by it:\n\n- Core WCS, as defined in the `FITS WCS standard`_, based on Mark\n  Calabretta's `wcslib`_.  (Also includes ``TPV`` and ``TPD``\n  distortion, but not ``SIP``).\n\n- Simple Imaging Polynomial (`SIP`_) convention. (See :doc:`note about SIP in headers <note_sip>`.)\n\n- Table lookup distortions as defined in the FITS WCS `distortion\n  paper`_.\n\n.. _pixel_conventions:\n\nPixel Conventions and Definitions\n---------------------------------\n\nBoth APIs assume that integer pixel values fall at the center of pixels (as assumed in\nthe `FITS WCS standard`_, see Section 2.1.4 of `Greisen et al., 2002,\nA&A 446, 747 <https://doi.org/10.1051/0004-6361:20053818>`_).\n\nHowever, there’s a difference in what is considered to be the first pixel. The\n``High Level API`` follows the Python and C convention that the first pixel is\nthe 0-th one, i.e. the first pixel spans pixel values -0.5 to + 0.5. The\n``Low Level API`` takes an additional ``origin`` argument with values of 0 or 1\nindicating whether the input arrays are 0- or 1-based.\nThe Low-level interface assumes Cartesian order (x, y) of the input coordinates,\nhowever the Common Interface for World Coordinate System accepts both conventions.\nThe order of the pixel coordinates ((x, y) vs (row, column)) in the Common API\ndepends on the method or property used, and this can normally be determined from\nthe property or method name. Properties and methods containing “pixel” assume (x, y)\nordering, while properties and methods containing “array” assume (row, column) ordering.\n\nA Simple Example\n================\n\nOne example of the use of the high-level WCS API is to use the\n`~astropy.wcs.wcs.WCS.pixel_to_world` to yield the simplest WCS\nwith default values, converting from pixel to world coordinates::\n\n    >>> from astropy.io import fits\n    >>> from astropy.wcs import WCS\n    >>> from astropy.utils.data import get_pkg_data_filename\n    >>> fn = get_pkg_data_filename('data/j94f05bgq_flt.fits', package='astropy.wcs.tests')\n    >>> f = fits.open(fn)\n    >>> w = WCS(f[1].header)\n    >>> sky = w.pixel_to_world(30, 40)\n    >>> print(sky)  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        (5.52844243, -72.05207809)>\n    >>> f.close()\n\nSimilarly, another use of the high-level API is to use the\n`~astropy.wcs.wcs.WCS.world_to_pixel` to yield another simple WCS, while\nconverting from world to pixel coordinates::\n\n    >>> from astropy.io import fits\n    >>> from astropy.wcs import WCS\n    >>> from astropy.utils.data import get_pkg_data_filename\n    >>> fn = get_pkg_data_filename('data/j94f05bgq_flt.fits', package='astropy.wcs.tests')\n    >>> f = fits.open(fn)\n    >>> w = WCS(f[1].header)\n    >>> x, y = w.world_to_pixel(sky)\n    >>> print(x, y)  # doctest: +FLOAT_CMP\n    30.00000214673885 39.999999958235094\n    >>> f.close()\n\nUsing `astropy.wcs`\n===================\n\n.. toctree::\n   :maxdepth: 2\n\n   Shared Python Interface for World Coordinate Systems <wcsapi.rst>\n   Legacy Interface <legacy_interface.rst>\n   Supported Projections <supported_projections>\n\nExamples creating a WCS programmatically\n========================================\n\n.. toctree::\n   :maxdepth: 2\n\n   Example of Imaging WCS <example_create_imaging.rst>\n   Example of Cube WCS <example_cube_wcs.rst>\n   Loading From a FITS File <loading_from_fits.rst>\n\n.. _wcslint:\n\n\n\nWCS Tools\n=========\n\n.. toctree::\n   :maxdepth: 1\n\n   wcstools.rst\n\nRelax Constants\n===============\n\n.. toctree::\n   :maxdepth: 1\n\n   relax\n\nOther Information\n=================\n\n.. toctree::\n   :maxdepth: 1\n\n   history\n   validation\n\n.. note that if this section gets too long, it should be moved to a separate\n   doc page - see the top of performance.inc.rst for the instructions on how to do\n   that\n.. include:: performance.inc.rst\n\n.. _wcs-reference-api:\n\n\nReference/API\n=============\n\n.. toctree::\n   :maxdepth: 1\n\n   reference_api\n\nSee Also\n========\n\n- `wcslib`_\n\n\n\nAcknowledgments and Licenses\n============================\n\n`wcslib`_ is licenced under the `GNU Lesser General Public License\n<http://www.gnu.org/licenses/lgpl.html>`_.\n"},{"id":121,"name":"history.rst","nodeType":"TextFile","path":"docs/wcs","text":"astropy.wcs History\n*******************\n\n`astropy.wcs` began life as ``pywcs``.  Earlier version numbers refer to\nthat package.\n\npywcs Version 1.11\n==================\n\n- Updated to wcslib version 4.8, which gives much more detailed error\n  messages.\n\n- Added functions get_pc() and get_cdelt().  These provide a way to\n  always get the canonical representation of the linear transformation\n  matrix, whether the header specified it in PC, CD or CROTA form.\n\n- Long-running process will now release the Python GIL to better\n  support Python multithreading.\n\n- The dimensions of the `~astropy.wcs.Wcsprm.cd` and\n  `~astropy.wcs.Wcsprm.pc` matrices were always returned as 2x2.  They\n  now are sized according to naxis.\n\n- Supports Python 3.x\n\n- Builds on Microsoft Windows without severely patching wcslib.\n\n- Lots of new unit tests\n\n- ``pywcs`` will now run without ``pyfits``, though the SIP and distortion\n  lookup table functionality is unavailable.\n\n- Setting `~astropy.wcs.Wcsprm.cunit` will now verify that the values\n  are valid unit strings.\n\npywcs Version 1.10\n==================\n\n- Adds a ``UnitConversion`` class, which gives access to wcslib's unit\n  conversion functionality.  Given two convertible unit strings, pywcs\n  can convert arrays of values from one to the other.\n\n- Now uses wcslib 4.7\n\n- Changes to some wcs values would not always calculate secondary values.\n\npywcs Version 1.9\n=================\n\n- Support binary image arrays and pixel list format WCS by presenting\n  a way to call wcslib's ``wcsbth()``\n\n- Updated underlying wcslib to version 4.5, which fixes the following:\n\n    - Fixed the interpretation of VELREF when translating\n      AIPS-convention spectral types.  Such translation is now handled\n      by a new special- purpose function, spcaips().  The wcsprm\n      struct has been augmented with an entry for velref which is\n      filled by wcspih() and wcsbth().  Previously, selection by\n      VELREF of the radio or optical velocity convention for type VELO\n      was not properly handled.\n\nBugs\n----\n\n- The `~astropy.wcs.Wcsprm.pc` member is now available with a default\n  raw `~astropy.wcs.Wcsprm` object.\n\n- Make properties that return arrays read-only, since modifying a\n  (mutable) array could result in secondary values not being\n  recomputed based on those changes.\n\n- `float` properties can now be set using `int` values\n\npywcs Version 1.3a1\n===================\n\nEarlier versions of pywcs had two versions of every conversion method::\n\n  X(...)      -- treats the origin of pixel coordinates at (0, 0)\n  X_fits(...) -- treats the origin of pixel coordinates at (1, 1)\n\nFrom version 1.3 onwards, there is only one method for each\nconversion, with an 'origin' argument:\n\n  - 0: places the origin at (0, 0), which is the C/Numpy convention.\n\n  - 1: places the origin at (1, 1), which is the Fortran/FITS\n    convention.\n"},{"id":122,"name":"note_sip.rst","nodeType":"TextFile","path":"docs/wcs","text":".. include:: references.rst\n.. doctest-skip-all\n.. _note_sip: :orphan:\n\n\nNote about SIP and WCS\n**********************\n\n`astropy.wcs` supports the Simple Imaging Polynomial (`SIP`_) convention.\nThe SIP distortion is defined in FITS headers by the presence of the\nSIP specific keywords **and** a ``-SIP`` suffix in ``CTYPE``, for example\n``RA---TAN-SIP``, ``DEC--TAN-SIP``.\n\nThis has not been a strict convention in the past and the default in\n`astropy.wcs` is to always include the SIP distortion if the SIP coefficients\nare present, even if ``-SIP`` is not included in CTYPE.\nThe presence of a ``-SIP`` suffix in CTYPE is not used as a trigger\nto initialize the SIP distortion.\n\nIt is important that headers implement correctly the SIP convention.\nIf the intention is to use the SIP distortion, a header should have\nthe SIP coefficients and the ``-SIP`` suffix in CTYPE.\n\n`astropy.wcs` prints INFO messages when inconsistent headers are detected,\nfor example when SIP coefficients are present but CTYPE is missing a ``-SIP`` suffix,\nsee examples below.\n`astropy.wcs` will print a message about the inconsistent header\nbut will create and use the SIP distortion and it will be used in\ncalls to `~astropy.wcs.wcs.WCS.all_pix2world`. If this was not the intended use\n(e.g. it's a drizzled image and has no distortions) it is best to remove the SIP\ncoefficients from the header. They can be removed temporarily from a WCS object by\n\n>>> wcsobj.sip = None\n\nIn addition, if SIP is the only distortion in the header, the two methods,\n`~astropy.wcs.wcs.WCS.wcs_pix2world` and `~astropy.wcs.wcs.WCS.wcs_world2pix`,\nmay be used to transform from pixels to world coordinate system while omitting distortions.\n\nAnother consequence of the inconsistent header is that if\n`~astropy.wcs.wcs.WCS.to_header()` is called with ``relax=True`` it will return a header\nwith SIP coefficients and a ``-SIP`` suffix in CTYPE and will not reproduce the original header.\n\n**In conclusion, when astropy.wcs detects inconsistent headers, the recommendation\nis that the header is inspected and corrected to match the data.**\n\nBelow is an example of a header with SIP coefficients when ``-SIP`` is missing from CTYPE.\nThe data is drizzled, i.e. distortion free, so the intention is **not** to include the\nSIP distortion.\n\n>>> wcsobj = wcs.WCS(header)\n\nINFO::\n\n        Inconsistent SIP distortion information is present in the FITS header and the WCS object:\n        SIP coefficients were detected, but CTYPE is missing a \"-SIP\" suffix.\n        astropy.wcs is using the SIP distortion coefficients,\n        therefore the coordinates calculated here might be incorrect.\n\n        If you do not want to apply the SIP distortion coefficients,\n        please remove the SIP coefficients from the FITS header or the\n        WCS object.  As an example, if the image is already distortion-corrected\n        (e.g., drizzled) then distortion components should not apply and the SIP\n        coefficients should be removed.\n\n        While the SIP distortion coefficients are being applied here, if that was indeed the intent,\n        for consistency please append \"-SIP\" to the CTYPE in the FITS header or the WCS object.\n\n\n>>> hdr = wcsobj.to_header(relax=True)\n\nINFO::\n\n        Inconsistent SIP distortion information is present in the current WCS:\n        SIP coefficients were detected, but CTYPE is missing \"-SIP\" suffix,\n        therefore the current WCS is internally inconsistent.\n\n        Because relax has been set to True, the resulting output WCS will have\n        \"-SIP\" appended to CTYPE in order to make the header internally consistent.\n\n        However, this may produce incorrect astrometry in the output WCS, if\n        in fact the current WCS is already distortion-corrected.\n\n        Therefore, if current WCS is already distortion-corrected (eg, drizzled)\n        then SIP distortion components should not apply. In that case, for a WCS\n        that is already distortion-corrected, please remove the SIP coefficients\n        from the header.\n"},{"id":123,"name":"reference_api.rst","nodeType":"TextFile","path":"docs/wcs","text":"Reference/API\n=============\n\n.. automodapi:: astropy.wcs\n   :inherited-members:\n\n.. automodapi:: astropy.wcs.utils\n   :inherited-members:\n\n.. automodapi:: astropy.wcs.wcsapi\n   :inherited-members:\n"},{"id":124,"name":"performance.inc.rst","nodeType":"TextFile","path":"docs/wcs","text":".. note that if this is changed from the default approach of using an *include*\n   (in index.rst) to a separate performance page, the header needs to be changed\n   from === to ***, the filename extension needs to be changed from .inc.rst to\n   .rst, and a link needs to be added in the subpackage toctree\n\n.. _astropy-wcs-performance:\n\n.. Performance Tips\n.. ================\n..\n.. Here we provide some tips and tricks for how to optimize performance of code\n.. using `astropy.wcs`.\n"},{"id":125,"name":"wcstools.rst","nodeType":"TextFile","path":"docs/wcs","text":".. _wcstools:\n\nSubsetting and Pixel Scales\n^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nWCS objects can be broken apart into their constituent axes using the\n`~astropy.wcs.WCS.sub` function.  There is also a `~astropy.wcs.WCS.celestial`\nconvenience function that will return a WCS object with only the celestial axes\nincluded.\n\nThe pixel scales of a celestial image or the pixel dimensions of a non-celestial\nimage can be extracted with the utility functions\n`~astropy.wcs.utils.proj_plane_pixel_scales` and\n`~astropy.wcs.utils.non_celestial_pixel_scales`. Likewise, celestial pixel\narea can be extracted with the utility function\n`~astropy.wcs.utils.proj_plane_pixel_area`.\n\nMatplotlib plots with correct WCS projection\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThe :ref:`WCSAxes <wcsaxes>` framework, previously a standalone package, allows\nthe :class:`~astropy.wcs.WCS` to be used to define projections in Matplotlib.\nMore information on using WCSAxes can be found :ref:`here <wcsaxes>`.\n\n.. plot::\n    :context: reset\n    :include-source:\n    :align: center\n\n    import warnings\n    from matplotlib import pyplot as plt\n    from astropy.io import fits\n    from astropy.wcs import WCS, FITSFixedWarning\n    from astropy.utils.data import get_pkg_data_filename\n\n    filename = get_pkg_data_filename('tutorials/FITS-images/HorseHead.fits')\n\n    hdu = fits.open(filename)[0]\n    with warnings.catch_warnings():\n        # Ignore a warning on using DATE-OBS in place of MJD-OBS\n        warnings.filterwarnings('ignore', message=\"'datfix' made the change\",\n                                category=FITSFixedWarning)\n        wcs = WCS(hdu.header)\n\n    fig = plt.figure()\n    fig.add_subplot(111, projection=wcs)\n    plt.imshow(hdu.data, origin='lower', cmap=plt.cm.viridis)\n    plt.xlabel('RA')\n    plt.ylabel('Dec')\n"},{"id":126,"name":"docs/wcs/examples","nodeType":"Package"},{"fileName":"programmatic.py","filePath":"docs/wcs/examples","id":127,"nodeType":"File","text":"# Set the WCS information manually by setting properties of the WCS\n# object.\n\nimport numpy as np\nfrom astropy import wcs\nfrom astropy.io import fits\n\n# Create a new WCS object.  The number of axes must be set\n# from the start\nw = wcs.WCS(naxis=2)\n\n# Set up an \"Airy's zenithal\" projection\n# Vector properties may be set with Python lists, or Numpy arrays\nw.wcs.crpix = [-234.75, 8.3393]\nw.wcs.cdelt = np.array([-0.066667, 0.066667])\nw.wcs.crval = [0, -90]\nw.wcs.ctype = [\"RA---AIR\", \"DEC--AIR\"]\nw.wcs.set_pv([(2, 1, 45.0)])\n\n# Three pixel coordinates of interest.\n# The pixel coordinates are pairs of [X, Y].\n# The \"origin\" argument indicates whether the input coordinates\n# are 0-based (as in Numpy arrays) or\n# 1-based (as in the FITS convention, for example coordinates\n# coming from DS9).\npixcrd = np.array([[0, 0], [24, 38], [45, 98]], dtype=np.float64)\n\n# Convert pixel coordinates to world coordinates.\n# The second argument is \"origin\" -- in this case we're declaring we\n# have 0-based (Numpy-like) coordinates.\nworld = w.wcs_pix2world(pixcrd, 0)\nprint(world)\n\n# Convert the same coordinates back to pixel coordinates.\npixcrd2 = w.wcs_world2pix(world, 0)\nprint(pixcrd2)\n\n# These should be the same as the original pixel coordinates, modulo\n# some floating-point error.\nassert np.max(np.abs(pixcrd - pixcrd2)) < 1e-6\n\n# The example below illustrates the use of \"origin\" to convert between\n# 0- and 1- based coordinates when executing the forward and backward\n# WCS transform.\nx = 0\ny = 0\norigin = 0\nassert (w.wcs_pix2world(x, y, origin) ==\n        w.wcs_pix2world(x + 1, y + 1, origin + 1))\n\n# Now, write out the WCS object as a FITS header\nheader = w.to_header()\n\n# header is an astropy.io.fits.Header object.  We can use it to create a new\n# PrimaryHDU and write it to a file.\nhdu = fits.PrimaryHDU(header=header)\n# Save to FITS file\n# hdu.writeto('test.fits')\n"},{"fileName":"cube_wcs.py","filePath":"docs/wcs/examples","id":128,"nodeType":"File","text":"# Define the astropy.wcs.WCS object using a Python dictionary as input\n\nimport astropy.wcs\nwcs_dict = {\n'CTYPE1': 'WAVE    ', 'CUNIT1': 'Angstrom', 'CDELT1': 0.2, 'CRPIX1': 0, 'CRVAL1': 10, 'NAXIS1': 5,\n'CTYPE2': 'HPLT-TAN', 'CUNIT2': 'deg', 'CDELT2': 0.5, 'CRPIX2': 2, 'CRVAL2': 0.5, 'NAXIS2': 4,\n'CTYPE3': 'HPLN-TAN', 'CUNIT3': 'deg', 'CDELT3': 0.4, 'CRPIX3': 2, 'CRVAL3': 1, 'NAXIS3': 3}\ninput_wcs = astropy.wcs.WCS(wcs_dict)\n"},{"fileName":"from_file.py","filePath":"docs/wcs/examples","id":129,"nodeType":"File","text":"# Load the WCS information from a fits header, and use it\n# to convert pixel coordinates to world coordinates.\n\nimport numpy as np\nfrom astropy import wcs\nfrom astropy.io import fits\nimport sys\n\n\ndef load_wcs_from_file(filename):\n    # Load the FITS hdulist using astropy.io.fits\n    hdulist = fits.open(filename)\n\n    # Parse the WCS keywords in the primary HDU\n    w = wcs.WCS(hdulist[0].header)\n\n    # Print out the \"name\" of the WCS, as defined in the FITS header\n    print(w.wcs.name)\n\n    # Print out all of the settings that were parsed from the header\n    w.wcs.print_contents()\n\n    # Three pixel coordinates of interest.\n    # Note we've silently assumed an NAXIS=2 image here.\n    # The pixel coordinates are pairs of [X, Y].\n    # The \"origin\" argument indicates whether the input coordinates\n    # are 0-based (as in Numpy arrays) or\n    # 1-based (as in the FITS convention, for example coordinates\n    # coming from DS9).\n    pixcrd = np.array([[0, 0], [24, 38], [45, 98]], dtype=np.float64)\n\n    # Convert pixel coordinates to world coordinates\n    # The second argument is \"origin\" -- in this case we're declaring we\n    # have 0-based (Numpy-like) coordinates.\n    world = w.wcs_pix2world(pixcrd, 0)\n    print(world)\n\n    # Convert the same coordinates back to pixel coordinates.\n    pixcrd2 = w.wcs_world2pix(world, 0)\n    print(pixcrd2)\n\n    # These should be the same as the original pixel coordinates, modulo\n    # some floating-point error.\n    assert np.max(np.abs(pixcrd - pixcrd2)) < 1e-6\n\n    # The example below illustrates the use of \"origin\" to convert between\n    # 0- and 1- based coordinates when executing the forward and backward\n    # WCS transform.\n    x = 0\n    y = 0\n    origin = 0\n    assert (w.wcs_pix2world(x, y, origin) ==\n            w.wcs_pix2world(x + 1, y + 1, origin + 1))\n\n\nif __name__ == '__main__':\n    load_wcs_from_file(sys.argv[-1])\n"},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":130,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"col":0,"comment":"null","endLoc":53,"header":"def load_wcs_from_file(filename)","id":131,"name":"load_wcs_from_file","nodeType":"Function","startLoc":10,"text":"def load_wcs_from_file(filename):\n    # Load the FITS hdulist using astropy.io.fits\n    hdulist = fits.open(filename)\n\n    # Parse the WCS keywords in the primary HDU\n    w = wcs.WCS(hdulist[0].header)\n\n    # Print out the \"name\" of the WCS, as defined in the FITS header\n    print(w.wcs.name)\n\n    # Print out all of the settings that were parsed from the header\n    w.wcs.print_contents()\n\n    # Three pixel coordinates of interest.\n    # Note we've silently assumed an NAXIS=2 image here.\n    # The pixel coordinates are pairs of [X, Y].\n    # The \"origin\" argument indicates whether the input coordinates\n    # are 0-based (as in Numpy arrays) or\n    # 1-based (as in the FITS convention, for example coordinates\n    # coming from DS9).\n    pixcrd = np.array([[0, 0], [24, 38], [45, 98]], dtype=np.float64)\n\n    # Convert pixel coordinates to world coordinates\n    # The second argument is \"origin\" -- in this case we're declaring we\n    # have 0-based (Numpy-like) coordinates.\n    world = w.wcs_pix2world(pixcrd, 0)\n    print(world)\n\n    # Convert the same coordinates back to pixel coordinates.\n    pixcrd2 = w.wcs_world2pix(world, 0)\n    print(pixcrd2)\n\n    # These should be the same as the original pixel coordinates, modulo\n    # some floating-point error.\n    assert np.max(np.abs(pixcrd - pixcrd2)) < 1e-6\n\n    # The example below illustrates the use of \"origin\" to convert between\n    # 0- and 1- based coordinates when executing the forward and backward\n    # WCS transform.\n    x = 0\n    y = 0\n    origin = 0\n    assert (w.wcs_pix2world(x, y, origin) ==\n            w.wcs_pix2world(x + 1, y + 1, origin + 1))"},{"attributeType":"null","col":0,"comment":"null","endLoc":4,"id":132,"name":"wcs_dict","nodeType":"Attribute","startLoc":4,"text":"wcs_dict"},{"id":133,"name":"docs/samp","nodeType":"Package"},{"id":134,"name":"advanced_embed_samp_hub.rst","nodeType":"TextFile","path":"docs/samp","text":".. doctest-skip-all\n\nEmbedding a SAMP Hub in a GUI\n*****************************\n\nOverview\n========\n\nIf you wish to embed a SAMP hub in your Python Graphical User Interface (GUI)\ntool, you will need to start the hub programmatically using::\n\n    from astropy.samp import SAMPHubServer\n    hub = SAMPHubServer()\n    hub.start()\n\nThis launches the hub in a thread and is non-blocking. If you are not\ninterested in connections from web SAMP clients, then you can use::\n\n    from astropy.samp import SAMPHubServer\n    hub = SAMPHubServer(web_profile=False)\n    hub.start()\n\nThis should be all you need to do. However, if you want to keep the Web\nProfile active, there is an additional consideration: when a web\nSAMP client connects, you will need to ask the user whether they accept the\nconnection (for security reasons). By default, the confirmation message is a\ntext-based message in the terminal, but if you have a GUI tool, you will\nlikely want to open a GUI dialog instead.\n\nTo do this, you will need to define a class that handles the dialog, and then\npass an **instance** of the class to |SAMPHubServer| (not the class itself).\nThis class should inherit from `astropy.samp.WebProfileDialog` and add the\nfollowing:\n\n    1) A GUI timer callback that periodically calls\n       ``WebProfileDialog.handle_queue`` (available as\n       ``self.handle_queue``).\n\n    2) A ``show_dialog`` method to display a consent dialog.\n       It should take the following arguments:\n\n           - ``samp_name``: The name of the application making the request.\n\n           - ``details``: A dictionary of details about the client\n             making the request. The only key in this dictionary required by\n             the SAMP standard is ``samp.name`` which gives the name of the\n             client making the request.\n\n           - ``client``: A hostname, port pair containing the client\n             address.\n\n           - ``origin``: A string containing the origin of the\n             request.\n\n    3) Based on the user response, the ``show_dialog`` should call\n       ``WebProfileDialog.consent`` or ``WebProfileDialog.reject``.\n       This may, in some cases, be the result of another GUI callback.\n\nExample of embedding a SAMP hub in a Tk application\n---------------------------------------------------\n\n..\n  EXAMPLE START\n  Embedding a SAMP Hub in a Tk Application\n\nThe following code is a full example of a Tk application that watches for web\nSAMP connections and opens the appropriate dialog::\n\n    import tkinter as tk\n    import tkinter.messagebox as tkMessageBox\n\n    from astropy.samp import SAMPHubServer\n    from astropy.samp.hub import WebProfileDialog\n\n    MESSAGE = \"\"\"\n    A Web application which declares to be\n\n    Name: {name}\n    Origin: {origin}\n\n    is requesting to be registered with the SAMP Hub.  Pay attention\n    that if you permit its registration, such application will acquire\n    all current user privileges, like file read/write.\n\n    Do you give your consent?\n    \"\"\"\n\n    class TkWebProfileDialog(WebProfileDialog):\n        def __init__(self, root):\n            self.root = root\n            self.wait_for_dialog()\n\n        def wait_for_dialog(self):\n            self.handle_queue()\n            self.root.after(100, self.wait_for_dialog)\n\n        def show_dialog(self, samp_name, details, client, origin):\n            text = MESSAGE.format(name=samp_name, origin=origin)\n\n            response = tkMessageBox.askyesno(\n                'SAMP Hub', text,\n                default=tkMessageBox.NO)\n\n            if response:\n                self.consent()\n            else:\n                self.reject()\n\n    # Start up Tk application\n    root = tk.Tk()\n    tk.Label(root, text=\"Example SAMP Tk application\",\n             font=(\"Helvetica\", 36), justify=tk.CENTER).pack(pady=200)\n    root.geometry(\"500x500\")\n    root.update()\n\n    # Start up SAMP hub\n    h = SAMPHubServer(web_profile_dialog=TkWebProfileDialog(root))\n    h.start()\n\n    try:\n        # Main GUI loop\n        root.mainloop()\n    except KeyboardInterrupt:\n        pass\n\n    h.stop()\n\nIf you run the above script, a window will open that says \"Example SAMP Tk\napplication.\" If you then go to the following page, for example:\n\nhttp://astrojs.github.io/sampjs/examples/pinger.html\n\nand click on the Ping button, you will see the dialog open in the Tk\napplication. Once you click on \"CONFIRM,\" future \"Ping\" calls will no longer\nbring up the dialog.\n\n..\n  EXAMPLE END\n"},{"attributeType":"WCS","col":0,"comment":"null","endLoc":10,"id":135,"name":"w","nodeType":"Attribute","startLoc":10,"text":"w"},{"attributeType":"WCS","col":0,"comment":"null","endLoc":8,"id":136,"name":"input_wcs","nodeType":"Attribute","startLoc":8,"text":"input_wcs"},{"id":137,"name":"example_table_image.rst","nodeType":"TextFile","path":"docs/samp","text":".. doctest-skip-all\n\n.. _vo-samp-example-table-image:\n\nSending and Receiving Tables and Images over SAMP\n*************************************************\n\nIn the following examples, we make use of:\n\n* `TOPCAT <http://www.star.bris.ac.uk/~mbt/topcat/>`_, which is a tool to\n  explore tabular data.\n* `SAO DS9 <http://ds9.si.edu/>`_, which is an image\n  visualization tool that can overplot catalogs.\n* `Aladin Desktop <http://aladin.u-strasbg.fr>`_, which is another tool that\n  can visualize images and catalogs.\n\nTOPCAT and Aladin will run a SAMP Hub if none is found, so for the following\nexamples you can either start up one of these applications first, or you can\nstart up the `astropy.samp` hub. You can start this using the following\ncommand::\n\n    $ samp_hub\n\nSending a Table to TOPCAT and DS9\n=================================\n\nThe easiest way to send a VO table to TOPCAT is to make use of the\n|SAMPIntegratedClient| class. Once TOPCAT is open, first instantiate a\n|SAMPIntegratedClient| instance and then connect to the hub::\n\n    >>> from astropy.samp import SAMPIntegratedClient\n    >>> client = SAMPIntegratedClient()\n    >>> client.connect()\n\nNext, we have to set up a dictionary that contains details about the table to\nsend. This should include ``url``, which is the URL to the file, and ``name``,\nwhich is a human-readable name for the table. The URL can be a local URL\n(starting with ``file:///``)::\n\n    >>> params = {}\n    >>> params[\"url\"] = 'file:///Users/tom/Desktop/aj285677t3_votable.xml'\n    >>> params[\"name\"] = \"Robitaille et al. (2008), Table 3\"\n\n.. note:: To construct a local URL, you can also make use of ``urlparse`` as\n          follows::\n\n                >>> import urlparse\n                >>> params[\"url\"] = urlparse.urljoin('file:', os.path.abspath(\"aj285677t3_votable.xml\"))\n\nNow we can set up the message itself. This includes the type of message (here\nwe use ``table.load.votable``, which indicates that a VO table should be loaded\nand the details of the table that we set above)::\n\n    >>> message = {}\n    >>> message[\"samp.mtype\"] = \"table.load.votable\"\n    >>> message[\"samp.params\"] = params\n\nFinally, we can broadcast this to all clients that are listening for\n``table.load.votable`` messages using\n:meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.notify_all`::\n\n    >>> client.notify_all(message)\n\nThe above message will actually be broadcast to all applications connected via\nSAMP. For example, if we open `SAO DS9 <http://ds9.si.edu/>`_ in\naddition to TOPCAT, and we run the above command, both applications will load\nthe table. We can use the\n:meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.get_registered_clients` method to\nfind all of the clients connected to the hub::\n\n    >>> client.get_registered_clients()\n    ['hub', 'c1', 'c2']\n\nThese IDs do not mean much, but we can find out more using::\n\n   >>> client.get_metadata('c1')\n   {'author.affiliation': 'Astrophysics Group, Bristol University',\n    'author.email': 'm.b.taylor@bristol.ac.uk',\n    'author.name': 'Mark Taylor',\n    'home.page': 'http://www.starlink.ac.uk/topcat/',\n    'samp.description.text': 'Tool for OPerations on Catalogues And Tables',\n    'samp.documentation.url': 'http://127.0.0.1:2525/doc/sun253/index.html',\n    'samp.icon.url': 'http://127.0.0.1:2525/doc/images/tc_sok.gif',\n    'samp.name': 'topcat',\n    'topcat.version': '4.0-1'}\n\nWe can see that ``c1`` is the TOPCAT client. We can now resend the data, but\nthis time only to TOPCAT, using the\n:meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.notify` method::\n\n    >>> client.notify('c1', message)\n\nOnce finished, we should make sure we disconnect from the hub::\n\n    >>> client.disconnect()\n\nReceiving a Table from TOPCAT\n=============================\n\nTo receive a table from TOPCAT, we have to set up a client that listens for\nmessages from the hub. As before, we instantiate a |SAMPIntegratedClient|\ninstance and connect to the hub::\n\n    >>> from astropy.samp import SAMPIntegratedClient\n    >>> client = SAMPIntegratedClient()\n    >>> client.connect()\n\nWe now set up a receiver class which will handle any received messages. We need\nto take care to write handlers for both notifications and calls (the difference\nbetween the two being that calls expect a reply)::\n\n    >>> class Receiver(object):\n    ...     def __init__(self, client):\n    ...         self.client = client\n    ...         self.received = False\n    ...     def receive_call(self, private_key, sender_id, msg_id, mtype, params, extra):\n    ...         self.params = params\n    ...         self.received = True\n    ...         self.client.reply(msg_id, {\"samp.status\": \"samp.ok\", \"samp.result\": {}})\n    ...     def receive_notification(self, private_key, sender_id, mtype, params, extra):\n    ...         self.params = params\n    ...         self.received = True\n\nAnd we instantiate it:\n\n    >>> r = Receiver(client)\n\nWe can now use the\n:meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.bind_receive_call`\nand\n:meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.bind_receive_notification`\nmethods to tell our receiver to listen to all ``table.load.votable`` messages::\n\n    >>> client.bind_receive_call(\"table.load.votable\", r.receive_call)\n    >>> client.bind_receive_notification(\"table.load.votable\", r.receive_notification)\n\nWe can now check that the message has not been received yet::\n\n    >>> r.received\n    False\n\nWe can now broadcast the table from TOPCAT. After a few seconds, we can check\nagain if the message has been received::\n\n    >>> r.received\n    True\n\nSuccess! The table URL should now be available in ``r.params['url']``, so we\ncan do::\n\n    >>> from astropy.table import Table\n    >>> t = Table.read(r.params['url'])\n    Downloading http://127.0.0.1:2525/dynamic/4/t12.vot [Done]\n    >>> t\n               col1             col2     col3    col4     col5    col6 col7  col8 col9 col10\n    ------------------------- -------- ------- -------- -------- ----- ---- ----- ---- -----\n    SSTGLMC G000.0046+01.1431   0.0046  1.1432 265.2992 -28.3321  6.67 5.04  6.89 5.22     N\n    SSTGLMC G000.0106-00.7315   0.0106 -0.7314 267.1274 -29.3063  7.18 6.07   nan 5.17     Y\n    SSTGLMC G000.0110-01.0237   0.0110 -1.0236 267.4151 -29.4564  8.32 6.30  8.34 6.32     N\n    ...\n\nAs before, we should remember to disconnect from the hub once we are done::\n\n    >>> client.disconnect()\n\nExample\n=======\n\n..\n  EXAMPLE START\n  Receiving and Reading a Table over SAMP\n\nThe following is a full example of a script that can be used to receive and\nread a table. It includes a loop that waits until the message is received, and\nreads the table once it has::\n\n    import time\n\n    from astropy.samp import SAMPIntegratedClient\n    from astropy.table import Table\n\n     # Instantiate the client and connect to the hub\n    client=SAMPIntegratedClient()\n    client.connect()\n\n    # Set up a receiver class\n    class Receiver(object):\n        def __init__(self, client):\n            self.client = client\n            self.received = False\n        def receive_call(self, private_key, sender_id, msg_id, mtype, params, extra):\n            self.params = params\n            self.received = True\n            self.client.reply(msg_id, {\"samp.status\": \"samp.ok\", \"samp.result\": {}})\n        def receive_notification(self, private_key, sender_id, mtype, params, extra):\n            self.params = params\n            self.received = True\n\n    # Instantiate the receiver\n    r = Receiver(client)\n\n    # Listen for any instructions to load a table\n    client.bind_receive_call(\"table.load.votable\", r.receive_call)\n    client.bind_receive_notification(\"table.load.votable\", r.receive_notification)\n\n    # We now run the loop to wait for the message in a try/finally block so that if\n    # the program is interrupted e.g. by control-C, the client terminates\n    # gracefully.\n\n    try:\n\n        # We test every 0.1s to see if the hub has sent a message\n        while True:\n            time.sleep(0.1)\n            if r.received:\n                t = Table.read(r.params['url'])\n                break\n\n    finally:\n\n        client.disconnect()\n\n    # Print out table\n    print t\n\n..\n  EXAMPLE END\n\nSending an Image to DS9 and Aladin\n==================================\n\nAs for tables, the most convenient way to send a FITS image over SAMP is to\nmake use of the |SAMPIntegratedClient| class. Once Aladin or DS9 are open,\nfirst instantiate a |SAMPIntegratedClient| instance and then connect to the hub\nas before::\n\n    >>> from astropy.samp import SAMPIntegratedClient\n    >>> client = SAMPIntegratedClient()\n    >>> client.connect()\n\nNext, we have to set up a dictionary that contains details about the image to\nsend. This should include ``url``, which is the URL to the file, and ``name``,\nwhich is a human-readable name for the table. The URL can be a local URL\n(starting with ``file:///``)::\n\n    >>> params = {}\n    >>> params[\"url\"] = 'file:///Users/tom/Desktop/MSX_E.fits'\n    >>> params[\"name\"] = \"MSX Band E Image of the Galactic Center\"\n\nSee `Sending a Table to TOPCAT and DS9`_ for an example of a recommended way to\nconstruct local URLs. Now we can set up the message itself. This includes the\ntype of message (here we use ``image.load.fits`` which indicates that a FITS\nimage should be loaded, and the details of the table that we set above)::\n\n    >>> message = {}\n    >>> message[\"samp.mtype\"] = \"image.load.fits\"\n    >>> message[\"samp.params\"] = params\n\nFinally, we can broadcast this to all clients that are listening for\n``table.load.votable`` messages::\n\n    >>> client.notify_all(message)\n\nAs for `Sending a Table to TOPCAT and DS9`_, the\n:meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.notify_all`\nmethod will broadcast the image to all listening clients, and for tables it\nis possible to instead use the\n:meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.notify` method\nto send it to a specific client.\n\nOnce finished, we should make sure we disconnect from the hub::\n\n    >>> client.disconnect()\n\nReceiving a Table from DS9 or Aladin\n====================================\n\nReceiving images over SAMP is identical to `Receiving a Table from TOPCAT`_,\nwith the exception that the message type should be ``image.load.fits`` instead\nof ``table.load.votable``. Once the URL has been received, the FITS image can\nbe opened with::\n\n    >>> from astropy.io import fits\n    >>> fits.open(r.params['url'])\n"},{"id":138,"name":"performance.inc.rst","nodeType":"TextFile","path":"docs/samp","text":".. note that if this is changed from the default approach of using an *include*\n   (in index.rst) to a separate performance page, the header needs to be changed\n   from === to ***, the filename extension needs to be changed from .inc.rst to\n   .rst, and a link needs to be added in the subpackage toctree\n\n.. _astropy-samp-performance:\n\n.. Performance Tips\n.. ================\n..\n.. Here we provide some tips and tricks for how to optimize performance of code\n.. using `astropy.samp`.\n"},{"id":139,"name":"example_clients.rst","nodeType":"TextFile","path":"docs/samp","text":".. doctest-skip-all\n\n.. _vo-samp-example_clients:\n\n\nCommunication between Integrated Clients Objects\n************************************************\n\nAs shown in :doc:`example_table_image`, the |SAMPIntegratedClient| class can be\nused to communicate with other SAMP-enabled tools such as `TOPCAT\n<http://www.star.bris.ac.uk/~mbt/topcat/>`_, `SAO DS9\n<http://ds9.si.edu/>`_, or `Aladin Desktop\n<http://aladin.u-strasbg.fr>`_.\n\nIn this section, we look at how we can set up two |SAMPIntegratedClient|\ninstances and communicate between them.\n\nFirst, start up a SAMP hub as described in :doc:`example_hub`.\n\nNext, we create two clients and connect them to the hub::\n\n   >>> from astropy import samp\n   >>> client1 = samp.SAMPIntegratedClient(name=\"Client 1\", description=\"Test Client 1\",\n   ...                                     metadata = {\"client1.version\":\"0.01\"})\n   >>> client2 = samp.SAMPIntegratedClient(name=\"Client 2\", description=\"Test Client 2\",\n   ...                                     metadata = {\"client2.version\":\"0.25\"})\n   >>> client1.connect()\n   >>> client2.connect()\n\nWe now define functions to call when receiving a notification, call or\nresponse::\n\n   >>> def test_receive_notification(private_key, sender_id, mtype, params, extra):\n   ...     print(\"Notification:\", private_key, sender_id, mtype, params, extra)\n\n   >>> def test_receive_call(private_key, sender_id, msg_id, mtype, params, extra):\n   ...     print(\"Call:\", private_key, sender_id, msg_id, mtype, params, extra)\n   ...     client1.ereply(msg_id, samp.SAMP_STATUS_OK, result = {\"txt\": \"printed\"})\n\n   >>> def test_receive_response(private_key, sender_id, msg_id, response):\n   ...     print(\"Response:\", private_key, sender_id, msg_id, response)\n\nWe subscribe client 1 to ``\"samp.app.*\"`` and bind it to the\nrelated functions::\n\n   >>> client1.bind_receive_notification(\"samp.app.*\", test_receive_notification)\n   >>> client1.bind_receive_call(\"samp.app.*\", test_receive_call)\n\nWe now bind message tags received by client 2 to suitable functions::\n\n   >>> client2.bind_receive_response(\"my-dummy-print\", test_receive_response)\n   >>> client2.bind_receive_response(\"my-dummy-print-specific\", test_receive_response)\n\nWe are now ready to test out the clients and callback functions. Client 2\nnotifies all clients using the \"samp.app.echo\" message type via the hub::\n\n   >>> client2.enotify_all(\"samp.app.echo\", txt=\"Hello world!\")\n   ['cli#2']\n   Notification: 0d7f4500225981c104a197c7666a8e4e cli#2 samp.app.echo {'txt':\n   'Hello world!'} {'host': 'antigone.lambrate.inaf.it', 'user': 'unknown'}\n\nWe can also find a dictionary that specifies which clients would currently\nreceive ``samp.app.echo`` messages::\n\n   >>> print(client2.get_subscribed_clients(\"samp.app.echo\"))\n   {'cli#2': {}}\n\nClient 2 calls all clients with the ``\"samp.app.echo\"`` message type using\n``\"my-dummy-print\"`` as a message-tag::\n\n   >>> print(client2.call_all(\"my-dummy-print\",\n   ...                        {\"samp.mtype\": \"samp.app.echo\",\n   ...                         \"samp.params\": {\"txt\": \"Hello world!\"}}))\n   {'cli#1': 'msg#1;;cli#hub;;cli#2;;my-dummy-print'}\n   Call: 8c8eb53178cb95e168ab17ec4eac2353 cli#2\n   msg#1;;cli#hub;;cli#2;;my-dummy-print samp.app.echo {'txt': 'Hello world!'}\n   {'host': 'antigone.lambrate.inaf.it', 'user': 'unknown'}\n   Response: d0a28636321948ccff45edaf40888c54 cli#1 my-dummy-print\n   {'samp.status': 'samp.ok', 'samp.result': {'txt': 'printed'}}\n\nClient 2 then calls client 1 using the ``\"samp.app.echo\"`` message type,\ntagging the message as ``\"my-dummy-print-specific\"``::\n\n   >>> try:\n   ...     print(client2.call(client1.get_public_id(),\n   ...                        \"my-dummy-print-specific\",\n   ...                        {\"samp.mtype\": \"samp.app.echo\",\n   ...                         \"samp.params\": {\"txt\": \"Hello client 1!\"}}))\n   ... except samp.SAMPProxyError as e:\n   ...     print(\"Error ({0}): {1}\".format(e.faultCode, e.faultString))\n   msg#2;;cli#hub;;cli#2;;my-dummy-print-specific\n   Call: 8c8eb53178cb95e168ab17ec4eac2353 cli#2\n   msg#2;;cli#hub;;cli#2;;my-dummy-print-specific samp.app.echo {'txt': 'Hello\n   Cli 1!'} {'host': 'antigone.lambrate.inaf.it', 'user': 'unknown'}\n   Response: d0a28636321948ccff45edaf40888c54 cli#1 my-dummy-print-specific\n   {'samp.status': 'samp.ok', 'samp.result': {'txt': 'printed'}}\n\nWe can now define a function called to test synchronous calls::\n\n   >>> def test_receive_sync_call(private_key, sender_id, msg_id, mtype, params, extra):\n   ...     import time\n   ...     print(\"SYNC Call:\", sender_id, msg_id, mtype, params, extra)\n   ...     time.sleep(2)\n   ...     client1.reply(msg_id, {\"samp.status\": samp.SAMP_STATUS_OK,\n   ...                            \"samp.result\": {\"txt\": \"printed sync\"}})\n\nWe now bind the ``samp.test`` message type to ``test_receive_sync_call``::\n\n   >>> client1.bind_receive_call(\"samp.test\", test_receive_sync_call)\n   >>> try:\n   ...     # Sync call\n   ...     print(client2.call_and_wait(client1.get_public_id(),\n   ...                                 {\"samp.mtype\": \"samp.test\",\n   ...                                  \"samp.params\": {\"txt\": \"Hello SYNCRO client 1!\"}},\n   ...                                  \"10\"))\n   ... except samp.SAMPProxyError as e:\n   ...     # If timeout expires than a SAMPProxyError is returned\n   ...     print(\"Error ({0}): {1}\".format(e.faultCode, e.faultString))\n   SYNC Call: cli#2 msg#3;;cli#hub;;cli#2;;sampy::sync::call samp.test {'txt':\n   'Hello SYNCRO Cli 1!'} {'host': 'antigone.lambrate.inaf.it', 'user':\n   'unknown'}\n   {'samp.status': 'samp.ok', 'samp.result': {'txt': 'printed sync'}}\n\nFinally, we disconnect the clients from the hub at the end::\n\n   >>> client1.disconnect()\n   >>> client2.disconnect()\n"},{"id":140,"name":"index.rst","nodeType":"TextFile","path":"docs/samp","text":".. doctest-skip-all\n\n.. _vo-samp:\n\n*************************************************************\nSAMP (Simple Application Messaging Protocol) (`astropy.samp`)\n*************************************************************\n\n`astropy.samp` is a Python implementation of the SAMP messaging system.\n\nSimple Application Messaging Protocol (SAMP) is an inter-process communication\nsystem that allows different client programs, usually running on the same\ncomputer, to communicate with each other by exchanging short messages that may\nreference external data files. The protocol has been developed within the\nInternational Virtual Observatory Alliance (IVOA) and is understood by many\ndesktop astronomy tools, including `TOPCAT\n<http://www.star.bris.ac.uk/~mbt/topcat/>`_, `SAO DS9 <http://ds9.si.edu/>`_,\nand `Aladin <http://aladin.u-strasbg.fr>`_.\n\nSo by using the classes in `astropy.samp`, Python code can interact with\nother running desktop clients, for instance displaying a named FITS file in DS9,\nprompting Aladin to recenter on a given sky position, or receiving a message\nidentifying the row when a user highlights a plotted point in TOPCAT.\n\nThe way the protocol works is that a SAMP \"Hub\" process must be running on the\nlocal host, and then various client programs can connect to it. Once connected,\nthese clients can send messages to each other via the hub. The details are\ndescribed in the `SAMP standard <http://www.ivoa.net/documents/SAMP/>`_.\n\n`astropy.samp` provides classes both to set up such a hub process, and to\nhelp implement a client that can send and receive messages. It also provides a\nstand-alone program ``samp_hub`` which can run a persistent hub in its own\nprocess. Note that setting up the hub from Python is not always necessary, since\nvarious other SAMP-aware applications may start up a hub independently; in most\ncases, only one running hub is used during a SAMP session.\n\nThe following classes are available in `astropy.samp`:\n\n* |SAMPHubServer|, which is used to instantiate a hub server that clients can\n  then connect to.\n* |SAMPHubProxy|, which is used to connect to an existing hub (including hubs\n  started from other applications such as\n  `TOPCAT <http://www.star.bris.ac.uk/~mbt/topcat/>`_).\n* |SAMPClient|, which is used to create a SAMP client.\n* |SAMPIntegratedClient|, which is the same as |SAMPClient| except that it has\n  a self-contained |SAMPHubProxy| to provide a simpler user interface.\n\n`astropy.samp` is a full implementation of `SAMP V1.3\n<http://www.ivoa.net/documents/SAMP/20120411/>`_. As well as the Standard\nProfile, it supports the Web Profile, which means that it can be used to also\ncommunicate with web SAMP clients; see the `sampjs\n<http://astrojs.github.io/sampjs/>`_ library examples for more details.\n\n.. _IVOA Simple Application Messaging Protocol: http://www.ivoa.net/documents/latest/SAMP.html\n\nUsing `astropy.samp`\n====================\n\n.. toctree::\n   :maxdepth: 2\n\n   example_hub\n   example_table_image\n   example_clients\n   advanced_embed_samp_hub\n\n.. note that if this section gets too long, it should be moved to a separate\n   doc page - see the top of performance.inc.rst for the instructions on how to do\n   that\n.. include:: performance.inc.rst\n\nReference/API\n=============\n\n.. automodapi:: astropy.samp\n\nAcknowledgments\n===============\n\nThis code is adapted from the `SAMPy <https://pypi.org/project/sampy>`__\npackage written by Luigi Paioro, who has granted the Astropy Project permission\nto use the code under a BSD license.\n"},{"id":141,"name":"example_hub.rst","nodeType":"TextFile","path":"docs/samp","text":".. doctest-skip-all\n\n.. _vo-samp-example_hub:\n\nStarting and Stopping a SAMP Hub Server\n***************************************\n\nThere are several ways you can start up a SAMP hub:\n\nUsing an Existing Hub\n=====================\n\nYou can start up another application that includes a hub, such as\n`TOPCAT <http://www.star.bris.ac.uk/~mbt/topcat/>`_,\n`SAO Ds9 <http://ds9.si.edu/>`_, or\n`Aladin Desktop <http://aladin.u-strasbg.fr>`_.\n\nUsing the Command-Line Hub Utility\n==================================\n\nYou can make use of the ``samp_hub`` command-line utility, which is included in\n``astropy``::\n\n    $ samp_hub\n\nTo get more help on available options for ``samp_hub``::\n\n    $ samp_hub -h\n\nTo stop the server, press control-C.\n\nStarting a Hub Programmatically (Advanced)\n==========================================\n\nYou can start up a hub by creating a |SAMPHubServer| instance and starting it,\neither from the interactive Python prompt, or from a Python script::\n\n    >>> from astropy.samp import SAMPHubServer\n    >>> hub = SAMPHubServer()\n    >>> hub.start()\n\nYou can then stop the hub by calling::\n\n    >>> hub.stop()\n\nHowever, this method is generally not recommended for average users because it\ndoes not work correctly when web SAMP clients try to connect. Instead, this\nshould be reserved for developers who want to embed a SAMP hub in a GUI, for\nexample. For more information, see :doc:`advanced_embed_samp_hub`.\n"},{"id":142,"name":"docs/time","nodeType":"Package"},{"id":143,"name":"performance.inc.rst","nodeType":"TextFile","path":"docs/time","text":".. note that if this is changed from the default approach of using an *include*\n   (in index.rst) to a separate performance page, the header needs to be changed\n   from === to ***, the filename extension needs to be changed from .inc.rst to\n   .rst, and a link needs to be added in the subpackage toctree\n\n.. _astropy-time-performance:\n\n.. Performance Tips\n.. ================\n..\n.. Here we provide some tips and tricks for how to optimize performance of code\n.. using `astropy.time`.\n"},{"id":144,"name":"index.rst","nodeType":"TextFile","path":"docs/time","text":".. _astropy-time:\n\n*******************************\nTime and Dates (`astropy.time`)\n*******************************\n\nIntroduction\n============\n\nThe `astropy.time` package provides functionality for manipulating times and\ndates. Specific emphasis is placed on supporting time scales (e.g., UTC, TAI,\nUT1, TDB) and time representations (e.g., JD, MJD, ISO 8601) that are used in\nastronomy and required to calculate, for example, sidereal times and barycentric\ncorrections. The `astropy.time` package is based on fast and memory efficient\nPyERFA_ wrappers around the ERFA_ time and calendar routines.\n\nAll time manipulations and arithmetic operations are done internally using two\n64-bit floats to represent time. Floating point algorithms from [#]_ are used so\nthat the |Time| object maintains sub-nanosecond precision over times spanning\nthe age of the universe.\n\n.. [#] Shewchuk, 1997, Discrete & Computational Geometry 18(3):305-363\n\nGetting Started\n===============\n\nThe usual way to use `astropy.time` is to create a |Time| object by\nsupplying one or more input time values as well as the `time format`_ and `time\nscale`_ of those values. The input time(s) can either be a single scalar like\n``\"2010-01-01 00:00:00\"`` or a list or a ``numpy`` array of values as shown\nbelow. In general, any output values have the same shape (scalar or array) as\nthe input.\n\nExamples\n--------\n\n.. EXAMPLE START: Creating a Time Object with astropy.time\n\nTo create a |Time| object:\n\n  >>> import numpy as np\n  >>> from astropy.time import Time\n  >>> times = ['1999-01-01T00:00:00.123456789', '2010-01-01T00:00:00']\n  >>> t = Time(times, format='isot', scale='utc')\n  >>> t\n  <Time object: scale='utc' format='isot' value=['1999-01-01T00:00:00.123' '2010-01-01T00:00:00.000']>\n  >>> t[1]\n  <Time object: scale='utc' format='isot' value=2010-01-01T00:00:00.000>\n\nThe ``format`` argument specifies how to interpret the input values (e.g., ISO,\nJD, or Unix time). The ``scale`` argument specifies the `time scale`_ for the\nvalues (e.g., UTC, TT, or UT1). The ``scale`` argument is optional and defaults\nto UTC except for `Time from Epoch Formats`_.\n\n.. EXAMPLE END\n\nWe could have written the above as::\n\n  >>> t = Time(times, format='isot')\n\nWhen the format of the input can be unambiguously determined, the\n``format`` argument is not required, so we can then simplify even further::\n\n  >>> t = Time(times)\n\nNow we can get the representation of these times in the JD and MJD\nformats by requesting the corresponding |Time| attributes::\n\n  >>> t.jd  # doctest: +FLOAT_CMP\n  array([2451179.50000143, 2455197.5       ])\n  >>> t.mjd  # doctest: +FLOAT_CMP\n  array([51179.00000143, 55197.        ])\n\nThe full power of output representation is available via the\n`~astropy.time.Time.to_value` method which also allows controlling the\n`subformat`_. For instance, using ``numpy.longdouble`` as the output type\nfor higher precision::\n\n  >>> t.to_value('mjd', 'long')  # doctest: +SKIP\n  array([51179.00000143, 55197.        ], dtype=float128)\n\nThe default representation can be changed by setting the ``format`` attribute::\n\n  >>> t.format = 'fits'\n  >>> t\n  <Time object: scale='utc' format='fits' value=['1999-01-01T00:00:00.123'\n                                                 '2010-01-01T00:00:00.000']>\n  >>> t.format = 'isot'\n\nWe can also convert to a different time scale, for instance from UTC to\nTT. This uses the same attribute mechanism as above but now returns a new\n|Time| object::\n\n  >>> t2 = t.tt\n  >>> t2\n  <Time object: scale='tt' format='isot' value=['1999-01-01T00:01:04.307' '2010-01-01T00:01:06.184']>\n  >>> t2.jd  # doctest: +FLOAT_CMP\n  array([2451179.5007443 , 2455197.50076602])\n\nNote that both the ISO (ISOT) and JD representations of ``t2`` are different\nthan for ``t`` because they are expressed relative to the TT time scale. Of\ncourse, from the numbers or strings you would not be able to tell this was the\ncase::\n\n  >>> print(t2.fits)\n  ['1999-01-01T00:01:04.307' '2010-01-01T00:01:06.184']\n\nYou can set the time values in place using the usual ``numpy`` array setting\nitem syntax::\n\n  >>> t2 = t.tt.copy()  # Copy required if transformed Time will be modified\n  >>> t2[1] = '2014-12-25'\n  >>> print(t2)\n  ['1999-01-01T00:01:04.307' '2014-12-25T00:00:00.000']\n\nThe |Time| object also has support for missing values, which is particularly\nuseful for :ref:`table_operations` such as joining and stacking::\n\n  >>> t2[0] = np.ma.masked  # Declare that first time is missing or invalid\n  >>> print(t2)\n  [-- '2014-12-25T00:00:00.000']\n\nFinally, some further examples of what is possible. For details, see\nthe API documentation below.\n\n  >>> dt = t[1] - t[0]\n  >>> dt  # doctest: +FLOAT_CMP\n  <TimeDelta object: scale='tai' format='jd' value=4018.00002172>\n\nHere, note the conversion of the timescale to TAI. Time differences\ncan only have scales in which one day is always equal to 86400 seconds.\n\n  >>> import numpy as np\n  >>> t[0] + dt * np.linspace(0.,1.,12)\n  <Time object: scale='utc' format='isot' value=['1999-01-01T00:00:00.123' '2000-01-01T06:32:43.930'\n   '2000-12-31T13:05:27.737' '2001-12-31T19:38:11.544'\n   '2003-01-01T02:10:55.351' '2004-01-01T08:43:39.158'\n   '2004-12-31T15:16:22.965' '2005-12-31T21:49:06.772'\n   '2007-01-01T04:21:49.579' '2008-01-01T10:54:33.386'\n   '2008-12-31T17:27:17.193' '2010-01-01T00:00:00.000']>\n\n  >>> t.sidereal_time('apparent', 'greenwich')  # doctest: +FLOAT_CMP +REMOTE_DATA\n  <Longitude [6.68050179, 6.70281947] hourangle>\n\nYou can also use time-based `~astropy.units.Quantity` for time arithmetic:\n\n  >>> import astropy.units as u\n  >>> Time(\"2020-01-01\") + 5 * u.day\n  <Time object: scale='utc' format='iso' value=2020-01-06 00:00:00.000>\n\nUsing `astropy.time`\n====================\n\nTime Object Basics\n------------------\n\nIn `astropy.time` a \"time\" is a single instant of time which is\nindependent of the way the time is represented (the \"format\") and the time\n\"scale\" which specifies the offset and scaling relation of the unit of time.\nThere is no distinction made between a \"date\" and a \"time\" since both concepts\n(as loosely defined in common usage) are just different representations of a\nmoment in time.\n\n.. _time-format:\n\nTime Format\n^^^^^^^^^^^\n\nThe time format specifies how an instant of time is represented. The currently\navailable formats are can be found in the ``Time.FORMATS`` dict and are listed\nin the table below. Each of these formats is implemented as a class that derives\nfrom the base :class:`~astropy.time.TimeFormat` class. This class structure can\nbe adapted and extended by users for specialized time formats not supplied in\n`astropy.time`.\n\n===========  =================================================  =====================================\nFormat            Class                                         Example Argument\n===========  =================================================  =====================================\nbyear        :class:`~astropy.time.TimeBesselianEpoch`          1950.0\nbyear_str    :class:`~astropy.time.TimeBesselianEpochString`    'B1950.0'\ncxcsec       :class:`~astropy.time.TimeCxcSec`                  63072064.184\ndatetime     :class:`~astropy.time.TimeDatetime`                datetime(2000, 1, 2, 12, 0, 0)\ndecimalyear  :class:`~astropy.time.TimeDecimalYear`             2000.45\nfits         :class:`~astropy.time.TimeFITS`                    '2000-01-01T00:00:00.000'\ngps          :class:`~astropy.time.TimeGPS`                     630720013.0\niso          :class:`~astropy.time.TimeISO`                     '2000-01-01 00:00:00.000'\nisot         :class:`~astropy.time.TimeISOT`                    '2000-01-01T00:00:00.000'\njd           :class:`~astropy.time.TimeJD`                      2451544.5\njyear        :class:`~astropy.time.TimeJulianEpoch`             2000.0\njyear_str    :class:`~astropy.time.TimeJulianEpochString`       'J2000.0'\nmjd          :class:`~astropy.time.TimeMJD`                     51544.0\nplot_date    :class:`~astropy.time.TimePlotDate`                730120.0003703703\nunix         :class:`~astropy.time.TimeUnix`                    946684800.0\nunix_tai     :class:`~astropy.time.TimeUnixTai`                 946684800.0\nyday         :class:`~astropy.time.TimeYearDayTime`             2000:001:00:00:00.000\nymdhms       :class:`~astropy.time.TimeYMDHMS`                  {'year': 2010, 'month': 3, 'day': 1}\ndatetime64   :class:`~astropy.time.TimeDatetime64`              np.datetime64('2000-01-01T01:01:01')\n===========  =================================================  =====================================\n\n.. note:: The :class:`~astropy.time.TimeFITS` format implements most\n   of the FITS standard [#]_, including support for the ``LOCAL`` timescale.\n   Note, though, that FITS supports some deprecated names for timescales;\n   these are translated to the formal names upon initialization. Furthermore,\n   any specific realization information, such as ``UT(NIST)`` is stored only as\n   long as the time scale is not changed.\n.. [#] `Rots et al. 2015, A&A 574:A36 <https://ui.adsabs.harvard.edu/abs/2015A%26A...574A..36R>`_\n\nChanging Format\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\n.. EXAMPLE START: Changing Time Format\n\nThe default representation can be changed by setting the ``format`` attribute::\n\n  >>> t = Time('2000-01-02')\n  >>> t.format = 'jd'\n  >>> t\n  <Time object: scale='utc' format='jd' value=2451545.5>\n\nBe aware that when changing format, the current output subformat (see section\nbelow) may not exist in the new format. In this case, the subformat will not be\npreserved::\n\n  >>> t = Time('2000-01-02', format='fits', out_subfmt='longdate')\n  >>> t.value\n  '+02000-01-02'\n  >>> t.format = 'iso'\n  >>> t.out_subfmt\n  u'*'\n  >>> t.format = 'fits'\n  >>> t.value\n  '2000-01-02T00:00:00.000'\n\n.. EXAMPLE END\n\nSubformat\n\"\"\"\"\"\"\"\"\"\n\nMany of the available time format classes support the concept of a subformat.\nThis allows for variations on the basic theme of a format in both the input\nparsing/validation and the output.\n\nThe table below illustrates available subformats for the string formats\n ``iso``, ``fits``, and ``yday`` formats:\n\n========  ============ ==============================\nFormat    Subformat    Input / Output\n========  ============ ==============================\n``iso``   date_hms     2001-01-02 03:04:05.678\n``iso``   date_hm      2001-01-02 03:04\n``iso``   date         2001-01-02\n``fits``  date_hms     2001-01-02T03:04:05.678\n``fits``  longdate_hms +02001-01-02T03:04:05.678\n``fits``  longdate     +02001-01-02\n``yday``  date_hms     2001:032:03:04:05.678\n``yday``  date_hm      2001:032:03:04\n``yday``  date         2001:032\n========  ============ ==============================\n\nNumerical formats such as ``mjd``, ``jyear``, or ``cxcsec`` all support the\nsubformats: ``'float'``, ``'long'``, ``'decimal'``, ``'str'``, and ``'bytes'``.\nHere, ``'long'`` uses ``numpy.longdouble`` for somewhat enhanced precision (with\nthe enhancement depending on platform), and ``'decimal'`` instances of\n:class:`decimal.Decimal` for full precision. For the ``'str'`` and ``'bytes'``\nsubformats, the number of digits is also chosen such that time values are\nrepresented accurately.\n\nWhen used on input, these formats allow creating a time using a single input\nvalue that accurately captures the value to the full available precision in\n|Time|. Conversely, the single value on output using |Time|\n`~astropy.time.Time.to_value` or |TimeDelta| `~astropy.time.TimeDelta.to_value`\ncan have higher precision than the standard 64-bit float::\n\n  >>> tm = Time('51544.000000000000001', format='mjd')  # String input\n  >>> tm.mjd  # float64 output loses last digit but Decimal gets it\n  51544.0\n  >>> tm.to_value('mjd', subfmt='decimal')  # doctest: +SKIP\n  Decimal('51544.00000000000000099920072216264')\n  >>> tm.to_value('mjd', subfmt='str')\n  '51544.000000000000001'\n\nThe complete list of subformat options for the |Time| formats that\nhave them is:\n\n================ ========================================\nFormat           Subformats\n================ ========================================\n``byear``        float, long, decimal, str, bytes\n``cxcsec``       float, long, decimal, str, bytes\n``datetime64``   date_hms, date_hm, date\n``decimalyear``  float, long, decimal, str, bytes\n``fits``         date_hms, date, longdate_hms, longdate\n``gps``          float, long, decimal, str, bytes\n``iso``          date_hms, date_hm, date\n``isot``         date_hms, date_hm, date\n``jd``           float, long, decimal, str, bytes\n``jyear``        float, long, decimal, str, bytes\n``mjd``          float, long, decimal, str, bytes\n``plot_date``    float, long, decimal, str, bytes\n``unix``         float, long, decimal, str, bytes\n``unix_tai``     float, long, decimal, str, bytes\n``yday``         date_hms, date_hm, date\n================ ========================================\n\nThe complete list of subformat options for the |TimeDelta| formats\nthat have them is:\n\n================ ========================================\nFormat           Subformats\n================ ========================================\n``jd``           float, long, decimal, str, bytes\n``sec``          float, long, decimal, str, bytes\n================ ========================================\n\nTime from Epoch Formats\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nThe formats ``cxcsec``, ``gps``, ``unix``, and ``unix_tai`` are special in that\nthey provide a floating point representation of the elapsed time in seconds\nsince a particular reference date. These formats have a intrinsic time scale\nwhich is used to compute the elapsed seconds since the reference date.\n\n============ ====== ========================\nFormat       Scale  Reference date\n============ ====== ========================\n``cxcsec``   TT     ``1998-01-01 00:00:00``\n``unix``     UTC    ``1970-01-01 00:00:00``\n``unix_tai`` TAI    ``1970-01-01 00:00:08``\n``gps``      TAI    ``1980-01-06 00:00:19``\n============ ====== ========================\n\nUnlike the other formats which default to UTC, if no ``scale`` is provided when\ninitializing a |Time| object then the above intrinsic scale is used.\nThis is done for computational efficiency.\n\n.. _time-scale:\n\nTime Scale\n^^^^^^^^^^\n\nThe time scale (or `time standard\n<https://en.wikipedia.org/wiki/Time_standard>`_) is \"a specification for\nmeasuring time: either the rate at which time passes; or points in time; or\nboth\" [#]_, [#]_.\n::\n\n  >>> Time.SCALES\n  ('tai', 'tcb', 'tcg', 'tdb', 'tt', 'ut1', 'utc', 'local')\n\n====== =================================\nScale  Description\n====== =================================\ntai    International Atomic Time   (TAI)\ntcb    Barycentric Coordinate Time (TCB)\ntcg    Geocentric Coordinate Time  (TCG)\ntdb    Barycentric Dynamical Time  (TDB)\ntt     Terrestrial Time             (TT)\nut1    Universal Time              (UT1)\nutc    Coordinated Universal Time  (UTC)\nlocal  Local Time Scale          (LOCAL)\n====== =================================\n\n.. [#] Wikipedia `time standard <https://en.wikipedia.org/wiki/Time_standard>`_ article\n.. [#] SOFA_ Time Scale and Calendar Tools\n       `(PDF) <http://www.iausofa.org/sofa_ts_c.pdf>`_\n\n.. note:: The ``local`` time scale is meant for free-running clocks or\n   simulation times (i.e., to represent a time without a properly defined\n   scale). This means it cannot be converted to any other time scale, and\n   arithmetic is possible only with |Time| instances with scale ``local`` and\n   with |TimeDelta| instances with scale ``local`` or `None`.\n\nThe system of transformation between supported time scales (i.e., all but\n``local``) is shown in the figure below. Further details are provided in the\n`Convert time scale`_ section.\n\n.. image:: time_scale_conversion.png\n\nScalar or Array\n^^^^^^^^^^^^^^^\n\nA |Time| object can hold either a single time value or an array of time values.\nThe distinction is made entirely by the form of the input time(s). If a |Time|\nobject holds a single value then any format outputs will be a single scalar\nvalue, and likewise for arrays.\n\nExample\n\"\"\"\"\"\"\"\n\n.. EXAMPLE START: Time Objects Holding Scalar or Array Values\n\nLike other arrays and lists, |Time| objects holding arrays are subscriptable,\nreturning scalar or array objects as appropriate::\n\n  >>> from astropy.time import Time\n  >>> t = Time(100.0, format='mjd')\n  >>> t.jd\n  2400100.5\n  >>> t = Time([100.0, 200.0, 300.], format='mjd')\n  >>> t.jd  # doctest: +FLOAT_CMP\n  array([2400100.5, 2400200.5, 2400300.5])\n  >>> t[:2]  # doctest: +FLOAT_CMP\n  <Time object: scale='utc' format='mjd' value=[100. 200.]>\n  >>> t[2]\n  <Time object: scale='utc' format='mjd' value=300.0>\n  >>> t = Time(np.arange(50000., 50003.)[:, np.newaxis],\n  ...          np.arange(0., 1., 0.5), format='mjd')\n  >>> t  # doctest: +FLOAT_CMP\n  <Time object: scale='utc' format='mjd' value=[[50000.  50000.5]\n   [50001.  50001.5]\n   [50002.  50002.5]]>\n  >>> t[0]  # doctest: +FLOAT_CMP\n  <Time object: scale='utc' format='mjd' value=[50000.  50000.5]>\n\n.. EXAMPLE END\n\n.. _astropy-time-shape-methods:\n\nNumPy Method Analogs and Applicable NumPy Functions\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nFor |Time| instances holding arrays, many of the same methods and attributes\nthat work on `~numpy.ndarray` instances can be used. For example, you can\nreshape |Time| instances and take specific parts using\n:meth:`~astropy.time.Time.reshape`, :meth:`~astropy.time.Time.ravel`,\n:meth:`~astropy.time.Time.flatten`, :attr:`~astropy.time.Time.T`,\n:meth:`~astropy.time.Time.transpose`, :meth:`~astropy.time.Time.swapaxes`,\n:meth:`~astropy.time.Time.diagonal`, :meth:`~astropy.time.Time.squeeze`, or\n:meth:`~astropy.time.Time.take`. Corresponding functions, as well as others\nthat affect the shape, such as `~numpy.atleast_1d` and `~numpy.rollaxis`, work\nas expected. (The relevant functions have to be explicitly enabled in\n``astropy`` source code; let us know if a ``numpy`` function is not supported\nthat you think should work.)\n\nExamples\n\"\"\"\"\"\"\"\"\n\n.. EXAMPLE START: Reshaping Time Instances Using NumPy Method Analogs\n\nTo reshape |Time| instances::\n\n  >>> t.reshape(2, 3)\n  <Time object: scale='utc' format='mjd' value=[[50000.  50000.5 50001. ]\n   [50001.5 50002.  50002.5]]>\n  >>> t.T\n  <Time object: scale='utc' format='mjd' value=[[50000.  50001.  50002. ]\n   [50000.5 50001.5 50002.5]]>\n  >>> np.roll(t, 1, axis=0)\n  <Time object: scale='utc' format='mjd' value=[[50002.  50002.5]\n   [50000.  50000.5]\n   [50001.  50001.5]]>\n\nNote that similarly to the `~numpy.ndarray` methods, all but\n:meth:`~astropy.time.Time.flatten` try to use new views of the data,\nwith the data copied only if that is impossible (as discussed, for example, in\nthe documentation for ``numpy`` :func:`~numpy.reshape`).\n\n.. EXAMPLE END\n\nSome arithmetic methods are supported as well: :meth:`~astropy.time.Time.min`,\n:meth:`~astropy.time.Time.max`, :meth:`~astropy.time.Time.ptp`,\n:meth:`~astropy.time.Time.sort`, :meth:`~astropy.time.Time.argmin`,\n:meth:`~astropy.time.Time.argmax`, and :meth:`~astropy.time.Time.argsort`.\n\n.. EXAMPLE START: Applying Arithmetic Methods to Time Instances\n\nTo apply arithmetic methods to |Time| instances::\n\n  >> t.max()\n  <Time object: scale='utc' format='mjd' value=50002.5>\n  >> t.ptp(axis=0)  # doctest: +FLOAT_CMP\n  <TimeDelta object: scale='tai' format='jd' value=[2. 2.]>\n\n.. EXAMPLE END\n\n.. _astropy-time-inferring-input:\n\nInferring Input Format\n^^^^^^^^^^^^^^^^^^^^^^\n\nThe |Time| class initializer will not accept ambiguous inputs, but it will make\nautomatic inferences in cases where the inputs are unambiguous. This can apply\nwhen the times are supplied as objects, inputs for ``ymdhms``, or strings. In\nthe latter case it is not required to specify the format because the available\nstring formats have no overlap. However, if the format is known in advance the\nstring parsing will be faster if the format is provided.\n\nExample\n\"\"\"\"\"\"\"\n\n.. EXAMPLE START: Inferring Input Format in the Time Class\n\nTo infer input format::\n\n  >>> from datetime import datetime\n  >>> t = Time(datetime(2010, 1, 2, 1, 2, 3))\n  >>> t.format\n  'datetime'\n  >>> t = Time('2010-01-02 01:02:03')\n  >>> t.format\n  'iso'\n\n.. EXAMPLE END\n\nInternal Representation\n^^^^^^^^^^^^^^^^^^^^^^^\n\nThe |Time| object maintains an internal representation of time as a pair of\ndouble precision numbers expressing Julian days. The sum of the two numbers is\nthe Julian Date for that time relative to the given `time scale`_. Users\nrequiring no better than microsecond precision over human time scales (~100\nyears) can safely ignore the internal representation details and skip this\nsection.\n\nThis representation is driven by the underlying ERFA_ C-library implementation.\nThe ERFA routines take care throughout to maintain overall precision of the\ndouble pair. Users are free to choose the way in which total JD is\nprovided, though internally one part contains integer days and the\nother the fraction of the day, as this ensures optimal accuracy for\nall conversions. The internal JD pair is available via the ``jd1``\nand ``jd2`` attributes::\n\n  >>> t = Time('2010-01-01 00:00:00', scale='utc')\n  >>> t.jd1, t.jd2\n  (2455198.0, -0.5)\n  >>> t2 = t.tai\n  >>> t2.jd1, t2.jd2  # doctest: +FLOAT_CMP\n  (2455198., -0.49960648148148146)\n\nCreating a Time Object\n----------------------\n\nThe allowed |Time| arguments to create a time object are listed below:\n\n**val** : numpy ndarray, list, str, or number\n    Data to initialize table.\n**val2** : numpy ndarray, list, str, or number; optional\n    Data to initialize table.\n**format** : str, optional\n    Format of input value(s).\n**scale** : str, optional\n    Time scale of input value(s).\n**precision** : int between 0 and 9 inclusive\n    Decimal precision when outputting seconds as floating point.\n**in_subfmt** : str\n    Unix glob to select subformats for parsing input times.\n**out_subfmt** : str\n    Unix glob to select subformat for output times.\n**location** : |EarthLocation| or tuple, optional\n    If a tuple, three |Quantity| items with length units for geocentric\n    coordinates, or a longitude, latitude, and optional height for geodetic\n    coordinates. Can be a single location, or one for each input time.\n\nval\n^^^\n\nThe ``val`` argument specifies the input time or times and can be a single\nstring or number, or it can be a Python list or ```numpy`` array of strings or\nnumbers. To initialize a |Time| object based on a specified time, it *must* be\npresent.\n\nIn most situations, you also need to specify the `time scale`_ via the\n``scale`` argument. The |Time| class will never guess the `time scale`_,\nso a concise example would be::\n\n  >>> t1 = Time(50100.0, scale='tt', format='mjd')\n  >>> t2 = Time('2010-01-01 00:00:00', scale='utc')\n\nIt is possible to create a new |Time| object from one or more existing time\nobjects. In this case, the format and scale will be inferred from the\nfirst object unless explicitly specified.\n::\n\n  >>> Time([t1, t2])  # doctest: +FLOAT_CMP\n  <Time object: scale='tt' format='mjd' value=[50100. 55197.00076602]>\n\nval2\n^^^^\n\nThe ``val2`` argument is available for those situations where high precision is\nrequired. Recall that the internal representation of time within `astropy.time`\nis two double-precision numbers that when summed give the Julian date. If\nprovided, the ``val2`` argument is used in combination with ``val`` to set the\nsecond of the internal time values. The exact interpretation of ``val2`` is\ndetermined by the input format class. All string-valued formats ignore ``val2``\nand all numeric inputs effectively add the two values in a way that maintains\nthe highest precision. For example::\n\n  >>> t = Time(100.0, 0.000001, format='mjd', scale='tt')\n  >>> t.jd, t.jd1, t.jd2  # doctest: +FLOAT_CMP\n  (2400100.500001, 2400101.0, -0.499999)\n\nformat\n^^^^^^\n\nThe ```format`` argument sets the time `time format`_, and as mentioned it is\nrequired unless the format can be unambiguously determined from the input times.\n\n\nscale\n^^^^^\n\nThe ``scale`` argument sets the `time scale`_ and is required except for time\nformats such as ``plot_date`` (:class:`~astropy.time.TimePlotDate`) and ``unix``\n(:class:`~astropy.time.TimeUnix`). These formats represent the duration\nin SI seconds since a fixed instant in time is independent of time scale. See\nthe `Time from Epoch Formats`_ for more details.\n\nprecision\n^^^^^^^^^\n\nThe ``precision`` setting affects string formats when outputting a value that\nincludes seconds. It must be an integer between 0 and 9. There is no effect\nwhen inputting time values from strings. The default precision is 3. Note\nthat the limit of 9 digits is driven by the way that ERFA_ handles fractional\nseconds. In practice this should should not be an issue.  ::\n\n  >>> t = Time('B1950.0', precision=3)\n  >>> t.byear_str\n  'B1950.000'\n  >>> t.precision = 0\n  >>> t.byear_str\n  'B1950'\n\nin_subfmt\n^^^^^^^^^\n\nThe ``in_subfmt`` argument provides a mechanism to select one or more\n`subformat`_ values from the available subformats for input. Multiple\nallowed subformats can be selected using Unix-style wildcard characters, in\nparticular ``*`` and ``?``, as documented in the Python `fnmatch\n<https://docs.python.org/3/library/fnmatch.html>`_ module.\n\nThe default value for ``in_subfmt`` is ``*`` which matches any available\nsubformat. This allows for convenient input of values with unknown or\nheterogeneous subformat::\n\n  >>> Time(['2000:001', '2000:002:03:04', '2001:003:04:05:06.789'])\n  <Time object: scale='utc' format='yday'\n   value=['2000:001:00:00:00.000' '2000:002:03:04:00.000' '2001:003:04:05:06.789']>\n\nYou can explicitly specify ``in_subfmt`` in order to strictly require a\ncertain subformat::\n\n  >>> t = Time('2000:002:03:04', in_subfmt='date_hm')\n  >>> t = Time('2000:002', in_subfmt='date_hm')  # doctest: +SKIP\n  Traceback (most recent call last):\n    ...\n  ValueError: Input values did not match any of the formats where the\n  format keyword is optional ['astropy_time', 'datetime',\n  'byear_str', 'iso', 'isot', 'jyear_str', 'yday']\n\nout_subfmt\n^^^^^^^^^^\n\nThe ``out_subfmt`` argument is similar to ``in_subfmt`` except that it applies\nto output formatting. In the case of multiple matching subformats, the first\nmatching subformat is used.\n\n  >>> Time('2000-01-01 02:03:04', out_subfmt='date').iso\n  '2000-01-01'\n  >>> Time('2000-01-01 02:03:04', out_subfmt='date_hms').iso\n  '2000-01-01 02:03:04.000'\n  >>> Time('2000-01-01 02:03:04', out_subfmt='date*').iso\n  '2000-01-01 02:03:04.000'\n  >>> Time('50814.123456789012345', format='mjd', out_subfmt='str').mjd\n  '50814.123456789012345'\n\nSee also the `subformat`_ section.\n\nlocation\n^^^^^^^^\n\nThis optional parameter specifies the observer location, using an\n|EarthLocation| object or a tuple containing any form that can initialize one:\neither a tuple with geocentric coordinates (X, Y, Z), or a tuple with geodetic\ncoordinates (longitude, latitude, height; with height defaulting to zero).\nThey are used for time scales that are sensitive to observer location\n(currently, only TDB, which relies on the PyERFA_ routine `erfa.dtdb` to\ndetermine the time offset between TDB and TT), as well as for sidereal time if\nno explicit longitude is given.\n\n  >>> t = Time('2001-03-22 00:01:44.732327132980', scale='utc',\n  ...          location=('120d', '40d'))\n  >>> t.sidereal_time('apparent', 'greenwich')  # doctest: +FLOAT_CMP +REMOTE_DATA\n  <Longitude 12. hourangle>\n  >>> t.sidereal_time('apparent')  # doctest: +FLOAT_CMP +REMOTE_DATA\n  <Longitude 20. hourangle>\n\n.. note:: In future versions, we hope to add the possibility to add observatory\n          objects and/or names.\n\nGetting the Current Time\n^^^^^^^^^^^^^^^^^^^^^^^^\n\nThe current time can be determined as a |Time| object using the\n`~astropy.time.Time.now` class method::\n\n  >>> nt = Time.now()\n  >>> ut = Time(datetime.utcnow(), scale='utc')\n\nThe two should be very close to each other.\n\n\n.. _time-fast-c-parser:\n\nFast C-based Date String Parser\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nTime formats that are based on a date string representation of time, including\n`~astropy.time.TimeISO`, `~astropy.time.TimeISOT`, and\n`~astropy.time.TimeYearDayTime`, make use of a fast C-based date parser that\nimproves speed by a factor of 20 or more for large arrays of times.\n\nThe C parser is stricter than the Python-based parser (which relies on\n`~time.strptime`). In particular fields like the month or day of year must\nalways have a fixed number of ASCII digits. As an example the Python parser will\naccept ``2000-1-2T3:04:5.23`` while the C parser requires\n``2000-01-02T03:04:05.23``\n\nUse of the C parser is enabled by default except when the input subformat\n``in_subfmt`` argument is different from the default value of ``'*'``. If the\nfast C parser fails to parse the date values then the |Time| initializer will\nautomatically fall through to the Python parser.\n\nIn rare cases where you need to explicitly control which parser gets used there\nis a configuration item ``time.conf.use_fast_parser`` that can be set. The\ndefault is ``'True'``, which means to try the fast parser and fall through to\nPython parser if needed.  Note that the configuration value is a string, not a\nbool object.\n\nFor example to disable the C parser use::\n\n  >>> from astropy.time import conf\n  >>> date = '2000-1-2T3:04:5.23'\n  >>> t = Time(date, format='isot')  # Succeeds by default\n  >>> with conf.set_temp('use_fast_parser', 'False'):\n  ...     t = Time(date, format='isot')\n  ...     print(t)\n  2000-01-02T03:04:05.230\n\nTo force the user of the C parser (for example in testing) use::\n\n  >>> with conf.set_temp('use_fast_parser', 'force'):\n  ...     try:\n  ...          t = Time(date, format='isot')\n  ...     except ValueError as err:\n  ...          print(err)\n  Input values did not match the format class isot:\n  ValueError: fast C time string parser failed: non-digit found where digit (0-9) required\n\nUsing Time Objects\n------------------\n\nThe operations available with |Time| objects include:\n\n- Get and set time value(s) for an array-valued |Time| object.\n- Set missing (masked) values.\n- Get the representation of the time value(s) in a particular `time format`_.\n- Get a new time object for the same time value(s) but referenced to a different\n  `time scale`_.\n- Calculate `sidereal time and Earth rotation angle`_ corresponding to the time value(s).\n- Do time arithmetic involving |Time|, |TimeDelta| and/or |Quantity| objects with units of time.\n\nGet and Set Values\n^^^^^^^^^^^^^^^^^^\n\nFor an existing |Time| object which is array-valued, you can use the\nusual ``numpy`` array item syntax to get either a single item or a subset\nof items. The returned value is a |Time| object with all the same\nattributes.\n\nExamples\n\"\"\"\"\"\"\"\"\n\n.. EXAMPLE START: Get and Set Values for Time Objects\n\nTo get an item or a subset of items::\n\n  >>> t = Time(['2001:020', '2001:040', '2001:060', '2001:080'],\n  ...          out_subfmt='date')\n  >>> print(t[1])\n  2001:040\n  >>> print(t[1:])\n  ['2001:040' '2001:060' '2001:080']\n  >>> print(t[[2, 0]])\n  ['2001:060' '2001:020']\n\nYou can also set values in place for an array-valued |Time| object::\n\n  >>> t = Time(['2001:020', '2001:040', '2001:060', '2001:080'],\n  ...          out_subfmt='date')\n  >>> t[1] = '2010:001'\n  >>> print(t)\n  ['2001:020' '2010:001' '2001:060' '2001:080']\n  >>> t[[2, 0]] = '1990:123'\n  >>> print(t)\n  ['1990:123' '2010:001' '1990:123' '2001:080']\n\n.. EXAMPLE END\n\nThe new value (on the right hand side) when setting can be one of three\npossibilities:\n\n- Scalar string value or array of string values where each value\n  is in a valid time format that can be automatically parsed and\n  used to create a |Time| object.\n- Value or array of values where each value has the same ``format`` as\n  the |Time| object being set. For instance, a float or ``numpy`` array\n  of floats for an object with ``format='unix'``.\n- |Time| object with identical ``location`` (but ``scale`` and\n  ``format`` need not be the same). The right side value will be\n  transformed so the time ``scale`` matches.\n\nWhenever any item is set, then the internal cache (see `Caching`_) is cleared\nalong with the ``delta_tdb_tt`` and/or ``delta_ut1_utc`` transformation\noffsets, if they have been set.\n\nIf it is required that the |Time| object be immutable, then set the\n``writeable`` attribute to `False`. In this case, attempting to set a value will\nraise a ``ValueError: Time object is read-only``. See the section on\n`Caching`_ for an example.\n\nMissing Values\n^^^^^^^^^^^^^^\n\nThe |Time| and |TimeDelta| objects support functionality for marking values as\nmissing or invalid. This is also known as masking, and is especially useful for\n:ref:`table_operations` such as joining and stacking.\n\nExample\n\"\"\"\"\"\"\"\n\n.. EXAMPLE START: Missing Values in Time and TimeDelta Objects\n\nTo set one or more items as missing, assign the special value\n`numpy.ma.masked`::\n\n  >>> t = Time(['2001:020', '2001:040', '2001:060', '2001:080'],\n  ...          out_subfmt='date')\n  >>> t[2] = np.ma.masked\n  >>> print(t)\n  ['2001:020' '2001:040' -- '2001:080']\n\n.. note:: The operation of setting an array element to `numpy.ma.masked`\n   (missing) *overwrites* the actual time data and therefore there is no way to\n   recover the original value. In this sense, the `numpy.ma.masked` value\n   behaves just like any other valid |Time| value when setting. This is\n   similar to how `Pandas missing data\n   <https://pandas.pydata.org/pandas-docs/stable/missing_data.html>`_ works,\n   but somewhat different from `NumPy masked arrays\n   <https://numpy.org/doc/stable/reference/maskedarray.html>`_ which\n   maintain a separate mask array and retain the underlying data. In the\n   |Time| object the ``mask`` attribute is read-only and cannot be directly set.\n\n.. EXAMPLE END\n\nOnce one or more values in the object are masked, any operations will\npropagate those values as masked, and access to format attributes such\nas ``unix`` or ``value`` will return a `~numpy.ma.MaskedArray`\nobject::\n\n  >>> t.unix  # doctest: +SKIP\n  masked_array(data = [979948800.0 981676800.0 -- 985132800.0],\n               mask = [False False  True False],\n         fill_value = 1e+20)\n\nYou can view the ``mask``, but note that it is read-only and\nsetting the mask is always done by setting the item to `~numpy.ma.masked`.\n\n  >>> t.mask\n  array([False, False,  True, False]...)\n  >>> t[:2] = np.ma.masked\n\n.. warning:: The internal implementation of missing value support is provisional\n   and may change in a subsequent release. This would impact information in the\n   next section. However, the documented API for using missing values with\n   |Time| and |TimeDelta| objects is stable.\n\nCustom Format Classes and Missing Values\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nFor advanced users who have written a custom time format via a\n`~astropy.time.TimeFormat` subclass, it may be necessary to modify your\nclass *if you wish to support missing values*. For applications that\ndo not take advantage of missing values no changes are required.\n\nMissing values in a `~astropy.time.TimeFormat` subclass object are marked by\nsetting the corresponding entries of the ``jd2`` attribute to be ``numpy.nan``\n(but this is never done directly by the user). For most array operations and\n``numpy`` functions the ``numpy.nan`` entries are propagated as expected and\nall is well. However, this is not always the case, and in particular the `ERFA`_\nroutines do not generally support ``numpy.nan`` values gracefully.\n\nIn cases where ``numpy.nan`` is not acceptable, format class methods should use\nthe ``jd2_filled`` property instead of ``jd2``. This replaces ``numpy.nan`` with\n``0.0``. Since ``jd2`` is always in the range -1 to +1, substituting ``0.0``\nwill allow functions to return \"reasonable\" values which will then be masked in\nany subsequent outputs. See the ``value`` property of the\n`~astropy.time.TimeDecimalYear` format for any example.\n\nGet Representation\n^^^^^^^^^^^^^^^^^^\n\nInstants of time can be represented in different ways, for instance as an\nISO-format date string (``'1999-07-23 04:31:00'``) or seconds since 1998.0\n(``49091460.0``) or Modified Julian Date (``51382.187451574``).\n\nThe representation of a |Time| object in a particular format is available\nby getting the object attribute corresponding to the format name. The list of\navailable format names is in the `time format`_ section.\n\n  >>> t = Time('2010-01-01 00:00:00', format='iso', scale='utc')\n  >>> t.jd        # JD representation of time in current scale (UTC)\n  2455197.5\n  >>> t.iso       # ISO representation of time in current scale (UTC)\n  '2010-01-01 00:00:00.000'\n  >>> t.unix      # seconds since 1970.0 (UTC)\n  1262304000.0\n  >>> t.datetime  # Representation as datetime.datetime object\n  datetime.datetime(2010, 1, 1, 0, 0)\n\nExample\n\"\"\"\"\"\"\"\n\n.. EXAMPLE START: Get Representation of a Time Object\n\nTo get the representation of a |Time| object::\n\n  >>> import matplotlib.pyplot as plt  # doctest: +SKIP\n  >>> jyear = np.linspace(2000, 2001, 20)  # doctest: +SKIP\n  >>> t = Time(jyear, format='jyear')  # doctest: +SKIP\n  >>> plt.plot_date(t.plot_date, jyear)  # doctest: +SKIP\n  >>> plt.gcf().autofmt_xdate()  # orient date labels at a slant  # doctest: +SKIP\n  >>> plt.draw()  # doctest: +SKIP\n\n.. EXAMPLE END\n\nConvert Time Scale\n^^^^^^^^^^^^^^^^^^\n\nA new |Time| object for the same time value(s) but referenced to a new `time\nscale`_ can be created getting the object attribute corresponding to the time\nscale name. The list of available time scale names is in the `time scale`_\nsection and in the figure below illustrating the network of time scale\ntransformations.\n\n.. image:: time_scale_conversion.png\n\nExamples\n\"\"\"\"\"\"\"\"\n\n.. EXAMPLE START: Converting Time Scales in Time Objects\n\nTo create a |Time| object with a new time scale::\n\n  >>> t = Time('2010-01-01 00:00:00', format='iso', scale='utc')\n  >>> t.tt        # TT scale\n  <Time object: scale='tt' format='iso' value=2010-01-01 00:01:06.184>\n  >>> t.tai\n  <Time object: scale='tai' format='iso' value=2010-01-01 00:00:34.000>\n\nIn this process the ``format`` and other object attributes like ``lon``,\n``lat``, and ``precision`` are also propagated to the new object.\n\n.. EXAMPLE END\n\nAs noted in the `Time Object Basics`_ section, a |Time| object can only be\nchanged by explicitly setting some of its elements. The process of changing the\ntime scale therefore begins by making a copy of the original object and then\nconverting the internal time values in the copy to the new time scale. The new\n|Time| object is returned by the attribute access.\n\nCaching\n^^^^^^^\n\nThe computations for transforming to different time scales or formats can be\ntime-consuming for large arrays. In order to avoid repeated computations, each\n|Time| or |TimeDelta| instance caches such transformations internally::\n\n  >>> t = Time(np.arange(1e6), format='unix', scale='utc')\n\n  >>> time x = t.tt  # doctest: +SKIP\n  CPU times: user 263 ms, sys: 4.02 ms, total: 267 ms\n  Wall time: 267 ms\n\n  >>> time x = t.tt  # doctest: +SKIP\n  CPU times: user 28 µs, sys: 9 µs, total: 37 µs\n  Wall time: 32.9 µs\n\nActions such as changing the output precision or subformat will clear\nthe cache. In order to explicitly clear the internal cache do::\n\n  >>> del t.cache\n\n  >>> time x = t.tt  # doctest: +SKIP\n  CPU times: user 263 ms, sys: 4.02 ms, total: 267 ms\n  Wall time: 267 ms\n\nIn order to ensure consistency between the transformed (and cached) version and\nthe original, the transformed object is set to be not writeable. For example::\n\n  >>> x = t.tt\n  >>> x[1] = '2000:001'\n  Traceback (most recent call last):\n    ...\n  ValueError: Time object is read-only. Make a copy() or set \"writeable\" attribute to True.\n\nIf you require modifying the object then make a copy first, for example, ``x =\nt.tt.copy()``.\n\nTransformation Offsets\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nTime scale transformations that cross one of the orange circles in the image\nabove require an additional offset time value that is model or\nobservation dependent. See SOFA_ `Time Scale and Calendar Tools\n<http://www.iausofa.org/sofa_ts_c.pdf>`_ for further details.\n\nThe two attributes :attr:`~astropy.time.Time.delta_ut1_utc` and\n:attr:`~astropy.time.Time.delta_tdb_tt` provide a way to set\nthese offset times explicitly. These represent the time scale offsets\nUT1 - UTC and TDB - TT, respectively. As an example::\n\n  >>> t = Time('2010-01-01 00:00:00', format='iso', scale='utc')\n  >>> t.delta_ut1_utc = 0.334  # Explicitly set one part of the transformation\n  >>> t.ut1.iso    # ISO representation of time in UT1 scale\n  '2010-01-01 00:00:00.334'\n\nFor the UT1 to UTC offset, you have to interpolate the observed values provided\nby the `International Earth Rotation and Reference Systems (IERS) Service\n<http://www.iers.org>`_. ``astropy`` will automatically download and use values\nfrom the IERS which cover times spanning from 1973-Jan-01 through one year into\nthe future. In addition, the ``astropy`` package is bundled with a data table of\nvalues provided in Bulletin B, which cover the period from 1962 to shortly\nbefore an ``astropy`` release.\n\nWhen the :attr:`~astropy.time.Time.delta_ut1_utc` attribute is not set\nexplicitly, IERS values will be used (initiating a download of a few Mb\nfile the first time). For details about how IERS values are used in ``astropy``\ntime and coordinates, and to understand how to control automatic downloads, see\n:ref:`utils-iers`. The example below illustrates converting to the ``UT1``\nscale along with the auto-download feature::\n\n  >>> t = Time('2016:001')\n  >>> t.ut1  # doctest: +SKIP\n  Downloading https://maia.usno.navy.mil/ser7/finals2000A.all\n  |==================================================================| 3.0M/3.0M (100.00%)         6s\n  <Time object: scale='ut1' format='yday' value=2016:001:00:00:00.082>\n\n.. note:: The :class:`~astropy.utils.iers.IERS_Auto` class contains machinery\n    to ensure that the IERS table is kept up to date by auto-downloading the\n    latest version as needed. This means that the IERS table is assured of\n    having the state-of-the-art definitive and predictive values for Earth\n    rotation. As a user it is **your responsibility** to understand the\n    accuracy of IERS predictions if your science depends on that. If you\n    request ``UT1-UTC`` for times beyond the range of IERS table data then the\n    nearest available values will be provided.\n\nIn the case of the TDB to TT offset, most users need only provide the ``lon``\nand ``lat`` values when creating the |Time| object. If the\n:attr:`~astropy.time.Time.delta_tdb_tt` attribute is not explicitly set, then\nthe PyERFA_ routine `erfa.dtdb` will be used to compute the TDB to TT\noffset. Note that if ``lon`` and ``lat`` are not explicitly initialized,\nvalues of 0.0 degrees for both will be used.\n\nExample\n~~~~~~~\n\n.. EXAMPLE START: Transformation Offsets in Time Objects\n\nThe following code replicates an example in the SOFA_ `Time Scale and Calendar\nTools <http://www.iausofa.org/sofa_ts_c.pdf>`_ document. It does the transform\nfrom UTC to all supported time scales (TAI, TCB, TCG, TDB, TT, UT1, UTC). This\nrequires an observer location (here, latitude and longitude).\n::\n\n  >>> import astropy.units as u\n  >>> t = Time('2006-01-15 21:24:37.5', format='iso', scale='utc',\n  ...          location=(-155.933222*u.deg, 19.48125*u.deg))\n  >>> t.utc.iso\n  '2006-01-15 21:24:37.500'\n  >>> t.ut1.iso  # doctest: +REMOTE_DATA\n  '2006-01-15 21:24:37.834'\n  >>> t.tai.iso\n  '2006-01-15 21:25:10.500'\n  >>> t.tt.iso\n  '2006-01-15 21:25:42.684'\n  >>> t.tcg.iso\n  '2006-01-15 21:25:43.323'\n  >>> t.tdb.iso\n  '2006-01-15 21:25:42.684'\n  >>> t.tcb.iso\n  '2006-01-15 21:25:56.894'\n\n.. EXAMPLE END\n\nHashing\n^^^^^^^\n\nA user can generate a unique hash key for scalar (0-dimensional) |Time| or\n|TimeDelta| objects. The key is based on a tuple of ``jd1``,\n``jd2``, ``scale``, and ``location`` (if present, ``None`` otherwise).\n\nNote that two |Time| objects with a different ``scale`` can compare equally\nbut still have different hash keys. This a practical consideration driven\nin by performance, but in most cases represents a desirable behavior.\n\n\nPrinting Time Arrays\n^^^^^^^^^^^^^^^^^^^^\n\nIf your ``times`` array contains a lot of elements, the ``value`` argument will\ndisplay all the elements of the |Time| object ``t`` when it is called or\nprinted. To control the number of elements to be displayed, set the\n``threshold`` argument with ``np.printoptions`` as follows:\n\n    >>> many_times = np.arange(1000)\n    >>> t = Time(many_times, format='cxcsec')\n    >>> with np.printoptions(threshold=10):\n    ...     print(repr(t))\n    ...     print(t.iso)\n    <Time object: scale='tt' format='cxcsec' value=[  0.   1.   2. ... 997. 998. 999.]>\n    ['1998-01-01 00:00:00.000' '1998-01-01 00:00:01.000'\n     '1998-01-01 00:00:02.000' ... '1998-01-01 00:16:37.000'\n     '1998-01-01 00:16:38.000' '1998-01-01 00:16:39.000']\n\nSidereal Time and Earth Rotation Angle\n--------------------------------------\n\nApparent or mean sidereal time can be calculated using\n:meth:`~astropy.time.Time.sidereal_time`. The method returns a |Longitude|\nwith units of hour angle, which by default is for the longitude corresponding to\nthe location with which the |Time| object is initialized. Like the scale\ntransformations, ERFA_ C-library routines are used under the hood, which support\ncalculations following different IAU resolutions.\n\nSimilarly, one can calculate the Earth rotation angle with\n:meth:`~astropy.time.Time.earth_rotation_angle`. Unlike sidereal time, which\nis referred to the equinox and is a complicated function of both UT1 and\nTerrestrial Time, the Earth rotation angle is referred to the Celestial\nIntermediate Origin (CIO) and is a linear function of UT1 alone.\n\nFor the recent IAU precession models, as well as for the Earth rotation angle,\nthe result includes the TIO locator (s'), which positions the Terrestrial\nIntermediate Origin on the equator of the Celestial Intermediate Pole (CIP)\nand is rigorously corrected for polar motion.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Calculating Sidereal Time and Earth Rotation Angle for Time Objects\n\nTo calculate sidereal time::\n\n  >>> t = Time('2006-01-15 21:24:37.5', scale='utc', location=('120d', '45d'))\n  >>> t.sidereal_time('mean')  # doctest: +FLOAT_CMP +REMOTE_DATA\n  <Longitude 13.08952187 hourangle>\n  >>> t.sidereal_time('apparent')  # doctest: +FLOAT_CMP +REMOTE_DATA\n  <Longitude 13.08950368 hourangle>\n  >>> t.earth_rotation_angle()  # doctest: +FLOAT_CMP +REMOTE_DATA\n  <Longitude 13.08436206 hourangle>\n  >>> t.sidereal_time('apparent', 'greenwich')  # doctest: +FLOAT_CMP +REMOTE_DATA\n  <Longitude 5.08950368 hourangle>\n  >>> t.sidereal_time('apparent', '-90d')  # doctest: +FLOAT_CMP +REMOTE_DATA\n  <Longitude 23.08950368 hourangle>\n  >>> t.sidereal_time('apparent', '-90d', 'IAU1994')  # doctest: +FLOAT_CMP +REMOTE_DATA\n  <Longitude 23.08950365 hourangle>\n\n.. EXAMPLE END\n\nTime Deltas\n-----------\n\nTime arithmetic is supported using the |TimeDelta| class. The following\noperations are available:\n\n- Create a |TimeDelta| explicitly by instantiating a class object.\n- Create a |TimeDelta| by subtracting two |Time| objects.\n- Add a |TimeDelta| to a |Time| object to get a new |Time|.\n- Subtract a |TimeDelta| from a |Time| object to get a new |Time|.\n- Add two |TimeDelta| objects to get a new |TimeDelta|.\n- Negate a |TimeDelta| or take its absolute value.\n- Multiply or divide a |TimeDelta| by a constant or array.\n- Convert |TimeDelta| objects to and from time-like |Quantity|'s.\n\nThe |TimeDelta| class is derived from the |Time| class and shares many of its\nproperties. One difference is that the time scale has to be one for which one\nday is exactly 86400 seconds. Hence, the scale cannot be UTC.\n\n|Quantity| objects with time units can also be used in place of |TimeDelta|.\n\nThe available time formats are:\n\n=========  ===================================================\nFormat     Class\n=========  ===================================================\nsec        :class:`~astropy.time.TimeDeltaSec`\njd         :class:`~astropy.time.TimeDeltaJD`\ndatetime   :class:`~astropy.time.TimeDeltaDatetime`\n=========  ===================================================\n\nExamples\n^^^^^^^^\n\n.. EXAMPLE START: Time Arithmetic Using the TimeDelta Class\n\nUse of the |TimeDelta| object is illustrated in the few examples below::\n\n  >>> t1 = Time('2010-01-01 00:00:00')\n  >>> t2 = Time('2010-02-01 00:00:00')\n  >>> dt = t2 - t1  # Difference between two Times\n  >>> dt\n  <TimeDelta object: scale='tai' format='jd' value=31.0>\n  >>> dt.sec\n  2678400.0\n\n  >>> from astropy.time import TimeDelta\n  >>> dt2 = TimeDelta(50.0, format='sec')\n  >>> t3 = t2 + dt2  # Add a TimeDelta to a Time\n  >>> t3.iso\n  '2010-02-01 00:00:50.000'\n\n  >>> t2 - dt2  # Subtract a TimeDelta from a Time\n  <Time object: scale='utc' format='iso' value=2010-01-31 23:59:10.000>\n\n  >>> dt + dt2  # doctest: +FLOAT_CMP\n  <TimeDelta object: scale='tai' format='jd' value=31.0005787037>\n\n  >>> import numpy as np\n  >>> t1 + dt * np.linspace(0, 1, 5)\n  <Time object: scale='utc' format='iso' value=['2010-01-01 00:00:00.000'\n  '2010-01-08 18:00:00.000' '2010-01-16 12:00:00.000' '2010-01-24 06:00:00.000'\n  '2010-02-01 00:00:00.000']>\n\n  >>> import astropy.units as u\n  >>> t1 + 1 * u.hour\n  <Time object: scale='utc' format='iso' value=2010-01-01 01:00:00.000>\n\n  # The now deprecated default assumes days for numeric inputs\n  >>> t1 + 5.0  # doctest: +SHOW_WARNINGS +ELLIPSIS\n  <Time object: scale='utc' format='iso' value=2010-01-06 00:00:00.000>\n  TimeDeltaMissingUnitWarning: Numerical value without unit or explicit format passed to TimeDelta, assuming days\n\nThe |TimeDelta| has a `~astropy.time.TimeDelta.to_value` method which supports\ncontrolling the type of the output representation by providing either a format\nname and optional `subformat`_ or a valid ``astropy`` unit::\n\n  >>> dt.to_value(u.hr)\n  744.0\n  >>> dt.to_value('jd', 'str')\n  '31.0'\n\n.. EXAMPLE END\n\nTime Scales for Time Deltas\n^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nWe have shown in the above that the difference between two UTC times is a\n|TimeDelta| with a scale of TAI. This is because a UTC time difference cannot be\nuniquely defined unless the user knows the two times that were differenced\n(because of leap seconds, a day does not always have 86400 seconds). For all\nother time scales, the |TimeDelta| inherits the scale of the first |Time|\nobject.\n\nExamples\n\"\"\"\"\"\"\"\"\n\n.. EXAMPLE START: Time Scales for Time Deltas\n\nTo get the time scale for a |TimeDelta| object::\n\n  >>> t1 = Time('2010-01-01 00:00:00', scale='tcg')\n  >>> t2 = Time('2011-01-01 00:00:00', scale='tcg')\n  >>> dt = t2 - t1\n  >>> dt\n  <TimeDelta object: scale='tcg' format='jd' value=365.0>\n\nWhen |TimeDelta| objects are added or subtracted from |Time| objects, scales\nare converted appropriately, with the final scale being that of the |Time|\nobject::\n\n  >>> t2 + dt\n  <Time object: scale='tcg' format='iso' value=2012-01-01 00:00:00.000>\n  >>> t2.tai\n  <Time object: scale='tai' format='iso' value=2010-12-31 23:59:27.068>\n  >>> t2.tai + dt\n  <Time object: scale='tai' format='iso' value=2011-12-31 23:59:27.046>\n\n|TimeDelta| objects can be converted only to objects with compatible scales\n(i.e., scales for which it is not necessary to know the times that were\ndifferenced)::\n\n  >>> dt.tt  # doctest: +FLOAT_CMP\n  <TimeDelta object: scale='tt' format='jd' value=364.999999746>\n  >>> dt.tdb  # doctest: +IGNORE_EXCEPTION_DETAIL\n  Traceback (most recent call last):\n    ...\n  ScaleValueError: Cannot convert TimeDelta with scale 'tcg' to scale 'tdb'\n\n|TimeDelta| objects can also have an undefined scale, in which case it is\nassumed that their scale matches that of the other |Time| or |TimeDelta|\nobject (or is TAI in case of a UTC time)::\n\n  >>> t2.tai + TimeDelta(365., format='jd', scale=None)\n  <Time object: scale='tai' format='iso' value=2011-12-31 23:59:27.068>\n\n.. note:: Since internally |Time| uses floating point numbers, round-off\n          errors can cause two times to be not strictly equal even if\n          mathematically they should be. For times in UTC in particular, this\n          can lead to surprising behavior, because when you add a\n          |TimeDelta|, which cannot have a scale of UTC, the UTC time is\n          first converted to TAI, then the addition is done, and finally the\n          time is converted back to UTC. Hence, rounding errors can be\n          incurred, which means that even expected equalities may not hold::\n\n            >>> t = Time(2450000., 1e-6, format='jd')\n            >>> t + TimeDelta(0, format='jd') == t\n            False\n\n.. EXAMPLE END\n\n.. _time-light-travel-time:\n\nBarycentric and Heliocentric Light Travel Time Corrections\n----------------------------------------------------------\n\nThe arrival times of photons at an observatory are not particularly useful for\naccurate timing work, such as eclipse/transit timing of binaries or exoplanets.\nThis is because the changing location of the observatory causes photons to\narrive early or late. The solution is to calculate the time the photon would\nhave arrived at a standard location; either the Solar System barycenter or the\nheliocenter.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Barycentric and Heliocentric Light Travel Time Corrections\n\nSuppose you observed the dwarf nova IP Peg from Greenwich and have a list of\ntimes in MJD form, in the UTC timescale. You then create appropriate |Time| and\n|SkyCoord| objects and calculate light travel times to the barycenter as\nfollows::\n\n    >>> from astropy import time, coordinates as coord, units as u\n    >>> ip_peg = coord.SkyCoord(\"23:23:08.55\", \"+18:24:59.3\",\n    ...                         unit=(u.hourangle, u.deg), frame='icrs')\n    >>> greenwich = coord.EarthLocation.of_site('greenwich')  # doctest: +REMOTE_DATA\n    >>> times = time.Time([56325.95833333, 56325.978254], format='mjd',\n    ...                   scale='utc', location=greenwich)  # doctest: +REMOTE_DATA\n    >>> ltt_bary = times.light_travel_time(ip_peg)  # doctest: +REMOTE_DATA\n    >>> ltt_bary # doctest: +FLOAT_CMP +REMOTE_DATA\n    <TimeDelta object: scale='tdb' format='jd' value=[-0.0037715  -0.00377286]>\n\nIf you desire the light travel time to the heliocenter instead, then use::\n\n    >>> ltt_helio = times.light_travel_time(ip_peg, 'heliocentric') # doctest: +REMOTE_DATA\n    >>> ltt_helio # doctest: +FLOAT_CMP +REMOTE_DATA\n    <TimeDelta object: scale='tdb' format='jd' value=[-0.00376576 -0.00376712]>\n\nThe method returns an |TimeDelta| object, which can be added to\nyour times to give the arrival time of the photons at the barycenter or\nheliocenter. Here, you should be careful with the timescales used; for more\ndetailed information about timescales, see :ref:`time-scale`.\n\n.. EXAMPLE END\n\nThe heliocenter is not a fixed point, and therefore the gravity\ncontinually changes at the heliocenter. Thus, the use of a relativistic\ntimescale like TDB is not particularly appropriate, and, historically,\ntimes corrected to the heliocenter are given in the UTC timescale::\n\n    >>> times_heliocentre = times.utc + ltt_helio  # doctest: +REMOTE_DATA\n\nCorrections to the barycenter are more precise than the heliocenter,\nbecause the barycenter is a fixed point where gravity is constant. For\nmaximum accuracy you want to have your barycentric corrected times in a\ntimescale that has always ticked at a uniform rate, and ideally one\nwhose tick rate is related to the rate that a clock would tick at the\nbarycenter. For this reason, barycentric corrected times normally use\nthe TDB timescale::\n\n    >>> time_barycentre = times.tdb + ltt_bary  # doctest: +REMOTE_DATA\n\n.. EXAMPLE START: Calculating Light Travel Time Using JPL Ephemerides\n\nBy default, the light travel time is calculated using the position and velocity\nof Earth and the Sun from ERFA_\nroutines, but you can also get more precise calculations using the JPL\nephemerides (which are derived from dynamical models). An example using the JPL\nephemerides is:\n\n.. doctest-requires:: jplephem\n\n    >>> ltt_bary_jpl = times.light_travel_time(ip_peg, ephemeris='jpl') # doctest: +REMOTE_DATA +IGNORE_OUTPUT\n    >>> ltt_bary_jpl # doctest: +REMOTE_DATA +FLOAT_CMP\n    <TimeDelta object: scale='tdb' format='jd' value=[-0.0037715  -0.00377286]>\n    >>> (ltt_bary_jpl - ltt_bary).to(u.ms) # doctest: +REMOTE_DATA +IGNORE_OUTPUT\n    <Quantity [-0.00132325, -0.00132861] ms>\n\nThe difference between the built-in ephemerides and the JPL ephemerides is\nnormally of the order of 1/100th of a millisecond, so the built-in ephemerides\nshould be suitable for most purposes. For more details about what ephemerides\nare available, including the requirements for using JPL ephemerides, see\n:ref:`astropy-coordinates-solarsystem`.\n\n.. EXAMPLE END\n\nInteraction with time-like Quantities\n-------------------------------------\n\nWhere possible, |Quantity| objects with units of time are treated as |TimeDelta|\nobjects with undefined scale (though necessarily with lower precision). They\ncan also be used as input in constructing |Time| and |TimeDelta| objects, and\n|TimeDelta| objects can be converted to |Quantity| objects of arbitrary units\nof time.\n\nExamples\n^^^^^^^^\n\n.. EXAMPLE START: Time Object Interaction with time-like Quantities\n\nTo use |Quantity| objects with units of time::\n\n  >>> import astropy.units as u\n  >>> Time(10.*u.yr, format='gps')   # time-valued quantities can be used for\n  ...                                # for formats requiring a time offset\n  <Time object: scale='tai' format='gps' value=315576000.0>\n  >>> Time(10.*u.yr, 1.*u.s, format='gps')\n  <Time object: scale='tai' format='gps' value=315576001.0>\n  >>> Time(2000.*u.yr, format='jyear')\n  <Time object: scale='tt' format='jyear' value=2000.0>\n  >>> Time(2000.*u.yr, format='byear')\n  ...                                # but not for Besselian year, which implies\n  ...                                # a different time scale\n  ...\n  Traceback (most recent call last):\n    ...\n  ValueError: Input values did not match the format class byear:\n  ValueError: Cannot use Quantities for 'byear' format, as the interpretation would be ambiguous. Use float with Besselian year instead.\n\n  >>> TimeDelta(10.*u.yr)            # With a quantity, no format is required\n  <TimeDelta object: scale='None' format='jd' value=3652.5>\n\n  >>> dt = TimeDelta([10., 20., 30.], format='jd')\n  >>> dt.to(u.hr)                    # can convert TimeDelta to a quantity  # doctest: +FLOAT_CMP\n  <Quantity [240., 480., 720.] h>\n  >>> dt > 400. * u.hr               # and compare to quantities with units of time\n  array([False,  True,  True]...)\n  >>> dt + 1.*u.hr                   # can also add/subtract such quantities  # doctest: +FLOAT_CMP\n  <TimeDelta object: scale='None' format='jd' value=[10.04166667 20.04166667 30.04166667]>\n  >>> Time(50000., format='mjd', scale='utc') + 1.*u.hr  # doctest: +FLOAT_CMP\n  <Time object: scale='utc' format='mjd' value=50000.0416667>\n  >>> dt * 10.*u.km/u.s              # for multiplication and division with a\n  ...                                # Quantity, TimeDelta is converted  # doctest: +FLOAT_CMP\n  <Quantity [100., 200., 300.] d km / s>\n  >>> dt * 10.*u.Unit(1)             # unless the Quantity is dimensionless  # doctest: +FLOAT_CMP\n  <TimeDelta object: scale='None' format='jd' value=[100. 200. 300.]>\n\n.. EXAMPLE END\n\nWriting a Custom Format\n-----------------------\n\nSome applications may need a custom |Time| format, and this capability is\navailable by making a new subclass of the `~astropy.time.TimeFormat` class.\nWhen such a subclass is defined in your code, the format class and\ncorresponding name is automatically registered in the set of available time\nformats.\n\nExamples\n^^^^^^^^\n\n.. EXAMPLE START: Writing a Custom Format with the TimeFormat Class\n\nThe key elements of a new format class are illustrated by examining the\ncode for the ``jd`` format (which is one of the most minimal)::\n\n  class TimeJD(TimeFormat):\n      \"\"\"\n      Julian Date time format.\n      \"\"\"\n      name = 'jd'  # Unique format name\n\n      def set_jds(self, val1, val2):\n          \"\"\"\n          Set the internal jd1 and jd2 values from the input val1, val2.\n          The input values are expected to conform to this format, as\n          validated by self._check_val_type(val1, val2) during __init__.\n          \"\"\"\n          self._check_scale(self._scale)  # Validate scale.\n          self.jd1, self.jd2 = day_frac(val1, val2)\n\n      @property\n      def value(self):\n          \"\"\"\n          Return format ``value`` property from internal jd1, jd2\n          \"\"\"\n          return self.jd1 + self.jd2\n\nAs mentioned above, the ``_check_val_type(self, val1, val2)``\nmethod may need to be overridden to validate the inputs as conforming to the\nformat specification. By default this checks for valid float, float array, or\n|Quantity| inputs. In contrast, the ``iso`` format class ensures the inputs\nmeet the ISO format specification for strings.\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Customizing the TimeFormat Class with Changes to Date Format\n\nOne special case that is relatively common and more convenient to implement is a\nformat that makes a small change to the date format. For instance, you could\ninsert ``T`` in the ``yday`` format with the following ``TimeYearDayTimeCustom``\nclass. Notice how the ``subfmts`` definition is modified slightly from the\nstandard `~astropy.time.TimeISO` class from which it inherits::\n\n  >>> from astropy.time import TimeISO\n  >>> class TimeYearDayTimeCustom(TimeISO):\n  ...    \"\"\"\n  ...    Year, day-of-year and time as \"<YYYY>-<DOY>T<HH>:<MM>:<SS.sss...>\".\n  ...    The day-of-year (DOY) goes from 001 to 365 (366 in leap years).\n  ...    For example, 2000-001T00:00:00.000 is midnight on January 1, 2000.\n  ...    The allowed subformats are:\n  ...    - 'date_hms': date + hours, mins, secs (and optional fractional secs)\n  ...    - 'date_hm': date + hours, mins\n  ...    - 'date': date\n  ...    \"\"\"\n  ...    name = 'yday_custom'  # Unique format name\n  ...    subfmts = (('date_hms',\n  ...                '%Y-%jT%H:%M:%S',\n  ...                '{year:d}-{yday:03d}T{hour:02d}:{min:02d}:{sec:02d}'),\n  ...               ('date_hm',\n  ...                '%Y-%jT%H:%M',\n  ...                '{year:d}-{yday:03d}T{hour:02d}:{min:02d}'),\n  ...               ('date',\n  ...                '%Y-%j',\n  ...                '{year:d}-{yday:03d}'))\n\n\n  >>> t = Time('2000-01-01')\n  >>> t.yday_custom\n  '2000-001T00:00:00.000'\n  >>> t2 = Time('2016-001T00:00:00')\n  >>> t2.iso\n  '2016-01-01 00:00:00.000'\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Customizing the TimeFormat Class with Time Since an Epoch\n\nAnother special case that is relatively common is a format that represents the\ntime since a particular epoch. The classic example is Unix time which is the\nnumber of seconds since 1970-01-01 00:00:00 UTC, not counting leap seconds. What\nif we wanted that value but **do** want to count leap seconds. This would be\ndone by using the TAI scale instead of the UTC scale. In this case we inherit\nfrom the `~astropy.time.TimeFromEpoch` class and define a few class attributes::\n\n  >>> from astropy.time.formats import erfa, TimeFromEpoch\n  >>> class TimeUnixLeap(TimeFromEpoch):\n  ...    \"\"\"\n  ...    Seconds from 1970-01-01 00:00:00 TAI.  Similar to Unix time\n  ...    but this includes leap seconds.\n  ...    \"\"\"\n  ...    name = 'unix_leap'\n  ...    unit = 1.0 / erfa.DAYSEC  # in days (1 day == 86400 seconds)\n  ...    epoch_val = '1970-01-01 00:00:00'\n  ...    epoch_val2 = None\n  ...    epoch_scale = 'tai'  # Scale for epoch_val class attribute\n  ...    epoch_format = 'iso'  # Format for epoch_val class attribute\n\n  >>> t = Time('2000-01-01')\n  >>> t.unix_leap\n  946684832.0\n  >>> t.unix_leap - t.unix\n  32.0\n\n.. EXAMPLE END\n\nGoing beyond this will probably require looking at the ``astropy`` code for more\nguidance, but if you get stuck, the ``astropy`` developers are more than happy\nto help. If you write a format class that is widely useful we might want to\ninclude it in the core!\n\nTimezones\n---------\n\nWhen a `~astropy.time.Time` object is constructed from a timezone-aware\n`~datetime.datetime`, no timezone information is saved in the\n`~astropy.time.Time` object. However, `~astropy.time.Time` objects can be\nconverted to timezone-aware datetime objects.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Timezones in Time Objects\n\nTo convert a |Time| object to a timezone-aware datetime object::\n\n  >>> from datetime import datetime\n  >>> from astropy.time import Time, TimezoneInfo\n  >>> import astropy.units as u\n  >>> utc_plus_one_hour = TimezoneInfo(utc_offset=1*u.hour)\n  >>> dt_aware = datetime(2000, 1, 1, 0, 0, 0, tzinfo=utc_plus_one_hour)\n  >>> t = Time(dt_aware)  # Loses timezone info, converts to UTC\n  >>> print(t)            # will return UTC\n  1999-12-31 23:00:00\n  >>> print(t.to_datetime(timezone=utc_plus_one_hour)) # to timezone-aware datetime\n  2000-01-01 00:00:00+01:00\n\nTimezone database packages, like `pytz <https://pythonhosted.org/pytz/>`_\nfor example, may be more convenient to use to create `~datetime.tzinfo`\nobjects used to specify timezones rather than the `~astropy.time.TimezoneInfo`\nobject.\n\n.. EXAMPLE END\n\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Initializing From a Timezone-aware Date\n\nUsing the `dateutil <https://dateutil.readthedocs.io/en/stable/index.html>`_ package,\nyou can parse times in a wide variety of supported formats to generate a\n`datetime.datetime` object which can then be used to initialize a |Time| object::\n\n  >>> from dateutil.parser import parse  # doctest: +SKIP\n  >>> dtime = parse('2020-10-29T08:20:46.950+1100')  # doctest: +SKIP\n  >>> Time(dtime)  # doctest: +SKIP\n  <Time object: scale='utc' format='datetime' value=2020-10-28 21:20:46.950000>\n\n.. EXAMPLE END\n\nCustom String Formats with ``strftime`` and ``strptime``\n--------------------------------------------------------\n\nThe `~astropy.time.Time` object supports output string representation\nusing the format specification language defined in the Python standard library\nfor `time.strftime`. This can be done using the `~astropy.time.Time.strftime`\nmethod.\n\nExamples\n^^^^^^^^\n\n.. EXAMPLE START: Custom String Formats with ``strftime`` and ``strptime``\n\nTo get output string representation using the `~astropy.time.Time.strftime`\nmethod::\n\n  >>> from astropy.time import Time\n  >>> t = Time('2018-01-01T10:12:58')\n  >>> t.strftime('%H:%M:%S %d %b %Y')\n  '10:12:58 01 Jan 2018'\n\nConversely, to create a `~astropy.time.Time` object from a custom date string\nthat can be parsed with Python standard library `time.strptime` (using the same\nformat language linked above), use the `~astropy.time.Time.strptime` class\nmethod::\n\n  >>> from astropy.time import Time\n  >>> t = Time.strptime('23:59:60 30 June 2015', '%H:%M:%S %d %B %Y')\n  >>> t\n  <Time object: scale='utc' format='isot' value=2015-06-30T23:59:60.000>\n\n.. EXAMPLE END\n\n.. note that if this section gets too long, it should be moved to a separate\n   doc page - see the top of performance.inc.rst for the instructions on how to do\n   that\n.. include:: performance.inc.rst\n\nReference/API\n=============\n\n.. automodapi:: astropy.time\n   :inherited-members:\n\n\nAcknowledgments and Licenses\n============================\n\nThis package makes use of the PyERFA_ wrappers of the ERFA_ ANSI C library. The copyright of the ERFA_\nsoftware belongs to the NumFOCUS Foundation. The library is made available\nunder the terms of the \"BSD-three clauses\" license.\n\nThe ERFA_ library is derived, with permission, from the International\nAstronomical Union's \"Standards of Fundamental Astronomy\" (SOFA_) library,\navailable from http://www.iausofa.org.\n"},{"id":145,"name":"docs/stats","nodeType":"Package"},{"id":146,"name":"circ.rst","nodeType":"TextFile","path":"docs/stats","text":".. _stats-circular:\n\n*******************\nCircular Statistics\n*******************\n\n.. automodapi:: astropy.stats.circstats\n\n\nReferences\n----------\n.. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n.. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n"},{"id":147,"name":"ripley.rst","nodeType":"TextFile","path":"docs/stats","text":".. _stats-ripley:\n\n******************************\nRipley's K Function Estimators\n******************************\n\nSpatial correlation functions have been used in the astronomical\ncontext to estimate the probability of finding an object (e.g., a galaxy)\nwithin a given distance of another object [1]_.\n\nRipley's K function is a type of estimator used to characterize the correlation\nof such spatial point processes\n[2]_, [3]_, [4]_, [5]_, [6]_.\nMore precisely, it describes correlation among objects in a given field.\nThe `~astropy.stats.RipleysKEstimator` class implements some\nestimators for this function which provides several methods for\nedge effects correction.\n\nBasic Usage\n===========\n\nThe actual implementation of Ripley's K function estimators lie in the method\n``evaluate``, which take the following arguments: ``data``, ``radii``, and\noptionally, ``mode``.\n\nThe ``data`` argument is a 2D array which represents the set of observed\npoints (events) in the area of study. The ``radii`` argument corresponds to a\nset of distances for which the estimator will be evaluated. The ``mode``\nargument takes a value on the following linguistic set\n``{none, translation, ohser, var-width, ripley}``; each keyword represents a\ndifferent method to perform correction due to edge effects. See the API\ndocumentation and references for details about these methods.\n\nInstances of `~astropy.stats.RipleysKEstimator` can also be used as\ncallables (which is equivalent to calling the ``evaluate`` method).\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Using Ripley's K Function Estimators\n\nTo use Ripley's K Function Estimators from ``astropy``'s stats sub-package:\n\n.. plot::\n    :include-source:\n\n    import numpy as np\n    from matplotlib import pyplot as plt\n    from astropy.stats import RipleysKEstimator\n\n    z = np.random.uniform(low=5, high=10, size=(100, 2))\n    Kest = RipleysKEstimator(area=25, x_max=10, y_max=10, x_min=5, y_min=5)\n\n    r = np.linspace(0, 2.5, 100)\n    plt.plot(r, Kest.poisson(r), color='green', ls=':', label=r'$K_{pois}$')\n    plt.plot(r, Kest(data=z, radii=r, mode='none'), color='red', ls='--',\n             label=r'$K_{un}$')\n    plt.plot(r, Kest(data=z, radii=r, mode='translation'), color='black',\n             label=r'$K_{trans}$')\n    plt.plot(r, Kest(data=z, radii=r, mode='ohser'), color='blue', ls='-.',\n             label=r'$K_{ohser}$')\n    plt.plot(r, Kest(data=z, radii=r, mode='var-width'), color='green',\n             label=r'$K_{var-width}$')\n    plt.plot(r, Kest(data=z, radii=r, mode='ripley'), color='yellow',\n             label=r'$K_{ripley}$')\n    plt.legend()\n\n..\n  EXAMPLE END\n\nReferences\n==========\n.. [1] Peebles, P.J.E. *The large scale structure of the universe*.\n       <https://ui.adsabs.harvard.edu/abs/1980lssu.book.....P>\n.. [2] Ripley, B.D. *The second-order analysis of stationary point processes*.\n       Journal of Applied Probability. 13: 255–266, 1976.\n.. [3] *Spatial descriptive statistics*.\n       <https://en.wikipedia.org/wiki/Spatial_descriptive_statistics>\n.. [4] Cressie, N.A.C. *Statistics for Spatial Data*, Wiley, New York.\n.. [5] Stoyan, D., Stoyan, H. *Fractals, Random Shapes and Point Fields*,\n       Akademie Verlag GmbH, Chichester, 1992.\n.. [6] *Correlation function*.\n       <https://en.wikipedia.org/wiki/Correlation_function_(astronomy)>\n"},{"id":148,"name":"performance.inc.rst","nodeType":"TextFile","path":"docs/stats","text":".. note that if this is changed from the default approach of using an *include*\n   (in index.rst) to a separate performance page, the header needs to be changed\n   from === to ***, the filename extension needs to be changed from .inc.rst to\n   .rst, and a link needs to be added in the subpackage toctree\n\n.. _astropy-stats-performance:\n\nPerformance Tips\n================\n\nIf you are finding sigma clipping to be slow, and if you have not already done\nso, consider installing the `bottleneck <https://pypi.org/project/Bottleneck/>`_\npackage, which will speed up some of the internal computations. In addition, if\nyou are using standard functions for ``cenfunc`` and/or ``stdfunc``, make sure\nyou specify these as strings rather than passing a NumPy function — that is,\nuse::\n\n    >>> sigma_clip(array, cenfunc='median')  # doctest: +SKIP\n\ninstead of::\n\n    >>> sigma_clip(array, cenfunc=np.nanmedian)  # doctest: +SKIP\n\nUsing strings will allow the sigma-clipping algorithm to pick the fastest\nimplementation available for finding the median.\n"},{"id":149,"name":"robust.rst","nodeType":"TextFile","path":"docs/stats","text":".. _stats-robust:\n\n*****************************\nRobust Statistical Estimators\n*****************************\n\nRobust statistics provides reliable estimates of basic statistics for complex\ndistributions. The statistics package includes several robust statistical\nfunctions that are commonly used in astronomy. This includes methods for\nrejecting outliers as well as statistical description of the underlying\ndistributions.\n\nIn addition to the functions mentioned here, models can be fit with outlier\nrejection using :func:`~astropy.modeling.fitting.FittingWithOutlierRemoval`.\n\nSigma Clipping\n==============\n\nSigma clipping provides a fast method for identifying outliers in a\ndistribution. For a distribution of points, a center and a standard\ndeviation are calculated. Values which are less or more than a\nspecified number of standard deviations from a center value are\nrejected. The process can be iterated to further reject outliers.\n\nThe `astropy.stats` package provides both a functional and\nobject-oriented interface for sigma clipping. The function is called\n:func:`~astropy.stats.sigma_clip` and the class is called\n:class:`~astropy.stats.SigmaClip`. By default, they both return a\nmasked array where the rejected points are masked.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Functional Sigma Clipping with astropy.stats.sigma_clip\n\nWe can start by generating some data that has a mean of 0 and standard\ndeviation of 0.2, but with outliers:\n\n.. doctest-requires:: scipy\n\n     >>> import numpy as np\n     >>> import scipy.stats as stats\n     >>> np.random.seed(0)\n     >>> x = np.arange(200)\n     >>> y = np.zeros(200)\n     >>> c = stats.bernoulli.rvs(0.35, size=x.shape)\n     >>> y += (np.random.normal(0., 0.2, x.shape) +\n     ...       c*np.random.normal(3.0, 5.0, x.shape))\n\nNow we can use :func:`~astropy.stats.sigma_clip` to perform sigma\nclipping on the data:\n\n.. doctest-requires:: scipy\n\n     >>> from astropy.stats import sigma_clip\n     >>> filtered_data = sigma_clip(y, sigma=3, maxiters=10)\n\nThe output masked array then can be used to calculate statistics on\nthe data, fit models to the data, or otherwise explore the data.\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Object-Oriented Sigma Clipping with the astropy.stats.SigmaClip Class\n\nTo perform the same sigma clipping with the\n:class:`~astropy.stats.SigmaClip` class:\n\n.. doctest-requires:: scipy\n\n     >>> from astropy.stats import SigmaClip\n     >>> sigclip = SigmaClip(sigma=3, maxiters=10)\n     >>> print(sigclip)  # doctest: +SKIP\n     <SigmaClip>\n        sigma: 3\n        sigma_lower: None\n        sigma_upper: None\n        maxiters: 10\n        cenfunc: <function median at 0x108dbde18>\n        stdfunc: <function std at 0x103ab52f0>\n     >>> filtered_data = sigclip(y)\n\nNote that once the ``sigclip`` instance is defined above, it can be\napplied to other data using the same already defined sigma-clipping\nparameters.\n\n..\n  EXAMPLE END\n\nFor basic statistics, :func:`~astropy.stats.sigma_clipped_stats` is a\nconvenience function to calculate the sigma-clipped mean, median, and\nstandard deviation of an array. As can be seen, rejecting the\noutliers returns accurate values for the underlying distribution.\n\n..\n  EXAMPLE START\n  Calculating the Sigma-Clipped Mean, Median, and Standard Deviation of an Array\n\nTo use :func:`~astropy.stats.sigma_clipped_stats` for sigma-clipped statistics\ncalculation:\n\n.. doctest-requires:: scipy\n\n     >>> from astropy.stats import sigma_clipped_stats\n     >>> y.mean(), np.median(y), y.std()  # doctest: +FLOAT_CMP\n     (0.86586417693378226, 0.03265864495523732, 3.2913811977676444)\n     >>> sigma_clipped_stats(y, sigma=3, maxiters=10)  # doctest: +FLOAT_CMP\n     (-0.0020337793767186197, -0.023632809025713953, 0.19514652532636906)\n\n:func:`~astropy.stats.sigma_clip` and\n:class:`~astropy.stats.SigmaClip` can be combined with other robust\nstatistics to provide improved outlier rejection as well.\n\n.. plot::\n    :include-source:\n\n    import numpy as np\n    import scipy.stats as stats\n    from matplotlib import pyplot as plt\n    from astropy.stats import sigma_clip, mad_std\n\n    # Generate fake data that has a mean of 0 and standard deviation of 0.2 with outliers\n    np.random.seed(0)\n    x = np.arange(200)\n    y = np.zeros(200)\n    c = stats.bernoulli.rvs(0.35, size=x.shape)\n    y += (np.random.normal(0., 0.2, x.shape) +\n          c*np.random.normal(3.0, 5.0, x.shape))\n\n    filtered_data = sigma_clip(y, sigma=3, maxiters=1, stdfunc=mad_std)\n\n    # plot the original and rejected data\n    plt.figure(figsize=(8,5))\n    plt.plot(x, y, '+', color='#1f77b4', label=\"original data\")\n    plt.plot(x[filtered_data.mask], y[filtered_data.mask], 'x',\n             color='#d62728', label=\"rejected data\")\n    plt.xlabel('x')\n    plt.ylabel('y')\n    plt.legend(loc=2, numpoints=1)\n\n.. automodapi:: astropy.stats.sigma_clipping\n\n..\n  EXAMPLE END\n\nMedian Absolute Deviation\n=========================\n\nThe median absolute deviation (MAD) is a measure of the spread of a\ndistribution and is defined as ``median(abs(a - median(a)))``. The\nMAD can be calculated using `~astropy.stats.median_absolute_deviation`. For a\nnormal distribution, the MAD is related to the standard deviation by a factor\nof 1.4826, and a convenience function, `~astropy.stats.mad_std`, is\navailable to apply the conversion.\n\n.. note::\n\n   A function can be supplied to the\n   `~astropy.stats.median_absolute_deviation` to specify the median\n   function to be used in the calculation. Depending on the version\n   of NumPy and whether the array is masked or contains irregular\n   values, significant performance increases can be had by\n   preselecting the median function. If the median function is not\n   specified, `~astropy.stats.median_absolute_deviation` will attempt\n   to select the most relevant function according to the input data.\n\n\nBiweight Estimators\n===================\n\nA set of functions are included in the `astropy.stats` package that use the\nbiweight formalism. These functions have long been used in astronomy,\nparticularly to calculate the velocity dispersion of galaxy clusters [1]_. The\nfollowing set of tasks are available for biweight measurements:\n\n.. automodapi:: astropy.stats.biweight\n\n\nReferences\n----------\n\n.. [1] Beers, Flynn, and Gebhardt (1990; AJ 100, 32) (https://ui.adsabs.harvard.edu/abs/1990AJ....100...32B)\n"},{"id":150,"name":"index.rst","nodeType":"TextFile","path":"docs/stats","text":".. _stats:\n\n***************************************\nAstrostatistics Tools (`astropy.stats`)\n***************************************\n\nIntroduction\n============\n\nThe `astropy.stats` package holds statistical functions or algorithms\nused in astronomy.  While the `scipy.stats` and `statsmodels\n<http://www.statsmodels.org/stable/index.html>`_ packages contains a\nwide range of statistical tools, they are general-purpose packages and\nare missing some tools that are particularly useful or specific to\nastronomy. This package is intended to provide such functionality,\nbut *not* to replace `scipy.stats` if its implementation satisfies\nastronomers' needs.\n\n\nGetting Started\n===============\n\nA number of different tools are contained in the stats package, and\nthey can be accessed by importing them::\n\n    >>> from astropy import stats\n\nA full list of the different tools are provided below. Please see the\ndocumentation for their different usages. For example, sigma clipping,\nwhich is a common way to estimate the background of an image, can be\nperformed with the :func:`~astropy.stats.sigma_clip` function. By\ndefault, the function returns a masked array where outliers are\nmasked.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Sigma Clipping with Astropy Stats sigma_clip Function\n\nTo estimate the background of an image::\n\n    >>> data = [1, 5, 6, 8, 100, 5, 3, 2]\n    >>> stats.sigma_clip(data, sigma=2, maxiters=5)\n    masked_array(data=[1, 5, 6, 8, --, 5, 3, 2],\n                 mask=[False, False, False, False,  True, False, False, False],\n           fill_value=999999)\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Sigma Clipping with Astropy Stats SigmaClip Class\n\nAlternatively, the :class:`~astropy.stats.SigmaClip` class provides an\nobject-oriented interface to sigma clipping, which also returns a\nmasked array by default::\n\n    >>> sigclip = stats.SigmaClip(sigma=2, maxiters=5)\n    >>> sigclip(data)\n    masked_array(data=[1, 5, 6, 8, --, 5, 3, 2],\n                 mask=[False, False, False, False,  True, False, False, False],\n           fill_value=999999)\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Calculating Sigma Clipping Statistics\n\nIn addition, there are also several convenience functions for making\nthe calculation of statistics even more convenient. For example,\n:func:`~astropy.stats.sigma_clipped_stats` will return the mean,\nmedian, and standard deviation of a sigma-clipped array::\n\n     >>> stats.sigma_clipped_stats(data, sigma=2, maxiters=5)  # doctest: +FLOAT_CMP\n     (4.2857142857142856, 5.0, 2.2497165354319457)\n\nThere are also tools for calculating :ref:`robust statistics\n<stats-robust>`, sampling the data, :ref:`circular statistics\n<stats-circular>`, confidence limits, spatial statistics, and adaptive\nhistograms.\n\n..\n  EXAMPLE END\n\nMost tools are fairly self-contained, and include relevant examples in\ntheir docstrings.\n\n\nUsing `astropy.stats`\n=====================\n\nMore detailed information on using the package is provided on separate pages,\nlisted below.\n\n.. toctree::\n   :maxdepth: 2\n\n   robust.rst\n   circ.rst\n   ripley.rst\n   ../visualization/histogram.rst\n\n\nConstants\n=========\n\nThe `astropy.stats` package defines two constants useful for\nconverting between Gaussian sigma and full width at half maximum\n(FWHM):\n\n.. data:: gaussian_sigma_to_fwhm\n\n    Factor with which to multiply Gaussian 1-sigma standard deviation\n    to convert it to full width at half maximum (FWHM).\n\n    >>> from astropy.stats import gaussian_sigma_to_fwhm\n    >>> gaussian_sigma_to_fwhm  # doctest: +FLOAT_CMP\n    2.3548200450309493\n\n.. data:: gaussian_fwhm_to_sigma\n\n    Factor with which to multiply Gaussian full width at half maximum\n    (FWHM) to convert it to 1-sigma standard deviation.\n\n    >>> from astropy.stats import gaussian_fwhm_to_sigma\n    >>> gaussian_fwhm_to_sigma  # doctest: +FLOAT_CMP\n    0.42466090014400953\n\n\nSee Also\n========\n\n* :mod:`scipy.stats`\n    This SciPy package contains a variety of useful statistical functions\n    and classes. The functionality in `astropy.stats` is intended to supplement\n    this, *not* replace it.\n\n* `statsmodels <http://www.statsmodels.org/stable/index.html>`_\n    The statsmodels package provides functionality for estimating\n    different statistical models, tests, and data exploration.\n\n* `astroML <https://www.astroml.org/>`_\n    The astroML package is a Python module for machine learning and\n    data mining. Some of the tools from this package have been\n    migrated here, but there are still a number of tools there that\n    are useful for astronomy and statistical analysis.\n\n\n* :func:`astropy.visualization.hist`\n    The :func:`~astropy.stats.histogram` routine and related functionality\n    defined here are used within the :func:`astropy.visualization.hist`\n    function. For a discussion of these methods for determining histogram\n    binnings, see :ref:`astropy-visualization-hist`.\n\n.. note that if this section gets too long, it should be moved to a separate\n   doc page - see the top of performance.inc.rst for the instructions on how to do\n   that\n.. include:: performance.inc.rst\n\nReference/API\n=============\n\n.. automodapi:: astropy.stats\n"},{"id":151,"name":"docs/table","nodeType":"Package"},{"id":152,"name":"implementation_details.rst","nodeType":"TextFile","path":"docs/table","text":"\n.. _table_implementation_details:\n\nTable Implementation Details\n*****************************\n\nThis page provides a brief overview of the |Table| class implementation, in\nparticular highlighting the internal data storage architecture. This is aimed\nat developers and/or users who are interested in optimal use of the |Table|\nclass.\n\nThe image below illustrates the basic architecture of the |Table| class.\nThe fundamental data container is an ordered dictionary of individual column\nobjects maintained as the ``columns`` attribute. It is via this container\nthat columns are managed and accessed.\n\n.. image:: table_architecture.png\n   :width: 45%\n\nEach |Column| (or |MaskedColumn|) object is an |ndarray| (or\n:class:`numpy.ma.MaskedArray`) subclass and is the sole owner of its data.\nMaintaining the table as separate columns simplifies table management\nconsiderably. It also makes operations like adding or removing columns much\nfaster in comparison to implementations using a ``numpy`` structured array\ncontainer.\n\nAs shown below, a |Row| object corresponds to a single row in the table. The\n|Row| object does not create a view of the full row at any point. Instead it\nmanages access (e.g., ``row['a']``) dynamically by referencing the appropriate\nelements of the parent table.\n\n.. image:: table_row.png\n   :width: 83%\n\nIn some cases it is desirable to have a static copy of the full row. This is\navailable via the `~astropy.table.Row.as_void()` method, which creates and\nreturns a :class:`numpy.void` or ``numpy.ma.mvoid`` object with a copy of the\noriginal data.\n"},{"id":153,"name":"indexing.rst","nodeType":"TextFile","path":"docs/table","text":".. |add_index| replace:: :func:`~astropy.table.Table.add_index`\n.. |index_mode| replace:: :func:`~astropy.table.Table.index_mode`\n\n.. _table-indexing:\n\nTable Indexing\n**************\n\nOnce a |Table| has been created, it is possible to create indices on one or\nmore columns of the table. An index internally sorts the rows of a table based\non the index column(s), allowing for element retrieval by column value and\nimproved performance for certain table operations.\n\nCreating an Index\n=================\n\n.. EXAMPLE START: Creating Indexes on Table Columns\n\nTo create an index on a table, use the |add_index| method::\n\n   >>> from astropy.table import Table\n   >>> t = Table([(2, 3, 2, 1), (8, 7, 6, 5)], names=('a', 'b'))\n   >>> t.add_index('a')\n\nThe optional argument ``unique`` may be specified to create an index with\nuniquely valued elements.\n\nTo create a composite index on multiple columns, pass a list of columns\ninstead::\n\n   >>> t.add_index(['a', 'b'])\n\nIn particular, the first index created using the\n|add_index| method is considered the default index or the \"primary key.\" To\nretrieve an index from a table, use the `~astropy.table.Table.indices`\nproperty::\n\n   >>> t.indices['a']\n   <SlicedIndex original=True index=<Index columns=('a',) data=<SortedArray length=4>\n    a  rows\n   --- ----\n     1    3\n     2    0\n     2    2\n     3    1>>\n   >>> t.indices['a', 'b']\n   <SlicedIndex original=True index=<Index columns=('a', 'b') data=<SortedArray length=4>\n    a   b  rows\n   --- --- ----\n     1   5    3\n     2   6    2\n     2   8    0\n     3   7    1>>\n\n.. EXAMPLE END\n\nRow Retrieval using Indices\n===========================\n\n.. EXAMPLE START: Retrieving Table Rows using Indices\n\nRow retrieval can be accomplished using two table properties:\n`~astropy.table.Table.loc` and `~astropy.table.Table.iloc`. The\n`~astropy.table.Table.loc` property can be indexed either by column value,\nrange of column values (*including* the bounds), or a :class:`list` or\n|ndarray| of column values::\n\n   >>> t = Table([(1, 2, 3, 4), (10, 1, 9, 9)], names=('a', 'b'), dtype=['i8', 'i8'])\n   >>> t.add_index('a')\n   >>> t.loc[2]\n   <Row index=1>\n     a     b\n   int64 int64\n   ----- -----\n       2     1\n   >>> t.loc[[1, 4]]\n   <Table length=2>\n     a     b\n   int64 int64\n   ----- -----\n       1    10\n       4     9\n   >>> t.loc[1:3]\n   <Table length=3>\n     a     b\n   int64 int64\n   ----- -----\n       1    10\n       2     1\n       3     9\n   >>> t.loc[:]\n   <Table length=4>\n     a     b\n   int64 int64\n   ----- -----\n       1    10\n       2     1\n       3     9\n       4     9\n\nNote that by default, `~astropy.table.Table.loc` uses the primary index, which\nhere is column ``'a'``. To use a different index, pass the indexed column name\nbefore the retrieval data::\n\n   >>> t.add_index('b')\n   >>> t.loc['b', 8:10]\n   <Table length=3>\n     a     b\n   int64 int64\n   ----- -----\n       3     9\n       4     9\n       1    10\n\nThe property `~astropy.table.Table.iloc` works similarly, except that the\nretrieval information must be either an integer or a :class:`slice`, and\nrelates to the sorted order of the index rather than column values. For\nexample::\n\n   >>> t.iloc[0] # smallest row by value 'a'\n   <Row index=0>\n     a     b\n   int64 int64\n   ----- -----\n       1    10\n   >>> t.iloc['b', 1:] # all but smallest value of 'b'\n   <Table length=3>\n     a     b\n   int64 int64\n   ----- -----\n       3     9\n       4     9\n       1    10\n\n.. EXAMPLE END\n\nEffects on Performance\n======================\n\nTable operations change somewhat when indices are present, and there are a\nnumber of factors to consider when deciding whether the use of indices will\nimprove performance. In general, indexing offers the following advantages:\n\n* Table grouping and sorting based on indexed column(s) both become faster.\n* Retrieving values by index is faster than custom searching.\n\nThere are certain caveats, however:\n\n* Creating an index requires time and memory.\n* Table modifications become slower due to automatic index updates.\n* Slicing a table becomes slower due to index relabeling.\n\nSee `here\n<https://nbviewer.jupyter.org/github/mdmueller/astropy-notebooks/blob/master/table/indexing-profiling.ipynb>`_\nfor an IPython notebook profiling various aspects of table indexing.\n\nIndex Modes\n===========\n\nThe |index_mode| method allows for some flexibility in the behavior of table\nindexing by allowing the user to enter a specific indexing mode via a context\nmanager. There are currently three indexing modes: ``'freeze'``,\n``'copy_on_getitem'``, and ``'discard_on_copy'``.\n\n.. EXAMPLE START: Table Indexing with the \"freeze\" Index Mode\n\nThe ``'freeze'`` mode prevents automatic index updates whenever a column of the\nindex is modified, and all indices refresh themselves after the context ends::\n\n  >>> with t.index_mode('freeze'):\n  ...    t['a'][0] = 0\n  ...    print(t.indices['a']) # unmodified\n  <SlicedIndex original=True index=<Index columns=('a',) data=<SortedArray length=4>\n   a  rows\n  --- ----\n    1    0\n    2    1\n    3    2\n    4    3>>\n  >>> print(t.indices['a']) # modified\n  <SlicedIndex original=True index=<Index columns=('a',) data=<SortedArray length=4>\n   a  rows\n  --- ----\n    0    0\n    2    1\n    3    2\n    4    3>>\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Table Indexing with the \"copy_on_getitem\" Index Mode\n\nThe ``'copy_on_getitem'`` mode forces columns to copy and relabel their indices\nupon slicing. In the absence of this mode, table slices will preserve\nindices while column slices will not::\n\n  >>> ca = t['a'][[1, 3]]\n  >>> ca.info.indices\n  []\n  >>> with t.index_mode('copy_on_getitem'):\n  ...     ca = t['a'][[1, 3]]\n  ...     print(ca.info.indices)\n  [<SlicedIndex original=True index=<Index columns=('a',) data=<SortedArray length=2>\n   a  rows\n  --- ----\n    2    0\n    4    1>>]\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Table Indexing with the \"discard_on_copy\" Index Mode\n\nThe ``'discard_on_copy'`` mode prevents indices from being copied whenever a\ncolumn or table is copied::\n\n  >>> t2 = Table(t)\n  >>> t2.indices['a']\n  <SlicedIndex original=True index=<Index columns=('a',) data=<SortedArray length=4>\n   a  rows\n  --- ----\n    0    0\n    2    1\n    3    2\n    4    3>>\n  >>> with t.index_mode('discard_on_copy'):\n  ...    t2 = Table(t)\n  ...    print(t2.indices)\n  []\n\n.. EXAMPLE END\n\nUpdating Rows using Indices\n===========================\n\n.. EXAMPLE START: Updating Table Rows using Indices\n\nRow updates can be accomplished by assigning the table property\n`~astropy.table.Table.loc` a complete row or a list of rows::\n\n   >>> t = Table([('w', 'x', 'y', 'z'), (10, 1, 9, 9)], names=('a', 'b'), dtype=['str', 'i8'])\n   >>> t.add_index('a')\n   >>> t.loc['x']\n   <Row index=1>\n    a     b\n   str1 int64\n   ---- -----\n      x     1\n   >>> t.loc['x'] = ['a', 12]\n   >>> t\n   <Table length=4>\n    a     b\n   str1 int64\n   ---- -----\n      w    10\n      a    12\n      y     9\n      z     9\n   >>> t.loc[['w', 'y']]\n   <Table length=2>\n    a     b\n   str1 int64\n   ---- -----\n      w    10\n      y     9\n   >>> t.loc[['w', 'z']] = [['b', 23], ['c', 56]]\n   >>> t\n   <Table length=4>\n    a     b\n   str1 int64\n   ---- -----\n      b    23\n      a    12\n      y     9\n      c    56\n\n.. EXAMPLE END\n\nRetrieving the Location of Rows using Indices\n=============================================\n\n.. EXAMPLE START: Retrieving the Location of Table Rows using Indices\n\nRetrieval of the location of rows can be accomplished using a table property:\n`~astropy.table.Table.loc_indices`. The `~astropy.table.Table.loc_indices`\nproperty can be indexed either by column value, range of column values\n(*including* the bounds), or a :class:`list` or |ndarray| of column values::\n\n   >>> t = Table([('w', 'x', 'y', 'z'), (10, 1, 9, 9)], names=('a', 'b'), dtype=['str', 'i8'])\n   >>> t.add_index('a')\n   >>> t.loc_indices['x']\n   1\n\n.. EXAMPLE END\n\nEngines\n=======\n\nWhen creating an index via |add_index|, the keyword argument ``engine`` may be\nspecified to use a particular indexing engine. The available engines are:\n\n* `~astropy.table.SortedArray`, a sorted array engine using an underlying\n  sorted |Table|.\n* `~astropy.table.SCEngine`, a sorted list engine using the `Sorted Containers\n  <https://pypi.org/project/sortedcontainers/>`_ package.\n* `~astropy.table.BST`, a Python-based binary search tree engine (not recommended).\n\nThe SCEngine depends on the ``sortedcontainers`` dependency. The most important takeaway is that\n`~astropy.table.SortedArray` (the default engine) is usually best, although\n`~astropy.table.SCEngine` may be more appropriate for an index created on an\nempty column since adding new values is quicker.\n\nThe `~astropy.table.BST` engine demonstrates a simple pure Python implementation\nof a search tree engine, but the performance is poor for larger tables. This\nis available in the code largely as an implementation reference.\n"},{"id":154,"name":"io.rst","nodeType":"TextFile","path":"docs/table","text":".. doctest-skip-all\n\n.. _read_write_tables:\n\nReading and Writing Table Objects\n*********************************\n\n``astropy`` provides a unified interface for reading and writing data in\ndifferent formats. For many common cases this will streamline the process of\nfile I/O and reduce the need to learn the separate details of all of the I/O\npackages within ``astropy``. For details and examples of using this interface\nsee the :ref:`table_io` section.\n\nGetting Started\n===============\n\nThe :class:`~astropy.table.Table` class includes two methods,\n:meth:`~astropy.table.Table.read` and :meth:`~astropy.table.Table.write`, that\nmake it possible to read from and write to files. A number of formats are\nautomatically supported (see :ref:`built_in_readers_writers`) and new file\nformats and extensions can be registered with the :class:`~astropy.table.Table`\nclass (see :ref:`io_registry`).\n\n.. EXAMPLE START: Reading and Writing Table Objects\n\nTo use this interface, first import the :class:`~astropy.table.Table` class,\nthen call the :class:`~astropy.table.Table` :meth:`~astropy.table.Table.read`\nmethod with the name of the file and the file format, for instance\n``'ascii.daophot'``::\n\n    >>> from astropy.table import Table\n    >>> t = Table.read('photometry.dat', format='ascii.daophot')\n\nIt is possible to load tables directly from the Internet using URLs. For\nexample, download tables from `VizieR catalogs <https://vizier.u-strasbg.fr/>`_\nin CDS format (``'ascii.cds'``)::\n\n    >>> t = Table.read(\"ftp://cdsarc.u-strasbg.fr/pub/cats/VII/253/snrs.dat\",\n    ...         readme=\"ftp://cdsarc.u-strasbg.fr/pub/cats/VII/253/ReadMe\",\n    ...         format=\"ascii.cds\")\n\n.. EXAMPLE END\n\nFor certain file formats, the format can be automatically detected, for\nexample from the filename extension::\n\n    >>> t = Table.read('table.tex')\n\nSimilarly, for writing, the format can be explicitly specified::\n\n    >>> t.write(filename, format='latex')\n\nAs for the :meth:`~astropy.table.Table.read` method, the format may\nbe automatically identified in some cases.\n\nAny additional arguments specified will depend on the format. For examples of\nthis see the section :ref:`built_in_readers_writers`. This section also\nprovides the full list of choices for the ``format`` argument.\n\nSupported Formats\n=================\n\nThe :ref:`table_io` has built-in support for the following data file formats:\n\n* :ref:`table_io_ascii`\n* :ref:`table_io_hdf5`\n* :ref:`table_io_fits`\n* :ref:`table_io_votable`\n* :ref:`table_io_parquet`\n"},{"id":155,"name":"mixin_columns.rst","nodeType":"TextFile","path":"docs/table","text":".. |join| replace:: :func:`~astropy.table.join`\n\n.. _mixin_columns:\n\nMixin Columns\n*************\n\n``astropy`` tables support the concept of \"mixin columns\", which\nallows integration of appropriate non-|Column| based class objects within a\n|Table| object. These mixin column objects are not converted in any way but are\nused natively.\n\nThe available built-in mixin column classes are:\n\n- |Quantity| and subclasses\n- |SkyCoord| and coordinate frame classes\n- |Time| and :class:`~astropy.time.TimeDelta`\n- :class:`~astropy.coordinates.EarthLocation`\n- `~astropy.table.NdarrayMixin`\n\nBasic Example\n=============\n\n.. EXAMPLE START: Using Mixin Columns in Tables\n\nAs an example we can create a table and add a time column::\n\n  >>> from astropy.table import Table\n  >>> from astropy.time import Time\n  >>> t = Table()\n  >>> t['index'] = [1, 2]\n  >>> t['time'] = Time(['2001-01-02T12:34:56', '2001-02-03T00:01:02'])\n  >>> print(t)\n  index           time\n  ----- -----------------------\n      1 2001-01-02T12:34:56.000\n      2 2001-02-03T00:01:02.000\n\nThe important point here is that the ``time`` column is a bona fide |Time|\nobject::\n\n  >>> t['time']\n  <Time object: scale='utc' format='isot' value=['2001-01-02T12:34:56.000' '2001-02-03T00:01:02.000']>\n  >>> t['time'].mjd  # doctest: +FLOAT_CMP\n  array([51911.52425926, 51943.00071759])\n\n.. EXAMPLE END\n\n.. _quantity_and_qtable:\n\nQuantity and QTable\n===================\n\nThe ability to natively handle |Quantity| objects within a table makes it more\nconvenient to manipulate tabular data with units in a natural and robust way.\nHowever, this feature introduces an ambiguity because data with a unit\n(e.g., from a FITS binary table) can be represented as either a |Column| with a\n``unit`` attribute or as a |Quantity| object. In order to cleanly resolve this\nambiguity, ``astropy`` defines a minor variant of the |Table| class called\n|QTable|. The |QTable| class is exactly the same as |Table| except that\n|Quantity| is the default for any data column with a defined unit.\n\nIf you take advantage of the |Quantity| infrastructure in your analysis, then\n|QTable| is the preferred way to create tables with units. If instead you use\ntable column units more as a descriptive label, then the plain |Table| class is\nprobably the best class to use.\n\nExample\n-------\n\n.. EXAMPLE START: Using Quantity Columns and QTables\n\nTo illustrate these concepts we first create a standard |Table| where we supply\nas input a |Time| object and a |Quantity| object with units of ``m / s``. In\nthis case the quantity is converted to a |Column| (which has a ``unit``\nattribute but does not have all of the features of a |Quantity|)::\n\n  >>> import astropy.units as u\n  >>> t = Table()\n  >>> t['index'] = [1, 2]\n  >>> t['time'] = Time(['2001-01-02T12:34:56', '2001-02-03T00:01:02'])\n  >>> t['velocity'] = [3, 4] * u.m / u.s\n\n  >>> print(t)\n  index           time          velocity\n                                 m / s\n  ----- ----------------------- --------\n      1 2001-01-02T12:34:56.000      3.0\n      2 2001-02-03T00:01:02.000      4.0\n\n  >>> type(t['velocity'])\n  <class 'astropy.table.column.Column'>\n\n  >>> t['velocity'].unit\n  Unit(\"m / s\")\n\n  >>> (t['velocity'] ** 2).unit  # WRONG because Column is not smart about unit\n  Unit(\"m / s\")\n\nSo instead let's do the same thing using a |QTable|::\n\n  >>> from astropy.table import QTable\n\n  >>> qt = QTable()\n  >>> qt['index'] = [1, 2]\n  >>> qt['time'] = Time(['2001-01-02T12:34:56', '2001-02-03T00:01:02'])\n  >>> qt['velocity'] = [3, 4] * u.m / u.s\n\nThe ``velocity`` column is now a |Quantity| and behaves accordingly::\n\n  >>> type(qt['velocity'])\n  <class 'astropy.units.quantity.Quantity'>\n\n  >>> qt['velocity'].unit\n  Unit(\"m / s\")\n\n  >>> (qt['velocity'] ** 2).unit  # GOOD!\n  Unit(\"m2 / s2\")\n\nYou can conveniently convert |Table| to |QTable| and vice-versa::\n\n  >>> qt2 = QTable(t)\n  >>> type(qt2['velocity'])\n  <class 'astropy.units.quantity.Quantity'>\n\n  >>> t2 = Table(qt2)\n  >>> type(t2['velocity'])\n  <class 'astropy.table.column.Column'>\n\n.. Note::\n\n   To summarize: the **only** difference between `~astropy.table.QTable` and\n   `~astropy.table.Table` is the behavior when adding a column that has a\n   specified unit. With `~astropy.table.QTable` such a column is always\n   converted to a `~astropy.units.Quantity` object before being added to the\n   table. Likewise if a unit is specified for an existing unit-less\n   `~astropy.table.Column` in a `~astropy.table.QTable`, then the column is\n   converted to `~astropy.units.Quantity`.\n\n   The converse is that if you add a `~astropy.units.Quantity` column to an\n   ordinary `~astropy.table.Table` then it gets converted to an ordinary\n   `~astropy.table.Column` with the corresponding ``unit`` attribute.\n\n.. attention::\n\n   When a column of ``int`` ``dtype`` is converted to `~astropy.units.Quantity`,\n   its ``dtype`` is converted to ``float``.\n\n   For example, for a quality flag column of ``int``, if it is\n   assigned with the :ref:`dimensionless unit <doc_dimensionless_unit>`, it will still\n   be converted to ``float``. Therefore such columns typically should not be\n   assigned with any unit.\n\n.. EXAMPLE END\n\n.. _mixin_attributes:\n\nMixin Attributes\n================\n\nThe usual column attributes ``name``, ``dtype``, ``unit``, ``format``, and\n``description`` are available in any mixin column via the ``info`` property::\n\n  >>> qt['velocity'].info.name\n  'velocity'\n\nThis ``info`` property is a key bit of glue that allows a non-|Column| object\nto behave much like a |Column|.\n\nThe same ``info`` property is also available in standard\n`~astropy.table.Column` objects. These ``info`` attributes like\n``t['a'].info.name`` refer to the direct `~astropy.table.Column`\nattribute (e.g., ``t['a'].name``) and can be used interchangeably.\nLikewise in a `~astropy.units.Quantity` object, ``info.dtype``\nattribute refers to the native ``dtype`` attribute of the object.\n\n.. Note::\n\n   When writing generalized code that handles column objects which\n   might be mixin columns, you must *always* use the ``info``\n   property to access column attributes.\n\n.. _details_and_caveats:\n\nDetails and Caveats\n===================\n\nMost common table operations behave as expected when mixin columns are part of\nthe table. However, there are limitations in the current implementation.\n\n**Adding or inserting a row**\n\nAdding or inserting a row works as expected only for mixin classes that are\nmutable (data can be changed internally) and that have an ``insert()`` method.\nAdding rows to a |Table| with |Quantity|, |Time| or |SkyCoord| columns does\nwork.\n\n**Masking**\n\nMasking of mixin columns is enabled by the |Masked| class. See\n:ref:`utils-masked` for details.\n\n**High-level table operations**\n\nSome :ref:`grouped-operations` can be used with a |QTable| with |Quantity|\ncolumns, but performing aggregation on such a |QTable| fails::\n\n  >>> import numpy as np\n  >>> t = QTable()\n  >>> t['name'] = ['foo', 'foo', 'bar']\n  >>> t['a'] = np.arange(3)*u.m\n  >>> t_grouped = t.group_by('name')\n  >>> print(t_grouped)\n  name  a\n        m\n  ---- ---\n   bar 2.0\n   foo 0.0\n   foo 1.0\n  >>> t_grouped.groups.aggregate(np.mean)\n  Traceback (most recent call last):\n  ...\n  AttributeError: 'Quantity' object has no 'groups' member\n\n**ASCII table writing**\n\nTables with mixin columns can be written out to file using the\n`astropy.io.ascii` module, but the fast C-based writers are not available.\nInstead, the pure-Python writers will be used. For writing tables with mixin\ncolumns it is recommended to use the :ref:`ecsv_format`. This will fully\nserialize the table data and metadata, allowing full \"round-trip\" of the table\nwhen it is read back.\n\n**Binary table writing**\n\nTables with mixin columns can be written to binary files using FITS, HDF5 and\nParquet formats. These can be read back to recover exactly the original |Table|\nincluding mixin columns and metadata. See :ref:`table_io` for details.\n\n.. _mixin_protocol:\n\nMixin Protocol\n==============\n\nA key idea behind mixin columns is that any class which satisfies a specified\nprotocol can be used. That means many user-defined class objects which handle\narray-like data can be used natively within a |Table|. The protocol is\nrelatively concise and requires that a class behave like a minimal ``numpy``\narray with the following properties:\n\n- Contains array-like data.\n- Implements ``__getitem__()`` to support getting data as a\n  single item, slicing, or index array access.\n- Has a ``shape`` attribute.\n- Has a ``__len__()`` method for length.\n- Has an ``info`` class descriptor which is a subclass of the\n  :class:`astropy.utils.data_info.MixinInfo` class.\n\nThe `Example: ArrayWrapper`_ section shows a minimal working example of a class\nwhich can be used as a mixin column. A :class:`pandas.Series` object can\nfunction as a mixin column as well.\n\nOther interesting possibilities for mixin columns include:\n\n- Columns which are dynamically computed as a function of other columns (AKA\n  spreadsheet).\n- Columns which are themselves a |Table| (i.e., nested tables). A `proof of\n  concept <https://github.com/astropy/astropy/pull/3963>`_ is available.\n\nnew_like() method\n-----------------\n\nIn order to support high-level operations like :func:`~astropy.table.join` and\n:func:`~astropy.table.vstack`, a mixin class must provide a ``new_like()``\nmethod in the ``info`` class descriptor. A key part of the functionality is to\nensure that the input column metadata are merged appropriately and that the\ncolumns have consistent properties such as the shape.\n\nA mixin class that provides ``new_like()`` must also implement\n``__setitem__()`` to support setting via a single item, slicing, or index\narray.\n\nThe ``new_like()`` method has the following signature::\n\n    def new_like(self, cols, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new instance of this class which is consistent with the\n        input ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty column object whose elements can\n        be set in-place for table operations like join or vstack.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns\n        length : int\n            Length of the output column object\n        metadata_conflicts : {'warn', 'error', 'silent'}\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : object\n            New instance of this class consistent with ``cols``\n        \"\"\"\n\nExamples of this are found in the `~astropy.table.column.ColumnInfo` and\n`~astropy.units.quantity.QuantityInfo` classes.\n\n\n.. _arraywrapper_example:\n\nExample: ArrayWrapper\n=====================\n\nThe code listing below shows an example of a data container class which acts as\na mixin column class. This class is a wrapper around a |ndarray|. It is used in\nthe ``astropy`` mixin test suite and is fully compliant as a mixin column.\n\n::\n\n  from astropy.utils.data_info import ParentDtypeInfo\n\n  class ArrayWrapper(object):\n      \"\"\"\n      Minimal mixin using a simple wrapper around a numpy array\n      \"\"\"\n      info = ParentDtypeInfo()\n\n      def __init__(self, data):\n          self.data = np.array(data)\n          if 'info' in getattr(data, '__dict__', ()):\n              self.info = data.info\n\n      def __getitem__(self, item):\n          if isinstance(item, (int, np.integer)):\n              out = self.data[item]\n          else:\n              out = self.__class__(self.data[item])\n              if 'info' in self.__dict__:\n                  out.info = self.info\n          return out\n\n      def __setitem__(self, item, value):\n          self.data[item] = value\n\n      def __len__(self):\n          return len(self.data)\n\n      @property\n      def dtype(self):\n          return self.data.dtype\n\n      @property\n      def shape(self):\n          return self.data.shape\n\n      def __repr__(self):\n          return f\"<{self.__class__.__name__} name='{self.info.name}' data={self.data}>\"\n\n.. _table_mixin_registry:\n\nRegistering array-like objects as mixin columns\n===============================================\n\nIn some cases, you may want to directly add an array-like\nobject as a table column while maintaining the original object properties\n(instead of the default conversion of the object to a `~astropy.table.Column`).\nThis is done by registering the object class as a mixin column and\ndefining a handler which allows `~astropy.table.Table` to treat that object\nclass as a mixin similar to the built-in mixin columns such as `~astropy.time.Time`\nor `~astropy.units.quantity.Quantity`.\n\nThis can be done for data classes that are defined in third-party packages and which\nyou have no control over. As an example, we define a class\nthat is not numpy-like and stores the data in a private attribute::\n\n    >>> class ExampleDataClass:\n    ...     def __init__(self):\n    ...         self._data = np.array([0, 1, 3, 4], dtype=float)\n\nBy default, this cannot be used as a table column::\n\n    >>> t = Table()\n    >>> t['data'] = ExampleDataClass()\n    Traceback (most recent call last):\n    ...\n    TypeError: Empty table cannot have column set to scalar value\n\nHowever, you can create a function (or 'handler') which takes\nan instance of the data class you want to have automatically\nhandled and returns a mixin column::\n\n    >>> from astropy.table.table_helpers import ArrayWrapper\n    >>> def handle_example_data_class(obj):\n    ...     return ArrayWrapper(obj._data)\n\nYou can then register this by providing the fully qualified name\nof the class and the handler function::\n\n    >>> from astropy.table.mixins.registry import register_mixin_handler\n    >>> register_mixin_handler('__main__.ExampleDataClass', handle_example_data_class)\n    >>> t['data'] = ExampleDataClass()\n    >>> t\n    <Table length=4>\n      data\n    float64\n    -------\n        0.0\n        1.0\n        3.0\n        4.0\n\nBecause we defined the data class as part of the example\nabove, the fully qualified name starts with ``__main__``,\nbut for a class in a third-party package, this might look\nlike ``package.Class`` for example.\n"},{"col":0,"comment":"Factory function to open a FITS file and return an `HDUList` object.\n\n    Parameters\n    ----------\n    name : str, file-like or `pathlib.Path`\n        File to be opened.\n\n    mode : str, optional\n        Open mode, 'readonly', 'update', 'append', 'denywrite', or\n        'ostream'. Default is 'readonly'.\n\n        If ``name`` is a file object that is already opened, ``mode`` must\n        match the mode the file was opened with, readonly (rb), update (rb+),\n        append (ab+), ostream (w), denywrite (rb)).\n\n    memmap : bool, optional\n        Is memory mapping to be used? This value is obtained from the\n        configuration item ``astropy.io.fits.Conf.use_memmap``.\n        Default is `True`.\n\n    save_backup : bool, optional\n        If the file was opened in update or append mode, this ensures that\n        a backup of the original file is saved before any changes are flushed.\n        The backup has the same name as the original file with \".bak\" appended.\n        If \"file.bak\" already exists then \"file.bak.1\" is used, and so on.\n        Default is `False`.\n\n    cache : bool, optional\n        If the file name is a URL, `~astropy.utils.data.download_file` is used\n        to open the file.  This specifies whether or not to save the file\n        locally in Astropy's download cache. Default is `True`.\n\n    lazy_load_hdus : bool, optional\n        To avoid reading all the HDUs and headers in a FITS file immediately\n        upon opening.  This is an optimization especially useful for large\n        files, as FITS has no way of determining the number and offsets of all\n        the HDUs in a file without scanning through the file and reading all\n        the headers. Default is `True`.\n\n        To disable lazy loading and read all HDUs immediately (the old\n        behavior) use ``lazy_load_hdus=False``.  This can lead to fewer\n        surprises--for example with lazy loading enabled, ``len(hdul)``\n        can be slow, as it means the entire FITS file needs to be read in\n        order to determine the number of HDUs.  ``lazy_load_hdus=False``\n        ensures that all HDUs have already been loaded after the file has\n        been opened.\n\n        .. versionadded:: 1.3\n\n    uint : bool, optional\n        Interpret signed integer data where ``BZERO`` is the central value and\n        ``BSCALE == 1`` as unsigned integer data.  For example, ``int16`` data\n        with ``BZERO = 32768`` and ``BSCALE = 1`` would be treated as\n        ``uint16`` data. Default is `True` so that the pseudo-unsigned\n        integer convention is assumed.\n\n    ignore_missing_end : bool, optional\n        Do not raise an exception when opening a file that is missing an\n        ``END`` card in the last header. Default is `False`.\n\n    ignore_missing_simple : bool, optional\n        Do not raise an exception when the SIMPLE keyword is missing. Note\n        that io.fits will raise a warning if a SIMPLE card is present but\n        written in a way that does not follow the FITS Standard.\n        Default is `False`.\n\n        .. versionadded:: 4.2\n\n    checksum : bool, str, optional\n        If `True`, verifies that both ``DATASUM`` and ``CHECKSUM`` card values\n        (when present in the HDU header) match the header and data of all HDU's\n        in the file.  Updates to a file that already has a checksum will\n        preserve and update the existing checksums unless this argument is\n        given a value of 'remove', in which case the CHECKSUM and DATASUM\n        values are not checked, and are removed when saving changes to the\n        file. Default is `False`.\n\n    disable_image_compression : bool, optional\n        If `True`, treats compressed image HDU's like normal binary table\n        HDU's.  Default is `False`.\n\n    do_not_scale_image_data : bool, optional\n        If `True`, image data is not scaled using BSCALE/BZERO values\n        when read.  Default is `False`.\n\n    character_as_bytes : bool, optional\n        Whether to return bytes for string columns, otherwise unicode strings\n        are returned, but this does not respect memory mapping and loads the\n        whole column in memory when accessed. Default is `False`.\n\n    ignore_blank : bool, optional\n        If `True`, the BLANK keyword is ignored if present.\n        Default is `False`.\n\n    scale_back : bool, optional\n        If `True`, when saving changes to a file that contained scaled image\n        data, restore the data to the original type and reapply the original\n        BSCALE/BZERO values. This could lead to loss of accuracy if scaling\n        back to integer values after performing floating point operations on\n        the data. Default is `False`.\n\n    output_verify : str\n        Output verification option.  Must be one of ``\"fix\"``,\n        ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n        ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n        ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n        (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n    Returns\n    -------\n    hdulist : `HDUList`\n        `HDUList` containing all of the header data units in the file.\n\n    ","endLoc":176,"header":"def fitsopen(name, mode='readonly', memmap=None, save_backup=False,\n             cache=True, lazy_load_hdus=None, ignore_missing_simple=False,\n             **kwargs)","id":156,"name":"fitsopen","nodeType":"Function","startLoc":37,"text":"def fitsopen(name, mode='readonly', memmap=None, save_backup=False,\n             cache=True, lazy_load_hdus=None, ignore_missing_simple=False,\n             **kwargs):\n    \"\"\"Factory function to open a FITS file and return an `HDUList` object.\n\n    Parameters\n    ----------\n    name : str, file-like or `pathlib.Path`\n        File to be opened.\n\n    mode : str, optional\n        Open mode, 'readonly', 'update', 'append', 'denywrite', or\n        'ostream'. Default is 'readonly'.\n\n        If ``name`` is a file object that is already opened, ``mode`` must\n        match the mode the file was opened with, readonly (rb), update (rb+),\n        append (ab+), ostream (w), denywrite (rb)).\n\n    memmap : bool, optional\n        Is memory mapping to be used? This value is obtained from the\n        configuration item ``astropy.io.fits.Conf.use_memmap``.\n        Default is `True`.\n\n    save_backup : bool, optional\n        If the file was opened in update or append mode, this ensures that\n        a backup of the original file is saved before any changes are flushed.\n        The backup has the same name as the original file with \".bak\" appended.\n        If \"file.bak\" already exists then \"file.bak.1\" is used, and so on.\n        Default is `False`.\n\n    cache : bool, optional\n        If the file name is a URL, `~astropy.utils.data.download_file` is used\n        to open the file.  This specifies whether or not to save the file\n        locally in Astropy's download cache. Default is `True`.\n\n    lazy_load_hdus : bool, optional\n        To avoid reading all the HDUs and headers in a FITS file immediately\n        upon opening.  This is an optimization especially useful for large\n        files, as FITS has no way of determining the number and offsets of all\n        the HDUs in a file without scanning through the file and reading all\n        the headers. Default is `True`.\n\n        To disable lazy loading and read all HDUs immediately (the old\n        behavior) use ``lazy_load_hdus=False``.  This can lead to fewer\n        surprises--for example with lazy loading enabled, ``len(hdul)``\n        can be slow, as it means the entire FITS file needs to be read in\n        order to determine the number of HDUs.  ``lazy_load_hdus=False``\n        ensures that all HDUs have already been loaded after the file has\n        been opened.\n\n        .. versionadded:: 1.3\n\n    uint : bool, optional\n        Interpret signed integer data where ``BZERO`` is the central value and\n        ``BSCALE == 1`` as unsigned integer data.  For example, ``int16`` data\n        with ``BZERO = 32768`` and ``BSCALE = 1`` would be treated as\n        ``uint16`` data. Default is `True` so that the pseudo-unsigned\n        integer convention is assumed.\n\n    ignore_missing_end : bool, optional\n        Do not raise an exception when opening a file that is missing an\n        ``END`` card in the last header. Default is `False`.\n\n    ignore_missing_simple : bool, optional\n        Do not raise an exception when the SIMPLE keyword is missing. Note\n        that io.fits will raise a warning if a SIMPLE card is present but\n        written in a way that does not follow the FITS Standard.\n        Default is `False`.\n\n        .. versionadded:: 4.2\n\n    checksum : bool, str, optional\n        If `True`, verifies that both ``DATASUM`` and ``CHECKSUM`` card values\n        (when present in the HDU header) match the header and data of all HDU's\n        in the file.  Updates to a file that already has a checksum will\n        preserve and update the existing checksums unless this argument is\n        given a value of 'remove', in which case the CHECKSUM and DATASUM\n        values are not checked, and are removed when saving changes to the\n        file. Default is `False`.\n\n    disable_image_compression : bool, optional\n        If `True`, treats compressed image HDU's like normal binary table\n        HDU's.  Default is `False`.\n\n    do_not_scale_image_data : bool, optional\n        If `True`, image data is not scaled using BSCALE/BZERO values\n        when read.  Default is `False`.\n\n    character_as_bytes : bool, optional\n        Whether to return bytes for string columns, otherwise unicode strings\n        are returned, but this does not respect memory mapping and loads the\n        whole column in memory when accessed. Default is `False`.\n\n    ignore_blank : bool, optional\n        If `True`, the BLANK keyword is ignored if present.\n        Default is `False`.\n\n    scale_back : bool, optional\n        If `True`, when saving changes to a file that contained scaled image\n        data, restore the data to the original type and reapply the original\n        BSCALE/BZERO values. This could lead to loss of accuracy if scaling\n        back to integer values after performing floating point operations on\n        the data. Default is `False`.\n\n    output_verify : str\n        Output verification option.  Must be one of ``\"fix\"``,\n        ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n        ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n        ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n        (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n    Returns\n    -------\n    hdulist : `HDUList`\n        `HDUList` containing all of the header data units in the file.\n\n    \"\"\"\n\n    from astropy.io.fits import conf\n\n    if memmap is None:\n        # distinguish between True (kwarg explicitly set)\n        # and None (preference for memmap in config, might be ignored)\n        memmap = None if conf.use_memmap else False\n    else:\n        memmap = bool(memmap)\n\n    if lazy_load_hdus is None:\n        lazy_load_hdus = conf.lazy_load_hdus\n    else:\n        lazy_load_hdus = bool(lazy_load_hdus)\n\n    if 'uint' not in kwargs:\n        kwargs['uint'] = conf.enable_uint\n\n    if not name:\n        raise ValueError(f'Empty filename: {name!r}')\n\n    return HDUList.fromfile(name, mode, memmap, save_backup, cache,\n                            lazy_load_hdus, ignore_missing_simple, **kwargs)"},{"col":0,"comment":"\n    Reference targets for ``astropy:`` and ``astropy-dev:`` are special cases.\n\n    Documentation links in astropy can be set up as intersphinx links so that\n    affiliate packages do not have to override the docstrings when building\n    the docs.\n\n    If we are building the development docs it is a local ref targeting the\n    label ``astropy-dev:<label>``, but for stable docs it should be an\n    intersphinx resolution to the development docs.\n\n    See https://github.com/astropy/astropy/issues/11366\n    ","endLoc":411,"header":"def resolve_astropy_and_dev_reference(app, env, node, contnode)","id":157,"name":"resolve_astropy_and_dev_reference","nodeType":"Function","startLoc":367,"text":"def resolve_astropy_and_dev_reference(app, env, node, contnode):\n    \"\"\"\n    Reference targets for ``astropy:`` and ``astropy-dev:`` are special cases.\n\n    Documentation links in astropy can be set up as intersphinx links so that\n    affiliate packages do not have to override the docstrings when building\n    the docs.\n\n    If we are building the development docs it is a local ref targeting the\n    label ``astropy-dev:<label>``, but for stable docs it should be an\n    intersphinx resolution to the development docs.\n\n    See https://github.com/astropy/astropy/issues/11366\n    \"\"\"\n    # should the node be processed?\n    reftarget = node.get('reftarget')  # str or None\n    if str(reftarget).startswith('astropy:'):\n        # This allows Astropy to use intersphinx links to itself and have\n        # them resolve to local links. Downstream packages will see intersphinx.\n        # TODO! deprecate this if sphinx-doc/sphinx/issues/9169 is implemented.\n        process, replace = True, 'astropy:'\n    elif dev and str(reftarget).startswith('astropy-dev:'):\n        process, replace = True, 'astropy-dev:'\n    else:\n        process, replace = False, ''\n\n    # make link local\n    if process:\n        reftype = node.get('reftype')\n        refdoc = node.get('refdoc', app.env.docname)\n        # convert astropy intersphinx targets to local links.\n        # there are a few types of intersphinx link patters, as described in\n        # https://docs.readthedocs.io/en/stable/guides/intersphinx.html\n        reftarget = reftarget.replace(replace, '')\n        if reftype == \"doc\":  # also need to replace the doc link\n            node.replace_attr(\"reftarget\", reftarget)\n        # Delegate to the ref node's original domain/target (typically :ref:)\n        try:\n            domain = app.env.domains[node['refdomain']]\n            return domain.resolve_xref(app.env, refdoc, app.builder,\n                                       reftype, reftarget, node, contnode)\n        except Exception:\n            pass\n\n        # Otherwise return None which should delegate to intersphinx"},{"id":158,"name":"operations.rst","nodeType":"TextFile","path":"docs/table","text":".. |join| replace:: :func:`~astropy.table.join`\n\n.. _table_operations:\n\nTable Operations\n****************\n\nIn this section we describe high-level operations that can be used to generate\na new table from one or more input tables. This includes:\n\n=======================\n\n.. list-table::\n   :header-rows: 1\n   :widths: 28 52 20\n\n   * - Documentation\n     - Description\n     - Function\n   * - `Grouped operations`_\n     - Group tables and columns by keys\n     - :func:`~astropy.table.Table.group_by`\n   * - `Binning`_\n     - Binning tables\n     - :func:`~astropy.table.Table.group_by`\n   * - `Stack vertically`_\n     - Concatenate input tables along rows\n     - :func:`~astropy.table.vstack`\n   * - `Stack horizontally`_\n     - Concatenate input tables along columns\n     - :func:`~astropy.table.hstack`\n   * - `Join`_\n     - Database-style join of two tables\n     - |join|\n   * - `Unique rows`_\n     - Unique table rows by keys\n     - :func:`~astropy.table.unique`\n   * - `Set difference`_\n     - Set difference of two tables\n     - :func:`~astropy.table.setdiff`\n   * - `Table diff`_\n     - Generic difference of two simple tables\n     - :func:`~astropy.utils.diff.report_diff_values`\n\n\n.. _grouped-operations:\n\nGrouped Operations\n------------------\n\n.. EXAMPLE START: Grouped Operations in Tables\n\nSometimes in a table or table column there are natural groups within the dataset\nfor which it makes sense to compute some derived values. A minimal example is a\nlist of objects with photometry from various observing runs::\n\n  >>> from astropy.table import Table\n  >>> obs = Table.read(\"\"\"name    obs_date    mag_b  mag_v\n  ...                     M31     2012-01-02  17.0   17.5\n  ...                     M31     2012-01-02  17.1   17.4\n  ...                     M101    2012-01-02  15.1   13.5\n  ...                     M82     2012-02-14  16.2   14.5\n  ...                     M31     2012-02-14  16.9   17.3\n  ...                     M82     2012-02-14  15.2   15.5\n  ...                     M101    2012-02-14  15.0   13.6\n  ...                     M82     2012-03-26  15.7   16.5\n  ...                     M101    2012-03-26  15.1   13.5\n  ...                     M101    2012-03-26  14.8   14.3\n  ...                     \"\"\", format='ascii')\n  >>> # Make sure magnitudes are printed with one digit after the decimal point\n  >>> obs['mag_b'].info.format = '{:.1f}'\n  >>> obs['mag_v'].info.format = '{:.1f}'\n\n.. EXAMPLE END\n\nTable Groups\n^^^^^^^^^^^^\n\nNow suppose we want the mean magnitudes for each object. We first group the data\nby the ``name`` column with the :func:`~astropy.table.Table.group_by` method.\nThis returns a new table sorted by ``name`` which has a ``groups`` property\nspecifying the unique values of ``name`` and the corresponding table rows::\n\n  >>> obs_by_name = obs.group_by('name')\n  >>> print(obs_by_name)  # doctest: +SKIP\n  name  obs_date  mag_b mag_v\n  ---- ---------- ----- -----\n  M101 2012-01-02  15.1  13.5  << First group (index=0, key='M101')\n  M101 2012-02-14  15.0  13.6\n  M101 2012-03-26  15.1  13.5\n  M101 2012-03-26  14.8  14.3\n   M31 2012-01-02  17.0  17.5  << Second group (index=4, key='M31')\n   M31 2012-01-02  17.1  17.4\n   M31 2012-02-14  16.9  17.3\n   M82 2012-02-14  16.2  14.5  << Third group (index=7, key='M83')\n   M82 2012-02-14  15.2  15.5\n   M82 2012-03-26  15.7  16.5\n                               << End of groups (index=10)\n  >>> print(obs_by_name.groups.keys)\n  name\n  ----\n  M101\n   M31\n   M82\n  >>> print(obs_by_name.groups.indices)\n  [ 0  4  7 10]\n\nThe ``groups`` property is the portal to all grouped operations with tables and\ncolumns. It defines how the table is grouped via an array of the unique row key\nvalues and the indices of the group boundaries for those key values. The groups\nhere correspond to the row slices ``0:4``, ``4:7``, and ``7:10`` in the\n``obs_by_name`` table.\n\nThe initial argument (``keys``) for the :func:`~astropy.table.Table.group_by`\nfunction can take a number of input data types:\n\n- Single string value with a table column name (as shown above)\n- List of string values with table column names\n- Another |Table| or |Column| with same length as table\n- ``numpy`` structured array with same length as table\n- ``numpy`` homogeneous array with same length as table\n\nIn all cases the corresponding row elements are considered as a :class:`tuple`\nof values which form a key value that is used to sort the original table and\ngenerate the required groups.\n\nAs an example, to get the average magnitudes for each object on each observing\nnight, we would first group the table on both ``name`` and ``obs_date`` as\nfollows::\n\n  >>> print(obs.group_by(['name', 'obs_date']).groups.keys)\n  name  obs_date\n  ---- ----------\n  M101 2012-01-02\n  M101 2012-02-14\n  M101 2012-03-26\n   M31 2012-01-02\n   M31 2012-02-14\n   M82 2012-02-14\n   M82 2012-03-26\n\n\nManipulating Groups\n^^^^^^^^^^^^^^^^^^^\n\n.. EXAMPLE START: Manipulating Groups in Tables\n\nOnce you have applied grouping to a table then you can access the individual\ngroups or subsets of groups. In all cases this returns a new grouped table.\nFor instance, to get the subtable which corresponds to the second group\n(index=1) do::\n\n  >>> print(obs_by_name.groups[1])\n  name  obs_date  mag_b mag_v\n  ---- ---------- ----- -----\n   M31 2012-01-02  17.0  17.5\n   M31 2012-01-02  17.1  17.4\n   M31 2012-02-14  16.9  17.3\n\nTo get the first and second groups together use a :class:`slice`::\n\n  >>> groups01 = obs_by_name.groups[0:2]\n  >>> print(groups01)\n  name  obs_date  mag_b mag_v\n  ---- ---------- ----- -----\n  M101 2012-01-02  15.1  13.5\n  M101 2012-02-14  15.0  13.6\n  M101 2012-03-26  15.1  13.5\n  M101 2012-03-26  14.8  14.3\n   M31 2012-01-02  17.0  17.5\n   M31 2012-01-02  17.1  17.4\n   M31 2012-02-14  16.9  17.3\n  >>> print(groups01.groups.keys)\n  name\n  ----\n  M101\n   M31\n\nYou can also supply a ``numpy`` array of indices or a boolean mask to select\nparticular groups, for example::\n\n  >>> mask = obs_by_name.groups.keys['name'] == 'M101'\n  >>> print(obs_by_name.groups[mask])\n  name  obs_date  mag_b mag_v\n  ---- ---------- ----- -----\n  M101 2012-01-02  15.1  13.5\n  M101 2012-02-14  15.0  13.6\n  M101 2012-03-26  15.1  13.5\n  M101 2012-03-26  14.8  14.3\n\nYou can iterate over the group subtables and corresponding keys with::\n\n  >>> for key, group in zip(obs_by_name.groups.keys, obs_by_name.groups):\n  ...     print(f'****** {key[\"name\"]} *******')\n  ...     print(group)\n  ...     print('')\n  ...\n  ****** M101 *******\n  name  obs_date  mag_b mag_v\n  ---- ---------- ----- -----\n  M101 2012-01-02  15.1  13.5\n  M101 2012-02-14  15.0  13.6\n  M101 2012-03-26  15.1  13.5\n  M101 2012-03-26  14.8  14.3\n  ****** M31 *******\n  name  obs_date  mag_b mag_v\n  ---- ---------- ----- -----\n   M31 2012-01-02  17.0  17.5\n   M31 2012-01-02  17.1  17.4\n   M31 2012-02-14  16.9  17.3\n  ****** M82 *******\n  name  obs_date  mag_b mag_v\n  ---- ---------- ----- -----\n   M82 2012-02-14  16.2  14.5\n   M82 2012-02-14  15.2  15.5\n   M82 2012-03-26  15.7  16.5\n\n.. EXAMPLE END\n\nColumn Groups\n^^^^^^^^^^^^^\n\nLike |Table| objects, |Column| objects can also be grouped for subsequent\nmanipulation with grouped operations. This can apply both to columns within a\n|Table| or bare |Column| objects.\n\nAs for |Table|, the grouping is generated with the\n:func:`~astropy.table.Table.group_by` method. The difference here is that\nthere is no option of providing one or more column names since that\ndoes not make sense for a |Column|.\n\nExamples\n~~~~~~~~\n\n.. EXAMPLE START: Grouping Column Objects in Tables\n\nTo generate grouping in columns::\n\n  >>> from astropy.table import Column\n  >>> import numpy as np\n  >>> c = Column([1, 2, 3, 4, 5, 6], name='a')\n  >>> key_vals = np.array(['foo', 'bar', 'foo', 'foo', 'qux', 'qux'])\n  >>> cg = c.group_by(key_vals)\n\n  >>> for key, group in zip(cg.groups.keys, cg.groups):\n  ...     print(f'****** {key} *******')\n  ...     print(group)\n  ...     print('')\n  ...\n  ****** bar *******\n   a\n  ---\n    2\n  ****** foo *******\n   a\n  ---\n    1\n    3\n    4\n  ****** qux *******\n   a\n  ---\n    5\n    6\n\n.. EXAMPLE END\n\nAggregation\n^^^^^^^^^^^\n\nAggregation is the process of applying a specified reduction function to the\nvalues within each group for each non-key column. This function must accept a\n|ndarray| as the first argument and return a single scalar value. Common\nfunction examples are :func:`numpy.sum`, :func:`numpy.mean`, and\n:func:`numpy.std`.\n\nFor the example grouped table ``obs_by_name`` from above, we compute the group\nmeans with the :meth:`~astropy.table.groups.TableGroups.aggregate` method::\n\n  >>> obs_mean = obs_by_name.groups.aggregate(np.mean)  # doctest: +SHOW_WARNINGS\n  AstropyUserWarning: Cannot aggregate column 'obs_date' with type '<U10'\n  >>> print(obs_mean)\n  name mag_b mag_v\n  ---- ----- -----\n  M101  15.0  13.7\n   M31  17.0  17.4\n   M82  15.7  15.5\n\nIt seems the magnitude values were successfully averaged, but what about the\n:class:`~astropy.utils.exceptions.AstropyUserWarning`? Since the ``obs_date``\ncolumn is a string-type array, the :func:`numpy.mean` function failed and\nraised an exception.  Any time this happens\n:meth:`~astropy.table.groups.TableGroups.aggregate` will issue a warning and\nthen drop that column from the output result. Note that the ``name`` column is\none of the ``keys`` used to determine the grouping so it is automatically\nignored from aggregation.\n\n.. EXAMPLE START: Performing Aggregation on Grouped Tables\n\nFrom a grouped table it is possible to select one or more columns on which\nto perform the aggregation::\n\n  >>> print(obs_by_name['mag_b'].groups.aggregate(np.mean))\n  mag_b\n  -----\n   15.0\n   17.0\n   15.7\n\nThe order of the columns can be specified too::\n\n  >>> print(obs_by_name['name', 'mag_v', 'mag_b'].groups.aggregate(np.mean))\n  name mag_v mag_b\n  ---- ----- -----\n  M101  13.7  15.0\n   M31  17.4  17.0\n   M82  15.5  15.7\n\n\nA single column of data can be aggregated as well::\n\n  >>> c = Column([1, 2, 3, 4, 5, 6], name='a')\n  >>> key_vals = np.array(['foo', 'bar', 'foo', 'foo', 'qux', 'qux'])\n  >>> cg = c.group_by(key_vals)\n  >>> cg_sums = cg.groups.aggregate(np.sum)\n  >>> for key, cg_sum in zip(cg.groups.keys, cg_sums):\n  ...     print(f'Sum for {key} = {cg_sum}')\n  ...\n  Sum for bar = 2\n  Sum for foo = 8\n  Sum for qux = 11\n\n.. EXAMPLE END\n\nIf the specified function has a :meth:`numpy.ufunc.reduceat` method, this will\nbe called instead. This can improve the performance by a factor of 10 to 100\n(or more) for large unmasked tables or columns with many relatively small\ngroups.  It also allows for the use of certain ``numpy`` functions which\nnormally take more than one input array but also work as reduction functions,\nlike `numpy.add`.  The ``numpy`` functions which should take advantage of using\n:meth:`numpy.ufunc.reduceat` include:\n\n- `numpy.add`\n- `numpy.arctan2`\n- `numpy.bitwise_and`\n- `numpy.bitwise_or`\n- `numpy.bitwise_xor`\n- `numpy.copysign`\n- `numpy.divide`\n- `numpy.equal`\n- `numpy.floor_divide`\n- `numpy.fmax`\n- `numpy.fmin`\n- `numpy.fmod`\n- `numpy.greater_equal`\n- `numpy.greater`\n- `numpy.hypot`\n- `numpy.left_shift`\n- `numpy.less_equal`\n- `numpy.less`\n- `numpy.logaddexp2`\n- `numpy.logaddexp`\n- `numpy.logical_and`\n- `numpy.logical_or`\n- `numpy.logical_xor`\n- `numpy.maximum`\n- `numpy.minimum`\n- `numpy.mod`\n- `numpy.multiply`\n- `numpy.not_equal`\n- `numpy.power`\n- `numpy.remainder`\n- `numpy.right_shift`\n- `numpy.subtract`\n- `numpy.true_divide`\n\nIn special cases, :func:`numpy.sum` and :func:`numpy.mean` are substituted with\ntheir respective ``reduceat`` methods.\n\nFiltering\n^^^^^^^^^\n\nTable groups can be filtered by means of the\n:meth:`~astropy.table.groups.TableGroups.filter` method. This is done by\nsupplying a function which is called for each group. The function\nwhich is passed to this method must accept two arguments:\n\n- ``table`` : |Table| object\n- ``key_colnames`` : list of columns in ``table`` used as keys for grouping\n\nIt must then return either `True` or `False`.\n\nExample\n~~~~~~~\n\n.. EXAMPLE START: Filtering Table Groups\n\nThe following will select all table groups with only positive values in the non-\nkey columns::\n\n  >>> def all_positive(table, key_colnames):\n  ...     colnames = [name for name in table.colnames if name not in key_colnames]\n  ...     for colname in colnames:\n  ...         if np.any(table[colname] <= 0):\n  ...             return False\n  ...     return True\n\nAn example of using this function is::\n\n  >>> t = Table.read(\"\"\" a   b    c\n  ...                   -2  7.0   2\n  ...                   -2  5.0   1\n  ...                    1  3.0  -5\n  ...                    1 -2.0  -6\n  ...                    1  1.0   7\n  ...                    0  4.0   4\n  ...                    3  3.0   5\n  ...                    3 -2.0   6\n  ...                    3  1.0   7\"\"\", format='ascii')\n  >>> tg = t.group_by('a')\n  >>> t_positive = tg.groups.filter(all_positive)\n  >>> for group in t_positive.groups:\n  ...     print(group)\n  ...     print('')\n  ...\n   a   b   c\n  --- --- ---\n   -2 7.0   2\n   -2 5.0   1\n  <BLANKLINE>\n   a   b   c\n  --- --- ---\n    0 4.0   4\n\nAs can be seen only the groups with ``a == -2`` and ``a == 0`` have all\npositive values in the non-key columns, so those are the ones that are selected.\n\nLikewise a grouped column can be filtered with the\n:meth:`~astropy.table.groups.ColumnGroups.filter`, method but in this case the\nfiltering function takes only a single argument which is the column group. It\nstill must return either `True` or `False`. For example::\n\n  def all_positive(column):\n      return np.all(column > 0)\n\n.. EXAMPLE END\n\n.. _table_binning:\n\nBinning\n-------\n\nA common tool in analysis is to bin a table based on some reference value.\nExamples:\n\n- Photometry of a binary star in several bands taken over a\n  span of time which should be binned by orbital phase.\n- Reducing the sampling density for a table by combining\n  100 rows at a time.\n- Unevenly sampled historical data which should binned to\n  four points per year.\n\nAll of these examples of binning a table can be accomplished using\n`grouped operations`_. The examples in that section are focused on the\ncase of discrete key values such as the name of a source. In this\nsection we show a concise yet powerful way of applying grouped operations to\naccomplish binning on key values such as time, phase, or row number.\n\nThe common theme in all of these cases is to convert the key value array into\na new float- or int-valued array whose values are identical for rows in the same\noutput bin.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Binning a Table using Grouped Operations\n\nAs an example, we generate a fake light curve::\n\n  >>> year = np.linspace(2000.0, 2010.0, 200)  # 200 observations over 10 years\n  >>> period = 1.811\n  >>> y0 = 2005.2\n  >>> mag = 14.0 + 1.2 * np.sin(2 * np.pi * (year - y0) / period)\n  >>> phase = ((year - y0) / period) % 1.0\n  >>> dat = Table([year, phase, mag], names=['year', 'phase', 'mag'])\n\nNow we make an array that will be used for binning the data by 0.25 year\nintervals::\n\n  >>> year_bin = np.trunc(year / 0.25)\n\nThis has the property that all samples in each 0.25 year bin have the same\nvalue of ``year_bin``. Think of ``year_bin`` as the bin number for ``year``.\nThen do the binning by grouping and immediately aggregating with\n:func:`numpy.mean`.\n\n  >>> dat_grouped = dat.group_by(year_bin)\n  >>> dat_binned = dat_grouped.groups.aggregate(np.mean)\n\nWe can plot the results with ``plt.plot(dat_binned['year'], dat_binned['mag'],\n'.')``. Alternately, we could bin into 10 phase bins::\n\n  >>> phase_bin = np.trunc(phase / 0.1)\n  >>> dat_grouped = dat.group_by(phase_bin)\n  >>> dat_binned = dat_grouped.groups.aggregate(np.mean)\n\nThis time, try plotting with ``plt.plot(dat_binned['phase'],\ndat_binned['mag'])``.\n\n.. EXAMPLE END\n\n.. _stack-vertically:\n\nStack Vertically\n----------------\n\nThe |Table| class supports stacking tables vertically with the\n:func:`~astropy.table.vstack` function. This process is also commonly known as\nconcatenating or appending tables in the row direction. It corresponds roughly\nto the :func:`numpy.vstack` function.\n\nExamples\n^^^^^^^^\n\n.. EXAMPLE START: Stacking (or Concatenating) Tables Vertically\n\nSuppose we have two tables of observations with several column names in\ncommon::\n\n  >>> from astropy.table import Table, vstack\n  >>> obs1 = Table.read(\"\"\"name    obs_date    mag_b  logLx\n  ...                      M31     2012-01-02  17.0   42.5\n  ...                      M82     2012-10-29  16.2   43.5\n  ...                      M101    2012-10-31  15.1   44.5\"\"\", format='ascii')\n\n  >>> obs2 = Table.read(\"\"\"name    obs_date    logLx\n  ...                      NGC3516 2011-11-11  42.1\n  ...                      M31     1999-01-05  43.1\n  ...                      M82     2012-10-30  45.0\"\"\", format='ascii')\n\nNow we can stack these two tables::\n\n  >>> print(vstack([obs1, obs2]))\n    name   obs_date  mag_b logLx\n  ------- ---------- ----- -----\n      M31 2012-01-02  17.0  42.5\n      M82 2012-10-29  16.2  43.5\n     M101 2012-10-31  15.1  44.5\n  NGC3516 2011-11-11    --  42.1\n      M31 1999-01-05    --  43.1\n      M82 2012-10-30    --  45.0\n\nNotice that the ``obs2`` table is missing the ``mag_b`` column, so in the\nstacked output table those values are marked as missing. This is the default\nbehavior and corresponds to ``join_type='outer'``. There are two other allowed\nvalues for the ``join_type`` argument, ``'inner'`` and ``'exact'``::\n\n  >>> print(vstack([obs1, obs2], join_type='inner'))\n    name   obs_date  logLx\n  ------- ---------- -----\n      M31 2012-01-02  42.5\n      M82 2012-10-29  43.5\n     M101 2012-10-31  44.5\n  NGC3516 2011-11-11  42.1\n      M31 1999-01-05  43.1\n      M82 2012-10-30  45.0\n\n  >>> print(vstack([obs1, obs2], join_type='exact'))  # doctest: +IGNORE_EXCEPTION_DETAIL\n  Traceback (most recent call last):\n    ...\n  TableMergeError: Inconsistent columns in input arrays (use 'inner'\n  or 'outer' join_type to allow non-matching columns)\n\nIn the case of ``join_type='inner'``, only the common columns (the intersection)\nare present in the output table. When ``join_type='exact'`` is specified, then\n:func:`~astropy.table.vstack` requires that all of the input tables have\nexactly the same column names.\n\nMore than two tables can be stacked by supplying a longer list of tables::\n\n  >>> obs3 = Table.read(\"\"\"name    obs_date    mag_b  logLx\n  ...                      M45     2012-02-03  15.0   40.5\"\"\", format='ascii')\n  >>> print(vstack([obs1, obs2, obs3]))\n    name   obs_date  mag_b logLx\n  ------- ---------- ----- -----\n      M31 2012-01-02  17.0  42.5\n      M82 2012-10-29  16.2  43.5\n     M101 2012-10-31  15.1  44.5\n  NGC3516 2011-11-11    --  42.1\n      M31 1999-01-05    --  43.1\n      M82 2012-10-30    --  45.0\n      M45 2012-02-03  15.0  40.5\n\nSee also the sections on `Merging metadata`_ and `Merging column attributes`_\nfor details on how these characteristics of the input tables are merged in the\nsingle output table. Note also that you can use a single table |Row| instead of\na full table as one of the inputs.\n\n.. EXAMPLE END\n\n.. _stack-horizontally:\n\nStack Horizontally\n------------------\n\nThe |Table| class supports stacking tables horizontally (in the column-wise\ndirection) with the :func:`~astropy.table.hstack` function. It corresponds\nroughly to the :func:`numpy.hstack` function.\n\nExamples\n^^^^^^^^\n\n.. EXAMPLE START: Stacking (or Concatenating) Tables Horizontally\n\nSuppose we have the following two tables::\n\n  >>> from astropy.table import Table, hstack\n  >>> t1 = Table.read(\"\"\"a   b    c\n  ...                    1   foo  1.4\n  ...                    2   bar  2.1\n  ...                    3   baz  2.8\"\"\", format='ascii')\n  >>> t2 = Table.read(\"\"\"d     e\n  ...                    ham   eggs\n  ...                    spam  toast\"\"\", format='ascii')\n\nNow we can stack these two tables horizontally::\n\n  >>> print(hstack([t1, t2]))\n   a   b   c   d     e\n  --- --- --- ---- -----\n    1 foo 1.4  ham  eggs\n    2 bar 2.1 spam toast\n    3 baz 2.8   --    --\n\nAs with :func:`~astropy.table.vstack`, there is an optional ``join_type``\nargument that can take values ``'inner'``, ``'exact'``, and ``'outer'``. The\ndefault is ``'outer'``, which effectively takes the union of available rows and\nmasks out any missing values. This is illustrated in the example above. The\nother options give the intersection of rows, where ``'exact'`` requires that\nall tables have exactly the same number of rows::\n\n  >>> print(hstack([t1, t2], join_type='inner'))\n   a   b   c   d     e\n  --- --- --- ---- -----\n    1 foo 1.4  ham  eggs\n    2 bar 2.1 spam toast\n\n  >>> print(hstack([t1, t2], join_type='exact'))  # doctest: +IGNORE_EXCEPTION_DETAIL\n  Traceback (most recent call last):\n    ...\n  TableMergeError: Inconsistent number of rows in input arrays (use 'inner' or\n  'outer' join_type to allow non-matching rows)\n\nMore than two tables can be stacked by supplying a longer list of tables. The\nexample below also illustrates the behavior when there is a conflict in the\ninput column names (see the section on `Column renaming`_ for details)::\n\n  >>> t3 = Table.read(\"\"\"a    b\n  ...                    M45  2012-02-03\"\"\", format='ascii')\n  >>> print(hstack([t1, t2, t3]))\n  a_1 b_1  c   d     e   a_3    b_3\n  --- --- --- ---- ----- --- ----------\n    1 foo 1.4  ham  eggs M45 2012-02-03\n    2 bar 2.1 spam toast  --         --\n    3 baz 2.8   --    --  --         --\n\nThe metadata from the input tables is merged by the process described in the\n`Merging metadata`_ section. Note also that you can use a single table |Row|\ninstead of a full table as one of the inputs.\n\n.. EXAMPLE END\n\n.. _stack-depthwise:\n\nStack Depth-Wise\n----------------\n\nThe |Table| class supports stacking columns within tables depth-wise using the\n:func:`~astropy.table.dstack` function. It corresponds roughly to running the\n:func:`numpy.dstack` function on the individual columns matched by name.\n\nExamples\n^^^^^^^^\n\n.. EXAMPLE START: Stacking (or Concatenating) Tables Depth-Wise\n\nSuppose we have tables of data for sources giving information on the enclosed\nsource counts for different PSF fractions::\n\n  >>> from astropy.table import Table, dstack\n  >>> src1 = Table.read(\"\"\"psf_frac  counts\n  ...                      0.10        45\n  ...                      0.50        90\n  ...                      0.90       120\n  ...                      \"\"\", format='ascii')\n\n  >>> src2 = Table.read(\"\"\"psf_frac  counts\n  ...                      0.10       200\n  ...                      0.50       300\n  ...                      0.90       350\n  ...                      \"\"\", format='ascii')\n\nNow we can stack these two tables depth-wise to get a single table with the\ncharacteristics of both sources::\n\n  >>> srcs = dstack([src1, src2])\n  >>> print(srcs)\n  psf_frac [2] counts [2]\n  ------------ ----------\n    0.1 .. 0.1  45 .. 200\n    0.5 .. 0.5  90 .. 300\n    0.9 .. 0.9 120 .. 350\n\nIn this case the counts for the first source are accessible as\n``srcs['counts'][:, 0]``, and likewise the second source counts are\n``srcs['counts'][:, 1]``.\n\nFor this function the length of all input tables must be the same. This\nfunction can accept ``join_type`` and ``metadata_conflicts`` just like the\n:func:`~astropy.table.vstack` function. The ``join_type`` argument controls how\nto handle mismatches in the columns of the input table.\n\nSee also the sections on `Merging metadata`_ and `Merging column attributes`_\nfor details on how these characteristics of the input tables are merged in the\nsingle output table. Note also that you can use a single table |Row| instead of\na full table as one of the inputs.\n\n.. EXAMPLE END\n\n.. _table-join:\n\nJoin\n----\n\nThe |Table| class supports the `database join\n<https://en.wikipedia.org/wiki/Join_(SQL)>`_ operation. This provides a flexible\nand powerful way to combine tables based on the values in one or more key\ncolumns.\n\nExamples\n^^^^^^^^\n\n.. EXAMPLE START: Combining Tables using the Database Join Operation\n\nSuppose we have two tables of observations, the first with B and V magnitudes\nand the second with X-ray luminosities of an overlapping (but not identical)\nsample::\n\n  >>> from astropy.table import Table, join\n  >>> optical = Table.read(\"\"\"name    obs_date    mag_b  mag_v\n  ...                         M31     2012-01-02  17.0   16.0\n  ...                         M82     2012-10-29  16.2   15.2\n  ...                         M101    2012-10-31  15.1   15.5\"\"\", format='ascii')\n  >>> xray = Table.read(\"\"\"   name    obs_date    logLx\n  ...                         NGC3516 2011-11-11  42.1\n  ...                         M31     1999-01-05  43.1\n  ...                         M82     2012-10-29  45.0\"\"\", format='ascii')\n\nThe |join| method allows you to merge these two tables into a single table based\non matching values in the \"key columns\". By default, the key columns are the set\nof columns that are common to both tables. In this case the key columns are\n``name`` and ``obs_date``. We can find all of the observations of the same\nobject on the same date as follows::\n\n  >>> opt_xray = join(optical, xray)\n  >>> print(opt_xray)\n  name  obs_date  mag_b mag_v logLx\n  ---- ---------- ----- ----- -----\n   M82 2012-10-29  16.2  15.2  45.0\n\nWe can perform the match by ``name`` only by providing the ``keys`` argument,\nwhich can be either a single column name or a list of column names::\n\n  >>> print(join(optical, xray, keys='name'))\n  name obs_date_1 mag_b mag_v obs_date_2 logLx\n  ---- ---------- ----- ----- ---------- -----\n   M31 2012-01-02  17.0  16.0 1999-01-05  43.1\n   M82 2012-10-29  16.2  15.2 2012-10-29  45.0\n\nThis output table has all of the observations that have both optical and X-ray\ndata for an object (M31 and M82). Notice that since the ``obs_date`` column\noccurs in both tables, it has been split into two columns, ``obs_date_1`` and\n``obs_date_2``. The values are taken from the \"left\" (``optical``) and \"right\"\n(``xray``) tables, respectively.\n\n.. EXAMPLE END\n\nDifferent Join Options\n^^^^^^^^^^^^^^^^^^^^^^\n\nThe table joins so far are known as \"inner\" joins and represent the strict\nintersection of the two tables on the key columns.\n\n.. EXAMPLE START: Table Join Options\n\nIf you want to make a new table which has *every* row from the left table and\nincludes matching values from the right table when available, this is known as a\nleft join::\n\n  >>> print(join(optical, xray, join_type='left'))\n  name  obs_date  mag_b mag_v logLx\n  ---- ---------- ----- ----- -----\n  M101 2012-10-31  15.1  15.5    --\n   M31 2012-01-02  17.0  16.0    --\n   M82 2012-10-29  16.2  15.2  45.0\n\nTwo of the observations do not have X-ray data, as indicated by the ``--`` in\nthe table. You might be surprised that there is no X-ray data for M31 in the\noutput. Remember that the default matching key includes both ``name`` and\n``obs_date``. Specifying the key as only the ``name`` column gives::\n\n  >>> print(join(optical, xray, join_type='left', keys='name'))\n  name obs_date_1 mag_b mag_v obs_date_2 logLx\n  ---- ---------- ----- ----- ---------- -----\n  M101 2012-10-31  15.1  15.5         --    --\n   M31 2012-01-02  17.0  16.0 1999-01-05  43.1\n   M82 2012-10-29  16.2  15.2 2012-10-29  45.0\n\nLikewise you can construct a new table with every row of the right table and\nmatching left values (when available) using ``join_type='right'``.\n\nTo make a table with the union of rows from both tables do an \"outer\" join::\n\n  >>> print(join(optical, xray, join_type='outer'))\n    name   obs_date  mag_b mag_v logLx\n  ------- ---------- ----- ----- -----\n     M101 2012-10-31  15.1  15.5    --\n      M31 1999-01-05    --    --  43.1\n      M31 2012-01-02  17.0  16.0    --\n      M82 2012-10-29  16.2  15.2  45.0\n  NGC3516 2011-11-11    --    --  42.1\n\nIn all the above cases the output join table will be sorted by the key\ncolumn(s) and in general will not preserve the row order of the input tables.\n\nFinally, you can do a \"Cartesian\" join, which is the Cartesian product of all\navailable rows. In this case there are no key columns (and supplying the\n``keys`` argument is an error)::\n\n  >>> print(join(optical, xray, join_type='cartesian'))\n  name_1 obs_date_1 mag_b mag_v  name_2 obs_date_2 logLx\n  ------ ---------- ----- ----- ------- ---------- -----\n     M31 2012-01-02  17.0  16.0 NGC3516 2011-11-11  42.1\n     M31 2012-01-02  17.0  16.0     M31 1999-01-05  43.1\n     M31 2012-01-02  17.0  16.0     M82 2012-10-29  45.0\n     M82 2012-10-29  16.2  15.2 NGC3516 2011-11-11  42.1\n     M82 2012-10-29  16.2  15.2     M31 1999-01-05  43.1\n     M82 2012-10-29  16.2  15.2     M82 2012-10-29  45.0\n    M101 2012-10-31  15.1  15.5 NGC3516 2011-11-11  42.1\n    M101 2012-10-31  15.1  15.5     M31 1999-01-05  43.1\n    M101 2012-10-31  15.1  15.5     M82 2012-10-29  45.0\n\n.. EXAMPLE END\n\nNon-Identical Key Column Names\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. EXAMPLE START: Joining Tables with Unique Key Column Names\n\nTo use the |join| function with non-identical key column names, use the\n``keys_left`` and ``keys_right`` arguments. In the following example one table\nhas a ``'name'`` column while the other has an ``'obj_id'`` column::\n\n  >>> optical = Table.read(\"\"\"name    obs_date    mag_b  mag_v\n  ...                         M31     2012-01-02  17.0   16.0\n  ...                         M82     2012-10-29  16.2   15.2\n  ...                         M101    2012-10-31  15.1   15.5\"\"\", format='ascii')\n  >>> xray_1 = Table.read(\"\"\"obj_id    obs_date    logLx\n  ...                        NGC3516 2011-11-11  42.1\n  ...                        M31     1999-01-05  43.1\n  ...                        M82     2012-10-29  45.0\"\"\", format='ascii')\n\nIn order to perform a match based on the names of the objects, do the\nfollowing::\n\n  >>> print(join(optical, xray_1, keys_left='name', keys_right='obj_id'))\n  name obs_date_1 mag_b mag_v obj_id obs_date_2 logLx\n  ---- ---------- ----- ----- ------ ---------- -----\n   M31 2012-01-02  17.0  16.0    M31 1999-01-05  43.1\n   M82 2012-10-29  16.2  15.2    M82 2012-10-29  45.0\n\nThe ``keys_left`` and ``keys_right`` arguments can also take a list of column\nnames or even a list of column-like objects. The latter case allows specifying\nthe matching key column values independent of the tables being joined.\n\n.. EXAMPLE END\n\nIdentical Key Values\n^^^^^^^^^^^^^^^^^^^^\n\n.. EXAMPLE START: Joining Tables with Identical Key Values\n\nThe |Table| join operation works even if there are multiple rows with identical\nkey values. For example, the following tables have multiple rows for the column\n``'key'``::\n\n  >>> from astropy.table import Table, join\n  >>> left = Table([[0, 1, 1, 2], ['L1', 'L2', 'L3', 'L4']], names=('key', 'L'))\n  >>> right = Table([[1, 1, 2, 4], ['R1', 'R2', 'R3', 'R4']], names=('key', 'R'))\n  >>> print(left)\n  key  L\n  --- ---\n    0  L1\n    1  L2\n    1  L3\n    2  L4\n  >>> print(right)\n  key  R\n  --- ---\n    1  R1\n    1  R2\n    2  R3\n    4  R4\n\nDoing an outer join on these tables shows that what is really happening is a\n`Cartesian product <https://en.wikipedia.org/wiki/Cartesian_product>`_. For\neach matching key, every combination of the left and right tables is\nrepresented. When there is no match in either the left or right table, the\ncorresponding column values are designated as missing::\n\n  >>> print(join(left, right, join_type='outer'))\n  key  L   R\n  --- --- ---\n    0  L1  --\n    1  L2  R1\n    1  L2  R2\n    1  L3  R1\n    1  L3  R2\n    2  L4  R3\n    4  --  R4\n\nAn inner join is the same but only returns rows where there is a key match in\nboth the left and right tables::\n\n  >>> print(join(left, right, join_type='inner'))\n  key  L   R\n  --- --- ---\n    1  L2  R1\n    1  L2  R2\n    1  L3  R1\n    1  L3  R2\n    2  L4  R3\n\nConflicts in the input table names are handled by the process described in the\nsection on `Column renaming`_. See also the sections on `Merging metadata`_ and\n`Merging column attributes`_ for details on how these characteristics of the\ninput tables are merged in the single output table.\n\n.. EXAMPLE END\n\nMerging Details\n---------------\n\nWhen combining two or more tables there is the need to merge certain\ncharacteristics in the inputs and potentially resolve conflicts. This\nsection describes the process.\n\nColumn Renaming\n^^^^^^^^^^^^^^^\n\nIn cases where the input tables have conflicting column names, there\nis a mechanism to generate unique output column names. There are two\nkeyword arguments that control the renaming behavior:\n\n``table_names``\n    List of strings that provide names for the tables being joined.\n    By default this is ``['1', '2', ...]``, where the numbers correspond to\n    the input tables.\n\n``uniq_col_name``\n    String format specifier with a default value of ``'{col_name}_{table_name}'``.\n\nThis is best understood by example using the ``optical`` and ``xray`` tables\nin the |join| example defined previously::\n\n  >>> print(join(optical, xray, keys='name',\n  ...            table_names=['OPTICAL', 'XRAY'],\n  ...            uniq_col_name='{table_name}_{col_name}'))\n  name OPTICAL_obs_date mag_b mag_v XRAY_obs_date logLx\n  ---- ---------------- ----- ----- ------------- -----\n   M31       2012-01-02  17.0  16.0    1999-01-05  43.1\n   M82       2012-10-29  16.2  15.2    2012-10-29  45.0\n\n.. _merging_metadata:\n\nMerging Metadata\n^^^^^^^^^^^^^^^^\n\n|Table| objects can have associated metadata:\n\n- ``Table.meta``: table-level metadata as an ordered dictionary\n- ``Column.meta``: per-column metadata as an ordered dictionary\n\nThe table operations described here handle the task of merging the metadata in\nthe input tables into a single output structure. Because the metadata can be\narbitrarily complex there is no unique way to do the merge. The current\nimplementation uses a recursive algorithm with four rules:\n\n- :class:`dict` elements are merged by keys.\n- Conflicting :class:`list` or :class:`tuple` elements are concatenated.\n- Conflicting :class:`dict` elements are merged by recursively calling the\n  merge function.\n- Conflicting elements that are not :class:`list`, :class:`tuple`, or\n  :class:`dict` will follow the following rules:\n\n    - If both metadata values are identical, the output is set to this value.\n    - If one of the conflicting metadata values is `None`, the other value is\n      picked.\n    - If both metadata values are different and neither is `None`, the one for\n      the last table in the list is picked.\n\nBy default, a warning is emitted in the last case (both metadata values are not\n`None`). The warning can be silenced or made into an exception using the\n``metadata_conflicts`` argument to :func:`~astropy.table.hstack`,\n:func:`~astropy.table.vstack`, or\n:func:`~astropy.table.join`. The ``metadata_conflicts`` option can be set to:\n\n- ``'silent'`` – no warning is emitted, the value for the last table is silently\n  picked.\n- ``'warn'`` – a warning is emitted, the value for the last table is picked.\n- ``'error'`` – an exception is raised.\n\nThe default strategies for merging metadata can be augmented or customized by\ndefining subclasses of the `~astropy.utils.metadata.MergeStrategy` base class.\nIn most cases you will also use\n:func:`~astropy.utils.metadata.enable_merge_strategies` for enabling the custom\nstrategies. The linked documentation strings provide details.\n\nMerging Column Attributes\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\nIn addition to the table and column ``meta`` attributes, the column attributes\n``unit``, ``format``, and ``description`` are merged by going through the input\ntables in order and taking the last value which is defined (i.e., is not\n`None`).\n\nExample\n~~~~~~~\n\n.. EXAMPLE START: Merging Column Attributes in a Table\n\nTo merge column attributes ``unit``, ``format``, or ``description``::\n\n  >>> from astropy.table import Column, Table, vstack\n  >>> col1 = Column([1], name='a')\n  >>> col2 = Column([2], name='a', unit='cm')\n  >>> col3 = Column([3], name='a', unit='m')\n  >>> t1 = Table([col1])\n  >>> t2 = Table([col2])\n  >>> t3 = Table([col3])\n  >>> out = vstack([t1, t2, t3])  # doctest: +SHOW_WARNINGS\n  MergeConflictWarning: In merged column 'a' the 'unit' attribute does\n  not match (cm != m).  Using m for merged output\n  >>> out['a'].unit\n  Unit(\"m\")\n\nThe rules for merging are the same as for `Merging metadata`_, and the\n``metadata_conflicts`` option also controls the merging of column attributes.\n\n.. EXAMPLE END\n\n.. _astropy-table-join-functions:\n\nJoining Coordinates and Custom Join Functions\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nSource catalogs that have |SkyCoord| coordinate columns can be joined using\ncross-matching of the coordinates with a specified distance threshold. This is\na special case of a more general problem of \"fuzzy\" matching of key column\nvalues, where instead of an exact match we require only an approximate match.\nThis is supported using the ``join_funcs`` argument.\n\n.. warning::\n\n   The coordinate and distance table joins discussed in this section are most\n   applicable in the case where the relevant entries in at least one of the\n   tables are all separated from one another by more than twice the join\n   distance. If this is not satisfied then the join results may be unexpected.\n\n   This is a consequence of the algorithm which effectively finds clusters of\n   nearby points (an \"equivalence class\") and assigns a unique cluster\n   identifier to each entry in both tables. This assumes the join matching\n   function is a transitive relation where ``join_func(A, B)`` and\n   ``join_func(B, C)`` implies ``join_func(A, C)``. With multiple matches on\n   both left and right sides it is possible for the cluster of points having a\n   single cluster identifier to expand in size beyond the distance threshold.\n\n   Users should be especially aware of this issue if additional join keys\n   are provided beyond the ``join_funcs``. The code does not do a \"pre-join\"\n   on the other keys, so the possibility of having overlaps within the distance\n   in both tables is higher.\n\nExample\n~~~~~~~\n\n.. EXAMPLE START: Joining a Table on Coordinates\n\nTo join two tables on a |SkyCoord| key column we use the ``join_funcs`` keyword\nto supply a :class:`dict` of functions that specify how to match a particular\nkey column by name. In the example below we are joining on the ``sc`` column,\nso we provide the following argument::\n\n  join_funcs={'sc': join_skycoord(0.2 * u.deg)}\n\nThis tells |join| to match the ``sc`` key column using the join function\n:func:`~astropy.table.join_skycoord` with a matching distance threshold of 0.2\ndeg. Under the hood this calls\n:meth:`~astropy.coordinates.SkyCoord.search_around_sky` or\n:meth:`~astropy.coordinates.SkyCoord.search_around_3d` to do the\ncross-matching. The default is to use\n:meth:`~astropy.coordinates.SkyCoord.search_around_sky` (angle) matching, but\n:meth:`~astropy.coordinates.SkyCoord.search_around_3d` (length or\ndimensionless) is also available. This is specified using the ``distance_func``\nargument of :func:`~astropy.table.join_skycoord`, which can also be a function\nthat matches the input and output API of\n:meth:`~astropy.coordinates.SkyCoord.search_around_sky`.\n\nNow we show the whole process:\n\n..  doctest-requires:: scipy\n\n  >>> from astropy.coordinates import SkyCoord\n  >>> import astropy.units as u\n  >>> from astropy.table import Table, join, join_skycoord\n\n..  doctest-requires:: scipy\n\n  >>> sc1 = SkyCoord([0, 1, 1.1, 2], [0, 0, 0, 0], unit='deg')\n  >>> sc2 = SkyCoord([1.05, 0.5, 2.1], [0, 0, 0], unit='deg')\n\n..  doctest-requires:: scipy\n\n  >>> t1 = Table([sc1, [0, 1, 2, 3]], names=['sc', 'idx'])\n  >>> t2 = Table([sc2, [0, 1, 2]], names=['sc', 'idx'])\n\n..  doctest-requires:: scipy\n\n  >>> t12 = join(t1, t2, keys='sc', join_funcs={'sc': join_skycoord(0.2 * u.deg)})\n  >>> print(t12)\n  sc_id   sc_1  idx_1   sc_2   idx_2\n        deg,deg       deg,deg\n  ----- ------- ----- -------- -----\n      1 1.0,0.0     1 1.05,0.0     0\n      1 1.1,0.0     2 1.05,0.0     0\n      2 2.0,0.0     3  2.1,0.0     2\n\nThe joined table has matched the sources within 0.2 deg and created a new\ncolumn ``sc_id`` with a unique identifier for each source.\n\n.. EXAMPLE END\n\nYou might be wondering what is happening in the join function defined above,\nespecially if you are interested in defining your own such function. This could\nbe done in order to allow fuzzy word matching of tables, for example joining\ntables of people by name where the names do not always match exactly.\n\nThe first thing to note here is that the :func:`~astropy.table.join_skycoord`\nfunction actually returns a function itself. This allows specifying a variable\nmatch distance via a function enclosure. The requirement of the join function\nis that it accepts two arguments corresponding to the two key columns, and\nreturns a tuple of ``(ids1, ids2)``. These identifiers correspond to the\nidentification of each column entry with a unique matched source.\n\n..  doctest-requires:: scipy\n\n    >>> join_func = join_skycoord(0.2 * u.deg)\n    >>> join_func(sc1, sc2)  # Associate each coordinate with unique source ID\n    (array([3, 1, 1, 2]), array([1, 4, 2]))\n\nIf you would like to write your own fuzzy matching function, we suggest starting\nfrom the source code for :func:`~astropy.table.join_skycoord` or\n:func:`~astropy.table.join_distance`.\n\nJoin on Distance\n~~~~~~~~~~~~~~~~\n\nThe example above focused on joining on a |SkyCoord|, but you can also join on\na generic distance between column values using the\n:func:`~astropy.table.join_distance` join function. This can apply to 1D or 2D\n(vector) columns. This will look very similar to the coordinates example, but\nhere there is a bit more flexibility. The matching is done using\n:class:`scipy.spatial.cKDTree` and\n:meth:`scipy.spatial.cKDTree.query_ball_tree`, and the behavior of these can be\ncontrolled via the ``kdtree_args`` and ``query_args`` arguments, respectively.\n\n.. _unique-rows:\n\nUnique Rows\n-----------\n\nSometimes it makes sense to use only rows with unique key columns or even\nfully unique rows from a table. This can be done using the above described\n:meth:`~astropy.table.Table.group_by` method and ``groups`` attribute, or with\nthe :func:`~astropy.table.unique` convenience function. The\n:func:`~astropy.table.unique` function returns a sorted table containing the\nfirst row for each unique ``keys`` column value. If no ``keys`` is provided, it\nreturns a sorted table containing all of the fully unique rows.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Grouping Unique Rows in Tables\n\nAn example of a situation where you might want to use rows with unique key\ncolumns is a list of objects with photometry from various observing\nruns. Using ``'name'`` as the only ``keys``, it returns with the first\noccurrence of each of the three targets::\n\n  >>> from astropy import table\n  >>> obs = table.Table.read(\"\"\"name    obs_date    mag_b  mag_v\n  ...                           M31     2012-01-02  17.0   17.5\n  ...                           M82     2012-02-14  16.2   14.5\n  ...                           M101    2012-01-02  15.1   13.5\n  ...                           M31     2012-01-02  17.1   17.4\n  ...                           M101    2012-01-02  15.1   13.5\n  ...                           M82     2012-02-14  16.2   14.5\n  ...                           M31     2012-02-14  16.9   17.3\n  ...                           M82     2012-02-14  15.2   15.5\n  ...                           M101    2012-02-14  15.0   13.6\n  ...                           M82     2012-03-26  15.7   16.5\n  ...                           M101    2012-03-26  15.1   13.5\n  ...                           M101    2012-03-26  14.8   14.3\n  ...                           \"\"\", format='ascii')\n  >>> unique_by_name = table.unique(obs, keys='name')\n  >>> print(unique_by_name)\n  name  obs_date  mag_b mag_v\n  ---- ---------- ----- -----\n  M101 2012-01-02  15.1  13.5\n   M31 2012-01-02  17.0  17.5\n   M82 2012-02-14  16.2  14.5\n\nUsing multiple columns as ``keys``::\n\n  >>> unique_by_name_date = table.unique(obs, keys=['name', 'obs_date'])\n  >>> print(unique_by_name_date)\n  name  obs_date  mag_b mag_v\n  ---- ---------- ----- -----\n  M101 2012-01-02  15.1  13.5\n  M101 2012-02-14  15.0  13.6\n  M101 2012-03-26  15.1  13.5\n   M31 2012-01-02  17.0  17.5\n   M31 2012-02-14  16.9  17.3\n   M82 2012-02-14  16.2  14.5\n   M82 2012-03-26  15.7  16.5\n\n.. EXAMPLE END\n\n.. _set-difference:\n\nSet Difference\n--------------\n\nA set difference will tell you the elements that are contained in the first set\nbut not in the other. This concept can be applied to rows of a table by using\nthe :func:`~astropy.table.setdiff` function. You provide the function with two\ninput tables and it will return all rows in the first table which do not occur\nin the second table.\n\nThe optional ``keys`` parameter specifies the names of columns that are used to\nmatch table rows. This can be a subset of the full list of columns, but both\nthe first and second tables must contain all columns specified by ``keys``.\nIf not provided, then ``keys`` defaults to all column names in the first table.\n\nIf no different rows are found, the :func:`~astropy.table.setdiff` function\nwill return an empty table.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Using Set Difference in Tables\n\nThe example below illustrates finding the set difference of two observation\nlists using a common subset of the columns in two tables.::\n\n  >>> from astropy.table import Table, setdiff\n  >>> cat_1 = Table.read(\"\"\"name    obs_date    mag_b  mag_v\n  ...                       M31     2012-01-02  17.0   16.0\n  ...                       M82     2012-10-29  16.2   15.2\n  ...                       M101    2012-10-31  15.1   15.5\"\"\", format='ascii')\n  >>> cat_2 = Table.read(\"\"\"   name    obs_date    logLx\n  ...                          NGC3516 2011-11-11  42.1\n  ...                          M31     2012-01-02  43.1\n  ...                          M82     2012-10-29  45.0\"\"\", format='ascii')\n  >>> sdiff = setdiff(cat_1, cat_2, keys=['name', 'obs_date'])\n  >>> print(sdiff)\n  name  obs_date  mag_b mag_v\n  ---- ---------- ----- -----\n  M101 2012-10-31  15.1  15.5\n\nIn this example there is a column in the first table that is not\npresent in the second table, so the ``keys`` parameter must be used to specify\nthe desired column names.\n\n.. EXAMPLE END\n\n.. _table-diff:\n\nTable Diff\n----------\n\nTo compare two tables, you can use\n:func:`~astropy.utils.diff.report_diff_values`, which would produce a report\nidentical to :ref:`FITS diff <io-fits-differs>`.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Using Table Diff to Compare Tables\n\nThe example below illustrates finding the difference between two tables::\n\n  >>> from astropy.table import Table\n  >>> from astropy.utils.diff import report_diff_values\n  >>> import sys\n  >>> cat_1 = Table.read(\"\"\"name    obs_date    mag_b  mag_v\n  ...                       M31     2012-01-02  17.0   16.0\n  ...                       M82     2012-10-29  16.2   15.2\n  ...                       M101    2012-10-31  15.1   15.5\"\"\", format='ascii')\n  >>> cat_2 = Table.read(\"\"\"name    obs_date    mag_b  mag_v\n  ...                       M31     2012-01-02  17.0   16.5\n  ...                       M82     2012-10-29  16.2   15.2\n  ...                       M101    2012-10-30  15.1   15.5\n  ...                       NEW     2018-05-08   nan    9.0\"\"\", format='ascii')\n  >>> identical = report_diff_values(cat_1, cat_2, fileobj=sys.stdout)\n       name  obs_date  mag_b mag_v\n       ---- ---------- ----- -----\n    a>  M31 2012-01-02  17.0  16.0\n     ?                           ^\n    b>  M31 2012-01-02  17.0  16.5\n     ?                           ^\n        M82 2012-10-29  16.2  15.2\n    a> M101 2012-10-31  15.1  15.5\n     ?               ^\n    b> M101 2012-10-30  15.1  15.5\n     ?               ^\n    b>  NEW 2018-05-08   nan   9.0\n  >>> identical\n  False\n\n.. EXAMPLE END\n"},{"id":159,"name":"masking.rst","nodeType":"TextFile","path":"docs/table","text":".. _masking_and_missing_values:\n\nMasking and Missing Values\n**************************\n\nThe `astropy.table` package provides support for masking and missing values in\na table by using the ``numpy.ma`` `masked array\n<https://numpy.org/doc/stable/reference/maskedarray.html>`_ package to define\nmasked columns and by supporting :ref:`mixin_columns` that provide masking.\nThis allows handling tables with missing or invalid entries in much the same\nmanner as for standard (unmasked) tables. It is useful to be familiar with the\n`masked array documentation\n<https://numpy.org/doc/stable/reference/maskedarray.generic.html>`_\nwhen using masked tables within `astropy.table`.\n\nIn a nutshell, the concept is to define a boolean mask that mirrors\nthe structure of a column data array. Wherever a mask value is\n`True`, the corresponding entry is considered to be missing or invalid.\nOperations involving column or row access and slicing are unchanged.\nThe key difference is that arithmetic or reduction operations involving\ncolumns or column slices follow the rules for `operations\non masked arrays\n<https://numpy.org/doc/stable/reference/maskedarray.generic.html#operations-on-masked-arrays>`_.\n\n.. Note::\n\n   Reduction operations like :func:`numpy.sum` or :func:`numpy.mean` follow the\n   convention of ignoring masked (invalid) values. This differs from\n   the behavior of the floating point ``NaN``, for which the sum of an\n   array including one or more ``NaN's`` will result in ``NaN``.\n\n   For more information see NumPy Enhancement Proposals `24\n   <https://numpy.org/neps/nep-0024-missing-data-2.html>`_, `25\n   <https://numpy.org/neps/nep-0025-missing-data-3.html>`_, and `26\n   <https://numpy.org/neps/nep-0026-missing-data-summary.html>`_.\n\nTable Creation\n==============\n\nA masked table can be created in several ways:\n\n**Create a table with one or more columns as a MaskedColumn object**\n\n  >>> from astropy.table import Table, Column, MaskedColumn\n  >>> a = MaskedColumn([1, 2], name='a', mask=[False, True], dtype='i4')\n  >>> b = Column([3, 4], name='b', dtype='i8')\n  >>> Table([a, b])\n  <Table length=2>\n    a     b\n  int32 int64\n  ----- -----\n      1     3\n     --     4\n\nThe |MaskedColumn| is the masked analog of the |Column| class and provides the\ninterface for creating and manipulating a column of masked data. The\n|MaskedColumn| class inherits from :class:`numpy.ma.MaskedArray`, in contrast\nto |Column| which inherits from |ndarray|. This distinction is the main reason\nthere are different classes for these two cases.\n\nNotice that masked entries in the table output are shown as ``--``.\n\n**Create a table with one or more columns as a NumPy MaskedArray**\n\n  >>> import numpy as np\n  >>> a = np.ma.array([1, 2])\n  >>> b = [3, 4]\n  >>> t = Table([a, b], names=('a', 'b'))\n\n**Create a table from list data containing numpy.ma.masked**\n\nYou can use the `numpy.ma.masked` constant to indicate masked or invalid data::\n\n  >>> a = [1.0, np.ma.masked]\n  >>> b = [np.ma.masked, 'val']\n  >>> Table([a, b], names=('a', 'b'))\n  <Table length=2>\n    a     b\n  float64 str3\n  ------- ----\n      1.0   --\n      --  val\n\nInitializing from lists with embedded `numpy.ma.masked` elements is\nconsiderably slower than using :func:`numpy.ma.array` or |MaskedColumn|\ndirectly, so if performance is a concern you should use the latter methods if\npossible.\n\n**Add a MaskedColumn object to an existing table**\n\n  >>> t = Table([[1, 2]], names=['a'])\n  >>> b = MaskedColumn([3, 4], mask=[True, False])\n  >>> t['b'] = b\n\n**Add a new row to an existing table and specify a mask argument**\n\n  >>> a = Column([1, 2], name='a')\n  >>> b = Column([3, 4], name='b')\n  >>> t = Table([a, b])\n  >>> t.add_row([3, 6], mask=[True, False])\n\n**Create a new table object and specify masked=True**\n\nIf ``masked=True`` is provided when creating the table then every column will\nbe created as a |MaskedColumn|, and new columns will always be added as a\n|MaskedColumn|.\n\n  >>> Table([(1, 2), (3, 4)], names=('a', 'b'), masked=True, dtype=('i4', 'i8'))\n  <Table masked=True length=2>\n    a     b\n  int32 int64\n  ----- -----\n      1     3\n      2     4\n\n**Convert an existing table to a masked table**\n\n  >>> t = Table([[1, 2], ['x', 'y']])  # standard (unmasked) table\n  >>> t = Table(t, masked=True, copy=False)  # convert to masked table\n\nThis operation will convert every |Column| to |MaskedColumn| and ensure that any\nsubsequently added columns are masked.\n\nTable Access\n============\n\nNearly all of the standard methods for accessing and modifying data\ncolumns, rows, and individual elements also apply to masked tables.\n\nThere is a difference however regarding the |Row| objects that are obtained by\nindexing a single row of a table. For standard tables, two such rows can be\ncompared for equality, but for masked tables this comparison will produce an\nexception::\n\n  >>> t[0] == t[1]\n  Traceback (most recent call last):\n  ...\n  ValueError: Unable to compare rows for masked table due to numpy.ma bug\n\nMasking and Filling\n===================\n\nBoth the |Table| and |MaskedColumn| classes provide attributes and methods to\nsupport manipulating tables with missing or invalid data.\n\nMask\n----\n\n.. EXAMPLE START: Manipulating Tables with Missing Data using Masks\n\nThe mask for a column can be viewed and modified via the ``mask`` attribute::\n\n  >>> t = Table([(1, 2), (3, 4)], names=('a', 'b'), masked=True)\n  >>> t['a'].mask = [False, True]  # Modify column mask (boolean array)\n  >>> t['b'].mask = [True, False]  # Modify column mask (boolean array)\n  >>> print(t)\n   a   b\n  --- ---\n    1  --\n   --   4\n\nMasked entries are shown as ``--`` when the table is printed. You can\nview the mask directly, either at the column or table level::\n\n  >>> t['a'].mask\n  array([False,  True]...)\n\n  >>> t.mask\n  <Table length=2>\n    a     b\n   bool  bool\n  ----- -----\n  False  True\n   True False\n\nTo get the indices of masked elements, use an expression like::\n\n  >>> t['a'].mask.nonzero()[0]  # doctest: +SKIP\n  array([1])\n\n.. EXAMPLE END\n\nFilling\n-------\n\n.. EXAMPLE START: Manipulating Tables with Missing Data by Filling Masked Values\n\nThe entries which are masked (i.e., missing or invalid) can be replaced with\nspecified fill values. Filling a |MaskedColumn| produces a |Column|. Each\ncolumn in a masked table has a ``fill_value`` attribute that specifies the\ndefault fill value for that column. To perform the actual replacement operation\nthe :meth:`~astropy.table.Table.filled` method is called. This takes an\noptional argument which can override the default column ``fill_value``\nattribute.\n::\n\n  >>> t['a'].fill_value = -99\n  >>> t['b'].fill_value = 33\n\n  >>> print(t.filled())\n   a   b\n  --- ---\n    1  33\n  -99   4\n\n  >>> print(t['a'].filled())\n   a\n  ---\n    1\n  -99\n\n  >>> print(t['a'].filled(999))\n   a\n  ---\n    1\n  999\n\n  >>> print(t.filled(1000))\n   a    b\n  ---- ----\n     1 1000\n  1000    4\n\n.. EXAMPLE END\n"},{"id":160,"name":"pandas.rst","nodeType":"TextFile","path":"docs/table","text":".. doctest-skip-all\n\n.. _pandas:\n\nInterfacing with the Pandas Package\n***********************************\n\nThe `pandas <https://pandas.pydata.org/>`__ package is a package for high\nperformance data analysis of table-like structures that is complementary to the\n:class:`~astropy.table.Table` class in ``astropy``.\n\nIn order to exchange data between the :class:`~astropy.table.Table` class and\nthe :class:`pandas.DataFrame` class (the main data structure in ``pandas``),\nthe |Table| class includes two methods, :meth:`~astropy.table.Table.to_pandas`\nand :meth:`~astropy.table.Table.from_pandas`.\n\nExample\n-------\n\n.. EXAMPLE START: Interfacing Tables with the Pandas Package\n\nTo demonstrate, we can create a minimal table::\n\n    >>> from astropy.table import Table\n    >>> t = Table()\n    >>> t['a'] = [1, 2, 3, 4]\n    >>> t['b'] = ['a', 'b', 'c', 'd']\n\nWhich we can then convert to a :class:`~pandas.DataFrame`::\n\n    >>> df = t.to_pandas()\n    >>> df\n       a  b\n    0  1  a\n    1  2  b\n    2  3  c\n    3  4  d\n    >>> type(df)\n    <class 'pandas.core.frame.DataFrame'>\n\nIt is also possible to create a table from a :class:`~pandas.DataFrame`::\n\n    >>> t2 = Table.from_pandas(df)\n    >>> t2\n    <Table length=4>\n      a      b\n    int64 string8\n    ----- -------\n        1       a\n        2       b\n        3       c\n        4       d\n\n.. EXAMPLE END\n\nThe conversions to and from ``pandas`` are subject to the following caveats:\n\n* The :class:`~pandas.DataFrame` structure does not support multidimensional\n  columns, so |Table| objects with multidimensional columns cannot be converted\n  to :class:`~pandas.DataFrame`.\n\n* Masked tables can be converted, but in columns of ``float`` or string values\n  the resulting :class:`~pandas.DataFrame` uses `numpy.nan` to indicate missing\n  values. For ``float`` columns, the conversion therefore does not necessarily\n  round-trip if converting back to an ``astropy`` table, because the\n  distinction between `numpy.nan` and masked values is lost. This is not a\n  problem for integer columns.\n\n* Tables with :ref:`mixin_columns` can not be converted.\n"},{"id":161,"name":"access_table.rst","nodeType":"TextFile","path":"docs/table","text":".. _access_table:\n\nAccessing a Table\n*****************\n\nAccessing table properties and data is generally consistent with the basic\ninterface for ``numpy`` `structured arrays\n<https://numpy.org/doc/stable/user/basics.rec.html>`_.\n\nBasics\n======\n\nFor a quick overview, the code below shows the basics of accessing table data.\nWhere relevant, there is a comment about what sort of object is returned.\nExcept where noted, table access returns objects that can be modified in order\nto update the original table data or properties. See also the section on\n:ref:`copy_versus_reference` to learn more about this topic.\n\n**Make a table**\n::\n\n  from astropy.table import Table\n  import numpy as np\n\n  arr = np.arange(15).reshape(5, 3)\n  t = Table(arr, names=('a', 'b', 'c'), meta={'keywords': {'key1': 'val1'}})\n\n**Table properties**\n::\n\n  t.columns   # Dict of table columns (access by column name, index, or slice)\n  t.colnames  # List of column names\n  t.meta      # Dict of meta-data\n  len(t)      # Number of table rows\n\n**Access table data**\n::\n\n  t['a']       # Column 'a'\n  t['a'][1]    # Row 1 of column 'a'\n  t[1]         # Row 1\n  t[1]['a']    # Column 'a' of row 1\n  t[2:5]       # Table object with rows 2:5\n  t[[1, 3, 4]]  # Table object with rows 1, 3, 4 (copy)\n  t[np.array([1, 3, 4])]  # Table object with rows 1, 3, 4 (copy)\n  t[[]]        # Same table definition but with no rows of data\n  t['a', 'c']  # Table with cols 'a', 'c' (copy)\n  dat = np.array(t)  # Copy table data to numpy structured array object\n  t['a'].quantity  # an astropy.units.Quantity for Column 'a'\n  t['a'].to('km')  # an astropy.units.Quantity for Column 'a' in units of kilometers\n  t.columns[1]  # Column 1 (which is the 'b' column)\n  t.columns[0:2]  # New table with columns 0 and 1\n\n.. Note::\n   Although they appear nearly equivalent, there is a factor of two performance\n   difference between ``t[1]['a']`` (slower, because an intermediate |Row|\n   object gets created) versus ``t['a'][1]`` (faster). Always use the latter\n   when possible.\n\n**Print table or column**\n::\n\n  print(t)     # Print formatted version of table to the screen\n  t.pprint()   # Same as above\n  t.pprint(show_unit=True)  # Show column unit\n  t.pprint(show_name=False)  # Do not show column names\n  t.pprint_all() # Print full table no matter how long / wide it is (same as t.pprint(max_lines=-1, max_width=-1))\n\n  t.more()  # Interactively scroll through table like Unix \"more\"\n\n  print(t['a'])    # Formatted column values\n  t['a'].pprint()  # Same as above, with same options as Table.pprint()\n  t['a'].more()    # Interactively scroll through column\n  t['a', 'c'].pprint()  # Print columns 'a' and 'c' of table\n\n  lines = t.pformat()  # Formatted table as a list of lines (same options as pprint)\n  lines = t['a'].pformat()  # Formatted column values as a list\n\n\nDetails\n=======\n\nFor all of the following examples it is assumed that the table has been created\nas follows::\n\n  >>> from astropy.table import Table, Column\n  >>> import numpy as np\n  >>> import astropy.units as u\n\n  >>> arr = np.arange(15, dtype=np.int32).reshape(5, 3)\n  >>> t = Table(arr, names=('a', 'b', 'c'), meta={'keywords': {'key1': 'val1'}})\n  >>> t['a'].format = \"{:.3f}\"  # print with 3 digits after decimal point\n  >>> t['a'].unit = 'm sec^-1'\n  >>> t['a'].description = 'unladen swallow velocity'\n  >>> print(t)\n       a      b   c\n    m sec^-1\n    -------- --- ---\n       0.000   1   2\n       3.000   4   5\n       6.000   7   8\n       9.000  10  11\n      12.000  13  14\n\n.. Note::\n\n   In the example above the ``format``, ``unit``, and ``description``\n   attributes of the |Column| were set directly. For :ref:`mixin_columns` like\n   |Quantity| you must set via the ``info`` attribute, for example,\n   ``t['a'].info.format = \"{:.3f}\"``. You can use the ``info`` attribute with\n   |Column| objects as well, so the general solution that works with any table\n   column is to set via the ``info`` attribute. See :ref:`mixin_attributes` for\n   more information.\n\n.. _table-summary-information:\n\nSummary Information\n-------------------\n\nYou can get summary information about the table as follows::\n\n  >>> t.info\n  <Table length=5>\n  name dtype   unit   format       description\n  ---- ----- -------- ------ ------------------------\n     a int32 m sec^-1 {:.3f} unladen swallow velocity\n     b int32\n     c int32\n\nIf called as a function then you can supply an ``option`` that specifies\nthe type of information to return. The built-in ``option`` choices are\n``'attributes'`` (column attributes, which is the default) or ``'stats'``\n(basic column statistics). The ``option`` argument can also be a list\nof available options::\n\n  >>> t.info('stats')  # doctest: +FLOAT_CMP\n  <Table length=5>\n  name mean   std   min max\n  ---- ---- ------- --- ---\n     a    6 4.24264   0  12\n     b    7 4.24264   1  13\n     c    8 4.24264   2  14\n\n  >>> t.info(['attributes', 'stats'])  # doctest: +FLOAT_CMP\n  <Table length=5>\n  name dtype   unit   format       description        mean   std   min max\n  ---- ----- -------- ------ ------------------------ ---- ------- --- ---\n     a int32 m sec^-1 {:.3f} unladen swallow velocity    6 4.24264   0  12\n     b int32                                             7 4.24264   1  13\n     c int32                                             8 4.24264   2  14\n\nColumns also have an ``info`` property that has the same behavior and\narguments, but provides information about a single column::\n\n  >>> t['a'].info\n  name = a\n  dtype = int32\n  unit = m sec^-1\n  format = {:.3f}\n  description = unladen swallow velocity\n  class = Column\n  n_bad = 0\n  length = 5\n\n  >>> t['a'].info('stats')  # doctest: +FLOAT_CMP\n  name = a\n  mean = 6\n  std = 4.24264\n  min = 0\n  max = 12\n  n_bad = 0\n  length = 5\n\n\nAccessing Properties\n--------------------\n\nThe code below shows accessing the table columns as a |TableColumns| object,\ngetting the column names, table metadata, and number of table rows. The table\nmetadata is an `~collections.OrderedDict` by default.\n::\n\n  >>> t.columns\n  <TableColumns names=('a','b','c')>\n\n  >>> t.colnames\n  ['a', 'b', 'c']\n\n  >>> t.meta  # Dict of meta-data\n  {'keywords': {'key1': 'val1'}}\n\n  >>> len(t)\n  5\n\n\nAccessing Data\n--------------\n\nAs expected you can access a table column by name and get an element from that\ncolumn with a numerical index::\n\n  >>> t['a']  # Column 'a'\n  <Column name='a' dtype='int32' unit='m sec^-1' format='{:.3f}' description='unladen swallow velocity' length=5>\n   0.000\n   3.000\n   6.000\n   9.000\n  12.000\n\n\n  >>> t['a'][1]  # Row 1 of column 'a'\n  3\n\nWhen a table column is printed, it is formatted according to the ``format``\nattribute (see :ref:`table_format_string`). Note the difference between the\ncolumn representation above and how it appears via ``print()`` or ``str()``::\n\n  >>> print(t['a'])\n     a\n  m sec^-1\n  --------\n     0.000\n     3.000\n     6.000\n     9.000\n    12.000\n\nLikewise a table row and a column from that row can be selected::\n\n  >>> t[1]  # Row object corresponding to row 1\n  <Row index=1>\n     a       b     c\n  m sec^-1\n   int32   int32 int32\n  -------- ----- -----\n     3.000     4     5\n\n  >>> t[1]['a']  # Column 'a' of row 1\n  3\n\nA |Row| object has the same columns and metadata as its parent table::\n\n  >>> t[1].columns\n  <TableColumns names=('a','b','c')>\n\n  >>> t[1].meta\n  {'keywords': {'key1': 'val1'}}\n\nSlicing a table returns a new table object with references to the original\ndata within the slice region (See :ref:`copy_versus_reference`). The table\nmetadata and column definitions are copied.\n::\n\n  >>> t[2:5]  # Table object with rows 2:5 (reference)\n  <Table length=3>\n     a       b     c\n  m sec^-1\n   int32   int32 int32\n  -------- ----- -----\n     6.000     7     8\n     9.000    10    11\n    12.000    13    14\n\nIt is possible to select table rows with an array of indexes or by specifying\nmultiple column names. This returns a copy of the original table for the\nselected rows or columns.  ::\n\n  >>> print(t[[1, 3, 4]])  # Table object with rows 1, 3, 4 (copy)\n       a      b   c\n    m sec^-1\n    -------- --- ---\n       3.000   4   5\n       9.000  10  11\n      12.000  13  14\n\n\n  >>> print(t[np.array([1, 3, 4])])  # Table object with rows 1, 3, 4 (copy)\n       a      b   c\n    m sec^-1\n    -------- --- ---\n       3.000   4   5\n       9.000  10  11\n      12.000  13  14\n\n\n  >>> print(t['a', 'c'])  # or t[['a', 'c']] or t[('a', 'c')]\n  ...                     # Table with cols 'a', 'c' (copy)\n       a      c\n    m sec^-1\n    -------- ---\n       0.000   2\n       3.000   5\n       6.000   8\n       9.000  11\n      12.000  14\n\nWe can select rows from a table using conditionals to create boolean masks. A\ntable indexed with a boolean array will only return rows where the mask array\nelement is `True`. Different conditionals can be combined using the bitwise\noperators.  ::\n\n  >>> mask = (t['a'] > 4) & (t['b'] > 8)  # Table rows where column a > 4\n  >>> print(t[mask])                      # and b > 8\n  ...\n       a      b   c\n    m sec^-1\n    -------- --- ---\n       9.000  10  11\n      12.000  13  14\n\nFinally, you can access the underlying table data as a native ``numpy``\nstructured array by creating a copy or reference with :func:`numpy.array`::\n\n  >>> data = np.array(t)  # copy of data in t as a structured array\n  >>> data = np.array(t, copy=False)  # reference to data in t\n\n\nTable Equality\n--------------\n\nWe can check table data equality using two different methods:\n\n- The ``==`` comparison operator. This returns a `True` or `False` for\n  each row if the *entire row* matches. This is the same as the behavior of\n  ``numpy`` structured arrays.\n- Table :meth:`~astropy.table.Table.values_equal` to compare table values\n  element-wise. This returns a boolean `True` or `False` for each table\n  *element*, so you get a `~astropy.table.Table` of values.\n\nExamples\n^^^^^^^^\n\n.. EXAMPLE START: Checking Table Equality\n\nTo check table equality::\n\n  >>> t1 = Table(rows=[[1, 2, 3],\n  ...                  [4, 5, 6],\n  ...                  [7, 7, 9]], names=['a', 'b', 'c'])\n  >>> t2 = Table(rows=[[1, 2, -1],\n  ...                  [4, -1, 6],\n  ...                  [7, 7, 9]], names=['a', 'b', 'c'])\n\n  >>> t1 == t2\n  array([False, False,  True])\n\n  >>> t1.values_equal(t2)  # Compare to another table\n  <Table length=3>\n   a     b     c\n  bool  bool  bool\n  ---- ----- -----\n  True  True False\n  True False  True\n  True  True  True\n\n  >>> t1.values_equal([2, 4, 7])  # Compare to an array column-wise\n  <Table length=3>\n    a     b     c\n   bool  bool  bool\n  ----- ----- -----\n  False  True False\n   True False False\n   True  True False\n\n  >>> t1.values_equal(7)  # Compare to a scalar column-wise\n  <Table length=3>\n    a     b     c\n   bool  bool  bool\n  ----- ----- -----\n  False False False\n  False False False\n   True  True False\n\n.. EXAMPLE END\n\nFormatted Printing\n------------------\n\nThe values in a table or column can be printed or retrieved as a formatted\ntable using one of several methods:\n\n- `print()` function.\n- `Table.more() <astropy.table.Table.more>` or `Column.more()\n  <astropy.table.Column.more>` methods to interactively scroll through\n  table values.\n- `Table.pprint() <astropy.table.Table.pprint>` or `Column.pprint()\n  <astropy.table.Column.pprint>` methods to print a formatted version of\n  the table to the screen.\n- `Table.pformat() <astropy.table.Table.pformat>` or `Column.pformat()\n  <astropy.table.Column.pformat>` methods to return the formatted table\n  or column as a list of fixed-width strings. This could be used as a quick way\n  to save a table.\n\nThese methods use :ref:`table_format_string`\nif available and strive to make the output readable.\nBy default, table and column printing will\nnot print the table larger than the available interactive screen size. If the\nscreen size cannot be determined (in a non-interactive environment or on\nWindows) then a default size of 25 rows by 80 columns is used. If a table is\ntoo large, then rows and/or columns are cut from the middle so it fits.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Printing Formatted Tables\n\nTo print a formatted table::\n\n  >>> arr = np.arange(3000).reshape(100, 30)  # 100 rows x 30 columns array\n  >>> t = Table(arr)\n  >>> print(t)\n  col0 col1 col2 col3 col4 col5 col6 ... col23 col24 col25 col26 col27 col28 col29\n  ---- ---- ---- ---- ---- ---- ---- ... ----- ----- ----- ----- ----- ----- -----\n     0    1    2    3    4    5    6 ...    23    24    25    26    27    28    29\n    30   31   32   33   34   35   36 ...    53    54    55    56    57    58    59\n    60   61   62   63   64   65   66 ...    83    84    85    86    87    88    89\n    90   91   92   93   94   95   96 ...   113   114   115   116   117   118   119\n   120  121  122  123  124  125  126 ...   143   144   145   146   147   148   149\n   150  151  152  153  154  155  156 ...   173   174   175   176   177   178   179\n   180  181  182  183  184  185  186 ...   203   204   205   206   207   208   209\n   210  211  212  213  214  215  216 ...   233   234   235   236   237   238   239\n   240  241  242  243  244  245  246 ...   263   264   265   266   267   268   269\n   270  271  272  273  274  275  276 ...   293   294   295   296   297   298   299\n   ...  ...  ...  ...  ...  ...  ... ...   ...   ...   ...   ...   ...   ...   ...\n  2670 2671 2672 2673 2674 2675 2676 ...  2693  2694  2695  2696  2697  2698  2699\n  2700 2701 2702 2703 2704 2705 2706 ...  2723  2724  2725  2726  2727  2728  2729\n  2730 2731 2732 2733 2734 2735 2736 ...  2753  2754  2755  2756  2757  2758  2759\n  2760 2761 2762 2763 2764 2765 2766 ...  2783  2784  2785  2786  2787  2788  2789\n  2790 2791 2792 2793 2794 2795 2796 ...  2813  2814  2815  2816  2817  2818  2819\n  2820 2821 2822 2823 2824 2825 2826 ...  2843  2844  2845  2846  2847  2848  2849\n  2850 2851 2852 2853 2854 2855 2856 ...  2873  2874  2875  2876  2877  2878  2879\n  2880 2881 2882 2883 2884 2885 2886 ...  2903  2904  2905  2906  2907  2908  2909\n  2910 2911 2912 2913 2914 2915 2916 ...  2933  2934  2935  2936  2937  2938  2939\n  2940 2941 2942 2943 2944 2945 2946 ...  2963  2964  2965  2966  2967  2968  2969\n  2970 2971 2972 2973 2974 2975 2976 ...  2993  2994  2995  2996  2997  2998  2999\n  Length = 100 rows\n\n.. EXAMPLE END\n\nmore() method\n^^^^^^^^^^^^^\n\nIn order to browse all rows of a table or column use the `Table.more()\n<astropy.table.Table.more>` or `Column.more() <astropy.table.Column.more>`\nmethods. These let you interactively scroll through the rows much like the Unix\n``more`` command. Once part of the table or column is displayed the supported\nnavigation keys are:\n\n|  **f, space** : forward one page\n|  **b** : back one page\n|  **r** : refresh same page\n|  **n** : next row\n|  **p** : previous row\n|  **<** : go to beginning\n|  **>** : go to end\n|  **q** : quit browsing\n|  **h** : print this help\n\npprint() method\n^^^^^^^^^^^^^^^\n\nIn order to fully control the print output use the `Table.pprint()\n<astropy.table.Table.pprint>` or `Column.pprint()\n<astropy.table.Column.pprint>` methods. These have keyword arguments\n``max_lines``, ``max_width``, ``show_name``, and ``show_unit``, with meanings\nas shown below::\n\n  >>> arr = np.arange(3000, dtype=float).reshape(100, 30)\n  >>> t = Table(arr)\n  >>> t['col0'].format = '%e'\n  >>> t['col0'].unit = 'km**2'\n  >>> t['col29'].unit = 'kg sec m**-2'\n\n  >>> t.pprint(max_lines=8, max_width=40)\n      col0     ...    col29\n      km2      ... kg sec m**-2\n  ------------ ... ------------\n  0.000000e+00 ...         29.0\n           ... ...          ...\n  2.940000e+03 ...       2969.0\n  2.970000e+03 ...       2999.0\n  Length = 100 rows\n\n  >>> t.pprint(max_lines=8, max_width=40, show_unit=False)\n      col0     ... col29\n  ------------ ... ------\n  0.000000e+00 ...   29.0\n           ... ...    ...\n  2.940000e+03 ... 2969.0\n  2.970000e+03 ... 2999.0\n  Length = 100 rows\n\n  >>> t.pprint(max_lines=8, max_width=40, show_name=False)\n      km2      ... kg sec m**-2\n  ------------ ... ------------\n  0.000000e+00 ...         29.0\n  3.000000e+01 ...         59.0\n           ... ...          ...\n  2.940000e+03 ...       2969.0\n  2.970000e+03 ...       2999.0\n  Length = 100 rows\n\nIn order to force printing all values regardless of the output length or width\nuse :meth:`~astropy.table.Table.pprint_all`, which is equivalent to setting\n``max_lines`` and ``max_width`` to ``-1`` in :meth:`~astropy.table.Table.pprint`.\n:meth:`~astropy.table.Table.pprint_all` takes the same arguments as :meth:`~astropy.table.Table.pprint`.\nFor the wide table in this example you see six lines of wrapped output like the\nfollowing::\n\n  >>> t.pprint_all(max_lines=8)  # doctest: +SKIP\n      col0         col1     col2   col3   col4   col5   col6   col7   col8   col9  col10  col11  col12  col13  col14  col15  col16  col17  col18  col19  col20  col21  col22  col23  col24  col25  col26  col27  col28     col29\n      km2                                                                                                                                                                                                               kg sec m**-2\n  ------------ ----------- ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------------\n  0.000000e+00    1.000000    2.0    3.0    4.0    5.0    6.0    7.0    8.0    9.0   10.0   11.0   12.0   13.0   14.0   15.0   16.0   17.0   18.0   19.0   20.0   21.0   22.0   23.0   24.0   25.0   26.0   27.0   28.0         29.0\n           ...         ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...          ...\n  2.940000e+03 2941.000000 2942.0 2943.0 2944.0 2945.0 2946.0 2947.0 2948.0 2949.0 2950.0 2951.0 2952.0 2953.0 2954.0 2955.0 2956.0 2957.0 2958.0 2959.0 2960.0 2961.0 2962.0 2963.0 2964.0 2965.0 2966.0 2967.0 2968.0       2969.0\n  2.970000e+03 2971.000000 2972.0 2973.0 2974.0 2975.0 2976.0 2977.0 2978.0 2979.0 2980.0 2981.0 2982.0 2983.0 2984.0 2985.0 2986.0 2987.0 2988.0 2989.0 2990.0 2991.0 2992.0 2993.0 2994.0 2995.0 2996.0 2997.0 2998.0       2999.0\n  Length = 100 rows\n\nFor columns, the syntax and behavior of :func:`~astropy.table.Column.pprint` is\nthe same except that there is no ``max_width`` keyword argument::\n\n  >>> t['col3'].pprint(max_lines=8)\n   col3\n  ------\n     3.0\n    33.0\n     ...\n  2943.0\n  2973.0\n  Length = 100 rows\n\nColumn alignment\n^^^^^^^^^^^^^^^^\n\nIndividual columns have the ability to be aligned in a number of different\nways for an enhanced viewing experience::\n\n  >>> t1 = Table()\n  >>> t1['long column name 1'] = [1, 2, 3]\n  >>> t1['long column name 2'] = [4, 5, 6]\n  >>> t1['long column name 3'] = [7, 8, 9]\n  >>> t1['long column name 4'] = [700000, 800000, 900000]\n  >>> t1['long column name 2'].info.format = '<'\n  >>> t1['long column name 3'].info.format = '0='\n  >>> t1['long column name 4'].info.format = '^'\n  >>> t1.pprint()\n   long column name 1 long column name 2 long column name 3 long column name 4\n  ------------------ ------------------ ------------------ ------------------\n                   1 4                  000000000000000007       700000\n                   2 5                  000000000000000008       800000\n                   3 6                  000000000000000009       900000\n\nConveniently, alignment can be handled another way — by passing a list to the\nkeyword argument ``align``::\n\n  >>> t1 = Table()\n  >>> t1['column1'] = [1, 2, 3]\n  >>> t1['column2'] = [2, 4, 6]\n  >>> t1.pprint(align=['<', '0='])\n  column1 column2\n  ------- -------\n  1       0000002\n  2       0000004\n  3       0000006\n\nIt is also possible to set the alignment of all columns with a single\nstring value::\n\n  >>> t1.pprint(align='^')\n  column1 column2\n  ------- -------\n     1       2\n     2       4\n     3       6\n\nThe fill character for justification can be set as a prefix to the\nalignment character (see `Format Specification Mini-Language\n<https://docs.python.org/3/library/string.html#format-specification-mini-language>`_\nfor additional explanation). This can be done both in the ``align`` argument\nand in the column ``format`` attribute. Note the interesting interaction below::\n\n  >>> t1 = Table([[1.0, 2.0], [1, 2]], names=['column1', 'column2'])\n\n  >>> t1['column1'].format = '#^.2f'\n  >>> t1.pprint()\n  column1 column2\n  ------- -------\n  ##1.00#       1\n  ##2.00#       2\n\nNow if we set a global align, it seems like our original column format\ngot lost::\n\n  >>> t1.pprint(align='!<')\n  column1 column2\n  ------- -------\n  1.00!!! 1!!!!!!\n  2.00!!! 2!!!!!!\n\nThe way to avoid this is to explicitly specify the alignment strings\nfor every column and use `None` where the column format should be\nused::\n\n  >>> t1.pprint(align=[None, '!<'])\n  column1 column2\n  ------- -------\n  ##1.00# 1!!!!!!\n  ##2.00# 2!!!!!!\n\npformat() method\n^^^^^^^^^^^^^^^^\n\nIn order to get the formatted output for manipulation or writing to a file use\nthe `Table.pformat() <astropy.table.Table.pformat>` or `Column.pformat()\n<astropy.table.Column.pformat>` methods. These behave just as for\n:meth:`~astropy.table.Table.pprint` but return a list corresponding to each\nformatted line in the :meth:`~astropy.table.Table.pprint` output. The\n:meth:`~astropy.table.Table.pformat_all` method can be used to return a list\nfor all lines in the |Table|.\n\n  >>> lines = t['col3'].pformat(max_lines=8)\n\nHiding columns\n^^^^^^^^^^^^^^\n\nThe |Table| class has functionality to selectively show or hide certain columns\nwithin the table when using any of the print methods. This can be useful for\ncolumns that are very wide or else \"uninteresting\" for various reasons. The\nspecification of which columns are outputted is associated with the table itself\nso that it persists through slicing, copying, and serialization (e.g. saving to\n:ref:`ecsv_format`). One use case is for specialized table subclasses that\ncontain auxiliary columns that are not typically useful to the user.\n\nThe specification of which columns to include when printing is handled through\ntwo complementary |Table| attributes:\n\n- `~astropy.table.Table.pprint_include_names`: column names to include, where\n  the default value of `None` implies including all columns.\n- `~astropy.table.Table.pprint_exclude_names`: column names to exclude, where\n  the default value of `None` implies excluding no columns.\n\nTypically you should use just one of the two attributes at a time. However,\nboth can be set at once and the set of columns that actually gets printed\nis conceptually expressed in this pseudo-code::\n\n  include_names = (set(table.pprint_include_names() or table.colnames)\n                   - set(table.pprint_exclude_names() or ())\n\nExamples\n\"\"\"\"\"\"\"\"\nLet's start with defining a simple table with one row and six columns::\n\n  >>> from astropy.table.table_helpers import simple_table\n  >>> t = simple_table(size=1, cols=6)\n  >>> print(t)\n  a   b   c   d   e   f\n  --- --- --- --- --- ---\n  1 1.0   c   4 4.0   f\n\nNow you can get the value of the ``pprint_include_names`` attribute by calling\nit as a function, and then include some names for printing::\n\n  >>> print(t.pprint_include_names())\n  None\n  >>> t.pprint_include_names = ('a', 'c', 'e')\n  >>> print(t.pprint_include_names())\n  ('a', 'c', 'e')\n  >>> print(t)\n   a   c   e\n  --- --- ---\n    1   c 4.0\n\nNow you can instead exclude some columns from printing. Note that for both\ninclude and exclude, you can add column names that do not exist in the table.\nThis allows pre-defining the attributes before the table has been fully\nconstructed.\n::\n\n  >>> t.pprint_include_names = None  # Revert to printing all columns\n  >>> t.pprint_exclude_names = ('a', 'c', 'e', 'does-not-exist')\n  >>> print(t)\n   b   d   f\n  --- --- ---\n  1.0   4   f\n\nNext you can ``add`` or ``remove`` names from the attribute::\n\n  >>> t = simple_table(size=1, cols=6)  # Start with a fresh table\n  >>> t.pprint_exclude_names.add('b')  # Single name\n  >>> t.pprint_exclude_names.add(['d', 'f'])  # List or tuple of names\n  >>> t.pprint_exclude_names.remove('f')  # Single name or list/tuple of names\n  >>> t.pprint_exclude_names()\n  ('b', 'd')\n\nFinally, you can temporarily set the attributes within a `context manager\n<https://docs.python.org/3/reference/datamodel.html#context-managers>`_. For\nexample::\n\n  >>> t = simple_table(size=1, cols=6)\n  >>> t.pprint_include_names = ('a', 'b')\n  >>> print(t)\n   a   b\n  --- ---\n    1 1.0\n\n  >>> # Show all (for pprint_include_names the value of None => all columns)\n  >>> with t.pprint_include_names.set(None):\n  ...     print(t)\n   a   b   c   d   e   f\n  --- --- --- --- --- ---\n    1 1.0   c   4 4.0   f\n\nThe specification of names for these attributes can include Unix-style globs\nlike ``*`` and ``?``. See `fnmatch` for details (and in particular how to\nescape those characters if needed). For example::\n\n  >>> t = Table()\n  >>> t.pprint_exclude_names = ['boring*']\n  >>> t['a'] = [1]\n  >>> t['b'] = ['b']\n  >>> t['boring_ra'] = [122.0]\n  >>> t['boring_dec'] = [89.9]\n  >>> print(t)\n   a   b\n  --- ---\n    1   b\n\nMultidimensional columns\n^^^^^^^^^^^^^^^^^^^^^^^^\n\nIf a column has more than one dimension then each element of the column is\nitself an array. In the example below there are three rows, each of which is a\n``2 x 2`` array. The formatted output for such a column shows only the first\nand last value of each row element and indicates the array dimensions in the\ncolumn name header::\n\n  >>> t = Table()\n  >>> arr = [ np.array([[ 1,  2],\n  ...                   [10, 20]]),\n  ...         np.array([[ 3,  4],\n  ...                   [30, 40]]),\n  ...         np.array([[ 5,  6],\n  ...                   [50, 60]]) ]\n  >>> t['a'] = arr\n  >>> t['a'].shape\n  (3, 2, 2)\n  >>> t.pprint()\n  a [2,2]\n  -------\n  1 .. 20\n  3 .. 40\n  5 .. 60\n\nIn order to see all of the data values for a multidimensional column use the\ncolumn representation. This uses the standard ``numpy`` mechanism for printing\nany array::\n\n  >>> t['a'].data\n  array([[[ 1,  2],\n          [10, 20]],\n         [[ 3,  4],\n          [30, 40]],\n         [[ 5,  6],\n          [50, 60]]])\n\n.. _columns_with_units:\n\nColumns with Units\n^^^^^^^^^^^^^^^^^^\n\n.. note::\n\n  |Table| and |QTable| instances handle entries with units differently. The\n  following describes |Table|. :ref:`quantity_and_qtable` explains how a\n  |QTable| differs from a |Table|.\n\nA |Column| object with units within a standard |Table| has certain\nquantity-related conveniences available. To begin with, it can be converted\nexplicitly to a |Quantity| object via the\n:attr:`~astropy.table.Column.quantity` property and the\n:meth:`~astropy.table.Column.to` method::\n\n  >>> data = [[1., 2., 3.], [40000., 50000., 60000.]]\n  >>> t = Table(data, names=('a', 'b'))\n  >>> t['a'].unit = u.m\n  >>> t['b'].unit = 'km/s'\n  >>> t['a'].quantity  # doctest: +FLOAT_CMP\n  <Quantity [1., 2., 3.] m>\n  >>> t['b'].to(u.kpc/u.Myr)  # doctest: +FLOAT_CMP\n  <Quantity [40.9084866 , 51.13560825, 61.3627299 ] kpc / Myr>\n\nNote that the :attr:`~astropy.table.Column.quantity` property is actually\na *view* of the data in the column, not a copy. Hence, you can set the\nvalues of a column in a way that respects units by making in-place\nchanges to the :attr:`~astropy.table.Column.quantity` property::\n\n  >>> t['b']\n  <Column name='b' dtype='float64' unit='km / s' length=3>\n  40000.0\n  50000.0\n  60000.0\n\n  >>> t['b'].quantity[0] = 45000000*u.m/u.s\n  >>> t['b']\n  <Column name='b' dtype='float64' unit='km / s' length=3>\n  45000.0\n  50000.0\n  60000.0\n\nEven without explicit conversion, columns with units can be treated like a\n|Quantity| in *some* arithmetic expressions (see the warning below for caveats\nto this)::\n\n  >>> t['a'] + .005*u.km  # doctest: +FLOAT_CMP\n  <Quantity [6., 7., 8.] m>\n  >>> from astropy.constants import c\n  >>> (t['b'] / c).decompose()  # doctest: +FLOAT_CMP\n  <Quantity [0.15010384, 0.16678205, 0.20013846]>\n\n.. warning::\n\n  |Table| columns do *not* always behave the same as |Quantity|. |Table|\n  columns act more like regular ``numpy`` arrays unless either explicitly\n  converted to a |Quantity| or combined with a |Quantity| using an arithmetic\n  operator. For example, the following does not work in the way you would\n  expect::\n\n    >>> data = [[30, 90]]\n    >>> t = Table(data, names=('angle',))\n    >>> t['angle'].unit = 'deg'\n    >>> np.sin(t['angle'])  # doctest: +FLOAT_CMP\n    <Column name='angle' dtype='float64' unit='deg' length=2>\n    -0.988031624093\n     0.893996663601\n\n  This is wrong both in that it says the result is in degrees, *and*\n  `~numpy.sin` treated the values as radians rather than degrees. If at all in\n  doubt that you will get the right result, the safest choice is to either use\n  |QTable| or to explicitly convert to |Quantity|::\n\n    >>> np.sin(t['angle'].quantity)  # doctest: +FLOAT_CMP\n    <Quantity [0.5, 1. ]>\n\n.. _bytestring-columns-python-3:\n\nBytestring Columns\n^^^^^^^^^^^^^^^^^^\n\nUsing bytestring columns (``numpy`` ``'S'`` dtype) is possible\nwith ``astropy`` tables since they can be compared with the natural\nPython string (``str``) type. See `The bytes/str dichotomy in Python 3\n<https://eli.thegreenplace.net/2012/01/30/the-bytesstr-dichotomy-in-python-3>`_\nfor a very brief overview of the difference.\n\nThe standard method of representing strings in ``numpy`` is via the\nunicode ``'U'`` dtype. The problem is that this requires 4 bytes per\ncharacter, and if you have a very large number of strings this could\nfill memory and impact performance. A very common use case is that these\nstrings are actually ASCII and can be represented with 1 byte per character.\nIn ``astropy`` it is possible to work directly and conveniently with\nbytestring data in |Table| and |Column| operations.\n\nNote that the bytestring issue is a particular problem when dealing with HDF5\nfiles, where character data are read as bytestrings (``'S'`` dtype) when using\nthe :ref:`table_io`. Since HDF5 files are frequently used to store very large\ndatasets, the memory bloat associated with conversion to ``'U'`` dtype is\nunacceptable.\n\n\nExamples\n\"\"\"\"\"\"\"\"\n\n.. EXAMPLE START: Bytestring Data in Astropy Tables\n\nThe examples below illustrate dealing with bytestring data in ``astropy``::\n\n    >>> t = Table([['abc', 'def']], names=['a'], dtype=['S'])\n\n    >>> t['a'] == 'abc'  # Gives expected answer\n    array([ True, False])\n\n    >>> t['a'] == b'abc'  # Still gives expected answer\n    array([ True, False])\n\n    >>> t['a'][0] == 'abc'  # Expected answer\n    True\n\n    >>> t['a'][0] == b'abc'  # Cannot compare to bytestring\n    False\n\n    >>> t['a'][0] = 'bä'\n    >>> t\n    <Table length=2>\n      a\n    bytes3\n    ------\n        bä\n       def\n\n    >>> t['a'] == 'bä'\n    array([ True, False])\n\n.. doctest-skip::\n\n    >>> # Round trip unicode strings through HDF5\n    >>> t.write('test.hdf5', format='hdf5', path='data', overwrite=True)\n    >>> t2 = Table.read('test.hdf5', format='hdf5', path='data')\n    >>> t2\n    <Table length=2>\n     col0\n    bytes3\n    ------\n        bä\n       def\n\n.. EXAMPLE END\n"},{"id":162,"name":"modify_table.rst","nodeType":"TextFile","path":"docs/table","text":".. _modify_table:\n\nModifying a Table\n*****************\n\nThe data values within a |Table| object can be modified in much the same manner\nas for ``numpy`` `structured arrays\n<https://numpy.org/doc/stable/user/basics.rec.html>`_ by accessing columns or\nrows of data and assigning values appropriately. A key enhancement provided by\nthe |Table| class is the ability to modify the structure of the table: you can\nadd or remove columns, and add new rows of data.\n\nQuick Overview\n==============\n\nThe code below shows the basics of modifying a table and its data.\n\nExamples\n--------\n\n.. EXAMPLE START: Making a Table and Modifying Data\n\n**Make a table**\n::\n\n  >>> from astropy.table import Table\n  >>> import numpy as np\n  >>> arr = np.arange(15).reshape(5, 3)\n  >>> t = Table(arr, names=('a', 'b', 'c'), meta={'keywords': {'key1': 'val1'}})\n\n**Modify data values**\n::\n\n  >>> t['a'][:] = [1, -2, 3, -4, 5]  # Set all values of column 'a'\n  >>> t['a'][2] = 30                 # Set row 2 of column 'a'\n  >>> t[1] = (8, 9, 10)              # Set all values of row 1\n  >>> t[1]['b'] = -9                 # Set column 'b' of row 1\n  >>> t[0:3]['c'] = 100              # Set column 'c' of rows 0, 1, 2\n\nNote that ``table[row][column]`` assignments will not work with ``numpy``\n\"fancy\" ``row`` indexing (in that case ``table[row]`` would be a *copy* instead\nof a *view*). \"Fancy\" ``numpy`` indices include a :class:`list`, |ndarray|, or\n:class:`tuple` of |ndarray| (e.g., the return from :func:`numpy.where`)::\n\n  >>> t[[1, 2]]['a'] = [3., 5.]             # doesn't change table t\n  >>> t[np.array([1, 2])]['a'] = [3., 5.]   # doesn't change table t\n  >>> t[np.where(t['a'] > 3)]['a'] = 3.     # doesn't change table t\n\nInstead use ``table[column][row]`` order::\n\n  >>> t['a'][[1, 2]] = [3., 5.]\n  >>> t['a'][np.array([1, 2])] = [3., 5.]\n  >>> t['a'][np.where(t['a'] > 3)] = 3.\n\nYou can also modify data columns with ``unit`` set in a way that follows\nthe conventions of `~astropy.units.Quantity` by using the\n:attr:`~astropy.table.Column.quantity` property::\n\n  >>> from astropy import units as u\n  >>> tu = Table([[1, 2.5]], names=('a',))\n  >>> tu['a'].unit = u.m\n  >>> tu['a'].quantity[:] = [1, 2] * u.km\n  >>> tu['a']\n  <Column name='a' dtype='float64' unit='m' length=2>\n  1000.0\n  2000.0\n\n.. note::\n\n  The best way to combine the functionality of the |Table| and |Quantity|\n  classes is to use a |QTable|. See :ref:`quantity_and_qtable` for more\n  information.\n\n.. EXAMPLE END\n\n**Add a column or columns**\n\n.. EXAMPLE START: Adding Columns to Tables\n\nA single column can be added to a table using syntax like adding a key-value\npair to a :class:`dict`. The value on the right hand side can be a\n:class:`list` or |ndarray| of the correct size, or a scalar value that will be\n`broadcast <https://numpy.org/doc/stable/user/basics.broadcasting.html>`_::\n\n  >>> t['d1'] = np.arange(5)\n  >>> t['d2'] = [1, 2, 3, 4, 5]\n  >>> t['d3'] = 6  # all 5 rows set to 6\n\nFor more explicit control, the :meth:`~astropy.table.Table.add_column` and\n:meth:`~astropy.table.Table.add_columns` methods can be used to add one or\nmultiple columns to a table. In both cases the new column(s) can be specified as\na :class:`list`, |ndarray|, |Column|, |MaskedColumn|, or a scalar::\n\n  >>> from astropy.table import Column\n  >>> t.add_column(np.arange(5), name='aa', index=0)  # Insert before first table column\n  >>> t.add_column(1.0, name='bb')  # Add column of all 1.0 to end of table\n  >>> c = Column(np.arange(5), name='e')\n  >>> t.add_column(c, index=0)  # Add Column using the existing column name 'e'\n  >>> t.add_columns([[1, 2, 3, 4, 5], ['v', 'w', 'x', 'y', 'z']], names=['h', 'i'])\n\nFinally, columns can also be added from |Quantity| objects, which automatically\nsets the ``unit`` attribute on the column (but you might find it more\nconvenient to add a |Quantity| to a |QTable| instead, see\n:ref:`quantity_and_qtable` for details)::\n\n  >>> from astropy import units as u\n  >>> t['d'] = np.arange(1., 6.) * u.m\n  >>> t['d']\n  <Column name='d' dtype='float64' unit='m' length=5>\n  1.0\n  2.0\n  3.0\n  4.0\n  5.0\n\n.. EXAMPLE END\n\n**Remove columns**\n\n.. EXAMPLE START: Removing Columns from Tables\n\nTo remove a column from a table::\n\n  >>> t.remove_column('d1')\n  >>> t.remove_columns(['aa', 'd2', 'e'])\n  >>> del t['d3']\n  >>> del t['h', 'i']\n  >>> t.keep_columns(['a', 'b'])\n\n.. EXAMPLE END\n\n**Replace a column**\n\n.. EXAMPLE START: Replacing Columns in Tables\n\nYou can entirely replace an existing column with a new column by setting the\ncolumn to any object that could be used to initialize a table column (e.g.,  a\n:class:`list` or |ndarray|). For example, you could change the data type of the\n``a`` column from ``int`` to ``float`` using::\n\n  >>> t['a'] = t['a'].astype(float)\n\nIf the right-hand side value is not column-like, then an in-place update using\n`broadcasting <https://numpy.org/doc/stable/user/basics.broadcasting.html>`_\nwill be done, for example::\n\n  >>> t['a'] = 1  # Internally does t['a'][:] = 1\n\n.. EXAMPLE END\n\n**Perform a dictionary-style update**\n\nIt is possible to perform a dictionary-style update, which adds new columns to\nthe table and replaces existing ones::\n\n  >>> t1 = Table({'name': ['foo', 'bar'], 'val': [0., 0.]}, meta={'n': 2})\n  >>> t2 = Table({'val': [1., 2.], 'val2': [10., 10.]}, meta={'id': 0})\n  >>> t1.update(t2)\n  >>> t1\n  <Table length=2>\n  name   val     val2\n  str3 float64 float64\n  ---- ------- -------\n   foo     1.0    10.0\n   bar     2.0    10.0\n\n:meth:`~astropy.table.Table.update` also takes care of silently :ref:`merging_metadata`::\n\n  >>> t1.meta\n  {'n': 2, 'id': 0}\n\nThe input of :meth:`~astropy.table.Table.update` does not have to be a |Table|,\nit can be anything that can be used for :ref:`construct_table` with a\ncompatible number of rows.\n\n**Rename columns**\n\n.. EXAMPLE START: Renaming Columns in Tables\n\nTo rename a column::\n\n  >>> t.rename_column('a', 'a_new')\n  >>> t['b'].name = 'b_new'\n\n.. EXAMPLE END\n\n**Add a row of data**\n\n.. EXAMPLE START: Adding a Row of Data to a Table\n\nTo add a row::\n\n  >>> t.add_row([-8, -9])\n\n.. EXAMPLE END\n\n**Remove rows**\n\n.. EXAMPLE START: Removing Rows of Data from Tables\n\nTo remove a row::\n\n  >>> t.remove_row(0)\n  >>> t.remove_rows(slice(4, 5))\n  >>> t.remove_rows([1, 2])\n\n.. EXAMPLE END\n\n**Sort by one or more columns**\n\n.. EXAMPLE START: Sorting Columns in Tables\n\nTo sort columns::\n\n  >>> t.sort('b_new')\n  >>> t.sort(['a_new', 'b_new'])\n\n.. EXAMPLE END\n\n**Reverse table rows**\n\n.. EXAMPLE START: Reversing Table Rows\n\nTo reverse the order of table rows::\n\n  >>> t.reverse()\n\n.. EXAMPLE END\n\n**Modify metadata**\n\n.. EXAMPLE START: Modifying Metadata in Tables\n\nTo modify metadata::\n\n  >>> t.meta['key'] = 'value'\n\n.. EXAMPLE END\n\n**Select or reorder columns**\n\n.. EXAMPLE START: Selecting or Reordering Columns in Tables\n\nA new table with a subset or reordered list of columns can be\ncreated as shown in the following example::\n\n  >>> t = Table(arr, names=('a', 'b', 'c'))\n  >>> t_acb = t['a', 'c', 'b']\n\nAnother way to do the same thing is to provide a list or tuple\nas the item, as shown below::\n\n  >>> new_order = ['a', 'c', 'b']  # List or tuple\n  >>> t_acb = t[new_order]\n\n.. EXAMPLE END\n\nCaveats\n=======\n\nModifying the table data and properties is fairly clear-cut, but one thing\nto keep in mind is that adding a row *may* require a new copy in memory of the\ntable data. This depends on the detailed layout of Python objects in memory\nand cannot be reliably controlled. In some cases it may be possible to build a\ntable row by row in less than O(N**2) time but you cannot count on it.\n\nAnother subtlety to keep in mind is that in some cases the return value of an\noperation results in a new table in memory while in other cases it results in a\nview of the existing table data. As an example, imagine trying to set two table\nelements using column selection with ``t['a', 'c']`` in combination with row\nindex selection::\n\n  >>> t = Table([[1, 2], [3, 4], [5, 6]], names=('a', 'b', 'c'))\n  >>> t['a', 'c'][1] = (100, 100)\n  >>> print(t)\n   a   b   c\n  --- --- ---\n    1   3   5\n    2   4   6\n\nThis might be surprising because the data values did not change and there\nwas no error. In fact, what happened is that ``t['a', 'c']`` created a\nnew temporary table in memory as a *copy* of the original and then updated the\nfirst row of the copy. The original ``t`` table was unaffected and the new\ntemporary table disappeared once the statement was complete. The takeaway\nis to pay attention to how certain operations are performed one step at\na time.\n\n.. _table-replace-1_3:\n\nIn-Place Versus Replace Column Update\n=====================================\n\nConsider this code snippet::\n\n  >>> t = Table([[1, 2, 3]], names=['a'])\n  >>> t['a'] = [10.5, 20.5, 30.5]\n\nThere are a couple of ways this could be handled. It could update the existing\narray values in-place (truncating to integer), or it could replace the entire\ncolumn with a new column based on the supplied data values.\n\nThe answer for ``astropy`` is that the operation shown above does a *complete\nreplacement* of the column object. In this case it makes a new column object\nwith float values by internally calling ``t.replace_column('a', [10.5, 20.5,\n30.5])``. In general this behavior is more consistent with Python and `pandas\n<https://pandas.pydata.org>`_ behavior.\n\n**Forcing in-place update**\n\nIt is possible to force an in-place update of a column as follows::\n\n  t[colname][:] = value\n\n**Finding the source of problems**\n\nIn order to find potential problems related to replacing columns, there is the\noption `astropy.table.conf.replace_warnings\n<astropy.table.Conf.replace_warnings>` in the :ref:`astropy_config`. This\ncontrols a set of warnings that are emitted under certain circumstances when a\ntable column is replaced. This option must be set to a list that includes zero\nor more of the following string values:\n\n``always`` :\n  Print a warning every time a column gets replaced via the\n  ``__setitem__()`` syntax (i.e., ``t['a'] = new_col``).\n\n``slice`` :\n  Print a warning when a column that appears to be a :class:`slice` of\n  a parent column is replaced.\n\n``refcount`` :\n  Print a warning when the Python reference count for the\n  column changes. This indicates that a stale object exists that might\n  be used elsewhere in the code and give unexpected results.\n\n``attributes`` :\n  Print a warning if any of the standard column attributes changed.\n\nThe default value for the ``table.conf.replace_warnings`` option is\n``[]`` (no warnings).\n"},{"id":163,"name":"index.rst","nodeType":"TextFile","path":"docs/table","text":".. _astropy-table:\n\n*****************************\nData Tables (`astropy.table`)\n*****************************\n\nIntroduction\n============\n\n`astropy.table` provides functionality for storing and manipulating\nheterogeneous tables of data in a way that is familiar to ``numpy`` users. A few\nnotable capabilities of this package are:\n\n* Initialize a table from a wide variety of input data structures and types.\n* Modify a table by adding or removing columns, changing column names,\n  or adding new rows of data.\n* Handle tables containing missing values.\n* Include table and column metadata as flexible data structures.\n* Specify a description, units, and output formatting for columns.\n* Interactively scroll through long tables similar to using ``more``.\n* Create a new table by selecting rows or columns from a table.\n* Perform :ref:`table_operations` like database joins, concatenation, and binning.\n* Maintain a table index for fast retrieval of table items or ranges.\n* Manipulate multidimensional columns.\n* Handle non-native (mixin) column types within table.\n* Methods for :ref:`read_write_tables` to files.\n* Hooks for :ref:`subclassing_table` and its component classes.\n\nGetting Started\n===============\n\nThe basic workflow for creating a table, accessing table elements,\nand modifying the table is shown below. These examples demonstrate a concise\ncase, while the full `astropy.table` documentation is available from the\n:ref:`using_astropy_table` section.\n\nFirst create a simple table with columns of data named ``a``, ``b``, ``c``, and\n``d``. These columns have integer, float, string, and |Quantity| values\nrespectively::\n\n  >>> from astropy.table import QTable\n  >>> import astropy.units as u\n  >>> import numpy as np\n\n  >>> a = np.array([1, 4, 5], dtype=np.int32)\n  >>> b = [2.0, 5.0, 8.5]\n  >>> c = ['x', 'y', 'z']\n  >>> d = [10, 20, 30] * u.m / u.s\n\n  >>> t = QTable([a, b, c, d],\n  ...            names=('a', 'b', 'c', 'd'),\n  ...            meta={'name': 'first table'})\n\nComments:\n\n- Column ``a`` is a |ndarray| with a specified ``dtype`` of ``int32``. If the\n  data type is not provided, the default type for integers is ``int64`` on Mac\n  and Linux and ``int32`` on Windows.\n- Column ``b`` is a list of ``float`` values, represented as ``float64``.\n- Column ``c`` is a list of ``str`` values, represented as unicode.\n  See :ref:`bytestring-columns-python-3` for more information.\n- Column ``d`` is a |Quantity| array. Since we used |QTable|, this stores a\n  native |Quantity| within the table and brings the full power of\n  :ref:`astropy-units` to this column in the table.\n\n.. Note::\n\n   If the table data have no units or you prefer to not use |Quantity|, then you\n   can use the |Table| class to create tables. The **only** difference between\n   |QTable| and |Table| is the behavior when adding a column that has units.\n   See :ref:`quantity_and_qtable` and :ref:`columns_with_units` for details on\n   the differences and use cases.\n\nThere are many other ways of :ref:`construct_table`, including from a list of\nrows (either tuples or dicts), from a ``numpy`` structured or 2D array, by\nadding columns or rows incrementally, or even converting from a |SkyCoord| or a\n:class:`pandas.DataFrame`.\n\nThere are a few ways of :ref:`access_table`. You can get detailed information\nabout the table values and column definitions as follows::\n\n  >>> t\n  <QTable length=3>\n    a      b     c      d\n                      m / s\n  int32 float64 str1 float64\n  ----- ------- ---- -------\n      1     2.0    x    10.0\n      4     5.0    y    20.0\n      5     8.5    z    30.0\n\nYou can get summary information about the table as follows::\n\n  >>> t.info\n  <QTable length=3>\n  name  dtype   unit  class\n  ---- ------- ----- --------\n     a   int32         Column\n     b float64         Column\n     c    str1         Column\n     d float64 m / s Quantity\n\nFrom within a `Jupyter notebook <https://jupyter.org/>`_, the table is\ndisplayed as a formatted HTML table (details of how it appears can be changed\nby altering the `astropy.table.conf.default_notebook_table_class\n<astropy.table.Conf.default_notebook_table_class>` item in the\n:ref:`astropy_config`:\n\n.. image:: table_repr_html.png\n   :width: 450px\n\nOr you can get a fancier notebook interface with in-browser search, and sort\nusing :meth:`~astropy.table.Table.show_in_notebook`:\n\n.. image:: table_show_in_nb.png\n   :width: 450px\n\nIf you print the table (either from the notebook or in a text console session)\nthen a formatted version appears::\n\n  >>> print(t)\n   a   b   c    d\n              m / s\n  --- --- --- -----\n    1 2.0   x  10.0\n    4 5.0   y  20.0\n    5 8.5   z  30.0\n\n\nIf you do not like the format of a particular column, you can change it through\n:ref:`the 'info' property <mixin_attributes>`::\n\n  >>> t['b'].info.format = '7.3f'\n  >>> print(t)\n   a     b     c    d\n                  m / s\n  --- ------- --- -----\n    1   2.000   x  10.0\n    4   5.000   y  20.0\n    5   8.500   z  30.0\n\nFor a long table you can scroll up and down through the table one page at\ntime::\n\n  >>> t.more()  # doctest: +SKIP\n\nYou can also display it as an HTML-formatted table in the browser::\n\n  >>> t.show_in_browser()  # doctest: +SKIP\n\nOr as an interactive (searchable and sortable) javascript table::\n\n  >>> t.show_in_browser(jsviewer=True)  # doctest: +SKIP\n\nNow examine some high-level information about the table::\n\n  >>> t.colnames\n  ['a', 'b', 'c', 'd']\n  >>> len(t)\n  3\n  >>> t.meta\n  {'name': 'first table'}\n\nAccess the data by column or row using familiar ``numpy`` structured array\nsyntax::\n\n  >>> t['a']       # Column 'a'\n  <Column name='a' dtype='int32' length=3>\n  1\n  4\n  5\n\n  >>> t['a'][1]    # Row 1 of column 'a'\n  4\n\n  >>> t[1]         # Row 1 of the table\n  <Row index=1>\n    a      b     c      d\n                      m / s\n  int32 float64 str1 float64\n  ----- ------- ---- -------\n      4   5.000    y    20.0\n\n\n  >>> t[1]['a']    # Column 'a' of row 1\n  4\n\nYou can retrieve a subset of a table by rows (using a :class:`slice`) or by\ncolumns (using column names), where the subset is returned as a new table::\n\n  >>> print(t[0:2])      # Table object with rows 0 and 1\n   a     b     c    d\n                  m / s\n  --- ------- --- -----\n    1   2.000   x  10.0\n    4   5.000   y  20.0\n\n\n  >>> print(t['a', 'c'])  # Table with cols 'a' and 'c'\n   a   c\n  --- ---\n    1   x\n    4   y\n    5   z\n\n:ref:`modify_table` in place is flexible and works as you would expect::\n\n  >>> t['a'][:] = [-1, -2, -3]    # Set all column values in place\n  >>> t['a'][2] = 30              # Set row 2 of column 'a'\n  >>> t[1] = (8, 9.0, \"W\", 4 * u.m / u.s) # Set all values of row 1\n  >>> t[1]['b'] = -9              # Set column 'b' of row 1\n  >>> t[0:2]['b'] = 100.0         # Set column 'b' of rows 0 and 1\n  >>> print(t)\n   a     b     c    d\n                  m / s\n  --- ------- --- -----\n   -1 100.000   x  10.0\n    8 100.000   W   4.0\n   30   8.500   z  30.0\n\nReplace, add, remove, and rename columns with the following::\n\n  >>> t['b'] = ['a', 'new', 'dtype']   # Replace column 'b' (different from in-place)\n  >>> t['e'] = [1, 2, 3]               # Add column 'e'\n  >>> del t['c']                       # Delete column 'c'\n  >>> t.rename_column('a', 'A')        # Rename column 'a' to 'A'\n  >>> t.colnames\n  ['A', 'b', 'd', 'e']\n\nAdding a new row of data to the table is as follows. Note that the unit\nvalue is given in ``cm / s`` but will be added to the table as ``0.1 m / s`` in\naccord with the existing unit.\n\n  >>> t.add_row([-8, 'string', 10 * u.cm / u.s, 10])\n  >>> t['d']\n  <Quantity [10. ,  4. , 30. ,  0.1] m / s>\n\nTables can be used for data with missing values::\n\n  >>> from astropy.table import MaskedColumn\n  >>> a_masked = MaskedColumn(a, mask=[True, True, False])\n  >>> t = QTable([a_masked, b, c], names=('a', 'b', 'c'),\n  ...            dtype=('i4', 'f8', 'U1'))\n  >>> t\n  <QTable length=3>\n    a      b     c\n  int32 float64 str1\n  ----- ------- ----\n     --     2.0    x\n     --     5.0    y\n      5     8.5    z\n\nIn addition to |Quantity|, you can include certain object types like\n`~astropy.time.Time`, `~astropy.coordinates.SkyCoord`, and\n`~astropy.table.NdarrayMixin` in your table. These \"mixin\" columns behave like\na hybrid of a regular `~astropy.table.Column` and the native object type (see\n:ref:`mixin_columns`). For example::\n\n  >>> from astropy.time import Time\n  >>> from astropy.coordinates import SkyCoord\n  >>> tm = Time(['2000:002', '2002:345'])\n  >>> sc = SkyCoord([10, 20], [-45, +40], unit='deg')\n  >>> t = QTable([tm, sc], names=['time', 'skycoord'])\n  >>> t\n  <QTable length=2>\n           time          skycoord\n                         deg,deg\n           Time          SkyCoord\n  --------------------- ----------\n  2000:002:00:00:00.000 10.0,-45.0\n  2002:345:00:00:00.000  20.0,40.0\n\nNow let us compute the interval since the launch of the `Chandra X-ray Observatory\n<https://en.wikipedia.org/wiki/Chandra_X-ray_Observatory>`_ aboard `STS-93\n<https://en.wikipedia.org/wiki/STS-93>`_ and store this in our table as a\n|Quantity| in days::\n\n  >>> dt = t['time'] - Time('1999-07-23 04:30:59.984')\n  >>> t['dt_cxo'] = dt.to(u.d)\n  >>> t['dt_cxo'].info.format = '.3f'\n  >>> print(t)\n           time          skycoord   dt_cxo\n                         deg,deg      d\n  --------------------- ---------- --------\n  2000:002:00:00:00.000 10.0,-45.0  162.812\n  2002:345:00:00:00.000  20.0,40.0 1236.812\n\n.. _using_astropy_table:\n\nUsing ``table``\n===============\n\nThe details of using `astropy.table` are provided in the following sections:\n\nConstruct Table\n---------------\n\n.. toctree::\n   :maxdepth: 2\n\n   construct_table.rst\n\nAccess Table\n------------\n\n.. toctree::\n   :maxdepth: 2\n\n   access_table.rst\n\nModify Table\n------------\n\n.. toctree::\n   :maxdepth: 2\n\n   modify_table.rst\n\nTable Operations\n----------------\n\n.. toctree::\n   :maxdepth: 2\n\n   operations.rst\n\nIndexing\n--------\n\n.. toctree::\n   :maxdepth: 2\n\n   indexing.rst\n\nMasking\n-------\n\n.. toctree::\n   :maxdepth: 2\n\n   masking.rst\n\nI/O with Tables\n---------------\n\n.. toctree::\n   :maxdepth: 2\n\n   io.rst\n   pandas.rst\n\nMixin Columns\n-------------\n\n.. toctree::\n   :maxdepth: 2\n\n   mixin_columns.rst\n\nImplementation\n--------------\n\n.. toctree::\n   :maxdepth: 2\n\n   implementation_details.rst\n\n.. note that if this section gets too long, it should be moved to a separate\n   doc page - see the top of performance.inc.rst for the instructions on how to do\n   that\n.. include:: performance.inc.rst\n\nReference/API\n=============\n\n.. automodapi:: astropy.table\n"},{"id":164,"name":"construct_table.rst","nodeType":"TextFile","path":"docs/table","text":".. _construct_table:\n\nConstructing a Table\n********************\n\nThere is great deal of flexibility in the way that a table can be initially\nconstructed. Details on the inputs to the |Table| and |QTable|\nconstructors are in the `Initialization Details`_ section. However, the\nbest way to understand how to make a table is by example.\n\nExamples\n========\n\nSetup\n-----\n\nFor the following examples you need to import the |QTable|, |Table|, and\n|Column| classes along with the :ref:`astropy-units` package and the ``numpy``\npackage::\n\n  >>> from astropy.table import QTable, Table, Column\n  >>> from astropy import units as u\n  >>> import numpy as np\n\nCreating from Scratch\n---------------------\n\n.. EXAMPLE START: Creating an Astropy Table from Scratch\n\nA |Table| can be created without any initial input data or even without any\ninitial columns. This is useful for building tables dynamically if the initial\nsize, columns, or data are not known.\n\n.. Note::\n   Adding rows requires making a new copy of the entire\n   table each time, so in the case of large tables this may be slow.\n   On the other hand, adding columns is fast.\n\n::\n\n  >>> t = Table()\n  >>> t['a'] = [1, 4]\n  >>> t['b'] = [2.0, 5.0]\n  >>> t['c'] = ['x', 'y']\n\n  >>> t = Table(names=('a', 'b', 'c'), dtype=('f4', 'i4', 'S2'))\n  >>> t.add_row((1, 2.0, 'x'))\n  >>> t.add_row((4, 5.0, 'y'))\n\n  >>> t = Table(dtype=[('a', 'f4'), ('b', 'i4'), ('c', 'S2')])\n\nIf your data columns have physical units associated with them then we\nrecommend using the |QTable| class. This will allow the column to be\nstored in the table as a native |Quantity| and bring the full power of\n:ref:`astropy-units` to the table. See :ref:`quantity_and_qtable` for details.\n::\n\n  >>> t = QTable()\n  >>> t['a'] = [1, 4]\n  >>> t['b'] = [2.0, 5.0] * u.cm / u.s\n  >>> t['c'] = ['x', 'y']\n  >>> type(t['b'])\n  <class 'astropy.units.quantity.Quantity'>\n\n.. EXAMPLE END\n\nList of Columns\n---------------\n\n.. EXAMPLE START: Creating an Astropy Table from a List of Columns\n\nA typical case is where you have a number of data columns with the same length\ndefined in different variables. These might be Python lists or ``numpy`` arrays\nor a mix of the two. These can be used to create a |Table| by putting the column\ndata variables into a Python list. In this case the column names are not\ndefined by the input data, so they must either be set using the ``names``\nkeyword or they will be automatically generated as ``col<N>``.\n\n::\n\n  >>> a = np.array([1, 4], dtype=np.int32)\n  >>> b = [2.0, 5.0]\n  >>> c = ['x', 'y']\n  >>> t = Table([a, b, c], names=('a', 'b', 'c'))\n  >>> t\n  <Table length=2>\n    a      b     c\n  int32 float64 str1\n  ----- ------- ----\n      1     2.0    x\n      4     5.0    y\n\n.. EXAMPLE END\n\n**Make a new table using columns from the first table**\n\nOnce you have a |Table|, then you can make a new table by selecting columns\nand putting them into a Python list (e.g., ``[ t['c'], t['a'] ]``)::\n\n  >>> Table([t['c'], t['a']])\n  <Table length=2>\n   c     a\n  str1 int32\n  ---- -----\n     x     1\n     y     4\n\n**Make a new table using expressions involving columns**\n\nThe |Column| object is derived from the standard |ndarray| and can be used\ndirectly in arithmetic expressions. This allows for a compact way of making a\nnew table with modified column values::\n\n  >>> Table([t['a']**2, t['b'] + 10])\n  <Table length=2>\n    a      b\n  int32 float64\n  ----- -------\n      1    12.0\n     16    15.0\n\n\n**Different types of column data**\n\nThe list input method for |Table| is very flexible since you can use a mix\nof different data types to initialize a table::\n\n  >>> a = (1., 4.)\n  >>> b = np.array([[2, 3], [5, 6]], dtype=np.int64)  # vector column\n  >>> c = Column(['x', 'y'], name='axis')\n  >>> arr = (a, b, c)\n  >>> Table(arr)\n  <Table length=2>\n    col0  col1 [2] axis\n  float64  int64   str1\n  ------- -------- ----\n      1.0   2 .. 3    x\n      4.0   5 .. 6    y\n\nNotice that in the third column the existing column name ``'axis'`` is used.\n\nDict of Columns\n---------------\n\n.. EXAMPLE START: Creating an Astropy Table from a Dictionary of Columns\n\nA :class:`dict` of column data can be used to initialize a |Table|::\n\n  >>> arr = {'a': np.array([1, 4], dtype=np.int32),\n  ...        'b': [2.0, 5.0],\n  ...        'c': ['x', 'y']}\n  >>>\n  >>> Table(arr)\n  <Table length=2>\n    a      b     c\n  int32 float64 str1\n  ----- ------- ----\n      1     2.0    x\n      4     5.0    y\n\n.. EXAMPLE END\n\n**Specify the column order and optionally the data types**\n::\n\n  >>> Table(arr, names=('a', 'c', 'b'), dtype=('f8', 'U2', 'i4'))\n  <Table length=2>\n     a     c     b\n  float64 str2 int32\n  ------- ---- -----\n      1.0    x     2\n      4.0    y     5\n\n**Different types of column data**\n\nThe input column data can be any data type that can initialize a |Column|\nobject::\n\n  >>> arr = {'a': (1., 4.),\n  ...        'b': np.array([[2, 3], [5, 6]], dtype=np.int64),\n  ...        'c': Column(['x', 'y'], name='axis')}\n  >>> Table(arr, names=('a', 'b', 'c'))\n  <Table length=2>\n    a   b [2]   c\n  float64 int64  str1\n  ------- ------ ----\n      1.0 2 .. 3    x\n      4.0 5 .. 6    y\n\nNotice that the key ``'c'`` takes precedence over the existing column name\n``'axis'`` in the third column. Also see that the ``'b'`` column is a vector\ncolumn where each row element is itself a two-element array.\n\n**Renaming columns is not possible**\n::\n\n  >>> Table(arr, names=('a_new', 'b_new', 'c_new'))\n  Traceback (most recent call last):\n    ...\n  KeyError: 'a_new'\n\nRow Data\n--------\n\nRow-oriented data can be used to create a table using the ``rows``\nkeyword argument.\n\n**List or tuple of data records**\n\nIf you have row-oriented input data such as a list of records, you\nneed to use the ``rows`` keyword to create a table::\n\n  >>> data_rows = [(1, 2.0, 'x'),\n  ...              (4, 5.0, 'y'),\n  ...              (5, 8.2, 'z')]\n  >>> t = Table(rows=data_rows, names=('a', 'b', 'c'))\n  >>> print(t)\n   a   b   c\n  --- --- ---\n    1 2.0   x\n    4 5.0   y\n    5 8.2   z\n\n**List of dict objects**\n\nYou can also initialize a table with row values. This is constructed as a\nlist of :class:`dict` objects. The keys determine the column names::\n\n  >>> data = [{'a': 5, 'b': 10},\n  ...         {'a': 15, 'b': 20}]\n  >>> t = Table(rows=data)\n  >>> print(t)\n   a   b\n  --- ---\n    5  10\n   15  20\n\nIf there are missing keys in one or more rows then the corresponding values\nwill be marked as missing (masked)::\n\n  >>> t = Table(rows=[{'a': 5, 'b': 10}, {'a': 15, 'c': 50}])\n  >>> print(t)\n   a   b   c\n  --- --- ---\n    5  10  --\n   15  --  50\n\nYou can specify the column order with the ``names`` argument::\n\n  >>> data = [{'a': 5, 'b': 10},\n  ...         {'a': 15, 'b': 20}]\n  >>> t = Table(rows=data, names=('b', 'a'))\n  >>> print(t)\n   b   a\n  --- ---\n   10   5\n   20  15\n\nIf ``names`` are not provided then column ordering will be determined by the\nfirst :class:`dict` if it contains values for all the columns, or by sorting\nthe column names alphabetically if it doesn't::\n\n  >>> data = [{'b': 10, 'c': 7, 'a': 5},\n  ...         {'a': 15, 'c': 35, 'b': 20}]\n  >>> t = Table(rows=data)\n  >>> print(t)\n   b   c   a\n  --- --- ---\n   10   7   5\n   20  35  15\n  >>> data = [{'b': 10, 'c': 7, },\n  ...         {'a': 15, 'c': 35, 'b': 20}]\n  >>> t = Table(rows=data)\n  >>> print(t)\n   a   b   c\n  --- --- ---\n   --  10   7\n   15  20  35\n\n**Single row**\n\nYou can also make a new table from a single row of an existing table::\n\n  >>> a = [1, 4]\n  >>> b = [2.0, 5.0]\n  >>> t = Table([a, b], names=('a', 'b'))\n  >>> t2 = Table(rows=t[1])\n\nRemember that a |Row| has effectively a zero length compared to the\nnewly created |Table| which has a length of one. This is similar to\nthe difference between a scalar ``1`` (length 0) and an array such as\n``np.array([1])`` with length 1.\n\n.. Note::\n\n   In the case of input data as a list of dicts or a single |Table| row, you\n   can supply the data as the ``data`` argument since these forms\n   are always unambiguous. For example, ``Table([{'a': 1}, {'a': 2}])`` is\n   accepted. However, a list of records must always be provided using the\n   ``rows`` keyword, otherwise it will be interpreted as a list of columns.\n\nNumPy Structured Array\n----------------------\n\nThe `structured array <https://numpy.org/doc/stable/user/basics.rec.html>`_ is\nthe standard mechanism in ``numpy`` for storing heterogeneous table data. Most\nscientific I/O packages that read table files (e.g., `astropy.io.fits`,\n`astropy.io.votable`, and `asciitable\n<https://cxc.harvard.edu/contrib/asciitable/>`_) will return the table in an\nobject that is based on the structured array. A structured array can be\ncreated using::\n\n  >>> arr = np.array([(1, 2.0, 'x'),\n  ...                 (4, 5.0, 'y')],\n  ...                dtype=[('a', 'i4'), ('b', 'f8'), ('c', 'U2')])\n\nFrom ``arr`` it is possible to create the corresponding |Table| object::\n\n  >>> Table(arr)\n  <Table length=2>\n    a      b     c\n  int32 float64 str2\n  ----- ------- ----\n      1     2.0    x\n      4     5.0    y\n\nNote that in the above example and most of the following examples we are\ncreating a table and immediately asking the interactive Python interpreter to\nprint the table to see what we made. In real code you might do something like::\n\n  >>> table = Table(arr)\n  >>> print(table)\n   a   b   c\n  --- --- ---\n    1 2.0   x\n    4 5.0   y\n\n**New column names**\n\nThe column names can be changed from the original values by providing the\n``names`` argument::\n\n  >>> Table(arr, names=('a_new', 'b_new', 'c_new'))\n  <Table length=2>\n  a_new  b_new  c_new\n  int32 float64  str2\n  ----- ------- -----\n      1     2.0     x\n      4     5.0     y\n\n**New data types**\n\nThe data type for each column can likewise be changed with ``dtype``::\n\n  >>> Table(arr, dtype=('f4', 'i4', 'U4'))\n  <Table length=2>\n     a      b    c\n  float32 int32 str4\n  ------- ----- ----\n      1.0     2    x\n      4.0     5    y\n\n  >>> Table(arr, names=('a_new', 'b_new', 'c_new'), dtype=('f4', 'i4', 'U4'))\n  <Table length=2>\n   a_new  b_new c_new\n  float32 int32  str4\n  ------- ----- -----\n      1.0     2     x\n      4.0     5     y\n\nNumPy Homogeneous Array\n-----------------------\n\nA ``numpy`` 1D array is treated as a single row table where each element of the\narray corresponds to a column::\n\n  >>> Table(np.array([1, 2, 3]), names=['a', 'b', 'c'], dtype=('i8', 'i8', 'i8'))\n  <Table length=1>\n    a     b     c\n  int64 int64 int64\n  ----- ----- -----\n      1     2     3\n\nA ``numpy`` 2D array (where all elements have the same type) can also be\nconverted into a |Table|. In this case the column names are not specified by\nthe data and must either be provided by the user or will be automatically\ngenerated as ``col<N>`` where ``<N>`` is the column number.\n\n**Basic example with automatic column names**\n::\n\n  >>> arr = np.array([[1, 2, 3],\n  ...                 [4, 5, 6]], dtype=np.int32)\n  >>> Table(arr)\n  <Table length=2>\n   col0  col1  col2\n  int32 int32 int32\n  ----- ----- -----\n      1     2     3\n      4     5     6\n\n**Column names and types specified**\n::\n\n  >>> Table(arr, names=('a_new', 'b_new', 'c_new'), dtype=('f4', 'i4', 'U4'))\n  <Table length=2>\n   a_new  b_new c_new\n  float32 int32  str4\n  ------- ----- -----\n      1.0     2     3\n      4.0     5     6\n\n**Referencing the original data**\n\nIt is possible to reference the original data as long as the data types are not\nchanged::\n\n  >>> t = Table(arr, copy=False)\n\nSee the `Copy versus Reference`_ section for more information.\n\n**Python arrays versus NumPy arrays as input**\n\nThere is a slightly subtle issue that is important to understand about the way\nthat |Table| objects are created. Any data input that looks like a Python\n:class:`list` (including a :class:`tuple`) is considered to be a list of\ncolumns. In contrast, a homogeneous |ndarray| input is interpreted as a list of\nrows::\n\n  >>> arr = [[1, 2, 3],\n  ...        [4, 5, 6]]\n  >>> np_arr = np.array(arr)\n\n  >>> print(Table(arr))    # Two columns, three rows\n  col0 col1\n  ---- ----\n     1    4\n     2    5\n     3    6\n\n  >>> print(Table(np_arr))  # Three columns, two rows\n  col0 col1 col2\n  ---- ---- ----\n     1    2    3\n     4    5    6\n\nThis dichotomy is needed to support flexible list input while retaining the\nnatural interpretation of 2D ``numpy`` arrays where the first index corresponds\nto data \"rows\" and the second index corresponds to data \"columns.\"\n\nFrom an Existing Table\n----------------------\n\n.. EXAMPLE START: Creating an Astropy Table from an Existing Table\n\nA new table can be created by selecting a subset of columns in an existing\ntable::\n\n  >>> t = Table(names=('a', 'b', 'c'))\n  >>> t['c', 'b', 'a']  # Makes a copy of the data\n  <Table length=0>\n     c       b       a\n  float64 float64 float64\n  ------- ------- -------\n\nAn alternate way is to use the ``columns`` attribute (explained in the\n`TableColumns`_ section) to initialize a new table. This lets you choose\ncolumns by their numerical index or name and supports slicing syntax::\n\n  >>> Table(t.columns[0:2])\n  <Table length=0>\n     a       b\n  float64 float64\n  ------- -------\n\n  >>> Table([t.columns[0], t.columns['c']])\n  <Table length=0>\n     a       c\n  float64 float64\n  ------- -------\n\nTo create a copy of an existing table that is empty (has no rows)::\n\n >>> t = Table([[1.0, 2.3], [2.1, 3]], names=['x', 'y'])\n >>> t\n <Table length=2>\n    x       y\n float64 float64\n ------- -------\n     1.0     2.1\n     2.3     3.0\n\n >>> tcopy = t[:0].copy()\n >>> tcopy\n <Table length=0>\n    x       y\n float64 float64\n ------- -------\n\n.. EXAMPLE END\n\nEmpty Array of a Known Size\n---------------------------\n\n.. EXAMPLE START: Creating an Astropy Table from an Empty Array\n\nIf you do know the size that your table will be, but do not know the values in\nadvance, you can create a zeroed |ndarray| and build the |Table| from it::\n\n  >>> N = 3\n  >>> dtype = [('a', 'i4'), ('b', 'f8'), ('c', 'bool')]\n  >>> t = Table(data=np.zeros(N, dtype=dtype))\n  >>> t\n  <Table length=3>\n    a      b      c\n  int32 float64  bool\n  ----- ------- -----\n      0     0.0 False\n      0     0.0 False\n      0     0.0 False\n\nFor example, you can then fill in this table row by row with values extracted\nfrom another table, or generated on the fly::\n\n  >>> for i in range(len(t)):\n  ...     t[i] = (i, 2.5*i, i % 2)\n  >>> t\n  <Table length=3>\n    a      b      c\n  int32 float64  bool\n  ----- ------- -----\n      0     0.0 False\n      1     2.5  True\n      2     5.0 False\n\n.. EXAMPLE END\n\nSkyCoord\n--------\n\nA |SkyCoord| object can be converted to a |QTable| using its\n:meth:`~astropy.coordinates.SkyCoord.to_table` method. For details and examples\nsee :ref:`skycoord-table-conversion`.\n\nPandas DataFrame\n----------------\n\nThe section on :ref:`pandas` gives details on how to initialize a |Table| using\na :class:`pandas.DataFrame` via the :func:`~astropy.table.Table.from_pandas`\nclass method. This provides a convenient way to take advantage of the many I/O\nand table manipulation methods in `pandas <https://pandas.pydata.org/>`_.\n\nComment Lines\n-------------\n\n.. EXAMPLE START: Adding Comment Lines in an ASCII File\n\nComment lines in an ASCII file can be added via the ``'comments'`` key in the\ntable's metadata. The following will insert two comment lines in the output\nASCII file unless ``comment=False`` is explicitly set in ``write()``::\n\n  >>> import sys\n  >>> from astropy.table import Table\n  >>> t = Table(names=('a', 'b', 'c'), dtype=('f4', 'i4', 'S2'))\n  >>> t.add_row((1, 2.0, 'x'))\n  >>> t.meta['comments'] = ['Here is my explanatory text. This is awesome.',\n  ...                       'Second comment line.']\n  >>> t.write(sys.stdout, format='ascii')\n  # Here is my explanatory text. This is awesome.\n  # Second comment line.\n  a b c\n  1.0 2 x\n\n.. EXAMPLE END\n\nInitialization Details\n======================\n\nA table object is created by initializing a |Table| class\nobject with the following arguments, all of which are optional:\n\n``data`` : |ndarray|, :class:`dict`, :class:`list`, |Table|, or table-like object, optional\n    Data to initialize table.\n``masked`` : :class:`bool`, optional\n    Specify whether the table is masked.\n``names`` : :class:`list`, optional\n    Specify column names.\n``dtype`` : :class:`list`, optional\n    Specify column data types.\n``meta`` : :class:`dict`, optional\n    Metadata associated with the table.\n``copy`` : :class:`bool`, optional\n    Copy the input data. If the input is a |Table| the ``meta`` is always\n    copied regardless of the ``copy`` parameter.\n    Default is `True`.\n``rows`` : |ndarray|, :class:`list` of lists, optional\n    Row-oriented data for table instead of ``data`` argument.\n``copy_indices`` : :class:`bool`, optional\n    Copy any indices in the input data. Default is `True`.\n``units`` : :class:`list`, :class:`dict`, optional\n    List or dict of units to apply to columns.\n``descriptions`` : :class:`list`, :class:`dict`, optional\n    List or dict of descriptions to apply to columns.\n``**kwargs`` : :class:`dict`, optional\n    Additional keyword args when converting table-like object.\n\nThe following subsections provide further detail on the values and options for\neach of the keyword arguments that can be used to create a new |Table| object.\n\ndata\n----\n\nThe |Table| object can be initialized with several different forms\nfor the ``data`` argument.\n\n**NumPy ndarray (structured array)**\n    The base column names are the field names of the ``data`` structured\n    array. The ``names`` list (optional) can be used to select\n    particular fields and/or reorder the base names. The ``dtype`` list\n    (optional) must match the length of ``names`` and is used to\n    override the existing ``data`` types.\n\n**NumPy ndarray (homogeneous)**\n    If the ``data`` is a one-dimensional |ndarray| then it is treated as a\n    single row table where each element of the array corresponds to a column.\n\n    If the ``data`` is an at least two-dimensional |ndarray|, then the first\n    (left-most) index corresponds to row number (table length) and the\n    second index corresponds to column number (table width). Higher\n    dimensions get absorbed in the shape of each table cell.\n\n    If provided, the ``names`` list must match the \"width\" of the ``data``\n    argument. The default for ``names`` is to auto-generate column names\n    in the form ``col<N>``. If provided, the ``dtype`` list overrides the\n    base column types and must match the length of ``names``.\n\n**dict-like**\n    The keys of the ``data`` object define the base column names. The\n    corresponding values can be |Column| objects, ``numpy`` arrays, or list-\n    like objects. The ``names`` list (optional) can be used to select\n    particular fields and/or reorder the base names. The ``dtype`` list\n    (optional) must match the length of ``names`` and is used to override\n    the existing or default data types.\n\n**list-like**\n    Each item in the ``data`` list provides a column of data values and\n    can be a |Column| object, |ndarray|, or list-like object. The\n    ``names`` list defines the name of each column. The names will be\n    auto-generated if not provided (either with the ``names`` argument or\n    by |Column| objects). If provided, the ``names`` argument must match the\n    number of items in the ``data`` list. The optional ``dtype`` list\n    will override the existing or default data types and must match\n    ``names`` in length.\n\n**list-of-dicts**\n    Similar to Python's built-in :class:`csv.DictReader`, each item in the\n    ``data`` list provides a row of data values and must be a :class:`dict`.\n    The key values in each :class:`dict` define the column names. The ``names``\n    argument may be supplied to specify column ordering. If ``names`` are not\n    provided then column ordering will be determined by the first :class:`dict`\n    if it contains values for all the columns, or by sorting the column names\n    alphabetically if it does not. The ``dtype`` list may be specified, and\n    must correspond to the order of output columns.\n\n**Table-like object**\n    If another table-like object has a ``__astropy_table__()`` method then\n    that object can be used to directly create a |Table|. See the\n    `table-like objects`_ section for details.\n\n**None**\n    Initialize a zero-length table. If ``names`` and optionally ``dtype``\n    are provided, then the corresponding columns are created.\n\nnames\n-----\n\nThe ``names`` argument provides a way to specify the table column names or\noverride the existing ones. By default, the column names are either taken from\nexisting names (for |ndarray| or |Table| input) or auto-generated as\n``col<N>``. If ``names`` is provided, then it must be a list with the same\nlength as the number of columns. Any list elements with value `None` fall back\nto the default name.\n\nIn the case where ``data`` is provided as a :class:`dict` of columns, the\n``names`` argument can be supplied to specify the order of columns. The\n``names`` list must then contain each of the keys in the ``data``\n:class:`dict`.\n\ndtype\n-----\n\nThe ``dtype`` argument provides a way to specify the table column data types or\noverride the existing types. By default, the types are either taken from\nexisting types (for |ndarray| or |Table| input) or auto-generated by the\n:func:`numpy.array` routine. If ``dtype`` is provided then it must be a list\nwith the same length as the number of columns. The values must be valid\n:class:`numpy.dtype` initializers or `None`. Any list elements with value\n`None` fall back to the default type.\n\nmeta\n----\n\nThe ``meta`` argument is an object that contains metadata associated with the\ntable. It is recommended that this object be a :class:`dict` or\n:class:`~collections.OrderedDict`, but the only firm requirement is that it can\nbe copied with the standard library :func:`copy.deepcopy` routine. By\ndefault, ``meta`` is an empty :class:`~collections.OrderedDict`.\n\ncopy\n----\n\nIn the case where ``data`` is either an |ndarray| object, a :class:`dict`, or\nan existing |Table|, it is possible to use a reference to the existing data by\nsetting ``copy=False``. This has the advantage of reducing memory use and being\nfaster. However, you should take care because any modifications to the new\n|Table| data will also be seen in the original input data. See the `Copy versus\nReference`_ section for more information.\n\nrows\n----\n\nThis argument allows for providing data as a sequence of rows, in contrast\nto the ``data`` keyword, which generally assumes data are a sequence of columns.\nThe `Row data`_ section provides details.\n\ncopy_indices\n------------\n\nIf you are initializing a |Table| from another |Table| that makes use of\n:ref:`table-indexing`, then this option allows copying that table *without*\ncopying the indices by setting ``copy_indices=False``. By default, the indices\nare copied.\n\nunits\n-----\n\nThis allows for setting the unit for one or more columns at the time of\ncreating the table. The input can be either a list of unit values corresponding\nto each of the columns in the table (using `None` or ``''`` for no unit), or a\n:class:`dict` that provides the unit for specified column names. For example::\n\n  >>> dat = [[1, 2], ['hello', 'world']]\n  >>> qt = QTable(dat, names=['a', 'b'], units=(u.m, None))\n  >>> qt = QTable(dat, names=['a', 'b'], units={'a': u.m})\n\nSee :ref:`quantity_and_qtable` for why we used a |QTable| here instead of a\n|Table|.\n\ndescriptions\n------------\n\nThis allows for setting the description for one or more columns at the time of\ncreating the table. The input can be either a list of description values\ncorresponding to each of the columns in the table (using `None` for no\ndescription), or a :class:`dict` that provides the description for specified\ncolumn names. This works in the same way as the ``units`` example above.\n\n.. _copy_versus_reference:\n\nCopy versus Reference\n=====================\n\nNormally when a new |Table| object is created, the input data are *copied*.\nThis ensures that if the new table elements are modified then the original data\nwill not be affected. However, when creating a table from an existing |Table|,\na |ndarray| object (structured or homogeneous) or a :class:`dict`, it is\npossible to disable copying so that a memory reference to the original data is\nused instead. This has the advantage of being faster and using less memory.\nHowever, caution must be exercised because the new table data and original data\nwill be linked, as shown below::\n\n  >>> arr = np.array([(1, 2.0, 'x'),\n  ...                 (4, 5.0, 'y')],\n  ...                dtype=[('a', 'i8'), ('b', 'f8'), ('c', 'S2')])\n  >>> print(arr['a'])  # column \"a\" of the input array\n  [1 4]\n  >>> t = Table(arr, copy=False)\n  >>> t['a'][1] = 99\n  >>> print(arr['a'])  # arr['a'] got changed when we modified t['a']\n  [ 1 99]\n\nNote that when referencing the data it is not possible to change the data types\nsince that operation requires making a copy of the data. In this case an error\noccurs::\n\n  >>> t = Table(arr, copy=False, dtype=('f4', 'i4', 'S4'))\n  Traceback (most recent call last):\n    ...\n  ValueError: Cannot specify dtype when copy=False\n\nAnother caveat to using referenced data is that if you add a new row to the\ntable, the reference to the original data array is lost and the table will now\ninstead hold a copy of the original values (in addition to the new row).\n\nColumn and TableColumns Classes\n===============================\n\nThere are two classes, |Column| and |TableColumns|, that are useful when\nconstructing new tables.\n\nColumn\n------\n\nA |Column| object can be created as follows, where in all cases the column\n``name`` should be provided as a keyword argument and you can optionally provide\nthese values:\n\n``data`` : :class:`list`, |ndarray| or `None`\n    Column data values.\n``dtype`` : :class:`numpy.dtype` compatible value\n    Data type for column.\n``description`` : :class:`str`\n    Full description of column.\n``unit`` : :class:`str`\n    Physical unit.\n``format`` : :class:`str` or function\n    `Format specifier`_ for outputting column values.\n``meta`` : :class:`dict`\n    Metadata associated with the column.\n\nInitialization Options\n^^^^^^^^^^^^^^^^^^^^^^\n\nThe column data values, shape, and data type are specified in one of two ways:\n\n**Provide data but not length or shape**\n\n  Examples::\n\n    col = Column([1, 2], name='a')  # shape=(2,)\n    col = Column([[1, 2], [3, 4]], name='a')  # shape=(2, 2)\n    col = Column([1, 2], name='a', dtype=float)\n    col = Column(np.array([1, 2]), name='a')\n    col = Column(['hello', 'world'], name='a')\n\n  The ``dtype`` argument can be any value which is an acceptable fixed-size\n  data type initializer for a :class:`numpy.dtype`. See the reference for\n  `data type objects\n  <https://numpy.org/doc/stable/reference/arrays.dtypes.html>`_. Examples\n  include:\n\n  - Python non-string type (:class:`float`, :class:`int`, :class:`bool`).\n  - ``numpy`` non-string type (e.g., ``np.float32``, ``np.int64``).\n  - ``numpy.dtype`` array-protocol type strings (e.g., ``'i4'``, ``'f8'``, ``'U15'``).\n\n  If no ``dtype`` value is provided, then the type is inferred using\n  :func:`numpy.array`. When ``data`` is provided then the ``shape``\n  and ``length`` arguments are ignored.\n\n**Provide length and optionally shape, but not data**\n\n  Examples::\n\n    col = Column(name='a', length=5)\n    col = Column(name='a', dtype=int, length=10, shape=(3,4))\n\n  The default ``dtype`` is ``np.float64``. The ``shape`` argument is the array\n  shape of a single cell in the column. The default ``shape`` is ``()`` which means\n  a single value in each element.\n\n.. note::\n\n   After setting the type for a column, that type cannot be changed.\n   If data values of a different type are assigned to the column then they\n   will be cast to the existing column type.\n\n.. _table_format_string:\n\nFormat Specifier\n^^^^^^^^^^^^^^^^\n\nThe format specifier controls the output of column values when a table or column\nis printed or written to an ASCII table. In the simplest case, it is a string\nthat can be passed to Python's built-in :func:`format` function. For more\ncomplicated formatting, one can also give \"old style\" or \"new style\"\nformat strings, or even a function:\n\n**Plain format specification**\n\nThis type of string specifies directly how the value should be formatted\nusing a `format specification mini-language\n<https://docs.python.org/3/library/string.html#formatspec>`_ that is\nquite similar to C.\n\n   ``\".4f\"`` will give four digits after the decimal in float format, or\n\n   ``\"6d\"`` will give integers in six-character fields.\n\n**Old style format string**\n\nThis corresponds to syntax like ``\"%.4f\" % value`` as documented in\n`printf-style String Formatting\n<https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting>`_.\n\n   ``\"%.4f\"`` to print four digits after the decimal in float format, or\n\n   ``\"%6d\"`` to print an integer in a six-character wide field.\n\n**New style format string**\n\nThis corresponds to syntax like ``\"{:.4f}\".format(value)`` as documented in\n`format string syntax\n<https://docs.python.org/3/library/string.html#format-string-syntax>`_.\n\n   ``\"{:.4f}\"`` to print four digits after the decimal in float format, or\n\n   ``\"{:6d}\"`` to print an integer in a six-character wide field.\n\nNote that in either format string case any Python string that formats exactly\none value is valid, so ``{:.4f} angstroms`` or ``Value: %12.2f`` would both\nwork.\n\n**Function**\n\n.. EXAMPLE START: Initialization Options for Column Objects\n\nThe greatest flexibility can be achieved by setting a formatting function. This\nfunction must accept a single argument (the value) and return a string. In the\nfollowing example this is used to make a LaTeX ready output::\n\n    >>> t = Table([[1,2],[1.234e9,2.34e-12]], names = ('a','b'))\n    >>> def latex_exp(value):\n    ...     val = f'{value:8.2}'\n    ...     mant, exp = val.split('e')\n    ...     # remove leading zeros\n    ...     exp = exp[0] + exp[1:].lstrip('0')\n    ...     return f'$ {mant} \\\\times 10^{{ {exp} }}$'\n    >>> t['b'].format = latex_exp\n    >>> t['a'].format = '.4f'\n    >>> import sys\n    >>> t.write(sys.stdout, format='latex')\n    \\begin{table}\n    \\begin{tabular}{cc}\n    a & b \\\\\n    1.0000 & $  1.2 \\times 10^{ +9 }$ \\\\\n    2.0000 & $  2.3 \\times 10^{ -12 }$ \\\\\n    \\end{tabular}\n    \\end{table}\n\n.. EXAMPLE END\n\nTableColumns\n------------\n\nEach |Table| object has an attribute ``columns`` which is an ordered dictionary\nthat stores all of the |Column| objects in the table (see also the `Column`_\nsection). Technically, the ``columns`` attribute is a |TableColumns| object,\nwhich is an enhanced ordered dictionary that provides easier ways to select\nmultiple columns. There are a few key points to remember:\n\n- A |Table| can be initialized from a |TableColumns| object (``copy`` is always\n  `True`).\n- Selecting multiple columns from a |TableColumns| object returns another\n  |TableColumns| object.\n- Selecting one column from a |TableColumns| object returns a |Column|.\n\nThere are a few different ways to select columns from a |TableColumns| object:\n\n**Select columns by name**\n::\n\n  >>> t = Table(names=('a', 'b', 'c', 'd'))\n\n  >>> t.columns['d', 'c', 'b']\n  <TableColumns names=('d','c','b')>\n\n**Select columns by index slicing**\n::\n\n  >>> t.columns[0:2]  # Select first two columns\n  <TableColumns names=('a','b')>\n\n  >>> t.columns[::-1]  # Reverse column order\n  <TableColumns names=('d','c','b','a')>\n\n**Select single columns by index or name**\n::\n\n  >>> t.columns[1]  # Choose a column by index\n  <Column name='b' dtype='float64' length=0>\n\n  >>> t.columns['b']  # Choose a column by name\n  <Column name='b' dtype='float64' length=0>\n\n.. _subclassing_table:\n\nSubclassing Table\n=================\n\nFor some applications it can be useful to subclass the |Table| class in order\nto introduce specialized behavior. Here we address two particular use cases\nfor subclassing: adding custom table attributes and changing the behavior of\ninternal class objects.\n\n.. _table-custom-attributes:\n\nAdding Custom Table Attributes\n------------------------------\n\nOne simple customization that can be useful is adding new attributes to\nthe table object.  There is nothing preventing setting an attribute on an\nexisting table object, for example ``t.foo = 'hello'``.  However, this attribute\nwould be ephemeral because it will be lost if the table is sliced, copied, or\npickled. Instead, you can add persistent attributes as shown in this example::\n\n  from astropy.table import Table, TableAttribute\n\n  class MyTable(Table):\n      foo = TableAttribute()\n      bar = TableAttribute(default=[])\n      baz = TableAttribute(default=1)\n\n  t = MyTable([[1, 2]], foo='foo')\n  t.bar.append(2.0)\n  t.baz = 'baz'\n\nSome key points:\n\n- A custom attribute can be set when the table is created or using\n  the usual syntax for setting an object attribute.\n- A custom attribute always has a default value, either explicitly set\n  in the class definition or `None`.\n- The attribute values are stored in the table ``meta`` dictionary. This is\n  the mechanism by which they are persistent through copy, slice, and\n  serialization such as pickling or writing to an :ref:`ecsv_format` file.\n\nChanging Behavior of Internal Class Objects\n-------------------------------------------\n\nIt is also possible to change the behavior of the internal class objects which\nare contained or created by a |Table|. This includes rows, columns, formatting,\nand the columns container. In order to do this the subclass needs to declare\nwhat class to use (if it is different from the built-in version). This is done\nby specifying one or more of the class attributes ``Row``, ``Column``,\n``MaskedColumn``, ``TableColumns``, or ``TableFormatter``.\n\nThe following trivial example overrides all of these with do-nothing\nsubclasses, but in practice you would override only the necessary\nsubcomponents::\n\n  >>> from astropy.table import Table, Row, Column, MaskedColumn, TableColumns, TableFormatter\n\n  >>> class MyRow(Row): pass\n  >>> class MyColumn(Column): pass\n  >>> class MyMaskedColumn(MaskedColumn): pass\n  >>> class MyTableColumns(TableColumns): pass\n  >>> class MyTableFormatter(TableFormatter): pass\n\n  >>> class MyTable(Table):\n  ...     \"\"\"\n  ...     Custom subclass of astropy.table.Table\n  ...     \"\"\"\n  ...     Row = MyRow  # Use MyRow to create a row object\n  ...     Column = MyColumn  # Column\n  ...     MaskedColumn = MyMaskedColumn  # Masked Column\n  ...     TableColumns = MyTableColumns  # Ordered dict holding Column objects\n  ...     TableFormatter = MyTableFormatter  # Controls table output\n\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Subclassing the Table Class\n\nAs a more practical example, suppose you have a table of data with a certain\nset of fixed columns, but you also want to carry an arbitrary dictionary of\nparameters for each row and then access those values using the same item access\nsyntax as if they were columns. It is assumed here that the extra parameters\nare contained in a ``numpy`` object-dtype column named ``params``::\n\n  >>> from astropy.table import Table, Row\n  >>> class ParamsRow(Row):\n  ...    \"\"\"\n  ...    Row class that allows access to an arbitrary dict of parameters\n  ...    stored as a dict object in the ``params`` column.\n  ...    \"\"\"\n  ...    def __getitem__(self, item):\n  ...        if item not in self.colnames:\n  ...            return super().__getitem__('params')[item]\n  ...        else:\n  ...            return super().__getitem__(item)\n  ...\n  ...    def keys(self):\n  ...        out = [name for name in self.colnames if name != 'params']\n  ...        params = [key.lower() for key in sorted(self['params'])]\n  ...        return out + params\n  ...\n  ...    def values(self):\n  ...        return [self[key] for key in self.keys()]\n\nNow we put this into action with a trivial |Table| subclass::\n\n  >>> class ParamsTable(Table):\n  ...     Row = ParamsRow\n\nFirst make a table and add a couple of rows::\n\n  >>> t = ParamsTable(names=['a', 'b', 'params'], dtype=['i', 'f', 'O'])\n  >>> t.add_row((1, 2.0, {'x': 1.5, 'y': 2.5}))\n  >>> t.add_row((2, 3.0, {'z': 'hello', 'id': 123123}))\n  >>> print(t)\n   a   b             params\n  --- --- ----------------------------\n    1 2.0         {'x': 1.5, 'y': 2.5}\n    2 3.0 {'z': 'hello', 'id': 123123}\n\nNow see what we have from our specialized ``ParamsRow`` object::\n\n  >>> t[0]['y']\n  2.5\n  >>> t[1]['id']\n  123123\n  >>> t[1].keys()\n  ['a', 'b', 'id', 'z']\n  >>> t[1].values()\n  [2, 3.0, 123123, 'hello']\n\nTo make this example really useful, you might want to override\n``Table.__getitem__()`` in order to allow table-level access to the parameter\nfields. This might look something like::\n\n  class ParamsTable(table.Table):\n      Row = ParamsRow\n\n      def __getitem__(self, item):\n          if isinstance(item, str):\n              if item in self.colnames:\n                  return self.columns[item]\n              else:\n                  # If item is not a column name then create a new MaskedArray\n                  # corresponding to self['params'][item] for each row.  This\n                  # might not exist in some rows so mark as masked (missing) in\n                  # those cases.\n                  mask = np.zeros(len(self), dtype=np.bool_)\n                  item = item.upper()\n                  values = [params.get(item) for params in self['params']]\n                  for ii, value in enumerate(values):\n                      if value is None:\n                          mask[ii] = True\n                          values[ii] = ''\n                  return self.MaskedColumn(name=item, data=values, mask=mask)\n\n          # ... and then the rest of the original __getitem__ ...\n\n.. EXAMPLE END\n\nColumns and Quantities\n======================\n\n.. EXAMPLE START: Handling Astropy Column and Quantity Objects within Tables\n\n``astropy`` `~astropy.units.Quantity` objects can be handled within tables in\ntwo complementary ways. The first method stores the `~astropy.units.Quantity`\nobject natively within the table via the \"mixin\" column protocol. See the\nsections on :ref:`mixin_columns` and :ref:`quantity_and_qtable` for details,\nbut in brief, the key difference is using the `~astropy.table.QTable` class to\nindicate that a `~astropy.units.Quantity` should be stored natively within the\ntable::\n\n  >>> from astropy.table import QTable\n  >>> from astropy import units as u\n  >>> t = QTable()\n  >>> t['velocity'] = [3, 4] * u.m / u.s\n  >>> type(t['velocity'])\n  <class 'astropy.units.quantity.Quantity'>\n\nFor new code that is quantity-aware we recommend using `~astropy.table.QTable`,\nbut this may not be possible in all situations (particularly when interfacing\nwith legacy code that does not handle quantities) and there are\n:ref:`details_and_caveats` that apply. In this case, use the\n`~astropy.table.Table` class, which will convert a `~astropy.units.Quantity` to\na `~astropy.table.Column` object with a ``unit`` attribute::\n\n  >>> from astropy.table import Table\n  >>> t = Table()\n  >>> t['velocity'] = [3, 4] * u.m / u.s\n  >>> type(t['velocity'])\n  <class 'astropy.table.column.Column'>\n  >>> t['velocity'].unit\n  Unit(\"m / s\")\n\nTo learn more about using standard `~astropy.table.Column` objects with defined\nunits, see the :ref:`columns_with_units` section.\n\n.. EXAMPLE END\n\n.. _Table-like Objects:\n\nTable-like Objects\n==================\n\nIn order to improve interoperability between different table classes, an\n``astropy`` |Table| object can be created directly from any other table-like\nobject that provides an ``__astropy_table__()`` method. In this case the\n``__astropy_table__()`` method will be called as follows::\n\n  >>> data = SomeOtherTableClass({'a': [1, 2], 'b': [3, 4]})  # doctest: +SKIP\n  >>> t = QTable(data, copy=False, strict_copy=True)  # doctest: +SKIP\n\nInternally the following call will be made to ask the ``data`` object\nto return a representation of itself as an ``astropy`` |Table|, respecting\nthe ``copy`` preference of the original call to ``QTable()``::\n\n  data.__astropy_table__(cls, copy, **kwargs)\n\nHere ``cls`` is the |Table| class or subclass that is being instantiated\n(|QTable| in this example), ``copy`` indicates whether a copy of the values in\n``data`` should be provided, and ``**kwargs`` are any extra keyword arguments\nwhich are not valid |Table| ``_init_()`` keyword arguments. In the example\nabove, ``strict_copy=True`` would end up in ``**kwargs`` and get passed to\n``__astropy_table__()``.\n\nIf ``copy`` is `True` then the ``__astropy_table__()`` method must ensure that\na copy of the original data is returned. If ``copy`` is `False` then a\nreference to the table data should be returned if possible. If it is not\npossible (e.g., the original data are in a Python list or must be otherwise\ntransformed in memory) then ``__astropy_table__()`` method is free to either\nreturn a copy or else raise an exception. This choice depends on the preference\nof the implementation. The implementation might choose to allow an additional\nkeyword argument (e.g., ``strict_copy`` which gets passed via ``**kwargs``) to\ncontrol the behavior in this case.\n\nAs a concise example, imagine a dict-based table class. (Note that |Table|\nalready can be initialized from a dict-like object, so this is a bit contrived\nbut does illustrate the principles involved.) Please pay attention to the\nmethod signature::\n\n  def __astropy_table__(self, cls, copy, **kwargs):\n\nYour class implementation of this must use the ``**kwargs`` technique for\ncatching keyword arguments at the end. This is to ensure future compatibility\nin case additional keywords are added to the internal ``table =\ndata.__astropy_table__(cls, copy)`` call. Including ``**kwargs`` will prevent\nbreakage in this case. ::\n\n  class DictTable(dict):\n      \"\"\"\n      Trivial \"table\" class that just uses a dict to hold columns.\n      This does not actually implement anything useful that makes\n      this a table.\n\n      The non-standard ``strict_copy=False`` keyword arg here will be passed\n      via the **kwargs of Table __init__().\n      \"\"\"\n\n      def __astropy_table__(self, cls, copy, strict_copy=False, **kwargs):\n          \"\"\"\n          Return an astropy Table of type ``cls``.\n\n          Parameters\n          ----------\n          cls : type\n               Astropy ``Table`` class or subclass.\n          copy : bool\n               Copy input data (True) or return a reference (False).\n          strict_copy : bool, optional\n               Raise an exception if copy is False but reference is not\n               possible.\n          **kwargs : dict, optional\n               Additional keyword args (ignored currently).\n          \"\"\"\n          if kwargs:\n              warnings.warn(f'unexpected keyword args {kwargs}')\n\n          cols = list(self.values())\n          names = list(self.keys())\n\n          # If returning a reference to existing data (copy=False) and\n          # strict_copy=True, make sure that each column is a numpy ndarray.\n          # If a column is a Python list or tuple then it must be copied for\n          # representation in an astropy Table.\n\n          if not copy and strict_copy:\n              for name, col in zip(names, cols):\n                  if not isinstance(col, np.ndarray):\n                      raise ValueError(f'cannot have copy=False because column {name} is '\n                                       'not an ndarray')\n\n          return cls(cols, names=names, copy=copy)\n"},{"id":165,"name":"performance.inc.rst","nodeType":"TextFile","path":"docs/table","text":".. note that if this is changed from the default approach of using an *include*\n   (in index.rst) to a separate performance page, the header needs to be changed\n   from === to ***, the filename extension needs to be changed from .inc.rst to\n   .rst, and a link needs to be added in the subpackage toctree\n\n.. doctest-skip-all\n\n.. _astropy-table-performance:\n\nPerformance Tips\n================\n\nConstructing |Table| objects row by row using\n:meth:`~astropy.table.Table.add_row` can be very slow::\n\n    >>> from astropy.table import Table\n    >>> t = Table(names=['a', 'b'])\n    >>> for i in range(100):\n    ...     t.add_row((1, 2))\n\nIf you do need to loop in your code to create the rows, a much faster approach\nis to construct a list of rows and then create the |Table| object at the very\nend::\n\n  >>> rows = []\n  >>> for i in range(100):\n  ...     rows.append((1, 2))\n  >>> t = Table(rows=rows, names=['a', 'b'])\n\nWriting a |Table| with |MaskedColumn| to ``.ecsv`` using\n:meth:`~astropy.table.Table.write` can be very slow::\n\n    >>> from astropy.table import Table\n    >>> import numpy as np\n    >>> x = np.arange(10000, dtype=float)\n    >>> tm = Table([x], masked=True)\n    >>> tm.write('tm.ecsv', overwrite=True)\n\nIf you want to write ``.ecsv`` using :meth:`~astropy.table.Table.write`,\nthen use ``serialize_method='data_mask'``.\nThis uses the non-masked version of data and it is faster::\n\n    >>> tm.write('tm.ecsv', overwrite=True, serialize_method='data_mask')\n\nRead FITS with memmap=True\n--------------------------\n\nBy default :meth:`~astropy.table.Table.read` will read the whole table into\nmemory, which can take a lot of memory and can take a lot of time, depending on\nthe table size and file format. In some cases, it is possible to only read a\nsubset of the table by choosing the option ``memmap=True``.\n\nFor FITS binary tables, the data is stored row by row, and it is possible to\nread only a subset of rows, but reading a full column loads the whole table data\ninto memory::\n\n    >>> import numpy as np\n    >>> from astropy.table import Table\n    >>> tbl = Table({'a': np.arange(1e7),\n    ...              'b': np.arange(1e7, dtype=float),\n    ...              'c': np.arange(1e7, dtype=float)})\n    >>> tbl.write('test.fits', overwrite=True)\n    >>> table = Table.read('test.fits', memmap=True)  # Very fast, doesn't actually load data\n    >>> table2 = tbl[:100]  # Fast, will read only first 100 rows\n    >>> print(table2)  # Accessing column data triggers the read\n     a    b    c\n    ---- ---- ----\n    0.0  0.0  0.0\n    1.0  1.0  1.0\n    2.0  2.0  2.0\n    ...  ...  ...\n    98.0 98.0 98.0\n    99.0 99.0 99.0\n    Length = 100 rows\n    >>> col = table['my_column']  # Will load all table into memory\n\n:meth:`~astropy.table.Table.read` does not support ``memmap=True``\nfor the HDF5 and ASCII file formats.\n"},{"id":166,"name":"docs/units","nodeType":"Package"},{"id":167,"name":"combining_and_defining.rst","nodeType":"TextFile","path":"docs/units","text":"Combining and Defining Units\n****************************\n\nBasic example\n=============\n\n.. EXAMPLE START: Combining Units and Quantities\n\nUnits and quantities can be combined together using the regular Python\nnumeric operators::\n\n  >>> from astropy import units as u\n  >>> fluxunit = u.erg / (u.cm ** 2 * u.s)\n  >>> fluxunit\n  Unit(\"erg / (cm2 s)\")\n  >>> 52.0 * fluxunit  # doctest: +FLOAT_CMP\n  <Quantity  52. erg / (cm2 s)>\n  >>> 52.0 * fluxunit / u.s  # doctest: +FLOAT_CMP\n  <Quantity  52. erg / (cm2 s2)>\n\n.. EXAMPLE END\n\nFractional powers\n=================\n\n.. EXAMPLE START: Using Fractional Powers with Units\n\nUnits support fractional powers, which retain their precision through\ncomplex operations. To do this, it is recommended to use\n:class:`fractions.Fraction` objects::\n\n  >>> from fractions import Fraction\n  >>> Franklin = u.g ** Fraction(1, 2) * u.cm ** Fraction(3, 2) * u.s ** -1\n\n.. note::\n\n    Floating-point powers that are effectively the same as fractions\n    with a denominator less than 10 are implicitly converted to\n    `~fractions.Fraction` objects under the hood. Therefore, the\n    following are equivalent::\n\n        >>> x = u.m ** Fraction(1, 3)\n        >>> x.powers\n        [Fraction(1, 3)]\n        >>> x = u.m ** (1. / 3.)\n        >>> x.powers\n        [Fraction(1, 3)]\n\n.. EXAMPLE END\n\nDefining units\n==============\n\n.. EXAMPLE START: Defining New Units\n\nUsers are free to define new units, either fundamental or compound,\nusing the :func:`~astropy.units.def_unit` function::\n\n  >>> bakers_fortnight = u.def_unit('bakers_fortnight', 13 * u.day)\n\nThe addition of a string gives the new unit a name that will show up\nwhen the unit is printed::\n\n  >>> 10. * bakers_fortnight  # doctest: +FLOAT_CMP\n  <Quantity  10. bakers_fortnight>\n\nCreating a new fundamental unit is also possible::\n\n  >>> titter = u.def_unit('titter')\n  >>> chuckle = u.def_unit('chuckle', 5 * titter)\n  >>> laugh = u.def_unit('laugh', 4 * chuckle)\n  >>> guffaw = u.def_unit('guffaw', 3 * laugh)\n  >>> rofl = u.def_unit('rofl', 4 * guffaw)\n  >>> death_by_laughing = u.def_unit('death_by_laughing', 10 * rofl)\n  >>> (1. * rofl).to(titter)  # doctest: +FLOAT_CMP\n  <Quantity  240. titter>\n\nUsers can see the definition of a unit and its :ref:`decomposition\n<decomposing>` via::\n\n  >>> rofl.represents\n  Unit(\"4 guffaw\")\n  >>> rofl.decompose()\n  Unit(\"240 titter\")\n\nBy default, custom units are not searched by methods such as\n:meth:`~astropy.units.core.UnitBase.find_equivalent_units`. However, they\ncan be enabled by calling :func:`~astropy.units.add_enabled_units`::\n\n  >>> kmph = u.def_unit('kmph', u.km / u.h)\n  >>> (u.m / u.s).find_equivalent_units()\n  There are no equivalent units\n  >>> u.add_enabled_units([kmph])\n  <astropy.units.core._UnitContext object at ...>\n  >>> (u.m / u.s).find_equivalent_units()\n    Primary name | Unit definition | Aliases\n  [\n    kmph         | 0.277778 m / s  |         ,\n  ]\n\n.. EXAMPLE END\n"},{"id":168,"name":"decomposing_and_composing.rst","nodeType":"TextFile","path":"docs/units","text":"Decomposing and Composing Units\n*******************************\n\n.. _decomposing:\n\nReducing a Unit to Its Irreducible Parts\n========================================\n\nA unit or quantity can be decomposed into its irreducible parts using\nthe `Unit.decompose() <astropy.units.core.UnitBase.decompose>` or\n`Quantity.decompose() <astropy.units.quantity.Quantity.decompose>`\nmethods.\n\nExamples\n--------\n\n.. EXAMPLE START: Reducing a Unit to Its Irreducible Parts\n\nTo decompose a unit with :meth:`~astropy.units.core.UnitBase.decompose`::\n\n  >>> from astropy import units as u\n  >>> u.Ry\n  Unit(\"Ry\")\n  >>> u.Ry.decompose()\n  Unit(\"2.17987e-18 kg m2 / s2\")\n\nYou can limit the selection of units that you want to decompose by\nusing the ``bases`` keyword argument::\n\n  >>> u.Ry.decompose(bases=[u.m, u.N])\n  Unit(\"2.17987e-18 m N\")\n\nThis is also useful to decompose to a particular system. For example,\nto decompose the Rydberg unit of energy in terms of `CGS\n<https://en.wikipedia.org/wiki/Centimetre-gram-second_system_of_units>`_\nunits::\n\n  >>> u.Ry.decompose(bases=u.cgs.bases)\n  Unit(\"2.17987e-11 cm2 g / s2\")\n\nFinally, if you want to know how a unit was defined::\n\n  >>> u.Ry.represents\n  Unit(\"13.6057 eV\")\n\n.. EXAMPLE END\n\nAutomatically Composing a Unit into More Complex Units\n======================================================\n\nConversely, a unit may be recomposed back into more complex units\nusing the :meth:`~astropy.units.core.UnitBase.compose` method. Since there\nmay be multiple equally good results, a list is always returned.\n\nExamples\n--------\n\n.. EXAMPLE START: Recomposing a Unit into More Complex Units\n\nTo recompose a unit with :meth:`~astropy.units.core.UnitBase.compose`::\n\n  >>> x = u.Ry.decompose()\n  >>> x.compose()\n  [Unit(\"Ry\"),\n   Unit(\"2.17987e-18 J\"),\n   Unit(\"2.17987e-11 erg\"),\n   Unit(\"13.6057 eV\")]\n\nSome other interesting examples::\n\n   >>> (u.s ** -1).compose()  # doctest: +SKIP\n   [Unit(\"Bq\"), Unit(\"Hz\"), Unit(\"2.7027e-11 Ci\")]\n\nComposition can be combined with :ref:`unit_equivalencies`::\n\n   >>> (u.s ** -1).compose(equivalencies=u.spectral())  # doctest: +SKIP\n   [Unit(\"m\"),\n    Unit(\"Hz\"),\n    Unit(\"J\"),\n    Unit(\"Bq\"),\n    Unit(\"3.24078e-17 pc\"),\n    Unit(\"1.057e-16 lyr\"),\n    Unit(\"6.68459e-12 AU\"),\n    Unit(\"1.4378e-09 solRad\"),\n    Unit(\"0.01 k\"),\n    Unit(\"100 cm\"),\n    Unit(\"1e+06 micron\"),\n    Unit(\"1e+07 erg\"),\n    Unit(\"1e+10 Angstrom\"),\n    Unit(\"3.7e+10 Ci\"),\n    Unit(\"4.58743e+17 Ry\"),\n    Unit(\"6.24151e+18 eV\")]\n\nA name does not exist for every arbitrary derived unit\nimaginable. In that case, the system will do its best to reduce the\nunit to the fewest possible symbols::\n\n   >>> (u.cd * u.sr * u.V * u.s).compose()\n   [Unit(\"lm Wb\")]\n\n.. EXAMPLE END\n\nConverting Between Systems\n==========================\n\nBuilt on top of this functionality is a convenience method to convert\nbetween unit systems.\n\nExamples\n--------\n\n.. EXAMPLE START: Converting Between Unit Systems\n\nTo convert between unit systems::\n\n   >>> u.Pa.to_system(u.cgs)\n   [Unit(\"10 P / s\"), Unit(\"10 Ba\")]\n\nThere is also a shorthand for this which only returns the first of\nmany possible matches::\n\n   >>> u.Pa.cgs\n   Unit(\"10 P / s\")\n\nThis is equivalent to decomposing into the new system and then\ncomposing into the most complex units possible, though\n:meth:`~astropy.units.core.UnitBase.to_system` adds some extra logic to\nreturn the results sorted in the most useful order::\n\n   >>> u.Pa.decompose(bases=u.cgs.bases)\n   Unit(\"10 g / (cm s2)\")\n   >>> _.compose(units=u.cgs)\n   [Unit(\"10 Ba\"), Unit(\"10 P / s\")]\n\n.. EXAMPLE END\n"},{"id":169,"name":"quantity.rst","nodeType":"TextFile","path":"docs/units","text":".. _quantity:\n\nQuantity\n********\n\nThe |Quantity| object is meant to represent a value that has some unit\nassociated with the number.\n\nCreating Quantity Instances\n===========================\n\n|Quantity| objects are normally created through multiplication with\n:class:`~astropy.units.Unit` objects.\n\nExamples\n--------\n\n.. EXAMPLE START: Creating Quantity Instances Through Multiplication\n\nTo create a |Quantity| to represent 15 m/s:\n\n    >>> import astropy.units as u\n    >>> 15 * u.m / u.s  # doctest: +FLOAT_CMP\n    <Quantity 15. m / s>\n\nThis extends as expected to division by a unit, or using ``numpy`` arrays or\n`Python sequences <https://docs.python.org/3/library/stdtypes.html#typesseq>`_:\n\n    >>> 1.25 / u.s\n    <Quantity 1.25 1 / s>\n    >>> [1, 2, 3] * u.m  # doctest: +FLOAT_CMP\n    <Quantity [1., 2., 3.] m>\n    >>> import numpy as np\n    >>> np.array([1, 2, 3]) * u.m  # doctest: +FLOAT_CMP\n    <Quantity [1., 2., 3.] m>\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Creating Quantity Instances Using the Quantity Constructor\n\nYou can also create instances using the |Quantity| constructor directly, by\nspecifying a value and unit:\n\n    >>> u.Quantity(15, u.m / u.s)  # doctest: +FLOAT_CMP\n    <Quantity 15. m / s>\n\nThe constructor gives a few more options. In particular, it allows you to\nmerge sequences of |Quantity| objects (as long as all of their units are\nequivalent), and to parse simple strings (which may help, for example, to parse\nconfiguration files, etc.):\n\n    >>> qlst = [60 * u.s, 1 * u.min]\n    >>> u.Quantity(qlst, u.minute)  # doctest: +FLOAT_CMP\n    <Quantity [1.,  1.] min>\n    >>> u.Quantity('15 m/s')  # doctest: +FLOAT_CMP\n    <Quantity 15. m / s>\n\nThe current unit and value can be accessed via the\n`~astropy.units.quantity.Quantity.unit` and\n`~astropy.units.quantity.Quantity.value` attributes:\n\n    >>> q = 2.5 * u.m / u.s\n    >>> q.unit\n    Unit(\"m / s\")\n    >>> q.value\n    2.5\n\n.. note:: |Quantity| objects are converted to float by default. Furthermore, any\n          data passed in are copied, which for large arrays may not be optimal.\n          As discussed :ref:`further below <astropy-units-quantity-no-copy>`,\n          you can instead obtain a `view\n          <https://numpy.org/doc/stable/glossary.html#term-view>`_ by passing\n          ``copy=False`` to |Quantity| or by using the ``<<`` operator.\n\n.. EXAMPLE END\n\n.. _quantity_unit_conversion:\n\nConverting to Different Units\n=============================\n\n|Quantity| objects can be converted to different units using the\n:meth:`~astropy.units.quantity.Quantity.to` method.\n\nExamples\n--------\n\n.. EXAMPLE START: Converting Quantity Objects to Different Units\n\nTo convert |Quantity| objects to different units:\n\n    >>> q = 2.3 * u.m / u.s\n    >>> q.to(u.km / u.h)  # doctest: +FLOAT_CMP\n    <Quantity 8.28 km / h>\n\nFor convenience, the :attr:`~astropy.units.quantity.Quantity.si` and\n:attr:`~astropy.units.quantity.Quantity.cgs` attributes can be used to convert\nthe |Quantity| to base `SI\n<https://www.bipm.org/documents/20126/41483022/SI-Brochure-9-EN.pdf>`_ or `CGS\n<https://en.wikipedia.org/wiki/Centimetre-gram-second_system_of_units>`_ units:\n\n    >>> q = 2.4 * u.m / u.s\n    >>> q.si  # doctest: +FLOAT_CMP\n    <Quantity 2.4 m / s>\n    >>> q.cgs  # doctest: +FLOAT_CMP\n    <Quantity 240. cm / s>\n\nIf you want the value of the quantity in a different unit, you can use\n:meth:`~astropy.units.Quantity.to_value` as a shortcut:\n\n    >>> q = 2.5 * u.m\n    >>> q.to_value(u.cm)\n    250.0\n\n.. note:: You could get the value in ``cm`` also by using ``q.to(u.cm).value``.\n          The difference is that :meth:`~astropy.units.Quantity.to_value` does\n          no copying if the unit is already the correct one, instead\n          returning a `view\n          <https://numpy.org/doc/stable/glossary.html#term-view>`_  of the data\n          (just as if you had done ``q.value``). In contrast,\n          :meth:`~astropy.units.Quantity.to` always returns a copy (which also\n          means it is slower for the case where no conversion is necessary).\n          As discussed :ref:`further below <astropy-units-quantity-no-copy>`,\n          you can avoid the copying by using the ``<<`` operator.\n\nComparing Quantities\n====================\n\nThe equality of |Quantity| objects is best tested using the\n:func:`~astropy.units.allclose` and :func:`~astropy.units.isclose` functions,\nwhich are unit-aware analogues of the ``numpy`` functions with the same name::\n\n    >>> u.allclose([1, 2] * u.m, [100, 200] * u.cm)\n    True\n    >>> u.isclose([1, 2] * u.m, [100, 20] * u.cm)\n    array([ True, False])\n\nThe use of `Python comparison operators\n<https://docs.python.org/3/reference/expressions.html#comparisons>`_ is also\nsupported::\n\n    >>> 1*u.m < 50*u.cm\n    False\n\nPlotting Quantities\n===================\n\n|Quantity| objects can be conveniently plotted using `Matplotlib`_ — see\n:ref:`plotting-quantities` for more details.\n\n.. _quantity_arithmetic:\n\nArithmetic\n==========\n\nAddition and Subtraction\n------------------------\n\nAddition or subtraction between |Quantity| objects is supported when their\nunits are equivalent.\n\nExamples\n^^^^^^^^\n\n.. EXAMPLE START: Addition and Subtraction Between Quantity Objects\n\nWhen the units are equal, the resulting object has the same unit:\n\n    >>> 11 * u.s + 30 * u.s  # doctest: +FLOAT_CMP\n    <Quantity 41. s>\n    >>> 30 * u.s - 11 * u.s  # doctest: +FLOAT_CMP\n    <Quantity 19. s>\n\nIf the units are equivalent, but not equal (e.g., kilometer and meter), the\nresulting object **has units of the object on the left**:\n\n    >>> 1100.1 * u.m + 13.5 * u.km\n    <Quantity 14600.1 m>\n    >>> 13.5 * u.km + 1100.1 * u.m  # doctest: +FLOAT_CMP\n    <Quantity 14.6001 km>\n    >>> 1100.1 * u.m - 13.5 * u.km\n    <Quantity -12399.9 m>\n    >>> 13.5 * u.km - 1100.1 * u.m  # doctest: +FLOAT_CMP\n    <Quantity 12.3999 km>\n\nAddition and subtraction are not supported between |Quantity| objects and basic\nnumeric types, except for dimensionless quantities (see `Dimensionless\nQuantities`_) or special values like zero and infinity::\n\n    >>> 13.5 * u.km + 19.412  # doctest: +IGNORE_EXCEPTION_DETAIL\n    Traceback (most recent call last):\n      ...\n    UnitConversionError: Can only apply 'add' function to dimensionless\n    quantities when other argument is not a quantity (unless the\n    latter is all zero/infinity/nan)\n\n.. EXAMPLE END\n\nMultiplication and Division\n---------------------------\n\nMultiplication and division are supported between |Quantity| objects with any\nunits, and with numeric types. For these operations between objects with\nequivalent units, the **resulting object has composite units**.\n\nExamples\n^^^^^^^^\n\n.. EXAMPLE START: Multiplication and Division Between Quantity Objects\n\nTo perform these operations on |Quantity| objects:\n\n    >>> 1.1 * u.m * 140.3 * u.cm  # doctest: +FLOAT_CMP\n    <Quantity 154.33 cm m>\n    >>> 140.3 * u.cm * 1.1 * u.m  # doctest: +FLOAT_CMP\n    <Quantity 154.33 cm m>\n    >>> 1. * u.m / (20. * u.cm)  # doctest: +FLOAT_CMP\n    <Quantity 0.05 m / cm>\n    >>> 20. * u.cm / (1. * u.m)  # doctest: +FLOAT_CMP\n    <Quantity 20. cm / m>\n\nFor multiplication, you can change how to represent the resulting object by\nusing the :meth:`~astropy.units.quantity.Quantity.to` method:\n\n    >>> (1.1 * u.m * 140.3 * u.cm).to(u.m**2)  # doctest: +FLOAT_CMP\n    <Quantity 1.5433 m2>\n    >>> (1.1 * u.m * 140.3 * u.cm).to(u.cm**2)  # doctest: +FLOAT_CMP\n    <Quantity 15433. cm2>\n\nFor division, if the units are equivalent, you may want to make the resulting\nobject dimensionless by reducing the units. To do this, use the\n:meth:`~astropy.units.quantity.Quantity.decompose()` method:\n\n    >>> (20. * u.cm / (1. * u.m)).decompose()  # doctest: +FLOAT_CMP\n    <Quantity 0.2>\n\nThis method is also useful for more complicated arithmetic:\n\n    >>> 15. * u.kg * 32. * u.cm * 15 * u.m / (11. * u.s * 1914.15 * u.ms)  # doctest: +FLOAT_CMP\n    <Quantity 0.34195097 cm kg m / (ms s)>\n    >>> (15. * u.kg * 32. * u.cm * 15 * u.m / (11. * u.s * 1914.15 * u.ms)).decompose()  # doctest: +FLOAT_CMP\n    <Quantity 3.41950973 kg m2 / s2>\n\n.. EXAMPLE END\n\n.. _quantity_and_numpy:\n\nNumPy Functions\n===============\n\n|Quantity| objects are actually full ``numpy`` arrays (the |Quantity| class\ninherits from and extends :class:`numpy.ndarray`), and we have tried to ensure\nthat ``numpy`` functions behave properly with quantities:\n\n    >>> q = np.array([1., 2., 3., 4.]) * u.m / u.s\n    >>> np.mean(q)\n    <Quantity 2.5 m / s>\n    >>> np.std(q)  # doctest: +FLOAT_CMP\n    <Quantity 1.11803399 m / s>\n\nThis includes functions that only accept specific units such as angles:\n\n    >>> q = 30. * u.deg\n    >>> np.sin(q)  # doctest: +FLOAT_CMP\n    <Quantity 0.5>\n\nOr `Dimensionless Quantities`_::\n\n    >>> from astropy.constants import h, k_B\n    >>> nu = 3 * u.GHz\n    >>> T = 30 * u.K\n    >>> np.exp(-h * nu / (k_B * T))  # doctest: +FLOAT_CMP\n    <Quantity 0.99521225>\n\n.. note:: Support for functions from other packages, such as `scipy`_, is more\n          incomplete (contributions to improve this are welcomed!).\n\nDimensionless Quantities\n========================\n\nDimensionless quantities have the characteristic that if they are\nadded to or subtracted from a Python scalar or unitless `~numpy.ndarray`,\nor if they are passed to a ``numpy`` function that takes dimensionless\nquantities, the units are simplified so that the quantity is\ndimensionless and scale-free. For example:\n\n    >>> 1. + 1. * u.m / u.km  # doctest: +FLOAT_CMP\n    <Quantity 1.001>\n\nWhich is different from:\n\n    >>> 1. + (1. * u.m / u.km).value\n    2.0\n\nIn the latter case, the result is ``2.0`` because the unit of ``(1. * u.m /\nu.km)`` is not scale-free by default:\n\n    >>> q = (1. * u.m / u.km)\n    >>> q.unit\n    Unit(\"m / km\")\n    >>> q.unit.decompose()\n    Unit(dimensionless with a scale of 0.001)\n\nHowever, when combining with an object that is not a |Quantity|, the unit is\nautomatically decomposed to be scale-free, giving the expected result.\n\nThis also occurs when passing dimensionless quantities to functions that take\ndimensionless quantities:\n\n    >>> nu = 3 * u.GHz\n    >>> T = 30 * u.K\n    >>> np.exp(- h * nu / (k_B * T))  # doctest: +FLOAT_CMP\n    <Quantity 0.99521225>\n\nThe result is independent from the units in which the different quantities were\nspecified:\n\n    >>> nu = 3.e9 * u.Hz\n    >>> T = 30 * u.K\n    >>> np.exp(- h * nu / (k_B * T))  # doctest: +FLOAT_CMP\n    <Quantity 0.99521225>\n\nConverting to Plain Python Scalars\n==================================\n\nConverting |Quantity| objects does not work for non-dimensionless quantities:\n\n    >>> float(3. * u.m)\n    Traceback (most recent call last):\n      ...\n    TypeError: only dimensionless scalar quantities can be converted\n    to Python scalars\n\nOnly dimensionless values can be converted to plain Python scalars:\n\n    >>> float(3. * u.m / (4. * u.m))\n    0.75\n    >>> float(3. * u.km / (4. * u.m))\n    750.0\n    >>> int(6. * u.km / (2. * u.m))\n    3000\n\nFunctions that Accept Quantities\n================================\n\nIf a function accepts a |Quantity| as an argument then it can be a good idea to\ncheck that the provided |Quantity| belongs to one of the expected\n:ref:`physical_types`. This can be done with the `decorator\n<https://docs.python.org/3/glossary.html#term-decorator>`_\n:func:`~astropy.units.quantity_input`.\n\nThe decorator does not convert the input |Quantity| to the desired unit, say\narcseconds to degrees in the example below, it merely checks that such a\nconversion is possible, thus verifying that the `~astropy.units.Quantity`\nargument can be used in calculations.\n\nKeyword arguments to :func:`~astropy.units.quantity_input` specify which\narguments should be validated and what unit they are expected to be compatible\nwith.\n\nExamples\n--------\n\n.. EXAMPLE START: Functions that Accept Quantities\n\nTo verify if a |Quantity| argument can be used in calculations::\n\n    >>> @u.quantity_input(myarg=u.deg)\n    ... def myfunction(myarg):\n    ...     return myarg.unit\n\n    >>> myfunction(100*u.arcsec)\n    Unit(\"arcsec\")\n    >>> myfunction(2*u.m)  # doctest: +IGNORE_EXCEPTION_DETAIL\n    Traceback (most recent call last):\n    ...\n    UnitsError: Argument 'myarg' to function 'myfunction' must be in units\n    convertible to 'deg'.\n\nIt is also possible to instead specify the :ref:`physical type\n<physical_types>` of the desired unit::\n\n    >>> @u.quantity_input(myarg='angle')\n    ... def myfunction(myarg):\n    ...     return myarg.unit\n\n    >>> myfunction(100*u.arcsec)\n    Unit(\"arcsec\")\n\nOptionally, `None` keyword arguments are also supported; for such cases, the\ninput is only checked when a value other than `None` is passed::\n\n    >>> @u.quantity_input(a='length', b='angle')\n    ... def myfunction(a, b=None):\n    ...     return a, b\n\n    >>> myfunction(1.*u.km)  # doctest: +FLOAT_CMP\n    (<Quantity 1. km>, None)\n    >>> myfunction(1.*u.km, 1*u.deg)  # doctest: +FLOAT_CMP\n    (<Quantity 1. km>, <Quantity 1. deg>)\n\nAlternatively, you can use the `annotations syntax\n<https://docs.python.org/3/library/typing.html>`_ to provide the units.\nWhile the raw unit or string can be used, the preferred method is with the\nunit-aware Quantity-annotation syntax.\nThis requires Python 3.9 or the package ``typing_extensions``.\n\n``Quantity[unit or \"string\", metadata, ...]``\n.. doctest-skip::\n\n    >>> @u.quantity_input\n    ... def myfunction(myarg: u.Quantity[u.arcsec]):\n    ...     return myarg.unit\n    >>>\n    >>> myfunction(100*u.arcsec)\n    Unit(\"arcsec\")\n\nYou can also annotate for different types in non-unit expecting arguments:\n.. doctest-skip::\n\n    >>> @u.quantity_input\n    ... def myfunction(myarg: u.Quantity[u.arcsec], nice_string: str):\n    ...     return myarg.unit, nice_string\n    >>> myfunction(100*u.arcsec, \"a nice string\")\n    (Unit(\"arcsec\"), 'a nice string')\n\nThe output can be specified to have a desired unit with a function annotation,\nfor example\n.. doctest-skip::\n\n    >>> @u.quantity_input\n    ... def myfunction(myarg: u.Quantity[u.arcsec]) -> u.deg:\n    ...     return myarg*1000\n    >>>\n    >>> myfunction(100*u.arcsec)  # doctest: +FLOAT_CMP\n    <Quantity 27.77777778 deg>\n\nThis both checks that the return value of your function is consistent with what\nyou expect and makes it much neater to display the results of the function.\n\n.. EXAMPLE END\n\nSpecifying a list of valid equivalent units or :ref:`physical_types` is\nsupported for functions that should accept inputs with multiple valid units:\n\n    >>> @u.quantity_input(a=['length', 'speed'])\n    ... def myfunction(a):\n    ...     return a.unit\n\n    >>> myfunction(1.*u.km)\n    Unit(\"km\")\n    >>> myfunction(1.*u.km/u.s)\n    Unit(\"km / s\")\n\nRepresenting Vectors with Units\n===============================\n\n|Quantity| objects can, like ``numpy`` arrays, be used to represent vectors or\nmatrices by assigning specific dimensions to represent the coordinates or\nmatrix elements, but that implies tracking those dimensions carefully. For\nvectors :ref:`astropy-coordinates-representations` can be more convenient as\ndoing so allows you to use representations other than Cartesian (such as\nspherical or cylindrical), as well as simple vector arithmetic.\n\n.. _astropy-units-quantity-no-copy:\n\nCreating and Converting Quantities without Copies\n=================================================\n\nWhen creating a |Quantity| using multiplication with a unit, a copy of the\nunderlying data is made. This can be avoided by passing on ``copy=False`` in\nthe initializer.\n\nExamples\n--------\n\n.. EXAMPLE START: Creating and Converting Quantities without Copies\n\nTo avoid duplication using ``copy=False``::\n\n    >>> a = np.arange(5.)\n    >>> q = u.Quantity(a, u.m, copy=False)\n    >>> q  # doctest: +FLOAT_CMP\n    <Quantity [0., 1., 2., 3., 4.] m>\n    >>> np.may_share_memory(a, q)\n    True\n    >>> a[0] = -1.\n    >>> q  # doctest: +FLOAT_CMP\n    <Quantity [-1.,  1.,  2.,  3.,  4.] m>\n\nThis may be particularly useful in functions which do not change their input\nwhile ensuring that if a user passes in a |Quantity| then it will be converted\nto the desired unit.\n\n.. EXAMPLE END\n\nAs a shortcut, you can \"shift\" to the requested unit using the ``<<``\noperator::\n\n    >>> q = a << u.m\n    >>> np.may_share_memory(a, q)\n    True\n    >>> q  # doctest: +FLOAT_CMP\n    <Quantity [-1.,  1.,  2.,  3.,  4.] m>\n\nThe operator works identically to the initialization with ``copy=False``\nmentioned above::\n\n    >>> q << u.cm  # doctest: +FLOAT_CMP\n    <Quantity [-100.,  100.,  200.,  300.,  400.] cm>\n\nIt can also be used for in-place conversion::\n\n    >>> q <<= u.cm\n    >>> q  # doctest: +FLOAT_CMP\n    <Quantity [-100.,  100.,  200.,  300.,  400.] cm>\n    >>> a  # doctest: +FLOAT_CMP\n    array([-100.,  100.,  200.,  300.,  400.])\n\nQTable\n======\n\nIt is possible to use |Quantity| objects as columns in :mod:`astropy.table`.\nSee :ref:`quantity_and_qtable` for more details.\n\nSubclassing Quantity\n====================\n\nTo subclass |Quantity|, you generally proceed as you would when subclassing\n|ndarray| (i.e., you typically need to override ``__new__()``, rather than\n``__init__()``, and use the ``numpy.ndarray.__array_finalize__()`` method to\nupdate attributes). For details, see the `NumPy documentation on subclassing\n<https://numpy.org/doc/stable/user/basics.subclassing.html>`_.  To get a sense\nof what is involved, have a look at |Quantity| itself, where, for example, the\n``astropy.units.Quantity.__array_finalize__()`` method is used to pass on the\n``unit``, at :class:`~astropy.coordinates.Angle`, where strings are parsed as\nangles in the ``astropy.coordinates.Angle.__new__()`` method and at\n:class:`~astropy.coordinates.Longitude`, where the\n``astropy.coordinates.Longitude.__array_finalize__()`` method is used to pass\non the angle at which longitudes wrap.\n\nAnother method that is meant to be overridden by subclasses, specific to\n|Quantity|, is ``astropy.units.Quantity.__quantity_subclass__()``. This is\ncalled to decide which type of subclass to return, based on the unit of the\n|Quantity| that is to be created. It is used, for example, in\n:class:`~astropy.coordinates.Angle` to return a |Quantity| if a calculation\nreturns a unit other than an angular one. The implementation of this is via\n:class:`~astropy.units.SpecificTypeQuantity`, which more generally allows users\nto construct |Quantity| subclasses that have methods that are useful only for a\nspecific physical type.\n"},{"id":170,"name":"logarithmic_units.rst","nodeType":"TextFile","path":"docs/units","text":".. _logarithmic_units:\n\nMagnitudes and Other Logarithmic Units\n**************************************\n\nMagnitudes and logarithmic units such as ``dex`` and ``dB`` are used as the\nlogarithm of values relative to some reference value. Quantities with such\nunits are supported in ``astropy`` via the :class:`~astropy.units.Magnitude`,\n:class:`~astropy.units.Dex`, and :class:`~astropy.units.Decibel` classes.\n\nCreating Logarithmic Quantities\n===============================\n\nYou can create logarithmic quantities either directly or by multiplication with\na logarithmic unit.\n\nExample\n-------\n\n.. EXAMPLE START: Creating Logarithmic Quantities\n\nTo create a logarithmic quantity::\n\n  >>> import astropy.units as u, astropy.constants as c, numpy as np\n  >>> u.Magnitude(-10.)  # doctest: +FLOAT_CMP\n  <Magnitude -10. mag>\n  >>> u.Magnitude(10 * u.ct / u.s)  # doctest: +FLOAT_CMP\n  <Magnitude -2.5 mag(ct / s)>\n  >>> u.Magnitude(-2.5, \"mag(ct/s)\")  # doctest: +FLOAT_CMP\n  <Magnitude -2.5 mag(ct / s)>\n  >>> -2.5 * u.mag(u.ct / u.s)  # doctest: +FLOAT_CMP\n  <Magnitude -2.5 mag(ct / s)>\n  >>> u.Dex((c.G * u.M_sun / u.R_sun**2).cgs)  # doctest: +FLOAT_CMP\n  <Dex 4.438067627303133 dex(cm / s2)>\n  >>> np.linspace(2., 5., 7) * u.Unit(\"dex(cm/s2)\")  # doctest: +FLOAT_CMP\n  <Dex [2. , 2.5, 3. , 3.5, 4. , 4.5, 5. ] dex(cm / s2)>\n\nAbove, we make use of the fact that the units ``mag``, ``dex``, and\n``dB`` are special in that, when used as functions, they return a\n:class:`~astropy.units.function.logarithmic.LogUnit` instance\n(:class:`~astropy.units.function.logarithmic.MagUnit`,\n:class:`~astropy.units.function.logarithmic.DexUnit`, and\n:class:`~astropy.units.function.logarithmic.DecibelUnit`,\nrespectively). The same happens as required when strings are parsed\nby :class:`~astropy.units.Unit`.\n\n.. EXAMPLE END\n\nAs for normal |Quantity| objects, you can access the value with the\n`~astropy.units.Quantity.value` attribute. In addition, you can convert to a\n|Quantity| with the physical unit using the\n`~astropy.units.function.FunctionQuantity.physical` attribute::\n\n    >>> logg = 5. * u.dex(u.cm / u.s**2)\n    >>> logg.value\n    5.0\n    >>> logg.physical  # doctest: +FLOAT_CMP\n    <Quantity 100000. cm / s2>\n\nConverting to Different Units\n=============================\n\nLike |Quantity| objects, logarithmic quantities can be converted to different\nunits, be it another logarithmic unit or a physical one.\n\nExample\n-------\n\n.. EXAMPLE START: Converting Logarithmic Quantities to Different Units\n\nTo convert a logarithmic quantity to a different unit::\n\n    >>> logg = 5. * u.dex(u.cm / u.s**2)\n    >>> logg.to(u.m / u.s**2)  # doctest: +FLOAT_CMP\n    <Quantity 1000. m / s2>\n    >>> logg.to('dex(m/s2)')  # doctest: +FLOAT_CMP\n    <Dex 3. dex(m / s2)>\n\nFor convenience, the :attr:`~astropy.units.function.FunctionQuantity.si` and\n:attr:`~astropy.units.function.FunctionQuantity.cgs` attributes can be used to\nconvert the |Quantity| to base `SI\n<https://www.bipm.org/documents/20126/41483022/SI-Brochure-9-EN.pdf>`_ or `CGS\n<https://en.wikipedia.org/wiki/Centimetre-gram-second_system_of_units>`_\nunits::\n\n    >>> logg.si  # doctest: +FLOAT_CMP\n    <Dex 3. dex(m / s2)>\n\n.. EXAMPLE END\n\nArithmetic and Photometric Applications\n=======================================\n\nAddition and subtraction work as expected for logarithmic quantities,\nmultiplying and dividing the physical units as appropriate. It may be best\nseen through an example of a photometric reduction.\n\nExample\n-------\n\n.. EXAMPLE START: Photometric Reduction with Logarithmic Quantities\n\nFirst, calculate instrumental magnitudes assuming some count rates for three\nobjects::\n\n    >>> tint = 1000.*u.s\n    >>> cr_b = ([3000., 100., 15.] * u.ct) / tint\n    >>> cr_v = ([4000., 90., 25.] * u.ct) / tint\n    >>> b_i, v_i = u.Magnitude(cr_b), u.Magnitude(cr_v)\n    >>> b_i, v_i  # doctest: +FLOAT_CMP\n    (<Magnitude [-1.19280314,  2.5       ,  4.55977185] mag(ct / s)>,\n     <Magnitude [-1.50514998,  2.61439373,  4.00514998] mag(ct / s)>)\n\nThen, the instrumental B-V color is::\n\n    >>> b_i - v_i  # doctest: +FLOAT_CMP\n    <Magnitude [ 0.31234684, -0.11439373,  0.55462187] mag>\n\nNote that the physical unit has become dimensionless. The following step might\nbe used to correct for atmospheric extinction::\n\n    >>> atm_ext_b, atm_ext_v = 0.12 * u.mag, 0.08 * u.mag\n    >>> secz = 1./np.cos(45 * u.deg)\n    >>> b_i0 = b_i - atm_ext_b * secz\n    >>> v_i0 = v_i - atm_ext_b * secz\n    >>> b_i0, v_i0  # doctest: +FLOAT_CMP\n    (<Magnitude [-1.36250876,  2.33029437,  4.39006622] mag(ct / s)>,\n     <Magnitude [-1.67485561,  2.4446881 ,  3.83544435] mag(ct / s)>)\n\nSince the extinction is dimensionless, the units do not change. Now suppose the\nfirst star has a known ST magnitude, so we can calculate zero points::\n\n    >>> b_ref, v_ref = 17.2 * u.STmag, 17.0 * u.STmag\n    >>> b_ref, v_ref  # doctest: +FLOAT_CMP\n    (<Magnitude 17.2 mag(ST)>, <Magnitude 17. mag(ST)>)\n    >>> zp_b, zp_v = b_ref - b_i0[0], v_ref - v_i0[0]\n    >>> zp_b, zp_v  # doctest: +FLOAT_CMP\n    (<Magnitude 18.56250876 mag(s ST / ct)>,\n     <Magnitude 18.67485561 mag(s ST / ct)>)\n\nHere, ``ST`` is shorthand for the ST zero-point flux::\n\n    >>> (0. * u.STmag).to(u.erg/u.s/u.cm**2/u.AA)  # doctest: +FLOAT_CMP\n    <Quantity 3.63078055e-09 erg / (Angstrom cm2 s)>\n    >>> (-21.1 * u.STmag).to(u.erg/u.s/u.cm**2/u.AA)  # doctest: +FLOAT_CMP\n    <Quantity 1. erg / (Angstrom cm2 s)>\n\n.. Note::\n\n    At present, only magnitudes defined in terms of luminosity or flux are\n    implemented, since those do not depend on the filter with which the\n    measurement was made. They include absolute and apparent bolometric [M15]_,\n    ST [H95]_, and AB [OG83]_ magnitudes.\n\nNow applying the calibration, we find (note the proper change in units)::\n\n    >>> B, V = b_i0 + zp_b, v_i0 + zp_v\n    >>> B, V  # doctest: +FLOAT_CMP\n    (<Magnitude [17.2       , 20.89280314, 22.95257499] mag(ST)>,\n     <Magnitude [17.        , 21.1195437 , 22.51029996] mag(ST)>)\n\nWe could convert these magnitudes to another system, for example, ABMag, using\nappropriate :ref:`equivalency <unit_equivalencies>`::\n\n    >>> V.to(u.ABmag, u.spectral_density(5500.*u.AA))  # doctest: +FLOAT_CMP\n    <Magnitude [16.99023831, 21.10978201, 22.50053827] mag(AB)>\n\nThis is particularly useful for converting magnitude into flux density. ``V``\nis currently in ST magnitudes, which is based on flux densities per unit\nwavelength (:math:`f_\\lambda`). Therefore, we can directly convert ``V`` into\nflux density per unit wavelength using the\n:meth:`~astropy.units.quantity.Quantity.to` method::\n\n    >>> flam = V.to(u.erg/u.s/u.cm**2/u.AA)\n    >>> flam  # doctest: +FLOAT_CMP\n    <Quantity [5.75439937e-16, 1.29473986e-17, 3.59649961e-18] erg / (Angstrom cm2 s)>\n\nTo convert ``V`` to flux density per unit frequency (:math:`f_\\nu`), we again\nneed the appropriate :ref:`equivalency <unit_equivalencies>`, which in this case\nis the central wavelength of the magnitude band, 5500 Angstroms::\n\n    >>> lam = 5500 * u.AA\n    >>> fnu = V.to(u.erg/u.s/u.cm**2/u.Hz, u.spectral_density(lam))\n    >>> fnu  # doctest: +FLOAT_CMP\n    <Quantity [5.80636959e-27, 1.30643316e-28, 3.62898099e-29] erg / (cm2 Hz s)>\n\nWe could have used the central frequency instead::\n\n    >>> nu = 5.45077196e+14 * u.Hz\n    >>> fnu = V.to(u.erg/u.s/u.cm**2/u.Hz, u.spectral_density(nu))\n    >>> fnu  # doctest: +FLOAT_CMP\n    <Quantity [5.80636959e-27, 1.30643316e-28, 3.62898099e-29] erg / (cm2 Hz s)>\n\n.. Note::\n\n    When converting magnitudes to flux densities, the order of operations\n    matters; the value of the unit needs to be established *before* the\n    conversion. For example, ``21 * u.ABmag.to(u.erg/u.s/u.cm**2/u.Hz)`` will\n    give you 21 times :math:`f_\\nu` for an AB mag of 1, whereas ``(21 *\n    u.ABmag).to(u.erg/u.s/u.cm**2/u.Hz)`` will give you :math:`f_\\nu` for an AB\n    mag of 21.\n\nSuppose we also knew the intrinsic color of the first star, then we can\ncalculate the reddening::\n\n    >>> B_V0 = -0.2 * u.mag\n    >>> EB_V = (B - V)[0] - B_V0\n    >>> R_V = 3.1\n    >>> A_V = R_V * EB_V\n    >>> A_B = (R_V+1) * EB_V\n    >>> EB_V, A_V, A_B  # doctest: +FLOAT_CMP\n    (<Magnitude 0.4 mag>, <Magnitude 1.24 mag>, <Magnitude 1.64 mag>)\n\nHere, you see that the extinctions have been converted to quantities. This\nhappens generally for division and multiplication, since these processes\nwork only for dimensionless magnitudes (otherwise, the physical unit would have\nto be raised to some power), and |Quantity| objects, unlike logarithmic\nquantities, allow units like ``mag / d``.\n\n.. EXAMPLE END\n\nNote that you can take the automatic unit conversion quite far (perhaps too\nfar, but it is fun). For instance, suppose we also knew the bolometric\ncorrection and absolute bolometric magnitude, then we can calculate the\ndistance modulus::\n\n    >>> BC_V = -0.3 * (u.m_bol - u.STmag)\n    >>> M_bol = 5.46 * u.M_bol\n    >>> DM = V[0] - A_V + BC_V - M_bol\n    >>> BC_V, M_bol, DM  # doctest: +FLOAT_CMP\n    (<Magnitude -0.3 mag(bol / ST)>,\n     <Magnitude 5.46 mag(Bol)>,\n     <Magnitude 10. mag(bol / Bol)>)\n\nWith a proper :ref:`equivalency <unit_equivalencies>`, we can also convert to\ndistance without remembering the 5-5log rule (but you might find the\n:class:`~astropy.coordinates.Distance` class to be even more convenient)::\n\n    >>> radius_and_inverse_area = [(u.pc, u.pc**-2,\n    ...                            lambda x: 1./(4.*np.pi*x**2),\n    ...                            lambda x: np.sqrt(1./(4.*np.pi*x)))]\n    >>> DM.to(u.pc, equivalencies=radius_and_inverse_area)  # doctest: +FLOAT_CMP\n    <Quantity 1000. pc>\n\nNumPy Functions\n===============\n\nFor logarithmic quantities, most ``numpy`` functions and many array methods do\nnot make sense, hence they are disabled. But you can use those you would expect\nto work::\n\n    >>> np.max(v_i)  # doctest: +FLOAT_CMP\n    <Magnitude 4.00514998 mag(ct / s)>\n    >>> np.std(v_i)  # doctest: +FLOAT_CMP\n    <Magnitude 2.33971149 mag>\n\n.. note::\n\n    This is implemented by having a list of supported ufuncs in\n    ``units/function/core.py`` and by explicitly disabling some array methods in\n    :class:`~astropy.units.function.FunctionQuantity`.  If you believe a\n    function or method is incorrectly treated, please `let us know\n    <http://www.astropy.org/contribute.html>`_.\n\nDimensionless Logarithmic Quantities\n====================================\n\nDimensionless quantities are treated somewhat specially in that, if needed,\nlogarithmic quantities will be converted to normal |Quantity| objects with the\nappropriate unit of ``mag``, ``dB``, or ``dex``.  With this, it is possible to\nuse composite units like ``mag/d`` or ``dB/m``, which cannot conveniently be\nsupported as logarithmic units. For instance::\n\n    >>> dBm = u.dB(u.mW)\n    >>> signal_in, signal_out = 100. * dBm, 50 * dBm\n    >>> cable_loss = (signal_in - signal_out) / (100. * u.m)\n    >>> signal_in, signal_out, cable_loss  # doctest: +FLOAT_CMP\n    (<Decibel 100. dB(mW)>, <Decibel 50. dB(mW)>, <Quantity 0.5 dB / m>)\n    >>> better_cable_loss = 0.2 * u.dB / u.m\n    >>> signal_in - better_cable_loss * 100. * u.m  # doctest: +FLOAT_CMP\n    <Decibel 80. dB(mW)>\n\n**References**\n\n.. [M15] Mamajek et al., 2015, `arXiv:1510.06262\n\t  <https://ui.adsabs.harvard.edu/abs/2015arXiv151006262M>`_\n.. [H95] E.g., Holtzman et al., 1995, `PASP 107, 1065\n          <https://ui.adsabs.harvard.edu/abs/1995PASP..107.1065H>`_\n.. [OG83] Oke, J.B., & Gunn, J. E., 1983, `ApJ 266, 713\n\t  <https://ui.adsabs.harvard.edu/abs/1983ApJ...266..713O>`_\n"},{"id":171,"name":"type_hints.rst","nodeType":"TextFile","path":"docs/units","text":"Unit-Aware Type Annotations\n***************************\n\nPython supports static type analysis using the type syntax of `PEP 484\n<https://www.python.org/dev/peps/pep-0484/>`_. For a detailed guide on type\nhints, function annotations, and other related syntax see the `Real Python Guide\n<https://realpython.com/python-type-checking/#type-aliases>`_. Below we describe\nhow you can be use Quantity type hints and annotations and also include metadata\nabout the associated units.\n\n\nWe assume the following imports:\n\n::\n\n   >>> import typing as T\n   >>> import astropy.units as u\n   >>> from astropy.units import Quantity\n\n\n.. _quantity_type_annotation:\n\nQuantity Type Annotation\n========================\n\nA |Quantity| can be used as a type annotation,::\n\n   >>> x: Quantity = 2 * u.km\n\nor as a function annotation.::\n\n   >>> def func(x: Quantity) -> Quantity:\n   ...     return x\n\n\nPreserving Units\n^^^^^^^^^^^^^^^^\n\nWhile the above annotations are useful for annotating the value's type, it\ndoes not inform us of the other most important attribute of a |Quantity|:\nthe unit.\n\nUnit information may be included by the syntax\n``Quantity[unit or \"physical_type\", shape, numpy.dtype]``.:\n\n..\n   All following doctests can be unskipped when py3.9+\n\n.. doctest-skip::\n\n   >>> Quantity[u.m]\n   typing.Annotated[astropy.units.quantity.Quantity, Unit(\"m\")]\n   >>>\n   >>> Quantity[\"length\"]\n   typing.Annotated[astropy.units.quantity.Quantity, PhysicalType('length')]\n\nSee ``typing.Annotated`` for explanation of ``Annotated``\n\nThese can also be used on functions\n\n.. doctest-skip::\n\n   >>> def func(x: Quantity[u.kpc]) -> Quantity[u.m]:\n   ...     return x << u.m\n\n\n.. _multiple_annotation:\n\nMultiple Annotations\n====================\n\nMultiple Quantity and unit-aware |Quantity| annotations are supported using\n:class:`~typing.Union` or :class:`~typing.Optional`\n\n.. doctest-skip::\n\n   >>> T.Union[Quantity[u.m], None]\n   typing.Optional[typing.Annotated[astropy.units.quantity.Quantity, Unit(\"m\")]]\n   >>>\n   >>> T.Union[Quantity[u.m], Quantity[\"time\"]]\n   typing.Union[typing.Annotated[astropy.units.quantity.Quantity, Unit(\"m\")],\n                typing.Annotated[astropy.units.quantity.Quantity, PhysicalType('time')]]\n"},{"col":0,"comment":"null","endLoc":434,"header":"def setup(app)","id":172,"name":"setup","nodeType":"Function","startLoc":414,"text":"def setup(app):\n    if sphinx_gallery is None:\n        msg = ('The sphinx_gallery extension is not installed, so the '\n               'gallery will not be built.  You will probably see '\n               'additional warnings about undefined references due '\n               'to this.')\n        try:\n            app.warn(msg)\n        except AttributeError:\n            # Sphinx 1.6+\n            from sphinx.util import logging\n            logger = logging.getLogger(__name__)\n            logger.warning(msg)\n\n    # Generate the page from Jinja template\n    app.connect(\"source-read\", rstjinja)\n    # Set this to higher priority than intersphinx; this way when building\n    # dev docs astropy-dev: targets will go to the local docs instead of the\n    # intersphinx mapping\n    app.connect(\"missing-reference\", resolve_astropy_and_dev_reference,\n                priority=400)"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":173,"name":"missing_requirements","nodeType":"Attribute","startLoc":39,"text":"missing_requirements"},{"attributeType":"null","col":4,"comment":"null","endLoc":40,"id":174,"name":"line","nodeType":"Attribute","startLoc":40,"text":"line"},{"attributeType":"null","col":8,"comment":"null","endLoc":42,"id":175,"name":"req","nodeType":"Attribute","startLoc":42,"text":"req"},{"attributeType":"null","col":8,"comment":"null","endLoc":43,"id":176,"name":"req_package","nodeType":"Attribute","startLoc":43,"text":"req_package"},{"attributeType":"null","col":8,"comment":"null","endLoc":44,"id":177,"name":"req_specifier","nodeType":"Attribute","startLoc":44,"text":"req_specifier"},{"attributeType":"null","col":12,"comment":"null","endLoc":47,"id":178,"name":"version","nodeType":"Attribute","startLoc":47,"text":"version"},{"id":179,"name":"format.rst","nodeType":"TextFile","path":"docs/units","text":".. _astropy-units-format:\n\nString Representations of Units\n*******************************\n\nConverting Units to String Representations\n==========================================\n\nYou can control the way that |Quantity| and |Unit| objects are rendered as\nstrings using the `Python Format String Syntax\n<https://docs.python.org/3/library/string.html#format-string-syntax>`_\n(demonstrated below using `f-strings\n<https://www.python.org/dev/peps/pep-0498/>`_).\n\nFor quantities, format specifiers, like ``0.003f`` will be applied to\nthe |Quantity| value, without affecting the unit. Specifiers like\n``20s``, which would only apply to a string, will be applied to the\nwhole string representation of the |Quantity|.\n\nExamples\n--------\n\n.. EXAMPLE START: Converting Units to String Representations\n\nTo render |Quantity| or |Unit| objects as strings::\n\n    >>> from astropy import units as u\n    >>> import numpy as np\n    >>> q = 10.5 * u.km\n    >>> q\n    <Quantity  10.5 km>\n    >>> f\"{q}\"\n    '10.5 km'\n    >>> f\"{q:+0.03f}\"\n    '+10.500 km'\n    >>> f\"{q:20s}\"\n    '10.5 km             '\n\nTo format both the value and the unit separately, you can access the |Quantity|\nclass attributes within format strings::\n\n    >>> q = 10.5 * u.km\n    >>> q\n    <Quantity  10.5 km>\n    >>> f\"{q.value:0.003f} in {q.unit:s}\"\n    '10.500 in km'\n\nBecause ``numpy`` arrays do not accept most format specifiers, using specifiers\nlike ``0.003f`` will not work when applied to a ``numpy`` array or non-scalar\n|Quantity|. Use :func:`numpy.array_str` instead. For instance::\n\n    >>> q = np.linspace(0,1,10) * u.m\n    >>> f\"{np.array_str(q.value, precision=1)} {q.unit}\"  # doctest: +FLOAT_CMP\n    '[0.  0.1 0.2 0.3 0.4 0.6 0.7 0.8 0.9 1. ] m'\n\nExamine the NumPy documentation for more examples with :func:`numpy.array_str`.\n\n.. EXAMPLE END\n\nUnits, or the unit part of a quantity, can also be formatted in a number of\ndifferent styles. By default, the string format used is referred to as the\n\"generic\" format, which is based on syntax of the `FITS standard\n<https://fits.gsfc.nasa.gov/fits_standard.html>`_ format for representing\nunits, but supports all of the units defined within the :mod:`astropy.units`\nframework, including user-defined units. The format specifier (and\n:meth:`~astropy.units.core.UnitBase.to_string`) functions also take an optional\nparameter to select a different format, including ``\"latex\"``, ``\"unicode\"``,\n``\"cds\"``, and others, defined below::\n\n    >>> q = 10 * u.km\n    >>> f\"{q.value:0.003f} in {q.unit:latex}\"\n    '10.000 in $\\\\mathrm{km}$'\n    >>> fluxunit = u.erg / (u.cm ** 2 * u.s)\n    >>> f\"{fluxunit}\"\n    u'erg / (cm2 s)'\n    >>> print(f\"{fluxunit:console}\")\n     erg\n    ------\n    s cm^2\n    >>> f\"{fluxunit:latex}\"\n    u'$\\\\mathrm{\\\\frac{erg}{s\\\\,cm^{2}}}$'\n    >>> f\"{fluxunit:>20s}\"\n    u'       erg / (cm2 s)'\n\nThe :meth:`~astropy.units.core.UnitBase.to_string` method is an alternative way\nto format units as strings, and is the underlying implementation of the\n`format`-style usage::\n\n    >>> fluxunit = u.erg / (u.cm ** 2 * u.s)\n    >>> fluxunit.to_string('latex')\n    u'$\\\\mathrm{\\\\frac{erg}{s\\\\,cm^{2}}}$'\n\nCreating Units from Strings\n===========================\n\n.. EXAMPLE START: Creating Units from Strings\n\nUnits can also be created from strings in a number of different\nformats using the `~astropy.units.Unit` class::\n\n  >>> u.Unit(\"m\")\n  Unit(\"m\")\n  >>> u.Unit(\"erg / (s cm2)\")\n  Unit(\"erg / (cm2 s)\")\n  >>> u.Unit(\"erg.s-1.cm-2\", format=\"cds\")\n  Unit(\"erg / (cm2 s)\")\n\n.. note::\n\n   Creating units from strings requires the use of a specialized\n   parser for the unit language, which results in a performance\n   penalty if units are created using strings. Thus, it is much\n   faster to use unit objects directly (e.g., ``unit = u.degree /\n   u.minute``) instead of via string parsing (``unit =\n   u.Unit('deg/min')``). This parser is very useful, however, if your\n   unit definitions are coming from a file format such as FITS or\n   VOTable.\n\n.. EXAMPLE END\n\nBuilt-In Formats\n================\n\n`astropy.units` includes support for parsing and writing the following\nformats:\n\n  - ``\"fits\"``: This is the format defined in the Units section of the\n    `FITS Standard <https://fits.gsfc.nasa.gov/fits_standard.html>`__.\n    Unlike the \"generic\" string format, this will only accept or\n    generate units defined in the FITS standard.\n\n  - ``\"vounit\"``: The `Units in the VO 1.0\n    <http://www.ivoa.net/documents/VOUnits/>`__ standard for\n    representing units in the VO. Again, based on the FITS syntax,\n    but the collection of supported units is different.\n\n  - ``\"cds\"``: `Standards for astronomical catalogues from Centre de\n    Données astronomiques de Strasbourg\n    <http://vizier.u-strasbg.fr/vizier/doc/catstd-3.2.htx>`_: This is the\n    standard used by `Vizier tables <http://vizier.u-strasbg.fr/>`__,\n    as well as what is used by VOTable versions 1.3 and earlier.\n\n  - ``\"ogip\"``: A standard for storing units as recommended by the\n    `Office of Guest Investigator Programs (OGIP)\n    <https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/general/ogip_93_001/>`_.\n\n`astropy.units` is also able to write, but not read, units in the\nfollowing formats:\n\n  - ``\"latex\"``: Writes units out using LaTeX math syntax using the\n    `IAU Style Manual\n    <https://www.iau.org/static/publications/stylemanual1989.pdf>`_\n    recommendations for unit presentation. This format is\n    automatically used when printing a unit in the IPython notebook::\n\n      >>> fluxunit  # doctest: +SKIP\n\n    .. math::\n\n       \\mathrm{\\frac{erg}{s\\,cm^{2}}}\n\n  - ``\"latex_inline\"``: Writes units out using LaTeX math syntax using the\n    `IAU Style Manual\n    <https://www.iau.org/static/publications/stylemanual1989.pdf>`_\n    recommendations for unit presentation, using negative powers instead of\n    fractions, as required by some journals (e.g., `Apj and AJ\n    <https://journals.aas.org/manuscript-preparation/>`_).\n    Best suited for unit representation inline with text::\n\n      >>> fluxunit.to_string('latex_inline')  # doctest: +SKIP\n\n    .. math::\n\n       \\mathrm{erg\\,s^{-1}\\,cm^{-2}}\n\n  - ``\"console\"``: Writes a multiline representation of the unit\n    useful for display in a text console::\n\n      >>> print(fluxunit.to_string('console'))\n       erg\n      ------\n      s cm^2\n\n  - ``\"unicode\"``: Same as ``\"console\"``, except uses Unicode\n    characters::\n\n      >>> print(u.Ry.decompose().to_string('unicode'))  # doctest: +FLOAT_CMP\n                      m² kg\n      2.1798724×10⁻¹⁸ ─────\n                       s²\n\n.. _astropy-units-format-unrecognized:\n\nDealing with Unrecognized Units\n===============================\n\nSince many files found in the wild have unit strings that do not\ncorrespond to any given standard, `astropy.units` also has a\nconsistent way to store and pass around unit strings that did not\nparse.  In addition, it provides tools for transforming non-standard,\nlegacy or misspelt unit strings into their standardized form,\npreventing the further propagation of these unit strings.\n\nBy default, passing an unrecognized unit string raises an exception::\n\n  >>> # The FITS standard uses 'angstrom', not 'Angstroem'\n  >>> u.Unit(\"Angstroem\", format=\"fits\")\n  Traceback (most recent call last):\n    ...\n  ValueError: 'Angstroem' did not parse as fits unit: At col 0, Unit\n  'Angstroem' not supported by the FITS standard. Did you mean Angstrom\n  or angstrom? If this is meant to be a custom unit, define it with\n  'u.def_unit'. To have it recognized inside a file reader or other\n  code, enable it with 'u.add_enabled_units'. For details, see\n  https://docs.astropy.org/en/latest/units/combining_and_defining.html\n\nHowever, the `~astropy.units.Unit` constructor has the keyword\nargument ``parse_strict`` that can take one of three values to control\nthis behavior:\n\n  - ``'raise'``: (default) raise a :class:`ValueError`.\n\n  - ``'warn'``: emit a :class:`~astropy.units.UnitsWarning`, and return an\n    `~astropy.units.UnrecognizedUnit` instance.\n\n  - ``'silent'``: return an `~astropy.units.UnrecognizedUnit`\n    instance.\n\nBy either adding additional unit aliases for the misspelt units with\n:func:`~astropy.units.set_enabled_aliases` (e.g., 'Angstroms' for 'Angstrom';\nas demonstrated below), or defining new units via\n:func:`~astropy.units.def_unit` and :func:`~astropy.units.add_enabled_units`,\nwe can use ``parse_strict='raise'`` to rapidly find issues with the units used,\nwhile also being able to read in older datasets where the unit usage may have\nbeen less standard.\n\n\nExamples\n--------\n\n.. EXAMPLE START: Define Aliases for Units\n\nTo set unit aliases, pass :func:`~astropy.units.set_enabled_aliases` a\n:class:`dict` mapping the misspelt string to an astropy unit. The following\ncode snippet shows how to set up Angstroem -> Angstrom::\n\n    >>> u.set_enabled_aliases({\"Angstroem\": u.Angstrom})\n    <astropy.units.core._UnitContext object at 0x...>\n    >>> u.Unit(\"Angstroem\")\n    Unit(\"Angstrom\")\n    >>> u.Unit(\"Angstroem\") == u.Angstrom\n    True\n\nYou can also set multiple aliases up at once or add to existing ones::\n\n    >>> u.set_enabled_aliases({\"Angstroem\": u.Angstrom, \"Angstroms\": u.Angstrom})\n    <astropy.units.core._UnitContext object at 0x...>\n    >>> u.add_enabled_aliases({\"angstroem\": u.Angstrom})\n    <astropy.units.core._UnitContext object at 0x...>\n    >>> u.Unit(\"Angstroem\") == u.Unit(\"Angstroms\") == u.Unit(\"angstroem\") == u.Angstrom\n    True\n\nThe aliases can be reset by passing an empty dictionary::\n\n    >>> u.set_enabled_aliases({})\n    <astropy.units.core._UnitContext object at 0x...>\n\nYou can use both :func:`~astropy.units.set_enabled_aliases` and\n:func:`~astropy.units.add_enabled_aliases` as a `context manager\n<https://docs.python.org/3/reference/datamodel.html#context-managers>`_,\nlimiting where a particular alias is used::\n\n    >>> with u.add_enabled_aliases({\"Angstroem\": u.Angstrom}):\n    ...     print(u.Unit(\"Angstroem\") == u.Angstrom)\n    True\n    >>> u.Unit(\"Angstroem\") == u.Angstrom\n    Traceback (most recent call last):\n      ...\n    ValueError: 'Angstroem' did not parse as unit: At col 0, Angstroem is not\n    a valid unit. Did you mean Angstrom, angstrom, mAngstrom or mangstrom? If\n    this is meant to be a custom unit, define it with 'u.def_unit'. To have it\n    recognized inside a file reader or other code, enable it with\n    'u.add_enabled_units'. For details, see\n    https://docs.astropy.org/en/latest/units/combining_and_defining.html\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Using `~astropy.units.UnrecognizedUnit`\n\nTo pass an unrecognized unit string::\n\n   >>> x = u.Unit(\"Angstroem\", format=\"fits\", parse_strict=\"warn\")  # doctest: +SHOW_WARNINGS\n   UnitsWarning: 'Angstroem' did not parse as fits unit: At col 0, Unit\n   'Angstroem' not supported by the FITS standard. Did you mean Angstrom or\n   angstrom? If this is meant to be a custom unit, define it with 'u.def_unit'.\n   To have it recognized inside a file reader or other code, enable it with\n   'u.add_enabled_units'. For details, see\n   https://docs.astropy.org/en/latest/units/combining_and_defining.html\n\nThis `~astropy.units.UnrecognizedUnit` object remembers the\noriginal string it was created with, so it can be written back out,\nbut any meaningful operations on it, such as converting to another\nunit or composing with other units, will fail.\n\n   >>> x.to_string()\n   'Angstroem'\n   >>> x.to(u.km)\n   Traceback (most recent call last):\n     ...\n   ValueError: The unit 'Angstroem' is unrecognized.  It can not be\n   converted to other units.\n   >>> x / u.m\n   Traceback (most recent call last):\n     ...\n   ValueError: The unit 'Angstroem' is unrecognized, so all arithmetic\n   operations with it are invalid.\n\n.. EXAMPLE END\n"},{"id":180,"name":"structured_units.rst","nodeType":"TextFile","path":"docs/units","text":".. _structured_units:\n\nStructured Units\n****************\n\nNumpy arrays can be :doc:`structured arrays <numpy:user/basics.rec>`, where\neach element consists of multiple fields. These can be used with |Quantity|\nusing a |StructuredUnit|, which provides a |Unit| for each field. For example,\nthis allows constructing a single |Quantity| object with position and velocity\nfields that have different units, but are contained within the same object\n(as is needed to support units in the PyERFA_ wrappers around the ERFA_\nroutines that use position-velocity arrays).\n\nCreating Structured Quantities\n==============================\n\nYou can create structured quantities either directly or by multiplication with\na |StructuredUnit|, with the latter in turn either created directly, or\nthrough `~astropy.units.Unit`.\n\nExample\n-------\n\n.. EXAMPLE START: Creating Structured Quantities\n\nTo create a structured quantity containing a position and velocity::\n\n  >>> import astropy.units as u, numpy as np\n  >>> pv_values = np.array([([1., 0., 0.], [0., 0.125, 0.]),\n  ...                       ([0., 1., 0.], [-0.125, 0., 0.])],\n  ...                      dtype=[('p', '(3,)f8'), ('v', '(3,)f8')])\n  >>> pv = u.Quantity(pv_values, u.StructuredUnit((u.km, u.km/u.s)))\n  >>> pv\n  <Quantity [([1., 0., 0.], [ 0.   ,  0.125,  0.   ]),\n             ([0., 1., 0.], [-0.125,  0.   ,  0.   ])] (km, km / s)>\n  >>> pv_values * u.Unit('AU, AU/day')\n  <Quantity [([1., 0., 0.], [ 0.   ,  0.125,  0.   ]),\n             ([0., 1., 0.], [-0.125,  0.   ,  0.   ])] (AU, AU / d)>\n\nAs for normal |Quantity| objects, you can access the value and the unit with the\n`~astropy.units.Quantity.value` and `~astropy.units.Quantity.unit` attribute,\nrespectively. In addition, you can index any given field using its name::\n\n  >>> pv = pv_values * u.Unit('km, km/s')\n  >>> pv.value\n  array([([1., 0., 0.], [ 0.   ,  0.125,  0.   ]),\n         ([0., 1., 0.], [-0.125,  0.   ,  0.   ])],\n        dtype=[('p', '<f8', (3,)), ('v', '<f8', (3,))])\n  >>> pv.unit\n  Unit(\"(km, km / s)\")\n  >>> pv['v']\n  <Quantity [[ 0.   ,  0.125,  0.   ],\n             [-0.125,  0.   ,  0.   ]] km / s>\n\nStructures can be nested, as in this example taken from an PyERFA_ test case\nfor :func:`erfa.ldn`::\n\n  >>> ldbody = [\n  ...     (0.00028574, 3e-10, ([-7.81014427, -5.60956681, -1.98079819],\n  ...                          [0.0030723249, -0.00406995477, -0.00181335842])),\n  ...     (0.00095435, 3e-9, ([0.738098796, 4.63658692, 1.9693136],\n  ...                         [-0.00755816922, 0.00126913722, 0.000727999001])),\n  ...     (1.0, 6e-6, ([-0.000712174377, -0.00230478303, -0.00105865966],\n  ...                  [6.29235213e-6, -3.30888387e-7, -2.96486623e-7]))\n  ...     ] * u.Unit('Msun,radian,(AU,AU/day)')\n  >>> ldbody  # doctest: +FLOAT_CMP\n  <Quantity [(2.8574e-04, 3.e-10, ([-7.81014427e+00, -5.60956681e+00, -1.98079819e+00], [ 3.07232490e-03, -4.06995477e-03, -1.81335842e-03])),\n             (9.5435e-04, 3.e-09, ([ 7.38098796e-01,  4.63658692e+00,  1.96931360e+00], [-7.55816922e-03,  1.26913722e-03,  7.27999001e-04])),\n             (1.0000e+00, 6.e-06, ([-7.12174377e-04, -2.30478303e-03, -1.05865966e-03], [ 6.29235213e-06, -3.30888387e-07, -2.96486623e-07]))] (solMass, rad, (AU, AU / d))>\n\n.. EXAMPLE END\n\nConverting to Different Units\n=============================\n\nLike regular |Quantity| objects, structured quantities can be converted to\ndifferent units, as long as they have the same structure and each unit is\nequivalent.\n\nExample\n-------\n\n.. EXAMPLE START: Converting Structured Quantities to Different Units\n\nTo convert a structured quantity to a different unit::\n\n  >>> pv.to((u.m, u.m / u.s))  # doctest: +FLOAT_CMP\n  <Quantity [([1000.,    0.,    0.], [   0.,  125.,    0.]),\n             ([   0., 1000.,    0.], [-125.,    0.,    0.])] (m, m / s)>\n  >>> pv.cgs\n  <Quantity [([100000.,      0.,      0.], [     0.,  12500.,      0.]),\n             ([     0., 100000.,      0.], [-12500.,      0.,      0.])] (cm, cm / s)>\n\n.. EXAMPLE END\n\nUse with ERFA\n=============\n\nThe ERFA_ C routines make use of structured types, and these are exposed in\nthe PyERFA_ interface.\n\n.. warning:: Not all PyERFA_ routines are wrapped yet. Help with adding\n             wrappers will be appreciated.\n\nExample\n-------\n\n.. EXAMPLE START: Using Structured Quantities with ERFA\n\nTo use a position-velocity structured array with PyERFA_::\n\n  >>> import erfa\n  >>> pv_values = np.array([([1., 0., 0.], [0., 0.125, 0.]),\n  ...                       ([0., 1., 0.], [-0.125, 0., 0.])],\n  ...                      dtype=erfa.dt_pv)\n  >>> pv = pv_values << u.Unit('AU,AU/day')\n  >>> erfa.pvu(86400*u.s, pv)\n  <Quantity [([ 1.   ,  0.125,  0.   ], [ 0.   ,  0.125,  0.   ]),\n             ([-0.125,  1.   ,  0.   ], [-0.125,  0.   ,  0.   ])] (AU, AU / d)>\n  >>> erfa.pv2s(pv)  # doctest: +FLOAT_CMP\n  (<Quantity [0.        , 1.57079633] rad>,\n   <Quantity [0., 0.] rad>,\n   <Quantity [1., 1.] AU>,\n   <Quantity [0.125, 0.125] rad / d>,\n   <Quantity [0., 0.] rad / d>,\n   <Quantity [0., 0.] AU / d>)\n  >>> z_axis = np.array(([0, 0, 1], [0, 0, 0]), erfa.dt_pv) * u.Unit('1,1/s')\n  >>> erfa.pvxpv(pv, z_axis)\n  <Quantity [([ 0., -1.,  0.], [0.125, 0.   , 0.   ]),\n             ([ 1.,  0.,  0.], [0.   , 0.125, 0.   ])] (AU, AU / d)>\n\n.. EXAMPLE END\n"},{"id":181,"name":"conversion.rst","nodeType":"TextFile","path":"docs/units","text":"Low-Level Unit Conversion\n*************************\n\nConversion of quantities from one unit to another is handled using the\n`Quantity.to() <astropy.units.quantity.Quantity.to>` method. This page\ndescribes some low-level features for handling unit conversion that\nare rarely required in user code.\n\nDirect Conversion\n=================\n\n.. EXAMPLE START: Direct Conversions Between Units\n\nIn this case, given a source and destination unit, the values in the\nnew units are returned.\n\n  >>> from astropy import units as u\n  >>> u.pc.to(u.m, 3.26)\n  1.0059308915661856e+17\n\nThis converts 3.26 parsecs to meters.\n\nArrays are permitted as arguments.\n\n  >>> u.h.to(u.s, [1, 2, 5, 10.1])\n  array([  3600.,   7200.,  18000.,  36360.])\n\n.. EXAMPLE END\n\nIncompatible Conversions\n========================\n\n.. EXAMPLE START: Conversions Between Incompatible Units\n\nIf you attempt to convert to a incompatible unit, a\n:class:`~astropy.units.UnitConversionError` will result:\n\n  >>> cms = u.cm / u.s\n  >>> cms.to(u.km)  # doctest: +IGNORE_EXCEPTION_DETAIL\n  Traceback (most recent call last):\n    ...\n  UnitConversionError: 'cm / s' (speed) and 'km' (length) are not convertible\n\nYou can check whether a particular conversion is possible using the\n:meth:`~astropy.units.core.UnitBase.is_equivalent` method::\n\n  >>> u.m.is_equivalent(u.pc)\n  True\n  >>> u.m.is_equivalent(\"second\")\n  False\n  >>> (u.m ** 3).is_equivalent(u.l)\n  True\n\n.. EXAMPLE END\n"},{"id":182,"name":"physical_types.rst","nodeType":"TextFile","path":"docs/units","text":".. _physical_types:\n\nPhysical Types\n**************\n\nA physical type corresponds to physical quantities with dimensionally\ncompatible units. For example, the physical type *mass* corresponds to\nphysical quantities with units that can be converted to kilograms.\nPhysical types are represented as instances of the |PhysicalType| class.\n\nAccessing Physical Types\n========================\n\n.. EXAMPLE START: Accessing Physical Types\n\nUsing :func:`~astropy.units.get_physical_type` lets us acquire |PhysicalType|\ninstances from strings with a name of a physical type, units, |Quantity|\ninstances, objects that can become quantities (e.g., numbers), and\n|PhysicalType| instances.\n\n  >>> import astropy.units as u\n  >>> u.get_physical_type('speed')  # from the name of a physical type\n  PhysicalType({'speed', 'velocity'})\n  >>> u.get_physical_type(u.meter)  # from a unit\n  PhysicalType('length')\n  >>> u.get_physical_type(1 * u.barn * u.Mpc)  # from a Quantity\n  PhysicalType('volume')\n  >>> u.get_physical_type(42)  # from a number\n  PhysicalType('dimensionless')\n\nThe physical type of a unit can be accessed via its\n:attr:`~astropy.units.UnitBase.physical_type` attribute::\n\n  >>> u.coulomb.physical_type\n  PhysicalType('electrical charge')\n  >>> (u.meter ** 2).physical_type\n  PhysicalType('area')\n\n.. EXAMPLE END\n\nUsing Physical Types\n====================\n\n.. EXAMPLE START: Using Physical Types\n\nAn equality comparison between a |PhysicalType| and a string will return\n`True` if the string is a name of the |PhysicalType|::\n\n  >>> acceleration = u.get_physical_type(u.m / u.s ** 2)\n  >>> acceleration == 'acceleration'\n  True\n\nSome units may correspond to multiple physical types because compatible\nunits can be used to quantify different phenomena::\n\n  >>> u.get_physical_type('pressure')\n  PhysicalType({'energy density', 'pressure', 'stress'})\n\nWe can iterate through the names of a |PhysicalType|::\n\n  >>> for name in u.J.physical_type: print(name)\n  energy\n  torque\n  work\n\nWe can test for membership or equality with a string that has the name\nof a |PhysicalType|::\n\n  >>> 'energy' == u.J.physical_type\n  True\n  >>> 'work' in u.J.physical_type\n  True\n\n.. EXAMPLE END\n\nDimensional Analysis\n====================\n\n.. EXAMPLE START: Dimensional Analysis With Physical Types\n\n|PhysicalType| instances support multiplication, division,\nand exponentiation. Because of this, they can be used for\ndimensional analysis::\n\n  >>> length = u.get_physical_type('length')\n  >>> time = u.get_physical_type('time')\n  >>> length ** 2\n  PhysicalType('area')\n  >>> 1 / time\n  PhysicalType('frequency')\n\nDimensional analysis can be performed between a |PhysicalType| and a\nunit or between a |PhysicalType| and a string with a name of a\n|PhysicalType|::\n\n  >>> length ** 2 / u.s\n  PhysicalType({'diffusivity', 'kinematic viscosity'})\n  >>> length / 'time'\n  PhysicalType({'speed', 'velocity'})\n\n.. EXAMPLE END\n"},{"id":183,"name":"standard_units.rst","nodeType":"TextFile","path":"docs/units","text":".. _doc_standard_units:\n\nStandard Units\n**************\n\nStandard units are defined in the `astropy.units` package as object\ninstances.\n\nAll units are defined in terms of basic \"irreducible\" units. The\nirreducible units include:\n\n  - Length (meter)\n  - Time (second)\n  - Mass (kilogram)\n  - Current (ampere)\n  - Temperature (Kelvin)\n  - Angular distance (radian)\n  - Solid angle (steradian)\n  - Luminous intensity (candela)\n  - Stellar magnitude (mag)\n  - Amount of substance (mole)\n  - Photon count (photon)\n\n(There are also some more obscure base units required by the `FITS Standard\n<https://fits.gsfc.nasa.gov/fits_standard.html>`_ that are no longer\nrecommended for use.)\n\nUnits that involve combinations of fundamental units are instances of\n`~astropy.units.CompositeUnit`. In most cases, you do not need\nto worry about the various kinds of unit classes unless you want to\ndesign a more complex case.\n\nThere are many units already predefined in the module. You may use the\n:meth:`~astropy.units.core.UnitBase.find_equivalent_units` method to list\nall of the existing predefined units of a given type::\n\n  >>> from astropy import units as u\n  >>> u.g.find_equivalent_units()\n    Primary name | Unit definition | Aliases\n  [\n    M_e          | 9.10938e-31 kg  |                                  ,\n    M_p          | 1.67262e-27 kg  |                                  ,\n    earthMass    | 5.97217e+24 kg  | M_earth, Mearth                  ,\n    g            | 0.001 kg        | gram                             ,\n    jupiterMass  | 1.89812e+27 kg  | M_jup, Mjup, M_jupiter, Mjupiter ,\n    kg           | irreducible     | kilogram                         ,\n    solMass      | 1.98841e+30 kg  | M_sun, Msun                      ,\n    t            | 1000 kg         | tonne                            ,\n    u            | 1.66054e-27 kg  | Da, Dalton                       ,\n  ]\n\n\nPrefixes\n========\n\nMost units can be used with prefixes, with both the standard `SI\n<https://www.bipm.org/documents/20126/41483022/SI-Brochure-9-EN.pdf>`_ prefixes\nand the `IEEE 1514-2002\n<https://ieeexplore.ieee.org/servlet/opac?punumber=5254929>`_ binary prefixes\n(for ``bit`` and ``byte``) supported:\n\n+------------------------------+\n|  Available decimal prefixes  |\n+--------+-------------+-------+\n| Symbol |    Prefix   | Value |\n+========+=============+=======+\n|    Y   |    yotta-   |  1e24 |\n+--------+-------------+-------+\n|    Z   |    zetta-   |  1e21 |\n+--------+-------------+-------+\n|    E   |     exa-    |  1e18 |\n+--------+-------------+-------+\n|    P   |    peta-    |  1e15 |\n+--------+-------------+-------+\n|    T   |    tera-    |  1e12 |\n+--------+-------------+-------+\n|    G   |    giga-    |  1e9  |\n+--------+-------------+-------+\n|    M   |    mega-    |  1e6  |\n+--------+-------------+-------+\n|    k   |    kilo-    |  1e3  |\n+--------+-------------+-------+\n|    h   |    hecto-   |  1e2  |\n+--------+-------------+-------+\n|   da   | deka-, deca |  1e1  |\n+--------+-------------+-------+\n|    d   |    deci-    |  1e-1 |\n+--------+-------------+-------+\n|    c   |    centi-   |  1e-2 |\n+--------+-------------+-------+\n|    m   |    milli-   |  1e-3 |\n+--------+-------------+-------+\n|    u   |    micro-   |  1e-6 |\n+--------+-------------+-------+\n|    n   |    nano-    |  1e-9 |\n+--------+-------------+-------+\n|    p   |    pico-    | 1e-12 |\n+--------+-------------+-------+\n|    f   |    femto-   | 1e-15 |\n+--------+-------------+-------+\n|    a   |    atto-    | 1e-18 |\n+--------+-------------+-------+\n|    z   |    zepto-   | 1e-21 |\n+--------+-------------+-------+\n|    y   |    yocto-   | 1e-24 |\n+--------+-------------+-------+\n\n+---------------------------+\n| Available binary prefixes |\n+--------+--------+---------+\n| Symbol | Prefix |  Value  |\n+========+========+=========+\n|   Ki   |  kibi- | 2 ** 10 |\n+--------+--------+---------+\n|   Mi   |  mebi- | 2 ** 20 |\n+--------+--------+---------+\n|   Gi   |  gibi- | 2 ** 30 |\n+--------+--------+---------+\n|   Ti   |  tebi- | 2 ** 40 |\n+--------+--------+---------+\n|   Pi   |  pebi- | 2 ** 50 |\n+--------+--------+---------+\n|   Ei   |  exbi- | 2 ** 60 |\n+--------+--------+---------+\n\n\n.. _doc_dimensionless_unit:\n\nThe Dimensionless Unit\n======================\n\nIn addition to these units, `astropy.units` includes the concept of\nthe dimensionless unit, used to indicate quantities that do not have a\nphysical dimension. This is distinct in concept from a unit that is\nequal to `None`: that indicates that no unit was specified in the data\nor by the user.\n\nFor convenience, there is a unit that is both dimensionless and\nunscaled: the ``dimensionless_unscaled`` object::\n\n   >>> u.dimensionless_unscaled\n   Unit(dimensionless)\n\nDimensionless quantities are often defined as products or ratios of\nquantities that are not dimensionless, but whose dimensions cancel out\nwhen their powers are multiplied.\n\nExamples\n--------\n\n.. EXAMPLE START: Dimensionless Units\n\nTo use the ``dimensionless_unscaled`` object::\n\n   >>> u.m / u.m\n   Unit(dimensionless)\n\nFor compatibility with the :ref:`astropy-units-format`, this is\nequivalent to ``Unit('')`` and ``Unit(1)``, though using\n``u.dimensionless_unscaled`` in Python code is preferred for\nreadability::\n\n   >>> u.dimensionless_unscaled == u.Unit('')\n   True\n   >>> u.dimensionless_unscaled == u.Unit(1)\n   True\n\nNote that in many cases, a dimensionless unit may also have a scale.\nFor example::\n\n   >>> (u.km / u.m).decompose()\n   Unit(dimensionless with a scale of 1000.0)\n   >>> (u.km / u.m).decompose() == u.dimensionless_unscaled\n   False\n\nAs an example of why you might want to create a scaled dimensionless\nquantity, say you will be doing many calculations with some big\nunit-less number, ``big_unitless_num = 20000000  # 20 million``,\nbut you want all of your answers to be in multiples of a million. This\ncan be done by dividing ``big_unitless_num`` by ``1e6``, but this\nrequires you to remember that this scaling factor has been applied,\nwhich may be difficult to do after many calculations. Instead, create\na scaled dimensionless quantity by multiplying a value by ``Unit(scale)``\nto keep track of the scaling factor. For example::\n\n   >>> scale = 1e6\n   >>> big_unitless_num = 20 * u.Unit(scale)  # 20 million\n\n   >>> some_measurement = 5.0 * u.cm\n   >>> some_measurement * big_unitless_num  # doctest: +FLOAT_CMP\n   <Quantity 100. 1e+06 cm>\n\nTo determine if a unit is dimensionless (but regardless of the scale),\nuse the `~astropy.units.core.UnitBase.physical_type` property::\n\n   >>> (u.km / u.m).physical_type\n   PhysicalType('dimensionless')\n   >>> # This also has a scale, so it is not the same as u.dimensionless_unscaled\n   >>> (u.km / u.m) == u.dimensionless_unscaled\n   False\n   >>> # However, (u.m / u.m) has a scale of 1.0, so it is the same\n   >>> (u.m / u.m) == u.dimensionless_unscaled\n   True\n\n.. EXAMPLE END\n\n.. _enabling-other-units:\n\nEnabling Other Units\n====================\n\nBy default, only the \"default\" units are searched by\n:meth:`~astropy.units.core.UnitBase.find_equivalent_units` and similar methods\nthat do searching. This includes `SI\n<https://www.bipm.org/documents/20126/41483022/SI-Brochure-9-EN.pdf>`_, `CGS\n<https://en.wikipedia.org/wiki/Centimetre-gram-second_system_of_units>`_, and\nastrophysical units. However, you may wish to enable the `Imperial\n<https://en.wikipedia.org/wiki/Imperial_units>`_ or other user-defined units.\n\nExample\n-------\n\n.. EXAMPLE START: Enabling Other Units\n\nTo enable Imperial units, do::\n\n    >>> from astropy.units import imperial\n    >>> imperial.enable()\n    <astropy.units.core._UnitContext object at ...>\n    >>> u.m.find_equivalent_units()\n      Primary name | Unit definition | Aliases\n    [\n      AU           | 1.49598e+11 m   | au, astronomical_unit            ,\n      Angstrom     | 1e-10 m         | AA, angstrom                     ,\n      cm           | 0.01 m          | centimeter                       ,\n      earthRad     | 6.3781e+06 m    | R_earth, Rearth                  ,\n      ft           | 0.3048 m        | foot                             ,\n      fur          | 201.168 m       | furlong                          ,\n      inch         | 0.0254 m        |                                  ,\n      jupiterRad   | 7.1492e+07 m    | R_jup, Rjup, R_jupiter, Rjupiter ,\n      lsec         | 2.99792e+08 m   | lightsecond                      ,\n      lyr          | 9.46073e+15 m   | lightyear                        ,\n      m            | irreducible     | meter                            ,\n      mi           | 1609.34 m       | mile                             ,\n      micron       | 1e-06 m         |                                  ,\n      mil          | 2.54e-05 m      | thou                             ,\n      nmi          | 1852 m          | nauticalmile, NM                 ,\n      pc           | 3.08568e+16 m   | parsec                           ,\n      solRad       | 6.957e+08 m     | R_sun, Rsun                      ,\n      yd           | 0.9144 m        | yard                             ,\n    ]\n\n\nThis may also be used with the `Python \"with\" statement\n<https://docs.python.org/3/reference/compound_stmts.html#with>`_, to\ntemporarily enable additional units::\n\n    >>> with imperial.enable():\n    ...     print(u.m.find_equivalent_units())\n          Primary name | Unit definition | Aliases\n    ...\n\nTo enable only specific units, use :func:`~astropy.units.add_enabled_units`::\n\n    >>> with u.add_enabled_units([imperial.knot]):\n    ...     print(u.m.find_equivalent_units())\n          Primary name | Unit definition | Aliases\n    ...\n\n.. EXAMPLE END\n"},{"col":4,"comment":"\n        Creates an `HDUList` instance from a file-like object.\n\n        The actual implementation of ``fitsopen()``, and generally shouldn't\n        be used directly.  Use :func:`open` instead (and see its\n        documentation for details of the parameters accepted by this method).\n        ","endLoc":413,"header":"@classmethod\n    def fromfile(cls, fileobj, mode=None, memmap=None,\n                 save_backup=False, cache=True, lazy_load_hdus=True,\n                 ignore_missing_simple=False, **kwargs)","id":184,"name":"fromfile","nodeType":"Function","startLoc":398,"text":"@classmethod\n    def fromfile(cls, fileobj, mode=None, memmap=None,\n                 save_backup=False, cache=True, lazy_load_hdus=True,\n                 ignore_missing_simple=False, **kwargs):\n        \"\"\"\n        Creates an `HDUList` instance from a file-like object.\n\n        The actual implementation of ``fitsopen()``, and generally shouldn't\n        be used directly.  Use :func:`open` instead (and see its\n        documentation for details of the parameters accepted by this method).\n        \"\"\"\n\n        return cls._readfrom(fileobj=fileobj, mode=mode, memmap=memmap,\n                             save_backup=save_backup, cache=cache,\n                             ignore_missing_simple=ignore_missing_simple,\n                             lazy_load_hdus=lazy_load_hdus, **kwargs)"},{"id":185,"name":"index.rst","nodeType":"TextFile","path":"docs/units","text":".. _astropy-units:\n\n**************************************\nUnits and Quantities (`astropy.units`)\n**************************************\n\n.. currentmodule:: astropy.units\n\nIntroduction\n============\n\n`astropy.units` handles defining, converting between, and performing\narithmetic with physical quantities, such as meters, seconds, Hz,\netc. It also handles logarithmic units such as magnitude and decibel.\n\n`astropy.units` does not know spherical geometry or sexagesimal\n(hours, min, sec): if you want to deal with celestial coordinates,\nsee the `astropy.coordinates` package.\n\nGetting Started\n===============\n\nMost users of the `astropy.units` package will work with :ref:`Quantity objects\n<quantity>`: the combination of a value and a unit. The most convenient way to\ncreate a |Quantity| is to multiply or divide a value by one of the built-in\nunits. It works with scalars, sequences, and ``numpy`` arrays.\n\nExamples\n--------\n\n.. EXAMPLE START: Creating and Combining Quantities with Units\n\nTo create a |Quantity| object::\n\n    >>> from astropy import units as u\n    >>> 42.0 * u.meter  # doctest: +FLOAT_CMP\n    <Quantity  42. m>\n    >>> [1., 2., 3.] * u.m  # doctest: +FLOAT_CMP\n    <Quantity [1., 2., 3.] m>\n    >>> import numpy as np\n    >>> np.array([1., 2., 3.]) * u.m  # doctest: +FLOAT_CMP\n    <Quantity [1., 2., 3.] m>\n\nYou can get the unit and value from a |Quantity| using the unit and\nvalue members::\n\n    >>> q = 42.0 * u.meter\n    >>> q.value\n    42.0\n    >>> q.unit\n    Unit(\"m\")\n\nFrom this basic building block, it is possible to start combining\nquantities with different units::\n\n    >>> 15.1 * u.meter / (32.0 * u.second)  # doctest: +FLOAT_CMP\n    <Quantity 0.471875 m / s>\n    >>> 3.0 * u.kilometer / (130.51 * u.meter / u.second)  # doctest: +FLOAT_CMP\n    <Quantity 0.022986744310780783 km s / m>\n    >>> (3.0 * u.kilometer / (130.51 * u.meter / u.second)).decompose()  # doctest: +FLOAT_CMP\n    <Quantity 22.986744310780782 s>\n\nUnit conversion is done using the\n:meth:`~astropy.units.quantity.Quantity.to` method, which returns a new\n|Quantity| in the given unit::\n\n    >>> x = 1.0 * u.parsec\n    >>> x.to(u.km)  # doctest: +FLOAT_CMP\n    <Quantity 30856775814671.914 km>\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Creating Custom Units for Quantity Objects\n\nIt is also possible to work directly with units at a lower level, for\nexample, to create custom units::\n\n    >>> from astropy.units import imperial\n\n    >>> cms = u.cm / u.s\n    >>> # ...and then use some imperial units\n    >>> mph = imperial.mile / u.hour\n\n    >>> # And do some conversions\n    >>> q = 42.0 * cms\n    >>> q.to(mph)  # doctest: +FLOAT_CMP\n    <Quantity 0.939513242662849 mi / h>\n\nUnits that \"cancel out\" become a special unit called the\n\"dimensionless unit\":\n\n    >>> u.m / u.m\n    Unit(dimensionless)\n\nTo create a basic :ref:`dimensionless quantity <doc_dimensionless_unit>`,\nmultiply a value by the unscaled dimensionless unit::\n\n    >>> q = 1.0 * u.dimensionless_unscaled\n    >>> q.unit\n    Unit(dimensionless)\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Matching and Converting Between Units\n\n`astropy.units` is able to match compound units against the units it already\nknows about::\n\n    >>> (u.s ** -1).compose()  # doctest: +SKIP\n    [Unit(\"Bq\"), Unit(\"Hz\"), Unit(\"2.7027e-11 Ci\")]\n\nAnd it can convert between unit systems, such as `SI\n<https://www.bipm.org/documents/20126/41483022/SI-Brochure-9-EN.pdf>`_ or `CGS\n<https://en.wikipedia.org/wiki/Centimetre-gram-second_system_of_units>`_::\n\n    >>> (1.0 * u.Pa).cgs\n    <Quantity 10. P / s>\n\nThe units ``mag``, ``dex``, and ``dB`` are special, being :ref:`logarithmic\nunits <logarithmic_units>`, for which a value is the logarithm of a physical\nquantity in a given unit. These can be used with a physical unit in\nparentheses to create a corresponding logarithmic quantity::\n\n    >>> -2.5 * u.mag(u.ct / u.s)\n    <Magnitude -2.5 mag(ct / s)>\n    >>> from astropy import constants as c\n    >>> u.Dex((c.G * u.M_sun / u.R_sun**2).cgs)  # doctest: +FLOAT_CMP\n    <Dex 4.438067627303133 dex(cm / s2)>\n\n`astropy.units` also handles :ref:`equivalencies <unit_equivalencies>`, such as\nthat between wavelength and frequency. To use that feature, equivalence objects\nare passed to the :meth:`~astropy.units.quantity.Quantity.to` conversion\nmethod. For instance, a conversion from wavelength to frequency does not\nnormally work:\n\n    >>> (1000 * u.nm).to(u.Hz)  # doctest: +IGNORE_EXCEPTION_DETAIL\n    Traceback (most recent call last):\n      ...\n    UnitConversionError: 'nm' (length) and 'Hz' (frequency) are not convertible\n\nBut by passing an equivalency list, in this case\n:func:`~astropy.units.equivalencies.spectral`, it does:\n\n    >>> (1000 * u.nm).to(u.Hz, equivalencies=u.spectral())  # doctest: +FLOAT_CMP\n    <Quantity  2.99792458e+14 Hz>\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Printing Quantities and Units to Strings\n\nQuantities and units can be :ref:`printed nicely to strings\n<astropy-units-format>` using the `Format String Syntax\n<https://docs.python.org/3/library/string.html#format-string-syntax>`_. Format\nspecifiers (like ``0.03f``) in strings will be used to format the quantity\nvalue::\n\n    >>> q = 15.1 * u.meter / (32.0 * u.second)\n    >>> q  # doctest: +FLOAT_CMP\n    <Quantity 0.471875 m / s>\n    >>> f\"{q:0.03f}\"\n    '0.472 m / s'\n\nThe value and unit can also be formatted separately. Format specifiers\nfor units can be used to choose the unit formatter::\n\n    >>> q = 15.1 * u.meter / (32.0 * u.second)\n    >>> q  # doctest: +FLOAT_CMP\n    <Quantity 0.471875 m / s>\n    >>> f\"{q.value:0.03f} {q.unit:FITS}\"\n    '0.472 m s-1'\n\n.. EXAMPLE END\n\nUsing `astropy.units`\n=====================\n\n.. toctree::\n   :maxdepth: 2\n\n   quantity\n   type_hints\n   standard_units\n   combining_and_defining\n   decomposing_and_composing\n   logarithmic_units\n   structured_units\n   format\n   equivalencies\n   physical_types\n   constants_versions\n   conversion\n\nAcknowledgments\n===============\n\nThis code was originally based on the `pynbody\n<https://github.com/pynbody/pynbody>`__ units module written by Andrew\nPontzen, who has granted the Astropy Project permission to use the code\nunder a BSD license.\n\nSee Also\n========\n\n- `FITS Standard <https://fits.gsfc.nasa.gov/fits_standard.html>`_ for\n  units in FITS.\n\n- The `Units in the VO 1.0 Standard\n  <http://www.ivoa.net/documents/VOUnits/>`_ for representing units in\n  the VO.\n\n- OGIP Units: A standard for storing units in `OGIP FITS files\n  <https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/general/ogip_93_001/>`_.\n\n- `Standards for astronomical catalogues: units\n  <http://vizier.u-strasbg.fr/vizier/doc/catstd-3.2.htx>`_.\n\n- `IAU Style Manual\n  <https://www.iau.org/static/publications/stylemanual1989.pdf>`_.\n\n- `A table of astronomical unit equivalencies\n  <https://www.stsci.edu/~strolger/docs/UNITS.txt>`_.\n\n.. note that if this section gets too long, it should be moved to a separate\n   doc page - see the top of performance.inc.rst for the instructions on how to do\n   that\n.. include:: performance.inc.rst\n\nReference/API\n=============\n\n.. automodapi:: astropy.units.quantity\n\n.. automodapi:: astropy.units\n\n.. automodapi:: astropy.units.format\n\n.. automodapi:: astropy.units.si\n\n.. automodapi:: astropy.units.cgs\n\n.. automodapi:: astropy.units.astrophys\n\n.. automodapi:: astropy.units.misc\n\n.. automodapi:: astropy.units.function.units\n\n.. automodapi:: astropy.units.photometric\n\n.. automodapi:: astropy.units.imperial\n\n.. automodapi:: astropy.units.cds\n\n.. automodapi:: astropy.units.physical\n\n.. automodapi:: astropy.units.equivalencies\n\n.. automodapi:: astropy.units.function\n\n.. automodapi:: astropy.units.function.logarithmic\n   :include-all-objects:\n\n.. automodapi:: astropy.units.deprecated\n\n.. automodapi:: astropy.units.required_by_vounit\n"},{"id":186,"name":"performance.inc.rst","nodeType":"TextFile","path":"docs/units","text":".. note that if this is changed from the default approach of using an *include*\n   (in index.rst) to a separate performance page, the header needs to be changed\n   from === to ***, the filename extension needs to be changed from .inc.rst to\n   .rst, and a link needs to be added in the subpackage toctree\n\n.. _astropy-units-performance:\n\nPerformance Tips\n================\n\nIf you are attaching units to arrays to make |Quantity| objects, multiplying\narrays by units will result in the array being copied in memory, which will slow\nthings down. Furthermore, if you are multiplying an array by a composite unit,\nthe array will be copied for each individual multiplication. Thus, in the\nfollowing case, the array is copied four successive times::\n\n    In [1]: array = np.random.random(10000000)\n\n    In [2]: %timeit array * u.m / u.s / u.kg / u.sr\n    92.5 ms ± 2.52 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\n\nThere are several ways to speed this up. First, when you are using composite\nunits, ensure that the entire unit gets evaluated first, then attached to the\narray. You can do this by using parentheses as for any other operation::\n\n    In [3]: %timeit array * (u.m / u.s / u.kg / u.sr)\n    21.5 ms ± 886 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n\nIn this case, this has sped things up by a factor of 4. If you use a composite\nunit several times in your code then you can define a variable for it::\n\n    In [4]: UNIT_MSKGSR = u.m / u.s / u.kg / u.sr\n\n    In [5]: %timeit array * UNIT_MSKGSR\n    22.2 ms ± 551 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n\nIn this case and the case with brackets, the array is still copied once when\ncreating the |Quantity|. If you want to avoid any copies altogether, you can\nmake use of the ``<<`` operator to attach the unit to the array::\n\n    In [6]: %timeit array << u.m / u.s / u.kg / u.sr\n    47.1 µs ± 5.77 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)\n\nNote that these are now **microseconds**, so this is 2000x faster than the\noriginal case with no brackets. Note that brackets are not needed when using\n``<<`` since ``*`` and ``/`` have a higher precedence, so the unit will be\nevaluated first. When using ``<<``, be aware that because the data is not being\ncopied, changing the original array will also change the |Quantity| object.\n\nNote that for composite units, you will definitely see an\nimpact if you can pre-compute the composite unit::\n\n    In [7]: %timeit array << UNIT_MSKGSR\n    6.51 µs ± 112 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)\n\nWhich is over 10000x faster than the original example. See\n:ref:`astropy-units-quantity-no-copy` for more details about the ``<<``\noperator.\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":57,"id":187,"name":"key","nodeType":"Attribute","startLoc":57,"text":"key"},{"id":188,"name":"constants_versions.rst","nodeType":"TextFile","path":"docs/units","text":"Using Prior Versions of Constants\n*********************************\n\nBy default, `astropy.units` are initialized upon first import to use\nthe current versions of `astropy.constants`. For units to initialize\nproperly to a prior version of constants, the constants versions must\nbe set before the first import of `astropy.units` or `astropy.constants`.\n\nThis is accomplished using :class:`~astropy.utils.state.ScienceState` classes\nin the top-level package. Setting the prior versions at the start of a Python\nsession will allow consistent units.\n\nExample\n=======\n\n.. EXAMPLE START: Using Prior Versions of Constants\n\nTo initialize units to a prior version of constants:\n\n>>> import astropy\n>>> astropy.physical_constants.set('codata2010')  # doctest: +SKIP\n<ScienceState physical_constants: 'codata2010'>\n>>> astropy.astronomical_constants.set('iau2012')  # doctest: +SKIP\n<ScienceState astronomical_constants: 'iau2012'>\n>>> import astropy.units as u\n>>> import astropy.constants as const\n>>> (const.M_sun / u.M_sun).to(u.dimensionless_unscaled) - 1  # doctest: +SKIP\n<Quantity 0.>\n>>> print(const.M_sun)  # doctest: +SKIP\n  Name   = Solar mass\n  Value  = 1.9891e+30\n  Uncertainty  = 5e+25\n  Unit  = kg\n  Reference = Allen's Astrophysical Quantities 4th Ed.\n\nIf :mod:`astropy.units` has already been imported, a :class:`RuntimeError` is\nraised.\n\n.. EXAMPLE END\n"},{"id":189,"name":"equivalencies.rst","nodeType":"TextFile","path":"docs/units","text":".. _unit_equivalencies:\n\nEquivalencies\n*************\n\nThe unit module has machinery for supporting equivalences between\ndifferent units in certain contexts, namely when equations can\nuniquely relate a value in one unit to a different unit. A good\nexample is the equivalence between wavelength, frequency, and energy\nfor specifying a wavelength of radiation. Normally these units are not\nconvertible, but when understood as representing light, they are\nconvertible in certain contexts. Here we describe how to use the\nequivalencies included in `astropy.units` and how to\ndefine new equivalencies.\n\nEquivalencies are used by passing a list of equivalency pairs to the\n``equivalencies`` keyword argument of `Quantity.to()\n<astropy.units.quantity.Quantity.to>` or `Unit.to()\n<astropy.units.core.UnitBase.to>` methods. The list can be supplied directly,\nbut ``astropy`` contains several functions that return appropriate lists so\nconstructing them is often not necessary. Alternatively, if a larger piece of\ncode needs the same equivalencies, you can set them for a :ref:`given context\n<equivalency-context>`.\n\nBuilt-In Equivalencies\n======================\n\nHow to Convert Parallax to Distance\n-----------------------------------\n\nThe length unit *parsec* is defined such that a star one parsec away\nwill exhibit a 1-arcsecond parallax. (Think of the name as a contraction\nbetween *parallax* and *arcsecond*.)\n\nThe :func:`~astropy.units.equivalencies.parallax` function handles\nconversions between parallax angles and length.\n\n.. EXAMPLE START: Converting Parallax to Distance\n\nIn general, you should not be able to change units of length into\nangles or vice versa, so :meth:`~astropy.units.core.UnitBase.to`\nraises an exception::\n\n  >>> from astropy import units as u\n  >>> (0.8 * u.arcsec).to(u.parsec)  # doctest: +IGNORE_EXCEPTION_DETAIL\n  Traceback (most recent call last):\n    ...\n  UnitConversionError: 'arcsec' (angle) and 'pc' (length) are not convertible\n\nTo trigger the conversion between parallax angle and distance, provide\n:func:`~astropy.units.equivalencies.parallax` as the optional keyword\nargument (``equivalencies=``) to the\n:meth:`~astropy.units.core.UnitBase.to` method.\n\n    >>> (0.8 * u.arcsec).to(u.parsec, equivalencies=u.parallax())\n    <Quantity 1.25 pc>\n\n.. EXAMPLE END\n\nAngles as Dimensionless Units\n-----------------------------\n\nAngles are treated as a physically distinct type, which usually helps to avoid\nmistakes. However, this is not very handy when working with units related to\nrotational energy or the small angle approximation. (Indeed, this\ndouble-sidedness underlies why radians went from a `supplementary to derived unit\n<https://www.bipm.org/en/committees/cg/cgpm/20-1995/resolution-8>`__.) The function\n:func:`~astropy.units.equivalencies.dimensionless_angles` provides the required\nequivalency list that helps convert between angles and dimensionless units. It\nis somewhat different from all others in that it allows an arbitrary change in\nthe number of powers to which radians is raised (i.e., including zero and\nthus dimensionless).\n\nExamples\n^^^^^^^^\n\n.. EXAMPLE START: Angles as Dimensionless Units\n\nNormally the following would raise exceptions::\n\n  >>> u.degree.to('')  # doctest: +IGNORE_EXCEPTION_DETAIL\n  Traceback (most recent call last):\n    ...\n  UnitConversionError: 'deg' (angle) and '' (dimensionless) are not convertible\n  >>> (u.kg * u.m**2 * (u.cycle / u.s)**2).to(u.J)  # doctest: +IGNORE_EXCEPTION_DETAIL\n  Traceback (most recent call last):\n    ...\n  UnitConversionError: 'cycle2 kg m2 / s2' and 'J' (energy) are not convertible\n\nBut when passing the proper conversion function,\n:func:`~astropy.units.equivalencies.dimensionless_angles`, it works.\n\n  >>> u.deg.to('', equivalencies=u.dimensionless_angles())  # doctest: +FLOAT_CMP\n  0.017453292519943295\n  >>> (0.5e38 * u.kg * u.m**2 * (u.cycle / u.s)**2).to(u.J,\n  ...                            equivalencies=u.dimensionless_angles())  # doctest: +FLOAT_CMP\n  <Quantity 1.9739208802178715e+39 J>\n  >>> import numpy as np\n  >>> np.exp((1j*0.125*u.cycle).to('', equivalencies=u.dimensionless_angles())) # doctest: +FLOAT_CMP\n  <Quantity  0.70710678+0.70710678j>\n\n.. EXAMPLE END\n\nIn an example with complex numbers you may well be doing a fair\nnumber of similar calculations. For such situations, there is the\noption to :ref:`set default equivalencies <equivalency-context>`.\n\nIn some situations, this equivalency may behave differently than\nanticipated. For instance, it might at first seem reasonable to use it\nfor converting from an angular velocity :math:`\\omega` in radians per\nsecond to the corresponding frequency :math:`f` in hertz (i.e., to\nimplement :math:`f=\\omega/2\\pi`). However, attempting this yields:\n\n  >>> (1*u.rad/u.s).to(u.Hz, equivalencies=u.dimensionless_angles())  # doctest: +FLOAT_CMP\n  <Quantity 1. Hz>\n  >>> (1*u.cycle/u.s).to(u.Hz, equivalencies=u.dimensionless_angles())  # doctest: +FLOAT_CMP\n  <Quantity 6.283185307179586 Hz>\n\nHere, we might have expected ~0.159 Hz in the first example and 1 Hz in\nthe second. However, :func:`~astropy.units.equivalencies.dimensionless_angles`\nconverts to radians per second and then drops radians as a unit. The\nimplicit mistake made in these examples is that the unit Hz is taken to be\nequivalent to cycles per second, which it is not (it is just \"per second\").\nThis realization also leads to the solution: to use an explicit equivalency\nbetween cycles per second and hertz:\n\n  >>> (1*u.rad/u.s).to(u.Hz, equivalencies=[(u.cy/u.s, u.Hz)])  # doctest: +FLOAT_CMP\n  <Quantity 0.15915494309189535 Hz>\n  >>> (1*u.cy/u.s).to(u.Hz, equivalencies=[(u.cy/u.s, u.Hz)])  # doctest: +FLOAT_CMP\n  <Quantity 1. Hz>\n\n.. _astropy-units-spectral-equivalency:\n\nSpectral Units\n--------------\n\n:func:`~astropy.units.equivalencies.spectral` is a function that returns\nan equivalency list to handle conversions between wavelength,\nfrequency, energy, and wave number.\n\n.. EXAMPLE START: Using Spectral Units for Conversions\n\nAs mentioned with parallax units, we pass a list of equivalencies (in this case,\nthe result of :func:`~astropy.units.equivalencies.spectral`) as the second\nargument to the :meth:`~astropy.units.quantity.Quantity.to` method and\nwavelength, and then frequency and energy can be converted.\n\n  >>> ([1000, 2000] * u.nm).to(u.Hz, equivalencies=u.spectral())  # doctest: +FLOAT_CMP\n  <Quantity [2.99792458e+14, 1.49896229e+14] Hz>\n  >>> ([1000, 2000] * u.nm).to(u.eV, equivalencies=u.spectral())  # doctest: +FLOAT_CMP\n  <Quantity [1.23984193, 0.61992096] eV>\n\nThese equivalencies even work with non-base units::\n\n  >>> # Inches to calories\n  >>> from astropy.units import imperial\n  >>> imperial.inch.to(imperial.Cal, equivalencies=u.spectral())  # doctest: +FLOAT_CMP\n  1.869180759162485e-27\n\n.. EXAMPLE END\n\n.. _astropy-units-doppler-equivalencies:\n\nSpectral (Doppler) Equivalencies\n--------------------------------\n\nSpectral equivalencies allow you to convert between wavelength,\nfrequency, energy, and wave number, but not to velocity, which is\nfrequently the quantity of interest.\n\nIt is fairly convenient to define the equivalency, but note that there are\ndifferent `conventions <https://www.gb.nrao.edu/~fghigo/gbtdoc/doppler.html>`__.\nIn these conventions :math:`f_0` is the rest frequency, :math:`f` is the\nobserved frequency, :math:`V` is the velocity, and :math:`c` is the speed of\nlight:\n\n    * Radio         :math:`V = c \\frac{f_0 - f}{f_0}  ;  f(V) = f_0 ( 1 - V/c )`\n    * Optical       :math:`V = c \\frac{f_0 - f}{f  }  ;  f(V) = f_0 ( 1 + V/c )^{-1}`\n    * Relativistic  :math:`V = c \\frac{f_0^2 - f^2}{f_0^2 + f^2} ;  f(V) = f_0 \\frac{\\left(1 - (V/c)^2\\right)^{1/2}}{(1+V/c)}`\n\nThese three conventions are implemented in\n:mod:`astropy.units.equivalencies` as\n:func:`~astropy.units.equivalencies.doppler_optical`,\n:func:`~astropy.units.equivalencies.doppler_radio`, and\n:func:`~astropy.units.equivalencies.doppler_relativistic`.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Using Spectral (Doppler) Equivalencies\n\nTo define an equivalency::\n\n    >>> restfreq = 115.27120 * u.GHz  # rest frequency of 12 CO 1-0 in GHz\n    >>> freq_to_vel = u.doppler_radio(restfreq)\n    >>> (116e9 * u.Hz).to(u.km / u.s, equivalencies=freq_to_vel)  # doctest: +FLOAT_CMP\n    <Quantity -1895.4321928669085 km / s>\n\n.. EXAMPLE END\n\nSpectral Flux and Luminosity Density Units\n------------------------------------------\n\nThere is also support for spectral flux and luminosity density units,\ntheir equivalent surface brightness units, and integrated flux units. Their use\nis more complex, since it is necessary to also supply the location in the\nspectrum for which the conversions will be done, and the units of those spectral\nlocations. The function that handles these unit conversions is\n:func:`~astropy.units.equivalencies.spectral_density`. This function takes as\nits arguments the |Quantity| for the spectral location.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Converting Spectral Flux and Luminosity Density Units\n\nTo perform unit conversions with\n:func:`~astropy.units.equivalencies.spectral_density`::\n\n    >>> (1.5 * u.Jy).to(u.photon / u.cm**2 / u.s / u.Hz,\n    ...                 equivalencies=u.spectral_density(3500 * u.AA)) # doctest: +FLOAT_CMP\n    <Quantity 2.6429114293019694e-12 ph / (cm2 Hz s)>\n    >>> (1.5 * u.Jy).to(u.photon / u.cm**2 / u.s / u.micron,\n    ...                 equivalencies=u.spectral_density(3500 * u.AA))  # doctest: +FLOAT_CMP\n    <Quantity 6467.9584789120845 ph / (cm2 micron s)>\n    >>> a = 1. * (u.photon / u.s / u.angstrom)\n    >>> a.to(u.erg / u.s / u.Hz,\n    ...      equivalencies=u.spectral_density(5500 * u.AA))  # doctest: +FLOAT_CMP\n    <Quantity 3.6443382634999996e-23 erg / (Hz s)>\n    >>> w = 5000 * u.AA\n    >>> a = 1. * (u.erg / u.cm**2 / u.s)\n    >>> b = a.to(u.photon / u.cm**2 / u.s, u.spectral_density(w))\n    >>> b  # doctest: +FLOAT_CMP\n    <Quantity 2.51705828e+11 ph / (cm2 s)>\n    >>> b.to(a.unit, u.spectral_density(w))  # doctest: +FLOAT_CMP\n    <Quantity 1. erg / (cm2 s)>\n\n.. EXAMPLE END\n\nBrightness Temperature and Surface Brightness Equivalency\n---------------------------------------------------------\n\nThere is an equivalency between surface brightness (flux density per area) and\nbrightness temperature. This equivalency is often referred to as \"Antenna Gain\"\nsince, at a given frequency, telescope brightness sensitivity is unrelated to\naperture size, but flux density sensitivity is, so this equivalency is only\ndependent on the aperture size. See `Tools of Radio Astronomy\n<https://books.google.com/books?id=9KHw6R8rQEMC&pg=PA179&source=gbs_toc_r&cad=4#v=onepage&q&f=false>`_\nfor details.\n\n.. note:: The brightness temperature mentioned here is the Rayleigh-Jeans\n          equivalent temperature, which results in a linear relation between\n          flux and temperature. This is the convention that is most often used\n          in relation to observations, but if you are interested in computing\n          the *exact* temperature of a blackbody function that would produce a\n          given flux, you should not use this equivalency.\n\nExamples\n^^^^^^^^\n\n.. EXAMPLE START: Converting Brightness Temperature and Surface Brightness\n   Equivalency\n\nThe :func:`~astropy.units.equivalencies.brightness_temperature` equivalency\nrequires the beam area and frequency as arguments. Recalling that the area of a\n2D Gaussian is :math:`2 \\pi \\sigma^2` (see `wikipedia\n<https://en.wikipedia.org/wiki/Gaussian_function#Two-dimensional_Gaussian_function>`_),\nhere is an example::\n\n    >>> beam_sigma = 50*u.arcsec\n    >>> omega_B = 2 * np.pi * beam_sigma**2\n    >>> freq = 5 * u.GHz\n    >>> (1*u.Jy/omega_B).to(u.K, equivalencies=u.brightness_temperature(freq))  # doctest: +FLOAT_CMP\n    <Quantity 3.526295144567176 K>\n\nIf you have beam full-width half-maxima (FWHM), which are often quoted and are\nthe values stored in the FITS header keywords BMAJ and BMIN, a more appropriate\nexample converts the FWHM to sigma::\n\n    >>> beam_fwhm = 50*u.arcsec\n    >>> fwhm_to_sigma = 1. / (8 * np.log(2))**0.5\n    >>> beam_sigma = beam_fwhm * fwhm_to_sigma\n    >>> omega_B = 2 * np.pi * beam_sigma**2\n    >>> (1*u.Jy/omega_B).to(u.K, equivalencies=u.brightness_temperature(freq))  # doctest: +FLOAT_CMP\n    <Quantity 19.553932298231704 K>\n\nYou can also convert between ``Jy/beam`` and ``K`` by specifying the beam area::\n\n    >>> (1*u.Jy/u.beam).to(u.K, u.brightness_temperature(freq, beam_area=omega_B))  # doctest: +FLOAT_CMP\n    <Quantity 19.553932298231704 K>\n\n.. EXAMPLE END\n\nBeam Equivalency\n----------------\n\nRadio data, especially from interferometers, is often produced in units of\n``Jy/beam``. Converting this number to a beam-independent value (e.g.,\n``Jy/sr``), can be done with the\n:func:`~astropy.units.equivalencies.beam_angular_area` equivalency.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Converting Radio Data to a Beam-Independent Value\n\nTo convert units of ``Jy/beam`` to ``Jy/sr``::\n\n    >>> beam_fwhm = 50*u.arcsec\n    >>> fwhm_to_sigma = 1. / (8 * np.log(2))**0.5\n    >>> beam_sigma = beam_fwhm * fwhm_to_sigma\n    >>> omega_B = 2 * np.pi * beam_sigma**2\n    >>> (1*u.Jy/u.beam).to(u.MJy/u.sr, equivalencies=u.beam_angular_area(omega_B))  # doctest: +FLOAT_CMP\n    <Quantity 15.019166691021288 MJy / sr>\n\n\nNote that the `radio_beam <https://github.com/radio-astro-tools/radio-beam>`_\npackage deals with beam input/output and various operations more directly.\n\n.. EXAMPLE END\n\nTemperature Energy Equivalency\n------------------------------\n\nThe :func:`~astropy.units.equivalencies.temperature_energy` equivalency allows\nconversion between temperature and its equivalent in energy (i.e., the\ntemperature multiplied by the Boltzmann constant), usually expressed in\nelectronvolts. This is used frequently for observations at high-energy, be it\nfor solar or X-ray astronomy.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Temperature Energy Equivalency\n\nTo convert between temperature and its equivalent in energy::\n\n    >>> t_k = 1e6 * u.K\n    >>> t_k.to(u.eV, equivalencies=u.temperature_energy())  # doctest: +FLOAT_CMP\n    <Quantity 86.17332384960955 eV>\n\n.. EXAMPLE END\n\n.. _tcmb-equivalency:\n\nThermodynamic Temperature Equivalency\n-------------------------------------\n\nThis :func:`~astropy.units.equivalencies.thermodynamic_temperature`\nequivalency allows conversion between ``Jy/beam`` and \"thermodynamic\ntemperature\", :math:`T_{CMB}`, in Kelvins.\n\nExamples\n^^^^^^^^\n\n.. EXAMPLE START: Thermodynamic Temperature Equivalency\n\nTo convert between ``Jy/beam`` and thermodynamic temperature::\n\n    >>> nu = 143 * u.GHz\n    >>> t_k = 0.002632051878 * u.K\n    >>> t_k.to(u.MJy / u.sr, equivalencies=u.thermodynamic_temperature(nu))  # doctest: +FLOAT_CMP\n    <Quantity 1. MJy / sr>\n\nBy default, this will use the :math:`T_{CMB}` value for the default\n:ref:`cosmology <astropy-cosmology>` in ``astropy``, but it is possible to\nspecify a custom :math:`T_{CMB}` value for a specific cosmology as the second\nargument to the equivalency::\n\n    >>> from astropy.cosmology import WMAP9\n    >>> t_k.to(u.MJy / u.sr, equivalencies=u.thermodynamic_temperature(nu, T_cmb=WMAP9.Tcmb0))  # doctest: +FLOAT_CMP\n    <Quantity 0.99982392 MJy / sr>\n\n.. EXAMPLE END\n\nMolar Mass AMU Equivalency\n--------------------------\n\nThe :func:`~astropy.units.equivalencies.molar_mass_amu` equivalency allows\nconversion between the atomic mass unit and the equivalent g/mol. For context,\nrefer to the `NIST definition of SI Base Units\n<https://www.nist.gov/si-redefinition/definitions-si-base-units>`_.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Molar Mass AMU Equivalency\n\nTo convert between atomic mass unit and the equivalent g/mol::\n\n    >>> x = 1 * (u.g / u.mol)\n    >>> y = 1 * u.u\n    >>> x.to(u.u, equivalencies=u.molar_mass_amu()) # doctest: +FLOAT_CMP\n    <Quantity 1.0 u>\n    >>> y.to(u.g/u.mol, equivalencies=u.molar_mass_amu()) # doctest: +FLOAT_CMP\n    <Quantity 1.0 g / mol>\n\n.. EXAMPLE END\n\nPixel and Plate Scale Equivalencies\n-----------------------------------\n\nThese equivalencies are for converting between angular scales and either linear\nscales in the focal plane or distances in units of the number of pixels.\n\nExamples\n^^^^^^^^\n\n.. EXAMPLE START: Pixel and Plate Scale Equivalencies\n\nSuppose you are working with cutouts from the Sloan Digital Sky Survey,\nwhich defaults to a pixel scale of 0.4 arcseconds per pixel, and want to know\nthe true size of something that you measure to be 240 pixels across in the\ncutout image::\n\n    >>> sdss_pixelscale = u.pixel_scale(0.4*u.arcsec/u.pixel)\n    >>> (240*u.pixel).to(u.arcmin, sdss_pixelscale)  # doctest: +FLOAT_CMP\n    <Quantity 1.6 arcmin>\n\nOr maybe you are designing an instrument for a telescope that someone told you\nhas an inverse plate scale of 7.8 meters per radian (for your desired focus),\nand you want to know how big your pixels need to be to cover half an arcsecond.\nUsing :func:`~astropy.units.equivalencies.plate_scale`::\n\n    >>> tel_platescale = u.plate_scale(7.8*u.m/u.radian)\n    >>> (0.5*u.arcsec).to(u.micron, tel_platescale)  # doctest: +FLOAT_CMP\n    <Quantity 18.9077335632719 micron>\n\nThe :func:`~astropy.units.equivalencies.pixel_scale` equivalency can also work\nin more general context, where the scale is specified as any quantity that is\nreducible to ``<composite unit>/u.pix`` or ``u.pix/<composite unit>`` (that is,\nthe dimensionality of ``u.pix`` is 1 or -1). For instance, you may define the\ndots per inch (DPI) for a digital image to calculate its physical size::\n\n    >>> dpi = u.pixel_scale(100 * u.pix / u.imperial.inch)\n    >>> (1024 * u.pix).to(u.cm, dpi)  # doctest: +FLOAT_CMP\n    <Quantity 26.0096 cm>\n\n.. EXAMPLE END\n\nPhotometric Zero Point Equivalency\n----------------------------------\n\nThe :func:`~astropy.units.zero_point_flux` equivalency provides a way to move\nbetween photometric systems (i.e., those defined relative to a particular\nzero-point flux) and absolute fluxes. This is most useful in conjunction with\nsupport for :ref:`logarithmic_units`.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Photometric Zero Point Equivalency\n\nSuppose you are observing a target with a filter with a reported standard zero\npoint of 3631.1 Jy::\n\n    >>> target_flux = 1.2 * u.nanomaggy\n    >>> zero_point_star_equiv = u.zero_point_flux(3631.1 * u.Jy)\n    >>> u.Magnitude(target_flux.to(u.AB, zero_point_star_equiv))  # doctest: +FLOAT_CMP\n    <Magnitude 22.30195136 mag(AB)>\n\n.. EXAMPLE END\n\nTemperature Equivalency\n-----------------------\n\nThe :func:`~astropy.units.temperature` equivalency allows conversion\nbetween the Celsius, Fahrenheit, Rankine and Kelvin.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Using the Temperature Equivalency\n\nTo convert between temperature scales::\n\n    >>> temp_C = 0 * u.Celsius\n    >>> temp_Kelvin = temp_C.to(u.K, equivalencies=u.temperature())\n    >>> temp_Kelvin  # doctest: +FLOAT_CMP\n    <Quantity 273.15 K>\n    >>> temp_F = temp_C.to(u.imperial.deg_F, equivalencies=u.temperature())\n    >>> temp_F  # doctest: +FLOAT_CMP\n    <Quantity 32. deg_F>\n    >>> temp_R = temp_C.to(u.imperial.deg_R, equivalencies=u.temperature())\n    >>> temp_R  # doctest: +FLOAT_CMP\n    <Quantity 491.67 deg_R>\n\n.. note:: You can also use ``u.deg_C`` instead of ``u.Celsius``.\n\n.. EXAMPLE END\n\nMass-Energy Equivalency\n-----------------------\n\n.. EXAMPLE START: Using the Mass-Energy Equivalency\n\nIn a special relativity context it can be convenient to use the\n:func:`~astropy.units.equivalencies.mass_energy` equivalency. For instance::\n\n    >>> (1 * u.g).to(u.eV, u.mass_energy())  # doctest: +FLOAT_CMP\n    <Quantity 5.60958865e+32 eV>\n\n.. EXAMPLE END\n\nDoppler Redshift Equivalency\n----------------------------\n\nConversion between Doppler redshift and radial velocity can be done with the\n:func:`~astropy.units.equivalencies.doppler_redshift` equivalency.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Converting Doppler redshift to radial velocity\n\nTo convert Doppler redshift (unitless) to ``km/s``::\n\n    >>> z = 0.1 * u.dimensionless_unscaled\n    >>> z.to(u.km / u.s, u.doppler_redshift())  # doctest: +FLOAT_CMP\n    <Quantity 28487.0661448 km / s>\n\nHowever, it cannot take the cosmological redshift unit from `astropy.cosmology.units`\nbecause the latter should not be interpreted the same since the recessional\nvelocity from the expansion of space can exceed the speed of light; see\n`Hubble's law: Redshift velocity and recessional velocity <https://en.wikipedia.org/wiki/Hubble%27s_law#Redshift_velocity_and_recessional_velocity>`_\nfor more information.\n\n.. EXAMPLE END\n\nWriting New Equivalencies\n=========================\n\nAn equivalence list is a :class:`list` of tuples, where each :class:`tuple` has\nfour elements::\n\n  (from_unit, to_unit, forward, backward)\n\n``from_unit`` and ``to_unit`` are the equivalent units. ``forward`` and\n``backward`` are functions that convert values between those units. ``forward``\nand ``backward`` are optional, and if omitted then the equivalency declares\nthat the two units should be taken as equivalent. The functions must take and\nreturn non-|Quantity| objects to avoid infinite recursion; See\n:ref:`complicated-equiv-example` for more details.\n\nExamples\n--------\n\n.. EXAMPLE START: Writing New Equivalencies\n\nUntil 1964, the metric liter was defined as the volume of 1kg of water at 4°C at\n760mm mercury pressure. Volumes and masses are not normally directly\nconvertible, but if we hold the constants in the 1964 definition of the liter as\ntrue, we could build an equivalency for them::\n\n  >>> liters_water = [\n  ...    (u.l, u.g, lambda x: 1000.0 * x, lambda x: x / 1000.0)\n  ... ]\n  >>> u.l.to(u.kg, 1, equivalencies=liters_water)\n  1.0\n\nNote that the equivalency can be used with any other compatible unit::\n\n  >>> imperial.gallon.to(imperial.pound, 1, equivalencies=liters_water)  # doctest: +FLOAT_CMP\n  8.345404463333525\n\nAnd it also works in the other direction::\n\n  >>> imperial.lb.to(imperial.pint, 1, equivalencies=liters_water)  # doctest: +FLOAT_CMP\n  0.9586114172355459\n\n.. EXAMPLE END\n\n.. _complicated-equiv-example:\n\nA More Complex Example: Spectral Doppler Equivalencies\n------------------------------------------------------\n\n.. EXAMPLE START: Writing Spectral Doppler Equivalencies\n\nWe show how to define an equivalency using the radio convention for CO 1-0.\nThis function is already defined in\n:func:`~astropy.units.equivalencies.doppler_radio`, but this example is\nillustrative::\n\n    >>> from astropy.constants import si\n    >>> restfreq = 115.27120  # rest frequency of 12 CO 1-0 in GHz\n    >>> freq_to_vel = [(u.GHz, u.km/u.s,\n    ... lambda x: (restfreq-x) / restfreq * si.c.to_value('km/s'),\n    ... lambda x: (1-x/si.c.to_value('km/s')) * restfreq )]\n    >>> u.Hz.to(u.km / u.s, 116e9, equivalencies=freq_to_vel)  # doctest: +FLOAT_CMP\n    -1895.4321928669262\n    >>> (116e9 * u.Hz).to(u.km / u.s, equivalencies=freq_to_vel)  # doctest: +FLOAT_CMP\n    <Quantity -1895.4321928669262 km / s>\n\n.. EXAMPLE END\n\nNote that once this is defined for GHz and km/s, it will work for all other\nunits of frequency and velocity. ``x`` is converted from the input frequency\nunit (e.g., Hz) to GHz before being passed to ``lambda x:``. Similarly, the\nreturn value is assumed to be in units of ``km/s``, which is why the ``value``\nof ``c`` is used instead of the :class:`~astropy.constants.Constant`.\n\nDisplaying Available Equivalencies\n==================================\n\nThe :meth:`~astropy.units.core.UnitBase.find_equivalent_units` method also\nunderstands equivalencies.\n\nExample\n-------\n\n.. EXAMPLE START: Displaying Available Equivalencies\n\nWithout passing equivalencies, there are three compatible units for ``Hz`` in\nthe standard set::\n\n  >>> u.Hz.find_equivalent_units()\n    Primary name | Unit definition | Aliases\n  [\n    Bq           | 1 / s           | becquerel    ,\n    Ci           | 3.7e+10 / s    | curie        ,\n    Hz           | 1 / s           | Hertz, hertz ,\n  ]\n\nHowever, when passing the spectral equivalency, you can see there are\nall kinds of things that ``Hz`` can be converted to::\n\n  >>> u.Hz.find_equivalent_units(equivalencies=u.spectral())\n    Primary name | Unit definition        | Aliases\n  [\n    AU           | 1.49598e+11 m          | au, astronomical_unit ,\n    Angstrom     | 1e-10 m                | AA, angstrom          ,\n    Bq           | 1 / s                  | becquerel             ,\n    Ci           | 3.7e+10 / s            | curie                 ,\n    Hz           | 1 / s                  | Hertz, hertz          ,\n    J            | kg m2 / s2             | Joule, joule          ,\n    Ry           | 2.17987e-18 kg m2 / s2 | rydberg               ,\n    cm           | 0.01 m                 | centimeter            ,\n    eV           | 1.60218e-19 kg m2 / s2 | electronvolt          ,\n    earthRad     | 6.3781e+06 m           | R_earth, Rearth       ,\n    erg          | 1e-07 kg m2 / s2       |                       ,\n    jupiterRad   | 7.1492e+07 m           | R_jup, Rjup, R_jupiter, Rjupiter ,\n    k            | 100 / m                | Kayser, kayser        ,\n    lsec         | 2.99792e+08 m          | lightsecond           ,\n    lyr          | 9.46073e+15 m          | lightyear             ,\n    m            | irreducible            | meter                 ,\n    micron       | 1e-06 m                |                       ,\n    pc           | 3.08568e+16 m          | parsec                ,\n    solRad       | 6.957e+08 m            | R_sun, Rsun           ,\n  ]\n\n.. EXAMPLE END\n\n.. _equivalency-context:\n\nUsing Equivalencies in Larger Pieces of Code\n============================================\n\nSometimes you may have an involved calculation where you are regularly switching\nback and forth between equivalent units. For these cases, you can set\nequivalencies that will by default be used, in a way similar to how you can\n:ref:`enable other units <enabling-other-units>`.\n\nExamples\n--------\n\n.. EXAMPLE START: Using Equivalencies in Larger Pieces of Code\n\nTo enable radians to be treated as a dimensionless unit use\n:func:`~astropy.units.set_enabled_equivalencies` as a `context manager\n<https://docs.python.org/3/reference/datamodel.html#context-managers>`_::\n\n  >>> with u.set_enabled_equivalencies(u.dimensionless_angles()):\n  ...    phase = 0.5 * u.cycle\n  ...    c = np.exp(1j*phase)\n  >>> c  # doctest: +FLOAT_CMP\n  <Quantity -1.+1.2246468e-16j>\n\nTo permanently and globally enable radians to be treated as a dimensionless\nunit use :func:`~astropy.units.set_enabled_equivalencies` not as a context\nmanager:\n\n.. doctest-skip::\n\n  >>> u.set_enabled_equivalencies(u.dimensionless_angles())\n  <astropy.units.core._UnitContext object at ...>\n  >>> u.deg.to('')  # doctest: +FLOAT_CMP\n  0.017453292519943295\n\nThe disadvantage of the above approach is that you may forget to turn the\ndefault off (done by giving an empty argument).\n\n:func:`~astropy.units.set_enabled_equivalencies` accepts any list of\nequivalencies, so you could add, for example,\n:func:`~astropy.units.equivalencies.spectral` and\n:func:`~astropy.units.equivalencies.spectral_density` (since these return\nlists, they should indeed be combined by adding them together).\n\n.. EXAMPLE END\n"},{"id":190,"name":"docs/utils","nodeType":"Package"},{"id":191,"name":"index.rst","nodeType":"TextFile","path":"docs/utils","text":".. _utils:\n\n************************************************\nAstropy Core Package Utilities (`astropy.utils`)\n************************************************\n\nIntroduction\n============\n\nThe `astropy.utils` package contains general-purpose utility functions and\nclasses.  Examples include data structures, tools for downloading and caching\nfrom URLs, and version intercompatibility functions.\n\nThis functionality is not astronomy-specific, but is intended primarily for\nuse by Astropy developers. It is all safe for users to use, but the functions\nand classes are typically more complicated or specific to a particular need of\nAstropy.\n\nBecause of the mostly standalone and grab-bag nature of these utilities, they\nare generally best understood through their docstrings, and hence this\ndocumentation generally does not have detailed sections like the other packages.\nThe exceptions are below:\n\n.. toctree::\n   :maxdepth: 1\n\n   iers\n   data\n   masked/index\n\n.. note:: The ``astropy.utils.compat`` subpackage is not included in this\n    documentation. It contains utility modules for compatibility with\n    older/newer versions of python and numpy, as well as including some\n    bugfixes for the stdlib that are important for ``astropy``. It is recommended\n    that developers at least glance over the source code for this subpackage,\n    but most of it cannot be reliably included here because of the large\n    amount of version-specific code it contains. Its content is solely for\n    internal use of ``astropy`` and subject to changes without deprecations.\n    Do not use it in external packages or code.\n\nReference/API\n=============\n.. module:: astropy.utils\n\n.. automodapi:: astropy.utils.codegen\n    :no-inheritance-diagram:\n\n.. automodapi:: astropy.utils.collections\n    :no-inheritance-diagram:\n\n.. automodapi:: astropy.utils.console\n    :no-inheritance-diagram:\n\n.. automodapi:: astropy.utils.data_info\n    :no-inheritance-diagram:\n\n.. automodapi:: astropy.utils.decorators\n    :no-inheritance-diagram:\n\n.. automodapi:: astropy.utils.diff\n    :no-inheritance-diagram:\n\n.. automodapi:: astropy.utils.exceptions\n    :no-inheritance-diagram:\n\n.. automodapi:: astropy.utils.iers\n    :no-inheritance-diagram:\n\n.. automodapi:: astropy.utils.introspection\n    :no-inheritance-diagram:\n\n.. automodapi:: astropy.utils.metadata\n    :no-inheritance-diagram:\n\n.. automodapi:: astropy.utils.misc\n    :no-inheritance-diagram:\n\n.. automodapi:: astropy.utils.parsing\n    :no-inheritance-diagram:\n\n.. automodapi:: astropy.utils.state\n    :no-inheritance-diagram:\n\n.. automodapi:: astropy.utils.shapes\n    :no-inheritance-diagram:\n\n\nFile Downloads\n--------------\n\n.. automodapi:: astropy.utils.data\n    :no-inheritance-diagram:\n\nXML\n---\nThe ``astropy.utils.xml.*`` modules provide various\n`XML <http://www.w3.org/XML/>`_ processing tools.\n\n.. automodapi:: astropy.utils.xml.check\n    :no-inheritance-diagram:\n    :headings: ^\"\n\n.. automodapi:: astropy.utils.xml.iterparser\n    :no-inheritance-diagram:\n    :headings: ^\"\n\n.. automodapi:: astropy.utils.xml.unescaper\n    :no-inheritance-diagram:\n    :headings: ^\"\n\n.. automodapi:: astropy.utils.xml.validate\n    :no-inheritance-diagram:\n    :headings: ^\"\n\n.. automodapi:: astropy.utils.xml.writer\n    :no-inheritance-diagram:\n    :headings: ^\"\n"},{"id":192,"name":"iers.rst","nodeType":"TextFile","path":"docs/utils","text":".. _utils-iers:\n\n***************************************\nIERS data access (`astropy.utils.iers`)\n***************************************\n\nIntroduction\n============\n\nThe `~astropy.utils.iers` package provides access to the tables provided by\nthe International Earth Rotation and Reference Systems (IERS) service, in\nparticular files allowing interpolation of published UT1-UTC and polar motion\nvalues for given times.  The UT1-UTC values are used in `astropy.time` to\nprovide UT1 values, and the polar motions are used in `astropy.coordinates` to\ndetermine Earth orientation for celestial-to-terrestrial coordinate\ntransformations.\n\n.. note:: The package also provides machinery to track leap seconds.  Since it\n          generally should not be necessary to deal with those by hand, this\n          is not discussed below.  For details, see the documentation of\n          `~astropy.utils.iers.LeapSeconds`.\n\nGetting started\n===============\n\nStarting with astropy 1.2, the latest IERS values (which include approximately\none year of predictive values) are automatically downloaded from the IERS\nservice when required.  This happens when a time or coordinate transformation\nneeds a value which is not already available via the download cache.  In most\ncases there is no need for invoking the `~astropy.utils.iers` classes oneself,\nbut it is useful to understand the situations when a download will occur\nand how this can be controlled.\n\nBasic usage\n-----------\n\nBy default, the IERS data are managed via instances of the\n:class:`~astropy.utils.iers.IERS_Auto` class.  These instances are created\ninternally within the relevant time and coordinate objects during\ntransformations.  If the astropy data cache does not have the required IERS\ndata file then astropy will request the file from the IERS service.  This will\noccur the first time such a transform is done for a new setup or on a new\nmachine.  Here is an example that shows the typical download progress bar::\n\n  >>> from astropy.time import Time\n  >>> t = Time('2016:001')\n  >>> t.ut1  # doctest: +SKIP\n  Downloading https://maia.usno.navy.mil/ser7/finals2000A.all\n  |==================================================================| 3.0M/3.0M (100.00%)         6s\n  <Time object: scale='ut1' format='yday' value=2016:001:00:00:00.082>\n\nNote that you can forcibly clear the download cache as follows::\n\n  >>> from astropy.utils.data import clear_download_cache\n  >>> clear_download_cache()  # doctest: +SKIP\n\nThe default IERS data used automatically is updated by the service every 7 days\nand includes transforms dating back to 1973-01-01.\n\n.. note:: The :class:`~astropy.utils.iers.IERS_Auto` class contains machinery\n    to ensure that the IERS table is kept up to date by auto-downloading the\n    latest version as needed.  This means that the IERS table is assured of\n    having the state-of-the-art definitive and predictive values for Earth\n    rotation.  As a user it is **your responsibility** to understand the\n    accuracy of IERS predictions if your science depends on that.  If you\n    request ``UT1-UTC`` or polar motions for times beyond the range of IERS\n    table data then the nearest available values will be provided.\n\n\nConfiguration parameters\n------------------------\n\nThere are a number of IERS configuration parameters in `astropy.utils.iers.Conf`\nthat control the behavior of the automatic IERS downloading. Three of the most\nimportant to consider are the following:\n\n  auto_download:\n    Enable auto-downloading of the latest IERS data.  If set to ``False`` then\n    the local IERS-B file will be used by default (even if the full IERS file\n    with predictions was already downloaded and cached).  This parameter also\n    controls whether internet resources will be queried to update the leap\n    second table if the installed version is out of date.\n\n  auto_max_age:\n    Maximum age of predictive data before auto-downloading (days).  See\n    next section for details. (default=30)\n\n  remote_timeout:\n    Remote timeout downloading IERS file data (seconds)\n\n\nAuto refresh behavior\n---------------------\n\nThe first time that one attempts a time or coordinate transformation that\nrequires IERS data, the latest version of the IERS table (from 1973 through\none year into the future) will be downloaded and stored in the astropy cache.\n\nTransformations will then use the cached data file if possible.  However, the\n``IERS_Auto`` table is automatically updated in place from the network if the\nfollowing two conditions a met when the table is queried for ``UT1-UTC`` or\npolar motion values:\n\n- Any of the requested IERS values are *predictive*, meaning that they have\n  been extrapolated into the future with a model that is fit to measured data.\n  The IERS table contains approximately one year of predictive data from the\n  time it is created.\n- The first predictive values in the table are at least ``conf.auto_max_age\n  days`` old relative to the current actual time (i.e. ``Time.now()``).  This\n  means that the IERS table is out of date and a newer version can be found on\n  the IERS service.\n\nThe IERS Service provides the default online table\n(set by ``astropy.utils.iers.IERS_A_URL``) and updates the content\nonce each 7 days.  The default value of ``auto_max_age`` is 30 days to avoid\nunnecessary network access, but one can reduce this to as low as 10 days.\n\n.. _iers-working-offline:\n\nWorking offline\n---------------\n\nIf you are working without an internet connection and doing transformations\nthat require IERS data, there are a couple of options.\n\n**Disable auto downloading**\n\nHere you can do::\n\n  >>> from astropy.utils import iers\n  >>> iers.conf.auto_download = False  # doctest: +SKIP\n\nIn this case any transforms will use the bundled IERS-B data which covers\nthe time range from 1962 to just before the astropy release date.  Any\ntransforms outside of this range will not be allowed.\n\n**Set the auto-download max age parameter**\n\n*Only do this if you understand what you are doing, THIS CAN GIVE INACCURATE\nANSWERS!* Assuming you have previously been connected to the internet and have\ndownloaded and cached the IERS auto values previously, then do the following::\n\n  >>> iers.conf.auto_max_age = None  # doctest: +SKIP\n\nThis disables the check of whether the IERS values are sufficiently recent, and\nall the transformations (even those outside the time range of available IERS\ndata) will succeed with at most warnings.\n\nDirect table access\n-------------------\n\nIn most cases the automatic interface will suffice, but you may need to\ndirectly load and manipulate IERS tables.  IERS-B values are provided as part\nof astropy and can be used to calculate time offsets and polar motion\ndirectly, or set up for internal use in further time and coordinate\ntransformations.  For example::\n\n  >>> from astropy.utils import iers\n  >>> t = Time('2010:001')\n  >>> iers_b = iers.IERS_B.open()\n  >>> iers_b.ut1_utc(t)  # doctest: +FLOAT_CMP\n  <Quantity 0.114033 s>\n  >>> iers.earth_orientation_table.set(iers_b)\n  <ScienceState earth_orientation_table: <IERS_B length=...>...>\n  >>> t.ut1.iso\n  '2010-01-01 00:00:00.114'\n\nInstead of local copies of IERS files, one can also download them, using\n``iers.IERS_A_URL`` (or ``iers.IERS_A_URL_MIRROR``) and ``iers.IERS_B_URL``,\nand then use those for future time and coordinate transformations (in this\nexample, just for a single calculation, by using\n`~astropy.utils.iers.earth_orientation_table` as a context manager)::\n\n  >>> iers_a = iers.IERS_A.open(iers.IERS_A_URL)  # doctest: +SKIP\n  >>> with iers.earth_orientation_table.set(iers_a):  # doctest: +SKIP\n  ...     print(t.ut1.iso)\n  2010-01-01 00:00:00.114\n\nTo reset to the default, pass in `None` (which is equivalent to passing in\n``iers.IERS_Auto.open()``)::\n\n  >>> iers.earth_orientation_table.set(None)  # doctest: +REMOTE_DATA\n  <ScienceState earth_orientation_table: <IERS...>...>\n\nTo see the internal IERS data that gets used in astropy you can do the\nfollowing::\n\n  >>> dat = iers.earth_orientation_table.get()  # doctest: +REMOTE_DATA\n  >>> type(dat)  # doctest: +REMOTE_DATA\n  <class 'astropy.utils.iers.iers.IERS...'>\n  >>> dat  # doctest: +SKIP\n  <IERS_Auto length=16196>\n   year month  day    MJD   PolPMFlag_A ... UT1Flag    PM_x     PM_y   PolPMFlag\n                       d                ...           arcsec   arcsec\n  int64 int64 int64 float64     str1    ... unicode1 float64  float64   unicode1\n  ----- ----- ----- ------- ----------- ... -------- -------- -------- ---------\n     73     1     2 41684.0           I ...        B    0.143    0.137         B\n     73     1     3 41685.0           I ...        B    0.141    0.134         B\n     73     1     4 41686.0           I ...        B    0.139    0.131         B\n     73     1     5 41687.0           I ...        B    0.137    0.128         B\n    ...   ...   ...     ...         ... ...      ...      ...      ...       ...\n     17     5     2 57875.0           P ...        P 0.007211  0.44884         P\n     17     5     3 57876.0           P ...        P 0.008757 0.450321         P\n     17     5     4 57877.0           P ...        P 0.010328 0.451777         P\n     17     5     5 57878.0           P ...        P 0.011924 0.453209         P\n     17     5     6 57879.0           P ...        P 0.013544 0.454617         P\n\nThe explanation for most of the columns can be found in the file named\n``iers.IERS_A_README``.  The important columns of this table are MJD, UT1_UTC,\nUT1Flag, PM_x, PM_y, PolPMFlag::\n\n  >>> dat['MJD', 'UT1_UTC', 'UT1Flag', 'PM_x', 'PM_y', 'PolPMFlag']  # doctest: +SKIP\n  <IERS_Auto length=16196>\n    MJD    UT1_UTC   UT1Flag    PM_x     PM_y   PolPMFlag\n     d        s                arcsec   arcsec\n  float64  float64   unicode1 float64  float64   unicode1\n  ------- ---------- -------- -------- -------- ---------\n  41684.0     0.8075        B    0.143    0.137         B\n  41685.0     0.8044        B    0.141    0.134         B\n  41686.0     0.8012        B    0.139    0.131         B\n  41687.0     0.7981        B    0.137    0.128         B\n      ...        ...      ...      ...      ...       ...\n  57875.0 -0.6545408        P 0.007211  0.44884         P\n  57876.0 -0.6559528        P 0.008757 0.450321         P\n  57877.0 -0.6573705        P 0.010328 0.451777         P\n  57878.0 -0.6587712        P 0.011924 0.453209         P\n  57879.0  -0.660187        P 0.013544 0.454617         P\n"},{"col":4,"comment":"\n        Provides the implementations from HDUList.fromfile and\n        HDUList.fromstring, both of which wrap this method, as their\n        implementations are largely the same.\n        ","endLoc":1134,"header":"@classmethod\n    def _readfrom(cls, fileobj=None, data=None, mode=None, memmap=None,\n                  cache=True, lazy_load_hdus=True, ignore_missing_simple=False,\n                  **kwargs)","id":193,"name":"_readfrom","nodeType":"Function","startLoc":1047,"text":"@classmethod\n    def _readfrom(cls, fileobj=None, data=None, mode=None, memmap=None,\n                  cache=True, lazy_load_hdus=True, ignore_missing_simple=False,\n                  **kwargs):\n        \"\"\"\n        Provides the implementations from HDUList.fromfile and\n        HDUList.fromstring, both of which wrap this method, as their\n        implementations are largely the same.\n        \"\"\"\n\n        if fileobj is not None:\n            if not isinstance(fileobj, _File):\n                # instantiate a FITS file object (ffo)\n                fileobj = _File(fileobj, mode=mode, memmap=memmap, cache=cache)\n            # The Astropy mode is determined by the _File initializer if the\n            # supplied mode was None\n            mode = fileobj.mode\n            hdulist = cls(file=fileobj)\n        else:\n            if mode is None:\n                # The default mode\n                mode = 'readonly'\n\n            hdulist = cls(file=data)\n            # This method is currently only called from HDUList.fromstring and\n            # HDUList.fromfile.  If fileobj is None then this must be the\n            # fromstring case; the data type of ``data`` will be checked in the\n            # _BaseHDU.fromstring call.\n\n        if (not ignore_missing_simple and\n                hdulist._file and\n                hdulist._file.mode != 'ostream' and\n                hdulist._file.size > 0):\n            pos = hdulist._file.tell()\n            # FITS signature is supposed to be in the first 30 bytes, but to\n            # allow reading various invalid files we will check in the first\n            # card (80 bytes).\n            simple = hdulist._file.read(80)\n            match_sig = (simple[:29] == FITS_SIGNATURE[:-1] and\n                         simple[29:30] in (b'T', b'F'))\n\n            if not match_sig:\n                # Check the SIMPLE card is there but not written correctly\n                match_sig_relaxed = re.match(rb\"SIMPLE\\s*=\\s*[T|F]\", simple)\n\n                if match_sig_relaxed:\n                    warnings.warn(\"Found a SIMPLE card but its format doesn't\"\n                                  \" respect the FITS Standard\", VerifyWarning)\n                else:\n                    if hdulist._file.close_on_error:\n                        hdulist._file.close()\n                    raise OSError(\n                        'No SIMPLE card found, this file does not appear to '\n                        'be a valid FITS file. If this is really a FITS file, '\n                        'try with ignore_missing_simple=True')\n\n            hdulist._file.seek(pos)\n\n        # Store additional keyword args that were passed to fits.open\n        hdulist._open_kwargs = kwargs\n\n        if fileobj is not None and fileobj.writeonly:\n            # Output stream--not interested in reading/parsing\n            # the HDUs--just writing to the output file\n            return hdulist\n\n        # Make sure at least the PRIMARY HDU can be read\n        read_one = hdulist._read_next_hdu()\n\n        # If we're trying to read only and no header units were found,\n        # raise an exception\n        if not read_one and mode in ('readonly', 'denywrite'):\n            # Close the file if necessary (issue #6168)\n            if hdulist._file.close_on_error:\n                hdulist._file.close()\n\n            raise OSError('Empty or corrupt FITS file')\n\n        if not lazy_load_hdus or kwargs.get('checksum') is True:\n            # Go ahead and load all HDUs\n            while hdulist._read_next_hdu():\n                pass\n\n        # initialize/reset attributes to be used in \"update/append\" mode\n        hdulist._resize = False\n        hdulist._truncate = False\n\n        return hdulist"},{"id":194,"name":"data.rst","nodeType":"TextFile","path":"docs/utils","text":".. _utils-data:\n\n***************************************************\nDownloadable Data Management (`astropy.utils.data`)\n***************************************************\n\nIntroduction\n============\n\nA number of Astropy's tools work with data sets that are either awkwardly\nlarge (e.g., `~astropy.coordinates.solar_system_ephemeris`) or\nregularly updated (e.g., `~astropy.utils.iers.IERS_B`) or both\n(e.g., `~astropy.utils.iers.IERS_A`). This kind of\ndata - authoritative data made available on the Web, and possibly updated\nfrom time to time - is reasonably common in astronomy. The Astropy Project therefore\nprovides some tools for working with such data.\n\nThe primary tool for this is the ``astropy`` *cache*. This is a repository of\ndownloaded data, indexed by the URL where it was obtained. The tool\n`~astropy.utils.data.download_file` and various other things built upon it can\nuse this cache to request the contents of a URL, and (if they choose to use the\ncache) the data will only be downloaded if it is not already present in the\ncache. The tools can be instructed to obtain a new copy of data\nthat is in the cache but has been updated online.\n\nThe ``astropy`` cache is stored in a centralized place (on Linux machines by\ndefault it is ``$HOME/.astropy/cache``; see :ref:`astropy_config` for\nmore details).  You can check its location on your machine::\n\n   >>> import astropy.config.paths\n   >>> astropy.config.paths.get_cache_dir()  # doctest: +SKIP\n   '/home/burnell/.astropy/cache'\n\nThis centralization means that the cache is persistent and shared between all\n``astropy`` runs in any virtualenv by one user on one machine (possibly more if\nyour home directory is shared between multiple machines).  This can\ndramatically accelerate ``astropy`` operations and reduce the load on servers,\nlike those of the IERS, that were not designed for heavy Web traffic. If you\nfind the cache has corrupted or outdated data in it, you can remove an entry or\nclear the whole thing with `~astropy.utils.data.clear_download_cache`.\n\nThe files in the cache directory are named according to a cryptographic hash of\ntheir URL (currently MD5, so in principle malevolent entities can cause\ncollisions, though the security risks this poses are marginal at most). The\nmodification times on these files normally indicate when they were last\ndownloaded from the Internet.\n\nUsage Within Astropy\n====================\n\nFor the most part, you can ignore the caching mechanism and rely on\n``astropy`` to have the correct data when you need it. For example, precise\ntime conversions and sky locations need measured tables of the Earth's\nrotation from the IERS. The table `~astropy.utils.iers.IERS_Auto` provides\nthe infrastructure for many of these calculations. It makes available\nEarth rotation parameters, and if you request them for a time more recent\nthan its tables cover, it will download updated tables from the IERS. So\nfor example asking what time it is in UT1 (a timescale that reflects the\nirregularity of the Earth's rotation) probably triggers a download of the\nIERS data::\n\n   >>> from astropy.time import Time\n   >>> Time.now().ut1  # doctest: +SKIP\n   Downloading https://maia.usno.navy.mil/ser7/finals2000A.all\n   |============================================| 3.2M/3.2M (100.00%)         1s\n   <Time object: scale='ut1' format='datetime' value=2019-09-22 08:39:03.812731>\n\nBut running it a second time does not require any new download::\n\n   >>> Time.now().ut1  # doctest: +SKIP\n   <Time object: scale='ut1' format='datetime' value=2019-09-22 08:41:21.588836>\n\nSome data is also made available from the `Astropy data server`_ either\nfor use within ``astropy`` or for your convenience. These are available more\nconveniently with the ``get_pkg_data_*`` functions::\n\n   >>> from astropy.utils.data import get_pkg_data_contents\n   >>> print(get_pkg_data_contents(\"coordinates/sites-un-ascii\"))  # doctest: +SKIP\n   # these are all mappings from the name in sites.json (which is ASCII-only) to the \"true\" unicode names\n   TUBITAK->TÜBİTAK\n\n.. note::\n\n    Sometimes when downloading files from internet resources secured with\n    TLS/SSL, you may get an exception regarding a certificate verification\n    error.  Typically this indicates that Python could not find an\n    up-to-date collection of `root certificates`_ on your system.  This is\n    especially common on Windows.  This problem can usually be resolved\n    by installing the `certifi`_ package, which Astropy will use if\n    available to verify remote connections.  In rare cases, certificate\n    verification may still fail if the remote server is misconfigured (e.g.,\n    with expired certificates).  In this case, you may pass the\n    ``allow_insecure=True`` argument to\n    :func:`~astropy.utils.data.download_file` to allow the download with a\n    warning instead (not recommended unless you understand the `potential\n    risks <https://en.wikipedia.org/wiki/Man-in-the-middle_attack>`_).\n\n\nUsage From Outside Astropy\n==========================\n\nUsers of ``astropy`` can also make use of ``astropy``'s caching and downloading\nmechanism. In its simplest form, this amounts to using\n`~astropy.utils.data.download_file` with the ``cache=True`` argument to obtain\ntheir data, from the cache if the data is there::\n\n   >>> from astropy.utils.iers import IERS_B_URL, IERS_B\n   >>> from astropy.utils.data import download_file\n   >>> IERS_B.open(download_file(IERS_B_URL, cache=True))[\"year\",\"month\",\"day\"][-3:]  # doctest: +SKIP\n    <IERS_B length=3>\n    year month  day\n   int64 int64 int64\n   ----- ----- -----\n    2019     8     4\n    2019     8     5\n    2019     8     6\n\nIf users want to update the cache to a newer version of the\ndata (note that here the data was already up to date; users\nwill have to decide for themselves when to obtain new versions),\nthey can use the ``cache='update'`` argument::\n\n   >>> IERS_B.open(download_file(IERS_B_URL,\n   ...                           cache='update')\n   ... )[\"year\",\"month\",\"day\"][-3:]  # doctest: +SKIP\n   Downloading http://hpiers.obspm.fr/iers/eop/eopc04/eopc04_IAU2000.62-now\n   |=========================================| 3.2M/3.2M (100.00%)         0s\n   <IERS_B length=3>\n    year month  day\n   int64 int64 int64\n   ----- ----- -----\n    2019     8    18\n    2019     8    19\n    2019     8    20\n\nIf they are concerned that the primary source of the data may be\noverloaded or unavailable, they can use the ``sources`` argument\nto provide a list of sources to attempt downloading from, in order.\nThis need not include the original source. Regardless, the data\nwill be stored in the cache under the original URL requested::\n\n   >>> f = download_file(\"ftp://ssd.jpl.nasa.gov/pub/eph/planets/bsp/de405.bsp\",\n   ...     cache=True,\n   ...     sources=['https://data.nanograv.org/static/data/ephem/de405.bsp',\n   ...              'ftp://ssd.jpl.nasa.gov/pub/eph/planets/bsp/de405.bsp'])  # doctest: +SKIP\n   Downloading ftp://ssd.jpl.nasa.gov/pub/eph/planets/bsp/de405.bsp from https://data.nanograv.org/static/data/ephem/de405.bsp\n   |========================================|  65M/ 65M (100.00%)        19s\n\n.. _Astropy data server: https://www.astropy.org/astropy-data/\n.. _root certificates: https://en.wikipedia.org/wiki/Root_certificate\n.. _certifi: https://pypi.org/project/certifi/\n\nCache Management\n================\n\nBecause the cache is persistent, it is possible for it to become inconveniently\nlarge, or become filled with irrelevant data. While it is simply a directory on\ndisk, each file is supposed to represent the contents of a URL, and many URLs\ndo not make acceptable on-disk filenames (for example, containing troublesome\ncharacters like \":\" and \"~\"). There is reason to worry that multiple\n``astropy`` processes accessing the cache simultaneously might lead to cache\ncorruption. The data is therefore stored in a subdirectory named after the hash\nof the URL, and write access is handled in a way that is resistant to\nconcurrency problems. So access to the cache is more convenient with a few\nhelpers provided by `~astropy.utils.data`.\n\nIf your cache starts behaving oddly you can use\n`~astropy.utils.data.check_download_cache` to examine your cache contents and\nraise an exception if it finds any anomalies.  If a single file is undesired or\ndamaged, it can be removed by calling\n`~astropy.utils.data.clear_download_cache` with an argument that is the URL it\nwas obtained from, the filename of the downloaded file, or the hash of its\ncontents. Should the cache ever become badly corrupted,\n`~astropy.utils.data.clear_download_cache` with no arguments will simply delete\nthe whole directory, freeing the space and removing any inconsistent data. Of\ncourse, if you remove data using either of these tools, any processes currently\nusing that data may be disrupted (or, under Windows, deleting the cache may not\nbe possible until those processes terminate). So use\n`~astropy.utils.data.clear_download_cache` with care.\n\nTo check the total space occupied by the cache, use\n`~astropy.utils.data.cache_total_size`. The contents of the cache can be\nlisted with `~astropy.utils.data.get_cached_urls`, and the presence of a\nparticular URL in the cache can be tested with\n`~astropy.utils.data.is_url_in_cache`. More general manipulations can be\ncarried out using `~astropy.utils.data.cache_contents`, which returns a\n`~dict` mapping URLs to on-disk filenames of their contents.\n\nIf you want to transfer the cache to another computer, or preserve its contents\nfor later use, you can use the functions `~astropy.utils.data.export_download_cache` to\nproduce a ZIP file listing some or all of the cache contents, and\n`~astropy.utils.data.import_download_cache` to load the ``astropy`` cache from such a\nZIP file.\n\nThe Astropy cache has changed format - once in the Python 2 to Python\n3 transition, and again before Astropy version 4.0.2 to resolve some\nconcurrency problems that arose on some compute clusters. Each version of the\ncache is in its own subdirectory, so the old versions do not interfere with the\nnew versions and vice versa, but their contents are not used by this version\nand are not cleared by `~astropy.utils.data.clear_download_cache`. To remove\nthese old cache directories, you can run::\n\n   >>> from shutil import rmtree\n   >>> from os.path import join\n   >>> from astropy.config.paths import get_cache_dir\n   >>> rmtree(join(get_cache_dir(), 'download', 'py2'), ignore_errors=True)  # doctest: +SKIP\n   >>> rmtree(join(get_cache_dir(), 'download', 'py3'), ignore_errors=True)  # doctest: +SKIP\n\nUsing Astropy With Limited or No Internet Access\n================================================\n\nYou might want to use ``astropy`` on a telescope control machine behind a strict\nfirewall. Or you might be running continuous integration (CI) on your ``astropy``\nserver and want to avoid hammering astronomy servers on every pull request for\nevery architecture. Or you might not have access to US government or military\nweb servers. Whichever is the case, you may need to avoid ``astropy`` needing data\nfrom the Internet. There is no simple and complete solution to this problem at\nthe moment, but there are tools that can help.\n\nExactly which external data your project depends on will depend on what parts\nof ``astropy`` you use and how. The most general solution is to use a computer that\ncan access the Internet to run a version of your calculation that pulls in all of\nthe data files you will require, including sufficiently up-to-date versions of\nfiles like the IERS data that update regularly. Then once the cache on this\nconnected machine is loaded with everything necessary, transport the cache\ncontents to your target machine by whatever means you have available, whether\nby copying via an intermediate machine, portable disk drive, or some other\ntool. The cache directory itself is somewhat portable between machines of the\nsame UNIX flavour; this may be sufficient if you can persuade your CI system to\ncache the directory between runs. For greater portability, though, you can\nsimply use `~astropy.utils.data.export_download_cache` and\n`~astropy.utils.data.import_download_cache`, which are portable and will allow\nadding files to an existing cache directory.\n\nIf your application needs IERS data specifically, you can download the\nappropriate IERS table, covering the appropriate time span, by any means you\nfind convenient. You can then load this file into your application and use the\nresulting table rather than `~astropy.utils.iers.IERS_Auto`. In fact, the IERS\nB table is small enough that a version (not necessarily recent) is bundled with\n``astropy`` as ``astropy.utils.iers.IERS_B_FILE``. Using a specific non-automatic\ntable also has the advantage of giving you control over exactly which version\nof the IERS data your application is using. See also :ref:`iers-working-offline`.\n\nIf your issue is with certain specific servers, even if they are the ones\n``astropy`` normally uses, if you can anticipate exactly which files will be needed\n(or just pick up after ``astropy`` fails to obtain them) and make those files\navailable somewhere else, you can request they be downloaded to the cache\nusing `~astropy.utils.data.download_file` with the ``sources`` argument set\nto locations you know do work. You can also set ``sources`` to an empty list\nto ensure that `~astropy.utils.data.download_file` does not attempt to use\nthe Internet at all.\n\nIf you have a particular URL that is giving you trouble, you can download it\nusing some other tool (e.g., ``wget``), possibly on another machine, and\nthen use `~astropy.utils.data.import_file_to_cache`.\n\nAstropy Data and Clusters\n=========================\n\nAstronomical calculations often require the use of a large number of different\nprocesses on different machines with a shared home filesystem. This can pose\ncertain complexities. In particular, if the many different processes attempt to\ndownload a file simultaneously this can overload a server or trigger security\nsystems. The parallel access to the home directory can also trigger concurrency\nproblems in the Astropy data cache, though we have tried to minimize these. We\ntherefore recommend the following guidelines:\n\n * Write a simple script that sets ``astropy.utils.iers.conf.auto_download = True``\n   and then accesses all cached resources your code will need, including source name\n   lookups and IERS tables. Run it on the head node from time to time (frequently\n   enough to beat the timeout ``astropy.utils.iers.conf.auto_max_age``, which\n   defaults to 30 days) to ensure all data is up to date.\n\n * Make an Astropy config file (see :ref:`astropy_config`) that sets\n   ``astropy.utils.iers.conf.auto_download = False`` so that the worker jobs will\n   not suddenly notice an out-of-date table all at once and frantically attempt\n   to download it.\n\n * Optionally, in this file, set ``astropy.utils.data.conf.allow_internet = False`` to\n   prevent any attempt to download any file from the worker nodes; if you do this,\n   you will need to override this setting in your script that does the actual\n   downloading.\n\nNow your worker nodes should not need to obtain anything from the Internet and\nall should run smoothly.\n"},{"id":195,"name":"docs/utils/masked","nodeType":"Package"},{"id":196,"name":"index.rst","nodeType":"TextFile","path":"docs/utils/masked","text":".. _utils-masked:\n\n**************************************\nMasked Values (`astropy.utils.masked`)\n**************************************\n\nOften, data sets are incomplete or corrupted and it would be handy to be able\nto mask certain values.  Astropy provides a |Masked| class to help represent\nsuch data sets.\n\n.. warning:: |Masked| is experimental! While we hope basic usage will remain\n   similar, we are not yet sure whether it will not be necessary to change it\n   to make things work throughout Astropy. This also means that comments and\n   suggestions for improvements are especially welcome!\n\n.. note:: |Masked| is similar to Numpy's :class:`~numpy.ma.MaskedArray`,\n   but it supports subclasses much better and also has some important\n   :ref:`differences in behaviour <utils-masked-vs-numpy-maskedarray>`.\n   As a result, the behaviour of functions inside `numpy.ma` is poorly\n   defined, and one should instead use regular ``numpy`` functions, which\n   are overridden to work properly with masks (with non-obvious\n   choices documented in `astropy.utils.masked.function_helpers`; please\n   report numpy functions that do not work properly with |Masked| values!).\n\nUsage\n=====\n\nAstropy |Masked| instances behave like `~numpy.ndarray` or subclasses such as\n|Quantity| but with a mask associated, which is propagated in operations such\nas addition, etc.::\n\n  >>> import numpy as np\n  >>> from astropy import units as u\n  >>> from astropy.utils.masked import Masked\n  >>> ma = Masked([1., 2., 3.], mask=[False, False, True])\n  >>> ma\n  MaskedNDArray([1., 2., ——])\n  >>> mq = ma * u.m\n  >>> mq + 25 * u.cm\n  <MaskedQuantity [1.25, 2.25,  ———] m>\n\nYou can get the values without the mask using\n`~astropy.utils.masked.Masked.unmasked`, or, if you need to control what\nshould be substituted for any masked values, with\n:meth:`~astropy.utils.masked.Masked.filled`::\n\n  >>> mq.unmasked\n  <Quantity [1., 2., 3.] m>\n  >>> mq.filled(fill_value=-75*u.cm)\n  <Quantity [ 1.  ,  2.  , -0.75] m>\n\nFor reductions such as sums, the mask propagates as if the sum was\ndone directly::\n\n  >>> ma = Masked([[0., 1.], [2., 3.]], mask=[[False, True], [False, False]])\n  >>> ma.sum(axis=-1)\n  MaskedNDArray([——, 5.])\n  >>> ma.sum()\n  MaskedNDArray(——)\n\nYou might wonder why masked elements are propagated, instead of just being\nskipped (as is done in `~numpy.ma.MaskedArray`; see :ref:`below\n<utils-masked-vs-numpy-maskedarray>`).  The rationale is that this leaves a\nsum which is generally not useful unless one knows the number of masked\nelements.  In contrast, for sample properties such as the mean, for which the\nnumber of elements are counted, it seems natural to simply omit the masked\nelements from the calculation::\n\n  >> ma.mean(-1)\n  MaskedNDArray([0.0, 2.5])\n\n\n.. _utils-masked-vs-numpy-maskedarray:\n\nDifferences from `numpy.ma.MaskedArray`\n=======================================\n\n|Masked| differs from `~numpy.ma.MaskedArray` in a number of ways.  In usage,\na major difference is that most operations act on the masked values, i.e., no\neffort is made to preserve values.  For instance, compare::\n\n  >>> np_ma = np.ma.MaskedArray([1., 2., 3.], mask=[False, True, False])\n  >>> (np_ma + 1).data\n  array([2., 2., 4.])\n  >>> (Masked(np_ma) + 1).unmasked\n  array([2., 3., 4.])\n\nThe main reason for this decision is that for some masked subclasses, like\nmasked |Quantity|, keeping the original value makes no sense (e.g., consider\ndividing a length by a time: if the unit of a masked quantity is changing, why\nshould its value not change?).  But it also helps to keep the implementation\nconsiderably simpler, as the |Masked| class now primarily has to deal with\npropagating the mask rather than deciding what to do with values.\n\nA second difference is that for reductions, the mask propagates as it would\nhave if the operations were done on the individual elements::\n\n  >>> np_ma.prod()\n  3.0\n  >>> np_ma[0] * np_ma[1] * np_ma[2]\n  masked\n  >>> Masked(np_ma).prod()\n  MaskedNDArray(——)\n\nThe rationale for this becomes clear again by thinking about subclasses like a\nmasked |Quantity|.  For instance, consider an array ``s`` of lengths with\nshape ``(N, 3)``, in which the last axis represents width, height, and depth.\nWith this, you could compute corresponding volumes by taking the product of\nthe values in the last axis, ``s.prod(axis=-1)``. But if masked elements were\nskipped, the physical dimension of entries in the result would depend how many\nelements were masked, which is something |Quantity| could not represent (and\nwould be rather surprising!).  As noted above, however, masked elements are\nskipped for operations for which this is well defined, such as for getting the\nmean and other sample properties such as the variance and standard deviation.\n\nA third difference is more conceptual.  For `~numpy.ma.MaskedArray`, the\ninstance that is created is a masked version of the unmasked instance, i.e.,\n`~numpy.ma.MaskedArray` remembers that is has wrapped a subclass like\n|Quantity|, but does not share any of its methods.  Hence, even though the\nresulting class looks reasonable at first glance, it does not work as expected::\n\n  >>> q = [1., 2.] * u.m\n  >>> np_mq = np.ma.MaskedArray(q, mask=[False, True])\n  >>> np_mq\n  masked_Quantity(data=[1.0, --],\n                  mask=[False,  True],\n            fill_value=1e+20)\n  >>> np_mq.unit\n  Traceback (most recent call last):\n  ...\n  AttributeError: 'MaskedArray' object has no attribute 'unit'\n  >>> np_mq / u.s\n  <Quantity [1., 2.] 1 / s>\n\nIn contrast, |Masked| is always wrapped around the data properly, i.e., a\n``MaskedQuantity`` is a quantity which has masked values, but with a unit that\nis never masked.  Indeed, one can see this from the class hierarchy::\n\n  >>> mq.__class__.__mro__\n  (<class 'astropy.utils.masked.core.MaskedQuantity'>,\n   <class 'astropy.units.quantity.Quantity'>,\n   <class 'astropy.utils.masked.core.MaskedNDArray'>,\n   <class 'astropy.utils.masked.core.Masked'>,\n   <class 'astropy.utils.shapes.NDArrayShapeMethods'>,\n   <class 'numpy.ndarray'>,\n   <class 'object'>)\n\nThis choice has made the implementation much simpler: |Masked| only has to\nworry about how to deal with masked values, while |Quantity| can worry just\nabout unit propagation, etc.  Indeed, an experiment showed that applying\n|Masked| to `~astropy.table.Column` (which is a subclass of `~numpy.ndarray`),\nthe result is a new ``MaskedColumn`` that \"just works\", with no need for the\noverrides and special-casing that were needed to make `~numpy.ma.MaskedArray`\nwork with `~astropy.table.Column`.  (Because the behaviour does change\nsomewhat, however, we chose not to replace the existing implementation.)\n\nIn some respects, rather than think of |Masked| as similar to\n`~numpy.ma.MaskedArray`, it may be more useful to think of |Masked| as similar\nto marking bad elements in arrays with NaN (not-a-number).  Like those NaN,\nthe mask just propagates, except that for some operations like taking the mean\nthe equivalence of `~numpy.nanmean` is used.\n\nReference/API\n=============\n\n.. automodapi:: astropy.utils.masked\n\n.. automodapi:: astropy.utils.masked.function_helpers\n"},{"id":197,"name":"docs/config","nodeType":"Package"},{"id":198,"name":"index.rst","nodeType":"TextFile","path":"docs/config","text":".. _astropy_config:\n\n***************************************\nConfiguration System (`astropy.config`)\n***************************************\n\nIntroduction\n============\n\nThe ``astropy`` configuration system is designed to give users control of\nvarious parameters used in ``astropy`` or affiliated packages without delving\ninto the source code to make those changes.\n\n.. note::\n    * Before version 4.3 the configuration file was created by default\n      when importing ``astropy``. Its existence was required, which is\n      no longer the case.\n\nGetting Started\n===============\n\nThe ``astropy`` configuration options are most conveniently set by modifying\nthe configuration file. Since ``astropy`` 4.3 you need to create this file,\nwhereas before it was created automatically when importing ``astropy``. The\nfunction :func:`~astropy.config.create_config_file` creates the file with all\nof the default values commented out::\n\n    >>> from astropy.config import create_config_file\n    >>> create_config_file('astropy')  # doctest: +SKIP\n\nThe exact location of this file can be obtained with\n:func:`~astropy.config.get_config_dir`::\n\n    >>> from astropy.config import get_config_dir\n    >>> get_config_dir()  # doctest: +SKIP\n\nAnd you should see the location of your configuration directory. The standard\nscheme generally puts your configuration directory in\n``$HOME/.astropy/config``. It can be customized with the environment variable\n``XDG_CONFIG_HOME`` in which case the ``$XDG_CONFIG_HOME/astropy`` directory\nmust exist. Note that ``XDG_CONFIG_HOME`` comes from a Linux-centric\nspecification (see `here\n<https://wiki.archlinux.org/index.php/XDG_Base_Directory_support>`_ for more\ndetails), but ``astropy`` will use this on any OS as a more general means to\nknow where user-specific configurations should be written.\n\n.. note::\n    See :ref:`astropy_config_file` for the content of this configuration file.\n\nOnce you have found the configuration file, open it with your favorite editor.\nIt should have all of the sections you might want, with descriptions and the\ntype of value that is accepted. Feel free to edit this as you wish, and\nany of these changes will be reflected when you next start ``astropy``. Or call\nthe :func:`~astropy.config.reload_config` function if you want to see your\nchanges immediately in your current ``astropy`` session::\n\n    >>> from astropy.config import reload_config\n    >>> reload_config()\n\n.. note::\n    If for whatever reason your ``$HOME/.astropy`` directory is not accessible\n    (i.e., you have ``astropy`` running somehow as root but you are not the root\n    user), the best solution is to set the ``XDG_CONFIG_HOME`` and\n    ``XDG_CACHE_HOME`` environment variables pointing to directories, and create\n    an ``astropy`` directory inside each of those. Both the configuration and\n    data download systems will then use those directories and never try to\n    access the ``$HOME/.astropy`` directory.\n\n\nUsing `astropy.config`\n======================\n\nAccessing Values\n----------------\n\nBy convention, configuration parameters live inside of objects called\n``conf`` at the root of each sub-package. For example, configuration\nparameters related to data files live in ``astropy.utils.data.conf``.\nThis object has properties for getting and setting individual\nconfiguration parameters. For instance, to get the default URL for\n``astropy`` remote data, do::\n\n    >>> from astropy.utils.data import conf\n    >>> conf.dataurl\n    'http://data.astropy.org/'\n\nChanging Values at Runtime\n--------------------------\n\nChanging the persistent state of configuration values is done by editing the\nconfiguration file as described above. Values can also, however, be\nmodified in an active Python session by setting any of the properties\non a ``conf`` object, or using the\n:meth:`~astropy.config.ConfigNamespace.set_temp` `context_manager\n<https://docs.python.org/3/reference/datamodel.html#context-managers>`_, as\nlong as the new value complies with the `Item Types and Validation`_.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Changing the Persistent State of Configuration Values at Runtime\n\nSuppose there is a part of your configuration file that looks like:\n\n.. code-block:: ini\n\n    [utils.data]\n\n    # URL for astropy remote data site.\n    dataurl = http://data.astropy.org/\n\n    # Time to wait for remote data query (in seconds).\n    remote_timeout = 10.0\n\nIf you wish to modify the ``remote_timeout`` value, but only for some small\nsection of your code, then :meth:`~astropy.config.ConfigNamespace.set_temp`\ntakes care of resetting the value you changed when you are done using it::\n\n    >>> from astropy.utils.data import conf\n    >>> conf.remote_timeout\n    10.0\n    >>> # Change remote_timeout, but only inside the with-statement.\n    >>> with conf.set_temp('remote_timeout', 4.5):\n    ...    conf.remote_timeout\n    4.5\n    >>> conf.remote_timeout\n    10.0\n\nYou can also modify the values at runtime directly::\n\n    >>> conf.dataurl\n    'http://data.astropy.org/'\n    >>> conf.dataurl = 'http://astropydata.mywebsite.com'\n    >>> conf.dataurl\n    'http://astropydata.mywebsite.com'\n    >>> conf.remote_timeout\n    10.0\n    >>> conf.remote_timeout = 4.5\n    >>> conf.remote_timeout\n    4.5\n\n..\n  EXAMPLE END\n\nReloading Configuration\n-----------------------\n\nInstead of modifying the variables in Python, you can also modify the\nconfiguration files and then use the\n:meth:`~astropy.config.ConfigNamespace.reload` method.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Modifying and Reloading Configuration Files\n\nIf you modify the configuration file to say:\n\n.. code-block:: ini\n\n    [utils.data]\n\n    # URL for astropy remote data site.\n    dataurl = http://myotherdata.mywebsite.com/\n\n    # Time to wait for remote data query (in seconds).\n    remote_timeout = 6.3\n\nAnd then run the following commands::\n\n    >>> conf.reload('dataurl')\n    >>> conf.reload('remote_timeout')\n\nThis should update the variables with the values from the configuration file:\n\n.. doctest-skip::\n\n    >>> conf.dataurl\n    'http://myotherdata.mywebsite.com/'\n    >>> conf.remote_timeout\n    6.3\n\nYou can reload all configuration parameters of a ``conf`` object at\nonce by calling :meth:`~astropy.config.ConfigNamespace.reload` with no\nparameters::\n\n    >>> conf.reload()\n\nOr if you want to reload all the configuration items at once, not just the ones\nin the module ``conf`` belongs to, use the\n:func:`~astropy.config.reload_config` function::\n\n    >>> from astropy import config\n    >>> config.reload_config()\n\nYou can also reset a configuration parameter back to its default value with the\n:meth:`~astropy.config.ConfigNamespace.reset` method. Note that this is the\ndefault value defined in the Python code, which might be different from the\nvalue in the configuration file::\n\n    >>> conf.reset('dataurl')\n    >>> conf.dataurl\n    'http://data.astropy.org/'\n\n..\n  EXAMPLE END\n\nExploring Configuration\n-----------------------\n\nTo see what configuration parameters are defined for a given ``conf``::\n\n    >>> from astropy.utils.iers import conf\n    >>> list(conf)\n    ['auto_download',\n     'auto_max_age',\n     ...,\n     'ietf_leap_second_auto_url']\n    >>> conf.auto_max_age\n    30.0\n\nYou can also iterate through ``conf`` in a dictionary-like fashion::\n\n    >>> list(conf.values())\n    [<ConfigItem: name='auto_download' value=True at ...>,\n     <ConfigItem: name='auto_max_age' value=30.0 at ...>,\n     ...,\n     <ConfigItem: name='ietf_leap_second_auto_url' value=...>]\n    >>> for (key, cfgitem) in conf.items():\n    ...     if key == 'auto_max_age':\n    ...         print(f'{cfgitem.description} Value is {cfgitem()}')\n    Maximum age (days) of predictive data before auto-downloading. See \"Auto\n    refresh behavior\" in astropy.utils.iers documentation for details. Default\n    is 30. Value is 30.0\n\nUpgrading ``astropy``\n---------------------\n\nEach time you upgrade to a new major version of ``astropy``, the\nconfiguration parameters may have changed. If you want to create a new\nconfiguration file, you can run::\n\n    >>> from astropy.config import create_config_file\n    >>> create_config_file('astropy', overwrite=True)  # doctest: +SKIP\n\nNote that this will overwrite the existing file, so if you modified it you\nmay want to report your changes in the new file. Another possibility is to\nhave a look at the :ref:`astropy_config` to see what has changed.\n\n.. _config-developer:\n\nAdding New Configuration Items\n==============================\n\nConfiguration items should be used wherever an option or setting is\nneeded that is either tied to a system configuration or should persist\nacross sessions of ``astropy`` or an affiliated package. Options that may\naffect the results of science calculations should not be configuration\nitems, but should instead be :class:`~astropy.utils.state.ScienceState`\ninstances, so it is possible to reproduce science results without them being\naffected by configuration parameters set in a particular environment.\nAdmittedly, this is only a guideline, as the precise cases where a\nconfiguration item is preferred over, say, a keyword option for a\nfunction is somewhat personal preference. It is the preferred form of\npersistent configuration, however, and ``astropy`` packages must all use\nit (and it is recommended for affiliated packages).\n\nThe reference guide below describes the interface for creating a\n``conf`` object with a number of configuration parameters. They\nshould be defined at the top level (i.e., in the ``__init__.py`` of\neach sub-package that has configuration items)::\n\n    \"\"\" This is the docstring at the beginning of a module\n    \"\"\"\n    from astropy import config as _config\n\n    class Conf(_config.ConfigNamespace):\n        \"\"\"\n        Configuration parameters for my subpackage.\n        \"\"\"\n        some_setting = _config.ConfigItem(\n            1, 'Description of some_setting')\n        another_setting = _config.ConfigItem(\n            'string value', 'Description of another_setting')\n        some_list = _config.ConfigItem(\n            [], 'Description of some_list', cfgtype='list')\n        another_list = _config.ConfigItem(\n            ['value'], 'Description of another_setting', cfgtype='list')\n\n    # Create an instance for the user\n    conf = Conf()\n\n    # implementation ...\n    def some_func():\n        # to get the value of some of these options, I might do:\n        something = conf.some_setting + 2\n        return conf.another_setting + ' Also, I added text.'\n\nFor an affiliated package called, for example, ``packagename``, the\nconfiguration file can be generated with the\n:func:`~astropy.config.create_config_file` function like this::\n\n    >>> from astropy.config import create_config_file\n    >>> create_config_file('packagename')  # doctest: +SKIP\n\nThe following content would be written to the config file template:\n\n.. code-block:: ini\n\n    [subpackage]\n    ## Description of some_setting\n    # some_setting = 1\n\n    ## Description of another_setting\n    # another_setting = foo\n\n    ## Description of some_list\n    # some_list = ,\n\n    ## Description of another_setting\n    # another_list = value,\n\nNote that the key/value pairs are commented out. This will allow for\nchanging the default values in a future version of the package without\nrequiring the user to edit their configuration file to take advantage\nof the new defaults. By convention, the descriptions of each\nparameter are in comment lines starting with two hash characters\n(``##``) to distinguish them from commented out key/value pairs.\n\nItem Types and Validation\n-------------------------\n\nIf not otherwise specified, a :class:`~astropy.config.ConfigItem` gets its type\nfrom the type of the ``defaultvalue`` it is given when it is created. The item\ncan only ever have a value of this type, although in some cases a provided\nvalue can be automatically converted. For example\n\n::\n\n    >>> conf.auto_download\n    True\n    >>> conf.auto_download = 0\n    >>> conf.auto_download\n    False\n\nsucceeds because the :class:`int` ``0`` can be safely converted to the\n:class:`bool` `False`. On the other hand\n\n::\n\n    >>> from astropy.utils.data import conf\n    >>> conf.compute_hash_block_size\n    65536\n    >>> conf.compute_hash_block_size = 65536.0\n    Traceback (most recent call last):\n    ...\n    TypeError: Provided value for configuration item compute_hash_block_size\n    not valid: the value \"65536.0\" is of the wrong type.\n\nfails because converting a :class:`float` to an :class:`int` can lose\ninformation.\n\nNote that if you want the configuration item to be limited to a particular set\nof options, you should pass in a :class:`list` as the ``defaultvalue`` option.\nThe first entry in the :class:`list` will be taken as the default, and the\n:class:`list` as a whole gives all of the valid options. For example::\n\n    an_option = ConfigItem(['a', 'b', 'c'],\n                           \"This option can be 'a', 'b', or 'c'\")\n    conf.an_option = 'b'  # succeeds\n    conf.an_option = 'c'  # succeeds\n    conf.an_option = 'd'  # fails!\n    conf.an_option = 6    # fails!\n\nFinally, a :class:`~astropy.config.ConfigItem` can be explicitly given a type\nvia the ``cfgtype`` option::\n\n    an_int_setting = ConfigItem(\n        1, 'A description.', cfgtype='integer')\n    ...\n    conf.an_int_setting = 3     # works fine\n    conf.an_int_setting = 4.2   # fails!\n\nIf the default value's type does not match ``cfgtype``, the\n:class:`~astropy.config.ConfigItem` cannot be created.\n\nIn summary, the default behavior (of automatically determining ``cfgtype``)\nis usually what you want. The main exception is when you want your\nconfiguration item to be a :class:`list`. The default behavior will treat that\nas a *list of options* unless you explicitly tell it that the\n:class:`~astropy.config.ConfigItem` itself is supposed to be a :class:`list`::\n\n    # The setting must be 1, 2 or 3\n    a_list_setting = ConfigItem([1, 2, 3], 'A description.')\n\n    # The setting must be a list and is [1, 2, 3] by default\n    a_list_setting = ConfigItem([1, 2, 3], 'A description.', cfgtype='list')\n\nDetails of all of the valid ``cfgtype`` items can be found in the\n`validation section of the configobj manual\n<https://configobj.readthedocs.io/en/latest/validate.html#the-standard-functions>`_.\nBelow is a list of the valid values here for quick reference:\n\n* ``'integer'``\n* ``'float'``\n* ``'boolean'``\n* ``'string'``\n* ``'ip_addr'``\n* ``'list'``\n* ``'tuple'``\n* ``'int_list'``\n* ``'float_list'``\n* ``'bool_list'``\n* ``'string_list'``\n* ``'ip_addr_list'``\n* ``'mixed_list'``\n* ``'option'``\n* ``'pass'``\n\nUsage Tips\n----------\n\nKeep in mind that :class:`~astropy.config.ConfigItem` objects can be\nchanged at runtime by users. So it is always recommended to read their\nvalues immediately before use instead of storing their initial\nvalue to some other variable (or used as a default for a\nfunction). For example, the following is incorrect usage::\n\n    >>> from astropy.utils.data import conf\n    >>> conf.remote_timeout = 1.0\n    >>> def some_func(val=conf.remote_timeout):\n    ...     return val + 2\n\nThis works only as long as the user does not change the value of the\nconfiguration item after the function has been defined, but if they do, the\nfunction will not know about the change::\n\n    >>> some_func()\n    3.0\n    >>> conf.remote_timeout = 3.0\n    >>> some_func()  # naively should return 5.0, because 3 + 2 = 5\n    3.0\n\nThere are two ways around this. The typical/intended way is::\n\n    >>> def some_func():\n    ...     \"\"\"\n    ...     The `SOME_SETTING` configuration item influences this output\n    ...     \"\"\"\n    ...     return conf.remote_timeout + 2\n    >>> some_func()\n    5.0\n    >>> conf.remote_timeout = 5.0\n    >>> some_func()\n    7.0\n\nOr, if the option needs to be available as a function parameter::\n\n    def some_func(val=None):\n        \"\"\"\n        If not specified, `val` is set by the `SOME_SETTING` configuration item.\n        \"\"\"\n        return (conf.remote_timeout if val is None else val) + 2\n\n\nCustomizing Config Location in Affiliated Packages\n==================================================\n\nThe `astropy.config` package can be used by other packages. By default creating\na config object in another package will lead to a configuration file taking the\nname of that package in the ``astropy`` config directory (i.e.,\n``<astropy_config>/packagename.cfg``).\n\nIt is possible to configure this behavior so that the a custom configuration\ndirectory is created for your package, for example,\n``~/.packagename/packagename.cfg``. To do this, create a ``packagename.config``\nsubpackage and put the following into the ``__init__.py`` file::\n\n  import astropy.config as astropyconfig\n\n\n  class ConfigNamespace(astropyconfig.ConfigNamespace):\n      rootname = 'packagename'\n\n\n  class ConfigItem(astropyconfig.ConfigItem):\n      rootname = 'packagename'\n\nThen replace all imports of `astropy.config` with ``packagename.config``.\n\n\nSee Also\n========\n\n.. toctree::\n   :maxdepth: 2\n\n   astropy_config\n\n:doc:`/logging` (overview of `astropy.logger`)\n\n\nReference/API\n=============\n\n.. automodapi:: astropy.config\n\n.. testcleanup::\n\n    >>> from astropy import config\n    >>> config.reload_config()\n    >>> from astropy.utils.iers import conf\n    >>> conf.auto_download = False\n"},{"id":199,"name":"astropy_config.rst","nodeType":"TextFile","path":"docs/config","text":".. _astropy_config_file:\n\nAstropy's Default Configuration File\n************************************\n\n .. generate_config:: astropy\n"},{"id":200,"name":"docs/nddata","nodeType":"Package"},{"id":201,"name":"ccddata.rst","nodeType":"TextFile","path":"docs/nddata","text":".. _ccddata:\n\n\nCCDData Class\n=============\n\nGetting Started\n---------------\n\nGetting Data In\n+++++++++++++++\n\nCreating a `~astropy.nddata.CCDData` object from any array-like data using\n`astropy.nddata` is convenient:\n\n    >>> import numpy as np\n    >>> from astropy.nddata import CCDData\n    >>> ccd = CCDData(np.arange(10), unit=\"adu\")\n\nNote that behind the scenes, this creates references to (not copies of) your\ndata when possible, so modifying the data in ``ccd`` will modify the\nunderlying data.\n\nYou are **required** to provide a unit for your data. The most frequently used\nunits for these objects are likely to be ``adu``, ``photon``, and ``electron``,\nwhich can be set either by providing the string name of the unit (as in the\nexample above) or from unit objects:\n\n    >>> from astropy import units as u\n    >>> ccd_photon = CCDData([1, 2, 3], unit=u.photon)\n    >>> ccd_electron = CCDData([1, 2, 3], unit=\"electron\")\n\nIf you prefer *not* to use the unit functionality, then use the special unit\n``u.dimensionless_unscaled`` when you create your `~astropy.nddata.CCDData`\nimages:\n\n    >>> ccd_unitless = CCDData(np.zeros((10, 10)),\n    ...                        unit=u.dimensionless_unscaled)\n\nA `~astropy.nddata.CCDData` object can also be initialized from a FITS filename\nor URL:\n\n    >>> ccd = CCDData.read('my_file.fits', unit=\"adu\")  # doctest: +SKIP\n    >>> ccd = CCDData.read('http://data.astropy.org/tutorials/FITS-images/HorseHead.fits', unit=\"adu\", cache=True)  # doctest: +REMOTE_DATA +IGNORE_WARNINGS\n\nIf there is a unit in the FITS file (in the ``BUNIT`` keyword), that will be\nused, but explicitly providing a unit in ``read`` will override any unit in the\nFITS file.\n\nThere is no restriction at all on what the unit can be — any unit in\n`astropy.units` or another that you create yourself will work.\n\nIn addition, the user can specify the extension in a FITS file to use:\n\n    >>> ccd = CCDData.read('my_file.fits', hdu=1, unit=\"adu\")  # doctest: +SKIP\n\nIf ``hdu`` is not specified, it will assume the data is in the primary\nextension. If there is no data in the primary extension, the first extension\nwith image data will be used.\n\nMetadata\n++++++++\n\nWhen initializing from a FITS file, the ``header`` property is initialized using\nthe header of the FITS file. Metadata is optional, and can be provided by any\ndictionary or dict-like object:\n\n    >>> ccd_simple = CCDData(np.arange(10), unit=\"adu\")\n    >>> my_meta = {'observer': 'Edwin Hubble', 'exposure': 30.0}\n    >>> ccd_simple.header = my_meta  # or use ccd_simple.meta = my_meta\n\nWhether the metadata is case-sensitive or not depends on how it is\ninitialized. A FITS header, for example, is not case-sensitive, but a Python\ndictionary is.\n\nGetting Data Out\n++++++++++++++++\n\nA `~astropy.nddata.CCDData` object behaves like a ``numpy`` array (masked if the\n`~astropy.nddata.CCDData` mask is set) in expressions, and the underlying\ndata (ignoring any mask) is accessed through the ``data`` attribute:\n\n    >>> ccd_masked = CCDData([1, 2, 3], unit=\"adu\", mask=[0, 0, 1])\n    >>> 2 * np.ones(3) * ccd_masked   # one return value will be masked\n    masked_array(data=[2.0, 4.0, --],\n                 mask=[False, False,  True],\n           fill_value=1e+20)\n    >>> 2 * np.ones(3) * ccd_masked.data   # ignores the mask  # doctest: +FLOAT_CMP\n    array([2., 4., 6.])\n\nYou can force conversion to a ``numpy`` array with:\n\n    >>> np.asarray(ccd_masked)\n    array([1, 2, 3])\n    >>> np.ma.array(ccd_masked.data, mask=ccd_masked.mask)\n    masked_array(data=[1, 2, --],\n                 mask=[False, False,  True],\n           fill_value=999999)\n\nA method for converting a `~astropy.nddata.CCDData` object to a FITS HDU list\nis also available. It converts the metadata to a FITS header:\n\n    >>> hdulist = ccd_masked.to_hdu()\n\nYou can also write directly to a FITS file:\n\n    >>> ccd_masked.write('my_image.fits')\n\nMasks and Flags\n+++++++++++++++\n\nAlthough it is not required when a `~astropy.nddata.CCDData` image is created,\nyou can also specify a mask and/or flags.\n\nA mask is a boolean array the same size as the data in which a value of\n``True`` indicates that a particular pixel should be masked (*i.e.*, not be\nincluded in arithmetic operations or aggregation).\n\nFlags are one or more additional arrays (of any type) whose shape matches the\nshape of the data. One particularly useful type of flag is a bit planes; for\nmore details about bit planes and the functions ``astropy`` provides for\nconverting them to binary masks, see :ref:`bitmask_details`. For more details\non setting flags, see `~astropy.nddata.NDData`.\n\nWCS\n+++\n\nThe ``wcs`` attribute of a `~astropy.nddata.CCDData` object can be set two ways.\n\n+ If the `~astropy.nddata.CCDData` object is created from a FITS file that has\n  WCS keywords in the header, the ``wcs`` attribute is set to a\n  `~astropy.wcs.WCS` object using the information in the FITS header.\n\n+ The WCS can also be provided when the `~astropy.nddata.CCDData` object is\n  constructed with the ``wcs`` argument.\n\nEither way, the ``wcs`` attribute is kept up to date if the\n`~astropy.nddata.CCDData` image is trimmed.\n\nUncertainty\n-----------\n\nYou can set the uncertainty directly, either by creating a\n`~astropy.nddata.StdDevUncertainty` object first:\n\n    >>> data = np.random.normal(size=(10, 10), loc=1.0, scale=0.1)\n    >>> ccd = CCDData(data, unit=\"electron\")\n    >>> from astropy.nddata.nduncertainty import StdDevUncertainty\n    >>> uncertainty = 0.1 * ccd.data  # can be any array whose shape matches the data\n    >>> my_uncertainty = StdDevUncertainty(uncertainty)\n    >>> ccd.uncertainty = my_uncertainty\n\nOr by providing a `~numpy.ndarray` with the same shape as the data:\n\n    >>> ccd.uncertainty = 0.1 * ccd.data  # doctest: +ELLIPSIS\n    INFO: array provided for uncertainty; assuming it is a StdDevUncertainty. [...]\n\nIn this case, the uncertainty is assumed to be\n`~astropy.nddata.StdDevUncertainty`.\n\nTwo other uncertainty classes are available for which error propagation is\nalso supported: `~astropy.nddata.VarianceUncertainty` and\n`~astropy.nddata.InverseVariance`. Using one of these three uncertainties is\nrequired to enable error propagation in `~astropy.nddata.CCDData`.\n\nIf you want access to the underlying uncertainty, use its ``.array`` attribute:\n\n    >>> ccd.uncertainty.array  # doctest: +ELLIPSIS\n    array(...)\n\nArithmetic with Images\n----------------------\n\nMethods are provided to perform arithmetic operations with a\n`~astropy.nddata.CCDData` image and a number, an ``astropy``\n`~astropy.units.Quantity` (a number with units), or another\n`~astropy.nddata.CCDData` image.\n\nUsing these methods propagates errors correctly (if the errors are\nuncorrelated), takes care of any necessary unit conversions, and applies masks\nappropriately. Note that the metadata of the result is *not* set if the\noperation is between two `~astropy.nddata.CCDData` objects.\n\n    >>> result = ccd.multiply(0.2 * u.adu)\n    >>> uncertainty_ratio = result.uncertainty.array[0, 0]/ccd.uncertainty.array[0, 0]\n    >>> round(uncertainty_ratio, 5)   # doctest: +FLOAT_CMP\n    0.2\n    >>> result.unit\n    Unit(\"adu electron\")\n\n.. note::\n    The affiliated package `ccdproc <https://ccdproc.readthedocs.io>`_ provides\n    functions for many common data reduction operations. Those functions try to\n    construct a sensible header for the result and provide a mechanism for\n    logging the action of the function in the header.\n\n\nThe arithmetic operators ``*``, ``/``, ``+``, and ``-`` are *not* overridden.\n\n.. note::\n   If two images have different WCS values, the ``wcs`` on the first\n   `~astropy.nddata.CCDData` object will be used for the resultant object.\n"},{"id":202,"name":"nddata.rst","nodeType":"TextFile","path":"docs/nddata","text":".. _nddata_details:\n\nNDData\n******\n\nOverview\n========\n\n:class:`~astropy.nddata.NDData` is based on `numpy.ndarray`-like ``data`` with\nadditional meta attributes:\n\n+  ``meta`` for general metadata\n+ ``unit`` represents the physical unit of the data\n+ ``uncertainty`` for the uncertainty of the data\n+ ``mask`` indicates invalid points in the data\n+ ``wcs`` represents the relationship between the data grid and world\n  coordinates\n\nEach of these attributes can be set during initialization or directly on the\ninstance. Only the ``data`` cannot be directly set after creating the instance.\n\nData\n====\n\nThe data is the base of `~astropy.nddata.NDData` and is required to be\n`numpy.ndarray`-like. It is the only property that is required to create an\ninstance and it cannot be directly set on the instance.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Creating Instances with NumPy NDarray-like Data\n\nTo create an instance::\n\n    >>> import numpy as np\n    >>> from astropy.nddata import NDData\n    >>> array = np.array([[0, 1, 0], [1, 0, 1], [0, 1, 0]])\n    >>> ndd = NDData(array)\n    >>> ndd\n    NDData([[0, 1, 0],\n            [1, 0, 1],\n            [0, 1, 0]])\n\nAnd access by the ``data`` attribute::\n\n    >>> ndd.data\n    array([[0, 1, 0],\n           [1, 0, 1],\n           [0, 1, 0]])\n\nAs already mentioned, it is not possible to set the data directly. So\n``ndd.data = np.arange(9)`` will raise an exception. But the data can be\nmodified in place::\n\n    >>> ndd.data[1,1] = 100\n    >>> ndd.data\n    array([[  0,   1,   0],\n           [  1, 100,   1],\n           [  0,   1,   0]])\n\n..\n  EXAMPLE END\n\nData During Initialization\n--------------------------\n\nDuring initialization it is possible to provide data that is not a\n`numpy.ndarray` but convertible to one.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Data Convertible to a NumPy NDarray During Initialization\n\nTo provide data that is convertible to a `numpy.ndarray`, you can pass a `list`\ncontaining numerical values::\n\n    >>> alist = [1, 2, 3, 4]\n    >>> ndd = NDData(alist)\n    >>> ndd.data  # data will be a numpy-array:\n    array([1, 2, 3, 4])\n\nA nested `list` or `tuple` is possible, but if these contain non-numerical\nvalues the conversion might fail.\n\nBesides input that is convertible to such an array, you can also use the\n``data`` parameter to pass implicit additional information. For example, if the\ndata is another `~astropy.nddata.NDData` object it implicitly uses its\nproperties::\n\n    >>> ndd = NDData(ndd, unit = 'm')\n    >>> ndd2 = NDData(ndd)\n    >>> ndd2.data  # It has the same data as ndd\n    array([1, 2, 3, 4])\n    >>> ndd2.unit  # but it also has the same unit as ndd\n    Unit(\"m\")\n\nAnother possibility is to use a `~astropy.units.Quantity` as a ``data``\nparameter::\n\n    >>> import astropy.units as u\n    >>> quantity = np.ones(3) * u.cm  # this will create a Quantity\n    >>> ndd3 = NDData(quantity)\n    >>> ndd3.data  # doctest: +FLOAT_CMP\n    array([1., 1., 1.])\n    >>> ndd3.unit\n    Unit(\"cm\")\n\nOr a `numpy.ma.MaskedArray`::\n\n    >>> masked_array = np.ma.array([5,10,15], mask=[False, True, False])\n    >>> ndd4 = NDData(masked_array)\n    >>> ndd4.data\n    array([ 5, 10, 15])\n    >>> ndd4.mask\n    array([False,  True, False]...)\n\nIf such an implicitly passed property conflicts with an explicit parameter, the\nexplicit parameter will be used and an info message will be issued::\n\n    >>> quantity = np.ones(3) * u.cm\n    >>> ndd6 = NDData(quantity, unit='m')\n    INFO: overwriting Quantity's current unit with specified unit. [astropy.nddata.nddata]\n    >>> ndd6.data  # doctest: +FLOAT_CMP\n    array([1., 1., 1.])\n    >>> ndd6.unit\n    Unit(\"m\")\n\nThe unit of the `~astropy.units.Quantity` is being ignored and the unit is set\nto the explicitly passed one.\n\nIt might be possible to pass other classes as a ``data`` parameter as long as\nthey have the properties ``shape``, ``dtype``, ``__getitem__``, and\n``__array__``.\n\nThe purpose of this mechanism is to allow considerable flexibility in the\nobjects used to store the data while providing a useful default (``numpy``\narray).\n\n..\n  EXAMPLE END\n\nMask\n====\n\nThe ``mask`` is being used to indicate if data points are valid or invalid.\n`~astropy.nddata.NDData` does not restrict this mask in any way but it is\nexpected to follow the `numpy.ma.MaskedArray` convention in that the mask:\n\n+ Returns ``True`` for data points that are considered **invalid**.\n+ Returns ``False`` for those points that are **valid**.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Masks Used to Indicate Valid or Invalid Data Points in NDData\n\nOne possibility is to create a mask by using ``numpy``'s comparison operators::\n\n    >>> array = np.array([0, 1, 4, 0, 2])\n\n    >>> mask = array == 0  # Mask points containing 0\n    >>> mask\n    array([ True, False, False,  True, False]...)\n\n    >>> other_mask = array > 1  # Mask points with a value greater than 1\n    >>> other_mask\n    array([False, False,  True, False,  True]...)\n\nAnd initialize the `~astropy.nddata.NDData` instance using the ``mask``\nparameter::\n\n    >>> ndd = NDData(array, mask=mask)\n    >>> ndd.mask\n    array([ True, False, False,  True, False]...)\n\nOr by replacing the mask::\n\n    >>> ndd.mask = other_mask\n    >>> ndd.mask\n    array([False, False,  True, False,  True]...)\n\nThere is no requirement that the mask actually be a ``numpy`` array; for\nexample, a function which evaluates a mask value as needed is acceptable as\nlong as it follows the convention that ``True`` indicates a value that should\nbe ignored.\n\n..\n  EXAMPLE END\n\nUnit\n====\n\nThe ``unit`` represents the unit of the data values. It is required to be\n`~astropy.units.Unit`-like or a string that can be converted to such a\n`~astropy.units.Unit`::\n\n    >>> import astropy.units as u\n    >>> ndd = NDData([1, 2, 3, 4], unit=\"meter\")  # using a string\n    >>> ndd.unit\n    Unit(\"m\")\n\n..note::\n    Setting the ``unit`` on an instance is not possible.\n\nUncertainties\n=============\n\nThe ``uncertainty`` represents an arbitrary representation of the error of the\ndata values. To indicate which kind of uncertainty representation is used, the\n``uncertainty`` should have an ``uncertainty_type`` property. If no such\nproperty is found it will be wrapped inside a\n`~astropy.nddata.UnknownUncertainty`.\n\nThe ``uncertainty_type`` should follow the `~astropy.nddata.StdDevUncertainty`\nconvention in that it returns a short string like ``\"std\"`` for an uncertainty\ngiven in standard deviation. Other examples are\n`~astropy.nddata.VarianceUncertainty` and `~astropy.nddata.InverseVariance`.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Setting Uncertainties During Initialization in NDData\n\nLike the other properties the ``uncertainty`` can be set during\ninitialization::\n\n    >>> from astropy.nddata import StdDevUncertainty\n    >>> array = np.array([10, 7, 12, 22])\n    >>> uncert = StdDevUncertainty(np.sqrt(array))\n    >>> ndd = NDData(array, uncertainty=uncert)\n    >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n    StdDevUncertainty([3.16227766, 2.64575131, 3.46410162, 4.69041576])\n\nOr on the instance directly::\n\n    >>> other_uncert = StdDevUncertainty([2,2,2,2])\n    >>> ndd.uncertainty = other_uncert\n    >>> ndd.uncertainty\n    StdDevUncertainty([2, 2, 2, 2])\n\nBut it will print an info message if there is no ``uncertainty_type``::\n\n    >>> ndd.uncertainty = np.array([5, 1, 2, 10])\n    INFO: uncertainty should have attribute uncertainty_type. [astropy.nddata.nddata]\n    >>> ndd.uncertainty\n    UnknownUncertainty([ 5,  1,  2, 10])\n\n..\n  EXAMPLE END\n\nWCS\n---\n\nThe ``wcs`` should contain a mapping from the gridded data to world\ncoordinates. There are no restrictions placed on the property currently but it\nmay be restricted to an `~astropy.wcs.WCS` object or a more generalized WCS\nobject in the future.\n\n.. note::\n    Like the unit the ``wcs`` cannot be set on an instance.\n\nMetadata\n=========\n\nThe ``meta`` property contains all further meta information that does not fit\nany other property.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Metadata in NDData\n\nIf the ``meta`` property is given it must be `dict`-like::\n\n    >>> ndd = NDData([1,2,3], meta={'observer': 'myself'})\n    >>> ndd.meta\n    {'observer': 'myself'}\n\n`dict`-like means it must be a mapping from some keys to some values. This\nalso includes `~astropy.io.fits.Header` objects::\n\n    >>> from astropy.io import fits\n    >>> header = fits.Header()\n    >>> header['observer'] = 'Edwin Hubble'\n    >>> ndd = NDData(np.zeros([10, 10]), meta=header)\n    >>> ndd.meta['observer']\n    'Edwin Hubble'\n\nIf the ``meta`` property is not provided or explicitly set to ``None``, it will\ndefault to an empty `collections.OrderedDict`::\n\n    >>> ndd.meta = None\n    >>> ndd.meta\n    OrderedDict()\n\n    >>> ndd = NDData([1,2,3])\n    >>> ndd.meta\n    OrderedDict()\n\nThe ``meta`` object therefore supports adding or updating these values::\n\n    >>> ndd.meta['exposure_time'] = 340.\n    >>> ndd.meta['filter'] = 'J'\n\nElements of the metadata dictionary can be set to any valid Python object::\n\n    >>> ndd.meta['history'] = ['calibrated', 'aligned', 'flat-fielded']\n\n..\n  EXAMPLE END\n\nInitialization with Copy\n========================\n\nThe default way to create an `~astropy.nddata.NDData` instance is to try saving\nthe parameters as references to the original rather than as copy. Sometimes\nthis is not possible because the internal mechanics do not allow for this.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Creating an NDData Instance with Copy\n\nIf the ``data`` is a `list` then during initialization this is copied\nwhile converting to a `~numpy.ndarray`. But it is also possible to enforce\ncopies during initialization by setting the ``copy`` parameter to ``True``::\n\n    >>> array = np.array([1, 2, 3, 4])\n    >>> ndd = NDData(array)\n    >>> ndd.data[2] = 10\n    >>> array[2]  # Original array has changed\n    10\n\n    >>> ndd2 = NDData(array, copy=True)\n    >>> ndd2.data[2] = 3\n    >>> array[2]  # Original array hasn't changed.\n    10\n\n.. note::\n    In some cases setting ``copy=True`` will copy the ``data`` twice. Known\n    cases are if the ``data`` is a `list` or `tuple`.\n\n..\n  EXAMPLE END\n\nConverting NDData to Other Classes\n==================================\n\nThere is limited support to convert a `~astropy.nddata.NDData` instance to\nother classes. In the process some properties might be lost.\n\n    >>> data = np.array([1, 2, 3, 4])\n    >>> mask = np.array([True, False, False, True])\n    >>> unit = 'm'\n    >>> ndd = NDData(data, mask=mask, unit=unit)\n\n`numpy.ndarray`\n---------------\n\nConverting the ``data`` to an array::\n\n    >>> array = np.asarray(ndd.data)\n    >>> array\n    array([1, 2, 3, 4])\n\nThough using ``np.asarray`` is not required, in most cases it will ensure that\nthe result is always a `numpy.ndarray`\n\n`numpy.ma.MaskedArray`\n----------------------\n\nConverting the ``data`` and ``mask`` to a MaskedArray::\n\n\n    >>> masked_array = np.ma.array(ndd.data, mask=ndd.mask)\n    >>> masked_array\n    masked_array(data=[--, 2, 3, --],\n                 mask=[ True, False, False,  True],\n           fill_value=999999)\n\n`~astropy.units.Quantity`\n-------------------------\n\nConverting the ``data`` and ``unit`` to a Quantity::\n\n    >>> quantity = u.Quantity(ndd.data, unit=ndd.unit)\n    >>> quantity  # doctest: +FLOAT_CMP\n    <Quantity [1., 2., 3., 4.] m>\n\n.. note::\n    Ideally, you would construct masked quantities, but these are not properly\n    supported: many operations on them fail.\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":203,"name":"crpix","nodeType":"Attribute","startLoc":14,"text":"w.wcs.crpix"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":204,"name":"cdelt","nodeType":"Attribute","startLoc":15,"text":"w.wcs.cdelt"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":205,"name":"crval","nodeType":"Attribute","startLoc":16,"text":"w.wcs.crval"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":206,"name":"ctype","nodeType":"Attribute","startLoc":17,"text":"w.wcs.ctype"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":207,"name":"pixcrd","nodeType":"Attribute","startLoc":26,"text":"pixcrd"},{"id":208,"name":"index.rst","nodeType":"TextFile","path":"docs/nddata","text":".. _astropy_nddata:\n\n*****************************************\nN-Dimensional Datasets (`astropy.nddata`)\n*****************************************\n\nIntroduction\n============\n\nThe `~astropy.nddata` package provides classes to represent images and other\ngridded data, some essential functions for manipulating images, and the\ninfrastructure for package developers who wish to include support for the\nimage classes. This subpackage was developed based on `APE 7`_.\n\n.. _astropy_nddata_getting_started:\n\nGetting Started\n===============\n\nNDData\n------\n\nThe primary purpose of `~astropy.nddata.NDData` is to act as a *container* for\ndata, metadata, and other related information like a mask.\n\nAn `~astropy.nddata.NDData` object can be instantiated by passing it an\nn-dimensional `numpy` array::\n\n    >>> import numpy as np\n    >>> from astropy.nddata import NDData\n    >>> array = np.zeros((12, 12, 12))  # a 3-dimensional array with all zeros\n    >>> ndd1 = NDData(array)\n\nOr something that can be converted to a `numpy.ndarray`::\n\n    >>> ndd2 = NDData([1, 2, 3, 4])\n    >>> ndd2\n    NDData([1, 2, 3, 4])\n\nAnd can be accessed again via the ``data`` attribute::\n\n    >>> ndd2.data\n    array([1, 2, 3, 4])\n\nIt also supports additional properties like a ``unit`` or ``mask`` for the\ndata, a ``wcs`` (World Coordinate System) and ``uncertainty`` of the data and\nadditional ``meta`` attributes:\n\n    >>> data = np.array([1,2,3,4])\n    >>> mask = data > 2\n    >>> unit = 'erg / s'\n    >>> from astropy.nddata import StdDevUncertainty\n    >>> uncertainty = StdDevUncertainty(np.sqrt(data)) # representing standard deviation\n    >>> meta = {'object': 'fictional data.'}\n    >>> ndd = NDData(data, mask=mask, unit=unit, uncertainty=uncertainty,\n    ...              meta=meta)\n    >>> ndd\n    NDData([1, 2, 3, 4], unit='erg / s')\n\nThe representation only displays the ``data``; the other attributes need to be\naccessed directly, for example, ``ndd.mask`` to access the mask.\n\n\nNDDataRef\n---------\n\nBuilding upon this pure container, `~astropy.nddata.NDDataRef` implements:\n\n+ A ``read`` and ``write`` method to access ``astropy``'s unified file I/O\n  interface.\n+ Simple arithmetics like addition, subtraction, division, and multiplication.\n+ Slicing.\n\nInstances are created in the same way::\n\n    >>> from astropy.nddata import NDDataRef\n    >>> ndd = NDDataRef(ndd)\n    >>> ndd\n    NDDataRef([1, 2, 3, 4], unit='erg / s')\n\nBut also support arithmetic (:ref:`nddata_arithmetic`) like addition::\n\n    >>> import astropy.units as u\n    >>> ndd2 = ndd.add([4, -3.5, 3, 2.5] * u.erg / u.s)\n    >>> ndd2\n    NDDataRef([ 5. , -1.5,  6. ,  6.5], unit='erg / s')\n\nBecause these operations have a wide range of options, these are not available\nusing arithmetic operators like ``+``.\n\nSlicing or indexing (:ref:`nddata_slicing`) is possible (with warnings issued if\nsome attribute cannot be sliced)::\n\n    >>> ndd2[2:]  # discard the first two elements  # doctest: +FLOAT_CMP\n    NDDataRef([6. , 6.5], unit='erg / s')\n    >>> ndd2[1]   # get the second element  # doctest: +FLOAT_CMP\n    NDDataRef(-1.5, unit='erg / s')\n\n\nWorking with Two-Dimensional Data Like Images\n---------------------------------------------\n\nThough the `~astropy.nddata` package supports any kind of gridded data, this\nintroduction will focus on the use of `~astropy.nddata` for two-dimensional\nimages. To get started, we will construct a two-dimensional image with a few\nsources, some Gaussian noise, and a \"cosmic ray\" which we will later mask out.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Working with Two-Dimensional Data Using NDData\n\nFirst, construct a two-dimensional image with a few sources, some Gaussian\nnoise, and a \"cosmic ray\"::\n\n    >>> import numpy as np\n    >>> from astropy.modeling.models import Gaussian2D\n    >>> y, x = np.mgrid[0:500, 0:600]\n    >>> data = (Gaussian2D(1, 150, 100, 20, 10, theta=0.5)(x, y) +\n    ...         Gaussian2D(0.5, 400, 300, 8, 12, theta=1.2)(x,y) +\n    ...         Gaussian2D(0.75, 250, 400, 5, 7, theta=0.23)(x,y) +\n    ...         Gaussian2D(0.9, 525, 150, 3, 3)(x,y) +\n    ...         Gaussian2D(0.6, 200, 225, 3, 3)(x,y))\n    >>> data += 0.01 * np.random.randn(500, 600)\n    >>> cosmic_ray_value = 0.997\n    >>> data[100, 300:310] = cosmic_ray_value\n\nThis image has a large \"galaxy\" in the lower left and the \"cosmic ray\" is the\nhorizontal line in the lower middle of the image:\n\n.. doctest-skip::\n\n    >>> import matplotlib.pyplot as plt\n    >>> plt.imshow(data, origin='lower')\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import Gaussian2D\n    y, x = np.mgrid[0:500, 0:600]\n    data = (Gaussian2D(1, 150, 100, 20, 10, theta=0.5)(x, y) +\n            Gaussian2D(0.5, 400, 300, 8, 12, theta=1.2)(x,y) +\n            Gaussian2D(0.75, 250, 400, 5, 7, theta=0.23)(x,y) +\n            Gaussian2D(0.9, 525, 150, 3, 3)(x,y) +\n            Gaussian2D(0.6, 200, 225, 3, 3)(x,y))\n    np.random.seed(123456)\n    data += 0.01 * np.random.randn(500, 600)\n    cosmic_ray_value = 0.997\n    data[100, 300:310] = cosmic_ray_value\n    plt.imshow(data, origin='lower')\n\n\nThe \"cosmic ray\" can be masked out in this test image, like this::\n\n    >>> mask = (data == cosmic_ray_value)\n\n..\n  EXAMPLE END\n\n`~astropy.nddata.CCDData` Class for Images\n------------------------------------------\n\nThe `~astropy.nddata.CCDData` object, like the other objects in this package,\ncan store the data, a mask, and metadata. The `~astropy.nddata.CCDData` object\nrequires that a unit be specified::\n\n    >>> from astropy.nddata import CCDData\n    >>> ccd = CCDData(data, mask=mask,\n    ...               meta={'object': 'fake galaxy', 'filter': 'R'},\n    ...               unit='adu')\n\nSlicing\n-------\n\nSlicing works the way you would expect with the mask and, if present,\nWCS, sliced appropriately::\n\n    >>> ccd2 = ccd[:200, :]\n    >>> ccd2.data.shape\n    (200, 600)\n    >>> ccd2.mask.shape\n    (200, 600)\n    >>> # Show the mask in a region around the cosmic ray:\n    >>> ccd2.mask[99:102, 299:311]\n    array([[False, False, False, False, False, False, False, False, False,\n            False, False, False],\n           [False,  True,  True,  True,  True,  True,  True,  True,  True,\n             True,  True, False],\n           [False, False, False, False, False, False, False, False, False,\n            False, False, False]]...)\n\nFor many applications it may be more convenient to use\n`~astropy.nddata.Cutout2D`, described in `image_utilities`_.\n\nImage Arithmetic, Including Uncertainty\n---------------------------------------\n\nMethods are provided for basic arithmetic operations between images, including\npropagation of uncertainties. Three uncertainty types are supported: variance\n(`~astropy.nddata.VarianceUncertainty`), standard deviation\n(`~astropy.nddata.StdDevUncertainty`), and inverse variance\n(`~astropy.nddata.InverseVariance`).\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Image Arithmetic Including Uncertainty in NDData\n\nThis example creates an uncertainty that is Poisson error, stored as a\nvariance::\n\n    >>> from astropy.nddata import VarianceUncertainty\n    >>> poisson_noise = np.ma.sqrt(np.ma.abs(ccd.data))\n    >>> ccd.uncertainty = VarianceUncertainty(poisson_noise ** 2)\n\nAs a convenience, the uncertainty can also be set with a ``numpy`` array. In\nthat case, the uncertainty is assumed to be the standard deviation::\n\n    >>> ccd.uncertainty = poisson_noise\n    INFO: array provided for uncertainty; assuming it is a StdDevUncertainty. [astropy.nddata.ccddata]\n\nIf we make a copy of the image and add that to the original, the uncertainty\nchanges as expected::\n\n    >>> ccd2 = ccd.copy()\n    >>> added_ccds = ccd.add(ccd2, handle_meta='first_found')\n    >>> added_ccds.uncertainty.array[0, 0] / ccd.uncertainty.array[0, 0] / np.sqrt(2) # doctest: +FLOAT_CMP\n    0.99999999999999989\n\n..\n  EXAMPLE END\n\nReading and Writing\n-------------------\n\nA `~astropy.nddata.CCDData` can be saved to a FITS file::\n\n    >>> ccd.write('test_file.fits')\n\nAnd can also be read in from a FITS file::\n\n    >>> ccd2 = CCDData.read('test_file.fits')\n\nNote the unit is stored in the ``BUNIT`` keyword in the header on saving, and is\nread from the header if it is present.\n\nDetailed help on the available keyword arguments for reading and writing\ncan be obtained via the ``help()`` method as follows:\n\n.. doctest-skip::\n\n    >>> CCDData.read.help('fits')  # Get help on the CCDData FITS reader\n    >>> CCDData.writer.help('fits')  # Get help on the CCDData FITS writer\n\n.. _image_utilities:\n\nImage Utilities\n---------------\n\nCutouts\n^^^^^^^\n\nThough slicing directly is one way to extract a subframe,\n`~astropy.nddata.Cutout2D` provides more convenient access to cutouts from the\ndata.\n\nExamples\n~~~~~~~~\n\n..\n  EXAMPLE START\n  Accessing Cutouts in NDData\n\nThis example pulls out the large \"galaxy\" in the lower left of the image, with\nthe center of the cutout at ``position``::\n\n    >>> from astropy.nddata import Cutout2D\n    >>> position = (149.7, 100.1)\n    >>> size = (81, 101)     # pixels\n    >>> cutout = Cutout2D(ccd, position, size)\n    >>> plt.imshow(cutout.data, origin='lower') # doctest: +SKIP\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import Gaussian2D\n    from astropy.nddata import CCDData\n    from astropy.nddata import Cutout2D\n    y, x = np.mgrid[0:500, 0:600]\n    data = (Gaussian2D(1, 150, 100, 20, 10, theta=0.5)(x, y) +\n            Gaussian2D(0.5, 400, 300, 8, 12, theta=1.2)(x,y) +\n            Gaussian2D(0.75, 250, 400, 5, 7, theta=0.23)(x,y) +\n            Gaussian2D(0.9, 525, 150, 3, 3)(x,y) +\n            Gaussian2D(0.6, 200, 225, 3, 3)(x,y))\n    np.random.seed(123456)\n    data += 0.01 * np.random.randn(500, 600)\n    cosmic_ray_value = 0.997\n    data[100, 300:310] = cosmic_ray_value\n    mask = (data == cosmic_ray_value)\n    ccd = CCDData(data, mask=mask,\n                  meta={'object': 'fake galaxy', 'filter': 'R'},\n                  unit='adu')\n    position = (149.7, 100.1)\n    size = (81, 101)     # pixels\n    cutout = Cutout2D(ccd, position, size)\n    plt.imshow(cutout.data, origin='lower')\n\nThis cutout can also plot itself on the original image::\n\n    >>> plt.imshow(ccd, origin='lower')  # doctest: +SKIP\n    >>> cutout.plot_on_original(color='white') # doctest: +SKIP\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import Gaussian2D\n    from astropy.nddata import CCDData, Cutout2D\n    y, x = np.mgrid[0:500, 0:600]\n    data = (Gaussian2D(1, 150, 100, 20, 10, theta=0.5)(x, y) +\n            Gaussian2D(0.5, 400, 300, 8, 12, theta=1.2)(x,y) +\n            Gaussian2D(0.75, 250, 400, 5, 7, theta=0.23)(x,y) +\n            Gaussian2D(0.9, 525, 150, 3, 3)(x,y) +\n            Gaussian2D(0.6, 200, 225, 3, 3)(x,y))\n    np.random.seed(123456)\n    data += 0.01 * np.random.randn(500, 600)\n    cosmic_ray_value = 0.997\n    data[100, 300:310] = cosmic_ray_value\n    mask = (data == cosmic_ray_value)\n    ccd = CCDData(data, mask=mask,\n                  meta={'object': 'fake galaxy', 'filter': 'R'},\n                  unit='adu')\n    position = (149.7, 100.1)\n    size = (81, 101)     # pixels\n    cutout = Cutout2D(ccd, position, size)\n    plt.imshow(ccd, origin='lower')\n    cutout.plot_on_original(color='white')\n\nThe cutout also provides methods for finding pixel coordinates in the original\nor in the cutout; recall that ``position`` is the center of the cutout in the\noriginal image::\n\n    >>> position\n    (149.7, 100.1)\n    >>> cutout.to_cutout_position(position)  # doctest: +FLOAT_CMP\n    (49.7, 40.099999999999994)\n    >>> cutout.to_original_position((49.7, 40.099999999999994))  # doctest: +FLOAT_CMP\n     (149.7, 100.1)\n\nFor more details, including constructing a cutout from World Coordinates and\nthe options for handling cutouts that go beyond the bounds of the original\nimage, see :ref:`cutout_images`.\n\n..\n  EXAMPLE END\n\nImage Resizing\n^^^^^^^^^^^^^^\n\nThe functions `~astropy.nddata.block_reduce` and\n`~astropy.nddata.block_replicate` resize images.\n\nExample\n~~~~~~~\n\n..\n  EXAMPLE START\n  Image Resizing in NDData\n\nThis example reduces the size of the image by a factor of 4. Note that the\nresult is a `numpy.ndarray`; the mask, metadata, etc. are discarded:\n\n.. doctest-requires:: skimage\n\n    >>> from astropy.nddata import block_reduce, block_replicate\n    >>> smaller = block_reduce(ccd, 4)  # doctest: +IGNORE_WARNINGS\n    >>> smaller\n    array(...)\n    >>> plt.imshow(smaller, origin='lower')  # doctest: +SKIP\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import Gaussian2D\n    from astropy.nddata import block_reduce, block_replicate\n    from astropy.nddata import CCDData, Cutout2D\n    y, x = np.mgrid[0:500, 0:600]\n    data = (Gaussian2D(1, 150, 100, 20, 10, theta=0.5)(x, y) +\n            Gaussian2D(0.5, 400, 300, 8, 12, theta=1.2)(x,y) +\n            Gaussian2D(0.75, 250, 400, 5, 7, theta=0.23)(x,y) +\n            Gaussian2D(0.9, 525, 150, 3, 3)(x,y) +\n            Gaussian2D(0.6, 200, 225, 3, 3)(x,y))\n    np.random.seed(123456)\n    data += 0.01 * np.random.randn(500, 600)\n    cosmic_ray_value = 0.997\n    data[100, 300:310] = cosmic_ray_value\n    mask = (data == cosmic_ray_value)\n    ccd = CCDData(data, mask=mask,\n                  meta={'object': 'fake galaxy', 'filter': 'R'},\n                  unit='adu')\n    smaller = block_reduce(ccd.data, 4)\n    plt.imshow(smaller, origin='lower')\n\nBy default, both `~astropy.nddata.block_reduce` and\n`~astropy.nddata.block_replicate` conserve flux.\n\n..\n  EXAMPLE END\n\nOther Image Classes\n-------------------\n\nThere are two less restrictive classes, `~astropy.nddata.NDDataArray` and\n`~astropy.nddata.NDDataRef`, that can be used to hold image data. They are\nprimarily of interest to those who may want to create their own image class by\nsubclassing from one of the classes in the `~astropy.nddata` package. The main\ndifferences between them are:\n\n+ `~astropy.nddata.NDDataRef` can be sliced and has methods for basic\n  arithmetic operations, but the user needs to use one of the uncertainty\n  classes to define an uncertainty. See :ref:`NDDataRef` for more detail.\n  Most of its properties must be set when the object is created because they\n  are not mutable.\n+ `~astropy.nddata.NDDataArray` extends `~astropy.nddata.NDDataRef` by adding\n  the methods necessary for it to behave like a ``numpy`` array in expressions\n  and adds setters for several properties. It lacks the ability to\n  automatically recognize and read data from FITS files and does not attempt\n  to automatically set the WCS property.\n+ `~astropy.nddata.CCDData` extends `~astropy.nddata.NDDataArray` by setting\n  up a default uncertainty class, setting up straightforward read/write to FITS\n  files, and automatically setting up a WCS property.\n\nMore General Gridded Data Classes\n---------------------------------\n\nThere are two additional classes in the ``nddata`` package that are of\ninterest primarily to users who either need a custom image class that goes\nbeyond the classes discussed so far, or who are working with gridded data that\nis not an image.\n\n+ `~astropy.nddata.NDData` is a container class for holding general gridded\n  data. It includes a handful of basic attributes, but no slicing or arithmetic.\n  More information about this class is in :ref:`nddata_details`.\n+ `~astropy.nddata.NDDataBase` is an abstract base class that developers of new\n  gridded data classes can subclass to declare that the new class follows the\n  `~astropy.nddata.NDData` interface. More details are in\n  :ref:`nddata_subclassing`.\n\nAdditional Examples\n===================\n\nThe list of packages below that use the ``nddata`` framework is intended to be\nuseful to either users writing their own image classes or those looking\nfor an image class that goes beyond what `~astropy.nddata.CCDData` does.\n\n+ The `SunPy project <https://sunpy.org/>`_ uses `~astropy.nddata.NDData` as the\n  foundation for its\n  `Map classes <https://docs.sunpy.org/en/stable/code_ref/map.html>`_.\n+ The class `~astropy.nddata.NDDataRef` is used in\n  `specutils <https://specutils.readthedocs.io/en/latest/>`_ as the basis for\n  `Spectrum1D <https://specutils.readthedocs.io/en/latest/api/specutils.Spectrum1D.html>`_, which adds several methods useful for\n  spectra.\n+ The package `ndmapper <https://ndmapper.readthedocs.io/en/latest/>`_, which\n  makes it easy to build reduction pipelines for optical data, uses\n  `~astropy.nddata.NDDataArray` as its image object.\n+ The package `ccdproc <https://ccdproc.readthedocs.io/en/latest/>`_ uses the\n  `~astropy.nddata.CCDData` class throughout for implementing optical/IR image\n  reduction.\n\nUsing ``nddata``\n================\n\n.. toctree::\n   :maxdepth: 2\n\n   ccddata.rst\n   utils.rst\n   bitmask.rst\n   decorator.rst\n   nddata.rst\n   mixins/index.rst\n   subclassing.rst\n\n.. note that if this section gets too long, it should be moved to a separate\n   doc page - see the top of performance.inc.rst for the instructions on how to do\n   that\n.. include:: performance.inc.rst\n\nReference/API\n=============\n\n.. automodapi:: astropy.nddata\n    :no-inheritance-diagram:\n\n.. automodapi:: astropy.nddata.bitmask\n    :no-inheritance-diagram:\n\n.. automodapi:: astropy.nddata.utils\n    :no-inheritance-diagram:\n\n.. _APE 7: https://github.com/astropy/astropy-APEs/blob/main/APE7.rst\n"},{"col":4,"comment":"null","endLoc":210,"header":"def __init__(self, fileobj=None, mode=None, memmap=None, overwrite=False,\n                 cache=True)","id":209,"name":"__init__","nodeType":"Function","startLoc":107,"text":"def __init__(self, fileobj=None, mode=None, memmap=None, overwrite=False,\n                 cache=True):\n        self.strict_memmap = bool(memmap)\n        memmap = True if memmap is None else memmap\n\n        self._file = None\n        self.closed = False\n        self.binary = True\n        self.mode = mode\n        self.memmap = memmap\n        self.compression = None\n        self.readonly = False\n        self.writeonly = False\n\n        # Should the object be closed on error: see\n        # https://github.com/astropy/astropy/issues/6168\n        self.close_on_error = False\n\n        # Holds mmap instance for files that use mmap\n        self._mmap = None\n\n        if fileobj is None:\n            self.simulateonly = True\n            return\n        else:\n            self.simulateonly = False\n            if isinstance(fileobj, os.PathLike):\n                fileobj = os.fspath(fileobj)\n\n        if mode is not None and mode not in IO_FITS_MODES:\n            raise ValueError(f\"Mode '{mode}' not recognized\")\n        if isfile(fileobj):\n            objmode = _normalize_fits_mode(fileobj_mode(fileobj))\n            if mode is not None and mode != objmode:\n                raise ValueError(\n                    \"Requested FITS mode '{}' not compatible with open file \"\n                    \"handle mode '{}'\".format(mode, objmode))\n            mode = objmode\n        if mode is None:\n            mode = 'readonly'\n\n        # Handle raw URLs\n        if (isinstance(fileobj, (str, bytes)) and\n                mode not in ('ostream', 'append', 'update') and _is_url(fileobj)):\n            self.name = download_file(fileobj, cache=cache)\n        # Handle responses from URL requests that have already been opened\n        elif isinstance(fileobj, http.client.HTTPResponse):\n            if mode in ('ostream', 'append', 'update'):\n                raise ValueError(\n                    f\"Mode {mode} not supported for HTTPResponse\")\n            fileobj = io.BytesIO(fileobj.read())\n        else:\n            self.name = fileobj_name(fileobj)\n\n        self.mode = mode\n\n        # Underlying fileobj is a file-like object, but an actual file object\n        self.file_like = False\n\n        # Initialize the internal self._file object\n        if isfile(fileobj):\n            self._open_fileobj(fileobj, mode, overwrite)\n        elif isinstance(fileobj, (str, bytes)):\n            self._open_filename(fileobj, mode, overwrite)\n        else:\n            self._open_filelike(fileobj, mode, overwrite)\n\n        self.fileobj_mode = fileobj_mode(self._file)\n\n        if isinstance(fileobj, gzip.GzipFile):\n            self.compression = 'gzip'\n        elif isinstance(fileobj, zipfile.ZipFile):\n            # Reading from zip files is supported but not writing (yet)\n            self.compression = 'zip'\n        elif _is_bz2file(fileobj):\n            self.compression = 'bzip2'\n\n        if (mode in ('readonly', 'copyonwrite', 'denywrite') or\n                (self.compression and mode == 'update')):\n            self.readonly = True\n        elif (mode == 'ostream' or\n                (self.compression and mode == 'append')):\n            self.writeonly = True\n\n        # For 'ab+' mode, the pointer is at the end after the open in\n        # Linux, but is at the beginning in Solaris.\n        if (mode == 'ostream' or self.compression or\n                not hasattr(self._file, 'seek')):\n            # For output stream start with a truncated file.\n            # For compressed files we can't really guess at the size\n            self.size = 0\n        else:\n            pos = self._file.tell()\n            self._file.seek(0, 2)\n            self.size = self._file.tell()\n            self._file.seek(pos)\n\n        if self.memmap:\n            if not isfile(self._file):\n                self.memmap = False\n            elif not self.readonly and not self._mmap_available:\n                # Test mmap.flush--see\n                # https://github.com/astropy/astropy/issues/968\n                self.memmap = False"},{"id":210,"name":"bitmask.rst","nodeType":"TextFile","path":"docs/nddata","text":".. _bitmask_details:\n\n********************************************************\nUtility Functions for Handling Bit Masks and Mask Arrays\n********************************************************\n\nIt is common to use `bit fields <https://en.wikipedia.org/wiki/Bit_field>`_,\nsuch as integer variables whose individual bits represent some attributes, to\ncharacterize the state of data. For example, Hubble Space Telescope (HST) uses\narrays of bit fields to characterize data quality (DQ) of HST images. See, for\nexample, DQ field values for `WFPC2 image data (see Table 3.3) <https://www.stsci.edu/files/live/sites/www/files/home/hst/instrumentation/legacy/wfpc2/_documents/wfpc2_dhb.pdf>`_ and `WFC3 image data (see Table 3.3) <https://hst-docs.stsci.edu/wfc3dhb/chapter-3-wfc3-data-calibration/3-3-ir-data-calibration-steps#id-3.3IRDataCalibrationSteps-3.3.1DataQualityInitialization>`_.\nAs you can see, the meaning assigned to various *bit flags* for the two\ninstruments is generally different.\n\nBit fields can be thought of as tightly packed collections of bit flags. Using\n`masking <https://en.wikipedia.org/wiki/Mask_(computing)>`_ we can \"inspect\"\nthe status of individual bits.\n\nOne common operation performed on bit field arrays is their conversion to\nboolean masks, for example, by assigning boolean `True` (in the boolean\nmask) to those elements that correspond to non-zero-valued bit fields\n(bit fields with at least one bit set to ``1``) or, oftentimes, by assigning\n`True` to elements whose corresponding bit fields have only *specific fields*\nset (to ``1``). This more sophisticated analysis of bit fields can be\naccomplished using *bit masks* and the aforementioned masking operation.\n\nThe `~astropy.nddata.bitmask` module provides two functions that facilitate\nconversion of bit field arrays (i.e., DQ arrays) to boolean masks:\n`~astropy.nddata.bitmask.bitfield_to_boolean_mask` converts an input bit\nfield array to a boolean mask using an input bit mask (or list of individual\nbit flags) and `~astropy.nddata.bitmask.interpret_bit_flags` creates a bit mask\nfrom an input list of individual bit flags.\n\nCreating Boolean Masks\n**********************\n\nOverview\n========\n\n`~astropy.nddata.bitmask.bitfield_to_boolean_mask` by default assumes that\nall input bit fields that have at least one bit turned \"ON\" corresponds to\n\"bad\" data (i.e., pixels) and converts them to boolean `True` in the output\nboolean mask (otherwise output boolean mask values are set to `False`).\n\nOften, for specific algorithms and situations, some bit flags are okay and\ncan be ignored. `~astropy.nddata.bitmask.bitfield_to_boolean_mask` accepts\nlists of bit flags that *by default must be ignored* in the input bit fields\nwhen creating boolean masks.\n\nFundamentally, *by default*, `~astropy.nddata.bitmask.bitfield_to_boolean_mask`\nperforms the following operation:\n\n.. _main_eq:\n\n``(1)    boolean_mask = (bitfield & ~bit_mask) != 0``\n\n(Here ``&`` is bitwise ``and`` while ``~`` is the bitwise ``not``\noperation.) In the previous formula, ``bit_mask`` is a bit mask created from\nindividual bit flags that need to be ignored in the bit field.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Creating Boolean Masks from Bit Field Arrays\n\n.. _table1:\n\n.. table:: Table 1: Examples of Boolean Mask Computations \\\n           (default parameters and 8-bit data type)\n\n    +--------------+--------------+--------------+--------------+------------+\n    | Bit Field    |  Bit Mask    | ~(Bit Mask)  | Bit Field &  |Boolean Mask|\n    |              |              |              | ~(Bit Mask)  |            |\n    +==============+==============+==============+==============+============+\n    |11011001 (217)|01010000 (80) |10101111 (175)|10001001 (137)|   True     |\n    +--------------+--------------+--------------+--------------+------------+\n    |11011001 (217)|10101111 (175)|01010000 (80) |01010000 (80) |   True     |\n    +--------------+--------------+--------------+--------------+------------+\n    |00001001 (9)  |01001001 (73) |10110110 (182)|00000000 (0)  |   False    |\n    +--------------+--------------+--------------+--------------+------------+\n    |00001001 (9)  |00000000 (0)  |11111111 (255)|00001001 (9)  |   True     |\n    +--------------+--------------+--------------+--------------+------------+\n    |00001001 (9)  |11111111 (255)|00000000 (0)  |00000000 (0)  |   False    |\n    +--------------+--------------+--------------+--------------+------------+\n\n..\n  EXAMPLE END\n\nSpecifying Bit Flags\n====================\n\n`~astropy.nddata.bitmask.bitfield_to_boolean_mask` accepts either an integer\nbit mask or lists of bit flags. Lists of bit flags will be combined into a\nbit mask and can be provided either as a Python list of\n**integer bit flag values** or as a comma-separated (or ``+``-separated)\nlist of integer bit flag values. Consider the bit mask from the first example\nin `Table 1 <table1_>`_. In this case ``ignore_flags`` can be set either to:\n\n    - An integer value bit mask 80\n    - A Python list indicating individual non-zero\n      *bit flag values:* ``[16, 64]``\n    - A string of comma-separated *bit flag values or mnemonic names*: ``'16,64'``, ``'CR,WARM'``\n    - A string of ``+``-separated *bit flag values or mnemonic names*: ``'16+64'``, ``'CR+WARM'``\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Specifying Bit Flags in NDData\n\nTo specify bit flags:\n\n    >>> from astropy.nddata import bitmask\n    >>> import numpy as np\n    >>> bitmask.bitfield_to_boolean_mask(217, ignore_flags=80)\n    array(True...)\n    >>> bitmask.bitfield_to_boolean_mask(217, ignore_flags='16,64')\n    array(True...)\n    >>> bitmask.bitfield_to_boolean_mask(217, ignore_flags=[16, 64])\n    array(True...)\n    >>> bitmask.bitfield_to_boolean_mask(9, ignore_flags=[1, 8, 64])\n    array(False...)\n    >>> bitmask.bitfield_to_boolean_mask([9, 10, 73, 217], ignore_flags='1,8,64')\n    array([False,  True, False,  True]...)\n\nIt is also possible to specify the type of the output mask:\n\n    >>> bitmask.bitfield_to_boolean_mask([9, 10, 73, 217], ignore_flags='1,8,64', dtype=np.uint8)\n    array([0, 1, 0, 1], dtype=uint8)\n\nIn order to use lists of mnemonic bit flags names, one must provide a map,\na subclass of `~astropy.nddata.bitmask.BitFlagNameMap`, that can be\nused to map mnemonic names to bit flag values. Normally these maps should be\nprovided by a third-party package supporting a specific instrument. Each bit\nflag in the map may also contain a string comment following the flag value.\nIn the example below we define a simple mask map:\n\n    >>> from astropy.nddata.bitmask import BitFlagNameMap\n    >>> class ST_DQ(BitFlagNameMap):\n    ...     CR = 1\n    ...     CLOUDY = 4\n    ...     RAINY = 8, 'Dome closed'\n    ...     HOT = 32\n    ...     DEAD = 64\n    >>> bitmask.bitfield_to_boolean_mask([9, 10, 73, 217], ignore_flags='CR,RAINY,DEAD',\n    ...                                  dtype=np.uint8, flag_name_map=ST_DQ)\n    array([0, 1, 0, 1], dtype=uint8)\n\n..\n  EXAMPLE END\n\nUsing Bit Flags Name Maps\n=========================\n\n..\n  EXAMPLE START\n\nIn order to allow the use of mnemonic bit flag names to describe the flags\nto be taken into consideration or ignored when creating a *boolean* mask, we\nuse bit flag name maps. These maps perform case-insensitive translation of\nmnemonic bit flag names to the corresponding integer value.\n\nBit flag name maps are subclasses of `~astropy.nddata.bitmask.BitFlagNameMap`\nand can be constructed in two ways, either by directly subclassing\n`~astropy.nddata.bitmask.BitFlagNameMap`, e.g.,\n\n    >>> from astropy.nddata.bitmask import BitFlagNameMap\n    >>> class ST_DQ(BitFlagNameMap):\n    ...     CR = 1\n    ...     CLOUDY = 4\n    ...     RAINY = 8\n    ...\n    >>> class ST_CAM1_DQ(ST_DQ):\n    ...     HOT = 16\n    ...     DEAD = 32\n\nor by using the `~astropy.nddata.bitmask.extend_bit_flag_map` class factory:\n\n    >>> from astropy.nddata.bitmask import extend_bit_flag_map\n    >>> ST_DQ = extend_bit_flag_map('ST_DQ', CR=1, CLOUDY=4, RAINY=8)\n    >>> ST_CAM1_DQ = extend_bit_flag_map('ST_CAM1_DQ', ST_DQ, HOT=16, DEAD=32)\n\n.. note::\n\n    Bit flag values must be integer numbers that are powers of 2.\n\nOnce constructed, bit flag values of a map cannot be modified, deleted, or\nadded. Adding flags to a map is allowed only through subclassing using one of\nthe two methods shown above or by adding lists of tuples of\nthe form ``('NAME', value)`` to the class. This will create a new map class\nsubclassed from the original map but containing the additional flags\n\n    >>> ST_CAM1_DQ = ST_DQ + [('HOT', 16), ('DEAD', 32)]\n\nwould result in an equivalent map as in the subclassing or class factory\nexamples shown above.\n\nOnce a bit flag name map was created, the bit flag values can be accessed\neither as *case-insensitive* class attributes or keys in a dictionary:\n\n    >>> ST_CAM1_DQ.cloudy\n    4\n    >>> ST_CAM1_DQ['Rainy']\n    8\n\n..\n  EXAMPLE END\n\nModifying the Formula for Creating Boolean Masks\n================================================\n\n`~astropy.nddata.bitmask.bitfield_to_boolean_mask` provides several parameters\nthat can be used to modify the formula used to create boolean masks.\n\nInverting Bit Masks\n-------------------\n\nSometimes it is more convenient to be able to specify those bit\nflags that *must be considered* when creating the boolean mask, and all other\nflags should be ignored.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Inverting Bit Masks in NDData\n\nIn `~astropy.nddata.bitmask.bitfield_to_boolean_mask` specifying bit flags that\nmust be considered when creating the boolean mask can be accomplished by\nsetting the parameter ``flip_bits`` to `True`. This effectively modifies\n`equation (1) <main_eq_>`_ to:\n\n.. _modif_eq2:\n\n``(2)    boolean_mask = (bitfield & bit_mask) != 0``\n\nSo, instead of:\n\n    >>> bitmask.bitfield_to_boolean_mask([9, 10, 73, 217], ignore_flags=[1, 8, 64])\n    array([False,  True, False,  True]...)\n\nYou can obtain the same result as:\n\n    >>> bitmask.bitfield_to_boolean_mask(\n    ...     [9, 10, 73, 217], ignore_flags=[2, 4, 16, 32, 128], flip_bits=True\n    ... )\n    array([False,  True, False,  True]...)\n\nNote however, when ``ignore_flags`` is a comma-separated list of bit flag\nvalues, ``flip_bits`` cannot be set to either `True` or `False`. Instead,\nto flip bits of the bit mask formed from a string list of comma-separated\nbit flag values, you can prepend a single ``~`` to the list:\n\n    >>> bitmask.bitfield_to_boolean_mask([9, 10, 73, 217], ignore_flags='~2+4+16+32+128')\n    array([False,  True, False,  True]...)\n\n..\n  EXAMPLE END\n\nInverting Boolean Masks\n-----------------------\n\nOther times, it may be more convenient to obtain an inverted mask in which\nflagged data are converted to `False` instead of `True`:\n\n.. _modif_eq3:\n\n``(3)    boolean_mask = (bitfield & ~bit_mask) == 0``\n\nThis can be accomplished by changing the ``good_mask_value`` parameter from\nits default value (`False`) to `True`.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Inverting Boolean Masks in NDData\n\nTo obtain an inverted mask in which flagged data are converted to `False`\ninstead of `True`:\n\n    >>> bitmask.bitfield_to_boolean_mask([9, 10, 73, 217], ignore_flags=[1, 8, 64],\n    ...                                  good_mask_value=True)\n    array([ True, False,  True, False]...)\n\n..\n  EXAMPLE END\n"},{"id":211,"name":"performance.inc.rst","nodeType":"TextFile","path":"docs/nddata","text":".. note that if this is changed from the default approach of using an *include*\n   (in index.rst) to a separate performance page, the header needs to be changed\n   from === to ***, the filename extension needs to be changed from .inc.rst to\n   .rst, and a link needs to be added in the subpackage toctree\n\n.. _astropy-nddata-performance:\n\nPerformance Tips\n================\n\n+ Using the uncertainty class `~astropy.nddata.VarianceUncertainty` will\n  be somewhat more efficient than the other two uncertainty classes,\n  `~astropy.nddata.InverseVariance` and `~astropy.nddata.StdDevUncertainty`.\n  The latter two are converted to variance for the purposes of error\n  propagation and then converted from variance back to the original\n  uncertainty type. The performance difference should be small.\n+ When possible, mask values by setting them to ``np.nan`` and use the\n  ``numpy`` functions and methods that automatically exclude ``np.nan``,\n  like ``np.nanmedian`` and ``np.nanstd``. This will typically be much\n  faster than using `numpy.ma.MaskedArray`.\n"},{"id":212,"name":"subclassing.rst","nodeType":"TextFile","path":"docs/nddata","text":".. _nddata_subclassing:\n\nSubclassing\n***********\n\n`~astropy.nddata.NDData`\n========================\n\nThis class serves as the base for subclasses that use a `numpy.ndarray` (or\nsomething that presents a ``numpy``-like interface) as the ``data`` attribute.\n\n.. note::\n  Each attribute is saved as an attribute with one leading underscore. For\n  example, the ``data`` is saved as ``_data`` and the ``mask`` as ``_mask``,\n  and so on.\n\nAdding Another Property\n-----------------------\n\n    >>> from astropy.nddata import NDData\n\n    >>> class NDDataWithFlags(NDData):\n    ...     def __init__(self, *args, **kwargs):\n    ...         # Remove flags attribute if given and pass it to the setter.\n    ...         self.flags = kwargs.pop('flags') if 'flags' in kwargs else None\n    ...         super().__init__(*args, **kwargs)\n    ...\n    ...     @property\n    ...     def flags(self):\n    ...         return self._flags\n    ...\n    ...     @flags.setter\n    ...     def flags(self, value):\n    ...         self._flags = value\n\n    >>> ndd = NDDataWithFlags([1,2,3])\n    >>> ndd.flags is None\n    True\n\n    >>> ndd = NDDataWithFlags([1,2,3], flags=[0, 0.2, 0.3])\n    >>> ndd.flags\n    [0, 0.2, 0.3]\n\n.. note::\n  To simplify subclassing, each setter (except for ``data``) is called during\n  ``__init__`` so putting restrictions on any attribute can be done inside\n  the setter and will also apply during instance creation.\n\nCustomize the Setter for a Property\n-----------------------------------\n\n    >>> import numpy as np\n\n    >>> class NDDataMaskBoolNumpy(NDData):\n    ...\n    ...     @NDData.mask.setter\n    ...     def mask(self, value):\n    ...         # Convert mask to boolean numpy array.\n    ...         self._mask = np.array(value, dtype=np.bool_)\n\n    >>> ndd = NDDataMaskBoolNumpy([1,2,3])\n    >>> ndd.mask = [True, False, True]\n    >>> ndd.mask\n    array([ True, False,  True]...)\n\nExtend the Setter for a Property\n--------------------------------\n\n``unit``, ``meta``, and ``uncertainty`` implement some additional logic in their\nsetter so subclasses might define a call to the superclass and let the\nsuper property set the attribute afterwards::\n\n    >>> import numpy as np\n\n    >>> class NDDataUncertaintyShapeChecker(NDData):\n    ...\n    ...     @NDData.uncertainty.setter\n    ...     def uncertainty(self, value):\n    ...         value = np.asarray(value)\n    ...         if value.shape != self.data.shape:\n    ...             raise ValueError('uncertainty must have the same shape as the data.')\n    ...         # Call the setter of the super class in case it might contain some\n    ...         # important logic (only True for meta, unit and uncertainty)\n    ...         super(NDDataUncertaintyShapeChecker, self.__class__).uncertainty.fset(self, value)\n    ...         # Unlike \"super(cls_name, cls_name).uncertainty.fset\" or\n    ...         # or \"NDData.uncertainty.fset\" this will respect Pythons method\n    ...         # resolution order.\n\n    >>> ndd = NDDataUncertaintyShapeChecker([1,2,3], uncertainty=[2,3,4])\n    INFO: uncertainty should have attribute uncertainty_type. [astropy.nddata.nddata]\n    >>> ndd.uncertainty\n    UnknownUncertainty([2, 3, 4])\n\nHaving a Setter for the Data\n----------------------------\n\n    >>> class NDDataWithDataSetter(NDData):\n    ...\n    ...     @NDData.data.setter\n    ...     def data(self, value):\n    ...         self._data = np.asarray(value)\n\n    >>> ndd = NDDataWithDataSetter([1,2,3])\n    >>> ndd.data = [3,2,1]\n    >>> ndd.data\n    array([3, 2, 1])\n\n.. _NDDataRef:\n\n`~astropy.nddata.NDDataRef`\n===========================\n\n`~astropy.nddata.NDDataRef` itself inherits from `~astropy.nddata.NDData` so\nany of the possibilities there also apply to NDDataRef. But NDDataRef also\ninherits from the Mixins:\n\n- `~astropy.nddata.NDSlicingMixin`\n- `~astropy.nddata.NDArithmeticMixin`\n- `~astropy.nddata.NDIOMixin`\n\nWhich allow additional operations.\n\nAdd Another Arithmetic Operation\n--------------------------------\n\nAdding another operation is possible provided the ``data`` and ``unit`` allow\nit within the framework of `~astropy.units.Quantity`.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Adding Operations When Working with NDDataRef\n\nTo add a power function::\n\n    >>> from astropy.nddata import NDDataRef\n    >>> import numpy as np\n    >>> from astropy.utils import sharedmethod\n\n    >>> class NDDataPower(NDDataRef):\n    ...     @sharedmethod # sharedmethod to allow it also as classmethod\n    ...     def pow(self, operand, operand2=None, **kwargs):\n    ...         # the uncertainty doesn't allow propagation so set it to None\n    ...         kwargs['propagate_uncertainties'] = None\n    ...         # Call the _prepare_then_do_arithmetic function with the\n    ...         # numpy.power ufunc.\n    ...         return self._prepare_then_do_arithmetic(np.power, operand,\n    ...                                                 operand2, **kwargs)\n\nThis can be used like the other arithmetic methods similar to\n:meth:`~astropy.nddata.NDArithmeticMixin.add`. So it works when calling it\non the class or the instance::\n\n    >>> ndd = NDDataPower([1,2,3])\n\n    >>> # using it on the instance with one operand\n    >>> ndd.pow(3)\n    NDDataPower([ 1,  8, 27])\n\n    >>> # using it on the instance with two operands\n    >>> ndd.pow([1,2,3], [3,4,5])\n    NDDataPower([  1,  16, 243])\n\n    >>> # or using it as classmethod\n    >>> NDDataPower.pow(6, [1,2,3])\n    NDDataPower([  6,  36, 216])\n\nTo allow propagation also with ``uncertainty`` see subclassing\n`~astropy.nddata.NDUncertainty`.\n\n..\n  EXAMPLE END\n\nThe ``_prepare_then_do_arithmetic`` implements the relevant checks if it was\ncalled on the class or the instance, and if one or two operands were given,\nconverts the operands, if necessary, to the appropriate classes. Overriding\n``_prepare_then_do_arithmetic`` in subclasses should be avoided if\npossible.\n\nArithmetic on an Existing Property\n----------------------------------\n\nCustomizing how an existing property is handled during arithmetic is possible\nwith some arguments to the function calls such as\n:meth:`~astropy.nddata.NDArithmeticMixin.add`, but it is possible to hardcode\nbehavior too. The actual operation on the attribute (except for ``unit``) is\ndone in a method ``_arithmetic_*`` where ``*`` is the name of the property.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Customizing Existing Properties During Arithmetic in NDData\n\nTo customize how the ``meta`` will be affected during arithmetics::\n\n    >>> from astropy.nddata import NDDataRef\n\n    >>> from copy import deepcopy\n    >>> class NDDataWithMetaArithmetics(NDDataRef):\n    ...\n    ...     def _arithmetic_meta(self, operation, operand, handle_mask, **kwds):\n    ...         # the function must take the arguments:\n    ...         # operation (numpy-ufunc like np.add, np.subtract, ...)\n    ...         # operand (the other NDData-like object, already wrapped as NDData)\n    ...         # handle_mask (see description for \"add\")\n    ...\n    ...         # The meta is dict like but we want the keywords exposure to change\n    ...         # Anticipate that one or both might have no meta and take the first one that has\n    ...         result_meta = deepcopy(self.meta) if self.meta else deepcopy(operand.meta)\n    ...         # Do the operation on the keyword if the keyword exists\n    ...         if result_meta and 'exposure' in result_meta:\n    ...             result_meta['exposure'] = operation(result_meta['exposure'], operand.data)\n    ...         return result_meta # return it\n\nTo trigger this method, the ``handle_meta`` argument to arithmetic methods can\nbe anything except ``None`` or ``\"first_found\"``::\n\n    >>> ndd = NDDataWithMetaArithmetics([1,2,3], meta={'exposure': 10})\n    >>> ndd2 = ndd.add(10, handle_meta='')\n    >>> ndd2.meta\n    {'exposure': 20}\n\n    >>> ndd3 = ndd.multiply(0.5, handle_meta='')\n    >>> ndd3.meta\n    {'exposure': 5.0}\n\n.. warning::\n  To use these internal `_arithmetic_*` methods there are some restrictions on\n  the attributes when calling the operation:\n\n  - ``mask``: ``handle_mask`` must not be ``None``, ``\"ff\"``, or\n    ``\"first_found\"``.\n  - ``wcs``: ``compare_wcs`` argument with the same restrictions as mask.\n  - ``meta``: ``handle_meta`` argument with the same restrictions as mask.\n  - ``uncertainty``: ``propagate_uncertainties`` must be ``None`` or evaluate\n    to ``False``. ``arithmetic_uncertainty`` must also accept different\n    arguments: ``operation``, ``operand``, ``result``, ``correlation``,\n    ``**kwargs``.\n\n..\n  EXAMPLE END\n\nChanging the Default Argument for Arithmetic Operations\n-------------------------------------------------------\n\nIf the goal is to change the default value of an existing parameter for\narithmetic methods, such as when explicitly specifying the parameter each\ntime you call an arithmetic operation is too much effort, you can change the\ndefault value of existing parameters by changing it in the method signature of\n``_arithmetic``.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Changing the Default Argument for Arithmetic Operations in NDData\n\nTo change the default value of an existing parameter for arithmetic methods::\n\n    >>> from astropy.nddata import NDDataRef\n    >>> import numpy as np\n\n    >>> class NDDDiffAritDefaults(NDDataRef):\n    ...     def _arithmetic(self, *args, **kwargs):\n    ...         # Changing the default of handle_mask to None\n    ...         if 'handle_mask' not in kwargs:\n    ...             kwargs['handle_mask'] = None\n    ...         # Call the original with the updated kwargs\n    ...         return super()._arithmetic(*args, **kwargs)\n\n    >>> ndd1 = NDDDiffAritDefaults(1, mask=False)\n    >>> ndd2 = NDDDiffAritDefaults(1, mask=True)\n    >>> ndd1.add(ndd2).mask is None  # it will be None\n    True\n\n    >>> # But giving other values is still possible:\n    >>> ndd1.add(ndd2, handle_mask=np.logical_or).mask\n    True\n\n    >>> ndd1.add(ndd2, handle_mask=\"ff\").mask\n    False\n\nThe parameter controlling how properties are handled are all keyword-only\nso using the ``*args``, ``**kwargs`` approach allows you to only alter one\ndefault without needing to care about the positional order of arguments.\n\n..\n  EXAMPLE END\n\nArithmetic with an Additional Property\n--------------------------------------\n\nThis also requires overriding the ``_arithmetic`` method. Suppose we have a\n``flags`` attribute again::\n\n    >>> from copy import deepcopy\n    >>> import numpy as np\n\n    >>> class NDDataWithFlags(NDDataRef):\n    ...     def __init__(self, *args, **kwargs):\n    ...         # Remove flags attribute if given and pass it to the setter.\n    ...         self.flags = kwargs.pop('flags') if 'flags' in kwargs else None\n    ...         super().__init__(*args, **kwargs)\n    ...\n    ...     @property\n    ...     def flags(self):\n    ...         return self._flags\n    ...\n    ...     @flags.setter\n    ...     def flags(self, value):\n    ...         self._flags = value\n    ...\n    ...     def _arithmetic(self, operation, operand, *args, **kwargs):\n    ...         # take all args and kwargs to allow arithmetic on the other properties\n    ...         # to work like before.\n    ...\n    ...         # do the arithmetics on the flags (pop the relevant kwargs, if any!!!)\n    ...         if self.flags is not None and operand.flags is not None:\n    ...             result_flags = np.logical_or(self.flags, operand.flags)\n    ...             # np.logical_or is just a suggestion you can do what you want\n    ...         else:\n    ...             if self.flags is not None:\n    ...                 result_flags = deepcopy(self.flags)\n    ...             else:\n    ...                 result_flags = deepcopy(operand.flags)\n    ...\n    ...         # Let the superclass do all the other attributes note that\n    ...         # this returns the result and a dictionary containing other attributes\n    ...         result, kwargs = super()._arithmetic(operation, operand, *args, **kwargs)\n    ...         # The arguments for creating a new instance are saved in kwargs\n    ...         # so we need to add another keyword \"flags\" and add the processed flags\n    ...         kwargs['flags'] = result_flags\n    ...         return result, kwargs # these must be returned\n\n    >>> ndd1 = NDDataWithFlags([1,2,3], flags=np.array([1,0,1], dtype=bool))\n    >>> ndd2 = NDDataWithFlags([1,2,3], flags=np.array([0,0,1], dtype=bool))\n    >>> ndd3 = ndd1.add(ndd2)\n    >>> ndd3.flags\n    array([ True, False,  True]...)\n\nSlicing an Existing Property\n----------------------------\n\nSuppose you have a class expecting a 2D ``data`` but the mask is\nonly 1D. This would lead to problems if you were to slice in two dimensions.\n\n    >>> from astropy.nddata import NDDataRef\n    >>> import numpy as np\n\n    >>> class NDDataMask1D(NDDataRef):\n    ...     def _slice_mask(self, item):\n    ...         # Multidimensional slices are represented by tuples:\n    ...         if isinstance(item, tuple):\n    ...             # only use the first dimension of the slice\n    ...             return self.mask[item[0]]\n    ...         # Let the superclass deal with the other cases\n    ...         return super()._slice_mask(item)\n\n    >>> ndd = NDDataMask1D(np.ones((3,3)), mask=np.ones(3, dtype=bool))\n    >>> nddsliced = ndd[1:3,1:3]\n    >>> nddsliced.mask\n    array([ True,  True]...)\n\n.. note::\n  The methods slicing the attributes are prefixed by a ``_slice_*`` where ``*``\n  can be ``mask``, ``uncertainty``, or ``wcs``. So overriding them is the\n  most convenient way to customize how the attributes are sliced.\n\n.. note::\n  If slicing should affect the ``unit`` or ``meta`` see the next example.\n\n\nSlicing an Additional Property\n------------------------------\n\nBuilding on the added property ``flags``, we want them to be sliceable:\n\n    >>> class NDDataWithFlags(NDDataRef):\n    ...     def __init__(self, *args, **kwargs):\n    ...         # Remove flags attribute if given and pass it to the setter.\n    ...         self.flags = kwargs.pop('flags') if 'flags' in kwargs else None\n    ...         super().__init__(*args, **kwargs)\n    ...\n    ...     @property\n    ...     def flags(self):\n    ...         return self._flags\n    ...\n    ...     @flags.setter\n    ...     def flags(self, value):\n    ...         self._flags = value\n    ...\n    ...     def _slice(self, item):\n    ...         # slice all normal attributes\n    ...         kwargs = super()._slice(item)\n    ...         # The arguments for creating a new instance are saved in kwargs\n    ...         # so we need to add another keyword \"flags\" and add the sliced flags\n    ...         kwargs['flags'] = self.flags[item]\n    ...         return kwargs # these must be returned\n\n    >>> ndd = NDDataWithFlags([1,2,3], flags=[0, 0.2, 0.3])\n    >>> ndd2 = ndd[1:3]\n    >>> ndd2.flags\n    [0.2, 0.3]\n\nIf you wanted to keep just the original ``flags`` instead of the sliced ones,\nyou could use ``kwargs['flags'] = self.flags`` and omit the ``[item]``.\n\n`~astropy.nddata.NDDataBase`\n============================\n\nThe class `~astropy.nddata.NDDataBase` is a metaclass — when subclassing it,\nall properties of `~astropy.nddata.NDDataBase` *must* be overridden in the\nsubclass.\n\nSubclassing from `~astropy.nddata.NDDataBase` gives you complete flexibility\nin how you implement data storage and the other properties. If your data is\nstored in a ``numpy`` array (or something that behaves like a ``numpy`` array),\nit may be more convenient to subclass `~astropy.nddata.NDData` instead of\n`~astropy.nddata.NDDataBase`.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Implementing the NDDataBase Interface\n\nTo implement the NDDataBase interface by creating a read-only container::\n\n    >>> from astropy.nddata import NDDataBase\n\n    >>> class NDDataReadOnlyNoRestrictions(NDDataBase):\n    ...     def __init__(self, data, unit, mask, uncertainty, meta, wcs):\n    ...         self._data = data\n    ...         self._unit = unit\n    ...         self._mask = mask\n    ...         self._uncertainty = uncertainty\n    ...         self._meta = meta\n    ...         self._wcs = wcs\n    ...\n    ...     @property\n    ...     def data(self):\n    ...         return self._data\n    ...\n    ...     @property\n    ...     def unit(self):\n    ...         return self._unit\n    ...\n    ...     @property\n    ...     def mask(self):\n    ...         return self._mask\n    ...\n    ...     @property\n    ...     def uncertainty(self):\n    ...         return self._uncertainty\n    ...\n    ...     @property\n    ...     def meta(self):\n    ...         return self._meta\n    ...\n    ...     @property\n    ...     def wcs(self):\n    ...         return self._wcs\n\n    >>> # A meaningless test to show that creating this class is possible:\n    >>> NDDataReadOnlyNoRestrictions(1,2,3,4,5,6) is not None\n    True\n\n.. note::\n  Actually defining an ``__init__`` is not necessary and the properties could\n  return arbitrary values but the properties **must** be defined.\n\n..\n  EXAMPLE END\n\nSubclassing `~astropy.nddata.NDUncertainty`\n===========================================\n\n.. warning::\n    The internal interface of NDUncertainty and subclasses is experimental and\n    might change in future versions.\n\nSubclasses deriving from `~astropy.nddata.NDUncertainty` need in order to\nimplement:\n\n- Property ``uncertainty_type`` should return a string describing the\n  uncertainty, for example, ``\"ivar\"`` for inverse variance.\n- Methods for propagation: `_propagate_*` where ``*`` is the name of the\n  universal function (ufunc) that is used on the ``NDData`` parent.\n\nCreating an Uncertainty without Propagation\n-------------------------------------------\n\n`~astropy.nddata.UnknownUncertainty` is a minimal working implementation\nwithout error propagation. We can create an uncertainty by storing\nsystematic uncertainties::\n\n    >>> from astropy.nddata import NDUncertainty\n\n    >>> class SystematicUncertainty(NDUncertainty):\n    ...     @property\n    ...     def uncertainty_type(self):\n    ...         return 'systematic'\n    ...\n    ...     def _data_unit_to_uncertainty_unit(self, value):\n    ...         return None\n    ...\n    ...     def _propagate_add(self, other_uncert, *args, **kwargs):\n    ...         return None\n    ...\n    ...     def _propagate_subtract(self, other_uncert, *args, **kwargs):\n    ...         return None\n    ...\n    ...     def _propagate_multiply(self, other_uncert, *args, **kwargs):\n    ...         return None\n    ...\n    ...     def _propagate_divide(self, other_uncert, *args, **kwargs):\n    ...         return None\n\n    >>> SystematicUncertainty([10])\n    SystematicUncertainty([10])\n"},{"id":213,"name":"decorator.rst","nodeType":"TextFile","path":"docs/nddata","text":"*********************************************\nDecorating Functions to Accept NDData Objects\n*********************************************\n\nThe `astropy.nddata` module includes a decorator\n:func:`~astropy.nddata.support_nddata` that makes it convenient for developers\nand users to write functions that can accept :class:`~astropy.nddata.NDData`\nobjects and also separate arguments.\n\nConsider the following function::\n\n    def test(data, wcs=None, unit=None, n_iterations=3):\n        ...\n\nNow say that we want to be able to call the function as ``test(nd)``\nwhere ``nd`` is an :class:`~astropy.nddata.NDData` instance. We can decorate\nthis function using :func:`~astropy.nddata.support_nddata`::\n\n    from astropy.nddata import support_nddata\n\n    @support_nddata\n    def test(data, wcs=None, unit=None, n_iterations=3):\n        ...\n\nWhich makes it so that when the user calls ``test(nd)``, the function would\nautomatically be called with::\n\n    test(nd.data, wcs=nd.wcs, unit=nd.unit)\n\nThe decorator looks at the signature of the function and checks if any\nof the arguments are also properties of the ``NDData`` object, and passes them\nas individual arguments. The function can also be called with separate\narguments as if it was not decorated.\n\nA warning is emitted if an ``NDData`` property is set but the function does\nnot accept it — for example, if ``wcs`` is set, but the function cannot support\nWCS objects. On the other hand, if an argument in the function does not exist\nin the ``NDData`` object or is not set, it is left to its default value.\n\nIf the function call succeeds, then the decorator returns the values from the\nfunction unmodified by default. However, in some cases we may want to return\nseparate ``data``, ``wcs``, etc. if these were passed in separately, and a new\n:class:`~astropy.nddata.NDData` instance otherwise. To do this, you can specify\n``repack=True`` in the decorator and provide a list of the names of the output\narguments from the function::\n\n    @support_nddata(repack=True, returns=['data', 'wcs'])\n    def test(data, wcs=None, unit=None, n_iterations=3):\n        ...\n\nWith this, the function will return separate values if ``test`` is called with\nseparate arguments, and an object with the same class type as the input if the\ninput is an :class:`~astropy.nddata.NDData` or subclass instance.\n\nFinally, the decorator can be made to restrict input to specific ``NDData``\nsubclasses (and the subclasses of those) using the ``accepts`` option::\n\n    @support_nddata(accepts=CCDImage)\n    def test(data, wcs=None, unit=None, n_iterations=3):\n        ...\n"},{"attributeType":"null","col":13,"comment":"null","endLoc":57,"id":214,"name":"val","nodeType":"Attribute","startLoc":57,"text":"val"},{"id":215,"name":"utils.rst","nodeType":"TextFile","path":"docs/nddata","text":".. _nddata_utils:\n\nImage Utilities\n***************\n\nOverview\n========\n\nThe `astropy.nddata.utils` module includes general utility functions\nfor array operations.\n\n.. _cutout_images:\n\n2D Cutout Images\n================\n\nGetting Started\n---------------\n\nThe `~astropy.nddata.utils.Cutout2D` class can be used to create a\npostage stamp cutout image from a 2D array. If an optional\n`~astropy.wcs.WCS` object is input to\n`~astropy.nddata.utils.Cutout2D`, then the\n`~astropy.nddata.utils.Cutout2D` object will contain an updated\n`~astropy.wcs.WCS` corresponding to the cutout array.\n\nFirst, we simulate a single source on a 2D data array. If you would like to\nsimulate many sources, see :ref:`bounding-boxes`.\n\nNote: The pair convention is different for **size** and **position**! The\nposition is specified as (x,y), but the size is specified as (y,x).\n\n    >>> import numpy as np\n    >>> from astropy.modeling.models import Gaussian2D\n    >>> y, x = np.mgrid[0:500, 0:500]\n    >>> data = Gaussian2D(1, 50, 100, 10, 5, theta=0.5)(x, y)\n\nNow, we can display the image:\n\n.. doctest-skip::\n\n    >>> import matplotlib.pyplot as plt\n    >>> plt.imshow(data, origin='lower')\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import Gaussian2D\n    y, x = np.mgrid[0:500, 0:500]\n    data = Gaussian2D(1, 50, 100, 10, 5, theta=0.5)(x, y)\n    plt.imshow(data, origin='lower')\n\nNext we can create a cutout for the single object in this image. We\ncreate a cutout centered at position ``(x, y) = (49.7, 100.1)`` with a\nsize of ``(ny, nx) = (41, 51)`` pixels::\n\n    >>> from astropy.nddata import Cutout2D\n    >>> from astropy import units as u\n    >>> position = (49.7, 100.1)\n    >>> size = (41, 51)     # pixels\n    >>> cutout = Cutout2D(data, position, size)\n\nThe ``size`` keyword can also be a `~astropy.units.Quantity` object::\n\n    >>> size = u.Quantity((41, 51), u.pixel)\n    >>> cutout = Cutout2D(data, position, size)\n\nOr contain `~astropy.units.Quantity` objects::\n\n    >>> size = (41*u.pixel, 51*u.pixel)\n    >>> cutout = Cutout2D(data, position, size)\n\nA square cutout image can be generated by passing an integer or\na scalar `~astropy.units.Quantity`::\n\n    >>> size = 41\n    >>> cutout2 = Cutout2D(data, position, size)\n\n    >>> size = 41 * u.pixel\n    >>> cutout2 = Cutout2D(data, position, size)\n\nThe cutout array is stored in the ``data`` attribute of the\n`~astropy.nddata.utils.Cutout2D` instance. If the ``copy`` keyword is\n`False` (default), then ``cutout.data`` will be a view into the\noriginal ``data`` array. If ``copy=True``, then ``cutout.data`` will\nhold a copy of the original ``data``. Now we display the cutout\nimage:\n\n.. doctest-skip::\n\n    >>> cutout = Cutout2D(data, position, (41, 51))\n    >>> plt.imshow(cutout.data, origin='lower')\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import Gaussian2D\n    from astropy.nddata import Cutout2D\n    y, x = np.mgrid[0:500, 0:500]\n    data = Gaussian2D(1, 50, 100, 10, 5, theta=0.5)(x, y)\n    position = (49.7, 100.1)\n    cutout = Cutout2D(data, position, (41, 51))\n    plt.imshow(cutout.data, origin='lower')\n\nThe cutout object can plot its bounding box on the original data using\nthe :meth:`~astropy.nddata.utils.Cutout2D.plot_on_original` method:\n\n.. doctest-skip::\n\n    >>> plt.imshow(data, origin='lower')\n    >>> cutout.plot_on_original(color='white')\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import Gaussian2D\n    from astropy.nddata import Cutout2D\n    y, x = np.mgrid[0:500, 0:500]\n    data = Gaussian2D(1, 50, 100, 10, 5, theta=0.5)(x, y)\n    position = (49.7, 100.1)\n    size = (41, 51)\n    cutout = Cutout2D(data, position, size)\n    plt.imshow(data, origin='lower')\n    cutout.plot_on_original(color='white')\n\nMany properties of the cutout array are also stored as attributes,\nincluding::\n\n    >>> # shape of the cutout array\n    >>> print(cutout.shape)\n    (41, 51)\n\n    >>> # rounded pixel index of the input position\n    >>> print(cutout.position_original)\n    (50, 100)\n\n    >>> # corresponding position in the cutout array\n    >>> print(cutout.position_cutout)\n    (25, 20)\n\n    >>> # (non-rounded) input position in both the original and cutout arrays\n    >>> print((cutout.input_position_original, cutout.input_position_cutout))  # doctest: +FLOAT_CMP\n    ((49.7, 100.1), (24.700000000000003, 20.099999999999994))\n\n    >>> # the origin pixel in both arrays\n    >>> print((cutout.origin_original, cutout.origin_cutout))\n    ((25, 80), (0, 0))\n\n    >>> # tuple of slice objects for the original array\n    >>> print(cutout.slices_original)\n    (slice(80, 121, None), slice(25, 76, None))\n\n    >>> # tuple of slice objects for the cutout array\n    >>> print(cutout.slices_cutout)\n    (slice(0, 41, None), slice(0, 51, None))\n\nThere are also two `~astropy.nddata.utils.Cutout2D` methods to convert\npixel positions between the original and cutout arrays::\n\n    >>> print(cutout.to_original_position((2, 1)))\n    (27, 81)\n\n    >>> print(cutout.to_cutout_position((27, 81)))\n    (2, 1)\n\n\n2D Cutout Modes\n---------------\n\nThere are three modes for creating cutout arrays: ``'trim'``,\n``'partial'``, and ``'strict'``. For the ``'partial'`` and ``'trim'``\nmodes, a partial overlap of the cutout array and the input ``data``\narray is sufficient. For the ``'strict'`` mode, the cutout array has\nto be fully contained within the ``data`` array, otherwise an\n`~astropy.nddata.utils.PartialOverlapError` is raised. In all modes,\nnon-overlapping arrays will raise a\n`~astropy.nddata.utils.NoOverlapError`. In ``'partial'`` mode,\npositions in the cutout array that do not overlap with the ``data``\narray will be filled with ``fill_value``. In ``'trim'`` mode only the\noverlapping elements are returned, thus the resulting cutout array may\nbe smaller than the requested ``size``.\n\nThe default uses ``mode='trim'``, which can result in cutout arrays\nthat are smaller than the requested ``size``::\n\n    >>> data2 = np.arange(20.).reshape(5, 4)\n    >>> cutout1 = Cutout2D(data2, (0, 0), (3, 3), mode='trim')\n    >>> print(cutout1.data)  # doctest: +FLOAT_CMP\n    [[0. 1.]\n     [4. 5.]]\n    >>> print(cutout1.shape)\n    (2, 2)\n    >>> print((cutout1.position_original, cutout1.position_cutout))\n    ((0, 0), (0, 0))\n\nWith ``mode='partial'``, the cutout will never be trimmed. Instead it\nwill be filled with ``fill_value`` (the default is ``numpy.nan``) if\nthe cutout is not fully contained in the data array::\n\n    >>> cutout2 = Cutout2D(data2, (0, 0), (3, 3), mode='partial')\n    >>> print(cutout2.data)  # doctest: +FLOAT_CMP\n    [[nan nan nan]\n     [nan  0.  1.]\n     [nan  4.  5.]]\n\nNote that for the ``'partial'`` mode, the positions (and several other\nattributes) are calculated for on the *valid* (non-filled) cutout\nvalues::\n\n    >>> print((cutout2.position_original, cutout2.position_cutout))\n    ((0, 0), (1, 1))\n    >>> print((cutout2.origin_original, cutout2.origin_cutout))\n    ((0, 0), (1, 1))\n    >>> print(cutout2.slices_original)\n    (slice(0, 2, None), slice(0, 2, None))\n    >>> print(cutout2.slices_cutout)\n    (slice(1, 3, None), slice(1, 3, None))\n\nUsing ``mode='strict'`` will raise an exception if the cutout is not\nfully contained in the data array:\n\n.. doctest-skip::\n\n    >>> cutout3 = Cutout2D(data2, (0, 0), (3, 3), mode='strict')\n    PartialOverlapError: Arrays overlap only partially.\n\n\n2D Cutout from a `~astropy.coordinates.SkyCoord` Position\n---------------------------------------------------------\n\nThe input ``position`` can also be specified as a\n`~astropy.coordinates.SkyCoord`, in which case a `~astropy.wcs.WCS`\nobject must be input via the ``wcs`` keyword.\n\nFirst, we define a `~astropy.coordinates.SkyCoord` position and a\n`~astropy.wcs.WCS` object for our data (usually this would come from\nyour FITS header)::\n\n    >>> from astropy.coordinates import SkyCoord\n    >>> from astropy.wcs import WCS\n    >>> position = SkyCoord('13h11m29.96s -01d19m18.7s', frame='icrs')\n    >>> wcs = WCS(naxis=2)\n    >>> rho = np.pi / 3.\n    >>> scale = 0.05 / 3600.\n    >>> wcs.wcs.cd = [[scale*np.cos(rho), -scale*np.sin(rho)],\n    ...               [scale*np.sin(rho), scale*np.cos(rho)]]\n    >>> wcs.wcs.ctype = ['RA---TAN', 'DEC--TAN']\n    >>> wcs.wcs.crval = [position.ra.to_value(u.deg),\n    ...                  position.dec.to_value(u.deg)]\n    >>> wcs.wcs.crpix = [50, 100]\n\nNow we can create the cutout array using the\n`~astropy.coordinates.SkyCoord` position and ``wcs`` object::\n\n    >>> cutout = Cutout2D(data, position, (30, 40), wcs=wcs)\n    >>> plt.imshow(cutout.data, origin='lower')   # doctest: +SKIP\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import Gaussian2D\n    from astropy.nddata import Cutout2D\n    from astropy.coordinates import SkyCoord\n    from astropy.wcs import WCS\n    y, x = np.mgrid[0:500, 0:500]\n    data = Gaussian2D(1, 50, 100, 10, 5, theta=0.5)(x, y)\n    position = SkyCoord('13h11m29.96s -01d19m18.7s', frame='icrs')\n    wcs = WCS(naxis=2)\n    rho = np.pi / 3.\n    scale = 0.05 / 3600.\n    wcs.wcs.cd = [[scale*np.cos(rho), -scale*np.sin(rho)],\n                  [scale*np.sin(rho), scale*np.cos(rho)]]\n    wcs.wcs.ctype = ['RA---TAN', 'DEC--TAN']\n    wcs.wcs.crval = [position.ra.value, position.dec.value]\n    wcs.wcs.crpix = [50, 100]\n    cutout = Cutout2D(data, position, (30, 40), wcs=wcs)\n    plt.imshow(cutout.data, origin='lower')\n\nThe ``wcs`` attribute of the `~astropy.nddata.utils.Cutout2D` object now\ncontains the propagated `~astropy.wcs.WCS` for the cutout array.\nNow we can find the sky coordinates for a given pixel in the cutout array.\nNote that we need to use the ``cutout.wcs`` object for the cutout\npositions::\n\n    >>> from astropy.wcs.utils import pixel_to_skycoord\n    >>> x_cutout, y_cutout = (5, 10)\n    >>> pixel_to_skycoord(x_cutout, y_cutout, cutout.wcs)    # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        ( 197.8747893, -1.32207626)>\n\nWe now find the corresponding pixel in the original ``data`` array and\nits sky coordinates::\n\n    >>> x_data, y_data = cutout.to_original_position((x_cutout, y_cutout))\n    >>> pixel_to_skycoord(x_data, y_data, wcs)    # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        ( 197.8747893, -1.32207626)>\n\nAs expected, the sky coordinates in the original ``data`` and the\ncutout array agree.\n\n\n2D Cutout Using an Angular ``size``\n-----------------------------------\n\nThe input ``size`` can also be specified as a\n`~astropy.units.Quantity` in angular units (e.g., degrees, arcminutes,\narcseconds, etc.). For this case, a `~astropy.wcs.WCS` object must be\ninput via the ``wcs`` keyword.\n\nFor this example, we will use the data, `~astropy.coordinates.SkyCoord`\nposition, and ``wcs`` object from above to create a cutout with size\n1.5 x 2.5 arcseconds::\n\n    >>> size = u.Quantity((1.5, 2.5), u.arcsec)\n    >>> cutout = Cutout2D(data, position, size, wcs=wcs)\n    >>> plt.imshow(cutout.data, origin='lower')   # doctest: +SKIP\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import Gaussian2D\n    from astropy.nddata import Cutout2D\n    from astropy.coordinates import SkyCoord\n    from astropy.wcs import WCS\n    from astropy import units as u\n    y, x = np.mgrid[0:500, 0:500]\n    data = Gaussian2D(1, 50, 100, 10, 5, theta=0.5)(x, y)\n    position = SkyCoord('13h11m29.96s -01d19m18.7s', frame='icrs')\n    wcs = WCS(naxis=2)\n    rho = np.pi / 3.\n    scale = 0.05 / 3600.\n    wcs.wcs.cd = [[scale*np.cos(rho), -scale*np.sin(rho)],\n                  [scale*np.sin(rho), scale*np.cos(rho)]]\n    wcs.wcs.ctype = ['RA---TAN', 'DEC--TAN']\n    wcs.wcs.crval = [position.ra.value, position.dec.value]\n    wcs.wcs.crpix = [50, 100]\n    size = u.Quantity((1.5, 2.5), u.arcsec)\n    cutout = Cutout2D(data, position, size, wcs=wcs)\n    plt.imshow(cutout.data, origin='lower')\n\n\nSaving a 2D Cutout to a FITS File with an Updated WCS\n=====================================================\n\nA `~astropy.nddata.utils.Cutout2D` object can be saved to a FITS file,\nincluding the updated WCS object for the cutout region. In this example, we\ndownload an example FITS image and create a cutout image. The resulting\n`~astropy.nddata.utils.Cutout2D` object is then saved to a new FITS file with\nthe updated WCS for the cutout region.\n\n.. literalinclude:: examples/cutout2d_tofits.py\n   :language: python\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":216,"name":"world","nodeType":"Attribute","startLoc":31,"text":"world"},{"id":217,"name":"docs/nddata/mixins","nodeType":"Package"},{"id":218,"name":"index.rst","nodeType":"TextFile","path":"docs/nddata/mixins","text":"Mixins for Added Functionality\n******************************\n\n.. toctree::\n    :maxdepth: 2\n\n    ndslicing.rst\n    ndarithmetic.rst\n    ndio.rst\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":65,"id":219,"name":"plot_rcparams","nodeType":"Attribute","startLoc":65,"text":"plot_rcparams"},{"attributeType":"null","col":0,"comment":"null","endLoc":72,"id":220,"name":"plot_apply_rcparams","nodeType":"Attribute","startLoc":72,"text":"plot_apply_rcparams"},{"attributeType":"null","col":0,"comment":"null","endLoc":73,"id":221,"name":"plot_html_show_source_link","nodeType":"Attribute","startLoc":73,"text":"plot_html_show_source_link"},{"attributeType":"null","col":0,"comment":"null","endLoc":74,"id":222,"name":"plot_formats","nodeType":"Attribute","startLoc":74,"text":"plot_formats"},{"id":223,"name":"ndio.rst","nodeType":"TextFile","path":"docs/nddata/mixins","text":".. _nddata_io:\n\nI/O Mixin\n*********\n\nThe I/O mixin, `~astropy.nddata.NDIOMixin`, adds ``read`` and ``write``\nmethods that use the ``astropy`` I/O registry.\n\nThe mixin itself creates the read/write methods; it does not register\nany readers or writers with the I/O registry. Subclasses of\n`~astropy.nddata.NDDataBase` or `~astropy.nddata.NDData` need to include this\nmixin, implement a reader and writer, *and* register it with the I/O\nframework. See :ref:`io_registry` for details.\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":76,"id":224,"name":"plot_pre_code","nodeType":"Attribute","startLoc":76,"text":"plot_pre_code"},{"attributeType":"null","col":0,"comment":"null","endLoc":81,"id":225,"name":"needs_sphinx","nodeType":"Attribute","startLoc":81,"text":"needs_sphinx"},{"id":226,"name":"ndarithmetic.rst","nodeType":"TextFile","path":"docs/nddata/mixins","text":".. _nddata_arithmetic:\n\nNDData Arithmetic\n*****************\n\nIntroduction\n============\n\n`~astropy.nddata.NDDataRef` implements the following arithmetic operations:\n\n- Addition: :meth:`~astropy.nddata.NDArithmeticMixin.add`\n- Subtraction: :meth:`~astropy.nddata.NDArithmeticMixin.subtract`\n- Multiplication: :meth:`~astropy.nddata.NDArithmeticMixin.multiply`\n- Division: :meth:`~astropy.nddata.NDArithmeticMixin.divide`\n\nUsing Basic Arithmetic Methods\n==============================\n\nUsing the standard arithmetic methods requires that the first operand\nis an `~astropy.nddata.NDDataRef` instance:\n\n    >>> from astropy.nddata import NDDataRef\n    >>> from astropy.wcs import WCS\n    >>> import numpy as np\n    >>> ndd1 = NDDataRef([1, 2, 3, 4])\n\nWhile the requirement for the second operand is that it must be convertible\nto the first operand. It can be a number::\n\n    >>> ndd1.add(3)\n    NDDataRef([4, 5, 6, 7])\n\nOr a `list`::\n\n    >>> ndd1.subtract([1,1,1,1])\n    NDDataRef([0, 1, 2, 3])\n\nOr a `numpy.ndarray`::\n\n    >>> ndd1.multiply(np.arange(4, 8))\n    NDDataRef([ 4, 10, 18, 28])\n    >>> ndd1.divide(np.arange(1,13).reshape(3,4))  # a 3 x 4 numpy array  # doctest: +FLOAT_CMP\n    NDDataRef([[1.        , 1.        , 1.        , 1.        ],\n               [0.2       , 0.33333333, 0.42857143, 0.5       ],\n               [0.11111111, 0.2       , 0.27272727, 0.33333333]])\n\nHere, broadcasting takes care of the different dimensions. Several other\nclasses are also possible.\n\nUsing Arithmetic Classmethods\n=============================\n\nHere both operands do not need to be `~astropy.nddata.NDDataRef`-like::\n\n    >>> NDDataRef.add(1, 3)\n    NDDataRef(4)\n\nTo wrap the result of an arithmetic operation between two Quantities::\n\n    >>> import astropy.units as u\n    >>> ndd = NDDataRef.multiply([1,2] * u.m, [10, 20] * u.cm)\n    >>> ndd  # doctest: +FLOAT_CMP\n    NDDataRef([10., 40.], unit='cm m')\n    >>> ndd.unit\n    Unit(\"cm m\")\n\nOr take the inverse of an `~astropy.nddata.NDDataRef` object::\n\n    >>> NDDataRef.divide(1, ndd1)  # doctest: +FLOAT_CMP\n    NDDataRef([1.        , 0.5       , 0.33333333, 0.25      ])\n\n\nPossible Operands\n-----------------\n\nThe possible types of input for operands are:\n\n+ Scalars of any type\n+ Lists containing numbers (or nested lists)\n+ ``numpy`` arrays\n+ ``numpy`` masked arrays\n+ ``astropy`` quantities\n+ Other ``nddata`` classes or subclasses\n\nAdvanced Options\n================\n\nThe normal Python operators ``+``, ``-``, etc. are not implemented because\nthe methods provide several options on how to proceed with the additional\nattributes.\n\nData and Unit\n-------------\n\nFor ``data`` and ``unit`` there are no parameters. Every arithmetic\noperation lets the `astropy.units.Quantity`-framework evaluate the result\nor fail and abort the operation.\n\nAdding two `~astropy.nddata.NDData` objects with the same unit works::\n\n    >>> ndd1 = NDDataRef([1,2,3,4,5], unit='m')\n    >>> ndd2 = NDDataRef([100,150,200,50,500], unit='m')\n\n    >>> ndd = ndd1.add(ndd2)\n    >>> ndd.data  # doctest: +FLOAT_CMP\n    array([101., 152., 203.,  54., 505.])\n    >>> ndd.unit\n    Unit(\"m\")\n\nAdding two `~astropy.nddata.NDData` objects with compatible units also works::\n\n    >>> ndd1 = NDDataRef(ndd1, unit='pc')\n    INFO: overwriting NDData's current unit with specified unit. [astropy.nddata.nddata]\n    >>> ndd2 = NDDataRef(ndd2, unit='lyr')\n    INFO: overwriting NDData's current unit with specified unit. [astropy.nddata.nddata]\n\n    >>> ndd = ndd1.subtract(ndd2)\n    >>> ndd.data  # doctest: +FLOAT_CMP\n    array([ -29.66013938,  -43.99020907,  -58.32027876,  -11.33006969,\n           -148.30069689])\n    >>> ndd.unit\n    Unit(\"pc\")\n\nThis will keep by default the unit of the first operand. However, units will\nnot be decomposed during division::\n\n    >>> ndd = ndd2.divide(ndd1)\n    >>> ndd.data  # doctest: +FLOAT_CMP\n    array([100.        ,  75.        ,  66.66666667,  12.5       , 100.        ])\n    >>> ndd.unit\n    Unit(\"lyr / pc\")\n\nMask\n----\n\nThe ``handle_mask`` parameter for the arithmetic operations implements what the\nresulting mask will be. There are several options.\n\n- ``None``, the result will have no ``mask``::\n\n      >>> ndd1 = NDDataRef(1, mask=True)\n      >>> ndd2 = NDDataRef(1, mask=False)\n      >>> ndd1.add(ndd2, handle_mask=None).mask is None\n      True\n\n- ``\"first_found\"`` or ``\"ff\"``, the result will have the ``mask`` of the first\n  operand or if that is ``None``, the ``mask`` of the second operand::\n\n      >>> ndd1 = NDDataRef(1, mask=True)\n      >>> ndd2 = NDDataRef(1, mask=False)\n      >>> ndd1.add(ndd2, handle_mask=\"first_found\").mask\n      True\n      >>> ndd3 = NDDataRef(1)\n      >>> ndd3.add(ndd2, handle_mask=\"first_found\").mask\n      False\n\n- A function (or an arbitrary callable) that takes at least two arguments.\n  For example, `numpy.logical_or` is the default::\n\n      >>> ndd1 = NDDataRef(1, mask=np.array([True, False, True, False]))\n      >>> ndd2 = NDDataRef(1, mask=np.array([True, False, False, True]))\n      >>> ndd1.add(ndd2).mask\n      array([ True, False,  True,  True]...)\n\n  This defaults to ``\"first_found\"`` in case only one ``mask`` is not None::\n\n      >>> ndd1 = NDDataRef(1)\n      >>> ndd2 = NDDataRef(1, mask=np.array([True, False, False, True]))\n      >>> ndd1.add(ndd2).mask\n      array([ True, False, False,  True]...)\n\n  Custom functions are also possible::\n\n      >>> def take_alternating_values(mask1, mask2, start=0):\n      ...     result = np.zeros(mask1.shape, dtype=np.bool_)\n      ...     result[start::2] = mask1[start::2]\n      ...     result[start+1::2] = mask2[start+1::2]\n      ...     return result\n\n  This function is nonsense, but we can still see how it performs::\n\n      >>> ndd1 = NDDataRef(1, mask=np.array([True, False, True, False]))\n      >>> ndd2 = NDDataRef(1, mask=np.array([True, False, False, True]))\n      >>> ndd1.add(ndd2, handle_mask=take_alternating_values).mask\n      array([ True, False,  True,  True]...)\n\n  Additional parameters can be given by prefixing them with ``mask_``\n  (which will be stripped before passing it to the function)::\n\n      >>> ndd1.add(ndd2, handle_mask=take_alternating_values, mask_start=1).mask\n      array([False, False, False, False]...)\n      >>> ndd1.add(ndd2, handle_mask=take_alternating_values, mask_start=2).mask\n      array([False, False,  True,  True]...)\n\nMeta\n----\n\nThe ``handle_meta`` parameter for the arithmetic operations implements what the\nresulting ``meta`` will be. The options are the same as for the ``mask``:\n\n- If ``None`` the resulting ``meta`` will be an empty `collections.OrderedDict`.\n\n      >>> ndd1 = NDDataRef(1, meta={'object': 'sun'})\n      >>> ndd2 = NDDataRef(1, meta={'object': 'moon'})\n      >>> ndd1.add(ndd2, handle_meta=None).meta\n      OrderedDict()\n\n  For ``meta`` this is the default so you do not need to pass it in this case::\n\n      >>> ndd1.add(ndd2).meta\n      OrderedDict()\n\n- If ``\"first_found\"`` or ``\"ff\"``, the resulting ``meta`` will be the ``meta``\n  of the first operand or if that contains no keys, the ``meta`` of the second\n  operand is taken.\n\n      >>> ndd1 = NDDataRef(1, meta={'object': 'sun'})\n      >>> ndd2 = NDDataRef(1, meta={'object': 'moon'})\n      >>> ndd1.add(ndd2, handle_meta='ff').meta\n      {'object': 'sun'}\n\n- If it is a ``callable`` it must take at least two arguments. Both ``meta``\n  attributes will be passed to this function (even if one or both of them are\n  empty) and the callable evaluates the result's ``meta``. For example, a\n  function that merges these two::\n\n      >>> # It's expected with arithmetics that the result is not a reference,\n      >>> # so we need to copy\n      >>> from copy import deepcopy\n\n      >>> def combine_meta(meta1, meta2):\n      ...     if not meta1:\n      ...         return deepcopy(meta2)\n      ...     elif not meta2:\n      ...         return deepcopy(meta1)\n      ...     else:\n      ...         meta_final = deepcopy(meta1)\n      ...         meta_final.update(meta2)\n      ...         return meta_final\n\n      >>> ndd1 = NDDataRef(1, meta={'time': 'today'})\n      >>> ndd2 = NDDataRef(1, meta={'object': 'moon'})\n      >>> ndd1.subtract(ndd2, handle_meta=combine_meta).meta # doctest: +SKIP\n      {'object': 'moon', 'time': 'today'}\n\n  Here again additional arguments for the function can be passed in using\n  the prefix ``meta_`` (which will be stripped away before passing it to this\n  function). See the description for the mask-attribute for further details.\n\nWorld Coordinate System (WCS)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThe ``compare_wcs`` argument will determine what the result's ``wcs`` will be\nor if the operation should be forbidden. The possible values are identical to\n``mask`` and ``meta``:\n\n- If ``None`` the resulting ``wcs`` will be an empty ``None``.\n\n      >>> ndd1 = NDDataRef(1, wcs=None)\n      >>> ndd2 = NDDataRef(1, wcs=WCS())\n      >>> ndd1.add(ndd2, compare_wcs=None).wcs is None\n      True\n\n- If ``\"first_found\"`` or ``\"ff\"`` the resulting ``wcs`` will be the ``wcs`` of\n  the first operand or if that is ``None``, the ``meta`` of the second operand\n  is taken.\n\n      >>> wcs = WCS()\n      >>> ndd1 = NDDataRef(1, wcs=wcs)\n      >>> ndd2 = NDDataRef(1, wcs=None)\n      >>> str(ndd1.add(ndd2, compare_wcs='ff').wcs) == str(wcs)\n      True\n\n- If it is a ``callable`` it must take at least two arguments. Both ``wcs``\n  attributes will be passed to this function (even if one or both of them are\n  ``None``) and the callable should return ``True`` if these ``wcs`` are\n  identical (enough) to allow the arithmetic operation or ``False`` if the\n  arithmetic operation should be aborted with a ``ValueError``. If ``True`` the\n  ``wcs`` are identical and the first one is used for the result::\n\n      >>> def compare_wcs_scalar(wcs1, wcs2, allowed_deviation=0.1):\n      ...     if wcs1 is None and wcs2 is None:\n      ...         return True  # both have no WCS so they are identical\n      ...     if wcs1 is None or wcs2 is None:\n      ...         return False  # one has WCS, the other doesn't not possible\n      ...     else:\n      ...         # Consider wcs close if centers are close enough\n      ...         return all(abs(wcs1.wcs.crpix - wcs2.wcs.crpix) < allowed_deviation)\n\n      >>> ndd1 = NDDataRef(1, wcs=None)\n      >>> ndd2 = NDDataRef(1, wcs=None)\n      >>> ndd1.subtract(ndd2, compare_wcs=compare_wcs_scalar).wcs\n\n\n  Additional arguments can be passed in prefixing them with ``wcs_`` (this\n  prefix will be stripped away before passing it to the function)::\n\n      >>> ndd1 = NDDataRef(1, wcs=WCS())\n      >>> ndd1.wcs.wcs.crpix = [1, 1]\n      >>> ndd2 = NDDataRef(1, wcs=WCS())\n      >>> ndd1.subtract(ndd2, compare_wcs=compare_wcs_scalar, wcs_allowed_deviation=2).wcs.wcs.crpix\n      array([1., 1.])\n\n  If you are using `~astropy.wcs.WCS` objects, a very handy function to use\n  might be::\n\n      >>> def wcs_compare(wcs1, wcs2, *args, **kwargs):\n      ...     return wcs1.wcs.compare(wcs2.wcs, *args, **kwargs)\n\n  See :meth:`astropy.wcs.Wcsprm.compare` for the arguments this comparison\n  allows.\n\nUncertainty\n-----------\n\nThe ``propagate_uncertainties`` argument can be used to turn the propagation\nof uncertainties on or off.\n\n- If ``None`` the result will have no uncertainty::\n\n      >>> from astropy.nddata import StdDevUncertainty\n      >>> ndd1 = NDDataRef(1, uncertainty=StdDevUncertainty(0))\n      >>> ndd2 = NDDataRef(1, uncertainty=StdDevUncertainty(1))\n      >>> ndd1.add(ndd2, propagate_uncertainties=None).uncertainty is None\n      True\n\n- If ``False`` the result will have the first found uncertainty.\n\n  .. note::\n      Setting ``propagate_uncertainties=False`` is generally not\n      recommended.\n\n- If ``True`` both uncertainties must be ``NDUncertainty`` subclasses that\n  implement propagation. This is possible for\n  `~astropy.nddata.StdDevUncertainty`::\n\n      >>> ndd1 = NDDataRef(1, uncertainty=StdDevUncertainty([10]))\n      >>> ndd2 = NDDataRef(1, uncertainty=StdDevUncertainty([10]))\n      >>> ndd1.add(ndd2, propagate_uncertainties=True).uncertainty  # doctest: +FLOAT_CMP\n      StdDevUncertainty([14.14213562])\n\nUncertainty with Correlation\n----------------------------\n\nIf ``propagate_uncertainties`` is ``True`` you can also give an argument\nfor ``uncertainty_correlation``. `~astropy.nddata.StdDevUncertainty` cannot\nkeep track of its correlations by itself, but it can evaluate the correct\nresulting uncertainty if the correct ``correlation`` is given.\n\nThe default (``0``) represents uncorrelated while ``1`` means correlated and\n``-1`` anti-correlated. If given a `numpy.ndarray` it should represent the\nelement-wise correlation coefficient.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Uncertainty with Correlation in NDData\n\nWithout correlation, subtracting an `~astropy.nddata.NDDataRef` instance from\nitself results in a non-zero uncertainty::\n\n    >>> ndd1 = NDDataRef(1, uncertainty=StdDevUncertainty([10]))\n    >>> ndd1.subtract(ndd1, propagate_uncertainties=True).uncertainty  # doctest: +FLOAT_CMP\n    StdDevUncertainty([14.14213562])\n\nGiven a correlation of ``1`` (because they clearly correlate) gives the\ncorrect uncertainty of ``0``::\n\n    >>> ndd1 = NDDataRef(1, uncertainty=StdDevUncertainty([10]))\n    >>> ndd1.subtract(ndd1, propagate_uncertainties=True,\n    ...               uncertainty_correlation=1).uncertainty  # doctest: +FLOAT_CMP\n    StdDevUncertainty([0.])\n\nWhich would be consistent with the equivalent operation ``ndd1 * 0``::\n\n    >>> ndd1.multiply(0, propagate_uncertainties=True).uncertainty # doctest: +FLOAT_CMP\n    StdDevUncertainty([0.])\n\n.. warning::\n    The user needs to calculate or know the appropriate value or array manually\n    and pass it to ``uncertainty_correlation``. The implementation follows\n    general first order error propagation formulas. See, for example:\n    `Wikipedia <https://en.wikipedia.org/wiki/Propagation_of_uncertainty#Example_formulas>`_.\n\nYou can also give element-wise correlations::\n\n    >>> ndd1 = NDDataRef([1,1,1,1], uncertainty=StdDevUncertainty([1,1,1,1]))\n    >>> ndd2 = NDDataRef([2,2,2,2], uncertainty=StdDevUncertainty([2,2,2,2]))\n    >>> ndd1.add(ndd2,uncertainty_correlation=np.array([1,0.5,0,-1])).uncertainty  # doctest: +FLOAT_CMP\n    StdDevUncertainty([3.        , 2.64575131, 2.23606798, 1.        ])\n\nThe correlation ``np.array([1, 0.5, 0, -1])`` would indicate that the first\nelement is fully correlated and the second element partially correlates, while\nthe third element is uncorrelated, and the fourth is anti-correlated.\n\n..\n  EXAMPLE END\n\nUncertainty with Unit\n---------------------\n\n`~astropy.nddata.StdDevUncertainty` implements correct error propagation even\nif the unit of the data differs from the unit of the uncertainty::\n\n    >>> ndd1 = NDDataRef([10], unit='m', uncertainty=StdDevUncertainty([10], unit='cm'))\n    >>> ndd2 = NDDataRef([20], unit='m', uncertainty=StdDevUncertainty([10]))\n    >>> ndd1.subtract(ndd2, propagate_uncertainties=True).uncertainty  # doctest: +FLOAT_CMP\n    StdDevUncertainty([10.00049999])\n\nBut it needs to be convertible to the unit for the data.\n"},{"id":227,"name":"ndslicing.rst","nodeType":"TextFile","path":"docs/nddata/mixins","text":".. _nddata_slicing:\n\nSlicing and Indexing NDData\n***************************\n\nIntroduction\n============\n\nThis page only deals with peculiarities that apply to\n`~astropy.nddata.NDData`-like classes. For a tutorial about slicing/indexing see the\n`python documentation <https://docs.python.org/3/tutorial/introduction.html#lists>`_\nand `numpy documentation <https://numpy.org/doc/stable/reference/arrays.indexing.html>`_.\n\n.. warning::\n    `~astropy.nddata.NDData` and `~astropy.nddata.NDDataRef` enforce almost no\n    restrictions on the properties, so it might happen that some **valid but\n    unusual** combinations of properties always result in an IndexError or\n    incorrect results. In this case, see :ref:`nddata_subclassing` on how to\n    customize slicing for a particular property.\n\n\nSlicing NDDataRef\n=================\n\nUnlike `~astropy.nddata.NDData` the class `~astropy.nddata.NDDataRef`\nimplements slicing or indexing. The result will be wrapped inside the same\nclass as the sliced object.\n\nGetting one element::\n\n    >>> import numpy as np\n    >>> from astropy.nddata import NDDataRef\n\n    >>> data = np.array([1, 2, 3, 4])\n    >>> ndd = NDDataRef(data)\n    >>> ndd[1]\n    NDDataRef(2)\n\nGetting a sliced portion of the original::\n\n    >>> ndd[1:3]  # Get element 1 (inclusive) to 3 (exclusive)\n    NDDataRef([2, 3])\n\nThis will return a reference (and as such **not a copy**) of the original\nproperties, so changing a slice will affect the original::\n\n    >>> ndd_sliced = ndd[1:3]\n    >>> ndd_sliced.data[0] = 5\n    >>> ndd_sliced\n    NDDataRef([5, 3])\n    >>> ndd\n    NDDataRef([1, 5, 3, 4])\n\nBut only the one element that was indexed is affected (for example,\n``ndd_sliced = ndd[1]``). The element is a scalar and changes will not\npropagate to the original.\n\nSlicing NDDataRef Including Attributes\n======================================\n\nIn the case that a ``mask``, or ``uncertainty`` is present, this\nattribute will be sliced too::\n\n    >>> from astropy.nddata import StdDevUncertainty\n    >>> data = np.array([1, 2, 3, 4])\n    >>> mask = data > 2\n    >>> uncertainty = StdDevUncertainty(np.sqrt(data))\n    >>> ndd = NDDataRef(data, mask=mask, uncertainty=uncertainty)\n    >>> ndd_sliced = ndd[1:3]\n\n    >>> ndd_sliced.data\n    array([2, 3])\n\n    >>> ndd_sliced.mask\n    array([False,  True]...)\n\n    >>> ndd_sliced.uncertainty  # doctest: +FLOAT_CMP\n    StdDevUncertainty([1.41421356, 1.73205081])\n\n``unit`` and ``meta``, however, will be unaffected.\n\nIf any of the attributes are set but do not implement slicing, an info will be\nprinted and the property will be kept as is::\n\n    >>> data = np.array([1, 2, 3, 4])\n    >>> mask = False\n    >>> uncertainty = StdDevUncertainty(0)\n    >>> ndd = NDDataRef(data, mask=mask, uncertainty=uncertainty)\n    >>> ndd_sliced = ndd[1:3]\n    INFO: uncertainty cannot be sliced. [astropy.nddata.mixins.ndslicing]\n    INFO: mask cannot be sliced. [astropy.nddata.mixins.ndslicing]\n\n    >>> ndd_sliced.mask\n    False\n\n\nSlicing NDData with World Coordinates\n-------------------------------------\n\nIf ``wcs`` is set, it must be either implement\n`~astropy.wcs.wcsapi.BaseLowLevelWCS` or `~astropy.wcs.wcsapi.BaseHighLevelWCS`.\nThis means that only integer or range slices without a step are supported. So\nslices like ``[::10]`` or array or boolean based slices will not work.\n\nIf you want to slice an ``NDData`` object called ``ndd`` without the WCS you can remove the\nWCS from the ``NDData`` object by running:\n\n    >>> ndd.wcs = None\n\n\nRemoving Masked Data\n--------------------\n\n.. warning::\n    If ``wcs`` is set this will **NOT** be possible. But you can work around\n    this by setting the wcs attribute to `None` with ``ndd.wcs = None`` before slicing.\n\nBy convention, the ``mask`` attribute indicates if a point is valid or invalid.\nSo we are able to get all valid data points by slicing with the mask.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Removing Masked Data in NDDataRef\n\nTo get all of the valid data points by slicing with the mask::\n\n    >>> data = np.array([[1,2,3],[4,5,6],[7,8,9]])\n    >>> mask = np.array([[0,1,0],[1,1,1],[0,0,1]], dtype=bool)\n    >>> uncertainty = StdDevUncertainty(np.sqrt(data))\n    >>> ndd = NDDataRef(data, mask=mask, uncertainty=uncertainty)\n    >>> # don't forget that ~ or you'll get the invalid points\n    >>> ndd_sliced = ndd[~ndd.mask]\n    >>> ndd_sliced\n    NDDataRef([1, 3, 7, 8])\n\n    >>> ndd_sliced.mask\n    array([False, False, False, False]...)\n\n    >>> ndd_sliced.uncertainty  # doctest: +FLOAT_CMP\n    StdDevUncertainty([1.        , 1.73205081, 2.64575131, 2.82842712])\n\nOr all invalid points::\n\n    >>> ndd_sliced = ndd[ndd.mask] # without the ~ now!\n    >>> ndd_sliced\n    NDDataRef([2, 4, 5, 6, 9])\n\n    >>> ndd_sliced.mask\n    array([ True,  True,  True,  True,  True]...)\n\n    >>> ndd_sliced.uncertainty  # doctest: +FLOAT_CMP\n    StdDevUncertainty([1.41421356, 2.        , 2.23606798, 2.44948974, 3.        ])\n\n.. note::\n    The result of this kind of indexing (boolean indexing) will always be\n    one-dimensional!\n\n..\n  EXAMPLE END\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":228,"name":"pixcrd2","nodeType":"Attribute","startLoc":35,"text":"pixcrd2"},{"id":229,"name":"docs/nddata/examples","nodeType":"Package"},{"fileName":"cutout2d_tofits.py","filePath":"docs/nddata/examples","id":230,"nodeType":"File","text":"# Download an example FITS file, create a 2D cutout, and save it to a\n# new FITS file, including the updated cutout WCS.\nfrom astropy.io import fits\nfrom astropy.nddata import Cutout2D\nfrom astropy.utils.data import download_file\nfrom astropy.wcs import WCS\n\n\ndef download_image_save_cutout(url, position, size):\n    # Download the image\n    filename = download_file(url)\n\n    # Load the image and the WCS\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n\n    # Make the cutout, including the WCS\n    cutout = Cutout2D(hdu.data, position=position, size=size, wcs=wcs)\n\n    # Put the cutout image in the FITS HDU\n    hdu.data = cutout.data\n\n    # Update the FITS header with the cutout WCS\n    hdu.header.update(cutout.wcs.to_header())\n\n    # Write the cutout to a new FITS file\n    cutout_filename = 'example_cutout.fits'\n    hdu.writeto(cutout_filename, overwrite=True)\n\n\nif __name__ == '__main__':\n    url = 'https://astropy.stsci.edu/data/photometry/spitzer_example_image.fits'\n\n    position = (500, 300)\n    size = (400, 400)\n    download_image_save_cutout(url, position, size)\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":45,"id":231,"name":"x","nodeType":"Attribute","startLoc":45,"text":"x"},{"attributeType":"null","col":0,"comment":"null","endLoc":46,"id":232,"name":"y","nodeType":"Attribute","startLoc":46,"text":"y"},{"attributeType":"null","col":0,"comment":"null","endLoc":47,"id":233,"name":"origin","nodeType":"Attribute","startLoc":47,"text":"origin"},{"attributeType":"Header","col":0,"comment":"null","endLoc":52,"id":234,"name":"header","nodeType":"Attribute","startLoc":52,"text":"header"},{"attributeType":"PrimaryHDU","col":0,"comment":"null","endLoc":56,"id":235,"name":"hdu","nodeType":"Attribute","startLoc":56,"text":"hdu"},{"col":0,"comment":"\n    Returns True if the given object represents an OS-level file (that is,\n    ``isinstance(f, file)``).\n\n    On Python 3 this also returns True if the given object is higher level\n    wrapper on top of a FileIO object, such as a TextIOWrapper.\n    ","endLoc":375,"header":"def isfile(f)","id":236,"name":"isfile","nodeType":"Function","startLoc":360,"text":"def isfile(f):\n    \"\"\"\n    Returns True if the given object represents an OS-level file (that is,\n    ``isinstance(f, file)``).\n\n    On Python 3 this also returns True if the given object is higher level\n    wrapper on top of a FileIO object, such as a TextIOWrapper.\n    \"\"\"\n\n    if isinstance(f, io.FileIO):\n        return True\n    elif hasattr(f, 'buffer'):\n        return isfile(f.buffer)\n    elif hasattr(f, 'raw'):\n        return isfile(f.raw)\n    return False"},{"className":"Cutout2D","col":0,"comment":"\n    Create a cutout object from a 2D array.\n\n    The returned object will contain a 2D cutout array.  If\n    ``copy=False`` (default), the cutout array is a view into the\n    original ``data`` array, otherwise the cutout array will contain a\n    copy of the original data.\n\n    If a `~astropy.wcs.WCS` object is input, then the returned object\n    will also contain a copy of the original WCS, but updated for the\n    cutout array.\n\n    For example usage, see :ref:`astropy:cutout_images`.\n\n    .. warning::\n\n        The cutout WCS object does not currently handle cases where the\n        input WCS object contains distortion lookup tables described in\n        the `FITS WCS distortion paper\n        <https://www.atnf.csiro.au/people/mcalabre/WCS/dcs_20040422.pdf>`__.\n\n    Parameters\n    ----------\n    data : ndarray\n        The 2D data array from which to extract the cutout array.\n\n    position : tuple or `~astropy.coordinates.SkyCoord`\n        The position of the cutout array's center with respect to\n        the ``data`` array.  The position can be specified either as\n        a ``(x, y)`` tuple of pixel coordinates or a\n        `~astropy.coordinates.SkyCoord`, in which case ``wcs`` is a\n        required input.\n\n    size : int, array-like, or `~astropy.units.Quantity`\n        The size of the cutout array along each axis.  If ``size``\n        is a scalar number or a scalar `~astropy.units.Quantity`,\n        then a square cutout of ``size`` will be created.  If\n        ``size`` has two elements, they should be in ``(ny, nx)``\n        order.  Scalar numbers in ``size`` are assumed to be in\n        units of pixels.  ``size`` can also be a\n        `~astropy.units.Quantity` object or contain\n        `~astropy.units.Quantity` objects.  Such\n        `~astropy.units.Quantity` objects must be in pixel or\n        angular units.  For all cases, ``size`` will be converted to\n        an integer number of pixels, rounding the the nearest\n        integer.  See the ``mode`` keyword for additional details on\n        the final cutout size.\n\n        .. note::\n            If ``size`` is in angular units, the cutout size is\n            converted to pixels using the pixel scales along each\n            axis of the image at the ``CRPIX`` location.  Projection\n            and other non-linear distortions are not taken into\n            account.\n\n    wcs : `~astropy.wcs.WCS`, optional\n        A WCS object associated with the input ``data`` array.  If\n        ``wcs`` is not `None`, then the returned cutout object will\n        contain a copy of the updated WCS for the cutout data array.\n\n    mode : {'trim', 'partial', 'strict'}, optional\n        The mode used for creating the cutout data array.  For the\n        ``'partial'`` and ``'trim'`` modes, a partial overlap of the\n        cutout array and the input ``data`` array is sufficient.\n        For the ``'strict'`` mode, the cutout array has to be fully\n        contained within the ``data`` array, otherwise an\n        `~astropy.nddata.utils.PartialOverlapError` is raised.   In\n        all modes, non-overlapping arrays will raise a\n        `~astropy.nddata.utils.NoOverlapError`.  In ``'partial'``\n        mode, positions in the cutout array that do not overlap with\n        the ``data`` array will be filled with ``fill_value``.  In\n        ``'trim'`` mode only the overlapping elements are returned,\n        thus the resulting cutout array may be smaller than the\n        requested ``shape``.\n\n    fill_value : float or int, optional\n        If ``mode='partial'``, the value to fill pixels in the\n        cutout array that do not overlap with the input ``data``.\n        ``fill_value`` must have the same ``dtype`` as the input\n        ``data`` array.\n\n    copy : bool, optional\n        If `False` (default), then the cutout data will be a view\n        into the original ``data`` array.  If `True`, then the\n        cutout data will hold a copy of the original ``data`` array.\n\n    Attributes\n    ----------\n    data : 2D `~numpy.ndarray`\n        The 2D cutout array.\n\n    shape : (2,) tuple\n        The ``(ny, nx)`` shape of the cutout array.\n\n    shape_input : (2,) tuple\n        The ``(ny, nx)`` shape of the input (original) array.\n\n    input_position_cutout : (2,) tuple\n        The (unrounded) ``(x, y)`` position with respect to the cutout\n        array.\n\n    input_position_original : (2,) tuple\n        The original (unrounded) ``(x, y)`` input position (with respect\n        to the original array).\n\n    slices_original : (2,) tuple of slice object\n        A tuple of slice objects for the minimal bounding box of the\n        cutout with respect to the original array.  For\n        ``mode='partial'``, the slices are for the valid (non-filled)\n        cutout values.\n\n    slices_cutout : (2,) tuple of slice object\n        A tuple of slice objects for the minimal bounding box of the\n        cutout with respect to the cutout array.  For\n        ``mode='partial'``, the slices are for the valid (non-filled)\n        cutout values.\n\n    xmin_original, ymin_original, xmax_original, ymax_original : float\n        The minimum and maximum ``x`` and ``y`` indices of the minimal\n        rectangular region of the cutout array with respect to the\n        original array.  For ``mode='partial'``, the bounding box\n        indices are for the valid (non-filled) cutout values.  These\n        values are the same as those in `bbox_original`.\n\n    xmin_cutout, ymin_cutout, xmax_cutout, ymax_cutout : float\n        The minimum and maximum ``x`` and ``y`` indices of the minimal\n        rectangular region of the cutout array with respect to the\n        cutout array.  For ``mode='partial'``, the bounding box indices\n        are for the valid (non-filled) cutout values.  These values are\n        the same as those in `bbox_cutout`.\n\n    wcs : `~astropy.wcs.WCS` or None\n        A WCS object associated with the cutout array if a ``wcs``\n        was input.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.nddata.utils import Cutout2D\n    >>> from astropy import units as u\n    >>> data = np.arange(20.).reshape(5, 4)\n    >>> cutout1 = Cutout2D(data, (2, 2), (3, 3))\n    >>> print(cutout1.data)  # doctest: +FLOAT_CMP\n    [[ 5.  6.  7.]\n     [ 9. 10. 11.]\n     [13. 14. 15.]]\n\n    >>> print(cutout1.center_original)\n    (2.0, 2.0)\n    >>> print(cutout1.center_cutout)\n    (1.0, 1.0)\n    >>> print(cutout1.origin_original)\n    (1, 1)\n\n    >>> cutout2 = Cutout2D(data, (2, 2), 3)\n    >>> print(cutout2.data)  # doctest: +FLOAT_CMP\n    [[ 5.  6.  7.]\n     [ 9. 10. 11.]\n     [13. 14. 15.]]\n\n    >>> size = u.Quantity([3, 3], u.pixel)\n    >>> cutout3 = Cutout2D(data, (0, 0), size)\n    >>> print(cutout3.data)  # doctest: +FLOAT_CMP\n    [[0. 1.]\n     [4. 5.]]\n\n    >>> cutout4 = Cutout2D(data, (0, 0), (3 * u.pixel, 3))\n    >>> print(cutout4.data)  # doctest: +FLOAT_CMP\n    [[0. 1.]\n     [4. 5.]]\n\n    >>> cutout5 = Cutout2D(data, (0, 0), (3, 3), mode='partial')\n    >>> print(cutout5.data)  # doctest: +FLOAT_CMP\n    [[nan nan nan]\n     [nan  0.  1.]\n     [nan  4.  5.]]\n    ","endLoc":797,"id":237,"nodeType":"Class","startLoc":341,"text":"class Cutout2D:\n    \"\"\"\n    Create a cutout object from a 2D array.\n\n    The returned object will contain a 2D cutout array.  If\n    ``copy=False`` (default), the cutout array is a view into the\n    original ``data`` array, otherwise the cutout array will contain a\n    copy of the original data.\n\n    If a `~astropy.wcs.WCS` object is input, then the returned object\n    will also contain a copy of the original WCS, but updated for the\n    cutout array.\n\n    For example usage, see :ref:`astropy:cutout_images`.\n\n    .. warning::\n\n        The cutout WCS object does not currently handle cases where the\n        input WCS object contains distortion lookup tables described in\n        the `FITS WCS distortion paper\n        <https://www.atnf.csiro.au/people/mcalabre/WCS/dcs_20040422.pdf>`__.\n\n    Parameters\n    ----------\n    data : ndarray\n        The 2D data array from which to extract the cutout array.\n\n    position : tuple or `~astropy.coordinates.SkyCoord`\n        The position of the cutout array's center with respect to\n        the ``data`` array.  The position can be specified either as\n        a ``(x, y)`` tuple of pixel coordinates or a\n        `~astropy.coordinates.SkyCoord`, in which case ``wcs`` is a\n        required input.\n\n    size : int, array-like, or `~astropy.units.Quantity`\n        The size of the cutout array along each axis.  If ``size``\n        is a scalar number or a scalar `~astropy.units.Quantity`,\n        then a square cutout of ``size`` will be created.  If\n        ``size`` has two elements, they should be in ``(ny, nx)``\n        order.  Scalar numbers in ``size`` are assumed to be in\n        units of pixels.  ``size`` can also be a\n        `~astropy.units.Quantity` object or contain\n        `~astropy.units.Quantity` objects.  Such\n        `~astropy.units.Quantity` objects must be in pixel or\n        angular units.  For all cases, ``size`` will be converted to\n        an integer number of pixels, rounding the the nearest\n        integer.  See the ``mode`` keyword for additional details on\n        the final cutout size.\n\n        .. note::\n            If ``size`` is in angular units, the cutout size is\n            converted to pixels using the pixel scales along each\n            axis of the image at the ``CRPIX`` location.  Projection\n            and other non-linear distortions are not taken into\n            account.\n\n    wcs : `~astropy.wcs.WCS`, optional\n        A WCS object associated with the input ``data`` array.  If\n        ``wcs`` is not `None`, then the returned cutout object will\n        contain a copy of the updated WCS for the cutout data array.\n\n    mode : {'trim', 'partial', 'strict'}, optional\n        The mode used for creating the cutout data array.  For the\n        ``'partial'`` and ``'trim'`` modes, a partial overlap of the\n        cutout array and the input ``data`` array is sufficient.\n        For the ``'strict'`` mode, the cutout array has to be fully\n        contained within the ``data`` array, otherwise an\n        `~astropy.nddata.utils.PartialOverlapError` is raised.   In\n        all modes, non-overlapping arrays will raise a\n        `~astropy.nddata.utils.NoOverlapError`.  In ``'partial'``\n        mode, positions in the cutout array that do not overlap with\n        the ``data`` array will be filled with ``fill_value``.  In\n        ``'trim'`` mode only the overlapping elements are returned,\n        thus the resulting cutout array may be smaller than the\n        requested ``shape``.\n\n    fill_value : float or int, optional\n        If ``mode='partial'``, the value to fill pixels in the\n        cutout array that do not overlap with the input ``data``.\n        ``fill_value`` must have the same ``dtype`` as the input\n        ``data`` array.\n\n    copy : bool, optional\n        If `False` (default), then the cutout data will be a view\n        into the original ``data`` array.  If `True`, then the\n        cutout data will hold a copy of the original ``data`` array.\n\n    Attributes\n    ----------\n    data : 2D `~numpy.ndarray`\n        The 2D cutout array.\n\n    shape : (2,) tuple\n        The ``(ny, nx)`` shape of the cutout array.\n\n    shape_input : (2,) tuple\n        The ``(ny, nx)`` shape of the input (original) array.\n\n    input_position_cutout : (2,) tuple\n        The (unrounded) ``(x, y)`` position with respect to the cutout\n        array.\n\n    input_position_original : (2,) tuple\n        The original (unrounded) ``(x, y)`` input position (with respect\n        to the original array).\n\n    slices_original : (2,) tuple of slice object\n        A tuple of slice objects for the minimal bounding box of the\n        cutout with respect to the original array.  For\n        ``mode='partial'``, the slices are for the valid (non-filled)\n        cutout values.\n\n    slices_cutout : (2,) tuple of slice object\n        A tuple of slice objects for the minimal bounding box of the\n        cutout with respect to the cutout array.  For\n        ``mode='partial'``, the slices are for the valid (non-filled)\n        cutout values.\n\n    xmin_original, ymin_original, xmax_original, ymax_original : float\n        The minimum and maximum ``x`` and ``y`` indices of the minimal\n        rectangular region of the cutout array with respect to the\n        original array.  For ``mode='partial'``, the bounding box\n        indices are for the valid (non-filled) cutout values.  These\n        values are the same as those in `bbox_original`.\n\n    xmin_cutout, ymin_cutout, xmax_cutout, ymax_cutout : float\n        The minimum and maximum ``x`` and ``y`` indices of the minimal\n        rectangular region of the cutout array with respect to the\n        cutout array.  For ``mode='partial'``, the bounding box indices\n        are for the valid (non-filled) cutout values.  These values are\n        the same as those in `bbox_cutout`.\n\n    wcs : `~astropy.wcs.WCS` or None\n        A WCS object associated with the cutout array if a ``wcs``\n        was input.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.nddata.utils import Cutout2D\n    >>> from astropy import units as u\n    >>> data = np.arange(20.).reshape(5, 4)\n    >>> cutout1 = Cutout2D(data, (2, 2), (3, 3))\n    >>> print(cutout1.data)  # doctest: +FLOAT_CMP\n    [[ 5.  6.  7.]\n     [ 9. 10. 11.]\n     [13. 14. 15.]]\n\n    >>> print(cutout1.center_original)\n    (2.0, 2.0)\n    >>> print(cutout1.center_cutout)\n    (1.0, 1.0)\n    >>> print(cutout1.origin_original)\n    (1, 1)\n\n    >>> cutout2 = Cutout2D(data, (2, 2), 3)\n    >>> print(cutout2.data)  # doctest: +FLOAT_CMP\n    [[ 5.  6.  7.]\n     [ 9. 10. 11.]\n     [13. 14. 15.]]\n\n    >>> size = u.Quantity([3, 3], u.pixel)\n    >>> cutout3 = Cutout2D(data, (0, 0), size)\n    >>> print(cutout3.data)  # doctest: +FLOAT_CMP\n    [[0. 1.]\n     [4. 5.]]\n\n    >>> cutout4 = Cutout2D(data, (0, 0), (3 * u.pixel, 3))\n    >>> print(cutout4.data)  # doctest: +FLOAT_CMP\n    [[0. 1.]\n     [4. 5.]]\n\n    >>> cutout5 = Cutout2D(data, (0, 0), (3, 3), mode='partial')\n    >>> print(cutout5.data)  # doctest: +FLOAT_CMP\n    [[nan nan nan]\n     [nan  0.  1.]\n     [nan  4.  5.]]\n    \"\"\"\n\n    def __init__(self, data, position, size, wcs=None, mode='trim',\n                 fill_value=np.nan, copy=False):\n        if wcs is None:\n            wcs = getattr(data, 'wcs', None)\n\n        if isinstance(position, SkyCoord):\n            if wcs is None:\n                raise ValueError('wcs must be input if position is a '\n                                 'SkyCoord')\n            position = skycoord_to_pixel(position, wcs, mode='all')  # (x, y)\n\n        if np.isscalar(size):\n            size = np.repeat(size, 2)\n\n        # special handling for a scalar Quantity\n        if isinstance(size, u.Quantity):\n            size = np.atleast_1d(size)\n            if len(size) == 1:\n                size = np.repeat(size, 2)\n\n        if len(size) > 2:\n            raise ValueError('size must have at most two elements')\n\n        shape = np.zeros(2).astype(int)\n        pixel_scales = None\n        # ``size`` can have a mixture of int and Quantity (and even units),\n        # so evaluate each axis separately\n        for axis, side in enumerate(size):\n            if not isinstance(side, u.Quantity):\n                shape[axis] = int(np.round(size[axis]))     # pixels\n            else:\n                if side.unit == u.pixel:\n                    shape[axis] = int(np.round(side.value))\n                elif side.unit.physical_type == 'angle':\n                    if wcs is None:\n                        raise ValueError('wcs must be input if any element '\n                                         'of size has angular units')\n                    if pixel_scales is None:\n                        pixel_scales = u.Quantity(\n                            proj_plane_pixel_scales(wcs), wcs.wcs.cunit[axis])\n                    shape[axis] = int(np.round(\n                        (side / pixel_scales[axis]).decompose()))\n                else:\n                    raise ValueError('shape can contain Quantities with only '\n                                     'pixel or angular units')\n\n        data = np.asanyarray(data)\n        # reverse position because extract_array and overlap_slices\n        # use (y, x), but keep the input position\n        pos_yx = position[::-1]\n\n        cutout_data, input_position_cutout = extract_array(\n            data, tuple(shape), pos_yx, mode=mode, fill_value=fill_value,\n            return_position=True)\n        if copy:\n            cutout_data = np.copy(cutout_data)\n        self.data = cutout_data\n\n        self.input_position_cutout = input_position_cutout[::-1]    # (x, y)\n        slices_original, slices_cutout = overlap_slices(\n            data.shape, shape, pos_yx, mode=mode)\n\n        self.slices_original = slices_original\n        self.slices_cutout = slices_cutout\n\n        self.shape = self.data.shape\n        self.input_position_original = position\n        self.shape_input = shape\n\n        ((self.ymin_original, self.ymax_original),\n         (self.xmin_original, self.xmax_original)) = self.bbox_original\n\n        ((self.ymin_cutout, self.ymax_cutout),\n         (self.xmin_cutout, self.xmax_cutout)) = self.bbox_cutout\n\n        # the true origin pixel of the cutout array, including any\n        # filled cutout values\n        self._origin_original_true = (\n            self.origin_original[0] - self.slices_cutout[1].start,\n            self.origin_original[1] - self.slices_cutout[0].start)\n\n        if wcs is not None:\n            self.wcs = deepcopy(wcs)\n            self.wcs.wcs.crpix -= self._origin_original_true\n            self.wcs.array_shape = self.data.shape\n            if wcs.sip is not None:\n                self.wcs.sip = Sip(wcs.sip.a, wcs.sip.b,\n                                   wcs.sip.ap, wcs.sip.bp,\n                                   wcs.sip.crpix - self._origin_original_true)\n        else:\n            self.wcs = None\n\n    def to_original_position(self, cutout_position):\n        \"\"\"\n        Convert an ``(x, y)`` position in the cutout array to the original\n        ``(x, y)`` position in the original large array.\n\n        Parameters\n        ----------\n        cutout_position : tuple\n            The ``(x, y)`` pixel position in the cutout array.\n\n        Returns\n        -------\n        original_position : tuple\n            The corresponding ``(x, y)`` pixel position in the original\n            large array.\n        \"\"\"\n        return tuple(cutout_position[i] + self.origin_original[i]\n                     for i in [0, 1])\n\n    def to_cutout_position(self, original_position):\n        \"\"\"\n        Convert an ``(x, y)`` position in the original large array to\n        the ``(x, y)`` position in the cutout array.\n\n        Parameters\n        ----------\n        original_position : tuple\n            The ``(x, y)`` pixel position in the original large array.\n\n        Returns\n        -------\n        cutout_position : tuple\n            The corresponding ``(x, y)`` pixel position in the cutout\n            array.\n        \"\"\"\n        return tuple(original_position[i] - self.origin_original[i]\n                     for i in [0, 1])\n\n    def plot_on_original(self, ax=None, fill=False, **kwargs):\n        \"\"\"\n        Plot the cutout region on a matplotlib Axes instance.\n\n        Parameters\n        ----------\n        ax : `matplotlib.axes.Axes` instance, optional\n            If `None`, then the current `matplotlib.axes.Axes` instance\n            is used.\n\n        fill : bool, optional\n            Set whether to fill the cutout patch.  The default is\n            `False`.\n\n        kwargs : optional\n            Any keyword arguments accepted by `matplotlib.patches.Patch`.\n\n        Returns\n        -------\n        ax : `matplotlib.axes.Axes` instance\n            The matplotlib Axes instance constructed in the method if\n            ``ax=None``.  Otherwise the output ``ax`` is the same as the\n            input ``ax``.\n        \"\"\"\n\n        import matplotlib.pyplot as plt\n        import matplotlib.patches as mpatches\n\n        kwargs['fill'] = fill\n\n        if ax is None:\n            ax = plt.gca()\n\n        height, width = self.shape\n        hw, hh = width / 2., height / 2.\n        pos_xy = self.position_original - np.array([hw, hh])\n        patch = mpatches.Rectangle(pos_xy, width, height, 0., **kwargs)\n        ax.add_patch(patch)\n        return ax\n\n    @staticmethod\n    def _calc_center(slices):\n        \"\"\"\n        Calculate the center position.  The center position will be\n        fractional for even-sized arrays.  For ``mode='partial'``, the\n        central position is calculated for the valid (non-filled) cutout\n        values.\n        \"\"\"\n        return tuple(0.5 * (slices[i].start + slices[i].stop - 1)\n                     for i in [1, 0])\n\n    @staticmethod\n    def _calc_bbox(slices):\n        \"\"\"\n        Calculate a minimal bounding box in the form ``((ymin, ymax),\n        (xmin, xmax))``.  Note these are pixel locations, not slice\n        indices.  For ``mode='partial'``, the bounding box indices are\n        for the valid (non-filled) cutout values.\n        \"\"\"\n        # (stop - 1) to return the max pixel location, not the slice index\n        return ((slices[0].start, slices[0].stop - 1),\n                (slices[1].start, slices[1].stop - 1))\n\n    @lazyproperty\n    def origin_original(self):\n        \"\"\"\n        The ``(x, y)`` index of the origin pixel of the cutout with\n        respect to the original array.  For ``mode='partial'``, the\n        origin pixel is calculated for the valid (non-filled) cutout\n        values.\n        \"\"\"\n        return (self.slices_original[1].start, self.slices_original[0].start)\n\n    @lazyproperty\n    def origin_cutout(self):\n        \"\"\"\n        The ``(x, y)`` index of the origin pixel of the cutout with\n        respect to the cutout array.  For ``mode='partial'``, the origin\n        pixel is calculated for the valid (non-filled) cutout values.\n        \"\"\"\n        return (self.slices_cutout[1].start, self.slices_cutout[0].start)\n\n    @staticmethod\n    def _round(a):\n        \"\"\"\n        Round the input to the nearest integer.\n\n        If two integers are equally close, the value is rounded up.\n        Note that this is different from `np.round`, which rounds to the\n        nearest even number.\n        \"\"\"\n        return int(np.floor(a + 0.5))\n\n    @lazyproperty\n    def position_original(self):\n        \"\"\"\n        The ``(x, y)`` position index (rounded to the nearest pixel) in\n        the original array.\n        \"\"\"\n        return (self._round(self.input_position_original[0]),\n                self._round(self.input_position_original[1]))\n\n    @lazyproperty\n    def position_cutout(self):\n        \"\"\"\n        The ``(x, y)`` position index (rounded to the nearest pixel) in\n        the cutout array.\n        \"\"\"\n        return (self._round(self.input_position_cutout[0]),\n                self._round(self.input_position_cutout[1]))\n\n    @lazyproperty\n    def center_original(self):\n        \"\"\"\n        The central ``(x, y)`` position of the cutout array with respect\n        to the original array.  For ``mode='partial'``, the central\n        position is calculated for the valid (non-filled) cutout values.\n        \"\"\"\n        return self._calc_center(self.slices_original)\n\n    @lazyproperty\n    def center_cutout(self):\n        \"\"\"\n        The central ``(x, y)`` position of the cutout array with respect\n        to the cutout array.  For ``mode='partial'``, the central\n        position is calculated for the valid (non-filled) cutout values.\n        \"\"\"\n        return self._calc_center(self.slices_cutout)\n\n    @lazyproperty\n    def bbox_original(self):\n        \"\"\"\n        The bounding box ``((ymin, ymax), (xmin, xmax))`` of the minimal\n        rectangular region of the cutout array with respect to the\n        original array.  For ``mode='partial'``, the bounding box\n        indices are for the valid (non-filled) cutout values.\n        \"\"\"\n        return self._calc_bbox(self.slices_original)\n\n    @lazyproperty\n    def bbox_cutout(self):\n        \"\"\"\n        The bounding box ``((ymin, ymax), (xmin, xmax))`` of the minimal\n        rectangular region of the cutout array with respect to the\n        cutout array.  For ``mode='partial'``, the bounding box indices\n        are for the valid (non-filled) cutout values.\n        \"\"\"\n        return self._calc_bbox(self.slices_cutout)"},{"col":4,"comment":"null","endLoc":610,"header":"def __init__(self, data, position, size, wcs=None, mode='trim',\n                 fill_value=np.nan, copy=False)","id":238,"name":"__init__","nodeType":"Function","startLoc":520,"text":"def __init__(self, data, position, size, wcs=None, mode='trim',\n                 fill_value=np.nan, copy=False):\n        if wcs is None:\n            wcs = getattr(data, 'wcs', None)\n\n        if isinstance(position, SkyCoord):\n            if wcs is None:\n                raise ValueError('wcs must be input if position is a '\n                                 'SkyCoord')\n            position = skycoord_to_pixel(position, wcs, mode='all')  # (x, y)\n\n        if np.isscalar(size):\n            size = np.repeat(size, 2)\n\n        # special handling for a scalar Quantity\n        if isinstance(size, u.Quantity):\n            size = np.atleast_1d(size)\n            if len(size) == 1:\n                size = np.repeat(size, 2)\n\n        if len(size) > 2:\n            raise ValueError('size must have at most two elements')\n\n        shape = np.zeros(2).astype(int)\n        pixel_scales = None\n        # ``size`` can have a mixture of int and Quantity (and even units),\n        # so evaluate each axis separately\n        for axis, side in enumerate(size):\n            if not isinstance(side, u.Quantity):\n                shape[axis] = int(np.round(size[axis]))     # pixels\n            else:\n                if side.unit == u.pixel:\n                    shape[axis] = int(np.round(side.value))\n                elif side.unit.physical_type == 'angle':\n                    if wcs is None:\n                        raise ValueError('wcs must be input if any element '\n                                         'of size has angular units')\n                    if pixel_scales is None:\n                        pixel_scales = u.Quantity(\n                            proj_plane_pixel_scales(wcs), wcs.wcs.cunit[axis])\n                    shape[axis] = int(np.round(\n                        (side / pixel_scales[axis]).decompose()))\n                else:\n                    raise ValueError('shape can contain Quantities with only '\n                                     'pixel or angular units')\n\n        data = np.asanyarray(data)\n        # reverse position because extract_array and overlap_slices\n        # use (y, x), but keep the input position\n        pos_yx = position[::-1]\n\n        cutout_data, input_position_cutout = extract_array(\n            data, tuple(shape), pos_yx, mode=mode, fill_value=fill_value,\n            return_position=True)\n        if copy:\n            cutout_data = np.copy(cutout_data)\n        self.data = cutout_data\n\n        self.input_position_cutout = input_position_cutout[::-1]    # (x, y)\n        slices_original, slices_cutout = overlap_slices(\n            data.shape, shape, pos_yx, mode=mode)\n\n        self.slices_original = slices_original\n        self.slices_cutout = slices_cutout\n\n        self.shape = self.data.shape\n        self.input_position_original = position\n        self.shape_input = shape\n\n        ((self.ymin_original, self.ymax_original),\n         (self.xmin_original, self.xmax_original)) = self.bbox_original\n\n        ((self.ymin_cutout, self.ymax_cutout),\n         (self.xmin_cutout, self.xmax_cutout)) = self.bbox_cutout\n\n        # the true origin pixel of the cutout array, including any\n        # filled cutout values\n        self._origin_original_true = (\n            self.origin_original[0] - self.slices_cutout[1].start,\n            self.origin_original[1] - self.slices_cutout[0].start)\n\n        if wcs is not None:\n            self.wcs = deepcopy(wcs)\n            self.wcs.wcs.crpix -= self._origin_original_true\n            self.wcs.array_shape = self.data.shape\n            if wcs.sip is not None:\n                self.wcs.sip = Sip(wcs.sip.a, wcs.sip.b,\n                                   wcs.sip.ap, wcs.sip.bp,\n                                   wcs.sip.crpix - self._origin_original_true)\n        else:\n            self.wcs = None"},{"attributeType":"null","col":4,"comment":"null","endLoc":112,"id":239,"name":"templates_path","nodeType":"Attribute","startLoc":112,"text":"templates_path"},{"attributeType":"null","col":0,"comment":"null","endLoc":119,"id":240,"name":"setup_cfg","nodeType":"Attribute","startLoc":119,"text":"setup_cfg"},{"col":0,"comment":"","endLoc":8,"header":"conftest.py#<anonymous>","id":241,"name":"<anonymous>","nodeType":"Function","startLoc":8,"text":"os.environ['XDG_CONFIG_HOME'] = tempfile.mkdtemp('astropy_config')\n\nos.environ['XDG_CACHE_HOME'] = tempfile.mkdtemp('astropy_cache')\n\nos.mkdir(os.path.join(os.environ['XDG_CONFIG_HOME'], 'astropy'))\n\nos.mkdir(os.path.join(os.environ['XDG_CACHE_HOME'], 'astropy'))"},{"id":242,"name":"docs/_static","nodeType":"Package"},{"id":243,"name":"astropy_banner.svg","nodeType":"TextFile","path":"docs/_static","text":"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<svg\n   xmlns:osb=\"http://www.openswatchbook.org/uri/2009/osb\"\n   xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n   xmlns:cc=\"http://creativecommons.org/ns#\"\n   xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n   xmlns:svg=\"http://www.w3.org/2000/svg\"\n   xmlns=\"http://www.w3.org/2000/svg\"\n   xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n   version=\"1.1\"\n   id=\"svg2\"\n   height=\"220\"\n   width=\"1200\">\n  <defs\n     id=\"defs4\">\n    <linearGradient\n       id=\"linearGradient3767\">\n      <stop\n         style=\"stop-color:#ffa900;stop-opacity:1;\"\n         offset=\"0\"\n         id=\"stop3800\" />\n      <stop\n         style=\"stop-color:#fd0000;stop-opacity:1;\"\n         offset=\"1\"\n         id=\"stop3775\" />\n    </linearGradient>\n    <linearGradient\n       spreadMethod=\"repeat\"\n       gradientUnits=\"userSpaceOnUse\"\n       y2=\"298.258\"\n       x2=\"83.651718\"\n       y1=\"163.12114\"\n       x1=\"195.5511\"\n       id=\"linearGradient3798\"\n       xlink:href=\"#linearGradient3767\" />\n  </defs>\n  <g\n     transform=\"translate(2.5547457,54.766869)\"\n     id=\"layer1\">\n    <g\n       id=\"text3084\"\n       style=\"line-height:125%\">\n      <path\n         id=\"path4169\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 228.57097,43.364565 c 0,14.62 10.2,24.48 24.82,24.48 9.86,0 18.36,-4.93 25.84,-11.22 l 0.51,0 1.53,9.18 15.98,0 0,-49.47 c 0,-23.2899996 -10.2,-36.04 -31.11,-36.04 -13.26,0 -24.99,5.1 -34.17,10.8800004 l 7.14,13.09 c 7.31,-4.41999997 15.13,-8.16 23.46,-8.16 11.22,0 14.96,7.48 15.13,16.3199996 -34.17,3.74 -49.13,13.09 -49.13,30.94 z m 19.04,-1.53 c 0,-8.33 7.48,-14.28 30.09,-17.17 l 0,18.7 c -6.12,5.78 -11.39,9.18 -18.19,9.18 -6.97,0 -11.9,-3.23 -11.9,-10.71 z\" />\n      <path\n         id=\"path4171\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 312.79535,56.284565 c 8.16,6.63 20.23,11.56 31.62,11.56 21.08,0 32.47,-11.56 32.47,-25.84 0,-15.64 -12.58,-21.08 -23.97,-25.33 -9.01,-3.23 -17.34,-5.78 -17.34,-12.4099996 0,-5.27 3.91,-9.18 12.24,-9.18 6.63,0 12.58,2.89 18.36,7.14 l 9.01,-11.9 c -6.8,-5.2700004 -16.15,-10.0300004 -27.71,-10.0300004 -18.7,0 -30.43,10.3700004 -30.43,24.9900004 0,13.9399996 12.41,20.2299996 23.46,24.3099996 8.84,3.4 17.85,6.46 17.85,13.43 0,5.78 -4.25,10.03 -13.26,10.03 -8.5,0 -15.64,-3.57 -23.12,-9.35 l -9.18,12.58 z\" />\n      <path\n         id=\"path4173\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 397.39425,37.584565 c 0,18.02 7.14,30.26 26.52,30.26 6.63,0 12.41,-1.53 17,-3.06 l -3.4,-14.45 c -2.38,1.02 -5.78,1.87 -8.67,1.87 -7.99,0 -11.73,-4.76 -11.73,-14.62 l 0,-39.7799996 21.25,0 0,-15.4700004 -21.25,0 0,-22.78 -16.32,0 -2.38,22.78 -12.92,0.85 0,14.6200004 11.9,0 0,39.7799996 z\" />\n      <path\n         id=\"path4175\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 455.93003,65.804565 19.55,0 0,-51 c 5.1,-12.5799996 13.09,-17.1699996 19.72,-17.1699996 3.57,0 5.78,0.51 8.67,1.36 l 3.4,-17.0000004 c -2.55,-1.19 -5.27,-1.7 -9.52,-1.7 -8.84,0 -17.68,5.95 -23.63,16.8300004 l -0.68,0 -1.36,-14.7900004 -16.15,0 0,83.47 z\" />\n      <path\n         id=\"path4177\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 512.24785,24.154565 c 0,27.71 18.87,43.69 39.61,43.69 20.91,0 39.78,-15.98 39.78,-43.69 0,-27.8799996 -18.87,-43.86 -39.78,-43.86 -20.74,0 -39.61,15.9800004 -39.61,43.86 z m 20.06,0 c 0,-16.8299996 7.31,-27.8799996 19.55,-27.8799996 12.24,0 19.72,11.05 19.72,27.8799996 0,16.66 -7.48,27.71 -19.72,27.71 -12.24,0 -19.55,-11.05 -19.55,-27.71 z\" />\n      <path\n         id=\"path4179\"\n         style=\"fill:#ff5000;fill-opacity:1\"\n         d=\"m 621.69863,57.814565 c 8.5,6.29 16.83,10.03 24.48,10.03 19.21,0 36.04,-16.32 36.04,-44.03 0,-25.3299996 -10.88,-41.65 -32.64,-41.65 -10.03,0 -19.72,5.95 -27.71,12.2400004 l -0.51,0 -0.68,-10.2000004 -6.46,0 0,118.490005 7.48,0 0,-29.750005 0,-15.13 z m 0,-7.14 0,-48.4499996 c 9.86,-8.67 18.53,-13.4300004 26.69,-13.4300004 18.7,0 25.84,14.9600004 25.84,35.02 0,22.1 -11.9,37.4 -28.39,37.4 -6.29,0 -14.79,-2.89 -24.14,-10.54 z\" />\n      <path\n         id=\"path4181\"\n         style=\"fill:#ff5000;fill-opacity:1\"\n         d=\"m 696.99535,94.704565 -1.7,6.630005 c 2.21,1.02 5.27,1.7 8.33,1.7 14.62,0 22.78,-13.430005 27.37,-27.030005 l 32.3,-91.8 -7.65,0 -17.51,51.34 c -2.21,6.8 -4.93,15.64 -7.48,22.78 l -0.68,0 c -3.06,-7.14 -6.29,-15.98 -8.84,-22.78 l -19.72,-51.34 -8.16,0 33.49,83.13 -2.21,7.14 c -4.08,12.41 -10.88,21.59 -20.91,21.59 -2.38,0 -4.93,-0.68 -6.63,-1.36 z\" />\n    </g>\n    <g\n       id=\"text3858\"\n       style=\"line-height:125%\">\n      <path\n         id=\"path4184\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 238.5584,128.98857 1.488,-4.8 c 1.152,-3.504 2.16,-6.96 3.12,-10.608 l 0.192,0 c 1.008,3.648 2.016,7.104 3.168,10.608 l 1.488,4.8 -9.456,0 z m 13.44,12.816 4.272,0 -10.656,-31.488 -4.512,0 -10.656,31.488 4.08,0 3.024,-9.6 11.472,0 2.976,9.6 z\" />\n      <path\n         id=\"path4186\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 268.6109,126.06057 c 0,10.272 5.856,16.32 13.776,16.32 4.032,0 7.104,-1.68 9.6,-4.56 l -2.256,-2.448 c -2.016,2.256 -4.224,3.504 -7.248,3.504 -5.952,0 -9.744,-4.992 -9.744,-12.912 0,-7.824 3.936,-12.72 9.936,-12.72 2.64,0 4.656,1.152 6.288,2.928 l 2.256,-2.544 c -1.824,-2.064 -4.8,-3.888 -8.592,-3.888 -8.064,0 -14.016,6.192 -14.016,16.32 z\" />\n      <path\n         id=\"path4188\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 295.6979,130.18857 c 0,7.728 5.088,12.192 10.8,12.192 5.712,0 10.8,-4.464 10.8,-12.192 0,-7.824 -5.088,-12.288 -10.8,-12.288 -5.712,0 -10.8,4.464 -10.8,12.288 z m 4.08,0 c 0,-5.376 2.736,-9.024 6.72,-9.024 4.032,0 6.72,3.648 6.72,9.024 0,5.328 -2.688,8.928 -6.72,8.928 -3.984,0 -6.72,-3.6 -6.72,-8.928 z\" />\n      <path\n         id=\"path4190\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 323.4884,141.80457 3.936,0 0,-16.896 c 2.16,-2.4 4.128,-3.6 5.856,-3.6 2.976,0 4.368,1.872 4.368,6.24 l 0,14.256 3.936,0 0,-16.896 c 2.16,-2.4 4.032,-3.6 5.856,-3.6 2.928,0 4.32,1.872 4.32,6.24 l 0,14.256 3.936,0 0,-14.784 c 0,-5.952 -2.304,-9.12 -7.104,-9.12 -2.832,0 -5.232,1.824 -7.68,4.464 -0.96,-2.784 -2.88,-4.464 -6.432,-4.464 -2.784,0 -5.232,1.728 -7.248,3.936 l -0.144,0 -0.336,-3.36 -3.264,0 0,23.328 z\" />\n      <path\n         id=\"path4192\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 363.2384,141.80457 3.936,0 0,-16.896 c 2.16,-2.4 4.128,-3.6 5.856,-3.6 2.976,0 4.368,1.872 4.368,6.24 l 0,14.256 3.936,0 0,-16.896 c 2.16,-2.4 4.032,-3.6 5.856,-3.6 2.928,0 4.32,1.872 4.32,6.24 l 0,14.256 3.936,0 0,-14.784 c 0,-5.952 -2.304,-9.12 -7.104,-9.12 -2.832,0 -5.232,1.824 -7.68,4.464 -0.96,-2.784 -2.88,-4.464 -6.432,-4.464 -2.784,0 -5.232,1.728 -7.248,3.936 l -0.144,0 -0.336,-3.36 -3.264,0 0,23.328 z\" />\n      <path\n         id=\"path4194\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 402.6524,133.26057 c 0,5.952 2.208,9.12 7.152,9.12 3.216,0 5.52,-1.68 7.68,-4.224 l 0.144,0 0.336,3.648 3.264,0 0,-23.328 -3.936,0 0,16.56 c -2.208,2.736 -3.888,3.936 -6.288,3.936 -3.072,0 -4.368,-1.872 -4.368,-6.24 l 0,-14.256 -3.984,0 0,14.784 z\" />\n      <path\n         id=\"path4196\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 429.14465,141.80457 3.936,0 0,-16.896 c 2.352,-2.352 3.984,-3.6 6.384,-3.6 3.072,0 4.416,1.872 4.416,6.24 l 0,14.256 3.936,0 0,-14.784 c 0,-5.952 -2.208,-9.12 -7.104,-9.12 -3.216,0 -5.616,1.728 -7.824,3.936 l -0.144,0 -0.336,-3.36 -3.264,0 0,23.328 z\" />\n      <path\n         id=\"path4198\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 457.41065,113.67657 c 1.536,0 2.736,-1.056 2.736,-2.544 0,-1.536 -1.2,-2.544 -2.736,-2.544 -1.536,0 -2.736,1.008 -2.736,2.544 0,1.488 1.2,2.544 2.736,2.544 z m -2.016,28.128 3.936,0 0,-23.328 -3.936,0 0,23.328 z\" />\n      <path\n         id=\"path4200\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 467.87915,134.60457 c 0,4.608 1.68,7.776 6.672,7.776 1.44,0 3.024,-0.432 4.32,-0.864 l -0.768,-2.976 c -0.768,0.288 -1.824,0.624 -2.64,0.624 -2.688,0 -3.6,-1.632 -3.6,-4.512 l 0,-12.96 6.288,0 0,-3.216 -6.288,0 0,-6.528 -3.312,0 -0.48,6.528 -3.648,0.24 0,2.976 3.456,0 0,12.912 z\" />\n      <path\n         id=\"path4202\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 481.8419,148.23657 -0.768,3.12 c 0.768,0.288 1.68,0.48 2.736,0.48 4.704,0 7.104,-3.504 8.736,-8.112 l 8.784,-25.248 -3.84,0 -4.176,12.912 c -0.624,2.064 -1.296,4.464 -1.968,6.576 l -0.192,0 c -0.72,-2.16 -1.536,-4.56 -2.256,-6.576 l -4.752,-12.912 -4.08,0 9.36,23.376 -0.528,1.728 c -0.96,2.88 -2.64,4.992 -5.28,4.992 -0.576,0 -1.296,-0.192 -1.776,-0.336 z\" />\n      <path\n         id=\"path4204\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 515.8724,141.80457 3.984,0 0,-12.48 5.664,0 c 6.912,0 11.616,-3.12 11.616,-9.744 0,-6.912 -4.656,-9.264 -11.616,-9.264 l -9.648,0 0,31.488 z m 3.984,-15.744 0,-12.528 5.184,0 c 5.424,0 8.112,1.488 8.112,6.048 0,4.464 -2.64,6.48 -8.112,6.48 l -5.184,0 z\" />\n      <path\n         id=\"path4206\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 541.56065,148.23657 -0.768,3.12 c 0.768,0.288 1.68,0.48 2.736,0.48 4.704,0 7.104,-3.504 8.736,-8.112 l 8.784,-25.248 -3.84,0 -4.176,12.912 c -0.624,2.064 -1.296,4.464 -1.968,6.576 l -0.192,0 c -0.72,-2.16 -1.536,-4.56 -2.256,-6.576 l -4.752,-12.912 -4.08,0 9.36,23.376 -0.528,1.728 c -0.96,2.88 -2.64,4.992 -5.28,4.992 -0.576,0 -1.296,-0.192 -1.776,-0.336 z\" />\n      <path\n         id=\"path4208\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 566.2229,134.60457 c 0,4.608 1.68,7.776 6.672,7.776 1.44,0 3.024,-0.432 4.32,-0.864 l -0.768,-2.976 c -0.768,0.288 -1.824,0.624 -2.64,0.624 -2.688,0 -3.6,-1.632 -3.6,-4.512 l 0,-12.96 6.288,0 0,-3.216 -6.288,0 0,-6.528 -3.312,0 -0.48,6.528 -3.648,0.24 0,2.976 3.456,0 0,12.912 z\" />\n      <path\n         id=\"path4210\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 581.76965,141.80457 3.936,0 0,-16.896 c 2.352,-2.352 3.984,-3.6 6.384,-3.6 3.072,0 4.416,1.872 4.416,6.24 l 0,14.256 3.936,0 0,-14.784 c 0,-5.952 -2.208,-9.12 -7.104,-9.12 -3.216,0 -5.568,1.728 -7.776,3.84 l 0.144,-4.8 0,-9.312 -3.936,0 0,34.176 z\" />\n      <path\n         id=\"path4212\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 606.1979,130.18857 c 0,7.728 5.088,12.192 10.8,12.192 5.712,0 10.8,-4.464 10.8,-12.192 0,-7.824 -5.088,-12.288 -10.8,-12.288 -5.712,0 -10.8,4.464 -10.8,12.288 z m 4.08,0 c 0,-5.376 2.736,-9.024 6.72,-9.024 4.032,0 6.72,3.648 6.72,9.024 0,5.328 -2.688,8.928 -6.72,8.928 -3.984,0 -6.72,-3.6 -6.72,-8.928 z\" />\n      <path\n         id=\"path4214\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 633.9884,141.80457 3.936,0 0,-16.896 c 2.352,-2.352 3.984,-3.6 6.384,-3.6 3.072,0 4.416,1.872 4.416,6.24 l 0,14.256 3.936,0 0,-14.784 c 0,-5.952 -2.208,-9.12 -7.104,-9.12 -3.216,0 -5.616,1.728 -7.824,3.936 l -0.144,0 -0.336,-3.36 -3.264,0 0,23.328 z\" />\n      <path\n         id=\"path4216\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 670.27865,141.80457 17.76,0 0,-3.408 -13.776,0 0,-28.08 -3.984,0 0,31.488 z\" />\n      <path\n         id=\"path4218\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 695.2544,113.67657 c 1.536,0 2.736,-1.056 2.736,-2.544 0,-1.536 -1.2,-2.544 -2.736,-2.544 -1.536,0 -2.736,1.008 -2.736,2.544 0,1.488 1.2,2.544 2.736,2.544 z m -2.016,28.128 3.936,0 0,-23.328 -3.936,0 0,23.328 z\" />\n      <path\n         id=\"path4220\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 705.0509,141.80457 3.168,0 0.336,-2.304 0.144,0 c 2.064,1.824 4.512,2.88 6.672,2.88 5.328,0 10.08,-4.656 10.08,-12.624 0,-7.2 -3.216,-11.856 -9.264,-11.856 -2.592,0 -5.184,1.392 -7.296,3.264 l 0.096,-4.224 0,-9.312 -3.936,0 0,34.176 z m 3.936,-5.184 0,-12.24 c 2.208,-2.064 4.272,-3.168 6.24,-3.168 4.416,0 6.144,3.456 6.144,8.592 0,5.76 -2.832,9.264 -6.672,9.264 -1.536,0 -3.648,-0.672 -5.712,-2.448 z\" />\n      <path\n         id=\"path4222\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 731.6759,141.80457 3.936,0 0,-14.976 c 1.584,-3.936 3.936,-5.376 5.904,-5.376 0.96,0 1.488,0.144 2.256,0.384 l 0.768,-3.456 c -0.768,-0.336 -1.488,-0.48 -2.496,-0.48 -2.64,0 -5.04,1.872 -6.624,4.8 l -0.144,0 -0.336,-4.224 -3.264,0 0,23.328 z\" />\n      <path\n         id=\"path4224\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 745.99265,135.75657 c 0,4.176 2.928,6.624 6.864,6.624 2.88,0 5.472,-1.536 7.728,-3.36 l 0.096,0 0.336,2.784 3.264,0 0,-14.304 c 0,-5.808 -2.4,-9.6 -8.112,-9.6 -3.744,0 -7.008,1.632 -9.168,3.024 l 1.584,2.736 c 1.824,-1.248 4.224,-2.496 6.96,-2.496 3.792,0 4.8,2.88 4.8,5.856 -9.936,1.104 -14.352,3.648 -14.352,8.736 z m 3.888,-0.288 c 0,-2.976 2.64,-4.896 10.464,-5.856 l 0,6.48 c -2.256,2.016 -4.128,3.12 -6.384,3.12 -2.304,0 -4.08,-1.104 -4.08,-3.744 z\" />\n      <path\n         id=\"path4226\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 771.70715,141.80457 3.936,0 0,-14.976 c 1.584,-3.936 3.936,-5.376 5.904,-5.376 0.96,0 1.488,0.144 2.256,0.384 l 0.768,-3.456 c -0.768,-0.336 -1.488,-0.48 -2.496,-0.48 -2.64,0 -5.04,1.872 -6.624,4.8 l -0.144,0 -0.336,-4.224 -3.264,0 0,23.328 z\" />\n      <path\n         id=\"path4228\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 787.74815,148.23657 -0.768,3.12 c 0.768,0.288 1.68,0.48 2.736,0.48 4.704,0 7.104,-3.504 8.736,-8.112 l 8.784,-25.248 -3.84,0 -4.176,12.912 c -0.624,2.064 -1.296,4.464 -1.968,6.576 l -0.192,0 c -0.72,-2.16 -1.536,-4.56 -2.256,-6.576 l -4.752,-12.912 -4.08,0 9.36,23.376 -0.528,1.728 c -0.96,2.88 -2.64,4.992 -5.28,4.992 -0.576,0 -1.296,-0.192 -1.776,-0.336 z\" />\n      <path\n         id=\"path4230\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 832.77065,107.82057 c -1.056,-0.432 -2.448,-0.768 -3.888,-0.768 -4.656,0 -6.816,2.976 -6.816,7.728 l 0,3.696 -3.168,0.24 0,2.976 3.168,0 0,20.112 3.936,0 0,-20.112 4.944,0 0,-3.216 -4.944,0 0,-3.696 c 0,-2.976 1.056,-4.512 3.264,-4.512 0.864,0 1.776,0.192 2.64,0.576 l 0.864,-3.024 z\" />\n      <path\n         id=\"path4232\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 833.2604,130.18857 c 0,7.728 5.088,12.192 10.8,12.192 5.712,0 10.8,-4.464 10.8,-12.192 0,-7.824 -5.088,-12.288 -10.8,-12.288 -5.712,0 -10.8,4.464 -10.8,12.288 z m 4.08,0 c 0,-5.376 2.736,-9.024 6.72,-9.024 4.032,0 6.72,3.648 6.72,9.024 0,5.328 -2.688,8.928 -6.72,8.928 -3.984,0 -6.72,-3.6 -6.72,-8.928 z\" />\n      <path\n         id=\"path4234\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 861.0509,141.80457 3.936,0 0,-14.976 c 1.584,-3.936 3.936,-5.376 5.904,-5.376 0.96,0 1.488,0.144 2.256,0.384 l 0.768,-3.456 c -0.768,-0.336 -1.488,-0.48 -2.496,-0.48 -2.64,0 -5.04,1.872 -6.624,4.8 l -0.144,0 -0.336,-4.224 -3.264,0 0,23.328 z\" />\n      <path\n         id=\"path4236\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 891.71465,128.98857 1.488,-4.8 c 1.152,-3.504 2.16,-6.96 3.12,-10.608 l 0.192,0 c 1.008,3.648 2.016,7.104 3.168,10.608 l 1.488,4.8 -9.456,0 z m 13.44,12.816 4.272,0 -10.656,-31.488 -4.512,0 -10.656,31.488 4.08,0 3.024,-9.6 11.472,0 2.976,9.6 z\" />\n      <path\n         id=\"path4238\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 910.9589,139.16457 c 2.208,1.824 5.376,3.216 8.688,3.216 5.52,0 8.544,-3.168 8.544,-6.96 0,-4.416 -3.744,-5.808 -7.104,-7.056 -2.64,-1.008 -5.184,-1.824 -5.184,-4.032 0,-1.776 1.344,-3.36 4.272,-3.36 2.064,0 3.744,0.864 5.328,2.064 l 1.872,-2.496 c -1.776,-1.44 -4.32,-2.64 -7.248,-2.64 -5.04,0 -8.016,2.88 -8.016,6.624 0,3.936 3.648,5.52 6.96,6.72 2.544,0.96 5.328,2.016 5.328,4.416 0,2.016 -1.536,3.648 -4.608,3.648 -2.784,0 -4.848,-1.152 -6.864,-2.784 l -1.968,2.64 z\" />\n      <path\n         id=\"path4240\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 934.37915,134.60457 c 0,4.608 1.68,7.776 6.672,7.776 1.44,0 3.024,-0.432 4.32,-0.864 l -0.768,-2.976 c -0.768,0.288 -1.824,0.624 -2.64,0.624 -2.688,0 -3.6,-1.632 -3.6,-4.512 l 0,-12.96 6.288,0 0,-3.216 -6.288,0 0,-6.528 -3.312,0 -0.48,6.528 -3.648,0.24 0,2.976 3.456,0 0,12.912 z\" />\n      <path\n         id=\"path4242\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 949.9259,141.80457 3.936,0 0,-14.976 c 1.584,-3.936 3.936,-5.376 5.904,-5.376 0.96,0 1.488,0.144 2.256,0.384 l 0.768,-3.456 c -0.768,-0.336 -1.488,-0.48 -2.496,-0.48 -2.64,0 -5.04,1.872 -6.624,4.8 l -0.144,0 -0.336,-4.224 -3.264,0 0,23.328 z\" />\n      <path\n         id=\"path4244\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 964.41665,130.18857 c 0,7.728 5.088,12.192 10.8,12.192 5.712,0 10.8,-4.464 10.8,-12.192 0,-7.824 -5.088,-12.288 -10.8,-12.288 -5.712,0 -10.8,4.464 -10.8,12.288 z m 4.08,0 c 0,-5.376 2.736,-9.024 6.72,-9.024 4.032,0 6.72,3.648 6.72,9.024 0,5.328 -2.688,8.928 -6.72,8.928 -3.984,0 -6.72,-3.6 -6.72,-8.928 z\" />\n      <path\n         id=\"path4246\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 992.20715,141.80457 3.936,0 0,-16.896 c 2.352,-2.352 3.98395,-3.6 6.38395,-3.6 3.072,0 4.416,1.872 4.416,6.24 l 0,14.256 3.936,0 0,-14.784 c 0,-5.952 -2.208,-9.12 -7.104,-9.12 -3.216,0 -5.61595,1.728 -7.82395,3.936 l -0.144,0 -0.336,-3.36 -3.264,0 0,23.328 z\" />\n      <path\n         id=\"path4248\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 1016.7291,130.18857 c 0,7.728 5.088,12.192 10.8,12.192 5.712,0 10.8,-4.464 10.8,-12.192 0,-7.824 -5.088,-12.288 -10.8,-12.288 -5.712,0 -10.8,4.464 -10.8,12.288 z m 4.08,0 c 0,-5.376 2.736,-9.024 6.72,-9.024 4.032,0 6.72,3.648 6.72,9.024 0,5.328 -2.688,8.928 -6.72,8.928 -3.984,0 -6.72,-3.6 -6.72,-8.928 z\" />\n      <path\n         id=\"path4250\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 1044.5196,141.80457 3.936,0 0,-16.896 c 2.16,-2.4 4.128,-3.6 5.856,-3.6 2.976,0 4.368,1.872 4.368,6.24 l 0,14.256 3.936,0 0,-16.896 c 2.16,-2.4 4.032,-3.6 5.856,-3.6 2.928,0 4.32,1.872 4.32,6.24 l 0,14.256 3.936,0 0,-14.784 c 0,-5.952 -2.304,-9.12 -7.104,-9.12 -2.832,0 -5.232,1.824 -7.68,4.464 -0.96,-2.784 -2.88,-4.464 -6.432,-4.464 -2.784,0 -5.232,1.728 -7.248,3.936 l -0.144,0 -0.336,-3.36 -3.264,0 0,23.328 z\" />\n      <path\n         id=\"path4252\"\n         style=\"fill:#4d4d4d;fill-opacity:1\"\n         d=\"m 1082.6856,148.23657 -0.768,3.12 c 0.768,0.288 1.68,0.48 2.736,0.48 4.704,0 7.104,-3.504 8.736,-8.112 l 8.784,-25.248 -3.84,0 -4.176,12.912 c -0.624,2.064 -1.296,4.464 -1.968,6.576 l -0.192,0 c -0.72,-2.16 -1.536,-4.56 -2.256,-6.576 l -4.752,-12.912 -4.08,0 9.36,23.376 -0.528,1.728 c -0.96,2.88 -2.64,4.992 -5.28,4.992 -0.576,0 -1.296,-0.192 -1.776,-0.336 z\" />\n    </g>\n    <path\n       clip-path=\"none\"\n       mask=\"none\"\n       transform=\"matrix(1.0651076,-0.90408718,0.89013474,1.0731629,-250.16148,-67.548145)\"\n       d=\"m 221.23922,233.12846 a 80.322945,68.372307 0 0 1 -80.32294,68.37231 80.322945,68.372307 0 0 1 -80.32295,-68.37231 80.322945,68.372307 0 0 1 80.32295,-68.3723 80.322945,68.372307 0 0 1 80.32294,68.3723 z\"\n       id=\"path3837\"\n       style=\"fill:url(#linearGradient3798);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-opacity:1\" />\n    <path\n       transform=\"matrix(-0.71212781,-0.99456325,-0.9777811,0.72852659,474.31246,145.67479)\"\n       d=\"m 238.396,198.78328 c 32.61949,7.06756 15.40308,37.20961 -8.24653,38.06088 -26.00022,0.93589 -44.08994,-24.61831 -41.97511,-48.94224 2.67817,-30.80329 32.53302,-51.80129 62.38812,-48.26147\"\n       id=\"path5413\"\n       style=\"fill:none;stroke:#ffffff;stroke-width:14.33045673;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none\" />\n    <path\n       transform=\"matrix(1.0512298,0.82294962,-0.97239782,0.94168108,304.90482,-361.44933)\"\n       d=\"m 144.4518,337.67926 a 22.223356,12.626906 0 0 1 -22.22335,12.62691 22.223356,12.626906 0 0 1 -22.22336,-12.62691 22.223356,12.626906 0 0 1 22.22336,-12.62691 22.223356,12.626906 0 0 1 22.22335,12.62691 z\"\n       id=\"path3819\"\n       style=\"fill:#ffffff;fill-opacity:1;stroke:none\" />\n    <path\n       id=\"path3853\"\n       d=\"m 136.88413,-13.10567 13.09858,22.1959915 20.1541,-20.0243955 -25.57713,-10.690029 z\"\n       style=\"fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:2.36031604;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none\" />\n    <g\n       transform=\"matrix(0.95039189,0,0,0.93299787,-2.487134,-0.56516029)\"\n       id=\"g3804\">\n      <path\n         style=\"fill:none;stroke:#ffffff;stroke-width:3.72635746;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none\"\n         d=\"m 142.07904,-24.83606 -2.29208,-13.70422 0.18559,0.452199 0,0\"\n         id=\"path3855-7\" />\n      <path\n         style=\"fill:none;stroke:#ffffff;stroke-width:4.02542162;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none\"\n         d=\"m 127.81295,-26.11257 15.12343,0.663566 -0.4755,0.06597 0,0\"\n         id=\"path3855-7-0\" />\n      <path\n         style=\"fill:none;stroke:#ffffff;stroke-width:4.06302309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none\"\n         d=\"m 150.77669,-18.240009 -9.57586,-7.57806 0.46343,0.302121 0,0\"\n         id=\"path3855-7-05\" />\n    </g>\n    <path\n       id=\"path3942\"\n       d=\"m 67.476992,131.73602 c 3.410653,2.96251 14.804165,7.71706 18.766169,12.74152 4.041356,5.12504 3.407665,10.98393 3.371624,14.32634\"\n       style=\"fill:none;stroke:#ffffff;stroke-width:17.45736313;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none\" />\n    <path\n       transform=\"matrix(0.95949998,0.82835015,0.79893463,-0.95307413,-285.3304,56.888018)\"\n       d=\"m 238.396,198.78328 c 32.61946,7.06755 15.40307,37.20957 -8.24652,38.06085 -26.0002,0.93588 -44.0899,-24.61829 -41.97507,-48.9422 2.70006,-31.05511 32.97695,-52.07076 63.01891,-48.18321 1.11735,0.14459 2.2306,0.32088 3.33799,0.52843\"\n       id=\"path2987-5\"\n       style=\"fill:none;stroke:#ffffff;stroke-width:13.93870544;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none\" />\n  </g>\n</svg>\n"},{"id":244,"name":"docs/changes","nodeType":"Package"},{"id":245,"name":"template.rst","nodeType":"TextFile","path":"docs/changes","text":"{% if top_line %}\n{{ top_line }}\n{{ top_underline * ((top_line)|length)}}\n{% elif versiondata.name %}\n{{ versiondata.name }} {{ versiondata.version }} ({{ versiondata.date }})\n{{ top_underline * ((versiondata.name + versiondata.version + versiondata.date)|length + 4)}}\n{% else %}\n{{ versiondata.version }} ({{ versiondata.date }})\n{{ top_underline * ((versiondata.version + versiondata.date)|length + 3)}}\n{% endif %}\n\n{% for category, val in definitions.items() %}\n\n{% set underline = underlines[0] %}\n{{ definitions[category]['name'] }}\n{{ underline * definitions[category]['name']|length }}\n{% set underline = underlines[1] %}\n\n{% for section, _ in sections.items() %}\n{% if section and category in sections[section] %}\n{{section}}\n{{ underline * section|length }}\n\n{% endif %}\n{% if sections[section] and category in sections[section] %}\n{% if definitions[category]['showcontent'] %}\n{% for text, values in sections[section][category].items() %}\n- {{ text }} [{{ values|join(', ') }}]\n\n{% endfor %}\n{% else %}\n- {{ sections[section][category]['']|join(', ') }}\n\n{% endif %}\n{% if sections[section][category]|length == 0 %}\nNo significant changes.\n\n{% else %}\n{% endif %}\n{% else %}\n{# No significant changes. #}\n{% endif %}\n{% endfor %}\n{% endfor %}\n"},{"id":246,"name":"README.rst","nodeType":"TextFile","path":"docs/changes","text":":orphan:\n\nChangelog\n=========\n\nThis directory contains \"news fragments\" which are short files that contain a\nsmall **ReST**-formatted text that will be added to the next what's new page.\n\nMake sure to use full sentences with correct case and punctuation.\n\nEach file should be named like ``<PULL REQUEST>.<TYPE>.rst``, where\n``<PULL REQUEST>`` is a pull request number, and ``<TYPE>`` is one of:\n\n* ``feature``: New feature.\n* ``api``: API change.\n* ``bugfix``: Bug fix.\n* ``other``: Other changes and additions.\n\nIf the change concern a sub-package, the file should go in the sub-directory\nrelative to this sub-package.\n\nIt is possible to add two files with different categories (and text) if both\nare relevant. For example a change may add a new feature but introduce an API\nchange.\n\nSo for example: ``123.feature.rst`` would have the content::\n\n    The ``my_new_feature`` option is now available for ``my_favorite_function``.\n    To use it, write ``np.my_favorite_function(..., my_new_feature=True)``.\n\nNote the use of double-backticks for code.\n\nIf you are unsure what pull request type to use, don't hesitate to ask in your\nPR.\n\nYou can install ``towncrier`` and run ``towncrier --draft --version 4.3``\nif you want to get a preview of how your change will look in the final release\nnotes.\n\n.. note::\n\n    This README was adapted from the Numpy changelog readme under the terms of\n    the MIT licence.\n"},{"id":247,"name":"docs/changes/wcs","nodeType":"Package"},{"id":248,"name":"12844.bugfix.rst","nodeType":"TextFile","path":"docs/changes/wcs","text":"Fixed a bug due to which ``naxis``, ``pixel_shape``, and\n``pixel_bounds`` attributes of ``astropy.wcs.WCS`` were not restored when\nan ``astropy.wcs.WCS`` object was unpickled. This fix also eliminates\n``FITSFixedWarning`` warning issued during unpiclikng of the WCS objects\nrelated to the number of axes. This fix also eliminates errors when\nunpickling WCS objects originally created using non-default values for\n`key`, `colsel`, and `keysel` parameters.\n"},{"id":249,"name":"12514.feature.rst","nodeType":"TextFile","path":"docs/changes/wcs","text":"``astropy.wcs.Celprm`` and ``astropy.wcs.Prjprm`` have been added\nto allow access to lower level WCSLIB functionality and to allow direct\naccess to the ``cel`` and ``prj`` members of ``Wcsprm``.\n"},{"id":250,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/wcs","text":""},{"id":251,"name":"docs/changes/samp","nodeType":"Package"},{"id":252,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/samp","text":""},{"id":253,"name":"docs/changes/time","nodeType":"Package"},{"id":254,"name":"12888.api.rst","nodeType":"TextFile","path":"docs/changes/time","text":"Creating an `~astropy.time.TimeDelta` object with numerical inputs\nthat do not have a unit and without specifying an explicit format,\nfor example ``TimeDelta(5)``,\nnow results in a `~astropy.time.TimeDeltaMissingUnitWarning`.\nThis also affects statements like ``Time(\"2020-01-01\") + 5`` or\n``Time(\"2020-01-05\") - Time(\"2020-01-03\") < 5``, which implicitly\ntransform the right-hand side into an `~astropy.time.TimeDelta` instance.\n"},{"id":255,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/time","text":""},{"col":0,"comment":"","endLoc":4,"header":"programmatic.py#<anonymous>","id":256,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"w = wcs.WCS(naxis=2)\n\nw.wcs.crpix = [-234.75, 8.3393]\n\nw.wcs.cdelt = np.array([-0.066667, 0.066667])\n\nw.wcs.crval = [0, -90]\n\nw.wcs.ctype = [\"RA---AIR\", \"DEC--AIR\"]\n\nw.wcs.set_pv([(2, 1, 45.0)])\n\npixcrd = np.array([[0, 0], [24, 38], [45, 98]], dtype=np.float64)\n\nworld = w.wcs_pix2world(pixcrd, 0)\n\nprint(world)\n\npixcrd2 = w.wcs_world2pix(world, 0)\n\nprint(pixcrd2)\n\nassert np.max(np.abs(pixcrd - pixcrd2)) < 1e-6\n\nx = 0\n\ny = 0\n\norigin = 0\n\nassert (w.wcs_pix2world(x, y, origin) ==\n        w.wcs_pix2world(x + 1, y + 1, origin + 1))\n\nheader = w.to_header()\n\nhdu = fits.PrimaryHDU(header=header)"},{"id":257,"name":"docs/changes/stats","nodeType":"Package"},{"id":258,"name":"12896.bugfix.rst","nodeType":"TextFile","path":"docs/changes/stats","text":"Fixed a bug in which running ``kuiper_false_positive_probability(D,N)`` on distributions with many data points could produce NaN values for the false positive probability of the Kuiper statistic.\n"},{"id":260,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/stats","text":""},{"id":261,"name":"docs/changes/table","nodeType":"Package"},{"id":262,"name":"12680.feature.rst","nodeType":"TextFile","path":"docs/changes/table","text":"Improve the performance of ``np.searchsorted`` by a factor of 1000 for a\nbytes-type ``Column`` when the search value is ``str`` or an array of ``str``.\nThis happens commonly for string data stored in FITS or HDF5 format files.\n"},{"id":263,"name":"12716.bugfix.rst","nodeType":"TextFile","path":"docs/changes/table","text":"Fixed a bug in ``Table.show_in_browser`` using the ``jsviewer=True`` option\nto display the table with sortable columns. Previously the sort direction arrows\nwere not being shown due to missing image files for the arrows.\n"},{"col":0,"comment":"\n    Returns the 'mode' string of a file-like object if such a thing exists.\n    Otherwise returns None.\n    ","endLoc":471,"header":"def fileobj_mode(f)","id":264,"name":"fileobj_mode","nodeType":"Function","startLoc":441,"text":"def fileobj_mode(f):\n    \"\"\"\n    Returns the 'mode' string of a file-like object if such a thing exists.\n    Otherwise returns None.\n    \"\"\"\n\n    # Go from most to least specific--for example gzip objects have a 'mode'\n    # attribute, but it's not analogous to the file.mode attribute\n\n    # gzip.GzipFile -like\n    if hasattr(f, 'fileobj') and hasattr(f.fileobj, 'mode'):\n        fileobj = f.fileobj\n\n    # astropy.io.fits._File -like, doesn't need additional checks because it's\n    # already validated\n    elif hasattr(f, 'fileobj_mode'):\n        return f.fileobj_mode\n\n    # PIL-Image -like investigate the fp (filebuffer)\n    elif hasattr(f, 'fp') and hasattr(f.fp, 'mode'):\n        fileobj = f.fp\n\n    # FILEIO -like (normal open(...)), keep as is.\n    elif hasattr(f, 'mode'):\n        fileobj = f\n\n    # Doesn't look like a file-like object, for example strings, urls or paths.\n    else:\n        return None\n\n    return _fileobj_normalize_mode(fileobj)"},{"id":265,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/table","text":""},{"id":266,"name":"12637.feature.rst","nodeType":"TextFile","path":"docs/changes/table","text":"A new keyword-only argument ``kind`` was added to the ``Table.sort`` method to\nspecify the sort algorithm.\n"},{"col":0,"comment":"Takes care of some corner cases in Python where the mode string\n    is either oddly formatted or does not truly represent the file mode.\n    ","endLoc":496,"header":"def _fileobj_normalize_mode(f)","id":267,"name":"_fileobj_normalize_mode","nodeType":"Function","startLoc":474,"text":"def _fileobj_normalize_mode(f):\n    \"\"\"Takes care of some corner cases in Python where the mode string\n    is either oddly formatted or does not truly represent the file mode.\n    \"\"\"\n    mode = f.mode\n\n    # Special case: Gzip modes:\n    if isinstance(f, gzip.GzipFile):\n        # GzipFiles can be either readonly or writeonly\n        if mode == gzip.READ:\n            return 'rb'\n        elif mode == gzip.WRITE:\n            return 'wb'\n        else:\n            return None  # This shouldn't happen?\n\n    # Sometimes Python can produce modes like 'r+b' which will be normalized\n    # here to 'rb+'\n    if '+' in mode:\n        mode = mode.replace('+', '')\n        mode += '+'\n\n    return mode"},{"id":268,"name":"12637.api.rst","nodeType":"TextFile","path":"docs/changes/table","text":"A new keyword-only argument ``kind`` was added to the ``Table.sort`` method to\nspecify the sort algorithm. The signature of ``Table.sort`` was modified so that\nthe ``reverse`` argument is now keyword-only. Previously ``reverse`` could be\nspecified as the second positional argument.\n"},{"id":269,"name":"12631.api.rst","nodeType":"TextFile","path":"docs/changes/table","text":"Change the repr of the Table object to replace embedded newlines and tabs with\n``r'\\n'`` and ``r'\\t'`` respectively. This improves the display of such tables.\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":121,"id":270,"name":"__minimum_python_version__","nodeType":"Attribute","startLoc":121,"text":"__minimum_python_version__"},{"col":0,"comment":"\n    Convert a set of SkyCoord coordinates into pixels.\n\n    Parameters\n    ----------\n    coords : `~astropy.coordinates.SkyCoord`\n        The coordinates to convert.\n    wcs : `~astropy.wcs.WCS`\n        The WCS transformation to use.\n    origin : int\n        Whether to return 0 or 1-based pixel coordinates.\n    mode : 'all' or 'wcs'\n        Whether to do the transformation including distortions (``'all'``) or\n        only including only the core WCS transformation (``'wcs'``).\n\n    Returns\n    -------\n    xp, yp : `numpy.ndarray`\n        The pixel coordinates\n\n    See Also\n    --------\n    astropy.coordinates.SkyCoord.from_pixel\n    ","endLoc":569,"header":"def skycoord_to_pixel(coords, wcs, origin=0, mode='all')","id":271,"name":"skycoord_to_pixel","nodeType":"Function","startLoc":504,"text":"def skycoord_to_pixel(coords, wcs, origin=0, mode='all'):\n    \"\"\"\n    Convert a set of SkyCoord coordinates into pixels.\n\n    Parameters\n    ----------\n    coords : `~astropy.coordinates.SkyCoord`\n        The coordinates to convert.\n    wcs : `~astropy.wcs.WCS`\n        The WCS transformation to use.\n    origin : int\n        Whether to return 0 or 1-based pixel coordinates.\n    mode : 'all' or 'wcs'\n        Whether to do the transformation including distortions (``'all'``) or\n        only including only the core WCS transformation (``'wcs'``).\n\n    Returns\n    -------\n    xp, yp : `numpy.ndarray`\n        The pixel coordinates\n\n    See Also\n    --------\n    astropy.coordinates.SkyCoord.from_pixel\n    \"\"\"\n\n    if _has_distortion(wcs) and wcs.naxis != 2:\n        raise ValueError(\"Can only handle WCS with distortions for 2-dimensional WCS\")\n\n    # Keep only the celestial part of the axes, also re-orders lon/lat\n    wcs = wcs.sub([WCSSUB_LONGITUDE, WCSSUB_LATITUDE])\n\n    if wcs.naxis != 2:\n        raise ValueError(\"WCS should contain celestial component\")\n\n    # Check which frame the WCS uses\n    frame = wcs_to_celestial_frame(wcs)\n\n    # Check what unit the WCS needs\n    xw_unit = u.Unit(wcs.wcs.cunit[0])\n    yw_unit = u.Unit(wcs.wcs.cunit[1])\n\n    # Convert positions to frame\n    coords = coords.transform_to(frame)\n\n    # Extract longitude and latitude. We first try and use lon/lat directly,\n    # but if the representation is not spherical or unit spherical this will\n    # fail. We should then force the use of the unit spherical\n    # representation. We don't do that directly to make sure that we preserve\n    # custom lon/lat representations if available.\n    try:\n        lon = coords.data.lon.to(xw_unit)\n        lat = coords.data.lat.to(yw_unit)\n    except AttributeError:\n        lon = coords.spherical.lon.to(xw_unit)\n        lat = coords.spherical.lat.to(yw_unit)\n\n    # Convert to pixel coordinates\n    if mode == 'all':\n        xp, yp = wcs.all_world2pix(lon.value, lat.value, origin)\n    elif mode == 'wcs':\n        xp, yp = wcs.wcs_world2pix(lon.value, lat.value, origin)\n    else:\n        raise ValueError(\"mode should be either 'all' or 'wcs'\")\n\n    return xp, yp"},{"col":0,"comment":"null","endLoc":99,"header":"def _normalize_fits_mode(mode)","id":272,"name":"_normalize_fits_mode","nodeType":"Function","startLoc":89,"text":"def _normalize_fits_mode(mode):\n    if mode is not None and mode not in IO_FITS_MODES:\n        if TEXT_RE.match(mode):\n            raise ValueError(\n                \"Text mode '{}' not supported: \"\n                \"files must be opened in binary mode\".format(mode))\n        new_mode = FILE_MODES.get(mode)\n        if new_mode not in IO_FITS_MODES:\n            raise ValueError(f\"Mode '{mode}' not recognized\")\n        mode = new_mode\n    return mode"},{"id":273,"name":"docs/changes/tests","nodeType":"Package"},{"id":274,"name":"12633.api.4.rst","nodeType":"TextFile","path":"docs/changes/tests","text":"Backward-compatible import of ``astropy.tests.disable_internet``\nhas been removed; use ``pytest_remotedata.disable_internet``\nfrom ``pytest-remotedata`` instead.\n"},{"id":275,"name":"12633.api.2.rst","nodeType":"TextFile","path":"docs/changes/tests","text":"Backward-compatible import of ``astropy.tests.helper.remote_data``\nhas been removed; use ``pytest.mark.remote_data`` from ``pytest-remotedata``\ninstead.\n"},{"id":276,"name":"12633.api.3.rst","nodeType":"TextFile","path":"docs/changes/tests","text":"Backward-compatible plugin ``astropy.tests.plugins.display``\nhas been removed; use ``pytest-astropy-header`` instead.\n"},{"id":277,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/tests","text":""},{"id":278,"name":"12633.api.1.rst","nodeType":"TextFile","path":"docs/changes/tests","text":"The following are deprecated and will be removed in a future release.\nUse ``pytest`` warning and exception handling instead:\n\n* ``astropy.io.ascii.tests.common.raises``\n* ``astropy.tests.helper.catch_warnings``\n* ``astropy.tests.helper.ignore_warnings``\n* ``astropy.tests.helper.raises``\n* ``astropy.tests.helper.enable_deprecations_as_exceptions``\n* ``astropy.tests.helper.treat_deprecations_as_exceptions``\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":122,"id":279,"name":"project","nodeType":"Attribute","startLoc":122,"text":"project"},{"id":280,"name":"docs/changes/units","nodeType":"Package"},{"id":281,"name":"12566.feature.rst","nodeType":"TextFile","path":"docs/changes/units","text":"Implement multiplication and division of LogQuantities and numbers\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":124,"id":282,"name":"min_versions","nodeType":"Attribute","startLoc":124,"text":"min_versions"},{"attributeType":"null","col":4,"comment":"null","endLoc":125,"id":283,"name":"line","nodeType":"Attribute","startLoc":125,"text":"line"},{"id":284,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/units","text":""},{"col":0,"comment":"","endLoc":3,"header":"cube_wcs.py#<anonymous>","id":285,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"wcs_dict = {\n'CTYPE1': 'WAVE    ', 'CUNIT1': 'Angstrom', 'CDELT1': 0.2, 'CRPIX1': 0, 'CRVAL1': 10, 'NAXIS1': 5,\n'CTYPE2': 'HPLT-TAN', 'CUNIT2': 'deg', 'CDELT2': 0.5, 'CRPIX2': 2, 'CRVAL2': 0.5, 'NAXIS2': 4,\n'CTYPE3': 'HPLN-TAN', 'CUNIT3': 'deg', 'CDELT3': 0.4, 'CRPIX3': 2, 'CRVAL3': 1, 'NAXIS3': 3}\n\ninput_wcs = astropy.wcs.WCS(wcs_dict)"},{"col":4,"comment":"null","endLoc":546,"header":"def __init__(self, header=None, fobj=None, key=' ', minerr=0.0,\n                 relax=True, naxis=None, keysel=None, colsel=None,\n                 fix=True, translate_units='', _do_set=True)","id":286,"name":"__init__","nodeType":"Function","startLoc":380,"text":"def __init__(self, header=None, fobj=None, key=' ', minerr=0.0,\n                 relax=True, naxis=None, keysel=None, colsel=None,\n                 fix=True, translate_units='', _do_set=True):\n        close_fds = []\n\n        # these parameters are stored to be used when unpickling a WCS object:\n        self._init_kwargs = {\n            'keysel': copy.copy(keysel),\n            'colsel': copy.copy(colsel),\n        }\n\n        if header is None:\n            if naxis is None:\n                naxis = 2\n            wcsprm = _wcs.Wcsprm(header=None, key=key,\n                                 relax=relax, naxis=naxis)\n            self.naxis = wcsprm.naxis\n            # Set some reasonable defaults.\n            det2im = (None, None)\n            cpdis = (None, None)\n            sip = None\n        else:\n            keysel_flags = _parse_keysel(keysel)\n\n            if isinstance(header, (str, bytes)):\n                try:\n                    is_path = (possible_filename(header) and\n                               os.path.exists(header))\n                except (OSError, ValueError):\n                    is_path = False\n\n                if is_path:\n                    if fobj is not None:\n                        raise ValueError(\n                            \"Can not provide both a FITS filename to \"\n                            \"argument 1 and a FITS file object to argument 2\")\n                    fobj = fits.open(header)\n                    close_fds.append(fobj)\n                    header = fobj[0].header\n            elif isinstance(header, fits.hdu.image._ImageBaseHDU):\n                header = header.header\n            elif not isinstance(header, fits.Header):\n                try:\n                    # Accept any dict-like object\n                    orig_header = header\n                    header = fits.Header()\n                    for dict_key in orig_header.keys():\n                        header[dict_key] = orig_header[dict_key]\n                except TypeError:\n                    raise TypeError(\n                        \"header must be a string, an astropy.io.fits.Header \"\n                        \"object, or a dict-like object\")\n\n            if isinstance(header, fits.Header):\n                header_string = header.tostring().rstrip()\n            else:\n                header_string = header\n\n            # Importantly, header is a *copy* of the passed-in header\n            # because we will be modifying it\n            if isinstance(header_string, str):\n                header_bytes = header_string.encode('ascii')\n                header_string = header_string\n            else:\n                header_bytes = header_string\n                header_string = header_string.decode('ascii')\n\n            if not (fobj is None or isinstance(fobj, fits.HDUList)):\n                raise AssertionError(\"'fobj' must be either None or an \"\n                                     \"astropy.io.fits.HDUList object.\")\n\n            est_naxis = 2\n            try:\n                tmp_header = fits.Header.fromstring(header_string)\n                self._remove_sip_kw(tmp_header)\n                tmp_header_bytes = tmp_header.tostring().rstrip()\n                if isinstance(tmp_header_bytes, str):\n                    tmp_header_bytes = tmp_header_bytes.encode('ascii')\n                tmp_wcsprm = _wcs.Wcsprm(header=tmp_header_bytes, key=key,\n                                         relax=relax, keysel=keysel_flags,\n                                         colsel=colsel, warnings=False,\n                                         hdulist=fobj)\n                if naxis is not None:\n                    try:\n                        tmp_wcsprm = tmp_wcsprm.sub(naxis)\n                    except ValueError:\n                        pass\n                    est_naxis = tmp_wcsprm.naxis if tmp_wcsprm.naxis else 2\n\n            except _wcs.NoWcsKeywordsFoundError:\n                pass\n\n            self.naxis = est_naxis\n\n            header = fits.Header.fromstring(header_string)\n\n            det2im = self._read_det2im_kw(header, fobj, err=minerr)\n            cpdis = self._read_distortion_kw(\n                header, fobj, dist='CPDIS', err=minerr)\n            sip = self._read_sip_kw(header, wcskey=key)\n            self._remove_sip_kw(header)\n\n            header_string = header.tostring()\n            header_string = header_string.replace('END' + ' ' * 77, '')\n\n            if isinstance(header_string, str):\n                header_bytes = header_string.encode('ascii')\n                header_string = header_string\n            else:\n                header_bytes = header_string\n                header_string = header_string.decode('ascii')\n\n            try:\n                wcsprm = _wcs.Wcsprm(header=header_bytes, key=key,\n                                     relax=relax, keysel=keysel_flags,\n                                     colsel=colsel, hdulist=fobj)\n            except _wcs.NoWcsKeywordsFoundError:\n                # The header may have SIP or distortions, but no core\n                # WCS.  That isn't an error -- we want a \"default\"\n                # (identity) core Wcs transformation in that case.\n                if colsel is None:\n                    wcsprm = _wcs.Wcsprm(header=None, key=key,\n                                         relax=relax, keysel=keysel_flags,\n                                         colsel=colsel, hdulist=fobj)\n                else:\n                    raise\n\n            if naxis is not None:\n                wcsprm = wcsprm.sub(naxis)\n            self.naxis = wcsprm.naxis\n\n            if (wcsprm.naxis != 2 and\n                    (det2im[0] or det2im[1] or cpdis[0] or cpdis[1] or sip)):\n                raise ValueError(\n                    \"\"\"\nFITS WCS distortion paper lookup tables and SIP distortions only work\nin 2 dimensions.  However, WCSLIB has detected {} dimensions in the\ncore WCS keywords.  To use core WCS in conjunction with FITS WCS\ndistortion paper lookup tables or SIP distortion, you must select or\nreduce these to 2 dimensions using the naxis kwarg.\n\"\"\".format(wcsprm.naxis))\n\n            header_naxis = header.get('NAXIS', None)\n            if header_naxis is not None and header_naxis < wcsprm.naxis:\n                warnings.warn(\n                    \"The WCS transformation has more axes ({:d}) than the \"\n                    \"image it is associated with ({:d})\".format(\n                        wcsprm.naxis, header_naxis), FITSFixedWarning)\n\n        self._get_naxis(header)\n        WCSBase.__init__(self, sip, cpdis, wcsprm, det2im)\n\n        if fix:\n            if header is None:\n                with warnings.catch_warnings():\n                    warnings.simplefilter('ignore', FITSFixedWarning)\n                    self.fix(translate_units=translate_units)\n            else:\n                self.fix(translate_units=translate_units)\n\n        if _do_set:\n            self.wcs.set()\n\n        for fd in close_fds:\n            fd.close()\n\n        self._pixel_bounds = None"},{"attributeType":"null","col":4,"comment":"null","endLoc":126,"id":287,"name":"req","nodeType":"Attribute","startLoc":126,"text":"req"},{"attributeType":"null","col":38,"comment":"null","endLoc":132,"id":288,"name":"cl","nodeType":"Attribute","startLoc":132,"text":"cl"},{"attributeType":"null","col":0,"comment":"null","endLoc":138,"id":289,"name":"IGNORE_OUTPUT","nodeType":"Attribute","startLoc":138,"text":"IGNORE_OUTPUT"},{"col":0,"comment":"\n    `True` if contains any SIP or image distortion components.\n    ","endLoc":498,"header":"def _has_distortion(wcs)","id":290,"name":"_has_distortion","nodeType":"Function","startLoc":493,"text":"def _has_distortion(wcs):\n    \"\"\"\n    `True` if contains any SIP or image distortion components.\n    \"\"\"\n    return any(getattr(wcs, dist_attr) is not None\n               for dist_attr in ['cpdis1', 'cpdis2', 'det2im1', 'det2im2', 'sip'])"},{"id":291,"name":"12486.feature.rst","nodeType":"TextFile","path":"docs/changes/units","text":"``structured_to_unstructured`` and ``unstructured_to_structured`` in\n``numpy.lib.recfunctions`` now work with Quantity.\n"},{"col":0,"comment":"\n    Test whether a string is a valid URL for :func:`download_file`.\n\n    Parameters\n    ----------\n    string : str\n        The string to test.\n\n    Returns\n    -------\n    status : bool\n        String is URL or not.\n\n    ","endLoc":149,"header":"def is_url(string)","id":292,"name":"is_url","nodeType":"Function","startLoc":130,"text":"def is_url(string):\n    \"\"\"\n    Test whether a string is a valid URL for :func:`download_file`.\n\n    Parameters\n    ----------\n    string : str\n        The string to test.\n\n    Returns\n    -------\n    status : bool\n        String is URL or not.\n\n    \"\"\"\n    url = urllib.parse.urlparse(string)\n    # we can't just check that url.scheme is not an empty string, because\n    # file paths in windows would return a non-empty scheme (e.g. e:\\\\\n    # returns 'e').\n    return url.scheme.lower() in ['http', 'https', 'ftp', 'sftp', 'ssh', 'file']"},{"id":293,"name":"12709.feature.rst","nodeType":"TextFile","path":"docs/changes/units","text":"New ``doppler_redshift`` equivalency to convert between\nDoppler redshift and radial velocity.\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":139,"id":294,"name":"REMOTE_DATA","nodeType":"Attribute","startLoc":139,"text":"REMOTE_DATA"},{"attributeType":"null","col":0,"comment":"null","endLoc":140,"id":295,"name":"FLOAT_CMP","nodeType":"Attribute","startLoc":140,"text":"FLOAT_CMP"},{"attributeType":"null","col":0,"comment":"null","endLoc":144,"id":296,"name":"numpydoc_xref_param_type","nodeType":"Attribute","startLoc":144,"text":"numpydoc_xref_param_type"},{"attributeType":"null","col":0,"comment":"null","endLoc":190,"id":297,"name":"author","nodeType":"Attribute","startLoc":190,"text":"author"},{"attributeType":"null","col":0,"comment":"null","endLoc":191,"id":298,"name":"copyright","nodeType":"Attribute","startLoc":191,"text":"copyright"},{"attributeType":"null","col":0,"comment":"null","endLoc":198,"id":299,"name":"release","nodeType":"Attribute","startLoc":198,"text":"release"},{"id":300,"name":"docs/changes/utils","nodeType":"Package"},{"id":301,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/utils","text":""},{"attributeType":"null","col":0,"comment":"null","endLoc":200,"id":302,"name":"version","nodeType":"Attribute","startLoc":200,"text":"version"},{"attributeType":"null","col":0,"comment":"null","endLoc":203,"id":303,"name":"dev","nodeType":"Attribute","startLoc":203,"text":"dev"},{"attributeType":"null","col":0,"comment":"null","endLoc":210,"id":304,"name":"modindex_common_prefix","nodeType":"Attribute","startLoc":210,"text":"modindex_common_prefix"},{"attributeType":"null","col":0,"comment":"null","endLoc":258,"id":305,"name":"html_title","nodeType":"Attribute","startLoc":258,"text":"html_title"},{"attributeType":"null","col":0,"comment":"null","endLoc":261,"id":306,"name":"htmlhelp_basename","nodeType":"Attribute","startLoc":261,"text":"htmlhelp_basename"},{"id":307,"name":"docs/changes/config","nodeType":"Package"},{"id":308,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/config","text":""},{"id":309,"name":"docs/changes/extern","nodeType":"Package"},{"id":310,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/extern","text":""},{"col":0,"comment":"\n    For a given WCS, return the coordinate frame that matches the celestial\n    component of the WCS.\n\n    Parameters\n    ----------\n    wcs : :class:`~astropy.wcs.WCS` instance\n        The WCS to find the frame for\n\n    Returns\n    -------\n    frame : :class:`~astropy.coordinates.baseframe.BaseCoordinateFrame` subclass instance\n        An instance of a :class:`~astropy.coordinates.baseframe.BaseCoordinateFrame`\n        subclass instance that best matches the specified WCS.\n\n    Notes\n    -----\n\n    To extend this function to frames not defined in astropy.coordinates, you\n    can write your own function which should take a :class:`~astropy.wcs.WCS`\n    instance and should return either an instance of a frame, or `None` if no\n    matching frame was found. You can register this function temporarily with::\n\n        >>> from astropy.wcs.utils import wcs_to_celestial_frame, custom_wcs_to_frame_mappings\n        >>> with custom_wcs_to_frame_mappings(my_function):\n        ...     wcs_to_celestial_frame(...)\n\n    ","endLoc":220,"header":"def wcs_to_celestial_frame(wcs)","id":311,"name":"wcs_to_celestial_frame","nodeType":"Function","startLoc":185,"text":"def wcs_to_celestial_frame(wcs):\n    \"\"\"\n    For a given WCS, return the coordinate frame that matches the celestial\n    component of the WCS.\n\n    Parameters\n    ----------\n    wcs : :class:`~astropy.wcs.WCS` instance\n        The WCS to find the frame for\n\n    Returns\n    -------\n    frame : :class:`~astropy.coordinates.baseframe.BaseCoordinateFrame` subclass instance\n        An instance of a :class:`~astropy.coordinates.baseframe.BaseCoordinateFrame`\n        subclass instance that best matches the specified WCS.\n\n    Notes\n    -----\n\n    To extend this function to frames not defined in astropy.coordinates, you\n    can write your own function which should take a :class:`~astropy.wcs.WCS`\n    instance and should return either an instance of a frame, or `None` if no\n    matching frame was found. You can register this function temporarily with::\n\n        >>> from astropy.wcs.utils import wcs_to_celestial_frame, custom_wcs_to_frame_mappings\n        >>> with custom_wcs_to_frame_mappings(my_function):\n        ...     wcs_to_celestial_frame(...)\n\n    \"\"\"\n    for mapping_set in WCS_FRAME_MAPPINGS:\n        for func in mapping_set:\n            frame = func(wcs)\n            if frame is not None:\n                return frame\n    raise ValueError(\"Could not determine celestial frame corresponding to \"\n                     \"the specified WCS object\")"},{"attributeType":"null","col":0,"comment":"null","endLoc":264,"id":312,"name":"html_context","nodeType":"Attribute","startLoc":264,"text":"html_context"},{"id":313,"name":"docs/changes/nddata","nodeType":"Package"},{"id":314,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/nddata","text":""},{"attributeType":"null","col":0,"comment":"null","endLoc":273,"id":315,"name":"latex_documents","nodeType":"Attribute","startLoc":273,"text":"latex_documents"},{"attributeType":"null","col":0,"comment":"null","endLoc":276,"id":316,"name":"latex_logo","nodeType":"Attribute","startLoc":276,"text":"latex_logo"},{"attributeType":"null","col":0,"comment":"null","endLoc":283,"id":317,"name":"man_pages","nodeType":"Attribute","startLoc":283,"text":"man_pages"},{"attributeType":"null","col":0,"comment":"null","endLoc":287,"id":318,"name":"github_issues_url","nodeType":"Attribute","startLoc":287,"text":"github_issues_url"},{"attributeType":"null","col":0,"comment":"null","endLoc":288,"id":319,"name":"edit_on_github_branch","nodeType":"Attribute","startLoc":288,"text":"edit_on_github_branch"},{"attributeType":"null","col":0,"comment":"null","endLoc":293,"id":320,"name":"nitpicky","nodeType":"Attribute","startLoc":293,"text":"nitpicky"},{"attributeType":"null","col":0,"comment":"null","endLoc":295,"id":321,"name":"nitpick_ignore","nodeType":"Attribute","startLoc":295,"text":"nitpick_ignore"},{"attributeType":"null","col":4,"comment":"null","endLoc":297,"id":322,"name":"line","nodeType":"Attribute","startLoc":297,"text":"line"},{"attributeType":"null","col":4,"comment":"null","endLoc":300,"id":323,"name":"dtype","nodeType":"Attribute","startLoc":300,"text":"dtype"},{"id":324,"name":"docs/changes/io.fits","nodeType":"Package"},{"id":325,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/io.fits","text":""},{"id":326,"name":"12258.api.rst","nodeType":"TextFile","path":"docs/changes/io.fits","text":"Removed deprecated ``clobber`` argument from functions in ``astropy.io.fits``.\n"},{"id":327,"name":"11843.feature.rst","nodeType":"TextFile","path":"docs/changes/io.fits","text":"Add option ``unit_parse_strict`` to `~astropy.io.fits.connect.read_table_fits`\nto enable warnings or errors about invalid FITS units when using `~astropy.table.Table.read`.\nThe default for this new option is ``\"warn\"``, which means warnings are now raised for\ncolumns with invalid units.\n"},{"id":328,"name":"docs/changes/io.misc","nodeType":"Package"},{"id":329,"name":"12895.feature.rst","nodeType":"TextFile","path":"docs/changes/io.misc","text":"Add asdf support for ``Cosine1D``, ``Tangent1D``, ``ArcSine1D``,\n``ArcCosine1D``, and ``ArcTangent1D`` models.\n"},{"attributeType":"null","col":11,"comment":"null","endLoc":300,"id":330,"name":"target","nodeType":"Attribute","startLoc":300,"text":"target"},{"attributeType":"null","col":4,"comment":"null","endLoc":301,"id":331,"name":"target","nodeType":"Attribute","startLoc":301,"text":"target"},{"attributeType":"null","col":4,"comment":"null","endLoc":312,"id":332,"name":"sphinx_gallery_conf","nodeType":"Attribute","startLoc":312,"text":"sphinx_gallery_conf"},{"attributeType":"None","col":4,"comment":"null","endLoc":332,"id":333,"name":"sphinx_gallery","nodeType":"Attribute","startLoc":332,"text":"sphinx_gallery"},{"attributeType":"null","col":0,"comment":"null","endLoc":336,"id":334,"name":"linkcheck_retry","nodeType":"Attribute","startLoc":336,"text":"linkcheck_retry"},{"attributeType":"null","col":0,"comment":"null","endLoc":337,"id":335,"name":"linkcheck_ignore","nodeType":"Attribute","startLoc":337,"text":"linkcheck_ignore"},{"attributeType":"null","col":0,"comment":"null","endLoc":345,"id":336,"name":"linkcheck_timeout","nodeType":"Attribute","startLoc":345,"text":"linkcheck_timeout"},{"attributeType":"null","col":0,"comment":"null","endLoc":346,"id":337,"name":"linkcheck_anchors","nodeType":"Attribute","startLoc":346,"text":"linkcheck_anchors"},{"attributeType":"null","col":0,"comment":"null","endLoc":351,"id":338,"name":"html_extra_path","nodeType":"Attribute","startLoc":351,"text":"html_extra_path"},{"id":339,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/io.misc","text":""},{"col":0,"comment":"","endLoc":28,"header":"conf.py#<anonymous>","id":340,"name":"<anonymous>","nodeType":"Function","startLoc":28,"text":"missing_requirements = {}\n\nfor line in metadata.requires('astropy'):\n    if 'extra == \"docs\"' in line:\n        req = Requirement(line.split(';')[0])\n        req_package = req.name.lower()\n        req_specifier = str(req.specifier)\n\n        try:\n            version = metadata.version(req_package)\n        except metadata.PackageNotFoundError:\n            missing_requirements[req_package] = req_specifier\n\n        if version not in SpecifierSet(req_specifier, prereleases=True):\n            missing_requirements[req_package] = req_specifier\n\nif missing_requirements:\n    print('The following packages could not be found and are required to '\n          'build the documentation:')\n    for key, val in missing_requirements.items():\n        print(f'    * {key} {val}')\n    print('Please install the \"docs\" requirements.')\n    sys.exit(1)\n\nplot_rcparams = {}\n\nplot_rcparams['figure.figsize'] = (6, 6)\n\nplot_rcparams['savefig.facecolor'] = 'none'\n\nplot_rcparams['savefig.bbox'] = 'tight'\n\nplot_rcparams['axes.labelsize'] = 'large'\n\nplot_rcparams['figure.subplot.hspace'] = 0.5\n\nplot_apply_rcparams = True\n\nplot_html_show_source_link = False\n\nplot_formats = ['png', 'svg', 'pdf']\n\nplot_pre_code = \"\"\n\nneeds_sphinx = '1.7'\n\ncheck_sphinx_version(\"1.2.1\")  # noqa: F405\n\ndel intersphinx_mapping['astropy']  # noqa: F405\n\nintersphinx_mapping['astropy-dev'] = ('https://docs.astropy.org/en/latest/', None)  # noqa: F405\n\nintersphinx_mapping['pyerfa'] = ('https://pyerfa.readthedocs.io/en/stable/', None)  # noqa: F405\n\nintersphinx_mapping['pytest'] = ('https://docs.pytest.org/en/stable/', None)  # noqa: F405\n\nintersphinx_mapping['ipython'] = ('https://ipython.readthedocs.io/en/stable/', None)  # noqa: F405\n\nintersphinx_mapping['pandas'] = ('https://pandas.pydata.org/pandas-docs/stable/', None)  # noqa: F405, E501\n\nintersphinx_mapping['sphinx_automodapi'] = ('https://sphinx-automodapi.readthedocs.io/en/stable/', None)  # noqa: F405, E501\n\nintersphinx_mapping['packagetemplate'] = ('https://docs.astropy.org/projects/package-template/en/latest/', None)  # noqa: F405, E501\n\nintersphinx_mapping['h5py'] = ('https://docs.h5py.org/en/stable/', None)  # noqa: F405\n\nexclude_patterns.append('_templates')  # noqa: F405\n\nexclude_patterns.append('changes')  # noqa: F405\n\nexclude_patterns.append('_pkgtemplate.rst')  # noqa: F405\n\nexclude_patterns.append('**/*.inc.rst')  # .inc.rst mean *include* files, don't have sphinx process them  # noqa: F405, E501\n\nif 'templates_path' not in locals():  # in case parent conf.py defines it\n    templates_path = []\n\ntemplates_path.append('_templates')\n\nextensions += [\"sphinx_changelog\"]  # noqa: F405\n\nsetup_cfg = configparser.ConfigParser()\n\nsetup_cfg.read(os.path.join(os.path.pardir, 'setup.cfg'))\n\n__minimum_python_version__ = setup_cfg['options']['python_requires'].replace('>=', '')\n\nproject = u'Astropy'\n\nmin_versions = {}\n\nfor line in metadata.requires('astropy'):\n    req = Requirement(line.split(';')[0])\n    min_versions[req.name.lower()] = str(req.specifier)\n\nwith open(\"common_links.txt\", \"r\") as cl:\n    rst_epilog += cl.read().format(minimum_python=__minimum_python_version__,\n                                   **min_versions)\n\nIGNORE_OUTPUT = doctest.register_optionflag('IGNORE_OUTPUT')\n\nREMOTE_DATA = doctest.register_optionflag('REMOTE_DATA')\n\nFLOAT_CMP = doctest.register_optionflag('FLOAT_CMP')\n\nnumpydoc_xref_param_type = True\n\nnumpydoc_xref_ignore.update({\n    \"mixin\",\n    \"Any\",  # aka something that would be annotated with `typing.Any`\n    # needed in subclassing numpy  # TODO! revisit\n    \"Arguments\", \"Path\",\n    # TODO! not need to ignore.\n    \"flag\", \"bits\",\n})\n\nnumpydoc_xref_aliases.update({\n    # python & adjacent\n    \"Any\": \"`~typing.Any`\",\n    \"file-like\": \":term:`python:file-like object`\",\n    \"file\": \":term:`python:file object`\",\n    \"path-like\": \":term:`python:path-like object`\",\n    \"module\": \":term:`python:module`\",\n    \"buffer-like\": \":term:buffer-like\",\n    \"hashable\": \":term:`python:hashable`\",\n    # for matplotlib\n    \"color\": \":term:`color`\",\n    # for numpy\n    \"ints\": \":class:`python:int`\",\n    # for astropy\n    \"number\": \":term:`number`\",\n    \"Representation\": \":class:`~astropy.coordinates.BaseRepresentation`\",\n    \"writable\": \":term:`writable file-like object`\",\n    \"readable\": \":term:`readable file-like object`\",\n    \"BaseHDU\": \":doc:`HDU </io/fits/api/hdus>`\"\n})\n\nnumpydoc_xref_aliases.update(numpydoc_xref_astropy_aliases)\n\nauthor = u'The Astropy Developers'\n\ncopyright = f'2011–{datetime.utcnow().year}, ' + author\n\nrelease = metadata.version(project)\n\nversion = '.'.join(release.split('.')[:2])\n\ndev = 'dev' in release\n\nif not dev:\n    exclude_patterns.append('development/*')  # noqa: F405\n    exclude_patterns.append('testhelpers.rst')  # noqa: F405\n\nmodindex_common_prefix = ['astropy.']\n\nhtml_title = f'{project} v{release}'\n\nhtmlhelp_basename = project + 'doc'\n\nhtml_context = {\n    'to_be_indexed': ['stable', 'latest'],\n    'is_development': dev\n}\n\nlatex_documents = [('index', project + '.tex', project + u' Documentation',\n                    author, 'manual')]\n\nlatex_logo = '_static/astropy_logo.pdf'\n\nman_pages = [('index', project.lower(), project + u' Documentation',\n              [author], 1)]\n\ngithub_issues_url = 'https://github.com/astropy/astropy/issues/'\n\nedit_on_github_branch = 'main'\n\nnitpicky = True\n\nnitpick_ignore = []\n\nfor line in open('nitpick-exceptions'):\n    if line.strip() == \"\" or line.startswith(\"#\"):\n        continue\n    dtype, target = line.split(None, 1)\n    target = target.strip()\n    nitpick_ignore.append((dtype, target))\n\ntry:\n    import warnings\n\n    import sphinx_gallery  # noqa: F401\n    extensions += [\"sphinx_gallery.gen_gallery\"]  # noqa: F405\n\n    sphinx_gallery_conf = {\n        'backreferences_dir': 'generated/modules',  # path to store the module using example template  # noqa: E501\n        'filename_pattern': '^((?!skip_).)*$',  # execute all examples except those that start with \"skip_\"  # noqa: E501\n        'examples_dirs': f'..{os.sep}examples',  # path to the examples scripts\n        'gallery_dirs': 'generated/examples',  # path to save gallery generated examples\n        'reference_url': {\n            'astropy': None,\n            'matplotlib': 'https://matplotlib.org/stable/',\n            'numpy': 'https://numpy.org/doc/stable/',\n        },\n        'abort_on_example_error': True\n    }\n\n    # Filter out backend-related warnings as described in\n    # https://github.com/sphinx-gallery/sphinx-gallery/pull/564\n    warnings.filterwarnings(\"ignore\", category=UserWarning,\n                            message='Matplotlib is currently using agg, which is a'\n                                    ' non-GUI backend, so cannot show the figure.')\n\nexcept ImportError:\n    sphinx_gallery = None\n\nlinkcheck_retry = 5\n\nlinkcheck_ignore = ['https://journals.aas.org/manuscript-preparation/',\n                    'https://maia.usno.navy.mil/',\n                    'https://www.usno.navy.mil/USNO/time/gps/usno-gps-time-transfer',\n                    'https://aa.usno.navy.mil/publications/docs/Circular_179.php',\n                    'http://data.astropy.org',\n                    'https://doi.org/10.1017/S0251107X00002406',  # internal server error\n                    'https://doi.org/10.1017/pasa.2013.31',  # internal server error\n                    r'https://github\\.com/astropy/astropy/(?:issues|pull)/\\d+']\n\nlinkcheck_timeout = 180\n\nlinkcheck_anchors = False\n\nhtml_extra_path = ['robots.txt']"},{"id":341,"name":"10198.feature.rst","nodeType":"TextFile","path":"docs/changes/io.misc","text":"Allow serialization of model unit equivalencies.\n"},{"id":342,"name":"12897.feature.rst","nodeType":"TextFile","path":"docs/changes/io.misc","text":"Add asdf support for ``Spline1D`` models.\n"},{"id":343,"name":"12279.feature.rst","nodeType":"TextFile","path":"docs/changes/io.misc","text":"Built-in Cosmology subclasses can now be converted to/from YAML with the\nfunctions ``dump`` and ``load`` in ``astropy.io.misc.yaml``.\n"},{"id":344,"name":"12800.bugfix.rst","nodeType":"TextFile","path":"docs/changes/io.misc","text":"Bugfix for ``units_mapping`` schema's property name conflicts. Changes:\n    * ``inputs`` to ``unit_inputs``\n    * ``outputs`` to ``unit_outputs``\n"},{"id":345,"name":"docs/changes/io.ascii","nodeType":"Package"},{"id":346,"name":"12880.bugfix.rst","nodeType":"TextFile","path":"docs/changes/io.ascii","text":"Bugfix to add backwards compatibility for reading ECSV\nversion 0.9 files with non-standard column datatypes\n(such as ``object``, ``str``, ``datetime64``, etc.), which would\nraise a ValueError in ECSV version 1.0.\n"},{"id":347,"name":"12631.bugfix.rst","nodeType":"TextFile","path":"docs/changes/io.ascii","text":"Fixed ``io.ascii`` read and write functions for most formats to correctly handle\ndata fields with embedded newlines for both the fast and pure-Python readers and\nwriters.\n"},{"id":348,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/io.ascii","text":""},{"col":0,"comment":"Downloads a URL and optionally caches the result.\n\n    It returns the filename of a file containing the URL's contents.\n    If ``cache=True`` and the file is present in the cache, just\n    returns the filename; if the file had to be downloaded, add it\n    to the cache. If ``cache=\"update\"`` always download and add it\n    to the cache.\n\n    The cache is effectively a dictionary mapping URLs to files; by default the\n    file contains the contents of the URL that is its key, but in practice\n    these can be obtained from a mirror (using ``sources``) or imported from\n    the local filesystem (using `~import_file_to_cache` or\n    `~import_download_cache`).  Regardless, each file is regarded as\n    representing the contents of a particular URL, and this URL should be used\n    to look them up or otherwise manipulate them.\n\n    The files in the cache directory are named according to a cryptographic\n    hash of their URLs (currently MD5, so hackers can cause collisions).\n    The modification times on these files normally indicate when they were\n    last downloaded from the Internet.\n\n    Parameters\n    ----------\n    remote_url : str\n        The URL of the file to download\n\n    cache : bool or \"update\", optional\n        Whether to cache the contents of remote URLs. If \"update\",\n        always download the remote URL in case there is a new version\n        and store the result in the cache.\n\n    show_progress : bool, optional\n        Whether to display a progress bar during the download (default\n        is `True`). Regardless of this setting, the progress bar is only\n        displayed when outputting to a terminal.\n\n    timeout : float, optional\n        Timeout for remote requests in seconds (default is the configurable\n        `astropy.utils.data.Conf.remote_timeout`).\n\n    sources : list of str, optional\n        If provided, a list of URLs to try to obtain the file from. The\n        result will be stored under the original URL. The original URL\n        will *not* be tried unless it is in this list; this is to prevent\n        long waits for a primary server that is known to be inaccessible\n        at the moment. If an empty list is passed, then ``download_file``\n        will not attempt to connect to the Internet, that is, if the file\n        is not in the cache a KeyError will be raised.\n\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    http_headers : dict or None\n        HTTP request headers to pass into ``urlopen`` if needed. (These headers\n        are ignored if the protocol for the ``name_or_obj``/``sources`` entry\n        is not a remote HTTP URL.) In the default case (None), the headers are\n        ``User-Agent: some_value`` and ``Accept: */*``, where ``some_value``\n        is set by ``astropy.utils.data.conf.default_http_user_agent``.\n\n    ssl_context : dict, optional\n        Keyword arguments to pass to `ssl.create_default_context` when\n        downloading from HTTPS or TLS+FTP sources.  This can be used provide\n        alternative paths to root CA certificates.  Additionally, if the key\n        ``'certfile'`` and optionally ``'keyfile'`` and ``'password'`` are\n        included, they are passed to `ssl.SSLContext.load_cert_chain`.  This\n        can be used for performing SSL/TLS client certificate authentication\n        for servers that require it.\n\n    allow_insecure : bool, optional\n        Allow downloading files over a TLS/SSL connection even when the server\n        certificate verification failed.  When set to `True` the potentially\n        insecure download is allowed to proceed, but an\n        `~astropy.utils.exceptions.AstropyWarning` is issued.  If you are\n        frequently getting certificate verification warnings, consider\n        installing or upgrading `certifi`_ package, which provides frequently\n        updated certificates for common root CAs (i.e., a set similar to those\n        used by web browsers).  If installed, Astropy will use it\n        automatically.\n\n        .. _certifi: https://pypi.org/project/certifi/\n\n    Returns\n    -------\n    local_path : str\n        Returns the local path that the file was download to.\n\n    Raises\n    ------\n    urllib.error.URLError\n        Whenever there's a problem getting the remote file.\n    KeyError\n        When a file was requested from the cache but is missing and no\n        sources were provided to obtain it from the Internet.\n\n    Notes\n    -----\n    Because this function returns a filename, another process could run\n    `clear_download_cache` before you actually open the file, leaving\n    you with a filename that no longer points to a usable file.\n    ","endLoc":1413,"header":"def download_file(remote_url, cache=False, show_progress=True, timeout=None,\n                  sources=None, pkgname='astropy', http_headers=None,\n                  ssl_context=None, allow_insecure=False)","id":349,"name":"download_file","nodeType":"Function","startLoc":1217,"text":"def download_file(remote_url, cache=False, show_progress=True, timeout=None,\n                  sources=None, pkgname='astropy', http_headers=None,\n                  ssl_context=None, allow_insecure=False):\n    \"\"\"Downloads a URL and optionally caches the result.\n\n    It returns the filename of a file containing the URL's contents.\n    If ``cache=True`` and the file is present in the cache, just\n    returns the filename; if the file had to be downloaded, add it\n    to the cache. If ``cache=\"update\"`` always download and add it\n    to the cache.\n\n    The cache is effectively a dictionary mapping URLs to files; by default the\n    file contains the contents of the URL that is its key, but in practice\n    these can be obtained from a mirror (using ``sources``) or imported from\n    the local filesystem (using `~import_file_to_cache` or\n    `~import_download_cache`).  Regardless, each file is regarded as\n    representing the contents of a particular URL, and this URL should be used\n    to look them up or otherwise manipulate them.\n\n    The files in the cache directory are named according to a cryptographic\n    hash of their URLs (currently MD5, so hackers can cause collisions).\n    The modification times on these files normally indicate when they were\n    last downloaded from the Internet.\n\n    Parameters\n    ----------\n    remote_url : str\n        The URL of the file to download\n\n    cache : bool or \"update\", optional\n        Whether to cache the contents of remote URLs. If \"update\",\n        always download the remote URL in case there is a new version\n        and store the result in the cache.\n\n    show_progress : bool, optional\n        Whether to display a progress bar during the download (default\n        is `True`). Regardless of this setting, the progress bar is only\n        displayed when outputting to a terminal.\n\n    timeout : float, optional\n        Timeout for remote requests in seconds (default is the configurable\n        `astropy.utils.data.Conf.remote_timeout`).\n\n    sources : list of str, optional\n        If provided, a list of URLs to try to obtain the file from. The\n        result will be stored under the original URL. The original URL\n        will *not* be tried unless it is in this list; this is to prevent\n        long waits for a primary server that is known to be inaccessible\n        at the moment. If an empty list is passed, then ``download_file``\n        will not attempt to connect to the Internet, that is, if the file\n        is not in the cache a KeyError will be raised.\n\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    http_headers : dict or None\n        HTTP request headers to pass into ``urlopen`` if needed. (These headers\n        are ignored if the protocol for the ``name_or_obj``/``sources`` entry\n        is not a remote HTTP URL.) In the default case (None), the headers are\n        ``User-Agent: some_value`` and ``Accept: */*``, where ``some_value``\n        is set by ``astropy.utils.data.conf.default_http_user_agent``.\n\n    ssl_context : dict, optional\n        Keyword arguments to pass to `ssl.create_default_context` when\n        downloading from HTTPS or TLS+FTP sources.  This can be used provide\n        alternative paths to root CA certificates.  Additionally, if the key\n        ``'certfile'`` and optionally ``'keyfile'`` and ``'password'`` are\n        included, they are passed to `ssl.SSLContext.load_cert_chain`.  This\n        can be used for performing SSL/TLS client certificate authentication\n        for servers that require it.\n\n    allow_insecure : bool, optional\n        Allow downloading files over a TLS/SSL connection even when the server\n        certificate verification failed.  When set to `True` the potentially\n        insecure download is allowed to proceed, but an\n        `~astropy.utils.exceptions.AstropyWarning` is issued.  If you are\n        frequently getting certificate verification warnings, consider\n        installing or upgrading `certifi`_ package, which provides frequently\n        updated certificates for common root CAs (i.e., a set similar to those\n        used by web browsers).  If installed, Astropy will use it\n        automatically.\n\n        .. _certifi: https://pypi.org/project/certifi/\n\n    Returns\n    -------\n    local_path : str\n        Returns the local path that the file was download to.\n\n    Raises\n    ------\n    urllib.error.URLError\n        Whenever there's a problem getting the remote file.\n    KeyError\n        When a file was requested from the cache but is missing and no\n        sources were provided to obtain it from the Internet.\n\n    Notes\n    -----\n    Because this function returns a filename, another process could run\n    `clear_download_cache` before you actually open the file, leaving\n    you with a filename that no longer points to a usable file.\n    \"\"\"\n    if timeout is None:\n        timeout = conf.remote_timeout\n    if sources is None:\n        sources = [remote_url]\n    if http_headers is None:\n        http_headers = {'User-Agent': conf.default_http_user_agent,\n                        'Accept': '*/*'}\n\n    missing_cache = \"\"\n\n    url_key = remote_url\n\n    if cache:\n        try:\n            dldir = _get_download_cache_loc(pkgname)\n        except OSError as e:\n            cache = False\n            missing_cache = (\n                f\"Cache directory cannot be read or created ({e}), \"\n                f\"providing data in temporary file instead.\"\n            )\n        else:\n            if cache == \"update\":\n                pass\n            elif isinstance(cache, str):\n                raise ValueError(f\"Cache value '{cache}' was requested but \"\n                                 f\"'update' is the only recognized string; \"\n                                 f\"otherwise use a boolean\")\n            else:\n                filename = os.path.join(dldir, _url_to_dirname(url_key), \"contents\")\n                if os.path.exists(filename):\n                    return os.path.abspath(filename)\n\n    errors = {}\n    for source_url in sources:\n        try:\n            f_name = _download_file_from_source(\n                    source_url,\n                    timeout=timeout,\n                    show_progress=show_progress,\n                    cache=cache,\n                    remote_url=remote_url,\n                    pkgname=pkgname,\n                    http_headers=http_headers,\n                    ssl_context=ssl_context,\n                    allow_insecure=allow_insecure)\n            # Success!\n            break\n\n        except urllib.error.URLError as e:\n            # errno 8 is from SSL \"EOF occurred in violation of protocol\"\n            if (hasattr(e, 'reason')\n                    and hasattr(e.reason, 'errno')\n                    and e.reason.errno == 8):\n                e.reason.strerror = (e.reason.strerror +\n                                     '. requested URL: '\n                                     + remote_url)\n                e.reason.args = (e.reason.errno, e.reason.strerror)\n            errors[source_url] = e\n    else:   # No success\n        if not sources:\n            raise KeyError(\n                f\"No sources listed and file {remote_url} not in cache! \"\n                f\"Please include primary URL in sources if you want it to be \"\n                f\"included as a valid source.\")\n        elif len(sources) == 1:\n            raise errors[sources[0]]\n        else:\n            raise urllib.error.URLError(\n                f\"Unable to open any source! Exceptions were {errors}\") \\\n                from errors[sources[0]]\n\n    if cache:\n        try:\n            return import_file_to_cache(url_key, f_name,\n                                        remove_original=True,\n                                        replace=(cache == 'update'),\n                                        pkgname=pkgname)\n        except PermissionError as e:\n            # Cache is readonly, we can't update it\n            missing_cache = (\n                f\"Cache directory appears to be read-only ({e}), unable to import \"\n                f\"downloaded file, providing data in temporary file {f_name} \"\n                f\"instead.\")\n        # FIXME: other kinds of cache problem can occur?\n\n    if missing_cache:\n        warn(CacheMissingWarning(missing_cache, f_name))\n    if conf.delete_temporary_downloads_at_exit:\n        global _tempfilestodel\n        _tempfilestodel.append(f_name)\n    return os.path.abspath(f_name)"},{"id":350,"name":"docs/changes/modeling","nodeType":"Package"},{"id":351,"name":"12384.feature.rst","nodeType":"TextFile","path":"docs/changes/modeling","text":"Enable direct use of the ``ignored`` feature of ``ModelBoundingBox`` by users in\naddition to its use as part of enabling ``CompoundBoundingBox``.\n"},{"col":0,"comment":"Finds the path to the cache directory and makes them if they don't exist.\n\n    Parameters\n    ----------\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    Returns\n    -------\n    datadir : str\n        The path to the data cache directory.\n    ","endLoc":1719,"header":"def _get_download_cache_loc(pkgname='astropy')","id":352,"name":"_get_download_cache_loc","nodeType":"Function","startLoc":1687,"text":"def _get_download_cache_loc(pkgname='astropy'):\n    \"\"\"Finds the path to the cache directory and makes them if they don't exist.\n\n    Parameters\n    ----------\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    Returns\n    -------\n    datadir : str\n        The path to the data cache directory.\n    \"\"\"\n    try:\n        datadir = os.path.join(astropy.config.paths.get_cache_dir(pkgname), 'download', 'url')\n\n        if not os.path.exists(datadir):\n            try:\n                os.makedirs(datadir)\n            except OSError:\n                if not os.path.exists(datadir):\n                    raise\n        elif not os.path.isdir(datadir):\n            raise OSError(f'Data cache directory {datadir} is not a directory')\n\n        return datadir\n    except OSError as e:\n        msg = 'Remote data cache could not be accessed due to '\n        estr = '' if len(e.args) < 1 else (': ' + str(e))\n        warn(CacheMissingWarning(msg + e.__class__.__name__ + estr))\n        raise"},{"col":0,"comment":"null","endLoc":172,"header":"def _parse_keysel(keysel)","id":353,"name":"_parse_keysel","nodeType":"Function","startLoc":155,"text":"def _parse_keysel(keysel):\n    keysel_flags = 0\n    if keysel is not None:\n        for element in keysel:\n            if element.lower() == 'image':\n                keysel_flags |= _wcs.WCSHDR_IMGHEAD\n            elif element.lower() == 'binary':\n                keysel_flags |= _wcs.WCSHDR_BIMGARR\n            elif element.lower() == 'pixel':\n                keysel_flags |= _wcs.WCSHDR_PIXLIST\n            else:\n                raise ValueError(\n                    \"keysel must be a list of 'image', 'binary' \" +\n                    \"and/or 'pixel'\")\n    else:\n        keysel_flags = -1\n\n    return keysel_flags"},{"id":354,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/modeling","text":""},{"id":355,"name":"12585.api.rst","nodeType":"TextFile","path":"docs/changes/modeling","text":"Made ``astropy.modeling.fitting._fitter_to_model_params`` and ``astropy.modeling.fitting._model_to_fit_params``\npublic methods.\n"},{"id":356,"name":"12558.feature.rst","nodeType":"TextFile","path":"docs/changes/modeling","text":"Switch ``modeling.projections`` to use ``astropy.wcs.Prjprm`` wrapper internally and provide access to the ``astropy.wcs.Prjprm`` structure.\n"},{"id":357,"name":"12900.feature.rst","nodeType":"TextFile","path":"docs/changes/modeling","text":"Provide a hook (``Model._calculate_separability_matrix``) to allow subclasses of ``Model`` to define how to compute their separability matrix.\n"},{"col":4,"comment":"null","endLoc":2060,"header":"def __call__(self, s=\"\", represents=None, format=None, namespace=None,\n                 doc=None, parse_strict='raise')","id":358,"name":"__call__","nodeType":"Function","startLoc":1966,"text":"def __call__(self, s=\"\", represents=None, format=None, namespace=None,\n                 doc=None, parse_strict='raise'):\n\n        # Short-circuit if we're already a unit\n        if hasattr(s, '_get_physical_type_id'):\n            return s\n\n        # turn possible Quantity input for s or represents into a Unit\n        from .quantity import Quantity\n\n        if isinstance(represents, Quantity):\n            if is_effectively_unity(represents.value):\n                represents = represents.unit\n            else:\n                represents = CompositeUnit(represents.value *\n                                           represents.unit.scale,\n                                           bases=represents.unit.bases,\n                                           powers=represents.unit.powers,\n                                           _error_check=False)\n\n        if isinstance(s, Quantity):\n            if is_effectively_unity(s.value):\n                s = s.unit\n            else:\n                s = CompositeUnit(s.value * s.unit.scale,\n                                  bases=s.unit.bases,\n                                  powers=s.unit.powers,\n                                  _error_check=False)\n\n        # now decide what we really need to do; define derived Unit?\n        if isinstance(represents, UnitBase):\n            # This has the effect of calling the real __new__ and\n            # __init__ on the Unit class.\n            return super().__call__(\n                s, represents, format=format, namespace=namespace, doc=doc)\n\n        # or interpret a Quantity (now became unit), string or number?\n        if isinstance(s, UnitBase):\n            return s\n\n        elif isinstance(s, (bytes, str)):\n            if len(s.strip()) == 0:\n                # Return the NULL unit\n                return dimensionless_unscaled\n\n            if format is None:\n                format = unit_format.Generic\n\n            f = unit_format.get_format(format)\n            if isinstance(s, bytes):\n                s = s.decode('ascii')\n\n            try:\n                return f.parse(s)\n            except NotImplementedError:\n                raise\n            except Exception as e:\n                if parse_strict == 'silent':\n                    pass\n                else:\n                    # Deliberately not issubclass here. Subclasses\n                    # should use their name.\n                    if f is not unit_format.Generic:\n                        format_clause = f.name + ' '\n                    else:\n                        format_clause = ''\n                    msg = (\"'{}' did not parse as {}unit: {} \"\n                           \"If this is meant to be a custom unit, \"\n                           \"define it with 'u.def_unit'. To have it \"\n                           \"recognized inside a file reader or other code, \"\n                           \"enable it with 'u.add_enabled_units'. \"\n                           \"For details, see \"\n                           \"https://docs.astropy.org/en/latest/units/combining_and_defining.html\"\n                           .format(s, format_clause, str(e)))\n                    if parse_strict == 'raise':\n                        raise ValueError(msg)\n                    elif parse_strict == 'warn':\n                        warnings.warn(msg, UnitsWarning)\n                    else:\n                        raise ValueError(\"'parse_strict' must be 'warn', \"\n                                         \"'raise' or 'silent'\")\n                return UnrecognizedUnit(s)\n\n        elif isinstance(s, (int, float, np.floating, np.integer)):\n            return CompositeUnit(s, [], [], _error_check=False)\n\n        elif isinstance(s, tuple):\n            from .structured import StructuredUnit\n            return StructuredUnit(s)\n\n        elif s is None:\n            raise TypeError(\"None is not a valid Unit\")\n\n        else:\n            raise TypeError(f\"{s} can not be converted to a Unit\")"},{"id":359,"name":"docs/changes/constants","nodeType":"Package"},{"id":360,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/constants","text":""},{"id":361,"name":"docs/changes/cosmology","nodeType":"Package"},{"id":362,"name":"12606.feature.rst","nodeType":"TextFile","path":"docs/changes/cosmology","text":"Add property ``is_flat`` to cosmologies to calculate the curvature of the Universe.\n\n``Cosmology`` is now an abstract class and subclasses must override the\nabstract property ``is_flat``.\n"},{"id":364,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/cosmology","text":""},{"id":365,"name":"12736.feature.rst","nodeType":"TextFile","path":"docs/changes/cosmology","text":"Register format \"astropy.cosmology\" with Cosmology I/O.\n"},{"col":0,"comment":"\n    Determine if the ``filename`` argument is an allowable type for a filename.\n\n    In Python 3.3 use of non-unicode filenames on system calls such as\n    `os.stat` and others that accept a filename argument was deprecated (and\n    may be removed outright in the future).\n\n    Therefore this returns `True` in all cases except for `bytes` strings in\n    Windows.\n    ","endLoc":35,"header":"def possible_filename(filename)","id":366,"name":"possible_filename","nodeType":"Function","startLoc":18,"text":"def possible_filename(filename):\n    \"\"\"\n    Determine if the ``filename`` argument is an allowable type for a filename.\n\n    In Python 3.3 use of non-unicode filenames on system calls such as\n    `os.stat` and others that accept a filename argument was deprecated (and\n    may be removed outright in the future).\n\n    Therefore this returns `True` in all cases except for `bytes` strings in\n    Windows.\n    \"\"\"\n\n    if isinstance(filename, str):\n        return True\n    elif isinstance(filename, bytes):\n        return not (sys.platform == 'win32')\n\n    return False"},{"id":367,"name":"12354.api.rst","nodeType":"TextFile","path":"docs/changes/cosmology","text":"The already deprecated ``Planck18_arXiv_v2`` has been removed.\nUse ``Planck18`` instead\n"},{"id":368,"name":"12612.api.rst","nodeType":"TextFile","path":"docs/changes/cosmology","text":"In I/O, conversions of Parameters move more relevant information from the\nParameter to the Column.\n\nThe default Parameter ``format_spec`` is changed from ``\".3g\"`` to ``\"\"``.\n"},{"id":369,"name":"12740.feature.rst","nodeType":"TextFile","path":"docs/changes/cosmology","text":"Cosmological equivalency (``Cosmology.is_equivalent``) can now be extended\nto any Python object that can be converted to a Cosmology, using the new\nkeyword argument ``format``.\nThis allows e.g. a properly formatted Table to be equivalent to a Cosmology.\n"},{"id":370,"name":"12710.feature.rst","nodeType":"TextFile","path":"docs/changes/cosmology","text":"For converting a cosmology to a mapping, two new boolean keyword arguments are\nadded: ``cosmology_as_str`` for turning the the class reference to a string,\ninstead of the class object itself, and ``move_from_meta`` to merge the\nmetadata with the rest of the returned mapping instead of adding it as a\nnested dictionary.\n"},{"id":371,"name":"12479.feature.rst","nodeType":"TextFile","path":"docs/changes/cosmology","text":"A method ``clone`` has been added to ``Parameter`` to quickly deep copy the\nobject and change any constructor argument.\nA supporting equality method is added, and ``repr`` is enhanced to be able to\nroundtrip -- ``eval(repr(Parameter()))`` -- if the Parameter's arguments can\nsimilarly roundtrip.\nParameter's arguments are made keyword-only.\n"},{"id":372,"name":"12279.feature.rst","nodeType":"TextFile","path":"docs/changes/cosmology","text":"Cosmology instance can be parsed from or converted to a YAML string using\nthe new \"yaml\" format in Cosmology's ``to/from_format`` I/O.\n"},{"id":373,"name":"12624.api.rst","nodeType":"TextFile","path":"docs/changes/cosmology","text":"Units of redshift are added to ``z_reion`` in built-in realizations' metadata.\n"},{"id":374,"name":"12746.api.rst","nodeType":"TextFile","path":"docs/changes/cosmology","text":"Cosmology realizations (e.g. ``Planck18``) and parameter dictionaries are now\nlazily loaded from source files.\n"},{"id":375,"name":"12313.feature.rst","nodeType":"TextFile","path":"docs/changes/cosmology","text":"Register \"astropy.row\" into Cosmology's to/from format I/O, allowing a\nCosmology instance to be parse from or converted to an Astropy Table Row.\n"},{"id":376,"name":"12375.api.rst","nodeType":"TextFile","path":"docs/changes/cosmology","text":"``default_cosmology.get_cosmology_from_string`` is deprecated and will be\nremoved in two minor versions.\nUse ``default_cosmology.get(<str>)`` instead.\n"},{"id":377,"name":"12590.feature.rst","nodeType":"TextFile","path":"docs/changes/cosmology","text":"Add methods ``Otot`` and ``Otot0`` to FLRW cosmologies to calculate the total\nenergy density of the Universe.\n"},{"col":0,"comment":"\n    Determines the Astropy cache directory name and creates the directory if it\n    doesn't exist.\n\n    This directory is typically ``$HOME/.astropy/cache``, but if the\n    XDG_CACHE_HOME environment variable is set and the\n    ``$XDG_CACHE_HOME/astropy`` directory exists, it will be that directory.\n    If neither exists, the former will be created and symlinked to the latter.\n\n    Parameters\n    ----------\n    rootname : str\n        Name of the root cache directory. For example, if\n        ``rootname = 'pkgname'``, the cache directory will be\n        ``<cache>/.pkgname/``.\n\n    Returns\n    -------\n    cachedir : str\n        The absolute path to the cache directory.\n\n    ","endLoc":170,"header":"def get_cache_dir(rootname=\"astropy\")","id":378,"name":"get_cache_dir","nodeType":"Function","startLoc":124,"text":"def get_cache_dir(rootname=\"astropy\"):\n    \"\"\"\n    Determines the Astropy cache directory name and creates the directory if it\n    doesn't exist.\n\n    This directory is typically ``$HOME/.astropy/cache``, but if the\n    XDG_CACHE_HOME environment variable is set and the\n    ``$XDG_CACHE_HOME/astropy`` directory exists, it will be that directory.\n    If neither exists, the former will be created and symlinked to the latter.\n\n    Parameters\n    ----------\n    rootname : str\n        Name of the root cache directory. For example, if\n        ``rootname = 'pkgname'``, the cache directory will be\n        ``<cache>/.pkgname/``.\n\n    Returns\n    -------\n    cachedir : str\n        The absolute path to the cache directory.\n\n    \"\"\"\n\n    # symlink will be set to this if the directory is created\n    linkto = None\n\n    # If using set_temp_cache, that overrides all\n    if set_temp_cache._temp_path is not None:\n        xch = set_temp_cache._temp_path\n        cache_path = os.path.join(xch, rootname)\n        if not os.path.exists(cache_path):\n            os.mkdir(cache_path)\n        return os.path.abspath(cache_path)\n\n    # first look for XDG_CACHE_HOME\n    xch = os.environ.get('XDG_CACHE_HOME')\n\n    if xch is not None and os.path.exists(xch):\n        xchpth = os.path.join(xch, rootname)\n        if not os.path.islink(xchpth):\n            if os.path.exists(xchpth):\n                return os.path.abspath(xchpth)\n            else:\n                linkto = xchpth\n\n    return os.path.abspath(_find_or_create_root_dir('cache', linkto, rootname))"},{"id":379,"name":"docs/changes/io.votable","nodeType":"Package"},{"id":380,"name":"12604.bugfix.rst","nodeType":"TextFile","path":"docs/changes/io.votable","text":"Fixed a bug where ``astropy.io.votable.validate`` was printing output to ``sys.stdout`` when the ``output`` paramter was set to ``None``. ``validate`` now returns a string when ``output`` is set to ``None``, as documented.\n"},{"id":381,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/io.votable","text":""},{"id":382,"name":"docs/changes/timeseries","nodeType":"Package"},{"id":383,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/timeseries","text":""},{"id":385,"name":"docs/changes/convolution","nodeType":"Package"},{"id":386,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/convolution","text":""},{"col":0,"comment":"null","endLoc":320,"header":"def _find_or_create_root_dir(dirnm, linkto, pkgname='astropy')","id":387,"name":"_find_or_create_root_dir","nodeType":"Function","startLoc":289,"text":"def _find_or_create_root_dir(dirnm, linkto, pkgname='astropy'):\n    innerdir = os.path.join(_find_home(), f'.{pkgname}')\n    maindir = os.path.join(_find_home(), f'.{pkgname}', dirnm)\n\n    if not os.path.exists(maindir):\n        # first create .astropy dir if needed\n        if not os.path.exists(innerdir):\n            try:\n                os.mkdir(innerdir)\n            except OSError:\n                if not os.path.isdir(innerdir):\n                    raise\n        elif not os.path.isdir(innerdir):\n            msg = 'Intended {0} {1} directory {1} is actually a file.'\n            raise OSError(msg.format(pkgname, dirnm, maindir))\n\n        try:\n            os.mkdir(maindir)\n        except OSError:\n            if not os.path.isdir(maindir):\n                raise\n\n        if (not sys.platform.startswith('win') and\n            linkto is not None and\n                not os.path.exists(linkto)):\n            os.symlink(maindir, linkto)\n\n    elif not os.path.isdir(maindir):\n        msg = 'Intended {0} {1} directory {1} is actually a file.'\n        raise OSError(msg.format(pkgname, dirnm, maindir))\n\n    return os.path.abspath(maindir)"},{"col":0,"comment":"Locates and return the home directory (or best approximation) on this\n    system.\n\n    Raises\n    ------\n    OSError\n        If the home directory cannot be located - usually means you are running\n        Astropy on some obscure platform that doesn't have standard home\n        directories.\n    ","endLoc":73,"header":"def _find_home()","id":388,"name":"_find_home","nodeType":"Function","startLoc":17,"text":"def _find_home():\n    \"\"\"Locates and return the home directory (or best approximation) on this\n    system.\n\n    Raises\n    ------\n    OSError\n        If the home directory cannot be located - usually means you are running\n        Astropy on some obscure platform that doesn't have standard home\n        directories.\n    \"\"\"\n    try:\n        homedir = os.path.expanduser('~')\n    except Exception:\n        # Linux, Unix, AIX, OS X\n        if os.name == 'posix':\n            if 'HOME' in os.environ:\n                homedir = os.environ['HOME']\n            else:\n                raise OSError('Could not find unix home directory to search for '\n                              'astropy config dir')\n        elif os.name == 'nt':  # This is for all modern Windows (NT or after)\n            if 'MSYSTEM' in os.environ and os.environ.get('HOME'):\n                # Likely using an msys shell; use whatever it is using for its\n                # $HOME directory\n                homedir = os.environ['HOME']\n            # See if there's a local home\n            elif 'HOMEDRIVE' in os.environ and 'HOMEPATH' in os.environ:\n                homedir = os.path.join(os.environ['HOMEDRIVE'],\n                                       os.environ['HOMEPATH'])\n            # Maybe a user profile?\n            elif 'USERPROFILE' in os.environ:\n                homedir = os.path.join(os.environ['USERPROFILE'])\n            else:\n                try:\n                    import winreg as wreg\n                    shell_folders = r'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders'  # noqa: E501\n                    key = wreg.OpenKey(wreg.HKEY_CURRENT_USER, shell_folders)\n\n                    homedir = wreg.QueryValueEx(key, 'Personal')[0]\n                    key.Close()\n                except Exception:\n                    # As a final possible resort, see if HOME is present\n                    if 'HOME' in os.environ:\n                        homedir = os.environ['HOME']\n                    else:\n                        raise OSError('Could not find windows home directory to '\n                                      'search for astropy config dir')\n        else:\n            # for other platforms, try HOME, although it probably isn't there\n            if 'HOME' in os.environ:\n                homedir = os.environ['HOME']\n            else:\n                raise OSError('Could not find a home directory to search for '\n                              'astropy config dir - are you on an unsupported '\n                              'platform?')\n    return homedir"},{"col":0,"comment":"null","endLoc":166,"header":"def is_effectively_unity(value)","id":389,"name":"is_effectively_unity","nodeType":"Function","startLoc":159,"text":"def is_effectively_unity(value):\n    # value is *almost* always real, except, e.g., for u.mag**0.5, when\n    # it will be complex.  Use try/except to ensure normal case is fast\n    try:\n        return _JUST_BELOW_UNITY <= value <= _JUST_ABOVE_UNITY\n    except TypeError:  # value is complex\n        return (_JUST_BELOW_UNITY <= value.real <= _JUST_ABOVE_UNITY and\n                _JUST_BELOW_UNITY <= value.imag + 1 <= _JUST_ABOVE_UNITY)"},{"id":390,"name":"docs/changes/coordinates","nodeType":"Package"},{"id":391,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/coordinates","text":""},{"id":392,"name":"docs/changes/io.registry","nodeType":"Package"},{"id":393,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/io.registry","text":""},{"id":394,"name":"docs/changes/uncertainty","nodeType":"Package"},{"id":395,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/uncertainty","text":""},{"id":396,"name":"docs/changes/visualization","nodeType":"Package"},{"id":397,"name":".gitkeep","nodeType":"TextFile","path":"docs/changes/visualization","text":""},{"id":398,"name":"docs/modeling","nodeType":"Package"},{"id":399,"name":"polynomial_models.rst","nodeType":"TextFile","path":"docs/modeling","text":".. include:: links.inc\n\n.. _polynomial_models:\n\n*****************\nPolynomial Models\n*****************\n\n.. _domain-window-note:\n\nNotes regarding usage of domain and window\n------------------------------------------\n\nMost of the polynomial models have optional domain and window attributes.\nIt is important to understand how they currently are interpreted, which\ncan be confusing since the terminology often implies something different.\n\nBoth the domain and window attributes for a polynomial consist of a two\nelement list (this will change to tuples in a future release) that\nindicate a range of values for input values. For 2-Dimensional polynomials\nthe attributes become x_domain, y_domain, x_window, and y_window.\nGenerally speaking, the main purpose of these attributes is to define\na linear transform between the supplied input variable and the resultant\ninput variable that is supplied to the polynomial. For example, if\ndomain = [-2, 2] and window = [-1, 1], input values will be divided by\ntwo so that the domain maps to the window. Correspondingly the pair\ndomain = [0, 2], window = [-1, 1] implies that 1 will be subtracted from\nthe input variable before using it in the polynomial.\n\nNeither domain or window are meant to imply that values that fall outside\nof their corresponding ranges will result in an exception, or that\nsuch values are necessarily invalid (the latter depends on the context\nof how the polynomial is being used).\n\nIt is the case that the orthogonal polynomials are defined on a range of\n[-1, 1], but nothing in the current machinery prevents them from being\nevaluated outside that range.\n\nDomain is used in fitting polynomials to bound the input variable to map\nto the defined window so that they fall within the expected [-1, 1] range\nfor such polynomials. That is, the fitting routine will set the domain to\nmap to the window range for the range of input x values supplied (so that\ndomain may change if the minimum and maximum x values being fit change).\n\nThe meaning of these terms may conflict with expectations (e.g., domain\nis often meant to mean the range of input values the function is valid\nfor). For fit results that is somewhat true, but otherwise, it is not.\nThe default values for ordinary polynomials is [-1, 1] for both domain\nand window, which effectively signals no transformation of the input\nvariable.\n\nThe terminology was adopted from numpy polynomials, which have the same\nconfusion in meaning.\n\n\n**************\n1D Polynomials\n**************\n\n- :class:`~astropy.modeling.polynomial.Polynomial1D`\n\n- :class:`~astropy.modeling.polynomial.Chebyshev1D`\n\n- :class:`~astropy.modeling.polynomial.Legendre1D`\n\n- :class:`~astropy.modeling.polynomial.Hermite1D`\n\n**************\n2D Polynomials\n**************\n\n- :class:`~astropy.modeling.polynomial.Polynomial2D`\n\n- :class:`~astropy.modeling.polynomial.Chebyshev2D`\n\n- :class:`~astropy.modeling.polynomial.Legendre2D`\n\n- :class:`~astropy.modeling.polynomial.Hermite2D`\n\n- :class:`~astropy.modeling.polynomial.SIP` model implements the\n  Simple Imaging Polynomial (`SIP`_) convention\n"},{"col":4,"comment":"\n        Construct a `Header` from an iterable and/or text file.\n\n        Parameters\n        ----------\n        cards : list of `Card`, optional\n            The cards to initialize the header with. Also allowed are other\n            `Header` (or `dict`-like) objects.\n\n            .. versionchanged:: 1.2\n                Allowed ``cards`` to be a `dict`-like object.\n\n        copy : bool, optional\n\n            If ``True`` copies the ``cards`` if they were another `Header`\n            instance.\n            Default is ``False``.\n\n            .. versionadded:: 1.3\n        ","endLoc":116,"header":"def __init__(self, cards=[], copy=False)","id":400,"name":"__init__","nodeType":"Function","startLoc":83,"text":"def __init__(self, cards=[], copy=False):\n        \"\"\"\n        Construct a `Header` from an iterable and/or text file.\n\n        Parameters\n        ----------\n        cards : list of `Card`, optional\n            The cards to initialize the header with. Also allowed are other\n            `Header` (or `dict`-like) objects.\n\n            .. versionchanged:: 1.2\n                Allowed ``cards`` to be a `dict`-like object.\n\n        copy : bool, optional\n\n            If ``True`` copies the ``cards`` if they were another `Header`\n            instance.\n            Default is ``False``.\n\n            .. versionadded:: 1.3\n        \"\"\"\n        self.clear()\n\n        if isinstance(cards, Header):\n            if copy:\n                cards = cards.copy()\n            cards = cards.cards\n        elif isinstance(cards, dict):\n            cards = cards.items()\n\n        for card in cards:\n            self.append(card, end=True)\n\n        self._modified = False"},{"id":401,"name":"fitting.rst","nodeType":"TextFile","path":"docs/modeling","text":"**********************\nFitting Models to Data\n**********************\n\nThis module provides wrappers, called Fitters, around some Numpy and Scipy\nfitting functions. All Fitters can be called as functions. They take an\ninstance of `~astropy.modeling.FittableModel` as input and modify its\n``parameters`` attribute. The idea is to make this extensible and allow\nusers to easily add other fitters.\n\nLinear fitting is done using Numpy's `numpy.linalg.lstsq` function.  There are\ncurrently two non-linear fitters which use `scipy.optimize.leastsq` and\n`scipy.optimize.fmin_slsqp`.\n\nThe rules for passing input to fitters are:\n\n* Non-linear fitters currently work only with single models (not model sets).\n\n* The linear fitter can fit a single input to multiple model sets creating\n  multiple fitted models.  This may require specifying the ``model_set_axis``\n  argument just as used when evaluating models; this may be required for the\n  fitter to know how to broadcast the input data.\n\n* The `~astropy.modeling.fitting.LinearLSQFitter` currently works only with\n  simple (not compound) models.\n\n* The current fitters work only with models that have a single output\n  (including bivariate functions such as\n  `~astropy.modeling.polynomial.Chebyshev2D` but not compound models that map\n  ``x, y -> x', y'``).\n\n.. _modeling-getting-started-1d-fitting:\n\nSimple 1-D model fitting\n------------------------\n\nIn this section, we look at a simple example of fitting a Gaussian to a\nsimulated dataset. We use the `~astropy.modeling.functional_models.Gaussian1D`\nand `~astropy.modeling.functional_models.Trapezoid1D` models and the\n`~astropy.modeling.fitting.LevMarLSQFitter` fitter to fit the data:\n\n.. plot::\n   :include-source:\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling import models, fitting\n\n    # Generate fake data\n    np.random.seed(0)\n    x = np.linspace(-5., 5., 200)\n    y = 3 * np.exp(-0.5 * (x - 1.3)**2 / 0.8**2)\n    y += np.random.normal(0., 0.2, x.shape)\n\n    # Fit the data using a box model.\n    # Bounds are not really needed but included here to demonstrate usage.\n    t_init = models.Trapezoid1D(amplitude=1., x_0=0., width=1., slope=0.5,\n                                bounds={\"x_0\": (-5., 5.)})\n    fit_t = fitting.LevMarLSQFitter()\n    t = fit_t(t_init, x, y)\n\n    # Fit the data using a Gaussian\n    g_init = models.Gaussian1D(amplitude=1., mean=0, stddev=1.)\n    fit_g = fitting.LevMarLSQFitter()\n    g = fit_g(g_init, x, y)\n\n    # Plot the data with the best-fit model\n    plt.figure(figsize=(8,5))\n    plt.plot(x, y, 'ko')\n    plt.plot(x, t(x), label='Trapezoid')\n    plt.plot(x, g(x), label='Gaussian')\n    plt.xlabel('Position')\n    plt.ylabel('Flux')\n    plt.legend(loc=2)\n\nAs shown above, once instantiated, the fitter class can be used as a function\nthat takes the initial model (``t_init`` or ``g_init``) and the data values\n(``x`` and ``y``), and returns a fitted model (``t`` or ``g``).\n\n.. _modeling-getting-started-2d-fitting:\n\nSimple 2-D model fitting\n------------------------\n\nSimilarly to the 1-D example, we can create a simulated 2-D data dataset, and\nfit a polynomial model to it.  This could be used for example to fit the\nbackground in an image.\n\n.. plot::\n   :include-source:\n\n    import warnings\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling import models, fitting\n    from astropy.utils.exceptions import AstropyUserWarning\n\n    # Generate fake data\n    np.random.seed(0)\n    y, x = np.mgrid[:128, :128]\n    z = 2. * x ** 2 - 0.5 * x ** 2 + 1.5 * x * y - 1.\n    z += np.random.normal(0., 0.1, z.shape) * 50000.\n\n    # Fit the data using astropy.modeling\n    p_init = models.Polynomial2D(degree=2)\n    fit_p = fitting.LevMarLSQFitter()\n\n    with warnings.catch_warnings():\n        # Ignore model linearity warning from the fitter\n        warnings.filterwarnings('ignore', message='Model is linear in parameters',\n                                category=AstropyUserWarning)\n        p = fit_p(p_init, x, y, z)\n\n    # Plot the data with the best-fit model\n    plt.figure(figsize=(8, 2.5))\n    plt.subplot(1, 3, 1)\n    plt.imshow(z, origin='lower', interpolation='nearest', vmin=-1e4, vmax=5e4)\n    plt.title(\"Data\")\n    plt.subplot(1, 3, 2)\n    plt.imshow(p(x, y), origin='lower', interpolation='nearest', vmin=-1e4,\n               vmax=5e4)\n    plt.title(\"Model\")\n    plt.subplot(1, 3, 3)\n    plt.imshow(z - p(x, y), origin='lower', interpolation='nearest', vmin=-1e4,\n               vmax=5e4)\n    plt.title(\"Residual\")\n"},{"col":4,"comment":"null","endLoc":2264,"header":"def __init__(self, scale, bases, powers, decompose=False,\n                 decompose_bases=set(), _error_check=True)","id":402,"name":"__init__","nodeType":"Function","startLoc":2222,"text":"def __init__(self, scale, bases, powers, decompose=False,\n                 decompose_bases=set(), _error_check=True):\n        # There are many cases internal to astropy.units where we\n        # already know that all the bases are Unit objects, and the\n        # powers have been validated.  In those cases, we can skip the\n        # error checking for performance reasons.  When the private\n        # kwarg `_error_check` is False, the error checking is turned\n        # off.\n        if _error_check:\n            for base in bases:\n                if not isinstance(base, UnitBase):\n                    raise TypeError(\n                        \"bases must be sequence of UnitBase instances\")\n            powers = [validate_power(p) for p in powers]\n\n        if not decompose and len(bases) == 1 and powers[0] >= 0:\n            # Short-cut; with one unit there's nothing to expand and gather,\n            # as that has happened already when creating the unit.  But do only\n            # positive powers, since for negative powers we need to re-sort.\n            unit = bases[0]\n            power = powers[0]\n            if power == 1:\n                scale *= unit.scale\n                self._bases = unit.bases\n                self._powers = unit.powers\n            elif power == 0:\n                self._bases = []\n                self._powers = []\n            else:\n                scale *= unit.scale ** power\n                self._bases = unit.bases\n                self._powers = [operator.mul(*resolve_fractions(p, power))\n                                for p in unit.powers]\n\n            self._scale = sanitize_scale(scale)\n        else:\n            # Regular case: use inputs as preliminary scale, bases, and powers,\n            # then \"expand and gather\" identical bases, sanitize the scale, &c.\n            self._scale = scale\n            self._bases = bases\n            self._powers = powers\n            self._expand_and_gather(decompose=decompose,\n                                    bases=decompose_bases)"},{"id":403,"name":"new-fitter.rst","nodeType":"TextFile","path":"docs/modeling","text":".. _new_fitter:\n\nDefining New Fitter Classes\n***************************\n\nThis section describes how to add a new nonlinear fitting algorithm to this\npackage or write a user-defined fitter.  In short, one needs to define an error\nfunction and a ``__call__`` method and define the types of constraints which\nwork with this fitter (if any).\n\nThe details are described below using scipy's SLSQP algorithm as an example.\nThe base class for all fitters is `~astropy.modeling.fitting.Fitter`::\n\n    class SLSQPFitter(Fitter):\n        supported_constraints = ['bounds', 'eqcons', 'ineqcons', 'fixed',\n                                 'tied']\n\n        def __init__(self):\n            # Most currently defined fitters take no arguments in their\n            # __init__, but the option certainly exists for custom fitters\n            super().__init__()\n\nAll fitters take a model (their ``__call__`` method modifies the model's\nparameters) as their first argument.\n\nNext, the error function takes a list of parameters returned by an iteration of\nthe fitting algorithm and input coordinates, evaluates the model with them and\nreturns some type of a measure for the fit.  In the example the sum of the\nsquared residuals is used as a measure of fitting.::\n\n    def objective_function(self, fps, *args):\n        model = args[0]\n        meas = args[-1]\n        model.fitparams(fps)\n        res = self.model(*args[1:-1]) - meas\n        return np.sum(res**2)\n\nThe ``__call__`` method performs the fitting. As a minimum it takes all\ncoordinates as separate arguments. Additional arguments are passed as\nnecessary::\n\n    def __call__(self, model, x, y , maxiter=MAXITER, epsilon=EPS):\n        if model.linear:\n                raise ModelLinearityException(\n                    'Model is linear in parameters; '\n                    'non-linear fitting methods should not be used.')\n        model_copy = model.copy()\n        init_values, _ = _model_to_fit_params(model_copy)\n        self.fitparams = optimize.fmin_slsqp(self.errorfunc, p0=init_values,\n                                             args=(y, x),\n                                             bounds=self.bounds,\n                                             eqcons=self.eqcons,\n                                             ineqcons=self.ineqcons)\n        return model_copy\n\nDefining a Plugin Fitter\n========================\n\n`astropy.modeling` includes a plugin mechanism which allows fitters\ndefined outside of astropy's core to be inserted into the\n`astropy.modeling.fitting` namespace through the use of entry points.\nEntry points are references to importable objects. A tutorial on defining\nentry points can be found in `setuptools' documentation <https://setuptools.readthedocs.io/en/latest/setuptools.html#dynamic-discovery-of-services-and-plugins>`_.\nPlugin fitters must to extend from the `~astropy.modeling.fitting.Fitter`\nbase class. For the fitter to be discovered and inserted into\n`astropy.modeling.fitting` the entry points must be inserted into\nthe `astropy.modeling` entry point group\n\n.. doctest-skip::\n\n    setup(\n          # ...\n          entry_points = {'astropy.modeling': 'PluginFitterName = fitter_module:PlugFitterClass'}\n    )\n\nThis would allow users to import the ``PlugFitterName`` through `astropy.modeling.fitting` by\n\n.. doctest-skip::\n\n    from astropy.modeling.fitting import PlugFitterName\n\nOne project which uses this functionality is `Saba <https://saba.readthedocs.io/>`_\nand be can be used as a reference.\n\nUsing a Custom Statistic Function\n=================================\n\nThis section describes how to write a new fitter with a user-defined statistic\nfunction.  The example below shows a specialized class which fits a straight\nline with uncertainties in both variables.\n\nThe following import statements are needed::\n\n    import numpy as np\n    from astropy.modeling.fitting import (_validate_model,\n                                          _fitter_to_model_params,\n                                          _model_to_fit_params, Fitter,\n                                          _convert_input)\n    from astropy.modeling.optimizers import Simplex\n\nFirst one needs to define a statistic. This can be a function or a callable\nclass.::\n\n    def chi_line(measured_vals, updated_model, x_sigma, y_sigma, x):\n        \"\"\"\n        Chi^2 statistic for fitting a straight line with uncertainties in x and\n        y.\n\n        Parameters\n        ----------\n        measured_vals : array\n        updated_model : `~astropy.modeling.ParametricModel`\n            model with parameters set by the current iteration of the optimizer\n        x_sigma : array\n            uncertainties in x\n        y_sigma : array\n            uncertainties in y\n\n        \"\"\"\n        model_vals = updated_model(x)\n        if x_sigma is None and y_sigma is None:\n            return np.sum((model_vals - measured_vals) ** 2)\n        elif x_sigma is not None and y_sigma is not None:\n            weights = 1 / (y_sigma ** 2 + updated_model.parameters[1] ** 2 *\n                           x_sigma ** 2)\n            return np.sum((weights * (model_vals - measured_vals)) ** 2)\n        else:\n            if x_sigma is not None:\n                weights = 1 / x_sigma ** 2\n            else:\n                weights = 1 / y_sigma ** 2\n            return np.sum((weights * (model_vals - measured_vals)) ** 2)\n\nIn general, to define a new fitter, all one needs to do is provide a statistic\nfunction and an optimizer. In this example we will let the optimizer be an\noptional argument to the fitter and will set the statistic to ``chi_line``\nabove::\n\n    class LineFitter(Fitter):\n        \"\"\"\n        Fit a straight line with uncertainties in both variables\n\n        Parameters\n        ----------\n        optimizer : class or callable\n            one of the classes in optimizers.py (default: Simplex)\n        \"\"\"\n\n        def __init__(self, optimizer=Simplex):\n            self.statistic = chi_line\n            super().__init__(optimizer, statistic=self.statistic)\n\nThe last thing to define is the ``__call__`` method::\n\n    def __call__(self, model, x, y, x_sigma=None, y_sigma=None, **kwargs):\n        \"\"\"\n        Fit data to this model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.core.ParametricModel`\n            model to fit to x, y\n        x : array\n            input coordinates\n        y : array\n            input coordinates\n        x_sigma : array\n            uncertainties in x\n        y_sigma : array\n            uncertainties in y\n        kwargs : dict\n            optional keyword arguments to be passed to the optimizer\n\n        Returns\n        ------\n        model_copy : `~astropy.modeling.core.ParametricModel`\n            a copy of the input model with parameters set by the fitter\n\n        \"\"\"\n        model_copy = _validate_model(model,\n                                     self._opt_method.supported_constraints)\n\n        farg = _convert_input(x, y)\n        farg = (model_copy, x_sigma, y_sigma) + farg\n        p0, _ = _model_to_fit_params(model_copy)\n\n        fitparams, self.fit_info = self._opt_method(\n            self.objective_function, p0, farg, **kwargs)\n        _fitter_to_model_params(model_copy, fitparams)\n\n        return model_copy\n"},{"id":404,"name":"example-fitting-line.rst","nodeType":"TextFile","path":"docs/modeling","text":".. _example_fitting_line:\n\nFitting a Line\n==============\n\nFitting a line to (x,y) data points is a common case in many areas.\nExamples fits are given for fitting, fitting using the uncertainties\nas weights, and fitting using iterative sigma clipping.\n\nSimple Fit\n----------\n\nHere the (x,y) data points are fit with a line.  The (x,y) data\npoints are simulated and have a range of uncertainties to give\na realistic example.\n\n.. plot::\n    :include-source:\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling import models, fitting\n\n    # define a model for a line\n    line_orig = models.Linear1D(slope=1.0, intercept=0.5)\n\n    # generate x, y data non-uniformly spaced in x\n    # add noise to y measurements\n    npts = 30\n    np.random.seed(10)\n    x = np.random.uniform(0.0, 10.0, npts)\n    y = line_orig(x)\n    yunc = np.absolute(np.random.normal(0.5, 2.5, npts))\n    y += np.random.normal(0.0, yunc, npts)\n\n    # initialize a linear fitter\n    fit = fitting.LinearLSQFitter()\n\n    # initialize a linear model\n    line_init = models.Linear1D()\n\n    # fit the data with the fitter\n    fitted_line = fit(line_init, x, y)\n\n    # plot\n    plt.figure()\n    plt.plot(x, y, 'ko', label='Data')\n    plt.plot(x, line_orig(x), 'b-', label='Simulation Model')\n    plt.plot(x, fitted_line(x), 'k-', label='Fitted Model')\n    plt.xlabel('x')\n    plt.ylabel('y')\n    plt.legend()\n\nFit using uncertainties\n-----------------------\n\nFitting can be done using the uncertainties as weights.\nTo get the standard weighting of 1/unc^2 for the case of\nGaussian errors, the weights to pass to the fitting are 1/unc.\n\n.. plot::\n    :include-source:\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling import models, fitting\n\n    # define a model for a line\n    line_orig = models.Linear1D(slope=1.0, intercept=0.5)\n\n    # generate x, y data non-uniformly spaced in x\n    # add noise to y measurements\n    npts = 30\n    np.random.seed(10)\n    x = np.random.uniform(0.0, 10.0, npts)\n    y = line_orig(x)\n    yunc = np.absolute(np.random.normal(0.5, 2.5, npts))\n    y += np.random.normal(0.0, yunc, npts)\n\n    # initialize a linear fitter\n    fit = fitting.LinearLSQFitter()\n\n    # initialize a linear model\n    line_init = models.Linear1D()\n\n    # fit the data with the fitter\n    fitted_line = fit(line_init, x, y, weights=1.0/yunc)\n\n    # plot\n    plt.figure()\n    plt.errorbar(x, y, yerr=yunc, fmt='ko', label='Data')\n    plt.plot(x, line_orig(x), 'b-', label='Simulation Model')\n    plt.plot(x, fitted_line(x), 'k-', label='Fitted Model')\n    plt.xlabel('x')\n    plt.ylabel('y')\n    plt.legend()\n\nIterative fitting using sigma clipping\n--------------------------------------\n\nWhen fitting, there may be data that are outliers from the fit\nthat can significantly bias the fitting.  These outliers can\nbe identified and removed from the fitting iteratively.\nNote that the iterative sigma clipping assumes all the data\nhave the same uncertainties for the sigma clipping decision.\n\n.. plot::\n    :include-source:\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.stats import sigma_clip\n    from astropy.modeling import models, fitting\n\n    # define a model for a line\n    line_orig = models.Linear1D(slope=1.0, intercept=0.5)\n\n    # generate x, y data non-uniformly spaced in x\n    # add noise to y measurements\n    npts = 30\n    np.random.seed(10)\n    x = np.random.uniform(0.0, 10.0, npts)\n    y = line_orig(x)\n    yunc = np.absolute(np.random.normal(0.5, 2.5, npts))\n    y += np.random.normal(0.0, yunc, npts)\n\n    # make true outliers\n    y[3] = line_orig(x[3]) + 6 * yunc[3]\n    y[10] = line_orig(x[10]) - 4 * yunc[10]\n\n    # initialize a linear fitter\n    fit = fitting.LinearLSQFitter()\n\n    # initialize the outlier removal fitter\n    or_fit = fitting.FittingWithOutlierRemoval(fit, sigma_clip, niter=3, sigma=3.0)\n\n    # initialize a linear model\n    line_init = models.Linear1D()\n\n    # fit the data with the fitter\n    fitted_line, mask = or_fit(line_init, x, y, weights=1.0/yunc)\n    filtered_data = np.ma.masked_array(y, mask=mask)\n\n    # plot\n    plt.figure()\n    plt.errorbar(x, y, yerr=yunc, fmt=\"ko\", fillstyle=\"none\", label=\"Clipped Data\")\n    plt.plot(x, filtered_data, \"ko\", label=\"Fitted Data\")\n    plt.plot(x, line_orig(x), 'b-', label='Simulation Model')\n    plt.plot(x, fitted_line(x), 'k-', label='Fitted Model')\n    plt.xlabel('x')\n    plt.ylabel('y')\n    plt.legend()\n"},{"col":0,"comment":"Convert a power to a floating point value, an integer, or a Fraction.\n\n    If a fractional power can be represented exactly as a floating point\n    number, convert it to a float, to make the math much faster; otherwise,\n    retain it as a `fractions.Fraction` object to avoid losing precision.\n    Conversely, if the value is indistinguishable from a rational number with a\n    low-numbered denominator, convert to a Fraction object.\n\n    Parameters\n    ----------\n    p : float, int, Rational, Fraction\n        Power to be converted\n    ","endLoc":267,"header":"def validate_power(p)","id":405,"name":"validate_power","nodeType":"Function","startLoc":225,"text":"def validate_power(p):\n    \"\"\"Convert a power to a floating point value, an integer, or a Fraction.\n\n    If a fractional power can be represented exactly as a floating point\n    number, convert it to a float, to make the math much faster; otherwise,\n    retain it as a `fractions.Fraction` object to avoid losing precision.\n    Conversely, if the value is indistinguishable from a rational number with a\n    low-numbered denominator, convert to a Fraction object.\n\n    Parameters\n    ----------\n    p : float, int, Rational, Fraction\n        Power to be converted\n    \"\"\"\n    denom = getattr(p, 'denominator', None)\n    if denom is None:\n        try:\n            p = float(p)\n        except Exception:\n            if not np.isscalar(p):\n                raise ValueError(\"Quantities and Units may only be raised \"\n                                 \"to a scalar power\")\n            else:\n                raise\n\n        # This returns either a (simple) Fraction or the same float.\n        p = maybe_simple_fraction(p)\n        # If still a float, nothing more to be done.\n        if isinstance(p, float):\n            return p\n\n        # Otherwise, check for simplifications.\n        denom = p.denominator\n\n    if denom == 1:\n        p = p.numerator\n\n    elif (denom & (denom - 1)) == 0:\n        # Above is a bit-twiddling hack to see if denom is a power of two.\n        # If so, float does not lose precision and will speed things up.\n        p = float(p)\n\n    return p"},{"id":406,"name":"jointfitter.rst","nodeType":"TextFile","path":"docs/modeling","text":".. _jointfitter:\n\nJointFitter\n===========\n\nThere are cases where one may wish to fit multiple datasets with models that\nshare parameters.  This is possible with the\n`astropy.modeling.fitting.JointFitter`.  Basically, this fitter is\nsetup with a list of defined models, the parameters in common between the\ndifferent models, and the initial values for those parameters. Then the fitter\nis called supplying as many x and y arrays, one for each model to be fit.  The\nfit parameters are the result of the jointly fitting the models to the\ncombined datasets.\n\n.. note::\n   The JointFitter uses the scipy.optimize.leastsq.  In addition, it\n   does not support fixed, bounded, or tied parameters at this time.\n\nExample: Spectral Line\n======================\n\nThis example is for two spectral segments with different spectral resolutions\nthat have the same spectral line in the wavelength region that is overlapping\nbetween both segments.\n\nWe will need to define a Gaussian function that has mean wavelength, area, and\nwidth parameters.  This is needed as the `astropy.modeling.functional_models.Gaussian1D`\nfunction has mean wavelength, central intensity, and width parameters, but the\ncentral intensity of a line will be different at different spectral resolutions,\nbut the area will be the same.\n\nFirst, imports needed for this example\n\n   >>> # imports\n   >>> import math\n   >>> import numpy as np\n   >>> from astropy.modeling import fitting, Fittable1DModel\n   >>> from astropy.modeling.parameters import Parameter\n   >>> from astropy.modeling.functional_models import FLOAT_EPSILON\n\nNow define AreaGaussian1D with area instead of intensity as a parameter.\nThis new is modified and trimmed version of the standard Gaussian1D model.\n\n   >>> class AreaGaussian1D(Fittable1DModel):\n   ...   \"\"\"\n   ...   One dimensional Gaussian model with area as a parameter.\n   ...\n   ...   Parameters\n   ...   ----------\n   ...   area : float or `~astropy.units.Quantity`.\n   ...       Integrated area\n   ...       Note: amplitude = area / (stddev * np.sqrt(2 * np.pi))\n   ...   mean : float or `~astropy.units.Quantity`.\n   ...       Mean of the Gaussian.\n   ...   stddev : float or `~astropy.units.Quantity`.\n   ...       Standard deviation of the Gaussian with FWHM = 2 * stddev * np.sqrt(2 * np.log(2)).\n   ...   \"\"\"\n   ...   area = Parameter(default=1)\n   ...   mean = Parameter(default=0)\n   ...\n   ...   # Ensure stddev makes sense if its bounds are not explicitly set.\n   ...   # stddev must be non-zero and positive.\n   ...   stddev = Parameter(default=1, bounds=(FLOAT_EPSILON, None))\n   ...\n   ...   @staticmethod\n   ...   def evaluate(x, area, mean, stddev):\n   ...       \"\"\"\n   ...       AreaGaussian1D model function.\n   ...       \"\"\"\n   ...       return (area / (stddev * np.sqrt(2 * np.pi))) * np.exp(\n   ...           -0.5 * (x - mean) ** 2 / stddev ** 2\n   ...       )\n\nData to be fit is simulated.  The 1st spectral segment will have a spectral\nresolution that is a factor of 2 higher than the second segment.  The first\nsegment will have wavelengths from 1 to 6 and the second from 4 to 10 giving\nan overlapping wavelength region from 4 to 6.\n\n   >>> # Generate fake data\n   >>> mean = 5.1\n   >>> sigma1 = 0.2\n   >>> sigma2 = 0.4\n   >>> noise = 0.10\n\n   >>> # compute the central amplitudes so the lines in each segment have the\n   >>> # same area\n   >>> area = 1.5\n   >>> amp1 = area / np.sqrt(2.0 * math.pi * sigma1 ** 2)\n   >>> amp2 = area / np.sqrt(2.0 * math.pi * sigma2 ** 2)\n\n   >>> # segment 1\n   >>> np.random.seed(0)\n   >>> x1 = np.linspace(1.0, 6.0, 200)\n   >>> y1 = amp1 * np.exp(-0.5 * (x1 - mean) ** 2 / sigma1 ** 2)\n   >>> y1 += np.random.normal(0.0, noise, x1.shape)\n\n   >>> # segment 2\n   >>> np.random.seed(0)\n   >>> x2 = np.linspace(4.0, 10.0, 200)\n   >>> y2 = amp2 * np.exp(-0.5 * (x2 - mean) ** 2 / sigma2 ** 2)\n   >>> y2 += np.random.normal(0.0, noise, x2.shape)\n\nNow define the models to be fit and fitter to use.  Then fit the two simulated\ndatasets.\n\n   >>> # define the two models to be fit\n   >>> gjf1 = AreaGaussian1D(area=1.0, mean=5.0, stddev=1.0)\n   >>> gjf2 = AreaGaussian1D(area=1.0, mean=5.0, stddev=1.0)\n\n.. doctest-requires:: scipy\n\n   >>> # define the jointfitter specifying the parameters in common and their initial values\n   >>> fit_joint = fitting.JointFitter(\n   ...    [gjf1, gjf2], {gjf1: [\"area\", \"mean\"], gjf2: [\"area\", \"mean\"]}, [1.0, 5.0]\n   ... )\n   >>>\n   >>> # perform the fit\n   >>> g12 = fit_joint(x1, y1, x2, y2)\n\n\nThe resulting fit parameters show that the area and mean wavelength of the\ntwo AreaGaussian1D models are exactly the same while the width (stddev) is\ndifferent reflecting the different spectral resolutions of the two segments.\n\nAreaGaussian1 parameters\n\n.. doctest-requires:: scipy\n\n   >>> print(gjf1.param_names)\n   ('area', 'mean', 'stddev')\n   >>> print(gjf1.parameters)\n   [1.48697226 5.09826068 0.19761087]\n\nAreaGaussian2 parameters\n\n.. doctest-requires:: scipy\n\n   >>> print(gjf1.param_names)\n   ('area', 'mean', 'stddev')\n   >>> print(gjf2.parameters)\n   [1.48697226 5.09826068 0.4015368 ]\n\n\nThe simulated data and best fit models can be plotted showing good agreement\nbetween the two AreaGaussian1D models and the two spectral segments.\n\n.. plot::\n\n   # imports\n   import numpy as np\n   import math\n   import matplotlib.pyplot as plt\n   from astropy.modeling import fitting, Fittable1DModel\n   from astropy.modeling.parameters import Parameter\n   from astropy.modeling.functional_models import FLOAT_EPSILON\n\n\n   class AreaGaussian1D(Fittable1DModel):\n       \"\"\"\n       One dimensional Gaussian model with area as a parameter.\n\n       Parameters\n       ----------\n       area : float or `~astropy.units.Quantity`.\n           Integrated area\n           Note: amplitude = area / (stddev * np.sqrt(2 * np.pi))\n       mean : float or `~astropy.units.Quantity`.\n           Mean of the Gaussian.\n       stddev : float or `~astropy.units.Quantity`.\n           Standard deviation of the Gaussian with FWHM = 2 * stddev * np.sqrt(2 * np.log(2)).\n       \"\"\"\n\n       area = Parameter(default=1)\n       mean = Parameter(default=0)\n\n       # Ensure stddev makes sense if its bounds are not explicitly set.\n       # stddev must be non-zero and positive.\n       stddev = Parameter(default=1, bounds=(FLOAT_EPSILON, None))\n\n       @staticmethod\n       def evaluate(x, area, mean, stddev):\n           \"\"\"\n           AreaGaussian1D model function.\n           \"\"\"\n           return (area / (stddev * np.sqrt(2 * np.pi))) * np.exp(\n               -0.5 * (x - mean) ** 2 / stddev ** 2\n           )\n\n\n   # Generate fake data\n   mean = 5.1\n   sigma1 = 0.2\n   sigma2 = 0.4\n   noise = 0.10\n\n   # compute the central amplitudes so the lines in each segment have the\n   # same area\n   area = 1.5\n   amp1 = area / np.sqrt(2.0 * math.pi * sigma1 ** 2)\n   amp2 = area / np.sqrt(2.0 * math.pi * sigma2 ** 2)\n\n   # segment 1\n   np.random.seed(0)\n   x1 = np.linspace(1.0, 6.0, 200)\n   y1 = amp1 * np.exp(-0.5 * (x1 - mean) ** 2 / sigma1 ** 2)\n   y1 += np.random.normal(0.0, noise, x1.shape)\n\n   # segment 2\n   np.random.seed(0)\n   x2 = np.linspace(4.0, 10.0, 200)\n   y2 = amp2 * np.exp(-0.5 * (x2 - mean) ** 2 / sigma2 ** 2)\n   y2 += np.random.normal(0.0, noise, x2.shape)\n\n   # define the two models to be fit\n   gjf1 = AreaGaussian1D(area=1.0, mean=5.0, stddev=1.0)\n   gjf2 = AreaGaussian1D(area=1.0, mean=5.0, stddev=1.0)\n\n   # define the jointfitter specifying the parameters in common and their initial values\n   fit_joint = fitting.JointFitter(\n       [gjf1, gjf2], {gjf1: [\"area\", \"mean\"], gjf2: [\"area\", \"mean\"]}, [1.0, 5.0]\n   )\n\n   # perform the fit\n   g12 = fit_joint(x1, y1, x2, y2)\n\n   # Plot the data with the best-fit models\n   plt.figure(figsize=(8, 5))\n   plt.plot(x1, y1, \"bo\", alpha=0.25)\n   plt.plot(x2, y2, \"go\", alpha=0.25)\n   plt.plot(x1, gjf1(x1), \"b--\", label=\"AreaGaussian1\")\n   plt.plot(x2, gjf2(x2), \"g--\", label=\"AreaGaussian2\")\n   plt.xlabel(\"Wavelength\")\n   plt.ylabel(\"Flux\")\n   plt.legend(loc=2)\n"},{"id":407,"name":"example-fitting-model-sets.rst","nodeType":"TextFile","path":"docs/modeling","text":".. _example-fitting-model-sets:\n\nFitting Model Sets\n==================\n\nAstropy model sets let you fit the same (linear) model to lots of independent\ndata sets. It solves the linear equations simultaneously, so can avoid looping.\nBut getting the data into the right shape can be a bit tricky.\n\nThe time savings could be worth the effort. In the example below, if we change\nthe width*height of the data cube to 500*500 it takes 140 ms on a 2015 MacBook Pro\nto fit the models using model sets. Doing the same fit by looping over the 500*500 models\ntakes 1.5 minutes, more than 600 times slower.\n\nIn the example below, we create a 3D data cube where the first dimension is a ramp --\nfor example as from non-destructive readouts of an IR detector. So each pixel has a\ndepth along a time axis, and flux that results a total number of counts that is\nincreasing with time. We will be fitting a 1D polynomial vs. time to estimate the\nflux in counts/second (the slope of the fit). We will use just a small image\nof 3 rows by 4 columns, with a depth of 10 non-destructive reads.\n\nFirst, import the necessary libraries:\n\n    >>> import numpy as np\n    >>> np.random.seed(seed=12345)\n    >>> from astropy.modeling import models, fitting\n\n    >>> depth, width, height = 10, 3, 4  # Time is along the depth axis\n    >>> t = np.arange(depth, dtype=np.float64)*10.  # e.g. readouts every 10 seconds\n\nThe number of counts in neach pixel is flux*time with the addition of some Gaussian noise::\n\n    >>> fluxes = np.arange(1. * width * height).reshape(width, height)\n    >>> image = fluxes[np.newaxis, :, :] * t[:, np.newaxis, np.newaxis]\n    >>> image += np.random.normal(0., image*0.05, size=image.shape)  # Add noise\n    >>> image.shape\n    (10, 3, 4)\n\nCreate the models and the fitter. We need N=width*height instances of the same linear,\nparametric model (model sets currently only work with linear models and fitters)::\n\n    >>> N = width * height\n    >>> line = models.Polynomial1D(degree=1, n_models=N)\n    >>> fit = fitting.LinearLSQFitter()\n    >>> print(f\"We created {len(line)} models\")\n    We created 12 models\n\nWe need to get the data to be fit into the right shape. It's not possible to just feed\nthe 3D data cube. In this case, the time axis can be one dimensional.\nThe fluxes have to be organized into an array that is of shape ``width*height,depth`` --  in\nother words, we are reshaping to flatten last two axes and transposing to put them first::\n\n    >>> pixels = image.reshape((depth, width*height))\n    >>> y = pixels.T\n    >>> print(\"x axis is one dimensional: \",t.shape)\n    x axis is one dimensional:  (10,)\n    >>> print(\"y axis is two dimensional, N by len(x): \", y.shape)\n    y axis is two dimensional, N by len(x):  (12, 10)\n\nFit the model. It fits the N models simultaneously::\n\n    >>> new_model = fit(line, x=t, y=y)\n    >>> print(f\"We fit {len(new_model)} models\")\n    We fit 12 models\n\nFill an array with values computed from the best fit and reshape it to match the original::\n\n    >>> best_fit = new_model(t, model_set_axis=False).T.reshape((depth, height, width))\n    >>> print(\"We reshaped the best fit to dimensions: \", best_fit.shape)\n    We reshaped the best fit to dimensions:  (10, 4, 3)\n\nNow inspect the model::\n\n    >>> print(new_model) # doctest: +FLOAT_CMP\n    Model: Polynomial1D\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Model set size: 12\n    Degree: 1\n    Parameters:\n                 c0                 c1\n        ------------------- ------------------\n\t                0.0                0.0\n\t-0.5206606340901005 1.0463998276552442\n         0.6401930368329991 1.9818733492667582\n         0.1134712985541639  3.049279878262541\n        -3.3556420351251313  4.013810434122983\n          6.782223372575449  4.755912707001437\n          3.628220497058842  5.841397947835126\n        -5.8828309622531565  7.016044775363114\n        -11.676538736037775  8.072519832452022\n          -6.17932185981594  9.103924115403503\n        -4.7258541419613165 10.315295021908833\n           4.95631951675311 10.911167956770575\n\n    >>> print(\"The new_model has a param_sets attribute with shape: \",new_model.param_sets.shape)\n    The new_model has a param_sets attribute with shape:  (2, 12)\n\n    >>> print(f\"And values that are the best-fit parameters for each pixel:\\n{new_model.param_sets}\") # doctest: +FLOAT_CMP\n    And values that are the best-fit parameters for each pixel:\n    [[  0.          -0.52066063   0.64019304   0.1134713   -3.35564204\n        6.78222337   3.6282205   -5.88283096 -11.67653874  -6.17932186\n       -4.72585414   4.95631952]\n     [  0.           1.04639983   1.98187335   3.04927988   4.01381043\n        4.75591271   5.84139795   7.01604478   8.07251983   9.10392412\n       10.31529502  10.91116796]]\n\nPlot the fit along a couple of pixels:\n\n    >>> def plotramp(t, image, best_fit, row, col):\n    ...     plt.plot(t, image[:, row, col], '.', label=f'data pixel {row},{col}')\n    ...     plt.plot(t, best_fit[:, row, col], '-', label=f'fit to pixel {row},{col}')\n    ...     plt.xlabel('Time')\n    ...     plt.ylabel('Counts')\n    ...     plt.legend(loc='upper left')\n    >>> fig = plt.figure(figsize=(10, 5)) # doctest: +SKIP\n    >>> plotramp(t, image, best_fit, 1, 1) # doctest: +SKIP\n    >>> plotramp(t, image, best_fit, 2, 1) # doctest: +SKIP\n\nThe data and the best fit model are shown together on one plot.\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from scipy import stats\n    from astropy.modeling import models, fitting\n\n    # Set up the shape of the image and create the time axis\n    depth,width,height=10,3,4 # Time is along the depth axis\n    t = np.arange(depth, dtype=np.float64)*10.  # e.g. readouts every 10 seconds\n\n    # Make up a flux in each pixel\n    fluxes = np.arange(1.*width*height).reshape(height, width)\n    # Create the ramps by integrating the fluxes along the time steps\n    image = fluxes[np.newaxis, :, :] * t[:, np.newaxis, np.newaxis]\n    # Add some Gaussian noise to each sample\n    image += stats.norm.rvs(0., image*0.05, size=image.shape)  # Add noise\n\n    # Create the models and the fitter\n    N = width * height # This is how many instances we need\n    line = models.Polynomial1D(degree=1, n_models=N)\n    fit = fitting.LinearLSQFitter()\n\n    # We need to get the data to be fit into the right shape\n    # In this case, the time axis can be one dimensional.\n    # The fluxes have to be organized into an array\n    # that is of shape `(width*height, depth)`\n    # i.e we are reshaping to flatten last two axes and\n    # transposing to put them first.\n    pixels = image.reshape((depth, width*height))\n    y = pixels.T\n\n    # Fit the model. It does the looping over the N models implicitly\n    new_model = fit(line, x=t, y=y)\n\n    # Fill an array with values computed from the best fit and reshape it to match the original\n    best_fit = new_model(t, model_set_axis=False).T.reshape((depth, height, width))\n\n\n    # Plot the fit along a couple of pixels\n    def plotramp(t, image, best_fit, row, col):\n        plt.plot(t, image[:, row, col], '.', label=f'data pixel {row},{col}')\n        plt.plot(t, best_fit[:, row, col], '-', label=f'fit to pixel {row},{col}')\n        plt.xlabel('Time')\n        plt.ylabel('Counts')\n        plt.legend(loc='upper left')\n\n\n    plt.figure(figsize=(10, 5))\n    plotramp(t, image, best_fit, 1, 1)\n    plotramp(t, image, best_fit, 3, 2)\n    plt.show()\n"},{"id":408,"name":"predef_models1D.rst","nodeType":"TextFile","path":"docs/modeling","text":".. _predef_models1D:\n\n*********\n1D Models\n*********\n\nOperations\n==========\n\nThese models perform simple mathematical operations.\n\n- :class:`~astropy.modeling.functional_models.Const1D` model returns the\n  constant replicated by the number of input x values.\n\n- :class:`~astropy.modeling.functional_models.Multiply` model multiples the\n  input x values by a factor and propagates units if the factor is\n  a :class:`~astropy.units.Quantity`.\n\n- :class:`~astropy.modeling.functional_models.RedshiftScaleFactor` model\n  multiples the input x values by a (1 + z) factor.\n\n- :class:`~astropy.modeling.functional_models.Scale` model multiples by a\n  factor without changing the units of the result.\n\n- :class:`~astropy.modeling.functional_models.Shift` model adds a constant\n  to the input x values.\n\nShapes\n======\n\nThese models provide shapes, often used to model general x, y data.\n\n- :class:`~astropy.modeling.functional_models.Linear1D` model provides a\n  line parameterizied by the slope and y-intercept\n\n- :class:`~astropy.modeling.functional_models.Sine1D` model provides a sine\n  parameterized by an amplitude, frequency, and phase.\n\n- :class:`~astropy.modeling.functional_models.Cosine1D` model provides a\n  cosine parameterized by an amplitude, frequency, and phase.\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    from astropy.modeling.models import (Linear1D, Sine1D, Cosine1D)\n\n    x = np.linspace(-4.0, 6.0, num=100)\n\n    fig, sax = plt.subplots(ncols=3, figsize=(10, 5))\n    ax = sax.flatten()\n\n    linemod = Linear1D(slope=2., intercept=1.)\n    ax[0].plot(x, linemod(x), label=\"Linear1D\")\n\n    sinemod = Sine1D(amplitude=10., frequency=0.5, phase=0.)\n    ax[1].plot(x, sinemod(x), label=\"Sine1D\")\n    ax[1].set_ylim(-11.0, 13.0)\n\n    cosinemod = Cosine1D(amplitude=10., frequency=0.5, phase=0)\n    ax[2].plot(x, cosinemod(x), label=\"Cosine1D\")\n    ax[2].set_ylim(-11.0, 13.0)\n\n    for k in range(3):\n        ax[k].set_xlabel(\"x\")\n        ax[k].set_ylabel(\"y\")\n        ax[k].legend()\n\n    plt.tight_layout()\n    plt.show()\n\nProfiles\n========\n\nThese models provide profiles, often used for lines in spectra.\n\n- :class:`~astropy.modeling.functional_models.Box1D` model computes a box\n  function with an amplitude centered at x_0 with the specified width.\n\n- :class:`~astropy.modeling.functional_models.Gaussian1D` model computes\n  a Gaussian with an amplitude centered at x_0 with the specified width.\n\n- :class:`~astropy.modeling.functional_models.KingProjectedAnalytic1D` model\n  computes the analytic form of the a King model with an amplitude and\n  core and tidal radii.\n\n- :class:`~astropy.modeling.functional_models.Lorentz1D` model computes\n  a Lorentzian with an amplitude centered at x_0 with the specified width.\n\n- :class:`~astropy.modeling.functional_models.RickerWavelet1D` model computes\n  a RickerWavelet function with an amplitude centered at x_0 with the specified width.\n\n- :class:`~astropy.modeling.functional_models.Moffat1D` model computes a\n  Moffat function with an amplitude centered at x_0 with the specified width.\n\n- :class:`~astropy.modeling.functional_models.Sersic1D` model\n  computes a Sersic model with an amplitude with an effective radius and\n  the specified sersic index.\n\n- :class:`~astropy.modeling.functional_models.Trapezoid1D` model computes a\n  box with sloping sides with an amplitude centered at x_0 with the specified\n  width and sides with the specified slope.\n\n- :class:`~astropy.modeling.functional_models.Voigt1D` model computes a\n  Voigt function with an amplitude centered at x_0 with the specified\n  Lorentzian and Gaussian widths.\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    from astropy.modeling.models import (\n        Box1D,\n        Gaussian1D,\n        RickerWavelet1D,\n        Moffat1D,\n        Lorentz1D,\n        Sersic1D,\n        Trapezoid1D,\n        KingProjectedAnalytic1D,\n        Voigt1D,\n    )\n\n    x = np.linspace(-4.0, 6.0, num=100)\n    r = np.logspace(-1.0, 2.0, num=100)\n\n    fig, sax = plt.subplots(nrows=3, ncols=3, figsize=(10, 10))\n    ax = sax.flatten()\n\n    mods = [\n        Box1D(amplitude=10.0, x_0=1.0, width=1.0),\n        Gaussian1D(amplitude=10.0, mean=1.0, stddev=1.0),\n        KingProjectedAnalytic1D(amplitude=10.0, r_core=1.0, r_tide=10.0),\n        Lorentz1D(amplitude=10.0, x_0=1.0, fwhm=1.0),\n        RickerWavelet1D(amplitude=10.0, x_0=1.0, sigma=1.0),\n        Moffat1D(amplitude=10.0, x_0=1.0, gamma=1.0, alpha=1.),\n        Sersic1D(amplitude=10.0, r_eff=1.0 / 2.0, n=5),\n        Trapezoid1D(amplitude=10.0, x_0=1.0, width=1.0, slope=5.0),\n        Voigt1D(amplitude_L=10.0, x_0=1.0, fwhm_L=1.0, fwhm_G=1.0),\n    ]\n\n    for k, mod in enumerate(mods):\n        cname = mod.__class__.__name__\n        ax[k].set_title(cname)\n        if cname in [\"KingProjectedAnalytic1D\", \"Sersic1D\"]:\n            ax[k].plot(r, mod(r))\n            ax[k].set_xscale(\"log\")\n            ax[k].set_yscale(\"log\")\n        else:\n            ax[k].plot(x, mod(x))\n\n    for k in range(len(mods)):\n        ax[k].set_xlabel(\"x\")\n        ax[k].set_ylabel(\"y\")\n\n    # remove axis for any plots not used\n    for k in range(len(mods), len(ax)):\n        ax[k].axis(\"off\")\n\n    plt.tight_layout()\n    plt.show()\n"},{"id":409,"name":"example-fitting-constraints.rst","nodeType":"TextFile","path":"docs/modeling","text":"Fitting with constraints\n========================\n\n`~astropy.modeling.fitting` support constraints, however, different fitters support\ndifferent types of constraints. The `~astropy.modeling.fitting.Fitter.supported_constraints`\nattribute shows the type of constraints supported by a specific fitter::\n\n    >>> from astropy.modeling import fitting\n    >>> fitting.LinearLSQFitter.supported_constraints\n    ['fixed']\n    >>> fitting.LevMarLSQFitter.supported_constraints\n    ['fixed', 'tied', 'bounds']\n    >>> fitting.SLSQPLSQFitter.supported_constraints\n    ['bounds', 'eqcons', 'ineqcons', 'fixed', 'tied']\n\nFixed Parameter Constraint\n--------------------------\n\nAll fitters support fixed (frozen) parameters through the ``fixed`` argument\nto models or setting the `~astropy.modeling.Parameter.fixed`\nattribute directly on a parameter.\n\nFor linear fitters, freezing a polynomial coefficient means that the\ncorresponding term will be subtracted from the data before fitting a\npolynomial without that term to the result. For example, fixing ``c0`` in a\npolynomial model will fit a polynomial with the zero-th order term missing\nto the data minus that constant. The fixed coefficients and corresponding terms\nare restored to the fit polynomial and this is the polynomial returned from the fitter::\n\n    >>> import numpy as np\n    >>> np.random.seed(seed=12345)\n    >>> from astropy.modeling import models, fitting\n    >>> x = np.arange(1, 10, .1)\n    >>> p1 = models.Polynomial1D(2, c0=[1, 1], c1=[2, 2], c2=[3, 3],\n    ...                          n_models=2)\n    >>> p1  # doctest: +FLOAT_CMP\n    <Polynomial1D(2, c0=[1., 1.], c1=[2., 2.], c2=[3., 3.], n_models=2)>\n    >>> y = p1(x, model_set_axis=False)\n    >>> n = (np.random.randn(y.size)).reshape(y.shape)\n    >>> p1.c0.fixed = True\n    >>> pfit = fitting.LinearLSQFitter()\n    >>> new_model = pfit(p1, x, y + n)  # doctest: +IGNORE_WARNINGS\n    >>> print(new_model)  # doctest: +SKIP\n    Model: Polynomial1D\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Model set size: 2\n    Degree: 2\n    Parameters:\n         c0         c1                 c2\n        --- ------------------ ------------------\n        1.0  2.072116176718454   2.99115839177437\n        1.0 1.9818866652726403 3.0024208951927585\n\nThe syntax to fix the same parameter ``c0`` using an argument to the model\ninstead of ``p1.c0.fixed = True`` would be::\n\n    >>> p1 = models.Polynomial1D(2, c0=[1, 1], c1=[2, 2], c2=[3, 3],\n    ...                          n_models=2, fixed={'c0': True})\n\n\nBounded Constraints\n-------------------\n\nBounded fitting is supported through the ``bounds`` arguments to models or by\nsetting `~astropy.modeling.Parameter.min` and `~astropy.modeling.Parameter.max`\nattributes on a parameter.  Bounds for the\n`~astropy.modeling.fitting.LevMarLSQFitter` are always exactly satisfied--if\nthe value of the parameter is outside the fitting interval, it will be reset to\nthe value at the bounds. The `~astropy.modeling.fitting.SLSQPLSQFitter` optimization\nalgorithm handles bounds internally.\n\n.. _tied:\n\nTied Constraints\n----------------\n\nThe `~astropy.modeling.Parameter.tied` constraint is often useful with :ref:`Compound models <compound-models-intro>`.\nIn this example we will read a spectrum from a file called ``spec.txt``\nand fit Gaussians to the lines simultaneously while linking the flux of the OIII_1 and OIII_2 lines.\n\n.. plot::\n    :include-source:\n\n    import numpy as np\n    from astropy.io import ascii\n    from astropy.utils.data import get_pkg_data_filename\n    from astropy.modeling import models, fitting\n    fname = get_pkg_data_filename('data/spec.txt', package='astropy.modeling.tests')\n    spec = ascii.read(fname)\n    wave = spec['lambda']\n    flux = spec['flux']\n\n    # Use the rest wavelengths of known lines as initial values for the fit.\n\n    Hbeta = 4862.721\n    OIII_1 = 4958.911\n    OIII_2 = 5008.239\n\n    # Create Gaussian1D models for each of the Hbeta and OIII lines.\n\n    h_beta = models.Gaussian1D(amplitude=34, mean=Hbeta, stddev=5)\n    o3_2 = models.Gaussian1D(amplitude=170, mean=OIII_2, stddev=5)\n    o3_1 = models.Gaussian1D(amplitude=57, mean=OIII_1, stddev=5)\n\n\n    # Tie the ratio of the intensity of the two OIII lines.\n\n    def tie_ampl(model):\n        return model.amplitude_2 / 3.1\n\n    o3_1.amplitude.tied = tie_ampl\n\n\n    # Also tie the wavelength of the Hbeta line to the OIII wavelength.\n\n    def tie_wave(model):\n        return model.mean_0 * OIII_1 / Hbeta\n\n    o3_1.mean.tied = tie_wave\n\n    # Create a Polynomial model to fit the continuum.\n\n    mean_flux = flux.mean()\n    cont = np.where(flux > mean_flux, mean_flux, flux)\n    linfitter = fitting.LinearLSQFitter()\n    poly_cont = linfitter(models.Polynomial1D(1), wave, cont)\n\n    # Create a compound model for the three lines and the continuum.\n\n    hbeta_combo = h_beta + o3_1 + o3_2 + poly_cont\n\n    # Fit all lines simultaneously -\n    # this will need one iteration more than the default of 100.\n\n    fitter = fitting.LevMarLSQFitter()\n    fitted_model = fitter(hbeta_combo, wave, flux, maxiter=111)\n    fitted_lines = fitted_model(wave)\n\n    from matplotlib import pyplot as plt\n    fig = plt.figure(figsize=(9, 6))\n    p = plt.plot(wave, flux, label=\"data\")\n    p = plt.plot(wave, fitted_lines, 'r', label=\"fit\")\n    p = plt.legend()\n    p = plt.xlabel(\"Wavelength\")\n    p = plt.ylabel(\"Flux\")\n    t = plt.text(4800, 70, 'Hbeta', rotation=90)\n    t = plt.text(4900, 100, 'OIII_1', rotation=90)\n    t = plt.text(4950, 180, 'OIII_2', rotation=90)\n    plt.show()\n"},{"id":410,"name":"new-model.rst","nodeType":"TextFile","path":"docs/modeling","text":".. _modeling-new-classes:\n\n**************************\nDefining New Model Classes\n**************************\n\nThis document describes how to add a model to the package or to create a\nuser-defined model. In short, one needs to define all model parameters and\nwrite a function which evaluates the model, that is, computes the mathematical\nfunction that implements the model.  If the model is fittable, a function to\ncompute the derivatives with respect to parameters is required if a linear\nfitting algorithm is to be used and optional if a non-linear fitter is to be\nused.\n\n\nBasic custom models\n===================\n\nFor most cases, the `~astropy.modeling.custom_model` decorator provides an\neasy way to make a new `~astropy.modeling.Model` class from an existing Python\ncallable. The following example demonstrates how to set up a model consisting\nof two Gaussians:\n\n.. plot::\n   :include-source:\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import custom_model\n    from astropy.modeling.fitting import LevMarLSQFitter\n\n    # Define model\n    @custom_model\n    def sum_of_gaussians(x, amplitude1=1., mean1=-1., sigma1=1.,\n                            amplitude2=1., mean2=1., sigma2=1.):\n        return (amplitude1 * np.exp(-0.5 * ((x - mean1) / sigma1)**2) +\n                amplitude2 * np.exp(-0.5 * ((x - mean2) / sigma2)**2))\n\n    # Generate fake data\n    np.random.seed(0)\n    x = np.linspace(-5., 5., 200)\n    m_ref = sum_of_gaussians(amplitude1=2., mean1=-0.5, sigma1=0.4,\n                             amplitude2=0.5, mean2=2., sigma2=1.0)\n    y = m_ref(x) + np.random.normal(0., 0.1, x.shape)\n\n    # Fit model to data\n    m_init = sum_of_gaussians()\n    fit = LevMarLSQFitter()\n    m = fit(m_init, x, y)\n\n    # Plot the data and the best fit\n    plt.plot(x, y, 'o', color='k')\n    plt.plot(x, m(x))\n\n\nThis decorator also supports setting a model's\n`~astropy.modeling.FittableModel.fit_deriv` as well as creating models with\nmore than one inputs.  Note that when creating a model from a function with\nmultiple outputs, the keyword argument ``n_outputs`` must be set to the\nnumber of outputs of the function.  It can also be used as a normal factory\nfunction (for example ``SumOfGaussians = custom_model(sum_of_gaussians)``)\nrather than as a decorator.  See the `~astropy.modeling.custom_model`\ndocumentation for more examples.\n\n\nA step by step definition of a 1-D Gaussian model\n=================================================\n\nThe example described in `Basic custom models`_ can be used for most simple\ncases, but the following section describes how to construct model classes in\ngeneral.  Defining a full model class may be desirable, for example, to\nprovide more specialized parameters, or to implement special functionality not\nsupported by the basic `~astropy.modeling.custom_model` factory function.\n\nThe details are explained below with a 1-D Gaussian model as an example.  There\nare two base classes for models. If the model is fittable, it should inherit\nfrom `~astropy.modeling.FittableModel`; if not it should subclass\n`~astropy.modeling.Model`.\n\nIf the model takes parameters they should be specified as class attributes in\nthe model's class definition using the `~astropy.modeling.Parameter`\ndescriptor.  All arguments to the Parameter constructor are optional, and may\ninclude a default value for that parameter, a text description of the parameter\n(useful for `help` and documentation generation), as well default constraints\nand custom getters/setters for the parameter value.  It is also possible to\ndefine a \"validator\" method for each parameter, enabling custom code to check\nwhether that parameter's value is valid according to the model definition (for\nexample if it must be non-negative).  See the example in\n`Parameter.validator <astropy.modeling.Parameter.validator>` for more details.\n\n::\n\n    from astropy.modeling import Fittable1DModel, Parameter\n\n    class Gaussian1D(Fittable1DModel):\n        n_inputs = 1\n        n_outputs = 1\n\n        amplitude = Parameter()\n        mean = Parameter()\n        stddev = Parameter()\n\nThe ``n_inputs`` and ``n_outputs`` class attributes must be integers\nindicating the number of independent variables that are input to evaluate the\nmodel, and the number of outputs it returns.  The labels of the inputs and\noutputs, ``inputs`` and ``outputs``, are generated automatically. It is possible\nto overwrite the default ones by assigning the desired values in the class ``__init__``\nmethod, after calling ``super``. ``outputs`` and ``inputs`` must be tuples of\nstrings with length ``n_outputs`` and ``n_inputs`` respectively.\nOutputs may have the same labels as inputs (eg. ``inputs = ('x', 'y')`` and ``outputs = ('x', 'y')``).\nHowever, inputs must not conflict with each other (eg. ``inputs = ('x', 'x')`` is\nincorrect) and likewise for outputs.\n\nThere are two helpful base classes in the modeling package that can be used to\navoid specifying ``n_inputs`` and ``n_outputs`` for most common models.  These are\n`~astropy.modeling.Fittable1DModel` and `~astropy.modeling.Fittable2DModel`.\nFor example, the actual `~astropy.modeling.functional_models.Gaussian1D` model is\na subclass of `~astropy.modeling.Fittable1DModel`. This helps cut\ndown on boilerplate by not having to specify ``n_inputs``, ``n_outputs``, ``inputs``\nand ``outputs`` for many models (follow the link to Gaussian1D to see its source code, for\nexample).\n\nFittable models can be linear or nonlinear in a regression sense. The default\nvalue of the `~astropy.modeling.Model.linear` attribute is ``False``.  Linear\nmodels should define the ``linear`` class attribute as ``True``.  Because this\nmodel is non-linear we can stick with the default.\n\nModels which inherit from `~astropy.modeling.Fittable1DModel` have the\n``Model._separable`` property already set to ``True``.\nAll other models should define this property to indicate the\n:ref:`separability`.\n\nNext, provide methods called ``evaluate`` to evaluate the model and\n``fit_deriv``, to compute its derivatives with respect to parameters.  These\nmay be normal methods, `classmethod`, or `staticmethod`, though the convention\nis to use `staticmethod` when the function does not depend on any of the\nobject's other attributes (i.e., it does not reference ``self``) or any of the\nclass's other attributes as in the case of `classmethod`.  The evaluation\nmethod takes all input coordinates as separate arguments and all of the model's\nparameters in the same order they would be listed by\n`~astropy.modeling.Model.param_names`.\n\nFor this example::\n\n    @staticmethod\n    def evaluate(x, amplitude, mean, stddev):\n        return amplitude * np.exp((-(1 / (2. * stddev**2)) * (x - mean)**2))\n\nIt should be made clear that the ``evaluate`` method must be designed to take\nthe model's parameter values as arguments.  This may seem at odds with the fact\nthat the parameter values are already available via attribute of the model\n(eg. ``model.amplitude``).  However, passing the parameter values directly to\n``evaluate`` is a more efficient way to use it in many cases, such as fitting.\n\nUsers of your model would not generally use ``evaluate`` directly.  Instead\nthey create an instance of the model and call it on some input.  The\n``__call__`` method of models uses ``evaluate`` internally, but users do not\nneed to be aware of it.  The default ``__call__`` implementation also handles\ndetails such as checking that the inputs are correctly formatted and follow\nNumpy's broadcasting rules before attempting to evaluate the model.\n\nLike ``evaluate``, the ``fit_deriv`` method takes as input all coordinates and\nall parameter values as arguments.  There is an option to compute numerical\nderivatives for nonlinear models in which case the ``fit_deriv`` method should\nbe ``None``::\n\n    @staticmethod\n    def fit_deriv(x, amplitude, mean, stddev):\n        d_amplitude = np.exp(- 0.5 / stddev**2 * (x - mean)**2)\n        d_mean = (amplitude *\n                  np.exp(- 0.5 / stddev**2 * (x - mean)**2) *\n                  (x - mean) / stddev**2)\n        d_stddev = (2 * amplitude *\n                    np.exp(- 0.5 / stddev**2 * (x - mean)**2) *\n                    (x - mean)**2 / stddev**3)\n        return [d_amplitude, d_mean, d_stddev]\n\n\nNote that we did *not* have to define an ``__init__`` method or a ``__call__``\nmethod for our model. For most models the ``__init__`` follows the same pattern,\ntaking the parameter values as positional arguments, followed by several optional\nkeyword arguments (constraints, etc.).  The modeling framework automatically generates an\n``__init__`` for your class that has the correct calling signature (see for\nyourself by calling ``help(Gaussian1D.__init__)`` on the example model we just\ndefined).\n\nThere are cases where it might be desirable to define a custom ``__init__``.\nFor example, the `~astropy.modeling.functional_models.Gaussian2D` model takes\nan optional ``cov_matrix`` argument which can be used as an alternative way to\nspecify the x/y_stddev and theta parameters.  This is perfectly valid so long\nas the ``__init__`` determines appropriate values for the actual parameters and\nthen calls the super ``__init__`` with the standard arguments.  Schematically\nthis looks something like:\n\n.. code-block:: python\n\n    def __init__(self, amplitude, x_mean, y_mean, x_stddev=None,\n                 y_stddev=None, theta=None, cov_matrix=None, **kwargs):\n        # The **kwargs here should be understood as other keyword arguments\n        # accepted by the basic Model.__init__ (such as constraints)\n        if cov_matrix is not None:\n            # Set x/y_stddev and theta from the covariance matrix\n            x_stddev = ...\n            y_stddev = ...\n            theta = ...\n\n        # Don't pass on cov_matrix since it doesn't mean anything to the base\n        # class\n        super().__init__(amplitude, x_mean, y_mean, x_stddev, y_stddev, theta,\n                         **kwargs)\n\n\nFull example\n------------\n\n.. code-block:: python\n\n    import numpy as np\n    from astropy.modeling import Fittable1DModel, Parameter\n\n    class Gaussian1D(Fittable1DModel):\n        amplitude = Parameter()\n        mean = Parameter()\n        stddev = Parameter()\n\n        @staticmethod\n        def evaluate(x, amplitude, mean, stddev):\n            return amplitude * np.exp((-(1 / (2. * stddev**2)) * (x - mean)**2))\n\n        @staticmethod\n        def fit_deriv(x, amplitude, mean, stddev):\n            d_amplitude = np.exp((-(1 / (stddev**2)) * (x - mean)**2))\n            d_mean = (2 * amplitude *\n                      np.exp((-(1 / (stddev**2)) * (x - mean)**2)) *\n                      (x - mean) / (stddev**2))\n            d_stddev = (2 * amplitude *\n                        np.exp((-(1 / (stddev**2)) * (x - mean)**2)) *\n                        ((x - mean)**2) / (stddev**3))\n            return [d_amplitude, d_mean, d_stddev]\n\n\nA full example of a LineModel\n=============================\n\nThis example demonstrates one other optional feature for model classes, which\nis an *inverse*.  An `~astropy.modeling.Model.inverse` implementation should be\na `property` that returns a new model instance (not necessarily of the same\nclass as the model being inverted) that computes the inverse of that model, so\nthat for some model instance with an inverse, ``model.inverse(model(*input)) ==\ninput``.\n\n.. code-block:: python\n\n    import numpy as np\n    from astropy.modeling import Fittable1DModel, Parameter\n\n    class LineModel(Fittable1DModel):\n        slope = Parameter()\n        intercept = Parameter()\n        linear = True\n\n        @staticmethod\n        def evaluate(x, slope, intercept):\n            return slope * x + intercept\n\n        @staticmethod\n        def fit_deriv(x, slope, intercept):\n            d_slope = x\n            d_intercept = np.ones_like(x)\n            return [d_slope, d_intercept]\n\n        @property\n        def inverse(self):\n            new_slope = self.slope ** -1\n            new_intercept = -self.intercept / self.slope\n            return LineModel(slope=new_slope, intercept=new_intercept)\n\n.. note::\n\n    The above example is essentially equivalent to the built-in\n    `~astropy.modeling.functional_models.Linear1D` model.\n"},{"col":0,"comment":"Fraction very close to x with denominator at most max_denominator.\n\n    The fraction has to be such that fraction/x is unity to within 4 ulp.\n    If such a fraction does not exist, returns the float number.\n\n    The algorithm is that of `fractions.Fraction.limit_denominator`, but\n    sped up by not creating a fraction to start with.\n    ","endLoc":222,"header":"def maybe_simple_fraction(p, max_denominator=100)","id":411,"name":"maybe_simple_fraction","nodeType":"Function","startLoc":198,"text":"def maybe_simple_fraction(p, max_denominator=100):\n    \"\"\"Fraction very close to x with denominator at most max_denominator.\n\n    The fraction has to be such that fraction/x is unity to within 4 ulp.\n    If such a fraction does not exist, returns the float number.\n\n    The algorithm is that of `fractions.Fraction.limit_denominator`, but\n    sped up by not creating a fraction to start with.\n    \"\"\"\n    if p == 0 or p.__class__ is int:\n        return p\n    n, d = p.as_integer_ratio()\n    a = n // d\n    # Normally, start with 0,1 and 1,0; here we have applied first iteration.\n    n0, d0 = 1, 0\n    n1, d1 = a, 1\n    while d1 <= max_denominator:\n        if _JUST_BELOW_UNITY <= n1/(d1*p) <= _JUST_ABOVE_UNITY:\n            return Fraction(n1, d1)\n        n, d = d, n-a*d\n        a = n // d\n        n0, n1 = n1, n0+a*n1\n        d0, d1 = d1, d0+a*d1\n\n    return p"},{"id":412,"name":"physical_models.rst","nodeType":"TextFile","path":"docs/modeling","text":".. _predef_physicalmodels:\n\n***************\nPhysical Models\n***************\n\nThese are models that are physical motivated, generally as solutions to\nphysical problems.  This is in contrast to those that are mathematically motivated,\ngenerally as solutions to mathematical problems.\n\n.. _blackbody-planck-law:\n\nBlackBody\n=========\n\nThe :class:`~astropy.modeling.physical_models.BlackBody` model provides a model\nfor using `Planck's Law <https://en.wikipedia.org/wiki/Planck%27s_law>`_.\nThe blackbody function is\n\n.. math::\n\n   B_{\\nu}(T) = A \\frac{2 h \\nu^{3} / c^{2}}{exp(h \\nu / k T) - 1}\n\nwhere :math:`\\nu` is the frequency, :math:`T` is the temperature,\n:math:`A` is the scaling factor,\n:math:`h` is the Plank constant, :math:`c` is the speed of light, and\n:math:`k` is the Boltzmann constant.\n\nThe two parameters of the model the scaling factor ``scale`` (A) and\nthe absolute temperature ``temperature`` (T).  If the ``scale`` factor does not\nhave units, then the result is in units of spectral radiance, specifically\nergs/(cm^2 Hz s sr).  If the ``scale`` factor is passed with spectral radiance units,\nthen the result is in those units (e.g., ergs/(cm^2 A s sr) or MJy/sr).\nSetting the ``scale`` factor with units of ergs/(cm^2 A s sr) will give the\nPlanck function as :math:`B_\\lambda`.\nThe temperature can be passed as a Quantity with any supported temperature unit.\n\nAn example plot for a blackbody with a temperature of 10000 K and a scale of 1 is\nshown below.  A scale of 1 shows the Planck function with no scaling in the\ndefault units returned by :class:`~astropy.modeling.physical_models.BlackBody`.\n\n.. plot::\n    :include-source:\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    from astropy.modeling.models import BlackBody\n    import astropy.units as u\n\n    wavelengths = np.logspace(np.log10(1000), np.log10(3e4), num=1000) * u.AA\n\n    # blackbody parameters\n    temperature = 10000 * u.K\n\n    # BlackBody provides the results in ergs/(cm^2 Hz s sr) when scale has no units\n    bb = BlackBody(temperature=temperature, scale=10000.0)\n    bb_result = bb(wavelengths)\n\n    fig, ax = plt.subplots(ncols=1)\n    ax.plot(wavelengths, bb_result, '-')\n\n    ax.set_xscale('log')\n    ax.set_xlabel(fr\"$\\lambda$ [{wavelengths.unit}]\")\n    ax.set_ylabel(fr\"$F(\\lambda)$ [{bb_result.unit}]\")\n\n    plt.tight_layout()\n    plt.show()\n\nThe :meth:`~astropy.modeling.physical_models.BlackBody.bolometric_flux` member\nfunction gives the bolometric flux using\n:math:`\\sigma T^4/\\pi` where :math:`\\sigma` is the Stefan-Boltzmann constant.\n\nThe :meth:`~astropy.modeling.physical_models.BlackBody.lambda_max` and\n:meth:`~astropy.modeling.physical_models.BlackBody.nu_max` member functions\ngive the wavelength and frequency of the maximum for :math:`B_\\lambda`\nand :math:`B_\\nu`, respectively, calculated using `Wien's Law\n<https://en.wikipedia.org/wiki/Wien%27s_displacement_law>`_.\n\nDrude1D\n=======\n\nThe :class:`~astropy.modeling.physical_models.Drude1D` model provides a model\nfor the behavior of an electron in a material\n(see `Drude Model <https://en.wikipedia.org/wiki/Drude_model>`_).\nLike the :class:`~astropy.modeling.functional_models.Lorentz1D` model, the Drude model\nhas broader wings than the :class:`~astropy.modeling.functional_models.Gaussian1D`\nmodel.  The Drude profile has been used to model dust features including the\n2175 Angstrom extinction feature and the mid-infrared aromatic/PAH features.\nThe Drude function at :math:`x` is\n\n.. math::\n\n    D(x) = A \\frac{(f/x_0)^2}{((x/x_0 - x_0/x)^2 + (f/x_0)^2}\n\nwhere :math:`A` is the amplitude, :math:`f` is the full width at half maximum,\nand :math:`x_0` is the central wavelength.  An example of a Drude1D model\nwith :math:`x_0 = 2175` Angstrom and :math:`f = 400` Angstrom is shown below.\n\n.. plot::\n    :include-source:\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    from astropy.modeling.models import Drude1D\n    import astropy.units as u\n\n    wavelengths = np.linspace(1000, 4000, num=1000) * u.AA\n\n    # Parameters and model\n    mod = Drude1D(amplitude=1.0, x_0=2175. * u.AA, fwhm=400. * u.AA)\n    mod_result = mod(wavelengths)\n\n    fig, ax = plt.subplots(ncols=1)\n    ax.plot(wavelengths, mod_result, '-')\n\n    ax.set_xlabel(fr\"$\\lambda$ [{wavelengths.unit}]\")\n    ax.set_ylabel(r\"$D(\\lambda)$\")\n\n    plt.tight_layout()\n    plt.show()\n\n.. _NFW:\n\nNFW\n=========\n\nThe :class:`~astropy.modeling.physical_models.NFW` model computes a\n1-dimensional Navarro–Frenk–White profile. The dark matter density in an\nNFW profile is given by:\n\n\n.. math::\n\n   \\rho(r)=\\frac{\\delta_c\\rho_{c}}{r/r_s(1+r/r_s)^2}\n\nwhere :math:`\\rho_{c}` is the critical density of the Universe at the redshift\nof the profile, :math:`\\delta_c` is the over density, and :math:`r_s` is the\nscale radius of the profile.\n\n\nThis model relies on three parameters:\n\n  ``mass`` : the mass of the profile (in solar masses if no units are provided)\n\n  ``concentration`` : the profile concentration\n\n  ``redshift`` : the redshift of the profile\n\nAs well as two optional initialization variables:\n\n  ``massfactor`` : tuple or string specifying the overdensity type and factor (default (\"critical\", 200))\n\n  ``cosmo`` : the cosmology for density calculation (default default_cosmology)\n\n.. note::\n\tInitialization of NFW profile object required before evaluation (in order to set mass\n\toverdensity and cosmology).\n\n\nSample plots of an NFW profile with the following parameters are displayed below:\n  ``mass`` = :math:`2.0 x 10^{15} M_{sun}`\n\n  ``concentration`` = 8.5\n\n  ``redshift`` = 0.63\n\nThe first plot is of the NFW profile density as a function of radius.\nThe second plot displays the profile density and radius normalized by the NFW scale\ndensity and scale radius, respectively. The scale density and scale radius are available\nas attributes ``rho_s`` and ``r_s``, and the overdensity radius can be accessed via ``r_virial``.\n\n.. plot::\n    :include-source:\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import NFW\n    import astropy.units as u\n    from astropy import cosmology\n\n    # NFW Parameters\n    mass = u.Quantity(2.0E15, u.M_sun)\n    concentration = 8.5\n    redshift = 0.63\n    cosmo = cosmology.Planck15\n    massfactor = (\"critical\", 200)\n\n    # Create NFW Object\n    n = NFW(mass=mass, concentration=concentration, redshift=redshift, cosmo=cosmo,\n\t    massfactor=massfactor)\n\n    # Radial distribution for plotting\n    radii = range(1,2001,10) * u.kpc\n\n    # Radial NFW density distribution\n    n_result = n(radii)\n\n    # Plot creation\n    fig, ax = plt.subplots(2)\n    fig.suptitle('1 Dimensional NFW Profile')\n\n    # Density profile subplot\n    ax[0].plot(radii, n_result, '-')\n    ax[0].set_yscale('log')\n    ax[0].set_xlabel(fr\"$r$ [{radii.unit}]\")\n    ax[0].set_ylabel(fr\"$\\rho$ [{n_result.unit}]\")\n\n    # Create scaled density / scaled radius subplot\n    # NFW Object\n    n = NFW(mass=mass, concentration=concentration, redshift=redshift, cosmo=cosmo,\n\t    massfactor=massfactor)\n\n    # Radial distribution for plotting\n    radii = np.logspace(np.log10(1e-5), np.log10(2), num=1000) * u.Mpc\n    n_result = n(radii)\n\n    # Scaled density / scaled radius subplot\n    ax[1].plot(radii / n.radius_s, n_result / n.density_s, '-')\n    ax[1].set_xscale('log')\n    ax[1].set_yscale('log')\n    ax[1].set_xlabel(r\"$r / r_s$\")\n    ax[1].set_ylabel(r\"$\\rho / \\rho_s$\")\n\n    # Display plot\n    plt.tight_layout(rect=[0, 0.03, 1, 0.95])\n    plt.show()\n\n\n\nThe :meth:`~astropy.modeling.physical_models.NFW.circular_velocity` member provides the circular\nvelocity at each position ``r`` via the equation:\n\n\n.. math::\n\n   v_{circ}(r)^2=\\frac{1}{x}\\frac{\\ln(1+cx)-(cx)/(1+cx)}{\\ln(1+c)-c/(1+c)}\n\nwhere x is the ratio ``r``:math:`/r_{vir}`. Circular velocities are provided in km/s.\n\nA sample plot of circular velocities of an NFW profile with the following parameters is displayed\nbelow:\n\n  ``mass`` = :math:`2.0 x 10^{15} M_{sun}`\n\n  ``concentration`` = 8.5\n\n  ``redshift`` = 0.63\n\nThe maximum circular velocity and radius of maximum circular velocity are available as attributes\n``v_max`` and ``r_max``.\n\n\n.. plot::\n    :include-source:\n\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import NFW\n    import astropy.units as u\n    from astropy import cosmology\n\n    # NFW Parameters\n    mass = u.Quantity(2.0E15, u.M_sun)\n    concentration = 8.5\n    redshift = 0.63\n    cosmo = cosmology.Planck15\n    massfactor = (\"critical\", 200)\n\n    # Create NFW Object\n    n = NFW(mass=mass, concentration=concentration, redshift=redshift, cosmo=cosmo,\n            massfactor=massfactor)\n\n    # Radial distribution for plotting\n    radii = range(1,200001,10) * u.kpc\n\n    # NFW circular velocity distribution\n    n_result = n.circular_velocity(radii)\n\n    # Plot creation\n    fig,ax = plt.subplots()\n    ax.set_title('NFW Profile Circular Velocity')\n    ax.plot(radii, n_result, '-')\n    ax.set_xscale('log')\n    ax.set_xlabel(fr\"$r$ [{radii.unit}]\")\n    ax.set_ylabel(r\"$v_{circ}$\" + f\" [{n_result.unit}]\")\n\n    # Display plot\n    plt.tight_layout(rect=[0, 0.03, 1, 0.95])\n    plt.show()\n\n\n.. _Cosmologies:\n\nCosmologies\n===========\n\nThe instances of the |Cosmology| class (and subclasses) include\n|Cosmology.to_format|, a method to convert a Cosmology to another python\nobject. Specifically, any redshift method can be converted to a\n:class:`~astropy.modeling.FittableModel` instance using the argument\n``format=\"astropy.model\"``.\nDuring the conversion, each |Cosmology| :class:`~astropy.cosmology.Parameter`\nis converted to a :class:`astropy.modeling.Model`\n:class:`~astropy.modeling.Parameter`, while the redshift-method becomes the\nmodel's ``__call__`` / ``evaluate`` method.\nThis means cosmologies can now be fit with data!\n\n.. code-block::\n\n    >>> from astropy.cosmology import Planck18\n    >>> model = Planck18.to_format(format=\"astropy.model\", method=\"lookback_time\")\n    >>> model\n    <FlatLambdaCDMCosmologyLookbackTimeModel(H0=67.66 km / (Mpc s), Om0=0.30966,\n        Tcmb0=2.7255 K, Neff=3.046, m_nu=[0.  , 0.  , 0.06] eV, Ob0=0.04897,\n        name='Planck18')>\n\nWhen finished, e.g. fitting, a model can be turned back into a |Cosmology|\nusing |Cosmology.from_format|.\n\n.. code-block::\n\n    >>> from astropy.cosmology import Cosmology\n    >>> cosmo = Cosmology.from_format(model, format=\"astropy.model\")\n    >>> cosmo == Planck18\n    True\n"},{"col":0,"comment":"\n    If either input is a Fraction, convert the other to a Fraction\n    (at least if it does not have a ridiculous denominator).\n    This ensures that any operation involving a Fraction will use\n    rational arithmetic and preserve precision.\n    ","endLoc":287,"header":"def resolve_fractions(a, b)","id":413,"name":"resolve_fractions","nodeType":"Function","startLoc":270,"text":"def resolve_fractions(a, b):\n    \"\"\"\n    If either input is a Fraction, convert the other to a Fraction\n    (at least if it does not have a ridiculous denominator).\n    This ensures that any operation involving a Fraction will use\n    rational arithmetic and preserve precision.\n    \"\"\"\n    # We short-circuit on the most common cases of int and float, since\n    # isinstance(a, Fraction) is very slow for any non-Fraction instances.\n    a_is_fraction = (a.__class__ is not int and a.__class__ is not float and\n                     isinstance(a, Fraction))\n    b_is_fraction = (b.__class__ is not int and b.__class__ is not float and\n                     isinstance(b, Fraction))\n    if a_is_fraction and not b_is_fraction:\n        b = maybe_simple_fraction(b)\n    elif not a_is_fraction and b_is_fraction:\n        a = maybe_simple_fraction(a)\n    return a, b"},{"id":414,"name":"compound-models.rst","nodeType":"TextFile","path":"docs/modeling","text":".. include:: links.inc\n\n.. _compound-models-intro:\n\nCombining Models\n****************\n\nBasics\n======\n\nWhile the Astropy modeling package makes it very easy to define :doc:`new\nmodels <new-model>` either from existing functions, or by writing a\n`~astropy.modeling.Model` subclass, an additional way to create new models is\nby combining them using arithmetic expressions.  This works with models built\ninto Astropy, and most user-defined models as well.  For example, it is\npossible to create a superposition of two Gaussians like so::\n\n    >>> from astropy.modeling import models\n    >>> g1 = models.Gaussian1D(1, 0, 0.2)\n    >>> g2 = models.Gaussian1D(2.5, 0.5, 0.1)\n    >>> g1_plus_2 = g1 + g2\n\nThe resulting object ``g1_plus_2`` is itself a new model.  Evaluating, say,\n``g1_plus_2(0.25)`` is the same as evaluating ``g1(0.25) + g2(0.25)``::\n\n    >>> g1_plus_2(0.25)  # doctest: +FLOAT_CMP\n    0.5676756958301329\n    >>> g1_plus_2(0.25) == g1(0.25) + g2(0.25)\n    True\n\nThis model can be further combined with other models in new expressions.\n\nThese new compound models can also be fitted to data, like most other models\n(though this currently requires one of the non-linear fitters):\n\n.. plot::\n    :include-source:\n\n    import warnings\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling import models, fitting\n\n    # Generate fake data\n    np.random.seed(42)\n    g1 = models.Gaussian1D(1, 0, 0.2)\n    g2 = models.Gaussian1D(2.5, 0.5, 0.1)\n    x = np.linspace(-1, 1, 200)\n    y = g1(x) + g2(x) + np.random.normal(0., 0.2, x.shape)\n\n    # Now to fit the data create a new superposition with initial\n    # guesses for the parameters:\n    gg_init = models.Gaussian1D(1, 0, 0.1) + models.Gaussian1D(2, 0.5, 0.1)\n    fitter = fitting.SLSQPLSQFitter()\n\n    with warnings.catch_warnings():\n        # Ignore a warning on clipping to bounds from the fitter\n        warnings.filterwarnings('ignore', message='Values in x were outside bounds',\n                                category=RuntimeWarning)\n        gg_fit = fitter(gg_init, x, y)\n\n    # Plot the data with the best-fit model\n    plt.figure(figsize=(8,5))\n    plt.plot(x, y, 'ko')\n    plt.plot(x, gg_fit(x))\n    plt.xlabel('Position')\n    plt.ylabel('Flux')\n\nThis works for 1-D models, 2-D models, and combinations thereof, though there\nare some complexities involved in correctly matching up the inputs and outputs\nof all models used to build a compound model.  You can learn more details in\nthe :doc:`compound-models` documentation.\n\nAstropy models also support convolution through the function\n`~astropy.convolution.convolve_models`, which returns a compound model.\n\nFor instance, the convolution of two Gaussian functions is also a Gaussian\nfunction in which the resulting mean (variance) is the sum of the means\n(variances) of each Gaussian.\n\n.. plot::\n    :include-source:\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling import models\n    from astropy.convolution import convolve_models\n\n    g1 = models.Gaussian1D(1, -1, 1)\n    g2 = models.Gaussian1D(1, 1, 1)\n    g3 = convolve_models(g1, g2)\n\n    x = np.linspace(-3, 3, 50)\n    plt.plot(x, g1(x), 'k-')\n    plt.plot(x, g2(x), 'k-')\n    plt.plot(x, g3(x), 'k-')\n\n\n.. _compound-models:\n\nA comprehensive description\n===========================\n\nSome terminology\n----------------\n\nIt is possible to create new models just by\ncombining existing models using the arithmetic operators ``+``, ``-``, ``*``,\n``/``, and ``**``, or by model composition using ``|`` and\nconcatenation (explained below) with ``&``, as well as using :func:`~astropy.modeling.fix_inputs`\nfor :ref:`reducing the number of inputs to a model <model-reduction>`.\n\n\nIn discussing the compound model feature, it is useful to be clear about a\nfew terms where there have been points of confusion:\n\n- The term \"model\" can refer either to a model *class* or a model *instance*.\n\n  - All models in `astropy.modeling`, whether it represents some\n    `function <astropy.modeling.functional_models>`, a\n    `rotation <astropy.modeling.rotations>`, etc., are represented in the\n    abstract by a model *class*--specifically a subclass of\n    `~astropy.modeling.Model`--that encapsulates the routine for evaluating the\n    model, a list of its required parameters, and other metadata about the\n    model.\n\n  - Per typical object-oriented parlance, a model *instance* is the object\n    created when when calling a model class with some arguments--in most cases\n    values for the model's parameters.\n\n  A model class, by itself, cannot be used to perform any computation because\n  most models, at least, have one or more parameters that must be specified\n  before the model can be evaluated on some input data. However, we can still\n  get some information about a model class from its representation.  For\n  example::\n\n      >>> from astropy.modeling.models import Gaussian1D\n      >>> Gaussian1D\n      <class 'astropy.modeling.functional_models.Gaussian1D'>\n      Name: Gaussian1D\n      N_inputs: 1\n      N_outputs: 1\n      Fittable parameters: ('amplitude', 'mean', 'stddev')\n\n  We can then create a model *instance* by passing in values for the three\n  parameters::\n\n      >>> my_gaussian = Gaussian1D(amplitude=1.0, mean=0, stddev=0.2)\n      >>> my_gaussian  # doctest: +FLOAT_CMP\n      <Gaussian1D(amplitude=1.0, mean=0.0, stddev=0.2)>\n\n  We now have an *instance* of `~astropy.modeling.functional_models.Gaussian1D`\n  with all its parameters (and in principle other details like fit constraints)\n  filled in so that we can perform calculations with it as though it were a\n  function::\n\n      >>> my_gaussian(0.2)  # doctest: +FLOAT_CMP\n      0.6065306597126334\n\n  In many cases this document just refers to \"models\", where the class/instance\n  distinction is either irrelevant or clear from context.  But a distinction\n  will be made where necessary.\n\n- A *compound model* can be created by combining two or more existing model instances\n  which can be models that come with Astropy, :doc:`user defined models <new-model>`, or\n  other compound models--using Python expressions consisting of one or more of the\n  supported binary operators.\n\n- In some places the term *composite model* is used interchangeably with\n  *compound model*. However, this document uses the\n  term *composite model* to refer *only* to the case of a compound model\n  created from the functional composition of two or more models using the pipe\n  operator ``|`` as explained below.  This distinction is used consistently\n  within this document, but it may be helpful to understand the distinction.\n\n\nCreating compound models\n------------------------\n\nThe only way to create compound models is\nto combine existing single models and/or compound models using expressions in\nPython with the binary operators ``+``, ``-``, ``*``, ``/``, ``**``, ``|``,\nand ``&``, each of which is discussed in the following sections.\n\nThe result of combining two models is a model instance::\n\n    >>> two_gaussians = Gaussian1D(1.1, 0.1, 0.2) + Gaussian1D(2.5, 0.5, 0.1)\n    >>> two_gaussians  # doctest: +FLOAT_CMP\n    <CompoundModel...(amplitude_0=1.1, mean_0=0.1, stddev_0=0.2, amplitude_1=2.5, mean_1=0.5, stddev_1=0.1)>\n\nThis expression creates a new model instance that is ready to be used for evaluation::\n\n    >>> two_gaussians(0.2)  # doctest: +FLOAT_CMP\n    0.9985190841886609\n\nThe ``print`` function provides more information about this object::\n\n    >>> print(two_gaussians)\n    Model: CompoundModel...\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Model set size: 1\n    Expression: [0] + [1]\n    Components:\n        [0]: <Gaussian1D(amplitude=1.1, mean=0.1, stddev=0.2)>\n    <BLANKLINE>\n        [1]: <Gaussian1D(amplitude=2.5, mean=0.5, stddev=0.1)>\n    Parameters:\n        amplitude_0 mean_0 stddev_0 amplitude_1 mean_1 stddev_1\n        ----------- ------ -------- ----------- ------ --------\n                1.1    0.1      0.2         2.5    0.5      0.1\n\nThere are a number of things to point out here:  This model has six\nfittable parameters. How parameters are handled is discussed further in the\nsection on :ref:`compound-model-parameters`.  We also see that there is a\nlisting of the *expression* that was used to create this compound model, which\nin this case is summarized as ``[0] + [1]``.  The ``[0]`` and ``[1]`` refer to\nthe first and second components of the model listed next (in this case both\ncomponents are the `~astropy.modeling.functional_models.Gaussian1D` objects).\n\nEach component of a compound model is a single, non-compound model.  This is\nthe case even when including an existing compound model in a new expression.\nThe existing compound model is not treated as a single model--instead the\nexpression represented by that compound model is extended.  An expression\ninvolving two or more compound models results in a new expression that is the\nconcatenation of all involved models' expressions::\n\n    >>> four_gaussians = two_gaussians + two_gaussians\n    >>> print(four_gaussians)\n    Model: CompoundModel...\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Model set size: 1\n    Expression: [0] + [1] + [2] + [3]\n    Components:\n        [0]: <Gaussian1D(amplitude=1.1, mean=0.1, stddev=0.2)>\n    <BLANKLINE>\n        [1]: <Gaussian1D(amplitude=2.5, mean=0.5, stddev=0.1)>\n    <BLANKLINE>\n        [2]: <Gaussian1D(amplitude=1.1, mean=0.1, stddev=0.2)>\n    <BLANKLINE>\n        [3]: <Gaussian1D(amplitude=2.5, mean=0.5, stddev=0.1)>\n    Parameters:\n        amplitude_0 mean_0 stddev_0 amplitude_1 ... stddev_2 amplitude_3 mean_3 stddev_3\n        ----------- ------ -------- ----------- ... -------- ----------- ------ --------\n                1.1    0.1      0.2         2.5 ...      0.2         2.5    0.5      0.1\n\n\nOperators\n---------\n\nArithmetic operators\n--------------------\n\nCompound models can be created from expressions that include any\nnumber of the arithmetic operators ``+``, ``-``, ``*``, ``/``, and\n``**``, which have the same meanings as they do for other numeric\nobjects in Python.\n\n.. note::\n\n    In the case of division ``/`` always means floating point division--integer\n    division and the ``//`` operator is not supported for models).\n\nAs demonstrated in previous examples, for models that have a single output\nthe result of evaluating a model like ``A + B`` is to evaluate ``A`` and\n``B`` separately on the given input, and then return the sum of the outputs of\n``A`` and ``B``.  This requires that ``A`` and ``B`` take the same number of\ninputs and both have a single output.\n\nIt is also possible to use arithmetic operators between models with multiple\noutputs.  Again, the number of inputs must be the same between the models, as\nmust be the number of outputs.  In this case the operator is applied to the\noperators element-wise, similarly to how arithmetic operators work on two Numpy\narrays.\n\n\n.. _compound-model-composition:\n\nModel composition\n-----------------\n\nThe sixth binary operator that can be used to create compound models is the\ncomposition operator, also known as the \"pipe\" operator ``|`` (not to be\nconfused with the boolean \"or\" operator that this implements for Python numeric\nobjects).  A model created with the composition operator like ``M = F | G``,\nwhen evaluated, is equivalent to evaluating :math:`g \\circ f = g(f(x))`.\n\n.. note::\n\n    The fact that the ``|`` operator has the opposite sense as the functional\n    composition operator :math:`\\circ` is sometimes a point of confusion.\n    This is in part because there is no operator symbol supported in Python\n    that corresponds well to this.  The ``|`` operator should instead be read\n    like the `pipe operator\n    <https://en.wikipedia.org/wiki/Pipeline_%28Unix%29>`_ of UNIX shell syntax:\n    It chains together models by piping the output of the left-hand operand to\n    the input of the right-hand operand, forming a \"pipeline\" of models, or\n    transformations.\n\nThis has different requirements on the inputs/outputs of its operands than do\nthe arithmetic operators.  For composition all that is required is that the\nleft-hand model has the same number of outputs as the right-hand model has\ninputs.\n\nFor simple functional models this is exactly the same as functional\ncomposition, except for the aforementioned caveat about ordering.  For\nexample, to create the following compound model:\n\n.. graphviz::\n\n    digraph {\n        in0 [shape=\"none\", label=\"input 0\"];\n        out0 [shape=\"none\", label=\"output 0\"];\n        redshift0 [shape=\"box\", label=\"RedshiftScaleFactor\"];\n        gaussian0 [shape=\"box\", label=\"Gaussian1D(1, 0.75, 0.1)\"];\n\n        in0 -> redshift0;\n        redshift0 -> gaussian0;\n        gaussian0 -> out0;\n    }\n\n.. plot::\n    :include-source:\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import RedshiftScaleFactor, Gaussian1D\n\n    x = np.linspace(0, 1.2, 100)\n    g0 = RedshiftScaleFactor(0) | Gaussian1D(1, 0.75, 0.1)\n\n    plt.figure(figsize=(8, 5))\n    plt.plot(x, g0(x), 'g--', label='$z=0$')\n\n    for z in (0.2, 0.4, 0.6):\n        g = RedshiftScaleFactor(z) | Gaussian1D(1, 0.75, 0.1)\n        plt.plot(x, g(x), color=plt.cm.OrRd(z),\n                 label=f'$z={z}$')\n\n    plt.xlabel('Energy')\n    plt.ylabel('Flux')\n    plt.legend()\n\nIf you wish to perform redshifting in the wavelength space instead of energy,\nand would also like to conserve flux, here is another way to do it using\nmodel *instances*:\n\n.. plot::\n    :include-source:\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import RedshiftScaleFactor, Gaussian1D, Scale\n\n    x = np.linspace(1000, 5000, 1000)\n    g0 = Gaussian1D(1, 2000, 200)  # No redshift is same as redshift with z=0\n\n    plt.figure(figsize=(8, 5))\n    plt.plot(x, g0(x), 'g--', label='$z=0$')\n\n    for z in (0.2, 0.4, 0.6):\n        rs = RedshiftScaleFactor(z).inverse  # Redshift in wavelength space\n        sc = Scale(1. / (1 + z))  # Rescale the flux to conserve energy\n        g = rs | g0 | sc\n        plt.plot(x, g(x), color=plt.cm.OrRd(z),\n                 label=f'$z={z}$')\n\n    plt.xlabel('Wavelength')\n    plt.ylabel('Flux')\n    plt.legend()\n\nWhen working with models with multiple inputs and outputs the same idea\napplies.  If each input is thought of as a coordinate axis, then this defines a\npipeline of transformations for the coordinates on each axis (though it does\nnot necessarily guarantee that these transformations are separable).  For\nexample:\n\n.. graphviz::\n\n    digraph {\n        in0 [shape=\"none\", label=\"input 0\"];\n        in1 [shape=\"none\", label=\"input 1\"];\n        out0 [shape=\"none\", label=\"output 0\"];\n        out1 [shape=\"none\", label=\"output 1\"];\n        rot0 [shape=\"box\", label=\"Rotation2D\"];\n        gaussian0 [shape=\"box\", label=\"Gaussian2D(1, 0, 0, 0.1, 0.3)\"];\n\n        in0 -> rot0;\n        in1 -> rot0;\n        rot0 -> gaussian0;\n        rot0 -> gaussian0;\n        gaussian0 -> out0;\n        gaussian0 -> out1;\n    }\n\n.. plot::\n    :include-source:\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import Rotation2D, Gaussian2D\n\n    x, y = np.mgrid[-1:1:0.01, -1:1:0.01]\n\n    plt.figure(figsize=(8, 2.5))\n\n    for idx, theta in enumerate((0, 45, 90)):\n        g = Rotation2D(theta) | Gaussian2D(1, 0, 0, 0.1, 0.3)\n        plt.subplot(1, 3, idx + 1)\n        plt.imshow(g(x, y), origin='lower')\n        plt.xticks([])\n        plt.yticks([])\n        plt.title(f'Rotated $ {theta}^\\circ $')\n\n.. note::\n\n    The above example is a bit contrived in that\n    `~astropy.modeling.functional_models.Gaussian2D` already supports an\n    optional rotation parameter.  However, this demonstrates how coordinate\n    rotation could be added to arbitrary models.\n\nNormally it is not possible to compose, say, a model with two outputs and a\nfunction of only one input::\n\n    >>> from astropy.modeling.models import Rotation2D\n    >>> Rotation2D() | Gaussian1D()  # doctest: +IGNORE_EXCEPTION_DETAIL\n    Traceback (most recent call last):\n    ...\n    ModelDefinitionError: Unsupported operands for |: Rotation2D (n_inputs=2, n_outputs=2) and Gaussian1D (n_inputs=1, n_outputs=1); n_outputs for the left-hand model must match n_inputs for the right-hand model.\n\nHowever, as we will see in the next section,\n:ref:`compound-model-concatenation`, provides a means of creating models\nthat apply transformations to only some of the outputs from a model,\nespecially when used in concert with :ref:`mappings <compound-model-mappings>`.\n\n\n.. _compound-model-concatenation:\n\nModel concatenation\n-------------------\n\nThe concatenation operator ``&``, sometimes also referred to as a \"join\",\ncombines two models into a single, fully separable transformation.  That is, it\nmakes a new model that takes the inputs to the left-hand model, concatenated\nwith the inputs to the right-hand model, and returns a tuple consisting of the\ntwo models' outputs concatenated together, without mixing in any way.  In other\nwords, it simply evaluates the two models in parallel--it can be thought of as\nsomething like a tuple of models.\n\nFor example, given two coordinate axes, we can scale each coordinate\nby a different factor by concatenating two\n`~astropy.modeling.functional_models.Scale` models.\n\n.. graphviz::\n\n    digraph {\n        in0 [shape=\"none\", label=\"input 0\"];\n        in1 [shape=\"none\", label=\"input 1\"];\n        out0 [shape=\"none\", label=\"output 0\"];\n        out1 [shape=\"none\", label=\"output 1\"];\n        scale0 [shape=\"box\", label=\"Scale(factor=1.2)\"];\n        scale1 [shape=\"box\", label=\"Scale(factor=3.4)\"];\n\n        in0 -> scale0;\n        scale0 -> out0;\n\n        in1 -> scale1;\n        scale1 -> out1;\n    }\n\n::\n\n    >>> from astropy.modeling.models import Scale\n    >>> separate_scales = Scale(factor=1.2) & Scale(factor=3.4)\n    >>> separate_scales(1, 2)  # doctest: +FLOAT_CMP\n    (1.2, 6.8)\n\nWe can also combine concatenation with composition to build chains of\ntransformations that use both \"1D\" and \"2D\" models on two (or more) coordinate\naxes:\n\n.. graphviz::\n\n    digraph {\n        in0 [shape=\"none\", label=\"input 0\"];\n        in1 [shape=\"none\", label=\"input 1\"];\n        out0 [shape=\"none\", label=\"output 0\"];\n        out1 [shape=\"none\", label=\"output 1\"];\n        scale0 [shape=\"box\", label=\"Scale(factor=1.2)\"];\n        scale1 [shape=\"box\", label=\"Scale(factor=3.4)\"];\n        rot0 [shape=\"box\", label=\"Rotation2D(90)\"];\n\n        in0 -> scale0;\n        scale0 -> rot0;\n\n        in1 -> scale1;\n        scale1 -> rot0;\n\n        rot0 -> out0;\n        rot0 -> out1;\n    }\n\n::\n\n    >>> scale_and_rotate = ((Scale(factor=1.2) & Scale(factor=3.4)) |\n    ...                     Rotation2D(90))\n    >>> scale_and_rotate.n_inputs\n    2\n    >>> scale_and_rotate.n_outputs\n    2\n    >>> scale_and_rotate(1, 2)  # doctest: +FLOAT_CMP\n    (-6.8, 1.2)\n\nThis is of course equivalent to an\n`~astropy.modeling.projections.AffineTransformation2D` with the appropriate\ntransformation matrix::\n\n    >>> from numpy import allclose\n    >>> from astropy.modeling.models import AffineTransformation2D\n    >>> affine = AffineTransformation2D(matrix=[[0, -3.4], [1.2, 0]])\n    >>> # May be small numerical differences due to different implementations\n    >>> allclose(scale_and_rotate(1, 2), affine(1, 2))\n    True\n\nOther Topics\n============\n\nModel names\n-----------\n\nIn the above two examples another notable feature of the generated compound\nmodel classes is that the class name, as displayed when printing the class at\nthe command prompt, is not \"TwoGaussians\", \"FourGaussians\", etc.  Instead it is\na generated name consisting of \"CompoundModel\" followed by an essentially\narbitrary integer that is chosen simply so that every compound model has a\nunique default name.  This is a limitation at present, due to the limitation\nthat it is not generally possible in Python when an object is created by an\nexpression for it to \"know\" the name of the variable it will be assigned to, if\nany.\nIt is possible to directly assign a name to the compound model instance\nby using the `Model.name <astropy.modeling.Model.name>` attribute::\n\n    >>> two_gaussians.name = \"TwoGaussians\"\n    >>> print(two_gaussians)  # doctest: +SKIP\n    Model: CompoundModel...\n    Name: TwoGaussians\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Model set size: 1\n    Expression: [0] + [1]\n    Components:\n        [0]: <Gaussian1D(amplitude=1.1, mean=0.1, stddev=0.2)>\n        <BLANKLINE>\n        [1]: <Gaussian1D(amplitude=2.5, mean=0.5, stddev=0.1)>\n    Parameters:\n        amplitude_0 mean_0 stddev_0 amplitude_1 mean_1 stddev_1\n        ----------- ------ -------- ----------- ------ --------\n                1.1    0.1      0.2         2.5    0.5      0.1\n\n.. _compound-model-indexing:\n\nIndexing and slicing\n--------------------\n\nAs seen in some of the previous examples in this document, when creating a\ncompound model each component of the model is assigned an integer index\nstarting from zero.  These indices are assigned simply by reading the\nexpression that defined the model, from left to right, regardless of the order\nof operations.  For example::\n\n    >>> from astropy.modeling.models import Const1D\n    >>> A = Const1D(1.1, name='A')\n    >>> B = Const1D(2.1, name='B')\n    >>> C = Const1D(3.1, name='C')\n    >>> M = A + B * C\n    >>> print(M)\n    Model: CompoundModel...\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Model set size: 1\n    Expression: [0] + [1] * [2]\n    Components:\n        [0]: <Const1D(amplitude=1.1, name='A')>\n    <BLANKLINE>\n        [1]: <Const1D(amplitude=2.1, name='B')>\n    <BLANKLINE>\n        [2]: <Const1D(amplitude=3.1, name='C')>\n    Parameters:\n        amplitude_0 amplitude_1 amplitude_2\n        ----------- ----------- -----------\n                1.1         2.1         3.1\n\n\nIn this example the expression is evaluated ``(B * C) + A``--that is, the\nmultiplication is evaluated before the addition per usual arithmetic rules.\nHowever, the components of this model are simply read off left to right from\nthe expression ``A + B * C``, with ``A -> 0``, ``B -> 1``, ``C -> 2``.  If we\nhad instead defined ``M = C * B + A`` then the indices would be reversed\n(though the expression is mathematically equivalent).  This convention is\nchosen for simplicity--given the list of components it is not necessary to\njump around when mentally mapping them to the expression.\n\nWe can pull out each individual component of the compound model ``M`` by using\nindexing notation on it.  Following from the above example, ``M[1]`` should\nreturn the model ``B``::\n\n    >>> M[1]\n    <Const1D(amplitude=2.1, name='B')>\n\nWe can also take a *slice* of the compound model.  This returns a new compound\nmodel that evaluates the *subexpression* involving the models selected by the\nslice.  This follows the same semantics as slicing a `list` or array in Python.\nThe start point is inclusive and the end point is exclusive.  So a slice like\n``M[1:3]`` (or just ``M[1:]``) selects models ``B`` and ``C`` (and all\n*operators* between them).  So the resulting model evaluates just the\nsubexpression ``B * C``::\n\n    >>> print(M[1:])\n    Model: CompoundModel\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Model set size: 1\n    Expression: [0] * [1]\n    Components:\n        [0]: <Const1D(amplitude=2.1, name='B')>\n    <BLANKLINE>\n        [1]: <Const1D(amplitude=3.1, name='C')>\n    Parameters:\n        amplitude_0 amplitude_1\n        ----------- -----------\n                2.1         3.1\n\n.. note::\n\n    There is a change in the parameter names of a slice from versions\n    prior to 4.0. Previously, the parameter names were identical to that\n    of the model being sliced. Now, they are what is expected for a\n    compound model of this type apart from the model sliced. That is,\n    the sliced model always starts with its own relative index for its\n    components, thus the parameter names start with a 0 suffix.\n\n.. note::\n\n    Starting with 4.0, the behavior of slicing is more restrictive than\n    previously. For example if::\n\n        m = m1 * m2 + m3\n\n    and one sliced by\n    using ``m[1:3]`` previously that would return the model: ``m2 + m3``\n    even though there was never any such submodel of m. Starting with 4.0\n    a slice must correspond to a submodel (something that corresponds\n    to an intermediate result of the computational chain of evaluating\n    the compound model). So::\n\n        m1 * m2\n\n    is a submodel (i.e.,``m[:2]``) but\n    ``m[1:3]`` is not. Currently this also means that in simpler expressions\n    such as::\n\n        m = m1 + m2 + m3 + m4\n\n    where any slice should be valid in\n    principle, only slices that include m1 are since it is part of\n    all submodules (since the order of evaluation is::\n\n        ((m1 + m2) + m3) + m4\n\n    Anyone creating compound models that wishes submodels to be available\n    is advised to use parentheses explicitly  or define intermediate\n    models to be used in subsequent expressions so that they can be\n    extracted with a slice or simple index depending on the context.\n    For example, to make ``m2 + m3`` accessible by slice define ``m`` as::\n\n        m = m1 + (m2 + m3) + m4. In this case ``m[1:3]`` will work.\n\nThe new compound model for the subexpression can be evaluated\nlike any other::\n\n    >>> M[1:](0)  # doctest: +FLOAT_CMP\n    6.51\n\nAlthough the model ``M`` was composed entirely of ``Const1D`` models in this\nexample, it was useful to give each component a unique name (``A``, ``B``,\n``C``) in order to differentiate between them.  This can also be used for\nindexing and slicing::\n\n    >>> print(M['B'])\n    Model: Const1D\n    Name: B\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Model set size: 1\n    Parameters:\n        amplitude\n        ---------\n              2.1\n\n\nIn this case ``M['B']`` is equivalent to ``M[1]``.  But by using the name we do\nnot have to worry about what index that component is in (this becomes\nespecially useful when combining multiple compound models).  A current\nlimitation, however, is that each component of a compound model must have a\nunique name--if some components have duplicate names then they can only be\naccessed by their integer index.\n\nSlicing also works with names.  When using names the start and end points are\n*both inclusive*::\n\n    >>> print(M['B':'C'])\n    Model: CompoundModel...\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Model set size: 1\n    Expression: [0] * [1]\n    Components:\n        [0]: <Const1D(amplitude=2.1, name='B')>\n    <BLANKLINE>\n        [1]: <Const1D(amplitude=3.1, name='C')>\n    Parameters:\n        amplitude_0 amplitude_1\n        ----------- -----------\n                2.1         3.1\n\nSo in this case ``M['B':'C']`` is equivalent to ``M[1:3]``.\n\n.. _compound-model-parameters:\n\nParameters\n----------\n\nA question that frequently comes up when first encountering compound models is\nhow exactly all the parameters are dealt with.  By now we've seen a few\nexamples that give some hints, but a more detailed explanation is in order.\nThis is also one of the biggest areas for possible improvements--the current\nbehavior is meant to be practical, but is not ideal.  (Some possible\nimprovements include being able to rename parameters, and providing a means of\nnarrowing down the number of parameters in a compound model.)\n\nAs explained in the general documentation for model :ref:`parameters\n<modeling-parameters>`, every model has an attribute called\n`~astropy.modeling.Model.param_names` that contains a tuple of all the model's\nadjustable parameters.  These names are given in a canonical order that also\ncorresponds to the order in which the parameters should be specified when\ninstantiating the model.\n\nThe simple scheme used currently for naming parameters in a compound model is\nthis:  The ``param_names`` from each component model are concatenated with each\nother in order from left to right as explained in the section on\n:ref:`compound-model-indexing`.  However, each parameter name is appended with\n``_<#>``, where ``<#>`` is the index of the component model that parameter\nbelongs to.  For example::\n\n    >>> Gaussian1D.param_names\n    ('amplitude', 'mean', 'stddev')\n    >>> (Gaussian1D() + Gaussian1D()).param_names\n    ('amplitude_0', 'mean_0', 'stddev_0', 'amplitude_1', 'mean_1', 'stddev_1')\n\nFor consistency's sake, this scheme is followed even if not all of the\ncomponents have overlapping parameter names::\n\n    >>> from astropy.modeling.models import RedshiftScaleFactor\n    >>> (RedshiftScaleFactor() | (Gaussian1D() + Gaussian1D())).param_names\n    ('z_0', 'amplitude_1', 'mean_1', 'stddev_1', 'amplitude_2', 'mean_2',\n    'stddev_2')\n\nOn some level a scheme like this is necessary in order for the compound model\nto maintain some consistency with other models with respect to the interface to\nits parameters.  However, if one gets lost it is also possible to take\nadvantage of :ref:`indexing <compound-model-indexing>` to make things easier.\nWhen returning a single component from a compound model the parameters\nassociated with that component are accessible through their original names, but\nare still tied back to the compound model::\n\n    >>> a = Gaussian1D(1, 0, 0.2, name='A')\n    >>> b = Gaussian1D(2.5, 0.5, 0.1, name='B')\n    >>> m = a + b\n    >>> m.amplitude_0\n    Parameter('amplitude', value=1.0)\n\nis equivalent to::\n\n    >>> m['A'].amplitude\n    Parameter('amplitude', value=1.0)\n\nYou can think of these both as different \"views\" of the same parameter.\nUpdating one updates the other::\n\n    >>> m.amplitude_0 = 42\n    >>> m['A'].amplitude\n    Parameter('amplitude', value=42.0)\n    >>> m['A'].amplitude = 99\n    >>> m.amplitude_0\n    Parameter('amplitude', value=99.0)\n\nNote, however, that the original\n`~astropy.modeling.functional_models.Gaussian1D` instance ``a`` has been\nupdated::\n\n    >>> a.amplitude\n    Parameter('amplitude', value=99.0)\n\nThis is different than the behavior in versions prior to 4.0. Now compound model\nparameters share the same Parameter instance as the original model.\n\n\n.. _compound-model-mappings:\n\nAdvanced mappings\n-----------------\n\nWe have seen in some previous examples how models can be chained together to\nform a \"pipeline\" of transformations by using model :ref:`composition\n<compound-model-composition>` and :ref:`concatenation\n<compound-model-concatenation>`.  To aid the creation of more complex chains of\ntransformations (for example for a WCS transformation) a new class of\n\"`mapping <astropy.modeling.mappings>`\" models is provided.\n\nMapping models do not (currently) take any parameters, nor do they perform any\nnumeric operation.  They are for use solely with the :ref:`concatenation\n<compound-model-concatenation>` (``&``) and :ref:`composition\n<compound-model-composition>` (``|``) operators, and can be used to control how\nthe inputs and outputs of models are ordered, and how outputs from one model\nare mapped to inputs of another model in a composition.\n\nCurrently there are only two mapping models:\n`~astropy.modeling.mappings.Identity`, and (the somewhat generically named)\n`~astropy.modeling.mappings.Mapping`.\n\nThe `~astropy.modeling.mappings.Identity` mapping simply passes one or more\ninputs through, unchanged.  It must be instantiated with an integer specifying\nthe number of inputs/outputs it accepts.  This can be used to trivially expand\nthe \"dimensionality\" of a model in terms of the number of inputs it accepts.\nIn the section on :ref:`concatenation <compound-model-concatenation>` we saw\nan example like::\n\n    >>> m = (Scale(1.2) & Scale(3.4)) | Rotation2D(90)\n\n\n.. graphviz::\n\n    digraph {\n        in0 [shape=\"none\", label=\"input 0\"];\n        in1 [shape=\"none\", label=\"input 1\"];\n        out0 [shape=\"none\", label=\"output 0\"];\n        out1 [shape=\"none\", label=\"output 1\"];\n        scale0 [shape=\"box\", label=\"Scale(factor=1.2)\"];\n        scale1 [shape=\"box\", label=\"Scale(factor=3.4)\"];\n        rot0 [shape=\"box\", label=\"Rotation2D(90)\"];\n\n        in0 -> scale0;\n        scale0 -> rot0;\n\n        in1 -> scale1;\n        scale1 -> rot0;\n\n        rot0 -> out0;\n        rot0 -> out1;\n    }\n\nwhere two coordinate inputs are scaled individually and then rotated into each\nother.  However, say we wanted to scale only one of those coordinates.  It\nwould be fine to simply use ``Scale(1)`` for one them, or any other model that\nis effectively a no-op.  But that also adds unnecessary computational overhead,\nso we might as well simply specify that that coordinate is not to be scaled or\ntransformed in any way.  This is a good use case for\n`~astropy.modeling.mappings.Identity`:\n\n.. graphviz::\n\n    digraph {\n        in0 [shape=\"none\", label=\"input 0\"];\n        in1 [shape=\"none\", label=\"input 1\"];\n        out0 [shape=\"none\", label=\"output 0\"];\n        out1 [shape=\"none\", label=\"output 1\"];\n        scale0 [shape=\"box\", label=\"Scale(factor=1.2)\"];\n        identity0 [shape=\"box\", label=\"Identity(1)\"];\n        rot0 [shape=\"box\", label=\"Rotation2D(90)\"];\n\n        in0 -> scale0;\n        scale0 -> rot0;\n\n        in1 -> identity0;\n        identity0 -> rot0;\n\n        rot0 -> out0;\n        rot0 -> out1;\n    }\n\n::\n\n    >>> from astropy.modeling.models import Identity\n    >>> m = Scale(1.2) & Identity(1)\n    >>> m(1, 2)  # doctest: +FLOAT_CMP\n    (1.2, 2.0)\n\n\nThis scales the first input, and passes the second one through unchanged.  We\ncan use this to build up more complicated steps in a many-axis WCS\ntransformation.  If for example we had 3 axes and only wanted to scale the\nfirst one:\n\n.. graphviz::\n\n    digraph {\n        in0 [shape=\"none\", label=\"input 0\"];\n        in1 [shape=\"none\", label=\"input 1\"];\n        in2 [shape=\"none\", label=\"input 2\"];\n        out0 [shape=\"none\", label=\"output 0\"];\n        out1 [shape=\"none\", label=\"output 1\"];\n        out2 [shape=\"none\", label=\"output 2\"];\n        scale0 [shape=\"box\", label=\"Scale(1.2)\"];\n        identity0 [shape=\"box\", label=\"Identity(2)\"];\n\n        in0 -> scale0;\n        scale0 -> out0;\n\n        in1 -> identity0;\n        in2 -> identity0;\n        identity0 -> out1;\n        identity0 -> out2;\n    }\n\n::\n\n    >>> m = Scale(1.2) & Identity(2)\n    >>> m(1, 2, 3)  # doctest: +FLOAT_CMP\n    (1.2, 2.0, 3.0)\n\n(Naturally, the last example could also be written out ``Scale(1.2) &\nIdentity(1) & Identity(1)``.)\n\nThe `~astropy.modeling.mappings.Mapping` model is similar in that it does not\nmodify any of its inputs.  However, it is more general in that it allows inputs\nto be duplicated, reordered, or even dropped outright.  It is instantiated with\na single argument: a `tuple`, the number of items of which correspond to the\nnumber of outputs the `~astropy.modeling.mappings.Mapping` should produce.  A\n1-tuple means that whatever inputs come in to the\n`~astropy.modeling.mappings.Mapping`, only one will be output.  And so on for\n2-tuple or higher (though the length of the tuple cannot be greater than the\nnumber of inputs--it will not pull values out of thin air).  The elements of\nthis mapping are integers corresponding to the indices of the inputs.  For\nexample, a mapping of ``Mapping((0,))`` is equivalent to ``Identity(1)``--it\nsimply takes the first (0-th) input and returns it:\n\n.. graphviz::\n\n    digraph G {\n        in0 [shape=\"none\", label=\"input 0\"];\n\n        subgraph cluster_A {\n            shape=rect;\n            color=black;\n            label=\"(0,)\";\n\n            a [shape=point, label=\"\"];\n        }\n\n        out0 [shape=\"none\", label=\"output 0\"];\n\n        in0 -> a;\n        a -> out0;\n    }\n\n::\n\n    >>> from astropy.modeling.models import Mapping\n    >>> m = Mapping((0,))\n    >>> m(1.0)\n    1.0\n\nLikewise ``Mapping((0, 1))`` is equivalent to ``Identity(2)``, and so on.\nHowever, `~astropy.modeling.mappings.Mapping` also allows outputs to be\nreordered arbitrarily:\n\n.. graphviz::\n\n    digraph G {\n        {\n            rank=same;\n            in0 [shape=\"none\", label=\"input 0\"];\n            in1 [shape=\"none\", label=\"input 1\"];\n        }\n\n        subgraph cluster_A {\n            shape=rect;\n            color=black;\n            label=\"(1, 0)\";\n\n            {\n                rank=same;\n                a [shape=point, label=\"\"];\n                b [shape=point, label=\"\"];\n            }\n\n            {\n                rank=same;\n                c [shape=point, label=\"\"];\n                d [shape=point, label=\"\"];\n            }\n\n            a -> c [style=invis];\n            a -> d [constraint=false];\n            b -> c [constraint=false];\n        }\n\n        {\n            rank=same;\n            out0 [shape=\"none\", label=\"output 0\"];\n            out1 [shape=\"none\", label=\"output 1\"];\n        }\n\n        in0 -> a;\n        in1 -> b;\n        c -> out0;\n        d -> out1;\n    }\n\n::\n\n    >>> m = Mapping((1, 0))\n    >>> m(1.0, 2.0)\n    (2.0, 1.0)\n\n.. graphviz::\n\n    digraph G {\n        {\n            rank=same;\n            in0 [shape=\"none\", label=\"input 0\"];\n            in1 [shape=\"none\", label=\"input 1\"];\n            in2 [shape=\"none\", label=\"input 2\"];\n        }\n\n        subgraph cluster_A {\n            shape=rect;\n            color=black;\n            label=\"(1, 0, 2)\";\n\n            {\n                rank=same;\n                a [shape=point, label=\"\"];\n                b [shape=point, label=\"\"];\n                c [shape=point, label=\"\"];\n            }\n\n            {\n                rank=same;\n                d [shape=point, label=\"\"];\n                e [shape=point, label=\"\"];\n                f [shape=point, label=\"\"];\n            }\n\n            a -> d [style=invis];\n            a -> e [constraint=false];\n            b -> d [constraint=false];\n            c -> f [constraint=false];\n        }\n\n        {\n            rank=same;\n            out0 [shape=\"none\", label=\"output 0\"];\n            out1 [shape=\"none\", label=\"output 1\"];\n            out2 [shape=\"none\", label=\"output 2\"];\n        }\n\n        in0 -> a;\n        in1 -> b;\n        in2 -> c;\n        d -> out0;\n        e -> out1;\n        f -> out2;\n    }\n\n::\n\n    >>> m = Mapping((1, 0, 2))\n    >>> m(1.0, 2.0, 3.0)\n    (2.0, 1.0, 3.0)\n\nOutputs may also be dropped:\n\n.. graphviz::\n\n    digraph G {\n        {\n            rank=same;\n            in0 [shape=\"none\", label=\"input 0\"];\n            in1 [shape=\"none\", label=\"input 1\"];\n        }\n\n        subgraph cluster_A {\n            shape=rect;\n            color=black;\n            label=\"(1,)\";\n\n            {\n                rank=same;\n                a [shape=point, label=\"\"];\n                b [shape=point, label=\"\"];\n            }\n\n            {\n                rank=same;\n                c [shape=point, label=\"\"];\n            }\n\n            a -> c [style=invis];\n            b -> c [constraint=false];\n        }\n\n        out0 [shape=\"none\", label=\"output 0\"];\n\n        in0 -> a;\n        in1 -> b;\n        c -> out0;\n    }\n\n::\n\n    >>> m = Mapping((1,))\n    >>> m(1.0, 2.0)\n    2.0\n\n.. graphviz::\n\n    digraph G {\n        {\n            rank=same;\n            in0 [shape=\"none\", label=\"input 0\"];\n            in1 [shape=\"none\", label=\"input 1\"];\n            in2 [shape=\"none\", label=\"input 2\"];\n        }\n\n        subgraph cluster_A {\n            shape=rect;\n            color=black;\n            label=\"(0, 2)\";\n\n            {\n                rank=same;\n                a [shape=point, label=\"\"];\n                b [shape=point, label=\"\"];\n                c [shape=point, label=\"\"];\n            }\n\n            {\n                rank=same;\n                d [shape=point, label=\"\"];\n                e [shape=point, label=\"\"];\n            }\n\n            a -> d [style=invis];\n            a -> d [constraint=false];\n            c -> e [constraint=false];\n        }\n\n        {\n            rank=same;\n            out0 [shape=\"none\", label=\"output 0\"];\n            out1 [shape=\"none\", label=\"output 1\"];\n        }\n\n        in0 -> a;\n        in1 -> b;\n        in2 -> c;\n        d -> out0;\n        e -> out1;\n    }\n\n::\n\n    >>> m = Mapping((0, 2))\n    >>> m(1.0, 2.0, 3.0)\n    (1.0, 3.0)\n\nOr duplicated:\n\n.. graphviz::\n\n    digraph G {\n        in0 [shape=\"none\", label=\"input 0\"];\n\n        subgraph cluster_A {\n            shape=rect;\n            color=black;\n            label=\"(0, 0)\";\n\n            a [shape=point, label=\"\"];\n\n            {\n                rank=same;\n                b [shape=point, label=\"\"];\n                c [shape=point, label=\"\"];\n            }\n\n            a -> b [style=invis];\n            a -> b [constraint=false];\n            a -> c [constraint=false];\n        }\n\n        {\n            rank=same;\n            out0 [shape=\"none\", label=\"output 0\"];\n            out1 [shape=\"none\", label=\"output 1\"];\n        }\n\n        in0 -> a;\n        b -> out0;\n        c -> out1;\n    }\n\n::\n\n    >>> m = Mapping((0, 0))\n    >>> m(1.0)\n    (1.0, 1.0)\n\n.. graphviz::\n\n    digraph G {\n        {\n            rank=same;\n            in0 [shape=\"none\", label=\"input 0\"];\n            in1 [shape=\"none\", label=\"input 1\"];\n            in2 [shape=\"none\", label=\"input 2\"];\n        }\n\n        subgraph cluster_A {\n            shape=rect;\n            color=black;\n            label=\"(0, 1, 1, 2)\";\n\n            {\n                rank=same;\n                a [shape=point, label=\"\"];\n                b [shape=point, label=\"\"];\n                c [shape=point, label=\"\"];\n            }\n\n            {\n                rank=same;\n                d [shape=point, label=\"\"];\n                e [shape=point, label=\"\"];\n                f [shape=point, label=\"\"];\n                g [shape=point, label=\"\"];\n            }\n\n            a -> d [style=invis];\n            a -> d [constraint=false];\n            b -> e [constraint=false];\n            b -> f [constraint=false];\n            c -> g [constraint=false];\n        }\n\n        {\n            rank=same;\n            out0 [shape=\"none\", label=\"output 0\"];\n            out1 [shape=\"none\", label=\"output 1\"];\n            out2 [shape=\"none\", label=\"output 2\"];\n            out3 [shape=\"none\", label=\"output 3\"];\n        }\n\n        in0 -> a;\n        in1 -> b;\n        in2 -> c;\n        d -> out0;\n        e -> out1;\n        f -> out2;\n        g -> out3;\n    }\n\n::\n\n    >>> m = Mapping((0, 1, 1, 2))\n    >>> m(1.0, 2.0, 3.0)\n    (1.0, 2.0, 2.0, 3.0)\n\n\nA complicated example that performs multiple transformations, some separable,\nsome not, on three coordinate axes might look something like:\n\n.. graphviz::\n\n    digraph G {\n        {\n            rank=same;\n            in0 [shape=\"none\", label=\"input 0\"];\n            in1 [shape=\"none\", label=\"input 1\"];\n            in2 [shape=\"none\", label=\"input 2\"];\n        }\n\n        {\n            rank=same;\n            poly0 [shape=rect, label=\"Poly1D(3, c0=1, c3=1)\"];\n            identity0 [shape=rect, label=\"Identity(1)\"];\n            poly1 [shape=rect, label=\"Poly1D(2, c2=1)\"];\n        }\n\n        subgraph cluster_A {\n            shape=rect;\n            color=black;\n            label=\"(0, 2, 1)\";\n\n            {\n                rank=same;\n                a [shape=point, label=\"\"];\n                b [shape=point, label=\"\"];\n                c [shape=point, label=\"\"];\n            }\n\n            {\n                rank=same;\n                d [shape=point, label=\"\"];\n                e [shape=point, label=\"\"];\n                f [shape=point, label=\"\"];\n            }\n\n            a -> d [style=invis];\n            d -> e [style=invis];\n            a -> d [constraint=false];\n            c -> e [constraint=false];\n            b -> f [constraint=false];\n        }\n\n        poly2 [shape=\"rect\", label=\"Poly2D(4, c0_0=1, c1_1=1, c2_2=2)\"];\n        gaussian0 [shape=\"rect\", label=\"Gaussian1D(1, 0, 4)\"];\n\n        {\n            rank=same;\n            out0 [shape=\"none\", label=\"output 0\"];\n            out1 [shape=\"none\", label=\"output 1\"];\n        }\n\n        in0 -> poly0;\n        in1 -> identity0;\n        in2 -> poly1;\n        poly0 -> a;\n        identity0 -> b;\n        poly1 -> c;\n        d -> poly2;\n        e -> poly2;\n        f -> gaussian0;\n        poly2 -> out0;\n        gaussian0 -> out1;\n    }\n\n::\n\n    >>> from astropy.modeling.models import Polynomial1D as Poly1D\n    >>> from astropy.modeling.models import Polynomial2D as Poly2D\n    >>> m = ((Poly1D(3, c0=1, c3=1) & Identity(1) & Poly1D(2, c2=1)) |\n    ...      Mapping((0, 2, 1)) |\n    ...      (Poly2D(4, c0_0=1, c1_1=1, c2_2=2) & Gaussian1D(1, 0, 4)))\n    ...\n    >>> m(2, 3, 4)  # doctest: +FLOAT_CMP\n    (41617.0, 0.7548396019890073)\n\n\n\nThis expression takes three inputs: :math:`x`, :math:`y`, and :math:`z`.  It\nfirst takes :math:`x \\rightarrow x^3 + 1` and :math:`z \\rightarrow z^2`.\nThen it remaps the axes so that :math:`x` and :math:`z` are passed in to the\n`~astropy.modeling.polynomial.Polynomial2D` to evaluate\n:math:`2x^2z^2 + xz + 1`, while simultaneously evaluating a Gaussian on\n:math:`y`.  The end result is a reduction down to two coordinates.  You can\nconfirm for yourself that the result is correct.\n\nThis opens up the possibility of essentially arbitrarily complex transformation\ngraphs.  Currently the tools do not exist to make it easy to navigate and\nreason about highly complex compound models that use these mappings, but that\nis a possible enhancement for future versions.\n\n.. _model-reduction:\n\nModel Reduction\n---------------\n\nIn order to save much duplication in the construction of complex models, it is\npossible to define one complex model that covers all cases where the\nvariables that distinguish the models are made part of the model's input\nvariables. The ``fix_inputs`` function allows defining models derived from\nthe more complex one by setting one or more of the inputs to a constant\nvalue. Examples of this sort of situation arise when working out\nthe transformations from detector pixel to RA, Dec, and lambda for\nspectrographs when the slit locations may be moved (e.g., fiber fed or\ncommandable slit masks), or different orders may be selected (e.g., Eschelle).\nIn the case of order, one may have a function of pixel ``x``, ``y``, ``spectral_order``\nthat map into ``RA``, ``Dec`` and ``lambda``. Without specifying ``spectral_order``, it is\nambiguous what ``RA``, ``Dec`` and ``Lambda`` corresponds to a pixel location. It\nis usually possible to define a function of all three inputs. Presuming\nthis model is ``general_transform`` then ``fix_inputs`` may be used to define\nthe transform for a specific order as follows:\n\n::\n     >>> order1_transform = fix_inputs(general_transform, {'order': 1})  # doctest: +SKIP\n\ncreates a new compound model that takes only pixel position and generates\n``RA``, ``Dec``, and ``lambda``. The ``fix_inputs`` function can be used to set input\nvalues by position (0 is the first) or by input variable name, and more\nthan one can be set in the dictionary supplied.\n\nIf the input model has a bounding_box, the generated model will have the\nbounding for the input coordinate removed.\n\n\n.. test_replace_submodel\n\nReplace submodels\n-----------------\n\n\n:meth:`~astropy.modeling.core.CompoundModel.replace_submodel` creates a new model by\nreplacing a submodel with a matching name with another submodel. The number of\ninputs and outputs of the old and new submodels should match.\n::\n\n    >>> from astropy.modeling import models\n    >>> shift = models.Shift(-1) & models.Shift(-1)\n    >>> scale = models.Scale(2) & models.Scale(3)\n    >>> scale.name = \"Scale\"\n    >>> model = shift | scale\n    >>> model(2, 1)  # doctest: +FLOAT_CMP\n    (2.0, 0.0)\n    >>> new_model = model.replace_submodel('Scale', models.Rotation2D(90, name='Rotation'))\n    >>> new_model(2, 1)  # doctest: +FLOAT_CMP\n    (6.12e-17, 1.0)\n"},{"col":0,"comment":"null","endLoc":195,"header":"def sanitize_scale(scale)","id":415,"name":"sanitize_scale","nodeType":"Function","startLoc":169,"text":"def sanitize_scale(scale):\n    if is_effectively_unity(scale):\n        return 1.0\n\n    # Maximum speed for regular case where scale is a float.\n    if scale.__class__ is float:\n        return scale\n\n    # We cannot have numpy scalars, since they don't autoconvert to\n    # complex if necessary.  They are also slower.\n    if hasattr(scale, 'dtype'):\n        scale = scale.item()\n\n    # All classes that scale can be (int, float, complex, Fraction)\n    # have an \"imag\" attribute.\n    if scale.imag:\n        if abs(scale.real) > abs(scale.imag):\n            if is_effectively_unity(scale.imag/scale.real + 1):\n                return scale.real\n\n        elif is_effectively_unity(scale.real/scale.imag + 1):\n            return complex(0., scale.imag)\n\n        return scale\n\n    else:\n        return scale.real"},{"col":0,"comment":"null","endLoc":1732,"header":"def _url_to_dirname(url)","id":416,"name":"_url_to_dirname","nodeType":"Function","startLoc":1722,"text":"def _url_to_dirname(url):\n    if not _is_url(url):\n        raise ValueError(f\"Malformed URL: '{url}'\")\n    # Make domain names case-insensitive\n    # Also makes the http:// case-insensitive\n    urlobj = list(urllib.parse.urlsplit(url))\n    urlobj[1] = urlobj[1].lower()\n    if urlobj[0].lower() in ['http', 'https'] and urlobj[1] and urlobj[2] == '':\n        urlobj[2] = '/'\n    url_c = urllib.parse.urlunsplit(urlobj)\n    return hashlib.md5(url_c.encode(\"utf-8\")).hexdigest()"},{"id":417,"name":"links.inc","nodeType":"TextFile","path":"docs/modeling","text":".. _Numpy broadcasting rules: https://numpy.org/doc/stable/user/basics.broadcasting.html\n.. _Generalized World Coordinate System (GWCS): https://gwcs.readthedocs.io/en/latest/\n.. _ASDF: https://asdf-standard.readthedocs.io/en/latest/\n.. _SIP: https://fits.gsfc.nasa.gov/registry/sip.html\n"},{"id":418,"name":"performance.rst","nodeType":"TextFile","path":"docs/modeling","text":"\n.. _astropy-modeling-performance:\n\nPerformance Tips\n****************\n\nInitializing a compound model with many constituent models can be time consuming.\nIf your code uses the same compound model repeatedly consider initializing it\nonce and reusing the model.\n\nConsider the :ref:`performance tips <astropy-units-performance>` that apply to\nquantities when initializing and evaluating models with quantities.\n"},{"id":419,"name":"add-units.rst","nodeType":"TextFile","path":"docs/modeling","text":".. _add_units:\n\nAdding support for units in a model (Advanced)\n==============================================\n\nEvaluation\n----------\n\nTo make it so that your models can accept parameters with units and be evaluated\nusing inputs with units, you need to make sure that the\n:meth:`~astropy.modeling.Model.evaluate` method works correctly with\ninput values and parameters with units. For simple arithmetic, this may work\nout of the box since :class:`~astropy.units.Quantity` objects are understood by\na number of Numpy functions.\n\nIf users of your models provide input during evaluation that is not compatible\nwith the parameter units, they may get cryptic errors such as::\n\n    UnitsError : Can only apply 'subtract' function to dimensionless quantities\n    when other argument is not a quantity (unless the latter is all\n    zero/infinity/nan)\n\nThere are several attributes or properties that can be set on models that adjust\nthe behavior of models with units. These attributes can be changed from the\ndefaults in the class definition, e.g.::\n\n    class MyModel(Model):\n        input_units = {'x': u.deg}\n        ...\n\nNote that these are all optional.\n\n.. _models_input_units:\n\n``input_units``\n^^^^^^^^^^^^^^^\n\nYou can easily add checking of the input units by adding an ``input_units``\nproperty or attribute on your model class. This should return either `None` (to\nindicate no constraints) or a dictionary where the keys are the input names\n(e.g. ``x`` for many 1D models) and the values are the units expected, which can\nbe a function of the parameter units::\n\n    @property\n    def input_units(self):\n        if self.mean.unit is None:\n            return None\n        else:\n            return {'x': self.mean.unit}\n\nIf the user then gives values with incorrect input units, a clear error will be\ndisplayed::\n\n    UnitsError: Units of input 'x', (dimensionless), could not be converted to\n    required input units of m (length)\n\nNote that the input units don't have to match exactly those returned by\n``input_units``, but be convertible to them. In addition, ``input_units`` can\nalso be specified as an attribute rather than a property in simple cases::\n\n    input_units = {'x': u.deg}\n\n.. _models_return_units:\n\n``return_units``\n^^^^^^^^^^^^^^^^\n\nSimilarly to :ref:`models_input_units`, this should be dictionary that maps the return\nvalues of a model to units. If :meth:`~astropy.modeling.Model.evaluate` was called\nwith quantities but returns unitless values, the units are added to the output.\nIf the return values are quantities in different units, they are converted to\n``return_units``.\n\n``input_units_strict``\n^^^^^^^^^^^^^^^^^^^^^^\n\nIf set to `True`, values that are passed in compatible units will be converted\nto the exact units specified in ``input_units``.\n\nThis attribute can also be a\ndictionary that maps input names to a Boolean to enable converting of that input\nto the specified unit.\n\n``input_units_equivalencies``\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThis can be set to a dictionary that maps the input names to a list of\nequivalencies, for example::\n\n    input_units_equivalencies = {'nu': u.spectral()}\n\n``_input_units_allow_dimensionless``\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nIf set to `True`, values that are plain scalars or Numpy arrays can be passed to\nevaluate even if ``input_units`` specifies that the input should have units. It\nis up to the :meth:`~astropy.modeling.Model.evaluate` to then decide how to\nhandle these dimensionless values. This attribute can also be a dictionary that\nmaps input names to a Boolean to enable passing dimensionless values to\n:meth:`~astropy.modeling.Model.evaluate` for that input.\n\n\nFitting\n-------\n\nTo allow models with parameters that have units to be fitted to data with units,\nyou will need to add a method called ``_parameter_units_for_data_units`` to your\nmodel class. This should take two arguments ``input_units`` and\n``output_units`` - ``input_units`` will be set to a dictionary with\nthe units of the independent variables in the data, while ``output_units`` will\nbe set to a dictionary with the units the dependent variables in the data (for\nexample, for a simple 1D model, ``input_units`` will have one key, ``x``, and\n``output_units`` will have one key, ``y``). This method should then return\na dictionary giving for each parameter the units the parameter should be\nconverted to so that the model could be used on the data if units were removed\nfrom both the models and the data. The following example shows the\nimplementation for the 1D Gaussian::\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'mean': inputs_unit['x'],\n                'stddev': inputs_unit['x'],\n                'amplitude': outputs_unit['y']}\n\nWith this method in place, the model can then be fit to data that has units.\n"},{"col":4,"comment":"\n        Remove all cards from the header.\n        ","endLoc":800,"header":"def clear(self)","id":420,"name":"clear","nodeType":"Function","startLoc":793,"text":"def clear(self):\n        \"\"\"\n        Remove all cards from the header.\n        \"\"\"\n\n        self._cards = []\n        self._keyword_indices = collections.defaultdict(list)\n        self._rvkc_indices = collections.defaultdict(list)"},{"id":421,"name":"units.rst","nodeType":"TextFile","path":"docs/modeling","text":".. _modeling-units:\n\n********************************\nSupport for units and quantities\n********************************\n\n\n.. note:: The functionality presented here was recently added. If you run into\n          any issues, please don't hesitate to open an issue in the `issue\n          tracker <https://github.com/astropy/astropy/issues>`_.\n\nThe `astropy.modeling` package includes partial support for the use of units and\nquantities in model parameters, models, and during fitting. At this time, only\nsome of the built-in models (such as\n:class:`~astropy.modeling.functional_models.Gaussian1D`) support units, but this\nwill be extended in future to all models where this is appropriate.\n\nSetting parameters to quantities\n================================\n\nModels can take :class:`~astropy.units.Quantity` objects as parameters::\n\n    >>> from astropy import units as u\n    >>> from astropy.modeling.models import Gaussian1D\n    >>> g1 = Gaussian1D(mean=3 * u.m, stddev=2 * u.cm, amplitude=3 * u.Jy)\n\nAccessing the parameter then returns a Parameter object that contains the value\nand the unit::\n\n    >>> g1.mean\n    Parameter('mean', value=3.0, unit=m)\n\nIt is then possible to access the individual properties of the parameter::\n\n    >>> g1.mean.name\n    'mean'\n    >>> g1.mean.value\n    3.0\n    >>> g1.mean.unit\n    Unit(\"m\")\n\nIf a parameter has been initialized as a Quantity, it should always be set to a\nquantity, but the units don't have to be compatible with the initial ones::\n\n    >>> g1.mean = 3 * u.s\n    >>> g1  # doctest: +FLOAT_CMP\n    <Gaussian1D(amplitude=3. Jy, mean=3. s, stddev=2. cm)>\n\nTo change the value of a parameter and not the unit, simply set the value\nproperty::\n\n    >>> g1.mean.value = 2\n    >>> g1  # doctest: +FLOAT_CMP\n    <Gaussian1D(amplitude=3. Jy, mean=2. s, stddev=2. cm)>\n\nSetting a parameter which was originally set to a quantity to a scalar doesn't\nwork because it's ambiguous whether the user means to change just the value and\npreserve the unit, or get rid of the unit::\n\n    >>> g1.mean = 2  # doctest: +IGNORE_EXCEPTION_DETAIL\n    Traceback (most recent call last):\n    ...\n    UnitsError : The 'mean' parameter should be given as a Quantity because it\n    was originally initialized as a Quantity\n\nOn the other hand, if a parameter previously defined without units is given a\nQuantity with a unit, this works because it is unambiguous::\n\n    >>> g2 = Gaussian1D(mean=3)\n    >>> g2.mean = 3 * u.m\n\nIn other words, once units are attached to a parameter, they can't be removed\ndue to ambiguous meaning.\n\nEvaluating models with quantities\n=================================\n\nQuantities can be passed to model during evaluation::\n\n    >>> g3 = Gaussian1D(mean=3 * u.m, stddev=5 * u.cm)\n    >>> g3(2.9 * u.m)  # doctest: +FLOAT_CMP\n    <Quantity 0.1353352832366122>\n    >>> g3(2.9 * u.s)  # doctest: +IGNORE_EXCEPTION_DETAIL\n    Traceback (most recent call last):\n    ...\n    UnitsError : Units of input 'x', s (time), could not be converted to\n    required input units of m (length)\n\nIn this case, since the mean and standard deviation have units, the value passed\nduring evaluation also needs units::\n\n    >>> g3(3)  # doctest: +IGNORE_EXCEPTION_DETAIL\n    Traceback (most recent call last):\n    ...\n    UnitsError : Units of input 'x', (dimensionless), could not be converted to\n    required input units of m (length)\n\nEquivalencies\n-------------\n\nEquivalencies require special care - a Gaussian defined in frequency space is\nnot a Gaussian in wavelength space for example. For this reason, we don't allow\nequivalencies to be attached to the parameters themselves. Instead, we take the\napproach of converting the input data to the parameter space, and any\nequivalencies should be applied at evaluation time to the data (not the\nparameters).\n\nLet's consider a model that is Gaussian in wavelength space::\n\n    >>> g4 = Gaussian1D(mean=3 * u.micron, stddev=1 * u.micron, amplitude=3 * u.Jy)\n\nBy default, passing a frequency will not work:\n\n    >>> g4(1e2 * u.THz)  # doctest: +IGNORE_EXCEPTION_DETAIL\n    Traceback (most recent call last):\n    ...\n    UnitsError : Units of input 'x', THz (frequency), could not be converted to\n    required input units of micron (length)\n\nBut you can pass a dictionary of equivalencies to the equivalencies argument\n(this needs to be a dictionary since some models can contain multiple inputs)::\n\n    >>> g4(110 * u.THz, equivalencies={'x': u.spectral()})  # doctest: +FLOAT_CMP\n    <Quantity 2.888986819525229 Jy>\n\nThe key of the dictionary should be the name of the inputs according to::\n\n    >>> g4.inputs\n    ('x',)\n\nIt is also possible to set default equivalencies for the input parameters using\nthe input_units_equivalencies property::\n\n    >>> g4.input_units_equivalencies = {'x': u.spectral()}\n    >>> g4(110 * u.THz)  # doctest: +FLOAT_CMP\n    <Quantity 2.888986819525229 Jy>\n\nFitting models with units to data\n=================================\n\nFitting models with units to data with units should be seamless provided that\nthe model supports fitting with units. To demonstrate this, we start off by\ngenerating synthetic data:\n\n.. plot::\n   :context: reset\n   :include-source:\n\n    import numpy as np\n    from astropy import units as u\n    import matplotlib.pyplot as plt\n\n    x = np.linspace(1, 5, 30) * u.micron\n    y = np.exp(-0.5 * (x - 2.5 * u.micron)**2 / (200 * u.nm)**2) * u.mJy\n    plt.plot(x, y, 'ko')\n    plt.xlabel('Wavelength (microns)')\n    plt.ylabel('Flux density (mJy)')\n\nand we then define the initial guess for the fitting and we carry out the fit as\nwe would without any units:\n\n.. plot::\n   :context:\n   :include-source:\n\n    from astropy.modeling import models, fitting\n\n    g5 = models.Gaussian1D(mean=3 * u.micron, stddev=1 * u.micron, amplitude=1 * u.Jy)\n\n    fitter = fitting.LevMarLSQFitter()\n\n    g5_fit = fitter(g5, x, y)\n\n    plt.plot(x, y, 'ko')\n    plt.plot(x, g5_fit(x), 'r-')\n    plt.xlabel('Wavelength (microns)')\n    plt.ylabel('Flux density (mJy)')\n\nFitting with equivalencies\n--------------------------\n\nLet's now consider the case where the data is not equivalent to those of the\nparameters, but they are convertible via equivalencies. In this case, the\nequivalencies can either be passed via a dictionary as shown higher up for the\nevaluation examples:\n\n.. plot::\n   :context:\n   :include-source:\n\n    g6 = models.Gaussian1D(mean=110 * u.THz, stddev=10 * u.THz, amplitude=1 * u.Jy)\n\n    g6_fit = fitter(g6, x, y, equivalencies={'x': u.spectral()})\n\n    plt.plot(x, g6_fit(x, equivalencies={'x': u.spectral()}), 'b-')\n    plt.xlabel('Wavelength (microns)')\n    plt.ylabel('Flux density (mJy)')\n\nIn this case, the fit (in blue) is slightly worse, because a Gaussian in\nfrequency space (blue) is not a Gaussian in wavelength space (red). As mentioned\npreviously, you can also set input_units_equivalencies on the model itself to\navoid having to pass extra arguments to the fitter::\n\n    g6.input_units_equivalencies = {'x': u.spectral()}\n    g6_fit = fitter(g6, x, y)\n\n\n.. _units-mapping:\n\nSupport for units in otherwise unitless models\n==============================================\n\nSome models, like polynomials, do not work intrinsically with units. Instead,\nthe :meth:`~astropy.modeling.core.Model.coerce_units` method provides a way to add input and return units to\nunitless models by enclosing the unitless model with two instances of :class:`~astropy.modeling.mappings.UnitsMapping`.\nInternally the inputs are stripped of the units before passed\nto the model and units are attached to the result if ``return_units`` is specified.\nThe method returns a new composite model::\n\n    >>> from astropy.modeling import models\n    >>> from astropy import units as u\n    >>> model = models.Polynomial1D(1, c0=1, c1=2)\n    >>> new_model = model.coerce_units(input_units={'x': u.Hz}, return_units={'y': u.s},\n    ... input_units_equivalencies={'x':u.spectral()})\n    >>> new_model(10 * u.Hz)\n    <Quantity 21. s>\n"},{"id":422,"name":"index.rst","nodeType":"TextFile","path":"docs/modeling","text":".. include:: links.inc\n\n.. _astropy-modeling:\n\n***************************************\nModels and Fitting (`astropy.modeling`)\n***************************************\n\nIntroduction\n============\n\n`astropy.modeling` provides a framework for representing models and performing\nmodel evaluation and fitting.  A number of predefined 1-D and 2-D models are\nprovided and the capability for custom, user defined models is supported.\nDifferent fitting algorithms can be used with any model.  For those fitters\nwith the capabilities fitting can be done using uncertainties, parameters with\nbounds, and priors.\n\n.. _modeling-using:\n\nUsing Modeling\n==============\n\n.. toctree::\n   :maxdepth: 2\n\n   Models <models.rst>\n   Compound Models <compound-models.rst>\n   Model Parameters <parameters.rst>\n   Fitting <fitting.rst>\n   Using Units with Models and Fitting <units.rst>\n\n\n.. _getting-started-example:\n\nA Simple Example\n================\n\nThis simple example illustrates defining a model,\ncalculating values based on input x values, and using fitting data with a model.\n\n   .. plot::\n       :include-source:\n\n       import numpy as np\n       import matplotlib.pyplot as plt\n       from astropy.modeling import models, fitting\n\n       # define a model for a line\n       line_orig = models.Linear1D(slope=1.0, intercept=0.5)\n\n       # generate x, y data non-uniformly spaced in x\n       # add noise to y measurements\n       npts = 30\n       np.random.seed(10)\n       x = np.random.uniform(0.0, 10.0, npts)\n       y = line_orig(x)\n       y += np.random.normal(0.0, 1.5, npts)\n\n       # initialize a linear fitter\n       fit = fitting.LinearLSQFitter()\n\n       # initialize a linear model\n       line_init = models.Linear1D()\n\n       # fit the data with the fitter\n       fitted_line = fit(line_init, x, y)\n\n       # plot the model\n       plt.figure()\n       plt.plot(x, y, 'ko', label='Data')\n       plt.plot(x, fitted_line(x), 'k-', label='Fitted Model')\n       plt.xlabel('x')\n       plt.ylabel('y')\n       plt.legend()\n\n.. _advanced_topics:\n\nAdvanced Topics\n===============\n\n.. toctree::\n   :maxdepth: 2\n\n   Performance Tips <performance.rst>\n   Extending Models <new-model.rst>\n   Extending Fitters <new-fitter.rst>\n   Adding support for units to models <add-units.rst>\n   Joint Fitting <jointfitter.rst>\n\n\nPre-Defined Models\n==================\n\n.. To be expanded to include all pre-defined models\n\nSome of the pre-defined models are listed and illustrated.\n\n.. toctree::\n   :maxdepth: 2\n\n   1D Models <predef_models1D.rst>\n   2D Models <predef_models2D.rst>\n   Physical Models <physical_models.rst>\n   Polynomial Models <polynomial_models.rst>\n   Spline Models <spline_models.rst>\n\nExamples\n========\n\n.. toctree::\n   :maxdepth: 2\n\n   Fitting a line <example-fitting-line>\n   example-fitting-constraints\n   example-fitting-model-sets\n\n.. TODO list\n    fitting with masks\n    fitting with priors\n    fitting with units\n    defining 1d model\n    defining 2d model\n    fitting 2d model\n    defining and using a WCS/gWCS model\n    defining and using a Tabular1D model\n    statistics functions and how to make your own\n    compound models\n\n\nReference/API\n=============\n\n.. toctree::\n   :maxdepth: 1\n\n   reference_api\n"},{"id":423,"name":"reference_api.rst","nodeType":"TextFile","path":"docs/modeling","text":"Reference/API\n=============\n\nCapabilities\n************\n\n.. automodapi:: astropy.modeling\n.. automodapi:: astropy.modeling.bounding_box\n.. automodapi:: astropy.modeling.mappings\n.. automodapi:: astropy.modeling.fitting\n.. automodapi:: astropy.modeling.optimizers\n.. automodapi:: astropy.modeling.statistic\n.. automodapi:: astropy.modeling.separable\n\nPre-Defined Models\n******************\n\n.. automodapi:: astropy.modeling.functional_models\n.. automodapi:: astropy.modeling.physical_models\n.. automodapi:: astropy.modeling.powerlaws\n.. automodapi:: astropy.modeling.polynomial\n.. automodapi:: astropy.modeling.projections\n.. automodapi:: astropy.modeling.rotations\n.. automodapi:: astropy.modeling.spline\n.. automodapi:: astropy.modeling.tabular\n"},{"col":4,"comment":"null","endLoc":2335,"header":"def _expand_and_gather(self, decompose=False, bases=set())","id":424,"name":"_expand_and_gather","nodeType":"Function","startLoc":2296,"text":"def _expand_and_gather(self, decompose=False, bases=set()):\n        def add_unit(unit, power, scale):\n            if bases and unit not in bases:\n                for base in bases:\n                    try:\n                        scale *= unit._to(base) ** power\n                    except UnitsError:\n                        pass\n                    else:\n                        unit = base\n                        break\n\n            if unit in new_parts:\n                a, b = resolve_fractions(new_parts[unit], power)\n                new_parts[unit] = a + b\n            else:\n                new_parts[unit] = power\n            return scale\n\n        new_parts = {}\n        scale = self._scale\n\n        for b, p in zip(self._bases, self._powers):\n            if decompose and b not in bases:\n                b = b.decompose(bases=bases)\n\n            if isinstance(b, CompositeUnit):\n                scale *= b._scale ** p\n                for b_sub, p_sub in zip(b._bases, b._powers):\n                    a, b = resolve_fractions(p_sub, p)\n                    scale = add_unit(b_sub, a * b, scale)\n            else:\n                scale = add_unit(b, p, scale)\n\n        new_parts = [x for x in new_parts.items() if x[1] != 0]\n        new_parts.sort(key=lambda x: (-x[1], getattr(x[0], 'name', '')))\n\n        self._bases = [x[0] for x in new_parts]\n        self._powers = [x[1] for x in new_parts]\n        self._scale = sanitize_scale(scale)"},{"col":0,"comment":"null","endLoc":1214,"header":"def _download_file_from_source(source_url, show_progress=True, timeout=None,\n                               remote_url=None, cache=False, pkgname='astropy',\n                               http_headers=None, ftp_tls=None,\n                               ssl_context=None, allow_insecure=False)","id":425,"name":"_download_file_from_source","nodeType":"Function","startLoc":1127,"text":"def _download_file_from_source(source_url, show_progress=True, timeout=None,\n                               remote_url=None, cache=False, pkgname='astropy',\n                               http_headers=None, ftp_tls=None,\n                               ssl_context=None, allow_insecure=False):\n    from astropy.utils.console import ProgressBarOrSpinner\n\n    if not conf.allow_internet:\n        raise urllib.error.URLError(\n            f\"URL {remote_url} was supposed to be downloaded but \"\n            f\"allow_internet is {conf.allow_internet}; \"\n            f\"if this is unexpected check the astropy.cfg file for the option \"\n            f\"allow_internet\")\n\n    if remote_url is None:\n        remote_url = source_url\n    if http_headers is None:\n        http_headers = {}\n\n    if ftp_tls is None and urllib.parse.urlparse(remote_url).scheme == \"ftp\":\n        try:\n            return _download_file_from_source(source_url,\n                                              show_progress=show_progress,\n                                              timeout=timeout,\n                                              remote_url=remote_url,\n                                              cache=cache,\n                                              pkgname=pkgname,\n                                              http_headers=http_headers,\n                                              ftp_tls=False)\n        except urllib.error.URLError as e:\n            # e.reason might not be a string, e.g. socket.gaierror\n            if str(e.reason).startswith(\"ftp error: error_perm\"):\n                ftp_tls = True\n            else:\n                raise\n\n    with _try_url_open(source_url, timeout=timeout, http_headers=http_headers,\n                       ftp_tls=ftp_tls, ssl_context=ssl_context,\n                       allow_insecure=allow_insecure) as remote:\n        info = remote.info()\n        try:\n            size = int(info['Content-Length'])\n        except (KeyError, ValueError, TypeError):\n            size = None\n\n        if size is not None:\n            check_free_space_in_dir(gettempdir(), size)\n            if cache:\n                dldir = _get_download_cache_loc(pkgname)\n                check_free_space_in_dir(dldir, size)\n\n        if show_progress and sys.stdout.isatty():\n            progress_stream = sys.stdout\n        else:\n            progress_stream = io.StringIO()\n\n        if source_url == remote_url:\n            dlmsg = f\"Downloading {remote_url}\"\n        else:\n            dlmsg = f\"Downloading {remote_url} from {source_url}\"\n        with ProgressBarOrSpinner(size, dlmsg, file=progress_stream) as p:\n            with NamedTemporaryFile(prefix=f\"astropy-download-{os.getpid()}-\",\n                                    delete=False) as f:\n                try:\n                    bytes_read = 0\n                    block = remote.read(conf.download_block_size)\n                    while block:\n                        f.write(block)\n                        bytes_read += len(block)\n                        p.update(bytes_read)\n                        block = remote.read(conf.download_block_size)\n                        if size is not None and bytes_read > size:\n                            raise urllib.error.URLError(\n                                f\"File was supposed to be {size} bytes but \"\n                                f\"server provides more, at least {bytes_read} \"\n                                f\"bytes. Download failed.\")\n                    if size is not None and bytes_read < size:\n                        raise urllib.error.ContentTooShortError(\n                            f\"File was supposed to be {size} bytes but we \"\n                            f\"only got {bytes_read} bytes. Download failed.\",\n                            content=None)\n                except BaseException:\n                    if os.path.exists(f.name):\n                        try:\n                            os.remove(f.name)\n                        except OSError:\n                            pass\n                    raise\n    return f.name"},{"id":426,"name":"parameters.rst","nodeType":"TextFile","path":"docs/modeling","text":".. include:: links.inc\n\n.. _modeling-parameters:\n\n**********\nParameters\n**********\n\nBasics\n======\n\nMost models in this package are \"parametric\" in the sense that each subclass\nof `~astropy.modeling.Model` represents an entire family of models, each\nmember of which is distinguished by a fixed set of parameters that fit that\nmodel to some dependent and independent variable(s) (also referred to\nthroughout the package as the outputs and inputs of the model).\n\nParameters are used in three different contexts within this package: Basic\nevaluation of models, fitting models to data, and providing information about\nindividual models to users (including documentation).\n\nMost subclasses of `~astropy.modeling.Model`--specifically those implementing a\nspecific physical or statistical model, have a fixed set of parameters that can\nbe specified for instances of that model.  There are a few classes of models\n(in particular polynomials) in which the number of parameters depends on some\nother property of the model (the degree in the case of polynomials).\n\nModels maintain a list of parameter names,\n`~astropy.modeling.Model.param_names`.  Single parameters are instances of\n`~astropy.modeling.Parameter` which provides a proxy for the actual parameter\nvalues.  Simple mathematical operations can be performed with them, but they\nalso contain additional attributes specific to model parameters, such as any\nconstraints on their values and documentation.\n\nParameter values may be scalars *or* array values.  Some parameters are\nrequired by their very nature to be arrays (such as the transformation matrix\nfor an `~astropy.modeling.projections.AffineTransformation2D`).  In most other\ncases, however, array-valued parameters have no meaning specific to the model,\nand are simply combined with input arrays during model evaluation according to\nthe standard `Numpy broadcasting rules`_.\n\nParameter constraints\n=====================\n\n`astropy.modeling` supports several types of parameter constraints. They are implemented\nas properties of `~astropy.modeling.Parameter`, the class which defines all fittable\nparameters, and can be set on individual parameters or on model instances.\n\nThe `astropy.modeling.Parameter.fixed` constraint is boolean and indicates\nwhether a parameter is kept \"fixed\" or \"frozen\" during fitting. For example, fixing the\n``stddev`` of a :class:`~astropy.modeling.functional_models.Gaussian1D` model\nmeans it will be excluded from the list of fitted parameters::\n\n    >>> from astropy.modeling.models import Gaussian1D\n    >>> g = Gaussian1D(amplitude=10.2, mean=2.3, stddev=1.2)\n    >>> g.stddev.fixed\n    False\n    >>> g.stddev.fixed = True\n    >>> g.stddev.fixed\n    True\n\n`astropy.modeling.Parameter.bounds` is a tuple of numbers\nsetting minimum and maximum value for a parameter. ``(None, None)`` indicates\nthe parameter values are not bound. ``bounds`` can be set also using the\n`~astropy.modeling.Parameter.min` and\n`~astropy.modeling.Parameter.max` properties. Assigning ``None`` to\nthe corresponding property removes the bound on the parameter. For example, setting\nbounds on the ``mean`` value of a :class:`~astropy.modeling.functional_models.Gaussian1D`\nmodel can be done either by setting ``min`` and ``max``::\n\n    >>> g.mean.bounds\n    (None, None)\n    >>> g.mean.min = 2.2\n    >>> g.mean.bounds\n    (2.2, None)\n    >>> g.mean.max = 2.4\n    >>> g.mean.bounds\n    (2.2, 2.4)\n\nor using the ``bounds`` property::\n\n    >>> g.mean.bounds = (2.2, 2.4)\n\n`astropy.modeling.Parameter.tied` is a user supplied callable\nwhich takes a model instance and returns a value for the parameter.  It is most useful\nwith setting constraints on compounds models, for example a ratio between two parameters (:ref:`example<tied>`).\n\nConstraints can also be set when the model is initialized. For example::\n\n    >>> g = Gaussian1D(amplitude=10.2, mean=2.3, stddev=1.2,\n    ...                fixed={'stddev': True},\n    ... \t        bounds={'mean': (2.2, 2.4)})\n    >>> g.stddev.fixed\n    True\n    >>> g.mean.bounds\n    (2.2, 2.4)\n\n\nParameter examples\n==================\n\n- Model classes can be introspected directly to find out what parameters they\n  accept::\n\n      >>> from astropy.modeling import models\n      >>> models.Gaussian1D.param_names\n      ('amplitude', 'mean', 'stddev')\n\n  The order of the items in the ``param_names`` list is relevant--this\n  is the same order in which values for those parameters should be passed in\n  when constructing an instance of that model::\n\n      >>> g = models.Gaussian1D(1.0, 0.0, 0.1)\n      >>> g  # doctest: +FLOAT_CMP\n      <Gaussian1D(amplitude=1.0, mean=0.0, stddev=0.1)>\n\n  However, parameters may also be given as keyword arguments (in any order)::\n\n      >>> g = models.Gaussian1D(mean=0.0, amplitude=2.0, stddev=0.2)\n      >>> g  # doctest: +FLOAT_CMP\n      <Gaussian1D(amplitude=2.0, mean=0.0, stddev=0.2)>\n\n  So all that really matters is knowing the names (and meanings) of the\n  parameters that each model accepts.  More information about an individual\n  model can also be obtained using the `help` built-in::\n\n      >>> help(models.Gaussian1D)  # doctest: +SKIP\n\n- Some types of models can have different numbers of parameters depending\n  on other properties of the model.  In particular, the parameters of\n  polynomial models are their coefficients, the number of which depends on the\n  polynomial's degree::\n\n      >>> p1 = models.Polynomial1D(degree=3, c0=1.0, c1=0.0, c2=2.0, c3=3.0)\n      >>> p1.param_names\n      ('c0', 'c1', 'c2', 'c3')\n      >>> p1  # doctest: +FLOAT_CMP\n      <Polynomial1D(3, c0=1., c1=0., c2=2., c3=3.)>\n\n  For the basic `~astropy.modeling.polynomial.Polynomial1D` class the\n  parameters are named ``c0`` through ``cN`` where ``N`` is the degree of the\n  polynomial.  The above example represents the polynomial :math:`3x^3 + 2x^2 +\n  1`.\n\n- Some models also have default values for one or more of their parameters.\n  For polynomial models, for example, the default value of all coefficients is\n  zero--this allows a polynomial instance to be created without specifying any\n  of the coefficients initially::\n\n      >>> p2 = models.Polynomial1D(degree=4)\n      >>> p2  # doctest: +FLOAT_CMP\n      <Polynomial1D(4, c0=0., c1=0., c2=0., c3=0., c4=0.)>\n\n- Parameters can then be set/updated by accessing attributes on the model of\n  the same names as the parameters::\n\n      >>> p2.c4 = 1\n      >>> p2.c2 = 3.5\n      >>> p2.c0 = 2.0\n      >>> p2  # doctest: +FLOAT_CMP\n      <Polynomial1D(4, c0=2., c1=0., c2=3.5, c3=0., c4=1.)>\n\n  This example now represents the polynomial :math:`x^4 + 3.5x^2 + 2`.\n\n- It is possible to set the coefficients of a polynomial by passing the\n  parameters in a dictionary, since all parameters can be provided as keyword\n  arguments::\n\n      >>> ch2 = models.Chebyshev2D(x_degree=2, y_degree=3)\n      >>> coeffs = dict((name, [idx, idx + 10])\n      ...               for idx, name in enumerate(ch2.param_names))\n      >>> ch2 = models.Chebyshev2D(x_degree=2, y_degree=3, n_models=2,\n      ...                          **coeffs)\n      >>> ch2.param_sets  # doctest: +FLOAT_CMP\n      array([[ 0., 10.],\n             [ 1., 11.],\n             [ 2., 12.],\n             [ 3., 13.],\n             [ 4., 14.],\n             [ 5., 15.],\n             [ 6., 16.],\n             [ 7., 17.],\n             [ 8., 18.],\n             [ 9., 19.],\n             [10., 20.],\n             [11., 21.]])\n\n- Or directly, using keyword arguments::\n\n      >>> ch2 = models.Chebyshev2D(x_degree=2, y_degree=3,\n      ...                          c0_0=[0, 10], c0_1=[3, 13],\n      ...                          c0_2=[6, 16], c0_3=[9, 19],\n      ...                          c1_0=[1, 11], c1_1=[4, 14],\n      ...                          c1_2=[7, 17], c1_3=[10, 20,],\n      ...                          c2_0=[2, 12], c2_1=[5, 15],\n      ...                          c2_2=[8, 18], c2_3=[11, 21])\n\n- Individual parameters values may be arrays of different sizes and shapes::\n\n      >>> p3 = models.Polynomial1D(degree=2, c0=1.0, c1=[2.0, 3.0],\n      ...                          c2=[[4.0, 5.0], [6.0, 7.0], [8.0, 9.0]])\n      >>> p3(2.0)  # doctest: +FLOAT_CMP\n      array([[21., 27.],\n             [29., 35.],\n             [37., 43.]])\n\n  This is equivalent to evaluating the Numpy expression::\n\n      >>> import numpy as np\n      >>> c2 = np.array([[4.0, 5.0],\n      ...                [6.0, 7.0],\n      ...                [8.0, 9.0]])\n      >>> c1 = np.array([2.0, 3.0])\n      >>> c2 * 2.0**2 + c1 * 2.0 + 1.0  # doctest: +FLOAT_CMP\n      array([[21., 27.],\n             [29., 35.],\n             [37., 43.]])\n\n  Note that in most cases, when using array-valued parameters, the parameters\n  must obey the standard broadcasting rules for Numpy arrays with respect to\n  each other::\n\n      >>> models.Polynomial1D(degree=2, c0=1.0, c1=[2.0, 3.0],\n      ...                     c2=[4.0, 5.0, 6.0])  # doctest: +IGNORE_EXCEPTION_DETAIL\n      Traceback (most recent call last):\n      ...\n      InputParameterError: Parameter u'c1' of shape (2,) cannot be broadcast\n      with parameter u'c2' of shape (3,).  All parameter arrays must have\n      shapes that are mutually compatible according to the broadcasting rules.\n"},{"col":4,"comment":"\n        Appends a new keyword+value card to the end of the Header, similar\n        to `list.append`.\n\n        By default if the last cards in the Header have commentary keywords,\n        this will append the new keyword before the commentary (unless the new\n        keyword is also commentary).\n\n        Also differs from `list.append` in that it can be called with no\n        arguments: In this case a blank card is appended to the end of the\n        Header.  In the case all the keyword arguments are ignored.\n\n        Parameters\n        ----------\n        card : str, tuple\n            A keyword or a (keyword, value, [comment]) tuple representing a\n            single header card; the comment is optional in which case a\n            2-tuple may be used\n\n        useblanks : bool, optional\n            If there are blank cards at the end of the Header, replace the\n            first blank card so that the total number of cards in the Header\n            does not increase.  Otherwise preserve the number of blank cards.\n\n        bottom : bool, optional\n            If True, instead of appending after the last non-commentary card,\n            append after the last non-blank card.\n\n        end : bool, optional\n            If True, ignore the useblanks and bottom options, and append at the\n            very end of the Header.\n\n        ","endLoc":1244,"header":"def append(self, card=None, useblanks=True, bottom=False, end=False)","id":427,"name":"append","nodeType":"Function","startLoc":1156,"text":"def append(self, card=None, useblanks=True, bottom=False, end=False):\n        \"\"\"\n        Appends a new keyword+value card to the end of the Header, similar\n        to `list.append`.\n\n        By default if the last cards in the Header have commentary keywords,\n        this will append the new keyword before the commentary (unless the new\n        keyword is also commentary).\n\n        Also differs from `list.append` in that it can be called with no\n        arguments: In this case a blank card is appended to the end of the\n        Header.  In the case all the keyword arguments are ignored.\n\n        Parameters\n        ----------\n        card : str, tuple\n            A keyword or a (keyword, value, [comment]) tuple representing a\n            single header card; the comment is optional in which case a\n            2-tuple may be used\n\n        useblanks : bool, optional\n            If there are blank cards at the end of the Header, replace the\n            first blank card so that the total number of cards in the Header\n            does not increase.  Otherwise preserve the number of blank cards.\n\n        bottom : bool, optional\n            If True, instead of appending after the last non-commentary card,\n            append after the last non-blank card.\n\n        end : bool, optional\n            If True, ignore the useblanks and bottom options, and append at the\n            very end of the Header.\n\n        \"\"\"\n\n        if isinstance(card, str):\n            card = Card(card)\n        elif isinstance(card, tuple):\n            card = Card(*card)\n        elif card is None:\n            card = Card()\n        elif not isinstance(card, Card):\n            raise ValueError(\n                'The value appended to a Header must be either a keyword or '\n                '(keyword, value, [comment]) tuple; got: {!r}'.format(card))\n\n        if not end and card.is_blank:\n            # Blank cards should always just be appended to the end\n            end = True\n\n        if end:\n            self._cards.append(card)\n            idx = len(self._cards) - 1\n        else:\n            idx = len(self._cards) - 1\n            while idx >= 0 and self._cards[idx].is_blank:\n                idx -= 1\n\n            if not bottom and card.keyword not in Card._commentary_keywords:\n                while (idx >= 0 and\n                       self._cards[idx].keyword in Card._commentary_keywords):\n                    idx -= 1\n\n            idx += 1\n            self._cards.insert(idx, card)\n            self._updateindices(idx)\n\n        keyword = Card.normalize_keyword(card.keyword)\n        self._keyword_indices[keyword].append(idx)\n        if card.field_specifier is not None:\n            self._rvkc_indices[card.rawkeyword].append(idx)\n\n        if not end:\n            # If the appended card was a commentary card, and it was appended\n            # before existing cards with the same keyword, the indices for\n            # cards with that keyword may have changed\n            if not bottom and card.keyword in Card._commentary_keywords:\n                self._keyword_indices[keyword].sort()\n\n            # Finally, if useblanks, delete a blank cards from the end\n            if useblanks and self._countblanks():\n                # Don't do this unless there is at least one blanks at the end\n                # of the header; we need to convert the card to its string\n                # image to see how long it is.  In the vast majority of cases\n                # this will just be 80 (Card.length) but it may be longer for\n                # CONTINUE cards\n                self._useblanks(len(str(card)) // Card.length)\n\n        self._modified = True"},{"id":428,"name":"spline_models.rst","nodeType":"TextFile","path":"docs/modeling","text":".. include:: links.inc\n\n.. _spline_models:\n\n****************\n1D Spline Models\n****************\n\n`~astropy.modeling.spline.Spline1D` models are models which can be used\nto fit a piecewise polynomial to a set of data. This means that splines\nare closely tied to the method used to fit the spline to the data. Currently,\nwe provide three methods for fitting splines to data:\n\n- :class:`~astropy.modeling.spline.SplineInterpolateFitter`, which\n  fits an interpolating spline to the data. This means that the spline\n  will exactly fit all data points.\n\n- :class:`~astropy.modeling.spline.SplineSmoothingFitter`, which fits\n  a smoothing spline to the data. This means that the number of knots\n  is chosen to satisfy the \"smoothing condition\":\n\n  .. math:: \\sum_{i} \\left(w_i * (y_i - spl(x_i))\\right)^{2} \\leq s\n\n- :class:`~astropy.modeling.spline.SplineExactKnotsFitter`, which fits\n  a spline to the data using an exact set of knots. This means that the\n  spline will use least-squares regression using the user supplied (interior)\n  knots to find the best fit spline to the data.\n\n.. plot::\n    :include-source:\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import Spline1D\n    from astropy.modeling.fitting import (SplineInterpolateFitter,\n                                          SplineSmoothingFitter,\n                                          SplineExactKnotsFitter)\n\n    x = np.linspace(-3, 3, 50)\n    y = np.exp(-x**2) + 0.1 * np.random.randn(50)\n    xs = np.linspace(-3, 3, 1000)\n    t = [-1, 0, 1]\n    spl = Spline1D()\n\n    fitter = SplineInterpolateFitter()\n    spl1 = fitter(spl, x, y)\n\n    fitter = SplineSmoothingFitter()\n    spl2 = fitter(spl, x, y, s=0.5)\n\n    fitter = SplineExactKnotsFitter()\n    spl3 = fitter(spl, x, y, t=t)\n\n    plt.plot(x, y, 'ro', label=\"Data\")\n    plt.plot(xs, spl1(xs), 'b-', label=\"Interpolating\")\n    plt.plot(xs, spl2(xs), 'g-', label=\"Smoothing\")\n    plt.plot(xs, spl3(xs), 'k-', label=\"Exact Knots\")\n    plt.legend()\n    plt.show()\n\nNote that by default, splines have `degree <astropy.modeling.spline.Spline1D.degree>` 3.\nIn the case of these splines, the ``degree - 1`` is the number of derivatives that\nare matched by the spline across knot points. So for degree 3 splines, the value,\nfirst, and second derivatives of the spline will match across each knot point.\n\n.. warning::\n\n    Splines only support integer degrees, such that ``1 <= degree <= 5``.\n"},{"id":429,"name":"models.rst","nodeType":"TextFile","path":"docs/modeling","text":".. include:: links.inc\n\n.. _models:\n\n******\nModels\n******\n\n.. _basics-models:\n\nBasics\n======\n\nThe `astropy.modeling` package defines a number of models that are collected\nunder a single namespace as ``astropy.modeling.models``.  Models behave like\nparametrized functions::\n\n    >>> import numpy as np\n    >>> from astropy.modeling import models\n    >>> g = models.Gaussian1D(amplitude=1.2, mean=0.9, stddev=0.5)\n    >>> print(g)\n    Model: Gaussian1D\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Model set size: 1\n    Parameters:\n        amplitude mean stddev\n        --------- ---- ------\n              1.2  0.9    0.5\n\nModel parameters can be accessed as attributes::\n\n    >>> g.amplitude\n    Parameter('amplitude', value=1.2)\n    >>> g.mean\n    Parameter('mean', value=0.9)\n    >>> g.stddev  # doctest: +FLOAT_CMP\n    Parameter('stddev', value=0.5, bounds=(1.1754943508222875e-38, None))\n\nand can also be updated via those attributes::\n\n    >>> g.amplitude = 0.8\n    >>> g.amplitude\n    Parameter('amplitude', value=0.8)\n\nModels can be evaluated by calling them as functions::\n\n    >>> g(0.1)\n    0.22242984036255528\n    >>> g(np.linspace(0.5, 1.5, 7))  # doctest: +FLOAT_CMP\n    array([0.58091923, 0.71746405, 0.7929204 , 0.78415894, 0.69394278,\n           0.54952605, 0.3894018 ])\n\nAs the above example demonstrates, in general most models evaluate array-like\ninputs according to the standard `Numpy broadcasting rules`_ for arrays.\nModels can therefore already be useful to evaluate common functions,\nindependently of the fitting features of the package.\n\n.. _modeling-instantiating:\n\n\nInstantiating and Evaluating Models\n-----------------------------------\n\nIn general, models are instantiated by supplying the parameter values that\ndefine that instance of the model to the constructor, as demonstrated in\nthe section on :ref:`modeling-parameters`.\n\nAdditionally, a `~astropy.modeling.Model` instance may represent a single model\nwith one set of parameters, or a :ref:`Model set <modeling-model-sets>` consisting\nof a set of parameters each representing a different parameterization of the same\nparametric model. For example, you may instantiate a single Gaussian model\nwith one mean, standard deviation, and amplitude. Or you may create a set\nof N Gaussians, each one of which would be evaluated on, for example, a\ndifferent plane in an image cube.\n\nFor example, a single Gaussian model may be instantiated with all scalar parameters::\n\n    >>> from astropy.modeling.models import Gaussian1D\n    >>> g = Gaussian1D(amplitude=1, mean=0, stddev=1)\n    >>> g  # doctest: +FLOAT_CMP\n    <Gaussian1D(amplitude=1., mean=0., stddev=1.)>\n\nThe newly created model instance ``g`` now works like a Gaussian function\nwith the specific parameters.  It takes a single input::\n\n    >>> g.inputs\n    ('x',)\n    >>> g(x=0)\n    1.0\n\nThe model can also be called without explicitly using keyword arguments::\n\n    >>> g(0)\n    1.0\n\nOr a set of Gaussians may be instantiated by passing multiple parameter values::\n\n    >>> from astropy.modeling.models import Gaussian1D\n    >>> gset = Gaussian1D(amplitude=[1, 1.5, 2],\n    ...                   mean=[0, 1, 2],\n    ...                   stddev=[1., 1., 1.],\n    ...                   n_models=3)\n    >>> print(gset)  # doctest: +FLOAT_CMP\n    Model: Gaussian1D\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Model set size: 3\n    Parameters:\n        amplitude mean stddev\n        --------- ---- ------\n              1.0  0.0    1.0\n              1.5  1.0    1.0\n              2.0  2.0    1.0\n\nThis model also works like a Gaussian function. The three models in\nthe model set can be evaluated on the same input::\n\n    >>> gset(1.)\n    array([0.60653066, 1.5       , 1.21306132])\n\nor on ``N=3`` inputs::\n\n    >>> gset([1, 2, 3])\n    array([0.60653066, 0.90979599, 1.21306132])\n\nFor a comprehensive example of fitting a model set see :ref:`example-fitting-model-sets`.\n\nModel inverses\n--------------\n\nAll models have a `Model.inverse <astropy.modeling.Model.inverse>` property\nwhich may, for some models, return a new model that is the analytic inverse of\nthe model it is attached to.  For example::\n\n    >>> from astropy.modeling.models import Linear1D\n    >>> linear = Linear1D(slope=0.8, intercept=1.0)\n    >>> linear.inverse\n    <Linear1D(slope=1.25, intercept=-1.25)>\n\nThe inverse of a model will always be a fully instantiated model in its own\nright, and so can be evaluated directly like::\n\n    >>> linear.inverse(2.0)\n    1.25\n\nIt is also possible to assign a *custom* inverse to a model.  This may be\nuseful, for example, in cases where a model does not have an analytic inverse,\nbut may have an approximate inverse that was computed numerically and is\nrepresented by another model. This works even if the target model has a\ndefault analytic inverse--in this case the default is overridden with the\ncustom inverse::\n\n    >>> from astropy.modeling.models import Polynomial1D\n    >>> linear.inverse = Polynomial1D(degree=1, c0=-1.25, c1=1.25)\n    >>> linear.inverse\n    <Polynomial1D(1, c0=-1.25, c1=1.25)>\n\nIf a custom inverse has been assigned to a model, it can be deleted with\n``del model.inverse``.  This resets the inverse to its default (if one exists).\nIf a default does not exist, accessing ``model.inverse`` raises a\n`NotImplementedError`.  For example polynomial models do not have a default\ninverse::\n\n    >>> del linear.inverse\n    >>> linear.inverse\n    <Linear1D(slope=1.25, intercept=-1.25)>\n    >>> p = Polynomial1D(degree=2, c0=1.0, c1=2.0, c2=3.0)\n    >>> p.inverse\n    Traceback (most recent call last):\n      File \"<stdin>\", line 1, in <module>\n      File \"astropy\\modeling\\core.py\", line 796, in inverse\n        raise NotImplementedError(\"An analytical inverse transform has not \"\n    NotImplementedError: No analytical or user-supplied inverse transform\n    has been implemented for this model.\n\nOne may certainly compute an inverse and assign it to a polynomial model\nthough.\n\n.. note::\n\n    When assigning a custom inverse to a model no validation is performed to\n    ensure that it is actually an inverse or even approximate inverse.  So\n    assign custom inverses at your own risk.\n\nBounding Boxes\n--------------\n\n.. _bounding-boxes:\n\nEfficient Model Rendering with Bounding Boxes\n+++++++++++++++++++++++++++++++++++++++++++++\n\n\nAll `Model <astropy.modeling.Model>` subclasses have a\n`bounding_box <astropy.modeling.Model.bounding_box>` attribute that\ncan be used to set the limits over which the model is significant. This greatly\nimproves the efficiency of evaluation when the input range is much larger than\nthe characteristic width of the model itself. For example, to create a sky model\nimage from a large survey catalog, each source should only be evaluated over the\npixels to which it contributes a significant amount of flux. This task can\notherwise be computationally prohibitive on an average CPU.\n\nThe :func:`Model.render <astropy.modeling.Model.render>` method can be used to\nevaluate a model on an output array, or input coordinate arrays, limiting the\nevaluation to the `bounding_box <astropy.modeling.Model.bounding_box>` region if\nit is set. This function will also produce postage stamp images of the model if\nno other input array is passed. To instead extract postage stamps from the data\narray itself, see :ref:`cutout_images`.\n\nUsing the standard Bounding Box\n+++++++++++++++++++++++++++++++\n\nFor basic usage, see `Model.bounding_box <astropy.modeling.Model.bounding_box>`.\nBy default no `~astropy.modeling.Model.bounding_box` is set, except on model\nsubclasses where a ``bounding_box`` property or method is explicitly defined.\nThe default is then the minimum rectangular region symmetric about the position\nthat fully contains the model. If the model does not have a finite extent,\nthe containment criteria are noted in the documentation. For example, see\n``Gaussian2D.bounding_box``.\n\n.. warning::\n\n    Accessing the `Model.bounding_box <astropy.modeling.Model.bounding_box>`\n    property when it has not been set, or does not have a default will\n    result in a ``NotImplementedError``. If this behavior is undesireable,\n    then one can instead use the `Model.get_bounding_box <astropy.modeling.Model.get_bounding_box>`\n    method instead. This method will return the bounding box if one exists\n    (by setting or default) otherwise it will return ``None`` instead\n    of raising an error.\n\nA `Model.bounding_box <astropy.modeling.Model.bounding_box>` default can be\nset by the user to any callable. This is particularly useful for models created\nwith `~astropy.modeling.custom_model` or as a `~astropy.modeling.core.CompoundModel`::\n\n    >>> from astropy.modeling import custom_model\n    >>> def ellipsoid(x, y, z, x0=0, y0=0, z0=0, a=2, b=3, c=4, amp=1):\n    ...     rsq = ((x - x0) / a) ** 2 + ((y - y0) / b) ** 2 + ((z - z0) / c) ** 2\n    ...     val = (rsq < 1) * amp\n    ...     return val\n    ...\n    >>> class Ellipsoid3D(custom_model(ellipsoid)):\n    ...     # A 3D ellipsoid model\n    ...     def bounding_box(self):\n    ...         return ((self.z0 - self.c, self.z0 + self.c),\n    ...                 (self.y0 - self.b, self.y0 + self.b),\n    ...                 (self.x0 - self.a, self.x0 + self.a))\n    ...\n    >>> model1 = Ellipsoid3D()\n    >>> model1.bounding_box\n    ModelBoundingBox(\n        intervals={\n            x0: Interval(lower=-2.0, upper=2.0)\n            x1: Interval(lower=-3.0, upper=3.0)\n            x2: Interval(lower=-4.0, upper=4.0)\n        }\n        model=Ellipsoid3D(inputs=('x0', 'x1', 'x2'))\n        order='C'\n    )\n\nBy default models are evaluated on any inputs. By passing a flag they can be evaluated\nonly on inputs within the bounding box. For inputs outside of the bounding_box a ``fill_value`` is\nreturned (``np.nan`` by default)::\n\n    >>> model1(-5, 1, 1)\n    0.0\n    >>> model1(-5, 1, 1, with_bounding_box=True)\n    nan\n    >>> model1(-5, 1, 1, with_bounding_box=True, fill_value=-1)\n    -1.0\n\n`Model.bounding_box <astropy.modeling.Model.bounding_box>` can be set on any\nmodel instance via the usage of the property setter. For example for a single\ninput model one needs to only set a tuple of the lower and upper bounds ::\n\n    >>> from astropy.modeling.models import Polynomial1D\n    >>> model2 = Polynomial1D(2)\n    >>> model2.bounding_box = (-1, 1)\n    >>> model2.bounding_box\n    ModelBoundingBox(\n        intervals={\n            x: Interval(lower=-1, upper=1)\n        }\n        model=Polynomial1D(inputs=('x',))\n        order='C'\n    )\n    >>> model2(-2)\n    0.0\n    >>> model2(-2, with_bounding_box=True)\n    nan\n    >>> model2(-2, with_bounding_box=True, fill_value=47)\n    47.0\n\nFor multi-input models, `Model.bounding_box <astropy.modeling.Model.bounding_box>`\ncan be set on any model instance by specifying a tuple of lower/upper bound tuples ::\n\n    >>> from astropy.modeling.models import Polynomial2D\n    >>> model3 = Polynomial2D(2)\n    >>> model3.bounding_box = ((-2, 2), (-1, 1))\n    >>> model3.bounding_box\n    ModelBoundingBox(\n        intervals={\n            x: Interval(lower=-1, upper=1)\n            y: Interval(lower=-2, upper=2)\n        }\n        model=Polynomial2D(inputs=('x', 'y'))\n        order='C'\n    )\n    >>> model3(-2, 0)\n    0.0\n    >>> model3(-2, 0, with_bounding_box=True)\n    nan\n    >>> model3(-2, 0, with_bounding_box=True, fill_value=7)\n    7.0\n\nNote that if one wants to directly recover the tuple used to formulate\na bounding box, then one can use the\n`ModelBoundingBox.bounding_box() <astropy.modeling.bounding_box.ModelBoundingBox.bounding_box>`\nmethod ::\n\n    >>> model1.bounding_box.bounding_box()\n    ((-4.0, 4.0), (-3.0, 3.0), (-2.0, 2.0))\n    >>> model2.bounding_box.bounding_box()\n    (-1, 1)\n    >>> model3.bounding_box.bounding_box()\n    ((-2, 2), (-1, 1))\n\n.. warning::\n\n    When setting multi-dimensional bounding boxes it is important to\n    remember that by default the tuple of tuples is assumed to be ``'C'`` ordered,\n    which means that the bound tuples will be ordered in the reverse order\n    to their respective input order. That is if the inputs are in the order\n    ``('x', 'y', 'z')`` then the bounds will need to be listed in ``('z', 'y', 'x')``\n    order.\n\nThe if one does not want to work directly with the default ``'C'`` ordered\nbounding boxes. It is possible to use the alternate ``'F'`` ordering, which\norders the bounding box tuple in the same order as the inputs. To do this\none can use the `bind_bounding_box <astropy.modeling.bind_bounding_box>`\nfunction, and passing the ``order='F'`` keyword argument ::\n\n    >>> from astropy.modeling import bind_bounding_box\n    >>> model4 = Polynomial2D(3)\n    >>> bind_bounding_box(model4, ((-1, 1), (-2, 2)), order='F')\n    >>> model4.bounding_box\n    ModelBoundingBox(\n        intervals={\n            x: Interval(lower=-1, upper=1)\n            y: Interval(lower=-2, upper=2)\n        }\n        model=Polynomial2D(inputs=('x', 'y'))\n        order='F'\n    )\n    >>> model4(-2, 0)\n    0.0\n    >>> model4(-2, 0, with_bounding_box=True)\n    nan\n    >>> model4(-2, 0, with_bounding_box=True, fill_value=12)\n    12.0\n    >>> model4.bounding_box.bounding_box()\n    ((-1, 1), (-2, 2))\n    >>> model4.bounding_box.bounding_box(order='C')\n    ((-2, 2), (-1, 1))\n\n.. warning::\n\n    Currently when combining models the bounding boxes of components are\n    combined only when joining models with the ``&`` operator.\n    For the other operators bounding boxes for compound models must be assigned\n    explicitly.  A future release will determine the appropriate bounding box\n    for a compound model where possible.\n\nUsing the Compound Bounding Box\n+++++++++++++++++++++++++++++++\n\nSometimes it is useful to have multiple bounding boxes for the same model,\nwhich are selectable when the model is evaluated. In this case, one should\nconsider using a `CompoundBoundingBox <astropy.modeling.bounding_box.CompoundBoundingBox>`.\n\nA common use case for this may be if the model has a single \"discrete\"\nselector input (for example ``'slit_id'``), which among other things,\ndetermines what bounding box should be applied to the other inputs. To\ndo this one needs to first define a dictionary of bounding box tuples,\nwith dictionary keys being the specific values of the selector input\ncorresponding to that specific bounding box ::\n\n    >>> from astropy.modeling.models import Shift, Identity\n    >>> model1 = Shift(1) & Shift(2) & Identity(1)\n    >>> model1.inputs = ('x', 'y', 'slit_id')\n    >>> bboxes = {\n    ...     0: ((0, 1), (1, 2)),\n    ...     1: ((2, 3), (3, 4))\n    ... }\n\nIn order for the compound bounding box to function one must specify a list\nof selector arguments, where the elements of this list are tuples of the input's\nname and whether or not the bounding box should be applied to the selector argument\nor not. In this case, it makes sense for the selector argument to be ignored ::\n\n    >>> from astropy.modeling.core import bind_compound_bounding_box\n    >>> selector_args = [('slit_id', True)]\n    >>> bind_compound_bounding_box(model1, bboxes, selector_args, order='F')\n    >>> model1.bounding_box\n    CompoundBoundingBox(\n        bounding_boxes={\n            (0,) = ModelBoundingBox(\n                    intervals={\n                        x: Interval(lower=0, upper=1)\n                        y: Interval(lower=1, upper=2)\n                    }\n                    ignored=['slit_id']\n                    model=CompoundModel(inputs=('x', 'y', 'slit_id'))\n                    order='F'\n                )\n            (1,) = ModelBoundingBox(\n                    intervals={\n                        x: Interval(lower=2, upper=3)\n                        y: Interval(lower=3, upper=4)\n                    }\n                    ignored=['slit_id']\n                    model=CompoundModel(inputs=('x', 'y', 'slit_id'))\n                    order='F'\n                )\n        }\n        selector_args = SelectorArguments(\n                Argument(name='slit_id', ignore=True)\n            )\n    )\n    >>> model1(0.5, 1.5, 0, with_bounding_box=True)\n    (1.5, 3.5, 0.0)\n    >>> model1(0.5, 1.5, 1, with_bounding_box=True)\n    (nan, nan, nan)\n\nMultiple selector arguments can also be used, in this case the keys of the\ndictionary of bounding boxes need to be specified as tuples of values ::\n\n    >>> model2 = Shift(1) & Shift(2) & Identity(2)\n    >>> model2.inputs = ('x', 'y', 'slit_x', 'slit_y')\n    >>> bboxes = {\n    ...     (0, 0): ((0, 1), (1, 2)),\n    ...     (0, 1): ((2, 3), (3, 4)),\n    ...     (1, 0): ((4, 5), (5, 6)),\n    ...     (1, 1): ((6, 7), (7, 8)),\n    ... }\n    >>> selector_args = [('slit_x', True), ('slit_y', True)]\n    >>> bind_compound_bounding_box(model2, bboxes, selector_args, order='F')\n    >>> model2.bounding_box\n    CompoundBoundingBox(\n        bounding_boxes={\n            (0, 0) = ModelBoundingBox(\n                    intervals={\n                        x: Interval(lower=0, upper=1)\n                        y: Interval(lower=1, upper=2)\n                    }\n                    ignored=['slit_x', 'slit_y']\n                    model=CompoundModel(inputs=('x', 'y', 'slit_x', 'slit_y'))\n                    order='F'\n                )\n            (0, 1) = ModelBoundingBox(\n                    intervals={\n                        x: Interval(lower=2, upper=3)\n                        y: Interval(lower=3, upper=4)\n                    }\n                    ignored=['slit_x', 'slit_y']\n                    model=CompoundModel(inputs=('x', 'y', 'slit_x', 'slit_y'))\n                    order='F'\n                )\n            (1, 0) = ModelBoundingBox(\n                    intervals={\n                        x: Interval(lower=4, upper=5)\n                        y: Interval(lower=5, upper=6)\n                    }\n                    ignored=['slit_x', 'slit_y']\n                    model=CompoundModel(inputs=('x', 'y', 'slit_x', 'slit_y'))\n                    order='F'\n                )\n            (1, 1) = ModelBoundingBox(\n                    intervals={\n                        x: Interval(lower=6, upper=7)\n                        y: Interval(lower=7, upper=8)\n                    }\n                    ignored=['slit_x', 'slit_y']\n                    model=CompoundModel(inputs=('x', 'y', 'slit_x', 'slit_y'))\n                    order='F'\n                )\n        }\n        selector_args = SelectorArguments(\n                Argument(name='slit_x', ignore=True)\n                Argument(name='slit_y', ignore=True)\n            )\n    )\n    >>> model2(0.5, 1.5, 0, 0, with_bounding_box=True)\n    (1.5, 3.5, 0.0, 0.0)\n    >>> model2(0.5, 1.5, 1, 1, with_bounding_box=True)\n    (nan, nan, nan, nan)\n\nNote that one can also specify the ordering for all the bounding boxes\ncomprising the compound bounding using the ``order`` keyword argument.\n\nAnother use case for this maybe a if one wants to use multiple bounding\nboxes for the same model, where the user chooses the bounding box when\nevaluating the model. In this case, one must still choose a selector\nargument as a fall back default for bounding box selection; however, this\nargument should not be ignored by the bounding box::\n\n    >>> from astropy.modeling.models import Polynomial2D\n    >>> from astropy.modeling import bind_compound_bounding_box\n    >>> model = Polynomial2D(3)\n    >>> bboxes = {\n    ...     0: ((0, 1), (1, 2)),\n    ...     1: ((2, 3), (3, 4))\n    ... }\n    >>> selector_args = [('x', False)]\n    >>> bind_compound_bounding_box(model, bboxes, selector_args, order='F')\n    >>> model.bounding_box\n        CompoundBoundingBox(\n        bounding_boxes={\n            (0,) = ModelBoundingBox(\n                    intervals={\n                        x: Interval(lower=0, upper=1)\n                        y: Interval(lower=1, upper=2)\n                    }\n                    model=Polynomial2D(inputs=('x', 'y'))\n                    order='F'\n                )\n            (1,) = ModelBoundingBox(\n                    intervals={\n                        x: Interval(lower=2, upper=3)\n                        y: Interval(lower=3, upper=4)\n                    }\n                    model=Polynomial2D(inputs=('x', 'y'))\n                    order='F'\n                )\n        }\n        selector_args = SelectorArguments(\n                Argument(name='x', ignore=False)\n            )\n    )\n\nFor the user to select the bounding box on evaluation, instead of\nspecifying, ``with_bounding_box=True`` as the keyword argument; the user\ninstead specifies ``with_bounding_box=<bounding_key>`` ::\n\n    >>> model(0.5, 1.5, with_bounding_box=0)\n    0.0\n    >>> model(0.5, 1.5, with_bounding_box=1)\n    nan\n\n\nIgnoring Inputs in Bounding Boxes\n+++++++++++++++++++++++++++++++++\n\nBoth `standard bounding box <astropy.modeling.bounding_box.ModelBoundingBox>`\nand `CompoundBoundingBox <astropy.modeling.bounding_box.CompoundBoundingBox>`\nsupport ignoring specific inputs from enforcement by the bounding box. Effectively,\nfor multi-dimensional models one can define bounding boxes so that bounds are\nonly applied to a subset of the model's inputs rather than the default of enforcing\na bound of some kind on every input. Note that use of this feature is equivalent\nto defining the bounds for an input to be ``[-np.inf, np.inf]``.\n\n.. warning::\n   The ``ignored`` input feature is not available when constructing/adding bounding\n   boxes to models using tuples and the property interface. That is one cannot\n   ignore inputs when setting bounding boxes using ``model.bounding_box = (-1, 1)``.\n   This feature is only available via the methods\n   `bind_bounding_box <astropy.modeling.bind_bounding_box>` and\n   `bind_compound_bounding_box <astropy.modeling.bind_compound_bounding_box>`.\n\nIgnoring inputs for a bounding box can be achieved via passing a list of the input\nname strings to be ignored to the ``ignored`` keyword argument in any of the main\nbounding box interfaces. ::\n\n    >>> from astropy.modeling.models import Polynomial1D\n    >>> from astropy.modeling import bind_bounding_box\n    >>> model1 = Polynomial2D(3)\n    >>> bind_bounding_box(model1, {'x': (-1, 1)}, ignored=['y'])\n    >>> model1.bounding_box\n    ModelBoundingBox(\n        intervals={\n            x: Interval(lower=-1, upper=1)\n        }\n        ignored=['y']\n        model=Polynomial2D(inputs=('x', 'y'))\n        order='C'\n    )\n    >>> model1(-2, 0, with_bounding_box=True)\n    nan\n    >>> model1(0, 300, with_bounding_box=True)\n    0.0\n\nSimilarly, the ignored inputs will be applied to all of the bounding boxes\ncontained within a compound bounding box. ::\n\n    >>> from astropy.modeling import bind_compound_bounding_box\n    >>> model2 = Polynomial2D(3)\n    >>> bboxes = {\n    ...     0: {'x': (0, 1)},\n    ...     1: {'x': (1, 2)}\n    ... }\n    >>> selector_args = [('x', False)]\n    >>> bind_compound_bounding_box(model2, bboxes, selector_args, ignored=['y'], order='F')\n    >>> model2.bounding_box\n        CompoundBoundingBox(\n        bounding_boxes={\n            (0,) = ModelBoundingBox(\n                    intervals={\n                        x: Interval(lower=0, upper=1)\n                    }\n                    ignored=['y']\n                    model=Polynomial2D(inputs=('x', 'y'))\n                    order='F'\n                )\n            (1,) = ModelBoundingBox(\n                    intervals={\n                        x: Interval(lower=1, upper=2)\n                    }\n                    ignored=['y']\n                    model=Polynomial2D(inputs=('x', 'y'))\n                    order='F'\n                )\n        }\n        selector_args = SelectorArguments(\n                Argument(name='x', ignore=False)\n            )\n    )\n    >>> model2(0.5, 300, with_bounding_box=0)\n    0.0\n    >>> model2(0.5, 300, with_bounding_box=1)\n    nan\n\n\nEfficient evaluation with `Model.render() <astropy.modeling.Model.render>`\n--------------------------------------------------------------------------\n\nWhen a model is evaluated over a range much larger than the model itself, it\nmay be prudent to use the :func:`Model.render <astropy.modeling.Model.render>`\nmethod if efficiency is a concern. The :func:`render <astropy.modeling.Model.render>`\nmethod can be used to evaluate the model on an\narray of the same dimensions.  ``model.render()`` can be called with no\narguments to return a \"postage stamp\" of the bounding box region.\n\nIn this example, we generate a 300x400 pixel image of 100 2D Gaussian sources.\nFor comparison, the models are evaluated both with and without using bounding\nboxes. By using bounding boxes, the evaluation speed increases by approximately\na factor of 10 with negligible loss of information.\n\n.. plot::\n    :include-source:\n\n    import numpy as np\n    from time import time\n    from astropy.modeling import models\n    import matplotlib.pyplot as plt\n    from matplotlib.patches import Rectangle\n\n    imshape = (300, 400)\n    y, x = np.indices(imshape)\n\n    # Generate random source model list\n    np.random.seed(0)\n    nsrc = 100\n    model_params = [\n        dict(amplitude=np.random.uniform(.5, 1),\n             x_mean=np.random.uniform(0, imshape[1] - 1),\n             y_mean=np.random.uniform(0, imshape[0] - 1),\n             x_stddev=np.random.uniform(2, 6),\n             y_stddev=np.random.uniform(2, 6),\n             theta=np.random.uniform(0, 2 * np.pi))\n        for _ in range(nsrc)]\n\n    model_list = [models.Gaussian2D(**kwargs) for kwargs in model_params]\n\n    # Render models to image using bounding boxes\n    bb_image = np.zeros(imshape)\n    t_bb = time()\n    for model in model_list:\n        model.render(bb_image)\n    t_bb = time() - t_bb\n\n    # Render models to image using full evaluation\n    full_image = np.zeros(imshape)\n    t_full = time()\n    for model in model_list:\n        model.bounding_box = None\n        model.render(full_image)\n    t_full = time() - t_full\n\n    flux = full_image.sum()\n    diff = (full_image - bb_image)\n    max_err = diff.max()\n\n    # Plots\n    plt.figure(figsize=(16, 7))\n    plt.subplots_adjust(left=.05, right=.97, bottom=.03, top=.97, wspace=0.15)\n\n    # Full model image\n    plt.subplot(121)\n    plt.imshow(full_image, origin='lower')\n    plt.title(f'Full Models\\nTiming: {t_full:.2f} seconds', fontsize=16)\n    plt.xlabel('x')\n    plt.ylabel('y')\n\n    # Bounded model image with boxes overplotted\n    ax = plt.subplot(122)\n    plt.imshow(bb_image, origin='lower')\n    for model in model_list:\n        del model.bounding_box  # Reset bounding_box to its default\n        dy, dx = np.diff(model.bounding_box).flatten()\n        pos = (model.x_mean.value - dx / 2, model.y_mean.value - dy / 2)\n        r = Rectangle(pos, dx, dy, edgecolor='w', facecolor='none', alpha=.25)\n        ax.add_patch(r)\n    plt.title(f'Bounded Models\\nTiming: {t_bb:.2f} seconds', fontsize=16)\n    plt.xlabel('x')\n    plt.ylabel('y')\n\n    # Difference image\n    plt.figure(figsize=(16, 8))\n    plt.subplot(111)\n    plt.imshow(diff, vmin=-max_err, vmax=max_err)\n    plt.colorbar(format='%.1e')\n    plt.title(f'Difference Image\\nTotal Flux Err = {((flux - np.sum(bb_image)) / flux):.0e}')\n    plt.xlabel('x')\n    plt.ylabel('y')\n    plt.show()\n\n\n\n.. _separability:\n\nModel Separability\n------------------\n\nSimple models have a boolean `Model.separable <astropy.modeling.Model.separable>` property.\nIt indicates whether the outputs are independent and is essential for computing the\nseparability of compound models using the :func:`~astropy.modeling.is_separable` function.\nHaving a separable compound model means that it can be decomposed into independent models,\nwhich in turn is useful in many applications.\nFor example, it may be easier to define inverses using the independent parts of a model\nthan the entire model.\nIn other cases, tools using `Generalized World Coordinate System (GWCS)`_,\ncan be more flexible and take advantage of separable spectral and spatial transforms.\n\nIf a custom subclass of `~astropy.modeling.Model` needs to override the\ncomputation of its separability it can implement the\n``_calculate_separability_matrix`` method which should return the separability\nmatrix for that model.\n\n\n.. _modeling-model-sets:\n\nModel Sets\n==========\n\nIn some cases it is useful to describe many models of the same type but with\ndifferent sets of parameter values.  This could be done simply by instantiating\nas many instances of a `~astropy.modeling.Model` as are needed.  But that can\nbe inefficient for a large number of models.  To that end, all model classes in\n`astropy.modeling` can also be used to represent a model **set** which is a\ncollection of models of the same type, but with different values for their\nparameters.\n\nTo instantiate a model set, use argument ``n_models=N`` where ``N`` is the\nnumber of models in the set when constructing the model.  The value of each\nparameter must be a list or array of length ``N``, such that each item in\nthe array corresponds to one model in the set::\n\n    >>> from astropy.modeling import models\n    >>> g = models.Gaussian1D(amplitude=[1, 2], mean=[0, 0],\n    ...                       stddev=[0.1, 0.2], n_models=2)\n    >>> print(g)\n    Model: Gaussian1D\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Model set size: 2\n    Parameters:\n        amplitude mean stddev\n        --------- ---- ------\n              1.0  0.0    0.1\n              2.0  0.0    0.2\n\nThis is equivalent to two Gaussians with the parameters ``amplitude=1, mean=0,\nstddev=0.1`` and ``amplitude=2, mean=0, stddev=0.2`` respectively.  When\nprinting the model the parameter values are displayed as a table, with each row\ncorresponding to a single model in the set.\n\nThe number of models in a model set can be determined using the `len` builtin::\n\n    >>> len(g)\n    2\n\nSingle models have a length of 1, and are not considered a model set as such.\n\nWhen evaluating a model set, by default the input must be the same length as\nthe number of models, with one input per model::\n\n    >>> g([0, 0.1])  # doctest: +FLOAT_CMP\n    array([1.        , 1.76499381])\n\nThe result is an array with one result per model in the set.  It is also\npossible to broadcast a single input value to all models in the set::\n\n    >>> g(0)  # doctest: +FLOAT_CMP\n    array([1., 2.])\n\nOr when the input is an array::\n\n    >>> x = np.array([[0, 0, 0], [0.1, 0.1, 0.1]])\n    >>> print(x)\n    [[0.  0.  0. ]\n     [0.1 0.1 0.1]]\n    >>> g(x)\n    array([[1.        , 1.        , 1.        ],\n           [1.76499381, 1.76499381, 1.76499381]])\n\nInternally the shape of the inputs, outputs, and parameter values is controlled\nby an attribute - ``model_set_axis``. In the above case ``model_set_axis=0``::\n\n    >>> g.model_set_axis\n    0\n\nThis indicates that elements along the 0-th axis will be passed as inputs to individual models.\nSometimes it may be useful to pass inputs along a different axis, for example the 1st axis::\n\n    >>> x = np.array([[0, 0, 0], [0.1, 0.1, 0.1]]).T\n    >>> print(x)\n    [[0.  0.1]\n     [0.  0.1]\n     [0.  0.1]]\n\nBecause there are two models in this model set and we are passing three inputs\nalong the 0th axis, evaluation will fail::\n\n    >>> g(x)\n    Traceback (most recent call last):\n    ...\n    ValueError: Input argument 'x' does not have the correct dimensions in\n    model_set_axis=0 for a model set with n_models=2.\n\nThere are two ways to get around this. ``model_set_axis`` can be passed in\nwhen the model is evaluated::\n\n    >>> g(x, model_set_axis=1)\n    array([[1.        , 1.76499381],\n           [1.        , 1.76499381],\n           [1.        , 1.76499381]])\n\nOr when the model is initialized::\n\n    >>> g = models.Gaussian1D(amplitude=[[1, 2]], mean=[[0, 0]],\n    ...                       stddev=[[0.1, 0.2]], n_models=2,\n    ...                       model_set_axis=1)\n    >>> g(x)\n    array([[1.        , 1.76499381],\n           [1.        , 1.76499381],\n           [1.        , 1.76499381]])\n\nNote that in the latter case, the shape of the individual parameters has changed to 2D\nbecause now the parameters are defined along the 1st axis.\n\nThe value of ``model_set_axis`` is either an integer number, representing the axis along which\nthe different parameter sets and inputs are defined, or a boolean of value ``False``,\nin which case it indicates all model sets should use the same inputs on evaluation.\nFor example, the above model has a value of 1 for ``model_set_axis``.\nIf ``model_set_axis=False`` is passed the two models will be evaluated on the same input::\n\n    >>> g.model_set_axis\n    1\n    >>> result = g(x, model_set_axis=False)\n    >>> result\n    array([[[1.        , 0.60653066],\n            [2.        , 1.76499381]],\n    <BLANKLINE>\n           [[1.        , 0.60653066],\n            [2.        , 1.76499381]],\n    <BLANKLINE>\n           [[1.        , 0.60653066],\n            [2.        , 1.76499381]]])\n    >>> result[: , 0]\n    array([[1.        , 0.60653066],\n           [1.        , 0.60653066],\n           [1.        , 0.60653066]])\n    >>> result[: , 1]\n    array([[2.        , 1.76499381],\n           [2.        , 1.76499381],\n           [2.        , 1.76499381]])\n\nCurrently model sets are most useful for fitting a set of **linear** models\n(:ref:`example <example-fitting-model-sets>`)\nallowing a large number of models of the same type to be fitted simultaneously\n(and independently from each other) to some large set of inputs, such as\nfitting a polynomial to the time response of each pixel in a data cube.\nThis can greatly speed up the fitting process. The speed-up is due to solving\nthe set of equations to find the exact solution. Nonlinear models, which require\nan iterative algorithm, cannot be currently fit using model sets. Model sets of nonlinear\nmodels can only be evaluated.\n\nWhen fitting model sets it is important that data arrays are passed to the fitter\nin the correct shape. The shape depends on the ``model_set_axis`` attribute of the\nmodel to be fit. The rule is that the index of the dependent variable that corresponds\nto a model set should be along the ``model_set_axis`` dimension. For example, for a\n1D model set with 3 models with ``model_set_axis == 1`` the shape of ``y`` should be (x, 3)::\n\n    >>> import numpy as np\n    >>> from astropy.modeling.models import Polynomial1D\n    >>> from astropy.modeling.fitting import LinearLSQFitter\n    >>> fitter = LinearLSQFitter()\n    >>> x = np.arange(4)\n    >>> y = np.array([2*x+1, x+4, x]).T\n    >>> print(y)\n    [[1 4 0]\n     [3 5 1]\n     [5 6 2]\n     [7 7 3]]\n    >>> print(y.shape)\n    (4, 3)\n    >>> m = Polynomial1D(1, n_models=3, model_set_axis=1)\n    >>> mfit = fitter(m, x, y)\n\nFor 2D models with 3 models and ``model_set_axis = 0`` the shape of ``z`` should be (3, x, y)::\n\n    >>> import numpy as np\n    >>> from astropy.modeling.models import Polynomial2D\n    >>> from astropy.modeling.fitting import LinearLSQFitter\n    >>> fitter = LinearLSQFitter()\n    >>> x = np.arange(8).reshape(2, 4)\n    >>> y = x\n    >>> z = np.asarray([2 * x + 1, x + 4, x + 3])\n    >>> print(z.shape)\n    (3, 2, 4)\n    >>> m = Polynomial2D(1, n_models=3, model_set_axis=0)\n    >>> mfit = fitter(m, x, y, z)\n\n.. _modeling-asdf:\n\nModel Serialization (Writing a Model to a File)\n===============================================\n\nModels are serializable using the `ASDF`_\nformat. This can be useful in many contexts, one of which is the implementation of a\n`Generalized World Coordinate System (GWCS)`_.\n\nSerializing a model to disk is possible by assigning the object to ``AsdfFile.tree``:\n\n.. doctest-requires:: asdf\n\n    >>> from asdf import AsdfFile\n    >>> from astropy.modeling import models\n    >>> rotation = models.Rotation2D(angle=23.7)\n    >>> f = AsdfFile()\n    >>> f.tree['model'] = rotation\n    >>> f.write_to('rotation.asdf')\n\nTo read the file and create the model:\n\n.. doctest-requires:: asdf\n\n    >>> import asdf\n    >>> with asdf.open('rotation.asdf') as f:\n    ...     model = f.tree['model']\n    >>> print(model)\n    Model: Rotation2D\n    Inputs: ('x', 'y')\n    Outputs: ('x', 'y')\n    Model set size: 1\n    Parameters:\n        angle\n        -----\n         23.7\n\nCompound models can also be serialized. Please note that some model attributes (e.g ``meta``,\n``tied`` parameter constraints used in fitting), as well as model sets are not yet serializable.\nFor more information on serialization of models, see :ref:`asdf_dev`.\n"},{"col":0,"comment":"Helper for opening a URL while handling TLS/SSL verification issues.","endLoc":1124,"header":"def _try_url_open(source_url, timeout=None, http_headers=None, ftp_tls=False,\n                  ssl_context=None, allow_insecure=False)","id":430,"name":"_try_url_open","nodeType":"Function","startLoc":1086,"text":"def _try_url_open(source_url, timeout=None, http_headers=None, ftp_tls=False,\n                  ssl_context=None, allow_insecure=False):\n    \"\"\"Helper for opening a URL while handling TLS/SSL verification issues.\"\"\"\n\n    # Always try first with a secure connection\n    # _build_urlopener uses lru_cache, so the ssl_context argument must be\n    # converted to a hashshable type (a set of 2-tuples)\n    ssl_context = frozenset(ssl_context.items() if ssl_context else [])\n    urlopener = _build_urlopener(ftp_tls=ftp_tls, ssl_context=ssl_context,\n                                 allow_insecure=False)\n    req = urllib.request.Request(source_url, headers=http_headers)\n\n    try:\n        return urlopener.open(req, timeout=timeout)\n    except urllib.error.URLError as exc:\n        reason = exc.reason\n        if (isinstance(reason, ssl.SSLError)\n                and reason.reason == 'CERTIFICATE_VERIFY_FAILED'):\n            msg = (f'Verification of TLS/SSL certificate at {source_url} '\n                   f'failed: this can mean either the server is '\n                   f'misconfigured or your local root CA certificates are '\n                   f'out-of-date; in the latter case this can usually be '\n                   f'addressed by installing the Python package \"certifi\" '\n                   f'(see the documentation for astropy.utils.data.download_url)')\n            if not allow_insecure:\n                msg += (f' or in both cases you can work around this by '\n                        f'passing allow_insecure=True, but only if you '\n                        f'understand the implications; the original error '\n                        f'was: {reason}')\n                raise urllib.error.URLError(msg)\n            else:\n                msg += '. Re-trying with allow_insecure=True.'\n                warn(msg, AstropyWarning)\n                # Try again with a new urlopener allowing insecure connections\n                urlopener = _build_urlopener(ftp_tls=ftp_tls, ssl_context=ssl_context,\n                                             allow_insecure=True)\n                return urlopener.open(req, timeout=timeout)\n\n        raise"},{"id":431,"name":"predef_models2D.rst","nodeType":"TextFile","path":"docs/modeling","text":".. _predef_models2D:\n\n*********\n2D Models\n*********\n\nThese models take as input x and y arrays.\n\nOperations\n==========\n\nThese models perform simple mathematical operations.\n\n- :class:`~astropy.modeling.functional_models.Const2D` model returns the\n  constant replicated by the number of input x and y values.\n\nShapes\n======\n\nThese models provide shapes, often used to model general x, y, z data.\n\n- :class:`~astropy.modeling.functional_models.Planar2D` model computes\n  a tilted plan with specified x,y slopes and z intercept\n\nProfiles\n========\n\nThese models provide profiles, often used sources in images.\nAll models have parameters giving the x,y location of the center and\nan amplitude.\n\n- :class:`~astropy.modeling.functional_models.AiryDisk2D` model computes\n  the Airy function for a radius\n\n- :class:`~astropy.modeling.functional_models.Box2D` model computes a box\n  with x,y dimensions\n\n- :class:`~astropy.modeling.functional_models.Disk2D` model computes a\n  disk a radius\n\n- :class:`~astropy.modeling.functional_models.Ellipse2D` model computes\n  an ellipse with major and minor axis and rotation angle\n\n- :class:`~astropy.modeling.functional_models.Gaussian2D` model computes\n  a Gaussian with x,y standard deviations and rotation angle\n\n- :class:`~astropy.modeling.functional_models.Moffat2D` model computes\n  a Moffat with x,y dimensions and alpha (power index) and gamma (core width)\n\n- :class:`~astropy.modeling.functional_models.RickerWavelet2D` model computes\n  a symmetric RickerWavelet function with the specified sigma\n\n- :class:`~astropy.modeling.functional_models.Sersic2D` model computes\n  a Sersic profile with an effective half-light radius, rotation, and\n  Sersic index\n\n- :class:`~astropy.modeling.functional_models.TrapezoidDisk2D` model\n  computes a disk with a radius and slope\n\n- :class:`~astropy.modeling.functional_models.Ring2D` model computes\n  a ring with inner and outer radii\n\n.. plot::\n\n    import numpy as np\n    import math\n    import matplotlib.pyplot as plt\n    from matplotlib.colors import LogNorm\n\n    from astropy.modeling.models import (AiryDisk2D, Box2D, Disk2D, Ellipse2D,\n                                         Gaussian2D, Moffat2D, RickerWavelet2D,\n                                         Sersic2D, TrapezoidDisk2D, Ring2D)\n\n    x = np.linspace(-4.0, 6.0, num=100)\n    r = np.logspace(-1.0, 2.0, num=100)\n\n    fig, sax = plt.subplots(nrows=4, ncols=3, figsize=(9, 12))\n    ax = sax.flatten()\n\n    # setup the x,y coordinates\n    x_npts = 100\n    y_npts = x_npts\n    x0, x1 = -4, 6\n    y0, y1 = -3, 7\n    x = np.linspace(x0, x1, num=x_npts)\n    y = np.linspace(y0, y1, num=y_npts)\n    X, Y = np.meshgrid(x, y)\n\n    # plot the different 2D profiles\n    mods = [AiryDisk2D(amplitude=10.0, x_0=1.0, y_0=2.0, radius=1.0),\n            Box2D(amplitude=10.0, x_0=1.0, y_0=2.0, x_width=1.0, y_width=2.0),\n            Disk2D(amplitude=10.0, x_0=1.0, y_0=2.0, R_0=1.0),\n            Ellipse2D(amplitude=10.0, x_0=1.0, y_0=2.0, a=1.0, b=2.0, theta=math.pi/4.),\n            Gaussian2D(amplitude=10.0, x_mean=1.0, y_mean=2.0, x_stddev=1.0, y_stddev=2.0, theta=math.pi/4.),\n            Moffat2D(amplitude=10.0, x_0=1.0, y_0=2.0, alpha=3, gamma=4),\n            RickerWavelet2D(amplitude=10.0, x_0=1.0, y_0=2.0, sigma=1.0),\n            Sersic2D(amplitude=10.0, x_0=1.0, y_0=2.0, r_eff=1.0, ellip=0.5, theta=math.pi/4.),\n            TrapezoidDisk2D(amplitude=10.0, x_0=1.0, y_0=2.0, R_0=1.0, slope=5.0),\n            Ring2D(amplitude=10.0, x_0=1.0, y_0=2.0, r_in=1.0, r_out=2.0)]\n\n    for k, mod in enumerate(mods):\n        cname = mod.__class__.__name__\n        ax[k].set_title(cname)\n        if cname == \"AiryDisk2D\":\n            normfunc = LogNorm(vmin=0.001, vmax=10.)\n        elif cname in [\"Gaussian2D\", \"Sersic2D\"]:\n            normfunc = LogNorm(vmin=0.1, vmax=10.)\n        else:\n            normfunc = None\n        ax[k].imshow(mod(X, Y), extent=[x0, x1, y0, y1], origin=\"lower\", cmap=plt.cm.gray_r,\n                     norm=normfunc)\n\n    for k in range(len(mods)):\n        ax[k].set_xlabel(\"x\")\n        ax[k].set_ylabel(\"y\")\n\n    # remove axis for any plots not used\n    for k in range(len(mods), len(ax)):\n        ax[k].axis(\"off\")\n\n    plt.tight_layout()\n    plt.show()\n"},{"col":0,"comment":"\n    Helper for building a `urllib.request.build_opener` which handles TLS/SSL.\n    ","endLoc":1083,"header":"@functools.lru_cache()\ndef _build_urlopener(ftp_tls=False, ssl_context=None, allow_insecure=False)","id":432,"name":"_build_urlopener","nodeType":"Function","startLoc":1045,"text":"@functools.lru_cache()\ndef _build_urlopener(ftp_tls=False, ssl_context=None, allow_insecure=False):\n    \"\"\"\n    Helper for building a `urllib.request.build_opener` which handles TLS/SSL.\n    \"\"\"\n\n    ssl_context = dict(it for it in ssl_context) if ssl_context else {}\n    cert_chain = {}\n    if 'certfile' in ssl_context:\n        cert_chain.update({\n            'certfile': ssl_context.pop('certfile'),\n            'keyfile': ssl_context.pop('keyfile', None),\n            'password': ssl_context.pop('password', None)\n        })\n    elif 'password' in ssl_context or 'keyfile' in ssl_context:\n        raise ValueError(\n            \"passing 'keyfile' or 'password' in the ssl_context argument \"\n            \"requires passing 'certfile' as well\")\n\n    if 'cafile' not in ssl_context and certifi is not None:\n        ssl_context['cafile'] = certifi.where()\n\n    ssl_context = ssl.create_default_context(**ssl_context)\n\n    if allow_insecure:\n        ssl_context.check_hostname = False\n        ssl_context.verify_mode = ssl.CERT_NONE\n\n    if cert_chain:\n        ssl_context.load_cert_chain(**cert_chain)\n\n    https_handler = urllib.request.HTTPSHandler(context=ssl_context)\n\n    if ftp_tls:\n        urlopener = urllib.request.build_opener(_FTPTLSHandler(), https_handler)\n    else:\n        urlopener = urllib.request.build_opener(https_handler)\n\n    return urlopener"},{"col":4,"comment":"null","endLoc":200,"header":"def __init__(self, keyword=None, value=None, comment=None, **kwargs)","id":433,"name":"__init__","nodeType":"Function","startLoc":157,"text":"def __init__(self, keyword=None, value=None, comment=None, **kwargs):\n        # For backwards compatibility, support the 'key' keyword argument:\n        if keyword is None and 'key' in kwargs:\n            keyword = kwargs['key']\n\n        self._keyword = None\n        self._value = None\n        self._comment = None\n        self._valuestring = None\n        self._image = None\n\n        # This attribute is set to False when creating the card from a card\n        # image to ensure that the contents of the image get verified at some\n        # point\n        self._verified = True\n\n        # A flag to conveniently mark whether or not this was a valid HIERARCH\n        # card\n        self._hierarch = False\n\n        # If the card could not be parsed according the the FITS standard or\n        # any recognized non-standard conventions, this will be True\n        self._invalid = False\n\n        self._field_specifier = None\n\n        # These are used primarily only by RVKCs\n        self._rawkeyword = None\n        self._rawvalue = None\n\n        if not (keyword is not None and value is not None and\n                self._check_if_rvkc(keyword, value)):\n            # If _check_if_rvkc passes, it will handle setting the keyword and\n            # value\n            if keyword is not None:\n                self.keyword = keyword\n            if value is not None:\n                self.value = value\n\n        if comment is not None:\n            self.comment = comment\n\n        self._modified = False\n        self._valuemodified = False"},{"id":434,"name":"docs/whatsnew","nodeType":"Package"},{"id":435,"name":"1.2.rst","nodeType":"TextFile","path":"docs/whatsnew","text":":orphan:\n\n`What's New in Astropy 1.2? <https://docs.astropy.org/en/v1.2/whatsnew/1.2.html>`__\n"},{"id":437,"name":"2.0.rst","nodeType":"TextFile","path":"docs/whatsnew","text":":orphan:\n\n`What's New in Astropy 2.0? <https://docs.astropy.org/en/v2.0/whatsnew/2.0.html>`__\n"},{"id":438,"name":"4.1.rst","nodeType":"TextFile","path":"docs/whatsnew","text":":orphan:\n\n`What's New in Astropy 4.1?\n<https://docs.astropy.org/en/v4.1/whatsnew/4.1.html>`__\n"},{"col":27,"endLoc":2331,"id":439,"nodeType":"Lambda","startLoc":2331,"text":"lambda x: (-x[1], getattr(x[0], 'name', ''))"},{"id":440,"name":"4.0.rst","nodeType":"TextFile","path":"docs/whatsnew","text":":orphan:\n\n`What's New in Astropy 4.0?\n<https://docs.astropy.org/en/v4.0.x/whatsnew/4.0.html>`__\n"},{"id":441,"name":"1.3.rst","nodeType":"TextFile","path":"docs/whatsnew","text":":orphan:\n\n`What's New in Astropy 1.3? <https://docs.astropy.org/en/v1.3/whatsnew/1.3.html>`__\n"},{"id":442,"name":"3.2.rst","nodeType":"TextFile","path":"docs/whatsnew","text":":orphan:\n\n`What's New in Astropy 3.2? <https://docs.astropy.org/en/v3.2/whatsnew/3.2.html>`__\n"},{"id":443,"name":"4.2.rst","nodeType":"TextFile","path":"docs/whatsnew","text":":orphan:\n\n`What's New in Astropy 4.2?\n<https://docs.astropy.org/en/v4.2/whatsnew/4.2.html>`__\n"},{"id":444,"name":"0.3.rst","nodeType":"TextFile","path":"docs/whatsnew","text":":orphan:\n\n`What's New in Astropy 0.3? <https://docs.astropy.org/en/v0.3/whatsnew/0.3.html>`__\n"},{"id":445,"name":"1.0.rst","nodeType":"TextFile","path":"docs/whatsnew","text":":orphan:\n\n`What's New in Astropy 1.0? <https://docs.astropy.org/en/v1.0/whatsnew/1.0.html>`__\n"},{"id":446,"name":"3.0.rst","nodeType":"TextFile","path":"docs/whatsnew","text":":orphan:\n\n`What's New in Astropy 3.0? <https://docs.astropy.org/en/v3.0/whatsnew/3.0.html>`__\n"},{"id":447,"name":"5.1.rst","nodeType":"TextFile","path":"docs/whatsnew","text":".. _whatsnew-5.1:\n\n**************************\nWhat's New in Astropy 5.1?\n**************************\n\nOverview\n========\n\nAstropy 5.1 is a major release that adds significant new functionality since\nthe 5.0 LTS release.\n\nIn particular, this release includes:\n\n* :ref:`whatsnew-5.1-cosmology`\n* :ref:`whatsnew-doppler-redshift-eq`\n\n.. _whatsnew-5.1-cosmology:\n\nUpdates to ``Cosmology``\n========================\n\n:class:`~astropy.cosmology.Cosmology` is now an abstract base class,\nand subclasses must override the abstract property ``is_flat``.\nFor :class:`~astropy.cosmology.FLRW`, ``is_flat`` checks that ``Ok0=0`` and\n``Otot0=1``.\n\nAstropy v5.0 introduced Cosmological equivalency -- with method\n:meth:`~astropy.cosmology.Cosmology.is_equivalent` -- where two cosmologies may\nbe equivalent even if not of the same class. For example, an instance of\n:class:`~astropy.cosmology.LambdaCDM` might have :math:`\\Omega_0=1` and\n:math:`\\Omega_k=0` and therefore be flat, like ``FlatLambdaCDM``.\nNow the keyword argument ``format`` is added to extend the notion of\nequivalence to any Python object that can be converted to a Cosmology.\n\n    >>> from astropy.cosmology import Planck18\n    >>> tbl = Planck18.to_format(\"astropy.table\")\n    >>> Planck18.is_equivalent(tbl, format=True)\n    True\n\nThe list of valid formats, e.g. the Table in this example, may be\nchecked with ``Cosmology.from_format.list_formats()``\n\n\n.. _whatsnew-doppler-redshift-eq:\n\n``doppler_redshift`` equivalency\n================================\n\nNew :func:`astropy.units.equivalencies.doppler_redshift` is added to\nprovide conversion between Doppler redshift and radial velocity.\n\nFull change log\n===============\n\nTo see a detailed list of all changes in version v5.1, including changes in\nAPI, please see the :ref:`changelog`.\n\nRenamed/removed functionality\n=============================\n"},{"col":4,"comment":"\n        Creates an HDU header from a byte string containing the entire header\n        data.\n\n        Parameters\n        ----------\n        data : str or bytes\n           String or bytes containing the entire header.  In the case of bytes\n           they will be decoded using latin-1 (only plain ASCII characters are\n           allowed in FITS headers but latin-1 allows us to retain any invalid\n           bytes that might appear in malformatted FITS files).\n\n        sep : str, optional\n            The string separating cards from each other, such as a newline.  By\n            default there is no card separator (as is the case in a raw FITS\n            file).  In general this is only used in cases where a header was\n            printed as text (e.g. with newlines after each card) and you want\n            to create a new `Header` from it by copy/pasting.\n\n        Examples\n        --------\n\n        >>> from astropy.io.fits import Header\n        >>> hdr = Header({'SIMPLE': True})\n        >>> Header.fromstring(hdr.tostring()) == hdr\n        True\n\n        If you want to create a `Header` from printed text it's not necessary\n        to have the exact binary structure as it would appear in a FITS file,\n        with the full 80 byte card length.  Rather, each \"card\" can end in a\n        newline and does not have to be padded out to a full card length as\n        long as it \"looks like\" a FITS header:\n\n        >>> hdr = Header.fromstring(\"\"\"\\\n        ... SIMPLE  =                    T / conforms to FITS standard\n        ... BITPIX  =                    8 / array data type\n        ... NAXIS   =                    0 / number of array dimensions\n        ... EXTEND  =                    T\n        ... \"\"\", sep='\\n')\n        >>> hdr['SIMPLE']\n        True\n        >>> hdr['BITPIX']\n        8\n        >>> len(hdr)\n        4\n\n        Returns\n        -------\n        `Header`\n            A new `Header` instance.\n        ","endLoc":457,"header":"@classmethod\n    def fromstring(cls, data, sep='')","id":448,"name":"fromstring","nodeType":"Function","startLoc":340,"text":"@classmethod\n    def fromstring(cls, data, sep=''):\n        \"\"\"\n        Creates an HDU header from a byte string containing the entire header\n        data.\n\n        Parameters\n        ----------\n        data : str or bytes\n           String or bytes containing the entire header.  In the case of bytes\n           they will be decoded using latin-1 (only plain ASCII characters are\n           allowed in FITS headers but latin-1 allows us to retain any invalid\n           bytes that might appear in malformatted FITS files).\n\n        sep : str, optional\n            The string separating cards from each other, such as a newline.  By\n            default there is no card separator (as is the case in a raw FITS\n            file).  In general this is only used in cases where a header was\n            printed as text (e.g. with newlines after each card) and you want\n            to create a new `Header` from it by copy/pasting.\n\n        Examples\n        --------\n\n        >>> from astropy.io.fits import Header\n        >>> hdr = Header({'SIMPLE': True})\n        >>> Header.fromstring(hdr.tostring()) == hdr\n        True\n\n        If you want to create a `Header` from printed text it's not necessary\n        to have the exact binary structure as it would appear in a FITS file,\n        with the full 80 byte card length.  Rather, each \"card\" can end in a\n        newline and does not have to be padded out to a full card length as\n        long as it \"looks like\" a FITS header:\n\n        >>> hdr = Header.fromstring(\\\"\\\"\\\"\\\\\n        ... SIMPLE  =                    T / conforms to FITS standard\n        ... BITPIX  =                    8 / array data type\n        ... NAXIS   =                    0 / number of array dimensions\n        ... EXTEND  =                    T\n        ... \\\"\\\"\\\", sep='\\\\n')\n        >>> hdr['SIMPLE']\n        True\n        >>> hdr['BITPIX']\n        8\n        >>> len(hdr)\n        4\n\n        Returns\n        -------\n        `Header`\n            A new `Header` instance.\n        \"\"\"\n\n        cards = []\n\n        # If the card separator contains characters that may validly appear in\n        # a card, the only way to unambiguously distinguish between cards is to\n        # require that they be Card.length long.  However, if the separator\n        # contains non-valid characters (namely \\n) the cards may be split\n        # immediately at the separator\n        require_full_cardlength = set(sep).issubset(VALID_HEADER_CHARS)\n\n        if isinstance(data, bytes):\n            # FITS supports only ASCII, but decode as latin1 and just take all\n            # bytes for now; if it results in mojibake due to e.g. UTF-8\n            # encoded data in a FITS header that's OK because it shouldn't be\n            # there in the first place--accepting it here still gives us the\n            # opportunity to display warnings later during validation\n            CONTINUE = b'CONTINUE'\n            END = b'END'\n            end_card = END_CARD.encode('ascii')\n            sep = sep.encode('latin1')\n            empty = b''\n        else:\n            CONTINUE = 'CONTINUE'\n            END = 'END'\n            end_card = END_CARD\n            empty = ''\n\n        # Split the header into individual cards\n        idx = 0\n        image = []\n\n        while idx < len(data):\n            if require_full_cardlength:\n                end_idx = idx + Card.length\n            else:\n                try:\n                    end_idx = data.index(sep, idx)\n                except ValueError:\n                    end_idx = len(data)\n\n            next_image = data[idx:end_idx]\n            idx = end_idx + len(sep)\n\n            if image:\n                if next_image[:8] == CONTINUE:\n                    image.append(next_image)\n                    continue\n                cards.append(Card.fromstring(empty.join(image)))\n\n            if require_full_cardlength:\n                if next_image == end_card:\n                    image = []\n                    break\n            else:\n                if next_image.split(sep)[0].rstrip() == END:\n                    image = []\n                    break\n\n            image = [next_image]\n\n        # Add the last image that was found before the end, if any\n        if image:\n            cards.append(Card.fromstring(empty.join(image)))\n\n        return cls._fromcards(cards)"},{"id":449,"name":"3.1.rst","nodeType":"TextFile","path":"docs/whatsnew","text":":orphan:\n\n`What's New in Astropy 3.1? <https://docs.astropy.org/en/v3.1.2/whatsnew/3.1.html>`__\n"},{"id":450,"name":"0.2.rst","nodeType":"TextFile","path":"docs/whatsnew","text":":orphan:\n\n`What's New in Astropy 0.2? <https://docs.astropy.org/en/v0.2/whatsnew/0.2.html>`__\n"},{"id":451,"name":"4.3.rst","nodeType":"TextFile","path":"docs/whatsnew","text":":orphan:\n\n`What's New in Astropy 4.3?\n<https://docs.astropy.org/en/v4.3post1/whatsnew/4.3.html>`__\n"},{"id":452,"name":"index.rst","nodeType":"TextFile","path":"docs/whatsnew","text":"*********************\nMajor Release History\n*********************\n\nExamples in these documents are frozen in time to respect the status of the\nAPI at the time of the release they are describing. Please refer to the\nmain, up-to-date documentation if you run into any issues with the\nfunctionality highlighted in these pages.\n\n\n.. toctree::\n   :maxdepth: 1\n\n   5.1\n\n* `What's New in Astropy 5.0? <https://docs.astropy.org/en/v5.0/whatsnew/5.0.html>`__\n* `What's New in Astropy 4.3? <https://docs.astropy.org/en/v4.3post1/whatsnew/4.3.html>`__\n* `What's New in Astropy 4.2? <https://docs.astropy.org/en/v4.2/whatsnew/4.2.html>`__\n* `What's New in Astropy 4.1? <https://docs.astropy.org/en/v4.1/whatsnew/4.1.html>`__\n* `What's New in Astropy 4.0? <https://docs.astropy.org/en/v4.0/whatsnew/4.0.html>`__\n* `What's New in Astropy 3.2? <https://docs.astropy.org/en/v3.2/whatsnew/3.2.html>`__\n* `What's New in Astropy 3.1? <https://docs.astropy.org/en/v3.1.2/whatsnew/3.1.html>`__\n* `What's New in Astropy 3.0? <https://docs.astropy.org/en/v3.0/whatsnew/3.0.html>`__\n* `What's New in Astropy 2.0? <https://docs.astropy.org/en/v2.0/whatsnew/2.0.html>`__\n* `What's New in Astropy 1.3? <https://docs.astropy.org/en/v1.3/whatsnew/1.3.html>`__\n* `What's New in Astropy 1.2? <https://docs.astropy.org/en/v1.2/whatsnew/1.2.html>`__\n* `What's New in Astropy 1.1? <https://docs.astropy.org/en/v1.1/whatsnew/1.1.html>`__\n* `What's New in Astropy 1.0? <https://docs.astropy.org/en/v1.0/whatsnew/1.0.html>`__\n* `What's New in Astropy 0.4? <https://docs.astropy.org/en/v0.4/whatsnew/0.4.html>`__\n* `What's New in Astropy 0.3? <https://docs.astropy.org/en/v0.3/whatsnew/0.3.html>`__\n* `What's New in Astropy 0.2? <https://docs.astropy.org/en/v0.2/whatsnew/0.2.html>`__\n* `What's New in Astropy 0.1? <https://docs.astropy.org/en/v0.2/whatsnew/0.1.html>`__\n"},{"id":453,"name":"5.0.rst","nodeType":"TextFile","path":"docs/whatsnew","text":":orphan:\n\n  `What's New in Astropy 5.0?\n  <https://docs.astropy.org/en/v5.0/whatsnew/5.0.html>`__\n"},{"id":454,"name":"1.1.rst","nodeType":"TextFile","path":"docs/whatsnew","text":":orphan:\n\n`What's New in Astropy 1.1? <https://docs.astropy.org/en/v1.1/whatsnew/1.1.html>`__\n"},{"id":455,"name":"0.1.rst","nodeType":"TextFile","path":"docs/whatsnew","text":":orphan:\n\n`What's New in Astropy 0.1? <https://docs.astropy.org/en/v0.2/whatsnew/0.1.html>`__\n"},{"id":456,"name":"0.4.rst","nodeType":"TextFile","path":"docs/whatsnew","text":":orphan:\n\n`What's New in Astropy 0.4? <https://docs.astropy.org/en/v0.4/whatsnew/0.4.html>`__\n"},{"id":457,"name":"docs/constants","nodeType":"Package"},{"id":458,"name":"index.rst","nodeType":"TextFile","path":"docs/constants","text":".. _astropy-constants:\n\n*******************************\nConstants (`astropy.constants`)\n*******************************\n\n.. currentmodule:: astropy.constants\n\nIntroduction\n============\n\n`astropy.constants` contains a number of physical constants useful in\nAstronomy. A `~astropy.constants.Constant` is a |Quantity| object with\nadditional metadata describing its provenance and uncertainty.\n\nGetting Started\n===============\n\nYou can import a :class:`~astropy.constants.Constant` directly from the\n:mod:`astropy.constants` sub-package::\n\n    >>> from astropy.constants import G\n    >>> print(G)\n      Name   = Gravitational constant\n      Value  = 6.6743e-11\n      Uncertainty  = 1.5e-15\n      Unit  = m3 / (kg s2)\n      Reference = CODATA 2018\n\nOr, if you want to avoid having to explicitly import all of the constants you\nneed, you can do::\n\n    >>> from astropy import constants as const\n    >>> print(const.G)\n      Name   = Gravitational constant\n      ...\n\nConstants can be used in :ref:`quantity_arithmetic` operations and\n:ref:`quantity_and_numpy` just like any other |Quantity|::\n\n    >>> from astropy import units as u\n    >>> F = (const.G * 3. * const.M_sun * 100 * u.kg) / (2.2 * u.au) ** 2\n    >>> print(F.to(u.N))  # doctest: +FLOAT_CMP\n    0.3675671602160826 N\n\nUnit Conversion\n===============\n\n..\n  EXAMPLE START\n  Converting Constants to Different Units\n\nExplicitly :ref:`quantity_unit_conversion` is often not necessary, but can be\ndone if needed::\n\n    >>> print(const.c)\n      Name   = Speed of light in vacuum\n      Value  = 299792458.0\n      Uncertainty  = 0.0\n      Unit  = m / s\n      Reference = CODATA 2018\n\n    >>> print(const.c.to('km/s'))\n    299792.458 km / s\n\n    >>> print(const.c.to('pc/yr'))  # doctest: +FLOAT_CMP\n    0.306601393788 pc / yr\n\nIt is possible to convert most constants to `Centimeter-Gram-Second (CGS)\n<https://en.wikipedia.org/wiki/Centimetre-gram-second_system_of_units>`_ units\nusing, for example::\n\n    >>> const.c.cgs  # doctest: +FLOAT_CMP\n    <Quantity   2.99792458e+10 cm / s>\n\nHowever, some constants are defined with `different physical dimensions in CGS\n<https://en.wikipedia.org/wiki/Centimetre-gram-second_system_of_units#Alternative_derivations_of_CGS_units_in_electromagnetism>`_\nand cannot be directly converted. Because of this ambiguity, such constants\ncannot be used in expressions without specifying a system::\n\n    >>> 100 * const.e\n    Traceback (most recent call last):\n        ...\n    TypeError: Constant u'e' does not have physically compatible units\n    across all systems of units and cannot be combined with other\n    values without specifying a system (eg. e.emu)\n    >>> 100 * const.e.esu  # doctest: +FLOAT_CMP\n    <Quantity 4.8032045057134676e-08 Fr>\n\n..\n  EXAMPLE END\n\n.. _astropy-constants-prior:\n\nCollections of Constants (and Prior Versions)\n=============================================\n\nConstants are organized into version modules. The constants for\n``astropy`` 2.0 can be accessed in the ``astropyconst20`` module.\nFor example::\n\n    >>> from astropy.constants import astropyconst20 as const\n    >>> print(const.e)\n      Name   = Electron charge\n      Value  = 1.6021766208e-19\n      Uncertainty  = 9.8e-28\n      Unit  = C\n      Reference = CODATA 2014\n\nThe version modules contain physical and astronomical constants, and both sets\ncan also be chosen independently from each other. Physical `CODATA constants\n<https://physics.nist.gov/cuu/Constants/index.html>`_ are in modules with names\nlike ``codata2010``, ``codata2014``, or ``codata2018``::\n\n    >>> from astropy.constants import codata2014 as const\n    >>> print(const.h)\n      Name   = Planck constant\n      Value  = 6.62607004e-34\n      Uncertainty  = 8.1e-42\n      Unit  = J s\n      Reference = CODATA 2014\n\nAstronomical constants defined (primarily) by the International Astronomical\nUnion (IAU) are collected in modules with names like ``iau2012`` or ``iau2015``::\n\n    >>> from astropy.constants import iau2012 as const\n    >>> print(const.L_sun)\n      Name   = Solar luminosity\n      Value  = 3.846e+26\n      Uncertainty  = 5e+22\n      Unit  = W\n      Reference = Allen's Astrophysical Quantities 4th Ed.\n\n    >>> from astropy.constants import iau2015 as const\n    >>> print(const.L_sun)\n      Name   = Nominal solar luminosity\n      Value  = 3.828e+26\n      Uncertainty  = 0.0\n      Unit  = W\n      Reference = IAU 2015 Resolution B 3\n\nHowever, importing these prior version modules directly will lead to\ninconsistencies with other subpackages that have already imported\n`astropy.constants`. Notably, `astropy.units` will have already used\nthe default version of constants. When using prior versions of the constants\nin this manner, quantities should be constructed with constants instead of units.\n\nTo ensure consistent use of a prior version of constants in other ``astropy``\npackages (such as :mod:`astropy.units`) that import :mod:`astropy.constants`,\nthe physical and astronomical constants versions should be set via\n:class:`~astropy.utils.state.ScienceState` classes. These must be set before\nthe first import of either :mod:`astropy.constants` or :mod:`astropy.units`.\nFor example, you can use the CODATA2010 physical constants together with the\nIAU 2012 astronomical constants::\n\n    >>> from astropy import physical_constants, astronomical_constants\n    >>> physical_constants.set('codata2010')  # doctest: +SKIP\n    <ScienceState physical_constants: 'codata2010'>\n    >>> physical_constants.get()  # doctest: +SKIP\n    'codata2010'\n    >>> astronomical_constants.set('iau2012')  # doctest: +SKIP\n    <ScienceState astronomical_constants: 'iau2012'>\n    >>> astronomical_constants.get()  # doctest: +SKIP\n    'iau2012'\n\nThen all other packages that import `astropy.constants` will self-consistently\ninitialize with these prior versions of constants.\n\nThe versions may also be set using values referring to the version modules::\n\n    >>> from astropy import physical_constants, astronomical_constants\n    >>> physical_constants.set('astropyconst13')  # doctest: +SKIP\n    <ScienceState physical_constants: 'codata2010'>\n    >>> physical_constants.get()  # doctest: +SKIP\n    'codata2010'\n    >>> astronomical_constants.set('astropyconst13')  # doctest: +SKIP\n    <ScienceState astronomical_constants: 'iau2012'>\n    >>> astronomical_constants.get()  # doctest: +SKIP\n    'iau2012'\n\n.. The doctest should not be skipped, ideally. See https://github.com/astropy/astropy/issues/8781\n\nIf :mod:`astropy.constants` or :mod:`astropy.units` have already been imported,\na :class:`RuntimeError` will be raised::\n\n    >>> import astropy.units\n    >>> from astropy import physical_constants, astronomical_constants\n    >>> astronomical_constants.set('astropyconst13')\n    Traceback (most recent call last):\n        ...\n    RuntimeError: astropy.units is already imported\n\n.. note that if this section gets too long, it should be moved to a separate\n   doc page - see the top of performance.inc.rst for the instructions on how to\n   do that\n.. include:: performance.inc.rst\n\nReference/API\n=============\n\n.. automodapi:: astropy.constants\n"},{"id":459,"name":"performance.inc.rst","nodeType":"TextFile","path":"docs/constants","text":".. note that if this is changed from the default approach of using an *include*\n   (in index.rst) to a separate performance page, the header needs to be changed\n   from === to ***, the filename extension needs to be changed from .inc.rst to\n   .rst, and a link needs to be added in the sub-package toctree\n\n.. _astropy-constants-performance:\n\n.. Performance Tips\n.. ================\n..\n.. Here we provide some tips and tricks for how to optimize performance of code\n.. using `astropy.constants`.\n"},{"col":4,"comment":"\n        Construct a `Card` object from a (raw) string. It will pad the string\n        if it is not the length of a card image (80 columns).  If the card\n        image is longer than 80 columns, assume it contains ``CONTINUE``\n        card(s).\n        ","endLoc":548,"header":"@classmethod\n    def fromstring(cls, image)","id":460,"name":"fromstring","nodeType":"Function","startLoc":529,"text":"@classmethod\n    def fromstring(cls, image):\n        \"\"\"\n        Construct a `Card` object from a (raw) string. It will pad the string\n        if it is not the length of a card image (80 columns).  If the card\n        image is longer than 80 columns, assume it contains ``CONTINUE``\n        card(s).\n        \"\"\"\n\n        card = cls()\n        if isinstance(image, bytes):\n            # FITS supports only ASCII, but decode as latin1 and just take all\n            # bytes for now; if it results in mojibake due to e.g. UTF-8\n            # encoded data in a FITS header that's OK because it shouldn't be\n            # there in the first place\n            image = image.decode('latin1')\n\n        card._image = _pad(image)\n        card._verified = False\n        return card"},{"col":0,"comment":"\n    Determines if a given directory has enough space to hold a file of\n    a given size.\n\n    Parameters\n    ----------\n    path : str\n        The path to a directory.\n\n    size : int or `~astropy.units.Quantity`\n        A proposed filesize. If not a Quantity, assume it is in bytes.\n\n    Raises\n    ------\n    OSError\n        There is not enough room on the filesystem.\n    ","endLoc":1025,"header":"def check_free_space_in_dir(path, size)","id":461,"name":"check_free_space_in_dir","nodeType":"Function","startLoc":1002,"text":"def check_free_space_in_dir(path, size):\n    \"\"\"\n    Determines if a given directory has enough space to hold a file of\n    a given size.\n\n    Parameters\n    ----------\n    path : str\n        The path to a directory.\n\n    size : int or `~astropy.units.Quantity`\n        A proposed filesize. If not a Quantity, assume it is in bytes.\n\n    Raises\n    ------\n    OSError\n        There is not enough room on the filesystem.\n    \"\"\"\n    space = get_free_space_in_dir(path, unit=getattr(size, 'unit', False))\n    if space < size:\n        from astropy.utils.console import human_file_size\n        raise OSError(f\"Not enough free space in {path} \"\n                      f\"to download a {human_file_size(size)} file, \"\n                      f\"only {human_file_size(space)} left\")"},{"id":462,"name":"docs/cosmology","nodeType":"Package"},{"id":463,"name":"dev.rst","nodeType":"TextFile","path":"docs/cosmology","text":".. _astropy-cosmology-for-developers:\n\nCosmology For Developers\n************************\n\nCosmologies in Functions\n========================\n\nIt is often useful to assume a default cosmology so that the exact cosmology\ndoes not have to be specified every time a function or method is called. In\nthis case, it is possible to specify a \"default\" cosmology.\n\nYou can set the default cosmology to a predefined value by using the\n\"default_cosmology\" option in the ``[cosmology.core]`` section of the\nconfiguration file (see :ref:`astropy_config`). Alternatively, you can use the\n:meth:`~astropy.cosmology.default_cosmology.set` function of\n|default_cosmology| to set a cosmology for the current Python session. If you\nhave not set a default cosmology using one of the methods described above, then\nthe cosmology module will default to using the\n``default_cosmology._value`` parameters.\n\nYou can override the default cosmology through the |default_cosmology| science\nstate object, using something like the following:\n\n.. code-block:: python\n\n    from astropy.cosmology import default_cosmology\n\n    def myfunc(..., cosmo=None):\n        if cosmo is None:\n            cosmo = default_cosmology.get()\n\n        ... function code here ...\n\nThis ensures that all code consistently uses the default cosmology unless\nexplicitly overridden.\n\n.. note::\n\n    If you are preparing a paper and thus need to ensure your code provides\n    reproducible results, it is better to use an explicit cosmology (for\n    example ``WMAP9.H(0)`` instead of ``default_cosmology.get().H(0)``).\n    Use of the default cosmology should generally be reserved for code that\n    allows for the global cosmology state to be changed; e.g. code included in\n    ``astropy`` core or an affiliated package.\n\n\n.. _astropy-cosmology-custom:\n\nCustom Cosmologies\n==================\n\nIn :mod:`astropy.cosmology` cosmologies are classes, so custom cosmologies may\nbe implemented by subclassing |Cosmology| (or more likely |FLRW|) and adding\ndetails specific to that cosmology. Here we will review some of those details\nand tips and tricks to building a performant cosmology class.\n\n.. code-block:: python\n\n    from astropy.cosmology import FLRW\n\n    class CustomCosmology(FLRW):\n        ...  # [details discussed below]\n\n\n.. _astropy-cosmology-custom-parameters:\n\nParameters\n----------\n\n.. |Parameter| replace:: :class:`~astropy.cosmology.Parameter`\n\nAn astropy |Cosmology| is characterized by 1) its class, which encodes the\nphysics, and 2) its free parameter(s), which specify a cosmological realization.\nWhen defining the former, all parameters must be declared using |Parameter| and\nshould have values assigned at instantiation.\n\nA |Parameter| is a `descriptor <https://docs.python.org/3/howto/descriptor.html>`_.\nWhen accessed from a class it transparently stores information, like the units\nand accepted equivalencies, that might be opaquely contained in the constructor\nsignature or more deeply in the code. On a cosmology instance, the descriptor\nwill return the parameter value.\n\nThere are a number of best practices. For a reference, this is excerpted from\nthe definition of |FLRW|.\n\n.. code-block:: python\n\n    class FLRW(Cosmology):\n\n        H0 = Parameter(doc=\"Hubble constant as an `~astropy.units.Quantity` at z=0\",\n                       unit=\"km/(s Mpc)\", fvalidate=\"scalar\")\n        Om0 = Parameter(doc=\"Omega matter; matter density/critical density at z=0\",\n                        fvalidate=\"non-negative\")\n        Ode0 = Parameter(doc=\"Omega dark energy; dark energy density/critical density at z=0.\",\n                         fvalidate=\"float\")\n        Tcmb0 = Parameter(doc=\"Temperature of the CMB as `~astropy.units.Quantity` at z=0.\",\n                  unit=\"Kelvin\", fmt=\"0.4g\", fvalidate=\"scalar\")\n        Neff = Parameter(doc=\"Number of effective neutrino species.\", fvalidate=\"non-negative\")\n        m_nu = Parameter(doc=\"Mass of neutrino species.\",\n                 unit=\"eV\", equivalencies=u.mass_energy(), fmt=\"\")\n        Ob0 = Parameter(doc=\"Omega baryon; baryonic matter density/critical density at z=0.\")\n\n        def __init__(self, H0, Om0, Ode0, Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV,\n                     Ob0=None, *, name=None, meta=None):\n            self.H0 = H0\n            ...  # for each Parameter in turn\n\n        @Ob0.validator\n        def Ob0(self, param, value):\n            \"\"\"Validate baryon density to None or positive float > matter density.\"\"\"\n            if value is None:\n                return value\n            value = _validate_non_negative(self, param, value)\n            if value > self.Om0:\n                raise ValueError(\"baryonic density can not be larger than total matter density.\")\n            return value\n\nFirst note that all the parameters are also arguments in ``__init__``. This is\nnot strictly necessary, but is good practice. If the parameter has units (and\nrelated equivalencies) these must be specified on the Parameter, as seen in\n:attr:`~astropy.cosmology.FLRW.H0` and :attr:`~astropy.cosmology.FLRW.m_nu`.\n\nThe next important thing to note is how the parameter value is set, in\n``__init__``. |Parameter| allows for a value to be set once (before\nauto-locking), so ``self.H0 = H0`` will use this setter and put the value on\n\"._H0\". The advantage of this method over direct assignment to the private\nattribute is the use of validators. |Parameter| allows for custom value\nvalidators, using the method-decorator ``validator``, that can check a value's\nvalidity and modify the value, e.g to assign units. If no custom ``validator``\nis specified the default is to check if the |Parameter| has defined units and\nif so, return the value as a |Quantity| with those units, using all enabled and\nthe parameter's unit equivalencies.\n\nThe last thing to note is pretty formatting for the |Cosmology|. Each\n|Parameter| defaults to the `format specification\n<https://docs.python.org/3/library/string.html#formatspec>`_ \".3g\", but this\nmay be overridden, like :attr:`~astropy.cosmology.FLRW.Tcmb0` does.\n\nIf a new cosmology modifies an existing Parameter, then the\n:meth:`~astropy.cosmology.Parameter.clone` method is useful to deep-copy the\nparameter and change any constructor argument. For example, see\n``FlatFLRWMixin`` in ``astropy.cosmology.flrw`` (also shown below).\n\n.. code-block:: python\n\n    class FlatFLRWMixin(FlatCosmologyMixin):\n        ...\n\n        Ode0 = FLRW.Ode0.clone(derived=True)  # now a derived param.\n\nMixins\n------\n\n`Mixins <https://en.wikipedia.org/wiki/Mixin>`_ are used in\n:mod:`~astropy.cosmology` to reuse code across multiple classes in different\ninheritance lines. We use the term loosely as mixins are meant to be strictly\northogonal, but may not be, particularly in ``__init__``.\n\nCurrently the only mixin is |FlatCosmologyMixin| and its |FLRW|-specific\nsubclass |FlatFLRWMixin|. \"Flat\" cosmologies should use this mixin.\n|FlatFLRWMixin| must precede the base class in the multiple-inheritance so that\nthis mixin's ``__init__`` proceeds the base class'.\n\n\n.. _astropy-cosmology-fast-integrals:\n\nSpeeding up Integrals in Custom Cosmologies\n-------------------------------------------\n\nThe supplied cosmology classes use a few tricks to speed up distance and time\nintegrals.  It is not necessary for anyone subclassing |FLRW| to use these\ntricks -- but if they do, such calculations may be a lot faster.\n\nThe first, more basic, idea is that, in many cases, it's a big deal to provide\nexplicit formulae for :meth:`~astropy.cosmology.FLRW.inv_efunc` rather than\nsimply setting up ``de_energy_scale`` -- assuming there is a nice expression.\nAs noted above, almost all of the provided classes do this, and that template\ncan pretty much be followed directly with the appropriate formula changes.\n\nThe second, and more advanced, option is to also explicitly provide a scalar\nonly version of :meth:`~astropy.cosmology.FLRW.inv_efunc`. This results in a\nfairly large speedup (>10x in most cases) in the distance and age integrals,\neven if only done in python, because testing whether the inputs are iterable or\npure scalars turns out to be rather expensive. To take advantage of this, the\nkey thing is to explicitly set the instance variables\n``self._inv_efunc_scalar`` and ``self._inv_efunc_scalar_args`` in the\nconstructor for the subclass, where the latter are all the arguments except\n``z`` to ``_inv_efunc_scalar``. The provided classes do use this optimization,\nand in fact go even further and provide optimizations for no radiation, and for\nradiation with massless neutrinos coded in cython. Consult the |FLRW|\nsubclasses and ``scalar_inv_efuncs`` for the details.\n\nHowever, the important point is that it is *not* necessary to do this.\n\n\nAstropy Interoperability: I/O and your Cosmology Package\n========================================================\n\nIf you are developing a package and want to be able to interoperate with\n|Cosmology|, you're in the right place! Here we will discuss how to enable\nAstropy to read and write your file formats, and convert your cosmology objects\nto and from Astropy's |Cosmology|.\n\nThe following presumes knowledge of how Astropy structures I/O functions. For\na quick tutorial see :ref:`cosmology_io`.\n\nNow that we know how to build and register functions into |Cosmology.read|,\n|Cosmology.write|, |Cosmology.from_format|, |Cosmology.to_format|, we can do\nthis in your package.\n\nConsider a package -- since this is mine, it's cleverly named ``mypackage`` --\nwith the following file structure: a module for cosmology codes and a module\nfor defining related input/output functions. In the cosmology module are\ndefined cosmology classes and a file format -- ``myformat`` -- and everything\nshould interoperate with astropy. The tests are done with :mod:`pytest` and are\nintegrated within the code structure.\n\n.. code-block:: text\n    :emphasize-lines: 7,8,9,13,14\n\n    mypackage/\n        __init__.py\n        cosmology/\n            __init__.py\n            ...\n        io/\n            __init__.py\n            astropy_convert.py\n            astropy_io.py\n            ...\n            tests/\n                __init__.py\n                test_astropy_convert.py\n                test_astropy_io.py\n                ...\n\nFor a fully implemented example ``mypackage``, see\nhttps://github.com/astropy/astropy/tree/main/astropy/cosmology/tests/mypackage\n\n\nConverting Objects Between Packages\n-----------------------------------\n\nWe want to enable conversion between cosmology objects from ``mypackage``\nto/from |Cosmology|. All the Astropy interface code is defined in\n``mypackage/io/astropy_convert.py``. The following is a rough outline of the\nnecessary functions and how to register them with astropy's unified I/O to be\nautomatically available to |Cosmology.from_format| and |Cosmology.to_format|.\n\n.. literalinclude:: ../../astropy/cosmology/tests/mypackage/io/astropy_convert.py\n   :language: python\n\n\nReading and Writing\n-------------------\n\nEverything Astropy read/write related is defined in\n``mypackage/io/astropy_io.py``. The following is a rough outline of the read,\nwrite, and identify functions and how to register them with astropy's unified\nIO to be automatically available to |Cosmology.read| and |Cosmology.write|.\n\n.. literalinclude:: ../../astropy/cosmology/tests/mypackage/io/astropy_io.py\n   :language: python\n\n\nIf Astropy is an optional dependency\n------------------------------------\n\nThe ``astropy_io`` and ``astropy_convert`` modules are written assuming Astropy\nis installed. If in ``mypackage`` it is an optional dependency then it is\nimportant to detect if Astropy is installed (and the correct version) before\nimporting ``astropy_io`` and ``astropy_convert``.\nWe do this in ``mypackage/io/__init__.py``:\n\n.. literalinclude:: ../../astropy/cosmology/tests/mypackage/io/__init__.py\n   :language: python\n\n\nAstropy Interoperability Tests\n------------------------------\n\nLastly, it's important to test that everything works. In this example package\nall such tests are contained in ``mypackage/io/tests/test_astropy_io.py``.\nThese tests require Astropy and will be skipped if it is not installed (and\nnot the correct version), so at least one test in the test matrix should\ninclude ``astropy >= 5.0``.\n\n.. literalinclude:: ../../astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py\n   :language: python\n\n.. literalinclude:: ../../astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py\n   :language: python\n"},{"col":0,"comment":"\n    Given a path to a directory, returns the amount of free space\n    on that filesystem.\n\n    Parameters\n    ----------\n    path : str\n        The path to a directory.\n\n    unit : bool or `~astropy.units.Unit`\n        Return the amount of free space as Quantity in the given unit,\n        if provided. Default is `False` for backward-compatibility.\n\n    Returns\n    -------\n    free_space : int or `~astropy.units.Quantity`\n        The amount of free space on the partition that the directory is on.\n        If ``unit=False``, it is returned as plain integer (in bytes).\n\n    ","endLoc":999,"header":"def get_free_space_in_dir(path, unit=False)","id":464,"name":"get_free_space_in_dir","nodeType":"Function","startLoc":965,"text":"def get_free_space_in_dir(path, unit=False):\n    \"\"\"\n    Given a path to a directory, returns the amount of free space\n    on that filesystem.\n\n    Parameters\n    ----------\n    path : str\n        The path to a directory.\n\n    unit : bool or `~astropy.units.Unit`\n        Return the amount of free space as Quantity in the given unit,\n        if provided. Default is `False` for backward-compatibility.\n\n    Returns\n    -------\n    free_space : int or `~astropy.units.Quantity`\n        The amount of free space on the partition that the directory is on.\n        If ``unit=False``, it is returned as plain integer (in bytes).\n\n    \"\"\"\n    if not os.path.isdir(path):\n        raise OSError(\n            \"Can only determine free space associated with directories, \"\n            \"not files.\")\n        # Actually you can on Linux but I want to avoid code that fails\n        # on Windows only.\n    free_space = shutil.disk_usage(path).free\n    if unit:\n        from astropy import units as u\n        # TODO: Automatically determine best prefix to use.\n        if unit is True:\n            unit = u.byte\n        free_space = u.Quantity(free_space, u.byte).to(unit)\n    return free_space"},{"id":465,"name":"io.rst","nodeType":"TextFile","path":"docs/cosmology","text":".. _cosmology_io:\n\nRead, Write, and Convert Cosmology Objects\n******************************************\n\nFor *temporary* storage an easy means to serialize and deserialize a Cosmology\nobject is using the :mod:`pickle` module. This is good for e.g. passing a\n|Cosmology| between threads.\n\n.. doctest-skip::\n\n   >>> import pickle\n   >>> from astropy.cosmology import Planck18\n   >>> with open(\"planck18.pkl\", mode=\"wb\") as file:\n   ...     pickle.dump(Planck18, file)\n   >>> # and to read back\n   >>> with open(\"planck18.pkl\", mode=\"rb\") as file:\n   ...     cosmo = pickle.load(file)\n   >>> cosmo\n   FlatLambdaCDM(name=\"Planck18\", ...\n\nHowever this method has all the attendant drawbacks of :mod:`pickle` — security\nvulnerabilities and non-human-readable files. Pickle files just generally don't\nmake for good persistent storage.\n\nSolving both these issues, ``astropy`` provides a unified interface for reading\nand writing data in different formats.\n\n\nGetting Started\n===============\n\nThe |Cosmology| class includes two methods, |Cosmology.read| and\n|Cosmology.write|, that make it possible to read from and write to files.\n\nCurrently the only registered ``read`` / ``write`` format is \"ascii.ecsv\",\nlike for Table. Also, custom ``read`` / ``write`` formats may be registered\ninto the Astropy Cosmology I/O framework.\n\nWriting a cosmology instance requires only the file location and optionally,\nif the file format cannot be inferred, a keyword argument \"format\". Additional\npositional arguments and keyword arguments are passed to the reader methods.\n\n.. doctest-skip::\n\n    >>> from astropy.cosmology import Planck18\n    >>> Planck18.write(\"example_cosmology.ecsv\", format=\"ascii.ecsv\")\n\nReading back the cosmology is most safely done from |Cosmology|, the base\nclass, as it provides no default information and therefore requires the file\nto have all necessary information to describe a cosmology.\n\n.. doctest-skip::\n\n    >>> from astropy.cosmology import Cosmology\n    >>> cosmo = Cosmology.read(\"example_cosmology.ecsv\", format=\"ascii.ecsv\")\n    >>> cosmo == Planck18\n    True\n\nTo see a list of the available read/write file formats:\n\n.. code-block:: python\n\n    >>> from astropy.cosmology import Cosmology\n    >>> Cosmology.read.list_formats()\n      Format   Read Write Auto-identify\n    ---------- ---- ----- -------------\n    ascii.ecsv  Yes   Yes           Yes\n      myformat  Yes   Yes           Yes\n\nThis list will include both built-in and registered 3rd-party formats.\n\"myformat\" is from an `example 3rd-party package\n<https://github.com/astropy/astropy/tree/main/astropy/cosmology/tests/mypackage>`_.\n\nWhen a subclass of |Cosmology| is used to read a file, the subclass will provide\na keyword argument ``cosmology=<class>`` to the registered read method. The\nmethod uses this cosmology class, regardless of the class indicated in the\nfile, and sets parameters' default values from the class' signature.\n\n.. doctest-skip::\n\n    >>> from astropy.cosmology import FlatLambdaCDM\n    >>> cosmo = FlatLambdaCDM.read('<file name>')\n    >>> cosmo == Planck18\n    True\n\nReading and writing |Cosmology| objects go through intermediate\nrepresentations, often a dict or |QTable| instance. These intermediate\nrepresentations are accessible through the methods |Cosmology.to_format| /\n|Cosmology.from_format|.\n\nTo see the a list of the available conversion formats:\n\n.. code-block:: python\n\n    >>> from astropy.cosmology import Cosmology\n    >>> Cosmology.to_format.list_formats()\n          Format      Read Write Auto-identify\n    ----------------- ---- ----- -------------\n    astropy.cosmology  Yes   Yes           Yes\n        astropy.model  Yes   Yes           Yes\n          astropy.row  Yes   Yes           Yes\n        astropy.table  Yes   Yes           Yes\n              mapping  Yes   Yes           Yes\n            mypackage  Yes   Yes           Yes\n                 yaml  Yes   Yes            No\n\nThis list will include both built-in and registered 3rd-party formats.\nFor instance, in the above, \"mapping\" is built-in while \"mypackage\" and\nis from an `example 3rd-party package\n<https://github.com/astropy/astropy/tree/main/astropy/cosmology/tests/mypackage>`_.\n\n|Cosmology.to_format| / |Cosmology.from_format| parse a Cosmology to/from\nanother python object. This can be useful for e.g., iterating through an MCMC\nof cosmological parameters or printing out a cosmological model to a journal\nformat, like latex or HTML. When 3rd party cosmology packages register with\nAstropy's Cosmology I/O, ``to/from_format`` can be used to convert cosmology\ninstances between packages!\n\n.. EXAMPLE START: Planck18 to mapping and back\n\n.. code-block::\n\n    >>> from astropy.cosmology import Planck18\n    >>> cm = Planck18.to_format(\"mapping\")\n    >>> cm\n    {'cosmology': <class 'astropy.cosmology.flrw.FlatLambdaCDM'>,\n     'name': 'Planck18',\n     'H0': <Quantity 67.66 km / (Mpc s)>,\n     'Om0': 0.30966,\n     ...\n\nNow this dict can be used to load a new cosmological instance identical\nto the |Planck18| cosmology from which it was created.\n\n.. code-block::\n\n    >>> from astropy.cosmology import Cosmology\n    >>> cosmo = Cosmology.from_format(cm, format=\"mapping\")\n    >>> cosmo == Planck18\n    True\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Planck18 to QTable and back\n\nAnother pre-registered format is \"table\", for converting a |Cosmology| to and\nfrom a |QTable|.\n\n.. code-block::\n\n    >>> ct = Planck18.to_format(\"astropy.table\")\n    >>> ct\n    <QTable length=1>\n      name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n             km / (Mpc s)            K                 eV\n      str8     float64    float64 float64 float64   float64   float64\n    -------- ------------ ------- ------- ------- ----------- -------\n    Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\nCosmology supports the astropy Table-like protocol (see\n:ref:`Table-like Objects`) to the same effect:\n\n.. code-block::\n\n    >>> from astropy.table import QTable\n    >>> ct = QTable(Planck18)\n    >>> ct\n    <QTable length=1>\n      name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n             km / (Mpc s)            K                 eV\n      str8     float64    float64 float64 float64   float64   float64\n    -------- ------------ ------- ------- ------- ----------- -------\n    Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\nNow this |QTable| can be used to load a new cosmological instance identical to\nthe |Planck18| cosmology from which it was created.\n\n.. code-block::\n\n    >>> cosmo = Cosmology.from_format(ct, format=\"astropy.table\")\n    >>> cosmo\n    FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                  Tcmb0=2.7255 K, Neff=3.046, m_nu=[0. 0. 0.06] eV, Ob0=0.04897)\n\nPerhaps more usefully, |QTable| can be saved to ``latex`` and ``html`` formats,\nwhich can be copied into journal articles and websites, respectively.\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Planck18 to Model and back\n\nUsing ``format=\"astropy.model\"`` any redshift(s) method of a cosmology may be\nturned into a :class:`astropy.modeling.Model`. Each |Cosmology|\n:class:`~astropy.cosmology.Parameter` is converted to a\n:class:`astropy.modeling.Model` :class:`~astropy.modeling.Parameter`\nand the redshift-method to the model's ``__call__ / evaluate``.\nNow you can fit cosmologies with data!\n\n.. code-block::\n\n    >>> model = Planck18.to_format(\"astropy.model\", method=\"lookback_time\")\n    >>> model\n    <FlatLambdaCDMCosmologyLookbackTimeModel(H0=67.66 km / (Mpc s), Om0=0.30966,\n        Tcmb0=2.7255 K, Neff=3.046, m_nu=[0.  , 0.  , 0.06] eV, Ob0=0.04897,\n        name='Planck18')>\n\nLike for the other formats, the |Planck18| cosmology can be recovered with\n|Cosmology.from_format|.\n\n\n.. _custom_cosmology_converters:\n\nCustom Cosmology To/From Formats\n================================\n\nCustom representation formats may also be registered into the Astropy Cosmology\nI/O framework for use by these methods. For details of the framework see\n:ref:`io_registry`. Note |Cosmology| ``to/from_format`` uses a custom registry,\navailable at ``Cosmology.<to/from>_format.registry``.\n\n.. EXAMPLE START : custom to/from format\n\nAs an example, the following is an implementation of an |Row| converter. We can\nand should use inbuilt parsers, like |QTable|, but to show a more complete\nexample we limit ourselves to only the \"mapping\" parser.\n\nWe start by defining the function to parse a |Row| into a |Cosmology|. This\nfunction should take 1 positional argument, the row object, and 2 keyword\narguments, for how to handle extra metadata and which Cosmology class to use.\nDetails about metadata treatment are in\n``Cosmology.from_format.help(\"mapping\")``.\n\n.. code-block:: python\n\n    >>> import copy\n    >>> from astropy.cosmology import Cosmology\n\n    >>> def from_table_row(row, *, move_to_meta=False, cosmology=None):\n    ...     # get name from column\n    ...     name = row['name'] if 'name' in row.columns else None\n    ...     meta = copy.deepcopy(row.meta)\n    ...     # turn row into mapping (dict of the arguments)\n    ...     mapping = dict(row)\n    ...     mapping['name'] = name\n    ...     mapping.setdefault(\"cosmology\", meta.pop(\"cosmology\", None))\n    ...     mapping[\"meta\"] = meta\n    ...     # build cosmology from map\n    ...     return Cosmology.from_format(mapping, move_to_meta=move_to_meta,\n    ...                                  cosmology=cosmology)\n\nThe next step is a function to perform the reverse operation: parse a\n|Cosmology| into a |Row|. This function requires only the cosmology object and\na ``*args`` to absorb unneeded information passed by\n:class:`astropy.io.registry.UnifiedReadWrite` (which implements\n|Cosmology.to_format|).\n\n.. code-block:: python\n\n    >>> from astropy.table import QTable\n\n    >>> def to_table_row(cosmology, *args):\n    ...     p = cosmology.to_format(\"mapping\", cosmology_as_str=True)\n    ...     meta = p.pop(\"meta\")\n    ...     # package parameters into lists for Table parsing\n    ...     params = {k: [v] for k, v in p.items()}\n    ...     return QTable(params, meta=meta)[0]  # return row\n\nLast we write a function to help with format auto-identification and then\nregister everything into `astropy.io.registry`.\n\n.. code-block:: python\n\n    >>> from astropy.cosmology import Cosmology\n    >>> from astropy.cosmology.connect import convert_registry\n    >>> from astropy.table import Row\n\n    >>> def row_identify(origin, format, *args, **kwargs):\n    ...     \"\"\"Identify if object uses the Table format.\"\"\"\n    ...     if origin == \"read\":\n    ...         return isinstance(args[1], Row) and (format in (None, \"astropy.row\"))\n    ...     return False\n\n    >>> # These exact functions are already registered in astropy\n    >>> # convert_registry.register_reader(\"astropy.row\", Cosmology, from_table_row)\n    >>> # convert_registry.register_writer(\"astropy.row\", Cosmology, to_table_row)\n    >>> # convert_registry.register_identifier(\"astropy.row\", Cosmology, row_identify)\n\nNow the registered functions can be used in |Cosmology.from_format| and\n|Cosmology.to_format|.\n\n.. code-block:: python\n\n    >>> from astropy.cosmology import Planck18\n    >>> row = Planck18.to_format(\"astropy.row\")\n    >>> row\n    <Row index=0>\n      cosmology     name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                           km / (Mpc s)            K                 eV\n        str13       str8     float64    float64 float64 float64   float64   float64\n    ------------- -------- ------------ ------- ------- ------- ----------- -------\n    FlatLambdaCDM Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\n    >>> cosmo = Cosmology.from_format(row)\n    >>> cosmo == Planck18  # test it round-trips\n    True\n\n.. EXAMPLE END\n\n\n.. _custom_cosmology_readers_writers:\n\nCustom Cosmology Readers/Writers\n================================\n\nCustom ``read`` / ``write`` formats may be registered into the Astropy\nCosmology I/O framework. For details of the framework see :ref:`io_registry`.\nNote |Cosmology| ``read/write`` uses a custom registry, available at\n``Cosmology.<read/write>.registry``.\n\n.. EXAMPLE START : custom read/write\n\nAs an example, in the following we will fully work out a |Cosmology| <-> JSON\n(de)serializer. Note that we can use other registered parsers -- here \"mapping\"\n-- to make the implementation much simpler.\n\nWe start by defining the function to parse JSON into a |Cosmology|. This\nfunction should take 1 positional argument, the file object or file path. We\nwill also pass kwargs through to |Cosmology.from_format|, which handles\nmetadata and which Cosmology class to use. Details of are in\n``Cosmology.from_format.help(\"mapping\")``.\n\n.. code-block:: python\n\n    >>> import json, os\n    >>> import astropy.units as u\n    >>> from astropy.cosmology import Cosmology\n\n    >>> def read_json(filename, **kwargs):\n    ...     # read file, from path-like or file-like\n    ...     if isinstance(filename, (str, bytes, os.PathLike)):\n    ...         with open(filename, \"r\") as file:\n    ...             data = file.read()\n    ...     else:  # file-like : this also handles errors in dumping\n    ...         data = filename.read()\n    ...     mapping = json.loads(data)  # parse json mappable to dict\n    ...     # deserialize Quantity\n    ...     for k, v in mapping.items():\n    ...         if isinstance(v, dict) and \"value\" in v and \"unit\" in v:\n    ...             mapping[k] = u.Quantity(v[\"value\"], v[\"unit\"])\n    ...     for k, v in mapping.get(\"meta\", {}).items():  # also the metadata\n    ...         if isinstance(v, dict) and \"value\" in v and \"unit\" in v:\n    ...             mapping[\"meta\"][k] = u.Quantity(v[\"value\"], v[\"unit\"])\n    ...     return Cosmology.from_format(mapping, **kwargs)\n\n\nThe next step is a function to write a |Cosmology| to JSON. This function\nrequires the cosmology object and a file object/path. We also require the\nboolean flag \"overwrite\" to set behavior for existing files. Note that\n|Quantity| is not natively compatible with JSON. In both the ``write`` and\n``read`` methods we have to create custom parsers.\n\n.. code-block:: python\n\n    >>> def write_json(cosmology, file, *, overwrite=False, **kwargs):\n    ...    data = cosmology.to_format(\"mapping\", cosmology_as_str=True)  # start by turning into dict\n    ...    # serialize Quantity\n    ...    for k, v in data.items():\n    ...        if isinstance(v, u.Quantity):\n    ...            data[k] = {\"value\": v.value.tolist(), \"unit\": str(v.unit)}\n    ...    for k, v in data.get(\"meta\", {}).items():  # also serialize the metadata\n    ...        if isinstance(v, u.Quantity):\n    ...            data[\"meta\"][k] = {\"value\": v.value.tolist(), \"unit\": str(v.unit)}\n    ...\n    ...    if isinstance(file, (str, bytes, os.PathLike)):\n    ...        # check that file exists and whether to overwrite.\n    ...        if os.path.exists(file) and not overwrite:\n    ...            raise IOError(f\"{file} exists. Set 'overwrite' to write over.\")\n    ...        with open(file, \"w\") as write_file:\n    ...            json.dump(data, write_file)\n    ...    else:\n    ...        json.dump(data, file)\n\nLast we write a function to help with format auto-identification and then\nregister everything into :mod:`astropy.io.registry`.\n\n.. code-block:: python\n\n    >>> from astropy.cosmology.connect import readwrite_registry\n\n    >>> def json_identify(origin, filepath, fileobj, *args, **kwargs):\n    ...     \"\"\"Identify if object uses the JSON format.\"\"\"\n    ...     return filepath is not None and filepath.endswith(\".json\")\n\n    >>> readwrite_registry.register_reader(\"json\", Cosmology, read_json)\n    >>> readwrite_registry.register_writer(\"json\", Cosmology, write_json)\n    >>> readwrite_registry.register_identifier(\"json\", Cosmology, json_identify)\n\nNow the registered functions can be used in |Cosmology.read| and\n|Cosmology.write|.\n\n.. doctest-skip:: win32\n\n    >>> import tempfile\n    >>> from astropy.cosmology import Planck18\n    >>>\n    >>> file = tempfile.NamedTemporaryFile()\n    >>> Planck18.write(file.name, format=\"json\", overwrite=True)\n    >>> with open(file.name) as f: f.readlines()\n    ['{\"cosmology\": \"FlatLambdaCDM\", \"name\": \"Planck18\",\n       \"H0\": {\"value\": 67.66, \"unit\": \"km / (Mpc s)\"}, \"Om0\": 0.30966,\n       ...\n    >>>\n    >>> cosmo = Cosmology.read(file.name, format=\"json\")\n    >>> file.close()\n    >>> cosmo == Planck18  # test it round-trips\n    True\n\n\n.. doctest::\n    :hide:\n\n    >>> from astropy.io.registry import IORegistryError\n    >>> readwrite_registry.unregister_reader(\"json\", Cosmology)\n    >>> readwrite_registry.unregister_writer(\"json\", Cosmology)\n    >>> readwrite_registry.unregister_identifier(\"json\", Cosmology)\n    >>> try:\n    ...     readwrite_registry.get_reader(\"json\", Cosmology)\n    ... except IORegistryError:\n    ...     pass\n\n.. EXAMPLE END\n\n\nReference/API\n=============\n\n.. automodapi:: astropy.cosmology.connect\n\n.. automodapi:: astropy.cosmology.io.mapping\n"},{"id":466,"name":"units.rst","nodeType":"TextFile","path":"docs/cosmology","text":".. _astropy-cosmology-units-and-equivalencies:\n\n************************************\nCosmological Units and Equivalencies\n************************************\n\n.. currentmodule:: astropy.cosmology.units\n\nThis package defines and collects cosmological units and equivalencies.\nWe suggest importing this units package as\n\n    >>> import astropy.cosmology.units as cu\n\n\nTo enable the main :mod:`astropy.units` to access these units when searching\nfor unit conversions and equivalencies, use\n:func:`~astropy.units.add_enabled_units`.\n\n    >>> import astropy.units as u\n    >>> u.add_enabled_units(cu)  # doctest: +SKIP\n\n\nAbout the Units\n===============\n\n.. doctest::\n   :hide:\n\n   >>> import astropy.units as u\n\n\n.. _cosmological-redshift:\n\nCosmological Redshift and Dimensionless Equivalency\n---------------------------------------------------\n\nThere are numerous measures of distance in cosmology -- luminosities, CMB\ntemperature, the universe's age, etc. -- but redshift is the principal measure\nfrom which others are defined. In cosmology, distance measures are commonly\nexasperating to follow in a derivation, because they are used interchangeably.\n``astropy`` provides the ``redshift`` unit and associated equivalencies to\nassist in these derivations and unify the distance measures.\n\nExamples\n^^^^^^^^\n\n.. EXAMPLE START: Using redshift-dimensionless equivalency\n\nTo convert to or from dimensionless to \"redshift\" units:\n\n    >>> import astropy.units as u\n    >>> import astropy.cosmology.units as cu\n    >>> z = 1100 * cu.redshift\n    >>> z.to(u.dimensionless_unscaled, equivalencies=cu.dimensionless_redshift())\n    <Quantity 1100.>\n\nThe equivalency works as part of a quantity with composite units\n\n    >>> q = (2.7 * u.K) * z\n    >>> q.to(u.K, equivalencies=cu.dimensionless_redshift())\n    <Quantity 2970. K>\n\nSince the redshift is not a true unit and is used so frequently, the\nredshift / dimensionless equivalency is actually enabled by default.\n\n    >>> z == 1100 * u.dimensionless_unscaled\n    True\n\n    >>> q.to(u.K)\n    <Quantity 2970. K>\n\nTo temporarily remove the equivalency and enforce unit strictness, use\n:func:`astropy.units.set_enabled_equivalencies` as a context.\n\n    >>> with u.set_enabled_equivalencies([]):\n    ...     try:\n    ...         z.to(u.dimensionless_unscaled)\n    ...     except u.UnitConversionError:\n    ...         print(\"equivalency disabled\")\n    equivalency disabled\n\n.. EXAMPLE END\n\n\n.. EXAMPLE START: Using `with_redshift` equivalency\n\nThe other redshift equivalency is `~astropy.cosmology.units.with_redshift`,\nenabling redshift to be converted to other units, like CMB temperature:\n\n    >>> from astropy.cosmology import WMAP9\n    >>> z = 1100 * cu.redshift\n    >>> z.to(u.K, cu.with_redshift(WMAP9))\n    <Quantity 3000.225 K>\n\nor the Hubble parameter:\n\n    >>> z.to(u.km / u.s / u.Mpc, cu.with_redshift(WMAP9))  # doctest: +FLOAT_CMP\n    <Quantity 1565637.40154275 km / (Mpc s)>\n\n    >>> z.to(cu.littleh, cu.with_redshift(WMAP9))  # doctest: +FLOAT_CMP\n    <Quantity 15656.37401543 littleh>\n\nor a physical distance (comoving, lookback, or luminosity):\n\n.. doctest-requires:: scipy\n\n    >>> z.to(u.Mpc, cu.with_redshift(WMAP9, distance=\"luminosity\"))  # doctest: +FLOAT_CMP\n    <Quantity 15418438.76317008 Mpc>\n\nThese conversions are cosmology dependent, so if the cosmology changes,\nso too will the conversions.\n\n    >>> excosmo = WMAP9.clone(Tcmb0=3.0)\n    >>> z.to(u.K, cu.with_redshift(excosmo))\n    <Quantity 3303. K>\n\nIf no argument is given (or the argument is `None`), this equivalency assumes\nthe current default |Cosmology|:\n\n    >>> z.to(u.K, cu.with_redshift())\n    <Quantity 3000.7755 K>\n\nTo use this equivalency in a larger block of code:\n\n    >>> with u.add_enabled_equivalencies(cu.with_redshift()):\n    ...     # long derivation here\n    ...     z.to(u.K)\n    <Quantity 3000.7755 K>\n\n.. EXAMPLE END\n\n\n.. _littleh-and-H0-equivalency:\n\nReduced Hubble Constant and \"little-h\" Equivalency\n--------------------------------------------------\n\nThe dimensionless version of the Hubble constant — often known as \"little h\" —\nis a frequently used quantity in extragalactic astrophysics. It is also widely\nknown as the bane of beginners' existence in such fields (See e.g., the title\nof `this paper <https://doi.org/10.1017/pasa.2013.31>`__, which also provides\nvaluable advice on the use of little h). ``astropy`` provides the\n:func:`~astropy.cosmology.units.with_H0` equivalency that helps keep this\nstraight in at least some of these cases, by providing a way to convert to/from\nphysical to \"little h\" units.\n\nExamples\n^^^^^^^^\n\n.. EXAMPLE START: Using the \"little h\" Equivalency\n\nTo convert to or from physical to \"little h\" units:\n\n.. code-block:: python\n\n    >>> import astropy.units as u\n    >>> import astropy.cosmology.units as cu\n    >>> H0_70 = 70 * u.km/u.s/u.Mpc\n    >>> distance = 70 * (u.Mpc/cu.littleh)\n    >>> distance.to(u.Mpc, cu.with_H0(H0_70))  # doctest: +FLOAT_CMP\n    <Quantity 100.0 Mpc>\n    >>> luminosity = 0.49 * u.Lsun * cu.littleh**-2\n    >>> luminosity.to(u.Lsun, cu.with_H0(H0_70))  # doctest: +FLOAT_CMP\n    <Quantity 1.0 solLum>\n\nNote the unit name ``littleh``: while this unit is usually expressed in the\nliterature as just ``h``, here it is ``littleh`` to avoid confusion with\n\"hours.\"\n\nIf no argument is given (or the argument is `None`), this equivalency assumes\nthe ``H0`` from the current default |Cosmology|:\n\n.. code-block:: python\n\n    >>> distance = 100 * (u.Mpc/cu.littleh)\n    >>> distance.to(u.Mpc, cu.with_H0())  # doctest: +FLOAT_CMP\n    <Quantity 147.79781259 Mpc>\n\nThis equivalency also allows a common magnitude formulation of little h\nscaling:\n\n.. code-block:: python\n\n    >>> mag_quantity = 12 * (u.mag - u.MagUnit(cu.littleh**2))\n    >>> mag_quantity  # doctest: +FLOAT_CMP\n    <Magnitude 12. mag(1 / littleh2)>\n    >>> mag_quantity.to(u.mag, cu.with_H0(H0_70))  # doctest: +FLOAT_CMP\n    <Quantity 11.2254902 mag>\n\n.. EXAMPLE END\n\n\nReference/API\n=============\n\n.. automodapi:: astropy.cosmology.units\n   :inherited-members:\n"},{"id":467,"name":"index.rst","nodeType":"TextFile","path":"docs/cosmology","text":".. _astropy-cosmology:\n\n***********************************************\nCosmological Calculations (`astropy.cosmology`)\n***********************************************\n\n.. |wCDM| replace:: :class:`~astropy.cosmology.wCDM`\n.. |FlatwCDM| replace:: :class:`~astropy.cosmology.FlatwCDM`\n.. |w0wzCDM| replace:: :class:`~astropy.cosmology.w0wzCDM`\n.. |w0waCDM| replace:: :class:`~astropy.cosmology.w0waCDM`\n.. |wpwaCDM| replace:: :class:`~astropy.cosmology.wpwaCDM`\n.. |WMAP7| replace:: :ref:`WMAP7 <astropy:WMAP7>`\n.. |WMAP9| replace:: :ref:`WMAP9 <astropy:WMAP9>`\n.. |Planck13| replace:: :ref:`Planck13 <astropy:Planck13>`\n.. |Planck15| replace:: :ref:`Planck15 <astropy:Planck15>`\n.. |z_at_value| replace:: :func:`~astropy.cosmology.z_at_value`\n\nIntroduction\n============\n\nThe :mod:`astropy.cosmology` sub-package contains classes for representing\ncosmologies and utility functions for calculating commonly used quantities that\ndepend on a cosmological model. This includes distances, ages, and lookback\ntimes corresponding to a measured redshift or the transverse separation\ncorresponding to a measured angular separation.\n\n:mod:`astropy.cosmology.units` extends the :mod:`astropy.units` sub-package,\nadding and collecting cosmological units and equivalencies, like :math:`h` for\nkeeping track of (dimensionless) factors of the Hubble constant.\n\nFor details on reading and writing cosmologies from files, see\n:ref:`cosmology_io`.\n\nFor notes on building custom Cosmology classes and interfacing\n:mod:`astropy.cosmology` with 3rd-party packages, see\n:ref:`astropy-cosmology-for-developers`.\n\n\nGetting Started\n===============\n\nCosmological quantities are calculated using methods of a |Cosmology| object.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Calculating Cosmological Quantities\n\nTo calculate the Hubble constant at z=0 (i.e., ``H0``) and the number of\ntransverse proper kiloparsecs (kpc) corresponding to an arcminute at z=3::\n\n  >>> from astropy.cosmology import WMAP9 as cosmo\n  >>> cosmo.H(0)  # doctest: +FLOAT_CMP\n  <Quantity 69.32 km / (Mpc s)>\n\n.. doctest-requires:: scipy\n\n  >>> cosmo.kpc_proper_per_arcmin(3)  # doctest: +FLOAT_CMP\n  <Quantity 472.97709620405266 kpc / arcmin>\n\nHere |WMAP9| is a built-in object describing a cosmology with the parameters\nfrom the nine-year WMAP results. Several other built-in cosmologies are also\navailable (see `Built-in Cosmologies`_). The available methods of the cosmology\nobject are listed in the methods summary for the |FLRW| class.\n\nAll of these methods also accept an arbitrarily-shaped array of redshifts as\ninput:\n\n.. doctest-requires:: scipy\n\n  >>> import numpy as np\n  >>> from astropy.cosmology import WMAP9 as cosmo\n  >>> cosmo.comoving_distance(np.array([0.5, 1.0, 1.5]))  # doctest: +FLOAT_CMP\n  <Quantity [1916.06941724, 3363.07062107, 4451.7475201 ] Mpc>\n\nYou can create your own FLRW-like cosmology using one of the cosmology\nclasses::\n\n  >>> from astropy.cosmology import FlatLambdaCDM\n  >>> cosmo = FlatLambdaCDM(H0=70, Om0=0.3, Tcmb0=2.725)\n  >>> cosmo  # doctest: +FLOAT_CMP\n  FlatLambdaCDM(H0=70.0 km / (Mpc s), Om0=0.3, Tcmb0=2.725 K,\n                Neff=3.04, m_nu=[0. 0. 0.] eV, Ob0=None)\n\nNote the presence of additional cosmological parameters (e.g., ``Neff``, the\nnumber of effective neutrino species) with default values; these can also be\nspecified explicitly in the call to the constructor.\n\n..\n  EXAMPLE END\n\nThe cosmology sub-package makes use of :mod:`~astropy.units`, so in many cases\nreturns values with units attached. Consult the documentation for that\nsub-package for more details, but briefly here we will show how to access the\nfloating point or array values::\n\n  >>> from astropy.cosmology import WMAP9 as cosmo\n  >>> H0 = cosmo.H(0)\n  >>> H0.value, H0.unit  # doctest: +FLOAT_CMP\n  (69.32, Unit(\"km / (Mpc s)\"))\n\n\nUsing `astropy.cosmology`\n=========================\n\nMore detailed information on using the package is provided on separate pages,\nlisted below.\n\n.. toctree::\n   :maxdepth: 1\n\n   Reading and Writing <io>\n   Units and Equivalencies <units>\n\n\nMost of the functionality is enabled by the |FLRW| object. This represents a\nhomogeneous and isotropic cosmology (characterized by the\nFriedmann-Lemaitre-Robertson-Walker metric, named after the people who solved\nEinstein's field equation for this special case). However, you cannot work with\nthis class directly, as you must specify a dark energy model by using one of\nits subclasses instead, such as |FlatLambdaCDM|.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Working with the FlatLambdaCDM Class\n\nYou can create a new |FlatLambdaCDM| object with arguments giving the Hubble\nparameter and Omega matter (both at z=0)::\n\n  >>> from astropy.cosmology import FlatLambdaCDM\n  >>> cosmo = FlatLambdaCDM(H0=70, Om0=0.3)\n  >>> cosmo\n  FlatLambdaCDM(H0=70.0 km / (Mpc s), Om0=0.3, Tcmb0=0.0 K,\n                Neff=3.04, m_nu=None, Ob0=None)\n\nThis can also be done more explicitly using units, which is recommended::\n\n  >>> from astropy.cosmology import FlatLambdaCDM\n  >>> import astropy.units as u\n  >>> cosmo = FlatLambdaCDM(H0=70 * u.km / u.s / u.Mpc, Tcmb0=2.725 * u.K, Om0=0.3)\n\n\nThe predefined cosmologies described in the `Getting Started`_ section are\ninstances of |FlatLambdaCDM|, and have the same methods. So we can find the\nluminosity distance to redshift 4 by:\n\n.. doctest-requires:: scipy\n\n  >>> cosmo.luminosity_distance(4)  # doctest: +FLOAT_CMP\n  <Quantity 35842.353618623194 Mpc>\n\nOr the age of the universe at z = 0:\n\n.. doctest-requires:: scipy\n\n  >>> cosmo.age(0)  # doctest: +FLOAT_CMP\n  <Quantity 13.461701658024014 Gyr>\n\nThey also accept arrays of redshifts:\n\n.. doctest-requires:: scipy\n\n  >>> import astropy.cosmology.units as cu\n  >>> cosmo.age([0.5, 1, 1.5] * cu.redshift)  # doctest: +FLOAT_CMP\n  <Quantity [8.42128013, 5.74698021, 4.19645373] Gyr>\n\nSee the |FLRW| and |FlatLambdaCDM| object docstring for all of the methods and\nattributes available.\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Working with Non-flat Universes with the LambdaCDM Class\n\nIn addition to flat universes, non-flat varieties are supported, such as\n|LambdaCDM|. A variety of standard cosmologies with the parameters already\ndefined are also available (see `Built-in Cosmologies`_)\n::\n\n  >>> from astropy.cosmology import WMAP7   # WMAP 7-year cosmology\n  >>> WMAP7.critical_density(0)  # critical density at z = 0  # doctest: +FLOAT_CMP\n  <Quantity 9.31000324385361e-30 g / cm3>\n\nYou can see how the density parameters evolve with redshift as well::\n\n  >>> import numpy as np\n  >>> from astropy.cosmology import WMAP7   # WMAP 7-year cosmology\n  >>> WMAP7.Om(np.array([0, 1.0, 2.0]))  # doctest: +FLOAT_CMP\n  array([0.272     , 0.74898522, 0.90905234])\n  >>> WMAP7.Ode(np.array([0., 1.0, 2.0]))  # doctest: +FLOAT_CMP\n  array([0.72791572, 0.2505506 , 0.0901026 ])\n\nNote that these do not quite add up to one, even though |WMAP7| assumes a flat\nuniverse, because photons and neutrinos are included. Also note that the\ndensity parameters are unitless and so are not |Quantity| objects.\n\nIt is possible to specify the baryonic matter density at redshift zero at class\ninstantiation by passing the keyword argument ``Ob0``::\n\n  >>> from astropy.cosmology import FlatLambdaCDM\n  >>> cosmo = FlatLambdaCDM(H0=70, Om0=0.3, Ob0=0.05)\n  >>> cosmo\n  FlatLambdaCDM(H0=70.0 km / (Mpc s), Om0=0.3, Tcmb0=0.0 K,\n                Neff=3.04, m_nu=None, Ob0=0.05)\n\nIn this case the dark matter-only density at redshift 0 is available as class\nattribute ``Odm0`` and the redshift evolution of dark and baryonic matter\ndensities can be computed using the methods ``Odm`` and ``Ob``, respectively.\nIf ``Ob0`` is not specified at class instantiation, it defaults to ``None`` and\nany method relying on it being specified will raise a ``ValueError``:\n\n  >>> from astropy.cosmology import FlatLambdaCDM\n  >>> cosmo = FlatLambdaCDM(H0=70, Om0=0.3)\n  >>> cosmo.Odm(1)\n  Traceback (most recent call last):\n  ...\n  ValueError: Baryonic density not set for this cosmology, unclear\n  meaning of dark matter density\n\nCosmological instances have an optional ``name`` attribute which can be used to\ndescribe the cosmology::\n\n  >>> from astropy.cosmology import FlatwCDM\n  >>> cosmo = FlatwCDM(name='SNLS3+WMAP7', H0=71.58, Om0=0.262, w0=-1.016)\n  >>> cosmo\n  FlatwCDM(name=\"SNLS3+WMAP7\", H0=71.58 km / (Mpc s), Om0=0.262,\n           w0=-1.016, Tcmb0=0.0 K, Neff=3.04, m_nu=None, Ob0=None)\n\n..\n  EXAMPLE END\n\nThis is also an example with a different model for dark energy: a flat universe\nwith a constant dark energy equation of state, but not necessarily a\ncosmological constant. A variety of additional dark energy models are also\nsupported (see `Specifying a dark energy model`_).\n\nAn important point is that the cosmological parameters of each instance are\nimmutable — that is, if you want to change, say, ``Om``, you need to make a new\ninstance of the class. To make this more convenient, a\n:meth:`~astropy.cosmology.Cosmology.clone` operation is provided, which allows\nyou to make a copy with specified values changed. Note that you cannot change\nthe type of cosmology with this operation (e.g., flat to non-flat).\n\n..\n  EXAMPLE START\n  Making New Cosmology Instances with the .clone() Method\n\nTo make a copy of a cosmological instance using the ``clone`` operation:\n\n  >>> from astropy.cosmology import WMAP9\n  >>> newcosmo = WMAP9.clone(name='WMAP9 modified', Om0=0.3141)\n  >>> WMAP9.H0, newcosmo.H0  # some values unchanged  # doctest: +FLOAT_CMP\n  (<Quantity 69.32 km / (Mpc s)>, <Quantity 69.32 km / (Mpc s)>)\n  >>> WMAP9.Om0, newcosmo.Om0  # some changed  # doctest: +FLOAT_CMP\n  (0.2865, 0.3141)\n  >>> WMAP9.Ode0, newcosmo.Ode0  # Indirectly changed since this is flat  # doctest: +FLOAT_CMP\n  (0.7134130719051658, 0.6858130719051657)\n\n..\n  EXAMPLE END\n\nFinding the Redshift at a Given Value of a Cosmological Quantity\n----------------------------------------------------------------\n\nIf you know a cosmological quantity and you want to know the redshift which it\ncorresponds to, you can use |z_at_value|.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Compute the Redshift at a Given Universe Age\n\nTo find the redshift using ``z_at_value``:\n\n.. doctest-requires:: scipy\n\n  >>> import astropy.units as u\n  >>> from astropy.cosmology import Planck13, z_at_value\n  >>> z_at_value(Planck13.age, 2 * u.Gyr)  # doctest: +FLOAT_CMP\n  <Quantity 3.19812061 redshift>\n\n..\n  EXAMPLE END\n\nFor some quantities, there can be more than one redshift that satisfies a value.\nIn this case you can use the ``zmin`` and ``zmax`` keywords to restrict the\nsearch range or set ``bracket`` to initialize it in the desired domain. See the\n|z_at_value| docstring for more detailed usage examples.\n\n\nBuilt-in Cosmologies\n--------------------\n\nA number of preloaded cosmologies are available from analyses using\nthe WMAP and Planck satellite data. For example:\n\n.. doctest-requires:: scipy\n\n  >>> from astropy.cosmology import Planck13  # Planck 2013\n  >>> Planck13.lookback_time(2)  # lookback time in Gyr at z=2  # doctest: +FLOAT_CMP\n  <Quantity 10.51184138 Gyr>\n\nA full list of the predefined cosmologies is given by\n``cosmology.realizations.available`` and summarized below:\n\n===========  ============================== ====  ===== =======\nName         Source                         H0    Om    Flat\n===========  ============================== ====  ===== =======\n_`WMAP1`     Spergel et al. 2003            72.0  0.257 Yes\n_`WMAP3`     Spergel et al. 2007            70.1  0.276 Yes\n_`WMAP5`     Komatsu et al. 2009            70.2  0.277 Yes\n_`WMAP7`     Komatsu et al. 2011            70.4  0.272 Yes\n_`WMAP9`     Hinshaw et al. 2013            69.3  0.287 Yes\n_`Planck13`  Planck Collab 2013, Paper XVI  67.8  0.307 Yes\n_`Planck15`  Planck Collab 2015, Paper XIII 67.7  0.307 Yes\n_`Planck18`  Planck Collab 2018, Paper VI   67.7  0.310 Yes\n===========  ============================== ====  ===== =======\n\n.. note::\n\n  Unlike the Planck 2015 paper, the Planck 2018 paper includes massive\n  neutrinos in ``Om0`` but the Planck18 object includes them in ``m_nu``\n  instead for consistency. Hence, the ``Om0`` value in Planck18 differs\n  slightly from the Planck 2018 paper but represents the same cosmological\n  model.\n\nCurrently, all are instances of |FlatLambdaCDM|. More details about exactly\nwhere each set of parameters comes from are available in the docstring for each\nobject::\n\n  >>> from astropy.cosmology import WMAP7\n  >>> print(WMAP7.__doc__)\n  WMAP7 instance of FlatLambdaCDM cosmology\n  (from Komatsu et al. 2011, ApJS, 192, 18, doi: 10.1088/0067-0049/192/2/18.\n   Table 1 (WMAP + BAO + H0 ML).)\n\n\nSpecifying a Dark Energy Model\n------------------------------\n\nAlong with the standard |FlatLambdaCDM| model described above, a number of\nadditional dark energy models are provided. |FlatLambdaCDM| and |LambdaCDM|\nassume that dark energy is a cosmological constant, and should be the most\ncommonly used cases; the former assumes a flat universe, the latter allows for\nspatial curvature. |FlatwCDM| and |wCDM| assume a constant dark energy equation\nof state parameterized by :math:`w_{0}`. Two forms of a variable dark energy\nequation of state are provided: the simple first order linear expansion\n:math:`w(z) = w_{0} + w_{z} z` by |w0wzCDM|, as well as the common CPL form by\n|w0waCDM|: :math:`w(z) = w_{0} + w_{a} (1 - a) = w_{0} + w_{a} z / (1 + z)`\nand its generalization to include a pivot redshift by |wpwaCDM|:\n:math:`w(z) = w_{p} + w_{a} (a_{p} - a)`.\n\nUsers can specify their own equation of state by subclassing |FLRW|. See the\nprovided subclasses for examples. It is advisable to stick to subclassing\n|FLRW| rather than one of its subclasses, since some of them use internal\noptimizations that also need to be propagated to any  subclasses. Users wishing\nto use similar tricks (which can make distance calculations much faster) should\nconsult the cosmology module source code for details.\n\nPhotons and Neutrinos\n---------------------\n\nThe cosmology classes (can) include the contribution to the energy density from\nboth photons and neutrinos. By default, the latter are assumed massless. The\nthree parameters controlling the properties of these species, which are\narguments to the initializers of all of the cosmological classes, are ``Tcmb0``\n(the temperature of the cosmic microwave background at z=0), ``Neff`` (the\neffective number of neutrino species), and ``m_nu`` (the rest mass of the\nneutrino species). ``Tcmb0`` and ``m_nu`` should be expressed as unit\nQuantities. All three have standard default values — 0 K, 3.04, and 0 eV,\nrespectively. (The reason that ``Neff`` is not 3 has to do primarily with a\nsmall bump in the neutrino energy spectrum due to electron-positron\nannihilation, but is also affected by weak interaction physics.) Setting the\nCMB temperature to 0 removes the contribution of both neutrinos and photons.\nThis is the default to ensure these components are excluded unless the user\nexplicitly requests them.\n\nMassive neutrinos are treated using the approach described in the\nWMAP seven-year cosmology paper (Komatsu et al. 2011, ApJS, 192, 18, section\n3.3). This is not the simple\n:math:`\\Omega_{\\nu 0} h^2 = \\sum_i m_{\\nu\\, i} / 93.04\\,\\mathrm{eV}`\napproximation. Also note that the values of :math:`\\Omega_{\\nu}(z)` include\nboth the kinetic energy and the rest mass energy components, and that the\n|Planck13| and |Planck15| cosmologies include a single species of neutrinos\nwith non-zero mass (which is not included in :math:`\\Omega_{m0}`).\n\nAdding massive neutrinos can have significant performance implications. In\nparticular, the computation of distance measures and lookback times are factors\nof three to four times slower than in the massless neutrino case. Therefore, if\nyou need to compute many distances in such a cosmology and performance is\ncritical, it is particularly useful to calculate them on a grid and use\ninterpolation.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Calculating the Contribution of Photons and Neutrinos to the Energy Density\n\nThe contribution of photons and neutrinos to the total mass-energy density can\nbe found as a function of redshift::\n\n  >>> from astropy.cosmology import WMAP7   # WMAP 7-year cosmology\n  >>> WMAP7.Ogamma0, WMAP7.Onu0  # Current epoch values  # doctest: +FLOAT_CMP\n  (4.985694972799396e-05, 3.442154948307989e-05)\n  >>> z = np.array([0, 1.0, 2.0])\n  >>> WMAP7.Ogamma(z), WMAP7.Onu(z)  # doctest: +FLOAT_CMP\n  (array([4.98603986e-05, 2.74593395e-04, 4.99915942e-04]),\n   array([3.44239306e-05, 1.89580995e-04, 3.45145089e-04]))\n\nIf you want to exclude photons and neutrinos from your calculations, you can\nset ``Tcmb0`` to 0 (which is also the default)::\n\n  >>> from astropy.cosmology import FlatLambdaCDM\n  >>> import astropy.units as u\n  >>> cos = FlatLambdaCDM(70.4 * u.km / u.s / u.Mpc, 0.272, Tcmb0 = 0.0 * u.K)\n  >>> cos.Ogamma0, cos.Onu0\n  (0.0, 0.0)\n\nYou can include photons but exclude any contributions from neutrinos by setting\n``Tcmb0`` to be non-zero (2.725 K is the standard value for our Universe) but\nsetting ``Neff`` to 0::\n\n  >>> from astropy.cosmology import FlatLambdaCDM\n  >>> cos = FlatLambdaCDM(70.4, 0.272, Tcmb0=2.725, Neff=0)\n  >>> cos.Ogamma(np.array([0, 1, 2]))  # Photons are still present  # doctest: +FLOAT_CMP\n  array([4.98603986e-05, 2.74642208e-04, 5.00086413e-04])\n  >>> cos.Onu(np.array([0, 1, 2]))  # But not neutrinos  # doctest: +FLOAT_CMP\n  array([0., 0., 0.])\n\nThe number of neutrino species is assumed to be the floor of ``Neff``, which in\nthe default case is ``Neff=3``. Therefore, if non-zero neutrino masses are\ndesired, then three masses should be provided. However, if only one value is\nprovided, all of the species are assumed to have the same mass. ``Neff`` is\nassumed to be shared equally between each species.\n\n::\n\n  >>> from astropy.cosmology import FlatLambdaCDM\n  >>> import astropy.units as u\n  >>> H0 = 70.4 * u.km / u.s / u.Mpc\n  >>> m_nu = 0 * u.eV\n  >>> cosmo = FlatLambdaCDM(H0, 0.272, Tcmb0=2.725, m_nu=m_nu)\n  >>> cosmo.has_massive_nu\n  False\n  >>> cosmo.m_nu  # doctest: +FLOAT_CMP\n  <Quantity [0., 0., 0.] eV>\n  >>> m_nu = [0.0, 0.05, 0.10] * u.eV\n  >>> cosmo = FlatLambdaCDM(H0, 0.272, Tcmb0=2.725, m_nu=m_nu)\n  >>> cosmo.has_massive_nu\n  True\n  >>> cosmo.m_nu  # doctest: +FLOAT_CMP\n  <Quantity [0.  , 0.05, 0.1 ] eV>\n  >>> cosmo.Onu(np.array([0, 1.0, 15.0]))  # doctest: +FLOAT_CMP\n  array([0.00327011, 0.00896845, 0.01257946])\n  >>> cosmo.Onu(1) * cosmo.critical_density(1)  # doctest: +FLOAT_CMP\n  <Quantity 2.444380380370406e-31 g / cm3>\n\nWhile these examples used |FlatLambdaCDM|, the above examples also apply for\nall of the other cosmology classes.\n\n..\n  EXAMPLE END\n\nSee Also\n========\n\n* Hogg, \"Distance measures in cosmology\",\n  https://arxiv.org/abs/astro-ph/9905116\n* Linder, \"Exploring the Expansion History of the Universe\", https://arxiv.org/abs/astro-ph/0208512\n* NASA's Legacy Archive for Microwave Background Data Analysis,\n  https://lambda.gsfc.nasa.gov/\n\nRange of Validity and Reliability\n=================================\n\nThe code in this sub-package is tested against several widely used online\ncosmology calculators and has been used to perform many calculations in\nrefereed papers. You can check the range of redshifts over which the code is\nregularly tested in the module ``astropy.cosmology.tests.test_cosmology``. If\nyou find any bugs, please let us know by `opening an issue at the GitHub\nrepository <https://github.com/astropy/astropy/issues>`_!\n\nA more difficult question is the range of redshifts over which the code is\nexpected to return valid results. This is necessarily model-dependent, but in\ngeneral you should not expect the numeric results to be well behaved for\nredshifts more than a few times larger than the epoch of matter-radiation\nequality (so, for typical models, not above z = 5-6,000, but for some models\nmuch lower redshifts may be ill-behaved). In particular, you should pay\nattention to warnings from the :mod:`scipy.integrate` package about integrals\nfailing to converge (which may only be issued once per session).\n\nThe built-in cosmologies use the parameters as listed in the respective papers.\nThese provide only a limited range of precision, and so you should not expect\nderived quantities to match beyond that precision. For example, the Planck 2013\nand 2015 results only provide the Hubble constant to four digits. Therefore,\nthey should not be expected to match the age quoted by the Planck team to\nbetter than that, despite the fact that five digits are quoted in the papers.\n\nReference/API\n=============\n\nMore detailed information on using the package is provided on separate pages,\nlisted below.\n\n.. toctree::\n   :maxdepth: 1\n\n   Reading and Writing <io>\n   For Developers <dev>\n\n\n.. automodapi:: astropy.cosmology\n   :inherited-members:\n"},{"id":468,"name":"docs/_templates","nodeType":"Package"},{"id":469,"name":"layout.html","nodeType":"TextFile","path":"docs/_templates","text":"{# This extension of the 'layout.html' prevents documentation for previous\n   versions of Astropy to be indexed by bots, e.g. googlebot or bing bot,\n   by inserting a robots meta tag into pages that are not in the stable or\n   latest branch.\n\n   It assumes that the documentation is built by and hosted on readthedocs.org:\n   1. Readthedocs.org has a global robots.txt and no option for a custom one.\n   2. The readthedocs app passes additional variables to the template context,\n   one of them being `version_slug`. This variable is a string computed from\n   the tags of the branches that are selected to be built. It can be 'latest',\n   'stable' or even a unique stringified version number.\n\n   For more information, please refer to:\n   https://github.com/astropy/astropy/pull/7874\n   http://www.robotstxt.org/meta.html\n   https://github.com/rtfd/readthedocs.org/blob/master/readthedocs/builds/version_slug.py\n#}\n\n{% extends \"!layout.html\" %}\n{%- block extrahead %}\n  {% if not version_slug in to_be_indexed  %}\n  <meta name=\"robots\" content=\"noindex, nofollow\">\n  {% endif %}\n  {{ super() }}\n{% endblock %}\n"},{"id":470,"name":"docs/timeseries","nodeType":"Package"},{"id":471,"name":"pandas.rst","nodeType":"TextFile","path":"docs/timeseries","text":".. _timeseries-pandas:\n\nInterfacing with the Pandas Package\n***********************************\n\nThe `astropy.timeseries` package is not the only package to provide\nfunctionality related to time series. Another notable package is `pandas\n<https://pandas.pydata.org/>`_, which provides a :class:`pandas.DataFrame`\nclass. The main benefits of `astropy.timeseries` in the context of astronomical\nresearch are the following:\n\n* The time column is a |Time| object that supports very high precision\n  representation of times, and makes it easy to convert between different\n  time scales and formats (e.g., ISO 8601 timestamps, Julian Dates, and so on).\n* The data columns can include |Quantity| objects with units.\n* The |BinnedTimeSeries| class includes variable-width time bins.\n* There are built-in readers for common time series file formats, as well as\n  the ability to define custom readers/writers.\n\nNevertheless, there are cases where using pandas :class:`~pandas.DataFrame`\nobjects might make sense, so we provide methods to convert to/from\n:class:`~pandas.DataFrame` objects.\n\nExample\n-------\n\n.. EXAMPLE START: Interfacing between Time Series and the Pandas DataFrame\n\nConsider a concise example starting from a :class:`~pandas.DataFrame`:\n\n.. doctest-requires:: pandas\n\n    >>> import pandas\n    >>> import numpy as np\n    >>> df = pandas.DataFrame()\n    >>> df['a'] = [1, 2, 3]\n    >>> times = np.array(['2015-07-04', '2015-07-05', '2015-07-06'], dtype=np.datetime64)\n    >>> df.set_index(pandas.DatetimeIndex(times), inplace=True)\n    >>> df\n        a\n    2015-07-04  1\n    2015-07-05  2\n    2015-07-06  3\n\nWe can convert this to an ``astropy`` |TimeSeries| using\n:meth:`~astropy.timeseries.TimeSeries.from_pandas`:\n\n.. doctest-requires:: pandas\n\n    >>> from astropy.timeseries import TimeSeries\n    >>> ts = TimeSeries.from_pandas(df)\n    >>> ts\n    <TimeSeries length=3>\n                 time               a\n                 Time             int64\n    ----------------------------- -----\n    2015-07-04T00:00:00.000000000     1\n    2015-07-05T00:00:00.000000000     2\n    2015-07-06T00:00:00.000000000     3\n\nConverting to :class:`~pandas.DataFrame` can also be done with\n:meth:`~astropy.timeseries.TimeSeries.to_pandas`:\n\n.. doctest-requires:: pandas\n\n    >>> ts['b'] = [1.2, 3.4, 5.4]\n    >>> df_new = ts.to_pandas()\n    >>> df_new\n                a    b\n    time\n    2015-07-04  1  1.2\n    2015-07-05  2  3.4\n    2015-07-06  3  5.4\n\nMissing values in the time column are supported and correctly converted to a\npandas' NaT object:\n\n.. doctest-requires:: pandas\n\n    >>> ts.time[2] = np.nan\n    >>> ts\n    <TimeSeries length=3>\n                 time               a      b\n                 Time             int64 float64\n    ----------------------------- ----- -------\n    2015-07-04T00:00:00.000000000     1     1.2\n    2015-07-05T00:00:00.000000000     2     3.4\n                               --     3     5.4\n    >>> df_missing = ts.to_pandas()\n    >>> df_missing\n               a    b\n    time\n    2015-07-04  1  1.2\n    2015-07-05  2  3.4\n    NaT         3  5.4\n\n.. EXAMPLE END\n"},{"id":472,"name":"io.rst","nodeType":"TextFile","path":"docs/timeseries","text":".. _timeseries-io:\n\nReading and Writing Time Series\n*******************************\n\nBuilt-in Readers\n================\n\nSince |TimeSeries| and |BinnedTimeSeries| are subclasses of |Table|, they have\n:meth:`~astropy.table.Table.read` and :meth:`~astropy.table.Table.write` methods\nthat can be used to read and write time series from files. We include a few readers for\nwell-defined formats in `astropy.timeseries`. For instance we have readers for\nlight curves in FITS format from the `Kepler\n<https://www.nasa.gov/mission_pages/kepler/main/index.html>`_ and `TESS\n<https://tess.gsfc.nasa.gov/>`_ missions.\n\nExample\n-------\n\n.. EXAMPLE START: Reading and Writing Kepler and TESS TimeSeries\n\nIn this demonstration of using Kepler FITS time series, we start off by fetching\nan example file:\n\n.. plot::\n   :include-source:\n   :context: reset\n   :nofigs:\n\n   from astropy.utils.data import get_pkg_data_filename\n   example_data = get_pkg_data_filename('timeseries/kplr010666592-2009131110544_slc.fits')\n\n.. note::\n    The light curve provided here is handpicked for example purposes. To get\n    other Kepler light curves for science purposes using Python, see the\n    `astroquery <https://astroquery.readthedocs.io>`_ affiliated package.\n\nThis will set ``example_data`` to the filename of the downloaded file (so you\ncan replace this by the filename for the file you want to read in). We can then\nread in the time series using:\n\n.. plot::\n   :include-source:\n   :context:\n   :nofigs:\n\n   from astropy.timeseries import TimeSeries\n   kepler = TimeSeries.read(example_data, format='kepler.fits')\n\nNow we can check that the time series has been read in correctly:\n\n.. plot::\n   :include-source:\n   :context:\n\n   import matplotlib.pyplot as plt\n\n   plt.plot(kepler.time.jd, kepler['sap_flux'], 'k.', markersize=1)\n   plt.xlabel('Julian Date')\n   plt.ylabel('SAP Flux (e-/s)')\n\n.. EXAMPLE END\n\nReading Common Light Curve Formats\n==================================\n\nAt the moment only a few formats are defined in ``astropy`` itself, in part\nbecause there are not many well-documented formats for storing time series. So\nin many cases, you will likely have to first read in your files using the more\ngeneric |Table| class (see :ref:`read_write_tables`). In fact, the\n:meth:`TimeSeries.read <astropy.timeseries.TimeSeries.read>` and\n:meth:`BinnedTimeSeries.read <astropy.timeseries.BinnedTimeSeries.read>` methods\ncan do this behind the scenes. If the table cannot be read by any of the time\nseries readers, these methods will try to use some of the default\n:class:`~astropy.table.Table` readers and then require users to specify the\nnames of the important columns.\n\nExamples\n--------\n\n.. EXAMPLE START: Reading Common Light Curve Formats for Storing Time Series\n\nIf you are reading in a file called :download:`sampled.csv <sampled.csv>` where\nthe time column is called ``Date`` and is an ISO string, you can do::\n\n    >>> from astropy.timeseries import TimeSeries\n    >>> from astropy.utils.data import get_pkg_data_filename\n    >>> sampled_filename = get_pkg_data_filename('data/sampled.csv',\n    ...                                          package='astropy.timeseries.tests')\n    >>> ts = TimeSeries.read(sampled_filename, format='ascii.csv',\n    ...                      time_column='Date')\n    >>> ts[:3]\n    <TimeSeries length=3>\n              time             A       B       C       D       E       F       G\n              Time          float64 float64 float64 float64 float64 float64 float64\n    ----------------------- ------- ------- ------- ------- ------- ------- -------\n    2008-03-18 00:00:00.000   24.68  164.93  114.73   26.27   19.21   28.87   63.44\n    2008-03-19 00:00:00.000   24.18  164.89  114.75   26.22   19.07   27.76   59.98\n    2008-03-20 00:00:00.000   23.99  164.63  115.04   25.78   19.01   27.04   59.61\n\nIf you are reading in a binned time series from a file called\n:download:`binned.csv <binned.csv>` and with a column ``time_start`` giving the\nstart time and ``bin_size`` giving the size of each bin, you can do::\n\n    >>> from astropy import units as u\n    >>> from astropy.timeseries import BinnedTimeSeries\n    >>> binned_filename = get_pkg_data_filename('data/binned.csv',\n    ...                                          package='astropy.timeseries.tests')\n    >>> ts = BinnedTimeSeries.read(binned_filename, format='ascii.csv',\n    ...                            time_bin_start_column='time_start',\n    ...                            time_bin_size_column='bin_size',\n    ...                            time_bin_size_unit=u.s)\n    >>> ts[:3]\n    <BinnedTimeSeries length=3>\n         time_bin_start     time_bin_size ...    E       F\n                                  s       ...\n              Time             float64    ... float64 float64\n    ----------------------- ------------- ... ------- -------\n    2016-03-22T12:30:31.000           3.0 ...   28.87   63.44\n    2016-03-22T12:30:34.000           3.0 ...   27.76   59.98\n    2016-03-22T12:30:37.000           3.0 ...   27.04   59.61\n\nSee the documentation for :meth:`TimeSeries.read\n<astropy.timeseries.TimeSeries.read>` and :meth:`BinnedTimeSeries.read\n<astropy.timeseries.BinnedTimeSeries.read>` for more details.\n\n.. EXAMPLE END\n\nAlternatively, you can read in the table using your own code then construct the\n|TimeSeries| object as described in :ref:`timeseries-initializing`, although\nthen you cannot write out another time series in the same format.\n\nIf you have written a reader/writer for a commonly used format, please feel free\nto contribute it to ``astropy``!\n"},{"col":0,"comment":"Pad blank space to the input string to be multiple of 80.","endLoc":1299,"header":"def _pad(input)","id":473,"name":"_pad","nodeType":"Function","startLoc":1283,"text":"def _pad(input):\n    \"\"\"Pad blank space to the input string to be multiple of 80.\"\"\"\n\n    _len = len(input)\n    if _len == Card.length:\n        return input\n    elif _len > Card.length:\n        strlen = _len % Card.length\n        if strlen == 0:\n            return input\n        else:\n            return input + ' ' * (Card.length - strlen)\n\n    # minimum length is 80\n    else:\n        strlen = _len % Card.length\n        return input + ' ' * (Card.length - strlen)"},{"id":474,"name":"lombscargle.rst","nodeType":"TextFile","path":"docs/timeseries","text":".. _stats-lombscargle:\n\n*************************\nLomb-Scargle Periodograms\n*************************\n\nThe Lomb-Scargle periodogram (after Lomb [1]_, and Scargle [2]_) is a commonly\nused statistical tool designed to detect periodic signals in unevenly spaced\nobservations. The :class:`~astropy.timeseries.LombScargle` class is a unified\ninterface to several implementations of the Lomb-Scargle periodogram, including\na fast *O[NlogN]* implementation following the algorithm presented by Press &\nRybicki [3]_.\n\nThe code here is adapted from the `astroml`_ package ([4]_, [5]_) and the\n`gatspy`_ package ([6]_, [7]_).  For a detailed practical discussion of the\nLomb-Scargle periodogram, with code examples based on ``astropy``, see\n*Understanding the Lomb-Scargle Periodogram* [11]_, with associated code at\nhttps://github.com/jakevdp/PracticalLombScargle/.\n\n.. _gatspy: https://www.astroml.org/gatspy/\n.. _astroml: https://www.astroml.org/\n\nBasic Usage\n===========\n\n.. Note::\n   All frequencies in :class:`~astropy.timeseries.LombScargle` are **not**\n   angular frequencies, but rather frequencies of oscillation (i.e., number of\n   cycles per unit time).\n\nThe Lomb-Scargle periodogram is designed to detect periodic signals in\nunevenly spaced observations.\n\nExample\n-------\n\n.. EXAMPLE START: Using the Lomb-Scargle Periodogram to Detect Periodic Signals\n\nTo detect periodic signals in unevenly spaced observations, consider the\nfollowing data:\n\n>>> import numpy as np\n>>> rand = np.random.default_rng(42)\n>>> t = 100 * rand.random(100)\n>>> y = np.sin(2 * np.pi * t) + 0.1 * rand.standard_normal(100)\n\nThese are 100 noisy measurements taken at irregular times, with a frequency\nof 1 cycle per unit time.\n\nThe Lomb-Scargle periodogram, evaluated at frequencies chosen\nautomatically based on the input data, can be computed as follows\nusing the :class:`~astropy.timeseries.LombScargle` class:\n\n>>> from astropy.timeseries import LombScargle\n>>> frequency, power = LombScargle(t, y).autopower()\n\nPlotting the result with Matplotlib gives:\n\n>>> import matplotlib.pyplot as plt  # doctest: +SKIP\n>>> plt.plot(frequency, power)       # doctest: +SKIP\n\n.. plot::\n\n    from astropy.timeseries import LombScargle\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    rand = np.random.default_rng(42)\n    t = 100 * rand.random(100)\n    y = np.sin(2 * np.pi * t) + 0.1 * rand.standard_normal(100)\n\n    frequency, power = LombScargle(t, y).autopower()\n    fig = plt.figure(figsize=(6, 4.5))\n    plt.plot(frequency, power)\n\nThe periodogram shows a clear spike at a frequency of 1 cycle per unit time,\nas we would expect from the data we constructed.\n\n.. EXAMPLE END\n\nMeasurement Uncertainties\n-------------------------\n\nThe :class:`~astropy.timeseries.LombScargle` interface can also handle data with\nmeasurement uncertainties.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Using the Lomb-Scargle Periodogram with Measurement Uncertainties\n\nIf all uncertainties are the same, you can pass a scalar:\n\n>>> dy = 0.1\n>>> frequency, power = LombScargle(t, y, dy).autopower()\n\nIf uncertainties vary from observation to observation, you can pass them as\nan array:\n\n>>> dy = 0.1 * (1 + rand.random(100))\n>>> y = np.sin(2 * np.pi * t) + dy * rand.standard_normal(100)\n>>> frequency, power = LombScargle(t, y, dy).autopower()\n\nGaussian uncertainties are assumed, and ``dy`` here specifies the standard\ndeviation (not the variance).\n\n.. EXAMPLE END\n\nPeriodograms and Units\n----------------------\n\nThe :class:`~astropy.timeseries.LombScargle` interface properly handles\n:class:`~astropy.units.Quantity` objects with units attached,\nand will validate the inputs to make sure units are appropriate.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Using the LombScargle Class with Quantity Objects\n\nTo use the :class:`~astropy.timeseries.LombScargle` for\n:class:`~astropy.units.Quantity` objects with units attached:\n\n>>> import astropy.units as u\n>>> t_days = t * u.day\n>>> y_mags = y * u.mag\n>>> dy_mags = y * u.mag\n>>> frequency, power = LombScargle(t_days, y_mags, dy_mags).autopower()\n>>> frequency.unit\nUnit(\"1 / d\")\n>>> power.unit\nUnit(dimensionless)\n\nWe see that the output is dimensionless, which is always the case for the\nstandard normalized periodogram (for more on normalizations,\nsee :ref:`lomb-scargle-normalization` below). If you include arguments to\nautopower such as ``minimum_frequency`` or ``maximum_frequency``, make sure to\nspecify units as well:\n\n>>> frequency, power = LombScargle(t_days, y_mags, dy_mags).autopower(minimum_frequency=1e-5*u.Hz)\n\n.. EXAMPLE END\n\nSpecifying the Frequency\n------------------------\n\nWith the :func:`~astropy.timeseries.LombScargle.autopower` method used above, a\nheuristic is applied to select a suitable frequency grid. By default, the\nheuristic assumes that the width of peaks is inversely proportional to the\nobservation baseline, and that the maximum frequency is a factor of five larger\nthan the so-called \"average Nyquist frequency,\" with computation based on the\naverage observation spacing.\n\nThis heuristic is not universally useful, as the frequencies probed by\nirregularly sampled data can be much higher than the average Nyquist frequency.\nFor this reason, the heuristic can be tuned through keywords passed to the\n:func:`~astropy.timeseries.LombScargle.autopower` method.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Specifying the Frequency with the LombScargle.autopower method\n\nTo tune the heuristic using keywords passed to the\n:func:`~astropy.timeseries.LombScargle.autopower` method:\n\n>>> frequency, power = LombScargle(t, y, dy).autopower(nyquist_factor=2)\n>>> len(frequency), frequency.min(), frequency.max()  # doctest: +FLOAT_CMP\n(500, 0.0010327803641893758, 1.0317475838251864)\n\nHere the highest frequency is two times the average Nyquist frequency.\nIf we increase the ``nyquist_factor``, we can probe higher frequencies:\n\n>>> frequency, power = LombScargle(t, y, dy).autopower(nyquist_factor=10)\n>>> len(frequency), frequency.min(), frequency.max()  # doctest: +FLOAT_CMP\n(2500, 0.0010327803641893758, 5.16286904058269)\n\nAlternatively, we can use the :func:`~astropy.timeseries.LombScargle.power`\nmethod to evaluate the periodogram at a user-specified set of frequencies:\n\n>>> frequency = np.linspace(0.5, 1.5, 1000)\n>>> power = LombScargle(t, y, dy).power(frequency)\n\nNote that the fastest Lomb-Scargle implementation requires regularly spaced\nfrequencies; if frequencies are irregularly spaced, a slower method will be\nused instead.\n\n.. EXAMPLE END\n\nFrequency Grid Spacing\n^^^^^^^^^^^^^^^^^^^^^^\n\nOne common issue with user-specified frequencies is inadvertently choosing\ntoo coarse a grid, such that significant peaks lie between grid points and\nare missed entirely.\n\nExample\n\"\"\"\"\"\"\"\n\n.. EXAMPLE START: Frequency Grid Spacing in Periodograms\n\nImagine you chose to evaluate your periodogram at 100 points:\n\n>>> frequency = np.linspace(0.1, 1.9, 100)\n>>> power = LombScargle(t, y, dy).power(frequency)\n>>> plt.plot(frequency, power)   # doctest: +SKIP\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.timeseries import LombScargle\n\n    rand = np.random.default_rng(42)\n    t = 100 * rand.random(100)\n    dy = 0.1\n    y = np.sin(2 * np.pi * t) + dy * rand.standard_normal(100)\n\n    frequency = np.linspace(0.1, 1.9, 100)\n    power = LombScargle(t, y, dy).power(frequency)\n\n    plt.figure(figsize=(6, 4.5))\n    plt.plot(frequency, power)\n    plt.xlabel('frequency')\n    plt.ylabel('Lomb-Scargle Power')\n    plt.ylim(0, 1)\n\nFrom this plot alone, you might conclude that no clear periodic signal exists in\nthe data.  But this conclusion is in error: there is in fact a strong periodic\nsignal, but the periodogram peak falls in the gap between the chosen grid\npoints!\n\nA more reliable approach is to use the frequency heuristic to decide on the\nappropriate grid spacing, optionally passing a minimum and maximum frequency to\nthe :func:`~astropy.timeseries.LombScargle.autopower` method:\n\n>>> frequency, power = LombScargle(t, y, dy).autopower(minimum_frequency=0.1,\n...                                                    maximum_frequency=1.9)\n>>> len(frequency)\n872\n>>> plt.plot(frequency, power)   # doctest: +SKIP\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.timeseries import LombScargle\n\n    rand = np.random.default_rng(42)\n    t = 100 * rand.random(100)\n    dy = 0.1\n    y = np.sin(2 * np.pi * t) + dy * rand.standard_normal(100)\n\n    frequency, power = LombScargle(t, y, dy).autopower(minimum_frequency=0.1,\n                                                       maximum_frequency=1.9)\n\n    plt.figure(figsize=(6, 4.5))\n    plt.plot(frequency, power)\n    plt.xlabel('frequency')\n    plt.ylabel('Lomb-Scargle Power')\n    plt.ylim(0, 1)\n\nWith a finer grid (here 884 points between 0.1 and 1.9),\nit is clear that there is a very strong periodic signal in the data.\n\n.. EXAMPLE END\n\nBy default, the heuristic aims to have roughly five grid points across each\nsignificant periodogram peak; this can be increased by changing the\n``samples_per_peak`` argument:\n\n>>> frequency, power = LombScargle(t, y, dy).autopower(minimum_frequency=0.1,\n...                                                    maximum_frequency=1.9,\n...                                                    samples_per_peak=10)\n>>> len(frequency)\n1744\n\nKeep in mind that the width of the peak scales inversely with the baseline of\nthe observations (i.e., the difference between the maximum and minimum time),\nand the required number of grid points will scale linearly with the size of\nthe baseline.\n\nThe Lomb-Scargle Model\n----------------------\n\nThe Lomb-Scargle periodogram fits a sinusoidal model to the data at each\nfrequency, with a larger power reflecting a better fit. With this in mind, it is\noften helpful to plot the best-fit sinusoid over the phased data.\n\nExample\n^^^^^^^\n\n.. EXAMPLE START: Computing a Best-Fit Sinusoid Using the LombScargle Class\n\nThis best-fit sinusoid can be computed using the\n:func:`~astropy.timeseries.LombScargle.model` method of the\n:class:`~astropy.timeseries.LombScargle` object:\n\n>>> best_frequency = frequency[np.argmax(power)]\n>>> t_fit = np.linspace(0, 1)\n>>> ls = LombScargle(t, y, dy)\n>>> y_fit = ls.model(t_fit, best_frequency)\n\nWe can then phase the data and plot the Lomb-Scargle model fit:\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    from astropy.timeseries import LombScargle\n\n    rand = np.random.default_rng(42)\n    t = 100 * rand.random(100)\n    dy = 0.1\n    y = np.sin(2 * np.pi * t) + dy * rand.standard_normal(100)\n\n    frequency, power = LombScargle(t, y, dy).autopower(minimum_frequency=0.1,\n                                                       maximum_frequency=1.9)\n    best_frequency = frequency[np.argmax(power)]\n    phase_fit = np.linspace(0, 1)\n    y_fit = LombScargle(t, y, dy).model(t=phase_fit / best_frequency,\n                                        frequency=best_frequency)\n    phase = (t * best_frequency) % 1\n\n    fig, ax = plt.subplots(figsize=(6, 4.5))\n    ax.errorbar(phase, y, dy, fmt='o', mew=0, capsize=0, elinewidth=1.5)\n    ax.plot(phase_fit, y_fit, color='black')\n    ax.invert_yaxis()\n    ax.set(xlabel='phase',\n           ylabel='magnitude',\n           title=f'phased data at frequency={best_frequency:.2f}')\n\nThe best-fit model parameters can be computed with the\n:func:`~astropy.timeseries.LombScargle.model_parameters` method of the\n:class:`~astropy.timeseries.LombScargle` object at a given frequency:\n\n>>> theta = ls.model_parameters(best_frequency)\n>>> theta.round(2)\narray([-0.01,  0.99,  0.11])\n\nThese parameters :math:`\\vec{\\theta}` are fit using the following model:\n\n.. math::\n\n    y(t; f, \\vec{\\theta}) = \\theta_0 + \\sum_{n=1}^{\\tt nterms} [\\theta_{2n-1}\\sin(2\\pi n f t) + \\theta_{2n}\\cos(2\\pi n f t)]\n\nThe model can be constructed from these parameters by computing the associated\n:func:`~astropy.timeseries.LombScargle.offset`, which accounts for the\npre-centering of data (i.e., the ``center_data`` argument), and\n:func:`~astropy.timeseries.LombScargle.design_matrix`, which computes the sine\nand cosine terms for you:\n\n>>> offset = ls.offset()\n>>> design_matrix = ls.design_matrix(best_frequency, t_fit)\n>>> np.allclose(y_fit, offset + design_matrix.dot(theta))\nTrue\n\n.. EXAMPLE END\n\nAdditional Arguments\n--------------------\n\nOn initialization, :class:`~astropy.timeseries.LombScargle` takes a few\nadditional arguments which control the model for the data:\n\n- ``center_data`` (``True`` by default) controls whether the ``y`` values are\n  pre-centered before the algorithm fits the data.  The only time it is really\n  warranted to change the default is if you are computing the periodogram of a\n  sequence of constant values to, for example, estimate the window power\n  spectrum for a series of observations.\n- ``fit_mean`` (``True`` by default) controls whether the model fits for the\n  mean of the data, rather than assuming the mean is zero. When\n  ``fit_mean=True``, the periodogram is more robust than the original\n  Lomb-Scargle formalism, particularly in the case of smaller sample sizes\n  and/or data with nontrivial selection bias. In the literature, this model has\n  variously been called the *date-compensated discrete Fourier transform*, the\n  *floating-mean periodogram*, the *generalized Lomb-Scargle method*, and likely\n  other names as well.\n- ``nterms`` (``1`` by default) controls how many Fourier terms are used in the\n  model. As seen above, the standard Lomb-Scargle periodogram is equivalent to\n  a single-term sinusoidal fit to the data at each frequency; the\n  generalization is to expand this to a truncated Fourier series with multiple\n  frequencies. While this can be very useful in some cases, in others the\n  additional model complexity can lead to spurious periodogram peaks that\n  outweigh the benefit of the more flexible model.\n\n.. _lomb-scargle-normalization:\n\nPeriodogram Normalizations\n==========================\n\nThere are several normalizations of the Lomb-Scargle periodogram found in the\nliterature. :class:`~astropy.timeseries.LombScargle` makes four options\navailable via the ``normalization`` argument: ``normalization='standard'`` (the\ndefault), ``normalization='model'``, ``normalization='log'``, and\n``normalization='psd'``. These normalizations can be thought of in terms of\nleast-squares fits around a constant reference model :math:`M_{ref}` and a\nperiodic model :math:`M(f)` at each frequency, with best-fit sum of residuals\nthat we will denote by :math:`\\chi^2_{ref}` and :math:`\\chi^2(f)` respectively.\n\nStandard Normalization\n----------------------\n\nThe default, the standard normalized periodogram is normalized by the residuals\nof the data around the constant reference model:\n\n.. math::\n\n   P_{standard}(f) = \\frac{\\chi^2_{ref} - \\chi^2(f)}{\\chi^2_{ref}}\n\nThis form of the normalization (``normalization='standard'``) is the default\nchoice used in :class:`~astropy.timeseries.LombScargle`. The resulting power\n*P* is a dimensionless quantity that lies in the range *0 ≤ P ≤ 1*.\n\nModel Normalization\n-------------------\n\nAlternatively, the periodogram is sometimes normalized instead by the residuals\naround the periodic model:\n\n.. math::\n\n   P_{model}(f) = \\frac{\\chi^2_{ref} - \\chi^2(f)}{\\chi^2(f)}\n\nThis form of the normalization can be specified with ``normalization='model'``.\nAs above, the resulting power is a dimensionless quantity that lies in the\nrange *0 ≤ P ≤ ∞*.\n\nLogarithmic Normalization\n-------------------------\n\nAnother form of normalization is to scale the periodogram logarithmically:\n\n.. math::\n\n   P_{log}(f) = \\log \\frac{\\chi^2_{ref}}{\\chi^2(f)}\n\nThis normalization can be specified with ``normalization='log'``, and the\nresulting power is a dimensionless quantity in the range *0 ≤ P ≤ ∞*.\n\nPSD Normalization (Unnormalized)\n--------------------------------\n\nFinally, it is sometimes useful to compute an unnormalized periodogram\n(``normalization='psd'``):\n\n.. math::\n\n   P_{psd}(f) = \\frac{1}{2}\\left(\\chi^2_{ref} - \\chi^2(f)\\right)\n\nWhich, in the case of no-uncertainty, will have units ``y.unit ** 2``.\nThis normalization is constructed to be comparable to the standard Fourier\npower spectral density (PSD):\n\n>>> ls = LombScargle(t_days, y_mags, normalization='psd')\n>>> frequency, power = ls.autopower()\n>>> power.unit\nUnit(\"mag2\")\n\nNote, however, that the ``normalization='psd'`` result only has these units\n*if uncertainties are not specified*. In the presence of uncertainties,\neven the unnormalized PSD periodogram will be dimensionless; this is due to\nthe scaling of data by uncertainty within the Lomb-Scargle computation:\n\n>>> # with uncertainties, PSD power is unitless\n>>> ls = LombScargle(t_days, y_mags, dy_mags, normalization='psd')\n>>> frequency, power = ls.autopower()\n>>> power.unit\nUnit(dimensionless)\n\nThe equivalence of the PSD-normalized periodogram and the Fourier PSD\nin the unnormalized, no-uncertainty case can be confirmed by comparing\nresults directly for uniformly sampled inputs.\n\nWe will first define a convenience function to compute the basic\nFourier periodogram for uniformly sampled quantities:\n\n>>> def fourier_periodogram(t, y):\n...     N = len(t)\n...     frequency = np.fft.fftfreq(N, t[1] - t[0])\n...     y_fft = np.fft.fft(y.value) * y.unit\n...     positive = (frequency > 0)\n...     return frequency[positive], (1. / N) * abs(y_fft[positive]) ** 2\n\nNext we compute the two versions of the PSD from uniformly sampled data:\n\n>>> t_days = np.arange(100) * u.day\n>>> y_mags = rand.standard_normal(100) * u.mag\n>>> frequency, PSD_fourier = fourier_periodogram(t_days, y_mags)\n>>> ls = LombScargle(t_days, y_mags, normalization='psd')\n>>> PSD_LS = ls.power(frequency)\n\nExamining the results, we see that the two outputs match:\n\n>>> u.allclose(PSD_fourier, PSD_LS)\nTrue\n\nThis equivalence is one reason that the Lomb-Scargle periodogram is considered\nto be an extension of the Fourier PSD.\n\nFor more information on the statistical properties of these normalizations,\nsee, for example, Baluev 2008 [8]_.\n\nPeak Significance and False Alarm Probabilities\n===============================================\n\n.. Note::\n   Interpretation of Lomb-Scargle peak significance via false alarm\n   probabilities is a subtle subject, and the quantities computed below are\n   commonly misinterpreted or misused. For a detailed discussion of periodogram\n   peak significance, see [11]_.\n\nWhen using the Lomb-Scargle periodogram to decide whether a signal contains a\nperiodic component, an important consideration is the significance of the\nperiodogram peak. This significance is usually expressed in terms of a\nfalse alarm probability, which encodes the probability of measuring a\npeak of a given height (or higher) conditioned on the assumption that\nthe data consists of Gaussian noise with no periodic component.\n\nExample\n-------\n\n.. EXAMPLE START: Lomb-Scargle Peak Significance via False Alarm Probabilities\n\nTo use the Lomb-Scargle periodogram to decide if our signal contains a periodic\ncomponent, we can start by simulating 60 observations of a sine wave with noise:\n\n>>> t = 100 * rand.random(60)\n>>> dy = 1.0\n>>> y = np.sin(2 * np.pi * t) + dy * rand.standard_normal(60)\n>>> ls = LombScargle(t, y, dy)\n>>> freq, power = ls.autopower()\n>>> print(power.max())  # doctest: +FLOAT_CMP\n0.29154492887882927\n\nThe peak of the periodogram has a value of 0.33, but how significant is\nthis peak? We can address this question using the\n:func:`~astropy.timeseries.LombScargle.false_alarm_probability` method:\n\n.. doctest-requires:: scipy\n\n  >>> ls.false_alarm_probability(power.max())  # doctest: +FLOAT_CMP\n  0.028959671719328808\n\nWhat this tells us is that under the assumption that there is no periodic\nsignal in the data, we will observe a peak this high or higher approximately\n0.4% of the time, which gives a strong indication that a periodic signal is\npresent in the data.\n\n.. Note::\n  Users must interpret this probability carefully: it is a measurement\n  conditioned on the assumption of the null hypothesis of no signal; in symbols,\n  you might write :math:`P({\\rm data} \\mid {\\rm noise-only})`.\n\n  Although it may seem like this quantity could be interpreted with a statement\n  such as \"there is an 0.4% chance that this data is noise only,\" this is *not*\n  a correct statement; in symbols, this statement describes the quantity\n  :math:`P({\\rm noise-only} \\mid {\\rm data})`, and in general :math:`P(A\\mid B)\n  \\ne P(B\\mid A)`.\n\n  See [11]_ for a more detailed discussion of such caveats.\n\nWe might also wish to compute the required peak height to attain any given\nfalse alarm probability, which can be done with the\n:func:`~astropy.timeseries.LombScargle.false_alarm_level` method:\n\n.. doctest-requires:: scipy\n\n  >>> probabilities = [0.1, 0.05, 0.01]\n  >>> ls.false_alarm_level(probabilities)  # doctest: +FLOAT_CMP\n  array([0.25681381, 0.27663466, 0.31928202])\n\nThis tells us that to attain a 10% false alarm probability requires the highest\nperiodogram peak to be approximately 0.25; 5% requires 0.27, and 1% requires\n0.32.\n\n.. EXAMPLE END\n\nFalse Alarm Approximations\n--------------------------\n\nAlthough the false alarm probability at any particular frequency is analytically\ncomputable, there is no closed-form analytic expression for the more relevant\nquantity of the false alarm level of the *highest* peak in a particular\nperiodogram. This must be either determined through bootstrap simulations, or\napproximated by various means.\n\n``astropy`` provides four options for approximating the false alarm probability,\nwhich can be chosen using the ``method`` keyword:\n\n- ``method=\"baluev\"`` (the default) implements the approximation proposed by\n  Baluev 2008 [8]_, which employs extreme value statistics to compute an upper\n  bound of the false alarm probability for the alias-free case. Experiments show\n  that the bound is also useful even for highly aliased observing patterns.\n\n.. doctest-requires:: scipy\n\n    >>> ls.false_alarm_probability(power.max(), method='baluev')  # doctest: +FLOAT_CMP\n    0.028959671719328808\n\n- ``method=\"bootstrap\"`` implements a bootstrap simulation: effectively it\n  computes many Lomb-Scargle periodograms on simulated data at the same\n  observation times. The bootstrap approach can very accurately determine\n  the false alarm probability, but is very computationally expensive.\n  To estimate the level corresponding to a false alarm probability\n  :math:`P_{false}`, it requires on order :math:`n_{boot} \\approx 10/P_{false}`\n  individual periodograms to be computed for the dataset.\n\n.. doctest-requires:: scipy\n\n    >>> ls.false_alarm_probability(power.max(), method='bootstrap')  # doctest: +SKIP\n    0.0030000000000000027\n\n- ``method=\"davies\"`` is related to the Baluev method, but loses accuracy\n  at large false alarm probabilities.\n\n.. doctest-requires:: scipy\n\n    >>> ls.false_alarm_probability(power.max(), method='davies')  # doctest: +FLOAT_CMP\n    0.029387277355227746\n\n- ``method=\"naive\"`` is a basic method based on the assumption that\n  well-separated areas in the periodogram are independent. In general, it\n  provides a very poor estimate of the false alarm probability and should\n  not be used in practice, but is included for completeness.\n\n.. doctest-requires:: scipy\n\n    >>> ls.false_alarm_probability(power.max(), method='naive')  # doctest: +FLOAT_CMP\n    0.00810080828660202\n\nThe following figure compares these false alarm estimates at a range of\npeak heights for 100 observations with a heavily aliased observing pattern:\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    from astropy.timeseries import LombScargle\n\n    rng = np.random.default_rng(42)\n\n    N = 100\n    t = 5 * rng.random(N)\n    t -= 0.5 * (t % 1)  # create alias-inducing structure in the window function\n    dy = 0.5 * (1 + rng.random(N))\n    y = dy * rng.standard_normal(N)\n\n    ls = LombScargle(t, y, dy, normalization='standard')\n    z = np.linspace(1E-3, 0.15, 1000)\n\n    def false_alarm(method):\n        return ls.false_alarm_probability(z, method=method, maximum_frequency=5)\n\n    fa_boot = ls.false_alarm_probability(z, method='bootstrap',\n                                         maximum_frequency=5,\n                                         method_kwds=dict(random_seed=42))\n\n    fig, ax = plt.subplots(figsize=(6, 4.5))\n\n    ax.plot(z, false_alarm('naive'), label='naive estimate')\n    ax.plot(z, false_alarm('baluev'), label='Baluev estimate')\n    ax.plot(z, false_alarm('davies'), ':k', label='Davies bound')\n    ax.plot(z, fa_boot, '-k', label='bootstrap estimate')\n\n    ax.legend(loc='lower left')\n    ax.set(yscale='log',\n           title='False Alarm Estimates (N=100)',\n           xlim=(0, 0.15), ylim=(0.01, 1.5),\n           xlabel='Value of Highest Periodogram Peak',\n           ylabel='False Alarm Probability');\n\nIn general, users should use the bootstrap approach when computationally\nfeasible, and the Baluev approach otherwise.\n\nIn all of this, it is important to keep in mind a few caveats:\n\n- False alarm probabilities are computed relative to a particular set of\n  observing times, and a particular choice of frequency grid.\n- False alarm probabilities are conditioned upon the null hypothesis of\n  data with no periodic component, and in particular say nothing\n  quantitative about whether the data are actually consistent with a\n  periodic model.\n- False alarm probabilities are not related to the question of whether the\n  highest peak in a periodogram is the *correct* peak, and in particular\n  are not especially useful in the case of observations with a strong\n  aliasing pattern.\n\nFor a detailed discussion of these caveats and others when computing and\ninterpreting false alarm probabilities, please refer to [11]_.\n\nPeriodogram Algorithms\n======================\n\nThe :class:`~astropy.timeseries.LombScargle` class makes available\nseveral complementary implementations of the Lomb-Scargle periodogram,\nwhich can be selected using the ``method`` keyword of the Lomb-Scargle power.\nBy design all methods will return the same results (some approximate),\nand each has its advantages and disadvantages.\n\nFor example, to compute a periodogram using the Fast Chi-squared method\nof Palmer (2009) [9]_, you can specify ``method='fastchi2'``:\n\n    >>> frequency, power = LombScargle(t, y).autopower(method='fastchi2')\n\nThere are currently six methods available in the package:\n\n``method='auto'``\n-----------------\n\nThe ``auto`` method is the default, and will attempt to select the best option\nfrom the following methods using heuristics driven by the input data.\n\n``method='slow'``\n-----------------\n\nThe ``slow`` method is a pure Python implementation of the original Lomb-Scargle\nperiodogram ([1]_, [2]_), enhanced to account for observational noise,\nand to allow a floating mean (sometimes called the *generalized periodogram*;\nsee [10]_). The method is not particularly fast, scaling approximately\nas :math:`O[NM]` for :math:`N` data points and :math:`M` frequencies.\n\n``method='cython'``\n-------------------\n\nThe ``cython`` method is a Cython implementation of the same algorithm used for\n``method='slow'``. It is slightly faster than the pure Python implementation,\nbut much more memory-efficient as the size of the inputs grow. The computational\nscaling is approximately :math:`O[NM]` for :math:`N` data points and\n:math:`M` frequencies.\n\n``method='scipy'``\n------------------\n\nThe ``scipy`` method wraps the C implementation of the original Lomb-Scargle\nperiodogram which is available in :func:`scipy.signal.lombscargle`. This is\nslightly faster than the ``slow`` method, but does not allow for errors in\ndata or extensions such as the floating mean. The scaling is approximately\n:math:`O[NM]` for :math:`N` data points and :math:`M` frequencies.\n\n``method='fast'``\n-----------------\n\nThe ``fast`` method is a pure Python implementation of the fast periodogram of\nPress & Rybicki [3]_. It uses an *extrapolation* approach to approximate the\nperiodogram frequencies using a fast Fourier transform. As with the ``slow``\nmethod, it can handle data errors and floating mean.  The scaling is\napproximately :math:`O[N\\log M]` for :math:`N` data points and :math:`M`\nfrequencies. The fast algorithm trades accuracy for speed, and produces a close\napproximation to the true periodogram. In particular, you may observe powers\nless than zero in some cases.\n\n``method='chi2'``\n-----------------\n\nThe ``chi2`` method is a pure Python implementation based on matrix algebra\n(see [7]_). It utilizes the fact that the Lomb-Scargle periodogram at\neach frequency is equivalent to the least-squares fit of a sinusoid to the\ndata. The advantage of the ``chi2`` method is that it allows extensions of\nthe periodogram to multiple Fourier terms, specified by the ``nterms``\nparameter. For the standard problem, it is slightly slower than\n``method='slow'`` and scales as :math:`O[n_fNM]` for :math:`N` data points,\n:math:`M` frequencies, and :math:`n_f` Fourier terms.\n\n``method='fastchi2'``\n---------------------\n\nThe Fast Chi-squared method of Palmer (2009) [9]_ is equivalent to the ``chi2``\nmethod, but the matrices are constructed using an FFT-based approach similar to\nthat of the ``fast`` method. The result is a relatively efficient periodogram\n(though not nearly as efficient as the ``fast`` method) which can be extended to\nmultiple terms. The scaling is approximately :math:`O[n_f(M + N\\log M)]` for\n:math:`N` data points, :math:`M` frequencies, and :math:`n_f` Fourier terms.\n\nSummary\n-------\n\nThe following table summarizes the features of the above algorithms:\n\n==============  ============================  =============  ===============  ========\nMethod          Computational                 Observational  Bias Term        Multiple\n                Scaling                       Uncertainties  (Floating Mean)  Terms\n==============  ============================  =============  ===============  ========\n``\"slow\"``      :math:`O[NM]`                 Yes            Yes              No\n``\"cython\"``    :math:`O[NM]`                 Yes            Yes              No\n``\"scipy\"``     :math:`O[NM]`                 No             No               No\n``\"fast\"``      :math:`O[N\\log M]`            Yes            Yes              No\n``\"chi2\"``      :math:`O[n_fNM]`              Yes            Yes              Yes\n``\"fastchi2\"``  :math:`O[n_f(M + N\\log M)]`   Yes            Yes              Yes\n==============  ============================  =============  ===============  ========\n\nIn the Computational Scaling column, :math:`N` is the number of data points,\n:math:`M` is the number of frequencies, and :math:`n_f` is the number of\nFourier terms for a multi-term fit.\n\n.. _lomb-scargle-example:\n\nRR Lyrae Example\n================\n\n.. EXAMPLE START: Computing a Periodogram for RR Lyrae Data\n\nAn example of computing the periodogram for a more realistic dataset is shown in\nthe following figure. The data here consists of 50 nightly observations of a\nsimulated RR Lyrae-like variable star, with a lightcurve shape that is more\ncomplicated than a simple sine wave:\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    from astropy.timeseries import LombScargle\n\n\n    def simulated_data(N, rseed=2, period=0.41, phase=0.0):\n        \"\"\"Simulate data based from a pre-computed empirical fit\"\"\"\n\n        # coefficients from a 5-term Fourier fit to SDSS object 1019544\n        coeffs = [-0.0191, 0.1375, -0.1968, 0.0959, 0.075,\n                  -0.0686, 0.0307, -0.0045, -0.0421, 0.0216, 0.0041]\n\n        rand = np.random.default_rng(rseed)\n        t = phase + np.arange(N, dtype=float)\n        t += 0.1 * rand.standard_normal(N)\n        dmag = 0.01 + 0.03 * rand.random(N)\n\n        omega = 2 * np.pi / period\n        n = np.arange(1 + len(coeffs) // 2)[:, None]\n\n        mag = (15 + dmag * rand.standard_normal(N)\n               + np.dot(coeffs[::2], np.cos(n * omega * t)) +\n               + np.dot(coeffs[1::2], np.sin(n[1:] * omega * t)))\n\n        return t, mag, dmag\n\n\n    # generate data and compute the periodogram\n    t, mag, dmag = simulated_data(50)\n    ls = LombScargle(t, mag, dmag, normalization='standard')\n    freq, PLS = ls.autopower(minimum_frequency=1 / 1.2,\n                             maximum_frequency=1 / 0.2)\n    best_freq = freq[np.argmax(PLS)]\n    phase = (t * best_freq) % 1\n\n    # compute the best-fit model\n    phase_fit = np.linspace(0, 1)\n    mag_fit = ls.model(t=phase_fit / best_freq,\n                       frequency=best_freq)\n\n    # set up the figure & axes for plotting\n    fig, ax = plt.subplots(1, 2, figsize=(12, 5))\n    fig.suptitle('Lomb-Scargle Periodogram (period=0.41 days)')\n    fig.subplots_adjust(bottom=0.12, left=0.07, right=0.95)\n    inset = fig.add_axes([0.78, 0.56, 0.15, 0.3])\n\n    # plot the raw data\n    ax[0].errorbar(t, mag, dmag, fmt='ok', elinewidth=1.5, capsize=0)\n    ax[0].invert_yaxis()\n    ax[0].set(xlim=(0, 50),\n              xlabel='Observation time (days)',\n              ylabel='Observed Magnitude')\n\n    # plot the periodogram\n    ax[1].plot(1. / freq, PLS)\n    ax[1].set(xlabel='period (days)',\n              ylabel='Lomb-Scargle Power',\n              xlim=(0.2, 1.2),\n              ylim=(0, 1));\n\n    # plot the false-alarm levels\n    z_false = ls.false_alarm_level(0.01, maximum_frequency=1 / 0.2,\n                                   method='baluev')\n    ax[1].axhline(z_false, linestyle='dotted', color='black')\n\n    # plot the phased data & model in the inset\n    inset.errorbar(phase, mag, dmag, fmt='.k', capsize=0)\n    inset.plot(phase_fit, mag_fit)\n    inset.invert_yaxis()\n    inset.set_xlabel('phase')\n    inset.set_ylabel('mag')\n\n\nThe dotted line shows the periodogram level corresponding to a maximum peak\nfalse alarm probability of 1%. This example demonstrates that for irregularly\nsampled data, the Lomb-Scargle periodogram can be sensitive to frequencies\nhigher than the average Nyquist frequency: the above data are sampled at an\naverage rate of roughly one observation per night, and the periodogram\nrelatively cleanly reveals the true period of 0.41 days.\n\nStill, the periodogram has many spurious peaks, which are due to several\nfactors:\n\n1. Errors in observations lead to leakage of power from the true peaks.\n2. The signal is not a perfect sinusoid, so additional peaks can indicate\n   higher frequency components in the signal.\n3. The observations take place only at night, meaning that the survey window has\n   non-negligible power at a frequency of 1 cycle per day.  Thus we expect\n   aliases to appear at :math:`f_{\\rm alias} = f_{\\rm true} + n f_{\\rm window}`\n   for integer values of :math:`n`. With a true period of 0.41 days and a 1-day\n   signal in the observing window, the :math:`n=+1` and :math:`n=-1` aliases to\n   lie at periods of 0.29 and 0.69 days, respectively: these aliases are\n   prominent in the above plot.\n\nThe interaction of these effects means that in practice there is no absolute\nguarantee that the highest peak corresponds to the best frequency, and results\nmust be interpreted carefully.  For a detailed discussion of these effects, see\n[11]_.\n\n.. EXAMPLE END\n\nLiterature References\n=====================\n\n.. [1] Lomb, N.R. *Least-squares frequency analysis of unequally spaced data*.\n       Ap&SS 39 pp. 447-462 (1976)\n.. [2] Scargle, J. D. *Studies in astronomical time series analysis. II -\n       Statistical aspects of spectral analysis of unevenly spaced data*.\n       ApJ 1:263 pp. 835-853 (1982)\n.. [3] Press W.H. and Rybicki, G.B, *Fast algorithm for spectral analysis\n       of unevenly sampled data*. ApJ 1:338, p. 277 (1989)\n.. [4] Vanderplas, J., Connolly, A. Ivezic, Z. & Gray, A. *Introduction to\n       astroML: Machine learning for astrophysics*. Proceedings of the\n       Conference on Intelligent Data Understanding (2012)\n.. [5]  Vanderplas, J., Connolly, A. Ivezic, Z. & Gray, A. *Statistics,\n\tData Mining and Machine Learning in Astronomy*. Princeton Press (2014)}\n.. [6] VanderPlas, J. *Gatspy: General Tools for Astronomical Time Series\n       in Python* (2015) https://zenodo.org/record/14833\n.. [7] VanderPlas, J. & Ivezic, Z. *Periodograms for Multiband Astronomical\n       Time Series*. ApJ 812.1:18 (2015)\n.. [8] Baluev, R.V. *Assessing Statistical Significance of Periodogram Peaks*\n       MNRAS 385, 1279 (2008)\n.. [9] Palmer, D. *A Fast Chi-squared Technique for Period Search of\n       Irregularly Sampled Data*. ApJ 695.1:496 (2009)\n.. [10] Zechmeister, M. and Kurster, M. *The generalised Lomb-Scargle\n       periodogram. A new formalism for the floating-mean and Keplerian\n       periodograms*, A&A 496, 577-584 (2009)\n.. [11] VanderPlas, J. *Understanding the Lomb-Scargle Periodogram*\n\tApJS 236.1:16 (2018)\n\thttps://ui.adsabs.harvard.edu/abs/2018ApJS..236...16V\n"},{"id":475,"name":"data_access.rst","nodeType":"TextFile","path":"docs/timeseries","text":".. _timeseries-data-access:\n\nAccessing Data in Time Series\n*****************************\n\n.. |time_attr| replace:: :attr:`~astropy.timeseries.TimeSeries.time`\n.. |time_bin_start| replace:: :attr:`~astropy.timeseries.BinnedTimeSeries.time_bin_start`\n.. |time_bin_center| replace:: :attr:`~astropy.timeseries.BinnedTimeSeries.time_bin_center`\n.. |time_bin_end| replace:: :attr:`~astropy.timeseries.BinnedTimeSeries.time_bin_end`\n.. |time_bin_size| replace:: :attr:`~astropy.timeseries.BinnedTimeSeries.time_bin_size`\n\nAccessing Data\n==============\n\n.. EXAMPLE START: Accessing Data in Time Series\n\nFor the examples in this page, we will consider a sampled time series\nwith two data columns — ``flux`` and ``temp``::\n\n    >>> from astropy import units as u\n    >>> from astropy.timeseries import TimeSeries\n    >>> ts = TimeSeries(time_start='2016-03-22T12:30:31',\n    ...                 time_delta=3 * u.s,\n    ...                 data={'flux': [1., 4., 5., 3., 2.] * u.Jy,\n    ...                       'temp': [40., 41., 39., 24., 20.] * u.K},\n    ...                 names=('flux', 'temp'))\n\nAs for |Table|, columns can be accessed by name::\n\n    >>> ts['flux']  # doctest: +FLOAT_CMP\n    <Quantity [ 1., 4., 5., 3., 2.] Jy>\n    >>> ts['time']\n    <Time object: scale='utc' format='isot' value=['2016-03-22T12:30:31.000' '2016-03-22T12:30:34.000'\n     '2016-03-22T12:30:37.000' '2016-03-22T12:30:40.000'\n     '2016-03-22T12:30:43.000']>\n\nAnd rows can be accessed by index::\n\n    >>> ts[0]\n    <Row index=0>\n              time            flux    temp\n                               Jy      K\n              Time          float64 float64\n    ----------------------- ------- -------\n    2016-03-22T12:30:31.000     1.0    40.0\n\nAccessing individual values can then be done either by accessing a column and\nthen a row, or vice versa::\n\n    >>> ts[0]['flux']  # doctest: +FLOAT_CMP\n    <Quantity 1. Jy>\n\n    >>> ts['temp'][2]  # doctest: +FLOAT_CMP\n    <Quantity 39. K>\n\n.. EXAMPLE END\n\n.. _timeseries-accessing-times:\n\nAccessing Times\n===============\n\n.. duplicate example from index.rst\n\nFor |TimeSeries|, the ``time`` column can be accessed using the regular column\naccess notation, as shown in `Accessing Data`_, but it can also be accessed\nmore conveniently using the |time_attr| attribute::\n\n    >>> ts.time\n    <Time object: scale='utc' format='isot' value=['2016-03-22T12:30:31.000' '2016-03-22T12:30:34.000'\n     '2016-03-22T12:30:37.000' '2016-03-22T12:30:40.000'\n     '2016-03-22T12:30:43.000']>\n\n.. EXAMPLE START: Accessing the Time Column in BinnedTimeSeries\n\nFor |BinnedTimeSeries|, we provide three attributes: |time_bin_start|,\n|time_bin_center|, and |time_bin_end|::\n\n    >>> from astropy.timeseries import BinnedTimeSeries\n    >>> bts = BinnedTimeSeries(time_bin_start='2016-03-22T12:30:31',\n    ...                        time_bin_size=3 * u.s, n_bins=5)\n    >>> bts.time_bin_start\n    <Time object: scale='utc' format='isot' value=['2016-03-22T12:30:31.000' '2016-03-22T12:30:34.000'\n     '2016-03-22T12:30:37.000' '2016-03-22T12:30:40.000'\n     '2016-03-22T12:30:43.000']>\n    >>> bts.time_bin_center\n    <Time object: scale='utc' format='isot' value=['2016-03-22T12:30:32.500' '2016-03-22T12:30:35.500'\n     '2016-03-22T12:30:38.500' '2016-03-22T12:30:41.500'\n     '2016-03-22T12:30:44.500']>\n    >>> bts.time_bin_end\n    <Time object: scale='utc' format='isot' value=['2016-03-22T12:30:34.000' '2016-03-22T12:30:37.000'\n     '2016-03-22T12:30:40.000' '2016-03-22T12:30:43.000'\n     '2016-03-22T12:30:46.000']>\n\nIn addition, the |time_bin_size| attribute can be used to access the bin sizes::\n\n    >>> bts.time_bin_size  # doctest: +SKIP\n    <Quantity [3., 3., 3., 3., 3.] s>\n\nNote that only |time_bin_start| and |time_bin_size| are available as actual\ncolumns, and |time_bin_center| and |time_bin_end| are computed on the fly.\n\n.. EXAMPLE END\n\nSee :ref:`timeseries-times` for more information about changing between\ndifferent representations of time.\n\nExtracting a Subset of Columns\n==============================\n\n.. EXAMPLE START: Extracting a Subset of Columns in TimeSeries\n\nWe can create a new time series with just the ``flux`` column by doing::\n\n   >>> ts['time', 'flux']\n   <TimeSeries length=5>\n             time            flux\n                              Jy\n             Time          float64\n   ----------------------- -------\n   2016-03-22T12:30:31.000     1.0\n   2016-03-22T12:30:34.000     4.0\n   2016-03-22T12:30:37.000     5.0\n   2016-03-22T12:30:40.000     3.0\n   2016-03-22T12:30:43.000     2.0\n\nNote that the new columns will be copies (not views) of the original columns.\nWe can also create a plain |QTable| by extracting just the ``flux`` and\n``temp`` columns::\n\n   >>> ts['flux', 'temp']\n   <QTable length=5>\n     flux    temp\n       Jy      K\n   float64 float64\n   ------- -------\n       1.0    40.0\n       4.0    41.0\n       5.0    39.0\n       3.0    24.0\n       2.0    20.0\n\n.. EXAMPLE END\n\nExtracting a Subset of Rows\n===========================\n\n.. EXAMPLE START: Extracting a Subset of Rows in TimeSeries\n\n|TimeSeries| objects can be sliced by rows, using the same syntax as for |Time|,\nfor example::\n\n   >>> ts[0:2]\n   <TimeSeries length=2>\n             time            flux    temp\n                              Jy      K\n             Time          float64 float64\n   ----------------------- ------- -------\n   2016-03-22T12:30:31.000     1.0    40.0\n   2016-03-22T12:30:34.000     4.0    41.0\n\n|TimeSeries| objects are also automatically indexed using the functionality\ndescribed in :ref:`table-indexing`. This provides the ability to access rows and\na subset of rows using the :attr:`~astropy.timeseries.TimeSeries.loc` and\n:attr:`~astropy.timeseries.TimeSeries.iloc` attributes.\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Slicing TimeSeries by Time\n\nThe :attr:`~astropy.timeseries.TimeSeries.loc` attribute can be used to slice\n|TimeSeries| objects by time. For example, the following can be used to extract\nall entries for a given timestamp::\n\n   >>> from astropy.time import Time\n   >>> ts.loc[Time('2016-03-22T12:30:31.000')]  # doctest: +SKIP\n   <Row index=0>\n             time            flux    temp\n                              Jy      K\n             Time          float64 float64\n   ----------------------- ------- -------\n   2016-03-22T12:30:31.000     1.0    40.0\n\nOr within a time range::\n\n   >>> ts.loc['2016-03-22T12:30:30':'2016-03-22T12:30:41']\n   <TimeSeries length=4>\n             time            flux    temp\n                              Jy      K\n             Time          float64 float64\n   ----------------------- ------- -------\n   2016-03-22T12:30:31.000     1.0    40.0\n   2016-03-22T12:30:34.000     4.0    41.0\n   2016-03-22T12:30:37.000     5.0    39.0\n   2016-03-22T12:30:40.000     3.0    24.0\n\n.. EXAMPLE END\n\nNote that in this case we did not specify |Time| — this is not needed if the\nstring is an ISO 8601 time string. As for the |QTable| and |Table| class ``loc``\nattribute, in order to be consistent with `pandas\n<https://pandas.pydata.org/>`_, the last item in the ``loc`` range is inclusive.\n\nAlso note that the result will always be sorted by time. Similarly, the\n:attr:`~astropy.timeseries.TimeSeries.iloc` attribute can be used to fetch\nrows from the time series *sorted by time*, so for example, the first two\nentries (by time) can be accessed with::\n\n   >>> ts.iloc[0:2]\n   <TimeSeries length=2>\n             time            flux    temp\n                              Jy      K\n             Time          float64 float64\n   ----------------------- ------- -------\n   2016-03-22T12:30:31.000     1.0    40.0\n   2016-03-22T12:30:34.000     4.0    41.0\n"},{"id":476,"name":"sampled.csv","nodeType":"TextFile","path":"docs/timeseries","text":"Date,A,B,C,D,E,F,G\n2008-03-18,24.68,164.93,114.73,26.27,19.21,28.87,63.44\n2008-03-19,24.18,164.89,114.75,26.22,19.07,27.76,59.98\n2008-03-20,23.99,164.63,115.04,25.78,19.01,27.04,59.61\n2008-03-25,24.14,163.92,114.85,27.41,19.61,27.84,59.41\n2008-03-26,24.44,163.45,114.84,26.86,19.53,28.02,60.09\n2008-03-27,24.38,163.46,115.4,27.09,19.72,28.25,59.62\n2008-03-28,24.32,163.22,115.56,27.13,19.63,28.24,58.65\n2008-03-31,24.19,164.02,115.54,26.74,19.55,28.43,59.2\n2008-04-01,23.81,163.59,115.72,27.82,20.21,29.17,56.18\n2008-04-02,24.03,163.32,115.11,28.22,20.42,29.38,56.64\n2008-04-03,24.34,163.34,115.17,28.14,20.36,29.51,57.49\n"},{"id":477,"name":"times.rst","nodeType":"TextFile","path":"docs/timeseries","text":".. _timeseries-times:\n\nConverting between Different Time Representations\n*************************************************\n\nIn :ref:`timeseries-accessing-times`, we saw how to access the time\ncolumns/attributes of the |TimeSeries| and |BinnedTimeSeries| classes. Here we\nlook in more detail at how to manipulate the resulting times.\n\nConverting Times\n================\n\nSince the time column in time series is always a |Time| object, it is possible\nto use the usual attributes on |Time| to convert the time to different formats\nor scales.\n\nExample\n-------\n\n.. EXAMPLE START: Converting the Time Column to Different Time Formats\n\nTo get the times as modified Julian Dates from a minimal time series::\n\n    >>> from astropy import units as u\n    >>> from astropy.timeseries import TimeSeries\n    >>> ts = TimeSeries(time_start='2016-03-22T12:30:31', time_delta=3 * u.s,\n    ...                 data={'flux': [1., 3., 4., 2., 4.]})\n    >>> ts.time.mjd  # doctest: +FLOAT_CMP\n    array([57469.52119213, 57469.52122685, 57469.52126157, 57469.5212963 ,\n           57469.52133102])\n\nOr to convert the times to the Temps Atomique International (TAI) scale::\n\n    >>> ts.time.tai\n    <Time object: scale='tai' format='isot' value=['2016-03-22T12:31:07.000' '2016-03-22T12:31:10.000'\n     '2016-03-22T12:31:13.000' '2016-03-22T12:31:16.000'\n     '2016-03-22T12:31:19.000']>\n\nTo find the current time scale of the data, you can do::\n\n    >>> ts.time.scale\n    'utc'\n\nSee :ref:`astropy-time` for more documentation on how to access and convert\ntimes.\n\n.. EXAMPLE END\n\nFormatting Times\n================\n\nSince the various time columns are |Time| objects, the default format and scale\nto use for the display of the time series can be changed using the ``format``\nand ``scale`` attributes.\n\nExample\n-------\n\n.. EXAMPLE START: Formatting the Time Column in Time Series\n\nTo change the display of the time series::\n\n    >>> ts.time.format = 'isot'\n    >>> ts\n    <TimeSeries length=5>\n              time            flux\n              Time          float64\n    ----------------------- -------\n    2016-03-22T12:30:31.000     1.0\n    2016-03-22T12:30:34.000     3.0\n    2016-03-22T12:30:37.000     4.0\n    2016-03-22T12:30:40.000     2.0\n    2016-03-22T12:30:43.000     4.0\n    >>> ts.time.format = 'unix'\n    >>> ts  # doctest: +FLOAT_CMP\n    <TimeSeries length=5>\n        time       flux\n        Time     float64\n    ------------ -------\n    1458649831.0     1.0\n    1458649834.0     3.0\n    1458649837.0     4.0\n    1458649840.0     2.0\n    1458649843.0     4.0\n\n.. EXAMPLE END\n\nTimes Relative to Other Times\n=============================\n\nIn some cases, it can be useful to use relative rather than absolute times.\nThis can be done by using the |TimeDelta| class instead of the |Time| class,\nfor example, by subtracting a reference time from an existing |Time| object.\n\nExample\n-------\n\n.. EXAMPLE START: Times Relative to Other Times in Time Series\n\nTo use a relative rather than an absolute time::\n\n    >>> ts_rel = TimeSeries(time=ts.time - ts.time[0])\n    >>> ts_rel  # doctest: +FLOAT_CMP\n    <TimeSeries length=5>\n             time\n           TimeDelta\n    ----------------------\n                       0.0\n     3.472222222222765e-05\n      6.94444444444553e-05\n    0.00010416666666657193\n    0.00013888888888879958\n\nThe |TimeDelta| values can be converted to a different time unit (e.g., second)\nusing::\n\n    >>> ts_rel.time.to('second')\n    <Quantity [ 0.,  3.,  6.,  9., 12.] s>\n\n.. EXAMPLE END\n"},{"id":478,"name":"index.rst","nodeType":"TextFile","path":"docs/timeseries","text":".. _astropy-timeseries:\n\n**********************************\nTime Series (`astropy.timeseries`)\n**********************************\n\nIntroduction\n============\n\nFrom sampling a continuous variable at fixed times to counting events binned\ninto time windows, many different areas of astrophysics require the manipulation\nof 1D time series data. To address this need, the `astropy.timeseries`\nsubpackage provides classes to represent and manipulate time series.\n\nThe time series classes presented below are |QTable| subclasses that have\nspecial columns to represent times using the |Time| class. Therefore, much of\nthe functionality described in :ref:`astropy-table` applies here. But the main\npurpose of the new classes are to provide time series-specific functionality\nabove and beyond |QTable|.\n\nGetting Started\n===============\n\nIn this section, we take a quick look at how to read in a time series, access\nthe data, and carry out some basic analysis. For more details about creating and\nusing time series, see the full documentation in :ref:`using-timeseries`.\n\nThe most basic time series class is |TimeSeries| — it represents a time series\nas a collection of values at specific points in time. If you are interested in\nrepresenting time series as measurements in discrete time bins, you will likely\nbe interested in the |BinnedTimeSeries| subclass which we show in\n:ref:`using-timeseries`).\n\n.. EXAMPLE START: Using the TimeSeries Class\n\nTo start off, we retrieve a FITS file containing a Kepler light curve for a\nsource::\n\n    >>> from astropy.utils.data import get_pkg_data_filename\n    >>> filename = get_pkg_data_filename('timeseries/kplr010666592-2009131110544_slc.fits')  # doctest: +REMOTE_DATA\n\n.. note::\n    The light curve provided here is handpicked for example purposes. For\n    more information about the Kepler FITS format, see\n    `Section 2.3.1 of the Kepler Archive Manual <https://archive.stsci.edu/files/live/sites/mast/files/home/missions-and-data/k2/_documents/MAST_Kepler_Archive_Manual_2020.pdf>`_.\n    To get other light curves for science purposes using Python, see the\n    `astroquery <https://astroquery.readthedocs.io>`_ affiliated package.\n\nWe can then use the |TimeSeries| class to read in this file::\n\n    >>> from astropy.timeseries import TimeSeries\n    >>> ts = TimeSeries.read(filename, format='kepler.fits')  # doctest: +REMOTE_DATA +IGNORE_WARNINGS\n\nTime series are specialized kinds of |Table| objects::\n\n    >>> ts  # doctest: +REMOTE_DATA\n    <TimeSeries length=14280>\n              time             timecorr   ...   pos_corr1      pos_corr2\n                                  d       ...      pix            pix\n              Time             float32    ...    float32        float32\n    ----------------------- ------------- ... -------------- --------------\n    2009-05-02T00:41:40.338  6.630610e-04 ...  1.5822421e-03 -1.4463664e-03\n    2009-05-02T00:42:39.188  6.630857e-04 ...  1.5743829e-03 -1.4540013e-03\n    2009-05-02T00:43:38.045  6.631103e-04 ...  1.5665225e-03 -1.4616371e-03\n    2009-05-02T00:44:36.894  6.631350e-04 ...  1.5586632e-03 -1.4692718e-03\n    2009-05-02T00:45:35.752  6.631597e-04 ...  1.5508028e-03 -1.4769078e-03\n    2009-05-02T00:46:34.601  6.631844e-04 ...  1.5429436e-03 -1.4845425e-03\n    2009-05-02T00:47:33.451  6.632091e-04 ...  1.5350844e-03 -1.4921773e-03\n    2009-05-02T00:48:32.291  6.632337e-04 ...  1.5272264e-03 -1.4998110e-03\n    2009-05-02T00:49:31.149  6.632584e-04 ...  1.5193661e-03 -1.5074468e-03\n                        ...           ... ...            ...            ...\n    2009-05-11T17:58:22.526  1.014493e-03 ...  3.6121816e-03  3.1950327e-03\n    2009-05-11T17:59:21.376  1.014518e-03 ...  3.6102540e-03  3.1872767e-03\n    2009-05-11T18:00:20.225  1.014542e-03 ...  3.6083264e-03  3.1795206e-03\n    2009-05-11T18:01:19.065  1.014567e-03 ...  3.6063993e-03  3.1717657e-03\n    2009-05-11T18:02:17.923  1.014591e-03 ...  3.6044715e-03  3.1640085e-03\n    2009-05-11T18:03:16.772  1.014615e-03 ...  3.6025438e-03  3.1562524e-03\n    2009-05-11T18:04:15.630  1.014640e-03 ...  3.6006160e-03  3.1484952e-03\n    2009-05-11T18:05:14.479  1.014664e-03 ...  3.5986886e-03  3.1407392e-03\n    2009-05-11T18:06:13.328  1.014689e-03 ...  3.5967610e-03  3.1329831e-03\n    2009-05-11T18:07:12.186  1.014713e-03 ...  3.5948332e-03  3.1252259e-03\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Slicing TimeSeries Objects Using Index Notation\n\nIn the same way as for |Table| objects, the various columns and rows of\n|TimeSeries| objects can be accessed and sliced using index notation::\n\n    >>> ts['sap_flux']  # doctest: +REMOTE_DATA\n    <Quantity [1027045.06, 1027184.44, 1027076.25, ..., 1025451.56, 1025468.5 ,\n               1025930.9 ] electron / s>\n\n    >>> ts['time', 'sap_flux']  # doctest: +REMOTE_DATA\n    <TimeSeries length=14280>\n              time             sap_flux\n                             electron / s\n              Time             float32\n    ----------------------- --------------\n    2009-05-02T00:41:40.338  1.0270451e+06\n    2009-05-02T00:42:39.188  1.0271844e+06\n    2009-05-02T00:43:38.045  1.0270762e+06\n    2009-05-02T00:44:36.894  1.0271414e+06\n    2009-05-02T00:45:35.752  1.0271569e+06\n    2009-05-02T00:46:34.601  1.0272296e+06\n    2009-05-02T00:47:33.451  1.0273199e+06\n    2009-05-02T00:48:32.291  1.0271497e+06\n    2009-05-02T00:49:31.149  1.0271755e+06\n                        ...            ...\n    2009-05-11T17:58:22.526  1.0234769e+06\n    2009-05-11T17:59:21.376  1.0234574e+06\n    2009-05-11T18:00:20.225  1.0238128e+06\n    2009-05-11T18:01:19.065  1.0243234e+06\n    2009-05-11T18:02:17.923  1.0244257e+06\n    2009-05-11T18:03:16.772  1.0248654e+06\n    2009-05-11T18:04:15.630  1.0250156e+06\n    2009-05-11T18:05:14.479  1.0254516e+06\n    2009-05-11T18:06:13.328  1.0254685e+06\n    2009-05-11T18:07:12.186  1.0259309e+06\n\n    >>> ts[0:4]  # doctest: +REMOTE_DATA\n    <TimeSeries length=4>\n              time             timecorr   ...   pos_corr1      pos_corr2\n                                  d       ...      pix            pix\n              Time             float32    ...    float32        float32\n    ----------------------- ------------- ... -------------- --------------\n    2009-05-02T00:41:40.338  6.630610e-04 ...  1.5822421e-03 -1.4463664e-03\n    2009-05-02T00:42:39.188  6.630857e-04 ...  1.5743829e-03 -1.4540013e-03\n    2009-05-02T00:43:38.045  6.631103e-04 ...  1.5665225e-03 -1.4616371e-03\n    2009-05-02T00:44:36.894  6.631350e-04 ...  1.5586632e-03 -1.4692718e-03\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Accessing the Time Column in TimeSeries Objects\n\nAs seen in the previous examples, |TimeSeries| objects have a ``time``\ncolumn, which is always the first column. This column can also be accessed using\nthe ``.time`` attribute::\n\n    >>> ts.time  # doctest: +REMOTE_DATA\n    <Time object: scale='tdb' format='isot' value=['2009-05-02T00:41:40.338' '2009-05-02T00:42:39.188'\n      '2009-05-02T00:43:38.045' ... '2009-05-11T18:05:14.479'\n      '2009-05-11T18:06:13.328' '2009-05-11T18:07:12.186']>\n\nThe first column is always a |Time| object (see :ref:`Times and Dates\n<astropy-time>`), which therefore supports the ability to convert to different\ntime scales and formats::\n\n    >>> ts.time.mjd  # doctest: +REMOTE_DATA\n    array([54953.0289391 , 54953.02962023, 54953.03030145, ...,\n           54962.7536398 , 54962.75432093, 54962.75500215])\n\n    >>> ts.time.unix  # doctest: +REMOTE_DATA\n    array([1.24122483e+09, 1.24122489e+09, 1.24122495e+09, ...,\n           1.24206505e+09, 1.24206511e+09, 1.24206517e+09])\n\nWe can also check what time scale the time is defined on::\n\n    >>> ts.time.scale  # doctest: +REMOTE_DATA\n    'tdb'\n\nThis is the Barycentric Dynamical Time scale (see :ref:`astropy-time` for more\ndetails). We can use what we have seen so far to make a plot:\n\n.. plot::\n   :context: reset\n   :nofigs:\n\n    from astropy.utils.data import get_pkg_data_filename\n    filename = get_pkg_data_filename('timeseries/kplr010666592-2009131110544_slc.fits')\n    from astropy.timeseries import TimeSeries\n    ts = TimeSeries.read(filename, format='kepler.fits')\n\n.. plot::\n   :include-source:\n   :context:\n\n   import matplotlib.pyplot as plt\n   plt.plot(ts.time.jd, ts['sap_flux'], 'k.', markersize=1)\n   plt.xlabel('Julian Date')\n   plt.ylabel('SAP Flux (e-/s)')\n\nIt looks like there are a few transits! We can use the\n:class:`~astropy.timeseries.BoxLeastSquares` class to estimate the\nperiod, using the \"box least squares\" (BLS) algorithm::\n\n    >>> import numpy as np\n    >>> from astropy import units as u\n    >>> from astropy.timeseries import BoxLeastSquares\n    >>> periodogram = BoxLeastSquares.from_timeseries(ts, 'sap_flux')  # doctest: +REMOTE_DATA\n\nTo run the periodogram analysis, we use a box with a duration of 0.2 days::\n\n    >>> results = periodogram.autopower(0.2 * u.day)  # doctest: +REMOTE_DATA\n    >>> best = np.argmax(results.power)  # doctest: +REMOTE_DATA\n    >>> period = results.period[best]  # doctest: +REMOTE_DATA\n    >>> period  # doctest: +REMOTE_DATA\n    <Quantity 2.20551724 d>\n    >>> transit_time = results.transit_time[best]  # doctest: +REMOTE_DATA\n    >>> transit_time  # doctest: +REMOTE_DATA\n    <Time object: scale='tdb' format='isot' value=2009-05-02T20:51:16.338>\n\n.. EXAMPLE END\n\nFor more information on available periodogram algorithms, see\n:ref:`periodogram-algorithms`.\n\n.. plot::\n   :context:\n   :nofigs:\n\n   import numpy as np\n   from astropy import units as u\n   from astropy.timeseries import BoxLeastSquares\n   periodogram = BoxLeastSquares.from_timeseries(ts, 'sap_flux')\n   results = periodogram.autopower(0.2 * u.day)\n   best = np.argmax(results.power)\n   period = results.period[best]\n   transit_time = results.transit_time[best]\n\nWe can now fold the time series using the period we found above using the\n:meth:`~astropy.timeseries.TimeSeries.fold` method::\n\n    >>> ts_folded = ts.fold(period=period, epoch_time=transit_time)  # doctest: +REMOTE_DATA\n\n.. plot::\n   :context:\n   :nofigs:\n\n   ts_folded = ts.fold(period=period, epoch_time=transit_time)\n\nNow we can take a look at the folded time series:\n\n.. plot::\n   :context:\n   :nofigs:\n\n   plt.clf()\n\n.. plot::\n   :context:\n   :include-source:\n\n   plt.plot(ts_folded.time.jd, ts_folded['sap_flux'], 'k.', markersize=1)\n   plt.xlabel('Time (days)')\n   plt.ylabel('SAP Flux (e-/s)')\n\nUsing the :ref:`stats` module, we can normalize the flux by sigma-clipping\nthe data to determine the baseline flux::\n\n    >>> from astropy.stats import sigma_clipped_stats\n    >>> mean, median, stddev = sigma_clipped_stats(ts_folded['sap_flux'])  # doctest: +REMOTE_DATA +IGNORE_WARNINGS\n    >>> ts_folded['sap_flux_norm'] = ts_folded['sap_flux'] / median  # doctest: +REMOTE_DATA\n\n.. plot::\n   :context:\n   :nofigs:\n\n   import warnings\n   warnings.filterwarnings('ignore', message='Input data contains invalid values')\n\n   from astropy.stats import sigma_clipped_stats\n   mean, median, stddev = sigma_clipped_stats(ts_folded['sap_flux'])\n   ts_folded['sap_flux_norm'] = ts_folded['sap_flux'] / median\n\nAnd we can downsample the time series by binning the points into bins of equal\ntime — this returns a |BinnedTimeSeries|::\n\n    >>> from astropy.timeseries import aggregate_downsample\n    >>> ts_binned = aggregate_downsample(ts_folded, time_bin_size=0.03 * u.day)  # doctest: +REMOTE_DATA +IGNORE_WARNINGS\n    >>> ts_binned  # doctest: +FLOAT_CMP +REMOTE_DATA\n    <BinnedTimeSeries length=74>\n       time_bin_start   time_bin_size ...        pos_corr2          sap_flux_norm\n                              d       ...           pix\n         TimeDelta         float64    ...         float64              float64\n    ------------------- ------------- ... ----------------------- ------------------\n    -1.1022116370482966          0.03 ...  0.00031207725987769663 0.9998741745948792\n    -1.0722116370482966          0.03 ...  0.00041217938996851444 0.9999074339866638\n    -1.0422116370482966          0.03 ...  0.00039273229776881635  0.999972939491272\n    -1.0122116370482965          0.03 ...   0.0002928022004198283 1.0000077486038208\n    -0.9822116370482965          0.03 ...   0.0003891147789545357 0.9999921917915344\n    -0.9522116370482965          0.03 ...   0.0003491091774776578 1.0000101327896118\n    -0.9222116370482966          0.03 ...   0.0002824827388394624 1.0000121593475342\n    -0.8922116370482965          0.03 ...  0.00016335179680027068 0.9999905228614807\n    -0.8622116370482965          0.03 ...   0.0001397567830281332 1.0000263452529907\n                    ...           ... ...                     ...                ...\n      0.817788362951705          0.03 ... -2.2798192730988376e-05 1.0000624656677246\n      0.847788362951705          0.03 ...  0.00022221534163691103 1.0000633001327515\n      0.877788362951705          0.03 ...  0.00019213277846574783 1.0000433921813965\n     0.9077883629517051          0.03 ...   0.0002187517675338313  1.000024676322937\n     0.9377883629517049          0.03 ...  0.00016979355132207274 1.0000224113464355\n     0.9677883629517047          0.03 ...  0.00014231358363758773 1.0000698566436768\n     0.9977883629517045          0.03 ...   0.0001224415173055604 0.9999606013298035\n     1.0277883629517042          0.03 ...  0.00027701034559868276 0.9999635815620422\n      1.057788362951704          0.03 ...   0.0003093520936090499 0.9999105930328369\n     1.0877883629517038          0.03 ...  0.00022884277859702706 0.9998687505722046\n\n\n.. plot::\n   :context:\n   :nofigs:\n\n   import warnings\n   warnings.filterwarnings('ignore', message='Mean of empty slice')\n\n   from astropy.timeseries import aggregate_downsample\n   ts_binned = aggregate_downsample(ts_folded, time_bin_size=0.03 * u.day)\n\nNow we can take a look at the final result:\n\n.. plot::\n   :context:\n   :nofigs:\n\n   plt.clf()\n\n.. plot::\n   :context:\n   :include-source:\n\n   plt.plot(ts_folded.time.jd, ts_folded['sap_flux_norm'], 'k.', markersize=1)\n   plt.plot(ts_binned.time_bin_start.jd, ts_binned['sap_flux_norm'], 'r-', drawstyle='steps-post')\n   plt.xlabel('Time (days)')\n   plt.ylabel('Normalized flux')\n\nTo learn more about the capabilities in the `astropy.timeseries` module, you can\nfind links to the full documentation in the next section.\n\n.. _using-timeseries:\n\nUsing ``timeseries``\n====================\n\nThe details of using `astropy.timeseries` are provided in the following\nsections:\n\nInitializing and Reading in Time Series\n---------------------------------------\n\n.. toctree::\n   :maxdepth: 2\n\n   initializing\n   io\n\nAccessing Data and Manipulating Time Series\n-------------------------------------------\n\n.. toctree::\n   :maxdepth: 2\n\n   data_access\n   times\n   analysis\n   masking\n   pandas\n\n.. _periodogram-algorithms:\n\nPeriodogram Algorithms\n----------------------\n\n.. toctree::\n   :maxdepth: 2\n\n   lombscargle\n   bls\n\nReference/API\n=============\n\n.. automodapi:: astropy.timeseries\n   :inherited-members:\n\n.. automodapi:: astropy.timeseries.io\n   :inherited-members:\n"},{"id":479,"name":"masking.rst","nodeType":"TextFile","path":"docs/timeseries","text":".. _timeseries-masking:\n\nMasking Values in Time Series\n*****************************\n\n.. warning:: Note that masking does not yet work for columns that have units.\n\nMasking values is done in the same way as for |Table| objects (see\n:ref:`masking_and_missing_values`). The most convenient way to use masking is to\ninitialize a |TimeSeries| object using the ``masked=True`` option.\n\nExample\n-------\n\n.. EXAMPLE START: Masking Values in TimeSeries Objects\n\nWe start by initializing a |TimeSeries| object with ``masked=True``::\n\n    >>> from astropy import units as u\n    >>> from astropy.timeseries import TimeSeries\n    >>> ts = TimeSeries(time_start='2016-03-22T12:30:31',\n    ...                 time_delta=3 * u.s,\n    ...                 n_samples=5, masked=True)\n\nWe can now add some data to our time series::\n\n    >>> ts['flux'] = [1., -2., 5., -1., 4.]\n\nAs you can see, some of the values are negative. We can mask these using::\n\n    >>> ts['flux'].mask = ts['flux'] < 0\n    >>> ts\n    <TimeSeries masked=True length=5>\n              time            flux\n              Time          float64\n    ----------------------- -------\n    2016-03-22T12:30:31.000     1.0\n    2016-03-22T12:30:34.000      --\n    2016-03-22T12:30:37.000     5.0\n    2016-03-22T12:30:40.000      --\n    2016-03-22T12:30:43.000     4.0\n\nWe can also access the mask values::\n\n    >>> ts['flux'].mask\n    array([False,  True, False,  True, False]...)\n\nMasks are column-based, so masking a single cell does not mask the whole row.\nHaving masked cells then allows functions that normally understand masked values\nand operate on columns to ignore the masked entries::\n\n    >>> import numpy as np\n    >>> np.min(ts['flux'])\n    1.0\n    >>> np.ma.median(ts['flux'])\n    4.0\n\n.. EXAMPLE END\n"},{"col":4,"comment":"null","endLoc":539,"header":"@classmethod\n    def _fromcards(cls, cards)","id":480,"name":"_fromcards","nodeType":"Function","startLoc":528,"text":"@classmethod\n    def _fromcards(cls, cards):\n        header = cls()\n        for idx, card in enumerate(cards):\n            header._cards.append(card)\n            keyword = Card.normalize_keyword(card.keyword)\n            header._keyword_indices[keyword].append(idx)\n            if card.field_specifier is not None:\n                header._rvkc_indices[card.rawkeyword].append(idx)\n\n        header._modified = False\n        return header"},{"id":481,"name":"analysis.rst","nodeType":"TextFile","path":"docs/timeseries","text":".. _timeseries-analysis:\n\nManipulation and Analysis of Time Series\n****************************************\n\nCombining Time Series\n=====================\n\nThe :func:`~astropy.table.vstack` and :func:`~astropy.table.hstack` functions\nfrom the :mod:`astropy.table` module can be used to stack time series in\ndifferent ways.\n\nExamples\n--------\n\n.. EXAMPLE START: Stacking Time Series Row-Wise Using table.vstack\n\nTime series can be stacked \"vertically\" or row-wise using the\n:func:`~astropy.table.vstack` function (although note that sampled time\nseries cannot be combined with binned time series and vice versa)::\n\n    >>> from astropy.table import vstack\n    >>> from astropy import units as u\n    >>> from astropy.timeseries import TimeSeries\n    >>> ts_a = TimeSeries(time_start='2016-03-22T12:30:31',\n    ...                   time_delta=3 * u.s,\n    ...                   data={'flux': [1, 4, 5, 3, 2] * u.mJy})\n    >>> ts_b = TimeSeries(time_start='2016-03-22T12:50:31',\n    ...                   time_delta=3 * u.s,\n    ...                   data={'flux': [4, 3, 1, 2, 3] * u.mJy})\n    >>> ts_ab = vstack([ts_a, ts_b])\n    >>> ts_ab\n    <TimeSeries length=10>\n              time            flux\n                              mJy\n              Time          float64\n    ----------------------- -------\n    2016-03-22T12:30:31.000     1.0\n    2016-03-22T12:30:34.000     4.0\n    2016-03-22T12:30:37.000     5.0\n    2016-03-22T12:30:40.000     3.0\n    2016-03-22T12:30:43.000     2.0\n    2016-03-22T12:50:31.000     4.0\n    2016-03-22T12:50:34.000     3.0\n    2016-03-22T12:50:37.000     1.0\n    2016-03-22T12:50:40.000     2.0\n    2016-03-22T12:50:43.000     3.0\n\nNote that :func:`~astropy.table.vstack` does not automatically sort, nor get rid\nof duplicates — this is something you would need to do explicitly afterwards.\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Stacking Time Series Column-Wise Using table.vstack\n\nTime series can also be combined \"horizontally\" or column-wise with other tables\nusing the :func:`~astropy.table.hstack` function, though these should not be\ntime series (as having multiple time columns would be confusing)::\n\n    >>> from astropy.table import Table, hstack\n    >>> data = Table(data={'temperature': [40., 41., 40., 39., 30.] * u.K})\n    >>> ts_a_data = hstack([ts_a, data])\n    >>> ts_a_data\n    <TimeSeries length=5>\n              time            flux  temperature\n                              mJy          K\n              Time          float64    float64\n    ----------------------- ------- -----------\n    2016-03-22T12:30:31.000     1.0        40.0\n    2016-03-22T12:30:34.000     4.0        41.0\n    2016-03-22T12:30:37.000     5.0        40.0\n    2016-03-22T12:30:40.000     3.0        39.0\n    2016-03-22T12:30:43.000     2.0        30.0\n\n.. EXAMPLE END\n\nSorting Time Series\n===================\n\n.. EXAMPLE START: Sorting Time Series\n\nSorting time series in place can be done using the\n:meth:`~astropy.table.Table.sort` method, as for |Table|::\n\n    >>> ts = TimeSeries(time_start='2016-03-22T12:30:31',\n    ...                 time_delta=3 * u.s,\n    ...                 data={'flux': [1., 4., 5., 3., 2.]})\n    >>> ts\n    <TimeSeries length=5>\n              time            flux\n              Time          float64\n    ----------------------- -------\n    2016-03-22T12:30:31.000     1.0\n    2016-03-22T12:30:34.000     4.0\n    2016-03-22T12:30:37.000     5.0\n    2016-03-22T12:30:40.000     3.0\n    2016-03-22T12:30:43.000     2.0\n    >>> ts.sort('flux')\n    >>> ts\n    <TimeSeries length=5>\n              time            flux\n              Time          float64\n    ----------------------- -------\n    2016-03-22T12:30:31.000     1.0\n    2016-03-22T12:30:43.000     2.0\n    2016-03-22T12:30:40.000     3.0\n    2016-03-22T12:30:34.000     4.0\n    2016-03-22T12:30:37.000     5.0\n\n.. EXAMPLE END\n\nResampling\n==========\n\nWe provide a :func:`~astropy.timeseries.aggregate_downsample` function\nthat can be used to bin values from a time series into equal-size or uneven bins,\nand contiguous and non-contiguous bins, using a custom function (mean, median, etc.).\nThis operation returns a |BinnedTimeSeries|. Note that this is a basic function in\nthe sense that it does not, for example, know how to treat columns with uncertainties\ndifferently from other values, and it will blindly apply the custom function\nspecified to all columns.\n\nExample\n-------\n\n.. EXAMPLE START: Creating a BinnedTimeSeries with even contiguous bins\n\nThe following example shows how to use\n:func:`~astropy.timeseries.aggregate_downsample` to bin a light curve from the\nKepler mission into 20 minute contiguous bins using a median function. First,\nwe read in the data using:\n\n.. plot::\n   :include-source:\n   :context: reset\n   :nofigs:\n\n    from astropy.timeseries import TimeSeries\n    from astropy.utils.data import get_pkg_data_filename\n    example_data = get_pkg_data_filename('timeseries/kplr010666592-2009131110544_slc.fits')\n    kepler = TimeSeries.read(example_data, format='kepler.fits')\n\n(See :ref:`timeseries-io` for more details about reading in data). We can then\ndownsample using:\n\n.. plot::\n   :context:\n   :nofigs:\n\n   import warnings\n   warnings.filterwarnings('ignore', message='All-NaN slice encountered')\n\n.. plot::\n   :include-source:\n   :context:\n   :nofigs:\n\n    import numpy as np\n    from astropy import units as u\n    from astropy.timeseries import aggregate_downsample\n    kepler_binned = aggregate_downsample(kepler, time_bin_size=20 * u.min, aggregate_func=np.nanmedian)\n\nWe can take a look at the results:\n\n.. plot::\n   :include-source:\n   :context:\n\n    import matplotlib.pyplot as plt\n    plt.plot(kepler.time.jd, kepler['sap_flux'], 'k.', markersize=1)\n    plt.plot(kepler_binned.time_bin_start.jd, kepler_binned['sap_flux'], 'r-', drawstyle='steps-pre')\n    plt.xlabel('Julian Date')\n    plt.ylabel('SAP Flux (e-/s)')\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Creating a BinnedTimeSeries with uneven contiguous bins\n\nThe :func:`~astropy.timeseries.aggregate_downsample` can also be used\nto bin the light curve into custom bins. The following example shows\nthe case of uneven-size contiguous bins:\n\n.. plot::\n   :context: reset\n   :nofigs:\n\n    import numpy as np\n    from astropy import units as u\n    import matplotlib.pyplot as plt\n    from astropy.timeseries import TimeSeries\n    from astropy.timeseries import aggregate_downsample\n    from astropy.utils.data import get_pkg_data_filename\n\n    example_data = get_pkg_data_filename('timeseries/kplr010666592-2009131110544_slc.fits')\n    kepler = TimeSeries.read(example_data, format='kepler.fits')\n\n    import warnings\n    warnings.filterwarnings('ignore', message='All-NaN slice encountered')\n\n.. plot::\n   :include-source:\n   :context:\n\n    kepler_binned = aggregate_downsample(kepler, time_bin_size=[1000, 125, 80, 25, 150, 210, 273] * u.min,\n                                         aggregate_func=np.nanmedian)\n\n    plt.plot(kepler.time.jd, kepler['sap_flux'], 'k.', markersize=1)\n    plt.plot(kepler_binned.time_bin_start.jd, kepler_binned['sap_flux'], 'r-', drawstyle='steps-pre')\n    plt.xlabel('Julian Date')\n    plt.ylabel('SAP Flux (e-/s)')\n\nTo learn more about the custom binning functionality in\n:func:`~astropy.timeseries.aggregate_downsample`, see\n:ref:`timeseries-binned-initializing`.\n\nFolding\n=======\n\n.. EXAMPLE START: Phase Folding a Time Series\n\nThe |TimeSeries| class has a\n:meth:`~astropy.timeseries.TimeSeries.fold` method that can be used to\nreturn a new time series with a relative and folded time axis. This method\ntakes the period as a :class:`~astropy.units.Quantity`, and optionally takes\nan epoch as a :class:`~astropy.time.Time`, which defines a zero time offset:\n\n.. plot::\n   :context: reset\n   :nofigs:\n\n   import numpy as np\n   from astropy import units as u\n   import matplotlib.pyplot as plt\n   from astropy.timeseries import TimeSeries\n   from astropy.utils.data import get_pkg_data_filename\n\n   example_data = get_pkg_data_filename('timeseries/kplr010666592-2009131110544_slc.fits')\n   kepler = TimeSeries.read(example_data, format='kepler.fits')\n\n.. plot::\n   :include-source:\n   :context:\n\n    kepler_folded = kepler.fold(period=2.2 * u.day, epoch_time='2009-05-02T20:53:40')\n\n    plt.plot(kepler_folded.time.jd, kepler_folded['sap_flux'], 'k.', markersize=1)\n    plt.xlabel('Time from midpoint epoch (days)')\n    plt.ylabel('SAP Flux (e-/s)')\n\nNote that in this example we happened to know the period and midpoint from a\nprevious periodogram analysis. See the example in :doc:`index` for how you\nmight do this.\n\n.. EXAMPLE END\n\nArithmetic\n==========\n\n.. EXAMPLE START: Arithmetic with Time Series\n\nSince |TimeSeries| objects are subclasses of |Table|, they naturally support\narithmetic on any of the data columns. As an example, we can take the folded\nKepler time series we have seen in previous examples, and normalize it to the\nsigma-clipped median value.\n\n.. plot::\n   :context: reset\n   :nofigs:\n\n   import numpy as np\n   from astropy import units as u\n   import matplotlib.pyplot as plt\n   from astropy.timeseries import TimeSeries\n   from astropy.utils.data import get_pkg_data_filename\n\n   example_data = get_pkg_data_filename('timeseries/kplr010666592-2009131110544_slc.fits')\n   kepler = TimeSeries.read(example_data, format='kepler.fits')\n   kepler_folded = kepler.fold(period=2.2 * u.day, epoch_time='2009-05-02T20:53:40')\n\n.. plot::\n   :context:\n   :nofigs:\n\n   import warnings\n   warnings.filterwarnings('ignore', message='Input data contains invalid values')\n\n.. plot::\n   :include-source:\n   :context:\n\n    from astropy.stats import sigma_clipped_stats\n\n    mean, median, stddev = sigma_clipped_stats(kepler_folded['sap_flux'])\n\n    kepler_folded['sap_flux_norm'] = kepler_folded['sap_flux'] / median\n\n    plt.plot(kepler_folded.time.jd, kepler_folded['sap_flux_norm'], 'k.', markersize=1)\n    plt.xlabel('Time from midpoint epoch (days)')\n    plt.ylabel('Normalized flux')\n\n.. EXAMPLE END\n"},{"id":482,"name":"bls.rst","nodeType":"TextFile","path":"docs/timeseries","text":".. _stats-bls:\n\n***********************************\nBox Least Squares (BLS) Periodogram\n***********************************\n\nThe \"box least squares\" (BLS) periodogram [1]_ is a statistical tool used for\ndetecting transiting exoplanets and eclipsing binaries in time series\nphotometric data. The main interface to this implementation is the\n`~astropy.timeseries.BoxLeastSquares` class.\n\nMathematical Background\n=======================\n\nThe BLS method finds transit candidates by modeling a transit as a periodic\nupside down top hat with four parameters: period, duration, depth, and a\nreference time. In this implementation, the reference time is chosen to be the\nmid-transit time of the first transit in the observational baseline. These\nparameters are shown in the following sketch:\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    period = 6\n    t0 = -3\n    duration = 2.5\n    depth = 0.1\n    x = np.linspace(-5, 5, 50000)\n    y = np.ones_like(x)\n    y[np.abs((x-t0+0.5*period)%period-0.5*period)<0.5*duration] = 1.0 - depth\n    plt.figure(figsize=(7, 4))\n    plt.axvline(t0, color=\"k\", ls=\"dashed\", lw=0.75)\n    plt.axvline(t0+period, color=\"k\", ls=\"dashed\", lw=0.75)\n    plt.axhline(1.0-depth, color=\"k\", ls=\"dashed\", lw=0.75)\n    plt.plot(x, y)\n\n    kwargs = dict(\n        va=\"center\", arrowprops=dict(arrowstyle=\"->\", lw=0.5),\n        bbox={\"fc\": \"w\", \"ec\": \"none\"},\n    )\n    plt.annotate(\"period\", xy=(t0+period, 1.01), xytext=(t0+0.5*period, 1.01), ha=\"center\", **kwargs)\n    plt.annotate(\"period\", xy=(t0, 1.01), xytext=(t0+0.5*period, 1.01), ha=\"center\", **kwargs)\n    plt.annotate(\"duration\", xy=(t0-0.5*duration, 1.0-0.5*depth), xytext=(t0, 1.0-0.5*depth), ha=\"center\", **kwargs)\n    plt.annotate(\"duration\", xy=(t0+0.5*duration, 1.0-0.5*depth), xytext=(t0, 1.0-0.5*depth), ha=\"center\", **kwargs)\n    plt.annotate(\"reference time\", xy=(t0, 1.0-depth-0.01), xytext=(t0+0.25*duration, 1.0-depth-0.01), ha=\"left\", **kwargs)\n    plt.annotate(\"depth\", xy=(0.0, 1.0), xytext=(0.0, 1.0-0.5*depth), ha=\"center\", rotation=90, **kwargs)\n    plt.annotate(\"depth\", xy=(0.0, 1.0-depth), xytext=(0.0, 1.0-0.5*depth), ha=\"center\", rotation=90, **kwargs)\n\n\n    plt.ylim(1.0 - depth - 0.02, 1.02)\n    plt.xlim(-5, 5)\n    plt.gca().set_yticks([])\n    plt.gca().set_xticks([])\n    plt.ylabel(\"brightness\")\n    plt.xlabel(\"time\")\n\n    # ****\n\nAssuming that the uncertainties on the measured flux are known, independent,\nand Gaussian, the maximum likelihood in-transit flux can be computed as\n\n.. math::\n\n    y_\\mathrm{in} = \\frac{\\sum_\\mathrm{in} y_n/{\\sigma_n}^2}{\\sum_\\mathrm{in} 1/{\\sigma_n}^2}\n\nwhere :math:`y_n` are the brightness measurements, :math:`\\sigma_n` are the\nassociated uncertainties, and both sums are computed over the in-transit data\npoints.\n\nSimilarly, the maximum likelihood out-of-transit flux is\n\n.. math::\n\n    y_\\mathrm{out} = \\frac{\\sum_\\mathrm{out} y_n/{\\sigma_n}^2}{\\sum_\\mathrm{out} 1/{\\sigma_n}^2}\n\nwhere these sums are over the out-of-transit observations. Using these results,\nthe log likelihood of a transit model (maximized over depth) at a given period\n:math:`P`, duration :math:`\\tau`, and reference time :math:`t_0` is\n\n.. math::\n\n    \\log \\mathcal{L}(P,\\,\\tau,\\,t_0) =\n    -\\frac{1}{2}\\,\\sum_\\mathrm{in}\\frac{(y_n-y_\\mathrm{in})^2}{{\\sigma_n}^2}\n    -\\frac{1}{2}\\,\\sum_\\mathrm{out}\\frac{(y_n-y_\\mathrm{out})^2}{{\\sigma_n}^2}\n    + \\mathrm{constant}\n\nThis equation might be familiar because it is proportional to the \"chi\nsquared\" :math:`\\chi^2` for this model and this is a direct consequence of our\nassumption of Gaussian uncertainties.\n\nThis :math:`\\chi^2` is called the \"signal residue\" by [1]_, so maximizing the\nlog likelihood over duration and reference time is equivalent to computing the\nbox least squares spectrum from [1]_.\n\nIn practice, this is achieved by finding the maximum likelihood model over a\ngrid in duration and reference time as specified by the ``durations`` and\n``oversample`` parameters for the\n`~astropy.timeseries.BoxLeastSquares.power` method.\n\nBehind the scenes, this implementation minimizes the number of required\ncalculations by pre-binning the observations onto a fine grid following [1]_\nand [2]_.\n\nBasic Usage\n===========\n\nThe transit periodogram takes as input time series observations where the\ntimestamps ``t`` and the observations ``y`` (usually brightness) are stored as\n``numpy`` arrays or :class:`~astropy.units.Quantity` objects. If known, error\nbars ``dy`` can also optionally be provided.\n\nExample\n-------\n\n.. EXAMPLE START: Evaluating BLS Periodograms\n\nTo evaluate the periodogram for a simulated data set:\n\n>>> import numpy as np\n>>> import astropy.units as u\n>>> from astropy.timeseries import BoxLeastSquares\n>>> np.random.seed(42)\n>>> t = np.random.uniform(0, 20, 2000)\n>>> y = np.ones_like(t) - 0.1*((t%3)<0.2) + 0.01*np.random.randn(len(t))\n>>> model = BoxLeastSquares(t * u.day, y, dy=0.01)\n>>> periodogram = model.autopower(0.2)\n\nThe output of the `.astropy.timeseries.BoxLeastSquares.autopower` method\nis a `~astropy.timeseries.BoxLeastSquaresResults` object with several\nuseful attributes, the most useful of which are generally the ``period`` and\n``power`` attributes.\n\nThis result can be plotted using matplotlib:\n\n>>> import matplotlib.pyplot as plt                  # doctest: +SKIP\n>>> plt.plot(periodogram.period, periodogram.power)  # doctest: +SKIP\n\n.. plot::\n\n    import numpy as np\n    import astropy.units as u\n    import matplotlib.pyplot as plt\n    from astropy.timeseries import BoxLeastSquares\n\n    np.random.seed(42)\n    t = np.random.uniform(0, 20, 2000)\n    y = np.ones_like(t) - 0.1*((t%3)<0.2) + 0.01*np.random.randn(len(t))\n    model = BoxLeastSquares(t * u.day, y, dy=0.01)\n    periodogram = model.autopower(0.2)\n\n    plt.figure(figsize=(8, 4))\n    plt.plot(periodogram.period, periodogram.power, \"k\")\n    plt.xlabel(\"period [day]\")\n    plt.ylabel(\"power\")\n\nIn this figure, you can see the peak at the correct period of three days.\n\n.. EXAMPLE END\n\nObjectives\n==========\n\nBy default, the `~astropy.timeseries.BoxLeastSquares.power` method computes the\nlog likelihood of the model fit and maximizes over reference time and duration.\nIt is also possible to use the signal-to-noise ratio with which the transit\ndepth is measured as an objective function.\n\nExample\n-------\n\n.. EXAMPLE START: Transit Search with BoxLeastSquares.power and Signal-to-Noise\n\nTo compute the log likelihood of the model fit, call\n`~astropy.timeseries.BoxLeastSquares.power` or\n`~astropy.timeseries.BoxLeastSquares.autopower` with ``objective='snr'`` as\nfollows:\n\n>>> model = BoxLeastSquares(t * u.day, y, dy=0.01)\n>>> periodogram = model.autopower(0.2, objective=\"snr\")\n\n.. plot::\n\n    import numpy as np\n    import astropy.units as u\n    import matplotlib.pyplot as plt\n    from astropy.timeseries import BoxLeastSquares\n\n    np.random.seed(42)\n    t = np.random.uniform(0, 20, 2000)\n    y = np.ones_like(t) - 0.1*((t%3)<0.2) + 0.01*np.random.randn(len(t))\n    model = BoxLeastSquares(t * u.day, y, dy=0.01)\n    periodogram = model.autopower(0.2, objective=\"snr\")\n\n    plt.figure(figsize=(8, 4))\n    plt.plot(periodogram.period, periodogram.power, \"k\")\n    plt.xlabel(\"period [day]\")\n    plt.ylabel(\"depth S/N\")\n\nThis objective will generally produce a periodogram that is qualitatively\nsimilar to the log likelihood spectrum, but it has been used to improve the\nreliability of transit search in the presence of correlated noise.\n\n.. EXAMPLE END\n\nPeriod Grid\n===========\n\nThe transit periodogram is always computed on a grid of periods and the results\ncan be sensitive to the sampling. As discussed in [1]_, the performance of the\ntransit periodogram method is more sensitive to the period grid than the\n`~astropy.timeseries.LombScargle` periodogram.\n\nThis implementation of the transit periodogram includes a conservative heuristic\nfor estimating the required period grid that is used by the\n`~astropy.timeseries.BoxLeastSquares.autoperiod` and\n`~astropy.timeseries.BoxLeastSquares.autopower` methods and the details of this\nmethod are given in the API documentation for\n`~astropy.timeseries.BoxLeastSquares.autoperiod`.\n\nExample\n-------\n\n.. EXAMPLE START: Computing Transit Periodograms on a Grid of Periods\n\nIt is possible to provide a specific period grid as follows:\n\n>>> model = BoxLeastSquares(t * u.day, y, dy=0.01)\n>>> periods = np.linspace(2.5, 3.5, 1000) * u.day\n>>> periodogram = model.power(periods, 0.2)\n\n.. plot::\n\n    import numpy as np\n    import astropy.units as u\n    import matplotlib.pyplot as plt\n    from astropy.timeseries import BoxLeastSquares\n\n    np.random.seed(42)\n    t = np.random.uniform(0, 20, 2000)\n    y = np.ones_like(t) - 0.1*((t%3)<0.2) + 0.01*np.random.randn(len(t))\n    model = BoxLeastSquares(t * u.day, y, dy=0.01)\n    periods = np.linspace(2.5, 3.5, 1000) * u.day\n    periodogram = model.power(periods, 0.2)\n\n    plt.figure(figsize=(8, 4))\n    plt.plot(periodogram.period, periodogram.power, \"k\")\n    plt.xlabel(\"period [day]\")\n    plt.ylabel(\"power\")\n\nHowever, if the period grid is too coarse, the correct period might be missed.\n\n>>> model = BoxLeastSquares(t * u.day, y, dy=0.01)\n>>> periods = np.linspace(0.5, 10.5, 15) * u.day\n>>> periodogram = model.power(periods, 0.2)\n\n.. plot::\n\n    import numpy as np\n    import astropy.units as u\n    import matplotlib.pyplot as plt\n    from astropy.timeseries import BoxLeastSquares\n\n    np.random.seed(42)\n    t = np.random.uniform(0, 20, 2000)\n    y = np.ones_like(t) - 0.1*((t%3)<0.2) + 0.01*np.random.randn(len(t))\n    model = BoxLeastSquares(t * u.day, y, dy=0.01)\n    periods = np.linspace(0.5, 10.5, 15) * u.day\n    periodogram = model.power(periods, 0.2)\n\n    plt.figure(figsize=(8, 4))\n    plt.plot(periodogram.period, periodogram.power, \"k\")\n    plt.xlabel(\"period [day]\")\n    plt.ylabel(\"power\")\n\n.. EXAMPLE END\n\nPeak Statistics\n===============\n\nTo help in the transit vetting process and to debug problems with candidate\npeaks, the `~astropy.timeseries.BoxLeastSquares.compute_stats` method can be\nused to calculate several statistics of a candidate transit.\n\nMany of these statistics are based on the VARTOOLS package described in [2]_.\nThis will often be used as follows to compute stats for the maximum point in\nthe periodogram:\n\n>>> model = BoxLeastSquares(t * u.day, y, dy=0.01)\n>>> periodogram = model.autopower(0.2)\n>>> max_power = np.argmax(periodogram.power)\n>>> stats = model.compute_stats(periodogram.period[max_power],\n...                             periodogram.duration[max_power],\n...                             periodogram.transit_time[max_power])\n\nThis calculates a dictionary with statistics about this candidate.\nEach entry in this dictionary is described in the documentation for\n`~astropy.timeseries.BoxLeastSquares.compute_stats`.\n\n\nLiterature References\n=====================\n\n.. [1] Kovacs, Zucker, & Mazeh (2002), A&A, 391, 369 (arXiv:astro-ph/0206099)\n.. [2] Hartman & Bakos (2016), Astronomy & Computing, 17, 1 (arXiv:1605.06811)\n"},{"id":483,"name":"initializing.rst","nodeType":"TextFile","path":"docs/timeseries","text":".. _timeseries-initializing:\n\nCreating Time Series\n********************\n\nInitializing a Time Series\n==========================\n\nThe first type of time series that we will look at here is a |TimeSeries|\nobject, which can be used for a time series which samples a continuous variable\nat discrete, instantaneous times. Initializing a |TimeSeries| object can be done\nin the same ways as initializing a |Table| object (see :ref:`Data Tables\n<astropy-table>`), but additional arguments related to the times should be\nspecified.\n\nEvenly Sampled Time Series\n--------------------------\n\n.. EXAMPLE START: Constructing an Evenly Sampled TimeSeries\n\nThe most convenient way to construct an evenly sampled |TimeSeries| is to\nspecify the start time, the time interval, and the number of samples::\n\n    >>> from astropy import units as u\n    >>> from astropy.timeseries import TimeSeries\n    >>> ts1 = TimeSeries(time_start='2016-03-22T12:30:31',\n    ...                  time_delta=3 * u.s,\n    ...                  n_samples=5)\n    >>> ts1\n    <TimeSeries length=5>\n              time\n              Time\n    -----------------------\n    2016-03-22T12:30:31.000\n    2016-03-22T12:30:34.000\n    2016-03-22T12:30:37.000\n    2016-03-22T12:30:40.000\n    2016-03-22T12:30:43.000\n\nThe ``time`` keyword argument can be set to anything that can be passed to the\n|Time| class (see also :ref:`Time and Dates <astropy-time>`) or |Time| objects\ndirectly. Note that the ``n_samples`` argument is only needed if you are not\nalso passing in data during initialization (see `Passing Data During\nInitialization`_).\n\n.. EXAMPLE END\n\nArbitrarily Sampled Time Series\n-------------------------------\n\n.. EXAMPLE START: Constructing an Arbitrarily Sampled TimeSeries\n\nTo construct a sampled time series with samples at arbitrary times, you can\npass multiple times to the ``time`` argument::\n\n    >>> ts2 = TimeSeries(time=['2016-03-22T12:30:31',\n    ...                        '2016-03-22T12:30:38',\n    ...                        '2016-03-22T12:34:40'])\n    >>> ts2\n    <TimeSeries length=3>\n              time\n              Time\n    -----------------------\n    2016-03-22T12:30:31.000\n    2016-03-22T12:30:38.000\n    2016-03-22T12:34:40.000\n\nYou can also specify a vector |Time| object directly as the ``time=`` argument,\nor a vector |TimeDelta| argument or a quantity array to the ``time_delta=``\nargument.::\n\n    >>> TimeSeries(time_start=\"2011-01-01T00:00:00\",\n    ...            time_delta=[0.1, 0.2, 0.1, 0.3, 0.2]*u.s)\n    <TimeSeries length=5>\n             time\n             Time\n    -----------------------\n    2011-01-01T00:00:00.000\n    2011-01-01T00:00:00.100\n    2011-01-01T00:00:00.300\n    2011-01-01T00:00:00.400\n    2011-01-01T00:00:00.700\n\n.. EXAMPLE END\n\n.. _timeseries-binned-initializing:\n\nInitializing a Binned Time Series\n=================================\n\nThe |BinnedTimeSeries| can be used to represent time series where each entry\ncorresponds to measurements taken over a range in time — for instance, a light\ncurve constructed by binning X-ray photon events. This class supports equal-size\nor uneven bins, and contiguous and non-contiguous bins. As for |TimeSeries|,\ninitializing a |BinnedTimeSeries| can be done in the same ways as initializing a\n|Table| object (see :ref:`Data Tables <astropy-table>`), but additional\narguments related to the times should be specified as described below.\n\nEqual-Sized Contiguous Bins\n---------------------------\n\n.. EXAMPLE START: Initializing a Binned Time Series with Equal Contiguous Bins\n\nTo create a binned time series with equal-size contiguous bins, it is sufficient\nto specify a start time as well as a bin size::\n\n    >>> from astropy.timeseries import BinnedTimeSeries\n    >>> ts3 = BinnedTimeSeries(time_bin_start='2016-03-22T12:30:31',\n    ...                        time_bin_size=3 * u.s, n_bins=10)\n    >>> ts3\n    <BinnedTimeSeries length=10>\n        time_bin_start     time_bin_size\n                                 s\n              Time             float64\n    ----------------------- -------------\n    2016-03-22T12:30:31.000           3.0\n    2016-03-22T12:30:34.000           3.0\n    2016-03-22T12:30:37.000           3.0\n    2016-03-22T12:30:40.000           3.0\n    2016-03-22T12:30:43.000           3.0\n    2016-03-22T12:30:46.000           3.0\n    2016-03-22T12:30:49.000           3.0\n    2016-03-22T12:30:52.000           3.0\n    2016-03-22T12:30:55.000           3.0\n    2016-03-22T12:30:58.000           3.0\n\nNote that the ``n_bins`` argument is only needed if you are not also passing in\ndata during initialization (see `Passing Data During Initialization`_).\n\n.. EXAMPLE END\n\nUneven Contiguous Bins\n----------------------\n\n.. EXAMPLE START: Initializing a Binned Time Series with Uneven Contiguous Bins\n\nWhen creating a binned time series with uneven contiguous bins, the bin size can\nbe changed to give multiple values (note that in this case ``n_bins`` is not\nrequired)::\n\n    >>> ts4 = BinnedTimeSeries(time_bin_start='2016-03-22T12:30:31',\n    ...                        time_bin_size=[3, 3, 2, 3] * u.s)\n    >>> ts4\n    <BinnedTimeSeries length=4>\n         time_bin_start     time_bin_size\n                                  s\n              Time             float64\n    ----------------------- -------------\n    2016-03-22T12:30:31.000           3.0\n    2016-03-22T12:30:34.000           3.0\n    2016-03-22T12:30:37.000           2.0\n    2016-03-22T12:30:39.000           3.0\n\nAlternatively, you can create the same time series by giving an array of start\ntimes as well as a single end time::\n\n    >>> ts5 = BinnedTimeSeries(time_bin_start=['2016-03-22T12:30:31',\n    ...                                        '2016-03-22T12:30:34',\n    ...                                        '2016-03-22T12:30:37',\n    ...                                        '2016-03-22T12:30:39'],\n    ...                        time_bin_end='2016-03-22T12:30:42')\n    >>> ts5  # doctest: +FLOAT_CMP\n    <BinnedTimeSeries length=4>\n         time_bin_start        time_bin_size\n                                    s\n             Time                float64\n    ----------------------- -----------------\n    2016-03-22T12:30:31.000               3.0\n    2016-03-22T12:30:34.000               3.0\n    2016-03-22T12:30:37.000               2.0\n    2016-03-22T12:30:39.000               3.0\n\n.. EXAMPLE END\n\nUneven Non-Contiguous Bins\n--------------------------\n\n.. EXAMPLE START: Initializing a Binned Time Series with Uneven Non-Contiguous\n   Bins\n\nTo create a binned time series with non-contiguous bins, you can either\nspecify an array of start times and bin widths::\n\n    >>> ts6 = BinnedTimeSeries(time_bin_start=['2016-03-22T12:30:31',\n    ...                                        '2016-03-22T12:30:38',\n    ...                                        '2016-03-22T12:34:40'],\n    ...                        time_bin_size=[5, 100, 2]*u.s)\n    >>> ts6\n    <BinnedTimeSeries length=3>\n         time_bin_start     time_bin_size\n                                  s\n              Time             float64\n    ----------------------- -------------\n    2016-03-22T12:30:31.000           5.0\n    2016-03-22T12:30:38.000         100.0\n    2016-03-22T12:34:40.000           2.0\n\nOr in the most general case, you can also specify multiple times for\n``time_bin_start`` and ``time_bin_end``::\n\n    >>> ts7 = BinnedTimeSeries(time_bin_start=['2016-03-22T12:30:31',\n    ...                                        '2016-03-22T12:30:33',\n    ...                                        '2016-03-22T12:30:40'],\n    ...                        time_bin_end=['2016-03-22T12:30:32',\n    ...                                      '2016-03-22T12:30:35',\n    ...                                      '2016-03-22T12:30:41'])\n    >>> ts7  # doctest: +FLOAT_CMP\n    <BinnedTimeSeries length=3>\n        time_bin_start        time_bin_size\n                                    s\n              Time               float64\n    ----------------------- ------------------\n    2016-03-22T12:30:31.000                1.0\n    2016-03-22T12:30:33.000                2.0\n    2016-03-22T12:30:40.000                1.0\n\n.. EXAMPLE END\n\nAdding Data to the Time Series\n==============================\n\nThe above examples show how to initialize |TimeSeries| objects, but these do not\ninclude any data aside from the times. There are different ways of adding data,\nas with the |Table| class.\n\nPassing Data During Initialization\n----------------------------------\n\n.. EXAMPLE START: Adding Data to a TimeSeries Object During Initialization\n\nIt is possible to pass data during the initialization of a |TimeSeries|\nobject, as for |Table| objects. For instance::\n\n    >>> ts8 = BinnedTimeSeries(time_bin_start=['2016-03-22T12:30:31',\n    ...                                        '2016-03-22T12:30:34',\n    ...                                        '2016-03-22T12:30:37',\n    ...                                        '2016-03-22T12:30:39'],\n    ...                        time_bin_end='2016-03-22T12:30:42',\n    ...                        data={'flux': [1., 4., 5., 6.] * u.mJy})\n    >>> ts8  # doctest: +FLOAT_CMP\n    <BinnedTimeSeries length=4>\n          time_bin_start     time_bin_size     flux\n                                   s            mJy\n              Time              float64       float64\n    ----------------------- ----------------- -------\n    2016-03-22T12:30:31.000               3.0     1.0\n    2016-03-22T12:30:34.000               3.0     4.0\n    2016-03-22T12:30:37.000               2.0     5.0\n    2016-03-22T12:30:39.000               3.0     6.0\n\n.. EXAMPLE END\n\nAdding Data After Initialization\n--------------------------------\n\n.. EXAMPLE START: Adding Data to a TimeSeries Object After Initialization\n\nOnce a |TimeSeries| object is initialized, you can add columns/fields to it as\nyou would for a |Table| object::\n\n    >>> from astropy import units as u\n    >>> ts1['flux'] = [1., 4., 5., 6., 4.] * u.mJy\n    >>> ts1\n    <TimeSeries length=5>\n              time            flux\n                              mJy\n              Time          float64\n    ----------------------- -------\n    2016-03-22T12:30:31.000     1.0\n    2016-03-22T12:30:34.000     4.0\n    2016-03-22T12:30:37.000     5.0\n    2016-03-22T12:30:40.000     6.0\n    2016-03-22T12:30:43.000     4.0\n\n.. EXAMPLE END\n\nAdding Rows\n-----------\n\n.. EXAMPLE START: Adding Rows to a TimeSeries or BinnedTimeSeries\n\nAdding rows to |TimeSeries| or |BinnedTimeSeries| can be done using the\n:meth:`~astropy.table.Table.add_row` method, as for |Table| and |QTable|. This\nmethod takes a dictionary where the keys are column names::\n\n    >>> ts8.add_row({'time_bin_start': '2016-03-22T12:30:44.000',\n    ...              'time_bin_size': 2 * u.s,\n    ...              'flux': 3 * u.mJy})\n    >>> ts8  # doctest: +FLOAT_CMP\n    <BinnedTimeSeries length=5>\n        time_bin_start       time_bin_size      flux\n                                    s           mJy\n              Time               float64      float64\n    ----------------------- ----------------- -------\n    2016-03-22T12:30:31.000               3.0     1.0\n    2016-03-22T12:30:34.000               3.0     4.0\n    2016-03-22T12:30:37.000               2.0     5.0\n    2016-03-22T12:30:39.000               3.0     6.0\n    2016-03-22T12:30:44.000               2.0     3.0\n\nIf you want to be able to skip some values when adding rows, you should make\nsure that masking is enabled — see :ref:`timeseries-masking` for more details.\n\n.. EXAMPLE END\n"},{"id":484,"name":"binned.csv","nodeType":"TextFile","path":"docs/timeseries","text":"time_start,bin_size,time_end,A,B,C,D,E,F\n2016-03-22T12:30:31.000,3,2016-03-22T12:30:34.000,164.93,114.73,26.27,19.21,28.87,63.44\n2016-03-22T12:30:34.000,3,2016-03-22T12:30:37.000,164.89,114.75,26.22,19.07,27.76,59.98\n2016-03-22T12:30:37.000,3,2016-03-22T12:30:40.000,164.63,115.04,25.78,19.01,27.04,59.61\n2016-03-22T12:30:40.000,3,2016-03-22T12:30:43.000,163.92,114.85,27.41,19.61,27.84,59.41\n2016-03-22T12:30:43.000,3,2016-03-22T12:30:46.000,163.45,114.84,26.86,19.53,28.02,60.09\n2016-03-22T12:30:46.000,3,2016-03-22T12:30:49.000,163.46,115.4,27.09,19.72,28.25,59.62\n2016-03-22T12:30:49.000,3,2016-03-22T12:30:52.000,163.22,115.56,27.13,19.63,28.24,58.65\n2016-03-22T12:30:52.000,3,2016-03-22T12:30:55.000,164.02,115.54,26.74,19.55,28.43,59.2\n2016-03-22T12:30:55.000,3,2016-03-22T12:30:58.000,163.59,115.72,27.82,20.21,29.17,56.18\n2016-03-22T12:30:58.000,3,2016-03-22T12:31:01.000,163.32,115.11,28.22,20.42,29.38,56.64\n"},{"id":485,"name":"docs/convolution","nodeType":"Package"},{"id":486,"name":"index.rst","nodeType":"TextFile","path":"docs/convolution","text":".. _astropy_convolve:\n\n*************************************************\nConvolution and Filtering (`astropy.convolution`)\n*************************************************\n\nIntroduction\n============\n\n`astropy.convolution` provides convolution functions and kernels that offer\nimprovements compared to the SciPy `scipy.ndimage` convolution routines,\nincluding:\n\n* Proper treatment of NaN values (ignoring them during convolution and\n  replacing NaN pixels with interpolated values)\n\n* A single function for 1D, 2D, and 3D convolution\n\n* Improved options for the treatment of edges\n\n* Both direct and Fast Fourier Transform (FFT) versions\n\n* Built-in kernels that are commonly used in Astronomy\n\nThe following thumbnails show the difference between ``scipy`` and\n``astropy`` convolve functions on an astronomical image that contains NaN\nvalues. ``scipy``'s function essentially returns NaN for all pixels that are\nwithin a kernel of any NaN value, which is often not the desired result.\n\n.. plot::\n   :context: reset\n   :include-source:\n   :align: center\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n    from astropy.convolution import Gaussian2DKernel\n    from scipy.signal import convolve as scipy_convolve\n    from astropy.convolution import convolve\n\n\n    # Load the data from data.astropy.org\n    filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')\n    hdu = fits.open(filename)[0]\n\n    # Scale the file to have reasonable numbers\n    # (this is mostly so that colorbars do not have too many digits)\n    # Also, we crop it so you can see individual pixels\n    img = hdu.data[50:90, 60:100] * 1e5\n\n    # This example is intended to demonstrate how astropy.convolve and\n    # scipy.convolve handle missing data, so we start by setting the\n    # brightest pixels to NaN to simulate a \"saturated\" data set\n    img[img > 2e1] = np.nan\n\n    # We also create a copy of the data and set those NaNs to zero.  We will\n    # use this for the scipy convolution\n    img_zerod = img.copy()\n    img_zerod[np.isnan(img)] = 0\n\n    # We smooth with a Gaussian kernel with x_stddev=1 (and y_stddev=1)\n    # It is a 9x9 array\n    kernel = Gaussian2DKernel(x_stddev=1)\n\n    # Convolution: scipy's direct convolution mode spreads out NaNs (see\n    # panel 2 below)\n    scipy_conv = scipy_convolve(img, kernel, mode='same', method='direct')\n\n    # scipy's direct convolution mode run on the 'zero'd' image will not\n    # have NaNs, but will have some very low value zones where the NaNs were\n    # (see panel 3 below)\n    scipy_conv_zerod = scipy_convolve(img_zerod, kernel, mode='same',\n                                      method='direct')\n\n    # astropy's convolution replaces the NaN pixels with a kernel-weighted\n    # interpolation from their neighbors\n    astropy_conv = convolve(img, kernel)\n\n\n    # Now we do a bunch of plots.  In the first two plots, the originally masked\n    # values are marked with red X's\n    plt.figure(1, figsize=(12, 12)).clf()\n    ax1 = plt.subplot(2, 2, 1)\n    im = ax1.imshow(img, vmin=-2., vmax=2.e1, origin='lower',\n                    interpolation='nearest', cmap='viridis')\n    y, x = np.where(np.isnan(img))\n    ax1.set_autoscale_on(False)\n    ax1.plot(x, y, 'rx', markersize=4)\n    ax1.set_title(\"Original\")\n    ax1.set_xticklabels([])\n    ax1.set_yticklabels([])\n\n    ax2 = plt.subplot(2, 2, 2)\n    im = ax2.imshow(scipy_conv, vmin=-2., vmax=2.e1, origin='lower',\n                    interpolation='nearest', cmap='viridis')\n    ax2.set_autoscale_on(False)\n    ax2.plot(x, y, 'rx', markersize=4)\n    ax2.set_title(\"Scipy\")\n    ax2.set_xticklabels([])\n    ax2.set_yticklabels([])\n\n    ax3 = plt.subplot(2, 2, 3)\n    im = ax3.imshow(scipy_conv_zerod, vmin=-2., vmax=2.e1, origin='lower',\n                    interpolation='nearest', cmap='viridis')\n    ax3.set_title(\"Scipy nan->zero\")\n    ax3.set_xticklabels([])\n    ax3.set_yticklabels([])\n\n    ax4 = plt.subplot(2, 2, 4)\n    im = ax4.imshow(astropy_conv, vmin=-2., vmax=2.e1, origin='lower',\n                    interpolation='nearest', cmap='viridis')\n    ax4.set_title(\"Default astropy\")\n    ax4.set_xticklabels([])\n    ax4.set_yticklabels([])\n\n    # we make a second plot of the amplitudes vs offset position to more\n    # clearly illustrate the value differences\n    plt.figure(2).clf()\n    plt.plot(img[:, 25], label='input', drawstyle='steps-mid', linewidth=2,\n             alpha=0.5)\n    plt.plot(scipy_conv[:, 25], label='scipy', drawstyle='steps-mid',\n             linewidth=2, alpha=0.5, marker='s')\n    plt.plot(scipy_conv_zerod[:, 25], label='scipy nan->zero',\n             drawstyle='steps-mid', linewidth=2, alpha=0.5, marker='s')\n    plt.plot(astropy_conv[:, 25], label='astropy', drawstyle='steps-mid',\n             linewidth=2, alpha=0.5)\n    plt.ylabel(\"Amplitude\")\n    plt.ylabel(\"Position Offset\")\n    plt.legend(loc='best')\n    plt.show()\n\n\nThe following sections describe how to make use of the convolution functions,\nand how to use built-in convolution kernels:\n\nGetting Started\n===============\n\nTwo convolution functions are provided. They are imported as::\n\n    from astropy.convolution import convolve, convolve_fft\n\nand are both used as::\n\n    result = convolve(image, kernel)\n    result = convolve_fft(image, kernel)\n\n:func:`~astropy.convolution.convolve` is implemented as a direct convolution\nalgorithm, while :func:`~astropy.convolution.convolve_fft` uses a Fast Fourier\nTransform (FFT). Thus, the former is better for small kernels, while the latter\nis much more efficient for larger kernels.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Convolution for User-Specified Kernels\n\nTo convolve a 1D dataset with a user-specified kernel, you can do::\n\n    >>> from astropy.convolution import convolve\n    >>> convolve([1, 4, 5, 6, 5, 7, 8], [0.2, 0.6, 0.2])  # doctest: +FLOAT_CMP\n    array([1.4, 3.6, 5. , 5.6, 5.6, 6.8, 6.2])\n\nNotice that the end points are set to zero — by default, points that are too\nclose to the boundary to have a convolved value calculated are set to zero.\nHowever, the :func:`~astropy.convolution.convolve` function allows for a\n``boundary`` argument that can be used to specify alternate behaviors. For\nexample, setting ``boundary='extend'`` causes values near the edges to be\ncomputed, assuming the original data is simply extended using a constant\nextrapolation beyond the boundary::\n\n    >>> from astropy.convolution import convolve\n    >>> convolve([1, 4, 5, 6, 5, 7, 8], [0.2, 0.6, 0.2], boundary='extend')  # doctest: +FLOAT_CMP\n    array([1.6, 3.6, 5. , 5.6, 5.6, 6.8, 7.8])\n\nThe values at the end are computed assuming that any value below the first\npoint is ``1``, and any value above the last point is ``8``. For a more\ndetailed discussion of boundary treatment, see :doc:`using`.\n\n..\n  EXAMPLE END\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Convolution for Built-In Kernels\n\nThe convolution module also includes built-in kernels that can be imported as,\nfor example::\n\n    >>> from astropy.convolution import Gaussian1DKernel\n\nTo use a kernel, first create a specific instance of the kernel::\n\n    >>> gauss = Gaussian1DKernel(stddev=2)\n\n``gauss`` is not an array, but a kernel object. The underlying array can be\nretrieved with::\n\n    >>> gauss.array  # doctest: +FLOAT_CMP\n    array([6.69151129e-05, 4.36341348e-04, 2.21592421e-03,\n           8.76415025e-03, 2.69954833e-02, 6.47587978e-02,\n           1.20985362e-01, 1.76032663e-01, 1.99471140e-01,\n           1.76032663e-01, 1.20985362e-01, 6.47587978e-02,\n           2.69954833e-02, 8.76415025e-03, 2.21592421e-03,\n           4.36341348e-04, 6.69151129e-05])\n\nThe kernel can then be used directly when calling\n:func:`~astropy.convolution.convolve`:\n\n.. plot::\n   :include-source:\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    from astropy.convolution import Gaussian1DKernel, convolve\n\n    plt.figure(3).clf()\n\n    # Generate fake data\n    x = np.arange(1000).astype(float)\n    y = np.sin(x / 100.) + np.random.normal(0., 1., x.shape)\n    y[::3] = np.nan\n\n    # Create kernel\n    g = Gaussian1DKernel(stddev=50)\n\n    # Convolve data\n    z = convolve(y, g)\n\n    # Plot data before and after convolution\n    plt.plot(x, y, 'k-', label='Before')\n    plt.plot(x, z, 'b-', label='After', alpha=0.5, linewidth=2)\n    plt.legend(loc='best')\n    plt.show()\n\n..\n  EXAMPLE END\n\nUsing ``astropy``'s Convolution to Replace Bad Data\n---------------------------------------------------\n\n``astropy``'s convolution methods can be used to replace bad data with values\ninterpolated from their neighbors. Kernel-based interpolation is useful for\nhandling images with a few bad pixels or for interpolating sparsely sampled\nimages.\n\nThe interpolation tool is implemented and used as::\n\n    from astropy.convolution import interpolate_replace_nans\n    result = interpolate_replace_nans(image, kernel)\n\nSome contexts in which you might want to use kernel-based interpolation include:\n\n * Images with saturated pixels. Generally, these are the highest-intensity\n   regions in the imaged area, and the interpolated values are not reliable,\n   but this can be useful for display purposes.\n * Images with flagged pixels (e.g., a few small regions affected by cosmic\n   rays or other spurious signals that require those pixels to be flagged out).\n   If the affected region is small enough, the resulting interpolation will have\n   a small effect on source statistics and may allow for robust source-finding\n   algorithms to be run on the resulting data.\n * Sparsely sampled images such as those constructed with single-pixel\n   detectors. Such images will only have a few discrete points sampled across\n   the imaged area, but an approximation of the extended sky emission can still\n   be constructed.\n\n.. note::\n    Care must be taken to ensure that the kernel is large enough to completely\n    cover potential contiguous regions of NaN values.\n    An ``AstropyUserWarning`` is raised if NaN values are detected post-\n    convolution, in which case the kernel size should be increased.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Kernel Interpolation to Fill in Flagged-Out Pixels\n\nThe script below shows an example of kernel interpolation to fill in\nflagged-out pixels:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n   import numpy as np\n   import matplotlib.pyplot as plt\n\n   from astropy.io import fits\n   from astropy.utils.data import get_pkg_data_filename\n   from astropy.convolution import Gaussian2DKernel, interpolate_replace_nans\n\n   # Load the data from data.astropy.org\n   filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')\n\n   hdu = fits.open(filename)[0]\n   img = hdu.data[50:90, 60:100] * 1e5\n\n   # This example is intended to demonstrate how astropy.convolve and\n   # scipy.convolve handle missing data, so we start by setting the brightest\n   # pixels to NaN to simulate a \"saturated\" data set\n   img[img > 2e1] = np.nan\n\n   # We smooth with a Gaussian kernel with x_stddev=1 (and y_stddev=1)\n   # It is a 9x9 array\n   kernel = Gaussian2DKernel(x_stddev=1)\n\n   # create a \"fixed\" image with NaNs replaced by interpolated values\n   fixed_image = interpolate_replace_nans(img, kernel)\n\n   # Now we do a bunch of plots.  In the first two plots, the originally masked\n   # values are marked with red X's\n   plt.figure(1, figsize=(12, 6)).clf()\n   plt.close(2) # close the second plot from above\n\n   ax1 = plt.subplot(1, 2, 1)\n   im = ax1.imshow(img, vmin=-2., vmax=2.e1, origin='lower',\n                   interpolation='nearest', cmap='viridis')\n   y, x = np.where(np.isnan(img))\n   ax1.set_autoscale_on(False)\n   ax1.plot(x, y, 'rx', markersize=4)\n   ax1.set_title(\"Original\")\n   ax1.set_xticklabels([])\n   ax1.set_yticklabels([])\n\n   ax2 = plt.subplot(1, 2, 2)\n   im = ax2.imshow(fixed_image, vmin=-2., vmax=2.e1, origin='lower',\n                   interpolation='nearest', cmap='viridis')\n   ax2.set_title(\"Fixed\")\n   ax2.set_xticklabels([])\n   ax2.set_yticklabels([])\n\n..\n  EXAMPLE END\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Kernel Interpolation to Reconstruct Images from Sparse Sampling.\n\nThis script shows the power of this technique for reconstructing images from\nsparse sampling. Note that the image is not perfect: the pointlike sources\nare sometimes missed, but the extended structure is very well recovered by\neye.\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n   import numpy as np\n   import matplotlib.pyplot as plt\n\n   from astropy.io import fits\n   from astropy.utils.data import get_pkg_data_filename\n   from astropy.convolution import Gaussian2DKernel, interpolate_replace_nans\n\n   # Load the data from data.astropy.org\n   filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')\n\n   hdu = fits.open(filename)[0]\n   img = hdu.data[50:90, 60:100] * 1e5\n\n   indices = np.random.randint(low=0, high=img.size, size=300)\n\n   sampled_data = img.flat[indices]\n\n   # Build a new, sparsely sampled version of the original image\n   new_img = np.tile(np.nan, img.shape)\n   new_img.flat[indices] = sampled_data\n\n   # We smooth with a Gaussian kernel with x_stddev=1 (and y_stddev=1)\n   # It is a 9x9 array\n   kernel = Gaussian2DKernel(x_stddev=1)\n\n   # create a \"reconstructed\" image with NaNs replaced by interpolated values\n   reconstructed_image = interpolate_replace_nans(new_img, kernel)\n\n   # Now we do a bunch of plots.  In the first two plots, the originally masked\n   # values are marked with red X's\n   plt.figure(1, figsize=(12, 6)).clf()\n   ax1 = plt.subplot(1, 3, 1)\n   im = ax1.imshow(img, vmin=-2., vmax=2.e1, origin='lower',\n                   interpolation='nearest', cmap='viridis')\n   y, x = np.where(np.isnan(img))\n   ax1.set_autoscale_on(False)\n   ax1.set_title(\"Original\")\n   ax1.set_xticklabels([])\n   ax1.set_yticklabels([])\n\n   ax2 = plt.subplot(1, 3, 2)\n   im = ax2.imshow(new_img, vmin=-2., vmax=2.e1, origin='lower',\n                   interpolation='nearest', cmap='viridis')\n   ax2.set_title(\"Sparsely Sampled\")\n   ax2.set_xticklabels([])\n   ax2.set_yticklabels([])\n\n   ax2 = plt.subplot(1, 3, 3)\n   im = ax2.imshow(reconstructed_image, vmin=-2., vmax=2.e1, origin='lower',\n                   interpolation='nearest', cmap='viridis')\n   ax2.set_title(\"Reconstructed\")\n   ax2.set_xticklabels([])\n   ax2.set_yticklabels([])\n\n..\n  EXAMPLE END\n\nUsing `astropy.convolution`\n===========================\n\n.. toctree::\n   :maxdepth: 2\n\n   using.rst\n   kernels.rst\n   non_normalized_kernels.rst\n\n.. note that if this section gets too long, it should be moved to a separate\n   doc page - see the top of performance.inc.rst for the instructions on how to\n   do that\n.. include:: performance.inc.rst\n\nReference/API\n=============\n\n.. automodapi:: astropy.convolution\n    :no-inheritance-diagram:\n    :skip: MexicanHat1DKernel\n    :skip: MexicanHat2DKernel\n"},{"col":4,"comment":"\n        `classmethod` to convert a keyword value that may contain a\n        field-specifier to uppercase.  The effect is to raise the key to\n        uppercase and leave the field specifier in its original case.\n\n        Parameters\n        ----------\n        keyword : or str\n            A keyword value or a ``keyword.field-specifier`` value\n        ","endLoc":582,"header":"@classmethod\n    def normalize_keyword(cls, keyword)","id":487,"name":"normalize_keyword","nodeType":"Function","startLoc":550,"text":"@classmethod\n    def normalize_keyword(cls, keyword):\n        \"\"\"\n        `classmethod` to convert a keyword value that may contain a\n        field-specifier to uppercase.  The effect is to raise the key to\n        uppercase and leave the field specifier in its original case.\n\n        Parameters\n        ----------\n        keyword : or str\n            A keyword value or a ``keyword.field-specifier`` value\n        \"\"\"\n\n        # Test first for the most common case: a standard FITS keyword provided\n        # in standard all-caps\n        if (len(keyword) <= KEYWORD_LENGTH and\n                cls._keywd_FSC_RE.match(keyword)):\n            return keyword\n\n        # Test if this is a record-valued keyword\n        match = cls._rvkc_keyword_name_RE.match(keyword)\n\n        if match:\n            return '.'.join((match.group('keyword').strip().upper(),\n                             match.group('field_specifier')))\n        elif len(keyword) > 9 and keyword[:9].upper() == 'HIERARCH ':\n            # Remove 'HIERARCH' from HIERARCH keywords; this could lead to\n            # ambiguity if there is actually a keyword card containing\n            # \"HIERARCH HIERARCH\", but shame on you if you do that.\n            return keyword[9:].strip().upper()\n        else:\n            # A normal FITS keyword, but provided in non-standard case\n            return keyword.strip().upper()"},{"id":488,"name":"performance.inc.rst","nodeType":"TextFile","path":"docs/convolution","text":".. note that if this is changed from the default approach of using an *include*\n   (in index.rst) to a separate performance page, the header needs to be changed\n   from === to ***, the filename extension needs to be changed from .inc.rst to\n   .rst, and a link needs to be added in the sub-package toctree\n\n.. _astropy-convolution-performance:\n\nPerformance Tips\n================\n\nThe :func:`~astropy.convolution.convolve` function is best suited to small\nkernels, and can become very slow for larger kernels. In this case, consider\nusing :func:`~astropy.convolution.convolve_fft` (though note that this function\nuses more memory, and consider the different padding options).\n"},{"id":489,"name":"kernels.rst","nodeType":"TextFile","path":"docs/convolution","text":"Convolution Kernels\n*******************\n\nIntroduction and Concept\n========================\n\nThe convolution module provides several built-in kernels to cover the most\ncommon applications in astronomy. It is also possible to define custom kernels\nfrom arrays or combine existing kernels to match specific applications.\n\nEvery filter kernel is characterized by its response function. For time series\nwe speak of an \"impulse response function\" or for images we call it \"point\nspread function.\" This response function is given for every kernel by a\n`~astropy.modeling.FittableModel`, which is evaluated on a grid with\n:func:`~astropy.convolution.discretize_model` to obtain a kernel\narray, which can be used for discrete convolution with the binned data.\n\n\nExamples\n========\n\n1D Kernels\n----------\n\n..\n  EXAMPLE START\n  Using 1D Kernels to Smooth Noisy Data\n\nOne application of filtering is to smooth noisy data. In this case we\nconsider a noisy Lorentz curve:\n\n>>> import numpy as np\n>>> from astropy.modeling.models import Lorentz1D\n>>> from astropy.convolution import convolve, Gaussian1DKernel, Box1DKernel\n>>> lorentz = Lorentz1D(1, 0, 1)\n>>> x = np.linspace(-5, 5, 100)\n>>> data_1D = lorentz(x) + 0.1 * (np.random.rand(100) - 0.5)\n\nSmoothing the noisy data with a `~astropy.convolution.Gaussian1DKernel`\nwith a standard deviation of 2 pixels:\n\n>>> gauss_kernel = Gaussian1DKernel(2)\n>>> smoothed_data_gauss = convolve(data_1D, gauss_kernel)\n\nSmoothing the same data with a `~astropy.convolution.Box1DKernel` of width 5\npixels:\n\n>>> box_kernel = Box1DKernel(5)\n>>> smoothed_data_box = convolve(data_1D, box_kernel)\n\nThe following plot illustrates the results:\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import Lorentz1D\n    from astropy.convolution import convolve, Gaussian1DKernel, Box1DKernel\n\n    # Fake Lorentz data including noise\n    lorentz = Lorentz1D(1, 0, 1)\n    x = np.linspace(-5, 5, 100)\n    data_1D = lorentz(x) + 0.1 * (np.random.rand(100) - 0.5)\n\n    # Smooth data\n    gauss_kernel = Gaussian1DKernel(2)\n    smoothed_data_gauss = convolve(data_1D, gauss_kernel)\n    box_kernel = Box1DKernel(5)\n    smoothed_data_box = convolve(data_1D, box_kernel)\n\n    # Plot data and smoothed data\n    plt.plot(x, data_1D, label='Original')\n    plt.plot(x, smoothed_data_gauss, label='Smoothed with Gaussian1DKernel')\n    plt.plot(x, smoothed_data_box, label='Smoothed with Box1DKernel')\n    plt.xlabel('x [a.u.]')\n    plt.ylabel('amplitude [a.u.]')\n    plt.xlim(-5, 5)\n    plt.ylim(-0.1, 1.5)\n    plt.legend(prop={'size':12})\n    plt.show()\n\n\nBeside the ``astropy`` convolution functions\n`~astropy.convolution.convolve` and\n`~astropy.convolution.convolve_fft`, it is also possible to use\nthe kernels with ``numpy`` or ``scipy`` convolution by passing the ``array``\nattribute. This will be faster in most cases than the ``astropy`` convolution,\nbut will not work properly if NaN values are present in the data.\n\n>>> smoothed = np.convolve(data_1D, box_kernel.array)\n\n..\n  EXAMPLE END\n\n2D Kernels\n----------\n\n..\n  EXAMPLE START\n  Using 2D Kernels to Smooth Noisy Data\n\nAs all 2D kernels are symmetric, it is sufficient to specify the width in one\ndirection. Therefore the use of 2D kernels is basically the same as for 1D\nkernels. Here we consider a small Gaussian-shaped source of amplitude 1 in the\nmiddle of the image and add 10% noise:\n\n>>> import numpy as np\n>>> from astropy.convolution import convolve, Gaussian2DKernel, Tophat2DKernel\n>>> from astropy.modeling.models import Gaussian2D\n>>> gauss = Gaussian2D(1, 0, 0, 3, 3)\n>>> # Fake image data including noise\n>>> x = np.arange(-100, 101)\n>>> y = np.arange(-100, 101)\n>>> x, y = np.meshgrid(x, y)\n>>> data_2D = gauss(x, y) + 0.1 * (np.random.rand(201, 201) - 0.5)\n\nSmoothing the noisy data with a\n:class:`~astropy.convolution.Gaussian2DKernel` with a standard\ndeviation of 2 pixels:\n\n>>> gauss_kernel = Gaussian2DKernel(2)\n>>> smoothed_data_gauss = convolve(data_2D, gauss_kernel)\n\nSmoothing the noisy data with a\n:class:`~astropy.convolution.Tophat2DKernel` of width 5 pixels:\n\n>>> tophat_kernel = Tophat2DKernel(5)\n>>> smoothed_data_tophat = convolve(data_2D, tophat_kernel)\n\nThis is what the original image looks like:\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.modeling.models import Gaussian2D\n    gauss = Gaussian2D(1, 0, 0, 2, 2)\n    # Fake image data including noise\n    x = np.arange(-100, 101)\n    y = np.arange(-100, 101)\n    x, y = np.meshgrid(x, y)\n    data_2D = gauss(x, y) + 0.1 * (np.random.rand(201, 201) - 0.5)\n    plt.imshow(data_2D, origin='lower')\n    plt.xlabel('x [pixels]')\n    plt.ylabel('y [pixels]')\n    plt.colorbar()\n    plt.show()\n\nThe following plot illustrates the differences between several 2D kernels\napplied to the simulated data. Note that it has a slightly different color\nscale compared to the original image.\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    from astropy.convolution import *\n    from astropy.modeling.models import Gaussian2D\n\n    # Small Gaussian source in the middle of the image\n    gauss = Gaussian2D(1, 0, 0, 2, 2)\n    # Fake data including noise\n    x = np.arange(-100, 101)\n    y = np.arange(-100, 101)\n    x, y = np.meshgrid(x, y)\n    data_2D = gauss(x, y) + 0.1 * (np.random.rand(201, 201) - 0.5)\n\n    # Setup kernels, including unity kernel for original image\n    # Choose normalization for linear scale space for RickerWavelet\n\n    kernels = [TrapezoidDisk2DKernel(11, slope=0.2),\n               Tophat2DKernel(11),\n               Gaussian2DKernel(11),\n               Box2DKernel(11),\n               11 ** 2 * RickerWavelet2DKernel(11),\n               AiryDisk2DKernel(11)]\n\n    fig, axes = plt.subplots(nrows=2, ncols=3)\n\n    # Plot kernels\n    for kernel, ax in zip(kernels, axes.flat):\n        smoothed = convolve(data_2D, kernel, normalize_kernel=False)\n        im = ax.imshow(smoothed, vmin=-0.01, vmax=0.08, origin='lower',\n                       interpolation='None')\n        title = kernel.__class__.__name__\n        ax.set_title(title, fontsize=12)\n        ax.set_yticklabels([])\n        ax.set_xticklabels([])\n\n    cax = fig.add_axes([0.9, 0.1, 0.03, 0.8])\n    fig.colorbar(im, cax=cax)\n    plt.subplots_adjust(left=0.05, right=0.85, top=0.95, bottom=0.05)\n    plt.show()\n\n\nThe Gaussian kernel has better smoothing properties compared to the Box and the\nTop Hat. The Box filter is not isotropic and can produce artifacts (the source\nappears rectangular). The Ricker Wavelet filter removes noise and slowly varying\nstructures (i.e., background), but produces a negative ring around the source.\nThe best choice for the filter strongly depends on the application.\n\n..\n  EXAMPLE END\n\nAvailable Kernels\n=================\n\n.. currentmodule:: astropy.convolution\n\n.. autosummary::\n\n   AiryDisk2DKernel\n   Box1DKernel\n   Box2DKernel\n   CustomKernel\n   Gaussian1DKernel\n   Gaussian2DKernel\n   RickerWavelet1DKernel\n   RickerWavelet2DKernel\n   Model1DKernel\n   Model2DKernel\n   Moffat2DKernel\n   Ring2DKernel\n   Tophat2DKernel\n   Trapezoid1DKernel\n   TrapezoidDisk2DKernel\n\nKernel Arithmetics\n==================\n\nAddition and Subtraction\n------------------------\n\nAs convolution is a linear operation, kernels can be added or subtracted from\neach other. They can also be multiplied with some number.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Adding and Subtracting Kernels in astropy.convolution\n\nOne basic example of subtracting kernels would be the definition of a\nDifference of Gaussian filter:\n\n>>> from astropy.convolution import Gaussian1DKernel\n>>> gauss_1 = Gaussian1DKernel(10)\n>>> gauss_2 = Gaussian1DKernel(16)\n>>> DoG = gauss_2 - gauss_1\n\nAnother application is to convolve faked data with an instrument response\nfunction model. For example, if the response function can be described by\nthe weighted sum of two Gaussians:\n\n>>> gauss_1 = Gaussian1DKernel(10)\n>>> gauss_2 = Gaussian1DKernel(16)\n>>> SoG = 4 * gauss_1 + gauss_2\n\nMost times it will be necessary to normalize the resulting kernel by calling\nexplicitly:\n\n>>> SoG.normalize()\n\n..\n  EXAMPLE END\n\nConvolution\n-----------\n\nFurthermore, two kernels can be convolved with each other, which is useful when\ndata is filtered with two different kinds of kernels or to create a new,\nspecial kernel.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Convolving Kernels in astropy.convolution\n\nTo convolve two kernels with each other:\n\n>>> from astropy.convolution import Gaussian1DKernel, convolve\n>>> gauss_1 = Gaussian1DKernel(10)\n>>> gauss_2 = Gaussian1DKernel(16)\n>>> broad_gaussian = convolve(gauss_2,  gauss_1)  # doctest: +IGNORE_WARNINGS\n\nOr in case of multistage smoothing:\n\n>>> import numpy as np\n>>> from astropy.modeling.models import Lorentz1D\n>>> from astropy.convolution import convolve, Gaussian1DKernel, Box1DKernel\n>>> lorentz = Lorentz1D(1, 0, 1)\n>>> x = np.linspace(-5, 5, 100)\n>>> data_1D = lorentz(x) + 0.1 * (np.random.rand(100) - 0.5)\n\n>>> gauss = Gaussian1DKernel(3)\n>>> box = Box1DKernel(5)\n>>> smoothed_gauss = convolve(data_1D, gauss)\n>>> smoothed_gauss_box = convolve(smoothed_gauss, box)\n\nYou would rather do the following:\n\n>>> gauss = Gaussian1DKernel(3)\n>>> box = Box1DKernel(5)\n>>> smoothed_gauss_box = convolve(data_1D, convolve(box, gauss))  # doctest: +IGNORE_WARNINGS\n\nWhich, in most cases, will also be faster than the first method because only\none convolution with the often times larger data array will be necessary.\n\n..\n  EXAMPLE END\n\nDiscretization\n==============\n\nTo obtain the kernel array for discrete convolution, the kernel's response\nfunction is evaluated on a grid with\n:func:`~astropy.convolution.discretize_model`. For the\ndiscretization step the following modes are available:\n\n* Mode ``'center'`` (default) evaluates the response function on the grid by\n  taking the value at the center of the bin.\n\n   >>> from astropy.convolution import Gaussian1DKernel\n   >>> gauss_center = Gaussian1DKernel(3, mode='center')\n\n* Mode ``'linear_interp'`` takes the values at the corners of the bin and\n  linearly interpolates the value at the center:\n\n  >>> gauss_interp = Gaussian1DKernel(3, mode='linear_interp')\n\n* Mode ``'oversample'`` evaluates the response function by taking the mean on an\n  oversampled grid. The oversample factor can be specified with the ``factor``\n  argument. If the oversample factor is too large, the evaluation becomes slow.\n\n >>> gauss_oversample = Gaussian1DKernel(3, mode='oversample', factor=10)\n\n* Mode ``'integrate'`` integrates the function over the pixel using\n  ``scipy.integrate.quad`` and ``scipy.integrate.dblquad``. This mode is very\n  slow and is only recommended when the highest accuracy is required.\n\n.. doctest-requires:: scipy\n\n    >>> gauss_integrate = Gaussian1DKernel(3, mode='integrate')\n\nEspecially in the range where the kernel width is in order of only a few pixels,\nit can be advantageous to use the mode ``oversample`` or ``integrate`` to\nconserve the integral on a subpixel scale.\n\n\nNormalization\n=============\n\nThe kernel models are normalized per default (i.e.,\n:math:`\\int_{-\\infty}^{\\infty} f(x) dx = 1`). But because of the limited kernel\narray size, the normalization for kernels with an infinite response can differ\nfrom one. The value of this deviation is stored in the kernel's ``truncation``\nattribute.\n\nThe normalization can also differ from one, especially for small kernels, due\nto the discretization step. This can be partly controlled by the ``mode``\nargument, when initializing the kernel. (See also\n:func:`~astropy.convolution.discretize_model`.) Setting the\n``mode`` to ``'oversample'`` allows us to conserve the normalization even on the\nsubpixel scale.\n\nThe kernel arrays can be renormalized explicitly by calling either the\n``normalize()`` method or by setting the ``normalize_kernel`` argument in the\n:func:`~astropy.convolution.convolve` and\n:func:`~astropy.convolution.convolve_fft` functions. The latter\nmethod leaves the kernel itself unchanged but works with an internal normalized\nversion of the kernel.\n\nNote that for :class:`~astropy.convolution.RickerWavelet1DKernel`\nand :class:`~astropy.convolution.RickerWavelet2DKernel` there is\n:math:`\\int_{-\\infty}^{\\infty} f(x) dx = 0`. To define a proper normalization,\nboth filters are derived from a normalized Gaussian function.\n"},{"id":490,"name":"non_normalized_kernels.rst","nodeType":"TextFile","path":"docs/convolution","text":"************************************\nConvolving with Unnormalized Kernels\n************************************\n\nThere are some tasks, such as source finding, where you want to apply a filter\nwith a kernel that is not normalized.\n\nFor data that are well-behaved (contain no missing or infinite values), this\ncan be done in one step::\n\n    convolve(image, kernel)\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Convolving with Unnormalized Kernels\n\nFor an example of applying a filter with a kernel that is not normalized, we\ncan try to run a commonly used peak enhancing kernel:\n\n.. plot::\n   :context: reset\n   :include-source:\n   :align: center\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n    from astropy.convolution import CustomKernel\n    from scipy.signal import convolve as scipy_convolve\n    from astropy.convolution import convolve, convolve_fft\n\n\n    # Load the data from data.astropy.org\n    filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')\n    hdu = fits.open(filename)[0]\n\n    # Scale the file to have reasonable numbers\n    # (this is mostly so that colorbars don't have too many digits)\n    # Also, we crop it so you can see individual pixels\n    img = hdu.data[50:90, 60:100] * 1e5\n\n    kernel = CustomKernel([[-1,-1,-1], [-1, 8, -1], [-1,-1,-1]])\n\n    astropy_conv = convolve(img, kernel, normalize_kernel=False, nan_treatment='fill')\n    #astropy_conv_fft = convolve_fft(img, kernel, normalize_kernel=False, nan_treatment='fill')\n\n    plt.figure(1, figsize=(12, 12)).clf()\n    ax1 = plt.subplot(1, 2, 1)\n    im = ax1.imshow(img, vmin=-6., vmax=5.e1, origin='lower',\n                    interpolation='nearest', cmap='viridis')\n\n    ax2 = plt.subplot(1, 2, 2)\n    im = ax2.imshow(astropy_conv, vmin=-6., vmax=5.e1, origin='lower',\n                    interpolation='nearest', cmap='viridis')\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Replacing NaN Values with Interpolated Values Using Kernels\n\nIf you have an image with missing values (NaNs), you have to replace them with\nreal values first. Often, the best way to do this is to replace the NaN values\nwith interpolated values. In the example below, we use a Gaussian kernel\nwith a size similar to that of our peak-finding kernel to replace the bad data\nbefore applying the peak-finding kernel.\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n   from astropy.convolution import Gaussian2DKernel, interpolate_replace_nans\n\n   # Select a random set of pixels that were affected by some sort of artifact\n   # and replaced with NaNs (e.g., cosmic-ray-affected pixels)\n   np.random.seed(42)\n   yinds, xinds = np.indices(img.shape)\n   img[np.random.choice(yinds.flat, 50), np.random.choice(xinds.flat, 50)] = np.nan\n\n   # We smooth with a Gaussian kernel with x_stddev=1 (and y_stddev=1)\n   # It is a 9x9 array\n   kernel = Gaussian2DKernel(x_stddev=1)\n\n   # interpolate away the NaNs\n   reconstructed_image = interpolate_replace_nans(img, kernel)\n\n\n   # apply peak-finding\n   kernel = CustomKernel([[-1,-1,-1], [-1, 8, -1], [-1,-1,-1]])\n\n   # Use the peak-finding kernel\n   # We have to turn off kernel normalization and set nan_treatment to \"fill\"\n   # here because `nan_treatment='interpolate'` is incompatible with non-\n   # normalized kernels\n   peaked_image = convolve(reconstructed_image, kernel,\n                           normalize_kernel=False,\n                           nan_treatment='fill')\n\n   plt.figure(1, figsize=(12, 12)).clf()\n   ax1 = plt.subplot(1, 3, 1)\n   ax1.set_title(\"Image with missing data\")\n   im = ax1.imshow(img, vmin=-6., vmax=5.e1, origin='lower',\n                   interpolation='nearest', cmap='viridis')\n\n   ax2 = plt.subplot(1, 3, 2)\n   ax2.set_title(\"Interpolated\")\n   im = ax2.imshow(reconstructed_image, vmin=-6., vmax=5.e1, origin='lower',\n                   interpolation='nearest', cmap='viridis')\n\n   ax3 = plt.subplot(1, 3, 3)\n   ax3.set_title(\"Peak-Finding\")\n   im = ax3.imshow(peaked_image, vmin=-6., vmax=5.e1, origin='lower',\n                   interpolation='nearest', cmap='viridis')\n\n..\n  EXAMPLE END\n"},{"id":491,"name":"using.rst","nodeType":"TextFile","path":"docs/convolution","text":"Using the Convolution Functions\n*******************************\n\nOverview\n========\n\nTwo convolution functions are provided. They are imported as::\n\n    >>> from astropy.convolution import convolve, convolve_fft\n\nand are both used as::\n\n    >>> result = convolve(image, kernel)  # doctest: +SKIP\n    >>> result = convolve_fft(image, kernel)  # doctest: +SKIP\n\n:func:`~astropy.convolution.convolve` is implemented as a\ndirect convolution algorithm, while\n:func:`~astropy.convolution.convolve_fft` uses a Fast Fourier\nTransform (FFT). Thus, the former is better for small kernels, while the latter\nis much more efficient for larger kernels.\n\nThe input images and kernels should be lists or ``numpy`` arrays with either 1,\n2, or 3 dimensions (and the number of dimensions should be the same for the\nimage and kernel). The result is a ``numpy`` array with the same dimensions as\nthe input image. The convolution is always done as floating point.\n\nThe :func:`~astropy.convolution.convolve` function takes an\noptional ``boundary=`` argument describing how to perform the convolution at\nthe edge of the array. The values for ``boundary`` can be:\n\n* ``None``: set the result values to zero where the kernel extends beyond the\n  edge of the array (default).\n\n* ``'fill'``: set values outside the array boundary to a constant. If this\n  option is specified, the constant should be specified using the\n  ``fill_value=`` argument, which defaults to zero.\n\n* ``'wrap'``: assume that the boundaries are periodic.\n\n* ``'extend'`` : set values outside the array to the nearest array value.\n\nBy default, the kernel is not normalized. To normalize it prior to convolution,\nuse::\n\n    >>> result = convolve(image, kernel, normalize_kernel=True)  # doctest: +SKIP\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Smoothing Arrays with Custom Kernels\n\nSmooth a 1D array with a custom kernel and no boundary treatment::\n\n    >>> import numpy as np\n    >>> convolve([1, 4, 5, 6, 5, 7, 8], [0.2, 0.6, 0.2])  # doctest: +FLOAT_CMP\n    array([1.4, 3.6, 5. , 5.6, 5.6, 6.8, 6.2])\n\nAs above, but using the 'extend' algorithm for boundaries::\n\n    >>> convolve([1, 4, 5, 6, 5, 7, 8], [0.2, 0.6, 0.2], boundary='extend')  # doctest: +FLOAT_CMP\n    array([1.6, 3.6, 5. , 5.6, 5.6, 6.8, 7.8])\n\nIf a NaN value is present in the original array, it will be\ninterpolated using the kernel::\n\n    >>> import numpy as np\n    >>> convolve([1, 4, 5, 6, np.nan, 7, 8], [0.2, 0.6, 0.2], boundary='extend')  # doctest: +FLOAT_CMP\n    array([1.6 , 3.6 , 5.  , 5.75, 6.5 , 7.25, 7.8 ])\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Constructing Kernels from Lists\n\nKernels and arrays can be specified either as lists or as ``numpy``\narrays. The following examples show how to construct a 1D array as a\nlist::\n\n    >>> kernel = [0, 1, 0]\n    >>> result = convolve(spectrum, kernel)  # doctest: +SKIP\n\nA 2D array as a list::\n\n    >>> kernel = [[0, 1, 0],\n    ...           [1, 2, 1],\n    ...           [0, 1, 0]]\n    >>> result = convolve(image, kernel)  # doctest: +SKIP\n\nAnd a 3D array as a list::\n\n    >>> kernel = [[[0, 0, 0], [0, 2, 0], [0, 0, 0]],\n    ...           [[0, 1, 0], [2, 3, 2], [0, 1, 0]],\n    ...           [[0, 0, 0], [0, 2, 0], [0, 0, 0]]]\n    >>> result = convolve(cube, kernel)  # doctest: +SKIP\n\n..\n  EXAMPLE END\n\nKernels\n=======\n\nThe above examples use custom kernels, but `astropy.convolution` also\nincludes a number of built-in kernels, which are described in\n:doc:`kernels`.\n"},{"col":4,"comment":"\n        Determine whether or not the card is a record-valued keyword card.\n\n        If one argument is given, that argument is treated as a full card image\n        and parsed as such.  If two arguments are given, the first is treated\n        as the card keyword (including the field-specifier if the card is\n        intended as a RVKC), and the second as the card value OR the first value\n        can be the base keyword, and the second value the 'field-specifier:\n        value' string.\n\n        If the check passes the ._keyword, ._value, and .field_specifier\n        keywords are set.\n\n        Examples\n        --------\n        ::\n\n            self._check_if_rvkc('DP1', 'AXIS.1: 2')\n            self._check_if_rvkc('DP1.AXIS.1', 2)\n            self._check_if_rvkc('DP1     = AXIS.1: 2')\n        ","endLoc":631,"header":"def _check_if_rvkc(self, *args)","id":492,"name":"_check_if_rvkc","nodeType":"Function","startLoc":584,"text":"def _check_if_rvkc(self, *args):\n        \"\"\"\n        Determine whether or not the card is a record-valued keyword card.\n\n        If one argument is given, that argument is treated as a full card image\n        and parsed as such.  If two arguments are given, the first is treated\n        as the card keyword (including the field-specifier if the card is\n        intended as a RVKC), and the second as the card value OR the first value\n        can be the base keyword, and the second value the 'field-specifier:\n        value' string.\n\n        If the check passes the ._keyword, ._value, and .field_specifier\n        keywords are set.\n\n        Examples\n        --------\n        ::\n\n            self._check_if_rvkc('DP1', 'AXIS.1: 2')\n            self._check_if_rvkc('DP1.AXIS.1', 2)\n            self._check_if_rvkc('DP1     = AXIS.1: 2')\n        \"\"\"\n\n        if not conf.enable_record_valued_keyword_cards:\n            return False\n\n        if len(args) == 1:\n            return self._check_if_rvkc_image(*args)\n        elif len(args) == 2:\n            keyword, value = args\n            if not isinstance(keyword, str):\n                return False\n            if keyword in self._commentary_keywords:\n                return False\n            match = self._rvkc_keyword_name_RE.match(keyword)\n            if match and isinstance(value, (int, float)):\n                self._init_rvkc(match.group('keyword'),\n                                match.group('field_specifier'), None, value)\n                return True\n\n            # Testing for ': ' is a quick way to avoid running the full regular\n            # expression, speeding this up for the majority of cases\n            if isinstance(value, str) and value.find(': ') > 0:\n                match = self._rvkc_field_specifier_val_RE.match(value)\n                if match and self._keywd_FSC_RE.match(keyword):\n                    self._init_rvkc(keyword, match.group('keyword'), value,\n                                    match.group('val'))\n                    return True"},{"id":493,"name":"docs/coordinates","nodeType":"Package"},{"id":494,"name":"representations.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. _astropy-coordinates-representations:\n\nUsing and Designing Coordinate Representations\n**********************************************\n\nPoints in a 3D vector space can be represented in different ways, such as\nCartesian, spherical polar, cylindrical, and so on. These underlie the way\ncoordinate data in `astropy.coordinates` is represented, as described in the\n:ref:`astropy-coordinates-overview`. Below, we describe how you can use them on\ntheir own as a way to convert between different representations, including\nones not built-in, and to do simple vector arithmetic.\n\nThe built-in representation classes are:\n\n* `~astropy.coordinates.CartesianRepresentation`: Cartesian\n  coordinates ``x``, ``y``, and ``z``.\n* `~astropy.coordinates.SphericalRepresentation`: spherical\n  polar coordinates represented by a longitude (``lon``), a latitude\n  (``lat``), and a distance (``distance``). The latitude is a value ranging\n  from -90 to 90 degrees.\n* `~astropy.coordinates.UnitSphericalRepresentation`:\n  spherical polar coordinates on a unit sphere, represented by a longitude\n  (``lon``) and latitude (``lat``).\n* `~astropy.coordinates.PhysicsSphericalRepresentation`:\n  spherical polar coordinates, represented by an inclination (``theta``) and\n  azimuthal angle (``phi``), and radius ``r``. The inclination goes from 0 to\n  180 degrees, and is related to the latitude in the\n  `~astropy.coordinates.SphericalRepresentation` by\n  ``theta = 90 deg - lat``.\n* `~astropy.coordinates.CylindricalRepresentation`:\n  cylindrical polar coordinates, represented by a cylindrical radius\n  (``rho``), azimuthal angle (``phi``), and height (``z``).\n\n.. Note::\n   For information about using and changing the representation of\n   `~astropy.coordinates.SkyCoord` objects, see the\n   :ref:`astropy-skycoord-representations` section.\n\nInstantiating and Converting\n============================\n\nRepresentation classes are instantiated with `~astropy.units.Quantity`\nobjects::\n\n    >>> from astropy import units as u\n    >>> from astropy.coordinates.representation import CartesianRepresentation\n    >>> car = CartesianRepresentation(3 * u.kpc, 5 * u.kpc, 4 * u.kpc)\n    >>> car  # doctest: +FLOAT_CMP\n    <CartesianRepresentation (x, y, z) in kpc\n        (3., 5., 4.)>\n\nArray `~astropy.units.Quantity` objects can also be passed to\nrepresentations. They will have the expected shape, which can be changed using\nmethods with the same names as those for `~numpy.ndarray`, such as ``reshape``,\n``ravel``, etc.::\n\n  >>> x = u.Quantity([[1., 0., 0.], [3., 5., 3.]], u.m)\n  >>> y = u.Quantity([[0., 2., 0.], [4., 0., -4.]], u.m)\n  >>> z = u.Quantity([[0., 0., 3.], [0., 12., -12.]], u.m)\n  >>> car_array = CartesianRepresentation(x, y, z)\n  >>> car_array  # doctest: +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) in m\n      [[(1.,  0.,   0.), (0.,  2.,   0.), (0.,  0.,   3.)],\n       [(3.,  4.,   0.), (5.,  0.,  12.), (3., -4., -12.)]]>\n  >>> car_array.shape\n  (2, 3)\n  >>> car_array.ravel()  # doctest: +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) in m\n      [(1.,  0.,   0.), (0.,  2.,   0.), (0.,  0.,   3.), (3.,  4.,   0.),\n       (5.,  0.,  12.), (3., -4., -12.)]>\n\nRepresentations can be converted to other representations using the\n``represent_as`` method::\n\n    >>> from astropy.coordinates.representation import SphericalRepresentation, CylindricalRepresentation\n    >>> sph = car.represent_as(SphericalRepresentation)\n    >>> sph  # doctest: +FLOAT_CMP\n    <SphericalRepresentation (lon, lat, distance) in (rad, rad, kpc)\n        (1.03037683, 0.60126422, 7.07106781)>\n    >>> cyl = car.represent_as(CylindricalRepresentation)\n    >>> cyl  # doctest: +FLOAT_CMP\n    <CylindricalRepresentation (rho, phi, z) in (kpc, rad, kpc)\n        (5.83095189, 1.03037683, 4.)>\n\nAll representations can be converted to each other without loss of\ninformation, with the exception of\n`~astropy.coordinates.UnitSphericalRepresentation`. This class\nis used to store the longitude and latitude of points but does not contain\nany distance to the points, and assumes that they are located on a unit and\ndimensionless sphere::\n\n    >>> from astropy.coordinates.representation import UnitSphericalRepresentation\n    >>> sph_unit = car.represent_as(UnitSphericalRepresentation)\n    >>> sph_unit  # doctest: +FLOAT_CMP\n    <UnitSphericalRepresentation (lon, lat) in rad\n        (1.03037683, 0.60126422)>\n\nConverting back to Cartesian, the absolute scaling information has been\nremoved, and the points are still located on a unit sphere::\n\n    >>> sph_unit = car.represent_as(UnitSphericalRepresentation)\n    >>> sph_unit.represent_as(CartesianRepresentation)  # doctest: +FLOAT_CMP\n    <CartesianRepresentation (x, y, z) [dimensionless]\n        (0.42426407, 0.70710678, 0.56568542)>\n\n\nArray Values and NumPy Array Method Analogs\n===========================================\n\nArray `~astropy.units.Quantity` objects can also be passed to representations,\nand such representations can be sliced, reshaped, etc., using the same methods\nas are available to `~numpy.ndarray`. Corresponding functions, as well as\nothers that affect the shape, such as `~numpy.atleast_1d` and\n`~numpy.rollaxis`, work as expected.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Array Values and NumPy Array Method Analogs\n\nTo pass array `~astropy.units.Quantity` objects to representations::\n\n  >>> import numpy as np\n  >>> x = np.linspace(0., 5., 6)\n  >>> y = np.linspace(10., 15., 6)\n  >>> z = np.linspace(20., 25., 6)\n  >>> car_array = CartesianRepresentation(x * u.m, y * u.m, z * u.m)\n  >>> car_array\n  <CartesianRepresentation (x, y, z) in m\n      [(0., 10., 20.), (1., 11., 21.), (2., 12., 22.),\n       (3., 13., 23.), (4., 14., 24.), (5., 15., 25.)]>\n\nTo manipulate using methods and ``numpy`` functions::\n\n  >>> car_array.reshape(3, 2)\n  <CartesianRepresentation (x, y, z) in m\n      [[(0., 10., 20.), (1., 11., 21.)],\n       [(2., 12., 22.), (3., 13., 23.)],\n       [(4., 14., 24.), (5., 15., 25.)]]>\n  >>> car_array[2]\n  <CartesianRepresentation (x, y, z) in m\n      (2., 12., 22.)>\n  >>> car_array[2] = car_array[1]\n  >>> car_array[:3]\n  <CartesianRepresentation (x, y, z) in m\n      [(0., 10., 20.), (1., 11., 21.), (1., 11., 21.)]>\n  >>> np.roll(car_array, 1)\n  <CartesianRepresentation (x, y, z) in m\n      [(5., 15., 25.), (0., 10., 20.), (1., 11., 21.), (1., 11., 21.),\n       (3., 13., 23.), (4., 14., 24.)]>\n\nAnd to set elements using other representation classes (as long\nas they are compatible in their units and number of dimensions)::\n\n  >>> car_array[2] = SphericalRepresentation(0*u.deg, 0*u.deg, 99*u.m)\n  >>> car_array[:3]  # doctest: +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) in m\n      [(0., 10., 20.), (1., 11., 21.), (99., 0., 0.)]>\n  >>> car_array[0] = UnitSphericalRepresentation(0*u.deg, 0*u.deg)\n  Traceback (most recent call last):\n  ...\n  ValueError: value must be representable as CartesianRepresentation without loss of information.\n\n..\n  EXAMPLE END\n\n.. _astropy-coordinates-representations-arithmetic:\n\nVector Arithmetic\n=================\n\nRepresentations support basic vector arithmetic such as taking the norm,\nmultiplying with and dividing by quantities, and taking dot and cross products,\nas well as adding, subtracting, summing and taking averages of representations,\nand multiplying with matrices.\n\n.. Note:: All arithmetic except the matrix multiplication works with\n   non-Cartesian representations as well. For taking the norm, multiplication,\n   and division, this uses just the non-angular components, while for the other\n   operations the representation is converted to Cartesian internally before\n   the operation is done, and the result is converted back to the original\n   representation. Hence, for optimal speed it may be best to work using\n   Cartesian representations.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Vector Arithmetic Operations with Representation Objects\n\nTo see how vector arithmetic operations work with representation objects,\nconsider the following examples::\n\n  >>> car_array = CartesianRepresentation([[1., 0., 0.], [3., 5.,  3.]] * u.m,\n  ...                                     [[0., 2., 0.], [4., 0., -4.]] * u.m,\n  ...                                     [[0., 0., 3.], [0.,12.,-12.]] * u.m)\n  >>> car_array  # doctest: +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) in m\n      [[(1.,  0.,  0.), (0.,  2.,   0.), (0.,  0.,   3.)],\n       [(3.,  4.,  0.), (5.,  0.,  12.), (3., -4., -12.)]]>\n  >>> car_array.norm()  # doctest: +FLOAT_CMP\n  <Quantity [[ 1.,  2.,  3.],\n             [ 5., 13., 13.]] m>\n  >>> car_array / car_array.norm()  # doctest: +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) [dimensionless]\n      [[(1.        ,  0.        ,  0.        ),\n        (0.        ,  1.        ,  0.        ),\n        (0.        ,  0.        ,  1.        )],\n       [(0.6       ,  0.8       ,  0.        ),\n        (0.38461538,  0.        ,  0.92307692),\n        (0.23076923, -0.30769231, -0.92307692)]]>\n  >>> (car_array[1] - car_array[0]) / (10. * u.s)  # doctest: +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) in m / s\n      [(0.2,  0.4,  0. ), (0.5, -0.2,  1.2), (0.3, -0.4, -1.5)]>\n  >>> car_array.sum()  # doctest: +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) in m\n      (12.,  2.,  3.)>\n  >>> car_array.mean(axis=0)  # doctest: +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) in m\n      [(2. ,  2.,  0. ), (2.5,  1.,  6. ), (1.5, -2., -4.5)]>\n\n  >>> unit_x = UnitSphericalRepresentation(0.*u.deg, 0.*u.deg)\n  >>> unit_y = UnitSphericalRepresentation(90.*u.deg, 0.*u.deg)\n  >>> unit_z = UnitSphericalRepresentation(0.*u.deg, 90.*u.deg)\n  >>> car_array.dot(unit_x)  # doctest: +FLOAT_CMP\n  <Quantity [[1., 0., 0.],\n             [3., 5., 3.]] m>\n  >>> car_array.dot(unit_y)  # doctest: +FLOAT_CMP\n  <Quantity [[ 6.12323400e-17,  2.00000000e+00,  0.00000000e+00],\n             [ 4.00000000e+00,  3.06161700e-16, -4.00000000e+00]] m>\n  >>> car_array.dot(unit_z)  # doctest: +FLOAT_CMP\n  <Quantity [[ 6.12323400e-17,  0.00000000e+00,  3.00000000e+00],\n             [ 1.83697020e-16,  1.20000000e+01, -1.20000000e+01]] m>\n  >>> car_array.cross(unit_x)  # doctest: +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) in m\n      [[(0.,  0.,  0.), (0.,   0., -2.), (0.,   3.,  0.)],\n       [(0.,  0., -4.), (0.,  12.,  0.), (0., -12.,  4.)]]>\n\n  >>> from astropy.coordinates.matrix_utilities import rotation_matrix\n  >>> rotation = rotation_matrix(90 * u.deg, axis='z')\n  >>> rotation  # doctest: +FLOAT_CMP\n  array([[ 6.12323400e-17,  1.00000000e+00,  0.00000000e+00],\n         [-1.00000000e+00,  6.12323400e-17,  0.00000000e+00],\n         [ 0.00000000e+00,  0.00000000e+00,  1.00000000e+00]])\n  >>> car_array.transform(rotation)  # doctest: +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) in m\n      [[( 6.12323400e-17, -1.00000000e+00,   0.),\n        ( 2.00000000e+00,  1.22464680e-16,   0.),\n        ( 0.00000000e+00,  0.00000000e+00,   3.)],\n       [( 4.00000000e+00, -3.00000000e+00,   0.),\n        ( 3.06161700e-16, -5.00000000e+00,  12.),\n        (-4.00000000e+00, -3.00000000e+00, -12.)]]>\n\n..\n  EXAMPLE END\n\n.. _astropy-coordinates-differentials:\n\nDifferentials and Derivatives of Representations\n================================================\n\nIn addition to positions in 3D space, coordinates also deal with proper motions\nand radial velocities, which require a way to represent differentials of\ncoordinates (i.e., finite realizations) of derivatives. To support this, the\nrepresentations all have corresponding ``Differential`` classes, which can hold\noffsets or derivatives in terms of the components of the representation class.\nAdding such an offset to a representation means the offset is taken in the\ndirection of the corresponding coordinate. (Although for any representation\nother than Cartesian, this is only defined relative to a specific location, as\nthe unit vectors are not invariant.)\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Differentials and Derivatives of Representations\n\nTo see how the ``Differential`` classes of representations works, consider the\nfollowing::\n\n  >>> from astropy.coordinates import SphericalRepresentation, SphericalDifferential\n  >>> sph_coo = SphericalRepresentation(lon=0.*u.deg, lat=0.*u.deg,\n  ...                                   distance=1.*u.kpc)\n  >>> sph_derivative = SphericalDifferential(d_lon=1.*u.arcsec/u.yr,\n  ...                                        d_lat=0.*u.arcsec/u.yr,\n  ...                                        d_distance=0.*u.km/u.s)\n  >>> sph_derivative.to_cartesian(base=sph_coo)  # doctest: +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) in arcsec kpc / (rad yr)\n      (0., 1., 0.)>\n\nNote how the conversion to Cartesian can only be done using a ``base``, since\notherwise the code cannot know what direction an increase in longitude\ncorresponds to. For ``lon=0``, this is in the ``y`` direction. Now, to get\nthe coordinates at two later times::\n\n  >>> sph_coo + sph_derivative * [1., 3600*180/np.pi] * u.yr  # doctest: +FLOAT_CMP\n  <SphericalRepresentation (lon, lat, distance) in (rad, rad, kpc)\n      [(4.84813681e-06, 0., 1.        ), (7.85398163e-01, 0., 1.41421356)]>\n\nThe above shows how addition is not to longitude itself, but in the direction\nof increasing longitude: for the large shift, by the equivalent of one radian,\nthe distance has increased as well (after all, a source will likely not move\nalong a curve on the sky!). This also means that the order of operations is\nimportant::\n\n  >>> big_offset = SphericalDifferential(1.*u.radian, 0.*u.radian, 0.*u.kpc)\n  >>> sph_coo + big_offset + big_offset  # doctest: +FLOAT_CMP\n  <SphericalRepresentation (lon, lat, distance) in (rad, rad, kpc)\n      (1.57079633, 0., 2.)>\n  >>> sph_coo + (big_offset + big_offset)  # doctest: +FLOAT_CMP\n  <SphericalRepresentation (lon, lat, distance) in (rad, rad, kpc)\n      (1.10714872, 0., 2.23606798)>\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Working with Proper Motions and Radial Velocities in Differential Objects\n\nOften, you may have just a proper motion or a radial velocity, but not both::\n\n  >>> from astropy.coordinates import UnitSphericalDifferential, RadialDifferential\n  >>> radvel = RadialDifferential(1000*u.km/u.s)\n  >>> sph_coo + radvel * 1. * u.Myr  # doctest: +FLOAT_CMP\n  <SphericalRepresentation (lon, lat, distance) in (rad, rad, kpc)\n      (0., 0., 2.02271217)>\n  >>> pm = UnitSphericalDifferential(1.*u.mas/u.yr, 0.*u.mas/u.yr)\n  >>> sph_coo + pm * 1. * u.Myr  # doctest: +FLOAT_CMP\n  <SphericalRepresentation (lon, lat, distance) in (rad, rad, kpc)\n      (0.0048481, 0., 1.00001175)>\n  >>> pm + radvel  # doctest: +FLOAT_CMP\n  <SphericalDifferential (d_lon, d_lat, d_distance) in (mas / yr, mas / yr, km / s)\n      (1., 0., 1000.)>\n  >>> sph_coo + (pm + radvel) * 1. * u.Myr  # doctest: +FLOAT_CMP\n  <SphericalRepresentation (lon, lat, distance) in (rad, rad, kpc)\n      (0.00239684, 0., 2.02271798)>\n\nNote in the above that the proper motion is defined strictly as a change in\nlongitude (i.e., it does not include a ``cos(latitude)`` term). There are\nspecial classes where this term is included::\n\n  >>> from astropy.coordinates import UnitSphericalCosLatDifferential\n  >>> sph_lat60 = SphericalRepresentation(lon=0.*u.deg, lat=60.*u.deg,\n  ...                                     distance=1.*u.kpc)\n  >>> pm = UnitSphericalDifferential(1.*u.mas/u.yr, 0.*u.mas/u.yr)\n  >>> pm  # doctest: +FLOAT_CMP\n  <UnitSphericalDifferential (d_lon, d_lat) in mas / yr\n      (1., 0.)>\n  >>> pm_coslat = UnitSphericalCosLatDifferential(1.*u.mas/u.yr, 0.*u.mas/u.yr)\n  >>> pm_coslat  # doctest: +FLOAT_CMP\n  <UnitSphericalCosLatDifferential (d_lon_coslat, d_lat) in mas / yr\n      (1., 0.)>\n  >>> sph_lat60 + pm * 1. * u.Myr  # doctest: +FLOAT_CMP\n  <SphericalRepresentation (lon, lat, distance) in (rad, rad, kpc)\n      (0.0048481, 1.04719246, 1.00000294)>\n  >>> sph_lat60 + pm_coslat * 1. * u.Myr  # doctest: +FLOAT_CMP\n  <SphericalRepresentation (lon, lat, distance) in (rad, rad, kpc)\n      (0.00969597, 1.0471772, 1.00001175)>\n\nClose inspections shows that indeed the changes are as expected. The systems\nwith and without ``cos(latitude)`` can be converted to each other, provided you\nsupply the ``base`` (representation)::\n\n  >>> usph_lat60 = sph_lat60.represent_as(UnitSphericalRepresentation)\n  >>> pm_coslat2 = pm.represent_as(UnitSphericalCosLatDifferential,\n  ...                              base=usph_lat60)\n  >>> pm_coslat2  # doctest: +FLOAT_CMP\n  <UnitSphericalCosLatDifferential (d_lon_coslat, d_lat) in mas / yr\n      (0.5, 0.)>\n  >>> sph_lat60 + pm_coslat2 * 1. * u.Myr  # doctest: +FLOAT_CMP\n  <SphericalRepresentation (lon, lat, distance) in (rad, rad, kpc)\n      (0.0048481, 1.04719246, 1.00000294)>\n\n.. Note:: At present, the differential classes are generally meant to work with\n   first derivatives, but they do not check the units of the inputs to enforce\n   this. Passing in second derivatives (e.g., acceleration values with\n   acceleration units) will succeed, but any transformations that occur through\n   re-representation of the differential will not necessarily be correct.\n\n..\n  EXAMPLE END\n\nAttaching ``Differential`` Objects to ``Representation`` Objects\n================================================================\n\n``Differential`` objects can be attached to ``Representation`` objects as a way\nto encapsulate related information into a single object. ``Differential``\nobjects can be passed in to the initializer of any of the built-in\n``Representation`` classes.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Attaching Differential Objects to Representation Objects\n\nTo store a single velocity differential with a position::\n\n  >>> from astropy.coordinates import representation as r\n  >>> dif = r.SphericalDifferential(d_lon=1 * u.mas/u.yr,\n  ...                               d_lat=2 * u.mas/u.yr,\n  ...                               d_distance=3 * u.km/u.s)\n  >>> rep = r.SphericalRepresentation(lon=0.*u.deg, lat=0.*u.deg,\n  ...                                 distance=1.*u.kpc,\n  ...                                 differentials=dif)\n  >>> rep  # doctest: +FLOAT_CMP\n  <SphericalRepresentation (lon, lat, distance) in (deg, deg, kpc)\n      (0., 0., 1.)\n   (has differentials w.r.t.: 's')>\n  >>> rep.differentials  # doctest: +FLOAT_CMP\n  {'s': <SphericalDifferential (d_lon, d_lat, d_distance) in (mas / yr, mas / yr, km / s)\n       (1., 2., 3.)>}\n\n..\n  EXAMPLE END\n\nThe ``Differential`` objects are stored as a Python dictionary on the\n``Representation`` object with keys equal to the (string) unit with which the\ndifferential derivatives are taken (converted to SI).\n\n..\n  EXAMPLE START\n  Differential and Representation Object Storage\n\nIn this case the key is ``'s'`` (second) because the ``Differential`` units are\nvelocities, a time derivative. Passing a single differential to the\n``Representation`` initializer will automatically generate the necessary key\nand store it in the differentials dictionary, but a dictionary is required to\nspecify multiple differentials::\n\n  >>> dif2 = r.SphericalDifferential(d_lon=4 * u.mas/u.yr**2,\n  ...                                d_lat=5 * u.mas/u.yr**2,\n  ...                                d_distance=6 * u.km/u.s**2)\n  >>> rep = r.SphericalRepresentation(lon=0.*u.deg, lat=0.*u.deg,\n  ...                                 distance=1.*u.kpc,\n  ...                                 differentials={'s': dif, 's2': dif2})\n  >>> rep.differentials['s']  # doctest: +FLOAT_CMP\n  <SphericalDifferential (d_lon, d_lat, d_distance) in (mas / yr, mas / yr, km / s)\n      (1., 2., 3.)>\n  >>> rep.differentials['s2']  # doctest: +FLOAT_CMP\n  <SphericalDifferential (d_lon, d_lat, d_distance) in (mas / yr2, mas / yr2, km / s2)\n      (4., 5., 6.)>\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Attaching Differential Objects to a Representation after Creation\n\n``Differential`` objects can also be attached to a ``Representation`` after\ncreation::\n\n  >>> rep = r.CartesianRepresentation(x=1 * u.kpc, y=2 * u.kpc, z=3 * u.kpc)\n  >>> dif = r.CartesianDifferential(*[1, 2, 3] * u.km/u.s)\n  >>> rep = rep.with_differentials(dif)\n  >>> rep  # doctest: +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) in kpc\n      (1., 2., 3.)\n   (has differentials w.r.t.: 's')>\n\nThis works for array data as well, as long as the shape of the\n``Differential`` data is the same as that of the ``Representation``::\n\n  >>> xyz = np.arange(12).reshape(3, 4) * u.au\n  >>> d_xyz = np.arange(12).reshape(3, 4) * u.km/u.s\n  >>> rep = r.CartesianRepresentation(*xyz)\n  >>> dif = r.CartesianDifferential(*d_xyz)\n  >>> rep = rep.with_differentials(dif)\n  >>> rep  # doctest: +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) in AU\n      [(0., 4.,  8.), (1., 5.,  9.), (2., 6., 10.), (3., 7., 11.)]\n   (has differentials w.r.t.: 's')>\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Converting Positional Data to a New Representation\n\nAs with a ``Representation`` instance without a differential, to convert the\npositional data to a new representation, use the ``.represent_as()``::\n\n  >>> rep.represent_as(r.SphericalRepresentation)  # doctest: +FLOAT_CMP\n  <SphericalRepresentation (lon, lat, distance) in (rad, rad, AU)\n      [(1.57079633, 1.10714872,  8.94427191),\n       (1.37340077, 1.05532979, 10.34408043),\n       (1.24904577, 1.00685369, 11.83215957),\n       (1.16590454, 0.96522779, 13.37908816)]>\n\nHowever, by passing just the desired representation class, only the\n``Representation`` has changed, and the differentials are dropped. To\nre-represent both the ``Representation`` and any ``Differential`` objects, you\nmust specify target classes for the ``Differential`` as well::\n\n  >>> rep2 = rep.represent_as(r.SphericalRepresentation, r.SphericalDifferential)\n  >>> rep2  # doctest: +FLOAT_CMP\n  <SphericalRepresentation (lon, lat, distance) in (rad, rad, AU)\n    [(1.57079633, 1.10714872,  8.94427191),\n     (1.37340077, 1.05532979, 10.34408043),\n     (1.24904577, 1.00685369, 11.83215957),\n     (1.16590454, 0.96522779, 13.37908816)]\n   (has differentials w.r.t.: 's')>\n  >>> rep2.differentials['s']  # doctest: +FLOAT_CMP\n  <SphericalDifferential (d_lon, d_lat, d_distance) in (km rad / (AU s), km rad / (AU s), km / s)\n      [( 6.12323400e-17, 1.11022302e-16,  8.94427191),\n       (-2.77555756e-17, 5.55111512e-17, 10.34408043),\n       ( 0.00000000e+00, 0.00000000e+00, 11.83215957),\n       ( 5.55111512e-17, 0.00000000e+00, 13.37908816)]>\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Shape-Changing Operations with Differential Objects\n\nShape-changing operations (e.g., reshapes) are propagated to all\n``Differential`` objects because they are guaranteed to have the same shape as\ntheir host ``Representation`` object::\n\n  >>> rep.shape\n  (4,)\n  >>> rep.differentials['s'].shape\n  (4,)\n  >>> new_rep = rep.reshape(2, 2)\n  >>> new_rep.shape\n  (2, 2)\n  >>> new_rep.differentials['s'].shape\n  (2, 2)\n\nThis also works for slicing::\n\n  >>> new_rep = rep[:2]\n  >>> new_rep.shape\n  (2,)\n  >>> new_rep.differentials['s'].shape\n  (2,)\n\nOperations on representations that return `~astropy.units.Quantity` objects (as\nopposed to other ``Representation`` instances) still work, but only operate on\nthe positional information, for example::\n\n  >>> rep.norm()  # doctest: +FLOAT_CMP\n  <Quantity [ 8.94427191, 10.34408043, 11.83215957, 13.37908816] AU>\n\nOperations that involve combining or scaling representations or pairs of\nrepresentation objects that contain differentials will currently fail, but\nsupport for some operations may be added in future versions::\n\n  >>> rep + rep\n  Traceback (most recent call last):\n  ...\n  TypeError: Operation 'add' is not supported when differentials are attached to a CartesianRepresentation.\n\nIf you have a ``Representation`` with attached ``Differential`` objects, you\ncan retrieve a copy of the ``Representation`` without the ``Differential``\nobject and use this ``Differential``-free object for any arithmetic operation::\n\n  >>> 15 * rep.without_differentials()  # doctest: +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) in AU\n      [( 0.,  60., 120.), (15.,  75., 135.), (30.,  90., 150.),\n       (45., 105., 165.)]>\n\n..\n  EXAMPLE END\n\n.. _astropy-coordinates-create-repr:\n\nCreating Your Own Representations\n=================================\n\nTo create your own representation class, your class must inherit from the\n`~astropy.coordinates.BaseRepresentation` class. This base has an ``__init__``\nmethod that will put all arguments components through their initializers,\nverify they can be broadcast against each other, and store the components on\n``self`` as the name prefixed with '_'. Furthermore, through its metaclass it\nprovides default properties for the components so that they can be accessed\nusing ``<instance>.<component>``. For the machinery to work, the following\nmust be defined:\n\n* ``attr_classes`` class attribute (``OrderedDict``):\n\n  Defines through its keys the names of the components (as well as the default\n  order), and through its values defines the class of which they should be\n  instances (which should be `~astropy.units.Quantity` or a subclass, or\n  anything that can initialize it).\n\n* ``from_cartesian`` class method:\n\n  Takes a `~astropy.coordinates.CartesianRepresentation` object and\n  returns an instance of your class.\n\n* ``to_cartesian`` method:\n\n  Returns a `~astropy.coordinates.CartesianRepresentation` object.\n\n* ``__init__`` method (optional):\n\n  If you want more than the basic initialization and checks provided by the\n  base representation class, or just an explicit signature, you can define your\n  own ``__init__``. In general, it is recommended to stay close to the\n  signature assumed by the base representation, ``__init__(self, comp1, comp2,\n  comp3, copy=True)``, and use ``super`` to call the base representation\n  initializer.\n\nOnce you do this, you will then automatically be able to call ``represent_as``\nto convert other representations to/from your representation class. Your\nrepresentation will also be available for use in |SkyCoord| and all frame\nclasses.\n\nA representation class may also have a ``_unit_representation`` attribute\n(although it is not required). This attribute points to the appropriate\n\"unit\" representation (i.e., a representation that is dimensionless). This is\nprobably only meaningful for subclasses of\n`~astropy.coordinates.SphericalRepresentation`, where it is assumed that it\nwill be a subclass of `~astropy.coordinates.UnitSphericalRepresentation`.\n\nFinally, if you wish to also use offsets in your coordinate system, two further\nmethods should be defined (please see\n`~astropy.coordinates.SphericalRepresentation` for an example):\n\n* ``unit_vectors`` method:\n\n  Returns a ``dict`` with a\n  `~astropy.coordinates.CartesianRepresentation` of unit vectors in the\n  direction of each component.\n\n* ``scale_factors`` method:\n\n  Returns a ``dict`` with a `~astropy.units.Quantity` for each component with\n  the appropriate physical scale factor for a unit change in that direction.\n\nAnd furthermore you should define a ``Differential`` class based on\n`~astropy.coordinates.BaseDifferential`. This class only needs to define:\n\n* ``base_representation`` attribute:\n\n  A link back to the representation for which this differential holds.\n\n\nIn pseudo-code, this means that a class will look like::\n\n    class MyRepresentation(BaseRepresentation):\n\n        attr_classes = OrderedDict([('comp1', ComponentClass1),\n                                     ('comp2', ComponentClass2),\n                                     ('comp3', ComponentClass3)])\n\n\t# __init__ is optional\n        def __init__(self, comp1, comp2, comp3, copy=True):\n            super().__init__(comp1, comp2, comp3, copy=copy)\n            ...\n\n        @classmethod\n        def from_cartesian(self, cartesian):\n            ...\n            return MyRepresentation(...)\n\n        def to_cartesian(self):\n            ...\n            return CartesianRepresentation(...)\n\n\t# if differential motion is needed\n\tdef unit_vectors(self):\n\t    ...\n\t    return {'comp1': CartesianRepresentation(...),\n\t            'comp2': CartesianRepresentation(...),\n\t\t    'comp3': CartesianRepresentation(...)}\n\n        def scale_factors(self):\n\t    ...\n\t    return {'comp1': ...,\n\t            'comp2': ...,\n\t\t    'comp3': ...}\n\n    class MyDifferential(BaseDifferential):\n        base_representation = MyRepresentation\n"},{"id":495,"name":"inplace.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. _astropy-coordinates-fast-in-place:\n\nFast In-Place Modification of Coordinates\n*****************************************\n\nFor some applications the recommended method of\n:ref:`astropy-coordinates-modifying-in-place` may not be fast enough due to the\nextensive validation performed in that process to ensure correctness.  Likewise,\nyou may find that creating another coordinate frame with different data using\n`~astropy.coordinates.BaseCoordinateFrame.realize_frame` does not meet your\nperformance requirements.\n\nFor these high-performance situations, you can directly modify in-place the\nrepresentation data in the frame object as shown in this example::\n\n    >>> import astropy.units as u\n    >>> from astropy.coordinates import SkyCoord\n    >>> sc = SkyCoord([1,2],[3,4], unit='deg')\n    >>> sc.data.lon[()] = [10, 20] * u.deg\n    >>> sc.data.lat[1] = 40 * u.deg\n\n    >>> sc.cache.clear()  # IMPORTANT TO DO THIS!\n\n    >>> sc  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        [(10., 3.), (20., 40.)]>\n\nNotice that the ``.data`` representation object uses different names for the\ncomponents than in the coordinate object.  If you wish to inspect the\nmapping between frame attributes (e.g., ``.ra``) and representation attributes\n(e.g., ``.lon``) you can look at the following dictionary::\n\n    >>> sc.representation_component_names\n    {'ra': 'lon', 'dec': 'lat', 'distance': 'distance'}\n\n.. warning::\n\n   You *must* include the step to clear the cache as shown. Failing to do so\n   will cause the object to be inconsistent and likely result in incorrect\n   results. `~astropy.coordinates.SkyCoord`\n   and `~astropy.coordinates.BaseCoordinateFrame` cache various kinds of\n   information for performance reasons, so you need clear the cache so that\n   the new representation values are used when required.\n\nYou should note that the only way to modify the data in a frame is by using\nthe ``.data`` attribute directly and not the aliases for components on the\nframe.  For example the following will *appear* to give a correct\nresult but it does not actually modify the underlying representation data::\n\n    >>> sc.ra[1] = 20 * u.deg  # THIS IS WRONG\n\nThis problem is related to the current implementation of performance-based\ncaching and cannot be easily resolved.\n"},{"id":496,"name":"spectralcoord.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. _astropy-spectralcoord:\n\nUsing the SpectralCoord Class\n*****************************\n\n.. warning::\n\n    The |SpectralCoord| class is new in Astropy v4.1 and should be considered\n    experimental at this time. Note that we do not fully support cases\n    where the observer and target are moving relativistically relative to each\n    other, so care should be taken in those cases. It is possible that there\n    will be API changes in future versions of Astropy based on user feedback. If\n    you have specific ideas for how it might be improved, please  let us know on\n    the `astropy-dev mailing list`_ or at http://feedback.astropy.org.\n\nThe |SpectralCoord| class provides an interface for representing and\ntransforming spectral coordinates such as frequencies, wavelengths, and photon\nenergies, as well as equivalent Doppler velocities. While the plain |Quantity|\nclass can also represent these kinds of physical quantities, and allow\nconversion via dedicated equivalencies (such as :ref:`u.spectral\n<astropy-units-spectral-equivalency>` or the :ref:`u.doppler_*\n<astropy-units-doppler-equivalencies>` equivalencies), |SpectralCoord| (which is\na sub-class of |Quantity|) aims to make this more straightforward, and can also\nbe made aware of the observer and target reference frames, allowing for example\ntransformation from telescope-centric (or topocentric) frames to e.g.\nBarycentric or Local Standard of Rest (LSRK and LSRD) velocity frames.\n\nCreating SpectralCoord Objects\n==============================\n\nSince the |SpectralCoord| class is a sub-class of |Quantity|, the simplest way\nto initialize it is to provide a value (or values) and a unit, or an existing\n|Quantity|::\n\n    >>> from astropy import units as u\n    >>> from astropy.coordinates import SpectralCoord\n    >>> sc1 = SpectralCoord(34.2, unit='GHz')\n    >>> sc1\n    <SpectralCoord 34.2 GHz>\n    >>> sc2 = SpectralCoord([654.2, 654.4, 654.6] * u.nm)\n    >>> sc2\n    <SpectralCoord [654.2, 654.4, 654.6] nm>\n\nAt this point, we are not making any assumptions about the observer frame, or\nthe target that is being observed. As we will see in subsequent sections, more\ninformation can be provided when initializing |SpectralCoord| objects, but first\nwe take a look at simple unit conversions with these objects.\n\nUnit conversion\n===============\n\nBy default, unit conversions between spectral units will work without having to\nspecify the :ref:`u.spectral <astropy-units-spectral-equivalency>` equivalency::\n\n    >>> sc2.to(u.micron)\n    <SpectralCoord [0.6542, 0.6544, 0.6546] micron>\n    >>> sc2.to(u.eV)\n    <SpectralCoord [1.89520328, 1.89462406, 1.89404519] eV>\n    >>> sc2.to(u.THz)\n    <SpectralCoord [458.25811373, 458.11805929, 457.97809044] THz>\n\nAs is the case with |Quantity| and the :ref:`Doppler equivalencies\n<astropy-units-doppler-equivalencies>`, it is also possible to convert these\nabsolute spectral coordinates into velocities, assuming a particular rest\nfrequency or wavelength (such as that of a spectral line). For example, to\nconvert the above values into velocities relative to the Halpha line at 656.65\nnm, assuming the optical Doppler convention, you can do::\n\n    >>> sc3 = sc2.to(u.km / u.s,\n    ...              doppler_convention='optical',\n    ...              doppler_rest=656.65 * u.nm)\n    >>> sc3\n    <SpectralCoord\n       (doppler_rest=656.65 nm\n        doppler_convention=optical)\n      [-1118.5433977 , -1027.23373258,  -935.92406746] km / s>\n\nThe rest value for the Doppler conversion as well as the convention to use are\nstored in the resulting ``sc3`` |SpectralCoord| object. You can then convert\nback to frequency without having to specify them again::\n\n    >>> sc3.to(u.THz)\n    <SpectralCoord\n       (doppler_rest=656.65 nm\n        doppler_convention=optical)\n      [458.25811373, 458.11805929, 457.97809044] THz>\n\nor you can explicitly specify a different convention or rest value to use::\n\n    >>> sc3.to(u.km / u.s, doppler_convention='relativistic')\n    <SpectralCoord\n       (doppler_rest=656.65 nm\n        doppler_convention=relativistic)\n      [-1120.63005892, -1028.99362163,  -937.38499411] km / s>\n\nIt is also possible to set ``doppler_convention`` and ``doppler_rest`` from the\nstart, even when creating a |SpectralCoord| in frequency, energy, or\nwavelength::\n\n    >>> sc4 = SpectralCoord(343 * u.GHz,\n    ...                     doppler_convention='radio',\n    ...                     doppler_rest=342.91 * u.GHz)\n    >>> sc4.to(u.km / u.s)\n    <SpectralCoord\n       (doppler_rest=342.91 GHz\n        doppler_convention=radio)\n      -78.68338987 km / s>\n\n\nReference frame transformations\n===============================\n\nIf you work with any kind of spectral data, you will often need to determine\nand/or apply velocity corrections due to different frames of reference, or apply\nor remove the effects of redshift. There are two main ways to do this using the\n|SpectralCoord| class:\n\n* You can specify or change the velocity offset or redshift\n  between the observer and the target without having to specify the\n  absolute observer and target, but rather specify a velocity difference.  For example, that you know that there\n  is a velocity difference of 15km/s along the line of sight, or that you are\n  observing a galaxy at z=3.2. This can be useful for quick analysis but\n  will not determine any frame transformations (e.g. from topocentric to\n  barycentric) for you.\n\n* You can specify the absolute position of the observer and the target,\n  as well as the date of observation, which means that |SpectralCoord| can\n  then compute different frame transformations. If information about the\n  observer and target are available, this is the recommended approach,\n  although it requires you to specify more information when setting up the\n  |SpectralCoord|\n\nIn the next two sections we will look at each of these in turn.\n\nSpecifying radial velocity or redshift manually\n-----------------------------------------------\n\nAs an example, we will consider an example of a |SpectralCoord| which represents\nfrequencies which form the x-axis of a (small) spectrum. We happen to know that\nthe target that was observed appears to be at a redshift of z=0.5, and we will\nassume that any frequency shifts due to the Earth's motion are unimportant. In\nthe reference frame of the telescope, the spectrometer provides 10 values\nbetween 500 and 900nm::\n\n    >>> import numpy as np\n    >>> wavs = SpectralCoord(np.linspace(500, 900, 9) * u.nm, redshift=0.5)\n    >>> wavs  # doctest: +FLOAT_CMP\n    <SpectralCoord\n       (observer to target:\n          radial_velocity=115304.79153846153 km / s\n          redshift=0.5)\n      [500., 550., 600., 650., 700., 750., 800., 850., 900.] nm>\n\nWe have set redshift=0.5 here so that we can keep track of what frame of reference\nour spectral values are in. The ``radial_velocity`` property gives the recession\nvelocity equivalent to that redshift, and it is indeed large enough that we don't need\nto worry about the rotation of the Earth on itself around the Sun (which would be\nat most a ~30km/s contribution).\n\n.. note:: In the context of |SpectralCoord|, we use the full relativistic relation\n          between redshift and velocity, i.e. :math:`1 + z = \\sqrt{(1 + v/c)/(1 - v/c)}`\n\nWe now want to shift the wavelengths so that they would be in the rest frame of\nthe galaxy. We can do this using the\n:meth:`~astropy.coordinates.SpectralCoord.to_rest` method::\n\n    >>> wavs_rest = wavs.to_rest()\n    >>> wavs_rest\n    <SpectralCoord\n       (observer to target:\n          radial_velocity=0.0 km / s\n          redshift=0.0)\n      [333.33333333, 366.66666667, 400.        , 433.33333333, 466.66666667,\n       500.        , 533.33333333, 566.66666667, 600.        ] nm>\n\nThe wavelengths have decreased by 1/3, which is what we expect for z=0.5. Note\nthat the ``redshift`` and ``radial_velocity`` properties are now zero, since we\nare in the reference frame of the target. We can also use the\n:meth:`~astropy.coordinates.SpectralCoord.with_radial_velocity_shift` method to more\ngenerically apply redshift and velocity corrections. The simplest way to use\nthis method is to give a single value that will be applied to the target - if\nthis value does not have units, it is interpreted as a redshift::\n\n    >>> wavs_orig = wavs_rest.with_radial_velocity_shift(0.5)\n    >>> wavs_orig  # doctest: +FLOAT_CMP\n    <SpectralCoord\n       (observer to target:\n          radial_velocity=115304.79153846153 km / s\n          redshift=0.5)\n      [500., 550., 600., 650., 700., 750., 800., 850., 900.] nm>\n\nThis returns an object equivalent to the one we started with, since we've\nre-applied a redshift of 0.5. We could also provide a velocity as a |Quantity|::\n\n    >>> wavs_rest.with_radial_velocity_shift(100000 * u.km / u.s)\n    <SpectralCoord\n       (observer to target:\n          radial_velocity=100000.0 km / s\n          redshift=0.41458078170200463)\n      [471.52692723, 518.67961996, 565.83231268, 612.9850054 , 660.13769813,\n       707.29039085, 754.44308357, 801.5957763 , 848.74846902] nm>\n\nwhich shifts the values to a frame of reference at a redshift of approximately\n0.33 (that is, if the spectrum did contain a contribution from an object at\nz=0.33, these would be the rest wavelengths for that object.\n\nSpecifying an observer and a target explicitly\n----------------------------------------------\n\n.. testsetup::\n\n    >>> from astropy.coordinates import EarthLocation\n    >>> location = EarthLocation(2225015.30883296, -5440016.41799762, -2481631.27428014, unit='m')\n\nTo use the more advanced functionality in |SpectralCoord|, including the ability\nto easily transform between different well-defined velocity frames, you will\nneed to give it information about the location (and optionally velocity) of\nthe observer and target. This is done by passing either coordinate frame objects\nor |SkyCoord| objects. To take a concrete example, let's assume that we are now\nobserve the source T Tau using the ALMA telescope. To create an observer object\ncorresponding to this, we can make use of the |EarthLocation| class::\n\n    >>> from astropy.coordinates import EarthLocation\n    >>> location = EarthLocation.of_site('ALMA')  # doctest: +SKIP\n    >>> location  # doctest: +FLOAT_CMP\n    <EarthLocation (2225015.30883296, -5440016.41799762, -2481631.27428014) m>\n\nThe three values in meters are geocentric coordinates, i.e. the 3D coordinates\nrelative to the center of the Earth. See |EarthLocation| for more details about\nthe different ways of creating these kinds of objects.\n\nOnce you have done this, you will need to convert ``location`` to a coordinate\nobject using the :meth:`~astropy.coordinates.EarthLocation.get_itrs` method,\nwhich takes the observation time (which is important to know for any kind of\nvelocity frame transformation)::\n\n    >>> from astropy.time import Time\n    >>> alma = location.get_itrs(obstime=Time('2019-04-24T02:32:10'))\n    >>> alma  # doctest: +FLOAT_CMP\n    <ITRS Coordinate (obstime=2019-04-24T02:32:10.000): (x, y, z) in m\n        (2225015.30883296, -5440016.41799762, -2481631.27428014)>\n\nITRS here stands for International Terrestrial Reference System which is a 3D\ncoordinate frame centered on the Earth's center and rotating with the Earth, so\nthe observatory will be stationary in this frame of reference.\n\nFor the target, the simplest way is to use the |SkyCoord| class::\n\n    >>> from astropy.coordinates import SkyCoord\n    >>> ttau = SkyCoord('04h21m59.43s +19d32m06.4', frame='icrs',\n    ...                 radial_velocity=23.9 * u.km / u.s,\n    ...                 distance=144.321 * u.pc)\n\nIn this case we specified a radial velocity and a distance for the target (using\nthe `T Tauri SIMBAD entry\n<http://simbad.u-strasbg.fr/simbad/sim-id?Ident=T+Tauri>`_, but it is also\npossible to not specify these, which means the target is assumed to be\nstationary in the frame in which it is observed, and are assumed to be at large\ndistance from the Sun (such that any parallax effects would be unimportant if\nrelevant). The radial velocity is assumed to be in the frame used to define the\ntarget location, so it is relative to the ICRS origin (the Solar System\nbarycenter) in the above case.\n\nWe now define a set of frequencies corresponding to the channels in which fluxes\nhave been measured (for the purposes of the example here we will assume we have only\n11 frequencies)::\n\n    >>> sc_ttau = SpectralCoord(np.linspace(200, 300, 11) * u.GHz,\n    ...                         observer=alma, target=ttau)  # doctest: +IGNORE_WARNINGS\n    >>> sc_ttau  # doctest: +FLOAT_CMP +REMOTE_DATA\n    <SpectralCoord\n       (observer: <ITRS Coordinate (obstime=2019-04-24T02:32:10.000): (x, y, z) in m\n                      (2225015.30883296, -5440016.41799762, -2481631.27428014)\n                   (v_x, v_y, v_z) in km / s\n                      (0., 0., 0.)>\n        target: <ICRS Coordinate: (ra, dec, distance) in (deg, deg, pc)\n                    (65.497625, 19.53511111, 144.321)\n                 (radial_velocity) in km / s\n                    (23.9,)>\n        observer to target (computed from above):\n          radial_velocity=41.03594953774002 km / s\n          redshift=0.00013689056329480032)\n      [200., 210., 220., 230., 240., 250., 260., 270., 280., 290., 300.] GHz>\n\nWe can already see above that |SpectralCoord| has computed the difference in\nvelocity between the observatory and T Tau, which includes the motion of the\nobservatory around the Earth, the motion of the Earth around the Solar System\nbarycenter, and the radial velocity of T Tau relative to the Solar System\nbarycenter. We can get this value directly with::\n\n    >>> sc_ttau.radial_velocity  # doctest: +FLOAT_CMP +REMOTE_DATA\n    <Quantity 41.03594948 km / s>\n\nIf you work with any kind of spectral data, you will often need to determine\nand/or apply velocity corrections due to different frames of reference. For\nexample if you have observations of the same object on the sky taken at\ndifferent dates, it is common to transform these to a common velocity frame of\nreference, so that your spectral coordinates are those that would have applied\nif the observer had been stationary relative to e.g. the Solar System\nBarycenter. You may also want to transform your spectral coordinates so that\nthey would be in a frame at rest relative to the local standard of rest (LSR),\nthe center of the Milky Way, the Local Group, or even the Cosmic Microwave\nBackground (CMB) dipole.\n\nWe can transform our frequencies for the observations of T Tau to different\nvelocity frames using the\n:meth:`~astropy.coordinates.SpectralCoord.with_observer_stationary_relative_to`\nmethod. This method can take the name of an existing coordinate/velocity frame,\na :class:`~astropy.coordinates.BaseCoordinateFrame` instance, or any arbitrary\n3D position and velocity coordinate object defined either as a\n:class:`~astropy.coordinates.BaseCoordinateFrame` or a |SkyCoord| object. Most\ncommonly-used frames are accessible using strings. For example to transform to a\nvelocity frame stationary with respect to the center of the Earth (so removing\nthe effect of the Earth's rotation), we can use the ``'gcrs'`` which stands for\n*Geocentric Celestial Reference System* (GCRS)::\n\n    >>> sc_ttau.with_observer_stationary_relative_to('gcrs')  # doctest: +SKIP\n    <SpectralCoord\n       (observer: <GCRS Coordinate (obstime=2019-04-24T02:32:10.000, obsgeoloc=(0., 0., 0.) m, obsgeovel=(0., 0., 0.) m / s): (x, y, z) in m\n                      (-5878853.86171412, -192921.84773269, -2470794.19765021)\n                   (v_x, v_y, v_z) in km / s\n                      (4.33251262e-09, 8.96175625e-08, -1.49258412e-08)>\n        target: <ICRS Coordinate: (ra, dec, distance) in (deg, deg, pc)\n                    (65.497625, 19.53511111, 144.321)\n                 (radial_velocity) in km / s\n                    (23.9,)>\n        observer to target (computed from above):\n          radial_velocity=40.674086368345165 km / s\n          redshift=0.00013568335316072044)\n      [200.00024141, 210.00025348, 220.00026555, 230.00027762, 240.00028969,\n       250.00030176, 260.00031383, 270.0003259 , 280.00033797, 290.00035004,\n       300.00036211] GHz>\n\nAs you can see, the frequencies have changed slightly, which is because we have\nremoved the Doppler shift caused by the Earth's rotation (this can also be seen\nin the ``radial_velocity`` property, which has changed by ~0.35 km/s. To use a\nvelocity reference frame relative to the Solar System barycenter, which is the\norigin of the *International Celestial Reference System* (ICRS) system, we can use::\n\n    >>> sc_ttau.with_observer_stationary_relative_to('icrs')  # doctest: +FLOAT_CMP +REMOTE_DATA\n    <SpectralCoord\n       (observer: <ICRS Coordinate: (x, y, z) in m\n                      (-1.25867767e+11, -7.48979688e+10, -3.24757657e+10)\n                   (v_x, v_y, v_z) in km / s\n                      (0., 0., 0.)>\n        target: <ICRS Coordinate: (ra, dec, distance) in (deg, deg, pc)\n                    (65.497625, 19.53511111, 144.321)\n                 (radial_velocity) in km / s\n                    (23.9,)>\n        observer to target (computed from above):\n          radial_velocity=23.9 km / s\n          redshift=7.97249967898761e-05)\n      [200.0114322 , 210.01200381, 220.01257542, 230.01314703, 240.01371864,\n       250.01429025, 260.01486186, 270.01543347, 280.01600508, 290.01657669,\n       300.0171483 ] GHz>\n\nNote that in this case the total radial velocity between the observer and the\ntarget matches what we specified when we set up the target, since it was defined\nrelative to the ICRS origin (the Solar System barycenter). The observer location\nis still as before, but the observer velocity is now ~10-20 km/s in x, y, and z,\nwhich is because the observer is now stationary relative to the barycenter so has\na significant velocity relative to the surface of the Earth.\n\nWe can also transform the frequencies to the Kinematic Local Standard of Rest\n(LSRK) frame of reference, which is a reference frame commonly used in some\nbranches of astronomy (such as radio astronomy)::\n\n    >>> sc_ttau.with_observer_stationary_relative_to('lsrk')  # doctest: +FLOAT_CMP +REMOTE_DATA\n    <SpectralCoord\n       (observer: <LSRK Coordinate: (x, y, z) in m\n                      (-1.25867767e+11, -7.48979688e+10, -3.24757657e+10)\n                   (v_x, v_y, v_z) in km / s\n                      (0., 0., 0.)>\n        target: <ICRS Coordinate: (ra, dec, distance) in (deg, deg, pc)\n                    (65.497625, 19.53511111, 144.321)\n                 (radial_velocity) in km / s\n                    (23.9,)>\n        observer to target (computed from above):\n          radial_velocity=12.50698856018455 km / s\n          redshift=4.171969349386906e-05)\n      [200.01903338, 210.01998505, 220.02093672, 230.02188839, 240.02284006,\n       250.02379172, 260.02474339, 270.02569506, 280.02664673, 290.0275984 ,\n       300.02855007] GHz>\n\n\nSee :ref:`spectralcoord-common-frames` for a list of common velocity frames\navailable as strings on the |SpectralCoord| class.\n\nSince we can give any arbitrary |SkyCoord| to the\n:meth:`~astropy.coordinates.SpectralCoord.with_observer_stationary_relative_to`\nmethod, we can also specify the target itself, to find the frequencies in the\nrest frame of the target::\n\n    >>> sc_ttau_targetframe = sc_ttau.with_observer_stationary_relative_to(sc_ttau.target)  # doctest: +REMOTE_DATA\n    >>> sc_ttau_targetframe  # doctest: +FLOAT_CMP +REMOTE_DATA\n    <SpectralCoord\n       (observer: <ICRS Coordinate: (x, y, z) in m\n                      (-1.25867767e+11, -7.48979688e+10, -3.24757657e+10)\n                   (v_x, v_y, v_z) in km / s\n                      (9.34149908, 20.49579745, 7.99178839)>\n        target: <ICRS Coordinate: (ra, dec, distance) in (deg, deg, pc)\n                    (65.497625, 19.53511111, 144.321)\n                 (radial_velocity) in km / s\n                    (23.9,)>\n        observer to target (computed from above):\n          radial_velocity=0.0 km / s\n          redshift=0.0)\n      [200.02737811, 210.02874702, 220.03011592, 230.03148483, 240.03285374,\n       250.03422264, 260.03559155, 270.03696045, 280.03832936, 290.03969826,\n       300.04106717] GHz>\n\nThe ``radial_velocity``, which is the velocity offset between observer and\ntarget, is now zero.\n\n|SpectralCoord| is intended to be versatile and be useful for representing any spectral\nvalues - not just the x-axis of a spectrum, but also for example the\nfrequencies of spectral features. For example, if we now consider that we found a\nspectral feature that appears to have components at the following frequencies\nin the frame of reference of the telescope::\n\n    >>> sc_feat = SpectralCoord([115.26, 115.266, 115.267] * u.GHz,\n    ...                         observer=alma, target=ttau)  # doctest: +IGNORE_WARNINGS\n\nWe can convert these to the rest frame of the target using::\n\n    >>> sc_feat_rest = sc_feat.with_observer_stationary_relative_to(sc_feat.target)  # doctest: +REMOTE_DATA\n    >>> sc_feat_rest  # doctest: +FLOAT_CMP +REMOTE_DATA\n    <SpectralCoord\n       (observer: <ICRS Coordinate: (x, y, z) in m\n                      (-1.25867767e+11, -7.48979688e+10, -3.24757657e+10)\n                   (v_x, v_y, v_z) in km / s\n                      (9.34149908, 20.49579745, 7.99178839)>\n        target: <ICRS Coordinate: (ra, dec, distance) in (deg, deg, pc)\n                    (65.497625, 19.53511111, 144.321)\n                 (radial_velocity) in km / s\n                    (23.9,)>\n        observer to target (computed from above):\n          radial_velocity=0.0 km / s\n          redshift=0.0)\n      [115.27577801, 115.28177883, 115.28277896] GHz>\n\nThe frequencies are very close to the rest frequency of the 12CO J=1-0 molecular line transition,\nwhich is 115.2712018 GHz. However, they are not exactly the same, so if the features we see are\nindeed from 12CO, then they are Doppler shifted compared to what we consider the rest frame of\nT Tau. We can convert these frequencies to velocities assuming the Doppler shift equation\n(in this case with the radio convention)::\n\n    >>> sc_feat_rest.to(u.km / u.s, doppler_convention='radio', doppler_rest=115.27120180 * u.GHz)  # doctest: +FLOAT_CMP +REMOTE_DATA\n    <SpectralCoord\n       (observer: <ICRS Coordinate: (x, y, z) in m\n                      (-1.25867767e+11, -7.48979688e+10, -3.24757657e+10)\n                   (v_x, v_y, v_z) in km / s\n                      (9.34149908, 20.49579745, 7.99178839)>\n        target: <ICRS Coordinate: (ra, dec, distance) in (deg, deg, pc)\n                    (65.497625, 19.53511111, 144.321)\n                 (radial_velocity) in km / s\n                    (23.9,)>\n        observer to target (computed from above):\n          radial_velocity=0.0 km / s\n          redshift=0.0\n        doppler_rest=115.2712018 GHz\n        doppler_convention=radio)\n      [-11.90160353, -27.50828545, -30.1093991 ] km / s>\n\nNote that these resulting velocities are different from the ``radial_velocity``\nproperty (which is still zero here) - the latter is the difference in velocity\nbetween observer and target, while the former are how much the spectral values\nare Doppler shifted by relative to the rest frequency or wavelength.\n\nSo if the features are indeed from 12CO, they have velocities of approximately -11.9, -27.5 and\n-30.1 km/s relative to the T tau rest frame.\n\n.. _spectralcoord-common-frames:\n\nCommon velocity frames\n======================\n\nAny valid astropy coordinate frame can be passed to the\n:meth:`~astropy.coordinates.SpectralCoord.with_observer_stationary_relative_to`\nmethod, including string aliases such as ``icrs``. Below we list some of the\nframes commonly used to define spectral coordinates in:\n\nThe velocity frames available as constants on the |SpectralCoord| class are:\n\n========================== =================================================\nFrame name                 Description\n========================== =================================================\n``'gcrs'``                 Geocentric frame (defined as stationary relative to the GCRS origin)\n``'icrs'``                 Barycentric frame (defined as stationary relative to the ICRS origin)\n``'hcrs'``                 Heliocentric frame (defined as stationary relative to the HCRS origin)\n``'lsrk``                  Kinematic Local Standard of Rest (LSRK),\n                           defined as having a velocity of 20 km/s towards\n                           18h +30d (B1900) relative to the Solar System\n                           Barycenter [1]_.\n``'lsrd'``                 Dynamical Local Standard of Rest (LSRD),\n                           defined as having a velocity of U=9 km/s,\n                           V=12 km/s, and W=7 km/s in Galactic coordinates\n                           (equivalent to 16.552945 km/s towards l=53.13\n                           and b=25.02) [2]_.\n``'lsr'``                  A more recent definition of the Local Standard\n                           of rest, with U=11.1 km/s,\n                           V=12.24 km/s, and W=7.25 km/s in Galactic coordinates [3]_.\n========================== =================================================\n\nDefining custom velocity frames\n===============================\n\nAs mentioned in the earlier examples on this page, it is possible to pass any\narbitrary :class:`~astropy.coordinates.BaseCoordinateFrame` or |SkyCoord| object\nto the :meth:`~astropy.coordinates.SpectralCoord.with_observer_stationary_relative_to` method,\nand the observer will be updated to be stationary relative to those coordinates.\nAs an example, we can define an object that can be used to define a velocity\nframe that moves with the local group of galaxies. There is not a unique definition\nof this, but for the purposes of this example we use the IAU 1976-recommended\nvalue which states that the Solar System barycenter is moving at 300 km/s towards\nl=90 and b=0 in the velocity frame of the local group of galaxies [4]_. Given\nthis value, we can define the velocity frame using::\n\n    >>> from astropy.coordinates import Galactic\n    >>> localgroup_frame = Galactic(u=0 * u.km, v=0 * u.km, w=0 * u.km,\n    ...                             U=0 * u.km / u.s, V=-300 * u.km / u.s, W=0 * u.km / u.s,\n    ...                             representation_type='cartesian',\n    ...                             differential_type='cartesian')\n\nNote that here we specify the velocity as -300, because what we need here is the\nvelocity of the local group relative to the Solar System barycenter. With this\nobject, we can then transform a |SpectralCoord| so that the observer is stationary\nin that frame of reference::\n\n    >>> sc_ttau.with_observer_stationary_relative_to(localgroup_frame)  # doctest: +FLOAT_CMP +REMOTE_DATA\n    <SpectralCoord\n       (observer: <Galactic Coordinate: (u, v, w) in m\n                      (8.8038652e+10, -5.31344273e+10, 1.09238291e+11)\n                   (U, V, W) in km / s\n                      (-1.42108547e-14, -300., 2.84217094e-14)>\n        target: <ICRS Coordinate: (ra, dec, distance) in (deg, deg, pc)\n                    (65.497625, 19.53511111, 144.321)\n                 (radial_velocity) in km / s\n                    (23.9,)>\n        observer to target (computed from above):\n          radial_velocity=42.33062895275233 km / s\n          redshift=0.00014120974955456056)\n      [199.99913628, 209.9990931 , 219.99904991, 229.99900673, 239.99896354,\n       249.99892036, 259.99887717, 269.99883398, 279.9987908 , 289.99874761,\n       299.99870443] GHz>\n\nReferences\n==========\n\n.. [1] Meeks, M. L. 1976, *Methods of experimental physics. Vol._12.\n       Astrophysics. Part C: Radio observations*, Section 6.1 by Gordon, M. A.\n       `[ADS] <https://ui.adsabs.harvard.edu/abs/1976mep..book.....M>`__.\n.. [2] Delhaye, J. 1965, *Galactic Structure*. Edited by Adriaan Blaauw and\n       Maarten Schmidt. Published by the University of Chicago Press, p61\n       `[ADS] <https://ui.adsabs.harvard.edu/abs/1965gast.book...61D>`__.\n.. [3] Schönrich, R., Binney, J., & Dehnen, W. 2010, MNRAS, 403, 1829\n       `[ADS] <https://ui.adsabs.harvard.edu/abs/2010MNRAS.403.1829S>`__.\n.. [4] *Transactions of the IAU Vol. XVI B Proceedings of the 16th General\n      Assembly, Reports of Meetings of Commissions: Comptes Rendus\n      Des Séances Des Commissions, Commission 28*.\n      `[DOI] <https://doi.org/10.1017/S0251107X00002406>`__\n\n.. The following frames are defined in FITS WCS and may be added here in future:\n..\n.. ``GALACTOCENTRIC_KLB1986`` Galactocentric frame defined as having a velocity\n..                            of 220 km/s towards l=90 and b=0 relative to\n..                            the Solar System Barycenter [3]_.\n.. ``LOCALGROUP_IAU1976``     Velocity frame representing the motion of the\n..                            Local Group of galaxies, and defined as having a velocity\n..                            of 300 km/s towards l=90 and b=0 relative to\n..                            the Solar System Barycenter [4]_.\n.. ``CMBDIPOL_WMAP1``         Velocity frame representing the motion of the\n..                            cosmic microwave background (CMB) dipole based on the\n..                            1-year WMAP data, and defined as a temperature\n..                            difference of 3.346mK (corresponding to approximately\n..                            368 km/s) in the direction of l=263.85, b=48.25 [5]_\n.. .. [3] Kerr, F. J., & Lynden-Bell, D. 1986, MNRAS, 221, 1023\n..       `[ADS] <https://ui.adsabs.harvard.edu/abs/1986MNRAS.221.1023K>`__.\n.. .. [5] Bennett, C. L., Halpern, M., Hinshaw, G., et al. 2003, ApJS, 148, 1\n..       `[ADS] <https://ui.adsabs.harvard.edu/abs/2003ApJS..148....1B>`__.\n"},{"col":4,"comment":"\n        Remove SIP information from a header.\n        ","endLoc":1068,"header":"def _remove_sip_kw(self, header)","id":497,"name":"_remove_sip_kw","nodeType":"Function","startLoc":1060,"text":"def _remove_sip_kw(self, header):\n        \"\"\"\n        Remove SIP information from a header.\n        \"\"\"\n        # Never pass SIP coefficients to wcslib\n        # CTYPE must be passed with -SIP to wcslib\n        for key in set(m.group() for m in map(SIP_KW.match, list(header))\n                       if m is not None):\n            del header[key]"},{"id":498,"name":"matchsep.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. _astropy-coordinates-separations-matching:\n\nSeparations, Offsets, Catalog Matching, and Related Functionality\n*****************************************************************\n\n`astropy.coordinates` contains commonly-used tools for comparing or\nmatching coordinate objects. Of particular importance are those for\ndetermining separations between coordinates and those for matching a\ncoordinate (or coordinates) to a catalog. These are mainly implemented\nas methods on the coordinate objects.\n\nIn the examples below, we will assume that the following imports have already\nbeen executed::\n\n    >>> import astropy.units as u\n    >>> from astropy.coordinates import SkyCoord\n\nSeparations\n===========\n\nThe on-sky separation can be computed with the\n:meth:`astropy.coordinates.BaseCoordinateFrame.separation` or\n:meth:`astropy.coordinates.SkyCoord.separation` methods,\nwhich computes the great-circle distance (*not* the small-angle approximation)::\n\n    >>> c1 = SkyCoord('5h23m34.5s', '-69d45m22s', frame='icrs')\n    >>> c2 = SkyCoord('0h52m44.8s', '-72d49m43s', frame='fk5')\n    >>> sep = c1.separation(c2)\n    >>> sep  # doctest: +FLOAT_CMP\n    <Angle 20.74611448 deg>\n\nThe returned object is an `~astropy.coordinates.Angle` instance, so it\nis possible to access the angle in any of several equivalent angular\nunits::\n\n    >>> sep.radian  # doctest: +FLOAT_CMP\n    0.36208800460262563\n    >>> sep.hour  # doctest: +FLOAT_CMP\n    1.3830742984029318\n    >>> sep.arcminute  # doctest: +FLOAT_CMP\n    1244.7668685626384\n    >>> sep.arcsecond  # doctest: +FLOAT_CMP\n    74686.0121137583\n\nAlso note that the two input coordinates were not in the same frame —\none is automatically converted to match the other, ensuring that even\nthough they are in different frames, the separation is determined\nconsistently.\n\nIn addition to the on-sky separation described above,\n:meth:`astropy.coordinates.BaseCoordinateFrame.separation_3d` or\n:meth:`astropy.coordinates.SkyCoord.separation_3d` methods will\ndetermine the 3D distance between two coordinates that have ``distance``\ndefined::\n\n    >>> c1 = SkyCoord('5h23m34.5s', '-69d45m22s', distance=70*u.kpc, frame='icrs')\n    >>> c2 = SkyCoord('0h52m44.8s', '-72d49m43s', distance=80*u.kpc, frame='icrs')\n    >>> sep = c1.separation_3d(c2)\n    >>> sep  # doctest: +FLOAT_CMP\n    <Distance 28.74398816 kpc>\n\n\nOffsets\n=======\n\nClosely related to angular separations are offsets between coordinates. The key\ndistinction for offsets is generally the concept of a \"from\" and \"to\" coordinate\nrather than the single scalar angular offset of a separation.\n`~astropy.coordinates` contains conveniences to compute some of the common\noffsets encountered in astronomy.\n\nThe first piece of such functionality is the\n:meth:`~astropy.coordinates.SkyCoord.position_angle` method. This method\ncomputes the position angle between one\n|SkyCoord| instance and another (passed as the argument) following the\nastronomy convention (positive angles East of North)::\n\n    >>> c1 = SkyCoord(1*u.deg, 1*u.deg, frame='icrs')\n    >>> c2 = SkyCoord(2*u.deg, 2*u.deg, frame='icrs')\n    >>> c1.position_angle(c2).to(u.deg)  # doctest: +FLOAT_CMP\n    <Angle 44.97818294 deg>\n\nThe combination of :meth:`~astropy.coordinates.SkyCoord.separation` and\n:meth:`~astropy.coordinates.SkyCoord.position_angle` thus give a set of\ndirectional offsets. To do the inverse operation — determining the new\n\"destination\" coordinate given a separation and position angle — the\n:meth:`~astropy.coordinates.SkyCoord.directional_offset_by` method is provided::\n\n    >>> c1 = SkyCoord(1*u.deg, 1*u.deg, frame='icrs')\n    >>> position_angle = 45 * u.deg\n    >>> separation = 1.414 * u.deg\n    >>> c1.directional_offset_by(position_angle, separation)  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        (2.0004075, 1.99964588)>\n\nThis technique is also useful for computing the midpoint (or indeed any point)\nbetween two coordinates in a way that accounts for spherical geometry\n(i.e., instead of averaging the RAs/Decs separately)::\n\n    >>> coord1 = SkyCoord(0*u.deg, 0*u.deg, frame='icrs')\n    >>> coord2 = SkyCoord(1*u.deg, 1*u.deg, frame='icrs')\n    >>> pa = coord1.position_angle(coord2)\n    >>> sep = coord1.separation(coord2)\n    >>> coord1.directional_offset_by(pa, sep/2)  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        (0.49996192, 0.50001904)>\n\nThere is also a :meth:`~astropy.coordinates.SkyCoord.spherical_offsets_to`\nmethod for computing angular offsets (e.g., small shifts like you might give a\ntelescope operator to move from a bright star to a fainter target)::\n\n    >>> bright_star = SkyCoord('8h50m59.75s', '+11d39m22.15s', frame='icrs')\n    >>> faint_galaxy = SkyCoord('8h50m47.92s', '+11d39m32.74s', frame='icrs')\n    >>> dra, ddec = bright_star.spherical_offsets_to(faint_galaxy)\n    >>> dra.to(u.arcsec)  # doctest: +FLOAT_CMP\n    <Angle -173.78873354 arcsec>\n    >>> ddec.to(u.arcsec)  # doctest: +FLOAT_CMP\n    <Angle 10.60510342 arcsec>\n\nThe conceptual inverse of\n:meth:`~astropy.coordinates.SkyCoord.spherical_offsets_to` is also available as\na method on any |SkyCoord| object:\n:meth:`~astropy.coordinates.SkyCoord.spherical_offsets_by`, which accepts two\nangular offsets (in longitude and latitude) and returns the coordinates at the\noffset location::\n\n    >>> target_star = SkyCoord(86.75309*u.deg, -31.5633*u.deg, frame='icrs')\n    >>> target_star.spherical_offsets_by(1.3*u.arcmin, -0.7*u.arcmin)  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        (86.77852168, -31.57496415)>\n\n.. _astropy-skyoffset-frames:\n\n\"Sky Offset\" Frames\n-------------------\n\nTo extend the concept of spherical offsets, `~astropy.coordinates` has\na frame class :class:`~astropy.coordinates.builtin_frames.skyoffset.SkyOffsetFrame`\nwhich creates distinct frames that are centered on a specific point.\nThese are known as \"sky offset frames,\" as they are a convenient way to create\na frame centered on an arbitrary position on the sky suitable for computing\npositional offsets (e.g., for astrometry)::\n\n    >>> from astropy.coordinates import SkyOffsetFrame, ICRS\n    >>> center = ICRS(10*u.deg, 45*u.deg)\n    >>> center.transform_to(SkyOffsetFrame(origin=center)) # doctest: +FLOAT_CMP\n    <SkyOffsetICRS Coordinate (rotation=0.0 deg, origin=<ICRS Coordinate: (ra, dec) in deg\n        (10., 45.)>): (lon, lat) in deg\n        (0., 0.)>\n    >>> target = ICRS(11*u.deg, 46*u.deg)\n    >>> target.transform_to(SkyOffsetFrame(origin=center))  # doctest: +FLOAT_CMP\n    <SkyOffsetICRS Coordinate (rotation=0.0 deg, origin=<ICRS Coordinate: (ra, dec) in deg\n        (10., 45.)>): (lon, lat) in deg\n        (0.69474685, 1.00428706)>\n\n\nAlternatively, the convenience method\n:meth:`~astropy.coordinates.SkyCoord.skyoffset_frame` lets you create a sky\noffset frame from an existing |SkyCoord|::\n\n    >>> center = SkyCoord(10*u.deg, 45*u.deg)\n    >>> aframe = center.skyoffset_frame()\n    >>> target.transform_to(aframe)  # doctest: +FLOAT_CMP\n    <SkyOffsetICRS Coordinate (rotation=0.0 deg, origin=<ICRS Coordinate: (ra, dec) in deg\n        (10., 45.)>): (lon, lat) in deg\n        (0.69474685, 1.00428706)>\n    >>> other = SkyCoord(9*u.deg, 44*u.deg, frame='fk5')\n    >>> other.transform_to(aframe)  # doctest: +FLOAT_CMP\n    <SkyCoord (SkyOffsetICRS: rotation=0.0 deg, origin=<ICRS Coordinate: (ra, dec) in deg\n        (10., 45.)>): (lon, lat) in deg\n        (-0.71943945, -0.99556216)>\n\n.. note ::\n\n    While sky offset frames *appear* to be all the same class, this not the\n    case: the sky offset frame for each different type of frame for ``origin`` is\n    actually a distinct class. E.g., ``SkyOffsetFrame(origin=ICRS(...))``\n    yields an object of class ``SkyOffsetICRS``, *not* ``SkyOffsetFrame``.\n    While this is not important for most uses of this class, it is important for\n    things like type-checking, because something like\n    ``SkyOffsetFrame(origin=ICRS(...)).__class__ is SkyOffsetFrame`` will\n    *not* be ``True``, as it would be for most classes.\n\nThis same frame is also useful as a tool for defining frames that are relative\nto a specific, known object useful for hierarchical physical systems like galaxy\ngroups. For example, objects around M31 are sometimes shown in a coordinate\nframe aligned with standard ICRA RA/Dec, but on M31::\n\n    >>> m31 = SkyCoord(10.6847083*u.deg, 41.26875*u.deg, frame='icrs')\n    >>> ngc147 = SkyCoord(8.3005*u.deg, 48.5087389*u.deg, frame='icrs')\n    >>> ngc147_inm31 = ngc147.transform_to(m31.skyoffset_frame())\n    >>> xi, eta = ngc147_inm31.lon, ngc147_inm31.lat\n    >>> xi  # doctest: +FLOAT_CMP\n    <Longitude -1.59206948 deg>\n    >>> eta  # doctest: +FLOAT_CMP\n    <Latitude 7.26183757 deg>\n\n.. note::\n\n    Currently, distance information in the ``origin`` of a\n    :class:`~astropy.coordinates.builtin_frames.skyoffset.SkyOffsetFrame` is not\n    used to compute any part of the transform. The ``origin`` is only used for\n    on-sky rotation. This may change in the future, however.\n\n\n.. _astropy-coordinates-matching:\n\nMatching Catalogs\n=================\n\n`~astropy.coordinates` leverages the coordinate framework to make it\npossible to find the closest coordinates in a catalog to a desired set\nof other coordinates. For example, assuming ``ra1``/``dec1`` and\n``ra2``/``dec2`` are NumPy arrays loaded from some file:\n\n.. testsetup::\n    >>> ra1 = [5.3517]\n    >>> dec1 = [-5.2328]\n    >>> distance1 = 1344\n    >>> ra2 = [6.459]\n    >>> dec2 = [-16.4258]\n    >>> distance2 = 8.611\n\n.. doctest-requires:: scipy\n\n    >>> c = SkyCoord(ra=ra1*u.degree, dec=dec1*u.degree)\n    >>> catalog = SkyCoord(ra=ra2*u.degree, dec=dec2*u.degree)\n    >>> idx, d2d, d3d = c.match_to_catalog_sky(catalog)\n\nThe distances returned ``d3d`` are 3-dimensional distances.\nUnless both source (``c``) and catalog (``catalog``) coordinates have\nassociated distances, this quantity assumes that all sources are at a distance\nof 1 (dimensionless).\n\nYou can also find the nearest 3D matches, different from the on-sky\nseparation shown above only when the coordinates were initialized with\na ``distance``:\n\n.. doctest-requires:: scipy\n\n    >>> c = SkyCoord(ra=ra1*u.degree, dec=dec1*u.degree, distance=distance1*u.kpc)\n    >>> catalog = SkyCoord(ra=ra2*u.degree, dec=dec2*u.degree, distance=distance2*u.kpc)\n    >>> idx, d2d, d3d = c.match_to_catalog_3d(catalog)\n\nNow ``idx`` are indices into ``catalog`` that are the closest objects to each\nof the coordinates in ``c``, ``d2d`` are the on-sky distances between them, and\n``d3d`` are the 3-dimensional distances. Because coordinate objects support\nindexing, ``idx`` enables easy access to the matched set of coordinates in\nthe catalog:\n\n.. doctest-requires:: scipy\n\n    >>> matches = catalog[idx]\n    >>> (matches.separation_3d(c) == d3d).all()\n    True\n    >>> dra, ddec = c.spherical_offsets_to(matches)\n\nThis functionality can also be accessed from the\n:func:`~astropy.coordinates.match_coordinates_sky` and\n:func:`~astropy.coordinates.match_coordinates_3d` functions. These\nwill work on either |SkyCoord| objects *or* the lower-level frame classes:\n\n.. doctest-requires:: scipy\n\n    >>> from astropy.coordinates import match_coordinates_sky\n    >>> idx, d2d, d3d = match_coordinates_sky(c, catalog)\n    >>> idx, d2d, d3d = match_coordinates_sky(c.frame, catalog.frame)\n\nIt is possible to impose a separation constraint (e.g., the maximum separation to be\nconsidered a match) by creating a boolean mask with ``d2d`` or ``d3d``. For example:\n\n.. doctest-requires:: scipy\n\n    >>> max_sep = 1.0 * u.arcsec\n    >>> idx, d2d, d3d = c.match_to_catalog_3d(catalog)\n    >>> sep_constraint = d2d < max_sep\n    >>> c_matches = c[sep_constraint]\n    >>> catalog_matches = catalog[idx[sep_constraint]]\n\nNow, ``c_matches`` and ``catalog_matches`` are the matched sources in ``c``\nand ``catalog``, respectively, which are separated by less than 1 arcsecond.\n\n.. _astropy-searching-coordinates:\n\nSearching around Coordinates\n============================\n\nClosely related functionality can be used to search for *all* coordinates within\na certain distance (either 3D distance or on-sky) of another set of coordinates.\nThe ``search_around_*`` methods (and functions) provide this functionality,\nwith an interface very similar to ``match_coordinates_*``:\n\n..  doctest-requires:: scipy\n\n    >>> import numpy as np\n    >>> idxc, idxcatalog, d2d, d3d = catalog.search_around_sky(c, 1*u.deg)\n    >>> np.all(d2d < 1*u.deg)\n    True\n\n.. doctest-requires:: scipy\n\n    >>> idxc, idxcatalog, d2d, d3d = catalog.search_around_3d(c, 1*u.kpc)\n    >>> np.all(d3d < 1*u.kpc)\n    True\n\nThe key difference for these methods is that there can be multiple (or no)\nmatches in ``catalog`` around any locations in ``c``. Hence, indices into both\n``c`` and ``catalog`` are returned instead of just indices into ``catalog``.\nThese can then be indexed back into the two |SkyCoord| objects, or, for that\nmatter, any array with the same order:\n\n..  doctest-requires:: scipy\n\n    >>> np.all(c[idxc].separation(catalog[idxcatalog]) == d2d)\n    True\n    >>> np.all(c[idxc].separation_3d(catalog[idxcatalog]) == d3d)\n    True\n    >>> print(catalog_objectnames[idxcatalog]) #doctest: +SKIP\n    ['NGC 1234' 'NGC 4567' ...]\n\nNote, though, that this dual-indexing means that ``search_around_*`` does not\nwork well if one of the coordinates is a scalar, because the returned index\nwould not make sense for a scalar::\n\n    >>> scalarc = SkyCoord(ra=1*u.deg, dec=2*u.deg, distance=distance1*u.kpc)\n    >>> idxscalarc, idxcatalog, d2d, d3d = catalog.search_around_sky(scalarc, 1*u.deg) # doctest: +SKIP\n    ValueError: One of the inputs to search_around_sky is a scalar.\n\nAs a result (and because the ``search_around_*`` algorithm is inefficient in\nthe scalar case), the best approach for this scenario is to instead\nuse the ``separation*`` methods:\n\n..  doctest-requires:: scipy\n\n    >>> d2d = scalarc.separation(catalog)\n    >>> catalogmsk = d2d < 1*u.deg\n    >>> d3d = scalarc.separation_3d(catalog)\n    >>> catalog3dmsk = d3d < 1*u.kpc\n\nThe resulting ``catalogmsk`` or ``catalog3dmsk`` variables are boolean arrays\nrather than arrays of indices, but in practice they usually can be used in\nthe same way as ``idxcatalog`` from the above examples. If you definitely do\nneed indices instead of boolean masks, you can do:\n\n..  doctest-requires:: scipy\n\n    >>> idxcatalog = np.where(catalogmsk)[0]\n    >>> idxcatalog3d = np.where(catalog3dmsk)[0]\n"},{"id":499,"name":"skycoord.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. _astropy-coordinates-high-level:\n\nUsing the SkyCoord High-Level Class\n***********************************\n\nThe |SkyCoord| class provides a simple and flexible user interface for\ncelestial coordinate representation, manipulation, and transformation between\ncoordinate frames. This is a high-level class that serves as a wrapper\naround the low-level coordinate frame classes like `~astropy.coordinates.ICRS`\nand `~astropy.coordinates.FK5` which do most of the heavy lifting.\n\nThe key distinctions between |SkyCoord| and the low-level classes\n(:doc:`frames`) are as follows:\n\n- The |SkyCoord| object can maintain the union of frame attributes for all\n  built-in and user-defined coordinate frames in the\n  ``astropy.coordinates.frame_transform_graph``. Individual frame classes hold\n  only the required attributes (e.g., equinox, observation time, or observer\n  location) for that frame. This means that a transformation from\n  `~astropy.coordinates.FK4` (with equinox and observation time) to\n  `~astropy.coordinates.ICRS` (with neither) and back to\n  `~astropy.coordinates.FK4` via the low-level classes would not remember the\n  original equinox and observation time. Since the |SkyCoord| object stores\n  all attributes, such a round-trip transformation will return to the same\n  coordinate object.\n\n- The |SkyCoord| class is more flexible with inputs to accommodate a wide\n  variety of user preferences and available data formats, whereas the frame\n  classes expect to receive quantity-like objects with angular units.\n\n- The |SkyCoord| class has a number of convenience methods that are useful\n  in typical analysis.\n\n- At present, |SkyCoord| objects can use only coordinate frames that have\n  transformations defined in the ``astropy.coordinates.frame_transform_graph``\n  transform graph object.\n\nCreating SkyCoord Objects\n=========================\n\nThe |SkyCoord| class accepts a wide variety of inputs for initialization.\nAt a minimum, these must provide one or more celestial coordinate values\nwith unambiguous units. Typically you must also specify the coordinate\nframe, though this is not required.\n\nCommon patterns are shown below. In this description the values in upper\ncase like ``COORD`` or ``FRAME`` represent inputs which are described in detail\nin the `Initialization Syntax`_ section. Elements in square brackets like\n``[unit=UNIT]`` are optional.\n::\n\n  SkyCoord(COORD, [FRAME], keyword_args ...)\n  SkyCoord(LON, LAT, [frame=FRAME], [unit=UNIT], keyword_args ...)\n  SkyCoord([FRAME], <lon_attr>=LON, <lat_attr>=LAT, keyword_args ...)\n\nThe examples below illustrate common ways of initializing a |SkyCoord| object.\nThese all reflect initializing using spherical coordinates, which is the\ndefault for all built-in frames. In order to understand working with coordinates\nusing a different representation, such as Cartesian or cylindrical, see the\nsection on `Representations`_. First, some imports::\n\n  >>> from astropy.coordinates import SkyCoord  # High-level coordinates\n  >>> from astropy.coordinates import ICRS, Galactic, FK4, FK5  # Low-level frames\n  >>> from astropy.coordinates import Angle, Latitude, Longitude  # Angles\n  >>> import astropy.units as u\n  >>> import numpy as np\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Initializing SkyCoord Objects Using Spherical Coordinates\n\nThe coordinate values and frame specification can be provided using\npositional and keyword arguments. First we show positional arguments for\nRA and Dec::\n\n  >>> SkyCoord(10, 20, unit='deg')  # Defaults to ICRS  # doctest: +FLOAT_CMP\n  <SkyCoord (ICRS): (ra, dec) in deg\n      (10., 20.)>\n\n  >>> SkyCoord([1, 2, 3], [-30, 45, 8], frame='icrs', unit='deg')  # doctest: +FLOAT_CMP\n  <SkyCoord (ICRS): (ra, dec) in deg\n      [(1., -30.), (2., 45.), (3.,   8.)]>\n\nNotice that the first example above does not explicitly give a frame. In\nthis case, the default is taken to be the ICRS system (approximately\ncorrect for \"J2000\" equatorial coordinates). It is always better to\nexplicitly specify the frame when it is known to be ICRS, however, as\nanyone reading the code will be better able to understand the intent.\n\nString inputs in common formats are acceptable, and the frame can be supplied\nas either a class type like `~astropy.coordinates.FK4`, an instance of a\nframe class, a `~astropy.coordinates.SkyCoord` instance (from which the frame\nwill be extracted), or the lowercase version of a frame name as a string, for\nexample, ``\"fk4\"``::\n\n  >>> coords = [\"1:12:43.2 +1:12:43\", \"1 12 43.2 +1 12 43\"]\n  >>> sc = SkyCoord(coords, frame=FK4, unit=(u.hourangle, u.deg), obstime=\"J1992.21\")\n  >>> sc = SkyCoord(coords, frame=FK4(obstime=\"J1992.21\"), unit=(u.hourangle, u.deg))\n  >>> sc = SkyCoord(coords, frame='fk4', unit='hourangle,deg', obstime=\"J1992.21\")\n\n  >>> sc = SkyCoord(\"1h12m43.2s\", \"+1d12m43s\", frame=Galactic)  # Units from strings\n  >>> sc = SkyCoord(\"1h12m43.2s +1d12m43s\", frame=Galactic)  # Units from string\n  >>> sc = SkyCoord(l=\"1h12m43.2s\", b=\"+1d12m43s\", frame='galactic')\n  >>> sc = SkyCoord(\"1h12.72m +1d12.71m\", frame='galactic')\n\nNote that frame instances with data and `~astropy.coordinates.SkyCoord`\ninstances can only be passed as frames using the ``frame=`` keyword argument\nand not as positional arguments.\n\nFor representations that have ``ra`` and ``dec`` attributes you can supply a\ncoordinate string in a number of other common formats. Examples include::\n\n  >>> sc = SkyCoord(\"15h17+89d15\")\n  >>> sc = SkyCoord(\"275d11m15.6954s+17d59m59.876s\")\n  >>> sc = SkyCoord(\"8 00 -5 00.6\", unit=(u.hour, u.deg))\n  >>> sc = SkyCoord(\"J080000.00-050036.00\", unit=(u.hour, u.deg))\n  >>> sc = SkyCoord(\"J1874221.31+122328.03\", unit=u.deg)\n\nAstropy `~astropy.units.Quantity`-type objects are acceptable and encouraged\nas a form of input::\n\n  >>> ra = Longitude([1, 2, 3], unit=u.deg)  # Could also use Angle\n  >>> dec = np.array([4.5, 5.2, 6.3]) * u.deg  # Astropy Quantity\n  >>> sc = SkyCoord(ra, dec, frame='icrs')\n  >>> sc = SkyCoord(ra=ra, dec=dec, frame=ICRS, obstime='2001-01-02T12:34:56')\n\nFinally, it is possible to initialize from a low-level coordinate frame object.\n\n  >>> c = FK4(1 * u.deg, 2 * u.deg)\n  >>> sc = SkyCoord(c, obstime='J2010.11', equinox='B1965')  # Override defaults\n\nA key subtlety highlighted here is that when low-level objects are created they\nhave certain default attribute values. For instance, the\n`~astropy.coordinates.FK4` frame uses ``equinox='B1950.0`` and\n``obstime=equinox`` as defaults. If this object is used to initialize a\n|SkyCoord| it is possible to override the low-level object attributes that were\nnot explicitly set. If the coordinate above were created with\n``c = FK4(1 * u.deg, 2 * u.deg, equinox='B1960')`` then creating a |SkyCoord|\nwith a different ``equinox`` would raise an exception.\n\n..\n  EXAMPLE END\n\nInitialization Syntax\n---------------------\n\nFor spherical representations, which are the most common and are the default\ninput format for all built-in frames, the syntax for |SkyCoord| is given\nbelow::\n\n  SkyCoord(COORD, [FRAME | frame=FRAME], [unit=UNIT], keyword_args ...)\n  SkyCoord(LON, LAT, [DISTANCE], [FRAME | frame=FRAME], [unit=UNIT], keyword_args ...)\n  SkyCoord([FRAME | frame=FRAME], <lon_name>=LON, <lat_name>=LAT, [unit=UNIT],\n           keyword_args ...)\n\nIn the above description, elements in all capital letters (e.g., ``FRAME``)\ndescribe a user input of that element type. Elements in square brackets are\noptional. For nonspherical inputs, see the `Representations`_ section.\n\n\n**LON**, **LAT**\n\nLongitude and latitude value can be specified as separate positional arguments.\nThe following options are available for longitude and latitude:\n\n- Single angle value:\n\n  - |Quantity| object\n  - Plain numeric value with ``unit`` keyword specifying the unit\n  - Angle string which is formatted for :ref:`angle-creation` of\n    |Longitude| or |Latitude| objects\n\n- List or |Quantity| array, or NumPy array of angle values\n- |Angle|, |Longitude|, or |Latitude| object, which can be scalar or\n  array-valued\n\n.. note::\n\n    While |SkyCoord| is flexible with respect to specifying longitude and\n    latitude component inputs, the frame classes expect to receive\n    |Quantity|-like objects with angular units (i.e., |Angle| or |Quantity|).\n    For example, when specifying components, the frame classes (e.g., ``ICRS``)\n    must be created as\n\n        >>> ICRS(0 * u.deg, 0 * u.deg) # doctest: +FLOAT_CMP\n        <ICRS Coordinate: (ra, dec) in deg\n            (0., 0.)>\n\n    and other methods of flexible initialization (that work with |SkyCoord|)\n    will not work\n\n        >>> ICRS(0, 0, unit=u.deg) # doctest: +SKIP\n        UnitTypeError: Longitude instances require units equivalent to 'rad', but no unit was given.\n\n**DISTANCE**\n\nThe distance to the object from the frame center can be optionally specified:\n\n- Single distance value:\n\n  - |Quantity| or `~astropy.coordinates.Distance` object\n  - Plain numeric value for a dimensionless distance\n  - Plain numeric value with ``unit`` keyword specifying the unit\n\n- List, or |Quantity|, or `~astropy.coordinates.Distance` array, or NumPy array\n  of angle values\n\n**COORD**\n\nThis input form uses a single object to supply coordinate data. For the case\nof spherical coordinate frames, the coordinate can include one or more\nlongitude and latitude pairs in one of the following ways:\n\n- Single coordinate string with a LON and LAT value separated by a space. The\n  respective values can be any string which is formatted for\n  :ref:`angle-creation` of |Longitude| or |Latitude| objects, respectively.\n- List or NumPy array of such coordinate strings.\n- List of (LON, LAT) tuples, where each LON and LAT are scalars (not arrays).\n- ``N x 2`` NumPy or |Quantity| array of values where the first column is\n  longitude and the second column is latitude, for example,\n  ``[[270, -30], [355, +85]] * u.deg``.\n- List of (LON, LAT, DISTANCE) tuples.\n- ``N x 3`` NumPy or |Quantity| array of values where columns are\n  longitude, latitude, and distance, respectively.\n\nThe input can also be more generalized objects that are not necessarily\nrepresented in the standard spherical coordinates:\n\n- Coordinate frame object (e.g., ``FK4(1*u.deg, 2*u.deg, obstime='J2012.2')``).\n- |SkyCoord| object (which just makes a copy of the object).\n- `~astropy.coordinates.BaseRepresentation` subclass object like\n  `~astropy.coordinates.SphericalRepresentation`,\n  `~astropy.coordinates.CylindricalRepresentation`, or\n  `~astropy.coordinates.CartesianRepresentation`.\n\n**FRAME**\n\nThis can be a `~astropy.coordinates.BaseCoordinateFrame` frame class, an\ninstance of such a class, or the corresponding string alias. The frame\nclasses that are built in to Astropy are `~astropy.coordinates.ICRS`,\n`~astropy.coordinates.FK5`, `~astropy.coordinates.FK4`,\n`~astropy.coordinates.FK4NoETerms`, `~astropy.coordinates.Galactic`, and\n`~astropy.coordinates.AltAz`. The string aliases are lowercase versions of the\nclass name.\n\nIf the frame is not supplied then you will see a special ``ICRS``\nidentifier. This indicates that the frame is unspecified and operations\nthat require comparing coordinates (even within that object) are not allowed.\n\n**unit=UNIT**\n\nThe unit specifier can be one of the following:\n\n- `~astropy.units.Unit` object, which is an angular unit that is equivalent to\n  ``Unit('radian')``.\n- Single string with a valid angular unit name.\n- 2-tuple of `~astropy.units.Unit` objects or string unit names specifying the\n  LON and LAT unit, respectively (e.g., ``('hourangle', 'degree')``).\n- Single string with two unit names separated by a comma (e.g.,\n  ``'hourangle,degree'``).\n\nIf only a single unit is provided then it applies to both LON and LAT.\n\n**Other keyword arguments**\n\nIn lieu of positional arguments to specify the longitude and latitude, the\nframe-specific names can be used as keyword arguments:\n\n*ra*, *dec*: **LON**, **LAT** values, optional\n    RA and Dec for frames where these are representation, including [FIXME]\n    `~astropy.coordinates.ICRS`, `~astropy.coordinates.FK5`,\n    `~astropy.coordinates.FK4`, and `~astropy.coordinates.FK4NoETerms`.\n\n*l*, *b*:  **LON**, **LAT** values, optional\n    Galactic ``l`` and ``b`` for the `~astropy.coordinates.Galactic` frame.\n\nThe following keywords can be specified for any frame:\n\n*distance*: distance quantity-like, optional\n    Distance from reference from center to source\n\n*obstime*: time-like, optional\n    Time of observation\n\n*equinox*: time-like, optional\n    Coordinate frame equinox\n\nIf custom user-defined frames are included in the transform graph and they\nhave additional frame attributes, then those attributes can also be\nset via corresponding keyword arguments in the |SkyCoord| initialization.\n\n.. _astropy-coordinates-array-operations:\n\nArray Operations\n================\n\nIt is possible to store arrays of coordinates in a |SkyCoord| object, and\nmanipulations done in this way will be orders of magnitude faster than\nlooping over a list of individual |SkyCoord| objects.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Storing Arrays of Coordinates in a SkyCoord Object\n\nTo store arrays of coordinates in a |SkyCoord| object::\n\n  >>> ra = np.linspace(0, 36000, 1001) * u.deg\n  >>> dec = np.linspace(-90, 90, 1001) * u.deg\n\n  >>> sc_list = [SkyCoord(r, d, frame='icrs') for r, d in zip(ra, dec)]  # doctest: +SKIP\n  >>> timeit sc_gal_list = [c.galactic for c in sc_list]  # doctest: +SKIP\n  1 loops, best of 3: 20.4 s per loop\n\n  >>> sc = SkyCoord(ra, dec, frame='icrs')\n  >>> timeit sc_gal = sc.galactic  # doctest: +SKIP\n  100 loops, best of 3: 21.8 ms per loop\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Array Operations Using SkyCoord\n\nIn addition to vectorized transformations, you can do the usual array slicing,\ndicing, and selection using the same methods and attributes that you use for\n`~numpy.ndarray` instances. Corresponding functions, as well as others that\naffect the shape, such as `~numpy.atleast_1d` and `~numpy.rollaxis`, work as\nexpected. (The relevant functions have to be explicitly enabled in ``astropy``\nsource code; let us know if a ``numpy`` function is not supported that you\nthink should work.)::\n\n  >>> north_mask = sc.dec > 0\n  >>> sc_north = sc[north_mask]\n  >>> len(sc_north)\n  500\n  >>> sc[2:4]  # doctest: +FLOAT_CMP\n  <SkyCoord (ICRS): (ra, dec) in deg\n      [( 72., -89.64), (108., -89.46)]>\n  >>> sc[500]\n  <SkyCoord (ICRS): (ra, dec) in deg\n      (0., 0.)>\n  >>> sc[0:-1:100].reshape(2, 5)\n  <SkyCoord (ICRS): (ra, dec) in deg\n      [[(0., -90.), (0., -72.), (0., -54.), (0., -36.), (0., -18.)],\n       [(0.,   0.), (0.,  18.), (0.,  36.), (0.,  54.), (0.,  72.)]]>\n  >>> np.roll(sc[::100], 1)\n  <SkyCoord (ICRS): (ra, dec) in deg\n      [(0.,  90.), (0., -90.), (0., -72.), (0., -54.), (0., -36.),\n       (0., -18.), (0.,   0.), (0.,  18.), (0.,  36.), (0.,  54.),\n       (0.,  72.)]>\n\nNote that similarly to the `~numpy.ndarray` methods, all but ``flatten`` try to\nuse new views of the data, with the data copied only if that is impossible\n(as discussed, for example, in the documentation for NumPy\n:func:`~numpy.reshape`).\n\n..\n  EXAMPLE END\n\n.. _astropy-coordinates-modifying-in-place:\n\nModifying Coordinate Objects In-place\n-------------------------------------\n\nCoordinate values in a array-valued |SkyCoord| object can be modified in-place\n(added in astropy 4.1). This requires that the new values be set from an\nanother |SkyCoord| object that is equivalent in all ways except for the actual\ncoordinate data values. In this way, no frame transformations are required and\nthe item setting operation is extremely robust.\n\nSpecifically, the right hand ``value`` must be strictly consistent with the\nobject being modified:\n\n- Identical class\n- Equivalent frames (`~astropy.coordinates.BaseCoordinateFrame.is_equivalent_frame`)\n- Identical representation_types\n- Identical representation differentials keys\n- Identical frame attributes\n- Identical \"extra\" frame attributes (e.g., ``obstime`` for an ICRS coord)\n\n..\n  EXAMPLE START\n  Modifying an Array of Coordinates in a SkyCoord Object\n\nTo modify an array of coordinates in a |SkyCoord| object use the same\nsyntax for a numpy array::\n\n  >>> sc1 = SkyCoord([1, 2] * u.deg, [3, 4] * u.deg)\n  >>> sc2 = SkyCoord(10 * u.deg, 20 * u.deg)\n  >>> sc1[0] = sc2\n  >>> sc1\n  <SkyCoord (ICRS): (ra, dec) in deg\n      [(10., 20.), ( 2.,  4.)]>\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Inserting Coordinates into a SkyCoord Object\n\nYou can insert a scalar or array-valued |SkyCoord| object into another\ncompatible |SkyCoord| object::\n\n  >>> sc1 = SkyCoord([1, 2] * u.deg, [3, 4] * u.deg)\n  >>> sc2 = SkyCoord(10 * u.deg, 20 * u.deg)\n  >>> sc1.insert(1, sc2)\n  <SkyCoord (ICRS): (ra, dec) in deg\n      [( 1.,  3.), (10., 20.), ( 2.,  4.)]>\n\n..\n  EXAMPLE END\n\nWith the ability to modify a |SkyCoord| object in-place, all of the\n:ref:`table_operations` such as joining, stacking, and inserting are\nfunctional with |SkyCoord| mixin columns (so long as no masking is required).\n\nThese methods are relatively slow because they require setting from an\nexisting |SkyCoord| object and they perform extensive validation to ensure\nthat the operation is valid. For some applications it may be necessary to\ntake a different lower-level approach which is described in the section\n:ref:`astropy-coordinates-fast-in-place`.\n\n.. warning::\n\n  You may be tempted to try an apparently obvious way of modifying a coordinate\n  object in place by updating the component attributes directly, for example\n  ``sc1.ra[1] = 40 * u.deg``. However, while this will *appear* to give a correct\n  result it does not actually modify the underlying representation data. This\n  is related to the current implementation of performance-based caching.\n  The current cache implementation is similarly unable to handle in-place changes\n  to the representation (``.data``) or frame attributes such as ``.obstime``.\n\n\nAttributes\n==========\n\nThe |SkyCoord| object has a number of useful attributes which come in handy.\nBy digging through these we will learn a little bit about |SkyCoord| and how it\nworks.\n\nTo begin, one of the most important tools for\nlearning about attributes and methods of objects is \"TAB-discovery.\" From\nwithin IPython you can type an object name, the period, and then the <TAB> key\nto see what is available. This can often be faster than reading the\ndocumentation::\n\n  >>> sc = SkyCoord(1, 2, frame='icrs', unit='deg', obstime='2013-01-02 14:25:36')\n  >>> sc.<TAB>  # doctest: +SKIP\n  sc.T                                   sc.match_to_catalog_3d\n  sc.altaz                               sc.match_to_catalog_sky\n  sc.barycentrictrueecliptic             sc.name\n  sc.cartesian                           sc.ndim\n  sc.cirs                                sc.obsgeoloc\n  sc.copy                                sc.obsgeovel\n  sc.data                                sc.obstime\n  sc.dec                                 sc.obswl\n  sc.default_representation              sc.position_angle\n  sc.diagonal                            sc.precessedgeocentric\n  sc.distance                            sc.pressure\n  sc.equinox                             sc.ra\n  sc.fk4                                 sc.ravel\n  sc.fk4noeterms                         sc.realize_frame\n  sc.fk5                                 sc.relative_humidity\n  sc.flatten                             sc.represent_as\n  sc.frame                               sc.representation_component_names\n  sc.frame_attributes                    sc.representation_component_units\n  sc.frame_specific_representation_info  sc.representation_info\n  sc.from_name                           sc.reshape\n  sc.from_pixel                          sc.roll\n  sc.galactic                            sc.search_around_3d\n  sc.galactocentric                      sc.search_around_sky\n  sc.galcen_distance                     sc.separation\n  sc.gcrs                                sc.separation_3d\n  sc.geocentrictrueecliptic              sc.shape\n  sc.get_constellation                   sc.size\n  sc.get_frame_attr_names                sc.skyoffset_frame\n  sc.guess_from_table                    sc.spherical\n  sc.has_data                            sc.spherical_offsets_to\n  sc.hcrs                                sc.squeeze\n  sc.heliocentrictrueecliptic            sc.supergalactic\n  sc.icrs                                sc.swapaxes\n  sc.info                                sc.take\n  sc.is_equivalent_frame                 sc.temperature\n  sc.is_frame_attr_default               sc.to_pixel\n  sc.is_transformable_to                 sc.to_string\n  sc.isscalar                            sc.transform_to\n  sc.itrs                                sc.transpose\n  sc.location                            sc.z_sun\n\nHere we see many attributes and methods. The most recognizable may be the\nlongitude and latitude attributes which are named ``ra`` and ``dec`` for the\n``ICRS`` frame::\n\n  >>> sc.ra  # doctest: +FLOAT_CMP\n  <Longitude 1. deg>\n  >>> sc.dec  # doctest: +FLOAT_CMP\n  <Latitude 2. deg>\n\nNext, notice that all of the built-in frame names ``icrs``, ``galactic``,\n``fk5``, ``fk4``, and ``fk4noeterms`` are there. Through the magic of Python\nproperties, accessing these attributes calls the object\n`~astropy.coordinates.SkyCoord.transform_to` method appropriately and returns a\nnew |SkyCoord| object in the requested frame::\n\n  >>> sc_gal = sc.galactic\n  >>> sc_gal  # doctest: +FLOAT_CMP\n  <SkyCoord (Galactic): (l, b) in deg\n      (99.63785528, -58.70969293)>\n\nOther attributes you may recognize are ``distance``, ``equinox``,\n``obstime``, and ``shape``.\n\nDigging Deeper\n--------------\n*[Casual users can skip this section]*\n\nAfter transforming to Galactic, the longitude and latitude values are now\nlabeled ``l`` and ``b``, following the normal convention for Galactic\ncoordinates. How does the object know what to call its values? The answer\nlies in some less obvious attributes::\n\n  >>> sc_gal.representation_component_names\n  {'l': 'lon', 'b': 'lat', 'distance': 'distance'}\n\n  >>> sc_gal.representation_component_units\n  {'l': Unit(\"deg\"), 'b': Unit(\"deg\")}\n\n  >>> sc_gal.representation_type\n  <class 'astropy.coordinates.representation.SphericalRepresentation'>\n\nTogether these tell the object that ``l`` and ``b`` are the longitude and\nlatitude, and that they should both be displayed in units of degrees as\na spherical-type coordinate (and not, for example, a Cartesian coordinate).\nFurthermore, the frame's ``representation_component_names`` attribute defines\nthe coordinate keyword arguments that |SkyCoord| will accept.\n\nAnother important attribute is ``frame_attr_names``, which defines the\nadditional attributes that are required to fully define the frame::\n\n  >>> sc_fk4 = SkyCoord(1, 2, frame='fk4', unit='deg')\n  >>> sc_fk4.get_frame_attr_names()\n  {'equinox': <Time object: scale='tt' format='byear_str' value=B1950.000>, 'obstime': None}\n\nThe key values correspond to the defaults if no explicit value is provided by\nthe user. This example shows that the `~astropy.coordinates.FK4` frame has two\nattributes, ``equinox`` and ``obstime``, that are required to fully define the\nframe.\n\nSome trickery is happening here because many of these attributes are\nactually owned by the underlying coordinate ``frame`` object which does much of\nthe real work. This is the middle layer in the three-tiered system of objects:\nrepresentation (spherical, Cartesian, etc.), frame (a.k.a. low-level frame\nclass), and |SkyCoord| (a.k.a. high-level class; see\n:ref:`astropy-coordinates-overview` and\n:ref:`astropy-coordinates-definitions`)::\n\n  >>> sc.frame  # doctest: +FLOAT_CMP\n  <ICRS Coordinate: (ra, dec) in deg\n      (1., 2.)>\n\n  >>> sc.has_data is sc.frame.has_data\n  True\n\n  >>> sc.frame.<TAB>  # doctest: +SKIP\n  sc.frame.T                                   sc.frame.ra\n  sc.frame.cartesian                           sc.frame.ravel\n  sc.frame.copy                                sc.frame.realize_frame\n  sc.frame.data                                sc.frame.represent_as\n  sc.frame.dec                                 sc.frame.representation\n  sc.frame.default_representation              sc.frame.representation_component_names\n  sc.frame.diagonal                            sc.frame.representation_component_units\n  sc.frame.distance                            sc.frame.representation_info\n  sc.frame.flatten                             sc.frame.reshape\n  sc.frame.frame_attributes                    sc.frame.separation\n  sc.frame.frame_specific_representation_info  sc.frame.separation_3d\n  sc.frame.get_frame_attr_names                sc.frame.shape\n  sc.frame.has_data                            sc.frame.size\n  sc.frame.is_equivalent_frame                 sc.frame.spherical\n  sc.frame.is_frame_attr_default               sc.frame.squeeze\n  sc.frame.is_transformable_to                 sc.frame.swapaxes\n  sc.frame.isscalar                            sc.frame.take\n  sc.frame.name                                sc.frame.transform_to\n  sc.frame.ndim                                sc.frame.transpose\n\n  >>> sc.frame.name\n  'icrs'\n\nThe |SkyCoord| object exposes the ``frame`` object attributes as its own. Though\nit might seem a tad confusing at first, this is a good thing because it makes\n|SkyCoord| objects and `~astropy.coordinates.BaseCoordinateFrame` objects\nbehave very similarly and most routines can accept either one as input without\nmuch bother (duck typing!).\n\nThe lowest layer in the stack is the abstract\n`~astropy.coordinates.UnitSphericalRepresentation` object:\n\n  >>> sc_gal.frame.data  # doctest: +FLOAT_CMP\n  <UnitSphericalRepresentation (lon, lat) in rad\n      (1.73900863, -1.02467744)>\n\nTransformations\n===============\n\nThe topic of transformations is covered in detail in the section on\n:ref:`astropy-coordinates-transforming`.\n\nFor completeness, here we will give some examples. Once you have defined\nyour coordinates and the reference frame, you can transform from that frame to\nanother frame. You can do this in a few different ways: if you only want the\ndefault version of that frame, you can use attribute-style access (as mentioned\npreviously). For more control, you can use the\n`~astropy.coordinates.SkyCoord.transform_to` method, which accepts a frame\nname, frame class, frame instance, or |SkyCoord|.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Transforming Between Frames\n\nTo transform from one frame to another::\n\n  >>> from astropy.coordinates import FK5\n  >>> sc = SkyCoord(1, 2, frame='icrs', unit='deg')\n  >>> sc.galactic  # doctest: +FLOAT_CMP\n  <SkyCoord (Galactic): (l, b) in deg\n      (99.63785528, -58.70969293)>\n\n  >>> sc.transform_to('fk5')  # Same as sc.fk5 and sc.transform_to(FK5)  # doctest: +FLOAT_CMP\n  <SkyCoord (FK5: equinox=J2000.000): (ra, dec) in deg\n          (1.00000656, 2.00000243)>\n\n  >>> sc.transform_to(FK5(equinox='J1975'))  # Transform to FK5 with a different equinox  # doctest: +FLOAT_CMP\n  <SkyCoord (FK5: equinox=J1975.000): (ra, dec) in deg\n          (0.67967282, 1.86083014)>\n\nTransforming to a |SkyCoord| instance is a convenient way of ensuring that two\ncoordinates are in the exact same reference frame::\n\n  >>> sc2 = SkyCoord(3, 4, frame='fk4', unit='deg', obstime='J1978.123', equinox='B1960.0')\n  >>> sc.transform_to(sc2)  # doctest: +FLOAT_CMP\n  <SkyCoord (FK4: equinox=B1960.000, obstime=J1978.123): (ra, dec) in deg\n      (0.48726331, 1.77731617)>\n\n..\n  EXAMPLE END\n\n.. _astropy-skycoord-representations:\n\nRepresentations\n===============\n\nSo far we have been using a spherical coordinate representation in all of the\nexamples, and this is the default for the built-in frames. Frequently it is\nconvenient to initialize or work with a coordinate using a different\nrepresentation such as Cartesian or cylindrical. In this section, we discuss\nhow to initialize an object using a different representation and how to\nchange the representation of an object. For more information about\nrepresentation objects themselves, see :ref:`astropy-coordinates-representations`.\n\nInitialization\n--------------\n\nMost of what you need to know can be inferred from the examples below and\nby extrapolating the previous documentation for spherical representations.\nInitialization requires setting the ``representation_type`` keyword and\nsupplying the corresponding components for that representation.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Initialization of a SkyCoord Object Using Different Representations\n\nTo initialize an object using a representation type other than spherical::\n\n    >>> c = SkyCoord(x=1, y=2, z=3, unit='kpc', representation_type='cartesian')\n    >>> c  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (x, y, z) in kpc\n        (1., 2., 3.)>\n    >>> c.x, c.y, c.z  # doctest: +FLOAT_CMP\n    (<Quantity 1. kpc>, <Quantity 2. kpc>, <Quantity 3. kpc>)\n\nOther variations include::\n\n    >>> SkyCoord(1, 2*u.deg, 3, representation_type='cylindrical')  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (rho, phi, z) in (, deg, )\n        (1., 2., 3.)>\n\n    >>> SkyCoord(rho=1*u.km, phi=2*u.deg, z=3*u.m, representation_type='cylindrical')  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (rho, phi, z) in (km, deg, m)\n        (1., 2., 3.)>\n\n    >>> SkyCoord(rho=1, phi=2, z=3, unit=(u.km, u.deg, u.m), representation_type='cylindrical')  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (rho, phi, z) in (km, deg, m)\n        (1., 2., 3.)>\n\n    >>> SkyCoord(1, 2, 3, unit=(None, u.deg, None), representation_type='cylindrical')  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (rho, phi, z) in (, deg, )\n        (1., 2., 3.)>\n\nIn general terms, the allowed syntax is as follows::\n\n  SkyCoord(COORD, [FRAME | frame=FRAME], [unit=UNIT], [representation_type=REPRESENTATION],\n           keyword_args ...)\n  SkyCoord(COMP1, COMP2, [COMP3], [FRAME | frame=FRAME], [unit=UNIT],\n           [representation_type=REPRESENTATION], keyword_args ...)\n  SkyCoord([FRAME | frame=FRAME], <comp1_name>=COMP1, <comp2_name>=COMP2,\n           <comp3_name>=COMP3, [representation_type=REPRESENTATION], [unit=UNIT],\n           keyword_args ...)\n\nIn this case, the ``keyword_args`` now includes the element\n``representation_type=REPRESENTATION``. In the above description, elements in\nall capital letters (e.g., ``FRAME``) describe a user input of that element\ntype. Elements in square brackets are optional.\n\n..\n  EXAMPLE END\n\n**COMP1**, **COMP2**, **COMP3**\n\nComponent values can be specified as separate positional arguments or as\nkeyword arguments. In this formalism the exact type of allowed input depends\non the details of the representation. In general, the following input forms\nare supported:\n\n- Single value:\n\n  - Component class object\n  - Plain numeric value with ``unit`` keyword specifying the unit\n\n- List or component class array, or NumPy array of values\n\nEach representation component has a specified class (the \"component class\")\nwhich is used to convert generic input data into a predefined object\nclass with a certain unit. These component classes are expected to be\nsubclasses of the `~astropy.units.Quantity` class.\n\n**COORD**\n\nThis input form uses a single object to supply coordinate data. The coordinate\ncan specify one or more coordinate positions as follows:\n\n- List of ``(COMP1, .., COMP<M>)`` tuples, where each component is a scalar (not\n  array) and there are ``M`` components in the representation. Typically\n  there are three components, but some\n  (e.g., `~astropy.coordinates.UnitSphericalRepresentation`)\n  can have fewer.\n- ``N x M`` NumPy or |Quantity| array of values, where ``N`` is the number\n  of coordinates and ``M`` is the number of components.\n\n**REPRESENTATION**\n\nThe representation can be supplied either as a\n`~astropy.coordinates.representation.BaseRepresentation` class (e.g.,\n`~astropy.coordinates.CartesianRepresentation`) or as a string name\nthat is simply the class name in lowercase without the\n``'representation'`` suffix (e.g., ``'cartesian'``).\n\nThe rest of the inputs for creating a |SkyCoord| object in the general case are\nthe same as for spherical.\n\nDetails\n-------\n\nThe available set of representations is dynamic and may change depending on what\nrepresentation classes have been defined. The built-in representations are:\n\n=====================  =======================================================\n  Name                   Class\n=====================  =======================================================\n``spherical``          `~astropy.coordinates.SphericalRepresentation`\n``unitspherical``      `~astropy.coordinates.UnitSphericalRepresentation`\n``physicsspherical``   `~astropy.coordinates.PhysicsSphericalRepresentation`\n``cartesian``          `~astropy.coordinates.CartesianRepresentation`\n``cylindrical``        `~astropy.coordinates.CylindricalRepresentation`\n=====================  =======================================================\n\nEach frame knows about all of the available representations, but different\nframes may use different names for the same components. A common example\nis that the `~astropy.coordinates.Galactic` frame uses ``l`` and ``b``\ninstead of ``ra`` and ``dec`` for the ``lon`` and ``lat`` components of\nthe `~astropy.coordinates.SphericalRepresentation`.\n\nFor a particular frame, in order to see the full list of representations\nand how it names all of the components, first make an instance of that frame\nwithout any data, and then print the ``representation_info`` property::\n\n    >>> ICRS().representation_info  # doctest: +SKIP\n    {astropy.coordinates.representation.CartesianRepresentation:\n      {'names': ('x', 'y', 'z'),\n       'units': (None, None, None)},\n     astropy.coordinates.representation.SphericalRepresentation:\n      {'names': ('ra', 'dec', 'distance'),\n       'units': (Unit(\"deg\"), Unit(\"deg\"), None)},\n     astropy.coordinates.representation.UnitSphericalRepresentation:\n      {'names': ('ra', 'dec'),\n       'units': (Unit(\"deg\"), Unit(\"deg\"))},\n     astropy.coordinates.representation.PhysicsSphericalRepresentation:\n      {'names': ('phi', 'theta', 'r'),\n       'units': (Unit(\"deg\"), Unit(\"deg\"), None)},\n     astropy.coordinates.representation.CylindricalRepresentation:\n      {'names': ('rho', 'phi', 'z'),\n       'units': (None, Unit(\"deg\"), None)}\n    }\n\nThis is a bit messy but it shows that for each representation there is a\n``dict`` with two keys:\n\n- ``names``: defines how each component is named in that frame.\n- ``units``: defines the units of each component when output, where ``None``\n  means to not force a particular unit.\n\nFor a particular coordinate instance you can use the ``representation_type``\nattribute in conjunction with the ``representation_component_names`` attribute\nto figure out what keywords are accepted by a particular class object. The\nformer will be the representation class the system is expressed in (e.g.,\nspherical for equatorial frames), and the latter will be a dictionary mapping\nnames for that frame to the component name on the representation class::\n\n    >>> import astropy.units as u\n    >>> icrs = ICRS(1*u.deg, 2*u.deg)\n    >>> icrs.representation_type\n    <class 'astropy.coordinates.representation.SphericalRepresentation'>\n    >>> icrs.representation_component_names\n    {'ra': 'lon', 'dec': 'lat', 'distance': 'distance'}\n\nChanging Representation\n-----------------------\n\nThe representation of the coordinate object can be changed, as shown\nbelow. This actually does *nothing* to the object internal data which\nstores the coordinate values, but it changes the external view of that\ndata in two ways:\n\n- The object prints itself in accord with the new representation.\n- The available attributes change to match those of the new representation\n  (e.g., from ``ra, dec, distance`` to ``x, y, z``).\n\nSetting the ``representation_type`` thus changes a *property* of the\nobject (how it appears) without changing the intrinsic object itself\nwhich represents a point in 3D space.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Changing the Representation of a Coordinate Object\n\nTo change the representation of a coordinate object by setting the\n``representation_type`` ::\n\n    >>> c = SkyCoord(x=1, y=2, z=3, unit='kpc', representation_type='cartesian')\n    >>> c  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (x, y, z) in kpc\n        (1., 2., 3.)>\n\n    >>> c.representation_type = 'cylindrical'\n    >>> c  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (rho, phi, z) in (kpc, deg, kpc)\n        (2.23606798, 63.43494882, 3.)>\n    >>> c.phi.to(u.deg)  # doctest: +FLOAT_CMP\n    <Angle 63.43494882 deg>\n    >>> c.x\n    Traceback (most recent call last):\n    ...\n    AttributeError: 'SkyCoord' object has no attribute 'x'\n\n    >>> c.representation_type = 'spherical'\n    >>> c  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec, distance) in (deg, deg, kpc)\n        (63.43494882, 53.3007748, 3.74165739)>\n\n    >>> c.representation_type = 'unitspherical'\n    >>> c  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        (63.43494882, 53.3007748)>\n\nYou can also use any representation class to set the representation::\n\n    >>> from astropy.coordinates import CartesianRepresentation\n    >>> c.representation_type = CartesianRepresentation\n\nNote that if all you want is a particular representation without changing the\nstate of the |SkyCoord| object, you should instead use the\n``astropy.coordinates.SkyCoord.represent_as()`` method::\n\n    >>> c.representation_type = 'spherical'\n    >>> cart = c.represent_as(CartesianRepresentation)\n    >>> cart  # doctest: +FLOAT_CMP\n    <CartesianRepresentation (x, y, z) in kpc\n        (1., 2., 3.)>\n    >>> c.representation_type\n    <class 'astropy.coordinates.representation.SphericalRepresentation'>\n\n..\n  EXAMPLE END\n\nExample 1: Plotting random data in Aitoff projection\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n..\n  EXAMPLE START\n  Plotting Random Data in Aitoff Projection\n\nThis is an example of how to make a plot in the Aitoff projection using data\nin a |SkyCoord| object. Here, a randomly generated data set will be used.\n\nFirst we need to import the required packages. We use\n`matplotlib <https://matplotlib.org/>`_ here for\nplotting and `numpy <https://numpy.org/>`_  to get the value of pi and to\ngenerate our random data.\n\n    >>> from astropy import units as u\n    >>> from astropy.coordinates import SkyCoord\n    >>> import numpy as np\n\nWe now generate random data for visualization. For RA this is done in the range\nof 0 and 360 degrees (``ra_random``), for DEC between -90 and +90 degrees\n(``dec_random``). Finally, we multiply these values by degrees to get a\n`~astropy.units.Quantity` with units of degrees.\n\n    >>> ra_random = np.random.rand(100)*360.0 * u.degree\n    >>> dec_random = (np.random.rand(100)*180.0-90.0) * u.degree\n\nAs the next step, those coordinates are transformed into an\n`astropy.coordinates` |SkyCoord| object.\n\n    >>> c = SkyCoord(ra=ra_random, dec=dec_random, frame='icrs')\n\nBecause matplotlib needs the coordinates in radians and between :math:`-\\pi`\nand :math:`\\pi`, not 0 and :math:`2\\pi`, we have to convert them.\nFor this purpose the `astropy.coordinates.Angle` object provides a special\nmethod, which we use here to wrap at 180:\n\n    >>> ra_rad = c.ra.wrap_at(180 * u.deg).radian\n    >>> dec_rad = c.dec.radian\n\nAs a last step, we set up the plotting environment with matplotlib using the\nAitoff projection with a specific title, a grid, filled circles as markers with\na marker size of 2, and an alpha value of 0.3. We use a figure with an x-y ratio\nthat is well suited for such a projection and we move the title upwards from\nits usual position to avoid overlap with the axis labels.\n\n.. doctest-skip::\n\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure(figsize=(8,4.2))\n    >>> plt.subplot(111, projection=\"aitoff\")\n    >>> plt.title(\"Aitoff projection of our random data\")\n    >>> plt.grid(True)\n    >>> plt.plot(ra_rad, dec_rad, 'o', markersize=2, alpha=0.3)\n    >>> plt.subplots_adjust(top=0.95,bottom=0.0)\n    >>> plt.show()\n\n\n.. plot::\n\n    # This is an example how to make a plot in the Aitoff projection using data\n    # in a SkyCoord object. Here a randomly generated data set will be used. The\n    # final script can be found below.\n\n    # First we need to import the required packages. We use\n    # `matplotlib <https://matplotlib.org/>`_ here for\n    # plotting and `numpy <https://numpy.org/>`_  to get the value of pi and to\n    # generate our random data.\n    from astropy import units as u\n    from astropy.coordinates import SkyCoord\n    import matplotlib.pyplot as plt\n    import numpy as np\n\n    # We now generate random data for visualization. For RA this is done in the range\n    # of 0 and 360 degrees (``ra_random``), for DEC between -90 and +90 degrees\n    # (``dec_random``). Finally, we multiply these values by degrees to get a\n    # `~astropy.units.Quantity` with units of degrees.\n    ra_random = np.random.rand(100)*360.0 * u.degree\n    dec_random = (np.random.rand(100)*180.0-90.0) * u.degree\n\n    # As the next step, those coordinates are transformed into an astropy.coordinates\n    # astropy.coordinates.SkyCoord object.\n    c = SkyCoord(ra=ra_random, dec=dec_random, frame='icrs')\n\n    # Because matplotlib needs the coordinates in radians and between :math:`-\\pi`\n    # and :math:`\\pi`, not 0 and :math:`2\\pi`, we have to convert them.\n    # For this purpose the `astropy.coordinates.Angle` object provides a special method,\n    # which we use here to wrap at 180:\n    ra_rad = c.ra.wrap_at(180 * u.deg).radian\n    dec_rad = c.dec.radian\n\n    # As a last step we set up the plotting environment with matplotlib using the\n    # Aitoff projection with a specific title, a grid, filled circles as markers with\n    # a marker size of 2, and an alpha value of 0.3.\n    plt.figure(figsize=(8,4.2))\n    plt.subplot(111, projection=\"aitoff\")\n    plt.title(\"Aitoff projection of our random data\", y=1.08)\n    plt.grid(True)\n    plt.plot(ra_rad, dec_rad, 'o', markersize=2, alpha=0.3)\n    plt.subplots_adjust(top=0.95, bottom=0.0)\n    plt.show()\n\n..\n  EXAMPLE END\n\nExample 2: Plotting star positions in bulge and disk\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n..\n  EXAMPLE START\n  Plotting Star Positions in Bulge and Disk\n\nThis is a more realistic example of how to make a plot in the Aitoff projection\nusing data in a |SkyCoord| object. Here, a randomly generated data set\n(multivariate normal distribution) for both stars in the bulge and in the disk\nof a galaxy will be used. Both types will be plotted with different number\ncounts.\n\nAs in the last example, we first import the required packages.\n\n    >>> from astropy import units as u\n    >>> from astropy.coordinates import SkyCoord\n    >>> import numpy as np\n\nWe now generate random data for visualization using\n``numpy.random.Generator.multivariate_normal``.\n\n    >>> disk = np.random.multivariate_normal(mean=[0,0,0], cov=np.diag([1,1,0.5]), size=5000)\n    >>> bulge = np.random.multivariate_normal(mean=[0,0,0], cov=np.diag([1,1,1]), size=500)\n    >>> galaxy = np.concatenate([disk, bulge])\n\nAs the next step, those coordinates are transformed into an\n`astropy.coordinates` |SkyCoord| object.\n\n    >>> c_gal = SkyCoord(galaxy, representation_type='cartesian', frame='galactic')\n    >>> c_gal_icrs = c_gal.icrs\n\nAgain, as in the last example, we need to convert the coordinates in radians\nand make sure they are between :math:`-\\pi` and :math:`\\pi`:\n\n    >>> ra_rad = c_gal_icrs.ra.wrap_at(180 * u.deg).radian\n    >>> dec_rad = c_gal_icrs.dec.radian\n\nWe use the same plotting setup as in the last example:\n\n.. doctest-skip::\n\n    >>> import matplotlib.pyplot as plt\n    >>> plt.figure(figsize=(8,4.2))\n    >>> plt.subplot(111, projection=\"aitoff\")\n    >>> plt.title(\"Aitoff projection of our random data\")\n    >>> plt.grid(True)\n    >>> plt.plot(ra_rad, dec_rad, 'o', markersize=2, alpha=0.3)\n    >>> plt.subplots_adjust(top=0.95,bottom=0.0)\n    >>> plt.show()\n\n\n.. plot::\n\n    # This is more realistic example how to make a plot in the Aitoff projection\n    # using data in a SkyCoord object.\n    # Here a randomly generated data set (multivariate normal distribution)\n    # for both stars in the bulge and in the disk of a galaxy\n    # will be used. Both types will be plotted with different number counts. The\n    # final script can be found below.\n\n    # As in the last example, we first import the required packages.\n    from astropy import units as u\n    from astropy.coordinates import SkyCoord\n    import matplotlib.pyplot as plt\n    import numpy as np\n\n    # We now generate random data for visualization with\n    # np.random.multivariate_normal.\n    disk = np.random.multivariate_normal(mean=[0,0,0], cov=np.diag([1,1,0.5]), size=5000)\n    bulge = np.random.multivariate_normal(mean=[0,0,0], cov=np.diag([1,1,1]), size=500)\n    galaxy = np.concatenate([disk, bulge])\n\n    # As the next step, those coordinates are transformed into an astropy.coordinates\n    # astropy.coordinates.SkyCoord object.\n    c_gal = SkyCoord(galaxy, representation_type='cartesian', frame='galactic')\n    c_gal_icrs = c_gal.icrs\n\n    # Again, as in the last example, we need to convert the coordinates in radians\n    # and make sure they are between :math:`-\\pi` and :math:`\\pi`:\n    ra_rad = c_gal_icrs.ra.wrap_at(180 * u.deg).radian\n    dec_rad = c_gal_icrs.dec.radian\n\n    # We use the same plotting setup as in the last example:\n    plt.figure(figsize=(8,4.2))\n    plt.subplot(111, projection=\"aitoff\")\n    plt.title(\"Aitoff projection of our random data\", y=1.08)\n    plt.grid(True)\n    plt.plot(ra_rad, dec_rad, 'o', markersize=2, alpha=0.3)\n    plt.subplots_adjust(top=0.95,bottom=0.0)\n    plt.show()\n\n..\n  EXAMPLE END\n\n.. _coordinates-skycoord-comparing:\n\nComparing SkyCoord Objects\n==========================\n\nThere are two primary ways to compare |SkyCoord| objects to each other. First is\nchecking if the coordinates are within a specified distance of each other. This\nis what most users should do in their science or processing analysis work\nbecause it allows for a tolerance due to floating point representation issues.\nThe second is checking for exact equivalence of two objects down to the bit,\nwhich is most useful for developers writing tests.\n\nThe example below illustrates the floating point issue using the exact\nequality comparison, where we do a roundtrip transformation\nFK4 => ICRS => FK4 and then compare::\n\n  >>> sc1 = SkyCoord(1*u.deg, 2*u.deg, frame='fk4')\n  >>> sc1.icrs.fk4 == sc1\n  False\n\nMatching Within Tolerance\n-------------------------\n\nTo test if coordinates are within a certain angular distance of one other, use the\n`~astropy.coordinates.SkyCoord.separation` method::\n\n  >>> sc1.icrs.fk4.separation(sc1).to(u.arcsec)  # doctest: +SKIP\n  <Angle 7.98873629e-13 arcsec>\n  >>> sc1.icrs.fk4.separation(sc1) < 1e-9 * u.arcsec\n  True\n\nExact Equality\n--------------\n\nAstropy also provides an exact equality operator for coordinates.\nFor example, when comparing, e.g., two |SkyCoord| objects::\n\n    >>> left_skycoord == right_skycoord  # doctest: +SKIP\n\nthe right object must be strictly consistent with the left object for\ncomparison:\n\n- Identical class\n- Equivalent frames (`~astropy.coordinates.BaseCoordinateFrame.is_equivalent_frame`)\n- Identical representation_types\n- Identical representation differentials keys\n- Identical frame attributes\n- Identical \"extra\" frame attributes (e.g., ``obstime`` for an ICRS coord)\n\nIn the first example we show simple comparisons using array-valued coordinates::\n\n  >>> sc1 = SkyCoord([1, 2]*u.deg, [3, 4]*u.deg)\n  >>> sc2 = SkyCoord([1, 20]*u.deg, [3, 4]*u.deg)\n\n  >>> sc1 == sc2  # Array-valued comparison\n  array([ True, False])\n  >>> sc2 == sc2[1]  # Broadcasting comparison with a scalar\n  array([False,  True])\n  >>> sc2[0] == sc2[1]  # Scalar to scalar comparison\n  False\n  >>> sc1 != sc2  # Not equal\n  array([False,  True])\n\nIn addition to numerically comparing the representation component data (which\nmay include velocities), the equality comparison includes strict tests that all\nof the frame attributes like ``equinox`` or ``obstime`` are exactly equal.  Any\nmismatch in attributes will result in an exception being raised.  For example::\n\n  >>> sc1 = SkyCoord([1, 2]*u.deg, [3, 4]*u.deg)\n  >>> sc2 = SkyCoord([1, 20]*u.deg, [3, 4]*u.deg, obstime='2020-01-01')\n  >>> sc1 == sc2  # doctest: +SKIP\n  ...\n  ValueError: cannot compare: extra frame attribute 'obstime' is not equivalent\n   (perhaps compare the frames directly to avoid this exception)\n\nIn this example the ``obstime`` attribute is a so-called \"extra\" frame attribute\nthat does not apply directly to the ICRS coordinate frame. So we could compare\nwith the following, this time using the ``!=`` operator for variety::\n\n  >>> sc1.frame != sc2.frame\n  array([False, True])\n\nOne slightly special case is comparing two frames that both have no data, where\nthe return value is the same as ``frame1.is_equivalent_frame(frame2)``. For\nexample::\n\n  >>> from astropy.coordinates import FK4\n  >>> FK4() == FK4(obstime='2020-01-01')\n  False\n\n.. _skycoord-table-conversion:\n\nConverting a SkyCoord to a Table\n================================\n\nA |SkyCoord| object can be converted to a |QTable| using its\n:meth:`~astropy.coordinates.SkyCoord.to_table` method. The attributes of the\n|SkyCoord| are converted to columns of the table or added to its metadata\ndepending on whether or not they have the same length as the |SkyCoord|. This\nmeans that attributes such as ``obstime`` can become columns or metadata::\n\n  >>> from astropy.coordinates import SkyCoord\n  >>> from astropy.time import Time\n  >>> sc = SkyCoord(ra=[15, 30], dec=[-70, -50], unit=u.deg,\n  ...               obstime=Time([2000, 2010], format='jyear'))\n  >>> t = sc.to_table()\n  >>> t\n  <QTable length=2>\n     ra     dec   obstime\n    deg     deg\n  float64 float64   Time\n  ------- ------- -------\n     15.0   -70.0  2000.0\n     30.0   -50.0  2010.0\n  >>> t.meta\n  {'representation_type': 'spherical', 'frame': 'icrs'}\n\n  >>> sc = SkyCoord(l=[0, 20], b=[20, 0], unit=u.deg, frame='galactic',\n  ...               obstime=Time(2000, format='jyear'))\n  >>> t = sc.to_table()\n  >>> t\n  <QTable length=2>\n     l       b\n    deg     deg\n  float64 float64\n  ------- -------\n      0.0    20.0\n     20.0     0.0\n  >>> t.meta\n  {'obstime': <Time object: scale='tt' format='jyear' value=2000.0>,\n   'representation_type': 'spherical', 'frame': 'galactic'}\n\nConvenience Methods\n===================\n\nA number of convenience methods are available, and you are encouraged to read\nthe available docstrings below:\n\n- `~astropy.coordinates.SkyCoord.match_to_catalog_sky`,\n- `~astropy.coordinates.SkyCoord.match_to_catalog_3d`,\n- `~astropy.coordinates.SkyCoord.position_angle`,\n- `~astropy.coordinates.SkyCoord.separation`,\n- `~astropy.coordinates.SkyCoord.separation_3d`\n- `~astropy.coordinates.SkyCoord.apply_space_motion`\n\nAdditional information and examples can be found in the section on\n:ref:`astropy-coordinates-separations-matching` and\n:ref:`astropy-coordinates-apply-space-motion`.\n"},{"id":500,"name":"common_errors.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. _astropy-coordinates-common-errors:\n\nCommon mistakes\n***************\n\nThe following are some common sources of difficulty when using `~astropy.coordinates`.\n\nObject Separation\n-----------------\n\nWhen calculating the separation between objects, it is important to bear in mind that\n:meth:`astropy.coordinates.SkyCoord.separation` gives a different answer depending\nupon the order in which is used. For example::\n\n    >>> import numpy as np\n    >>> from astropy import units as u\n    >>> from astropy.coordinates import SkyCoord, GCRS\n    >>> from astropy.time import Time\n    >>> t = Time(\"2010-05-22T00:00\")\n    >>> moon = SkyCoord(104.29*u.deg, 23.51*u.deg, 359367.3*u.km, frame=GCRS(obstime=t))\n    >>> star = SkyCoord(101.4*u.deg, 23.02*u.deg, frame='icrs')\n    >>> star.separation(moon) # doctest: +FLOAT_CMP\n    <Angle 139.84211884 deg>\n    >>> moon.separation(star) # doctest: +FLOAT_CMP\n    <Angle 2.70390995 deg>\n\nWhy do these give such different answers?\n\nThe reason is that :meth:`astropy.coordinates.SkyCoord.separation` gives the separation as measured\nin the frame of the |SkyCoord| object. So ``star.separation(moon)`` gives the angular separation\nin the ICRS frame. This is the separation as it would appear from the Solar System Barycenter. For a\ngeocentric observer, ``moon.separation(star)`` gives the correct answer, since ``moon`` is in a\ngeocentric frame.\n\nAltAz calculations for Earth-based objects\n------------------------------------------\n\nOne might expect that the following code snippet would produce an altitude of exactly 90 degrees::\n\n    >>> from astropy.coordinates import EarthLocation, AltAz\n    >>> from astropy.time import Time\n    >>> from astropy import units as u\n\n    >>> t = Time('J2010')\n    >>> obj = EarthLocation(-1*u.deg, 52*u.deg, height=10.*u.km)\n    >>> home = EarthLocation(-1*u.deg, 52*u.deg, height=0.*u.km)\n    >>> altaz_frame = AltAz(obstime=t, location=home)\n    >>> obj.get_itrs(t).transform_to(altaz_frame).alt # doctest: +FLOAT_CMP\n    <Latitude 86.32878441 deg>\n\nWhy is the result over three degrees away from the zenith? It is only possible to understand by taking a very careful\nlook at what ``obj.get_itrs(t)`` returns. This call provides the ITRS position of the source ``obj``. ITRS is\na geocentric coordinate system, and includes the aberration of light. So the code above provides the ITRS position\nof a source that appears directly overhead *for an observer at the geocenter*.\n\nDue to aberration, the actual position of this source will be displaced from its apparent position, by an angle of\napproximately 20.5 arcseconds. Because this source is about one Earth radius away, it's actual position is therefore\naround 600 metres away from where it appears to be. This 600 metre shift, for an object 10 km above the Earth's surface\nis an angular difference of just over three degrees - which is why this object does not appear overhead for a topocentric\nobserver - one on the surface of the Earth.\n\nThe correct way to construct a |SkyCoord| object for a source that is directly overhead a topocentric observer is\nas follows::\n\n    >>> from astropy.coordinates import EarthLocation, AltAz, ITRS, CIRS\n    >>> from astropy.time import Time\n    >>> from astropy import units as u\n\n    >>> t = Time('J2010')\n    >>> obj = EarthLocation(-1*u.deg, 52*u.deg, height=10.*u.km)\n    >>> home = EarthLocation(-1*u.deg, 52*u.deg, height=0.*u.km)\n\n    >>> # Now we make a ITRS vector of a straight overhead object\n    >>> itrs_vec = obj.get_itrs(t).cartesian - home.get_itrs(t).cartesian\n\n    >>> # Now we create a topocentric coordinate with this data\n    >>> # Any topocentric frame will work, we use CIRS\n    >>> # Start by transforming the ITRS vector to CIRS\n    >>> cirs_vec = ITRS(itrs_vec, obstime=t).transform_to(CIRS(obstime=t)).cartesian\n    >>> # Finally, make CIRS frame object with the correct data\n    >>> cirs_topo = CIRS(cirs_vec, obstime=t, location=home)\n\n    >>> # convert to AltAz\n    >>> aa = cirs_topo.transform_to(AltAz(obstime=t, location=home))\n    >>> aa.alt # doctest: +FLOAT_CMP\n    <Latitude 90. deg>\n"},{"id":501,"name":"remote_methods.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. _astropy-coordinates-remote:\n\nUsage Tips/Suggestions for Methods That Access Remote Resources\n***************************************************************\n\nThere are currently two methods that rely on getting remote data to work.\n\nThe first is the :class:`~astropy.coordinates.SkyCoord` :meth:`~astropy.coordinates.SkyCoord.from_name` method, which uses\n`Sesame <http://cds.u-strasbg.fr/cgi-bin/Sesame>`_ to retrieve coordinates\nfor a particular named object::\n\n    >>> from astropy.coordinates import SkyCoord\n    >>> SkyCoord.from_name(\"PSR J1012+5307\")  # doctest: +REMOTE_DATA +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        ( 153.1393271,  53.117343)>\n\n.. testsetup::\n\n    >>> from astropy.coordinates import EarthLocation\n    >>> apo = EarthLocation(-1463969.3018517173, -5166673.342234327, 3434985.7120456537, unit='m')\n\nThe second is the :class:`~astropy.coordinates.EarthLocation` :meth:`~astropy.coordinates.EarthLocation.of_site` method, which\nprovides a similar quick way to get an\n:class:`~astropy.coordinates.EarthLocation` from an observatory name::\n\n    >>> from astropy.coordinates import EarthLocation\n    >>> apo = EarthLocation.of_site('Apache Point Observatory')  # doctest: +SKIP\n    >>> apo  # doctest: +FLOAT_CMP\n    <EarthLocation (-1463969.3018517173, -5166673.342234327, 3434985.7120456537) m>\n\nThe full list of available observatory names can be obtained with\n :meth:`astropy.coordinates.EarthLocation.get_site_names`.\n\n.. testsetup::\n\n    >>> loc = EarthLocation(-1994502.60430614, -5037538.54232911, 3358104.99690298, unit='m')\n\nWhile these methods are convenient, there are several considerations to take\ninto account:\n\n* Since these methods access online data, the data may evolve over time (for\n  example, the accuracy of coordinates might improve, and new observatories\n  may be added). Therefore, this means that a script using these and currently\n  running may give a different answer in five years. Therefore, users concerned\n  with reproducibility should not use these methods in their final scripts,\n  but can instead use them to get the values required, and then hard-code them\n  into the scripts. For example, we can check the coordinates of the Kitt\n  Peak Observatories using::\n\n    >>> loc = EarthLocation.of_site('Kitt Peak')  # doctest: +SKIP\n\n  Note that this command requires an internet connection.\n\n  We can then view the actual Cartesian coordinates for the observatory:\n\n    >>> loc  # doctest: +FLOAT_CMP\n    <EarthLocation (-1994502.6043061386, -5037538.54232911, 3358104.9969029757) m>\n\n  This can then be converted into code::\n\n    >>> loc = EarthLocation(-1994502.6043061386, -5037538.54232911, 3358104.9969029757, unit='m')\n\n  This latter line can then be included in a script and will ensure that the\n  results stay the same over time.\n\n* The online data may not be accurate enough for your purposes. If maximum\n  accuracy is paramount, we recommend that you determine the celestial or\n  Earth coordinates yourself and hard-code these, rather than using the\n  convenience methods.\n\n* These methods will not function if an internet connection is not available.\n  Therefore, if you need to work on a script while offline, follow the\n  instructions in the first bullet point above to hard-code the coordinates\n  before going offline.\n"},{"id":502,"name":"definitions.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. _astropy-coordinates-definitions:\n\nImportant Definitions\n*********************\n\nFor reference, below, we define some key terms as they are used in\n`~astropy.coordinates`, due to some ambiguities that exist in the\ncolloquial use of these terms. Chief among these terms is the concept\nof a \"coordinate system.\" To some members of the community, \"coordinate\nsystem\" means the *representation* of a point in space (e.g., \"Cartesian\ncoordinate system\" is different from \"Spherical polar coordinate\nsystem\"). Another use of \"coordinate system\" is to mean a unique\nreference frame with a particular set of reference points (e.g., \"the\nICRS coordinate system\" or the \"J2000 coordinate system\"). This second\nmeaning is further complicated by the fact that such systems use quite\ndifferent ways of defining a frame.\n\nBecause of the likelihood of confusion between these meanings of\n\"coordinate system,\" `~astropy.coordinates` avoids this term wherever\npossible, and instead adopts the following terms (loosely inspired by\nthe IAU2000 resolutions on celestial coordinate systems):\n\n* A \"Coordinate Representation\" is a particular way of describing a unique\n  point in a vector space. (Here, this means three-dimensional space, but future\n  extensions might have different dimensionality, particularly if relativistic\n  effects are desired.) Examples include Cartesian coordinates, cylindrical\n  polar, or latitude/longitude spherical polar coordinates. Note that this term\n  applies to the positions, *not* their velocities or other derivatives (which\n  are represented as \"differential\" classes).\n\n* A \"Reference System\" is a scheme for orienting points in a space and\n  describing how they transform to other systems. Examples include the ICRS,\n  equatorial coordinates with mean equinox, or the WGS84 geoid for\n  latitude/longitude on the Earth.\n\n* A \"Coordinate Frame,\" \"Reference Frame,\" or just \"Frame\" is a specific\n  realization of a reference system (e.g., the ICRF, or J2000 equatorial\n  coordinates). For some systems, there may be only one meaningful frame, while\n  others may have many different frames (differentiated by something like a\n  different equinox, or a different set of reference points).\n\n* A \"Coordinate\" is a combination of all of the above that specifies a unique\n  point.\n"},{"col":4,"comment":"\n        Implements `Card._check_if_rvkc` for the case of an unparsed card\n        image.  If given one argument this is the full intact image.  If given\n        two arguments the card has already been split between keyword and\n        value+comment at the standard value indicator '= '.\n        ","endLoc":664,"header":"def _check_if_rvkc_image(self, *args)","id":503,"name":"_check_if_rvkc_image","nodeType":"Function","startLoc":633,"text":"def _check_if_rvkc_image(self, *args):\n        \"\"\"\n        Implements `Card._check_if_rvkc` for the case of an unparsed card\n        image.  If given one argument this is the full intact image.  If given\n        two arguments the card has already been split between keyword and\n        value+comment at the standard value indicator '= '.\n        \"\"\"\n\n        if len(args) == 1:\n            image = args[0]\n            eq_idx = image.find(VALUE_INDICATOR)\n            if eq_idx < 0 or eq_idx > 9:\n                return False\n            keyword = image[:eq_idx]\n            rest = image[eq_idx + VALUE_INDICATOR_LEN:]\n        else:\n            keyword, rest = args\n\n        rest = rest.lstrip()\n\n        # This test allows us to skip running the full regular expression for\n        # the majority of cards that do not contain strings or that definitely\n        # do not contain RVKC field-specifiers; it's very much a\n        # micro-optimization but it does make a measurable difference\n        if not rest or rest[0] != \"'\" or rest.find(': ') < 2:\n            return False\n\n        match = self._rvkc_keyword_val_comm_RE.match(rest)\n        if match:\n            self._init_rvkc(keyword, match.group('keyword'),\n                            match.group('rawval'), match.group('val'))\n            return True"},{"id":504,"name":"transforming.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. _astropy-coordinates-transforming:\n\nTransforming between Systems\n****************************\n\n`astropy.coordinates` supports a rich system for transforming\ncoordinates from one frame to another. While common astronomy frames\nare built into Astropy, the transformation infrastructure is dynamic.\nThis means it allows users to define new coordinate frames and their\ntransformations. The topic of writing your own coordinate frame or\ntransforms is detailed in :ref:`astropy-coordinates-design`, and this\nsection is focused on how to *use* transformations.\n\nThe full list of built-in coordinate frames, the included transformations,\nand the frame names are shown as a (clickable) graph in the\n`~astropy.coordinates` API documentation.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Transforming Coordinates to Another Frame\n\nThe recommended method of transformation is shown below::\n\n    >>> import astropy.units as u\n    >>> from astropy.coordinates import SkyCoord\n    >>> gc = SkyCoord(l=0*u.degree, b=45*u.degree, frame='galactic')\n    >>> gc.fk5  # doctest: +FLOAT_CMP\n    <SkyCoord (FK5: equinox=J2000.000): (ra, dec) in deg\n        ( 229.27251463, -1.12844288)>\n\nWhile this appears to be ordinary attribute-style access, it is actually\nsyntactic sugar for the more general\n:meth:`~astropy.coordinates.SkyCoord.transform_to` method, which can\naccept either a frame name, class, or instance::\n\n    >>> from astropy.coordinates import FK5\n    >>> gc.transform_to('fk5')  # doctest: +FLOAT_CMP\n    <SkyCoord (FK5: equinox=J2000.000): (ra, dec) in deg\n        ( 229.27251463, -1.12844288)>\n    >>> gc.transform_to(FK5)  # doctest: +FLOAT_CMP\n    <SkyCoord (FK5: equinox=J2000.000): (ra, dec) in deg\n        ( 229.27251463, -1.12844288)>\n    >>> gc.transform_to(FK5(equinox='J1980.0'))  # doctest: +FLOAT_CMP\n    <SkyCoord (FK5: equinox=J1980.000): (ra, dec) in deg\n        ( 229.0146935, -1.05560349)>\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Using SkyCoord Objects as the Frame in Transformations\n\nAs a convenience, it is also possible to use a |SkyCoord| object as the frame in\n:meth:`~astropy.coordinates.SkyCoord.transform_to`. This allows for putting one\ncoordinate object into the frame of another::\n\n    >>> sc = SkyCoord(ra=1.0, dec=2.0, unit='deg', frame=FK5, equinox='J1980.0')\n    >>> gc.transform_to(sc)  # doctest: +FLOAT_CMP\n    <SkyCoord (FK5: equinox=J1980.000): (ra, dec) in deg\n        ( 229.0146935, -1.05560349)>\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Self Transformations of Coordinate Frames\n\nSome coordinate frames (including `~astropy.coordinates.FK5`,\n`~astropy.coordinates.FK4`, and `~astropy.coordinates.FK4NoETerms`) support\n\"self transformations,\" meaning the *type* of frame does not change, but the\nframe attributes do. An example is precessing a coordinate from one equinox\nto another in an equatorial frame. This is done by passing ``transform_to`` a\nframe class with the relevant attributes, as shown below. Note that these\nframes use a default equinox if you do not specify one::\n\n    >>> fk5c = SkyCoord('02h31m49.09s', '+89d15m50.8s', frame=FK5)\n    >>> fk5c.equinox\n    <Time object: scale='tt' format='jyear_str' value=J2000.000>\n    >>> fk5c  # doctest: +FLOAT_CMP\n    <SkyCoord (FK5: equinox=J2000.000): (ra, dec) in deg\n        ( 37.95454167,  89.26411111)>\n    >>> fk5_2005 = FK5(equinox='J2005')  # String initializes an astropy.time.Time object\n    >>> fk5c.transform_to(fk5_2005)  # doctest: +FLOAT_CMP\n    <SkyCoord (FK5: equinox=J2005.000): (ra, dec) in deg\n        ( 39.39317639,  89.28584422)>\n\nYou can also specify the equinox when you create a coordinate using a\n`~astropy.time.Time` object::\n\n    >>> from astropy.time import Time\n    >>> fk5c = SkyCoord('02h31m49.09s', '+89d15m50.8s',\n    ...                 frame=FK5(equinox=Time('J1970')))\n    >>> fk5_2000 = FK5(equinox=Time(2000, format='jyear'))\n    >>> fk5c.transform_to(fk5_2000)  # doctest: +FLOAT_CMP\n    <SkyCoord (FK5: equinox=2000.0): (ra, dec) in deg\n        ( 48.023171,  89.38672485)>\n\nThe same lower-level frame classes also have a\n:meth:`~astropy.coordinates.BaseCoordinateFrame.transform_to` method\nthat works the same as above, but they do not support attribute-style\naccess. They are also subtly different in that they only use frame\nattributes present in the initial or final frame, while |SkyCoord|\nobjects use any frame attributes they have for all transformation\nsteps. So |SkyCoord| can always transform from one frame to another and\nback again without change, while low-level classes may lose information\nand hence often do not round-trip.\n\n..\n  EXAMPLE END\n\n.. _astropy-coordinates-transforming-ephemerides:\n\nTransformations and Solar System Ephemerides\n============================================\n\nSome transformations (e.g., the transformation between\n`~astropy.coordinates.ICRS` and `~astropy.coordinates.GCRS`) require the use of\na Solar System ephemeris to calculate the position and velocity of the Earth\nand Sun. By default, transformations are calculated using built-in\n`ERFA <https://github.com/liberfa/erfa>`_ routines, but they can also use more\nprecise ones using the JPL ephemerides (which are derived from dynamical\nmodels).\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Calculating Transformations Using Solar System Ephemeris\n\nTo use the JPL ephemerides, use the\n`~astropy.coordinates.solar_system_ephemeris` context manager, as shown below:\n\n.. doctest-requires:: jplephem\n\n    >>> from astropy.coordinates import solar_system_ephemeris\n    >>> from astropy.coordinates import GCRS\n    >>> with solar_system_ephemeris.set('jpl'): # doctest: +REMOTE_DATA +IGNORE_OUTPUT\n    ...     fk5c.transform_to(GCRS(obstime=Time(\"J2000\"))) # doctest: +REMOTE_DATA +IGNORE_OUTPUT\n\nFor locations at large distances from the Solar system, using the JPL\nephemerides will make a negligible difference on the order of micro-arcseconds.\nFor nearby objects, such as the Moon, the difference can be of the\norder of milli-arcseconds. For more details about what ephemerides\nare available, including the requirements for using JPL ephemerides, see\n:ref:`astropy-coordinates-solarsystem`.\n\n..\n  EXAMPLE END\n"},{"id":505,"name":"formatting.rst","nodeType":"TextFile","path":"docs/coordinates","text":"Formatting Coordinate Strings\n*****************************\n\n.. todo: @taldcroft should change this to start with a discussion of SkyCoord's capabilities\n\nGetting a string representation of a coordinate is most powerfully\napproached by treating the components (e.g., RA and Dec) separately.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Getting and Formatting String Representations of Coordinates\n\nTo get the string representation of a coordinate::\n\n  >>> from astropy.coordinates import ICRS\n  >>> from astropy import units as u\n  >>> coo = ICRS(187.70592*u.degree, 12.39112*u.degree)\n  >>> str(coo.ra) + ' ' + str(coo.dec)\n  '187d42m21.312s 12d23m28.032s'\n\nTo get better control over the formatting, you can use the angles'\n:meth:`~astropy.coordinates.Angle.to_string` method (see :doc:`angles` for\nmore). For example::\n\n  >>> rahmsstr = coo.ra.to_string(u.hour)\n  >>> str(rahmsstr)\n  '12h30m49.4208s'\n  >>> decdmsstr = coo.dec.to_string(u.degree, alwayssign=True)\n  >>> str(decdmsstr)\n  '+12d23m28.032s'\n  >>> rahmsstr + ' ' + decdmsstr\n  u'12h30m49.4208s +12d23m28.032s'\n\nYou can also use Python's `format` string method to create more complex\nstring expressions, such as IAU-style coordinates or even full sentences::\n\n  >>> (f'SDSS J{coo.ra.to_string(unit=u.hourangle, sep=\"\", precision=2, pad=True)}'\n  ...  f'{coo.dec.to_string(sep=\"\", precision=2, alwayssign=True, pad=True)}')\n  'SDSS J123049.42+122328.03'\n  >>> f'The galaxy M87, at an RA of {coo.ra.hour:.2f} hours and Dec of {coo.dec.deg:.1f} degrees, has an impressive jet.'\n  'The galaxy M87, at an RA of 12.51 hours and Dec of 12.4 degrees, has an impressive jet.'\n\n..\n  EXAMPLE END\n"},{"id":506,"name":"velocities.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. _astropy-coordinates-velocities:\n\nWorking with Velocities in Astropy Coordinates\n**********************************************\n\nUsing Velocities with ``SkyCoord``\n==================================\n\nThe best way to start getting a coordinate object with velocities is to use the\n|SkyCoord| interface.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Using SkyCoord to Get Coordinate Objects with Velocities\n\nA |SkyCoord| to represent a star with a measured radial velocity but unknown\nproper motion and distance could be created as::\n\n    >>> from astropy.coordinates import SkyCoord\n    >>> import astropy.units as u\n    >>> sc = SkyCoord(1*u.deg, 2*u.deg, radial_velocity=20*u.km/u.s)\n    >>> sc  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        (1., 2.)\n     (radial_velocity) in km / s\n        (20.,)>\n    >>> sc.radial_velocity  # doctest: +FLOAT_CMP\n    <Quantity 20.0 km / s>\n\n|SkyCoord| objects created in this manner follow all of the same transformation\nrules and will correctly update their velocities when transformed to other\nframes. For example, to determine proper motions in Galactic coordinates for\na star with proper motions measured in ICRS::\n\n    >>> sc = SkyCoord(1*u.deg, 2*u.deg, pm_ra_cosdec=.2*u.mas/u.yr, pm_dec=.1*u.mas/u.yr)\n    >>> sc.galactic  # doctest: +FLOAT_CMP\n    <SkyCoord (Galactic): (l, b) in deg\n      ( 99.63785528, -58.70969293)\n    (pm_l_cosb, pm_b) in mas / yr\n      ( 0.22240398,  0.02316181)>\n\n..\n  EXAMPLE END\n\nFor more details on valid operations and limitations of velocity support in\n`astropy.coordinates` (particularly the :ref:`current accuracy limitations\n<astropy-coordinate-finite-difference-velocities>`), see the more detailed\ndiscussions below of velocity support in the lower-level frame objects. All\nthese same rules apply for |SkyCoord| objects, as they are built directly on top\nof the frame classes' velocity functionality detailed here.\n\n.. _astropy-coordinate-custom-frame-with-velocities:\n\nCreating Frame Objects with Velocity Data\n=========================================\n\nThe coordinate frame classes support storing and transforming velocity data\n(alongside the positional coordinate data). Similar to the positional data that\nuse the ``Representation`` classes to abstract away the particular\nrepresentation and allow re-representing from (e.g., Cartesian to Spherical),\nthe velocity data makes use of ``Differential`` classes to do the\nsame. (For more information about the differential classes, see\n:ref:`astropy-coordinates-differentials`.) Also like the positional data, the\nnames of the differential (velocity) components depend on the particular\ncoordinate frame.\n\nMost frames expect velocity data in the form of two proper motion components\nand/or a radial velocity because the default differential for most frames is the\n`~astropy.coordinates.SphericalCosLatDifferential` class. When supported, the\nproper motion components all begin with ``pm_`` and, by default, the\nlongitudinal component is expected to already include the ``cos(latitude)``\nterm. For example, the proper motion components for the ``ICRS`` frame are\n(``pm_ra_cosdec``, ``pm_dec``).\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Creating Frame Objects with Proper Motions\n\nTo create frame objects with velocity data in the form of proper motion\ncomponents::\n\n    >>> from astropy.coordinates import ICRS\n    >>> ICRS(ra=8.67*u.degree, dec=53.09*u.degree,\n    ...      pm_ra_cosdec=4.8*u.mas/u.yr, pm_dec=-15.16*u.mas/u.yr)  # doctest: +FLOAT_CMP\n    <ICRS Coordinate: (ra, dec) in deg\n        (8.67, 53.09)\n     (pm_ra_cosdec, pm_dec) in mas / yr\n        (4.8, -15.16)>\n    >>> ICRS(ra=8.67*u.degree, dec=53.09*u.degree,\n    ...      pm_ra_cosdec=4.8*u.mas/u.yr, pm_dec=-15.16*u.mas/u.yr,\n    ...      radial_velocity=23.42*u.km/u.s)  # doctest: +FLOAT_CMP\n    <ICRS Coordinate: (ra, dec) in deg\n        (8.67, 53.09)\n     (pm_ra_cosdec, pm_dec, radial_velocity) in (mas / yr, mas / yr, km / s)\n        (4.8, -15.16, 23.42)>\n\nFor proper motion components in the ``Galactic`` frame, the names track the\nlongitude and latitude names::\n\n    >>> from astropy.coordinates import Galactic\n    >>> Galactic(l=11.23*u.degree, b=58.13*u.degree,\n    ...          pm_l_cosb=21.34*u.mas/u.yr, pm_b=-55.89*u.mas/u.yr)  # doctest: +FLOAT_CMP\n    <Galactic Coordinate: (l, b) in deg\n        (11.23, 58.13)\n     (pm_l_cosb, pm_b) in mas / yr\n        (21.34, -55.89)>\n\nLike the positional data, velocity data must be passed in as\n`~astropy.units.Quantity` objects.\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Changing the Differential Class when Creating Frame Objects\n\nThe expected differential class can be changed to control the argument names\nthat the frame expects. By default the proper motion components are expected to\ncontain the ``cos(latitude)``, but this can be changed by specifying the\n`~astropy.coordinates.SphericalDifferential` class (instead of the default\n`~astropy.coordinates.SphericalCosLatDifferential`)::\n\n    >>> from astropy.coordinates import SphericalDifferential\n    >>> Galactic(l=11.23*u.degree, b=58.13*u.degree,\n    ...          pm_l=21.34*u.mas/u.yr, pm_b=-55.89*u.mas/u.yr,\n    ...          differential_type=SphericalDifferential)  # doctest: +FLOAT_CMP\n    <Galactic Coordinate: (l, b) in deg\n        (11.23, 58.13)\n     (pm_l, pm_b) in mas / yr\n        (21.34, -55.89)>\n\nThis works in parallel to specifying the expected representation class, as long\nas the differential class is compatible with the representation. For example, to\nspecify all coordinate and velocity components in Cartesian::\n\n    >>> from astropy.coordinates import (CartesianRepresentation,\n    ...                                  CartesianDifferential)\n    >>> Galactic(u=103*u.pc, v=-11*u.pc, w=93.*u.pc,\n    ...          U=31*u.km/u.s, V=-10*u.km/u.s, W=75*u.km/u.s,\n    ...          representation_type=CartesianRepresentation,\n    ...          differential_type=CartesianDifferential)  # doctest: +FLOAT_CMP\n    <Galactic Coordinate: (u, v, w) in pc\n        (103., -11., 93.)\n     (U, V, W) in km / s\n        (31., -10., 75.)>\n\nNote that the ``Galactic`` frame has special, standard names for Cartesian\nposition and velocity components. For other frames, these are just ``x,y,z`` and\n``v_x,v_y,v_z``::\n\n    >>> ICRS(x=103*u.pc, y=-11*u.pc, z=93.*u.pc,\n    ...      v_x=31*u.km/u.s, v_y=-10*u.km/u.s, v_z=75*u.km/u.s,\n    ...      representation_type=CartesianRepresentation,\n    ...      differential_type=CartesianDifferential)  # doctest: +FLOAT_CMP\n    <ICRS Coordinate: (x, y, z) in pc\n        (103., -11., 93.)\n     (v_x, v_y, v_z) in km / s\n        (31., -10., 75.)>\n\n..\n  EXAMPLE END\n\n..\n  EXAMPLE START\n  Shorthands for Convenient Access to Velocity Data in Frame Objects\n\nFor any frame with velocity data with any representation, there are also\nshorthands that provide easier access to the underlying velocity data in\ncommonly needed formats. With any frame object with 3D velocity data, the 3D\nCartesian velocity can be accessed with::\n\n    >>> icrs = ICRS(ra=8.67*u.degree, dec=53.09*u.degree,\n    ...             distance=171*u.pc,\n    ...             pm_ra_cosdec=4.8*u.mas/u.yr, pm_dec=-15.16*u.mas/u.yr,\n    ...             radial_velocity=23.42*u.km/u.s)\n    >>> icrs.velocity # doctest: +FLOAT_CMP\n    <CartesianDifferential (d_x, d_y, d_z) in km / s\n        ( 23.03160789,  7.44794505,  11.34587732)>\n\nThere are also shorthands for retrieving a single `~astropy.units.Quantity`\nobject that contains the two-dimensional proper motion data, and for retrieving\nthe radial (line-of-sight) velocity::\n\n    >>> icrs.proper_motion # doctest: +FLOAT_CMP\n    <Quantity [  4.8 ,-15.16] mas / yr>\n    >>> icrs.radial_velocity # doctest: +FLOAT_CMP\n    <Quantity 23.42 km / s>\n\n..\n  EXAMPLE END\n\nAdding Velocities to Existing Frame Objects\n===========================================\n\nAnother use case similar to the above comes up when you have an existing frame\nobject (or |SkyCoord|) and want an object with the same position but with\nvelocities added. The most conceptually direct way to do this is to\nuse the differential objects along with\n`~astropy.coordinates.BaseCoordinateFrame.realize_frame`.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Adding Velocities to Existing Frame Objects\n\nThe following snippet accomplishes a well-defined case where the desired\nvelocities are known in the Cartesian representation. To add the velocities to\nthe existing frame using\n`~astropy.coordinates.BaseCoordinateFrame.realize_frame`::\n\n    >>> icrs = ICRS(1*u.deg, 2*u.deg, distance=3*u.kpc)\n    >>> icrs # doctest: +FLOAT_CMP\n    <ICRS Coordinate: (ra, dec, distance) in (deg, deg, kpc)\n        (1., 2., 3.)>\n    >>> vel_to_add = CartesianDifferential(4*u.km/u.s, 5*u.km/u.s, 6*u.km/u.s)\n    >>> newdata = icrs.data.to_cartesian().with_differentials(vel_to_add)\n    >>> icrs.realize_frame(newdata) # doctest: +FLOAT_CMP\n    <ICRS Coordinate: (ra, dec, distance) in (deg, deg, kpc)\n        (1., 2., 3.)\n     (pm_ra_cosdec, pm_dec, radial_velocity) in (mas / yr, mas / yr, km / s)\n        (0.34662023, 0.41161335, 4.29356031)>\n\nA similar mechanism can also be used to add velocities even if full 3D coordinates\nare not available (e.g., for a radial velocity observation of an object where\nthe distance is unknown). However, it requires a slightly different way of\nspecifying the differentials because of the lack of explicit unit information::\n\n    >>> from astropy.coordinates import RadialDifferential\n    >>> icrs_no_distance = ICRS(1*u.deg, 2*u.deg)\n    >>> icrs_no_distance\n    <ICRS Coordinate: (ra, dec) in deg\n        (1., 2.)>\n    >>> rv_to_add = RadialDifferential(500*u.km/u.s)\n    >>> data_with_rv = icrs_no_distance.data.with_differentials({'s':rv_to_add})\n    >>> icrs_no_distance.realize_frame(data_with_rv) # doctest: +FLOAT_CMP\n    <ICRS Coordinate: (ra, dec) in deg\n        (1., 2.)\n     (radial_velocity) in km / s\n        (500.,)>\n\nWhich we can see yields an object identical to what you get when you specify a\nradial velocity when you create the object::\n\n    >>> ICRS(1*u.deg, 2*u.deg, radial_velocity=500*u.km/u.s) # doctest: +FLOAT_CMP\n    <ICRS Coordinate: (ra, dec) in deg\n        (1., 2.)\n     (radial_velocity) in km / s\n        (500.,)>\n\n..\n  EXAMPLE END\n\n.. _astropy-coordinate-transform-with-velocities:\n\nTransforming Frames with Velocities\n===================================\n\nTransforming coordinate frame instances that contain velocity data to a\ndifferent frame (which may involve both position and velocity transformations)\nis done exactly the same way as transforming position-only frame instances.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Transforming Coordinate Frames with Velocities\n\nTo transform a coordinate frame that contains velocity data::\n\n    >>> from astropy.coordinates import Galactic\n    >>> icrs = ICRS(ra=8.67*u.degree, dec=53.09*u.degree,\n    ...             pm_ra_cosdec=4.8*u.mas/u.yr, pm_dec=-15.16*u.mas/u.yr)  # doctest: +FLOAT_CMP\n    >>> icrs.transform_to(Galactic()) # doctest: +FLOAT_CMP\n    <Galactic Coordinate: (l, b) in deg\n        (120.38084191, -9.69872044)\n     (pm_l_cosb, pm_b) in mas / yr\n        (3.78957965, -15.44359693)>\n\n..\n  EXAMPLE END\n\nHowever, the details of how the velocity components are transformed depends on\nthe particular set of transforms required to get from the starting frame to the\ndesired frame (i.e., the path taken through the frame transform graph). If all\nframes in the chain of transformations are transformed to each other via\n`~astropy.coordinates.BaseAffineTransform` subclasses (i.e., are matrix\ntransformations or affine transformations), then the transformations can be\napplied explicitly to the velocity data. If this is not the case, the velocity\ntransformation is computed numerically by finite-differencing the positional\ntransformation. See the subsections below for more details about these two\nmethods.\n\nAffine Transformations\n----------------------\n\nFrame transformations that involve a rotation and/or an origin shift and/or\na velocity offset are implemented as affine transformations using the\n`~astropy.coordinates.BaseAffineTransform` subclasses:\n`~astropy.coordinates.StaticMatrixTransform`,\n`~astropy.coordinates.DynamicMatrixTransform`, and\n`~astropy.coordinates.AffineTransform`.\n\nMatrix-only transformations (e.g., rotations such as\n`~astropy.coordinates.ICRS` to `~astropy.coordinates.Galactic`) can be performed\non proper-motion-only data or full-space, 3D velocities.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Affine Frame Transformations\n\nTo perform a matrix-only transformation::\n\n    >>> icrs = ICRS(ra=8.67*u.degree, dec=53.09*u.degree,\n    ...             pm_ra_cosdec=4.8*u.mas/u.yr, pm_dec=-15.16*u.mas/u.yr,\n    ...             radial_velocity=23.42*u.km/u.s)\n    >>> icrs.transform_to(Galactic())  # doctest: +FLOAT_CMP\n    <Galactic Coordinate: (l, b) in deg\n        (120.38084191, -9.69872044)\n     (pm_l_cosb, pm_b, radial_velocity) in (mas / yr, mas / yr, km / s)\n        (3.78957965, -15.44359693, 23.42)>\n\nThe same rotation matrix is applied to both the position vector and the velocity\nvector. Any transformation that involves a velocity offset requires all 3D\nvelocity components (which typically require specifying a distance as well),\nfor example, `~astropy.coordinates.ICRS` to `~astropy.coordinates.LSR`::\n\n    >>> from astropy.coordinates import LSR\n    >>> icrs = ICRS(ra=8.67*u.degree, dec=53.09*u.degree,\n    ...             distance=117*u.pc,\n    ...             pm_ra_cosdec=4.8*u.mas/u.yr, pm_dec=-15.16*u.mas/u.yr,\n    ...             radial_velocity=23.42*u.km/u.s)\n    >>> icrs.transform_to(LSR())  # doctest: +FLOAT_CMP\n    <LSR Coordinate (v_bary=(11.1, 12.24, 7.25) km / s): (ra, dec, distance) in (deg, deg, pc)\n        (8.67, 53.09, 117.)\n     (pm_ra_cosdec, pm_dec, radial_velocity) in (mas / yr, mas / yr, km / s)\n        (-24.51315607, -2.67935501, 27.07339176)>\n\n..\n  EXAMPLE END\n\n.. _astropy-coordinate-finite-difference-velocities:\n\nFinite Difference Transformations\n---------------------------------\n\nSome frame transformations cannot be expressed as affine transformations.\nFor example, transformations from the `~astropy.coordinates.AltAz` frame can\ninclude an atmospheric dispersion correction, which is inherently nonlinear.\nAdditionally, some frames are more conveniently implemented as functions, even\nif they can be cast as affine transformations. For these frames, a finite\ndifference approach to transforming velocities is available. Note that this\napproach is implemented such that user-defined frames can use it in\nthe same manner (i.e., by defining a transformation of the\n`~astropy.coordinates.FunctionTransformWithFiniteDifference` type).\n\nThis finite difference approach actually combines two separate (but important)\nelements of the transformation:\n\n  * Transformation of the *direction* of the velocity vector that already exists\n    in the starting frame. That is, a frame transformation sometimes involves\n    reorienting the coordinate frame (e.g., rotation), and the velocity vector\n    in the new frame must account for this. The finite difference approach\n    models this by moving the position of the starting frame along the velocity\n    vector, and computing this offset in the target frame.\n  * The \"induced\" velocity due to motion of the frame *itself*. For example,\n    shifting from a frame centered at the solar system barycenter to one\n    centered on the Earth includes a velocity component due entirely to the\n    Earth's motion around the barycenter. This is accounted for by computing\n    the location of the starting frame in the target frame at slightly different\n    times, and computing the difference between those. Note that this step\n    depends on assuming that a particular frame attribute represents a \"time\"\n    of relevance for the induced velocity. By convention this is typically the\n    ``obstime`` frame attribute, although it is an option that can be set when\n    defining a finite difference transformation function.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Transforming Velocity Data Between Frames Using a Finite Difference Scheme\n\nIt is important to recognize that the finite difference transformations\nhave inherent limits set by the finite difference algorithm and machine\nprecision. To illustrate this problem, consider the AltAz to GCRS  (i.e.,\ngeocentric) transformation. Let us try to compute the radial velocity in the\nGCRS frame for something observed from the Earth at a distance of 100 AU with a\nradial velocity of 10 km/s:\n\n.. plot::\n    :context: reset\n    :include-source:\n\n    import numpy as np\n    from matplotlib import pyplot as plt\n\n    from astropy import units as u\n    from astropy.time import Time\n    from astropy.coordinates import EarthLocation, AltAz, GCRS\n\n    time = Time('J2010') + np.linspace(-1,1,1000)*u.min\n    location = EarthLocation(lon=0*u.deg, lat=45*u.deg)\n    aa = AltAz(alt=[45]*1000*u.deg, az=90*u.deg, distance=100*u.au,\n               radial_velocity=[10]*1000*u.km/u.s,\n               location=location, obstime=time)\n    gcrs = aa.transform_to(GCRS(obstime=time))\n    plt.plot_date(time.plot_date, gcrs.radial_velocity.to(u.km/u.s))\n    plt.ylabel('RV [km/s]')\n\nThis seems plausible: the radial velocity should indeed be very close to 10 km/s\nbecause the frame does not involve a velocity shift.\n\nNow let us consider 100 *kiloparsecs* as the distance. In this case we expect\nthe same: the radial velocity should be essentially the same in both frames:\n\n.. plot::\n    :context:\n    :include-source:\n\n    time = Time('J2010') + np.linspace(-1,1,1000)*u.min\n    location = EarthLocation(lon=0*u.deg, lat=45*u.deg)\n    aa = AltAz(alt=[45]*1000*u.deg, az=90*u.deg, distance=100*u.kpc,\n               radial_velocity=[10]*1000*u.km/u.s,\n               location=location, obstime=time)\n    gcrs = aa.transform_to(GCRS(obstime=time))\n    plt.plot_date(time.plot_date, gcrs.radial_velocity.to(u.km/u.s))\n    plt.ylabel('RV [km/s]')\n\nBut this result is nonsense, with values from -1000 to 1000 km/s instead of the\n~10 km/s we expected. The root of the problem here is that the machine\nprecision is not sufficient to compute differences on the order of kilometers\nover distances on the order of kiloparsecs. Hence, the straightforward finite\ndifference method will not work for this use case with the default values.\n\n.. testsetup::\n\n    >>> import numpy as np\n    >>> from astropy.coordinates import EarthLocation, AltAz, GCRS\n    >>> from astropy.time import Time\n    >>> time = Time('J2010') + np.linspace(-1,1,1000) * u.min\n    >>> location = EarthLocation(lon=0*u.deg, lat=45*u.deg)\n    >>> aa = AltAz(alt=[45]*1000*u.deg, az=90*u.deg, distance=100*u.kpc,\n    ...            radial_velocity=[10]*1000*u.km/u.s,\n    ...            location=location, obstime=time)\n\nIt is possible to override the timestep over which the finite difference occurs.\nFor example::\n\n    >>> from astropy.coordinates import frame_transform_graph, AltAz, CIRS\n    >>> trans = frame_transform_graph.get_transform(AltAz, CIRS).transforms[0]\n    >>> trans.finite_difference_dt = 1 * u.year\n    >>> gcrs = aa.transform_to(GCRS(obstime=time))  # doctest: +REMOTE_DATA\n    >>> trans.finite_difference_dt = 1 * u.second  # return to default\n\nIn the above example, there is exactly one transformation step from\n`~astropy.coordinates.AltAz` to `~astropy.coordinates.GCRS`.  In general, there\nmay be more than one step between two frames, or the single step may perform\nother transformations internally.  One can use the context manager\n:func:`~astropy.coordinates.TransformGraph.impose_finite_difference_dt` for the\ntransformation graph to override ``finite_difference_dt`` for *all*\nfinite-difference transformations on the graph::\n\n    >>> from astropy.coordinates import frame_transform_graph\n    >>> with frame_transform_graph.impose_finite_difference_dt(1 * u.year):\n    ...     gcrs = aa.transform_to(GCRS(obstime=time))  # doctest: +REMOTE_DATA\n\nBut beware that this will *not* help in cases like the above, where the relevant\ntimescales for the velocities are seconds. (The velocity of the Earth relative\nto a particular direction changes dramatically over the course of one year.)\n\n..\n  EXAMPLE END\n\nFuture versions of Astropy will improve on this algorithm to make the results\nmore numerically stable and practical for use in these (not unusual) use cases.\n\n.. _astropy-coordinates-rv-corrs:\n\nRadial Velocity Corrections\n===========================\n\nSeparately from the above, Astropy supports computing barycentric or\nheliocentric radial velocity corrections. While in the future this may\nbe a high-level convenience function using the framework described above, the\ncurrent implementation is independent to ensure sufficient accuracy (see\n:ref:`astropy-coordinates-rv-corrs` and the\n`~astropy.coordinates.SkyCoord.radial_velocity_correction` API docs for\ndetails).\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Computing Barycentric or Heliocentric Radial Velocity Corrections\n\nThis example demonstrates how to compute this correction if observing some\nobject at a known RA and Dec from the Keck observatory at a particular time. If\na precision of around 3 m/s is sufficient, the computed correction can then be\nadded to any observed radial velocity to determine the final heliocentric\nradial velocity::\n\n    >>> from astropy.time import Time\n    >>> from astropy.coordinates import SkyCoord, EarthLocation\n    >>> # keck = EarthLocation.of_site('Keck')  # the easiest way... but requires internet\n    >>> keck = EarthLocation.from_geodetic(lat=19.8283*u.deg, lon=-155.4783*u.deg, height=4160*u.m)\n    >>> sc = SkyCoord(ra=4.88375*u.deg, dec=35.0436389*u.deg)\n    >>> barycorr = sc.radial_velocity_correction(obstime=Time('2016-6-4'), location=keck)  # doctest: +REMOTE_DATA\n    >>> barycorr.to(u.km/u.s)  # doctest: +REMOTE_DATA +FLOAT_CMP\n    <Quantity 20.077135 km / s>\n    >>> heliocorr = sc.radial_velocity_correction('heliocentric', obstime=Time('2016-6-4'), location=keck)  # doctest: +REMOTE_DATA\n    >>> heliocorr.to(u.km/u.s)  # doctest: +REMOTE_DATA +FLOAT_CMP\n    <Quantity 20.070039 km / s>\n\nNote that there are a few different ways to specify the options for the\ncorrection (e.g., the location, observation time, etc.). See the\n`~astropy.coordinates.SkyCoord.radial_velocity_correction` docs for more\ninformation.\n\n..\n  EXAMPLE END\n\nPrecision of `~astropy.coordinates.SkyCoord.radial_velocity_correction`\n------------------------------------------------------------------------\n\nThe correction computed by `~astropy.coordinates.SkyCoord.radial_velocity_correction`\nuses the optical approximation :math:`v = zc` (see :ref:`astropy-units-doppler-equivalencies`\nfor details). The correction can be added to any observed radial velocity\nto provide a correction that is accurate to a level of approximately 3 m/s.\nIf you need more precise corrections, there are a number of subtleties of\nwhich you must be aware.\n\nThe first is that you should always use a barycentric correction, as the\nbarycenter is a fixed point where gravity is constant. Since the heliocenter\ndoes not satisfy these conditions, corrections to the heliocenter are only\nsuitable for low precision work. As a result, and to increase speed, the\nheliocentric correction in\n`~astropy.coordinates.SkyCoord.radial_velocity_correction` does not include\neffects such as the gravitational redshift due to the potential at the Earth's\nsurface. For these reasons, the barycentric correction in\n`~astropy.coordinates.SkyCoord.radial_velocity_correction` should always\nbe used for high precision work.\n\nOther considerations necessary for radial velocity corrections at the cm/s\nlevel are outlined in `Wright & Eastman (2014) <https://ui.adsabs.harvard.edu/abs/2014PASP..126..838W>`_.\nMost important is that the barycentric correction is, strictly speaking,\n*multiplicative*, so that you should apply it as:\n\n.. math::\n\n    v_t = v_m + v_b + \\frac{v_b v_m}{c},\n\nWhere :math:`v_t` is the true radial velocity, :math:`v_m` is the measured\nradial velocity and :math:`v_b` is the barycentric correction returned by\n`~astropy.coordinates.SkyCoord.radial_velocity_correction`. Failure to apply\nthe barycentric correction in this way leads to errors of order 3 m/s.\n\nThe barycentric correction in `~astropy.coordinates.SkyCoord.radial_velocity_correction` is consistent\nwith the `IDL implementation <http://astroutils.astronomy.ohio-state.edu/exofast/barycorr.html>`_ of\nthe Wright & Eastmann (2014) paper to a level of 10 mm/s for a source at\ninfinite distance. We do not include the Shapiro delay nor the light\ntravel time correction from equation 28 of that paper. The neglected terms\nare not important unless you require accuracies of better than 1 cm/s.\nIf you do require that precision, see `Wright & Eastmann (2014) <https://ui.adsabs.harvard.edu/abs/2014PASP..126..838W>`_.\n"},{"id":507,"name":"index.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. We call EarthLocation.of_site here first to force the downloading\n.. of sites.json so that future doctest output isn't cluttered with\n.. \"Downloading ... [done]\". This can be removed once we have a better\n.. way of ignoring output lines based on pattern-matching, e.g.:\n.. https://github.com/astropy/pytest-doctestplus/issues/11\n\n.. testsetup::\n\n    >>> from astropy.coordinates import EarthLocation\n    >>> EarthLocation.of_site('greenwich') # doctest: +IGNORE_OUTPUT +IGNORE_WARNINGS\n\n.. _astropy-coordinates:\n\n*******************************************************\nAstronomical Coordinate Systems (`astropy.coordinates`)\n*******************************************************\n\nIntroduction\n============\n\nThe `~astropy.coordinates` package provides classes for representing a variety\nof celestial/spatial coordinates and their velocity components, as well as tools\nfor converting between common coordinate systems in a uniform way.\n\nGetting Started\n===============\n\nThe best way to start using `~astropy.coordinates` is to use the |SkyCoord|\nclass. |SkyCoord| objects are instantiated by passing in positions (and\noptional velocities) with specified units and a coordinate frame. Sky positions\nare commonly passed in as `~astropy.units.Quantity` objects and the frame is\nspecified with the string name.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Using the SkyCoord Class\n\nTo create a |SkyCoord| object to represent an ICRS (Right ascension [RA],\nDeclination [Dec]) sky position::\n\n    >>> from astropy import units as u\n    >>> from astropy.coordinates import SkyCoord\n    >>> c = SkyCoord(ra=10.625*u.degree, dec=41.2*u.degree, frame='icrs')\n\nThe initializer for |SkyCoord| is very flexible and supports inputs provided in\na number of convenient formats. The following ways of initializing a coordinate\nare all equivalent to the above::\n\n    >>> c = SkyCoord(10.625, 41.2, frame='icrs', unit='deg')\n    >>> c = SkyCoord('00h42m30s', '+41d12m00s', frame='icrs')\n    >>> c = SkyCoord('00h42.5m', '+41d12m')\n    >>> c = SkyCoord('00 42 30 +41 12 00', unit=(u.hourangle, u.deg))\n    >>> c = SkyCoord('00:42.5 +41:12', unit=(u.hourangle, u.deg))\n    >>> c  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        (10.625, 41.2)>\n\nThe examples above illustrate a few rules to follow when creating a\ncoordinate object:\n\n- Coordinate values can be provided either as unnamed positional arguments or\n  via keyword arguments like ``ra`` and ``dec``, or  ``l`` and ``b`` (depending\n  on the frame).\n- The coordinate ``frame`` keyword is optional because it defaults to\n  `~astropy.coordinates.ICRS`.\n- Angle units must be specified for all components, either by passing in a\n  `~astropy.units.Quantity` object (e.g., ``10.5*u.degree``), by including them\n  in the value (e.g., ``'+41d12m00s'``), or via the ``unit`` keyword.\n\n..\n  EXAMPLE END\n\n|SkyCoord| and all other `~astropy.coordinates` objects also support\narray coordinates. These work in the same way as single-value coordinates, but\nthey store multiple coordinates in a single object. When you are going\nto apply the same operation to many different coordinates (say, from a\ncatalog), this is a better choice than a list of |SkyCoord| objects,\nbecause it will be *much* faster than applying the operation to each\n|SkyCoord| in a ``for`` loop. Like the underlying `~numpy.ndarray` instances\nthat contain the data, |SkyCoord| objects can be sliced, reshaped, etc.,\nand can be used with functions like `numpy.moveaxis`, etc., that affect the\nshape::\n\n    >>> import numpy as np\n    >>> c = SkyCoord(ra=[10, 11, 12, 13]*u.degree, dec=[41, -5, 42, 0]*u.degree)\n    >>> c\n    <SkyCoord (ICRS): (ra, dec) in deg\n        [(10., 41.), (11., -5.), (12., 42.), (13.,  0.)]>\n    >>> c[1]\n    <SkyCoord (ICRS): (ra, dec) in deg\n        (11., -5.)>\n    >>> c.reshape(2, 2)\n    <SkyCoord (ICRS): (ra, dec) in deg\n        [[(10., 41.), (11., -5.)],\n         [(12., 42.), (13.,  0.)]]>\n    >>> np.roll(c, 1)\n    <SkyCoord (ICRS): (ra, dec) in deg\n        [(13.,  0.), (10., 41.), (11., -5.), (12., 42.)]>\n\n\nCoordinate Access\n-----------------\n\nOnce you have a coordinate object you can access the components of that\ncoordinate (e.g., RA, Dec) to get string representations of the full\ncoordinate.\n\nThe component values are accessed using (typically lowercase) named attributes\nthat depend on the coordinate frame (e.g., ICRS, Galactic, etc.). For the\ndefault, ICRS, the coordinate component names are ``ra`` and ``dec``::\n\n    >>> c = SkyCoord(ra=10.68458*u.degree, dec=41.26917*u.degree)\n    >>> c.ra  # doctest: +FLOAT_CMP\n    <Longitude 10.68458 deg>\n    >>> c.ra.hour  # doctest: +FLOAT_CMP\n    0.7123053333333335\n    >>> c.ra.hms  # doctest: +FLOAT_CMP\n    hms_tuple(h=0.0, m=42.0, s=44.299200000000525)\n    >>> c.dec  # doctest: +FLOAT_CMP\n    <Latitude 41.26917 deg>\n    >>> c.dec.degree  # doctest: +FLOAT_CMP\n    41.26917\n    >>> c.dec.radian  # doctest: +FLOAT_CMP\n    0.7202828960652683\n\nCoordinates can be converted to strings using the\n:meth:`~astropy.coordinates.SkyCoord.to_string` method::\n\n    >>> c = SkyCoord(ra=10.68458*u.degree, dec=41.26917*u.degree)\n    >>> c.to_string('decimal')\n    '10.6846 41.2692'\n    >>> c.to_string('dms')\n    '10d41m04.488s 41d16m09.012s'\n    >>> c.to_string('hmsdms')\n    '00h42m44.2992s +41d16m09.012s'\n\nFor additional information see the section on :ref:`working_with_angles`.\n\nTransformation\n--------------\n\nOne convenient way to transform to a new coordinate frame is by accessing\nthe appropriately named attribute.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Transforming to a New Coordinate Frame\n\nTo get the coordinate in the `~astropy.coordinates.Galactic` frame use::\n\n    >>> c_icrs = SkyCoord(ra=10.68458*u.degree, dec=41.26917*u.degree, frame='icrs')\n    >>> c_icrs.galactic  # doctest: +FLOAT_CMP\n    <SkyCoord (Galactic): (l, b) in deg\n        (121.17424181, -21.57288557)>\n\nFor more control, you can use the `~astropy.coordinates.SkyCoord.transform_to`\nmethod, which accepts a frame name, frame class, or frame instance::\n\n    >>> c_fk5 = c_icrs.transform_to('fk5')  # c_icrs.fk5 does the same thing\n    >>> c_fk5  # doctest: +FLOAT_CMP\n    <SkyCoord (FK5: equinox=J2000.000): (ra, dec) in deg\n        (10.68459154, 41.26917146)>\n\n    >>> from astropy.coordinates import FK5\n    >>> c_fk5.transform_to(FK5(equinox='J1975'))  # precess to a different equinox  # doctest: +FLOAT_CMP\n    <SkyCoord (FK5: equinox=J1975.000): (ra, dec) in deg\n        (10.34209135, 41.13232112)>\n\n..\n  EXAMPLE END\n\nThis form of `~astropy.coordinates.SkyCoord.transform_to` also makes it\npossible to convert from celestial coordinates to\n`~astropy.coordinates.AltAz` coordinates, allowing the use of |SkyCoord|\nas a tool for planning observations. For a more complete example of\nthis, see :ref:`sphx_glr_generated_examples_coordinates_plot_obs-planning.py`.\n\nSome coordinate frames such as `~astropy.coordinates.AltAz` require Earth\nrotation information (UT1-UTC offset and/or polar motion) when transforming\nto/from other frames. These Earth rotation values are automatically downloaded\nfrom the International Earth Rotation and Reference Systems (IERS) service when\nrequired. See :ref:`utils-iers` for details of this process.\n\nRepresentation\n--------------\n\nSo far we have been using a spherical coordinate representation in all of our\nexamples, and this is the default for the built-in frames. Frequently it is\nconvenient to initialize or work with a coordinate using a different\nrepresentation such as Cartesian or Cylindrical. This can be done by setting\nthe ``representation_type`` for either |SkyCoord| objects or low-level frame\ncoordinate objects.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Working with Nonspherical Coordinate Representations\n\nTo initialize or work with a coordinate using a different representation such\nas Cartesian or Cylindrical::\n\n    >>> c = SkyCoord(x=1, y=2, z=3, unit='kpc', representation_type='cartesian')\n    >>> c  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (x, y, z) in kpc\n        (1., 2., 3.)>\n    >>> c.x, c.y, c.z  # doctest: +FLOAT_CMP\n    (<Quantity 1. kpc>, <Quantity 2. kpc>, <Quantity 3. kpc>)\n\n    >>> c.representation_type = 'cylindrical'\n    >>> c  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (rho, phi, z) in (kpc, deg, kpc)\n        (2.23606798, 63.43494882, 3.)>\n\nFor all of the details see :ref:`astropy-skycoord-representations`.\n\n..\n  EXAMPLE END\n\nDistance\n--------\n\n|SkyCoord| and the individual frame classes also support specifying a distance\nfrom the frame origin. The origin depends on the particular coordinate frame;\nthis can be, for example, centered on the earth, centered on the solar system\nbarycenter, etc.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  Specifying a Distance with SkyCoord\n\nTwo angles and a distance specify a unique point in 3D space, which also allows\nconverting the coordinates to a Cartesian representation::\n\n    >>> c = SkyCoord(ra=10.68458*u.degree, dec=41.26917*u.degree, distance=770*u.kpc)\n    >>> c.cartesian.x  # doctest: +FLOAT_CMP\n    <Quantity 568.71286542 kpc>\n    >>> c.cartesian.y  # doctest: +FLOAT_CMP\n    <Quantity 107.3008974 kpc>\n    >>> c.cartesian.z  # doctest: +FLOAT_CMP\n    <Quantity 507.88994292 kpc>\n\nWith distances assigned, |SkyCoord| convenience methods are more powerful, as\nthey can make use of the 3D information. For example, to compute the physical,\n3D separation between two points in space::\n\n    >>> c1 = SkyCoord(ra=10*u.degree, dec=9*u.degree, distance=10*u.pc, frame='icrs')\n    >>> c2 = SkyCoord(ra=11*u.degree, dec=10*u.degree, distance=11.5*u.pc, frame='icrs')\n    >>> c1.separation_3d(c2)  # doctest: +FLOAT_CMP\n    <Distance 1.52286024 pc>\n\n..\n  EXAMPLE END\n\nConvenience Methods\n-------------------\n\n|SkyCoord| defines a number of convenience methods that support, for example,\ncomputing on-sky (i.e., angular) and 3D separations between two coordinates.\n\nExamples\n^^^^^^^^\n\n..\n  EXAMPLE START\n  SkyCoord Convenience Methods\n\nTo compute on-sky and 3D separations between two coordinates::\n\n    >>> c1 = SkyCoord(ra=10*u.degree, dec=9*u.degree, frame='icrs')\n    >>> c2 = SkyCoord(ra=11*u.degree, dec=10*u.degree, frame='fk5')\n    >>> c1.separation(c2)  # Differing frames handled correctly  # doctest: +FLOAT_CMP\n    <Angle 1.40453359 deg>\n\nOr cross-matching catalog coordinates (detailed in\n:ref:`astropy-coordinates-matching`)::\n\n    >>> target_c = SkyCoord(ra=10*u.degree, dec=9*u.degree, frame='icrs')\n    >>> # read in coordinates from a catalog...\n    >>> catalog_c = ... # doctest: +SKIP\n    >>> idx, sep, _ = target_c.match_to_catalog_sky(catalog_c) # doctest: +SKIP\n\n..\n  EXAMPLE END\n\nThe `astropy.coordinates` sub-package also provides a quick way to get\ncoordinates for named objects, assuming you have an active internet\nconnection. The `~astropy.coordinates.SkyCoord.from_name` method of |SkyCoord|\nuses `Sesame <http://cds.u-strasbg.fr/cgi-bin/Sesame>`_ to retrieve coordinates\nfor a particular named object.\n\n..\n  EXAMPLE START\n  Retrieving Coordinates for a Named Object with SkyCoord\n\nTo retrieve coordinates for a particular named object::\n\n    >>> SkyCoord.from_name(\"PSR J1012+5307\")  # doctest: +REMOTE_DATA +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        (153.1393271, 53.117343)>\n\nIn some cases, the coordinates are embedded in the catalog name of the object.\nFor such object names, `~astropy.coordinates.SkyCoord.from_name` is able\nto parse the coordinates from the name if given the ``parse=True`` option.\nFor slow connections, this may be much faster than a sesame query for the same\nobject name. It's worth noting, however, that the coordinates extracted in this\nway may differ from the database coordinates by a few deci-arcseconds, so only\nuse this option if you do not need sub-arcsecond accuracy for your coordinates::\n\n    >>> SkyCoord.from_name(\"CRTS SSS100805 J194428-420209\", parse=True)  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        (296.11666667, -42.03583333)>\n\n..\n  EXAMPLE END\n\n.. testsetup::\n\n    >>> from astropy.coordinates import EarthLocation, SkyCoord\n    >>> apo = EarthLocation(-1463969.30185172, -5166673.34223433, 3434985.71204565, unit='m')\n    >>> keck = EarthLocation(-5464487.81759887, -2492806.59108569, 2151240.19451846, unit='m')\n    >>> target = SkyCoord(10.68470833, 41.26875, unit='deg')  # M31\n\nFor sites (primarily observatories) on the Earth, `astropy.coordinates` provides\na quick way to get an `~astropy.coordinates.EarthLocation` - the\n`~astropy.coordinates.EarthLocation.of_site` method::\n\n    >>> from astropy.coordinates import EarthLocation\n    >>> apo = EarthLocation.of_site('Apache Point Observatory')  # doctest: +SKIP\n    >>> apo  # doctest: +FLOAT_CMP\n    <EarthLocation (-1463969.30185172, -5166673.34223433, 3434985.71204565) m>\n\nTo see the list of site names available, use\n:func:`astropy.coordinates.EarthLocation.get_site_names`.\n\nFor arbitrary Earth addresses (e.g., not observatory sites), use the\n`~astropy.coordinates.EarthLocation.of_address` classmethod. Any address passed\nto this function uses Google maps to retrieve the latitude and longitude and can\nalso (optionally) query Google maps to get the height of the location. As with\nGoogle maps, this works with fully specified addresses, location names, city\nnames, etc.:\n\n.. doctest-skip::\n\n    >>> EarthLocation.of_address('1002 Holy Grail Court, St. Louis, MO')\n    <EarthLocation (-26726.98216371, -4997009.8604809, 3950271.16507911) m>\n    >>> EarthLocation.of_address('1002 Holy Grail Court, St. Louis, MO',\n    ...                          get_height=True)\n    <EarthLocation (-26727.6272786, -4997130.47437768, 3950367.15622108) m>\n    >>> EarthLocation.of_address('Danbury, CT')\n    <EarthLocation ( 1364606.64511651, -4593292.9428273,  4195415.93695139) m>\n\n.. note::\n    `~astropy.coordinates.SkyCoord.from_name`,\n    `~astropy.coordinates.EarthLocation.of_site`, and\n    `~astropy.coordinates.EarthLocation.of_address` are for convenience, and\n    hence are by design relatively low precision. If you need more precise coordinates for an\n    object you should find the appropriate reference and input the coordinates\n    manually, or use more specialized functionality like that in the `astroquery\n    <http://www.astropy.org/astroquery/>`_ or `astroplan\n    <https://astroplan.readthedocs.io/>`_ affiliated packages.\n\n    Also note that these methods retrieve data from the internet to\n    determine the celestial or Earth coordinates. The online data may be\n    updated, so if you need to guarantee that your scripts are reproducible\n    in the long term, see the :doc:`remote_methods` section.\n\nThis functionality can be combined to do more complicated tasks like computing\nbarycentric corrections to radial velocity observations (also a supported\nhigh-level |SkyCoord| method - see :ref:`astropy-coordinates-rv-corrs`)::\n\n    >>> from astropy.time import Time\n    >>> obstime = Time('2017-2-14')\n    >>> target = SkyCoord.from_name('M31')  # doctest: +SKIP\n    >>> keck = EarthLocation.of_site('Keck')  # doctest: +SKIP\n    >>> target.radial_velocity_correction(obstime=obstime, location=keck).to('km/s')  # doctest: +FLOAT_CMP  +REMOTE_DATA\n    <Quantity -22.359784554780255 km / s>\n\nWhile ``astropy.coordinates`` does not natively support converting an Earth\nlocation to a timezone, the longitude and latitude can be retrieved from any\n`~astropy.coordinates.EarthLocation` object, which could then be passed to any\nthird-party package that supports timezone solving, such as `timezonefinder\n<https://timezonefinder.readthedocs.io/>`_. For example, ``timezonefinder`` can\nbe used to retrieve the timezone name for an address with:\n\n.. doctest-skip::\n\n    >>> loc = EarthLocation.of_address('Tucson, AZ')\n    >>> from timezonefinder import TimezoneFinder\n    >>> tz_name = TimezoneFinder().timezone_at(lng=loc.lon.degree,\n    ...                                        lat=loc.lat.degree)\n    >>> tz_name\n    'America/Phoenix'\n\nThe resulting timezone name could then be used with any packages that support\ntime zone definitions, such as the (Python 3.9 default package) `zoneinfo\n<https://docs.python.org/3/library/zoneinfo.html>`_:\n\n.. doctest-skip::\n\n    >>> from zoneinfo import ZoneInfo  # requires Python 3.9 or greater\n    >>> tz = ZoneInfo(tz_name)\n    >>> dt = datetime.datetime(2021, 4, 12, 20, 0, 0, tzinfo=tz)\n\n(Please note that the above code is not tested regularly with the ``astropy`` test\nsuite, so please raise an issue if this no longer works.)\n\nVelocities (Proper Motions and Radial Velocities)\n-------------------------------------------------\n\nIn addition to positional coordinates, `~astropy.coordinates` supports storing\nand transforming velocities. These are available both via the lower-level\n:doc:`coordinate frame classes <frames>`, and via |SkyCoord| objects::\n\n    >>> sc = SkyCoord(1*u.deg, 2*u.deg, radial_velocity=20*u.km/u.s)\n    >>> sc  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        (1., 2.)\n     (radial_velocity) in km / s\n        (20.,)>\n\nFor more details on velocity support (and limitations), see the\n:doc:`velocities` page.\n\n.. _astropy-coordinates-overview:\n\nOverview of `astropy.coordinates` Concepts\n==========================================\n\n.. note ::\n    More detailed information and justification of the design is available in\n    `APE (Astropy Proposal for Enhancement) 5\n    <https://github.com/astropy/astropy-APEs/blob/main/APE5.rst>`_.\n\nHere we provide an overview of the package and associated framework.\nThis background information is not necessary for using `~astropy.coordinates`,\nparticularly if you use the |SkyCoord| high-level class, but it is helpful for\nmore advanced usage, particularly creating your own frame, transformations, or\nrepresentations. Another useful piece of background information are some\n:ref:`astropy-coordinates-definitions` as they are used in\n`~astropy.coordinates`.\n\n`~astropy.coordinates` is built on a three-tiered system of objects:\nrepresentations, frames, and a high-level class. Representations\nclasses are a particular way of storing a three-dimensional data point\n(or points), such as Cartesian coordinates or spherical polar\ncoordinates. Frames are particular reference frames like FK5 or ICRS,\nwhich may store their data in different representations, but have well-\ndefined transformations between each other. These transformations are\nall stored in the ``astropy.coordinates.frame_transform_graph``, and new\ntransformations can be created by users. Finally, the high-level class\n(|SkyCoord|) uses the frame classes, but provides a more accessible\ninterface to these objects as well as various convenience methods and\nmore string-parsing capabilities.\n\nSeparating these concepts makes it easier to extend the functionality of\n`~astropy.coordinates`. It allows representations, frames, and\ntransformations to be defined or extended separately, while still\npreserving the high-level capabilities and ease-of-use of the |SkyCoord|\nclass.\n\n.. topic:: Examples:\n\n    See :ref:`sphx_glr_generated_examples_coordinates_plot_obs-planning.py` for\n    an example of using the `~astropy.coordinates` functionality to prepare for\n    an observing run.\n\nUsing `astropy.coordinates`\n===========================\n\nMore detailed information on using the package is provided on separate pages,\nlisted below.\n\n.. toctree::\n   :maxdepth: 1\n\n   angles\n   skycoord\n   transforming\n   solarsystem\n   satellites\n   formatting\n   matchsep\n   representations\n   frames\n   velocities\n   apply_space_motion\n   spectralcoord\n   galactocentric\n   remote_methods\n   common_errors\n   definitions\n   inplace\n\n\nIn addition, another resource for the capabilities of this package is the\n``astropy.coordinates.tests.test_api_ape5`` testing file. It showcases most of\nthe major capabilities of the package, and hence is a useful supplement to\nthis document. You can see it by either downloading a copy of the Astropy\nsource code, or typing the following in an IPython session::\n\n    In [1]: from astropy.coordinates.tests import test_api_ape5\n    In [2]: test_api_ape5??\n\n\n.. note that if this section gets too long, it should be moved to a separate\n   doc page - see the top of performance.inc.rst for the instructions on how to\n   do that\n.. include:: performance.inc.rst\n\n.. _astropy-coordinates-seealso:\n\nSee Also\n========\n\nSome references that are particularly useful in understanding subtleties of the\ncoordinate systems implemented here include:\n\n* `USNO Circular 179 <https://arxiv.org/abs/astro-ph/0602086>`_\n    A useful guide to the IAU 2000/2003 work surrounding ICRS/IERS/CIRS and\n    related problems in precision coordinate system work.\n* `Standards Of Fundamental Astronomy <http://www.iausofa.org/>`_\n    The definitive implementation of IAU-defined algorithms. The \"SOFA Tools\n    for Earth Attitude\" document is particularly valuable for understanding\n    the latest IAU standards in detail.\n* `IERS Conventions (2010) <https://www.iers.org/IERS/EN/Publications/TechnicalNotes/tn36.html>`_\n    An exhaustive reference covering the ITRS, the IAU2000 celestial coordinates\n    framework, and other related details of modern coordinate conventions.\n* Meeus, J. \"Astronomical Algorithms\"\n    A valuable text describing details of a wide range of coordinate-related\n    problems and concepts.\n* `Revisiting Spacetrack Report #3 <https://celestrak.com/publications/AIAA/2006-6753/AIAA-2006-6753-Rev2.pdf>`_\n    A discussion of the simplified general perturbation (SGP) for satellite orbits, with a description of\n    the True Equator Mean Equinox (TEME) coordinate frame.\n\n\nBuilt-in Frame Classes\n======================\n\n.. automodapi:: astropy.coordinates.builtin_frames\n    :skip: make_transform_graph_docs\n    :no-inheritance-diagram:\n\n\n.. _astropy-coordinates-api:\n\nReference/API\n=============\n\n.. automodapi:: astropy.coordinates\n"},{"id":508,"name":"angles.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. _working_with_angles:\n\nWorking with Angles\n*******************\n\nThe angular components of the various coordinate objects are represented\nby objects of the |Angle| class. While most likely to be encountered in\nthe context of coordinate objects, |Angle| objects can also be used on\ntheir own wherever a representation of an angle is needed.\n\n.. _angle-creation:\n\nCreation\n========\n\nThe creation of an |Angle| object is quite flexible and supports a wide\nvariety of input object types and formats. The type of the input angle(s)\ncan be array, scalar, tuple, string, `~astropy.units.Quantity` or another\n|Angle|. This is best illustrated with a number of examples of valid ways\nto create an |Angle|.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Different Ways to Create an Angle Object\n\nThere are a number of ways to create an |Angle|::\n\n    >>> import numpy as np\n    >>> from astropy import units as u\n    >>> from astropy.coordinates import Angle\n\n    >>> Angle('10.2345d')              # String with 'd' abbreviation for degrees  # doctest: +FLOAT_CMP\n    <Angle 10.2345 deg>\n    >>> Angle(['10.2345d', '-20d'])    # Array of strings  # doctest: +FLOAT_CMP\n    <Angle [ 10.2345, -20.    ] deg>\n    >>> Angle('1:2:30.43 degrees')     # Sexagesimal degrees  # doctest: +FLOAT_CMP\n    <Angle 1.04178611 deg>\n    >>> Angle('1 2 0 hours')           # Sexagesimal hours  # doctest: +FLOAT_CMP\n    <Angle 1.03333333 hourangle>\n    >>> Angle(np.arange(1., 8.), unit=u.deg)  # Numpy array from 1..7 in degrees  # doctest: +FLOAT_CMP\n    <Angle [1., 2., 3., 4., 5., 6., 7.] deg>\n    >>> Angle('1°2′3″')               # Unicode degree, arcmin and arcsec symbols  # doctest: +FLOAT_CMP\n    <Angle 1.03416667 deg>\n    >>> Angle('1°2′3″N')               # Unicode degree, arcmin, arcsec symbols and direction  # doctest: +FLOAT_CMP\n    <Angle 1.03416667 deg>\n    >>> Angle('1d2m3.4s')              # Degree, arcmin, arcsec.  # doctest: +FLOAT_CMP\n    <Angle 1.03427778 deg>\n    >>> Angle('1d2m3.4sS')              # Degree, arcmin, arcsec, direction.  # doctest: +FLOAT_CMP\n    <Angle -1.03427778 deg>\n    >>> Angle('-1h2m3s')               # Hour, minute, second  # doctest: +FLOAT_CMP\n    <Angle -1.03416667 hourangle>\n    >>> Angle('-1h2m3sW')               # Hour, minute, second, direction  # doctest: +FLOAT_CMP\n    <Angle 1.03416667 hourangle>\n    >>> Angle((-1, 2, 3), unit=u.deg)  # (degree, arcmin, arcsec)  # doctest: +FLOAT_CMP\n    <Angle -1.03416667 deg>\n    >>> Angle(10.2345 * u.deg)         # From a Quantity object in degrees  # doctest: +FLOAT_CMP\n    <Angle 10.2345 deg>\n    >>> Angle(Angle(10.2345 * u.deg))  # From another Angle object  # doctest: +FLOAT_CMP\n    <Angle 10.2345 deg>\n\n..\n  EXAMPLE END\n\nRepresentation\n==============\n\nThe |Angle| object also supports a variety of ways of representing the value\nof the angle, both as a floating point number and as a string.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Representation of Angle Object Values\n\nThere are many ways to represent the value of an |Angle|::\n\n    >>> a = Angle(1, u.radian)\n    >>> a  # doctest: +FLOAT_CMP\n    <Angle 1. rad>\n    >>> a.radian\n    1.0\n    >>> a.degree  # doctest: +FLOAT_CMP\n    57.29577951308232\n    >>> a.hour  # doctest: +FLOAT_CMP\n    3.8197186342054885\n    >>> a.hms  # doctest: +FLOAT_CMP\n    hms_tuple(h=3.0, m=49.0, s=10.987083139758766)\n    >>> a.dms  # doctest: +FLOAT_CMP\n    dms_tuple(d=57.0, m=17.0, s=44.806247096362313)\n    >>> a.signed_dms  # doctest: +FLOAT_CMP\n    signed_dms_tuple(sign=1.0, d=57.0, m=17.0, s=44.806247096362313)\n    >>> (-a).dms  # doctest: +FLOAT_CMP\n    dms_tuple(d=-57.0, m=-17.0, s=-44.806247096362313)\n    >>> (-a).signed_dms  # doctest: +FLOAT_CMP\n    signed_dms_tuple(sign=-1.0, d=57.0, m=17.0, s=44.806247096362313)\n    >>> a.arcminute  # doctest: +FLOAT_CMP\n    3437.7467707849396\n    >>> a.to_string()\n    '1rad'\n    >>> a.to_string(unit=u.degree)\n    '57d17m44.8062471s'\n    >>> a.to_string(unit=u.degree, sep=':')\n    '57:17:44.8062471'\n    >>> a.to_string(unit=u.degree, sep=('deg', 'm', 's'))\n    '57deg17m44.8062471s'\n    >>> a.to_string(unit=u.hour)\n    '3h49m10.98708314s'\n    >>> a.to_string(unit=u.hour, decimal=True)\n    '3.81972'\n\n..\n  EXAMPLE END\n\nUsage\n=====\n\nAngles will also behave correctly for appropriate arithmetic operations.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Arithmetic Operations Using Angle Objects\n\nTo use |Angle| objects in arithmetic operations::\n\n    >>> a = Angle(1.0, u.radian)\n    >>> a + 0.5 * u.radian + 2 * a  # doctest: +FLOAT_CMP\n    <Angle 3.5 rad>\n    >>> np.sin(a / 2)  # doctest: +FLOAT_CMP\n    <Quantity 0.47942554>\n    >>> a == a  # doctest: +SKIP\n    array(True, dtype=bool)\n    >>> a == (a + a)    # doctest: +SKIP\n    array(False, dtype=bool)\n\n..\n  EXAMPLE END\n\n|Angle| objects can also be used for creating coordinate objects.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Creating Coordinate Objects with Angle Objects\n\nTo create a coordinate object using an |Angle|::\n\n    >>> from astropy.coordinates import ICRS\n    >>> ICRS(Angle(1, u.deg), Angle(0.5, u.deg))  # doctest: +FLOAT_CMP\n    <ICRS Coordinate: (ra, dec) in deg\n        (1., 0.5)>\n\n..\n  EXAMPLE END\n\nWrapping and Bounds\n===================\n\nThere are two utility methods for working with angles that should have bounds.\nThe :meth:`~astropy.coordinates.Angle.wrap_at` method allows taking an angle or\nangles and wrapping to be within a single 360 degree slice. The\n:meth:`~astropy.coordinates.Angle.is_within_bounds` method returns a\nboolean indicating whether an angle or angles is within the specified bounds.\n\n\nLongitude and Latitude Objects\n==============================\n\n|Longitude| and |Latitude| are two specialized subclasses of the |Angle|\nclass that are used for all of the spherical coordinate classes.\n|Longitude| is used to represent values like right ascension, Galactic\nlongitude, and azimuth (for Equatorial, Galactic, and Alt-Az coordinates,\nrespectively). |Latitude| is used for declination, Galactic latitude, and\nelevation.\n\nLongitude\n---------\n\nA |Longitude| object is distinguished from a pure |Angle| by virtue of a\n``wrap_angle`` property. The ``wrap_angle`` specifies that all angle values\nrepresented by the object will be in the range::\n\n  wrap_angle - 360 * u.deg <= angle(s) < wrap_angle\n\nThe default ``wrap_angle`` is 360 deg. Setting ``'wrap_angle=180 * u.deg'``\nwould instead result in values between -180 and +180 deg. Setting the\n``wrap_angle`` attribute of an existing ``Longitude`` object will result in\nre-wrapping the angle values in-place. For example::\n\n    >>> from astropy.coordinates import Longitude\n    >>> a = Longitude([-20, 150, 350, 360] * u.deg)\n    >>> a.degree  # doctest: +FLOAT_CMP\n    array([340., 150., 350.,   0.])\n    >>> a.wrap_angle = 180 * u.deg\n    >>> a.degree  # doctest: +FLOAT_CMP\n    array([-20., 150., -10.,   0.])\n\nLatitude\n--------\n\nA Latitude object is distinguished from a pure |Angle| by virtue\nof being bounded so that::\n\n  -90.0 * u.deg <= angle(s) <= +90.0 * u.deg\n\nAny attempt to set a value outside of that range will result in a\n`ValueError`.\n\n\nGenerating Angle Values\n=======================\n\nAstropy provides utility functions for generating angular or spherical\npositions, either with random sampling or with a grid of values. These functions\nall return `~astropy.coordinates.BaseRepresentation` subclass instances, which\ncan be passed directly into coordinate frame classes or |SkyCoord| to create\nrandom or gridded coordinate objects.\n\n\nWith Random Sampling\n--------------------\n\nThese functions both use standard, random `spherical point picking\n<https://mathworld.wolfram.com/SpherePointPicking.html>`_ to generate angular\npositions that are uniformly distributed on the surface of the unit sphere. To\nretrieve angular values only, use\n`~astropy.coordinates.uniform_spherical_random_surface`. For\nexample, to generate 4 random angular positions::\n\n    >>> from astropy.coordinates import uniform_spherical_random_surface\n    >>> pts = uniform_spherical_random_surface(size=4)\n    >>> pts  # doctest: +SKIP\n    <UnitSphericalRepresentation (lon, lat) in rad\n        [(0.52561028, 0.38712031), (0.29900285, 0.52776066),\n         (0.98199282, 0.34247723), (2.15260367, 1.01499232)]>\n\nTo generate three-dimensional positions uniformly within a spherical volume set\nby a maximum radius, instead use the\n`~astropy.coordinates.uniform_spherical_random_volume`\nfunction. For example, to generate 4 random 3D positions::\n\n    >>> from astropy.coordinates import uniform_spherical_random_volume\n    >>> pts_3d = uniform_spherical_random_volume(size=4)\n    >>> pts_3d  # doctest: +SKIP\n    <SphericalRepresentation (lon, lat, distance) in (rad, rad, )\n        [(4.98504602, -0.74247419, 0.39752416),\n         (5.53281607,  0.89425191, 0.7391255 ),\n         (0.88100456,  0.21080555, 0.5531785 ),\n         (6.00879324,  0.61547168, 0.61746148)]>\n\nBy default, the distance values returned are uniformly distributed within the\nunit sphere (i.e., the distance values are dimensionless). To instead generate\nrandom points within a sphere of a given dimensional radius, for example, 1\nparsec, pass in a |Quantity| object with the ``max_radius`` argument::\n\n    >>> import astropy.units as u\n    >>> pts_3d = uniform_spherical_random_volume(size=4, max_radius=2*u.pc)\n    >>> pts_3d  # doctest: +SKIP\n    <SphericalRepresentation (lon, lat, distance) in (rad, rad, pc)\n        [(3.36590297, -0.23085809, 1.47210093),\n         (6.14591179,  0.06840621, 0.9325143 ),\n         (2.19194797,  0.55099774, 1.19294064),\n         (5.25689272, -1.17703409, 1.63773358)]>\n\n\nOn a Grid\n---------\n\nNo grid or lattice of points on the sphere can produce equal spacing between all\ngrid points, but many approximate algorithms exist for generating angular grids\nwith nearly even spacing (for example, `see this page\n<https://bendwavy.org/pack/pack.htm>`_).\n\nOne simple and popular method in this context is the `golden spiral method\n<https://stackoverflow.com/a/44164075>`_, which is available in\n`astropy.coordinates` through the utility function\n`~astropy.coordinates.golden_spiral_grid`. This function accepts\na single argument, ``size``, which specifies the number of points to generate in\nthe grid::\n\n    >>> from astropy.coordinates import golden_spiral_grid\n    >>> golden_pts = golden_spiral_grid(size=32)\n    >>> golden_pts  # doctest: +FLOAT_CMP\n    <UnitSphericalRepresentation (lon, lat) in rad\n        [(1.94161104,  1.32014066), (5.82483312,  1.1343273 ),\n         (3.42486989,  1.004232  ), (1.02490666,  0.89666582),\n         (4.90812873,  0.80200278), (2.5081655 ,  0.71583806),\n         (0.10820227,  0.63571129), (3.99142435,  0.56007531),\n         (1.59146112,  0.48787515), (5.4746832 ,  0.41834639),\n         (3.07471997,  0.35090734), (0.67475674,  0.28509644),\n         (4.55797882,  0.22053326), (2.15801559,  0.15689287),\n         (6.04123767,  0.09388788), (3.64127444,  0.03125509),\n         (1.24131121, -0.03125509), (5.12453328, -0.09388788),\n         (2.72457005, -0.15689287), (0.32460682, -0.22053326),\n         (4.2078289 , -0.28509644), (1.80786567, -0.35090734),\n         (5.69108775, -0.41834639), (3.29112452, -0.48787515),\n         (0.89116129, -0.56007531), (4.77438337, -0.63571129),\n         (2.37442014, -0.71583806), (6.25764222, -0.80200278),\n         (3.85767899, -0.89666582), (1.45771576, -1.004232  ),\n         (5.34093783, -1.1343273 ), (2.9409746 , -1.32014066)]>\n\n\n\n\nComparing Spherical Point Generation Methods\n--------------------------------------------\n\n.. plot::\n    :align: center\n    :context: close-figs\n\n    import matplotlib.pyplot as plt\n    from astropy.coordinates import uniform_spherical_random_surface, golden_spiral_grid\n\n    fig, axes = plt.subplots(1, 2, figsize=(10, 6),\n                             subplot_kw=dict(projection='3d'),\n                             constrained_layout=True)\n\n    for func, ax in zip([uniform_spherical_random_surface,\n                         golden_spiral_grid], axes):\n        pts = func(size=128)\n\n        xyz = pts.to_cartesian().xyz\n        ax.plot(*xyz, ls='none')\n\n        ax.set(xlim=(-1, 1),\n            ylim=(-1, 1),\n            zlim=(-1, 1),\n            xlabel='$x$',\n            ylabel='$y$',\n            zlabel='$z$')\n        ax.set_title(func.__name__, fontsize=14)\n\n    fig.suptitle('128 points', fontsize=18)\n"},{"col":4,"comment":"\n        Create a `distortion paper`_ type lookup table for detector to\n        image plane correction.\n        ","endLoc":856,"header":"def _read_det2im_kw(self, header, fobj, err=0.0)","id":509,"name":"_read_det2im_kw","nodeType":"Function","startLoc":791,"text":"def _read_det2im_kw(self, header, fobj, err=0.0):\n        \"\"\"\n        Create a `distortion paper`_ type lookup table for detector to\n        image plane correction.\n        \"\"\"\n        if fobj is None:\n            return (None, None)\n\n        if not isinstance(fobj, fits.HDUList):\n            return (None, None)\n\n        try:\n            axiscorr = header['AXISCORR']\n            d2imdis = self._read_d2im_old_format(header, fobj, axiscorr)\n            return d2imdis\n        except KeyError:\n            pass\n\n        dist = 'D2IMDIS'\n        d_kw = 'D2IM'\n        err_kw = 'D2IMERR'\n        tables = {}\n        for i in range(1, self.naxis + 1):\n            d_error = header.get(err_kw + str(i), 0.0)\n            if d_error < err:\n                tables[i] = None\n                continue\n            distortion = dist + str(i)\n            if distortion in header:\n                dis = header[distortion].lower()\n                if dis == 'lookup':\n                    del header[distortion]\n                    assert isinstance(fobj, fits.HDUList), (\n                        'An astropy.io.fits.HDUList'\n                        'is required for Lookup table distortion.')\n                    dp = (d_kw + str(i)).strip()\n                    dp_extver_key = dp + '.EXTVER'\n                    if dp_extver_key in header:\n                        d_extver = header[dp_extver_key]\n                        del header[dp_extver_key]\n                    else:\n                        d_extver = 1\n                    dp_axis_key = dp + f'.AXIS.{i:d}'\n                    if i == header[dp_axis_key]:\n                        d_data = fobj['D2IMARR', d_extver].data\n                    else:\n                        d_data = (fobj['D2IMARR', d_extver].data).transpose()\n                    del header[dp_axis_key]\n                    d_header = fobj['D2IMARR', d_extver].header\n                    d_crpix = (d_header.get('CRPIX1', 0.0), d_header.get('CRPIX2', 0.0))\n                    d_crval = (d_header.get('CRVAL1', 0.0), d_header.get('CRVAL2', 0.0))\n                    d_cdelt = (d_header.get('CDELT1', 1.0), d_header.get('CDELT2', 1.0))\n                    d_lookup = DistortionLookupTable(d_data, d_crpix,\n                                                     d_crval, d_cdelt)\n                    tables[i] = d_lookup\n                else:\n                    warnings.warn('Polynomial distortion is not implemented.\\n', AstropyUserWarning)\n                for key in set(header):\n                    if key.startswith(dp + '.'):\n                        del header[key]\n            else:\n                tables[i] = None\n        if not tables:\n            return (None, None)\n        else:\n            return (tables.get(1), tables.get(2))"},{"id":510,"name":"performance.inc.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. note that if this is changed from the default approach of using an *include*\n   (in index.rst) to a separate performance page, the header needs to be changed\n   from === to ***, the filename extension needs to be changed from .inc.rst to\n   .rst, and a link needs to be added in the subpackage toctree\n\n.. _astropy-coordinates-performance:\n\nPerformance Tips\n================\n\nIf you are using |SkyCoord| for many different coordinates, you will see much\nbetter performance if you create a single |SkyCoord| with arrays of coordinates\nas opposed to creating individual |SkyCoord| objects for each individual\ncoordinate::\n\n    >>> coord = SkyCoord(ra_array, dec_array, unit='deg')  # doctest: +SKIP\n\nIn addition, looping over a |SkyCoord| object can be slow. If you need to\ntransform the coordinates to a different frame, it is much faster to transform a\nsingle |SkyCoord| with arrays of values as opposed to looping over the\n|SkyCoord| and transforming them individually.\n\nFinally, for more advanced users, note that you can use broadcasting to\ntransform |SkyCoord| objects into frames with vector properties.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Performance Tips for Transforming SkyCoord Objects\n\nTo use broadcasting to transform |SkyCoord| objects into frames with vector\nproperties::\n\n    >>> from astropy.coordinates import SkyCoord, EarthLocation\n    >>> from astropy import coordinates as coord\n    >>> from astropy.coordinates.angle_utilities import golden_spiral_grid\n    >>> from astropy.time import Time\n    >>> from astropy import units as u\n    >>> import numpy as np\n\n    >>> # 1000 locations in a grid on the sky\n    >>> coos = SkyCoord(golden_spiral_grid(size=1000))\n\n    >>> # 300 times over the space of 10 hours\n    >>> times = Time.now() + np.linspace(-5, 5, 300)*u.hour\n\n    >>> # note the use of broadcasting so that 300 times are broadcast against 1000 positions\n    >>> lapalma = EarthLocation.from_geocentric(5327448.9957829, -1718665.73869569, 3051566.90295403, unit='m')\n    >>> aa_frame = coord.AltAz(obstime=times[:, np.newaxis], location=lapalma)\n\n    >>> # calculate alt-az of each object at each time.\n    >>> aa_coos = coos.transform_to(aa_frame)  # doctest: +REMOTE_DATA +IGNORE_WARNINGS\n\n..\n  EXAMPLE END\n\n\nImproving Performance for Arrays of ``obstime``\n-----------------------------------------------\n\nThe most expensive operations when transforming between observer-dependent coordinate\nframes (e.g. ``AltAz``) and sky-fixed frames (e.g. ``ICRS``) are the calculation\nof the orientation and position of Earth.\n\nIf |SkyCoord| instances are transformed for a large  number of closely spaced ``obstime``,\nthese calculations can be sped up by factors up to 100, whilst still keeping micro-arcsecond precision,\nby utilizing interpolation instead of calculating Earth orientation parameters for each individual point.\n\n..\n  EXAMPLE START\n  Improving performance for obstime arrays\n\nTo use interpolation for the astrometric values in coordinate transformation, use::\n\n   >>> from astropy.coordinates import SkyCoord, EarthLocation, AltAz\n   >>> from astropy.coordinates.erfa_astrom import erfa_astrom, ErfaAstromInterpolator\n   >>> from astropy.time import Time\n   >>> from time import perf_counter\n   >>> import numpy as np\n   >>> import astropy.units as u\n\n\n   >>> # array with 10000 obstimes\n   >>> obstime = Time('2010-01-01T20:00') + np.linspace(0, 6, 10000) * u.hour\n   >>> location = location = EarthLocation(lon=-17.89 * u.deg, lat=28.76 * u.deg, height=2200 * u.m)\n   >>> frame = AltAz(obstime=obstime, location=location)\n   >>> crab = SkyCoord(ra='05h34m31.94s', dec='22d00m52.2s')\n\n   >>> # transform with default transformation and print duration\n   >>> t0 = perf_counter()\n   >>> crab_altaz = crab.transform_to(frame)  # doctest:+IGNORE_WARNINGS +REMOTE_DATA\n   >>> print(f'Transformation took {perf_counter() - t0:.2f} s')  # doctest:+IGNORE_OUTPUT\n   Transformation took 1.77 s\n\n   >>> # transform with interpolating astrometric values\n   >>> t0 = perf_counter()\n   >>> with erfa_astrom.set(ErfaAstromInterpolator(300 * u.s)): # doctest:+REMOTE_DATA\n   ...     crab_altaz_interpolated = crab.transform_to(frame)  # doctest:+IGNORE_WARNINGS +REMOTE_DATA\n   >>> print(f'Transformation took {perf_counter() - t0:.2f} s')  # doctest:+IGNORE_OUTPUT\n   Transformation took 0.03 s\n\n   >>> err = crab_altaz.separation(crab_altaz_interpolated)  # doctest:+IGNORE_WARNINGS +REMOTE_DATA\n   >>> print(f'Mean error of interpolation: {err.to(u.microarcsecond).mean():.4f}')  # doctest:+ELLIPSIS +REMOTE_DATA\n   Mean error of interpolation: 0.0... uarcsec\n\n   >>> # To set erfa_astrom for a whole session, use it without context manager:\n   >>> erfa_astrom.set(ErfaAstromInterpolator(300 * u.s))  # doctest:+SKIP\n\n..\n  EXAMPLE END\n\n\nHere, we look into choosing an appropriate ``time_resolution``.\nWe will transform a single sky coordinate for lots of observation times from\n``ICRS`` to ``AltAz`` and evaluate precision and runtime for different values\nfor ``time_resolution`` compared to the non-interpolating, default approach.\n\n.. plot::\n   :include-source:\n   :context: reset\n\n    from time import perf_counter\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    from astropy.coordinates.erfa_astrom import erfa_astrom, ErfaAstromInterpolator\n    from astropy.coordinates import SkyCoord, EarthLocation, AltAz\n    from astropy.time import Time\n    import astropy.units as u\n\n    np.random.seed(1337)\n\n    # 100_000 times randomly distributed over 12 hours\n    t = Time('2020-01-01T20:00:00') + np.random.uniform(0, 1, 10_000) * u.hour\n\n    location = location = EarthLocation(\n        lon=-17.89 * u.deg, lat=28.76 * u.deg, height=2200 * u.m\n    )\n\n    # A celestial object in ICRS\n    crab = SkyCoord.from_name(\"Crab Nebula\")\n\n    # target horizontal coordinate frame\n    altaz = AltAz(obstime=t, location=location)\n\n\n    # the reference transform using no interpolation\n    t0 = perf_counter()\n    no_interp = crab.transform_to(altaz)\n    reference = perf_counter() - t0\n    print(f'No Interpolation took {reference:.4f} s')\n\n\n    # now the interpolating approach for different time resolutions\n    resolutions = 10.0**np.arange(-1, 5) * u.s\n    times = []\n    seps = []\n\n    for resolution in resolutions:\n        with erfa_astrom.set(ErfaAstromInterpolator(resolution)):\n            t0 = perf_counter()\n            interp = crab.transform_to(altaz)\n            duration = perf_counter() - t0\n\n        print(\n            f'Interpolation with {resolution.value: 9.1f} {str(resolution.unit)}'\n            f' resolution took {duration:.4f} s'\n            f' ({reference / duration:5.1f}x faster) '\n        )\n        seps.append(no_interp.separation(interp))\n        times.append(duration)\n\n    seps = u.Quantity(seps)\n\n    fig = plt.figure()\n\n    ax1, ax2 = fig.subplots(2, 1, gridspec_kw={'height_ratios': [2, 1]}, sharex=True)\n\n    ax1.plot(\n        resolutions.to_value(u.s),\n        seps.mean(axis=1).to_value(u.microarcsecond),\n        'o', label='mean',\n    )\n\n    for p in [25, 50, 75, 95]:\n        ax1.plot(\n            resolutions.to_value(u.s),\n            np.percentile(seps.to_value(u.microarcsecond), p, axis=1),\n            'o', label=f'{p}%', color='C1', alpha=p / 100,\n        )\n\n    ax1.set_title('Transformation of SkyCoord with 100.000 obstimes over 12 hours')\n\n    ax1.legend()\n    ax1.set_xscale('log')\n    ax1.set_yscale('log')\n    ax1.set_ylabel('Angular distance to no interpolation / µas')\n\n    ax2.plot(resolutions.to_value(u.s), reference / np.array(times), 's')\n    ax2.set_yscale('log')\n    ax2.set_ylabel('Speedup')\n    ax2.set_xlabel('time resolution / s')\n\n    ax2.yaxis.grid()\n    fig.tight_layout()\n"},{"col":0,"comment":"\n    Get a formatter by name.\n\n    Parameters\n    ----------\n    format : str or `astropy.units.format.Base` instance or subclass\n        The name of the format, or the format instance or subclass\n        itself.\n\n    Returns\n    -------\n    format : `astropy.units.format.Base` instance\n        The requested formatter.\n    ","endLoc":69,"header":"def get_format(format=None)","id":511,"name":"get_format","nodeType":"Function","startLoc":39,"text":"def get_format(format=None):\n    \"\"\"\n    Get a formatter by name.\n\n    Parameters\n    ----------\n    format : str or `astropy.units.format.Base` instance or subclass\n        The name of the format, or the format instance or subclass\n        itself.\n\n    Returns\n    -------\n    format : `astropy.units.format.Base` instance\n        The requested formatter.\n    \"\"\"\n    if format is None:\n        return Generic\n\n    if isinstance(format, type) and issubclass(format, Base):\n        return format\n    elif not (isinstance(format, str) or format is None):\n        raise TypeError(\n            f\"Formatter must a subclass or instance of a subclass of {Base!r} \"\n            f\"or a string giving the name of the formatter. {_known_formats()}.\")\n\n    format_lower = format.lower()\n\n    if format_lower in Base.registry:\n        return Base.registry[format_lower]\n\n    raise ValueError(f\"Unknown format {format!r}.  {_known_formats()}\")"},{"id":512,"name":"galactocentric.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. _coordinates-galactocentric:\n\n**************************************************\nDescription of the Galactocentric Coordinate Frame\n**************************************************\n\nWhile many other frames implemented in `astropy.coordinates` are standardized in\nsome way (e.g., defined by the IAU), there is no standard Milky Way\nreference frame with the center of the Milky Way as its origin. (This is\ndistinct from `~astropy.coordinates.Galactic` coordinates, which point\ntoward the Galactic Center but have their origin in the Solar System).\nThe `~astropy.coordinates.Galactocentric` frame\nclass is meant to be flexible enough to support all common definitions of such a\ntransformation, but with reasonable default parameter values, such as the solar\nvelocity relative to the Galactic center, the solar height above the Galactic\nmidplane, etc. Below, :ref:`we describe our generalized definition of the\ntransformation <astropy-coordinates-galactocentric-transformation>` from the\nICRS to/from Galactocentric coordinates, and :ref:`describe how to customize the\ndefault Galactocentric parameters\n<astropy-coordinates-galactocentric-defaults>` that are used when the\n`~astropy.coordinates.Galactocentric` frame is initialized without explicitly\npassing in parameter values.\n\n\n.. _astropy-coordinates-galactocentric-transformation:\n\nDefinition of the Transformation\n================================\n\nThis document describes the mathematics behind the transformation from\n`~astropy.coordinates.ICRS` to `~astropy.coordinates.Galactocentric`\ncoordinates. This is described in detail here on account of the mathematical\nsubtleties and the fact that there is no official standard/definition for this\nframe. For examples of how to use this transformation in code, see the\nthe *Examples* section of the `~astropy.coordinates.Galactocentric` class\ndocumentation.\n\nWe assume that we start with a 3D position in the ICRS reference frame:\na Right Ascension, Declination, and heliocentric distance,\n:math:`(\\alpha, \\delta, d)`. We can convert this to a Cartesian position using\nthe standard transformation from Cartesian to spherical coordinates:\n\n.. math::\n\n   \\begin{aligned}\n       x_{\\rm icrs} &= d\\cos{\\alpha}\\cos{\\delta}\\\\\n       y_{\\rm icrs} &= d\\sin{\\alpha}\\cos{\\delta}\\\\\n       z_{\\rm icrs} &= d\\sin{\\delta}\\\\\n       \\boldsymbol{r}_{\\rm icrs} &= \\begin{pmatrix}\n         x_{\\rm icrs}\\\\\n         y_{\\rm icrs}\\\\\n         z_{\\rm icrs}\n       \\end{pmatrix}\\end{aligned}\n\nThe first transformation rotates the :math:`x_{\\rm icrs}` axis so that the new\n:math:`x'` axis points towards the Galactic Center (GC), specified by the ICRS\nposition :math:`(\\alpha_{\\rm GC}, \\delta_{\\rm GC})` (in the\n`~astropy.coordinates.Galactocentric` frame, this is controlled by the frame\nattribute ``galcen_coord``):\n\n.. math::\n\n   \\begin{aligned}\n       \\boldsymbol{R}_1 &= \\begin{bmatrix}\n         \\cos\\delta_{\\rm GC}& 0 & \\sin\\delta_{\\rm GC}\\\\\n         0 & 1 & 0 \\\\\n         -\\sin\\delta_{\\rm GC}& 0 & \\cos\\delta_{\\rm GC}\\end{bmatrix}\\\\\n       \\boldsymbol{R}_2 &=\n       \\begin{bmatrix}\n         \\cos\\alpha_{\\rm GC}& \\sin\\alpha_{\\rm GC}& 0\\\\\n         -\\sin\\alpha_{\\rm GC}& \\cos\\alpha_{\\rm GC}& 0\\\\\n         0 & 0 & 1\n       \\end{bmatrix}.\\end{aligned}\n\nThe transformation thus far has aligned the :math:`x'` axis with the\nvector pointing from the Sun to the GC, but the :math:`y'` and\n:math:`z'` axes point in arbitrary directions. We adopt the\norientation of the Galactic plane as the normal to the north pole of\nGalactic coordinates defined by the IAU\n(`Blaauw et. al. 1960 <https://ui.adsabs.harvard.edu/abs/1960MNRAS.121..164B>`_).\nThis extra “roll” angle, :math:`\\eta`, was measured by transforming a grid\nof points along :math:`l=0` to this interim frame and minimizing the square\nof their :math:`y'` positions. We find:\n\n.. math::\n\n   \\begin{aligned}\n       \\eta &= 58.5986320306^\\circ\\\\\n       \\boldsymbol{R}_3 &=\n       \\begin{bmatrix}\n         1 & 0 & 0\\\\\n         0 & \\cos\\eta & \\sin\\eta\\\\\n         0 & -\\sin\\eta & \\cos\\eta\n       \\end{bmatrix}\\end{aligned}\n\nThe full rotation matrix thus far is:\n\n.. math::\n\n   \\begin{gathered}\n       \\boldsymbol{R} = \\boldsymbol{R}_3 \\boldsymbol{R}_1 \\boldsymbol{R}_2 = \\\\\n       \\begin{bmatrix}\n         \\cos\\alpha_{\\rm GC}\\cos\\delta_{\\rm GC}& \\cos\\delta_{\\rm GC}\\sin\\alpha_{\\rm GC}& -\\sin\\delta_{\\rm GC}\\\\\n         \\cos\\alpha_{\\rm GC}\\sin\\delta_{\\rm GC}\\sin\\eta - \\sin\\alpha_{\\rm GC}\\cos\\eta & \\sin\\alpha_{\\rm GC}\\sin\\delta_{\\rm GC}\\sin\\eta + \\cos\\alpha_{\\rm GC}\\cos\\eta & \\cos\\delta_{\\rm GC}\\sin\\eta\\\\\n         \\cos\\alpha_{\\rm GC}\\sin\\delta_{\\rm GC}\\cos\\eta + \\sin\\alpha_{\\rm GC}\\sin\\eta & \\sin\\alpha_{\\rm GC}\\sin\\delta_{\\rm GC}\\cos\\eta - \\cos\\alpha_{\\rm GC}\\sin\\eta & \\cos\\delta_{\\rm GC}\\cos\\eta\n       \\end{bmatrix}\\end{gathered}\n\nWith the rotated position vector\n:math:`\\boldsymbol{R}\\boldsymbol{r}_{\\rm icrs}`, we can now subtract the\ndistance to the GC, :math:`d_{\\rm GC}`, which is purely along the\n:math:`x'` axis:\n\n.. math::\n\n   \\begin{aligned}\n       \\boldsymbol{r}' &= \\boldsymbol{R}\\boldsymbol{r}_{\\rm icrs} - d_{\\rm GC}\\hat{\\boldsymbol{x}}_{\\rm GC}.\\end{aligned}\n\nwhere :math:`\\hat{\\boldsymbol{x}}_{\\rm GC} = (1,0,0)^{\\mathsf{T}}`.\n\nThe final transformation accounts for the (specified) height of the Sun above\nthe Galactic midplane by rotating about the final :math:`y''` axis by\nthe angle :math:`\\theta= \\sin^{-1}(z_\\odot / d_{\\rm GC})`:\n\n.. math::\n\n   \\begin{aligned}\n       \\boldsymbol{H} &=\n       \\begin{bmatrix}\n         \\cos\\theta & 0 & \\sin\\theta\\\\\n         0 & 1 & 0\\\\\n         -\\sin\\theta & 0 & \\cos\\theta\n       \\end{bmatrix}\\end{aligned}\n\nwhere :math:`z_\\odot` is the measured height of the Sun above the\nmidplane.\n\nThe full transformation is then:\n\n.. math:: \\boldsymbol{r}_{\\rm GC} = \\boldsymbol{H} \\left( \\boldsymbol{R}\\boldsymbol{r}_{\\rm icrs} - d_{\\rm GC}\\hat{\\boldsymbol{x}}_{\\rm GC}\\right).\n\n.. topic:: Examples:\n\n    For an example of how to use the `~astropy.coordinates.Galactocentric`\n    frame, see\n    :ref:`sphx_glr_generated_examples_coordinates_plot_galactocentric-frame.py`.\n\n\n.. _astropy-coordinates-galactocentric-defaults:\n\nControlling the Default Frame Parameters\n========================================\n\nAll of the frame-defining parameters of the\n`~astropy.coordinates.Galactocentric` frame are customizable and can be set by\npassing arguments in to the `~astropy.coordinates.Galactocentric` initializer.\nHowever, it is often convenient to use the frame without having to pass in every\nparameter. Hence, the class comes with reasonable default values for these\nparameters, but more precise measurements of the solar position or motion in the\nGalaxy are constantly being made. The default values of the\n`~astropy.coordinates.Galactocentric` frame attributes will therefore be updated\nas necessary with subsequent releases of ``astropy``. We therefore provide a\nmechanism to globally or locally control the default parameter values used in\nthis frame through the `~astropy.coordinates.galactocentric_frame_defaults`\n`~astropy.utils.state.ScienceState` class.\n\nThe `~astropy.coordinates.galactocentric_frame_defaults` class controls the\ndefault parameter settings in `~astropy.coordinates.Galactocentric` by mapping a\nset of string names to particular choices of the parameter values. For an\nup-to-date list of valid names, see the docstring of\n`~astropy.coordinates.galactocentric_frame_defaults`, but these names are things\nlike ``'pre-v4.0'``, which sets the default parameter values to their original\ndefinition (i.e. pre-astropy-v4.0) values, and ``'v4.0'``, which sets the\ndefault parameter values to a more modern set of measurements as updated in\nAstropy version 4.0. Also, custom sets of measurements can be registered to\n`~astropy.coordinates.galactocentric_frame_defaults` and used like the\nbuilt-in options.\n\n`~astropy.coordinates.galactocentric_frame_defaults` also tracks the\nreferences (i.e. scientific papers that define the parameter values) for all\nparameter values, as well as any further specified metadata information.\n\nAs with other `~astropy.utils.state.ScienceState` subclasses, the\n`~astropy.coordinates.galactocentric_frame_defaults` class can be used to\nglobally set the frame defaults at runtime.\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Setting Galactocentric Coordinate Frame Defaults at Runtime\n\nThe default parameter values can be seen by initializing the\n`~astropy.coordinates.Galactocentric` frame with no arguments:\n\n::\n\n    >>> from astropy.coordinates import Galactocentric\n    >>> Galactocentric()\n    <Galactocentric Frame (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n        (266.4051, -28.936175)>, galcen_distance=8.122 kpc, galcen_v_sun=(12.9, 245.6, 7.78) km / s, z_sun=20.8 pc, roll=0.0 deg)>\n\nThese default values can be modified using this class::\n\n    >>> from astropy.coordinates import galactocentric_frame_defaults\n    >>> _ = galactocentric_frame_defaults.set('v4.0') # doctest: +SKIP\n    >>> Galactocentric() # doctest: +SKIP\n    <Galactocentric Frame (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n        (266.4051, -28.936175)>, galcen_distance=8.122 kpc, galcen_v_sun=(12.9, 245.6, 7.78) km / s, z_sun=20.8 pc, roll=0.0 deg)>\n    >>> _ = galactocentric_frame_defaults.set('pre-v4.0') # doctest: +SKIP\n    >>> Galactocentric() # doctest: +SKIP\n    <Galactocentric Frame (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n        (266.4051, -28.936175)>, galcen_distance=8.3 kpc, galcen_v_sun=(11.1, 232.24, 7.25) km / s, z_sun=27.0 pc, roll=0.0 deg)>\n\nThe default parameters can also be updated by using this class as a context\nmanager to change the default parameter values locally to a piece of your code::\n\n    >>> with galactocentric_frame_defaults.set('pre-v4.0'):\n    ...     print(Galactocentric()) # doctest: +FLOAT_CMP\n    <Galactocentric Frame (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n        (266.4051, -28.936175)>, galcen_distance=8.3 kpc, galcen_v_sun=(11.1, 232.24, 7.25) km / s, z_sun=27.0 pc, roll=0.0 deg)>\n\nAgain, changing the default parameter values will not affect frame\nattributes that are explicitly specified::\n\n    >>> import astropy.units as u\n    >>> with galactocentric_frame_defaults.set('pre-v4.0'):\n    ...     print(Galactocentric(galcen_distance=8.0*u.kpc)) # doctest: +FLOAT_CMP\n    <Galactocentric Frame (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n        (266.4051, -28.936175)>, galcen_distance=8.0 kpc, galcen_v_sun=(11.1, 232.24, 7.25) km / s, z_sun=27.0 pc, roll=0.0 deg)>\n\n\nAdditional parameter sets may be registered, for instance to use the Dehnen & Binney (1998) measurements of the solar motion. We can also add metadata, such as the 1-sigma errors::\n\n    >>> state = galactocentric_frame_defaults.get_from_registry(\"v4.0\")\n    >>> state[\"parameters\"][\"galcen_v_sun\"] = (10.00, 225.25, 7.17) * (u.km / u.s)\n    >>> state[\"references\"][\"galcen_v_sun\"] = \"http://www.adsabs.harvard.edu/full/1998MNRAS.298..387D\"\n    >>> state[\"error\"] = {\"galcen_v_sun\": (0.36, 0.62, 0.38) * (u.km / u.s)}\n    >>> galactocentric_frame_defaults.register(name=\"DB1998\", **state)\n\nJust as in the previous examples, the new parameter set can be get / set::\n\n    >>> state = galactocentric_frame_defaults.get_from_registry(\"DB1998\")\n    >>> print(state[\"error\"][\"galcen_v_sun\"])  # doctest: +FLOAT_CMP\n    [0.36 0.62 0.38] km / s\n\n..\n  EXAMPLE END\n\nUnless set with the `~astropy.coordinates.galactocentric_frame_defaults` class,\nthe default parameter values for the `~astropy.coordinates.Galactocentric`\nframe are set to ``'latest'``, meaning that the default parameter values may\nchange if you update Astropy. If you use the\n`~astropy.coordinates.Galactocentric` frame without specifying all parameter\nvalues explicitly, we therefore suggest manually setting the frame default set\nmanually in any science code that depends sensitively on the choice of, e.g.,\nsolar motion or the other frame parameters.  For example, in such code, we\nrecommend adding something like this to your import block (here using\n``'v4.0'`` as an example)::\n\n    >>> import astropy.coordinates as coord\n    >>> coord.galactocentric_frame_defaults.set('v4.0') # doctest: +SKIP\n"},{"id":513,"name":"satellites.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. _astropy-coordinates-satellites:\n\nWorking with Earth Satellites Using Astropy Coordinates\n*******************************************************\n\nSatellite data is normally provided in the Two-Line Element (TLE) format\n(see `here <https://www.celestrak.com/NORAD/documentation/tle-fmt.php>`_\nfor a definition). These datasets are designed to be used in combination\nwith a theory for orbital propagation model to predict the positions\nof satellites.\n\nThe history of such models is discussed in detail in\n`Vallado et al (2006) <https://celestrak.com/publications/AIAA/2006-6753/AIAA-2006-6753-Rev2.pdf>`_\nwho also provide a reference implementation of the SGP4 orbital propagation\ncode, designed to be compatible with the TLE sets provided by the United\nStates Department of Defense, which are available from a source like\n`Celestrak <http://celestrak.com/>`_.\n\nThe output coordinate frame of the SGP4 model is the True Equator, Mean Equinox\nframe (TEME), which is one of the frames built-in to `astropy.coordinates`.\nTEME is an Earth-centered inertial frame (i.e., it does not rotate with respect\nto the stars). Several definitions exist; ``astropy`` uses the implementation described\nin `Vallado et al (2006) <https://celestrak.com/publications/AIAA/2006-6753/AIAA-2006-6753-Rev2.pdf>`_.\n\nFinding TEME Coordinates from TLE Data\n======================================\n\nThere is currently no support in `astropy.coordinates` for computing satellite orbits\nfrom TLE orbital element sets. Full support for handling TLE files is available in\nthe `Skyfield <https://rhodesmill.org/skyfield/>`_ library, but some advice for dealing\nwith satellite data in ``astropy`` is below.\n\n.. EXAMPLE START Using sgp4 to get a TEME coordinate\n\nYou will need some external library to compute the position and velocity of the satellite from the\nTLE orbital elements. The `SGP4 <https://pypi.org/project/sgp4/>`_ library can do this. An example\nof using this library to find the  `~astropy.coordinates.TEME` coordinates of a satellite is:\n\n.. doctest-requires:: sgp4\n\n    >>> from sgp4.api import Satrec\n    >>> from sgp4.api import SGP4_ERRORS\n    >>> s = '1 25544U 98067A   19343.69339541  .00001764  00000-0  38792-4 0  9991'\n    >>> t = '2 25544  51.6439 211.2001 0007417  17.6667  85.6398 15.50103472202482'\n    >>> satellite = Satrec.twoline2rv(s, t)\n\nThe ``satellite`` object has a method, ``satellite.sgp4``, that will try to compute the TEME position\nand velocity at a given time:\n\n.. doctest-requires:: sgp4\n\n    >>> from astropy.time import Time\n    >>> t = Time(2458827.362605, format='jd')\n    >>> error_code, teme_p, teme_v = satellite.sgp4(t.jd1, t.jd2)  # in km and km/s\n    >>> if error_code != 0:\n    ...     raise RuntimeError(SGP4_ERRORS[error_code])\n\nNow that we have the position and velocity in kilometers and kilometers per second, we can create a\nposition in the `~astropy.coordinates.TEME` reference frame:\n\n.. doctest-requires:: sgp4\n\n    >>> from astropy.coordinates import TEME, CartesianDifferential, CartesianRepresentation\n    >>> from astropy import units as u\n    >>> teme_p = CartesianRepresentation(teme_p*u.km)\n    >>> teme_v = CartesianDifferential(teme_v*u.km/u.s)\n    >>> teme = TEME(teme_p.with_differentials(teme_v), obstime=t)\n\n.. EXAMPLE END\n\nNote how we are careful to set the observed time of the `~astropy.coordinates.TEME` frame to\nthe time at which we calculated satellite position.\n\nTransforming TEME to Other Coordinate Systems\n=============================================\n\nOnce you have satellite positions in `~astropy.coordinates.TEME` coordinates they can be transformed\ninto any `astropy.coordinates` frame.\n\nFor example, to find the overhead latitude, longitude, and height of the satellite:\n\n.. EXAMPLE START Transforming TEME\n\n.. doctest-requires:: sgp4\n\n    >>> from astropy.coordinates import ITRS\n    >>> itrs = teme.transform_to(ITRS(obstime=t))  # doctest: +IGNORE_WARNINGS\n    >>> location = itrs.earth_location\n    >>> location.geodetic  # doctest: +FLOAT_CMP\n    GeodeticLocation(lon=<Longitude 160.34199789 deg>, lat=<Latitude -24.6609379 deg>, height=<Quantity 420.17927591 km>)\n\n.. testsetup::\n\n    >>> from astropy.coordinates import EarthLocation\n    >>> siding_spring = EarthLocation(-4680888.60272112, 2805218.44653429, -3292788.0804506, unit='m')\n\nOr, if you want to find the altitude and azimuth of the satellite from a particular location:\n\n.. doctest-requires:: sgp4\n\n    >>> from astropy.coordinates import EarthLocation, AltAz\n    >>> siding_spring = EarthLocation.of_site('aao')  # doctest: +SKIP\n    >>> aa = teme.transform_to(AltAz(obstime=t, location=siding_spring))  # doctest: +IGNORE_WARNINGS\n    >>> aa.alt  # doctest: +FLOAT_CMP\n    <Latitude 10.95229446 deg>\n    >>> aa.az  # doctest: +FLOAT_CMP\n    <Longitude 59.30081255 deg>\n\n.. EXAMPLE END\n"},{"id":514,"name":"solarsystem.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. _astropy-coordinates-solarsystem:\n\nSolar System Ephemerides\n************************\n\n`astropy.coordinates` can calculate the |SkyCoord| of some of the major solar\nsystem objects. By default, it uses approximate orbital elements calculated\nusing PyERFA_ routines, but it can\nalso use more precise ones using the JPL ephemerides (which are derived from\ndynamical models). The default JPL ephemerides (DE430) provide predictions\nvalid roughly for the years between 1550 and 2650. The file is 115 MB and will\nneed to be downloaded the first time you use this functionality, but will be\ncached after that.\n\n.. note::\n   Using JPL ephemerides requires that the `jplephem\n   <https://pypi.org/project/jplephem/>`_ package be installed. This is\n   most conveniently achieved via ``pip install jplephem``, although whatever\n   package management system you use might have it as well.\n\nThree functions are provided; :meth:`~astropy.coordinates.get_body`,\n:meth:`~astropy.coordinates.get_moon` and\n:meth:`~astropy.coordinates.get_body_barycentric`. The first two functions\nreturn |SkyCoord| objects in the `~astropy.coordinates.GCRS` frame, while the\nlatter returns a `~astropy.coordinates.CartesianRepresentation` of the\nbarycentric position of a body (i.e., in the `~astropy.coordinates.ICRS` frame).\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Using the Solar System Ephemerides\n\nHere is an example of using these functions with built-in ephemerides (i.e.,\nwithout the need to download a large ephemerides file)::\n\n  >>> from astropy.time import Time\n  >>> from astropy.coordinates import solar_system_ephemeris, EarthLocation\n  >>> from astropy.coordinates import get_body_barycentric, get_body, get_moon\n  >>> t = Time(\"2014-09-22 23:22\")\n  >>> loc = EarthLocation.of_site('greenwich') # doctest: +REMOTE_DATA\n  >>> with solar_system_ephemeris.set('builtin'):\n  ...     jup = get_body('jupiter', t, loc) # doctest: +REMOTE_DATA +IGNORE_OUTPUT\n  >>> jup  # doctest: +FLOAT_CMP +REMOTE_DATA\n  <SkyCoord (GCRS: obstime=2014-09-22 23:22:00.000, obsgeoloc=(3949481.69182405, -550931.91022387, 4961151.73597633) m, obsgeovel=(40.159527, 287.47873161, -0.04597922) m / s): (ra, dec, distance) in (deg, deg, AU)\n      (136.91116253, 17.02935396, 5.94386022)>\n\nAbove, we used ``solar_system_ephemeris`` as a context, which sets the default\nephemeris while in the ``with`` clause, and resets it at the end.\n\nTo get more precise positions than is possible with the built-in ephemeris\n(see :ref:`astropy-coordinates-solarsystem-erfa-precision`), you\ncould use the ``de430`` ephemeris mentioned above, or, if you only care about\ntimes between 1950 and 2050, opt for the ``de432s`` ephemeris, which is stored\nin a smaller, ~10 MB, file (which will be downloaded and cached when the\nephemeris is set):\n\n.. doctest-requires:: jplephem\n\n  >>> solar_system_ephemeris.set('de432s') # doctest: +REMOTE_DATA, +IGNORE_OUTPUT\n  <ScienceState solar_system_ephemeris: 'de432s'>\n  >>> get_body('jupiter', t, loc) # doctest: +REMOTE_DATA, +FLOAT_CMP\n  <SkyCoord (GCRS: obstime=2014-09-22 23:22:00.000, obsgeoloc=(3949481.69182405, -550931.91022387, 4961151.73597633) m, obsgeovel=(40.159527, 287.47873161, -0.04597922) m / s): (ra, dec, distance) in (deg, deg, km)\n      (136.90234846, 17.03160654, 8.89196021e+08)>\n  >>> get_moon(t, loc) # doctest: +REMOTE_DATA, +FLOAT_CMP\n  <SkyCoord (GCRS: obstime=2014-09-22 23:22:00.000, obsgeoloc=(3949481.69182405, -550931.91022387, 4961151.73597633) m, obsgeovel=(40.159527, 287.47873161, -0.04597922) m / s): (ra, dec, distance) in (deg, deg, km)\n      (165.51854528, 2.32861794, 407229.55638763)>\n  >>> get_body_barycentric('moon', t) # doctest: +REMOTE_DATA, +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) in km\n      (1.50107535e+08, -866789.11996916, -418963.55218495)>\n\nFor one-off calculations with a given ephemeris, you can also pass it directly\nto the various functions:\n\n.. doctest-requires:: jplephem\n\n  >>> get_body_barycentric('moon', t, ephemeris='de432s')\n  ... # doctest: +REMOTE_DATA, +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) in km\n      (1.50107535e+08, -866789.11996916, -418963.55218495)>\n  >>> get_body_barycentric('moon', t, ephemeris='builtin')\n  ... # doctest: +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) in AU\n      (1.00340683, -0.00579417, -0.00280064)>\n\n..\n  EXAMPLE END\n\nFor a list of the bodies for which positions can be calculated, do:\n\n.. note that we skip the next test if jplephem is not installed because if\n.. jplephem was not installed, we didn't change the science state higher up\n\n.. doctest-requires:: jplephem\n\n  >>> solar_system_ephemeris.bodies # doctest: +REMOTE_DATA\n  ('sun',\n   'mercury',\n   'venus',\n   'earth-moon-barycenter',\n   'earth',\n   'moon',\n   'mars',\n   'jupiter',\n   'saturn',\n   'uranus',\n   'neptune',\n   'pluto')\n  >>> solar_system_ephemeris.set('builtin')\n  <ScienceState solar_system_ephemeris: 'builtin'>\n  >>> solar_system_ephemeris.bodies\n  ('earth',\n   'sun',\n   'moon',\n   'mercury',\n   'venus',\n   'earth-moon-barycenter',\n   'mars',\n   'jupiter',\n   'saturn',\n   'uranus',\n   'neptune')\n\n.. note ::\n    While the sun is included in the these ephemerides, it is important to\n    recognize that `~astropy.coordinates.get_sun` always uses the built-in,\n    polynomial model (as this requires no special download). So it is not safe\n    to assume that ``get_body(time, 'sun')`` and ``get_sun(time)`` will give\n    the same result.\n\n.. _astropy-coordinates-solarsystem-erfa-precision:\n\nPrecision of the Built-In Ephemeris\n===================================\n\nThe algorithm for calculating positions and velocities for planets other than\nEarth used by ERFA_ is due to J.L. Simon, P. Bretagnon, J. Chapront,\nM. Chapront-Touze, G. Francou and J. Laskar (Bureau des Longitudes, Paris,\nFrance).  From comparisons with JPL ephemeris DE102, they quote the maximum\nerrors over the interval 1800-2050 below. For more details, see the PyERFA_ routine, `erfa.plan94`.\nFor the Earth, the rms errors in position and velocity are about 4.6 km and\n1.4 mm/s, respectively (see `erfa.epv00`).\n\n.. list-table::\n\n  * - Planet\n    - L (arcsec)\n    - B (arcsec)\n    - R (km)\n  * - Mercury\n    - 4\n    - 1\n    - 300\n  * - Venus\n    - 5\n    - 1\n    - 800\n  * - EMB\n    - 6\n    - 1\n    - 1000\n  * - Mars\n    - 17\n    - 1\n    - 7700\n  * - Jupiter\n    - 71\n    - 5\n    - 76000\n  * - Saturn\n    - 81\n    - 13\n    - 267000\n  * - Uranus\n    - 86\n    - 7\n    - 712000\n  * - Neptune\n    - 11\n    - 1\n    - 253000\n"},{"id":515,"name":"frames.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. We call EarthLocation.of_site here first to force the downloading\n.. of sites.json so that future doctest output isn't cluttered with\n.. \"Downloading ... [done]\". This can be removed once we have a better\n.. way of ignoring output lines based on pattern-matching, e.g.:\n.. https://github.com/astropy/pytest-doctestplus/issues/11\n\n.. testsetup::\n    >>> from astropy.coordinates import EarthLocation\n    >>> EarthLocation.of_site('greenwich') # doctest: +IGNORE_OUTPUT +IGNORE_WARNINGS\n\nUsing and Designing Coordinate Frames\n*************************************\n\nIn `astropy.coordinates`, as outlined in the\n:ref:`astropy-coordinates-overview`, subclasses of |BaseFrame| (\"frame\nclasses\") define particular coordinate frames. They can (but do not\n*have* to) contain representation objects storing the actual coordinate\ndata. The actual coordinate transformations are defined as functions\nthat transform representations between frame classes. This approach\nserves to separate high-level user functionality (see :doc:`skycoord`)\nand details of how the coordinates are actually stored (see\n:doc:`representations`) from the definition of frames and how they are\ntransformed.\n\nUsing Frame Objects\n===================\n\nFrames without Data\n-------------------\n\nFrame objects have two distinct (but related) uses. The first is\nstoring the information needed to uniquely define a frame (e.g.,\nequinox, observation time). This information is stored on the frame\nobjects as (read-only) Python attributes, which are set when the object\nis first created::\n\n    >>> from astropy.coordinates import ICRS, FK5\n    >>> FK5(equinox='J1975')\n    <FK5 Frame (equinox=J1975.000)>\n    >>> ICRS()  # has no attributes\n    <ICRS Frame>\n    >>> FK5()  # uses default equinox\n    <FK5 Frame (equinox=J2000.000)>\n\nThe specific names of attributes available for a particular frame (and\ntheir default values) are available as the class method\n``get_frame_attr_names``::\n\n    >>> FK5.get_frame_attr_names()\n    {'equinox': <Time object: scale='tt' format='jyear_str' value=J2000.000>}\n\nYou can access any of the attributes on a frame by using standard Python\nattribute access. Note that for cases like ``equinox``, which are time\ninputs, if you pass in any unambiguous time string, it will be converted\ninto an `~astropy.time.Time` object (see\n:ref:`astropy-time-inferring-input`)::\n\n    >>> f = FK5(equinox='J1975')\n    >>> f.equinox\n    <Time object: scale='tt' format='jyear_str' value=J1975.000>\n    >>> f = FK5(equinox='2011-05-15T12:13:14')\n    >>> f.equinox\n    <Time object: scale='utc' format='isot' value=2011-05-15T12:13:14.000>\n\n\nFrames with Data\n----------------\n\nThe second use for frame objects is to store actual realized coordinate\ndata for frames like those described above. In this use, it is similar\nto the |SkyCoord| class, and in fact, the |SkyCoord| class internally\nuses the frame classes as its implementation. However, the frame\nclasses have fewer \"convenience\" features, thereby streamlining the\nimplementation of frame classes. As such, they are created\nsimilarly to |SkyCoord| objects. One suggested way is to use\nwith keywords appropriate for the frame (e.g., ``ra`` and ``dec`` for\nequatorial systems)::\n\n    >>> from astropy import units as u\n    >>> ICRS(ra=1.1*u.deg, dec=2.2*u.deg)  # doctest: +FLOAT_CMP\n    <ICRS Coordinate: (ra, dec) in deg\n        (1.1, 2.2)>\n    >>> FK5(ra=1.1*u.deg, dec=2.2*u.deg, equinox='J1975')  # doctest: +FLOAT_CMP\n    <FK5 Coordinate (equinox=J1975.000): (ra, dec) in deg\n        (1.1, 2.2)>\n\nThese same attributes can be used to access the data in the frames as\n|Angle| objects (or |Angle| subclasses)::\n\n    >>> coo = ICRS(ra=1.1*u.deg, dec=2.2*u.deg)\n    >>> coo.ra  # doctest: +FLOAT_CMP\n    <Longitude 1.1 deg>\n    >>> coo.ra.value  # doctest: +FLOAT_CMP\n    1.1\n    >>> coo.ra.to(u.hourangle)  # doctest: +FLOAT_CMP\n    <Longitude 0.07333333 hourangle>\n\nYou can use the ``representation_type`` attribute in conjunction\nwith the ``representation_component_names`` attribute to figure out what\nkeywords are accepted by a particular class object. The former will be the\nrepresentation class in which the system is expressed (e.g., spherical for\nequatorial frames), and the latter will be a dictionary mapping names for that\nframe to the attribute name on the representation class::\n\n    >>> import astropy.units as u\n    >>> icrs = ICRS(1*u.deg, 2*u.deg)\n    >>> icrs.representation_type\n    <class 'astropy.coordinates.representation.SphericalRepresentation'>\n    >>> icrs.representation_component_names\n    {'ra': 'lon', 'dec': 'lat', 'distance': 'distance'}\n\nYou can get the data in a different representation if needed::\n\n    >>> icrs.represent_as('cartesian')  # doctest: +FLOAT_CMP\n    <CartesianRepresentation (x, y, z) [dimensionless]\n         (0.99923861, 0.01744177, 0.0348995)>\n\nThe representation of the coordinate object can also be changed directly, as\nshown below. This does *nothing* to the object internal data which stores the\ncoordinate values, but it changes the external view of that data in two ways:\n(1) the object prints itself in accord with the new representation, and (2) the\navailable attributes change to match those of the new representation (e.g., from\n``ra, dec, distance`` to ``x, y, z``). Setting the ``representation_type``\nthus changes a *property* of the object (how it appears) without changing the\nintrinsic object itself which represents a point in 3D space.::\n\n    >>> from astropy.coordinates import CartesianRepresentation\n    >>> icrs.representation_type = CartesianRepresentation\n    >>> icrs  # doctest: +FLOAT_CMP\n    <ICRS Coordinate: (x, y, z) [dimensionless]\n        (0.99923861, 0.01744177, 0.0348995)>\n    >>> icrs.x  # doctest: +FLOAT_CMP\n    <Quantity 0.99923861>\n\nThe representation can also be set at the time of creating a coordinate\nand affects the set of keywords used to supply the coordinate data. For\nexample, to create a coordinate with Cartesian data do::\n\n    >>> ICRS(x=1*u.kpc, y=2*u.kpc, z=3*u.kpc, representation_type='cartesian')  #  doctest: +FLOAT_CMP\n    <ICRS Coordinate: (x, y, z) in kpc\n        (1., 2., 3.)>\n\nFor more information about the use of representations in coordinates see the\n:ref:`astropy-skycoord-representations` section, and for details about the\nrepresentations themselves see :ref:`astropy-coordinates-representations`.\n\nThere are two other ways to create frame classes with coordinates. A\nrepresentation class can be passed in directly at creation, along with\nany frame attributes required::\n\n    >>> from astropy.coordinates import SphericalRepresentation\n    >>> rep = SphericalRepresentation(lon=1.1*u.deg, lat=2.2*u.deg, distance=3.3*u.kpc)\n    >>> FK5(rep, equinox='J1975')  # doctest: +FLOAT_CMP\n    <FK5 Coordinate (equinox=J1975.000): (ra, dec, distance) in (deg, deg, kpc)\n        (1.1, 2.2, 3.3)>\n\nA final way is to create a frame object from an already existing frame\n(either one with or without data), using the ``realize_frame`` method. This\nwill yield a frame with the same attributes, but new data::\n\n    >>> f1 = FK5(equinox='J1975')\n    >>> f1\n    <FK5 Frame (equinox=J1975.000)>\n    >>> rep = SphericalRepresentation(lon=1.1*u.deg, lat=2.2*u.deg, distance=3.3*u.kpc)\n    >>> f1.realize_frame(rep)  # doctest: +FLOAT_CMP\n    <FK5 Coordinate (equinox=J1975.000): (ra, dec, distance) in (deg, deg, kpc)\n        (1.1, 2.2, 3.3)>\n\nYou can check if a frame object has data using the ``has_data`` attribute, and\nif it is present, it can be accessed from the ``data`` attribute::\n\n    >>> ICRS().has_data\n    False\n    >>> cooi = ICRS(ra=1.1*u.deg, dec=2.2*u.deg)\n    >>> cooi.has_data\n    True\n    >>> cooi.data  # doctest: +FLOAT_CMP\n    <UnitSphericalRepresentation (lon, lat) in deg\n        (1.1, 2.2)>\n\nAll of the above methods can also accept array data (in the form of\nclass:`~astropy.units.Quantity`, or other Python sequences) to create arrays of\ncoordinates::\n\n    >>> ICRS(ra=[1.5, 2.5]*u.deg, dec=[3.5, 4.5]*u.deg)  # doctest: +FLOAT_CMP\n    <ICRS Coordinate: (ra, dec) in deg\n        [(1.5, 3.5), (2.5, 4.5)]>\n\nIf you pass in mixed arrays and scalars, the arrays will be broadcast\nover the scalars appropriately::\n\n    >>> ICRS(ra=[1.5, 2.5]*u.deg, dec=[3.5, 4.5]*u.deg, distance=5*u.kpc)  # doctest: +FLOAT_CMP\n    <ICRS Coordinate: (ra, dec, distance) in (deg, deg, kpc)\n        [(1.5, 3.5, 5.), (2.5, 4.5, 5.)]>\n\nSimilar broadcasting happens if you transform to another frame. For example::\n\n    >>> import numpy as np\n    >>> from astropy.coordinates import EarthLocation, AltAz\n    >>> coo = ICRS(ra=180.*u.deg, dec=51.477811*u.deg)\n    >>> lf = AltAz(location=EarthLocation.of_site('greenwich'),\n    ...            obstime=['2012-03-21T00:00:00', '2012-06-21T00:00:00'])\n    >>> lcoo = coo.transform_to(lf)  # this can load finals2000A.all # doctest: +REMOTE_DATA +IGNORE_OUTPUT\n    >>> lcoo  # doctest: +REMOTE_DATA +FLOAT_CMP\n    <AltAz Coordinate (obstime=['2012-03-21T00:00:00.000' '2012-06-21T00:00:00.000'], location=(3980608.9024681724, -102.47522910648239, 4966861.273100675) m, pressure=0.0 hPa, temperature=0.0 deg_C, relative_humidity=0.0, obswl=1.0 micron): (az, alt) in deg\n        [( 94.71264993, 89.21424259), (307.69488825, 37.98077772)]>\n\nAbove, the shapes — ``()`` for ``coo`` and ``(2,)`` for ``lf`` — were\nbroadcast against each other. If you wish to determine the positions for a\nset of coordinates, you will need to make sure that the shapes allow this::\n\n    >>> coo2 = ICRS(ra=[180., 225., 270.]*u.deg, dec=[51.5, 0., 51.5]*u.deg)\n    >>> coo2.transform_to(lf)\n    Traceback (most recent call last):\n    ...\n    ValueError: operands could not be broadcast together...\n    >>> coo2.shape\n    (3,)\n    >>> lf.shape\n    (2,)\n    >>> lf2 = lf[:, np.newaxis]\n    >>> lf2.shape\n    (2, 1)\n    >>> coo2.transform_to(lf2)  # doctest:  +REMOTE_DATA +FLOAT_CMP\n    <AltAz Coordinate (obstime=[['2012-03-21T00:00:00.000' '2012-03-21T00:00:00.000'\n      '2012-03-21T00:00:00.000']\n     ['2012-06-21T00:00:00.000' '2012-06-21T00:00:00.000'\n      '2012-06-21T00:00:00.000']], location=(3980608.90246817, -102.47522911, 4966861.27310068) m, pressure=0.0 hPa, temperature=0.0 deg_C, relative_humidity=0.0, obswl=1.0 micron): (az, alt) in deg\n        [[( 93.09845183, 89.21613128), (126.85789664, 25.4660055 ),\n          ( 51.37993234, 37.18532527)],\n         [(307.71713698, 37.99437658), (231.3740787 , 26.36768329),\n          ( 85.42187236, 89.69297998)]]>\n\n.. Note::\n   Frames without data have a ``shape`` that is determined by their frame\n   attributes. For frames with data, the ``shape`` always is that of the data;\n   any non-scalar attributes are broadcast to have matching shapes\n   (as can be seen for ``obstime`` in the last line above).\n\nCoordinate values in a array-valued frame object can be modified in-place\n(added in astropy 4.1). This requires that the new values be set from an\nanother frame object that is equivalent in all ways except for the actual\ncoordinate data values. In this way, no frame transformations are required and\nthe item setting operation is extremely robust.\n\nTo modify an array of coordinates use the same syntax for a numpy array::\n\n  >>> coo1 = ICRS([1, 2] * u.deg, [3, 4] * u.deg)\n  >>> coo2 = ICRS(10 * u.deg, 20 * u.deg)\n  >>> coo1[0] = coo2\n  >>> coo1\n  <ICRS Coordinate: (ra, dec) in deg\n      [(10., 20.), ( 2.,  4.)]>\n\nThis method is relatively slow because it requires setting from an\nexisting frame object and it performs extensive validation to ensure\nthat the operation is valid. For some applications it may be necessary to\ntake a different lower-level approach which is described in the section\n:ref:`astropy-coordinates-fast-in-place`.\n\n.. warning::\n\n  You may be tempted to try an apparently obvious way of modifying a frame\n  object in place by updating the component attributes directly, for example\n  ``coo1.ra[1] = 40 * u.deg``. However, while this will *appear* to give a correct\n  result it does not actually modify the underlying representation data. This\n  is related to the current implementation of performance-based caching.\n  The current cache implementation is similarly unable to handle in-place changes\n  to the representation (``.data``) or frame attributes such as ``.obstime``.\n\nTransforming between Frames\n===========================\n\nTo transform a frame object with data into another frame, use the\n``transform_to`` method of an object, and provide it the frame you wish to\ntransform to.  This frame should be a frame object (with or without coordinate\ndata).  If you wish to use all default frame attributes, you can instantiate\nthe frame class with no arguments (i.e., empty parentheses)::\n\n    >>> cooi = ICRS(1.5*u.deg, 2.5*u.deg)\n    >>> cooi.transform_to(FK5())  # doctest: +FLOAT_CMP\n    <FK5 Coordinate (equinox=J2000.000): (ra, dec) in deg\n        (1.50000661, 2.50000238)>\n    >>> cooi.transform_to(FK5(equinox='J1975'))  # doctest: +FLOAT_CMP\n    <FK5 Coordinate (equinox=J1975.000): (ra, dec) in deg\n        (1.17960348, 2.36085321)>\n\nThe :ref:`astropy-coordinates-api` includes a list of all of the frames built\ninto `astropy.coordinates`, as well as the defined transformations between\nthem. Any transformation that has a valid path, even if it passes through\nother frames, can be transformed too. To programmatically check for or\nmanipulate transformations, see the `~astropy.coordinates.TransformGraph`\ndocumentation.\n\n\n.. _astropy-coordinates-design:\n\nDefining a New Frame\n====================\n\nImplementing a new frame class that connects to the ``astropy.coordinates``\ninfrastructure can be done by subclassing\n`~astropy.coordinates.BaseCoordinateFrame`. Some guidance and examples are given\nbelow, but detailed instructions for creating new frames are given in the\ndocstring of `~astropy.coordinates.BaseCoordinateFrame`.\n\nAll frame classes must specify a default representation for the coordinate\npositions by, at minimum, defining a ``default_representation`` class attribute\n(see :ref:`astropy-coordinates-representations` for more information about the\nsupported ``Representation`` objects).\n\nExamples\n--------\n\n..\n  EXAMPLE START\n  Defining a New Frame Class that Connects to astropy.coordinates\n\nTo create a new frame that, by default, expects to receive its coordinate data\nin spherical coordinates, we would create a subclass as follows::\n\n    >>> from astropy.coordinates import BaseCoordinateFrame\n    >>> import astropy.coordinates.representation as r\n    >>> class MyFrame1(BaseCoordinateFrame):\n    ...     # Specify how coordinate values are represented when outputted\n    ...     default_representation = r.SphericalRepresentation\n\nAlready, this is a valid frame class::\n\n    >>> fr = MyFrame1(1*u.deg, 2*u.deg)\n    >>> fr # doctest: +FLOAT_CMP\n    <MyFrame1 Coordinate: (lon, lat) in deg\n        (1., 2.)>\n    >>> fr.lon # doctest: +FLOAT_CMP\n    <Longitude 1. deg>\n\nHowever, as we have defined it above, (1) the coordinate component names will be\nthe same as used in the specified ``default_representation`` (in this case,\n``lon``, ``lat``, and ``distance`` for longitude, latitude, and distance,\nrespectively), (2) this frame does not have any additional attributes or\nmetadata, (3) this frame does not support transformations to any other\ncoordinate frame, and (4) this frame does not support velocity data. We can\naddress each of these points by seeing some other ways of customizing frame\nsubclasses.\n\n..\n  EXAMPLE END\n\nCustomizing Frame Component Names\n---------------------------------\n\nFirst, as mentioned in the point (1) :ref:`above <astropy-coordinates-design>`,\nsome frame classes have special names for their components. For example, the\n`~astropy.coordinates.ICRS` frame and other equatorial frame classes often use\n\"Right Ascension\" or \"RA\" in place of longitude, and \"Declination\" or \"Dec.\" in\nplace of latitude. These component name overrides, which change the frame\ncomponent name defaults taken from the ``Representation`` classes, are defined\nby specifying a set of `~astropy.coordinates.RepresentationMapping` instances\n(one per component) as a part of defining an additional class attribute on a\nframe class: ``frame_specific_representation_info``. This attribute must be a\ndictionary, and the keys should be either ``Representation`` or ``Differential``\nclasses (see below for a discussion about customizing behavior for velocity\ncomponents, which is done with the ``Differential`` classes). Using our example\nframe implemented above, we can customize it to use the names \"R\" and \"D\"\ninstead of \"lon\" and \"lat\"::\n\n    >>> from astropy.coordinates import RepresentationMapping\n    >>> class MyFrame2(BaseCoordinateFrame):\n    ...     # Specify how coordinate values are represented when outputted\n    ...     default_representation = r.SphericalRepresentation\n    ...\n    ...     # Override component names (e.g., \"ra\" instead of \"lon\")\n    ...     frame_specific_representation_info = {\n    ...         r.SphericalRepresentation: [RepresentationMapping('lon', 'R'),\n    ...                                     RepresentationMapping('lat', 'D')]\n    ...     }\n\nWith this frame, we can now use the names ``R`` and ``D`` to access the frame\ndata::\n\n    >>> fr = MyFrame2(3*u.deg, 4*u.deg)\n    >>> fr # doctest: +FLOAT_CMP\n    <MyFrame2 Coordinate: (R, D) in deg\n        (3., 4.)>\n    >>> fr.R # doctest: +FLOAT_CMP\n    <Longitude 3. deg>\n\nWe can specify name mappings for any ``Representation`` class in\n``astropy.coordinates`` to change the default component names. For example, the\n`~astropy.coordinates.Galactic` frame uses the standard longitude and latitude\nnames \"l\" and \"b\" when used with a\n`~astropy.coordinates.SphericalRepresentation`, but uses the component names\n\"x\", \"y\", and \"z\" when the representation is changed to a\n`~astropy.coordinates.CartesianRepresentation`. With our example above, we could\nadd an additional set of mappings to override the Cartesian component names to\nbe \"a\", \"b\", and \"c\" instead of the default \"x\", \"y\", and \"z\"::\n\n    >>> class MyFrame3(BaseCoordinateFrame):\n    ...     # Specify how coordinate values are represented when outputted\n    ...     default_representation = r.SphericalRepresentation\n    ...\n    ...     # Override component names (e.g., \"ra\" instead of \"lon\")\n    ...     frame_specific_representation_info = {\n    ...         r.SphericalRepresentation: [RepresentationMapping('lon', 'R'),\n    ...                                     RepresentationMapping('lat', 'D')],\n    ...         r.CartesianRepresentation: [RepresentationMapping('x', 'a'),\n    ...                                     RepresentationMapping('y', 'b'),\n    ...                                     RepresentationMapping('z', 'c')]\n    ...     }\n\nFor any `~astropy.coordinates.RepresentationMapping`, you can also specify a\ndefault unit for the component by setting the ``defaultunit`` keyword argument.\n\n\nDefining Frame Attributes\n-------------------------\n\nSecond, as indicated by the point (2) in the :ref:`introduction above\n<astropy-coordinates-design>`, it is often useful for coordinate frames to allow\nspecifying frame \"attributes\" that may specify additional data or parameters\nneeded in order to fully specify transformations between a given frame and some\nother frame. For example, the `~astropy.coordinates.FK5` frame allows specifying\nan ``equinox`` that helps define the transformation between\n`~astropy.coordinates.FK5` and the `~astropy.coordinates.ICRS` frame. Frame\nattributes are defined by creating class attributes that are instances of\n`~astropy.coordinates.Attribute` or its subclasses (e.g.,\n`~astropy.coordinates.TimeAttribute`, `~astropy.coordinates.QuantityAttribute`,\netc.). If attributes are defined using these classes, there is often no need to\ndefine an ``__init__`` function, as the initializer in\n`~astropy.coordinates.BaseCoordinateFrame` will probably behave in the way you\nwant. Let us now modify the above toy frame class implementation to add two\nframe attributes::\n\n    >>> from astropy.coordinates import TimeAttribute, QuantityAttribute\n    >>> class MyFrame4(BaseCoordinateFrame):\n    ...     # Specify how coordinate values are represented when outputted\n    ...     default_representation = r.SphericalRepresentation\n    ...\n    ...     # Override component names (e.g., \"ra\" instead of \"lon\")\n    ...     frame_specific_representation_info = {\n    ...         r.SphericalRepresentation: [RepresentationMapping('lon', 'R'),\n    ...                                     RepresentationMapping('lat', 'D')],\n    ...         r.CartesianRepresentation: [RepresentationMapping('x', 'a'),\n    ...                                     RepresentationMapping('y', 'b'),\n    ...                                     RepresentationMapping('z', 'c')]\n    ...     }\n    ...\n    ...     # Specify frame attributes required to fully specify the frame\n    ...     time = TimeAttribute(default='B1950')\n    ...     orientation = QuantityAttribute(default=42*u.deg)\n\nWithout specifying an initializer, defining these attributes tells the\n`~astropy.coordinates.BaseCoordinateFrame` what to expect in terms of additional\narguments passed in to our subclass initializer. For example, when defining a\nframe instance with our subclass, we can now optionally specify values for these\nattributes::\n\n    >>> fr = MyFrame4(R=1*u.deg, D=2*u.deg, orientation=21*u.deg)\n    >>> fr # doctest: +FLOAT_CMP\n    <MyFrame4 Coordinate (time=B1950.000, orientation=21.0 deg): (R, D) in deg\n        (1., 2.)>\n\nNote that we specified both frame attributes with default values, so they are\noptional arguments to the frame initializer. Note also that the frame attributes\nnow appear in the ``repr`` of the frame instance above. As a bonus, for most of\nthe ``Attribute`` subclasses, even without defining an initializer, attributes\nspecified as arguments will be validated. For example, arguments passed in to\n`~astropy.coordinates.QuantityAttribute` attributes will be checked that they\nhave valid and compatible units with the expected attribute units. Using our\nframe example above, which expects an ``orientation`` with angular units,\npassing in a time results in an error::\n\n    >>> MyFrame4(R=1*u.deg, D=2*u.deg, orientation=55*u.microyear) # doctest: +IGNORE_EXCEPTION_DETAIL\n    Traceback (most recent call last):\n    ...\n    UnitConversionError: 'uyr' (time) and 'deg' (angle) are not convertible\n\nWhen defining frame attributes, you do not always have to specify a default\nvalue as long as the ``Attribute`` subclass is able to validate the input. For\nexample, with the above frame, if the ``orientation`` does not require a default\nvalue but we still want to enforce it to have angular units, we could instead\ndefine it as::\n\n    orientation = QuantityAttribute(unit=u.deg)\n\nIn the above case, if ``orientation`` is not specified when a new frame instance\nis created, its value will be `None`: Note that it is up to the frame\nclasses and transformation function implementations to define how to handle a\n`None` value. In most cases `None` should signify a special case like \"use a\ndifferent frame attribute for this value\" or similar.\n\nCustomizing Display of Attributes\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nWhile the default `repr` for coordinate frames is suitable for most cases, you\nmay want to customize how frame attributes are displayed in certain cases. To\ndo this you can define a method named ``_astropy_repr_in_frame``. This method\nshould be defined on the object that is set to the frame attribute itself,\n**not** the `~astropy.coordinates.Attribute` descriptor.\n\nExample\n^^^^^^^\n\n..\n  EXAMPLE START\n  Customizing Display of Attributes in Coordinate Frames\n\nAs an example of method ``_astropy_repr_in_frame``, say you have an\nobject ``Spam`` which you have as an attribute of your frame::\n\n  >>> class Spam:\n  ...     def _astropy_repr_in_frame(self):\n  ...         return \"<A can of Spam>\"\n\nIf your frame has this class as an attribute::\n\n  >>> from astropy.coordinates import Attribute\n  >>> class Egg(BaseCoordinateFrame):\n  ...     can = Attribute(default=Spam())\n\nWhen it is displayed by the frame it will use the result of\n``_astropy_repr_in_frame``::\n\n  >>> Egg()\n  <Egg Frame (can=<A can of Spam>)>\n\n..\n  EXAMPLE END\n\nDefining Transformations between Frames\n---------------------------------------\n\nAs indicated by the point (3) in the :ref:`introduction above\n<astropy-coordinates-design>`, a frame class on its own is likely not very\nuseful until transformations are defined between it and other coordinate frame\nclasses. The key concept for defining transformations in ``astropy.coordinates``\nis the \"frame transform graph\" (in the \"graph theory\" sense, not \"plot\"), which\nstores all of the transformations between the built-in frames, as well as tools\nfor finding the shortest paths through this graph to transform from any frame to\nany other by composing the transformations. The power behind this concept is\navailable to user-created frames as well, meaning that once you define even one\ntransform from your frame to any frame in the graph, coordinates defined in your\nframe can be transformed to *any* other frame in the graph. The \"frame transform\ngraph\" is available in code as ``astropy.coordinates.frame_transform_graph``,\nwhich is an instance of the `~astropy.coordinates.TransformGraph` class.\n\nThe transformations themselves are represented as\n`~astropy.coordinates.CoordinateTransform` objects or their subclasses. The\nuseful subclasses/types of transformations are:\n\n* `~astropy.coordinates.FunctionTransform`\n\n    A transform that is defined as a function that takes a frame object\n    of one frame class and returns an object of another class.\n\n* `~astropy.coordinates.AffineTransform`\n\n    A transformation that includes a linear matrix operation and a translation\n    (vector offset). These transformations are defined by a 3x3 matrix and a\n    3-vector for the offset (supplied as a Cartesian representation). The\n    transformation is applied to the Cartesian representation of one frame and\n    transforms into the Cartesian representation of the target frame.\n\n* `~astropy.coordinates.StaticMatrixTransform`\n* `~astropy.coordinates.DynamicMatrixTransform`\n\n    The matrix transforms are `~astropy.coordinates.AffineTransform`\n    transformations without a translation (i.e., only a rotation). The static\n    version is for the case where the matrix is independent of the frame\n    attributes (e.g., the ICRS->FK5 transformation, because ICRS has no frame\n    attributes). The dynamic case is for transformations where the\n    transformation matrix depends on the frame attributes of either the\n    to or from frame.\n\nGenerally, it is not necessary to use these classes directly. Instead,\nuse methods on the ``frame_transform_graph`` that can be used as function\ndecorators. Define functions that either do the actual\ntransformation (for `~astropy.coordinates.FunctionTransform`), or that compute\nthe necessary transformation matrices to transform. Then decorate the functions\nto register these transformations with the frame transform graph::\n\n    from astropy.coordinates import frame_transform_graph\n\n    @frame_transform_graph.transform(DynamicMatrixTransform, ICRS, FK5)\n    def icrs_to_fk5(icrscoord, fk5frame):\n        ...\n\n    @frame_transform_graph.transform(DynamicMatrixTransform, FK5, ICRS)\n    def fk5_to_icrs(fk5coord, icrsframe):\n        ...\n\nIf the transformation to your coordinate frame of interest is not\nrepresentable by a matrix operation, you can also specify a function to do\nthe actual transformation, and pass the\n`~astropy.coordinates.FunctionTransform` class to the transform graph\ndecorator instead::\n\n    @frame_transform_graph.transform(FunctionTransform, FK4NoETerms, FK4)\n    def fk4_no_e_to_fk4(fk4noecoord, fk4frame):\n        ...\n\nFurthermore, the ``frame_transform_graph`` does some caching and\noptimization to speed up transformations after the first attempt to go\nfrom one frame to another, and shortcuts steps where relevant (for\nexample, combining multiple static matrix transforms into a single\nmatrix). Hence, in general, it is better to define whatever are the\nmost natural transformations for a user-defined frame, rather than\nworrying about optimizing or caching a transformation to speed up the\nprocess.\n\nFor a demonstration of how to define transformation functions that also work for\ntransforming velocity components, see\n:ref:`astropy-coordinate-transform-with-velocities`.\n\n\nSupporting Velocity Data in Frames\n----------------------------------\n\nAs alluded to by point (4) in the :ref:`introduction above\n<astropy-coordinates-design>`, the examples we have seen above mostly deal with\ncustomizing frame behavior for positional information. (For some context about\nhow velocities are handled in ``astropy.coordinates``, it may be useful to read\nthe overview: :ref:`astropy-coordinate-custom-frame-with-velocities`.)\n\nWhen defining a frame class, it is also possible to set a\n``default_differential`` (analogous to ``default_representation``), and to\ncustomize how velocity data components are named. Expanding on our custom frame\nexample above, we can use `~astropy.coordinates.RepresentationMapping` to\noverride ``Differential`` component names. The default ``Differential``\ncomponents are typically named after the corresponding ``Representation``\ncomponent, preceded by ``d_``. So, for example, the longitude ``Differential``\ncomponent is, by default, ``d_lon``. However, there are some defaults to be\naware of. Here, if we set the default ``Differential`` class to also be\nSpherical, it will implement a set of default \"nicer\" names for the velocity\ncomponents, mapping ``pm_R`` to ``d_lon``, ``pm_D`` to ``d_lat``, and\n``radial_velocity`` to ``d_distance`` (taking the previously overridden\nlongitude and latitude component names)::\n\n    >>> class MyFrame4WithVelocity(BaseCoordinateFrame):\n    ...     # Specify how coordinate values are represented when outputted\n    ...     default_representation = r.SphericalRepresentation\n    ...     default_differential = r.SphericalDifferential\n    ...\n    ...     # Override component names (e.g., \"ra\" instead of \"lon\")\n    ...     frame_specific_representation_info = {\n    ...         r.SphericalRepresentation: [RepresentationMapping('lon', 'R'),\n    ...                                     RepresentationMapping('lat', 'D')],\n    ...         r.CartesianRepresentation: [RepresentationMapping('x', 'a'),\n    ...                                     RepresentationMapping('y', 'b'),\n    ...                                     RepresentationMapping('z', 'c')]\n    ...     }\n    >>> fr = MyFrame4WithVelocity(R=1*u.deg, D=2*u.deg,\n    ...                           pm_R=3*u.mas/u.yr, pm_D=4*u.mas/u.yr)\n    >>> fr # doctest: +FLOAT_CMP\n    <MyFrame4WithVelocity Coordinate: (R, D) in deg\n        (1., 2.)\n    (pm_R, pm_D) in mas / yr\n        (3., 4.)>\n\nIf you want to override the default \"nicer\" names, you can specify a new key in\nthe ``frame_specific_representation_info`` for any of the ``Differential``\nclasses, for example::\n\n    >>> class MyFrame4WithVelocity2(BaseCoordinateFrame):\n    ...     # Specify how coordinate values are represented when outputted\n    ...     default_representation = r.SphericalRepresentation\n    ...     default_differential = r.SphericalDifferential\n    ...\n    ...     # Override component names (e.g., \"ra\" instead of \"lon\")\n    ...     frame_specific_representation_info = {\n    ...         r.SphericalRepresentation: [RepresentationMapping('lon', 'R'),\n    ...                                     RepresentationMapping('lat', 'D')],\n    ...         r.CartesianRepresentation: [RepresentationMapping('x', 'a'),\n    ...                                     RepresentationMapping('y', 'b'),\n    ...                                     RepresentationMapping('z', 'c')],\n    ...         r.SphericalDifferential: [RepresentationMapping('d_lon', 'pm1'),\n    ...                                   RepresentationMapping('d_lat', 'pm2'),\n    ...                                   RepresentationMapping('d_distance', 'rv')]\n    ...     }\n    >>> fr = MyFrame4WithVelocity2(R=1*u.deg, D=2*u.deg,\n    ...                           pm1=3*u.mas/u.yr, pm2=4*u.mas/u.yr)\n    >>> fr # doctest: +FLOAT_CMP\n    <MyFrame4WithVelocity2 Coordinate: (R, D) in deg\n        (1., 2.)\n    (pm1, pm2) in mas / yr\n        (3., 4.)>\n\n\nFinal Notes\n-----------\n\nYou can also define arbitrary methods for any added functionality you\nwant your frame to have that is unique to that frame. These methods will\nbe available in any |SkyCoord| that is created using your user-defined\nframe.\n\nFor examples of defining frame classes, the first place to look is\nat the source code for the frames that are included in ``astropy``\n(available at ``astropy.coordinates.builtin_frames``). These are not\nspecial-cased, but rather use all of the same API and features available to\nuser-created frames.\n\n.. topic:: Examples:\n\n    See also :ref:`sphx_glr_generated_examples_coordinates_plot_sgr-coordinate-frame.py`\n    for a more annotated example of defining a new coordinate frame.\n"},{"id":516,"name":"apply_space_motion.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. _astropy-coordinates-apply-space-motion:\n\nAccounting for Space Motion\n***************************\n\nThe |SkyCoord| object supports updating the position of a source given its space\nmotion and a time at which to evaluate the new position (or a difference\nbetween the coordinate's current time and a new one). This is\ndone using the :meth:`~astropy.coordinates.SkyCoord.apply_space_motion` method.\n\nExample\n-------\n\n..\n  EXAMPLE START\n  Accounting for Space Motion with SkyCoord Objects\n\nFirst we will create a |SkyCoord| object with a specified ``obstime``::\n\n    >>> import astropy.units as u\n    >>> from astropy.time import Time\n    >>> from astropy.coordinates import SkyCoord\n    >>> c = SkyCoord(l=10*u.degree, b=45*u.degree, distance=100*u.pc,\n    ...              pm_l_cosb=34*u.mas/u.yr, pm_b=-117*u.mas/u.yr,\n    ...              frame='galactic',\n    ...              obstime=Time('1988-12-18 05:11:23.5'))\n\nWe can now find the position at some other time, taking the space motion into\naccount. We can either specify the time difference between the observation time\nand the desired time::\n\n    >>> c.apply_space_motion(dt=10. * u.year) # doctest: +FLOAT_CMP\n    <SkyCoord (Galactic): (l, b, distance) in (deg, deg, pc)\n        ( 10.00013356,  44.999675,  99.99999994)\n     (pm_l_cosb, pm_b, radial_velocity) in (mas / yr, mas / yr, km / s)\n        ( 33.99980714, -117.00005604,  0.00034117)>\n    >>> c.apply_space_motion(dt=-10. * u.year) # doctest: +FLOAT_CMP\n    <SkyCoord (Galactic): (l, b, distance) in (deg, deg, pc)\n        ( 9.99986643,  45.000325,  100.00000006)\n     (pm_l_cosb, pm_b, radial_velocity) in (mas / yr, mas / yr, km / s)\n        ( 34.00019286, -116.99994395, -0.00034117)>\n\nOr, we can specify the new time to evaluate the position at::\n\n    >>> c.apply_space_motion(new_obstime=Time('2017-12-18 01:12:07.3')) # doctest: +FLOAT_CMP\n    <SkyCoord (Galactic): (l, b, distance) in (deg, deg, pc)\n        ( 10.00038732,  44.99905754,  99.99999985)\n     (pm_l_cosb, pm_b, radial_velocity) in (mas / yr, mas / yr, km / s)\n        ( 33.99944073, -117.00016248,  0.00098937)>\n\n..\n  EXAMPLE END\n\nIf the |SkyCoord| object has no specified radial velocity (RV), the RV is\nassumed to be 0. The new position of the source is determined assuming the\nsource moves in a straight line with constant velocity in an inertial frame.\nThere are no plans to support more complex evolution (e.g., non-inertial\nframes or more complex evolution), as that is out of scope for the ``astropy``\ncore package (although it may well be in-scope for a variety of affiliated\npackages).\n\nExample: Use velocity to compute sky position at different epochs\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n..\n  EXAMPLE START\n  Using Velocity to Compute Sky Position at Different Epochs\n\nIn this example, we will use *Gaia* `TGAS\n<https://www.cosmos.esa.int/web/gaia/dr1>`_ astrometry for a nearby star to\ncompute the sky position of the source on the date that the 2MASS survey\nobserved that region of the sky. The TGAS astrometry is provided on the\nreference epoch J2015.0, whereas the 2MASS survey occurred in the late 1990's.\nFor the star of interest, the proper motion is large enough that there are\nappreciable differences in the sky position between the two surveys.\n\nAfter computing the previous position of the source, we will then cross-match\nthe source with the 2MASS catalog to compute *Gaia*-2MASS colors for this object\nsource.\n\n.. note::\n\n    This example requires accessing data from the *Gaia* TGAS and 2MASS\n    catalogs. For convenience and speed below, we have created dictionary\n    objects that contain the data. We retrieved the data using the Astropy\n    affiliated package `astroquery <https://astroquery.readthedocs.io/>`_ using\n    the following queries::\n\n        import astropy.coordinates as coord\n        import astropy.units as u\n        from astroquery.gaia import Gaia\n        from astroquery.vizier import Vizier\n\n        job = Gaia.launch_job(\"SELECT TOP 1 * FROM gaiadr1.tgas_source \\\n            WHERE parallax_error < 0.3  AND parallax > 5 AND pmra > 100 \\\n            ORDER BY random_index\")\n        result_tgas = job.get_results()[0]\n\n        c_tgas = coord.SkyCoord(ra=result_tgas['ra'] * u.deg,\n                                dec=result_tgas['dec'] * u.deg)\n        v = Vizier(columns=[\"**\"], catalog=\"II/246/out\")\n        result_2mass = v.query_region(c, radius=1*u.arcmin)['II/246/out']\n\nThe TGAS data from relevant columns for this source (see queries in Note\nabove)::\n\n    >>> result_tgas = dict(ra=66.44280212823296,\n    ...                    dec=-69.99366255906372,\n    ...                    parallax=22.764078749733947,\n    ...                    pmra=144.91354358297048,\n    ...                    pmdec=5.445648092997134,\n    ...                    ref_epoch=2015.0,\n    ...                    phot_g_mean_mag=7.657174523348196)\n\nThe 2MASS data for all sources within 1 arcminute around the above position\n(see queries in Note above)::\n\n    >>> result_2mass = dict(RAJ2000=[66.421970000000002, 66.433521999999996,\n    ...                              66.420564999999996, 66.485068999999996,\n    ...                              66.467928999999998, 66.440815000000001,\n    ...                              66.440454000000003],\n    ...                     DEJ2000=[-70.003722999999994, -69.990768000000003,\n    ...                              -69.992255999999998, -69.994881000000007,\n    ...                              -69.994926000000007, -69.993613999999994,\n    ...                              -69.990836999999999],\n    ...                     Jmag=[16.35, 13.663, 16.171, 16.184, 16.292,\n    ...                           6.6420002, 12.275],\n    ...                     Hmag=[15.879, 13.955, 15.154, 15.856, 15.642,\n    ...                           6.3660002, 12.185],\n    ...                     Kmag=[15.581, 14.238, 14.622, 15.398, 15.123,\n    ...                           6.2839999, 12.106],\n    ...                     Date=['1998-10-24', '1998-10-24', '1998-10-24',\n    ...                           '1998-10-24', '1998-10-24', '1998-10-24',\n    ...                           '1998-10-24'])\n\nWe will first create a |SkyCoord| object from the information provided in the\nTGAS catalog. Note that we set the ``obstime`` of the object to the reference\nepoch provided by the TGAS catalog (J2015.0 in Barycentric Coordinate Time)::\n\n    >>> import astropy.units as u\n    >>> from astropy.coordinates import SkyCoord, Distance\n    >>> from astropy.time import Time\n    >>> c = SkyCoord(ra=result_tgas['ra'] * u.deg,\n    ...              dec=result_tgas['dec'] * u.deg,\n    ...              distance=Distance(parallax=result_tgas['parallax'] * u.mas),\n    ...              pm_ra_cosdec=result_tgas['pmra'] * u.mas/u.yr,\n    ...              pm_dec=result_tgas['pmdec'] * u.mas/u.yr,\n    ...              obstime=Time(result_tgas['ref_epoch'], format='jyear',\n    ...                           scale='tcb'))\n\nWe next create a |SkyCoord| object with the sky positions from the 2MASS\ncatalog, and an `~astropy.time.Time` object for the date of the 2MASS\nobservations provided in the 2MASS catalog (for the data in this region the\nobservation date is the same, so we take only the 0th value)::\n\n    >>> catalog_2mass = SkyCoord(ra=result_2mass['RAJ2000'] * u.deg,\n    ...                          dec=result_2mass['DEJ2000'] * u.deg)\n    >>> epoch_2mass = Time(result_2mass['Date'][0])\n\nWe can now use the :meth:`~astropy.coordinates.SkyCoord.apply_space_motion`\nmethod to compute the position of the TGAS source at another epoch. This uses\nthe proper motion and parallax information to evolve the position of the source\nassuming straight-line motion::\n\n    >>> c_2mass_epoch = c.apply_space_motion(epoch_2mass)\n\nNow that we have the coordinates of the TGAS source at the 2MASS epoch, we can\ndo the cross-match (see also :ref:`astropy-coordinates-separations-matching`)::\n\n    >>> idx, sep, _ = c_2mass_epoch.match_to_catalog_sky(catalog_2mass) # doctest: +SKIP\n    >>> sep[0].to_string() # doctest: +FLOAT_CMP +SKIP\n    '0d00m00.2818s'\n    >>> idx # doctest: +SKIP\n    array(5)\n\nThe closest source it found is 0.2818 arcseconds away and corresponds to\nrow index 5 in the 2MASS catalog. We can then, for example, compute *Gaia*-2MASS\ncolors::\n\n    >>> G = result_tgas['phot_g_mean_mag']\n    >>> J = result_2mass['Jmag'][idx] # doctest: +SKIP\n    >>> K = result_2mass['Kmag'][idx] # doctest: +SKIP\n    >>> G - J, G - K # doctest: +SKIP\n    (1.0151743233481962, 1.3731746233481958)\n\n..\n  EXAMPLE END\n"},{"col":4,"comment":"null","endLoc":892,"header":"def _read_d2im_old_format(self, header, fobj, axiscorr)","id":517,"name":"_read_d2im_old_format","nodeType":"Function","startLoc":858,"text":"def _read_d2im_old_format(self, header, fobj, axiscorr):\n        warnings.warn(\n            \"The use of ``AXISCORR`` for D2IM correction has been deprecated.\"\n            \"`~astropy.wcs` will read in files with ``AXISCORR`` but ``to_fits()`` will write \"\n            \"out files without it.\",\n            AstropyDeprecationWarning)\n        cpdis = [None, None]\n        crpix = [0., 0.]\n        crval = [0., 0.]\n        cdelt = [1., 1.]\n        try:\n            d2im_data = fobj[('D2IMARR', 1)].data\n        except KeyError:\n            return (None, None)\n        except AttributeError:\n            return (None, None)\n\n        d2im_data = np.array([d2im_data])\n        d2im_hdr = fobj[('D2IMARR', 1)].header\n        naxis = d2im_hdr['NAXIS']\n\n        for i in range(1, naxis + 1):\n            crpix[i - 1] = d2im_hdr.get('CRPIX' + str(i), 0.0)\n            crval[i - 1] = d2im_hdr.get('CRVAL' + str(i), 0.0)\n            cdelt[i - 1] = d2im_hdr.get('CDELT' + str(i), 1.0)\n\n        cpdis = DistortionLookupTable(d2im_data, crpix, crval, cdelt)\n\n        if axiscorr == 1:\n            return (cpdis, None)\n        elif axiscorr == 2:\n            return (None, cpdis)\n        else:\n            warnings.warn(\"Expected AXISCORR to be 1 or 2\", AstropyUserWarning)\n            return (None, None)"},{"id":518,"name":"docs/development","nodeType":"Package"},{"id":519,"name":"when_to_rebase.rst","nodeType":"TextFile","path":"docs/development","text":"*********************************\nWhen to rebase and squash commits\n*********************************\n\nThis page describes recommendations for when to rebase pull requests and when to\ncombine/squash commits.\n\nWhen to remove or combine/squash commits\n========================================\n\nPull requests **must** be rebased and at least partially squashed (but not\nnecessarily squashed to a single commit) if large (approximately >10KB)\nnon-source code files (e.g. images, data files, etc.) are added and then removed\nor modified in the PR commit history (The squashing should remove all but the\nlast addition of the file to not use extra space in the repository).\n\nCombining/squashing commits is **encouraged** when the number of commits\nis excessive for the changes made. The definition of 'excessive' is\nsubjective, but in general one should attempt to have individual commits be\nunits of change, and not include reversions.\nAs a concrete example, for a change affecting < 10 lines of source code and\nincluding a changelog entry, more than a few commits would be excessive.\nFor a larger pull request adding significant functionality, however, more\ncommits may well be appropriate.\n\nAs another guideline, squashing should remove extraneous information but\nshould not be used to remove useful information for how a PR was developed.  For\nexample, 4 commits that are testing  changes and have a commit message of just\n\"debug\" should be squashed.  But a series of commit messages that are\n\"Implemented feature X\", \"added test for feature X\", \"fixed bugs revealed by\ntests for feature X\" are useful information and should not be squashed away\nwithout reason.\n\nWhen squashing, extra care should be taken to keep authorship credit to all\nindividuals who provided substantial contribution to the given PR,\ne.g. only squash commits made by the same author.\n\nIn all cases, be mindful of maintaining a welcoming environment and be helpful\nwith advice, especially for new contributors.  E.g., It is expected that a\nmaintainer offer to help a contributor who is a novice git user do any squashing\nthat that maintainer asks for, or do the squash themselves by directly pushing\nto the PR branch.\n\nWhen to rebase\n==============\n\nPull requests **must** be rebased (but not necessarily squashed to a single\ncommit) if at least one of the following conditions is met:\n\n* There are conflicts with main\n* There are merge commits from upstream/main in the PR commit history (merge\n  commits from PRs to the user's fork are fine)\n* There are commit messages include offensive language or violate the code of\n  conduct (in this case the rebase must also edit the commit messages)\n\nGithub 'Squash and Merge' button\n================================\n\nWe should never use or enable the GitHub 'Squash and Merge' button since this\ncreates problems when dealing with identifying backports.\n"},{"id":520,"name":"ccython.rst","nodeType":"TextFile","path":"docs/development","text":".. _building-c-or-cython-extensions:\n\n**********************\nC or Cython Extensions\n**********************\n\nAstropy supports using C extensions for wrapping C libraries and Cython for\nspeeding up computationally-intensive calculations. Both Cython and C extension\nbuilding can be customized using the ``get_extensions`` function of the\n``setup_package.py`` file. If defined, this function must return a list of\n``setuptools.Extension`` objects. The creation process is left to the\nsubpackage designer, and can be customized however is relevant for the\nextensions in the subpackage.\n\nWhile C extensions must always be defined through the ``get_extensions``\nmechanism, Cython files (ending in ``.pyx``) are automatically located\nby `extension-helpers <https://extension-helpers.readthedocs.io/>`_ and\nloaded in separate extensions if they are not in ``get_extensions``. For\nCython extensions located in this way, headers for numpy C functions are\nincluded in the build, but no other external headers are included. ``.pyx``\nfiles present in the extensions returned by ``get_extensions`` are not\nincluded in the list of automatically generated extensions.\n\n.. note::\n\n    If a ``setuptools.Extension`` object is provided for Cython\n    source files using the ``get_extensions`` mechanism, it is very\n    important that the ``.pyx`` files be given as the ``source``, rather than the\n    ``.c`` files generated by Cython.\n\nUsing Numpy C headers\n=====================\n\nIf your C or Cython extensions uses `numpy` at the C level, you probably\nneed access to the numpy C headers.  When doing this, you should use\n``numpy.get_include()`` to specify the include directory to use, for example::\n\n    from setuptools import Extension\n    import numpy\n\n    def get_extensions():\n        return Extension(name='myextension', sources=['myext.c'],\n                         include_dirs=[numpy.get_include()])\n\n\nInstalling C header files\n=========================\n\nIf your C extension needs to be linked from other third-party C code,\nyou probably want to install its header files along side the Python module.\n\n    1) Create an ``include`` directory inside of your package for\n       all of the header files.\n\n    2) Use the ``[options.package_data]`` section in your ``setup.cfg``\n       file to include those header files in the package. For example, the\n       `astropy.wcs` package has the following entries in the\n       ``[options.package_data]`` section::\n\n           [options.package_data]\n           ...\n           astropy.wcs = include/*/*.h\n           ...\n\nPreventing importing at build time\n==================================\n\nIt is important to make sure that ``setup_package.py`` files do not trigger an\nimport of the package they are in - so they should be able to be executed without\nrelying on imports to other parts of the package.\n\nSpeed up your builds with ccache\n================================\n\n`ccache <https://en.wikipedia.org/wiki/Ccache>`_ is a tool that caches\ncompiled sources so that they don't have to be recompiled (so long as they are\nunchanged) even if the outputs have been deleted.  This means that if you\nswitch branches or clean your source checkout you can save a lot of time by\navoiding the majority of re-compiles from scratch.\n\nBecause installation and configuration of ccache varies from platform to\nplatform, please consult the ccache documentation and/or Google to set up\nccache on your system--this is strongly encouraged for anyone doing significant\ndevelopment of Astropy or scientific programming in general.\n"},{"id":521,"name":"docrules.rst","nodeType":"TextFile","path":"docs/development","text":":orphan:\n\n***********************\nAstropy Docstring Rules\n***********************\n\nThe rules for Astropy docstrings are now the same as those given in the\n[numpydoc documentation](https://numpydoc.readthedocs.io/en/latest/format.html).\n"},{"id":522,"name":"codeguide.rst","nodeType":"TextFile","path":"docs/development","text":".. doctest-skip-all\n.. _code-guide:\n\n*****************\nCoding Guidelines\n*****************\n\nThis section describes requirements and guidelines that should be followed both\nby the core package and by coordinated packages, and these are also recommended\nfor affiliated packages.\n\nInterface and Dependencies\n==========================\n\n* All code must be compatible with the versions of Python indicated by the\n  ``python_requires`` key in the `setup.cfg\n  <https://github.com/astropy/astropy/blob/main/setup.cfg>`_ file of the\n  core package.\n\n* Usage of ``six``, ``__future__``, and ``2to3`` is no longer acceptable.\n\n* `f-strings <https://docs.python.org/3/reference/lexical_analysis.html#f-strings>`_\n  should be used when possible, and if not, Python 3\n  formatting should be used (i.e. ``\"{0:s}\".format(\"spam\")``)\n  instead of the ``%`` operator (``\"%s\" % \"spam\"``).\n\n* The core package should be importable with no\n  dependencies other than components already in the Astropy core, the\n  `Python Standard Library <https://docs.python.org/3/library/index.html>`_,\n  and NumPy_ |minimum_numpy_version| or later.\n\n* Additional dependencies - such as SciPy_, Matplotlib_, or other\n  third-party packages - are allowed for sub-modules or in function\n  calls, but they must be noted in the package documentation and\n  should only affect the relevant component.  In functions and\n  methods, the optional dependency should use a normal ``import``\n  statement, which will raise an ``ImportError`` if the dependency is\n  not available. In the astropy core package, such optional dependencies should\n  be recorded in the ``setup.cfg`` file in the ``extras_require``\n  entry, under ``all`` (or ``test_all`` if the dependency is only\n  needed for testing).\n\n  At the module level, one can subclass a class from an optional dependency\n  like so::\n\n      try:\n          from opdep import Superclass\n      except ImportError:\n          warn(AstropyWarning('opdep is not present, so <functionality>'\n                              'will not work.'))\n          class Superclass(object): pass\n\n      class Customclass(Superclass):\n          ...\n\n* General utilities necessary for but not specific to the package or\n  sub-package should be placed in a ``packagename.utils`` module (e.g.\n  ``astropy.utils`` for the core package). If a utility is already present in\n  :mod:`astropy.utils`, packages should always use that utility instead of\n  re-implementing it in ``packagename.utils`` module.\n\nDocumentation and Testing\n=========================\n\n* Docstrings must be present for all public classes/methods/functions, and\n  must follow the form outlined in the :doc:`docguide` document.\n\n* Write usage examples in the docstrings of all classes and functions whenever\n  possible. These examples should be short and simple to reproduce--users\n  should be able to copy them verbatim and run them. These examples should,\n  whenever possible, be in the :ref:`doctest <doctests>` format and will be\n  executed as part of the test suite.\n\n* Unit tests should be provided for as many public methods and functions as\n  possible, and should adhere to the standards set in the :doc:`testguide`\n  document.\n\n\nData and Configuration\n======================\n\n* Packages can include data in a directory named ``data`` inside a subpackage\n  source directory as long as it is less than about 100 kB. These data should\n  always be accessed via the :func:`~astropy.utils.data.get_pkg_data_fileobj` or\n  :func:`~astropy.utils.data.get_pkg_data_filename` functions. If the data\n  exceeds this size, it should be hosted outside the source code repository,\n  either at a third-party location on the internet or the `astropy data server\n  <https://github.com/astropy/astropy-data>`_.\n  In either case, it should always be downloaded using the\n  :func:`~astropy.utils.data.get_pkg_data_fileobj` or\n  :func:`~astropy.utils.data.get_pkg_data_filename` functions. If a specific\n  version of a data file is needed, the hash mechanism described in\n  :mod:`astropy.utils.data` should be used.\n\n* All persistent configuration should use the\n  :ref:`astropy_config` mechanism.  Such configuration items\n  should be placed at the top of the module or package that makes use of them,\n  and supply a description sufficient for users to understand what the setting\n  changes.\n\nStandard output, warnings, and errors\n=====================================\n\nThe built-in ``print(...)`` function should only be used for output that\nis explicitly requested by the user, for example ``print_header(...)``\nor ``list_catalogs(...)``. Any other standard output, warnings, and\nerrors should follow these rules:\n\n* For errors/exceptions, one should always use ``raise`` with one of the\n  built-in exception classes, or a custom exception class. The\n  nondescript ``Exception`` class should be avoided as much as possible,\n  in favor of more specific exceptions (`IOError`, `ValueError`,\n  etc.).\n\n* For warnings, one should always use ``warnings.warn(message,\n  warning_class)``. These get redirected to ``log.warning()`` by default,\n  but one can still use the standard warning-catching mechanism and custom\n  warning classes. The warning class should be either\n  :class:`~astropy.utils.exceptions.AstropyUserWarning` or inherit from it.\n\n* For informational and debugging messages, one should always use\n  ``log.info(message)`` and ``log.debug(message)``.\n\nThe logging system uses the built-in Python :py:mod:`logging`\nmodule. The logger can be imported using::\n\n    from astropy import log\n\nCoding Style/Conventions\n========================\n\n* The code should follow the standard `PEP8 Style Guide for Python Code\n  <https://www.python.org/dev/peps/pep-0008/>`_. In particular, this includes\n  using only 4 spaces for indentation, and never tabs.\n\n* Our testing infrastructure currently enforces a subset of the PEP8 style\n  guide. You can check locally whether your changes have followed these by\n  running the following `tox <https://tox.readthedocs.io/>`__ command::\n\n    tox -e codestyle\n\n* *Follow the existing coding style* within a subpackage and avoid making\n  changes that are purely stylistic.  In particular, there is variation in the\n  maximum line length for different subpackages (typically either 80 or 100\n  characters).  Please try to maintain the style when adding or modifying code.\n\n* The use of automatic code formatters (e.g.,\n  `Black <https://black.readthedocs.io/en/stable/>`_) is strongly discouraged in\n  contributions to Astropy.\n\n* Following PEP8's recommendation, absolute imports are to be used in general.\n  The exception to this is relative imports of the form\n  ``from . import modname``, best when referring to files within the same\n  sub-module.  This makes it clearer what code is from the current submodule\n  as opposed to from another.\n\n  .. note:: There are multiple options for testing PEP8 compliance of code,\n            see :doc:`testguide` for more information.\n            See :doc:`codeguide_emacs` for some configuration options for Emacs\n            that helps in ensuring conformance to PEP8.\n\n* Astropy source code should contain a comment at the beginning of the file (or\n  immediately after the ``#!/usr/bin env python`` command, if relevant)\n  pointing to the license for the Astropy source code.  This line should say::\n\n      # Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n* The following naming conventions::\n\n    import numpy as np\n    import matplotlib as mpl\n    import matplotlib.pyplot as plt\n\n  should be used wherever relevant. On the other hand::\n\n    from packagename import *\n\n  should never be used, except as a tool to flatten the namespace of a module.\n  An example of the allowed usage is given in the :ref:`import-star-example`\n  example.\n\n* Classes should either use direct variable access, or Python’s property\n  mechanism for setting object instance variables. ``get_value``/``set_value``\n  style methods should be used only when getting and setting the values\n  requires a computationally-expensive operation. The\n  :ref:`prop-get-set-example` example below illustrates this guideline.\n\n* Classes should use the builtin `super` function when making calls to\n  methods in their super-class(es) unless there are specific reasons not to.\n  `super` should be used consistently in all subclasses since it does not\n  work otherwise. The :ref:`super-vs-direct-example` example below illustrates\n  why this is important.\n\n* Multiple inheritance should be avoided in general without good reason.\n  Multiple inheritance is complicated to implement well, which is why many\n  object-oriented languages, like Java, do not allow it at all.  Python does\n  enable multiple inheritance through use of the\n  `C3 Linearization <https://www.python.org/download/releases/2.3/mro/>`_\n  algorithm, which provides a consistent method resolution ordering.\n  Non-trivial multiple-inheritance schemes should not be attempted without\n  good justification, or without understanding how C3 is used to determine\n  method resolution order.  However, trivial multiple inheritance using\n  orthogonal base classes, known as the 'mixin' pattern, may be used.\n\n* ``__init__.py`` files for modules should not contain any significant\n  implementation code. ``__init__.py`` can contain docstrings and code for\n  organizing the module layout, however (e.g. ``from submodule import *``\n  in accord with the guideline above). If a module is small enough that\n  it fits in one file, it should simply be a single file, rather than a\n  directory with an ``__init__.py`` file.\n\n* Command-line scripts should follow the form outlined in the :doc:`scripts`\n  document.\n\n.. _handling-unicode:\n\nUnicode guidelines\n==================\n\nFor maximum compatibility, we need to assume that writing non-ASCII\ncharacters to the console or to files will not work.  However, for\nthose that have a correctly configured Unicode environment, we should\nallow them to opt-in to take advantage of Unicode output when\nappropriate.  Therefore, there is a global configuration option,\n``astropy.conf.unicode_output`` to enable Unicode output of values, set\nto `False` by default.\n\nThe following conventions should be used for classes that define the\nstandard string conversion methods (``__str__``, ``__repr__``,\n``__bytes__``, and ``__format__``).  In the bullets\nbelow, the phrase \"string instance\" is used to refer to `str`, while\n\"bytes instance\" is used to refer to `bytes`.\n\n- ``__repr__``: Return a \"string instance\" containing only 7-bit characters.\n\n- ``__bytes__``: Return a \"bytes instance\" containing only 7-bit characters.\n\n- ``__str__``: Return a \"string instance\".\n  If ``astropy.conf.unicode_output`` is `False`, it must contain\n  only 7-bit characters.  If ``astropy.conf.unicode_output`` is `True`, it\n  may contain non-ASCII characters when applicable.\n\n- ``__format__``: Return a \"string instance\".  If\n  ``astropy.conf.unicode_output`` is `False`, it must contain only 7-bit\n  characters.  If ``astropy.conf.unicode_output`` is `True`, it may contain\n  non-ASCII characters when applicable.\n\nFor classes that are expected to roundtrip through strings (unicode or\nbytes), the parser must accept the output of ``__str__``.\nAdditionally, ``__repr__`` should roundtrip when that makes sense.\n\nThis design generally follows Postel's Law: \"Be liberal in what you\naccept, and conservative in what you send.\"\n\nThe following example class shows a way to implement this::\n\n    # -*- coding: utf-8 -*-\n\n    from astropy import conf\n\n    class FloatList(object):\n        def __init__(self, init):\n            if isinstance(init, str):\n                init = init.split('‖')\n            elif isinstance(init, bytes):\n                init = init.split(b'|')\n            self.x = [float(x) for x in init]\n\n        def __repr__(self):\n            # Return unicode object containing no non-ASCII characters\n            return f'<FloatList [{\", \".join(str(x) for x in self.x)}]>'\n\n        def __bytes__(self):\n            return b'|'.join(bytes(x) for x in self.x)\n\n        def __str__(self):\n            if astropy.conf.unicode_output:\n                return '‖'.join(str(x) for x in self.x)\n            else:\n                return self.__bytes__().decode('ascii')\n\nAdditionally, there is a test helper,\n``astropy.test.helper.assert_follows_unicode_guidelines`` to ensure that a\nclass follows the Unicode guidelines outlined above.  The following\nexample test will test that our example class above is compliant::\n\n    def test_unicode_guidelines():\n        from astropy.test.helper import assert_follows_unicode_guidelines\n        assert_follows_unicode_guidelines(FloatList(b'5|4|3|2'), roundtrip=True)\n\nIncluding C Code\n================\n\n* C extensions are only allowed when they provide a significant performance\n  enhancement over pure Python, or a robust C library already exists to\n  provided the needed functionality. When C extensions are used, the Python\n  interface must meet the aforementioned Python interface guidelines.\n\n* The use of Cython_ is strongly recommended for C extensions. Cython_\n  extensions should store ``.pyx`` files in the source code repository,\n  but not the generated ``.c`` files.\n\n* If a C extension has a dependency on an external C library, the source code\n  for the library should be bundled with the Astropy core, provided the\n  license for the C library is compatible with the Astropy license.\n  Additionally, the package must be compatible with using a system-installed\n  library in place of the library included in Astropy, and a user installing\n  the package should be able to opt-in to using the system version using\n  a ``ASTROPY_USE_SYSTEM_???`` environment variable, where ``???`` is the name\n  of the library, e.g. ``ASTROPY_USE_SYSTEM_WCSLIB`` (see also\n  :ref:`external_c_libraries`).\n\n* In cases where C extensions are needed but Cython_ cannot be used, the `PEP 7\n  Style Guide for C Code <https://www.python.org/dev/peps/pep-0007/>`_ is\n  recommended.\n\n* C extensions (Cython_ or otherwise) should provide the necessary information\n  for building the extension via the mechanisms described in\n  :ref:`building-c-or-cython-extensions`.\n\n\nRequirements Specific to Affiliated Packages\n============================================\n\n* Affiliated packages implementing many classes/functions not relevant to\n  the affiliated package itself (for example leftover code from a previous\n  package) will not be accepted - the package should only include the\n  required functionality and relevant extensions.\n\n* Affiliated packages must be registered on the `Python Package Index\n  <https://pypi.org/>`_, with proper metadata for downloading and\n  installing the source package.\n\n* The ``astropy`` root package name should not be used by affiliated\n  packages - it is reserved for use by the core package.\n\nExamples\n========\n\nThis section shows a few examples (not all of which are correct!) to\nillustrate points from the guidelines.\n\n.. _prop-get-set-example:\n\nProperties vs. get\\_/set\\_\n--------------------------\n\nThis example shows a sample class illustrating the guideline regarding the use\nof properties as opposed to getter/setter methods.\n\nLet's assuming you've defined a ``Star`` class and create an instance\nlike this::\n\n    >>> s = Star(B=5.48, V=4.83)\n\nYou should always use attribute syntax like this::\n\n    >>> s.color = 0.4\n    >>> print(s.color)\n    0.4\n\nRather than like this::\n\n    >>> s.set_color(0.4)  # Bad form!\n    >>> print(s.get_color())  # Bad form!\n    0.4\n\nUsing Python properties, attribute syntax can still do anything possible with\na get/set method. For lengthy or complex calculations, however, use a method::\n\n    >>> print(s.compute_color(5800, age=5e9))\n    0.4\n\n.. _super-vs-direct-example:\n\nsuper() vs. Direct Calling\n--------------------------\n\nThis example shows why the use of `super` leads to a more consistent\nmethod resolution order than manually calling methods of the super classes in a\nmultiple inheritance case::\n\n    # This is dangerous and bug-prone!\n\n    class A(object):\n        def method(self):\n            print('Doing A')\n\n\n    class B(A):\n        def method(self):\n            print('Doing B')\n            A.method(self)\n\n\n    class C(A):\n        def method(self):\n            print('Doing C')\n            A.method(self)\n\n    class D(C, B):\n        def method(self):\n            print('Doing D')\n            C.method(self)\n            B.method(self)\n\nif you then do::\n\n    >>> b = B()\n    >>> b.method()\n\nyou will see::\n\n    Doing B\n    Doing A\n\nwhich is what you expect, and similarly for C. However, if you do::\n\n    >>> d = D()\n    >>> d.method()\n\nyou might expect to see the methods called in the order D, B, C, A but instead\nyou see::\n\n    Doing D\n    Doing C\n    Doing A\n    Doing B\n    Doing A\n\nbecause both ``B.method()`` and ``C.method()`` call ``A.method()`` unaware of\nthe fact that they're being called as part of a chain in a hierarchy.  When\n``C.method()`` is called it is unaware that it's being called from a subclass\nthat inherits from both ``B`` and ``C``, and that ``B.method()`` should be\ncalled next.  By calling `super` the entire method resolution order for\n``D`` is precomputed, enabling each superclass to cooperatively determine which\nclass should be handed control in the next `super` call::\n\n    # This is safer\n\n    class A(object):\n        def method(self):\n            print('Doing A')\n\n    class B(A):\n        def method(self):\n            print('Doing B')\n            super().method()\n\n\n    class C(A):\n        def method(self):\n            print('Doing C')\n            super().method()\n\n    class D(C, B):\n        def method(self):\n            print('Doing D')\n            super().method()\n\n::\n\n    >>> d = D()\n    >>> d.method()\n    Doing D\n    Doing C\n    Doing B\n    Doing A\n\nAs you can see, each superclass's method is entered only once.  For this to\nwork it is very important that each method in a class that calls its\nsuperclass's version of that method use `super` instead of calling the\nmethod directly.  In the most common case of single-inheritance, using\n``super()`` is functionally equivalent to calling the superclass's method\ndirectly.  But as soon as a class is used in a multiple-inheritance\nhierarchy it must use ``super()`` in order to cooperate with other classes in\nthe hierarchy.\n\n.. note:: For more information on the the benefits of `super`, see\n          https://rhettinger.wordpress.com/2011/05/26/super-considered-super/\n\n.. _import-star-example:\n\nAcceptable use of ``from module import *``\n------------------------------------------\n\n``from module import *`` is discouraged in a module that contains\nimplementation code, as it impedes clarity and often imports unused variables.\nIt can, however, be used for a package that is laid out in the following\nmanner::\n\n    packagename\n    packagename/__init__.py\n    packagename/submodule1.py\n    packagename/submodule2.py\n\nIn this case, ``packagename/__init__.py`` may be::\n\n    \"\"\"\n    A docstring describing the package goes here\n    \"\"\"\n    from submodule1 import *\n    from submodule2 import *\n\nThis allows functions or classes in the submodules to be used directly as\n``packagename.foo`` rather than ``packagename.submodule1.foo``. If this is\nused, it is strongly recommended that the submodules make use of the ``__all__``\nvariable to specify which modules should be imported. Thus, ``submodule2.py``\nmight read::\n\n    from numpy import array, linspace\n\n    __all__ = ['foo', 'AClass']\n\n    def foo(bar):\n        # the function would be defined here\n        pass\n\n    class AClass(object):\n        # the class is defined here\n        pass\n\nThis ensures that ``from submodule import *`` only imports ``foo`` and\n``AClass``, but not `numpy.array` or `numpy.linspace`.\n\n\nAdditional Resources\n====================\n\nFurther tips and hints relating to the coding guidelines are included below.\n\n.. toctree::\n    :maxdepth: 1\n\n    codeguide_emacs\n\n.. _Numpy: https://numpy.org/\n.. _Scipy: https://www.scipy.org/\n.. _matplotlib: https://matplotlib.org/\n.. _Cython: https://cython.org/\n.. _PyPI: https://pypi.org/project\n"},{"id":523,"name":"codeguide_emacs.rst","nodeType":"TextFile","path":"docs/development","text":"*******************************************\nEmacs setup for following coding guidelines\n*******************************************\n\n.. _flycheck: https://www.flycheck.org/\n.. _flake8: http://flake8.pycqa.org/\n\nThe Astropy coding guidelines are listed in :doc:`codeguide`. Here, we describe\nhow to configure Emacs to help ensure Python code satisfies the guidelines.\n\nFor this setup, we add to the standard ``python-mode`` using flycheck_ and the\nflake8_ python style checker.  For installation instructions, see their\nrespective web sites (or install via your distribution; e.g., in Debian/Ubuntu,\nthe packages are called ``elpa-flycheck`` and ``flake8``).\n\n.. note:: Emacs can be configured in several different ways. So instead of\n          providing a drop in configuration file, only the individual\n          configurations are presented below.\n\n          The setup below is on purpose minimal.  In principle, it is possible\n          to use `Emacs for Python development\n          <https://realpython.com/emacs-the-best-python-editor/>`_,\n          with, e.g., `elpy <https://elpy.readthedocs.io/>`_.\n\nNo tabs\n=======\n\nThis setting will cause indentation to use spaces rather than tabs for all\nfiles.  For python files, indentation of 4 spaces will be used if the tab key\nis pressed.\n\n.. code-block:: scheme\n\n  ;; Don't use TABS for indentations.\n  (setq-default indent-tabs-mode nil)\n\nDelete trailing white spaces\n============================\n\nOne can `delete trailing whitespace\n<https://www.emacswiki.org/emacs/DeletingWhitespace#toc3>`_ with ``M-x\ndelete-trailing-whitespace``. To ensure this is done every time a python file\nis saved, use:\n\n.. code-block:: scheme\n\n  ;; Automatically remove trailing whitespace when file is saved.\n  (add-hook 'python-mode-hook\n  (lambda () (add-to-list 'write-file-functions 'delete-trailing-whitespace)))\n\nIf you want to use this for every type of file, you can use\n``(add-hook 'before-save-hook 'delete-trailing-whitespace)``.\n\nFlycheck\n========\n\nOne can make lines that do not satisfy syntax requirements using flycheck_.\nWhen the cursor is on such a line a message is displayed in the mini-buffer.\nWhen mouse pointer is on such a line a \"tool tip\" message is also shown. By\ndefault, flycheck_ will check if flake8_ is installed and, if so, use that for\nits syntax checking. To ensure flycheck_ starts upon opening python files, add:\n\n.. code-block:: scheme\n\n  (add-hook 'python-mode-hook 'flycheck-mode)\n\nAlternatively, you can just use ``(global-flycheck-mode)`` to run flycheck\nfor all languages it supports.\n"},{"id":524,"name":"releasing.rst","nodeType":"TextFile","path":"docs/development","text":"**********************************************\nRelease procedure for the astropy core package\n**********************************************\n\nThis page describes the release process for the core astropy package. For the average\ncoordinated or affiliated package, you can instead check\n:ref:`these <simple-release-docs>` instructions which will be a lot simpler.\n\nThe lifetime of a major release cycle of the core package is as follows:\n\n* Feature freeze, which consists of creating a release branch\n* Release candidates followed by a final release for the first version of the release cycle\n* Bugfix releases - for LTS releases, bugfix releases continue to be made for\n  two years, while for non-LTS releases they stop as soon as a new major release\n  is done.\n\nThe instructions on this page follow the lifetime of a major release chronologically,\nand applies to both LTS and non-LTS releases (whenever any step doesn't apply to one\nof these, this is indicated explicitly).\n\n.. note::\n\n   You may need to replace ``upstream`` on this page with ``astropy`` or\n   whatever remote name you use for the `astropy core repository`_.\n\n.. _release-procedure-new-major:\n\nStart of a new release cycle - feature freeze and branching\n===========================================================\n\nAs outlined in\n`APE2 <https://github.com/astropy/astropy-APEs/blob/main/APE2.rst>`_, astropy\ncore package major releases occur at regular intervals. The first step in a major release\ncycle is to perform a *feature freeze* which means that we create a new release\nbranch based on the (at the time) latest developer version, and we then subsequently\nno longer add any features to this release branch - only bug fixes, documentation\nupdates, and so on. New features can then continue to be added in parallel to the ``main`` branch.\n\nThe procedure for the feature freeze is as follows:\n\n#. On the GitHub issue tracker, add a new milestone for the next major version\n   and for the next bugfix version, and also create a ``backport-v<version>.x``\n   label which can be used to label pull requests that should be backported\n   to the new release branch. You can then start to move any issues and pull\n   requests that you know will not be included in the release to the next milestones.\n\n#. Well in advance of the feature freeze date, advertise to developers when the\n   feature freeze will happen and encourage developers to re-milestone pull\n   requests to the next version (not the one you are releasing now) if they\n   will not be ready in time.\n\n#. Once you are ready to make the release branch, update your local ``main`` branch to the latest version from GitHub::\n\n      $ git fetch upstream --tags --prune\n      $ git checkout -B main upstream/main\n\n#. Create a new branch from ``main`` at the point you want the feature freeze to\n   occur::\n\n      $ git branch v<version>.x\n\n   Note that you do not yet need to switch to this branch yet - the following steps\n   should still be done on ``main``.\n\n#. Update the \"What's new?\" section of the documentation to include a section for the\n   next major version (for example if you are in the process of releasing 5.0, you\n   would need to create a page for the 5.1 release). For instance you can start by copying the latest existing one::\n\n      $ cp docs/whatsnew/<current_version>.rst docs/whatsnew/<next_version>.rst\n\n   You'll then need to edit ``docs/whatsnew/<next_version>.rst``, removing all\n   the content but leaving the basic structure.  You may also need to\n   replace the \"by the numbers\" numbers with \"xxx\" as a reminder to update them\n   before the next release. Then add the new version to the top of\n   ``docs/whatsnew/index.rst``, update the reference in ``docs/index.rst`` to\n   point to the that version.\n\n#. Update the \"What's new?\" section of the current version you are doing the release for,\n   ``docs/whatsnew/<current_version>.rst``, and remove all content, replacing it\n   with::\n\n      :orphan:\n\n      `What's New in Astropy <current_version>?\n      <https://docs.astropy.org/en/v<current_version>/whatsnew/<current_version>.html>`__\n\n   This is because we want to make sure that links in the previous \"What's new?\" pages continue\n   to work and reference the original link they referenced at the time of writing.\n\n#. Commit these changes::\n\n      $ git add docs/whatsnew/<current_version>.rst\n      $ git add docs/whatsnew/<next_version>.rst\n      $ git add docs/whatsnew/index.rst\n      $ git add docs/index.rst\n      $ git commit -m \"Added <next_version> what's new page and redirect <current_version> what's new page\"\n\n#. Tag this commit using the next major version followed by ``.dev``. For example,\n   if you have just branched ``v5.0.x``, create the ``v5.1.dev`` tag::\n\n      $ git tag -s \"v<next_version>.dev\" -m \"Back to development: v<next_version>\"\n\n#. Push all of these changes up to GitHub::\n\n      $ git push upstream v<version>.x:v<version>.x\n      $ git push upstream main:main\n      $ git push upstream v<next_version>.dev:v<next_version>.dev\n\n#. Inform the Astropy developer community that the branching has occurred.\n\n.. _release-procedure-first-rc:\n\nReleasing the first major release candidate\n===========================================\n\n.. _release-procedure-restrict-branch:\n\nRestricting changes to the release branch\n-----------------------------------------\n\nThis step is optional and could also be done at a later stage in the release process,\nbut you may want to temporarily restrict who can push/merge pull requests to the\nrelease branch so that someone does not inadvertantly push changes to the release\nbranch while you are in the middle of following release steps. If you wish to do this,\nyou can go to the core package repository settings, and under 'Branches' and 'Branch\nprotection rules' you can then add a rule which restricts who can push to the branch.\n\n.. _release-procedure-update-iers:\n\nUpdating the IERS parameter and leap second tables\n--------------------------------------------------\n\nEnsure the built-in IERS earth rotation parameter and leap second tables are up\nto date by changing directory to ``astropy/utils/iers/data`` and executing\n``update_builtin_iers.sh``. Check the result with ``git diff`` (do not be\nsurprised to find many lines in the ``eopc04_IAU2000.62-now`` file change; those\ndata are reanalyzed periodically) and committing. This update should be done via a\npull request to the ``main`` branch, and then backported to the release branch,\nas it is important for the ``main`` branch to have up-to-date values, and donig it\nvia a pull request allows us to check for any failures the update introduces.\n\n.. _release-procedure-update-whatsnew:\n\nUpdating the What's new and contributors\n----------------------------------------\n\nMake sure to update the \"What's new\"\nsection with the stats on the number of issues, PRs, and contributors.\nSince the What's New for the major release is now only present in the release\nbranch, you should switch to it to, e.g.::\n\n   $ git checkout v5.0.x\n\nTo find the statistics and contributors, use the `generate_releaserst.xsh`_\nscript. This requires `xonsh <https://xon.sh/>`_ and `docopt\n<http://docopt.org/>`_ which you can install with::\n\n   pip install xonsh docopt\n\nYou should then run the script in the root of the astropy repository as follows::\n\n   xonsh generate_releaserst.xsh 4.3 v5.0.dev \\\n                                 --project-name=astropy \\\n                                 --pretty-project-name=astropy \\\n                                 --pat=<a GitHub personal access token>\n\nThe first argument should be the last major version (before any bug fix\nreleases, while the second argument should be the ``.dev`` tag that was just\nafter the branching of the last major version. Finally, you will need a\nGitHub personal access token with default permissions (no scopes selected).\n\nThe output will look similar to::\n\n   This release of astropy contains 2573 commits in 163 merged pull requests\n   closing 104 issues from 98 people, 50 of which are first-time contributors\n   to astropy.\n\n   * 2573 commits have been added since 4.3\n   * 104 issues have been closed since 4.3\n   * 163 pull requests have been merged since 4.3\n   * 98 people have contributed since 4.3\n   * 50 of which are new contributors\n\n   The people who have contributed to the code for this release are:\n\n   - Name 1 *\n   - Name 2 *\n   - Name 3\n\nAt this point, you will likely need to update the Astropy ``.mailmap`` file,\nwhich maps contributor emails to names, as there are often contributors who\nare not careful about using the same e-mail address for every commit, meaning\nthat they appear multiple times in the contributor list above, sometimes with\ndifferent spelling, and sometimes you may also just see their GitHub username\nwith no full name.\n\nThe easiest way to get a full list of contributors and email addresses is\nto do::\n\n   git shortlog -n -s -e\n\nEdit the ``.mailmap`` file to add entries for new email addresses for already\nknown contributors (matched to the appropriate canonical name/email address).\nYou can also try and investigate users with no name to see if you can determine\ntheir full name from other sources - if you do, add a new entry for them in\nthe ``.mailmap`` file. Once you have done this, you can re-run the\n``generate_releaserst.xsh`` script (you will likely need to iterate a few times).\nOnce you are happy with the output, copy it into the 'What's new' page for\nthe current release and commit this. E.g., ::\n\n   $ git add docs/whatsnew/5.0.rst\n   $ git commit -m \"Added contributor statistics and names\"\n\nPush the release branch back to GitHub, e.g.::\n\n      $ git push upstream v5.0.x\n\nSwitch to a new branch that tracks the ``main`` branch and update the\n``docs/credits.rst`` file to include any new contributors from the above step,\nand commit this and the ``.mailmap`` changes::\n\n   $ git checkout -b v5.0-mailmap-credits upstream/main\n   $ git add .mailmap\n   $ git add docs/credits.rst\n   $ git commit -m \"Updated list of contributors and .mailmap file\"\n\nOpen a pull request to merge this into ``main`` and mark it as requiring backporting to\nthe release branch.\n\n\n.. _release-procedure-update-ci:\n\nUpdate continuous integration configuration\n-------------------------------------------\n\nUpdate the continuous integration configuration in the release branch\nto run on all commits rather than use cron jobs. For example, for GitHub actions,\nyou should edit the ``ci_cron*.yml`` files and replace the existing ``on`` section\nwith e.g.::\n\n   on:\n   push:\n      branches:\n      - v5.0.x\n   pull_request:\n      branches:\n      - v5.0.x\n\n(with the branch name replaced by the appropriate one), and remove any lines that\nlook like e.g.::\n\n        if: (github.repository == 'astropy/astropy' && (github.event_name == 'schedule' ...\n\nThis is important because once you are on a release branch, it is necessary to make sure\nwe are much more careful about not introducing regressions and we cannot always wait for the\ncron jobs to run to carry out the release.\n\n.. _release-procedure-check-ci:\n\nEnsure continuous integration and intensive tests pass\n------------------------------------------------------\n\nMake sure that the continuous integration services (e.g., GitHub Actions or CircleCI) are passing\nfor the `astropy core repository`_ branch you are going to release. Also check that\nthe `Azure core package pipeline`_ which builds wheels on the ``v*`` branches is passing.\nAlso make sure that the ReadTheDocs build is passing for the release branch.\n\nYou may also want to locally run the tests (with remote data on to ensure all\nof the tests actually run), using tox to do a thorough test in an isolated\nenvironment::\n\n   $ pip install tox --upgrade\n   $ TEST_READ_HUGE_FILE=1 tox -e test-alldeps -- --remote-data=any\n\nAdditional notes\n----------------\n\nDo not render the changelog with towncrier at this point. This should only be done just before the final\nrelease. However, it is up to the discretion of the release manager whether to\nopen 'practice' pull requests to do this as part of the beta/release candidate\nprocess (but they should not be merged in) - if so the process for rendering the changelog is described\nin :ref:`release-procedure-render-changelog`.\n\n.. _release-procedure-tagging:\n\nTagging the first release candidate\n-----------------------------------\n\nAssuming all the CI passes, you should now be ready to do a first release\ncandidate! Ensure you have a GPG key pair available for when git needs to sign\nthe tag you create for the release (see e.g.,\n`GitHub's documentation <https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key>`_\nfor how to generate a key pair).\n\nMake sure your local release branch is up-to-date with the upstream release\nbranch, then tag the latest commit with the ``-s`` option, including an ``rc1``\nsuffix, e.g.::\n\n      $ git tag -s v5.0rc1 -m \"Tagging v5.0rc1\"\n\nPush up the tag to the `astropy core repository`_, e.g.::\n\n      $ git push upstream v5.0rc1\n\n.. warning::\n\n   It might be tempting to use the ``--tags`` argument to ``git push``,\n   but this should *not* be done, as it might push up some unintended tags.\n\nAt this point if all goes well, the wheels and sdist will be build\nin the `Azure core package pipeline`_ and uploaded to PyPI!\n\nIn the event there are any issues with the wheel building for the tag\n(which shouldn't really happen if it was passing for the release branch),\nyou'll have to fix whatever the problem is. Make sure you delete the\ntag::\n\n   git tag -d v<version>\n\nMake any fixes by adding commits to the release branch (no need to remove\nprevious commits) e.g. via pull requests to the release branch, backports,\nor direct commits on the release branch, as appropriate. Once you are\nready to try and release again, create the tag, then force push the tag\nto GitHub to overwrite the previous one.\n\nOnce the sdist and wheels are uploaded, the first release candidate is done!\n\nAt this point create a new Wiki page under\n`Astropy Project Wiki <https://github.com/astropy/astropy/wiki>`_ with the\ntitle \"vX.Y RC testing\" (replace \"X.Y\" with the release number) using the\n`wiki of a previous RC <https://github.com/astropy/astropy/wiki/v3.2-RC-testing>`_\nas a template. You can now email the user and developer community advertising\nthe release candidate and including a link to the wiki page to report any\nsuccesses and failures.\n\nReleasing subsequent release candidates\n=======================================\n\nIt is very likely that some issues will be reported with the first release\ncandidate. Any issues should be fixed via pull requests to the ``main`` branch\nand marked for backporting to the release branch. The process for backporting\nfixes is described in :ref:`release-procedure-bug-fix-backport`.\n\nOnce you have backported any required fixes, repeat the following steps\nyou did for the first release candidate:\n\n* :ref:`release-procedure-update-iers` (optional, only do this if it has been a while since it was done before the first release candidate)\n* :ref:`release-procedure-update-whatsnew` (this should only involve updating the numbers of issues and so on, as well as potentially adding a few new contributors)\n* :ref:`release-procedure-check-ci`\n\nYou can then proceed with tagging the second release candidate, as done in\n* :ref:`release-procedure-tagging` and replacing ``rc1`` with ``rc2``.\n\nYou can potentially repeat this section for a third or even fourth release candidate if needed. Once no major issues\ncome up with a release candidate, you are ready to proceed to the next section.\n\nReleasing the final version of the major release\n================================================\n\n.. _release-procedure-render-changelog:\n\nRendering the changelog\n-----------------------\n\n.. warning:: Make sure that you have a very recent version of towncrier - at the time of\n             writing you will need the 21.9.0rc1 pre-release for things to work correctly::\n\n                $ pip install towncrier==21.9.0rc1\n\nWe now need to render the changelog with towncrier. Since it is a good idea to\nreview the changelog and fix any line wrap and other issues, we do this on\na separate branch and open a pull request into the release branch to allow for\neasy review. First, create and switch to a new branch based off the release\nbranch, e.g.::\n\n   $ git checkout -b v5.0-changelog\n\nNext, run towncrier and confirm that the fragments can be deleted::\n\n      towncrier build --version 5.0\n\nCheck the ``CHANGES.rst`` file and remove any empty sections from the new\nchangelog section.\n\nThen add and commit those changes with::\n\n   $ git add CHANGES.rst\n   $ git commit -m \"Finalizing changelog for v<version>\"\n\nPush to GitHub and open a pull request for merging this into the release branch,\ne.g. v5.0.x.\n\nIn cases where an LTS branch and a different release branch are being maintained,\nthe changelog should be rendered on both branches separately, and only the\nrendering from the non-LTS release branch should be forward-ported to ``main``.\n\n.. note::\n\n   We render the changelog on the latest release branch and forward-port it\n   rather than rendering on ``main`` and backporting, since the latter would\n   render all news fragments into the changelog rather than only the ones\n   intended for the e.g. v5.0.x release branch.\n\n.. _release-procedure-checking-changelog:\n\nChecking the changelog\n----------------------\n\nScripts are provided at https://github.com/astropy/astropy-tools/tree/main/pr_consistency\nto check for consistency between milestones, labels, the presence of pull requests\nin release branches, and the changelog. Follow the instructions in that repository\nto make sure everything is correct for the present release.\n\nTagging the final release\n-------------------------\n\nOnce the changelog pull request is merged, update your release branch to\nmatch the upstream version, then (on the release branch), tag the merge\ncommit for the changelog changes with ``v<version>`` - as described in\n:ref:`release-procedure-tagging` but leaving out the ``rc1`` suffix, then\npush the tag to GitHub and wait for the wheels and sdist to be uploaded to\nPyPI.\n\nCongratulations!  You have completed the release! Now there are just a few\nclean-up tasks to finalize the process.\n\n.. _post-release-procedure:\n\nPost-Release procedures\n-----------------------\n\n#. If this is a release of the current release (i.e., not an LTS supported along\n   side a more recent version), update the \"stable\" branch to point to the new\n   release::\n\n      $ git checkout stable\n      $ git reset --hard v<version>\n      $ git push upstream stable --force\n\n#. If this is an LTS release (whether or not it is being supported alongside\n   a more recent version), update the \"LTS\" branch to ponit to the new LTS\n   release:\n\n      $ git checkout LTS\n      $ git reset --hard v<version>\n      $ git push upstream LTS --force\n\n#. Update Readthedocs so that it builds docs for the version you just released.\n   You'll find this in the \"Admin\" tab, in the \"Edit Versions\" section --\n   click on \"Activate\" for the tag of the release you have just done.\n   Also verify that the ``stable`` Readthedocs version builds correctly for\n   the new version (it should trigger automatically once you've done the\n   previous step).\n\n#. When releasing a patch release, also set the previous RTD version in the\n   release history to \"Hidden\".  For example when releasing v5.0.2, set\n   v5.0.1 to \"Hidden\".  This prevents the previous releases from\n   cluttering the list of versions that users see in the version dropdown\n   (the previous versions are still accessible by their URL though).\n\n#. If you have updated the list of contributors during the release, update the\n   equivalent list on the Astropy web site at\n   https://github.com/astropy/astropy.github.com.\n\n#. Cherry-pick the commit rendering the changelog and deleting the fragments and\n   open a PR to the astropy *main* branch. Also make sure you cherry-pick the\n   commit updating the ``.mailmap`` and ``docs/credits.rst`` files to the *main*\n   branch in a separate PR.\n\n#. Turn off any branch protection you might have enabled in\n   :ref:`release-procedure-restrict-branch`.\n\n#. ``conda-forge`` has a bot that automatically opens\n   a PR from a new PyPI (stable) release, which you need to follow up on and\n   merge. Meanwhile, for a LTS release, you still have to manually open a PR\n   at `astropy-feedstock <https://github.com/conda-forge/astropy-feedstock/>`_.\n   This is similar to the process for wheels.\n   When the ``conda-forge`` package is ready, email the Anaconda maintainers\n   about the release(s) so they can update the versions in the default channels.\n   Typically, you should wait to make sure ``conda-forge`` and possibly\n   ``conda`` works before sending out the public announcement\n   (so that users who want to try out the new version can do so with ``conda``).\n\n#. Upload the release to Zenodo by creating a GitHub Release off the GitHub tag.\n   Click on the tag in https://github.com/astropy/astropy/tags and then click on\n   \"Create release from tag\" on the upper right. The release title is the same as the\n   tag. In the description, you can copy and paste a description from the previous\n   release, as it should be a one-liner that points to ``CHANGES.rst``. When you\n   are ready, click \"Publish release\" (the green button on bottom left).\n   A webhook to Zenodo will be activated and the release will appear under\n   https://doi.org/10.5281/zenodo.4670728 . If you encounter problems during this\n   step, please contact the Astropy Coordination Committee.\n\n#. Once the release(s) are available on the default ``conda`` channels,\n   prepare the public announcement. Use the previous announcement as a template,\n   but link to the release tag instead of ``stable``. For a new major release,\n   you should coordinate with the rest of the Astropy release team and the\n   community engagement coordinators. Meanwhile, for a bugfix release, you can\n   proceed to send out an email to the ``astropy-dev`` and Astropy mailing\n   lists.\n\n.. _release-procedure-bug-fix:\n\nMaintaining Bug Fix Releases\n============================\n\nAstropy releases, as recommended for most Python projects, follows a\n<major>.<minor>.<micro> version scheme, where the \"micro\" version is also\nknown as a \"bug fix\" release.  Bug fix releases should not change any user-\nvisible interfaces.  They should only fix bugs on the previous major/minor\nrelease and may also refactor internal APIs or include omissions from previous\nreleases--that is, features that were documented to exist but were accidentally\nleft out of the previous release. They may also include changes to docstrings\nthat enhance clarity but do not describe new features (e.g., more examples,\ntypo fixes, etc).\n\nBug fix releases are typically managed by maintaining one or more bug fix\nbranches separate from the main branch (the release procedure below discusses\ncreating these branches).  Typically, whenever an issue is fixed on the Astropy\nmain branch a decision must be made whether this is a fix that should be\nincluded in the Astropy bug fix release.  Usually the answer to this question\nis \"yes\", though there are some issues that may not apply to the bug fix\nbranch.  For example, it is not necessary to backport a fix to a new feature\nthat did not exist when the bug fix branch was first created.  New features\nare never merged into the bug fix branch--only bug fixes; hence the name.\n\nIn rare cases a bug fix may be made directly into the bug fix branch without\ngoing into the main branch first.  This may occur if a fix is made to a\nfeature that has been removed or rewritten in the development version and no\nlonger has the issue being fixed.  However, depending on how critical the bug\nis it may be worth including in a bug fix release, as some users can be slow to\nupgrade to new major/micro versions due to API changes.\n\nIssues are assigned to an Astropy release by way of the Milestone feature in\nthe GitHub issue tracker.  At any given time there are at least two versions\nunder development: The next major/minor version, and the next bug fix release.\nFor example, at the time of writing there are two release milestones open:\nv5.1 and v5.0.1.  In this case, v5.0.1 is the next bug fix release and all\nissues that should include fixes in that release should be assigned that\nmilestone.  Any issues that implement new features would go into the v5.1\nmilestone--this is any work that goes in the main branch that should not\nbe backported.  For a more detailed set of guidelines on using milestones, see\n:ref:`milestones-and-labels`.\n\nBefore going ahead with the release, you should check that all merged pull\nrequests milestoned for the upcoming release have been correctly backported.\nYou can find more information on backporting fixes to release branches\nin :ref:`release-procedure-bug-fix-backport`.\n\nOnce you have backported any required fixes, go through the following steps\nin a similar way to the initial major release:\n\n* :ref:`release-procedure-update-iers` (this should be done in ``main`` and backport it)\n* :ref:`release-procedure-check-ci`\n* :ref:`release-procedure-render-changelog`\n* :ref:`release-procedure-checking-changelog`\n\nYou can then proceed with tagging the bugfix release. Make sure your local\nrelease branch is up-to-date with the upstream release branch, then tag the\nlatest commit with the ``-s`` option, e.g::\n\n      $ git tag -s v5.0.1 -m \"Tagging v5.0.1\"\n\nPush up the tag to the `astropy core repository`_, e.g.::\n\n      $ git push upstream v5.0.1\n\n.. note::\n\n   It might be tempting to use the ``--tags`` argument to ``git push``,\n   but this should *not* be done, as it might push up some unintended tags.\n\nAt this point if all goes well, the wheels and sdist will be build\nin the `Azure core package pipeline`_ and uploaded to PyPI!\n\nIn the event there are any issues with the wheel building for the tag\n(which shouldn't really happen if it was passing for the release branch),\nyou'll have to fix whatever the problem is. Make sure you delete the\ntag locally, e.g.::\n\n   git tag -d v5.0.1\n\nand on GitHub:\n\n   git push upstream :refs/tags/v5.0.1\n\nMake any fixes by adding commits to the release branch (no need to remove\nprevious commits) e.g. via pull requests to the release branch, backports,\nor direct commits on the release branch, as appropriate. Once you are\nready to try and release again, create the tag, then force push the tag\nto GitHub to overwrite the previous one.\n\nOnce the release is done, follow the :ref:`post-release-procedure`.\n\nCommon procedures\n=================\n\n.. _release-procedure-bug-fix-backport:\n\nBackporting fixes from main\n---------------------------\n\n.. note::\n\n    The changelog script in `astropy-tools <https://github.com/astropy/astropy-tools/>`_\n    (``pr_consistency`` scripts in particular) does not know about minor releases, thus please be careful.\n    For example, let's say we have two branches (``main`` and ``v5.0.x``).\n    Both 5.0 and 5.0.1 releases will come out of the same v5.0.x branch.\n    If a PR for 5.0.1 is merged into ``main`` before 5.0 is released,\n    it should not be backported into v5.0.x branch until after 5.0 is\n    released, despite complaining from the aforementioned script.\n    This situation only arises in a very narrow time frame after 5.0\n    freeze but before its release.\n\nMost pull requests will be backported automatically by a backport bot, which\nopens pull requests with the backports aganist the release branch. Make sure\nthat any such pull requests are merged in before starting the release process\nfor a new bugfix release.\n\nIn some cases, some pull requests or in some cases direct commits to ``main``\nwill need to be backported manually. This is done using the ``git cherry-pick``\ncommand, which applies the diff from a single commit like a patch.  For the sake\nof example, say the current bug fix branch is 'v5.0.x', and that a bug was fixed\nin main in a commit ``abcd1234``.  In order to backport the fix, checkout the\nv5.0.x branch (it's also good to make sure it's in sync with the `astropy core\nrepository`_) and cherry-pick the appropriate commit::\n\n    $ git checkout v5.0.x\n    $ git pull upstream v5.0.x\n    $ git cherry-pick abcd1234\n\nSometimes a cherry-pick does not apply cleanly, since the bug fix branch\nrepresents a different line of development.  This can be resolved like any\nother merge conflict:  Edit the conflicted files by hand, and then run\n``git commit`` and accept the default commit message.  If the fix being\ncherry-picked has an associated changelog entry in a separate commit make\nsure to backport that as well.\n\nWhat if the issue required more than one commit to fix?  There are a few\npossibilities for this.  The easiest is if the fix came in the form of a\npull request that was merged into the main branch.  Whenever GitHub merges\na pull request it generates a merge commit in the main branch.  This merge\ncommit represents the *full* difference of all the commits in the pull request\ncombined.  What this means is that it is only necessary to cherry-pick the\nmerge commit (this requires adding the ``-m 1`` option to the cherry-pick\ncommand).  For example, if ``5678abcd`` is a merge commit::\n\n    $ git checkout v5.0.x\n    $ git pull upstream v5.0.x\n    $ git cherry-pick -m 1 5678abcd\n\nIn fact, because Astropy emphasizes a pull request-based workflow, this is the\n*most* common scenario for backporting bug fixes, and the one requiring the\nleast thought.  However, if you're not dealing with backporting a fix that was\nnot brought in as a pull request, read on.\n\n.. seealso::\n\n    :ref:`merge-commits-and-cherry-picks` for further explanation of the\n    cherry-pick command and how it works with merge commits.\n\nIf not cherry-picking a merge commit there are still other options for dealing\nwith multiple commits.  The simplest, though potentially tedious, is to\nrun the cherry-pick command once for each commit in the correct order.\nHowever, as of Git 1.7.2 it is possible to merge a range of commits like so::\n\n    $ git cherry-pick 1234abcd..56789def\n\nThis works fine so long as the commits you want to pick are actually congruous\nwith each other.  In most cases this will be the case, though some bug fixes\nwill involve followup commits that need to back backported as well.  Most bug\nfixes will have an issues associated with it in the issue tracker, so make sure\nto reference all commits related to that issue in the commit message.  That way\nit's harder for commits that need to be backported from getting lost.\n\n.. _astropy core repository: https://github.com/astropy/astropy\n.. _signed tags: https://git-scm.com/book/en/v2/Git-Basics-Tagging#Signed-Tags\n.. _cython: http://www.cython.org/\n.. _astropy-tools repository: https://github.com/astropy/astropy-tools\n.. _Anaconda: https://conda.io/docs/\n.. _twine: https://packaging.python.org/key_projects/#twine\n.. _Azure core package pipeline: https://dev.azure.com/astropy-project/astropy/_build\n.. _generate_releaserst.xsh: https://raw.githubusercontent.com/sunpy/sunpy/main/tools/generate_releaserst.xsh\n"},{"id":525,"name":"docguide.rst","nodeType":"TextFile","path":"docs/development","text":".. _documentation-guidelines:\n\n*********************\nWriting Documentation\n*********************\n\nHigh-quality, consistent documentation for astronomy code is one of the major\ngoals of the Astropy Project.  Hence, we describe our documentation procedures\nand rules here.  For the astropy core project and coordinated packages we try to\nkeep to these as closely as possible, and we encourage affiliated packages to\nalso adhere to these as they encourage useful documentation, a characteristic\noften lacking in professional astronomy software.\n\nAdding a Git Commit\n===================\n\nWhen your changes only affect documentation (i.e., docstring or RST files)\nand do not include any code snippets that require doctest to run, you may\nadd a ``[ci skip]`` in your commit message. For example::\n\n    git commit -m \"Update documentation about this and that [ci skip]\"\n\nWhen this commit is pushed out to your branch associated with a pull request,\nall CI will be skipped because it is not required. This is because the\nthe documentation build resides in RTD, which currently does not respect the\n``[ci skip]`` directive.\n\n\nBuilding the Documentation from source\n======================================\n\nFor information about building the documentation from source, see\nthe :ref:`builddocs` section in the installation instructions.\n\nAstropy Documentation Rules and Guidelines\n==========================================\n\nThis section describes the standards for documentation that any contribution\nbeing considered for integration into the core package should follow, as well as\nthe standard Astropy docstring format.\n\n* All documentation text should follow the :ref:`astropy-style-guide`.\n\n* All documentation should be written using the `Sphinx`_\n  documentation tool.\n\n* ReST substitutions are centralized in ``docs/conf.py::rst_epilog`` for\n  consistency across the documentation and docstrings. These should be used over\n  custom redefinitions; and new substitutions should probably be placed there.\n\n* The `package template <https://github.com/astropy/package-template>`_ provides\n  a recommended general structure for documentation.\n\n* Docstrings must be provided for all public classes, methods, and functions.\n\n* Docstrings should follow the `numpydoc format\n  <https://numpydoc.readthedocs.io/en/latest/format.html>`_.\n\n* References in docstrings, **including internal Astropy links**, should use the\n  `intersphinx format\n  <https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html>`_.\n  For example a link to the Astropy section on unit equivalencies would be\n  `` :ref:`astropy:unit_equivalencies` ``.\n  When built in Astropy, links starting with 'astropy' resolve to the current\n  build. In affiliate packages using ``sphinx-astropy``'s intersphinx mapping,\n  the links resolve to the stable version of Astropy. For linking to the\n  development version, use the intersphinx target 'astropy-dev'.\n\n* Examples and/or tutorials are strongly encouraged for typical use-cases of a\n  particular module or class.\n\n* Any external package dependencies must be explicitly mentioned in the\n  documentation. They should also be recorded in the ``setup.cfg`` file in the\n  root of the astropy repository using an entry in ``extras_require``,\n  under ``all``.\n\n* Configuration options using the :mod:`astropy.config` mechanisms must be\n  explicitly mentioned in the documentation.\n\n\nSphinx Documentation Themes\n===========================\n\nAn Astropy Project Sphinx HTML theme is included in the astropy-sphinx-theme_\npackage. This allows the theme to be used by both Astropy and affiliated\npackages. The theme is activated by setting the theme in the global Astropy\nsphinx configuration in sphinx-astropy_, which is imported in the sphinx\nconfiguration of both Astropy and affiliated packages.\n\nA different theme can be used by overriding a few sphinx\nconfiguration variables set in the global configuration.\n\n* To use a different theme, set ``html_theme`` to the name of a desired\n  builtin Sphinx theme or a custom theme in ``package-name/docs/conf.py``\n  (where ``'package-name'`` is \"astropy\" or the name of the affiliated\n  package).\n\n* To use a custom theme, additionally: place the theme in\n  ``package-name/docs/_themes`` and add ``'_themes'`` to the\n  ``html_theme_path`` variable. See the Sphinx_ documentation for more\n  details on theming.\n\nSphinx extensions\n=================\n\nThe documentation build process for Astropy uses a number of sphinx extensions\nwhich are all installed automatically when installing sphinx-astropy_. These\nfacilitate easily documenting code in a homogeneous and readable way.\n\nThe main extensions used are:\n\n* sphinx-automodapi_ - an extension that makes it easy to automatically\n  generate API documentation.\n\n* sphinx-gallery_ - an extension to generate example galleries\n\n* `numpydoc`_ - an extension to parse docstrings in NumpyDoc format\n\nIn addition, the sphinx-astropy_ includes a few small extensions:\n\n* ``sphinx_astropy.ext.edit_on_github`` - an extension to add 'Edit on GitHub'\n  links to documentation pages.\n\n* ``sphinx_astropy.ext.changelog_links`` - an extension to add links to\n  pull requests when rendering the changelog.\n\n* ``sphinx_astropy.ext.doctest`` - an extension that makes it possible to\n  add metadata about doctests inside ``.rst`` files\n\n.. _Sphinx: http://www.sphinx-doc.org/\n.. _sphinx-automodapi: https://github.com/astropy/sphinx-automodapi\n.. _astropy-sphinx-theme: https://github.com/astropy/astropy-sphinx-theme\n.. _sphinx-astropy: https://github.com/astropy/sphinx-astropy\n.. _sphinx-gallery: https://sphinx-gallery.readthedocs.io\n"},{"id":526,"name":"vision.rst","nodeType":"TextFile","path":"docs/development","text":":orphan:\n\n.. _vision:\n\n********************************************\nVision for a Common Astronomy Python Package\n********************************************\n\nThe following document summarizes a vision for a common Astronomy Python\npackage, and how we can best all work together to achieve this. In the\nfollowing document, this common package will be referred to as the core\npackage. This vision is not set in stone, and we are committed to adapting it\nto whatever process and guidelines work in practice.\n\nThe ultimate goal that we seek is a package that would contain much of the core\nfunctionality and some common tools required across Astronomy, but not\n*everything* Astronomers will ever need. The aim is primarily to avoid\nduplication for common core tasks, and to provide a robust framework upon which\nto build more complex tools.\n\nSuch a common package should not preclude any other Astronomy package from\nexisting, because there will always be more complex and/or specialized tools\nrequired. These tools will be able to rely on a single core library for many\ntasks, and thus reduce the number of dependencies, reduce duplication of\nfunctionality, and increase consistency of their interfaces.\n\nProcedure\n=========\n\nWith the help of the community, the coordination committee will start by\nidentifying a few of key areas where initial development/consolidation will be\nneeded (such as FITS, WCS, coordinates, tables, photometry, spectra, etc.) and\nwill encourage teams to be formed to build standalone packages implementing\nthis functionality. These packages will be referred to as affiliated packages\n(meaning that they are intended for future integration in the core package).\n\nA set of requirements will be set out concerning the interfaces and\nclasses/methods that affiliated packages will need to make available in order\nto ensure consistency between the different components. As the core package\ngrows, new potential areas/components for the core package will be identified.\nCompetition cannot be avoided, and will not be actively discouraged, but\nwhenever possible, developers should strive to work as a team to provide a\nsingle and robust affiliated package, for the benefit of the community.\n\nThe affiliated packages will be developed outside the core package in\nindependent repositories, which will allow the teams the choice of tool and\norganization. Once an affiliated package has implemented the desired\nfunctionality, and satisfies quality criteria for coding style, documentation,\nand testing, it will be considered for inclusion in the core package, and\nfurther development will be done directly in the core package either via direct\naccess to the repository, or via patches/pull requests (exactly how this will\nbe done will be decided later).\n\nTo ensure uniformity across affiliated packages, and to facilitate integration\nwith the core package, developers who wish to submit their affiliated packages\nfor inclusion in the core will need to follow the layout of a ‘template’\npackage that will be provided before development starts.\n\nDependencies\n============\n\nAffiliated packages should be able to be imported with only the following\ndependencies:\n\n* The Python Standard Library NumPy, SciPy, and Matplotlib Components already\n  * in the core Astronomy package\n\nOther packages may be used, but must be imported as needed rather than during\nthe initial import of the package.\n\nIf a dependency is needed, but is an affiliated package, the dependent package\nwill need to wait until the dependency is integrated into the core package\nbefore being itself considered for inclusion. In the mean time, it can make use\nof the other affiliated package in its current form, or other packages, so as\nnot to stall development. Thus, the first packages to be included in the core\nwill be those only requiring the standard library, NumPy, SciPy, and\nMatplotlib.\n\nIf the required dependency will never be part of a main package, then by\ndefault the dependency can be included but should be imported as needed\n(meaning that it only prevents the importing of that component, not the entire\ncore package), unless a strong case is made and a general consensus is reached\nby the community that this dependency is important enough to be required at a\nhigher level.\n\nThis system means that packages will be integrated into the core package in an\norder depending on the dependency tree, and also ensures that the interfaces of\npackages being integrated into the core package are consistent with those\nalready in the core package.\n\nInitially, no dependency on GUI toolkits will be allowed in the core package.\nIf the community reaches an agreement on a single toolkit that could be used,\nthen this toolkit will be allowed (but will only be imported as needed).\n\nKeeping track of affiliated packages\n====================================\n\nAffiliated packages will be listed in a central location (in addition to PyPI)\nthat will allow an easy installation of all the affiliated packages, for\nexample with a script that will seamlessly download and install all the\naffiliated packages. The core package will also include mechanisms to\nfacilitate this installation process.\n\nExisting Packages\n=================\n\nDevelopers who already have existing packages will be encouraged to continue\nsupporting them for the benefit of users until the core library is considered\nstable, contains this functionality, and is released to the community.\nThereafter, developers should encourage users to transition to using the\nfunctionality in the core package, and eventually phase out their own packages,\nunless they provide added value over the core package.\n"},{"id":527,"name":"astropy-package-template.rst","nodeType":"TextFile","path":"docs/development","text":"**********************************************************************\nHow to create and maintain a Python package using the Astropy template\n**********************************************************************\n\nIf you run into any problems, don't hesitate to ask for help on the\nastropy-dev mailing list!\n\nThe `package-template`_ repository provides a template for Python\npackages. This package design mirrors the layout of the main `Astropy`_\nrepository, as well as reusing much of the helper code used to organize\n`Astropy`_. See the\n:ref:`package template documentation <packagetemplate:package-template>`\nfor instructions on using the package template.\n\n\n.. _simple-release-docs:\n\nReleasing a Python package\n**************************\n\nYou can release a package using the steps given below. In these\ninstructions, we assume that the release is made from a fresh clone of the\nremote \"main\" repository and not from a forked copy. We also assume that\nthe changelog file is named ``CHANGES.rst``, like for the astropy core\npackage. If instead you use Markdown, then you should replace ``CHANGES.rst``\nby ``CHANGES.md`` in the instructions.\n\n.. note:: The instructions below assume that you do not make use of bug fix\n          branches in your workflow. If you do wish to create a bug fix branch,\n          we recommend that you read over the more complete astropy\n          :doc:`releasing` and adapt them for your package.\n\n#. Make sure that continuous integration is passing.\n\n#. Update the ``CHANGES.rst`` file to make sure that all the changes are listed,\n   and update the release date, which should currently be set to\n   ``unreleased``, to the current date in ``yyyy-mm-dd`` format.\n\n#. Run ``git clean -fxd`` to remove any untracked files (WARNING: this will\n   permanently remove any files that have not been previously committed, so\n   make sure that you don't need to keep any of these files).\n\n#. At this point, the command to run to build the tar file will depend on\n   whether your package has a ``pyproject.toml`` file or not. If it does\n   not, then::\n\n        python setup.py build sdist --format=gztar\n\n   If it does, then first make sure the `build <https://pypi.org/project/build/>`_\n   package is installed and up-to-date::\n\n        pip install build --upgrade\n\n   then create the source distribution with::\n\n        python -m build --sdist .\n\n   All following instructions will assume you have ``pyproject.toml``.\n   If you do not use ``pyproject.toml`` yet, please see\n   https://docs.astropy.org/en/v3.2.x/development/astropy-package-template.html\n   instead.\n\n   In both cases, make sure that generated file is good to go by going inside\n   ``dist``, expanding the tar file, going inside the expanded directory, and\n   running the tests with::\n\n        pip install -e .[test]\n        pytest\n\n   You may need to add the ``--remote-data`` flag or any other flags that you\n   normally add when fully testing your package.\n\n#. Go back to the root of the directory and remove the generated files with::\n\n        git clean -fxd\n\n#. Add the changes to ``CHANGES.rst`` and ``setup.cfg``::\n\n        git add CHANGES.rst setup.cfg\n\n   and commit with message::\n\n        git commit -m \"Preparing release <version>\"\n\n#. Tag commit with ``v<version>``, optionally signing with the ``-s`` option::\n\n        git tag v<version>\n\n#. Change ``VERSION`` in ``setup.cfg`` to next version number, but with a\n   ``.dev`` suffix at the end (e.g. ``0.2.dev``). Add a new section to\n   ``CHANGES.rst`` for next version, with a single entry ``No changes yet``, e.g.::\n\n       0.2 (unreleased)\n       ----------------\n\n       - No changes yet\n\n#. Add the changes to ``CHANGES.rst`` and ``setup.cfg``::\n\n        git add CHANGES.rst setup.cfg\n\n   and commit with message::\n\n        git commit -m \"Back to development: <next_version>\"\n\n#. Check out the release commit with ``git checkout v<version>``.\n   Run ``git clean -fxd`` to remove any non-committed files.\n\n#. (optional) Run the tests in an environment that mocks up a \"typical user\"\n   scenario. This is not strictly necessary because you ran the tests above, but\n   it can sometimes be useful to catch subtle bugs that might come from you\n   using a customized developer environment.  For more on setting up virtual\n   environments, see :ref:`virtual_envs`, but for the sake of example we will\n   assume you're using `Anaconda <https://conda.io/docs/>`_. Do::\n\n       conda create -n myaffilpkg_rel_test astropy <any more dependencies here>\n       source activate myaffilpkg_rel_test\n       python -m build --sdist .\n       cd dist\n       pip install myaffilpkg-version.tar.gz\n       python -c 'import myaffilpkg; myaffilpkg.test()'\n       source deactivate\n       cd <back to your source>\n\n   You may want to repeat this for other combinations of dependencies if you think\n   your users might have other relevant packages installed.  Assuming the tests\n   all pass, you can proceed on.\n\n#. If you did the previous step, do ``git clean -fxd`` again to remove anything\n   you made there.  Run ``python -m build --sdist .`` to\n   create the files for upload.  Then you can upload to PyPI via ``twine``::\n\n        twine upload dist/*\n\n   as described in `these <https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives>`_\n   instructions. Check that the entry on PyPI is correct, and that\n   the tarfile is present.\n\n#. Go back to the main branch and push your changes to github::\n\n        git checkout main\n        git push --tags origin main\n\n   Once you have done this, if you use Read the Docs, trigger a ``latest`` build\n   then go to the project settings, and under **Versions** you should see the\n   tag you just pushed. Select the tag to activate it, and save.\n\n#. If your package is available in the ``conda-forge`` conda channel, you\n   should also submit a pull request to update the version number in the\n   feedstock of your package.\n\n\nModifications for a beta/release candidate release\n==================================================\n\n   Before a new release of your package, you may wish do a \"pre-release\" of the\n   code, for example to allow collaborators to independently test the release.\n   If the release you are performing is this kind of pre-release,\n   some of the above steps need to be modified.\n\n   The primary modifications to the release procedure is:\n\n   * When entering the new version number, instead of just removing the\n     ``.dev``, enter \"1.2b1\" or \"1.2rc1\".  It is critical that you follow this\n     numbering scheme (``X.Yb#`` or ``X.Y.Zrc#``), as it will ensure the release\n     is ordered \"before\" the main release by various automated tools, and also\n     tells PyPI that this is a \"pre-release\".\n\n\n.. _package-template: https://github.com/astropy/package-template\n"},{"id":528,"name":"testguide.rst","nodeType":"TextFile","path":"docs/development","text":".. doctest-skip-all\n\n.. _testing-guidelines:\n\n******************\nTesting Guidelines\n******************\n\nThis section describes the testing framework and format standards for tests in\nAstropy core and coordinated packages, and also serves as recommendations for\naffiliated packages.\n\nTesting Framework\n*****************\n\nThe testing framework used by astropy (and packages using the :doc:`Astropy\npackage template <astropy-package-template>`) is the `pytest`_ framework.\n\n.. _testing-dependencies:\n\nTesting Dependencies\n********************\n\nThe dependencies used by the Astropy test runner are provided by a separate\npackage called `pytest-astropy`_. This package provides the ``pytest``\ndependency itself, in addition to several ``pytest`` plugins that are used by\nAstropy, and will also be of general use to other packages.\n\nSince the testing dependencies are not actually required to install or use\nAstropy, they are not included in ``install_requires`` in ``setup.cfg``.\nInstead, they are listed in an ``extras_require`` section called ``test`` in\n``setup.cfg``. Developers who want to run the test suite will need to either\ninstall pytest-astropy directly::\n\n    pip install pytest-astropy\n\nor install the core package in 'editable' mode specifying the ``[test]``\noption::\n\n    pip install -e .[test]\n\nA detailed description of the plugins can be found in the :ref:`pytest-plugins`\nsection.\n\n.. _running-tests:\n\nRunning Tests\n*************\n\nThere are currently three different ways to invoke Astropy tests. Each\nmethod invokes `pytest`_ to run the tests but offers different options when\ncalling. To run the tests, you will need to make sure you have the `pytest`_\npackage installed.\n\nIn addition to running the Astropy tests, these methods can also be called\nso that they check Python source code for `PEP8 compliance\n<https://www.python.org/dev/peps/pep-0008/>`_. All of the PEP8 testing\noptions require the `pytest-pep8 plugin\n<https://pypi.org/project/pytest-pep8>`_, which must be installed\nseparately.\n\n\ntox\n===\n\nThe most robust way to run the tests (which can also be the slowest) is\nto make use of `Tox <https://tox.readthedocs.io/en/latest/>`__, which is a\ngeneral purpose tool for automating Python testing. One of the benefits of tox\nis that it first creates a source distribution of the package being tested, and\ninstalls it into a new virtual environment, along with any dependencies that are\ndeclared in the package, before running the tests. This can therefore catch\nissues related to undeclared package data, or missing dependencies. Since we use\ntox to run many of the tests on continuous integration services, it can also be\nused in many cases to reproduce issues seen on those services.\n\nTo run the tests with tox, first make sure that tox is installed, e.g.::\n\n    pip install tox\n\nthen run the basic test suite with::\n\n    tox -e test\n\nor run the test suite with all optional dependencies with::\n\n    tox -e test-alldeps\n\nYou can see a list of available test environments with::\n\n    tox -l -v\n\nwhich will also explain what each of them does.\n\nYou can also run checks or commands not directly related to tests - for instance::\n\n    tox -e codestyle\n\nwill run checks using the flake8 tool.\n\nIs is possible to pass options to pytest when running tox - to do this, add a\n``--`` after the regular tox command, and anything after this will be passed to\npytest, e.g.::\n\n    tox -e test -- -v --pdb\n\nThis can be used in conjunction with the ``-P`` option provided by the\n`pytest-filter-subpackage <https://github.com/astropy/pytest-filter-subpackage>`_\nplugin to run just part of the test suite.\n\n.. _running-pytest:\n\npytest\n======\n\nThe test suite can also be run directly from the native ``pytest`` command,\nwhich is generally faster than using tox for iterative development. In\nthis case, it is important for developers to be aware that they must manually\nrebuild any extensions by running::\n\n    pip install -e .[test]\n\nbefore running the test with pytest with::\n\n    pytest\n\nInstead of calling ``pip install -e .[test]``, you can also build the\nextensions with::\n\n    python setup.py build_ext --inplace\n\nwhich avoids also installing the developer version of astropy into your current\nenvironment - however note that the ``pip`` command is required if you need to\ntest parts of the package that rely on certain `entry points\n<https://setuptools.readthedocs.io/en/latest/pkg_resources.html#entry-points>`_\nbeing installed.\n\nIt is possible to run only the tests for a particular subpackage or set of\nsubpackages.  For example, to run only the ``wcs`` tests from the\ncommandline::\n\n    pytest -P wcs\n\nOr, to run only the ``wcs`` and ``utils`` tests::\n\n    pytest -P wcs,utils\n\nYou can also specify a single directory or file to test from the commandline,\ne.g.::\n\n    pytest astropy/modeling\n\nor::\n\n    pytest astropy/wcs/tests/test_wcs.py\n\nand this works for ``.rst`` files too::\n\n    pytest astropy/wcs/index.rst\n\n.. _astropy.test():\n\nastropy.test()\n==============\n\nTests can be run from an installed version of Astropy with::\n\n    import astropy\n    astropy.test()\n\nThis will run all the default tests for Astropy (but will not run the\ndocumentation tests in the ``.rst`` documentation since those files are\nnot installed).\n\nTests for a specific package can be run by specifying the package in the call\nto the ``test()`` function::\n\n    astropy.test(package='io.fits')\n\nThis method works only with package names that can be mapped to Astropy\ndirectories. As an alternative you can test a specific directory or file\nwith the ``test_path`` option::\n\n  astropy.test(test_path='wcs/tests/test_wcs.py')\n\nThe ``test_path`` must be specified either relative to the working directory\nor absolutely.\n\nBy default `astropy.test()`_ will skip tests which retrieve data from the\ninternet. To turn these tests on use the ``remote_data`` flag::\n\n    astropy.test(package='io.fits', remote_data=True)\n\nIn addition, the ``test`` function supports any of the options that can be\npassed to :ref:`pytest.main() <pytest:pytest.main-usage>`\nand convenience options ``verbose=`` and ``pastebin=``.\n\nEnable PEP8 compliance testing with ``pep8=True`` in the call to\n``astropy.test``. This will enable PEP8 checking and disable regular tests.\n\nAstropy Test Function\n---------------------\n\n.. autofunction:: astropy.test\n\nTest-running options\n====================\n\n.. _open-files:\n\nTesting for open files\n----------------------\n\nUsing the :ref:`openfiles-plugin` plugin (which is installed automatically\nwhen installing pytest-astropy),  we can test whether any of the unit tests\ninadvertently leave any files open.  Since this greatly slows down the time it\ntakes to run the tests, it is turned off by default.\n\nTo use it from the commandline, do::\n\n    pytest --open-files\n\nTo use it from Python, do::\n\n    >>> import astropy\n    >>> astropy.test(open_files=True)\n\nFor more information on the ``pytest-openfiles`` plugin see\n:ref:`openfiles-plugin`\n\nTest coverage reports\n---------------------\n\nCoverage reports can be generated using the `pytest-cov\n<https://pypi.org/project/pytest-cov/>`_ plugin (which is installed\nautomatically when installing pytest-astropy) by using e.g.::\n\n    pytest --cov astropy --cov-report html\n\nThere is some configuration inside the ``setup.cfg`` file that\ndefines files to omit as well as lines to exclude.\n\nRunning tests in parallel\n-------------------------\n\nIt is possible to speed up astropy's tests using the `pytest-xdist\n<https://pypi.org/project/pytest-xdist>`_ plugin.\n\nOnce installed, tests can be run in parallel using the ``'-n'``\ncommandline option. For example, to use 4 processes::\n\n    pytest -n 4\n\nPass ``-n auto`` to create the same number of processes as cores\non your machine.\n\nSimilarly, this feature can be invoked from ``astropy.test``::\n\n    >>> import astropy\n    >>> astropy.test(parallel=4)\n\n.. _writing-tests:\n\nWriting tests\n*************\n\n``pytest`` has the following test discovery rules:\n\n * ``test_*.py`` or ``*_test.py`` files\n * ``Test`` prefixed classes (without an ``__init__`` method)\n * ``test_`` prefixed functions and methods\n\nConsult the :ref:`test discovery rules <pytest:python test discovery>`\nfor detailed information on how to name files and tests so that they are\nautomatically discovered by `pytest`_.\n\nSimple example\n==============\n\nThe following example shows a simple function and a test to test this\nfunction::\n\n    def func(x):\n        \"\"\"Add one to the argument.\"\"\"\n        return x + 1\n\n    def test_answer():\n        \"\"\"Check the return value of func() for an example argument.\"\"\"\n        assert func(3) == 5\n\nIf we place this in a ``test.py`` file and then run::\n\n    pytest test.py\n\nThe result is::\n\n    ============================= test session starts ==============================\n    python: platform darwin -- Python 3.x.x -- pytest-x.x.x\n    test object 1: /Users/username/tmp/test.py\n\n    test.py F\n\n    =================================== FAILURES ===================================\n    _________________________________ test_answer __________________________________\n\n        def test_answer():\n    >       assert func(3) == 5\n    E       assert 4 == 5\n    E        +  where 4 = func(3)\n\n    test.py:5: AssertionError\n    =========================== 1 failed in 0.07 seconds ===========================\n\nWhere to put tests\n==================\n\nPackage-specific tests\n----------------------\n\nEach package should include a suite of unit tests, covering as many of\nthe public methods/functions as possible. These tests should be\nincluded inside each sub-package, e.g::\n\n    astropy/io/fits/tests/\n\n``tests`` directories should contain an ``__init__.py`` file so that\nthe tests can be imported and so that they can use relative imports.\n\nInteroperability tests\n----------------------\n\nTests involving two or more sub-packages should be included in::\n\n    astropy/tests/\n\nRegression tests\n================\n\nAny time a bug is fixed, and wherever possible, one or more regression tests\nshould be added to ensure that the bug is not introduced in future. Regression\ntests should include the ticket URL where the bug was reported.\n\n.. _data-files:\n\nWorking with data files\n=======================\n\nTests that need to make use of a data file should use the\n`~astropy.utils.data.get_pkg_data_fileobj` or\n`~astropy.utils.data.get_pkg_data_filename` functions.  These functions\nsearch locally first, and then on the astropy data server or an arbitrary\nURL, and return a file-like object or a local filename, respectively.  They\nautomatically cache the data locally if remote data is obtained, and from\nthen on the local copy will be used transparently.  See the next section for\nnote specific to dealing with the cache in tests.\n\nThey also support the use of an MD5 hash to get a specific version of a data\nfile.  This hash can be obtained prior to submitting a file to the astropy\ndata server by using the `~astropy.utils.data.compute_hash` function on a\nlocal copy of the file.\n\nTests that may retrieve remote data should be marked with the\n``@pytest.mark.remote_data`` decorator, or, if a doctest, flagged with the\n``REMOTE_DATA`` flag.  Tests marked in this way will be skipped by default by\n``astropy.test()`` to prevent test runs from taking too long. These tests can\nbe run by ``astropy.test()`` by adding the ``remote_data='any'`` flag.  Turn on\nthe remote data tests at the command line with ``pytest --remote-data=any``.\n\nIt is possible to mark tests using\n``@pytest.mark.remote_data(source='astropy')``, which can be used to indicate\nthat the only required data is from the http://data.astropy.org server. To\nenable just these tests, you can run the\ntests with ``pytest --remote-data=astropy``.\n\nFor more information on the ``pytest-remotedata`` plugin, see\n:ref:`remotedata-plugin`.\n\nExamples\n--------\n.. code-block:: python\n\n    from ...config import get_data_filename\n\n    def test_1():\n        \"\"\"Test version using a local file.\"\"\"\n        #if filename.fits is a local file in the source distribution\n        datafile = get_data_filename('filename.fits')\n        # do the test\n\n    @pytest.mark.remote_data\n    def test_2():\n        \"\"\"Test version using a remote file.\"\"\"\n        #this is the hash for a particular version of a file stored on the\n        #astropy data server.\n        datafile = get_data_filename('hash/94935ac31d585f68041c08f87d1a19d4')\n        # do the test\n\n    def doctest_example():\n        \"\"\"\n        >>> datafile = get_data_filename('hash/94935')  # doctest: +REMOTE_DATA\n        \"\"\"\n        pass\n\nThe ``get_remote_test_data`` will place the files in a temporary directory\nindicated by the ``tempfile`` module, so that the test files will eventually\nget removed by the system. In the long term, once test data files become too\nlarge, we will need to design a mechanism for removing test data immediately.\n\nTests that use the file cache\n-----------------------------\n\nBy default, the Astropy test runner sets up a clean file cache in a temporary\ndirectory that is used only for that test run and then destroyed.  This is to\nensure consistency between test runs, as well as to not clutter users' caches\n(i.e. the cache directory returned by `~astropy.config.get_cache_dir`) with\ntest files.\n\nHowever, some test authors (especially for affiliated packages) may find it\ndesirable to cache files downloaded during a test run in a more permanent\nlocation (e.g. for large data sets).  To this end the\n`~astropy.config.set_temp_cache` helper may be used.  It can be used either as\na context manager within a test to temporarily set the cache to a custom\nlocation, or as a *decorator* that takes effect for an entire test function\n(not including setup or teardown, which would have to be decorated separately).\n\nFurthermore, it is possible to change the location of the cache directory\nfor the duration of the test run by setting the ``XDG_CACHE_HOME``\nenvironment variable.\n\n\nTests that create files\n=======================\n\nTests may often be run from directories where users do not have write\npermissions so tests which create files should always do so in\ntemporary directories. This can be done with the\n:ref:`pytest 'tmpdir' fixture <pytest:tmpdir>` or with\nPython's built-in :ref:`tempfile module <python:tempfile-examples>`.\n\n\nSetting up/Tearing down tests\n=============================\n\nIn some cases, it can be useful to run a series of tests requiring something\nto be set up first. There are four ways to do this:\n\nModule-level setup/teardown\n---------------------------\n\nIf the ``setup_module`` and ``teardown_module`` functions are specified in a\nfile, they are called before and after all the tests in the file respectively.\nThese functions take one argument, which is the module itself, which makes it\nvery easy to set module-wide variables::\n\n    def setup_module(module):\n        \"\"\"Initialize the value of NUM.\"\"\"\n        module.NUM = 11\n\n    def add_num(x):\n        \"\"\"Add pre-defined NUM to the argument.\"\"\"\n        return x + NUM\n\n    def test_42():\n        \"\"\"Ensure that add_num() adds the correct NUM to its argument.\"\"\"\n        added = add_num(42)\n        assert added == 53\n\nWe can use this for example to download a remote test data file and have all\nthe functions in the file access it::\n\n    import os\n\n    def setup_module(module):\n        \"\"\"Store a copy of the remote test file.\"\"\"\n        module.DATAFILE = get_remote_test_data('94935ac31d585f68041c08f87d1a19d4')\n\n    def test():\n        \"\"\"Perform test using cached remote input file.\"\"\"\n        f = open(DATAFILE, 'rb')\n        # do the test\n\n    def teardown_module(module):\n        \"\"\"Clean up remote test file copy.\"\"\"\n        os.remove(DATAFILE)\n\nClass-level setup/teardown\n--------------------------\n\nTests can be organized into classes that have their own setup/teardown\nfunctions. In the following ::\n\n    def add_nums(x, y):\n        \"\"\"Add two numbers.\"\"\"\n        return x + y\n\n    class TestAdd42(object):\n        \"\"\"Test for add_nums with y=42.\"\"\"\n\n        def setup_class(self):\n            self.NUM = 42\n\n        def test_1(self):\n            \"\"\"Test behavior for a specific input value.\"\"\"\n            added = add_nums(11, self.NUM)\n            assert added == 53\n\n        def test_2(self):\n            \"\"\"Test behavior for another input value.\"\"\"\n            added = add_nums(13, self.NUM)\n            assert added == 55\n\n        def teardown_class(self):\n            pass\n\nIn the above example, the ``setup_class`` method is called first, then all the\ntests in the class, and finally the ``teardown_class`` is called.\n\nMethod-level setup/teardown\n---------------------------\n\nThere are cases where one might want setup and teardown methods to be run\nbefore and after *each* test. For this, use the ``setup_method`` and\n``teardown_method`` methods::\n\n    def add_nums(x, y):\n        \"\"\"Add two numbers.\"\"\"\n        return x + y\n\n    class TestAdd42(object):\n        \"\"\"Test for add_nums with y=42.\"\"\"\n\n        def setup_method(self, method):\n            self.NUM = 42\n\n        def test_1(self):\n        \"\"\"Test behavior for a specific input value.\"\"\"\n            added = add_nums(11, self.NUM)\n            assert added == 53\n\n        def test_2(self):\n        \"\"\"Test behavior for another input value.\"\"\"\n            added = add_nums(13, self.NUM)\n            assert added == 55\n\n        def teardown_method(self, method):\n            pass\n\nFunction-level setup/teardown\n-----------------------------\n\nFinally, one can use ``setup_function`` and ``teardown_function`` to define a\nsetup/teardown mechanism to be run before and after each function in a module.\nThese take one argument, which is the function being tested::\n\n    def setup_function(function):\n        pass\n\n    def test_1(self):\n       \"\"\"First test.\"\"\"\n        # do test\n\n    def test_2(self):\n        \"\"\"Second test.\"\"\"\n        # do test\n\n    def teardown_function(function):\n        pass\n\nProperty-based tests\n====================\n\n`Property-based testing\n<https://increment.com/testing/in-praise-of-property-based-testing/>`_\nlets you focus on the parts of your test that matter, by making more\ngeneral claims - \"works for any two numbers\" instead of \"works for 1 + 2\".\nImagine if random testing gave you minimal, non-flaky failing examples,\nand a clean way to describe even the most complicated data - that's\nproperty-based testing!\n\n``pytest-astropy`` includes a dependency on `Hypothesis\n<https://hypothesis.readthedocs.io/>`_, so installation is easy -\nyou can just read the docs or `work through the tutorial\n<https://github.com/Zac-HD/escape-from-automanual-testing/>`_\nand start writing tests like::\n\n    from astropy.coordinates import SkyCoord\n    from hypothesis import given, strategies as st\n\n    @given(\n        st.builds(SkyCoord, ra=st.floats(0, 360), dec=st.floats(-90, 90))\n    )\n    def test_coordinate_transform(coord):\n        \"\"\"Test that sky coord can be translated from ICRS to Galactic and back.\"\"\"\n        assert coord == coord.galactic.icrs  # floating-point precision alert!\n\nOther properties that you could test include:\n\n- Round-tripping from image to sky coordinates and back should be lossless\n  for distortion-free mappings, and otherwise always below 10^-5 px.\n- Take a moment in time, round-trip it through various frames, and check it\n  hasn't changed or lost precision. (or at least not by more than a nanosecond)\n- IO routines losslessly round-trip data that they are expected to handle\n- Optimised routines calculate the same result as unoptimised, within tolerances\n\nThis is a great way to start contributing to Astropy, and has already found\nbugs in time handling.  See issue #9017 and pull request #9532 for details!\n\n(and if you find Hypothesis useful in your research,\n`please cite it <https://doi.org/10.21105/joss.01891>`_!)\n\n\nParametrizing tests\n===================\n\nIf you want to run a test several times for slightly different values,\nyou can use ``pytest`` to avoid writing separate tests.\nFor example, instead of writing::\n\n    def test1():\n        assert type('a') == str\n\n    def test2():\n        assert type('b') == str\n\n    def test3():\n        assert type('c') == str\n\nYou can use the ``@pytest.mark.parametrize`` decorator to concisely\ncreate a test function for each input::\n\n    @pytest.mark.parametrize(('letter'), ['a', 'b', 'c'])\n    def test(letter):\n        \"\"\"Check that the input is a string.\"\"\"\n        assert type(letter) == str\n\nAs a guideline, use ``parametrize`` if you can enumerate all possible\ntest cases and each failure would be a distinct issue, and Hypothesis\nwhen there are many possible inputs or you only want a single simple\nfailure to be reported.\n\nTests requiring optional dependencies\n=====================================\n\nFor tests that test functions or methods that require optional dependencies\n(e.g., Scipy), pytest should be instructed to skip the test if the dependencies\nare not present, as the ``astropy`` tests should succeed even if an optional\ndependency is not present. ``astropy`` provides a list of boolean flags that\ntest whether optional dependencies are installed (at import time). For example,\nto load the corresponding flag for Scipy and mark a test to skip if Scipy is not\npresent, use::\n\n    import pytest\n    from astropy.utils.compat.optional_deps import HAS_SCIPY\n\n    @pytest.mark.skipif(not HAS_SCIPY, reason='scipy is required')\n    def test_that_uses_scipy():\n        ...\n\nThese variables should exist for all of Astropy's optional dependencies; a\ncomplete list of supported flags can be found in\n``astropy.utils.compat.optional_deps``.\n\nAny new optional dependencies should be added to that file, as well as to\nrelevant entries in ``setup.cfg`` under ``options.extras_require``:\ntypically, under ``all`` for dependencies used in user-facing code\n(e.g., ``h5py``, which is used to write tables to HDF5 format),\nand in ``test_all`` for dependencies only used in tests (e.g.,\n``skyfield``, which is used to cross-check the accuracy of coordinate\ntransforms).\n\nUsing pytest helper functions\n=============================\n\nIf your tests need to use `pytest helper functions\n<https://docs.pytest.org/en/latest/reference/reference.html#functions>`_, such as\n``pytest.raises``, import ``pytest`` into your test module like so::\n\n    import pytest\n\nTesting warnings\n================\n\nIn order to test that warnings are triggered as expected in certain\nsituations,\n`pytest`_ provides its own context manager\n:ref:`pytest.warns <pytest:warns>` that, completely\nanalogously to ``pytest.raises`` (see below) allows to probe explicitly\nfor specific warning classes and, through the optional ``match`` argument,\nmessages. Note that when no warning of the specified type is\ntriggered, this will make the test fail. When checking for optional,\nbut not mandatory warnings, ``pytest.warns()`` can be used to catch and\ninspect them.\n\n.. note::\n\n   With `pytest`_ there is also the option of using the\n   :ref:`recwarn <pytest:recwarn>` function argument to test that\n   warnings are triggered within the entire embedding function.\n   This method has been found to be problematic in at least one case\n   (`pull request 1174 <https://github.com/astropy/astropy/pull/1174#issuecomment-20249309>`_).\n\nTesting exceptions\n==================\n\nJust like the handling of warnings described above, tests that are\ndesigned to trigger certain errors should verify that an exception of\nthe expected type is raised in the expected place.  This is efficiently\ndone by running the tested code inside the\n:ref:`pytest.raises <pytest:assertraises>`\ncontext manager.  Its optional ``match`` argument allows to check the\nerror message for any patterns using ``regex`` syntax.  For example the\nmatches ``pytest.raises(OSError, match=r'^No such file')`` and\n``pytest.raises(OSError, match=r'or directory$')`` would be equivalent\nto ``assert str(err).startswith(No such file)`` and ``assert\nstr(err).endswith(or directory)``, respectively, on the raised error\nmessage ``err``.\nFor matching multi-line messages you need to pass the ``(?s)``\n:ref:`flag <python:re-syntax>`\nto the underlying ``re.search``, as in the example below::\n\n  with pytest.raises(fits.VerifyError, match=r'(?s)not upper.+ Illegal key') as excinfo:\n      hdu.verify('fix+exception')\n  assert str(excinfo.value).count('Card') == 2\n\nThis invocation also illustrates how to get an ``ExceptionInfo`` object\nreturned to perform additional diagnostics on the info.\n\nTesting configuration parameters\n================================\n\nIn order to ensure reproducibility of tests, all configuration items\nare reset to their default values when the test runner starts up.\n\nSometimes you'll want to test the behavior of code when a certain\nconfiguration item is set to a particular value.  In that case, you\ncan use the `astropy.config.ConfigItem.set_temp` context manager to\ntemporarily set a configuration item to that value, test within that\ncontext, and have it automatically return to its original value.\n\nFor example::\n\n    def test_pprint():\n        from ... import conf\n        with conf.set_temp('max_lines', 6):\n            # ...\n\nMarking blocks of code to exclude from coverage\n===============================================\n\nBlocks of code may be ignored by the coverage testing by adding a\ncomment containing the phrase ``pragma: no cover`` to the start of the\nblock::\n\n    if this_rarely_happens:  # pragma: no cover\n        this_call_is_ignored()\n\n.. _image-tests:\n\nImage tests with pytest-mpl\n===========================\n\nRunning image tests\n-------------------\n\nWe make use of the `pytest-mpl <https://pypi.org/project/pytest-mpl>`_\nplugin to write tests where we can compare the output of plotting commands\nwith reference files on a pixel-by-pixel basis (this is used for instance in\n:ref:`astropy.visualization.wcsaxes <wcsaxes>`).\n\nTo run the Astropy tests with the image comparison, use::\n\n    pytest --mpl --remote-data=astropy\n\nHowever, note that the output can be very sensitive to the version of Matplotlib\nas well as all its dependencies (e.g., freetype), so we recommend running the\nimage tests inside a `Docker <https://www.docker.com/>`__ container which has a\nfrozen set of package versions (Docker containers can be thought of as mini\nvirtual machines). See our ``.circleci/config.yml`` for reference.\n\nWriting image tests\n-------------------\n\nThe `README.rst <https://github.com/matplotlib/pytest-mpl/blob/master/README.rst>`__\nfor the plugin contains information on writing tests with this plugin. The only\nkey addition compared to those instructions is that you should set\n``baseline_dir``::\n\n    from astropy.tests.image_tests import IMAGE_REFERENCE_DIR\n\n    @pytest.mark.mpl_image_compare(baseline_dir=IMAGE_REFERENCE_DIR)\n\nThis is because since the reference image files would contribute significantly\nto the repository size, we instead store them on the http://data.astropy.org\nsite. The downside is that it is a little more complicated to create or\nre-generate reference files, but we describe the process here.\n\nGenerating reference images\n---------------------------\n\nAny failed test on CircleCI would provide you with the old and the new reference\nimages, along with the difference image. After you have determined that the\nnew reference image is acceptable, you could download it from the \"artifacts\"\ntab on the CircleCI dashboard.\n\nUploading the reference images\n------------------------------\n\nNext, we need to add these images to the http://data.astropy.org server. To do\nthis, open a pull request to `this <https://github.com/astropy/astropy-data>`_\nrepository. The reference images for Astropy tests should go inside the\n`testing/astropy <https://github.com/astropy/astropy-data/tree/gh-pages/testing/astropy>`_\ndirectory. In that directory are folders named as timestamps. If you are simply\nadding new tests, add the reference files to the most recent directory.\n\nIf you are re-generating baseline images due to changes in Astropy, make a new\ntimestamp directory by copying one the most recent one, then replace any\nbaseline images that have changed. Note that due to changes between Matplotlib\nversions, we need to add the whole set of reference images for each major\nMatplotlib version. Therefore, in each timestamp folder, there are folders named\ne.g. ``1.4.x`` and ``1.5.x``.\n\nOnce the reference images are merged in and available on\nhttp://data.astropy.org, update the timestamp in the ``IMAGE_REFERENCE_DIR``\nvariable in the ``astropy.tests.image_tests`` sub-module. Because the timestamp\nis hard-coded, adding a new timestamp directory will not mess with testing for\nreleased versions of Astropy, so you can easily add and tweak a new timestamp\ndirectory while still working on a pull request to Astropy.\n\n.. _doctests:\n\nWriting doctests\n****************\n\nA doctest in Python is a special kind of test that is embedded in a\nfunction, class, or module's docstring, or in the narrative Sphinx\ndocumentation, and is formatted to look like a Python interactive\nsession--that is, they show lines of Python code entered at a ``>>>``\nprompt followed by the output that would be expected (if any) when\nrunning that code in an interactive session.\n\nThe idea is to write usage examples in docstrings that users can enter\nverbatim and check their output against the expected output to confirm that\nthey are using the interface properly.\n\nFurthermore, Python includes a :mod:`doctest` module that can detect these\ndoctests and execute them as part of a project's automated test suite.  This\nway we can automatically ensure that all doctest-like examples in our\ndocstrings are correct.\n\nThe Astropy test suite automatically detects and runs any doctests in the\nastropy source code or documentation, or in packages using the Astropy test\nrunning framework. For example doctests and detailed documentation on how to\nwrite them, see the full :mod:`doctest` documentation.\n\n.. note::\n\n   Since the narrative Sphinx documentation is not installed alongside the\n   astropy source code, it can only be tested by running ``pytest`` directly (or\n   via tox), not by ``import astropy; astropy.test()``.\n\nFor more information on the ``pytest-doctestplus`` plugin used by Astropy, see\n:ref:`doctestplus-plugin`.\n\n.. _skipping-doctests:\n\nSkipping doctests\n=================\n\nSometimes it is necessary to write examples that look like doctests but that\nare not actually executable verbatim. An example may depend on some external\nconditions being fulfilled, for example. In these cases there are a few ways to\nskip a doctest:\n\n1. Next to the example add a comment like: ``# doctest: +SKIP``.  For example:\n\n   .. code-block:: none\n\n     >>> import os\n     >>> os.listdir('.')  # doctest: +SKIP\n\n   In the above example we want to direct the user to run ``os.listdir('.')``\n   but we don't want that line to be executed as part of the doctest.\n\n   To skip tests that require fetching remote data, use the ``REMOTE_DATA``\n   flag instead.  This way they can be turned on using the\n   ``--remote-data`` flag when running the tests:\n\n   .. code-block:: none\n\n     >>> datafile = get_data_filename('hash/94935')  # doctest: +REMOTE_DATA\n\n2. Astropy's test framework adds support for a special ``__doctest_skip__``\n   variable that can be placed at the module level of any module to list\n   functions, classes, and methods in that module whose doctests should not\n   be run.  That is, if it doesn't make sense to run a function's example\n   usage as a doctest, the entire function can be skipped in the doctest\n   collection phase.\n\n   The value of ``__doctest_skip__`` should be a list of wildcard patterns\n   for all functions/classes whose doctests should be skipped.  For example::\n\n       __doctest_skip__ = ['myfunction', 'MyClass', 'MyClass.*']\n\n   skips the doctests in a function called ``myfunction``, the doctest for a\n   class called ``MyClass``, and all *methods* of ``MyClass``.\n\n   Module docstrings may contain doctests as well.  To skip the module-level\n   doctests include the string ``'.'`` in ``__doctest_skip__``.\n\n   To skip all doctests in a module::\n\n       __doctest_skip__ = ['*']\n\n3. In the Sphinx documentation, a doctest section can be skipped by\n   making it part of a ``doctest-skip`` directive::\n\n       .. doctest-skip::\n\n           >>> # This is a doctest that will appear in the documentation,\n           >>> # but will not be executed by the testing framework.\n           >>> 1 / 0  # Divide by zero, ouch!\n\n   It is also possible to skip all doctests below a certain line using\n   a ``doctest-skip-all`` comment.  Note the lack of ``::`` at the end\n   of the line here::\n\n       .. doctest-skip-all\n\n       All doctests below here are skipped...\n\n4. ``__doctest_requires__`` is a way to list dependencies for specific\n   doctests.  It should be a dictionary mapping wildcard patterns (in the same\n   format as ``__doctest_skip__``) to a list of one or more modules that should\n   be *importable* in order for the tests to run.  For example, if some tests\n   require the scipy module to work they will be skipped unless ``import\n   scipy`` is possible.  It is also possible to use a tuple of wildcard\n   patterns as a key in this dict::\n\n            __doctest_requires__ = {('func1', 'func2'): ['scipy']}\n\n   Having this module-level variable will require ``scipy`` to be importable\n   in order to run the doctests for functions ``func1`` and ``func2`` in that\n   module.\n\n   In the Sphinx documentation, a doctest requirement can be notated with the\n   ``doctest-requires`` directive::\n\n       .. doctest-requires:: scipy\n\n           >>> import scipy\n           >>> scipy.hamming(...)\n\n\nSkipping output\n===============\n\nOne of the important aspects of writing doctests is that the example output\ncan be accurately compared to the actual output produced when running the\ntest.\n\nThe doctest system compares the actual output to the example output verbatim\nby default, but this not always feasible.  For example the example output may\ncontain the ``__repr__`` of an object which displays its id (which will change\non each run), or a test that expects an exception may output a traceback.\n\nThe simplest way to generalize the example output is to use the ellipses\n``...``.  For example::\n\n    >>> 1 / 0\n    Traceback (most recent call last):\n    ...\n    ZeroDivisionError: integer division or modulo by zero\n\nThis doctest expects an exception with a traceback, but the text of the\ntraceback is skipped in the example output--only the first and last lines\nof the output are checked.  See the :mod:`doctest` documentation for\nmore examples of skipping output.\n\nIgnoring all output\n-------------------\n\nAnother possibility for ignoring output is to use the\n``# doctest: +IGNORE_OUTPUT`` flag.  This allows a doctest to execute (and\ncheck that the code executes without errors), but allows the entire output\nto be ignored in cases where we don't care what the output is.  This differs\nfrom using ellipses in that we can still provide complete example output, just\nwithout the test checking that it is exactly right.  For example::\n\n    >>> print('Hello world')  # doctest: +IGNORE_OUTPUT\n    We don't really care what the output is as long as there were no errors...\n\n.. _handling-float-output:\n\nHandling float output\n=====================\n\nSome doctests may produce output that contains string representations of\nfloating point values.  Floating point representations are often not exact and\ncontain roundoffs in their least significant digits.  Depending on the platform\nthe tests are being run on (different Python versions, different OS, etc.) the\nexact number of digits shown can differ.  Because doctests work by comparing\nstrings this can cause such tests to fail.\n\nTo address this issue, the ``pytest-doctestplus`` plugin provides support for a\n``FLOAT_CMP`` flag that can be used with doctests.  For example:\n\n.. code-block:: none\n\n  >>> 1.0 / 3.0  # doctest: +FLOAT_CMP\n  0.333333333333333311\n\nWhen this flag is used, the expected and actual outputs are both parsed to find\nany floating point values in the strings.  Those are then converted to actual\nPython `float` objects and compared numerically.  This means that small\ndifferences in representation of roundoff digits will be ignored by the\ndoctest.  The values are otherwise compared exactly, so more significant\n(albeit possibly small) differences will still be caught by these tests.\n\nContinuous integration\n**********************\n\nOverview\n========\n\nAstropy uses the following continuous integration (CI) services:\n\n* `GitHub Actions <https://github.com/astropy/astropy/actions>`_ for\n  Linux, OS X, and Windows setups\n  (Note: GitHub Actions does not have \"allowed failures\" yet, so you might\n  see a fail job reported for your PR with \"(Allowed Failure)\" in its name.\n  Still, some failures might be real and related to your changes, so check\n  it anyway!)\n* `CircleCI <https://circleci.com>`_ for visualization tests\n\nThese continuously test the package for each commit and pull request that is\npushed to GitHub to notice when something breaks.\n\nIn some cases, you may see failures on continuous integration services that\nyou do not see locally, for example because the operating system is different,\nor because the failure happens with only 32-bit Python.\n\n.. _pytest-plugins:\n\nPytest Plugins\n**************\n\nThe following ``pytest`` plugins are maintained and used by Astropy. They are\nincluded as dependencies to the ``pytest-astropy`` package, which is now\nrequired for testing Astropy. More information on all of the  plugins provided\nby the ``pytest-astropy`` package (including dependencies not maintained by\nAstropy) can be found `here <https://github.com/astropy/pytest-astropy>`__.\n\n.. _remotedata-plugin:\n\npytest-remotedata\n=================\n\nThe `pytest-remotedata`_ plugin allows developers to control whether to run\ntests that access data from the internet. The plugin provides two decorators\nthat can be used to mark individual test functions or entire test classes:\n\n* ``@pytest.mark.remote_data`` for tests that require data from the internet\n* ``@pytest.mark.internet_off`` for tests that should run only when there is no\n  internet access. This is useful for testing local data caches or fallbacks\n  for when no network access is available.\n\nThe plugin also adds the ``--remote-data`` option to the ``pytest`` command\n(which is also made available through the Astropy test runner).\n\nIf the ``--remote-data`` option is not provided when running the test suite, or\nif ``--remote-data=none`` is provided, all tests that are marked with\n``remote_data`` will be skipped. All tests that are marked with\n``internet_off`` will be executed. Any test that attempts to access the\ninternet but is not marked with ``remote_data`` will result in a failure.\n\nProviding either the ``--remote-data`` option, or ``--remote-data=any``, will\ncause all tests marked with ``remote_data`` to be executed. Any tests that are\nmarked with ``internet_off`` will be skipped.\n\nRunning the tests with ``--remote-data=astropy`` will cause only tests that\nreceive remote data from Astropy data sources to be run. Tests with any other\ndata sources will be skipped. This is indicated in the test code by marking\ntest functions with ``@pytest.mark.remote_data(source='astropy')``. Tests\nmarked with ``internet_off`` will also be skipped in this case.\n\nAlso see :ref:`data-files`.\n\n.. _doctestplus-plugin:\n\npytest-doctestplus\n==================\n\nThe `pytest-doctestplus`_ plugin provides advanced doctest features, including:\n\n* handling doctests that use remote data in conjunction with the\n  ``pytest-remotedata`` plugin above (see :ref:`data-files`)\n* approximate floating point comparison for doctests that produce floating\n  point results (see :ref:`handling-float-output`)\n* skipping particular classes, methods, and functions when running doctests\n  (see :ref:`skipping-doctests`)\n* optional inclusion of ``*.rst`` files for doctests\n\nThis plugin provides two command line options: ``--doctest-plus`` for enabling\nthe advanced features mentioned above, and ``--doctest-rst`` for including\n``*.rst`` files in doctest collection.\n\nThe Astropy test runner enables both of these options by default. When running\nthe test suite directly from ``pytest`` (instead of through the Astropy test\nrunner), it is necessary to explicitly provide these options when they are\nneeded.\n\n.. _openfiles-plugin:\n\npytest-openfiles\n================\n\nThe `pytest-openfiles`_ plugin allows for the detection of open I/O resources\nat the end of unit tests. This plugin adds the ``--open-files`` option to the\n``pytest`` command (which is also exposed through the Astropy test runner).\n\nWhen running tests with ``--open-files``, if a file is opened during the course\nof a unit test but that file  not closed before the test finishes, the test\nwill fail. This is particularly useful for testing code that manipulates file\nhandles or other I/O resources. It allows developers to ensure that this kind\nof code properly cleans up I/O resources when they are no longer needed.\n\nAlso see :ref:`open-files`.\n"},{"id":529,"name":"building.rst","nodeType":"TextFile","path":"docs/development","text":".. _dev-build-astropy-subpkg:\n\n************************************\nBuilding Astropy and its Subpackages\n************************************\n\nThe build process currently uses the `setuptools\n<https://setuptools.readthedocs.io>`_ package to build and install the astropy\ncore (and any affiliated packages that use the template). As is typical, there\nis a single ``setup.py`` file that is used for the whole ``astropy`` package. To\nmake it easier to set up C extensions for individual sub-packages, we use\n`extension-helpers <https://extension-helpers.readthedocs.io/>`_, which allows\nextensions to be defined inside each sub-package.\n\nThe way extension-helpers works is that it looks for ``setup_package.py`` files\nanywhere in the package, and then looks for a function called ``get_extensions``\ninside each of these files. This function should return a list of\n``setuptools.Extension`` objects, and these are combined into an\noverall list of extensions to build.\n\nFor certain string-parsing tasks, Astropy uses the\n`PLY <http://www.dabeaz.com/ply/>`_ tool.  PLY generates tables that speed up\nthe parsing process, which are checked into source code so they don't have to\nbe regenerated.  These tables can be recognized by having either ``lextab`` or\n``parsetab`` in their names.  To regenerate these files (e.g. if a new version\nof PLY is bundled with Astropy or some of the parsing code changes), the tables\nneed to be deleted and the appropriate parts of astropy re-imported and run. For\nexact details, see the comments in the headers of the ``parsetab`` and\n``lextab`` files.\n\n.. _dev-build-astropy-subpkg-win:\n\nBuilding on Windows\n*******************\n\nThe most convenient option is to use Python installation from Miniconda. If you like\nUnix-like commands, Git Bash, which comes installed with Git, complements\nMiniconda pretty well, as long as Miniconda is installed with the option for\nit to be available system-wide (the option that is not recommended by the\ninstaller).\n\nSince ``astropy`` contains C extensions, you also need to install Microsoft\nVisual Studio (the latest available should work) so Python can access the\nsystem C compiler.\n\nOnce everything is set up as above, you can proceed to build ``astropy``\nfrom source in the ``conda`` environment in an OS-agnostic way. For example:\n\n* Create a new ``conda`` environment.\n* Go to the ``astropy`` code checkout directory.\n* If you have not already, fetch all of the tags from the main repository.\n  If you do not have the latest tag, your developer version number will be\n  wrong.\n* Run ``pip install -e .`` to build ``astropy``.\n"},{"id":530,"name":"style-guide.rst","nodeType":"TextFile","path":"docs/development","text":".. _astropy-style-guide:\n\n******************************************************************\nAstropy Narrative Style Guide: A Writing Resource for Contributors\n******************************************************************\n\nThe purpose of this style guide is to provide the Astropy community with a set\nof style and formatting guidelines that can be referenced when writing Astropy\ndocumentation. Following the guidelines offered in this style guide will bring\ngreater consistency and clarity to Astropy's documentation, supporting its\nmission to develop a common core package for Astronomy in Python and foster an\necosystem of interoperable astronomy packages.\n\nThis style guide is organized alphabetically by writing topic, with usage\nexamples in each section, and tone and formatting guidelines at the end.\n\nAbbreviations\n=============\n\nPlace abbreviations such as i.e. and e.g. within parentheses, where they are\nfollowed by a comma. Alternatively, consider using \"that is\" and “for example”\ninstead, preceded by an em dash or semicolon and followed by a comma, or\ncontained within em dashes.\n\nExamples\n--------\n* The only way to modify the data in a frame is by using the ``data`` attribute\n  directly and not the aliases for components on the frame (i.e., the following\n  will not work).\n* There are no plans to support more complex evolution (e.g., non-inertial\n  frames or more complex evolution), as that is out of scope for the ``astropy``\n  core.\n* Once you have a coordinate object you can access the components of that\n  coordinate — for example, RA or Dec — to get string representations of the\n  full coordinate.\n\nFor general use and scientific terms, use abbreviations only when the\nabbreviated term is well-known and widely used within the astronomy community.\nFor less common scientific terms, or terms specific to a given field, write out\nthe term or link to a resource of explanation. A good rule of thumb to follow\nwhen deciding whether or not something should be abbreviated is: when in doubt,\nwrite it out.\n\nExamples\n--------\n* 1D, 2D, etc. is preferred over one-dimensional, two-dimensional, etc.\n* Units such as SI and CGS can be abbreviated as is more commonly seen in the\n  scientific community.\n* White dwarf should be written out fully instead of abbreviated as WD.\n* Names of organizations or other proper nouns that employ acronyms should be\n  written as their known acronym, but with a hyperlink to a website or resource\n  for reference, for instance, `CODATA <https://codata.org/>`_.\n\nCapitalization\n==============\n\nCapitalize all proper nouns (names) in plain text, except when referring to\npackage/code names, in which case use lowercase and double backticks. Astropy\ncapitalized refers to The Astropy Project, while ``astropy`` lowercase and in\nbackticks refers to the core package.\n\nExamples\n--------\n* Follow Astropy guidelines for contributing code.\n* Affiliated packages are astronomy-related software packages that are not part\n  of the ``astropy`` core package.\n* Provide a code example along with details of the operating system and the\n  Python, ``numpy``, and ``astropy`` versions you are using.\n\nIn Documentation materials, title case capitalization is preferred in headings,\nmeaning capitalize first, last, and all major words in the heading, but\nlowercase articles (the, a, an), prepositions (at, to, up, down, with, in,\netc.), and common coordinating conjunctions (and, but, for, or). Sentence case\ncapitalization is acceptable for longer example headings.\n\nExamples\n--------\n* Building and Installing\n* Frames without Data\n* Checklist for Contributing Code\n* Astropy Guidelines\n* Importing ``astropy`` and Subpackages\n* Example: Use velocity to compute sky position at different epochs\n\nIn Tutorials and other learning materials, title case capitalization is\npreferred in headings of structured introductory/template sections, but within\nthe tutorial, sentence case (i.e., capitalize first word and proper nouns only)\nis acceptable for longer headings designating different learning/code sections.\n\nContractions\n============\n\nDo not use contractions in formal documentation material.\n\nExamples\n--------\n* If you are making changes that impact ``astropy`` performance, consider adding\n  a performance benchmark.\n* You do not need to include a changelog entry.\n\nIn all other materials, avoid use of contractions only when the tense can be\nconfused, such as in the case of “she is gone” versus “she has gone,” etc.\n\n.. _Hyphenation:\n\nHyphenation\n===========\n\nPhrasal adjectives/compound modifiers placed before a noun should be hyphenated\nto avoid confusion.\n\nExamples\n--------\n* Astronomy-related software packages.\n* Astropy provides sustainable, high-level education to the astronomy community.\n\nHyphenated compound words should contain hyphens in plain text, but no hyphens\nin code.\n\nExample\n-------\n* Do not forget to double-check your formatting.\n\nNumbers\n=======\n\nFor numbers followed by a unit or as part of a name, use the numeral.\n\nExamples\n--------\n* 1 arcminute\n* 32 degrees\n* Gaia data release 2 catalog\n* 1D, 2D, etc. is preferred over one-dimensional, two-dimensional, etc.\n\nFor all other whole numbers, follow Associated Press (AP) style: spell out\nnumbers one through nine, and use numerals for 10 and higher, with numeral-word\ncombinations for millions, billions, and trillions.\n\nExamples\n--------\n* There are two ways to build Astropy documentation.\n* Follow these 11 steps.\n* Measuring astrometry for about 2 billion stars.\n\nFor casual expressions, spell out the number.\n\nExample\n-------\n* A picture is worth a thousand words.\n\nPunctuation\n===========\n\nFor consistency across Astropy materials, non-U.S. punctuation will be edited\nto reflect American punctuation preferences.\n\n**Parentheses**: punctuation belonging to parenthetical material will be placed\ninside of closing parentheses, with the exception of commas to denote a small\npause coming after parenthetical material, and periods when parenthetical\nmaterial is included within another sentence.\n\nExamples\n--------\n* (For full contributor guidelines, see our documentation.)\n* Once you open a pull request (which should be opened against the ``main``\n  branch), please make sure to include the following.\n* In some cases, most of the required functionality is contained in a single\n  class (or a few classes).\n\n**Quotation marks**: periods and commas will be placed inside of closing\nquotation marks, whether double or single.\n\nExamples\n--------\n* Chief among these terms is the concept of a “coordinate system.”\n* Because of the likelihood of confusion between these meanings of “coordinate\n  system,” `~astropy.coordinates` avoids this term wherever possible.\n\n**Hyphens vs. En Dashes vs. Em Dashes**\n\nHyphens (-) should be used for phrasal adjectives and compound words (see\n`Hyphenation`_ above).\n\nEn dashes (– longer) should be used for number ranges (dates, times, pages) or\nto replace the words “to” or “through,” without spaces around the dash.\n\nExamples\n--------\n* See chapters 14–18.\n* We have blocked off March 2019–May 2019 to develop a new version.\n\nEm dashes (— longest) can be used in place of commas, parentheses, or colons to\nset off amplifying or explanatory elements. In Astropy materials, follow\nAssociated Press (AP) style, which calls for spaces on either side of each em\ndash.\n\nExamples\n--------\n* Several types of input angles — array, scalar, tuple, string — can be used in\n  the creation of an Angle object.\n* The creation of an Angle object supports a variety of input angle types —\n  array, scalar, tuple, string, etc.\n\nSpelling\n========\n\nFor consistency across Astropy materials, non-U.S. spelling will be edited to\nreflect American spelling preferences.\n\nExample\n-------\n* Cross-matching catalog coordinates (versus catalogue)\n\nTime and Date\n=============\n\nUse numerals when exact times are expressed. Use the 24-hour system to express\nexact times. For consistency across Astropy materials, all instances of exact\ntimes will be edited to reflect 24-hour time system preferences.\n\nExample\n-------\n* The presentation starts at 15:00.\n\nExpress specific dates as numerals in ISO 8601 format, year-month-day.\n\nExample\n-------\n* Data from the Gaia mission was released on 2018-04-25.\n\nA Note About Voice and Tone\n===========================\n\nAcross all Astropy materials in narrative sections, please follow these voice\nand tone guidelines.\n\nWrite in the present tense.\n\nExample\n-------\n* In the following section, we are going to make a plot...\n* To test if your version of ``astropy`` is running correctly...\n\nUse the first-person inclusive plural.\n\nExample\n-------\n* We did this the long way, but next we can try it the short way...\n\nUse the generic pronoun “you” instead of “one.”\n\nExample\n-------\n* You can access any of the attributes on a frame by...\n\nAlways avoid extraneous or belittling words such as “obviously,” “easily,”\n“simply,” “just,” or “straightforward.” Avoid extraneous phrases like, “we just\nhave to do one more thing.”\n\nAvoid words or phrases that create worry in the mind of the reader. Instead,\nuse positive language that establishes confidence in the skills being learned.\n\nExamples\n--------\n* As a best practice...\n* One recommended way to...\n* An important note to remember is...\n\nAlong these lines, use \"warning\" directives only to note limitations in the\ncode, not implied limitations in the skills or knowledge of the reader.\n\nDocumentation vs. Tutorials vs. Guides\n--------------------------------------\n\nDocumentation\n^^^^^^^^^^^^^\nTone: academic and slightly more formal.\n\n* Use title case capitalization in section headings.\n* Do not use contractions.\n\nTutorials\n^^^^^^^^^\nTone: academic but less formal and more friendly.\n\n* Use title case capitalization in introductory/template headings, switch to\n  sentence case capitalization for learning/example section headings.\n* Section headings should use the imperative mood to form a command or request\n  (e.g., “Download the data”).\n* Contractions can be used as long as the tense is clear.\n\nGuides\n^^^^^^\nTone: academic but less formal and more friendly.\n\n* Use title case capitalization in introductory/template headings, switch to\n  sentence case capitalization for learning/example section headings.\n* Contractions can be used as long as the tense is clear.\n\nFormatting Guidelines\n=====================\n\nAstropy documentation is written in reStructuredText using the Sphinx\ndocumentation generator. When formatting the different sections of your\ndocumentation files, please follow these guidelines to maintain consistency in\nsection heading hierarchy across Astropy's RST files.\n\nSection headings in reStructuredText files are created by underlining (and\noptionally overlining) the section title with a punctuation character the same\nlength as the text.\n\nExamples\n--------\n\n::\n\n  *************************\n  This is a Chapter Heading\n  *************************\n\n::\n\n  This is a Section Heading\n  =========================\n\nAlthough there are no formally assigned characters to create heading level\nhierarchy, as the hierarchy rendering is determined from the succession of\nheadings, here is a suggested convention to follow when formatting Astropy\ndocumentation files:\n\n# with overline, for parts\n* with overline, for chapters\n=, for sections\n-, for subsections\n^, for subsubsections\n\", for paragraphs\n\nThese guidelines follow Sphinx's recommendation in the `Sections\n<https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#sections>`_\nchapter of its reStructuredText Primer and Python's convention in the `7.3.6.\nSections <https://devguide.python.org/documenting/#sections>`_ part of its style\nguide.\n\nOther Writing Resources\n=======================\n\nSome other resources that may be useful when writing Astropy documentation are:\n\n* Python's `Style Guide\n  <https://devguide.python.org/documenting/#style-guide>`_\n* Sphinx's `reStructuredText Primer\n  <https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html>`_\n* `Quick reStructuredText\n  <https://docutils.sourceforge.io/docs/user/rst/quickref.html>`_\n"},{"id":531,"name":"scripts.rst","nodeType":"TextFile","path":"docs/development","text":"****************************\nWriting Command-Line Scripts\n****************************\n\nCommand-line scripts in Astropy should follow a consistent scheme to promote\nreadability and compatibility.\n\nSetuptools' `\"entry points\"`_ are used to automatically generate wrappers with\nthe correct extension. The scripts can live in their own module, or be part of\na larger module that implements a class or function for astropy library use.\nThey should have a ``main`` function to parse the arguments and pass those\narguments on to some library function so that the library function can be used\nprogrammatically when needed. The ``main`` function should accept an optional\nsingle argument that holds the ``sys.argv`` list, except for the script name\n(e.g., ``argv[1:]``). It must then be added to the list of entry points in the\n``setup.py`` file (see the example below).\n\nCommand-line options can be parsed however desired, but the :mod:`argparse`\nmodule is recommended when possible, due to its simpler and more flexible\ninterface relative to the older :mod:`optparse`.\n\n.. _\"entry points\": https://setuptools.readthedocs.io/en/latest/setuptools.html#automatic-script-creation\n\nExample\n=======\n\nContents of ``/astropy/somepackage/somemod.py`` ::\n\n    def do_something(args, option=False):\n        for a in args:\n            if option:\n                ...do something...\n            else:\n                ...do something else...\n\n    def main(args=None):\n\n        import argparse\n\n        parser = argparse.ArgumentParser(description='Process some integers.')\n        parser.add_argument('-o', '--option', dest='op',action='store_true',\n                            help='Some option that turns something on.')\n        parser.add_argument('stuff', metavar='S', nargs='+',\n                            help='Some input I should be able to get lots of.')\n\n        res = parser.parse_args(args)\n\n        do_something(res.stuff,res.op)\n\nThen add the script to the ``setup.cfg`` under this section::\n\n    [options.entry_points]\n    console_scripts =\n        somescript = astropy.somepackage.somemod:main\n"},{"col":0,"comment":"null","endLoc":36,"header":"def _known_formats()","id":532,"name":"_known_formats","nodeType":"Function","startLoc":30,"text":"def _known_formats():\n    inout = [name for name, cls in Base.registry.items()\n             if cls.parse.__func__ is not Base.parse.__func__]\n    out_only = [name for name, cls in Base.registry.items()\n                if cls.parse.__func__ is Base.parse.__func__]\n    return (f\"Valid formatter names are: {inout} for input and output, \"\n            f\"and {out_only} for output only.\")"},{"col":4,"comment":"\n        Sort of addendum to Card.__init__ to set the appropriate internal\n        attributes if the card was determined to be a RVKC.\n        ","endLoc":677,"header":"def _init_rvkc(self, keyword, field_specifier, field, value)","id":533,"name":"_init_rvkc","nodeType":"Function","startLoc":666,"text":"def _init_rvkc(self, keyword, field_specifier, field, value):\n        \"\"\"\n        Sort of addendum to Card.__init__ to set the appropriate internal\n        attributes if the card was determined to be a RVKC.\n        \"\"\"\n\n        keyword_upper = keyword.upper()\n        self._keyword = '.'.join((keyword_upper, field_specifier))\n        self._rawkeyword = keyword_upper\n        self._field_specifier = field_specifier\n        self._value = _int_or_float(value)\n        self._rawvalue = field"},{"id":534,"name":"docs/development/workflow","nodeType":"Package"},{"id":535,"name":"development_workflow.rst","nodeType":"TextFile","path":"docs/development/workflow","text":".. _development-workflow:\n\n*******************************\nHow to make a code contribution\n*******************************\n\nThis document outlines the process for contributing code to the Astropy\nproject.\n\n**Already experienced with git? Contributed before?** Jump right to\n:ref:`astropy-git`.\n\nPre-requisites\n**************\n\nBefore following the steps in this document you need:\n\n+ an account on `GitHub`_\n+ a local copy of the astropy source. Instructions for doing that, including the\n  basics you need for setting up git and GitHub, are at :ref:`get_devel`.\n\nStrongly Recommended, but not required\n**************************************\n\nYou cannot easily work on the development version of astropy in a python\nenvironment in which you also use the stable version. It can be done |emdash|\nbut can only be done *successfully* if you always remember whether the\ndevelopment version or stable version is the active one.\n\n:ref:`virtual_envs` offer a better solution and take only a few minutes to set\nup. It is well worth your time.\n\nNot sure what your first contribution should be? Take a look at the `Astropy\nissue list`_ and grab one labeled `\"package-novice\" <https://github.com/astropy/astropy/issues?q=is%3Aissue+is%3Aopen+label%3Apackage-novice>`_.\nThese issues are the most accessible ones if you are not familiar with the\nAstropy source code. Issues labeled as `\"effort-low\" <https://github.com/astropy/astropy/issues?q=is%3Aissue+is%3Aopen+label%3Aeffort-low>`_\nare expected to take a few hours (at most) to address, while the\n`\"effort-medium\" <https://github.com/astropy/astropy/issues?q=is%3Aissue+is%3Aopen+label%3Aeffort-medium>`_\nones may take a few days. The developers are friendly and want you to help, so\ndon't be shy about asking questions on the `astropy-dev mailing list`_.\n\nNew to `git`_?\n**************\n\nSome `git`_ resources\n=====================\n\nIf you have never used git or have limited experience with it, take a few\nminutes to look at these resources:\n\n* `Interactive tutorial`_ that runs in a browser\n* `Git Basics`_, part of a much longer `git book`_.\n\nIn practice, you need only a handful of `git`_ commands to make contributions\nto Astropy. There is a more extensive list of :ref:`git-resources` if you\nwant more background.\n\nDouble check your setup\n=======================\n\nBefore going further, make sure you have set up astropy as described in\n:ref:`get_devel`.\n\nIn a terminal window, change directory to the one containing your clone of\nAstropy. Then, run ``git remote``; the output should look something like this::\n\n    your-github-username\n    astropy\n\nIf that works, also run ``git fetch --all``. If it runs without errors then\nyour installation is working and you have a complete list of all branches in\nyour clone, ``your-github-username`` and ``astropy``.\n\nAbout names in `git`_\n=====================\n\n`git`_ is designed to be a *distributed* version control system. Each clone of\na repository is, itself, a repository. That can lead to some confusion,\nespecially for the branch called ``main``. If you list all of the branches\nyour clone of git knows about with ``git branch -a`` you will see there are\n*three* different branches called ``main``::\n\n    * main                              # this is main in your local repo\n    remotes/your-github-username/main   # main on your fork of Astropy on GitHub\n    remotes/astropy/main                # the official development branch of Astropy\n\nThe naming scheme used by `git`_ will also be used here. A plain branch name,\nlike ``main`` means a branch in your local copy of Astropy. A branch on a\nremote, like ``astropy`` , is labeled by that remote, ``astropy/main``.\n\nThis duplication of names can get very confusing when working with pull\nrequests, especially when the official main branch, ``astropy/main``,\nchanges due to other contributions before your contributions are merged in.\nAs a result, you should never do any work in your main\nbranch, ``main``. Always work on a branch instead.\n\nEssential `git`_ commands\n=========================\n\nA full `git`_ tutorial is beyond the scope of this document but this list\ndescribes the few ``git`` commands you are likely to encounter in contributing\nto Astropy:\n\n* ``git fetch`` gets the latest development version of Astropy, which you will\n  use as the basis for making your changes.\n* ``git branch`` makes a logically separate copy of Astropy to keep track of\n  your changes.\n* ``git add`` stages files you have changed or created for addition to `git`_.\n* ``git commit`` adds your staged changes to the repository.\n* ``git push`` copies the changes you committed to GitHub\n* ``git status`` to see a list of files that have been modified or created.\n\n.. note::\n    A good graphical interface to git makes some of these steps much\n    easier. Some options are described in :ref:`git_gui_options`.\n\nIf something goes wrong\n=======================\n\n`git`_ provides a number of ways to recover from errors. If you end up making a\n`git`_ mistake, do not hesitate to ask for help. An additional resource that\nwalks you through recovering from `git`_ mistakes is the\n`git choose-your-own-adventure`_.\n\n.. _astropy-git:\n\nAstropy Guidelines for `git`_\n*****************************\n\n* Don't use your ``main`` branch for anything. Consider :ref:`delete-main`.\n* Make a new branch, called a *feature branch*, for each separable set of\n  changes: \"one task, one branch\" (`ipython git workflow`_).\n* Start that new *feature branch* from the most current development version\n  of astropy (instructions are below).\n* Name your branch for the purpose of the changes, for example\n  ``bugfix-for-issue-14`` or ``refactor-database-code``.\n* Make frequent commits, and always include a commit message. Each commit\n  should represent one logical set of changes.\n* Ask on the `astropy-dev mailing list`_ if you get stuck.\n* Never merge changes from ``astropy/main`` into your feature branch. If\n  changes in the development version require changes to our code you can\n  :ref:`rebase`.\n\nIn addition there are a couple of `git`_ naming conventions used in this\ndocument:\n\n* Change the name of the remote ``origin`` to ``your-github-username``.\n* Name the remote that is the primary Astropy repository\n  ``astropy``; in prior versions of this documentation it was referred to as\n  ``upstream``.\n\nWorkflow\n********\n\nThese, conceptually, are the steps you will follow in contributing to Astropy:\n\n#. :ref:`fetch-latest`\n#. :ref:`make-feature-branch`; you will make your changes on this branch.\n#. :ref:`install-branch`\n#. Follow :ref:`edit-flow` to write/edit/document/test code - make\n   frequent, small commits.\n#. :ref:`add-changelog`\n#. :ref:`push-to-github`\n#. From GitHub, :ref:`pull-request` to let the Astropy maintainers know\n   you have contributions to review.\n#. :ref:`revise and push` in response to comments on the pull\n   request. Pushing those changes to GitHub automatically updates the\n   pull request.\n\nThis way of working helps to keep work well organized, with readable history.\nThis in turn makes it easier for project maintainers (that might be you) to\nsee what you've done, and why you did it.\n\nA worked example that follows these steps for fixing an Astropy issue is at\n:ref:`astropy-fix-example`.\n\nSome additional topics related to `git`_ are in :ref:`additional-git`.\n\n.. _delete-main:\n\nDeleting your main branch\n=========================\n\nIt may sound strange, but deleting your own ``main`` branch can help reduce\nconfusion about which branch you are on.  See `deleting main on github`_ for\ndetails.\n\n.. _fetch-latest:\n\nFetch the latest Astropy\n************************\n\nFrom time to time you should fetch the development version (i.e. Astropy\n``astropy/main``) changes from GitHub::\n\n   git fetch astropy --tags\n\nThis will pull down any commits you don't have, and set the remote branches to\npoint to the latest commit. For example, 'trunk' is the branch referred to by\n``astropy/main``, and if there have been commits since\nyou last checked, ``astropy/main`` will change after you do the fetch.\n\n.. _make-feature-branch:\n\nMake a new feature branch\n*************************\n\nMake the new branch\n===================\n\nWhen you are ready to make some changes to the code, you should start a new\nbranch. Branches that are for a collection of related edits are often called\n'feature branches'.\n\nMaking a new branch for each set of related changes will make it easier for\nsomeone reviewing your branch to see what you are doing.\n\nChoose an informative name for the branch to remind yourself and the rest of us\nwhat the changes in the branch are for. Branch names like ``add-ability-to-fly``\nor ``buxfix-for-issue-42`` clearly describe the purpose of the branch.\n\nAlways make your branch from ``astropy/main`` so that you are basing your\nchanges on the latest version of Astropy::\n\n    # Update the mirror of trunk\n    git fetch astropy --tags\n\n    # Make new feature branch starting at astropy/main\n    git branch my-new-feature astropy/main\n    git checkout my-new-feature\n\nConnect the branch to GitHub\n============================\n\nAt this point you have made and checked out a new branch, but `git`_ does not\nknow it should be connected to your fork on GitHub. You need that connection\nfor your proposed changes to be managed by the Astropy maintainers on GitHub.\n\nThe most convenient way for connecting your local branch to GitHub is to `git\npush`_ this new branch up to your GitHub repo with the ``--set-upstream``\noption::\n\n   git push --set-upstream your-github-username my-new-feature\n\nFrom now on git will know that ``my-new-feature`` is related to the\n``your-github-username/my-new-feature`` branch in your GitHub fork of Astropy.\n\nYou will still need to ``git push`` your changes to GitHub periodically. The\nsetup in this section will make that easier because any following pushes of\nthis branch can be performed without having to write out the remote and branch\nnames.\n\n.. _install-branch:\n\nInstall your branch\n*******************\n\nIdeally you should set up a Python virtual environment just for this fix;\ninstructions for doing to are at :ref:`virtual_envs`. Doing so ensures you\nwill not corrupt your main ``astropy`` install and makes it very easy to recover\nfrom mistakes.\n\nOnce you have activated that environment, you need to install the version of\n``astropy`` you are working on. Do that with:\n\n.. code-block:: bash\n\n    pip install -e .\n\nFor more details on building ``astropy`` from source, see\n:ref:`dev-build-astropy-subpkg`.\n\n.. _edit-flow:\n\nThe editing workflow\n********************\n\nConceptually, you will:\n\n#. Make changes to one or more files and/or add a new file.\n#. Check that your changes do not break existing code.\n#. Add documentation to your code and, as appropriate, to the Astropy\n   documentation.\n#. Ideally, also make sure your changes do not break the documentation.\n#. Add tests of the code you contribute.\n#. Commit your changes in `git`_\n#. Repeat as necessary.\n\n\nIn more detail\n==============\n\n#. Make some changes to one or more files. You should follow the Astropy\n   :ref:`code-guide`. Each logical set of changes should be treated as one\n   commit. For example, if you are fixing a known bug in Astropy and notice\n   a different bug while implementing your fix, implement the fix to that new\n   bug as a different set of changes.\n\n#. Test that your changes do not lead to *regressions*, i.e. that your\n   changes do not break existing code, by running the Astropy tests. You can\n   run all of the Astropy tests from ipython with::\n\n     import astropy\n     astropy.test()\n\n   If your change involves only a small part of Astropy, e.g. Time, you can\n   run just those tests::\n\n     import astropy\n     astropy.test(package='time')\n\n   Tests can also be run from the command line while in the package\n   root directory, e.g.::\n\n     pytest\n\n   To run the tests in only a single package, e.g. Time, you can do::\n\n     pytest -P time\n\n   For more details on running tests, please see :ref:`testing-guidelines`.\n\n#. Make sure your code includes appropriate docstrings, in the\n   `Numpydoc format`_.\n   If appropriate, as when you are adding a new feature,\n   you should update the appropriate documentation in the ``docs`` directory;\n   a detailed description is in :ref:`documentation-guidelines`.\n\n#. If you have sphinx installed, you can also check that\n   the documentation builds and looks correct by running, from the\n   ``astropy`` directory::\n\n     cd docs\n     make html\n\n   The last line should just state ``build succeeded``, and should not mention\n   any warnings.  (For more details, see :ref:`documentation-guidelines`.)\n\n#. Add tests of your new code, if appropriate. Some changes (e.g. to\n   documentation) do not need tests. Detailed instructions are at\n   :ref:`writing-tests`, but if you have no experience writing tests or\n   with the `pytest`_ testing framework submit your changes without adding\n   tests, but mention in the pull request that you have not written tests.\n   An example of writing a test is in\n   :ref:`astropy-fix-add-tests`.\n\n#. Stage your changes using ``git add`` and commit them using ``git commit``.\n   An example of doing that, based on the fix for an actual Astropy issue, is\n   at :ref:`astropy-fix-example`.\n\n   .. note::\n        Make your `git`_ commit messages short and descriptive. If a commit\n        fixes an issue, include, on the second or later line of the commit\n        message, the issue number in the commit message, like this:\n        ``Closes #123``. Doing so will automatically close the issue when the\n        pull request is accepted.\n\n#. Some modifications require more than one commit; if in doubt, break\n   your changes into a few, smaller, commits rather than one large commit\n   that does many things at once. Repeat the steps above as necessary!\n\n.. _add-changelog:\n\nAdd a changelog entry\n*********************\n\nAdd a changelog fragment briefly describing the change you made by creating\na new file in ``docs/changes/<sub-package>/``. The file should be named like\n``<PULL REQUEST>.<TYPE>.rst``, where ``<PULL REQUEST>`` is a pull request\nnumber, and ``<TYPE>`` is one of:\n\n* ``feature``: New feature.\n* ``api``: API change.\n* ``bugfix``: Bug fix.\n* ``other``: Other changes and additions.\n\nAn example entry, for the changes in `PR 1845\n<https://github.com/astropy/astropy/pull/1845>`_, the file would be\n``docs/changes/wcs/1845.bugfix.rst`` and would contain::\n\n    ``astropy.wcs.Wcs.printwcs`` will no longer warn that ``cdelt`` is\n    being ignored when none was present in the FITS file.\n\nIf you are opening a new pull request, you may not know its number yet, but you\ncan add it *after* you make the pull request. If you're not sure where to\nput the changelog entry, wait at least until a maintainer has reviewed your\nPR and assigned it to a milestone.\n\nWhen writing changelog entries, do not attempt to make API reference links\nby using single-backticks.  This is because the changelog (in its current\nformat) runs for the history of the project, and API references you make today\nmay not be valid in a future version of Astropy.  However, use of\ndouble-backticks for monospace rendering of module/class/function/argument\nnames and the like is encouraged.\n\n.. _push-to-github:\n\nCopy your changes to GitHub\n***************************\n\nIf you followed the instructions to `Connect the branch to GitHub`_ then you\ncan simply use::\n\n    git push\n\nIf you skipped that step then you need to write out the remote and branch\nnames::\n\n    git push your-github-username my-new-feature\n\n.. _pull-request:\n\nAsk for your changes to be reviewed\n***********************************\n\nA *pull request* on GitHub is a request to merge the changes you have made into\nanother repository.\n\nWhen you are ready to ask for someone to review your code and consider merging\nit into Astropy:\n\n#. Go to the URL of your fork of Astropy, e.g.,\n   ``https://github.com/your-user-name/astropy``.\n\n#. Use the 'Switch Branches' dropdown menu to select the branch with your\n   changes:\n\n   .. image:: branch_dropdown.png\n\n#. Click on the 'Pull request' button:\n\n   .. image:: pull_button.png\n\n   Enter a title for the set of changes, and some explanation of what you've\n   done. If there is anything you'd like particular attention for, like a\n   complicated change or some code you are not happy with, add the details\n   here.\n\n   If you don't think your request is ready to be merged, just say so in your\n   pull request message.  This is still a good way to start a preliminary\n   code review.\n\n   You may also opt to open a work-in-progress pull request.\n   If you do so, instead of clicking \"Create pull request\", click on the small\n   down arrow next to it and select \"Create draft pull request\". This will let\n   the maintainers know that your work is not ready for a full review nor to be\n   merged yet. In addition, if your commits are not ready for CI testing, you\n   should also use ``[ci skip]`` or ``[skip ci]`` directive in your commit message.\n\n.. _revise and push:\n\nRevise and push as necessary\n****************************\n\nYou may be asked to make changes in the discussion of the pull request. Make\nthose changes in your local copy, commit them to your local repo and push them\nto GitHub. GitHub will automatically update your pull request.\n\n.. _no git pull:\n\nDo Not Create a Merge Commit\n****************************\n\nIf your branch associated with the pull request falls behind the ``main``\nbranch of https://github.com/astropy/astropy, GitHub might offer you the option\nto catch up or resolve conflicts via its web interface, but do not use this. Using\nthe web interface might create a \"merge commit\" in your commit history, which is\nundesirable, as a \"merge commit\" can introduce maintenance overhead for the\nrelease manager as well as undesirable branch structure complexity. Do not use the ``git pull`` command either.\n\nInstead, in your local checkout, do a ``fetch`` and then a ``rebase``, and\nresolve conflicts as necessary. See :ref:`rebase` and :ref:`howto_rebase`\nfor further information.\n\n.. _rebase:\n\nRebase, but only if asked\n*************************\n\nSometimes the maintainers of Astropy may ask a pull request to be *rebased*\nor *squashed* in the process of reviewing a pull request for merging into\nthe main Astropy *main* repository.\n\nThe decisions of when to request a *squash* or *rebase* are left to\nindividual maintainers.  These may be requested to reduce the number of\nvisible commits saved in the repository history, or because of code changes\nin Astropy in the meantime.  A rebase may be necessary to allow the Continuous\nIntegration tests to run.  Both involve rewriting the `git`_ history, meaning\nthat commit hashes will change, which is why you should do it only if asked.\n\nConceptually, rebasing means taking your changes and applying them to the latest\nversion of the development branch of the official Astropy as though that was the\nversion you had originally branched from. Each individual commit remains\nvisible, but with new metadata/commit hashes. Squashing commits changes the\nmetadata/commit hash, and also removes separate visibility of individual\ncommits; a new commit and commit message will only contain a textual\nlist of the earlier commits.\n\nIt is easier to make mistakes rebasing than other areas of `git`_, so before you\nstart make a branch to serve as a backup copy of your work::\n\n    git branch tmp my-new-feature # make temporary branch--will be deleted later\n\nAfter altering the history, e.g. with ``git rebase``, a normal ``git push``\nis prevented, and a ``git push --force`` will be required.\n\n.. warning::\n\n    Do not update your branch with ``git pull``. Pulling changes from\n    ``astropy/main`` includes merging the branches, which combines them in a\n    way that preserves the commit history of both. The purpose of rebasing is\n    rewriting the commit history of your branch, not preserving it.\n\n.. _howto_rebase:\n\nHow to rebase\n*************\n\nBehind the scenes, `git`_ is deleting the changes and branch you made, making the\nchanges others made to the development branch of Astropy, then re-making your\nbranch from the development branch and applying your changes to your branch.\n\nThe actual rebasing is usually easy::\n\n    git fetch astropy main # get the latest development astropy\n    git rebase astropy/main my-new-feature\n\nYou are more likely to run into *conflicts* here — places where the changes you\nmade conflict with changes that someone else made — than anywhere else. Ask for\nhelp if you need it. Instructions are available on how to\n`resolve merge conflicts after a Git rebase <https://help.github.com/en/articles/resolving-merge-conflicts-after-a-git-rebase>`_.\n\n.. _howto_squash:\n\nHow to squash\n*************\n\nTypically we ask to *squash* when there was a fair amount of trial\nand error, but the final patch remains quite small, or when files were added\nand removed (especially binary files or files that should not remain in the\nrepository) or if the number of commits in the history is disproportionate\ncompared to the work being carried out (for example 30 commits gradually\nrefining a final 10-line change).  Conceptually this is equivalent to\nexporting the final diff from a feature branch, then starting a new branch and\napplying only that patch.\n\nMany of us find that is it actually easiest to squash using rebase. In particular,\nyou can rebase and squash within the existing branch using::\n\n  git fetch astropy\n  git rebase -i astropy/main\n\nThe last command will open an editor with all your commits, allowing you to\nsquash several commits together, rename them, etc. Helpfully, the file you are\nediting has the instructions on what to do.\n\n.. _howto_push_force:\n\nHow to push\n***********\n\nAfter using ``git rebase`` you will still need to push your changes to\nGitHub so that they are visible to others and the pull request can be\nupdated.  Use of a simple ``git push`` will be prevented because of the\nchanged history, and will need to be manually overridden using::\n\n    git push --force\n\nIf you run into any problems, do not hesitate to ask. A more detailed conceptual\ndiscussing of rebasing is at :ref:`rebase-on-trunk`.\n\nOnce the modifications and new git history are successfully pushed to GitHub you\ncan delete any backup branches that may have been created::\n\n    git branch -D tmp\n\n.. include:: links.inc\n\n.. _Interactive tutorial: http://try.github.io/\n.. _Git Basics: https://git-scm.com/book/en/Getting-Started-Git-Basics\n.. _git book: https://git-scm.com/book/\n.. _Astropy issue list: https://github.com/astropy/astropy/issues\n.. _git choose-your-own-adventure: http://sethrobertson.github.io/GitFixUm/fixup.html\n.. _numpydoc format: https://numpydoc.readthedocs.io/en/latest/format.html\n"},{"id":536,"name":"git_links.inc","nodeType":"TextFile","path":"docs/development/workflow","text":".. This (-*- rst -*-) format file contains commonly used link targets\n   and name substitutions.  It may be included in many files,\n   therefore it should only contain link targets and name\n   substitutions.  Try grepping for \"^\\.\\. _\" to find plausible\n   candidates for this list.\n\n.. NOTE: reST targets are\n   __not_case_sensitive__, so only one target definition is needed for\n   nipy, NIPY, Nipy, etc...\n\n.. git stuff\n.. _git: https://git-scm.com/\n.. _github: https://github.com/\n.. _GitHub Help: https://help.github.com/\n.. _msysgit: http://code.google.com/p/msysgit/downloads/list\n.. _git-osx-installer: http://code.google.com/p/git-osx-installer/downloads/list\n.. _git cheat sheet: https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet\n.. _pro git book: https://git-scm.com/book\n.. _git svn crash course: https://git.wiki.kernel.org/index.php/GitSvnCrashCourse\n.. _learn.github: https://services.github.com/\n.. _network graph visualizer: https://github.blog/2008-04-10-say-hello-to-the-network-graph-visualizer/\n.. _git user manual: http://schacon.github.io/git/user-manual.html\n.. _git tutorial: http://schacon.github.io/git/gittutorial.html\n.. _git community book: https://book.git-scm.com/\n.. _git ready: http://gitready.com/\n.. _git casts: https://services.github.com/\n.. _Fernando's git page: http://www.fperez.org/py4science/git.html\n.. _git magic: http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html\n.. _git concepts: https://www.sbf5.com/~cduan/technical/git/\n.. _git clone: http://schacon.github.io/git/git-clone.html\n.. _git checkout: http://schacon.github.io/git/git-checkout.html\n.. _git commit: http://schacon.github.io/git/git-commit.html\n.. _git push: http://schacon.github.io/git/git-push.html\n.. _git pull: http://schacon.github.io/git/git-pull.html\n.. _git add: http://schacon.github.io/git/git-add.html\n.. _git status: http://schacon.github.io/git/git-status.html\n.. _git diff: http://schacon.github.io/git/git-diff.html\n.. _git log: http://schacon.github.io/git/git-log.html\n.. _git branch: http://schacon.github.io/git/git-branch.html\n.. _git remote: http://schacon.github.io/git/git-remote.html\n.. _git rebase: http://schacon.github.io/git/git-rebase.html\n.. _git config: http://schacon.github.io/git/git-config.html\n.. _why the -a flag?: http://gitready.com/beginner/2009/01/18/the-staging-area.html\n.. _git staging area: http://gitready.com/beginner/2009/01/18/the-staging-area.html\n.. _tangled working copy problem: http://tomayko.com/writings/the-thing-about-git\n.. _git management: https://web.archive.org/web/20120511084711/http://kerneltrap.org/Linux/Git_Management\n.. _linux git workflow: http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg39091.html\n.. _git parable: https://tom.preston-werner.com/2009/05/19/the-git-parable.html\n.. _git foundation: http://matthew-brett.github.io/pydagogue/foundation.html\n.. _deleting main on github: http://matthew-brett.github.io/pydagogue/gh_delete_master.html\n.. _rebase without tears: http://matthew-brett.github.io/pydagogue/rebase_without_tears.html\n.. _resolving a merge: http://schacon.github.io/git/user-manual.html#resolving-a-merge\n.. _ipython git workflow: https://mail.python.org/pipermail/ipython-dev/2010-October/005632.html\n.. _ipython notebook on using git in science: https://nbviewer.jupyter.org/github/fperez/reprosw/blob/master/Version%20Control.ipynb\n\n.. other stuff\n.. |emdash| unicode:: U+02014\n.. vim: ft=rst\n"},{"col":0,"comment":"\n    Converts an a string to an int if possible, or to a float.\n\n    If the string is neither a string or a float a value error is raised.\n    ","endLoc":1212,"header":"def _int_or_float(s)","id":537,"name":"_int_or_float","nodeType":"Function","startLoc":1195,"text":"def _int_or_float(s):\n    \"\"\"\n    Converts an a string to an int if possible, or to a float.\n\n    If the string is neither a string or a float a value error is raised.\n    \"\"\"\n\n    if isinstance(s, float):\n        # Already a float so just pass through\n        return s\n\n    try:\n        return int(s)\n    except (ValueError, TypeError):\n        try:\n            return float(s)\n        except (ValueError, TypeError) as e:\n            raise ValueError(str(e))"},{"id":538,"name":"git_resources.rst","nodeType":"TextFile","path":"docs/development/workflow","text":":orphan:\n\n.. _git-resources:\n\n*************\nGit resources\n*************\n\nTutorials and summaries\n***********************\n\n* `GitHub Help`_ has an excellent series of how-to guides.\n* `learn.github`_ has an excellent series of tutorials\n* The `pro git book`_ is a good in-depth book on git.\n* A `git cheat sheet`_ is a page giving summaries of common commands.\n* The `git user manual`_\n* The `git tutorial`_\n* The `git community book`_\n* `git ready`_ |emdash| a nice series of tutorials\n* `git casts`_ |emdash| video snippets giving git how-tos.\n* `git magic`_ |emdash| extended introduction with intermediate detail\n* The `git parable`_ is an easy read explaining the concepts behind git.\n* `git foundation`_ expands on the `git parable`_.\n* Fernando Perez' git page |emdash| `Fernando's git page`_ |emdash| many\n  links and tips\n* Fernando Perez's `ipython notebook on using git in science`_\n* A good but technical page on `git concepts`_\n* `git svn crash course`_: git for those of us used to subversion\n\nManual pages online\n*******************\n\nYou can get these on your own machine with (e.g) ``git help push`` or\n(same thing) ``git push --help``, but, for convenience, here are the\nonline manual pages for some common commands:\n\n* `git add`_\n* `git branch`_\n* `git checkout`_\n* `git clone`_\n* `git commit`_\n* `git config`_\n* `git diff`_\n* `git log`_\n* `git pull`_\n* `git push`_\n* `git remote`_\n* `git status`_\n\n.. include:: links.inc\n"},{"id":539,"name":"maintainer_workflow.rst","nodeType":"TextFile","path":"docs/development/workflow","text":".. _maintainer-workflow:\n\n************************\nWorkflow for Maintainers\n************************\n\nThis page is for maintainers |emdash| those of us who merge our own or other\npeoples' changes into the upstream repository.\n\nBeing as how you're a maintainer, you are completely on top of the basic stuff\nin :ref:`development-workflow`.\n\n=======================================================\nIntegrating changes via the web interface (recommended)\n=======================================================\n\nWhenever possible, merge pull requests automatically via the pull request manager on GitHub. Merging should only be done manually if there is a really good reason to do this!\n\nMake sure that pull requests do not contain a messy history with merges, etc. If this is the case, then follow the manual instructions, and make sure the fork is rebased to tidy the history before committing.\n\n============================\nIntegrating changes manually\n============================\n\nFirst, check out the ``astropy`` repository. The instructions in :ref:`set_upstream_main` add a remote that has read-only\naccess to the upstream repo.  Being a maintainer, you've got read-write access.\n\nIt's good to have your upstream remote have a scary name, to remind you that\nit's a read-write remote::\n\n    git remote add upstream-rw git@github.com:astropy/astropy.git\n    git fetch upstream-rw --tags\n\nLet's say you have some changes that need to go into trunk\n(``upstream-rw/main``).\n\nThe changes are in some branch that you are currently on. For example, you are\nlooking at someone's changes like this::\n\n    git remote add someone git://github.com/someone/astropy.git\n    git fetch someone\n    git branch cool-feature --track someone/cool-feature\n    git checkout cool-feature\n\nSo now you are on the branch with the changes to be incorporated upstream. The\nrest of this section assumes you are on this branch.\n\nA few commits\n-------------\n\nIf there are only a few commits, consider rebasing to upstream::\n\n    # Fetch upstream changes\n    git fetch upstream-rw\n\n    # Rebase\n    git rebase upstream-rw/main\n\nRemember that, if you do a rebase, and push that, you'll have to close any\ngithub pull requests manually, because github will not be able to detect the\nchanges have already been merged.\n\nA long series of commits\n------------------------\n\nIf there are a longer series of related commits, consider a merge instead::\n\n    git fetch upstream-rw\n    git merge --no-ff upstream-rw/main\n\nThe merge will be detected by github, and should close any related pull\nrequests automatically.\n\nNote the ``--no-ff`` above. This forces git to make a merge commit, rather\nthan doing a fast-forward, so that these set of commits branch off trunk then\nrejoin the main history with a merge, rather than appearing to have been made\ndirectly on top of trunk.\n\nCheck the history\n-----------------\n\nNow, in either case, you should check that the history is sensible and you\nhave the right commits::\n\n    git log --oneline --graph\n    git log -p upstream-rw/main..\n\nThe first line above just shows the history in a compact way, with a text\nrepresentation of the history graph. The second line shows the log of commits\nexcluding those that can be reached from trunk (``upstream-rw/main``), and\nincluding those that can be reached from current HEAD (implied with the ``..``\nat the end). So, it shows the commits unique to this branch compared to trunk.\nThe ``-p`` option shows the diff for these commits in patch form.\n\nPush to trunk\n-------------\n\n::\n\n    git push upstream-rw my-new-feature:main\n\nThis pushes the ``my-new-feature`` branch in this repository to the ``main``\nbranch in the ``upstream-rw`` repository.\n\n\n.. _milestones-and-labels:\n\n===========================\nUsing Milestones and Labels\n===========================\n\nGeneral guidelines for milestones:\n\n* 100% of pull requests should have a milestone\n\n* Issues are not milestoned unless they block a given release\n\n* Only the following criteria should result in a pull request being closed without a milestone:\n\n  * Invalid (user error, etc.)\n\n  * Duplicate of an existing pull request\n\n  * A pull request superseded by a new pull request providing an alternate implementation\n\n* In general there should be the following open milestones:\n\n  * The next bug fix releases for any still-supported version lines; for example if 0.4 is in development and\n    0.2.x and 0.3.x are still supported there should be milestones for the next 0.2.x and 0.3.x releases.\n\n  * The next X.Y release, i.e. the next minor release; this is generally the next release that all development in\n    main is aimed toward.\n\n  * The next X.Y release +1; for example if 0.3 is the next release, there should also be a milestone for 0.4 for\n    issues that are important, but that we know won't be resolved in the next release.\n\n* We have `Rolling reminder: update wcslib and cfitsio and leap second/IERS B table to the latest version <https://github.com/astropy/astropy/issues/9018>`_.\n  The milestone for this issue should be updated as part of the release\n  procedures.\n\nGeneral guidelines for labels:\n\n* Issues: Maintainer should be proactive in labeling issues as they come in.\n  At the very least, label the subpackage(s) involved and whether the issue\n  is a bug.\n\n* Pull requests: We have GitHub Actions to automatically apply labels using\n  some simple rules when a pull request is opened. Once that is done, a\n  maintainer can then manually apply any other labels that apply.\n\n\n.. _changelog-format:\n\n======================================\nUpdating and Maintaining the Changelog\n======================================\n\nThe Astropy \"changelog\" is managed with\n`towncrier <https://pypi.org/project/towncrier/>`_, which is used to generate\nthe ``CHANGES.rst`` file at the root of the repository. The changelog fragment\nfiles should be added with each PR as described in\n`docs/changes/README.rst <https://github.com/astropy/astropy/blob/main/docs/changes/README.rst>`_.\nThe purpose of this file is to give a technical, but still user (and developer)\noriented overview of what changes were made to Astropy between each public\nrelease.  The idea is that it's a little more to the point and easier to follow\nthan trying to read through full git log.  It lists all new features added\nbetween versions, so that a user can easily find out from reading the changelog\nwhen a feature was added.  Likewise it lists any features or APIs that were\nchanged (and how they were changed) or removed.  It also lists all bug fixes.\nAffiliated packages are encouraged to maintain a similar changelog.\n\n.. _stale-policies:\n\n==============\nStale Policies\n==============\n\nThe ``astropy`` GitHub repository has the following stale policies, which are\nenforced by `action-astropy-stalebot <https://github.com/pllim/action-astropy-stalebot/>`_\nin `.github/workflows/stalebot.yml <https://github.com/astropy/astropy/blob/main/.github/workflows/stalebot.yml>`_\nthat runs on a schedule. Hereafter, we refer to this automated enforcer as stale-bot.\n\nAll the timing mentioned depends on a successful stale-bot run. GitHub API limits,\nspam protection, or server maintenance could affect the run. The former might\nespecially be relevant when there is a significant backlog of stale issues and\npull requests accumulated.\n\nIf you notice unintended stale-bot behaviors, please report them to the Astropy\nmaintainers.\n\nIssues\n------\n\nA maintainer applies the \"Closed?\" label to mark an issue as stale, otherwise it\nstays open until someone manually closes it. Once marked as stale, a warning will\nbe issued.\n\nA maintainer can apply \"keep-open\" label or remove \"Closed?\" label to remove the\nstale status. Otherwise, stale-bot will close the issue after about a week and\napply a \"closed-by-bot\" label.\n\nWhen both \"keep-open\" and \"Close?\" labels exist, the former will take precedence\nand the latter will be removed from the issue.\n\nPull Requests\n-------------\n\nA pull request becomes stale after about 4-5 months since the last commit (stale-bot\ncounts in seconds and naively assumes 30 days per month). When this happens, stale-bot\napplies the \"Close?\" label to it. A maintainer can also fast-track its staleness by\nmanually applying the \"Close?\" label. Once marked as stale, a warning will be issued.\n\nA maintainer can apply \"keep-open\" label or remove \"Closed?\" label to remove the\nstale status. The pull request author (or maintainer) can reset the stale timer by\npushing out a commit (e.g., by rebasing). Otherwise, stale-bot will close the\npull request after about a month and apply a \"closed-by-bot\" label.\n\n.. note::\n\n    The \"keep-open\" label should be used very sparingly, only for pull requests that\n    *must* be kept open. For example, a pull request that has been completed but cannot be\n    merged until a blocker is removed can use this label. An abandoned or incomplete\n    pull request should not use this label as it can be re-opened later when the author\n    has a renewed interest to wrap it up.\n\nWhen both \"keep-open\" and \"Close?\" labels exist, the former will take precedence\nand the latter will be removed from the pull request. If maintainer removes \"Close?\"\nwithout applying \"keep-open\" or pushing a new commit, stale-bot will mark it as\nstale again in the next run.\n\nIf a new commit is pushed but the \"Close?\" label remains, stale-bot will close\nit without another warning after another 4-5 months.\n\nIn short, to truly reset the stale timer for a pull request, it is recommended\nthat a new commit be pushed *and* the \"Close?\" label be removed.\n\n.. include:: links.inc\n"},{"col":4,"comment":"null","endLoc":529,"header":"def __new__(cls, value, unit=None, dtype=None, copy=True, order=None,\n                subok=False, ndmin=0)","id":540,"name":"__new__","nodeType":"Function","startLoc":406,"text":"def __new__(cls, value, unit=None, dtype=None, copy=True, order=None,\n                subok=False, ndmin=0):\n\n        if unit is not None:\n            # convert unit first, to avoid multiple string->unit conversions\n            unit = Unit(unit)\n\n        # optimize speed for Quantity with no dtype given, copy=False\n        if isinstance(value, Quantity):\n            if unit is not None and unit is not value.unit:\n                value = value.to(unit)\n                # the above already makes a copy (with float dtype)\n                copy = False\n\n            if type(value) is not cls and not (subok and\n                                               isinstance(value, cls)):\n                value = value.view(cls)\n\n            if dtype is None and value.dtype.kind in 'iu':\n                dtype = float\n\n            return np.array(value, dtype=dtype, copy=copy, order=order,\n                            subok=True, ndmin=ndmin)\n\n        # Maybe str, or list/tuple of Quantity? If so, this may set value_unit.\n        # To ensure array remains fast, we short-circuit it.\n        value_unit = None\n        if not isinstance(value, np.ndarray):\n            if isinstance(value, str):\n                # The first part of the regex string matches any integer/float;\n                # the second parts adds possible trailing .+-, which will break\n                # the float function below and ensure things like 1.2.3deg\n                # will not work.\n                pattern = (r'\\s*[+-]?'\n                           r'((\\d+\\.?\\d*)|(\\.\\d+)|([nN][aA][nN])|'\n                           r'([iI][nN][fF]([iI][nN][iI][tT][yY]){0,1}))'\n                           r'([eE][+-]?\\d+)?'\n                           r'[.+-]?')\n\n                v = re.match(pattern, value)\n                unit_string = None\n                try:\n                    value = float(v.group())\n\n                except Exception:\n                    raise TypeError('Cannot parse \"{}\" as a {}. It does not '\n                                    'start with a number.'\n                                    .format(value, cls.__name__))\n\n                unit_string = v.string[v.end():].strip()\n                if unit_string:\n                    value_unit = Unit(unit_string)\n                    if unit is None:\n                        unit = value_unit  # signal no conversion needed below.\n\n            elif isiterable(value) and len(value) > 0:\n                # Iterables like lists and tuples.\n                if all(isinstance(v, Quantity) for v in value):\n                    # If a list/tuple containing only quantities, convert all\n                    # to the same unit.\n                    if unit is None:\n                        unit = value[0].unit\n                    value = [q.to_value(unit) for q in value]\n                    value_unit = unit  # signal below that conversion has been done\n                elif (dtype is None and not hasattr(value, 'dtype')\n                      and isinstance(unit, StructuredUnit)):\n                    # Special case for list/tuple of values and a structured unit:\n                    # ``np.array(value, dtype=None)`` would treat tuples as lower\n                    # levels of the array, rather than as elements of a structured\n                    # array, so we use the structure of the unit to help infer the\n                    # structured dtype of the value.\n                    dtype = unit._recursively_get_dtype(value)\n\n        if value_unit is None:\n            # If the value has a `unit` attribute and if not None\n            # (for Columns with uninitialized unit), treat it like a quantity.\n            value_unit = getattr(value, 'unit', None)\n            if value_unit is None:\n                # Default to dimensionless for no (initialized) unit attribute.\n                if unit is None:\n                    unit = cls._default_unit\n                value_unit = unit  # signal below that no conversion is needed\n            else:\n                try:\n                    value_unit = Unit(value_unit)\n                except Exception as exc:\n                    raise TypeError(\"The unit attribute {!r} of the input could \"\n                                    \"not be parsed as an astropy Unit, raising \"\n                                    \"the following exception:\\n{}\"\n                                    .format(value.unit, exc))\n\n                if unit is None:\n                    unit = value_unit\n                elif unit is not value_unit:\n                    copy = False  # copy will be made in conversion at end\n\n        value = np.array(value, dtype=dtype, copy=copy, order=order,\n                         subok=True, ndmin=ndmin)\n\n        # check that array contains numbers or long int objects\n        if (value.dtype.kind in 'OSU' and\n            not (value.dtype.kind == 'O' and\n                 isinstance(value.item(0), numbers.Number))):\n            raise TypeError(\"The value must be a valid Python or \"\n                            \"Numpy numeric type.\")\n\n        # by default, cast any integer, boolean, etc., to float\n        if dtype is None and value.dtype.kind in 'iuO':\n            value = value.astype(float)\n\n        # if we allow subclasses, allow a class from the unit.\n        if subok:\n            qcls = getattr(unit, '_quantity_class', cls)\n            if issubclass(qcls, cls):\n                cls = qcls\n\n        value = value.view(cls)\n        value._set_unit(value_unit)\n        if unit is value_unit:\n            return value\n        else:\n            # here we had non-Quantity input that had a \"unit\" attribute\n            # with a unit different from the desired one.  So, convert.\n            return value.to(unit)"},{"id":541,"name":"additional_git_topics.rst","nodeType":"TextFile","path":"docs/development/workflow","text":":orphan:\n\n.. _additional-git:\n\nSome other things you might want to do\n**************************************\n\nDelete a branch on GitHub\n=========================\n\n`git`_ strongly encourages making a new branch each time you make a change in the\ncode. At some point you will need to clean up the branches you no longer need--\nthat point is *after* your changes have been accepted if you made a pull request\nfor those changes.\n\nThere are two places to delete the branch: in your local repo and on GitHub.\n\nYou can do these independent of each other.\n\nTo delete both your local copy AND the GitHub copy from the command line follow\nthese instructions::\n\n   # change to the main branch (if you still have one, otherwise change to\n   # another branch)\n   git checkout main\n\n   # delete branch locally\n   # Note: -d tells git to check whether your branch has been merged somewhere\n   # if it hasn't, and you delete it, it is gone forever.\n   #\n   # Use -D instead to force deletion regardless of merge status\n   git branch -d my-unwanted-branch\n\n   # delete branch on GitHub\n   git push origin :my-unwanted-branch\n\n(Note the colon ``:`` before ``test-branch``.) See `Github's instructions for\ndeleting a branch\n<https://help.github.com/en/articles/creating-and-deleting-branches-within-your-repository>`_\nif you want to delete the GitHub copy through GitHub.\n\nSeveral people sharing a single repository\n==========================================\n\nIf you want to work on some stuff with other people, where you are all\ncommitting into the same repository, or even the same branch, then just\nshare it via GitHub.\n\nFirst fork Astropy into your account, as from :ref:`fork_a_copy`.\n\nThen, go to your forked repository GitHub page, e.g.,\n``https://github.com/your-user-name/astropy``\n\nClick on the 'Admin' button, and add anyone else to the repo as a\ncollaborator:\n\n   .. image:: pull_button.png\n\nNow all those people can do::\n\n    git clone --recursive git@githhub.com:your-user-name/astropy.git\n\nRemember that links starting with ``git@`` use the ssh protocol and are\nread-write; links starting with ``git://`` are read-only.\n\nYour collaborators can then commit directly into that repo with the\nusual::\n\n     git commit -am 'ENH - much better code'\n     git push origin main # pushes directly into your repo\n\nExplore your repository\n=======================\n\nTo see a graphical representation of the repository branches and\ncommits::\n\n   gitk --all\n\nTo see a linear list of commits for this branch::\n\n   git log\n\nYou can also look at the `network graph visualizer`_ for your GitHub\nrepo.\n\n.. _rebase-on-trunk:\n\nRebasing on trunk\n=================\n\nLet's say you thought of some work you'd like to do. You\n:ref:`fetch-latest` and :ref:`make-feature-branch` called\n``cool-feature``. At this stage trunk is at some commit, let's call it E. Now\nyou make some new commits on your ``cool-feature`` branch, let's call them A,\nB, C. Maybe your changes take a while, or you come back to them after a while.\nIn the meantime, trunk has progressed from commit E to commit (say) G::\n\n          A---B---C cool-feature\n         /\n    D---E---F---G trunk\n\nAt this stage you consider merging trunk into your feature branch, and you\nremember that this here page sternly advises you not to do that, because the\nhistory will get messy. Most of the time you can just ask for a review, and\nnot worry that trunk has got a little ahead. But sometimes, the changes in\ntrunk might affect your changes, and you need to harmonize them. In this\nsituation you may prefer to do a rebase.\n\nRebase takes your changes (A, B, C) and replays them as if they had been made\nto the current state of ``trunk``. In other words, in this case, it takes the\nchanges represented by A, B, C and replays them on top of G. After the rebase,\nyour history will look like this::\n\n                  A'--B'--C' cool-feature\n                 /\n    D---E---F---G trunk\n\nSee `rebase without tears`_ for more detail.\n\nTo do a rebase on trunk::\n\n    # Update the mirror of trunk\n    git fetch upstream\n\n    # Go to the feature branch\n    git checkout cool-feature\n\n    # Make a backup in case you mess up\n    git branch tmp cool-feature\n\n    # Rebase cool-feature onto trunk\n    git rebase --onto upstream/main upstream/main cool-feature\n\nIn this situation, where you are already on branch ``cool-feature``, the last\ncommand can be written more succinctly as::\n\n    git rebase upstream/main\n\nWhen all looks good you can delete your backup branch::\n\n   git branch -D tmp\n\nIf it doesn't look good you may need to have a look at\n:ref:`recovering-from-mess-up`.\n\nIf you have made changes to files that have also changed in trunk, this may\ngenerate merge conflicts that you need to resolve - see the `git rebase`_ man\npage for some instructions at the end of the \"Description\" section. There is\nsome related help on merging in the git user manual - see `resolving a\nmerge`_.\n\nIf your feature branch is already on GitHub and you rebase, you will have to\nforce push the branch; a normal push would give an error. If the branch you\nrebased is called ``cool-feature`` and your GitHub fork is available as the\nremote called ``origin``, you use this command to force-push::\n\n   git push -f origin cool-feature\n\nNote that this will overwrite the branch on GitHub, i.e. this is one of the few\nways you can actually lose commits with git. Also note that it is never allowed\nto force push to the main astropy repo (typically called ``upstream``), because\nthis would re-write commit history and thus cause problems for all others.\n\n.. _recovering-from-mess-up:\n\nRecovering from mess-ups\n========================\n\nSometimes, you mess up merges or rebases. Luckily, in git it is relatively\nstraightforward to recover from such mistakes.\n\nIf you mess up during a rebase::\n\n   git rebase --abort\n\nIf you notice you messed up after the rebase::\n\n   # Reset branch back to the saved point\n   git reset --hard tmp\n\nIf you forgot to make a backup branch::\n\n   # Look at the reflog of the branch\n   git reflog show cool-feature\n\n   8630830 cool-feature@{0}: commit: BUG: io: close file handles immediately\n   278dd2a cool-feature@{1}: rebase finished: refs/heads/my-feature-branch onto 11ee694744f2552d\n   26aa21a cool-feature@{2}: commit: BUG: lib: make seek_gzip_factory not leak gzip obj\n   ...\n\n   # Reset the branch to where it was before the botched rebase\n   git reset --hard cool-feature@{2}\n\n.. _rewriting-commit-history:\n\nRewriting commit history\n========================\n\n.. note::\n\n   Do this only for your own feature branches.\n\nThere's an embarrassing typo in a commit you made? Or perhaps the you\nmade several false starts you would like the posterity not to see.\n\nThis can be done via *interactive rebasing*.\n\nSuppose that the commit history looks like this::\n\n    git log --oneline\n    eadc391 Fix some remaining bugs\n    a815645 Modify it so that it works\n    2dec1ac Fix a few bugs + disable\n    13d7934 First implementation\n    6ad92e5 * masked is now an instance of a new object, MaskedConstant\n    29001ed Add pre-nep for a couple of structured_array_extensions.\n    ...\n\nand ``6ad92e5`` is the last commit in the ``cool-feature`` branch. Suppose we\nwant to make the following changes:\n\n* Rewrite the commit message for ``13d7934`` to something more sensible.\n* Combine the commits ``2dec1ac``, ``a815645``, ``eadc391`` into a single one.\n\nWe do as follows::\n\n    # make a backup of the current state\n    git branch tmp HEAD\n    # interactive rebase\n    git rebase -i 6ad92e5\n\nThis will open an editor with the following text in it::\n\n    pick 13d7934 First implementation\n    pick 2dec1ac Fix a few bugs + disable\n    pick a815645 Modify it so that it works\n    pick eadc391 Fix some remaining bugs\n\n    # Rebase 6ad92e5..eadc391 onto 6ad92e5\n    #\n    # Commands:\n    #  p, pick = use commit\n    #  r, reword = use commit, but edit the commit message\n    #  e, edit = use commit, but stop for amending\n    #  s, squash = use commit, but meld into previous commit\n    #  f, fixup = like \"squash\", but discard this commit's log message\n    #\n    # If you remove a line here THAT COMMIT WILL BE LOST.\n    # However, if you remove everything, the rebase will be aborted.\n    #\n\nTo achieve what we want, we will make the following changes to it::\n\n    r 13d7934 First implementation\n    pick 2dec1ac Fix a few bugs + disable\n    f a815645 Modify it so that it works\n    f eadc391 Fix some remaining bugs\n\nThis means that (i) we want to edit the commit message for ``13d7934``, and\n(ii) collapse the last three commits into one. Now we save and quit the\neditor.\n\nGit will then immediately bring up an editor for editing the commit message.\nAfter revising it, we get the output::\n\n    [detached HEAD 721fc64] FOO: First implementation\n     2 files changed, 199 insertions(+), 66 deletions(-)\n    [detached HEAD 0f22701] Fix a few bugs + disable\n     1 files changed, 79 insertions(+), 61 deletions(-)\n    Successfully rebased and updated refs/heads/my-feature-branch.\n\nand the history looks now like this::\n\n     0f22701 Fix a few bugs + disable\n     721fc64 ENH: Sophisticated feature\n     6ad92e5 * masked is now an instance of a new object, MaskedConstant\n\nIf it went wrong, recovery is again possible as explained :ref:`above\n<recovering-from-mess-up>`.\n\n.. _merge-commits-and-cherry-picks:\n\nMerge commits and cherry picks\n==============================\n\nLet's say that you have a fork (origin) on GitHub of the main Astropy\nrepository (upstream).  Your fork is up to date with upstream's main branch\nand you've made some commits branching off from it on your own branch::\n\n    upstream:\n\n       main\n          |\n    A--B--C\n\n    origin:\n\n     upstream/main\n          |\n    A--B--C\n           \\\n            D--E\n               |\n           issue-branch\n\nThen say you make a pull request of issue-branch against Astroy's main, and\nthe pull request is accepted and merged.  When GitHub merges the pull request\nit's basically doing the following in the upstream repository::\n\n    $ git checkout main\n    $ git remote add yourfork file:///path/to/your/fork/astropy\n    $ git fetch yourfork\n    $ git merge --no-ff yourfork/issue-branch\n\n\nBecause it always uses ``--no-ff`` we always get a merge commit (it is possible\nto manually do a fast-forward merge of a pull request, but we rarely ever do\nthat).  Now the main Astropy repository looks like this::\n\n\n    upstream:\n\n              main\n                 |\n    A--B--C------F\n           \\    /\n            D--E\n               |\n        yourfork/issue-branch\n\nwhere \"F\" is the merge commit GitHub just made in upstream.\n\nWhen you do cherry-pick of a non-merge commit, say you want to just cherry-pick\n\"D\" from the branch, what happens is it does a diff of \"D\" with its parent (in\nthis case \"C\") and applies that diff as a patch to whatever your HEAD is.\n\nThe problem with a merge commit, such as \"F\", is that \"F\" has two parents: \"C\"\nand \"E\".  It doesn't know whether to apply the diff of \"F\" with \"C\" or the diff\nof \"F\" with \"E\".  Clearly in this case of backporting a pull request to a bug\nfix branch we want to apply everything that changed on main from the merge,\nso we want the diff of \"F\" with \"C\".\n\nSince GitHub was on ``main`` when it did ``git merge yourfork/issue-branch``, the\nlast commit in ``main`` is the first parent.  Basically whatever HEAD you're on\nwhen you do the merge is the first parent, and the tip you're merging from is\nthe second parent (octopus merge gets more complicated but only a little, and\nthat doesn't apply to pull requests).  Since parents are numbered starting from\n\"1\" then we will always cherry-pick merge commits with ``-m 1`` in this case.\n\nThat's not to say that the cherry-pick will always apply cleanly.  Say in\nupstream we also have a backport branch that we want to cherry pick \"F\" onto::\n\n    upstream:\n\n      backport\n         |\n         G       main\n        /          |\n    A--B----C------F\n             \\    /\n              D--E\n\nWe would do::\n\n    $ git checkout backport\n    $ git cherry-pick -m 1 F\n\nBut this applies the diff of \"F\" with \"C\", not of \"F\" with \"G\".  So clearly\nthere's potential for conflicts and incongruity here.  But this will work like\nany merge that has conflicts--you can resolve any conflicts manually and then\ncommit.  As long as the fix being merged is reasonably self-contained this\nusually requires little effort.\n\n.. include:: links.inc\n"},{"id":542,"name":"get_devel_version.rst","nodeType":"TextFile","path":"docs/development/workflow","text":".. _get_devel:\n\n***************************\nTry the development version\n***************************\n\n.. note::\n    `git`_ is the name of a source code management system. It is used to keep\n    track of changes made to code and to manage contributions coming from\n    several different people. If you want to read more about `git`_ right now\n    take a look at `Git Basics`_.\n\n    If you have never used `git`_ before, allow one hour the first time you do\n    this. If you find this taking more than one hour, post in one of the\n    `astropy forums <http://www.astropy.org/help.html>`_ to get help.\n\n\nTrying out the development version of astropy is useful in three ways:\n\n* More users testing new features helps uncover bugs before the feature is\n  released.\n* A bug in the most recent stable release might have been fixed in the\n  development version. Knowing whether that is the case can make your bug\n  reports more useful.\n* You will need to go through all of these steps before contributing any\n  code to `Astropy`_. Practicing now will save you time later if you plan to\n  contribute.\n\nOverview\n========\n\nConceptually, there are several steps to getting a working copy of the latest\nversion of astropy on your computer:\n\n#. :ref:`fork_a_copy`; this copy is called a *fork* (if you don't have an\n   account on `github`_ yet, go there now and make one).\n#. :ref:`check_git_install`\n#. :ref:`clone_your_fork`; this is called making a *clone* of the repository.\n#. :ref:`set_upstream_main`\n#. :ref:`make_a_branch`; this is called making a *branch*.\n#. :ref:`activate_development_astropy`\n#. :ref:`test_installation`\n#. :ref:`try_devel`\n#. :ref:`deactivate_development`\n\nStep-by-step instructions\n=========================\n\n.. _fork_a_copy:\n\nMake your own copy of Astropy on GitHub\n---------------------------------------\n\nIn the language of `GitHub`_, making a copy of someone's code is called making\na *fork*. A fork is a complete copy of the code and all of its revision\nhistory.\n\n#. Log into your `GitHub`_ account.\n\n#. Go to the `Astropy GitHub`_ home page.\n\n#. Click on the *fork* button:\n\n   .. image:: ../workflow/forking_button.png\n\n   After a short pause and an animation of Octocat scanning a book on a\n   flatbed scanner, you should find yourself at the home page for your own\n   forked copy of astropy.\n\n.. _check_git_install:\n\nMake sure git is installed and configured on your computer\n----------------------------------------------------------\n\n**Check that git is installed:**\n\nCheck by typing, in a terminal::\n\n    $ git --version\n    # if git is installed, will get something like: git version 2.20.1\n\nIf `git`_ is not installed, `get it <https://git-scm.com/downloads>`_.\n\n**Basic git configuration:**\n\nFollow the instructions at `Set Up Git at GitHub`_ to take care of two\nessential items:\n\n+ Set your user name and email in your copy of `git`_\n\n+ Set up authentication so you don't have to type your github password every\n  time you need to access github from the command line. The default method at\n  `Set Up Git at GitHub`_ may require administrative privileges; if that is a\n  problem, set up authentication\n  `using SSH keys instead <https://help.github.com/en/articles/connecting-to-github-with-ssh>`_\n\nWe also recommend setting up `git`_ so that when you copy changes from your\ncomputer to `GitHub`_ only the copy (called a *branch*) of astropy that you are\nworking on gets pushed up to GitHub.  *If* your version of git is 1.7.11 or,\ngreater, you can do that with::\n\n    git config --global push.default simple\n\nIf you skip this step now it is not a problem; `git`_ will remind you to do it in\nthose cases when it is relevant.  If your version of git is less than 1.7.11,\nyou can still continue without this, but it may lead to confusion later, as you\nmight push up branches you do not intend to push.\n\n.. note::\n\n    Make sure you make a note of which authentication method you set up\n    because it affects the command you use to copy your GitHub fork to your\n    computer.\n\n    If you set up password caching (the default method) the URLs will look like\n    ``https://github.com/your-user-name/astropy.git``.\n\n    If you set up SSH keys the URLs you use for making copies will look\n    something like ``git@github.com:your-user-name/astropy.git``.\n\n\n.. _clone_your_fork:\n\nCopy your fork of Astropy from GitHub to your computer\n------------------------------------------------------\n\nOne of the commands below will make a complete copy of your `GitHub`_ fork\nof `Astropy`_ in a directory called ``astropy``; which form you use depends\non what kind of authentication you set up in the previous step::\n\n    # Use this form if you setup SSH keys...\n    $ git clone --recursive git@github.com:your-user-name/astropy.git\n    # ...otherwise use this form:\n    $ git clone --recursive https://github.com/your-user-name/astropy.git\n\nIf there is an error at this stage it is probably an error in setting up\nauthentication.\n\n.. _set_upstream_main:\n\nTell git where to look for changes in the development version of Astropy\n------------------------------------------------------------------------\n\nRight now your local copy of astropy doesn't know where the development\nversion of astropy is. There is no easy way to keep your local copy up to\ndate. In `git`_ the name for another location of the same repository is a\n*remote*. The repository that contains the latest \"official\" development\nversion is traditionally called the *upstream* remote, but here we use a\nmore meaningful name for the remote: *astropy*.\n\nChange into the ``astropy`` directory you created in the previous step and\nlet `git`_ know about about the astropy remote::\n\n    cd astropy\n    git remote add astropy git://github.com/astropy/astropy.git\n\nYou can check that everything is set up properly so far by asking `git`_ to\nshow you all of the remotes it knows about for your local repository of\n`Astropy`_ with ``git remote -v``, which should display something like::\n\n    astropy   git://github.com/astropy/astropy.git (fetch)\n    astropy   git://github.com/astropy/astropy.git (push)\n    origin     git@github.com:your-user-name/astropy.git (fetch)\n    origin     git@github.com:your-user-name/astropy.git (push)\n\nNote that `git`_ already knew about one remote, called *origin*; that is your\nfork of `Astropy`_ on `GitHub`_.\n\nTo make more explicit that origin is really *your* fork of `Astropy`_, rename that\nremote to your `GitHub`_ user name::\n\n  git remote rename origin your-user-name\n\n.. _make_a_branch:\n\nCreate your own private workspace\n---------------------------------\n\nOne of the nice things about `git`_ is that it is easy to make what is\nessentially your own private workspace to try out coding ideas. `git`_\ncalls these workspaces *branches*.\n\nYour repository already has several branches; see them if you want by running\n``git branch -a``. Most of them are on ``remotes/origin``; in other words,\nthey exist on your remote copy of astropy on GitHub.\n\nThere is one special branch, called *main*. Right now it is the one you are\nworking on; you can tell because it has a marker next to it in your list of\nbranches: ``* main``.\n\nTo make a long story short, you never want to work on main. Always work on a branch.\n\nTo avoid potential confusion down the road, make your own branch now; this\none you can call anything you like (when making contributions you should use\na meaningful more name)::\n\n    git branch my-own-astropy\n\nYou are *not quite* done yet. Git knows about this new branch; run\n``git branch`` and you get::\n\n    * main\n      my-own-astropy\n\nThe ``*`` indicates you are still working on main. To work on your branch\ninstead you need to *check out* the branch ``my-own-astropy``. Do that with::\n\n    git checkout my-own-astropy\n\nand you should be rewarded with::\n\n    Switched to branch 'my-own-astropy'\n\n.. _activate_development_astropy:\n\n\"Activate\" the development version of astropy\n---------------------------------------------\n\nRight now you have the development version of astropy, but python will not\nsee it. Though there are more sophisticated ways of managing multiple versions\nof astropy, for now this straightforward way will work (if you want to jump\nahead to the more sophisticated method look at :ref:`virtual_envs`).\n\n.. note::\n    If you want to work on C or Cython code in `Astropy`_, this quick method\n    of activating your copy of astropy will *not* work _ -- you need to go\n    straight to using a virtual python environment.\n\nIf you have decided to use the recommended \"activation\" method with\n``pip``, please note the following: Before trying to install,\ncheck that you have the required dependency: \"cython\".\nIf not, install it with ``pip``. Note that on some platforms,\nthe pip command is ``pip3`` instead of ``pip``, so be sure to use\nthis instead in the examples below if that is the case.\nIf you have any problem with different versions of ``pip`` installed,\ntry aliasing to resolve the issue. If you are unsure about which ``pip``\nversion you are using, try the command ``which pip`` on the terminal.\n\nIn the directory where your copy of astropy is type::\n\n    pip install -e .\n\nSeveral pages of output will follow the first time you do this; this wouldn't\nbe a bad time to get a fresh cup of coffee. At the end of it you should see\nsomething like  ``Finished processing dependencies for astropy==3.2.dev6272``.\n\nTo make sure it has been activated **change to a different directory outside of\nthe astropy distribution** and try this in python::\n\n    >>> import astropy\n    >>> astropy.__version__  # doctest: +SKIP\n    '3.2.dev6272'\n\nThe actual version number will be different than in this example, but it\nshould have ``'dev'`` in the name.\n\n.. warning::\n    Right now every time you run Python, the development version of astropy\n    will be used. That is fine for testing but you should make sure you change\n    back to the stable version unless you are developing astropy. If you want\n    to develop astropy, there is a better way of separating the development\n    version from the version you do science with. That method, using a\n    `virtualenv`_, is discussed at :ref:`virtual_envs`.\n\n    For now **remember to change back to your usual version** when you are\n    done with this.\n\n.. _test_installation:\n\nTest your development copy\n--------------------------\n\nTesting is an important part of making sure astropy produces reliable,\nreproducible results. Before you try out a new feature or think you have found\na bug make sure the tests run properly on your system.\n\nBefore running your tests, please see :ref:`testing-dependencies`.\n\nIf the test *don't* complete successfully, that is itself a bug--please\n`report it <https://github.com/astropy/astropy/issues>`_.\n\nTo run the tests, navigate back to the directory your copy of astropy is in on\nyour computer, then, at the shell prompt, type::\n\n    pytest\n\nThis is another good time to get some coffee or tea. The number of test is\nlarge. When the test are done running you will see a message something like\nthis::\n\n    4741 passed, 85 skipped, 11 xfailed\n\nSkips and xfails are fine, but if there are errors or failures please\n`report them <https://github.com/astropy/astropy/issues>`_.\n\n.. _try_devel:\n\nTry out the development version\n-------------------------------\n\nIf you are going through this to ramp up to making more contributions to\n`Astropy`_ you don't actually have to do anything here.\n\nIf you are doing this because you have found a bug and are checking that it\nstill exists in the development version, try running your code.\n\nOr, just for fun, try out one of the :ref:`new features <changelog>` in\nthe development version.\n\nEither way, once you are done, make sure you do the next step.\n\n.. _deactivate_development:\n\n\"Deactivate\" the development version\n------------------------------------\n\nBe sure to turn the development version off before you go back to doing\nscience work with astropy.\n\nNavigate to the directory where your local copy of the development version is,\nthen run::\n\n    pip uninstall astropy\n\nThis should remove the development version only. Once again,\nit is important to check that you are using the proper version of\n``pip`` corresponding to the Python executable desired.\n\nYou should really confirm it is deactivated by **changing to a different\ndirectory outside of the astropy distribution** and running this in python::\n\n    >>> import astropy\n    >>> astropy.__version__  # doctest: +SKIP\n    '3.1.1'\n\nThe actual version number you see will likely be different than this example,\nbut it should not have ``'dev'`` in it.\n\n\n.. include:: links.inc\n.. _Git Basics: https://git-scm.com/book/en/Getting-Started-Git-Basics\n.. _Set Up Git at GitHub: https://help.github.com/en/articles/set-up-git#set-up-git\n"},{"id":543,"name":"git_edit_workflow_examples.rst","nodeType":"TextFile","path":"docs/development/workflow","text":":orphan:\n\n.. include:: links.inc\n.. _astropy-fix-example:\n\n**********************************************\nContributing code to Astropy, a worked example\n**********************************************\n\nThis example is based on fixing `Issue 1761`_ from the list\nof `astropy issues on GitHub <https://github.com/astropy/astropy/issues>`_.\nIt resulted in `pull request 1917`_.\n\nThe issue title was \"len() does not work for coordinates\" with description\n\"It would be nice to be able to use ``len`` on coordinate arrays to know how\nmany coordinates are present.\"\n\nThis particular example was chosen because it was tagged as easy in GitHub;\nseemed like the best place to start out!\n\nBefore you begin\n================\n\nMake sure you have a local copy of astropy set up as described in\n:ref:`get_devel`. In a nutshell, the output of ``git remote -v``, run in the\ndirectory where your local of ``astropy`` resides, should be something like this::\n\n    astropy   git@github.com:astropy/astropy.git (fetch)\n    astropy   git@github.com:astropy/astropy.git (push)\n    your-user-name     git@github.com:your-user-name/astropy.git (fetch)\n    your-user-name     git@github.com:your-user-name/astropy.git (push)\n\nThe precise form of the URLs for ``your-user-name`` depends on the\nauthentication method you set up with GitHub.\n\nThe important point is that ``astropy`` should point to the official ``astropy``\nrepo and ``your-user-name`` should point to *your* copy of ``astropy`` on GitHub.\n\n\nGrab the latest updates to astropy\n==================================\n\nA few steps in this tutorial take only a single command. They are broken out\nseparately to outline the process in words as well as code.\n\nInform your local copy of ``astropy`` about the latest changes in the development\nversion with::\n\n    git fetch astropy --tags\n\nSet up an isolated workspace\n============================\n\n+ Make a new `git`_ branch for fixing this issue and switch to the branch::\n\n    git checkout astropy/main -b fix-1761\n\n+ Make a Python environment just for this fix and switch to that environment.\n  The example below shows the necessary steps in the Miniconda/Anaconda Python\n  distribution::\n\n    conda create -n apy-1761 python=3.9 # replace 3.9 with desired version\n    conda activate apy-1761\n\n  If you are using a different distribution, see :ref:`virtual_envs` for\n  instructions for creating and activating a new environment.\n\n+ Install our branch in this environment with::\n\n    pip install -e .[test]\n\nDo you really have to set up a separate Python environment for each fix? No,\nbut you definitely want to have a Python environment for your work on code\ncontributions. Making new environments is fast, does not take much space, and\nprovide a way to keep your work organized.\n\nIf installation fails, try to upgrade ``pip`` using ``pip install pip -U``\ncommand. It is also a good practice to keep your ``conda`` up-to-date by\nrunning ``conda update conda -n base`` when prompted to do so; maybe ``git`` too.\n\nTest first, please\n==================\n\nIt would be hard to overstate the importance of testing in Astropy. Tests are\nwhat gives you confidence that new code does what it should and that it\ndoes not break old code.\n\nYou should at least run the relevant tests before you make any changes to make\nsure that your Python environment is set up properly.\n\nThe first challenge is figuring out where to look for relevant tests. `Issue\n1761`_ is a problem in the `~astropy.coordinates` package, so the tests for\nit are in ``astropy/coordinates/tests``. The rest of ``astropy`` has a similar\nlayout, as described at :ref:`testing-guidelines`.\n\nRun the current tests in that directory with::\n\n    pytest astropy/coordinates/tests\n\nIf the bug you are working on involves remote data access, you need to run\nthe tests with an extra flag, i.e., ``pytest ... --remote-data``.\n\nIn the event where all the tests passed with the bug present, new tests are\nneeded to expose this bug.\n\nA subpackage organizes its tests into multiple test modules; e.g.::\n\n    $ ls astropy/coordinates/tests\n    test_angles.py\n    test_angular_separation.py\n    test_api_ape5.py\n    test_arrays.py\n    ...\n\n`Issue 1761`_ affects arrays of coordinates, so it seems sensible to put the\nnew test in ``test_arrays.py``. As with all of the steps, when in doubt,\nplease ask on the `astropy-dev mailing list`_.\n\nThe goal at this point may be a little counter-intuitive: write a test that we\nknow will fail with the current code. This test allows ``astropy`` to check,\nin an automated way, whether our fix actually works and to prevent\nregression (i.e., make sure future changes to code do not break our fix).\n\nLooking over the existing code in ``test_arrays.py``, each test is a function\nwith a name that starts with ``test_``. An appropriate place to add the test is\nafter the last test function in the file.\n\nGive the test a reasonably clear name; e.g., ``test_array_len``. The\neasiest way to figure out what you need to import and how to set up the test\nis to look at other tests. The full test is in the traceback below and in\n`pull request 1917`_.\n\nWrite the test, then see if it works as expected; remember, in this case we\nexpect it to *fail* without the patch from `pull request 1917`_.\nRunning ``pytest astropy/coordinates/tests/test_arrays.py`` would give the expected failure;\nan excerpt from the output is::\n\n    ================= FAILURES =============================\n    ______________ test_array_len __________________________\n\n        def test_array_len():\n            from .. import ICRS\n\n            input_length = 5\n            ra = np.linspace(0, 360, input_length)\n            dec = np.linspace(0, 90, input_length)\n\n            c = ICRS(ra, dec, unit=(u.degree, u.degree))\n\n    >       assert len(c) == input_length\n    E       TypeError: object of type 'ICRS' has no len()\n\n    astropy/coordinates/tests/test_arrays.py:291: TypeError\n\nSuccess!\n\nAdd this test to your local `git`_ repo\n=======================================\n\nKeep `git`_ commits small and focused on one logical piece at a time. The test\nwe just wrote is one logical change, so we will commit it. You could, if you\nprefer, wait and commit this test along with your fix.\n\nFor this tutorial, we will commit the test separately. If you are not sure what to\ndo, ask on `astropy-dev mailing list`_.\n\nCheck what was changed\n----------------------\n\nWe can see what has changed with ``git status``::\n\n    $ git status\n    On branch fix-1761\n    Your branch is up-to-date with 'astropy/main'.\n\n    Changes not staged for commit:\n      (use \"git add <file>...\" to update what will be committed)\n      (use \"git checkout -- <file>...\" to discard changes in working directory)\n\n        modified:   astropy/coordinates/tests/test_arrays.py\n\n    no changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nThere are two bits of information here:\n\n+ one file changed; i.e., ``astropy/coordinates/tests/test_arrays.py``\n+ this file has not been added to git's staging area yet, so it is listed\n  under ``Changes not staged for commit``.\n\nUse ``git diff`` to see what changes have been made::\n\n    $ git diff\n    diff --git a/astropy/coordinates/tests/test_arrays.py b/astropy/coordinates/test\n    index 2785b59..7eecfbb 100644\n    --- a/astropy/coordinates/tests/test_arrays.py\n    +++ b/astropy/coordinates/tests/test_arrays.py\n    @@ -278,3 +278,14 @@ def test_array_indexing():\n         assert c2.equinox == c1.equinox\n         assert c3.equinox == c1.equinox\n         assert c4.equinox == c1.equinox\n    +\n    +\n    +def test_array_len():\n    +    from .. import ICRS\n    +\n    +    input_length = 5\n    +    ra = np.linspace(0, 360, input_length)\n    +    dec = np.linspace(0, 90, input_length)\n    +\n    +    c = ICRS(ra, dec, unit=(u.degree, u.degree))\n    +\n    +    assert len(c) == input_length\n\nA graphical interface to git makes keeping track of these sorts of changes\neven easier; see :ref:`git_gui_options` if you are interested.\n\nStage the change\n----------------\n\n`git`_ requires you to add changes in two steps:\n\n+ stage the change with ``git add ...``; this adds the file to\n  the list of items that will be added to the repo when you are ready to\n  commit.\n+ commit the change with ``git commit ...``; this actually adds the changes to\n  your repo.\n\nThese can be combined into one step (not recommended); the advantage of doing it in two steps\nis that it is easier to undo staging than committing. As we will see later,\n``git status`` even tells you how to do it.\n\nStaging can be very handy if you are making changes in a couple of different\nplaces that you want to commit at the same time. Make your first changes,\nstage it, then make your second change and stage that. Once everything is\nstaged, commit the changes as one commit.\n\nIn this case, first stage the change::\n\n    git add astropy/coordinates/tests/test_arrays.py\n\nYou get no notice at the command line that anything has changed, but\n``git status`` will let you know::\n\n    $ git status\n    On branch fix-1761\n    Your branch is up-to-date with 'astropy/main'.\n\n    Changes to be committed:\n      (use \"git reset HEAD <file>...\" to unstage)\n\n        modified:   astropy/coordinates/tests/test_arrays.py\n\nNote that `git`_ helpfully includes the command necessary to unstage the\nchange if you want to.\n\nCommit your change\n------------------\n\nNext, we will commit the test without the fix::\n\n    $ git commit -m \"Add test for array coordinate length (issue #1761)\"\n    [fix-1761 dd4ef8c] Add test for array coordinate length (issue #1761)\n     1 file changed, 12 insertions(+)\n\nCommit messages should be concise. Including the GitHub issue\nnumber allows GitHub to automatically create links to the relevant issue.\n\nUse ``git status`` to get a recap of where we are so far::\n\n    $ git status\n    On branch fix-1761\n    Your branch is ahead of 'astropy/main' by 1 commit.\n      (use \"git push\" to publish your local commits)\n\n    nothing to commit, working directory clean\n\nIn other words, we have made a change to our local copy of ``astropy`` but we\nhave not pushed (transferred) that change to our GitHub account.\n\nFix the issue\n=============\n\nWrite the code\n--------------\n\nNow that we have a test written, we will fix the issue. A full discussion of\nthe fix is beyond the scope of this tutorial, but the fix is to add a\n``__len__`` method to ``astropy.coordinates.SphericalCoordinatesBase`` in\n``coordsystems.py`` (the code has since been refactored, if you try to look\nfor it). All of the spherical coordinate systems inherit from\nthis base class and it is this base class that implements the\n``__getitem__`` method that allows indexing of coordinate arrays.\n\nSee `pull request 1917`_ to view the changes to the code.\n\n.. _test_changes:\n\nTest your change\n----------------\n\nThere are a few levels at which you want to test:\n\n+ Does this code change make the test we wrote succeed now? Check\n  by running ``pytest astropy/coordinates/tests/test_arrays.py``.\n  In this case, yes!\n+ Do the rest of the coordinate tests still pass? Check by running\n  ``pytest astropy/coordinates/``. In this case, yes, we have not broken\n  anything!\n+ Do all of the astropy tests still succeed? Check by running ``pytest``\n  from the top-level directory.\n  This may take a while depending on the speed of your system.\n  Success again!\n\n.. note::\n    Tests that are skipped or xfailed are fine. A fail or an error is not\n    fine. If you get stuck, ask on `astropy-dev mailing list`_ for help!\n\nStage and commit your change\n----------------------------\n\nAdd the file to your `git`_ repo in two steps: stage, then commit.\n\nTo make this a little different than the commit we did above, make sure you\nare still in the top level directory and check the ``git status``::\n\n    $ git status\n    On branch fix-1761\n    Your branch is ahead of 'astropy/main' by 1 commit.\n      (use \"git push\" to publish your local commits)\n\n    Changes not staged for commit:\n      (use \"git add <file>...\" to update what will be committed)\n      (use \"git checkout -- <file>...\" to discard changes in working directory)\n\n        modified:   astropy/coordinates/coordsystems.py\n\n    no changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nNote that git knows what has changed no matter what directory you are in (as\nlong as you are in one of the directories in the repo, that is).\n\nStage the change with::\n\n    git add astropy/coordinates/coordsystems.py\n\nFor this commit, it is helpful to use a multi-line commit message that will\nautomatically close the issue on GitHub when this change is accepted. The\nsnippet below accomplishes that in bash (and similar shells)::\n\n    $ git commit -m\"\n    > Add len() to coordinates\n    >\n    > Closes #1761\"\n    [fix-1761 f196771] Add len() to coordinates\n     1 file changed, 4 insertions(+)\n\nAnother option for multi-line commit message is to use a Git GUI or to\nrun ``git commit`` without a message to get prompted by an editor.\n\nThe message after committing should look like this when you inspect with\n``git log``::\n\n    Add len() to coordinates\n\n    Closes #1761\n\nIf the commit message does not look right, run ``git commit --amend``.\nIf you still run into problems, please ask about fixing it at\n`astropy-dev mailing list`_.\n\nAt this point, none of the Astropy maintainers know anything about\nyour changes.\n\nWe will take care of that in a moment with a \"pull request\", but first,\nsee :ref:`astropy-fix-add-tests`.\n\n.. _astropy-fix-add-tests:\n\nStop and think: Any more tests or other changes?\n================================================\n\nIt never hurts to pause at this point and review whether your proposed\nchanges are complete. In this case, there are some more tests that could\nbe included, such as:\n\n+ What happens when ``len()`` is called on a coordinate that is *not* an\n  array?\n+ Does ``len()`` work when the coordinate is an array with one entry?\n\nBoth of these are mentioned in `pull request 1917`_, so it does not hurt to check\nthem. In this case, they also provide an opportunity to illustrate a feature\nof the `pytest`_ framework.\n\nThe second case is easier, so it will be handled first following the\ndevelopment cycle we used above:\n\n+ Make the change in ``astropy/coordinates/tests/test_arrays.py``\n+ Test the change\n\nThe test passed; but rather than committing this one change, we will also\nimplement the check for the scalar case.\n\nOne could imagine two different desirable outcomes here:\n\n+ ``len(scalar_coordinate)`` behaves just like ``len(scalar_angle)``, raising\n  a `TypeError` for a scalar coordinate.\n+ ``len(scalar_coordinate)`` returns 1 since there is one coordinate.\n\nIf you encounter a case like this and are not sure what to do, ask. The best\nplace to ask is on GitHub on the page for the issue you are fixing.\n\nAlternatively, make a choice and be clear in your pull request on GitHub what\nyou chose and why; instructions for that are below.\n\nTesting for an expected error\n-----------------------------\n\nIn this case, we opted for raising a `TypeError`, because\nthe user needs to know that the coordinate they created is not going to\nbehave like an array of one coordinate if they try to index it later on.\n\nThe `pytest`_ framework makes testing for an exception relatively\neasy; you put the code you expect to fail in a ``with`` block::\n\n    c = ICRS(0, 0, unit=(u.degree, u.degree))\n\n    with pytest.raises(TypeError):\n        len(c)\n\nA test like this can be added ``test_array_len`` in ``test_arrays.py``.\nIn your own work, you may also choose to put that into a new test function,\nif you wish.\n\nAside: Python lesson--let others do your work\n---------------------------------------------\n\nThe actual fix to this issue was very, very short. In ``coordsystems.py``, two\nlines were added::\n\n    def __len__(self):\n        return len(self.lonangle)\n\n``lonangle`` contains the ``Angle``s that represent longitude (sometimes this\nis an RA, sometimes a longitude). By simply calling ``len()`` on one of the\nangles in the array you get, for free, whatever behavior has been defined in\nthe ``Angle`` class for handling the case of a scalar.\n\nAdding an explicit check for the case of a scalar here would have the very\nbig downside of having two things that need to be kept in sync: handling of\nscalars in ``Angle`` and in coordinates.\n\nCommit any additional changes\n=============================\n\nContinue to follow the development cycle above for other files that you need\nto modify, including changelog (see :ref:`git_edit_changelog`) and\ndocumentation, as needed:\n\n+ Check that **all** ``astropy`` tests still pass; see :ref:`test_changes`\n+ ``git status`` to see what needs to be staged and committed\n+ ``git add ...`` to stage the changes\n+ ``git commit ...`` to commit the changes\n+ ``git log`` to inspect the change history\n\nThe `git`_ commands, without their output, are::\n\n    git status\n    git add astropy/coordinates/tests/test_arrays.py\n    git commit -m \"Add tests of len() for scalar coordinate and length 1 coordinate\"\n    git log\n\nPush your changes to your GitHub fork of astropy\n================================================\n\nUse this command to push your local changes out to your copy of ``astropy``\non GitHub before asking for the changes to be reviewed::\n\n    git push your-user-name fix-1761\n\nPropose your changes as a pull request\n======================================\n\nThis stage requires going to your GitHub account and navigate to *your* copy\nof ``astropy``; the url will be something like\n``https://github.com/your-user-name/astropy``.\n\nOnce there, select the branch that contains your fix from the branches\ndropdown:\n\n    .. image:: worked_example_switch_branch.png\n\nAfter selecting the correct branch, click on the \"Pull Request\" button,\nas shown below:\n\n    .. image:: pull_button.png\n\nName your pull request something sensible. Include the issue number with a\nleading ``#`` in the description of the pull request so that a link is\ncreated to the original issue, as stated in ``astropy``'s pull request template.\n\nPlease see `pull request 1917`_ for the pull request showcased in this tutorial.\n\n.. _git_edit_changelog:\n\nEdit the changelog\n==================\n\nKeeping the list of changes up to date is nearly impossible unless each\ncontributor makes the appropriate updates as they propose changes.\n\nCreate a file ``docs/changes/coordinates/<PULL REQUEST>.feature.rst``, where\n``<PULL REQUEST>`` is the pull request number (1917 for this example).  The\ncontent of this file should summarize what you did. For writing changelog\nentries, you do not need to know much about the markup language being used\n(though you can read as much as you want about it at the `Sphinx primer`_); look\nat other entries and emulate.\n\nFor this issue, the file would contain::\n\n    Implemented ``len()`` for coordinate objects.\n\nPutting ``len()`` in double-backtick makes that text render in a monospaced\nfont.\n\nCommit your changes and push\n----------------------------\n\nYou can use ``git status`` as above or jump right to staging and committing::\n\n    git add docs/changes/coordinates/<PULL REQUEST>.feature.rst\n    git commit -m \"Add changelog entry\"\n    git push\n\nRevise and push as necessary\n============================\n\nYou may be asked to make changes in the discussion of the pull request. Make\nthose changes in your local copy, commit them to your local repo, and push them\nto GitHub. GitHub will automatically update your pull request.\n\n.. _Issue 1761: https://github.com/astropy/astropy/issues/1761\n.. _pull request 1917: https://github.com/astropy/astropy/pull/1917\n.. _Sphinx primer: https://www.sphinx-doc.org/\n.. _test commit: https://github.com/mwcraig/astropy/commit/cf7d5ac15d7c63ae28dac638c6484339bac5f8de\n"},{"id":544,"name":"links.inc","nodeType":"TextFile","path":"docs/development/workflow","text":".. compiling links file\n.. note ``known_links.inc`` has been subsumed into ``conf.py``\n.. include:: this_project.inc\n.. include:: git_links.inc\n"},{"id":545,"name":"virtual_pythons.rst","nodeType":"TextFile","path":"docs/development/workflow","text":":orphan:\n\n.. include:: links.inc\n.. _virtual_envs:\n\n***************************\nPython virtual environments\n***************************\n\nIf you plan to do regular work on Astropy you should do your development in\na Python virtual environment. Conceptually a virtual environment is a\nduplicate of the Python environment you normally work in, but sandboxed from\nyour default Python environment in the sense that packages installed in the\nvirtual environment do not affect your normal working environment in any way.\nThis allows you to install, for example, a development version of Astropy\nand its dependencies without it conflicting with your day-to-day work with\nAstropy and other Python packages.\n\n.. note::\n\n    \"Default Python environment\" here means whatever Python you are using\n    when you log in; i.e. the default Python installation on your system,\n    which is not in a Conda environment or virtualenv.\n\n    More specifically, in UNIX-like platforms it creates a parallel root\n    \"prefix\" with its own ``bin/``, ``lib/``, etc. directories.  When you\n    :ref:`activate <activate_env>` the virtual environment it places this\n    ``bin/`` at the head of your ``$PATH`` environment variable.\n\n    This works similarly on Windows but the details depend on how you\n    installed Python and whether or not you're using Anaconda.\n\nThere are a few options for using virtual environments; the choice of method\nis dictated by the Python distribution you use:\n\n* If you use the Anaconda/Conda Python distribution you must use the\n  `conda`_ command to make and manage your virtual environments.\n\n* If you do not use Anaconda you can use `virtualenv`_ and the conda-like\n  helper commands provided by `virtualenvwrapper`_; you *can not* use this\n  with `conda`_. As the name suggests, `virtualenvwrapper`_ is a wrapper\n  around `virtualenv`_.\n\n* A third, more recent option which is growing in popularity is `pipenv`_\n  which builds on top of `virtualenv`_ to provide project-specific Python\n  environments and dependency management.\n\nIn both cases you will go through the same basic steps; the commands to\naccomplish each step are given for both `conda`_ and `virtualenvwrapper`_:\n\n* :ref:`setup_for_env`\n* :ref:`list_env`\n* :ref:`create_env`\n* :ref:`activate_env`\n* :ref:`deactivate_env`\n* :ref:`delete_env`\n\nAnother well-maintained guide to Python virtualenvs (specifically `pipenv`_\nand `virtualenv`_, though it does not discuss `conda`_) which has been\ntranslated into multiple languages is the `Hitchhiker's Guide to Python\n<https://docs.python-guide.org/dev/virtualenvs/>`_ chapter on the subject.\n\n\n.. _setup_for_env:\n\n\nSet up for virtual environments\n===============================\n\n* `virtualenvwrapper`_:\n\n  + First, install `virtualenvwrapper`_, which will also install `virtualenv`_,\n    with::\n\n        pip install --user virtualenvwrapper\n\n  + From the `documentation for virtualenvwrapper`_, you also need to::\n\n      export WORKON_HOME=$HOME/.virtualenvs\n      export PROJECT_HOME=$HOME/\n      source /usr/local/bin/virtualenvwrapper.sh\n\n* `conda`_: No setup is necessary beyond installing the Anaconda Python\n  distribution.\n\n* `pipenv`_: Install the ``pipenv`` command using your default pip (the\n  pip in the default Python environment)::\n\n      pip install --user pipenv\n\n.. _list_env:\n\nList virtual environments\n=========================\n\nYou do not need to list the virtual environments you have created before using\nthem...but sooner or later you will forget what environments you have defined\nand this is the easy way to find out.\n\n* `virtualenvwrapper`_: ``workon``\n    + If this displays nothing you have no virtual environments\n    + If this displays ``workon: command not found`` then you haven't done\n      the :ref:`setup_for_env`; do that.\n    + For more detailed information about installed environments use\n      ``lsvirtualenv``.\n\n* `conda`_: ``conda info -e``\n    + you will always have at least one environment, called ``root``\n    + your active environment is indicated by a ``*``\n\n* `pipenv`_ does not have a concept of listing virtualenvs; it instead\n  automatically generates the virtualenv associated with a project directory\n  (e.g. the Astropy source repository on your computer).\n\n.. _create_env:\n\nCreate a new virtual environment\n================================\n\nThis needs to be done once for each virtual environment you want. There is one\nimportant choice you need to make when you create a virtual environment:\nwhich, if any, of the packages installed in your default Python environment do\nyou want in your virtual environment?\n\nIncluding them in your virtual environment doesn't take much extra space--they\nare linked into the virtual environment instead of being copied. Within the\nvirtual environment you can install new versions of packages like Numpy or\nAstropy that override the versions installed in your default Python environment.\n\nThe easiest way to get started is to include in your virtual environment the\npackages installed in your your default Python environment; the instructions\nbelow do that.\n\nIn everything that follows, ``ENV`` represents the name you give your virtual\nenvironment.\n\n**The name you choose cannot have spaces in it.**\n\n* `virtualenvwrapper`_:\n    + Make an environment called ``ENV`` with all of the packages in your\n      default Python environment::\n\n         mkvirtualenv --system-site-packages ENV\n\n    + Omit the option ``--system-site-packages`` to create an environment\n      without the Python packages installed in your default Python environment.\n    + Environments created with `virtualenvwrapper`_ always include `pip`_\n      and `setuptools <https://setuptools.readthedocs.io>`_ so that you\n      can install packages within the virtual environment.\n    + More details and examples are in the\n      `virtualenvwrapper command documentation`_.\n\n* `conda`_:\n    + Make an environment called ``ENV`` with all of the packages in your main\n      Anaconda environment::\n\n        conda create -n ENV anaconda\n\n    + More details, and examples that start with none of the packages from\n      your default Python environment, are in the\n      `documentation for the conda command`_ and the\n      `guide on how to manage environments`_.\n\n    + Next activate the environment ``ENV`` with::\n\n        conda activate ENV\n\n    + Your command-line prompt will contain ``ENV`` in parentheses by default.\n\n    + If Astropy is installed in your ``ENV`` environment, you may need to uninstall it\n      in order for the development version to install properly. You can do this\n      with the following command::\n\n        conda uninstall astropy\n\n* `pipenv`_:\n    + Make sure you are in the Astropy source directory.  See\n      :ref:`get_devel` if you are unsure how to get the source code.  After\n      running ``git clone <your-astropy-fork>`` run ``cd astropy/`` then::\n\n        pipenv install -e .\n\n    + This both creates the virtual environment for the project\n      automatically, and also installs all of Astropy's dependencies, and\n      adds your Astropy repository as the version of Astropy to use in the\n      environment.\n\n    + You can activate the environment any time you're in the top-level\n      ``astropy/`` directory (cloned from git) by running::\n\n        pipenv shell\n\n      This will open a new shell with the appropriate virtualenv enabled.\n\n      You can also run individual commands from the virtualenv without\n      activating it in the shell like::\n\n        pipenv run python\n\n.. _activate_env:\n\nActivate a virtual environment\n==============================\n\nTo use a new virtual environment you may need to activate it;\n`virtualenvwrapper`_ will try to automatically activate your new environment\nwhen you create it. Activation does two things (either of which you could do\nmanually, though it would be inconvenient):\n\n* Puts the ``bin`` directory for the virtual environment at the front of your\n  ``$PATH``.\n\n* Adds the name of the virtual environment to your command prompt. If you\n  have successfully switched to a new environment called ``ENV`` your prompt\n  should look something like this: ``(ENV)[~] $``\n\nThe commands below allow you to switch between virtual environments in\naddition to activating new ones.\n\n* `virtualenvwrapper`_: Activate the environment ``ENV`` with::\n\n      workon ENV\n\n* `conda`_: Activate the environment ``ENV`` with::\n\n      conda activate ENV\n\n* `pipenv`_: Activate the environment by changing into the project\n  directory (i.e. the copy of the Astropy repository on your computer) and\n  running::\n\n      pipenv shell\n\n\n.. _deactivate_env:\n\nDeactivate a virtual environment\n================================\n\nAt some point you may want to go back to your default Python environment. Do\nthat with:\n\n* `virtualenvwrapper`_: ``deactivate``\n    + Note that in ``virtualenvwrapper 4.1.1`` the output of\n      ``mkvirtualenv`` says you should use ``source deactivate``; that does\n      not seem to actually work.\n\n* `conda`_: ``conda deactivate``\n\n* `pipenv`_: ``exit``\n\n  .. note::\n\n    Unlike ``virtualenv`` and ``conda``, ``pipenv`` does not manipulate\n    environment variables in your current shell session.  Instead it\n    launches a *subshell* which is a copy of your previous shell, in which\n    it can then change some environment variables.  Therefore, any\n    environment variables you change in the ``pipenv`` shell will be\n    restored to their previous value (or lost entirely) when ``exit``-ing\n    the subshell.\n\n.. _delete_env:\n\nDelete a virtual environment\n============================\n\nIn both `virtualenvwrapper`_ and `conda`_ you can simply delete the\ndirectory in which the ``ENV`` is located; both also provide commands to\nmake that a bit easier.  `pipenv`_ includes a command for deleting the\nvirtual environment associated with the current directory:\n\n* `virtualenvwrapper`_: ``rmvirtualenv ENV``\n\n* `conda`_: ``conda remove --all -n ENV``\n\n* `pipenv`_: ``pipenv --rm``: As with other ``pipenv`` commands this is\n  run from within the project directory.\n\n.. _documentation for virtualenvwrapper: https://virtualenvwrapper.readthedocs.io/en/latest/install.html\n.. _virtualenvwrapper command documentation: https://virtualenvwrapper.readthedocs.io/en/latest/command_ref.html\n.. _documentation for the conda command: https://docs.conda.io/projects/conda/en/latest/commands.html\n.. _guide on how to manage environments: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html\n"},{"id":546,"name":"git_install.rst","nodeType":"TextFile","path":"docs/development/workflow","text":":orphan:\n\n.. include:: links.inc\n.. _install-git:\n\n**************************\n Install and configure git\n**************************\n\n\nGet git\n=======\n\nInstallers and instructions for all platforms are available at\nhttps://git-scm.com/downloads\n\n.. _essential_config:\n\nEssential configuration\n=======================\n\nThough technically not required to install `git`_ and get it running, configure `git`_ so that you get credit for your contributions::\n\n    git config --global user.name \"Your Name\"\n    git config --global user.email you@yourdomain.example.com\n\n.. note::\n    Use the same email address here that you used for setting up your GitHub\n    account to save yourself a couple of steps later, when you connect your\n    git to GitHub.\n\nCheck it with::\n\n    $ git config --list\n    user.name=Your Name\n    user.email=you@yourdomain.example.com\n    # ...likely followed by many other configuration values\n\n.. _git_gui_options:\n\nGet a git GUI (optional)\n========================\n\nThere are several good, free graphical interfaces for git.\nEven if you are proficient with `git`_ at the command line a GUI can be useful.\n\nMac and Windows:\n\n+ `SourceTree`_\n+ The github client for `Mac`_ or `Windows`_\n\nLinux, Mac and Windows:\n\n+ `git-cola`_\n\nThere is a more extensive list of `git GUIs`_, including non-free options, for\nall platforms.\n\n.. _git GUIs: https://git-scm.com/downloads/guis\n.. _SourceTree: https://www.sourcetreeapp.com/\n.. _Mac: https://desktop.github.com/\n.. _Windows: https://desktop.github.com/\n.. _git-cola: http://git-cola.github.io/\n"},{"id":547,"name":"patches.rst","nodeType":"TextFile","path":"docs/development/workflow","text":":orphan:\n\n.. _basic-workflow:\n\n****************\nCreating patches\n****************\n\nOverview\n========\n\nIf you haven't already configured git::\n\n    git config --global user.name \"Your Name\"\n    git config --global user.email you@yourdomain.example.com\n\nThen, the workflow is the following::\n\n   # Get the repository if you don't have it\n   git clone --recursive git://github.com/astropy/astropy.git\n\n   # Make a branch for your patching\n   cd astropy\n   git branch the-fix-im-thinking-of\n   git checkout the-fix-im-thinking-of\n\n   # hack, hack, hack\n\n   # Tell git about any new files you've made\n   git add somewhere/tests/test_my_bug.py\n\n   # Commit work in progress as you go\n   git commit -am 'BF - added tests for Funny bug'\n\n   # hack hack, hack\n\n   # Commit work\n   git commit -am 'BF - added fix for Funny bug'\n\n   # Make the patch files\n   git format-patch -M -C main\n\nThen, send the generated patch files to the `astropy-dev mailing list`_ |emdash|\nwhere we will thank you warmly.\n\nIn detail\n=========\n\n#. Tell git who you are so it can label the commits you've\n   made::\n\n    git config --global user.name \"Your Name\"\n    git config --global user.email you@yourdomain.example.com\n\n   This is only necessary if you haven't already done this, and you haven't\n   checked to :ref:`check_git_install`.\n\n#. If you don't already have one, clone a copy of the\n   Astropy_ repository::\n\n      git clone --recursive git://github.com/astropy/astropy.git\n      cd astropy\n\n#. Make a 'feature branch'. This will be where you work on your bug fix. It's\n   nice and safe and leaves you with access to an unmodified copy of the code\n   in the main branch::\n\n      git branch the-fix-im-thinking-of\n      git checkout the-fix-im-thinking-of\n\n#. Do some edits, and commit them as you go::\n\n      # hack, hack, hack\n\n      # Tell git about any new files you've made\n      git add somewhere/tests/test_my_bug.py\n\n      # Commit work in progress as you go\n      git commit -am 'BF - added tests for Funny bug'\n\n      # hack hack, hack\n\n      # Commit work\n      git commit -am 'BF - added fix for Funny bug'\n\n   Note the ``-am`` options to ``commit``. The ``m`` flag just\n   signals that you're going to type a message on the command\n   line.  The ``a`` flag |emdash| you can just take on faith |emdash|\n   or see `why the -a flag?`_.\n\n#. When you have finished, check you have committed all your changes::\n\n      git status\n\n#. Finally, make your commits into patches. You want all the commits since you\n   branched from the ``main`` branch::\n\n      git format-patch -M -C main\n\n   You will now have several files named for the commits::\n\n      0001-BF-added-tests-for-Funny-bug.patch\n      0002-BF-added-fix-for-Funny-bug.patch\n\n   Send these files to the `astropy-dev mailing list`_.\n\nWhen you are done, to switch back to the main copy of the\ncode, just return to the ``main`` branch::\n\n   git checkout main\n\n.. include:: links.inc\n"},{"id":548,"name":"this_project.inc","nodeType":"TextFile","path":"docs/development/workflow","text":".. _`Astropy GitHub`: https://github.com/astropy/astropy\n"},{"id":549,"name":"docs/uncertainty","nodeType":"Package"},{"id":550,"name":"index.rst","nodeType":"TextFile","path":"docs/uncertainty","text":".. _astropy-uncertainty:\n\n*******************************************************\nUncertainties and Distributions (`astropy.uncertainty`)\n*******************************************************\n\nIntroduction\n============\n\n.. note:: This subpackage is still in development.\n\n``astropy`` provides a |Distribution| object to represent statistical\ndistributions in a form that acts as a drop-in replacement for a |Quantity|\nobject or a regular |ndarray|. Used in this manner, |Distribution| provides\nuncertainty propagation at the cost of additional computation. It can also more\ngenerally represent sampled distributions for Monte Carlo calculation\ntechniques, for instance.\n\nThe core object for this feature is the |Distribution|. Currently, all\nsuch distributions are Monte Carlo sampled. While this means each distribution\nmay take more memory, it allows arbitrarily complex operations to be performed\non distributions while maintaining their correlation structure. Some specific\nwell-behaved distributions (e.g., the normal distribution) have\nanalytic forms which may eventually enable a more compact and efficient\nrepresentation. In the future, these may provide a coherent uncertainty\npropagation mechanism to work with `~astropy.nddata.NDData`. However, this is\nnot currently implemented. Hence, details of storing uncertainties for\n`~astropy.nddata.NDData` objects can be found in the :ref:`astropy_nddata`\nsection.\n\nGetting Started\n===============\n\nTo demonstrate a basic use case for distributions, consider the problem of\nuncertainty propagation of normal distributions. Assume there are two\nmeasurements you wish to add, each with normal uncertainties. We start\nwith some initial imports and setup::\n\n  >>> import numpy as np\n  >>> from astropy import units as u\n  >>> from astropy import uncertainty as unc\n  >>> np.random.seed(12345)  # ensures reproducible example numbers\n\nNow we create two |Distribution| objects to represent our distributions::\n\n  >>> a = unc.normal(1*u.kpc, std=30*u.pc, n_samples=10000)\n  >>> b = unc.normal(2*u.kpc, std=40*u.pc, n_samples=10000)\n\nFor normal distributions, the centers should add as expected, and the standard\ndeviations add in quadrature. We can check these results (to the limits of our\nMonte Carlo sampling) trivially with |Distribution| arithmetic and attributes::\n\n  >>> c = a + b\n  >>> c # doctest: +ELLIPSIS\n  <QuantityDistribution [...] kpc with n_samples=10000>\n  >>> c.pdf_mean() # doctest: +FLOAT_CMP\n  <Quantity 2.99970555 kpc>\n  >>> c.pdf_std().to(u.pc) # doctest: +FLOAT_CMP\n  <Quantity 50.07120457 pc>\n\nIndeed these are close to the expectations. While this may seem unnecessary for\nthe basic Gaussian case, for more complex distributions or arithmetic\noperations where error analysis becomes untenable, |Distribution| still powers\nthrough::\n\n  >>> d = unc.uniform(center=3*u.kpc, width=800*u.pc, n_samples=10000)\n  >>> e = unc.Distribution(((np.random.beta(2,5, 10000)-(2/7))/2 + 3)*u.kpc)\n  >>> f = (c * d * e) ** (1/3)\n  >>> f.pdf_mean() # doctest: +FLOAT_CMP\n  <Quantity 2.99786227 kpc>\n  >>> f.pdf_std() # doctest: +FLOAT_CMP\n  <Quantity 0.08330476 kpc>\n  >>> from matplotlib import pyplot as plt # doctest: +SKIP\n  >>> from astropy.visualization import quantity_support # doctest: +SKIP\n  >>> with quantity_support():\n  ...     plt.hist(f.distribution, bins=50) # doctest: +SKIP\n\n.. plot::\n\n  import numpy as np\n  from astropy import units as u\n  from astropy import uncertainty as unc\n  from astropy.visualization import quantity_support\n  from matplotlib import pyplot as plt\n  np.random.seed(12345)\n  a = unc.normal(1*u.kpc, std=30*u.pc, n_samples=10000)\n  b = unc.normal(2*u.kpc, std=40*u.pc, n_samples=10000)\n  c = a + b\n  d = unc.uniform(center=3*u.kpc, width=800*u.pc, n_samples=10000)\n  e = unc.Distribution(((np.random.beta(2,5, 10000)-(2/7))/2 + 3)*u.kpc)\n  f = (c * d * e) ** (1/3)\n  with quantity_support():\n      plt.hist(f.distribution, bins=50)\n\n\nUsing `astropy.uncertainty`\n===========================\n\nCreating Distributions\n----------------------\n\n.. EXAMPLE START: Creating Distributions Using Arrays or Quantities\n\nThe most direct way to create a distribution is to use an array or |Quantity|\nthat carries the samples in the *last* dimension::\n\n  >>> import numpy as np\n  >>> from astropy import units as u\n  >>> from astropy import uncertainty as unc\n  >>> np.random.seed(123456)  # ensures \"random\" numbers match examples below\n  >>> unc.Distribution(np.random.poisson(12, (1000)))  # doctest: +ELLIPSIS\n  NdarrayDistribution([..., 12,...]) with n_samples=1000\n  >>> pq = np.random.poisson([1, 5, 30, 400], (1000, 4)).T * u.ct # note the transpose, required to get the sampling on the *last* axis\n  >>> distr = unc.Distribution(pq)\n  >>> distr # doctest: +ELLIPSIS\n  <QuantityDistribution [[...],\n             [...],\n             [...],\n             [...]] ct with n_samples=1000>\n\nNote the distinction for these two distributions: the first is built from an\narray and therefore does not have |Quantity| attributes like ``unit``, while the\nlatter does have these attributes. This is reflected in how they interact with\nother objects, for example, the ``NdarrayDistribution`` will not combine with\n|Quantity| objects containing units.\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Creating Distributions Using Helper Functions\n\nFor commonly used distributions, helper functions exist to make creating them\nmore convenient. The examples below demonstrate several equivalent ways to\ncreate a normal/Gaussian distribution::\n\n  >>> center = [1, 5, 30, 400]\n  >>> n_distr = unc.normal(center*u.kpc, std=[0.2, 1.5, 4, 1]*u.kpc, n_samples=1000)\n  >>> n_distr = unc.normal(center*u.kpc, var=[0.04, 2.25, 16, 1]*u.kpc**2, n_samples=1000)\n  >>> n_distr = unc.normal(center*u.kpc, ivar=[25, 0.44444444, 0.625, 1]*u.kpc**-2, n_samples=1000)\n  >>> n_distr.distribution.shape\n  (4, 1000)\n  >>> unc.normal(center*u.kpc, std=[0.2, 1.5, 4, 1]*u.kpc, n_samples=100).distribution.shape\n  (4, 100)\n  >>> unc.normal(center*u.kpc, std=[0.2, 1.5, 4, 1]*u.kpc, n_samples=20000).distribution.shape\n  (4, 20000)\n\nAdditionally, Poisson and uniform |Distribution| creation functions exist::\n\n  >>> unc.poisson(center*u.count, n_samples=1000) # doctest: +ELLIPSIS\n  <QuantityDistribution [[...],\n               [...],\n               [...],\n               [...]] ct with n_samples=1000>\n  >>> uwidth = [10, 20, 10, 55]*u.pc\n  >>> unc.uniform(center=center*u.kpc, width=uwidth, n_samples=1000) # doctest: +ELLIPSIS\n  <QuantityDistribution [[...],\n               [...],\n               [...],\n               [...]] kpc with n_samples=1000>\n  >>> unc.uniform(lower=center*u.kpc - uwidth/2,  upper=center*u.kpc + uwidth/2, n_samples=1000)  # doctest: +ELLIPSIS\n  <QuantityDistribution [[...],\n               [...],\n               [...],\n               [...]] kpc with n_samples=1000>\n\n.. EXAMPLE END\n\nUsers are free to create their own distribution classes following similar\npatterns.\n\nUsing Distributions\n-------------------\n\n.. EXAMPLE START: Accessing Properties of Distributions\n\nThis object now acts much like a |Quantity| or |ndarray| for all but the\nnon-sampled dimension, but with additional statistical operations that work on\nthe sampled distributions::\n\n  >>> distr.shape\n  (4,)\n  >>> distr.size\n  4\n  >>> distr.unit\n  Unit(\"ct\")\n  >>> distr.n_samples\n  1000\n  >>> distr.pdf_mean() # doctest: +FLOAT_CMP\n  <Quantity [  0.998,   5.017,  30.085, 400.345] ct>\n  >>> distr.pdf_std() # doctest: +FLOAT_CMP\n  <Quantity [ 0.97262326,  2.32222114,  5.47629208, 20.6328373 ] ct>\n  >>> distr.pdf_var() # doctest: +FLOAT_CMP\n  <Quantity [  0.945996,   5.392711,  29.989775, 425.713975] ct2>\n  >>> distr.pdf_median()\n  <Quantity [   1.,   5.,  30., 400.] ct>\n  >>> distr.pdf_mad()  # Median absolute deviation # doctest: +FLOAT_CMP\n  <Quantity [ 1.,  2.,  4., 14.] ct>\n  >>> distr.pdf_smad()  # Median absolute deviation, rescaled to match std for normal # doctest: +FLOAT_CMP\n  <Quantity [ 1.48260222,  2.96520444,  5.93040887, 20.75643106] ct>\n  >>> distr.pdf_percentiles([10, 50, 90])\n  <Quantity [[  0. ,   2. ,  23. , 374. ],\n             [  1. ,   5. ,  30. , 400. ],\n             [  2. ,   8. ,  37.1, 427. ]] ct>\n  >>> distr.pdf_percentiles([.1, .5, .9]*u.dimensionless_unscaled)\n  <Quantity [[  0. ,   2. ,  23. , 374. ],\n            [  1. ,   5. ,  30. , 400. ],\n            [  2. ,   8. ,  37.1, 427. ]] ct>\n\nIf need be, the underlying array can then be accessed from the ``distribution``\nattribute::\n\n  >>> distr.distribution  # doctest: +ELLIPSIS\n  <Quantity [[...1...],\n             [...5...],\n             [...27...],\n             [...405...]] ct>\n  >>> distr.distribution.shape\n  (4, 1000)\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Interaction Between Quantity Objects and Distributions\n\nA |Quantity| distribution interacts naturally with non-|Distribution|\n|Quantity| objects, assuming the |Quantity| is a Dirac delta distribution::\n\n  >>> distr_in_kpc = distr * u.kpc/u.count  # for the sake of round numbers in examples\n  >>> distrplus = distr_in_kpc + [2000,0,0,500]*u.pc\n  >>> distrplus.pdf_median()\n  <Quantity [   3. ,   5. ,  30. , 400.5] kpc>\n  >>> distrplus.pdf_var() # doctest: +FLOAT_CMP\n  <Quantity [  0.945996,   5.392711,  29.989775, 425.713975] kpc2>\n\nIt also operates as expected with other distributions (but see below for a\ndiscussion of covariances)::\n\n  >>> another_distr = unc.Distribution((np.random.randn(1000,4)*[1000,.01 , 3000, 10] + [2000, 0, 0, 500]).T * u.pc)\n  >>> combined_distr = distr_in_kpc + another_distr\n  >>> combined_distr.pdf_median()  # doctest: +FLOAT_CMP\n  <Quantity [  3.01847755,   4.99999576,  29.60559788, 400.49176321] kpc>\n  >>> combined_distr.pdf_var()  # doctest: +FLOAT_CMP\n  <Quantity [  1.8427705 ,   5.39271147,  39.5343726 , 425.71324244] kpc2>\n\n.. EXAMPLE END\n\nCovariance in Distributions and Discrete Sampling Effects\n---------------------------------------------------------\n\nOne of the main applications for distributions is uncertainty propagation, which\ncritically requires proper treatment of covariance. This comes naturally in the\nMonte Carlo sampling approach used by the |Distribution| class, as long as\nproper care is taken with sampling error.\n\n.. EXAMPLE START: Covariance in Distributions\n\nTo start with a basic example, two un-correlated distributions should produce\nan un-correlated joint distribution plot:\n\n.. plot::\n  :context: close-figs\n  :include-source:\n\n  >>> import numpy as np\n  >>> np.random.seed(12345)  # produce repeatable plots\n  >>> from astropy import units as u\n  >>> from astropy import uncertainty as unc\n  >>> from matplotlib import pyplot as plt # doctest: +SKIP\n  >>> n1 = unc.normal(center=0., std=1, n_samples=10000)\n  >>> n2 = unc.normal(center=0., std=2, n_samples=10000)\n  >>> plt.scatter(n1.distribution, n2.distribution, s=2, lw=0, alpha=.5) # doctest: +SKIP\n  >>> plt.xlim(-4, 4) # doctest: +SKIP\n  >>> plt.ylim(-4, 4) # doctest: +SKIP\n\nIndeed, the distributions are independent. If we instead construct a covariant\npair of Gaussians, it is immediately apparent:\n\n.. plot::\n  :context: close-figs\n  :include-source:\n\n  >>> ncov = np.random.multivariate_normal([0, 0], [[1, .5], [.5, 2]], size=10000)\n  >>> n1 = unc.Distribution(ncov[:, 0])\n  >>> n2 = unc.Distribution(ncov[:, 1])\n  >>> plt.scatter(n1.distribution, n2.distribution, s=2, lw=0, alpha=.5) # doctest: +SKIP\n  >>> plt.xlim(-4, 4) # doctest: +SKIP\n  >>> plt.ylim(-4, 4) # doctest: +SKIP\n\nMost importantly, the proper correlated structure is preserved or generated as\nexpected by appropriate arithmetic operations. For example, ratios of\nuncorrelated normal distribution gain covariances if the axes are not\nindependent, as in this simulation of iron, hydrogen, and oxygen abundances in\na hypothetical collection of stars:\n\n.. plot::\n  :context: close-figs\n  :include-source:\n\n  >>> fe_abund = unc.normal(center=-2, std=.25, n_samples=10000)\n  >>> o_abund = unc.normal(center=-6., std=.5, n_samples=10000)\n  >>> h_abund = unc.normal(center=-0.7, std=.1, n_samples=10000)\n  >>> feh = fe_abund - h_abund\n  >>> ofe = o_abund - fe_abund\n  >>> plt.scatter(ofe.distribution, feh.distribution, s=2, lw=0, alpha=.5) # doctest: +SKIP\n  >>> plt.xlabel('[Fe/H]') # doctest: +SKIP\n  >>> plt.ylabel('[O/Fe]') # doctest: +SKIP\n\nThis demonstrates that the correlations naturally arise from the variables, but\nthere is no need to explicitly account for it: the sampling process naturally\nrecovers correlations that are present.\n\n.. EXAMPLE END\n\n.. EXAMPLE START: Preserving Covariance in Distributions\n\nAn important note of warning, however, is that the covariance is only preserved\nif the sampling axes are exactly matched sample by sample. If they are not, all\ncovariance information is (silently) lost:\n\n.. plot::\n  :context: close-figs\n  :include-source:\n\n  >>> n2_wrong = unc.Distribution(ncov[::-1, 1])  #reverse the sampling axis order\n  >>> plt.scatter(n1.distribution, n2_wrong.distribution, s=2, lw=0, alpha=.5) # doctest: +SKIP\n  >>> plt.xlim(-4, 4) # doctest: +SKIP\n  >>> plt.ylim(-4, 4) # doctest: +SKIP\n\nMoreover, an insufficiently sampled distribution may give poor estimates or\nhide correlations. The example below is the same as the covariant Gaussian\nexample above, but with 200x fewer samples:\n\n\n.. plot::\n  :context: close-figs\n  :include-source:\n\n  >>> ncov = np.random.multivariate_normal([0, 0], [[1, .5], [.5, 2]], size=50)\n  >>> n1 = unc.Distribution(ncov[:, 0])\n  >>> n2 = unc.Distribution(ncov[:, 1])\n  >>> plt.scatter(n1.distribution, n2.distribution, s=5, lw=0) # doctest: +SKIP\n  >>> plt.xlim(-4, 4) # doctest: +SKIP\n  >>> plt.ylim(-4, 4) # doctest: +SKIP\n  >>> np.cov(n1.distribution, n2.distribution) # doctest: +FLOAT_CMP\n  array([[1.04667972, 0.19391617],\n         [0.19391617, 1.50899902]])\n\nThe covariance structure is much less apparent by eye, and this is reflected\nin significant discrepancies between the input and output covariance matrix.\nIn general this is an intrinsic trade-off using sampled distributions: a smaller\nnumber of samples is computationally more efficient, but leads to larger\nuncertainties in any of the relevant quantities. These tend to be of order\n:math:`\\sqrt{n_{\\rm samples}}` in any derived quantity, but that depends on the\ncomplexity of the distribution in question.\n\n.. EXAMPLE END\n\n.. note that if this section gets too long, it should be moved to a separate\n   doc page - see the top of performance.inc.rst for the instructions on how to do\n   that\n.. include:: performance.inc.rst\n\nReference/API\n=============\n\n.. automodapi:: astropy.uncertainty\n"},{"id":551,"name":"performance.inc.rst","nodeType":"TextFile","path":"docs/uncertainty","text":".. note that if this is changed from the default approach of using an *include*\n   (in index.rst) to a separate performance page, the header needs to be changed\n   from === to ***, the filename extension needs to be changed from .inc.rst to\n   .rst, and a link needs to be added in the subpackage toctree\n\n.. _astropy-time-performance:\n\n.. Performance Tips\n.. ================\n..\n.. Here we provide some tips and tricks for how to optimize performance of code\n.. using `astropy.time`.\n"},{"id":552,"name":"docs/visualization","nodeType":"Package"},{"id":553,"name":"normalization.rst","nodeType":"TextFile","path":"docs/visualization","text":"\n.. _astropy-visualization-stretchnorm:\n\n**********************************\nImage stretching and normalization\n**********************************\n\nThe `astropy.visualization` module provides a framework for\ntransforming values in images (and more generally any arrays),\ntypically for the purpose of visualization. Two main types of\ntransformations are provided:\n\n* Normalization to the [0:1] range using lower and upper limits where\n  :math:`x` represents the values in the original image:\n\n.. math::\n\n    y = \\frac{x - v_{\\rm min}}{v_{\\rm max} - v_{\\rm min}}\n\n* *Stretching* of values in the [0:1] range to the [0:1] range using a\n  linear or non-linear function:\n\n.. math::\n\n    z = f(y)\n\nIn addition, classes are provided in order to identify lower and upper\nlimits for a dataset based on specific algorithms (such as using\npercentiles).\n\nIdentifying lower and upper limits, as well as re-normalizing, is\ndescribed in the `Intervals and Normalization`_ section, while\nstretching is described in the `Stretching`_ section.\n\nIntervals and Normalization\n===========================\n\nThe Quick Way\n-------------\n\n``astropy`` provides a convenience\n:func:`~astropy.visualization.mpl_normalize.simple_norm` function that can be\nuseful for quick interactive analysis:\n\n.. plot::\n    :include-source:\n    :align: center\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.visualization import simple_norm\n\n    # Generate a test image\n    image = np.arange(65536).reshape((256, 256))\n\n    # Create an ImageNormalize object\n    norm = simple_norm(image, 'sqrt')\n\n    # Display the image\n    fig = plt.figure()\n    ax = fig.add_subplot(1, 1, 1)\n    im = ax.imshow(image, origin='lower', norm=norm)\n    fig.colorbar(im)\n\nThis convenience function combines a :class:`Stretch\n<astropy.visualization.stretch.BaseStretch>` object with an :class:`Interval\n<astropy.visualization.interval.BaseInterval>` object.\nWe recommend using\n:class:`~astropy.visualization.mpl_normalize.ImageNormalize` directly\nin scripted programs instead of this convenience function.\n\n\nThe detailed way\n----------------\n\nSeveral classes are provided for determining intervals and for\nnormalizing values in this interval to the [0:1] range. One of the\nsimplest examples is the\n:class:`~astropy.visualization.MinMaxInterval` which determines the\nlimits of the values based on the minimum and maximum values in the\narray. The class is instantiated with no arguments::\n\n    >>> from astropy.visualization import MinMaxInterval\n    >>> interval = MinMaxInterval()\n\nand the limits can be determined by calling the\n:meth:`~astropy.visualization.MinMaxInterval.get_limits` method, which\ntakes the array of values::\n\n    >>> interval.get_limits([1, 3, 4, 5, 6])\n    (1, 6)\n\nThe ``interval`` instance can also be called like a function to\nactually normalize values to the range::\n\n    >>> interval([1, 3, 4, 5, 6])  # doctest: +FLOAT_CMP\n    array([0. , 0.4, 0.6, 0.8, 1. ])\n\nOther interval classes include\n:class:`~astropy.visualization.ManualInterval`,\n:class:`~astropy.visualization.PercentileInterval`,\n:class:`~astropy.visualization.AsymmetricPercentileInterval`, and\n:class:`~astropy.visualization.ZScaleInterval`. For these, values in\nthe array can fall outside of the limits given by the interval.  A\n``clip`` argument is provided to control the behavior of the\nnormalization when values fall outside the limits::\n\n    >>> from astropy.visualization import PercentileInterval\n    >>> interval = PercentileInterval(50.)\n    >>> interval.get_limits([1, 3, 4, 5, 6])\n    (3.0, 5.0)\n    >>> interval([1, 3, 4, 5, 6])  # default is clip=True  # doctest: +FLOAT_CMP\n    array([0. , 0. , 0.5, 1. , 1. ])\n    >>> interval([1, 3, 4, 5, 6], clip=False)  # doctest: +FLOAT_CMP\n    array([-1. ,  0. ,  0.5,  1. ,  1.5])\n\n\nStretching\n==========\n\nIn addition to classes that can scale values to the [0:1] range, a\nnumber of classes are provided to 'stretch' the values using different\nfunctions. These map a [0:1] range onto a transformed [0:1] range. A\nsimple example is the :class:`~astropy.visualization.SqrtStretch`\nclass::\n\n    >>> from astropy.visualization import SqrtStretch\n    >>> stretch = SqrtStretch()\n    >>> stretch([0., 0.25, 0.5, 0.75, 1.])  # doctest: +FLOAT_CMP\n    array([0.        , 0.5       , 0.70710678, 0.8660254 , 1.        ])\n\nAs for the intervals, values outside the [0:1] range can be treated\ndifferently depending on the ``clip`` argument. By default, output\nvalues are clipped to the [0:1] range::\n\n    >>> stretch([-1., 0., 0.5, 1., 1.5])  # doctest: +FLOAT_CMP\n    array([0.       , 0.        , 0.70710678, 1.        , 1.        ])\n\nbut this can be disabled::\n\n    >>> stretch([-1., 0., 0.5, 1., 1.5], clip=False)  # doctest: +FLOAT_CMP\n    array([       nan, 0.        , 0.70710678, 1.        , 1.22474487])\n\n.. note::\n    The stretch functions are similar but not always strictly\n    identical to those used in e.g. `DS9\n    <http://ds9.si.edu/site/Home.html>`_ (although they should have\n    the same behavior). The equations for the DS9 stretches can be\n    found `here <http://ds9.si.edu/doc/ref/how.html>`_ and can be\n    compared to the equations for our stretches provided in the\n    `astropy.visualization` API section. The main difference between\n    our stretches and DS9 is that we have adjusted them so that the\n    [0:1] range always maps exactly to the [0:1] range.\n\n\nCombining transformations\n=========================\n\nAny intervals and stretches can be chained by using the ``+``\noperator, which returns a new transformation. When combining intervals\nand stretches, the stretch object must come before the interval\nobject. For example, to apply normalization based on a percentile\nvalue, followed by a square root stretch, you can do::\n\n    >>> transform = SqrtStretch() + PercentileInterval(90.)\n    >>> transform([1, 3, 4, 5, 6])  # doctest: +FLOAT_CMP\n    array([0.        , 0.60302269, 0.76870611, 0.90453403, 1.        ])\n\nAs before, the combined transformation can also accept a ``clip``\nargument (which is `True` by default).\n\nMatplotlib normalization\n========================\n\nMatplotlib allows a custom normalization and stretch to be used when\ndisplaying data by passing a :class:`matplotlib.colors.Normalize`\nobject, e.g. to :meth:`~matplotlib.axes.Axes.imshow`. The\n`astropy.visualization` module provides an\n:class:`~astropy.visualization.mpl_normalize.ImageNormalize` class\nthat wraps the interval (see `Intervals and Normalization`_) and\nstretch (see `Stretching`_) objects into an object Matplotlib\nunderstands.\n\nThe inputs to the\n:class:`~astropy.visualization.mpl_normalize.ImageNormalize` class are\nthe data and the interval and stretch objects:\n\n.. plot::\n    :include-source:\n    :align: center\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    from astropy.visualization import (MinMaxInterval, SqrtStretch,\n                                       ImageNormalize)\n\n    # Generate a test image\n    image = np.arange(65536).reshape((256, 256))\n\n    # Create an ImageNormalize object\n    norm = ImageNormalize(image, interval=MinMaxInterval(),\n                          stretch=SqrtStretch())\n\n    # or equivalently using positional arguments\n    # norm = ImageNormalize(image, MinMaxInterval(), SqrtStretch())\n\n    # Display the image\n    fig = plt.figure()\n    ax = fig.add_subplot(1, 1, 1)\n    im = ax.imshow(image, origin='lower', norm=norm)\n    fig.colorbar(im)\n\nAs shown above, the colorbar ticks are automatically adjusted.\n\nPlease note that one should not use ``ax.imshow(norm(image))`` because\nthe colorbar ticks marks will represent normalized image values (on a\nlinear scale), not the actual image values.  Also, the image displayed\nby ``ax.imshow(norm(image))`` is not exactly equivalent to\n``ax.imshow(image, norm=norm)`` if the image contains ``NaN`` or\n``inf`` values.  The exact equivalent is\n``ax.imshow(norm(np.ma.masked_invalid(image))``.\n\nThe input image to\n:class:`~astropy.visualization.mpl_normalize.ImageNormalize` is\ntypically the one to be displayed, so there is a convenience function\n:func:`~astropy.visualization.mpl_normalize.imshow_norm` to ease this\nuse case:\n\n\n.. plot::\n    :include-source:\n    :align: center\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    from astropy.visualization import imshow_norm, MinMaxInterval, SqrtStretch\n\n    # Generate a test image\n    image = np.arange(65536).reshape((256, 256))\n\n    # Display the exact same thing as the above plot\n    fig = plt.figure()\n    ax = fig.add_subplot(1, 1, 1)\n    im, norm = imshow_norm(image, ax, origin='lower',\n                           interval=MinMaxInterval(), stretch=SqrtStretch())\n    fig.colorbar(im)\n\nWhile this is the simplest case, it is also possible for a completely different\nimage to be used to establish the normalization (e.g. if one wants to display\nseveral images with exactly the same normalization and stretch).\n\nThe inputs to the\n:class:`~astropy.visualization.mpl_normalize.ImageNormalize` class can\nalso be the vmin and vmax limits, which you can determine from the\n`Intervals and Normalization`_ classes, and the stretch object:\n\n.. plot::\n    :include-source:\n    :align: center\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    from astropy.visualization import (MinMaxInterval, SqrtStretch,\n                                       ImageNormalize)\n\n    # Generate a test image\n    image = np.arange(65536).reshape((256, 256))\n\n    # Create interval object\n    interval = MinMaxInterval()\n    vmin, vmax = interval.get_limits(image)\n\n    # Create an ImageNormalize object using a SqrtStretch object\n    norm = ImageNormalize(vmin=vmin, vmax=vmax, stretch=SqrtStretch())\n\n    # Display the image\n    fig = plt.figure()\n    ax = fig.add_subplot(1, 1, 1)\n    im = ax.imshow(image, origin='lower', norm=norm)\n    fig.colorbar(im)\n\n\nCombining stretches and Matplotlib normalization\n================================================\n\nStretches can also be combined with other stretches, just like transformations.\nThe resulting :class:`~astropy.visualization.stretch.CompositeStretch` can be\nused to normalize Matplotlib images like any other stretch. For example, a\ncomposite stretch can stretch residual images with negative values:\n\n.. plot::\n    :include-source:\n    :align: center\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.visualization.stretch import SinhStretch, LinearStretch\n    from astropy.visualization import ImageNormalize\n\n    # Transforms normalized values [0,1] to [-1,1] before stretch and then back\n    stretch = LinearStretch(slope=0.5, intercept=0.5) + SinhStretch() + \\\n        LinearStretch(slope=2, intercept=-1)\n\n    # Image of random Gaussian noise\n    image = np.random.normal(size=(64, 64))\n    fig = plt.figure()\n    ax = fig.add_subplot(1, 1, 1)\n    # ImageNormalize normalizes values to [0,1] before applying the stretch\n    norm = ImageNormalize(stretch=stretch, vmin=-5, vmax=5)\n    im = ax.imshow(image, origin='lower', norm=norm, cmap='gray')\n    fig.colorbar(im)\n"},{"id":554,"name":"index.rst","nodeType":"TextFile","path":"docs/visualization","text":".. _astropy-visualization:\n\n********************************************\nData Visualization (`astropy.visualization`)\n********************************************\n\nIntroduction\n============\n\n`astropy.visualization` provides functionality that can be helpful when\nvisualizing data. This includes a framework for plotting Astronomical images\nwith coordinates with Matplotlib (previously the standalone **wcsaxes**\npackage), functionality related to image normalization (including both scaling\nand stretching), smart histogram plotting, RGB color image creation from\nseparate images, and custom plotting styles for Matplotlib.\n\nUsing `astropy.visualization`\n=============================\n.. toctree::\n   :maxdepth: 2\n\n   matplotlib_integration.rst\n   wcsaxes/index.rst\n   normalization.rst\n   histogram.rst\n   rgb.rst\n\n.. _fits2bitmap:\n\nScripts\n=======\n\nThis module includes a command-line script, ``fits2bitmap`` to convert FITS\nimages to bitmaps, including scaling and stretching of the image. To find out\nmore about the available options and how to use it, type::\n\n    $ fits2bitmap --help\n\n.. note that if this section gets too long, it should be moved to a separate\n   doc page - see the top of performance.inc.rst for the instructions on how to do\n   that\n.. include:: performance.inc.rst\n\nReference/API\n=============\n\n.. automodapi:: astropy.visualization\n\n.. automodapi:: astropy.visualization.mpl_normalize\n"},{"id":555,"name":"matplotlib_integration.rst","nodeType":"TextFile","path":"docs/visualization","text":"Plotting Astropy objects in Matplotlib\n**************************************\n\n.. _plotting-quantities:\n\nPlotting quantities\n===================\n\n|Quantity| objects can be conveniently plotted using matplotlib.  This\nfeature needs to be explicitly turned on:\n\n.. doctest-requires:: matplotlib\n\n    >>> from astropy.visualization import quantity_support\n    >>> quantity_support()  # doctest: +IGNORE_OUTPUT\n    <astropy.visualization.units.MplQuantityConverter ...>\n\nThen |Quantity| objects can be passed to matplotlib plotting\nfunctions.  The axis labels are automatically labeled with the unit of\nthe quantity:\n\n.. plot::\n   :include-source:\n   :context: reset\n\n    from astropy import units as u\n    from astropy.visualization import quantity_support\n    quantity_support()\n    from matplotlib import pyplot as plt\n    plt.figure(figsize=(5,3))\n    plt.plot([1, 2, 3] * u.m)\n\nQuantities are automatically converted to the first unit set on a\nparticular axis, so in the following, the y-axis remains in ``m`` even\nthough the second line is given in ``cm``:\n\n.. plot::\n   :include-source:\n   :context:\n\n    plt.plot([1, 2, 3] * u.cm)\n\nPlotting a quantity with an incompatible unit will raise an exception.\nFor example, calling ``plt.plot([1, 2, 3] * u.kg)`` (mass unit) to overplot\non the plot above that is displaying length units.\n\nTo make sure unit support is turned off afterward, you can use\n`~astropy.visualization.quantity_support` with a ``with`` statement::\n\n    with quantity_support():\n        plt.plot([1, 2, 3] * u.m)\n\n.. _plotting-times:\n\nPlotting times\n==============\n\nMatplotlib natively provides a mechanism for plotting dates and times on one\nor both of the axes, as described in\n`Date tick labels <https://matplotlib.org/stable/gallery/text_labels_and_annotations/date.html>`_.\nTo make use of this, you can use the ``plot_date`` attribute of |Time| to get\nvalues in the time system used by Matplotlib.\n\nHowever, in many cases, you will probably want to have more control over the\nprecise scale and format to use for the tick labels, in which case you can make\nuse of the `~astropy.visualization.time_support` function. This feature needs to\nbe explicitly turned on:\n\n.. doctest-requires:: matplotlib\n\n    >>> from astropy.visualization import time_support\n    >>> time_support()  # doctest: +IGNORE_OUTPUT\n    <astropy.visualization.units.MplTimeConverter ...>\n\nOnce this is enabled, |Time| objects can be passed to matplotlib plotting\nfunctions. The axis labels are then automatically labeled with times formatted\nusing the |Time| class:\n\n.. plot::\n   :include-source:\n   :context: reset\n\n    from matplotlib import pyplot as plt\n    from astropy.time import Time\n    from astropy.visualization import time_support\n\n    time_support()\n\n    plt.figure(figsize=(5,3))\n    plt.plot(Time([58000, 59000, 62000], format='mjd'), [1.2, 3.3, 2.3])\n\nBy default, the format and scale used for the plots is taken from the first time\nthat Matplotlib encounters for a particular Axes instance. The format and scale\ncan also be explicitly controlled by passing arguments to ``time_support``:\n\n.. plot::\n   :nofigs:\n   :context: reset\n\n   from matplotlib import pyplot as plt\n   from astropy.time import Time\n   from astropy.visualization import time_support\n\n.. plot::\n   :include-source:\n   :context:\n\n    time_support(format='mjd', scale='tai')\n    plt.figure(figsize=(5,3))\n    plt.plot(Time([50000, 52000, 54000], format='mjd'), [1.2, 3.3, 2.3])\n\nTo make sure support for plotting times is turned off afterward, you can use\n`~astropy.visualization.time_support` as a context manager::\n\n    with time_support(format='mjd', scale='tai'):\n        plt.figure(figsize=(5,3))\n        plt.plot(Time([50000, 52000, 54000], format='mjd'))\n"},{"id":556,"name":"rgb.rst","nodeType":"TextFile","path":"docs/visualization","text":".. _astropy-visualization-rgb:\n\n*************************\nCreating color RGB images\n*************************\n\nRGB images can be produced using matplotlib's ability to make three-color\nimages.  In general, an RGB image is an MxNx3 array, where M is the\ny-dimension, N is the x-dimension, and the length-3 layer represents red,\ngreen, and blue, respectively.  A fourth layer representing the alpha (opacity)\nvalue can be specified.\n\nMatplotlib has several tools for manipulating these colors at\n`matplotlib.colors`.\n\nAstropy's visualization tools can be used to change the stretch and scaling of\nthe individual layers of the RGB image.  Each layer must be on a scale of 0-1\nfor floats (or 0-255 for integers); values outside that range will be clipped.\n\n\n**************************************************************\nCreating color RGB images using the Lupton et al (2004) scheme\n**************************************************************\n\n`Lupton et al. (2004)`_ describe an \"optimal\" algorithm for producing red-green-\nblue composite images from three separate high-dynamic range arrays. This method\nis implemented in `~astropy.visualization.make_lupton_rgb` as a convenience\nwrapper function and an associated set of classes to provide alternate scalings.\nThe SDSS SkyServer color images were made using a variation on this technique.\nTo generate a color PNG file with the default (arcsinh) scaling:\n\n.. _Lupton et al. (2004): https://ui.adsabs.harvard.edu/abs/2004PASP..116..133L\n\n.. plot::\n    :include-source:\n    :align: center\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.visualization import make_lupton_rgb\n    image_r = np.random.random((100,100))\n    image_g = np.random.random((100,100))\n    image_b = np.random.random((100,100))\n    image = make_lupton_rgb(image_r, image_g, image_b, stretch=0.5)\n    plt.imshow(image)\n\nThis method requires that the three images be aligned and have the same pixel\nscale and size. Changing ``minimum`` will change the black level, while\n``stretch`` and ``Q`` will change how the values between black and white are\nscaled.\n\nFor a more in-depth example, download the ``g``, ``r``, ``i`` SDSS frames\n(they will serve as the blue, green and red channels respectively) of\nthe area around the Hickson 88 group and try the example below and compare\nit with Figure 1 of `Lupton et al. (2004)`_:\n\n.. plot::\n   :context: reset\n   :include-source:\n   :align: center\n\n   import matplotlib.pyplot as plt\n   from astropy.visualization import make_lupton_rgb\n   from astropy.io import fits\n   from astropy.utils.data import get_pkg_data_filename\n\n   # Read in the three images downloaded from here:\n   g_name = get_pkg_data_filename('visualization/reprojected_sdss_g.fits.bz2')\n   r_name = get_pkg_data_filename('visualization/reprojected_sdss_r.fits.bz2')\n   i_name = get_pkg_data_filename('visualization/reprojected_sdss_i.fits.bz2')\n   g = fits.open(g_name)[0].data\n   r = fits.open(r_name)[0].data\n   i = fits.open(i_name)[0].data\n\n   rgb_default = make_lupton_rgb(i, r, g, filename=\"ngc6976-default.jpeg\")\n   plt.imshow(rgb_default, origin='lower')\n\nThe image above was generated with the default parameters. However using a\ndifferent scaling, e.g Q=10, stretch=0.5, faint features\nof the galaxies show up. Compare with Fig. 1 of `Lupton et al. (2004)`_ or the\n`SDSS Skyserver image`_.\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n   rgb = make_lupton_rgb(i, r, g, Q=10, stretch=0.5, filename=\"ngc6976.jpeg\")\n   plt.imshow(rgb, origin='lower')\n\n\n.. _SDSS Skyserver image: http://skyserver.sdss.org/dr13/en/tools/chart/navi.aspx?ra=313.12381&dec=-5.74611\n"},{"id":557,"name":"histogram.rst","nodeType":"TextFile","path":"docs/visualization","text":".. _astropy-visualization-hist:\n\n***********************\nChoosing Histogram Bins\n***********************\n\nThe :mod:`astropy.visualization` module provides the\n:func:`~astropy.visualization.hist` function, which is a generalization of\nmatplotlib's histogram function which allows for more flexible specification\nof histogram bins. For computing bins without the accompanying plot, see\n:func:`astropy.stats.histogram`.\n\nAs a motivation for this, consider the following two histograms, which are\nconstructed from the same underlying set of 5000 points, the first with\nmatplotlib's default of 10 bins, the second with an arbitrarily chosen\n200 bins:\n\n.. plot::\n   :align: center\n   :include-source:\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    # generate some complicated data\n    rng = np.random.default_rng(0)\n    t = np.concatenate([-5 + 1.8 * rng.standard_cauchy(500),\n                        -4 + 0.8 * rng.standard_cauchy(2000),\n                        -1 + 0.3 * rng.standard_cauchy(500),\n                        2 + 0.8 * rng.standard_cauchy(1000),\n                        4 + 1.5 * rng.standard_cauchy(1000)])\n\n    # truncate to a reasonable range\n    t = t[(t > -15) & (t < 15)]\n\n    # draw histograms with two different bin widths\n    fig, ax = plt.subplots(1, 2, figsize=(10, 4))\n\n    fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)\n    for i, bins in enumerate([10, 200]):\n        ax[i].hist(t, bins=bins, histtype='stepfilled', alpha=0.2, density=True)\n        ax[i].set_xlabel('t')\n        ax[i].set_ylabel('P(t)')\n        ax[i].set_title(f'plt.hist(t, bins={bins})',\n                        fontdict=dict(family='monospace'))\n\nUpon visual inspection, it is clear that each of these choices is suboptimal:\nwith 10 bins, the fine structure of the data distribution is lost, while with\n200 bins, heights of individual bins are affected by sampling error.\nThe tried-and-true method employed by most scientists is a trial and error\napproach that attempts to find a suitable midpoint between these.\n\nAstropy's :func:`~astropy.visualization.hist` function addresses this by\nproviding several methods of automatically tuning the histogram bin size.\nIt has a syntax identical to matplotlib's ``plt.hist`` function, with the\nexception of the ``bins`` parameter, which allows specification of one of\nfour different methods for automatic bin selection. These methods are\nimplemented in :func:`astropy.stats.histogram`, which has a similar syntax\nto the ``np.histogram`` function.\n\nNormal Reference Rules\n======================\nThe simplest methods of tuning the number of bins are the normal reference\nrules due to Scott (implemented in :func:`~astropy.stats.scott_bin_width`) and\nFreedman & Diaconis (implemented in :func:`~astropy.stats.freedman_bin_width`).\nThese rules proceed by assuming the data is close to normally-distributed, and\napplying a rule-of-thumb intended to minimize the difference between the\nhistogram and the underlying distribution of data.\n\nThe following figure shows the results of these two rules on the above dataset:\n\n.. plot::\n   :align: center\n   :include-source:\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.visualization import hist\n\n    # generate some complicated data\n    rng = np.random.default_rng(0)\n    t = np.concatenate([-5 + 1.8 * rng.standard_cauchy(500),\n                        -4 + 0.8 * rng.standard_cauchy(2000),\n                        -1 + 0.3 * rng.standard_cauchy(500),\n                        2 + 0.8 * rng.standard_cauchy(1000),\n                        4 + 1.5 * rng.standard_cauchy(1000)])\n\n    # truncate to a reasonable range\n    t = t[(t > -15) & (t < 15)]\n\n    # draw histograms with two different bin widths\n    fig, ax = plt.subplots(1, 2, figsize=(10, 4))\n\n    fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)\n    for i, bins in enumerate(['scott', 'freedman']):\n        hist(t, bins=bins, ax=ax[i], histtype='stepfilled',\n             alpha=0.2, density=True)\n        ax[i].set_xlabel('t')\n        ax[i].set_ylabel('P(t)')\n        ax[i].set_title(f'hist(t, bins=\"{bins}\")',\n                        fontdict=dict(family='monospace'))\n\n\nAs we can see, both of these rules of thumb choose an intermediate number of\nbins which provide a good trade-off between data representation and noise\nsuppression.\n\nBayesian Models\n===============\n\nThough rules-of-thumb like Scott's rule and the Freedman-Diaconis rule are\nfast and convenient, their strong assumptions about the data make them\nsuboptimal for more complicated distributions. Other methods of bin selection\nuse fitness functions computed on the actual data to choose an optimal binning.\nAstropy implements two of these examples: Knuth's rule (implemented in\n:func:`~astropy.stats.knuth_bin_width`) and Bayesian Blocks (implemented in\n:func:`~astropy.stats.bayesian_blocks`).\n\nKnuth's rule chooses a constant bin size which minimizes the error of the\nhistogram's approximation to the data, while the Bayesian Blocks uses a more\nflexible method which allows varying bin widths. Because both of these require\nthe minimization of a cost function across the dataset, they are more\ncomputationally intensive than the rules-of-thumb mentioned above. Here are\nthe results of these procedures for the above dataset:\n\n.. plot::\n   :align: center\n   :include-source:\n\n    import warnings\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from astropy.visualization import hist\n\n    # generate some complicated data\n    rng = np.random.default_rng(0)\n    t = np.concatenate([-5 + 1.8 * rng.standard_cauchy(500),\n                        -4 + 0.8 * rng.standard_cauchy(2000),\n                        -1 + 0.3 * rng.standard_cauchy(500),\n                        2 + 0.8 * rng.standard_cauchy(1000),\n                        4 + 1.5 * rng.standard_cauchy(1000)])\n\n    # truncate to a reasonable range\n    t = t[(t > -15) & (t < 15)]\n\n    # draw histograms with two different bin widths\n    fig, ax = plt.subplots(1, 2, figsize=(10, 4))\n\n    fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)\n    for i, bins in enumerate(['knuth', 'blocks']):\n        hist(t, bins=bins, ax=ax[i], histtype='stepfilled',\n                alpha=0.2, density=True)\n        ax[i].set_xlabel('t')\n        ax[i].set_ylabel('P(t)')\n        ax[i].set_title(f'hist(t, bins=\"{bins}\")',\n                        fontdict=dict(family='monospace'))\n\n\nNotice that both of these capture the shape of the distribution very\naccurately, and that the ``bins='blocks'`` panel selects bin widths which vary\nin width depending on the local structure in the data. Compared to standard\ndefaults, these Bayesian optimization methods provide a much more principled\nmeans of choosing histogram binning.\n"},{"id":558,"name":"performance.inc.rst","nodeType":"TextFile","path":"docs/visualization","text":".. note that if this is changed from the default approach of using an *include*\n   (in index.rst) to a separate performance page, the header needs to be changed\n   from === to ***, the filename extension needs to be changed from .inc.rst to\n   .rst, and a link needs to be added in the subpackage toctree\n\n.. _astropy-visualization-performance:\n\n.. Performance Tips\n.. ================\n..\n.. Here we provide some tips and tricks for how to optimize performance of code\n.. using `astropy.visualization`.\n"},{"id":559,"name":"docs/visualization/wcsaxes","nodeType":"Package"},{"id":560,"name":"overlaying_coordinate_systems.rst","nodeType":"TextFile","path":"docs/visualization/wcsaxes","text":"*****************************\nOverlaying coordinate systems\n*****************************\n\nFor the example in the following page we start from the example introduced in\n:ref:`initialization`.\n\n.. plot::\n   :context: reset\n   :nofigs:\n\n    from astropy.wcs import WCS\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n\n    filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')\n\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n\n    import matplotlib.pyplot as plt\n\n    ax = plt.subplot(projection=wcs)\n    ax.imshow(hdu.data, vmin=-2.e-5, vmax=2.e-4, origin='lower')\n\nThe coordinates shown by default in a plot will be those derived from the WCS\nor transformation passed to the :class:`~astropy.visualization.wcsaxes.WCSAxes` class.\nHowever, it is possible to overlay different coordinate systems using the\n:meth:`~astropy.visualization.wcsaxes.WCSAxes.get_coords_overlay` method:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    overlay = ax.get_coords_overlay('fk5')\n\nThe object returned is a :class:`~astropy.visualization.wcsaxes.coordinates_map.CoordinatesMap`, the\nsame type of object as ``ax.coord``. It can therefore be used in the same way\nas ``ax.coord`` to set the ticks, tick labels, and axis labels properties:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    ax.coords['glon'].set_ticks(color='white')\n    ax.coords['glat'].set_ticks(color='white')\n\n    ax.coords['glon'].set_axislabel('Galactic Longitude')\n    ax.coords['glat'].set_axislabel('Galactic Latitude')\n\n    ax.coords.grid(color='yellow', linestyle='solid', alpha=0.5)\n\n    overlay['ra'].set_ticks(color='white')\n    overlay['dec'].set_ticks(color='white')\n\n    overlay['ra'].set_axislabel('Right Ascension')\n    overlay['dec'].set_axislabel('Declination')\n\n    overlay.grid(color='white', linestyle='solid', alpha=0.5)\n"},{"id":561,"name":"ticks_labels_grid.rst","nodeType":"TextFile","path":"docs/visualization/wcsaxes","text":"**********************************\nTicks, tick labels, and grid lines\n**********************************\n\nFor the example in the following page we start from the example introduced in\n:ref:`initialization`.\n\n.. plot::\n   :context: reset\n   :nofigs:\n\n    from astropy.wcs import WCS\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n\n    filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')\n\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n\n    import matplotlib.pyplot as plt\n\n    ax = plt.subplot(projection=wcs)\n    ax.imshow(hdu.data, vmin=-2.e-5, vmax=2.e-4, origin='lower')\n\n.. _coordinateobjects:\n\nCoordinate objects\n******************\n\nWhile for many images, the coordinate axes are aligned with the pixel axes,\nthis is not always the case, especially if there is any rotation in the world\ncoordinate system, or in coordinate systems with high curvature, where the\ncoupling between x- and y-axis to actual coordinates become less well-defined.\n\nTherefore rather than referring to ``x`` and ``y`` ticks as Matplotlib does,\nwe use specialized objects to access the coordinates. The coordinates used in\nthe plot can be accessed using the ``coords`` attribute of the axes. As a\nreminder, if you use the pyplot interface, you can grab a reference to the axes\nwhen creating a subplot::\n\n    ax = plt.subplot()\n\nor you can call ``plt.gca()`` at any time to get the current active axes::\n\n    ax = plt.gca()\n\nIf you use the object-oriented interface to Matplotlib, you should already\nhave a reference to the axes.\n\nOnce you have an axes object, the coordinates can either be accessed by index::\n\n    lon = ax.coords[0]\n    lat = ax.coords[1]\n\nor, in the case of common coordinate systems, by their name:\n\n.. plot::\n   :context:\n   :include-source:\n   :nofigs:\n\n    lon = ax.coords['glon']\n    lat = ax.coords['glat']\n\nIn this example, the image is in Galactic coordinates, so the coordinates are\ncalled ``glon`` and ``glat``. For an image in equatorial coordinates, you\nwould use ``ra`` and ``dec``. The names are only available for specific\ncelestial coordinate systems - for all other systems, you should use the index\nof the coordinate (``0`` or ``1``).\n\nEach coordinate is an instance of the\n:class:`~astropy.visualization.wcsaxes.coordinate_helpers.CoordinateHelper` class, which can be used\nto control the appearance of the ticks, tick labels, grid lines, and axis\nlabels associated with that coordinate.\n\nAxis labels\n***********\n\nAxis labels can be added using the\n:meth:`~astropy.visualization.wcsaxes.coordinate_helpers.CoordinateHelper.set_axislabel` method:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    lon.set_axislabel('Galactic Longitude')\n    lat.set_axislabel('Galactic Latitude')\n\nThe padding of the axis label with respect to the axes can also be adjusted by\nusing the ``minpad`` option. The default value for ``minpad`` is 1 and is in\nterms of the font size of the axis label text. Negative values are also\nallowed.\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    lon.set_axislabel('Galactic Longitude', minpad=0.3)\n    lat.set_axislabel('Galactic Latitude', minpad=-0.4)\n\n\n.. plot::\n   :context:\n   :nofigs:\n\n    lon.set_axislabel('Galactic Longitude', minpad=1)\n    lat.set_axislabel('Galactic Latitude', minpad=1)\n\n.. note:: Note that, as shown in :ref:`wcsaxes-getting-started`, it is also\n          possible to use the normal ``plt.xlabel`` or ``ax.set_xlabel``\n          notation to set the axis labels in the case where they do appear on\n          the x and y axis.\n\n.. _tick_label_format:\n\nTick label format\n*****************\n\nThe format of the tick labels can be specified with a string describing the\nformat:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    lon.set_major_formatter('dd:mm:ss.s')\n    lat.set_major_formatter('dd:mm')\n\nThe syntax for the format string is the following:\n\n==================== ====================\n       format              result\n==================== ====================\n``'dd'``              ``'15d'``\n``'dd:mm'``           ``'15d24m'``\n``'dd:mm:ss'``        ``'15d23m32s'``\n``'dd:mm:ss.s'``      ``'15d23m32.0s'``\n``'dd:mm:ss.ssss'``   ``'15d23m32.0316s'``\n``'hh'``              ``'1h'``\n``'hh:mm'``           ``'1h02m'``\n``'hh:mm:ss'``        ``'1h01m34s'``\n``'hh:mm:ss.s'``      ``'1h01m34.1s'``\n``'hh:mm:ss.ssss'``   ``'1h01m34.1354s'``\n``'d'``               ``'15'``\n``'d.d'``             ``'15.4'``\n``'d.dd'``            ``'15.39'``\n``'d.ddd'``           ``'15.392'``\n``'m'``               ``'924'``\n``'m.m'``             ``'923.5'``\n``'m.mm'``            ``'923.53'``\n``'s'``               ``'55412'``\n``'s.s'``             ``'55412.0'``\n``'s.ss'``            ``'55412.03'``\n``'x.xxxx'``          ``'15.3922'``\n``'%.2f'``            ``'15.39'``\n``'%.3f'``            ``'15.392'``\n``'%d'``              ``'15'``\n==================== ====================\n\nAll the ``h...``, ``d...``, ``m...``, and ``s...`` formats can be used for\nangular coordinate axes, while the ``x...`` format or valid Python formats\n(see `String Formatting Operations\n<https://docs.python.org/3/library/stdtypes.html#string-formatting>`_) should\nbe used for non-angular coordinate axes.\n\nThe separators for angular coordinate tick labels can also be set by\nspecifying a string or a tuple.\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    lon.set_separator(('d', \"'\", '\"'))\n    lat.set_separator(':-s')\n\n\nTick/label spacing and properties\n*********************************\n\nThe spacing of ticks/tick labels should have a sensible default, but you may\nwant to be able to manually specify the spacing. This can be done using the\n:meth:`~astropy.visualization.wcsaxes.coordinate_helpers.CoordinateHelper.set_ticks` method. There\nare different options that can be used:\n\n* Set the tick positions manually as an Astropy :class:`~astropy.units.quantity.Quantity`::\n\n      from astropy import units as u\n      lon.set_ticks([242.2, 242.3, 242.4] * u.degree)\n\n* Set the spacing between ticks also as an Astropy :class:`~astropy.units.quantity.Quantity`::\n\n      lon.set_ticks(spacing=5. * u.arcmin)\n\n* Set the approximate number of ticks::\n\n      lon.set_ticks(number=4)\n\nIn the case of angular axes, specifying the spacing as an Astropy\n:class:`~astropy.units.quantity.Quantity` avoids roundoff errors. The\n:meth:`~astropy.visualization.wcsaxes.coordinate_helpers.CoordinateHelper.set_ticks` method can also\nbe used to set the appearance (color and size) of the ticks, using the\n``color=`` and ``size=`` options.\n\nThe :meth:`~astropy.visualization.wcsaxes.coordinate_helpers.CoordinateHelper.set_ticklabel` method can be used\nto change settings for the tick labels, such as color, font, size, and so on::\n\n    lon.set_ticklabel(color='red', size=12)\n\nIn addition, this method has an option ``exclude_overlapping=True`` to prevent\noverlapping tick labels from being displayed.\n\nWe can apply this to the previous example:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    from astropy import units as u\n    lon.set_ticks(spacing=10 * u.arcmin, color='white')\n    lat.set_ticks(spacing=10 * u.arcmin, color='white')\n    lon.set_ticklabel(exclude_overlapping=True)\n    lat.set_ticklabel(exclude_overlapping=True)\n\nMinor ticks\n***********\n\nWCSAxes does not display minor ticks by default but these can be shown by\nusing the\n:meth:`~astropy.visualization.wcsaxes.coordinate_helpers.CoordinateHelper.display_minor_ticks`\nmethod. The default frequency of minor ticks is 5 but this can also be\nspecified.\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    lon.display_minor_ticks(True)\n    lat.display_minor_ticks(True)\n    lat.set_minor_frequency(10)\n\nTick, tick label, and axis label position\n*****************************************\n\nBy default, the tick and axis labels for the first coordinate are shown on the\nx-axis, and the tick and axis labels for the second coordinate are shown on\nthe y-axis. In addition, the ticks for both coordinates are shown on all axes.\nThis can be customized using the\n:meth:`~astropy.visualization.wcsaxes.coordinate_helpers.CoordinateHelper.set_ticks_position` and\n:meth:`~astropy.visualization.wcsaxes.coordinate_helpers.CoordinateHelper.set_ticklabel_position` methods, which each\ntake a string that can contain any or several of ``l``, ``b``, ``r``, or ``t``\n(indicating the ticks or tick labels should be shown on the left, bottom,\nright, or top axes respectively):\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    lon.set_ticks_position('bt')\n    lon.set_ticklabel_position('bt')\n    lon.set_axislabel_position('bt')\n    lat.set_ticks_position('lr')\n    lat.set_ticklabel_position('lr')\n    lat.set_axislabel_position('lr')\n\nWe can set the defaults back using:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    lon.set_ticks_position('all')\n    lon.set_ticklabel_position('b')\n    lon.set_axislabel_position('b')\n    lat.set_ticks_position('all')\n    lat.set_ticklabel_position('l')\n    lat.set_axislabel_position('l')\n\nOn plots with elliptical frames, three alternate tick positions are supported:\n``c`` for the outer circular or elliptical border, ``h`` for the horizontal\naxis (which is usually the major axis of the ellipse), and ``v`` for the\nvertical axis (which is usually the minor axis of the ellipse).\n\n\nHiding ticks and tick labels\n****************************\n\nSometimes it's desirable to hide ticks and tick labels. A common scenario\nis where WCSAxes is being used in a grid of subplots and the tick labels\nare redundant across rows or columns. Tick labels and ticks can be hidden with\nthe :meth:`~astropy.visualization.wcsaxes.coordinate_helpers.CoordinateHelper.set_ticklabel_visible`\nand :meth:`~astropy.visualization.wcsaxes.coordinate_helpers.CoordinateHelper.set_ticks_visible`\nmethods, respectively:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    lon.set_ticks_visible(False)\n    lon.set_ticklabel_visible(False)\n    lat.set_ticks_visible(False)\n    lat.set_ticklabel_visible(False)\n    lon.set_axislabel('')\n    lat.set_axislabel('')\n\nAnd we can restore the ticks and tick labels again using:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    lon.set_ticks_visible(True)\n    lon.set_ticklabel_visible(True)\n    lat.set_ticks_visible(True)\n    lat.set_ticklabel_visible(True)\n    lon.set_axislabel('Galactic Longitude')\n    lat.set_axislabel('Galactic Latitude')\n\n\nCoordinate grid\n***************\n\nSince the properties of a coordinate grid are linked to the properties of the\nticks and labels, grid lines 'belong' to the coordinate objects described\nabove. For example, you can show a grid with yellow lines for RA and orange lines\nfor declination with:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    lon.grid(color='yellow', alpha=0.5, linestyle='solid')\n    lat.grid(color='orange', alpha=0.5, linestyle='solid')\n\nFor convenience, you can also simply draw a grid for all the coordinates in\none command:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    ax.coords.grid(color='white', alpha=0.5, linestyle='solid')\n\n.. note:: If you use the pyplot interface, you can also plot the grid using\n          ``plt.grid()``.\n"},{"id":562,"name":"generic_transforms.rst","nodeType":"TextFile","path":"docs/visualization/wcsaxes","text":"*******************************************\nInitializing WCSAxes with custom transforms\n*******************************************\n\nIn :ref:`initialization`, we saw how to make plots using\n:class:`~astropy.wcs.WCS` objects. However, the\n:class:`~astropy.visualization.wcsaxes.WCSAxes` class can also be initialized\nwith more general transformations that don't have to be represented by the\n:class:`~astropy.wcs.WCS` class. Instead, you can initialize\n:class:`~astropy.visualization.wcsaxes.WCSAxes` using a Matplotlib\n:class:`~matplotlib.transforms.Transform` object and a dictionary\n(``coord_meta``) that provides metadata on how to interpret the transformation.\n\nThe :class:`~matplotlib.transforms.Transform` should represent the conversion\nfrom pixel to world coordinates, and should have ``input_dims=2`` and can have\n``output_dims`` set to any positive integer. In addition, ``has_inverse`` should\nbe set to `True` and the ``inverted`` method should be implemented.\n\nThe ``coord_meta`` dictionary should include the following keys:\n\n* ``name``: an iterable of strings giving the names for each dimension\n* ``type``: an iterable of strings that should be either ``'longitude'``,\n  ``'latitude'``, or ``'scalar'`` (for anything that isn't a longitude or latitude).\n* ``wrap``: an iterable of values which indicate for longitudes at which\n  angle (in degrees) to wrap the coordinates. This should be `None` unless\n  ``type`` is ``'longitude'``.\n* ``unit``: an iterable of :class:`~astropy.units.Unit` objects giving the\n  units of the world coordinates returned by the\n  :class:`~matplotlib.transforms.Transform`.\n* ``format_unit``: an iterable of :class:`~astropy.units.Unit` objects\n  giving the units to use for the formatting of the labels. These can be set to\n  `None` to default to the units given in ``unit``, but can be set for example\n  if the :class:`~matplotlib.transforms.Transform` returns values in degrees\n  and you want the labels to be formatted in hours.\n\nIn addition the ``coord_meta`` can optionally include the following keys:\n\n* ``default_axislabel_position``: an iterable of strings giving for each world\n  coordinates the spine of the frame on which to show the axis label for the\n  coordinate. Each string should be such that it could be used as input to\n  :meth:`~astropy.visualization.wcsaxes.coordinate_helpers.CoordinateHelper.set_axislabel_position`.\n\n* ``default_ticklabel_position``: an iterable of strings giving for each world\n  coordinates the spine of the frame on which to show the tick labels for the\n  coordinate. Each string should be such that it could be used as input to\n  :meth:`~astropy.visualization.wcsaxes.coordinate_helpers.CoordinateHelper.set_ticklabel_position`.\n\n* ``default_ticks_position``: an iterable of strings giving for each world\n  coordinates the spine of the frame on which to show the ticks for the\n  coordinate. Each string should be such that it could be used as input to\n  :meth:`~astropy.visualization.wcsaxes.coordinate_helpers.CoordinateHelper.set_ticks_position`.\n\nThe following example illustrates a custom projection using a transform and\n``coord_meta``:\n\n.. plot::\n   :context: reset\n   :include-source:\n   :align: center\n\n    from astropy import units as u\n    import matplotlib.pyplot as plt\n    from matplotlib.transforms import Affine2D\n    from astropy.visualization.wcsaxes import WCSAxes\n\n    # Set up an affine transformation\n    transform = Affine2D()\n    transform.scale(0.01)\n    transform.translate(40, -30)\n    transform.rotate(0.3)  # radians\n\n    # Set up metadata dictionary\n    coord_meta = {}\n    coord_meta['name'] = 'lon', 'lat'\n    coord_meta['type'] = 'longitude', 'latitude'\n    coord_meta['wrap'] = 180, None\n    coord_meta['unit'] = u.deg, u.deg\n    coord_meta['format_unit'] = None, None\n\n    fig = plt.figure()\n    ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8], aspect='equal',\n                 transform=transform, coord_meta=coord_meta)\n    fig.add_axes(ax)\n    ax.set_xlim(-0.5, 499.5)\n    ax.set_ylim(-0.5, 399.5)\n    ax.grid()\n    ax.coords['lon'].set_axislabel('Longitude')\n    ax.coords['lat'].set_axislabel('Latitude')\n"},{"id":563,"name":"custom_frames.rst","nodeType":"TextFile","path":"docs/visualization/wcsaxes","text":"********************\nUsing a custom frame\n********************\n\nBy default, `~astropy.visualization.wcsaxes.WCSAxes` will make use of a rectangular\nframe for a plot, but this can be changed to provide any custom frame. The\nfollowing example shows how to use the built-in\n:class:`~astropy.visualization.wcsaxes.frame.EllipticalFrame` class, which is an ellipse which extends to the same limits as the built-in rectangular frame:\n\n.. plot::\n   :context: reset\n   :include-source:\n   :align: center\n\n    from astropy.wcs import WCS\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n    from astropy.visualization.wcsaxes.frame import EllipticalFrame\n    import matplotlib.pyplot as plt\n\n    filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n\n    ax = plt.subplot(projection=wcs, frame_class=EllipticalFrame)\n\n    ax.coords.grid(color='white')\n\n    im = ax.imshow(hdu.data, vmin=-2.e-5, vmax=2.e-4, origin='lower')\n\n    # Clip the image to the frame\n    im.set_clip_path(ax.coords.frame.patch)\n\nThe :class:`~astropy.visualization.wcsaxes.frame.EllipticalFrame` class is especially useful for\nall-sky plots such as Aitoff projections:\n\n.. plot::\n   :context: reset\n   :include-source:\n   :align: center\n\n    from astropy.wcs import WCS\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n    from astropy.visualization.wcsaxes.frame import EllipticalFrame\n    from matplotlib import patheffects\n    import matplotlib.pyplot as plt\n\n    filename = get_pkg_data_filename('allsky/allsky_rosat.fits')\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n\n    ax = plt.subplot(projection=wcs, frame_class=EllipticalFrame)\n\n    path_effects=[patheffects.withStroke(linewidth=3, foreground='black')]\n    ax.coords.grid(color='white')\n    ax.coords['glon'].set_ticklabel(color='white', path_effects=path_effects)\n\n    im = ax.imshow(hdu.data, vmin=0., vmax=300., origin='lower')\n\n    # Clip the image to the frame\n    im.set_clip_path(ax.coords.frame.patch)\n\nHowever, you can also write your own frame class. The idea is to set up any\nnumber of connecting spines that define the frame. You can define a frame as a\nspine, but if you define it as multiple spines you will be able to control on\nwhich spine the tick labels and ticks should appear.\n\nThe following example shows how you could for example define a hexagonal frame:\n\n.. plot::\n   :context: reset\n   :include-source:\n   :nofigs:\n\n    import numpy as np\n    from astropy.visualization.wcsaxes.frame import BaseFrame\n\n    class HexagonalFrame(BaseFrame):\n\n        spine_names = 'abcdef'\n\n        def update_spines(self):\n\n            xmin, xmax = self.parent_axes.get_xlim()\n            ymin, ymax = self.parent_axes.get_ylim()\n\n            ymid = 0.5 * (ymin + ymax)\n            xmid1 = (xmin + xmax) / 4.\n            xmid2 = (xmin + xmax) * 3. / 4.\n\n            self['a'].data = np.array(([xmid1, ymin], [xmid2, ymin]))\n            self['b'].data = np.array(([xmid2, ymin], [xmax, ymid]))\n            self['c'].data = np.array(([xmax, ymid], [xmid2, ymax]))\n            self['d'].data = np.array(([xmid2, ymax], [xmid1, ymax]))\n            self['e'].data = np.array(([xmid1, ymax], [xmin, ymid]))\n            self['f'].data = np.array(([xmin, ymid], [xmid1, ymin]))\n\nwhich we can then use:\n\n.. plot::\n    :context:\n    :include-source:\n    :align: center\n\n     from astropy.wcs import WCS\n     from astropy.io import fits\n     from astropy.utils.data import get_pkg_data_filename\n     import matplotlib.pyplot as plt\n\n     filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')\n     hdu = fits.open(filename)[0]\n     wcs = WCS(hdu.header)\n\n     ax = plt.subplot(projection=wcs, frame_class=HexagonalFrame)\n\n     ax.coords.grid(color='white')\n\n     im = ax.imshow(hdu.data, vmin=-2.e-5, vmax=2.e-4, origin='lower')\n\n     # Clip the image to the frame\n     im.set_clip_path(ax.coords.frame.patch)\n\n\nFrame properties\n****************\n\nThe color and linewidth of the frame can also be set by\n\n.. plot::\n    :context:\n    :include-source:\n    :align: center\n\n    ax.coords.frame.set_color('red')\n    ax.coords.frame.set_linewidth(2)\n"},{"id":564,"name":"initializing_axes.rst","nodeType":"TextFile","path":"docs/visualization/wcsaxes","text":".. _initialization:\n\n****************************************\nInitializing axes with world coordinates\n****************************************\n\nBasic initialization\n********************\n\nTo make a plot using `~astropy.visualization.wcsaxes.WCSAxes`, we first read in\nthe data using `astropy.io.fits\n<https://docs.astropy.org/en/stable/io/fits/index.html>`_ and parse the WCS\ninformation. In this example, we will use an example FITS file from the\nhttp://data.astropy.org server (the\n:func:`~astropy.utils.data.get_pkg_data_filename` function downloads the file\nand returns a filename):\n\n.. plot::\n   :context: reset\n   :nofigs:\n   :include-source:\n   :align: center\n\n    from astropy.wcs import WCS\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n\n    filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')\n\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n\nWe then create a figure using Matplotlib and create the axes using the\n:class:`~astropy.wcs.WCS` object created above. The following example shows how\nto do this with the Matplotlib 'pyplot' interface, keeping a reference to the\naxes object:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    import matplotlib.pyplot as plt\n    ax = plt.subplot(projection=wcs)\n\nThe ``ax`` object created is an instance of the\n:class:`~astropy.visualization.wcsaxes.WCSAxes` class. Note that if no WCS\ntransformation is specified, the transformation will default to identity,\nmeaning that the world coordinates will match the pixel coordinates.\n\nThe field of view shown is, as for standard matplotlib axes, 0 to 1 in both\ndirections, in pixel coordinates. As soon as you show an image (see\n:doc:`images_contours`), the limits will be adjusted, but if you want you can\nalso adjust the limits manually. Adjusting the limits is done using the\nsame functions/methods as for a normal Matplotlib plot:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    ax.set_xlim(-0.5, hdu.data.shape[1] - 0.5)\n    ax.set_ylim(-0.5, hdu.data.shape[0] - 0.5)\n\n.. note:: If you use the pyplot interface, you can also replace ``ax.set_xlim`` and\n          ``ax.set_ylim`` by ``plt.xlim`` and ``plt.ylim``.\n\nAlternative methods\n*******************\n\nAs in Matplotlib, there are in fact several ways you can initialize the\n:class:`~astropy.visualization.wcsaxes.WCSAxes`.\n\nAs shown above, the simplest way is to make use of the :class:`~astropy.wcs.WCS`\nclass and pass this to ``plt.subplot``. If you normally use the (partially)\nobject-oriented interface of Matplotlib, you can also do::\n\n    fig = plt.figure()\n    ax = fig.add_subplot(1, 1, 1, projection=wcs)\n\nNote that this also works with :meth:`~matplotlib.figure.Figure.add_axes` and\n:func:`~matplotlib.pyplot.axes`, e.g.::\n\n    ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], projection=wcs)\n\nor::\n\n    plt.axes([0.1, 0.1, 0.8, 0.8], projection=wcs)\n\nAny additional arguments passed to\n:meth:`~matplotlib.figure.Figure.add_subplot`,\n:meth:`~matplotlib.figure.Figure.add_axes`,\n:func:`~matplotlib.pyplot.subplot`, or :func:`~matplotlib.pyplot.axes`, such\nas ``slices`` or ``frame_class``, will be passed on to the\n:class:`~astropy.visualization.wcsaxes.WCSAxes` class.\n\n.. _initialize_alternative:\n\nDirectly initializing WCSAxes\n*****************************\n\nAs an alternative to the above methods of initializing\n:class:`~astropy.visualization.wcsaxes.WCSAxes`, you can also instantiate\n:class:`~astropy.visualization.wcsaxes.WCSAxes` directly and add it to the\nfigure::\n\n    from astropy.wcs import WCS\n    from astropy.visualization.wcsaxes import WCSAxes\n    import matplotlib.pyplot as plt\n\n    wcs = WCS(...)\n\n    fig = plt.figure()\n    ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8], wcs=wcs)\n    fig.add_axes(ax)  # note that the axes have to be explicitly added to the figure\n"},{"id":565,"name":"controlling_axes.rst","nodeType":"TextFile","path":"docs/visualization/wcsaxes","text":"******************\nControlling Axes\n******************\n\nChanging Axis Units\n*******************\n\nWCSAxes also allows users to change the units of the axes of an image. In the\nexample in :doc:`slicing_datacubes`, the x axis represents velocity in m/s. We\ncan change the unit to an equivalent one by:\n\n\n.. plot::\n   :context: reset\n   :nofigs:\n\n    from astropy.wcs import WCS\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n\n    filename = get_pkg_data_filename('l1448/l1448_13co.fits')\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n\n    import matplotlib.pyplot as plt\n\n    ax = plt.subplot(projection=wcs, slices=(50, 'y', 'x'))\n    ax.imshow(hdu.data[:, :, 50].transpose())\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    import astropy.units as u\n    ax.coords[2].set_major_formatter('x.x') # Otherwise values round to the nearest whole number\n    ax.coords[2].set_format_unit(u.km / u.s)\n\n\nDisabling Automatic Labelling\n*****************************\n\nBy default WCSAxes adds labels to the axes to indicate what world coordinate is\nbeing represented on that axis, and what unit is being used to display it. If\nyou want to disable this behavior you can either set an explicit label for that\naxis with `~astropy.visualization.wcsaxes.CoordinateHelper.set_axislabel` or you\ncan disable the feature per coordinate with::\n\n  ax = plt.subplot(projection=wcs)  # doctest: +SKIP\n  ax.coords[0].set_auto_axislabel(False)  # doctest: +SKIP\n\n\nChanging Axis Directions\n************************\n\nSometimes astronomy FITS files don't follow the convention of having the longitude increase to the left,\nso we want to flip an axis so that it goes in the opposite direction. To do this on our example image:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    ax.invert_xaxis()\n"},{"id":566,"name":"slicing_datacubes.rst","nodeType":"TextFile","path":"docs/visualization/wcsaxes","text":"*****************************\nSlicing Multidimensional Data\n*****************************\n\nWCSAxes can either plot one or two dimensional data. If we have a dataset with\nhigher dimensionality than the plot we want to make, we have to select which\ndimensions to use for the x or x and y axes of the plot. This example will show\nhow to slice a FITS data cube and plot an image from it.\n\nSlicing the WCS object\n**********************\n\nLike the example introduced in :ref:`initialization`, we will read in the\ndata using `astropy.io.fits\n<https://docs.astropy.org/en/stable/io/fits/index.html>`_ and parse the WCS\ninformation. The original FITS file can be downloaded from `here\n<http://www.astropy.org/astropy-data/l1448/l1448_13co.fits>`_.\n\n.. plot::\n   :context: reset\n   :include-source:\n   :align: center\n   :nofigs:\n\n    import matplotlib.pyplot as plt\n    from astropy.wcs import WCS\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n    filename = get_pkg_data_filename('l1448/l1448_13co.fits')\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n    image_data = hdu.data\n\nThis is a three-dimensional dataset which you can check by looking at the\nheader information by::\n\n    >>> hdu.header  # doctest: +SKIP\n    ...\n    NAXIS = 3 /number of axes\n    CTYPE1  = 'RA---SFL'           /\n    CTYPE2  = 'DEC--SFL'           /\n    CTYPE3  = 'VELO-LSR'           /\n    ...\n\nThe header keyword 'NAXIS' gives the number of dimensions of the dataset. The keywords 'CTYPE1', 'CTYPE2' and 'CTYPE3' give the data type of these dimensions to be right ascension, declination and velocity respectively.\n\nWe then instantiate the `~astropy.visualization.wcsaxes.WCSAxes` using the\n:class:`~astropy.wcs.WCS` object and select the slices we want to plot:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n   :nofigs:\n\n    import matplotlib.pyplot as plt\n    ax = plt.subplot(projection=wcs, slices=(50, 'y', 'x'))\n\nBy setting ``slices=(50, 'y', 'x')``, we have chosen to plot the second\ndimension on the y-axis and the third dimension on the x-axis. Even though we\nare not plotting the all the dimensions, we have to specify which slices to\nselect for the dimensions that are not shown. In this example, we are not\nplotting the first dimension so we have selected the slice 50 to display. You\ncan experiment with this by changing the selected slice and looking at how the\nplotted image changes.\n\nPlotting the image\n******************\n\nWe then add the axes to the image and plot it using the method\n:meth:`~matplotlib.axes.Axes.imshow`.\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    ax.coords[2].set_ticklabel(exclude_overlapping=True)\n    ax.imshow(image_data[:, :, 50].transpose())\n\nHere, ``image_data`` is an :class:`~numpy.ndarray` object. In Numpy, the order\nof the axes is reversed so the first dimension in the FITS file appears last,\nthe last dimension appears first and so on. Therefore the index passed to\n:meth:`~matplotlib.axes.Axes.imshow` should be the same as passed to\n``slices`` but in reversed order. We also need to\n:meth:`~numpy.ndarray.transpose` ``image_data`` as we have reversed the\ndimensions plotted on the x and y axes in the slice.\n\nIf we don't want to reverse the dimensions plotted, we can simply do:\n\n.. plot::\n   :context: reset\n   :align: center\n   :nofigs:\n\n    import astropy.units as u\n    from astropy.wcs import WCS\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n    filename = get_pkg_data_filename('l1448/l1448_13co.fits')\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n    image_data = hdu.data\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    import matplotlib.pyplot as plt\n    ax = plt.subplot(projection=wcs, slices=(50, 'x', 'y'))\n    ax.imshow(image_data[:, :, 50])\n\n\nPlotting one dimensional data\n*****************************\n\nIf we wanted to plot the spectral axes for one pixel we can do this by slicing\ndown to one dimension.\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n   :nofigs:\n\n    import matplotlib.pyplot as plt\n    ax = plt.subplot(projection=wcs, slices=(50, 50, 'x'))\n\n\nHere we have selected the 50 pixel in the first and second dimensions and will\nuse the third dimension as our x axis.\n\nWe can now plot the spectral axis for this pixel. Note that we are plotting\nagainst pixel coordinates in the call to ``ax.plot``, ``WCSAxes`` will display\nthe world coordinates for us.\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n   :nofigs:\n\n   ax.plot(image_data[:, 50, 50])\n\nAs this is still a ``WCSAxes`` plot, we can set the display units for the x-axis\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n   ra, dec, vel = ax.coords\n   vel.set_format_unit(u.km/u.s)\n\n\nIf we wanted to plot a one dimensional plot along a spatial dimension, i.e.\nintensity along a row in the image, ``WCSAxes`` defaults to displaying both the\nworld coordinates for this plot. We can customise the colors and add grid lines\nfor each of the spatial axes.\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n   :nofigs:\n\n    import matplotlib.pyplot as plt\n    ax = plt.subplot(projection=wcs, slices=(50, 'x', 0))\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n   ax.plot(image_data[0, :, 50])\n\n   ra, dec, wave = ax.coords\n   ra.set_ticks(color=\"red\")\n   ra.set_ticklabel(color=\"red\")\n   ra.grid(color=\"red\")\n\n   dec.set_ticks(color=\"blue\")\n   dec.set_ticklabel(color=\"blue\")\n   dec.grid(color=\"blue\")\n"},{"id":567,"name":"index.rst","nodeType":"TextFile","path":"docs/visualization/wcsaxes","text":".. _wcsaxes:\n\n*********************************************\nMaking plots with world coordinates (WCSAxes)\n*********************************************\n\nWCSAxes is a framework for making plots of Astronomical data in `Matplotlib`_.\nIt was previously distributed as a standalone package (``wcsaxes``), but is now included in\n:ref:`astropy.visualization <astropy-visualization>`.\n\n.. _wcsaxes-getting-started:\n\nGetting started\n===============\n\nThe following is a very simple example of plotting an image with the WCSAxes\npackage:\n\n.. plot::\n   :context: reset\n   :include-source:\n   :align: center\n\n    import matplotlib.pyplot as plt\n\n    from astropy.wcs import WCS\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n\n    filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')\n\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n\n    plt.subplot(projection=wcs)\n    plt.imshow(hdu.data, vmin=-2.e-5, vmax=2.e-4, origin='lower')\n    plt.grid(color='white', ls='solid')\n    plt.xlabel('Galactic Longitude')\n    plt.ylabel('Galactic Latitude')\n\nThis example uses the :mod:`matplotlib.pyplot` interface to Matplotlib, but WCSAxes\ncan be used with any of the other ways of using Matplotlib (some examples of which\nare given in :ref:`initialization`). For example, using the partially object-oriented\ninterface, you can do::\n\n    ax = plt.subplot(projection=wcs)\n    ax.imshow(hdu.data, vmin=-2.e-5, vmax=2.e-4, origin='lower')\n    ax.grid(color='white', ls='solid')\n    ax.set_xlabel('Galactic Longitude')\n    ax.set_ylabel('Galactic Latitude')\n\nHowever, the axes object is needed to access some of the more advanced functionality\nof WCSAxes.  An example of this usage is:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    ax = plt.subplot(projection=wcs, label='overlays')\n\n    ax.imshow(hdu.data, vmin=-2.e-5, vmax=2.e-4, origin='lower')\n\n    ax.coords.grid(True, color='white', ls='solid')\n    ax.coords[0].set_axislabel('Galactic Longitude')\n    ax.coords[1].set_axislabel('Galactic Latitude')\n\n    overlay = ax.get_coords_overlay('fk5')\n    overlay.grid(color='white', ls='dotted')\n    overlay[0].set_axislabel('Right Ascension (J2000)')\n    overlay[1].set_axislabel('Declination (J2000)')\n\nIn the rest of this documentation we will assume that you have kept a reference\nto the axes object, which we will refer to as ``ax``. However, we also note\nwhen something can be done directly with the pyplot interface.\n\nWCSAxes supports a number of advanced plotting options, including the ability to\ncontrol which axes to show labels on for which coordinates, overlaying contours\nfrom data with different coordinate systems, overlaying grids for different\ncoordinate systems, dealing with plotting slices from data with more dimensions\nthan the plot, and defining custom (non-rectangular) frames.\n\nUsing WCSAxes\n=============\n\n.. toctree::\n   :maxdepth: 1\n\n   initializing_axes\n   images_contours\n   ticks_labels_grid\n   overlays\n   overlaying_coordinate_systems\n   slicing_datacubes\n   controlling_axes\n   generic_transforms\n   custom_frames\n\nReference/API\n=============\n\n.. automodapi:: astropy.visualization.wcsaxes\n   :no-inheritance-diagram:\n\n.. automodapi:: astropy.visualization.wcsaxes.frame\n   :no-inheritance-diagram:\n"},{"id":568,"name":"overlays.rst","nodeType":"TextFile","path":"docs/visualization/wcsaxes","text":"********************************\nOverplotting markers and artists\n********************************\n\nFor the example in the following page we start from the example introduced in\n:ref:`initialization`.\n\n.. plot::\n   :context: reset\n   :nofigs:\n\n    from astropy.wcs import WCS\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n    import matplotlib.pyplot as plt\n\n    filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')\n\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n\n    ax = plt.subplot(projection=wcs)\n    ax.imshow(hdu.data, vmin=-2.e-5, vmax=2.e-4, origin='lower')\n\n\nPixel coordinates\n*****************\n\nApart from the handling of the ticks, tick labels, and grid lines, the\n`~astropy.visualization.wcsaxes.WCSAxes` class behaves like a normal Matplotlib\n``Axes`` instance, and methods such as\n:meth:`~matplotlib.axes.Axes.imshow`,\n:meth:`~matplotlib.axes.Axes.contour`,\n:meth:`~matplotlib.axes.Axes.plot`,\n:meth:`~matplotlib.axes.Axes.scatter`, and so on will work and plot the\ndata in **pixel coordinates** by default.\n\nIn the following example, the scatter markers and the rectangle will be plotted\nin pixel coordinates:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    # The following line makes it so that the zoom level no longer changes,\n    # otherwise Matplotlib has a tendency to zoom out when adding overlays.\n    ax.set_autoscale_on(False)\n\n    # Add a rectangle with bottom left corner at pixel position (30, 50) with a\n    # width and height of 60 and 50 pixels respectively.\n    from matplotlib.patches import Rectangle\n    r = Rectangle((30., 50.), 60., 50., edgecolor='yellow', facecolor='none')\n    ax.add_patch(r)\n\n    # Add three markers at (40, 30), (100, 130), and (130, 60). The facecolor is\n    # a transparent white (0.5 is the alpha value).\n    ax.scatter([40, 100, 130], [30, 130, 60], s=100, edgecolor='white', facecolor=(1, 1, 1, 0.5))\n\nWorld coordinates\n*****************\n\nAll such Matplotlib commands allow a ``transform=`` argument to be passed,\nwhich will transform the input from world to pixel coordinates before it is\npassed to Matplotlib and plotted. For instance::\n\n    ax.scatter(..., transform=...)\n\nwill take the values passed to :meth:`~matplotlib.axes.Axes.scatter` and will\ntransform them using the transformation passed to ``transform=``, in order to\nend up with the final pixel coordinates.\n\nThe `~astropy.visualization.wcsaxes.WCSAxes` class includes a :meth:`~astropy.visualization.wcsaxes.WCSAxes.get_transform`\nmethod that can be used to get the appropriate transformation object to convert\nfrom various world coordinate systems to the final pixel coordinate system\nrequired by Matplotlib. The :meth:`~astropy.visualization.wcsaxes.WCSAxes.get_transform` method can\ntake a number of different inputs, which are described in this and subsequent\nsections. The two simplest inputs to this method are ``'world'`` and\n``'pixel'``.\n\nFor example, if your WCS defines an image where the coordinate system consists of an angle in degrees and a wavelength in nanometers, you can do::\n\n    ax.scatter([34], [3.2], transform=ax.get_transform('world'))\n\nto plot a marker at (34deg, 3.2nm).\n\nUsing ``ax.get_transform('pixel')`` is equivalent to not using any\ntransformation at all (and things then behave as described in the `Pixel\ncoordinates`_ section).\n\nCelestial coordinates\n*********************\n\nFor the special case where the WCS represents celestial coordinates, a number\nof other inputs can be passed to :meth:`~astropy.visualization.wcsaxes.WCSAxes.get_transform`. These\nare:\n\n* ``'fk4'``: B1950 FK4 equatorial coordinates\n* ``'fk5'``: J2000 FK5 equatorial coordinates\n* ``'icrs'``: ICRS equatorial coordinates\n* ``'galactic'``: Galactic coordinates\n\nIn addition, any valid `astropy.coordinates` coordinate frame can be passed.\n\nFor example, you can add markers with positions defined in the FK5 system using:\n\n.. plot::\n   :context: reset\n   :nofigs:\n\n    from astropy.wcs import WCS\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n    import matplotlib.pyplot as plt\n\n    filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')\n\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n\n    ax = plt.subplot(projection=wcs)\n    ax.imshow(hdu.data, vmin=-2.e-5, vmax=2.e-4, origin='lower')\n\n    ax.set_autoscale_on(False)\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    ax.scatter(266.78238, -28.769255, transform=ax.get_transform('fk5'), s=300,\n               edgecolor='white', facecolor='none')\n\nIn the case of :meth:`~matplotlib.axes.Axes.scatter` and :meth:`~matplotlib.axes.Axes.plot`, the positions of the center of the markers is transformed, but the markers themselves are drawn in the frame of reference of the image, which means that they will not look distorted.\n\nPatches/shapes/lines\n********************\n\nTransformations can also be passed to Astropy or Matplotlib patches. For example, we can\nuse the :meth:`~astropy.visualization.wcsaxes.WCSAxes.get_transform` method above to plot a quadrangle\nin FK5 equatorial coordinates:\n\n.. plot::\n   :context: reset\n   :nofigs:\n\n    from astropy.wcs import WCS\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n    import matplotlib.pyplot as plt\n\n    filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n\n    ax = plt.subplot(projection=wcs)\n    ax.imshow(hdu.data, vmin=-2.e-5, vmax=2.e-4, origin='lower')\n\n    ax.set_autoscale_on(False)\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    from astropy import units as u\n    from astropy.visualization.wcsaxes import Quadrangle\n\n    r = Quadrangle((266.0, -28.9)*u.deg, 0.3*u.deg, 0.15*u.deg,\n                   edgecolor='green', facecolor='none',\n                   transform=ax.get_transform('fk5'))\n    ax.add_patch(r)\n\nIn this case, the quadrangle will be plotted at FK5 J2000 coordinates (266deg, -28.9deg).\nSee the `Quadrangles`_ section for more information on `~astropy.visualization.wcsaxes.Quadrangle`.\n\nHowever, it is **very important** to note that while the height will indeed be 0.15 degrees, the width will not strictly represent 0.3 degrees on the sky, but an interval of 0.3 degrees in longitude (which, depending on the latitude, will represent a different angle on the sky).\nIn other words, if the width and height are set to the same value, the resulting polygon will not be a square.\nThe same applies to the `~matplotlib.patches.Circle` patch, which will not actually produce a circle:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    from matplotlib.patches import Circle\n\n    r = Quadrangle((266.4, -28.9)*u.deg, 0.3*u.deg, 0.3*u.deg,\n                   edgecolor='cyan', facecolor='none',\n                   transform=ax.get_transform('fk5'))\n    ax.add_patch(r)\n\n    c = Circle((266.4, -29.1), 0.15, edgecolor='yellow', facecolor='none',\n               transform=ax.get_transform('fk5'))\n    ax.add_patch(c)\n\n\n\n.. important:: If what you are interested is simply plotting circles around\n               sources to highlight them, then we recommend using\n               :meth:`~matplotlib.axes.Axes.scatter`, since for the circular\n               marker (the default), the circles will be guaranteed to be\n               circles in the plot, and only the position of the center is\n               transformed.\n\n               To plot 'true' spherical circles, see the `Spherical patches`_\n               section.\n\nQuadrangles\n***********\n\n`~astropy.visualization.wcsaxes.Quadrangle` is the recommended patch for plotting a quadrangle, as opposed to Matplotlib's `~matplotlib.patches.Rectangle`.\nThe edges of a quadrangle lie on two lines of constant longitude and two lines of constant latitude (or the equivalent component names in the coordinate frame of interest, such as right ascension and declination).\nThe edges of `~astropy.visualization.wcsaxes.Quadrangle` will render as curved lines if appropriate for the WCS transformation.\nIn contrast, `~matplotlib.patches.Rectangle` will always have straight edges.\nHere's a comparison of the two types of patches for plotting a quadrangle in `~astropy.coordinates.ICRS` coordinates on `~astropy.coordinates.Galactic` axes:\n\n.. plot::\n   :context: reset\n   :nofigs:\n\n    from astropy import units as u\n    from astropy.wcs import WCS\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n    from astropy.visualization.wcsaxes import Quadrangle\n    import matplotlib.pyplot as plt\n\n    filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    from matplotlib.patches import Rectangle\n\n    # Set the Galactic axes such that the plot includes the ICRS south pole\n    ax = plt.subplot(projection=wcs)\n    ax.set_xlim(0, 10000)\n    ax.set_ylim(-10000, 0)\n\n    # Overlay the ICRS coordinate grid\n    overlay = ax.get_coords_overlay('icrs')\n    overlay.grid(color='black', ls='dotted')\n\n    # Add a quadrangle patch (100 degrees by 20 degrees)\n    q = Quadrangle((255, -70)*u.deg, 100*u.deg, 20*u.deg,\n                   label='Quadrangle', edgecolor='blue', facecolor='none',\n                   transform=ax.get_transform('icrs'))\n    ax.add_patch(q)\n\n    # Add a rectangle patch (100 degrees by 20 degrees)\n    r = Rectangle((255, -70), 100, 20,\n                  label='Rectangle', edgecolor='red', facecolor='none', linestyle='--',\n                  transform=ax.get_transform('icrs'))\n    ax.add_patch(r)\n\n    plt.legend(loc='upper right')\n\nContours\n********\n\nOverplotting contours is also simple using the\n:meth:`~astropy.visualization.wcsaxes.WCSAxes.get_transform` method. For contours,\n:meth:`~astropy.visualization.wcsaxes.WCSAxes.get_transform` should be given the WCS of the\nimage to plot the contours for:\n\n.. plot::\n   :context: reset\n   :nofigs:\n\n    from astropy.wcs import WCS\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n    from matplotlib.patches import Rectangle\n    import matplotlib.pyplot as plt\n\n    filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n\n    ax = plt.subplot(projection=wcs)\n    ax.imshow(hdu.data, vmin=-2.e-5, vmax=2.e-4, origin='lower')\n\n    ax.set_autoscale_on(False)\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    filename = get_pkg_data_filename('galactic_center/gc_bolocam_gps.fits')\n    hdu = fits.open(filename)[0]\n    ax.contour(hdu.data, transform=ax.get_transform(WCS(hdu.header)),\n               levels=[1,2,3,4,5,6], colors='white')\n\nSpherical patches\n*****************\n\nIn the case where you are making a plot of a celestial image, and want to plot a circle that represents the area within a certain angle of a longitude/latitude,\nthe `~matplotlib.patches.Circle` patch is not appropriate, since it will result in a distorted shape (because longitude is not the same as the angle on the sky).\nFor this use case, you can instead use `~astropy.visualization.wcsaxes.SphericalCircle`, which takes a tuple of |Quantity| or a |SkyCoord| object as the input,\nand a |Quantity| as the radius:\n\n.. plot::\n   :context: reset\n   :nofigs:\n\n    from astropy.wcs import WCS\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n    import matplotlib.pyplot as plt\n\n    filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n\n    ax = plt.subplot(projection=wcs)\n    ax.imshow(hdu.data, vmin=-2.e-5, vmax=2.e-4, origin='lower')\n\n    ax.set_autoscale_on(False)\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    from astropy import units as u\n    from astropy.coordinates import SkyCoord\n    from astropy.visualization.wcsaxes import SphericalCircle\n\n\n    r = SphericalCircle((266.4 * u.deg, -29.1 * u.deg), 0.15 * u.degree,\n                         edgecolor='yellow', facecolor='none',\n                         transform=ax.get_transform('fk5'))\n\n    ax.add_patch(r)\n\n    #The following lines show the usage of a SkyCoord object as the input.\n    skycoord_object = SkyCoord(266.4 * u.deg, -28.7 * u.deg)\n    s = SphericalCircle(skycoord_object, 0.15 * u.degree,\n                        edgecolor='white', facecolor='none',\n                        transform=ax.get_transform('fk5'))\n\n    ax.add_patch(s)\n"},{"id":569,"name":"images_contours.rst","nodeType":"TextFile","path":"docs/visualization/wcsaxes","text":"****************************\nPlotting images and contours\n****************************\n\nFor the example in the following page we start from the example introduced in\n:ref:`initialization`.\n\n.. plot::\n   :context: reset\n   :nofigs:\n\n    from astropy.wcs import WCS\n    from astropy.io import fits\n    from astropy.utils.data import get_pkg_data_filename\n\n    filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')\n\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n\n    import matplotlib.pyplot as plt\n\n    ax = plt.subplot(projection=wcs)\n    ax.imshow(hdu.data, vmin=-2.e-5, vmax=2.e-4, origin='lower')\n\nPlotting images as bitmaps or contours should be done via the usual matplotlib\nmethods such as :meth:`~matplotlib.axes.Axes.imshow` or\n:meth:`~matplotlib.axes.Axes.contour`. For example, continuing from the\nexample in :ref:`initialization`, you can do:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    ax.imshow(hdu.data, vmin=-2.e-5, vmax=2.e-4, origin='lower')\n\nand we can also add contours corresponding to the same image using:\n\n.. plot::\n   :context:\n   :include-source:\n   :align: center\n\n    import numpy as np\n    ax.contour(hdu.data, levels=np.logspace(-4.7, -3., 10), colors='white', alpha=0.5)\n\nTo show contours for an image in a different coordinate system, see\n:doc:`overlays`.\n\n.. note:: If you like using the pyplot interface, you can also call\n          ``plt.imshow`` and ``plt.contour`` instead of ``ax.imshow`` and\n          ``ax.contour``.\n"},{"col":4,"comment":"\n        For all cards with index above idx, increment or decrement its index\n        value in the keyword_indices dict.\n        ","endLoc":1838,"header":"def _updateindices(self, idx, increment=True)","id":570,"name":"_updateindices","nodeType":"Function","startLoc":1823,"text":"def _updateindices(self, idx, increment=True):\n        \"\"\"\n        For all cards with index above idx, increment or decrement its index\n        value in the keyword_indices dict.\n        \"\"\"\n        if idx > len(self._cards):\n            # Save us some effort\n            return\n\n        increment = 1 if increment else -1\n\n        for index_sets in (self._keyword_indices, self._rvkc_indices):\n            for indices in index_sets.values():\n                for jdx, keyword_index in enumerate(indices):\n                    if keyword_index >= idx:\n                        indices[jdx] += increment"},{"id":571,"name":".github","nodeType":"Package"},{"id":572,"name":"PULL_REQUEST_TEMPLATE.md","nodeType":"TextFile","path":".github","text":"<!-- This comments are hidden when you submit the pull request,\nso you do not need to remove them! -->\n\n<!-- Please be sure to check out our contributing guidelines,\nhttps://github.com/astropy/astropy/blob/main/CONTRIBUTING.md .\nPlease be sure to check out our code of conduct,\nhttps://github.com/astropy/astropy/blob/main/CODE_OF_CONDUCT.md . -->\n\n<!-- If you are new or need to be re-acquainted with Astropy\ncontributing workflow, please see\nhttp://docs.astropy.org/en/latest/development/workflow/development_workflow.html .\nThere is even a practical example at\nhttps://docs.astropy.org/en/latest/development/workflow/git_edit_workflow_examples.html#astropy-fix-example . -->\n\n<!-- Astropy coding style guidelines can be found here:\nhttps://docs.astropy.org/en/latest/development/codeguide.html#coding-style-conventions\nOur testing infrastructure enforces to follow a subset of the PEP8 to be\nfollowed. You can check locally whether your changes have followed these by\nrunning the following command:\n\ntox -e codestyle\n\n-->\n\n<!-- Please just have a quick search on GitHub to see if a similar\npull request has already been posted.\nWe have old closed pull requests that might provide useful code or ideas\nthat directly tie in with your pull request. -->\n\n<!-- We have several automatic features that run when a pull request is open.\nThey can appear daunting but do not worry because maintainers will help\nyou navigate them, if necessary. -->\n\n### Description\n<!-- Provide a general description of what your pull request does.\nComplete the following sentence and add relevant details as you see fit. -->\n\n<!-- In addition please ensure that the pull request title is descriptive\nand allows maintainers to infer the applicable subpackage(s). -->\n\n<!-- READ THIS FOR MANUAL BACKPORT FROM A MAINTAINER:\nApply \"skip-basebranch-check\" label **before** you open the PR! -->\n\nThis pull request is to address ...\n\n<!-- If the pull request closes any open issues you can add this.\nIf you replace <Issue Number> with a number, GitHub will automatically link it.\nIf this pull request is unrelated to any issues, please remove\nthe following line. -->\n\nFixes #<Issue Number>\n\n### Checklist for package maintainer(s)\n<!-- This section is to be filled by package maintainer(s) who will\nreview this pull request. -->\n\nThis checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.\n\n- [ ] Do the proposed changes actually accomplish desired goals?\n- [ ] Do the proposed changes follow the [Astropy coding guidelines](https://docs.astropy.org/en/latest/development/codeguide.html)?\n- [ ] Are tests added/updated as required? If so, do they follow the [Astropy testing guidelines](https://docs.astropy.org/en/latest/development/testguide.html)?\n- [ ] Are docs added/updated as required? If so, do they follow the [Astropy documentation guidelines](https://docs.astropy.org/en/latest/development/docguide.html#astropy-documentation-rules-and-guidelines)?\n- [ ] Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see [\"When to rebase and squash commits\"](https://docs.astropy.org/en/latest/development/when_to_rebase.html).\n- [ ] Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the `Extra CI` label.\n- [ ] Is a change log needed? If yes, did the change log check pass? If no, add the `no-changelog-entry-needed` label. If this is a manual backport, use the `skip-changelog-checks` label unless special changelog handling is necessary.\n- [ ] Is this a big PR that makes a \"What's new?\" entry worthwhile and if so, is (1) a \"what's new\" entry included in this PR and (2) the \"whatsnew-needed\" label applied?\n- [ ] Is a milestone set? Milestone must be set but `astropy-bot` check might be missing; do not let the green checkmark fool you.\n- [ ] At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate `backport-X.Y.x` label(s) *before* merge.\n"},{"col":4,"comment":"null","endLoc":1735,"header":"def __init__(self, st, doc=None, format=None, namespace=None)","id":573,"name":"__init__","nodeType":"Function","startLoc":1699,"text":"def __init__(self, st, doc=None, format=None, namespace=None):\n\n        UnitBase.__init__(self)\n\n        if isinstance(st, (bytes, str)):\n            self._names = [st]\n            self._short_names = [st]\n            self._long_names = []\n        elif isinstance(st, tuple):\n            if not len(st) == 2:\n                raise ValueError(\"st must be string, list or 2-tuple\")\n            self._names = st[0] + [n for n in st[1] if n not in st[0]]\n            if not len(self._names):\n                raise ValueError(\"must provide at least one name\")\n            self._short_names = st[0][:]\n            self._long_names = st[1][:]\n        else:\n            if len(st) == 0:\n                raise ValueError(\n                    \"st list must have at least one entry\")\n            self._names = st[:]\n            self._short_names = [st[0]]\n            self._long_names = st[1:]\n\n        if format is None:\n            format = {}\n        self._format = format\n\n        if doc is None:\n            doc = self._generate_doc()\n        else:\n            doc = textwrap.dedent(doc)\n            doc = textwrap.fill(doc)\n\n        self.__doc__ = doc\n\n        self._inject(namespace)"},{"id":574,"name":"labeler.yml","nodeType":"TextFile","path":".github","text":"Docs:\n  - docs/*\n  - docs/_static/*\n  - docs/_templates/*\n  - docs/development/**/*\n  - docs/whatsnew/*\n  - examples/**/*\n  - licenses/*\n  - CITATION\n  - .mailmap\n  - readthedocs.yml\n  - '*.md'\n  - any: ['*.rst', '!CHANGES.rst']\n\ntesting:\n  - astropy/tests/**/*\n  - codecov.yml\n  - conftest.py\n  - '**/conftest.py'\n  - azure-pipelines.yml\n  - tox.ini\n  - .circleci/*\n  - .github/**/*.yml\n  - .pep8speaks.yml\n  - .pyinstaller/**/*\n\nexternal:\n  - astropy/extern/**/*\n  - cextern/**/*\n\ninstallation:\n  - docs/install.rst\n  - MANIFEST.in\n  - pip-requirements\n  - pyproject.toml\n  - setup.*\n\nRelease:\n  - docs/development/releasing.rst\n\nconfig:\n  - '**/config/**/*'\n  - astropy/extern/configobj/**/*\n\nconstants:\n  - '**/constants/**/*'\n\nconvolution:\n  - '**/convolution/**/*'\n\ncoordinates:\n  - '**/coordinates/**/*'\n\ncosmology:\n  - '**/cosmology/**/*'\n\nio.ascii:\n  - '**/io/ascii/**/*'\n\nio.fits:\n  - '**/io/fits/**/*'\n  - cextern/cfitsio/**/*\n\nio.misc:\n  - astropy/io/misc/*\n  - astropy/io/misc/pandas/**/*\n  - astropy/io/misc/tests/**/*\n  - docs/io/misc.rst\n\nio.misc.asdf:\n  - astropy/io/misc/asdf/**/*\n  - docs/io/asdf-schemas.rst\n\nio.registry:\n  - astropy/io/*\n  - astropy/io/tests/*\n  - docs/io/registry.rst\n\nio.votable:\n  - '**/io/votable/**/*'\n\nlogging:\n  - astropy/logger.py\n  - astropy/tests/test_logger.py\n  - docs/logging.rst\n\nmodeling:\n  - '**/modeling/**/*'\n\nnddata:\n  - '**/nddata/**/*'\n\nsamp:\n  - '**/samp/**/*'\n\nstats:\n  - '**/stats/**/*'\n\ntable:\n  - '**/table/**/*'\n  - astropy/extern/jquery/**/*\n\ntime:\n  - '**/time/**/*'\n\ntimeseries:\n  - '**/timeseries/**/*'\n\nuncertainty:\n  - '**/uncertainty/**/*'\n\nunified-io:\n  - docs/io/unified.rst\n\nunits:\n  - '**/units/**/*'\n  - astropy/extern/ply/**/*\n\nutils:\n  - cextern/expat/**/*\n  - any: ['**/utils/**/*',\n          '!astropy/utils/iers/**/*', '!docs/utils/iers.rst',\n          '!astropy/utils/masked/**/*', '!docs/utils/masked/**/*']\n\nutils.iers:\n  - astropy/utils/iers/**/*\n  - docs/utils/iers.rst\n\nutils.masked:\n  - astropy/utils/masked/**/*\n  - docs/utils/masked/**/*\n\nvisualization:\n  - any: ['**/visualization/**/*', '!**/visualization/wcsaxes/**/*']\n\nvisualization.wcsaxes:\n  - '**/visualization/wcsaxes/**/*'\n\nwcs:\n  - cextern/wcslib/**/*\n  - any: ['**/wcs/**/*', '!astropy/wcs/wcsapi/**/*', '!docs/wcs/wcsapi.rst']\n\nwcs.wcsapi:\n  - astropy/wcs/wcsapi/**/*\n  - docs/wcs/wcsapi.rst\n"},{"id":575,"name":".github/workflows","nodeType":"Package"},{"id":576,"name":"check_changelog.yml","nodeType":"TextFile","path":".github/workflows","text":"name: Check PR change log\n\non:\n  # So it cannot be skipped.\n  pull_request_target:\n    types: [opened, synchronize, labeled, unlabeled]\n\njobs:\n  changelog_checker:\n    name: Check if towncrier change log entry is correct\n    runs-on: ubuntu-latest\n    steps:\n    - uses: pllim/actions-towncrier-changelog@main\n      env:\n        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        BOT_USERNAME: gilesbot\n"},{"id":577,"name":"cancel_workflows.yml","nodeType":"TextFile","path":".github/workflows","text":"name: Cancel duplicate workflows\n\non:\n  workflow_run:\n    workflows: [\"CI\", \"Daily cron\", \"Weekly cron\", \"Check PR change log\"]\n    types:\n      - requested\n\n# Note: This has to be in workflow_run so it works for PRs from forks.\njobs:\n  cancel:\n    runs-on: ubuntu-latest\n    steps:\n    - name: Cancel previous runs\n      uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d  # 0.8.0\n      with:\n        workflow_id: ${{ github.event.workflow.id }}\n"},{"id":578,"name":"ci_cron_daily.yml","nodeType":"TextFile","path":".github/workflows","text":"name: Daily cron\n\non:\n  schedule:\n    # run every day at 3am UTC\n    - cron: '0 3 * * *'\n  pull_request:\n    # We also want this workflow triggered if the 'Extra CI' label is added\n    # or present when PR is updated\n    types:\n      - synchronize\n      - labeled\n  push:\n    # We want this workflow to always run on release branches as well as\n    # all tags since we want to be really sure we don't introduce\n    # regressions on the release branches, and it's also important to run\n    # this on pre-release and release tags.\n    branches:\n    - 'v*'\n    tags:\n    - '*'\n\nenv:\n  ARCH_ON_CI: \"normal\"\n  IS_CRON: \"true\"\n\njobs:\n  tests:\n    runs-on: ${{ matrix.os }}\n    if: (github.repository == 'astropy/astropy' && (github.event_name == 'schedule' || github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'Extra CI')))\n    strategy:\n      fail-fast: false\n      matrix:\n        include:\n\n          - name: Bundling with pyinstaller\n            os: ubuntu-latest\n            python: 3.8\n            toxenv: pyinstaller\n\n    steps:\n    - name: Checkout code\n      uses: actions/checkout@v2\n      with:\n        fetch-depth: 0\n    - name: Set up Python\n      uses: actions/setup-python@v2\n      with:\n        python-version: ${{ matrix.python }}\n    - name: Install language-pack-de and tzdata\n      if: ${{ matrix.os == 'ubuntu-latest' }}\n      run: |\n        sudo apt-get update\n        sudo apt-get install language-pack-de tzdata\n    - name: Install Python dependencies\n      run: python -m pip install --upgrade tox\n    - name: Run tests\n      run: tox ${{ matrix.toxargs}} -e ${{ matrix.toxenv}} -- ${{ matrix.toxposargs}}\n"},{"id":579,"name":"open_actions.yml","nodeType":"TextFile","path":".github/workflows","text":"name: \"When Opened\"\n\non:\n  issues:\n    types:\n    - opened\n  pull_request_target:\n    types:\n    - opened\n\njobs:\n  triage:\n    runs-on: ubuntu-latest\n    steps:\n    # NOTE: sync-labels due to https://github.com/actions/labeler/issues/112\n    - name: Label PR\n      uses: actions/labeler@v3\n      if: github.event_name == 'pull_request_target' && github.event.pull_request.user.login != 'meeseeksmachine'\n      with:\n        repo-token: \"${{ secrets.GITHUB_TOKEN }}\"\n        sync-labels: ''\n    - name: Greet new contributors\n      uses: actions/first-interaction@v1\n      with:\n        repo-token: \"${{ secrets.GITHUB_TOKEN }}\"\n        issue-message: >\n            Welcome to Astropy 👋 and thank you for your first issue!\n\n\n            A project member will respond to you as soon as possible; in\n            the meantime, please double-check the [guidelines for submitting\n            issues](https://github.com/astropy/astropy/blob/main/CONTRIBUTING.md#reporting-issues)\n            and make sure you've provided the requested details.\n\n\n            GitHub issues in the Astropy repository are used to track bug\n            reports and feature requests; If your issue poses a question about\n            how to use Astropy, please instead raise your question in the\n            [Astropy Discourse user\n            forum](https://community.openastronomy.org/c/astropy/8) and close\n            this issue.\n\n\n            If you feel that this issue has not been responded to in a timely\n            manner, please leave a comment mentioning our software support\n            engineer @embray, or send a message directly to the [development\n            mailing list](http://groups.google.com/group/astropy-dev).  If\n            the issue is urgent or sensitive in nature (e.g., a security\n            vulnerability) please send an e-mail directly to the private e-mail\n            feedback@astropy.org.\n        pr-message: >\n            Welcome to Astropy 👋 and congratulations on your first pull\n            request! 🎉\n\n\n            A project member will respond to you as soon as possible; in the\n            meantime, please have a look over the [Checklist for Contributed\n            Code](https://github.com/astropy/astropy/blob/main/CONTRIBUTING.md#checklist-for-contributed-code)\n            and make sure you've addressed as many of the questions there as\n            possible.\n\n\n            If you feel that this pull request has not been responded to in a\n            timely manner, please leave a comment mentioning our software\n            support engineer @embray, or send a message directly to the\n            [development mailing\n            list](http://groups.google.com/group/astropy-dev).  If the issue is\n            urgent or sensitive in nature (e.g., a security vulnerability)\n            please send an e-mail directly to the private e-mail\n            feedback@astropy.org.\n    - name: 'Comment Draft PR'\n      uses: actions/github-script@v3\n      if: github.event.pull_request.draft == true\n      with:\n        github-token: ${{ secrets.GITHUB_TOKEN }}\n        script: |\n          github.issues.createComment({\n            issue_number: context.issue.number,\n            owner: context.repo.owner,\n            repo: context.repo.repo,\n            body: '👋 Thank you for your draft pull request! Do you know that you can use `[ci skip]` or `[skip ci]` in your commit messages to skip running continuous integration tests until you are ready?'\n          })\n    # We can take this out when astropy-bot comes back online, maybe... Until next year!\n    #- name: Special comment\n    #  uses: pllim/action-special_pr_comment@main\n    #  with:\n    #    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n"},{"id":580,"name":"ci_workflows.yml","nodeType":"TextFile","path":".github/workflows","text":"name: CI\n\non:\n  push:\n    branches:\n    - main\n    tags:\n    - '*'\n  pull_request:\n\nenv:\n  ARCH_ON_CI: \"normal\"\n  IS_CRON: \"false\"\n\njobs:\n  initial_checks:\n    name: Mandatory checks before CI\n    runs-on: ubuntu-latest\n    steps:\n    - name: Check base branch\n      uses: actions/github-script@v3\n      if: github.event_name == 'pull_request'\n      with:\n        script: |\n          const skip_label = 'skip-basebranch-check';\n          const { default_branch: allowed_basebranch } = context.payload.repository;\n          const pr = context.payload.pull_request;\n          if (pr.user.login === 'meeseeksmachine') {\n            core.info(`Base branch check is skipped since this is auto-backport by ${pr.user.login}`);\n            return;\n          }\n          if (pr.labels.find(lbl => lbl.name === skip_label)) {\n            core.info(`Base branch check is skipped due to the presence of ${skip_label} label`);\n            return;\n          }\n          if (pr.base.ref !== allowed_basebranch) {\n            core.setFailed(`PR opened against ${pr.base.ref}, not ${allowed_basebranch}`);\n          } else {\n            core.info(`PR opened correctly against ${allowed_basebranch}`);\n          }\n\n  tests:\n    name: ${{ matrix.name }}\n    runs-on: ${{ matrix.os }}\n    needs: initial_checks\n    strategy:\n      fail-fast: true\n      matrix:\n        include:\n\n          - name: Code style checks\n            os: ubuntu-latest\n            python: 3.x\n            toxenv: codestyle\n            toxposargs: --all-files -v\n\n          # NOTE: this 2nd coverage test is needed for tests and code that\n          #       run only with minimal dependencies.\n          - name: Python 3.10 with minimal dependencies and full coverage\n            os: ubuntu-latest\n            python: '3.10'\n            toxenv: py310-test-cov\n\n          # NOTE: In the build below we also check that tests do not open and\n          # leave open any files. This has a performance impact on running the\n          # tests, hence why it is not enabled by default.\n          - name: Python 3.9 with all optional dependencies\n            os: ubuntu-latest\n            python: 3.9\n            toxenv: py39-test-alldeps\n            toxargs: -v --develop\n            toxposargs: --open-files\n\n          - name: Python 3.8 with oldest supported version of all dependencies\n            os: ubuntu-18.04\n            python: 3.8\n            toxenv: py38-test-oldestdeps-alldeps-cov-clocale\n            toxposargs: --remote-data=astropy\n\n          - name: Python 3.9 with all optional dependencies (Windows)\n            os: windows-latest\n            python: 3.9\n            toxenv: py39-test-alldeps\n            toxposargs: --durations=50\n\n          - name: Python 3.9 with all optional dependencies (MacOS X)\n            os: macos-latest\n            python: 3.9\n            toxenv: py39-test-alldeps\n            toxposargs: --durations=50\n\n    steps:\n    - name: Checkout code\n      uses: actions/checkout@v2\n      with:\n        fetch-depth: 0\n    - name: Set up Python\n      uses: actions/setup-python@v2\n      with:\n        python-version: ${{ matrix.python }}\n    - name: Install language-pack-fr and tzdata\n      if: startsWith(matrix.os, 'ubuntu')\n      run: |\n        sudo apt-get update\n        sudo apt-get install language-pack-fr tzdata\n    - name: Install Python dependencies\n      run: python -m pip install --upgrade tox codecov\n    - name: Run tests\n      run: tox ${{ matrix.toxargs }} -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }}\n    # TODO: Do we need --gcov-glob \"*cextern*\" ?\n    - name: Upload coverage to codecov\n      if: ${{ contains(matrix.toxenv,'-cov') }}\n      uses: codecov/codecov-action@v2\n      with:\n        file: ./coverage.xml\n\n  allowed_failures:\n    name: ${{ matrix.name }}\n    runs-on: ${{ matrix.os }}\n    needs: initial_checks\n    strategy:\n      fail-fast: false\n      matrix:\n        include:\n          - name: (Allowed Failure) Python 3.8 with remote data and dev version of key dependencies\n            os: ubuntu-latest\n            python: 3.8\n            toxenv: py38-test-devdeps\n            toxposargs: --remote-data=any\n\n    steps:\n    - name: Checkout code\n      uses: actions/checkout@v2\n      with:\n        fetch-depth: 0\n    - name: Set up Python\n      uses: actions/setup-python@v2\n      with:\n        python-version: ${{ matrix.python }}\n    - name: Install language-pack-de and tzdata\n      if: startsWith(matrix.os, 'ubuntu')\n      run: |\n        sudo apt-get update\n        sudo apt-get install language-pack-de tzdata\n    - name: Install Python dependencies\n      run: python -m pip install --upgrade tox codecov\n    - name: Run tests\n      run: tox ${{ matrix.toxargs }} -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }}\n\n  parallel_and_32bit:\n    name: 32-bit and parallel\n    runs-on: ubuntu-latest\n    needs: initial_checks\n    container:\n      image: quay.io/pypa/manylinux2014_i686\n    steps:\n    # TODO: Use newer checkout actions when https://github.com/actions/checkout/issues/334 fixed\n    - name: Checkout code\n      uses: actions/checkout@v1\n      with:\n        fetch-depth: 0\n    - name: Write configuration items to standard location to make sure they are ignored in parallel mode\n      run: |\n        mkdir -p $HOME/.astropy/config/\n        printf \"unicode_output = True\\nmax_width = 500\" > $HOME/.astropy/config/astropy.cfg\n    # In addition to testing 32-bit, we also use the 3.8 builds to\n    # test the ability to run the test suite in parallel.\n    # Numpy is pinned to avoid building it from source for numpy 1.21.5\n    - name: Install dependencies for Python 3.8\n      run: /opt/python/cp38-cp38/bin/pip install tox\n    - name: Run tests for Python 3.8\n      run: /opt/python/cp38-cp38/bin/python -m tox -e py38-numpy120-test -- -n=4 --durations=50\n    # We use the 3.8 build to check that running tests twice in a row in the\n    # same Python session works without issues. This catches cases where\n    # running the tests changes the module state permanently. Note that we\n    # shouldn't also test the parallel build here since that enforces a degree\n    # of isolation of tests which will interfere with what we are trying to do\n    # here.\n    # Numpy is pinned to avoid building it from source for numpy 1.21.5\n    - name: Run tests for Python 3.8\n      run: /opt/python/cp38-cp38/bin/python -m tox -e py38-numpy120-test-double\n"},{"id":581,"name":"ci_cron_weekly.yml","nodeType":"TextFile","path":".github/workflows","text":"name: Weekly cron\n\non:\n  schedule:\n    # run every Monday at 6am UTC\n    - cron: '0 6 * * 1'\n  pull_request:\n    # We also want this workflow triggered if the 'Extra CI' label is added\n    # or present when PR is updated\n    types:\n      - synchronize\n      - labeled\n  push:\n    # We want this workflow to always run on release branches as well as\n    # all tags since we want to be really sure we don't introduce\n    # regressions on the release branches, and it's also important to run\n    # this on pre-release and release tags.\n    branches:\n    - 'v*'\n    tags:\n    - '*'\n\nenv:\n  IS_CRON: 'true'\n\njobs:\n  tests:\n    runs-on: ${{ matrix.os }}\n    if: (github.repository == 'astropy/astropy' && (github.event_name == 'schedule' || github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'Extra CI')))\n    env:\n      ARCH_ON_CI: \"normal\"\n    strategy:\n      fail-fast: false\n      matrix:\n        include:\n\n          # We check numpy-dev also in a job that only runs from cron, so that\n          # we can spot issues sooner. We do not use remote data here, since\n          # that gives too many false positives due to URL timeouts. We also\n          # install all dependencies via pip here so we pick up the latest\n          # releases.\n          - name: Python 3.10 with dev version of key dependencies\n            os: ubuntu-latest\n            python: '3.10'\n            toxenv: py310-test-devdeps\n\n          - name: Documentation link check\n            os: ubuntu-latest\n            python: 3.8\n            toxenv: linkcheck\n\n          # TODO: Uncomment when 3.10 is more mature. Should we use devdeps?\n          # Test against Python dev in cron job.\n          #- name: Python dev with basic dependencies\n          #  os: ubuntu-latest\n          #  python: 3.10-dev\n          #  toxenv: pydev-test\n\n    steps:\n    - name: Checkout code\n      uses: actions/checkout@v2\n      with:\n        fetch-depth: 0\n    - name: Set up Python\n      uses: actions/setup-python@v2\n      with:\n        python-version: ${{ matrix.python }}\n    - name: Install language-pack-de and tzdata\n      if: ${{ matrix.os == 'ubuntu-latest' }}\n      run: |\n        sudo apt-get update\n        sudo apt-get install language-pack-de tzdata\n    - name: Install graphviz\n      if: ${{ matrix.toxenv == 'linkcheck' }}\n      run: sudo apt-get install graphviz\n    - name: Install Python dependencies\n      run: python -m pip install --upgrade tox\n    - name: Run tests\n      run: tox ${{ matrix.toxargs}} -e ${{ matrix.toxenv}} -- ${{ matrix.toxposargs}}\n\n\n  tests_more_architectures:\n\n    # The following architectures are emulated and are therefore slow, so\n    # we include them just in the weekly cron. These also serve as a test\n    # of using system libraries and using pytest directly.\n\n    runs-on: ubuntu-20.04\n    name: Python 3.9\n    if: (github.repository == 'astropy/astropy' && (github.event_name == 'schedule' || github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'Extra CI')))\n    env:\n      ARCH_ON_CI: ${{ matrix.arch }}\n\n    strategy:\n      fail-fast: false\n      matrix:\n        include:\n          - arch: aarch64\n          - arch: s390x\n          # Uncomment when we ready to fix the failures, see PR 11697\n          #- arch: ppc64le\n\n    steps:\n      - uses: actions/checkout@v2\n        with:\n          fetch-depth: 0\n      - uses: uraimo/run-on-arch-action@v2.1.1\n        name: Run tests\n        id: build\n        with:\n          arch: ${{ matrix.arch }}\n          distro: bullseye\n\n          shell: /bin/bash\n\n          install: |\n            echo \"deb http://deb.debian.org/debian bullseye-backports main\" >> /etc/apt/sources.list\n            apt-get update -q -y\n            apt-get install -q -y git \\\n                                  g++ \\\n                                  pkg-config \\\n                                  python3 \\\n                                  python3-configobj \\\n                                  python3-numpy \\\n                                  python3-ply \\\n                                  python3-venv \\\n                                  cython3 \\\n                                  libwcs7/bullseye-backports \\\n                                  wcslib-dev/bullseye-backports \\\n                                  libcfitsio-dev \\\n                                  liberfa1\n\n          run: |\n            python3 -m venv --system-site-packages tests\n            source tests/bin/activate\n            ASTROPY_USE_SYSTEM_ALL=1 pip3 install -e .[test]\n            python3 -m pytest\n"},{"id":582,"name":"codeql-analysis.yml","nodeType":"TextFile","path":".github/workflows","text":"# For most projects, this workflow file will not need changing; you simply need\n# to commit it to your repository.\n#\n# You may wish to alter this file to override the set of languages analyzed,\n# or to provide custom queries or build logic.\n#\n# ******** NOTE ********\n# We have attempted to detect the languages in your repository. Please check\n# the `language` matrix defined below to confirm you have the correct set of\n# supported CodeQL languages.\n#\nname: \"CodeQL\"\n\non:\n  schedule:\n    # run every Wednesday at 6am UTC\n    - cron: '0 6 * * 3'\n\njobs:\n  analyze:\n    name: Analyze\n    runs-on: ubuntu-latest\n\n    strategy:\n      fail-fast: false\n      matrix:\n        language: ['cpp', 'python']\n        # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]\n        # Learn more:\n        # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed\n\n    steps:\n    - name: Checkout repository\n      uses: actions/checkout@v2\n      with:\n        fetch-depth: 0\n\n    # Initializes the CodeQL tools for scanning.\n    - name: Initialize CodeQL\n      uses: github/codeql-action/init@v1\n      with:\n        languages: ${{ matrix.language }}\n        # If you wish to specify custom queries, you can do so here or in a config file.\n        # By default, queries listed here will override any specified in a config file.\n        # Prefix the list here with \"+\" to use these queries and those in the config file.\n        # queries: ./path/to/local/query, your-org/your-repo/queries@main\n\n    # Autobuild attempts to build any compiled languages  (C/C++, C#, or Java).\n    # If this step fails, then you should remove it and run the build manually (see below)\n    - name: Autobuild\n      if: matrix.language != 'cpp'\n      uses: github/codeql-action/autobuild@v1\n\n    # ℹ️ Command-line programs to run using the OS shell.\n    # 📚 https://git.io/JvXDl\n\n    # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines\n    #    and modify them (or add more) to build your code if your project\n    #    uses a compiled language\n\n    - name: Set up Python\n      uses: actions/setup-python@v2\n      if: matrix.language == 'cpp'\n      with:\n        python-version: 3.9\n\n    - name: Manual build\n      if: matrix.language == 'cpp'\n      run: |\n       pip install -U pip setuptools_scm wheel\n       pip install extension-helpers cython numpy pyerfa\n       python setup.py build_ext --inplace\n\n    - name: Perform CodeQL Analysis\n      uses: github/codeql-action/analyze@v1\n"},{"col":4,"comment":"Returns the number of blank cards at the end of the Header.","endLoc":1846,"header":"def _countblanks(self)","id":583,"name":"_countblanks","nodeType":"Function","startLoc":1840,"text":"def _countblanks(self):\n        \"\"\"Returns the number of blank cards at the end of the Header.\"\"\"\n\n        for idx in range(1, len(self._cards)):\n            if not self._cards[-idx].is_blank:\n                return idx - 1\n        return 0"},{"id":584,"name":"stalebot.yml","nodeType":"TextFile","path":".github/workflows","text":"name: Astropy stalebot\n\non:\n  schedule:\n    # * is a special character in YAML so you have to quote this string\n    # run every day at 5:30 am UTC\n    - cron: '30 5 * * *'\n  workflow_dispatch:\n\njobs:\n  stalebot:\n    runs-on: ubuntu-latest\n    if: github.repository == 'astropy/astropy'\n    steps:\n      - uses: pllim/action-astropy-stalebot@main\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          STALEBOT_MAX_ISSUES: -1\n          STALEBOT_MAX_PRS: -1\n          STALEBOT_SLEEP: 10\n"},{"col":4,"comment":"null","endLoc":1853,"header":"def _useblanks(self, count)","id":585,"name":"_useblanks","nodeType":"Function","startLoc":1848,"text":"def _useblanks(self, count):\n        for _ in range(count):\n            if self._cards[-1].is_blank:\n                del self[-1]\n            else:\n                break"},{"id":586,"name":".github/ISSUE_TEMPLATE","nodeType":"Package"},{"id":587,"name":"feature_request.md","nodeType":"TextFile","path":".github/ISSUE_TEMPLATE","text":"---\nname: Feature request\nabout: Suggest an idea to improve astropy\nlabels: \"Feature Request\"\n---\n\n<!-- This comments are hidden when you submit the issue,\nso you do not need to remove them! -->\n\n<!-- Please be sure to check out our contributing guidelines,\nhttps://github.com/astropy/astropy/blob/main/CONTRIBUTING.md .\nPlease be sure to check out our code of conduct,\nhttps://github.com/astropy/astropy/blob/main/CODE_OF_CONDUCT.md . -->\n\n<!-- Please have a search on our GitHub repository to see if a similar\nissue has already been posted.\nIf a similar issue is closed, have a quick look to see if you are satisfied\nby the resolution.\nIf not please go ahead and open an issue! -->\n\n### Description\n<!-- Provide a general description of the feature you would like. -->\n<!-- If you want to, you can suggest a draft design or API. -->\n<!-- This way we have a deeper discussion on the feature. -->\n\n\n### Additional context\n<!-- Add any other context or screenshots about the feature request here. -->\n<!-- This part is optional. -->\n"},{"id":588,"name":"bug_report.md","nodeType":"TextFile","path":".github/ISSUE_TEMPLATE","text":"---\nname: Bug report\nabout: Create a report describing unexpected or incorrect behavior in astropy.\nlabels: Bug\n---\n\n<!-- This comments are hidden when you submit the issue,\nso you do not need to remove them! -->\n\n<!-- Please be sure to check out our contributing guidelines,\nhttps://github.com/astropy/astropy/blob/main/CONTRIBUTING.md .\nPlease be sure to check out our code of conduct,\nhttps://github.com/astropy/astropy/blob/main/CODE_OF_CONDUCT.md . -->\n\n<!-- Please have a search on our GitHub repository to see if a similar\nissue has already been posted.\nIf a similar issue is closed, have a quick look to see if you are satisfied\nby the resolution.\nIf not please go ahead and open an issue! -->\n\n<!-- Please check that the development version still produces the same bug.\nYou can install development version with\npip install git+https://github.com/astropy/astropy\ncommand. -->\n\n### Description\n<!-- Provide a general description of the bug. -->\n\n### Expected behavior\n<!-- What did you expect to happen. -->\n\n### Actual behavior\n<!-- What actually happened. -->\n<!-- Was the output confusing or poorly described? -->\n\n### Steps to Reproduce\n<!-- Ideally a code example could be provided so we can run it ourselves. -->\n<!-- If you are pasting code, use triple backticks (```) around\nyour code snippet. -->\n<!-- If necessary, sanitize your screen output to be pasted so you do not\nreveal secrets like tokens and passwords. -->\n\n1. [First Step]\n2. [Second Step]\n3. [and so on...]\n\n```python\n# Put your Python code snippet here.\n```\n\n### System Details\n<!-- Even if you do not think this is necessary, it is useful information for the maintainers.\nPlease run the following snippet and paste the output below:\nimport platform; print(platform.platform())\nimport sys; print(\"Python\", sys.version)\nimport numpy; print(\"Numpy\", numpy.__version__)\nimport erfa; print(\"pyerfa\", erfa.__version__)\nimport astropy; print(\"astropy\", astropy.__version__)\nimport scipy; print(\"Scipy\", scipy.__version__)\nimport matplotlib; print(\"Matplotlib\", matplotlib.__version__)\n-->\n"},{"col":4,"comment":"\n        Reads `distortion paper`_ table-lookup keywords and data, and\n        returns a 2-tuple of `~astropy.wcs.DistortionLookupTable`\n        objects.\n\n        If no `distortion paper`_ keywords are found, ``(None, None)``\n        is returned.\n        ","endLoc":1013,"header":"def _read_distortion_kw(self, header, fobj, dist='CPDIS', err=0.0)","id":589,"name":"_read_distortion_kw","nodeType":"Function","startLoc":941,"text":"def _read_distortion_kw(self, header, fobj, dist='CPDIS', err=0.0):\n        \"\"\"\n        Reads `distortion paper`_ table-lookup keywords and data, and\n        returns a 2-tuple of `~astropy.wcs.DistortionLookupTable`\n        objects.\n\n        If no `distortion paper`_ keywords are found, ``(None, None)``\n        is returned.\n        \"\"\"\n        if isinstance(header, (str, bytes)):\n            return (None, None)\n\n        if dist == 'CPDIS':\n            d_kw = 'DP'\n            err_kw = 'CPERR'\n        else:\n            d_kw = 'DQ'\n            err_kw = 'CQERR'\n\n        tables = {}\n        for i in range(1, self.naxis + 1):\n            d_error_key = err_kw + str(i)\n            if d_error_key in header:\n                d_error = header[d_error_key]\n                del header[d_error_key]\n            else:\n                d_error = 0.0\n            if d_error < err:\n                tables[i] = None\n                continue\n            distortion = dist + str(i)\n            if distortion in header:\n                dis = header[distortion].lower()\n                del header[distortion]\n                if dis == 'lookup':\n                    if not isinstance(fobj, fits.HDUList):\n                        raise ValueError('an astropy.io.fits.HDUList is '\n                                         'required for Lookup table distortion.')\n                    dp = (d_kw + str(i)).strip()\n                    dp_extver_key = dp + '.EXTVER'\n                    if dp_extver_key in header:\n                        d_extver = header[dp_extver_key]\n                        del header[dp_extver_key]\n                    else:\n                        d_extver = 1\n                    dp_axis_key = dp + f'.AXIS.{i:d}'\n                    if i == header[dp_axis_key]:\n                        d_data = fobj['WCSDVARR', d_extver].data\n                    else:\n                        d_data = (fobj['WCSDVARR', d_extver].data).transpose()\n                    del header[dp_axis_key]\n                    d_header = fobj['WCSDVARR', d_extver].header\n                    d_crpix = (d_header.get('CRPIX1', 0.0),\n                               d_header.get('CRPIX2', 0.0))\n                    d_crval = (d_header.get('CRVAL1', 0.0),\n                               d_header.get('CRVAL2', 0.0))\n                    d_cdelt = (d_header.get('CDELT1', 1.0),\n                               d_header.get('CDELT2', 1.0))\n                    d_lookup = DistortionLookupTable(d_data, d_crpix, d_crval, d_cdelt)\n                    tables[i] = d_lookup\n\n                    for key in set(header):\n                        if key.startswith(dp + '.'):\n                            del header[key]\n                else:\n                    warnings.warn('Polynomial distortion is not implemented.\\n', AstropyUserWarning)\n            else:\n                tables[i] = None\n\n        if not tables:\n            return (None, None)\n        else:\n            return (tables.get(1), tables.get(2))"},{"id":590,"name":"astropy","nodeType":"Package"},{"id":591,"name":"CITATION","nodeType":"TextFile","path":"astropy","text":"If you use Astropy for work/research presented in a publication (whether\ndirectly, or as a dependency to another package), we recommend and encourage\nthe following acknowledgment:\n\n  This research made use of Astropy, a community-developed core Python package\n  for Astronomy (Astropy Collaboration, 2018).\n\nwhere (Astropy Collaboration, 2018) is a citation to this paper:\n\n  https://ui.adsabs.harvard.edu/abs/2018AJ....156..123T\n\nAn earlier paper is also available describing the status of the package at\nthe time of v0.2. If you have used Astropy for a long time, you are\nencouraged to acknowledge both papers:\n\n  This research made use of Astropy, a community-developed core Python package\n  for Astronomy (Astropy Collaboration, 2013, 2018).\n\nwhere (Astropy Collaboration, 2013) is a citation to this paper:\n\n  https://ui.adsabs.harvard.edu/abs/2013A%26A...558A..33A\n\nWe encourage you to also include citations to the papers in the main text\nwherever appropriate.\n\n\nRecommended BibTeX entries for the above citations are:\n\n@ARTICLE{2018AJ....156..123T,\n   author = {{The Astropy Collaboration} and {Price-Whelan}, A.~M. and {Sip{\\H o}cz}, B.~M. and\n\t{G{\\\"u}nther}, H.~M. and {Lim}, P.~L. and {Crawford}, S.~M. and\n\t{Conseil}, S. and {Shupe}, D.~L. and {Craig}, M.~W. and {Dencheva}, N. and\n\t{Ginsburg}, A. and {VanderPlas}, J.~T. and {Bradley}, L.~D. and\n\t{P{\\'e}rez-Su{\\'a}rez}, D. and {de Val-Borro}, M. and {Paper Contributors}, (. and\n\t{Aldcroft}, T.~L. and {Cruz}, K.~L. and {Robitaille}, T.~P. and\n\t{Tollerud}, E.~J. and {Coordination Committee}, (. and {Ardelean}, C. and\n\t{Babej}, T. and {Bach}, Y.~P. and {Bachetti}, M. and {Bakanov}, A.~V. and\n\t{Bamford}, S.~P. and {Barentsen}, G. and {Barmby}, P. and {Baumbach}, A. and\n\t{Berry}, K.~L. and {Biscani}, F. and {Boquien}, M. and {Bostroem}, K.~A. and\n\t{Bouma}, L.~G. and {Brammer}, G.~B. and {Bray}, E.~M. and {Breytenbach}, H. and\n\t{Buddelmeijer}, H. and {Burke}, D.~J. and {Calderone}, G. and\n\t{Cano Rodr{\\'{\\i}}guez}, J.~L. and {Cara}, M. and {Cardoso}, J.~V.~M. and\n\t{Cheedella}, S. and {Copin}, Y. and {Corrales}, L. and {Crichton}, D. and\n\t{D{\\rsquo}Avella}, D. and {Deil}, C. and {Depagne}, {\\'E}. and\n\t{Dietrich}, J.~P. and {Donath}, A. and {Droettboom}, M. and\n\t{Earl}, N. and {Erben}, T. and {Fabbro}, S. and {Ferreira}, L.~A. and\n\t{Finethy}, T. and {Fox}, R.~T. and {Garrison}, L.~H. and {Gibbons}, S.~L.~J. and\n\t{Goldstein}, D.~A. and {Gommers}, R. and {Greco}, J.~P. and\n\t{Greenfield}, P. and {Groener}, A.~M. and {Grollier}, F. and\n\t{Hagen}, A. and {Hirst}, P. and {Homeier}, D. and {Horton}, A.~J. and\n\t{Hosseinzadeh}, G. and {Hu}, L. and {Hunkeler}, J.~S. and {Ivezi{\\'c}}, {\\v Z}. and\n\t{Jain}, A. and {Jenness}, T. and {Kanarek}, G. and {Kendrew}, S. and\n\t{Kern}, N.~S. and {Kerzendorf}, W.~E. and {Khvalko}, A. and\n\t{King}, J. and {Kirkby}, D. and {Kulkarni}, A.~M. and {Kumar}, A. and\n\t{Lee}, A. and {Lenz}, D. and {Littlefair}, S.~P. and {Ma}, Z. and\n\t{Macleod}, D.~M. and {Mastropietro}, M. and {McCully}, C. and\n\t{Montagnac}, S. and {Morris}, B.~M. and {Mueller}, M. and {Mumford}, S.~J. and\n\t{Muna}, D. and {Murphy}, N.~A. and {Nelson}, S. and {Nguyen}, G.~H. and\n\t{Ninan}, J.~P. and {N{\\\"o}the}, M. and {Ogaz}, S. and {Oh}, S. and\n\t{Parejko}, J.~K. and {Parley}, N. and {Pascual}, S. and {Patil}, R. and\n\t{Patil}, A.~A. and {Plunkett}, A.~L. and {Prochaska}, J.~X. and\n\t{Rastogi}, T. and {Reddy Janga}, V. and {Sabater}, J. and {Sakurikar}, P. and\n\t{Seifert}, M. and {Sherbert}, L.~E. and {Sherwood-Taylor}, H. and\n\t{Shih}, A.~Y. and {Sick}, J. and {Silbiger}, M.~T. and {Singanamalla}, S. and\n\t{Singer}, L.~P. and {Sladen}, P.~H. and {Sooley}, K.~A. and\n\t{Sornarajah}, S. and {Streicher}, O. and {Teuben}, P. and {Thomas}, S.~W. and\n\t{Tremblay}, G.~R. and {Turner}, J.~E.~H. and {Terr{\\'o}n}, V. and\n\t{van Kerkwijk}, M.~H. and {de la Vega}, A. and {Watkins}, L.~L. and\n\t{Weaver}, B.~A. and {Whitmore}, J.~B. and {Woillez}, J. and\n\t{Zabalza}, V. and {Contributors}, (.},\n    title = \"{The Astropy Project: Building an Open-science Project and Status of the v2.0 Core Package}\",\n  journal = {\\aj},\narchivePrefix = \"arXiv\",\n   eprint = {1801.02634},\n primaryClass = \"astro-ph.IM\",\n keywords = {methods: data analysis, methods: miscellaneous, methods: statistical, reference systems },\n     year = 2018,\n    month = sep,\n   volume = 156,\n      eid = {123},\n    pages = {123},\n      doi = {10.3847/1538-3881/aabc4f},\n   adsurl = {https://ui.adsabs.harvard.edu/abs/2018AJ....156..123T},\n  adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n@ARTICLE{2013A&A...558A..33A,\n   author = {{Astropy Collaboration} and {Robitaille}, T.~P. and {Tollerud}, E.~J. and\n    {Greenfield}, P. and {Droettboom}, M. and {Bray}, E. and {Aldcroft}, T. and\n    {Davis}, M. and {Ginsburg}, A. and {Price-Whelan}, A.~M. and\n    {Kerzendorf}, W.~E. and {Conley}, A. and {Crighton}, N. and\n    {Barbary}, K. and {Muna}, D. and {Ferguson}, H. and {Grollier}, F. and\n    {Parikh}, M.~M. and {Nair}, P.~H. and {Unther}, H.~M. and {Deil}, C. and\n    {Woillez}, J. and {Conseil}, S. and {Kramer}, R. and {Turner}, J.~E.~H. and\n    {Singer}, L. and {Fox}, R. and {Weaver}, B.~A. and {Zabalza}, V. and\n    {Edwards}, Z.~I. and {Azalee Bostroem}, K. and {Burke}, D.~J. and\n    {Casey}, A.~R. and {Crawford}, S.~M. and {Dencheva}, N. and\n    {Ely}, J. and {Jenness}, T. and {Labrie}, K. and {Lian Lim}, P. and\n    {Pierfederici}, F. and {Pontzen}, A. and {Ptak}, A. and {Refsdal}, B. and\n    {Servillat}, M. and {Streicher}, O.},\n    title = \"{Astropy: A community Python package for astronomy}\",\n  journal = {\\aap},\n keywords = {methods: data analysis, methods: miscellaneous, virtual observatory tools},\n     year = 2013,\n    month = oct,\n   volume = 558,\n      eid = {A33},\n    pages = {A33},\n      doi = {10.1051/0004-6361/201322068},\n   adsurl = {https://ui.adsabs.harvard.edu/abs/2013A%26A...558A..33A},\n  adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n"},{"fileName":"version.py","filePath":"astropy","id":592,"nodeType":"File","text":"# NOTE: First try _dev.scm_version if it exists and setuptools_scm is installed\n# This file is not included in astropy wheels/tarballs, so otherwise it will\n# fall back on the generated _version module.\ntry:\n    try:\n        from ._dev.scm_version import version\n    except ImportError:\n        from ._version import version\nexcept Exception:\n    import warnings\n    warnings.warn(\n        f'could not determine {__name__.split(\".\")[0]} package version; '\n        f'this indicates a broken installation')\n    del warnings\n\n    version = '0.0.0'\n\n\n# We use Version to define major, minor, micro, but ignore any suffixes.\ndef split_version(version):\n    pieces = [0, 0, 0]\n\n    try:\n        from packaging.version import Version\n\n        v = Version(version)\n        pieces = [v.major, v.minor, v.micro]\n\n    except Exception:\n        pass\n\n    return pieces\n\n\nmajor, minor, bugfix = split_version(version)\n\ndel split_version  # clean up namespace.\n\nrelease = 'dev' not in version\n"},{"col":0,"comment":"null","endLoc":32,"header":"def split_version(version)","id":593,"name":"split_version","nodeType":"Function","startLoc":20,"text":"def split_version(version):\n    pieces = [0, 0, 0]\n\n    try:\n        from packaging.version import Version\n\n        v = Version(version)\n        pieces = [v.major, v.minor, v.micro]\n\n    except Exception:\n        pass\n\n    return pieces"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":594,"name":"major","nodeType":"Attribute","startLoc":35,"text":"major"},{"fileName":"logger.py","filePath":"astropy","id":595,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"This module defines a logging class based on the built-in logging module.\n\n.. note::\n\n    This module is meant for internal ``astropy`` usage. For use in other\n    packages, we recommend implementing your own logger instead.\n\n\"\"\"\n\nimport inspect\nimport os\nimport sys\nimport logging\nimport warnings\nfrom contextlib import contextmanager\n\nfrom . import config as _config\nfrom . import conf as _conf\nfrom .utils import find_current_module\nfrom .utils.exceptions import AstropyWarning, AstropyUserWarning\n\n__all__ = ['Conf', 'conf', 'log', 'AstropyLogger', 'LoggingError']\n\n# import the logging levels from logging so that one can do:\n# log.setLevel(log.DEBUG), for example\nlogging_levels = ['NOTSET', 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL',\n                  'FATAL', ]\nfor level in logging_levels:\n    globals()[level] = getattr(logging, level)\n__all__ += logging_levels\n\n\n# Initialize by calling _init_log()\nlog = None\n\n\nclass LoggingError(Exception):\n    \"\"\"\n    This exception is for various errors that occur in the astropy logger,\n    typically when activating or deactivating logger-related features.\n    \"\"\"\n\n\nclass _AstLogIPYExc(Exception):\n    \"\"\"\n    An exception that is used only as a placeholder to indicate to the\n    IPython exception-catching mechanism that the astropy\n    exception-capturing is activated. It should not actually be used as\n    an exception anywhere.\n    \"\"\"\n\n\nclass Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.logger`.\n    \"\"\"\n    log_level = _config.ConfigItem(\n        'INFO',\n        \"Threshold for the logging messages. Logging \"\n        \"messages that are less severe than this level \"\n        \"will be ignored. The levels are ``'DEBUG'``, \"\n        \"``'INFO'``, ``'WARNING'``, ``'ERROR'``.\")\n    log_warnings = _config.ConfigItem(\n        True,\n        \"Whether to log `warnings.warn` calls.\")\n    log_exceptions = _config.ConfigItem(\n        False,\n        \"Whether to log exceptions before raising \"\n        \"them.\")\n    log_to_file = _config.ConfigItem(\n        False,\n        \"Whether to always log messages to a log \"\n        \"file.\")\n    log_file_path = _config.ConfigItem(\n        '',\n        \"The file to log messages to.  If empty string is given, \"\n        \"it defaults to a file ``'astropy.log'`` in \"\n        \"the astropy config directory.\")\n    log_file_level = _config.ConfigItem(\n        'INFO',\n        \"Threshold for logging messages to \"\n        \"`log_file_path`.\")\n    log_file_format = _config.ConfigItem(\n        \"%(asctime)r, \"\n        \"%(origin)r, %(levelname)r, %(message)r\",\n        \"Format for log file entries.\")\n    log_file_encoding = _config.ConfigItem(\n        '',\n        \"The encoding (e.g., UTF-8) to use for the log file.  If empty string \"\n        \"is given, it defaults to the platform-preferred encoding.\")\n\n\nconf = Conf()\n\n\ndef _init_log():\n    \"\"\"Initializes the Astropy log--in most circumstances this is called\n    automatically when importing astropy.\n    \"\"\"\n\n    global log\n\n    orig_logger_cls = logging.getLoggerClass()\n    logging.setLoggerClass(AstropyLogger)\n    try:\n        log = logging.getLogger('astropy')\n        log._set_defaults()\n    finally:\n        logging.setLoggerClass(orig_logger_cls)\n\n    return log\n\n\ndef _teardown_log():\n    \"\"\"Shut down exception and warning logging (if enabled) and clear all\n    Astropy loggers from the logging module's cache.\n\n    This involves poking some logging module internals, so much if it is 'at\n    your own risk' and is allowed to pass silently if any exceptions occur.\n    \"\"\"\n\n    global log\n\n    if log.exception_logging_enabled():\n        log.disable_exception_logging()\n\n    if log.warnings_logging_enabled():\n        log.disable_warnings_logging()\n\n    del log\n\n    # Now for the fun stuff...\n    try:\n        logging._acquireLock()\n        try:\n            loggerDict = logging.Logger.manager.loggerDict\n            for key in loggerDict.keys():\n                if key == 'astropy' or key.startswith('astropy.'):\n                    del loggerDict[key]\n        finally:\n            logging._releaseLock()\n    except Exception:\n        pass\n\n\nLogger = logging.getLoggerClass()\n\n\nclass AstropyLogger(Logger):\n    '''\n    This class is used to set up the Astropy logging.\n\n    The main functionality added by this class over the built-in\n    logging.Logger class is the ability to keep track of the origin of the\n    messages, the ability to enable logging of warnings.warn calls and\n    exceptions, and the addition of colorized output and context managers to\n    easily capture messages to a file or list.\n    '''\n\n    def makeRecord(self, name, level, pathname, lineno, msg, args, exc_info,\n                   func=None, extra=None, sinfo=None):\n        if extra is None:\n            extra = {}\n        if 'origin' not in extra:\n            current_module = find_current_module(1, finddiff=[True, 'logging'])\n            if current_module is not None:\n                extra['origin'] = current_module.__name__\n            else:\n                extra['origin'] = 'unknown'\n        return Logger.makeRecord(self, name, level, pathname, lineno, msg,\n                                 args, exc_info, func=func, extra=extra,\n                                 sinfo=sinfo)\n\n    _showwarning_orig = None\n\n    def _showwarning(self, *args, **kwargs):\n\n        # Bail out if we are not catching a warning from Astropy\n        if not isinstance(args[0], AstropyWarning):\n            return self._showwarning_orig(*args, **kwargs)\n\n        warning = args[0]\n        # Deliberately not using isinstance here: We want to display\n        # the class name only when it's not the default class,\n        # AstropyWarning.  The name of subclasses of AstropyWarning should\n        # be displayed.\n        if type(warning) not in (AstropyWarning, AstropyUserWarning):\n            message = f'{warning.__class__.__name__}: {args[0]}'\n        else:\n            message = str(args[0])\n\n        mod_path = args[2]\n        # Now that we have the module's path, we look through sys.modules to\n        # find the module object and thus the fully-package-specified module\n        # name.  The module.__file__ is the original source file name.\n        mod_name = None\n        mod_path, ext = os.path.splitext(mod_path)\n        for name, mod in list(sys.modules.items()):\n            try:\n                # Believe it or not this can fail in some cases:\n                # https://github.com/astropy/astropy/issues/2671\n                path = os.path.splitext(getattr(mod, '__file__', ''))[0]\n            except Exception:\n                continue\n            if path == mod_path:\n                mod_name = mod.__name__\n                break\n\n        if mod_name is not None:\n            self.warning(message, extra={'origin': mod_name})\n        else:\n            self.warning(message)\n\n    def warnings_logging_enabled(self):\n        return self._showwarning_orig is not None\n\n    def enable_warnings_logging(self):\n        '''\n        Enable logging of warnings.warn() calls\n\n        Once called, any subsequent calls to ``warnings.warn()`` are\n        redirected to this logger and emitted with level ``WARN``. Note that\n        this replaces the output from ``warnings.warn``.\n\n        This can be disabled with ``disable_warnings_logging``.\n        '''\n        if self.warnings_logging_enabled():\n            raise LoggingError(\"Warnings logging has already been enabled\")\n        self._showwarning_orig = warnings.showwarning\n        warnings.showwarning = self._showwarning\n\n    def disable_warnings_logging(self):\n        '''\n        Disable logging of warnings.warn() calls\n\n        Once called, any subsequent calls to ``warnings.warn()`` are no longer\n        redirected to this logger.\n\n        This can be re-enabled with ``enable_warnings_logging``.\n        '''\n        if not self.warnings_logging_enabled():\n            raise LoggingError(\"Warnings logging has not been enabled\")\n        if warnings.showwarning != self._showwarning:\n            raise LoggingError(\"Cannot disable warnings logging: \"\n                               \"warnings.showwarning was not set by this \"\n                               \"logger, or has been overridden\")\n        warnings.showwarning = self._showwarning_orig\n        self._showwarning_orig = None\n\n    _excepthook_orig = None\n\n    def _excepthook(self, etype, value, traceback):\n\n        if traceback is None:\n            mod = None\n        else:\n            tb = traceback\n            while tb.tb_next is not None:\n                tb = tb.tb_next\n            mod = inspect.getmodule(tb)\n\n        # include the the error type in the message.\n        if len(value.args) > 0:\n            message = f'{etype.__name__}: {str(value)}'\n        else:\n            message = str(etype.__name__)\n\n        if mod is not None:\n            self.error(message, extra={'origin': mod.__name__})\n        else:\n            self.error(message)\n        self._excepthook_orig(etype, value, traceback)\n\n    def exception_logging_enabled(self):\n        '''\n        Determine if the exception-logging mechanism is enabled.\n\n        Returns\n        -------\n        exclog : bool\n            True if exception logging is on, False if not.\n        '''\n        try:\n            ip = get_ipython()\n        except NameError:\n            ip = None\n\n        if ip is None:\n            return self._excepthook_orig is not None\n        else:\n            return _AstLogIPYExc in ip.custom_exceptions\n\n    def enable_exception_logging(self):\n        '''\n        Enable logging of exceptions\n\n        Once called, any uncaught exceptions will be emitted with level\n        ``ERROR`` by this logger, before being raised.\n\n        This can be disabled with ``disable_exception_logging``.\n        '''\n        try:\n            ip = get_ipython()\n        except NameError:\n            ip = None\n\n        if self.exception_logging_enabled():\n            raise LoggingError(\"Exception logging has already been enabled\")\n\n        if ip is None:\n            # standard python interpreter\n            self._excepthook_orig = sys.excepthook\n            sys.excepthook = self._excepthook\n        else:\n            # IPython has its own way of dealing with excepthook\n\n            # We need to locally define the function here, because IPython\n            # actually makes this a member function of their own class\n            def ipy_exc_handler(ipyshell, etype, evalue, tb, tb_offset=None):\n                # First use our excepthook\n                self._excepthook(etype, evalue, tb)\n\n                # Now also do IPython's traceback\n                ipyshell.showtraceback((etype, evalue, tb), tb_offset=tb_offset)\n\n            # now register the function with IPython\n            # note that we include _AstLogIPYExc so `disable_exception_logging`\n            # knows that it's disabling the right thing\n            ip.set_custom_exc((BaseException, _AstLogIPYExc), ipy_exc_handler)\n\n            # and set self._excepthook_orig to a no-op\n            self._excepthook_orig = lambda etype, evalue, tb: None\n\n    def disable_exception_logging(self):\n        '''\n        Disable logging of exceptions\n\n        Once called, any uncaught exceptions will no longer be emitted by this\n        logger.\n\n        This can be re-enabled with ``enable_exception_logging``.\n        '''\n        try:\n            ip = get_ipython()\n        except NameError:\n            ip = None\n\n        if not self.exception_logging_enabled():\n            raise LoggingError(\"Exception logging has not been enabled\")\n\n        if ip is None:\n            # standard python interpreter\n            if sys.excepthook != self._excepthook:\n                raise LoggingError(\"Cannot disable exception logging: \"\n                                   \"sys.excepthook was not set by this logger, \"\n                                   \"or has been overridden\")\n            sys.excepthook = self._excepthook_orig\n            self._excepthook_orig = None\n        else:\n            # IPython has its own way of dealing with exceptions\n            ip.set_custom_exc(tuple(), None)\n\n    def enable_color(self):\n        '''\n        Enable colorized output\n        '''\n        _conf.use_color = True\n\n    def disable_color(self):\n        '''\n        Disable colorized output\n        '''\n        _conf.use_color = False\n\n    @contextmanager\n    def log_to_file(self, filename, filter_level=None, filter_origin=None):\n        '''\n        Context manager to temporarily log messages to a file.\n\n        Parameters\n        ----------\n        filename : str\n            The file to log messages to.\n        filter_level : str\n            If set, any log messages less important than ``filter_level`` will\n            not be output to the file. Note that this is in addition to the\n            top-level filtering for the logger, so if the logger has level\n            'INFO', then setting ``filter_level`` to ``INFO`` or ``DEBUG``\n            will have no effect, since these messages are already filtered\n            out.\n        filter_origin : str\n            If set, only log messages with an origin starting with\n            ``filter_origin`` will be output to the file.\n\n        Notes\n        -----\n\n        By default, the logger already outputs log messages to a file set in\n        the Astropy configuration file. Using this context manager does not\n        stop log messages from being output to that file, nor does it stop log\n        messages from being printed to standard output.\n\n        Examples\n        --------\n\n        The context manager is used as::\n\n            with logger.log_to_file('myfile.log'):\n                # your code here\n        '''\n        encoding = conf.log_file_encoding if conf.log_file_encoding else None\n        fh = logging.FileHandler(filename, encoding=encoding)\n        if filter_level is not None:\n            fh.setLevel(filter_level)\n        if filter_origin is not None:\n            fh.addFilter(FilterOrigin(filter_origin))\n        f = logging.Formatter(conf.log_file_format)\n        fh.setFormatter(f)\n        self.addHandler(fh)\n        yield\n        fh.close()\n        self.removeHandler(fh)\n\n    @contextmanager\n    def log_to_list(self, filter_level=None, filter_origin=None):\n        '''\n        Context manager to temporarily log messages to a list.\n\n        Parameters\n        ----------\n        filename : str\n            The file to log messages to.\n        filter_level : str\n            If set, any log messages less important than ``filter_level`` will\n            not be output to the file. Note that this is in addition to the\n            top-level filtering for the logger, so if the logger has level\n            'INFO', then setting ``filter_level`` to ``INFO`` or ``DEBUG``\n            will have no effect, since these messages are already filtered\n            out.\n        filter_origin : str\n            If set, only log messages with an origin starting with\n            ``filter_origin`` will be output to the file.\n\n        Notes\n        -----\n\n        Using this context manager does not stop log messages from being\n        output to standard output.\n\n        Examples\n        --------\n\n        The context manager is used as::\n\n            with logger.log_to_list() as log_list:\n                # your code here\n        '''\n        lh = ListHandler()\n        if filter_level is not None:\n            lh.setLevel(filter_level)\n        if filter_origin is not None:\n            lh.addFilter(FilterOrigin(filter_origin))\n        self.addHandler(lh)\n        yield lh.log_list\n        self.removeHandler(lh)\n\n    def _set_defaults(self):\n        '''\n        Reset logger to its initial state\n        '''\n\n        # Reset any previously installed hooks\n        if self.warnings_logging_enabled():\n            self.disable_warnings_logging()\n        if self.exception_logging_enabled():\n            self.disable_exception_logging()\n\n        # Remove all previous handlers\n        for handler in self.handlers[:]:\n            self.removeHandler(handler)\n\n        # Set levels\n        self.setLevel(conf.log_level)\n\n        # Set up the stdout handler\n        sh = StreamHandler()\n        self.addHandler(sh)\n\n        # Set up the main log file handler if requested (but this might fail if\n        # configuration directory or log file is not writeable).\n        if conf.log_to_file:\n            log_file_path = conf.log_file_path\n\n            # \"None\" as a string because it comes from config\n            try:\n                _ASTROPY_TEST_\n                testing_mode = True\n            except NameError:\n                testing_mode = False\n\n            try:\n                if log_file_path == '' or testing_mode:\n                    log_file_path = os.path.join(\n                        _config.get_config_dir('astropy'), \"astropy.log\")\n                else:\n                    log_file_path = os.path.expanduser(log_file_path)\n\n                encoding = conf.log_file_encoding if conf.log_file_encoding else None\n                fh = logging.FileHandler(log_file_path, encoding=encoding)\n            except OSError as e:\n                warnings.warn(\n                    f'log file {log_file_path!r} could not be opened for writing: {str(e)}',\n                    RuntimeWarning)\n            else:\n                formatter = logging.Formatter(conf.log_file_format)\n                fh.setFormatter(formatter)\n                fh.setLevel(conf.log_file_level)\n                self.addHandler(fh)\n\n        if conf.log_warnings:\n            self.enable_warnings_logging()\n\n        if conf.log_exceptions:\n            self.enable_exception_logging()\n\n\nclass StreamHandler(logging.StreamHandler):\n    \"\"\"\n    A specialized StreamHandler that logs INFO and DEBUG messages to\n    stdout, and all other messages to stderr.  Also provides coloring\n    of the output, if enabled in the parent logger.\n    \"\"\"\n\n    def emit(self, record):\n        '''\n        The formatter for stderr\n        '''\n        if record.levelno <= logging.INFO:\n            stream = sys.stdout\n        else:\n            stream = sys.stderr\n\n        if record.levelno < logging.DEBUG or not _conf.use_color:\n            print(record.levelname, end='', file=stream)\n        else:\n            # Import utils.console only if necessary and at the latest because\n            # the import takes a significant time [#4649]\n            from .utils.console import color_print\n            if record.levelno < logging.INFO:\n                color_print(record.levelname, 'magenta', end='', file=stream)\n            elif record.levelno < logging.WARN:\n                color_print(record.levelname, 'green', end='', file=stream)\n            elif record.levelno < logging.ERROR:\n                color_print(record.levelname, 'brown', end='', file=stream)\n            else:\n                color_print(record.levelname, 'red', end='', file=stream)\n        record.message = f\"{record.msg} [{record.origin:s}]\"\n        print(\": \" + record.message, file=stream)\n\n\nclass FilterOrigin:\n    '''A filter for the record origin'''\n\n    def __init__(self, origin):\n        self.origin = origin\n\n    def filter(self, record):\n        return record.origin.startswith(self.origin)\n\n\nclass ListHandler(logging.Handler):\n    '''A handler that can be used to capture the records in a list'''\n\n    def __init__(self, filter_level=None, filter_origin=None):\n        logging.Handler.__init__(self)\n        self.log_list = []\n\n    def emit(self, record):\n        self.log_list.append(record)\n"},{"col":4,"comment":"\n        Generate a docstring for the unit if the user didn't supply\n        one.  This is only used from the constructor and may be\n        overridden in subclasses.\n        ","endLoc":1747,"header":"def _generate_doc(self)","id":596,"name":"_generate_doc","nodeType":"Function","startLoc":1737,"text":"def _generate_doc(self):\n        \"\"\"\n        Generate a docstring for the unit if the user didn't supply\n        one.  This is only used from the constructor and may be\n        overridden in subclasses.\n        \"\"\"\n        names = self.names\n        if len(self.names) > 1:\n            return \"{1} ({0})\".format(*names[:2])\n        else:\n            return names[0]"},{"attributeType":"null","col":0,"comment":"null","endLoc":74,"id":597,"name":"conf","nodeType":"Attribute","startLoc":74,"text":"conf"},{"col":4,"comment":"\n        Injects the unit, and all of its aliases, in the given\n        namespace dictionary.\n        ","endLoc":1822,"header":"def _inject(self, namespace=None)","id":598,"name":"_inject","nodeType":"Function","startLoc":1804,"text":"def _inject(self, namespace=None):\n        \"\"\"\n        Injects the unit, and all of its aliases, in the given\n        namespace dictionary.\n        \"\"\"\n        if namespace is None:\n            return\n\n        # Loop through all of the names first, to ensure all of them\n        # are new, then add them all as a single \"transaction\" below.\n        for name in self._names:\n            if name in namespace and self != namespace[name]:\n                raise ValueError(\n                    \"Object with name {!r} already exists in \"\n                    \"given namespace ({!r}).\".format(\n                        name, namespace[name]))\n\n        for name in self._names:\n            namespace[name] = self"},{"col":0,"comment":"Returns `True` if the given object is iterable.","endLoc":53,"header":"def isiterable(obj)","id":600,"name":"isiterable","nodeType":"Function","startLoc":46,"text":"def isiterable(obj):\n    \"\"\"Returns `True` if the given object is iterable.\"\"\"\n\n    try:\n        iter(obj)\n        return True\n    except TypeError:\n        return False"},{"col":0,"comment":"\n    Determines the module/package from which this function is called.\n\n    This function has two modes, determined by the ``finddiff`` option. it\n    will either simply go the requested number of frames up the call\n    stack (if ``finddiff`` is False), or it will go up the call stack until\n    it reaches a module that is *not* in a specified set.\n\n    Parameters\n    ----------\n    depth : int\n        Specifies how far back to go in the call stack (0-indexed, so that\n        passing in 0 gives back `astropy.utils.misc`).\n    finddiff : bool or list\n        If False, the returned ``mod`` will just be ``depth`` frames up from\n        the current frame. Otherwise, the function will start at a frame\n        ``depth`` up from current, and continue up the call stack to the\n        first module that is *different* from those in the provided list.\n        In this case, ``finddiff`` can be a list of modules or modules\n        names. Alternatively, it can be True, which will use the module\n        ``depth`` call stack frames up as the module the returned module\n        most be different from.\n\n    Returns\n    -------\n    mod : module or None\n        The module object or None if the package cannot be found. The name of\n        the module is available as the ``__name__`` attribute of the returned\n        object (if it isn't None).\n\n    Raises\n    ------\n    ValueError\n        If ``finddiff`` is a list with an invalid entry.\n\n    Examples\n    --------\n    The examples below assume that there are two modules in a package named\n    ``pkg``. ``mod1.py``::\n\n        def find1():\n            from astropy.utils import find_current_module\n            print find_current_module(1).__name__\n        def find2():\n            from astropy.utils import find_current_module\n            cmod = find_current_module(2)\n            if cmod is None:\n                print 'None'\n            else:\n                print cmod.__name__\n        def find_diff():\n            from astropy.utils import find_current_module\n            print find_current_module(0,True).__name__\n\n    ``mod2.py``::\n\n        def find():\n            from .mod1 import find2\n            find2()\n\n    With these modules in place, the following occurs::\n\n        >>> from pkg import mod1, mod2\n        >>> from astropy.utils import find_current_module\n        >>> mod1.find1()\n        pkg.mod1\n        >>> mod1.find2()\n        None\n        >>> mod2.find()\n        pkg.mod2\n        >>> find_current_module(0)\n        <module 'astropy.utils.misc' from 'astropy/utils/misc.py'>\n        >>> mod1.find_diff()\n        pkg.mod1\n\n    ","endLoc":279,"header":"def find_current_module(depth=1, finddiff=False)","id":601,"name":"find_current_module","nodeType":"Function","startLoc":172,"text":"def find_current_module(depth=1, finddiff=False):\n    \"\"\"\n    Determines the module/package from which this function is called.\n\n    This function has two modes, determined by the ``finddiff`` option. it\n    will either simply go the requested number of frames up the call\n    stack (if ``finddiff`` is False), or it will go up the call stack until\n    it reaches a module that is *not* in a specified set.\n\n    Parameters\n    ----------\n    depth : int\n        Specifies how far back to go in the call stack (0-indexed, so that\n        passing in 0 gives back `astropy.utils.misc`).\n    finddiff : bool or list\n        If False, the returned ``mod`` will just be ``depth`` frames up from\n        the current frame. Otherwise, the function will start at a frame\n        ``depth`` up from current, and continue up the call stack to the\n        first module that is *different* from those in the provided list.\n        In this case, ``finddiff`` can be a list of modules or modules\n        names. Alternatively, it can be True, which will use the module\n        ``depth`` call stack frames up as the module the returned module\n        most be different from.\n\n    Returns\n    -------\n    mod : module or None\n        The module object or None if the package cannot be found. The name of\n        the module is available as the ``__name__`` attribute of the returned\n        object (if it isn't None).\n\n    Raises\n    ------\n    ValueError\n        If ``finddiff`` is a list with an invalid entry.\n\n    Examples\n    --------\n    The examples below assume that there are two modules in a package named\n    ``pkg``. ``mod1.py``::\n\n        def find1():\n            from astropy.utils import find_current_module\n            print find_current_module(1).__name__\n        def find2():\n            from astropy.utils import find_current_module\n            cmod = find_current_module(2)\n            if cmod is None:\n                print 'None'\n            else:\n                print cmod.__name__\n        def find_diff():\n            from astropy.utils import find_current_module\n            print find_current_module(0,True).__name__\n\n    ``mod2.py``::\n\n        def find():\n            from .mod1 import find2\n            find2()\n\n    With these modules in place, the following occurs::\n\n        >>> from pkg import mod1, mod2\n        >>> from astropy.utils import find_current_module\n        >>> mod1.find1()\n        pkg.mod1\n        >>> mod1.find2()\n        None\n        >>> mod2.find()\n        pkg.mod2\n        >>> find_current_module(0)\n        <module 'astropy.utils.misc' from 'astropy/utils/misc.py'>\n        >>> mod1.find_diff()\n        pkg.mod1\n\n    \"\"\"\n\n    frm = inspect.currentframe()\n    for i in range(depth):\n        frm = frm.f_back\n        if frm is None:\n            return None\n\n    if finddiff:\n        currmod = _get_module_from_frame(frm)\n        if finddiff is True:\n            diffmods = [currmod]\n        else:\n            diffmods = []\n            for fd in finddiff:\n                if inspect.ismodule(fd):\n                    diffmods.append(fd)\n                elif isinstance(fd, str):\n                    diffmods.append(importlib.import_module(fd))\n                elif fd is True:\n                    diffmods.append(currmod)\n                else:\n                    raise ValueError('invalid entry in finddiff')\n\n        while frm:\n            frmb = frm.f_back\n            modb = _get_module_from_frame(frmb)\n            if modb not in diffmods:\n                return modb\n            frm = frmb\n    else:\n        return _get_module_from_frame(frm)"},{"col":4,"comment":"\n        Reads `SIP`_ header keywords and returns a `~astropy.wcs.Sip`\n        object.\n\n        If no `SIP`_ header keywords are found, ``None`` is returned.\n        ","endLoc":1187,"header":"def _read_sip_kw(self, header, wcskey=\"\")","id":602,"name":"_read_sip_kw","nodeType":"Function","startLoc":1070,"text":"def _read_sip_kw(self, header, wcskey=\"\"):\n        \"\"\"\n        Reads `SIP`_ header keywords and returns a `~astropy.wcs.Sip`\n        object.\n\n        If no `SIP`_ header keywords are found, ``None`` is returned.\n        \"\"\"\n        if isinstance(header, (str, bytes)):\n            # TODO: Parse SIP from a string without pyfits around\n            return None\n\n        if \"A_ORDER\" in header and header['A_ORDER'] > 1:\n            if \"B_ORDER\" not in header:\n                raise ValueError(\n                    \"A_ORDER provided without corresponding B_ORDER \"\n                    \"keyword for SIP distortion\")\n\n            m = int(header[\"A_ORDER\"])\n            a = np.zeros((m + 1, m + 1), np.double)\n            for i in range(m + 1):\n                for j in range(m - i + 1):\n                    key = f\"A_{i}_{j}\"\n                    if key in header:\n                        a[i, j] = header[key]\n                        del header[key]\n\n            m = int(header[\"B_ORDER\"])\n            if m > 1:\n                b = np.zeros((m + 1, m + 1), np.double)\n                for i in range(m + 1):\n                    for j in range(m - i + 1):\n                        key = f\"B_{i}_{j}\"\n                        if key in header:\n                            b[i, j] = header[key]\n                            del header[key]\n            else:\n                a = None\n                b = None\n\n            del header['A_ORDER']\n            del header['B_ORDER']\n\n            ctype = [header[f'CTYPE{nax}{wcskey}'] for nax in range(1, self.naxis + 1)]\n            if any(not ctyp.endswith('-SIP') for ctyp in ctype):\n                message = \"\"\"\n                Inconsistent SIP distortion information is present in the FITS header and the WCS object:\n                SIP coefficients were detected, but CTYPE is missing a \"-SIP\" suffix.\n                astropy.wcs is using the SIP distortion coefficients,\n                therefore the coordinates calculated here might be incorrect.\n\n                If you do not want to apply the SIP distortion coefficients,\n                please remove the SIP coefficients from the FITS header or the\n                WCS object.  As an example, if the image is already distortion-corrected\n                (e.g., drizzled) then distortion components should not apply and the SIP\n                coefficients should be removed.\n\n                While the SIP distortion coefficients are being applied here, if that was indeed the intent,\n                for consistency please append \"-SIP\" to the CTYPE in the FITS header or the WCS object.\n\n                \"\"\"  # noqa: E501\n                log.info(message)\n        elif \"B_ORDER\" in header and header['B_ORDER'] > 1:\n            raise ValueError(\n                \"B_ORDER provided without corresponding A_ORDER \" +\n                \"keyword for SIP distortion\")\n        else:\n            a = None\n            b = None\n\n        if \"AP_ORDER\" in header and header['AP_ORDER'] > 1:\n            if \"BP_ORDER\" not in header:\n                raise ValueError(\n                    \"AP_ORDER provided without corresponding BP_ORDER \"\n                    \"keyword for SIP distortion\")\n\n            m = int(header[\"AP_ORDER\"])\n            ap = np.zeros((m + 1, m + 1), np.double)\n            for i in range(m + 1):\n                for j in range(m - i + 1):\n                    key = f\"AP_{i}_{j}\"\n                    if key in header:\n                        ap[i, j] = header[key]\n                        del header[key]\n\n            m = int(header[\"BP_ORDER\"])\n            if m > 1:\n                bp = np.zeros((m + 1, m + 1), np.double)\n                for i in range(m + 1):\n                    for j in range(m - i + 1):\n                        key = f\"BP_{i}_{j}\"\n                        if key in header:\n                            bp[i, j] = header[key]\n                            del header[key]\n            else:\n                ap = None\n                bp = None\n\n            del header['AP_ORDER']\n            del header['BP_ORDER']\n        elif \"BP_ORDER\" in header and header['BP_ORDER'] > 1:\n            raise ValueError(\n                \"BP_ORDER provided without corresponding AP_ORDER \"\n                \"keyword for SIP distortion\")\n        else:\n            ap = None\n            bp = None\n\n        if a is None and b is None and ap is None and bp is None:\n            return None\n\n        if f\"CRPIX1{wcskey}\" not in header or f\"CRPIX2{wcskey}\" not in header:\n            raise ValueError(\n                \"Header has SIP keywords without CRPIX keywords\")\n\n        crpix1 = header.get(f\"CRPIX1{wcskey}\")\n        crpix2 = header.get(f\"CRPIX2{wcskey}\")\n\n        return Sip(a, b, ap, bp, (crpix1, crpix2))"},{"attributeType":"null","col":7,"comment":"null","endLoc":35,"id":603,"name":"minor","nodeType":"Attribute","startLoc":35,"text":"minor"},{"attributeType":"null","col":14,"comment":"null","endLoc":35,"id":604,"name":"bugfix","nodeType":"Attribute","startLoc":35,"text":"bugfix"},{"col":0,"comment":"Uses inspect.getmodule() to get the module that the current frame's\n    code is running in.\n\n    However, this does not work reliably for code imported from a zip file,\n    so this provides a fallback mechanism for that case which is less\n    reliable in general, but more reliable than inspect.getmodule() for this\n    particular case.\n    ","endLoc":322,"header":"def _get_module_from_frame(frm)","id":605,"name":"_get_module_from_frame","nodeType":"Function","startLoc":282,"text":"def _get_module_from_frame(frm):\n    \"\"\"Uses inspect.getmodule() to get the module that the current frame's\n    code is running in.\n\n    However, this does not work reliably for code imported from a zip file,\n    so this provides a fallback mechanism for that case which is less\n    reliable in general, but more reliable than inspect.getmodule() for this\n    particular case.\n    \"\"\"\n\n    mod = inspect.getmodule(frm)\n    if mod is not None:\n        return mod\n\n    # Check to see if we're importing from a bundle file. First ensure that\n    # __file__ is available in globals; this is cheap to check to bail out\n    # immediately if this fails\n\n    if '__file__' in frm.f_globals and '__name__' in frm.f_globals:\n\n        filename = frm.f_globals['__file__']\n\n        # Using __file__ from the frame's globals and getting it into the form\n        # of an absolute path name with .py at the end works pretty well for\n        # looking up the module using the same means as inspect.getmodule\n\n        if filename[-4:].lower() in ('.pyc', '.pyo'):\n            filename = filename[:-4] + '.py'\n        filename = os.path.realpath(os.path.abspath(filename))\n        if filename in inspect.modulesbyfile:\n            return sys.modules.get(inspect.modulesbyfile[filename])\n\n        # On Windows, inspect.modulesbyfile appears to have filenames stored\n        # in lowercase, so we check for this case too.\n        if filename.lower() in inspect.modulesbyfile:\n            return sys.modules.get(inspect.modulesbyfile[filename.lower()])\n\n    # Otherwise there are still some even trickier things that might be possible\n    # to track down the module, but we'll leave those out unless we find a case\n    # where it's really necessary.  So return None if the module is not found.\n    return None"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":606,"name":"release","nodeType":"Attribute","startLoc":39,"text":"release"},{"col":0,"comment":"","endLoc":16,"header":"version.py#<anonymous>","id":607,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"try:\n    try:\n        from ._dev.scm_version import version\n    except ImportError:\n        from ._version import version\nexcept Exception:\n    import warnings\n    warnings.warn(\n        f'could not determine {__name__.split(\".\")[0]} package version; '\n        f'this indicates a broken installation')\n    del warnings\n\n    version = '0.0.0'\n\nmajor, minor, bugfix = split_version(version)\n\ndel split_version  # clean up namespace.\n\nrelease = 'dev' not in version"},{"fileName":"__init__.py","filePath":"astropy","id":608,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nAstropy is a package intended to contain core functionality and some\ncommon tools needed for performing astronomy and astrophysics research with\nPython. It also provides an index for other astronomy packages and tools for\nmanaging them.\n\"\"\"\n\nimport os\nimport sys\n\nfrom .version import version as __version__\n\n\ndef _is_astropy_source(path=None):\n    \"\"\"\n    Returns whether the source for this module is directly in an astropy\n    source distribution or checkout.\n    \"\"\"\n\n    # If this __init__.py file is in ./astropy/ then import is within a source\n    # dir .astropy-root is a file distributed with the source, but that should\n    # not installed\n    if path is None:\n        path = os.path.join(os.path.dirname(__file__), os.pardir)\n    elif os.path.isfile(path):\n        path = os.path.dirname(path)\n\n    source_dir = os.path.abspath(path)\n    return os.path.exists(os.path.join(source_dir, '.astropy-root'))\n\n\n# The location of the online documentation for astropy\n# This location will normally point to the current released version of astropy\nif 'dev' in __version__:\n    online_docs_root = 'https://docs.astropy.org/en/latest/'\nelse:\n    online_docs_root = f'https://docs.astropy.org/en/{__version__}/'\n\n\nfrom . import config as _config  # noqa: E402\n\n\nclass Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy`.\n    \"\"\"\n\n    unicode_output = _config.ConfigItem(\n        False,\n        'When True, use Unicode characters when outputting values, and '\n        'displaying widgets at the console.')\n    use_color = _config.ConfigItem(\n        sys.platform != 'win32',\n        'When True, use ANSI color escape sequences when writing to the console.',\n        aliases=['astropy.utils.console.USE_COLOR', 'astropy.logger.USE_COLOR'])\n    max_lines = _config.ConfigItem(\n        None,\n        description='Maximum number of lines in the display of pretty-printed '\n        'objects. If not provided, try to determine automatically from the '\n        'terminal size.  Negative numbers mean no limit.',\n        cfgtype='integer(default=None)',\n        aliases=['astropy.table.pprint.max_lines'])\n    max_width = _config.ConfigItem(\n        None,\n        description='Maximum number of characters per line in the display of '\n        'pretty-printed objects.  If not provided, try to determine '\n        'automatically from the terminal size. Negative numbers mean no '\n        'limit.',\n        cfgtype='integer(default=None)',\n        aliases=['astropy.table.pprint.max_width'])\n\n\nconf = Conf()\n\n\n# Define a base ScienceState for configuring constants and units\nfrom .utils.state import ScienceState  # noqa: E402\n\n\nclass base_constants_version(ScienceState):\n    \"\"\"\n    Base class for the real version-setters below\n    \"\"\"\n    _value = 'test'\n\n    _versions = dict(test='test')\n\n    @classmethod\n    def validate(cls, value):\n        if value not in cls._versions:\n            raise ValueError(f'Must be one of {list(cls._versions.keys())}')\n        return cls._versions[value]\n\n    @classmethod\n    def set(cls, value):\n        \"\"\"\n        Set the current constants value.\n        \"\"\"\n        import sys\n        if 'astropy.units' in sys.modules:\n            raise RuntimeError('astropy.units is already imported')\n        if 'astropy.constants' in sys.modules:\n            raise RuntimeError('astropy.constants is already imported')\n\n        return super().set(value)\n\n\nclass physical_constants(base_constants_version):\n    \"\"\"\n    The version of physical constants to use\n    \"\"\"\n    # Maintainers: update when new constants are added\n    _value = 'codata2018'\n\n    _versions = dict(codata2018='codata2018', codata2014='codata2014',\n                     codata2010='codata2010', astropyconst40='codata2018',\n                     astropyconst20='codata2014', astropyconst13='codata2010')\n\n\nclass astronomical_constants(base_constants_version):\n    \"\"\"\n    The version of astronomical constants to use\n    \"\"\"\n    # Maintainers: update when new constants are added\n    _value = 'iau2015'\n\n    _versions = dict(iau2015='iau2015', iau2012='iau2012',\n                     astropyconst40='iau2015', astropyconst20='iau2015',\n                     astropyconst13='iau2012')\n\n\n# Create the test() function\nfrom .tests.runner import TestRunner  # noqa: E402\n\ntest = TestRunner.make_test_runner_in(__path__[0])  # noqa: F821\n\n\n# if we are *not* in setup mode, import the logger and possibly populate the\n# configuration file with the defaults\ndef _initialize_astropy():\n    try:\n        from .utils import _compiler  # noqa: F401\n    except ImportError:\n        if _is_astropy_source():\n            raise ImportError('You appear to be trying to import astropy from '\n                              'within a source checkout or from an editable '\n                              'installation without building the extension '\n                              'modules first. Either run:\\n\\n'\n                              '  pip install -e .\\n\\nor\\n\\n'\n                              '  python setup.py build_ext --inplace\\n\\n'\n                              'to make sure the extension modules are built ')\n        else:\n            # Outright broken installation, just raise standard error\n            raise\n\n\n# Set the bibtex entry to the article referenced in CITATION.\ndef _get_bibtex():\n    citation_file = os.path.join(os.path.dirname(__file__), 'CITATION')\n\n    with open(citation_file, 'r') as citation:\n        refs = citation.read().split('@ARTICLE')[1:]\n        if len(refs) == 0:\n            return ''\n        bibtexreference = f'@ARTICLE{refs[0]}'\n    return bibtexreference\n\n\n__citation__ = __bibtex__ = _get_bibtex()\n\nfrom .logger import _init_log, _teardown_log  # noqa: E402, F401\n\nlog = _init_log()\n\n_initialize_astropy()\n\nfrom .utils.misc import find_api_page  # noqa: E402, F401\n\n\ndef online_help(query):\n    \"\"\"\n    Search the online Astropy documentation for the given query.\n    Opens the results in the default web browser.  Requires an active\n    Internet connection.\n\n    Parameters\n    ----------\n    query : str\n        The search query.\n    \"\"\"\n    import webbrowser\n    from urllib.parse import urlencode\n\n    version = __version__\n    if 'dev' in version:\n        version = 'latest'\n    else:\n        version = 'v' + version\n\n    url = f\"https://docs.astropy.org/en/{version}/search.html?{urlencode({'q': query})}\"\n    webbrowser.open(url)\n\n\n__dir_inc__ = ['__version__', '__githash__',\n               '__bibtex__', 'test', 'log', 'find_api_page', 'online_help',\n               'online_docs_root', 'conf', 'physical_constants',\n               'astronomical_constants']\n\n\nfrom types import ModuleType as __module_type__  # noqa: E402\n\n# Clean up top-level namespace--delete everything that isn't in __dir_inc__\n# or is a magic attribute, and that isn't a submodule of this package\nfor varname in dir():\n    if not ((varname.startswith('__') and varname.endswith('__')) or\n            varname in __dir_inc__ or\n            (varname[0] != '_' and\n                isinstance(locals()[varname], __module_type__) and\n                locals()[varname].__name__.startswith(__name__ + '.'))):\n        # The last clause in the the above disjunction deserves explanation:\n        # When using relative imports like ``from .. import config``, the\n        # ``config`` variable is automatically created in the namespace of\n        # whatever module ``..`` resolves to (in this case astropy).  This\n        # happens a few times just in the module setup above.  This allows\n        # the cleanup to keep any public submodules of the astropy package\n        del locals()[varname]\n\ndel varname, __module_type__\n"},{"col":4,"comment":"null","endLoc":181,"header":"def __new__(cls, units, names=None)","id":609,"name":"__new__","nodeType":"Function","startLoc":123,"text":"def __new__(cls, units, names=None):\n        dtype = None\n        if names is not None:\n            if isinstance(names, StructuredUnit):\n                dtype = names._units.dtype\n                names = names.field_names\n            elif isinstance(names, np.dtype):\n                if not names.fields:\n                    raise ValueError('dtype should be structured, with fields.')\n                dtype = np.dtype([(name, DTYPE_OBJECT) for name in names.names])\n                names = _names_from_dtype(names)\n            else:\n                if not isinstance(names, tuple):\n                    names = (names,)\n                names = _normalize_names(names)\n\n        if not isinstance(units, tuple):\n            units = Unit(units)\n            if isinstance(units, StructuredUnit):\n                # Avoid constructing a new StructuredUnit if no field names\n                # are given, or if all field names are the same already anyway.\n                if names is None or units.field_names == names:\n                    return units\n\n                # Otherwise, turn (the upper level) into a tuple, for renaming.\n                units = units.values()\n            else:\n                # Single regular unit: make a tuple for iteration below.\n                units = (units,)\n\n        if names is None:\n            names = tuple(f'f{i}' for i in range(len(units)))\n\n        elif len(units) != len(names):\n            raise ValueError(\"lengths of units and field names must match.\")\n\n        converted = []\n        for unit, name in zip(units, names):\n            if isinstance(name, list):\n                # For list, the first item is the name of our level,\n                # and the second another tuple of names, i.e., we recurse.\n                unit = cls(unit, name[1])\n                name = name[0]\n            else:\n                # We are at the lowest level.  Check unit.\n                unit = Unit(unit)\n                if dtype is not None and isinstance(unit, StructuredUnit):\n                    raise ValueError(\"units do not match in depth with field \"\n                                     \"names from dtype or structured unit.\")\n\n            converted.append(unit)\n\n        self = super().__new__(cls)\n        if dtype is None:\n            dtype = np.dtype([((name[0] if isinstance(name, list) else name),\n                               DTYPE_OBJECT) for name in names])\n        # Decay array to void so we can access by field name and number.\n        self._units = np.array(tuple(converted), dtype)[()]\n        return self"},{"className":"ScienceState","col":0,"comment":"\n    Science state subclasses are used to manage global items that can\n    affect science results.  Subclasses will generally override\n    `validate` to convert from any of the acceptable inputs (such as\n    strings) to the appropriate internal objects, and set an initial\n    value to the ``_value`` member so it has a default.\n\n    Examples\n    --------\n\n    ::\n\n        class MyState(ScienceState):\n            @classmethod\n            def validate(cls, value):\n                if value not in ('A', 'B', 'C'):\n                    raise ValueError(\"Must be one of A, B, C\")\n                return value\n    ","endLoc":77,"id":610,"nodeType":"Class","startLoc":10,"text":"class ScienceState:\n    \"\"\"\n    Science state subclasses are used to manage global items that can\n    affect science results.  Subclasses will generally override\n    `validate` to convert from any of the acceptable inputs (such as\n    strings) to the appropriate internal objects, and set an initial\n    value to the ``_value`` member so it has a default.\n\n    Examples\n    --------\n\n    ::\n\n        class MyState(ScienceState):\n            @classmethod\n            def validate(cls, value):\n                if value not in ('A', 'B', 'C'):\n                    raise ValueError(\"Must be one of A, B, C\")\n                return value\n    \"\"\"\n\n    def __init__(self):\n        raise RuntimeError(\n            \"This class is a singleton.  Do not instantiate.\")\n\n    @classmethod\n    def get(cls):\n        \"\"\"\n        Get the current science state value.\n        \"\"\"\n        return cls.validate(cls._value)\n\n    @classmethod\n    def set(cls, value):\n        \"\"\"\n        Set the current science state value.\n        \"\"\"\n        class _Context:\n            def __init__(self, parent, value):\n                self._value = value\n                self._parent = parent\n\n            def __enter__(self):\n                pass\n\n            def __exit__(self, type, value, tb):\n                self._parent._value = self._value\n\n            def __repr__(self):\n                # Ensure we have a single-line repr, just in case our\n                # value is not something simple like a string.\n                value_repr, lb, _ = repr(self._parent._value).partition('\\n')\n                if lb:\n                    value_repr += '...'\n                return (f'<ScienceState {self._parent.__name__}: {value_repr}>')\n\n        ctx = _Context(cls, cls._value)\n        value = cls.validate(value)\n        cls._value = value\n        return ctx\n\n    @classmethod\n    def validate(cls, value):\n        \"\"\"\n        Validate the value and convert it to its native type, if\n        necessary.\n        \"\"\"\n        return value"},{"className":"AstropyWarning","col":0,"comment":"\n    The base warning class from which all Astropy warnings should inherit.\n\n    Any warning inheriting from this class is handled by the Astropy logger.\n    ","endLoc":29,"id":611,"nodeType":"Class","startLoc":24,"text":"class AstropyWarning(Warning):\n    \"\"\"\n    The base warning class from which all Astropy warnings should inherit.\n\n    Any warning inheriting from this class is handled by the Astropy logger.\n    \"\"\""},{"className":"AstropyUserWarning","col":0,"comment":"\n    The primary warning class for Astropy.\n\n    Use this if you do not need a specific sub-class.\n    ","endLoc":37,"id":612,"nodeType":"Class","startLoc":32,"text":"class AstropyUserWarning(UserWarning, AstropyWarning):\n    \"\"\"\n    The primary warning class for Astropy.\n\n    Use this if you do not need a specific sub-class.\n    \"\"\""},{"col":4,"comment":"null","endLoc":33,"header":"def __init__(self)","id":613,"name":"__init__","nodeType":"Function","startLoc":31,"text":"def __init__(self):\n        raise RuntimeError(\n            \"This class is a singleton.  Do not instantiate.\")"},{"className":"LoggingError","col":0,"comment":"\n    This exception is for various errors that occur in the astropy logger,\n    typically when activating or deactivating logger-related features.\n    ","endLoc":42,"id":614,"nodeType":"Class","startLoc":38,"text":"class LoggingError(Exception):\n    \"\"\"\n    This exception is for various errors that occur in the astropy logger,\n    typically when activating or deactivating logger-related features.\n    \"\"\""},{"col":4,"comment":"\n        Get the current science state value.\n        ","endLoc":40,"header":"@classmethod\n    def get(cls)","id":615,"name":"get","nodeType":"Function","startLoc":35,"text":"@classmethod\n    def get(cls):\n        \"\"\"\n        Get the current science state value.\n        \"\"\"\n        return cls.validate(cls._value)"},{"className":"_AstLogIPYExc","col":0,"comment":"\n    An exception that is used only as a placeholder to indicate to the\n    IPython exception-catching mechanism that the astropy\n    exception-capturing is activated. It should not actually be used as\n    an exception anywhere.\n    ","endLoc":51,"id":616,"nodeType":"Class","startLoc":45,"text":"class _AstLogIPYExc(Exception):\n    \"\"\"\n    An exception that is used only as a placeholder to indicate to the\n    IPython exception-catching mechanism that the astropy\n    exception-capturing is activated. It should not actually be used as\n    an exception anywhere.\n    \"\"\""},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.logger`.\n    ","endLoc":91,"id":617,"nodeType":"Class","startLoc":54,"text":"class Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.logger`.\n    \"\"\"\n    log_level = _config.ConfigItem(\n        'INFO',\n        \"Threshold for the logging messages. Logging \"\n        \"messages that are less severe than this level \"\n        \"will be ignored. The levels are ``'DEBUG'``, \"\n        \"``'INFO'``, ``'WARNING'``, ``'ERROR'``.\")\n    log_warnings = _config.ConfigItem(\n        True,\n        \"Whether to log `warnings.warn` calls.\")\n    log_exceptions = _config.ConfigItem(\n        False,\n        \"Whether to log exceptions before raising \"\n        \"them.\")\n    log_to_file = _config.ConfigItem(\n        False,\n        \"Whether to always log messages to a log \"\n        \"file.\")\n    log_file_path = _config.ConfigItem(\n        '',\n        \"The file to log messages to.  If empty string is given, \"\n        \"it defaults to a file ``'astropy.log'`` in \"\n        \"the astropy config directory.\")\n    log_file_level = _config.ConfigItem(\n        'INFO',\n        \"Threshold for logging messages to \"\n        \"`log_file_path`.\")\n    log_file_format = _config.ConfigItem(\n        \"%(asctime)r, \"\n        \"%(origin)r, %(levelname)r, %(message)r\",\n        \"Format for log file entries.\")\n    log_file_encoding = _config.ConfigItem(\n        '',\n        \"The encoding (e.g., UTF-8) to use for the log file.  If empty string \"\n        \"is given, it defaults to the platform-preferred encoding.\")"},{"col":4,"comment":"\n        Validate the value and convert it to its native type, if\n        necessary.\n        ","endLoc":77,"header":"@classmethod\n    def validate(cls, value)","id":618,"name":"validate","nodeType":"Function","startLoc":71,"text":"@classmethod\n    def validate(cls, value):\n        \"\"\"\n        Validate the value and convert it to its native type, if\n        necessary.\n        \"\"\"\n        return value"},{"col":4,"comment":"\n        Set the current science state value.\n        ","endLoc":69,"header":"@classmethod\n    def set(cls, value)","id":619,"name":"set","nodeType":"Function","startLoc":42,"text":"@classmethod\n    def set(cls, value):\n        \"\"\"\n        Set the current science state value.\n        \"\"\"\n        class _Context:\n            def __init__(self, parent, value):\n                self._value = value\n                self._parent = parent\n\n            def __enter__(self):\n                pass\n\n            def __exit__(self, type, value, tb):\n                self._parent._value = self._value\n\n            def __repr__(self):\n                # Ensure we have a single-line repr, just in case our\n                # value is not something simple like a string.\n                value_repr, lb, _ = repr(self._parent._value).partition('\\n')\n                if lb:\n                    value_repr += '...'\n                return (f'<ScienceState {self._parent.__name__}: {value_repr}>')\n\n        ctx = _Context(cls, cls._value)\n        value = cls.validate(value)\n        cls._value = value\n        return ctx"},{"className":"ConfigNamespace","col":0,"comment":"\n    A namespace of configuration items.  Each subpackage with\n    configuration items should define a subclass of this class,\n    containing `ConfigItem` instances as members.\n\n    For example::\n\n        class Conf(_config.ConfigNamespace):\n            unicode_output = _config.ConfigItem(\n                False,\n                'Use Unicode characters when outputting values, ...')\n            use_color = _config.ConfigItem(\n                sys.platform != 'win32',\n                'When True, use ANSI color escape sequences when ...',\n                aliases=['astropy.utils.console.USE_COLOR'])\n        conf = Conf()\n    ","endLoc":182,"id":620,"nodeType":"Class","startLoc":84,"text":"class ConfigNamespace(metaclass=_ConfigNamespaceMeta):\n    \"\"\"\n    A namespace of configuration items.  Each subpackage with\n    configuration items should define a subclass of this class,\n    containing `ConfigItem` instances as members.\n\n    For example::\n\n        class Conf(_config.ConfigNamespace):\n            unicode_output = _config.ConfigItem(\n                False,\n                'Use Unicode characters when outputting values, ...')\n            use_color = _config.ConfigItem(\n                sys.platform != 'win32',\n                'When True, use ANSI color escape sequences when ...',\n                aliases=['astropy.utils.console.USE_COLOR'])\n        conf = Conf()\n    \"\"\"\n    def __iter__(self):\n        for key, val in self.__class__.__dict__.items():\n            if isinstance(val, ConfigItem):\n                yield key\n\n    keys = __iter__\n    \"\"\"Iterate over configuration item names.\"\"\"\n\n    def values(self):\n        \"\"\"Iterate over configuration item values.\"\"\"\n        for val in self.__class__.__dict__.values():\n            if isinstance(val, ConfigItem):\n                yield val\n\n    def items(self):\n        \"\"\"Iterate over configuration item ``(name, value)`` pairs.\"\"\"\n        for key, val in self.__class__.__dict__.items():\n            if isinstance(val, ConfigItem):\n                yield key, val\n\n    def set_temp(self, attr, value):\n        \"\"\"\n        Temporarily set a configuration value.\n\n        Parameters\n        ----------\n        attr : str\n            Configuration item name\n\n        value : object\n            The value to set temporarily.\n\n        Examples\n        --------\n        >>> import astropy\n        >>> with astropy.conf.set_temp('use_color', False):\n        ...     pass\n        ...     # console output will not contain color\n        >>> # console output contains color again...\n        \"\"\"\n        if hasattr(self, attr):\n            return self.__class__.__dict__[attr].set_temp(value)\n        raise AttributeError(f\"No configuration parameter '{attr}'\")\n\n    def reload(self, attr=None):\n        \"\"\"\n        Reload a configuration item from the configuration file.\n\n        Parameters\n        ----------\n        attr : str, optional\n            The name of the configuration parameter to reload.  If not\n            provided, reload all configuration parameters.\n        \"\"\"\n        if attr is not None:\n            if hasattr(self, attr):\n                return self.__class__.__dict__[attr].reload()\n            raise AttributeError(f\"No configuration parameter '{attr}'\")\n\n        for item in self.values():\n            item.reload()\n\n    def reset(self, attr=None):\n        \"\"\"\n        Reset a configuration item to its default.\n\n        Parameters\n        ----------\n        attr : str, optional\n            The name of the configuration parameter to reload.  If not\n            provided, reset all configuration parameters.\n        \"\"\"\n        if attr is not None:\n            if hasattr(self, attr):\n                prop = self.__class__.__dict__[attr]\n                prop.set(prop.defaultvalue)\n                return\n            raise AttributeError(f\"No configuration parameter '{attr}'\")\n\n        for item in self.values():\n            item.set(item.defaultvalue)"},{"attributeType":"null","col":8,"comment":"null","endLoc":68,"id":622,"name":"_value","nodeType":"Attribute","startLoc":68,"text":"cls._value"},{"className":"TestRunner","col":0,"comment":"\n    A test runner for astropy tests\n    ","endLoc":604,"id":623,"nodeType":"Class","startLoc":278,"text":"class TestRunner(TestRunnerBase):\n    \"\"\"\n    A test runner for astropy tests\n    \"\"\"\n\n    def packages_path(self, packages, base_path, error=None, warning=None):\n        \"\"\"\n        Generates the path for multiple packages.\n\n        Parameters\n        ----------\n        packages : str\n            Comma separated string of packages.\n        base_path : str\n            Base path to the source code or documentation.\n        error : str\n            Error message to be raised as ``ValueError``. Individual package\n            name and path can be accessed by ``{name}`` and ``{path}``\n            respectively. No error is raised if `None`. (Default: `None`)\n        warning : str\n            Warning message to be issued. Individual package\n            name and path can be accessed by ``{name}`` and ``{path}``\n            respectively. No warning is issues if `None`. (Default: `None`)\n\n        Returns\n        -------\n        paths : list of str\n            List of strings of existing package paths.\n        \"\"\"\n        packages = packages.split(\",\")\n\n        paths = []\n        for package in packages:\n            path = os.path.join(\n                base_path, package.replace('.', os.path.sep))\n            if not os.path.isdir(path):\n                info = {'name': package, 'path': path}\n                if error is not None:\n                    raise ValueError(error.format(**info))\n                if warning is not None:\n                    warnings.warn(warning.format(**info))\n            else:\n                paths.append(path)\n\n        return paths\n\n    # Increase priority so this warning is displayed first.\n    @keyword(priority=1000)\n    def coverage(self, coverage, kwargs):\n        if coverage:\n            warnings.warn(\n                \"The coverage option is ignored on run_tests, since it \"\n                \"can not be made to work in that context.  Use \"\n                \"'python setup.py test --coverage' instead.\",\n                AstropyWarning)\n\n        return []\n\n    # test_path depends on self.package_path so make sure this runs before\n    # test_path.\n    @keyword(priority=1)\n    def package(self, package, kwargs):\n        \"\"\"\n        package : str, optional\n            The name of a specific package to test, e.g. 'io.fits' or\n            'utils'. Accepts comma separated string to specify multiple\n            packages. If nothing is specified all default tests are run.\n        \"\"\"\n        if package is None:\n            self.package_path = [self.base_path]\n        else:\n            error_message = ('package to test is not found: {name} '\n                             '(at path {path}).')\n            self.package_path = self.packages_path(package, self.base_path,\n                                                   error=error_message)\n\n        if not kwargs['test_path']:\n            return self.package_path\n\n        return []\n\n    @keyword()\n    def test_path(self, test_path, kwargs):\n        \"\"\"\n        test_path : str, optional\n            Specify location to test by path. May be a single file or\n            directory. Must be specified absolutely or relative to the\n            calling directory.\n        \"\"\"\n        all_args = []\n        # Ensure that the package kwarg has been run.\n        self.package(kwargs['package'], kwargs)\n        if test_path:\n            base, ext = os.path.splitext(test_path)\n\n            if ext in ('.rst', ''):\n                if kwargs['docs_path'] is None:\n                    # This shouldn't happen from \"python setup.py test\"\n                    raise ValueError(\n                        \"Can not test .rst files without a docs_path \"\n                        \"specified.\")\n\n                abs_docs_path = os.path.abspath(kwargs['docs_path'])\n                abs_test_path = os.path.abspath(\n                    os.path.join(abs_docs_path, os.pardir, test_path))\n\n                common = os.path.commonprefix((abs_docs_path, abs_test_path))\n\n                if os.path.exists(abs_test_path) and common == abs_docs_path:\n                    # Turn on the doctest_rst plugin\n                    all_args.append('--doctest-rst')\n                    test_path = abs_test_path\n\n            # Check that the extensions are in the path and not at the end to\n            # support specifying the name of the test, i.e.\n            # test_quantity.py::test_unit\n            if not (os.path.isdir(test_path) or ('.py' in test_path or '.rst' in test_path)):\n                raise ValueError(\"Test path must be a directory or a path to \"\n                                 \"a .py or .rst file\")\n\n            return all_args + [test_path]\n\n        return []\n\n    @keyword()\n    def args(self, args, kwargs):\n        \"\"\"\n        args : str, optional\n            Additional arguments to be passed to ``pytest.main`` in the ``args``\n            keyword argument.\n        \"\"\"\n        if args:\n            return shlex.split(args, posix=not sys.platform.startswith('win'))\n\n        return []\n\n    @keyword(default_value=[])\n    def plugins(self, plugins, kwargs):\n        \"\"\"\n        plugins : list, optional\n            Plugins to be passed to ``pytest.main`` in the ``plugins`` keyword\n            argument.\n        \"\"\"\n        # Plugins are handled independently by `run_tests` so we define this\n        # keyword just for the docstring\n        return []\n\n    @keyword()\n    def verbose(self, verbose, kwargs):\n        \"\"\"\n        verbose : bool, optional\n            Convenience option to turn on verbose output from pytest. Passing\n            True is the same as specifying ``-v`` in ``args``.\n        \"\"\"\n        if verbose:\n            return ['-v']\n\n        return []\n\n    @keyword()\n    def pastebin(self, pastebin, kwargs):\n        \"\"\"\n        pastebin : ('failed', 'all', None), optional\n            Convenience option for turning on pytest pastebin output. Set to\n            'failed' to upload info for failed tests, or 'all' to upload info\n            for all tests.\n        \"\"\"\n        if pastebin is not None:\n            if pastebin in ['failed', 'all']:\n                return [f'--pastebin={pastebin}']\n            else:\n                raise ValueError(\"pastebin should be 'failed' or 'all'\")\n\n        return []\n\n    @keyword(default_value='none')\n    def remote_data(self, remote_data, kwargs):\n        \"\"\"\n        remote_data : {'none', 'astropy', 'any'}, optional\n            Controls whether to run tests marked with @pytest.mark.remote_data. This can be\n            set to run no tests with remote data (``none``), only ones that use\n            data from http://data.astropy.org (``astropy``), or all tests that\n            use remote data (``any``). The default is ``none``.\n        \"\"\"\n\n        if remote_data is True:\n            remote_data = 'any'\n        elif remote_data is False:\n            remote_data = 'none'\n        elif remote_data not in ('none', 'astropy', 'any'):\n            warnings.warn(\"The remote_data option should be one of \"\n                          \"none/astropy/any (found {}). For backward-compatibility, \"\n                          \"assuming 'any', but you should change the option to be \"\n                          \"one of the supported ones to avoid issues in \"\n                          \"future.\".format(remote_data),\n                          AstropyDeprecationWarning)\n            remote_data = 'any'\n\n        return [f'--remote-data={remote_data}']\n\n    @keyword()\n    def pep8(self, pep8, kwargs):\n        \"\"\"\n        pep8 : bool, optional\n            Turn on PEP8 checking via the pytest-pep8 plugin and disable normal\n            tests. Same as specifying ``--pep8 -k pep8`` in ``args``.\n        \"\"\"\n        if pep8:\n            try:\n                import pytest_pep8  # pylint: disable=W0611\n            except ImportError:\n                raise ImportError('PEP8 checking requires pytest-pep8 plugin: '\n                                  'https://pypi.org/project/pytest-pep8')\n            else:\n                return ['--pep8', '-k', 'pep8']\n\n        return []\n\n    @keyword()\n    def pdb(self, pdb, kwargs):\n        \"\"\"\n        pdb : bool, optional\n            Turn on PDB post-mortem analysis for failing tests. Same as\n            specifying ``--pdb`` in ``args``.\n        \"\"\"\n        if pdb:\n            return ['--pdb']\n        return []\n\n    @keyword()\n    def open_files(self, open_files, kwargs):\n        \"\"\"\n        open_files : bool, optional\n            Fail when any tests leave files open.  Off by default, because\n            this adds extra run time to the test suite.  Requires the\n            ``psutil`` package.\n        \"\"\"\n        if open_files:\n            if kwargs['parallel'] != 0:\n                raise SystemError(\n                    \"open file detection may not be used in conjunction with \"\n                    \"parallel testing.\")\n\n            try:\n                import psutil  # pylint: disable=W0611\n            except ImportError:\n                raise SystemError(\n                    \"open file detection requested, but psutil package \"\n                    \"is not installed.\")\n\n            return ['--open-files']\n\n            print(\"Checking for unclosed files\")\n\n        return []\n\n    @keyword(0)\n    def parallel(self, parallel, kwargs):\n        \"\"\"\n        parallel : int or 'auto', optional\n            When provided, run the tests in parallel on the specified\n            number of CPUs.  If parallel is ``'auto'``, it will use the all\n            the cores on the machine.  Requires the ``pytest-xdist`` plugin.\n        \"\"\"\n        if parallel != 0:\n            try:\n                from xdist import plugin # noqa\n            except ImportError:\n                raise SystemError(\n                    \"running tests in parallel requires the pytest-xdist package\")\n\n            return ['-n', str(parallel)]\n\n        return []\n\n    @keyword()\n    def docs_path(self, docs_path, kwargs):\n        \"\"\"\n        docs_path : str, optional\n            The path to the documentation .rst files.\n        \"\"\"\n\n        paths = []\n        if docs_path is not None and not kwargs['skip_docs']:\n            if kwargs['package'] is not None:\n                warning_message = (\"Can not test .rst docs for {name}, since \"\n                                   \"docs path ({path}) does not exist.\")\n                paths = self.packages_path(kwargs['package'], docs_path,\n                                           warning=warning_message)\n            elif not kwargs['test_path']:\n                paths = [docs_path, ]\n\n            if len(paths) and not kwargs['test_path']:\n                paths.append('--doctest-rst')\n\n        return paths\n\n    @keyword()\n    def skip_docs(self, skip_docs, kwargs):\n        \"\"\"\n        skip_docs : `bool`, optional\n            When `True`, skips running the doctests in the .rst files.\n        \"\"\"\n        # Skip docs is a bool used by docs_path only.\n        return []\n\n    @keyword()\n    def repeat(self, repeat, kwargs):\n        \"\"\"\n        repeat : `int`, optional\n            If set, specifies how many times each test should be run. This is\n            useful for diagnosing sporadic failures.\n        \"\"\"\n        if repeat:\n            return [f'--repeat={repeat}']\n\n        return []\n\n    # Override run_tests for astropy-specific fixes\n    def run_tests(self, **kwargs):\n\n        # This prevents cyclical import problems that make it\n        # impossible to test packages that define Table types on their\n        # own.\n        from astropy.table import Table  # pylint: disable=W0611\n\n        return super().run_tests(**kwargs)"},{"col":0,"comment":"Recursively extract field names from a dtype.","endLoc":30,"header":"def _names_from_dtype(dtype)","id":624,"name":"_names_from_dtype","nodeType":"Function","startLoc":21,"text":"def _names_from_dtype(dtype):\n    \"\"\"Recursively extract field names from a dtype.\"\"\"\n    names = []\n    for name in dtype.names:\n        subdtype = dtype.fields[name][0]\n        if subdtype.names:\n            names.append([name, _names_from_dtype(subdtype)])\n        else:\n            names.append(name)\n    return tuple(names)"},{"col":0,"comment":"Recursively normalize, inferring upper level names for unadorned tuples.\n\n    Generally, we want the field names to be organized like dtypes, as in\n    ``(['pv', ('p', 'v')], 't')``.  But we automatically infer upper\n    field names if the list is absent from items like ``(('p', 'v'), 't')``,\n    by concatenating the names inside the tuple.\n    ","endLoc":59,"header":"def _normalize_names(names)","id":625,"name":"_normalize_names","nodeType":"Function","startLoc":33,"text":"def _normalize_names(names):\n    \"\"\"Recursively normalize, inferring upper level names for unadorned tuples.\n\n    Generally, we want the field names to be organized like dtypes, as in\n    ``(['pv', ('p', 'v')], 't')``.  But we automatically infer upper\n    field names if the list is absent from items like ``(('p', 'v'), 't')``,\n    by concatenating the names inside the tuple.\n    \"\"\"\n    result = []\n    for name in names:\n        if isinstance(name, str) and len(name) > 0:\n            result.append(name)\n        elif (isinstance(name, list)\n              and len(name) == 2\n              and isinstance(name[0], str) and len(name[0]) > 0\n              and isinstance(name[1], tuple) and len(name[1]) > 0):\n            result.append([name[0], _normalize_names(name[1])])\n        elif isinstance(name, tuple) and len(name) > 0:\n            new_tuple = _normalize_names(name)\n            result.append([''.join([(i[0] if isinstance(i, list) else i)\n                                    for i in new_tuple]), new_tuple])\n        else:\n            raise ValueError(f'invalid entry {name!r}. Should be a name, '\n                             'tuple of names, or 2-element list of the '\n                             'form [name, tuple of names].')\n\n    return tuple(result)"},{"col":4,"comment":"\n        Return a new `~astropy.units.Quantity` object with the specified unit.\n\n        Parameters\n        ----------\n        unit : unit-like\n            An object that represents the unit to convert to. Must be\n            an `~astropy.units.UnitBase` object or a string parseable\n            by the `~astropy.units` package.\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            If not provided or ``[]``, class default equivalencies will be used\n            (none for `~astropy.units.Quantity`, but may be set for subclasses)\n            If `None`, no equivalencies will be applied at all, not even any\n            set globally or within a context.\n\n        copy : bool, optional\n            If `True` (default), then the value is copied.  Otherwise, a copy\n            will only be made if necessary.\n\n        See also\n        --------\n        to_value : get the numerical value in a given unit.\n        ","endLoc":850,"header":"def to(self, unit, equivalencies=[], copy=True)","id":626,"name":"to","nodeType":"Function","startLoc":813,"text":"def to(self, unit, equivalencies=[], copy=True):\n        \"\"\"\n        Return a new `~astropy.units.Quantity` object with the specified unit.\n\n        Parameters\n        ----------\n        unit : unit-like\n            An object that represents the unit to convert to. Must be\n            an `~astropy.units.UnitBase` object or a string parseable\n            by the `~astropy.units` package.\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            If not provided or ``[]``, class default equivalencies will be used\n            (none for `~astropy.units.Quantity`, but may be set for subclasses)\n            If `None`, no equivalencies will be applied at all, not even any\n            set globally or within a context.\n\n        copy : bool, optional\n            If `True` (default), then the value is copied.  Otherwise, a copy\n            will only be made if necessary.\n\n        See also\n        --------\n        to_value : get the numerical value in a given unit.\n        \"\"\"\n        # We don't use `to_value` below since we always want to make a copy\n        # and don't want to slow down this method (esp. the scalar case).\n        unit = Unit(unit)\n        if copy:\n            # Avoid using to_value to ensure that we make a copy. We also\n            # don't want to slow down this method (esp. the scalar case).\n            value = self._to_value(unit, equivalencies)\n        else:\n            # to_value only copies if necessary\n            value = self.to_value(unit, equivalencies)\n        return self._new_view(value, unit)"},{"col":4,"comment":"Helper method for to and to_value.","endLoc":811,"header":"def _to_value(self, unit, equivalencies=[])","id":627,"name":"_to_value","nodeType":"Function","startLoc":794,"text":"def _to_value(self, unit, equivalencies=[]):\n        \"\"\"Helper method for to and to_value.\"\"\"\n        if equivalencies == []:\n            equivalencies = self._equivalencies\n        if not self.dtype.names or isinstance(self.unit, StructuredUnit):\n            # Standard path, let unit to do work.\n            return self.unit.to(unit, self.view(np.ndarray),\n                                equivalencies=equivalencies)\n\n        else:\n            # The .to() method of a simple unit cannot convert a structured\n            # dtype, so we work around it, by recursing.\n            # TODO: deprecate this?\n            # Convert simple to Structured on initialization?\n            result = np.empty_like(self.view(np.ndarray))\n            for name in self.dtype.names:\n                result[name] = self[name]._to_value(unit, equivalencies)\n            return result"},{"className":"TestRunnerBase","col":0,"comment":"\n    The base class for the TestRunner.\n\n    A test runner can be constructed by creating a subclass of this class and\n    defining 'keyword' methods. These are methods that have the\n    :class:`~astropy.tests.runner.keyword` decorator, these methods are used to\n    construct allowed keyword arguments to the\n    ``run_tests`` method as a way to allow\n    customization of individual keyword arguments (and associated logic)\n    without having to re-implement the whole\n    ``run_tests`` method.\n\n    Examples\n    --------\n\n    A simple keyword method::\n\n        class MyRunner(TestRunnerBase):\n\n            @keyword('default_value'):\n            def spam(self, spam, kwargs):\n                \"\"\"\n                spam : `str`\n                    The parameter description for the run_tests docstring.\n                \"\"\"\n                # Return value must be a list with a CLI parameter for pytest.\n                return ['--spam={}'.format(spam)]\n    ","endLoc":275,"id":628,"nodeType":"Class","startLoc":52,"text":"class TestRunnerBase:\n    \"\"\"\n    The base class for the TestRunner.\n\n    A test runner can be constructed by creating a subclass of this class and\n    defining 'keyword' methods. These are methods that have the\n    :class:`~astropy.tests.runner.keyword` decorator, these methods are used to\n    construct allowed keyword arguments to the\n    ``run_tests`` method as a way to allow\n    customization of individual keyword arguments (and associated logic)\n    without having to re-implement the whole\n    ``run_tests`` method.\n\n    Examples\n    --------\n\n    A simple keyword method::\n\n        class MyRunner(TestRunnerBase):\n\n            @keyword('default_value'):\n            def spam(self, spam, kwargs):\n                \\\"\\\"\\\"\n                spam : `str`\n                    The parameter description for the run_tests docstring.\n                \\\"\\\"\\\"\n                # Return value must be a list with a CLI parameter for pytest.\n                return ['--spam={}'.format(spam)]\n    \"\"\"\n\n    def __init__(self, base_path):\n        self.base_path = os.path.abspath(base_path)\n\n    def __new__(cls, *args, **kwargs):\n        # Before constructing the class parse all the methods that have been\n        # decorated with ``keyword``.\n\n        # The objective of this method is to construct a default set of keyword\n        # arguments to the ``run_tests`` method. It does this by inspecting the\n        # methods of the class for functions with the name ``keyword`` which is\n        # the name of the decorator wrapping function. Once it has created this\n        # dictionary, it also formats the docstring of ``run_tests`` to be\n        # comprised of the docstrings for the ``keyword`` methods.\n\n        # To add a keyword argument to the ``run_tests`` method, define a new\n        # method decorated with ``@keyword`` and with the ``self, name, kwargs``\n        # signature.\n        # Get all 'function' members as the wrapped methods are functions\n        functions = inspect.getmembers(cls, predicate=inspect.isfunction)\n\n        # Filter out anything that's not got the name 'keyword'\n        keywords = filter(lambda func: func[1].__name__ == 'keyword', functions)\n        # Sort all keywords based on the priority flag.\n        sorted_keywords = sorted(keywords, key=lambda x: x[1]._priority, reverse=True)\n\n        cls.keywords = OrderedDict()\n        doc_keywords = \"\"\n        for name, func in sorted_keywords:\n            # Here we test if the function has been overloaded to return\n            # NotImplemented which is the way to disable arguments on\n            # subclasses. If it has been disabled we need to remove it from the\n            # default keywords dict. We do it in the try except block because\n            # we do not have access to an instance of the class, so this is\n            # going to error unless the method is just doing `return\n            # NotImplemented`.\n            try:\n                # Second argument is False, as it is normally a bool.\n                # The other two are placeholders for objects.\n                if func(None, False, None) is NotImplemented:\n                    continue\n            except Exception:\n                pass\n\n            # Construct the default kwargs dict and docstring\n            cls.keywords[name] = func._default_value\n            if func.__doc__:\n                doc_keywords += ' '*8\n                doc_keywords += func.__doc__.strip()\n                doc_keywords += '\\n\\n'\n\n        cls.run_tests.__doc__ = cls.RUN_TESTS_DOCSTRING.format(keywords=doc_keywords)\n\n        return super().__new__(cls)\n\n    def _generate_args(self, **kwargs):\n        # Update default values with passed kwargs\n        # but don't modify the defaults\n        keywords = copy.deepcopy(self.keywords)\n        keywords.update(kwargs)\n        # Iterate through the keywords (in order of priority)\n        args = []\n        for keyword in keywords.keys():\n            func = getattr(self, keyword)\n            result = func(keywords[keyword], keywords)\n\n            # Allow disabling of options in a subclass\n            if result is NotImplemented:\n                raise TypeError(f\"run_tests() got an unexpected keyword argument {keyword}\")\n\n            # keyword methods must return a list\n            if not isinstance(result, list):\n                raise TypeError(f\"{keyword} keyword method must return a list\")\n\n            args += result\n\n        return args\n\n    RUN_TESTS_DOCSTRING = \\\n        \"\"\"\n        Run the tests for the package.\n\n        This method builds arguments for and then calls ``pytest.main``.\n\n        Parameters\n        ----------\n{keywords}\n\n        \"\"\"\n\n    _required_dependencies = ['pytest', 'pytest_remotedata', 'pytest_doctestplus', 'pytest_astropy_header']\n    _missing_dependancy_error = (\n        \"Test dependencies are missing: {module}. You should install the \"\n        \"'pytest-astropy' package (you may need to update the package if you \"\n        \"have a previous version installed, e.g., \"\n        \"'pip install pytest-astropy --upgrade' or the equivalent with conda).\")\n\n    @classmethod\n    def _has_test_dependencies(cls):  # pragma: no cover\n        # Using the test runner will not work without these dependencies, but\n        # pytest-openfiles is optional, so it's not listed here.\n        for module in cls._required_dependencies:\n            spec = find_spec(module)\n            # Checking loader accounts for packages that were uninstalled\n            if spec is None or spec.loader is None:\n                raise RuntimeError(\n                    cls._missing_dependancy_error.format(module=module))\n\n    def run_tests(self, **kwargs):\n        # The following option will include eggs inside a .eggs folder in\n        # sys.path when running the tests. This is possible so that when\n        # running pytest, test dependencies installed via e.g.\n        # tests_requires are available here. This is not an advertised option\n        # since it is only for internal use\n        if kwargs.pop('add_local_eggs_to_path', False):\n\n            # Add each egg to sys.path individually\n            for egg in glob.glob(os.path.join('.eggs', '*.egg')):\n                sys.path.insert(0, egg)\n\n        self._has_test_dependencies()  # pragma: no cover\n\n        # The docstring for this method is defined as a class variable.\n        # This allows it to be built for each subclass in __new__.\n\n        # Don't import pytest until it's actually needed to run the tests\n        import pytest\n\n        # Raise error for undefined kwargs\n        allowed_kwargs = set(self.keywords.keys())\n        passed_kwargs = set(kwargs.keys())\n        if not passed_kwargs.issubset(allowed_kwargs):\n            wrong_kwargs = list(passed_kwargs.difference(allowed_kwargs))\n            raise TypeError(f\"run_tests() got an unexpected keyword argument {wrong_kwargs[0]}\")\n\n        args = self._generate_args(**kwargs)\n\n        if kwargs.get('plugins', None) is not None:\n            plugins = kwargs.pop('plugins')\n        elif self.keywords.get('plugins', None) is not None:\n            plugins = self.keywords['plugins']\n        else:\n            plugins = []\n\n        # Override the config locations to not make a new directory nor use\n        # existing cache or config. Note that we need to do this here in\n        # addition to in conftest.py - for users running tests interactively\n        # in e.g. IPython, conftest.py would get read in too late, so we need\n        # to do it here - but at the same time the code here doesn't work when\n        # running tests in parallel mode because this uses subprocesses which\n        # don't know about the temporary config/cache.\n        astropy_config = tempfile.mkdtemp('astropy_config')\n        astropy_cache = tempfile.mkdtemp('astropy_cache')\n\n        # Have to use nested with statements for cross-Python support\n        # Note, using these context managers here is superfluous if the\n        # config_dir or cache_dir options to pytest are in use, but it's\n        # also harmless to nest the contexts\n        with set_temp_config(astropy_config, delete=True):\n            with set_temp_cache(astropy_cache, delete=True):\n                return pytest.main(args=args, plugins=plugins)\n\n    @classmethod\n    def make_test_runner_in(cls, path):\n        \"\"\"\n        Constructs a `TestRunner` to run in the given path, and returns a\n        ``test()`` function which takes the same arguments as\n        ``TestRunner.run_tests``.\n\n        The returned ``test()`` function will be defined in the module this\n        was called from.  This is used to implement the ``astropy.test()``\n        function (or the equivalent for affiliated packages).\n        \"\"\"\n\n        runner = cls(path)\n\n        @wraps(runner.run_tests, ('__doc__',))\n        def test(**kwargs):\n            return runner.run_tests(**kwargs)\n\n        module = find_current_module(2)\n        if module is not None:\n            test.__module__ = module.__name__\n\n        # A somewhat unusual hack, but delete the attached __wrapped__\n        # attribute--although this is normally used to tell if the function\n        # was wrapped with wraps, on some version of Python this is also\n        # used to determine the signature to display in help() which is\n        # not useful in this case.  We don't really care in this case if the\n        # function was wrapped either\n        if hasattr(test, '__wrapped__'):\n            del test.__wrapped__\n\n        test.__test__ = False\n        return test"},{"col":4,"comment":"null","endLoc":83,"header":"def __init__(self, base_path)","id":629,"name":"__init__","nodeType":"Function","startLoc":82,"text":"def __init__(self, base_path):\n        self.base_path = os.path.abspath(base_path)"},{"col":4,"comment":"null","endLoc":134,"header":"def __new__(cls, *args, **kwargs)","id":630,"name":"__new__","nodeType":"Function","startLoc":85,"text":"def __new__(cls, *args, **kwargs):\n        # Before constructing the class parse all the methods that have been\n        # decorated with ``keyword``.\n\n        # The objective of this method is to construct a default set of keyword\n        # arguments to the ``run_tests`` method. It does this by inspecting the\n        # methods of the class for functions with the name ``keyword`` which is\n        # the name of the decorator wrapping function. Once it has created this\n        # dictionary, it also formats the docstring of ``run_tests`` to be\n        # comprised of the docstrings for the ``keyword`` methods.\n\n        # To add a keyword argument to the ``run_tests`` method, define a new\n        # method decorated with ``@keyword`` and with the ``self, name, kwargs``\n        # signature.\n        # Get all 'function' members as the wrapped methods are functions\n        functions = inspect.getmembers(cls, predicate=inspect.isfunction)\n\n        # Filter out anything that's not got the name 'keyword'\n        keywords = filter(lambda func: func[1].__name__ == 'keyword', functions)\n        # Sort all keywords based on the priority flag.\n        sorted_keywords = sorted(keywords, key=lambda x: x[1]._priority, reverse=True)\n\n        cls.keywords = OrderedDict()\n        doc_keywords = \"\"\n        for name, func in sorted_keywords:\n            # Here we test if the function has been overloaded to return\n            # NotImplemented which is the way to disable arguments on\n            # subclasses. If it has been disabled we need to remove it from the\n            # default keywords dict. We do it in the try except block because\n            # we do not have access to an instance of the class, so this is\n            # going to error unless the method is just doing `return\n            # NotImplemented`.\n            try:\n                # Second argument is False, as it is normally a bool.\n                # The other two are placeholders for objects.\n                if func(None, False, None) is NotImplemented:\n                    continue\n            except Exception:\n                pass\n\n            # Construct the default kwargs dict and docstring\n            cls.keywords[name] = func._default_value\n            if func.__doc__:\n                doc_keywords += ' '*8\n                doc_keywords += func.__doc__.strip()\n                doc_keywords += '\\n\\n'\n\n        cls.run_tests.__doc__ = cls.RUN_TESTS_DOCSTRING.format(keywords=doc_keywords)\n\n        return super().__new__(cls)"},{"col":26,"endLoc":103,"id":631,"nodeType":"Lambda","startLoc":103,"text":"lambda func: func[1].__name__ == 'keyword'"},{"col":47,"endLoc":105,"id":632,"nodeType":"Lambda","startLoc":105,"text":"lambda x: x[1]._priority"},{"col":4,"comment":"null","endLoc":105,"header":"def __iter__(self)","id":633,"name":"__iter__","nodeType":"Function","startLoc":102,"text":"def __iter__(self):\n        for key, val in self.__class__.__dict__.items():\n            if isinstance(val, ConfigItem):\n                yield key"},{"col":4,"comment":"null","endLoc":2856,"header":"def _get_naxis(self, header=None)","id":634,"name":"_get_naxis","nodeType":"Function","startLoc":2843,"text":"def _get_naxis(self, header=None):\n        _naxis = []\n        if (header is not None and\n                not isinstance(header, (str, bytes))):\n            for naxis in itertools.count(1):\n                try:\n                    _naxis.append(header[f'NAXIS{naxis}'])\n                except KeyError:\n                    break\n        if len(_naxis) == 0:\n            _naxis = [0, 0]\n        elif len(_naxis) == 1:\n            _naxis.append(0)\n        self._naxis = _naxis"},{"col":4,"comment":"null","endLoc":157,"header":"def _generate_args(self, **kwargs)","id":635,"name":"_generate_args","nodeType":"Function","startLoc":136,"text":"def _generate_args(self, **kwargs):\n        # Update default values with passed kwargs\n        # but don't modify the defaults\n        keywords = copy.deepcopy(self.keywords)\n        keywords.update(kwargs)\n        # Iterate through the keywords (in order of priority)\n        args = []\n        for keyword in keywords.keys():\n            func = getattr(self, keyword)\n            result = func(keywords[keyword], keywords)\n\n            # Allow disabling of options in a subclass\n            if result is NotImplemented:\n                raise TypeError(f\"run_tests() got an unexpected keyword argument {keyword}\")\n\n            # keyword methods must return a list\n            if not isinstance(result, list):\n                raise TypeError(f\"{keyword} keyword method must return a list\")\n\n            args += result\n\n        return args"},{"col":4,"comment":"Iterate over configuration item values.","endLoc":114,"header":"def values(self)","id":636,"name":"values","nodeType":"Function","startLoc":110,"text":"def values(self):\n        \"\"\"Iterate over configuration item values.\"\"\"\n        for val in self.__class__.__dict__.values():\n            if isinstance(val, ConfigItem):\n                yield val"},{"col":4,"comment":"Iterate over configuration item ``(name, value)`` pairs.","endLoc":120,"header":"def items(self)","id":637,"name":"items","nodeType":"Function","startLoc":116,"text":"def items(self):\n        \"\"\"Iterate over configuration item ``(name, value)`` pairs.\"\"\"\n        for key, val in self.__class__.__dict__.items():\n            if isinstance(val, ConfigItem):\n                yield key, val"},{"col":4,"comment":"\n        Temporarily set a configuration value.\n\n        Parameters\n        ----------\n        attr : str\n            Configuration item name\n\n        value : object\n            The value to set temporarily.\n\n        Examples\n        --------\n        >>> import astropy\n        >>> with astropy.conf.set_temp('use_color', False):\n        ...     pass\n        ...     # console output will not contain color\n        >>> # console output contains color again...\n        ","endLoc":144,"header":"def set_temp(self, attr, value)","id":638,"name":"set_temp","nodeType":"Function","startLoc":122,"text":"def set_temp(self, attr, value):\n        \"\"\"\n        Temporarily set a configuration value.\n\n        Parameters\n        ----------\n        attr : str\n            Configuration item name\n\n        value : object\n            The value to set temporarily.\n\n        Examples\n        --------\n        >>> import astropy\n        >>> with astropy.conf.set_temp('use_color', False):\n        ...     pass\n        ...     # console output will not contain color\n        >>> # console output contains color again...\n        \"\"\"\n        if hasattr(self, attr):\n            return self.__class__.__dict__[attr].set_temp(value)\n        raise AttributeError(f\"No configuration parameter '{attr}'\")"},{"col":4,"comment":"\n        Reload a configuration item from the configuration file.\n\n        Parameters\n        ----------\n        attr : str, optional\n            The name of the configuration parameter to reload.  If not\n            provided, reload all configuration parameters.\n        ","endLoc":162,"header":"def reload(self, attr=None)","id":639,"name":"reload","nodeType":"Function","startLoc":146,"text":"def reload(self, attr=None):\n        \"\"\"\n        Reload a configuration item from the configuration file.\n\n        Parameters\n        ----------\n        attr : str, optional\n            The name of the configuration parameter to reload.  If not\n            provided, reload all configuration parameters.\n        \"\"\"\n        if attr is not None:\n            if hasattr(self, attr):\n                return self.__class__.__dict__[attr].reload()\n            raise AttributeError(f\"No configuration parameter '{attr}'\")\n\n        for item in self.values():\n            item.reload()"},{"col":4,"comment":"null","endLoc":187,"header":"@classmethod\n    def _has_test_dependencies(cls)","id":640,"name":"_has_test_dependencies","nodeType":"Function","startLoc":178,"text":"@classmethod\n    def _has_test_dependencies(cls):  # pragma: no cover\n        # Using the test runner will not work without these dependencies, but\n        # pytest-openfiles is optional, so it's not listed here.\n        for module in cls._required_dependencies:\n            spec = find_spec(module)\n            # Checking loader accounts for packages that were uninstalled\n            if spec is None or spec.loader is None:\n                raise RuntimeError(\n                    cls._missing_dependancy_error.format(module=module))"},{"col":4,"comment":"\n        Reset a configuration item to its default.\n\n        Parameters\n        ----------\n        attr : str, optional\n            The name of the configuration parameter to reload.  If not\n            provided, reset all configuration parameters.\n        ","endLoc":182,"header":"def reset(self, attr=None)","id":641,"name":"reset","nodeType":"Function","startLoc":164,"text":"def reset(self, attr=None):\n        \"\"\"\n        Reset a configuration item to its default.\n\n        Parameters\n        ----------\n        attr : str, optional\n            The name of the configuration parameter to reload.  If not\n            provided, reset all configuration parameters.\n        \"\"\"\n        if attr is not None:\n            if hasattr(self, attr):\n                prop = self.__class__.__dict__[attr]\n                prop.set(prop.defaultvalue)\n                return\n            raise AttributeError(f\"No configuration parameter '{attr}'\")\n\n        for item in self.values():\n            item.set(item.defaultvalue)"},{"col":4,"comment":"\n        The numerical value, possibly in a different unit.\n\n        Parameters\n        ----------\n        unit : unit-like, optional\n            The unit in which the value should be given. If not given or `None`,\n            use the current unit.\n\n        equivalencies : list of tuple, optional\n            A list of equivalence pairs to try if the units are not directly\n            convertible (see :ref:`astropy:unit_equivalencies`). If not provided\n            or ``[]``, class default equivalencies will be used (none for\n            `~astropy.units.Quantity`, but may be set for subclasses).\n            If `None`, no equivalencies will be applied at all, not even any\n            set globally or within a context.\n\n        Returns\n        -------\n        value : ndarray or scalar\n            The value in the units specified. For arrays, this will be a view\n            of the data if no unit conversion was necessary.\n\n        See also\n        --------\n        to : Get a new instance in a different unit.\n        ","endLoc":904,"header":"def to_value(self, unit=None, equivalencies=[])","id":642,"name":"to_value","nodeType":"Function","startLoc":852,"text":"def to_value(self, unit=None, equivalencies=[]):\n        \"\"\"\n        The numerical value, possibly in a different unit.\n\n        Parameters\n        ----------\n        unit : unit-like, optional\n            The unit in which the value should be given. If not given or `None`,\n            use the current unit.\n\n        equivalencies : list of tuple, optional\n            A list of equivalence pairs to try if the units are not directly\n            convertible (see :ref:`astropy:unit_equivalencies`). If not provided\n            or ``[]``, class default equivalencies will be used (none for\n            `~astropy.units.Quantity`, but may be set for subclasses).\n            If `None`, no equivalencies will be applied at all, not even any\n            set globally or within a context.\n\n        Returns\n        -------\n        value : ndarray or scalar\n            The value in the units specified. For arrays, this will be a view\n            of the data if no unit conversion was necessary.\n\n        See also\n        --------\n        to : Get a new instance in a different unit.\n        \"\"\"\n        if unit is None or unit is self.unit:\n            value = self.view(np.ndarray)\n        elif not self.dtype.names:\n            # For non-structured, we attempt a short-cut, where we just get\n            # the scale.  If that is 1, we do not have to do anything.\n            unit = Unit(unit)\n            # We want a view if the unit does not change.  One could check\n            # with \"==\", but that calculates the scale that we need anyway.\n            # TODO: would be better for `unit.to` to have an in-place flag.\n            try:\n                scale = self.unit._to(unit)\n            except Exception:\n                # Short-cut failed; try default (maybe equivalencies help).\n                value = self._to_value(unit, equivalencies)\n            else:\n                value = self.view(np.ndarray)\n                if not is_effectively_unity(scale):\n                    # not in-place!\n                    value = value * scale\n        else:\n            # For structured arrays, we go the default route.\n            value = self._to_value(unit, equivalencies)\n\n        # Index with empty tuple to decay array scalars in to numpy scalars.\n        return value if value.shape else value[()]"},{"attributeType":"function","col":4,"comment":"Iterate over configuration item names.","endLoc":107,"id":643,"name":"keys","nodeType":"Attribute","startLoc":107,"text":"keys"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":58,"id":644,"name":"log_level","nodeType":"Attribute","startLoc":58,"text":"log_level"},{"col":4,"comment":"\n        Perform the fix operations from wcslib, and warn about any\n        changes it has made.\n\n        Parameters\n        ----------\n        translate_units : str, optional\n            Specify which potentially unsafe translations of\n            non-standard unit strings to perform.  By default,\n            performs none.\n\n            Although ``\"S\"`` is commonly used to represent seconds,\n            its translation to ``\"s\"`` is potentially unsafe since the\n            standard recognizes ``\"S\"`` formally as Siemens, however\n            rarely that may be used.  The same applies to ``\"H\"`` for\n            hours (Henry), and ``\"D\"`` for days (Debye).\n\n            This string controls what to do in such cases, and is\n            case-insensitive.\n\n            - If the string contains ``\"s\"``, translate ``\"S\"`` to\n              ``\"s\"``.\n\n            - If the string contains ``\"h\"``, translate ``\"H\"`` to\n              ``\"h\"``.\n\n            - If the string contains ``\"d\"``, translate ``\"D\"`` to\n              ``\"d\"``.\n\n            Thus ``''`` doesn't do any unsafe translations, whereas\n            ``'shd'`` does all of them.\n\n        naxis : int array, optional\n            Image axis lengths.  If this array is set to zero or\n            ``None``, then `~astropy.wcs.Wcsprm.cylfix` will not be\n            invoked.\n        ","endLoc":720,"header":"def fix(self, translate_units='', naxis=None)","id":645,"name":"fix","nodeType":"Function","startLoc":671,"text":"def fix(self, translate_units='', naxis=None):\n        \"\"\"\n        Perform the fix operations from wcslib, and warn about any\n        changes it has made.\n\n        Parameters\n        ----------\n        translate_units : str, optional\n            Specify which potentially unsafe translations of\n            non-standard unit strings to perform.  By default,\n            performs none.\n\n            Although ``\"S\"`` is commonly used to represent seconds,\n            its translation to ``\"s\"`` is potentially unsafe since the\n            standard recognizes ``\"S\"`` formally as Siemens, however\n            rarely that may be used.  The same applies to ``\"H\"`` for\n            hours (Henry), and ``\"D\"`` for days (Debye).\n\n            This string controls what to do in such cases, and is\n            case-insensitive.\n\n            - If the string contains ``\"s\"``, translate ``\"S\"`` to\n              ``\"s\"``.\n\n            - If the string contains ``\"h\"``, translate ``\"H\"`` to\n              ``\"h\"``.\n\n            - If the string contains ``\"d\"``, translate ``\"D\"`` to\n              ``\"d\"``.\n\n            Thus ``''`` doesn't do any unsafe translations, whereas\n            ``'shd'`` does all of them.\n\n        naxis : int array, optional\n            Image axis lengths.  If this array is set to zero or\n            ``None``, then `~astropy.wcs.Wcsprm.cylfix` will not be\n            invoked.\n        \"\"\"\n        if self.wcs is not None:\n            self._fix_scamp()\n            fixes = self.wcs.fix(translate_units, naxis)\n            for key, val in fixes.items():\n                if val != \"No change\":\n                    if (key == 'datfix' and '1858-11-17' in val and\n                            not np.count_nonzero(self.wcs.mjdref)):\n                        continue\n                    warnings.warn(\n                        (\"'{0}' made the change '{1}'.\").\n                        format(key, val),\n                        FITSFixedWarning)"},{"col":4,"comment":"null","endLoc":241,"header":"def run_tests(self, **kwargs)","id":646,"name":"run_tests","nodeType":"Function","startLoc":189,"text":"def run_tests(self, **kwargs):\n        # The following option will include eggs inside a .eggs folder in\n        # sys.path when running the tests. This is possible so that when\n        # running pytest, test dependencies installed via e.g.\n        # tests_requires are available here. This is not an advertised option\n        # since it is only for internal use\n        if kwargs.pop('add_local_eggs_to_path', False):\n\n            # Add each egg to sys.path individually\n            for egg in glob.glob(os.path.join('.eggs', '*.egg')):\n                sys.path.insert(0, egg)\n\n        self._has_test_dependencies()  # pragma: no cover\n\n        # The docstring for this method is defined as a class variable.\n        # This allows it to be built for each subclass in __new__.\n\n        # Don't import pytest until it's actually needed to run the tests\n        import pytest\n\n        # Raise error for undefined kwargs\n        allowed_kwargs = set(self.keywords.keys())\n        passed_kwargs = set(kwargs.keys())\n        if not passed_kwargs.issubset(allowed_kwargs):\n            wrong_kwargs = list(passed_kwargs.difference(allowed_kwargs))\n            raise TypeError(f\"run_tests() got an unexpected keyword argument {wrong_kwargs[0]}\")\n\n        args = self._generate_args(**kwargs)\n\n        if kwargs.get('plugins', None) is not None:\n            plugins = kwargs.pop('plugins')\n        elif self.keywords.get('plugins', None) is not None:\n            plugins = self.keywords['plugins']\n        else:\n            plugins = []\n\n        # Override the config locations to not make a new directory nor use\n        # existing cache or config. Note that we need to do this here in\n        # addition to in conftest.py - for users running tests interactively\n        # in e.g. IPython, conftest.py would get read in too late, so we need\n        # to do it here - but at the same time the code here doesn't work when\n        # running tests in parallel mode because this uses subprocesses which\n        # don't know about the temporary config/cache.\n        astropy_config = tempfile.mkdtemp('astropy_config')\n        astropy_cache = tempfile.mkdtemp('astropy_cache')\n\n        # Have to use nested with statements for cross-Python support\n        # Note, using these context managers here is superfluous if the\n        # config_dir or cache_dir options to pytest are in use, but it's\n        # also harmless to nest the contexts\n        with set_temp_config(astropy_config, delete=True):\n            with set_temp_cache(astropy_cache, delete=True):\n                return pytest.main(args=args, plugins=plugins)"},{"col":0,"comment":"\n    For a WCS returns pixel scales along each axis of the image pixel at\n    the ``CRPIX`` location once it is projected onto the\n    \"plane of intermediate world coordinates\" as defined in\n    `Greisen & Calabretta 2002, A&A, 395, 1061 <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1061G>`_.\n\n    .. note::\n        This function is concerned **only** about the transformation\n        \"image plane\"->\"projection plane\" and **not** about the\n        transformation \"celestial sphere\"->\"projection plane\"->\"image plane\".\n        Therefore, this function ignores distortions arising due to\n        non-linear nature of most projections.\n\n    .. note::\n        In order to compute the scales corresponding to celestial axes only,\n        make sure that the input `~astropy.wcs.WCS` object contains\n        celestial axes only, e.g., by passing in the\n        `~astropy.wcs.WCS.celestial` WCS object.\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.WCS`\n        A world coordinate system object.\n\n    Returns\n    -------\n    scale : ndarray\n        A vector (`~numpy.ndarray`) of projection plane increments\n        corresponding to each pixel side (axis). The units of the returned\n        results are the same as the units of `~astropy.wcs.Wcsprm.cdelt`,\n        `~astropy.wcs.Wcsprm.crval`, and `~astropy.wcs.Wcsprm.cd` for\n        the celestial WCS and can be obtained by inquiring the value\n        of `~astropy.wcs.Wcsprm.cunit` property of the input\n        `~astropy.wcs.WCS` WCS object.\n\n    See Also\n    --------\n    astropy.wcs.utils.proj_plane_pixel_area\n\n    ","endLoc":335,"header":"def proj_plane_pixel_scales(wcs)","id":647,"name":"proj_plane_pixel_scales","nodeType":"Function","startLoc":294,"text":"def proj_plane_pixel_scales(wcs):\n    \"\"\"\n    For a WCS returns pixel scales along each axis of the image pixel at\n    the ``CRPIX`` location once it is projected onto the\n    \"plane of intermediate world coordinates\" as defined in\n    `Greisen & Calabretta 2002, A&A, 395, 1061 <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1061G>`_.\n\n    .. note::\n        This function is concerned **only** about the transformation\n        \"image plane\"->\"projection plane\" and **not** about the\n        transformation \"celestial sphere\"->\"projection plane\"->\"image plane\".\n        Therefore, this function ignores distortions arising due to\n        non-linear nature of most projections.\n\n    .. note::\n        In order to compute the scales corresponding to celestial axes only,\n        make sure that the input `~astropy.wcs.WCS` object contains\n        celestial axes only, e.g., by passing in the\n        `~astropy.wcs.WCS.celestial` WCS object.\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.WCS`\n        A world coordinate system object.\n\n    Returns\n    -------\n    scale : ndarray\n        A vector (`~numpy.ndarray`) of projection plane increments\n        corresponding to each pixel side (axis). The units of the returned\n        results are the same as the units of `~astropy.wcs.Wcsprm.cdelt`,\n        `~astropy.wcs.Wcsprm.crval`, and `~astropy.wcs.Wcsprm.cd` for\n        the celestial WCS and can be obtained by inquiring the value\n        of `~astropy.wcs.Wcsprm.cunit` property of the input\n        `~astropy.wcs.WCS` WCS object.\n\n    See Also\n    --------\n    astropy.wcs.utils.proj_plane_pixel_area\n\n    \"\"\"\n    return np.sqrt((wcs.pixel_scale_matrix**2).sum(axis=0, dtype=float))"},{"col":4,"comment":"\n        Remove SCAMP's PVi_m distortion parameters if SIP distortion parameters\n        are also present. Some projects (e.g., Palomar Transient Factory)\n        convert SCAMP's distortion parameters (which abuse the PVi_m cards) to\n        SIP. However, wcslib gets confused by the presence of both SCAMP and\n        SIP distortion parameters.\n\n        See https://github.com/astropy/astropy/issues/299.\n        ","endLoc":669,"header":"def _fix_scamp(self)","id":648,"name":"_fix_scamp","nodeType":"Function","startLoc":628,"text":"def _fix_scamp(self):\n        \"\"\"\n        Remove SCAMP's PVi_m distortion parameters if SIP distortion parameters\n        are also present. Some projects (e.g., Palomar Transient Factory)\n        convert SCAMP's distortion parameters (which abuse the PVi_m cards) to\n        SIP. However, wcslib gets confused by the presence of both SCAMP and\n        SIP distortion parameters.\n\n        See https://github.com/astropy/astropy/issues/299.\n        \"\"\"\n        # Nothing to be done if no WCS attached\n        if self.wcs is None:\n            return\n\n        # Nothing to be done if no PV parameters attached\n        pv = self.wcs.get_pv()\n        if not pv:\n            return\n\n        # Nothing to be done if axes don't use SIP distortion parameters\n        if self.sip is None:\n            return\n\n        # Nothing to be done if any radial terms are present...\n        # Loop over list to find any radial terms.\n        # Certain values of the `j' index are used for storing\n        # radial terms; refer to Equation (1) in\n        # <http://web.ipac.caltech.edu/staff/shupe/reprints/SIP_to_PV_SPIE2012.pdf>.\n        pv = np.asarray(pv)\n        # Loop over distinct values of `i' index\n        for i in set(pv[:, 0]):\n            # Get all values of `j' index for this value of `i' index\n            js = set(pv[:, 1][pv[:, 0] == i])\n            # Find max value of `j' index\n            max_j = max(js)\n            for j in (3, 11, 23, 39):\n                if j < max_j and j in js:\n                    return\n\n        self.wcs.set_pv([])\n        warnings.warn(\"Removed redundant SCAMP distortion parameters \" +\n                      \"because SIP parameters are also present\", FITSFixedWarning)"},{"col":4,"comment":"null","endLoc":1432,"header":"def wcs_pix2world(self, *args, **kwargs)","id":649,"name":"wcs_pix2world","nodeType":"Function","startLoc":1427,"text":"def wcs_pix2world(self, *args, **kwargs):\n        if self.wcs is None:\n            raise ValueError(\"No basic WCS settings were created.\")\n        return self._array_converter(\n            lambda xy, o: self.wcs.p2s(xy, o)['world'],\n            'output', *args, **kwargs)"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":64,"id":650,"name":"log_warnings","nodeType":"Attribute","startLoc":64,"text":"log_warnings"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":67,"id":651,"name":"log_exceptions","nodeType":"Attribute","startLoc":67,"text":"log_exceptions"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":71,"id":652,"name":"log_to_file","nodeType":"Attribute","startLoc":71,"text":"log_to_file"},{"col":4,"comment":"null","endLoc":183,"header":"def __init__(self, path=None, delete=False)","id":653,"name":"__init__","nodeType":"Function","startLoc":177,"text":"def __init__(self, path=None, delete=False):\n        if path is not None:\n            path = os.path.abspath(path)\n\n        self._path = path\n        self._delete = delete\n        self._prev_path = self.__class__._temp_path"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":75,"id":654,"name":"log_file_path","nodeType":"Attribute","startLoc":75,"text":"log_file_path"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":80,"id":655,"name":"log_file_level","nodeType":"Attribute","startLoc":80,"text":"log_file_level"},{"col":4,"comment":"\n        Constructs a `TestRunner` to run in the given path, and returns a\n        ``test()`` function which takes the same arguments as\n        ``TestRunner.run_tests``.\n\n        The returned ``test()`` function will be defined in the module this\n        was called from.  This is used to implement the ``astropy.test()``\n        function (or the equivalent for affiliated packages).\n        ","endLoc":275,"header":"@classmethod\n    def make_test_runner_in(cls, path)","id":656,"name":"make_test_runner_in","nodeType":"Function","startLoc":243,"text":"@classmethod\n    def make_test_runner_in(cls, path):\n        \"\"\"\n        Constructs a `TestRunner` to run in the given path, and returns a\n        ``test()`` function which takes the same arguments as\n        ``TestRunner.run_tests``.\n\n        The returned ``test()`` function will be defined in the module this\n        was called from.  This is used to implement the ``astropy.test()``\n        function (or the equivalent for affiliated packages).\n        \"\"\"\n\n        runner = cls(path)\n\n        @wraps(runner.run_tests, ('__doc__',))\n        def test(**kwargs):\n            return runner.run_tests(**kwargs)\n\n        module = find_current_module(2)\n        if module is not None:\n            test.__module__ = module.__name__\n\n        # A somewhat unusual hack, but delete the attached __wrapped__\n        # attribute--although this is normally used to tell if the function\n        # was wrapped with wraps, on some version of Python this is also\n        # used to determine the signature to display in help() which is\n        # not useful in this case.  We don't really care in this case if the\n        # function was wrapped either\n        if hasattr(test, '__wrapped__'):\n            del test.__wrapped__\n\n        test.__test__ = False\n        return test"},{"fileName":"conftest.py","filePath":"astropy","id":657,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis file contains pytest configuration settings that are astropy-specific\n(i.e.  those that would not necessarily be shared by affiliated packages\nmaking use of astropy's test runner).\n\"\"\"\nimport builtins\nimport os\nimport sys\nimport tempfile\nimport warnings\n\ntry:\n    from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS\nexcept ImportError:\n    PYTEST_HEADER_MODULES = {}\n    TESTED_VERSIONS = {}\n\nimport pytest\n\nfrom astropy import __version__\n\n# This is needed to silence a warning from matplotlib caused by\n# PyInstaller's matplotlib runtime hook.  This can be removed once the\n# issue is fixed upstream in PyInstaller, and only impacts us when running\n# the tests from a PyInstaller bundle.\n# See https://github.com/astropy/astropy/issues/10785\nif getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):\n    # The above checks whether we are running in a PyInstaller bundle.\n    warnings.filterwarnings(\"ignore\", \"(?s).*MATPLOTLIBDATA.*\",\n                            category=UserWarning)\n\n# Note: while the filterwarnings is required, this import has to come after the\n# filterwarnings above, because this attempts to import matplotlib:\nfrom astropy.utils.compat.optional_deps import HAS_MATPLOTLIB  # noqa: E402\n\nif HAS_MATPLOTLIB:\n    import matplotlib\n\nmatplotlibrc_cache = {}\n\n\n@pytest.fixture\ndef ignore_matplotlibrc():\n    # This is a fixture for tests that use matplotlib but not pytest-mpl\n    # (which already handles rcParams)\n    from matplotlib import pyplot as plt\n    with plt.style.context({}, after_reset=True):\n        yield\n\n\n@pytest.fixture\ndef fast_thread_switching():\n    \"\"\"Fixture that reduces thread switching interval.\n\n    This makes it easier to provoke race conditions.\n    \"\"\"\n    old = sys.getswitchinterval()\n    sys.setswitchinterval(1e-6)\n    yield\n    sys.setswitchinterval(old)\n\n\ndef pytest_configure(config):\n    from astropy.utils.iers import conf as iers_conf\n\n    # Disable IERS auto download for testing\n    iers_conf.auto_download = False\n\n    builtins._pytest_running = True\n    # do not assign to matplotlibrc_cache in function scope\n    if HAS_MATPLOTLIB:\n        with warnings.catch_warnings():\n            warnings.simplefilter('ignore')\n            matplotlibrc_cache.update(matplotlib.rcParams)\n            matplotlib.rcdefaults()\n            matplotlib.use('Agg')\n\n    # Make sure we use temporary directories for the config and cache\n    # so that the tests are insensitive to local configuration. Note that this\n    # is also set in the test runner, but we need to also set it here for\n    # things to work properly in parallel mode\n\n    builtins._xdg_config_home_orig = os.environ.get('XDG_CONFIG_HOME')\n    builtins._xdg_cache_home_orig = os.environ.get('XDG_CACHE_HOME')\n\n    os.environ['XDG_CONFIG_HOME'] = tempfile.mkdtemp('astropy_config')\n    os.environ['XDG_CACHE_HOME'] = tempfile.mkdtemp('astropy_cache')\n\n    os.mkdir(os.path.join(os.environ['XDG_CONFIG_HOME'], 'astropy'))\n    os.mkdir(os.path.join(os.environ['XDG_CACHE_HOME'], 'astropy'))\n\n    config.option.astropy_header = True\n    PYTEST_HEADER_MODULES['PyERFA'] = 'erfa'\n    PYTEST_HEADER_MODULES['Cython'] = 'cython'\n    PYTEST_HEADER_MODULES['Scikit-image'] = 'skimage'\n    PYTEST_HEADER_MODULES['asdf'] = 'asdf'\n    TESTED_VERSIONS['Astropy'] = __version__\n\n\ndef pytest_unconfigure(config):\n    from astropy.utils.iers import conf as iers_conf\n\n    # Undo IERS auto download setting for testing\n    iers_conf.reset('auto_download')\n\n    builtins._pytest_running = False\n    # do not assign to matplotlibrc_cache in function scope\n    if HAS_MATPLOTLIB:\n        with warnings.catch_warnings():\n            warnings.simplefilter('ignore')\n            matplotlib.rcParams.update(matplotlibrc_cache)\n            matplotlibrc_cache.clear()\n\n    if builtins._xdg_config_home_orig is None:\n        os.environ.pop('XDG_CONFIG_HOME')\n    else:\n        os.environ['XDG_CONFIG_HOME'] = builtins._xdg_config_home_orig\n\n    if builtins._xdg_cache_home_orig is None:\n        os.environ.pop('XDG_CACHE_HOME')\n    else:\n        os.environ['XDG_CACHE_HOME'] = builtins._xdg_cache_home_orig\n\n\ndef pytest_terminal_summary(terminalreporter):\n    \"\"\"Output a warning to IPython users in case any tests failed.\"\"\"\n\n    try:\n        get_ipython()\n    except NameError:\n        return\n\n    if not terminalreporter.stats.get('failed'):\n        # Only issue the warning when there are actually failures\n        return\n\n    terminalreporter.ensure_newline()\n    terminalreporter.write_line(\n        'Some tests may fail when run from the IPython prompt; '\n        'especially, but not limited to tests involving logging and warning '\n        'handling.  Unless you are certain as to the cause of the failure, '\n        'please check that the failure occurs outside IPython as well.  See '\n        'https://docs.astropy.org/en/stable/known_issues.html#failing-logging-'\n        'tests-when-running-the-tests-in-ipython for more information.',\n        yellow=True, bold=True)\n"},{"col":0,"comment":"\n    Extract a smaller array of the given shape and position from a\n    larger array.\n\n    Parameters\n    ----------\n    array_large : ndarray\n        The array from which to extract the small array.\n    shape : int or tuple thereof\n        The shape of the extracted array (for 1D arrays, this can be an\n        `int`).  See the ``mode`` keyword for additional details.\n    position : number or tuple thereof\n        The position of the small array's center with respect to the\n        large array.  The pixel coordinates should be in the same order\n        as the array shape.  Integer positions are at the pixel centers\n        (for 1D arrays, this can be a number).\n    mode : {'partial', 'trim', 'strict'}, optional\n        The mode used for extracting the small array.  For the\n        ``'partial'`` and ``'trim'`` modes, a partial overlap of the\n        small array and the large array is sufficient.  For the\n        ``'strict'`` mode, the small array has to be fully contained\n        within the large array, otherwise an\n        `~astropy.nddata.utils.PartialOverlapError` is raised.   In all\n        modes, non-overlapping arrays will raise a\n        `~astropy.nddata.utils.NoOverlapError`.  In ``'partial'`` mode,\n        positions in the small array that do not overlap with the large\n        array will be filled with ``fill_value``.  In ``'trim'`` mode\n        only the overlapping elements are returned, thus the resulting\n        small array may be smaller than the requested ``shape``.\n    fill_value : number, optional\n        If ``mode='partial'``, the value to fill pixels in the extracted\n        small array that do not overlap with the input ``array_large``.\n        ``fill_value`` will be changed to have the same ``dtype`` as the\n        ``array_large`` array, with one exception. If ``array_large``\n        has integer type and ``fill_value`` is ``np.nan``, then a\n        `ValueError` will be raised.\n    return_position : bool, optional\n        If `True`, return the coordinates of ``position`` in the\n        coordinate system of the returned array.\n\n    Returns\n    -------\n    array_small : ndarray\n        The extracted array.\n    new_position : tuple\n        If ``return_position`` is true, this tuple will contain the\n        coordinates of the input ``position`` in the coordinate system\n        of ``array_small``. Note that for partially overlapping arrays,\n        ``new_position`` might actually be outside of the\n        ``array_small``; ``array_small[new_position]`` might give wrong\n        results if any element in ``new_position`` is negative.\n\n    Examples\n    --------\n    We consider a large array with the shape 11x10, from which we extract\n    a small array of shape 3x5:\n\n    >>> import numpy as np\n    >>> from astropy.nddata.utils import extract_array\n    >>> large_array = np.arange(110).reshape((11, 10))\n    >>> extract_array(large_array, (3, 5), (7, 7))\n    array([[65, 66, 67, 68, 69],\n           [75, 76, 77, 78, 79],\n           [85, 86, 87, 88, 89]])\n    ","endLoc":242,"header":"def extract_array(array_large, shape, position, mode='partial',\n                  fill_value=np.nan, return_position=False)","id":658,"name":"extract_array","nodeType":"Function","startLoc":140,"text":"def extract_array(array_large, shape, position, mode='partial',\n                  fill_value=np.nan, return_position=False):\n    \"\"\"\n    Extract a smaller array of the given shape and position from a\n    larger array.\n\n    Parameters\n    ----------\n    array_large : ndarray\n        The array from which to extract the small array.\n    shape : int or tuple thereof\n        The shape of the extracted array (for 1D arrays, this can be an\n        `int`).  See the ``mode`` keyword for additional details.\n    position : number or tuple thereof\n        The position of the small array's center with respect to the\n        large array.  The pixel coordinates should be in the same order\n        as the array shape.  Integer positions are at the pixel centers\n        (for 1D arrays, this can be a number).\n    mode : {'partial', 'trim', 'strict'}, optional\n        The mode used for extracting the small array.  For the\n        ``'partial'`` and ``'trim'`` modes, a partial overlap of the\n        small array and the large array is sufficient.  For the\n        ``'strict'`` mode, the small array has to be fully contained\n        within the large array, otherwise an\n        `~astropy.nddata.utils.PartialOverlapError` is raised.   In all\n        modes, non-overlapping arrays will raise a\n        `~astropy.nddata.utils.NoOverlapError`.  In ``'partial'`` mode,\n        positions in the small array that do not overlap with the large\n        array will be filled with ``fill_value``.  In ``'trim'`` mode\n        only the overlapping elements are returned, thus the resulting\n        small array may be smaller than the requested ``shape``.\n    fill_value : number, optional\n        If ``mode='partial'``, the value to fill pixels in the extracted\n        small array that do not overlap with the input ``array_large``.\n        ``fill_value`` will be changed to have the same ``dtype`` as the\n        ``array_large`` array, with one exception. If ``array_large``\n        has integer type and ``fill_value`` is ``np.nan``, then a\n        `ValueError` will be raised.\n    return_position : bool, optional\n        If `True`, return the coordinates of ``position`` in the\n        coordinate system of the returned array.\n\n    Returns\n    -------\n    array_small : ndarray\n        The extracted array.\n    new_position : tuple\n        If ``return_position`` is true, this tuple will contain the\n        coordinates of the input ``position`` in the coordinate system\n        of ``array_small``. Note that for partially overlapping arrays,\n        ``new_position`` might actually be outside of the\n        ``array_small``; ``array_small[new_position]`` might give wrong\n        results if any element in ``new_position`` is negative.\n\n    Examples\n    --------\n    We consider a large array with the shape 11x10, from which we extract\n    a small array of shape 3x5:\n\n    >>> import numpy as np\n    >>> from astropy.nddata.utils import extract_array\n    >>> large_array = np.arange(110).reshape((11, 10))\n    >>> extract_array(large_array, (3, 5), (7, 7))\n    array([[65, 66, 67, 68, 69],\n           [75, 76, 77, 78, 79],\n           [85, 86, 87, 88, 89]])\n    \"\"\"\n\n    if np.isscalar(shape):\n        shape = (shape, )\n    if np.isscalar(position):\n        position = (position, )\n\n    if mode not in ['partial', 'trim', 'strict']:\n        raise ValueError(\"Valid modes are 'partial', 'trim', and 'strict'.\")\n\n    large_slices, small_slices = overlap_slices(array_large.shape,\n                                                shape, position, mode=mode)\n    extracted_array = array_large[large_slices]\n    if return_position:\n        new_position = [i - s.start for i, s in zip(position, large_slices)]\n\n    # Extracting on the edges is presumably a rare case, so treat special here\n    if (extracted_array.shape != shape) and (mode == 'partial'):\n        extracted_array = np.zeros(shape, dtype=array_large.dtype)\n        try:\n            extracted_array[:] = fill_value\n        except ValueError as exc:\n            exc.args += ('fill_value is inconsistent with the data type of '\n                         'the input array (e.g., fill_value cannot be set to '\n                         'np.nan if the input array has integer type). Please '\n                         'change either the input array dtype or the '\n                         'fill_value.',)\n            raise exc\n\n        extracted_array[small_slices] = array_large[large_slices]\n        if return_position:\n            new_position = [i + s.start for i, s in zip(new_position,\n                                                        small_slices)]\n    if return_position:\n        return extracted_array, tuple(new_position)\n    else:\n        return extracted_array"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":84,"id":659,"name":"log_file_format","nodeType":"Attribute","startLoc":84,"text":"log_file_format"},{"col":0,"comment":"\n    Get slices for the overlapping part of a small and a large array.\n\n    Given a certain position of the center of the small array, with\n    respect to the large array, tuples of slices are returned which can be\n    used to extract, add or subtract the small array at the given\n    position. This function takes care of the correct behavior at the\n    boundaries, where the small array is cut of appropriately.\n    Integer positions are at the pixel centers.\n\n    Parameters\n    ----------\n    large_array_shape : tuple of int or int\n        The shape of the large array (for 1D arrays, this can be an\n        `int`).\n    small_array_shape : int or tuple thereof\n        The shape of the small array (for 1D arrays, this can be an\n        `int`).  See the ``mode`` keyword for additional details.\n    position : number or tuple thereof\n        The position of the small array's center with respect to the\n        large array.  The pixel coordinates should be in the same order\n        as the array shape.  Integer positions are at the pixel centers.\n        For any axis where ``small_array_shape`` is even, the position\n        is rounded up, e.g. extracting two elements with a center of\n        ``1`` will define the extracted region as ``[0, 1]``.\n    mode : {'partial', 'trim', 'strict'}, optional\n        In ``'partial'`` mode, a partial overlap of the small and the\n        large array is sufficient.  The ``'trim'`` mode is similar to\n        the ``'partial'`` mode, but ``slices_small`` will be adjusted to\n        return only the overlapping elements.  In the ``'strict'`` mode,\n        the small array has to be fully contained in the large array,\n        otherwise an `~astropy.nddata.utils.PartialOverlapError` is\n        raised.  In all modes, non-overlapping arrays will raise a\n        `~astropy.nddata.utils.NoOverlapError`.\n\n    Returns\n    -------\n    slices_large : tuple of slice\n        A tuple of slice objects for each axis of the large array, such\n        that ``large_array[slices_large]`` extracts the region of the\n        large array that overlaps with the small array.\n    slices_small : tuple of slice\n        A tuple of slice objects for each axis of the small array, such\n        that ``small_array[slices_small]`` extracts the region that is\n        inside the large array.\n    ","endLoc":137,"header":"def overlap_slices(large_array_shape, small_array_shape, position,\n                   mode='partial')","id":660,"name":"overlap_slices","nodeType":"Function","startLoc":31,"text":"def overlap_slices(large_array_shape, small_array_shape, position,\n                   mode='partial'):\n    \"\"\"\n    Get slices for the overlapping part of a small and a large array.\n\n    Given a certain position of the center of the small array, with\n    respect to the large array, tuples of slices are returned which can be\n    used to extract, add or subtract the small array at the given\n    position. This function takes care of the correct behavior at the\n    boundaries, where the small array is cut of appropriately.\n    Integer positions are at the pixel centers.\n\n    Parameters\n    ----------\n    large_array_shape : tuple of int or int\n        The shape of the large array (for 1D arrays, this can be an\n        `int`).\n    small_array_shape : int or tuple thereof\n        The shape of the small array (for 1D arrays, this can be an\n        `int`).  See the ``mode`` keyword for additional details.\n    position : number or tuple thereof\n        The position of the small array's center with respect to the\n        large array.  The pixel coordinates should be in the same order\n        as the array shape.  Integer positions are at the pixel centers.\n        For any axis where ``small_array_shape`` is even, the position\n        is rounded up, e.g. extracting two elements with a center of\n        ``1`` will define the extracted region as ``[0, 1]``.\n    mode : {'partial', 'trim', 'strict'}, optional\n        In ``'partial'`` mode, a partial overlap of the small and the\n        large array is sufficient.  The ``'trim'`` mode is similar to\n        the ``'partial'`` mode, but ``slices_small`` will be adjusted to\n        return only the overlapping elements.  In the ``'strict'`` mode,\n        the small array has to be fully contained in the large array,\n        otherwise an `~astropy.nddata.utils.PartialOverlapError` is\n        raised.  In all modes, non-overlapping arrays will raise a\n        `~astropy.nddata.utils.NoOverlapError`.\n\n    Returns\n    -------\n    slices_large : tuple of slice\n        A tuple of slice objects for each axis of the large array, such\n        that ``large_array[slices_large]`` extracts the region of the\n        large array that overlaps with the small array.\n    slices_small : tuple of slice\n        A tuple of slice objects for each axis of the small array, such\n        that ``small_array[slices_small]`` extracts the region that is\n        inside the large array.\n    \"\"\"\n\n    if mode not in ['partial', 'trim', 'strict']:\n        raise ValueError('Mode can be only \"partial\", \"trim\", or \"strict\".')\n    if np.isscalar(small_array_shape):\n        small_array_shape = (small_array_shape, )\n    if np.isscalar(large_array_shape):\n        large_array_shape = (large_array_shape, )\n    if np.isscalar(position):\n        position = (position, )\n\n    if any(~np.isfinite(position)):\n        raise ValueError('Input position contains invalid values (NaNs or '\n                         'infs).')\n\n    if len(small_array_shape) != len(large_array_shape):\n        raise ValueError('\"large_array_shape\" and \"small_array_shape\" must '\n                         'have the same number of dimensions.')\n\n    if len(small_array_shape) != len(position):\n        raise ValueError('\"position\" must have the same number of dimensions '\n                         'as \"small_array_shape\".')\n\n    # define the min/max pixel indices\n    indices_min = [int(np.ceil(pos - (small_shape / 2.)))\n                   for (pos, small_shape) in zip(position, small_array_shape)]\n    indices_max = [int(np.ceil(pos + (small_shape / 2.)))\n                   for (pos, small_shape) in zip(position, small_array_shape)]\n\n    for e_max in indices_max:\n        if e_max < 0:\n            raise NoOverlapError('Arrays do not overlap.')\n    for e_min, large_shape in zip(indices_min, large_array_shape):\n        if e_min >= large_shape:\n            raise NoOverlapError('Arrays do not overlap.')\n\n    if mode == 'strict':\n        for e_min in indices_min:\n            if e_min < 0:\n                raise PartialOverlapError('Arrays overlap only partially.')\n        for e_max, large_shape in zip(indices_max, large_array_shape):\n            if e_max > large_shape:\n                raise PartialOverlapError('Arrays overlap only partially.')\n\n    # Set up slices\n    slices_large = tuple(slice(max(0, indices_min),\n                               min(large_shape, indices_max))\n                         for (indices_min, indices_max, large_shape) in\n                         zip(indices_min, indices_max, large_array_shape))\n    if mode == 'trim':\n        slices_small = tuple(slice(0, slc.stop - slc.start)\n                             for slc in slices_large)\n    else:\n        slices_small = tuple(slice(max(0, -indices_min),\n                                   min(large_shape - indices_min,\n                                       indices_max - indices_min))\n                             for (indices_min, indices_max, large_shape) in\n                             zip(indices_min, indices_max, large_array_shape))\n\n    return slices_large, slices_small"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":88,"id":661,"name":"log_file_encoding","nodeType":"Attribute","startLoc":88,"text":"log_file_encoding"},{"className":"AstropyLogger","col":0,"comment":"\n    This class is used to set up the Astropy logging.\n\n    The main functionality added by this class over the built-in\n    logging.Logger class is the ability to keep track of the origin of the\n    messages, the ability to enable logging of warnings.warn calls and\n    exceptions, and the addition of colorized output and context managers to\n    easily capture messages to a file or list.\n    ","endLoc":525,"id":662,"nodeType":"Class","startLoc":150,"text":"class AstropyLogger(Logger):\n    '''\n    This class is used to set up the Astropy logging.\n\n    The main functionality added by this class over the built-in\n    logging.Logger class is the ability to keep track of the origin of the\n    messages, the ability to enable logging of warnings.warn calls and\n    exceptions, and the addition of colorized output and context managers to\n    easily capture messages to a file or list.\n    '''\n\n    def makeRecord(self, name, level, pathname, lineno, msg, args, exc_info,\n                   func=None, extra=None, sinfo=None):\n        if extra is None:\n            extra = {}\n        if 'origin' not in extra:\n            current_module = find_current_module(1, finddiff=[True, 'logging'])\n            if current_module is not None:\n                extra['origin'] = current_module.__name__\n            else:\n                extra['origin'] = 'unknown'\n        return Logger.makeRecord(self, name, level, pathname, lineno, msg,\n                                 args, exc_info, func=func, extra=extra,\n                                 sinfo=sinfo)\n\n    _showwarning_orig = None\n\n    def _showwarning(self, *args, **kwargs):\n\n        # Bail out if we are not catching a warning from Astropy\n        if not isinstance(args[0], AstropyWarning):\n            return self._showwarning_orig(*args, **kwargs)\n\n        warning = args[0]\n        # Deliberately not using isinstance here: We want to display\n        # the class name only when it's not the default class,\n        # AstropyWarning.  The name of subclasses of AstropyWarning should\n        # be displayed.\n        if type(warning) not in (AstropyWarning, AstropyUserWarning):\n            message = f'{warning.__class__.__name__}: {args[0]}'\n        else:\n            message = str(args[0])\n\n        mod_path = args[2]\n        # Now that we have the module's path, we look through sys.modules to\n        # find the module object and thus the fully-package-specified module\n        # name.  The module.__file__ is the original source file name.\n        mod_name = None\n        mod_path, ext = os.path.splitext(mod_path)\n        for name, mod in list(sys.modules.items()):\n            try:\n                # Believe it or not this can fail in some cases:\n                # https://github.com/astropy/astropy/issues/2671\n                path = os.path.splitext(getattr(mod, '__file__', ''))[0]\n            except Exception:\n                continue\n            if path == mod_path:\n                mod_name = mod.__name__\n                break\n\n        if mod_name is not None:\n            self.warning(message, extra={'origin': mod_name})\n        else:\n            self.warning(message)\n\n    def warnings_logging_enabled(self):\n        return self._showwarning_orig is not None\n\n    def enable_warnings_logging(self):\n        '''\n        Enable logging of warnings.warn() calls\n\n        Once called, any subsequent calls to ``warnings.warn()`` are\n        redirected to this logger and emitted with level ``WARN``. Note that\n        this replaces the output from ``warnings.warn``.\n\n        This can be disabled with ``disable_warnings_logging``.\n        '''\n        if self.warnings_logging_enabled():\n            raise LoggingError(\"Warnings logging has already been enabled\")\n        self._showwarning_orig = warnings.showwarning\n        warnings.showwarning = self._showwarning\n\n    def disable_warnings_logging(self):\n        '''\n        Disable logging of warnings.warn() calls\n\n        Once called, any subsequent calls to ``warnings.warn()`` are no longer\n        redirected to this logger.\n\n        This can be re-enabled with ``enable_warnings_logging``.\n        '''\n        if not self.warnings_logging_enabled():\n            raise LoggingError(\"Warnings logging has not been enabled\")\n        if warnings.showwarning != self._showwarning:\n            raise LoggingError(\"Cannot disable warnings logging: \"\n                               \"warnings.showwarning was not set by this \"\n                               \"logger, or has been overridden\")\n        warnings.showwarning = self._showwarning_orig\n        self._showwarning_orig = None\n\n    _excepthook_orig = None\n\n    def _excepthook(self, etype, value, traceback):\n\n        if traceback is None:\n            mod = None\n        else:\n            tb = traceback\n            while tb.tb_next is not None:\n                tb = tb.tb_next\n            mod = inspect.getmodule(tb)\n\n        # include the the error type in the message.\n        if len(value.args) > 0:\n            message = f'{etype.__name__}: {str(value)}'\n        else:\n            message = str(etype.__name__)\n\n        if mod is not None:\n            self.error(message, extra={'origin': mod.__name__})\n        else:\n            self.error(message)\n        self._excepthook_orig(etype, value, traceback)\n\n    def exception_logging_enabled(self):\n        '''\n        Determine if the exception-logging mechanism is enabled.\n\n        Returns\n        -------\n        exclog : bool\n            True if exception logging is on, False if not.\n        '''\n        try:\n            ip = get_ipython()\n        except NameError:\n            ip = None\n\n        if ip is None:\n            return self._excepthook_orig is not None\n        else:\n            return _AstLogIPYExc in ip.custom_exceptions\n\n    def enable_exception_logging(self):\n        '''\n        Enable logging of exceptions\n\n        Once called, any uncaught exceptions will be emitted with level\n        ``ERROR`` by this logger, before being raised.\n\n        This can be disabled with ``disable_exception_logging``.\n        '''\n        try:\n            ip = get_ipython()\n        except NameError:\n            ip = None\n\n        if self.exception_logging_enabled():\n            raise LoggingError(\"Exception logging has already been enabled\")\n\n        if ip is None:\n            # standard python interpreter\n            self._excepthook_orig = sys.excepthook\n            sys.excepthook = self._excepthook\n        else:\n            # IPython has its own way of dealing with excepthook\n\n            # We need to locally define the function here, because IPython\n            # actually makes this a member function of their own class\n            def ipy_exc_handler(ipyshell, etype, evalue, tb, tb_offset=None):\n                # First use our excepthook\n                self._excepthook(etype, evalue, tb)\n\n                # Now also do IPython's traceback\n                ipyshell.showtraceback((etype, evalue, tb), tb_offset=tb_offset)\n\n            # now register the function with IPython\n            # note that we include _AstLogIPYExc so `disable_exception_logging`\n            # knows that it's disabling the right thing\n            ip.set_custom_exc((BaseException, _AstLogIPYExc), ipy_exc_handler)\n\n            # and set self._excepthook_orig to a no-op\n            self._excepthook_orig = lambda etype, evalue, tb: None\n\n    def disable_exception_logging(self):\n        '''\n        Disable logging of exceptions\n\n        Once called, any uncaught exceptions will no longer be emitted by this\n        logger.\n\n        This can be re-enabled with ``enable_exception_logging``.\n        '''\n        try:\n            ip = get_ipython()\n        except NameError:\n            ip = None\n\n        if not self.exception_logging_enabled():\n            raise LoggingError(\"Exception logging has not been enabled\")\n\n        if ip is None:\n            # standard python interpreter\n            if sys.excepthook != self._excepthook:\n                raise LoggingError(\"Cannot disable exception logging: \"\n                                   \"sys.excepthook was not set by this logger, \"\n                                   \"or has been overridden\")\n            sys.excepthook = self._excepthook_orig\n            self._excepthook_orig = None\n        else:\n            # IPython has its own way of dealing with exceptions\n            ip.set_custom_exc(tuple(), None)\n\n    def enable_color(self):\n        '''\n        Enable colorized output\n        '''\n        _conf.use_color = True\n\n    def disable_color(self):\n        '''\n        Disable colorized output\n        '''\n        _conf.use_color = False\n\n    @contextmanager\n    def log_to_file(self, filename, filter_level=None, filter_origin=None):\n        '''\n        Context manager to temporarily log messages to a file.\n\n        Parameters\n        ----------\n        filename : str\n            The file to log messages to.\n        filter_level : str\n            If set, any log messages less important than ``filter_level`` will\n            not be output to the file. Note that this is in addition to the\n            top-level filtering for the logger, so if the logger has level\n            'INFO', then setting ``filter_level`` to ``INFO`` or ``DEBUG``\n            will have no effect, since these messages are already filtered\n            out.\n        filter_origin : str\n            If set, only log messages with an origin starting with\n            ``filter_origin`` will be output to the file.\n\n        Notes\n        -----\n\n        By default, the logger already outputs log messages to a file set in\n        the Astropy configuration file. Using this context manager does not\n        stop log messages from being output to that file, nor does it stop log\n        messages from being printed to standard output.\n\n        Examples\n        --------\n\n        The context manager is used as::\n\n            with logger.log_to_file('myfile.log'):\n                # your code here\n        '''\n        encoding = conf.log_file_encoding if conf.log_file_encoding else None\n        fh = logging.FileHandler(filename, encoding=encoding)\n        if filter_level is not None:\n            fh.setLevel(filter_level)\n        if filter_origin is not None:\n            fh.addFilter(FilterOrigin(filter_origin))\n        f = logging.Formatter(conf.log_file_format)\n        fh.setFormatter(f)\n        self.addHandler(fh)\n        yield\n        fh.close()\n        self.removeHandler(fh)\n\n    @contextmanager\n    def log_to_list(self, filter_level=None, filter_origin=None):\n        '''\n        Context manager to temporarily log messages to a list.\n\n        Parameters\n        ----------\n        filename : str\n            The file to log messages to.\n        filter_level : str\n            If set, any log messages less important than ``filter_level`` will\n            not be output to the file. Note that this is in addition to the\n            top-level filtering for the logger, so if the logger has level\n            'INFO', then setting ``filter_level`` to ``INFO`` or ``DEBUG``\n            will have no effect, since these messages are already filtered\n            out.\n        filter_origin : str\n            If set, only log messages with an origin starting with\n            ``filter_origin`` will be output to the file.\n\n        Notes\n        -----\n\n        Using this context manager does not stop log messages from being\n        output to standard output.\n\n        Examples\n        --------\n\n        The context manager is used as::\n\n            with logger.log_to_list() as log_list:\n                # your code here\n        '''\n        lh = ListHandler()\n        if filter_level is not None:\n            lh.setLevel(filter_level)\n        if filter_origin is not None:\n            lh.addFilter(FilterOrigin(filter_origin))\n        self.addHandler(lh)\n        yield lh.log_list\n        self.removeHandler(lh)\n\n    def _set_defaults(self):\n        '''\n        Reset logger to its initial state\n        '''\n\n        # Reset any previously installed hooks\n        if self.warnings_logging_enabled():\n            self.disable_warnings_logging()\n        if self.exception_logging_enabled():\n            self.disable_exception_logging()\n\n        # Remove all previous handlers\n        for handler in self.handlers[:]:\n            self.removeHandler(handler)\n\n        # Set levels\n        self.setLevel(conf.log_level)\n\n        # Set up the stdout handler\n        sh = StreamHandler()\n        self.addHandler(sh)\n\n        # Set up the main log file handler if requested (but this might fail if\n        # configuration directory or log file is not writeable).\n        if conf.log_to_file:\n            log_file_path = conf.log_file_path\n\n            # \"None\" as a string because it comes from config\n            try:\n                _ASTROPY_TEST_\n                testing_mode = True\n            except NameError:\n                testing_mode = False\n\n            try:\n                if log_file_path == '' or testing_mode:\n                    log_file_path = os.path.join(\n                        _config.get_config_dir('astropy'), \"astropy.log\")\n                else:\n                    log_file_path = os.path.expanduser(log_file_path)\n\n                encoding = conf.log_file_encoding if conf.log_file_encoding else None\n                fh = logging.FileHandler(log_file_path, encoding=encoding)\n            except OSError as e:\n                warnings.warn(\n                    f'log file {log_file_path!r} could not be opened for writing: {str(e)}',\n                    RuntimeWarning)\n            else:\n                formatter = logging.Formatter(conf.log_file_format)\n                fh.setFormatter(formatter)\n                fh.setLevel(conf.log_file_level)\n                self.addHandler(fh)\n\n        if conf.log_warnings:\n            self.enable_warnings_logging()\n\n        if conf.log_exceptions:\n            self.enable_exception_logging()"},{"col":0,"comment":"null","endLoc":49,"header":"@pytest.fixture\ndef ignore_matplotlibrc()","id":663,"name":"ignore_matplotlibrc","nodeType":"Function","startLoc":43,"text":"@pytest.fixture\ndef ignore_matplotlibrc():\n    # This is a fixture for tests that use matplotlib but not pytest-mpl\n    # (which already handles rcParams)\n    from matplotlib import pyplot as plt\n    with plt.style.context({}, after_reset=True):\n        yield"},{"col":4,"comment":"null","endLoc":173,"header":"def makeRecord(self, name, level, pathname, lineno, msg, args, exc_info,\n                   func=None, extra=None, sinfo=None)","id":664,"name":"makeRecord","nodeType":"Function","startLoc":161,"text":"def makeRecord(self, name, level, pathname, lineno, msg, args, exc_info,\n                   func=None, extra=None, sinfo=None):\n        if extra is None:\n            extra = {}\n        if 'origin' not in extra:\n            current_module = find_current_module(1, finddiff=[True, 'logging'])\n            if current_module is not None:\n                extra['origin'] = current_module.__name__\n            else:\n                extra['origin'] = 'unknown'\n        return Logger.makeRecord(self, name, level, pathname, lineno, msg,\n                                 args, exc_info, func=func, extra=extra,\n                                 sinfo=sinfo)"},{"col":0,"comment":"Fixture that reduces thread switching interval.\n\n    This makes it easier to provoke race conditions.\n    ","endLoc":61,"header":"@pytest.fixture\ndef fast_thread_switching()","id":665,"name":"fast_thread_switching","nodeType":"Function","startLoc":52,"text":"@pytest.fixture\ndef fast_thread_switching():\n    \"\"\"Fixture that reduces thread switching interval.\n\n    This makes it easier to provoke race conditions.\n    \"\"\"\n    old = sys.getswitchinterval()\n    sys.setswitchinterval(1e-6)\n    yield\n    sys.setswitchinterval(old)"},{"col":0,"comment":"null","endLoc":98,"header":"def pytest_configure(config)","id":666,"name":"pytest_configure","nodeType":"Function","startLoc":64,"text":"def pytest_configure(config):\n    from astropy.utils.iers import conf as iers_conf\n\n    # Disable IERS auto download for testing\n    iers_conf.auto_download = False\n\n    builtins._pytest_running = True\n    # do not assign to matplotlibrc_cache in function scope\n    if HAS_MATPLOTLIB:\n        with warnings.catch_warnings():\n            warnings.simplefilter('ignore')\n            matplotlibrc_cache.update(matplotlib.rcParams)\n            matplotlib.rcdefaults()\n            matplotlib.use('Agg')\n\n    # Make sure we use temporary directories for the config and cache\n    # so that the tests are insensitive to local configuration. Note that this\n    # is also set in the test runner, but we need to also set it here for\n    # things to work properly in parallel mode\n\n    builtins._xdg_config_home_orig = os.environ.get('XDG_CONFIG_HOME')\n    builtins._xdg_cache_home_orig = os.environ.get('XDG_CACHE_HOME')\n\n    os.environ['XDG_CONFIG_HOME'] = tempfile.mkdtemp('astropy_config')\n    os.environ['XDG_CACHE_HOME'] = tempfile.mkdtemp('astropy_cache')\n\n    os.mkdir(os.path.join(os.environ['XDG_CONFIG_HOME'], 'astropy'))\n    os.mkdir(os.path.join(os.environ['XDG_CACHE_HOME'], 'astropy'))\n\n    config.option.astropy_header = True\n    PYTEST_HEADER_MODULES['PyERFA'] = 'erfa'\n    PYTEST_HEADER_MODULES['Cython'] = 'cython'\n    PYTEST_HEADER_MODULES['Scikit-image'] = 'skimage'\n    PYTEST_HEADER_MODULES['asdf'] = 'asdf'\n    TESTED_VERSIONS['Astropy'] = __version__"},{"attributeType":"null","col":4,"comment":"null","endLoc":159,"id":667,"name":"RUN_TESTS_DOCSTRING","nodeType":"Attribute","startLoc":159,"text":"RUN_TESTS_DOCSTRING"},{"attributeType":"null","col":4,"comment":"null","endLoc":171,"id":668,"name":"_required_dependencies","nodeType":"Attribute","startLoc":171,"text":"_required_dependencies"},{"attributeType":"null","col":4,"comment":"null","endLoc":172,"id":669,"name":"_missing_dependancy_error","nodeType":"Attribute","startLoc":172,"text":"_missing_dependancy_error"},{"attributeType":"null","col":8,"comment":"null","endLoc":100,"id":670,"name":"functions","nodeType":"Attribute","startLoc":100,"text":"functions"},{"attributeType":"null","col":8,"comment":"null","endLoc":107,"id":671,"name":"keywords","nodeType":"Attribute","startLoc":107,"text":"cls.keywords"},{"attributeType":"null","col":8,"comment":"null","endLoc":108,"id":672,"name":"doc_keywords","nodeType":"Attribute","startLoc":108,"text":"doc_keywords"},{"attributeType":"null","col":8,"comment":"null","endLoc":132,"id":673,"name":"__doc__","nodeType":"Attribute","startLoc":132,"text":"cls.run_tests.__doc__"},{"attributeType":"null","col":8,"comment":"null","endLoc":83,"id":674,"name":"base_path","nodeType":"Attribute","startLoc":83,"text":"self.base_path"},{"col":12,"endLoc":1431,"id":675,"nodeType":"Lambda","startLoc":1431,"text":"lambda xy, o: self.wcs.p2s(xy, o)['world']"},{"attributeType":"null","col":8,"comment":"null","endLoc":105,"id":676,"name":"sorted_keywords","nodeType":"Attribute","startLoc":105,"text":"sorted_keywords"},{"col":0,"comment":"null","endLoc":123,"header":"def pytest_unconfigure(config)","id":677,"name":"pytest_unconfigure","nodeType":"Function","startLoc":101,"text":"def pytest_unconfigure(config):\n    from astropy.utils.iers import conf as iers_conf\n\n    # Undo IERS auto download setting for testing\n    iers_conf.reset('auto_download')\n\n    builtins._pytest_running = False\n    # do not assign to matplotlibrc_cache in function scope\n    if HAS_MATPLOTLIB:\n        with warnings.catch_warnings():\n            warnings.simplefilter('ignore')\n            matplotlib.rcParams.update(matplotlibrc_cache)\n            matplotlibrc_cache.clear()\n\n    if builtins._xdg_config_home_orig is None:\n        os.environ.pop('XDG_CONFIG_HOME')\n    else:\n        os.environ['XDG_CONFIG_HOME'] = builtins._xdg_config_home_orig\n\n    if builtins._xdg_cache_home_orig is None:\n        os.environ.pop('XDG_CACHE_HOME')\n    else:\n        os.environ['XDG_CACHE_HOME'] = builtins._xdg_cache_home_orig"},{"col":4,"comment":"\n        Generates the path for multiple packages.\n\n        Parameters\n        ----------\n        packages : str\n            Comma separated string of packages.\n        base_path : str\n            Base path to the source code or documentation.\n        error : str\n            Error message to be raised as ``ValueError``. Individual package\n            name and path can be accessed by ``{name}`` and ``{path}``\n            respectively. No error is raised if `None`. (Default: `None`)\n        warning : str\n            Warning message to be issued. Individual package\n            name and path can be accessed by ``{name}`` and ``{path}``\n            respectively. No warning is issues if `None`. (Default: `None`)\n\n        Returns\n        -------\n        paths : list of str\n            List of strings of existing package paths.\n        ","endLoc":322,"header":"def packages_path(self, packages, base_path, error=None, warning=None)","id":678,"name":"packages_path","nodeType":"Function","startLoc":283,"text":"def packages_path(self, packages, base_path, error=None, warning=None):\n        \"\"\"\n        Generates the path for multiple packages.\n\n        Parameters\n        ----------\n        packages : str\n            Comma separated string of packages.\n        base_path : str\n            Base path to the source code or documentation.\n        error : str\n            Error message to be raised as ``ValueError``. Individual package\n            name and path can be accessed by ``{name}`` and ``{path}``\n            respectively. No error is raised if `None`. (Default: `None`)\n        warning : str\n            Warning message to be issued. Individual package\n            name and path can be accessed by ``{name}`` and ``{path}``\n            respectively. No warning is issues if `None`. (Default: `None`)\n\n        Returns\n        -------\n        paths : list of str\n            List of strings of existing package paths.\n        \"\"\"\n        packages = packages.split(\",\")\n\n        paths = []\n        for package in packages:\n            path = os.path.join(\n                base_path, package.replace('.', os.path.sep))\n            if not os.path.isdir(path):\n                info = {'name': package, 'path': path}\n                if error is not None:\n                    raise ValueError(error.format(**info))\n                if warning is not None:\n                    warnings.warn(warning.format(**info))\n            else:\n                paths.append(path)\n\n        return paths"},{"col":4,"comment":"\n        A helper function to support reading either a pair of arrays\n        or a single Nx2 array.\n        ","endLoc":1354,"header":"def _array_converter(self, func, sky, *args, ra_dec_order=False)","id":679,"name":"_array_converter","nodeType":"Function","startLoc":1281,"text":"def _array_converter(self, func, sky, *args, ra_dec_order=False):\n        \"\"\"\n        A helper function to support reading either a pair of arrays\n        or a single Nx2 array.\n        \"\"\"\n\n        def _return_list_of_arrays(axes, origin):\n            if any([x.size == 0 for x in axes]):\n                return axes\n\n            try:\n                axes = np.broadcast_arrays(*axes)\n            except ValueError:\n                raise ValueError(\n                    \"Coordinate arrays are not broadcastable to each other\")\n\n            xy = np.hstack([x.reshape((x.size, 1)) for x in axes])\n\n            if ra_dec_order and sky == 'input':\n                xy = self._denormalize_sky(xy)\n            output = func(xy, origin)\n            if ra_dec_order and sky == 'output':\n                output = self._normalize_sky(output)\n                return (output[:, 0].reshape(axes[0].shape),\n                        output[:, 1].reshape(axes[0].shape))\n            return [output[:, i].reshape(axes[0].shape)\n                    for i in range(output.shape[1])]\n\n        def _return_single_array(xy, origin):\n            if xy.shape[-1] != self.naxis:\n                raise ValueError(\n                    \"When providing two arguments, the array must be \"\n                    \"of shape (N, {})\".format(self.naxis))\n            if 0 in xy.shape:\n                return xy\n            if ra_dec_order and sky == 'input':\n                xy = self._denormalize_sky(xy)\n            result = func(xy, origin)\n            if ra_dec_order and sky == 'output':\n                result = self._normalize_sky(result)\n            return result\n\n        if len(args) == 2:\n            try:\n                xy, origin = args\n                xy = np.asarray(xy)\n                origin = int(origin)\n            except Exception:\n                raise TypeError(\n                    \"When providing two arguments, they must be \"\n                    \"(coords[N][{}], origin)\".format(self.naxis))\n            if xy.shape == () or len(xy.shape) == 1:\n                return _return_list_of_arrays([xy], origin)\n            return _return_single_array(xy, origin)\n\n        elif len(args) == self.naxis + 1:\n            axes = args[:-1]\n            origin = args[-1]\n            try:\n                axes = [np.asarray(x) for x in axes]\n                origin = int(origin)\n            except Exception:\n                raise TypeError(\n                    \"When providing more than two arguments, they must be \" +\n                    \"a 1-D array for each axis, followed by an origin.\")\n\n            return _return_list_of_arrays(axes, origin)\n\n        raise TypeError(\n            \"WCS projection has {0} dimensions, so expected 2 (an Nx{0} array \"\n            \"and the origin argument) or {1} arguments (the position in each \"\n            \"dimension, and the origin argument). Instead, {2} arguments were \"\n            \"given.\".format(\n                self.naxis, self.naxis + 1, len(args)))"},{"col":4,"comment":"\n        Create a Quantity view of some array-like input, and set the unit\n\n        By default, return a view of ``obj`` of the same class as ``self`` and\n        with the same unit.  Subclasses can override the type of class for a\n        given unit using ``__quantity_subclass__``, and can ensure properties\n        other than the unit are copied using ``__array_finalize__``.\n\n        If the given unit defines a ``_quantity_class`` of which ``self``\n        is not an instance, a view using this class is taken.\n\n        Parameters\n        ----------\n        obj : ndarray or scalar, optional\n            The array to create a view of.  If obj is a numpy or python scalar,\n            it will be converted to an array scalar.  By default, ``self``\n            is converted.\n\n        unit : unit-like, optional\n            The unit of the resulting object.  It is used to select a\n            subclass, and explicitly assigned to the view if given.\n            If not given, the subclass and unit will be that of ``self``.\n\n        Returns\n        -------\n        view : `~astropy.units.Quantity` subclass\n        ","endLoc":744,"header":"def _new_view(self, obj=None, unit=None)","id":680,"name":"_new_view","nodeType":"Function","startLoc":681,"text":"def _new_view(self, obj=None, unit=None):\n        \"\"\"\n        Create a Quantity view of some array-like input, and set the unit\n\n        By default, return a view of ``obj`` of the same class as ``self`` and\n        with the same unit.  Subclasses can override the type of class for a\n        given unit using ``__quantity_subclass__``, and can ensure properties\n        other than the unit are copied using ``__array_finalize__``.\n\n        If the given unit defines a ``_quantity_class`` of which ``self``\n        is not an instance, a view using this class is taken.\n\n        Parameters\n        ----------\n        obj : ndarray or scalar, optional\n            The array to create a view of.  If obj is a numpy or python scalar,\n            it will be converted to an array scalar.  By default, ``self``\n            is converted.\n\n        unit : unit-like, optional\n            The unit of the resulting object.  It is used to select a\n            subclass, and explicitly assigned to the view if given.\n            If not given, the subclass and unit will be that of ``self``.\n\n        Returns\n        -------\n        view : `~astropy.units.Quantity` subclass\n        \"\"\"\n        # Determine the unit and quantity subclass that we need for the view.\n        if unit is None:\n            unit = self.unit\n            quantity_subclass = self.__class__\n        elif unit is self.unit and self.__class__ is Quantity:\n            # The second part is because we should not presume what other\n            # classes want to do for the same unit.  E.g., Constant will\n            # always want to fall back to Quantity, and relies on going\n            # through `__quantity_subclass__`.\n            quantity_subclass = Quantity\n        else:\n            unit = Unit(unit)\n            quantity_subclass = getattr(unit, '_quantity_class', Quantity)\n            if isinstance(self, quantity_subclass):\n                quantity_subclass, subok = self.__quantity_subclass__(unit)\n                if subok:\n                    quantity_subclass = self.__class__\n\n        # We only want to propagate information from ``self`` to our new view,\n        # so obj should be a regular array.  By using ``np.array``, we also\n        # convert python and numpy scalars, which cannot be viewed as arrays\n        # and thus not as Quantity either, to zero-dimensional arrays.\n        # (These are turned back into scalar in `.value`)\n        # Note that for an ndarray input, the np.array call takes only double\n        # ``obj.__class is np.ndarray``. So, not worth special-casing.\n        if obj is None:\n            obj = self.view(np.ndarray)\n        else:\n            obj = np.array(obj, copy=False, subok=True)\n\n        # Take the view, set the unit, and update possible other properties\n        # such as ``info``, ``wrap_angle`` in `Longitude`, etc.\n        view = obj.view(quantity_subclass)\n        view._set_unit(unit)\n        view.__array_finalize__(self)\n        return view"},{"col":4,"comment":"null","endLoc":334,"header":"@keyword(priority=1000)\n    def coverage(self, coverage, kwargs)","id":681,"name":"coverage","nodeType":"Function","startLoc":325,"text":"@keyword(priority=1000)\n    def coverage(self, coverage, kwargs):\n        if coverage:\n            warnings.warn(\n                \"The coverage option is ignored on run_tests, since it \"\n                \"can not be made to work in that context.  Use \"\n                \"'python setup.py test --coverage' instead.\",\n                AstropyWarning)\n\n        return []"},{"col":4,"comment":"null","endLoc":213,"header":"def _showwarning(self, *args, **kwargs)","id":682,"name":"_showwarning","nodeType":"Function","startLoc":177,"text":"def _showwarning(self, *args, **kwargs):\n\n        # Bail out if we are not catching a warning from Astropy\n        if not isinstance(args[0], AstropyWarning):\n            return self._showwarning_orig(*args, **kwargs)\n\n        warning = args[0]\n        # Deliberately not using isinstance here: We want to display\n        # the class name only when it's not the default class,\n        # AstropyWarning.  The name of subclasses of AstropyWarning should\n        # be displayed.\n        if type(warning) not in (AstropyWarning, AstropyUserWarning):\n            message = f'{warning.__class__.__name__}: {args[0]}'\n        else:\n            message = str(args[0])\n\n        mod_path = args[2]\n        # Now that we have the module's path, we look through sys.modules to\n        # find the module object and thus the fully-package-specified module\n        # name.  The module.__file__ is the original source file name.\n        mod_name = None\n        mod_path, ext = os.path.splitext(mod_path)\n        for name, mod in list(sys.modules.items()):\n            try:\n                # Believe it or not this can fail in some cases:\n                # https://github.com/astropy/astropy/issues/2671\n                path = os.path.splitext(getattr(mod, '__file__', ''))[0]\n            except Exception:\n                continue\n            if path == mod_path:\n                mod_name = mod.__name__\n                break\n\n        if mod_name is not None:\n            self.warning(message, extra={'origin': mod_name})\n        else:\n            self.warning(message)"},{"col":4,"comment":"null","endLoc":37,"header":"def __init__(self, default_value=None, priority=0)","id":683,"name":"__init__","nodeType":"Function","startLoc":35,"text":"def __init__(self, default_value=None, priority=0):\n        self.default_value = default_value\n        self.priority = priority"},{"col":4,"comment":"\n        package : str, optional\n            The name of a specific package to test, e.g. 'io.fits' or\n            'utils'. Accepts comma separated string to specify multiple\n            packages. If nothing is specified all default tests are run.\n        ","endLoc":357,"header":"@keyword(priority=1)\n    def package(self, package, kwargs)","id":684,"name":"package","nodeType":"Function","startLoc":338,"text":"@keyword(priority=1)\n    def package(self, package, kwargs):\n        \"\"\"\n        package : str, optional\n            The name of a specific package to test, e.g. 'io.fits' or\n            'utils'. Accepts comma separated string to specify multiple\n            packages. If nothing is specified all default tests are run.\n        \"\"\"\n        if package is None:\n            self.package_path = [self.base_path]\n        else:\n            error_message = ('package to test is not found: {name} '\n                             '(at path {path}).')\n            self.package_path = self.packages_path(package, self.base_path,\n                                                   error=error_message)\n\n        if not kwargs['test_path']:\n            return self.package_path\n\n        return []"},{"col":0,"comment":"Output a warning to IPython users in case any tests failed.","endLoc":146,"header":"def pytest_terminal_summary(terminalreporter)","id":685,"name":"pytest_terminal_summary","nodeType":"Function","startLoc":126,"text":"def pytest_terminal_summary(terminalreporter):\n    \"\"\"Output a warning to IPython users in case any tests failed.\"\"\"\n\n    try:\n        get_ipython()\n    except NameError:\n        return\n\n    if not terminalreporter.stats.get('failed'):\n        # Only issue the warning when there are actually failures\n        return\n\n    terminalreporter.ensure_newline()\n    terminalreporter.write_line(\n        'Some tests may fail when run from the IPython prompt; '\n        'especially, but not limited to tests involving logging and warning '\n        'handling.  Unless you are certain as to the cause of the failure, '\n        'please check that the failure occurs outside IPython as well.  See '\n        'https://docs.astropy.org/en/stable/known_issues.html#failing-logging-'\n        'tests-when-running-the-tests-in-ipython for more information.',\n        yellow=True, bold=True)"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":686,"name":"PYTEST_HEADER_MODULES","nodeType":"Attribute","startLoc":16,"text":"PYTEST_HEADER_MODULES"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":687,"name":"TESTED_VERSIONS","nodeType":"Attribute","startLoc":17,"text":"TESTED_VERSIONS"},{"attributeType":"null","col":0,"comment":"null","endLoc":40,"id":688,"name":"matplotlibrc_cache","nodeType":"Attribute","startLoc":40,"text":"matplotlibrc_cache"},{"col":0,"comment":"","endLoc":6,"header":"conftest.py#<anonymous>","id":689,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis file contains pytest configuration settings that are astropy-specific\n(i.e.  those that would not necessarily be shared by affiliated packages\nmaking use of astropy's test runner).\n\"\"\"\n\ntry:\n    from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS\nexcept ImportError:\n    PYTEST_HEADER_MODULES = {}\n    TESTED_VERSIONS = {}\n\nif getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):\n    # The above checks whether we are running in a PyInstaller bundle.\n    warnings.filterwarnings(\"ignore\", \"(?s).*MATPLOTLIBDATA.*\",\n                            category=UserWarning)\n\nif HAS_MATPLOTLIB:\n    import matplotlib\n\nmatplotlibrc_cache = {}"},{"id":690,"name":"astropy/io","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io","id":691,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis subpackage contains modules and packages for interpreting data storage\nformats used by and in astropy.\n\"\"\"\n"},{"col":0,"comment":"","endLoc":5,"header":"__init__.py#<anonymous>","id":692,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis subpackage contains modules and packages for interpreting data storage\nformats used by and in astropy.\n\"\"\""},{"id":693,"name":"astropy/io/fits","nodeType":"Package"},{"id":694,"name":"_utils.pyx","nodeType":"TextFile","path":"astropy/io/fits","text":"# cython: language_level=3\nfrom collections import OrderedDict\n\ncdef Py_ssize_t BLOCK_SIZE = 2880  # the FITS block size\ncdef Py_ssize_t CARD_LENGTH = 80\ncdef str VALUE_INDICATOR = '= '  # The standard FITS value indicator\ncdef str END_CARD = 'END' + ' ' * 77\n\n\ndef parse_header(fileobj):\n    \"\"\"Fast (and incomplete) parser for FITS headers.\n\n    This parser only reads the standard 8 character keywords, and ignores the\n    CONTINUE, COMMENT, HISTORY and HIERARCH cards. The goal is to find quickly\n    the structural keywords needed to build the HDU objects.\n\n    The implementation is straightforward: first iterate on the 2880-bytes\n    blocks, then iterate on the 80-bytes cards, find the value separator, and\n    store the parsed (keyword, card image) in a dictionary.\n\n    \"\"\"\n\n    cards = OrderedDict()\n    cdef list read_blocks = []\n    cdef int found_end = 0\n    cdef bytes block\n    cdef str header_str, block_str, card_image, keyword\n    cdef Py_ssize_t idx, end_idx, sep_idx\n\n    while found_end == 0:\n        # iterate on blocks\n        block = fileobj.read(BLOCK_SIZE)\n        if not block or len(block) < BLOCK_SIZE:\n            # header looks incorrect, raising exception to fall back to\n            # the full Header parsing\n            raise Exception\n\n        block_str = block.decode('ascii')\n        read_blocks.append(block_str)\n        idx = 0\n        while idx < BLOCK_SIZE:\n            # iterate on cards\n            end_idx = idx + CARD_LENGTH\n            card_image = block_str[idx:end_idx]\n            idx = end_idx\n\n            # We are interested only in standard keyword, so we skip\n            # other cards, e.g. CONTINUE, HIERARCH, COMMENT.\n            if card_image[8:10] == VALUE_INDICATOR:\n                # ok, found standard keyword\n                keyword = card_image[:8].strip()\n                cards[keyword.upper()] = card_image\n            else:\n                sep_idx = card_image.find(VALUE_INDICATOR, 0, 8)\n                if sep_idx > 0:\n                    keyword = card_image[:sep_idx]\n                    cards[keyword.upper()] = card_image\n                elif card_image == END_CARD:\n                    found_end = 1\n                    break\n\n    # we keep the full header string as it may be needed later to\n    # create a Header object\n    header_str = ''.join(read_blocks)\n    return header_str, cards\n"},{"col":4,"comment":"\n        test_path : str, optional\n            Specify location to test by path. May be a single file or\n            directory. Must be specified absolutely or relative to the\n            calling directory.\n        ","endLoc":400,"header":"@keyword()\n    def test_path(self, test_path, kwargs)","id":695,"name":"test_path","nodeType":"Function","startLoc":359,"text":"@keyword()\n    def test_path(self, test_path, kwargs):\n        \"\"\"\n        test_path : str, optional\n            Specify location to test by path. May be a single file or\n            directory. Must be specified absolutely or relative to the\n            calling directory.\n        \"\"\"\n        all_args = []\n        # Ensure that the package kwarg has been run.\n        self.package(kwargs['package'], kwargs)\n        if test_path:\n            base, ext = os.path.splitext(test_path)\n\n            if ext in ('.rst', ''):\n                if kwargs['docs_path'] is None:\n                    # This shouldn't happen from \"python setup.py test\"\n                    raise ValueError(\n                        \"Can not test .rst files without a docs_path \"\n                        \"specified.\")\n\n                abs_docs_path = os.path.abspath(kwargs['docs_path'])\n                abs_test_path = os.path.abspath(\n                    os.path.join(abs_docs_path, os.pardir, test_path))\n\n                common = os.path.commonprefix((abs_docs_path, abs_test_path))\n\n                if os.path.exists(abs_test_path) and common == abs_docs_path:\n                    # Turn on the doctest_rst plugin\n                    all_args.append('--doctest-rst')\n                    test_path = abs_test_path\n\n            # Check that the extensions are in the path and not at the end to\n            # support specifying the name of the test, i.e.\n            # test_quantity.py::test_unit\n            if not (os.path.isdir(test_path) or ('.py' in test_path or '.rst' in test_path)):\n                raise ValueError(\"Test path must be a directory or a path to \"\n                                 \"a .py or .rst file\")\n\n            return all_args + [test_path]\n\n        return []"},{"fileName":"fitsrec.py","filePath":"astropy/io/fits","id":696,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport copy\nimport operator\nimport warnings\nimport weakref\n\nfrom contextlib import suppress\nfrom functools import reduce\n\nimport numpy as np\n\nfrom numpy import char as chararray\n\nfrom .column import (ASCIITNULL, FITS2NUMPY, ASCII2NUMPY, ASCII2STR, ColDefs,\n                     _AsciiColDefs, _FormatX, _FormatP, _VLF, _get_index,\n                     _wrapx, _unwrapx, _makep, Delayed)\nfrom .util import decode_ascii, encode_ascii, _rstrip_inplace\nfrom astropy.utils import lazyproperty\n\n\nclass FITS_record:\n    \"\"\"\n    FITS record class.\n\n    `FITS_record` is used to access records of the `FITS_rec` object.\n    This will allow us to deal with scaled columns.  It also handles\n    conversion/scaling of columns in ASCII tables.  The `FITS_record`\n    class expects a `FITS_rec` object as input.\n    \"\"\"\n\n    def __init__(self, input, row=0, start=None, end=None, step=None,\n                 base=None, **kwargs):\n        \"\"\"\n        Parameters\n        ----------\n        input : array\n            The array to wrap.\n        row : int, optional\n            The starting logical row of the array.\n        start : int, optional\n            The starting column in the row associated with this object.\n            Used for subsetting the columns of the `FITS_rec` object.\n        end : int, optional\n            The ending column in the row associated with this object.\n            Used for subsetting the columns of the `FITS_rec` object.\n        \"\"\"\n\n        self.array = input\n        self.row = row\n        if base:\n            width = len(base)\n        else:\n            width = self.array._nfields\n\n        s = slice(start, end, step).indices(width)\n        self.start, self.end, self.step = s\n        self.base = base\n\n    def __getitem__(self, key):\n        if isinstance(key, str):\n            indx = _get_index(self.array.names, key)\n\n            if indx < self.start or indx > self.end - 1:\n                raise KeyError(f\"Key '{key}' does not exist.\")\n        elif isinstance(key, slice):\n            return type(self)(self.array, self.row, key.start, key.stop,\n                              key.step, self)\n        else:\n            indx = self._get_index(key)\n\n            if indx > self.array._nfields - 1:\n                raise IndexError('Index out of bounds')\n\n        return self.array.field(indx)[self.row]\n\n    def __setitem__(self, key, value):\n        if isinstance(key, str):\n            indx = _get_index(self.array.names, key)\n\n            if indx < self.start or indx > self.end - 1:\n                raise KeyError(f\"Key '{key}' does not exist.\")\n        elif isinstance(key, slice):\n            for indx in range(slice.start, slice.stop, slice.step):\n                indx = self._get_indx(indx)\n                self.array.field(indx)[self.row] = value\n        else:\n            indx = self._get_index(key)\n            if indx > self.array._nfields - 1:\n                raise IndexError('Index out of bounds')\n\n        self.array.field(indx)[self.row] = value\n\n    def __len__(self):\n        return len(range(self.start, self.end, self.step))\n\n    def __repr__(self):\n        \"\"\"\n        Display a single row.\n        \"\"\"\n\n        outlist = []\n        for idx in range(len(self)):\n            outlist.append(repr(self[idx]))\n        return f\"({', '.join(outlist)})\"\n\n    def field(self, field):\n        \"\"\"\n        Get the field data of the record.\n        \"\"\"\n\n        return self.__getitem__(field)\n\n    def setfield(self, field, value):\n        \"\"\"\n        Set the field data of the record.\n        \"\"\"\n\n        self.__setitem__(field, value)\n\n    @lazyproperty\n    def _bases(self):\n        bases = [weakref.proxy(self)]\n        base = self.base\n        while base:\n            bases.append(base)\n            base = base.base\n        return bases\n\n    def _get_index(self, indx):\n        indices = np.ogrid[:self.array._nfields]\n        for base in reversed(self._bases):\n            if base.step < 1:\n                s = slice(base.start, None, base.step)\n            else:\n                s = slice(base.start, base.end, base.step)\n            indices = indices[s]\n        return indices[indx]\n\n\nclass FITS_rec(np.recarray):\n    \"\"\"\n    FITS record array class.\n\n    `FITS_rec` is the data part of a table HDU's data part.  This is a layer\n    over the `~numpy.recarray`, so we can deal with scaled columns.\n\n    It inherits all of the standard methods from `numpy.ndarray`.\n    \"\"\"\n\n    _record_type = FITS_record\n    _character_as_bytes = False\n\n    def __new__(subtype, input):\n        \"\"\"\n        Construct a FITS record array from a recarray.\n        \"\"\"\n\n        # input should be a record array\n        if input.dtype.subdtype is None:\n            self = np.recarray.__new__(subtype, input.shape, input.dtype,\n                                       buf=input.data)\n        else:\n            self = np.recarray.__new__(subtype, input.shape, input.dtype,\n                                       buf=input.data, strides=input.strides)\n\n        self._init()\n        if self.dtype.fields:\n            self._nfields = len(self.dtype.fields)\n\n        return self\n\n    def __setstate__(self, state):\n        meta = state[-1]\n        column_state = state[-2]\n        state = state[:-2]\n\n        super().__setstate__(state)\n\n        self._col_weakrefs = weakref.WeakSet()\n\n        for attr, value in zip(meta, column_state):\n            setattr(self, attr, value)\n\n    def __reduce__(self):\n        \"\"\"\n        Return a 3-tuple for pickling a FITS_rec. Use the super-class\n        functionality but then add in a tuple of FITS_rec-specific\n        values that get used in __setstate__.\n        \"\"\"\n\n        reconst_func, reconst_func_args, state = super().__reduce__()\n\n        # Define FITS_rec-specific attrs that get added to state\n        column_state = []\n        meta = []\n\n        for attrs in ['_converted', '_heapoffset', '_heapsize', '_nfields',\n                      '_gap', '_uint', 'parnames', '_coldefs']:\n\n            with suppress(AttributeError):\n                # _coldefs can be Delayed, and file objects cannot be\n                # picked, it needs to be deepcopied first\n                if attrs == '_coldefs':\n                    column_state.append(self._coldefs.__deepcopy__(None))\n                else:\n                    column_state.append(getattr(self, attrs))\n                meta.append(attrs)\n\n        state = state + (column_state, meta)\n\n        return reconst_func, reconst_func_args, state\n\n    def __array_finalize__(self, obj):\n        if obj is None:\n            return\n\n        if isinstance(obj, FITS_rec):\n            self._character_as_bytes = obj._character_as_bytes\n\n        if isinstance(obj, FITS_rec) and obj.dtype == self.dtype:\n            self._converted = obj._converted\n            self._heapoffset = obj._heapoffset\n            self._heapsize = obj._heapsize\n            self._col_weakrefs = obj._col_weakrefs\n            self._coldefs = obj._coldefs\n            self._nfields = obj._nfields\n            self._gap = obj._gap\n            self._uint = obj._uint\n        elif self.dtype.fields is not None:\n            # This will allow regular ndarrays with fields, rather than\n            # just other FITS_rec objects\n            self._nfields = len(self.dtype.fields)\n            self._converted = {}\n\n            self._heapoffset = getattr(obj, '_heapoffset', 0)\n            self._heapsize = getattr(obj, '_heapsize', 0)\n\n            self._gap = getattr(obj, '_gap', 0)\n            self._uint = getattr(obj, '_uint', False)\n            self._col_weakrefs = weakref.WeakSet()\n            self._coldefs = ColDefs(self)\n\n            # Work around chicken-egg problem.  Column.array relies on the\n            # _coldefs attribute to set up ref back to parent FITS_rec; however\n            # in the above line the self._coldefs has not been assigned yet so\n            # this fails.  This patches that up...\n            for col in self._coldefs:\n                del col.array\n                col._parent_fits_rec = weakref.ref(self)\n        else:\n            self._init()\n\n    def _init(self):\n        \"\"\"Initializes internal attributes specific to FITS-isms.\"\"\"\n\n        self._nfields = 0\n        self._converted = {}\n        self._heapoffset = 0\n        self._heapsize = 0\n        self._col_weakrefs = weakref.WeakSet()\n        self._coldefs = None\n        self._gap = 0\n        self._uint = False\n\n    @classmethod\n    def from_columns(cls, columns, nrows=0, fill=False, character_as_bytes=False):\n        \"\"\"\n        Given a `ColDefs` object of unknown origin, initialize a new `FITS_rec`\n        object.\n\n        .. note::\n\n            This was originally part of the ``new_table`` function in the table\n            module but was moved into a class method since most of its\n            functionality always had more to do with initializing a `FITS_rec`\n            object than anything else, and much of it also overlapped with\n            ``FITS_rec._scale_back``.\n\n        Parameters\n        ----------\n        columns : sequence of `Column` or a `ColDefs`\n            The columns from which to create the table data.  If these\n            columns have data arrays attached that data may be used in\n            initializing the new table.  Otherwise the input columns\n            will be used as a template for a new table with the requested\n            number of rows.\n\n        nrows : int\n            Number of rows in the new table.  If the input columns have data\n            associated with them, the size of the largest input column is used.\n            Otherwise the default is 0.\n\n        fill : bool\n            If `True`, will fill all cells with zeros or blanks.  If\n            `False`, copy the data from input, undefined cells will still\n            be filled with zeros/blanks.\n        \"\"\"\n\n        if not isinstance(columns, ColDefs):\n            columns = ColDefs(columns)\n\n        # read the delayed data\n        for column in columns:\n            arr = column.array\n            if isinstance(arr, Delayed):\n                if arr.hdu.data is None:\n                    column.array = None\n                else:\n                    column.array = _get_recarray_field(arr.hdu.data,\n                                                       arr.field)\n        # Reset columns._arrays (which we may want to just do away with\n        # altogether\n        del columns._arrays\n\n        # use the largest column shape as the shape of the record\n        if nrows == 0:\n            for arr in columns._arrays:\n                if arr is not None:\n                    dim = arr.shape[0]\n                else:\n                    dim = 0\n                if dim > nrows:\n                    nrows = dim\n\n        raw_data = np.empty(columns.dtype.itemsize * nrows, dtype=np.uint8)\n        raw_data.fill(ord(columns._padding_byte))\n        data = np.recarray(nrows, dtype=columns.dtype, buf=raw_data).view(cls)\n        data._character_as_bytes = character_as_bytes\n\n        # Previously this assignment was made from hdu.columns, but that's a\n        # bug since if a _TableBaseHDU has a FITS_rec in its .data attribute\n        # the _TableBaseHDU.columns property is actually returned from\n        # .data._coldefs, so this assignment was circular!  Don't make that\n        # mistake again.\n        # All of this is an artifact of the fragility of the FITS_rec class,\n        # and that it can't just be initialized by columns...\n        data._coldefs = columns\n\n        # If fill is True we don't copy anything from the column arrays.  We're\n        # just using them as a template, and returning a table filled with\n        # zeros/blanks\n        if fill:\n            return data\n\n        # Otherwise we have to fill the recarray with data from the input\n        # columns\n        for idx, column in enumerate(columns):\n            # For each column in the ColDef object, determine the number of\n            # rows in that column.  This will be either the number of rows in\n            # the ndarray associated with the column, or the number of rows\n            # given in the call to this function, which ever is smaller.  If\n            # the input FILL argument is true, the number of rows is set to\n            # zero so that no data is copied from the original input data.\n            arr = column.array\n\n            if arr is None:\n                array_size = 0\n            else:\n                array_size = len(arr)\n\n            n = min(array_size, nrows)\n\n            # TODO: At least *some* of this logic is mostly redundant with the\n            # _convert_foo methods in this class; see if we can eliminate some\n            # of that duplication.\n\n            if not n:\n                # The input column had an empty array, so just use the fill\n                # value\n                continue\n\n            field = _get_recarray_field(data, idx)\n            name = column.name\n            fitsformat = column.format\n            recformat = fitsformat.recformat\n\n            outarr = field[:n]\n            inarr = arr[:n]\n\n            if isinstance(recformat, _FormatX):\n                # Data is a bit array\n                if inarr.shape[-1] == recformat.repeat:\n                    _wrapx(inarr, outarr, recformat.repeat)\n                    continue\n            elif isinstance(recformat, _FormatP):\n                data._cache_field(name, _makep(inarr, field, recformat,\n                                               nrows=nrows))\n                continue\n            # TODO: Find a better way of determining that the column is meant\n            # to be FITS L formatted\n            elif recformat[-2:] == FITS2NUMPY['L'] and inarr.dtype == bool:\n                # column is boolean\n                # The raw data field should be filled with either 'T' or 'F'\n                # (not 0).  Use 'F' as a default\n                field[:] = ord('F')\n                # Also save the original boolean array in data._converted so\n                # that it doesn't have to be re-converted\n                converted = np.zeros(field.shape, dtype=bool)\n                converted[:n] = inarr\n                data._cache_field(name, converted)\n                # TODO: Maybe this step isn't necessary at all if _scale_back\n                # will handle it?\n                inarr = np.where(inarr == np.False_, ord('F'), ord('T'))\n            elif (columns[idx]._physical_values and\n                    columns[idx]._pseudo_unsigned_ints):\n                # Temporary hack...\n                bzero = column.bzero\n                converted = np.zeros(field.shape, dtype=inarr.dtype)\n                converted[:n] = inarr\n                data._cache_field(name, converted)\n                if n < nrows:\n                    # Pre-scale rows below the input data\n                    field[n:] = -bzero\n\n                inarr = inarr - bzero\n            elif isinstance(columns, _AsciiColDefs):\n                # Regardless whether the format is character or numeric, if the\n                # input array contains characters then it's already in the raw\n                # format for ASCII tables\n                if fitsformat._pseudo_logical:\n                    # Hack to support converting from 8-bit T/F characters\n                    # Normally the column array is a chararray of 1 character\n                    # strings, but we need to view it as a normal ndarray of\n                    # 8-bit ints to fill it with ASCII codes for 'T' and 'F'\n                    outarr = field.view(np.uint8, np.ndarray)[:n]\n                elif arr.dtype.kind not in ('S', 'U'):\n                    # Set up views of numeric columns with the appropriate\n                    # numeric dtype\n                    # Fill with the appropriate blanks for the column format\n                    data._cache_field(name, np.zeros(nrows, dtype=arr.dtype))\n                    outarr = data._converted[name][:n]\n\n                outarr[:] = inarr\n                continue\n\n            if inarr.shape != outarr.shape:\n                if (inarr.dtype.kind == outarr.dtype.kind and\n                        inarr.dtype.kind in ('U', 'S') and\n                        inarr.dtype != outarr.dtype):\n\n                    inarr_rowsize = inarr[0].size\n                    inarr = inarr.flatten().view(outarr.dtype)\n\n                # This is a special case to handle input arrays with\n                # non-trivial TDIMn.\n                # By design each row of the outarray is 1-D, while each row of\n                # the input array may be n-D\n                if outarr.ndim > 1:\n                    # The normal case where the first dimension is the rows\n                    inarr_rowsize = inarr[0].size\n                    inarr = inarr.reshape(n, inarr_rowsize)\n                    outarr[:, :inarr_rowsize] = inarr\n                else:\n                    # Special case for strings where the out array only has one\n                    # dimension (the second dimension is rolled up into the\n                    # strings\n                    outarr[:n] = inarr.ravel()\n            else:\n                outarr[:] = inarr\n\n        # Now replace the original column array references with the new\n        # fields\n        # This is required to prevent the issue reported in\n        # https://github.com/spacetelescope/PyFITS/issues/99\n        for idx in range(len(columns)):\n            columns._arrays[idx] = data.field(idx)\n\n        return data\n\n    def __repr__(self):\n        # Force use of the normal ndarray repr (rather than the new\n        # one added for recarray in Numpy 1.10) for backwards compat\n        return np.ndarray.__repr__(self)\n\n    def __getattribute__(self, attr):\n        # First, see if ndarray has this attr, and return it if so. Note that\n        # this means a field with the same name as an ndarray attr cannot be\n        # accessed by attribute, this is Numpy's default behavior.\n        # We avoid using np.recarray.__getattribute__ here because after doing\n        # this check it would access the columns without doing the conversions\n        # that we need (with .field, see below).\n        try:\n            return object.__getattribute__(self, attr)\n        except AttributeError:\n            pass\n\n        # attr might still be a fieldname.  If we have column definitions,\n        # we should access this via .field, as the data may have to be scaled.\n        if self._coldefs is not None and attr in self.columns.names:\n            return self.field(attr)\n\n        # If not, just let the usual np.recarray override deal with it.\n        return super().__getattribute__(attr)\n\n    def __getitem__(self, key):\n        if self._coldefs is None:\n            return super().__getitem__(key)\n\n        if isinstance(key, str):\n            return self.field(key)\n\n        # Have to view as a recarray then back as a FITS_rec, otherwise the\n        # circular reference fix/hack in FITS_rec.field() won't preserve\n        # the slice.\n        out = self.view(np.recarray)[key]\n        if type(out) is not np.recarray:\n            # Oops, we got a single element rather than a view. In that case,\n            # return a Record, which has no __getstate__ and is more efficient.\n            return self._record_type(self, key)\n\n        # We got a view; change it back to our class, and add stuff\n        out = out.view(type(self))\n        out._uint = self._uint\n        out._coldefs = ColDefs(self._coldefs)\n        arrays = []\n        out._converted = {}\n        for idx, name in enumerate(self._coldefs.names):\n            #\n            # Store the new arrays for the _coldefs object\n            #\n            arrays.append(self._coldefs._arrays[idx][key])\n\n            # Ensure that the sliced FITS_rec will view the same scaled\n            # columns as the original; this is one of the few cases where\n            # it is not necessary to use _cache_field()\n            if name in self._converted:\n                dummy = self._converted[name]\n                field = np.ndarray.__getitem__(dummy, key)\n                out._converted[name] = field\n\n        out._coldefs._arrays = arrays\n        return out\n\n    def __setitem__(self, key, value):\n        if self._coldefs is None:\n            return super().__setitem__(key, value)\n\n        if isinstance(key, str):\n            self[key][:] = value\n            return\n\n        if isinstance(key, slice):\n            end = min(len(self), key.stop or len(self))\n            end = max(0, end)\n            start = max(0, key.start or 0)\n            end = min(end, start + len(value))\n\n            for idx in range(start, end):\n                self.__setitem__(idx, value[idx - start])\n            return\n\n        if isinstance(value, FITS_record):\n            for idx in range(self._nfields):\n                self.field(self.names[idx])[key] = value.field(self.names[idx])\n        elif isinstance(value, (tuple, list, np.void)):\n            if self._nfields == len(value):\n                for idx in range(self._nfields):\n                    self.field(idx)[key] = value[idx]\n            else:\n                raise ValueError('Input tuple or list required to have {} '\n                                 'elements.'.format(self._nfields))\n        else:\n            raise TypeError('Assignment requires a FITS_record, tuple, or '\n                            'list as input.')\n\n    def _ipython_key_completions_(self):\n        return self.names\n\n    def copy(self, order='C'):\n        \"\"\"\n        The Numpy documentation lies; `numpy.ndarray.copy` is not equivalent to\n        `numpy.copy`.  Differences include that it re-views the copied array as\n        self's ndarray subclass, as though it were taking a slice; this means\n        ``__array_finalize__`` is called and the copy shares all the array\n        attributes (including ``._converted``!).  So we need to make a deep\n        copy of all those attributes so that the two arrays truly do not share\n        any data.\n        \"\"\"\n\n        new = super().copy(order=order)\n\n        new.__dict__ = copy.deepcopy(self.__dict__)\n        return new\n\n    @property\n    def columns(self):\n        \"\"\"A user-visible accessor for the coldefs.\"\"\"\n\n        return self._coldefs\n\n    @property\n    def _coldefs(self):\n        # This used to be a normal internal attribute, but it was changed to a\n        # property as a quick and transparent way to work around the reference\n        # leak bug fixed in https://github.com/astropy/astropy/pull/4539\n        #\n        # See the long comment in the Column.array property for more details\n        # on this.  But in short, FITS_rec now has a ._col_weakrefs attribute\n        # which is a WeakSet of weakrefs to each Column in _coldefs.\n        #\n        # So whenever ._coldefs is set we also add each Column in the ColDefs\n        # to the weakrefs set.  This is an easy way to find out if a Column has\n        # any references to it external to the FITS_rec (i.e. a user assigned a\n        # column to a variable).  If the column is still in _col_weakrefs then\n        # there are other references to it external to this FITS_rec.  We use\n        # that information in __del__ to save off copies of the array data\n        # for those columns to their Column.array property before our memory\n        # is freed.\n        return self.__dict__.get('_coldefs')\n\n    @_coldefs.setter\n    def _coldefs(self, cols):\n        self.__dict__['_coldefs'] = cols\n        if isinstance(cols, ColDefs):\n            for col in cols.columns:\n                self._col_weakrefs.add(col)\n\n    @_coldefs.deleter\n    def _coldefs(self):\n        try:\n            del self.__dict__['_coldefs']\n        except KeyError as exc:\n            raise AttributeError(exc.args[0])\n\n    def __del__(self):\n        try:\n            del self._coldefs\n            if self.dtype.fields is not None:\n                for col in self._col_weakrefs:\n\n                    if col.array is not None:\n                        col.array = col.array.copy()\n\n        # See issues #4690 and #4912\n        except (AttributeError, TypeError):  # pragma: no cover\n            pass\n\n    @property\n    def names(self):\n        \"\"\"List of column names.\"\"\"\n\n        if self.dtype.fields:\n            return list(self.dtype.names)\n        elif getattr(self, '_coldefs', None) is not None:\n            return self._coldefs.names\n        else:\n            return None\n\n    @property\n    def formats(self):\n        \"\"\"List of column FITS formats.\"\"\"\n\n        if getattr(self, '_coldefs', None) is not None:\n            return self._coldefs.formats\n\n        return None\n\n    @property\n    def _raw_itemsize(self):\n        \"\"\"\n        Returns the size of row items that would be written to the raw FITS\n        file, taking into account the possibility of unicode columns being\n        compactified.\n\n        Currently for internal use only.\n        \"\"\"\n\n        if _has_unicode_fields(self):\n            total_itemsize = 0\n            for field in self.dtype.fields.values():\n                itemsize = field[0].itemsize\n                if field[0].kind == 'U':\n                    itemsize = itemsize // 4\n                total_itemsize += itemsize\n            return total_itemsize\n        else:\n            # Just return the normal itemsize\n            return self.itemsize\n\n    def field(self, key):\n        \"\"\"\n        A view of a `Column`'s data as an array.\n        \"\"\"\n\n        # NOTE: The *column* index may not be the same as the field index in\n        # the recarray, if the column is a phantom column\n        column = self.columns[key]\n        name = column.name\n        format = column.format\n\n        if format.dtype.itemsize == 0:\n            warnings.warn(\n                'Field {!r} has a repeat count of 0 in its format code, '\n                'indicating an empty field.'.format(key))\n            return np.array([], dtype=format.dtype)\n\n        # If field's base is a FITS_rec, we can run into trouble because it\n        # contains a reference to the ._coldefs object of the original data;\n        # this can lead to a circular reference; see ticket #49\n        base = self\n        while (isinstance(base, FITS_rec) and\n                isinstance(base.base, np.recarray)):\n            base = base.base\n        # base could still be a FITS_rec in some cases, so take care to\n        # use rec.recarray.field to avoid a potential infinite\n        # recursion\n        field = _get_recarray_field(base, name)\n\n        if name not in self._converted:\n            recformat = format.recformat\n            # TODO: If we're now passing the column to these subroutines, do we\n            # really need to pass them the recformat?\n            if isinstance(recformat, _FormatP):\n                # for P format\n                converted = self._convert_p(column, field, recformat)\n            else:\n                # Handle all other column data types which are fixed-width\n                # fields\n                converted = self._convert_other(column, field, recformat)\n\n            # Note: Never assign values directly into the self._converted dict;\n            # always go through self._cache_field; this way self._converted is\n            # only used to store arrays that are not already direct views of\n            # our own data.\n            self._cache_field(name, converted)\n            return converted\n\n        return self._converted[name]\n\n    def _cache_field(self, name, field):\n        \"\"\"\n        Do not store fields in _converted if one of its bases is self,\n        or if it has a common base with self.\n\n        This results in a reference cycle that cannot be broken since\n        ndarrays do not participate in cyclic garbage collection.\n        \"\"\"\n\n        base = field\n        while True:\n            self_base = self\n            while True:\n                if self_base is base:\n                    return\n\n                if getattr(self_base, 'base', None) is not None:\n                    self_base = self_base.base\n                else:\n                    break\n\n            if getattr(base, 'base', None) is not None:\n                base = base.base\n            else:\n                break\n\n        self._converted[name] = field\n\n    def _update_column_attribute_changed(self, column, idx, attr, old_value,\n                                         new_value):\n        \"\"\"\n        Update how the data is formatted depending on changes to column\n        attributes initiated by the user through the `Column` interface.\n\n        Dispatches column attribute change notifications to individual methods\n        for each attribute ``_update_column_<attr>``\n        \"\"\"\n\n        method_name = f'_update_column_{attr}'\n        if hasattr(self, method_name):\n            # Right now this is so we can be lazy and not implement updaters\n            # for every attribute yet--some we may not need at all, TBD\n            getattr(self, method_name)(column, idx, old_value, new_value)\n\n    def _update_column_name(self, column, idx, old_name, name):\n        \"\"\"Update the dtype field names when a column name is changed.\"\"\"\n\n        dtype = self.dtype\n        # Updating the names on the dtype should suffice\n        dtype.names = dtype.names[:idx] + (name,) + dtype.names[idx + 1:]\n\n    def _convert_x(self, field, recformat):\n        \"\"\"Convert a raw table column to a bit array as specified by the\n        FITS X format.\n        \"\"\"\n\n        dummy = np.zeros(self.shape + (recformat.repeat,), dtype=np.bool_)\n        _unwrapx(field, dummy, recformat.repeat)\n        return dummy\n\n    def _convert_p(self, column, field, recformat):\n        \"\"\"Convert a raw table column of FITS P or Q format descriptors\n        to a VLA column with the array data returned from the heap.\n        \"\"\"\n\n        dummy = _VLF([None] * len(self), dtype=recformat.dtype)\n        raw_data = self._get_raw_data()\n\n        if raw_data is None:\n            raise OSError(\n                \"Could not find heap data for the {!r} variable-length \"\n                \"array column.\".format(column.name))\n\n        for idx in range(len(self)):\n            offset = field[idx, 1] + self._heapoffset\n            count = field[idx, 0]\n\n            if recformat.dtype == 'a':\n                dt = np.dtype(recformat.dtype + str(1))\n                arr_len = count * dt.itemsize\n                da = raw_data[offset:offset + arr_len].view(dt)\n                da = np.char.array(da.view(dtype=dt), itemsize=count)\n                dummy[idx] = decode_ascii(da)\n            else:\n                dt = np.dtype(recformat.dtype)\n                arr_len = count * dt.itemsize\n                dummy[idx] = raw_data[offset:offset + arr_len].view(dt)\n                dummy[idx].dtype = dummy[idx].dtype.newbyteorder('>')\n                # Each array in the field may now require additional\n                # scaling depending on the other scaling parameters\n                # TODO: The same scaling parameters apply to every\n                # array in the column so this is currently very slow; we\n                # really only need to check once whether any scaling will\n                # be necessary and skip this step if not\n                # TODO: Test that this works for X format; I don't think\n                # that it does--the recformat variable only applies to the P\n                # format not the X format\n                dummy[idx] = self._convert_other(column, dummy[idx],\n                                                 recformat)\n\n        return dummy\n\n    def _convert_ascii(self, column, field):\n        \"\"\"\n        Special handling for ASCII table columns to convert columns containing\n        numeric types to actual numeric arrays from the string representation.\n        \"\"\"\n\n        format = column.format\n        recformat = getattr(format, 'recformat', ASCII2NUMPY[format[0]])\n        # if the string = TNULL, return ASCIITNULL\n        nullval = str(column.null).strip().encode('ascii')\n        if len(nullval) > format.width:\n            nullval = nullval[:format.width]\n\n        # Before using .replace make sure that any trailing bytes in each\n        # column are filled with spaces, and *not*, say, nulls; this causes\n        # functions like replace to potentially leave gibberish bytes in the\n        # array buffer.\n        dummy = np.char.ljust(field, format.width)\n        dummy = np.char.replace(dummy, encode_ascii('D'), encode_ascii('E'))\n        null_fill = encode_ascii(str(ASCIITNULL).rjust(format.width))\n\n        # Convert all fields equal to the TNULL value (nullval) to empty fields.\n        # TODO: These fields really should be converted to NaN or something else undefined.\n        # Currently they are converted to empty fields, which are then set to zero.\n        dummy = np.where(np.char.strip(dummy) == nullval, null_fill, dummy)\n\n        # always replace empty fields, see https://github.com/astropy/astropy/pull/5394\n        if nullval != b'':\n            dummy = np.where(np.char.strip(dummy) == b'', null_fill, dummy)\n\n        try:\n            dummy = np.array(dummy, dtype=recformat)\n        except ValueError as exc:\n            indx = self.names.index(column.name)\n            raise ValueError(\n                '{}; the header may be missing the necessary TNULL{} '\n                'keyword or the table contains invalid data'.format(\n                    exc, indx + 1))\n\n        return dummy\n\n    def _convert_other(self, column, field, recformat):\n        \"\"\"Perform conversions on any other fixed-width column data types.\n\n        This may not perform any conversion at all if it's not necessary, in\n        which case the original column array is returned.\n        \"\"\"\n\n        if isinstance(recformat, _FormatX):\n            # special handling for the X format\n            return self._convert_x(field, recformat)\n\n        (_str, _bool, _number, _scale, _zero, bscale, bzero, dim) = \\\n            self._get_scale_factors(column)\n\n        indx = self.names.index(column.name)\n\n        # ASCII table, convert strings to numbers\n        # TODO:\n        # For now, check that these are ASCII columns by checking the coldefs\n        # type; in the future all columns (for binary tables, ASCII tables, or\n        # otherwise) should \"know\" what type they are already and how to handle\n        # converting their data from FITS format to native format and vice\n        # versa...\n        if not _str and isinstance(self._coldefs, _AsciiColDefs):\n            field = self._convert_ascii(column, field)\n\n        # Test that the dimensions given in dim are sensible; otherwise\n        # display a warning and ignore them\n        if dim:\n            # See if the dimensions already match, if not, make sure the\n            # number items will fit in the specified dimensions\n            if field.ndim > 1:\n                actual_shape = field.shape[1:]\n                if _str:\n                    actual_shape = actual_shape + (field.itemsize,)\n            else:\n                actual_shape = field.shape[0]\n\n            if dim == actual_shape:\n                # The array already has the correct dimensions, so we\n                # ignore dim and don't convert\n                dim = None\n            else:\n                nitems = reduce(operator.mul, dim)\n                if _str:\n                    actual_nitems = field.itemsize\n                elif len(field.shape) == 1:  # No repeat count in TFORMn, equivalent to 1\n                    actual_nitems = 1\n                else:\n                    actual_nitems = field.shape[1]\n                if nitems > actual_nitems:\n                    warnings.warn(\n                        'TDIM{} value {:d} does not fit with the size of '\n                        'the array items ({:d}).  TDIM{:d} will be ignored.'\n                        .format(indx + 1, self._coldefs[indx].dims,\n                                actual_nitems, indx + 1))\n                    dim = None\n\n        # further conversion for both ASCII and binary tables\n        # For now we've made columns responsible for *knowing* whether their\n        # data has been scaled, but we make the FITS_rec class responsible for\n        # actually doing the scaling\n        # TODO: This also needs to be fixed in the effort to make Columns\n        # responsible for scaling their arrays to/from FITS native values\n        if not column.ascii and column.format.p_format:\n            format_code = column.format.p_format\n        else:\n            # TODO: Rather than having this if/else it might be nice if the\n            # ColumnFormat class had an attribute guaranteed to give the format\n            # of actual values in a column regardless of whether the true\n            # format is something like P or Q\n            format_code = column.format.format\n\n        if (_number and (_scale or _zero) and not column._physical_values):\n            # This is to handle pseudo unsigned ints in table columns\n            # TODO: For now this only really works correctly for binary tables\n            # Should it work for ASCII tables as well?\n            if self._uint:\n                if bzero == 2**15 and format_code == 'I':\n                    field = np.array(field, dtype=np.uint16)\n                elif bzero == 2**31 and format_code == 'J':\n                    field = np.array(field, dtype=np.uint32)\n                elif bzero == 2**63 and format_code == 'K':\n                    field = np.array(field, dtype=np.uint64)\n                    bzero64 = np.uint64(2 ** 63)\n                else:\n                    field = np.array(field, dtype=np.float64)\n            else:\n                field = np.array(field, dtype=np.float64)\n\n            if _scale:\n                np.multiply(field, bscale, field)\n            if _zero:\n                if self._uint and format_code == 'K':\n                    # There is a chance of overflow, so be careful\n                    test_overflow = field.copy()\n                    try:\n                        test_overflow += bzero64\n                    except OverflowError:\n                        warnings.warn(\n                            \"Overflow detected while applying TZERO{:d}. \"\n                            \"Returning unscaled data.\".format(indx + 1))\n                    else:\n                        field = test_overflow\n                else:\n                    field += bzero\n\n            # mark the column as scaled\n            column._physical_values = True\n\n        elif _bool and field.dtype != bool:\n            field = np.equal(field, ord('T'))\n        elif _str:\n            if not self._character_as_bytes:\n                with suppress(UnicodeDecodeError):\n                    field = decode_ascii(field)\n\n        if dim:\n            # Apply the new field item dimensions\n            nitems = reduce(operator.mul, dim)\n            if field.ndim > 1:\n                field = field[:, :nitems]\n            if _str:\n                fmt = field.dtype.char\n                dtype = (f'|{fmt}{dim[-1]}', dim[:-1])\n                field.dtype = dtype\n            else:\n                field.shape = (field.shape[0],) + dim\n\n        return field\n\n    def _get_heap_data(self):\n        \"\"\"\n        Returns a pointer into the table's raw data to its heap (if present).\n\n        This is returned as a numpy byte array.\n        \"\"\"\n\n        if self._heapsize:\n            raw_data = self._get_raw_data().view(np.ubyte)\n            heap_end = self._heapoffset + self._heapsize\n            return raw_data[self._heapoffset:heap_end]\n        else:\n            return np.array([], dtype=np.ubyte)\n\n    def _get_raw_data(self):\n        \"\"\"\n        Returns the base array of self that \"raw data array\" that is the\n        array in the format that it was first read from a file before it was\n        sliced or viewed as a different type in any way.\n\n        This is determined by walking through the bases until finding one that\n        has at least the same number of bytes as self, plus the heapsize.  This\n        may be the immediate .base but is not always.  This is used primarily\n        for variable-length array support which needs to be able to find the\n        heap (the raw data *may* be larger than nbytes + heapsize if it\n        contains a gap or padding).\n\n        May return ``None`` if no array resembling the \"raw data\" according to\n        the stated criteria can be found.\n        \"\"\"\n\n        raw_data_bytes = self.nbytes + self._heapsize\n        base = self\n        while hasattr(base, 'base') and base.base is not None:\n            base = base.base\n            if hasattr(base, 'nbytes') and base.nbytes >= raw_data_bytes:\n                return base\n\n    def _get_scale_factors(self, column):\n        \"\"\"Get all the scaling flags and factors for one column.\"\"\"\n\n        # TODO: Maybe this should be a method/property on Column?  Or maybe\n        # it's not really needed at all...\n        _str = column.format.format == 'A'\n        _bool = column.format.format == 'L'\n\n        _number = not (_bool or _str)\n        bscale = column.bscale\n        bzero = column.bzero\n\n        _scale = bscale not in ('', None, 1)\n        _zero = bzero not in ('', None, 0)\n\n        # ensure bscale/bzero are numbers\n        if not _scale:\n            bscale = 1\n        if not _zero:\n            bzero = 0\n\n        # column._dims gives a tuple, rather than column.dim which returns the\n        # original string format code from the FITS header...\n        dim = column._dims\n\n        return (_str, _bool, _number, _scale, _zero, bscale, bzero, dim)\n\n    def _scale_back(self, update_heap_pointers=True):\n        \"\"\"\n        Update the parent array, using the (latest) scaled array.\n\n        If ``update_heap_pointers`` is `False`, this will leave all the heap\n        pointers in P/Q columns as they are verbatim--it only makes sense to do\n        this if there is already data on the heap and it can be guaranteed that\n        that data has not been modified, and there is not new data to add to\n        the heap.  Currently this is only used as an optimization for\n        CompImageHDU that does its own handling of the heap.\n        \"\"\"\n\n        # Running total for the new heap size\n        heapsize = 0\n\n        for indx, name in enumerate(self.dtype.names):\n            column = self._coldefs[indx]\n            recformat = column.format.recformat\n            raw_field = _get_recarray_field(self, indx)\n\n            # add the location offset of the heap area for each\n            # variable length column\n            if isinstance(recformat, _FormatP):\n                # Irritatingly, this can return a different dtype than just\n                # doing np.dtype(recformat.dtype); but this returns the results\n                # that we want.  For example if recformat.dtype is 'a' we want\n                # an array of characters.\n                dtype = np.array([], dtype=recformat.dtype).dtype\n\n                if update_heap_pointers and name in self._converted:\n                    # The VLA has potentially been updated, so we need to\n                    # update the array descriptors\n                    raw_field[:] = 0  # reset\n                    npts = [len(arr) for arr in self._converted[name]]\n\n                    raw_field[:len(npts), 0] = npts\n                    raw_field[1:, 1] = (np.add.accumulate(raw_field[:-1, 0]) *\n                                        dtype.itemsize)\n                    raw_field[:, 1][:] += heapsize\n\n                heapsize += raw_field[:, 0].sum() * dtype.itemsize\n                # Even if this VLA has not been read or updated, we need to\n                # include the size of its constituent arrays in the heap size\n                # total\n\n            if isinstance(recformat, _FormatX) and name in self._converted:\n                _wrapx(self._converted[name], raw_field, recformat.repeat)\n                continue\n\n            _str, _bool, _number, _scale, _zero, bscale, bzero, _ = \\\n                self._get_scale_factors(column)\n\n            field = self._converted.get(name, raw_field)\n\n            # conversion for both ASCII and binary tables\n            if _number or _str:\n                if _number and (_scale or _zero) and column._physical_values:\n                    dummy = field.copy()\n                    if _zero:\n                        dummy -= bzero\n                    if _scale:\n                        dummy /= bscale\n                    # This will set the raw values in the recarray back to\n                    # their non-physical storage values, so the column should\n                    # be mark is not scaled\n                    column._physical_values = False\n                elif _str or isinstance(self._coldefs, _AsciiColDefs):\n                    dummy = field\n                else:\n                    continue\n\n                # ASCII table, convert numbers to strings\n                if isinstance(self._coldefs, _AsciiColDefs):\n                    self._scale_back_ascii(indx, dummy, raw_field)\n                # binary table string column\n                elif isinstance(raw_field, chararray.chararray):\n                    self._scale_back_strings(indx, dummy, raw_field)\n                # all other binary table columns\n                else:\n                    if len(raw_field) and isinstance(raw_field[0],\n                                                     np.integer):\n                        dummy = np.around(dummy)\n\n                    if raw_field.shape == dummy.shape:\n                        raw_field[:] = dummy\n                    else:\n                        # Reshaping the data is necessary in cases where the\n                        # TDIMn keyword was used to shape a column's entries\n                        # into arrays\n                        raw_field[:] = dummy.ravel().view(raw_field.dtype)\n\n                del dummy\n\n            # ASCII table does not have Boolean type\n            elif _bool and name in self._converted:\n                choices = (np.array([ord('F')], dtype=np.int8)[0],\n                           np.array([ord('T')], dtype=np.int8)[0])\n                raw_field[:] = np.choose(field, choices)\n\n        # Store the updated heapsize\n        self._heapsize = heapsize\n\n    def _scale_back_strings(self, col_idx, input_field, output_field):\n        # There are a few possibilities this has to be able to handle properly\n        # The input_field, which comes from the _converted column is of dtype\n        # 'Un' so that elements read out of the array are normal str\n        # objects (i.e. unicode strings)\n        #\n        # At the other end the *output_field* may also be of type 'S' or of\n        # type 'U'.  It will *usually* be of type 'S' because when reading\n        # an existing FITS table the raw data is just ASCII strings, and\n        # represented in Numpy as an S array.  However, when a user creates\n        # a new table from scratch, they *might* pass in a column containing\n        # unicode strings (dtype 'U').  Therefore the output_field of the\n        # raw array is actually a unicode array.  But we still want to make\n        # sure the data is encodable as ASCII.  Later when we write out the\n        # array we use, in the dtype 'U' case, a different write routine\n        # that writes row by row and encodes any 'U' columns to ASCII.\n\n        # If the output_field is non-ASCII we will worry about ASCII encoding\n        # later when writing; otherwise we can do it right here\n        if input_field.dtype.kind == 'U' and output_field.dtype.kind == 'S':\n            try:\n                _ascii_encode(input_field, out=output_field)\n            except _UnicodeArrayEncodeError as exc:\n                raise ValueError(\n                    \"Could not save column '{}': Contains characters that \"\n                    \"cannot be encoded as ASCII as required by FITS, starting \"\n                    \"at the index {!r} of the column, and the index {} of \"\n                    \"the string at that location.\".format(\n                        self._coldefs[col_idx].name,\n                        exc.index[0] if len(exc.index) == 1 else exc.index,\n                        exc.start))\n        else:\n            # Otherwise go ahead and do a direct copy into--if both are type\n            # 'U' we'll handle encoding later\n            input_field = input_field.flatten().view(output_field.dtype)\n            output_field.flat[:] = input_field\n\n        # Ensure that blanks at the end of each string are\n        # converted to nulls instead of spaces, see Trac #15\n        # and #111\n        _rstrip_inplace(output_field)\n\n    def _scale_back_ascii(self, col_idx, input_field, output_field):\n        \"\"\"\n        Convert internal array values back to ASCII table representation.\n\n        The ``input_field`` is the internal representation of the values, and\n        the ``output_field`` is the character array representing the ASCII\n        output that will be written.\n        \"\"\"\n\n        starts = self._coldefs.starts[:]\n        spans = self._coldefs.spans\n        format = self._coldefs[col_idx].format\n\n        # The the index of the \"end\" column of the record, beyond\n        # which we can't write\n        end = super().field(-1).itemsize\n        starts.append(end + starts[-1])\n\n        if col_idx > 0:\n            lead = starts[col_idx] - starts[col_idx - 1] - spans[col_idx - 1]\n        else:\n            lead = 0\n\n        if lead < 0:\n            warnings.warn('Column {!r} starting point overlaps the previous '\n                          'column.'.format(col_idx + 1))\n\n        trail = starts[col_idx + 1] - starts[col_idx] - spans[col_idx]\n\n        if trail < 0:\n            warnings.warn('Column {!r} ending point overlaps the next '\n                          'column.'.format(col_idx + 1))\n\n        # TODO: It would be nice if these string column formatting\n        # details were left to a specialized class, as is the case\n        # with FormatX and FormatP\n        if 'A' in format:\n            _pc = '{:'\n        else:\n            _pc = '{:>'\n\n        fmt = ''.join([_pc, format[1:], ASCII2STR[format[0]], '}',\n                       (' ' * trail)])\n\n        # Even if the format precision is 0, we should output a decimal point\n        # as long as there is space to do so--not including a decimal point in\n        # a float value is discouraged by the FITS Standard\n        trailing_decimal = (format.precision == 0 and\n                            format.format in ('F', 'E', 'D'))\n\n        # not using numarray.strings's num2char because the\n        # result is not allowed to expand (as C/Python does).\n        for jdx, value in enumerate(input_field):\n            value = fmt.format(value)\n            if len(value) > starts[col_idx + 1] - starts[col_idx]:\n                raise ValueError(\n                    \"Value {!r} does not fit into the output's itemsize of \"\n                    \"{}.\".format(value, spans[col_idx]))\n\n            if trailing_decimal and value[0] == ' ':\n                # We have some extra space in the field for the trailing\n                # decimal point\n                value = value[1:] + '.'\n\n            output_field[jdx] = value\n\n        # Replace exponent separator in floating point numbers\n        if 'D' in format:\n            output_field[:] = output_field.replace(b'E', b'D')\n\n    def tolist(self):\n        # Override .tolist to take care of special case of VLF\n\n        column_lists = [self[name].tolist() for name in self.columns.names]\n\n        return [list(row) for row in zip(*column_lists)]\n\n\ndef _get_recarray_field(array, key):\n    \"\"\"\n    Compatibility function for using the recarray base class's field method.\n    This incorporates the legacy functionality of returning string arrays as\n    Numeric-style chararray objects.\n    \"\"\"\n\n    # Numpy >= 1.10.dev recarray no longer returns chararrays for strings\n    # This is currently needed for backwards-compatibility and for\n    # automatic truncation of trailing whitespace\n    field = np.recarray.field(array, key)\n    if (field.dtype.char in ('S', 'U') and\n            not isinstance(field, chararray.chararray)):\n        field = field.view(chararray.chararray)\n    return field\n\n\nclass _UnicodeArrayEncodeError(UnicodeEncodeError):\n    def __init__(self, encoding, object_, start, end, reason, index):\n        super().__init__(encoding, object_, start, end, reason)\n        self.index = index\n\n\ndef _ascii_encode(inarray, out=None):\n    \"\"\"\n    Takes a unicode array and fills the output string array with the ASCII\n    encodings (if possible) of the elements of the input array.  The two arrays\n    must be the same size (though not necessarily the same shape).\n\n    This is like an inplace version of `np.char.encode` though simpler since\n    it's only limited to ASCII, and hence the size of each character is\n    guaranteed to be 1 byte.\n\n    If any strings are non-ASCII an UnicodeArrayEncodeError is raised--this is\n    just a `UnicodeEncodeError` with an additional attribute for the index of\n    the item that couldn't be encoded.\n    \"\"\"\n\n    out_dtype = np.dtype((f'S{inarray.dtype.itemsize // 4}',\n                         inarray.dtype.shape))\n    if out is not None:\n        out = out.view(out_dtype)\n\n    op_dtypes = [inarray.dtype, out_dtype]\n    op_flags = [['readonly'], ['writeonly', 'allocate']]\n    it = np.nditer([inarray, out], op_dtypes=op_dtypes,\n                   op_flags=op_flags, flags=['zerosize_ok'])\n\n    try:\n        for initem, outitem in it:\n            outitem[...] = initem.item().encode('ascii')\n    except UnicodeEncodeError as exc:\n        index = np.unravel_index(it.iterindex, inarray.shape)\n        raise _UnicodeArrayEncodeError(*(exc.args + (index,)))\n\n    return it.operands[1]\n\n\ndef _has_unicode_fields(array):\n    \"\"\"\n    Returns True if any fields in a structured array have Unicode dtype.\n    \"\"\"\n\n    dtypes = (d[0] for d in array.dtype.fields.values())\n    return any(d.kind == 'U' for d in dtypes)\n"},{"col":4,"comment":"null","endLoc":1250,"header":"def _denormalize_sky(self, sky)","id":697,"name":"_denormalize_sky","nodeType":"Function","startLoc":1222,"text":"def _denormalize_sky(self, sky):\n        if self.wcs.lngtyp != 'RA':\n            raise ValueError(\n                \"WCS does not have longitude type of 'RA', therefore \" +\n                \"(ra, dec) data can not be used as input\")\n        if self.wcs.lattyp != 'DEC':\n            raise ValueError(\n                \"WCS does not have longitude type of 'DEC', therefore \" +\n                \"(ra, dec) data can not be used as input\")\n        if self.wcs.naxis == 2:\n            if self.wcs.lng == 0 and self.wcs.lat == 1:\n                return sky\n            elif self.wcs.lng == 1 and self.wcs.lat == 0:\n                # Reverse the order of the columns\n                return sky[:, ::-1]\n            else:\n                raise ValueError(\n                    \"WCS does not have longitude and latitude celestial \" +\n                    \"axes, therefore (ra, dec) data can not be used as input\")\n        else:\n            if self.wcs.lng < 0 or self.wcs.lat < 0:\n                raise ValueError(\n                    \"WCS does not have both longitude and latitude \"\n                    \"celestial axes, therefore (ra, dec) data can not be \" +\n                    \"used as input\")\n            out = np.zeros((sky.shape[0], self.wcs.naxis))\n            out[:, self.wcs.lng] = sky[:, 0]\n            out[:, self.wcs.lat] = sky[:, 1]\n            return out"},{"col":4,"comment":"\n        Overridden by subclasses to change what kind of view is\n        created based on the output unit of an operation.\n\n        Parameters\n        ----------\n        unit : UnitBase\n            The unit for which the appropriate class should be returned\n\n        Returns\n        -------\n        tuple :\n            - `~astropy.units.Quantity` subclass\n            - bool: True if subclasses of the given class are ok\n        ","endLoc":679,"header":"def __quantity_subclass__(self, unit)","id":698,"name":"__quantity_subclass__","nodeType":"Function","startLoc":663,"text":"def __quantity_subclass__(self, unit):\n        \"\"\"\n        Overridden by subclasses to change what kind of view is\n        created based on the output unit of an operation.\n\n        Parameters\n        ----------\n        unit : UnitBase\n            The unit for which the appropriate class should be returned\n\n        Returns\n        -------\n        tuple :\n            - `~astropy.units.Quantity` subclass\n            - bool: True if subclasses of the given class are ok\n        \"\"\"\n        return Quantity, True"},{"col":4,"comment":"\n        args : str, optional\n            Additional arguments to be passed to ``pytest.main`` in the ``args``\n            keyword argument.\n        ","endLoc":412,"header":"@keyword()\n    def args(self, args, kwargs)","id":699,"name":"args","nodeType":"Function","startLoc":402,"text":"@keyword()\n    def args(self, args, kwargs):\n        \"\"\"\n        args : str, optional\n            Additional arguments to be passed to ``pytest.main`` in the ``args``\n            keyword argument.\n        \"\"\"\n        if args:\n            return shlex.split(args, posix=not sys.platform.startswith('win'))\n\n        return []"},{"col":4,"comment":"null","endLoc":1279,"header":"def _normalize_sky(self, sky)","id":700,"name":"_normalize_sky","nodeType":"Function","startLoc":1252,"text":"def _normalize_sky(self, sky):\n        if self.wcs.lngtyp != 'RA':\n            raise ValueError(\n                \"WCS does not have longitude type of 'RA', therefore \" +\n                \"(ra, dec) data can not be returned\")\n        if self.wcs.lattyp != 'DEC':\n            raise ValueError(\n                \"WCS does not have longitude type of 'DEC', therefore \" +\n                \"(ra, dec) data can not be returned\")\n        if self.wcs.naxis == 2:\n            if self.wcs.lng == 0 and self.wcs.lat == 1:\n                return sky\n            elif self.wcs.lng == 1 and self.wcs.lat == 0:\n                # Reverse the order of the columns\n                return sky[:, ::-1]\n            else:\n                raise ValueError(\n                    \"WCS does not have longitude and latitude celestial \"\n                    \"axes, therefore (ra, dec) data can not be returned\")\n        else:\n            if self.wcs.lng < 0 or self.wcs.lat < 0:\n                raise ValueError(\n                    \"WCS does not have both longitude and latitude celestial \"\n                    \"axes, therefore (ra, dec) data can not be returned\")\n            out = np.empty((sky.shape[0], 2))\n            out[:, 0] = sky[:, self.wcs.lng]\n            out[:, 1] = sky[:, self.wcs.lat]\n            return out"},{"col":4,"comment":"\n        plugins : list, optional\n            Plugins to be passed to ``pytest.main`` in the ``plugins`` keyword\n            argument.\n        ","endLoc":423,"header":"@keyword(default_value=[])\n    def plugins(self, plugins, kwargs)","id":701,"name":"plugins","nodeType":"Function","startLoc":414,"text":"@keyword(default_value=[])\n    def plugins(self, plugins, kwargs):\n        \"\"\"\n        plugins : list, optional\n            Plugins to be passed to ``pytest.main`` in the ``plugins`` keyword\n            argument.\n        \"\"\"\n        # Plugins are handled independently by `run_tests` so we define this\n        # keyword just for the docstring\n        return []"},{"col":0,"comment":"\n    Returns a human-friendly string representing a file size\n    that is 2-4 characters long.\n\n    For example, depending on the number of bytes given, can be one\n    of::\n\n        256b\n        64k\n        1.1G\n\n    Parameters\n    ----------\n    size : int\n        The size of the file (in bytes)\n\n    Returns\n    -------\n    size : str\n        A human-friendly representation of the size of the file\n    ","endLoc":457,"header":"def human_file_size(size)","id":702,"name":"human_file_size","nodeType":"Function","startLoc":411,"text":"def human_file_size(size):\n    \"\"\"\n    Returns a human-friendly string representing a file size\n    that is 2-4 characters long.\n\n    For example, depending on the number of bytes given, can be one\n    of::\n\n        256b\n        64k\n        1.1G\n\n    Parameters\n    ----------\n    size : int\n        The size of the file (in bytes)\n\n    Returns\n    -------\n    size : str\n        A human-friendly representation of the size of the file\n    \"\"\"\n    if hasattr(size, 'unit'):\n        # Import units only if necessary because the import takes a\n        # significant time [#4649]\n        from astropy import units as u\n        size = u.Quantity(size, u.byte).value\n\n    suffixes = ' kMGTPEZY'\n    if size == 0:\n        num_scale = 0\n    else:\n        num_scale = int(math.floor(math.log(size) / math.log(1000)))\n    if num_scale > 7:\n        suffix = '?'\n    else:\n        suffix = suffixes[num_scale]\n    num_scale = int(math.pow(1000, num_scale))\n    value = size / num_scale\n    str_value = str(value)\n    if suffix == ' ':\n        str_value = str_value[:str_value.index('.')]\n    elif str_value[2] == '.':\n        str_value = str_value[:2]\n    else:\n        str_value = str_value[:3]\n    return f\"{str_value:>3s}{suffix}\""},{"col":4,"comment":"\n        verbose : bool, optional\n            Convenience option to turn on verbose output from pytest. Passing\n            True is the same as specifying ``-v`` in ``args``.\n        ","endLoc":435,"header":"@keyword()\n    def verbose(self, verbose, kwargs)","id":703,"name":"verbose","nodeType":"Function","startLoc":425,"text":"@keyword()\n    def verbose(self, verbose, kwargs):\n        \"\"\"\n        verbose : bool, optional\n            Convenience option to turn on verbose output from pytest. Passing\n            True is the same as specifying ``-v`` in ``args``.\n        \"\"\"\n        if verbose:\n            return ['-v']\n\n        return []"},{"col":4,"comment":"\n        pastebin : ('failed', 'all', None), optional\n            Convenience option for turning on pytest pastebin output. Set to\n            'failed' to upload info for failed tests, or 'all' to upload info\n            for all tests.\n        ","endLoc":451,"header":"@keyword()\n    def pastebin(self, pastebin, kwargs)","id":704,"name":"pastebin","nodeType":"Function","startLoc":437,"text":"@keyword()\n    def pastebin(self, pastebin, kwargs):\n        \"\"\"\n        pastebin : ('failed', 'all', None), optional\n            Convenience option for turning on pytest pastebin output. Set to\n            'failed' to upload info for failed tests, or 'all' to upload info\n            for all tests.\n        \"\"\"\n        if pastebin is not None:\n            if pastebin in ['failed', 'all']:\n                return [f'--pastebin={pastebin}']\n            else:\n                raise ValueError(\"pastebin should be 'failed' or 'all'\")\n\n        return []"},{"col":4,"comment":"\n        remote_data : {'none', 'astropy', 'any'}, optional\n            Controls whether to run tests marked with @pytest.mark.remote_data. This can be\n            set to run no tests with remote data (``none``), only ones that use\n            data from http://data.astropy.org (``astropy``), or all tests that\n            use remote data (``any``). The default is ``none``.\n        ","endLoc":476,"header":"@keyword(default_value='none')\n    def remote_data(self, remote_data, kwargs)","id":705,"name":"remote_data","nodeType":"Function","startLoc":453,"text":"@keyword(default_value='none')\n    def remote_data(self, remote_data, kwargs):\n        \"\"\"\n        remote_data : {'none', 'astropy', 'any'}, optional\n            Controls whether to run tests marked with @pytest.mark.remote_data. This can be\n            set to run no tests with remote data (``none``), only ones that use\n            data from http://data.astropy.org (``astropy``), or all tests that\n            use remote data (``any``). The default is ``none``.\n        \"\"\"\n\n        if remote_data is True:\n            remote_data = 'any'\n        elif remote_data is False:\n            remote_data = 'none'\n        elif remote_data not in ('none', 'astropy', 'any'):\n            warnings.warn(\"The remote_data option should be one of \"\n                          \"none/astropy/any (found {}). For backward-compatibility, \"\n                          \"assuming 'any', but you should change the option to be \"\n                          \"one of the supported ones to avoid issues in \"\n                          \"future.\".format(remote_data),\n                          AstropyDeprecationWarning)\n            remote_data = 'any'\n\n        return [f'--remote-data={remote_data}']"},{"col":4,"comment":"\n        pep8 : bool, optional\n            Turn on PEP8 checking via the pytest-pep8 plugin and disable normal\n            tests. Same as specifying ``--pep8 -k pep8`` in ``args``.\n        ","endLoc":494,"header":"@keyword()\n    def pep8(self, pep8, kwargs)","id":706,"name":"pep8","nodeType":"Function","startLoc":478,"text":"@keyword()\n    def pep8(self, pep8, kwargs):\n        \"\"\"\n        pep8 : bool, optional\n            Turn on PEP8 checking via the pytest-pep8 plugin and disable normal\n            tests. Same as specifying ``--pep8 -k pep8`` in ``args``.\n        \"\"\"\n        if pep8:\n            try:\n                import pytest_pep8  # pylint: disable=W0611\n            except ImportError:\n                raise ImportError('PEP8 checking requires pytest-pep8 plugin: '\n                                  'https://pypi.org/project/pytest-pep8')\n            else:\n                return ['--pep8', '-k', 'pep8']\n\n        return []"},{"col":4,"comment":"null","endLoc":216,"header":"def warnings_logging_enabled(self)","id":707,"name":"warnings_logging_enabled","nodeType":"Function","startLoc":215,"text":"def warnings_logging_enabled(self):\n        return self._showwarning_orig is not None"},{"col":4,"comment":"\n        Enable logging of warnings.warn() calls\n\n        Once called, any subsequent calls to ``warnings.warn()`` are\n        redirected to this logger and emitted with level ``WARN``. Note that\n        this replaces the output from ``warnings.warn``.\n\n        This can be disabled with ``disable_warnings_logging``.\n        ","endLoc":231,"header":"def enable_warnings_logging(self)","id":708,"name":"enable_warnings_logging","nodeType":"Function","startLoc":218,"text":"def enable_warnings_logging(self):\n        '''\n        Enable logging of warnings.warn() calls\n\n        Once called, any subsequent calls to ``warnings.warn()`` are\n        redirected to this logger and emitted with level ``WARN``. Note that\n        this replaces the output from ``warnings.warn``.\n\n        This can be disabled with ``disable_warnings_logging``.\n        '''\n        if self.warnings_logging_enabled():\n            raise LoggingError(\"Warnings logging has already been enabled\")\n        self._showwarning_orig = warnings.showwarning\n        warnings.showwarning = self._showwarning"},{"col":4,"comment":"\n        pdb : bool, optional\n            Turn on PDB post-mortem analysis for failing tests. Same as\n            specifying ``--pdb`` in ``args``.\n        ","endLoc":505,"header":"@keyword()\n    def pdb(self, pdb, kwargs)","id":709,"name":"pdb","nodeType":"Function","startLoc":496,"text":"@keyword()\n    def pdb(self, pdb, kwargs):\n        \"\"\"\n        pdb : bool, optional\n            Turn on PDB post-mortem analysis for failing tests. Same as\n            specifying ``--pdb`` in ``args``.\n        \"\"\"\n        if pdb:\n            return ['--pdb']\n        return []"},{"col":4,"comment":"\n        open_files : bool, optional\n            Fail when any tests leave files open.  Off by default, because\n            this adds extra run time to the test suite.  Requires the\n            ``psutil`` package.\n        ","endLoc":532,"header":"@keyword()\n    def open_files(self, open_files, kwargs)","id":710,"name":"open_files","nodeType":"Function","startLoc":507,"text":"@keyword()\n    def open_files(self, open_files, kwargs):\n        \"\"\"\n        open_files : bool, optional\n            Fail when any tests leave files open.  Off by default, because\n            this adds extra run time to the test suite.  Requires the\n            ``psutil`` package.\n        \"\"\"\n        if open_files:\n            if kwargs['parallel'] != 0:\n                raise SystemError(\n                    \"open file detection may not be used in conjunction with \"\n                    \"parallel testing.\")\n\n            try:\n                import psutil  # pylint: disable=W0611\n            except ImportError:\n                raise SystemError(\n                    \"open file detection requested, but psutil package \"\n                    \"is not installed.\")\n\n            return ['--open-files']\n\n            print(\"Checking for unclosed files\")\n\n        return []"},{"col":4,"comment":"\n        parallel : int or 'auto', optional\n            When provided, run the tests in parallel on the specified\n            number of CPUs.  If parallel is ``'auto'``, it will use the all\n            the cores on the machine.  Requires the ``pytest-xdist`` plugin.\n        ","endLoc":551,"header":"@keyword(0)\n    def parallel(self, parallel, kwargs)","id":711,"name":"parallel","nodeType":"Function","startLoc":534,"text":"@keyword(0)\n    def parallel(self, parallel, kwargs):\n        \"\"\"\n        parallel : int or 'auto', optional\n            When provided, run the tests in parallel on the specified\n            number of CPUs.  If parallel is ``'auto'``, it will use the all\n            the cores on the machine.  Requires the ``pytest-xdist`` plugin.\n        \"\"\"\n        if parallel != 0:\n            try:\n                from xdist import plugin # noqa\n            except ImportError:\n                raise SystemError(\n                    \"running tests in parallel requires the pytest-xdist package\")\n\n            return ['-n', str(parallel)]\n\n        return []"},{"col":4,"comment":"\n        docs_path : str, optional\n            The path to the documentation .rst files.\n        ","endLoc":573,"header":"@keyword()\n    def docs_path(self, docs_path, kwargs)","id":712,"name":"docs_path","nodeType":"Function","startLoc":553,"text":"@keyword()\n    def docs_path(self, docs_path, kwargs):\n        \"\"\"\n        docs_path : str, optional\n            The path to the documentation .rst files.\n        \"\"\"\n\n        paths = []\n        if docs_path is not None and not kwargs['skip_docs']:\n            if kwargs['package'] is not None:\n                warning_message = (\"Can not test .rst docs for {name}, since \"\n                                   \"docs path ({path}) does not exist.\")\n                paths = self.packages_path(kwargs['package'], docs_path,\n                                           warning=warning_message)\n            elif not kwargs['test_path']:\n                paths = [docs_path, ]\n\n            if len(paths) and not kwargs['test_path']:\n                paths.append('--doctest-rst')\n\n        return paths"},{"col":4,"comment":"\n        skip_docs : `bool`, optional\n            When `True`, skips running the doctests in the .rst files.\n        ","endLoc":582,"header":"@keyword()\n    def skip_docs(self, skip_docs, kwargs)","id":713,"name":"skip_docs","nodeType":"Function","startLoc":575,"text":"@keyword()\n    def skip_docs(self, skip_docs, kwargs):\n        \"\"\"\n        skip_docs : `bool`, optional\n            When `True`, skips running the doctests in the .rst files.\n        \"\"\"\n        # Skip docs is a bool used by docs_path only.\n        return []"},{"col":4,"comment":"\n        repeat : `int`, optional\n            If set, specifies how many times each test should be run. This is\n            useful for diagnosing sporadic failures.\n        ","endLoc":594,"header":"@keyword()\n    def repeat(self, repeat, kwargs)","id":714,"name":"repeat","nodeType":"Function","startLoc":584,"text":"@keyword()\n    def repeat(self, repeat, kwargs):\n        \"\"\"\n        repeat : `int`, optional\n            If set, specifies how many times each test should be run. This is\n            useful for diagnosing sporadic failures.\n        \"\"\"\n        if repeat:\n            return [f'--repeat={repeat}']\n\n        return []"},{"col":4,"comment":"\n        Disable logging of warnings.warn() calls\n\n        Once called, any subsequent calls to ``warnings.warn()`` are no longer\n        redirected to this logger.\n\n        This can be re-enabled with ``enable_warnings_logging``.\n        ","endLoc":249,"header":"def disable_warnings_logging(self)","id":715,"name":"disable_warnings_logging","nodeType":"Function","startLoc":233,"text":"def disable_warnings_logging(self):\n        '''\n        Disable logging of warnings.warn() calls\n\n        Once called, any subsequent calls to ``warnings.warn()`` are no longer\n        redirected to this logger.\n\n        This can be re-enabled with ``enable_warnings_logging``.\n        '''\n        if not self.warnings_logging_enabled():\n            raise LoggingError(\"Warnings logging has not been enabled\")\n        if warnings.showwarning != self._showwarning:\n            raise LoggingError(\"Cannot disable warnings logging: \"\n                               \"warnings.showwarning was not set by this \"\n                               \"logger, or has been overridden\")\n        warnings.showwarning = self._showwarning_orig\n        self._showwarning_orig = None"},{"col":4,"comment":"null","endLoc":604,"header":"def run_tests(self, **kwargs)","id":716,"name":"run_tests","nodeType":"Function","startLoc":597,"text":"def run_tests(self, **kwargs):\n\n        # This prevents cyclical import problems that make it\n        # impossible to test packages that define Table types on their\n        # own.\n        from astropy.table import Table  # pylint: disable=W0611\n\n        return super().run_tests(**kwargs)"},{"attributeType":"null","col":12,"comment":"null","endLoc":347,"id":717,"name":"package_path","nodeType":"Attribute","startLoc":347,"text":"self.package_path"},{"col":0,"comment":"Initializes the Astropy log--in most circumstances this is called\n    automatically when importing astropy.\n    ","endLoc":112,"header":"def _init_log()","id":718,"name":"_init_log","nodeType":"Function","startLoc":97,"text":"def _init_log():\n    \"\"\"Initializes the Astropy log--in most circumstances this is called\n    automatically when importing astropy.\n    \"\"\"\n\n    global log\n\n    orig_logger_cls = logging.getLoggerClass()\n    logging.setLoggerClass(AstropyLogger)\n    try:\n        log = logging.getLogger('astropy')\n        log._set_defaults()\n    finally:\n        logging.setLoggerClass(orig_logger_cls)\n\n    return log"},{"col":4,"comment":"null","endLoc":273,"header":"def _excepthook(self, etype, value, traceback)","id":719,"name":"_excepthook","nodeType":"Function","startLoc":253,"text":"def _excepthook(self, etype, value, traceback):\n\n        if traceback is None:\n            mod = None\n        else:\n            tb = traceback\n            while tb.tb_next is not None:\n                tb = tb.tb_next\n            mod = inspect.getmodule(tb)\n\n        # include the the error type in the message.\n        if len(value.args) > 0:\n            message = f'{etype.__name__}: {str(value)}'\n        else:\n            message = str(etype.__name__)\n\n        if mod is not None:\n            self.error(message, extra={'origin': mod.__name__})\n        else:\n            self.error(message)\n        self._excepthook_orig(etype, value, traceback)"},{"col":0,"comment":"Shut down exception and warning logging (if enabled) and clear all\n    Astropy loggers from the logging module's cache.\n\n    This involves poking some logging module internals, so much if it is 'at\n    your own risk' and is allowed to pass silently if any exceptions occur.\n    ","endLoc":144,"header":"def _teardown_log()","id":720,"name":"_teardown_log","nodeType":"Function","startLoc":115,"text":"def _teardown_log():\n    \"\"\"Shut down exception and warning logging (if enabled) and clear all\n    Astropy loggers from the logging module's cache.\n\n    This involves poking some logging module internals, so much if it is 'at\n    your own risk' and is allowed to pass silently if any exceptions occur.\n    \"\"\"\n\n    global log\n\n    if log.exception_logging_enabled():\n        log.disable_exception_logging()\n\n    if log.warnings_logging_enabled():\n        log.disable_warnings_logging()\n\n    del log\n\n    # Now for the fun stuff...\n    try:\n        logging._acquireLock()\n        try:\n            loggerDict = logging.Logger.manager.loggerDict\n            for key in loggerDict.keys():\n                if key == 'astropy' or key.startswith('astropy.'):\n                    del loggerDict[key]\n        finally:\n            logging._releaseLock()\n    except Exception:\n        pass"},{"col":4,"comment":"\n        Parameters\n        ----------\n        total : int or None\n            If an int, the number of increments in the process being\n            tracked and a `ProgressBar` is displayed.  If `None`, a\n            `Spinner` is displayed.\n\n        msg : str\n            The message to display above the `ProgressBar` or\n            alongside the `Spinner`.\n\n        color : str, optional\n            The color of ``msg``, if any.  Must be an ANSI terminal\n            color name.  Must be one of: black, red, green, brown,\n            blue, magenta, cyan, lightgrey, default, darkgrey,\n            lightred, lightgreen, yellow, lightblue, lightmagenta,\n            lightcyan, white.\n\n        file : writable file-like, optional\n            The file to write the to.  Defaults to `sys.stdout`.  If\n            ``file`` is not a tty (as determined by calling its `isatty`\n            member, if any), only ``msg`` will be displayed: the\n            `ProgressBar` or `Spinner` will be silent.\n        ","endLoc":1015,"header":"def __init__(self, total, msg, color='default', file=None)","id":723,"name":"__init__","nodeType":"Function","startLoc":979,"text":"def __init__(self, total, msg, color='default', file=None):\n        \"\"\"\n        Parameters\n        ----------\n        total : int or None\n            If an int, the number of increments in the process being\n            tracked and a `ProgressBar` is displayed.  If `None`, a\n            `Spinner` is displayed.\n\n        msg : str\n            The message to display above the `ProgressBar` or\n            alongside the `Spinner`.\n\n        color : str, optional\n            The color of ``msg``, if any.  Must be an ANSI terminal\n            color name.  Must be one of: black, red, green, brown,\n            blue, magenta, cyan, lightgrey, default, darkgrey,\n            lightred, lightgreen, yellow, lightblue, lightmagenta,\n            lightcyan, white.\n\n        file : writable file-like, optional\n            The file to write the to.  Defaults to `sys.stdout`.  If\n            ``file`` is not a tty (as determined by calling its `isatty`\n            member, if any), only ``msg`` will be displayed: the\n            `ProgressBar` or `Spinner` will be silent.\n        \"\"\"\n\n        if file is None:\n            file = _get_stdout()\n\n        if total is None or not isatty(file):\n            self._is_spinner = True\n            self._obj = Spinner(msg, color=color, file=file)\n        else:\n            self._is_spinner = False\n            color_print(msg, color, file=file)\n            self._obj = ProgressBar(total, file=file)"},{"col":0,"comment":"\n    This utility function contains the logic to determine what streams to use\n    by default for standard out/err.\n\n    Typically this will just return `sys.stdout`, but it contains additional\n    logic for use in IPython on Windows to determine the correct stream to use\n    (usually ``IPython.util.io.stdout`` but only if sys.stdout is a TTY).\n    ","endLoc":112,"header":"def _get_stdout(stderr=False)","id":724,"name":"_get_stdout","nodeType":"Function","startLoc":96,"text":"def _get_stdout(stderr=False):\n    \"\"\"\n    This utility function contains the logic to determine what streams to use\n    by default for standard out/err.\n\n    Typically this will just return `sys.stdout`, but it contains additional\n    logic for use in IPython on Windows to determine the correct stream to use\n    (usually ``IPython.util.io.stdout`` but only if sys.stdout is a TTY).\n    \"\"\"\n\n    if stderr:\n        stream = 'stderr'\n    else:\n        stream = 'stdout'\n\n    sys_stream = getattr(sys, stream)\n    return sys_stream"},{"col":0,"comment":"\n    Returns `True` if ``file`` is a tty.\n\n    Most built-in Python file-like objects have an `isatty` member,\n    but some user-defined types may not, so this assumes those are not\n    ttys.\n    ","endLoc":152,"header":"def isatty(file)","id":725,"name":"isatty","nodeType":"Function","startLoc":115,"text":"def isatty(file):\n    \"\"\"\n    Returns `True` if ``file`` is a tty.\n\n    Most built-in Python file-like objects have an `isatty` member,\n    but some user-defined types may not, so this assumes those are not\n    ttys.\n    \"\"\"\n    if (multiprocessing.current_process().name != 'MainProcess' or\n            threading.current_thread().name != 'MainThread'):\n        return False\n\n    if hasattr(file, 'isatty'):\n        return file.isatty()\n\n    if _IPython.OutStream is None or (not isinstance(file, _IPython.OutStream)):\n        return False\n\n    # File is an IPython OutStream. Check whether:\n    # - File name is 'stdout'; or\n    # - File wraps a Console\n    if getattr(file, 'name', None) == 'stdout':\n        return True\n\n    if hasattr(file, 'stream'):\n        # FIXME: pyreadline has no had new release since 2015, drop it when\n        #        IPython minversion is 5.x.\n        # On Windows, in IPython 2 the standard I/O streams will wrap\n        # pyreadline.Console objects if pyreadline is available; this should\n        # be considered a TTY.\n        try:\n            from pyreadline.console import Console as PyreadlineConsole\n        except ImportError:\n            return False\n\n        return isinstance(file.stream, PyreadlineConsole)\n\n    return False"},{"col":0,"comment":"\n    Determines the URL of the API page for the specified object, and\n    optionally open that page in a web browser.\n\n    .. note::\n        You must be connected to the internet for this to function even if\n        ``openinbrowser`` is `False`, unless you provide a local version of\n        the documentation to ``version`` (e.g., ``file:///path/to/docs``).\n\n    Parameters\n    ----------\n    obj\n        The object to open the docs for or its fully-qualified name\n        (as a str).\n    version : str\n        The doc version - either a version number like '0.1', 'dev' for\n        the development/latest docs, or a URL to point to a specific\n        location that should be the *base* of the documentation. Defaults to\n        latest if you are on aren't on a release, otherwise, the version you\n        are on.\n    openinbrowser : bool\n        If `True`, the `webbrowser` package will be used to open the doc\n        page in a new web browser window.\n    timeout : number, optional\n        The number of seconds to wait before timing-out the query to\n        the astropy documentation.  If not given, the default python\n        stdlib timeout will be used.\n\n    Returns\n    -------\n    url : str\n        The loaded URL\n\n    Raises\n    ------\n    ValueError\n        If the documentation can't be found\n\n    ","endLoc":285,"header":"def find_api_page(obj, version=None, openinbrowser=True, timeout=None)","id":726,"name":"find_api_page","nodeType":"Function","startLoc":168,"text":"def find_api_page(obj, version=None, openinbrowser=True, timeout=None):\n    \"\"\"\n    Determines the URL of the API page for the specified object, and\n    optionally open that page in a web browser.\n\n    .. note::\n        You must be connected to the internet for this to function even if\n        ``openinbrowser`` is `False`, unless you provide a local version of\n        the documentation to ``version`` (e.g., ``file:///path/to/docs``).\n\n    Parameters\n    ----------\n    obj\n        The object to open the docs for or its fully-qualified name\n        (as a str).\n    version : str\n        The doc version - either a version number like '0.1', 'dev' for\n        the development/latest docs, or a URL to point to a specific\n        location that should be the *base* of the documentation. Defaults to\n        latest if you are on aren't on a release, otherwise, the version you\n        are on.\n    openinbrowser : bool\n        If `True`, the `webbrowser` package will be used to open the doc\n        page in a new web browser window.\n    timeout : number, optional\n        The number of seconds to wait before timing-out the query to\n        the astropy documentation.  If not given, the default python\n        stdlib timeout will be used.\n\n    Returns\n    -------\n    url : str\n        The loaded URL\n\n    Raises\n    ------\n    ValueError\n        If the documentation can't be found\n\n    \"\"\"\n    import webbrowser\n    from zlib import decompress\n    from astropy.utils.data import get_readable_fileobj\n\n    if (not isinstance(obj, str) and\n            hasattr(obj, '__module__') and\n            hasattr(obj, '__name__')):\n        obj = obj.__module__ + '.' + obj.__name__\n    elif inspect.ismodule(obj):\n        obj = obj.__name__\n\n    if version is None:\n        from astropy import version\n\n        if version.release:\n            version = 'v' + version.version\n        else:\n            version = 'dev'\n\n    if '://' in version:\n        if version.endswith('index.html'):\n            baseurl = version[:-10]\n        elif version.endswith('/'):\n            baseurl = version\n        else:\n            baseurl = version + '/'\n    elif version == 'dev' or version == 'latest':\n        baseurl = 'http://devdocs.astropy.org/'\n    else:\n        baseurl = f'https://docs.astropy.org/en/{version}/'\n\n    # Custom request headers; see\n    # https://github.com/astropy/astropy/issues/8990\n    url = baseurl + 'objects.inv'\n    headers = {'User-Agent': f'Astropy/{version}'}\n    with get_readable_fileobj(url, encoding='binary', remote_timeout=timeout,\n                              http_headers=headers) as uf:\n        oiread = uf.read()\n\n        # need to first read/remove the first four lines, which have info before\n        # the compressed section with the actual object inventory\n        idx = -1\n        headerlines = []\n        for _ in range(4):\n            oldidx = idx\n            idx = oiread.index(b'\\n', oldidx + 1)\n            headerlines.append(oiread[(oldidx+1):idx].decode('utf-8'))\n\n        # intersphinx version line, project name, and project version\n        ivers, proj, vers, compr = headerlines\n        if 'The remainder of this file is compressed using zlib' not in compr:\n            raise ValueError('The file downloaded from {} does not seem to be'\n                             'the usual Sphinx objects.inv format.  Maybe it '\n                             'has changed?'.format(baseurl + 'objects.inv'))\n\n        compressed = oiread[(idx+1):]\n\n    decompressed = decompress(compressed).decode('utf-8')\n\n    resurl = None\n\n    for l in decompressed.strip().splitlines():\n        ls = l.split()\n        name = ls[0]\n        loc = ls[3]\n        if loc.endswith('$'):\n            loc = loc[:-1] + name\n\n        if name == obj:\n            resurl = baseurl + loc\n            break\n\n    if resurl is None:\n        raise ValueError(f'Could not find the docs for the object {obj}')\n    elif openinbrowser:\n        webbrowser.open(resurl)\n\n    return resurl"},{"col":4,"comment":"\n        Convert an ``(x, y)`` position in the cutout array to the original\n        ``(x, y)`` position in the original large array.\n\n        Parameters\n        ----------\n        cutout_position : tuple\n            The ``(x, y)`` pixel position in the cutout array.\n\n        Returns\n        -------\n        original_position : tuple\n            The corresponding ``(x, y)`` pixel position in the original\n            large array.\n        ","endLoc":629,"header":"def to_original_position(self, cutout_position)","id":727,"name":"to_original_position","nodeType":"Function","startLoc":612,"text":"def to_original_position(self, cutout_position):\n        \"\"\"\n        Convert an ``(x, y)`` position in the cutout array to the original\n        ``(x, y)`` position in the original large array.\n\n        Parameters\n        ----------\n        cutout_position : tuple\n            The ``(x, y)`` pixel position in the cutout array.\n\n        Returns\n        -------\n        original_position : tuple\n            The corresponding ``(x, y)`` pixel position in the original\n            large array.\n        \"\"\"\n        return tuple(cutout_position[i] + self.origin_original[i]\n                     for i in [0, 1])"},{"col":4,"comment":"\n        Convert an ``(x, y)`` position in the original large array to\n        the ``(x, y)`` position in the cutout array.\n\n        Parameters\n        ----------\n        original_position : tuple\n            The ``(x, y)`` pixel position in the original large array.\n\n        Returns\n        -------\n        cutout_position : tuple\n            The corresponding ``(x, y)`` pixel position in the cutout\n            array.\n        ","endLoc":648,"header":"def to_cutout_position(self, original_position)","id":728,"name":"to_cutout_position","nodeType":"Function","startLoc":631,"text":"def to_cutout_position(self, original_position):\n        \"\"\"\n        Convert an ``(x, y)`` position in the original large array to\n        the ``(x, y)`` position in the cutout array.\n\n        Parameters\n        ----------\n        original_position : tuple\n            The ``(x, y)`` pixel position in the original large array.\n\n        Returns\n        -------\n        cutout_position : tuple\n            The corresponding ``(x, y)`` pixel position in the cutout\n            array.\n        \"\"\"\n        return tuple(original_position[i] - self.origin_original[i]\n                     for i in [0, 1])"},{"col":4,"comment":"\n        Plot the cutout region on a matplotlib Axes instance.\n\n        Parameters\n        ----------\n        ax : `matplotlib.axes.Axes` instance, optional\n            If `None`, then the current `matplotlib.axes.Axes` instance\n            is used.\n\n        fill : bool, optional\n            Set whether to fill the cutout patch.  The default is\n            `False`.\n\n        kwargs : optional\n            Any keyword arguments accepted by `matplotlib.patches.Patch`.\n\n        Returns\n        -------\n        ax : `matplotlib.axes.Axes` instance\n            The matplotlib Axes instance constructed in the method if\n            ``ax=None``.  Otherwise the output ``ax`` is the same as the\n            input ``ax``.\n        ","endLoc":688,"header":"def plot_on_original(self, ax=None, fill=False, **kwargs)","id":729,"name":"plot_on_original","nodeType":"Function","startLoc":650,"text":"def plot_on_original(self, ax=None, fill=False, **kwargs):\n        \"\"\"\n        Plot the cutout region on a matplotlib Axes instance.\n\n        Parameters\n        ----------\n        ax : `matplotlib.axes.Axes` instance, optional\n            If `None`, then the current `matplotlib.axes.Axes` instance\n            is used.\n\n        fill : bool, optional\n            Set whether to fill the cutout patch.  The default is\n            `False`.\n\n        kwargs : optional\n            Any keyword arguments accepted by `matplotlib.patches.Patch`.\n\n        Returns\n        -------\n        ax : `matplotlib.axes.Axes` instance\n            The matplotlib Axes instance constructed in the method if\n            ``ax=None``.  Otherwise the output ``ax`` is the same as the\n            input ``ax``.\n        \"\"\"\n\n        import matplotlib.pyplot as plt\n        import matplotlib.patches as mpatches\n\n        kwargs['fill'] = fill\n\n        if ax is None:\n            ax = plt.gca()\n\n        height, width = self.shape\n        hw, hh = width / 2., height / 2.\n        pos_xy = self.position_original - np.array([hw, hh])\n        patch = mpatches.Rectangle(pos_xy, width, height, 0., **kwargs)\n        ax.add_patch(patch)\n        return ax"},{"col":0,"comment":"Yield a readable, seekable file-like object from a file or URL.\n\n    This supports passing filenames, URLs, and readable file-like objects,\n    any of which can be compressed in gzip, bzip2 or lzma (xz) if the\n    appropriate compression libraries are provided by the Python installation.\n\n    Notes\n    -----\n\n    This function is a context manager, and should be used for example\n    as::\n\n        with get_readable_fileobj('file.dat') as f:\n            contents = f.read()\n\n    If a URL is provided and the cache is in use, the provided URL will be the\n    name used in the cache. The contents may already be stored in the cache\n    under this URL provided, they may be downloaded from this URL, or they may\n    be downloaded from one of the locations listed in ``sources``. See\n    `~download_file` for details.\n\n    Parameters\n    ----------\n    name_or_obj : str or file-like\n        The filename of the file to access (if given as a string), or\n        the file-like object to access.\n\n        If a file-like object, it must be opened in binary mode.\n\n    encoding : str, optional\n        When `None` (default), returns a file-like object with a\n        ``read`` method that returns `str` (``unicode``) objects, using\n        `locale.getpreferredencoding` as an encoding.  This matches\n        the default behavior of the built-in `open` when no ``mode``\n        argument is provided.\n\n        When ``'binary'``, returns a file-like object where its ``read``\n        method returns `bytes` objects.\n\n        When another string, it is the name of an encoding, and the\n        file-like object's ``read`` method will return `str` (``unicode``)\n        objects, decoded from binary using the given encoding.\n\n    cache : bool or \"update\", optional\n        Whether to cache the contents of remote URLs. If \"update\",\n        check the remote URL for a new version but store the result\n        in the cache.\n\n    show_progress : bool, optional\n        Whether to display a progress bar if the file is downloaded\n        from a remote server.  Default is `True`.\n\n    remote_timeout : float\n        Timeout for remote requests in seconds (default is the configurable\n        `astropy.utils.data.Conf.remote_timeout`).\n\n    sources : list of str, optional\n        If provided, a list of URLs to try to obtain the file from. The\n        result will be stored under the original URL. The original URL\n        will *not* be tried unless it is in this list; this is to prevent\n        long waits for a primary server that is known to be inaccessible\n        at the moment.\n\n    http_headers : dict or None\n        HTTP request headers to pass into ``urlopen`` if needed. (These headers\n        are ignored if the protocol for the ``name_or_obj``/``sources`` entry\n        is not a remote HTTP URL.) In the default case (None), the headers are\n        ``User-Agent: some_value`` and ``Accept: */*``, where ``some_value``\n        is set by ``astropy.utils.data.conf.default_http_user_agent``.\n\n    Returns\n    -------\n    file : readable file-like\n    ","endLoc":402,"header":"@contextlib.contextmanager\ndef get_readable_fileobj(name_or_obj, encoding=None, cache=False,\n                         show_progress=True, remote_timeout=None,\n                         sources=None, http_headers=None)","id":730,"name":"get_readable_fileobj","nodeType":"Function","startLoc":165,"text":"@contextlib.contextmanager\ndef get_readable_fileobj(name_or_obj, encoding=None, cache=False,\n                         show_progress=True, remote_timeout=None,\n                         sources=None, http_headers=None):\n    \"\"\"Yield a readable, seekable file-like object from a file or URL.\n\n    This supports passing filenames, URLs, and readable file-like objects,\n    any of which can be compressed in gzip, bzip2 or lzma (xz) if the\n    appropriate compression libraries are provided by the Python installation.\n\n    Notes\n    -----\n\n    This function is a context manager, and should be used for example\n    as::\n\n        with get_readable_fileobj('file.dat') as f:\n            contents = f.read()\n\n    If a URL is provided and the cache is in use, the provided URL will be the\n    name used in the cache. The contents may already be stored in the cache\n    under this URL provided, they may be downloaded from this URL, or they may\n    be downloaded from one of the locations listed in ``sources``. See\n    `~download_file` for details.\n\n    Parameters\n    ----------\n    name_or_obj : str or file-like\n        The filename of the file to access (if given as a string), or\n        the file-like object to access.\n\n        If a file-like object, it must be opened in binary mode.\n\n    encoding : str, optional\n        When `None` (default), returns a file-like object with a\n        ``read`` method that returns `str` (``unicode``) objects, using\n        `locale.getpreferredencoding` as an encoding.  This matches\n        the default behavior of the built-in `open` when no ``mode``\n        argument is provided.\n\n        When ``'binary'``, returns a file-like object where its ``read``\n        method returns `bytes` objects.\n\n        When another string, it is the name of an encoding, and the\n        file-like object's ``read`` method will return `str` (``unicode``)\n        objects, decoded from binary using the given encoding.\n\n    cache : bool or \"update\", optional\n        Whether to cache the contents of remote URLs. If \"update\",\n        check the remote URL for a new version but store the result\n        in the cache.\n\n    show_progress : bool, optional\n        Whether to display a progress bar if the file is downloaded\n        from a remote server.  Default is `True`.\n\n    remote_timeout : float\n        Timeout for remote requests in seconds (default is the configurable\n        `astropy.utils.data.Conf.remote_timeout`).\n\n    sources : list of str, optional\n        If provided, a list of URLs to try to obtain the file from. The\n        result will be stored under the original URL. The original URL\n        will *not* be tried unless it is in this list; this is to prevent\n        long waits for a primary server that is known to be inaccessible\n        at the moment.\n\n    http_headers : dict or None\n        HTTP request headers to pass into ``urlopen`` if needed. (These headers\n        are ignored if the protocol for the ``name_or_obj``/``sources`` entry\n        is not a remote HTTP URL.) In the default case (None), the headers are\n        ``User-Agent: some_value`` and ``Accept: */*``, where ``some_value``\n        is set by ``astropy.utils.data.conf.default_http_user_agent``.\n\n    Returns\n    -------\n    file : readable file-like\n    \"\"\"\n\n    # close_fds is a list of file handles created by this function\n    # that need to be closed.  We don't want to always just close the\n    # returned file handle, because it may simply be the file handle\n    # passed in.  In that case it is not the responsibility of this\n    # function to close it: doing so could result in a \"double close\"\n    # and an \"invalid file descriptor\" exception.\n\n    close_fds = []\n    delete_fds = []\n\n    if remote_timeout is None:\n        # use configfile default\n        remote_timeout = conf.remote_timeout\n\n    # name_or_obj could be an os.PathLike object\n    if isinstance(name_or_obj, os.PathLike):\n        name_or_obj = os.fspath(name_or_obj)\n\n    # Get a file object to the content\n    if isinstance(name_or_obj, str):\n        is_url = _is_url(name_or_obj)\n        if is_url:\n            name_or_obj = download_file(\n                name_or_obj, cache=cache, show_progress=show_progress,\n                timeout=remote_timeout, sources=sources,\n                http_headers=http_headers)\n        fileobj = io.FileIO(name_or_obj, 'r')\n        if is_url and not cache:\n            delete_fds.append(fileobj)\n        close_fds.append(fileobj)\n    else:\n        fileobj = name_or_obj\n\n    # Check if the file object supports random access, and if not,\n    # then wrap it in a BytesIO buffer.  It would be nicer to use a\n    # BufferedReader to avoid reading loading the whole file first,\n    # but that is not compatible with streams or urllib2.urlopen\n    # objects on Python 2.x.\n    if not hasattr(fileobj, 'seek'):\n        try:\n            # py.path.LocalPath objects have .read() method but it uses\n            # text mode, which won't work. .read_binary() does, and\n            # surely other ducks would return binary contents when\n            # called like this.\n            # py.path.LocalPath is what comes from the tmpdir fixture\n            # in pytest.\n            fileobj = io.BytesIO(fileobj.read_binary())\n        except AttributeError:\n            fileobj = io.BytesIO(fileobj.read())\n\n    # Now read enough bytes to look at signature\n    signature = fileobj.read(4)\n    fileobj.seek(0)\n\n    if signature[:3] == b'\\x1f\\x8b\\x08':  # gzip\n        import struct\n        try:\n            import gzip\n            fileobj_new = gzip.GzipFile(fileobj=fileobj, mode='rb')\n            fileobj_new.read(1)  # need to check that the file is really gzip\n        except (OSError, EOFError, struct.error):  # invalid gzip file\n            fileobj.seek(0)\n            fileobj_new.close()\n        else:\n            fileobj_new.seek(0)\n            fileobj = fileobj_new\n    elif signature[:3] == b'BZh':  # bzip2\n        try:\n            import bz2\n        except ImportError:\n            for fd in close_fds:\n                fd.close()\n            raise ModuleNotFoundError(\n                \"This Python installation does not provide the bz2 module.\")\n        try:\n            # bz2.BZ2File does not support file objects, only filenames, so we\n            # need to write the data to a temporary file\n            with NamedTemporaryFile(\"wb\", delete=False) as tmp:\n                tmp.write(fileobj.read())\n                tmp.close()\n                fileobj_new = bz2.BZ2File(tmp.name, mode='rb')\n            fileobj_new.read(1)  # need to check that the file is really bzip2\n        except OSError:  # invalid bzip2 file\n            fileobj.seek(0)\n            fileobj_new.close()\n            # raise\n        else:\n            fileobj_new.seek(0)\n            close_fds.append(fileobj_new)\n            fileobj = fileobj_new\n    elif signature[:3] == b'\\xfd7z':  # xz\n        try:\n            import lzma\n            fileobj_new = lzma.LZMAFile(fileobj, mode='rb')\n            fileobj_new.read(1)  # need to check that the file is really xz\n        except ImportError:\n            for fd in close_fds:\n                fd.close()\n            raise ModuleNotFoundError(\n                \"This Python installation does not provide the lzma module.\")\n        except (OSError, EOFError):  # invalid xz file\n            fileobj.seek(0)\n            fileobj_new.close()\n            # should we propagate this to the caller to signal bad content?\n            # raise ValueError(e)\n        else:\n            fileobj_new.seek(0)\n            fileobj = fileobj_new\n\n    # By this point, we have a file, io.FileIO, gzip.GzipFile, bz2.BZ2File\n    # or lzma.LZMAFile instance opened in binary mode (that is, read\n    # returns bytes).  Now we need to, if requested, wrap it in a\n    # io.TextIOWrapper so read will return unicode based on the\n    # encoding parameter.\n\n    needs_textio_wrapper = encoding != 'binary'\n\n    if needs_textio_wrapper:\n        # A bz2.BZ2File can not be wrapped by a TextIOWrapper,\n        # so we decompress it to a temporary file and then\n        # return a handle to that.\n        try:\n            import bz2\n        except ImportError:\n            pass\n        else:\n            if isinstance(fileobj, bz2.BZ2File):\n                tmp = NamedTemporaryFile(\"wb\", delete=False)\n                data = fileobj.read()\n                tmp.write(data)\n                tmp.close()\n                delete_fds.append(tmp)\n\n                fileobj = io.FileIO(tmp.name, 'r')\n                close_fds.append(fileobj)\n\n        fileobj = _NonClosingBufferedReader(fileobj)\n        fileobj = _NonClosingTextIOWrapper(fileobj, encoding=encoding)\n\n        # Ensure that file is at the start - io.FileIO will for\n        # example not always be at the start:\n        # >>> import io\n        # >>> f = open('test.fits', 'rb')\n        # >>> f.read(4)\n        # 'SIMP'\n        # >>> f.seek(0)\n        # >>> fileobj = io.FileIO(f.fileno())\n        # >>> fileobj.tell()\n        # 4096L\n\n        fileobj.seek(0)\n\n    try:\n        yield fileobj\n    finally:\n        for fd in close_fds:\n            fd.close()\n        for fd in delete_fds:\n            os.remove(fd.name)"},{"attributeType":"null","col":0,"comment":"null","endLoc":179,"id":731,"name":"ASCIITNULL","nodeType":"Attribute","startLoc":179,"text":"ASCIITNULL"},{"col":4,"comment":"\n        Calculate the center position.  The center position will be\n        fractional for even-sized arrays.  For ``mode='partial'``, the\n        central position is calculated for the valid (non-filled) cutout\n        values.\n        ","endLoc":699,"header":"@staticmethod\n    def _calc_center(slices)","id":732,"name":"_calc_center","nodeType":"Function","startLoc":690,"text":"@staticmethod\n    def _calc_center(slices):\n        \"\"\"\n        Calculate the center position.  The center position will be\n        fractional for even-sized arrays.  For ``mode='partial'``, the\n        central position is calculated for the valid (non-filled) cutout\n        values.\n        \"\"\"\n        return tuple(0.5 * (slices[i].start + slices[i].stop - 1)\n                     for i in [1, 0])"},{"attributeType":"null","col":0,"comment":"null","endLoc":40,"id":733,"name":"FITS2NUMPY","nodeType":"Attribute","startLoc":40,"text":"FITS2NUMPY"},{"col":4,"comment":"null","endLoc":2238,"header":"def wcs_world2pix(self, *args, **kwargs)","id":734,"name":"wcs_world2pix","nodeType":"Function","startLoc":2233,"text":"def wcs_world2pix(self, *args, **kwargs):\n        if self.wcs is None:\n            raise ValueError(\"No basic WCS settings were created.\")\n        return self._array_converter(\n            lambda xy, o: self.wcs.s2p(xy, o)['pixcrd'],\n            'input', *args, **kwargs)"},{"col":4,"comment":"\n        Calculate a minimal bounding box in the form ``((ymin, ymax),\n        (xmin, xmax))``.  Note these are pixel locations, not slice\n        indices.  For ``mode='partial'``, the bounding box indices are\n        for the valid (non-filled) cutout values.\n        ","endLoc":711,"header":"@staticmethod\n    def _calc_bbox(slices)","id":735,"name":"_calc_bbox","nodeType":"Function","startLoc":701,"text":"@staticmethod\n    def _calc_bbox(slices):\n        \"\"\"\n        Calculate a minimal bounding box in the form ``((ymin, ymax),\n        (xmin, xmax))``.  Note these are pixel locations, not slice\n        indices.  For ``mode='partial'``, the bounding box indices are\n        for the valid (non-filled) cutout values.\n        \"\"\"\n        # (stop - 1) to return the max pixel location, not the slice index\n        return ((slices[0].start, slices[0].stop - 1),\n                (slices[1].start, slices[1].stop - 1))"},{"col":4,"comment":"\n        The ``(x, y)`` index of the origin pixel of the cutout with\n        respect to the original array.  For ``mode='partial'``, the\n        origin pixel is calculated for the valid (non-filled) cutout\n        values.\n        ","endLoc":721,"header":"@lazyproperty\n    def origin_original(self)","id":736,"name":"origin_original","nodeType":"Function","startLoc":713,"text":"@lazyproperty\n    def origin_original(self):\n        \"\"\"\n        The ``(x, y)`` index of the origin pixel of the cutout with\n        respect to the original array.  For ``mode='partial'``, the\n        origin pixel is calculated for the valid (non-filled) cutout\n        values.\n        \"\"\"\n        return (self.slices_original[1].start, self.slices_original[0].start)"},{"col":4,"comment":"\n        The ``(x, y)`` index of the origin pixel of the cutout with\n        respect to the cutout array.  For ``mode='partial'``, the origin\n        pixel is calculated for the valid (non-filled) cutout values.\n        ","endLoc":730,"header":"@lazyproperty\n    def origin_cutout(self)","id":737,"name":"origin_cutout","nodeType":"Function","startLoc":723,"text":"@lazyproperty\n    def origin_cutout(self):\n        \"\"\"\n        The ``(x, y)`` index of the origin pixel of the cutout with\n        respect to the cutout array.  For ``mode='partial'``, the origin\n        pixel is calculated for the valid (non-filled) cutout values.\n        \"\"\"\n        return (self.slices_cutout[1].start, self.slices_cutout[0].start)"},{"col":4,"comment":"\n        Round the input to the nearest integer.\n\n        If two integers are equally close, the value is rounded up.\n        Note that this is different from `np.round`, which rounds to the\n        nearest even number.\n        ","endLoc":741,"header":"@staticmethod\n    def _round(a)","id":738,"name":"_round","nodeType":"Function","startLoc":732,"text":"@staticmethod\n    def _round(a):\n        \"\"\"\n        Round the input to the nearest integer.\n\n        If two integers are equally close, the value is rounded up.\n        Note that this is different from `np.round`, which rounds to the\n        nearest even number.\n        \"\"\"\n        return int(np.floor(a + 0.5))"},{"col":4,"comment":"\n        The ``(x, y)`` position index (rounded to the nearest pixel) in\n        the original array.\n        ","endLoc":750,"header":"@lazyproperty\n    def position_original(self)","id":739,"name":"position_original","nodeType":"Function","startLoc":743,"text":"@lazyproperty\n    def position_original(self):\n        \"\"\"\n        The ``(x, y)`` position index (rounded to the nearest pixel) in\n        the original array.\n        \"\"\"\n        return (self._round(self.input_position_original[0]),\n                self._round(self.input_position_original[1]))"},{"attributeType":"null","col":0,"comment":"null","endLoc":70,"id":740,"name":"ASCII2NUMPY","nodeType":"Attribute","startLoc":70,"text":"ASCII2NUMPY"},{"attributeType":"null","col":0,"comment":"null","endLoc":74,"id":741,"name":"ASCII2STR","nodeType":"Attribute","startLoc":74,"text":"ASCII2STR"},{"className":"ColDefs","col":0,"comment":"\n    Column definitions class.\n\n    It has attributes corresponding to the `Column` attributes\n    (e.g. `ColDefs` has the attribute ``names`` while `Column`\n    has ``name``). Each attribute in `ColDefs` is a list of\n    corresponding attribute values from all `Column` objects.\n    ","endLoc":1878,"id":742,"nodeType":"Class","startLoc":1346,"text":"class ColDefs(NotifierMixin):\n    \"\"\"\n    Column definitions class.\n\n    It has attributes corresponding to the `Column` attributes\n    (e.g. `ColDefs` has the attribute ``names`` while `Column`\n    has ``name``). Each attribute in `ColDefs` is a list of\n    corresponding attribute values from all `Column` objects.\n    \"\"\"\n\n    _padding_byte = '\\x00'\n    _col_format_cls = _ColumnFormat\n\n    def __new__(cls, input, ascii=False):\n        klass = cls\n\n        if (hasattr(input, '_columns_type') and\n                issubclass(input._columns_type, ColDefs)):\n            klass = input._columns_type\n        elif (hasattr(input, '_col_format_cls') and\n                issubclass(input._col_format_cls, _AsciiColumnFormat)):\n            klass = _AsciiColDefs\n\n        if ascii:  # force ASCII if this has been explicitly requested\n            klass = _AsciiColDefs\n\n        return object.__new__(klass)\n\n    def __getnewargs__(self):\n        return (self._arrays,)\n\n    def __init__(self, input, ascii=False):\n        \"\"\"\n        Parameters\n        ----------\n\n        input : sequence of `Column` or `ColDefs` or ndarray or `~numpy.recarray`\n            An existing table HDU, an existing `ColDefs`, or any multi-field\n            Numpy array or `numpy.recarray`.\n\n        ascii : bool\n            Use True to ensure that ASCII table columns are used.\n\n        \"\"\"\n        from .hdu.table import _TableBaseHDU\n        from .fitsrec import FITS_rec\n\n        if isinstance(input, ColDefs):\n            self._init_from_coldefs(input)\n        elif (isinstance(input, FITS_rec) and hasattr(input, '_coldefs') and\n                input._coldefs):\n            # If given a FITS_rec object we can directly copy its columns, but\n            # only if its columns have already been defined, otherwise this\n            # will loop back in on itself and blow up\n            self._init_from_coldefs(input._coldefs)\n        elif isinstance(input, np.ndarray) and input.dtype.fields is not None:\n            # Construct columns from the fields of a record array\n            self._init_from_array(input)\n        elif isiterable(input):\n            # if the input is a list of Columns\n            self._init_from_sequence(input)\n        elif isinstance(input, _TableBaseHDU):\n            # Construct columns from fields in an HDU header\n            self._init_from_table(input)\n        else:\n            raise TypeError('Input to ColDefs must be a table HDU, a list '\n                            'of Columns, or a record/field array.')\n\n        # Listen for changes on all columns\n        for col in self.columns:\n            col._add_listener(self)\n\n    def _init_from_coldefs(self, coldefs):\n        \"\"\"Initialize from an existing ColDefs object (just copy the\n        columns and convert their formats if necessary).\n        \"\"\"\n\n        self.columns = [self._copy_column(col) for col in coldefs]\n\n    def _init_from_sequence(self, columns):\n        for idx, col in enumerate(columns):\n            if not isinstance(col, Column):\n                raise TypeError(f'Element {idx} in the ColDefs input is not a Column.')\n\n        self._init_from_coldefs(columns)\n\n    def _init_from_array(self, array):\n        self.columns = []\n        for idx in range(len(array.dtype)):\n            cname = array.dtype.names[idx]\n            ftype = array.dtype.fields[cname][0]\n            format = self._col_format_cls.from_recformat(ftype)\n\n            # Determine the appropriate dimensions for items in the column\n            # (typically just 1D)\n            dim = array.dtype[idx].shape[::-1]\n            if dim and (len(dim) > 0 or 'A' in format):\n                if 'A' in format:\n                    # n x m string arrays must include the max string\n                    # length in their dimensions (e.g. l x n x m)\n                    dim = (array.dtype[idx].base.itemsize,) + dim\n                dim = '(' + ','.join(str(d) for d in dim) + ')'\n            else:\n                dim = None\n\n            # Check for unsigned ints.\n            bzero = None\n            if ftype.base.kind == 'u':\n                if 'I' in format:\n                    bzero = np.uint16(2**15)\n                elif 'J' in format:\n                    bzero = np.uint32(2**31)\n                elif 'K' in format:\n                    bzero = np.uint64(2**63)\n\n            c = Column(name=cname, format=format,\n                       array=array.view(np.ndarray)[cname], bzero=bzero,\n                       dim=dim)\n            self.columns.append(c)\n\n    def _init_from_table(self, table):\n        hdr = table._header\n        nfields = hdr['TFIELDS']\n\n        # go through header keywords to pick out column definition keywords\n        # definition dictionaries for each field\n        col_keywords = [{} for i in range(nfields)]\n        for keyword in hdr:\n            key = TDEF_RE.match(keyword)\n            try:\n                label = key.group('label')\n            except Exception:\n                continue  # skip if there is no match\n            if label in KEYWORD_NAMES:\n                col = int(key.group('num'))\n                if 0 < col <= nfields:\n                    attr = KEYWORD_TO_ATTRIBUTE[label]\n                    value = hdr[keyword]\n                    if attr == 'format':\n                        # Go ahead and convert the format value to the\n                        # appropriate ColumnFormat container now\n                        value = self._col_format_cls(value)\n                    col_keywords[col - 1][attr] = value\n\n        # Verify the column keywords and display any warnings if necessary;\n        # we only want to pass on the valid keywords\n        for idx, kwargs in enumerate(col_keywords):\n            valid_kwargs, invalid_kwargs = Column._verify_keywords(**kwargs)\n            for val in invalid_kwargs.values():\n                warnings.warn(\n                    f'Invalid keyword for column {idx + 1}: {val[1]}',\n                    VerifyWarning)\n            # Special cases for recformat and dim\n            # TODO: Try to eliminate the need for these special cases\n            del valid_kwargs['recformat']\n            if 'dim' in valid_kwargs:\n                valid_kwargs['dim'] = kwargs['dim']\n            col_keywords[idx] = valid_kwargs\n\n        # data reading will be delayed\n        for col in range(nfields):\n            col_keywords[col]['array'] = Delayed(table, col)\n\n        # now build the columns\n        self.columns = [Column(**attrs) for attrs in col_keywords]\n\n        # Add the table HDU is a listener to changes to the columns\n        # (either changes to individual columns, or changes to the set of\n        # columns (add/remove/etc.))\n        self._add_listener(table)\n\n    def __copy__(self):\n        return self.__class__(self)\n\n    def __deepcopy__(self, memo):\n        return self.__class__([copy.deepcopy(c, memo) for c in self.columns])\n\n    def _copy_column(self, column):\n        \"\"\"Utility function used currently only by _init_from_coldefs\n        to help convert columns from binary format to ASCII format or vice\n        versa if necessary (otherwise performs a straight copy).\n        \"\"\"\n\n        if isinstance(column.format, self._col_format_cls):\n            # This column has a FITS format compatible with this column\n            # definitions class (that is ascii or binary)\n            return column.copy()\n\n        new_column = column.copy()\n\n        # Try to use the Numpy recformat as the equivalency between the\n        # two formats; if that conversion can't be made then these\n        # columns can't be transferred\n        # TODO: Catch exceptions here and raise an explicit error about\n        # column format conversion\n        new_column.format = self._col_format_cls.from_column_format(column.format)\n\n        # Handle a few special cases of column format options that are not\n        # compatible between ASCII an binary tables\n        # TODO: This is sort of hacked in right now; we really need\n        # separate classes for ASCII and Binary table Columns, and they\n        # should handle formatting issues like these\n        if not isinstance(new_column.format, _AsciiColumnFormat):\n            # the column is a binary table column...\n            new_column.start = None\n            if new_column.null is not None:\n                # We can't just \"guess\" a value to represent null\n                # values in the new column, so just disable this for\n                # now; users may modify it later\n                new_column.null = None\n        else:\n            # the column is an ASCII table column...\n            if new_column.null is not None:\n                new_column.null = DEFAULT_ASCII_TNULL\n            if (new_column.disp is not None and\n                    new_column.disp.upper().startswith('L')):\n                # ASCII columns may not use the logical data display format;\n                # for now just drop the TDISPn option for this column as we\n                # don't have a systematic conversion of boolean data to ASCII\n                # tables yet\n                new_column.disp = None\n\n        return new_column\n\n    def __getattr__(self, name):\n        \"\"\"\n        Automatically returns the values for the given keyword attribute for\n        all `Column`s in this list.\n\n        Implements for example self.units, self.formats, etc.\n        \"\"\"\n        cname = name[:-1]\n        if cname in KEYWORD_ATTRIBUTES and name[-1] == 's':\n            attr = []\n            for col in self.columns:\n                val = getattr(col, cname)\n                attr.append(val if val is not None else '')\n            return attr\n        raise AttributeError(name)\n\n    @lazyproperty\n    def dtype(self):\n        # Note: This previously returned a dtype that just used the raw field\n        # widths based on the format's repeat count, and did not incorporate\n        # field *shapes* as provided by TDIMn keywords.\n        # Now this incorporates TDIMn from the start, which makes *this* method\n        # a little more complicated, but simplifies code elsewhere (for example\n        # fields will have the correct shapes even in the raw recarray).\n        formats = []\n        offsets = [0]\n\n        for format_, dim in zip(self.formats, self._dims):\n            dt = format_.dtype\n\n            if len(offsets) < len(self.formats):\n                # Note: the size of the *original* format_ may be greater than\n                # one would expect from the number of elements determined by\n                # dim.  The FITS format allows this--the rest of the field is\n                # filled with undefined values.\n                offsets.append(offsets[-1] + dt.itemsize)\n\n            if dim:\n                if format_.format == 'A':\n                    dt = np.dtype((dt.char + str(dim[-1]), dim[:-1]))\n                else:\n                    dt = np.dtype((dt.base, dim))\n\n            formats.append(dt)\n\n        return np.dtype({'names': self.names,\n                         'formats': formats,\n                         'offsets': offsets})\n\n    @lazyproperty\n    def names(self):\n        return [col.name for col in self.columns]\n\n    @lazyproperty\n    def formats(self):\n        return [col.format for col in self.columns]\n\n    @lazyproperty\n    def _arrays(self):\n        return [col.array for col in self.columns]\n\n    @lazyproperty\n    def _recformats(self):\n        return [fmt.recformat for fmt in self.formats]\n\n    @lazyproperty\n    def _dims(self):\n        \"\"\"Returns the values of the TDIMn keywords parsed into tuples.\"\"\"\n\n        return [col._dims for col in self.columns]\n\n    def __getitem__(self, key):\n        if isinstance(key, str):\n            key = _get_index(self.names, key)\n\n        x = self.columns[key]\n        if _is_int(key):\n            return x\n        else:\n            return ColDefs(x)\n\n    def __len__(self):\n        return len(self.columns)\n\n    def __repr__(self):\n        rep = 'ColDefs('\n        if hasattr(self, 'columns') and self.columns:\n            # The hasattr check is mostly just useful in debugging sessions\n            # where self.columns may not be defined yet\n            rep += '\\n    '\n            rep += '\\n    '.join([repr(c) for c in self.columns])\n            rep += '\\n'\n        rep += ')'\n        return rep\n\n    def __add__(self, other, option='left'):\n        if isinstance(other, Column):\n            b = [other]\n        elif isinstance(other, ColDefs):\n            b = list(other.columns)\n        else:\n            raise TypeError('Wrong type of input.')\n        if option == 'left':\n            tmp = list(self.columns) + b\n        else:\n            tmp = b + list(self.columns)\n        return ColDefs(tmp)\n\n    def __radd__(self, other):\n        return self.__add__(other, 'right')\n\n    def __sub__(self, other):\n        if not isinstance(other, (list, tuple)):\n            other = [other]\n        _other = [_get_index(self.names, key) for key in other]\n        indx = list(range(len(self)))\n        for x in _other:\n            indx.remove(x)\n        tmp = [self[i] for i in indx]\n        return ColDefs(tmp)\n\n    def _update_column_attribute_changed(self, column, attr, old_value,\n                                         new_value):\n        \"\"\"\n        Handle column attribute changed notifications from columns that are\n        members of this `ColDefs`.\n\n        `ColDefs` itself does not currently do anything with this, and just\n        bubbles the notification up to any listening table HDUs that may need\n        to update their headers, etc.  However, this also informs the table of\n        the numerical index of the column that changed.\n        \"\"\"\n\n        idx = 0\n        for idx, col in enumerate(self.columns):\n            if col is column:\n                break\n\n        if attr == 'name':\n            del self.names\n        elif attr == 'format':\n            del self.formats\n\n        self._notify('column_attribute_changed', column, idx, attr, old_value,\n                     new_value)\n\n    def add_col(self, column):\n        \"\"\"\n        Append one `Column` to the column definition.\n        \"\"\"\n\n        if not isinstance(column, Column):\n            raise AssertionError\n\n        # Ask the HDU object to load the data before we modify our columns\n        self._notify('load_data')\n\n        self._arrays.append(column.array)\n        # Obliterate caches of certain things\n        del self.dtype\n        del self._recformats\n        del self._dims\n        del self.names\n        del self.formats\n\n        self.columns.append(column)\n\n        # Listen for changes on the new column\n        column._add_listener(self)\n\n        # If this ColDefs is being tracked by a Table, inform the\n        # table that its data is now invalid.\n        self._notify('column_added', self, column)\n        return self\n\n    def del_col(self, col_name):\n        \"\"\"\n        Delete (the definition of) one `Column`.\n\n        col_name : str or int\n            The column's name or index\n        \"\"\"\n\n        # Ask the HDU object to load the data before we modify our columns\n        self._notify('load_data')\n\n        indx = _get_index(self.names, col_name)\n        col = self.columns[indx]\n\n        del self._arrays[indx]\n        # Obliterate caches of certain things\n        del self.dtype\n        del self._recformats\n        del self._dims\n        del self.names\n        del self.formats\n\n        del self.columns[indx]\n\n        col._remove_listener(self)\n\n        # If this ColDefs is being tracked by a table HDU, inform the HDU (or\n        # any other listeners) that the column has been removed\n        # Just send a reference to self, and the index of the column that was\n        # removed\n        self._notify('column_removed', self, indx)\n        return self\n\n    def change_attrib(self, col_name, attrib, new_value):\n        \"\"\"\n        Change an attribute (in the ``KEYWORD_ATTRIBUTES`` list) of a `Column`.\n\n        Parameters\n        ----------\n        col_name : str or int\n            The column name or index to change\n\n        attrib : str\n            The attribute name\n\n        new_value : object\n            The new value for the attribute\n        \"\"\"\n\n        setattr(self[col_name], attrib, new_value)\n\n    def change_name(self, col_name, new_name):\n        \"\"\"\n        Change a `Column`'s name.\n\n        Parameters\n        ----------\n        col_name : str\n            The current name of the column\n\n        new_name : str\n            The new name of the column\n        \"\"\"\n\n        if new_name != col_name and new_name in self.names:\n            raise ValueError(f'New name {new_name} already exists.')\n        else:\n            self.change_attrib(col_name, 'name', new_name)\n\n    def change_unit(self, col_name, new_unit):\n        \"\"\"\n        Change a `Column`'s unit.\n\n        Parameters\n        ----------\n        col_name : str or int\n            The column name or index\n\n        new_unit : str\n            The new unit for the column\n        \"\"\"\n\n        self.change_attrib(col_name, 'unit', new_unit)\n\n    def info(self, attrib='all', output=None):\n        \"\"\"\n        Get attribute(s) information of the column definition.\n\n        Parameters\n        ----------\n        attrib : str\n            Can be one or more of the attributes listed in\n            ``astropy.io.fits.column.KEYWORD_ATTRIBUTES``.  The default is\n            ``\"all\"`` which will print out all attributes.  It forgives plurals\n            and blanks.  If there are two or more attribute names, they must be\n            separated by comma(s).\n\n        output : file-like, optional\n            File-like object to output to.  Outputs to stdout by default.\n            If `False`, returns the attributes as a `dict` instead.\n\n        Notes\n        -----\n        This function doesn't return anything by default; it just prints to\n        stdout.\n        \"\"\"\n\n        if output is None:\n            output = sys.stdout\n\n        if attrib.strip().lower() in ['all', '']:\n            lst = KEYWORD_ATTRIBUTES\n        else:\n            lst = attrib.split(',')\n            for idx in range(len(lst)):\n                lst[idx] = lst[idx].strip().lower()\n                if lst[idx][-1] == 's':\n                    lst[idx] = list[idx][:-1]\n\n        ret = {}\n\n        for attr in lst:\n            if output:\n                if attr not in KEYWORD_ATTRIBUTES:\n                    output.write(\"'{}' is not an attribute of the column \"\n                                 \"definitions.\\n\".format(attr))\n                    continue\n                output.write(f\"{attr}:\\n\")\n                output.write(f\"    {getattr(self, attr + 's')}\\n\")\n            else:\n                ret[attr] = getattr(self, attr + 's')\n\n        if not output:\n            return ret"},{"col":4,"comment":"\n        Determine if the exception-logging mechanism is enabled.\n\n        Returns\n        -------\n        exclog : bool\n            True if exception logging is on, False if not.\n        ","endLoc":292,"header":"def exception_logging_enabled(self)","id":743,"name":"exception_logging_enabled","nodeType":"Function","startLoc":275,"text":"def exception_logging_enabled(self):\n        '''\n        Determine if the exception-logging mechanism is enabled.\n\n        Returns\n        -------\n        exclog : bool\n            True if exception logging is on, False if not.\n        '''\n        try:\n            ip = get_ipython()\n        except NameError:\n            ip = None\n\n        if ip is None:\n            return self._excepthook_orig is not None\n        else:\n            return _AstLogIPYExc in ip.custom_exceptions"},{"col":4,"comment":"\n        Enable logging of exceptions\n\n        Once called, any uncaught exceptions will be emitted with level\n        ``ERROR`` by this logger, before being raised.\n\n        This can be disabled with ``disable_exception_logging``.\n        ","endLoc":333,"header":"def enable_exception_logging(self)","id":744,"name":"enable_exception_logging","nodeType":"Function","startLoc":294,"text":"def enable_exception_logging(self):\n        '''\n        Enable logging of exceptions\n\n        Once called, any uncaught exceptions will be emitted with level\n        ``ERROR`` by this logger, before being raised.\n\n        This can be disabled with ``disable_exception_logging``.\n        '''\n        try:\n            ip = get_ipython()\n        except NameError:\n            ip = None\n\n        if self.exception_logging_enabled():\n            raise LoggingError(\"Exception logging has already been enabled\")\n\n        if ip is None:\n            # standard python interpreter\n            self._excepthook_orig = sys.excepthook\n            sys.excepthook = self._excepthook\n        else:\n            # IPython has its own way of dealing with excepthook\n\n            # We need to locally define the function here, because IPython\n            # actually makes this a member function of their own class\n            def ipy_exc_handler(ipyshell, etype, evalue, tb, tb_offset=None):\n                # First use our excepthook\n                self._excepthook(etype, evalue, tb)\n\n                # Now also do IPython's traceback\n                ipyshell.showtraceback((etype, evalue, tb), tb_offset=tb_offset)\n\n            # now register the function with IPython\n            # note that we include _AstLogIPYExc so `disable_exception_logging`\n            # knows that it's disabling the right thing\n            ip.set_custom_exc((BaseException, _AstLogIPYExc), ipy_exc_handler)\n\n            # and set self._excepthook_orig to a no-op\n            self._excepthook_orig = lambda etype, evalue, tb: None"},{"col":4,"comment":"\n        The ``(x, y)`` position index (rounded to the nearest pixel) in\n        the cutout array.\n        ","endLoc":759,"header":"@lazyproperty\n    def position_cutout(self)","id":745,"name":"position_cutout","nodeType":"Function","startLoc":752,"text":"@lazyproperty\n    def position_cutout(self):\n        \"\"\"\n        The ``(x, y)`` position index (rounded to the nearest pixel) in\n        the cutout array.\n        \"\"\"\n        return (self._round(self.input_position_cutout[0]),\n                self._round(self.input_position_cutout[1]))"},{"col":12,"endLoc":2237,"id":746,"nodeType":"Lambda","startLoc":2237,"text":"lambda xy, o: self.wcs.s2p(xy, o)['pixcrd']"},{"col":4,"comment":"\n        The central ``(x, y)`` position of the cutout array with respect\n        to the original array.  For ``mode='partial'``, the central\n        position is calculated for the valid (non-filled) cutout values.\n        ","endLoc":768,"header":"@lazyproperty\n    def center_original(self)","id":747,"name":"center_original","nodeType":"Function","startLoc":761,"text":"@lazyproperty\n    def center_original(self):\n        \"\"\"\n        The central ``(x, y)`` position of the cutout array with respect\n        to the original array.  For ``mode='partial'``, the central\n        position is calculated for the valid (non-filled) cutout values.\n        \"\"\"\n        return self._calc_center(self.slices_original)"},{"col":4,"comment":"Generate an `astropy.io.fits.Header` object with the basic WCS\n        and SIP information stored in this object.  This should be\n        logically identical to the input FITS file, but it will be\n        normalized in a number of ways.\n\n        .. warning::\n\n          This function does not write out FITS WCS `distortion\n          paper`_ information, since that requires multiple FITS\n          header data units.  To get a full representation of\n          everything in this object, use `to_fits`.\n\n        Parameters\n        ----------\n        relax : bool or int, optional\n            Degree of permissiveness:\n\n            - `False` (default): Write all extensions that are\n              considered to be safe and recommended.\n\n            - `True`: Write all recognized informal extensions of the\n              WCS standard.\n\n            - `int`: a bit field selecting specific extensions to\n              write.  See :ref:`astropy:relaxwrite` for details.\n\n            If the ``relax`` keyword argument is not given and any\n            keywords were omitted from the output, an\n            `~astropy.utils.exceptions.AstropyWarning` is displayed.\n            To override this, explicitly pass a value to ``relax``.\n\n        key : str\n            The name of a particular WCS transform to use.  This may be\n            either ``' '`` or ``'A'``-``'Z'`` and corresponds to the ``\"a\"``\n            part of the ``CTYPEia`` cards.\n\n        Returns\n        -------\n        header : `astropy.io.fits.Header`\n\n        Notes\n        -----\n        The output header will almost certainly differ from the input in a\n        number of respects:\n\n          1. The output header only contains WCS-related keywords.  In\n             particular, it does not contain syntactically-required\n             keywords such as ``SIMPLE``, ``NAXIS``, ``BITPIX``, or\n             ``END``.\n\n          2. Deprecated (e.g. ``CROTAn``) or non-standard usage will\n             be translated to standard (this is partially dependent on\n             whether ``fix`` was applied).\n\n          3. Quantities will be converted to the units used internally,\n             basically SI with the addition of degrees.\n\n          4. Floating-point quantities may be given to a different decimal\n             precision.\n\n          5. Elements of the ``PCi_j`` matrix will be written if and\n             only if they differ from the unit matrix.  Thus, if the\n             matrix is unity then no elements will be written.\n\n          6. Additional keywords such as ``WCSAXES``, ``CUNITia``,\n             ``LONPOLEa`` and ``LATPOLEa`` may appear.\n\n          7. The original keycomments will be lost, although\n             `to_header` tries hard to write meaningful comments.\n\n          8. Keyword order may be changed.\n\n        ","endLoc":2737,"header":"def to_header(self, relax=None, key=None)","id":748,"name":"to_header","nodeType":"Function","startLoc":2586,"text":"def to_header(self, relax=None, key=None):\n        \"\"\"Generate an `astropy.io.fits.Header` object with the basic WCS\n        and SIP information stored in this object.  This should be\n        logically identical to the input FITS file, but it will be\n        normalized in a number of ways.\n\n        .. warning::\n\n          This function does not write out FITS WCS `distortion\n          paper`_ information, since that requires multiple FITS\n          header data units.  To get a full representation of\n          everything in this object, use `to_fits`.\n\n        Parameters\n        ----------\n        relax : bool or int, optional\n            Degree of permissiveness:\n\n            - `False` (default): Write all extensions that are\n              considered to be safe and recommended.\n\n            - `True`: Write all recognized informal extensions of the\n              WCS standard.\n\n            - `int`: a bit field selecting specific extensions to\n              write.  See :ref:`astropy:relaxwrite` for details.\n\n            If the ``relax`` keyword argument is not given and any\n            keywords were omitted from the output, an\n            `~astropy.utils.exceptions.AstropyWarning` is displayed.\n            To override this, explicitly pass a value to ``relax``.\n\n        key : str\n            The name of a particular WCS transform to use.  This may be\n            either ``' '`` or ``'A'``-``'Z'`` and corresponds to the ``\"a\"``\n            part of the ``CTYPEia`` cards.\n\n        Returns\n        -------\n        header : `astropy.io.fits.Header`\n\n        Notes\n        -----\n        The output header will almost certainly differ from the input in a\n        number of respects:\n\n          1. The output header only contains WCS-related keywords.  In\n             particular, it does not contain syntactically-required\n             keywords such as ``SIMPLE``, ``NAXIS``, ``BITPIX``, or\n             ``END``.\n\n          2. Deprecated (e.g. ``CROTAn``) or non-standard usage will\n             be translated to standard (this is partially dependent on\n             whether ``fix`` was applied).\n\n          3. Quantities will be converted to the units used internally,\n             basically SI with the addition of degrees.\n\n          4. Floating-point quantities may be given to a different decimal\n             precision.\n\n          5. Elements of the ``PCi_j`` matrix will be written if and\n             only if they differ from the unit matrix.  Thus, if the\n             matrix is unity then no elements will be written.\n\n          6. Additional keywords such as ``WCSAXES``, ``CUNITia``,\n             ``LONPOLEa`` and ``LATPOLEa`` may appear.\n\n          7. The original keycomments will be lost, although\n             `to_header` tries hard to write meaningful comments.\n\n          8. Keyword order may be changed.\n\n        \"\"\"\n        # default precision for numerical WCS keywords\n        precision = WCSHDO_P14  # Defined by C-ext  # noqa: F821\n        display_warning = False\n        if relax is None:\n            display_warning = True\n            relax = False\n\n        if relax not in (True, False):\n            do_sip = relax & WCSHDO_SIP\n            relax &= ~WCSHDO_SIP\n        else:\n            do_sip = relax\n            relax = WCSHDO_all if relax is True else WCSHDO_safe  # Defined by C-ext  # noqa: F821\n\n        relax = precision | relax\n\n        if self.wcs is not None:\n            if key is not None:\n                orig_key = self.wcs.alt\n                self.wcs.alt = key\n            header_string = self.wcs.to_header(relax)\n            header = fits.Header.fromstring(header_string)\n            keys_to_remove = [\"\", \" \", \"COMMENT\"]\n            for kw in keys_to_remove:\n                if kw in header:\n                    del header[kw]\n            # Check if we can handle TPD distortion correctly\n            if int(_parsed_version[0]) * 10 + int(_parsed_version[1]) < 71:\n                for kw, val in header.items():\n                    if kw[:5] in ('CPDIS', 'CQDIS') and val == 'TPD':\n                        warnings.warn(\n                            f\"WCS contains a TPD distortion model in {kw}. WCSLIB \"\n                            f\"{_wcs.__version__} is writing this in a format incompatible with \"\n                            f\"current versions - please update to 7.4 or use the bundled WCSLIB.\",\n                            AstropyWarning)\n            elif int(_parsed_version[0]) * 10 + int(_parsed_version[1]) < 74:\n                for kw, val in header.items():\n                    if kw[:5] in ('CPDIS', 'CQDIS') and val == 'TPD':\n                        warnings.warn(\n                            f\"WCS contains a TPD distortion model in {kw}, which requires WCSLIB \"\n                            f\"7.4 or later to store in a FITS header (having {_wcs.__version__}).\",\n                            AstropyWarning)\n        else:\n            header = fits.Header()\n\n        if do_sip and self.sip is not None:\n            if self.wcs is not None and any(not ctyp.endswith('-SIP') for ctyp in self.wcs.ctype):\n                self._fix_ctype(header, add_sip=True)\n\n            for kw, val in self._write_sip_kw().items():\n                header[kw] = val\n\n        if not do_sip and self.wcs is not None and any(self.wcs.ctype) and self.sip is not None:\n            # This is called when relax is not False or WCSHDO_SIP\n            # The default case of ``relax=None`` is handled further in the code.\n            header = self._fix_ctype(header, add_sip=False)\n\n        if display_warning:\n            full_header = self.to_header(relax=True, key=key)\n            missing_keys = []\n            for kw, val in full_header.items():\n                if kw not in header:\n                    missing_keys.append(kw)\n\n            if len(missing_keys):\n                warnings.warn(\n                    \"Some non-standard WCS keywords were excluded: {} \"\n                    \"Use the ``relax`` kwarg to control this.\".format(\n                        ', '.join(missing_keys)),\n                    AstropyWarning)\n            # called when ``relax=None``\n            # This is different from the case of ``relax=False``.\n            if any(self.wcs.ctype) and self.sip is not None:\n                header = self._fix_ctype(header, add_sip=False, log_message=False)\n        # Finally reset the key. This must be called after ``_fix_ctype``.\n        if key is not None:\n            self.wcs.alt = orig_key\n        return header"},{"col":4,"comment":"\n        The central ``(x, y)`` position of the cutout array with respect\n        to the cutout array.  For ``mode='partial'``, the central\n        position is calculated for the valid (non-filled) cutout values.\n        ","endLoc":777,"header":"@lazyproperty\n    def center_cutout(self)","id":749,"name":"center_cutout","nodeType":"Function","startLoc":770,"text":"@lazyproperty\n    def center_cutout(self):\n        \"\"\"\n        The central ``(x, y)`` position of the cutout array with respect\n        to the cutout array.  For ``mode='partial'``, the central\n        position is calculated for the valid (non-filled) cutout values.\n        \"\"\"\n        return self._calc_center(self.slices_cutout)"},{"col":4,"comment":"\n        The bounding box ``((ymin, ymax), (xmin, xmax))`` of the minimal\n        rectangular region of the cutout array with respect to the\n        original array.  For ``mode='partial'``, the bounding box\n        indices are for the valid (non-filled) cutout values.\n        ","endLoc":787,"header":"@lazyproperty\n    def bbox_original(self)","id":750,"name":"bbox_original","nodeType":"Function","startLoc":779,"text":"@lazyproperty\n    def bbox_original(self):\n        \"\"\"\n        The bounding box ``((ymin, ymax), (xmin, xmax))`` of the minimal\n        rectangular region of the cutout array with respect to the\n        original array.  For ``mode='partial'``, the bounding box\n        indices are for the valid (non-filled) cutout values.\n        \"\"\"\n        return self._calc_bbox(self.slices_original)"},{"col":4,"comment":"\n        The bounding box ``((ymin, ymax), (xmin, xmax))`` of the minimal\n        rectangular region of the cutout array with respect to the\n        cutout array.  For ``mode='partial'``, the bounding box indices\n        are for the valid (non-filled) cutout values.\n        ","endLoc":797,"header":"@lazyproperty\n    def bbox_cutout(self)","id":751,"name":"bbox_cutout","nodeType":"Function","startLoc":789,"text":"@lazyproperty\n    def bbox_cutout(self):\n        \"\"\"\n        The bounding box ``((ymin, ymax), (xmin, xmax))`` of the minimal\n        rectangular region of the cutout array with respect to the\n        cutout array.  For ``mode='partial'``, the bounding box indices\n        are for the valid (non-filled) cutout values.\n        \"\"\"\n        return self._calc_bbox(self.slices_cutout)"},{"attributeType":"null","col":8,"comment":"null","endLoc":578,"id":752,"name":"input_position_cutout","nodeType":"Attribute","startLoc":578,"text":"self.input_position_cutout"},{"col":36,"endLoc":333,"id":753,"nodeType":"Lambda","startLoc":333,"text":"lambda etype, evalue, tb: None"},{"col":4,"comment":"\n        Disable logging of exceptions\n\n        Once called, any uncaught exceptions will no longer be emitted by this\n        logger.\n\n        This can be re-enabled with ``enable_exception_logging``.\n        ","endLoc":362,"header":"def disable_exception_logging(self)","id":754,"name":"disable_exception_logging","nodeType":"Function","startLoc":335,"text":"def disable_exception_logging(self):\n        '''\n        Disable logging of exceptions\n\n        Once called, any uncaught exceptions will no longer be emitted by this\n        logger.\n\n        This can be re-enabled with ``enable_exception_logging``.\n        '''\n        try:\n            ip = get_ipython()\n        except NameError:\n            ip = None\n\n        if not self.exception_logging_enabled():\n            raise LoggingError(\"Exception logging has not been enabled\")\n\n        if ip is None:\n            # standard python interpreter\n            if sys.excepthook != self._excepthook:\n                raise LoggingError(\"Cannot disable exception logging: \"\n                                   \"sys.excepthook was not set by this logger, \"\n                                   \"or has been overridden\")\n            sys.excepthook = self._excepthook_orig\n            self._excepthook_orig = None\n        else:\n            # IPython has its own way of dealing with exceptions\n            ip.set_custom_exc(tuple(), None)"},{"attributeType":"null","col":10,"comment":"null","endLoc":593,"id":755,"name":"xmin_cutout","nodeType":"Attribute","startLoc":593,"text":"self.xmin_cutout"},{"attributeType":"null","col":8,"comment":"null","endLoc":576,"id":756,"name":"data","nodeType":"Attribute","startLoc":576,"text":"self.data"},{"attributeType":"null","col":8,"comment":"null","endLoc":585,"id":757,"name":"shape","nodeType":"Attribute","startLoc":585,"text":"self.shape"},{"col":4,"comment":"\n        Parameters\n        ----------\n        header : `~astropy.io.fits.Header`\n            FITS header.\n        add_sip : bool\n            Flag indicating whether \"-SIP\" should be added or removed from CTYPE keywords.\n\n            Remove \"-SIP\" from CTYPE when writing out a header with relax=False.\n            This needs to be done outside ``to_header`` because ``to_header`` runs\n            twice when ``relax=False`` and the second time ``relax`` is set to ``True``\n            to display the missing keywords.\n\n            If the user requested SIP distortion to be written out add \"-SIP\" to\n            CTYPE if it is missing.\n        ","endLoc":2788,"header":"def _fix_ctype(self, header, add_sip=True, log_message=True)","id":758,"name":"_fix_ctype","nodeType":"Function","startLoc":2739,"text":"def _fix_ctype(self, header, add_sip=True, log_message=True):\n        \"\"\"\n        Parameters\n        ----------\n        header : `~astropy.io.fits.Header`\n            FITS header.\n        add_sip : bool\n            Flag indicating whether \"-SIP\" should be added or removed from CTYPE keywords.\n\n            Remove \"-SIP\" from CTYPE when writing out a header with relax=False.\n            This needs to be done outside ``to_header`` because ``to_header`` runs\n            twice when ``relax=False`` and the second time ``relax`` is set to ``True``\n            to display the missing keywords.\n\n            If the user requested SIP distortion to be written out add \"-SIP\" to\n            CTYPE if it is missing.\n        \"\"\"\n\n        _add_sip_to_ctype = \"\"\"\n        Inconsistent SIP distortion information is present in the current WCS:\n        SIP coefficients were detected, but CTYPE is missing \"-SIP\" suffix,\n        therefore the current WCS is internally inconsistent.\n\n        Because relax has been set to True, the resulting output WCS will have\n        \"-SIP\" appended to CTYPE in order to make the header internally consistent.\n\n        However, this may produce incorrect astrometry in the output WCS, if\n        in fact the current WCS is already distortion-corrected.\n\n        Therefore, if current WCS is already distortion-corrected (eg, drizzled)\n        then SIP distortion components should not apply. In that case, for a WCS\n        that is already distortion-corrected, please remove the SIP coefficients\n        from the header.\n\n        \"\"\"\n        if log_message:\n            if add_sip:\n                log.info(_add_sip_to_ctype)\n        for i in range(1, self.naxis+1):\n            # strip() must be called here to cover the case of alt key= \" \"\n            kw = f'CTYPE{i}{self.wcs.alt}'.strip()\n            if kw in header:\n                if add_sip:\n                    val = header[kw].strip(\"-SIP\") + \"-SIP\"\n                else:\n                    val = header[kw].strip(\"-SIP\")\n                header[kw] = val\n            else:\n                continue\n        return header"},{"attributeType":"null","col":8,"comment":"null","endLoc":583,"id":759,"name":"slices_cutout","nodeType":"Attribute","startLoc":583,"text":"self.slices_cutout"},{"col":4,"comment":"\n        Write out SIP keywords.  Returns a dictionary of key-value\n        pairs.\n        ","endLoc":1220,"header":"def _write_sip_kw(self)","id":760,"name":"_write_sip_kw","nodeType":"Function","startLoc":1189,"text":"def _write_sip_kw(self):\n        \"\"\"\n        Write out SIP keywords.  Returns a dictionary of key-value\n        pairs.\n        \"\"\"\n        if self.sip is None:\n            return {}\n\n        keywords = {}\n\n        def write_array(name, a):\n            if a is None:\n                return\n            size = a.shape[0]\n            trdir = 'sky to detector' if name[-1] == 'P' else 'detector to sky'\n            comment = ('SIP polynomial order, axis {:d}, {:s}'\n                       .format(ord(name[0]) - ord('A'), trdir))\n            keywords[f'{name}_ORDER'] = size - 1, comment\n\n            comment = 'SIP distortion coefficient'\n            for i in range(size):\n                for j in range(size - i):\n                    if a[i, j] != 0.0:\n                        keywords[\n                            f'{name}_{i:d}_{j:d}'] = a[i, j], comment\n\n        write_array('A', self.sip.a)\n        write_array('B', self.sip.b)\n        write_array('AP', self.sip.ap)\n        write_array('BP', self.sip.bp)\n\n        return keywords"},{"col":4,"comment":"\n        Enable colorized output\n        ","endLoc":368,"header":"def enable_color(self)","id":761,"name":"enable_color","nodeType":"Function","startLoc":364,"text":"def enable_color(self):\n        '''\n        Enable colorized output\n        '''\n        _conf.use_color = True"},{"col":4,"comment":"\n        Disable colorized output\n        ","endLoc":374,"header":"def disable_color(self)","id":762,"name":"disable_color","nodeType":"Function","startLoc":370,"text":"def disable_color(self):\n        '''\n        Disable colorized output\n        '''\n        _conf.use_color = False"},{"col":4,"comment":"\n        Context manager to temporarily log messages to a file.\n\n        Parameters\n        ----------\n        filename : str\n            The file to log messages to.\n        filter_level : str\n            If set, any log messages less important than ``filter_level`` will\n            not be output to the file. Note that this is in addition to the\n            top-level filtering for the logger, so if the logger has level\n            'INFO', then setting ``filter_level`` to ``INFO`` or ``DEBUG``\n            will have no effect, since these messages are already filtered\n            out.\n        filter_origin : str\n            If set, only log messages with an origin starting with\n            ``filter_origin`` will be output to the file.\n\n        Notes\n        -----\n\n        By default, the logger already outputs log messages to a file set in\n        the Astropy configuration file. Using this context manager does not\n        stop log messages from being output to that file, nor does it stop log\n        messages from being printed to standard output.\n\n        Examples\n        --------\n\n        The context manager is used as::\n\n            with logger.log_to_file('myfile.log'):\n                # your code here\n        ","endLoc":423,"header":"@contextmanager\n    def log_to_file(self, filename, filter_level=None, filter_origin=None)","id":763,"name":"log_to_file","nodeType":"Function","startLoc":376,"text":"@contextmanager\n    def log_to_file(self, filename, filter_level=None, filter_origin=None):\n        '''\n        Context manager to temporarily log messages to a file.\n\n        Parameters\n        ----------\n        filename : str\n            The file to log messages to.\n        filter_level : str\n            If set, any log messages less important than ``filter_level`` will\n            not be output to the file. Note that this is in addition to the\n            top-level filtering for the logger, so if the logger has level\n            'INFO', then setting ``filter_level`` to ``INFO`` or ``DEBUG``\n            will have no effect, since these messages are already filtered\n            out.\n        filter_origin : str\n            If set, only log messages with an origin starting with\n            ``filter_origin`` will be output to the file.\n\n        Notes\n        -----\n\n        By default, the logger already outputs log messages to a file set in\n        the Astropy configuration file. Using this context manager does not\n        stop log messages from being output to that file, nor does it stop log\n        messages from being printed to standard output.\n\n        Examples\n        --------\n\n        The context manager is used as::\n\n            with logger.log_to_file('myfile.log'):\n                # your code here\n        '''\n        encoding = conf.log_file_encoding if conf.log_file_encoding else None\n        fh = logging.FileHandler(filename, encoding=encoding)\n        if filter_level is not None:\n            fh.setLevel(filter_level)\n        if filter_origin is not None:\n            fh.addFilter(FilterOrigin(filter_origin))\n        f = logging.Formatter(conf.log_file_format)\n        fh.setFormatter(f)\n        self.addHandler(fh)\n        yield\n        fh.close()\n        self.removeHandler(fh)"},{"attributeType":"null","col":10,"comment":"null","endLoc":592,"id":765,"name":"ymin_cutout","nodeType":"Attribute","startLoc":592,"text":"self.ymin_cutout"},{"col":4,"comment":"\n        Parameters\n        ----------\n        msg : str\n            The message to print\n\n        color : str, optional\n            An ANSI terminal color name.  Must be one of: black, red,\n            green, brown, blue, magenta, cyan, lightgrey, default,\n            darkgrey, lightred, lightgreen, yellow, lightblue,\n            lightmagenta, lightcyan, white.\n\n        file : writable file-like, optional\n            The file to write the spinner to.  Defaults to\n            `sys.stdout`.  If ``file`` is not a tty (as determined by\n            calling its `isatty` member, if any, or special case hacks\n            to detect the IPython console), the spinner will be\n            completely silent.\n\n        step : int, optional\n            Only update the spinner every *step* steps\n\n        chars : str, optional\n            The character sequence to use for the spinner\n        ","endLoc":884,"header":"def __init__(self, msg, color='default', file=None, step=1,\n                 chars=None)","id":766,"name":"__init__","nodeType":"Function","startLoc":837,"text":"def __init__(self, msg, color='default', file=None, step=1,\n                 chars=None):\n        \"\"\"\n        Parameters\n        ----------\n        msg : str\n            The message to print\n\n        color : str, optional\n            An ANSI terminal color name.  Must be one of: black, red,\n            green, brown, blue, magenta, cyan, lightgrey, default,\n            darkgrey, lightred, lightgreen, yellow, lightblue,\n            lightmagenta, lightcyan, white.\n\n        file : writable file-like, optional\n            The file to write the spinner to.  Defaults to\n            `sys.stdout`.  If ``file`` is not a tty (as determined by\n            calling its `isatty` member, if any, or special case hacks\n            to detect the IPython console), the spinner will be\n            completely silent.\n\n        step : int, optional\n            Only update the spinner every *step* steps\n\n        chars : str, optional\n            The character sequence to use for the spinner\n        \"\"\"\n\n        if file is None:\n            file = _get_stdout()\n\n        self._msg = msg\n        self._color = color\n        self._file = file\n        self._step = step\n        if chars is None:\n            if conf.unicode_output:\n                chars = self._default_unicode_chars\n            else:\n                chars = self._default_ascii_chars\n        self._chars = chars\n\n        self._silent = not isatty(file)\n\n        if self._silent:\n            self._iter = self._silent_iterator()\n        else:\n            self._iter = self._iterator()"},{"attributeType":"null","col":28,"comment":"null","endLoc":593,"id":767,"name":"xmax_cutout","nodeType":"Attribute","startLoc":593,"text":"self.xmax_cutout"},{"col":4,"comment":"null","endLoc":566,"header":"def __init__(self, origin)","id":768,"name":"__init__","nodeType":"Function","startLoc":565,"text":"def __init__(self, origin):\n        self.origin = origin"},{"attributeType":"null","col":12,"comment":"null","endLoc":610,"id":769,"name":"wcs","nodeType":"Attribute","startLoc":610,"text":"self.wcs"},{"className":"NotifierMixin","col":0,"comment":"\n    Mixin class that provides services by which objects can register\n    listeners to changes on that object.\n\n    All methods provided by this class are underscored, since this is intended\n    for internal use to communicate between classes in a generic way, and is\n    not machinery that should be exposed to users of the classes involved.\n\n    Use the ``_add_listener`` method to register a listener on an instance of\n    the notifier.  This registers the listener with a weak reference, so if\n    no other references to the listener exist it is automatically dropped from\n    the list and does not need to be manually removed.\n\n    Call the ``_notify`` method on the notifier to update all listeners\n    upon changes.  ``_notify('change_type', *args, **kwargs)`` results\n    in calling ``listener._update_change_type(*args, **kwargs)`` on all\n    listeners subscribed to that notifier.\n\n    If a particular listener does not have the appropriate update method\n    it is ignored.\n\n    Examples\n    --------\n\n    >>> class Widget(NotifierMixin):\n    ...     state = 1\n    ...     def __init__(self, name):\n    ...         self.name = name\n    ...     def update_state(self):\n    ...         self.state += 1\n    ...         self._notify('widget_state_changed', self)\n    ...\n    >>> class WidgetListener:\n    ...     def _update_widget_state_changed(self, widget):\n    ...         print('Widget {0} changed state to {1}'.format(\n    ...             widget.name, widget.state))\n    ...\n    >>> widget = Widget('fred')\n    >>> listener = WidgetListener()\n    >>> widget._add_listener(listener)\n    >>> widget.update_state()\n    Widget fred changed state to 2\n    ","endLoc":147,"id":770,"nodeType":"Class","startLoc":33,"text":"class NotifierMixin:\n    \"\"\"\n    Mixin class that provides services by which objects can register\n    listeners to changes on that object.\n\n    All methods provided by this class are underscored, since this is intended\n    for internal use to communicate between classes in a generic way, and is\n    not machinery that should be exposed to users of the classes involved.\n\n    Use the ``_add_listener`` method to register a listener on an instance of\n    the notifier.  This registers the listener with a weak reference, so if\n    no other references to the listener exist it is automatically dropped from\n    the list and does not need to be manually removed.\n\n    Call the ``_notify`` method on the notifier to update all listeners\n    upon changes.  ``_notify('change_type', *args, **kwargs)`` results\n    in calling ``listener._update_change_type(*args, **kwargs)`` on all\n    listeners subscribed to that notifier.\n\n    If a particular listener does not have the appropriate update method\n    it is ignored.\n\n    Examples\n    --------\n\n    >>> class Widget(NotifierMixin):\n    ...     state = 1\n    ...     def __init__(self, name):\n    ...         self.name = name\n    ...     def update_state(self):\n    ...         self.state += 1\n    ...         self._notify('widget_state_changed', self)\n    ...\n    >>> class WidgetListener:\n    ...     def _update_widget_state_changed(self, widget):\n    ...         print('Widget {0} changed state to {1}'.format(\n    ...             widget.name, widget.state))\n    ...\n    >>> widget = Widget('fred')\n    >>> listener = WidgetListener()\n    >>> widget._add_listener(listener)\n    >>> widget.update_state()\n    Widget fred changed state to 2\n    \"\"\"\n\n    _listeners = None\n\n    def _add_listener(self, listener):\n        \"\"\"\n        Add an object to the list of listeners to notify of changes to this\n        object.  This adds a weakref to the list of listeners that is\n        removed from the listeners list when the listener has no other\n        references to it.\n        \"\"\"\n\n        if self._listeners is None:\n            self._listeners = weakref.WeakValueDictionary()\n\n        self._listeners[id(listener)] = listener\n\n    def _remove_listener(self, listener):\n        \"\"\"\n        Removes the specified listener from the listeners list.  This relies\n        on object identity (i.e. the ``is`` operator).\n        \"\"\"\n\n        if self._listeners is None:\n            return\n\n        with suppress(KeyError):\n            del self._listeners[id(listener)]\n\n    def _notify(self, notification, *args, **kwargs):\n        \"\"\"\n        Notify all listeners of some particular state change by calling their\n        ``_update_<notification>`` method with the given ``*args`` and\n        ``**kwargs``.\n\n        The notification does not by default include the object that actually\n        changed (``self``), but it certainly may if required.\n        \"\"\"\n\n        if self._listeners is None:\n            return\n\n        method_name = f'_update_{notification}'\n        for listener in self._listeners.valuerefs():\n            # Use valuerefs instead of itervaluerefs; see\n            # https://github.com/astropy/astropy/issues/4015\n            listener = listener()  # dereference weakref\n            if listener is None:\n                continue\n\n            if hasattr(listener, method_name):\n                method = getattr(listener, method_name)\n                if callable(method):\n                    method(*args, **kwargs)\n\n    def __getstate__(self):\n        \"\"\"\n        Exclude listeners when saving the listener's state, since they may be\n        ephemeral.\n        \"\"\"\n\n        # TODO: This hasn't come up often, but if anyone needs to pickle HDU\n        # objects it will be necessary when HDU objects' states are restored to\n        # re-register themselves as listeners on their new column instances.\n        try:\n            state = super().__getstate__()\n        except AttributeError:\n            # Chances are the super object doesn't have a getstate\n            state = self.__dict__.copy()\n\n        state['_listeners'] = None\n        return state"},{"col":4,"comment":"\n        Add an object to the list of listeners to notify of changes to this\n        object.  This adds a weakref to the list of listeners that is\n        removed from the listeners list when the listener has no other\n        references to it.\n        ","endLoc":91,"header":"def _add_listener(self, listener)","id":771,"name":"_add_listener","nodeType":"Function","startLoc":80,"text":"def _add_listener(self, listener):\n        \"\"\"\n        Add an object to the list of listeners to notify of changes to this\n        object.  This adds a weakref to the list of listeners that is\n        removed from the listeners list when the listener has no other\n        references to it.\n        \"\"\"\n\n        if self._listeners is None:\n            self._listeners = weakref.WeakValueDictionary()\n\n        self._listeners[id(listener)] = listener"},{"col":4,"comment":"\n        Construct a primary HDU.\n\n        Parameters\n        ----------\n        data : array or ``astropy.io.fits.hdu.base.DELAYED``, optional\n            The data in the HDU.\n\n        header : `~astropy.io.fits.Header`, optional\n            The header to be used (as a template).  If ``header`` is `None`, a\n            minimal header will be provided.\n\n        do_not_scale_image_data : bool, optional\n            If `True`, image data is not scaled using BSCALE/BZERO values\n            when read. (default: False)\n\n        ignore_blank : bool, optional\n            If `True`, the BLANK header keyword will be ignored if present.\n            Otherwise, pixels equal to this value will be replaced with\n            NaNs. (default: False)\n\n        uint : bool, optional\n            Interpret signed integer data where ``BZERO`` is the\n            central value and ``BSCALE == 1`` as unsigned integer\n            data.  For example, ``int16`` data with ``BZERO = 32768``\n            and ``BSCALE = 1`` would be treated as ``uint16`` data.\n            (default: True)\n\n        scale_back : bool, optional\n            If `True`, when saving changes to a file that contained scaled\n            image data, restore the data to the original type and reapply the\n            original BSCALE/BZERO values.  This could lead to loss of accuracy\n            if scaling back to integer values after performing floating point\n            operations on the data.  Pseudo-unsigned integers are automatically\n            rescaled unless scale_back is explicitly set to `False`.\n            (default: None)\n        ","endLoc":1078,"header":"def __init__(self, data=None, header=None, do_not_scale_image_data=False,\n                 ignore_blank=False,\n                 uint=True, scale_back=None)","id":772,"name":"__init__","nodeType":"Function","startLoc":1026,"text":"def __init__(self, data=None, header=None, do_not_scale_image_data=False,\n                 ignore_blank=False,\n                 uint=True, scale_back=None):\n        \"\"\"\n        Construct a primary HDU.\n\n        Parameters\n        ----------\n        data : array or ``astropy.io.fits.hdu.base.DELAYED``, optional\n            The data in the HDU.\n\n        header : `~astropy.io.fits.Header`, optional\n            The header to be used (as a template).  If ``header`` is `None`, a\n            minimal header will be provided.\n\n        do_not_scale_image_data : bool, optional\n            If `True`, image data is not scaled using BSCALE/BZERO values\n            when read. (default: False)\n\n        ignore_blank : bool, optional\n            If `True`, the BLANK header keyword will be ignored if present.\n            Otherwise, pixels equal to this value will be replaced with\n            NaNs. (default: False)\n\n        uint : bool, optional\n            Interpret signed integer data where ``BZERO`` is the\n            central value and ``BSCALE == 1`` as unsigned integer\n            data.  For example, ``int16`` data with ``BZERO = 32768``\n            and ``BSCALE = 1`` would be treated as ``uint16`` data.\n            (default: True)\n\n        scale_back : bool, optional\n            If `True`, when saving changes to a file that contained scaled\n            image data, restore the data to the original type and reapply the\n            original BSCALE/BZERO values.  This could lead to loss of accuracy\n            if scaling back to integer values after performing floating point\n            operations on the data.  Pseudo-unsigned integers are automatically\n            rescaled unless scale_back is explicitly set to `False`.\n            (default: None)\n        \"\"\"\n\n        super().__init__(\n            data=data, header=header,\n            do_not_scale_image_data=do_not_scale_image_data, uint=uint,\n            ignore_blank=ignore_blank,\n            scale_back=scale_back)\n\n        # insert the keywords EXTEND\n        if header is None:\n            dim = self._header['NAXIS']\n            if dim == 0:\n                dim = ''\n            self._header.set('EXTEND', True, after='NAXIS' + str(dim))"},{"col":4,"comment":"null","endLoc":957,"header":"def _silent_iterator(self)","id":773,"name":"_silent_iterator","nodeType":"Function","startLoc":952,"text":"def _silent_iterator(self):\n        color_print(self._msg, self._color, file=self._file, end='')\n        self._file.flush()\n\n        while True:\n            yield"},{"col":0,"comment":"\n    Prints colors and styles to the terminal uses ANSI escape\n    sequences.\n\n    ::\n\n       color_print('This is the color ', 'default', 'GREEN', 'green')\n\n    Parameters\n    ----------\n    positional args : str\n        The positional arguments come in pairs (*msg*, *color*), where\n        *msg* is the string to display and *color* is the color to\n        display it in.\n\n        *color* is an ANSI terminal color name.  Must be one of:\n        black, red, green, brown, blue, magenta, cyan, lightgrey,\n        default, darkgrey, lightred, lightgreen, yellow, lightblue,\n        lightmagenta, lightcyan, white, or '' (the empty string).\n\n    file : writable file-like, optional\n        Where to write to.  Defaults to `sys.stdout`.  If file is not\n        a tty (as determined by calling its `isatty` member, if one\n        exists), no coloring will be included.\n\n    end : str, optional\n        The ending of the message.  Defaults to ``\\n``.  The end will\n        be printed after resetting any color or font state.\n    ","endLoc":352,"header":"def color_print(*args, end='\\n', **kwargs)","id":774,"name":"color_print","nodeType":"Function","startLoc":296,"text":"def color_print(*args, end='\\n', **kwargs):\n    \"\"\"\n    Prints colors and styles to the terminal uses ANSI escape\n    sequences.\n\n    ::\n\n       color_print('This is the color ', 'default', 'GREEN', 'green')\n\n    Parameters\n    ----------\n    positional args : str\n        The positional arguments come in pairs (*msg*, *color*), where\n        *msg* is the string to display and *color* is the color to\n        display it in.\n\n        *color* is an ANSI terminal color name.  Must be one of:\n        black, red, green, brown, blue, magenta, cyan, lightgrey,\n        default, darkgrey, lightred, lightgreen, yellow, lightblue,\n        lightmagenta, lightcyan, white, or '' (the empty string).\n\n    file : writable file-like, optional\n        Where to write to.  Defaults to `sys.stdout`.  If file is not\n        a tty (as determined by calling its `isatty` member, if one\n        exists), no coloring will be included.\n\n    end : str, optional\n        The ending of the message.  Defaults to ``\\\\n``.  The end will\n        be printed after resetting any color or font state.\n    \"\"\"\n\n    file = kwargs.get('file', _get_stdout())\n\n    write = file.write\n    if isatty(file) and conf.use_color:\n        for i in range(0, len(args), 2):\n            msg = args[i]\n            if i + 1 == len(args):\n                color = ''\n            else:\n                color = args[i + 1]\n\n            if color:\n                msg = _color_text(msg, color)\n\n            # Some file objects support writing unicode sensibly on some Python\n            # versions; if this fails try creating a writer using the locale's\n            # preferred encoding. If that fails too give up.\n\n            write = _write_with_fallback(msg, write, file)\n\n        write(end)\n    else:\n        for i in range(0, len(args), 2):\n            msg = args[i]\n            write(msg)\n        write(end)"},{"col":4,"comment":"\n        Removes the specified listener from the listeners list.  This relies\n        on object identity (i.e. the ``is`` operator).\n        ","endLoc":103,"header":"def _remove_listener(self, listener)","id":775,"name":"_remove_listener","nodeType":"Function","startLoc":93,"text":"def _remove_listener(self, listener):\n        \"\"\"\n        Removes the specified listener from the listeners list.  This relies\n        on object identity (i.e. the ``is`` operator).\n        \"\"\"\n\n        if self._listeners is None:\n            return\n\n        with suppress(KeyError):\n            del self._listeners[id(listener)]"},{"attributeType":"null","col":8,"comment":"null","endLoc":582,"id":776,"name":"slices_original","nodeType":"Attribute","startLoc":582,"text":"self.slices_original"},{"attributeType":"null","col":10,"comment":"null","endLoc":589,"id":777,"name":"ymin_original","nodeType":"Attribute","startLoc":589,"text":"self.ymin_original"},{"col":4,"comment":"\n        Context manager to temporarily log messages to a list.\n\n        Parameters\n        ----------\n        filename : str\n            The file to log messages to.\n        filter_level : str\n            If set, any log messages less important than ``filter_level`` will\n            not be output to the file. Note that this is in addition to the\n            top-level filtering for the logger, so if the logger has level\n            'INFO', then setting ``filter_level`` to ``INFO`` or ``DEBUG``\n            will have no effect, since these messages are already filtered\n            out.\n        filter_origin : str\n            If set, only log messages with an origin starting with\n            ``filter_origin`` will be output to the file.\n\n        Notes\n        -----\n\n        Using this context manager does not stop log messages from being\n        output to standard output.\n\n        Examples\n        --------\n\n        The context manager is used as::\n\n            with logger.log_to_list() as log_list:\n                # your code here\n        ","endLoc":466,"header":"@contextmanager\n    def log_to_list(self, filter_level=None, filter_origin=None)","id":778,"name":"log_to_list","nodeType":"Function","startLoc":425,"text":"@contextmanager\n    def log_to_list(self, filter_level=None, filter_origin=None):\n        '''\n        Context manager to temporarily log messages to a list.\n\n        Parameters\n        ----------\n        filename : str\n            The file to log messages to.\n        filter_level : str\n            If set, any log messages less important than ``filter_level`` will\n            not be output to the file. Note that this is in addition to the\n            top-level filtering for the logger, so if the logger has level\n            'INFO', then setting ``filter_level`` to ``INFO`` or ``DEBUG``\n            will have no effect, since these messages are already filtered\n            out.\n        filter_origin : str\n            If set, only log messages with an origin starting with\n            ``filter_origin`` will be output to the file.\n\n        Notes\n        -----\n\n        Using this context manager does not stop log messages from being\n        output to standard output.\n\n        Examples\n        --------\n\n        The context manager is used as::\n\n            with logger.log_to_list() as log_list:\n                # your code here\n        '''\n        lh = ListHandler()\n        if filter_level is not None:\n            lh.setLevel(filter_level)\n        if filter_origin is not None:\n            lh.addFilter(FilterOrigin(filter_origin))\n        self.addHandler(lh)\n        yield lh.log_list\n        self.removeHandler(lh)"},{"col":0,"comment":"\n    Returns a string wrapped in ANSI color codes for coloring the\n    text in a terminal::\n\n        colored_text = color_text('Here is a message', 'blue')\n\n    This won't actually effect the text until it is printed to the\n    terminal.\n\n    Parameters\n    ----------\n    text : str\n        The string to return, bounded by the color codes.\n    color : str\n        An ANSI terminal color name. Must be one of:\n        black, red, green, brown, blue, magenta, cyan, lightgrey,\n        default, darkgrey, lightred, lightgreen, yellow, lightblue,\n        lightmagenta, lightcyan, white, or '' (the empty string).\n    ","endLoc":240,"header":"def _color_text(text, color)","id":779,"name":"_color_text","nodeType":"Function","startLoc":196,"text":"def _color_text(text, color):\n    \"\"\"\n    Returns a string wrapped in ANSI color codes for coloring the\n    text in a terminal::\n\n        colored_text = color_text('Here is a message', 'blue')\n\n    This won't actually effect the text until it is printed to the\n    terminal.\n\n    Parameters\n    ----------\n    text : str\n        The string to return, bounded by the color codes.\n    color : str\n        An ANSI terminal color name. Must be one of:\n        black, red, green, brown, blue, magenta, cyan, lightgrey,\n        default, darkgrey, lightred, lightgreen, yellow, lightblue,\n        lightmagenta, lightcyan, white, or '' (the empty string).\n    \"\"\"\n    color_mapping = {\n        'black': '0;30',\n        'red': '0;31',\n        'green': '0;32',\n        'brown': '0;33',\n        'blue': '0;34',\n        'magenta': '0;35',\n        'cyan': '0;36',\n        'lightgrey': '0;37',\n        'default': '0;39',\n        'darkgrey': '1;30',\n        'lightred': '1;31',\n        'lightgreen': '1;32',\n        'yellow': '1;33',\n        'lightblue': '1;34',\n        'lightmagenta': '1;35',\n        'lightcyan': '1;36',\n        'white': '1;37'}\n\n    if sys.platform == 'win32' and _IPython.OutStream is None:\n        # On Windows do not colorize text unless in IPython\n        return text\n\n    color_code = color_mapping.get(color, '0;39')\n    return f'\\033[{color_code}m{text}\\033[0m'"},{"col":0,"comment":"Write the supplied string with the given write function like\n    ``write(s)``, but use a writer for the locale's preferred encoding in case\n    of a UnicodeEncodeError.  Failing that attempt to write with 'utf-8' or\n    'latin-1'.\n    ","endLoc":293,"header":"def _write_with_fallback(s, write, fileobj)","id":780,"name":"_write_with_fallback","nodeType":"Function","startLoc":261,"text":"def _write_with_fallback(s, write, fileobj):\n    \"\"\"Write the supplied string with the given write function like\n    ``write(s)``, but use a writer for the locale's preferred encoding in case\n    of a UnicodeEncodeError.  Failing that attempt to write with 'utf-8' or\n    'latin-1'.\n    \"\"\"\n    try:\n        write(s)\n        return write\n    except UnicodeEncodeError:\n        # Let's try the next approach...\n        pass\n\n    enc = locale.getpreferredencoding()\n    try:\n        Writer = codecs.getwriter(enc)\n    except LookupError:\n        Writer = codecs.getwriter(_DEFAULT_ENCODING)\n\n    f = Writer(fileobj)\n    write = f.write\n\n    try:\n        write(s)\n        return write\n    except UnicodeEncodeError:\n        Writer = codecs.getwriter('latin-1')\n        f = Writer(fileobj)\n        write = f.write\n\n    # If this doesn't work let the exception bubble up; I'm out of ideas\n    write(s)\n    return write"},{"attributeType":"null","col":10,"comment":"null","endLoc":590,"id":781,"name":"xmin_original","nodeType":"Attribute","startLoc":590,"text":"self.xmin_original"},{"col":4,"comment":"\n        Notify all listeners of some particular state change by calling their\n        ``_update_<notification>`` method with the given ``*args`` and\n        ``**kwargs``.\n\n        The notification does not by default include the object that actually\n        changed (``self``), but it certainly may if required.\n        ","endLoc":129,"header":"def _notify(self, notification, *args, **kwargs)","id":782,"name":"_notify","nodeType":"Function","startLoc":105,"text":"def _notify(self, notification, *args, **kwargs):\n        \"\"\"\n        Notify all listeners of some particular state change by calling their\n        ``_update_<notification>`` method with the given ``*args`` and\n        ``**kwargs``.\n\n        The notification does not by default include the object that actually\n        changed (``self``), but it certainly may if required.\n        \"\"\"\n\n        if self._listeners is None:\n            return\n\n        method_name = f'_update_{notification}'\n        for listener in self._listeners.valuerefs():\n            # Use valuerefs instead of itervaluerefs; see\n            # https://github.com/astropy/astropy/issues/4015\n            listener = listener()  # dereference weakref\n            if listener is None:\n                continue\n\n            if hasattr(listener, method_name):\n                method = getattr(listener, method_name)\n                if callable(method):\n                    method(*args, **kwargs)"},{"col":4,"comment":"null","endLoc":577,"header":"def __init__(self, filter_level=None, filter_origin=None)","id":783,"name":"__init__","nodeType":"Function","startLoc":575,"text":"def __init__(self, filter_level=None, filter_origin=None):\n        logging.Handler.__init__(self)\n        self.log_list = []"},{"attributeType":"null","col":8,"comment":"null","endLoc":597,"id":784,"name":"_origin_original_true","nodeType":"Attribute","startLoc":597,"text":"self._origin_original_true"},{"attributeType":"null","col":30,"comment":"null","endLoc":589,"id":785,"name":"ymax_original","nodeType":"Attribute","startLoc":589,"text":"self.ymax_original"},{"col":4,"comment":"null","endLoc":915,"header":"def _iterator(self)","id":786,"name":"_iterator","nodeType":"Function","startLoc":886,"text":"def _iterator(self):\n        chars = self._chars\n        index = 0\n        file = self._file\n        write = file.write\n        flush = file.flush\n        try_fallback = True\n\n        while True:\n            write('\\r')\n            color_print(self._msg, self._color, file=file, end='')\n            write(' ')\n            try:\n                if try_fallback:\n                    write = _write_with_fallback(chars[index], write, file)\n                else:\n                    write(chars[index])\n            except UnicodeError:\n                # If even _write_with_fallback failed for any reason just give\n                # up on trying to use the unicode characters\n                chars = self._default_ascii_chars\n                write(chars[index])\n                try_fallback = False  # No good will come of using this again\n            flush()\n            yield\n\n            for i in range(self._step):\n                yield\n\n            index = (index + 1) % len(chars)"},{"col":4,"comment":"\n        Reset logger to its initial state\n        ","endLoc":525,"header":"def _set_defaults(self)","id":787,"name":"_set_defaults","nodeType":"Function","startLoc":468,"text":"def _set_defaults(self):\n        '''\n        Reset logger to its initial state\n        '''\n\n        # Reset any previously installed hooks\n        if self.warnings_logging_enabled():\n            self.disable_warnings_logging()\n        if self.exception_logging_enabled():\n            self.disable_exception_logging()\n\n        # Remove all previous handlers\n        for handler in self.handlers[:]:\n            self.removeHandler(handler)\n\n        # Set levels\n        self.setLevel(conf.log_level)\n\n        # Set up the stdout handler\n        sh = StreamHandler()\n        self.addHandler(sh)\n\n        # Set up the main log file handler if requested (but this might fail if\n        # configuration directory or log file is not writeable).\n        if conf.log_to_file:\n            log_file_path = conf.log_file_path\n\n            # \"None\" as a string because it comes from config\n            try:\n                _ASTROPY_TEST_\n                testing_mode = True\n            except NameError:\n                testing_mode = False\n\n            try:\n                if log_file_path == '' or testing_mode:\n                    log_file_path = os.path.join(\n                        _config.get_config_dir('astropy'), \"astropy.log\")\n                else:\n                    log_file_path = os.path.expanduser(log_file_path)\n\n                encoding = conf.log_file_encoding if conf.log_file_encoding else None\n                fh = logging.FileHandler(log_file_path, encoding=encoding)\n            except OSError as e:\n                warnings.warn(\n                    f'log file {log_file_path!r} could not be opened for writing: {str(e)}',\n                    RuntimeWarning)\n            else:\n                formatter = logging.Formatter(conf.log_file_format)\n                fh.setFormatter(formatter)\n                fh.setLevel(conf.log_file_level)\n                self.addHandler(fh)\n\n        if conf.log_warnings:\n            self.enable_warnings_logging()\n\n        if conf.log_exceptions:\n            self.enable_exception_logging()"},{"col":4,"comment":"\n        Exclude listeners when saving the listener's state, since they may be\n        ephemeral.\n        ","endLoc":147,"header":"def __getstate__(self)","id":788,"name":"__getstate__","nodeType":"Function","startLoc":131,"text":"def __getstate__(self):\n        \"\"\"\n        Exclude listeners when saving the listener's state, since they may be\n        ephemeral.\n        \"\"\"\n\n        # TODO: This hasn't come up often, but if anyone needs to pickle HDU\n        # objects it will be necessary when HDU objects' states are restored to\n        # re-register themselves as listeners on their new column instances.\n        try:\n            state = super().__getstate__()\n        except AttributeError:\n            # Chances are the super object doesn't have a getstate\n            state = self.__dict__.copy()\n\n        state['_listeners'] = None\n        return state"},{"attributeType":"null","col":4,"comment":"null","endLoc":78,"id":789,"name":"_listeners","nodeType":"Attribute","startLoc":78,"text":"_listeners"},{"attributeType":"null","col":12,"comment":"null","endLoc":89,"id":790,"name":"_listeners","nodeType":"Attribute","startLoc":89,"text":"self._listeners"},{"col":4,"comment":"null","endLoc":1372,"header":"def __new__(cls, input, ascii=False)","id":791,"name":"__new__","nodeType":"Function","startLoc":1359,"text":"def __new__(cls, input, ascii=False):\n        klass = cls\n\n        if (hasattr(input, '_columns_type') and\n                issubclass(input._columns_type, ColDefs)):\n            klass = input._columns_type\n        elif (hasattr(input, '_col_format_cls') and\n                issubclass(input._col_format_cls, _AsciiColumnFormat)):\n            klass = _AsciiColDefs\n\n        if ascii:  # force ASCII if this has been explicitly requested\n            klass = _AsciiColDefs\n\n        return object.__new__(klass)"},{"col":4,"comment":"null","endLoc":1375,"header":"def __getnewargs__(self)","id":792,"name":"__getnewargs__","nodeType":"Function","startLoc":1374,"text":"def __getnewargs__(self):\n        return (self._arrays,)"},{"col":4,"comment":"\n        Parameters\n        ----------\n\n        input : sequence of `Column` or `ColDefs` or ndarray or `~numpy.recarray`\n            An existing table HDU, an existing `ColDefs`, or any multi-field\n            Numpy array or `numpy.recarray`.\n\n        ascii : bool\n            Use True to ensure that ASCII table columns are used.\n\n        ","endLoc":1416,"header":"def __init__(self, input, ascii=False)","id":793,"name":"__init__","nodeType":"Function","startLoc":1377,"text":"def __init__(self, input, ascii=False):\n        \"\"\"\n        Parameters\n        ----------\n\n        input : sequence of `Column` or `ColDefs` or ndarray or `~numpy.recarray`\n            An existing table HDU, an existing `ColDefs`, or any multi-field\n            Numpy array or `numpy.recarray`.\n\n        ascii : bool\n            Use True to ensure that ASCII table columns are used.\n\n        \"\"\"\n        from .hdu.table import _TableBaseHDU\n        from .fitsrec import FITS_rec\n\n        if isinstance(input, ColDefs):\n            self._init_from_coldefs(input)\n        elif (isinstance(input, FITS_rec) and hasattr(input, '_coldefs') and\n                input._coldefs):\n            # If given a FITS_rec object we can directly copy its columns, but\n            # only if its columns have already been defined, otherwise this\n            # will loop back in on itself and blow up\n            self._init_from_coldefs(input._coldefs)\n        elif isinstance(input, np.ndarray) and input.dtype.fields is not None:\n            # Construct columns from the fields of a record array\n            self._init_from_array(input)\n        elif isiterable(input):\n            # if the input is a list of Columns\n            self._init_from_sequence(input)\n        elif isinstance(input, _TableBaseHDU):\n            # Construct columns from fields in an HDU header\n            self._init_from_table(input)\n        else:\n            raise TypeError('Input to ColDefs must be a table HDU, a list '\n                            'of Columns, or a record/field array.')\n\n        # Listen for changes on all columns\n        for col in self.columns:\n            col._add_listener(self)"},{"col":4,"comment":"\n        Parameters\n        ----------\n        total_or_items : int or sequence\n            If an int, the number of increments in the process being\n            tracked.  If a sequence, the items to iterate over.\n\n        ipython_widget : bool, optional\n            If `True`, the progress bar will display as an IPython\n            notebook widget.\n\n        file : writable file-like, optional\n            The file to write the progress bar to.  Defaults to\n            `sys.stdout`.  If ``file`` is not a tty (as determined by\n            calling its `isatty` member, if any, or special case hacks\n            to detect the IPython console), the progress bar will be\n            completely silent.\n        ","endLoc":542,"header":"def __init__(self, total_or_items, ipython_widget=False, file=None)","id":794,"name":"__init__","nodeType":"Function","startLoc":489,"text":"def __init__(self, total_or_items, ipython_widget=False, file=None):\n        \"\"\"\n        Parameters\n        ----------\n        total_or_items : int or sequence\n            If an int, the number of increments in the process being\n            tracked.  If a sequence, the items to iterate over.\n\n        ipython_widget : bool, optional\n            If `True`, the progress bar will display as an IPython\n            notebook widget.\n\n        file : writable file-like, optional\n            The file to write the progress bar to.  Defaults to\n            `sys.stdout`.  If ``file`` is not a tty (as determined by\n            calling its `isatty` member, if any, or special case hacks\n            to detect the IPython console), the progress bar will be\n            completely silent.\n        \"\"\"\n        if file is None:\n            file = _get_stdout()\n\n        if not ipython_widget and not isatty(file):\n            self.update = self._silent_update\n            self._silent = True\n        else:\n            self._silent = False\n\n        if isiterable(total_or_items):\n            self._items = iter(total_or_items)\n            self._total = len(total_or_items)\n        else:\n            try:\n                self._total = int(total_or_items)\n            except TypeError:\n                raise TypeError(\"First argument must be int or sequence\")\n            else:\n                self._items = iter(range(self._total))\n\n        self._file = file\n        self._start_time = time.time()\n        self._human_total = human_file_size(self._total)\n        self._ipython_widget = ipython_widget\n\n        self._signal_set = False\n        if not ipython_widget:\n            self._should_handle_resize = (\n                _CAN_RESIZE_TERMINAL and self._file.isatty())\n            self._handle_resize()\n            if self._should_handle_resize:\n                signal.signal(signal.SIGWINCH, self._handle_resize)\n                self._signal_set = True\n\n        self.update(0)"},{"attributeType":"null","col":8,"comment":"null","endLoc":587,"id":795,"name":"shape_input","nodeType":"Attribute","startLoc":587,"text":"self.shape_input"},{"attributeType":"null","col":8,"comment":"null","endLoc":586,"id":796,"name":"input_position_original","nodeType":"Attribute","startLoc":586,"text":"self.input_position_original"},{"attributeType":"null","col":30,"comment":"null","endLoc":590,"id":797,"name":"xmax_original","nodeType":"Attribute","startLoc":590,"text":"self.xmax_original"},{"col":4,"comment":"Initialize from an existing ColDefs object (just copy the\n        columns and convert their formats if necessary).\n        ","endLoc":1423,"header":"def _init_from_coldefs(self, coldefs)","id":798,"name":"_init_from_coldefs","nodeType":"Function","startLoc":1418,"text":"def _init_from_coldefs(self, coldefs):\n        \"\"\"Initialize from an existing ColDefs object (just copy the\n        columns and convert their formats if necessary).\n        \"\"\"\n\n        self.columns = [self._copy_column(col) for col in coldefs]"},{"attributeType":"null","col":28,"comment":"null","endLoc":592,"id":799,"name":"ymax_cutout","nodeType":"Attribute","startLoc":592,"text":"self.ymax_cutout"},{"col":4,"comment":"Utility function used currently only by _init_from_coldefs\n        to help convert columns from binary format to ASCII format or vice\n        versa if necessary (otherwise performs a straight copy).\n        ","endLoc":1568,"header":"def _copy_column(self, column)","id":800,"name":"_copy_column","nodeType":"Function","startLoc":1523,"text":"def _copy_column(self, column):\n        \"\"\"Utility function used currently only by _init_from_coldefs\n        to help convert columns from binary format to ASCII format or vice\n        versa if necessary (otherwise performs a straight copy).\n        \"\"\"\n\n        if isinstance(column.format, self._col_format_cls):\n            # This column has a FITS format compatible with this column\n            # definitions class (that is ascii or binary)\n            return column.copy()\n\n        new_column = column.copy()\n\n        # Try to use the Numpy recformat as the equivalency between the\n        # two formats; if that conversion can't be made then these\n        # columns can't be transferred\n        # TODO: Catch exceptions here and raise an explicit error about\n        # column format conversion\n        new_column.format = self._col_format_cls.from_column_format(column.format)\n\n        # Handle a few special cases of column format options that are not\n        # compatible between ASCII an binary tables\n        # TODO: This is sort of hacked in right now; we really need\n        # separate classes for ASCII and Binary table Columns, and they\n        # should handle formatting issues like these\n        if not isinstance(new_column.format, _AsciiColumnFormat):\n            # the column is a binary table column...\n            new_column.start = None\n            if new_column.null is not None:\n                # We can't just \"guess\" a value to represent null\n                # values in the new column, so just disable this for\n                # now; users may modify it later\n                new_column.null = None\n        else:\n            # the column is an ASCII table column...\n            if new_column.null is not None:\n                new_column.null = DEFAULT_ASCII_TNULL\n            if (new_column.disp is not None and\n                    new_column.disp.upper().startswith('L')):\n                # ASCII columns may not use the logical data display format;\n                # for now just drop the TDISPn option for this column as we\n                # don't have a systematic conversion of boolean data to ASCII\n                # tables yet\n                new_column.disp = None\n\n        return new_column"},{"className":"WCS","col":0,"comment":"WCS objects perform standard WCS transformations, and correct for\n    `SIP`_ and `distortion paper`_ table-lookup transformations, based\n    on the WCS keywords and supplementary data read from a FITS file.\n\n    See also: https://docs.astropy.org/en/stable/wcs/\n\n    Parameters\n    ----------\n    header : `~astropy.io.fits.Header`, `~astropy.io.fits.hdu.image.PrimaryHDU`, `~astropy.io.fits.hdu.image.ImageHDU`, str, dict-like, or None, optional\n        If *header* is not provided or None, the object will be\n        initialized to default values.\n\n    fobj : `~astropy.io.fits.HDUList`, optional\n        It is needed when header keywords point to a `distortion\n        paper`_ lookup table stored in a different extension.\n\n    key : str, optional\n        The name of a particular WCS transform to use.  This may be\n        either ``' '`` or ``'A'``-``'Z'`` and corresponds to the\n        ``\"a\"`` part of the ``CTYPEia`` cards.  *key* may only be\n        provided if *header* is also provided.\n\n    minerr : float, optional\n        The minimum value a distortion correction must have in order\n        to be applied. If the value of ``CQERRja`` is smaller than\n        *minerr*, the corresponding distortion is not applied.\n\n    relax : bool or int, optional\n        Degree of permissiveness:\n\n        - `True` (default): Admit all recognized informal extensions\n          of the WCS standard.\n\n        - `False`: Recognize only FITS keywords defined by the\n          published WCS standard.\n\n        - `int`: a bit field selecting specific extensions to accept.\n          See :ref:`astropy:relaxread` for details.\n\n    naxis : int or sequence, optional\n        Extracts specific coordinate axes using\n        :meth:`~astropy.wcs.Wcsprm.sub`.  If a header is provided, and\n        *naxis* is not ``None``, *naxis* will be passed to\n        :meth:`~astropy.wcs.Wcsprm.sub` in order to select specific\n        axes from the header.  See :meth:`~astropy.wcs.Wcsprm.sub` for\n        more details about this parameter.\n\n    keysel : sequence of str, optional\n        A sequence of flags used to select the keyword types\n        considered by wcslib.  When ``None``, only the standard image\n        header keywords are considered (and the underlying wcspih() C\n        function is called).  To use binary table image array or pixel\n        list keywords, *keysel* must be set.\n\n        Each element in the list should be one of the following\n        strings:\n\n        - 'image': Image header keywords\n\n        - 'binary': Binary table image array keywords\n\n        - 'pixel': Pixel list keywords\n\n        Keywords such as ``EQUIna`` or ``RFRQna`` that are common to\n        binary table image arrays and pixel lists (including\n        ``WCSNna`` and ``TWCSna``) are selected by both 'binary' and\n        'pixel'.\n\n    colsel : sequence of int, optional\n        A sequence of table column numbers used to restrict the WCS\n        transformations considered to only those pertaining to the\n        specified columns.  If `None`, there is no restriction.\n\n    fix : bool, optional\n        When `True` (default), call `~astropy.wcs.Wcsprm.fix` on\n        the resulting object to fix any non-standard uses in the\n        header.  `FITSFixedWarning` Warnings will be emitted if any\n        changes were made.\n\n    translate_units : str, optional\n        Specify which potentially unsafe translations of non-standard\n        unit strings to perform.  By default, performs none.  See\n        `WCS.fix` for more information about this parameter.  Only\n        effective when ``fix`` is `True`.\n\n    Raises\n    ------\n    MemoryError\n         Memory allocation failed.\n\n    ValueError\n         Invalid key.\n\n    KeyError\n         Key not found in FITS header.\n\n    ValueError\n         Lookup table distortion present in the header but *fobj* was\n         not provided.\n\n    Notes\n    -----\n\n    1. astropy.wcs supports arbitrary *n* dimensions for the core WCS\n       (the transformations handled by WCSLIB).  However, the\n       `distortion paper`_ lookup table and `SIP`_ distortions must be\n       two dimensional.  Therefore, if you try to create a WCS object\n       where the core WCS has a different number of dimensions than 2\n       and that object also contains a `distortion paper`_ lookup\n       table or `SIP`_ distortion, a `ValueError`\n       exception will be raised.  To avoid this, consider using the\n       *naxis* kwarg to select two dimensions from the core WCS.\n\n    2. The number of coordinate axes in the transformation is not\n       determined directly from the ``NAXIS`` keyword but instead from\n       the highest of:\n\n           - ``NAXIS`` keyword\n\n           - ``WCSAXESa`` keyword\n\n           - The highest axis number in any parameterized WCS keyword.\n             The keyvalue, as well as the keyword, must be\n             syntactically valid otherwise it will not be considered.\n\n       If none of these keyword types is present, i.e. if the header\n       only contains auxiliary WCS keywords for a particular\n       coordinate representation, then no coordinate description is\n       constructed for it.\n\n       The number of axes, which is set as the ``naxis`` member, may\n       differ for different coordinate representations of the same\n       image.\n\n    3. When the header includes duplicate keywords, in most cases the\n       last encountered is used.\n\n    4. `~astropy.wcs.Wcsprm.set` is called immediately after\n       construction, so any invalid keywords or transformations will\n       be raised by the constructor, not when subsequently calling a\n       transformation method.\n\n    ","endLoc":3280,"id":801,"nodeType":"Class","startLoc":235,"text":"class WCS(FITSWCSAPIMixin, WCSBase):\n    \"\"\"WCS objects perform standard WCS transformations, and correct for\n    `SIP`_ and `distortion paper`_ table-lookup transformations, based\n    on the WCS keywords and supplementary data read from a FITS file.\n\n    See also: https://docs.astropy.org/en/stable/wcs/\n\n    Parameters\n    ----------\n    header : `~astropy.io.fits.Header`, `~astropy.io.fits.hdu.image.PrimaryHDU`, `~astropy.io.fits.hdu.image.ImageHDU`, str, dict-like, or None, optional\n        If *header* is not provided or None, the object will be\n        initialized to default values.\n\n    fobj : `~astropy.io.fits.HDUList`, optional\n        It is needed when header keywords point to a `distortion\n        paper`_ lookup table stored in a different extension.\n\n    key : str, optional\n        The name of a particular WCS transform to use.  This may be\n        either ``' '`` or ``'A'``-``'Z'`` and corresponds to the\n        ``\\\"a\\\"`` part of the ``CTYPEia`` cards.  *key* may only be\n        provided if *header* is also provided.\n\n    minerr : float, optional\n        The minimum value a distortion correction must have in order\n        to be applied. If the value of ``CQERRja`` is smaller than\n        *minerr*, the corresponding distortion is not applied.\n\n    relax : bool or int, optional\n        Degree of permissiveness:\n\n        - `True` (default): Admit all recognized informal extensions\n          of the WCS standard.\n\n        - `False`: Recognize only FITS keywords defined by the\n          published WCS standard.\n\n        - `int`: a bit field selecting specific extensions to accept.\n          See :ref:`astropy:relaxread` for details.\n\n    naxis : int or sequence, optional\n        Extracts specific coordinate axes using\n        :meth:`~astropy.wcs.Wcsprm.sub`.  If a header is provided, and\n        *naxis* is not ``None``, *naxis* will be passed to\n        :meth:`~astropy.wcs.Wcsprm.sub` in order to select specific\n        axes from the header.  See :meth:`~astropy.wcs.Wcsprm.sub` for\n        more details about this parameter.\n\n    keysel : sequence of str, optional\n        A sequence of flags used to select the keyword types\n        considered by wcslib.  When ``None``, only the standard image\n        header keywords are considered (and the underlying wcspih() C\n        function is called).  To use binary table image array or pixel\n        list keywords, *keysel* must be set.\n\n        Each element in the list should be one of the following\n        strings:\n\n        - 'image': Image header keywords\n\n        - 'binary': Binary table image array keywords\n\n        - 'pixel': Pixel list keywords\n\n        Keywords such as ``EQUIna`` or ``RFRQna`` that are common to\n        binary table image arrays and pixel lists (including\n        ``WCSNna`` and ``TWCSna``) are selected by both 'binary' and\n        'pixel'.\n\n    colsel : sequence of int, optional\n        A sequence of table column numbers used to restrict the WCS\n        transformations considered to only those pertaining to the\n        specified columns.  If `None`, there is no restriction.\n\n    fix : bool, optional\n        When `True` (default), call `~astropy.wcs.Wcsprm.fix` on\n        the resulting object to fix any non-standard uses in the\n        header.  `FITSFixedWarning` Warnings will be emitted if any\n        changes were made.\n\n    translate_units : str, optional\n        Specify which potentially unsafe translations of non-standard\n        unit strings to perform.  By default, performs none.  See\n        `WCS.fix` for more information about this parameter.  Only\n        effective when ``fix`` is `True`.\n\n    Raises\n    ------\n    MemoryError\n         Memory allocation failed.\n\n    ValueError\n         Invalid key.\n\n    KeyError\n         Key not found in FITS header.\n\n    ValueError\n         Lookup table distortion present in the header but *fobj* was\n         not provided.\n\n    Notes\n    -----\n\n    1. astropy.wcs supports arbitrary *n* dimensions for the core WCS\n       (the transformations handled by WCSLIB).  However, the\n       `distortion paper`_ lookup table and `SIP`_ distortions must be\n       two dimensional.  Therefore, if you try to create a WCS object\n       where the core WCS has a different number of dimensions than 2\n       and that object also contains a `distortion paper`_ lookup\n       table or `SIP`_ distortion, a `ValueError`\n       exception will be raised.  To avoid this, consider using the\n       *naxis* kwarg to select two dimensions from the core WCS.\n\n    2. The number of coordinate axes in the transformation is not\n       determined directly from the ``NAXIS`` keyword but instead from\n       the highest of:\n\n           - ``NAXIS`` keyword\n\n           - ``WCSAXESa`` keyword\n\n           - The highest axis number in any parameterized WCS keyword.\n             The keyvalue, as well as the keyword, must be\n             syntactically valid otherwise it will not be considered.\n\n       If none of these keyword types is present, i.e. if the header\n       only contains auxiliary WCS keywords for a particular\n       coordinate representation, then no coordinate description is\n       constructed for it.\n\n       The number of axes, which is set as the ``naxis`` member, may\n       differ for different coordinate representations of the same\n       image.\n\n    3. When the header includes duplicate keywords, in most cases the\n       last encountered is used.\n\n    4. `~astropy.wcs.Wcsprm.set` is called immediately after\n       construction, so any invalid keywords or transformations will\n       be raised by the constructor, not when subsequently calling a\n       transformation method.\n\n    \"\"\"  # noqa: E501\n\n    def __init__(self, header=None, fobj=None, key=' ', minerr=0.0,\n                 relax=True, naxis=None, keysel=None, colsel=None,\n                 fix=True, translate_units='', _do_set=True):\n        close_fds = []\n\n        # these parameters are stored to be used when unpickling a WCS object:\n        self._init_kwargs = {\n            'keysel': copy.copy(keysel),\n            'colsel': copy.copy(colsel),\n        }\n\n        if header is None:\n            if naxis is None:\n                naxis = 2\n            wcsprm = _wcs.Wcsprm(header=None, key=key,\n                                 relax=relax, naxis=naxis)\n            self.naxis = wcsprm.naxis\n            # Set some reasonable defaults.\n            det2im = (None, None)\n            cpdis = (None, None)\n            sip = None\n        else:\n            keysel_flags = _parse_keysel(keysel)\n\n            if isinstance(header, (str, bytes)):\n                try:\n                    is_path = (possible_filename(header) and\n                               os.path.exists(header))\n                except (OSError, ValueError):\n                    is_path = False\n\n                if is_path:\n                    if fobj is not None:\n                        raise ValueError(\n                            \"Can not provide both a FITS filename to \"\n                            \"argument 1 and a FITS file object to argument 2\")\n                    fobj = fits.open(header)\n                    close_fds.append(fobj)\n                    header = fobj[0].header\n            elif isinstance(header, fits.hdu.image._ImageBaseHDU):\n                header = header.header\n            elif not isinstance(header, fits.Header):\n                try:\n                    # Accept any dict-like object\n                    orig_header = header\n                    header = fits.Header()\n                    for dict_key in orig_header.keys():\n                        header[dict_key] = orig_header[dict_key]\n                except TypeError:\n                    raise TypeError(\n                        \"header must be a string, an astropy.io.fits.Header \"\n                        \"object, or a dict-like object\")\n\n            if isinstance(header, fits.Header):\n                header_string = header.tostring().rstrip()\n            else:\n                header_string = header\n\n            # Importantly, header is a *copy* of the passed-in header\n            # because we will be modifying it\n            if isinstance(header_string, str):\n                header_bytes = header_string.encode('ascii')\n                header_string = header_string\n            else:\n                header_bytes = header_string\n                header_string = header_string.decode('ascii')\n\n            if not (fobj is None or isinstance(fobj, fits.HDUList)):\n                raise AssertionError(\"'fobj' must be either None or an \"\n                                     \"astropy.io.fits.HDUList object.\")\n\n            est_naxis = 2\n            try:\n                tmp_header = fits.Header.fromstring(header_string)\n                self._remove_sip_kw(tmp_header)\n                tmp_header_bytes = tmp_header.tostring().rstrip()\n                if isinstance(tmp_header_bytes, str):\n                    tmp_header_bytes = tmp_header_bytes.encode('ascii')\n                tmp_wcsprm = _wcs.Wcsprm(header=tmp_header_bytes, key=key,\n                                         relax=relax, keysel=keysel_flags,\n                                         colsel=colsel, warnings=False,\n                                         hdulist=fobj)\n                if naxis is not None:\n                    try:\n                        tmp_wcsprm = tmp_wcsprm.sub(naxis)\n                    except ValueError:\n                        pass\n                    est_naxis = tmp_wcsprm.naxis if tmp_wcsprm.naxis else 2\n\n            except _wcs.NoWcsKeywordsFoundError:\n                pass\n\n            self.naxis = est_naxis\n\n            header = fits.Header.fromstring(header_string)\n\n            det2im = self._read_det2im_kw(header, fobj, err=minerr)\n            cpdis = self._read_distortion_kw(\n                header, fobj, dist='CPDIS', err=minerr)\n            sip = self._read_sip_kw(header, wcskey=key)\n            self._remove_sip_kw(header)\n\n            header_string = header.tostring()\n            header_string = header_string.replace('END' + ' ' * 77, '')\n\n            if isinstance(header_string, str):\n                header_bytes = header_string.encode('ascii')\n                header_string = header_string\n            else:\n                header_bytes = header_string\n                header_string = header_string.decode('ascii')\n\n            try:\n                wcsprm = _wcs.Wcsprm(header=header_bytes, key=key,\n                                     relax=relax, keysel=keysel_flags,\n                                     colsel=colsel, hdulist=fobj)\n            except _wcs.NoWcsKeywordsFoundError:\n                # The header may have SIP or distortions, but no core\n                # WCS.  That isn't an error -- we want a \"default\"\n                # (identity) core Wcs transformation in that case.\n                if colsel is None:\n                    wcsprm = _wcs.Wcsprm(header=None, key=key,\n                                         relax=relax, keysel=keysel_flags,\n                                         colsel=colsel, hdulist=fobj)\n                else:\n                    raise\n\n            if naxis is not None:\n                wcsprm = wcsprm.sub(naxis)\n            self.naxis = wcsprm.naxis\n\n            if (wcsprm.naxis != 2 and\n                    (det2im[0] or det2im[1] or cpdis[0] or cpdis[1] or sip)):\n                raise ValueError(\n                    \"\"\"\nFITS WCS distortion paper lookup tables and SIP distortions only work\nin 2 dimensions.  However, WCSLIB has detected {} dimensions in the\ncore WCS keywords.  To use core WCS in conjunction with FITS WCS\ndistortion paper lookup tables or SIP distortion, you must select or\nreduce these to 2 dimensions using the naxis kwarg.\n\"\"\".format(wcsprm.naxis))\n\n            header_naxis = header.get('NAXIS', None)\n            if header_naxis is not None and header_naxis < wcsprm.naxis:\n                warnings.warn(\n                    \"The WCS transformation has more axes ({:d}) than the \"\n                    \"image it is associated with ({:d})\".format(\n                        wcsprm.naxis, header_naxis), FITSFixedWarning)\n\n        self._get_naxis(header)\n        WCSBase.__init__(self, sip, cpdis, wcsprm, det2im)\n\n        if fix:\n            if header is None:\n                with warnings.catch_warnings():\n                    warnings.simplefilter('ignore', FITSFixedWarning)\n                    self.fix(translate_units=translate_units)\n            else:\n                self.fix(translate_units=translate_units)\n\n        if _do_set:\n            self.wcs.set()\n\n        for fd in close_fds:\n            fd.close()\n\n        self._pixel_bounds = None\n\n    def __copy__(self):\n        new_copy = self.__class__()\n        WCSBase.__init__(new_copy, self.sip,\n                         (self.cpdis1, self.cpdis2),\n                         self.wcs,\n                         (self.det2im1, self.det2im2))\n        new_copy.__dict__.update(self.__dict__)\n        return new_copy\n\n    def __deepcopy__(self, memo):\n        from copy import deepcopy\n\n        new_copy = self.__class__()\n        new_copy.naxis = deepcopy(self.naxis, memo)\n        WCSBase.__init__(new_copy, deepcopy(self.sip, memo),\n                         (deepcopy(self.cpdis1, memo),\n                          deepcopy(self.cpdis2, memo)),\n                         deepcopy(self.wcs, memo),\n                         (deepcopy(self.det2im1, memo),\n                          deepcopy(self.det2im2, memo)))\n        for key, val in self.__dict__.items():\n            new_copy.__dict__[key] = deepcopy(val, memo)\n        return new_copy\n\n    def copy(self):\n        \"\"\"\n        Return a shallow copy of the object.\n\n        Convenience method so user doesn't have to import the\n        :mod:`copy` stdlib module.\n\n        .. warning::\n            Use `deepcopy` instead of `copy` unless you know why you need a\n            shallow copy.\n        \"\"\"\n        return copy.copy(self)\n\n    def deepcopy(self):\n        \"\"\"\n        Return a deep copy of the object.\n\n        Convenience method so user doesn't have to import the\n        :mod:`copy` stdlib module.\n        \"\"\"\n        return copy.deepcopy(self)\n\n    def sub(self, axes=None):\n\n        copy = self.deepcopy()\n\n        # We need to know which axes have been dropped, but there is no easy\n        # way to do this with the .sub function, so instead we assign UUIDs to\n        # the CNAME parameters in copy.wcs. We can later access the original\n        # CNAME properties from self.wcs.\n        cname_uuid = [str(uuid.uuid4()) for i in range(copy.wcs.naxis)]\n        copy.wcs.cname = cname_uuid\n\n        # Subset the WCS\n        copy.wcs = copy.wcs.sub(axes)\n        copy.naxis = copy.wcs.naxis\n\n        # Construct a list of dimensions from the original WCS in the order\n        # in which they appear in the final WCS.\n        keep = [cname_uuid.index(cname) if cname in cname_uuid else None\n                for cname in copy.wcs.cname]\n\n        # Restore the original CNAMEs\n        copy.wcs.cname = ['' if i is None else self.wcs.cname[i] for i in keep]\n\n        # Subset pixel_shape and pixel_bounds\n        if self.pixel_shape:\n            copy.pixel_shape = tuple([None if i is None else self.pixel_shape[i] for i in keep])\n        if self.pixel_bounds:\n            copy.pixel_bounds = [None if i is None else self.pixel_bounds[i] for i in keep]\n\n        return copy\n\n    if _wcs is not None:\n        sub.__doc__ = _wcs.Wcsprm.sub.__doc__\n\n    def _fix_scamp(self):\n        \"\"\"\n        Remove SCAMP's PVi_m distortion parameters if SIP distortion parameters\n        are also present. Some projects (e.g., Palomar Transient Factory)\n        convert SCAMP's distortion parameters (which abuse the PVi_m cards) to\n        SIP. However, wcslib gets confused by the presence of both SCAMP and\n        SIP distortion parameters.\n\n        See https://github.com/astropy/astropy/issues/299.\n        \"\"\"\n        # Nothing to be done if no WCS attached\n        if self.wcs is None:\n            return\n\n        # Nothing to be done if no PV parameters attached\n        pv = self.wcs.get_pv()\n        if not pv:\n            return\n\n        # Nothing to be done if axes don't use SIP distortion parameters\n        if self.sip is None:\n            return\n\n        # Nothing to be done if any radial terms are present...\n        # Loop over list to find any radial terms.\n        # Certain values of the `j' index are used for storing\n        # radial terms; refer to Equation (1) in\n        # <http://web.ipac.caltech.edu/staff/shupe/reprints/SIP_to_PV_SPIE2012.pdf>.\n        pv = np.asarray(pv)\n        # Loop over distinct values of `i' index\n        for i in set(pv[:, 0]):\n            # Get all values of `j' index for this value of `i' index\n            js = set(pv[:, 1][pv[:, 0] == i])\n            # Find max value of `j' index\n            max_j = max(js)\n            for j in (3, 11, 23, 39):\n                if j < max_j and j in js:\n                    return\n\n        self.wcs.set_pv([])\n        warnings.warn(\"Removed redundant SCAMP distortion parameters \" +\n                      \"because SIP parameters are also present\", FITSFixedWarning)\n\n    def fix(self, translate_units='', naxis=None):\n        \"\"\"\n        Perform the fix operations from wcslib, and warn about any\n        changes it has made.\n\n        Parameters\n        ----------\n        translate_units : str, optional\n            Specify which potentially unsafe translations of\n            non-standard unit strings to perform.  By default,\n            performs none.\n\n            Although ``\"S\"`` is commonly used to represent seconds,\n            its translation to ``\"s\"`` is potentially unsafe since the\n            standard recognizes ``\"S\"`` formally as Siemens, however\n            rarely that may be used.  The same applies to ``\"H\"`` for\n            hours (Henry), and ``\"D\"`` for days (Debye).\n\n            This string controls what to do in such cases, and is\n            case-insensitive.\n\n            - If the string contains ``\"s\"``, translate ``\"S\"`` to\n              ``\"s\"``.\n\n            - If the string contains ``\"h\"``, translate ``\"H\"`` to\n              ``\"h\"``.\n\n            - If the string contains ``\"d\"``, translate ``\"D\"`` to\n              ``\"d\"``.\n\n            Thus ``''`` doesn't do any unsafe translations, whereas\n            ``'shd'`` does all of them.\n\n        naxis : int array, optional\n            Image axis lengths.  If this array is set to zero or\n            ``None``, then `~astropy.wcs.Wcsprm.cylfix` will not be\n            invoked.\n        \"\"\"\n        if self.wcs is not None:\n            self._fix_scamp()\n            fixes = self.wcs.fix(translate_units, naxis)\n            for key, val in fixes.items():\n                if val != \"No change\":\n                    if (key == 'datfix' and '1858-11-17' in val and\n                            not np.count_nonzero(self.wcs.mjdref)):\n                        continue\n                    warnings.warn(\n                        (\"'{0}' made the change '{1}'.\").\n                        format(key, val),\n                        FITSFixedWarning)\n\n    def calc_footprint(self, header=None, undistort=True, axes=None, center=True):\n        \"\"\"\n        Calculates the footprint of the image on the sky.\n\n        A footprint is defined as the positions of the corners of the\n        image on the sky after all available distortions have been\n        applied.\n\n        Parameters\n        ----------\n        header : `~astropy.io.fits.Header` object, optional\n            Used to get ``NAXIS1`` and ``NAXIS2``\n            header and axes are mutually exclusive, alternative ways\n            to provide the same information.\n\n        undistort : bool, optional\n            If `True`, take SIP and distortion lookup table into\n            account\n\n        axes : (int, int), optional\n            If provided, use the given sequence as the shape of the\n            image.  Otherwise, use the ``NAXIS1`` and ``NAXIS2``\n            keywords from the header that was used to create this\n            `WCS` object.\n\n        center : bool, optional\n            If `True` use the center of the pixel, otherwise use the corner.\n\n        Returns\n        -------\n        coord : (4, 2) array of (*x*, *y*) coordinates.\n            The order is clockwise starting with the bottom left corner.\n        \"\"\"\n        if axes is not None:\n            naxis1, naxis2 = axes\n        else:\n            if header is None:\n                try:\n                    # classes that inherit from WCS and define naxis1/2\n                    # do not require a header parameter\n                    naxis1, naxis2 = self.pixel_shape\n                except (AttributeError, TypeError):\n                    warnings.warn(\n                        \"Need a valid header in order to calculate footprint\\n\", AstropyUserWarning)\n                    return None\n            else:\n                naxis1 = header.get('NAXIS1', None)\n                naxis2 = header.get('NAXIS2', None)\n\n        if naxis1 is None or naxis2 is None:\n            raise ValueError(\n                    \"Image size could not be determined.\")\n\n        if center:\n            corners = np.array([[1, 1],\n                                [1, naxis2],\n                                [naxis1, naxis2],\n                                [naxis1, 1]], dtype=np.float64)\n        else:\n            corners = np.array([[0.5, 0.5],\n                                [0.5, naxis2 + 0.5],\n                                [naxis1 + 0.5, naxis2 + 0.5],\n                                [naxis1 + 0.5, 0.5]], dtype=np.float64)\n\n        if undistort:\n            return self.all_pix2world(corners, 1)\n        else:\n            return self.wcs_pix2world(corners, 1)\n\n    def _read_det2im_kw(self, header, fobj, err=0.0):\n        \"\"\"\n        Create a `distortion paper`_ type lookup table for detector to\n        image plane correction.\n        \"\"\"\n        if fobj is None:\n            return (None, None)\n\n        if not isinstance(fobj, fits.HDUList):\n            return (None, None)\n\n        try:\n            axiscorr = header['AXISCORR']\n            d2imdis = self._read_d2im_old_format(header, fobj, axiscorr)\n            return d2imdis\n        except KeyError:\n            pass\n\n        dist = 'D2IMDIS'\n        d_kw = 'D2IM'\n        err_kw = 'D2IMERR'\n        tables = {}\n        for i in range(1, self.naxis + 1):\n            d_error = header.get(err_kw + str(i), 0.0)\n            if d_error < err:\n                tables[i] = None\n                continue\n            distortion = dist + str(i)\n            if distortion in header:\n                dis = header[distortion].lower()\n                if dis == 'lookup':\n                    del header[distortion]\n                    assert isinstance(fobj, fits.HDUList), (\n                        'An astropy.io.fits.HDUList'\n                        'is required for Lookup table distortion.')\n                    dp = (d_kw + str(i)).strip()\n                    dp_extver_key = dp + '.EXTVER'\n                    if dp_extver_key in header:\n                        d_extver = header[dp_extver_key]\n                        del header[dp_extver_key]\n                    else:\n                        d_extver = 1\n                    dp_axis_key = dp + f'.AXIS.{i:d}'\n                    if i == header[dp_axis_key]:\n                        d_data = fobj['D2IMARR', d_extver].data\n                    else:\n                        d_data = (fobj['D2IMARR', d_extver].data).transpose()\n                    del header[dp_axis_key]\n                    d_header = fobj['D2IMARR', d_extver].header\n                    d_crpix = (d_header.get('CRPIX1', 0.0), d_header.get('CRPIX2', 0.0))\n                    d_crval = (d_header.get('CRVAL1', 0.0), d_header.get('CRVAL2', 0.0))\n                    d_cdelt = (d_header.get('CDELT1', 1.0), d_header.get('CDELT2', 1.0))\n                    d_lookup = DistortionLookupTable(d_data, d_crpix,\n                                                     d_crval, d_cdelt)\n                    tables[i] = d_lookup\n                else:\n                    warnings.warn('Polynomial distortion is not implemented.\\n', AstropyUserWarning)\n                for key in set(header):\n                    if key.startswith(dp + '.'):\n                        del header[key]\n            else:\n                tables[i] = None\n        if not tables:\n            return (None, None)\n        else:\n            return (tables.get(1), tables.get(2))\n\n    def _read_d2im_old_format(self, header, fobj, axiscorr):\n        warnings.warn(\n            \"The use of ``AXISCORR`` for D2IM correction has been deprecated.\"\n            \"`~astropy.wcs` will read in files with ``AXISCORR`` but ``to_fits()`` will write \"\n            \"out files without it.\",\n            AstropyDeprecationWarning)\n        cpdis = [None, None]\n        crpix = [0., 0.]\n        crval = [0., 0.]\n        cdelt = [1., 1.]\n        try:\n            d2im_data = fobj[('D2IMARR', 1)].data\n        except KeyError:\n            return (None, None)\n        except AttributeError:\n            return (None, None)\n\n        d2im_data = np.array([d2im_data])\n        d2im_hdr = fobj[('D2IMARR', 1)].header\n        naxis = d2im_hdr['NAXIS']\n\n        for i in range(1, naxis + 1):\n            crpix[i - 1] = d2im_hdr.get('CRPIX' + str(i), 0.0)\n            crval[i - 1] = d2im_hdr.get('CRVAL' + str(i), 0.0)\n            cdelt[i - 1] = d2im_hdr.get('CDELT' + str(i), 1.0)\n\n        cpdis = DistortionLookupTable(d2im_data, crpix, crval, cdelt)\n\n        if axiscorr == 1:\n            return (cpdis, None)\n        elif axiscorr == 2:\n            return (None, cpdis)\n        else:\n            warnings.warn(\"Expected AXISCORR to be 1 or 2\", AstropyUserWarning)\n            return (None, None)\n\n    def _write_det2im(self, hdulist):\n        \"\"\"\n        Writes a `distortion paper`_ type lookup table to the given\n        `~astropy.io.fits.HDUList`.\n        \"\"\"\n\n        if self.det2im1 is None and self.det2im2 is None:\n            return\n        dist = 'D2IMDIS'\n        d_kw = 'D2IM'\n\n        def write_d2i(num, det2im):\n            if det2im is None:\n                return\n\n            hdulist[0].header[f'{dist}{num:d}'] = (\n                'LOOKUP', 'Detector to image correction type')\n            hdulist[0].header[f'{d_kw}{num:d}.EXTVER'] = (\n                num, 'Version number of WCSDVARR extension')\n            hdulist[0].header[f'{d_kw}{num:d}.NAXES'] = (\n                len(det2im.data.shape), 'Number of independent variables in D2IM function')\n\n            for i in range(det2im.data.ndim):\n                jth = {1: '1st', 2: '2nd', 3: '3rd'}.get(i + 1, f'{i + 1}th')\n                hdulist[0].header[f'{d_kw}{num:d}.AXIS.{i + 1:d}'] = (\n                    i + 1, f'Axis number of the {jth} variable in a D2IM function')\n\n            image = fits.ImageHDU(det2im.data, name='D2IMARR')\n            header = image.header\n\n            header['CRPIX1'] = (det2im.crpix[0],\n                                'Coordinate system reference pixel')\n            header['CRPIX2'] = (det2im.crpix[1],\n                                'Coordinate system reference pixel')\n            header['CRVAL1'] = (det2im.crval[0],\n                                'Coordinate system value at reference pixel')\n            header['CRVAL2'] = (det2im.crval[1],\n                                'Coordinate system value at reference pixel')\n            header['CDELT1'] = (det2im.cdelt[0],\n                                'Coordinate increment along axis')\n            header['CDELT2'] = (det2im.cdelt[1],\n                                'Coordinate increment along axis')\n            image.ver = int(hdulist[0].header[f'{d_kw}{num:d}.EXTVER'])\n            hdulist.append(image)\n        write_d2i(1, self.det2im1)\n        write_d2i(2, self.det2im2)\n\n    def _read_distortion_kw(self, header, fobj, dist='CPDIS', err=0.0):\n        \"\"\"\n        Reads `distortion paper`_ table-lookup keywords and data, and\n        returns a 2-tuple of `~astropy.wcs.DistortionLookupTable`\n        objects.\n\n        If no `distortion paper`_ keywords are found, ``(None, None)``\n        is returned.\n        \"\"\"\n        if isinstance(header, (str, bytes)):\n            return (None, None)\n\n        if dist == 'CPDIS':\n            d_kw = 'DP'\n            err_kw = 'CPERR'\n        else:\n            d_kw = 'DQ'\n            err_kw = 'CQERR'\n\n        tables = {}\n        for i in range(1, self.naxis + 1):\n            d_error_key = err_kw + str(i)\n            if d_error_key in header:\n                d_error = header[d_error_key]\n                del header[d_error_key]\n            else:\n                d_error = 0.0\n            if d_error < err:\n                tables[i] = None\n                continue\n            distortion = dist + str(i)\n            if distortion in header:\n                dis = header[distortion].lower()\n                del header[distortion]\n                if dis == 'lookup':\n                    if not isinstance(fobj, fits.HDUList):\n                        raise ValueError('an astropy.io.fits.HDUList is '\n                                         'required for Lookup table distortion.')\n                    dp = (d_kw + str(i)).strip()\n                    dp_extver_key = dp + '.EXTVER'\n                    if dp_extver_key in header:\n                        d_extver = header[dp_extver_key]\n                        del header[dp_extver_key]\n                    else:\n                        d_extver = 1\n                    dp_axis_key = dp + f'.AXIS.{i:d}'\n                    if i == header[dp_axis_key]:\n                        d_data = fobj['WCSDVARR', d_extver].data\n                    else:\n                        d_data = (fobj['WCSDVARR', d_extver].data).transpose()\n                    del header[dp_axis_key]\n                    d_header = fobj['WCSDVARR', d_extver].header\n                    d_crpix = (d_header.get('CRPIX1', 0.0),\n                               d_header.get('CRPIX2', 0.0))\n                    d_crval = (d_header.get('CRVAL1', 0.0),\n                               d_header.get('CRVAL2', 0.0))\n                    d_cdelt = (d_header.get('CDELT1', 1.0),\n                               d_header.get('CDELT2', 1.0))\n                    d_lookup = DistortionLookupTable(d_data, d_crpix, d_crval, d_cdelt)\n                    tables[i] = d_lookup\n\n                    for key in set(header):\n                        if key.startswith(dp + '.'):\n                            del header[key]\n                else:\n                    warnings.warn('Polynomial distortion is not implemented.\\n', AstropyUserWarning)\n            else:\n                tables[i] = None\n\n        if not tables:\n            return (None, None)\n        else:\n            return (tables.get(1), tables.get(2))\n\n    def _write_distortion_kw(self, hdulist, dist='CPDIS'):\n        \"\"\"\n        Write out `distortion paper`_ keywords to the given\n        `~astropy.io.fits.HDUList`.\n        \"\"\"\n        if self.cpdis1 is None and self.cpdis2 is None:\n            return\n\n        if dist == 'CPDIS':\n            d_kw = 'DP'\n        else:\n            d_kw = 'DQ'\n\n        def write_dist(num, cpdis):\n            if cpdis is None:\n                return\n\n            hdulist[0].header[f'{dist}{num:d}'] = (\n                'LOOKUP', 'Prior distortion function type')\n            hdulist[0].header[f'{d_kw}{num:d}.EXTVER'] = (\n                num, 'Version number of WCSDVARR extension')\n            hdulist[0].header[f'{d_kw}{num:d}.NAXES'] = (\n                len(cpdis.data.shape), f'Number of independent variables in {dist} function')\n\n            for i in range(cpdis.data.ndim):\n                jth = {1: '1st', 2: '2nd', 3: '3rd'}.get(i + 1, f'{i + 1}th')\n                hdulist[0].header[f'{d_kw}{num:d}.AXIS.{i + 1:d}'] = (\n                    i + 1,\n                    f'Axis number of the {jth} variable in a {dist} function')\n\n            image = fits.ImageHDU(cpdis.data, name='WCSDVARR')\n            header = image.header\n\n            header['CRPIX1'] = (cpdis.crpix[0], 'Coordinate system reference pixel')\n            header['CRPIX2'] = (cpdis.crpix[1], 'Coordinate system reference pixel')\n            header['CRVAL1'] = (cpdis.crval[0], 'Coordinate system value at reference pixel')\n            header['CRVAL2'] = (cpdis.crval[1], 'Coordinate system value at reference pixel')\n            header['CDELT1'] = (cpdis.cdelt[0], 'Coordinate increment along axis')\n            header['CDELT2'] = (cpdis.cdelt[1], 'Coordinate increment along axis')\n            image.ver = int(hdulist[0].header[f'{d_kw}{num:d}.EXTVER'])\n            hdulist.append(image)\n\n        write_dist(1, self.cpdis1)\n        write_dist(2, self.cpdis2)\n\n    def _remove_sip_kw(self, header):\n        \"\"\"\n        Remove SIP information from a header.\n        \"\"\"\n        # Never pass SIP coefficients to wcslib\n        # CTYPE must be passed with -SIP to wcslib\n        for key in set(m.group() for m in map(SIP_KW.match, list(header))\n                       if m is not None):\n            del header[key]\n\n    def _read_sip_kw(self, header, wcskey=\"\"):\n        \"\"\"\n        Reads `SIP`_ header keywords and returns a `~astropy.wcs.Sip`\n        object.\n\n        If no `SIP`_ header keywords are found, ``None`` is returned.\n        \"\"\"\n        if isinstance(header, (str, bytes)):\n            # TODO: Parse SIP from a string without pyfits around\n            return None\n\n        if \"A_ORDER\" in header and header['A_ORDER'] > 1:\n            if \"B_ORDER\" not in header:\n                raise ValueError(\n                    \"A_ORDER provided without corresponding B_ORDER \"\n                    \"keyword for SIP distortion\")\n\n            m = int(header[\"A_ORDER\"])\n            a = np.zeros((m + 1, m + 1), np.double)\n            for i in range(m + 1):\n                for j in range(m - i + 1):\n                    key = f\"A_{i}_{j}\"\n                    if key in header:\n                        a[i, j] = header[key]\n                        del header[key]\n\n            m = int(header[\"B_ORDER\"])\n            if m > 1:\n                b = np.zeros((m + 1, m + 1), np.double)\n                for i in range(m + 1):\n                    for j in range(m - i + 1):\n                        key = f\"B_{i}_{j}\"\n                        if key in header:\n                            b[i, j] = header[key]\n                            del header[key]\n            else:\n                a = None\n                b = None\n\n            del header['A_ORDER']\n            del header['B_ORDER']\n\n            ctype = [header[f'CTYPE{nax}{wcskey}'] for nax in range(1, self.naxis + 1)]\n            if any(not ctyp.endswith('-SIP') for ctyp in ctype):\n                message = \"\"\"\n                Inconsistent SIP distortion information is present in the FITS header and the WCS object:\n                SIP coefficients were detected, but CTYPE is missing a \"-SIP\" suffix.\n                astropy.wcs is using the SIP distortion coefficients,\n                therefore the coordinates calculated here might be incorrect.\n\n                If you do not want to apply the SIP distortion coefficients,\n                please remove the SIP coefficients from the FITS header or the\n                WCS object.  As an example, if the image is already distortion-corrected\n                (e.g., drizzled) then distortion components should not apply and the SIP\n                coefficients should be removed.\n\n                While the SIP distortion coefficients are being applied here, if that was indeed the intent,\n                for consistency please append \"-SIP\" to the CTYPE in the FITS header or the WCS object.\n\n                \"\"\"  # noqa: E501\n                log.info(message)\n        elif \"B_ORDER\" in header and header['B_ORDER'] > 1:\n            raise ValueError(\n                \"B_ORDER provided without corresponding A_ORDER \" +\n                \"keyword for SIP distortion\")\n        else:\n            a = None\n            b = None\n\n        if \"AP_ORDER\" in header and header['AP_ORDER'] > 1:\n            if \"BP_ORDER\" not in header:\n                raise ValueError(\n                    \"AP_ORDER provided without corresponding BP_ORDER \"\n                    \"keyword for SIP distortion\")\n\n            m = int(header[\"AP_ORDER\"])\n            ap = np.zeros((m + 1, m + 1), np.double)\n            for i in range(m + 1):\n                for j in range(m - i + 1):\n                    key = f\"AP_{i}_{j}\"\n                    if key in header:\n                        ap[i, j] = header[key]\n                        del header[key]\n\n            m = int(header[\"BP_ORDER\"])\n            if m > 1:\n                bp = np.zeros((m + 1, m + 1), np.double)\n                for i in range(m + 1):\n                    for j in range(m - i + 1):\n                        key = f\"BP_{i}_{j}\"\n                        if key in header:\n                            bp[i, j] = header[key]\n                            del header[key]\n            else:\n                ap = None\n                bp = None\n\n            del header['AP_ORDER']\n            del header['BP_ORDER']\n        elif \"BP_ORDER\" in header and header['BP_ORDER'] > 1:\n            raise ValueError(\n                \"BP_ORDER provided without corresponding AP_ORDER \"\n                \"keyword for SIP distortion\")\n        else:\n            ap = None\n            bp = None\n\n        if a is None and b is None and ap is None and bp is None:\n            return None\n\n        if f\"CRPIX1{wcskey}\" not in header or f\"CRPIX2{wcskey}\" not in header:\n            raise ValueError(\n                \"Header has SIP keywords without CRPIX keywords\")\n\n        crpix1 = header.get(f\"CRPIX1{wcskey}\")\n        crpix2 = header.get(f\"CRPIX2{wcskey}\")\n\n        return Sip(a, b, ap, bp, (crpix1, crpix2))\n\n    def _write_sip_kw(self):\n        \"\"\"\n        Write out SIP keywords.  Returns a dictionary of key-value\n        pairs.\n        \"\"\"\n        if self.sip is None:\n            return {}\n\n        keywords = {}\n\n        def write_array(name, a):\n            if a is None:\n                return\n            size = a.shape[0]\n            trdir = 'sky to detector' if name[-1] == 'P' else 'detector to sky'\n            comment = ('SIP polynomial order, axis {:d}, {:s}'\n                       .format(ord(name[0]) - ord('A'), trdir))\n            keywords[f'{name}_ORDER'] = size - 1, comment\n\n            comment = 'SIP distortion coefficient'\n            for i in range(size):\n                for j in range(size - i):\n                    if a[i, j] != 0.0:\n                        keywords[\n                            f'{name}_{i:d}_{j:d}'] = a[i, j], comment\n\n        write_array('A', self.sip.a)\n        write_array('B', self.sip.b)\n        write_array('AP', self.sip.ap)\n        write_array('BP', self.sip.bp)\n\n        return keywords\n\n    def _denormalize_sky(self, sky):\n        if self.wcs.lngtyp != 'RA':\n            raise ValueError(\n                \"WCS does not have longitude type of 'RA', therefore \" +\n                \"(ra, dec) data can not be used as input\")\n        if self.wcs.lattyp != 'DEC':\n            raise ValueError(\n                \"WCS does not have longitude type of 'DEC', therefore \" +\n                \"(ra, dec) data can not be used as input\")\n        if self.wcs.naxis == 2:\n            if self.wcs.lng == 0 and self.wcs.lat == 1:\n                return sky\n            elif self.wcs.lng == 1 and self.wcs.lat == 0:\n                # Reverse the order of the columns\n                return sky[:, ::-1]\n            else:\n                raise ValueError(\n                    \"WCS does not have longitude and latitude celestial \" +\n                    \"axes, therefore (ra, dec) data can not be used as input\")\n        else:\n            if self.wcs.lng < 0 or self.wcs.lat < 0:\n                raise ValueError(\n                    \"WCS does not have both longitude and latitude \"\n                    \"celestial axes, therefore (ra, dec) data can not be \" +\n                    \"used as input\")\n            out = np.zeros((sky.shape[0], self.wcs.naxis))\n            out[:, self.wcs.lng] = sky[:, 0]\n            out[:, self.wcs.lat] = sky[:, 1]\n            return out\n\n    def _normalize_sky(self, sky):\n        if self.wcs.lngtyp != 'RA':\n            raise ValueError(\n                \"WCS does not have longitude type of 'RA', therefore \" +\n                \"(ra, dec) data can not be returned\")\n        if self.wcs.lattyp != 'DEC':\n            raise ValueError(\n                \"WCS does not have longitude type of 'DEC', therefore \" +\n                \"(ra, dec) data can not be returned\")\n        if self.wcs.naxis == 2:\n            if self.wcs.lng == 0 and self.wcs.lat == 1:\n                return sky\n            elif self.wcs.lng == 1 and self.wcs.lat == 0:\n                # Reverse the order of the columns\n                return sky[:, ::-1]\n            else:\n                raise ValueError(\n                    \"WCS does not have longitude and latitude celestial \"\n                    \"axes, therefore (ra, dec) data can not be returned\")\n        else:\n            if self.wcs.lng < 0 or self.wcs.lat < 0:\n                raise ValueError(\n                    \"WCS does not have both longitude and latitude celestial \"\n                    \"axes, therefore (ra, dec) data can not be returned\")\n            out = np.empty((sky.shape[0], 2))\n            out[:, 0] = sky[:, self.wcs.lng]\n            out[:, 1] = sky[:, self.wcs.lat]\n            return out\n\n    def _array_converter(self, func, sky, *args, ra_dec_order=False):\n        \"\"\"\n        A helper function to support reading either a pair of arrays\n        or a single Nx2 array.\n        \"\"\"\n\n        def _return_list_of_arrays(axes, origin):\n            if any([x.size == 0 for x in axes]):\n                return axes\n\n            try:\n                axes = np.broadcast_arrays(*axes)\n            except ValueError:\n                raise ValueError(\n                    \"Coordinate arrays are not broadcastable to each other\")\n\n            xy = np.hstack([x.reshape((x.size, 1)) for x in axes])\n\n            if ra_dec_order and sky == 'input':\n                xy = self._denormalize_sky(xy)\n            output = func(xy, origin)\n            if ra_dec_order and sky == 'output':\n                output = self._normalize_sky(output)\n                return (output[:, 0].reshape(axes[0].shape),\n                        output[:, 1].reshape(axes[0].shape))\n            return [output[:, i].reshape(axes[0].shape)\n                    for i in range(output.shape[1])]\n\n        def _return_single_array(xy, origin):\n            if xy.shape[-1] != self.naxis:\n                raise ValueError(\n                    \"When providing two arguments, the array must be \"\n                    \"of shape (N, {})\".format(self.naxis))\n            if 0 in xy.shape:\n                return xy\n            if ra_dec_order and sky == 'input':\n                xy = self._denormalize_sky(xy)\n            result = func(xy, origin)\n            if ra_dec_order and sky == 'output':\n                result = self._normalize_sky(result)\n            return result\n\n        if len(args) == 2:\n            try:\n                xy, origin = args\n                xy = np.asarray(xy)\n                origin = int(origin)\n            except Exception:\n                raise TypeError(\n                    \"When providing two arguments, they must be \"\n                    \"(coords[N][{}], origin)\".format(self.naxis))\n            if xy.shape == () or len(xy.shape) == 1:\n                return _return_list_of_arrays([xy], origin)\n            return _return_single_array(xy, origin)\n\n        elif len(args) == self.naxis + 1:\n            axes = args[:-1]\n            origin = args[-1]\n            try:\n                axes = [np.asarray(x) for x in axes]\n                origin = int(origin)\n            except Exception:\n                raise TypeError(\n                    \"When providing more than two arguments, they must be \" +\n                    \"a 1-D array for each axis, followed by an origin.\")\n\n            return _return_list_of_arrays(axes, origin)\n\n        raise TypeError(\n            \"WCS projection has {0} dimensions, so expected 2 (an Nx{0} array \"\n            \"and the origin argument) or {1} arguments (the position in each \"\n            \"dimension, and the origin argument). Instead, {2} arguments were \"\n            \"given.\".format(\n                self.naxis, self.naxis + 1, len(args)))\n\n    def all_pix2world(self, *args, **kwargs):\n        return self._array_converter(\n            self._all_pix2world, 'output', *args, **kwargs)\n    all_pix2world.__doc__ = \"\"\"\n        Transforms pixel coordinates to world coordinates.\n\n        Performs all of the following in series:\n\n            - Detector to image plane correction (if present in the\n              FITS file)\n\n            - `SIP`_ distortion correction (if present in the FITS\n              file)\n\n            - `distortion paper`_ table-lookup correction (if present\n              in the FITS file)\n\n            - `wcslib`_ \"core\" WCS transformation\n\n        Parameters\n        ----------\n        {}\n\n            For a transformation that is not two-dimensional, the\n            two-argument form must be used.\n\n        {}\n\n        Returns\n        -------\n\n        {}\n\n        Notes\n        -----\n        The order of the axes for the result is determined by the\n        ``CTYPEia`` keywords in the FITS header, therefore it may not\n        always be of the form (*ra*, *dec*).  The\n        `~astropy.wcs.Wcsprm.lat`, `~astropy.wcs.Wcsprm.lng`,\n        `~astropy.wcs.Wcsprm.lattyp` and `~astropy.wcs.Wcsprm.lngtyp`\n        members can be used to determine the order of the axes.\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        SingularMatrixError\n            Linear transformation matrix is singular.\n\n        InconsistentAxisTypesError\n            Inconsistent or unrecognized coordinate axis types.\n\n        ValueError\n            Invalid parameter value.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n\n        ValueError\n            x- and y-coordinate arrays are not the same size.\n\n        InvalidTransformError\n            Invalid coordinate transformation parameters.\n\n        InvalidTransformError\n            Ill-conditioned coordinate transformation parameters.\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('naxis', 8),\n                   docstrings.RA_DEC_ORDER(8),\n                   docstrings.RETURNS('sky coordinates, in degrees', 8))\n\n    def wcs_pix2world(self, *args, **kwargs):\n        if self.wcs is None:\n            raise ValueError(\"No basic WCS settings were created.\")\n        return self._array_converter(\n            lambda xy, o: self.wcs.p2s(xy, o)['world'],\n            'output', *args, **kwargs)\n    wcs_pix2world.__doc__ = \"\"\"\n        Transforms pixel coordinates to world coordinates by doing\n        only the basic `wcslib`_ transformation.\n\n        No `SIP`_ or `distortion paper`_ table lookup correction is\n        applied.  To perform distortion correction, see\n        `~astropy.wcs.WCS.all_pix2world`,\n        `~astropy.wcs.WCS.sip_pix2foc`, `~astropy.wcs.WCS.p4_pix2foc`,\n        or `~astropy.wcs.WCS.pix2foc`.\n\n        Parameters\n        ----------\n        {}\n\n            For a transformation that is not two-dimensional, the\n            two-argument form must be used.\n\n        {}\n\n        Returns\n        -------\n\n        {}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        SingularMatrixError\n            Linear transformation matrix is singular.\n\n        InconsistentAxisTypesError\n            Inconsistent or unrecognized coordinate axis types.\n\n        ValueError\n            Invalid parameter value.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n\n        ValueError\n            x- and y-coordinate arrays are not the same size.\n\n        InvalidTransformError\n            Invalid coordinate transformation parameters.\n\n        InvalidTransformError\n            Ill-conditioned coordinate transformation parameters.\n\n        Notes\n        -----\n        The order of the axes for the result is determined by the\n        ``CTYPEia`` keywords in the FITS header, therefore it may not\n        always be of the form (*ra*, *dec*).  The\n        `~astropy.wcs.Wcsprm.lat`, `~astropy.wcs.Wcsprm.lng`,\n        `~astropy.wcs.Wcsprm.lattyp` and `~astropy.wcs.Wcsprm.lngtyp`\n        members can be used to determine the order of the axes.\n\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('naxis', 8),\n                   docstrings.RA_DEC_ORDER(8),\n                   docstrings.RETURNS('world coordinates, in degrees', 8))\n\n    def _all_world2pix(self, world, origin, tolerance, maxiter, adaptive,\n                       detect_divergence, quiet):\n        # ############################################################\n        # #          DESCRIPTION OF THE NUMERICAL METHOD            ##\n        # ############################################################\n        # In this section I will outline the method of solving\n        # the inverse problem of converting world coordinates to\n        # pixel coordinates (*inverse* of the direct transformation\n        # `all_pix2world`) and I will summarize some of the aspects\n        # of the method proposed here and some of the issues of the\n        # original `all_world2pix` (in relation to this method)\n        # discussed in https://github.com/astropy/astropy/issues/1977\n        # A more detailed discussion can be found here:\n        # https://github.com/astropy/astropy/pull/2373\n        #\n        #\n        #                  ### Background ###\n        #\n        #\n        # I will refer here to the [SIP Paper]\n        # (http://fits.gsfc.nasa.gov/registry/sip/SIP_distortion_v1_0.pdf).\n        # According to this paper, the effect of distortions as\n        # described in *their* equation (1) is:\n        #\n        # (1)   x = CD*(u+f(u)),\n        #\n        # where `x` is a *vector* of \"intermediate spherical\n        # coordinates\" (equivalent to (x,y) in the paper) and `u`\n        # is a *vector* of \"pixel coordinates\", and `f` is a vector\n        # function describing geometrical distortions\n        # (see equations 2 and 3 in SIP Paper.\n        # However, I prefer to use `w` for \"intermediate world\n        # coordinates\", `x` for pixel coordinates, and assume that\n        # transformation `W` performs the **linear**\n        # (CD matrix + projection onto celestial sphere) part of the\n        # conversion from pixel coordinates to world coordinates.\n        # Then we can re-write (1) as:\n        #\n        # (2)   w = W*(x+f(x)) = T(x)\n        #\n        # In `astropy.wcs.WCS` transformation `W` is represented by\n        # the `wcs_pix2world` member, while the combined (\"total\")\n        # transformation (linear part + distortions) is performed by\n        # `all_pix2world`. Below I summarize the notations and their\n        # equivalents in `astropy.wcs.WCS`:\n        #\n        # | Equation term | astropy.WCS/meaning          |\n        # | ------------- | ---------------------------- |\n        # | `x`           | pixel coordinates            |\n        # | `w`           | world coordinates            |\n        # | `W`           | `wcs_pix2world()`            |\n        # | `W^{-1}`      | `wcs_world2pix()`            |\n        # | `T`           | `all_pix2world()`            |\n        # | `x+f(x)`      | `pix2foc()`                  |\n        #\n        #\n        #      ### Direct Solving of Equation (2)  ###\n        #\n        #\n        # In order to find the pixel coordinates that correspond to\n        # given world coordinates `w`, it is necessary to invert\n        # equation (2): `x=T^{-1}(w)`, or solve equation `w==T(x)`\n        # for `x`. However, this approach has the following\n        # disadvantages:\n        #    1. It requires unnecessary transformations (see next\n        #       section).\n        #    2. It is prone to \"RA wrapping\" issues as described in\n        # https://github.com/astropy/astropy/issues/1977\n        # (essentially because `all_pix2world` may return points with\n        # a different phase than user's input `w`).\n        #\n        #\n        #      ### Description of the Method Used here ###\n        #\n        #\n        # By applying inverse linear WCS transformation (`W^{-1}`)\n        # to both sides of equation (2) and introducing notation `x'`\n        # (prime) for the pixels coordinates obtained from the world\n        # coordinates by applying inverse *linear* WCS transformation\n        # (\"focal plane coordinates\"):\n        #\n        # (3)   x' = W^{-1}(w)\n        #\n        # we obtain the following equation:\n        #\n        # (4)   x' = x+f(x),\n        #\n        # or,\n        #\n        # (5)   x = x'-f(x)\n        #\n        # This equation is well suited for solving using the method\n        # of fixed-point iterations\n        # (http://en.wikipedia.org/wiki/Fixed-point_iteration):\n        #\n        # (6)   x_{i+1} = x'-f(x_i)\n        #\n        # As an initial value of the pixel coordinate `x_0` we take\n        # \"focal plane coordinate\" `x'=W^{-1}(w)=wcs_world2pix(w)`.\n        # We stop iterations when `|x_{i+1}-x_i|<tolerance`. We also\n        # consider the process to be diverging if\n        # `|x_{i+1}-x_i|>|x_i-x_{i-1}|`\n        # **when** `|x_{i+1}-x_i|>=tolerance` (when current\n        # approximation is close to the true solution,\n        # `|x_{i+1}-x_i|>|x_i-x_{i-1}|` may be due to rounding errors\n        # and we ignore such \"divergences\" when\n        # `|x_{i+1}-x_i|<tolerance`). It may appear that checking for\n        # `|x_{i+1}-x_i|<tolerance` in order to ignore divergence is\n        # unnecessary since the iterative process should stop anyway,\n        # however, the proposed implementation of this iterative\n        # process is completely vectorized and, therefore, we may\n        # continue iterating over *some* points even though they have\n        # converged to within a specified tolerance (while iterating\n        # over other points that have not yet converged to\n        # a solution).\n        #\n        # In order to efficiently implement iterative process (6)\n        # using available methods in `astropy.wcs.WCS`, we add and\n        # subtract `x_i` from the right side of equation (6):\n        #\n        # (7)   x_{i+1} = x'-(x_i+f(x_i))+x_i = x'-pix2foc(x_i)+x_i,\n        #\n        # where `x'=wcs_world2pix(w)` and it is computed only *once*\n        # before the beginning of the iterative process (and we also\n        # set `x_0=x'`). By using `pix2foc` at each iteration instead\n        # of `all_pix2world` we get about 25% increase in performance\n        # (by not performing the linear `W` transformation at each\n        # step) and we also avoid the \"RA wrapping\" issue described\n        # above (by working in focal plane coordinates and avoiding\n        # pix->world transformations).\n        #\n        # As an added benefit, the process converges to the correct\n        # solution in just one iteration when distortions are not\n        # present (compare to\n        # https://github.com/astropy/astropy/issues/1977 and\n        # https://github.com/astropy/astropy/pull/2294): in this case\n        # `pix2foc` is the identical transformation\n        # `x_i=pix2foc(x_i)` and from equation (7) we get:\n        #\n        # x' = x_0 = wcs_world2pix(w)\n        # x_1 = x' - pix2foc(x_0) + x_0 = x' - pix2foc(x') + x' = x'\n        #     = wcs_world2pix(w) = x_0\n        # =>\n        # |x_1-x_0| = 0 < tolerance (with tolerance > 0)\n        #\n        # However, for performance reasons, it is still better to\n        # avoid iterations altogether and return the exact linear\n        # solution (`wcs_world2pix`) right-away when non-linear\n        # distortions are not present by checking that attributes\n        # `sip`, `cpdis1`, `cpdis2`, `det2im1`, and `det2im2` are\n        # *all* `None`.\n        #\n        #\n        #         ### Outline of the Algorithm ###\n        #\n        #\n        # While the proposed code is relatively long (considering\n        # the simplicity of the algorithm), this is due to: 1)\n        # checking if iterative solution is necessary at all; 2)\n        # checking for divergence; 3) re-implementation of the\n        # completely vectorized algorithm as an \"adaptive\" vectorized\n        # algorithm (for cases when some points diverge for which we\n        # want to stop iterations). In my tests, the adaptive version\n        # of the algorithm is about 50% slower than non-adaptive\n        # version for all HST images.\n        #\n        # The essential part of the vectorized non-adaptive algorithm\n        # (without divergence and other checks) can be described\n        # as follows:\n        #\n        #     pix0 = self.wcs_world2pix(world, origin)\n        #     pix  = pix0.copy() # 0-order solution\n        #\n        #     for k in range(maxiter):\n        #         # find correction to the previous solution:\n        #         dpix = self.pix2foc(pix, origin) - pix0\n        #\n        #         # compute norm (L2) of the correction:\n        #         dn = np.linalg.norm(dpix, axis=1)\n        #\n        #         # apply correction:\n        #         pix -= dpix\n        #\n        #         # check convergence:\n        #         if np.max(dn) < tolerance:\n        #             break\n        #\n        #    return pix\n        #\n        # Here, the input parameter `world` can be a `MxN` array\n        # where `M` is the number of coordinate axes in WCS and `N`\n        # is the number of points to be converted simultaneously to\n        # image coordinates.\n        #\n        #\n        #                ###  IMPORTANT NOTE:  ###\n        #\n        # If, in the future releases of the `~astropy.wcs`,\n        # `pix2foc` will not apply all the required distortion\n        # corrections then in the code below, calls to `pix2foc` will\n        # have to be replaced with\n        # wcs_world2pix(all_pix2world(pix_list, origin), origin)\n        #\n\n        # ############################################################\n        # #            INITIALIZE ITERATIVE PROCESS:                ##\n        # ############################################################\n\n        # initial approximation (linear WCS based only)\n        pix0 = self.wcs_world2pix(world, origin)\n\n        # Check that an iterative solution is required at all\n        # (when any of the non-CD-matrix-based corrections are\n        # present). If not required return the initial\n        # approximation (pix0).\n        if not self.has_distortion:\n            # No non-WCS corrections detected so\n            # simply return initial approximation:\n            return pix0\n\n        pix = pix0.copy()  # 0-order solution\n\n        # initial correction:\n        dpix = self.pix2foc(pix, origin) - pix0\n\n        # Update initial solution:\n        pix -= dpix\n\n        # Norm (L2) squared of the correction:\n        dn = np.sum(dpix*dpix, axis=1)\n        dnprev = dn.copy()  # if adaptive else dn\n        tol2 = tolerance**2\n\n        # Prepare for iterative process\n        k = 1\n        ind = None\n        inddiv = None\n\n        # Turn off numpy runtime warnings for 'invalid' and 'over':\n        old_invalid = np.geterr()['invalid']\n        old_over = np.geterr()['over']\n        np.seterr(invalid='ignore', over='ignore')\n\n        # ############################################################\n        # #                NON-ADAPTIVE ITERATIONS:                 ##\n        # ############################################################\n        if not adaptive:\n            # Fixed-point iterations:\n            while (np.nanmax(dn) >= tol2 and k < maxiter):\n                # Find correction to the previous solution:\n                dpix = self.pix2foc(pix, origin) - pix0\n\n                # Compute norm (L2) squared of the correction:\n                dn = np.sum(dpix*dpix, axis=1)\n\n                # Check for divergence (we do this in two stages\n                # to optimize performance for the most common\n                # scenario when successive approximations converge):\n                if detect_divergence:\n                    divergent = (dn >= dnprev)\n                    if np.any(divergent):\n                        # Find solutions that have not yet converged:\n                        slowconv = (dn >= tol2)\n                        inddiv, = np.where(divergent & slowconv)\n\n                        if inddiv.shape[0] > 0:\n                            # Update indices of elements that\n                            # still need correction:\n                            conv = (dn < dnprev)\n                            iconv = np.where(conv)\n\n                            # Apply correction:\n                            dpixgood = dpix[iconv]\n                            pix[iconv] -= dpixgood\n                            dpix[iconv] = dpixgood\n\n                            # For the next iteration choose\n                            # non-divergent points that have not yet\n                            # converged to the requested accuracy:\n                            ind, = np.where(slowconv & conv)\n                            pix0 = pix0[ind]\n                            dnprev[ind] = dn[ind]\n                            k += 1\n\n                            # Switch to adaptive iterations:\n                            adaptive = True\n                            break\n                    # Save current correction magnitudes for later:\n                    dnprev = dn\n\n                # Apply correction:\n                pix -= dpix\n                k += 1\n\n        # ############################################################\n        # #                  ADAPTIVE ITERATIONS:                   ##\n        # ############################################################\n        if adaptive:\n            if ind is None:\n                ind, = np.where(np.isfinite(pix).all(axis=1))\n                pix0 = pix0[ind]\n\n            # \"Adaptive\" fixed-point iterations:\n            while (ind.shape[0] > 0 and k < maxiter):\n                # Find correction to the previous solution:\n                dpixnew = self.pix2foc(pix[ind], origin) - pix0\n\n                # Compute norm (L2) of the correction:\n                dnnew = np.sum(np.square(dpixnew), axis=1)\n\n                # Bookkeeping of corrections:\n                dnprev[ind] = dn[ind].copy()\n                dn[ind] = dnnew\n\n                if detect_divergence:\n                    # Find indices of pixels that are converging:\n                    conv = (dnnew < dnprev[ind])\n                    iconv = np.where(conv)\n                    iiconv = ind[iconv]\n\n                    # Apply correction:\n                    dpixgood = dpixnew[iconv]\n                    pix[iiconv] -= dpixgood\n                    dpix[iiconv] = dpixgood\n\n                    # Find indices of solutions that have not yet\n                    # converged to the requested accuracy\n                    # AND that do not diverge:\n                    subind, = np.where((dnnew >= tol2) & conv)\n\n                else:\n                    # Apply correction:\n                    pix[ind] -= dpixnew\n                    dpix[ind] = dpixnew\n\n                    # Find indices of solutions that have not yet\n                    # converged to the requested accuracy:\n                    subind, = np.where(dnnew >= tol2)\n\n                # Choose solutions that need more iterations:\n                ind = ind[subind]\n                pix0 = pix0[subind]\n\n                k += 1\n\n        # ############################################################\n        # #         FINAL DETECTION OF INVALID, DIVERGING,          ##\n        # #         AND FAILED-TO-CONVERGE POINTS                   ##\n        # ############################################################\n        # Identify diverging and/or invalid points:\n        invalid = ((~np.all(np.isfinite(pix), axis=1)) &\n                   (np.all(np.isfinite(world), axis=1)))\n\n        # When detect_divergence==False, dnprev is outdated\n        # (it is the norm of the very first correction).\n        # Still better than nothing...\n        inddiv, = np.where(((dn >= tol2) & (dn >= dnprev)) | invalid)\n        if inddiv.shape[0] == 0:\n            inddiv = None\n\n        # Identify points that did not converge within 'maxiter'\n        # iterations:\n        if k >= maxiter:\n            ind, = np.where((dn >= tol2) & (dn < dnprev) & (~invalid))\n            if ind.shape[0] == 0:\n                ind = None\n        else:\n            ind = None\n\n        # Restore previous numpy error settings:\n        np.seterr(invalid=old_invalid, over=old_over)\n\n        # ############################################################\n        # #  RAISE EXCEPTION IF DIVERGING OR TOO SLOWLY CONVERGING  ##\n        # #  DATA POINTS HAVE BEEN DETECTED:                        ##\n        # ############################################################\n        if (ind is not None or inddiv is not None) and not quiet:\n            if inddiv is None:\n                raise NoConvergence(\n                    \"'WCS.all_world2pix' failed to \"\n                    \"converge to the requested accuracy after {:d} \"\n                    \"iterations.\".format(k), best_solution=pix,\n                    accuracy=np.abs(dpix), niter=k,\n                    slow_conv=ind, divergent=None)\n            else:\n                raise NoConvergence(\n                    \"'WCS.all_world2pix' failed to \"\n                    \"converge to the requested accuracy.\\n\"\n                    \"After {:d} iterations, the solution is diverging \"\n                    \"at least for one input point.\"\n                    .format(k), best_solution=pix,\n                    accuracy=np.abs(dpix), niter=k,\n                    slow_conv=ind, divergent=inddiv)\n\n        return pix\n\n    @deprecated_renamed_argument('accuracy', 'tolerance', '4.3')\n    def all_world2pix(self, *args, tolerance=1e-4, maxiter=20, adaptive=False,\n                      detect_divergence=True, quiet=False, **kwargs):\n        if self.wcs is None:\n            raise ValueError(\"No basic WCS settings were created.\")\n\n        return self._array_converter(\n            lambda *args, **kwargs:\n            self._all_world2pix(\n                *args, tolerance=tolerance, maxiter=maxiter,\n                adaptive=adaptive, detect_divergence=detect_divergence,\n                quiet=quiet),\n            'input', *args, **kwargs\n        )\n\n    all_world2pix.__doc__ = \"\"\"\n        all_world2pix(*arg, tolerance=1.0e-4, maxiter=20,\n        adaptive=False, detect_divergence=True, quiet=False)\n\n        Transforms world coordinates to pixel coordinates, using\n        numerical iteration to invert the full forward transformation\n        `~astropy.wcs.WCS.all_pix2world` with complete\n        distortion model.\n\n\n        Parameters\n        ----------\n        {0}\n\n            For a transformation that is not two-dimensional, the\n            two-argument form must be used.\n\n        {1}\n\n        tolerance : float, optional (default = 1.0e-4)\n            Tolerance of solution. Iteration terminates when the\n            iterative solver estimates that the \"true solution\" is\n            within this many pixels current estimate, more\n            specifically, when the correction to the solution found\n            during the previous iteration is smaller\n            (in the sense of the L2 norm) than ``tolerance``.\n\n        maxiter : int, optional (default = 20)\n            Maximum number of iterations allowed to reach a solution.\n\n        quiet : bool, optional (default = False)\n            Do not throw :py:class:`NoConvergence` exceptions when\n            the method does not converge to a solution with the\n            required accuracy within a specified number of maximum\n            iterations set by ``maxiter`` parameter. Instead,\n            simply return the found solution.\n\n        Other Parameters\n        ----------------\n        adaptive : bool, optional (default = False)\n            Specifies whether to adaptively select only points that\n            did not converge to a solution within the required\n            accuracy for the next iteration. Default is recommended\n            for HST as well as most other instruments.\n\n            .. note::\n               The :py:meth:`all_world2pix` uses a vectorized\n               implementation of the method of consecutive\n               approximations (see ``Notes`` section below) in which it\n               iterates over *all* input points *regardless* until\n               the required accuracy has been reached for *all* input\n               points. In some cases it may be possible that\n               *almost all* points have reached the required accuracy\n               but there are only a few of input data points for\n               which additional iterations may be needed (this\n               depends mostly on the characteristics of the geometric\n               distortions for a given instrument). In this situation\n               it may be advantageous to set ``adaptive`` = `True` in\n               which case :py:meth:`all_world2pix` will continue\n               iterating *only* over the points that have not yet\n               converged to the required accuracy. However, for the\n               HST's ACS/WFC detector, which has the strongest\n               distortions of all HST instruments, testing has\n               shown that enabling this option would lead to a about\n               50-100% penalty in computational time (depending on\n               specifics of the image, geometric distortions, and\n               number of input points to be converted). Therefore,\n               for HST and possibly instruments, it is recommended\n               to set ``adaptive`` = `False`. The only danger in\n               getting this setting wrong will be a performance\n               penalty.\n\n            .. note::\n               When ``detect_divergence`` is `True`,\n               :py:meth:`all_world2pix` will automatically switch\n               to the adaptive algorithm once divergence has been\n               detected.\n\n        detect_divergence : bool, optional (default = True)\n            Specifies whether to perform a more detailed analysis\n            of the convergence to a solution. Normally\n            :py:meth:`all_world2pix` may not achieve the required\n            accuracy if either the ``tolerance`` or ``maxiter`` arguments\n            are too low. However, it may happen that for some\n            geometric distortions the conditions of convergence for\n            the the method of consecutive approximations used by\n            :py:meth:`all_world2pix` may not be satisfied, in which\n            case consecutive approximations to the solution will\n            diverge regardless of the ``tolerance`` or ``maxiter``\n            settings.\n\n            When ``detect_divergence`` is `False`, these divergent\n            points will be detected as not having achieved the\n            required accuracy (without further details). In addition,\n            if ``adaptive`` is `False` then the algorithm will not\n            know that the solution (for specific points) is diverging\n            and will continue iterating and trying to \"improve\"\n            diverging solutions. This may result in ``NaN`` or\n            ``Inf`` values in the return results (in addition to a\n            performance penalties). Even when ``detect_divergence``\n            is `False`, :py:meth:`all_world2pix`, at the end of the\n            iterative process, will identify invalid results\n            (``NaN`` or ``Inf``) as \"diverging\" solutions and will\n            raise :py:class:`NoConvergence` unless the ``quiet``\n            parameter is set to `True`.\n\n            When ``detect_divergence`` is `True`,\n            :py:meth:`all_world2pix` will detect points for which\n            current correction to the coordinates is larger than\n            the correction applied during the previous iteration\n            **if** the requested accuracy **has not yet been\n            achieved**. In this case, if ``adaptive`` is `True`,\n            these points will be excluded from further iterations and\n            if ``adaptive`` is `False`, :py:meth:`all_world2pix` will\n            automatically switch to the adaptive algorithm. Thus, the\n            reported divergent solution will be the latest converging\n            solution computed immediately *before* divergence\n            has been detected.\n\n            .. note::\n               When accuracy has been achieved, small increases in\n               current corrections may be possible due to rounding\n               errors (when ``adaptive`` is `False`) and such\n               increases will be ignored.\n\n            .. note::\n               Based on our testing using HST ACS/WFC images, setting\n               ``detect_divergence`` to `True` will incur about 5-20%\n               performance penalty with the larger penalty\n               corresponding to ``adaptive`` set to `True`.\n               Because the benefits of enabling this\n               feature outweigh the small performance penalty,\n               especially when ``adaptive`` = `False`, it is\n               recommended to set ``detect_divergence`` to `True`,\n               unless extensive testing of the distortion models for\n               images from specific instruments show a good stability\n               of the numerical method for a wide range of\n               coordinates (even outside the image itself).\n\n            .. note::\n               Indices of the diverging inverse solutions will be\n               reported in the ``divergent`` attribute of the\n               raised :py:class:`NoConvergence` exception object.\n\n        Returns\n        -------\n\n        {2}\n\n        Notes\n        -----\n        The order of the axes for the input world array is determined by\n        the ``CTYPEia`` keywords in the FITS header, therefore it may\n        not always be of the form (*ra*, *dec*).  The\n        `~astropy.wcs.Wcsprm.lat`, `~astropy.wcs.Wcsprm.lng`,\n        `~astropy.wcs.Wcsprm.lattyp`, and\n        `~astropy.wcs.Wcsprm.lngtyp`\n        members can be used to determine the order of the axes.\n\n        Using the method of fixed-point iterations approximations we\n        iterate starting with the initial approximation, which is\n        computed using the non-distortion-aware\n        :py:meth:`wcs_world2pix` (or equivalent).\n\n        The :py:meth:`all_world2pix` function uses a vectorized\n        implementation of the method of consecutive approximations and\n        therefore it is highly efficient (>30x) when *all* data points\n        that need to be converted from sky coordinates to image\n        coordinates are passed at *once*. Therefore, it is advisable,\n        whenever possible, to pass as input a long array of all points\n        that need to be converted to :py:meth:`all_world2pix` instead\n        of calling :py:meth:`all_world2pix` for each data point. Also\n        see the note to the ``adaptive`` parameter.\n\n        Raises\n        ------\n        NoConvergence\n            The method did not converge to a\n            solution to the required accuracy within a specified\n            number of maximum iterations set by the ``maxiter``\n            parameter. To turn off this exception, set ``quiet`` to\n            `True`. Indices of the points for which the requested\n            accuracy was not achieved (if any) will be listed in the\n            ``slow_conv`` attribute of the\n            raised :py:class:`NoConvergence` exception object.\n\n            See :py:class:`NoConvergence` documentation for\n            more details.\n\n        MemoryError\n            Memory allocation failed.\n\n        SingularMatrixError\n            Linear transformation matrix is singular.\n\n        InconsistentAxisTypesError\n            Inconsistent or unrecognized coordinate axis types.\n\n        ValueError\n            Invalid parameter value.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n\n        ValueError\n            x- and y-coordinate arrays are not the same size.\n\n        InvalidTransformError\n            Invalid coordinate transformation parameters.\n\n        InvalidTransformError\n            Ill-conditioned coordinate transformation parameters.\n\n        Examples\n        --------\n        >>> import astropy.io.fits as fits\n        >>> import astropy.wcs as wcs\n        >>> import numpy as np\n        >>> import os\n\n        >>> filename = os.path.join(wcs.__path__[0], 'tests/data/j94f05bgq_flt.fits')\n        >>> hdulist = fits.open(filename)\n        >>> w = wcs.WCS(hdulist[('sci',1)].header, hdulist)\n        >>> hdulist.close()\n\n        >>> ra, dec = w.all_pix2world([1,2,3], [1,1,1], 1)\n        >>> print(ra)  # doctest: +FLOAT_CMP\n        [ 5.52645627  5.52649663  5.52653698]\n        >>> print(dec)  # doctest: +FLOAT_CMP\n        [-72.05171757 -72.05171276 -72.05170795]\n        >>> radec = w.all_pix2world([[1,1], [2,1], [3,1]], 1)\n        >>> print(radec)  # doctest: +FLOAT_CMP\n        [[  5.52645627 -72.05171757]\n         [  5.52649663 -72.05171276]\n         [  5.52653698 -72.05170795]]\n        >>> x, y = w.all_world2pix(ra, dec, 1)\n        >>> print(x)  # doctest: +FLOAT_CMP\n        [ 1.00000238  2.00000237  3.00000236]\n        >>> print(y)  # doctest: +FLOAT_CMP\n        [ 0.99999996  0.99999997  0.99999997]\n        >>> xy = w.all_world2pix(radec, 1)\n        >>> print(xy)  # doctest: +FLOAT_CMP\n        [[ 1.00000238  0.99999996]\n         [ 2.00000237  0.99999997]\n         [ 3.00000236  0.99999997]]\n        >>> xy = w.all_world2pix(radec, 1, maxiter=3,\n        ...                      tolerance=1.0e-10, quiet=False)\n        Traceback (most recent call last):\n        ...\n        NoConvergence: 'WCS.all_world2pix' failed to converge to the\n        requested accuracy. After 3 iterations, the solution is\n        diverging at least for one input point.\n\n        >>> # Now try to use some diverging data:\n        >>> divradec = w.all_pix2world([[1.0, 1.0],\n        ...                             [10000.0, 50000.0],\n        ...                             [3.0, 1.0]], 1)\n        >>> print(divradec)  # doctest: +FLOAT_CMP\n        [[  5.52645627 -72.05171757]\n         [  7.15976932 -70.8140779 ]\n         [  5.52653698 -72.05170795]]\n\n        >>> # First, turn detect_divergence on:\n        >>> try:  # doctest: +FLOAT_CMP\n        ...   xy = w.all_world2pix(divradec, 1, maxiter=20,\n        ...                        tolerance=1.0e-4, adaptive=False,\n        ...                        detect_divergence=True,\n        ...                        quiet=False)\n        ... except wcs.wcs.NoConvergence as e:\n        ...   print(\"Indices of diverging points: {{0}}\"\n        ...         .format(e.divergent))\n        ...   print(\"Indices of poorly converging points: {{0}}\"\n        ...         .format(e.slow_conv))\n        ...   print(\"Best solution:\\\\n{{0}}\".format(e.best_solution))\n        ...   print(\"Achieved accuracy:\\\\n{{0}}\".format(e.accuracy))\n        Indices of diverging points: [1]\n        Indices of poorly converging points: None\n        Best solution:\n        [[  1.00000238e+00   9.99999965e-01]\n         [ -1.99441636e+06   1.44309097e+06]\n         [  3.00000236e+00   9.99999966e-01]]\n        Achieved accuracy:\n        [[  6.13968380e-05   8.59638593e-07]\n         [  8.59526812e+11   6.61713548e+11]\n         [  6.09398446e-05   8.38759724e-07]]\n        >>> raise e\n        Traceback (most recent call last):\n        ...\n        NoConvergence: 'WCS.all_world2pix' failed to converge to the\n        requested accuracy.  After 5 iterations, the solution is\n        diverging at least for one input point.\n\n        >>> # This time turn detect_divergence off:\n        >>> try:  # doctest: +FLOAT_CMP\n        ...   xy = w.all_world2pix(divradec, 1, maxiter=20,\n        ...                        tolerance=1.0e-4, adaptive=False,\n        ...                        detect_divergence=False,\n        ...                        quiet=False)\n        ... except wcs.wcs.NoConvergence as e:\n        ...   print(\"Indices of diverging points: {{0}}\"\n        ...         .format(e.divergent))\n        ...   print(\"Indices of poorly converging points: {{0}}\"\n        ...         .format(e.slow_conv))\n        ...   print(\"Best solution:\\\\n{{0}}\".format(e.best_solution))\n        ...   print(\"Achieved accuracy:\\\\n{{0}}\".format(e.accuracy))\n        Indices of diverging points: [1]\n        Indices of poorly converging points: None\n        Best solution:\n        [[ 1.00000009  1.        ]\n         [        nan         nan]\n         [ 3.00000009  1.        ]]\n        Achieved accuracy:\n        [[  2.29417358e-06   3.21222995e-08]\n         [             nan              nan]\n         [  2.27407877e-06   3.13005639e-08]]\n        >>> raise e\n        Traceback (most recent call last):\n        ...\n        NoConvergence: 'WCS.all_world2pix' failed to converge to the\n        requested accuracy.  After 6 iterations, the solution is\n        diverging at least for one input point.\n\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('naxis', 8),\n                   docstrings.RA_DEC_ORDER(8),\n                   docstrings.RETURNS('pixel coordinates', 8))\n\n    def wcs_world2pix(self, *args, **kwargs):\n        if self.wcs is None:\n            raise ValueError(\"No basic WCS settings were created.\")\n        return self._array_converter(\n            lambda xy, o: self.wcs.s2p(xy, o)['pixcrd'],\n            'input', *args, **kwargs)\n    wcs_world2pix.__doc__ = \"\"\"\n        Transforms world coordinates to pixel coordinates, using only\n        the basic `wcslib`_ WCS transformation.  No `SIP`_ or\n        `distortion paper`_ table lookup transformation is applied.\n\n        Parameters\n        ----------\n        {}\n\n            For a transformation that is not two-dimensional, the\n            two-argument form must be used.\n\n        {}\n\n        Returns\n        -------\n\n        {}\n\n        Notes\n        -----\n        The order of the axes for the input world array is determined by\n        the ``CTYPEia`` keywords in the FITS header, therefore it may\n        not always be of the form (*ra*, *dec*).  The\n        `~astropy.wcs.Wcsprm.lat`, `~astropy.wcs.Wcsprm.lng`,\n        `~astropy.wcs.Wcsprm.lattyp` and `~astropy.wcs.Wcsprm.lngtyp`\n        members can be used to determine the order of the axes.\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        SingularMatrixError\n            Linear transformation matrix is singular.\n\n        InconsistentAxisTypesError\n            Inconsistent or unrecognized coordinate axis types.\n\n        ValueError\n            Invalid parameter value.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n\n        ValueError\n            x- and y-coordinate arrays are not the same size.\n\n        InvalidTransformError\n            Invalid coordinate transformation parameters.\n\n        InvalidTransformError\n            Ill-conditioned coordinate transformation parameters.\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('naxis', 8),\n                   docstrings.RA_DEC_ORDER(8),\n                   docstrings.RETURNS('pixel coordinates', 8))\n\n    def pix2foc(self, *args):\n        return self._array_converter(self._pix2foc, None, *args)\n    pix2foc.__doc__ = \"\"\"\n        Convert pixel coordinates to focal plane coordinates using the\n        `SIP`_ polynomial distortion convention and `distortion\n        paper`_ table-lookup correction.\n\n        The output is in absolute pixel coordinates, not relative to\n        ``CRPIX``.\n\n        Parameters\n        ----------\n\n        {}\n\n        Returns\n        -------\n\n        {}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('2', 8),\n                   docstrings.RETURNS('focal coordinates', 8))\n\n    def p4_pix2foc(self, *args):\n        return self._array_converter(self._p4_pix2foc, None, *args)\n    p4_pix2foc.__doc__ = \"\"\"\n        Convert pixel coordinates to focal plane coordinates using\n        `distortion paper`_ table-lookup correction.\n\n        The output is in absolute pixel coordinates, not relative to\n        ``CRPIX``.\n\n        Parameters\n        ----------\n\n        {}\n\n        Returns\n        -------\n\n        {}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('2', 8),\n                   docstrings.RETURNS('focal coordinates', 8))\n\n    def det2im(self, *args):\n        return self._array_converter(self._det2im, None, *args)\n    det2im.__doc__ = \"\"\"\n        Convert detector coordinates to image plane coordinates using\n        `distortion paper`_ table-lookup correction.\n\n        The output is in absolute pixel coordinates, not relative to\n        ``CRPIX``.\n\n        Parameters\n        ----------\n\n        {}\n\n        Returns\n        -------\n\n        {}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('2', 8),\n                   docstrings.RETURNS('pixel coordinates', 8))\n\n    def sip_pix2foc(self, *args):\n        if self.sip is None:\n            if len(args) == 2:\n                return args[0]\n            elif len(args) == 3:\n                return args[:2]\n            else:\n                raise TypeError(\"Wrong number of arguments\")\n        return self._array_converter(self.sip.pix2foc, None, *args)\n    sip_pix2foc.__doc__ = \"\"\"\n        Convert pixel coordinates to focal plane coordinates using the\n        `SIP`_ polynomial distortion convention.\n\n        The output is in pixel coordinates, relative to ``CRPIX``.\n\n        FITS WCS `distortion paper`_ table lookup correction is not\n        applied, even if that information existed in the FITS file\n        that initialized this :class:`~astropy.wcs.WCS` object.  To\n        correct for that, use `~astropy.wcs.WCS.pix2foc` or\n        `~astropy.wcs.WCS.p4_pix2foc`.\n\n        Parameters\n        ----------\n\n        {}\n\n        Returns\n        -------\n\n        {}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('2', 8),\n                   docstrings.RETURNS('focal coordinates', 8))\n\n    def sip_foc2pix(self, *args):\n        if self.sip is None:\n            if len(args) == 2:\n                return args[0]\n            elif len(args) == 3:\n                return args[:2]\n            else:\n                raise TypeError(\"Wrong number of arguments\")\n        return self._array_converter(self.sip.foc2pix, None, *args)\n    sip_foc2pix.__doc__ = \"\"\"\n        Convert focal plane coordinates to pixel coordinates using the\n        `SIP`_ polynomial distortion convention.\n\n        FITS WCS `distortion paper`_ table lookup distortion\n        correction is not applied, even if that information existed in\n        the FITS file that initialized this `~astropy.wcs.WCS` object.\n\n        Parameters\n        ----------\n\n        {}\n\n        Returns\n        -------\n\n        {}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('2', 8),\n                   docstrings.RETURNS('pixel coordinates', 8))\n\n    def proj_plane_pixel_scales(self):\n        \"\"\"\n        Calculate pixel scales along each axis of the image pixel at\n        the ``CRPIX`` location once it is projected onto the\n        \"plane of intermediate world coordinates\" as defined in\n        `Greisen & Calabretta 2002, A&A, 395, 1061 <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1061G>`_.\n\n        .. note::\n            This method is concerned **only** about the transformation\n            \"image plane\"->\"projection plane\" and **not** about the\n            transformation \"celestial sphere\"->\"projection plane\"->\"image plane\".\n            Therefore, this function ignores distortions arising due to\n            non-linear nature of most projections.\n\n        .. note::\n            This method only returns sensible answers if the WCS contains\n            celestial axes, i.e., the `~astropy.wcs.WCS.celestial` WCS object.\n\n        Returns\n        -------\n        scale : list of `~astropy.units.Quantity`\n            A vector of projection plane increments corresponding to each\n            pixel side (axis).\n\n        See Also\n        --------\n        astropy.wcs.utils.proj_plane_pixel_scales\n\n        \"\"\"  # noqa: E501\n        from astropy.wcs.utils import proj_plane_pixel_scales  # Avoid circular import\n        values = proj_plane_pixel_scales(self)\n        units = [u.Unit(x) for x in self.wcs.cunit]\n        return [value * unit for (value, unit) in zip(values, units)]  # Can have different units\n\n    def proj_plane_pixel_area(self):\n        \"\"\"\n        For a **celestial** WCS (see `astropy.wcs.WCS.celestial`), returns pixel\n        area of the image pixel at the ``CRPIX`` location once it is projected\n        onto the \"plane of intermediate world coordinates\" as defined in\n        `Greisen & Calabretta 2002, A&A, 395, 1061 <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1061G>`_.\n\n        .. note::\n            This function is concerned **only** about the transformation\n            \"image plane\"->\"projection plane\" and **not** about the\n            transformation \"celestial sphere\"->\"projection plane\"->\"image plane\".\n            Therefore, this function ignores distortions arising due to\n            non-linear nature of most projections.\n\n        .. note::\n            This method only returns sensible answers if the WCS contains\n            celestial axes, i.e., the `~astropy.wcs.WCS.celestial` WCS object.\n\n        Returns\n        -------\n        area : `~astropy.units.Quantity`\n            Area (in the projection plane) of the pixel at ``CRPIX`` location.\n\n        Raises\n        ------\n        ValueError\n            Pixel area is defined only for 2D pixels. Most likely the\n            `~astropy.wcs.Wcsprm.cd` matrix of the `~astropy.wcs.WCS.celestial`\n            WCS is not a square matrix of second order.\n\n        Notes\n        -----\n\n        Depending on the application, square root of the pixel area can be used to\n        represent a single pixel scale of an equivalent square pixel\n        whose area is equal to the area of a generally non-square pixel.\n\n        See Also\n        --------\n        astropy.wcs.utils.proj_plane_pixel_area\n\n        \"\"\"  # noqa: E501\n        from astropy.wcs.utils import proj_plane_pixel_area  # Avoid circular import\n        value = proj_plane_pixel_area(self)\n        unit = u.Unit(self.wcs.cunit[0]) * u.Unit(self.wcs.cunit[1])  # 2D only\n        return value * unit\n\n    def to_fits(self, relax=False, key=None):\n        \"\"\"\n        Generate an `~astropy.io.fits.HDUList` object with all of the\n        information stored in this object.  This should be logically identical\n        to the input FITS file, but it will be normalized in a number of ways.\n\n        See `to_header` for some warnings about the output produced.\n\n        Parameters\n        ----------\n\n        relax : bool or int, optional\n            Degree of permissiveness:\n\n            - `False` (default): Write all extensions that are\n              considered to be safe and recommended.\n\n            - `True`: Write all recognized informal extensions of the\n              WCS standard.\n\n            - `int`: a bit field selecting specific extensions to\n              write.  See :ref:`astropy:relaxwrite` for details.\n\n        key : str\n            The name of a particular WCS transform to use.  This may be\n            either ``' '`` or ``'A'``-``'Z'`` and corresponds to the ``\"a\"``\n            part of the ``CTYPEia`` cards.\n\n        Returns\n        -------\n        hdulist : `~astropy.io.fits.HDUList`\n        \"\"\"\n\n        header = self.to_header(relax=relax, key=key)\n\n        hdu = fits.PrimaryHDU(header=header)\n        hdulist = fits.HDUList(hdu)\n\n        self._write_det2im(hdulist)\n        self._write_distortion_kw(hdulist)\n\n        return hdulist\n\n    def to_header(self, relax=None, key=None):\n        \"\"\"Generate an `astropy.io.fits.Header` object with the basic WCS\n        and SIP information stored in this object.  This should be\n        logically identical to the input FITS file, but it will be\n        normalized in a number of ways.\n\n        .. warning::\n\n          This function does not write out FITS WCS `distortion\n          paper`_ information, since that requires multiple FITS\n          header data units.  To get a full representation of\n          everything in this object, use `to_fits`.\n\n        Parameters\n        ----------\n        relax : bool or int, optional\n            Degree of permissiveness:\n\n            - `False` (default): Write all extensions that are\n              considered to be safe and recommended.\n\n            - `True`: Write all recognized informal extensions of the\n              WCS standard.\n\n            - `int`: a bit field selecting specific extensions to\n              write.  See :ref:`astropy:relaxwrite` for details.\n\n            If the ``relax`` keyword argument is not given and any\n            keywords were omitted from the output, an\n            `~astropy.utils.exceptions.AstropyWarning` is displayed.\n            To override this, explicitly pass a value to ``relax``.\n\n        key : str\n            The name of a particular WCS transform to use.  This may be\n            either ``' '`` or ``'A'``-``'Z'`` and corresponds to the ``\"a\"``\n            part of the ``CTYPEia`` cards.\n\n        Returns\n        -------\n        header : `astropy.io.fits.Header`\n\n        Notes\n        -----\n        The output header will almost certainly differ from the input in a\n        number of respects:\n\n          1. The output header only contains WCS-related keywords.  In\n             particular, it does not contain syntactically-required\n             keywords such as ``SIMPLE``, ``NAXIS``, ``BITPIX``, or\n             ``END``.\n\n          2. Deprecated (e.g. ``CROTAn``) or non-standard usage will\n             be translated to standard (this is partially dependent on\n             whether ``fix`` was applied).\n\n          3. Quantities will be converted to the units used internally,\n             basically SI with the addition of degrees.\n\n          4. Floating-point quantities may be given to a different decimal\n             precision.\n\n          5. Elements of the ``PCi_j`` matrix will be written if and\n             only if they differ from the unit matrix.  Thus, if the\n             matrix is unity then no elements will be written.\n\n          6. Additional keywords such as ``WCSAXES``, ``CUNITia``,\n             ``LONPOLEa`` and ``LATPOLEa`` may appear.\n\n          7. The original keycomments will be lost, although\n             `to_header` tries hard to write meaningful comments.\n\n          8. Keyword order may be changed.\n\n        \"\"\"\n        # default precision for numerical WCS keywords\n        precision = WCSHDO_P14  # Defined by C-ext  # noqa: F821\n        display_warning = False\n        if relax is None:\n            display_warning = True\n            relax = False\n\n        if relax not in (True, False):\n            do_sip = relax & WCSHDO_SIP\n            relax &= ~WCSHDO_SIP\n        else:\n            do_sip = relax\n            relax = WCSHDO_all if relax is True else WCSHDO_safe  # Defined by C-ext  # noqa: F821\n\n        relax = precision | relax\n\n        if self.wcs is not None:\n            if key is not None:\n                orig_key = self.wcs.alt\n                self.wcs.alt = key\n            header_string = self.wcs.to_header(relax)\n            header = fits.Header.fromstring(header_string)\n            keys_to_remove = [\"\", \" \", \"COMMENT\"]\n            for kw in keys_to_remove:\n                if kw in header:\n                    del header[kw]\n            # Check if we can handle TPD distortion correctly\n            if int(_parsed_version[0]) * 10 + int(_parsed_version[1]) < 71:\n                for kw, val in header.items():\n                    if kw[:5] in ('CPDIS', 'CQDIS') and val == 'TPD':\n                        warnings.warn(\n                            f\"WCS contains a TPD distortion model in {kw}. WCSLIB \"\n                            f\"{_wcs.__version__} is writing this in a format incompatible with \"\n                            f\"current versions - please update to 7.4 or use the bundled WCSLIB.\",\n                            AstropyWarning)\n            elif int(_parsed_version[0]) * 10 + int(_parsed_version[1]) < 74:\n                for kw, val in header.items():\n                    if kw[:5] in ('CPDIS', 'CQDIS') and val == 'TPD':\n                        warnings.warn(\n                            f\"WCS contains a TPD distortion model in {kw}, which requires WCSLIB \"\n                            f\"7.4 or later to store in a FITS header (having {_wcs.__version__}).\",\n                            AstropyWarning)\n        else:\n            header = fits.Header()\n\n        if do_sip and self.sip is not None:\n            if self.wcs is not None and any(not ctyp.endswith('-SIP') for ctyp in self.wcs.ctype):\n                self._fix_ctype(header, add_sip=True)\n\n            for kw, val in self._write_sip_kw().items():\n                header[kw] = val\n\n        if not do_sip and self.wcs is not None and any(self.wcs.ctype) and self.sip is not None:\n            # This is called when relax is not False or WCSHDO_SIP\n            # The default case of ``relax=None`` is handled further in the code.\n            header = self._fix_ctype(header, add_sip=False)\n\n        if display_warning:\n            full_header = self.to_header(relax=True, key=key)\n            missing_keys = []\n            for kw, val in full_header.items():\n                if kw not in header:\n                    missing_keys.append(kw)\n\n            if len(missing_keys):\n                warnings.warn(\n                    \"Some non-standard WCS keywords were excluded: {} \"\n                    \"Use the ``relax`` kwarg to control this.\".format(\n                        ', '.join(missing_keys)),\n                    AstropyWarning)\n            # called when ``relax=None``\n            # This is different from the case of ``relax=False``.\n            if any(self.wcs.ctype) and self.sip is not None:\n                header = self._fix_ctype(header, add_sip=False, log_message=False)\n        # Finally reset the key. This must be called after ``_fix_ctype``.\n        if key is not None:\n            self.wcs.alt = orig_key\n        return header\n\n    def _fix_ctype(self, header, add_sip=True, log_message=True):\n        \"\"\"\n        Parameters\n        ----------\n        header : `~astropy.io.fits.Header`\n            FITS header.\n        add_sip : bool\n            Flag indicating whether \"-SIP\" should be added or removed from CTYPE keywords.\n\n            Remove \"-SIP\" from CTYPE when writing out a header with relax=False.\n            This needs to be done outside ``to_header`` because ``to_header`` runs\n            twice when ``relax=False`` and the second time ``relax`` is set to ``True``\n            to display the missing keywords.\n\n            If the user requested SIP distortion to be written out add \"-SIP\" to\n            CTYPE if it is missing.\n        \"\"\"\n\n        _add_sip_to_ctype = \"\"\"\n        Inconsistent SIP distortion information is present in the current WCS:\n        SIP coefficients were detected, but CTYPE is missing \"-SIP\" suffix,\n        therefore the current WCS is internally inconsistent.\n\n        Because relax has been set to True, the resulting output WCS will have\n        \"-SIP\" appended to CTYPE in order to make the header internally consistent.\n\n        However, this may produce incorrect astrometry in the output WCS, if\n        in fact the current WCS is already distortion-corrected.\n\n        Therefore, if current WCS is already distortion-corrected (eg, drizzled)\n        then SIP distortion components should not apply. In that case, for a WCS\n        that is already distortion-corrected, please remove the SIP coefficients\n        from the header.\n\n        \"\"\"\n        if log_message:\n            if add_sip:\n                log.info(_add_sip_to_ctype)\n        for i in range(1, self.naxis+1):\n            # strip() must be called here to cover the case of alt key= \" \"\n            kw = f'CTYPE{i}{self.wcs.alt}'.strip()\n            if kw in header:\n                if add_sip:\n                    val = header[kw].strip(\"-SIP\") + \"-SIP\"\n                else:\n                    val = header[kw].strip(\"-SIP\")\n                header[kw] = val\n            else:\n                continue\n        return header\n\n    def to_header_string(self, relax=None):\n        \"\"\"\n        Identical to `to_header`, but returns a string containing the\n        header cards.\n        \"\"\"\n        return str(self.to_header(relax))\n\n    def footprint_to_file(self, filename='footprint.reg', color='green',\n                          width=2, coordsys=None):\n        \"\"\"\n        Writes out a `ds9`_ style regions file. It can be loaded\n        directly by `ds9`_.\n\n        Parameters\n        ----------\n        filename : str, optional\n            Output file name - default is ``'footprint.reg'``\n\n        color : str, optional\n            Color to use when plotting the line.\n\n        width : int, optional\n            Width of the region line.\n\n        coordsys : str, optional\n            Coordinate system. If not specified (default), the ``radesys``\n            value is used. For all possible values, see\n            http://ds9.si.edu/doc/ref/region.html#RegionFileFormat\n\n        \"\"\"\n        comments = ('# Region file format: DS9 version 4.0 \\n'\n                    '# global color=green font=\"helvetica 12 bold '\n                    'select=1 highlite=1 edit=1 move=1 delete=1 '\n                    'include=1 fixed=0 source\\n')\n\n        coordsys = coordsys or self.wcs.radesys\n\n        if coordsys not in ('PHYSICAL', 'IMAGE', 'FK4', 'B1950', 'FK5',\n                            'J2000', 'GALACTIC', 'ECLIPTIC', 'ICRS', 'LINEAR',\n                            'AMPLIFIER', 'DETECTOR'):\n            raise ValueError(\"Coordinate system '{}' is not supported. A valid\"\n                             \" one can be given with the 'coordsys' argument.\"\n                             .format(coordsys))\n\n        with open(filename, mode='w') as f:\n            f.write(comments)\n            f.write(f'{coordsys}\\n')\n            f.write('polygon(')\n            ftpr = self.calc_footprint()\n            if ftpr is not None:\n                ftpr.tofile(f, sep=',')\n                f.write(f') # color={color}, width={width:d} \\n')\n\n    def _get_naxis(self, header=None):\n        _naxis = []\n        if (header is not None and\n                not isinstance(header, (str, bytes))):\n            for naxis in itertools.count(1):\n                try:\n                    _naxis.append(header[f'NAXIS{naxis}'])\n                except KeyError:\n                    break\n        if len(_naxis) == 0:\n            _naxis = [0, 0]\n        elif len(_naxis) == 1:\n            _naxis.append(0)\n        self._naxis = _naxis\n\n    def printwcs(self):\n        print(repr(self))\n\n    def __repr__(self):\n        '''\n        Return a short description. Simply porting the behavior from\n        the `printwcs()` method.\n        '''\n        description = [\"WCS Keywords\\n\",\n                       f\"Number of WCS axes: {self.naxis!r}\"]\n        sfmt = ' : ' + \"\".join([\"{\"+f\"{i}\"+\"!r}  \" for i in range(self.naxis)])\n\n        keywords = ['CTYPE', 'CRVAL', 'CRPIX']\n        values = [self.wcs.ctype, self.wcs.crval, self.wcs.crpix]\n        for keyword, value in zip(keywords, values):\n            description.append(keyword+sfmt.format(*value))\n\n        if hasattr(self.wcs, 'pc'):\n            for i in range(self.naxis):\n                s = ''\n                for j in range(self.naxis):\n                    s += ''.join(['PC', str(i+1), '_', str(j+1), ' '])\n                s += sfmt\n                description.append(s.format(*self.wcs.pc[i]))\n            s = 'CDELT' + sfmt\n            description.append(s.format(*self.wcs.cdelt))\n        elif hasattr(self.wcs, 'cd'):\n            for i in range(self.naxis):\n                s = ''\n                for j in range(self.naxis):\n                    s += \"\".join(['CD', str(i+1), '_', str(j+1), ' '])\n                s += sfmt\n                description.append(s.format(*self.wcs.cd[i]))\n\n        description.append(f\"NAXIS : {'  '.join(map(str, self._naxis))}\")\n        return '\\n'.join(description)\n\n    def get_axis_types(self):\n        \"\"\"\n        Similar to `self.wcsprm.axis_types <astropy.wcs.Wcsprm.axis_types>`\n        but provides the information in a more Python-friendly format.\n\n        Returns\n        -------\n        result : list of dict\n\n            Returns a list of dictionaries, one for each axis, each\n            containing attributes about the type of that axis.\n\n            Each dictionary has the following keys:\n\n            - 'coordinate_type':\n\n              - None: Non-specific coordinate type.\n\n              - 'stokes': Stokes coordinate.\n\n              - 'celestial': Celestial coordinate (including ``CUBEFACE``).\n\n              - 'spectral': Spectral coordinate.\n\n            - 'scale':\n\n              - 'linear': Linear axis.\n\n              - 'quantized': Quantized axis (``STOKES``, ``CUBEFACE``).\n\n              - 'non-linear celestial': Non-linear celestial axis.\n\n              - 'non-linear spectral': Non-linear spectral axis.\n\n              - 'logarithmic': Logarithmic axis.\n\n              - 'tabular': Tabular axis.\n\n            - 'group'\n\n              - Group number, e.g. lookup table number\n\n            - 'number'\n\n              - For celestial axes:\n\n                - 0: Longitude coordinate.\n\n                - 1: Latitude coordinate.\n\n                - 2: ``CUBEFACE`` number.\n\n              - For lookup tables:\n\n                - the axis number in a multidimensional table.\n\n            ``CTYPEia`` in ``\"4-3\"`` form with unrecognized algorithm code will\n            generate an error.\n        \"\"\"\n        if self.wcs is None:\n            raise AttributeError(\n                \"This WCS object does not have a wcsprm object.\")\n\n        coordinate_type_map = {\n            0: None,\n            1: 'stokes',\n            2: 'celestial',\n            3: 'spectral'}\n\n        scale_map = {\n            0: 'linear',\n            1: 'quantized',\n            2: 'non-linear celestial',\n            3: 'non-linear spectral',\n            4: 'logarithmic',\n            5: 'tabular'}\n\n        result = []\n        for axis_type in self.wcs.axis_types:\n            subresult = {}\n\n            coordinate_type = (axis_type // 1000) % 10\n            subresult['coordinate_type'] = coordinate_type_map[coordinate_type]\n\n            scale = (axis_type // 100) % 10\n            subresult['scale'] = scale_map[scale]\n\n            group = (axis_type // 10) % 10\n            subresult['group'] = group\n\n            number = axis_type % 10\n            subresult['number'] = number\n\n            result.append(subresult)\n\n        return result\n\n    def __reduce__(self):\n        \"\"\"\n        Support pickling of WCS objects.  This is done by serializing\n        to an in-memory FITS file and dumping that as a string.\n        \"\"\"\n\n        hdulist = self.to_fits(relax=True)\n\n        buffer = io.BytesIO()\n        hdulist.writeto(buffer)\n\n        dct = self.__dict__.copy()\n        dct['_alt_wcskey'] = self.wcs.alt\n\n        return (__WCS_unpickle__,\n                (self.__class__, dct, buffer.getvalue(),))\n\n    def dropaxis(self, dropax):\n        \"\"\"\n        Remove an axis from the WCS.\n\n        Parameters\n        ----------\n        wcs : `~astropy.wcs.WCS`\n            The WCS with naxis to be chopped to naxis-1\n        dropax : int\n            The index of the WCS to drop, counting from 0 (i.e., python convention,\n            not FITS convention)\n\n        Returns\n        -------\n        `~astropy.wcs.WCS`\n            A new `~astropy.wcs.WCS` instance with one axis fewer\n        \"\"\"\n        inds = list(range(self.wcs.naxis))\n        inds.pop(dropax)\n\n        # axis 0 has special meaning to sub\n        # if wcs.wcs.ctype == ['RA','DEC','VLSR'], you want\n        # wcs.sub([1,2]) to get 'RA','DEC' back\n        return self.sub([i+1 for i in inds])\n\n    def swapaxes(self, ax0, ax1):\n        \"\"\"\n        Swap axes in a WCS.\n\n        Parameters\n        ----------\n        wcs : `~astropy.wcs.WCS`\n            The WCS to have its axes swapped\n        ax0 : int\n        ax1 : int\n            The indices of the WCS to be swapped, counting from 0 (i.e., python\n            convention, not FITS convention)\n\n        Returns\n        -------\n        `~astropy.wcs.WCS`\n            A new `~astropy.wcs.WCS` instance with the same number of axes,\n            but two swapped\n        \"\"\"\n        inds = list(range(self.wcs.naxis))\n        inds[ax0], inds[ax1] = inds[ax1], inds[ax0]\n\n        return self.sub([i+1 for i in inds])\n\n    def reorient_celestial_first(self):\n        \"\"\"\n        Reorient the WCS such that the celestial axes are first, followed by\n        the spectral axis, followed by any others.\n        Assumes at least celestial axes are present.\n        \"\"\"\n        return self.sub([WCSSUB_CELESTIAL, WCSSUB_SPECTRAL, WCSSUB_STOKES])  # Defined by C-ext  # noqa: F821 E501\n\n    def slice(self, view, numpy_order=True):\n        \"\"\"\n        Slice a WCS instance using a Numpy slice. The order of the slice should\n        be reversed (as for the data) compared to the natural WCS order.\n\n        Parameters\n        ----------\n        view : tuple\n            A tuple containing the same number of slices as the WCS system.\n            The ``step`` method, the third argument to a slice, is not\n            presently supported.\n        numpy_order : bool\n            Use numpy order, i.e. slice the WCS so that an identical slice\n            applied to a numpy array will slice the array and WCS in the same\n            way. If set to `False`, the WCS will be sliced in FITS order,\n            meaning the first slice will be applied to the *last* numpy index\n            but the *first* WCS axis.\n\n        Returns\n        -------\n        wcs_new : `~astropy.wcs.WCS`\n            A new resampled WCS axis\n        \"\"\"\n        if hasattr(view, '__len__') and len(view) > self.wcs.naxis:\n            raise ValueError(\"Must have # of slices <= # of WCS axes\")\n        elif not hasattr(view, '__len__'):  # view MUST be an iterable\n            view = [view]\n\n        if not all(isinstance(x, slice) for x in view):\n            # We need to drop some dimensions, but this may not always be\n            # possible with .sub due to correlated axes, so instead we use the\n            # generalized slicing infrastructure from astropy.wcs.wcsapi.\n            return SlicedFITSWCS(self, view)\n\n        # NOTE: we could in principle use SlicedFITSWCS as above for all slicing,\n        # but in the simple case where there are no axes dropped, we can just\n        # create a full WCS object with updated WCS parameters which is faster\n        # for this specific case and also backward-compatible.\n\n        wcs_new = self.deepcopy()\n        if wcs_new.sip is not None:\n            sip_crpix = wcs_new.sip.crpix.tolist()\n\n        for i, iview in enumerate(view):\n            if iview.step is not None and iview.step < 0:\n                raise NotImplementedError(\"Reversing an axis is not \"\n                                          \"implemented.\")\n\n            if numpy_order:\n                wcs_index = self.wcs.naxis - 1 - i\n            else:\n                wcs_index = i\n\n            if iview.step is not None and iview.start is None:\n                # Slice from \"None\" is equivalent to slice from 0 (but one\n                # might want to downsample, so allow slices with\n                # None,None,step or None,stop,step)\n                iview = slice(0, iview.stop, iview.step)\n\n            if iview.start is not None:\n                if iview.step not in (None, 1):\n                    crpix = self.wcs.crpix[wcs_index]\n                    cdelt = self.wcs.cdelt[wcs_index]\n                    # equivalently (keep this comment so you can compare eqns):\n                    # wcs_new.wcs.crpix[wcs_index] =\n                    # (crpix - iview.start)*iview.step + 0.5 - iview.step/2.\n                    crp = ((crpix - iview.start - 1.)/iview.step\n                           + 0.5 + 1./iview.step/2.)\n                    wcs_new.wcs.crpix[wcs_index] = crp\n                    if wcs_new.sip is not None:\n                        sip_crpix[wcs_index] = crp\n                    wcs_new.wcs.cdelt[wcs_index] = cdelt * iview.step\n                else:\n                    wcs_new.wcs.crpix[wcs_index] -= iview.start\n                    if wcs_new.sip is not None:\n                        sip_crpix[wcs_index] -= iview.start\n\n            try:\n                # range requires integers but the other attributes can also\n                # handle arbitrary values, so this needs to be in a try/except.\n                nitems = len(builtins.range(self._naxis[wcs_index])[iview])\n            except TypeError as exc:\n                if 'indices must be integers' not in str(exc):\n                    raise\n                warnings.warn(\"NAXIS{} attribute is not updated because at \"\n                              \"least one index ('{}') is no integer.\"\n                              \"\".format(wcs_index, iview), AstropyUserWarning)\n            else:\n                wcs_new._naxis[wcs_index] = nitems\n\n        if wcs_new.sip is not None:\n            wcs_new.sip = Sip(self.sip.a, self.sip.b, self.sip.ap, self.sip.bp,\n                              sip_crpix)\n\n        return wcs_new\n\n    def __getitem__(self, item):\n        # \"getitem\" is a shortcut for self.slice; it is very limited\n        # there is no obvious and unambiguous interpretation of wcs[1,2,3]\n        # We COULD allow wcs[1] to link to wcs.sub([2])\n        # (wcs[i] -> wcs.sub([i+1])\n        return self.slice(item)\n\n    def __iter__(self):\n        # Having __getitem__ makes Python think WCS is iterable. However,\n        # Python first checks whether __iter__ is present, so we can raise an\n        # exception here.\n        raise TypeError(f\"'{self.__class__.__name__}' object is not iterable\")\n\n    @property\n    def axis_type_names(self):\n        \"\"\"\n        World names for each coordinate axis\n\n        Returns\n        -------\n        list of str\n            A list of names along each axis.\n        \"\"\"\n        names = list(self.wcs.cname)\n        types = self.wcs.ctype\n        for i in range(len(names)):\n            if len(names[i]) > 0:\n                continue\n            names[i] = types[i].split('-')[0]\n        return names\n\n    @property\n    def celestial(self):\n        \"\"\"\n        A copy of the current WCS with only the celestial axes included\n        \"\"\"\n        return self.sub([WCSSUB_CELESTIAL])  # Defined by C-ext  # noqa: F821\n\n    @property\n    def is_celestial(self):\n        return self.has_celestial and self.naxis == 2\n\n    @property\n    def has_celestial(self):\n        try:\n            return self.wcs.lng >= 0 and self.wcs.lat >= 0\n        except InconsistentAxisTypesError:\n            return False\n\n    @property\n    def spectral(self):\n        \"\"\"\n        A copy of the current WCS with only the spectral axes included\n        \"\"\"\n        return self.sub([WCSSUB_SPECTRAL])  # Defined by C-ext  # noqa: F821\n\n    @property\n    def is_spectral(self):\n        return self.has_spectral and self.naxis == 1\n\n    @property\n    def has_spectral(self):\n        try:\n            return self.wcs.spec >= 0\n        except InconsistentAxisTypesError:\n            return False\n\n    @property\n    def has_distortion(self):\n        \"\"\"\n        Returns `True` if any distortion terms are present.\n        \"\"\"\n        return (self.sip is not None or\n                self.cpdis1 is not None or self.cpdis2 is not None or\n                self.det2im1 is not None and self.det2im2 is not None)\n\n    @property\n    def pixel_scale_matrix(self):\n\n        try:\n            cdelt = np.diag(self.wcs.get_cdelt())\n            pc = self.wcs.get_pc()\n        except InconsistentAxisTypesError:\n            try:\n                # for non-celestial axes, get_cdelt doesn't work\n                with warnings.catch_warnings():\n                    warnings.filterwarnings(\n                        'ignore', 'cdelt will be ignored since cd is present', RuntimeWarning)\n                    cdelt = np.dot(self.wcs.cd, np.diag(self.wcs.cdelt))\n            except AttributeError:\n                cdelt = np.diag(self.wcs.cdelt)\n\n            try:\n                pc = self.wcs.pc\n            except AttributeError:\n                pc = 1\n\n        pccd = np.dot(cdelt, pc)\n\n        return pccd\n\n    def footprint_contains(self, coord, **kwargs):\n        \"\"\"\n        Determines if a given SkyCoord is contained in the wcs footprint.\n\n        Parameters\n        ----------\n        coord : `~astropy.coordinates.SkyCoord`\n            The coordinate to check if it is within the wcs coordinate.\n        **kwargs :\n           Additional arguments to pass to `~astropy.coordinates.SkyCoord.to_pixel`\n\n        Returns\n        -------\n        response : bool\n           True means the WCS footprint contains the coordinate, False means it does not.\n        \"\"\"\n\n        return coord.contained_by(self, **kwargs)"},{"col":4,"comment":"null","endLoc":546,"header":"def _handle_resize(self, signum=None, frame=None)","id":802,"name":"_handle_resize","nodeType":"Function","startLoc":544,"text":"def _handle_resize(self, signum=None, frame=None):\n        terminal_width = terminal_size(self._file)[1]\n        self._bar_length = terminal_width - 37"},{"col":0,"comment":"\n    Returns a tuple (height, width) containing the height and width of\n    the terminal.\n\n    This function will look for the width in height in multiple areas\n    before falling back on the width and height in astropy's\n    configuration.\n    ","endLoc":193,"header":"def terminal_size(file=None)","id":803,"name":"terminal_size","nodeType":"Function","startLoc":155,"text":"def terminal_size(file=None):\n    \"\"\"\n    Returns a tuple (height, width) containing the height and width of\n    the terminal.\n\n    This function will look for the width in height in multiple areas\n    before falling back on the width and height in astropy's\n    configuration.\n    \"\"\"\n\n    if file is None:\n        file = _get_stdout()\n\n    try:\n        s = struct.pack(\"HHHH\", 0, 0, 0, 0)\n        x = fcntl.ioctl(file, termios.TIOCGWINSZ, s)\n        (lines, width, xpixels, ypixels) = struct.unpack(\"HHHH\", x)\n        if lines > 12:\n            lines -= 6\n        if width > 10:\n            width -= 1\n        if lines <= 0 or width <= 0:\n            raise Exception('unable to get terminal size')\n        return (lines, width)\n    except Exception:\n        try:\n            # see if POSIX standard variables will work\n            return (int(os.environ.get('LINES')),\n                    int(os.environ.get('COLUMNS')))\n        except TypeError:\n            # fall back on configuration variables, or if not\n            # set, (25, 80)\n            lines = conf.max_lines\n            width = conf.max_width\n            if lines is None:\n                lines = 25\n            if width is None:\n                width = 80\n            return lines, width"},{"col":4,"comment":"null","endLoc":1464,"header":"def _init_from_array(self, array)","id":804,"name":"_init_from_array","nodeType":"Function","startLoc":1432,"text":"def _init_from_array(self, array):\n        self.columns = []\n        for idx in range(len(array.dtype)):\n            cname = array.dtype.names[idx]\n            ftype = array.dtype.fields[cname][0]\n            format = self._col_format_cls.from_recformat(ftype)\n\n            # Determine the appropriate dimensions for items in the column\n            # (typically just 1D)\n            dim = array.dtype[idx].shape[::-1]\n            if dim and (len(dim) > 0 or 'A' in format):\n                if 'A' in format:\n                    # n x m string arrays must include the max string\n                    # length in their dimensions (e.g. l x n x m)\n                    dim = (array.dtype[idx].base.itemsize,) + dim\n                dim = '(' + ','.join(str(d) for d in dim) + ')'\n            else:\n                dim = None\n\n            # Check for unsigned ints.\n            bzero = None\n            if ftype.base.kind == 'u':\n                if 'I' in format:\n                    bzero = np.uint16(2**15)\n                elif 'J' in format:\n                    bzero = np.uint32(2**31)\n                elif 'K' in format:\n                    bzero = np.uint64(2**63)\n\n            c = Column(name=cname, format=format,\n                       array=array.view(np.ndarray)[cname], bzero=bzero,\n                       dim=dim)\n            self.columns.append(c)"},{"className":"FITSWCSAPIMixin","col":0,"comment":"\n    A mix-in class that is intended to be inherited by the\n    :class:`~astropy.wcs.WCS` class and provides the low- and high-level WCS API\n    ","endLoc":673,"id":805,"nodeType":"Class","startLoc":196,"text":"class FITSWCSAPIMixin(BaseLowLevelWCS, HighLevelWCSMixin):\n    \"\"\"\n    A mix-in class that is intended to be inherited by the\n    :class:`~astropy.wcs.WCS` class and provides the low- and high-level WCS API\n    \"\"\"\n\n    @property\n    def pixel_n_dim(self):\n        return self.naxis\n\n    @property\n    def world_n_dim(self):\n        return len(self.wcs.ctype)\n\n    @property\n    def array_shape(self):\n        if self.pixel_shape is None:\n            return None\n        else:\n            return self.pixel_shape[::-1]\n\n    @array_shape.setter\n    def array_shape(self, value):\n        if value is None:\n            self.pixel_shape = None\n        else:\n            self.pixel_shape = value[::-1]\n\n    @property\n    def pixel_shape(self):\n        if self._naxis == [0, 0]:\n            return None\n        else:\n            return tuple(self._naxis)\n\n    @pixel_shape.setter\n    def pixel_shape(self, value):\n        if value is None:\n            self._naxis = [0, 0]\n        else:\n            if len(value) != self.naxis:\n                raise ValueError(\"The number of data axes, \"\n                                 \"{}, does not equal the \"\n                                 \"shape {}.\".format(self.naxis, len(value)))\n            self._naxis = list(value)\n\n    @property\n    def pixel_bounds(self):\n        return self._pixel_bounds\n\n    @pixel_bounds.setter\n    def pixel_bounds(self, value):\n        if value is None:\n            self._pixel_bounds = value\n        else:\n            if len(value) != self.naxis:\n                raise ValueError(\"The number of data axes, \"\n                                 \"{}, does not equal the number of \"\n                                 \"pixel bounds {}.\".format(self.naxis, len(value)))\n            self._pixel_bounds = list(value)\n\n    @property\n    def world_axis_physical_types(self):\n        types = []\n        # TODO: need to support e.g. TT(TAI)\n        for ctype in self.wcs.ctype:\n            if ctype.upper().startswith(('UT(', 'TT(')):\n                types.append('time')\n            else:\n                ctype_name = ctype.split('-')[0]\n                for custom_mapping in CTYPE_TO_UCD1_CUSTOM:\n                    if ctype_name in custom_mapping:\n                        types.append(custom_mapping[ctype_name])\n                        break\n                else:\n                    types.append(CTYPE_TO_UCD1.get(ctype_name.upper(), None))\n        return types\n\n    @property\n    def world_axis_units(self):\n        units = []\n        for unit in self.wcs.cunit:\n            if unit is None:\n                unit = ''\n            elif isinstance(unit, u.Unit):\n                unit = unit.to_string(format='vounit')\n            else:\n                try:\n                    unit = u.Unit(unit).to_string(format='vounit')\n                except u.UnitsError:\n                    unit = ''\n            units.append(unit)\n        return units\n\n    @property\n    def world_axis_names(self):\n        return list(self.wcs.cname)\n\n    @property\n    def axis_correlation_matrix(self):\n\n        # If there are any distortions present, we assume that there may be\n        # correlations between all axes. Maybe if some distortions only apply\n        # to the image plane we can improve this?\n        if self.has_distortion:\n            return np.ones((self.world_n_dim, self.pixel_n_dim), dtype=bool)\n\n        # Assuming linear world coordinates along each axis, the correlation\n        # matrix would be given by whether or not the PC matrix is zero\n        matrix = self.wcs.get_pc() != 0\n\n        # We now need to check specifically for celestial coordinates since\n        # these can assume correlations because of spherical distortions. For\n        # each celestial coordinate we copy over the pixel dependencies from\n        # the other celestial coordinates.\n        celestial = (self.wcs.axis_types // 1000) % 10 == 2\n        celestial_indices = np.nonzero(celestial)[0]\n        for world1 in celestial_indices:\n            for world2 in celestial_indices:\n                if world1 != world2:\n                    matrix[world1] |= matrix[world2]\n                    matrix[world2] |= matrix[world1]\n\n        return matrix\n\n    def pixel_to_world_values(self, *pixel_arrays):\n        world = self.all_pix2world(*pixel_arrays, 0)\n        return world[0] if self.world_n_dim == 1 else tuple(world)\n\n    def world_to_pixel_values(self, *world_arrays):\n        pixel = self.all_world2pix(*world_arrays, 0)\n        return pixel[0] if self.pixel_n_dim == 1 else tuple(pixel)\n\n    @property\n    def world_axis_object_components(self):\n        return self._get_components_and_classes()[0]\n\n    @property\n    def world_axis_object_classes(self):\n        return self._get_components_and_classes()[1]\n\n    @property\n    def serialized_classes(self):\n        return False\n\n    def _get_components_and_classes(self):\n\n        # The aim of this function is to return whatever is needed for\n        # world_axis_object_components and world_axis_object_classes. It's easier\n        # to figure it out in one go and then return the values and let the\n        # properties return part of it.\n\n        # Since this method might get called quite a few times, we need to cache\n        # it. We start off by defining a hash based on the attributes of the\n        # WCS that matter here (we can't just use the WCS object as a hash since\n        # it is mutable)\n        wcs_hash = (self.naxis,\n                    list(self.wcs.ctype),\n                    list(self.wcs.cunit),\n                    self.wcs.radesys,\n                    self.wcs.specsys,\n                    self.wcs.equinox,\n                    self.wcs.dateobs,\n                    self.wcs.lng,\n                    self.wcs.lat)\n\n        # If the cache is present, we need to check that the 'hash' matches.\n        if getattr(self, '_components_and_classes_cache', None) is not None:\n            cache = self._components_and_classes_cache\n            if cache[0] == wcs_hash:\n                return cache[1]\n            else:\n                self._components_and_classes_cache = None\n\n        # Avoid circular imports by importing here\n        from astropy.wcs.utils import wcs_to_celestial_frame\n        from astropy.coordinates import SkyCoord, EarthLocation\n        from astropy.time.formats import FITS_DEPRECATED_SCALES\n        from astropy.time import Time, TimeDelta\n\n        components = [None] * self.naxis\n        classes = {}\n\n        # Let's start off by checking whether the WCS has a pair of celestial\n        # components\n\n        if self.has_celestial:\n\n            try:\n                celestial_frame = wcs_to_celestial_frame(self)\n            except ValueError:\n                # Some WCSes, e.g. solar, can be recognized by WCSLIB as being\n                # celestial but we don't necessarily have frames for them.\n                celestial_frame = None\n            else:\n\n                kwargs = {}\n                kwargs['frame'] = celestial_frame\n                kwargs['unit'] = u.deg\n\n                classes['celestial'] = (SkyCoord, (), kwargs)\n\n                components[self.wcs.lng] = ('celestial', 0, 'spherical.lon.degree')\n                components[self.wcs.lat] = ('celestial', 1, 'spherical.lat.degree')\n\n        # Next, we check for spectral components\n\n        if self.has_spectral:\n\n            # Find index of spectral coordinate\n            ispec = self.wcs.spec\n            ctype = self.wcs.ctype[ispec][:4]\n            ctype = ctype.upper()\n\n            kwargs = {}\n\n            # Determine observer location and velocity\n\n            # TODO: determine how WCS standard would deal with observer on a\n            # spacecraft far from earth. For now assume the obsgeo parameters,\n            # if present, give the geocentric observer location.\n\n            if np.isnan(self.wcs.obsgeo[0]):\n                observer = None\n            else:\n\n                earth_location = EarthLocation(*self.wcs.obsgeo[:3], unit=u.m)\n                obstime = Time(self.wcs.mjdobs, format='mjd', scale='utc',\n                               location=earth_location)\n                observer_location = SkyCoord(earth_location.get_itrs(obstime=obstime))\n\n                if self.wcs.specsys in VELOCITY_FRAMES:\n                    frame = VELOCITY_FRAMES[self.wcs.specsys]\n                    observer = observer_location.transform_to(frame)\n                    if isinstance(frame, str):\n                        observer = attach_zero_velocities(observer)\n                    else:\n                        observer = update_differentials_to_match(observer_location,\n                                                                 VELOCITY_FRAMES[self.wcs.specsys],\n                                                                 preserve_observer_frame=True)\n                elif self.wcs.specsys == 'TOPOCENT':\n                    observer = attach_zero_velocities(observer_location)\n                else:\n                    raise NotImplementedError(f'SPECSYS={self.wcs.specsys} not yet supported')\n\n            # Determine target\n\n            # This is tricker. In principle the target for each pixel is the\n            # celestial coordinates of the pixel, but we then need to be very\n            # careful about SSYSOBS which is tricky. For now, we set the\n            # target using the reference celestial coordinate in the WCS (if\n            # any).\n\n            if self.has_celestial and celestial_frame is not None:\n\n                # NOTE: celestial_frame was defined higher up\n\n                # NOTE: we set the distance explicitly to avoid warnings in SpectralCoord\n\n                target = SkyCoord(self.wcs.crval[self.wcs.lng] * self.wcs.cunit[self.wcs.lng],\n                                  self.wcs.crval[self.wcs.lat] * self.wcs.cunit[self.wcs.lat],\n                                  frame=celestial_frame,\n                                  distance=1000 * u.kpc)\n\n                target = attach_zero_velocities(target)\n\n            else:\n\n                target = None\n\n            # SpectralCoord does not work properly if either observer or target\n            # are not convertible to ICRS, so if this is the case, we (for now)\n            # drop the observer and target from the SpectralCoord and warn the\n            # user.\n\n            if observer is not None:\n                try:\n                    observer.transform_to(ICRS())\n                except Exception:\n                    warnings.warn('observer cannot be converted to ICRS, so will '\n                                  'not be set on SpectralCoord', AstropyUserWarning)\n                    observer = None\n\n            if target is not None:\n                try:\n                    target.transform_to(ICRS())\n                except Exception:\n                    warnings.warn('target cannot be converted to ICRS, so will '\n                                  'not be set on SpectralCoord', AstropyUserWarning)\n                    target = None\n\n            # NOTE: below we include Quantity in classes['spectral'] instead\n            # of SpectralCoord - this is because we want to also be able to\n            # accept plain quantities.\n\n            if ctype == 'ZOPT':\n\n                def spectralcoord_from_redshift(redshift):\n                    if isinstance(redshift, SpectralCoord):\n                        return redshift\n                    return SpectralCoord((redshift + 1) * self.wcs.restwav,\n                                         unit=u.m, observer=observer, target=target)\n\n                def redshift_from_spectralcoord(spectralcoord):\n                    # TODO: check target is consistent\n                    if observer is None:\n                        warnings.warn('No observer defined on WCS, SpectralCoord '\n                                      'will be converted without any velocity '\n                                      'frame change', AstropyUserWarning)\n                        return spectralcoord.to_value(u.m) / self.wcs.restwav - 1.\n                    else:\n                        return spectralcoord.with_observer_stationary_relative_to(observer).to_value(u.m) / self.wcs.restwav - 1.\n\n                classes['spectral'] = (u.Quantity, (), {}, spectralcoord_from_redshift)\n                components[self.wcs.spec] = ('spectral', 0, redshift_from_spectralcoord)\n\n            elif ctype == 'BETA':\n\n                def spectralcoord_from_beta(beta):\n                    if isinstance(beta, SpectralCoord):\n                        return beta\n                    return SpectralCoord(beta * C_SI,\n                                         unit=u.m / u.s,\n                                         doppler_convention='relativistic',\n                                         doppler_rest=self.wcs.restwav * u.m,\n                                         observer=observer, target=target)\n\n                def beta_from_spectralcoord(spectralcoord):\n                    # TODO: check target is consistent\n                    doppler_equiv = u.doppler_relativistic(self.wcs.restwav * u.m)\n                    if observer is None:\n                        warnings.warn('No observer defined on WCS, SpectralCoord '\n                                      'will be converted without any velocity '\n                                      'frame change', AstropyUserWarning)\n                        return spectralcoord.to_value(u.m / u.s, doppler_equiv) / C_SI\n                    else:\n                        return spectralcoord.with_observer_stationary_relative_to(observer).to_value(u.m / u.s, doppler_equiv) / C_SI\n\n                classes['spectral'] = (u.Quantity, (), {}, spectralcoord_from_beta)\n                components[self.wcs.spec] = ('spectral', 0, beta_from_spectralcoord)\n\n            else:\n\n                kwargs['unit'] = self.wcs.cunit[ispec]\n\n                if self.wcs.restfrq > 0:\n                    if ctype == 'VELO':\n                        kwargs['doppler_convention'] = 'relativistic'\n                        kwargs['doppler_rest'] = self.wcs.restfrq * u.Hz\n                    elif ctype == 'VRAD':\n                        kwargs['doppler_convention'] = 'radio'\n                        kwargs['doppler_rest'] = self.wcs.restfrq * u.Hz\n                    elif ctype == 'VOPT':\n                        kwargs['doppler_convention'] = 'optical'\n                        kwargs['doppler_rest'] = self.wcs.restwav * u.m\n\n                def spectralcoord_from_value(value):\n                    return SpectralCoord(value, observer=observer, target=target, **kwargs)\n\n                def value_from_spectralcoord(spectralcoord):\n                    # TODO: check target is consistent\n                    if observer is None:\n                        warnings.warn('No observer defined on WCS, SpectralCoord '\n                                      'will be converted without any velocity '\n                                      'frame change', AstropyUserWarning)\n                        return spectralcoord.to_value(**kwargs)\n                    else:\n                        return spectralcoord.with_observer_stationary_relative_to(observer).to_value(**kwargs)\n\n                classes['spectral'] = (u.Quantity, (), {}, spectralcoord_from_value)\n                components[self.wcs.spec] = ('spectral', 0, value_from_spectralcoord)\n\n        # We can then make sure we correctly return Time objects where appropriate\n        # (https://www.aanda.org/articles/aa/pdf/2015/02/aa24653-14.pdf)\n\n        if 'time' in self.world_axis_physical_types:\n\n            multiple_time = self.world_axis_physical_types.count('time') > 1\n\n            for i in range(self.naxis):\n\n                if self.world_axis_physical_types[i] == 'time':\n\n                    if multiple_time:\n                        name = f'time.{i}'\n                    else:\n                        name = 'time'\n\n                    # Initialize delta\n                    reference_time_delta = None\n\n                    # Extract time scale\n                    scale = self.wcs.ctype[i].lower()\n\n                    if scale == 'time':\n                        if self.wcs.timesys:\n                            scale = self.wcs.timesys.lower()\n                        else:\n                            scale = 'utc'\n\n                    # Drop sub-scales\n                    if '(' in scale:\n                        pos = scale.index('(')\n                        scale, subscale = scale[:pos], scale[pos+1:-1]\n                        warnings.warn(f'Dropping unsupported sub-scale '\n                                      f'{subscale.upper()} from scale {scale.upper()}',\n                                      UserWarning)\n\n                    # TODO: consider having GPS as a scale in Time\n                    # For now GPS is not a scale, we approximate this by TAI - 19s\n                    if scale == 'gps':\n                        reference_time_delta = TimeDelta(19, format='sec')\n                        scale = 'tai'\n\n                    elif scale.upper() in FITS_DEPRECATED_SCALES:\n                        scale = FITS_DEPRECATED_SCALES[scale.upper()]\n\n                    elif scale not in Time.SCALES:\n                        raise ValueError(f'Unrecognized time CTYPE={self.wcs.ctype[i]}')\n\n                    # Determine location\n                    trefpos = self.wcs.trefpos.lower()\n\n                    if trefpos.startswith('topocent'):\n                        # Note that some headers use TOPOCENT instead of TOPOCENTER\n                        if np.any(np.isnan(self.wcs.obsgeo[:3])):\n                            warnings.warn('Missing or incomplete observer location '\n                                          'information, setting location in Time to None',\n                                          UserWarning)\n                            location = None\n                        else:\n                            location = EarthLocation(*self.wcs.obsgeo[:3], unit=u.m)\n                    elif trefpos == 'geocenter':\n                        location = EarthLocation(0, 0, 0, unit=u.m)\n                    elif trefpos == '':\n                        location = None\n                    else:\n                        # TODO: implement support for more locations when Time supports it\n                        warnings.warn(f\"Observation location '{trefpos}' is not \"\n                                       \"supported, setting location in Time to None\", UserWarning)\n                        location = None\n\n                    reference_time = Time(np.nan_to_num(self.wcs.mjdref[0]),\n                                          np.nan_to_num(self.wcs.mjdref[1]),\n                                          format='mjd', scale=scale,\n                                          location=location)\n\n                    if reference_time_delta is not None:\n                        reference_time = reference_time + reference_time_delta\n\n                    def time_from_reference_and_offset(offset):\n                        if isinstance(offset, Time):\n                            return offset\n                        return reference_time + TimeDelta(offset, format='sec')\n\n                    def offset_from_time_and_reference(time):\n                        return (time - reference_time).sec\n\n                    classes[name] = (Time, (), {}, time_from_reference_and_offset)\n                    components[i] = (name, 0, offset_from_time_and_reference)\n\n        # Fallback: for any remaining components that haven't been identified, just\n        # return Quantity as the class to use\n\n        for i in range(self.naxis):\n            if components[i] is None:\n                name = self.wcs.ctype[i].split('-')[0].lower()\n                if name == '':\n                    name = 'world'\n                while name in classes:\n                    name += \"_\"\n                classes[name] = (u.Quantity, (), {'unit': self.wcs.cunit[i]})\n                components[i] = (name, 0, 'value')\n\n        # Keep a cached version of result\n        self._components_and_classes_cache = wcs_hash, (components, classes)\n\n        return components, classes"},{"col":4,"comment":"null","endLoc":661,"header":"def _silent_update(self, value=None)","id":806,"name":"_silent_update","nodeType":"Function","startLoc":660,"text":"def _silent_update(self, value=None):\n        pass"},{"col":4,"comment":"\n        Construct a `Column` by specifying attributes.  All attributes\n        except ``format`` can be optional; see :ref:`astropy:column_creation`\n        and :ref:`astropy:creating_ascii_table` for more information regarding\n        ``TFORM`` keyword.\n\n        Parameters\n        ----------\n        name : str, optional\n            column name, corresponding to ``TTYPE`` keyword\n\n        format : str\n            column format, corresponding to ``TFORM`` keyword\n\n        unit : str, optional\n            column unit, corresponding to ``TUNIT`` keyword\n\n        null : str, optional\n            null value, corresponding to ``TNULL`` keyword\n\n        bscale : int-like, optional\n            bscale value, corresponding to ``TSCAL`` keyword\n\n        bzero : int-like, optional\n            bzero value, corresponding to ``TZERO`` keyword\n\n        disp : str, optional\n            display format, corresponding to ``TDISP`` keyword\n\n        start : int, optional\n            column starting position (ASCII table only), corresponding\n            to ``TBCOL`` keyword\n\n        dim : str, optional\n            column dimension corresponding to ``TDIM`` keyword\n\n        array : iterable, optional\n            a `list`, `numpy.ndarray` (or other iterable that can be used to\n            initialize an ndarray) providing initial data for this column.\n            The array will be automatically converted, if possible, to the data\n            format of the column.  In the case were non-trivial ``bscale``\n            and/or ``bzero`` arguments are given, the values in the array must\n            be the *physical* values--that is, the values of column as if the\n            scaling has already been applied (the array stored on the column\n            object will then be converted back to its storage values).\n\n        ascii : bool, optional\n            set `True` if this describes a column for an ASCII table; this\n            may be required to disambiguate the column format\n\n        coord_type : str, optional\n            coordinate/axis type corresponding to ``TCTYP`` keyword\n\n        coord_unit : str, optional\n            coordinate/axis unit corresponding to ``TCUNI`` keyword\n\n        coord_ref_point : int-like, optional\n            pixel coordinate of the reference point corresponding to ``TCRPX``\n            keyword\n\n        coord_ref_value : int-like, optional\n            coordinate value at reference point corresponding to ``TCRVL``\n            keyword\n\n        coord_inc : int-like, optional\n            coordinate increment at reference point corresponding to ``TCDLT``\n            keyword\n\n        time_ref_pos : str, optional\n            reference position for a time coordinate column corresponding to\n            ``TRPOS`` keyword\n        ","endLoc":674,"header":"def __init__(self, name=None, format=None, unit=None, null=None,\n                 bscale=None, bzero=None, disp=None, start=None, dim=None,\n                 array=None, ascii=None, coord_type=None, coord_unit=None,\n                 coord_ref_point=None, coord_ref_value=None, coord_inc=None,\n                 time_ref_pos=None)","id":807,"name":"__init__","nodeType":"Function","startLoc":521,"text":"def __init__(self, name=None, format=None, unit=None, null=None,\n                 bscale=None, bzero=None, disp=None, start=None, dim=None,\n                 array=None, ascii=None, coord_type=None, coord_unit=None,\n                 coord_ref_point=None, coord_ref_value=None, coord_inc=None,\n                 time_ref_pos=None):\n        \"\"\"\n        Construct a `Column` by specifying attributes.  All attributes\n        except ``format`` can be optional; see :ref:`astropy:column_creation`\n        and :ref:`astropy:creating_ascii_table` for more information regarding\n        ``TFORM`` keyword.\n\n        Parameters\n        ----------\n        name : str, optional\n            column name, corresponding to ``TTYPE`` keyword\n\n        format : str\n            column format, corresponding to ``TFORM`` keyword\n\n        unit : str, optional\n            column unit, corresponding to ``TUNIT`` keyword\n\n        null : str, optional\n            null value, corresponding to ``TNULL`` keyword\n\n        bscale : int-like, optional\n            bscale value, corresponding to ``TSCAL`` keyword\n\n        bzero : int-like, optional\n            bzero value, corresponding to ``TZERO`` keyword\n\n        disp : str, optional\n            display format, corresponding to ``TDISP`` keyword\n\n        start : int, optional\n            column starting position (ASCII table only), corresponding\n            to ``TBCOL`` keyword\n\n        dim : str, optional\n            column dimension corresponding to ``TDIM`` keyword\n\n        array : iterable, optional\n            a `list`, `numpy.ndarray` (or other iterable that can be used to\n            initialize an ndarray) providing initial data for this column.\n            The array will be automatically converted, if possible, to the data\n            format of the column.  In the case were non-trivial ``bscale``\n            and/or ``bzero`` arguments are given, the values in the array must\n            be the *physical* values--that is, the values of column as if the\n            scaling has already been applied (the array stored on the column\n            object will then be converted back to its storage values).\n\n        ascii : bool, optional\n            set `True` if this describes a column for an ASCII table; this\n            may be required to disambiguate the column format\n\n        coord_type : str, optional\n            coordinate/axis type corresponding to ``TCTYP`` keyword\n\n        coord_unit : str, optional\n            coordinate/axis unit corresponding to ``TCUNI`` keyword\n\n        coord_ref_point : int-like, optional\n            pixel coordinate of the reference point corresponding to ``TCRPX``\n            keyword\n\n        coord_ref_value : int-like, optional\n            coordinate value at reference point corresponding to ``TCRVL``\n            keyword\n\n        coord_inc : int-like, optional\n            coordinate increment at reference point corresponding to ``TCDLT``\n            keyword\n\n        time_ref_pos : str, optional\n            reference position for a time coordinate column corresponding to\n            ``TRPOS`` keyword\n        \"\"\"\n\n        if format is None:\n            raise ValueError('Must specify format to construct Column.')\n\n        # any of the input argument (except array) can be a Card or just\n        # a number/string\n        kwargs = {'ascii': ascii}\n        for attr in KEYWORD_ATTRIBUTES:\n            value = locals()[attr]  # get the argument's value\n\n            if isinstance(value, Card):\n                value = value.value\n\n            kwargs[attr] = value\n\n        valid_kwargs, invalid_kwargs = self._verify_keywords(**kwargs)\n\n        if invalid_kwargs:\n            msg = ['The following keyword arguments to Column were invalid:']\n\n            for val in invalid_kwargs.values():\n                msg.append(indent(val[1]))\n\n            raise VerifyError('\\n'.join(msg))\n\n        for attr in KEYWORD_ATTRIBUTES:\n            setattr(self, attr, valid_kwargs.get(attr))\n\n        # TODO: Try to eliminate the following two special cases\n        # for recformat and dim:\n        # This is not actually stored as an attribute on columns for some\n        # reason\n        recformat = valid_kwargs['recformat']\n\n        # The 'dim' keyword's original value is stored in self.dim, while\n        # *only* the tuple form is stored in self._dims.\n        self._dims = self.dim\n        self.dim = dim\n\n        # Awful hack to use for now to keep track of whether the column holds\n        # pseudo-unsigned int data\n        self._pseudo_unsigned_ints = False\n\n        # if the column data is not ndarray, make it to be one, i.e.\n        # input arrays can be just list or tuple, not required to be ndarray\n        # does not include Object array because there is no guarantee\n        # the elements in the object array are consistent.\n        if not isinstance(array,\n                          (np.ndarray, chararray.chararray, Delayed)):\n            try:  # try to convert to a ndarray first\n                if array is not None:\n                    array = np.array(array)\n            except Exception:\n                try:  # then try to convert it to a strings array\n                    itemsize = int(recformat[1:])\n                    array = chararray.array(array, itemsize=itemsize)\n                except ValueError:\n                    # then try variable length array\n                    # Note: This includes _FormatQ by inheritance\n                    if isinstance(recformat, _FormatP):\n                        array = _VLF(array, dtype=recformat.dtype)\n                    else:\n                        raise ValueError('Data is inconsistent with the '\n                                         'format `{}`.'.format(format))\n\n        array = self._convert_to_valid_data_type(array)\n\n        # We have required (through documentation) that arrays passed in to\n        # this constructor are already in their physical values, so we make\n        # note of that here\n        if isinstance(array, np.ndarray):\n            self._physical_values = True\n        else:\n            self._physical_values = False\n\n        self._parent_fits_rec = None\n        self.array = array"},{"className":"BaseLowLevelWCS","col":0,"comment":"\n    Abstract base class for the low-level WCS interface.\n\n    This is described in `APE 14: A shared Python interface for World Coordinate\n    Systems <https://doi.org/10.5281/zenodo.1188875>`_.\n    ","endLoc":341,"id":808,"nodeType":"Class","startLoc":9,"text":"class BaseLowLevelWCS(metaclass=abc.ABCMeta):\n    \"\"\"\n    Abstract base class for the low-level WCS interface.\n\n    This is described in `APE 14: A shared Python interface for World Coordinate\n    Systems <https://doi.org/10.5281/zenodo.1188875>`_.\n    \"\"\"\n\n    @property\n    @abc.abstractmethod\n    def pixel_n_dim(self):\n        \"\"\"\n        The number of axes in the pixel coordinate system.\n        \"\"\"\n\n    @property\n    @abc.abstractmethod\n    def world_n_dim(self):\n        \"\"\"\n        The number of axes in the world coordinate system.\n        \"\"\"\n\n    @property\n    @abc.abstractmethod\n    def world_axis_physical_types(self):\n        \"\"\"\n        An iterable of strings describing the physical type for each world axis.\n\n        These should be names from the VO UCD1+ controlled Vocabulary\n        (http://www.ivoa.net/documents/latest/UCDlist.html). If no matching UCD\n        type exists, this can instead be ``\"custom:xxx\"``, where ``xxx`` is an\n        arbitrary string.  Alternatively, if the physical type is\n        unknown/undefined, an element can be `None`.\n        \"\"\"\n\n    @property\n    @abc.abstractmethod\n    def world_axis_units(self):\n        \"\"\"\n        An iterable of strings given the units of the world coordinates for each\n        axis.\n\n        The strings should follow the `IVOA VOUnit standard\n        <http://ivoa.net/documents/VOUnits/>`_ (though as noted in the VOUnit\n        specification document, units that do not follow this standard are still\n        allowed, but just not recommended).\n        \"\"\"\n\n    @abc.abstractmethod\n    def pixel_to_world_values(self, *pixel_arrays):\n        \"\"\"\n        Convert pixel coordinates to world coordinates.\n\n        This method takes `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` scalars or arrays as\n        input, and pixel coordinates should be zero-based. Returns\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` scalars or arrays in units given by\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_units`. Note that pixel coordinates are\n        assumed to be 0 at the center of the first pixel in each dimension. If a\n        pixel is in a region where the WCS is not defined, NaN can be returned.\n        The coordinates should be specified in the ``(x, y)`` order, where for\n        an image, ``x`` is the horizontal coordinate and ``y`` is the vertical\n        coordinate.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned.\n        \"\"\"\n\n    def array_index_to_world_values(self, *index_arrays):\n        \"\"\"\n        Convert array indices to world coordinates.\n\n        This is the same as `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values` except that\n        the indices should be given in ``(i, j)`` order, where for an image\n        ``i`` is the row and ``j`` is the column (i.e. the opposite order to\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values`).\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned.\n        \"\"\"\n        return self.pixel_to_world_values(*index_arrays[::-1])\n\n    @abc.abstractmethod\n    def world_to_pixel_values(self, *world_arrays):\n        \"\"\"\n        Convert world coordinates to pixel coordinates.\n\n        This method takes `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` scalars or arrays as\n        input in units given by `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_units`. Returns\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` scalars or arrays. Note that pixel\n        coordinates are assumed to be 0 at the center of the first pixel in each\n        dimension. If a world coordinate does not have a matching pixel\n        coordinate, NaN can be returned.  The coordinates should be returned in\n        the ``(x, y)`` order, where for an image, ``x`` is the horizontal\n        coordinate and ``y`` is the vertical coordinate.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned.\n        \"\"\"\n\n    def world_to_array_index_values(self, *world_arrays):\n        \"\"\"\n        Convert world coordinates to array indices.\n\n        This is the same as `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_to_pixel_values` except that\n        the indices should be returned in ``(i, j)`` order, where for an image\n        ``i`` is the row and ``j`` is the column (i.e. the opposite order to\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values`). The indices should be\n        returned as rounded integers.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned.\n        \"\"\"\n        pixel_arrays = self.world_to_pixel_values(*world_arrays)\n        if self.pixel_n_dim == 1:\n            pixel_arrays = (pixel_arrays,)\n        else:\n            pixel_arrays = pixel_arrays[::-1]\n        array_indices = tuple(np.asarray(np.floor(pixel + 0.5), dtype=np.int_) for pixel in pixel_arrays)\n        return array_indices[0] if self.pixel_n_dim == 1 else array_indices\n\n    @property\n    @abc.abstractmethod\n    def world_axis_object_components(self):\n        \"\"\"\n        A list with `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` elements giving information\n        on constructing high-level objects for the world coordinates.\n\n        Each element of the list is a tuple with three items:\n\n        * The first is a name for the world object this world array\n          corresponds to, which *must* match the string names used in\n          `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_classes`. Note that names might\n          appear twice because two world arrays might correspond to a single\n          world object (e.g. a celestial coordinate might have both “ra” and\n          “dec” arrays, which correspond to a single sky coordinate object).\n\n        * The second element is either a string keyword argument name or a\n          positional index for the corresponding class from\n          `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_classes`.\n\n        * The third argument is a string giving the name of the property\n          to access on the corresponding class from\n          `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_classes` in\n          order to get numerical values. Alternatively, this argument can be a\n          callable Python object that takes a high-level coordinate object and\n          returns the numerical values suitable for passing to the low-level\n          WCS transformation methods.\n\n        See the document\n        `APE 14: A shared Python interface for World Coordinate Systems\n        <https://doi.org/10.5281/zenodo.1188875>`_ for examples.\n        \"\"\"\n\n    @property\n    @abc.abstractmethod\n    def world_axis_object_classes(self):\n        \"\"\"\n        A dictionary giving information on constructing high-level objects for\n        the world coordinates.\n\n        Each key of the dictionary is a string key from\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_components`, and each value is a\n        tuple with three elements or four elements:\n\n        * The first element of the tuple must be a class or a string specifying\n          the fully-qualified name of a class, which will specify the actual\n          Python object to be created.\n\n        * The second element, should be a tuple specifying the positional\n          arguments required to initialize the class. If\n          `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_components` specifies that the\n          world coordinates should be passed as a positional argument, this this\n          tuple should include `None` placeholders for the world coordinates.\n\n        * The third tuple element must be a dictionary with the keyword\n          arguments required to initialize the class.\n\n        * Optionally, for advanced use cases, the fourth element (if present)\n          should be a callable Python object that gets called instead of the\n          class and gets passed the positional and keyword arguments. It should\n          return an object of the type of the first element in the tuple.\n\n        Note that we don't require the classes to be Astropy classes since there\n        is no guarantee that Astropy will have all the classes to represent all\n        kinds of world coordinates. Furthermore, we recommend that the output be\n        kept as human-readable as possible.\n\n        The classes used here should have the ability to do conversions by\n        passing an instance as the first argument to the same class with\n        different arguments (e.g. ``Time(Time(...), scale='tai')``). This is\n        a requirement for the implementation of the high-level interface.\n\n        The second and third tuple elements for each value of this dictionary\n        can in turn contain either instances of classes, or if necessary can\n        contain serialized versions that should take the same form as the main\n        classes described above (a tuple with three elements with the fully\n        qualified name of the class, then the positional arguments and the\n        keyword arguments). For low-level API objects implemented in Python, we\n        recommend simply returning the actual objects (not the serialized form)\n        for optimal performance. Implementations should either always or never\n        use serialized classes to represent Python objects, and should indicate\n        which of these they follow using the\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.serialized_classes` attribute.\n\n        See the document\n        `APE 14: A shared Python interface for World Coordinate Systems\n        <https://doi.org/10.5281/zenodo.1188875>`_ for examples .\n        \"\"\"\n\n    # The following three properties have default fallback implementations, so\n    # they are not abstract.\n\n    @property\n    def array_shape(self):\n        \"\"\"\n        The shape of the data that the WCS applies to as a tuple of length\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` in ``(row, column)``\n        order (the convention for arrays in Python).\n\n        If the WCS is valid in the context of a dataset with a particular\n        shape, then this property can be used to store the shape of the\n        data. This can be used for example if implementing slicing of WCS\n        objects. This is an optional property, and it should return `None`\n        if a shape is not known or relevant.\n        \"\"\"\n        if self.pixel_shape is None:\n            return None\n        else:\n            return self.pixel_shape[::-1]\n\n    @property\n    def pixel_shape(self):\n        \"\"\"\n        The shape of the data that the WCS applies to as a tuple of length\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` in ``(x, y)``\n        order (where for an image, ``x`` is the horizontal coordinate and ``y``\n        is the vertical coordinate).\n\n        If the WCS is valid in the context of a dataset with a particular\n        shape, then this property can be used to store the shape of the\n        data. This can be used for example if implementing slicing of WCS\n        objects. This is an optional property, and it should return `None`\n        if a shape is not known or relevant.\n\n        If you are interested in getting a shape that is comparable to that of\n        a Numpy array, you should use\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.array_shape` instead.\n        \"\"\"\n        return None\n\n    @property\n    def pixel_bounds(self):\n        \"\"\"\n        The bounds (in pixel coordinates) inside which the WCS is defined,\n        as a list with `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim`\n        ``(min, max)`` tuples.\n\n        The bounds should be given in ``[(xmin, xmax), (ymin, ymax)]``\n        order. WCS solutions are sometimes only guaranteed to be accurate\n        within a certain range of pixel values, for example when defining a\n        WCS that includes fitted distortions. This is an optional property,\n        and it should return `None` if a shape is not known or relevant.\n        \"\"\"\n        return None\n\n    @property\n    def pixel_axis_names(self):\n        \"\"\"\n        An iterable of strings describing the name for each pixel axis.\n\n        If an axis does not have a name, an empty string should be returned\n        (this is the default behavior for all axes if a subclass does not\n        override this property). Note that these names are just for display\n        purposes and are not standardized.\n        \"\"\"\n        return [''] * self.pixel_n_dim\n\n    @property\n    def world_axis_names(self):\n        \"\"\"\n        An iterable of strings describing the name for each world axis.\n\n        If an axis does not have a name, an empty string should be returned\n        (this is the default behavior for all axes if a subclass does not\n        override this property). Note that these names are just for display\n        purposes and are not standardized. For standardized axis types, see\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_physical_types`.\n        \"\"\"\n        return [''] * self.world_n_dim\n\n    @property\n    def axis_correlation_matrix(self):\n        \"\"\"\n        Returns an (`~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim`,\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim`) matrix that\n        indicates using booleans whether a given world coordinate depends on a\n        given pixel coordinate.\n\n        This defaults to a matrix where all elements are `True` in the absence\n        of any further information. For completely independent axes, the\n        diagonal would be `True` and all other entries `False`.\n        \"\"\"\n        return np.ones((self.world_n_dim, self.pixel_n_dim), dtype=bool)\n\n    @property\n    def serialized_classes(self):\n        \"\"\"\n        Indicates whether Python objects are given in serialized form or as\n        actual Python objects.\n        \"\"\"\n        return False\n\n    def _as_mpl_axes(self):\n        \"\"\"\n        Compatibility hook for Matplotlib and WCSAxes. With this method, one can\n        do::\n\n            from astropy.wcs import WCS\n            import matplotlib.pyplot as plt\n            wcs = WCS('filename.fits')\n            fig = plt.figure()\n            ax = fig.add_axes([0.15, 0.1, 0.8, 0.8], projection=wcs)\n            ...\n\n        and this will generate a plot with the correct WCS coordinates on the\n        axes.\n        \"\"\"\n        from astropy.visualization.wcsaxes import WCSAxes\n        return WCSAxes, {'wcs': self}"},{"col":4,"comment":"\n        The number of axes in the pixel coordinate system.\n        ","endLoc":22,"header":"@property\n    @abc.abstractmethod\n    def pixel_n_dim(self)","id":809,"name":"pixel_n_dim","nodeType":"Function","startLoc":17,"text":"@property\n    @abc.abstractmethod\n    def pixel_n_dim(self):\n        \"\"\"\n        The number of axes in the pixel coordinate system.\n        \"\"\""},{"col":4,"comment":"\n        The number of axes in the world coordinate system.\n        ","endLoc":29,"header":"@property\n    @abc.abstractmethod\n    def world_n_dim(self)","id":810,"name":"world_n_dim","nodeType":"Function","startLoc":24,"text":"@property\n    @abc.abstractmethod\n    def world_n_dim(self):\n        \"\"\"\n        The number of axes in the world coordinate system.\n        \"\"\""},{"col":4,"comment":"\n        An iterable of strings describing the physical type for each world axis.\n\n        These should be names from the VO UCD1+ controlled Vocabulary\n        (http://www.ivoa.net/documents/latest/UCDlist.html). If no matching UCD\n        type exists, this can instead be ``\"custom:xxx\"``, where ``xxx`` is an\n        arbitrary string.  Alternatively, if the physical type is\n        unknown/undefined, an element can be `None`.\n        ","endLoc":42,"header":"@property\n    @abc.abstractmethod\n    def world_axis_physical_types(self)","id":811,"name":"world_axis_physical_types","nodeType":"Function","startLoc":31,"text":"@property\n    @abc.abstractmethod\n    def world_axis_physical_types(self):\n        \"\"\"\n        An iterable of strings describing the physical type for each world axis.\n\n        These should be names from the VO UCD1+ controlled Vocabulary\n        (http://www.ivoa.net/documents/latest/UCDlist.html). If no matching UCD\n        type exists, this can instead be ``\"custom:xxx\"``, where ``xxx`` is an\n        arbitrary string.  Alternatively, if the physical type is\n        unknown/undefined, an element can be `None`.\n        \"\"\""},{"col":4,"comment":"\n        An iterable of strings given the units of the world coordinates for each\n        axis.\n\n        The strings should follow the `IVOA VOUnit standard\n        <http://ivoa.net/documents/VOUnits/>`_ (though as noted in the VOUnit\n        specification document, units that do not follow this standard are still\n        allowed, but just not recommended).\n        ","endLoc":55,"header":"@property\n    @abc.abstractmethod\n    def world_axis_units(self)","id":812,"name":"world_axis_units","nodeType":"Function","startLoc":44,"text":"@property\n    @abc.abstractmethod\n    def world_axis_units(self):\n        \"\"\"\n        An iterable of strings given the units of the world coordinates for each\n        axis.\n\n        The strings should follow the `IVOA VOUnit standard\n        <http://ivoa.net/documents/VOUnits/>`_ (though as noted in the VOUnit\n        specification document, units that do not follow this standard are still\n        allowed, but just not recommended).\n        \"\"\""},{"col":4,"comment":"\n        Convert pixel coordinates to world coordinates.\n\n        This method takes `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` scalars or arrays as\n        input, and pixel coordinates should be zero-based. Returns\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` scalars or arrays in units given by\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_units`. Note that pixel coordinates are\n        assumed to be 0 at the center of the first pixel in each dimension. If a\n        pixel is in a region where the WCS is not defined, NaN can be returned.\n        The coordinates should be specified in the ``(x, y)`` order, where for\n        an image, ``x`` is the horizontal coordinate and ``y`` is the vertical\n        coordinate.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned.\n        ","endLoc":75,"header":"@abc.abstractmethod\n    def pixel_to_world_values(self, *pixel_arrays)","id":813,"name":"pixel_to_world_values","nodeType":"Function","startLoc":57,"text":"@abc.abstractmethod\n    def pixel_to_world_values(self, *pixel_arrays):\n        \"\"\"\n        Convert pixel coordinates to world coordinates.\n\n        This method takes `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` scalars or arrays as\n        input, and pixel coordinates should be zero-based. Returns\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` scalars or arrays in units given by\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_units`. Note that pixel coordinates are\n        assumed to be 0 at the center of the first pixel in each dimension. If a\n        pixel is in a region where the WCS is not defined, NaN can be returned.\n        The coordinates should be specified in the ``(x, y)`` order, where for\n        an image, ``x`` is the horizontal coordinate and ``y`` is the vertical\n        coordinate.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned.\n        \"\"\""},{"col":4,"comment":"\n        Convert array indices to world coordinates.\n\n        This is the same as `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values` except that\n        the indices should be given in ``(i, j)`` order, where for an image\n        ``i`` is the row and ``j`` is the column (i.e. the opposite order to\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values`).\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned.\n        ","endLoc":90,"header":"def array_index_to_world_values(self, *index_arrays)","id":814,"name":"array_index_to_world_values","nodeType":"Function","startLoc":77,"text":"def array_index_to_world_values(self, *index_arrays):\n        \"\"\"\n        Convert array indices to world coordinates.\n\n        This is the same as `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values` except that\n        the indices should be given in ``(i, j)`` order, where for an image\n        ``i`` is the row and ``j`` is the column (i.e. the opposite order to\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values`).\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned.\n        \"\"\"\n        return self.pixel_to_world_values(*index_arrays[::-1])"},{"col":4,"comment":"\n        Convert world coordinates to pixel coordinates.\n\n        This method takes `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` scalars or arrays as\n        input in units given by `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_units`. Returns\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` scalars or arrays. Note that pixel\n        coordinates are assumed to be 0 at the center of the first pixel in each\n        dimension. If a world coordinate does not have a matching pixel\n        coordinate, NaN can be returned.  The coordinates should be returned in\n        the ``(x, y)`` order, where for an image, ``x`` is the horizontal\n        coordinate and ``y`` is the vertical coordinate.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned.\n        ","endLoc":109,"header":"@abc.abstractmethod\n    def world_to_pixel_values(self, *world_arrays)","id":815,"name":"world_to_pixel_values","nodeType":"Function","startLoc":92,"text":"@abc.abstractmethod\n    def world_to_pixel_values(self, *world_arrays):\n        \"\"\"\n        Convert world coordinates to pixel coordinates.\n\n        This method takes `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` scalars or arrays as\n        input in units given by `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_units`. Returns\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` scalars or arrays. Note that pixel\n        coordinates are assumed to be 0 at the center of the first pixel in each\n        dimension. If a world coordinate does not have a matching pixel\n        coordinate, NaN can be returned.  The coordinates should be returned in\n        the ``(x, y)`` order, where for an image, ``x`` is the horizontal\n        coordinate and ``y`` is the vertical coordinate.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned.\n        \"\"\""},{"col":4,"comment":"\n        Convert world coordinates to array indices.\n\n        This is the same as `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_to_pixel_values` except that\n        the indices should be returned in ``(i, j)`` order, where for an image\n        ``i`` is the row and ``j`` is the column (i.e. the opposite order to\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values`). The indices should be\n        returned as rounded integers.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned.\n        ","endLoc":131,"header":"def world_to_array_index_values(self, *world_arrays)","id":816,"name":"world_to_array_index_values","nodeType":"Function","startLoc":111,"text":"def world_to_array_index_values(self, *world_arrays):\n        \"\"\"\n        Convert world coordinates to array indices.\n\n        This is the same as `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_to_pixel_values` except that\n        the indices should be returned in ``(i, j)`` order, where for an image\n        ``i`` is the row and ``j`` is the column (i.e. the opposite order to\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values`). The indices should be\n        returned as rounded integers.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned.\n        \"\"\"\n        pixel_arrays = self.world_to_pixel_values(*world_arrays)\n        if self.pixel_n_dim == 1:\n            pixel_arrays = (pixel_arrays,)\n        else:\n            pixel_arrays = pixel_arrays[::-1]\n        array_indices = tuple(np.asarray(np.floor(pixel + 0.5), dtype=np.int_) for pixel in pixel_arrays)\n        return array_indices[0] if self.pixel_n_dim == 1 else array_indices"},{"col":4,"comment":"null","endLoc":166,"header":"def __init__(self, data=None, header=None, do_not_scale_image_data=False,\n                 uint=True, scale_back=False, ignore_blank=False, **kwargs)","id":817,"name":"__init__","nodeType":"Function","startLoc":43,"text":"def __init__(self, data=None, header=None, do_not_scale_image_data=False,\n                 uint=True, scale_back=False, ignore_blank=False, **kwargs):\n\n        from .groups import GroupsHDU\n\n        super().__init__(data=data, header=header)\n\n        if data is DELAYED:\n            # Presumably if data is DELAYED then this HDU is coming from an\n            # open file, and was not created in memory\n            if header is None:\n                # this should never happen\n                raise ValueError('No header to setup HDU.')\n        else:\n            # TODO: Some of this card manipulation should go into the\n            # PrimaryHDU and GroupsHDU subclasses\n            # construct a list of cards of minimal header\n            if isinstance(self, ExtensionHDU):\n                c0 = ('XTENSION', 'IMAGE',\n                      self.standard_keyword_comments['XTENSION'])\n            else:\n                c0 = ('SIMPLE', True, self.standard_keyword_comments['SIMPLE'])\n            cards = [\n                c0,\n                ('BITPIX', 8, self.standard_keyword_comments['BITPIX']),\n                ('NAXIS', 0, self.standard_keyword_comments['NAXIS'])]\n\n            if isinstance(self, GroupsHDU):\n                cards.append(('GROUPS', True,\n                             self.standard_keyword_comments['GROUPS']))\n\n            if isinstance(self, (ExtensionHDU, GroupsHDU)):\n                cards.append(('PCOUNT', 0,\n                              self.standard_keyword_comments['PCOUNT']))\n                cards.append(('GCOUNT', 1,\n                              self.standard_keyword_comments['GCOUNT']))\n\n            if header is not None:\n                orig = header.copy()\n                header = Header(cards)\n                header.extend(orig, strip=True, update=True, end=True)\n            else:\n                header = Header(cards)\n\n            self._header = header\n\n        self._do_not_scale_image_data = do_not_scale_image_data\n\n        self._uint = uint\n        self._scale_back = scale_back\n\n        # Keep track of whether BZERO/BSCALE were set from the header so that\n        # values for self._orig_bzero and self._orig_bscale can be set\n        # properly, if necessary, once the data has been set.\n        bzero_in_header = 'BZERO' in self._header\n        bscale_in_header = 'BSCALE' in self._header\n        self._bzero = self._header.get('BZERO', 0)\n        self._bscale = self._header.get('BSCALE', 1)\n\n        # Save off other important values from the header needed to interpret\n        # the image data\n        self._axes = [self._header.get('NAXIS' + str(axis + 1), 0)\n                      for axis in range(self._header.get('NAXIS', 0))]\n\n        # Not supplying a default for BITPIX makes sense because BITPIX\n        # is either in the header or should be determined from the dtype of\n        # the data (which occurs when the data is set).\n        self._bitpix = self._header.get('BITPIX')\n        self._gcount = self._header.get('GCOUNT', 1)\n        self._pcount = self._header.get('PCOUNT', 0)\n        self._blank = None if ignore_blank else self._header.get('BLANK')\n        self._verify_blank()\n\n        self._orig_bitpix = self._bitpix\n        self._orig_blank = self._header.get('BLANK')\n\n        # These get set again below, but need to be set to sensible defaults\n        # here.\n        self._orig_bzero = self._bzero\n        self._orig_bscale = self._bscale\n\n        # Set the name attribute if it was provided (if this is an ImageHDU\n        # this will result in setting the EXTNAME keyword of the header as\n        # well)\n        if 'name' in kwargs and kwargs['name']:\n            self.name = kwargs['name']\n        if 'ver' in kwargs and kwargs['ver']:\n            self.ver = kwargs['ver']\n\n        # Set to True if the data or header is replaced, indicating that\n        # update_header should be called\n        self._modified = False\n\n        if data is DELAYED:\n            if (not do_not_scale_image_data and\n                    (self._bscale != 1 or self._bzero != 0)):\n                # This indicates that when the data is accessed or written out\n                # to a new file it will need to be rescaled\n                self._data_needs_rescale = True\n            return\n        else:\n            # Setting data will update the header and set _bitpix, _bzero,\n            # and _bscale to the appropriate BITPIX for the data, and always\n            # sets _bzero=0 and _bscale=1.\n            self.data = data\n\n            # Check again for BITPIX/BSCALE/BZERO in case they changed when the\n            # data was assigned. This can happen, for example, if the input\n            # data is an unsigned int numpy array.\n            self._bitpix = self._header.get('BITPIX')\n\n            # Do not provide default values for BZERO and BSCALE here because\n            # the keywords will have been deleted in the header if appropriate\n            # after scaling. We do not want to put them back in if they\n            # should not be there.\n            self._bzero = self._header.get('BZERO')\n            self._bscale = self._header.get('BSCALE')\n\n        # Handle case where there was no BZERO/BSCALE in the initial header\n        # but there should be a BSCALE/BZERO now that the data has been set.\n        if not bzero_in_header:\n            self._orig_bzero = self._bzero\n        if not bscale_in_header:\n            self._orig_bscale = self._bscale"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy`.\n    ","endLoc":71,"id":818,"nodeType":"Class","startLoc":44,"text":"class Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy`.\n    \"\"\"\n\n    unicode_output = _config.ConfigItem(\n        False,\n        'When True, use Unicode characters when outputting values, and '\n        'displaying widgets at the console.')\n    use_color = _config.ConfigItem(\n        sys.platform != 'win32',\n        'When True, use ANSI color escape sequences when writing to the console.',\n        aliases=['astropy.utils.console.USE_COLOR', 'astropy.logger.USE_COLOR'])\n    max_lines = _config.ConfigItem(\n        None,\n        description='Maximum number of lines in the display of pretty-printed '\n        'objects. If not provided, try to determine automatically from the '\n        'terminal size.  Negative numbers mean no limit.',\n        cfgtype='integer(default=None)',\n        aliases=['astropy.table.pprint.max_lines'])\n    max_width = _config.ConfigItem(\n        None,\n        description='Maximum number of characters per line in the display of '\n        'pretty-printed objects.  If not provided, try to determine '\n        'automatically from the terminal size. Negative numbers mean no '\n        'limit.',\n        cfgtype='integer(default=None)',\n        aliases=['astropy.table.pprint.max_width'])"},{"col":0,"comment":"Import the on-disk file specified by filename to the cache.\n\n    The provided ``url_key`` will be the name used in the cache. The file\n    should contain the contents of this URL, at least notionally (the URL may\n    be temporarily or permanently unavailable). It is using ``url_key`` that\n    users will request these contents from the cache. See :func:`download_file` for\n    details.\n\n    If ``url_key`` already exists in the cache, it will be updated to point to\n    these imported contents, and its old contents will be deleted from the\n    cache.\n\n    Parameters\n    ----------\n    url_key : str\n        The key to index the file under. This should probably be\n        the URL where the file was located, though if you obtained\n        it from a mirror you should use the URL of the primary\n        location.\n    filename : str\n        The file whose contents you want to import.\n    remove_original : bool\n        Whether to remove the original file (``filename``) once import is\n        complete.\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n    replace : boolean, optional\n        Whether or not to replace an existing object in the cache, if one exists.\n        If replacement is not requested but the object exists, silently pass.\n    ","endLoc":1957,"header":"def import_file_to_cache(url_key, filename,\n                         remove_original=False,\n                         pkgname='astropy',\n                         *,\n                         replace=True)","id":819,"name":"import_file_to_cache","nodeType":"Function","startLoc":1893,"text":"def import_file_to_cache(url_key, filename,\n                         remove_original=False,\n                         pkgname='astropy',\n                         *,\n                         replace=True):\n    \"\"\"Import the on-disk file specified by filename to the cache.\n\n    The provided ``url_key`` will be the name used in the cache. The file\n    should contain the contents of this URL, at least notionally (the URL may\n    be temporarily or permanently unavailable). It is using ``url_key`` that\n    users will request these contents from the cache. See :func:`download_file` for\n    details.\n\n    If ``url_key`` already exists in the cache, it will be updated to point to\n    these imported contents, and its old contents will be deleted from the\n    cache.\n\n    Parameters\n    ----------\n    url_key : str\n        The key to index the file under. This should probably be\n        the URL where the file was located, though if you obtained\n        it from a mirror you should use the URL of the primary\n        location.\n    filename : str\n        The file whose contents you want to import.\n    remove_original : bool\n        Whether to remove the original file (``filename``) once import is\n        complete.\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n    replace : boolean, optional\n        Whether or not to replace an existing object in the cache, if one exists.\n        If replacement is not requested but the object exists, silently pass.\n    \"\"\"\n    cache_dir = _get_download_cache_loc(pkgname=pkgname)\n    cache_dirname = _url_to_dirname(url_key)\n    local_dirname = os.path.join(cache_dir, cache_dirname)\n    local_filename = os.path.join(local_dirname, \"contents\")\n    with _SafeTemporaryDirectory(prefix=\"temp_dir\", dir=cache_dir) as temp_dir:\n        temp_filename = os.path.join(temp_dir, \"contents\")\n        # Make sure we're on the same filesystem\n        # This will raise an exception if the url_key doesn't turn into a valid filename\n        shutil.copy(filename, temp_filename)\n        with open(os.path.join(temp_dir, \"url\"), \"wt\", encoding=\"utf-8\") as f:\n            f.write(url_key)\n        if replace:\n            _rmtree(local_dirname, replace=temp_dir)\n        else:\n            try:\n                os.rename(temp_dir, local_dirname)\n            except FileExistsError:\n                # already there, fine\n                pass\n            except OSError as e:\n                if e.errno == errno.ENOTEMPTY:\n                    # already there, fine\n                    pass\n                else:\n                    raise\n    if remove_original:\n        os.remove(filename)\n    return os.path.abspath(local_filename)"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":49,"id":820,"name":"unicode_output","nodeType":"Attribute","startLoc":49,"text":"unicode_output"},{"col":4,"comment":"null","endLoc":925,"header":"def __init__(self, data=None, header=None, name=None, ver=None, **kwargs)","id":821,"name":"__init__","nodeType":"Function","startLoc":905,"text":"def __init__(self, data=None, header=None, name=None, ver=None, **kwargs):\n        super().__init__(data=data, header=header)\n\n        if (header is not None and\n                not isinstance(header, (Header, _BasicHeader))):\n            # TODO: Instead maybe try initializing a new Header object from\n            # whatever is passed in as the header--there are various types\n            # of objects that could work for this...\n            raise ValueError('header must be a Header object')\n\n        # NOTE:  private data members _checksum and _datasum are used by the\n        # utility script \"fitscheck\" to detect missing checksums.\n        self._checksum = None\n        self._checksum_valid = None\n        self._datasum = None\n        self._datasum_valid = None\n\n        if name is not None:\n            self.name = name\n        if ver is not None:\n            self.ver = ver"},{"col":4,"comment":"\n        A list with `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` elements giving information\n        on constructing high-level objects for the world coordinates.\n\n        Each element of the list is a tuple with three items:\n\n        * The first is a name for the world object this world array\n          corresponds to, which *must* match the string names used in\n          `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_classes`. Note that names might\n          appear twice because two world arrays might correspond to a single\n          world object (e.g. a celestial coordinate might have both “ra” and\n          “dec” arrays, which correspond to a single sky coordinate object).\n\n        * The second element is either a string keyword argument name or a\n          positional index for the corresponding class from\n          `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_classes`.\n\n        * The third argument is a string giving the name of the property\n          to access on the corresponding class from\n          `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_classes` in\n          order to get numerical values. Alternatively, this argument can be a\n          callable Python object that takes a high-level coordinate object and\n          returns the numerical values suitable for passing to the low-level\n          WCS transformation methods.\n\n        See the document\n        `APE 14: A shared Python interface for World Coordinate Systems\n        <https://doi.org/10.5281/zenodo.1188875>`_ for examples.\n        ","endLoc":164,"header":"@property\n    @abc.abstractmethod\n    def world_axis_object_components(self)","id":822,"name":"world_axis_object_components","nodeType":"Function","startLoc":133,"text":"@property\n    @abc.abstractmethod\n    def world_axis_object_components(self):\n        \"\"\"\n        A list with `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` elements giving information\n        on constructing high-level objects for the world coordinates.\n\n        Each element of the list is a tuple with three items:\n\n        * The first is a name for the world object this world array\n          corresponds to, which *must* match the string names used in\n          `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_classes`. Note that names might\n          appear twice because two world arrays might correspond to a single\n          world object (e.g. a celestial coordinate might have both “ra” and\n          “dec” arrays, which correspond to a single sky coordinate object).\n\n        * The second element is either a string keyword argument name or a\n          positional index for the corresponding class from\n          `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_classes`.\n\n        * The third argument is a string giving the name of the property\n          to access on the corresponding class from\n          `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_classes` in\n          order to get numerical values. Alternatively, this argument can be a\n          callable Python object that takes a high-level coordinate object and\n          returns the numerical values suitable for passing to the low-level\n          WCS transformation methods.\n\n        See the document\n        `APE 14: A shared Python interface for World Coordinate Systems\n        <https://doi.org/10.5281/zenodo.1188875>`_ for examples.\n        \"\"\""},{"col":4,"comment":"\n        A dictionary giving information on constructing high-level objects for\n        the world coordinates.\n\n        Each key of the dictionary is a string key from\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_components`, and each value is a\n        tuple with three elements or four elements:\n\n        * The first element of the tuple must be a class or a string specifying\n          the fully-qualified name of a class, which will specify the actual\n          Python object to be created.\n\n        * The second element, should be a tuple specifying the positional\n          arguments required to initialize the class. If\n          `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_components` specifies that the\n          world coordinates should be passed as a positional argument, this this\n          tuple should include `None` placeholders for the world coordinates.\n\n        * The third tuple element must be a dictionary with the keyword\n          arguments required to initialize the class.\n\n        * Optionally, for advanced use cases, the fourth element (if present)\n          should be a callable Python object that gets called instead of the\n          class and gets passed the positional and keyword arguments. It should\n          return an object of the type of the first element in the tuple.\n\n        Note that we don't require the classes to be Astropy classes since there\n        is no guarantee that Astropy will have all the classes to represent all\n        kinds of world coordinates. Furthermore, we recommend that the output be\n        kept as human-readable as possible.\n\n        The classes used here should have the ability to do conversions by\n        passing an instance as the first argument to the same class with\n        different arguments (e.g. ``Time(Time(...), scale='tai')``). This is\n        a requirement for the implementation of the high-level interface.\n\n        The second and third tuple elements for each value of this dictionary\n        can in turn contain either instances of classes, or if necessary can\n        contain serialized versions that should take the same form as the main\n        classes described above (a tuple with three elements with the fully\n        qualified name of the class, then the positional arguments and the\n        keyword arguments). For low-level API objects implemented in Python, we\n        recommend simply returning the actual objects (not the serialized form)\n        for optimal performance. Implementations should either always or never\n        use serialized classes to represent Python objects, and should indicate\n        which of these they follow using the\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.serialized_classes` attribute.\n\n        See the document\n        `APE 14: A shared Python interface for World Coordinate Systems\n        <https://doi.org/10.5281/zenodo.1188875>`_ for examples .\n        ","endLoc":220,"header":"@property\n    @abc.abstractmethod\n    def world_axis_object_classes(self)","id":823,"name":"world_axis_object_classes","nodeType":"Function","startLoc":166,"text":"@property\n    @abc.abstractmethod\n    def world_axis_object_classes(self):\n        \"\"\"\n        A dictionary giving information on constructing high-level objects for\n        the world coordinates.\n\n        Each key of the dictionary is a string key from\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_components`, and each value is a\n        tuple with three elements or four elements:\n\n        * The first element of the tuple must be a class or a string specifying\n          the fully-qualified name of a class, which will specify the actual\n          Python object to be created.\n\n        * The second element, should be a tuple specifying the positional\n          arguments required to initialize the class. If\n          `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_components` specifies that the\n          world coordinates should be passed as a positional argument, this this\n          tuple should include `None` placeholders for the world coordinates.\n\n        * The third tuple element must be a dictionary with the keyword\n          arguments required to initialize the class.\n\n        * Optionally, for advanced use cases, the fourth element (if present)\n          should be a callable Python object that gets called instead of the\n          class and gets passed the positional and keyword arguments. It should\n          return an object of the type of the first element in the tuple.\n\n        Note that we don't require the classes to be Astropy classes since there\n        is no guarantee that Astropy will have all the classes to represent all\n        kinds of world coordinates. Furthermore, we recommend that the output be\n        kept as human-readable as possible.\n\n        The classes used here should have the ability to do conversions by\n        passing an instance as the first argument to the same class with\n        different arguments (e.g. ``Time(Time(...), scale='tai')``). This is\n        a requirement for the implementation of the high-level interface.\n\n        The second and third tuple elements for each value of this dictionary\n        can in turn contain either instances of classes, or if necessary can\n        contain serialized versions that should take the same form as the main\n        classes described above (a tuple with three elements with the fully\n        qualified name of the class, then the positional arguments and the\n        keyword arguments). For low-level API objects implemented in Python, we\n        recommend simply returning the actual objects (not the serialized form)\n        for optimal performance. Implementations should either always or never\n        use serialized classes to represent Python objects, and should indicate\n        which of these they follow using the\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.serialized_classes` attribute.\n\n        See the document\n        `APE 14: A shared Python interface for World Coordinate Systems\n        <https://doi.org/10.5281/zenodo.1188875>`_ for examples .\n        \"\"\""},{"col":4,"comment":"\n        The shape of the data that the WCS applies to as a tuple of length\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` in ``(row, column)``\n        order (the convention for arrays in Python).\n\n        If the WCS is valid in the context of a dataset with a particular\n        shape, then this property can be used to store the shape of the\n        data. This can be used for example if implementing slicing of WCS\n        objects. This is an optional property, and it should return `None`\n        if a shape is not known or relevant.\n        ","endLoc":241,"header":"@property\n    def array_shape(self)","id":824,"name":"array_shape","nodeType":"Function","startLoc":225,"text":"@property\n    def array_shape(self):\n        \"\"\"\n        The shape of the data that the WCS applies to as a tuple of length\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` in ``(row, column)``\n        order (the convention for arrays in Python).\n\n        If the WCS is valid in the context of a dataset with a particular\n        shape, then this property can be used to store the shape of the\n        data. This can be used for example if implementing slicing of WCS\n        objects. This is an optional property, and it should return `None`\n        if a shape is not known or relevant.\n        \"\"\"\n        if self.pixel_shape is None:\n            return None\n        else:\n            return self.pixel_shape[::-1]"},{"col":4,"comment":"\n        The shape of the data that the WCS applies to as a tuple of length\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` in ``(x, y)``\n        order (where for an image, ``x`` is the horizontal coordinate and ``y``\n        is the vertical coordinate).\n\n        If the WCS is valid in the context of a dataset with a particular\n        shape, then this property can be used to store the shape of the\n        data. This can be used for example if implementing slicing of WCS\n        objects. This is an optional property, and it should return `None`\n        if a shape is not known or relevant.\n\n        If you are interested in getting a shape that is comparable to that of\n        a Numpy array, you should use\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.array_shape` instead.\n        ","endLoc":261,"header":"@property\n    def pixel_shape(self)","id":825,"name":"pixel_shape","nodeType":"Function","startLoc":243,"text":"@property\n    def pixel_shape(self):\n        \"\"\"\n        The shape of the data that the WCS applies to as a tuple of length\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` in ``(x, y)``\n        order (where for an image, ``x`` is the horizontal coordinate and ``y``\n        is the vertical coordinate).\n\n        If the WCS is valid in the context of a dataset with a particular\n        shape, then this property can be used to store the shape of the\n        data. This can be used for example if implementing slicing of WCS\n        objects. This is an optional property, and it should return `None`\n        if a shape is not known or relevant.\n\n        If you are interested in getting a shape that is comparable to that of\n        a Numpy array, you should use\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.array_shape` instead.\n        \"\"\"\n        return None"},{"col":4,"comment":"\n        The bounds (in pixel coordinates) inside which the WCS is defined,\n        as a list with `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim`\n        ``(min, max)`` tuples.\n\n        The bounds should be given in ``[(xmin, xmax), (ymin, ymax)]``\n        order. WCS solutions are sometimes only guaranteed to be accurate\n        within a certain range of pixel values, for example when defining a\n        WCS that includes fitted distortions. This is an optional property,\n        and it should return `None` if a shape is not known or relevant.\n        ","endLoc":276,"header":"@property\n    def pixel_bounds(self)","id":826,"name":"pixel_bounds","nodeType":"Function","startLoc":263,"text":"@property\n    def pixel_bounds(self):\n        \"\"\"\n        The bounds (in pixel coordinates) inside which the WCS is defined,\n        as a list with `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim`\n        ``(min, max)`` tuples.\n\n        The bounds should be given in ``[(xmin, xmax), (ymin, ymax)]``\n        order. WCS solutions are sometimes only guaranteed to be accurate\n        within a certain range of pixel values, for example when defining a\n        WCS that includes fitted distortions. This is an optional property,\n        and it should return `None` if a shape is not known or relevant.\n        \"\"\"\n        return None"},{"col":4,"comment":"\n        An iterable of strings describing the name for each pixel axis.\n\n        If an axis does not have a name, an empty string should be returned\n        (this is the default behavior for all axes if a subclass does not\n        override this property). Note that these names are just for display\n        purposes and are not standardized.\n        ","endLoc":288,"header":"@property\n    def pixel_axis_names(self)","id":827,"name":"pixel_axis_names","nodeType":"Function","startLoc":278,"text":"@property\n    def pixel_axis_names(self):\n        \"\"\"\n        An iterable of strings describing the name for each pixel axis.\n\n        If an axis does not have a name, an empty string should be returned\n        (this is the default behavior for all axes if a subclass does not\n        override this property). Note that these names are just for display\n        purposes and are not standardized.\n        \"\"\"\n        return [''] * self.pixel_n_dim"},{"col":4,"comment":"\n        An iterable of strings describing the name for each world axis.\n\n        If an axis does not have a name, an empty string should be returned\n        (this is the default behavior for all axes if a subclass does not\n        override this property). Note that these names are just for display\n        purposes and are not standardized. For standardized axis types, see\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_physical_types`.\n        ","endLoc":301,"header":"@property\n    def world_axis_names(self)","id":828,"name":"world_axis_names","nodeType":"Function","startLoc":290,"text":"@property\n    def world_axis_names(self):\n        \"\"\"\n        An iterable of strings describing the name for each world axis.\n\n        If an axis does not have a name, an empty string should be returned\n        (this is the default behavior for all axes if a subclass does not\n        override this property). Note that these names are just for display\n        purposes and are not standardized. For standardized axis types, see\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_physical_types`.\n        \"\"\"\n        return [''] * self.world_n_dim"},{"col":4,"comment":"\n        Returns an (`~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim`,\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim`) matrix that\n        indicates using booleans whether a given world coordinate depends on a\n        given pixel coordinate.\n\n        This defaults to a matrix where all elements are `True` in the absence\n        of any further information. For completely independent axes, the\n        diagonal would be `True` and all other entries `False`.\n        ","endLoc":315,"header":"@property\n    def axis_correlation_matrix(self)","id":829,"name":"axis_correlation_matrix","nodeType":"Function","startLoc":303,"text":"@property\n    def axis_correlation_matrix(self):\n        \"\"\"\n        Returns an (`~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim`,\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim`) matrix that\n        indicates using booleans whether a given world coordinate depends on a\n        given pixel coordinate.\n\n        This defaults to a matrix where all elements are `True` in the absence\n        of any further information. For completely independent axes, the\n        diagonal would be `True` and all other entries `False`.\n        \"\"\"\n        return np.ones((self.world_n_dim, self.pixel_n_dim), dtype=bool)"},{"col":4,"comment":"\n        Indicates whether Python objects are given in serialized form or as\n        actual Python objects.\n        ","endLoc":323,"header":"@property\n    def serialized_classes(self)","id":830,"name":"serialized_classes","nodeType":"Function","startLoc":317,"text":"@property\n    def serialized_classes(self):\n        \"\"\"\n        Indicates whether Python objects are given in serialized form or as\n        actual Python objects.\n        \"\"\"\n        return False"},{"col":4,"comment":"\n        Compatibility hook for Matplotlib and WCSAxes. With this method, one can\n        do::\n\n            from astropy.wcs import WCS\n            import matplotlib.pyplot as plt\n            wcs = WCS('filename.fits')\n            fig = plt.figure()\n            ax = fig.add_axes([0.15, 0.1, 0.8, 0.8], projection=wcs)\n            ...\n\n        and this will generate a plot with the correct WCS coordinates on the\n        axes.\n        ","endLoc":341,"header":"def _as_mpl_axes(self)","id":831,"name":"_as_mpl_axes","nodeType":"Function","startLoc":325,"text":"def _as_mpl_axes(self):\n        \"\"\"\n        Compatibility hook for Matplotlib and WCSAxes. With this method, one can\n        do::\n\n            from astropy.wcs import WCS\n            import matplotlib.pyplot as plt\n            wcs = WCS('filename.fits')\n            fig = plt.figure()\n            ax = fig.add_axes([0.15, 0.1, 0.8, 0.8], projection=wcs)\n            ...\n\n        and this will generate a plot with the correct WCS coordinates on the\n        axes.\n        \"\"\"\n        from astropy.visualization.wcsaxes import WCSAxes\n        return WCSAxes, {'wcs': self}"},{"className":"HighLevelWCSMixin","col":0,"comment":"\n    Mix-in class that automatically provides the high-level WCS API for the\n    low-level WCS object given by the `~HighLevelWCSMixin.low_level_wcs`\n    property.\n    ","endLoc":329,"id":832,"nodeType":"Class","startLoc":296,"text":"class HighLevelWCSMixin(BaseHighLevelWCS):\n    \"\"\"\n    Mix-in class that automatically provides the high-level WCS API for the\n    low-level WCS object given by the `~HighLevelWCSMixin.low_level_wcs`\n    property.\n    \"\"\"\n\n    @property\n    def low_level_wcs(self):\n        return self\n\n    def world_to_pixel(self, *world_objects):\n\n        world_values = high_level_objects_to_values(*world_objects, low_level_wcs=self.low_level_wcs)\n\n        # Finally we convert to pixel coordinates\n        pixel_values = self.low_level_wcs.world_to_pixel_values(*world_values)\n\n        return pixel_values\n\n    def pixel_to_world(self, *pixel_arrays):\n\n        # Compute the world coordinate values\n        world_values = self.low_level_wcs.pixel_to_world_values(*pixel_arrays)\n\n        if self.world_n_dim == 1:\n            world_values = (world_values,)\n\n        pixel_values = values_to_high_level_objects(*world_values, low_level_wcs=self.low_level_wcs)\n\n        if len(pixel_values) == 1:\n            return pixel_values[0]\n        else:\n            return pixel_values"},{"col":0,"comment":"\n    Determines the package configuration directory name and creates the\n    directory if it doesn't exist.\n\n    This directory is typically ``$HOME/.astropy/config``, but if the\n    XDG_CONFIG_HOME environment variable is set and the\n    ``$XDG_CONFIG_HOME/astropy`` directory exists, it will be that directory.\n    If neither exists, the former will be created and symlinked to the latter.\n\n    Parameters\n    ----------\n    rootname : str\n        Name of the root configuration directory. For example, if ``rootname =\n        'pkgname'``, the configuration directory would be ``<home>/.pkgname/``\n        rather than ``<home>/.astropy`` (depending on platform).\n\n    Returns\n    -------\n    configdir : str\n        The absolute path to the configuration directory.\n\n    ","endLoc":121,"header":"def get_config_dir(rootname='astropy')","id":833,"name":"get_config_dir","nodeType":"Function","startLoc":76,"text":"def get_config_dir(rootname='astropy'):\n    \"\"\"\n    Determines the package configuration directory name and creates the\n    directory if it doesn't exist.\n\n    This directory is typically ``$HOME/.astropy/config``, but if the\n    XDG_CONFIG_HOME environment variable is set and the\n    ``$XDG_CONFIG_HOME/astropy`` directory exists, it will be that directory.\n    If neither exists, the former will be created and symlinked to the latter.\n\n    Parameters\n    ----------\n    rootname : str\n        Name of the root configuration directory. For example, if ``rootname =\n        'pkgname'``, the configuration directory would be ``<home>/.pkgname/``\n        rather than ``<home>/.astropy`` (depending on platform).\n\n    Returns\n    -------\n    configdir : str\n        The absolute path to the configuration directory.\n\n    \"\"\"\n\n    # symlink will be set to this if the directory is created\n    linkto = None\n\n    # If using set_temp_config, that overrides all\n    if set_temp_config._temp_path is not None:\n        xch = set_temp_config._temp_path\n        config_path = os.path.join(xch, rootname)\n        if not os.path.exists(config_path):\n            os.mkdir(config_path)\n        return os.path.abspath(config_path)\n\n    # first look for XDG_CONFIG_HOME\n    xch = os.environ.get('XDG_CONFIG_HOME')\n\n    if xch is not None and os.path.exists(xch):\n        xchpth = os.path.join(xch, rootname)\n        if not os.path.islink(xchpth):\n            if os.path.exists(xchpth):\n                return os.path.abspath(xchpth)\n            else:\n                linkto = xchpth\n    return os.path.abspath(_find_or_create_root_dir('config', linkto, rootname))"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":53,"id":834,"name":"use_color","nodeType":"Attribute","startLoc":53,"text":"use_color"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":57,"id":835,"name":"max_lines","nodeType":"Attribute","startLoc":57,"text":"max_lines"},{"col":0,"comment":"Temporary directory context manager\n\n    This will not raise an exception if the temporary directory goes away\n    before it's supposed to be deleted. Specifically, what is deleted will\n    be the directory *name* produced; if no such directory exists, no\n    exception will be raised.\n\n    It would be safer to delete it only if it's really the same directory\n    - checked by file descriptor - and if it's still called the same thing.\n    But that opens a platform-specific can of worms.\n\n    It would also be more robust to use ExitStack and TemporaryDirectory,\n    which is more aggressive about removing readonly things.\n    ","endLoc":1863,"header":"@contextlib.contextmanager\ndef _SafeTemporaryDirectory(suffix=None, prefix=None, dir=None)","id":836,"name":"_SafeTemporaryDirectory","nodeType":"Function","startLoc":1840,"text":"@contextlib.contextmanager\ndef _SafeTemporaryDirectory(suffix=None, prefix=None, dir=None):\n    \"\"\"Temporary directory context manager\n\n    This will not raise an exception if the temporary directory goes away\n    before it's supposed to be deleted. Specifically, what is deleted will\n    be the directory *name* produced; if no such directory exists, no\n    exception will be raised.\n\n    It would be safer to delete it only if it's really the same directory\n    - checked by file descriptor - and if it's still called the same thing.\n    But that opens a platform-specific can of worms.\n\n    It would also be more robust to use ExitStack and TemporaryDirectory,\n    which is more aggressive about removing readonly things.\n    \"\"\"\n    d = mkdtemp(suffix=suffix, prefix=prefix, dir=dir)\n    try:\n        yield d\n    finally:\n        try:\n            shutil.rmtree(d)\n        except OSError:\n            pass"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":64,"id":837,"name":"max_width","nodeType":"Attribute","startLoc":64,"text":"max_width"},{"className":"base_constants_version","col":0,"comment":"\n    Base class for the real version-setters below\n    ","endLoc":106,"id":838,"nodeType":"Class","startLoc":81,"text":"class base_constants_version(ScienceState):\n    \"\"\"\n    Base class for the real version-setters below\n    \"\"\"\n    _value = 'test'\n\n    _versions = dict(test='test')\n\n    @classmethod\n    def validate(cls, value):\n        if value not in cls._versions:\n            raise ValueError(f'Must be one of {list(cls._versions.keys())}')\n        return cls._versions[value]\n\n    @classmethod\n    def set(cls, value):\n        \"\"\"\n        Set the current constants value.\n        \"\"\"\n        import sys\n        if 'astropy.units' in sys.modules:\n            raise RuntimeError('astropy.units is already imported')\n        if 'astropy.constants' in sys.modules:\n            raise RuntimeError('astropy.constants is already imported')\n\n        return super().set(value)"},{"col":4,"comment":"null","endLoc":93,"header":"@classmethod\n    def validate(cls, value)","id":839,"name":"validate","nodeType":"Function","startLoc":89,"text":"@classmethod\n    def validate(cls, value):\n        if value not in cls._versions:\n            raise ValueError(f'Must be one of {list(cls._versions.keys())}')\n        return cls._versions[value]"},{"col":4,"comment":"\n        Set the current constants value.\n        ","endLoc":106,"header":"@classmethod\n    def set(cls, value)","id":840,"name":"set","nodeType":"Function","startLoc":95,"text":"@classmethod\n    def set(cls, value):\n        \"\"\"\n        Set the current constants value.\n        \"\"\"\n        import sys\n        if 'astropy.units' in sys.modules:\n            raise RuntimeError('astropy.units is already imported')\n        if 'astropy.constants' in sys.modules:\n            raise RuntimeError('astropy.constants is already imported')\n\n        return super().set(value)"},{"attributeType":"None","col":4,"comment":"null","endLoc":175,"id":841,"name":"_showwarning_orig","nodeType":"Attribute","startLoc":175,"text":"_showwarning_orig"},{"attributeType":"None","col":4,"comment":"null","endLoc":251,"id":842,"name":"_excepthook_orig","nodeType":"Attribute","startLoc":251,"text":"_excepthook_orig"},{"attributeType":"null","col":4,"comment":"null","endLoc":85,"id":843,"name":"_value","nodeType":"Attribute","startLoc":85,"text":"_value"},{"attributeType":"function","col":8,"comment":"null","endLoc":230,"id":844,"name":"_showwarning_orig","nodeType":"Attribute","startLoc":230,"text":"self._showwarning_orig"},{"attributeType":"null","col":4,"comment":"null","endLoc":87,"id":845,"name":"_versions","nodeType":"Attribute","startLoc":87,"text":"_versions"},{"attributeType":"function","col":12,"comment":"null","endLoc":313,"id":846,"name":"_excepthook_orig","nodeType":"Attribute","startLoc":313,"text":"self._excepthook_orig"},{"className":"StreamHandler","col":0,"comment":"\n    A specialized StreamHandler that logs INFO and DEBUG messages to\n    stdout, and all other messages to stderr.  Also provides coloring\n    of the output, if enabled in the parent logger.\n    ","endLoc":559,"id":847,"nodeType":"Class","startLoc":528,"text":"class StreamHandler(logging.StreamHandler):\n    \"\"\"\n    A specialized StreamHandler that logs INFO and DEBUG messages to\n    stdout, and all other messages to stderr.  Also provides coloring\n    of the output, if enabled in the parent logger.\n    \"\"\"\n\n    def emit(self, record):\n        '''\n        The formatter for stderr\n        '''\n        if record.levelno <= logging.INFO:\n            stream = sys.stdout\n        else:\n            stream = sys.stderr\n\n        if record.levelno < logging.DEBUG or not _conf.use_color:\n            print(record.levelname, end='', file=stream)\n        else:\n            # Import utils.console only if necessary and at the latest because\n            # the import takes a significant time [#4649]\n            from .utils.console import color_print\n            if record.levelno < logging.INFO:\n                color_print(record.levelname, 'magenta', end='', file=stream)\n            elif record.levelno < logging.WARN:\n                color_print(record.levelname, 'green', end='', file=stream)\n            elif record.levelno < logging.ERROR:\n                color_print(record.levelname, 'brown', end='', file=stream)\n            else:\n                color_print(record.levelname, 'red', end='', file=stream)\n        record.message = f\"{record.msg} [{record.origin:s}]\"\n        print(\": \" + record.message, file=stream)"},{"className":"physical_constants","col":0,"comment":"\n    The version of physical constants to use\n    ","endLoc":118,"id":848,"nodeType":"Class","startLoc":109,"text":"class physical_constants(base_constants_version):\n    \"\"\"\n    The version of physical constants to use\n    \"\"\"\n    # Maintainers: update when new constants are added\n    _value = 'codata2018'\n\n    _versions = dict(codata2018='codata2018', codata2014='codata2014',\n                     codata2010='codata2010', astropyconst40='codata2018',\n                     astropyconst20='codata2014', astropyconst13='codata2010')"},{"col":4,"comment":"\n        The formatter for stderr\n        ","endLoc":559,"header":"def emit(self, record)","id":849,"name":"emit","nodeType":"Function","startLoc":535,"text":"def emit(self, record):\n        '''\n        The formatter for stderr\n        '''\n        if record.levelno <= logging.INFO:\n            stream = sys.stdout\n        else:\n            stream = sys.stderr\n\n        if record.levelno < logging.DEBUG or not _conf.use_color:\n            print(record.levelname, end='', file=stream)\n        else:\n            # Import utils.console only if necessary and at the latest because\n            # the import takes a significant time [#4649]\n            from .utils.console import color_print\n            if record.levelno < logging.INFO:\n                color_print(record.levelname, 'magenta', end='', file=stream)\n            elif record.levelno < logging.WARN:\n                color_print(record.levelname, 'green', end='', file=stream)\n            elif record.levelno < logging.ERROR:\n                color_print(record.levelname, 'brown', end='', file=stream)\n            else:\n                color_print(record.levelname, 'red', end='', file=stream)\n        record.message = f\"{record.msg} [{record.origin:s}]\"\n        print(\": \" + record.message, file=stream)"},{"col":4,"comment":"\n        Given the keyword arguments used to initialize a Column, specifically\n        those that typically read from a FITS header (so excluding array),\n        verify that each keyword has a valid value.\n\n        Returns a 2-tuple of dicts.  The first maps valid keywords to their\n        values.  The second maps invalid keywords to a 2-tuple of their value,\n        and a message explaining why they were found invalid.\n        ","endLoc":1198,"header":"@classmethod\n    def _verify_keywords(cls, name=None, format=None, unit=None, null=None,\n                         bscale=None, bzero=None, disp=None, start=None,\n                         dim=None, ascii=None, coord_type=None, coord_unit=None,\n                         coord_ref_point=None, coord_ref_value=None,\n                         coord_inc=None, time_ref_pos=None)","id":850,"name":"_verify_keywords","nodeType":"Function","startLoc":951,"text":"@classmethod\n    def _verify_keywords(cls, name=None, format=None, unit=None, null=None,\n                         bscale=None, bzero=None, disp=None, start=None,\n                         dim=None, ascii=None, coord_type=None, coord_unit=None,\n                         coord_ref_point=None, coord_ref_value=None,\n                         coord_inc=None, time_ref_pos=None):\n        \"\"\"\n        Given the keyword arguments used to initialize a Column, specifically\n        those that typically read from a FITS header (so excluding array),\n        verify that each keyword has a valid value.\n\n        Returns a 2-tuple of dicts.  The first maps valid keywords to their\n        values.  The second maps invalid keywords to a 2-tuple of their value,\n        and a message explaining why they were found invalid.\n        \"\"\"\n\n        valid = {}\n        invalid = {}\n\n        try:\n            format, recformat = cls._determine_formats(format, start, dim, ascii)\n            valid.update(format=format, recformat=recformat)\n        except (ValueError, VerifyError) as err:\n            msg = (\n                f'Column format option (TFORMn) failed verification: {err!s} '\n                'The invalid value will be ignored for the purpose of '\n                'formatting the data in this column.')\n            invalid['format'] = (format, msg)\n        except AttributeError as err:\n            msg = (\n                f'Column format option (TFORMn) must be a string with a valid '\n                f'FITS table format (got {format!s}: {err!s}). '\n                'The invalid value will be ignored for the purpose of '\n                'formatting the data in this column.')\n            invalid['format'] = (format, msg)\n\n        # Currently we don't have any validation for name, unit, bscale, or\n        # bzero so include those by default\n        # TODO: Add validation for these keywords, obviously\n        for k, v in [('name', name), ('unit', unit), ('bscale', bscale),\n                     ('bzero', bzero)]:\n            if v is not None and v != '':\n                valid[k] = v\n\n        # Validate null option\n        # Note: Enough code exists that thinks empty strings are sensible\n        # inputs for these options that we need to treat '' as None\n        if null is not None and null != '':\n            msg = None\n            if isinstance(format, _AsciiColumnFormat):\n                null = str(null)\n                if len(null) > format.width:\n                    msg = (\n                        \"ASCII table null option (TNULLn) is longer than \"\n                        \"the column's character width and will be truncated \"\n                        \"(got {!r}).\".format(null))\n            else:\n                tnull_formats = ('B', 'I', 'J', 'K')\n\n                if not _is_int(null):\n                    # Make this an exception instead of a warning, since any\n                    # non-int value is meaningless\n                    msg = (\n                        'Column null option (TNULLn) must be an integer for '\n                        'binary table columns (got {!r}).  The invalid value '\n                        'will be ignored for the purpose of formatting '\n                        'the data in this column.'.format(null))\n\n                elif not (format.format in tnull_formats or\n                          (format.format in ('P', 'Q') and\n                           format.p_format in tnull_formats)):\n                    # TODO: We should also check that TNULLn's integer value\n                    # is in the range allowed by the column's format\n                    msg = (\n                        'Column null option (TNULLn) is invalid for binary '\n                        'table columns of type {!r} (got {!r}).  The invalid '\n                        'value will be ignored for the purpose of formatting '\n                        'the data in this column.'.format(format, null))\n\n            if msg is None:\n                valid['null'] = null\n            else:\n                invalid['null'] = (null, msg)\n\n        # Validate the disp option\n        # TODO: Add full parsing and validation of TDISPn keywords\n        if disp is not None and disp != '':\n            msg = None\n            if not isinstance(disp, str):\n                msg = (\n                    f'Column disp option (TDISPn) must be a string (got '\n                    f'{disp!r}). The invalid value will be ignored for the '\n                    'purpose of formatting the data in this column.')\n\n            elif (isinstance(format, _AsciiColumnFormat) and\n                    disp[0].upper() == 'L'):\n                # disp is at least one character long and has the 'L' format\n                # which is not recognized for ASCII tables\n                msg = (\n                    \"Column disp option (TDISPn) may not use the 'L' format \"\n                    \"with ASCII table columns.  The invalid value will be \"\n                    \"ignored for the purpose of formatting the data in this \"\n                    \"column.\")\n\n            if msg is None:\n                try:\n                    _parse_tdisp_format(disp)\n                    valid['disp'] = disp\n                except VerifyError as err:\n                    msg = (\n                        f'Column disp option (TDISPn) failed verification: '\n                        f'{err!s} The invalid value will be ignored for the '\n                        'purpose of formatting the data in this column.')\n                    invalid['disp'] = (disp, msg)\n            else:\n                invalid['disp'] = (disp, msg)\n\n        # Validate the start option\n        if start is not None and start != '':\n            msg = None\n            if not isinstance(format, _AsciiColumnFormat):\n                # The 'start' option only applies to ASCII columns\n                msg = (\n                    'Column start option (TBCOLn) is not allowed for binary '\n                    'table columns (got {!r}).  The invalid keyword will be '\n                    'ignored for the purpose of formatting the data in this '\n                    'column.'.format(start))\n            else:\n                try:\n                    start = int(start)\n                except (TypeError, ValueError):\n                    pass\n\n                if not _is_int(start) or start < 1:\n                    msg = (\n                        'Column start option (TBCOLn) must be a positive integer '\n                        '(got {!r}).  The invalid value will be ignored for the '\n                        'purpose of formatting the data in this column.'.format(start))\n\n            if msg is None:\n                valid['start'] = start\n            else:\n                invalid['start'] = (start, msg)\n\n        # Process TDIMn options\n        # ASCII table columns can't have a TDIMn keyword associated with it;\n        # for now we just issue a warning and ignore it.\n        # TODO: This should be checked by the FITS verification code\n        if dim is not None and dim != '':\n            msg = None\n            dims_tuple = tuple()\n            # NOTE: If valid, the dim keyword's value in the the valid dict is\n            # a tuple, not the original string; if invalid just the original\n            # string is returned\n            if isinstance(format, _AsciiColumnFormat):\n                msg = (\n                    'Column dim option (TDIMn) is not allowed for ASCII table '\n                    'columns (got {!r}).  The invalid keyword will be ignored '\n                    'for the purpose of formatting this column.'.format(dim))\n\n            elif isinstance(dim, str):\n                dims_tuple = _parse_tdim(dim)\n            elif isinstance(dim, tuple):\n                dims_tuple = dim\n            else:\n                msg = (\n                    \"`dim` argument must be a string containing a valid value \"\n                    \"for the TDIMn header keyword associated with this column, \"\n                    \"or a tuple containing the C-order dimensions for the \"\n                    \"column.  The invalid value will be ignored for the purpose \"\n                    \"of formatting this column.\")\n\n            if dims_tuple:\n                if reduce(operator.mul, dims_tuple) > format.repeat:\n                    msg = (\n                        \"The repeat count of the column format {!r} for column {!r} \"\n                        \"is fewer than the number of elements per the TDIM \"\n                        \"argument {!r}.  The invalid TDIMn value will be ignored \"\n                        \"for the purpose of formatting this column.\".format(\n                            name, format, dim))\n\n            if msg is None:\n                valid['dim'] = dims_tuple\n            else:\n                invalid['dim'] = (dim, msg)\n\n        if coord_type is not None and coord_type != '':\n            msg = None\n            if not isinstance(coord_type, str):\n                msg = (\n                    \"Coordinate/axis type option (TCTYPn) must be a string \"\n                    \"(got {!r}). The invalid keyword will be ignored for the \"\n                    \"purpose of formatting this column.\".format(coord_type))\n            elif len(coord_type) > 8:\n                msg = (\n                    \"Coordinate/axis type option (TCTYPn) must be a string \"\n                    \"of atmost 8 characters (got {!r}). The invalid keyword \"\n                    \"will be ignored for the purpose of formatting this \"\n                    \"column.\".format(coord_type))\n\n            if msg is None:\n                valid['coord_type'] = coord_type\n            else:\n                invalid['coord_type'] = (coord_type, msg)\n\n        if coord_unit is not None and coord_unit != '':\n            msg = None\n            if not isinstance(coord_unit, str):\n                msg = (\n                    \"Coordinate/axis unit option (TCUNIn) must be a string \"\n                    \"(got {!r}). The invalid keyword will be ignored for the \"\n                    \"purpose of formatting this column.\".format(coord_unit))\n\n            if msg is None:\n                valid['coord_unit'] = coord_unit\n            else:\n                invalid['coord_unit'] = (coord_unit, msg)\n\n        for k, v in [('coord_ref_point', coord_ref_point),\n                     ('coord_ref_value', coord_ref_value),\n                     ('coord_inc', coord_inc)]:\n            if v is not None and v != '':\n                msg = None\n                if not isinstance(v, numbers.Real):\n                    msg = (\n                        \"Column {} option ({}n) must be a real floating type (got {!r}). \"\n                        \"The invalid value will be ignored for the purpose of formatting \"\n                        \"the data in this column.\".format(k, ATTRIBUTE_TO_KEYWORD[k], v))\n\n                if msg is None:\n                    valid[k] = v\n                else:\n                    invalid[k] = (v, msg)\n\n        if time_ref_pos is not None and time_ref_pos != '':\n            msg = None\n            if not isinstance(time_ref_pos, str):\n                msg = (\n                    \"Time coordinate reference position option (TRPOSn) must be \"\n                    \"a string (got {!r}). The invalid keyword will be ignored for \"\n                    \"the purpose of formatting this column.\".format(time_ref_pos))\n\n            if msg is None:\n                valid['time_ref_pos'] = time_ref_pos\n            else:\n                invalid['time_ref_pos'] = (time_ref_pos, msg)\n\n        return valid, invalid"},{"attributeType":"null","col":4,"comment":"null","endLoc":114,"id":851,"name":"_value","nodeType":"Attribute","startLoc":114,"text":"_value"},{"col":0,"comment":"More-atomic rmtree. Ignores missing directory.","endLoc":1890,"header":"def _rmtree(path, replace=None)","id":852,"name":"_rmtree","nodeType":"Function","startLoc":1866,"text":"def _rmtree(path, replace=None):\n    \"\"\"More-atomic rmtree. Ignores missing directory.\"\"\"\n    with TemporaryDirectory(prefix=\"rmtree-\",\n                            dir=os.path.dirname(os.path.abspath(path))) as d:\n        try:\n            os.rename(path, os.path.join(d, \"to-zap\"))\n        except FileNotFoundError:\n            pass\n        except PermissionError:\n            warn(CacheMissingWarning(\n                f\"Unable to remove directory {path} because a file in it \"\n                f\"is in use and you are on Windows\", path))\n            raise\n        if replace is not None:\n            try:\n                os.rename(replace, path)\n            except FileExistsError:\n                # already there, fine\n                pass\n            except OSError as e:\n                if e.errno == errno.ENOTEMPTY:\n                    # already there, fine\n                    pass\n                else:\n                    raise"},{"attributeType":"null","col":4,"comment":"null","endLoc":116,"id":853,"name":"_versions","nodeType":"Attribute","startLoc":116,"text":"_versions"},{"className":"astronomical_constants","col":0,"comment":"\n    The version of astronomical constants to use\n    ","endLoc":130,"id":854,"nodeType":"Class","startLoc":121,"text":"class astronomical_constants(base_constants_version):\n    \"\"\"\n    The version of astronomical constants to use\n    \"\"\"\n    # Maintainers: update when new constants are added\n    _value = 'iau2015'\n\n    _versions = dict(iau2015='iau2015', iau2012='iau2012',\n                     astropyconst40='iau2015', astropyconst20='iau2015',\n                     astropyconst13='iau2012')"},{"className":"FilterOrigin","col":0,"comment":"A filter for the record origin","endLoc":569,"id":855,"nodeType":"Class","startLoc":562,"text":"class FilterOrigin:\n    '''A filter for the record origin'''\n\n    def __init__(self, origin):\n        self.origin = origin\n\n    def filter(self, record):\n        return record.origin.startswith(self.origin)"},{"attributeType":"null","col":4,"comment":"null","endLoc":126,"id":856,"name":"_value","nodeType":"Attribute","startLoc":126,"text":"_value"},{"attributeType":"null","col":4,"comment":"null","endLoc":128,"id":857,"name":"_versions","nodeType":"Attribute","startLoc":128,"text":"_versions"},{"col":0,"comment":"\n    Returns whether the source for this module is directly in an astropy\n    source distribution or checkout.\n    ","endLoc":30,"header":"def _is_astropy_source(path=None)","id":858,"name":"_is_astropy_source","nodeType":"Function","startLoc":15,"text":"def _is_astropy_source(path=None):\n    \"\"\"\n    Returns whether the source for this module is directly in an astropy\n    source distribution or checkout.\n    \"\"\"\n\n    # If this __init__.py file is in ./astropy/ then import is within a source\n    # dir .astropy-root is a file distributed with the source, but that should\n    # not installed\n    if path is None:\n        path = os.path.join(os.path.dirname(__file__), os.pardir)\n    elif os.path.isfile(path):\n        path = os.path.dirname(path)\n\n    source_dir = os.path.abspath(path)\n    return os.path.exists(os.path.join(source_dir, '.astropy-root'))"},{"col":4,"comment":"null","endLoc":569,"header":"def filter(self, record)","id":859,"name":"filter","nodeType":"Function","startLoc":568,"text":"def filter(self, record):\n        return record.origin.startswith(self.origin)"},{"col":0,"comment":"null","endLoc":155,"header":"def _initialize_astropy()","id":860,"name":"_initialize_astropy","nodeType":"Function","startLoc":141,"text":"def _initialize_astropy():\n    try:\n        from .utils import _compiler  # noqa: F401\n    except ImportError:\n        if _is_astropy_source():\n            raise ImportError('You appear to be trying to import astropy from '\n                              'within a source checkout or from an editable '\n                              'installation without building the extension '\n                              'modules first. Either run:\\n\\n'\n                              '  pip install -e .\\n\\nor\\n\\n'\n                              '  python setup.py build_ext --inplace\\n\\n'\n                              'to make sure the extension modules are built ')\n        else:\n            # Outright broken installation, just raise standard error\n            raise"},{"attributeType":"null","col":8,"comment":"null","endLoc":566,"id":861,"name":"origin","nodeType":"Attribute","startLoc":566,"text":"self.origin"},{"className":"ListHandler","col":0,"comment":"A handler that can be used to capture the records in a list","endLoc":580,"id":862,"nodeType":"Class","startLoc":572,"text":"class ListHandler(logging.Handler):\n    '''A handler that can be used to capture the records in a list'''\n\n    def __init__(self, filter_level=None, filter_origin=None):\n        logging.Handler.__init__(self)\n        self.log_list = []\n\n    def emit(self, record):\n        self.log_list.append(record)"},{"col":4,"comment":"null","endLoc":580,"header":"def emit(self, record)","id":863,"name":"emit","nodeType":"Function","startLoc":579,"text":"def emit(self, record):\n        self.log_list.append(record)"},{"col":0,"comment":"null","endLoc":167,"header":"def _get_bibtex()","id":864,"name":"_get_bibtex","nodeType":"Function","startLoc":159,"text":"def _get_bibtex():\n    citation_file = os.path.join(os.path.dirname(__file__), 'CITATION')\n\n    with open(citation_file, 'r') as citation:\n        refs = citation.read().split('@ARTICLE')[1:]\n        if len(refs) == 0:\n            return ''\n        bibtexreference = f'@ARTICLE{refs[0]}'\n    return bibtexreference"},{"className":"BaseHighLevelWCS","col":0,"comment":"\n    Abstract base class for the high-level WCS interface.\n\n    This is described in `APE 14: A shared Python interface for World Coordinate\n    Systems <https://doi.org/10.5281/zenodo.1188875>`_.\n    ","endLoc":117,"id":865,"nodeType":"Class","startLoc":46,"text":"class BaseHighLevelWCS(metaclass=abc.ABCMeta):\n    \"\"\"\n    Abstract base class for the high-level WCS interface.\n\n    This is described in `APE 14: A shared Python interface for World Coordinate\n    Systems <https://doi.org/10.5281/zenodo.1188875>`_.\n    \"\"\"\n\n    @property\n    @abc.abstractmethod\n    def low_level_wcs(self):\n        \"\"\"\n        Returns a reference to the underlying low-level WCS object.\n        \"\"\"\n\n    @abc.abstractmethod\n    def pixel_to_world(self, *pixel_arrays):\n        \"\"\"\n        Convert pixel coordinates to world coordinates (represented by\n        high-level objects).\n\n        If a single high-level object is used to represent the world coordinates\n        (i.e., if ``len(wcs.world_axis_object_classes) == 1``), it is returned\n        as-is (not in a tuple/list), otherwise a tuple of high-level objects is\n        returned. See\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values` for pixel\n        indexing and ordering conventions.\n        \"\"\"\n\n    def array_index_to_world(self, *index_arrays):\n        \"\"\"\n        Convert array indices to world coordinates (represented by Astropy\n        objects).\n\n        If a single high-level object is used to represent the world coordinates\n        (i.e., if ``len(wcs.world_axis_object_classes) == 1``), it is returned\n        as-is (not in a tuple/list), otherwise a tuple of high-level objects is\n        returned. See\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.array_index_to_world_values` for\n        pixel indexing and ordering conventions.\n        \"\"\"\n        return self.pixel_to_world(*index_arrays[::-1])\n\n    @abc.abstractmethod\n    def world_to_pixel(self, *world_objects):\n        \"\"\"\n        Convert world coordinates (represented by Astropy objects) to pixel\n        coordinates.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned. See\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_to_pixel_values` for pixel\n        indexing and ordering conventions.\n        \"\"\"\n\n    def world_to_array_index(self, *world_objects):\n        \"\"\"\n        Convert world coordinates (represented by Astropy objects) to array\n        indices.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned. See\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_to_array_index_values` for\n        pixel indexing and ordering conventions. The indices should be returned\n        as rounded integers.\n        \"\"\"\n        if self.pixel_n_dim == 1:\n            return _toindex(self.world_to_pixel(*world_objects))\n        else:\n            return tuple(_toindex(self.world_to_pixel(*world_objects)[::-1]).tolist())"},{"col":4,"comment":"\n        Returns a reference to the underlying low-level WCS object.\n        ","endLoc":59,"header":"@property\n    @abc.abstractmethod\n    def low_level_wcs(self)","id":866,"name":"low_level_wcs","nodeType":"Function","startLoc":54,"text":"@property\n    @abc.abstractmethod\n    def low_level_wcs(self):\n        \"\"\"\n        Returns a reference to the underlying low-level WCS object.\n        \"\"\""},{"col":4,"comment":"\n        Convert pixel coordinates to world coordinates (represented by\n        high-level objects).\n\n        If a single high-level object is used to represent the world coordinates\n        (i.e., if ``len(wcs.world_axis_object_classes) == 1``), it is returned\n        as-is (not in a tuple/list), otherwise a tuple of high-level objects is\n        returned. See\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values` for pixel\n        indexing and ordering conventions.\n        ","endLoc":73,"header":"@abc.abstractmethod\n    def pixel_to_world(self, *pixel_arrays)","id":867,"name":"pixel_to_world","nodeType":"Function","startLoc":61,"text":"@abc.abstractmethod\n    def pixel_to_world(self, *pixel_arrays):\n        \"\"\"\n        Convert pixel coordinates to world coordinates (represented by\n        high-level objects).\n\n        If a single high-level object is used to represent the world coordinates\n        (i.e., if ``len(wcs.world_axis_object_classes) == 1``), it is returned\n        as-is (not in a tuple/list), otherwise a tuple of high-level objects is\n        returned. See\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values` for pixel\n        indexing and ordering conventions.\n        \"\"\""},{"col":4,"comment":"\n        Given a format string and whether or not the Column is for an\n        ASCII table (ascii=None means unspecified, but lean toward binary table\n        where ambiguous) create an appropriate _BaseColumnFormat instance for\n        the column's format, and determine the appropriate recarray format.\n\n        The values of the start and dim keyword arguments are also useful, as\n        the former is only valid for ASCII tables and the latter only for\n        BINARY tables.\n        ","endLoc":1235,"header":"@classmethod\n    def _determine_formats(cls, format, start, dim, ascii)","id":868,"name":"_determine_formats","nodeType":"Function","startLoc":1200,"text":"@classmethod\n    def _determine_formats(cls, format, start, dim, ascii):\n        \"\"\"\n        Given a format string and whether or not the Column is for an\n        ASCII table (ascii=None means unspecified, but lean toward binary table\n        where ambiguous) create an appropriate _BaseColumnFormat instance for\n        the column's format, and determine the appropriate recarray format.\n\n        The values of the start and dim keyword arguments are also useful, as\n        the former is only valid for ASCII tables and the latter only for\n        BINARY tables.\n        \"\"\"\n\n        # If the given format string is unambiguously a Numpy dtype or one of\n        # the Numpy record format type specifiers supported by Astropy then that\n        # should take priority--otherwise assume it is a FITS format\n        if isinstance(format, np.dtype):\n            format, _, _ = _dtype_to_recformat(format)\n\n        # check format\n        if ascii is None and not isinstance(format, _BaseColumnFormat):\n            # We're just give a string which could be either a Numpy format\n            # code, or a format for a binary column array *or* a format for an\n            # ASCII column array--there may be many ambiguities here.  Try our\n            # best to guess what the user intended.\n            format, recformat = cls._guess_format(format, start, dim)\n        elif not ascii and not isinstance(format, _BaseColumnFormat):\n            format, recformat = cls._convert_format(format, _ColumnFormat)\n        elif ascii and not isinstance(format, _AsciiColumnFormat):\n            format, recformat = cls._convert_format(format,\n                                                    _AsciiColumnFormat)\n        else:\n            # The format is already acceptable and unambiguous\n            recformat = format.recformat\n\n        return format, recformat"},{"col":0,"comment":"\n    Utility function for converting a dtype object or string that instantiates\n    a dtype (e.g. 'float32') into one of the two character Numpy format codes\n    that have been traditionally used by Astropy.\n\n    In particular, use of 'a' to refer to character data is long since\n    deprecated in Numpy, but Astropy remains heavily invested in its use\n    (something to try to get away from sooner rather than later).\n    ","endLoc":2426,"header":"def _dtype_to_recformat(dtype)","id":869,"name":"_dtype_to_recformat","nodeType":"Function","startLoc":2404,"text":"def _dtype_to_recformat(dtype):\n    \"\"\"\n    Utility function for converting a dtype object or string that instantiates\n    a dtype (e.g. 'float32') into one of the two character Numpy format codes\n    that have been traditionally used by Astropy.\n\n    In particular, use of 'a' to refer to character data is long since\n    deprecated in Numpy, but Astropy remains heavily invested in its use\n    (something to try to get away from sooner rather than later).\n    \"\"\"\n\n    if not isinstance(dtype, np.dtype):\n        dtype = np.dtype(dtype)\n\n    kind = dtype.base.kind\n\n    if kind in ('U', 'S'):\n        recformat = kind = 'a'\n    else:\n        itemsize = dtype.base.itemsize\n        recformat = kind + str(itemsize)\n\n    return recformat, kind, dtype"},{"attributeType":"null","col":8,"comment":"null","endLoc":577,"id":870,"name":"log_list","nodeType":"Attribute","startLoc":577,"text":"self.log_list"},{"attributeType":"null","col":24,"comment":"null","endLoc":18,"id":871,"name":"_config","nodeType":"Attribute","startLoc":18,"text":"_config"},{"attributeType":"null","col":22,"comment":"null","endLoc":19,"id":872,"name":"_conf","nodeType":"Attribute","startLoc":19,"text":"_conf"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":873,"name":"__all__","nodeType":"Attribute","startLoc":23,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":874,"name":"logging_levels","nodeType":"Attribute","startLoc":27,"text":"logging_levels"},{"attributeType":"null","col":4,"comment":"null","endLoc":29,"id":875,"name":"level","nodeType":"Attribute","startLoc":29,"text":"level"},{"col":0,"comment":"\n    Search the online Astropy documentation for the given query.\n    Opens the results in the default web browser.  Requires an active\n    Internet connection.\n\n    Parameters\n    ----------\n    query : str\n        The search query.\n    ","endLoc":202,"header":"def online_help(query)","id":876,"name":"online_help","nodeType":"Function","startLoc":181,"text":"def online_help(query):\n    \"\"\"\n    Search the online Astropy documentation for the given query.\n    Opens the results in the default web browser.  Requires an active\n    Internet connection.\n\n    Parameters\n    ----------\n    query : str\n        The search query.\n    \"\"\"\n    import webbrowser\n    from urllib.parse import urlencode\n\n    version = __version__\n    if 'dev' in version:\n        version = 'latest'\n    else:\n        version = 'v' + version\n\n    url = f\"https://docs.astropy.org/en/{version}/search.html?{urlencode({'q': query})}\"\n    webbrowser.open(url)"},{"attributeType":"None","col":0,"comment":"null","endLoc":35,"id":877,"name":"log","nodeType":"Attribute","startLoc":35,"text":"log"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":94,"id":878,"name":"conf","nodeType":"Attribute","startLoc":94,"text":"conf"},{"attributeType":"null","col":0,"comment":"null","endLoc":147,"id":879,"name":"Logger","nodeType":"Attribute","startLoc":147,"text":"Logger"},{"col":0,"comment":"","endLoc":9,"header":"logger.py#<anonymous>","id":880,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"This module defines a logging class based on the built-in logging module.\n\n.. note::\n\n    This module is meant for internal ``astropy`` usage. For use in other\n    packages, we recommend implementing your own logger instead.\n\n\"\"\"\n\n__all__ = ['Conf', 'conf', 'log', 'AstropyLogger', 'LoggingError']\n\nlogging_levels = ['NOTSET', 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL',\n                  'FATAL', ]\n\nfor level in logging_levels:\n    globals()[level] = getattr(logging, level)\n\n__all__ += logging_levels\n\nlog = None\n\nconf = Conf()\n\nLogger = logging.getLoggerClass()"},{"col":4,"comment":"null","endLoc":1278,"header":"@classmethod\n    def _guess_format(cls, format, start, dim)","id":881,"name":"_guess_format","nodeType":"Function","startLoc":1237,"text":"@classmethod\n    def _guess_format(cls, format, start, dim):\n        if start and dim:\n            # This is impossible; this can't be a valid FITS column\n            raise ValueError(\n                'Columns cannot have both a start (TCOLn) and dim '\n                '(TDIMn) option, since the former is only applies to '\n                'ASCII tables, and the latter is only valid for binary '\n                'tables.')\n        elif start:\n            # Only ASCII table columns can have a 'start' option\n            guess_format = _AsciiColumnFormat\n        elif dim:\n            # Only binary tables can have a dim option\n            guess_format = _ColumnFormat\n        else:\n            # If the format is *technically* a valid binary column format\n            # (i.e. it has a valid format code followed by arbitrary\n            # \"optional\" codes), but it is also strictly a valid ASCII\n            # table format, then assume an ASCII table column was being\n            # requested (the more likely case, after all).\n            with suppress(VerifyError):\n                format = _AsciiColumnFormat(format, strict=True)\n\n            # A safe guess which reflects the existing behavior of previous\n            # Astropy versions\n            guess_format = _ColumnFormat\n\n        try:\n            format, recformat = cls._convert_format(format, guess_format)\n        except VerifyError:\n            # For whatever reason our guess was wrong (for example if we got\n            # just 'F' that's not a valid binary format, but it an ASCII format\n            # code albeit with the width/precision omitted\n            guess_format = (_AsciiColumnFormat\n                            if guess_format is _ColumnFormat\n                            else _ColumnFormat)\n            # If this fails too we're out of options--it is truly an invalid\n            # format, or at least not supported\n            format, recformat = cls._convert_format(format, guess_format)\n\n        return format, recformat"},{"fileName":"file.py","filePath":"astropy/io/fits","id":882,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport gzip\nimport errno\nimport http.client\nimport mmap\nimport operator\nimport io\nimport os\nimport sys\nimport tempfile\nimport warnings\nimport zipfile\nimport re\n\nfrom functools import reduce\n\nimport numpy as np\n\nfrom .util import (isreadable, iswritable, isfile, fileobj_open, fileobj_name,\n                   fileobj_closed, fileobj_mode, _array_from_file,\n                   _array_to_file, _write_string)\nfrom astropy.utils.data import download_file, _is_url\nfrom astropy.utils.decorators import classproperty\nfrom astropy.utils.exceptions import AstropyUserWarning\nfrom astropy.utils.misc import NOT_OVERWRITING_MSG\n\n# NOTE: Python can be built without bz2.\nfrom astropy.utils.compat.optional_deps import HAS_BZ2\nif HAS_BZ2:\n    import bz2\n\n\n# Maps astropy.io.fits-specific file mode names to the appropriate file\n# modes to use for the underlying raw files.\nIO_FITS_MODES = {\n    'readonly': 'rb',\n    'copyonwrite': 'rb',\n    'update': 'rb+',\n    'append': 'ab+',\n    'ostream': 'wb',\n    'denywrite': 'rb'}\n\n# Maps OS-level file modes to the appropriate astropy.io.fits specific mode\n# to use when given file objects but no mode specified; obviously in\n# IO_FITS_MODES there are overlaps; for example 'readonly' and 'denywrite'\n# both require the file to be opened in 'rb' mode.  But 'readonly' is the\n# default behavior for such files if not otherwise specified.\n# Note: 'ab' is only supported for 'ostream' which is output-only.\nFILE_MODES = {\n    'rb': 'readonly', 'rb+': 'update',\n    'wb': 'ostream', 'wb+': 'update',\n    'ab': 'ostream', 'ab+': 'append'}\n\n# A match indicates the file was opened in text mode, which is not allowed\nTEXT_RE = re.compile(r'^[rwa]((t?\\+?)|(\\+?t?))$')\n\n\n# readonly actually uses copyonwrite for mmap so that readonly without mmap and\n# with mmap still have to same behavior with regard to updating the array.  To\n# get a truly readonly mmap use denywrite\n# the name 'denywrite' comes from a deprecated flag to mmap() on Linux--it\n# should be clarified that 'denywrite' mode is not directly analogous to the\n# use of that flag; it was just taken, for lack of anything better, as a name\n# that means something like \"read only\" but isn't readonly.\nMEMMAP_MODES = {'readonly': mmap.ACCESS_COPY,\n                'copyonwrite': mmap.ACCESS_COPY,\n                'update': mmap.ACCESS_WRITE,\n                'append': mmap.ACCESS_COPY,\n                'denywrite': mmap.ACCESS_READ}\n\n# TODO: Eventually raise a warning, and maybe even later disable the use of\n# 'copyonwrite' and 'denywrite' modes unless memmap=True.  For now, however,\n# that would generate too many warnings for too many users.  If nothing else,\n# wait until the new logging system is in place.\n\nGZIP_MAGIC = b'\\x1f\\x8b\\x08'\nPKZIP_MAGIC = b'\\x50\\x4b\\x03\\x04'\nBZIP2_MAGIC = b'\\x42\\x5a'\n\n\ndef _is_bz2file(fileobj):\n    if HAS_BZ2:\n        return isinstance(fileobj, bz2.BZ2File)\n    else:\n        return False\n\n\ndef _normalize_fits_mode(mode):\n    if mode is not None and mode not in IO_FITS_MODES:\n        if TEXT_RE.match(mode):\n            raise ValueError(\n                \"Text mode '{}' not supported: \"\n                \"files must be opened in binary mode\".format(mode))\n        new_mode = FILE_MODES.get(mode)\n        if new_mode not in IO_FITS_MODES:\n            raise ValueError(f\"Mode '{mode}' not recognized\")\n        mode = new_mode\n    return mode\n\n\nclass _File:\n    \"\"\"\n    Represents a FITS file on disk (or in some other file-like object).\n    \"\"\"\n\n    def __init__(self, fileobj=None, mode=None, memmap=None, overwrite=False,\n                 cache=True):\n        self.strict_memmap = bool(memmap)\n        memmap = True if memmap is None else memmap\n\n        self._file = None\n        self.closed = False\n        self.binary = True\n        self.mode = mode\n        self.memmap = memmap\n        self.compression = None\n        self.readonly = False\n        self.writeonly = False\n\n        # Should the object be closed on error: see\n        # https://github.com/astropy/astropy/issues/6168\n        self.close_on_error = False\n\n        # Holds mmap instance for files that use mmap\n        self._mmap = None\n\n        if fileobj is None:\n            self.simulateonly = True\n            return\n        else:\n            self.simulateonly = False\n            if isinstance(fileobj, os.PathLike):\n                fileobj = os.fspath(fileobj)\n\n        if mode is not None and mode not in IO_FITS_MODES:\n            raise ValueError(f\"Mode '{mode}' not recognized\")\n        if isfile(fileobj):\n            objmode = _normalize_fits_mode(fileobj_mode(fileobj))\n            if mode is not None and mode != objmode:\n                raise ValueError(\n                    \"Requested FITS mode '{}' not compatible with open file \"\n                    \"handle mode '{}'\".format(mode, objmode))\n            mode = objmode\n        if mode is None:\n            mode = 'readonly'\n\n        # Handle raw URLs\n        if (isinstance(fileobj, (str, bytes)) and\n                mode not in ('ostream', 'append', 'update') and _is_url(fileobj)):\n            self.name = download_file(fileobj, cache=cache)\n        # Handle responses from URL requests that have already been opened\n        elif isinstance(fileobj, http.client.HTTPResponse):\n            if mode in ('ostream', 'append', 'update'):\n                raise ValueError(\n                    f\"Mode {mode} not supported for HTTPResponse\")\n            fileobj = io.BytesIO(fileobj.read())\n        else:\n            self.name = fileobj_name(fileobj)\n\n        self.mode = mode\n\n        # Underlying fileobj is a file-like object, but an actual file object\n        self.file_like = False\n\n        # Initialize the internal self._file object\n        if isfile(fileobj):\n            self._open_fileobj(fileobj, mode, overwrite)\n        elif isinstance(fileobj, (str, bytes)):\n            self._open_filename(fileobj, mode, overwrite)\n        else:\n            self._open_filelike(fileobj, mode, overwrite)\n\n        self.fileobj_mode = fileobj_mode(self._file)\n\n        if isinstance(fileobj, gzip.GzipFile):\n            self.compression = 'gzip'\n        elif isinstance(fileobj, zipfile.ZipFile):\n            # Reading from zip files is supported but not writing (yet)\n            self.compression = 'zip'\n        elif _is_bz2file(fileobj):\n            self.compression = 'bzip2'\n\n        if (mode in ('readonly', 'copyonwrite', 'denywrite') or\n                (self.compression and mode == 'update')):\n            self.readonly = True\n        elif (mode == 'ostream' or\n                (self.compression and mode == 'append')):\n            self.writeonly = True\n\n        # For 'ab+' mode, the pointer is at the end after the open in\n        # Linux, but is at the beginning in Solaris.\n        if (mode == 'ostream' or self.compression or\n                not hasattr(self._file, 'seek')):\n            # For output stream start with a truncated file.\n            # For compressed files we can't really guess at the size\n            self.size = 0\n        else:\n            pos = self._file.tell()\n            self._file.seek(0, 2)\n            self.size = self._file.tell()\n            self._file.seek(pos)\n\n        if self.memmap:\n            if not isfile(self._file):\n                self.memmap = False\n            elif not self.readonly and not self._mmap_available:\n                # Test mmap.flush--see\n                # https://github.com/astropy/astropy/issues/968\n                self.memmap = False\n\n    def __repr__(self):\n        return f'<{self.__module__}.{self.__class__.__name__} {self._file}>'\n\n    # Support the 'with' statement\n    def __enter__(self):\n        return self\n\n    def __exit__(self, type, value, traceback):\n        self.close()\n\n    def readable(self):\n        if self.writeonly:\n            return False\n        return isreadable(self._file)\n\n    def read(self, size=None):\n        if not hasattr(self._file, 'read'):\n            raise EOFError\n        try:\n            return self._file.read(size)\n        except OSError:\n            # On some versions of Python, it appears, GzipFile will raise an\n            # OSError if you try to read past its end (as opposed to just\n            # returning '')\n            if self.compression == 'gzip':\n                return ''\n            raise\n\n    def readarray(self, size=None, offset=0, dtype=np.uint8, shape=None):\n        \"\"\"\n        Similar to file.read(), but returns the contents of the underlying\n        file as a numpy array (or mmap'd array if memmap=True) rather than a\n        string.\n\n        Usually it's best not to use the `size` argument with this method, but\n        it's provided for compatibility.\n        \"\"\"\n\n        if not hasattr(self._file, 'read'):\n            raise EOFError\n\n        if not isinstance(dtype, np.dtype):\n            dtype = np.dtype(dtype)\n\n        if size and size % dtype.itemsize != 0:\n            raise ValueError(f'size {size} not a multiple of {dtype}')\n\n        if isinstance(shape, int):\n            shape = (shape,)\n\n        if not (size or shape):\n            warnings.warn('No size or shape given to readarray(); assuming a '\n                          'shape of (1,)', AstropyUserWarning)\n            shape = (1,)\n\n        if size and not shape:\n            shape = (size // dtype.itemsize,)\n\n        if size and shape:\n            actualsize = np.prod(shape) * dtype.itemsize\n\n            if actualsize > size:\n                raise ValueError('size {} is too few bytes for a {} array of '\n                                 '{}'.format(size, shape, dtype))\n            elif actualsize < size:\n                raise ValueError('size {} is too many bytes for a {} array of '\n                                 '{}'.format(size, shape, dtype))\n\n        filepos = self._file.tell()\n\n        try:\n            if self.memmap:\n                if self._mmap is None:\n                    # Instantiate Memmap array of the file offset at 0 (so we\n                    # can return slices of it to offset anywhere else into the\n                    # file)\n                    access_mode = MEMMAP_MODES[self.mode]\n\n                    # For reasons unknown the file needs to point to (near)\n                    # the beginning or end of the file. No idea how close to\n                    # the beginning or end.\n                    # If I had to guess there is some bug in the mmap module\n                    # of CPython or perhaps in microsoft's underlying code\n                    # for generating the mmap.\n                    self._file.seek(0, 0)\n                    # This would also work:\n                    # self._file.seek(0, 2)   # moves to the end\n                    try:\n                        self._mmap = mmap.mmap(self._file.fileno(), 0,\n                                               access=access_mode,\n                                               offset=0)\n                    except OSError as exc:\n                        # NOTE: mode='readonly' results in the memory-mapping\n                        # using the ACCESS_COPY mode in mmap so that users can\n                        # modify arrays. However, on some systems, the OS raises\n                        # a '[Errno 12] Cannot allocate memory' OSError if the\n                        # address space is smaller than the file. The solution\n                        # is to open the file in mode='denywrite', which at\n                        # least allows the file to be opened even if the\n                        # resulting arrays will be truly read-only.\n                        if exc.errno == errno.ENOMEM and self.mode == 'readonly':\n                            warnings.warn(\"Could not memory map array with \"\n                                          \"mode='readonly', falling back to \"\n                                          \"mode='denywrite', which means that \"\n                                          \"the array will be read-only\",\n                                          AstropyUserWarning)\n                            self._mmap = mmap.mmap(self._file.fileno(), 0,\n                                                   access=MEMMAP_MODES['denywrite'],\n                                                   offset=0)\n                        else:\n                            raise\n\n                return np.ndarray(shape=shape, dtype=dtype, offset=offset,\n                                  buffer=self._mmap)\n            else:\n                count = reduce(operator.mul, shape)\n                self._file.seek(offset)\n                data = _array_from_file(self._file, dtype, count)\n                data.shape = shape\n                return data\n        finally:\n            # Make sure we leave the file in the position we found it; on\n            # some platforms (e.g. Windows) mmaping a file handle can also\n            # reset its file pointer\n            self._file.seek(filepos)\n\n    def writable(self):\n        if self.readonly:\n            return False\n        return iswritable(self._file)\n\n    def write(self, string):\n        if self.simulateonly:\n            return\n        if hasattr(self._file, 'write'):\n            _write_string(self._file, string)\n\n    def writearray(self, array):\n        \"\"\"\n        Similar to file.write(), but writes a numpy array instead of a string.\n\n        Also like file.write(), a flush() or close() may be needed before\n        the file on disk reflects the data written.\n        \"\"\"\n\n        if self.simulateonly:\n            return\n        if hasattr(self._file, 'write'):\n            _array_to_file(array, self._file)\n\n    def flush(self):\n        if self.simulateonly:\n            return\n        if hasattr(self._file, 'flush'):\n            self._file.flush()\n\n    def seek(self, offset, whence=0):\n        if not hasattr(self._file, 'seek'):\n            return\n        self._file.seek(offset, whence)\n        pos = self._file.tell()\n        if self.size and pos > self.size:\n            warnings.warn('File may have been truncated: actual file length '\n                          '({}) is smaller than the expected size ({})'\n                          .format(self.size, pos), AstropyUserWarning)\n\n    def tell(self):\n        if self.simulateonly:\n            raise OSError\n        if not hasattr(self._file, 'tell'):\n            raise EOFError\n        return self._file.tell()\n\n    def truncate(self, size=None):\n        if hasattr(self._file, 'truncate'):\n            self._file.truncate(size)\n\n    def close(self):\n        \"\"\"\n        Close the 'physical' FITS file.\n        \"\"\"\n\n        if hasattr(self._file, 'close'):\n            self._file.close()\n\n        self._maybe_close_mmap()\n        # Set self._memmap to None anyways since no new .data attributes can be\n        # loaded after the file is closed\n        self._mmap = None\n\n        self.closed = True\n        self.close_on_error = False\n\n    def _maybe_close_mmap(self, refcount_delta=0):\n        \"\"\"\n        When mmap is in use these objects hold a reference to the mmap of the\n        file (so there is only one, shared by all HDUs that reference this\n        file).\n\n        This will close the mmap if there are no arrays referencing it.\n        \"\"\"\n\n        if (self._mmap is not None and\n                sys.getrefcount(self._mmap) == 2 + refcount_delta):\n            self._mmap.close()\n            self._mmap = None\n\n    def _overwrite_existing(self, overwrite, fileobj, closed):\n        \"\"\"Overwrite an existing file if ``overwrite`` is ``True``, otherwise\n        raise an OSError.  The exact behavior of this method depends on the\n        _File object state and is only meant for use within the ``_open_*``\n        internal methods.\n        \"\"\"\n\n        # The file will be overwritten...\n        if ((self.file_like and hasattr(fileobj, 'len') and fileobj.len > 0) or\n                (os.path.exists(self.name) and os.path.getsize(self.name) != 0)):\n            if overwrite:\n                if self.file_like and hasattr(fileobj, 'truncate'):\n                    fileobj.truncate(0)\n                else:\n                    if not closed:\n                        fileobj.close()\n                    os.remove(self.name)\n            else:\n                raise OSError(NOT_OVERWRITING_MSG.format(self.name))\n\n    def _try_read_compressed(self, obj_or_name, magic, mode, ext=''):\n        \"\"\"Attempt to determine if the given file is compressed\"\"\"\n        is_ostream = mode == 'ostream'\n        if (is_ostream and ext == '.gz') or magic.startswith(GZIP_MAGIC):\n            if mode == 'append':\n                raise OSError(\"'append' mode is not supported with gzip files.\"\n                              \"Use 'update' mode instead\")\n            # Handle gzip files\n            kwargs = dict(mode=IO_FITS_MODES[mode])\n            if isinstance(obj_or_name, str):\n                kwargs['filename'] = obj_or_name\n            else:\n                kwargs['fileobj'] = obj_or_name\n            self._file = gzip.GzipFile(**kwargs)\n            self.compression = 'gzip'\n        elif (is_ostream and ext == '.zip') or magic.startswith(PKZIP_MAGIC):\n            # Handle zip files\n            self._open_zipfile(self.name, mode)\n            self.compression = 'zip'\n        elif (is_ostream and ext == '.bz2') or magic.startswith(BZIP2_MAGIC):\n            # Handle bzip2 files\n            if mode in ['update', 'append']:\n                raise OSError(\"update and append modes are not supported \"\n                              \"with bzip2 files\")\n            if not HAS_BZ2:\n                raise ModuleNotFoundError(\n                    \"This Python installation does not provide the bz2 module.\")\n            # bzip2 only supports 'w' and 'r' modes\n            bzip2_mode = 'w' if is_ostream else 'r'\n            self._file = bz2.BZ2File(obj_or_name, mode=bzip2_mode)\n            self.compression = 'bzip2'\n        return self.compression is not None\n\n    def _open_fileobj(self, fileobj, mode, overwrite):\n        \"\"\"Open a FITS file from a file object (including compressed files).\"\"\"\n\n        closed = fileobj_closed(fileobj)\n        # FIXME: this variable was unused, check if it was useful\n        # fmode = fileobj_mode(fileobj) or IO_FITS_MODES[mode]\n\n        if mode == 'ostream':\n            self._overwrite_existing(overwrite, fileobj, closed)\n\n        if not closed:\n            self._file = fileobj\n        elif isfile(fileobj):\n            self._file = fileobj_open(self.name, IO_FITS_MODES[mode])\n\n        # Attempt to determine if the file represented by the open file object\n        # is compressed\n        try:\n            # We need to account for the possibility that the underlying file\n            # handle may have been opened with either 'ab' or 'ab+', which\n            # means that the current file position is at the end of the file.\n            if mode in ['ostream', 'append']:\n                self._file.seek(0)\n            magic = self._file.read(4)\n            # No matter whether the underlying file was opened with 'ab' or\n            # 'ab+', we need to return to the beginning of the file in order\n            # to properly process the FITS header (and handle the possibility\n            # of a compressed file).\n            self._file.seek(0)\n        except OSError:\n            return\n\n        self._try_read_compressed(fileobj, magic, mode)\n\n    def _open_filelike(self, fileobj, mode, overwrite):\n        \"\"\"Open a FITS file from a file-like object, i.e. one that has\n        read and/or write methods.\n        \"\"\"\n\n        self.file_like = True\n        self._file = fileobj\n\n        if fileobj_closed(fileobj):\n            raise OSError(\"Cannot read from/write to a closed file-like \"\n                          \"object ({!r}).\".format(fileobj))\n\n        if isinstance(fileobj, zipfile.ZipFile):\n            self._open_zipfile(fileobj, mode)\n            # We can bypass any additional checks at this point since now\n            # self._file points to the temp file extracted from the zip\n            return\n\n        # If there is not seek or tell methods then set the mode to\n        # output streaming.\n        if (not hasattr(self._file, 'seek') or\n                not hasattr(self._file, 'tell')):\n            self.mode = mode = 'ostream'\n\n        if mode == 'ostream':\n            self._overwrite_existing(overwrite, fileobj, False)\n\n        # Any \"writeable\" mode requires a write() method on the file object\n        if (self.mode in ('update', 'append', 'ostream') and\n                not hasattr(self._file, 'write')):\n            raise OSError(\"File-like object does not have a 'write' \"\n                          \"method, required for mode '{}'.\".format(self.mode))\n\n        # Any mode except for 'ostream' requires readability\n        if self.mode != 'ostream' and not hasattr(self._file, 'read'):\n            raise OSError(\"File-like object does not have a 'read' \"\n                          \"method, required for mode {!r}.\".format(self.mode))\n\n    def _open_filename(self, filename, mode, overwrite):\n        \"\"\"Open a FITS file from a filename string.\"\"\"\n\n        if mode == 'ostream':\n            self._overwrite_existing(overwrite, None, True)\n\n        if os.path.exists(self.name):\n            with fileobj_open(self.name, 'rb') as f:\n                magic = f.read(4)\n        else:\n            magic = b''\n\n        ext = os.path.splitext(self.name)[1]\n\n        if not self._try_read_compressed(self.name, magic, mode, ext=ext):\n            self._file = fileobj_open(self.name, IO_FITS_MODES[mode])\n            self.close_on_error = True\n\n        # Make certain we're back at the beginning of the file\n        # BZ2File does not support seek when the file is open for writing, but\n        # when opening a file for write, bz2.BZ2File always truncates anyway.\n        if not (_is_bz2file(self._file) and mode == 'ostream'):\n            self._file.seek(0)\n\n    @classproperty(lazy=True)\n    def _mmap_available(cls):\n        \"\"\"Tests that mmap, and specifically mmap.flush works.  This may\n        be the case on some uncommon platforms (see\n        https://github.com/astropy/astropy/issues/968).\n\n        If mmap.flush is found not to work, ``self.memmap = False`` is\n        set and a warning is issued.\n        \"\"\"\n\n        tmpfd, tmpname = tempfile.mkstemp()\n        try:\n            # Windows does not allow mappings on empty files\n            os.write(tmpfd, b' ')\n            os.fsync(tmpfd)\n            try:\n                mm = mmap.mmap(tmpfd, 1, access=mmap.ACCESS_WRITE)\n            except OSError as exc:\n                warnings.warn('Failed to create mmap: {}; mmap use will be '\n                              'disabled'.format(str(exc)), AstropyUserWarning)\n                del exc\n                return False\n            try:\n                mm.flush()\n            except OSError:\n                warnings.warn('mmap.flush is unavailable on this platform; '\n                              'using mmap in writeable mode will be disabled',\n                              AstropyUserWarning)\n                return False\n            finally:\n                mm.close()\n        finally:\n            os.close(tmpfd)\n            os.remove(tmpname)\n\n        return True\n\n    def _open_zipfile(self, fileobj, mode):\n        \"\"\"Limited support for zipfile.ZipFile objects containing a single\n        a file.  Allows reading only for now by extracting the file to a\n        tempfile.\n        \"\"\"\n\n        if mode in ('update', 'append'):\n            raise OSError(\n                  \"Writing to zipped fits files is not currently \"\n                  \"supported\")\n\n        if not isinstance(fileobj, zipfile.ZipFile):\n            zfile = zipfile.ZipFile(fileobj)\n            close = True\n        else:\n            zfile = fileobj\n            close = False\n\n        namelist = zfile.namelist()\n        if len(namelist) != 1:\n            raise OSError(\n              \"Zip files with multiple members are not supported.\")\n        self._file = tempfile.NamedTemporaryFile(suffix='.fits')\n        self._file.write(zfile.read(namelist[0]))\n\n        if close:\n            zfile.close()\n        # We just wrote the contents of the first file in the archive to a new\n        # temp file, which now serves as our underlying file object. So it's\n        # necessary to reset the position back to the beginning\n        self._file.seek(0)\n"},{"col":0,"comment":"\n    Returns the 'name' of file-like object *f*, if it has anything that could be\n    called its name.  Otherwise f's class or type is returned.  If f is a\n    string f itself is returned.\n    ","endLoc":416,"header":"def fileobj_name(f)","id":883,"name":"fileobj_name","nodeType":"Function","startLoc":391,"text":"def fileobj_name(f):\n    \"\"\"\n    Returns the 'name' of file-like object *f*, if it has anything that could be\n    called its name.  Otherwise f's class or type is returned.  If f is a\n    string f itself is returned.\n    \"\"\"\n\n    if isinstance(f, (str, bytes)):\n        return f\n    elif isinstance(f, gzip.GzipFile):\n        # The .name attribute on GzipFiles does not always represent the name\n        # of the file being read/written--it can also represent the original\n        # name of the file being compressed\n        # See the documentation at\n        # https://docs.python.org/3/library/gzip.html#gzip.GzipFile\n        # As such, for gzip files only return the name of the underlying\n        # fileobj, if it exists\n        return fileobj_name(f.fileobj)\n    elif hasattr(f, 'name'):\n        return f.name\n    elif hasattr(f, 'filename'):\n        return f.filename\n    elif hasattr(f, '__class__'):\n        return str(f.__class__)\n    else:\n        return str(type(f))"},{"col":0,"comment":"\n    Returns True if the file-like object can be read from.  This is a common-\n    sense approximation of io.IOBase.readable.\n    ","endLoc":333,"header":"def isreadable(f)","id":884,"name":"isreadable","nodeType":"Function","startLoc":312,"text":"def isreadable(f):\n    \"\"\"\n    Returns True if the file-like object can be read from.  This is a common-\n    sense approximation of io.IOBase.readable.\n    \"\"\"\n\n    if hasattr(f, 'readable'):\n        return f.readable()\n\n    if hasattr(f, 'closed') and f.closed:\n        # This mimics the behavior of io.IOBase.readable\n        raise ValueError('I/O operation on closed file')\n\n    if not hasattr(f, 'read'):\n        return False\n\n    if hasattr(f, 'mode') and not any(c in f.mode for c in 'r+'):\n        return False\n\n    # Not closed, has a 'read()' method, and either has no known mode or a\n    # readable mode--should be good enough to assume 'readable'\n    return True"},{"attributeType":"null","col":4,"comment":"null","endLoc":36,"id":885,"name":"online_docs_root","nodeType":"Attribute","startLoc":36,"text":"online_docs_root"},{"attributeType":"null","col":4,"comment":"null","endLoc":38,"id":886,"name":"online_docs_root","nodeType":"Attribute","startLoc":38,"text":"online_docs_root"},{"col":4,"comment":"null","endLoc":330,"header":"def __new__(cls, format, strict=False)","id":887,"name":"__new__","nodeType":"Function","startLoc":318,"text":"def __new__(cls, format, strict=False):\n        self = super().__new__(cls, format)\n        self.format, self.width, self.precision = \\\n            _parse_ascii_tformat(format, strict)\n\n        # If no width has been specified, set the dtype here to default as well\n        if format == self.format:\n            self.recformat = ASCII2NUMPY[format]\n\n        # This is to support handling logical (boolean) data from binary tables\n        # in an ASCII table\n        self._pseudo_logical = False\n        return self"},{"attributeType":"null","col":0,"comment":"null","endLoc":136,"id":888,"name":"test","nodeType":"Attribute","startLoc":136,"text":"test"},{"col":0,"comment":"\n    Returns True if the file-like object can be written to.  This is a common-\n    sense approximation of io.IOBase.writable.\n    ","endLoc":357,"header":"def iswritable(f)","id":889,"name":"iswritable","nodeType":"Function","startLoc":336,"text":"def iswritable(f):\n    \"\"\"\n    Returns True if the file-like object can be written to.  This is a common-\n    sense approximation of io.IOBase.writable.\n    \"\"\"\n\n    if hasattr(f, 'writable'):\n        return f.writable()\n\n    if hasattr(f, 'closed') and f.closed:\n        # This mimics the behavior of io.IOBase.writable\n        raise ValueError('I/O operation on closed file')\n\n    if not hasattr(f, 'write'):\n        return False\n\n    if hasattr(f, 'mode') and not any(c in f.mode for c in 'wa+'):\n        return False\n\n    # Note closed, has a 'write()' method, and either has no known mode or a\n    # mode that supports writing--should be good enough to assume 'writable'\n    return True"},{"col":0,"comment":"\n    Parse the ``TFORMn`` keywords for ASCII tables into a ``(format, width,\n    precision)`` tuple (the latter is always zero unless format is one of 'E',\n    'F', or 'D').\n    ","endLoc":2268,"header":"def _parse_ascii_tformat(tform, strict=False)","id":890,"name":"_parse_ascii_tformat","nodeType":"Function","startLoc":2202,"text":"def _parse_ascii_tformat(tform, strict=False):\n    \"\"\"\n    Parse the ``TFORMn`` keywords for ASCII tables into a ``(format, width,\n    precision)`` tuple (the latter is always zero unless format is one of 'E',\n    'F', or 'D').\n    \"\"\"\n\n    match = TFORMAT_ASCII_RE.match(tform.strip())\n    if not match:\n        raise VerifyError(f'Format {tform!r} is not recognized.')\n\n    # Be flexible on case\n    format = match.group('format')\n    if format is None:\n        # Floating point format\n        format = match.group('formatf').upper()\n        width = match.group('widthf')\n        precision = match.group('precision')\n        if width is None or precision is None:\n            if strict:\n                raise VerifyError('Format {!r} is not unambiguously an ASCII '\n                                  'table format.')\n            else:\n                width = 0 if width is None else width\n                precision = 1 if precision is None else precision\n    else:\n        format = format.upper()\n        width = match.group('width')\n        if width is None:\n            if strict:\n                raise VerifyError('Format {!r} is not unambiguously an ASCII '\n                                  'table format.')\n            else:\n                # Just use a default width of 0 if unspecified\n                width = 0\n        precision = 0\n\n    def convert_int(val):\n        msg = ('Format {!r} is not valid--field width and decimal precision '\n               'must be integers.')\n        try:\n            val = int(val)\n        except (ValueError, TypeError):\n            raise VerifyError(msg.format(tform))\n\n        return val\n\n    if width and precision:\n        # This should only be the case for floating-point formats\n        width, precision = convert_int(width), convert_int(precision)\n    elif width:\n        # Just for integer/string formats; ignore precision\n        width = convert_int(width)\n    else:\n        # For any format, if width was unspecified use the set defaults\n        width, precision = ASCII_DEFAULT_WIDTHS[format]\n\n    if width <= 0:\n        raise VerifyError(\"Format {!r} not valid--field width must be a \"\n                          \"positive integeter.\".format(tform))\n\n    if precision >= width:\n        raise VerifyError(\"Format {!r} not valid--the number of decimal digits \"\n                          \"must be less than the format's total \"\n                          \"width {}.\".format(tform, width))\n\n    return format, width, precision"},{"attributeType":"null","col":0,"comment":"null","endLoc":170,"id":891,"name":"__citation__","nodeType":"Attribute","startLoc":170,"text":"__citation__"},{"attributeType":"null","col":15,"comment":"null","endLoc":170,"id":892,"name":"__bibtex__","nodeType":"Attribute","startLoc":170,"text":"__bibtex__"},{"attributeType":"null","col":0,"comment":"null","endLoc":174,"id":893,"name":"log","nodeType":"Attribute","startLoc":174,"text":"log"},{"col":4,"comment":"Open a FITS file from a file object (including compressed files).","endLoc":504,"header":"def _open_fileobj(self, fileobj, mode, overwrite)","id":894,"name":"_open_fileobj","nodeType":"Function","startLoc":472,"text":"def _open_fileobj(self, fileobj, mode, overwrite):\n        \"\"\"Open a FITS file from a file object (including compressed files).\"\"\"\n\n        closed = fileobj_closed(fileobj)\n        # FIXME: this variable was unused, check if it was useful\n        # fmode = fileobj_mode(fileobj) or IO_FITS_MODES[mode]\n\n        if mode == 'ostream':\n            self._overwrite_existing(overwrite, fileobj, closed)\n\n        if not closed:\n            self._file = fileobj\n        elif isfile(fileobj):\n            self._file = fileobj_open(self.name, IO_FITS_MODES[mode])\n\n        # Attempt to determine if the file represented by the open file object\n        # is compressed\n        try:\n            # We need to account for the possibility that the underlying file\n            # handle may have been opened with either 'ab' or 'ab+', which\n            # means that the current file position is at the end of the file.\n            if mode in ['ostream', 'append']:\n                self._file.seek(0)\n            magic = self._file.read(4)\n            # No matter whether the underlying file was opened with 'ab' or\n            # 'ab+', we need to return to the beginning of the file in order\n            # to properly process the FITS header (and handle the possibility\n            # of a compressed file).\n            self._file.seek(0)\n        except OSError:\n            return\n\n        self._try_read_compressed(fileobj, magic, mode)"},{"attributeType":"null","col":0,"comment":"null","endLoc":205,"id":895,"name":"__dir_inc__","nodeType":"Attribute","startLoc":205,"text":"__dir_inc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":215,"id":896,"name":"varname","nodeType":"Attribute","startLoc":215,"text":"varname"},{"col":0,"comment":"","endLoc":7,"header":"__init__.py#<anonymous>","id":897,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nAstropy is a package intended to contain core functionality and some\ncommon tools needed for performing astronomy and astrophysics research with\nPython. It also provides an index for other astronomy packages and tools for\nmanaging them.\n\"\"\"\n\nif 'dev' in __version__:\n    online_docs_root = 'https://docs.astropy.org/en/latest/'\nelse:\n    online_docs_root = f'https://docs.astropy.org/en/{__version__}/'\n\nconf = Conf()\n\ntest = TestRunner.make_test_runner_in(__path__[0])  # noqa: F821\n\n__citation__ = __bibtex__ = _get_bibtex()\n\nlog = _init_log()\n\n_initialize_astropy()\n\n__dir_inc__ = ['__version__', '__githash__',\n               '__bibtex__', 'test', 'log', 'find_api_page', 'online_help',\n               'online_docs_root', 'conf', 'physical_constants',\n               'astronomical_constants']\n\nfor varname in dir():\n    if not ((varname.startswith('__') and varname.endswith('__')) or\n            varname in __dir_inc__ or\n            (varname[0] != '_' and\n                isinstance(locals()[varname], __module_type__) and\n                locals()[varname].__name__.startswith(__name__ + '.'))):\n        # The last clause in the the above disjunction deserves explanation:\n        # When using relative imports like ``from .. import config``, the\n        # ``config`` variable is automatically created in the namespace of\n        # whatever module ``..`` resolves to (in this case astropy).  This\n        # happens a few times just in the module setup above.  This allows\n        # the cleanup to keep any public submodules of the astropy package\n        del locals()[varname]\n\ndel varname, __module_type__"},{"col":0,"comment":"\n    Returns True if the given file-like object is closed or if *f* is a string\n    (and assumed to be a pathname).\n\n    Returns False for all other types of objects, under the assumption that\n    they are file-like objects with no sense of a 'closed' state.\n    ","endLoc":438,"header":"def fileobj_closed(f)","id":898,"name":"fileobj_closed","nodeType":"Function","startLoc":419,"text":"def fileobj_closed(f):\n    \"\"\"\n    Returns True if the given file-like object is closed or if *f* is a string\n    (and assumed to be a pathname).\n\n    Returns False for all other types of objects, under the assumption that\n    they are file-like objects with no sense of a 'closed' state.\n    \"\"\"\n\n    if isinstance(f, path_like):\n        return True\n\n    if hasattr(f, 'closed'):\n        return f.closed\n    elif hasattr(f, 'fileobj') and hasattr(f.fileobj, 'closed'):\n        return f.fileobj.closed\n    elif hasattr(f, 'fp') and hasattr(f.fp, 'closed'):\n        return f.fp.closed\n    else:\n        return False"},{"col":4,"comment":"Overwrite an existing file if ``overwrite`` is ``True``, otherwise\n        raise an OSError.  The exact behavior of this method depends on the\n        _File object state and is only meant for use within the ``_open_*``\n        internal methods.\n        ","endLoc":437,"header":"def _overwrite_existing(self, overwrite, fileobj, closed)","id":899,"name":"_overwrite_existing","nodeType":"Function","startLoc":419,"text":"def _overwrite_existing(self, overwrite, fileobj, closed):\n        \"\"\"Overwrite an existing file if ``overwrite`` is ``True``, otherwise\n        raise an OSError.  The exact behavior of this method depends on the\n        _File object state and is only meant for use within the ``_open_*``\n        internal methods.\n        \"\"\"\n\n        # The file will be overwritten...\n        if ((self.file_like and hasattr(fileobj, 'len') and fileobj.len > 0) or\n                (os.path.exists(self.name) and os.path.getsize(self.name) != 0)):\n            if overwrite:\n                if self.file_like and hasattr(fileobj, 'truncate'):\n                    fileobj.truncate(0)\n                else:\n                    if not closed:\n                        fileobj.close()\n                    os.remove(self.name)\n            else:\n                raise OSError(NOT_OVERWRITING_MSG.format(self.name))"},{"fileName":"verify.py","filePath":"astropy/io/fits","id":900,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport operator\nimport warnings\n\nfrom astropy.utils import indent\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n\nclass VerifyError(Exception):\n    \"\"\"\n    Verify exception class.\n    \"\"\"\n\n\nclass VerifyWarning(AstropyUserWarning):\n    \"\"\"\n    Verify warning class.\n    \"\"\"\n\n\nVERIFY_OPTIONS = ['ignore', 'warn', 'exception', 'fix', 'silentfix',\n                  'fix+ignore', 'fix+warn', 'fix+exception',\n                  'silentfix+ignore', 'silentfix+warn', 'silentfix+exception']\n\n\nclass _Verify:\n    \"\"\"\n    Shared methods for verification.\n    \"\"\"\n\n    def run_option(self, option='warn', err_text='', fix_text='Fixed.',\n                   fix=None, fixable=True):\n        \"\"\"\n        Execute the verification with selected option.\n        \"\"\"\n\n        text = err_text\n\n        if option in ['warn', 'exception']:\n            fixable = False\n        # fix the value\n        elif not fixable:\n            text = f'Unfixable error: {text}'\n        else:\n            if fix:\n                fix()\n            text += '  ' + fix_text\n\n        return (fixable, text)\n\n    def verify(self, option='warn'):\n        \"\"\"\n        Verify all values in the instance.\n\n        Parameters\n        ----------\n        option : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``\"+warn\"``, or ``\"+exception\"``\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n        \"\"\"\n\n        opt = option.lower()\n        if opt not in VERIFY_OPTIONS:\n            raise ValueError(f'Option {option!r} not recognized.')\n\n        if opt == 'ignore':\n            return\n\n        errs = self._verify(opt)\n\n        # Break the verify option into separate options related to reporting of\n        # errors, and fixing of fixable errors\n        if '+' in opt:\n            fix_opt, report_opt = opt.split('+')\n        elif opt in ['fix', 'silentfix']:\n            # The original default behavior for 'fix' and 'silentfix' was to\n            # raise an exception for unfixable errors\n            fix_opt, report_opt = opt, 'exception'\n        else:\n            fix_opt, report_opt = None, opt\n\n        if fix_opt == 'silentfix' and report_opt == 'ignore':\n            # Fixable errors were fixed, but don't report anything\n            return\n\n        if fix_opt == 'silentfix':\n            # Don't print out fixable issues; the first element of each verify\n            # item is a boolean indicating whether or not the issue was fixable\n            line_filter = lambda x: not x[0]\n        elif fix_opt == 'fix' and report_opt == 'ignore':\n            # Don't print *unfixable* issues, but do print fixed issues; this\n            # is probably not very useful but the option exists for\n            # completeness\n            line_filter = operator.itemgetter(0)\n        else:\n            line_filter = None\n\n        unfixable = False\n        messages = []\n        for fixable, message in errs.iter_lines(filter=line_filter):\n            if fixable is not None:\n                unfixable = not fixable\n            messages.append(message)\n\n        if messages:\n            messages.insert(0, 'Verification reported errors:')\n            messages.append('Note: astropy.io.fits uses zero-based indexing.\\n')\n\n            if fix_opt == 'silentfix' and not unfixable:\n                return\n            elif report_opt == 'warn' or (fix_opt == 'fix' and not unfixable):\n                for line in messages:\n                    warnings.warn(line, VerifyWarning)\n            else:\n                raise VerifyError('\\n' + '\\n'.join(messages))\n\n\nclass _ErrList(list):\n    \"\"\"\n    Verification errors list class.  It has a nested list structure\n    constructed by error messages generated by verifications at\n    different class levels.\n    \"\"\"\n\n    def __init__(self, val=(), unit='Element'):\n        super().__init__(val)\n        self.unit = unit\n\n    def __str__(self):\n        return '\\n'.join(item[1] for item in self.iter_lines())\n\n    def iter_lines(self, filter=None, shift=0):\n        \"\"\"\n        Iterate the nested structure as a list of strings with appropriate\n        indentations for each level of structure.\n        \"\"\"\n\n        element = 0\n        # go through the list twice, first time print out all top level\n        # messages\n        for item in self:\n            if not isinstance(item, _ErrList):\n                if filter is None or filter(item):\n                    yield item[0], indent(item[1], shift=shift)\n\n        # second time go through the next level items, each of the next level\n        # must present, even it has nothing.\n        for item in self:\n            if isinstance(item, _ErrList):\n                next_lines = item.iter_lines(filter=filter, shift=shift + 1)\n                try:\n                    first_line = next(next_lines)\n                except StopIteration:\n                    first_line = None\n\n                if first_line is not None:\n                    if self.unit:\n                        # This line is sort of a header for the next level in\n                        # the hierarchy\n                        yield None, indent(f'{self.unit} {element}:',\n                                           shift=shift)\n                    yield first_line\n\n                for line in next_lines:\n                    yield line\n\n                element += 1\n"},{"col":4,"comment":"\n        Convert array indices to world coordinates (represented by Astropy\n        objects).\n\n        If a single high-level object is used to represent the world coordinates\n        (i.e., if ``len(wcs.world_axis_object_classes) == 1``), it is returned\n        as-is (not in a tuple/list), otherwise a tuple of high-level objects is\n        returned. See\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.array_index_to_world_values` for\n        pixel indexing and ordering conventions.\n        ","endLoc":87,"header":"def array_index_to_world(self, *index_arrays)","id":901,"name":"array_index_to_world","nodeType":"Function","startLoc":75,"text":"def array_index_to_world(self, *index_arrays):\n        \"\"\"\n        Convert array indices to world coordinates (represented by Astropy\n        objects).\n\n        If a single high-level object is used to represent the world coordinates\n        (i.e., if ``len(wcs.world_axis_object_classes) == 1``), it is returned\n        as-is (not in a tuple/list), otherwise a tuple of high-level objects is\n        returned. See\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.array_index_to_world_values` for\n        pixel indexing and ordering conventions.\n        \"\"\"\n        return self.pixel_to_world(*index_arrays[::-1])"},{"col":0,"comment":"\n    A wrapper around the `open()` builtin.\n\n    This exists because `open()` returns an `io.BufferedReader` by default.\n    This is bad, because `io.BufferedReader` doesn't support random access,\n    which we need in some cases.  We must call open with buffering=0 to get\n    a raw random-access file reader.\n    ","endLoc":388,"header":"def fileobj_open(filename, mode)","id":902,"name":"fileobj_open","nodeType":"Function","startLoc":378,"text":"def fileobj_open(filename, mode):\n    \"\"\"\n    A wrapper around the `open()` builtin.\n\n    This exists because `open()` returns an `io.BufferedReader` by default.\n    This is bad, because `io.BufferedReader` doesn't support random access,\n    which we need in some cases.  We must call open with buffering=0 to get\n    a raw random-access file reader.\n    \"\"\"\n\n    return open(filename, mode, buffering=0)"},{"col":0,"comment":"Indent a block of text.  The indentation is applied to each line.","endLoc":64,"header":"def indent(s, shift=1, width=4)","id":903,"name":"indent","nodeType":"Function","startLoc":56,"text":"def indent(s, shift=1, width=4):\n    \"\"\"Indent a block of text.  The indentation is applied to each line.\"\"\"\n\n    indented = '\\n'.join(' ' * (width * shift) + l if l else ''\n                         for l in s.splitlines())\n    if s[-1] == '\\n':\n        indented += '\\n'\n\n    return indented"},{"col":0,"comment":"Create a numpy array from a file or a file-like object.","endLoc":589,"header":"def _array_from_file(infile, dtype, count)","id":904,"name":"_array_from_file","nodeType":"Function","startLoc":554,"text":"def _array_from_file(infile, dtype, count):\n    \"\"\"Create a numpy array from a file or a file-like object.\"\"\"\n\n    if isfile(infile):\n\n        global CHUNKED_FROMFILE\n        if CHUNKED_FROMFILE is None:\n            if (sys.platform == 'darwin' and\n                    Version(platform.mac_ver()[0]) < Version('10.9')):\n                CHUNKED_FROMFILE = True\n            else:\n                CHUNKED_FROMFILE = False\n\n        if CHUNKED_FROMFILE:\n            chunk_size = int(1024 ** 3 / dtype.itemsize)  # 1Gb to be safe\n            if count < chunk_size:\n                return np.fromfile(infile, dtype=dtype, count=count)\n            else:\n                array = np.empty(count, dtype=dtype)\n                for beg in range(0, count, chunk_size):\n                    end = min(count, beg + chunk_size)\n                    array[beg:end] = np.fromfile(infile, dtype=dtype, count=end - beg)\n                return array\n        else:\n            return np.fromfile(infile, dtype=dtype, count=count)\n    else:\n        # treat as file-like object with \"read\" method; this includes gzip file\n        # objects, because numpy.fromfile just reads the compressed bytes from\n        # their underlying file object, instead of the decompressed bytes\n        read_size = np.dtype(dtype).itemsize * count\n        s = infile.read(read_size)\n        array = np.ndarray(buffer=s, dtype=dtype, shape=(count,))\n        # copy is needed because np.frombuffer returns a read-only view of the\n        # underlying buffer\n        array = array.copy()\n        return array"},{"col":4,"comment":"\n        Convert world coordinates (represented by Astropy objects) to pixel\n        coordinates.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned. See\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_to_pixel_values` for pixel\n        indexing and ordering conventions.\n        ","endLoc":100,"header":"@abc.abstractmethod\n    def world_to_pixel(self, *world_objects)","id":905,"name":"world_to_pixel","nodeType":"Function","startLoc":89,"text":"@abc.abstractmethod\n    def world_to_pixel(self, *world_objects):\n        \"\"\"\n        Convert world coordinates (represented by Astropy objects) to pixel\n        coordinates.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned. See\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_to_pixel_values` for pixel\n        indexing and ordering conventions.\n        \"\"\""},{"col":4,"comment":"\n        Convert world coordinates (represented by Astropy objects) to array\n        indices.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned. See\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_to_array_index_values` for\n        pixel indexing and ordering conventions. The indices should be returned\n        as rounded integers.\n        ","endLoc":117,"header":"def world_to_array_index(self, *world_objects)","id":906,"name":"world_to_array_index","nodeType":"Function","startLoc":102,"text":"def world_to_array_index(self, *world_objects):\n        \"\"\"\n        Convert world coordinates (represented by Astropy objects) to array\n        indices.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned. See\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_to_array_index_values` for\n        pixel indexing and ordering conventions. The indices should be returned\n        as rounded integers.\n        \"\"\"\n        if self.pixel_n_dim == 1:\n            return _toindex(self.world_to_pixel(*world_objects))\n        else:\n            return tuple(_toindex(self.world_to_pixel(*world_objects)[::-1]).tolist())"},{"className":"VerifyError","col":0,"comment":"\n    Verify exception class.\n    ","endLoc":13,"id":907,"nodeType":"Class","startLoc":10,"text":"class VerifyError(Exception):\n    \"\"\"\n    Verify exception class.\n    \"\"\""},{"className":"VerifyWarning","col":0,"comment":"\n    Verify warning class.\n    ","endLoc":19,"id":908,"nodeType":"Class","startLoc":16,"text":"class VerifyWarning(AstropyUserWarning):\n    \"\"\"\n    Verify warning class.\n    \"\"\""},{"className":"_Verify","col":0,"comment":"\n    Shared methods for verification.\n    ","endLoc":119,"id":909,"nodeType":"Class","startLoc":27,"text":"class _Verify:\n    \"\"\"\n    Shared methods for verification.\n    \"\"\"\n\n    def run_option(self, option='warn', err_text='', fix_text='Fixed.',\n                   fix=None, fixable=True):\n        \"\"\"\n        Execute the verification with selected option.\n        \"\"\"\n\n        text = err_text\n\n        if option in ['warn', 'exception']:\n            fixable = False\n        # fix the value\n        elif not fixable:\n            text = f'Unfixable error: {text}'\n        else:\n            if fix:\n                fix()\n            text += '  ' + fix_text\n\n        return (fixable, text)\n\n    def verify(self, option='warn'):\n        \"\"\"\n        Verify all values in the instance.\n\n        Parameters\n        ----------\n        option : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``\"+warn\"``, or ``\"+exception\"``\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n        \"\"\"\n\n        opt = option.lower()\n        if opt not in VERIFY_OPTIONS:\n            raise ValueError(f'Option {option!r} not recognized.')\n\n        if opt == 'ignore':\n            return\n\n        errs = self._verify(opt)\n\n        # Break the verify option into separate options related to reporting of\n        # errors, and fixing of fixable errors\n        if '+' in opt:\n            fix_opt, report_opt = opt.split('+')\n        elif opt in ['fix', 'silentfix']:\n            # The original default behavior for 'fix' and 'silentfix' was to\n            # raise an exception for unfixable errors\n            fix_opt, report_opt = opt, 'exception'\n        else:\n            fix_opt, report_opt = None, opt\n\n        if fix_opt == 'silentfix' and report_opt == 'ignore':\n            # Fixable errors were fixed, but don't report anything\n            return\n\n        if fix_opt == 'silentfix':\n            # Don't print out fixable issues; the first element of each verify\n            # item is a boolean indicating whether or not the issue was fixable\n            line_filter = lambda x: not x[0]\n        elif fix_opt == 'fix' and report_opt == 'ignore':\n            # Don't print *unfixable* issues, but do print fixed issues; this\n            # is probably not very useful but the option exists for\n            # completeness\n            line_filter = operator.itemgetter(0)\n        else:\n            line_filter = None\n\n        unfixable = False\n        messages = []\n        for fixable, message in errs.iter_lines(filter=line_filter):\n            if fixable is not None:\n                unfixable = not fixable\n            messages.append(message)\n\n        if messages:\n            messages.insert(0, 'Verification reported errors:')\n            messages.append('Note: astropy.io.fits uses zero-based indexing.\\n')\n\n            if fix_opt == 'silentfix' and not unfixable:\n                return\n            elif report_opt == 'warn' or (fix_opt == 'fix' and not unfixable):\n                for line in messages:\n                    warnings.warn(line, VerifyWarning)\n            else:\n                raise VerifyError('\\n' + '\\n'.join(messages))"},{"col":4,"comment":"\n        Execute the verification with selected option.\n        ","endLoc":50,"header":"def run_option(self, option='warn', err_text='', fix_text='Fixed.',\n                   fix=None, fixable=True)","id":910,"name":"run_option","nodeType":"Function","startLoc":32,"text":"def run_option(self, option='warn', err_text='', fix_text='Fixed.',\n                   fix=None, fixable=True):\n        \"\"\"\n        Execute the verification with selected option.\n        \"\"\"\n\n        text = err_text\n\n        if option in ['warn', 'exception']:\n            fixable = False\n        # fix the value\n        elif not fixable:\n            text = f'Unfixable error: {text}'\n        else:\n            if fix:\n                fix()\n            text += '  ' + fix_text\n\n        return (fixable, text)"},{"col":4,"comment":"\n        Verify all values in the instance.\n\n        Parameters\n        ----------\n        option : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``\"+warn\"``, or ``\"+exception\"``\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n        ","endLoc":119,"header":"def verify(self, option='warn')","id":912,"name":"verify","nodeType":"Function","startLoc":52,"text":"def verify(self, option='warn'):\n        \"\"\"\n        Verify all values in the instance.\n\n        Parameters\n        ----------\n        option : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``\"+warn\"``, or ``\"+exception\"``\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n        \"\"\"\n\n        opt = option.lower()\n        if opt not in VERIFY_OPTIONS:\n            raise ValueError(f'Option {option!r} not recognized.')\n\n        if opt == 'ignore':\n            return\n\n        errs = self._verify(opt)\n\n        # Break the verify option into separate options related to reporting of\n        # errors, and fixing of fixable errors\n        if '+' in opt:\n            fix_opt, report_opt = opt.split('+')\n        elif opt in ['fix', 'silentfix']:\n            # The original default behavior for 'fix' and 'silentfix' was to\n            # raise an exception for unfixable errors\n            fix_opt, report_opt = opt, 'exception'\n        else:\n            fix_opt, report_opt = None, opt\n\n        if fix_opt == 'silentfix' and report_opt == 'ignore':\n            # Fixable errors were fixed, but don't report anything\n            return\n\n        if fix_opt == 'silentfix':\n            # Don't print out fixable issues; the first element of each verify\n            # item is a boolean indicating whether or not the issue was fixable\n            line_filter = lambda x: not x[0]\n        elif fix_opt == 'fix' and report_opt == 'ignore':\n            # Don't print *unfixable* issues, but do print fixed issues; this\n            # is probably not very useful but the option exists for\n            # completeness\n            line_filter = operator.itemgetter(0)\n        else:\n            line_filter = None\n\n        unfixable = False\n        messages = []\n        for fixable, message in errs.iter_lines(filter=line_filter):\n            if fixable is not None:\n                unfixable = not fixable\n            messages.append(message)\n\n        if messages:\n            messages.insert(0, 'Verification reported errors:')\n            messages.append('Note: astropy.io.fits uses zero-based indexing.\\n')\n\n            if fix_opt == 'silentfix' and not unfixable:\n                return\n            elif report_opt == 'warn' or (fix_opt == 'fix' and not unfixable):\n                for line in messages:\n                    warnings.warn(line, VerifyWarning)\n            else:\n                raise VerifyError('\\n' + '\\n'.join(messages))"},{"col":0,"comment":"\n    Convert value to an int or an int array.\n    Input coordinates converted to integers\n    corresponding to the center of the pixel.\n    The convention is that the center of the pixel is\n    (0, 0), while the lower left corner is (-0.5, -0.5).\n    The outputs are used to index the mask.\n    Examples\n    --------\n    >>> _toindex(np.array([-0.5, 0.49999]))\n    array([0, 0])\n    >>> _toindex(np.array([0.5, 1.49999]))\n    array([1, 1])\n    >>> _toindex(np.array([1.5, 2.49999]))\n    array([2, 2])\n    ","endLoc":43,"header":"def _toindex(value)","id":913,"name":"_toindex","nodeType":"Function","startLoc":25,"text":"def _toindex(value):\n    \"\"\"\n    Convert value to an int or an int array.\n    Input coordinates converted to integers\n    corresponding to the center of the pixel.\n    The convention is that the center of the pixel is\n    (0, 0), while the lower left corner is (-0.5, -0.5).\n    The outputs are used to index the mask.\n    Examples\n    --------\n    >>> _toindex(np.array([-0.5, 0.49999]))\n    array([0, 0])\n    >>> _toindex(np.array([0.5, 1.49999]))\n    array([1, 1])\n    >>> _toindex(np.array([1.5, 2.49999]))\n    array([2, 2])\n    \"\"\"\n    indx = np.asarray(np.floor(np.asarray(value) + 0.5), dtype=int)\n    return indx"},{"col":4,"comment":"null","endLoc":305,"header":"@property\n    def low_level_wcs(self)","id":914,"name":"low_level_wcs","nodeType":"Function","startLoc":303,"text":"@property\n    def low_level_wcs(self):\n        return self"},{"col":4,"comment":"null","endLoc":314,"header":"def world_to_pixel(self, *world_objects)","id":915,"name":"world_to_pixel","nodeType":"Function","startLoc":307,"text":"def world_to_pixel(self, *world_objects):\n\n        world_values = high_level_objects_to_values(*world_objects, low_level_wcs=self.low_level_wcs)\n\n        # Finally we convert to pixel coordinates\n        pixel_values = self.low_level_wcs.world_to_pixel_values(*world_values)\n\n        return pixel_values"},{"col":0,"comment":"\n    Convert the input high level object to low level values.\n\n    This function uses the information in ``wcs.world_axis_object_classes`` and\n    ``wcs.world_axis_object_components`` to convert the high level objects\n    (such as `~.SkyCoord`) to low level \"values\" `~.Quantity` objects.\n\n    This is used in `.HighLevelWCSMixin.world_to_pixel`, but provided as a\n    separate function for use in other places where needed.\n\n    Parameters\n    ----------\n    *world_objects: object\n        High level coordinate objects.\n\n    low_level_wcs: `.BaseLowLevelWCS`\n        The WCS object to use to interpret the coordinates.\n    ","endLoc":237,"header":"def high_level_objects_to_values(*world_objects, low_level_wcs)","id":916,"name":"high_level_objects_to_values","nodeType":"Function","startLoc":120,"text":"def high_level_objects_to_values(*world_objects, low_level_wcs):\n    \"\"\"\n    Convert the input high level object to low level values.\n\n    This function uses the information in ``wcs.world_axis_object_classes`` and\n    ``wcs.world_axis_object_components`` to convert the high level objects\n    (such as `~.SkyCoord`) to low level \"values\" `~.Quantity` objects.\n\n    This is used in `.HighLevelWCSMixin.world_to_pixel`, but provided as a\n    separate function for use in other places where needed.\n\n    Parameters\n    ----------\n    *world_objects: object\n        High level coordinate objects.\n\n    low_level_wcs: `.BaseLowLevelWCS`\n        The WCS object to use to interpret the coordinates.\n    \"\"\"\n    # Cache the classes and components since this may be expensive\n    serialized_classes = low_level_wcs.world_axis_object_classes\n    components = low_level_wcs.world_axis_object_components\n\n    # Deserialize world_axis_object_classes using the default order\n    classes = OrderedDict()\n    for key in default_order(components):\n        if low_level_wcs.serialized_classes:\n            classes[key] = deserialize_class(serialized_classes[key],\n                                             construct=False)\n        else:\n            classes[key] = serialized_classes[key]\n\n    # Check that the number of classes matches the number of inputs\n    if len(world_objects) != len(classes):\n        raise ValueError(\"Number of world inputs ({}) does not match \"\n                         \"expected ({})\".format(len(world_objects), len(classes)))\n\n    # Determine whether the classes are uniquely matched, that is we check\n    # whether there is only one of each class.\n    world_by_key = {}\n    unique_match = True\n    for w in world_objects:\n        matches = []\n        for key, (klass, *_) in classes.items():\n            if isinstance(w, klass):\n                matches.append(key)\n        if len(matches) == 1:\n            world_by_key[matches[0]] = w\n        else:\n            unique_match = False\n            break\n\n    # If the match is not unique, the order of the classes needs to match,\n    # whereas if all classes are unique, we can still intelligently match\n    # them even if the order is wrong.\n\n    objects = {}\n\n    if unique_match:\n\n        for key, (klass, args, kwargs, *rest) in classes.items():\n\n            if len(rest) == 0:\n                klass_gen = klass\n            elif len(rest) == 1:\n                klass_gen = rest[0]\n            else:\n                raise ValueError(\"Tuples in world_axis_object_classes should have length 3 or 4\")\n\n            # FIXME: For now SkyCoord won't auto-convert upon initialization\n            # https://github.com/astropy/astropy/issues/7689\n            from astropy.coordinates import SkyCoord\n            if isinstance(world_by_key[key], SkyCoord):\n                if 'frame' in kwargs:\n                    objects[key] = world_by_key[key].transform_to(kwargs['frame'])\n                else:\n                    objects[key] = world_by_key[key]\n            else:\n                objects[key] = klass_gen(world_by_key[key], *args, **kwargs)\n\n    else:\n\n        for ikey, key in enumerate(classes):\n\n            klass, args, kwargs, *rest = classes[key]\n\n            if len(rest) == 0:\n                klass_gen = klass\n            elif len(rest) == 1:\n                klass_gen = rest[0]\n            else:\n                raise ValueError(\"Tuples in world_axis_object_classes should have length 3 or 4\")\n\n            w = world_objects[ikey]\n            if not isinstance(w, klass):\n                raise ValueError(\"Expected the following order of world \"\n                                 \"arguments: {}\".format(', '.join([k.__name__ for (k, _, _) in classes.values()])))\n\n            # FIXME: For now SkyCoord won't auto-convert upon initialization\n            # https://github.com/astropy/astropy/issues/7689\n            from astropy.coordinates import SkyCoord\n            if isinstance(w, SkyCoord):\n                if 'frame' in kwargs:\n                    objects[key] = w.transform_to(kwargs['frame'])\n                else:\n                    objects[key] = w\n            else:\n                objects[key] = klass_gen(w, *args, **kwargs)\n\n    # We now extract the attributes needed for the world values\n    world = []\n    for key, _, attr in components:\n        if callable(attr):\n            world.append(attr(objects[key]))\n        else:\n            world.append(rec_getattr(objects[key], attr))\n\n    return world"},{"col":0,"comment":"null","endLoc":22,"header":"def default_order(components)","id":917,"name":"default_order","nodeType":"Function","startLoc":17,"text":"def default_order(components):\n    order = []\n    for key, _, _ in components:\n        if key not in order:\n            order.append(key)\n    return order"},{"col":26,"endLoc":93,"id":918,"nodeType":"Lambda","startLoc":93,"text":"lambda x: not x[0]"},{"col":4,"comment":"null","endLoc":151,"header":"def __init__(self, data=None, header=None, *args, **kwargs)","id":919,"name":"__init__","nodeType":"Function","startLoc":128,"text":"def __init__(self, data=None, header=None, *args, **kwargs):\n        if header is None:\n            header = Header()\n        self._header = header\n        self._header_str = None\n        self._file = None\n        self._buffer = None\n        self._header_offset = None\n        self._data_offset = None\n        self._data_size = None\n\n        # This internal variable is used to track whether the data attribute\n        # still points to the same data array as when the HDU was originally\n        # created (this does not track whether the data is actually the same\n        # content-wise)\n        self._data_replaced = False\n        self._data_needs_rescale = False\n        self._new = True\n        self._output_checksum = False\n\n        if 'DATASUM' in self._header and 'CHECKSUM' not in self._header:\n            self._output_checksum = 'datasum'\n        elif 'CHECKSUM' in self._header:\n            self._output_checksum = True"},{"col":4,"comment":"The format argument to this class's initializer may come in many\n        forms.  This uses the given column format class ``cls`` to convert\n        to a format of that type.\n\n        TODO: There should be an abc base class for column format classes\n        ","endLoc":949,"header":"@staticmethod\n    def _convert_format(format, cls)","id":920,"name":"_convert_format","nodeType":"Function","startLoc":922,"text":"@staticmethod\n    def _convert_format(format, cls):\n        \"\"\"The format argument to this class's initializer may come in many\n        forms.  This uses the given column format class ``cls`` to convert\n        to a format of that type.\n\n        TODO: There should be an abc base class for column format classes\n        \"\"\"\n\n        # Short circuit in case we're already a _BaseColumnFormat--there is at\n        # least one case in which this can happen\n        if isinstance(format, _BaseColumnFormat):\n            return format, format.recformat\n\n        if format in NUMPY2FITS:\n            with suppress(VerifyError):\n                # legit recarray format?\n                recformat = format\n                format = cls.from_recformat(format)\n\n        try:\n            # legit FITS format?\n            format = cls(format)\n            recformat = format.recformat\n        except VerifyError:\n            raise VerifyError(f'Illegal format `{format}`.')\n\n        return format, recformat"},{"col":0,"comment":"\n    Deserialize classes recursively.\n    ","endLoc":28,"header":"def deserialize_class(tpl, construct=True)","id":921,"name":"deserialize_class","nodeType":"Function","startLoc":9,"text":"def deserialize_class(tpl, construct=True):\n    \"\"\"\n    Deserialize classes recursively.\n    \"\"\"\n\n    if not isinstance(tpl, tuple) or len(tpl) != 3:\n        raise ValueError(\"Expected a tuple of three values\")\n\n    module, klass = tpl[0].rsplit('.', 1)\n    module = importlib.import_module(module)\n    klass = getattr(module, klass)\n\n    args = tuple([deserialize_class(arg) if isinstance(arg, tuple) else arg for arg in tpl[1]])\n\n    kwargs = dict((key, deserialize_class(val)) if isinstance(val, tuple) else (key, val) for (key, val) in tpl[2].items())\n\n    if construct:\n        return klass(*args, **kwargs)\n    else:\n        return klass, args, kwargs"},{"col":0,"comment":"\n    Write a numpy array to a file or a file-like object.\n\n    Parameters\n    ----------\n    arr : ndarray\n        The Numpy array to write.\n    outfile : file-like\n        A file-like object such as a Python file object, an `io.BytesIO`, or\n        anything else with a ``write`` method.  The file object must support\n        the buffer interface in its ``write``.\n\n    If writing directly to an on-disk file this delegates directly to\n    `ndarray.tofile`.  Otherwise a slower Python implementation is used.\n    ","endLoc":644,"header":"def _array_to_file(arr, outfile)","id":922,"name":"_array_to_file","nodeType":"Function","startLoc":596,"text":"def _array_to_file(arr, outfile):\n    \"\"\"\n    Write a numpy array to a file or a file-like object.\n\n    Parameters\n    ----------\n    arr : ndarray\n        The Numpy array to write.\n    outfile : file-like\n        A file-like object such as a Python file object, an `io.BytesIO`, or\n        anything else with a ``write`` method.  The file object must support\n        the buffer interface in its ``write``.\n\n    If writing directly to an on-disk file this delegates directly to\n    `ndarray.tofile`.  Otherwise a slower Python implementation is used.\n    \"\"\"\n\n    if isfile(outfile) and not isinstance(outfile, io.BufferedIOBase):\n        write = lambda a, f: a.tofile(f)\n    else:\n        write = _array_to_file_like\n\n    # Implements a workaround for a bug deep in OSX's stdlib file writing\n    # functions; on 64-bit OSX it is not possible to correctly write a number\n    # of bytes greater than 2 ** 32 and divisible by 4096 (or possibly 8192--\n    # whatever the default blocksize for the filesystem is).\n    # This issue should have a workaround in Numpy too, but hasn't been\n    # implemented there yet: https://github.com/astropy/astropy/issues/839\n    #\n    # Apparently Windows has its own fwrite bug:\n    # https://github.com/numpy/numpy/issues/2256\n\n    if (sys.platform == 'darwin' and arr.nbytes >= _OSX_WRITE_LIMIT + 1 and\n            arr.nbytes % 4096 == 0):\n        # chunksize is a count of elements in the array, not bytes\n        chunksize = _OSX_WRITE_LIMIT // arr.itemsize\n    elif sys.platform.startswith('win'):\n        chunksize = _WIN_WRITE_LIMIT // arr.itemsize\n    else:\n        # Just pass the whole array to the write routine\n        return write(arr, outfile)\n\n    # Write one chunk at a time for systems whose fwrite chokes on large\n    # writes.\n    idx = 0\n    arr = arr.view(np.ndarray).flatten()\n    while idx < arr.nbytes:\n        write(arr[idx:idx + chunksize], outfile)\n        idx += chunksize"},{"col":16,"endLoc":614,"id":923,"nodeType":"Lambda","startLoc":614,"text":"lambda a, f: a.tofile(f)"},{"col":4,"comment":"Attempt to determine if the given file is compressed","endLoc":470,"header":"def _try_read_compressed(self, obj_or_name, magic, mode, ext='')","id":924,"name":"_try_read_compressed","nodeType":"Function","startLoc":439,"text":"def _try_read_compressed(self, obj_or_name, magic, mode, ext=''):\n        \"\"\"Attempt to determine if the given file is compressed\"\"\"\n        is_ostream = mode == 'ostream'\n        if (is_ostream and ext == '.gz') or magic.startswith(GZIP_MAGIC):\n            if mode == 'append':\n                raise OSError(\"'append' mode is not supported with gzip files.\"\n                              \"Use 'update' mode instead\")\n            # Handle gzip files\n            kwargs = dict(mode=IO_FITS_MODES[mode])\n            if isinstance(obj_or_name, str):\n                kwargs['filename'] = obj_or_name\n            else:\n                kwargs['fileobj'] = obj_or_name\n            self._file = gzip.GzipFile(**kwargs)\n            self.compression = 'gzip'\n        elif (is_ostream and ext == '.zip') or magic.startswith(PKZIP_MAGIC):\n            # Handle zip files\n            self._open_zipfile(self.name, mode)\n            self.compression = 'zip'\n        elif (is_ostream and ext == '.bz2') or magic.startswith(BZIP2_MAGIC):\n            # Handle bzip2 files\n            if mode in ['update', 'append']:\n                raise OSError(\"update and append modes are not supported \"\n                              \"with bzip2 files\")\n            if not HAS_BZ2:\n                raise ModuleNotFoundError(\n                    \"This Python installation does not provide the bz2 module.\")\n            # bzip2 only supports 'w' and 'r' modes\n            bzip2_mode = 'w' if is_ostream else 'r'\n            self._file = bz2.BZ2File(obj_or_name, mode=bzip2_mode)\n            self.compression = 'bzip2'\n        return self.compression is not None"},{"col":0,"comment":"null","endLoc":749,"header":"def _is_int(val)","id":925,"name":"_is_int","nodeType":"Function","startLoc":748,"text":"def _is_int(val):\n    return isinstance(val, all_integer_types)"},{"col":4,"comment":"Limited support for zipfile.ZipFile objects containing a single\n        a file.  Allows reading only for now by extracting the file to a\n        tempfile.\n        ","endLoc":635,"header":"def _open_zipfile(self, fileobj, mode)","id":926,"name":"_open_zipfile","nodeType":"Function","startLoc":605,"text":"def _open_zipfile(self, fileobj, mode):\n        \"\"\"Limited support for zipfile.ZipFile objects containing a single\n        a file.  Allows reading only for now by extracting the file to a\n        tempfile.\n        \"\"\"\n\n        if mode in ('update', 'append'):\n            raise OSError(\n                  \"Writing to zipped fits files is not currently \"\n                  \"supported\")\n\n        if not isinstance(fileobj, zipfile.ZipFile):\n            zfile = zipfile.ZipFile(fileobj)\n            close = True\n        else:\n            zfile = fileobj\n            close = False\n\n        namelist = zfile.namelist()\n        if len(namelist) != 1:\n            raise OSError(\n              \"Zip files with multiple members are not supported.\")\n        self._file = tempfile.NamedTemporaryFile(suffix='.fits')\n        self._file.write(zfile.read(namelist[0]))\n\n        if close:\n            zfile.close()\n        # We just wrote the contents of the first file in the archive to a new\n        # temp file, which now serves as our underlying file object. So it's\n        # necessary to reset the position back to the beginning\n        self._file.seek(0)"},{"col":0,"comment":"\n    Parse the ``TDISPn`` keywords for ASCII and binary tables into a\n    ``(format, width, precision, exponential)`` tuple (the TDISP values\n    for ASCII and binary are identical except for 'Lw',\n    which is only present in BINTABLE extensions\n\n    Parameters\n    ----------\n    tdisp : str\n        TDISPn FITS Header keyword.  Used to specify display formatting.\n\n    Returns\n    -------\n    formatc: str\n        The format characters from TDISPn\n    width: str\n        The width int value from TDISPn\n    precision: str\n        The precision int value from TDISPn\n    exponential: str\n        The exponential int value from TDISPn\n\n    ","endLoc":2551,"header":"def _parse_tdisp_format(tdisp)","id":927,"name":"_parse_tdisp_format","nodeType":"Function","startLoc":2497,"text":"def _parse_tdisp_format(tdisp):\n    \"\"\"\n    Parse the ``TDISPn`` keywords for ASCII and binary tables into a\n    ``(format, width, precision, exponential)`` tuple (the TDISP values\n    for ASCII and binary are identical except for 'Lw',\n    which is only present in BINTABLE extensions\n\n    Parameters\n    ----------\n    tdisp : str\n        TDISPn FITS Header keyword.  Used to specify display formatting.\n\n    Returns\n    -------\n    formatc: str\n        The format characters from TDISPn\n    width: str\n        The width int value from TDISPn\n    precision: str\n        The precision int value from TDISPn\n    exponential: str\n        The exponential int value from TDISPn\n\n    \"\"\"\n\n    # Use appropriate regex for format type\n    tdisp = tdisp.strip()\n    fmt_key = tdisp[0] if tdisp[0] != 'E' or (\n        len(tdisp) > 1 and tdisp[1] not in 'NS') else tdisp[:2]\n    try:\n        tdisp_re = TDISP_RE_DICT[fmt_key]\n    except KeyError:\n        raise VerifyError(f'Format {tdisp} is not recognized.')\n\n    match = tdisp_re.match(tdisp.strip())\n    if not match or match.group('formatc') is None:\n        raise VerifyError(f'Format {tdisp} is not recognized.')\n\n    formatc = match.group('formatc')\n    width = match.group('width')\n    precision = None\n    exponential = None\n\n    # Some formats have precision and exponential\n    if tdisp[0] in ('I', 'B', 'O', 'Z', 'F', 'E', 'G', 'D'):\n        precision = match.group('precision')\n        if precision is None:\n            precision = 1\n    if tdisp[0] in ('E', 'D', 'G') and tdisp[1] not in ('N', 'S'):\n        exponential = match.group('exponential')\n        if exponential is None:\n            exponential = 1\n\n    # Once parsed, check format dict to do conversion to a formatting string\n    return formatc, width, precision, exponential"},{"col":0,"comment":"\n    Write a string to a file, encoding to ASCII if the file is open in binary\n    mode, or decoding if the file is open in text mode.\n    ","endLoc":705,"header":"def _write_string(f, s)","id":928,"name":"_write_string","nodeType":"Function","startLoc":690,"text":"def _write_string(f, s):\n    \"\"\"\n    Write a string to a file, encoding to ASCII if the file is open in binary\n    mode, or decoding if the file is open in text mode.\n    \"\"\"\n\n    # Assume if the file object doesn't have a specific mode, that the mode is\n    # binary\n    binmode = fileobj_is_binary(f)\n\n    if binmode and isinstance(s, str):\n        s = encode_ascii(s)\n    elif not binmode and not isinstance(f, str):\n        s = decode_ascii(s)\n\n    f.write(s)"},{"col":0,"comment":"\n    Returns True if the give file or file-like object has a file open in binary\n    mode.  When in doubt, returns True by default.\n    ","endLoc":517,"header":"def fileobj_is_binary(f)","id":929,"name":"fileobj_is_binary","nodeType":"Function","startLoc":499,"text":"def fileobj_is_binary(f):\n    \"\"\"\n    Returns True if the give file or file-like object has a file open in binary\n    mode.  When in doubt, returns True by default.\n    \"\"\"\n\n    # This is kind of a hack for this to work correctly with _File objects,\n    # which, for the time being, are *always* binary\n    if hasattr(f, 'binary'):\n        return f.binary\n\n    if isinstance(f, io.TextIOBase):\n        return False\n\n    mode = fileobj_mode(f)\n    if mode:\n        return 'b' in mode\n    else:\n        return True"},{"className":"_ErrList","col":0,"comment":"\n    Verification errors list class.  It has a nested list structure\n    constructed by error messages generated by verifications at\n    different class levels.\n    ","endLoc":171,"id":930,"nodeType":"Class","startLoc":122,"text":"class _ErrList(list):\n    \"\"\"\n    Verification errors list class.  It has a nested list structure\n    constructed by error messages generated by verifications at\n    different class levels.\n    \"\"\"\n\n    def __init__(self, val=(), unit='Element'):\n        super().__init__(val)\n        self.unit = unit\n\n    def __str__(self):\n        return '\\n'.join(item[1] for item in self.iter_lines())\n\n    def iter_lines(self, filter=None, shift=0):\n        \"\"\"\n        Iterate the nested structure as a list of strings with appropriate\n        indentations for each level of structure.\n        \"\"\"\n\n        element = 0\n        # go through the list twice, first time print out all top level\n        # messages\n        for item in self:\n            if not isinstance(item, _ErrList):\n                if filter is None or filter(item):\n                    yield item[0], indent(item[1], shift=shift)\n\n        # second time go through the next level items, each of the next level\n        # must present, even it has nothing.\n        for item in self:\n            if isinstance(item, _ErrList):\n                next_lines = item.iter_lines(filter=filter, shift=shift + 1)\n                try:\n                    first_line = next(next_lines)\n                except StopIteration:\n                    first_line = None\n\n                if first_line is not None:\n                    if self.unit:\n                        # This line is sort of a header for the next level in\n                        # the hierarchy\n                        yield None, indent(f'{self.unit} {element}:',\n                                           shift=shift)\n                    yield first_line\n\n                for line in next_lines:\n                    yield line\n\n                element += 1"},{"col":4,"comment":"null","endLoc":131,"header":"def __init__(self, val=(), unit='Element')","id":931,"name":"__init__","nodeType":"Function","startLoc":129,"text":"def __init__(self, val=(), unit='Element'):\n        super().__init__(val)\n        self.unit = unit"},{"col":4,"comment":"null","endLoc":134,"header":"def __str__(self)","id":932,"name":"__str__","nodeType":"Function","startLoc":133,"text":"def __str__(self):\n        return '\\n'.join(item[1] for item in self.iter_lines())"},{"col":0,"comment":"Parse the ``TDIM`` value into a tuple (may return an empty tuple if\n    the value ``TDIM`` value is empty or invalid).\n    ","endLoc":2281,"header":"def _parse_tdim(tdim)","id":933,"name":"_parse_tdim","nodeType":"Function","startLoc":2271,"text":"def _parse_tdim(tdim):\n    \"\"\"Parse the ``TDIM`` value into a tuple (may return an empty tuple if\n    the value ``TDIM`` value is empty or invalid).\n    \"\"\"\n    m = tdim and TDIM_RE.match(tdim)\n    if m:\n        dims = m.group('dims')\n        return tuple(int(d.strip()) for d in dims.split(','))[::-1]\n\n    # Ignore any dim values that don't specify a multidimensional column\n    return tuple()"},{"col":0,"comment":"null","endLoc":273,"header":"def encode_ascii(s)","id":934,"name":"encode_ascii","nodeType":"Function","startLoc":261,"text":"def encode_ascii(s):\n    if isinstance(s, str):\n        return s.encode('ascii')\n    elif (isinstance(s, np.ndarray) and\n          issubclass(s.dtype.type, np.str_)):\n        ns = np.char.encode(s, 'ascii').view(type(s))\n        if ns.dtype.itemsize != s.dtype.itemsize / 4:\n            ns = ns.astype((np.bytes_, s.dtype.itemsize / 4))\n        return ns\n    elif (isinstance(s, np.ndarray) and\n          not issubclass(s.dtype.type, np.bytes_)):\n        raise TypeError('string operation on non-string array')\n    return s"},{"col":0,"comment":"null","endLoc":14,"header":"def rec_getattr(obj, att)","id":935,"name":"rec_getattr","nodeType":"Function","startLoc":11,"text":"def rec_getattr(obj, att):\n    for a in att.split('.'):\n        obj = getattr(obj, a)\n    return obj"},{"col":4,"comment":"null","endLoc":329,"header":"def pixel_to_world(self, *pixel_arrays)","id":936,"name":"pixel_to_world","nodeType":"Function","startLoc":316,"text":"def pixel_to_world(self, *pixel_arrays):\n\n        # Compute the world coordinate values\n        world_values = self.low_level_wcs.pixel_to_world_values(*pixel_arrays)\n\n        if self.world_n_dim == 1:\n            world_values = (world_values,)\n\n        pixel_values = values_to_high_level_objects(*world_values, low_level_wcs=self.low_level_wcs)\n\n        if len(pixel_values) == 1:\n            return pixel_values[0]\n        else:\n            return pixel_values"},{"col":0,"comment":"\n    Convert low level values into high level objects.\n\n    This function uses the information in ``wcs.world_axis_object_classes`` and\n    ``wcs.world_axis_object_components`` to convert low level \"values\"\n    `~.Quantity` objects, to high level objects (such as `~.SkyCoord).\n\n    This is used in `.HighLevelWCSMixin.pixel_to_world`, but provided as a\n    separate function for use in other places where needed.\n\n    Parameters\n    ----------\n    *world_values: object\n        Low level, \"values\" representations of the world coordinates.\n\n    low_level_wcs: `.BaseLowLevelWCS`\n        The WCS object to use to interpret the coordinates.\n    ","endLoc":293,"header":"def values_to_high_level_objects(*world_values, low_level_wcs)","id":937,"name":"values_to_high_level_objects","nodeType":"Function","startLoc":240,"text":"def values_to_high_level_objects(*world_values, low_level_wcs):\n    \"\"\"\n    Convert low level values into high level objects.\n\n    This function uses the information in ``wcs.world_axis_object_classes`` and\n    ``wcs.world_axis_object_components`` to convert low level \"values\"\n    `~.Quantity` objects, to high level objects (such as `~.SkyCoord).\n\n    This is used in `.HighLevelWCSMixin.pixel_to_world`, but provided as a\n    separate function for use in other places where needed.\n\n    Parameters\n    ----------\n    *world_values: object\n        Low level, \"values\" representations of the world coordinates.\n\n    low_level_wcs: `.BaseLowLevelWCS`\n        The WCS object to use to interpret the coordinates.\n    \"\"\"\n    # Cache the classes and components since this may be expensive\n    components = low_level_wcs.world_axis_object_components\n    classes = low_level_wcs.world_axis_object_classes\n\n    # Deserialize classes\n    if low_level_wcs.serialized_classes:\n        classes_new = {}\n        for key, value in classes.items():\n            classes_new[key] = deserialize_class(value, construct=False)\n        classes = classes_new\n\n    args = defaultdict(list)\n    kwargs = defaultdict(dict)\n\n    for i, (key, attr, _) in enumerate(components):\n        if isinstance(attr, str):\n            kwargs[key][attr] = world_values[i]\n        else:\n            while attr > len(args[key]) - 1:\n                args[key].append(None)\n            args[key][attr] = world_values[i]\n\n    result = []\n\n    for key in default_order(components):\n        klass, ar, kw, *rest = classes[key]\n        if len(rest) == 0:\n            klass_gen = klass\n        elif len(rest) == 1:\n            klass_gen = rest[0]\n        else:\n            raise ValueError(\"Tuples in world_axis_object_classes should have length 3 or 4\")\n        result.append(klass_gen(*args[key], *ar, **kwargs[key], **kw))\n\n    return result"},{"col":4,"comment":"null","endLoc":204,"header":"@property\n    def pixel_n_dim(self)","id":938,"name":"pixel_n_dim","nodeType":"Function","startLoc":202,"text":"@property\n    def pixel_n_dim(self):\n        return self.naxis"},{"col":4,"comment":"null","endLoc":208,"header":"@property\n    def world_n_dim(self)","id":939,"name":"world_n_dim","nodeType":"Function","startLoc":206,"text":"@property\n    def world_n_dim(self):\n        return len(self.wcs.ctype)"},{"col":4,"comment":"null","endLoc":215,"header":"@property\n    def array_shape(self)","id":940,"name":"array_shape","nodeType":"Function","startLoc":210,"text":"@property\n    def array_shape(self):\n        if self.pixel_shape is None:\n            return None\n        else:\n            return self.pixel_shape[::-1]"},{"col":4,"comment":"null","endLoc":222,"header":"@array_shape.setter\n    def array_shape(self, value)","id":941,"name":"array_shape","nodeType":"Function","startLoc":217,"text":"@array_shape.setter\n    def array_shape(self, value):\n        if value is None:\n            self.pixel_shape = None\n        else:\n            self.pixel_shape = value[::-1]"},{"col":4,"comment":"null","endLoc":229,"header":"@property\n    def pixel_shape(self)","id":942,"name":"pixel_shape","nodeType":"Function","startLoc":224,"text":"@property\n    def pixel_shape(self):\n        if self._naxis == [0, 0]:\n            return None\n        else:\n            return tuple(self._naxis)"},{"col":4,"comment":"null","endLoc":240,"header":"@pixel_shape.setter\n    def pixel_shape(self, value)","id":943,"name":"pixel_shape","nodeType":"Function","startLoc":231,"text":"@pixel_shape.setter\n    def pixel_shape(self, value):\n        if value is None:\n            self._naxis = [0, 0]\n        else:\n            if len(value) != self.naxis:\n                raise ValueError(\"The number of data axes, \"\n                                 \"{}, does not equal the \"\n                                 \"shape {}.\".format(self.naxis, len(value)))\n            self._naxis = list(value)"},{"col":4,"comment":"null","endLoc":602,"header":"def _verify_blank(self)","id":944,"name":"_verify_blank","nodeType":"Function","startLoc":578,"text":"def _verify_blank(self):\n        # Probably not the best place for this (it should probably happen\n        # in _verify as well) but I want to be able to raise this warning\n        # both when the HDU is created and when written\n        if self._blank is None:\n            return\n\n        messages = []\n        # TODO: Once the FITSSchema framewhere is merged these warnings\n        # should be handled by the schema\n        if not _is_int(self._blank):\n            messages.append(\n                \"Invalid value for 'BLANK' keyword in header: {!r} \"\n                \"The 'BLANK' keyword must be an integer.  It will be \"\n                \"ignored in the meantime.\".format(self._blank))\n            self._blank = None\n        if not self._bitpix > 0:\n            messages.append(\n                \"Invalid 'BLANK' keyword in header.  The 'BLANK' keyword \"\n                \"is only applicable to integer data, and will be ignored \"\n                \"in this HDU.\")\n            self._blank = None\n\n        for msg in messages:\n            warnings.warn(msg, VerifyWarning)"},{"col":4,"comment":"null","endLoc":244,"header":"@property\n    def pixel_bounds(self)","id":945,"name":"pixel_bounds","nodeType":"Function","startLoc":242,"text":"@property\n    def pixel_bounds(self):\n        return self._pixel_bounds"},{"col":4,"comment":"null","endLoc":255,"header":"@pixel_bounds.setter\n    def pixel_bounds(self, value)","id":946,"name":"pixel_bounds","nodeType":"Function","startLoc":246,"text":"@pixel_bounds.setter\n    def pixel_bounds(self, value):\n        if value is None:\n            self._pixel_bounds = value\n        else:\n            if len(value) != self.naxis:\n                raise ValueError(\"The number of data axes, \"\n                                 \"{}, does not equal the number of \"\n                                 \"pixel bounds {}.\".format(self.naxis, len(value)))\n            self._pixel_bounds = list(value)"},{"col":4,"comment":"Open a FITS file from a filename string.","endLoc":566,"header":"def _open_filename(self, filename, mode, overwrite)","id":947,"name":"_open_filename","nodeType":"Function","startLoc":544,"text":"def _open_filename(self, filename, mode, overwrite):\n        \"\"\"Open a FITS file from a filename string.\"\"\"\n\n        if mode == 'ostream':\n            self._overwrite_existing(overwrite, None, True)\n\n        if os.path.exists(self.name):\n            with fileobj_open(self.name, 'rb') as f:\n                magic = f.read(4)\n        else:\n            magic = b''\n\n        ext = os.path.splitext(self.name)[1]\n\n        if not self._try_read_compressed(self.name, magic, mode, ext=ext):\n            self._file = fileobj_open(self.name, IO_FITS_MODES[mode])\n            self.close_on_error = True\n\n        # Make certain we're back at the beginning of the file\n        # BZ2File does not support seek when the file is open for writing, but\n        # when opening a file for write, bz2.BZ2File always truncates anyway.\n        if not (_is_bz2file(self._file) and mode == 'ostream'):\n            self._file.seek(0)"},{"col":4,"comment":"null","endLoc":272,"header":"@property\n    def world_axis_physical_types(self)","id":948,"name":"world_axis_physical_types","nodeType":"Function","startLoc":257,"text":"@property\n    def world_axis_physical_types(self):\n        types = []\n        # TODO: need to support e.g. TT(TAI)\n        for ctype in self.wcs.ctype:\n            if ctype.upper().startswith(('UT(', 'TT(')):\n                types.append('time')\n            else:\n                ctype_name = ctype.split('-')[0]\n                for custom_mapping in CTYPE_TO_UCD1_CUSTOM:\n                    if ctype_name in custom_mapping:\n                        types.append(custom_mapping[ctype_name])\n                        break\n                else:\n                    types.append(CTYPE_TO_UCD1.get(ctype_name.upper(), None))\n        return types"},{"col":0,"comment":"null","endLoc":309,"header":"def decode_ascii(s)","id":949,"name":"decode_ascii","nodeType":"Function","startLoc":276,"text":"def decode_ascii(s):\n    if isinstance(s, bytes):\n        try:\n            return s.decode('ascii')\n        except UnicodeDecodeError:\n            warnings.warn('non-ASCII characters are present in the FITS '\n                          'file header and have been replaced by \"?\" '\n                          'characters', AstropyUserWarning)\n            s = s.decode('ascii', errors='replace')\n            return s.replace('\\ufffd', '?')\n    elif (isinstance(s, np.ndarray) and\n          issubclass(s.dtype.type, np.bytes_)):\n        # np.char.encode/decode annoyingly don't preserve the type of the\n        # array, hence the view() call\n        # It also doesn't necessarily preserve widths of the strings,\n        # hence the astype()\n        if s.size == 0:\n            # Numpy apparently also has a bug that if a string array is\n            # empty calling np.char.decode on it returns an empty float64\n            # array wth\n            dt = s.dtype.str.replace('S', 'U')\n            ns = np.array([], dtype=dt).view(type(s))\n        else:\n            ns = np.char.decode(s, 'ascii').view(type(s))\n        if ns.dtype.itemsize / 4 != s.dtype.itemsize:\n            ns = ns.astype((np.str_, s.dtype.itemsize))\n        return ns\n    elif (isinstance(s, np.ndarray) and\n          not issubclass(s.dtype.type, np.str_)):\n        # Don't silently pass through on non-string arrays; we don't want\n        # to hide errors where things that are not stringy are attempting\n        # to be decoded\n        raise TypeError('string operation on non-string array')\n    return s"},{"col":0,"comment":"null","endLoc":86,"header":"def _is_bz2file(fileobj)","id":950,"name":"_is_bz2file","nodeType":"Function","startLoc":82,"text":"def _is_bz2file(fileobj):\n    if HAS_BZ2:\n        return isinstance(fileobj, bz2.BZ2File)\n    else:\n        return False"},{"col":4,"comment":"null","endLoc":288,"header":"@property\n    def world_axis_units(self)","id":951,"name":"world_axis_units","nodeType":"Function","startLoc":274,"text":"@property\n    def world_axis_units(self):\n        units = []\n        for unit in self.wcs.cunit:\n            if unit is None:\n                unit = ''\n            elif isinstance(unit, u.Unit):\n                unit = unit.to_string(format='vounit')\n            else:\n                try:\n                    unit = u.Unit(unit).to_string(format='vounit')\n                except u.UnitsError:\n                    unit = ''\n            units.append(unit)\n        return units"},{"col":4,"comment":"Open a FITS file from a file-like object, i.e. one that has\n        read and/or write methods.\n        ","endLoc":542,"header":"def _open_filelike(self, fileobj, mode, overwrite)","id":952,"name":"_open_filelike","nodeType":"Function","startLoc":506,"text":"def _open_filelike(self, fileobj, mode, overwrite):\n        \"\"\"Open a FITS file from a file-like object, i.e. one that has\n        read and/or write methods.\n        \"\"\"\n\n        self.file_like = True\n        self._file = fileobj\n\n        if fileobj_closed(fileobj):\n            raise OSError(\"Cannot read from/write to a closed file-like \"\n                          \"object ({!r}).\".format(fileobj))\n\n        if isinstance(fileobj, zipfile.ZipFile):\n            self._open_zipfile(fileobj, mode)\n            # We can bypass any additional checks at this point since now\n            # self._file points to the temp file extracted from the zip\n            return\n\n        # If there is not seek or tell methods then set the mode to\n        # output streaming.\n        if (not hasattr(self._file, 'seek') or\n                not hasattr(self._file, 'tell')):\n            self.mode = mode = 'ostream'\n\n        if mode == 'ostream':\n            self._overwrite_existing(overwrite, fileobj, False)\n\n        # Any \"writeable\" mode requires a write() method on the file object\n        if (self.mode in ('update', 'append', 'ostream') and\n                not hasattr(self._file, 'write')):\n            raise OSError(\"File-like object does not have a 'write' \"\n                          \"method, required for mode '{}'.\".format(self.mode))\n\n        # Any mode except for 'ostream' requires readability\n        if self.mode != 'ostream' and not hasattr(self._file, 'read'):\n            raise OSError(\"File-like object does not have a 'read' \"\n                          \"method, required for mode {!r}.\".format(self.mode))"},{"col":4,"comment":"\n        Iterate the nested structure as a list of strings with appropriate\n        indentations for each level of structure.\n        ","endLoc":171,"header":"def iter_lines(self, filter=None, shift=0)","id":953,"name":"iter_lines","nodeType":"Function","startLoc":136,"text":"def iter_lines(self, filter=None, shift=0):\n        \"\"\"\n        Iterate the nested structure as a list of strings with appropriate\n        indentations for each level of structure.\n        \"\"\"\n\n        element = 0\n        # go through the list twice, first time print out all top level\n        # messages\n        for item in self:\n            if not isinstance(item, _ErrList):\n                if filter is None or filter(item):\n                    yield item[0], indent(item[1], shift=shift)\n\n        # second time go through the next level items, each of the next level\n        # must present, even it has nothing.\n        for item in self:\n            if isinstance(item, _ErrList):\n                next_lines = item.iter_lines(filter=filter, shift=shift + 1)\n                try:\n                    first_line = next(next_lines)\n                except StopIteration:\n                    first_line = None\n\n                if first_line is not None:\n                    if self.unit:\n                        # This line is sort of a header for the next level in\n                        # the hierarchy\n                        yield None, indent(f'{self.unit} {element}:',\n                                           shift=shift)\n                    yield first_line\n\n                for line in next_lines:\n                    yield line\n\n                element += 1"},{"attributeType":"null","col":8,"comment":"null","endLoc":131,"id":954,"name":"unit","nodeType":"Attribute","startLoc":131,"text":"self.unit"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":955,"name":"VERIFY_OPTIONS","nodeType":"Attribute","startLoc":22,"text":"VERIFY_OPTIONS"},{"col":4,"comment":"\n        Parameters\n        ----------\n        input\n            a sequence of variable-sized elements.\n        ","endLoc":1988,"header":"def __new__(cls, input, dtype='a')","id":956,"name":"__new__","nodeType":"Function","startLoc":1966,"text":"def __new__(cls, input, dtype='a'):\n        \"\"\"\n        Parameters\n        ----------\n        input\n            a sequence of variable-sized elements.\n        \"\"\"\n\n        if dtype == 'a':\n            try:\n                # this handles ['abc'] and [['a','b','c']]\n                # equally, beautiful!\n                input = [chararray.array(x, itemsize=1) for x in input]\n            except Exception:\n                raise ValueError(\n                    f'Inconsistent input data array: {input}')\n\n        a = np.array(input, dtype=object)\n        self = np.ndarray.__new__(cls, shape=(len(input),), buffer=a,\n                                  dtype=object)\n        self.max = 0\n        self.element_dtype = dtype\n        return self"},{"col":0,"comment":"","endLoc":3,"header":"verify.py#<anonymous>","id":957,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"VERIFY_OPTIONS = ['ignore', 'warn', 'exception', 'fix', 'silentfix',\n                  'fix+ignore', 'fix+warn', 'fix+exception',\n                  'silentfix+ignore', 'silentfix+warn', 'silentfix+exception']"},{"col":4,"comment":"null","endLoc":292,"header":"@property\n    def world_axis_names(self)","id":958,"name":"world_axis_names","nodeType":"Function","startLoc":290,"text":"@property\n    def world_axis_names(self):\n        return list(self.wcs.cname)"},{"col":4,"comment":"null","endLoc":319,"header":"@property\n    def axis_correlation_matrix(self)","id":959,"name":"axis_correlation_matrix","nodeType":"Function","startLoc":294,"text":"@property\n    def axis_correlation_matrix(self):\n\n        # If there are any distortions present, we assume that there may be\n        # correlations between all axes. Maybe if some distortions only apply\n        # to the image plane we can improve this?\n        if self.has_distortion:\n            return np.ones((self.world_n_dim, self.pixel_n_dim), dtype=bool)\n\n        # Assuming linear world coordinates along each axis, the correlation\n        # matrix would be given by whether or not the PC matrix is zero\n        matrix = self.wcs.get_pc() != 0\n\n        # We now need to check specifically for celestial coordinates since\n        # these can assume correlations because of spherical distortions. For\n        # each celestial coordinate we copy over the pixel dependencies from\n        # the other celestial coordinates.\n        celestial = (self.wcs.axis_types // 1000) % 10 == 2\n        celestial_indices = np.nonzero(celestial)[0]\n        for world1 in celestial_indices:\n            for world2 in celestial_indices:\n                if world1 != world2:\n                    matrix[world1] |= matrix[world2]\n                    matrix[world2] |= matrix[world1]\n\n        return matrix"},{"fileName":"util.py","filePath":"astropy/io/fits","id":960,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport gzip\nimport itertools\nimport io\nimport mmap\nimport operator\nimport os\nimport platform\nimport signal\nimport sys\nimport tempfile\nimport textwrap\nimport threading\nimport warnings\nimport weakref\nfrom contextlib import contextmanager, suppress\nfrom functools import wraps\n\nimport numpy as np\nfrom packaging.version import Version\n\nfrom astropy.utils import data\nfrom astropy.utils.exceptions import AstropyUserWarning\n\npath_like = (str, os.PathLike)\n\ncmp = lambda a, b: (a > b) - (a < b)\n\nall_integer_types = (int, np.integer)\n\n\nclass NotifierMixin:\n    \"\"\"\n    Mixin class that provides services by which objects can register\n    listeners to changes on that object.\n\n    All methods provided by this class are underscored, since this is intended\n    for internal use to communicate between classes in a generic way, and is\n    not machinery that should be exposed to users of the classes involved.\n\n    Use the ``_add_listener`` method to register a listener on an instance of\n    the notifier.  This registers the listener with a weak reference, so if\n    no other references to the listener exist it is automatically dropped from\n    the list and does not need to be manually removed.\n\n    Call the ``_notify`` method on the notifier to update all listeners\n    upon changes.  ``_notify('change_type', *args, **kwargs)`` results\n    in calling ``listener._update_change_type(*args, **kwargs)`` on all\n    listeners subscribed to that notifier.\n\n    If a particular listener does not have the appropriate update method\n    it is ignored.\n\n    Examples\n    --------\n\n    >>> class Widget(NotifierMixin):\n    ...     state = 1\n    ...     def __init__(self, name):\n    ...         self.name = name\n    ...     def update_state(self):\n    ...         self.state += 1\n    ...         self._notify('widget_state_changed', self)\n    ...\n    >>> class WidgetListener:\n    ...     def _update_widget_state_changed(self, widget):\n    ...         print('Widget {0} changed state to {1}'.format(\n    ...             widget.name, widget.state))\n    ...\n    >>> widget = Widget('fred')\n    >>> listener = WidgetListener()\n    >>> widget._add_listener(listener)\n    >>> widget.update_state()\n    Widget fred changed state to 2\n    \"\"\"\n\n    _listeners = None\n\n    def _add_listener(self, listener):\n        \"\"\"\n        Add an object to the list of listeners to notify of changes to this\n        object.  This adds a weakref to the list of listeners that is\n        removed from the listeners list when the listener has no other\n        references to it.\n        \"\"\"\n\n        if self._listeners is None:\n            self._listeners = weakref.WeakValueDictionary()\n\n        self._listeners[id(listener)] = listener\n\n    def _remove_listener(self, listener):\n        \"\"\"\n        Removes the specified listener from the listeners list.  This relies\n        on object identity (i.e. the ``is`` operator).\n        \"\"\"\n\n        if self._listeners is None:\n            return\n\n        with suppress(KeyError):\n            del self._listeners[id(listener)]\n\n    def _notify(self, notification, *args, **kwargs):\n        \"\"\"\n        Notify all listeners of some particular state change by calling their\n        ``_update_<notification>`` method with the given ``*args`` and\n        ``**kwargs``.\n\n        The notification does not by default include the object that actually\n        changed (``self``), but it certainly may if required.\n        \"\"\"\n\n        if self._listeners is None:\n            return\n\n        method_name = f'_update_{notification}'\n        for listener in self._listeners.valuerefs():\n            # Use valuerefs instead of itervaluerefs; see\n            # https://github.com/astropy/astropy/issues/4015\n            listener = listener()  # dereference weakref\n            if listener is None:\n                continue\n\n            if hasattr(listener, method_name):\n                method = getattr(listener, method_name)\n                if callable(method):\n                    method(*args, **kwargs)\n\n    def __getstate__(self):\n        \"\"\"\n        Exclude listeners when saving the listener's state, since they may be\n        ephemeral.\n        \"\"\"\n\n        # TODO: This hasn't come up often, but if anyone needs to pickle HDU\n        # objects it will be necessary when HDU objects' states are restored to\n        # re-register themselves as listeners on their new column instances.\n        try:\n            state = super().__getstate__()\n        except AttributeError:\n            # Chances are the super object doesn't have a getstate\n            state = self.__dict__.copy()\n\n        state['_listeners'] = None\n        return state\n\n\ndef first(iterable):\n    \"\"\"\n    Returns the first item returned by iterating over an iterable object.\n\n    Example:\n\n    >>> a = [1, 2, 3]\n    >>> first(a)\n    1\n    \"\"\"\n\n    return next(iter(iterable))\n\n\ndef itersubclasses(cls, _seen=None):\n    \"\"\"\n    Generator over all subclasses of a given class, in depth first order.\n\n    >>> class A: pass\n    >>> class B(A): pass\n    >>> class C(A): pass\n    >>> class D(B,C): pass\n    >>> class E(D): pass\n    >>>\n    >>> for cls in itersubclasses(A):\n    ...     print(cls.__name__)\n    B\n    D\n    E\n    C\n    >>> # get ALL classes currently defined\n    >>> [cls.__name__ for cls in itersubclasses(object)]\n    [...'tuple', ...'type', ...]\n\n    From http://code.activestate.com/recipes/576949/\n    \"\"\"\n\n    if _seen is None:\n        _seen = set()\n    try:\n        subs = cls.__subclasses__()\n    except TypeError:  # fails only when cls is type\n        subs = cls.__subclasses__(cls)\n    for sub in sorted(subs, key=operator.attrgetter('__name__')):\n        if sub not in _seen:\n            _seen.add(sub)\n            yield sub\n            for sub in itersubclasses(sub, _seen):\n                yield sub\n\n\ndef ignore_sigint(func):\n    \"\"\"\n    This decorator registers a custom SIGINT handler to catch and ignore SIGINT\n    until the wrapped function is completed.\n    \"\"\"\n\n    @wraps(func)\n    def wrapped(*args, **kwargs):\n        # Get the name of the current thread and determine if this is a single\n        # threaded application\n        curr_thread = threading.current_thread()\n        single_thread = (threading.active_count() == 1 and\n                         curr_thread.name == 'MainThread')\n\n        class SigintHandler:\n            def __init__(self):\n                self.sigint_received = False\n\n            def __call__(self, signum, frame):\n                warnings.warn('KeyboardInterrupt ignored until {} is '\n                              'complete!'.format(func.__name__),\n                              AstropyUserWarning)\n                self.sigint_received = True\n\n        sigint_handler = SigintHandler()\n\n        # Define new signal interput handler\n        if single_thread:\n            # Install new handler\n            old_handler = signal.signal(signal.SIGINT, sigint_handler)\n\n        try:\n            func(*args, **kwargs)\n        finally:\n            if single_thread:\n                if old_handler is not None:\n                    signal.signal(signal.SIGINT, old_handler)\n                else:\n                    signal.signal(signal.SIGINT, signal.SIG_DFL)\n\n                if sigint_handler.sigint_received:\n                    raise KeyboardInterrupt\n\n    return wrapped\n\n\ndef pairwise(iterable):\n    \"\"\"Return the items of an iterable paired with its next item.\n\n    Ex: s -> (s0,s1), (s1,s2), (s2,s3), ....\n    \"\"\"\n\n    a, b = itertools.tee(iterable)\n    for _ in b:\n        # Just a little trick to advance b without having to catch\n        # StopIter if b happens to be empty\n        break\n    return zip(a, b)\n\n\ndef encode_ascii(s):\n    if isinstance(s, str):\n        return s.encode('ascii')\n    elif (isinstance(s, np.ndarray) and\n          issubclass(s.dtype.type, np.str_)):\n        ns = np.char.encode(s, 'ascii').view(type(s))\n        if ns.dtype.itemsize != s.dtype.itemsize / 4:\n            ns = ns.astype((np.bytes_, s.dtype.itemsize / 4))\n        return ns\n    elif (isinstance(s, np.ndarray) and\n          not issubclass(s.dtype.type, np.bytes_)):\n        raise TypeError('string operation on non-string array')\n    return s\n\n\ndef decode_ascii(s):\n    if isinstance(s, bytes):\n        try:\n            return s.decode('ascii')\n        except UnicodeDecodeError:\n            warnings.warn('non-ASCII characters are present in the FITS '\n                          'file header and have been replaced by \"?\" '\n                          'characters', AstropyUserWarning)\n            s = s.decode('ascii', errors='replace')\n            return s.replace('\\ufffd', '?')\n    elif (isinstance(s, np.ndarray) and\n          issubclass(s.dtype.type, np.bytes_)):\n        # np.char.encode/decode annoyingly don't preserve the type of the\n        # array, hence the view() call\n        # It also doesn't necessarily preserve widths of the strings,\n        # hence the astype()\n        if s.size == 0:\n            # Numpy apparently also has a bug that if a string array is\n            # empty calling np.char.decode on it returns an empty float64\n            # array wth\n            dt = s.dtype.str.replace('S', 'U')\n            ns = np.array([], dtype=dt).view(type(s))\n        else:\n            ns = np.char.decode(s, 'ascii').view(type(s))\n        if ns.dtype.itemsize / 4 != s.dtype.itemsize:\n            ns = ns.astype((np.str_, s.dtype.itemsize))\n        return ns\n    elif (isinstance(s, np.ndarray) and\n          not issubclass(s.dtype.type, np.str_)):\n        # Don't silently pass through on non-string arrays; we don't want\n        # to hide errors where things that are not stringy are attempting\n        # to be decoded\n        raise TypeError('string operation on non-string array')\n    return s\n\n\ndef isreadable(f):\n    \"\"\"\n    Returns True if the file-like object can be read from.  This is a common-\n    sense approximation of io.IOBase.readable.\n    \"\"\"\n\n    if hasattr(f, 'readable'):\n        return f.readable()\n\n    if hasattr(f, 'closed') and f.closed:\n        # This mimics the behavior of io.IOBase.readable\n        raise ValueError('I/O operation on closed file')\n\n    if not hasattr(f, 'read'):\n        return False\n\n    if hasattr(f, 'mode') and not any(c in f.mode for c in 'r+'):\n        return False\n\n    # Not closed, has a 'read()' method, and either has no known mode or a\n    # readable mode--should be good enough to assume 'readable'\n    return True\n\n\ndef iswritable(f):\n    \"\"\"\n    Returns True if the file-like object can be written to.  This is a common-\n    sense approximation of io.IOBase.writable.\n    \"\"\"\n\n    if hasattr(f, 'writable'):\n        return f.writable()\n\n    if hasattr(f, 'closed') and f.closed:\n        # This mimics the behavior of io.IOBase.writable\n        raise ValueError('I/O operation on closed file')\n\n    if not hasattr(f, 'write'):\n        return False\n\n    if hasattr(f, 'mode') and not any(c in f.mode for c in 'wa+'):\n        return False\n\n    # Note closed, has a 'write()' method, and either has no known mode or a\n    # mode that supports writing--should be good enough to assume 'writable'\n    return True\n\n\ndef isfile(f):\n    \"\"\"\n    Returns True if the given object represents an OS-level file (that is,\n    ``isinstance(f, file)``).\n\n    On Python 3 this also returns True if the given object is higher level\n    wrapper on top of a FileIO object, such as a TextIOWrapper.\n    \"\"\"\n\n    if isinstance(f, io.FileIO):\n        return True\n    elif hasattr(f, 'buffer'):\n        return isfile(f.buffer)\n    elif hasattr(f, 'raw'):\n        return isfile(f.raw)\n    return False\n\n\ndef fileobj_open(filename, mode):\n    \"\"\"\n    A wrapper around the `open()` builtin.\n\n    This exists because `open()` returns an `io.BufferedReader` by default.\n    This is bad, because `io.BufferedReader` doesn't support random access,\n    which we need in some cases.  We must call open with buffering=0 to get\n    a raw random-access file reader.\n    \"\"\"\n\n    return open(filename, mode, buffering=0)\n\n\ndef fileobj_name(f):\n    \"\"\"\n    Returns the 'name' of file-like object *f*, if it has anything that could be\n    called its name.  Otherwise f's class or type is returned.  If f is a\n    string f itself is returned.\n    \"\"\"\n\n    if isinstance(f, (str, bytes)):\n        return f\n    elif isinstance(f, gzip.GzipFile):\n        # The .name attribute on GzipFiles does not always represent the name\n        # of the file being read/written--it can also represent the original\n        # name of the file being compressed\n        # See the documentation at\n        # https://docs.python.org/3/library/gzip.html#gzip.GzipFile\n        # As such, for gzip files only return the name of the underlying\n        # fileobj, if it exists\n        return fileobj_name(f.fileobj)\n    elif hasattr(f, 'name'):\n        return f.name\n    elif hasattr(f, 'filename'):\n        return f.filename\n    elif hasattr(f, '__class__'):\n        return str(f.__class__)\n    else:\n        return str(type(f))\n\n\ndef fileobj_closed(f):\n    \"\"\"\n    Returns True if the given file-like object is closed or if *f* is a string\n    (and assumed to be a pathname).\n\n    Returns False for all other types of objects, under the assumption that\n    they are file-like objects with no sense of a 'closed' state.\n    \"\"\"\n\n    if isinstance(f, path_like):\n        return True\n\n    if hasattr(f, 'closed'):\n        return f.closed\n    elif hasattr(f, 'fileobj') and hasattr(f.fileobj, 'closed'):\n        return f.fileobj.closed\n    elif hasattr(f, 'fp') and hasattr(f.fp, 'closed'):\n        return f.fp.closed\n    else:\n        return False\n\n\ndef fileobj_mode(f):\n    \"\"\"\n    Returns the 'mode' string of a file-like object if such a thing exists.\n    Otherwise returns None.\n    \"\"\"\n\n    # Go from most to least specific--for example gzip objects have a 'mode'\n    # attribute, but it's not analogous to the file.mode attribute\n\n    # gzip.GzipFile -like\n    if hasattr(f, 'fileobj') and hasattr(f.fileobj, 'mode'):\n        fileobj = f.fileobj\n\n    # astropy.io.fits._File -like, doesn't need additional checks because it's\n    # already validated\n    elif hasattr(f, 'fileobj_mode'):\n        return f.fileobj_mode\n\n    # PIL-Image -like investigate the fp (filebuffer)\n    elif hasattr(f, 'fp') and hasattr(f.fp, 'mode'):\n        fileobj = f.fp\n\n    # FILEIO -like (normal open(...)), keep as is.\n    elif hasattr(f, 'mode'):\n        fileobj = f\n\n    # Doesn't look like a file-like object, for example strings, urls or paths.\n    else:\n        return None\n\n    return _fileobj_normalize_mode(fileobj)\n\n\ndef _fileobj_normalize_mode(f):\n    \"\"\"Takes care of some corner cases in Python where the mode string\n    is either oddly formatted or does not truly represent the file mode.\n    \"\"\"\n    mode = f.mode\n\n    # Special case: Gzip modes:\n    if isinstance(f, gzip.GzipFile):\n        # GzipFiles can be either readonly or writeonly\n        if mode == gzip.READ:\n            return 'rb'\n        elif mode == gzip.WRITE:\n            return 'wb'\n        else:\n            return None  # This shouldn't happen?\n\n    # Sometimes Python can produce modes like 'r+b' which will be normalized\n    # here to 'rb+'\n    if '+' in mode:\n        mode = mode.replace('+', '')\n        mode += '+'\n\n    return mode\n\n\ndef fileobj_is_binary(f):\n    \"\"\"\n    Returns True if the give file or file-like object has a file open in binary\n    mode.  When in doubt, returns True by default.\n    \"\"\"\n\n    # This is kind of a hack for this to work correctly with _File objects,\n    # which, for the time being, are *always* binary\n    if hasattr(f, 'binary'):\n        return f.binary\n\n    if isinstance(f, io.TextIOBase):\n        return False\n\n    mode = fileobj_mode(f)\n    if mode:\n        return 'b' in mode\n    else:\n        return True\n\n\ndef translate(s, table, deletechars):\n    if deletechars:\n        table = table.copy()\n        for c in deletechars:\n            table[ord(c)] = None\n    return s.translate(table)\n\n\ndef fill(text, width, **kwargs):\n    \"\"\"\n    Like :func:`textwrap.wrap` but preserves existing paragraphs which\n    :func:`textwrap.wrap` does not otherwise handle well.  Also handles section\n    headers.\n    \"\"\"\n\n    paragraphs = text.split('\\n\\n')\n\n    def maybe_fill(t):\n        if all(len(l) < width for l in t.splitlines()):\n            return t\n        else:\n            return textwrap.fill(t, width, **kwargs)\n\n    return '\\n\\n'.join(maybe_fill(p) for p in paragraphs)\n\n\n# On MacOS X 10.8 and earlier, there is a bug that causes numpy.fromfile to\n# fail when reading over 2Gb of data. If we detect these versions of MacOS X,\n# we can instead read the data in chunks. To avoid performance penalties at\n# import time, we defer the setting of this global variable until the first\n# time it is needed.\nCHUNKED_FROMFILE = None\n\n\ndef _array_from_file(infile, dtype, count):\n    \"\"\"Create a numpy array from a file or a file-like object.\"\"\"\n\n    if isfile(infile):\n\n        global CHUNKED_FROMFILE\n        if CHUNKED_FROMFILE is None:\n            if (sys.platform == 'darwin' and\n                    Version(platform.mac_ver()[0]) < Version('10.9')):\n                CHUNKED_FROMFILE = True\n            else:\n                CHUNKED_FROMFILE = False\n\n        if CHUNKED_FROMFILE:\n            chunk_size = int(1024 ** 3 / dtype.itemsize)  # 1Gb to be safe\n            if count < chunk_size:\n                return np.fromfile(infile, dtype=dtype, count=count)\n            else:\n                array = np.empty(count, dtype=dtype)\n                for beg in range(0, count, chunk_size):\n                    end = min(count, beg + chunk_size)\n                    array[beg:end] = np.fromfile(infile, dtype=dtype, count=end - beg)\n                return array\n        else:\n            return np.fromfile(infile, dtype=dtype, count=count)\n    else:\n        # treat as file-like object with \"read\" method; this includes gzip file\n        # objects, because numpy.fromfile just reads the compressed bytes from\n        # their underlying file object, instead of the decompressed bytes\n        read_size = np.dtype(dtype).itemsize * count\n        s = infile.read(read_size)\n        array = np.ndarray(buffer=s, dtype=dtype, shape=(count,))\n        # copy is needed because np.frombuffer returns a read-only view of the\n        # underlying buffer\n        array = array.copy()\n        return array\n\n\n_OSX_WRITE_LIMIT = (2 ** 32) - 1\n_WIN_WRITE_LIMIT = (2 ** 31) - 1\n\n\ndef _array_to_file(arr, outfile):\n    \"\"\"\n    Write a numpy array to a file or a file-like object.\n\n    Parameters\n    ----------\n    arr : ndarray\n        The Numpy array to write.\n    outfile : file-like\n        A file-like object such as a Python file object, an `io.BytesIO`, or\n        anything else with a ``write`` method.  The file object must support\n        the buffer interface in its ``write``.\n\n    If writing directly to an on-disk file this delegates directly to\n    `ndarray.tofile`.  Otherwise a slower Python implementation is used.\n    \"\"\"\n\n    if isfile(outfile) and not isinstance(outfile, io.BufferedIOBase):\n        write = lambda a, f: a.tofile(f)\n    else:\n        write = _array_to_file_like\n\n    # Implements a workaround for a bug deep in OSX's stdlib file writing\n    # functions; on 64-bit OSX it is not possible to correctly write a number\n    # of bytes greater than 2 ** 32 and divisible by 4096 (or possibly 8192--\n    # whatever the default blocksize for the filesystem is).\n    # This issue should have a workaround in Numpy too, but hasn't been\n    # implemented there yet: https://github.com/astropy/astropy/issues/839\n    #\n    # Apparently Windows has its own fwrite bug:\n    # https://github.com/numpy/numpy/issues/2256\n\n    if (sys.platform == 'darwin' and arr.nbytes >= _OSX_WRITE_LIMIT + 1 and\n            arr.nbytes % 4096 == 0):\n        # chunksize is a count of elements in the array, not bytes\n        chunksize = _OSX_WRITE_LIMIT // arr.itemsize\n    elif sys.platform.startswith('win'):\n        chunksize = _WIN_WRITE_LIMIT // arr.itemsize\n    else:\n        # Just pass the whole array to the write routine\n        return write(arr, outfile)\n\n    # Write one chunk at a time for systems whose fwrite chokes on large\n    # writes.\n    idx = 0\n    arr = arr.view(np.ndarray).flatten()\n    while idx < arr.nbytes:\n        write(arr[idx:idx + chunksize], outfile)\n        idx += chunksize\n\n\ndef _array_to_file_like(arr, fileobj):\n    \"\"\"\n    Write a `~numpy.ndarray` to a file-like object (which is not supported by\n    `numpy.ndarray.tofile`).\n    \"\"\"\n\n    # If the array is empty, we can simply take a shortcut and return since\n    # there is nothing to write.\n    if len(arr) == 0:\n        return\n\n    if arr.flags.contiguous:\n\n        # It suffices to just pass the underlying buffer directly to the\n        # fileobj's write (assuming it supports the buffer interface). If\n        # it does not have the buffer interface, a TypeError should be returned\n        # in which case we can fall back to the other methods.\n\n        try:\n            fileobj.write(arr.data)\n        except TypeError:\n            pass\n        else:\n            return\n\n    if hasattr(np, 'nditer'):\n        # nditer version for non-contiguous arrays\n        for item in np.nditer(arr, order='C'):\n            fileobj.write(item.tobytes())\n    else:\n        # Slower version for Numpy versions without nditer;\n        # The problem with flatiter is it doesn't preserve the original\n        # byteorder\n        byteorder = arr.dtype.byteorder\n        if ((sys.byteorder == 'little' and byteorder == '>')\n                or (sys.byteorder == 'big' and byteorder == '<')):\n            for item in arr.flat:\n                fileobj.write(item.byteswap().tobytes())\n        else:\n            for item in arr.flat:\n                fileobj.write(item.tobytes())\n\n\ndef _write_string(f, s):\n    \"\"\"\n    Write a string to a file, encoding to ASCII if the file is open in binary\n    mode, or decoding if the file is open in text mode.\n    \"\"\"\n\n    # Assume if the file object doesn't have a specific mode, that the mode is\n    # binary\n    binmode = fileobj_is_binary(f)\n\n    if binmode and isinstance(s, str):\n        s = encode_ascii(s)\n    elif not binmode and not isinstance(f, str):\n        s = decode_ascii(s)\n\n    f.write(s)\n\n\ndef _convert_array(array, dtype):\n    \"\"\"\n    Converts an array to a new dtype--if the itemsize of the new dtype is\n    the same as the old dtype and both types are not numeric, a view is\n    returned.  Otherwise a new array must be created.\n    \"\"\"\n\n    if array.dtype == dtype:\n        return array\n    elif (array.dtype.itemsize == dtype.itemsize and not\n            (np.issubdtype(array.dtype, np.number) and\n             np.issubdtype(dtype, np.number))):\n        # Includes a special case when both dtypes are at least numeric to\n        # account for old Trac ticket 218 (now inaccessible).\n        return array.view(dtype)\n    else:\n        return array.astype(dtype)\n\n\ndef _pseudo_zero(dtype):\n    \"\"\"\n    Given a numpy dtype, finds its \"zero\" point, which is exactly in the\n    middle of its range.\n    \"\"\"\n\n    # special case for int8\n    if dtype.kind == 'i' and dtype.itemsize == 1:\n        return -128\n\n    assert dtype.kind == 'u'\n    return 1 << (dtype.itemsize * 8 - 1)\n\n\ndef _is_pseudo_integer(dtype):\n    return (\n        (dtype.kind == 'u' and dtype.itemsize >= 2)\n        or (dtype.kind == 'i' and dtype.itemsize == 1)\n    )\n\n\ndef _is_int(val):\n    return isinstance(val, all_integer_types)\n\n\ndef _str_to_num(val):\n    \"\"\"Converts a given string to either an int or a float if necessary.\"\"\"\n\n    try:\n        num = int(val)\n    except ValueError:\n        # If this fails then an exception should be raised anyways\n        num = float(val)\n    return num\n\n\ndef _words_group(s, width):\n    \"\"\"\n    Split a long string into parts where each part is no longer than ``strlen``\n    and no word is cut into two pieces.  But if there are any single words\n    which are longer than ``strlen``, then they will be split in the middle of\n    the word.\n    \"\"\"\n\n    words = []\n    slen = len(s)\n\n    # appending one blank at the end always ensures that the \"last\" blank\n    # is beyond the end of the string\n    arr = np.frombuffer(s.encode('utf8') + b' ', dtype='S1')\n\n    # locations of the blanks\n    blank_loc = np.nonzero(arr == b' ')[0]\n    offset = 0\n    xoffset = 0\n\n    while True:\n        try:\n            loc = np.nonzero(blank_loc >= width + offset)[0][0]\n        except IndexError:\n            loc = len(blank_loc)\n\n        if loc > 0:\n            offset = blank_loc[loc - 1] + 1\n        else:\n            offset = -1\n\n        # check for one word longer than strlen, break in the middle\n        if offset <= xoffset:\n            offset = min(xoffset + width, slen)\n\n        # collect the pieces in a list\n        words.append(s[xoffset:offset])\n        if offset >= slen:\n            break\n        xoffset = offset\n\n    return words\n\n\ndef _tmp_name(input):\n    \"\"\"\n    Create a temporary file name which should not already exist.  Use the\n    directory of the input file as the base name of the mkstemp() output.\n    \"\"\"\n\n    if input is not None:\n        input = os.path.dirname(input)\n    f, fn = tempfile.mkstemp(dir=input)\n    os.close(f)\n    return fn\n\n\ndef _get_array_mmap(array):\n    \"\"\"\n    If the array has an mmap.mmap at base of its base chain, return the mmap\n    object; otherwise return None.\n    \"\"\"\n\n    if isinstance(array, mmap.mmap):\n        return array\n\n    base = array\n    while hasattr(base, 'base') and base.base is not None:\n        if isinstance(base.base, mmap.mmap):\n            return base.base\n        base = base.base\n\n\n@contextmanager\ndef _free_space_check(hdulist, dirname=None):\n    try:\n        yield\n    except OSError as exc:\n        error_message = ''\n        if not isinstance(hdulist, list):\n            hdulist = [hdulist, ]\n        if dirname is None:\n            dirname = os.path.dirname(hdulist._file.name)\n        if os.path.isdir(dirname):\n            free_space = data.get_free_space_in_dir(dirname)\n            hdulist_size = sum(hdu.size for hdu in hdulist)\n            if free_space < hdulist_size:\n                error_message = (\"Not enough space on disk: requested {}, \"\n                                 \"available {}. \".format(hdulist_size, free_space))\n\n        for hdu in hdulist:\n            hdu._close()\n\n        raise OSError(error_message + str(exc))\n\n\ndef _extract_number(value, default):\n    \"\"\"\n    Attempts to extract an integer number from the given value. If the\n    extraction fails, the value of the 'default' argument is returned.\n    \"\"\"\n\n    try:\n        # The _str_to_num method converts the value to string/float\n        # so we need to perform one additional conversion to int on top\n        return int(_str_to_num(value))\n    except (TypeError, ValueError):\n        return default\n\n\ndef get_testdata_filepath(filename):\n    \"\"\"\n    Return a string representing the path to the file requested from the\n    io.fits test data set.\n\n    .. versionadded:: 2.0.3\n\n    Parameters\n    ----------\n    filename : str\n        The filename of the test data file.\n\n    Returns\n    -------\n    filepath : str\n        The path to the requested file.\n    \"\"\"\n    return data.get_pkg_data_filename(\n        f'io/fits/tests/data/{filename}', 'astropy')\n\n\ndef _rstrip_inplace(array):\n    \"\"\"\n    Performs an in-place rstrip operation on string arrays. This is necessary\n    since the built-in `np.char.rstrip` in Numpy does not perform an in-place\n    calculation.\n    \"\"\"\n\n    # The following implementation convert the string to unsigned integers of\n    # the right length. Trailing spaces (which are represented as 32) are then\n    # converted to null characters (represented as zeros). To avoid creating\n    # large temporary mask arrays, we loop over chunks (attempting to do that\n    # on a 1-D version of the array; large memory may still be needed in the\n    # unlikely case that a string array has small first dimension and cannot\n    # be represented as a contiguous 1-D array in memory).\n\n    dt = array.dtype\n\n    if dt.kind not in 'SU':\n        raise TypeError(\"This function can only be used on string arrays\")\n    # View the array as appropriate integers. The last dimension will\n    # equal the number of characters in each string.\n    bpc = 1 if dt.kind == 'S' else 4\n    dt_int = f\"({dt.itemsize // bpc},){dt.byteorder}u{bpc}\"\n    b = array.view(dt_int, np.ndarray)\n    # For optimal speed, work in chunks of the internal ufunc buffer size.\n    bufsize = np.getbufsize()\n    # Attempt to have the strings as a 1-D array to give the chunk known size.\n    # Note: the code will work if this fails; the chunks will just be larger.\n    if b.ndim > 2:\n        try:\n            b.shape = -1, b.shape[-1]\n        except AttributeError:  # can occur for non-contiguous arrays\n            pass\n    for j in range(0, b.shape[0], bufsize):\n        c = b[j:j + bufsize]\n        # Mask which will tell whether we're in a sequence of trailing spaces.\n        mask = np.ones(c.shape[:-1], dtype=bool)\n        # Loop over the characters in the strings, in reverse order. We process\n        # the i-th character of all strings in the chunk at the same time. If\n        # the character is 32, this corresponds to a space, and we then change\n        # this to 0. We then construct a new mask to find rows where the\n        # i-th character is 0 (null) and the i-1-th is 32 (space) and repeat.\n        for i in range(-1, -c.shape[-1], -1):\n            mask &= c[..., i] == 32\n            c[..., i][mask] = 0\n            mask = c[..., i] == 0\n\n    return array\n\n\ndef _is_dask_array(data):\n    \"\"\"Check whether data is a dask array.\n\n    We avoid importing dask unless it is likely it is a dask array,\n    so that non-dask code is not slowed down.\n    \"\"\"\n    if not hasattr(data, 'compute'):\n        return False\n\n    try:\n        from dask.array import Array\n    except ImportError:\n        # If we cannot import dask, surely this cannot be a\n        # dask array!\n        return False\n    else:\n        return isinstance(data, Array)\n"},{"col":0,"comment":"\n    Returns the first item returned by iterating over an iterable object.\n\n    Example:\n\n    >>> a = [1, 2, 3]\n    >>> first(a)\n    1\n    ","endLoc":161,"header":"def first(iterable)","id":961,"name":"first","nodeType":"Function","startLoc":150,"text":"def first(iterable):\n    \"\"\"\n    Returns the first item returned by iterating over an iterable object.\n\n    Example:\n\n    >>> a = [1, 2, 3]\n    >>> first(a)\n    1\n    \"\"\"\n\n    return next(iter(iterable))"},{"col":0,"comment":"\n    Generator over all subclasses of a given class, in depth first order.\n\n    >>> class A: pass\n    >>> class B(A): pass\n    >>> class C(A): pass\n    >>> class D(B,C): pass\n    >>> class E(D): pass\n    >>>\n    >>> for cls in itersubclasses(A):\n    ...     print(cls.__name__)\n    B\n    D\n    E\n    C\n    >>> # get ALL classes currently defined\n    >>> [cls.__name__ for cls in itersubclasses(object)]\n    [...'tuple', ...'type', ...]\n\n    From http://code.activestate.com/recipes/576949/\n    ","endLoc":198,"header":"def itersubclasses(cls, _seen=None)","id":962,"name":"itersubclasses","nodeType":"Function","startLoc":164,"text":"def itersubclasses(cls, _seen=None):\n    \"\"\"\n    Generator over all subclasses of a given class, in depth first order.\n\n    >>> class A: pass\n    >>> class B(A): pass\n    >>> class C(A): pass\n    >>> class D(B,C): pass\n    >>> class E(D): pass\n    >>>\n    >>> for cls in itersubclasses(A):\n    ...     print(cls.__name__)\n    B\n    D\n    E\n    C\n    >>> # get ALL classes currently defined\n    >>> [cls.__name__ for cls in itersubclasses(object)]\n    [...'tuple', ...'type', ...]\n\n    From http://code.activestate.com/recipes/576949/\n    \"\"\"\n\n    if _seen is None:\n        _seen = set()\n    try:\n        subs = cls.__subclasses__()\n    except TypeError:  # fails only when cls is type\n        subs = cls.__subclasses__(cls)\n    for sub in sorted(subs, key=operator.attrgetter('__name__')):\n        if sub not in _seen:\n            _seen.add(sub)\n            yield sub\n            for sub in itersubclasses(sub, _seen):\n                yield sub"},{"attributeType":"function","col":0,"comment":"null","endLoc":153,"id":963,"name":"_is_url","nodeType":"Attribute","startLoc":153,"text":"_is_url"},{"col":4,"comment":"null","endLoc":323,"header":"def pixel_to_world_values(self, *pixel_arrays)","id":964,"name":"pixel_to_world_values","nodeType":"Function","startLoc":321,"text":"def pixel_to_world_values(self, *pixel_arrays):\n        world = self.all_pix2world(*pixel_arrays, 0)\n        return world[0] if self.world_n_dim == 1 else tuple(world)"},{"className":"classproperty","col":0,"comment":"\n    Similar to `property`, but allows class-level properties.  That is,\n    a property whose getter is like a `classmethod`.\n\n    The wrapped method may explicitly use the `classmethod` decorator (which\n    must become before this decorator), or the `classmethod` may be omitted\n    (it is implicit through use of this decorator).\n\n    .. note::\n\n        classproperty only works for *read-only* properties.  It does not\n        currently allow writeable/deletable properties, due to subtleties of how\n        Python descriptors work.  In order to implement such properties on a class\n        a metaclass for that class must be implemented.\n\n    Parameters\n    ----------\n    fget : callable\n        The function that computes the value of this property (in particular,\n        the function when this is used as a decorator) a la `property`.\n\n    doc : str, optional\n        The docstring for the property--by default inherited from the getter\n        function.\n\n    lazy : bool, optional\n        If True, caches the value returned by the first call to the getter\n        function, so that it is only called once (used for lazy evaluation\n        of an attribute).  This is analogous to `lazyproperty`.  The ``lazy``\n        argument can also be used when `classproperty` is used as a decorator\n        (see the third example below).  When used in the decorator syntax this\n        *must* be passed in as a keyword argument.\n\n    Examples\n    --------\n\n    ::\n\n        >>> class Foo:\n        ...     _bar_internal = 1\n        ...     @classproperty\n        ...     def bar(cls):\n        ...         return cls._bar_internal + 1\n        ...\n        >>> Foo.bar\n        2\n        >>> foo_instance = Foo()\n        >>> foo_instance.bar\n        2\n        >>> foo_instance._bar_internal = 2\n        >>> foo_instance.bar  # Ignores instance attributes\n        2\n\n    As previously noted, a `classproperty` is limited to implementing\n    read-only attributes::\n\n        >>> class Foo:\n        ...     _bar_internal = 1\n        ...     @classproperty\n        ...     def bar(cls):\n        ...         return cls._bar_internal\n        ...     @bar.setter\n        ...     def bar(cls, value):\n        ...         cls._bar_internal = value\n        ...\n        Traceback (most recent call last):\n        ...\n        NotImplementedError: classproperty can only be read-only; use a\n        metaclass to implement modifiable class-level properties\n\n    When the ``lazy`` option is used, the getter is only called once::\n\n        >>> class Foo:\n        ...     @classproperty(lazy=True)\n        ...     def bar(cls):\n        ...         print(\"Performing complicated calculation\")\n        ...         return 1\n        ...\n        >>> Foo.bar\n        Performing complicated calculation\n        1\n        >>> Foo.bar\n        1\n\n    If a subclass inherits a lazy `classproperty` the property is still\n    re-evaluated for the subclass::\n\n        >>> class FooSub(Foo):\n        ...     pass\n        ...\n        >>> FooSub.bar\n        Performing complicated calculation\n        1\n        >>> FooSub.bar\n        1\n    ","endLoc":723,"id":965,"nodeType":"Class","startLoc":555,"text":"class classproperty(property):\n    \"\"\"\n    Similar to `property`, but allows class-level properties.  That is,\n    a property whose getter is like a `classmethod`.\n\n    The wrapped method may explicitly use the `classmethod` decorator (which\n    must become before this decorator), or the `classmethod` may be omitted\n    (it is implicit through use of this decorator).\n\n    .. note::\n\n        classproperty only works for *read-only* properties.  It does not\n        currently allow writeable/deletable properties, due to subtleties of how\n        Python descriptors work.  In order to implement such properties on a class\n        a metaclass for that class must be implemented.\n\n    Parameters\n    ----------\n    fget : callable\n        The function that computes the value of this property (in particular,\n        the function when this is used as a decorator) a la `property`.\n\n    doc : str, optional\n        The docstring for the property--by default inherited from the getter\n        function.\n\n    lazy : bool, optional\n        If True, caches the value returned by the first call to the getter\n        function, so that it is only called once (used for lazy evaluation\n        of an attribute).  This is analogous to `lazyproperty`.  The ``lazy``\n        argument can also be used when `classproperty` is used as a decorator\n        (see the third example below).  When used in the decorator syntax this\n        *must* be passed in as a keyword argument.\n\n    Examples\n    --------\n\n    ::\n\n        >>> class Foo:\n        ...     _bar_internal = 1\n        ...     @classproperty\n        ...     def bar(cls):\n        ...         return cls._bar_internal + 1\n        ...\n        >>> Foo.bar\n        2\n        >>> foo_instance = Foo()\n        >>> foo_instance.bar\n        2\n        >>> foo_instance._bar_internal = 2\n        >>> foo_instance.bar  # Ignores instance attributes\n        2\n\n    As previously noted, a `classproperty` is limited to implementing\n    read-only attributes::\n\n        >>> class Foo:\n        ...     _bar_internal = 1\n        ...     @classproperty\n        ...     def bar(cls):\n        ...         return cls._bar_internal\n        ...     @bar.setter\n        ...     def bar(cls, value):\n        ...         cls._bar_internal = value\n        ...\n        Traceback (most recent call last):\n        ...\n        NotImplementedError: classproperty can only be read-only; use a\n        metaclass to implement modifiable class-level properties\n\n    When the ``lazy`` option is used, the getter is only called once::\n\n        >>> class Foo:\n        ...     @classproperty(lazy=True)\n        ...     def bar(cls):\n        ...         print(\"Performing complicated calculation\")\n        ...         return 1\n        ...\n        >>> Foo.bar\n        Performing complicated calculation\n        1\n        >>> Foo.bar\n        1\n\n    If a subclass inherits a lazy `classproperty` the property is still\n    re-evaluated for the subclass::\n\n        >>> class FooSub(Foo):\n        ...     pass\n        ...\n        >>> FooSub.bar\n        Performing complicated calculation\n        1\n        >>> FooSub.bar\n        1\n    \"\"\"\n\n    def __new__(cls, fget=None, doc=None, lazy=False):\n        if fget is None:\n            # Being used as a decorator--return a wrapper that implements\n            # decorator syntax\n            def wrapper(func):\n                return cls(func, lazy=lazy)\n\n            return wrapper\n\n        return super().__new__(cls)\n\n    def __init__(self, fget, doc=None, lazy=False):\n        self._lazy = lazy\n        if lazy:\n            self._lock = threading.RLock()   # Protects _cache\n            self._cache = {}\n        fget = self._wrap_fget(fget)\n\n        super().__init__(fget=fget, doc=doc)\n\n        # There is a buglet in Python where self.__doc__ doesn't\n        # get set properly on instances of property subclasses if\n        # the doc argument was used rather than taking the docstring\n        # from fget\n        # Related Python issue: https://bugs.python.org/issue24766\n        if doc is not None:\n            self.__doc__ = doc\n\n    def __get__(self, obj, objtype):\n        if self._lazy:\n            val = self._cache.get(objtype, _NotFound)\n            if val is _NotFound:\n                with self._lock:\n                    # Check if another thread initialised before we locked.\n                    val = self._cache.get(objtype, _NotFound)\n                    if val is _NotFound:\n                        val = self.fget.__wrapped__(objtype)\n                        self._cache[objtype] = val\n        else:\n            # The base property.__get__ will just return self here;\n            # instead we pass objtype through to the original wrapped\n            # function (which takes the class as its sole argument)\n            val = self.fget.__wrapped__(objtype)\n        return val\n\n    def getter(self, fget):\n        return super().getter(self._wrap_fget(fget))\n\n    def setter(self, fset):\n        raise NotImplementedError(\n            \"classproperty can only be read-only; use a metaclass to \"\n            \"implement modifiable class-level properties\")\n\n    def deleter(self, fdel):\n        raise NotImplementedError(\n            \"classproperty can only be read-only; use a metaclass to \"\n            \"implement modifiable class-level properties\")\n\n    @staticmethod\n    def _wrap_fget(orig_fget):\n        if isinstance(orig_fget, classmethod):\n            orig_fget = orig_fget.__func__\n\n        # Using stock functools.wraps instead of the fancier version\n        # found later in this module, which is overkill for this purpose\n\n        @functools.wraps(orig_fget)\n        def fget(obj):\n            return orig_fget(obj.__class__)\n\n        return fget"},{"col":4,"comment":"null","endLoc":327,"header":"def world_to_pixel_values(self, *world_arrays)","id":966,"name":"world_to_pixel_values","nodeType":"Function","startLoc":325,"text":"def world_to_pixel_values(self, *world_arrays):\n        pixel = self.all_world2pix(*world_arrays, 0)\n        return pixel[0] if self.pixel_n_dim == 1 else tuple(pixel)"},{"col":4,"comment":"null","endLoc":331,"header":"@property\n    def world_axis_object_components(self)","id":967,"name":"world_axis_object_components","nodeType":"Function","startLoc":329,"text":"@property\n    def world_axis_object_components(self):\n        return self._get_components_and_classes()[0]"},{"col":0,"comment":"\n    This decorator registers a custom SIGINT handler to catch and ignore SIGINT\n    until the wrapped function is completed.\n    ","endLoc":244,"header":"def ignore_sigint(func)","id":968,"name":"ignore_sigint","nodeType":"Function","startLoc":201,"text":"def ignore_sigint(func):\n    \"\"\"\n    This decorator registers a custom SIGINT handler to catch and ignore SIGINT\n    until the wrapped function is completed.\n    \"\"\"\n\n    @wraps(func)\n    def wrapped(*args, **kwargs):\n        # Get the name of the current thread and determine if this is a single\n        # threaded application\n        curr_thread = threading.current_thread()\n        single_thread = (threading.active_count() == 1 and\n                         curr_thread.name == 'MainThread')\n\n        class SigintHandler:\n            def __init__(self):\n                self.sigint_received = False\n\n            def __call__(self, signum, frame):\n                warnings.warn('KeyboardInterrupt ignored until {} is '\n                              'complete!'.format(func.__name__),\n                              AstropyUserWarning)\n                self.sigint_received = True\n\n        sigint_handler = SigintHandler()\n\n        # Define new signal interput handler\n        if single_thread:\n            # Install new handler\n            old_handler = signal.signal(signal.SIGINT, sigint_handler)\n\n        try:\n            func(*args, **kwargs)\n        finally:\n            if single_thread:\n                if old_handler is not None:\n                    signal.signal(signal.SIGINT, old_handler)\n                else:\n                    signal.signal(signal.SIGINT, signal.SIG_DFL)\n\n                if sigint_handler.sigint_received:\n                    raise KeyboardInterrupt\n\n    return wrapped"},{"col":0,"comment":"Return the items of an iterable paired with its next item.\n\n    Ex: s -> (s0,s1), (s1,s2), (s2,s3), ....\n    ","endLoc":258,"header":"def pairwise(iterable)","id":970,"name":"pairwise","nodeType":"Function","startLoc":247,"text":"def pairwise(iterable):\n    \"\"\"Return the items of an iterable paired with its next item.\n\n    Ex: s -> (s0,s1), (s1,s2), (s2,s3), ....\n    \"\"\"\n\n    a, b = itertools.tee(iterable)\n    for _ in b:\n        # Just a little trick to advance b without having to catch\n        # StopIter if b happens to be empty\n        break\n    return zip(a, b)"},{"col":0,"comment":"null","endLoc":525,"header":"def translate(s, table, deletechars)","id":971,"name":"translate","nodeType":"Function","startLoc":520,"text":"def translate(s, table, deletechars):\n    if deletechars:\n        table = table.copy()\n        for c in deletechars:\n            table[ord(c)] = None\n    return s.translate(table)"},{"col":4,"comment":"\n        Construct a `HDUList` object.\n\n        Parameters\n        ----------\n        hdus : BaseHDU or sequence thereof, optional\n            The HDU object(s) to comprise the `HDUList`.  Should be\n            instances of HDU classes like `ImageHDU` or `BinTableHDU`.\n\n        file : file-like, bytes, optional\n            The opened physical file associated with the `HDUList`\n            or a bytes object containing the contents of the FITS\n            file.\n        ","endLoc":246,"header":"def __init__(self, hdus=[], file=None)","id":972,"name":"__init__","nodeType":"Function","startLoc":185,"text":"def __init__(self, hdus=[], file=None):\n        \"\"\"\n        Construct a `HDUList` object.\n\n        Parameters\n        ----------\n        hdus : BaseHDU or sequence thereof, optional\n            The HDU object(s) to comprise the `HDUList`.  Should be\n            instances of HDU classes like `ImageHDU` or `BinTableHDU`.\n\n        file : file-like, bytes, optional\n            The opened physical file associated with the `HDUList`\n            or a bytes object containing the contents of the FITS\n            file.\n        \"\"\"\n\n        if isinstance(file, bytes):\n            self._data = file\n            self._file = None\n        else:\n            self._file = file\n            self._data = None\n\n        # For internal use only--the keyword args passed to fitsopen /\n        # HDUList.fromfile/string when opening the file\n        self._open_kwargs = {}\n        self._in_read_next_hdu = False\n\n        # If we have read all the HDUs from the file or not\n        # The assumes that all HDUs have been written when we first opened the\n        # file; we do not currently support loading additional HDUs from a file\n        # while it is being streamed to.  In the future that might be supported\n        # but for now this is only used for the purpose of lazy-loading of\n        # existing HDUs.\n        if file is None:\n            self._read_all = True\n        elif self._file is not None:\n            # Should never attempt to read HDUs in ostream mode\n            self._read_all = self._file.mode == 'ostream'\n        else:\n            self._read_all = False\n\n        if hdus is None:\n            hdus = []\n\n        # can take one HDU, as well as a list of HDU's as input\n        if isinstance(hdus, _ValidHDU):\n            hdus = [hdus]\n        elif not isinstance(hdus, (HDUList, list)):\n            raise TypeError(\"Invalid input for HDUList.\")\n\n        for idx, hdu in enumerate(hdus):\n            if not isinstance(hdu, _BaseHDU):\n                raise TypeError(f\"Element {idx} in the HDUList input is not an HDU.\")\n\n        super().__init__(hdus)\n\n        if file is None:\n            # Only do this when initializing from an existing list of HDUs\n            # When initializing from a file, this will be handled by the\n            # append method after the first HDU is read\n            self.update_extend()"},{"col":4,"comment":"null","endLoc":662,"header":"def __new__(cls, fget=None, doc=None, lazy=False)","id":973,"name":"__new__","nodeType":"Function","startLoc":653,"text":"def __new__(cls, fget=None, doc=None, lazy=False):\n        if fget is None:\n            # Being used as a decorator--return a wrapper that implements\n            # decorator syntax\n            def wrapper(func):\n                return cls(func, lazy=lazy)\n\n            return wrapper\n\n        return super().__new__(cls)"},{"col":0,"comment":"\n    Like :func:`textwrap.wrap` but preserves existing paragraphs which\n    :func:`textwrap.wrap` does not otherwise handle well.  Also handles section\n    headers.\n    ","endLoc":543,"header":"def fill(text, width, **kwargs)","id":974,"name":"fill","nodeType":"Function","startLoc":528,"text":"def fill(text, width, **kwargs):\n    \"\"\"\n    Like :func:`textwrap.wrap` but preserves existing paragraphs which\n    :func:`textwrap.wrap` does not otherwise handle well.  Also handles section\n    headers.\n    \"\"\"\n\n    paragraphs = text.split('\\n\\n')\n\n    def maybe_fill(t):\n        if all(len(l) < width for l in t.splitlines()):\n            return t\n        else:\n            return textwrap.fill(t, width, **kwargs)\n\n    return '\\n\\n'.join(maybe_fill(p) for p in paragraphs)"},{"col":4,"comment":"null","endLoc":673,"header":"def _get_components_and_classes(self)","id":975,"name":"_get_components_and_classes","nodeType":"Function","startLoc":341,"text":"def _get_components_and_classes(self):\n\n        # The aim of this function is to return whatever is needed for\n        # world_axis_object_components and world_axis_object_classes. It's easier\n        # to figure it out in one go and then return the values and let the\n        # properties return part of it.\n\n        # Since this method might get called quite a few times, we need to cache\n        # it. We start off by defining a hash based on the attributes of the\n        # WCS that matter here (we can't just use the WCS object as a hash since\n        # it is mutable)\n        wcs_hash = (self.naxis,\n                    list(self.wcs.ctype),\n                    list(self.wcs.cunit),\n                    self.wcs.radesys,\n                    self.wcs.specsys,\n                    self.wcs.equinox,\n                    self.wcs.dateobs,\n                    self.wcs.lng,\n                    self.wcs.lat)\n\n        # If the cache is present, we need to check that the 'hash' matches.\n        if getattr(self, '_components_and_classes_cache', None) is not None:\n            cache = self._components_and_classes_cache\n            if cache[0] == wcs_hash:\n                return cache[1]\n            else:\n                self._components_and_classes_cache = None\n\n        # Avoid circular imports by importing here\n        from astropy.wcs.utils import wcs_to_celestial_frame\n        from astropy.coordinates import SkyCoord, EarthLocation\n        from astropy.time.formats import FITS_DEPRECATED_SCALES\n        from astropy.time import Time, TimeDelta\n\n        components = [None] * self.naxis\n        classes = {}\n\n        # Let's start off by checking whether the WCS has a pair of celestial\n        # components\n\n        if self.has_celestial:\n\n            try:\n                celestial_frame = wcs_to_celestial_frame(self)\n            except ValueError:\n                # Some WCSes, e.g. solar, can be recognized by WCSLIB as being\n                # celestial but we don't necessarily have frames for them.\n                celestial_frame = None\n            else:\n\n                kwargs = {}\n                kwargs['frame'] = celestial_frame\n                kwargs['unit'] = u.deg\n\n                classes['celestial'] = (SkyCoord, (), kwargs)\n\n                components[self.wcs.lng] = ('celestial', 0, 'spherical.lon.degree')\n                components[self.wcs.lat] = ('celestial', 1, 'spherical.lat.degree')\n\n        # Next, we check for spectral components\n\n        if self.has_spectral:\n\n            # Find index of spectral coordinate\n            ispec = self.wcs.spec\n            ctype = self.wcs.ctype[ispec][:4]\n            ctype = ctype.upper()\n\n            kwargs = {}\n\n            # Determine observer location and velocity\n\n            # TODO: determine how WCS standard would deal with observer on a\n            # spacecraft far from earth. For now assume the obsgeo parameters,\n            # if present, give the geocentric observer location.\n\n            if np.isnan(self.wcs.obsgeo[0]):\n                observer = None\n            else:\n\n                earth_location = EarthLocation(*self.wcs.obsgeo[:3], unit=u.m)\n                obstime = Time(self.wcs.mjdobs, format='mjd', scale='utc',\n                               location=earth_location)\n                observer_location = SkyCoord(earth_location.get_itrs(obstime=obstime))\n\n                if self.wcs.specsys in VELOCITY_FRAMES:\n                    frame = VELOCITY_FRAMES[self.wcs.specsys]\n                    observer = observer_location.transform_to(frame)\n                    if isinstance(frame, str):\n                        observer = attach_zero_velocities(observer)\n                    else:\n                        observer = update_differentials_to_match(observer_location,\n                                                                 VELOCITY_FRAMES[self.wcs.specsys],\n                                                                 preserve_observer_frame=True)\n                elif self.wcs.specsys == 'TOPOCENT':\n                    observer = attach_zero_velocities(observer_location)\n                else:\n                    raise NotImplementedError(f'SPECSYS={self.wcs.specsys} not yet supported')\n\n            # Determine target\n\n            # This is tricker. In principle the target for each pixel is the\n            # celestial coordinates of the pixel, but we then need to be very\n            # careful about SSYSOBS which is tricky. For now, we set the\n            # target using the reference celestial coordinate in the WCS (if\n            # any).\n\n            if self.has_celestial and celestial_frame is not None:\n\n                # NOTE: celestial_frame was defined higher up\n\n                # NOTE: we set the distance explicitly to avoid warnings in SpectralCoord\n\n                target = SkyCoord(self.wcs.crval[self.wcs.lng] * self.wcs.cunit[self.wcs.lng],\n                                  self.wcs.crval[self.wcs.lat] * self.wcs.cunit[self.wcs.lat],\n                                  frame=celestial_frame,\n                                  distance=1000 * u.kpc)\n\n                target = attach_zero_velocities(target)\n\n            else:\n\n                target = None\n\n            # SpectralCoord does not work properly if either observer or target\n            # are not convertible to ICRS, so if this is the case, we (for now)\n            # drop the observer and target from the SpectralCoord and warn the\n            # user.\n\n            if observer is not None:\n                try:\n                    observer.transform_to(ICRS())\n                except Exception:\n                    warnings.warn('observer cannot be converted to ICRS, so will '\n                                  'not be set on SpectralCoord', AstropyUserWarning)\n                    observer = None\n\n            if target is not None:\n                try:\n                    target.transform_to(ICRS())\n                except Exception:\n                    warnings.warn('target cannot be converted to ICRS, so will '\n                                  'not be set on SpectralCoord', AstropyUserWarning)\n                    target = None\n\n            # NOTE: below we include Quantity in classes['spectral'] instead\n            # of SpectralCoord - this is because we want to also be able to\n            # accept plain quantities.\n\n            if ctype == 'ZOPT':\n\n                def spectralcoord_from_redshift(redshift):\n                    if isinstance(redshift, SpectralCoord):\n                        return redshift\n                    return SpectralCoord((redshift + 1) * self.wcs.restwav,\n                                         unit=u.m, observer=observer, target=target)\n\n                def redshift_from_spectralcoord(spectralcoord):\n                    # TODO: check target is consistent\n                    if observer is None:\n                        warnings.warn('No observer defined on WCS, SpectralCoord '\n                                      'will be converted without any velocity '\n                                      'frame change', AstropyUserWarning)\n                        return spectralcoord.to_value(u.m) / self.wcs.restwav - 1.\n                    else:\n                        return spectralcoord.with_observer_stationary_relative_to(observer).to_value(u.m) / self.wcs.restwav - 1.\n\n                classes['spectral'] = (u.Quantity, (), {}, spectralcoord_from_redshift)\n                components[self.wcs.spec] = ('spectral', 0, redshift_from_spectralcoord)\n\n            elif ctype == 'BETA':\n\n                def spectralcoord_from_beta(beta):\n                    if isinstance(beta, SpectralCoord):\n                        return beta\n                    return SpectralCoord(beta * C_SI,\n                                         unit=u.m / u.s,\n                                         doppler_convention='relativistic',\n                                         doppler_rest=self.wcs.restwav * u.m,\n                                         observer=observer, target=target)\n\n                def beta_from_spectralcoord(spectralcoord):\n                    # TODO: check target is consistent\n                    doppler_equiv = u.doppler_relativistic(self.wcs.restwav * u.m)\n                    if observer is None:\n                        warnings.warn('No observer defined on WCS, SpectralCoord '\n                                      'will be converted without any velocity '\n                                      'frame change', AstropyUserWarning)\n                        return spectralcoord.to_value(u.m / u.s, doppler_equiv) / C_SI\n                    else:\n                        return spectralcoord.with_observer_stationary_relative_to(observer).to_value(u.m / u.s, doppler_equiv) / C_SI\n\n                classes['spectral'] = (u.Quantity, (), {}, spectralcoord_from_beta)\n                components[self.wcs.spec] = ('spectral', 0, beta_from_spectralcoord)\n\n            else:\n\n                kwargs['unit'] = self.wcs.cunit[ispec]\n\n                if self.wcs.restfrq > 0:\n                    if ctype == 'VELO':\n                        kwargs['doppler_convention'] = 'relativistic'\n                        kwargs['doppler_rest'] = self.wcs.restfrq * u.Hz\n                    elif ctype == 'VRAD':\n                        kwargs['doppler_convention'] = 'radio'\n                        kwargs['doppler_rest'] = self.wcs.restfrq * u.Hz\n                    elif ctype == 'VOPT':\n                        kwargs['doppler_convention'] = 'optical'\n                        kwargs['doppler_rest'] = self.wcs.restwav * u.m\n\n                def spectralcoord_from_value(value):\n                    return SpectralCoord(value, observer=observer, target=target, **kwargs)\n\n                def value_from_spectralcoord(spectralcoord):\n                    # TODO: check target is consistent\n                    if observer is None:\n                        warnings.warn('No observer defined on WCS, SpectralCoord '\n                                      'will be converted without any velocity '\n                                      'frame change', AstropyUserWarning)\n                        return spectralcoord.to_value(**kwargs)\n                    else:\n                        return spectralcoord.with_observer_stationary_relative_to(observer).to_value(**kwargs)\n\n                classes['spectral'] = (u.Quantity, (), {}, spectralcoord_from_value)\n                components[self.wcs.spec] = ('spectral', 0, value_from_spectralcoord)\n\n        # We can then make sure we correctly return Time objects where appropriate\n        # (https://www.aanda.org/articles/aa/pdf/2015/02/aa24653-14.pdf)\n\n        if 'time' in self.world_axis_physical_types:\n\n            multiple_time = self.world_axis_physical_types.count('time') > 1\n\n            for i in range(self.naxis):\n\n                if self.world_axis_physical_types[i] == 'time':\n\n                    if multiple_time:\n                        name = f'time.{i}'\n                    else:\n                        name = 'time'\n\n                    # Initialize delta\n                    reference_time_delta = None\n\n                    # Extract time scale\n                    scale = self.wcs.ctype[i].lower()\n\n                    if scale == 'time':\n                        if self.wcs.timesys:\n                            scale = self.wcs.timesys.lower()\n                        else:\n                            scale = 'utc'\n\n                    # Drop sub-scales\n                    if '(' in scale:\n                        pos = scale.index('(')\n                        scale, subscale = scale[:pos], scale[pos+1:-1]\n                        warnings.warn(f'Dropping unsupported sub-scale '\n                                      f'{subscale.upper()} from scale {scale.upper()}',\n                                      UserWarning)\n\n                    # TODO: consider having GPS as a scale in Time\n                    # For now GPS is not a scale, we approximate this by TAI - 19s\n                    if scale == 'gps':\n                        reference_time_delta = TimeDelta(19, format='sec')\n                        scale = 'tai'\n\n                    elif scale.upper() in FITS_DEPRECATED_SCALES:\n                        scale = FITS_DEPRECATED_SCALES[scale.upper()]\n\n                    elif scale not in Time.SCALES:\n                        raise ValueError(f'Unrecognized time CTYPE={self.wcs.ctype[i]}')\n\n                    # Determine location\n                    trefpos = self.wcs.trefpos.lower()\n\n                    if trefpos.startswith('topocent'):\n                        # Note that some headers use TOPOCENT instead of TOPOCENTER\n                        if np.any(np.isnan(self.wcs.obsgeo[:3])):\n                            warnings.warn('Missing or incomplete observer location '\n                                          'information, setting location in Time to None',\n                                          UserWarning)\n                            location = None\n                        else:\n                            location = EarthLocation(*self.wcs.obsgeo[:3], unit=u.m)\n                    elif trefpos == 'geocenter':\n                        location = EarthLocation(0, 0, 0, unit=u.m)\n                    elif trefpos == '':\n                        location = None\n                    else:\n                        # TODO: implement support for more locations when Time supports it\n                        warnings.warn(f\"Observation location '{trefpos}' is not \"\n                                       \"supported, setting location in Time to None\", UserWarning)\n                        location = None\n\n                    reference_time = Time(np.nan_to_num(self.wcs.mjdref[0]),\n                                          np.nan_to_num(self.wcs.mjdref[1]),\n                                          format='mjd', scale=scale,\n                                          location=location)\n\n                    if reference_time_delta is not None:\n                        reference_time = reference_time + reference_time_delta\n\n                    def time_from_reference_and_offset(offset):\n                        if isinstance(offset, Time):\n                            return offset\n                        return reference_time + TimeDelta(offset, format='sec')\n\n                    def offset_from_time_and_reference(time):\n                        return (time - reference_time).sec\n\n                    classes[name] = (Time, (), {}, time_from_reference_and_offset)\n                    components[i] = (name, 0, offset_from_time_and_reference)\n\n        # Fallback: for any remaining components that haven't been identified, just\n        # return Quantity as the class to use\n\n        for i in range(self.naxis):\n            if components[i] is None:\n                name = self.wcs.ctype[i].split('-')[0].lower()\n                if name == '':\n                    name = 'world'\n                while name in classes:\n                    name += \"_\"\n                classes[name] = (u.Quantity, (), {'unit': self.wcs.cunit[i]})\n                components[i] = (name, 0, 'value')\n\n        # Keep a cached version of result\n        self._components_and_classes_cache = wcs_hash, (components, classes)\n\n        return components, classes"},{"col":4,"comment":"null","endLoc":679,"header":"def __init__(self, fget, doc=None, lazy=False)","id":976,"name":"__init__","nodeType":"Function","startLoc":664,"text":"def __init__(self, fget, doc=None, lazy=False):\n        self._lazy = lazy\n        if lazy:\n            self._lock = threading.RLock()   # Protects _cache\n            self._cache = {}\n        fget = self._wrap_fget(fget)\n\n        super().__init__(fget=fget, doc=doc)\n\n        # There is a buglet in Python where self.__doc__ doesn't\n        # get set properly on instances of property subclasses if\n        # the doc argument was used rather than taking the docstring\n        # from fget\n        # Related Python issue: https://bugs.python.org/issue24766\n        if doc is not None:\n            self.__doc__ = doc"},{"col":4,"comment":"null","endLoc":723,"header":"@staticmethod\n    def _wrap_fget(orig_fget)","id":977,"name":"_wrap_fget","nodeType":"Function","startLoc":711,"text":"@staticmethod\n    def _wrap_fget(orig_fget):\n        if isinstance(orig_fget, classmethod):\n            orig_fget = orig_fget.__func__\n\n        # Using stock functools.wraps instead of the fancier version\n        # found later in this module, which is overkill for this purpose\n\n        @functools.wraps(orig_fget)\n        def fget(obj):\n            return orig_fget(obj.__class__)\n\n        return fget"},{"col":4,"comment":"null","endLoc":1343,"header":"def _convert_to_valid_data_type(self, array)","id":978,"name":"_convert_to_valid_data_type","nodeType":"Function","startLoc":1280,"text":"def _convert_to_valid_data_type(self, array):\n        # Convert the format to a type we understand\n        if isinstance(array, Delayed):\n            return array\n        elif array is None:\n            return array\n        else:\n            format = self.format\n            dims = self._dims\n\n            if dims:\n                shape = dims[:-1] if 'A' in format else dims\n                shape = (len(array),) + shape\n                array = array.reshape(shape)\n\n            if 'P' in format or 'Q' in format:\n                return array\n            elif 'A' in format:\n                if array.dtype.char in 'SU':\n                    if dims:\n                        # The 'last' dimension (first in the order given\n                        # in the TDIMn keyword itself) is the number of\n                        # characters in each string\n                        fsize = dims[-1]\n                    else:\n                        fsize = np.dtype(format.recformat).itemsize\n                    return chararray.array(array, itemsize=fsize, copy=False)\n                else:\n                    return _convert_array(array, np.dtype(format.recformat))\n            elif 'L' in format:\n                # boolean needs to be scaled back to storage values ('T', 'F')\n                if array.dtype == np.dtype('bool'):\n                    return np.where(array == np.False_, ord('F'), ord('T'))\n                else:\n                    return np.where(array == 0, ord('F'), ord('T'))\n            elif 'X' in format:\n                return _convert_array(array, np.dtype('uint8'))\n            else:\n                # Preserve byte order of the original array for now; see #77\n                numpy_format = array.dtype.byteorder + format.recformat\n\n                # Handle arrays passed in as unsigned ints as pseudo-unsigned\n                # int arrays; blatantly tacked in here for now--we need columns\n                # to have explicit knowledge of whether they treated as\n                # pseudo-unsigned\n                bzeros = {2: np.uint16(2**15), 4: np.uint32(2**31),\n                          8: np.uint64(2**63)}\n                if (array.dtype.kind == 'u' and\n                        array.dtype.itemsize in bzeros and\n                        self.bscale in (1, None, '') and\n                        self.bzero == bzeros[array.dtype.itemsize]):\n                    # Basically the array is uint, has scale == 1.0, and the\n                    # bzero is the appropriate value for a pseudo-unsigned\n                    # integer of the input dtype, then go ahead and assume that\n                    # uint is assumed\n                    numpy_format = numpy_format.replace('i', 'u')\n                    self._pseudo_unsigned_ints = True\n\n                # The .base here means we're dropping the shape information,\n                # which is only used to format recarray fields, and is not\n                # useful for converting input arrays to the correct data type\n                dtype = np.dtype(numpy_format).base\n\n                return _convert_array(array, dtype)"},{"col":4,"comment":"null","endLoc":696,"header":"def __get__(self, obj, objtype)","id":979,"name":"__get__","nodeType":"Function","startLoc":681,"text":"def __get__(self, obj, objtype):\n        if self._lazy:\n            val = self._cache.get(objtype, _NotFound)\n            if val is _NotFound:\n                with self._lock:\n                    # Check if another thread initialised before we locked.\n                    val = self._cache.get(objtype, _NotFound)\n                    if val is _NotFound:\n                        val = self.fget.__wrapped__(objtype)\n                        self._cache[objtype] = val\n        else:\n            # The base property.__get__ will just return self here;\n            # instead we pass objtype through to the original wrapped\n            # function (which takes the class as its sole argument)\n            val = self.fget.__wrapped__(objtype)\n        return val"},{"fileName":"fitstime.py","filePath":"astropy/io/fits","id":980,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport re\nimport warnings\nfrom collections import defaultdict, OrderedDict\n\nimport numpy as np\n\nfrom . import Header, Card\n\nfrom astropy import units as u\nfrom astropy.coordinates import EarthLocation\nfrom astropy.table import Column, MaskedColumn\nfrom astropy.table.column import col_copy\nfrom astropy.time import Time, TimeDelta\nfrom astropy.time.core import BARYCENTRIC_SCALES\nfrom astropy.time.formats import FITS_DEPRECATED_SCALES\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n# The following is based on the FITS WCS Paper IV, \"Representations of time\n# coordinates in FITS\".\n# https://ui.adsabs.harvard.edu/abs/2015A%26A...574A..36R\n\n\n# FITS WCS standard specified \"4-3\" form for non-linear coordinate types\nTCTYP_RE_TYPE = re.compile(r'(?P<type>[A-Z]+)[-]+')\nTCTYP_RE_ALGO = re.compile(r'(?P<algo>[A-Z]+)\\s*')\n\n\n# FITS Time standard specified time units\nFITS_TIME_UNIT = ['s', 'd', 'a', 'cy', 'min', 'h', 'yr', 'ta', 'Ba']\n\n\n# Global time reference coordinate keywords\nTIME_KEYWORDS = ('TIMESYS', 'MJDREF', 'JDREF', 'DATEREF',\n                 'TREFPOS', 'TREFDIR', 'TIMEUNIT', 'TIMEOFFS',\n                 'OBSGEO-X', 'OBSGEO-Y', 'OBSGEO-Z',\n                 'OBSGEO-L', 'OBSGEO-B', 'OBSGEO-H', 'DATE',\n                 'DATE-OBS', 'DATE-AVG', 'DATE-BEG', 'DATE-END',\n                 'MJD-OBS', 'MJD-AVG', 'MJD-BEG', 'MJD-END')\n\n\n# Column-specific time override keywords\nCOLUMN_TIME_KEYWORDS = ('TCTYP', 'TCUNI', 'TRPOS')\n\n\n# Column-specific keywords regex\nCOLUMN_TIME_KEYWORD_REGEXP = f\"({'|'.join(COLUMN_TIME_KEYWORDS)})[0-9]+\"\n\n\ndef is_time_column_keyword(keyword):\n    \"\"\"\n    Check if the FITS header keyword is a time column-specific keyword.\n\n    Parameters\n    ----------\n    keyword : str\n        FITS keyword.\n    \"\"\"\n    return re.match(COLUMN_TIME_KEYWORD_REGEXP, keyword) is not None\n\n\n# Set astropy time global information\nGLOBAL_TIME_INFO = {'TIMESYS': ('UTC', 'Default time scale'),\n                    'JDREF': (0.0, 'Time columns are jd = jd1 + jd2'),\n                    'TREFPOS': ('TOPOCENTER', 'Time reference position')}\n\n\ndef _verify_global_info(global_info):\n    \"\"\"\n    Given the global time reference frame information, verify that\n    each global time coordinate attribute will be given a valid value.\n\n    Parameters\n    ----------\n    global_info : dict\n        Global time reference frame information.\n    \"\"\"\n\n    # Translate FITS deprecated scale into astropy scale, or else just convert\n    # to lower case for further checks.\n    global_info['scale'] = FITS_DEPRECATED_SCALES.get(global_info['TIMESYS'],\n                                                      global_info['TIMESYS'].lower())\n\n    # Verify global time scale\n    if global_info['scale'] not in Time.SCALES:\n\n        # 'GPS' and 'LOCAL' are FITS recognized time scale values\n        # but are not supported by astropy.\n\n        if global_info['scale'] == 'gps':\n            warnings.warn(\n                'Global time scale (TIMESYS) has a FITS recognized time scale '\n                'value \"GPS\". In Astropy, \"GPS\" is a time from epoch format '\n                'which runs synchronously with TAI; GPS is approximately 19 s '\n                'ahead of TAI. Hence, this format will be used.', AstropyUserWarning)\n            # Assume that the values are in GPS format\n            global_info['scale'] = 'tai'\n            global_info['format'] = 'gps'\n\n        if global_info['scale'] == 'local':\n            warnings.warn(\n                'Global time scale (TIMESYS) has a FITS recognized time scale '\n                'value \"LOCAL\". However, the standard states that \"LOCAL\" should be '\n                'tied to one of the existing scales because it is intrinsically '\n                'unreliable and/or ill-defined. Astropy will thus use the default '\n                'global time scale \"UTC\" instead of \"LOCAL\".', AstropyUserWarning)\n            # Default scale 'UTC'\n            global_info['scale'] = 'utc'\n            global_info['format'] = None\n\n        else:\n            raise AssertionError(\n                'Global time scale (TIMESYS) should have a FITS recognized '\n                'time scale value (got {!r}). The FITS standard states that '\n                'the use of local time scales should be restricted to alternate '\n                'coordinates.'.format(global_info['TIMESYS']))\n    else:\n        # Scale is already set\n        global_info['format'] = None\n\n    # Check if geocentric global location is specified\n    obs_geo = [global_info[attr] for attr in ('OBSGEO-X', 'OBSGEO-Y', 'OBSGEO-Z')\n               if attr in global_info]\n\n    # Location full specification is (X, Y, Z)\n    if len(obs_geo) == 3:\n        global_info['location'] = EarthLocation.from_geocentric(*obs_geo, unit=u.m)\n    else:\n        # Check if geodetic global location is specified (since geocentric failed)\n\n        # First warn the user if geocentric location is partially specified\n        if obs_geo:\n            warnings.warn(\n                'The geocentric observatory location {} is not completely '\n                'specified (X, Y, Z) and will be ignored.'.format(obs_geo),\n                AstropyUserWarning)\n\n        # Check geodetic location\n        obs_geo = [global_info[attr] for attr in ('OBSGEO-L', 'OBSGEO-B', 'OBSGEO-H')\n                   if attr in global_info]\n\n        if len(obs_geo) == 3:\n            global_info['location'] = EarthLocation.from_geodetic(*obs_geo)\n        else:\n            # Since both geocentric and geodetic locations are not specified,\n            # location will be None.\n\n            # Warn the user if geodetic location is partially specified\n            if obs_geo:\n                warnings.warn(\n                    'The geodetic observatory location {} is not completely '\n                    'specified (lon, lat, alt) and will be ignored.'.format(obs_geo),\n                    AstropyUserWarning)\n            global_info['location'] = None\n\n    # Get global time reference\n    # Keywords are listed in order of precedence, as stated by the standard\n    for key, format_ in (('MJDREF', 'mjd'), ('JDREF', 'jd'), ('DATEREF', 'fits')):\n        if key in global_info:\n            global_info['ref_time'] = {'val': global_info[key], 'format': format_}\n            break\n    else:\n        # If none of the three keywords is present, MJDREF = 0.0 must be assumed\n        global_info['ref_time'] = {'val': 0, 'format': 'mjd'}\n\n\ndef _verify_column_info(column_info, global_info):\n    \"\"\"\n    Given the column-specific time reference frame information, verify that\n    each column-specific time coordinate attribute has a valid value.\n    Return True if the coordinate column is time, or else return False.\n\n    Parameters\n    ----------\n    global_info : dict\n        Global time reference frame information.\n    column_info : dict\n        Column-specific time reference frame override information.\n    \"\"\"\n\n    scale = column_info.get('TCTYP', None)\n    unit = column_info.get('TCUNI', None)\n    location = column_info.get('TRPOS', None)\n\n    if scale is not None:\n\n        # Non-linear coordinate types have \"4-3\" form and are not time coordinates\n        if TCTYP_RE_TYPE.match(scale[:5]) and TCTYP_RE_ALGO.match(scale[5:]):\n            return False\n\n        elif scale.lower() in Time.SCALES:\n            column_info['scale'] = scale.lower()\n            column_info['format'] = None\n\n        elif scale in FITS_DEPRECATED_SCALES.keys():\n            column_info['scale'] = FITS_DEPRECATED_SCALES[scale]\n            column_info['format'] = None\n\n        # TCTYPn (scale) = 'TIME' indicates that the column scale is\n        # controlled by the global scale.\n        elif scale == 'TIME':\n            column_info['scale'] = global_info['scale']\n            column_info['format'] = global_info['format']\n\n        elif scale == 'GPS':\n            warnings.warn(\n                'Table column \"{}\" has a FITS recognized time scale value \"GPS\". '\n                'In Astropy, \"GPS\" is a time from epoch format which runs '\n                'synchronously with TAI; GPS runs ahead of TAI approximately '\n                'by 19 s. Hence, this format will be used.'.format(column_info),\n                AstropyUserWarning)\n            column_info['scale'] = 'tai'\n            column_info['format'] = 'gps'\n\n        elif scale == 'LOCAL':\n            warnings.warn(\n                'Table column \"{}\" has a FITS recognized time scale value \"LOCAL\". '\n                'However, the standard states that \"LOCAL\" should be tied to one '\n                'of the existing scales because it is intrinsically unreliable '\n                'and/or ill-defined. Astropy will thus use the global time scale '\n                '(TIMESYS) as the default.'. format(column_info),\n                AstropyUserWarning)\n            column_info['scale'] = global_info['scale']\n            column_info['format'] = global_info['format']\n\n        else:\n            # Coordinate type is either an unrecognized local time scale\n            # or a linear coordinate type\n            return False\n\n    # If TCUNIn is a time unit or TRPOSn is specified, the column is a time\n    # coordinate. This has to be tested since TCTYP (scale) is not specified.\n    elif (unit is not None and unit in FITS_TIME_UNIT) or location is not None:\n        column_info['scale'] = global_info['scale']\n        column_info['format'] = global_info['format']\n\n    # None of the conditions for time coordinate columns is satisfied\n    else:\n        return False\n\n    # Check if column-specific reference position TRPOSn is specified\n    if location is not None:\n\n        # Observatory position (location) needs to be specified only\n        # for 'TOPOCENTER'.\n        if location == 'TOPOCENTER':\n            column_info['location'] = global_info['location']\n            if column_info['location'] is None:\n                warnings.warn(\n                    'Time column reference position \"TRPOSn\" value is \"TOPOCENTER\". '\n                    'However, the observatory position is not properly specified. '\n                    'The FITS standard does not support this and hence reference '\n                    'position will be ignored.', AstropyUserWarning)\n        else:\n            column_info['location'] = None\n\n    # Warn user about ignoring global reference position when TRPOSn is\n    # not specified\n    elif global_info['TREFPOS'] == 'TOPOCENTER':\n\n        if global_info['location'] is not None:\n            warnings.warn(\n                'Time column reference position \"TRPOSn\" is not specified. The '\n                'default value for it is \"TOPOCENTER\", and the observatory position '\n                'has been specified. However, for supporting column-specific location, '\n                'reference position will be ignored for this column.',\n                AstropyUserWarning)\n        column_info['location'] = None\n    else:\n        column_info['location'] = None\n\n    # Get reference time\n    column_info['ref_time'] = global_info['ref_time']\n\n    return True\n\n\ndef _get_info_if_time_column(col, global_info):\n    \"\"\"\n    Check if a column without corresponding time column keywords in the\n    FITS header represents time or not. If yes, return the time column\n    information needed for its conversion to Time.\n    This is only applicable to the special-case where a column has the\n    name 'TIME' and a time unit.\n    \"\"\"\n\n    # Column with TTYPEn = 'TIME' and lacking any TC*n or time\n    # specific keywords will be controlled by the global keywords.\n    if col.info.name.upper() == 'TIME' and col.info.unit in FITS_TIME_UNIT:\n        column_info = {'scale': global_info['scale'],\n                       'format': global_info['format'],\n                       'ref_time': global_info['ref_time'],\n                       'location': None}\n\n        if global_info['TREFPOS'] == 'TOPOCENTER':\n            column_info['location'] = global_info['location']\n            if column_info['location'] is None:\n                warnings.warn(\n                    'Time column \"{}\" reference position will be ignored '\n                    'due to unspecified observatory position.'.format(col.info.name),\n                    AstropyUserWarning)\n\n        return column_info\n\n    return None\n\n\ndef _convert_global_time(table, global_info):\n    \"\"\"\n    Convert the table metadata for time informational keywords\n    to astropy Time.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        The table whose time metadata is to be converted.\n    global_info : dict\n        Global time reference frame information.\n    \"\"\"\n    # Read in Global Informational keywords as Time\n    for key, value in global_info.items():\n        # FITS uses a subset of ISO-8601 for DATE-xxx\n        if key not in table.meta:\n            try:\n                table.meta[key] = _convert_time_key(global_info, key)\n            except ValueError:\n                pass\n\n\ndef _convert_time_key(global_info, key):\n    \"\"\"\n    Convert a time metadata key to a Time object.\n\n    Parameters\n    ----------\n    global_info : dict\n        Global time reference frame information.\n    key : str\n        Time key.\n\n    Returns\n    -------\n    astropy.time.Time\n\n    Raises\n    ------\n    ValueError\n        If key is not a valid global time keyword.\n    \"\"\"\n    value = global_info[key]\n    if key.startswith('DATE'):\n        scale = 'utc' if key == 'DATE' else global_info['scale']\n        precision = len(value.split('.')[-1]) if '.' in value else 0\n        return Time(value, format='fits', scale=scale,\n                    precision=precision)\n    # MJD-xxx in MJD according to TIMESYS\n    elif key.startswith('MJD-'):\n        return Time(value, format='mjd',\n                    scale=global_info['scale'])\n    else:\n        raise ValueError('Key is not a valid global time keyword')\n\n\ndef _convert_time_column(col, column_info):\n    \"\"\"\n    Convert time columns to astropy Time columns.\n\n    Parameters\n    ----------\n    col : `~astropy.table.Column`\n        The time coordinate column to be converted to Time.\n    column_info : dict\n        Column-specific time reference frame override information.\n    \"\"\"\n\n    # The code might fail while attempting to read FITS files not written by astropy.\n    try:\n        # ISO-8601 is the only string representation of time in FITS\n        if col.info.dtype.kind in ['S', 'U']:\n            # [+/-C]CCYY-MM-DD[Thh:mm:ss[.s...]] where the number of characters\n            # from index 20 to the end of string represents the precision\n            precision = max(int(col.info.dtype.str[2:]) - 20, 0)\n            return Time(col, format='fits', scale=column_info['scale'],\n                        precision=precision,\n                        location=column_info['location'])\n\n        if column_info['format'] == 'gps':\n            return Time(col, format='gps', location=column_info['location'])\n\n        # If reference value is 0 for JD or MJD, the column values can be\n        # directly converted to Time, as they are absolute (relative\n        # to a globally accepted zero point).\n        if (column_info['ref_time']['val'] == 0 and\n                column_info['ref_time']['format'] in ['jd', 'mjd']):\n            # (jd1, jd2) where jd = jd1 + jd2\n            if col.shape[-1] == 2 and col.ndim > 1:\n                return Time(col[..., 0], col[..., 1], scale=column_info['scale'],\n                            format=column_info['ref_time']['format'],\n                            location=column_info['location'])\n            else:\n                return Time(col, scale=column_info['scale'],\n                            format=column_info['ref_time']['format'],\n                            location=column_info['location'])\n\n        # Reference time\n        ref_time = Time(column_info['ref_time']['val'], scale=column_info['scale'],\n                        format=column_info['ref_time']['format'],\n                        location=column_info['location'])\n\n        # Elapsed time since reference time\n        if col.shape[-1] == 2 and col.ndim > 1:\n            delta_time = TimeDelta(col[..., 0], col[..., 1])\n        else:\n            delta_time = TimeDelta(col)\n\n        return ref_time + delta_time\n    except Exception as err:\n        warnings.warn(\n            'The exception \"{}\" was encountered while trying to convert the time '\n            'column \"{}\" to Astropy Time.'.format(err, col.info.name),\n            AstropyUserWarning)\n        return col\n\n\ndef fits_to_time(hdr, table):\n    \"\"\"\n    Read FITS binary table time columns as `~astropy.time.Time`.\n\n    This method reads the metadata associated with time coordinates, as\n    stored in a FITS binary table header, converts time columns into\n    `~astropy.time.Time` columns and reads global reference times as\n    `~astropy.time.Time` instances.\n\n    Parameters\n    ----------\n    hdr : `~astropy.io.fits.header.Header`\n        FITS Header\n    table : `~astropy.table.Table`\n        The table whose time columns are to be read as Time\n\n    Returns\n    -------\n    hdr : `~astropy.io.fits.header.Header`\n        Modified FITS Header (time metadata removed)\n    \"\"\"\n\n    # Set defaults for global time scale, reference, etc.\n    global_info = {'TIMESYS': 'UTC',\n                   'TREFPOS': 'TOPOCENTER'}\n\n    # Set default dictionary for time columns\n    time_columns = defaultdict(OrderedDict)\n\n    # Make a \"copy\" (not just a view) of the input header, since it\n    # may get modified.  the data is still a \"view\" (for now)\n    hcopy = hdr.copy(strip=True)\n\n    # Scan the header for global and column-specific time keywords\n    for key, value, comment in hdr.cards:\n        if key in TIME_KEYWORDS:\n\n            global_info[key] = value\n            hcopy.remove(key)\n\n        elif is_time_column_keyword(key):\n\n            base, idx = re.match(r'([A-Z]+)([0-9]+)', key).groups()\n            time_columns[int(idx)][base] = value\n            hcopy.remove(key)\n\n        elif (value in ('OBSGEO-X', 'OBSGEO-Y', 'OBSGEO-Z') and\n              re.match('TTYPE[0-9]+', key)):\n\n            global_info[value] = table[value]\n\n    # Verify and get the global time reference frame information\n    _verify_global_info(global_info)\n    _convert_global_time(table, global_info)\n\n    # Columns with column-specific time (coordinate) keywords\n    if time_columns:\n        for idx, column_info in time_columns.items():\n            # Check if the column is time coordinate (not spatial)\n            if _verify_column_info(column_info, global_info):\n                colname = table.colnames[idx - 1]\n                # Convert to Time\n                table[colname] = _convert_time_column(table[colname],\n                                                      column_info)\n\n    # Check for special-cases of time coordinate columns\n    for idx, colname in enumerate(table.colnames):\n        if (idx + 1) not in time_columns:\n            column_info = _get_info_if_time_column(table[colname], global_info)\n            if column_info:\n                table[colname] = _convert_time_column(table[colname], column_info)\n\n    return hcopy\n\n\ndef time_to_fits(table):\n    \"\"\"\n    Replace Time columns in a Table with non-mixin columns containing\n    each element as a vector of two doubles (jd1, jd2) and return a FITS\n    header with appropriate time coordinate keywords.\n    jd = jd1 + jd2 represents time in the Julian Date format with\n    high-precision.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        The table whose Time columns are to be replaced.\n\n    Returns\n    -------\n    table : `~astropy.table.Table`\n        The table with replaced Time columns\n    hdr : `~astropy.io.fits.header.Header`\n        Header containing global time reference frame FITS keywords\n    \"\"\"\n    # Make a light copy of table (to the extent possible) and clear any indices along\n    # the way. Indices are not serialized and cause problems later, but they are not\n    # needed here so just drop.  For Column subclasses take advantage of copy() method,\n    # but for others it is required to actually copy the data if there are attached\n    # indices.  See #8077 and #9009 for further discussion.\n    new_cols = []\n    for col in table.itercols():\n        if isinstance(col, Column):\n            new_col = col.copy(copy_data=False)  # Also drops any indices\n        else:\n            new_col = col_copy(col, copy_indices=False) if col.info.indices else col\n        new_cols.append(new_col)\n    newtable = table.__class__(new_cols, copy=False)\n    newtable.meta = table.meta\n\n    # Global time coordinate frame keywords\n    hdr = Header([Card(keyword=key, value=val[0], comment=val[1])\n                  for key, val in GLOBAL_TIME_INFO.items()])\n\n    # Store coordinate column-specific metadata\n    newtable.meta['__coordinate_columns__'] = defaultdict(OrderedDict)\n    coord_meta = newtable.meta['__coordinate_columns__']\n\n    time_cols = table.columns.isinstance(Time)\n\n    # Geocentric location\n    location = None\n\n    for col in time_cols:\n        # By default, Time objects are written in full precision, i.e. we store both\n        # jd1 and jd2 (serialize_method['fits'] = 'jd1_jd2'). Formatted values for\n        # Time can be stored if the user explicitly chooses to do so.\n        col_cls = MaskedColumn if col.masked else Column\n        if col.info.serialize_method['fits'] == 'formatted_value':\n            newtable.replace_column(col.info.name, col_cls(col.value))\n            continue\n\n        # The following is necessary to deal with multi-dimensional ``Time`` objects\n        # (i.e. where Time.shape is non-trivial).\n        jd12 = np.stack([col.jd1, col.jd2], axis=-1)\n        # Roll the 0th (innermost) axis backwards, until it lies in the last position\n        # (jd12.ndim)\n        newtable.replace_column(col.info.name, col_cls(jd12, unit='d'))\n\n        # Time column-specific override keywords\n        coord_meta[col.info.name]['coord_type'] = col.scale.upper()\n        coord_meta[col.info.name]['coord_unit'] = 'd'\n\n        # Time column reference position\n        if getattr(col, 'location') is None:\n            coord_meta[col.info.name]['time_ref_pos'] = None\n            if location is not None:\n                warnings.warn(\n                    'Time Column \"{}\" has no specified location, but global Time '\n                    'Position is present, which will be the default for this column '\n                    'in FITS specification.'.format(col.info.name),\n                    AstropyUserWarning)\n        else:\n            coord_meta[col.info.name]['time_ref_pos'] = 'TOPOCENTER'\n            # Compatibility of Time Scales and Reference Positions\n            if col.scale in BARYCENTRIC_SCALES:\n                warnings.warn(\n                    'Earth Location \"TOPOCENTER\" for Time Column \"{}\" is incompatible '\n                    'with scale \"{}\".'.format(col.info.name, col.scale.upper()),\n                    AstropyUserWarning)\n\n            if location is None:\n                # Set global geocentric location\n                location = col.location\n                if location.size > 1:\n                    for dim in ('x', 'y', 'z'):\n                        newtable.add_column(Column(getattr(location, dim).to_value(u.m)),\n                                            name=f'OBSGEO-{dim.upper()}')\n                else:\n                    hdr.extend([Card(keyword=f'OBSGEO-{dim.upper()}',\n                                     value=getattr(location, dim).to_value(u.m))\n                                for dim in ('x', 'y', 'z')])\n            elif np.any(location != col.location):\n                raise ValueError('Multiple Time Columns with different geocentric '\n                                 'observatory locations ({}, {}) encountered.'\n                                 'This is not supported by the FITS standard.'\n                                 .format(location, col.location))\n\n    return newtable, hdr\n"},{"col":0,"comment":"\n    Converts an array to a new dtype--if the itemsize of the new dtype is\n    the same as the old dtype and both types are not numeric, a view is\n    returned.  Otherwise a new array must be created.\n    ","endLoc":724,"header":"def _convert_array(array, dtype)","id":981,"name":"_convert_array","nodeType":"Function","startLoc":708,"text":"def _convert_array(array, dtype):\n    \"\"\"\n    Converts an array to a new dtype--if the itemsize of the new dtype is\n    the same as the old dtype and both types are not numeric, a view is\n    returned.  Otherwise a new array must be created.\n    \"\"\"\n\n    if array.dtype == dtype:\n        return array\n    elif (array.dtype.itemsize == dtype.itemsize and not\n            (np.issubdtype(array.dtype, np.number) and\n             np.issubdtype(dtype, np.number))):\n        # Includes a special case when both dtypes are at least numeric to\n        # account for old Trac ticket 218 (now inaccessible).\n        return array.view(dtype)\n    else:\n        return array.astype(dtype)"},{"col":4,"comment":"null","endLoc":699,"header":"def getter(self, fget)","id":982,"name":"getter","nodeType":"Function","startLoc":698,"text":"def getter(self, fget):\n        return super().getter(self._wrap_fget(fget))"},{"col":4,"comment":"null","endLoc":704,"header":"def setter(self, fset)","id":983,"name":"setter","nodeType":"Function","startLoc":701,"text":"def setter(self, fset):\n        raise NotImplementedError(\n            \"classproperty can only be read-only; use a metaclass to \"\n            \"implement modifiable class-level properties\")"},{"col":4,"comment":"null","endLoc":709,"header":"def deleter(self, fdel)","id":984,"name":"deleter","nodeType":"Function","startLoc":706,"text":"def deleter(self, fdel):\n        raise NotImplementedError(\n            \"classproperty can only be read-only; use a metaclass to \"\n            \"implement modifiable class-level properties\")"},{"attributeType":"null","col":12,"comment":"null","endLoc":667,"id":985,"name":"_lock","nodeType":"Attribute","startLoc":667,"text":"self._lock"},{"col":4,"comment":"\n        Make sure that if the primary header needs the keyword ``EXTEND`` that\n        it has it and it is correct.\n        ","endLoc":891,"header":"def update_extend(self)","id":986,"name":"update_extend","nodeType":"Function","startLoc":861,"text":"def update_extend(self):\n        \"\"\"\n        Make sure that if the primary header needs the keyword ``EXTEND`` that\n        it has it and it is correct.\n        \"\"\"\n\n        if not len(self):\n            return\n\n        if not isinstance(self[0], PrimaryHDU):\n            # A PrimaryHDU will be automatically inserted at some point, but it\n            # might not have been added yet\n            return\n\n        hdr = self[0].header\n\n        def get_first_ext():\n            try:\n                return self[1]\n            except IndexError:\n                return None\n\n        if 'EXTEND' in hdr:\n            if not hdr['EXTEND'] and get_first_ext() is not None:\n                hdr['EXTEND'] = True\n        elif get_first_ext() is not None:\n            if hdr['NAXIS'] == 0:\n                hdr.set('EXTEND', True, after='NAXIS')\n            else:\n                n = hdr['NAXIS']\n                hdr.set('EXTEND', True, after='NAXIS' + str(n))"},{"className":"Header","col":0,"comment":"\n    FITS header class.  This class exposes both a dict-like interface and a\n    list-like interface to FITS headers.\n\n    The header may be indexed by keyword and, like a dict, the associated value\n    will be returned.  When the header contains cards with duplicate keywords,\n    only the value of the first card with the given keyword will be returned.\n    It is also possible to use a 2-tuple as the index in the form (keyword,\n    n)--this returns the n-th value with that keyword, in the case where there\n    are duplicate keywords.\n\n    For example::\n\n        >>> header['NAXIS']\n        0\n        >>> header[('FOO', 1)]  # Return the value of the second FOO keyword\n        'foo'\n\n    The header may also be indexed by card number::\n\n        >>> header[0]  # Return the value of the first card in the header\n        'T'\n\n    Commentary keywords such as HISTORY and COMMENT are special cases: When\n    indexing the Header object with either 'HISTORY' or 'COMMENT' a list of all\n    the HISTORY/COMMENT values is returned::\n\n        >>> header['HISTORY']\n        This is the first history entry in this header.\n        This is the second history entry in this header.\n        ...\n\n    See the Astropy documentation for more details on working with headers.\n\n    Notes\n    -----\n    Although FITS keywords must be exclusively upper case, retrieving an item\n    in a `Header` object is case insensitive.\n    ","endLoc":1939,"id":987,"nodeType":"Class","startLoc":42,"text":"class Header:\n    \"\"\"\n    FITS header class.  This class exposes both a dict-like interface and a\n    list-like interface to FITS headers.\n\n    The header may be indexed by keyword and, like a dict, the associated value\n    will be returned.  When the header contains cards with duplicate keywords,\n    only the value of the first card with the given keyword will be returned.\n    It is also possible to use a 2-tuple as the index in the form (keyword,\n    n)--this returns the n-th value with that keyword, in the case where there\n    are duplicate keywords.\n\n    For example::\n\n        >>> header['NAXIS']\n        0\n        >>> header[('FOO', 1)]  # Return the value of the second FOO keyword\n        'foo'\n\n    The header may also be indexed by card number::\n\n        >>> header[0]  # Return the value of the first card in the header\n        'T'\n\n    Commentary keywords such as HISTORY and COMMENT are special cases: When\n    indexing the Header object with either 'HISTORY' or 'COMMENT' a list of all\n    the HISTORY/COMMENT values is returned::\n\n        >>> header['HISTORY']\n        This is the first history entry in this header.\n        This is the second history entry in this header.\n        ...\n\n    See the Astropy documentation for more details on working with headers.\n\n    Notes\n    -----\n    Although FITS keywords must be exclusively upper case, retrieving an item\n    in a `Header` object is case insensitive.\n    \"\"\"\n\n    def __init__(self, cards=[], copy=False):\n        \"\"\"\n        Construct a `Header` from an iterable and/or text file.\n\n        Parameters\n        ----------\n        cards : list of `Card`, optional\n            The cards to initialize the header with. Also allowed are other\n            `Header` (or `dict`-like) objects.\n\n            .. versionchanged:: 1.2\n                Allowed ``cards`` to be a `dict`-like object.\n\n        copy : bool, optional\n\n            If ``True`` copies the ``cards`` if they were another `Header`\n            instance.\n            Default is ``False``.\n\n            .. versionadded:: 1.3\n        \"\"\"\n        self.clear()\n\n        if isinstance(cards, Header):\n            if copy:\n                cards = cards.copy()\n            cards = cards.cards\n        elif isinstance(cards, dict):\n            cards = cards.items()\n\n        for card in cards:\n            self.append(card, end=True)\n\n        self._modified = False\n\n    def __len__(self):\n        return len(self._cards)\n\n    def __iter__(self):\n        for card in self._cards:\n            yield card.keyword\n\n    def __contains__(self, keyword):\n        if keyword in self._keyword_indices or keyword in self._rvkc_indices:\n            # For the most common case (single, standard form keyword lookup)\n            # this will work and is an O(1) check.  If it fails that doesn't\n            # guarantee absence, just that we have to perform the full set of\n            # checks in self._cardindex\n            return True\n        try:\n            self._cardindex(keyword)\n        except (KeyError, IndexError):\n            return False\n        return True\n\n    def __getitem__(self, key):\n        if isinstance(key, slice):\n            return self.__class__([copy.copy(c) for c in self._cards[key]])\n        elif self._haswildcard(key):\n            return self.__class__([copy.copy(self._cards[idx])\n                                   for idx in self._wildcardmatch(key)])\n        elif isinstance(key, str):\n            key = key.strip()\n            if key.upper() in Card._commentary_keywords:\n                key = key.upper()\n                # Special case for commentary cards\n                return _HeaderCommentaryCards(self, key)\n\n        if isinstance(key, tuple):\n            keyword = key[0]\n        else:\n            keyword = key\n\n        card = self._cards[self._cardindex(key)]\n\n        if card.field_specifier is not None and keyword == card.rawkeyword:\n            # This is RVKC; if only the top-level keyword was specified return\n            # the raw value, not the parsed out float value\n            return card.rawvalue\n\n        value = card.value\n        if value == UNDEFINED:\n            return None\n        return value\n\n    def __setitem__(self, key, value):\n        if self._set_slice(key, value, self):\n            return\n\n        if isinstance(value, tuple):\n            if len(value) > 2:\n                raise ValueError(\n                    'A Header item may be set with either a scalar value, '\n                    'a 1-tuple containing a scalar value, or a 2-tuple '\n                    'containing a scalar value and comment string.')\n            if len(value) == 1:\n                value, comment = value[0], None\n                if value is None:\n                    value = UNDEFINED\n            elif len(value) == 2:\n                value, comment = value\n                if value is None:\n                    value = UNDEFINED\n                if comment is None:\n                    comment = ''\n        else:\n            comment = None\n\n        card = None\n        if isinstance(key, numbers.Integral):\n            card = self._cards[key]\n        elif isinstance(key, tuple):\n            card = self._cards[self._cardindex(key)]\n        if value is None:\n            value = UNDEFINED\n        if card:\n            card.value = value\n            if comment is not None:\n                card.comment = comment\n            if card._modified:\n                self._modified = True\n        else:\n            # If we get an IndexError that should be raised; we don't allow\n            # assignment to non-existing indices\n            self._update((key, value, comment))\n\n    def __delitem__(self, key):\n        if isinstance(key, slice) or self._haswildcard(key):\n            # This is very inefficient but it's not a commonly used feature.\n            # If someone out there complains that they make heavy use of slice\n            # deletions and it's too slow, well, we can worry about it then\n            # [the solution is not too complicated--it would be wait 'til all\n            # the cards are deleted before updating _keyword_indices rather\n            # than updating it once for each card that gets deleted]\n            if isinstance(key, slice):\n                indices = range(*key.indices(len(self)))\n                # If the slice step is backwards we want to reverse it, because\n                # it will be reversed in a few lines...\n                if key.step and key.step < 0:\n                    indices = reversed(indices)\n            else:\n                indices = self._wildcardmatch(key)\n            for idx in reversed(indices):\n                del self[idx]\n            return\n        elif isinstance(key, str):\n            # delete ALL cards with the same keyword name\n            key = Card.normalize_keyword(key)\n            indices = self._keyword_indices\n            if key not in self._keyword_indices:\n                indices = self._rvkc_indices\n\n            if key not in indices:\n                # if keyword is not present raise KeyError.\n                # To delete keyword without caring if they were present,\n                # Header.remove(Keyword) can be used with optional argument ignore_missing as True\n                raise KeyError(f\"Keyword '{key}' not found.\")\n\n            for idx in reversed(indices[key]):\n                # Have to copy the indices list since it will be modified below\n                del self[idx]\n            return\n\n        idx = self._cardindex(key)\n        card = self._cards[idx]\n        keyword = card.keyword\n        del self._cards[idx]\n        keyword = Card.normalize_keyword(keyword)\n        indices = self._keyword_indices[keyword]\n        indices.remove(idx)\n        if not indices:\n            del self._keyword_indices[keyword]\n\n        # Also update RVKC indices if necessary :/\n        if card.field_specifier is not None:\n            indices = self._rvkc_indices[card.rawkeyword]\n            indices.remove(idx)\n            if not indices:\n                del self._rvkc_indices[card.rawkeyword]\n\n        # We also need to update all other indices\n        self._updateindices(idx, increment=False)\n        self._modified = True\n\n    def __repr__(self):\n        return self.tostring(sep='\\n', endcard=False, padding=False)\n\n    def __str__(self):\n        return self.tostring()\n\n    def __eq__(self, other):\n        \"\"\"\n        Two Headers are equal only if they have the exact same string\n        representation.\n        \"\"\"\n\n        return str(self) == str(other)\n\n    def __add__(self, other):\n        temp = self.copy(strip=False)\n        temp.extend(other)\n        return temp\n\n    def __iadd__(self, other):\n        self.extend(other)\n        return self\n\n    def _ipython_key_completions_(self):\n        return self.__iter__()\n\n    @property\n    def cards(self):\n        \"\"\"\n        The underlying physical cards that make up this Header; it can be\n        looked at, but it should not be modified directly.\n        \"\"\"\n\n        return _CardAccessor(self)\n\n    @property\n    def comments(self):\n        \"\"\"\n        View the comments associated with each keyword, if any.\n\n        For example, to see the comment on the NAXIS keyword:\n\n            >>> header.comments['NAXIS']\n            number of data axes\n\n        Comments can also be updated through this interface:\n\n            >>> header.comments['NAXIS'] = 'Number of data axes'\n\n        \"\"\"\n\n        return _HeaderComments(self)\n\n    @property\n    def _modified(self):\n        \"\"\"\n        Whether or not the header has been modified; this is a property so that\n        it can also check each card for modifications--cards may have been\n        modified directly without the header containing it otherwise knowing.\n        \"\"\"\n\n        modified_cards = any(c._modified for c in self._cards)\n        if modified_cards:\n            # If any cards were modified then by definition the header was\n            # modified\n            self.__dict__['_modified'] = True\n\n        return self.__dict__['_modified']\n\n    @_modified.setter\n    def _modified(self, val):\n        self.__dict__['_modified'] = val\n\n    @classmethod\n    def fromstring(cls, data, sep=''):\n        \"\"\"\n        Creates an HDU header from a byte string containing the entire header\n        data.\n\n        Parameters\n        ----------\n        data : str or bytes\n           String or bytes containing the entire header.  In the case of bytes\n           they will be decoded using latin-1 (only plain ASCII characters are\n           allowed in FITS headers but latin-1 allows us to retain any invalid\n           bytes that might appear in malformatted FITS files).\n\n        sep : str, optional\n            The string separating cards from each other, such as a newline.  By\n            default there is no card separator (as is the case in a raw FITS\n            file).  In general this is only used in cases where a header was\n            printed as text (e.g. with newlines after each card) and you want\n            to create a new `Header` from it by copy/pasting.\n\n        Examples\n        --------\n\n        >>> from astropy.io.fits import Header\n        >>> hdr = Header({'SIMPLE': True})\n        >>> Header.fromstring(hdr.tostring()) == hdr\n        True\n\n        If you want to create a `Header` from printed text it's not necessary\n        to have the exact binary structure as it would appear in a FITS file,\n        with the full 80 byte card length.  Rather, each \"card\" can end in a\n        newline and does not have to be padded out to a full card length as\n        long as it \"looks like\" a FITS header:\n\n        >>> hdr = Header.fromstring(\\\"\\\"\\\"\\\\\n        ... SIMPLE  =                    T / conforms to FITS standard\n        ... BITPIX  =                    8 / array data type\n        ... NAXIS   =                    0 / number of array dimensions\n        ... EXTEND  =                    T\n        ... \\\"\\\"\\\", sep='\\\\n')\n        >>> hdr['SIMPLE']\n        True\n        >>> hdr['BITPIX']\n        8\n        >>> len(hdr)\n        4\n\n        Returns\n        -------\n        `Header`\n            A new `Header` instance.\n        \"\"\"\n\n        cards = []\n\n        # If the card separator contains characters that may validly appear in\n        # a card, the only way to unambiguously distinguish between cards is to\n        # require that they be Card.length long.  However, if the separator\n        # contains non-valid characters (namely \\n) the cards may be split\n        # immediately at the separator\n        require_full_cardlength = set(sep).issubset(VALID_HEADER_CHARS)\n\n        if isinstance(data, bytes):\n            # FITS supports only ASCII, but decode as latin1 and just take all\n            # bytes for now; if it results in mojibake due to e.g. UTF-8\n            # encoded data in a FITS header that's OK because it shouldn't be\n            # there in the first place--accepting it here still gives us the\n            # opportunity to display warnings later during validation\n            CONTINUE = b'CONTINUE'\n            END = b'END'\n            end_card = END_CARD.encode('ascii')\n            sep = sep.encode('latin1')\n            empty = b''\n        else:\n            CONTINUE = 'CONTINUE'\n            END = 'END'\n            end_card = END_CARD\n            empty = ''\n\n        # Split the header into individual cards\n        idx = 0\n        image = []\n\n        while idx < len(data):\n            if require_full_cardlength:\n                end_idx = idx + Card.length\n            else:\n                try:\n                    end_idx = data.index(sep, idx)\n                except ValueError:\n                    end_idx = len(data)\n\n            next_image = data[idx:end_idx]\n            idx = end_idx + len(sep)\n\n            if image:\n                if next_image[:8] == CONTINUE:\n                    image.append(next_image)\n                    continue\n                cards.append(Card.fromstring(empty.join(image)))\n\n            if require_full_cardlength:\n                if next_image == end_card:\n                    image = []\n                    break\n            else:\n                if next_image.split(sep)[0].rstrip() == END:\n                    image = []\n                    break\n\n            image = [next_image]\n\n        # Add the last image that was found before the end, if any\n        if image:\n            cards.append(Card.fromstring(empty.join(image)))\n\n        return cls._fromcards(cards)\n\n    @classmethod\n    def fromfile(cls, fileobj, sep='', endcard=True, padding=True):\n        \"\"\"\n        Similar to :meth:`Header.fromstring`, but reads the header string from\n        a given file-like object or filename.\n\n        Parameters\n        ----------\n        fileobj : str, file-like\n            A filename or an open file-like object from which a FITS header is\n            to be read.  For open file handles the file pointer must be at the\n            beginning of the header.\n\n        sep : str, optional\n            The string separating cards from each other, such as a newline.  By\n            default there is no card separator (as is the case in a raw FITS\n            file).\n\n        endcard : bool, optional\n            If True (the default) the header must end with an END card in order\n            to be considered valid.  If an END card is not found an\n            `OSError` is raised.\n\n        padding : bool, optional\n            If True (the default) the header will be required to be padded out\n            to a multiple of 2880, the FITS header block size.  Otherwise any\n            padding, or lack thereof, is ignored.\n\n        Returns\n        -------\n        `Header`\n            A new `Header` instance.\n        \"\"\"\n\n        close_file = False\n\n        if isinstance(fileobj, path_like):\n            # If sep is non-empty we are trying to read a header printed to a\n            # text file, so open in text mode by default to support newline\n            # handling; if a binary-mode file object is passed in, the user is\n            # then on their own w.r.t. newline handling.\n            #\n            # Otherwise assume we are reading from an actual FITS file and open\n            # in binary mode.\n            if sep:\n                fileobj = open(fileobj, 'r', encoding='latin1')\n            else:\n                fileobj = open(fileobj, 'rb')\n\n            close_file = True\n\n        try:\n            is_binary = fileobj_is_binary(fileobj)\n\n            def block_iter(nbytes):\n                while True:\n                    data = fileobj.read(nbytes)\n\n                    if data:\n                        yield data\n                    else:\n                        break\n\n            return cls._from_blocks(block_iter, is_binary, sep, endcard,\n                                    padding)[1]\n        finally:\n            if close_file:\n                fileobj.close()\n\n    @classmethod\n    def _fromcards(cls, cards):\n        header = cls()\n        for idx, card in enumerate(cards):\n            header._cards.append(card)\n            keyword = Card.normalize_keyword(card.keyword)\n            header._keyword_indices[keyword].append(idx)\n            if card.field_specifier is not None:\n                header._rvkc_indices[card.rawkeyword].append(idx)\n\n        header._modified = False\n        return header\n\n    @classmethod\n    def _from_blocks(cls, block_iter, is_binary, sep, endcard, padding):\n        \"\"\"\n        The meat of `Header.fromfile`; in a separate method so that\n        `Header.fromfile` itself is just responsible for wrapping file\n        handling.  Also used by `_BaseHDU.fromstring`.\n\n        ``block_iter`` should be a callable which, given a block size n\n        (typically 2880 bytes as used by the FITS standard) returns an iterator\n        of byte strings of that block size.\n\n        ``is_binary`` specifies whether the returned blocks are bytes or text\n\n        Returns both the entire header *string*, and the `Header` object\n        returned by Header.fromstring on that string.\n        \"\"\"\n\n        actual_block_size = _block_size(sep)\n        clen = Card.length + len(sep)\n\n        blocks = block_iter(actual_block_size)\n\n        # Read the first header block.\n        try:\n            block = next(blocks)\n        except StopIteration:\n            raise EOFError()\n\n        if not is_binary:\n            # TODO: There needs to be error handling at *this* level for\n            # non-ASCII characters; maybe at this stage decoding latin-1 might\n            # be safer\n            block = encode_ascii(block)\n\n        read_blocks = []\n        is_eof = False\n        end_found = False\n\n        # continue reading header blocks until END card or EOF is reached\n        while True:\n            # find the END card\n            end_found, block = cls._find_end_card(block, clen)\n\n            read_blocks.append(decode_ascii(block))\n\n            if end_found:\n                break\n\n            try:\n                block = next(blocks)\n            except StopIteration:\n                is_eof = True\n                break\n\n            if not block:\n                is_eof = True\n                break\n\n            if not is_binary:\n                block = encode_ascii(block)\n\n        header_str = ''.join(read_blocks)\n        _check_padding(header_str, actual_block_size, is_eof,\n                       check_block_size=padding)\n\n        if not end_found and is_eof and endcard:\n            # TODO: Pass this error to validation framework as an ERROR,\n            # rather than raising an exception\n            raise OSError('Header missing END card.')\n\n        return header_str, cls.fromstring(header_str, sep=sep)\n\n    @classmethod\n    def _find_end_card(cls, block, card_len):\n        \"\"\"\n        Utility method to search a header block for the END card and handle\n        invalid END cards.\n\n        This method can also returned a modified copy of the input header block\n        in case an invalid end card needs to be sanitized.\n        \"\"\"\n\n        for mo in HEADER_END_RE.finditer(block):\n            # Ensure the END card was found, and it started on the\n            # boundary of a new card (see ticket #142)\n            if mo.start() % card_len != 0:\n                continue\n\n            # This must be the last header block, otherwise the\n            # file is malformatted\n            if mo.group('invalid'):\n                offset = mo.start()\n                trailing = block[offset + 3:offset + card_len - 3].rstrip()\n                if trailing:\n                    trailing = repr(trailing).lstrip('ub')\n                    # TODO: Pass this warning up to the validation framework\n                    warnings.warn(\n                        'Unexpected bytes trailing END keyword: {}; these '\n                        'bytes will be replaced with spaces on write.'.format(\n                            trailing), AstropyUserWarning)\n                else:\n                    # TODO: Pass this warning up to the validation framework\n                    warnings.warn(\n                        'Missing padding to end of the FITS block after the '\n                        'END keyword; additional spaces will be appended to '\n                        'the file upon writing to pad out to {} '\n                        'bytes.'.format(BLOCK_SIZE), AstropyUserWarning)\n\n                # Sanitize out invalid END card now that the appropriate\n                # warnings have been issued\n                block = (block[:offset] + encode_ascii(END_CARD) +\n                         block[offset + len(END_CARD):])\n\n            return True, block\n\n        return False, block\n\n    def tostring(self, sep='', endcard=True, padding=True):\n        r\"\"\"\n        Returns a string representation of the header.\n\n        By default this uses no separator between cards, adds the END card, and\n        pads the string with spaces to the next multiple of 2880 bytes.  That\n        is, it returns the header exactly as it would appear in a FITS file.\n\n        Parameters\n        ----------\n        sep : str, optional\n            The character or string with which to separate cards.  By default\n            there is no separator, but one could use ``'\\\\n'``, for example, to\n            separate each card with a new line\n\n        endcard : bool, optional\n            If True (default) adds the END card to the end of the header\n            string\n\n        padding : bool, optional\n            If True (default) pads the string with spaces out to the next\n            multiple of 2880 characters\n\n        Returns\n        -------\n        str\n            A string representing a FITS header.\n        \"\"\"\n\n        lines = []\n        for card in self._cards:\n            s = str(card)\n            # Cards with CONTINUE cards may be longer than 80 chars; so break\n            # them into multiple lines\n            while s:\n                lines.append(s[:Card.length])\n                s = s[Card.length:]\n\n        s = sep.join(lines)\n        if endcard:\n            s += sep + _pad('END')\n        if padding:\n            s += ' ' * _pad_length(len(s))\n        return s\n\n    def tofile(self, fileobj, sep='', endcard=True, padding=True,\n               overwrite=False):\n        r\"\"\"\n        Writes the header to file or file-like object.\n\n        By default this writes the header exactly as it would be written to a\n        FITS file, with the END card included and padding to the next multiple\n        of 2880 bytes.  However, aspects of this may be controlled.\n\n        Parameters\n        ----------\n        fileobj : path-like or file-like, optional\n            Either the pathname of a file, or an open file handle or file-like\n            object.\n\n        sep : str, optional\n            The character or string with which to separate cards.  By default\n            there is no separator, but one could use ``'\\\\n'``, for example, to\n            separate each card with a new line\n\n        endcard : bool, optional\n            If `True` (default) adds the END card to the end of the header\n            string\n\n        padding : bool, optional\n            If `True` (default) pads the string with spaces out to the next\n            multiple of 2880 characters\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n        \"\"\"\n\n        close_file = fileobj_closed(fileobj)\n\n        if not isinstance(fileobj, _File):\n            fileobj = _File(fileobj, mode='ostream', overwrite=overwrite)\n\n        try:\n            blocks = self.tostring(sep=sep, endcard=endcard, padding=padding)\n            actual_block_size = _block_size(sep)\n            if padding and len(blocks) % actual_block_size != 0:\n                raise OSError(\n                    'Header size ({}) is not a multiple of block '\n                    'size ({}).'.format(\n                        len(blocks) - actual_block_size + BLOCK_SIZE,\n                        BLOCK_SIZE))\n\n            fileobj.flush()\n            fileobj.write(blocks.encode('ascii'))\n            fileobj.flush()\n        finally:\n            if close_file:\n                fileobj.close()\n\n    @classmethod\n    def fromtextfile(cls, fileobj, endcard=False):\n        \"\"\"\n        Read a header from a simple text file or file-like object.\n\n        Equivalent to::\n\n            >>> Header.fromfile(fileobj, sep='\\\\n', endcard=False,\n            ...                 padding=False)\n\n        See Also\n        --------\n        fromfile\n        \"\"\"\n\n        return cls.fromfile(fileobj, sep='\\n', endcard=endcard, padding=False)\n\n    def totextfile(self, fileobj, endcard=False, overwrite=False):\n        \"\"\"\n        Write the header as text to a file or a file-like object.\n\n        Equivalent to::\n\n            >>> Header.tofile(fileobj, sep='\\\\n', endcard=False,\n            ...               padding=False, overwrite=overwrite)\n\n        See Also\n        --------\n        tofile\n        \"\"\"\n\n        self.tofile(fileobj, sep='\\n', endcard=endcard, padding=False,\n                    overwrite=overwrite)\n\n    def clear(self):\n        \"\"\"\n        Remove all cards from the header.\n        \"\"\"\n\n        self._cards = []\n        self._keyword_indices = collections.defaultdict(list)\n        self._rvkc_indices = collections.defaultdict(list)\n\n    def copy(self, strip=False):\n        \"\"\"\n        Make a copy of the :class:`Header`.\n\n        .. versionchanged:: 1.3\n            `copy.copy` and `copy.deepcopy` on a `Header` will call this\n            method.\n\n        Parameters\n        ----------\n        strip : bool, optional\n            If `True`, strip any headers that are specific to one of the\n            standard HDU types, so that this header can be used in a different\n            HDU.\n\n        Returns\n        -------\n        `Header`\n            A new :class:`Header` instance.\n        \"\"\"\n\n        tmp = self.__class__((copy.copy(card) for card in self._cards))\n        if strip:\n            tmp.strip()\n        return tmp\n\n    def __copy__(self):\n        return self.copy()\n\n    def __deepcopy__(self, *args, **kwargs):\n        return self.copy()\n\n    @classmethod\n    def fromkeys(cls, iterable, value=None):\n        \"\"\"\n        Similar to :meth:`dict.fromkeys`--creates a new `Header` from an\n        iterable of keywords and an optional default value.\n\n        This method is not likely to be particularly useful for creating real\n        world FITS headers, but it is useful for testing.\n\n        Parameters\n        ----------\n        iterable\n            Any iterable that returns strings representing FITS keywords.\n\n        value : optional\n            A default value to assign to each keyword; must be a valid type for\n            FITS keywords.\n\n        Returns\n        -------\n        `Header`\n            A new `Header` instance.\n        \"\"\"\n\n        d = cls()\n        if not isinstance(value, tuple):\n            value = (value,)\n        for key in iterable:\n            d.append((key,) + value)\n        return d\n\n    def get(self, key, default=None):\n        \"\"\"\n        Similar to :meth:`dict.get`--returns the value associated with keyword\n        in the header, or a default value if the keyword is not found.\n\n        Parameters\n        ----------\n        key : str\n            A keyword that may or may not be in the header.\n\n        default : optional\n            A default value to return if the keyword is not found in the\n            header.\n\n        Returns\n        -------\n        value: str, number, complex, bool, or ``astropy.io.fits.card.Undefined``\n            The value associated with the given keyword, or the default value\n            if the keyword is not in the header.\n        \"\"\"\n\n        try:\n            return self[key]\n        except (KeyError, IndexError):\n            return default\n\n    def set(self, keyword, value=None, comment=None, before=None, after=None):\n        \"\"\"\n        Set the value and/or comment and/or position of a specified keyword.\n\n        If the keyword does not already exist in the header, a new keyword is\n        created in the specified position, or appended to the end of the header\n        if no position is specified.\n\n        This method is similar to :meth:`Header.update` prior to Astropy v0.1.\n\n        .. note::\n            It should be noted that ``header.set(keyword, value)`` and\n            ``header.set(keyword, value, comment)`` are equivalent to\n            ``header[keyword] = value`` and\n            ``header[keyword] = (value, comment)`` respectively.\n\n            New keywords can also be inserted relative to existing keywords\n            using, for example::\n\n                >>> header.insert('NAXIS1', ('NAXIS', 2, 'Number of axes'))\n\n            to insert before an existing keyword, or::\n\n                >>> header.insert('NAXIS', ('NAXIS1', 4096), after=True)\n\n            to insert after an existing keyword.\n\n            The only advantage of using :meth:`Header.set` is that it\n            easily replaces the old usage of :meth:`Header.update` both\n            conceptually and in terms of function signature.\n\n        Parameters\n        ----------\n        keyword : str\n            A header keyword\n\n        value : str, optional\n            The value to set for the given keyword; if None the existing value\n            is kept, but '' may be used to set a blank value\n\n        comment : str, optional\n            The comment to set for the given keyword; if None the existing\n            comment is kept, but ``''`` may be used to set a blank comment\n\n        before : str, int, optional\n            Name of the keyword, or index of the `Card` before which this card\n            should be located in the header.  The argument ``before`` takes\n            precedence over ``after`` if both specified.\n\n        after : str, int, optional\n            Name of the keyword, or index of the `Card` after which this card\n            should be located in the header.\n\n        \"\"\"\n\n        # Create a temporary card that looks like the one being set; if the\n        # temporary card turns out to be a RVKC this will make it easier to\n        # deal with the idiosyncrasies thereof\n        # Don't try to make a temporary card though if they keyword looks like\n        # it might be a HIERARCH card or is otherwise invalid--this step is\n        # only for validating RVKCs.\n        if (len(keyword) <= KEYWORD_LENGTH and\n            Card._keywd_FSC_RE.match(keyword) and\n                keyword not in self._keyword_indices):\n            new_card = Card(keyword, value, comment)\n            new_keyword = new_card.keyword\n        else:\n            new_keyword = keyword\n\n        if (new_keyword not in Card._commentary_keywords and\n                new_keyword in self):\n            if comment is None:\n                comment = self.comments[keyword]\n            if value is None:\n                value = self[keyword]\n\n            self[keyword] = (value, comment)\n\n            if before is not None or after is not None:\n                card = self._cards[self._cardindex(keyword)]\n                self._relativeinsert(card, before=before, after=after,\n                                     replace=True)\n        elif before is not None or after is not None:\n            self._relativeinsert((keyword, value, comment), before=before,\n                                 after=after)\n        else:\n            self[keyword] = (value, comment)\n\n    def items(self):\n        \"\"\"Like :meth:`dict.items`.\"\"\"\n\n        for card in self._cards:\n            yield card.keyword, None if card.value == UNDEFINED else card.value\n\n    def keys(self):\n        \"\"\"\n        Like :meth:`dict.keys`--iterating directly over the `Header`\n        instance has the same behavior.\n        \"\"\"\n\n        for card in self._cards:\n            yield card.keyword\n\n    def values(self):\n        \"\"\"Like :meth:`dict.values`.\"\"\"\n\n        for card in self._cards:\n            yield None if card.value == UNDEFINED else card.value\n\n    def pop(self, *args):\n        \"\"\"\n        Works like :meth:`list.pop` if no arguments or an index argument are\n        supplied; otherwise works like :meth:`dict.pop`.\n        \"\"\"\n\n        if len(args) > 2:\n            raise TypeError(f'Header.pop expected at most 2 arguments, got {len(args)}')\n\n        if len(args) == 0:\n            key = -1\n        else:\n            key = args[0]\n\n        try:\n            value = self[key]\n        except (KeyError, IndexError):\n            if len(args) == 2:\n                return args[1]\n            raise\n\n        del self[key]\n        return value\n\n    def popitem(self):\n        \"\"\"Similar to :meth:`dict.popitem`.\"\"\"\n\n        try:\n            k, v = next(self.items())\n        except StopIteration:\n            raise KeyError('Header is empty')\n        del self[k]\n        return k, v\n\n    def setdefault(self, key, default=None):\n        \"\"\"Similar to :meth:`dict.setdefault`.\"\"\"\n\n        try:\n            return self[key]\n        except (KeyError, IndexError):\n            self[key] = default\n        return default\n\n    def update(self, *args, **kwargs):\n        \"\"\"\n        Update the Header with new keyword values, updating the values of\n        existing keywords and appending new keywords otherwise; similar to\n        `dict.update`.\n\n        `update` accepts either a dict-like object or an iterable.  In the\n        former case the keys must be header keywords and the values may be\n        either scalar values or (value, comment) tuples.  In the case of an\n        iterable the items must be (keyword, value) tuples or (keyword, value,\n        comment) tuples.\n\n        Arbitrary arguments are also accepted, in which case the update() is\n        called again with the kwargs dict as its only argument.  That is,\n\n        ::\n\n            >>> header.update(NAXIS1=100, NAXIS2=100)\n\n        is equivalent to::\n\n            header.update({'NAXIS1': 100, 'NAXIS2': 100})\n\n        .. warning::\n            As this method works similarly to `dict.update` it is very\n            different from the ``Header.update()`` method in Astropy v0.1.\n            Use of the old API was\n            **deprecated** for a long time and is now removed. Most uses of the\n            old API can be replaced as follows:\n\n            * Replace ::\n\n                  header.update(keyword, value)\n\n              with ::\n\n                  header[keyword] = value\n\n            * Replace ::\n\n                  header.update(keyword, value, comment=comment)\n\n              with ::\n\n                  header[keyword] = (value, comment)\n\n            * Replace ::\n\n                  header.update(keyword, value, before=before_keyword)\n\n              with ::\n\n                  header.insert(before_keyword, (keyword, value))\n\n            * Replace ::\n\n                  header.update(keyword, value, after=after_keyword)\n\n              with ::\n\n                  header.insert(after_keyword, (keyword, value),\n                                after=True)\n\n            See also :meth:`Header.set` which is a new method that provides an\n            interface similar to the old ``Header.update()`` and may help make\n            transition a little easier.\n\n        \"\"\"\n\n        if args:\n            other = args[0]\n        else:\n            other = None\n\n        def update_from_dict(k, v):\n            if not isinstance(v, tuple):\n                card = Card(k, v)\n            elif 0 < len(v) <= 2:\n                card = Card(*((k,) + v))\n            else:\n                raise ValueError(\n                    'Header update value for key %r is invalid; the '\n                    'value must be either a scalar, a 1-tuple '\n                    'containing the scalar value, or a 2-tuple '\n                    'containing the value and a comment string.' % k)\n            self._update(card)\n\n        if other is None:\n            pass\n        elif isinstance(other, Header):\n            for card in other.cards:\n                self._update(card)\n        elif hasattr(other, 'items'):\n            for k, v in other.items():\n                update_from_dict(k, v)\n        elif hasattr(other, 'keys'):\n            for k in other.keys():\n                update_from_dict(k, other[k])\n        else:\n            for idx, card in enumerate(other):\n                if isinstance(card, Card):\n                    self._update(card)\n                elif isinstance(card, tuple) and (1 < len(card) <= 3):\n                    self._update(Card(*card))\n                else:\n                    raise ValueError(\n                        'Header update sequence item #{} is invalid; '\n                        'the item must either be a 2-tuple containing '\n                        'a keyword and value, or a 3-tuple containing '\n                        'a keyword, value, and comment string.'.format(idx))\n        if kwargs:\n            self.update(kwargs)\n\n    def append(self, card=None, useblanks=True, bottom=False, end=False):\n        \"\"\"\n        Appends a new keyword+value card to the end of the Header, similar\n        to `list.append`.\n\n        By default if the last cards in the Header have commentary keywords,\n        this will append the new keyword before the commentary (unless the new\n        keyword is also commentary).\n\n        Also differs from `list.append` in that it can be called with no\n        arguments: In this case a blank card is appended to the end of the\n        Header.  In the case all the keyword arguments are ignored.\n\n        Parameters\n        ----------\n        card : str, tuple\n            A keyword or a (keyword, value, [comment]) tuple representing a\n            single header card; the comment is optional in which case a\n            2-tuple may be used\n\n        useblanks : bool, optional\n            If there are blank cards at the end of the Header, replace the\n            first blank card so that the total number of cards in the Header\n            does not increase.  Otherwise preserve the number of blank cards.\n\n        bottom : bool, optional\n            If True, instead of appending after the last non-commentary card,\n            append after the last non-blank card.\n\n        end : bool, optional\n            If True, ignore the useblanks and bottom options, and append at the\n            very end of the Header.\n\n        \"\"\"\n\n        if isinstance(card, str):\n            card = Card(card)\n        elif isinstance(card, tuple):\n            card = Card(*card)\n        elif card is None:\n            card = Card()\n        elif not isinstance(card, Card):\n            raise ValueError(\n                'The value appended to a Header must be either a keyword or '\n                '(keyword, value, [comment]) tuple; got: {!r}'.format(card))\n\n        if not end and card.is_blank:\n            # Blank cards should always just be appended to the end\n            end = True\n\n        if end:\n            self._cards.append(card)\n            idx = len(self._cards) - 1\n        else:\n            idx = len(self._cards) - 1\n            while idx >= 0 and self._cards[idx].is_blank:\n                idx -= 1\n\n            if not bottom and card.keyword not in Card._commentary_keywords:\n                while (idx >= 0 and\n                       self._cards[idx].keyword in Card._commentary_keywords):\n                    idx -= 1\n\n            idx += 1\n            self._cards.insert(idx, card)\n            self._updateindices(idx)\n\n        keyword = Card.normalize_keyword(card.keyword)\n        self._keyword_indices[keyword].append(idx)\n        if card.field_specifier is not None:\n            self._rvkc_indices[card.rawkeyword].append(idx)\n\n        if not end:\n            # If the appended card was a commentary card, and it was appended\n            # before existing cards with the same keyword, the indices for\n            # cards with that keyword may have changed\n            if not bottom and card.keyword in Card._commentary_keywords:\n                self._keyword_indices[keyword].sort()\n\n            # Finally, if useblanks, delete a blank cards from the end\n            if useblanks and self._countblanks():\n                # Don't do this unless there is at least one blanks at the end\n                # of the header; we need to convert the card to its string\n                # image to see how long it is.  In the vast majority of cases\n                # this will just be 80 (Card.length) but it may be longer for\n                # CONTINUE cards\n                self._useblanks(len(str(card)) // Card.length)\n\n        self._modified = True\n\n    def extend(self, cards, strip=True, unique=False, update=False,\n               update_first=False, useblanks=True, bottom=False, end=False):\n        \"\"\"\n        Appends multiple keyword+value cards to the end of the header, similar\n        to `list.extend`.\n\n        Parameters\n        ----------\n        cards : iterable\n            An iterable of (keyword, value, [comment]) tuples; see\n            `Header.append`.\n\n        strip : bool, optional\n            Remove any keywords that have meaning only to specific types of\n            HDUs, so that only more general keywords are added from extension\n            Header or Card list (default: `True`).\n\n        unique : bool, optional\n            If `True`, ensures that no duplicate keywords are appended;\n            keywords already in this header are simply discarded.  The\n            exception is commentary keywords (COMMENT, HISTORY, etc.): they are\n            only treated as duplicates if their values match.\n\n        update : bool, optional\n            If `True`, update the current header with the values and comments\n            from duplicate keywords in the input header.  This supersedes the\n            ``unique`` argument.  Commentary keywords are treated the same as\n            if ``unique=True``.\n\n        update_first : bool, optional\n            If the first keyword in the header is 'SIMPLE', and the first\n            keyword in the input header is 'XTENSION', the 'SIMPLE' keyword is\n            replaced by the 'XTENSION' keyword.  Likewise if the first keyword\n            in the header is 'XTENSION' and the first keyword in the input\n            header is 'SIMPLE', the 'XTENSION' keyword is replaced by the\n            'SIMPLE' keyword.  This behavior is otherwise dumb as to whether or\n            not the resulting header is a valid primary or extension header.\n            This is mostly provided to support backwards compatibility with the\n            old ``Header.fromTxtFile`` method, and only applies if\n            ``update=True``.\n\n        useblanks, bottom, end : bool, optional\n            These arguments are passed to :meth:`Header.append` while appending\n            new cards to the header.\n        \"\"\"\n\n        temp = self.__class__(cards)\n        if strip:\n            temp.strip()\n\n        if len(self):\n            first = self._cards[0].keyword\n        else:\n            first = None\n\n        # We don't immediately modify the header, because first we need to sift\n        # out any duplicates in the new header prior to adding them to the\n        # existing header, but while *allowing* duplicates from the header\n        # being extended from (see ticket #156)\n        extend_cards = []\n\n        for idx, card in enumerate(temp.cards):\n            keyword = card.keyword\n            if keyword not in Card._commentary_keywords:\n                if unique and not update and keyword in self:\n                    continue\n                elif update:\n                    if idx == 0 and update_first:\n                        # Dumbly update the first keyword to either SIMPLE or\n                        # XTENSION as the case may be, as was in the case in\n                        # Header.fromTxtFile\n                        if ((keyword == 'SIMPLE' and first == 'XTENSION') or\n                                (keyword == 'XTENSION' and first == 'SIMPLE')):\n                            del self[0]\n                            self.insert(0, card)\n                        else:\n                            self[keyword] = (card.value, card.comment)\n                    elif keyword in self:\n                        self[keyword] = (card.value, card.comment)\n                    else:\n                        extend_cards.append(card)\n                else:\n                    extend_cards.append(card)\n            else:\n                if (unique or update) and keyword in self:\n                    if card.is_blank:\n                        extend_cards.append(card)\n                        continue\n\n                    for value in self[keyword]:\n                        if value == card.value:\n                            break\n                    else:\n                        extend_cards.append(card)\n                else:\n                    extend_cards.append(card)\n\n        for card in extend_cards:\n            self.append(card, useblanks=useblanks, bottom=bottom, end=end)\n\n    def count(self, keyword):\n        \"\"\"\n        Returns the count of the given keyword in the header, similar to\n        `list.count` if the Header object is treated as a list of keywords.\n\n        Parameters\n        ----------\n        keyword : str\n            The keyword to count instances of in the header\n\n        \"\"\"\n\n        keyword = Card.normalize_keyword(keyword)\n\n        # We have to look before we leap, since otherwise _keyword_indices,\n        # being a defaultdict, will create an entry for the nonexistent keyword\n        if keyword not in self._keyword_indices:\n            raise KeyError(f\"Keyword {keyword!r} not found.\")\n\n        return len(self._keyword_indices[keyword])\n\n    def index(self, keyword, start=None, stop=None):\n        \"\"\"\n        Returns the index if the first instance of the given keyword in the\n        header, similar to `list.index` if the Header object is treated as a\n        list of keywords.\n\n        Parameters\n        ----------\n        keyword : str\n            The keyword to look up in the list of all keywords in the header\n\n        start : int, optional\n            The lower bound for the index\n\n        stop : int, optional\n            The upper bound for the index\n\n        \"\"\"\n\n        if start is None:\n            start = 0\n\n        if stop is None:\n            stop = len(self._cards)\n\n        if stop < start:\n            step = -1\n        else:\n            step = 1\n\n        norm_keyword = Card.normalize_keyword(keyword)\n\n        for idx in range(start, stop, step):\n            if self._cards[idx].keyword.upper() == norm_keyword:\n                return idx\n        else:\n            raise ValueError(f'The keyword {keyword!r} is not in the  header.')\n\n    def insert(self, key, card, useblanks=True, after=False):\n        \"\"\"\n        Inserts a new keyword+value card into the Header at a given location,\n        similar to `list.insert`.\n\n        Parameters\n        ----------\n        key : int, str, or tuple\n            The index into the list of header keywords before which the\n            new keyword should be inserted, or the name of a keyword before\n            which the new keyword should be inserted.  Can also accept a\n            (keyword, index) tuple for inserting around duplicate keywords.\n\n        card : str, tuple\n            A keyword or a (keyword, value, [comment]) tuple; see\n            `Header.append`\n\n        useblanks : bool, optional\n            If there are blank cards at the end of the Header, replace the\n            first blank card so that the total number of cards in the Header\n            does not increase.  Otherwise preserve the number of blank cards.\n\n        after : bool, optional\n            If set to `True`, insert *after* the specified index or keyword,\n            rather than before it.  Defaults to `False`.\n        \"\"\"\n\n        if not isinstance(key, numbers.Integral):\n            # Don't pass through ints to _cardindex because it will not take\n            # kindly to indices outside the existing number of cards in the\n            # header, which insert needs to be able to support (for example\n            # when inserting into empty headers)\n            idx = self._cardindex(key)\n        else:\n            idx = key\n\n        if after:\n            if idx == -1:\n                idx = len(self._cards)\n            else:\n                idx += 1\n\n        if idx >= len(self._cards):\n            # This is just an append (Though it must be an append absolutely to\n            # the bottom, ignoring blanks, etc.--the point of the insert method\n            # is that you get exactly what you asked for with no surprises)\n            self.append(card, end=True)\n            return\n\n        if isinstance(card, str):\n            card = Card(card)\n        elif isinstance(card, tuple):\n            card = Card(*card)\n        elif not isinstance(card, Card):\n            raise ValueError(\n                'The value inserted into a Header must be either a keyword or '\n                '(keyword, value, [comment]) tuple; got: {!r}'.format(card))\n\n        self._cards.insert(idx, card)\n\n        keyword = card.keyword\n\n        # If idx was < 0, determine the actual index according to the rules\n        # used by list.insert()\n        if idx < 0:\n            idx += len(self._cards) - 1\n            if idx < 0:\n                idx = 0\n\n        # All the keyword indices above the insertion point must be updated\n        self._updateindices(idx)\n\n        keyword = Card.normalize_keyword(keyword)\n        self._keyword_indices[keyword].append(idx)\n        count = len(self._keyword_indices[keyword])\n        if count > 1:\n            # There were already keywords with this same name\n            if keyword not in Card._commentary_keywords:\n                warnings.warn(\n                    'A {!r} keyword already exists in this header.  Inserting '\n                    'duplicate keyword.'.format(keyword), AstropyUserWarning)\n            self._keyword_indices[keyword].sort()\n\n        if card.field_specifier is not None:\n            # Update the index of RVKC as well\n            rvkc_indices = self._rvkc_indices[card.rawkeyword]\n            rvkc_indices.append(idx)\n            rvkc_indices.sort()\n\n        if useblanks:\n            self._useblanks(len(str(card)) // Card.length)\n\n        self._modified = True\n\n    def remove(self, keyword, ignore_missing=False, remove_all=False):\n        \"\"\"\n        Removes the first instance of the given keyword from the header similar\n        to `list.remove` if the Header object is treated as a list of keywords.\n\n        Parameters\n        ----------\n        keyword : str\n            The keyword of which to remove the first instance in the header.\n\n        ignore_missing : bool, optional\n            When True, ignores missing keywords.  Otherwise, if the keyword\n            is not present in the header a KeyError is raised.\n\n        remove_all : bool, optional\n            When True, all instances of keyword will be removed.\n            Otherwise only the first instance of the given keyword is removed.\n\n        \"\"\"\n        keyword = Card.normalize_keyword(keyword)\n        if keyword in self._keyword_indices:\n            del self[self._keyword_indices[keyword][0]]\n            if remove_all:\n                while keyword in self._keyword_indices:\n                    del self[self._keyword_indices[keyword][0]]\n        elif not ignore_missing:\n            raise KeyError(f\"Keyword '{keyword}' not found.\")\n\n    def rename_keyword(self, oldkeyword, newkeyword, force=False):\n        \"\"\"\n        Rename a card's keyword in the header.\n\n        Parameters\n        ----------\n        oldkeyword : str or int\n            Old keyword or card index\n\n        newkeyword : str\n            New keyword\n\n        force : bool, optional\n            When `True`, if the new keyword already exists in the header, force\n            the creation of a duplicate keyword. Otherwise a\n            `ValueError` is raised.\n        \"\"\"\n\n        oldkeyword = Card.normalize_keyword(oldkeyword)\n        newkeyword = Card.normalize_keyword(newkeyword)\n\n        if newkeyword == 'CONTINUE':\n            raise ValueError('Can not rename to CONTINUE')\n\n        if (newkeyword in Card._commentary_keywords or\n                oldkeyword in Card._commentary_keywords):\n            if not (newkeyword in Card._commentary_keywords and\n                    oldkeyword in Card._commentary_keywords):\n                raise ValueError('Regular and commentary keys can not be '\n                                 'renamed to each other.')\n        elif not force and newkeyword in self:\n            raise ValueError(f'Intended keyword {newkeyword} already exists in header.')\n\n        idx = self.index(oldkeyword)\n        card = self._cards[idx]\n        del self[idx]\n        self.insert(idx, (newkeyword, card.value, card.comment))\n\n    def add_history(self, value, before=None, after=None):\n        \"\"\"\n        Add a ``HISTORY`` card.\n\n        Parameters\n        ----------\n        value : str\n            History text to be added.\n\n        before : str or int, optional\n            Same as in `Header.update`\n\n        after : str or int, optional\n            Same as in `Header.update`\n        \"\"\"\n\n        self._add_commentary('HISTORY', value, before=before, after=after)\n\n    def add_comment(self, value, before=None, after=None):\n        \"\"\"\n        Add a ``COMMENT`` card.\n\n        Parameters\n        ----------\n        value : str\n            Text to be added.\n\n        before : str or int, optional\n            Same as in `Header.update`\n\n        after : str or int, optional\n            Same as in `Header.update`\n        \"\"\"\n\n        self._add_commentary('COMMENT', value, before=before, after=after)\n\n    def add_blank(self, value='', before=None, after=None):\n        \"\"\"\n        Add a blank card.\n\n        Parameters\n        ----------\n        value : str, optional\n            Text to be added.\n\n        before : str or int, optional\n            Same as in `Header.update`\n\n        after : str or int, optional\n            Same as in `Header.update`\n        \"\"\"\n\n        self._add_commentary('', value, before=before, after=after)\n\n    def strip(self):\n        \"\"\"\n        Strip cards specific to a certain kind of header.\n\n        Strip cards like ``SIMPLE``, ``BITPIX``, etc. so the rest of\n        the header can be used to reconstruct another kind of header.\n        \"\"\"\n\n        # TODO: Previously this only deleted some cards specific to an HDU if\n        # _hdutype matched that type.  But it seemed simple enough to just\n        # delete all desired cards anyways, and just ignore the KeyErrors if\n        # they don't exist.\n        # However, it might be desirable to make this extendable somehow--have\n        # a way for HDU classes to specify some headers that are specific only\n        # to that type, and should be removed otherwise.\n\n        naxis = self.get('NAXIS', 0)\n        tfields = self.get('TFIELDS', 0)\n\n        for idx in range(naxis):\n            self.remove('NAXIS' + str(idx + 1), ignore_missing=True)\n\n        for name in ('TFORM', 'TSCAL', 'TZERO', 'TNULL', 'TTYPE',\n                     'TUNIT', 'TDISP', 'TDIM', 'THEAP', 'TBCOL'):\n            for idx in range(tfields):\n                self.remove(name + str(idx + 1), ignore_missing=True)\n\n        for name in ('SIMPLE', 'XTENSION', 'BITPIX', 'NAXIS', 'EXTEND',\n                     'PCOUNT', 'GCOUNT', 'GROUPS', 'BSCALE', 'BZERO',\n                     'TFIELDS'):\n            self.remove(name, ignore_missing=True)\n\n    def _update(self, card):\n        \"\"\"\n        The real update code.  If keyword already exists, its value and/or\n        comment will be updated.  Otherwise a new card will be appended.\n\n        This will not create a duplicate keyword except in the case of\n        commentary cards.  The only other way to force creation of a duplicate\n        is to use the insert(), append(), or extend() methods.\n        \"\"\"\n\n        keyword, value, comment = card\n\n        # Lookups for existing/known keywords are case-insensitive\n        keyword = keyword.strip().upper()\n        if keyword.startswith('HIERARCH '):\n            keyword = keyword[9:]\n\n        if (keyword not in Card._commentary_keywords and\n                keyword in self._keyword_indices):\n            # Easy; just update the value/comment\n            idx = self._keyword_indices[keyword][0]\n            existing_card = self._cards[idx]\n            existing_card.value = value\n            if comment is not None:\n                # '' should be used to explicitly blank a comment\n                existing_card.comment = comment\n            if existing_card._modified:\n                self._modified = True\n        elif keyword in Card._commentary_keywords:\n            cards = self._splitcommentary(keyword, value)\n            if keyword in self._keyword_indices:\n                # Append after the last keyword of the same type\n                idx = self.index(keyword, start=len(self) - 1, stop=-1)\n                isblank = not (keyword or value or comment)\n                for c in reversed(cards):\n                    self.insert(idx + 1, c, useblanks=(not isblank))\n            else:\n                for c in cards:\n                    self.append(c, bottom=True)\n        else:\n            # A new keyword! self.append() will handle updating _modified\n            self.append(card)\n\n    def _cardindex(self, key):\n        \"\"\"Returns an index into the ._cards list given a valid lookup key.\"\"\"\n\n        # This used to just set key = (key, 0) and then go on to act as if the\n        # user passed in a tuple, but it's much more common to just be given a\n        # string as the key, so optimize more for that case\n        if isinstance(key, str):\n            keyword = key\n            n = 0\n        elif isinstance(key, numbers.Integral):\n            # If < 0, determine the actual index\n            if key < 0:\n                key += len(self._cards)\n            if key < 0 or key >= len(self._cards):\n                raise IndexError('Header index out of range.')\n            return key\n        elif isinstance(key, slice):\n            return key\n        elif isinstance(key, tuple):\n            if (len(key) != 2 or not isinstance(key[0], str) or\n                    not isinstance(key[1], numbers.Integral)):\n                raise ValueError(\n                    'Tuple indices must be 2-tuples consisting of a '\n                    'keyword string and an integer index.')\n            keyword, n = key\n        else:\n            raise ValueError(\n                'Header indices must be either a string, a 2-tuple, or '\n                'an integer.')\n\n        keyword = Card.normalize_keyword(keyword)\n        # Returns the index into _cards for the n-th card with the given\n        # keyword (where n is 0-based)\n        indices = self._keyword_indices.get(keyword, None)\n\n        if keyword and not indices:\n            if len(keyword) > KEYWORD_LENGTH or '.' in keyword:\n                raise KeyError(f\"Keyword {keyword!r} not found.\")\n            else:\n                # Maybe it's a RVKC?\n                indices = self._rvkc_indices.get(keyword, None)\n\n        if not indices:\n            raise KeyError(f\"Keyword {keyword!r} not found.\")\n\n        try:\n            return indices[n]\n        except IndexError:\n            raise IndexError('There are only {} {!r} cards in the '\n                             'header.'.format(len(indices), keyword))\n\n    def _keyword_from_index(self, idx):\n        \"\"\"\n        Given an integer index, return the (keyword, repeat) tuple that index\n        refers to.  For most keywords the repeat will always be zero, but it\n        may be greater than zero for keywords that are duplicated (especially\n        commentary keywords).\n\n        In a sense this is the inverse of self.index, except that it also\n        supports duplicates.\n        \"\"\"\n\n        if idx < 0:\n            idx += len(self._cards)\n\n        keyword = self._cards[idx].keyword\n        keyword = Card.normalize_keyword(keyword)\n        repeat = self._keyword_indices[keyword].index(idx)\n        return keyword, repeat\n\n    def _relativeinsert(self, card, before=None, after=None, replace=False):\n        \"\"\"\n        Inserts a new card before or after an existing card; used to\n        implement support for the legacy before/after keyword arguments to\n        Header.update().\n\n        If replace=True, move an existing card with the same keyword.\n        \"\"\"\n\n        if before is None:\n            insertionkey = after\n        else:\n            insertionkey = before\n\n        def get_insertion_idx():\n            if not (isinstance(insertionkey, numbers.Integral) and\n                    insertionkey >= len(self._cards)):\n                idx = self._cardindex(insertionkey)\n            else:\n                idx = insertionkey\n\n            if before is None:\n                idx += 1\n\n            return idx\n\n        if replace:\n            # The card presumably already exists somewhere in the header.\n            # Check whether or not we actually have to move it; if it does need\n            # to be moved we just delete it and then it will be reinserted\n            # below\n            old_idx = self._cardindex(card.keyword)\n            insertion_idx = get_insertion_idx()\n\n            if (insertion_idx >= len(self._cards) and\n                    old_idx == len(self._cards) - 1):\n                # The card would be appended to the end, but it's already at\n                # the end\n                return\n\n            if before is not None:\n                if old_idx == insertion_idx - 1:\n                    return\n            elif after is not None and old_idx == insertion_idx:\n                return\n\n            del self[old_idx]\n\n        # Even if replace=True, the insertion idx may have changed since the\n        # old card was deleted\n        idx = get_insertion_idx()\n\n        if card[0] in Card._commentary_keywords:\n            cards = reversed(self._splitcommentary(card[0], card[1]))\n        else:\n            cards = [card]\n        for c in cards:\n            self.insert(idx, c)\n\n    def _updateindices(self, idx, increment=True):\n        \"\"\"\n        For all cards with index above idx, increment or decrement its index\n        value in the keyword_indices dict.\n        \"\"\"\n        if idx > len(self._cards):\n            # Save us some effort\n            return\n\n        increment = 1 if increment else -1\n\n        for index_sets in (self._keyword_indices, self._rvkc_indices):\n            for indices in index_sets.values():\n                for jdx, keyword_index in enumerate(indices):\n                    if keyword_index >= idx:\n                        indices[jdx] += increment\n\n    def _countblanks(self):\n        \"\"\"Returns the number of blank cards at the end of the Header.\"\"\"\n\n        for idx in range(1, len(self._cards)):\n            if not self._cards[-idx].is_blank:\n                return idx - 1\n        return 0\n\n    def _useblanks(self, count):\n        for _ in range(count):\n            if self._cards[-1].is_blank:\n                del self[-1]\n            else:\n                break\n\n    def _haswildcard(self, keyword):\n        \"\"\"Return `True` if the input keyword contains a wildcard pattern.\"\"\"\n\n        return (isinstance(keyword, str) and\n                (keyword.endswith('...') or '*' in keyword or '?' in keyword))\n\n    def _wildcardmatch(self, pattern):\n        \"\"\"\n        Returns a list of indices of the cards matching the given wildcard\n        pattern.\n\n         * '*' matches 0 or more characters\n         * '?' matches a single character\n         * '...' matches 0 or more of any non-whitespace character\n        \"\"\"\n\n        pattern = pattern.replace('*', r'.*').replace('?', r'.')\n        pattern = pattern.replace('...', r'\\S*') + '$'\n        pattern_re = re.compile(pattern, re.I)\n\n        return [idx for idx, card in enumerate(self._cards)\n                if pattern_re.match(card.keyword)]\n\n    def _set_slice(self, key, value, target):\n        \"\"\"\n        Used to implement Header.__setitem__ and CardAccessor.__setitem__.\n        \"\"\"\n\n        if isinstance(key, slice) or self._haswildcard(key):\n            if isinstance(key, slice):\n                indices = range(*key.indices(len(target)))\n            else:\n                indices = self._wildcardmatch(key)\n\n            if isinstance(value, str) or not isiterable(value):\n                value = itertools.repeat(value, len(indices))\n\n            for idx, val in zip(indices, value):\n                target[idx] = val\n\n            return True\n\n        return False\n\n    def _splitcommentary(self, keyword, value):\n        \"\"\"\n        Given a commentary keyword and value, returns a list of the one or more\n        cards needed to represent the full value.  This is primarily used to\n        create the multiple commentary cards needed to represent a long value\n        that won't fit into a single commentary card.\n        \"\"\"\n\n        # The maximum value in each card can be the maximum card length minus\n        # the maximum key length (which can include spaces if they key length\n        # less than 8\n        maxlen = Card.length - KEYWORD_LENGTH\n        valuestr = str(value)\n\n        if len(valuestr) <= maxlen:\n            # The value can fit in a single card\n            cards = [Card(keyword, value)]\n        else:\n            # The value must be split across multiple consecutive commentary\n            # cards\n            idx = 0\n            cards = []\n            while idx < len(valuestr):\n                cards.append(Card(keyword, valuestr[idx:idx + maxlen]))\n                idx += maxlen\n        return cards\n\n    def _add_commentary(self, key, value, before=None, after=None):\n        \"\"\"\n        Add a commentary card.\n\n        If ``before`` and ``after`` are `None`, add to the last occurrence\n        of cards of the same name (except blank card).  If there is no\n        card (or blank card), append at the end.\n        \"\"\"\n\n        if before is not None or after is not None:\n            self._relativeinsert((key, value), before=before,\n                                 after=after)\n        else:\n            self[key] = value"},{"attributeType":"null","col":12,"comment":"null","endLoc":679,"id":988,"name":"__doc__","nodeType":"Attribute","startLoc":679,"text":"self.__doc__"},{"col":4,"comment":"null","endLoc":119,"header":"def __len__(self)","id":990,"name":"__len__","nodeType":"Function","startLoc":118,"text":"def __len__(self):\n        return len(self._cards)"},{"col":4,"comment":"null","endLoc":123,"header":"def __iter__(self)","id":991,"name":"__iter__","nodeType":"Function","startLoc":121,"text":"def __iter__(self):\n        for card in self._cards:\n            yield card.keyword"},{"col":4,"comment":"null","endLoc":136,"header":"def __contains__(self, keyword)","id":992,"name":"__contains__","nodeType":"Function","startLoc":125,"text":"def __contains__(self, keyword):\n        if keyword in self._keyword_indices or keyword in self._rvkc_indices:\n            # For the most common case (single, standard form keyword lookup)\n            # this will work and is an O(1) check.  If it fails that doesn't\n            # guarantee absence, just that we have to perform the full set of\n            # checks in self._cardindex\n            return True\n        try:\n            self._cardindex(keyword)\n        except (KeyError, IndexError):\n            return False\n        return True"},{"attributeType":"null","col":8,"comment":"null","endLoc":665,"id":993,"name":"_lazy","nodeType":"Attribute","startLoc":665,"text":"self._lazy"},{"col":4,"comment":"Returns an index into the ._cards list given a valid lookup key.","endLoc":1743,"header":"def _cardindex(self, key)","id":994,"name":"_cardindex","nodeType":"Function","startLoc":1694,"text":"def _cardindex(self, key):\n        \"\"\"Returns an index into the ._cards list given a valid lookup key.\"\"\"\n\n        # This used to just set key = (key, 0) and then go on to act as if the\n        # user passed in a tuple, but it's much more common to just be given a\n        # string as the key, so optimize more for that case\n        if isinstance(key, str):\n            keyword = key\n            n = 0\n        elif isinstance(key, numbers.Integral):\n            # If < 0, determine the actual index\n            if key < 0:\n                key += len(self._cards)\n            if key < 0 or key >= len(self._cards):\n                raise IndexError('Header index out of range.')\n            return key\n        elif isinstance(key, slice):\n            return key\n        elif isinstance(key, tuple):\n            if (len(key) != 2 or not isinstance(key[0], str) or\n                    not isinstance(key[1], numbers.Integral)):\n                raise ValueError(\n                    'Tuple indices must be 2-tuples consisting of a '\n                    'keyword string and an integer index.')\n            keyword, n = key\n        else:\n            raise ValueError(\n                'Header indices must be either a string, a 2-tuple, or '\n                'an integer.')\n\n        keyword = Card.normalize_keyword(keyword)\n        # Returns the index into _cards for the n-th card with the given\n        # keyword (where n is 0-based)\n        indices = self._keyword_indices.get(keyword, None)\n\n        if keyword and not indices:\n            if len(keyword) > KEYWORD_LENGTH or '.' in keyword:\n                raise KeyError(f\"Keyword {keyword!r} not found.\")\n            else:\n                # Maybe it's a RVKC?\n                indices = self._rvkc_indices.get(keyword, None)\n\n        if not indices:\n            raise KeyError(f\"Keyword {keyword!r} not found.\")\n\n        try:\n            return indices[n]\n        except IndexError:\n            raise IndexError('There are only {} {!r} cards in the '\n                             'header.'.format(len(indices), keyword))"},{"col":4,"comment":"null","endLoc":1430,"header":"def _init_from_sequence(self, columns)","id":995,"name":"_init_from_sequence","nodeType":"Function","startLoc":1425,"text":"def _init_from_sequence(self, columns):\n        for idx, col in enumerate(columns):\n            if not isinstance(col, Column):\n                raise TypeError(f'Element {idx} in the ColDefs input is not a Column.')\n\n        self._init_from_coldefs(columns)"},{"attributeType":"null","col":12,"comment":"null","endLoc":668,"id":996,"name":"_cache","nodeType":"Attribute","startLoc":668,"text":"self._cache"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":997,"name":"NOT_OVERWRITING_MSG","nodeType":"Attribute","startLoc":38,"text":"NOT_OVERWRITING_MSG"},{"className":"_File","col":0,"comment":"\n    Represents a FITS file on disk (or in some other file-like object).\n    ","endLoc":635,"id":998,"nodeType":"Class","startLoc":102,"text":"class _File:\n    \"\"\"\n    Represents a FITS file on disk (or in some other file-like object).\n    \"\"\"\n\n    def __init__(self, fileobj=None, mode=None, memmap=None, overwrite=False,\n                 cache=True):\n        self.strict_memmap = bool(memmap)\n        memmap = True if memmap is None else memmap\n\n        self._file = None\n        self.closed = False\n        self.binary = True\n        self.mode = mode\n        self.memmap = memmap\n        self.compression = None\n        self.readonly = False\n        self.writeonly = False\n\n        # Should the object be closed on error: see\n        # https://github.com/astropy/astropy/issues/6168\n        self.close_on_error = False\n\n        # Holds mmap instance for files that use mmap\n        self._mmap = None\n\n        if fileobj is None:\n            self.simulateonly = True\n            return\n        else:\n            self.simulateonly = False\n            if isinstance(fileobj, os.PathLike):\n                fileobj = os.fspath(fileobj)\n\n        if mode is not None and mode not in IO_FITS_MODES:\n            raise ValueError(f\"Mode '{mode}' not recognized\")\n        if isfile(fileobj):\n            objmode = _normalize_fits_mode(fileobj_mode(fileobj))\n            if mode is not None and mode != objmode:\n                raise ValueError(\n                    \"Requested FITS mode '{}' not compatible with open file \"\n                    \"handle mode '{}'\".format(mode, objmode))\n            mode = objmode\n        if mode is None:\n            mode = 'readonly'\n\n        # Handle raw URLs\n        if (isinstance(fileobj, (str, bytes)) and\n                mode not in ('ostream', 'append', 'update') and _is_url(fileobj)):\n            self.name = download_file(fileobj, cache=cache)\n        # Handle responses from URL requests that have already been opened\n        elif isinstance(fileobj, http.client.HTTPResponse):\n            if mode in ('ostream', 'append', 'update'):\n                raise ValueError(\n                    f\"Mode {mode} not supported for HTTPResponse\")\n            fileobj = io.BytesIO(fileobj.read())\n        else:\n            self.name = fileobj_name(fileobj)\n\n        self.mode = mode\n\n        # Underlying fileobj is a file-like object, but an actual file object\n        self.file_like = False\n\n        # Initialize the internal self._file object\n        if isfile(fileobj):\n            self._open_fileobj(fileobj, mode, overwrite)\n        elif isinstance(fileobj, (str, bytes)):\n            self._open_filename(fileobj, mode, overwrite)\n        else:\n            self._open_filelike(fileobj, mode, overwrite)\n\n        self.fileobj_mode = fileobj_mode(self._file)\n\n        if isinstance(fileobj, gzip.GzipFile):\n            self.compression = 'gzip'\n        elif isinstance(fileobj, zipfile.ZipFile):\n            # Reading from zip files is supported but not writing (yet)\n            self.compression = 'zip'\n        elif _is_bz2file(fileobj):\n            self.compression = 'bzip2'\n\n        if (mode in ('readonly', 'copyonwrite', 'denywrite') or\n                (self.compression and mode == 'update')):\n            self.readonly = True\n        elif (mode == 'ostream' or\n                (self.compression and mode == 'append')):\n            self.writeonly = True\n\n        # For 'ab+' mode, the pointer is at the end after the open in\n        # Linux, but is at the beginning in Solaris.\n        if (mode == 'ostream' or self.compression or\n                not hasattr(self._file, 'seek')):\n            # For output stream start with a truncated file.\n            # For compressed files we can't really guess at the size\n            self.size = 0\n        else:\n            pos = self._file.tell()\n            self._file.seek(0, 2)\n            self.size = self._file.tell()\n            self._file.seek(pos)\n\n        if self.memmap:\n            if not isfile(self._file):\n                self.memmap = False\n            elif not self.readonly and not self._mmap_available:\n                # Test mmap.flush--see\n                # https://github.com/astropy/astropy/issues/968\n                self.memmap = False\n\n    def __repr__(self):\n        return f'<{self.__module__}.{self.__class__.__name__} {self._file}>'\n\n    # Support the 'with' statement\n    def __enter__(self):\n        return self\n\n    def __exit__(self, type, value, traceback):\n        self.close()\n\n    def readable(self):\n        if self.writeonly:\n            return False\n        return isreadable(self._file)\n\n    def read(self, size=None):\n        if not hasattr(self._file, 'read'):\n            raise EOFError\n        try:\n            return self._file.read(size)\n        except OSError:\n            # On some versions of Python, it appears, GzipFile will raise an\n            # OSError if you try to read past its end (as opposed to just\n            # returning '')\n            if self.compression == 'gzip':\n                return ''\n            raise\n\n    def readarray(self, size=None, offset=0, dtype=np.uint8, shape=None):\n        \"\"\"\n        Similar to file.read(), but returns the contents of the underlying\n        file as a numpy array (or mmap'd array if memmap=True) rather than a\n        string.\n\n        Usually it's best not to use the `size` argument with this method, but\n        it's provided for compatibility.\n        \"\"\"\n\n        if not hasattr(self._file, 'read'):\n            raise EOFError\n\n        if not isinstance(dtype, np.dtype):\n            dtype = np.dtype(dtype)\n\n        if size and size % dtype.itemsize != 0:\n            raise ValueError(f'size {size} not a multiple of {dtype}')\n\n        if isinstance(shape, int):\n            shape = (shape,)\n\n        if not (size or shape):\n            warnings.warn('No size or shape given to readarray(); assuming a '\n                          'shape of (1,)', AstropyUserWarning)\n            shape = (1,)\n\n        if size and not shape:\n            shape = (size // dtype.itemsize,)\n\n        if size and shape:\n            actualsize = np.prod(shape) * dtype.itemsize\n\n            if actualsize > size:\n                raise ValueError('size {} is too few bytes for a {} array of '\n                                 '{}'.format(size, shape, dtype))\n            elif actualsize < size:\n                raise ValueError('size {} is too many bytes for a {} array of '\n                                 '{}'.format(size, shape, dtype))\n\n        filepos = self._file.tell()\n\n        try:\n            if self.memmap:\n                if self._mmap is None:\n                    # Instantiate Memmap array of the file offset at 0 (so we\n                    # can return slices of it to offset anywhere else into the\n                    # file)\n                    access_mode = MEMMAP_MODES[self.mode]\n\n                    # For reasons unknown the file needs to point to (near)\n                    # the beginning or end of the file. No idea how close to\n                    # the beginning or end.\n                    # If I had to guess there is some bug in the mmap module\n                    # of CPython or perhaps in microsoft's underlying code\n                    # for generating the mmap.\n                    self._file.seek(0, 0)\n                    # This would also work:\n                    # self._file.seek(0, 2)   # moves to the end\n                    try:\n                        self._mmap = mmap.mmap(self._file.fileno(), 0,\n                                               access=access_mode,\n                                               offset=0)\n                    except OSError as exc:\n                        # NOTE: mode='readonly' results in the memory-mapping\n                        # using the ACCESS_COPY mode in mmap so that users can\n                        # modify arrays. However, on some systems, the OS raises\n                        # a '[Errno 12] Cannot allocate memory' OSError if the\n                        # address space is smaller than the file. The solution\n                        # is to open the file in mode='denywrite', which at\n                        # least allows the file to be opened even if the\n                        # resulting arrays will be truly read-only.\n                        if exc.errno == errno.ENOMEM and self.mode == 'readonly':\n                            warnings.warn(\"Could not memory map array with \"\n                                          \"mode='readonly', falling back to \"\n                                          \"mode='denywrite', which means that \"\n                                          \"the array will be read-only\",\n                                          AstropyUserWarning)\n                            self._mmap = mmap.mmap(self._file.fileno(), 0,\n                                                   access=MEMMAP_MODES['denywrite'],\n                                                   offset=0)\n                        else:\n                            raise\n\n                return np.ndarray(shape=shape, dtype=dtype, offset=offset,\n                                  buffer=self._mmap)\n            else:\n                count = reduce(operator.mul, shape)\n                self._file.seek(offset)\n                data = _array_from_file(self._file, dtype, count)\n                data.shape = shape\n                return data\n        finally:\n            # Make sure we leave the file in the position we found it; on\n            # some platforms (e.g. Windows) mmaping a file handle can also\n            # reset its file pointer\n            self._file.seek(filepos)\n\n    def writable(self):\n        if self.readonly:\n            return False\n        return iswritable(self._file)\n\n    def write(self, string):\n        if self.simulateonly:\n            return\n        if hasattr(self._file, 'write'):\n            _write_string(self._file, string)\n\n    def writearray(self, array):\n        \"\"\"\n        Similar to file.write(), but writes a numpy array instead of a string.\n\n        Also like file.write(), a flush() or close() may be needed before\n        the file on disk reflects the data written.\n        \"\"\"\n\n        if self.simulateonly:\n            return\n        if hasattr(self._file, 'write'):\n            _array_to_file(array, self._file)\n\n    def flush(self):\n        if self.simulateonly:\n            return\n        if hasattr(self._file, 'flush'):\n            self._file.flush()\n\n    def seek(self, offset, whence=0):\n        if not hasattr(self._file, 'seek'):\n            return\n        self._file.seek(offset, whence)\n        pos = self._file.tell()\n        if self.size and pos > self.size:\n            warnings.warn('File may have been truncated: actual file length '\n                          '({}) is smaller than the expected size ({})'\n                          .format(self.size, pos), AstropyUserWarning)\n\n    def tell(self):\n        if self.simulateonly:\n            raise OSError\n        if not hasattr(self._file, 'tell'):\n            raise EOFError\n        return self._file.tell()\n\n    def truncate(self, size=None):\n        if hasattr(self._file, 'truncate'):\n            self._file.truncate(size)\n\n    def close(self):\n        \"\"\"\n        Close the 'physical' FITS file.\n        \"\"\"\n\n        if hasattr(self._file, 'close'):\n            self._file.close()\n\n        self._maybe_close_mmap()\n        # Set self._memmap to None anyways since no new .data attributes can be\n        # loaded after the file is closed\n        self._mmap = None\n\n        self.closed = True\n        self.close_on_error = False\n\n    def _maybe_close_mmap(self, refcount_delta=0):\n        \"\"\"\n        When mmap is in use these objects hold a reference to the mmap of the\n        file (so there is only one, shared by all HDUs that reference this\n        file).\n\n        This will close the mmap if there are no arrays referencing it.\n        \"\"\"\n\n        if (self._mmap is not None and\n                sys.getrefcount(self._mmap) == 2 + refcount_delta):\n            self._mmap.close()\n            self._mmap = None\n\n    def _overwrite_existing(self, overwrite, fileobj, closed):\n        \"\"\"Overwrite an existing file if ``overwrite`` is ``True``, otherwise\n        raise an OSError.  The exact behavior of this method depends on the\n        _File object state and is only meant for use within the ``_open_*``\n        internal methods.\n        \"\"\"\n\n        # The file will be overwritten...\n        if ((self.file_like and hasattr(fileobj, 'len') and fileobj.len > 0) or\n                (os.path.exists(self.name) and os.path.getsize(self.name) != 0)):\n            if overwrite:\n                if self.file_like and hasattr(fileobj, 'truncate'):\n                    fileobj.truncate(0)\n                else:\n                    if not closed:\n                        fileobj.close()\n                    os.remove(self.name)\n            else:\n                raise OSError(NOT_OVERWRITING_MSG.format(self.name))\n\n    def _try_read_compressed(self, obj_or_name, magic, mode, ext=''):\n        \"\"\"Attempt to determine if the given file is compressed\"\"\"\n        is_ostream = mode == 'ostream'\n        if (is_ostream and ext == '.gz') or magic.startswith(GZIP_MAGIC):\n            if mode == 'append':\n                raise OSError(\"'append' mode is not supported with gzip files.\"\n                              \"Use 'update' mode instead\")\n            # Handle gzip files\n            kwargs = dict(mode=IO_FITS_MODES[mode])\n            if isinstance(obj_or_name, str):\n                kwargs['filename'] = obj_or_name\n            else:\n                kwargs['fileobj'] = obj_or_name\n            self._file = gzip.GzipFile(**kwargs)\n            self.compression = 'gzip'\n        elif (is_ostream and ext == '.zip') or magic.startswith(PKZIP_MAGIC):\n            # Handle zip files\n            self._open_zipfile(self.name, mode)\n            self.compression = 'zip'\n        elif (is_ostream and ext == '.bz2') or magic.startswith(BZIP2_MAGIC):\n            # Handle bzip2 files\n            if mode in ['update', 'append']:\n                raise OSError(\"update and append modes are not supported \"\n                              \"with bzip2 files\")\n            if not HAS_BZ2:\n                raise ModuleNotFoundError(\n                    \"This Python installation does not provide the bz2 module.\")\n            # bzip2 only supports 'w' and 'r' modes\n            bzip2_mode = 'w' if is_ostream else 'r'\n            self._file = bz2.BZ2File(obj_or_name, mode=bzip2_mode)\n            self.compression = 'bzip2'\n        return self.compression is not None\n\n    def _open_fileobj(self, fileobj, mode, overwrite):\n        \"\"\"Open a FITS file from a file object (including compressed files).\"\"\"\n\n        closed = fileobj_closed(fileobj)\n        # FIXME: this variable was unused, check if it was useful\n        # fmode = fileobj_mode(fileobj) or IO_FITS_MODES[mode]\n\n        if mode == 'ostream':\n            self._overwrite_existing(overwrite, fileobj, closed)\n\n        if not closed:\n            self._file = fileobj\n        elif isfile(fileobj):\n            self._file = fileobj_open(self.name, IO_FITS_MODES[mode])\n\n        # Attempt to determine if the file represented by the open file object\n        # is compressed\n        try:\n            # We need to account for the possibility that the underlying file\n            # handle may have been opened with either 'ab' or 'ab+', which\n            # means that the current file position is at the end of the file.\n            if mode in ['ostream', 'append']:\n                self._file.seek(0)\n            magic = self._file.read(4)\n            # No matter whether the underlying file was opened with 'ab' or\n            # 'ab+', we need to return to the beginning of the file in order\n            # to properly process the FITS header (and handle the possibility\n            # of a compressed file).\n            self._file.seek(0)\n        except OSError:\n            return\n\n        self._try_read_compressed(fileobj, magic, mode)\n\n    def _open_filelike(self, fileobj, mode, overwrite):\n        \"\"\"Open a FITS file from a file-like object, i.e. one that has\n        read and/or write methods.\n        \"\"\"\n\n        self.file_like = True\n        self._file = fileobj\n\n        if fileobj_closed(fileobj):\n            raise OSError(\"Cannot read from/write to a closed file-like \"\n                          \"object ({!r}).\".format(fileobj))\n\n        if isinstance(fileobj, zipfile.ZipFile):\n            self._open_zipfile(fileobj, mode)\n            # We can bypass any additional checks at this point since now\n            # self._file points to the temp file extracted from the zip\n            return\n\n        # If there is not seek or tell methods then set the mode to\n        # output streaming.\n        if (not hasattr(self._file, 'seek') or\n                not hasattr(self._file, 'tell')):\n            self.mode = mode = 'ostream'\n\n        if mode == 'ostream':\n            self._overwrite_existing(overwrite, fileobj, False)\n\n        # Any \"writeable\" mode requires a write() method on the file object\n        if (self.mode in ('update', 'append', 'ostream') and\n                not hasattr(self._file, 'write')):\n            raise OSError(\"File-like object does not have a 'write' \"\n                          \"method, required for mode '{}'.\".format(self.mode))\n\n        # Any mode except for 'ostream' requires readability\n        if self.mode != 'ostream' and not hasattr(self._file, 'read'):\n            raise OSError(\"File-like object does not have a 'read' \"\n                          \"method, required for mode {!r}.\".format(self.mode))\n\n    def _open_filename(self, filename, mode, overwrite):\n        \"\"\"Open a FITS file from a filename string.\"\"\"\n\n        if mode == 'ostream':\n            self._overwrite_existing(overwrite, None, True)\n\n        if os.path.exists(self.name):\n            with fileobj_open(self.name, 'rb') as f:\n                magic = f.read(4)\n        else:\n            magic = b''\n\n        ext = os.path.splitext(self.name)[1]\n\n        if not self._try_read_compressed(self.name, magic, mode, ext=ext):\n            self._file = fileobj_open(self.name, IO_FITS_MODES[mode])\n            self.close_on_error = True\n\n        # Make certain we're back at the beginning of the file\n        # BZ2File does not support seek when the file is open for writing, but\n        # when opening a file for write, bz2.BZ2File always truncates anyway.\n        if not (_is_bz2file(self._file) and mode == 'ostream'):\n            self._file.seek(0)\n\n    @classproperty(lazy=True)\n    def _mmap_available(cls):\n        \"\"\"Tests that mmap, and specifically mmap.flush works.  This may\n        be the case on some uncommon platforms (see\n        https://github.com/astropy/astropy/issues/968).\n\n        If mmap.flush is found not to work, ``self.memmap = False`` is\n        set and a warning is issued.\n        \"\"\"\n\n        tmpfd, tmpname = tempfile.mkstemp()\n        try:\n            # Windows does not allow mappings on empty files\n            os.write(tmpfd, b' ')\n            os.fsync(tmpfd)\n            try:\n                mm = mmap.mmap(tmpfd, 1, access=mmap.ACCESS_WRITE)\n            except OSError as exc:\n                warnings.warn('Failed to create mmap: {}; mmap use will be '\n                              'disabled'.format(str(exc)), AstropyUserWarning)\n                del exc\n                return False\n            try:\n                mm.flush()\n            except OSError:\n                warnings.warn('mmap.flush is unavailable on this platform; '\n                              'using mmap in writeable mode will be disabled',\n                              AstropyUserWarning)\n                return False\n            finally:\n                mm.close()\n        finally:\n            os.close(tmpfd)\n            os.remove(tmpname)\n\n        return True\n\n    def _open_zipfile(self, fileobj, mode):\n        \"\"\"Limited support for zipfile.ZipFile objects containing a single\n        a file.  Allows reading only for now by extracting the file to a\n        tempfile.\n        \"\"\"\n\n        if mode in ('update', 'append'):\n            raise OSError(\n                  \"Writing to zipped fits files is not currently \"\n                  \"supported\")\n\n        if not isinstance(fileobj, zipfile.ZipFile):\n            zfile = zipfile.ZipFile(fileobj)\n            close = True\n        else:\n            zfile = fileobj\n            close = False\n\n        namelist = zfile.namelist()\n        if len(namelist) != 1:\n            raise OSError(\n              \"Zip files with multiple members are not supported.\")\n        self._file = tempfile.NamedTemporaryFile(suffix='.fits')\n        self._file.write(zfile.read(namelist[0]))\n\n        if close:\n            zfile.close()\n        # We just wrote the contents of the first file in the archive to a new\n        # temp file, which now serves as our underlying file object. So it's\n        # necessary to reset the position back to the beginning\n        self._file.seek(0)"},{"col":4,"comment":"null","endLoc":1515,"header":"def _init_from_table(self, table)","id":999,"name":"_init_from_table","nodeType":"Function","startLoc":1466,"text":"def _init_from_table(self, table):\n        hdr = table._header\n        nfields = hdr['TFIELDS']\n\n        # go through header keywords to pick out column definition keywords\n        # definition dictionaries for each field\n        col_keywords = [{} for i in range(nfields)]\n        for keyword in hdr:\n            key = TDEF_RE.match(keyword)\n            try:\n                label = key.group('label')\n            except Exception:\n                continue  # skip if there is no match\n            if label in KEYWORD_NAMES:\n                col = int(key.group('num'))\n                if 0 < col <= nfields:\n                    attr = KEYWORD_TO_ATTRIBUTE[label]\n                    value = hdr[keyword]\n                    if attr == 'format':\n                        # Go ahead and convert the format value to the\n                        # appropriate ColumnFormat container now\n                        value = self._col_format_cls(value)\n                    col_keywords[col - 1][attr] = value\n\n        # Verify the column keywords and display any warnings if necessary;\n        # we only want to pass on the valid keywords\n        for idx, kwargs in enumerate(col_keywords):\n            valid_kwargs, invalid_kwargs = Column._verify_keywords(**kwargs)\n            for val in invalid_kwargs.values():\n                warnings.warn(\n                    f'Invalid keyword for column {idx + 1}: {val[1]}',\n                    VerifyWarning)\n            # Special cases for recformat and dim\n            # TODO: Try to eliminate the need for these special cases\n            del valid_kwargs['recformat']\n            if 'dim' in valid_kwargs:\n                valid_kwargs['dim'] = kwargs['dim']\n            col_keywords[idx] = valid_kwargs\n\n        # data reading will be delayed\n        for col in range(nfields):\n            col_keywords[col]['array'] = Delayed(table, col)\n\n        # now build the columns\n        self.columns = [Column(**attrs) for attrs in col_keywords]\n\n        # Add the table HDU is a listener to changes to the columns\n        # (either changes to individual columns, or changes to the set of\n        # columns (add/remove/etc.))\n        self._add_listener(table)"},{"col":4,"comment":"null","endLoc":213,"header":"def __repr__(self)","id":1000,"name":"__repr__","nodeType":"Function","startLoc":212,"text":"def __repr__(self):\n        return f'<{self.__module__}.{self.__class__.__name__} {self._file}>'"},{"col":4,"comment":"null","endLoc":217,"header":"def __enter__(self)","id":1001,"name":"__enter__","nodeType":"Function","startLoc":216,"text":"def __enter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":220,"header":"def __exit__(self, type, value, traceback)","id":1002,"name":"__exit__","nodeType":"Function","startLoc":219,"text":"def __exit__(self, type, value, traceback):\n        self.close()"},{"col":4,"comment":"\n        Close the 'physical' FITS file.\n        ","endLoc":403,"header":"def close(self)","id":1003,"name":"close","nodeType":"Function","startLoc":389,"text":"def close(self):\n        \"\"\"\n        Close the 'physical' FITS file.\n        \"\"\"\n\n        if hasattr(self._file, 'close'):\n            self._file.close()\n\n        self._maybe_close_mmap()\n        # Set self._memmap to None anyways since no new .data attributes can be\n        # loaded after the file is closed\n        self._mmap = None\n\n        self.closed = True\n        self.close_on_error = False"},{"col":4,"comment":"null","endLoc":166,"header":"def __getitem__(self, key)","id":1004,"name":"__getitem__","nodeType":"Function","startLoc":138,"text":"def __getitem__(self, key):\n        if isinstance(key, slice):\n            return self.__class__([copy.copy(c) for c in self._cards[key]])\n        elif self._haswildcard(key):\n            return self.__class__([copy.copy(self._cards[idx])\n                                   for idx in self._wildcardmatch(key)])\n        elif isinstance(key, str):\n            key = key.strip()\n            if key.upper() in Card._commentary_keywords:\n                key = key.upper()\n                # Special case for commentary cards\n                return _HeaderCommentaryCards(self, key)\n\n        if isinstance(key, tuple):\n            keyword = key[0]\n        else:\n            keyword = key\n\n        card = self._cards[self._cardindex(key)]\n\n        if card.field_specifier is not None and keyword == card.rawkeyword:\n            # This is RVKC; if only the top-level keyword was specified return\n            # the raw value, not the parsed out float value\n            return card.rawvalue\n\n        value = card.value\n        if value == UNDEFINED:\n            return None\n        return value"},{"col":4,"comment":"\n        When mmap is in use these objects hold a reference to the mmap of the\n        file (so there is only one, shared by all HDUs that reference this\n        file).\n\n        This will close the mmap if there are no arrays referencing it.\n        ","endLoc":417,"header":"def _maybe_close_mmap(self, refcount_delta=0)","id":1005,"name":"_maybe_close_mmap","nodeType":"Function","startLoc":405,"text":"def _maybe_close_mmap(self, refcount_delta=0):\n        \"\"\"\n        When mmap is in use these objects hold a reference to the mmap of the\n        file (so there is only one, shared by all HDUs that reference this\n        file).\n\n        This will close the mmap if there are no arrays referencing it.\n        \"\"\"\n\n        if (self._mmap is not None and\n                sys.getrefcount(self._mmap) == 2 + refcount_delta):\n            self._mmap.close()\n            self._mmap = None"},{"col":4,"comment":"Return `True` if the input keyword contains a wildcard pattern.","endLoc":1859,"header":"def _haswildcard(self, keyword)","id":1006,"name":"_haswildcard","nodeType":"Function","startLoc":1855,"text":"def _haswildcard(self, keyword):\n        \"\"\"Return `True` if the input keyword contains a wildcard pattern.\"\"\"\n\n        return (isinstance(keyword, str) and\n                (keyword.endswith('...') or '*' in keyword or '?' in keyword))"},{"col":4,"comment":"null","endLoc":225,"header":"def readable(self)","id":1007,"name":"readable","nodeType":"Function","startLoc":222,"text":"def readable(self):\n        if self.writeonly:\n            return False\n        return isreadable(self._file)"},{"col":4,"comment":"\n        Returns a list of indices of the cards matching the given wildcard\n        pattern.\n\n         * '*' matches 0 or more characters\n         * '?' matches a single character\n         * '...' matches 0 or more of any non-whitespace character\n        ","endLoc":1876,"header":"def _wildcardmatch(self, pattern)","id":1008,"name":"_wildcardmatch","nodeType":"Function","startLoc":1861,"text":"def _wildcardmatch(self, pattern):\n        \"\"\"\n        Returns a list of indices of the cards matching the given wildcard\n        pattern.\n\n         * '*' matches 0 or more characters\n         * '?' matches a single character\n         * '...' matches 0 or more of any non-whitespace character\n        \"\"\"\n\n        pattern = pattern.replace('*', r'.*').replace('?', r'.')\n        pattern = pattern.replace('...', r'\\S*') + '$'\n        pattern_re = re.compile(pattern, re.I)\n\n        return [idx for idx, card in enumerate(self._cards)\n                if pattern_re.match(card.keyword)]"},{"col":4,"comment":"null","endLoc":238,"header":"def read(self, size=None)","id":1009,"name":"read","nodeType":"Function","startLoc":227,"text":"def read(self, size=None):\n        if not hasattr(self._file, 'read'):\n            raise EOFError\n        try:\n            return self._file.read(size)\n        except OSError:\n            # On some versions of Python, it appears, GzipFile will raise an\n            # OSError if you try to read past its end (as opposed to just\n            # returning '')\n            if self.compression == 'gzip':\n                return ''\n            raise"},{"col":4,"comment":"\n        Similar to file.read(), but returns the contents of the underlying\n        file as a numpy array (or mmap'd array if memmap=True) rather than a\n        string.\n\n        Usually it's best not to use the `size` argument with this method, but\n        it's provided for compatibility.\n        ","endLoc":336,"header":"def readarray(self, size=None, offset=0, dtype=np.uint8, shape=None)","id":1010,"name":"readarray","nodeType":"Function","startLoc":240,"text":"def readarray(self, size=None, offset=0, dtype=np.uint8, shape=None):\n        \"\"\"\n        Similar to file.read(), but returns the contents of the underlying\n        file as a numpy array (or mmap'd array if memmap=True) rather than a\n        string.\n\n        Usually it's best not to use the `size` argument with this method, but\n        it's provided for compatibility.\n        \"\"\"\n\n        if not hasattr(self._file, 'read'):\n            raise EOFError\n\n        if not isinstance(dtype, np.dtype):\n            dtype = np.dtype(dtype)\n\n        if size and size % dtype.itemsize != 0:\n            raise ValueError(f'size {size} not a multiple of {dtype}')\n\n        if isinstance(shape, int):\n            shape = (shape,)\n\n        if not (size or shape):\n            warnings.warn('No size or shape given to readarray(); assuming a '\n                          'shape of (1,)', AstropyUserWarning)\n            shape = (1,)\n\n        if size and not shape:\n            shape = (size // dtype.itemsize,)\n\n        if size and shape:\n            actualsize = np.prod(shape) * dtype.itemsize\n\n            if actualsize > size:\n                raise ValueError('size {} is too few bytes for a {} array of '\n                                 '{}'.format(size, shape, dtype))\n            elif actualsize < size:\n                raise ValueError('size {} is too many bytes for a {} array of '\n                                 '{}'.format(size, shape, dtype))\n\n        filepos = self._file.tell()\n\n        try:\n            if self.memmap:\n                if self._mmap is None:\n                    # Instantiate Memmap array of the file offset at 0 (so we\n                    # can return slices of it to offset anywhere else into the\n                    # file)\n                    access_mode = MEMMAP_MODES[self.mode]\n\n                    # For reasons unknown the file needs to point to (near)\n                    # the beginning or end of the file. No idea how close to\n                    # the beginning or end.\n                    # If I had to guess there is some bug in the mmap module\n                    # of CPython or perhaps in microsoft's underlying code\n                    # for generating the mmap.\n                    self._file.seek(0, 0)\n                    # This would also work:\n                    # self._file.seek(0, 2)   # moves to the end\n                    try:\n                        self._mmap = mmap.mmap(self._file.fileno(), 0,\n                                               access=access_mode,\n                                               offset=0)\n                    except OSError as exc:\n                        # NOTE: mode='readonly' results in the memory-mapping\n                        # using the ACCESS_COPY mode in mmap so that users can\n                        # modify arrays. However, on some systems, the OS raises\n                        # a '[Errno 12] Cannot allocate memory' OSError if the\n                        # address space is smaller than the file. The solution\n                        # is to open the file in mode='denywrite', which at\n                        # least allows the file to be opened even if the\n                        # resulting arrays will be truly read-only.\n                        if exc.errno == errno.ENOMEM and self.mode == 'readonly':\n                            warnings.warn(\"Could not memory map array with \"\n                                          \"mode='readonly', falling back to \"\n                                          \"mode='denywrite', which means that \"\n                                          \"the array will be read-only\",\n                                          AstropyUserWarning)\n                            self._mmap = mmap.mmap(self._file.fileno(), 0,\n                                                   access=MEMMAP_MODES['denywrite'],\n                                                   offset=0)\n                        else:\n                            raise\n\n                return np.ndarray(shape=shape, dtype=dtype, offset=offset,\n                                  buffer=self._mmap)\n            else:\n                count = reduce(operator.mul, shape)\n                self._file.seek(offset)\n                data = _array_from_file(self._file, dtype, count)\n                data.shape = shape\n                return data\n        finally:\n            # Make sure we leave the file in the position we found it; on\n            # some platforms (e.g. Windows) mmaping a file handle can also\n            # reset its file pointer\n            self._file.seek(filepos)"},{"col":4,"comment":"null","endLoc":211,"header":"def __new__(cls, *args, **kwargs)","id":1011,"name":"__new__","nodeType":"Function","startLoc":196,"text":"def __new__(cls, *args, **kwargs):\n        # TODO: needs copy argument and better dealing with inputs.\n        if (len(args) == 1 and len(kwargs) == 0 and\n                isinstance(args[0], EarthLocation)):\n            return args[0].copy()\n        try:\n            self = cls.from_geocentric(*args, **kwargs)\n        except (u.UnitsError, TypeError) as exc_geocentric:\n            try:\n                self = cls.from_geodetic(*args, **kwargs)\n            except Exception as exc_geodetic:\n                raise TypeError('Coordinates could not be parsed as either '\n                                'geocentric or geodetic, with respective '\n                                'exceptions \"{}\" and \"{}\"'\n                                .format(exc_geocentric, exc_geodetic))\n        return self"},{"col":4,"comment":"null","endLoc":2198,"header":"def __init__(self, header, keyword='')","id":1012,"name":"__init__","nodeType":"Function","startLoc":2194,"text":"def __init__(self, header, keyword=''):\n        super().__init__(header)\n        self._keyword = keyword\n        self._count = self._header.count(self._keyword)\n        self._indices = slice(self._count).indices(self._count)"},{"col":4,"comment":"null","endLoc":191,"header":"def __init__(self, hdu=None, field=None)","id":1013,"name":"__init__","nodeType":"Function","startLoc":189,"text":"def __init__(self, hdu=None, field=None):\n        self.hdu = weakref.proxy(hdu)\n        self.field = field"},{"col":4,"comment":"null","endLoc":2079,"header":"def __init__(self, header)","id":1014,"name":"__init__","nodeType":"Function","startLoc":2078,"text":"def __init__(self, header):\n        self._header = header"},{"col":4,"comment":"null","endLoc":207,"header":"def __setitem__(self, key, value)","id":1015,"name":"__setitem__","nodeType":"Function","startLoc":168,"text":"def __setitem__(self, key, value):\n        if self._set_slice(key, value, self):\n            return\n\n        if isinstance(value, tuple):\n            if len(value) > 2:\n                raise ValueError(\n                    'A Header item may be set with either a scalar value, '\n                    'a 1-tuple containing a scalar value, or a 2-tuple '\n                    'containing a scalar value and comment string.')\n            if len(value) == 1:\n                value, comment = value[0], None\n                if value is None:\n                    value = UNDEFINED\n            elif len(value) == 2:\n                value, comment = value\n                if value is None:\n                    value = UNDEFINED\n                if comment is None:\n                    comment = ''\n        else:\n            comment = None\n\n        card = None\n        if isinstance(key, numbers.Integral):\n            card = self._cards[key]\n        elif isinstance(key, tuple):\n            card = self._cards[self._cardindex(key)]\n        if value is None:\n            value = UNDEFINED\n        if card:\n            card.value = value\n            if comment is not None:\n                card.comment = comment\n            if card._modified:\n                self._modified = True\n        else:\n            # If we get an IndexError that should be raised; we don't allow\n            # assignment to non-existing indices\n            self._update((key, value, comment))"},{"col":4,"comment":"\n        Used to implement Header.__setitem__ and CardAccessor.__setitem__.\n        ","endLoc":1897,"header":"def _set_slice(self, key, value, target)","id":1016,"name":"_set_slice","nodeType":"Function","startLoc":1878,"text":"def _set_slice(self, key, value, target):\n        \"\"\"\n        Used to implement Header.__setitem__ and CardAccessor.__setitem__.\n        \"\"\"\n\n        if isinstance(key, slice) or self._haswildcard(key):\n            if isinstance(key, slice):\n                indices = range(*key.indices(len(target)))\n            else:\n                indices = self._wildcardmatch(key)\n\n            if isinstance(value, str) or not isiterable(value):\n                value = itertools.repeat(value, len(indices))\n\n            for idx, val in zip(indices, value):\n                target[idx] = val\n\n            return True\n\n        return False"},{"col":4,"comment":"\n        The real update code.  If keyword already exists, its value and/or\n        comment will be updated.  Otherwise a new card will be appended.\n\n        This will not create a duplicate keyword except in the case of\n        commentary cards.  The only other way to force creation of a duplicate\n        is to use the insert(), append(), or extend() methods.\n        ","endLoc":1692,"header":"def _update(self, card)","id":1017,"name":"_update","nodeType":"Function","startLoc":1651,"text":"def _update(self, card):\n        \"\"\"\n        The real update code.  If keyword already exists, its value and/or\n        comment will be updated.  Otherwise a new card will be appended.\n\n        This will not create a duplicate keyword except in the case of\n        commentary cards.  The only other way to force creation of a duplicate\n        is to use the insert(), append(), or extend() methods.\n        \"\"\"\n\n        keyword, value, comment = card\n\n        # Lookups for existing/known keywords are case-insensitive\n        keyword = keyword.strip().upper()\n        if keyword.startswith('HIERARCH '):\n            keyword = keyword[9:]\n\n        if (keyword not in Card._commentary_keywords and\n                keyword in self._keyword_indices):\n            # Easy; just update the value/comment\n            idx = self._keyword_indices[keyword][0]\n            existing_card = self._cards[idx]\n            existing_card.value = value\n            if comment is not None:\n                # '' should be used to explicitly blank a comment\n                existing_card.comment = comment\n            if existing_card._modified:\n                self._modified = True\n        elif keyword in Card._commentary_keywords:\n            cards = self._splitcommentary(keyword, value)\n            if keyword in self._keyword_indices:\n                # Append after the last keyword of the same type\n                idx = self.index(keyword, start=len(self) - 1, stop=-1)\n                isblank = not (keyword or value or comment)\n                for c in reversed(cards):\n                    self.insert(idx + 1, c, useblanks=(not isblank))\n            else:\n                for c in cards:\n                    self.append(c, bottom=True)\n        else:\n            # A new keyword! self.append() will handle updating _modified\n            self.append(card)"},{"col":4,"comment":"null","endLoc":1518,"header":"def __copy__(self)","id":1018,"name":"__copy__","nodeType":"Function","startLoc":1517,"text":"def __copy__(self):\n        return self.__class__(self)"},{"col":4,"comment":"null","endLoc":1521,"header":"def __deepcopy__(self, memo)","id":1019,"name":"__deepcopy__","nodeType":"Function","startLoc":1520,"text":"def __deepcopy__(self, memo):\n        return self.__class__([copy.deepcopy(c, memo) for c in self.columns])"},{"col":4,"comment":"\n        Automatically returns the values for the given keyword attribute for\n        all `Column`s in this list.\n\n        Implements for example self.units, self.formats, etc.\n        ","endLoc":1584,"header":"def __getattr__(self, name)","id":1020,"name":"__getattr__","nodeType":"Function","startLoc":1570,"text":"def __getattr__(self, name):\n        \"\"\"\n        Automatically returns the values for the given keyword attribute for\n        all `Column`s in this list.\n\n        Implements for example self.units, self.formats, etc.\n        \"\"\"\n        cname = name[:-1]\n        if cname in KEYWORD_ATTRIBUTES and name[-1] == 's':\n            attr = []\n            for col in self.columns:\n                val = getattr(col, cname)\n                attr.append(val if val is not None else '')\n            return attr\n        raise AttributeError(name)"},{"col":4,"comment":"null","endLoc":1617,"header":"@lazyproperty\n    def dtype(self)","id":1021,"name":"dtype","nodeType":"Function","startLoc":1586,"text":"@lazyproperty\n    def dtype(self):\n        # Note: This previously returned a dtype that just used the raw field\n        # widths based on the format's repeat count, and did not incorporate\n        # field *shapes* as provided by TDIMn keywords.\n        # Now this incorporates TDIMn from the start, which makes *this* method\n        # a little more complicated, but simplifies code elsewhere (for example\n        # fields will have the correct shapes even in the raw recarray).\n        formats = []\n        offsets = [0]\n\n        for format_, dim in zip(self.formats, self._dims):\n            dt = format_.dtype\n\n            if len(offsets) < len(self.formats):\n                # Note: the size of the *original* format_ may be greater than\n                # one would expect from the number of elements determined by\n                # dim.  The FITS format allows this--the rest of the field is\n                # filled with undefined values.\n                offsets.append(offsets[-1] + dt.itemsize)\n\n            if dim:\n                if format_.format == 'A':\n                    dt = np.dtype((dt.char + str(dim[-1]), dim[:-1]))\n                else:\n                    dt = np.dtype((dt.base, dim))\n\n            formats.append(dt)\n\n        return np.dtype({'names': self.names,\n                         'formats': formats,\n                         'offsets': offsets})"},{"col":4,"comment":"null","endLoc":1621,"header":"@lazyproperty\n    def names(self)","id":1022,"name":"names","nodeType":"Function","startLoc":1619,"text":"@lazyproperty\n    def names(self):\n        return [col.name for col in self.columns]"},{"col":4,"comment":"null","endLoc":1625,"header":"@lazyproperty\n    def formats(self)","id":1023,"name":"formats","nodeType":"Function","startLoc":1623,"text":"@lazyproperty\n    def formats(self):\n        return [col.format for col in self.columns]"},{"col":4,"comment":"null","endLoc":1629,"header":"@lazyproperty\n    def _arrays(self)","id":1024,"name":"_arrays","nodeType":"Function","startLoc":1627,"text":"@lazyproperty\n    def _arrays(self):\n        return [col.array for col in self.columns]"},{"col":4,"comment":"null","endLoc":1633,"header":"@lazyproperty\n    def _recformats(self)","id":1025,"name":"_recformats","nodeType":"Function","startLoc":1631,"text":"@lazyproperty\n    def _recformats(self):\n        return [fmt.recformat for fmt in self.formats]"},{"col":4,"comment":"Returns the values of the TDIMn keywords parsed into tuples.","endLoc":1639,"header":"@lazyproperty\n    def _dims(self)","id":1026,"name":"_dims","nodeType":"Function","startLoc":1635,"text":"@lazyproperty\n    def _dims(self):\n        \"\"\"Returns the values of the TDIMn keywords parsed into tuples.\"\"\"\n\n        return [col._dims for col in self.columns]"},{"col":4,"comment":"null","endLoc":1649,"header":"def __getitem__(self, key)","id":1027,"name":"__getitem__","nodeType":"Function","startLoc":1641,"text":"def __getitem__(self, key):\n        if isinstance(key, str):\n            key = _get_index(self.names, key)\n\n        x = self.columns[key]\n        if _is_int(key):\n            return x\n        else:\n            return ColDefs(x)"},{"col":0,"comment":"\n    Get the index of the ``key`` in the ``names`` list.\n\n    The ``key`` can be an integer or string.  If integer, it is the index\n    in the list.  If string,\n\n        a. Field (column) names are case sensitive: you can have two\n           different columns called 'abc' and 'ABC' respectively.\n\n        b. When you *refer* to a field (presumably with the field\n           method), it will try to match the exact name first, so in\n           the example in (a), field('abc') will get the first field,\n           and field('ABC') will get the second field.\n\n        If there is no exact name matched, it will try to match the\n        name with case insensitivity.  So, in the last example,\n        field('Abc') will cause an exception since there is no unique\n        mapping.  If there is a field named \"XYZ\" and no other field\n        name is a case variant of \"XYZ\", then field('xyz'),\n        field('Xyz'), etc. will get this field.\n    ","endLoc":2060,"header":"def _get_index(names, key)","id":1028,"name":"_get_index","nodeType":"Function","startLoc":2017,"text":"def _get_index(names, key):\n    \"\"\"\n    Get the index of the ``key`` in the ``names`` list.\n\n    The ``key`` can be an integer or string.  If integer, it is the index\n    in the list.  If string,\n\n        a. Field (column) names are case sensitive: you can have two\n           different columns called 'abc' and 'ABC' respectively.\n\n        b. When you *refer* to a field (presumably with the field\n           method), it will try to match the exact name first, so in\n           the example in (a), field('abc') will get the first field,\n           and field('ABC') will get the second field.\n\n        If there is no exact name matched, it will try to match the\n        name with case insensitivity.  So, in the last example,\n        field('Abc') will cause an exception since there is no unique\n        mapping.  If there is a field named \"XYZ\" and no other field\n        name is a case variant of \"XYZ\", then field('xyz'),\n        field('Xyz'), etc. will get this field.\n    \"\"\"\n\n    if _is_int(key):\n        indx = int(key)\n    elif isinstance(key, str):\n        # try to find exact match first\n        try:\n            indx = names.index(key.rstrip())\n        except ValueError:\n            # try to match case-insentively,\n            _key = key.lower().rstrip()\n            names = [n.lower().rstrip() for n in names]\n            count = names.count(_key)  # occurrence of _key in names\n            if count == 1:\n                indx = names.index(_key)\n            elif count == 0:\n                raise KeyError(f\"Key '{key}' does not exist.\")\n            else:              # multiple match\n                raise KeyError(f\"Ambiguous key name '{key}'.\")\n    else:\n        raise KeyError(f\"Illegal key '{key!r}'.\")\n\n    return indx"},{"col":4,"comment":"\n        Given a commentary keyword and value, returns a list of the one or more\n        cards needed to represent the full value.  This is primarily used to\n        create the multiple commentary cards needed to represent a long value\n        that won't fit into a single commentary card.\n        ","endLoc":1924,"header":"def _splitcommentary(self, keyword, value)","id":1029,"name":"_splitcommentary","nodeType":"Function","startLoc":1899,"text":"def _splitcommentary(self, keyword, value):\n        \"\"\"\n        Given a commentary keyword and value, returns a list of the one or more\n        cards needed to represent the full value.  This is primarily used to\n        create the multiple commentary cards needed to represent a long value\n        that won't fit into a single commentary card.\n        \"\"\"\n\n        # The maximum value in each card can be the maximum card length minus\n        # the maximum key length (which can include spaces if they key length\n        # less than 8\n        maxlen = Card.length - KEYWORD_LENGTH\n        valuestr = str(value)\n\n        if len(valuestr) <= maxlen:\n            # The value can fit in a single card\n            cards = [Card(keyword, value)]\n        else:\n            # The value must be split across multiple consecutive commentary\n            # cards\n            idx = 0\n            cards = []\n            while idx < len(valuestr):\n                cards.append(Card(keyword, valuestr[idx:idx + maxlen]))\n                idx += maxlen\n        return cards"},{"col":0,"comment":"\n    Write a `~numpy.ndarray` to a file-like object (which is not supported by\n    `numpy.ndarray.tofile`).\n    ","endLoc":687,"header":"def _array_to_file_like(arr, fileobj)","id":1031,"name":"_array_to_file_like","nodeType":"Function","startLoc":647,"text":"def _array_to_file_like(arr, fileobj):\n    \"\"\"\n    Write a `~numpy.ndarray` to a file-like object (which is not supported by\n    `numpy.ndarray.tofile`).\n    \"\"\"\n\n    # If the array is empty, we can simply take a shortcut and return since\n    # there is nothing to write.\n    if len(arr) == 0:\n        return\n\n    if arr.flags.contiguous:\n\n        # It suffices to just pass the underlying buffer directly to the\n        # fileobj's write (assuming it supports the buffer interface). If\n        # it does not have the buffer interface, a TypeError should be returned\n        # in which case we can fall back to the other methods.\n\n        try:\n            fileobj.write(arr.data)\n        except TypeError:\n            pass\n        else:\n            return\n\n    if hasattr(np, 'nditer'):\n        # nditer version for non-contiguous arrays\n        for item in np.nditer(arr, order='C'):\n            fileobj.write(item.tobytes())\n    else:\n        # Slower version for Numpy versions without nditer;\n        # The problem with flatiter is it doesn't preserve the original\n        # byteorder\n        byteorder = arr.dtype.byteorder\n        if ((sys.byteorder == 'little' and byteorder == '>')\n                or (sys.byteorder == 'big' and byteorder == '<')):\n            for item in arr.flat:\n                fileobj.write(item.byteswap().tobytes())\n        else:\n            for item in arr.flat:\n                fileobj.write(item.tobytes())"},{"col":4,"comment":"null","endLoc":1652,"header":"def __len__(self)","id":1032,"name":"__len__","nodeType":"Function","startLoc":1651,"text":"def __len__(self):\n        return len(self.columns)"},{"col":4,"comment":"null","endLoc":1663,"header":"def __repr__(self)","id":1033,"name":"__repr__","nodeType":"Function","startLoc":1654,"text":"def __repr__(self):\n        rep = 'ColDefs('\n        if hasattr(self, 'columns') and self.columns:\n            # The hasattr check is mostly just useful in debugging sessions\n            # where self.columns may not be defined yet\n            rep += '\\n    '\n            rep += '\\n    '.join([repr(c) for c in self.columns])\n            rep += '\\n'\n        rep += ')'\n        return rep"},{"col":4,"comment":"null","endLoc":1676,"header":"def __add__(self, other, option='left')","id":1034,"name":"__add__","nodeType":"Function","startLoc":1665,"text":"def __add__(self, other, option='left'):\n        if isinstance(other, Column):\n            b = [other]\n        elif isinstance(other, ColDefs):\n            b = list(other.columns)\n        else:\n            raise TypeError('Wrong type of input.')\n        if option == 'left':\n            tmp = list(self.columns) + b\n        else:\n            tmp = b + list(self.columns)\n        return ColDefs(tmp)"},{"col":4,"comment":"null","endLoc":341,"header":"def writable(self)","id":1035,"name":"writable","nodeType":"Function","startLoc":338,"text":"def writable(self):\n        if self.readonly:\n            return False\n        return iswritable(self._file)"},{"col":4,"comment":"null","endLoc":347,"header":"def write(self, string)","id":1036,"name":"write","nodeType":"Function","startLoc":343,"text":"def write(self, string):\n        if self.simulateonly:\n            return\n        if hasattr(self._file, 'write'):\n            _write_string(self._file, string)"},{"col":4,"comment":"\n        Similar to file.write(), but writes a numpy array instead of a string.\n\n        Also like file.write(), a flush() or close() may be needed before\n        the file on disk reflects the data written.\n        ","endLoc":360,"header":"def writearray(self, array)","id":1037,"name":"writearray","nodeType":"Function","startLoc":349,"text":"def writearray(self, array):\n        \"\"\"\n        Similar to file.write(), but writes a numpy array instead of a string.\n\n        Also like file.write(), a flush() or close() may be needed before\n        the file on disk reflects the data written.\n        \"\"\"\n\n        if self.simulateonly:\n            return\n        if hasattr(self._file, 'write'):\n            _array_to_file(array, self._file)"},{"col":4,"comment":"null","endLoc":1679,"header":"def __radd__(self, other)","id":1038,"name":"__radd__","nodeType":"Function","startLoc":1678,"text":"def __radd__(self, other):\n        return self.__add__(other, 'right')"},{"col":4,"comment":"null","endLoc":366,"header":"def flush(self)","id":1039,"name":"flush","nodeType":"Function","startLoc":362,"text":"def flush(self):\n        if self.simulateonly:\n            return\n        if hasattr(self._file, 'flush'):\n            self._file.flush()"},{"col":4,"comment":"null","endLoc":1689,"header":"def __sub__(self, other)","id":1040,"name":"__sub__","nodeType":"Function","startLoc":1681,"text":"def __sub__(self, other):\n        if not isinstance(other, (list, tuple)):\n            other = [other]\n        _other = [_get_index(self.names, key) for key in other]\n        indx = list(range(len(self)))\n        for x in _other:\n            indx.remove(x)\n        tmp = [self[i] for i in indx]\n        return ColDefs(tmp)"},{"col":4,"comment":"null","endLoc":376,"header":"def seek(self, offset, whence=0)","id":1041,"name":"seek","nodeType":"Function","startLoc":368,"text":"def seek(self, offset, whence=0):\n        if not hasattr(self._file, 'seek'):\n            return\n        self._file.seek(offset, whence)\n        pos = self._file.tell()\n        if self.size and pos > self.size:\n            warnings.warn('File may have been truncated: actual file length '\n                          '({}) is smaller than the expected size ({})'\n                          .format(self.size, pos), AstropyUserWarning)"},{"col":0,"comment":"\n    Given a numpy dtype, finds its \"zero\" point, which is exactly in the\n    middle of its range.\n    ","endLoc":738,"header":"def _pseudo_zero(dtype)","id":1042,"name":"_pseudo_zero","nodeType":"Function","startLoc":727,"text":"def _pseudo_zero(dtype):\n    \"\"\"\n    Given a numpy dtype, finds its \"zero\" point, which is exactly in the\n    middle of its range.\n    \"\"\"\n\n    # special case for int8\n    if dtype.kind == 'i' and dtype.itemsize == 1:\n        return -128\n\n    assert dtype.kind == 'u'\n    return 1 << (dtype.itemsize * 8 - 1)"},{"col":0,"comment":"null","endLoc":745,"header":"def _is_pseudo_integer(dtype)","id":1043,"name":"_is_pseudo_integer","nodeType":"Function","startLoc":741,"text":"def _is_pseudo_integer(dtype):\n    return (\n        (dtype.kind == 'u' and dtype.itemsize >= 2)\n        or (dtype.kind == 'i' and dtype.itemsize == 1)\n    )"},{"col":0,"comment":"Converts a given string to either an int or a float if necessary.","endLoc":760,"header":"def _str_to_num(val)","id":1044,"name":"_str_to_num","nodeType":"Function","startLoc":752,"text":"def _str_to_num(val):\n    \"\"\"Converts a given string to either an int or a float if necessary.\"\"\"\n\n    try:\n        num = int(val)\n    except ValueError:\n        # If this fails then an exception should be raised anyways\n        num = float(val)\n    return num"},{"col":0,"comment":"\n    Split a long string into parts where each part is no longer than ``strlen``\n    and no word is cut into two pieces.  But if there are any single words\n    which are longer than ``strlen``, then they will be split in the middle of\n    the word.\n    ","endLoc":804,"header":"def _words_group(s, width)","id":1045,"name":"_words_group","nodeType":"Function","startLoc":763,"text":"def _words_group(s, width):\n    \"\"\"\n    Split a long string into parts where each part is no longer than ``strlen``\n    and no word is cut into two pieces.  But if there are any single words\n    which are longer than ``strlen``, then they will be split in the middle of\n    the word.\n    \"\"\"\n\n    words = []\n    slen = len(s)\n\n    # appending one blank at the end always ensures that the \"last\" blank\n    # is beyond the end of the string\n    arr = np.frombuffer(s.encode('utf8') + b' ', dtype='S1')\n\n    # locations of the blanks\n    blank_loc = np.nonzero(arr == b' ')[0]\n    offset = 0\n    xoffset = 0\n\n    while True:\n        try:\n            loc = np.nonzero(blank_loc >= width + offset)[0][0]\n        except IndexError:\n            loc = len(blank_loc)\n\n        if loc > 0:\n            offset = blank_loc[loc - 1] + 1\n        else:\n            offset = -1\n\n        # check for one word longer than strlen, break in the middle\n        if offset <= xoffset:\n            offset = min(xoffset + width, slen)\n\n        # collect the pieces in a list\n        words.append(s[xoffset:offset])\n        if offset >= slen:\n            break\n        xoffset = offset\n\n    return words"},{"col":4,"comment":"\n        Location on Earth, initialized from geocentric coordinates.\n\n        Parameters\n        ----------\n        x, y, z : `~astropy.units.Quantity` or array-like\n            Cartesian coordinates.  If not quantities, ``unit`` should be given.\n        unit : unit-like or None\n            Physical unit of the coordinate values.  If ``x``, ``y``, and/or\n            ``z`` are quantities, they will be converted to this unit.\n\n        Raises\n        ------\n        astropy.units.UnitsError\n            If the units on ``x``, ``y``, and ``z`` do not match or an invalid\n            unit is given.\n        ValueError\n            If the shapes of ``x``, ``y``, and ``z`` do not match.\n        TypeError\n            If ``x`` is not a `~astropy.units.Quantity` and no unit is given.\n        ","endLoc":260,"header":"@classmethod\n    def from_geocentric(cls, x, y, z, unit=None)","id":1046,"name":"from_geocentric","nodeType":"Function","startLoc":213,"text":"@classmethod\n    def from_geocentric(cls, x, y, z, unit=None):\n        \"\"\"\n        Location on Earth, initialized from geocentric coordinates.\n\n        Parameters\n        ----------\n        x, y, z : `~astropy.units.Quantity` or array-like\n            Cartesian coordinates.  If not quantities, ``unit`` should be given.\n        unit : unit-like or None\n            Physical unit of the coordinate values.  If ``x``, ``y``, and/or\n            ``z`` are quantities, they will be converted to this unit.\n\n        Raises\n        ------\n        astropy.units.UnitsError\n            If the units on ``x``, ``y``, and ``z`` do not match or an invalid\n            unit is given.\n        ValueError\n            If the shapes of ``x``, ``y``, and ``z`` do not match.\n        TypeError\n            If ``x`` is not a `~astropy.units.Quantity` and no unit is given.\n        \"\"\"\n        if unit is None:\n            try:\n                unit = x.unit\n            except AttributeError:\n                raise TypeError(\"Geocentric coordinates should be Quantities \"\n                                \"unless an explicit unit is given.\") from None\n        else:\n            unit = u.Unit(unit)\n\n        if unit.physical_type != 'length':\n            raise u.UnitsError(\"Geocentric coordinates should be in \"\n                               \"units of length.\")\n\n        try:\n            x = u.Quantity(x, unit, copy=False)\n            y = u.Quantity(y, unit, copy=False)\n            z = u.Quantity(z, unit, copy=False)\n        except u.UnitsError:\n            raise u.UnitsError(\"Geocentric coordinate units should all be \"\n                               \"consistent.\")\n\n        x, y, z = np.broadcast_arrays(x, y, z)\n        struc = np.empty(x.shape, cls._location_dtype)\n        struc['x'], struc['y'], struc['z'] = x, y, z\n        return super().__new__(cls, struc, unit, copy=False)"},{"col":4,"comment":"\n        Handle column attribute changed notifications from columns that are\n        members of this `ColDefs`.\n\n        `ColDefs` itself does not currently do anything with this, and just\n        bubbles the notification up to any listening table HDUs that may need\n        to update their headers, etc.  However, this also informs the table of\n        the numerical index of the column that changed.\n        ","endLoc":1714,"header":"def _update_column_attribute_changed(self, column, attr, old_value,\n                                         new_value)","id":1047,"name":"_update_column_attribute_changed","nodeType":"Function","startLoc":1691,"text":"def _update_column_attribute_changed(self, column, attr, old_value,\n                                         new_value):\n        \"\"\"\n        Handle column attribute changed notifications from columns that are\n        members of this `ColDefs`.\n\n        `ColDefs` itself does not currently do anything with this, and just\n        bubbles the notification up to any listening table HDUs that may need\n        to update their headers, etc.  However, this also informs the table of\n        the numerical index of the column that changed.\n        \"\"\"\n\n        idx = 0\n        for idx, col in enumerate(self.columns):\n            if col is column:\n                break\n\n        if attr == 'name':\n            del self.names\n        elif attr == 'format':\n            del self.formats\n\n        self._notify('column_attribute_changed', column, idx, attr, old_value,\n                     new_value)"},{"col":4,"comment":"\n        Append one `Column` to the column definition.\n        ","endLoc":1743,"header":"def add_col(self, column)","id":1048,"name":"add_col","nodeType":"Function","startLoc":1716,"text":"def add_col(self, column):\n        \"\"\"\n        Append one `Column` to the column definition.\n        \"\"\"\n\n        if not isinstance(column, Column):\n            raise AssertionError\n\n        # Ask the HDU object to load the data before we modify our columns\n        self._notify('load_data')\n\n        self._arrays.append(column.array)\n        # Obliterate caches of certain things\n        del self.dtype\n        del self._recformats\n        del self._dims\n        del self.names\n        del self.formats\n\n        self.columns.append(column)\n\n        # Listen for changes on the new column\n        column._add_listener(self)\n\n        # If this ColDefs is being tracked by a Table, inform the\n        # table that its data is now invalid.\n        self._notify('column_added', self, column)\n        return self"},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":1049,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"col":0,"comment":"","endLoc":4,"header":"from_file.py#<anonymous>","id":1050,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"if __name__ == '__main__':\n    load_wcs_from_file(sys.argv[-1])"},{"col":0,"comment":"\n    Create a temporary file name which should not already exist.  Use the\n    directory of the input file as the base name of the mkstemp() output.\n    ","endLoc":817,"header":"def _tmp_name(input)","id":1051,"name":"_tmp_name","nodeType":"Function","startLoc":807,"text":"def _tmp_name(input):\n    \"\"\"\n    Create a temporary file name which should not already exist.  Use the\n    directory of the input file as the base name of the mkstemp() output.\n    \"\"\"\n\n    if input is not None:\n        input = os.path.dirname(input)\n    f, fn = tempfile.mkstemp(dir=input)\n    os.close(f)\n    return fn"},{"col":0,"comment":"\n    If the array has an mmap.mmap at base of its base chain, return the mmap\n    object; otherwise return None.\n    ","endLoc":833,"header":"def _get_array_mmap(array)","id":1052,"name":"_get_array_mmap","nodeType":"Function","startLoc":820,"text":"def _get_array_mmap(array):\n    \"\"\"\n    If the array has an mmap.mmap at base of its base chain, return the mmap\n    object; otherwise return None.\n    \"\"\"\n\n    if isinstance(array, mmap.mmap):\n        return array\n\n    base = array\n    while hasattr(base, 'base') and base.base is not None:\n        if isinstance(base.base, mmap.mmap):\n            return base.base\n        base = base.base"},{"col":4,"comment":"\n        Returns the index if the first instance of the given keyword in the\n        header, similar to `list.index` if the Header object is treated as a\n        list of keywords.\n\n        Parameters\n        ----------\n        keyword : str\n            The keyword to look up in the list of all keywords in the header\n\n        start : int, optional\n            The lower bound for the index\n\n        stop : int, optional\n            The upper bound for the index\n\n        ","endLoc":1403,"header":"def index(self, keyword, start=None, stop=None)","id":1053,"name":"index","nodeType":"Function","startLoc":1367,"text":"def index(self, keyword, start=None, stop=None):\n        \"\"\"\n        Returns the index if the first instance of the given keyword in the\n        header, similar to `list.index` if the Header object is treated as a\n        list of keywords.\n\n        Parameters\n        ----------\n        keyword : str\n            The keyword to look up in the list of all keywords in the header\n\n        start : int, optional\n            The lower bound for the index\n\n        stop : int, optional\n            The upper bound for the index\n\n        \"\"\"\n\n        if start is None:\n            start = 0\n\n        if stop is None:\n            stop = len(self._cards)\n\n        if stop < start:\n            step = -1\n        else:\n            step = 1\n\n        norm_keyword = Card.normalize_keyword(keyword)\n\n        for idx in range(start, stop, step):\n            if self._cards[idx].keyword.upper() == norm_keyword:\n                return idx\n        else:\n            raise ValueError(f'The keyword {keyword!r} is not in the  header.')"},{"col":0,"comment":"null","endLoc":856,"header":"@contextmanager\ndef _free_space_check(hdulist, dirname=None)","id":1054,"name":"_free_space_check","nodeType":"Function","startLoc":836,"text":"@contextmanager\ndef _free_space_check(hdulist, dirname=None):\n    try:\n        yield\n    except OSError as exc:\n        error_message = ''\n        if not isinstance(hdulist, list):\n            hdulist = [hdulist, ]\n        if dirname is None:\n            dirname = os.path.dirname(hdulist._file.name)\n        if os.path.isdir(dirname):\n            free_space = data.get_free_space_in_dir(dirname)\n            hdulist_size = sum(hdu.size for hdu in hdulist)\n            if free_space < hdulist_size:\n                error_message = (\"Not enough space on disk: requested {}, \"\n                                 \"available {}. \".format(hdulist_size, free_space))\n\n        for hdu in hdulist:\n            hdu._close()\n\n        raise OSError(error_message + str(exc))"},{"fileName":"diff.py","filePath":"astropy/io/fits","id":1055,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nFacilities for diffing two FITS files.  Includes objects for diffing entire\nFITS files, individual HDUs, FITS headers, or just FITS data.\n\nUsed to implement the fitsdiff program.\n\"\"\"\nimport fnmatch\nimport glob\nimport io\nimport operator\nimport os\nimport os.path\nimport textwrap\n\nfrom collections import defaultdict\nfrom inspect import signature\nfrom itertools import islice\n\nimport numpy as np\n\nfrom astropy import __version__\n\nfrom .card import Card, BLANK_CARD\nfrom .header import Header\n# HDUList is used in one of the doctests\nfrom .hdu.hdulist import fitsopen, HDUList  # pylint: disable=W0611\nfrom .hdu.table import _TableLikeHDU\nfrom astropy.utils.diff import (report_diff_values, fixed_width_indent,\n                                where_not_allclose, diff_values)\nfrom astropy.utils.misc import NOT_OVERWRITING_MSG\n\n__all__ = ['FITSDiff', 'HDUDiff', 'HeaderDiff', 'ImageDataDiff', 'RawDataDiff',\n           'TableDataDiff']\n\n# Column attributes of interest for comparison\n_COL_ATTRS = [('unit', 'units'), ('null', 'null values'),\n              ('bscale', 'bscales'), ('bzero', 'bzeros'),\n              ('disp', 'display formats'), ('dim', 'dimensions')]\n\n\nclass _BaseDiff:\n    \"\"\"\n    Base class for all FITS diff objects.\n\n    When instantiating a FITS diff object, the first two arguments are always\n    the two objects to diff (two FITS files, two FITS headers, etc.).\n    Instantiating a ``_BaseDiff`` also causes the diff itself to be executed.\n    The returned ``_BaseDiff`` instance has a number of attribute that describe\n    the results of the diff operation.\n\n    The most basic attribute, present on all ``_BaseDiff`` instances, is\n    ``.identical`` which is `True` if the two objects being compared are\n    identical according to the diff method for objects of that type.\n    \"\"\"\n\n    def __init__(self, a, b):\n        \"\"\"\n        The ``_BaseDiff`` class does not implement a ``_diff`` method and\n        should not be instantiated directly. Instead instantiate the\n        appropriate subclass of ``_BaseDiff`` for the objects being compared\n        (for example, use `HeaderDiff` to compare two `Header` objects.\n        \"\"\"\n\n        self.a = a\n        self.b = b\n\n        # For internal use in report output\n        self._fileobj = None\n        self._indent = 0\n\n        self._diff()\n\n    def __bool__(self):\n        \"\"\"\n        A ``_BaseDiff`` object acts as `True` in a boolean context if the two\n        objects compared are identical.  Otherwise it acts as `False`.\n        \"\"\"\n\n        return not self.identical\n\n    @classmethod\n    def fromdiff(cls, other, a, b):\n        \"\"\"\n        Returns a new Diff object of a specific subclass from an existing diff\n        object, passing on the values for any arguments they share in common\n        (such as ignore_keywords).\n\n        For example::\n\n            >>> from astropy.io import fits\n            >>> hdul1, hdul2 = fits.HDUList(), fits.HDUList()\n            >>> headera, headerb = fits.Header(), fits.Header()\n            >>> fd = fits.FITSDiff(hdul1, hdul2, ignore_keywords=['*'])\n            >>> hd = fits.HeaderDiff.fromdiff(fd, headera, headerb)\n            >>> list(hd.ignore_keywords)\n            ['*']\n        \"\"\"\n\n        sig = signature(cls.__init__)\n        # The first 3 arguments of any Diff initializer are self, a, and b.\n        kwargs = {}\n        for arg in list(sig.parameters.keys())[3:]:\n            if hasattr(other, arg):\n                kwargs[arg] = getattr(other, arg)\n\n        return cls(a, b, **kwargs)\n\n    @property\n    def identical(self):\n        \"\"\"\n        `True` if all the ``.diff_*`` attributes on this diff instance are\n        empty, implying that no differences were found.\n\n        Any subclass of ``_BaseDiff`` must have at least one ``.diff_*``\n        attribute, which contains a non-empty value if and only if some\n        difference was found between the two objects being compared.\n        \"\"\"\n\n        return not any(getattr(self, attr) for attr in self.__dict__\n                       if attr.startswith('diff_'))\n\n    def report(self, fileobj=None, indent=0, overwrite=False):\n        \"\"\"\n        Generates a text report on the differences (if any) between two\n        objects, and either returns it as a string or writes it to a file-like\n        object.\n\n        Parameters\n        ----------\n        fileobj : file-like, string, or None, optional\n            If `None`, this method returns the report as a string. Otherwise it\n            returns `None` and writes the report to the given file-like object\n            (which must have a ``.write()`` method at a minimum), or to a new\n            file at the path specified.\n\n        indent : int\n            The number of 4 space tabs to indent the report.\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n\n        Returns\n        -------\n        report : str or None\n        \"\"\"\n\n        return_string = False\n        filepath = None\n\n        if isinstance(fileobj, str):\n            if os.path.exists(fileobj) and not overwrite:\n                raise OSError(NOT_OVERWRITING_MSG.format(fileobj))\n            else:\n                filepath = fileobj\n                fileobj = open(filepath, 'w')\n        elif fileobj is None:\n            fileobj = io.StringIO()\n            return_string = True\n\n        self._fileobj = fileobj\n        self._indent = indent  # This is used internally by _writeln\n\n        try:\n            self._report()\n        finally:\n            if filepath:\n                fileobj.close()\n\n        if return_string:\n            return fileobj.getvalue()\n\n    def _writeln(self, text):\n        self._fileobj.write(fixed_width_indent(text, self._indent) + '\\n')\n\n    def _diff(self):\n        raise NotImplementedError\n\n    def _report(self):\n        raise NotImplementedError\n\n\nclass FITSDiff(_BaseDiff):\n    \"\"\"Diff two FITS files by filename, or two `HDUList` objects.\n\n    `FITSDiff` objects have the following diff attributes:\n\n    - ``diff_hdu_count``: If the FITS files being compared have different\n      numbers of HDUs, this contains a 2-tuple of the number of HDUs in each\n      file.\n\n    - ``diff_hdus``: If any HDUs with the same index are different, this\n      contains a list of 2-tuples of the HDU index and the `HDUDiff` object\n      representing the differences between the two HDUs.\n    \"\"\"\n\n    def __init__(self, a, b, ignore_hdus=[], ignore_keywords=[],\n                 ignore_comments=[], ignore_fields=[],\n                 numdiffs=10, rtol=0.0, atol=0.0,\n                 ignore_blanks=True, ignore_blank_cards=True):\n        \"\"\"\n        Parameters\n        ----------\n        a : str or `HDUList`\n            The filename of a FITS file on disk, or an `HDUList` object.\n\n        b : str or `HDUList`\n            The filename of a FITS file on disk, or an `HDUList` object to\n            compare to the first file.\n\n        ignore_hdus : sequence, optional\n            HDU names to ignore when comparing two FITS files or HDU lists; the\n            presence of these HDUs and their contents are ignored.  Wildcard\n            strings may also be included in the list.\n\n        ignore_keywords : sequence, optional\n            Header keywords to ignore when comparing two headers; the presence\n            of these keywords and their values are ignored.  Wildcard strings\n            may also be included in the list.\n\n        ignore_comments : sequence, optional\n            A list of header keywords whose comments should be ignored in the\n            comparison.  May contain wildcard strings as with ignore_keywords.\n\n        ignore_fields : sequence, optional\n            The (case-insensitive) names of any table columns to ignore if any\n            table data is to be compared.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\\\left| a - b \\\\right| > \\\\text{atol} + \\\\text{rtol} \\\\cdot \\\\left| b \\\\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n\n        ignore_blanks : bool, optional\n            Ignore extra whitespace at the end of string values either in\n            headers or data. Extra leading whitespace is not ignored\n            (default: True).\n\n        ignore_blank_cards : bool, optional\n            Ignore all cards that are blank, i.e. they only contain\n            whitespace (default: True).\n        \"\"\"\n\n        if isinstance(a, (str, os.PathLike)):\n            try:\n                a = fitsopen(a)\n            except Exception as exc:\n                raise OSError(\"error opening file a ({}): {}: {}\".format(\n                        a, exc.__class__.__name__, exc.args[0]))\n            close_a = True\n        else:\n            close_a = False\n\n        if isinstance(b, (str, os.PathLike)):\n            try:\n                b = fitsopen(b)\n            except Exception as exc:\n                raise OSError(\"error opening file b ({}): {}: {}\".format(\n                        b, exc.__class__.__name__, exc.args[0]))\n            close_b = True\n        else:\n            close_b = False\n\n        # Normalize keywords/fields to ignore to upper case\n        self.ignore_hdus = set(k.upper() for k in ignore_hdus)\n        self.ignore_keywords = set(k.upper() for k in ignore_keywords)\n        self.ignore_comments = set(k.upper() for k in ignore_comments)\n        self.ignore_fields = set(k.upper() for k in ignore_fields)\n\n        self.numdiffs = numdiffs\n        self.rtol = rtol\n        self.atol = atol\n\n        self.ignore_blanks = ignore_blanks\n        self.ignore_blank_cards = ignore_blank_cards\n\n        # Some hdu names may be pattern wildcards.  Find them.\n        self.ignore_hdu_patterns = set()\n        for name in list(self.ignore_hdus):\n            if name != '*' and glob.has_magic(name):\n                self.ignore_hdus.remove(name)\n                self.ignore_hdu_patterns.add(name)\n\n        self.diff_hdu_count = ()\n        self.diff_hdus = []\n\n        try:\n            super().__init__(a, b)\n        finally:\n            if close_a:\n                a.close()\n            if close_b:\n                b.close()\n\n    def _diff(self):\n        if len(self.a) != len(self.b):\n            self.diff_hdu_count = (len(self.a), len(self.b))\n\n        # Record filenames for use later in _report\n        self.filenamea = self.a.filename()\n        if not self.filenamea:\n            self.filenamea = f'<{self.a.__class__.__name__} object at {id(self.a):#x}>'\n\n        self.filenameb = self.b.filename()\n        if not self.filenameb:\n            self.filenameb = f'<{self.b.__class__.__name__} object at {id(self.b):#x}>'\n\n        if self.ignore_hdus:\n            self.a = HDUList([h for h in self.a if h.name not in self.ignore_hdus])\n            self.b = HDUList([h for h in self.b if h.name not in self.ignore_hdus])\n        if self.ignore_hdu_patterns:\n            a_names = [hdu.name for hdu in self.a]\n            b_names = [hdu.name for hdu in self.b]\n            for pattern in self.ignore_hdu_patterns:\n                self.a = HDUList([h for h in self.a if h.name not in fnmatch.filter(\n                    a_names, pattern)])\n                self.b = HDUList([h for h in self.b if h.name not in fnmatch.filter(\n                    b_names, pattern)])\n\n        # For now, just compare the extensions one by one in order.\n        # Might allow some more sophisticated types of diffing later.\n\n        # TODO: Somehow or another simplify the passing around of diff\n        # options--this will become important as the number of options grows\n        for idx in range(min(len(self.a), len(self.b))):\n            hdu_diff = HDUDiff.fromdiff(self, self.a[idx], self.b[idx])\n\n            if not hdu_diff.identical:\n                if self.a[idx].name == self.b[idx].name and self.a[idx].ver == self.b[idx].ver:\n                    self.diff_hdus.append((idx, hdu_diff, self.a[idx].name, self.a[idx].ver))\n                else:\n                    self.diff_hdus.append((idx, hdu_diff, \"\", self.a[idx].ver))\n\n    def _report(self):\n        wrapper = textwrap.TextWrapper(initial_indent='  ',\n                                       subsequent_indent='  ')\n\n        self._fileobj.write('\\n')\n        self._writeln(f' fitsdiff: {__version__}')\n        self._writeln(f' a: {self.filenamea}\\n b: {self.filenameb}')\n\n        if self.ignore_hdus:\n            ignore_hdus = ' '.join(sorted(self.ignore_hdus))\n            self._writeln(f' HDU(s) not to be compared:\\n{wrapper.fill(ignore_hdus)}')\n\n        if self.ignore_hdu_patterns:\n            ignore_hdu_patterns = ' '.join(sorted(self.ignore_hdu_patterns))\n            self._writeln(' HDU(s) not to be compared:\\n{}'\n                          .format(wrapper.fill(ignore_hdu_patterns)))\n\n        if self.ignore_keywords:\n            ignore_keywords = ' '.join(sorted(self.ignore_keywords))\n            self._writeln(' Keyword(s) not to be compared:\\n{}'\n                          .format(wrapper.fill(ignore_keywords)))\n\n        if self.ignore_comments:\n            ignore_comments = ' '.join(sorted(self.ignore_comments))\n            self._writeln(' Keyword(s) whose comments are not to be compared'\n                          ':\\n{}'.format(wrapper.fill(ignore_comments)))\n\n        if self.ignore_fields:\n            ignore_fields = ' '.join(sorted(self.ignore_fields))\n            self._writeln(' Table column(s) not to be compared:\\n{}'\n                          .format(wrapper.fill(ignore_fields)))\n\n        self._writeln(' Maximum number of different data values to be '\n                      'reported: {}'.format(self.numdiffs))\n        self._writeln(' Relative tolerance: {}, Absolute tolerance: {}'\n                      .format(self.rtol, self.atol))\n\n        if self.diff_hdu_count:\n            self._fileobj.write('\\n')\n            self._writeln('Files contain different numbers of HDUs:')\n            self._writeln(f' a: {self.diff_hdu_count[0]}')\n            self._writeln(f' b: {self.diff_hdu_count[1]}')\n\n            if not self.diff_hdus:\n                self._writeln('No differences found between common HDUs.')\n                return\n        elif not self.diff_hdus:\n            self._fileobj.write('\\n')\n            self._writeln('No differences found.')\n            return\n\n        for idx, hdu_diff, extname, extver in self.diff_hdus:\n            # print out the extension heading\n            if idx == 0:\n                self._fileobj.write('\\n')\n                self._writeln('Primary HDU:')\n            else:\n                self._fileobj.write('\\n')\n                if extname:\n                    self._writeln(f'Extension HDU {idx} ({extname}, {extver}):')\n                else:\n                    self._writeln(f'Extension HDU {idx}:')\n            hdu_diff.report(self._fileobj, indent=self._indent + 1)\n\n\nclass HDUDiff(_BaseDiff):\n    \"\"\"\n    Diff two HDU objects, including their headers and their data (but only if\n    both HDUs contain the same type of data (image, table, or unknown).\n\n    `HDUDiff` objects have the following diff attributes:\n\n    - ``diff_extnames``: If the two HDUs have different EXTNAME values, this\n      contains a 2-tuple of the different extension names.\n\n    - ``diff_extvers``: If the two HDUS have different EXTVER values, this\n      contains a 2-tuple of the different extension versions.\n\n    - ``diff_extlevels``: If the two HDUs have different EXTLEVEL values, this\n      contains a 2-tuple of the different extension levels.\n\n    - ``diff_extension_types``: If the two HDUs have different XTENSION values,\n      this contains a 2-tuple of the different extension types.\n\n    - ``diff_headers``: Contains a `HeaderDiff` object for the headers of the\n      two HDUs. This will always contain an object--it may be determined\n      whether the headers are different through ``diff_headers.identical``.\n\n    - ``diff_data``: Contains either a `ImageDataDiff`, `TableDataDiff`, or\n      `RawDataDiff` as appropriate for the data in the HDUs, and only if the\n      two HDUs have non-empty data of the same type (`RawDataDiff` is used for\n      HDUs containing non-empty data of an indeterminate type).\n    \"\"\"\n\n    def __init__(self, a, b, ignore_keywords=[], ignore_comments=[],\n                 ignore_fields=[], numdiffs=10, rtol=0.0, atol=0.0,\n                 ignore_blanks=True, ignore_blank_cards=True):\n        \"\"\"\n        Parameters\n        ----------\n        a : BaseHDU\n            An HDU object.\n\n        b : BaseHDU\n            An HDU object to compare to the first HDU object.\n\n        ignore_keywords : sequence, optional\n            Header keywords to ignore when comparing two headers; the presence\n            of these keywords and their values are ignored.  Wildcard strings\n            may also be included in the list.\n\n        ignore_comments : sequence, optional\n            A list of header keywords whose comments should be ignored in the\n            comparison.  May contain wildcard strings as with ignore_keywords.\n\n        ignore_fields : sequence, optional\n            The (case-insensitive) names of any table columns to ignore if any\n            table data is to be compared.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\\\left| a - b \\\\right| > \\\\text{atol} + \\\\text{rtol} \\\\cdot \\\\left| b \\\\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n\n        ignore_blanks : bool, optional\n            Ignore extra whitespace at the end of string values either in\n            headers or data. Extra leading whitespace is not ignored\n            (default: True).\n\n        ignore_blank_cards : bool, optional\n            Ignore all cards that are blank, i.e. they only contain\n            whitespace (default: True).\n        \"\"\"\n\n        self.ignore_keywords = {k.upper() for k in ignore_keywords}\n        self.ignore_comments = {k.upper() for k in ignore_comments}\n        self.ignore_fields = {k.upper() for k in ignore_fields}\n\n        self.rtol = rtol\n        self.atol = atol\n\n        self.numdiffs = numdiffs\n        self.ignore_blanks = ignore_blanks\n        self.ignore_blank_cards = ignore_blank_cards\n\n        self.diff_extnames = ()\n        self.diff_extvers = ()\n        self.diff_extlevels = ()\n        self.diff_extension_types = ()\n        self.diff_headers = None\n        self.diff_data = None\n\n        super().__init__(a, b)\n\n    def _diff(self):\n        if self.a.name != self.b.name:\n            self.diff_extnames = (self.a.name, self.b.name)\n\n        if self.a.ver != self.b.ver:\n            self.diff_extvers = (self.a.ver, self.b.ver)\n\n        if self.a.level != self.b.level:\n            self.diff_extlevels = (self.a.level, self.b.level)\n\n        if self.a.header.get('XTENSION') != self.b.header.get('XTENSION'):\n            self.diff_extension_types = (self.a.header.get('XTENSION'),\n                                         self.b.header.get('XTENSION'))\n\n        self.diff_headers = HeaderDiff.fromdiff(self, self.a.header.copy(),\n                                                self.b.header.copy())\n\n        if self.a.data is None or self.b.data is None:\n            # TODO: Perhaps have some means of marking this case\n            pass\n        elif self.a.is_image and self.b.is_image:\n            self.diff_data = ImageDataDiff.fromdiff(self, self.a.data,\n                                                    self.b.data)\n            # Clean up references to (possibly) memmapped arrays so they can\n            # be closed by .close()\n            self.diff_data.a = None\n            self.diff_data.b = None\n        elif (isinstance(self.a, _TableLikeHDU) and\n              isinstance(self.b, _TableLikeHDU)):\n            # TODO: Replace this if/when _BaseHDU grows a .is_table property\n            self.diff_data = TableDataDiff.fromdiff(self, self.a.data,\n                                                    self.b.data)\n            # Clean up references to (possibly) memmapped arrays so they can\n            # be closed by .close()\n            self.diff_data.a = None\n            self.diff_data.b = None\n        elif not self.diff_extension_types:\n            # Don't diff the data for unequal extension types that are not\n            # recognized image or table types\n            self.diff_data = RawDataDiff.fromdiff(self, self.a.data,\n                                                  self.b.data)\n            # Clean up references to (possibly) memmapped arrays so they can\n            # be closed by .close()\n            self.diff_data.a = None\n            self.diff_data.b = None\n\n    def _report(self):\n        if self.identical:\n            self._writeln(\" No differences found.\")\n        if self.diff_extension_types:\n            self._writeln(\" Extension types differ:\\n  a: {}\\n  \"\n                          \"b: {}\".format(*self.diff_extension_types))\n        if self.diff_extnames:\n            self._writeln(\" Extension names differ:\\n  a: {}\\n  \"\n                          \"b: {}\".format(*self.diff_extnames))\n        if self.diff_extvers:\n            self._writeln(\" Extension versions differ:\\n  a: {}\\n  \"\n                          \"b: {}\".format(*self.diff_extvers))\n\n        if self.diff_extlevels:\n            self._writeln(\" Extension levels differ:\\n  a: {}\\n  \"\n                          \"b: {}\".format(*self.diff_extlevels))\n\n        if not self.diff_headers.identical:\n            self._fileobj.write('\\n')\n            self._writeln(\" Headers contain differences:\")\n            self.diff_headers.report(self._fileobj, indent=self._indent + 1)\n\n        if self.diff_data is not None and not self.diff_data.identical:\n            self._fileobj.write('\\n')\n            self._writeln(\" Data contains differences:\")\n            self.diff_data.report(self._fileobj, indent=self._indent + 1)\n\n\nclass HeaderDiff(_BaseDiff):\n    \"\"\"\n    Diff two `Header` objects.\n\n    `HeaderDiff` objects have the following diff attributes:\n\n    - ``diff_keyword_count``: If the two headers contain a different number of\n      keywords, this contains a 2-tuple of the keyword count for each header.\n\n    - ``diff_keywords``: If either header contains one or more keywords that\n      don't appear at all in the other header, this contains a 2-tuple\n      consisting of a list of the keywords only appearing in header a, and a\n      list of the keywords only appearing in header b.\n\n    - ``diff_duplicate_keywords``: If a keyword appears in both headers at\n      least once, but contains a different number of duplicates (for example, a\n      different number of HISTORY cards in each header), an item is added to\n      this dict with the keyword as the key, and a 2-tuple of the different\n      counts of that keyword as the value.  For example::\n\n          {'HISTORY': (20, 19)}\n\n      means that header a contains 20 HISTORY cards, while header b contains\n      only 19 HISTORY cards.\n\n    - ``diff_keyword_values``: If any of the common keyword between the two\n      headers have different values, they appear in this dict.  It has a\n      structure similar to ``diff_duplicate_keywords``, with the keyword as the\n      key, and a 2-tuple of the different values as the value.  For example::\n\n          {'NAXIS': (2, 3)}\n\n      means that the NAXIS keyword has a value of 2 in header a, and a value of\n      3 in header b.  This excludes any keywords matched by the\n      ``ignore_keywords`` list.\n\n    - ``diff_keyword_comments``: Like ``diff_keyword_values``, but contains\n      differences between keyword comments.\n\n    `HeaderDiff` objects also have a ``common_keywords`` attribute that lists\n    all keywords that appear in both headers.\n    \"\"\"\n\n    def __init__(self, a, b, ignore_keywords=[], ignore_comments=[],\n                 rtol=0.0, atol=0.0, ignore_blanks=True, ignore_blank_cards=True):\n        \"\"\"\n        Parameters\n        ----------\n        a : `~astropy.io.fits.Header` or string or bytes\n            A header.\n\n        b : `~astropy.io.fits.Header` or string or bytes\n            A header to compare to the first header.\n\n        ignore_keywords : sequence, optional\n            Header keywords to ignore when comparing two headers; the presence\n            of these keywords and their values are ignored.  Wildcard strings\n            may also be included in the list.\n\n        ignore_comments : sequence, optional\n            A list of header keywords whose comments should be ignored in the\n            comparison.  May contain wildcard strings as with ignore_keywords.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\\\left| a - b \\\\right| > \\\\text{atol} + \\\\text{rtol} \\\\cdot \\\\left| b \\\\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n\n        ignore_blanks : bool, optional\n            Ignore extra whitespace at the end of string values either in\n            headers or data. Extra leading whitespace is not ignored\n            (default: True).\n\n        ignore_blank_cards : bool, optional\n            Ignore all cards that are blank, i.e. they only contain\n            whitespace (default: True).\n        \"\"\"\n\n        self.ignore_keywords = {k.upper() for k in ignore_keywords}\n        self.ignore_comments = {k.upper() for k in ignore_comments}\n\n        self.rtol = rtol\n        self.atol = atol\n\n        self.ignore_blanks = ignore_blanks\n        self.ignore_blank_cards = ignore_blank_cards\n\n        self.ignore_keyword_patterns = set()\n        self.ignore_comment_patterns = set()\n        for keyword in list(self.ignore_keywords):\n            keyword = keyword.upper()\n            if keyword != '*' and glob.has_magic(keyword):\n                self.ignore_keywords.remove(keyword)\n                self.ignore_keyword_patterns.add(keyword)\n        for keyword in list(self.ignore_comments):\n            keyword = keyword.upper()\n            if keyword != '*' and glob.has_magic(keyword):\n                self.ignore_comments.remove(keyword)\n                self.ignore_comment_patterns.add(keyword)\n\n        # Keywords appearing in each header\n        self.common_keywords = []\n\n        # Set to the number of keywords in each header if the counts differ\n        self.diff_keyword_count = ()\n\n        # Set if the keywords common to each header (excluding ignore_keywords)\n        # appear in different positions within the header\n        # TODO: Implement this\n        self.diff_keyword_positions = ()\n\n        # Keywords unique to each header (excluding keywords in\n        # ignore_keywords)\n        self.diff_keywords = ()\n\n        # Keywords that have different numbers of duplicates in each header\n        # (excluding keywords in ignore_keywords)\n        self.diff_duplicate_keywords = {}\n\n        # Keywords common to each header but having different values (excluding\n        # keywords in ignore_keywords)\n        self.diff_keyword_values = defaultdict(list)\n\n        # Keywords common to each header but having different comments\n        # (excluding keywords in ignore_keywords or in ignore_comments)\n        self.diff_keyword_comments = defaultdict(list)\n\n        if isinstance(a, str):\n            a = Header.fromstring(a)\n        if isinstance(b, str):\n            b = Header.fromstring(b)\n\n        if not (isinstance(a, Header) and isinstance(b, Header)):\n            raise TypeError('HeaderDiff can only diff astropy.io.fits.Header '\n                            'objects or strings containing FITS headers.')\n\n        super().__init__(a, b)\n\n    # TODO: This doesn't pay much attention to the *order* of the keywords,\n    # except in the case of duplicate keywords.  The order should be checked\n    # too, or at least it should be an option.\n    def _diff(self):\n        if self.ignore_blank_cards:\n            cardsa = [c for c in self.a.cards if str(c) != BLANK_CARD]\n            cardsb = [c for c in self.b.cards if str(c) != BLANK_CARD]\n        else:\n            cardsa = list(self.a.cards)\n            cardsb = list(self.b.cards)\n\n        # build dictionaries of keyword values and comments\n        def get_header_values_comments(cards):\n            values = {}\n            comments = {}\n            for card in cards:\n                value = card.value\n                if self.ignore_blanks and isinstance(value, str):\n                    value = value.rstrip()\n                values.setdefault(card.keyword, []).append(value)\n                comments.setdefault(card.keyword, []).append(card.comment)\n            return values, comments\n\n        valuesa, commentsa = get_header_values_comments(cardsa)\n        valuesb, commentsb = get_header_values_comments(cardsb)\n\n        # Normalize all keyword to upper-case for comparison's sake;\n        # TODO: HIERARCH keywords should be handled case-sensitively I think\n        keywordsa = {k.upper() for k in valuesa}\n        keywordsb = {k.upper() for k in valuesb}\n\n        self.common_keywords = sorted(keywordsa.intersection(keywordsb))\n        if len(cardsa) != len(cardsb):\n            self.diff_keyword_count = (len(cardsa), len(cardsb))\n\n        # Any other diff attributes should exclude ignored keywords\n        keywordsa = keywordsa.difference(self.ignore_keywords)\n        keywordsb = keywordsb.difference(self.ignore_keywords)\n        if self.ignore_keyword_patterns:\n            for pattern in self.ignore_keyword_patterns:\n                keywordsa = keywordsa.difference(fnmatch.filter(keywordsa,\n                                                                pattern))\n                keywordsb = keywordsb.difference(fnmatch.filter(keywordsb,\n                                                                pattern))\n\n        if '*' in self.ignore_keywords:\n            # Any other differences between keywords are to be ignored\n            return\n\n        left_only_keywords = sorted(keywordsa.difference(keywordsb))\n        right_only_keywords = sorted(keywordsb.difference(keywordsa))\n\n        if left_only_keywords or right_only_keywords:\n            self.diff_keywords = (left_only_keywords, right_only_keywords)\n\n        # Compare count of each common keyword\n        for keyword in self.common_keywords:\n            if keyword in self.ignore_keywords:\n                continue\n            if self.ignore_keyword_patterns:\n                skip = False\n                for pattern in self.ignore_keyword_patterns:\n                    if fnmatch.fnmatch(keyword, pattern):\n                        skip = True\n                        break\n                if skip:\n                    continue\n\n            counta = len(valuesa[keyword])\n            countb = len(valuesb[keyword])\n            if counta != countb:\n                self.diff_duplicate_keywords[keyword] = (counta, countb)\n\n            # Compare keywords' values and comments\n            for a, b in zip(valuesa[keyword], valuesb[keyword]):\n                if diff_values(a, b, rtol=self.rtol, atol=self.atol):\n                    self.diff_keyword_values[keyword].append((a, b))\n                else:\n                    # If there are duplicate keywords we need to be able to\n                    # index each duplicate; if the values of a duplicate\n                    # are identical use None here\n                    self.diff_keyword_values[keyword].append(None)\n\n            if not any(self.diff_keyword_values[keyword]):\n                # No differences found; delete the array of Nones\n                del self.diff_keyword_values[keyword]\n\n            if '*' in self.ignore_comments or keyword in self.ignore_comments:\n                continue\n            if self.ignore_comment_patterns:\n                skip = False\n                for pattern in self.ignore_comment_patterns:\n                    if fnmatch.fnmatch(keyword, pattern):\n                        skip = True\n                        break\n                if skip:\n                    continue\n\n            for a, b in zip(commentsa[keyword], commentsb[keyword]):\n                if diff_values(a, b):\n                    self.diff_keyword_comments[keyword].append((a, b))\n                else:\n                    self.diff_keyword_comments[keyword].append(None)\n\n            if not any(self.diff_keyword_comments[keyword]):\n                del self.diff_keyword_comments[keyword]\n\n    def _report(self):\n        if self.diff_keyword_count:\n            self._writeln(' Headers have different number of cards:')\n            self._writeln(f'  a: {self.diff_keyword_count[0]}')\n            self._writeln(f'  b: {self.diff_keyword_count[1]}')\n        if self.diff_keywords:\n            for keyword in self.diff_keywords[0]:\n                if keyword in Card._commentary_keywords:\n                    val = self.a[keyword][0]\n                else:\n                    val = self.a[keyword]\n                self._writeln(f' Extra keyword {keyword!r:8} in a: {val!r}')\n            for keyword in self.diff_keywords[1]:\n                if keyword in Card._commentary_keywords:\n                    val = self.b[keyword][0]\n                else:\n                    val = self.b[keyword]\n                self._writeln(f' Extra keyword {keyword!r:8} in b: {val!r}')\n\n        if self.diff_duplicate_keywords:\n            for keyword, count in sorted(self.diff_duplicate_keywords.items()):\n                self._writeln(f' Inconsistent duplicates of keyword {keyword!r:8}:')\n                self._writeln('  Occurs {} time(s) in a, {} times in (b)'\n                              .format(*count))\n\n        if self.diff_keyword_values or self.diff_keyword_comments:\n            for keyword in self.common_keywords:\n                report_diff_keyword_attr(self._fileobj, 'values',\n                                         self.diff_keyword_values, keyword,\n                                         ind=self._indent)\n                report_diff_keyword_attr(self._fileobj, 'comments',\n                                         self.diff_keyword_comments, keyword,\n                                         ind=self._indent)\n\n# TODO: It might be good if there was also a threshold option for percentage of\n# different pixels: For example ignore if only 1% of the pixels are different\n# within some threshold.  There are lots of possibilities here, but hold off\n# for now until specific cases come up.\n\n\nclass ImageDataDiff(_BaseDiff):\n    \"\"\"\n    Diff two image data arrays (really any array from a PRIMARY HDU or an IMAGE\n    extension HDU, though the data unit is assumed to be \"pixels\").\n\n    `ImageDataDiff` objects have the following diff attributes:\n\n    - ``diff_dimensions``: If the two arrays contain either a different number\n      of dimensions or different sizes in any dimension, this contains a\n      2-tuple of the shapes of each array.  Currently no further comparison is\n      performed on images that don't have the exact same dimensions.\n\n    - ``diff_pixels``: If the two images contain any different pixels, this\n      contains a list of 2-tuples of the array index where the difference was\n      found, and another 2-tuple containing the different values.  For example,\n      if the pixel at (0, 0) contains different values this would look like::\n\n          [(0, 0), (1.1, 2.2)]\n\n      where 1.1 and 2.2 are the values of that pixel in each array.  This\n      array only contains up to ``self.numdiffs`` differences, for storage\n      efficiency.\n\n    - ``diff_total``: The total number of different pixels found between the\n      arrays.  Although ``diff_pixels`` does not necessarily contain all the\n      different pixel values, this can be used to get a count of the total\n      number of differences found.\n\n    - ``diff_ratio``: Contains the ratio of ``diff_total`` to the total number\n      of pixels in the arrays.\n    \"\"\"\n\n    def __init__(self, a, b, numdiffs=10, rtol=0.0, atol=0.0):\n        \"\"\"\n        Parameters\n        ----------\n        a : BaseHDU\n            An HDU object.\n\n        b : BaseHDU\n            An HDU object to compare to the first HDU object.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\\\left| a - b \\\\right| > \\\\text{atol} + \\\\text{rtol} \\\\cdot \\\\left| b \\\\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n        \"\"\"\n\n        self.numdiffs = numdiffs\n        self.rtol = rtol\n        self.atol = atol\n\n        self.diff_dimensions = ()\n        self.diff_pixels = []\n        self.diff_ratio = 0\n\n        # self.diff_pixels only holds up to numdiffs differing pixels, but this\n        # self.diff_total stores the total count of differences between\n        # the images, but not the different values\n        self.diff_total = 0\n\n        super().__init__(a, b)\n\n    def _diff(self):\n        if self.a.shape != self.b.shape:\n            self.diff_dimensions = (self.a.shape, self.b.shape)\n            # Don't do any further comparison if the dimensions differ\n            # TODO: Perhaps we could, however, diff just the intersection\n            # between the two images\n            return\n\n        # Find the indices where the values are not equal\n        # If neither a nor b are floating point (or complex), ignore rtol and\n        # atol\n        if not (np.issubdtype(self.a.dtype, np.inexact) or\n                np.issubdtype(self.b.dtype, np.inexact)):\n            rtol = 0\n            atol = 0\n        else:\n            rtol = self.rtol\n            atol = self.atol\n\n        diffs = where_not_allclose(self.a, self.b, atol=atol, rtol=rtol)\n\n        self.diff_total = len(diffs[0])\n\n        if self.diff_total == 0:\n            # Then we're done\n            return\n\n        if self.numdiffs < 0:\n            numdiffs = self.diff_total\n        else:\n            numdiffs = self.numdiffs\n\n        self.diff_pixels = [(idx, (self.a[idx], self.b[idx]))\n                            for idx in islice(zip(*diffs), 0, numdiffs)]\n        self.diff_ratio = float(self.diff_total) / float(len(self.a.flat))\n\n    def _report(self):\n        if self.diff_dimensions:\n            dimsa = ' x '.join(str(d) for d in\n                               reversed(self.diff_dimensions[0]))\n            dimsb = ' x '.join(str(d) for d in\n                               reversed(self.diff_dimensions[1]))\n            self._writeln(' Data dimensions differ:')\n            self._writeln(f'  a: {dimsa}')\n            self._writeln(f'  b: {dimsb}')\n            # For now we don't do any further comparison if the dimensions\n            # differ; though in the future it might be nice to be able to\n            # compare at least where the images intersect\n            self._writeln(' No further data comparison performed.')\n            return\n\n        if not self.diff_pixels:\n            return\n\n        for index, values in self.diff_pixels:\n            index = [x + 1 for x in reversed(index)]\n            self._writeln(f' Data differs at {index}:')\n            report_diff_values(values[0], values[1], fileobj=self._fileobj,\n                               indent_width=self._indent + 1)\n\n        if self.diff_total > self.numdiffs:\n            self._writeln(' ...')\n        self._writeln(' {} different pixels found ({:.2%} different).'\n                      .format(self.diff_total, self.diff_ratio))\n\n\nclass RawDataDiff(ImageDataDiff):\n    \"\"\"\n    `RawDataDiff` is just a special case of `ImageDataDiff` where the images\n    are one-dimensional, and the data is treated as a 1-dimensional array of\n    bytes instead of pixel values.  This is used to compare the data of two\n    non-standard extension HDUs that were not recognized as containing image or\n    table data.\n\n    `ImageDataDiff` objects have the following diff attributes:\n\n    - ``diff_dimensions``: Same as the ``diff_dimensions`` attribute of\n      `ImageDataDiff` objects. Though the \"dimension\" of each array is just an\n      integer representing the number of bytes in the data.\n\n    - ``diff_bytes``: Like the ``diff_pixels`` attribute of `ImageDataDiff`\n      objects, but renamed to reflect the minor semantic difference that these\n      are raw bytes and not pixel values.  Also the indices are integers\n      instead of tuples.\n\n    - ``diff_total`` and ``diff_ratio``: Same as `ImageDataDiff`.\n    \"\"\"\n\n    def __init__(self, a, b, numdiffs=10):\n        \"\"\"\n        Parameters\n        ----------\n        a : BaseHDU\n            An HDU object.\n\n        b : BaseHDU\n            An HDU object to compare to the first HDU object.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n        \"\"\"\n\n        self.diff_dimensions = ()\n        self.diff_bytes = []\n\n        super().__init__(a, b, numdiffs=numdiffs)\n\n    def _diff(self):\n        super()._diff()\n        if self.diff_dimensions:\n            self.diff_dimensions = (self.diff_dimensions[0][0],\n                                    self.diff_dimensions[1][0])\n\n        self.diff_bytes = [(x[0], y) for x, y in self.diff_pixels]\n        del self.diff_pixels\n\n    def _report(self):\n        if self.diff_dimensions:\n            self._writeln(' Data sizes differ:')\n            self._writeln(f'  a: {self.diff_dimensions[0]} bytes')\n            self._writeln(f'  b: {self.diff_dimensions[1]} bytes')\n            # For now we don't do any further comparison if the dimensions\n            # differ; though in the future it might be nice to be able to\n            # compare at least where the images intersect\n            self._writeln(' No further data comparison performed.')\n            return\n\n        if not self.diff_bytes:\n            return\n\n        for index, values in self.diff_bytes:\n            self._writeln(f' Data differs at byte {index}:')\n            report_diff_values(values[0], values[1], fileobj=self._fileobj,\n                               indent_width=self._indent + 1)\n\n        self._writeln(' ...')\n        self._writeln(' {} different bytes found ({:.2%} different).'\n                      .format(self.diff_total, self.diff_ratio))\n\n\nclass TableDataDiff(_BaseDiff):\n    \"\"\"\n    Diff two table data arrays. It doesn't matter whether the data originally\n    came from a binary or ASCII table--the data should be passed in as a\n    recarray.\n\n    `TableDataDiff` objects have the following diff attributes:\n\n    - ``diff_column_count``: If the tables being compared have different\n      numbers of columns, this contains a 2-tuple of the column count in each\n      table.  Even if the tables have different column counts, an attempt is\n      still made to compare any columns they have in common.\n\n    - ``diff_columns``: If either table contains columns unique to that table,\n      either in name or format, this contains a 2-tuple of lists. The first\n      element is a list of columns (these are full `Column` objects) that\n      appear only in table a.  The second element is a list of tables that\n      appear only in table b.  This only lists columns with different column\n      definitions, and has nothing to do with the data in those columns.\n\n    - ``diff_column_names``: This is like ``diff_columns``, but lists only the\n      names of columns unique to either table, rather than the full `Column`\n      objects.\n\n    - ``diff_column_attributes``: Lists columns that are in both tables but\n      have different secondary attributes, such as TUNIT or TDISP.  The format\n      is a list of 2-tuples: The first a tuple of the column name and the\n      attribute, the second a tuple of the different values.\n\n    - ``diff_values``: `TableDataDiff` compares the data in each table on a\n      column-by-column basis.  If any different data is found, it is added to\n      this list.  The format of this list is similar to the ``diff_pixels``\n      attribute on `ImageDataDiff` objects, though the \"index\" consists of a\n      (column_name, row) tuple.  For example::\n\n          [('TARGET', 0), ('NGC1001', 'NGC1002')]\n\n      shows that the tables contain different values in the 0-th row of the\n      'TARGET' column.\n\n    - ``diff_total`` and ``diff_ratio``: Same as `ImageDataDiff`.\n\n    `TableDataDiff` objects also have a ``common_columns`` attribute that lists\n    the `Column` objects for columns that are identical in both tables, and a\n    ``common_column_names`` attribute which contains a set of the names of\n    those columns.\n    \"\"\"\n\n    def __init__(self, a, b, ignore_fields=[], numdiffs=10, rtol=0.0, atol=0.0):\n        \"\"\"\n        Parameters\n        ----------\n        a : BaseHDU\n            An HDU object.\n\n        b : BaseHDU\n            An HDU object to compare to the first HDU object.\n\n        ignore_fields : sequence, optional\n            The (case-insensitive) names of any table columns to ignore if any\n            table data is to be compared.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\\\left| a - b \\\\right| > \\\\text{atol} + \\\\text{rtol} \\\\cdot \\\\left| b \\\\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n        \"\"\"\n\n        self.ignore_fields = set(ignore_fields)\n        self.numdiffs = numdiffs\n        self.rtol = rtol\n        self.atol = atol\n\n        self.common_columns = []\n        self.common_column_names = set()\n\n        # self.diff_columns contains columns with different column definitions,\n        # but not different column data. Column data is only compared in\n        # columns that have the same definitions\n        self.diff_rows = ()\n        self.diff_column_count = ()\n        self.diff_columns = ()\n\n        # If two columns have the same name+format, but other attributes are\n        # different (such as TUNIT or such) they are listed here\n        self.diff_column_attributes = []\n\n        # Like self.diff_columns, but just contains a list of the column names\n        # unique to each table, and in the order they appear in the tables\n        self.diff_column_names = ()\n        self.diff_values = []\n\n        self.diff_ratio = 0\n        self.diff_total = 0\n\n        super().__init__(a, b)\n\n    def _diff(self):\n        # Much of the code for comparing columns is similar to the code for\n        # comparing headers--consider refactoring\n        colsa = self.a.columns\n        colsb = self.b.columns\n\n        if len(colsa) != len(colsb):\n            self.diff_column_count = (len(colsa), len(colsb))\n\n        # Even if the number of columns are unequal, we still do comparison of\n        # any common columns\n        colsa = {c.name.lower(): c for c in colsa}\n        colsb = {c.name.lower(): c for c in colsb}\n\n        if '*' in self.ignore_fields:\n            # If all columns are to be ignored, ignore any further differences\n            # between the columns\n            return\n\n        # Keep the user's original ignore_fields list for reporting purposes,\n        # but internally use a case-insensitive version\n        ignore_fields = {f.lower() for f in self.ignore_fields}\n\n        # It might be nice if there were a cleaner way to do this, but for now\n        # it'll do\n        for fieldname in ignore_fields:\n            fieldname = fieldname.lower()\n            if fieldname in colsa:\n                del colsa[fieldname]\n            if fieldname in colsb:\n                del colsb[fieldname]\n\n        colsa_set = set(colsa.values())\n        colsb_set = set(colsb.values())\n        self.common_columns = sorted(colsa_set.intersection(colsb_set),\n                                     key=operator.attrgetter('name'))\n\n        self.common_column_names = {col.name.lower()\n                                    for col in self.common_columns}\n\n        left_only_columns = {col.name.lower(): col\n                             for col in colsa_set.difference(colsb_set)}\n        right_only_columns = {col.name.lower(): col\n                              for col in colsb_set.difference(colsa_set)}\n\n        if left_only_columns or right_only_columns:\n            self.diff_columns = (left_only_columns, right_only_columns)\n            self.diff_column_names = ([], [])\n\n        if left_only_columns:\n            for col in self.a.columns:\n                if col.name.lower() in left_only_columns:\n                    self.diff_column_names[0].append(col.name)\n\n        if right_only_columns:\n            for col in self.b.columns:\n                if col.name.lower() in right_only_columns:\n                    self.diff_column_names[1].append(col.name)\n\n        # If the tables have a different number of rows, we don't compare the\n        # columns right now.\n        # TODO: It might be nice to optionally compare the first n rows where n\n        # is the minimum of the row counts between the two tables.\n        if len(self.a) != len(self.b):\n            self.diff_rows = (len(self.a), len(self.b))\n            return\n\n        # If the tables contain no rows there's no data to compare, so we're\n        # done at this point. (See ticket #178)\n        if len(self.a) == len(self.b) == 0:\n            return\n\n        # Like in the old fitsdiff, compare tables on a column by column basis\n        # The difficulty here is that, while FITS column names are meant to be\n        # case-insensitive, Astropy still allows, for the sake of flexibility,\n        # two columns with the same name but different case.  When columns are\n        # accessed in FITS tables, a case-sensitive is tried first, and failing\n        # that a case-insensitive match is made.\n        # It's conceivable that the same column could appear in both tables\n        # being compared, but with different case.\n        # Though it *may* lead to inconsistencies in these rare cases, this\n        # just assumes that there are no duplicated column names in either\n        # table, and that the column names can be treated case-insensitively.\n        for col in self.common_columns:\n            name_lower = col.name.lower()\n            if name_lower in ignore_fields:\n                continue\n\n            cola = colsa[name_lower]\n            colb = colsb[name_lower]\n\n            for attr, _ in _COL_ATTRS:\n                vala = getattr(cola, attr, None)\n                valb = getattr(colb, attr, None)\n                if diff_values(vala, valb):\n                    self.diff_column_attributes.append(\n                        ((col.name.upper(), attr), (vala, valb)))\n\n            arra = self.a[col.name]\n            arrb = self.b[col.name]\n\n            if (np.issubdtype(arra.dtype, np.floating) and\n                    np.issubdtype(arrb.dtype, np.floating)):\n                diffs = where_not_allclose(arra, arrb,\n                                           rtol=self.rtol,\n                                           atol=self.atol)\n            elif 'P' in col.format:\n                diffs = ([idx for idx in range(len(arra))\n                          if not np.allclose(arra[idx], arrb[idx],\n                                             rtol=self.rtol,\n                                             atol=self.atol)],)\n            else:\n                diffs = np.where(arra != arrb)\n\n            self.diff_total += len(set(diffs[0]))\n\n            if self.numdiffs >= 0:\n                if len(self.diff_values) >= self.numdiffs:\n                    # Don't save any more diff values\n                    continue\n\n                # Add no more diff'd values than this\n                max_diffs = self.numdiffs - len(self.diff_values)\n            else:\n                max_diffs = len(diffs[0])\n\n            last_seen_idx = None\n            for idx in islice(diffs[0], 0, max_diffs):\n                if idx == last_seen_idx:\n                    # Skip duplicate indices, which my occur when the column\n                    # data contains multi-dimensional values; we're only\n                    # interested in storing row-by-row differences\n                    continue\n                last_seen_idx = idx\n                self.diff_values.append(((col.name, idx),\n                                         (arra[idx], arrb[idx])))\n\n        total_values = len(self.a) * len(self.a.dtype.fields)\n        self.diff_ratio = float(self.diff_total) / float(total_values)\n\n    def _report(self):\n        if self.diff_column_count:\n            self._writeln(' Tables have different number of columns:')\n            self._writeln(f'  a: {self.diff_column_count[0]}')\n            self._writeln(f'  b: {self.diff_column_count[1]}')\n\n        if self.diff_column_names:\n            # Show columns with names unique to either table\n            for name in self.diff_column_names[0]:\n                format = self.diff_columns[0][name.lower()].format\n                self._writeln(f' Extra column {name} of format {format} in a')\n            for name in self.diff_column_names[1]:\n                format = self.diff_columns[1][name.lower()].format\n                self._writeln(f' Extra column {name} of format {format} in b')\n\n        col_attrs = dict(_COL_ATTRS)\n        # Now go through each table again and show columns with common\n        # names but other property differences...\n        for col_attr, vals in self.diff_column_attributes:\n            name, attr = col_attr\n            self._writeln(f' Column {name} has different {col_attrs[attr]}:')\n            report_diff_values(vals[0], vals[1], fileobj=self._fileobj,\n                               indent_width=self._indent + 1)\n\n        if self.diff_rows:\n            self._writeln(' Table rows differ:')\n            self._writeln(f'  a: {self.diff_rows[0]}')\n            self._writeln(f'  b: {self.diff_rows[1]}')\n            self._writeln(' No further data comparison performed.')\n            return\n\n        if not self.diff_values:\n            return\n\n        # Finally, let's go through and report column data differences:\n        for indx, values in self.diff_values:\n            self._writeln(' Column {} data differs in row {}:'.format(*indx))\n            report_diff_values(values[0], values[1], fileobj=self._fileobj,\n                               indent_width=self._indent + 1)\n\n        if self.diff_values and self.numdiffs < self.diff_total:\n            self._writeln(' ...{} additional difference(s) found.'.format(\n                                self.diff_total - self.numdiffs))\n\n        if self.diff_total > self.numdiffs:\n            self._writeln(' ...')\n\n        self._writeln(' {} different table data element(s) found '\n                      '({:.2%} different).'\n                      .format(self.diff_total, self.diff_ratio))\n\n\ndef report_diff_keyword_attr(fileobj, attr, diffs, keyword, ind=0):\n    \"\"\"\n    Write a diff between two header keyword values or comments to the specified\n    file-like object.\n    \"\"\"\n\n    if keyword in diffs:\n        vals = diffs[keyword]\n        for idx, val in enumerate(vals):\n            if val is None:\n                continue\n            if idx == 0:\n                dup = ''\n            else:\n                dup = f'[{idx + 1}]'\n            fileobj.write(\n                fixed_width_indent(' Keyword {:8}{} has different {}:\\n'\n                                   .format(keyword, dup, attr), ind))\n            report_diff_values(val[0], val[1], fileobj=fileobj,\n                               indent_width=ind + 1)\n"},{"col":0,"comment":"\n    Attempts to extract an integer number from the given value. If the\n    extraction fails, the value of the 'default' argument is returned.\n    ","endLoc":870,"header":"def _extract_number(value, default)","id":1056,"name":"_extract_number","nodeType":"Function","startLoc":859,"text":"def _extract_number(value, default):\n    \"\"\"\n    Attempts to extract an integer number from the given value. If the\n    extraction fails, the value of the 'default' argument is returned.\n    \"\"\"\n\n    try:\n        # The _str_to_num method converts the value to string/float\n        # so we need to perform one additional conversion to int on top\n        return int(_str_to_num(value))\n    except (TypeError, ValueError):\n        return default"},{"col":0,"comment":"\n    Return a string representing the path to the file requested from the\n    io.fits test data set.\n\n    .. versionadded:: 2.0.3\n\n    Parameters\n    ----------\n    filename : str\n        The filename of the test data file.\n\n    Returns\n    -------\n    filepath : str\n        The path to the requested file.\n    ","endLoc":891,"header":"def get_testdata_filepath(filename)","id":1057,"name":"get_testdata_filepath","nodeType":"Function","startLoc":873,"text":"def get_testdata_filepath(filename):\n    \"\"\"\n    Return a string representing the path to the file requested from the\n    io.fits test data set.\n\n    .. versionadded:: 2.0.3\n\n    Parameters\n    ----------\n    filename : str\n        The filename of the test data file.\n\n    Returns\n    -------\n    filepath : str\n        The path to the requested file.\n    \"\"\"\n    return data.get_pkg_data_filename(\n        f'io/fits/tests/data/{filename}', 'astropy')"},{"col":0,"comment":"\n    Retrieves a data file from the standard locations for the package and\n    provides a local filename for the data.\n\n    This function is similar to `get_pkg_data_fileobj` but returns the\n    file *name* instead of a readable file-like object.  This means\n    that this function must always cache remote files locally, unlike\n    `get_pkg_data_fileobj`.\n\n    Parameters\n    ----------\n    data_name : str\n        Name/location of the desired data file.  One of the following:\n\n            * The name of a data file included in the source\n              distribution.  The path is relative to the module\n              calling this function.  For example, if calling from\n              ``astropy.pkname``, use ``'data/file.dat'`` to get the\n              file in ``astropy/pkgname/data/file.dat``.  Double-dots\n              can be used to go up a level.  In the same example, use\n              ``'../data/file.dat'`` to get ``astropy/data/file.dat``.\n            * If a matching local file does not exist, the Astropy\n              data server will be queried for the file.\n            * A hash like that produced by `compute_hash` can be\n              requested, prefixed by 'hash/'\n              e.g. 'hash/34c33b3eb0d56eb9462003af249eff28'.  The hash\n              will first be searched for locally, and if not found,\n              the Astropy data server will be queried.\n\n    package : str, optional\n        If specified, look for a file relative to the given package, rather\n        than the default of looking relative to the calling module's package.\n\n    show_progress : bool, optional\n        Whether to display a progress bar if the file is downloaded\n        from a remote server.  Default is `True`.\n\n    remote_timeout : float\n        Timeout for the requests in seconds (default is the\n        configurable `astropy.utils.data.Conf.remote_timeout`).\n\n    Raises\n    ------\n    urllib.error.URLError\n        If a remote file cannot be found.\n    OSError\n        If problems occur writing or reading a local file.\n\n    Returns\n    -------\n    filename : str\n        A file path on the local file system corresponding to the data\n        requested in ``data_name``.\n\n    Examples\n    --------\n\n    This will retrieve the contents of the data file for the `astropy.wcs`\n    tests::\n\n        >>> from astropy.utils.data import get_pkg_data_filename\n        >>> fn = get_pkg_data_filename('data/3d_cd.hdr',\n        ...                            package='astropy.wcs.tests')\n        >>> with open(fn) as f:\n        ...     fcontents = f.read()\n        ...\n\n    This retrieves a data file by hash either locally or from the astropy data\n    server::\n\n        >>> from astropy.utils.data import get_pkg_data_filename\n        >>> fn = get_pkg_data_filename('hash/34c33b3eb0d56eb9462003af249eff28')  # doctest: +SKIP\n        >>> with open(fn) as f:\n        ...     fcontents = f.read()\n        ...\n\n    See Also\n    --------\n    get_pkg_data_contents : returns the contents of a file or url as a bytes object\n    get_pkg_data_fileobj : returns a file-like object with the data\n    ","endLoc":657,"header":"def get_pkg_data_filename(data_name, package=None, show_progress=True,\n                          remote_timeout=None)","id":1058,"name":"get_pkg_data_filename","nodeType":"Function","startLoc":544,"text":"def get_pkg_data_filename(data_name, package=None, show_progress=True,\n                          remote_timeout=None):\n    \"\"\"\n    Retrieves a data file from the standard locations for the package and\n    provides a local filename for the data.\n\n    This function is similar to `get_pkg_data_fileobj` but returns the\n    file *name* instead of a readable file-like object.  This means\n    that this function must always cache remote files locally, unlike\n    `get_pkg_data_fileobj`.\n\n    Parameters\n    ----------\n    data_name : str\n        Name/location of the desired data file.  One of the following:\n\n            * The name of a data file included in the source\n              distribution.  The path is relative to the module\n              calling this function.  For example, if calling from\n              ``astropy.pkname``, use ``'data/file.dat'`` to get the\n              file in ``astropy/pkgname/data/file.dat``.  Double-dots\n              can be used to go up a level.  In the same example, use\n              ``'../data/file.dat'`` to get ``astropy/data/file.dat``.\n            * If a matching local file does not exist, the Astropy\n              data server will be queried for the file.\n            * A hash like that produced by `compute_hash` can be\n              requested, prefixed by 'hash/'\n              e.g. 'hash/34c33b3eb0d56eb9462003af249eff28'.  The hash\n              will first be searched for locally, and if not found,\n              the Astropy data server will be queried.\n\n    package : str, optional\n        If specified, look for a file relative to the given package, rather\n        than the default of looking relative to the calling module's package.\n\n    show_progress : bool, optional\n        Whether to display a progress bar if the file is downloaded\n        from a remote server.  Default is `True`.\n\n    remote_timeout : float\n        Timeout for the requests in seconds (default is the\n        configurable `astropy.utils.data.Conf.remote_timeout`).\n\n    Raises\n    ------\n    urllib.error.URLError\n        If a remote file cannot be found.\n    OSError\n        If problems occur writing or reading a local file.\n\n    Returns\n    -------\n    filename : str\n        A file path on the local file system corresponding to the data\n        requested in ``data_name``.\n\n    Examples\n    --------\n\n    This will retrieve the contents of the data file for the `astropy.wcs`\n    tests::\n\n        >>> from astropy.utils.data import get_pkg_data_filename\n        >>> fn = get_pkg_data_filename('data/3d_cd.hdr',\n        ...                            package='astropy.wcs.tests')\n        >>> with open(fn) as f:\n        ...     fcontents = f.read()\n        ...\n\n    This retrieves a data file by hash either locally or from the astropy data\n    server::\n\n        >>> from astropy.utils.data import get_pkg_data_filename\n        >>> fn = get_pkg_data_filename('hash/34c33b3eb0d56eb9462003af249eff28')  # doctest: +SKIP\n        >>> with open(fn) as f:\n        ...     fcontents = f.read()\n        ...\n\n    See Also\n    --------\n    get_pkg_data_contents : returns the contents of a file or url as a bytes object\n    get_pkg_data_fileobj : returns a file-like object with the data\n    \"\"\"\n\n    if remote_timeout is None:\n        # use configfile default\n        remote_timeout = conf.remote_timeout\n\n    if data_name.startswith('hash/'):\n        # first try looking for a local version if a hash is specified\n        hashfn = _find_hash_fn(data_name[5:])\n\n        if hashfn is None:\n            return download_file(conf.dataurl + data_name, cache=True,\n                                 show_progress=show_progress,\n                                 timeout=remote_timeout,\n                                 sources=[conf.dataurl + data_name,\n                                          conf.dataurl_mirror + data_name])\n        else:\n            return hashfn\n    else:\n        fs_path = os.path.normpath(data_name)\n        datafn = get_pkg_data_path(fs_path, package=package)\n        if os.path.isdir(datafn):\n            raise OSError(\"Tried to access a data file that's actually \"\n                          \"a package data directory\")\n        elif os.path.isfile(datafn):  # local file\n            return datafn\n        else:  # remote file\n            return download_file(conf.dataurl + data_name, cache=True,\n                                 show_progress=show_progress,\n                                 timeout=remote_timeout,\n                                 sources=[conf.dataurl + data_name,\n                                          conf.dataurl_mirror + data_name])"},{"col":4,"comment":"\n        Inserts a new keyword+value card into the Header at a given location,\n        similar to `list.insert`.\n\n        Parameters\n        ----------\n        key : int, str, or tuple\n            The index into the list of header keywords before which the\n            new keyword should be inserted, or the name of a keyword before\n            which the new keyword should be inserted.  Can also accept a\n            (keyword, index) tuple for inserting around duplicate keywords.\n\n        card : str, tuple\n            A keyword or a (keyword, value, [comment]) tuple; see\n            `Header.append`\n\n        useblanks : bool, optional\n            If there are blank cards at the end of the Header, replace the\n            first blank card so that the total number of cards in the Header\n            does not increase.  Otherwise preserve the number of blank cards.\n\n        after : bool, optional\n            If set to `True`, insert *after* the specified index or keyword,\n            rather than before it.  Defaults to `False`.\n        ","endLoc":1497,"header":"def insert(self, key, card, useblanks=True, after=False)","id":1059,"name":"insert","nodeType":"Function","startLoc":1405,"text":"def insert(self, key, card, useblanks=True, after=False):\n        \"\"\"\n        Inserts a new keyword+value card into the Header at a given location,\n        similar to `list.insert`.\n\n        Parameters\n        ----------\n        key : int, str, or tuple\n            The index into the list of header keywords before which the\n            new keyword should be inserted, or the name of a keyword before\n            which the new keyword should be inserted.  Can also accept a\n            (keyword, index) tuple for inserting around duplicate keywords.\n\n        card : str, tuple\n            A keyword or a (keyword, value, [comment]) tuple; see\n            `Header.append`\n\n        useblanks : bool, optional\n            If there are blank cards at the end of the Header, replace the\n            first blank card so that the total number of cards in the Header\n            does not increase.  Otherwise preserve the number of blank cards.\n\n        after : bool, optional\n            If set to `True`, insert *after* the specified index or keyword,\n            rather than before it.  Defaults to `False`.\n        \"\"\"\n\n        if not isinstance(key, numbers.Integral):\n            # Don't pass through ints to _cardindex because it will not take\n            # kindly to indices outside the existing number of cards in the\n            # header, which insert needs to be able to support (for example\n            # when inserting into empty headers)\n            idx = self._cardindex(key)\n        else:\n            idx = key\n\n        if after:\n            if idx == -1:\n                idx = len(self._cards)\n            else:\n                idx += 1\n\n        if idx >= len(self._cards):\n            # This is just an append (Though it must be an append absolutely to\n            # the bottom, ignoring blanks, etc.--the point of the insert method\n            # is that you get exactly what you asked for with no surprises)\n            self.append(card, end=True)\n            return\n\n        if isinstance(card, str):\n            card = Card(card)\n        elif isinstance(card, tuple):\n            card = Card(*card)\n        elif not isinstance(card, Card):\n            raise ValueError(\n                'The value inserted into a Header must be either a keyword or '\n                '(keyword, value, [comment]) tuple; got: {!r}'.format(card))\n\n        self._cards.insert(idx, card)\n\n        keyword = card.keyword\n\n        # If idx was < 0, determine the actual index according to the rules\n        # used by list.insert()\n        if idx < 0:\n            idx += len(self._cards) - 1\n            if idx < 0:\n                idx = 0\n\n        # All the keyword indices above the insertion point must be updated\n        self._updateindices(idx)\n\n        keyword = Card.normalize_keyword(keyword)\n        self._keyword_indices[keyword].append(idx)\n        count = len(self._keyword_indices[keyword])\n        if count > 1:\n            # There were already keywords with this same name\n            if keyword not in Card._commentary_keywords:\n                warnings.warn(\n                    'A {!r} keyword already exists in this header.  Inserting '\n                    'duplicate keyword.'.format(keyword), AstropyUserWarning)\n            self._keyword_indices[keyword].sort()\n\n        if card.field_specifier is not None:\n            # Update the index of RVKC as well\n            rvkc_indices = self._rvkc_indices[card.rawkeyword]\n            rvkc_indices.append(idx)\n            rvkc_indices.sort()\n\n        if useblanks:\n            self._useblanks(len(str(card)) // Card.length)\n\n        self._modified = True"},{"col":0,"comment":"\n    Looks for a local file by hash - returns file name if found and a valid\n    file, otherwise returns None.\n    ","endLoc":962,"header":"def _find_hash_fn(hexdigest, pkgname='astropy')","id":1060,"name":"_find_hash_fn","nodeType":"Function","startLoc":954,"text":"def _find_hash_fn(hexdigest, pkgname='astropy'):\n    \"\"\"\n    Looks for a local file by hash - returns file name if found and a valid\n    file, otherwise returns None.\n    \"\"\"\n    for v in cache_contents(pkgname=pkgname).values():\n        if compute_hash(v) == hexdigest:\n            return v\n    return None"},{"col":0,"comment":"Obtain a dict mapping cached URLs to filenames.\n\n    This dictionary is a read-only snapshot of the state of the cache when this\n    function was called. If other processes are actively working with the\n    cache, it is possible for them to delete files that are listed in this\n    dictionary. Use with some caution if you are working on a system that is\n    busy with many running astropy processes, although the same issues apply to\n    most functions in this module.\n    ","endLoc":2008,"header":"def cache_contents(pkgname='astropy')","id":1061,"name":"cache_contents","nodeType":"Function","startLoc":1988,"text":"def cache_contents(pkgname='astropy'):\n    \"\"\"Obtain a dict mapping cached URLs to filenames.\n\n    This dictionary is a read-only snapshot of the state of the cache when this\n    function was called. If other processes are actively working with the\n    cache, it is possible for them to delete files that are listed in this\n    dictionary. Use with some caution if you are working on a system that is\n    busy with many running astropy processes, although the same issues apply to\n    most functions in this module.\n    \"\"\"\n    r = {}\n    try:\n        dldir = _get_download_cache_loc(pkgname=pkgname)\n    except OSError:\n        return _NOTHING\n    with os.scandir(dldir) as it:\n        for entry in it:\n            if entry.is_dir:\n                url = get_file_contents(os.path.join(dldir, entry.name, \"url\"), encoding=\"utf-8\")\n                r[url] = os.path.abspath(os.path.join(dldir, entry.name, \"contents\"))\n    return ReadOnlyDict(r)"},{"col":4,"comment":"\n        Location on Earth, initialized from geodetic coordinates.\n\n        Parameters\n        ----------\n        lon : `~astropy.coordinates.Longitude` or float\n            Earth East longitude.  Can be anything that initialises an\n            `~astropy.coordinates.Angle` object (if float, in degrees).\n        lat : `~astropy.coordinates.Latitude` or float\n            Earth latitude.  Can be anything that initialises an\n            `~astropy.coordinates.Latitude` object (if float, in degrees).\n        height : `~astropy.units.Quantity` ['length'] or float, optional\n            Height above reference ellipsoid (if float, in meters; default: 0).\n        ellipsoid : str, optional\n            Name of the reference ellipsoid to use (default: 'WGS84').\n            Available ellipsoids are:  'WGS84', 'GRS80', 'WGS72'.\n\n        Raises\n        ------\n        astropy.units.UnitsError\n            If the units on ``lon`` and ``lat`` are inconsistent with angular\n            ones, or that on ``height`` with a length.\n        ValueError\n            If ``lon``, ``lat``, and ``height`` do not have the same shape, or\n            if ``ellipsoid`` is not recognized as among the ones implemented.\n\n        Notes\n        -----\n        For the conversion to geocentric coordinates, the ERFA routine\n        ``gd2gc`` is used.  See https://github.com/liberfa/erfa\n        ","endLoc":307,"header":"@classmethod\n    def from_geodetic(cls, lon, lat, height=0., ellipsoid=None)","id":1062,"name":"from_geodetic","nodeType":"Function","startLoc":262,"text":"@classmethod\n    def from_geodetic(cls, lon, lat, height=0., ellipsoid=None):\n        \"\"\"\n        Location on Earth, initialized from geodetic coordinates.\n\n        Parameters\n        ----------\n        lon : `~astropy.coordinates.Longitude` or float\n            Earth East longitude.  Can be anything that initialises an\n            `~astropy.coordinates.Angle` object (if float, in degrees).\n        lat : `~astropy.coordinates.Latitude` or float\n            Earth latitude.  Can be anything that initialises an\n            `~astropy.coordinates.Latitude` object (if float, in degrees).\n        height : `~astropy.units.Quantity` ['length'] or float, optional\n            Height above reference ellipsoid (if float, in meters; default: 0).\n        ellipsoid : str, optional\n            Name of the reference ellipsoid to use (default: 'WGS84').\n            Available ellipsoids are:  'WGS84', 'GRS80', 'WGS72'.\n\n        Raises\n        ------\n        astropy.units.UnitsError\n            If the units on ``lon`` and ``lat`` are inconsistent with angular\n            ones, or that on ``height`` with a length.\n        ValueError\n            If ``lon``, ``lat``, and ``height`` do not have the same shape, or\n            if ``ellipsoid`` is not recognized as among the ones implemented.\n\n        Notes\n        -----\n        For the conversion to geocentric coordinates, the ERFA routine\n        ``gd2gc`` is used.  See https://github.com/liberfa/erfa\n        \"\"\"\n        ellipsoid = _check_ellipsoid(ellipsoid, default=cls._ellipsoid)\n        # As wrapping fails on readonly input, we do so manually\n        lon = Angle(lon, u.degree, copy=False).wrap_at(180 * u.degree)\n        lat = Latitude(lat, u.degree, copy=False)\n        # don't convert to m by default, so we can use the height unit below.\n        if not isinstance(height, u.Quantity):\n            height = u.Quantity(height, u.m, copy=False)\n        # get geocentric coordinates.\n        geodetic = ELLIPSOIDS[ellipsoid](lon, lat, height, copy=False)\n        xyz = geodetic.to_cartesian().get_xyz(xyz_axis=-1) << height.unit\n        self = xyz.view(cls._location_dtype, cls).reshape(geodetic.shape)\n        self._ellipsoid = ellipsoid\n        return self"},{"className":"Card","col":0,"comment":"null","endLoc":1192,"id":1063,"nodeType":"Class","startLoc":42,"text":"class Card(_Verify):\n\n    length = CARD_LENGTH\n    \"\"\"The length of a Card image; should always be 80 for valid FITS files.\"\"\"\n\n    # String for a FITS standard compliant (FSC) keyword.\n    _keywd_FSC_RE = re.compile(r'^[A-Z0-9_-]{0,%d}$' % KEYWORD_LENGTH)\n    # This will match any printable ASCII character excluding '='\n    _keywd_hierarch_RE = re.compile(r'^(?:HIERARCH +)?(?:^[ -<>-~]+ ?)+$',\n                                    re.I)\n\n    # A number sub-string, either an integer or a float in fixed or\n    # scientific notation.  One for FSC and one for non-FSC (NFSC) format:\n    # NFSC allows lower case of DE for exponent, allows space between sign,\n    # digits, exponent sign, and exponents\n    _digits_FSC = r'(\\.\\d+|\\d+(\\.\\d*)?)([DE][+-]?\\d+)?'\n    _digits_NFSC = r'(\\.\\d+|\\d+(\\.\\d*)?) *([deDE] *[+-]? *\\d+)?'\n    _numr_FSC = r'[+-]?' + _digits_FSC\n    _numr_NFSC = r'[+-]? *' + _digits_NFSC\n\n    # This regex helps delete leading zeros from numbers, otherwise\n    # Python might evaluate them as octal values (this is not-greedy, however,\n    # so it may not strip leading zeros from a float, which is fine)\n    _number_FSC_RE = re.compile(rf'(?P<sign>[+-])?0*?(?P<digt>{_digits_FSC})')\n    _number_NFSC_RE = \\\n            re.compile(rf'(?P<sign>[+-])? *0*?(?P<digt>{_digits_NFSC})')\n\n    # Used in cards using the CONTINUE convention which expect a string\n    # followed by an optional comment\n    _strg = r'\\'(?P<strg>([ -~]+?|\\'\\'|) *?)\\'(?=$|/| )'\n    _comm_field = r'(?P<comm_field>(?P<sepr>/ *)(?P<comm>(.|\\n)*))'\n    _strg_comment_RE = re.compile(f'({_strg})? *{_comm_field}?')\n\n    # FSC commentary card string which must contain printable ASCII characters.\n    # Note: \\Z matches the end of the string without allowing newlines\n    _ascii_text_re = re.compile(r'[ -~]*\\Z')\n\n    # Checks for a valid value/comment string.  It returns a match object\n    # for a valid value/comment string.\n    # The valu group will return a match if a FITS string, boolean,\n    # number, or complex value is found, otherwise it will return\n    # None, meaning the keyword is undefined.  The comment field will\n    # return a match if the comment separator is found, though the\n    # comment maybe an empty string.\n    _value_FSC_RE = re.compile(\n        r'(?P<valu_field> *'\n            r'(?P<valu>'\n\n                #  The <strg> regex is not correct for all cases, but\n                #  it comes pretty darn close.  It appears to find the\n                #  end of a string rather well, but will accept\n                #  strings with an odd number of single quotes,\n                #  instead of issuing an error.  The FITS standard\n                #  appears vague on this issue and only states that a\n                #  string should not end with two single quotes,\n                #  whereas it should not end with an even number of\n                #  quotes to be precise.\n                #\n                #  Note that a non-greedy match is done for a string,\n                #  since a greedy match will find a single-quote after\n                #  the comment separator resulting in an incorrect\n                #  match.\n                rf'{_strg}|'\n                r'(?P<bool>[FT])|'\n                r'(?P<numr>' + _numr_FSC + r')|'\n                r'(?P<cplx>\\( *'\n                    r'(?P<real>' + _numr_FSC + r') *, *'\n                    r'(?P<imag>' + _numr_FSC + r') *\\))'\n            r')? *)'\n        r'(?P<comm_field>'\n            r'(?P<sepr>/ *)'\n            r'(?P<comm>[!-~][ -~]*)?'\n        r')?$')\n\n    _value_NFSC_RE = re.compile(\n        r'(?P<valu_field> *'\n            r'(?P<valu>'\n                rf'{_strg}|'\n                r'(?P<bool>[FT])|'\n                r'(?P<numr>' + _numr_NFSC + r')|'\n                r'(?P<cplx>\\( *'\n                    r'(?P<real>' + _numr_NFSC + r') *, *'\n                    r'(?P<imag>' + _numr_NFSC + r') *\\))'\n            fr')? *){_comm_field}?$')\n\n    _rvkc_identifier = r'[a-zA-Z_]\\w*'\n    _rvkc_field = _rvkc_identifier + r'(\\.\\d+)?'\n    _rvkc_field_specifier_s = fr'{_rvkc_field}(\\.{_rvkc_field})*'\n    _rvkc_field_specifier_val = (r'(?P<keyword>{}): +(?P<val>{})'.format(\n            _rvkc_field_specifier_s, _numr_FSC))\n    _rvkc_keyword_val = fr'\\'(?P<rawval>{_rvkc_field_specifier_val})\\''\n    _rvkc_keyword_val_comm = (r' *{} *(/ *(?P<comm>[ -~]*))?$'.format(\n            _rvkc_keyword_val))\n\n    _rvkc_field_specifier_val_RE = re.compile(_rvkc_field_specifier_val + '$')\n\n    # regular expression to extract the key and the field specifier from a\n    # string that is being used to index into a card list that contains\n    # record value keyword cards (ex. 'DP1.AXIS.1')\n    _rvkc_keyword_name_RE = (\n        re.compile(r'(?P<keyword>{})\\.(?P<field_specifier>{})$'.format(\n                _rvkc_identifier, _rvkc_field_specifier_s)))\n\n    # regular expression to extract the field specifier and value and comment\n    # from the string value of a record value keyword card\n    # (ex \"'AXIS.1: 1' / a comment\")\n    _rvkc_keyword_val_comm_RE = re.compile(_rvkc_keyword_val_comm)\n\n    _commentary_keywords = {'', 'COMMENT', 'HISTORY', 'END'}\n    _special_keywords = _commentary_keywords.union(['CONTINUE'])\n\n    # The default value indicator; may be changed if required by a convention\n    # (namely HIERARCH cards)\n    _value_indicator = VALUE_INDICATOR\n\n    def __init__(self, keyword=None, value=None, comment=None, **kwargs):\n        # For backwards compatibility, support the 'key' keyword argument:\n        if keyword is None and 'key' in kwargs:\n            keyword = kwargs['key']\n\n        self._keyword = None\n        self._value = None\n        self._comment = None\n        self._valuestring = None\n        self._image = None\n\n        # This attribute is set to False when creating the card from a card\n        # image to ensure that the contents of the image get verified at some\n        # point\n        self._verified = True\n\n        # A flag to conveniently mark whether or not this was a valid HIERARCH\n        # card\n        self._hierarch = False\n\n        # If the card could not be parsed according the the FITS standard or\n        # any recognized non-standard conventions, this will be True\n        self._invalid = False\n\n        self._field_specifier = None\n\n        # These are used primarily only by RVKCs\n        self._rawkeyword = None\n        self._rawvalue = None\n\n        if not (keyword is not None and value is not None and\n                self._check_if_rvkc(keyword, value)):\n            # If _check_if_rvkc passes, it will handle setting the keyword and\n            # value\n            if keyword is not None:\n                self.keyword = keyword\n            if value is not None:\n                self.value = value\n\n        if comment is not None:\n            self.comment = comment\n\n        self._modified = False\n        self._valuemodified = False\n\n    def __repr__(self):\n        return repr((self.keyword, self.value, self.comment))\n\n    def __str__(self):\n        return self.image\n\n    def __len__(self):\n        return 3\n\n    def __getitem__(self, index):\n        return (self.keyword, self.value, self.comment)[index]\n\n    @property\n    def keyword(self):\n        \"\"\"Returns the keyword name parsed from the card image.\"\"\"\n        if self._keyword is not None:\n            return self._keyword\n        elif self._image:\n            self._keyword = self._parse_keyword()\n            return self._keyword\n        else:\n            self.keyword = ''\n            return ''\n\n    @keyword.setter\n    def keyword(self, keyword):\n        \"\"\"Set the key attribute; once set it cannot be modified.\"\"\"\n        if self._keyword is not None:\n            raise AttributeError(\n                'Once set, the Card keyword may not be modified')\n        elif isinstance(keyword, str):\n            # Be nice and remove trailing whitespace--some FITS code always\n            # pads keywords out with spaces; leading whitespace, however,\n            # should be strictly disallowed.\n            keyword = keyword.rstrip()\n            keyword_upper = keyword.upper()\n            if (len(keyword) <= KEYWORD_LENGTH and\n                    self._keywd_FSC_RE.match(keyword_upper)):\n                # For keywords with length > 8 they will be HIERARCH cards,\n                # and can have arbitrary case keywords\n                if keyword_upper == 'END':\n                    raise ValueError(\"Keyword 'END' not allowed.\")\n                keyword = keyword_upper\n            elif self._keywd_hierarch_RE.match(keyword):\n                # In prior versions of PyFITS (*) HIERARCH cards would only be\n                # created if the user-supplied keyword explicitly started with\n                # 'HIERARCH '.  Now we will create them automatically for long\n                # keywords, but we still want to support the old behavior too;\n                # the old behavior makes it possible to create HIERARCH cards\n                # that would otherwise be recognized as RVKCs\n                # (*) This has never affected Astropy, because it was changed\n                # before PyFITS was merged into Astropy!\n                self._hierarch = True\n                self._value_indicator = HIERARCH_VALUE_INDICATOR\n\n                if keyword_upper[:9] == 'HIERARCH ':\n                    # The user explicitly asked for a HIERARCH card, so don't\n                    # bug them about it...\n                    keyword = keyword[9:].strip()\n                else:\n                    # We'll gladly create a HIERARCH card, but a warning is\n                    # also displayed\n                    warnings.warn(\n                        'Keyword name {!r} is greater than 8 characters or '\n                        'contains characters not allowed by the FITS '\n                        'standard; a HIERARCH card will be created.'.format(\n                            keyword), VerifyWarning)\n            else:\n                raise ValueError(f'Illegal keyword name: {keyword!r}.')\n            self._keyword = keyword\n            self._modified = True\n        else:\n            raise ValueError(f'Keyword name {keyword!r} is not a string.')\n\n    @property\n    def value(self):\n        \"\"\"The value associated with the keyword stored in this card.\"\"\"\n\n        if self.field_specifier:\n            return float(self._value)\n\n        if self._value is not None:\n            value = self._value\n        elif self._valuestring is not None or self._image:\n            value = self._value = self._parse_value()\n        else:\n            if self._keyword == '':\n                self._value = value = ''\n            else:\n                self._value = value = UNDEFINED\n\n        if conf.strip_header_whitespace and isinstance(value, str):\n            value = value.rstrip()\n\n        return value\n\n    @value.setter\n    def value(self, value):\n        if self._invalid:\n            raise ValueError(\n                'The value of invalid/unparsable cards cannot set.  Either '\n                'delete this card from the header or replace it.')\n\n        if value is None:\n            value = UNDEFINED\n\n        try:\n            oldvalue = self.value\n        except VerifyError:\n            # probably a parsing error, falling back to the internal _value\n            # which should be None. This may happen while calling _fix_value.\n            oldvalue = self._value\n\n        if oldvalue is None:\n            oldvalue = UNDEFINED\n\n        if not isinstance(value,\n                          (str, int, float, complex, bool, Undefined,\n                           np.floating, np.integer, np.complexfloating,\n                           np.bool_)):\n            raise ValueError(f'Illegal value: {value!r}.')\n\n        if isinstance(value, (float, np.float32)) and (np.isnan(value) or\n                                                       np.isinf(value)):\n            # value is checked for both float and np.float32 instances\n            # since np.float32 is not considered a Python float.\n            raise ValueError(\"Floating point {!r} values are not allowed \"\n                             \"in FITS headers.\".format(value))\n\n        elif isinstance(value, str):\n            m = self._ascii_text_re.match(value)\n            if not m:\n                raise ValueError(\n                    'FITS header values must contain standard printable ASCII '\n                    'characters; {!r} contains characters not representable in '\n                    'ASCII or non-printable characters.'.format(value))\n        elif isinstance(value, np.bool_):\n            value = bool(value)\n\n        if (conf.strip_header_whitespace and\n                (isinstance(oldvalue, str) and isinstance(value, str))):\n            # Ignore extra whitespace when comparing the new value to the old\n            different = oldvalue.rstrip() != value.rstrip()\n        elif isinstance(oldvalue, bool) or isinstance(value, bool):\n            different = oldvalue is not value\n        else:\n            different = (oldvalue != value or\n                         not isinstance(value, type(oldvalue)))\n\n        if different:\n            self._value = value\n            self._rawvalue = None\n            self._modified = True\n            self._valuestring = None\n            self._valuemodified = True\n            if self.field_specifier:\n                try:\n                    self._value = _int_or_float(self._value)\n                except ValueError:\n                    raise ValueError(f'value {self._value} is not a float')\n\n    @value.deleter\n    def value(self):\n        if self._invalid:\n            raise ValueError(\n                'The value of invalid/unparsable cards cannot deleted.  '\n                'Either delete this card from the header or replace it.')\n\n        if not self.field_specifier:\n            self.value = ''\n        else:\n            raise AttributeError('Values cannot be deleted from record-valued '\n                                 'keyword cards')\n\n    @property\n    def rawkeyword(self):\n        \"\"\"On record-valued keyword cards this is the name of the standard <= 8\n        character FITS keyword that this RVKC is stored in.  Otherwise it is\n        the card's normal keyword.\n        \"\"\"\n\n        if self._rawkeyword is not None:\n            return self._rawkeyword\n        elif self.field_specifier is not None:\n            self._rawkeyword = self.keyword.split('.', 1)[0]\n            return self._rawkeyword\n        else:\n            return self.keyword\n\n    @property\n    def rawvalue(self):\n        \"\"\"On record-valued keyword cards this is the raw string value in\n        the ``<field-specifier>: <value>`` format stored in the card in order\n        to represent a RVKC.  Otherwise it is the card's normal value.\n        \"\"\"\n\n        if self._rawvalue is not None:\n            return self._rawvalue\n        elif self.field_specifier is not None:\n            self._rawvalue = f'{self.field_specifier}: {self.value}'\n            return self._rawvalue\n        else:\n            return self.value\n\n    @property\n    def comment(self):\n        \"\"\"Get the comment attribute from the card image if not already set.\"\"\"\n\n        if self._comment is not None:\n            return self._comment\n        elif self._image:\n            self._comment = self._parse_comment()\n            return self._comment\n        else:\n            self._comment = ''\n            return ''\n\n    @comment.setter\n    def comment(self, comment):\n        if self._invalid:\n            raise ValueError(\n                'The comment of invalid/unparsable cards cannot set.  Either '\n                'delete this card from the header or replace it.')\n\n        if comment is None:\n            comment = ''\n\n        if isinstance(comment, str):\n            m = self._ascii_text_re.match(comment)\n            if not m:\n                raise ValueError(\n                    'FITS header comments must contain standard printable '\n                    'ASCII characters; {!r} contains characters not '\n                    'representable in ASCII or non-printable characters.'\n                    .format(comment))\n\n        try:\n            oldcomment = self.comment\n        except VerifyError:\n            # probably a parsing error, falling back to the internal _comment\n            # which should be None.\n            oldcomment = self._comment\n\n        if oldcomment is None:\n            oldcomment = ''\n        if comment != oldcomment:\n            self._comment = comment\n            self._modified = True\n\n    @comment.deleter\n    def comment(self):\n        if self._invalid:\n            raise ValueError(\n                'The comment of invalid/unparsable cards cannot deleted.  '\n                'Either delete this card from the header or replace it.')\n\n        self.comment = ''\n\n    @property\n    def field_specifier(self):\n        \"\"\"\n        The field-specifier of record-valued keyword cards; always `None` on\n        normal cards.\n        \"\"\"\n\n        # Ensure that the keyword exists and has been parsed--the will set the\n        # internal _field_specifier attribute if this is a RVKC.\n        if self.keyword:\n            return self._field_specifier\n        else:\n            return None\n\n    @field_specifier.setter\n    def field_specifier(self, field_specifier):\n        if not field_specifier:\n            raise ValueError('The field-specifier may not be blank in '\n                             'record-valued keyword cards.')\n        elif not self.field_specifier:\n            raise AttributeError('Cannot coerce cards to be record-valued '\n                                 'keyword cards by setting the '\n                                 'field_specifier attribute')\n        elif field_specifier != self.field_specifier:\n            self._field_specifier = field_specifier\n            # The keyword need also be updated\n            keyword = self._keyword.split('.', 1)[0]\n            self._keyword = '.'.join([keyword, field_specifier])\n            self._modified = True\n\n    @field_specifier.deleter\n    def field_specifier(self):\n        raise AttributeError('The field_specifier attribute may not be '\n                             'deleted from record-valued keyword cards.')\n\n    @property\n    def image(self):\n        \"\"\"\n        The card \"image\", that is, the 80 byte character string that represents\n        this card in an actual FITS header.\n        \"\"\"\n\n        if self._image and not self._verified:\n            self.verify('fix+warn')\n        if self._image is None or self._modified:\n            self._image = self._format_image()\n        return self._image\n\n    @property\n    def is_blank(self):\n        \"\"\"\n        `True` if the card is completely blank--that is, it has no keyword,\n        value, or comment.  It appears in the header as 80 spaces.\n\n        Returns `False` otherwise.\n        \"\"\"\n\n        if not self._verified:\n            # The card image has not been parsed yet; compare directly with the\n            # string representation of a blank card\n            return self._image == BLANK_CARD\n\n        # If the keyword, value, and comment are all empty (for self.value\n        # explicitly check that it is a string value, since a blank value is\n        # returned as '')\n        return (not self.keyword and\n                (isinstance(self.value, str) and not self.value) and\n                not self.comment)\n\n    @classmethod\n    def fromstring(cls, image):\n        \"\"\"\n        Construct a `Card` object from a (raw) string. It will pad the string\n        if it is not the length of a card image (80 columns).  If the card\n        image is longer than 80 columns, assume it contains ``CONTINUE``\n        card(s).\n        \"\"\"\n\n        card = cls()\n        if isinstance(image, bytes):\n            # FITS supports only ASCII, but decode as latin1 and just take all\n            # bytes for now; if it results in mojibake due to e.g. UTF-8\n            # encoded data in a FITS header that's OK because it shouldn't be\n            # there in the first place\n            image = image.decode('latin1')\n\n        card._image = _pad(image)\n        card._verified = False\n        return card\n\n    @classmethod\n    def normalize_keyword(cls, keyword):\n        \"\"\"\n        `classmethod` to convert a keyword value that may contain a\n        field-specifier to uppercase.  The effect is to raise the key to\n        uppercase and leave the field specifier in its original case.\n\n        Parameters\n        ----------\n        keyword : or str\n            A keyword value or a ``keyword.field-specifier`` value\n        \"\"\"\n\n        # Test first for the most common case: a standard FITS keyword provided\n        # in standard all-caps\n        if (len(keyword) <= KEYWORD_LENGTH and\n                cls._keywd_FSC_RE.match(keyword)):\n            return keyword\n\n        # Test if this is a record-valued keyword\n        match = cls._rvkc_keyword_name_RE.match(keyword)\n\n        if match:\n            return '.'.join((match.group('keyword').strip().upper(),\n                             match.group('field_specifier')))\n        elif len(keyword) > 9 and keyword[:9].upper() == 'HIERARCH ':\n            # Remove 'HIERARCH' from HIERARCH keywords; this could lead to\n            # ambiguity if there is actually a keyword card containing\n            # \"HIERARCH HIERARCH\", but shame on you if you do that.\n            return keyword[9:].strip().upper()\n        else:\n            # A normal FITS keyword, but provided in non-standard case\n            return keyword.strip().upper()\n\n    def _check_if_rvkc(self, *args):\n        \"\"\"\n        Determine whether or not the card is a record-valued keyword card.\n\n        If one argument is given, that argument is treated as a full card image\n        and parsed as such.  If two arguments are given, the first is treated\n        as the card keyword (including the field-specifier if the card is\n        intended as a RVKC), and the second as the card value OR the first value\n        can be the base keyword, and the second value the 'field-specifier:\n        value' string.\n\n        If the check passes the ._keyword, ._value, and .field_specifier\n        keywords are set.\n\n        Examples\n        --------\n        ::\n\n            self._check_if_rvkc('DP1', 'AXIS.1: 2')\n            self._check_if_rvkc('DP1.AXIS.1', 2)\n            self._check_if_rvkc('DP1     = AXIS.1: 2')\n        \"\"\"\n\n        if not conf.enable_record_valued_keyword_cards:\n            return False\n\n        if len(args) == 1:\n            return self._check_if_rvkc_image(*args)\n        elif len(args) == 2:\n            keyword, value = args\n            if not isinstance(keyword, str):\n                return False\n            if keyword in self._commentary_keywords:\n                return False\n            match = self._rvkc_keyword_name_RE.match(keyword)\n            if match and isinstance(value, (int, float)):\n                self._init_rvkc(match.group('keyword'),\n                                match.group('field_specifier'), None, value)\n                return True\n\n            # Testing for ': ' is a quick way to avoid running the full regular\n            # expression, speeding this up for the majority of cases\n            if isinstance(value, str) and value.find(': ') > 0:\n                match = self._rvkc_field_specifier_val_RE.match(value)\n                if match and self._keywd_FSC_RE.match(keyword):\n                    self._init_rvkc(keyword, match.group('keyword'), value,\n                                    match.group('val'))\n                    return True\n\n    def _check_if_rvkc_image(self, *args):\n        \"\"\"\n        Implements `Card._check_if_rvkc` for the case of an unparsed card\n        image.  If given one argument this is the full intact image.  If given\n        two arguments the card has already been split between keyword and\n        value+comment at the standard value indicator '= '.\n        \"\"\"\n\n        if len(args) == 1:\n            image = args[0]\n            eq_idx = image.find(VALUE_INDICATOR)\n            if eq_idx < 0 or eq_idx > 9:\n                return False\n            keyword = image[:eq_idx]\n            rest = image[eq_idx + VALUE_INDICATOR_LEN:]\n        else:\n            keyword, rest = args\n\n        rest = rest.lstrip()\n\n        # This test allows us to skip running the full regular expression for\n        # the majority of cards that do not contain strings or that definitely\n        # do not contain RVKC field-specifiers; it's very much a\n        # micro-optimization but it does make a measurable difference\n        if not rest or rest[0] != \"'\" or rest.find(': ') < 2:\n            return False\n\n        match = self._rvkc_keyword_val_comm_RE.match(rest)\n        if match:\n            self._init_rvkc(keyword, match.group('keyword'),\n                            match.group('rawval'), match.group('val'))\n            return True\n\n    def _init_rvkc(self, keyword, field_specifier, field, value):\n        \"\"\"\n        Sort of addendum to Card.__init__ to set the appropriate internal\n        attributes if the card was determined to be a RVKC.\n        \"\"\"\n\n        keyword_upper = keyword.upper()\n        self._keyword = '.'.join((keyword_upper, field_specifier))\n        self._rawkeyword = keyword_upper\n        self._field_specifier = field_specifier\n        self._value = _int_or_float(value)\n        self._rawvalue = field\n\n    def _parse_keyword(self):\n        keyword = self._image[:KEYWORD_LENGTH].strip()\n        keyword_upper = keyword.upper()\n\n        if keyword_upper in self._special_keywords:\n            return keyword_upper\n        elif (keyword_upper == 'HIERARCH' and self._image[8] == ' ' and\n              HIERARCH_VALUE_INDICATOR in self._image):\n            # This is valid HIERARCH card as described by the HIERARCH keyword\n            # convention:\n            # http://fits.gsfc.nasa.gov/registry/hierarch_keyword.html\n            self._hierarch = True\n            self._value_indicator = HIERARCH_VALUE_INDICATOR\n            keyword = self._image.split(HIERARCH_VALUE_INDICATOR, 1)[0][9:]\n            return keyword.strip()\n        else:\n            val_ind_idx = self._image.find(VALUE_INDICATOR)\n            if 0 <= val_ind_idx <= KEYWORD_LENGTH:\n                # The value indicator should appear in byte 8, but we are\n                # flexible and allow this to be fixed\n                if val_ind_idx < KEYWORD_LENGTH:\n                    keyword = keyword[:val_ind_idx]\n                    keyword_upper = keyword_upper[:val_ind_idx]\n\n                rest = self._image[val_ind_idx + VALUE_INDICATOR_LEN:]\n\n                # So far this looks like a standard FITS keyword; check whether\n                # the value represents a RVKC; if so then we pass things off to\n                # the RVKC parser\n                if self._check_if_rvkc_image(keyword, rest):\n                    return self._keyword\n\n                return keyword_upper\n            else:\n                warnings.warn(\n                    'The following header keyword is invalid or follows an '\n                    'unrecognized non-standard convention:\\n{}'\n                    .format(self._image), AstropyUserWarning)\n                self._invalid = True\n                return keyword\n\n    def _parse_value(self):\n        \"\"\"Extract the keyword value from the card image.\"\"\"\n\n        # for commentary cards, no need to parse further\n        # Likewise for invalid cards\n        if self.keyword.upper() in self._commentary_keywords or self._invalid:\n            return self._image[KEYWORD_LENGTH:].rstrip()\n\n        if self._check_if_rvkc(self._image):\n            return self._value\n\n        m = self._value_NFSC_RE.match(self._split()[1])\n\n        if m is None:\n            raise VerifyError(\"Unparsable card ({}), fix it first with \"\n                              \".verify('fix').\".format(self.keyword))\n\n        if m.group('bool') is not None:\n            value = m.group('bool') == 'T'\n        elif m.group('strg') is not None:\n            value = re.sub(\"''\", \"'\", m.group('strg'))\n        elif m.group('numr') is not None:\n            #  Check for numbers with leading 0s.\n            numr = self._number_NFSC_RE.match(m.group('numr'))\n            digt = translate(numr.group('digt'), FIX_FP_TABLE2, ' ')\n            if numr.group('sign') is None:\n                sign = ''\n            else:\n                sign = numr.group('sign')\n            value = _str_to_num(sign + digt)\n\n        elif m.group('cplx') is not None:\n            #  Check for numbers with leading 0s.\n            real = self._number_NFSC_RE.match(m.group('real'))\n            rdigt = translate(real.group('digt'), FIX_FP_TABLE2, ' ')\n            if real.group('sign') is None:\n                rsign = ''\n            else:\n                rsign = real.group('sign')\n            value = _str_to_num(rsign + rdigt)\n            imag = self._number_NFSC_RE.match(m.group('imag'))\n            idigt = translate(imag.group('digt'), FIX_FP_TABLE2, ' ')\n            if imag.group('sign') is None:\n                isign = ''\n            else:\n                isign = imag.group('sign')\n            value += _str_to_num(isign + idigt) * 1j\n        else:\n            value = UNDEFINED\n\n        if not self._valuestring:\n            self._valuestring = m.group('valu')\n        return value\n\n    def _parse_comment(self):\n        \"\"\"Extract the keyword value from the card image.\"\"\"\n\n        # for commentary cards, no need to parse further\n        # likewise for invalid/unparsable cards\n        if self.keyword in Card._commentary_keywords or self._invalid:\n            return ''\n\n        valuecomment = self._split()[1]\n        m = self._value_NFSC_RE.match(valuecomment)\n        comment = ''\n        if m is not None:\n            # Don't combine this if statement with the one above, because\n            # we only want the elif case to run if this was not a valid\n            # card at all\n            if m.group('comm'):\n                comment = m.group('comm').rstrip()\n        elif '/' in valuecomment:\n            # The value in this FITS file was not in a valid/known format.  In\n            # this case the best we can do is guess that everything after the\n            # first / was meant to be the comment\n            comment = valuecomment.split('/', 1)[1].strip()\n\n        return comment\n\n    def _split(self):\n        \"\"\"\n        Split the card image between the keyword and the rest of the card.\n        \"\"\"\n\n        if self._image is not None:\n            # If we already have a card image, don't try to rebuild a new card\n            # image, which self.image would do\n            image = self._image\n        else:\n            image = self.image\n\n        # Split cards with CONTINUE cards or commentary keywords with long\n        # values\n        if len(self._image) > self.length:\n            values = []\n            comments = []\n            keyword = None\n            for card in self._itersubcards():\n                kw, vc = card._split()\n                if keyword is None:\n                    keyword = kw\n\n                if keyword in self._commentary_keywords:\n                    values.append(vc)\n                    continue\n\n                # Should match a string followed by a comment; if not it\n                # might be an invalid Card, so we just take it verbatim\n                m = self._strg_comment_RE.match(vc)\n                if not m:\n                    return kw, vc\n\n                value = m.group('strg') or ''\n                value = value.rstrip().replace(\"''\", \"'\")\n                if value and value[-1] == '&':\n                    value = value[:-1]\n                values.append(value)\n                comment = m.group('comm')\n                if comment:\n                    comments.append(comment.rstrip())\n\n            if keyword in self._commentary_keywords:\n                valuecomment = ''.join(values)\n            else:\n                # CONTINUE card\n                valuecomment = f\"'{''.join(values)}' / {' '.join(comments)}\"\n            return keyword, valuecomment\n\n        if self.keyword in self._special_keywords:\n            keyword, valuecomment = image.split(' ', 1)\n        else:\n            try:\n                delim_index = image.index(self._value_indicator)\n            except ValueError:\n                delim_index = None\n\n            # The equal sign may not be any higher than column 10; anything\n            # past that must be considered part of the card value\n            if delim_index is None:\n                keyword = image[:KEYWORD_LENGTH]\n                valuecomment = image[KEYWORD_LENGTH:]\n            elif delim_index > 10 and image[:9] != 'HIERARCH ':\n                keyword = image[:8]\n                valuecomment = image[8:]\n            else:\n                keyword, valuecomment = image.split(self._value_indicator, 1)\n        return keyword.strip(), valuecomment.strip()\n\n    def _fix_keyword(self):\n        if self.field_specifier:\n            keyword, field_specifier = self._keyword.split('.', 1)\n            self._keyword = '.'.join([keyword.upper(), field_specifier])\n        else:\n            self._keyword = self._keyword.upper()\n        self._modified = True\n\n    def _fix_value(self):\n        \"\"\"Fix the card image for fixable non-standard compliance.\"\"\"\n\n        value = None\n        keyword, valuecomment = self._split()\n        m = self._value_NFSC_RE.match(valuecomment)\n\n        # for the unparsable case\n        if m is None:\n            try:\n                value, comment = valuecomment.split('/', 1)\n                self.value = value.strip()\n                self.comment = comment.strip()\n            except (ValueError, IndexError):\n                self.value = valuecomment\n            self._valuestring = self._value\n            return\n        elif m.group('numr') is not None:\n            numr = self._number_NFSC_RE.match(m.group('numr'))\n            value = translate(numr.group('digt'), FIX_FP_TABLE, ' ')\n            if numr.group('sign') is not None:\n                value = numr.group('sign') + value\n\n        elif m.group('cplx') is not None:\n            real = self._number_NFSC_RE.match(m.group('real'))\n            rdigt = translate(real.group('digt'), FIX_FP_TABLE, ' ')\n            if real.group('sign') is not None:\n                rdigt = real.group('sign') + rdigt\n\n            imag = self._number_NFSC_RE.match(m.group('imag'))\n            idigt = translate(imag.group('digt'), FIX_FP_TABLE, ' ')\n            if imag.group('sign') is not None:\n                idigt = imag.group('sign') + idigt\n            value = f'({rdigt}, {idigt})'\n        self._valuestring = value\n        # The value itself has not been modified, but its serialized\n        # representation (as stored in self._valuestring) has been changed, so\n        # still set this card as having been modified (see ticket #137)\n        self._modified = True\n\n    def _format_keyword(self):\n        if self.keyword:\n            if self.field_specifier:\n                return '{:{len}}'.format(self.keyword.split('.', 1)[0],\n                                         len=KEYWORD_LENGTH)\n            elif self._hierarch:\n                return f'HIERARCH {self.keyword} '\n            else:\n                return '{:{len}}'.format(self.keyword, len=KEYWORD_LENGTH)\n        else:\n            return ' ' * KEYWORD_LENGTH\n\n    def _format_value(self):\n        # value string\n        float_types = (float, np.floating, complex, np.complexfloating)\n\n        # Force the value to be parsed out first\n        value = self.value\n        # But work with the underlying raw value instead (to preserve\n        # whitespace, for now...)\n        value = self._value\n\n        if self.keyword in self._commentary_keywords:\n            # The value of a commentary card must be just a raw unprocessed\n            # string\n            value = str(value)\n        elif (self._valuestring and not self._valuemodified and\n              isinstance(self.value, float_types)):\n            # Keep the existing formatting for float/complex numbers\n            value = f'{self._valuestring:>20}'\n        elif self.field_specifier:\n            value = _format_value(self._value).strip()\n            value = f\"'{self.field_specifier}: {value}'\"\n        else:\n            value = _format_value(value)\n\n        # For HIERARCH cards the value should be shortened to conserve space\n        if not self.field_specifier and len(self.keyword) > KEYWORD_LENGTH:\n            value = value.strip()\n\n        return value\n\n    def _format_comment(self):\n        if not self.comment:\n            return ''\n        else:\n            return f' / {self._comment}'\n\n    def _format_image(self):\n        keyword = self._format_keyword()\n\n        value = self._format_value()\n        is_commentary = keyword.strip() in self._commentary_keywords\n        if is_commentary:\n            comment = ''\n        else:\n            comment = self._format_comment()\n\n        # equal sign string\n        # by default use the standard value indicator even for HIERARCH cards;\n        # later we may abbreviate it if necessary\n        delimiter = VALUE_INDICATOR\n        if is_commentary:\n            delimiter = ''\n\n        # put all parts together\n        output = ''.join([keyword, delimiter, value, comment])\n\n        # For HIERARCH cards we can save a bit of space if necessary by\n        # removing the space between the keyword and the equals sign; I'm\n        # guessing this is part of the HIEARCH card specification\n        keywordvalue_length = len(keyword) + len(delimiter) + len(value)\n        if (keywordvalue_length > self.length and\n                keyword.startswith('HIERARCH')):\n            if (keywordvalue_length == self.length + 1 and keyword[-1] == ' '):\n                output = ''.join([keyword[:-1], delimiter, value, comment])\n            else:\n                # I guess the HIERARCH card spec is incompatible with CONTINUE\n                # cards\n                raise ValueError('The header keyword {!r} with its value is '\n                                 'too long'.format(self.keyword))\n\n        if len(output) <= self.length:\n            output = f'{output:80}'\n        else:\n            # longstring case (CONTINUE card)\n            # try not to use CONTINUE if the string value can fit in one line.\n            # Instead, just truncate the comment\n            if (isinstance(self.value, str) and\n                    len(value) > (self.length - 10)):\n                output = self._format_long_image()\n            else:\n                warnings.warn('Card is too long, comment will be truncated.',\n                              VerifyWarning)\n                output = output[:Card.length]\n        return output\n\n    def _format_long_image(self):\n        \"\"\"\n        Break up long string value/comment into ``CONTINUE`` cards.\n        This is a primitive implementation: it will put the value\n        string in one block and the comment string in another.  Also,\n        it does not break at the blank space between words.  So it may\n        not look pretty.\n        \"\"\"\n\n        if self.keyword in Card._commentary_keywords:\n            return self._format_long_commentary_image()\n\n        value_length = 67\n        comment_length = 64\n        output = []\n\n        # do the value string\n        value = self._value.replace(\"'\", \"''\")\n        words = _words_group(value, value_length)\n        for idx, word in enumerate(words):\n            if idx == 0:\n                headstr = '{:{len}}= '.format(self.keyword, len=KEYWORD_LENGTH)\n            else:\n                headstr = 'CONTINUE  '\n\n            # If this is the final CONTINUE remove the '&'\n            if not self.comment and idx == len(words) - 1:\n                value_format = \"'{}'\"\n            else:\n                value_format = \"'{}&'\"\n\n            value = value_format.format(word)\n\n            output.append(f'{headstr + value:80}')\n\n        # do the comment string\n        comment_format = \"{}\"\n\n        if self.comment:\n            words = _words_group(self.comment, comment_length)\n            for idx, word in enumerate(words):\n                # If this is the final CONTINUE remove the '&'\n                if idx == len(words) - 1:\n                    headstr = \"CONTINUE  '' / \"\n                else:\n                    headstr = \"CONTINUE  '&' / \"\n\n                comment = headstr + comment_format.format(word)\n                output.append(f'{comment:80}')\n\n        return ''.join(output)\n\n    def _format_long_commentary_image(self):\n        \"\"\"\n        If a commentary card's value is too long to fit on a single card, this\n        will render the card as multiple consecutive commentary card of the\n        same type.\n        \"\"\"\n\n        maxlen = Card.length - KEYWORD_LENGTH\n        value = self._format_value()\n        output = []\n        idx = 0\n        while idx < len(value):\n            output.append(str(Card(self.keyword, value[idx:idx + maxlen])))\n            idx += maxlen\n        return ''.join(output)\n\n    def _verify(self, option='warn'):\n        errs = []\n        fix_text = f'Fixed {self.keyword!r} card to meet the FITS standard.'\n\n        # Don't try to verify cards that already don't meet any recognizable\n        # standard\n        if self._invalid:\n            return _ErrList(errs)\n\n        # verify the equal sign position\n        if (self.keyword not in self._commentary_keywords and\n            (self._image and self._image[:9].upper() != 'HIERARCH ' and\n             self._image.find('=') != 8)):\n            errs.append(dict(\n                err_text='Card {!r} is not FITS standard (equal sign not '\n                         'at column 8).'.format(self.keyword),\n                fix_text=fix_text,\n                fix=self._fix_value))\n\n        # verify the key, it is never fixable\n        # always fix silently the case where \"=\" is before column 9,\n        # since there is no way to communicate back to the _keys.\n        if ((self._image and self._image[:8].upper() == 'HIERARCH') or\n                self._hierarch):\n            pass\n        else:\n            if self._image:\n                # PyFITS will auto-uppercase any standard keyword, so lowercase\n                # keywords can only occur if they came from the wild\n                keyword = self._split()[0]\n                if keyword != keyword.upper():\n                    # Keyword should be uppercase unless it's a HIERARCH card\n                    errs.append(dict(\n                        err_text=f'Card keyword {keyword!r} is not upper case.',\n                        fix_text=fix_text,\n                        fix=self._fix_keyword))\n\n            keyword = self.keyword\n            if self.field_specifier:\n                keyword = keyword.split('.', 1)[0]\n\n            if not self._keywd_FSC_RE.match(keyword):\n                errs.append(dict(\n                    err_text=f'Illegal keyword name {keyword!r}',\n                    fixable=False))\n\n        # verify the value, it may be fixable\n        keyword, valuecomment = self._split()\n        if self.keyword in self._commentary_keywords:\n            # For commentary keywords all that needs to be ensured is that it\n            # contains only printable ASCII characters\n            if not self._ascii_text_re.match(valuecomment):\n                errs.append(dict(\n                    err_text='Unprintable string {!r}; commentary cards may '\n                             'only contain printable ASCII characters'.format(\n                             valuecomment),\n                    fixable=False))\n        else:\n            if not self._valuemodified:\n                m = self._value_FSC_RE.match(valuecomment)\n                # If the value of a card was replaced before the card was ever\n                # even verified, the new value can be considered valid, so we\n                # don't bother verifying the old value.  See\n                # https://github.com/astropy/astropy/issues/5408\n                if m is None:\n                    errs.append(dict(\n                        err_text=f'Card {self.keyword!r} is not FITS standard '\n                                 f'(invalid value string: {valuecomment!r}).',\n                        fix_text=fix_text,\n                        fix=self._fix_value))\n\n        # verify the comment (string), it is never fixable\n        m = self._value_NFSC_RE.match(valuecomment)\n        if m is not None:\n            comment = m.group('comm')\n            if comment is not None:\n                if not self._ascii_text_re.match(comment):\n                    errs.append(dict(\n                        err_text=f'Unprintable string {comment!r}; header '\n                                  'comments may only contain printable '\n                                  'ASCII characters',\n                        fixable=False))\n\n        errs = _ErrList([self.run_option(option, **err) for err in errs])\n        self._verified = True\n        return errs\n\n    def _itersubcards(self):\n        \"\"\"\n        If the card image is greater than 80 characters, it should consist of a\n        normal card followed by one or more CONTINUE card.  This method returns\n        the subcards that make up this logical card.\n\n        This can also support the case where a HISTORY or COMMENT card has a\n        long value that is stored internally as multiple concatenated card\n        images.\n        \"\"\"\n\n        ncards = len(self._image) // Card.length\n\n        for idx in range(0, Card.length * ncards, Card.length):\n            card = Card.fromstring(self._image[idx:idx + Card.length])\n            if idx > 0 and card.keyword.upper() not in self._special_keywords:\n                raise VerifyError(\n                        'Long card images must have CONTINUE cards after '\n                        'the first card or have commentary keywords like '\n                        'HISTORY or COMMENT.')\n\n            if not isinstance(card.value, str):\n                raise VerifyError('CONTINUE cards must have string values.')\n\n            yield card"},{"col":4,"comment":"null","endLoc":203,"header":"def __repr__(self)","id":1064,"name":"__repr__","nodeType":"Function","startLoc":202,"text":"def __repr__(self):\n        return repr((self.keyword, self.value, self.comment))"},{"col":4,"comment":"null","endLoc":206,"header":"def __str__(self)","id":1065,"name":"__str__","nodeType":"Function","startLoc":205,"text":"def __str__(self):\n        return self.image"},{"col":4,"comment":"null","endLoc":209,"header":"def __len__(self)","id":1066,"name":"__len__","nodeType":"Function","startLoc":208,"text":"def __len__(self):\n        return 3"},{"col":4,"comment":"null","endLoc":212,"header":"def __getitem__(self, index)","id":1067,"name":"__getitem__","nodeType":"Function","startLoc":211,"text":"def __getitem__(self, index):\n        return (self.keyword, self.value, self.comment)[index]"},{"col":4,"comment":"Returns the keyword name parsed from the card image.","endLoc":224,"header":"@property\n    def keyword(self)","id":1068,"name":"keyword","nodeType":"Function","startLoc":214,"text":"@property\n    def keyword(self):\n        \"\"\"Returns the keyword name parsed from the card image.\"\"\"\n        if self._keyword is not None:\n            return self._keyword\n        elif self._image:\n            self._keyword = self._parse_keyword()\n            return self._keyword\n        else:\n            self.keyword = ''\n            return ''"},{"col":0,"comment":"null","endLoc":57,"header":"def _check_ellipsoid(ellipsoid=None, default='WGS84')","id":1069,"name":"_check_ellipsoid","nodeType":"Function","startLoc":52,"text":"def _check_ellipsoid(ellipsoid=None, default='WGS84'):\n    if ellipsoid is None:\n        ellipsoid = default\n    if ellipsoid not in ELLIPSOIDS:\n        raise ValueError(f'Ellipsoid {ellipsoid} not among known ones ({ELLIPSOIDS})')\n    return ellipsoid"},{"col":4,"comment":"\n        Delete (the definition of) one `Column`.\n\n        col_name : str or int\n            The column's name or index\n        ","endLoc":1776,"header":"def del_col(self, col_name)","id":1070,"name":"del_col","nodeType":"Function","startLoc":1745,"text":"def del_col(self, col_name):\n        \"\"\"\n        Delete (the definition of) one `Column`.\n\n        col_name : str or int\n            The column's name or index\n        \"\"\"\n\n        # Ask the HDU object to load the data before we modify our columns\n        self._notify('load_data')\n\n        indx = _get_index(self.names, col_name)\n        col = self.columns[indx]\n\n        del self._arrays[indx]\n        # Obliterate caches of certain things\n        del self.dtype\n        del self._recformats\n        del self._dims\n        del self.names\n        del self.formats\n\n        del self.columns[indx]\n\n        col._remove_listener(self)\n\n        # If this ColDefs is being tracked by a table HDU, inform the HDU (or\n        # any other listeners) that the column has been removed\n        # Just send a reference to self, and the index of the column that was\n        # removed\n        self._notify('column_removed', self, indx)\n        return self"},{"col":4,"comment":"null","endLoc":718,"header":"def _parse_keyword(self)","id":1071,"name":"_parse_keyword","nodeType":"Function","startLoc":679,"text":"def _parse_keyword(self):\n        keyword = self._image[:KEYWORD_LENGTH].strip()\n        keyword_upper = keyword.upper()\n\n        if keyword_upper in self._special_keywords:\n            return keyword_upper\n        elif (keyword_upper == 'HIERARCH' and self._image[8] == ' ' and\n              HIERARCH_VALUE_INDICATOR in self._image):\n            # This is valid HIERARCH card as described by the HIERARCH keyword\n            # convention:\n            # http://fits.gsfc.nasa.gov/registry/hierarch_keyword.html\n            self._hierarch = True\n            self._value_indicator = HIERARCH_VALUE_INDICATOR\n            keyword = self._image.split(HIERARCH_VALUE_INDICATOR, 1)[0][9:]\n            return keyword.strip()\n        else:\n            val_ind_idx = self._image.find(VALUE_INDICATOR)\n            if 0 <= val_ind_idx <= KEYWORD_LENGTH:\n                # The value indicator should appear in byte 8, but we are\n                # flexible and allow this to be fixed\n                if val_ind_idx < KEYWORD_LENGTH:\n                    keyword = keyword[:val_ind_idx]\n                    keyword_upper = keyword_upper[:val_ind_idx]\n\n                rest = self._image[val_ind_idx + VALUE_INDICATOR_LEN:]\n\n                # So far this looks like a standard FITS keyword; check whether\n                # the value represents a RVKC; if so then we pass things off to\n                # the RVKC parser\n                if self._check_if_rvkc_image(keyword, rest):\n                    return self._keyword\n\n                return keyword_upper\n            else:\n                warnings.warn(\n                    'The following header keyword is invalid or follows an '\n                    'unrecognized non-standard convention:\\n{}'\n                    .format(self._image), AstropyUserWarning)\n                self._invalid = True\n                return keyword"},{"col":4,"comment":"null","endLoc":265,"header":"def __delitem__(self, key)","id":1072,"name":"__delitem__","nodeType":"Function","startLoc":209,"text":"def __delitem__(self, key):\n        if isinstance(key, slice) or self._haswildcard(key):\n            # This is very inefficient but it's not a commonly used feature.\n            # If someone out there complains that they make heavy use of slice\n            # deletions and it's too slow, well, we can worry about it then\n            # [the solution is not too complicated--it would be wait 'til all\n            # the cards are deleted before updating _keyword_indices rather\n            # than updating it once for each card that gets deleted]\n            if isinstance(key, slice):\n                indices = range(*key.indices(len(self)))\n                # If the slice step is backwards we want to reverse it, because\n                # it will be reversed in a few lines...\n                if key.step and key.step < 0:\n                    indices = reversed(indices)\n            else:\n                indices = self._wildcardmatch(key)\n            for idx in reversed(indices):\n                del self[idx]\n            return\n        elif isinstance(key, str):\n            # delete ALL cards with the same keyword name\n            key = Card.normalize_keyword(key)\n            indices = self._keyword_indices\n            if key not in self._keyword_indices:\n                indices = self._rvkc_indices\n\n            if key not in indices:\n                # if keyword is not present raise KeyError.\n                # To delete keyword without caring if they were present,\n                # Header.remove(Keyword) can be used with optional argument ignore_missing as True\n                raise KeyError(f\"Keyword '{key}' not found.\")\n\n            for idx in reversed(indices[key]):\n                # Have to copy the indices list since it will be modified below\n                del self[idx]\n            return\n\n        idx = self._cardindex(key)\n        card = self._cards[idx]\n        keyword = card.keyword\n        del self._cards[idx]\n        keyword = Card.normalize_keyword(keyword)\n        indices = self._keyword_indices[keyword]\n        indices.remove(idx)\n        if not indices:\n            del self._keyword_indices[keyword]\n\n        # Also update RVKC indices if necessary :/\n        if card.field_specifier is not None:\n            indices = self._rvkc_indices[card.rawkeyword]\n            indices.remove(idx)\n            if not indices:\n                del self._rvkc_indices[card.rawkeyword]\n\n        # We also need to update all other indices\n        self._updateindices(idx, increment=False)\n        self._modified = True"},{"col":4,"comment":"null","endLoc":383,"header":"def tell(self)","id":1073,"name":"tell","nodeType":"Function","startLoc":378,"text":"def tell(self):\n        if self.simulateonly:\n            raise OSError\n        if not hasattr(self._file, 'tell'):\n            raise EOFError\n        return self._file.tell()"},{"col":4,"comment":"\n        Change an attribute (in the ``KEYWORD_ATTRIBUTES`` list) of a `Column`.\n\n        Parameters\n        ----------\n        col_name : str or int\n            The column name or index to change\n\n        attrib : str\n            The attribute name\n\n        new_value : object\n            The new value for the attribute\n        ","endLoc":1794,"header":"def change_attrib(self, col_name, attrib, new_value)","id":1074,"name":"change_attrib","nodeType":"Function","startLoc":1778,"text":"def change_attrib(self, col_name, attrib, new_value):\n        \"\"\"\n        Change an attribute (in the ``KEYWORD_ATTRIBUTES`` list) of a `Column`.\n\n        Parameters\n        ----------\n        col_name : str or int\n            The column name or index to change\n\n        attrib : str\n            The attribute name\n\n        new_value : object\n            The new value for the attribute\n        \"\"\"\n\n        setattr(self[col_name], attrib, new_value)"},{"col":4,"comment":"\n        Change a `Column`'s name.\n\n        Parameters\n        ----------\n        col_name : str\n            The current name of the column\n\n        new_name : str\n            The new name of the column\n        ","endLoc":1812,"header":"def change_name(self, col_name, new_name)","id":1075,"name":"change_name","nodeType":"Function","startLoc":1796,"text":"def change_name(self, col_name, new_name):\n        \"\"\"\n        Change a `Column`'s name.\n\n        Parameters\n        ----------\n        col_name : str\n            The current name of the column\n\n        new_name : str\n            The new name of the column\n        \"\"\"\n\n        if new_name != col_name and new_name in self.names:\n            raise ValueError(f'New name {new_name} already exists.')\n        else:\n            self.change_attrib(col_name, 'name', new_name)"},{"col":0,"comment":"\n    Retrieves the contents of a filename or file-like object.\n\n    See  the `get_readable_fileobj` docstring for details on parameters.\n\n    Returns\n    -------\n    object\n        The content of the file (as requested by ``encoding``).\n    ","endLoc":417,"header":"def get_file_contents(*args, **kwargs)","id":1076,"name":"get_file_contents","nodeType":"Function","startLoc":405,"text":"def get_file_contents(*args, **kwargs):\n    \"\"\"\n    Retrieves the contents of a filename or file-like object.\n\n    See  the `get_readable_fileobj` docstring for details on parameters.\n\n    Returns\n    -------\n    object\n        The content of the file (as requested by ``encoding``).\n    \"\"\"\n    with get_readable_fileobj(*args, **kwargs) as f:\n        return f.read()"},{"col":4,"comment":"\n        Change a `Column`'s unit.\n\n        Parameters\n        ----------\n        col_name : str or int\n            The column name or index\n\n        new_unit : str\n            The new unit for the column\n        ","endLoc":1827,"header":"def change_unit(self, col_name, new_unit)","id":1077,"name":"change_unit","nodeType":"Function","startLoc":1814,"text":"def change_unit(self, col_name, new_unit):\n        \"\"\"\n        Change a `Column`'s unit.\n\n        Parameters\n        ----------\n        col_name : str or int\n            The column name or index\n\n        new_unit : str\n            The new unit for the column\n        \"\"\"\n\n        self.change_attrib(col_name, 'unit', new_unit)"},{"col":4,"comment":"\n        Get attribute(s) information of the column definition.\n\n        Parameters\n        ----------\n        attrib : str\n            Can be one or more of the attributes listed in\n            ``astropy.io.fits.column.KEYWORD_ATTRIBUTES``.  The default is\n            ``\"all\"`` which will print out all attributes.  It forgives plurals\n            and blanks.  If there are two or more attribute names, they must be\n            separated by comma(s).\n\n        output : file-like, optional\n            File-like object to output to.  Outputs to stdout by default.\n            If `False`, returns the attributes as a `dict` instead.\n\n        Notes\n        -----\n        This function doesn't return anything by default; it just prints to\n        stdout.\n        ","endLoc":1878,"header":"def info(self, attrib='all', output=None)","id":1078,"name":"info","nodeType":"Function","startLoc":1829,"text":"def info(self, attrib='all', output=None):\n        \"\"\"\n        Get attribute(s) information of the column definition.\n\n        Parameters\n        ----------\n        attrib : str\n            Can be one or more of the attributes listed in\n            ``astropy.io.fits.column.KEYWORD_ATTRIBUTES``.  The default is\n            ``\"all\"`` which will print out all attributes.  It forgives plurals\n            and blanks.  If there are two or more attribute names, they must be\n            separated by comma(s).\n\n        output : file-like, optional\n            File-like object to output to.  Outputs to stdout by default.\n            If `False`, returns the attributes as a `dict` instead.\n\n        Notes\n        -----\n        This function doesn't return anything by default; it just prints to\n        stdout.\n        \"\"\"\n\n        if output is None:\n            output = sys.stdout\n\n        if attrib.strip().lower() in ['all', '']:\n            lst = KEYWORD_ATTRIBUTES\n        else:\n            lst = attrib.split(',')\n            for idx in range(len(lst)):\n                lst[idx] = lst[idx].strip().lower()\n                if lst[idx][-1] == 's':\n                    lst[idx] = list[idx][:-1]\n\n        ret = {}\n\n        for attr in lst:\n            if output:\n                if attr not in KEYWORD_ATTRIBUTES:\n                    output.write(\"'{}' is not an attribute of the column \"\n                                 \"definitions.\\n\".format(attr))\n                    continue\n                output.write(f\"{attr}:\\n\")\n                output.write(f\"    {getattr(self, attr + 's')}\\n\")\n            else:\n                ret[attr] = getattr(self, attr + 's')\n\n        if not output:\n            return ret"},{"col":4,"comment":"null","endLoc":139,"header":"def __new__(cls, angle, unit=None, dtype=None, copy=True, **kwargs)","id":1079,"name":"__new__","nodeType":"Function","startLoc":112,"text":"def __new__(cls, angle, unit=None, dtype=None, copy=True, **kwargs):\n\n        if not isinstance(angle, u.Quantity):\n            if unit is not None:\n                unit = cls._convert_unit_to_angle_unit(u.Unit(unit))\n\n            if isinstance(angle, tuple):\n                angle = cls._tuple_to_float(angle, unit)\n\n            elif isinstance(angle, str):\n                angle, angle_unit = form.parse_angle(angle, unit)\n                if angle_unit is None:\n                    angle_unit = unit\n\n                if isinstance(angle, tuple):\n                    angle = cls._tuple_to_float(angle, angle_unit)\n\n                if angle_unit is not unit:\n                    # Possible conversion to `unit` will be done below.\n                    angle = u.Quantity(angle, angle_unit, copy=False)\n\n            elif (isiterable(angle) and\n                  not (isinstance(angle, np.ndarray) and\n                       angle.dtype.kind not in 'SUVO')):\n                angle = [Angle(x, unit, copy=False) for x in angle]\n\n        return super().__new__(cls, angle, unit, dtype=dtype, copy=copy,\n                               **kwargs)"},{"col":4,"comment":"Set the key attribute; once set it cannot be modified.","endLoc":274,"header":"@keyword.setter\n    def keyword(self, keyword)","id":1080,"name":"keyword","nodeType":"Function","startLoc":226,"text":"@keyword.setter\n    def keyword(self, keyword):\n        \"\"\"Set the key attribute; once set it cannot be modified.\"\"\"\n        if self._keyword is not None:\n            raise AttributeError(\n                'Once set, the Card keyword may not be modified')\n        elif isinstance(keyword, str):\n            # Be nice and remove trailing whitespace--some FITS code always\n            # pads keywords out with spaces; leading whitespace, however,\n            # should be strictly disallowed.\n            keyword = keyword.rstrip()\n            keyword_upper = keyword.upper()\n            if (len(keyword) <= KEYWORD_LENGTH and\n                    self._keywd_FSC_RE.match(keyword_upper)):\n                # For keywords with length > 8 they will be HIERARCH cards,\n                # and can have arbitrary case keywords\n                if keyword_upper == 'END':\n                    raise ValueError(\"Keyword 'END' not allowed.\")\n                keyword = keyword_upper\n            elif self._keywd_hierarch_RE.match(keyword):\n                # In prior versions of PyFITS (*) HIERARCH cards would only be\n                # created if the user-supplied keyword explicitly started with\n                # 'HIERARCH '.  Now we will create them automatically for long\n                # keywords, but we still want to support the old behavior too;\n                # the old behavior makes it possible to create HIERARCH cards\n                # that would otherwise be recognized as RVKCs\n                # (*) This has never affected Astropy, because it was changed\n                # before PyFITS was merged into Astropy!\n                self._hierarch = True\n                self._value_indicator = HIERARCH_VALUE_INDICATOR\n\n                if keyword_upper[:9] == 'HIERARCH ':\n                    # The user explicitly asked for a HIERARCH card, so don't\n                    # bug them about it...\n                    keyword = keyword[9:].strip()\n                else:\n                    # We'll gladly create a HIERARCH card, but a warning is\n                    # also displayed\n                    warnings.warn(\n                        'Keyword name {!r} is greater than 8 characters or '\n                        'contains characters not allowed by the FITS '\n                        'standard; a HIERARCH card will be created.'.format(\n                            keyword), VerifyWarning)\n            else:\n                raise ValueError(f'Illegal keyword name: {keyword!r}.')\n            self._keyword = keyword\n            self._modified = True\n        else:\n            raise ValueError(f'Keyword name {keyword!r} is not a string.')"},{"col":4,"comment":"null","endLoc":268,"header":"def __repr__(self)","id":1081,"name":"__repr__","nodeType":"Function","startLoc":267,"text":"def __repr__(self):\n        return self.tostring(sep='\\n', endcard=False, padding=False)"},{"col":4,"comment":"null","endLoc":387,"header":"def truncate(self, size=None)","id":1082,"name":"truncate","nodeType":"Function","startLoc":385,"text":"def truncate(self, size=None):\n        if hasattr(self._file, 'truncate'):\n            self._file.truncate(size)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1356,"id":1083,"name":"_padding_byte","nodeType":"Attribute","startLoc":1356,"text":"_padding_byte"},{"col":4,"comment":"\n        Returns a string representation of the header.\n\n        By default this uses no separator between cards, adds the END card, and\n        pads the string with spaces to the next multiple of 2880 bytes.  That\n        is, it returns the header exactly as it would appear in a FITS file.\n\n        Parameters\n        ----------\n        sep : str, optional\n            The character or string with which to separate cards.  By default\n            there is no separator, but one could use ``'\\\\n'``, for example, to\n            separate each card with a new line\n\n        endcard : bool, optional\n            If True (default) adds the END card to the end of the header\n            string\n\n        padding : bool, optional\n            If True (default) pads the string with spaces out to the next\n            multiple of 2880 characters\n\n        Returns\n        -------\n        str\n            A string representing a FITS header.\n        ","endLoc":701,"header":"def tostring(self, sep='', endcard=True, padding=True)","id":1084,"name":"tostring","nodeType":"Function","startLoc":658,"text":"def tostring(self, sep='', endcard=True, padding=True):\n        r\"\"\"\n        Returns a string representation of the header.\n\n        By default this uses no separator between cards, adds the END card, and\n        pads the string with spaces to the next multiple of 2880 bytes.  That\n        is, it returns the header exactly as it would appear in a FITS file.\n\n        Parameters\n        ----------\n        sep : str, optional\n            The character or string with which to separate cards.  By default\n            there is no separator, but one could use ``'\\\\n'``, for example, to\n            separate each card with a new line\n\n        endcard : bool, optional\n            If True (default) adds the END card to the end of the header\n            string\n\n        padding : bool, optional\n            If True (default) pads the string with spaces out to the next\n            multiple of 2880 characters\n\n        Returns\n        -------\n        str\n            A string representing a FITS header.\n        \"\"\"\n\n        lines = []\n        for card in self._cards:\n            s = str(card)\n            # Cards with CONTINUE cards may be longer than 80 chars; so break\n            # them into multiple lines\n            while s:\n                lines.append(s[:Card.length])\n                s = s[Card.length:]\n\n        s = sep.join(lines)\n        if endcard:\n            s += sep + _pad('END')\n        if padding:\n            s += ' ' * _pad_length(len(s))\n        return s"},{"attributeType":"null","col":4,"comment":"null","endLoc":1357,"id":1085,"name":"_col_format_cls","nodeType":"Attribute","startLoc":1357,"text":"_col_format_cls"},{"attributeType":"null","col":12,"comment":"null","endLoc":1370,"id":1086,"name":"klass","nodeType":"Attribute","startLoc":1370,"text":"klass"},{"attributeType":"null","col":8,"comment":"null","endLoc":1423,"id":1087,"name":"columns","nodeType":"Attribute","startLoc":1423,"text":"self.columns"},{"className":"_AsciiColDefs","col":0,"comment":"ColDefs implementation for ASCII tables.","endLoc":1957,"id":1088,"nodeType":"Class","startLoc":1881,"text":"class _AsciiColDefs(ColDefs):\n    \"\"\"ColDefs implementation for ASCII tables.\"\"\"\n\n    _padding_byte = ' '\n    _col_format_cls = _AsciiColumnFormat\n\n    def __init__(self, input, ascii=True):\n        super().__init__(input)\n\n        # if the format of an ASCII column has no width, add one\n        if not isinstance(input, _AsciiColDefs):\n            self._update_field_metrics()\n        else:\n            for idx, s in enumerate(input.starts):\n                self.columns[idx].start = s\n\n            self._spans = input.spans\n            self._width = input._width\n\n    @lazyproperty\n    def dtype(self):\n        dtype = {}\n\n        for j in range(len(self)):\n            data_type = 'S' + str(self.spans[j])\n            dtype[self.names[j]] = (data_type, self.starts[j] - 1)\n\n        return np.dtype(dtype)\n\n    @property\n    def spans(self):\n        \"\"\"A list of the widths of each field in the table.\"\"\"\n\n        return self._spans\n\n    @lazyproperty\n    def _recformats(self):\n        if len(self) == 1:\n            widths = []\n        else:\n            widths = [y - x for x, y in pairwise(self.starts)]\n\n        # Widths is the width of each field *including* any space between\n        # fields; this is so that we can map the fields to string records in a\n        # Numpy recarray\n        widths.append(self._width - self.starts[-1] + 1)\n        return ['a' + str(w) for w in widths]\n\n    def add_col(self, column):\n        super().add_col(column)\n        self._update_field_metrics()\n\n    def del_col(self, col_name):\n        super().del_col(col_name)\n        self._update_field_metrics()\n\n    def _update_field_metrics(self):\n        \"\"\"\n        Updates the list of the start columns, the list of the widths of each\n        field, and the total width of each record in the table.\n        \"\"\"\n\n        spans = [0] * len(self.columns)\n        end_col = 0  # Refers to the ASCII text column, not the table col\n        for idx, col in enumerate(self.columns):\n            width = col.format.width\n\n            # Update the start columns and column span widths taking into\n            # account the case that the starting column of a field may not\n            # be the column immediately after the previous field\n            if not col.start:\n                col.start = end_col + 1\n            end_col = col.start + width - 1\n            spans[idx] = width\n\n        self._spans = spans\n        self._width = end_col"},{"col":4,"comment":"null","endLoc":1898,"header":"def __init__(self, input, ascii=True)","id":1089,"name":"__init__","nodeType":"Function","startLoc":1887,"text":"def __init__(self, input, ascii=True):\n        super().__init__(input)\n\n        # if the format of an ASCII column has no width, add one\n        if not isinstance(input, _AsciiColDefs):\n            self._update_field_metrics()\n        else:\n            for idx, s in enumerate(input.starts):\n                self.columns[idx].start = s\n\n            self._spans = input.spans\n            self._width = input._width"},{"col":4,"comment":"The value associated with the keyword stored in this card.","endLoc":296,"header":"@property\n    def value(self)","id":1090,"name":"value","nodeType":"Function","startLoc":276,"text":"@property\n    def value(self):\n        \"\"\"The value associated with the keyword stored in this card.\"\"\"\n\n        if self.field_specifier:\n            return float(self._value)\n\n        if self._value is not None:\n            value = self._value\n        elif self._valuestring is not None or self._image:\n            value = self._value = self._parse_value()\n        else:\n            if self._keyword == '':\n                self._value = value = ''\n            else:\n                self._value = value = UNDEFINED\n\n        if conf.strip_header_whitespace and isinstance(value, str):\n            value = value.rstrip()\n\n        return value"},{"col":4,"comment":"Tests that mmap, and specifically mmap.flush works.  This may\n        be the case on some uncommon platforms (see\n        https://github.com/astropy/astropy/issues/968).\n\n        If mmap.flush is found not to work, ``self.memmap = False`` is\n        set and a warning is issued.\n        ","endLoc":603,"header":"@classproperty(lazy=True)\n    def _mmap_available(cls)","id":1091,"name":"_mmap_available","nodeType":"Function","startLoc":568,"text":"@classproperty(lazy=True)\n    def _mmap_available(cls):\n        \"\"\"Tests that mmap, and specifically mmap.flush works.  This may\n        be the case on some uncommon platforms (see\n        https://github.com/astropy/astropy/issues/968).\n\n        If mmap.flush is found not to work, ``self.memmap = False`` is\n        set and a warning is issued.\n        \"\"\"\n\n        tmpfd, tmpname = tempfile.mkstemp()\n        try:\n            # Windows does not allow mappings on empty files\n            os.write(tmpfd, b' ')\n            os.fsync(tmpfd)\n            try:\n                mm = mmap.mmap(tmpfd, 1, access=mmap.ACCESS_WRITE)\n            except OSError as exc:\n                warnings.warn('Failed to create mmap: {}; mmap use will be '\n                              'disabled'.format(str(exc)), AstropyUserWarning)\n                del exc\n                return False\n            try:\n                mm.flush()\n            except OSError:\n                warnings.warn('mmap.flush is unavailable on this platform; '\n                              'using mmap in writeable mode will be disabled',\n                              AstropyUserWarning)\n                return False\n            finally:\n                mm.close()\n        finally:\n            os.close(tmpfd)\n            os.remove(tmpname)\n\n        return True"},{"col":4,"comment":"null","endLoc":157,"header":"@staticmethod\n    def _convert_unit_to_angle_unit(unit)","id":1092,"name":"_convert_unit_to_angle_unit","nodeType":"Function","startLoc":155,"text":"@staticmethod\n    def _convert_unit_to_angle_unit(unit):\n        return u.hourangle if unit is u.hour else unit"},{"col":4,"comment":"\n        Converts an angle represented as a 3-tuple or 2-tuple into a floating\n        point number in the given unit.\n        ","endLoc":153,"header":"@staticmethod\n    def _tuple_to_float(angle, unit)","id":1093,"name":"_tuple_to_float","nodeType":"Function","startLoc":141,"text":"@staticmethod\n    def _tuple_to_float(angle, unit):\n        \"\"\"\n        Converts an angle represented as a 3-tuple or 2-tuple into a floating\n        point number in the given unit.\n        \"\"\"\n        # TODO: Numpy array of tuples?\n        if unit == u.hourangle:\n            return form.hms_to_hours(*angle)\n        elif unit == u.degree:\n            return form.dms_to_degrees(*angle)\n        else:\n            raise u.UnitsError(f\"Can not parse '{angle}' as unit '{unit}'\")"},{"col":0,"comment":"Bytes needed to pad the input stringlen to the next FITS block.","endLoc":2250,"header":"def _pad_length(stringlen)","id":1094,"name":"_pad_length","nodeType":"Function","startLoc":2247,"text":"def _pad_length(stringlen):\n    \"\"\"Bytes needed to pad the input stringlen to the next FITS block.\"\"\"\n\n    return (BLOCK_SIZE - (stringlen % BLOCK_SIZE)) % BLOCK_SIZE"},{"col":4,"comment":"null","endLoc":271,"header":"def __str__(self)","id":1095,"name":"__str__","nodeType":"Function","startLoc":270,"text":"def __str__(self):\n        return self.tostring()"},{"col":4,"comment":"Extract the keyword value from the card image.","endLoc":772,"header":"def _parse_value(self)","id":1096,"name":"_parse_value","nodeType":"Function","startLoc":720,"text":"def _parse_value(self):\n        \"\"\"Extract the keyword value from the card image.\"\"\"\n\n        # for commentary cards, no need to parse further\n        # Likewise for invalid cards\n        if self.keyword.upper() in self._commentary_keywords or self._invalid:\n            return self._image[KEYWORD_LENGTH:].rstrip()\n\n        if self._check_if_rvkc(self._image):\n            return self._value\n\n        m = self._value_NFSC_RE.match(self._split()[1])\n\n        if m is None:\n            raise VerifyError(\"Unparsable card ({}), fix it first with \"\n                              \".verify('fix').\".format(self.keyword))\n\n        if m.group('bool') is not None:\n            value = m.group('bool') == 'T'\n        elif m.group('strg') is not None:\n            value = re.sub(\"''\", \"'\", m.group('strg'))\n        elif m.group('numr') is not None:\n            #  Check for numbers with leading 0s.\n            numr = self._number_NFSC_RE.match(m.group('numr'))\n            digt = translate(numr.group('digt'), FIX_FP_TABLE2, ' ')\n            if numr.group('sign') is None:\n                sign = ''\n            else:\n                sign = numr.group('sign')\n            value = _str_to_num(sign + digt)\n\n        elif m.group('cplx') is not None:\n            #  Check for numbers with leading 0s.\n            real = self._number_NFSC_RE.match(m.group('real'))\n            rdigt = translate(real.group('digt'), FIX_FP_TABLE2, ' ')\n            if real.group('sign') is None:\n                rsign = ''\n            else:\n                rsign = real.group('sign')\n            value = _str_to_num(rsign + rdigt)\n            imag = self._number_NFSC_RE.match(m.group('imag'))\n            idigt = translate(imag.group('digt'), FIX_FP_TABLE2, ' ')\n            if imag.group('sign') is None:\n                isign = ''\n            else:\n                isign = imag.group('sign')\n            value += _str_to_num(isign + idigt) * 1j\n        else:\n            value = UNDEFINED\n\n        if not self._valuestring:\n            self._valuestring = m.group('valu')\n        return value"},{"col":4,"comment":"\n        Updates the list of the start columns, the list of the widths of each\n        field, and the total width of each record in the table.\n        ","endLoc":1957,"header":"def _update_field_metrics(self)","id":1097,"name":"_update_field_metrics","nodeType":"Function","startLoc":1937,"text":"def _update_field_metrics(self):\n        \"\"\"\n        Updates the list of the start columns, the list of the widths of each\n        field, and the total width of each record in the table.\n        \"\"\"\n\n        spans = [0] * len(self.columns)\n        end_col = 0  # Refers to the ASCII text column, not the table col\n        for idx, col in enumerate(self.columns):\n            width = col.format.width\n\n            # Update the start columns and column span widths taking into\n            # account the case that the starting column of a field may not\n            # be the column immediately after the previous field\n            if not col.start:\n                col.start = end_col + 1\n            end_col = col.start + width - 1\n            spans[idx] = width\n\n        self._spans = spans\n        self._width = end_col"},{"col":4,"comment":"\n        Two Headers are equal only if they have the exact same string\n        representation.\n        ","endLoc":279,"header":"def __eq__(self, other)","id":1098,"name":"__eq__","nodeType":"Function","startLoc":273,"text":"def __eq__(self, other):\n        \"\"\"\n        Two Headers are equal only if they have the exact same string\n        representation.\n        \"\"\"\n\n        return str(self) == str(other)"},{"col":4,"comment":"null","endLoc":284,"header":"def __add__(self, other)","id":1099,"name":"__add__","nodeType":"Function","startLoc":281,"text":"def __add__(self, other):\n        temp = self.copy(strip=False)\n        temp.extend(other)\n        return temp"},{"col":0,"comment":"\n    Convert hour, minute, second to a float hour value.\n    ","endLoc":462,"header":"def hms_to_hours(h, m, s=None)","id":1100,"name":"hms_to_hours","nodeType":"Function","startLoc":439,"text":"def hms_to_hours(h, m, s=None):\n    \"\"\"\n    Convert hour, minute, second to a float hour value.\n    \"\"\"\n\n    check_hms_ranges(h, m, s)\n\n    # determine sign\n    sign = np.copysign(1.0, h)\n\n    try:\n        h = np.floor(np.abs(h))\n        if s is None:\n            m = np.abs(m)\n            s = 0\n        else:\n            m = np.floor(np.abs(m))\n            s = np.abs(s)\n    except ValueError as err:\n        raise ValueError(format_exception(\n            \"{func}: HMS values ({1[0]},{2[1]},{3[2]}) could not be \"\n            \"converted to numbers.\", h, m, s)) from err\n\n    return sign * (h + m / 60. + s / 3600.)"},{"col":4,"comment":"\n        Make a copy of the :class:`Header`.\n\n        .. versionchanged:: 1.3\n            `copy.copy` and `copy.deepcopy` on a `Header` will call this\n            method.\n\n        Parameters\n        ----------\n        strip : bool, optional\n            If `True`, strip any headers that are specific to one of the\n            standard HDU types, so that this header can be used in a different\n            HDU.\n\n        Returns\n        -------\n        `Header`\n            A new :class:`Header` instance.\n        ","endLoc":826,"header":"def copy(self, strip=False)","id":1101,"name":"copy","nodeType":"Function","startLoc":802,"text":"def copy(self, strip=False):\n        \"\"\"\n        Make a copy of the :class:`Header`.\n\n        .. versionchanged:: 1.3\n            `copy.copy` and `copy.deepcopy` on a `Header` will call this\n            method.\n\n        Parameters\n        ----------\n        strip : bool, optional\n            If `True`, strip any headers that are specific to one of the\n            standard HDU types, so that this header can be used in a different\n            HDU.\n\n        Returns\n        -------\n        `Header`\n            A new :class:`Header` instance.\n        \"\"\"\n\n        tmp = self.__class__((copy.copy(card) for card in self._cards))\n        if strip:\n            tmp.strip()\n        return tmp"},{"col":0,"comment":" Computes the MD5 hash for a file.\n\n    The hash for a data file is used for looking up data files in a unique\n    fashion. This is of particular use for tests; a test may require a\n    particular version of a particular file, in which case it can be accessed\n    via hash to get the appropriate version.\n\n    Typically, if you wish to write a test that requires a particular data\n    file, you will want to submit that file to the astropy data servers, and\n    use\n    e.g. ``get_pkg_data_filename('hash/34c33b3eb0d56eb9462003af249eff28')``,\n    but with the hash for your file in place of the hash in the example.\n\n    Parameters\n    ----------\n    localfn : str\n        The path to the file for which the hash should be generated.\n\n    Returns\n    -------\n    hash : str\n        The hex digest of the cryptographic hash for the contents of the\n        ``localfn`` file.\n    ","endLoc":889,"header":"def compute_hash(localfn)","id":1102,"name":"compute_hash","nodeType":"Function","startLoc":857,"text":"def compute_hash(localfn):\n    \"\"\" Computes the MD5 hash for a file.\n\n    The hash for a data file is used for looking up data files in a unique\n    fashion. This is of particular use for tests; a test may require a\n    particular version of a particular file, in which case it can be accessed\n    via hash to get the appropriate version.\n\n    Typically, if you wish to write a test that requires a particular data\n    file, you will want to submit that file to the astropy data servers, and\n    use\n    e.g. ``get_pkg_data_filename('hash/34c33b3eb0d56eb9462003af249eff28')``,\n    but with the hash for your file in place of the hash in the example.\n\n    Parameters\n    ----------\n    localfn : str\n        The path to the file for which the hash should be generated.\n\n    Returns\n    -------\n    hash : str\n        The hex digest of the cryptographic hash for the contents of the\n        ``localfn`` file.\n    \"\"\"\n    with open(localfn, 'rb') as f:\n        h = hashlib.md5()\n        block = f.read(conf.compute_hash_block_size)\n        while block:\n            h.update(block)\n            block = f.read(conf.compute_hash_block_size)\n\n    return h.hexdigest()"},{"col":4,"comment":"null","endLoc":1908,"header":"@lazyproperty\n    def dtype(self)","id":1103,"name":"dtype","nodeType":"Function","startLoc":1900,"text":"@lazyproperty\n    def dtype(self):\n        dtype = {}\n\n        for j in range(len(self)):\n            data_type = 'S' + str(self.spans[j])\n            dtype[self.names[j]] = (data_type, self.starts[j] - 1)\n\n        return np.dtype(dtype)"},{"col":4,"comment":"\n        Split the card image between the keyword and the rest of the card.\n        ","endLoc":866,"header":"def _split(self)","id":1104,"name":"_split","nodeType":"Function","startLoc":799,"text":"def _split(self):\n        \"\"\"\n        Split the card image between the keyword and the rest of the card.\n        \"\"\"\n\n        if self._image is not None:\n            # If we already have a card image, don't try to rebuild a new card\n            # image, which self.image would do\n            image = self._image\n        else:\n            image = self.image\n\n        # Split cards with CONTINUE cards or commentary keywords with long\n        # values\n        if len(self._image) > self.length:\n            values = []\n            comments = []\n            keyword = None\n            for card in self._itersubcards():\n                kw, vc = card._split()\n                if keyword is None:\n                    keyword = kw\n\n                if keyword in self._commentary_keywords:\n                    values.append(vc)\n                    continue\n\n                # Should match a string followed by a comment; if not it\n                # might be an invalid Card, so we just take it verbatim\n                m = self._strg_comment_RE.match(vc)\n                if not m:\n                    return kw, vc\n\n                value = m.group('strg') or ''\n                value = value.rstrip().replace(\"''\", \"'\")\n                if value and value[-1] == '&':\n                    value = value[:-1]\n                values.append(value)\n                comment = m.group('comm')\n                if comment:\n                    comments.append(comment.rstrip())\n\n            if keyword in self._commentary_keywords:\n                valuecomment = ''.join(values)\n            else:\n                # CONTINUE card\n                valuecomment = f\"'{''.join(values)}' / {' '.join(comments)}\"\n            return keyword, valuecomment\n\n        if self.keyword in self._special_keywords:\n            keyword, valuecomment = image.split(' ', 1)\n        else:\n            try:\n                delim_index = image.index(self._value_indicator)\n            except ValueError:\n                delim_index = None\n\n            # The equal sign may not be any higher than column 10; anything\n            # past that must be considered part of the card value\n            if delim_index is None:\n                keyword = image[:KEYWORD_LENGTH]\n                valuecomment = image[KEYWORD_LENGTH:]\n            elif delim_index > 10 and image[:9] != 'HIERARCH ':\n                keyword = image[:8]\n                valuecomment = image[8:]\n            else:\n                keyword, valuecomment = image.split(self._value_indicator, 1)\n        return keyword.strip(), valuecomment.strip()"},{"col":4,"comment":"A list of the widths of each field in the table.","endLoc":1914,"header":"@property\n    def spans(self)","id":1105,"name":"spans","nodeType":"Function","startLoc":1910,"text":"@property\n    def spans(self):\n        \"\"\"A list of the widths of each field in the table.\"\"\"\n\n        return self._spans"},{"col":4,"comment":"null","endLoc":1927,"header":"@lazyproperty\n    def _recformats(self)","id":1106,"name":"_recformats","nodeType":"Function","startLoc":1916,"text":"@lazyproperty\n    def _recformats(self):\n        if len(self) == 1:\n            widths = []\n        else:\n            widths = [y - x for x, y in pairwise(self.starts)]\n\n        # Widths is the width of each field *including* any space between\n        # fields; this is so that we can map the fields to string records in a\n        # Numpy recarray\n        widths.append(self._width - self.starts[-1] + 1)\n        return ['a' + str(w) for w in widths]"},{"col":4,"comment":"null","endLoc":1931,"header":"def add_col(self, column)","id":1107,"name":"add_col","nodeType":"Function","startLoc":1929,"text":"def add_col(self, column):\n        super().add_col(column)\n        self._update_field_metrics()"},{"col":4,"comment":"\n        If the card image is greater than 80 characters, it should consist of a\n        normal card followed by one or more CONTINUE card.  This method returns\n        the subcards that make up this logical card.\n\n        This can also support the case where a HISTORY or COMMENT card has a\n        long value that is stored internally as multiple concatenated card\n        images.\n        ","endLoc":1192,"header":"def _itersubcards(self)","id":1108,"name":"_itersubcards","nodeType":"Function","startLoc":1168,"text":"def _itersubcards(self):\n        \"\"\"\n        If the card image is greater than 80 characters, it should consist of a\n        normal card followed by one or more CONTINUE card.  This method returns\n        the subcards that make up this logical card.\n\n        This can also support the case where a HISTORY or COMMENT card has a\n        long value that is stored internally as multiple concatenated card\n        images.\n        \"\"\"\n\n        ncards = len(self._image) // Card.length\n\n        for idx in range(0, Card.length * ncards, Card.length):\n            card = Card.fromstring(self._image[idx:idx + Card.length])\n            if idx > 0 and card.keyword.upper() not in self._special_keywords:\n                raise VerifyError(\n                        'Long card images must have CONTINUE cards after '\n                        'the first card or have commentary keywords like '\n                        'HISTORY or COMMENT.')\n\n            if not isinstance(card.value, str):\n                raise VerifyError('CONTINUE cards must have string values.')\n\n            yield card"},{"col":0,"comment":"Get path from source-included data directories.\n\n    Parameters\n    ----------\n    *path : str\n        Name/location of the desired data file/directory.\n        May be a tuple of strings for ``os.path`` joining.\n\n    package : str or None, optional, keyword-only\n        If specified, look for a file relative to the given package, rather\n        than the calling module's package.\n\n    Returns\n    -------\n    path : str\n        Name/location of the desired data file/directory.\n\n    Raises\n    ------\n    ImportError\n        Given package or module is not importable.\n    RuntimeError\n        If the local data file is outside of the package's tree.\n\n    ","endLoc":951,"header":"def get_pkg_data_path(*path, package=None)","id":1109,"name":"get_pkg_data_path","nodeType":"Function","startLoc":892,"text":"def get_pkg_data_path(*path, package=None):\n    \"\"\"Get path from source-included data directories.\n\n    Parameters\n    ----------\n    *path : str\n        Name/location of the desired data file/directory.\n        May be a tuple of strings for ``os.path`` joining.\n\n    package : str or None, optional, keyword-only\n        If specified, look for a file relative to the given package, rather\n        than the calling module's package.\n\n    Returns\n    -------\n    path : str\n        Name/location of the desired data file/directory.\n\n    Raises\n    ------\n    ImportError\n        Given package or module is not importable.\n    RuntimeError\n        If the local data file is outside of the package's tree.\n\n    \"\"\"\n    if package is None:\n        module = find_current_module(1, finddiff=['astropy.utils.data', 'contextlib'])\n        if module is None:\n            # not called from inside an astropy package.  So just pass name\n            # through\n            return os.path.join(*path)\n\n        if not hasattr(module, '__package__') or not module.__package__:\n            # The __package__ attribute may be missing or set to None; see\n            # PEP-366, also astropy issue #1256\n            if '.' in module.__name__:\n                package = module.__name__.rpartition('.')[0]\n            else:\n                package = module.__name__\n        else:\n            package = module.__package__\n    else:\n        # package errors if it isn't a str\n        # so there is no need for checks in the containing if/else\n        module = resolve_name(package)\n\n    # module path within package\n    module_path = os.path.dirname(module.__file__)\n    full_path = os.path.join(module_path, *path)\n\n    # Check that file is inside tree.\n    rootpkgname = package.partition('.')[0]\n    rootpkg = resolve_name(rootpkgname)\n    root_dir = os.path.dirname(rootpkg.__file__)\n    if not _is_inside(full_path, root_dir):\n        raise RuntimeError(f\"attempted to get a local data file outside \"\n                           f\"of the {rootpkgname} tree.\")\n\n    return full_path"},{"col":4,"comment":"null","endLoc":1935,"header":"def del_col(self, col_name)","id":1110,"name":"del_col","nodeType":"Function","startLoc":1933,"text":"def del_col(self, col_name):\n        super().del_col(col_name)\n        self._update_field_metrics()"},{"col":4,"comment":"null","endLoc":288,"header":"def __iadd__(self, other)","id":1111,"name":"__iadd__","nodeType":"Function","startLoc":286,"text":"def __iadd__(self, other):\n        self.extend(other)\n        return self"},{"col":4,"comment":"\n        Appends multiple keyword+value cards to the end of the header, similar\n        to `list.extend`.\n\n        Parameters\n        ----------\n        cards : iterable\n            An iterable of (keyword, value, [comment]) tuples; see\n            `Header.append`.\n\n        strip : bool, optional\n            Remove any keywords that have meaning only to specific types of\n            HDUs, so that only more general keywords are added from extension\n            Header or Card list (default: `True`).\n\n        unique : bool, optional\n            If `True`, ensures that no duplicate keywords are appended;\n            keywords already in this header are simply discarded.  The\n            exception is commentary keywords (COMMENT, HISTORY, etc.): they are\n            only treated as duplicates if their values match.\n\n        update : bool, optional\n            If `True`, update the current header with the values and comments\n            from duplicate keywords in the input header.  This supersedes the\n            ``unique`` argument.  Commentary keywords are treated the same as\n            if ``unique=True``.\n\n        update_first : bool, optional\n            If the first keyword in the header is 'SIMPLE', and the first\n            keyword in the input header is 'XTENSION', the 'SIMPLE' keyword is\n            replaced by the 'XTENSION' keyword.  Likewise if the first keyword\n            in the header is 'XTENSION' and the first keyword in the input\n            header is 'SIMPLE', the 'XTENSION' keyword is replaced by the\n            'SIMPLE' keyword.  This behavior is otherwise dumb as to whether or\n            not the resulting header is a valid primary or extension header.\n            This is mostly provided to support backwards compatibility with the\n            old ``Header.fromTxtFile`` method, and only applies if\n            ``update=True``.\n\n        useblanks, bottom, end : bool, optional\n            These arguments are passed to :meth:`Header.append` while appending\n            new cards to the header.\n        ","endLoc":1344,"header":"def extend(self, cards, strip=True, unique=False, update=False,\n               update_first=False, useblanks=True, bottom=False, end=False)","id":1112,"name":"extend","nodeType":"Function","startLoc":1246,"text":"def extend(self, cards, strip=True, unique=False, update=False,\n               update_first=False, useblanks=True, bottom=False, end=False):\n        \"\"\"\n        Appends multiple keyword+value cards to the end of the header, similar\n        to `list.extend`.\n\n        Parameters\n        ----------\n        cards : iterable\n            An iterable of (keyword, value, [comment]) tuples; see\n            `Header.append`.\n\n        strip : bool, optional\n            Remove any keywords that have meaning only to specific types of\n            HDUs, so that only more general keywords are added from extension\n            Header or Card list (default: `True`).\n\n        unique : bool, optional\n            If `True`, ensures that no duplicate keywords are appended;\n            keywords already in this header are simply discarded.  The\n            exception is commentary keywords (COMMENT, HISTORY, etc.): they are\n            only treated as duplicates if their values match.\n\n        update : bool, optional\n            If `True`, update the current header with the values and comments\n            from duplicate keywords in the input header.  This supersedes the\n            ``unique`` argument.  Commentary keywords are treated the same as\n            if ``unique=True``.\n\n        update_first : bool, optional\n            If the first keyword in the header is 'SIMPLE', and the first\n            keyword in the input header is 'XTENSION', the 'SIMPLE' keyword is\n            replaced by the 'XTENSION' keyword.  Likewise if the first keyword\n            in the header is 'XTENSION' and the first keyword in the input\n            header is 'SIMPLE', the 'XTENSION' keyword is replaced by the\n            'SIMPLE' keyword.  This behavior is otherwise dumb as to whether or\n            not the resulting header is a valid primary or extension header.\n            This is mostly provided to support backwards compatibility with the\n            old ``Header.fromTxtFile`` method, and only applies if\n            ``update=True``.\n\n        useblanks, bottom, end : bool, optional\n            These arguments are passed to :meth:`Header.append` while appending\n            new cards to the header.\n        \"\"\"\n\n        temp = self.__class__(cards)\n        if strip:\n            temp.strip()\n\n        if len(self):\n            first = self._cards[0].keyword\n        else:\n            first = None\n\n        # We don't immediately modify the header, because first we need to sift\n        # out any duplicates in the new header prior to adding them to the\n        # existing header, but while *allowing* duplicates from the header\n        # being extended from (see ticket #156)\n        extend_cards = []\n\n        for idx, card in enumerate(temp.cards):\n            keyword = card.keyword\n            if keyword not in Card._commentary_keywords:\n                if unique and not update and keyword in self:\n                    continue\n                elif update:\n                    if idx == 0 and update_first:\n                        # Dumbly update the first keyword to either SIMPLE or\n                        # XTENSION as the case may be, as was in the case in\n                        # Header.fromTxtFile\n                        if ((keyword == 'SIMPLE' and first == 'XTENSION') or\n                                (keyword == 'XTENSION' and first == 'SIMPLE')):\n                            del self[0]\n                            self.insert(0, card)\n                        else:\n                            self[keyword] = (card.value, card.comment)\n                    elif keyword in self:\n                        self[keyword] = (card.value, card.comment)\n                    else:\n                        extend_cards.append(card)\n                else:\n                    extend_cards.append(card)\n            else:\n                if (unique or update) and keyword in self:\n                    if card.is_blank:\n                        extend_cards.append(card)\n                        continue\n\n                    for value in self[keyword]:\n                        if value == card.value:\n                            break\n                    else:\n                        extend_cards.append(card)\n                else:\n                    extend_cards.append(card)\n\n        for card in extend_cards:\n            self.append(card, useblanks=useblanks, bottom=bottom, end=end)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1884,"id":1113,"name":"_padding_byte","nodeType":"Attribute","startLoc":1884,"text":"_padding_byte"},{"attributeType":"null","col":4,"comment":"null","endLoc":1885,"id":1114,"name":"_col_format_cls","nodeType":"Attribute","startLoc":1885,"text":"_col_format_cls"},{"col":0,"comment":"Resolve a name like ``module.object`` to an object and return it.\n\n    This ends up working like ``from module import object`` but is easier\n    to deal with than the `__import__` builtin and supports digging into\n    submodules.\n\n    Parameters\n    ----------\n\n    name : `str`\n        A dotted path to a Python object--that is, the name of a function,\n        class, or other object in a module with the full path to that module,\n        including parent modules, separated by dots.  Also known as the fully\n        qualified name of the object.\n\n    additional_parts : iterable, optional\n        If more than one positional arguments are given, those arguments are\n        automatically dotted together with ``name``.\n\n    Examples\n    --------\n\n    >>> resolve_name('astropy.utils.introspection.resolve_name')\n    <function resolve_name at 0x...>\n    >>> resolve_name('astropy', 'utils', 'introspection', 'resolve_name')\n    <function resolve_name at 0x...>\n\n    Raises\n    ------\n    `ImportError`\n        If the module or named object is not found.\n    ","endLoc":105,"header":"def resolve_name(name, *additional_parts)","id":1115,"name":"resolve_name","nodeType":"Function","startLoc":36,"text":"def resolve_name(name, *additional_parts):\n    \"\"\"Resolve a name like ``module.object`` to an object and return it.\n\n    This ends up working like ``from module import object`` but is easier\n    to deal with than the `__import__` builtin and supports digging into\n    submodules.\n\n    Parameters\n    ----------\n\n    name : `str`\n        A dotted path to a Python object--that is, the name of a function,\n        class, or other object in a module with the full path to that module,\n        including parent modules, separated by dots.  Also known as the fully\n        qualified name of the object.\n\n    additional_parts : iterable, optional\n        If more than one positional arguments are given, those arguments are\n        automatically dotted together with ``name``.\n\n    Examples\n    --------\n\n    >>> resolve_name('astropy.utils.introspection.resolve_name')\n    <function resolve_name at 0x...>\n    >>> resolve_name('astropy', 'utils', 'introspection', 'resolve_name')\n    <function resolve_name at 0x...>\n\n    Raises\n    ------\n    `ImportError`\n        If the module or named object is not found.\n    \"\"\"\n\n    additional_parts = '.'.join(additional_parts)\n\n    if additional_parts:\n        name = name + '.' + additional_parts\n\n    parts = name.split('.')\n\n    if len(parts) == 1:\n        # No dots in the name--just a straight up module import\n        cursor = 1\n        fromlist = []\n    else:\n        cursor = len(parts) - 1\n        fromlist = [parts[-1]]\n\n    module_name = parts[:cursor]\n\n    while cursor > 0:\n        try:\n            ret = __import__('.'.join(module_name), fromlist=fromlist)\n            break\n        except ImportError:\n            if cursor == 0:\n                raise\n            cursor -= 1\n            module_name = parts[:cursor]\n            fromlist = [parts[cursor]]\n            ret = ''\n\n    for part in parts[cursor:]:\n        try:\n            ret = getattr(ret, part)\n        except AttributeError:\n            raise ImportError(name)\n\n    return ret"},{"attributeType":"null","col":12,"comment":"null","endLoc":1898,"id":1116,"name":"_width","nodeType":"Attribute","startLoc":1898,"text":"self._width"},{"col":0,"comment":"\n    Checks that the given hour, minute and second are all within\n    reasonable range.\n    ","endLoc":361,"header":"def check_hms_ranges(h, m, s)","id":1117,"name":"check_hms_ranges","nodeType":"Function","startLoc":353,"text":"def check_hms_ranges(h, m, s):\n    \"\"\"\n    Checks that the given hour, minute and second are all within\n    reasonable range.\n    \"\"\"\n    _check_hour_range(h)\n    _check_minute_range(m)\n    _check_second_range(s)\n    return None"},{"col":0,"comment":"\n    Checks that the given value is in the range (-24, 24).\n    ","endLoc":324,"header":"def _check_hour_range(hrs)","id":1118,"name":"_check_hour_range","nodeType":"Function","startLoc":317,"text":"def _check_hour_range(hrs):\n    \"\"\"\n    Checks that the given value is in the range (-24, 24).\n    \"\"\"\n    if np.any(np.abs(hrs) == 24.):\n        warn(IllegalHourWarning(hrs, 'Treating as 24 hr'))\n    elif np.any(hrs < -24.) or np.any(hrs > 24.):\n        raise IllegalHourError(hrs)"},{"attributeType":"null","col":12,"comment":"null","endLoc":1897,"id":1119,"name":"_spans","nodeType":"Attribute","startLoc":1897,"text":"self._spans"},{"className":"_FormatX","col":0,"comment":"For X format in binary tables.","endLoc":384,"id":1120,"nodeType":"Class","startLoc":369,"text":"class _FormatX(str):\n    \"\"\"For X format in binary tables.\"\"\"\n\n    def __new__(cls, repeat=1):\n        nbytes = ((repeat - 1) // 8) + 1\n        # use an array, even if it is only ONE u1 (i.e. use tuple always)\n        obj = super().__new__(cls, repr((nbytes,)) + 'u1')\n        obj.repeat = repeat\n        return obj\n\n    def __getnewargs__(self):\n        return (self.repeat,)\n\n    @property\n    def tform(self):\n        return f'{self.repeat}X'"},{"col":4,"comment":"null","endLoc":377,"header":"def __new__(cls, repeat=1)","id":1121,"name":"__new__","nodeType":"Function","startLoc":372,"text":"def __new__(cls, repeat=1):\n        nbytes = ((repeat - 1) // 8) + 1\n        # use an array, even if it is only ONE u1 (i.e. use tuple always)\n        obj = super().__new__(cls, repr((nbytes,)) + 'u1')\n        obj.repeat = repeat\n        return obj"},{"col":4,"comment":"null","endLoc":380,"header":"def __getnewargs__(self)","id":1122,"name":"__getnewargs__","nodeType":"Function","startLoc":379,"text":"def __getnewargs__(self):\n        return (self.repeat,)"},{"col":4,"comment":"null","endLoc":384,"header":"@property\n    def tform(self)","id":1123,"name":"tform","nodeType":"Function","startLoc":382,"text":"@property\n    def tform(self):\n        return f'{self.repeat}X'"},{"attributeType":"null","col":8,"comment":"null","endLoc":375,"id":1124,"name":"obj","nodeType":"Attribute","startLoc":375,"text":"obj"},{"attributeType":"null","col":8,"comment":"null","endLoc":376,"id":1125,"name":"repeat","nodeType":"Attribute","startLoc":376,"text":"obj.repeat"},{"attributeType":"null","col":8,"comment":"null","endLoc":373,"id":1126,"name":"nbytes","nodeType":"Attribute","startLoc":373,"text":"nbytes"},{"className":"_FormatP","col":0,"comment":"For P format in variable length table.","endLoc":428,"id":1127,"nodeType":"Class","startLoc":390,"text":"class _FormatP(str):\n    \"\"\"For P format in variable length table.\"\"\"\n\n    # As far as I can tell from my reading of the FITS standard, a type code is\n    # *required* for P and Q formats; there is no default\n    _format_re_template = (r'(?P<repeat>\\d+)?{}(?P<dtype>[LXBIJKAEDCM])'\n                           r'(?:\\((?P<max>\\d*)\\))?')\n    _format_code = 'P'\n    _format_re = re.compile(_format_re_template.format(_format_code))\n    _descriptor_format = '2i4'\n\n    def __new__(cls, dtype, repeat=None, max=None):\n        obj = super().__new__(cls, cls._descriptor_format)\n        obj.format = NUMPY2FITS[dtype]\n        obj.dtype = dtype\n        obj.repeat = repeat\n        obj.max = max\n        return obj\n\n    def __getnewargs__(self):\n        return (self.dtype, self.repeat, self.max)\n\n    @classmethod\n    def from_tform(cls, format):\n        m = cls._format_re.match(format)\n        if not m or m.group('dtype') not in FITS2NUMPY:\n            raise VerifyError(f'Invalid column format: {format}')\n        repeat = m.group('repeat')\n        array_dtype = m.group('dtype')\n        max = m.group('max')\n        if not max:\n            max = None\n        return cls(FITS2NUMPY[array_dtype], repeat=repeat, max=max)\n\n    @property\n    def tform(self):\n        repeat = '' if self.repeat is None else self.repeat\n        max = '' if self.max is None else self.max\n        return f'{repeat}{self._format_code}{self.format}({max})'"},{"attributeType":"null","col":8,"comment":"null","endLoc":174,"id":1128,"name":"fileobj_mode","nodeType":"Attribute","startLoc":174,"text":"self.fileobj_mode"},{"col":4,"comment":"null","endLoc":407,"header":"def __new__(cls, dtype, repeat=None, max=None)","id":1129,"name":"__new__","nodeType":"Function","startLoc":401,"text":"def __new__(cls, dtype, repeat=None, max=None):\n        obj = super().__new__(cls, cls._descriptor_format)\n        obj.format = NUMPY2FITS[dtype]\n        obj.dtype = dtype\n        obj.repeat = repeat\n        obj.max = max\n        return obj"},{"col":4,"comment":"null","endLoc":410,"header":"def __getnewargs__(self)","id":1130,"name":"__getnewargs__","nodeType":"Function","startLoc":409,"text":"def __getnewargs__(self):\n        return (self.dtype, self.repeat, self.max)"},{"col":4,"comment":"null","endLoc":422,"header":"@classmethod\n    def from_tform(cls, format)","id":1131,"name":"from_tform","nodeType":"Function","startLoc":412,"text":"@classmethod\n    def from_tform(cls, format):\n        m = cls._format_re.match(format)\n        if not m or m.group('dtype') not in FITS2NUMPY:\n            raise VerifyError(f'Invalid column format: {format}')\n        repeat = m.group('repeat')\n        array_dtype = m.group('dtype')\n        max = m.group('max')\n        if not max:\n            max = None\n        return cls(FITS2NUMPY[array_dtype], repeat=repeat, max=max)"},{"col":0,"comment":"null","endLoc":162,"header":"def _is_inside(path, parent_path)","id":1132,"name":"_is_inside","nodeType":"Function","startLoc":156,"text":"def _is_inside(path, parent_path):\n    # We have to try realpath too to avoid issues with symlinks, but we leave\n    # abspath because some systems like debian have the absolute path (with no\n    # symlinks followed) match, but the real directories in different\n    # locations, so need to try both cases.\n    return os.path.abspath(path).startswith(os.path.abspath(parent_path)) \\\n        or os.path.realpath(path).startswith(os.path.realpath(parent_path))"},{"col":4,"comment":"null","endLoc":291,"header":"def _ipython_key_completions_(self)","id":1133,"name":"_ipython_key_completions_","nodeType":"Function","startLoc":290,"text":"def _ipython_key_completions_(self):\n        return self.__iter__()"},{"col":4,"comment":"\n        The underlying physical cards that make up this Header; it can be\n        looked at, but it should not be modified directly.\n        ","endLoc":300,"header":"@property\n    def cards(self)","id":1134,"name":"cards","nodeType":"Function","startLoc":293,"text":"@property\n    def cards(self):\n        \"\"\"\n        The underlying physical cards that make up this Header; it can be\n        looked at, but it should not be modified directly.\n        \"\"\"\n\n        return _CardAccessor(self)"},{"col":4,"comment":"\n        View the comments associated with each keyword, if any.\n\n        For example, to see the comment on the NAXIS keyword:\n\n            >>> header.comments['NAXIS']\n            number of data axes\n\n        Comments can also be updated through this interface:\n\n            >>> header.comments['NAXIS'] = 'Number of data axes'\n\n        ","endLoc":318,"header":"@property\n    def comments(self)","id":1135,"name":"comments","nodeType":"Function","startLoc":302,"text":"@property\n    def comments(self):\n        \"\"\"\n        View the comments associated with each keyword, if any.\n\n        For example, to see the comment on the NAXIS keyword:\n\n            >>> header.comments['NAXIS']\n            number of data axes\n\n        Comments can also be updated through this interface:\n\n            >>> header.comments['NAXIS'] = 'Number of data axes'\n\n        \"\"\"\n\n        return _HeaderComments(self)"},{"col":0,"comment":"\n    Performs an in-place rstrip operation on string arrays. This is necessary\n    since the built-in `np.char.rstrip` in Numpy does not perform an in-place\n    calculation.\n    ","endLoc":941,"header":"def _rstrip_inplace(array)","id":1136,"name":"_rstrip_inplace","nodeType":"Function","startLoc":894,"text":"def _rstrip_inplace(array):\n    \"\"\"\n    Performs an in-place rstrip operation on string arrays. This is necessary\n    since the built-in `np.char.rstrip` in Numpy does not perform an in-place\n    calculation.\n    \"\"\"\n\n    # The following implementation convert the string to unsigned integers of\n    # the right length. Trailing spaces (which are represented as 32) are then\n    # converted to null characters (represented as zeros). To avoid creating\n    # large temporary mask arrays, we loop over chunks (attempting to do that\n    # on a 1-D version of the array; large memory may still be needed in the\n    # unlikely case that a string array has small first dimension and cannot\n    # be represented as a contiguous 1-D array in memory).\n\n    dt = array.dtype\n\n    if dt.kind not in 'SU':\n        raise TypeError(\"This function can only be used on string arrays\")\n    # View the array as appropriate integers. The last dimension will\n    # equal the number of characters in each string.\n    bpc = 1 if dt.kind == 'S' else 4\n    dt_int = f\"({dt.itemsize // bpc},){dt.byteorder}u{bpc}\"\n    b = array.view(dt_int, np.ndarray)\n    # For optimal speed, work in chunks of the internal ufunc buffer size.\n    bufsize = np.getbufsize()\n    # Attempt to have the strings as a 1-D array to give the chunk known size.\n    # Note: the code will work if this fails; the chunks will just be larger.\n    if b.ndim > 2:\n        try:\n            b.shape = -1, b.shape[-1]\n        except AttributeError:  # can occur for non-contiguous arrays\n            pass\n    for j in range(0, b.shape[0], bufsize):\n        c = b[j:j + bufsize]\n        # Mask which will tell whether we're in a sequence of trailing spaces.\n        mask = np.ones(c.shape[:-1], dtype=bool)\n        # Loop over the characters in the strings, in reverse order. We process\n        # the i-th character of all strings in the chunk at the same time. If\n        # the character is 32, this corresponds to a space, and we then change\n        # this to 0. We then construct a new mask to find rows where the\n        # i-th character is 0 (null) and the i-1-th is 32 (space) and repeat.\n        for i in range(-1, -c.shape[-1], -1):\n            mask &= c[..., i] == 32\n            c[..., i][mask] = 0\n            mask = c[..., i] == 0\n\n    return array"},{"col":4,"comment":"null","endLoc":428,"header":"@property\n    def tform(self)","id":1137,"name":"tform","nodeType":"Function","startLoc":424,"text":"@property\n    def tform(self):\n        repeat = '' if self.repeat is None else self.repeat\n        max = '' if self.max is None else self.max\n        return f'{repeat}{self._format_code}{self.format}({max})'"},{"attributeType":"null","col":4,"comment":"null","endLoc":395,"id":1138,"name":"_format_re_template","nodeType":"Attribute","startLoc":395,"text":"_format_re_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":397,"id":1139,"name":"_format_code","nodeType":"Attribute","startLoc":397,"text":"_format_code"},{"col":4,"comment":"\n        Whether or not the header has been modified; this is a property so that\n        it can also check each card for modifications--cards may have been\n        modified directly without the header containing it otherwise knowing.\n        ","endLoc":334,"header":"@property\n    def _modified(self)","id":1140,"name":"_modified","nodeType":"Function","startLoc":320,"text":"@property\n    def _modified(self):\n        \"\"\"\n        Whether or not the header has been modified; this is a property so that\n        it can also check each card for modifications--cards may have been\n        modified directly without the header containing it otherwise knowing.\n        \"\"\"\n\n        modified_cards = any(c._modified for c in self._cards)\n        if modified_cards:\n            # If any cards were modified then by definition the header was\n            # modified\n            self.__dict__['_modified'] = True\n\n        return self.__dict__['_modified']"},{"attributeType":"null","col":4,"comment":"null","endLoc":398,"id":1141,"name":"_format_re","nodeType":"Attribute","startLoc":398,"text":"_format_re"},{"attributeType":"null","col":4,"comment":"null","endLoc":399,"id":1142,"name":"_descriptor_format","nodeType":"Attribute","startLoc":399,"text":"_descriptor_format"},{"col":4,"comment":"null","endLoc":338,"header":"@_modified.setter\n    def _modified(self, val)","id":1143,"name":"_modified","nodeType":"Function","startLoc":336,"text":"@_modified.setter\n    def _modified(self, val):\n        self.__dict__['_modified'] = val"},{"col":4,"comment":"\n        Similar to :meth:`Header.fromstring`, but reads the header string from\n        a given file-like object or filename.\n\n        Parameters\n        ----------\n        fileobj : str, file-like\n            A filename or an open file-like object from which a FITS header is\n            to be read.  For open file handles the file pointer must be at the\n            beginning of the header.\n\n        sep : str, optional\n            The string separating cards from each other, such as a newline.  By\n            default there is no card separator (as is the case in a raw FITS\n            file).\n\n        endcard : bool, optional\n            If True (the default) the header must end with an END card in order\n            to be considered valid.  If an END card is not found an\n            `OSError` is raised.\n\n        padding : bool, optional\n            If True (the default) the header will be required to be padded out\n            to a multiple of 2880, the FITS header block size.  Otherwise any\n            padding, or lack thereof, is ignored.\n\n        Returns\n        -------\n        `Header`\n            A new `Header` instance.\n        ","endLoc":526,"header":"@classmethod\n    def fromfile(cls, fileobj, sep='', endcard=True, padding=True)","id":1144,"name":"fromfile","nodeType":"Function","startLoc":459,"text":"@classmethod\n    def fromfile(cls, fileobj, sep='', endcard=True, padding=True):\n        \"\"\"\n        Similar to :meth:`Header.fromstring`, but reads the header string from\n        a given file-like object or filename.\n\n        Parameters\n        ----------\n        fileobj : str, file-like\n            A filename or an open file-like object from which a FITS header is\n            to be read.  For open file handles the file pointer must be at the\n            beginning of the header.\n\n        sep : str, optional\n            The string separating cards from each other, such as a newline.  By\n            default there is no card separator (as is the case in a raw FITS\n            file).\n\n        endcard : bool, optional\n            If True (the default) the header must end with an END card in order\n            to be considered valid.  If an END card is not found an\n            `OSError` is raised.\n\n        padding : bool, optional\n            If True (the default) the header will be required to be padded out\n            to a multiple of 2880, the FITS header block size.  Otherwise any\n            padding, or lack thereof, is ignored.\n\n        Returns\n        -------\n        `Header`\n            A new `Header` instance.\n        \"\"\"\n\n        close_file = False\n\n        if isinstance(fileobj, path_like):\n            # If sep is non-empty we are trying to read a header printed to a\n            # text file, so open in text mode by default to support newline\n            # handling; if a binary-mode file object is passed in, the user is\n            # then on their own w.r.t. newline handling.\n            #\n            # Otherwise assume we are reading from an actual FITS file and open\n            # in binary mode.\n            if sep:\n                fileobj = open(fileobj, 'r', encoding='latin1')\n            else:\n                fileobj = open(fileobj, 'rb')\n\n            close_file = True\n\n        try:\n            is_binary = fileobj_is_binary(fileobj)\n\n            def block_iter(nbytes):\n                while True:\n                    data = fileobj.read(nbytes)\n\n                    if data:\n                        yield data\n                    else:\n                        break\n\n            return cls._from_blocks(block_iter, is_binary, sep, endcard,\n                                    padding)[1]\n        finally:\n            if close_file:\n                fileobj.close()"},{"attributeType":"null","col":8,"comment":"null","endLoc":406,"id":1145,"name":"max","nodeType":"Attribute","startLoc":406,"text":"obj.max"},{"attributeType":"null","col":8,"comment":"null","endLoc":402,"id":1146,"name":"obj","nodeType":"Attribute","startLoc":402,"text":"obj"},{"attributeType":"null","col":8,"comment":"null","endLoc":405,"id":1147,"name":"repeat","nodeType":"Attribute","startLoc":405,"text":"obj.repeat"},{"attributeType":"null","col":8,"comment":"null","endLoc":403,"id":1148,"name":"format","nodeType":"Attribute","startLoc":403,"text":"obj.format"},{"col":4,"comment":"null","endLoc":60,"header":"def __init__(self, hour, alternativeactionstr=None)","id":1149,"name":"__init__","nodeType":"Function","startLoc":58,"text":"def __init__(self, hour, alternativeactionstr=None):\n        self.hour = hour\n        self.alternativeactionstr = alternativeactionstr"},{"attributeType":"null","col":8,"comment":"null","endLoc":404,"id":1150,"name":"dtype","nodeType":"Attribute","startLoc":404,"text":"obj.dtype"},{"attributeType":"None","col":8,"comment":"null","endLoc":126,"id":1151,"name":"_mmap","nodeType":"Attribute","startLoc":126,"text":"self._mmap"},{"attributeType":"null","col":16,"comment":"null","endLoc":210,"id":1152,"name":"memmap","nodeType":"Attribute","startLoc":210,"text":"self.memmap"},{"attributeType":"null","col":12,"comment":"null","endLoc":132,"id":1153,"name":"simulateonly","nodeType":"Attribute","startLoc":132,"text":"self.simulateonly"},{"attributeType":"None | {__eq__}","col":8,"comment":"null","endLoc":161,"id":1154,"name":"mode","nodeType":"Attribute","startLoc":161,"text":"self.mode"},{"className":"_VLF","col":0,"comment":"Variable length field object.","endLoc":2014,"id":1155,"nodeType":"Class","startLoc":1963,"text":"class _VLF(np.ndarray):\n    \"\"\"Variable length field object.\"\"\"\n\n    def __new__(cls, input, dtype='a'):\n        \"\"\"\n        Parameters\n        ----------\n        input\n            a sequence of variable-sized elements.\n        \"\"\"\n\n        if dtype == 'a':\n            try:\n                # this handles ['abc'] and [['a','b','c']]\n                # equally, beautiful!\n                input = [chararray.array(x, itemsize=1) for x in input]\n            except Exception:\n                raise ValueError(\n                    f'Inconsistent input data array: {input}')\n\n        a = np.array(input, dtype=object)\n        self = np.ndarray.__new__(cls, shape=(len(input),), buffer=a,\n                                  dtype=object)\n        self.max = 0\n        self.element_dtype = dtype\n        return self\n\n    def __array_finalize__(self, obj):\n        if obj is None:\n            return\n        self.max = obj.max\n        self.element_dtype = obj.element_dtype\n\n    def __setitem__(self, key, value):\n        \"\"\"\n        To make sure the new item has consistent data type to avoid\n        misalignment.\n        \"\"\"\n\n        if isinstance(value, np.ndarray) and value.dtype == self.dtype:\n            pass\n        elif isinstance(value, chararray.chararray) and value.itemsize == 1:\n            pass\n        elif self.element_dtype == 'a':\n            value = chararray.array(value, itemsize=1)\n        else:\n            value = np.array(value, dtype=self.element_dtype)\n        np.ndarray.__setitem__(self, key, value)\n        self.max = max(self.max, len(value))\n\n    def tolist(self):\n        return [list(item) for item in super().tolist()]"},{"col":0,"comment":"Check whether data is a dask array.\n\n    We avoid importing dask unless it is likely it is a dask array,\n    so that non-dask code is not slowed down.\n    ","endLoc":960,"header":"def _is_dask_array(data)","id":1156,"name":"_is_dask_array","nodeType":"Function","startLoc":944,"text":"def _is_dask_array(data):\n    \"\"\"Check whether data is a dask array.\n\n    We avoid importing dask unless it is likely it is a dask array,\n    so that non-dask code is not slowed down.\n    \"\"\"\n    if not hasattr(data, 'compute'):\n        return False\n\n    try:\n        from dask.array import Array\n    except ImportError:\n        # If we cannot import dask, surely this cannot be a\n        # dask array!\n        return False\n    else:\n        return isinstance(data, Array)"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":1157,"name":"path_like","nodeType":"Attribute","startLoc":26,"text":"path_like"},{"col":4,"comment":"null","endLoc":1994,"header":"def __array_finalize__(self, obj)","id":1158,"name":"__array_finalize__","nodeType":"Function","startLoc":1990,"text":"def __array_finalize__(self, obj):\n        if obj is None:\n            return\n        self.max = obj.max\n        self.element_dtype = obj.element_dtype"},{"col":4,"comment":"\n        To make sure the new item has consistent data type to avoid\n        misalignment.\n        ","endLoc":2011,"header":"def __setitem__(self, key, value)","id":1159,"name":"__setitem__","nodeType":"Function","startLoc":1996,"text":"def __setitem__(self, key, value):\n        \"\"\"\n        To make sure the new item has consistent data type to avoid\n        misalignment.\n        \"\"\"\n\n        if isinstance(value, np.ndarray) and value.dtype == self.dtype:\n            pass\n        elif isinstance(value, chararray.chararray) and value.itemsize == 1:\n            pass\n        elif self.element_dtype == 'a':\n            value = chararray.array(value, itemsize=1)\n        else:\n            value = np.array(value, dtype=self.element_dtype)\n        np.ndarray.__setitem__(self, key, value)\n        self.max = max(self.max, len(value))"},{"attributeType":"function","col":0,"comment":"null","endLoc":28,"id":1160,"name":"cmp","nodeType":"Attribute","startLoc":28,"text":"cmp"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":1161,"name":"all_integer_types","nodeType":"Attribute","startLoc":30,"text":"all_integer_types"},{"attributeType":"None","col":0,"comment":"null","endLoc":551,"id":1162,"name":"CHUNKED_FROMFILE","nodeType":"Attribute","startLoc":551,"text":"CHUNKED_FROMFILE"},{"attributeType":"null","col":0,"comment":"null","endLoc":592,"id":1163,"name":"_OSX_WRITE_LIMIT","nodeType":"Attribute","startLoc":592,"text":"_OSX_WRITE_LIMIT"},{"attributeType":"null","col":0,"comment":"null","endLoc":593,"id":1164,"name":"_WIN_WRITE_LIMIT","nodeType":"Attribute","startLoc":593,"text":"_WIN_WRITE_LIMIT"},{"col":0,"comment":"","endLoc":3,"header":"util.py#<anonymous>","id":1165,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"path_like = (str, os.PathLike)\n\ncmp = lambda a, b: (a > b) - (a < b)\n\nall_integer_types = (int, np.integer)\n\nCHUNKED_FROMFILE = None\n\n_OSX_WRITE_LIMIT = (2 ** 32) - 1\n\n_WIN_WRITE_LIMIT = (2 ** 31) - 1"},{"col":6,"endLoc":28,"id":1166,"nodeType":"Lambda","startLoc":28,"text":"lambda a, b: (a > b) - (a < b)"},{"fileName":"column.py","filePath":"astropy/io/fits","id":1167,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport copy\nimport operator\nimport re\nimport sys\nimport warnings\nimport weakref\nimport numbers\n\nfrom functools import reduce\nfrom collections import OrderedDict\nfrom contextlib import suppress\n\nimport numpy as np\nfrom numpy import char as chararray\n\nfrom .card import Card, CARD_LENGTH\nfrom .util import (pairwise, _is_int, _convert_array, encode_ascii, cmp,\n                   NotifierMixin)\nfrom .verify import VerifyError, VerifyWarning\n\nfrom astropy.utils import lazyproperty, isiterable, indent\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n__all__ = ['Column', 'ColDefs', 'Delayed']\n\n\n# mapping from TFORM data type to numpy data type (code)\n# L: Logical (Boolean)\n# B: Unsigned Byte\n# I: 16-bit Integer\n# J: 32-bit Integer\n# K: 64-bit Integer\n# E: Single-precision Floating Point\n# D: Double-precision Floating Point\n# C: Single-precision Complex\n# M: Double-precision Complex\n# A: Character\nFITS2NUMPY = {'L': 'i1', 'B': 'u1', 'I': 'i2', 'J': 'i4', 'K': 'i8', 'E': 'f4',\n              'D': 'f8', 'C': 'c8', 'M': 'c16', 'A': 'a'}\n\n# the inverse dictionary of the above\nNUMPY2FITS = {val: key for key, val in FITS2NUMPY.items()}\n# Normally booleans are represented as ints in Astropy, but if passed in a numpy\n# boolean array, that should be supported\nNUMPY2FITS['b1'] = 'L'\n# Add unsigned types, which will be stored as signed ints with a TZERO card.\nNUMPY2FITS['u2'] = 'I'\nNUMPY2FITS['u4'] = 'J'\nNUMPY2FITS['u8'] = 'K'\n# Add half precision floating point numbers which will be up-converted to\n# single precision.\nNUMPY2FITS['f2'] = 'E'\n\n# This is the order in which values are converted to FITS types\n# Note that only double precision floating point/complex are supported\nFORMATORDER = ['L', 'B', 'I', 'J', 'K', 'D', 'M', 'A']\n\n# Convert single precision floating point/complex to double precision.\nFITSUPCONVERTERS = {'E': 'D', 'C': 'M'}\n\n# mapping from ASCII table TFORM data type to numpy data type\n# A: Character\n# I: Integer (32-bit)\n# J: Integer (64-bit; non-standard)\n# F: Float (64-bit; fixed decimal notation)\n# E: Float (64-bit; exponential notation)\n# D: Float (64-bit; exponential notation, always 64-bit by convention)\nASCII2NUMPY = {'A': 'a', 'I': 'i4', 'J': 'i8', 'F': 'f8', 'E': 'f8', 'D': 'f8'}\n\n# Maps FITS ASCII column format codes to the appropriate Python string\n# formatting codes for that type.\nASCII2STR = {'A': '', 'I': 'd', 'J': 'd', 'F': 'f', 'E': 'E', 'D': 'E'}\n\n# For each ASCII table format code, provides a default width (and decimal\n# precision) for when one isn't given explicitly in the column format\nASCII_DEFAULT_WIDTHS = {'A': (1, 0), 'I': (10, 0), 'J': (15, 0),\n                        'E': (15, 7), 'F': (16, 7), 'D': (25, 17)}\n\n# TDISPn for both ASCII and Binary tables\nTDISP_RE_DICT = {}\nTDISP_RE_DICT['F'] = re.compile(r'(?:(?P<formatc>[F])(?:(?P<width>[0-9]+)\\.{1}'\n                                r'(?P<precision>[0-9])+)+)|')\nTDISP_RE_DICT['A'] = TDISP_RE_DICT['L'] = \\\n    re.compile(r'(?:(?P<formatc>[AL])(?P<width>[0-9]+)+)|')\nTDISP_RE_DICT['I'] = TDISP_RE_DICT['B'] = \\\n    TDISP_RE_DICT['O'] = TDISP_RE_DICT['Z'] =  \\\n    re.compile(r'(?:(?P<formatc>[IBOZ])(?:(?P<width>[0-9]+)'\n               r'(?:\\.{0,1}(?P<precision>[0-9]+))?))|')\nTDISP_RE_DICT['E'] = TDISP_RE_DICT['G'] = \\\n    TDISP_RE_DICT['D'] = \\\n    re.compile(r'(?:(?P<formatc>[EGD])(?:(?P<width>[0-9]+)\\.'\n               r'(?P<precision>[0-9]+))+)'\n               r'(?:E{0,1}(?P<exponential>[0-9]+)?)|')\nTDISP_RE_DICT['EN'] = TDISP_RE_DICT['ES'] = \\\n    re.compile(r'(?:(?P<formatc>E[NS])(?:(?P<width>[0-9]+)\\.{1}'\n               r'(?P<precision>[0-9])+)+)')\n\n# mapping from TDISP format to python format\n# A: Character\n# L: Logical (Boolean)\n# I: 16-bit Integer\n#    Can't predefine zero padding and space padding before hand without\n#    knowing the value being formatted, so grabbing precision and using that\n#    to zero pad, ignoring width. Same with B, O, and Z\n# B: Binary Integer\n# O: Octal Integer\n# Z: Hexadecimal Integer\n# F: Float (64-bit; fixed decimal notation)\n# EN: Float (engineering fortran format, exponential multiple of thee\n# ES: Float (scientific, same as EN but non-zero leading digit\n# E: Float, exponential notation\n#    Can't get exponential restriction to work without knowing value\n#    before hand, so just using width and precision, same with D, G, EN, and\n#    ES formats\n# D: Double-precision Floating Point with exponential\n#    (E but for double precision)\n# G: Double-precision Floating Point, may or may not show exponent\nTDISP_FMT_DICT = {\n    'I': '{{:{width}d}}',\n    'B': '{{:{width}b}}',\n    'O': '{{:{width}o}}',\n    'Z': '{{:{width}x}}',\n    'F': '{{:{width}.{precision}f}}',\n    'G': '{{:{width}.{precision}g}}'\n}\nTDISP_FMT_DICT['A'] = TDISP_FMT_DICT['L'] = '{{:>{width}}}'\nTDISP_FMT_DICT['E'] = TDISP_FMT_DICT['D'] =  \\\n    TDISP_FMT_DICT['EN'] = TDISP_FMT_DICT['ES'] = '{{:{width}.{precision}e}}'\n\n# tuple of column/field definition common names and keyword names, make\n# sure to preserve the one-to-one correspondence when updating the list(s).\n# Use lists, instead of dictionaries so the names can be displayed in a\n# preferred order.\nKEYWORD_NAMES = ('TTYPE', 'TFORM', 'TUNIT', 'TNULL', 'TSCAL', 'TZERO',\n                 'TDISP', 'TBCOL', 'TDIM', 'TCTYP', 'TCUNI', 'TCRPX',\n                 'TCRVL', 'TCDLT', 'TRPOS')\nKEYWORD_ATTRIBUTES = ('name', 'format', 'unit', 'null', 'bscale', 'bzero',\n                      'disp', 'start', 'dim', 'coord_type', 'coord_unit',\n                      'coord_ref_point', 'coord_ref_value', 'coord_inc',\n                      'time_ref_pos')\n\"\"\"This is a list of the attributes that can be set on `Column` objects.\"\"\"\n\n\nKEYWORD_TO_ATTRIBUTE = OrderedDict(zip(KEYWORD_NAMES, KEYWORD_ATTRIBUTES))\n\nATTRIBUTE_TO_KEYWORD = OrderedDict(zip(KEYWORD_ATTRIBUTES, KEYWORD_NAMES))\n\n\n# TODO: Define a list of default comments to associate with each table keyword\n\n# TFORMn regular expression\nTFORMAT_RE = re.compile(r'(?P<repeat>^[0-9]*)(?P<format>[LXBIJKAEDCMPQ])'\n                        r'(?P<option>[!-~]*)', re.I)\n\n# TFORMn for ASCII tables; two different versions depending on whether\n# the format is floating-point or not; allows empty values for width\n# in which case defaults are used\nTFORMAT_ASCII_RE = re.compile(r'(?:(?P<format>[AIJ])(?P<width>[0-9]+)?)|'\n                              r'(?:(?P<formatf>[FED])'\n                              r'(?:(?P<widthf>[0-9]+)\\.'\n                              r'(?P<precision>[0-9]+))?)')\n\nTTYPE_RE = re.compile(r'[0-9a-zA-Z_]+')\n\"\"\"\nRegular expression for valid table column names.  See FITS Standard v3.0 section\n7.2.2.\n\"\"\"\n\n# table definition keyword regular expression\nTDEF_RE = re.compile(r'(?P<label>^T[A-Z]*)(?P<num>[1-9][0-9 ]*$)')\n\n# table dimension keyword regular expression (fairly flexible with whitespace)\nTDIM_RE = re.compile(r'\\(\\s*(?P<dims>(?:\\d+\\s*)(?:,\\s*\\d+\\s*)*\\s*)\\)\\s*')\n\n# value for ASCII table cell with value = TNULL\n# this can be reset by user.\nASCIITNULL = 0\n\n# The default placeholder to use for NULL values in ASCII tables when\n# converting from binary to ASCII tables\nDEFAULT_ASCII_TNULL = '---'\n\n\nclass Delayed:\n    \"\"\"Delayed file-reading data.\"\"\"\n\n    def __init__(self, hdu=None, field=None):\n        self.hdu = weakref.proxy(hdu)\n        self.field = field\n\n    def __getitem__(self, key):\n        # This forces the data for the HDU to be read, which will replace\n        # the corresponding Delayed objects in the Tables Columns to be\n        # transformed into ndarrays.  It will also return the value of the\n        # requested data element.\n        return self.hdu.data[key][self.field]\n\n\nclass _BaseColumnFormat(str):\n    \"\"\"\n    Base class for binary table column formats (just called _ColumnFormat)\n    and ASCII table column formats (_AsciiColumnFormat).\n    \"\"\"\n\n    def __eq__(self, other):\n        if not other:\n            return False\n\n        if isinstance(other, str):\n            if not isinstance(other, self.__class__):\n                try:\n                    other = self.__class__(other)\n                except ValueError:\n                    return False\n        else:\n            return False\n\n        return self.canonical == other.canonical\n\n    def __hash__(self):\n        return hash(self.canonical)\n\n    @lazyproperty\n    def dtype(self):\n        \"\"\"\n        The Numpy dtype object created from the format's associated recformat.\n        \"\"\"\n\n        return np.dtype(self.recformat)\n\n    @classmethod\n    def from_column_format(cls, format):\n        \"\"\"Creates a column format object from another column format object\n        regardless of their type.\n\n        That is, this can convert a _ColumnFormat to an _AsciiColumnFormat\n        or vice versa at least in cases where a direct translation is possible.\n        \"\"\"\n\n        return cls.from_recformat(format.recformat)\n\n\nclass _ColumnFormat(_BaseColumnFormat):\n    \"\"\"\n    Represents a FITS binary table column format.\n\n    This is an enhancement over using a normal string for the format, since the\n    repeat count, format code, and option are available as separate attributes,\n    and smart comparison is used.  For example 1J == J.\n    \"\"\"\n\n    def __new__(cls, format):\n        self = super().__new__(cls, format)\n        self.repeat, self.format, self.option = _parse_tformat(format)\n        self.format = self.format.upper()\n        if self.format in ('P', 'Q'):\n            # TODO: There should be a generic factory that returns either\n            # _FormatP or _FormatQ as appropriate for a given TFORMn\n            if self.format == 'P':\n                recformat = _FormatP.from_tform(format)\n            else:\n                recformat = _FormatQ.from_tform(format)\n            # Format of variable length arrays\n            self.p_format = recformat.format\n        else:\n            self.p_format = None\n        return self\n\n    @classmethod\n    def from_recformat(cls, recformat):\n        \"\"\"Creates a column format from a Numpy record dtype format.\"\"\"\n\n        return cls(_convert_format(recformat, reverse=True))\n\n    @lazyproperty\n    def recformat(self):\n        \"\"\"Returns the equivalent Numpy record format string.\"\"\"\n\n        return _convert_format(self)\n\n    @lazyproperty\n    def canonical(self):\n        \"\"\"\n        Returns a 'canonical' string representation of this format.\n\n        This is in the proper form of rTa where T is the single character data\n        type code, a is the optional part, and r is the repeat.  If repeat == 1\n        (the default) it is left out of this representation.\n        \"\"\"\n\n        if self.repeat == 1:\n            repeat = ''\n        else:\n            repeat = str(self.repeat)\n\n        return f'{repeat}{self.format}{self.option}'\n\n\nclass _AsciiColumnFormat(_BaseColumnFormat):\n    \"\"\"Similar to _ColumnFormat but specifically for columns in ASCII tables.\n\n    The formats of ASCII table columns and binary table columns are inherently\n    incompatible in FITS.  They don't support the same ranges and types of\n    values, and even reuse format codes in subtly different ways.  For example\n    the format code 'Iw' in ASCII columns refers to any integer whose string\n    representation is at most w characters wide, so 'I' can represent\n    effectively any integer that will fit in a FITS columns.  Whereas for\n    binary tables 'I' very explicitly refers to a 16-bit signed integer.\n\n    Conversions between the two column formats can be performed using the\n    ``to/from_binary`` methods on this class, or the ``to/from_ascii``\n    methods on the `_ColumnFormat` class.  But again, not all conversions are\n    possible and may result in a `ValueError`.\n    \"\"\"\n\n    def __new__(cls, format, strict=False):\n        self = super().__new__(cls, format)\n        self.format, self.width, self.precision = \\\n            _parse_ascii_tformat(format, strict)\n\n        # If no width has been specified, set the dtype here to default as well\n        if format == self.format:\n            self.recformat = ASCII2NUMPY[format]\n\n        # This is to support handling logical (boolean) data from binary tables\n        # in an ASCII table\n        self._pseudo_logical = False\n        return self\n\n    @classmethod\n    def from_column_format(cls, format):\n        inst = cls.from_recformat(format.recformat)\n        # Hack\n        if format.format == 'L':\n            inst._pseudo_logical = True\n        return inst\n\n    @classmethod\n    def from_recformat(cls, recformat):\n        \"\"\"Creates a column format from a Numpy record dtype format.\"\"\"\n\n        return cls(_convert_ascii_format(recformat, reverse=True))\n\n    @lazyproperty\n    def recformat(self):\n        \"\"\"Returns the equivalent Numpy record format string.\"\"\"\n\n        return _convert_ascii_format(self)\n\n    @lazyproperty\n    def canonical(self):\n        \"\"\"\n        Returns a 'canonical' string representation of this format.\n\n        This is in the proper form of Tw.d where T is the single character data\n        type code, w is the width in characters for this field, and d is the\n        number of digits after the decimal place (for format codes 'E', 'F',\n        and 'D' only).\n        \"\"\"\n\n        if self.format in ('E', 'F', 'D'):\n            return f'{self.format}{self.width}.{self.precision}'\n\n        return f'{self.format}{self.width}'\n\n\nclass _FormatX(str):\n    \"\"\"For X format in binary tables.\"\"\"\n\n    def __new__(cls, repeat=1):\n        nbytes = ((repeat - 1) // 8) + 1\n        # use an array, even if it is only ONE u1 (i.e. use tuple always)\n        obj = super().__new__(cls, repr((nbytes,)) + 'u1')\n        obj.repeat = repeat\n        return obj\n\n    def __getnewargs__(self):\n        return (self.repeat,)\n\n    @property\n    def tform(self):\n        return f'{self.repeat}X'\n\n\n# TODO: Table column formats need to be verified upon first reading the file;\n# as it is, an invalid P format will raise a VerifyError from some deep,\n# unexpected place\nclass _FormatP(str):\n    \"\"\"For P format in variable length table.\"\"\"\n\n    # As far as I can tell from my reading of the FITS standard, a type code is\n    # *required* for P and Q formats; there is no default\n    _format_re_template = (r'(?P<repeat>\\d+)?{}(?P<dtype>[LXBIJKAEDCM])'\n                           r'(?:\\((?P<max>\\d*)\\))?')\n    _format_code = 'P'\n    _format_re = re.compile(_format_re_template.format(_format_code))\n    _descriptor_format = '2i4'\n\n    def __new__(cls, dtype, repeat=None, max=None):\n        obj = super().__new__(cls, cls._descriptor_format)\n        obj.format = NUMPY2FITS[dtype]\n        obj.dtype = dtype\n        obj.repeat = repeat\n        obj.max = max\n        return obj\n\n    def __getnewargs__(self):\n        return (self.dtype, self.repeat, self.max)\n\n    @classmethod\n    def from_tform(cls, format):\n        m = cls._format_re.match(format)\n        if not m or m.group('dtype') not in FITS2NUMPY:\n            raise VerifyError(f'Invalid column format: {format}')\n        repeat = m.group('repeat')\n        array_dtype = m.group('dtype')\n        max = m.group('max')\n        if not max:\n            max = None\n        return cls(FITS2NUMPY[array_dtype], repeat=repeat, max=max)\n\n    @property\n    def tform(self):\n        repeat = '' if self.repeat is None else self.repeat\n        max = '' if self.max is None else self.max\n        return f'{repeat}{self._format_code}{self.format}({max})'\n\n\nclass _FormatQ(_FormatP):\n    \"\"\"Carries type description of the Q format for variable length arrays.\n\n    The Q format is like the P format but uses 64-bit integers in the array\n    descriptors, allowing for heaps stored beyond 2GB into a file.\n    \"\"\"\n\n    _format_code = 'Q'\n    _format_re = re.compile(_FormatP._format_re_template.format(_format_code))\n    _descriptor_format = '2i8'\n\n\nclass ColumnAttribute:\n    \"\"\"\n    Descriptor for attributes of `Column` that are associated with keywords\n    in the FITS header and describe properties of the column as specified in\n    the FITS standard.\n\n    Each `ColumnAttribute` may have a ``validator`` method defined on it.\n    This validates values set on this attribute to ensure that they meet the\n    FITS standard.  Invalid values will raise a warning and will not be used in\n    formatting the column.  The validator should take two arguments--the\n    `Column` it is being assigned to, and the new value for the attribute, and\n    it must raise an `AssertionError` if the value is invalid.\n\n    The `ColumnAttribute` itself is a decorator that can be used to define the\n    ``validator`` for each column attribute.  For example::\n\n        @ColumnAttribute('TTYPE')\n        def name(col, name):\n            if not isinstance(name, str):\n                raise AssertionError\n\n    The actual object returned by this decorator is the `ColumnAttribute`\n    instance though, not the ``name`` function.  As such ``name`` is not a\n    method of the class it is defined in.\n\n    The setter for `ColumnAttribute` also updates the header of any table\n    HDU this column is attached to in order to reflect the change.  The\n    ``validator`` should ensure that the value is valid for inclusion in a FITS\n    header.\n    \"\"\"\n\n    def __init__(self, keyword):\n        self._keyword = keyword\n        self._validator = None\n\n        # The name of the attribute associated with this keyword is currently\n        # determined from the KEYWORD_NAMES/ATTRIBUTES lists.  This could be\n        # make more flexible in the future, for example, to support custom\n        # column attributes.\n        self._attr = '_' + KEYWORD_TO_ATTRIBUTE[self._keyword]\n\n    def __get__(self, obj, objtype=None):\n        if obj is None:\n            return self\n        else:\n            return getattr(obj, self._attr)\n\n    def __set__(self, obj, value):\n        if self._validator is not None:\n            self._validator(obj, value)\n\n        old_value = getattr(obj, self._attr, None)\n        setattr(obj, self._attr, value)\n        obj._notify('column_attribute_changed', obj, self._attr[1:], old_value,\n                    value)\n\n    def __call__(self, func):\n        \"\"\"\n        Set the validator for this column attribute.\n\n        Returns ``self`` so that this can be used as a decorator, as described\n        in the docs for this class.\n        \"\"\"\n\n        self._validator = func\n\n        return self\n\n    def __repr__(self):\n        return f\"{self.__class__.__name__}('{self._keyword}')\"\n\n\nclass Column(NotifierMixin):\n    \"\"\"\n    Class which contains the definition of one column, e.g.  ``ttype``,\n    ``tform``, etc. and the array containing values for the column.\n    \"\"\"\n\n    def __init__(self, name=None, format=None, unit=None, null=None,\n                 bscale=None, bzero=None, disp=None, start=None, dim=None,\n                 array=None, ascii=None, coord_type=None, coord_unit=None,\n                 coord_ref_point=None, coord_ref_value=None, coord_inc=None,\n                 time_ref_pos=None):\n        \"\"\"\n        Construct a `Column` by specifying attributes.  All attributes\n        except ``format`` can be optional; see :ref:`astropy:column_creation`\n        and :ref:`astropy:creating_ascii_table` for more information regarding\n        ``TFORM`` keyword.\n\n        Parameters\n        ----------\n        name : str, optional\n            column name, corresponding to ``TTYPE`` keyword\n\n        format : str\n            column format, corresponding to ``TFORM`` keyword\n\n        unit : str, optional\n            column unit, corresponding to ``TUNIT`` keyword\n\n        null : str, optional\n            null value, corresponding to ``TNULL`` keyword\n\n        bscale : int-like, optional\n            bscale value, corresponding to ``TSCAL`` keyword\n\n        bzero : int-like, optional\n            bzero value, corresponding to ``TZERO`` keyword\n\n        disp : str, optional\n            display format, corresponding to ``TDISP`` keyword\n\n        start : int, optional\n            column starting position (ASCII table only), corresponding\n            to ``TBCOL`` keyword\n\n        dim : str, optional\n            column dimension corresponding to ``TDIM`` keyword\n\n        array : iterable, optional\n            a `list`, `numpy.ndarray` (or other iterable that can be used to\n            initialize an ndarray) providing initial data for this column.\n            The array will be automatically converted, if possible, to the data\n            format of the column.  In the case were non-trivial ``bscale``\n            and/or ``bzero`` arguments are given, the values in the array must\n            be the *physical* values--that is, the values of column as if the\n            scaling has already been applied (the array stored on the column\n            object will then be converted back to its storage values).\n\n        ascii : bool, optional\n            set `True` if this describes a column for an ASCII table; this\n            may be required to disambiguate the column format\n\n        coord_type : str, optional\n            coordinate/axis type corresponding to ``TCTYP`` keyword\n\n        coord_unit : str, optional\n            coordinate/axis unit corresponding to ``TCUNI`` keyword\n\n        coord_ref_point : int-like, optional\n            pixel coordinate of the reference point corresponding to ``TCRPX``\n            keyword\n\n        coord_ref_value : int-like, optional\n            coordinate value at reference point corresponding to ``TCRVL``\n            keyword\n\n        coord_inc : int-like, optional\n            coordinate increment at reference point corresponding to ``TCDLT``\n            keyword\n\n        time_ref_pos : str, optional\n            reference position for a time coordinate column corresponding to\n            ``TRPOS`` keyword\n        \"\"\"\n\n        if format is None:\n            raise ValueError('Must specify format to construct Column.')\n\n        # any of the input argument (except array) can be a Card or just\n        # a number/string\n        kwargs = {'ascii': ascii}\n        for attr in KEYWORD_ATTRIBUTES:\n            value = locals()[attr]  # get the argument's value\n\n            if isinstance(value, Card):\n                value = value.value\n\n            kwargs[attr] = value\n\n        valid_kwargs, invalid_kwargs = self._verify_keywords(**kwargs)\n\n        if invalid_kwargs:\n            msg = ['The following keyword arguments to Column were invalid:']\n\n            for val in invalid_kwargs.values():\n                msg.append(indent(val[1]))\n\n            raise VerifyError('\\n'.join(msg))\n\n        for attr in KEYWORD_ATTRIBUTES:\n            setattr(self, attr, valid_kwargs.get(attr))\n\n        # TODO: Try to eliminate the following two special cases\n        # for recformat and dim:\n        # This is not actually stored as an attribute on columns for some\n        # reason\n        recformat = valid_kwargs['recformat']\n\n        # The 'dim' keyword's original value is stored in self.dim, while\n        # *only* the tuple form is stored in self._dims.\n        self._dims = self.dim\n        self.dim = dim\n\n        # Awful hack to use for now to keep track of whether the column holds\n        # pseudo-unsigned int data\n        self._pseudo_unsigned_ints = False\n\n        # if the column data is not ndarray, make it to be one, i.e.\n        # input arrays can be just list or tuple, not required to be ndarray\n        # does not include Object array because there is no guarantee\n        # the elements in the object array are consistent.\n        if not isinstance(array,\n                          (np.ndarray, chararray.chararray, Delayed)):\n            try:  # try to convert to a ndarray first\n                if array is not None:\n                    array = np.array(array)\n            except Exception:\n                try:  # then try to convert it to a strings array\n                    itemsize = int(recformat[1:])\n                    array = chararray.array(array, itemsize=itemsize)\n                except ValueError:\n                    # then try variable length array\n                    # Note: This includes _FormatQ by inheritance\n                    if isinstance(recformat, _FormatP):\n                        array = _VLF(array, dtype=recformat.dtype)\n                    else:\n                        raise ValueError('Data is inconsistent with the '\n                                         'format `{}`.'.format(format))\n\n        array = self._convert_to_valid_data_type(array)\n\n        # We have required (through documentation) that arrays passed in to\n        # this constructor are already in their physical values, so we make\n        # note of that here\n        if isinstance(array, np.ndarray):\n            self._physical_values = True\n        else:\n            self._physical_values = False\n\n        self._parent_fits_rec = None\n        self.array = array\n\n    def __repr__(self):\n        text = ''\n        for attr in KEYWORD_ATTRIBUTES:\n            value = getattr(self, attr)\n            if value is not None:\n                text += attr + ' = ' + repr(value) + '; '\n        return text[:-2]\n\n    def __eq__(self, other):\n        \"\"\"\n        Two columns are equal if their name and format are the same.  Other\n        attributes aren't taken into account at this time.\n        \"\"\"\n\n        # According to the FITS standard column names must be case-insensitive\n        a = (self.name.lower(), self.format)\n        b = (other.name.lower(), other.format)\n        return a == b\n\n    def __hash__(self):\n        \"\"\"\n        Like __eq__, the hash of a column should be based on the unique column\n        name and format, and be case-insensitive with respect to the column\n        name.\n        \"\"\"\n\n        return hash((self.name.lower(), self.format))\n\n    @property\n    def array(self):\n        \"\"\"\n        The Numpy `~numpy.ndarray` associated with this `Column`.\n\n        If the column was instantiated with an array passed to the ``array``\n        argument, this will return that array.  However, if the column is\n        later added to a table, such as via `BinTableHDU.from_columns` as\n        is typically the case, this attribute will be updated to reference\n        the associated field in the table, which may no longer be the same\n        array.\n        \"\"\"\n\n        # Ideally the .array attribute never would have existed in the first\n        # place, or would have been internal-only.  This is a legacy of the\n        # older design from Astropy that needs to have continued support, for\n        # now.\n\n        # One of the main problems with this design was that it created a\n        # reference cycle.  When the .array attribute was updated after\n        # creating a FITS_rec from the column (as explained in the docstring) a\n        # reference cycle was created.  This is because the code in BinTableHDU\n        # (and a few other places) does essentially the following:\n        #\n        # data._coldefs = columns  # The ColDefs object holding this Column\n        # for col in columns:\n        #     col.array = data.field(col.name)\n        #\n        # This way each columns .array attribute now points to the field in the\n        # table data.  It's actually a pretty confusing interface (since it\n        # replaces the array originally pointed to by .array), but it's the way\n        # things have been for a long, long time.\n        #\n        # However, this results, in *many* cases, in a reference cycle.\n        # Because the array returned by data.field(col.name), while sometimes\n        # an array that owns its own data, is usually like a slice of the\n        # original data.  It has the original FITS_rec as the array .base.\n        # This results in the following reference cycle (for the n-th column):\n        #\n        #    data -> data._coldefs -> data._coldefs[n] ->\n        #     data._coldefs[n].array -> data._coldefs[n].array.base -> data\n        #\n        # Because ndarray objects do not handled by Python's garbage collector\n        # the reference cycle cannot be broken.  Therefore the FITS_rec's\n        # refcount never goes to zero, its __del__ is never called, and its\n        # memory is never freed.  This didn't occur in *all* cases, but it did\n        # occur in many cases.\n        #\n        # To get around this, Column.array is no longer a simple attribute\n        # like it was previously.  Now each Column has a ._parent_fits_rec\n        # attribute which is a weakref to a FITS_rec object.  Code that\n        # previously assigned each col.array to field in a FITS_rec (as in\n        # the example a few paragraphs above) is still used, however now\n        # array.setter checks if a reference cycle will be created.  And if\n        # so, instead of saving directly to the Column's __dict__, it creates\n        # the ._prent_fits_rec weakref, and all lookups of the column's .array\n        # go through that instead.\n        #\n        # This alone does not fully solve the problem.  Because\n        # _parent_fits_rec is a weakref, if the user ever holds a reference to\n        # the Column, but deletes all references to the underlying FITS_rec,\n        # the .array attribute would suddenly start returning None instead of\n        # the array data.  This problem is resolved on FITS_rec's end.  See the\n        # note in the FITS_rec._coldefs property for the rest of the story.\n\n        # If the Columns's array is not a reference to an existing FITS_rec,\n        # then it is just stored in self.__dict__; otherwise check the\n        # _parent_fits_rec reference if it 's still available.\n        if 'array' in self.__dict__:\n            return self.__dict__['array']\n        elif self._parent_fits_rec is not None:\n            parent = self._parent_fits_rec()\n            if parent is not None:\n                return parent[self.name]\n        else:\n            return None\n\n    @array.setter\n    def array(self, array):\n        # The following looks over the bases of the given array to check if it\n        # has a ._coldefs attribute (i.e. is a FITS_rec) and that that _coldefs\n        # contains this Column itself, and would create a reference cycle if we\n        # stored the array directly in self.__dict__.\n        # In this case it instead sets up the _parent_fits_rec weakref to the\n        # underlying FITS_rec, so that array.getter can return arrays through\n        # self._parent_fits_rec().field(self.name), rather than storing a\n        # hard reference to the field like it used to.\n        base = array\n        while True:\n            if (hasattr(base, '_coldefs') and\n                    isinstance(base._coldefs, ColDefs)):\n                for col in base._coldefs:\n                    if col is self and self._parent_fits_rec is None:\n                        self._parent_fits_rec = weakref.ref(base)\n\n                        # Just in case the user already set .array to their own\n                        # array.\n                        if 'array' in self.__dict__:\n                            del self.__dict__['array']\n                        return\n\n            if getattr(base, 'base', None) is not None:\n                base = base.base\n            else:\n                break\n\n        self.__dict__['array'] = array\n\n    @array.deleter\n    def array(self):\n        try:\n            del self.__dict__['array']\n        except KeyError:\n            pass\n\n        self._parent_fits_rec = None\n\n    @ColumnAttribute('TTYPE')\n    def name(col, name):\n        if name is None:\n            # Allow None to indicate deleting the name, or to just indicate an\n            # unspecified name (when creating a new Column).\n            return\n\n        # Check that the name meets the recommended standard--other column\n        # names are *allowed*, but will be discouraged\n        if isinstance(name, str) and not TTYPE_RE.match(name):\n            warnings.warn(\n                'It is strongly recommended that column names contain only '\n                'upper and lower-case ASCII letters, digits, or underscores '\n                'for maximum compatibility with other software '\n                '(got {!r}).'.format(name), VerifyWarning)\n\n        # This ensures that the new name can fit into a single FITS card\n        # without any special extension like CONTINUE cards or the like.\n        if (not isinstance(name, str)\n                or len(str(Card('TTYPE', name))) != CARD_LENGTH):\n            raise AssertionError(\n                'Column name must be a string able to fit in a single '\n                'FITS card--typically this means a maximum of 68 '\n                'characters, though it may be fewer if the string '\n                'contains special characters like quotes.')\n\n    @ColumnAttribute('TCTYP')\n    def coord_type(col, coord_type):\n        if coord_type is None:\n            return\n\n        if (not isinstance(coord_type, str)\n                or len(coord_type) > 8):\n            raise AssertionError(\n                'Coordinate/axis type must be a string of atmost 8 '\n                'characters.')\n\n    @ColumnAttribute('TCUNI')\n    def coord_unit(col, coord_unit):\n        if (coord_unit is not None\n                and not isinstance(coord_unit, str)):\n            raise AssertionError(\n                'Coordinate/axis unit must be a string.')\n\n    @ColumnAttribute('TCRPX')\n    def coord_ref_point(col, coord_ref_point):\n        if (coord_ref_point is not None\n                and not isinstance(coord_ref_point, numbers.Real)):\n            raise AssertionError(\n                'Pixel coordinate of the reference point must be '\n                'real floating type.')\n\n    @ColumnAttribute('TCRVL')\n    def coord_ref_value(col, coord_ref_value):\n        if (coord_ref_value is not None\n                and not isinstance(coord_ref_value, numbers.Real)):\n            raise AssertionError(\n                'Coordinate value at reference point must be real '\n                'floating type.')\n\n    @ColumnAttribute('TCDLT')\n    def coord_inc(col, coord_inc):\n        if (coord_inc is not None\n                and not isinstance(coord_inc, numbers.Real)):\n            raise AssertionError(\n                'Coordinate increment must be real floating type.')\n\n    @ColumnAttribute('TRPOS')\n    def time_ref_pos(col, time_ref_pos):\n        if (time_ref_pos is not None\n                and not isinstance(time_ref_pos, str)):\n            raise AssertionError(\n                'Time reference position must be a string.')\n\n    format = ColumnAttribute('TFORM')\n    unit = ColumnAttribute('TUNIT')\n    null = ColumnAttribute('TNULL')\n    bscale = ColumnAttribute('TSCAL')\n    bzero = ColumnAttribute('TZERO')\n    disp = ColumnAttribute('TDISP')\n    start = ColumnAttribute('TBCOL')\n    dim = ColumnAttribute('TDIM')\n\n    @lazyproperty\n    def ascii(self):\n        \"\"\"Whether this `Column` represents a column in an ASCII table.\"\"\"\n\n        return isinstance(self.format, _AsciiColumnFormat)\n\n    @lazyproperty\n    def dtype(self):\n        return self.format.dtype\n\n    def copy(self):\n        \"\"\"\n        Return a copy of this `Column`.\n        \"\"\"\n        tmp = Column(format='I')  # just use a throw-away format\n        tmp.__dict__ = self.__dict__.copy()\n        return tmp\n\n    @staticmethod\n    def _convert_format(format, cls):\n        \"\"\"The format argument to this class's initializer may come in many\n        forms.  This uses the given column format class ``cls`` to convert\n        to a format of that type.\n\n        TODO: There should be an abc base class for column format classes\n        \"\"\"\n\n        # Short circuit in case we're already a _BaseColumnFormat--there is at\n        # least one case in which this can happen\n        if isinstance(format, _BaseColumnFormat):\n            return format, format.recformat\n\n        if format in NUMPY2FITS:\n            with suppress(VerifyError):\n                # legit recarray format?\n                recformat = format\n                format = cls.from_recformat(format)\n\n        try:\n            # legit FITS format?\n            format = cls(format)\n            recformat = format.recformat\n        except VerifyError:\n            raise VerifyError(f'Illegal format `{format}`.')\n\n        return format, recformat\n\n    @classmethod\n    def _verify_keywords(cls, name=None, format=None, unit=None, null=None,\n                         bscale=None, bzero=None, disp=None, start=None,\n                         dim=None, ascii=None, coord_type=None, coord_unit=None,\n                         coord_ref_point=None, coord_ref_value=None,\n                         coord_inc=None, time_ref_pos=None):\n        \"\"\"\n        Given the keyword arguments used to initialize a Column, specifically\n        those that typically read from a FITS header (so excluding array),\n        verify that each keyword has a valid value.\n\n        Returns a 2-tuple of dicts.  The first maps valid keywords to their\n        values.  The second maps invalid keywords to a 2-tuple of their value,\n        and a message explaining why they were found invalid.\n        \"\"\"\n\n        valid = {}\n        invalid = {}\n\n        try:\n            format, recformat = cls._determine_formats(format, start, dim, ascii)\n            valid.update(format=format, recformat=recformat)\n        except (ValueError, VerifyError) as err:\n            msg = (\n                f'Column format option (TFORMn) failed verification: {err!s} '\n                'The invalid value will be ignored for the purpose of '\n                'formatting the data in this column.')\n            invalid['format'] = (format, msg)\n        except AttributeError as err:\n            msg = (\n                f'Column format option (TFORMn) must be a string with a valid '\n                f'FITS table format (got {format!s}: {err!s}). '\n                'The invalid value will be ignored for the purpose of '\n                'formatting the data in this column.')\n            invalid['format'] = (format, msg)\n\n        # Currently we don't have any validation for name, unit, bscale, or\n        # bzero so include those by default\n        # TODO: Add validation for these keywords, obviously\n        for k, v in [('name', name), ('unit', unit), ('bscale', bscale),\n                     ('bzero', bzero)]:\n            if v is not None and v != '':\n                valid[k] = v\n\n        # Validate null option\n        # Note: Enough code exists that thinks empty strings are sensible\n        # inputs for these options that we need to treat '' as None\n        if null is not None and null != '':\n            msg = None\n            if isinstance(format, _AsciiColumnFormat):\n                null = str(null)\n                if len(null) > format.width:\n                    msg = (\n                        \"ASCII table null option (TNULLn) is longer than \"\n                        \"the column's character width and will be truncated \"\n                        \"(got {!r}).\".format(null))\n            else:\n                tnull_formats = ('B', 'I', 'J', 'K')\n\n                if not _is_int(null):\n                    # Make this an exception instead of a warning, since any\n                    # non-int value is meaningless\n                    msg = (\n                        'Column null option (TNULLn) must be an integer for '\n                        'binary table columns (got {!r}).  The invalid value '\n                        'will be ignored for the purpose of formatting '\n                        'the data in this column.'.format(null))\n\n                elif not (format.format in tnull_formats or\n                          (format.format in ('P', 'Q') and\n                           format.p_format in tnull_formats)):\n                    # TODO: We should also check that TNULLn's integer value\n                    # is in the range allowed by the column's format\n                    msg = (\n                        'Column null option (TNULLn) is invalid for binary '\n                        'table columns of type {!r} (got {!r}).  The invalid '\n                        'value will be ignored for the purpose of formatting '\n                        'the data in this column.'.format(format, null))\n\n            if msg is None:\n                valid['null'] = null\n            else:\n                invalid['null'] = (null, msg)\n\n        # Validate the disp option\n        # TODO: Add full parsing and validation of TDISPn keywords\n        if disp is not None and disp != '':\n            msg = None\n            if not isinstance(disp, str):\n                msg = (\n                    f'Column disp option (TDISPn) must be a string (got '\n                    f'{disp!r}). The invalid value will be ignored for the '\n                    'purpose of formatting the data in this column.')\n\n            elif (isinstance(format, _AsciiColumnFormat) and\n                    disp[0].upper() == 'L'):\n                # disp is at least one character long and has the 'L' format\n                # which is not recognized for ASCII tables\n                msg = (\n                    \"Column disp option (TDISPn) may not use the 'L' format \"\n                    \"with ASCII table columns.  The invalid value will be \"\n                    \"ignored for the purpose of formatting the data in this \"\n                    \"column.\")\n\n            if msg is None:\n                try:\n                    _parse_tdisp_format(disp)\n                    valid['disp'] = disp\n                except VerifyError as err:\n                    msg = (\n                        f'Column disp option (TDISPn) failed verification: '\n                        f'{err!s} The invalid value will be ignored for the '\n                        'purpose of formatting the data in this column.')\n                    invalid['disp'] = (disp, msg)\n            else:\n                invalid['disp'] = (disp, msg)\n\n        # Validate the start option\n        if start is not None and start != '':\n            msg = None\n            if not isinstance(format, _AsciiColumnFormat):\n                # The 'start' option only applies to ASCII columns\n                msg = (\n                    'Column start option (TBCOLn) is not allowed for binary '\n                    'table columns (got {!r}).  The invalid keyword will be '\n                    'ignored for the purpose of formatting the data in this '\n                    'column.'.format(start))\n            else:\n                try:\n                    start = int(start)\n                except (TypeError, ValueError):\n                    pass\n\n                if not _is_int(start) or start < 1:\n                    msg = (\n                        'Column start option (TBCOLn) must be a positive integer '\n                        '(got {!r}).  The invalid value will be ignored for the '\n                        'purpose of formatting the data in this column.'.format(start))\n\n            if msg is None:\n                valid['start'] = start\n            else:\n                invalid['start'] = (start, msg)\n\n        # Process TDIMn options\n        # ASCII table columns can't have a TDIMn keyword associated with it;\n        # for now we just issue a warning and ignore it.\n        # TODO: This should be checked by the FITS verification code\n        if dim is not None and dim != '':\n            msg = None\n            dims_tuple = tuple()\n            # NOTE: If valid, the dim keyword's value in the the valid dict is\n            # a tuple, not the original string; if invalid just the original\n            # string is returned\n            if isinstance(format, _AsciiColumnFormat):\n                msg = (\n                    'Column dim option (TDIMn) is not allowed for ASCII table '\n                    'columns (got {!r}).  The invalid keyword will be ignored '\n                    'for the purpose of formatting this column.'.format(dim))\n\n            elif isinstance(dim, str):\n                dims_tuple = _parse_tdim(dim)\n            elif isinstance(dim, tuple):\n                dims_tuple = dim\n            else:\n                msg = (\n                    \"`dim` argument must be a string containing a valid value \"\n                    \"for the TDIMn header keyword associated with this column, \"\n                    \"or a tuple containing the C-order dimensions for the \"\n                    \"column.  The invalid value will be ignored for the purpose \"\n                    \"of formatting this column.\")\n\n            if dims_tuple:\n                if reduce(operator.mul, dims_tuple) > format.repeat:\n                    msg = (\n                        \"The repeat count of the column format {!r} for column {!r} \"\n                        \"is fewer than the number of elements per the TDIM \"\n                        \"argument {!r}.  The invalid TDIMn value will be ignored \"\n                        \"for the purpose of formatting this column.\".format(\n                            name, format, dim))\n\n            if msg is None:\n                valid['dim'] = dims_tuple\n            else:\n                invalid['dim'] = (dim, msg)\n\n        if coord_type is not None and coord_type != '':\n            msg = None\n            if not isinstance(coord_type, str):\n                msg = (\n                    \"Coordinate/axis type option (TCTYPn) must be a string \"\n                    \"(got {!r}). The invalid keyword will be ignored for the \"\n                    \"purpose of formatting this column.\".format(coord_type))\n            elif len(coord_type) > 8:\n                msg = (\n                    \"Coordinate/axis type option (TCTYPn) must be a string \"\n                    \"of atmost 8 characters (got {!r}). The invalid keyword \"\n                    \"will be ignored for the purpose of formatting this \"\n                    \"column.\".format(coord_type))\n\n            if msg is None:\n                valid['coord_type'] = coord_type\n            else:\n                invalid['coord_type'] = (coord_type, msg)\n\n        if coord_unit is not None and coord_unit != '':\n            msg = None\n            if not isinstance(coord_unit, str):\n                msg = (\n                    \"Coordinate/axis unit option (TCUNIn) must be a string \"\n                    \"(got {!r}). The invalid keyword will be ignored for the \"\n                    \"purpose of formatting this column.\".format(coord_unit))\n\n            if msg is None:\n                valid['coord_unit'] = coord_unit\n            else:\n                invalid['coord_unit'] = (coord_unit, msg)\n\n        for k, v in [('coord_ref_point', coord_ref_point),\n                     ('coord_ref_value', coord_ref_value),\n                     ('coord_inc', coord_inc)]:\n            if v is not None and v != '':\n                msg = None\n                if not isinstance(v, numbers.Real):\n                    msg = (\n                        \"Column {} option ({}n) must be a real floating type (got {!r}). \"\n                        \"The invalid value will be ignored for the purpose of formatting \"\n                        \"the data in this column.\".format(k, ATTRIBUTE_TO_KEYWORD[k], v))\n\n                if msg is None:\n                    valid[k] = v\n                else:\n                    invalid[k] = (v, msg)\n\n        if time_ref_pos is not None and time_ref_pos != '':\n            msg = None\n            if not isinstance(time_ref_pos, str):\n                msg = (\n                    \"Time coordinate reference position option (TRPOSn) must be \"\n                    \"a string (got {!r}). The invalid keyword will be ignored for \"\n                    \"the purpose of formatting this column.\".format(time_ref_pos))\n\n            if msg is None:\n                valid['time_ref_pos'] = time_ref_pos\n            else:\n                invalid['time_ref_pos'] = (time_ref_pos, msg)\n\n        return valid, invalid\n\n    @classmethod\n    def _determine_formats(cls, format, start, dim, ascii):\n        \"\"\"\n        Given a format string and whether or not the Column is for an\n        ASCII table (ascii=None means unspecified, but lean toward binary table\n        where ambiguous) create an appropriate _BaseColumnFormat instance for\n        the column's format, and determine the appropriate recarray format.\n\n        The values of the start and dim keyword arguments are also useful, as\n        the former is only valid for ASCII tables and the latter only for\n        BINARY tables.\n        \"\"\"\n\n        # If the given format string is unambiguously a Numpy dtype or one of\n        # the Numpy record format type specifiers supported by Astropy then that\n        # should take priority--otherwise assume it is a FITS format\n        if isinstance(format, np.dtype):\n            format, _, _ = _dtype_to_recformat(format)\n\n        # check format\n        if ascii is None and not isinstance(format, _BaseColumnFormat):\n            # We're just give a string which could be either a Numpy format\n            # code, or a format for a binary column array *or* a format for an\n            # ASCII column array--there may be many ambiguities here.  Try our\n            # best to guess what the user intended.\n            format, recformat = cls._guess_format(format, start, dim)\n        elif not ascii and not isinstance(format, _BaseColumnFormat):\n            format, recformat = cls._convert_format(format, _ColumnFormat)\n        elif ascii and not isinstance(format, _AsciiColumnFormat):\n            format, recformat = cls._convert_format(format,\n                                                    _AsciiColumnFormat)\n        else:\n            # The format is already acceptable and unambiguous\n            recformat = format.recformat\n\n        return format, recformat\n\n    @classmethod\n    def _guess_format(cls, format, start, dim):\n        if start and dim:\n            # This is impossible; this can't be a valid FITS column\n            raise ValueError(\n                'Columns cannot have both a start (TCOLn) and dim '\n                '(TDIMn) option, since the former is only applies to '\n                'ASCII tables, and the latter is only valid for binary '\n                'tables.')\n        elif start:\n            # Only ASCII table columns can have a 'start' option\n            guess_format = _AsciiColumnFormat\n        elif dim:\n            # Only binary tables can have a dim option\n            guess_format = _ColumnFormat\n        else:\n            # If the format is *technically* a valid binary column format\n            # (i.e. it has a valid format code followed by arbitrary\n            # \"optional\" codes), but it is also strictly a valid ASCII\n            # table format, then assume an ASCII table column was being\n            # requested (the more likely case, after all).\n            with suppress(VerifyError):\n                format = _AsciiColumnFormat(format, strict=True)\n\n            # A safe guess which reflects the existing behavior of previous\n            # Astropy versions\n            guess_format = _ColumnFormat\n\n        try:\n            format, recformat = cls._convert_format(format, guess_format)\n        except VerifyError:\n            # For whatever reason our guess was wrong (for example if we got\n            # just 'F' that's not a valid binary format, but it an ASCII format\n            # code albeit with the width/precision omitted\n            guess_format = (_AsciiColumnFormat\n                            if guess_format is _ColumnFormat\n                            else _ColumnFormat)\n            # If this fails too we're out of options--it is truly an invalid\n            # format, or at least not supported\n            format, recformat = cls._convert_format(format, guess_format)\n\n        return format, recformat\n\n    def _convert_to_valid_data_type(self, array):\n        # Convert the format to a type we understand\n        if isinstance(array, Delayed):\n            return array\n        elif array is None:\n            return array\n        else:\n            format = self.format\n            dims = self._dims\n\n            if dims:\n                shape = dims[:-1] if 'A' in format else dims\n                shape = (len(array),) + shape\n                array = array.reshape(shape)\n\n            if 'P' in format or 'Q' in format:\n                return array\n            elif 'A' in format:\n                if array.dtype.char in 'SU':\n                    if dims:\n                        # The 'last' dimension (first in the order given\n                        # in the TDIMn keyword itself) is the number of\n                        # characters in each string\n                        fsize = dims[-1]\n                    else:\n                        fsize = np.dtype(format.recformat).itemsize\n                    return chararray.array(array, itemsize=fsize, copy=False)\n                else:\n                    return _convert_array(array, np.dtype(format.recformat))\n            elif 'L' in format:\n                # boolean needs to be scaled back to storage values ('T', 'F')\n                if array.dtype == np.dtype('bool'):\n                    return np.where(array == np.False_, ord('F'), ord('T'))\n                else:\n                    return np.where(array == 0, ord('F'), ord('T'))\n            elif 'X' in format:\n                return _convert_array(array, np.dtype('uint8'))\n            else:\n                # Preserve byte order of the original array for now; see #77\n                numpy_format = array.dtype.byteorder + format.recformat\n\n                # Handle arrays passed in as unsigned ints as pseudo-unsigned\n                # int arrays; blatantly tacked in here for now--we need columns\n                # to have explicit knowledge of whether they treated as\n                # pseudo-unsigned\n                bzeros = {2: np.uint16(2**15), 4: np.uint32(2**31),\n                          8: np.uint64(2**63)}\n                if (array.dtype.kind == 'u' and\n                        array.dtype.itemsize in bzeros and\n                        self.bscale in (1, None, '') and\n                        self.bzero == bzeros[array.dtype.itemsize]):\n                    # Basically the array is uint, has scale == 1.0, and the\n                    # bzero is the appropriate value for a pseudo-unsigned\n                    # integer of the input dtype, then go ahead and assume that\n                    # uint is assumed\n                    numpy_format = numpy_format.replace('i', 'u')\n                    self._pseudo_unsigned_ints = True\n\n                # The .base here means we're dropping the shape information,\n                # which is only used to format recarray fields, and is not\n                # useful for converting input arrays to the correct data type\n                dtype = np.dtype(numpy_format).base\n\n                return _convert_array(array, dtype)\n\n\nclass ColDefs(NotifierMixin):\n    \"\"\"\n    Column definitions class.\n\n    It has attributes corresponding to the `Column` attributes\n    (e.g. `ColDefs` has the attribute ``names`` while `Column`\n    has ``name``). Each attribute in `ColDefs` is a list of\n    corresponding attribute values from all `Column` objects.\n    \"\"\"\n\n    _padding_byte = '\\x00'\n    _col_format_cls = _ColumnFormat\n\n    def __new__(cls, input, ascii=False):\n        klass = cls\n\n        if (hasattr(input, '_columns_type') and\n                issubclass(input._columns_type, ColDefs)):\n            klass = input._columns_type\n        elif (hasattr(input, '_col_format_cls') and\n                issubclass(input._col_format_cls, _AsciiColumnFormat)):\n            klass = _AsciiColDefs\n\n        if ascii:  # force ASCII if this has been explicitly requested\n            klass = _AsciiColDefs\n\n        return object.__new__(klass)\n\n    def __getnewargs__(self):\n        return (self._arrays,)\n\n    def __init__(self, input, ascii=False):\n        \"\"\"\n        Parameters\n        ----------\n\n        input : sequence of `Column` or `ColDefs` or ndarray or `~numpy.recarray`\n            An existing table HDU, an existing `ColDefs`, or any multi-field\n            Numpy array or `numpy.recarray`.\n\n        ascii : bool\n            Use True to ensure that ASCII table columns are used.\n\n        \"\"\"\n        from .hdu.table import _TableBaseHDU\n        from .fitsrec import FITS_rec\n\n        if isinstance(input, ColDefs):\n            self._init_from_coldefs(input)\n        elif (isinstance(input, FITS_rec) and hasattr(input, '_coldefs') and\n                input._coldefs):\n            # If given a FITS_rec object we can directly copy its columns, but\n            # only if its columns have already been defined, otherwise this\n            # will loop back in on itself and blow up\n            self._init_from_coldefs(input._coldefs)\n        elif isinstance(input, np.ndarray) and input.dtype.fields is not None:\n            # Construct columns from the fields of a record array\n            self._init_from_array(input)\n        elif isiterable(input):\n            # if the input is a list of Columns\n            self._init_from_sequence(input)\n        elif isinstance(input, _TableBaseHDU):\n            # Construct columns from fields in an HDU header\n            self._init_from_table(input)\n        else:\n            raise TypeError('Input to ColDefs must be a table HDU, a list '\n                            'of Columns, or a record/field array.')\n\n        # Listen for changes on all columns\n        for col in self.columns:\n            col._add_listener(self)\n\n    def _init_from_coldefs(self, coldefs):\n        \"\"\"Initialize from an existing ColDefs object (just copy the\n        columns and convert their formats if necessary).\n        \"\"\"\n\n        self.columns = [self._copy_column(col) for col in coldefs]\n\n    def _init_from_sequence(self, columns):\n        for idx, col in enumerate(columns):\n            if not isinstance(col, Column):\n                raise TypeError(f'Element {idx} in the ColDefs input is not a Column.')\n\n        self._init_from_coldefs(columns)\n\n    def _init_from_array(self, array):\n        self.columns = []\n        for idx in range(len(array.dtype)):\n            cname = array.dtype.names[idx]\n            ftype = array.dtype.fields[cname][0]\n            format = self._col_format_cls.from_recformat(ftype)\n\n            # Determine the appropriate dimensions for items in the column\n            # (typically just 1D)\n            dim = array.dtype[idx].shape[::-1]\n            if dim and (len(dim) > 0 or 'A' in format):\n                if 'A' in format:\n                    # n x m string arrays must include the max string\n                    # length in their dimensions (e.g. l x n x m)\n                    dim = (array.dtype[idx].base.itemsize,) + dim\n                dim = '(' + ','.join(str(d) for d in dim) + ')'\n            else:\n                dim = None\n\n            # Check for unsigned ints.\n            bzero = None\n            if ftype.base.kind == 'u':\n                if 'I' in format:\n                    bzero = np.uint16(2**15)\n                elif 'J' in format:\n                    bzero = np.uint32(2**31)\n                elif 'K' in format:\n                    bzero = np.uint64(2**63)\n\n            c = Column(name=cname, format=format,\n                       array=array.view(np.ndarray)[cname], bzero=bzero,\n                       dim=dim)\n            self.columns.append(c)\n\n    def _init_from_table(self, table):\n        hdr = table._header\n        nfields = hdr['TFIELDS']\n\n        # go through header keywords to pick out column definition keywords\n        # definition dictionaries for each field\n        col_keywords = [{} for i in range(nfields)]\n        for keyword in hdr:\n            key = TDEF_RE.match(keyword)\n            try:\n                label = key.group('label')\n            except Exception:\n                continue  # skip if there is no match\n            if label in KEYWORD_NAMES:\n                col = int(key.group('num'))\n                if 0 < col <= nfields:\n                    attr = KEYWORD_TO_ATTRIBUTE[label]\n                    value = hdr[keyword]\n                    if attr == 'format':\n                        # Go ahead and convert the format value to the\n                        # appropriate ColumnFormat container now\n                        value = self._col_format_cls(value)\n                    col_keywords[col - 1][attr] = value\n\n        # Verify the column keywords and display any warnings if necessary;\n        # we only want to pass on the valid keywords\n        for idx, kwargs in enumerate(col_keywords):\n            valid_kwargs, invalid_kwargs = Column._verify_keywords(**kwargs)\n            for val in invalid_kwargs.values():\n                warnings.warn(\n                    f'Invalid keyword for column {idx + 1}: {val[1]}',\n                    VerifyWarning)\n            # Special cases for recformat and dim\n            # TODO: Try to eliminate the need for these special cases\n            del valid_kwargs['recformat']\n            if 'dim' in valid_kwargs:\n                valid_kwargs['dim'] = kwargs['dim']\n            col_keywords[idx] = valid_kwargs\n\n        # data reading will be delayed\n        for col in range(nfields):\n            col_keywords[col]['array'] = Delayed(table, col)\n\n        # now build the columns\n        self.columns = [Column(**attrs) for attrs in col_keywords]\n\n        # Add the table HDU is a listener to changes to the columns\n        # (either changes to individual columns, or changes to the set of\n        # columns (add/remove/etc.))\n        self._add_listener(table)\n\n    def __copy__(self):\n        return self.__class__(self)\n\n    def __deepcopy__(self, memo):\n        return self.__class__([copy.deepcopy(c, memo) for c in self.columns])\n\n    def _copy_column(self, column):\n        \"\"\"Utility function used currently only by _init_from_coldefs\n        to help convert columns from binary format to ASCII format or vice\n        versa if necessary (otherwise performs a straight copy).\n        \"\"\"\n\n        if isinstance(column.format, self._col_format_cls):\n            # This column has a FITS format compatible with this column\n            # definitions class (that is ascii or binary)\n            return column.copy()\n\n        new_column = column.copy()\n\n        # Try to use the Numpy recformat as the equivalency between the\n        # two formats; if that conversion can't be made then these\n        # columns can't be transferred\n        # TODO: Catch exceptions here and raise an explicit error about\n        # column format conversion\n        new_column.format = self._col_format_cls.from_column_format(column.format)\n\n        # Handle a few special cases of column format options that are not\n        # compatible between ASCII an binary tables\n        # TODO: This is sort of hacked in right now; we really need\n        # separate classes for ASCII and Binary table Columns, and they\n        # should handle formatting issues like these\n        if not isinstance(new_column.format, _AsciiColumnFormat):\n            # the column is a binary table column...\n            new_column.start = None\n            if new_column.null is not None:\n                # We can't just \"guess\" a value to represent null\n                # values in the new column, so just disable this for\n                # now; users may modify it later\n                new_column.null = None\n        else:\n            # the column is an ASCII table column...\n            if new_column.null is not None:\n                new_column.null = DEFAULT_ASCII_TNULL\n            if (new_column.disp is not None and\n                    new_column.disp.upper().startswith('L')):\n                # ASCII columns may not use the logical data display format;\n                # for now just drop the TDISPn option for this column as we\n                # don't have a systematic conversion of boolean data to ASCII\n                # tables yet\n                new_column.disp = None\n\n        return new_column\n\n    def __getattr__(self, name):\n        \"\"\"\n        Automatically returns the values for the given keyword attribute for\n        all `Column`s in this list.\n\n        Implements for example self.units, self.formats, etc.\n        \"\"\"\n        cname = name[:-1]\n        if cname in KEYWORD_ATTRIBUTES and name[-1] == 's':\n            attr = []\n            for col in self.columns:\n                val = getattr(col, cname)\n                attr.append(val if val is not None else '')\n            return attr\n        raise AttributeError(name)\n\n    @lazyproperty\n    def dtype(self):\n        # Note: This previously returned a dtype that just used the raw field\n        # widths based on the format's repeat count, and did not incorporate\n        # field *shapes* as provided by TDIMn keywords.\n        # Now this incorporates TDIMn from the start, which makes *this* method\n        # a little more complicated, but simplifies code elsewhere (for example\n        # fields will have the correct shapes even in the raw recarray).\n        formats = []\n        offsets = [0]\n\n        for format_, dim in zip(self.formats, self._dims):\n            dt = format_.dtype\n\n            if len(offsets) < len(self.formats):\n                # Note: the size of the *original* format_ may be greater than\n                # one would expect from the number of elements determined by\n                # dim.  The FITS format allows this--the rest of the field is\n                # filled with undefined values.\n                offsets.append(offsets[-1] + dt.itemsize)\n\n            if dim:\n                if format_.format == 'A':\n                    dt = np.dtype((dt.char + str(dim[-1]), dim[:-1]))\n                else:\n                    dt = np.dtype((dt.base, dim))\n\n            formats.append(dt)\n\n        return np.dtype({'names': self.names,\n                         'formats': formats,\n                         'offsets': offsets})\n\n    @lazyproperty\n    def names(self):\n        return [col.name for col in self.columns]\n\n    @lazyproperty\n    def formats(self):\n        return [col.format for col in self.columns]\n\n    @lazyproperty\n    def _arrays(self):\n        return [col.array for col in self.columns]\n\n    @lazyproperty\n    def _recformats(self):\n        return [fmt.recformat for fmt in self.formats]\n\n    @lazyproperty\n    def _dims(self):\n        \"\"\"Returns the values of the TDIMn keywords parsed into tuples.\"\"\"\n\n        return [col._dims for col in self.columns]\n\n    def __getitem__(self, key):\n        if isinstance(key, str):\n            key = _get_index(self.names, key)\n\n        x = self.columns[key]\n        if _is_int(key):\n            return x\n        else:\n            return ColDefs(x)\n\n    def __len__(self):\n        return len(self.columns)\n\n    def __repr__(self):\n        rep = 'ColDefs('\n        if hasattr(self, 'columns') and self.columns:\n            # The hasattr check is mostly just useful in debugging sessions\n            # where self.columns may not be defined yet\n            rep += '\\n    '\n            rep += '\\n    '.join([repr(c) for c in self.columns])\n            rep += '\\n'\n        rep += ')'\n        return rep\n\n    def __add__(self, other, option='left'):\n        if isinstance(other, Column):\n            b = [other]\n        elif isinstance(other, ColDefs):\n            b = list(other.columns)\n        else:\n            raise TypeError('Wrong type of input.')\n        if option == 'left':\n            tmp = list(self.columns) + b\n        else:\n            tmp = b + list(self.columns)\n        return ColDefs(tmp)\n\n    def __radd__(self, other):\n        return self.__add__(other, 'right')\n\n    def __sub__(self, other):\n        if not isinstance(other, (list, tuple)):\n            other = [other]\n        _other = [_get_index(self.names, key) for key in other]\n        indx = list(range(len(self)))\n        for x in _other:\n            indx.remove(x)\n        tmp = [self[i] for i in indx]\n        return ColDefs(tmp)\n\n    def _update_column_attribute_changed(self, column, attr, old_value,\n                                         new_value):\n        \"\"\"\n        Handle column attribute changed notifications from columns that are\n        members of this `ColDefs`.\n\n        `ColDefs` itself does not currently do anything with this, and just\n        bubbles the notification up to any listening table HDUs that may need\n        to update their headers, etc.  However, this also informs the table of\n        the numerical index of the column that changed.\n        \"\"\"\n\n        idx = 0\n        for idx, col in enumerate(self.columns):\n            if col is column:\n                break\n\n        if attr == 'name':\n            del self.names\n        elif attr == 'format':\n            del self.formats\n\n        self._notify('column_attribute_changed', column, idx, attr, old_value,\n                     new_value)\n\n    def add_col(self, column):\n        \"\"\"\n        Append one `Column` to the column definition.\n        \"\"\"\n\n        if not isinstance(column, Column):\n            raise AssertionError\n\n        # Ask the HDU object to load the data before we modify our columns\n        self._notify('load_data')\n\n        self._arrays.append(column.array)\n        # Obliterate caches of certain things\n        del self.dtype\n        del self._recformats\n        del self._dims\n        del self.names\n        del self.formats\n\n        self.columns.append(column)\n\n        # Listen for changes on the new column\n        column._add_listener(self)\n\n        # If this ColDefs is being tracked by a Table, inform the\n        # table that its data is now invalid.\n        self._notify('column_added', self, column)\n        return self\n\n    def del_col(self, col_name):\n        \"\"\"\n        Delete (the definition of) one `Column`.\n\n        col_name : str or int\n            The column's name or index\n        \"\"\"\n\n        # Ask the HDU object to load the data before we modify our columns\n        self._notify('load_data')\n\n        indx = _get_index(self.names, col_name)\n        col = self.columns[indx]\n\n        del self._arrays[indx]\n        # Obliterate caches of certain things\n        del self.dtype\n        del self._recformats\n        del self._dims\n        del self.names\n        del self.formats\n\n        del self.columns[indx]\n\n        col._remove_listener(self)\n\n        # If this ColDefs is being tracked by a table HDU, inform the HDU (or\n        # any other listeners) that the column has been removed\n        # Just send a reference to self, and the index of the column that was\n        # removed\n        self._notify('column_removed', self, indx)\n        return self\n\n    def change_attrib(self, col_name, attrib, new_value):\n        \"\"\"\n        Change an attribute (in the ``KEYWORD_ATTRIBUTES`` list) of a `Column`.\n\n        Parameters\n        ----------\n        col_name : str or int\n            The column name or index to change\n\n        attrib : str\n            The attribute name\n\n        new_value : object\n            The new value for the attribute\n        \"\"\"\n\n        setattr(self[col_name], attrib, new_value)\n\n    def change_name(self, col_name, new_name):\n        \"\"\"\n        Change a `Column`'s name.\n\n        Parameters\n        ----------\n        col_name : str\n            The current name of the column\n\n        new_name : str\n            The new name of the column\n        \"\"\"\n\n        if new_name != col_name and new_name in self.names:\n            raise ValueError(f'New name {new_name} already exists.')\n        else:\n            self.change_attrib(col_name, 'name', new_name)\n\n    def change_unit(self, col_name, new_unit):\n        \"\"\"\n        Change a `Column`'s unit.\n\n        Parameters\n        ----------\n        col_name : str or int\n            The column name or index\n\n        new_unit : str\n            The new unit for the column\n        \"\"\"\n\n        self.change_attrib(col_name, 'unit', new_unit)\n\n    def info(self, attrib='all', output=None):\n        \"\"\"\n        Get attribute(s) information of the column definition.\n\n        Parameters\n        ----------\n        attrib : str\n            Can be one or more of the attributes listed in\n            ``astropy.io.fits.column.KEYWORD_ATTRIBUTES``.  The default is\n            ``\"all\"`` which will print out all attributes.  It forgives plurals\n            and blanks.  If there are two or more attribute names, they must be\n            separated by comma(s).\n\n        output : file-like, optional\n            File-like object to output to.  Outputs to stdout by default.\n            If `False`, returns the attributes as a `dict` instead.\n\n        Notes\n        -----\n        This function doesn't return anything by default; it just prints to\n        stdout.\n        \"\"\"\n\n        if output is None:\n            output = sys.stdout\n\n        if attrib.strip().lower() in ['all', '']:\n            lst = KEYWORD_ATTRIBUTES\n        else:\n            lst = attrib.split(',')\n            for idx in range(len(lst)):\n                lst[idx] = lst[idx].strip().lower()\n                if lst[idx][-1] == 's':\n                    lst[idx] = list[idx][:-1]\n\n        ret = {}\n\n        for attr in lst:\n            if output:\n                if attr not in KEYWORD_ATTRIBUTES:\n                    output.write(\"'{}' is not an attribute of the column \"\n                                 \"definitions.\\n\".format(attr))\n                    continue\n                output.write(f\"{attr}:\\n\")\n                output.write(f\"    {getattr(self, attr + 's')}\\n\")\n            else:\n                ret[attr] = getattr(self, attr + 's')\n\n        if not output:\n            return ret\n\n\nclass _AsciiColDefs(ColDefs):\n    \"\"\"ColDefs implementation for ASCII tables.\"\"\"\n\n    _padding_byte = ' '\n    _col_format_cls = _AsciiColumnFormat\n\n    def __init__(self, input, ascii=True):\n        super().__init__(input)\n\n        # if the format of an ASCII column has no width, add one\n        if not isinstance(input, _AsciiColDefs):\n            self._update_field_metrics()\n        else:\n            for idx, s in enumerate(input.starts):\n                self.columns[idx].start = s\n\n            self._spans = input.spans\n            self._width = input._width\n\n    @lazyproperty\n    def dtype(self):\n        dtype = {}\n\n        for j in range(len(self)):\n            data_type = 'S' + str(self.spans[j])\n            dtype[self.names[j]] = (data_type, self.starts[j] - 1)\n\n        return np.dtype(dtype)\n\n    @property\n    def spans(self):\n        \"\"\"A list of the widths of each field in the table.\"\"\"\n\n        return self._spans\n\n    @lazyproperty\n    def _recformats(self):\n        if len(self) == 1:\n            widths = []\n        else:\n            widths = [y - x for x, y in pairwise(self.starts)]\n\n        # Widths is the width of each field *including* any space between\n        # fields; this is so that we can map the fields to string records in a\n        # Numpy recarray\n        widths.append(self._width - self.starts[-1] + 1)\n        return ['a' + str(w) for w in widths]\n\n    def add_col(self, column):\n        super().add_col(column)\n        self._update_field_metrics()\n\n    def del_col(self, col_name):\n        super().del_col(col_name)\n        self._update_field_metrics()\n\n    def _update_field_metrics(self):\n        \"\"\"\n        Updates the list of the start columns, the list of the widths of each\n        field, and the total width of each record in the table.\n        \"\"\"\n\n        spans = [0] * len(self.columns)\n        end_col = 0  # Refers to the ASCII text column, not the table col\n        for idx, col in enumerate(self.columns):\n            width = col.format.width\n\n            # Update the start columns and column span widths taking into\n            # account the case that the starting column of a field may not\n            # be the column immediately after the previous field\n            if not col.start:\n                col.start = end_col + 1\n            end_col = col.start + width - 1\n            spans[idx] = width\n\n        self._spans = spans\n        self._width = end_col\n\n\n# Utilities\n\n\nclass _VLF(np.ndarray):\n    \"\"\"Variable length field object.\"\"\"\n\n    def __new__(cls, input, dtype='a'):\n        \"\"\"\n        Parameters\n        ----------\n        input\n            a sequence of variable-sized elements.\n        \"\"\"\n\n        if dtype == 'a':\n            try:\n                # this handles ['abc'] and [['a','b','c']]\n                # equally, beautiful!\n                input = [chararray.array(x, itemsize=1) for x in input]\n            except Exception:\n                raise ValueError(\n                    f'Inconsistent input data array: {input}')\n\n        a = np.array(input, dtype=object)\n        self = np.ndarray.__new__(cls, shape=(len(input),), buffer=a,\n                                  dtype=object)\n        self.max = 0\n        self.element_dtype = dtype\n        return self\n\n    def __array_finalize__(self, obj):\n        if obj is None:\n            return\n        self.max = obj.max\n        self.element_dtype = obj.element_dtype\n\n    def __setitem__(self, key, value):\n        \"\"\"\n        To make sure the new item has consistent data type to avoid\n        misalignment.\n        \"\"\"\n\n        if isinstance(value, np.ndarray) and value.dtype == self.dtype:\n            pass\n        elif isinstance(value, chararray.chararray) and value.itemsize == 1:\n            pass\n        elif self.element_dtype == 'a':\n            value = chararray.array(value, itemsize=1)\n        else:\n            value = np.array(value, dtype=self.element_dtype)\n        np.ndarray.__setitem__(self, key, value)\n        self.max = max(self.max, len(value))\n\n    def tolist(self):\n        return [list(item) for item in super().tolist()]\n\n\ndef _get_index(names, key):\n    \"\"\"\n    Get the index of the ``key`` in the ``names`` list.\n\n    The ``key`` can be an integer or string.  If integer, it is the index\n    in the list.  If string,\n\n        a. Field (column) names are case sensitive: you can have two\n           different columns called 'abc' and 'ABC' respectively.\n\n        b. When you *refer* to a field (presumably with the field\n           method), it will try to match the exact name first, so in\n           the example in (a), field('abc') will get the first field,\n           and field('ABC') will get the second field.\n\n        If there is no exact name matched, it will try to match the\n        name with case insensitivity.  So, in the last example,\n        field('Abc') will cause an exception since there is no unique\n        mapping.  If there is a field named \"XYZ\" and no other field\n        name is a case variant of \"XYZ\", then field('xyz'),\n        field('Xyz'), etc. will get this field.\n    \"\"\"\n\n    if _is_int(key):\n        indx = int(key)\n    elif isinstance(key, str):\n        # try to find exact match first\n        try:\n            indx = names.index(key.rstrip())\n        except ValueError:\n            # try to match case-insentively,\n            _key = key.lower().rstrip()\n            names = [n.lower().rstrip() for n in names]\n            count = names.count(_key)  # occurrence of _key in names\n            if count == 1:\n                indx = names.index(_key)\n            elif count == 0:\n                raise KeyError(f\"Key '{key}' does not exist.\")\n            else:              # multiple match\n                raise KeyError(f\"Ambiguous key name '{key}'.\")\n    else:\n        raise KeyError(f\"Illegal key '{key!r}'.\")\n\n    return indx\n\n\ndef _unwrapx(input, output, repeat):\n    \"\"\"\n    Unwrap the X format column into a Boolean array.\n\n    Parameters\n    ----------\n    input\n        input ``Uint8`` array of shape (`s`, `nbytes`)\n\n    output\n        output Boolean array of shape (`s`, `repeat`)\n\n    repeat\n        number of bits\n    \"\"\"\n\n    pow2 = np.array([128, 64, 32, 16, 8, 4, 2, 1], dtype='uint8')\n    nbytes = ((repeat - 1) // 8) + 1\n    for i in range(nbytes):\n        _min = i * 8\n        _max = min((i + 1) * 8, repeat)\n        for j in range(_min, _max):\n            output[..., j] = np.bitwise_and(input[..., i], pow2[j - i * 8])\n\n\ndef _wrapx(input, output, repeat):\n    \"\"\"\n    Wrap the X format column Boolean array into an ``UInt8`` array.\n\n    Parameters\n    ----------\n    input\n        input Boolean array of shape (`s`, `repeat`)\n\n    output\n        output ``Uint8`` array of shape (`s`, `nbytes`)\n\n    repeat\n        number of bits\n    \"\"\"\n\n    output[...] = 0  # reset the output\n    nbytes = ((repeat - 1) // 8) + 1\n    unused = nbytes * 8 - repeat\n    for i in range(nbytes):\n        _min = i * 8\n        _max = min((i + 1) * 8, repeat)\n        for j in range(_min, _max):\n            if j != _min:\n                np.left_shift(output[..., i], 1, output[..., i])\n            np.add(output[..., i], input[..., j], output[..., i])\n\n    # shift the unused bits\n    np.left_shift(output[..., i], unused, output[..., i])\n\n\ndef _makep(array, descr_output, format, nrows=None):\n    \"\"\"\n    Construct the P (or Q) format column array, both the data descriptors and\n    the data.  It returns the output \"data\" array of data type `dtype`.\n\n    The descriptor location will have a zero offset for all columns\n    after this call.  The final offset will be calculated when the file\n    is written.\n\n    Parameters\n    ----------\n    array\n        input object array\n\n    descr_output\n        output \"descriptor\" array of data type int32 (for P format arrays) or\n        int64 (for Q format arrays)--must be nrows long in its first dimension\n\n    format\n        the _FormatP object representing the format of the variable array\n\n    nrows : int, optional\n        number of rows to create in the column; defaults to the number of rows\n        in the input array\n    \"\"\"\n\n    # TODO: A great deal of this is redundant with FITS_rec._convert_p; see if\n    # we can merge the two somehow.\n\n    _offset = 0\n\n    if not nrows:\n        nrows = len(array)\n\n    data_output = _VLF([None] * nrows, dtype=format.dtype)\n\n    if format.dtype == 'a':\n        _nbytes = 1\n    else:\n        _nbytes = np.array([], dtype=format.dtype).itemsize\n\n    for idx in range(nrows):\n        if idx < len(array):\n            rowval = array[idx]\n        else:\n            if format.dtype == 'a':\n                rowval = ' ' * data_output.max\n            else:\n                rowval = [0] * data_output.max\n        if format.dtype == 'a':\n            data_output[idx] = chararray.array(encode_ascii(rowval),\n                                               itemsize=1)\n        else:\n            data_output[idx] = np.array(rowval, dtype=format.dtype)\n\n        descr_output[idx, 0] = len(data_output[idx])\n        descr_output[idx, 1] = _offset\n        _offset += len(data_output[idx]) * _nbytes\n\n    return data_output\n\n\ndef _parse_tformat(tform):\n    \"\"\"Parse ``TFORMn`` keyword for a binary table into a\n    ``(repeat, format, option)`` tuple.\n    \"\"\"\n\n    try:\n        (repeat, format, option) = TFORMAT_RE.match(tform.strip()).groups()\n    except Exception:\n        # TODO: Maybe catch this error use a default type (bytes, maybe?) for\n        # unrecognized column types.  As long as we can determine the correct\n        # byte width somehow..\n        raise VerifyError(f'Format {tform!r} is not recognized.')\n\n    if repeat == '':\n        repeat = 1\n    else:\n        repeat = int(repeat)\n\n    return (repeat, format.upper(), option)\n\n\ndef _parse_ascii_tformat(tform, strict=False):\n    \"\"\"\n    Parse the ``TFORMn`` keywords for ASCII tables into a ``(format, width,\n    precision)`` tuple (the latter is always zero unless format is one of 'E',\n    'F', or 'D').\n    \"\"\"\n\n    match = TFORMAT_ASCII_RE.match(tform.strip())\n    if not match:\n        raise VerifyError(f'Format {tform!r} is not recognized.')\n\n    # Be flexible on case\n    format = match.group('format')\n    if format is None:\n        # Floating point format\n        format = match.group('formatf').upper()\n        width = match.group('widthf')\n        precision = match.group('precision')\n        if width is None or precision is None:\n            if strict:\n                raise VerifyError('Format {!r} is not unambiguously an ASCII '\n                                  'table format.')\n            else:\n                width = 0 if width is None else width\n                precision = 1 if precision is None else precision\n    else:\n        format = format.upper()\n        width = match.group('width')\n        if width is None:\n            if strict:\n                raise VerifyError('Format {!r} is not unambiguously an ASCII '\n                                  'table format.')\n            else:\n                # Just use a default width of 0 if unspecified\n                width = 0\n        precision = 0\n\n    def convert_int(val):\n        msg = ('Format {!r} is not valid--field width and decimal precision '\n               'must be integers.')\n        try:\n            val = int(val)\n        except (ValueError, TypeError):\n            raise VerifyError(msg.format(tform))\n\n        return val\n\n    if width and precision:\n        # This should only be the case for floating-point formats\n        width, precision = convert_int(width), convert_int(precision)\n    elif width:\n        # Just for integer/string formats; ignore precision\n        width = convert_int(width)\n    else:\n        # For any format, if width was unspecified use the set defaults\n        width, precision = ASCII_DEFAULT_WIDTHS[format]\n\n    if width <= 0:\n        raise VerifyError(\"Format {!r} not valid--field width must be a \"\n                          \"positive integeter.\".format(tform))\n\n    if precision >= width:\n        raise VerifyError(\"Format {!r} not valid--the number of decimal digits \"\n                          \"must be less than the format's total \"\n                          \"width {}.\".format(tform, width))\n\n    return format, width, precision\n\n\ndef _parse_tdim(tdim):\n    \"\"\"Parse the ``TDIM`` value into a tuple (may return an empty tuple if\n    the value ``TDIM`` value is empty or invalid).\n    \"\"\"\n    m = tdim and TDIM_RE.match(tdim)\n    if m:\n        dims = m.group('dims')\n        return tuple(int(d.strip()) for d in dims.split(','))[::-1]\n\n    # Ignore any dim values that don't specify a multidimensional column\n    return tuple()\n\n\ndef _scalar_to_format(value):\n    \"\"\"\n    Given a scalar value or string, returns the minimum FITS column format\n    that can represent that value.  'minimum' is defined by the order given in\n    FORMATORDER.\n    \"\"\"\n\n    # First, if value is a string, try to convert to the appropriate scalar\n    # value\n    for type_ in (int, float, complex):\n        try:\n            value = type_(value)\n            break\n        except ValueError:\n            continue\n\n    numpy_dtype_str = np.min_scalar_type(value).str\n    numpy_dtype_str = numpy_dtype_str[1:]  # Strip endianness\n\n    try:\n        fits_format = NUMPY2FITS[numpy_dtype_str]\n        return FITSUPCONVERTERS.get(fits_format, fits_format)\n    except KeyError:\n        return \"A\" + str(len(value))\n\n\ndef _cmp_recformats(f1, f2):\n    \"\"\"\n    Compares two numpy recformats using the ordering given by FORMATORDER.\n    \"\"\"\n\n    if f1[0] == 'a' and f2[0] == 'a':\n        return cmp(int(f1[1:]), int(f2[1:]))\n    else:\n        f1, f2 = NUMPY2FITS[f1], NUMPY2FITS[f2]\n        return cmp(FORMATORDER.index(f1), FORMATORDER.index(f2))\n\n\ndef _convert_fits2record(format):\n    \"\"\"\n    Convert FITS format spec to record format spec.\n    \"\"\"\n\n    repeat, dtype, option = _parse_tformat(format)\n\n    if dtype in FITS2NUMPY:\n        if dtype == 'A':\n            output_format = FITS2NUMPY[dtype] + str(repeat)\n            # to accommodate both the ASCII table and binary table column\n            # format spec, i.e. A7 in ASCII table is the same as 7A in\n            # binary table, so both will produce 'a7'.\n            # Technically the FITS standard does not allow this but it's a very\n            # common mistake\n            if format.lstrip()[0] == 'A' and option != '':\n                # make sure option is integer\n                output_format = FITS2NUMPY[dtype] + str(int(option))\n        else:\n            repeat_str = ''\n            if repeat != 1:\n                repeat_str = str(repeat)\n            output_format = repeat_str + FITS2NUMPY[dtype]\n\n    elif dtype == 'X':\n        output_format = _FormatX(repeat)\n    elif dtype == 'P':\n        output_format = _FormatP.from_tform(format)\n    elif dtype == 'Q':\n        output_format = _FormatQ.from_tform(format)\n    elif dtype == 'F':\n        output_format = 'f8'\n    else:\n        raise ValueError(f'Illegal format `{format}`.')\n\n    return output_format\n\n\ndef _convert_record2fits(format):\n    \"\"\"\n    Convert record format spec to FITS format spec.\n    \"\"\"\n\n    recformat, kind, dtype = _dtype_to_recformat(format)\n    shape = dtype.shape\n    itemsize = dtype.base.itemsize\n    if dtype.char == 'U':\n        # Unicode dtype--itemsize is 4 times actual ASCII character length,\n        # which what matters for FITS column formats\n        # Use dtype.base--dtype may be a multi-dimensional dtype\n        itemsize = itemsize // 4\n\n    option = str(itemsize)\n\n    ndims = len(shape)\n    repeat = 1\n    if ndims > 0:\n        nel = np.array(shape, dtype='i8').prod()\n        if nel > 1:\n            repeat = nel\n\n    if kind == 'a':\n        # This is a kludge that will place string arrays into a\n        # single field, so at least we won't lose data.  Need to\n        # use a TDIM keyword to fix this, declaring as (slength,\n        # dim1, dim2, ...)  as mwrfits does\n\n        ntot = int(repeat) * int(option)\n\n        output_format = str(ntot) + 'A'\n    elif recformat in NUMPY2FITS:  # record format\n        if repeat != 1:\n            repeat = str(repeat)\n        else:\n            repeat = ''\n        output_format = repeat + NUMPY2FITS[recformat]\n    else:\n        raise ValueError(f'Illegal format `{format}`.')\n\n    return output_format\n\n\ndef _dtype_to_recformat(dtype):\n    \"\"\"\n    Utility function for converting a dtype object or string that instantiates\n    a dtype (e.g. 'float32') into one of the two character Numpy format codes\n    that have been traditionally used by Astropy.\n\n    In particular, use of 'a' to refer to character data is long since\n    deprecated in Numpy, but Astropy remains heavily invested in its use\n    (something to try to get away from sooner rather than later).\n    \"\"\"\n\n    if not isinstance(dtype, np.dtype):\n        dtype = np.dtype(dtype)\n\n    kind = dtype.base.kind\n\n    if kind in ('U', 'S'):\n        recformat = kind = 'a'\n    else:\n        itemsize = dtype.base.itemsize\n        recformat = kind + str(itemsize)\n\n    return recformat, kind, dtype\n\n\ndef _convert_format(format, reverse=False):\n    \"\"\"\n    Convert FITS format spec to record format spec.  Do the opposite if\n    reverse=True.\n    \"\"\"\n\n    if reverse:\n        return _convert_record2fits(format)\n    else:\n        return _convert_fits2record(format)\n\n\ndef _convert_ascii_format(format, reverse=False):\n    \"\"\"Convert ASCII table format spec to record format spec.\"\"\"\n\n    if reverse:\n        recformat, kind, dtype = _dtype_to_recformat(format)\n        itemsize = dtype.itemsize\n\n        if kind == 'a':\n            return 'A' + str(itemsize)\n        elif NUMPY2FITS.get(recformat) == 'L':\n            # Special case for logical/boolean types--for ASCII tables we\n            # represent these as single character columns containing 'T' or 'F'\n            # (a la the storage format for Logical columns in binary tables)\n            return 'A1'\n        elif kind == 'i':\n            # Use for the width the maximum required to represent integers\n            # of that byte size plus 1 for signs, but use a minimum of the\n            # default width (to keep with existing behavior)\n            width = 1 + len(str(2 ** (itemsize * 8)))\n            width = max(width, ASCII_DEFAULT_WIDTHS['I'][0])\n            return 'I' + str(width)\n        elif kind == 'f':\n            # This is tricky, but go ahead and use D if float-64, and E\n            # if float-32 with their default widths\n            if itemsize >= 8:\n                format = 'D'\n            else:\n                format = 'E'\n            width = '.'.join(str(w) for w in ASCII_DEFAULT_WIDTHS[format])\n            return format + width\n        # TODO: There may be reasonable ways to represent other Numpy types so\n        # let's see what other possibilities there are besides just 'a', 'i',\n        # and 'f'.  If it doesn't have a reasonable ASCII representation then\n        # raise an exception\n    else:\n        format, width, precision = _parse_ascii_tformat(format)\n\n        # This gives a sensible \"default\" dtype for a given ASCII\n        # format code\n        recformat = ASCII2NUMPY[format]\n\n        # The following logic is taken from CFITSIO:\n        # For integers, if the width <= 4 we can safely use 16-bit ints for all\n        # values, if width >= 10 we may need to accommodate 64-bit ints.\n        # values [for the non-standard J format code just always force 64-bit]\n        if format == 'I':\n            if width <= 4:\n                recformat = 'i2'\n            elif width > 9:\n                recformat = 'i8'\n        elif format == 'A':\n            recformat += str(width)\n\n        return recformat\n\n\ndef _parse_tdisp_format(tdisp):\n    \"\"\"\n    Parse the ``TDISPn`` keywords for ASCII and binary tables into a\n    ``(format, width, precision, exponential)`` tuple (the TDISP values\n    for ASCII and binary are identical except for 'Lw',\n    which is only present in BINTABLE extensions\n\n    Parameters\n    ----------\n    tdisp : str\n        TDISPn FITS Header keyword.  Used to specify display formatting.\n\n    Returns\n    -------\n    formatc: str\n        The format characters from TDISPn\n    width: str\n        The width int value from TDISPn\n    precision: str\n        The precision int value from TDISPn\n    exponential: str\n        The exponential int value from TDISPn\n\n    \"\"\"\n\n    # Use appropriate regex for format type\n    tdisp = tdisp.strip()\n    fmt_key = tdisp[0] if tdisp[0] != 'E' or (\n        len(tdisp) > 1 and tdisp[1] not in 'NS') else tdisp[:2]\n    try:\n        tdisp_re = TDISP_RE_DICT[fmt_key]\n    except KeyError:\n        raise VerifyError(f'Format {tdisp} is not recognized.')\n\n    match = tdisp_re.match(tdisp.strip())\n    if not match or match.group('formatc') is None:\n        raise VerifyError(f'Format {tdisp} is not recognized.')\n\n    formatc = match.group('formatc')\n    width = match.group('width')\n    precision = None\n    exponential = None\n\n    # Some formats have precision and exponential\n    if tdisp[0] in ('I', 'B', 'O', 'Z', 'F', 'E', 'G', 'D'):\n        precision = match.group('precision')\n        if precision is None:\n            precision = 1\n    if tdisp[0] in ('E', 'D', 'G') and tdisp[1] not in ('N', 'S'):\n        exponential = match.group('exponential')\n        if exponential is None:\n            exponential = 1\n\n    # Once parsed, check format dict to do conversion to a formatting string\n    return formatc, width, precision, exponential\n\n\ndef _fortran_to_python_format(tdisp):\n    \"\"\"\n    Turn the TDISPn fortran format pieces into a final Python format string.\n    See the format_type definitions above the TDISP_FMT_DICT. If codes is\n    changed to take advantage of the exponential specification, will need to\n    add it as another input parameter.\n\n    Parameters\n    ----------\n    tdisp : str\n        TDISPn FITS Header keyword.  Used to specify display formatting.\n\n    Returns\n    -------\n    format_string: str\n        The TDISPn keyword string translated into a Python format string.\n    \"\"\"\n    format_type, width, precision, exponential = _parse_tdisp_format(tdisp)\n\n    try:\n        fmt = TDISP_FMT_DICT[format_type]\n        return fmt.format(width=width, precision=precision)\n\n    except KeyError:\n        raise VerifyError(f'Format {format_type} is not recognized.')\n\n\ndef python_to_tdisp(format_string, logical_dtype=False):\n    \"\"\"\n    Turn the Python format string to a TDISP FITS compliant format string. Not\n    all formats convert. these will cause a Warning and return None.\n\n    Parameters\n    ----------\n    format_string : str\n        TDISPn FITS Header keyword.  Used to specify display formatting.\n    logical_dtype : bool\n        True is this format type should be a logical type, 'L'. Needs special\n        handling.\n\n    Returns\n    -------\n    tdsip_string: str\n        The TDISPn keyword string translated into a Python format string.\n    \"\"\"\n\n    fmt_to_tdisp = {'a': 'A', 's': 'A', 'd': 'I', 'b': 'B', 'o': 'O', 'x': 'Z',\n                    'X': 'Z', 'f': 'F', 'F': 'F', 'g': 'G', 'G': 'G', 'e': 'E',\n                    'E': 'E'}\n\n    if format_string in [None, \"\", \"{}\"]:\n        return None\n\n    # Strip out extra format characters that aren't a type or a width/precision\n    if format_string[0] == '{' and format_string != \"{}\":\n        fmt_str = format_string.lstrip(\"{:\").rstrip('}')\n    elif format_string[0] == '%':\n        fmt_str = format_string.lstrip(\"%\")\n    else:\n        fmt_str = format_string\n\n    precision, sep = '', ''\n\n    # Character format, only translate right aligned, and don't take zero fills\n    if fmt_str[-1].isdigit() and fmt_str[0] == '>' and fmt_str[1] != '0':\n        ftype = fmt_to_tdisp['a']\n        width = fmt_str[1:]\n\n    elif fmt_str[-1] == 's' and fmt_str != 's':\n        ftype = fmt_to_tdisp['a']\n        width = fmt_str[:-1].lstrip('0')\n\n    # Number formats, don't take zero fills\n    elif fmt_str[-1].isalpha() and len(fmt_str) > 1 and fmt_str[0] != '0':\n        ftype = fmt_to_tdisp[fmt_str[-1]]\n        fmt_str = fmt_str[:-1]\n\n        # If format has a \".\" split out the width and precision\n        if '.' in fmt_str:\n            width, precision = fmt_str.split('.')\n            sep = '.'\n            if width == \"\":\n                ascii_key = ftype if ftype != 'G' else 'F'\n                width = str(int(precision) + (ASCII_DEFAULT_WIDTHS[ascii_key][0] -\n                                     ASCII_DEFAULT_WIDTHS[ascii_key][1]))\n        # Otherwise we just have a width\n        else:\n            width = fmt_str\n\n    else:\n        warnings.warn('Format {} cannot be mapped to the accepted '\n                      'TDISPn keyword values.  Format will not be '\n                      'moved into TDISPn keyword.'.format(format_string),\n                      AstropyUserWarning)\n        return None\n\n    # Catch logical data type, set the format type back to L in this case\n    if logical_dtype:\n        ftype = 'L'\n\n    return ftype + width + sep + precision\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":1168,"name":"CARD_LENGTH","nodeType":"Attribute","startLoc":22,"text":"CARD_LENGTH"},{"className":"lazyproperty","col":0,"comment":"\n    Works similarly to property(), but computes the value only once.\n\n    This essentially memorizes the value of the property by storing the result\n    of its computation in the ``__dict__`` of the object instance.  This is\n    useful for computing the value of some property that should otherwise be\n    invariant.  For example::\n\n        >>> class LazyTest:\n        ...     @lazyproperty\n        ...     def complicated_property(self):\n        ...         print('Computing the value for complicated_property...')\n        ...         return 42\n        ...\n        >>> lt = LazyTest()\n        >>> lt.complicated_property\n        Computing the value for complicated_property...\n        42\n        >>> lt.complicated_property\n        42\n\n    As the example shows, the second time ``complicated_property`` is accessed,\n    the ``print`` statement is not executed.  Only the return value from the\n    first access off ``complicated_property`` is returned.\n\n    By default, a setter and deleter are used which simply overwrite and\n    delete, respectively, the value stored in ``__dict__``. Any user-specified\n    setter or deleter is executed before executing these default actions.\n    The one exception is that the default setter is not run if the user setter\n    already sets the new value in ``__dict__`` and returns that value and the\n    returned value is not ``None``.\n\n    ","endLoc":799,"id":1169,"nodeType":"Class","startLoc":728,"text":"class lazyproperty(property):\n    \"\"\"\n    Works similarly to property(), but computes the value only once.\n\n    This essentially memorizes the value of the property by storing the result\n    of its computation in the ``__dict__`` of the object instance.  This is\n    useful for computing the value of some property that should otherwise be\n    invariant.  For example::\n\n        >>> class LazyTest:\n        ...     @lazyproperty\n        ...     def complicated_property(self):\n        ...         print('Computing the value for complicated_property...')\n        ...         return 42\n        ...\n        >>> lt = LazyTest()\n        >>> lt.complicated_property\n        Computing the value for complicated_property...\n        42\n        >>> lt.complicated_property\n        42\n\n    As the example shows, the second time ``complicated_property`` is accessed,\n    the ``print`` statement is not executed.  Only the return value from the\n    first access off ``complicated_property`` is returned.\n\n    By default, a setter and deleter are used which simply overwrite and\n    delete, respectively, the value stored in ``__dict__``. Any user-specified\n    setter or deleter is executed before executing these default actions.\n    The one exception is that the default setter is not run if the user setter\n    already sets the new value in ``__dict__`` and returns that value and the\n    returned value is not ``None``.\n\n    \"\"\"\n\n    def __init__(self, fget, fset=None, fdel=None, doc=None):\n        super().__init__(fget, fset, fdel, doc)\n        self._key = self.fget.__name__\n        self._lock = threading.RLock()\n\n    def __get__(self, obj, owner=None):\n        try:\n            obj_dict = obj.__dict__\n            val = obj_dict.get(self._key, _NotFound)\n            if val is _NotFound:\n                with self._lock:\n                    # Check if another thread beat us to it.\n                    val = obj_dict.get(self._key, _NotFound)\n                    if val is _NotFound:\n                        val = self.fget(obj)\n                        obj_dict[self._key] = val\n            return val\n        except AttributeError:\n            if obj is None:\n                return self\n            raise\n\n    def __set__(self, obj, val):\n        obj_dict = obj.__dict__\n        if self.fset:\n            ret = self.fset(obj, val)\n            if ret is not None and obj_dict.get(self._key) is ret:\n                # By returning the value set the setter signals that it\n                # took over setting the value in obj.__dict__; this\n                # mechanism allows it to override the input value\n                return\n        obj_dict[self._key] = val\n\n    def __delete__(self, obj):\n        if self.fdel:\n            self.fdel(obj)\n        obj.__dict__.pop(self._key, None)    # Delete if present"},{"col":4,"comment":"null","endLoc":766,"header":"def __init__(self, fget, fset=None, fdel=None, doc=None)","id":1170,"name":"__init__","nodeType":"Function","startLoc":763,"text":"def __init__(self, fget, fset=None, fdel=None, doc=None):\n        super().__init__(fget, fset, fdel, doc)\n        self._key = self.fget.__name__\n        self._lock = threading.RLock()"},{"col":4,"comment":"null","endLoc":2014,"header":"def tolist(self)","id":1171,"name":"tolist","nodeType":"Function","startLoc":2013,"text":"def tolist(self):\n        return [list(item) for item in super().tolist()]"},{"col":4,"comment":"null","endLoc":783,"header":"def __get__(self, obj, owner=None)","id":1172,"name":"__get__","nodeType":"Function","startLoc":768,"text":"def __get__(self, obj, owner=None):\n        try:\n            obj_dict = obj.__dict__\n            val = obj_dict.get(self._key, _NotFound)\n            if val is _NotFound:\n                with self._lock:\n                    # Check if another thread beat us to it.\n                    val = obj_dict.get(self._key, _NotFound)\n                    if val is _NotFound:\n                        val = self.fget(obj)\n                        obj_dict[self._key] = val\n            return val\n        except AttributeError:\n            if obj is None:\n                return self\n            raise"},{"attributeType":"null","col":8,"comment":"null","endLoc":1987,"id":1173,"name":"element_dtype","nodeType":"Attribute","startLoc":1987,"text":"self.element_dtype"},{"col":4,"comment":"null","endLoc":794,"header":"def __set__(self, obj, val)","id":1174,"name":"__set__","nodeType":"Function","startLoc":785,"text":"def __set__(self, obj, val):\n        obj_dict = obj.__dict__\n        if self.fset:\n            ret = self.fset(obj, val)\n            if ret is not None and obj_dict.get(self._key) is ret:\n                # By returning the value set the setter signals that it\n                # took over setting the value in obj.__dict__; this\n                # mechanism allows it to override the input value\n                return\n        obj_dict[self._key] = val"},{"col":4,"comment":"\n        The meat of `Header.fromfile`; in a separate method so that\n        `Header.fromfile` itself is just responsible for wrapping file\n        handling.  Also used by `_BaseHDU.fromstring`.\n\n        ``block_iter`` should be a callable which, given a block size n\n        (typically 2880 bytes as used by the FITS standard) returns an iterator\n        of byte strings of that block size.\n\n        ``is_binary`` specifies whether the returned blocks are bytes or text\n\n        Returns both the entire header *string*, and the `Header` object\n        returned by Header.fromstring on that string.\n        ","endLoc":611,"header":"@classmethod\n    def _from_blocks(cls, block_iter, is_binary, sep, endcard, padding)","id":1175,"name":"_from_blocks","nodeType":"Function","startLoc":541,"text":"@classmethod\n    def _from_blocks(cls, block_iter, is_binary, sep, endcard, padding):\n        \"\"\"\n        The meat of `Header.fromfile`; in a separate method so that\n        `Header.fromfile` itself is just responsible for wrapping file\n        handling.  Also used by `_BaseHDU.fromstring`.\n\n        ``block_iter`` should be a callable which, given a block size n\n        (typically 2880 bytes as used by the FITS standard) returns an iterator\n        of byte strings of that block size.\n\n        ``is_binary`` specifies whether the returned blocks are bytes or text\n\n        Returns both the entire header *string*, and the `Header` object\n        returned by Header.fromstring on that string.\n        \"\"\"\n\n        actual_block_size = _block_size(sep)\n        clen = Card.length + len(sep)\n\n        blocks = block_iter(actual_block_size)\n\n        # Read the first header block.\n        try:\n            block = next(blocks)\n        except StopIteration:\n            raise EOFError()\n\n        if not is_binary:\n            # TODO: There needs to be error handling at *this* level for\n            # non-ASCII characters; maybe at this stage decoding latin-1 might\n            # be safer\n            block = encode_ascii(block)\n\n        read_blocks = []\n        is_eof = False\n        end_found = False\n\n        # continue reading header blocks until END card or EOF is reached\n        while True:\n            # find the END card\n            end_found, block = cls._find_end_card(block, clen)\n\n            read_blocks.append(decode_ascii(block))\n\n            if end_found:\n                break\n\n            try:\n                block = next(blocks)\n            except StopIteration:\n                is_eof = True\n                break\n\n            if not block:\n                is_eof = True\n                break\n\n            if not is_binary:\n                block = encode_ascii(block)\n\n        header_str = ''.join(read_blocks)\n        _check_padding(header_str, actual_block_size, is_eof,\n                       check_block_size=padding)\n\n        if not end_found and is_eof and endcard:\n            # TODO: Pass this error to validation framework as an ERROR,\n            # rather than raising an exception\n            raise OSError('Header missing END card.')\n\n        return header_str, cls.fromstring(header_str, sep=sep)"},{"col":0,"comment":"\n    Determine the size of a FITS header block if a non-blank separator is used\n    between cards.\n    ","endLoc":2244,"header":"def _block_size(sep)","id":1176,"name":"_block_size","nodeType":"Function","startLoc":2238,"text":"def _block_size(sep):\n    \"\"\"\n    Determine the size of a FITS header block if a non-blank separator is used\n    between cards.\n    \"\"\"\n\n    return BLOCK_SIZE + (len(sep) * (BLOCK_SIZE // Card.length - 1))"},{"col":4,"comment":"null","endLoc":799,"header":"def __delete__(self, obj)","id":1177,"name":"__delete__","nodeType":"Function","startLoc":796,"text":"def __delete__(self, obj):\n        if self.fdel:\n            self.fdel(obj)\n        obj.__dict__.pop(self._key, None)    # Delete if present"},{"attributeType":"null","col":16,"comment":"null","endLoc":1978,"id":1178,"name":"input","nodeType":"Attribute","startLoc":1978,"text":"input"},{"attributeType":"null","col":8,"comment":"null","endLoc":766,"id":1179,"name":"_lock","nodeType":"Attribute","startLoc":766,"text":"self._lock"},{"attributeType":"null","col":8,"comment":"null","endLoc":1983,"id":1180,"name":"a","nodeType":"Attribute","startLoc":1983,"text":"a"},{"attributeType":"null","col":8,"comment":"null","endLoc":1986,"id":1181,"name":"max","nodeType":"Attribute","startLoc":1986,"text":"self.max"},{"attributeType":"null","col":8,"comment":"null","endLoc":1984,"id":1182,"name":"self","nodeType":"Attribute","startLoc":1984,"text":"self"},{"col":0,"comment":"\n    Wrap the X format column Boolean array into an ``UInt8`` array.\n\n    Parameters\n    ----------\n    input\n        input Boolean array of shape (`s`, `repeat`)\n\n    output\n        output ``Uint8`` array of shape (`s`, `nbytes`)\n\n    repeat\n        number of bits\n    ","endLoc":2116,"header":"def _wrapx(input, output, repeat)","id":1183,"name":"_wrapx","nodeType":"Function","startLoc":2088,"text":"def _wrapx(input, output, repeat):\n    \"\"\"\n    Wrap the X format column Boolean array into an ``UInt8`` array.\n\n    Parameters\n    ----------\n    input\n        input Boolean array of shape (`s`, `repeat`)\n\n    output\n        output ``Uint8`` array of shape (`s`, `nbytes`)\n\n    repeat\n        number of bits\n    \"\"\"\n\n    output[...] = 0  # reset the output\n    nbytes = ((repeat - 1) // 8) + 1\n    unused = nbytes * 8 - repeat\n    for i in range(nbytes):\n        _min = i * 8\n        _max = min((i + 1) * 8, repeat)\n        for j in range(_min, _max):\n            if j != _min:\n                np.left_shift(output[..., i], 1, output[..., i])\n            np.add(output[..., i], input[..., j], output[..., i])\n\n    # shift the unused bits\n    np.left_shift(output[..., i], unused, output[..., i])"},{"attributeType":"None","col":8,"comment":"null","endLoc":112,"id":1184,"name":"_file","nodeType":"Attribute","startLoc":112,"text":"self._file"},{"attributeType":"null","col":8,"comment":"null","endLoc":123,"id":1185,"name":"close_on_error","nodeType":"Attribute","startLoc":123,"text":"self.close_on_error"},{"attributeType":"null","col":8,"comment":"null","endLoc":765,"id":1186,"name":"_key","nodeType":"Attribute","startLoc":765,"text":"self._key"},{"attributeType":"null","col":12,"comment":"null","endLoc":189,"id":1187,"name":"writeonly","nodeType":"Attribute","startLoc":189,"text":"self.writeonly"},{"col":0,"comment":"\n    Unwrap the X format column into a Boolean array.\n\n    Parameters\n    ----------\n    input\n        input ``Uint8`` array of shape (`s`, `nbytes`)\n\n    output\n        output Boolean array of shape (`s`, `repeat`)\n\n    repeat\n        number of bits\n    ","endLoc":2085,"header":"def _unwrapx(input, output, repeat)","id":1188,"name":"_unwrapx","nodeType":"Function","startLoc":2063,"text":"def _unwrapx(input, output, repeat):\n    \"\"\"\n    Unwrap the X format column into a Boolean array.\n\n    Parameters\n    ----------\n    input\n        input ``Uint8`` array of shape (`s`, `nbytes`)\n\n    output\n        output Boolean array of shape (`s`, `repeat`)\n\n    repeat\n        number of bits\n    \"\"\"\n\n    pow2 = np.array([128, 64, 32, 16, 8, 4, 2, 1], dtype='uint8')\n    nbytes = ((repeat - 1) // 8) + 1\n    for i in range(nbytes):\n        _min = i * 8\n        _max = min((i + 1) * 8, repeat)\n        for j in range(_min, _max):\n            output[..., j] = np.bitwise_and(input[..., i], pow2[j - i * 8])"},{"attributeType":"null","col":12,"comment":"null","endLoc":186,"id":1189,"name":"readonly","nodeType":"Attribute","startLoc":186,"text":"self.readonly"},{"col":0,"comment":"\n    Construct the P (or Q) format column array, both the data descriptors and\n    the data.  It returns the output \"data\" array of data type `dtype`.\n\n    The descriptor location will have a zero offset for all columns\n    after this call.  The final offset will be calculated when the file\n    is written.\n\n    Parameters\n    ----------\n    array\n        input object array\n\n    descr_output\n        output \"descriptor\" array of data type int32 (for P format arrays) or\n        int64 (for Q format arrays)--must be nrows long in its first dimension\n\n    format\n        the _FormatP object representing the format of the variable array\n\n    nrows : int, optional\n        number of rows to create in the column; defaults to the number of rows\n        in the input array\n    ","endLoc":2178,"header":"def _makep(array, descr_output, format, nrows=None)","id":1190,"name":"_makep","nodeType":"Function","startLoc":2119,"text":"def _makep(array, descr_output, format, nrows=None):\n    \"\"\"\n    Construct the P (or Q) format column array, both the data descriptors and\n    the data.  It returns the output \"data\" array of data type `dtype`.\n\n    The descriptor location will have a zero offset for all columns\n    after this call.  The final offset will be calculated when the file\n    is written.\n\n    Parameters\n    ----------\n    array\n        input object array\n\n    descr_output\n        output \"descriptor\" array of data type int32 (for P format arrays) or\n        int64 (for Q format arrays)--must be nrows long in its first dimension\n\n    format\n        the _FormatP object representing the format of the variable array\n\n    nrows : int, optional\n        number of rows to create in the column; defaults to the number of rows\n        in the input array\n    \"\"\"\n\n    # TODO: A great deal of this is redundant with FITS_rec._convert_p; see if\n    # we can merge the two somehow.\n\n    _offset = 0\n\n    if not nrows:\n        nrows = len(array)\n\n    data_output = _VLF([None] * nrows, dtype=format.dtype)\n\n    if format.dtype == 'a':\n        _nbytes = 1\n    else:\n        _nbytes = np.array([], dtype=format.dtype).itemsize\n\n    for idx in range(nrows):\n        if idx < len(array):\n            rowval = array[idx]\n        else:\n            if format.dtype == 'a':\n                rowval = ' ' * data_output.max\n            else:\n                rowval = [0] * data_output.max\n        if format.dtype == 'a':\n            data_output[idx] = chararray.array(encode_ascii(rowval),\n                                               itemsize=1)\n        else:\n            data_output[idx] = np.array(rowval, dtype=format.dtype)\n\n        descr_output[idx, 0] = len(data_output[idx])\n        descr_output[idx, 1] = _offset\n        _offset += len(data_output[idx]) * _nbytes\n\n    return data_output"},{"attributeType":"null","col":12,"comment":"null","endLoc":201,"id":1191,"name":"size","nodeType":"Attribute","startLoc":201,"text":"self.size"},{"attributeType":"null","col":8,"comment":"null","endLoc":114,"id":1192,"name":"binary","nodeType":"Attribute","startLoc":114,"text":"self.binary"},{"attributeType":"null","col":12,"comment":"null","endLoc":159,"id":1193,"name":"name","nodeType":"Attribute","startLoc":159,"text":"self.name"},{"col":4,"comment":"\n        Utility method to search a header block for the END card and handle\n        invalid END cards.\n\n        This method can also returned a modified copy of the input header block\n        in case an invalid end card needs to be sanitized.\n        ","endLoc":656,"header":"@classmethod\n    def _find_end_card(cls, block, card_len)","id":1194,"name":"_find_end_card","nodeType":"Function","startLoc":613,"text":"@classmethod\n    def _find_end_card(cls, block, card_len):\n        \"\"\"\n        Utility method to search a header block for the END card and handle\n        invalid END cards.\n\n        This method can also returned a modified copy of the input header block\n        in case an invalid end card needs to be sanitized.\n        \"\"\"\n\n        for mo in HEADER_END_RE.finditer(block):\n            # Ensure the END card was found, and it started on the\n            # boundary of a new card (see ticket #142)\n            if mo.start() % card_len != 0:\n                continue\n\n            # This must be the last header block, otherwise the\n            # file is malformatted\n            if mo.group('invalid'):\n                offset = mo.start()\n                trailing = block[offset + 3:offset + card_len - 3].rstrip()\n                if trailing:\n                    trailing = repr(trailing).lstrip('ub')\n                    # TODO: Pass this warning up to the validation framework\n                    warnings.warn(\n                        'Unexpected bytes trailing END keyword: {}; these '\n                        'bytes will be replaced with spaces on write.'.format(\n                            trailing), AstropyUserWarning)\n                else:\n                    # TODO: Pass this warning up to the validation framework\n                    warnings.warn(\n                        'Missing padding to end of the FITS block after the '\n                        'END keyword; additional spaces will be appended to '\n                        'the file upon writing to pad out to {} '\n                        'bytes.'.format(BLOCK_SIZE), AstropyUserWarning)\n\n                # Sanitize out invalid END card now that the appropriate\n                # warnings have been issued\n                block = (block[:offset] + encode_ascii(END_CARD) +\n                         block[offset + len(END_CARD):])\n\n            return True, block\n\n        return False, block"},{"col":4,"comment":"null","endLoc":44,"header":"def __init__(self, hour)","id":1195,"name":"__init__","nodeType":"Function","startLoc":43,"text":"def __init__(self, hour):\n        self.hour = hour"},{"className":"Delayed","col":0,"comment":"Delayed file-reading data.","endLoc":198,"id":1196,"nodeType":"Class","startLoc":186,"text":"class Delayed:\n    \"\"\"Delayed file-reading data.\"\"\"\n\n    def __init__(self, hdu=None, field=None):\n        self.hdu = weakref.proxy(hdu)\n        self.field = field\n\n    def __getitem__(self, key):\n        # This forces the data for the HDU to be read, which will replace\n        # the corresponding Delayed objects in the Tables Columns to be\n        # transformed into ndarrays.  It will also return the value of the\n        # requested data element.\n        return self.hdu.data[key][self.field]"},{"col":4,"comment":"null","endLoc":361,"header":"@value.setter\n    def value(self, value)","id":1197,"name":"value","nodeType":"Function","startLoc":298,"text":"@value.setter\n    def value(self, value):\n        if self._invalid:\n            raise ValueError(\n                'The value of invalid/unparsable cards cannot set.  Either '\n                'delete this card from the header or replace it.')\n\n        if value is None:\n            value = UNDEFINED\n\n        try:\n            oldvalue = self.value\n        except VerifyError:\n            # probably a parsing error, falling back to the internal _value\n            # which should be None. This may happen while calling _fix_value.\n            oldvalue = self._value\n\n        if oldvalue is None:\n            oldvalue = UNDEFINED\n\n        if not isinstance(value,\n                          (str, int, float, complex, bool, Undefined,\n                           np.floating, np.integer, np.complexfloating,\n                           np.bool_)):\n            raise ValueError(f'Illegal value: {value!r}.')\n\n        if isinstance(value, (float, np.float32)) and (np.isnan(value) or\n                                                       np.isinf(value)):\n            # value is checked for both float and np.float32 instances\n            # since np.float32 is not considered a Python float.\n            raise ValueError(\"Floating point {!r} values are not allowed \"\n                             \"in FITS headers.\".format(value))\n\n        elif isinstance(value, str):\n            m = self._ascii_text_re.match(value)\n            if not m:\n                raise ValueError(\n                    'FITS header values must contain standard printable ASCII '\n                    'characters; {!r} contains characters not representable in '\n                    'ASCII or non-printable characters.'.format(value))\n        elif isinstance(value, np.bool_):\n            value = bool(value)\n\n        if (conf.strip_header_whitespace and\n                (isinstance(oldvalue, str) and isinstance(value, str))):\n            # Ignore extra whitespace when comparing the new value to the old\n            different = oldvalue.rstrip() != value.rstrip()\n        elif isinstance(oldvalue, bool) or isinstance(value, bool):\n            different = oldvalue is not value\n        else:\n            different = (oldvalue != value or\n                         not isinstance(value, type(oldvalue)))\n\n        if different:\n            self._value = value\n            self._rawvalue = None\n            self._modified = True\n            self._valuestring = None\n            self._valuemodified = True\n            if self.field_specifier:\n                try:\n                    self._value = _int_or_float(self._value)\n                except ValueError:\n                    raise ValueError(f'value {self._value} is not a float')"},{"col":4,"comment":"null","endLoc":198,"header":"def __getitem__(self, key)","id":1198,"name":"__getitem__","nodeType":"Function","startLoc":193,"text":"def __getitem__(self, key):\n        # This forces the data for the HDU to be read, which will replace\n        # the corresponding Delayed objects in the Tables Columns to be\n        # transformed into ndarrays.  It will also return the value of the\n        # requested data element.\n        return self.hdu.data[key][self.field]"},{"attributeType":"null","col":8,"comment":"null","endLoc":191,"id":1199,"name":"field","nodeType":"Attribute","startLoc":191,"text":"self.field"},{"attributeType":"null","col":8,"comment":"null","endLoc":113,"id":1200,"name":"closed","nodeType":"Attribute","startLoc":113,"text":"self.closed"},{"attributeType":"null","col":8,"comment":"null","endLoc":190,"id":1201,"name":"hdu","nodeType":"Attribute","startLoc":190,"text":"self.hdu"},{"attributeType":"null","col":12,"comment":"null","endLoc":182,"id":1202,"name":"compression","nodeType":"Attribute","startLoc":182,"text":"self.compression"},{"col":0,"comment":"\n    Checks that the given value is in the range [0,60].  If the value\n    is equal to 60, then a warning is raised.\n    ","endLoc":336,"header":"def _check_minute_range(m)","id":1203,"name":"_check_minute_range","nodeType":"Function","startLoc":327,"text":"def _check_minute_range(m):\n    \"\"\"\n    Checks that the given value is in the range [0,60].  If the value\n    is equal to 60, then a warning is raised.\n    \"\"\"\n    if np.any(m == 60.):\n        warn(IllegalMinuteWarning(m, 'Treating as 0 min, +1 hr/deg'))\n    elif np.any(m < -60.) or np.any(m > 60.):\n        # \"Error: minutes not in range [-60,60) ({0}).\".format(min))\n        raise IllegalMinuteError(m)"},{"className":"_BaseColumnFormat","col":0,"comment":"\n    Base class for binary table column formats (just called _ColumnFormat)\n    and ASCII table column formats (_AsciiColumnFormat).\n    ","endLoc":242,"id":1204,"nodeType":"Class","startLoc":201,"text":"class _BaseColumnFormat(str):\n    \"\"\"\n    Base class for binary table column formats (just called _ColumnFormat)\n    and ASCII table column formats (_AsciiColumnFormat).\n    \"\"\"\n\n    def __eq__(self, other):\n        if not other:\n            return False\n\n        if isinstance(other, str):\n            if not isinstance(other, self.__class__):\n                try:\n                    other = self.__class__(other)\n                except ValueError:\n                    return False\n        else:\n            return False\n\n        return self.canonical == other.canonical\n\n    def __hash__(self):\n        return hash(self.canonical)\n\n    @lazyproperty\n    def dtype(self):\n        \"\"\"\n        The Numpy dtype object created from the format's associated recformat.\n        \"\"\"\n\n        return np.dtype(self.recformat)\n\n    @classmethod\n    def from_column_format(cls, format):\n        \"\"\"Creates a column format object from another column format object\n        regardless of their type.\n\n        That is, this can convert a _ColumnFormat to an _AsciiColumnFormat\n        or vice versa at least in cases where a direct translation is possible.\n        \"\"\"\n\n        return cls.from_recformat(format.recformat)"},{"col":4,"comment":"null","endLoc":220,"header":"def __eq__(self, other)","id":1205,"name":"__eq__","nodeType":"Function","startLoc":207,"text":"def __eq__(self, other):\n        if not other:\n            return False\n\n        if isinstance(other, str):\n            if not isinstance(other, self.__class__):\n                try:\n                    other = self.__class__(other)\n                except ValueError:\n                    return False\n        else:\n            return False\n\n        return self.canonical == other.canonical"},{"attributeType":"null","col":8,"comment":"null","endLoc":164,"id":1206,"name":"file_like","nodeType":"Attribute","startLoc":164,"text":"self.file_like"},{"attributeType":"null","col":8,"comment":"null","endLoc":109,"id":1207,"name":"strict_memmap","nodeType":"Attribute","startLoc":109,"text":"self.strict_memmap"},{"attributeType":"null","col":0,"comment":"null","endLoc":36,"id":1208,"name":"IO_FITS_MODES","nodeType":"Attribute","startLoc":36,"text":"IO_FITS_MODES"},{"attributeType":"null","col":0,"comment":"null","endLoc":50,"id":1209,"name":"FILE_MODES","nodeType":"Attribute","startLoc":50,"text":"FILE_MODES"},{"attributeType":"null","col":0,"comment":"null","endLoc":56,"id":1210,"name":"TEXT_RE","nodeType":"Attribute","startLoc":56,"text":"TEXT_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":66,"id":1211,"name":"MEMMAP_MODES","nodeType":"Attribute","startLoc":66,"text":"MEMMAP_MODES"},{"attributeType":"null","col":0,"comment":"null","endLoc":77,"id":1212,"name":"GZIP_MAGIC","nodeType":"Attribute","startLoc":77,"text":"GZIP_MAGIC"},{"attributeType":"null","col":0,"comment":"null","endLoc":78,"id":1213,"name":"PKZIP_MAGIC","nodeType":"Attribute","startLoc":78,"text":"PKZIP_MAGIC"},{"attributeType":"null","col":0,"comment":"null","endLoc":79,"id":1214,"name":"BZIP2_MAGIC","nodeType":"Attribute","startLoc":79,"text":"BZIP2_MAGIC"},{"col":0,"comment":"","endLoc":3,"header":"file.py#<anonymous>","id":1215,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"if HAS_BZ2:\n    import bz2\n\nIO_FITS_MODES = {\n    'readonly': 'rb',\n    'copyonwrite': 'rb',\n    'update': 'rb+',\n    'append': 'ab+',\n    'ostream': 'wb',\n    'denywrite': 'rb'}\n\nFILE_MODES = {\n    'rb': 'readonly', 'rb+': 'update',\n    'wb': 'ostream', 'wb+': 'update',\n    'ab': 'ostream', 'ab+': 'append'}\n\nTEXT_RE = re.compile(r'^[rwa]((t?\\+?)|(\\+?t?))$')\n\nMEMMAP_MODES = {'readonly': mmap.ACCESS_COPY,\n                'copyonwrite': mmap.ACCESS_COPY,\n                'update': mmap.ACCESS_WRITE,\n                'append': mmap.ACCESS_COPY,\n                'denywrite': mmap.ACCESS_READ}\n\nGZIP_MAGIC = b'\\x1f\\x8b\\x08'\n\nPKZIP_MAGIC = b'\\x50\\x4b\\x03\\x04'\n\nBZIP2_MAGIC = b'\\x42\\x5a'"},{"fileName":"setup_package.py","filePath":"astropy/io/fits","id":1216,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport os\nimport sys\nfrom collections import defaultdict\n\nfrom setuptools import Extension\nfrom glob import glob\n\nimport numpy\n\nfrom extension_helpers import pkg_config, get_compiler\n\n\ndef _get_compression_extension():\n\n    debug = '--debug' in sys.argv\n\n    cfg = defaultdict(list)\n    cfg['include_dirs'].append(numpy.get_include())\n    cfg['sources'].append(os.path.join(os.path.dirname(__file__),\n                                       'src', 'compressionmodule.c'))\n\n    if (int(os.environ.get('ASTROPY_USE_SYSTEM_CFITSIO', 0)) or\n            int(os.environ.get('ASTROPY_USE_SYSTEM_ALL', 0))):\n        for k, v in pkg_config(['cfitsio'], ['cfitsio']).items():\n            cfg[k].extend(v)\n    else:\n        if get_compiler() == 'msvc':\n            # These come from the CFITSIO vcc makefile, except the last\n            # which ensures on windows we do not include unistd.h (in regular\n            # compilation of cfitsio, an empty file would be generated)\n            cfg['extra_compile_args'].extend(\n                ['/D', 'WIN32',\n                 '/D', '_WINDOWS',\n                 '/D', '_MBCS',\n                 '/D', '_USRDLL',\n                 '/D', '_CRT_SECURE_NO_DEPRECATE',\n                 '/D', 'FF_NO_UNISTD_H'])\n        else:\n            cfg['extra_compile_args'].extend([\n                '-Wno-declaration-after-statement'\n            ])\n\n            cfg['define_macros'].append(('HAVE_UNISTD_H', None))\n\n            if not debug:\n                # these switches are to silence warnings from compiling CFITSIO\n                # For full silencing, some are added that only are used in\n                # later versions of gcc (versions approximate; see #6474)\n                cfg['extra_compile_args'].extend([\n                    '-Wno-strict-prototypes',\n                    '-Wno-unused',\n                    '-Wno-uninitialized',\n                    '-Wno-unused-result',  # gcc >~4.8\n                    '-Wno-misleading-indentation',  # gcc >~7.2\n                    '-Wno-format-overflow',  # gcc >~7.2\n                ])\n\n        cfitsio_lib_path = os.path.join('cextern', 'cfitsio', 'lib')\n        cfitsio_zlib_path = os.path.join('cextern', 'cfitsio', 'zlib')\n        cfitsio_files = glob(os.path.join(cfitsio_lib_path, '*.c'))\n        cfitsio_zlib_files = glob(os.path.join(cfitsio_zlib_path, '*.c'))\n        cfg['include_dirs'].append(cfitsio_lib_path)\n        cfg['include_dirs'].append(cfitsio_zlib_path)\n        cfg['sources'].extend(cfitsio_files)\n        cfg['sources'].extend(cfitsio_zlib_files)\n\n    return Extension('astropy.io.fits.compression', **cfg)\n\n\ndef get_extensions():\n    return [_get_compression_extension()]\n"},{"col":4,"comment":"null","endLoc":103,"header":"def __init__(self, minute, alternativeactionstr=None)","id":1217,"name":"__init__","nodeType":"Function","startLoc":101,"text":"def __init__(self, minute, alternativeactionstr=None):\n        self.minute = minute\n        self.alternativeactionstr = alternativeactionstr"},{"col":4,"comment":"null","endLoc":223,"header":"def __hash__(self)","id":1218,"name":"__hash__","nodeType":"Function","startLoc":222,"text":"def __hash__(self):\n        return hash(self.canonical)"},{"col":0,"comment":"null","endLoc":2278,"header":"def _check_padding(header_str, block_size, is_eof, check_block_size=True)","id":1219,"name":"_check_padding","nodeType":"Function","startLoc":2253,"text":"def _check_padding(header_str, block_size, is_eof, check_block_size=True):\n    # Strip any zero-padding (see ticket #106)\n    if header_str and header_str[-1] == '\\0':\n        if is_eof and header_str.strip('\\0') == '':\n            # TODO: Pass this warning to validation framework\n            warnings.warn(\n                'Unexpected extra padding at the end of the file.  This '\n                'padding may not be preserved when saving changes.',\n                AstropyUserWarning)\n            raise EOFError()\n        else:\n            # Replace the illegal null bytes with spaces as required by\n            # the FITS standard, and issue a nasty warning\n            # TODO: Pass this warning to validation framework\n            warnings.warn(\n                'Header block contains null bytes instead of spaces for '\n                'padding, and is not FITS-compliant. Nulls may be '\n                'replaced with spaces upon writing.', AstropyUserWarning)\n            header_str.replace('\\0', ' ')\n\n    if check_block_size and (len(header_str) % block_size) != 0:\n        # This error message ignores the length of the separator for\n        # now, but maybe it shouldn't?\n        actual_len = len(header_str) - block_size + BLOCK_SIZE\n        # TODO: Pass this error to validation framework\n        raise ValueError(f'Header size is not multiple of {BLOCK_SIZE}: {actual_len}')"},{"col":4,"comment":"\n        The Numpy dtype object created from the format's associated recformat.\n        ","endLoc":231,"header":"@lazyproperty\n    def dtype(self)","id":1220,"name":"dtype","nodeType":"Function","startLoc":225,"text":"@lazyproperty\n    def dtype(self):\n        \"\"\"\n        The Numpy dtype object created from the format's associated recformat.\n        \"\"\"\n\n        return np.dtype(self.recformat)"},{"col":0,"comment":"null","endLoc":69,"header":"def _get_compression_extension()","id":1221,"name":"_get_compression_extension","nodeType":"Function","startLoc":15,"text":"def _get_compression_extension():\n\n    debug = '--debug' in sys.argv\n\n    cfg = defaultdict(list)\n    cfg['include_dirs'].append(numpy.get_include())\n    cfg['sources'].append(os.path.join(os.path.dirname(__file__),\n                                       'src', 'compressionmodule.c'))\n\n    if (int(os.environ.get('ASTROPY_USE_SYSTEM_CFITSIO', 0)) or\n            int(os.environ.get('ASTROPY_USE_SYSTEM_ALL', 0))):\n        for k, v in pkg_config(['cfitsio'], ['cfitsio']).items():\n            cfg[k].extend(v)\n    else:\n        if get_compiler() == 'msvc':\n            # These come from the CFITSIO vcc makefile, except the last\n            # which ensures on windows we do not include unistd.h (in regular\n            # compilation of cfitsio, an empty file would be generated)\n            cfg['extra_compile_args'].extend(\n                ['/D', 'WIN32',\n                 '/D', '_WINDOWS',\n                 '/D', '_MBCS',\n                 '/D', '_USRDLL',\n                 '/D', '_CRT_SECURE_NO_DEPRECATE',\n                 '/D', 'FF_NO_UNISTD_H'])\n        else:\n            cfg['extra_compile_args'].extend([\n                '-Wno-declaration-after-statement'\n            ])\n\n            cfg['define_macros'].append(('HAVE_UNISTD_H', None))\n\n            if not debug:\n                # these switches are to silence warnings from compiling CFITSIO\n                # For full silencing, some are added that only are used in\n                # later versions of gcc (versions approximate; see #6474)\n                cfg['extra_compile_args'].extend([\n                    '-Wno-strict-prototypes',\n                    '-Wno-unused',\n                    '-Wno-uninitialized',\n                    '-Wno-unused-result',  # gcc >~4.8\n                    '-Wno-misleading-indentation',  # gcc >~7.2\n                    '-Wno-format-overflow',  # gcc >~7.2\n                ])\n\n        cfitsio_lib_path = os.path.join('cextern', 'cfitsio', 'lib')\n        cfitsio_zlib_path = os.path.join('cextern', 'cfitsio', 'zlib')\n        cfitsio_files = glob(os.path.join(cfitsio_lib_path, '*.c'))\n        cfitsio_zlib_files = glob(os.path.join(cfitsio_zlib_path, '*.c'))\n        cfg['include_dirs'].append(cfitsio_lib_path)\n        cfg['include_dirs'].append(cfitsio_zlib_path)\n        cfg['sources'].extend(cfitsio_files)\n        cfg['sources'].extend(cfitsio_zlib_files)\n\n    return Extension('astropy.io.fits.compression', **cfg)"},{"col":4,"comment":"Creates a column format object from another column format object\n        regardless of their type.\n\n        That is, this can convert a _ColumnFormat to an _AsciiColumnFormat\n        or vice versa at least in cases where a direct translation is possible.\n        ","endLoc":242,"header":"@classmethod\n    def from_column_format(cls, format)","id":1222,"name":"from_column_format","nodeType":"Function","startLoc":233,"text":"@classmethod\n    def from_column_format(cls, format):\n        \"\"\"Creates a column format object from another column format object\n        regardless of their type.\n\n        That is, this can convert a _ColumnFormat to an _AsciiColumnFormat\n        or vice versa at least in cases where a direct translation is possible.\n        \"\"\"\n\n        return cls.from_recformat(format.recformat)"},{"col":4,"comment":"null","endLoc":374,"header":"@value.deleter\n    def value(self)","id":1223,"name":"value","nodeType":"Function","startLoc":363,"text":"@value.deleter\n    def value(self):\n        if self._invalid:\n            raise ValueError(\n                'The value of invalid/unparsable cards cannot deleted.  '\n                'Either delete this card from the header or replace it.')\n\n        if not self.field_specifier:\n            self.value = ''\n        else:\n            raise AttributeError('Values cannot be deleted from record-valued '\n                                 'keyword cards')"},{"col":4,"comment":"On record-valued keyword cards this is the name of the standard <= 8\n        character FITS keyword that this RVKC is stored in.  Otherwise it is\n        the card's normal keyword.\n        ","endLoc":389,"header":"@property\n    def rawkeyword(self)","id":1224,"name":"rawkeyword","nodeType":"Function","startLoc":376,"text":"@property\n    def rawkeyword(self):\n        \"\"\"On record-valued keyword cards this is the name of the standard <= 8\n        character FITS keyword that this RVKC is stored in.  Otherwise it is\n        the card's normal keyword.\n        \"\"\"\n\n        if self._rawkeyword is not None:\n            return self._rawkeyword\n        elif self.field_specifier is not None:\n            self._rawkeyword = self.keyword.split('.', 1)[0]\n            return self._rawkeyword\n        else:\n            return self.keyword"},{"col":4,"comment":"On record-valued keyword cards this is the raw string value in\n        the ``<field-specifier>: <value>`` format stored in the card in order\n        to represent a RVKC.  Otherwise it is the card's normal value.\n        ","endLoc":404,"header":"@property\n    def rawvalue(self)","id":1225,"name":"rawvalue","nodeType":"Function","startLoc":391,"text":"@property\n    def rawvalue(self):\n        \"\"\"On record-valued keyword cards this is the raw string value in\n        the ``<field-specifier>: <value>`` format stored in the card in order\n        to represent a RVKC.  Otherwise it is the card's normal value.\n        \"\"\"\n\n        if self._rawvalue is not None:\n            return self._rawvalue\n        elif self.field_specifier is not None:\n            self._rawvalue = f'{self.field_specifier}: {self.value}'\n            return self._rawvalue\n        else:\n            return self.value"},{"col":4,"comment":"Get the comment attribute from the card image if not already set.","endLoc":417,"header":"@property\n    def comment(self)","id":1226,"name":"comment","nodeType":"Function","startLoc":406,"text":"@property\n    def comment(self):\n        \"\"\"Get the comment attribute from the card image if not already set.\"\"\"\n\n        if self._comment is not None:\n            return self._comment\n        elif self._image:\n            self._comment = self._parse_comment()\n            return self._comment\n        else:\n            self._comment = ''\n            return ''"},{"col":4,"comment":"\n        Writes the header to file or file-like object.\n\n        By default this writes the header exactly as it would be written to a\n        FITS file, with the END card included and padding to the next multiple\n        of 2880 bytes.  However, aspects of this may be controlled.\n\n        Parameters\n        ----------\n        fileobj : path-like or file-like, optional\n            Either the pathname of a file, or an open file handle or file-like\n            object.\n\n        sep : str, optional\n            The character or string with which to separate cards.  By default\n            there is no separator, but one could use ``'\\\\n'``, for example, to\n            separate each card with a new line\n\n        endcard : bool, optional\n            If `True` (default) adds the END card to the end of the header\n            string\n\n        padding : bool, optional\n            If `True` (default) pads the string with spaces out to the next\n            multiple of 2880 characters\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n        ","endLoc":757,"header":"def tofile(self, fileobj, sep='', endcard=True, padding=True,\n               overwrite=False)","id":1227,"name":"tofile","nodeType":"Function","startLoc":703,"text":"def tofile(self, fileobj, sep='', endcard=True, padding=True,\n               overwrite=False):\n        r\"\"\"\n        Writes the header to file or file-like object.\n\n        By default this writes the header exactly as it would be written to a\n        FITS file, with the END card included and padding to the next multiple\n        of 2880 bytes.  However, aspects of this may be controlled.\n\n        Parameters\n        ----------\n        fileobj : path-like or file-like, optional\n            Either the pathname of a file, or an open file handle or file-like\n            object.\n\n        sep : str, optional\n            The character or string with which to separate cards.  By default\n            there is no separator, but one could use ``'\\\\n'``, for example, to\n            separate each card with a new line\n\n        endcard : bool, optional\n            If `True` (default) adds the END card to the end of the header\n            string\n\n        padding : bool, optional\n            If `True` (default) pads the string with spaces out to the next\n            multiple of 2880 characters\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n        \"\"\"\n\n        close_file = fileobj_closed(fileobj)\n\n        if not isinstance(fileobj, _File):\n            fileobj = _File(fileobj, mode='ostream', overwrite=overwrite)\n\n        try:\n            blocks = self.tostring(sep=sep, endcard=endcard, padding=padding)\n            actual_block_size = _block_size(sep)\n            if padding and len(blocks) % actual_block_size != 0:\n                raise OSError(\n                    'Header size ({}) is not a multiple of block '\n                    'size ({}).'.format(\n                        len(blocks) - actual_block_size + BLOCK_SIZE,\n                        BLOCK_SIZE))\n\n            fileobj.flush()\n            fileobj.write(blocks.encode('ascii'))\n            fileobj.flush()\n        finally:\n            if close_file:\n                fileobj.close()"},{"className":"_ColumnFormat","col":0,"comment":"\n    Represents a FITS binary table column format.\n\n    This is an enhancement over using a normal string for the format, since the\n    repeat count, format code, and option are available as separate attributes,\n    and smart comparison is used.  For example 1J == J.\n    ","endLoc":298,"id":1228,"nodeType":"Class","startLoc":245,"text":"class _ColumnFormat(_BaseColumnFormat):\n    \"\"\"\n    Represents a FITS binary table column format.\n\n    This is an enhancement over using a normal string for the format, since the\n    repeat count, format code, and option are available as separate attributes,\n    and smart comparison is used.  For example 1J == J.\n    \"\"\"\n\n    def __new__(cls, format):\n        self = super().__new__(cls, format)\n        self.repeat, self.format, self.option = _parse_tformat(format)\n        self.format = self.format.upper()\n        if self.format in ('P', 'Q'):\n            # TODO: There should be a generic factory that returns either\n            # _FormatP or _FormatQ as appropriate for a given TFORMn\n            if self.format == 'P':\n                recformat = _FormatP.from_tform(format)\n            else:\n                recformat = _FormatQ.from_tform(format)\n            # Format of variable length arrays\n            self.p_format = recformat.format\n        else:\n            self.p_format = None\n        return self\n\n    @classmethod\n    def from_recformat(cls, recformat):\n        \"\"\"Creates a column format from a Numpy record dtype format.\"\"\"\n\n        return cls(_convert_format(recformat, reverse=True))\n\n    @lazyproperty\n    def recformat(self):\n        \"\"\"Returns the equivalent Numpy record format string.\"\"\"\n\n        return _convert_format(self)\n\n    @lazyproperty\n    def canonical(self):\n        \"\"\"\n        Returns a 'canonical' string representation of this format.\n\n        This is in the proper form of rTa where T is the single character data\n        type code, a is the optional part, and r is the repeat.  If repeat == 1\n        (the default) it is left out of this representation.\n        \"\"\"\n\n        if self.repeat == 1:\n            repeat = ''\n        else:\n            repeat = str(self.repeat)\n\n        return f'{repeat}{self.format}{self.option}'"},{"col":4,"comment":"Extract the keyword value from the card image.","endLoc":797,"header":"def _parse_comment(self)","id":1229,"name":"_parse_comment","nodeType":"Function","startLoc":774,"text":"def _parse_comment(self):\n        \"\"\"Extract the keyword value from the card image.\"\"\"\n\n        # for commentary cards, no need to parse further\n        # likewise for invalid/unparsable cards\n        if self.keyword in Card._commentary_keywords or self._invalid:\n            return ''\n\n        valuecomment = self._split()[1]\n        m = self._value_NFSC_RE.match(valuecomment)\n        comment = ''\n        if m is not None:\n            # Don't combine this if statement with the one above, because\n            # we only want the elif case to run if this was not a valid\n            # card at all\n            if m.group('comm'):\n                comment = m.group('comm').rstrip()\n        elif '/' in valuecomment:\n            # The value in this FITS file was not in a valid/known format.  In\n            # this case the best we can do is guess that everything after the\n            # first / was meant to be the comment\n            comment = valuecomment.split('/', 1)[1].strip()\n\n        return comment"},{"className":"FITS_record","col":0,"comment":"\n    FITS record class.\n\n    `FITS_record` is used to access records of the `FITS_rec` object.\n    This will allow us to deal with scaled columns.  It also handles\n    conversion/scaling of columns in ASCII tables.  The `FITS_record`\n    class expects a `FITS_rec` object as input.\n    ","endLoc":138,"id":1230,"nodeType":"Class","startLoc":22,"text":"class FITS_record:\n    \"\"\"\n    FITS record class.\n\n    `FITS_record` is used to access records of the `FITS_rec` object.\n    This will allow us to deal with scaled columns.  It also handles\n    conversion/scaling of columns in ASCII tables.  The `FITS_record`\n    class expects a `FITS_rec` object as input.\n    \"\"\"\n\n    def __init__(self, input, row=0, start=None, end=None, step=None,\n                 base=None, **kwargs):\n        \"\"\"\n        Parameters\n        ----------\n        input : array\n            The array to wrap.\n        row : int, optional\n            The starting logical row of the array.\n        start : int, optional\n            The starting column in the row associated with this object.\n            Used for subsetting the columns of the `FITS_rec` object.\n        end : int, optional\n            The ending column in the row associated with this object.\n            Used for subsetting the columns of the `FITS_rec` object.\n        \"\"\"\n\n        self.array = input\n        self.row = row\n        if base:\n            width = len(base)\n        else:\n            width = self.array._nfields\n\n        s = slice(start, end, step).indices(width)\n        self.start, self.end, self.step = s\n        self.base = base\n\n    def __getitem__(self, key):\n        if isinstance(key, str):\n            indx = _get_index(self.array.names, key)\n\n            if indx < self.start or indx > self.end - 1:\n                raise KeyError(f\"Key '{key}' does not exist.\")\n        elif isinstance(key, slice):\n            return type(self)(self.array, self.row, key.start, key.stop,\n                              key.step, self)\n        else:\n            indx = self._get_index(key)\n\n            if indx > self.array._nfields - 1:\n                raise IndexError('Index out of bounds')\n\n        return self.array.field(indx)[self.row]\n\n    def __setitem__(self, key, value):\n        if isinstance(key, str):\n            indx = _get_index(self.array.names, key)\n\n            if indx < self.start or indx > self.end - 1:\n                raise KeyError(f\"Key '{key}' does not exist.\")\n        elif isinstance(key, slice):\n            for indx in range(slice.start, slice.stop, slice.step):\n                indx = self._get_indx(indx)\n                self.array.field(indx)[self.row] = value\n        else:\n            indx = self._get_index(key)\n            if indx > self.array._nfields - 1:\n                raise IndexError('Index out of bounds')\n\n        self.array.field(indx)[self.row] = value\n\n    def __len__(self):\n        return len(range(self.start, self.end, self.step))\n\n    def __repr__(self):\n        \"\"\"\n        Display a single row.\n        \"\"\"\n\n        outlist = []\n        for idx in range(len(self)):\n            outlist.append(repr(self[idx]))\n        return f\"({', '.join(outlist)})\"\n\n    def field(self, field):\n        \"\"\"\n        Get the field data of the record.\n        \"\"\"\n\n        return self.__getitem__(field)\n\n    def setfield(self, field, value):\n        \"\"\"\n        Set the field data of the record.\n        \"\"\"\n\n        self.__setitem__(field, value)\n\n    @lazyproperty\n    def _bases(self):\n        bases = [weakref.proxy(self)]\n        base = self.base\n        while base:\n            bases.append(base)\n            base = base.base\n        return bases\n\n    def _get_index(self, indx):\n        indices = np.ogrid[:self.array._nfields]\n        for base in reversed(self._bases):\n            if base.step < 1:\n                s = slice(base.start, None, base.step)\n            else:\n                s = slice(base.start, base.end, base.step)\n            indices = indices[s]\n        return indices[indx]"},{"col":4,"comment":"null","endLoc":269,"header":"def __new__(cls, format)","id":1231,"name":"__new__","nodeType":"Function","startLoc":254,"text":"def __new__(cls, format):\n        self = super().__new__(cls, format)\n        self.repeat, self.format, self.option = _parse_tformat(format)\n        self.format = self.format.upper()\n        if self.format in ('P', 'Q'):\n            # TODO: There should be a generic factory that returns either\n            # _FormatP or _FormatQ as appropriate for a given TFORMn\n            if self.format == 'P':\n                recformat = _FormatP.from_tform(format)\n            else:\n                recformat = _FormatQ.from_tform(format)\n            # Format of variable length arrays\n            self.p_format = recformat.format\n        else:\n            self.p_format = None\n        return self"},{"col":4,"comment":"\n        Parameters\n        ----------\n        input : array\n            The array to wrap.\n        row : int, optional\n            The starting logical row of the array.\n        start : int, optional\n            The starting column in the row associated with this object.\n            Used for subsetting the columns of the `FITS_rec` object.\n        end : int, optional\n            The ending column in the row associated with this object.\n            Used for subsetting the columns of the `FITS_rec` object.\n        ","endLoc":58,"header":"def __init__(self, input, row=0, start=None, end=None, step=None,\n                 base=None, **kwargs)","id":1232,"name":"__init__","nodeType":"Function","startLoc":32,"text":"def __init__(self, input, row=0, start=None, end=None, step=None,\n                 base=None, **kwargs):\n        \"\"\"\n        Parameters\n        ----------\n        input : array\n            The array to wrap.\n        row : int, optional\n            The starting logical row of the array.\n        start : int, optional\n            The starting column in the row associated with this object.\n            Used for subsetting the columns of the `FITS_rec` object.\n        end : int, optional\n            The ending column in the row associated with this object.\n            Used for subsetting the columns of the `FITS_rec` object.\n        \"\"\"\n\n        self.array = input\n        self.row = row\n        if base:\n            width = len(base)\n        else:\n            width = self.array._nfields\n\n        s = slice(start, end, step).indices(width)\n        self.start, self.end, self.step = s\n        self.base = base"},{"col":4,"comment":"null","endLoc":87,"header":"def __init__(self, minute)","id":1233,"name":"__init__","nodeType":"Function","startLoc":86,"text":"def __init__(self, minute):\n        self.minute = minute"},{"col":0,"comment":"Parse ``TFORMn`` keyword for a binary table into a\n    ``(repeat, format, option)`` tuple.\n    ","endLoc":2199,"header":"def _parse_tformat(tform)","id":1234,"name":"_parse_tformat","nodeType":"Function","startLoc":2181,"text":"def _parse_tformat(tform):\n    \"\"\"Parse ``TFORMn`` keyword for a binary table into a\n    ``(repeat, format, option)`` tuple.\n    \"\"\"\n\n    try:\n        (repeat, format, option) = TFORMAT_RE.match(tform.strip()).groups()\n    except Exception:\n        # TODO: Maybe catch this error use a default type (bytes, maybe?) for\n        # unrecognized column types.  As long as we can determine the correct\n        # byte width somehow..\n        raise VerifyError(f'Format {tform!r} is not recognized.')\n\n    if repeat == '':\n        repeat = 1\n    else:\n        repeat = int(repeat)\n\n    return (repeat, format.upper(), option)"},{"col":0,"comment":"\n    Checks that the given value is in the range [0,60].  If the value\n    is equal to 60, then a warning is raised.\n    ","endLoc":350,"header":"def _check_second_range(sec)","id":1235,"name":"_check_second_range","nodeType":"Function","startLoc":339,"text":"def _check_second_range(sec):\n    \"\"\"\n    Checks that the given value is in the range [0,60].  If the value\n    is equal to 60, then a warning is raised.\n    \"\"\"\n    if np.any(sec == 60.):\n        warn(IllegalSecondWarning(sec, 'Treating as 0 sec, +1 min'))\n    elif sec is None:\n        pass\n    elif np.any(sec < -60.) or np.any(sec > 60.):\n        # \"Error: seconds not in range [-60,60) ({0}).\".format(sec))\n        raise IllegalSecondError(sec)"},{"col":4,"comment":"null","endLoc":145,"header":"def __init__(self, second, alternativeactionstr=None)","id":1236,"name":"__init__","nodeType":"Function","startLoc":143,"text":"def __init__(self, second, alternativeactionstr=None):\n        self.second = second\n        self.alternativeactionstr = alternativeactionstr"},{"col":4,"comment":"\n        Read a header from a simple text file or file-like object.\n\n        Equivalent to::\n\n            >>> Header.fromfile(fileobj, sep='\\n', endcard=False,\n            ...                 padding=False)\n\n        See Also\n        --------\n        fromfile\n        ","endLoc":774,"header":"@classmethod\n    def fromtextfile(cls, fileobj, endcard=False)","id":1237,"name":"fromtextfile","nodeType":"Function","startLoc":759,"text":"@classmethod\n    def fromtextfile(cls, fileobj, endcard=False):\n        \"\"\"\n        Read a header from a simple text file or file-like object.\n\n        Equivalent to::\n\n            >>> Header.fromfile(fileobj, sep='\\\\n', endcard=False,\n            ...                 padding=False)\n\n        See Also\n        --------\n        fromfile\n        \"\"\"\n\n        return cls.fromfile(fileobj, sep='\\n', endcard=endcard, padding=False)"},{"col":4,"comment":"null","endLoc":449,"header":"@comment.setter\n    def comment(self, comment)","id":1238,"name":"comment","nodeType":"Function","startLoc":419,"text":"@comment.setter\n    def comment(self, comment):\n        if self._invalid:\n            raise ValueError(\n                'The comment of invalid/unparsable cards cannot set.  Either '\n                'delete this card from the header or replace it.')\n\n        if comment is None:\n            comment = ''\n\n        if isinstance(comment, str):\n            m = self._ascii_text_re.match(comment)\n            if not m:\n                raise ValueError(\n                    'FITS header comments must contain standard printable '\n                    'ASCII characters; {!r} contains characters not '\n                    'representable in ASCII or non-printable characters.'\n                    .format(comment))\n\n        try:\n            oldcomment = self.comment\n        except VerifyError:\n            # probably a parsing error, falling back to the internal _comment\n            # which should be None.\n            oldcomment = self._comment\n\n        if oldcomment is None:\n            oldcomment = ''\n        if comment != oldcomment:\n            self._comment = comment\n            self._modified = True"},{"col":4,"comment":"\n        Write the header as text to a file or a file-like object.\n\n        Equivalent to::\n\n            >>> Header.tofile(fileobj, sep='\\n', endcard=False,\n            ...               padding=False, overwrite=overwrite)\n\n        See Also\n        --------\n        tofile\n        ","endLoc":791,"header":"def totextfile(self, fileobj, endcard=False, overwrite=False)","id":1239,"name":"totextfile","nodeType":"Function","startLoc":776,"text":"def totextfile(self, fileobj, endcard=False, overwrite=False):\n        \"\"\"\n        Write the header as text to a file or a file-like object.\n\n        Equivalent to::\n\n            >>> Header.tofile(fileobj, sep='\\\\n', endcard=False,\n            ...               padding=False, overwrite=overwrite)\n\n        See Also\n        --------\n        tofile\n        \"\"\"\n\n        self.tofile(fileobj, sep='\\n', endcard=endcard, padding=False,\n                    overwrite=overwrite)"},{"col":4,"comment":"null","endLoc":829,"header":"def __copy__(self)","id":1240,"name":"__copy__","nodeType":"Function","startLoc":828,"text":"def __copy__(self):\n        return self.copy()"},{"col":4,"comment":"null","endLoc":129,"header":"def __init__(self, second)","id":1241,"name":"__init__","nodeType":"Function","startLoc":128,"text":"def __init__(self, second):\n        self.second = second"},{"col":0,"comment":"null","endLoc":73,"header":"def get_extensions()","id":1242,"name":"get_extensions","nodeType":"Function","startLoc":72,"text":"def get_extensions():\n    return [_get_compression_extension()]"},{"col":4,"comment":"null","endLoc":832,"header":"def __deepcopy__(self, *args, **kwargs)","id":1243,"name":"__deepcopy__","nodeType":"Function","startLoc":831,"text":"def __deepcopy__(self, *args, **kwargs):\n        return self.copy()"},{"fileName":"__init__.py","filePath":"astropy/io/fits","id":1244,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\n\"\"\"\nA package for reading and writing FITS files and manipulating their\ncontents.\n\nA module for reading and writing Flexible Image Transport System\n(FITS) files.  This file format was endorsed by the International\nAstronomical Union in 1999 and mandated by NASA as the standard format\nfor storing high energy astrophysics data.  For details of the FITS\nstandard, see the NASA/Science Office of Standards and Technology\npublication, NOST 100-2.0.\n\"\"\"\n\nfrom astropy import config as _config\n\n# Set module-global boolean variables\n# TODO: Make it possible to set these variables via environment variables\n# again, once support for that is added to Astropy\n\n\nclass Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.io.fits`.\n    \"\"\"\n\n    enable_record_valued_keyword_cards = _config.ConfigItem(\n        True,\n        'If True, enable support for record-valued keywords as described by '\n        'FITS WCS distortion paper. Otherwise they are treated as normal '\n        'keywords.',\n        aliases=['astropy.io.fits.enabled_record_valued_keyword_cards'])\n    extension_name_case_sensitive = _config.ConfigItem(\n        False,\n        'If True, extension names (i.e. the ``EXTNAME`` keyword) should be '\n        'treated as case-sensitive.')\n    strip_header_whitespace = _config.ConfigItem(\n        True,\n        'If True, automatically remove trailing whitespace for string values in'\n        ' headers. Otherwise the values are returned verbatim, with all '\n        'whitespace intact.')\n    use_memmap = _config.ConfigItem(\n        True,\n        'If True, use memory-mapped file access to read/write the data in '\n        'FITS files. This generally provides better performance, especially '\n        'for large files, but may affect performance in I/O-heavy '\n        'applications.')\n    lazy_load_hdus = _config.ConfigItem(\n        True,\n        'If True, use lazy loading of HDUs when opening FITS files by '\n        'default; that is fits.open() will only seek for and read HDUs on '\n        'demand rather than reading all HDUs at once.  See the documentation '\n        'for fits.open() for more datails.')\n    enable_uint = _config.ConfigItem(\n        True,\n        'If True, default to recognizing the convention for representing '\n        'unsigned integers in FITS--if an array has BITPIX > 0, BSCALE = 1, '\n        'and BZERO = 2**BITPIX, represent the data as unsigned integers '\n        'per this convention.')\n\n\nconf = Conf()\n\n\n# Public API compatibility imports\n# These need to come after the global config variables, as some of the\n# submodules use them\nfrom . import card\nfrom . import column\nfrom . import convenience\nfrom . import hdu\nfrom .card import *\nfrom .column import *\nfrom .convenience import *\nfrom .diff import *\nfrom .fitsrec import FITS_record, FITS_rec\nfrom .hdu import *\n\nfrom .hdu.groups import GroupData\nfrom .hdu.hdulist import fitsopen as open\nfrom .hdu.image import Section\nfrom .header import Header\nfrom .verify import VerifyError\n\n\n__all__ = (['Conf', 'conf'] + card.__all__ + column.__all__ +\n           convenience.__all__ + hdu.__all__ +\n           ['FITS_record', 'FITS_rec', 'GroupData', 'open', 'Section',\n            'Header', 'VerifyError', 'conf'])\n"},{"col":0,"comment":"\n    Given an exception message string, uses new-style formatting arguments\n    ``{filename}``, ``{lineno}``, ``{func}`` and/or ``{text}`` to fill in\n    information about the exception that occurred.  For example:\n\n        try:\n            1/0\n        except:\n            raise ZeroDivisionError(\n                format_except('A divide by zero occurred in {filename} at '\n                              'line {lineno} of function {func}.'))\n\n    Any additional positional or keyword arguments passed to this function are\n    also used to format the message.\n\n    .. note::\n        This uses `sys.exc_info` to gather up the information needed to fill\n        in the formatting arguments. Since `sys.exc_info` is not carried\n        outside a handled exception, it's not wise to use this\n        outside of an ``except`` clause - if it is, this will substitute\n        '<unknown>' for the 4 formatting arguments.\n    ","endLoc":118,"header":"def format_exception(msg, *args, **kwargs)","id":1245,"name":"format_exception","nodeType":"Function","startLoc":87,"text":"def format_exception(msg, *args, **kwargs):\n    \"\"\"\n    Given an exception message string, uses new-style formatting arguments\n    ``{filename}``, ``{lineno}``, ``{func}`` and/or ``{text}`` to fill in\n    information about the exception that occurred.  For example:\n\n        try:\n            1/0\n        except:\n            raise ZeroDivisionError(\n                format_except('A divide by zero occurred in {filename} at '\n                              'line {lineno} of function {func}.'))\n\n    Any additional positional or keyword arguments passed to this function are\n    also used to format the message.\n\n    .. note::\n        This uses `sys.exc_info` to gather up the information needed to fill\n        in the formatting arguments. Since `sys.exc_info` is not carried\n        outside a handled exception, it's not wise to use this\n        outside of an ``except`` clause - if it is, this will substitute\n        '<unknown>' for the 4 formatting arguments.\n    \"\"\"\n\n    tb = traceback.extract_tb(sys.exc_info()[2], limit=1)\n    if len(tb) > 0:\n        filename, lineno, func, text = tb[0]\n    else:\n        filename = lineno = func = text = '<unknown>'\n\n    return msg.format(*args, filename=filename, lineno=lineno, func=func,\n                      text=text, **kwargs)"},{"className":"FITS_rec","col":0,"comment":"\n    FITS record array class.\n\n    `FITS_rec` is the data part of a table HDU's data part.  This is a layer\n    over the `~numpy.recarray`, so we can deal with scaled columns.\n\n    It inherits all of the standard methods from `numpy.ndarray`.\n    ","endLoc":1289,"id":1246,"nodeType":"Class","startLoc":141,"text":"class FITS_rec(np.recarray):\n    \"\"\"\n    FITS record array class.\n\n    `FITS_rec` is the data part of a table HDU's data part.  This is a layer\n    over the `~numpy.recarray`, so we can deal with scaled columns.\n\n    It inherits all of the standard methods from `numpy.ndarray`.\n    \"\"\"\n\n    _record_type = FITS_record\n    _character_as_bytes = False\n\n    def __new__(subtype, input):\n        \"\"\"\n        Construct a FITS record array from a recarray.\n        \"\"\"\n\n        # input should be a record array\n        if input.dtype.subdtype is None:\n            self = np.recarray.__new__(subtype, input.shape, input.dtype,\n                                       buf=input.data)\n        else:\n            self = np.recarray.__new__(subtype, input.shape, input.dtype,\n                                       buf=input.data, strides=input.strides)\n\n        self._init()\n        if self.dtype.fields:\n            self._nfields = len(self.dtype.fields)\n\n        return self\n\n    def __setstate__(self, state):\n        meta = state[-1]\n        column_state = state[-2]\n        state = state[:-2]\n\n        super().__setstate__(state)\n\n        self._col_weakrefs = weakref.WeakSet()\n\n        for attr, value in zip(meta, column_state):\n            setattr(self, attr, value)\n\n    def __reduce__(self):\n        \"\"\"\n        Return a 3-tuple for pickling a FITS_rec. Use the super-class\n        functionality but then add in a tuple of FITS_rec-specific\n        values that get used in __setstate__.\n        \"\"\"\n\n        reconst_func, reconst_func_args, state = super().__reduce__()\n\n        # Define FITS_rec-specific attrs that get added to state\n        column_state = []\n        meta = []\n\n        for attrs in ['_converted', '_heapoffset', '_heapsize', '_nfields',\n                      '_gap', '_uint', 'parnames', '_coldefs']:\n\n            with suppress(AttributeError):\n                # _coldefs can be Delayed, and file objects cannot be\n                # picked, it needs to be deepcopied first\n                if attrs == '_coldefs':\n                    column_state.append(self._coldefs.__deepcopy__(None))\n                else:\n                    column_state.append(getattr(self, attrs))\n                meta.append(attrs)\n\n        state = state + (column_state, meta)\n\n        return reconst_func, reconst_func_args, state\n\n    def __array_finalize__(self, obj):\n        if obj is None:\n            return\n\n        if isinstance(obj, FITS_rec):\n            self._character_as_bytes = obj._character_as_bytes\n\n        if isinstance(obj, FITS_rec) and obj.dtype == self.dtype:\n            self._converted = obj._converted\n            self._heapoffset = obj._heapoffset\n            self._heapsize = obj._heapsize\n            self._col_weakrefs = obj._col_weakrefs\n            self._coldefs = obj._coldefs\n            self._nfields = obj._nfields\n            self._gap = obj._gap\n            self._uint = obj._uint\n        elif self.dtype.fields is not None:\n            # This will allow regular ndarrays with fields, rather than\n            # just other FITS_rec objects\n            self._nfields = len(self.dtype.fields)\n            self._converted = {}\n\n            self._heapoffset = getattr(obj, '_heapoffset', 0)\n            self._heapsize = getattr(obj, '_heapsize', 0)\n\n            self._gap = getattr(obj, '_gap', 0)\n            self._uint = getattr(obj, '_uint', False)\n            self._col_weakrefs = weakref.WeakSet()\n            self._coldefs = ColDefs(self)\n\n            # Work around chicken-egg problem.  Column.array relies on the\n            # _coldefs attribute to set up ref back to parent FITS_rec; however\n            # in the above line the self._coldefs has not been assigned yet so\n            # this fails.  This patches that up...\n            for col in self._coldefs:\n                del col.array\n                col._parent_fits_rec = weakref.ref(self)\n        else:\n            self._init()\n\n    def _init(self):\n        \"\"\"Initializes internal attributes specific to FITS-isms.\"\"\"\n\n        self._nfields = 0\n        self._converted = {}\n        self._heapoffset = 0\n        self._heapsize = 0\n        self._col_weakrefs = weakref.WeakSet()\n        self._coldefs = None\n        self._gap = 0\n        self._uint = False\n\n    @classmethod\n    def from_columns(cls, columns, nrows=0, fill=False, character_as_bytes=False):\n        \"\"\"\n        Given a `ColDefs` object of unknown origin, initialize a new `FITS_rec`\n        object.\n\n        .. note::\n\n            This was originally part of the ``new_table`` function in the table\n            module but was moved into a class method since most of its\n            functionality always had more to do with initializing a `FITS_rec`\n            object than anything else, and much of it also overlapped with\n            ``FITS_rec._scale_back``.\n\n        Parameters\n        ----------\n        columns : sequence of `Column` or a `ColDefs`\n            The columns from which to create the table data.  If these\n            columns have data arrays attached that data may be used in\n            initializing the new table.  Otherwise the input columns\n            will be used as a template for a new table with the requested\n            number of rows.\n\n        nrows : int\n            Number of rows in the new table.  If the input columns have data\n            associated with them, the size of the largest input column is used.\n            Otherwise the default is 0.\n\n        fill : bool\n            If `True`, will fill all cells with zeros or blanks.  If\n            `False`, copy the data from input, undefined cells will still\n            be filled with zeros/blanks.\n        \"\"\"\n\n        if not isinstance(columns, ColDefs):\n            columns = ColDefs(columns)\n\n        # read the delayed data\n        for column in columns:\n            arr = column.array\n            if isinstance(arr, Delayed):\n                if arr.hdu.data is None:\n                    column.array = None\n                else:\n                    column.array = _get_recarray_field(arr.hdu.data,\n                                                       arr.field)\n        # Reset columns._arrays (which we may want to just do away with\n        # altogether\n        del columns._arrays\n\n        # use the largest column shape as the shape of the record\n        if nrows == 0:\n            for arr in columns._arrays:\n                if arr is not None:\n                    dim = arr.shape[0]\n                else:\n                    dim = 0\n                if dim > nrows:\n                    nrows = dim\n\n        raw_data = np.empty(columns.dtype.itemsize * nrows, dtype=np.uint8)\n        raw_data.fill(ord(columns._padding_byte))\n        data = np.recarray(nrows, dtype=columns.dtype, buf=raw_data).view(cls)\n        data._character_as_bytes = character_as_bytes\n\n        # Previously this assignment was made from hdu.columns, but that's a\n        # bug since if a _TableBaseHDU has a FITS_rec in its .data attribute\n        # the _TableBaseHDU.columns property is actually returned from\n        # .data._coldefs, so this assignment was circular!  Don't make that\n        # mistake again.\n        # All of this is an artifact of the fragility of the FITS_rec class,\n        # and that it can't just be initialized by columns...\n        data._coldefs = columns\n\n        # If fill is True we don't copy anything from the column arrays.  We're\n        # just using them as a template, and returning a table filled with\n        # zeros/blanks\n        if fill:\n            return data\n\n        # Otherwise we have to fill the recarray with data from the input\n        # columns\n        for idx, column in enumerate(columns):\n            # For each column in the ColDef object, determine the number of\n            # rows in that column.  This will be either the number of rows in\n            # the ndarray associated with the column, or the number of rows\n            # given in the call to this function, which ever is smaller.  If\n            # the input FILL argument is true, the number of rows is set to\n            # zero so that no data is copied from the original input data.\n            arr = column.array\n\n            if arr is None:\n                array_size = 0\n            else:\n                array_size = len(arr)\n\n            n = min(array_size, nrows)\n\n            # TODO: At least *some* of this logic is mostly redundant with the\n            # _convert_foo methods in this class; see if we can eliminate some\n            # of that duplication.\n\n            if not n:\n                # The input column had an empty array, so just use the fill\n                # value\n                continue\n\n            field = _get_recarray_field(data, idx)\n            name = column.name\n            fitsformat = column.format\n            recformat = fitsformat.recformat\n\n            outarr = field[:n]\n            inarr = arr[:n]\n\n            if isinstance(recformat, _FormatX):\n                # Data is a bit array\n                if inarr.shape[-1] == recformat.repeat:\n                    _wrapx(inarr, outarr, recformat.repeat)\n                    continue\n            elif isinstance(recformat, _FormatP):\n                data._cache_field(name, _makep(inarr, field, recformat,\n                                               nrows=nrows))\n                continue\n            # TODO: Find a better way of determining that the column is meant\n            # to be FITS L formatted\n            elif recformat[-2:] == FITS2NUMPY['L'] and inarr.dtype == bool:\n                # column is boolean\n                # The raw data field should be filled with either 'T' or 'F'\n                # (not 0).  Use 'F' as a default\n                field[:] = ord('F')\n                # Also save the original boolean array in data._converted so\n                # that it doesn't have to be re-converted\n                converted = np.zeros(field.shape, dtype=bool)\n                converted[:n] = inarr\n                data._cache_field(name, converted)\n                # TODO: Maybe this step isn't necessary at all if _scale_back\n                # will handle it?\n                inarr = np.where(inarr == np.False_, ord('F'), ord('T'))\n            elif (columns[idx]._physical_values and\n                    columns[idx]._pseudo_unsigned_ints):\n                # Temporary hack...\n                bzero = column.bzero\n                converted = np.zeros(field.shape, dtype=inarr.dtype)\n                converted[:n] = inarr\n                data._cache_field(name, converted)\n                if n < nrows:\n                    # Pre-scale rows below the input data\n                    field[n:] = -bzero\n\n                inarr = inarr - bzero\n            elif isinstance(columns, _AsciiColDefs):\n                # Regardless whether the format is character or numeric, if the\n                # input array contains characters then it's already in the raw\n                # format for ASCII tables\n                if fitsformat._pseudo_logical:\n                    # Hack to support converting from 8-bit T/F characters\n                    # Normally the column array is a chararray of 1 character\n                    # strings, but we need to view it as a normal ndarray of\n                    # 8-bit ints to fill it with ASCII codes for 'T' and 'F'\n                    outarr = field.view(np.uint8, np.ndarray)[:n]\n                elif arr.dtype.kind not in ('S', 'U'):\n                    # Set up views of numeric columns with the appropriate\n                    # numeric dtype\n                    # Fill with the appropriate blanks for the column format\n                    data._cache_field(name, np.zeros(nrows, dtype=arr.dtype))\n                    outarr = data._converted[name][:n]\n\n                outarr[:] = inarr\n                continue\n\n            if inarr.shape != outarr.shape:\n                if (inarr.dtype.kind == outarr.dtype.kind and\n                        inarr.dtype.kind in ('U', 'S') and\n                        inarr.dtype != outarr.dtype):\n\n                    inarr_rowsize = inarr[0].size\n                    inarr = inarr.flatten().view(outarr.dtype)\n\n                # This is a special case to handle input arrays with\n                # non-trivial TDIMn.\n                # By design each row of the outarray is 1-D, while each row of\n                # the input array may be n-D\n                if outarr.ndim > 1:\n                    # The normal case where the first dimension is the rows\n                    inarr_rowsize = inarr[0].size\n                    inarr = inarr.reshape(n, inarr_rowsize)\n                    outarr[:, :inarr_rowsize] = inarr\n                else:\n                    # Special case for strings where the out array only has one\n                    # dimension (the second dimension is rolled up into the\n                    # strings\n                    outarr[:n] = inarr.ravel()\n            else:\n                outarr[:] = inarr\n\n        # Now replace the original column array references with the new\n        # fields\n        # This is required to prevent the issue reported in\n        # https://github.com/spacetelescope/PyFITS/issues/99\n        for idx in range(len(columns)):\n            columns._arrays[idx] = data.field(idx)\n\n        return data\n\n    def __repr__(self):\n        # Force use of the normal ndarray repr (rather than the new\n        # one added for recarray in Numpy 1.10) for backwards compat\n        return np.ndarray.__repr__(self)\n\n    def __getattribute__(self, attr):\n        # First, see if ndarray has this attr, and return it if so. Note that\n        # this means a field with the same name as an ndarray attr cannot be\n        # accessed by attribute, this is Numpy's default behavior.\n        # We avoid using np.recarray.__getattribute__ here because after doing\n        # this check it would access the columns without doing the conversions\n        # that we need (with .field, see below).\n        try:\n            return object.__getattribute__(self, attr)\n        except AttributeError:\n            pass\n\n        # attr might still be a fieldname.  If we have column definitions,\n        # we should access this via .field, as the data may have to be scaled.\n        if self._coldefs is not None and attr in self.columns.names:\n            return self.field(attr)\n\n        # If not, just let the usual np.recarray override deal with it.\n        return super().__getattribute__(attr)\n\n    def __getitem__(self, key):\n        if self._coldefs is None:\n            return super().__getitem__(key)\n\n        if isinstance(key, str):\n            return self.field(key)\n\n        # Have to view as a recarray then back as a FITS_rec, otherwise the\n        # circular reference fix/hack in FITS_rec.field() won't preserve\n        # the slice.\n        out = self.view(np.recarray)[key]\n        if type(out) is not np.recarray:\n            # Oops, we got a single element rather than a view. In that case,\n            # return a Record, which has no __getstate__ and is more efficient.\n            return self._record_type(self, key)\n\n        # We got a view; change it back to our class, and add stuff\n        out = out.view(type(self))\n        out._uint = self._uint\n        out._coldefs = ColDefs(self._coldefs)\n        arrays = []\n        out._converted = {}\n        for idx, name in enumerate(self._coldefs.names):\n            #\n            # Store the new arrays for the _coldefs object\n            #\n            arrays.append(self._coldefs._arrays[idx][key])\n\n            # Ensure that the sliced FITS_rec will view the same scaled\n            # columns as the original; this is one of the few cases where\n            # it is not necessary to use _cache_field()\n            if name in self._converted:\n                dummy = self._converted[name]\n                field = np.ndarray.__getitem__(dummy, key)\n                out._converted[name] = field\n\n        out._coldefs._arrays = arrays\n        return out\n\n    def __setitem__(self, key, value):\n        if self._coldefs is None:\n            return super().__setitem__(key, value)\n\n        if isinstance(key, str):\n            self[key][:] = value\n            return\n\n        if isinstance(key, slice):\n            end = min(len(self), key.stop or len(self))\n            end = max(0, end)\n            start = max(0, key.start or 0)\n            end = min(end, start + len(value))\n\n            for idx in range(start, end):\n                self.__setitem__(idx, value[idx - start])\n            return\n\n        if isinstance(value, FITS_record):\n            for idx in range(self._nfields):\n                self.field(self.names[idx])[key] = value.field(self.names[idx])\n        elif isinstance(value, (tuple, list, np.void)):\n            if self._nfields == len(value):\n                for idx in range(self._nfields):\n                    self.field(idx)[key] = value[idx]\n            else:\n                raise ValueError('Input tuple or list required to have {} '\n                                 'elements.'.format(self._nfields))\n        else:\n            raise TypeError('Assignment requires a FITS_record, tuple, or '\n                            'list as input.')\n\n    def _ipython_key_completions_(self):\n        return self.names\n\n    def copy(self, order='C'):\n        \"\"\"\n        The Numpy documentation lies; `numpy.ndarray.copy` is not equivalent to\n        `numpy.copy`.  Differences include that it re-views the copied array as\n        self's ndarray subclass, as though it were taking a slice; this means\n        ``__array_finalize__`` is called and the copy shares all the array\n        attributes (including ``._converted``!).  So we need to make a deep\n        copy of all those attributes so that the two arrays truly do not share\n        any data.\n        \"\"\"\n\n        new = super().copy(order=order)\n\n        new.__dict__ = copy.deepcopy(self.__dict__)\n        return new\n\n    @property\n    def columns(self):\n        \"\"\"A user-visible accessor for the coldefs.\"\"\"\n\n        return self._coldefs\n\n    @property\n    def _coldefs(self):\n        # This used to be a normal internal attribute, but it was changed to a\n        # property as a quick and transparent way to work around the reference\n        # leak bug fixed in https://github.com/astropy/astropy/pull/4539\n        #\n        # See the long comment in the Column.array property for more details\n        # on this.  But in short, FITS_rec now has a ._col_weakrefs attribute\n        # which is a WeakSet of weakrefs to each Column in _coldefs.\n        #\n        # So whenever ._coldefs is set we also add each Column in the ColDefs\n        # to the weakrefs set.  This is an easy way to find out if a Column has\n        # any references to it external to the FITS_rec (i.e. a user assigned a\n        # column to a variable).  If the column is still in _col_weakrefs then\n        # there are other references to it external to this FITS_rec.  We use\n        # that information in __del__ to save off copies of the array data\n        # for those columns to their Column.array property before our memory\n        # is freed.\n        return self.__dict__.get('_coldefs')\n\n    @_coldefs.setter\n    def _coldefs(self, cols):\n        self.__dict__['_coldefs'] = cols\n        if isinstance(cols, ColDefs):\n            for col in cols.columns:\n                self._col_weakrefs.add(col)\n\n    @_coldefs.deleter\n    def _coldefs(self):\n        try:\n            del self.__dict__['_coldefs']\n        except KeyError as exc:\n            raise AttributeError(exc.args[0])\n\n    def __del__(self):\n        try:\n            del self._coldefs\n            if self.dtype.fields is not None:\n                for col in self._col_weakrefs:\n\n                    if col.array is not None:\n                        col.array = col.array.copy()\n\n        # See issues #4690 and #4912\n        except (AttributeError, TypeError):  # pragma: no cover\n            pass\n\n    @property\n    def names(self):\n        \"\"\"List of column names.\"\"\"\n\n        if self.dtype.fields:\n            return list(self.dtype.names)\n        elif getattr(self, '_coldefs', None) is not None:\n            return self._coldefs.names\n        else:\n            return None\n\n    @property\n    def formats(self):\n        \"\"\"List of column FITS formats.\"\"\"\n\n        if getattr(self, '_coldefs', None) is not None:\n            return self._coldefs.formats\n\n        return None\n\n    @property\n    def _raw_itemsize(self):\n        \"\"\"\n        Returns the size of row items that would be written to the raw FITS\n        file, taking into account the possibility of unicode columns being\n        compactified.\n\n        Currently for internal use only.\n        \"\"\"\n\n        if _has_unicode_fields(self):\n            total_itemsize = 0\n            for field in self.dtype.fields.values():\n                itemsize = field[0].itemsize\n                if field[0].kind == 'U':\n                    itemsize = itemsize // 4\n                total_itemsize += itemsize\n            return total_itemsize\n        else:\n            # Just return the normal itemsize\n            return self.itemsize\n\n    def field(self, key):\n        \"\"\"\n        A view of a `Column`'s data as an array.\n        \"\"\"\n\n        # NOTE: The *column* index may not be the same as the field index in\n        # the recarray, if the column is a phantom column\n        column = self.columns[key]\n        name = column.name\n        format = column.format\n\n        if format.dtype.itemsize == 0:\n            warnings.warn(\n                'Field {!r} has a repeat count of 0 in its format code, '\n                'indicating an empty field.'.format(key))\n            return np.array([], dtype=format.dtype)\n\n        # If field's base is a FITS_rec, we can run into trouble because it\n        # contains a reference to the ._coldefs object of the original data;\n        # this can lead to a circular reference; see ticket #49\n        base = self\n        while (isinstance(base, FITS_rec) and\n                isinstance(base.base, np.recarray)):\n            base = base.base\n        # base could still be a FITS_rec in some cases, so take care to\n        # use rec.recarray.field to avoid a potential infinite\n        # recursion\n        field = _get_recarray_field(base, name)\n\n        if name not in self._converted:\n            recformat = format.recformat\n            # TODO: If we're now passing the column to these subroutines, do we\n            # really need to pass them the recformat?\n            if isinstance(recformat, _FormatP):\n                # for P format\n                converted = self._convert_p(column, field, recformat)\n            else:\n                # Handle all other column data types which are fixed-width\n                # fields\n                converted = self._convert_other(column, field, recformat)\n\n            # Note: Never assign values directly into the self._converted dict;\n            # always go through self._cache_field; this way self._converted is\n            # only used to store arrays that are not already direct views of\n            # our own data.\n            self._cache_field(name, converted)\n            return converted\n\n        return self._converted[name]\n\n    def _cache_field(self, name, field):\n        \"\"\"\n        Do not store fields in _converted if one of its bases is self,\n        or if it has a common base with self.\n\n        This results in a reference cycle that cannot be broken since\n        ndarrays do not participate in cyclic garbage collection.\n        \"\"\"\n\n        base = field\n        while True:\n            self_base = self\n            while True:\n                if self_base is base:\n                    return\n\n                if getattr(self_base, 'base', None) is not None:\n                    self_base = self_base.base\n                else:\n                    break\n\n            if getattr(base, 'base', None) is not None:\n                base = base.base\n            else:\n                break\n\n        self._converted[name] = field\n\n    def _update_column_attribute_changed(self, column, idx, attr, old_value,\n                                         new_value):\n        \"\"\"\n        Update how the data is formatted depending on changes to column\n        attributes initiated by the user through the `Column` interface.\n\n        Dispatches column attribute change notifications to individual methods\n        for each attribute ``_update_column_<attr>``\n        \"\"\"\n\n        method_name = f'_update_column_{attr}'\n        if hasattr(self, method_name):\n            # Right now this is so we can be lazy and not implement updaters\n            # for every attribute yet--some we may not need at all, TBD\n            getattr(self, method_name)(column, idx, old_value, new_value)\n\n    def _update_column_name(self, column, idx, old_name, name):\n        \"\"\"Update the dtype field names when a column name is changed.\"\"\"\n\n        dtype = self.dtype\n        # Updating the names on the dtype should suffice\n        dtype.names = dtype.names[:idx] + (name,) + dtype.names[idx + 1:]\n\n    def _convert_x(self, field, recformat):\n        \"\"\"Convert a raw table column to a bit array as specified by the\n        FITS X format.\n        \"\"\"\n\n        dummy = np.zeros(self.shape + (recformat.repeat,), dtype=np.bool_)\n        _unwrapx(field, dummy, recformat.repeat)\n        return dummy\n\n    def _convert_p(self, column, field, recformat):\n        \"\"\"Convert a raw table column of FITS P or Q format descriptors\n        to a VLA column with the array data returned from the heap.\n        \"\"\"\n\n        dummy = _VLF([None] * len(self), dtype=recformat.dtype)\n        raw_data = self._get_raw_data()\n\n        if raw_data is None:\n            raise OSError(\n                \"Could not find heap data for the {!r} variable-length \"\n                \"array column.\".format(column.name))\n\n        for idx in range(len(self)):\n            offset = field[idx, 1] + self._heapoffset\n            count = field[idx, 0]\n\n            if recformat.dtype == 'a':\n                dt = np.dtype(recformat.dtype + str(1))\n                arr_len = count * dt.itemsize\n                da = raw_data[offset:offset + arr_len].view(dt)\n                da = np.char.array(da.view(dtype=dt), itemsize=count)\n                dummy[idx] = decode_ascii(da)\n            else:\n                dt = np.dtype(recformat.dtype)\n                arr_len = count * dt.itemsize\n                dummy[idx] = raw_data[offset:offset + arr_len].view(dt)\n                dummy[idx].dtype = dummy[idx].dtype.newbyteorder('>')\n                # Each array in the field may now require additional\n                # scaling depending on the other scaling parameters\n                # TODO: The same scaling parameters apply to every\n                # array in the column so this is currently very slow; we\n                # really only need to check once whether any scaling will\n                # be necessary and skip this step if not\n                # TODO: Test that this works for X format; I don't think\n                # that it does--the recformat variable only applies to the P\n                # format not the X format\n                dummy[idx] = self._convert_other(column, dummy[idx],\n                                                 recformat)\n\n        return dummy\n\n    def _convert_ascii(self, column, field):\n        \"\"\"\n        Special handling for ASCII table columns to convert columns containing\n        numeric types to actual numeric arrays from the string representation.\n        \"\"\"\n\n        format = column.format\n        recformat = getattr(format, 'recformat', ASCII2NUMPY[format[0]])\n        # if the string = TNULL, return ASCIITNULL\n        nullval = str(column.null).strip().encode('ascii')\n        if len(nullval) > format.width:\n            nullval = nullval[:format.width]\n\n        # Before using .replace make sure that any trailing bytes in each\n        # column are filled with spaces, and *not*, say, nulls; this causes\n        # functions like replace to potentially leave gibberish bytes in the\n        # array buffer.\n        dummy = np.char.ljust(field, format.width)\n        dummy = np.char.replace(dummy, encode_ascii('D'), encode_ascii('E'))\n        null_fill = encode_ascii(str(ASCIITNULL).rjust(format.width))\n\n        # Convert all fields equal to the TNULL value (nullval) to empty fields.\n        # TODO: These fields really should be converted to NaN or something else undefined.\n        # Currently they are converted to empty fields, which are then set to zero.\n        dummy = np.where(np.char.strip(dummy) == nullval, null_fill, dummy)\n\n        # always replace empty fields, see https://github.com/astropy/astropy/pull/5394\n        if nullval != b'':\n            dummy = np.where(np.char.strip(dummy) == b'', null_fill, dummy)\n\n        try:\n            dummy = np.array(dummy, dtype=recformat)\n        except ValueError as exc:\n            indx = self.names.index(column.name)\n            raise ValueError(\n                '{}; the header may be missing the necessary TNULL{} '\n                'keyword or the table contains invalid data'.format(\n                    exc, indx + 1))\n\n        return dummy\n\n    def _convert_other(self, column, field, recformat):\n        \"\"\"Perform conversions on any other fixed-width column data types.\n\n        This may not perform any conversion at all if it's not necessary, in\n        which case the original column array is returned.\n        \"\"\"\n\n        if isinstance(recformat, _FormatX):\n            # special handling for the X format\n            return self._convert_x(field, recformat)\n\n        (_str, _bool, _number, _scale, _zero, bscale, bzero, dim) = \\\n            self._get_scale_factors(column)\n\n        indx = self.names.index(column.name)\n\n        # ASCII table, convert strings to numbers\n        # TODO:\n        # For now, check that these are ASCII columns by checking the coldefs\n        # type; in the future all columns (for binary tables, ASCII tables, or\n        # otherwise) should \"know\" what type they are already and how to handle\n        # converting their data from FITS format to native format and vice\n        # versa...\n        if not _str and isinstance(self._coldefs, _AsciiColDefs):\n            field = self._convert_ascii(column, field)\n\n        # Test that the dimensions given in dim are sensible; otherwise\n        # display a warning and ignore them\n        if dim:\n            # See if the dimensions already match, if not, make sure the\n            # number items will fit in the specified dimensions\n            if field.ndim > 1:\n                actual_shape = field.shape[1:]\n                if _str:\n                    actual_shape = actual_shape + (field.itemsize,)\n            else:\n                actual_shape = field.shape[0]\n\n            if dim == actual_shape:\n                # The array already has the correct dimensions, so we\n                # ignore dim and don't convert\n                dim = None\n            else:\n                nitems = reduce(operator.mul, dim)\n                if _str:\n                    actual_nitems = field.itemsize\n                elif len(field.shape) == 1:  # No repeat count in TFORMn, equivalent to 1\n                    actual_nitems = 1\n                else:\n                    actual_nitems = field.shape[1]\n                if nitems > actual_nitems:\n                    warnings.warn(\n                        'TDIM{} value {:d} does not fit with the size of '\n                        'the array items ({:d}).  TDIM{:d} will be ignored.'\n                        .format(indx + 1, self._coldefs[indx].dims,\n                                actual_nitems, indx + 1))\n                    dim = None\n\n        # further conversion for both ASCII and binary tables\n        # For now we've made columns responsible for *knowing* whether their\n        # data has been scaled, but we make the FITS_rec class responsible for\n        # actually doing the scaling\n        # TODO: This also needs to be fixed in the effort to make Columns\n        # responsible for scaling their arrays to/from FITS native values\n        if not column.ascii and column.format.p_format:\n            format_code = column.format.p_format\n        else:\n            # TODO: Rather than having this if/else it might be nice if the\n            # ColumnFormat class had an attribute guaranteed to give the format\n            # of actual values in a column regardless of whether the true\n            # format is something like P or Q\n            format_code = column.format.format\n\n        if (_number and (_scale or _zero) and not column._physical_values):\n            # This is to handle pseudo unsigned ints in table columns\n            # TODO: For now this only really works correctly for binary tables\n            # Should it work for ASCII tables as well?\n            if self._uint:\n                if bzero == 2**15 and format_code == 'I':\n                    field = np.array(field, dtype=np.uint16)\n                elif bzero == 2**31 and format_code == 'J':\n                    field = np.array(field, dtype=np.uint32)\n                elif bzero == 2**63 and format_code == 'K':\n                    field = np.array(field, dtype=np.uint64)\n                    bzero64 = np.uint64(2 ** 63)\n                else:\n                    field = np.array(field, dtype=np.float64)\n            else:\n                field = np.array(field, dtype=np.float64)\n\n            if _scale:\n                np.multiply(field, bscale, field)\n            if _zero:\n                if self._uint and format_code == 'K':\n                    # There is a chance of overflow, so be careful\n                    test_overflow = field.copy()\n                    try:\n                        test_overflow += bzero64\n                    except OverflowError:\n                        warnings.warn(\n                            \"Overflow detected while applying TZERO{:d}. \"\n                            \"Returning unscaled data.\".format(indx + 1))\n                    else:\n                        field = test_overflow\n                else:\n                    field += bzero\n\n            # mark the column as scaled\n            column._physical_values = True\n\n        elif _bool and field.dtype != bool:\n            field = np.equal(field, ord('T'))\n        elif _str:\n            if not self._character_as_bytes:\n                with suppress(UnicodeDecodeError):\n                    field = decode_ascii(field)\n\n        if dim:\n            # Apply the new field item dimensions\n            nitems = reduce(operator.mul, dim)\n            if field.ndim > 1:\n                field = field[:, :nitems]\n            if _str:\n                fmt = field.dtype.char\n                dtype = (f'|{fmt}{dim[-1]}', dim[:-1])\n                field.dtype = dtype\n            else:\n                field.shape = (field.shape[0],) + dim\n\n        return field\n\n    def _get_heap_data(self):\n        \"\"\"\n        Returns a pointer into the table's raw data to its heap (if present).\n\n        This is returned as a numpy byte array.\n        \"\"\"\n\n        if self._heapsize:\n            raw_data = self._get_raw_data().view(np.ubyte)\n            heap_end = self._heapoffset + self._heapsize\n            return raw_data[self._heapoffset:heap_end]\n        else:\n            return np.array([], dtype=np.ubyte)\n\n    def _get_raw_data(self):\n        \"\"\"\n        Returns the base array of self that \"raw data array\" that is the\n        array in the format that it was first read from a file before it was\n        sliced or viewed as a different type in any way.\n\n        This is determined by walking through the bases until finding one that\n        has at least the same number of bytes as self, plus the heapsize.  This\n        may be the immediate .base but is not always.  This is used primarily\n        for variable-length array support which needs to be able to find the\n        heap (the raw data *may* be larger than nbytes + heapsize if it\n        contains a gap or padding).\n\n        May return ``None`` if no array resembling the \"raw data\" according to\n        the stated criteria can be found.\n        \"\"\"\n\n        raw_data_bytes = self.nbytes + self._heapsize\n        base = self\n        while hasattr(base, 'base') and base.base is not None:\n            base = base.base\n            if hasattr(base, 'nbytes') and base.nbytes >= raw_data_bytes:\n                return base\n\n    def _get_scale_factors(self, column):\n        \"\"\"Get all the scaling flags and factors for one column.\"\"\"\n\n        # TODO: Maybe this should be a method/property on Column?  Or maybe\n        # it's not really needed at all...\n        _str = column.format.format == 'A'\n        _bool = column.format.format == 'L'\n\n        _number = not (_bool or _str)\n        bscale = column.bscale\n        bzero = column.bzero\n\n        _scale = bscale not in ('', None, 1)\n        _zero = bzero not in ('', None, 0)\n\n        # ensure bscale/bzero are numbers\n        if not _scale:\n            bscale = 1\n        if not _zero:\n            bzero = 0\n\n        # column._dims gives a tuple, rather than column.dim which returns the\n        # original string format code from the FITS header...\n        dim = column._dims\n\n        return (_str, _bool, _number, _scale, _zero, bscale, bzero, dim)\n\n    def _scale_back(self, update_heap_pointers=True):\n        \"\"\"\n        Update the parent array, using the (latest) scaled array.\n\n        If ``update_heap_pointers`` is `False`, this will leave all the heap\n        pointers in P/Q columns as they are verbatim--it only makes sense to do\n        this if there is already data on the heap and it can be guaranteed that\n        that data has not been modified, and there is not new data to add to\n        the heap.  Currently this is only used as an optimization for\n        CompImageHDU that does its own handling of the heap.\n        \"\"\"\n\n        # Running total for the new heap size\n        heapsize = 0\n\n        for indx, name in enumerate(self.dtype.names):\n            column = self._coldefs[indx]\n            recformat = column.format.recformat\n            raw_field = _get_recarray_field(self, indx)\n\n            # add the location offset of the heap area for each\n            # variable length column\n            if isinstance(recformat, _FormatP):\n                # Irritatingly, this can return a different dtype than just\n                # doing np.dtype(recformat.dtype); but this returns the results\n                # that we want.  For example if recformat.dtype is 'a' we want\n                # an array of characters.\n                dtype = np.array([], dtype=recformat.dtype).dtype\n\n                if update_heap_pointers and name in self._converted:\n                    # The VLA has potentially been updated, so we need to\n                    # update the array descriptors\n                    raw_field[:] = 0  # reset\n                    npts = [len(arr) for arr in self._converted[name]]\n\n                    raw_field[:len(npts), 0] = npts\n                    raw_field[1:, 1] = (np.add.accumulate(raw_field[:-1, 0]) *\n                                        dtype.itemsize)\n                    raw_field[:, 1][:] += heapsize\n\n                heapsize += raw_field[:, 0].sum() * dtype.itemsize\n                # Even if this VLA has not been read or updated, we need to\n                # include the size of its constituent arrays in the heap size\n                # total\n\n            if isinstance(recformat, _FormatX) and name in self._converted:\n                _wrapx(self._converted[name], raw_field, recformat.repeat)\n                continue\n\n            _str, _bool, _number, _scale, _zero, bscale, bzero, _ = \\\n                self._get_scale_factors(column)\n\n            field = self._converted.get(name, raw_field)\n\n            # conversion for both ASCII and binary tables\n            if _number or _str:\n                if _number and (_scale or _zero) and column._physical_values:\n                    dummy = field.copy()\n                    if _zero:\n                        dummy -= bzero\n                    if _scale:\n                        dummy /= bscale\n                    # This will set the raw values in the recarray back to\n                    # their non-physical storage values, so the column should\n                    # be mark is not scaled\n                    column._physical_values = False\n                elif _str or isinstance(self._coldefs, _AsciiColDefs):\n                    dummy = field\n                else:\n                    continue\n\n                # ASCII table, convert numbers to strings\n                if isinstance(self._coldefs, _AsciiColDefs):\n                    self._scale_back_ascii(indx, dummy, raw_field)\n                # binary table string column\n                elif isinstance(raw_field, chararray.chararray):\n                    self._scale_back_strings(indx, dummy, raw_field)\n                # all other binary table columns\n                else:\n                    if len(raw_field) and isinstance(raw_field[0],\n                                                     np.integer):\n                        dummy = np.around(dummy)\n\n                    if raw_field.shape == dummy.shape:\n                        raw_field[:] = dummy\n                    else:\n                        # Reshaping the data is necessary in cases where the\n                        # TDIMn keyword was used to shape a column's entries\n                        # into arrays\n                        raw_field[:] = dummy.ravel().view(raw_field.dtype)\n\n                del dummy\n\n            # ASCII table does not have Boolean type\n            elif _bool and name in self._converted:\n                choices = (np.array([ord('F')], dtype=np.int8)[0],\n                           np.array([ord('T')], dtype=np.int8)[0])\n                raw_field[:] = np.choose(field, choices)\n\n        # Store the updated heapsize\n        self._heapsize = heapsize\n\n    def _scale_back_strings(self, col_idx, input_field, output_field):\n        # There are a few possibilities this has to be able to handle properly\n        # The input_field, which comes from the _converted column is of dtype\n        # 'Un' so that elements read out of the array are normal str\n        # objects (i.e. unicode strings)\n        #\n        # At the other end the *output_field* may also be of type 'S' or of\n        # type 'U'.  It will *usually* be of type 'S' because when reading\n        # an existing FITS table the raw data is just ASCII strings, and\n        # represented in Numpy as an S array.  However, when a user creates\n        # a new table from scratch, they *might* pass in a column containing\n        # unicode strings (dtype 'U').  Therefore the output_field of the\n        # raw array is actually a unicode array.  But we still want to make\n        # sure the data is encodable as ASCII.  Later when we write out the\n        # array we use, in the dtype 'U' case, a different write routine\n        # that writes row by row and encodes any 'U' columns to ASCII.\n\n        # If the output_field is non-ASCII we will worry about ASCII encoding\n        # later when writing; otherwise we can do it right here\n        if input_field.dtype.kind == 'U' and output_field.dtype.kind == 'S':\n            try:\n                _ascii_encode(input_field, out=output_field)\n            except _UnicodeArrayEncodeError as exc:\n                raise ValueError(\n                    \"Could not save column '{}': Contains characters that \"\n                    \"cannot be encoded as ASCII as required by FITS, starting \"\n                    \"at the index {!r} of the column, and the index {} of \"\n                    \"the string at that location.\".format(\n                        self._coldefs[col_idx].name,\n                        exc.index[0] if len(exc.index) == 1 else exc.index,\n                        exc.start))\n        else:\n            # Otherwise go ahead and do a direct copy into--if both are type\n            # 'U' we'll handle encoding later\n            input_field = input_field.flatten().view(output_field.dtype)\n            output_field.flat[:] = input_field\n\n        # Ensure that blanks at the end of each string are\n        # converted to nulls instead of spaces, see Trac #15\n        # and #111\n        _rstrip_inplace(output_field)\n\n    def _scale_back_ascii(self, col_idx, input_field, output_field):\n        \"\"\"\n        Convert internal array values back to ASCII table representation.\n\n        The ``input_field`` is the internal representation of the values, and\n        the ``output_field`` is the character array representing the ASCII\n        output that will be written.\n        \"\"\"\n\n        starts = self._coldefs.starts[:]\n        spans = self._coldefs.spans\n        format = self._coldefs[col_idx].format\n\n        # The the index of the \"end\" column of the record, beyond\n        # which we can't write\n        end = super().field(-1).itemsize\n        starts.append(end + starts[-1])\n\n        if col_idx > 0:\n            lead = starts[col_idx] - starts[col_idx - 1] - spans[col_idx - 1]\n        else:\n            lead = 0\n\n        if lead < 0:\n            warnings.warn('Column {!r} starting point overlaps the previous '\n                          'column.'.format(col_idx + 1))\n\n        trail = starts[col_idx + 1] - starts[col_idx] - spans[col_idx]\n\n        if trail < 0:\n            warnings.warn('Column {!r} ending point overlaps the next '\n                          'column.'.format(col_idx + 1))\n\n        # TODO: It would be nice if these string column formatting\n        # details were left to a specialized class, as is the case\n        # with FormatX and FormatP\n        if 'A' in format:\n            _pc = '{:'\n        else:\n            _pc = '{:>'\n\n        fmt = ''.join([_pc, format[1:], ASCII2STR[format[0]], '}',\n                       (' ' * trail)])\n\n        # Even if the format precision is 0, we should output a decimal point\n        # as long as there is space to do so--not including a decimal point in\n        # a float value is discouraged by the FITS Standard\n        trailing_decimal = (format.precision == 0 and\n                            format.format in ('F', 'E', 'D'))\n\n        # not using numarray.strings's num2char because the\n        # result is not allowed to expand (as C/Python does).\n        for jdx, value in enumerate(input_field):\n            value = fmt.format(value)\n            if len(value) > starts[col_idx + 1] - starts[col_idx]:\n                raise ValueError(\n                    \"Value {!r} does not fit into the output's itemsize of \"\n                    \"{}.\".format(value, spans[col_idx]))\n\n            if trailing_decimal and value[0] == ' ':\n                # We have some extra space in the field for the trailing\n                # decimal point\n                value = value[1:] + '.'\n\n            output_field[jdx] = value\n\n        # Replace exponent separator in floating point numbers\n        if 'D' in format:\n            output_field[:] = output_field.replace(b'E', b'D')\n\n    def tolist(self):\n        # Override .tolist to take care of special case of VLF\n\n        column_lists = [self[name].tolist() for name in self.columns.names]\n\n        return [list(row) for row in zip(*column_lists)]"},{"col":4,"comment":"null","endLoc":458,"header":"@comment.deleter\n    def comment(self)","id":1247,"name":"comment","nodeType":"Function","startLoc":451,"text":"@comment.deleter\n    def comment(self):\n        if self._invalid:\n            raise ValueError(\n                'The comment of invalid/unparsable cards cannot deleted.  '\n                'Either delete this card from the header or replace it.')\n\n        self.comment = ''"},{"col":4,"comment":"\n        The field-specifier of record-valued keyword cards; always `None` on\n        normal cards.\n        ","endLoc":472,"header":"@property\n    def field_specifier(self)","id":1248,"name":"field_specifier","nodeType":"Function","startLoc":460,"text":"@property\n    def field_specifier(self):\n        \"\"\"\n        The field-specifier of record-valued keyword cards; always `None` on\n        normal cards.\n        \"\"\"\n\n        # Ensure that the keyword exists and has been parsed--the will set the\n        # internal _field_specifier attribute if this is a RVKC.\n        if self.keyword:\n            return self._field_specifier\n        else:\n            return None"},{"col":4,"comment":"null","endLoc":488,"header":"@field_specifier.setter\n    def field_specifier(self, field_specifier)","id":1249,"name":"field_specifier","nodeType":"Function","startLoc":474,"text":"@field_specifier.setter\n    def field_specifier(self, field_specifier):\n        if not field_specifier:\n            raise ValueError('The field-specifier may not be blank in '\n                             'record-valued keyword cards.')\n        elif not self.field_specifier:\n            raise AttributeError('Cannot coerce cards to be record-valued '\n                                 'keyword cards by setting the '\n                                 'field_specifier attribute')\n        elif field_specifier != self.field_specifier:\n            self._field_specifier = field_specifier\n            # The keyword need also be updated\n            keyword = self._keyword.split('.', 1)[0]\n            self._keyword = '.'.join([keyword, field_specifier])\n            self._modified = True"},{"col":4,"comment":"\n        Similar to :meth:`dict.fromkeys`--creates a new `Header` from an\n        iterable of keywords and an optional default value.\n\n        This method is not likely to be particularly useful for creating real\n        world FITS headers, but it is useful for testing.\n\n        Parameters\n        ----------\n        iterable\n            Any iterable that returns strings representing FITS keywords.\n\n        value : optional\n            A default value to assign to each keyword; must be a valid type for\n            FITS keywords.\n\n        Returns\n        -------\n        `Header`\n            A new `Header` instance.\n        ","endLoc":863,"header":"@classmethod\n    def fromkeys(cls, iterable, value=None)","id":1250,"name":"fromkeys","nodeType":"Function","startLoc":834,"text":"@classmethod\n    def fromkeys(cls, iterable, value=None):\n        \"\"\"\n        Similar to :meth:`dict.fromkeys`--creates a new `Header` from an\n        iterable of keywords and an optional default value.\n\n        This method is not likely to be particularly useful for creating real\n        world FITS headers, but it is useful for testing.\n\n        Parameters\n        ----------\n        iterable\n            Any iterable that returns strings representing FITS keywords.\n\n        value : optional\n            A default value to assign to each keyword; must be a valid type for\n            FITS keywords.\n\n        Returns\n        -------\n        `Header`\n            A new `Header` instance.\n        \"\"\"\n\n        d = cls()\n        if not isinstance(value, tuple):\n            value = (value,)\n        for key in iterable:\n            d.append((key,) + value)\n        return d"},{"col":4,"comment":"null","endLoc":75,"header":"def __getitem__(self, key)","id":1251,"name":"__getitem__","nodeType":"Function","startLoc":60,"text":"def __getitem__(self, key):\n        if isinstance(key, str):\n            indx = _get_index(self.array.names, key)\n\n            if indx < self.start or indx > self.end - 1:\n                raise KeyError(f\"Key '{key}' does not exist.\")\n        elif isinstance(key, slice):\n            return type(self)(self.array, self.row, key.start, key.stop,\n                              key.step, self)\n        else:\n            indx = self._get_index(key)\n\n            if indx > self.array._nfields - 1:\n                raise IndexError('Index out of bounds')\n\n        return self.array.field(indx)[self.row]"},{"col":4,"comment":"\n        Construct a FITS record array from a recarray.\n        ","endLoc":171,"header":"def __new__(subtype, input)","id":1252,"name":"__new__","nodeType":"Function","startLoc":154,"text":"def __new__(subtype, input):\n        \"\"\"\n        Construct a FITS record array from a recarray.\n        \"\"\"\n\n        # input should be a record array\n        if input.dtype.subdtype is None:\n            self = np.recarray.__new__(subtype, input.shape, input.dtype,\n                                       buf=input.data)\n        else:\n            self = np.recarray.__new__(subtype, input.shape, input.dtype,\n                                       buf=input.data, strides=input.strides)\n\n        self._init()\n        if self.dtype.fields:\n            self._nfields = len(self.dtype.fields)\n\n        return self"},{"col":4,"comment":"null","endLoc":493,"header":"@field_specifier.deleter\n    def field_specifier(self)","id":1253,"name":"field_specifier","nodeType":"Function","startLoc":490,"text":"@field_specifier.deleter\n    def field_specifier(self):\n        raise AttributeError('The field_specifier attribute may not be '\n                             'deleted from record-valued keyword cards.')"},{"col":4,"comment":"\n        Similar to :meth:`dict.get`--returns the value associated with keyword\n        in the header, or a default value if the keyword is not found.\n\n        Parameters\n        ----------\n        key : str\n            A keyword that may or may not be in the header.\n\n        default : optional\n            A default value to return if the keyword is not found in the\n            header.\n\n        Returns\n        -------\n        value: str, number, complex, bool, or ``astropy.io.fits.card.Undefined``\n            The value associated with the given keyword, or the default value\n            if the keyword is not in the header.\n        ","endLoc":889,"header":"def get(self, key, default=None)","id":1254,"name":"get","nodeType":"Function","startLoc":865,"text":"def get(self, key, default=None):\n        \"\"\"\n        Similar to :meth:`dict.get`--returns the value associated with keyword\n        in the header, or a default value if the keyword is not found.\n\n        Parameters\n        ----------\n        key : str\n            A keyword that may or may not be in the header.\n\n        default : optional\n            A default value to return if the keyword is not found in the\n            header.\n\n        Returns\n        -------\n        value: str, number, complex, bool, or ``astropy.io.fits.card.Undefined``\n            The value associated with the given keyword, or the default value\n            if the keyword is not in the header.\n        \"\"\"\n\n        try:\n            return self[key]\n        except (KeyError, IndexError):\n            return default"},{"col":4,"comment":"\n        The card \"image\", that is, the 80 byte character string that represents\n        this card in an actual FITS header.\n        ","endLoc":506,"header":"@property\n    def image(self)","id":1255,"name":"image","nodeType":"Function","startLoc":495,"text":"@property\n    def image(self):\n        \"\"\"\n        The card \"image\", that is, the 80 byte character string that represents\n        this card in an actual FITS header.\n        \"\"\"\n\n        if self._image and not self._verified:\n            self.verify('fix+warn')\n        if self._image is None or self._modified:\n            self._image = self._format_image()\n        return self._image"},{"col":4,"comment":"\n        Set the value and/or comment and/or position of a specified keyword.\n\n        If the keyword does not already exist in the header, a new keyword is\n        created in the specified position, or appended to the end of the header\n        if no position is specified.\n\n        This method is similar to :meth:`Header.update` prior to Astropy v0.1.\n\n        .. note::\n            It should be noted that ``header.set(keyword, value)`` and\n            ``header.set(keyword, value, comment)`` are equivalent to\n            ``header[keyword] = value`` and\n            ``header[keyword] = (value, comment)`` respectively.\n\n            New keywords can also be inserted relative to existing keywords\n            using, for example::\n\n                >>> header.insert('NAXIS1', ('NAXIS', 2, 'Number of axes'))\n\n            to insert before an existing keyword, or::\n\n                >>> header.insert('NAXIS', ('NAXIS1', 4096), after=True)\n\n            to insert after an existing keyword.\n\n            The only advantage of using :meth:`Header.set` is that it\n            easily replaces the old usage of :meth:`Header.update` both\n            conceptually and in terms of function signature.\n\n        Parameters\n        ----------\n        keyword : str\n            A header keyword\n\n        value : str, optional\n            The value to set for the given keyword; if None the existing value\n            is kept, but '' may be used to set a blank value\n\n        comment : str, optional\n            The comment to set for the given keyword; if None the existing\n            comment is kept, but ``''`` may be used to set a blank comment\n\n        before : str, int, optional\n            Name of the keyword, or index of the `Card` before which this card\n            should be located in the header.  The argument ``before`` takes\n            precedence over ``after`` if both specified.\n\n        after : str, int, optional\n            Name of the keyword, or index of the `Card` after which this card\n            should be located in the header.\n\n        ","endLoc":977,"header":"def set(self, keyword, value=None, comment=None, before=None, after=None)","id":1256,"name":"set","nodeType":"Function","startLoc":891,"text":"def set(self, keyword, value=None, comment=None, before=None, after=None):\n        \"\"\"\n        Set the value and/or comment and/or position of a specified keyword.\n\n        If the keyword does not already exist in the header, a new keyword is\n        created in the specified position, or appended to the end of the header\n        if no position is specified.\n\n        This method is similar to :meth:`Header.update` prior to Astropy v0.1.\n\n        .. note::\n            It should be noted that ``header.set(keyword, value)`` and\n            ``header.set(keyword, value, comment)`` are equivalent to\n            ``header[keyword] = value`` and\n            ``header[keyword] = (value, comment)`` respectively.\n\n            New keywords can also be inserted relative to existing keywords\n            using, for example::\n\n                >>> header.insert('NAXIS1', ('NAXIS', 2, 'Number of axes'))\n\n            to insert before an existing keyword, or::\n\n                >>> header.insert('NAXIS', ('NAXIS1', 4096), after=True)\n\n            to insert after an existing keyword.\n\n            The only advantage of using :meth:`Header.set` is that it\n            easily replaces the old usage of :meth:`Header.update` both\n            conceptually and in terms of function signature.\n\n        Parameters\n        ----------\n        keyword : str\n            A header keyword\n\n        value : str, optional\n            The value to set for the given keyword; if None the existing value\n            is kept, but '' may be used to set a blank value\n\n        comment : str, optional\n            The comment to set for the given keyword; if None the existing\n            comment is kept, but ``''`` may be used to set a blank comment\n\n        before : str, int, optional\n            Name of the keyword, or index of the `Card` before which this card\n            should be located in the header.  The argument ``before`` takes\n            precedence over ``after`` if both specified.\n\n        after : str, int, optional\n            Name of the keyword, or index of the `Card` after which this card\n            should be located in the header.\n\n        \"\"\"\n\n        # Create a temporary card that looks like the one being set; if the\n        # temporary card turns out to be a RVKC this will make it easier to\n        # deal with the idiosyncrasies thereof\n        # Don't try to make a temporary card though if they keyword looks like\n        # it might be a HIERARCH card or is otherwise invalid--this step is\n        # only for validating RVKCs.\n        if (len(keyword) <= KEYWORD_LENGTH and\n            Card._keywd_FSC_RE.match(keyword) and\n                keyword not in self._keyword_indices):\n            new_card = Card(keyword, value, comment)\n            new_keyword = new_card.keyword\n        else:\n            new_keyword = keyword\n\n        if (new_keyword not in Card._commentary_keywords and\n                new_keyword in self):\n            if comment is None:\n                comment = self.comments[keyword]\n            if value is None:\n                value = self[keyword]\n\n            self[keyword] = (value, comment)\n\n            if before is not None or after is not None:\n                card = self._cards[self._cardindex(keyword)]\n                self._relativeinsert(card, before=before, after=after,\n                                     replace=True)\n        elif before is not None or after is not None:\n            self._relativeinsert((keyword, value, comment), before=before,\n                                 after=after)\n        else:\n            self[keyword] = (value, comment)"},{"col":0,"comment":"\n    Convert degrees, arcminute, arcsecond to a float degrees value.\n    ","endLoc":436,"header":"def dms_to_degrees(d, m, s=None)","id":1257,"name":"dms_to_degrees","nodeType":"Function","startLoc":412,"text":"def dms_to_degrees(d, m, s=None):\n    \"\"\"\n    Convert degrees, arcminute, arcsecond to a float degrees value.\n    \"\"\"\n\n    _check_minute_range(m)\n    _check_second_range(s)\n\n    # determine sign\n    sign = np.copysign(1.0, d)\n\n    try:\n        d = np.floor(np.abs(d))\n        if s is None:\n            m = np.abs(m)\n            s = 0\n        else:\n            m = np.floor(np.abs(m))\n            s = np.abs(s)\n    except ValueError as err:\n        raise ValueError(format_exception(\n            \"{func}: dms values ({1[0]},{2[1]},{3[2]}) could not be \"\n            \"converted to numbers.\", d, m, s)) from err\n\n    return sign * (d + m / 60. + s / 3600.)"},{"col":4,"comment":"null","endLoc":183,"header":"def __setstate__(self, state)","id":1258,"name":"__setstate__","nodeType":"Function","startLoc":173,"text":"def __setstate__(self, state):\n        meta = state[-1]\n        column_state = state[-2]\n        state = state[:-2]\n\n        super().__setstate__(state)\n\n        self._col_weakrefs = weakref.WeakSet()\n\n        for attr, value in zip(meta, column_state):\n            setattr(self, attr, value)"},{"col":4,"comment":"null","endLoc":1011,"header":"def _format_image(self)","id":1259,"name":"_format_image","nodeType":"Function","startLoc":964,"text":"def _format_image(self):\n        keyword = self._format_keyword()\n\n        value = self._format_value()\n        is_commentary = keyword.strip() in self._commentary_keywords\n        if is_commentary:\n            comment = ''\n        else:\n            comment = self._format_comment()\n\n        # equal sign string\n        # by default use the standard value indicator even for HIERARCH cards;\n        # later we may abbreviate it if necessary\n        delimiter = VALUE_INDICATOR\n        if is_commentary:\n            delimiter = ''\n\n        # put all parts together\n        output = ''.join([keyword, delimiter, value, comment])\n\n        # For HIERARCH cards we can save a bit of space if necessary by\n        # removing the space between the keyword and the equals sign; I'm\n        # guessing this is part of the HIEARCH card specification\n        keywordvalue_length = len(keyword) + len(delimiter) + len(value)\n        if (keywordvalue_length > self.length and\n                keyword.startswith('HIERARCH')):\n            if (keywordvalue_length == self.length + 1 and keyword[-1] == ' '):\n                output = ''.join([keyword[:-1], delimiter, value, comment])\n            else:\n                # I guess the HIERARCH card spec is incompatible with CONTINUE\n                # cards\n                raise ValueError('The header keyword {!r} with its value is '\n                                 'too long'.format(self.keyword))\n\n        if len(output) <= self.length:\n            output = f'{output:80}'\n        else:\n            # longstring case (CONTINUE card)\n            # try not to use CONTINUE if the string value can fit in one line.\n            # Instead, just truncate the comment\n            if (isinstance(self.value, str) and\n                    len(value) > (self.length - 10)):\n                output = self._format_long_image()\n            else:\n                warnings.warn('Card is too long, comment will be truncated.',\n                              VerifyWarning)\n                output = output[:Card.length]\n        return output"},{"col":4,"comment":"\n        Return a 3-tuple for pickling a FITS_rec. Use the super-class\n        functionality but then add in a tuple of FITS_rec-specific\n        values that get used in __setstate__.\n        ","endLoc":212,"header":"def __reduce__(self)","id":1260,"name":"__reduce__","nodeType":"Function","startLoc":185,"text":"def __reduce__(self):\n        \"\"\"\n        Return a 3-tuple for pickling a FITS_rec. Use the super-class\n        functionality but then add in a tuple of FITS_rec-specific\n        values that get used in __setstate__.\n        \"\"\"\n\n        reconst_func, reconst_func_args, state = super().__reduce__()\n\n        # Define FITS_rec-specific attrs that get added to state\n        column_state = []\n        meta = []\n\n        for attrs in ['_converted', '_heapoffset', '_heapsize', '_nfields',\n                      '_gap', '_uint', 'parnames', '_coldefs']:\n\n            with suppress(AttributeError):\n                # _coldefs can be Delayed, and file objects cannot be\n                # picked, it needs to be deepcopied first\n                if attrs == '_coldefs':\n                    column_state.append(self._coldefs.__deepcopy__(None))\n                else:\n                    column_state.append(getattr(self, attrs))\n                meta.append(attrs)\n\n        state = state + (column_state, meta)\n\n        return reconst_func, reconst_func_args, state"},{"col":0,"comment":"\n    Parses an input string value into an angle value.\n\n    Parameters\n    ----------\n    angle : str\n        A string representing the angle.  May be in one of the following forms:\n\n            * 01:02:30.43 degrees\n            * 1 2 0 hours\n            * 1°2′3″\n            * 1d2m3s\n            * -1h2m3s\n\n    unit : `~astropy.units.UnitBase` instance, optional\n        The unit used to interpret the string.  If ``unit`` is not\n        provided, the unit must be explicitly represented in the\n        string, either at the end or as number separators.\n\n    debug : bool, optional\n        If `True`, print debugging information from the parser.\n\n    Returns\n    -------\n    value, unit : tuple\n        ``value`` is the value as a floating point number or three-part\n        tuple, and ``unit`` is a `Unit` instance which is either the\n        unit passed in or the one explicitly mentioned in the input\n        string.\n    ","endLoc":395,"header":"def parse_angle(angle, unit=None, debug=False)","id":1261,"name":"parse_angle","nodeType":"Function","startLoc":364,"text":"def parse_angle(angle, unit=None, debug=False):\n    \"\"\"\n    Parses an input string value into an angle value.\n\n    Parameters\n    ----------\n    angle : str\n        A string representing the angle.  May be in one of the following forms:\n\n            * 01:02:30.43 degrees\n            * 1 2 0 hours\n            * 1°2′3″\n            * 1d2m3s\n            * -1h2m3s\n\n    unit : `~astropy.units.UnitBase` instance, optional\n        The unit used to interpret the string.  If ``unit`` is not\n        provided, the unit must be explicitly represented in the\n        string, either at the end or as number separators.\n\n    debug : bool, optional\n        If `True`, print debugging information from the parser.\n\n    Returns\n    -------\n    value, unit : tuple\n        ``value`` is the value as a floating point number or three-part\n        tuple, and ``unit`` is a `Unit` instance which is either the\n        unit passed in or the one explicitly mentioned in the input\n        string.\n    \"\"\"\n    return _AngleParser().parse(angle, unit, debug=debug)"},{"col":4,"comment":"null","endLoc":252,"header":"def __array_finalize__(self, obj)","id":1262,"name":"__array_finalize__","nodeType":"Function","startLoc":214,"text":"def __array_finalize__(self, obj):\n        if obj is None:\n            return\n\n        if isinstance(obj, FITS_rec):\n            self._character_as_bytes = obj._character_as_bytes\n\n        if isinstance(obj, FITS_rec) and obj.dtype == self.dtype:\n            self._converted = obj._converted\n            self._heapoffset = obj._heapoffset\n            self._heapsize = obj._heapsize\n            self._col_weakrefs = obj._col_weakrefs\n            self._coldefs = obj._coldefs\n            self._nfields = obj._nfields\n            self._gap = obj._gap\n            self._uint = obj._uint\n        elif self.dtype.fields is not None:\n            # This will allow regular ndarrays with fields, rather than\n            # just other FITS_rec objects\n            self._nfields = len(self.dtype.fields)\n            self._converted = {}\n\n            self._heapoffset = getattr(obj, '_heapoffset', 0)\n            self._heapsize = getattr(obj, '_heapsize', 0)\n\n            self._gap = getattr(obj, '_gap', 0)\n            self._uint = getattr(obj, '_uint', False)\n            self._col_weakrefs = weakref.WeakSet()\n            self._coldefs = ColDefs(self)\n\n            # Work around chicken-egg problem.  Column.array relies on the\n            # _coldefs attribute to set up ref back to parent FITS_rec; however\n            # in the above line the self._coldefs has not been assigned yet so\n            # this fails.  This patches that up...\n            for col in self._coldefs:\n                del col.array\n                col._parent_fits_rec = weakref.ref(self)\n        else:\n            self._init()"},{"col":4,"comment":"null","endLoc":62,"header":"def __init__(self)","id":1263,"name":"__init__","nodeType":"Function","startLoc":52,"text":"def __init__(self):\n        # TODO: in principle, the parser should be invalidated if we change unit\n        # system (from CDS to FITS, say).  Might want to keep a link to the\n        # unit_registry used, and regenerate the parser/lexer if it changes.\n        # Alternatively, perhaps one should not worry at all and just pre-\n        # generate the parser for each release (as done for unit formats).\n        # For some discussion of this problem, see\n        # https://github.com/astropy/astropy/issues/5350#issuecomment-248770151\n        if '_parser' not in _AngleParser._thread_local.__dict__:\n            (_AngleParser._thread_local._parser,\n             _AngleParser._thread_local._lexer) = self._make_parser()"},{"col":4,"comment":"null","endLoc":926,"header":"def _format_keyword(self)","id":1264,"name":"_format_keyword","nodeType":"Function","startLoc":916,"text":"def _format_keyword(self):\n        if self.keyword:\n            if self.field_specifier:\n                return '{:{len}}'.format(self.keyword.split('.', 1)[0],\n                                         len=KEYWORD_LENGTH)\n            elif self._hierarch:\n                return f'HIERARCH {self.keyword} '\n            else:\n                return '{:{len}}'.format(self.keyword, len=KEYWORD_LENGTH)\n        else:\n            return ' ' * KEYWORD_LENGTH"},{"col":4,"comment":"null","endLoc":956,"header":"def _format_value(self)","id":1265,"name":"_format_value","nodeType":"Function","startLoc":928,"text":"def _format_value(self):\n        # value string\n        float_types = (float, np.floating, complex, np.complexfloating)\n\n        # Force the value to be parsed out first\n        value = self.value\n        # But work with the underlying raw value instead (to preserve\n        # whitespace, for now...)\n        value = self._value\n\n        if self.keyword in self._commentary_keywords:\n            # The value of a commentary card must be just a raw unprocessed\n            # string\n            value = str(value)\n        elif (self._valuestring and not self._valuemodified and\n              isinstance(self.value, float_types)):\n            # Keep the existing formatting for float/complex numbers\n            value = f'{self._valuestring:>20}'\n        elif self.field_specifier:\n            value = _format_value(self._value).strip()\n            value = f\"'{self.field_specifier}: {value}'\"\n        else:\n            value = _format_value(value)\n\n        # For HIERARCH cards the value should be shortened to conserve space\n        if not self.field_specifier and len(self.keyword) > KEYWORD_LENGTH:\n            value = value.strip()\n\n        return value"},{"col":0,"comment":"\n    Converts a card value to its appropriate string representation as\n    defined by the FITS format.\n    ","endLoc":1248,"header":"def _format_value(value)","id":1266,"name":"_format_value","nodeType":"Function","startLoc":1215,"text":"def _format_value(value):\n    \"\"\"\n    Converts a card value to its appropriate string representation as\n    defined by the FITS format.\n    \"\"\"\n\n    # string value should occupies at least 8 columns, unless it is\n    # a null string\n    if isinstance(value, str):\n        if value == '':\n            return \"''\"\n        else:\n            exp_val_str = value.replace(\"'\", \"''\")\n            val_str = f\"'{exp_val_str:8}'\"\n            return f'{val_str:20}'\n\n    # must be before int checking since bool is also int\n    elif isinstance(value, (bool, np.bool_)):\n        return f'{repr(value)[0]:>20}'  # T or F\n\n    elif _is_int(value):\n        return f'{value:>20d}'\n\n    elif isinstance(value, (float, np.floating)):\n        return f'{_format_float(value):>20}'\n\n    elif isinstance(value, (complex, np.complexfloating)):\n        val_str = f'({_format_float(value.real)}, {_format_float(value.imag)})'\n        return f'{val_str:>20}'\n\n    elif isinstance(value, Undefined):\n        return ''\n    else:\n        return ''"},{"col":4,"comment":"null","endLoc":298,"header":"@classmethod\n    def _make_parser(cls)","id":1267,"name":"_make_parser","nodeType":"Function","startLoc":76,"text":"@classmethod\n    def _make_parser(cls):\n        from astropy.extern.ply import lex, yacc\n\n        # List of token names.\n        tokens = (\n            'SIGN',\n            'UINT',\n            'UFLOAT',\n            'COLON',\n            'DEGREE',\n            'HOUR',\n            'MINUTE',\n            'SECOND',\n            'SIMPLE_UNIT',\n            'EASTWEST',\n            'NORTHSOUTH'\n        )\n\n        # NOTE THE ORDERING OF THESE RULES IS IMPORTANT!!\n        # Regular expression rules for simple tokens\n        def t_UFLOAT(t):\n            r'((\\d+\\.\\d*)|(\\.\\d+))([eE][+-−]?\\d+)?'\n            # The above includes Unicode \"MINUS SIGN\" \\u2212.  It is\n            # important to include the hyphen last, or the regex will\n            # treat this as a range.\n            t.value = float(t.value.replace('−', '-'))\n            return t\n\n        def t_UINT(t):\n            r'\\d+'\n            t.value = int(t.value)\n            return t\n\n        def t_SIGN(t):\n            r'[+−-]'\n            # The above include Unicode \"MINUS SIGN\" \\u2212.  It is\n            # important to include the hyphen last, or the regex will\n            # treat this as a range.\n            if t.value == '+':\n                t.value = 1.0\n            else:\n                t.value = -1.0\n            return t\n\n        def t_EASTWEST(t):\n            r'[EW]$'\n            t.value = -1.0 if t.value == 'W' else 1.0\n            return t\n\n        def t_NORTHSOUTH(t):\n            r'[NS]$'\n            # We cannot use lower-case letters otherwise we'll confuse\n            # s[outh] with s[econd]\n            t.value = -1.0 if t.value == 'S' else 1.0\n            return t\n\n        def t_SIMPLE_UNIT(t):\n            t.value = u.Unit(t.value)\n            return t\n\n        t_SIMPLE_UNIT.__doc__ = '|'.join(\n            f'(?:{x})' for x in cls._get_simple_unit_names())\n\n        t_COLON = ':'\n        t_DEGREE = r'd(eg(ree(s)?)?)?|°'\n        t_HOUR = r'hour(s)?|h(r)?|ʰ'\n        t_MINUTE = r'm(in(ute(s)?)?)?|′|\\'|ᵐ'\n        t_SECOND = r's(ec(ond(s)?)?)?|″|\\\"|ˢ'\n\n        # A string containing ignored characters (spaces)\n        t_ignore = ' '\n\n        # Error handling rule\n        def t_error(t):\n            raise ValueError(\n                f\"Invalid character at col {t.lexpos}\")\n\n        lexer = parsing.lex(lextab='angle_lextab', package='astropy/coordinates')\n\n        def p_angle(p):\n            '''\n            angle : sign hms eastwest\n                  | sign dms dir\n                  | sign arcsecond dir\n                  | sign arcminute dir\n                  | sign simple dir\n            '''\n            sign = p[1] * p[3]\n            value, unit = p[2]\n            if isinstance(value, tuple):\n                p[0] = ((sign * value[0],) + value[1:], unit)\n            else:\n                p[0] = (sign * value, unit)\n\n        def p_sign(p):\n            '''\n            sign : SIGN\n                 |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1.0\n\n        def p_eastwest(p):\n            '''\n            eastwest : EASTWEST\n                     |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1.0\n\n        def p_dir(p):\n            '''\n            dir : EASTWEST\n                | NORTHSOUTH\n                |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1.0\n\n        def p_ufloat(p):\n            '''\n            ufloat : UFLOAT\n                   | UINT\n            '''\n            p[0] = p[1]\n\n        def p_colon(p):\n            '''\n            colon : UINT COLON ufloat\n                  | UINT COLON UINT COLON ufloat\n            '''\n            if len(p) == 4:\n                p[0] = (p[1], p[3])\n            elif len(p) == 6:\n                p[0] = (p[1], p[3], p[5])\n\n        def p_spaced(p):\n            '''\n            spaced : UINT ufloat\n                   | UINT UINT ufloat\n            '''\n            if len(p) == 3:\n                p[0] = (p[1], p[2])\n            elif len(p) == 4:\n                p[0] = (p[1], p[2], p[3])\n\n        def p_generic(p):\n            '''\n            generic : colon\n                    | spaced\n                    | ufloat\n            '''\n            p[0] = p[1]\n\n        def p_hms(p):\n            '''\n            hms : UINT HOUR\n                | UINT HOUR ufloat\n                | UINT HOUR UINT MINUTE\n                | UINT HOUR UFLOAT MINUTE\n                | UINT HOUR UINT MINUTE ufloat\n                | UINT HOUR UINT MINUTE ufloat SECOND\n                | generic HOUR\n            '''\n            if len(p) == 3:\n                p[0] = (p[1], u.hourangle)\n            elif len(p) in (4, 5):\n                p[0] = ((p[1], p[3]), u.hourangle)\n            elif len(p) in (6, 7):\n                p[0] = ((p[1], p[3], p[5]), u.hourangle)\n\n        def p_dms(p):\n            '''\n            dms : UINT DEGREE\n                | UINT DEGREE ufloat\n                | UINT DEGREE UINT MINUTE\n                | UINT DEGREE UFLOAT MINUTE\n                | UINT DEGREE UINT MINUTE ufloat\n                | UINT DEGREE UINT MINUTE ufloat SECOND\n                | generic DEGREE\n            '''\n            if len(p) == 3:\n                p[0] = (p[1], u.degree)\n            elif len(p) in (4, 5):\n                p[0] = ((p[1], p[3]), u.degree)\n            elif len(p) in (6, 7):\n                p[0] = ((p[1], p[3], p[5]), u.degree)\n\n        def p_simple(p):\n            '''\n            simple : generic\n                   | generic SIMPLE_UNIT\n            '''\n            if len(p) == 2:\n                p[0] = (p[1], None)\n            else:\n                p[0] = (p[1], p[2])\n\n        def p_arcsecond(p):\n            '''\n            arcsecond : generic SECOND\n            '''\n            p[0] = (p[1], u.arcsecond)\n\n        def p_arcminute(p):\n            '''\n            arcminute : generic MINUTE\n            '''\n            p[0] = (p[1], u.arcminute)\n\n        def p_error(p):\n            raise ValueError\n\n        parser = parsing.yacc(tabmodule='angle_parsetab', package='astropy/coordinates')\n\n        return parser, lexer"},{"col":4,"comment":"Creates a column format from a Numpy record dtype format.","endLoc":275,"header":"@classmethod\n    def from_recformat(cls, recformat)","id":1268,"name":"from_recformat","nodeType":"Function","startLoc":271,"text":"@classmethod\n    def from_recformat(cls, recformat):\n        \"\"\"Creates a column format from a Numpy record dtype format.\"\"\"\n\n        return cls(_convert_format(recformat, reverse=True))"},{"col":0,"comment":"Format a floating number to make sure it gets the decimal point.","endLoc":1280,"header":"def _format_float(value)","id":1269,"name":"_format_float","nodeType":"Function","startLoc":1251,"text":"def _format_float(value):\n    \"\"\"Format a floating number to make sure it gets the decimal point.\"\"\"\n\n    value_str = f'{value:.16G}'\n    if '.' not in value_str and 'E' not in value_str:\n        value_str += '.0'\n    elif 'E' in value_str:\n        # On some Windows builds of Python (and possibly other platforms?) the\n        # exponent is zero-padded out to, it seems, three digits.  Normalize\n        # the format to pad only to two digits.\n        significand, exponent = value_str.split('E')\n        if exponent[0] in ('+', '-'):\n            sign = exponent[0]\n            exponent = exponent[1:]\n        else:\n            sign = ''\n        value_str = f'{significand}E{sign}{int(exponent):02d}'\n\n    # Limit the value string to at most 20 characters.\n    str_len = len(value_str)\n\n    if str_len > 20:\n        idx = value_str.find('E')\n\n        if idx < 0:\n            value_str = value_str[:20]\n        else:\n            value_str = value_str[:20 - (str_len - idx)] + value_str[idx:]\n\n    return value_str"},{"col":4,"comment":"null","endLoc":138,"header":"def _get_index(self, indx)","id":1270,"name":"_get_index","nodeType":"Function","startLoc":130,"text":"def _get_index(self, indx):\n        indices = np.ogrid[:self.array._nfields]\n        for base in reversed(self._bases):\n            if base.step < 1:\n                s = slice(base.start, None, base.step)\n            else:\n                s = slice(base.start, base.end, base.step)\n            indices = indices[s]\n        return indices[indx]"},{"col":0,"comment":"\n    Convert FITS format spec to record format spec.  Do the opposite if\n    reverse=True.\n    ","endLoc":2438,"header":"def _convert_format(format, reverse=False)","id":1271,"name":"_convert_format","nodeType":"Function","startLoc":2429,"text":"def _convert_format(format, reverse=False):\n    \"\"\"\n    Convert FITS format spec to record format spec.  Do the opposite if\n    reverse=True.\n    \"\"\"\n\n    if reverse:\n        return _convert_record2fits(format)\n    else:\n        return _convert_fits2record(format)"},{"col":0,"comment":"\n    Convert record format spec to FITS format spec.\n    ","endLoc":2401,"header":"def _convert_record2fits(format)","id":1272,"name":"_convert_record2fits","nodeType":"Function","startLoc":2360,"text":"def _convert_record2fits(format):\n    \"\"\"\n    Convert record format spec to FITS format spec.\n    \"\"\"\n\n    recformat, kind, dtype = _dtype_to_recformat(format)\n    shape = dtype.shape\n    itemsize = dtype.base.itemsize\n    if dtype.char == 'U':\n        # Unicode dtype--itemsize is 4 times actual ASCII character length,\n        # which what matters for FITS column formats\n        # Use dtype.base--dtype may be a multi-dimensional dtype\n        itemsize = itemsize // 4\n\n    option = str(itemsize)\n\n    ndims = len(shape)\n    repeat = 1\n    if ndims > 0:\n        nel = np.array(shape, dtype='i8').prod()\n        if nel > 1:\n            repeat = nel\n\n    if kind == 'a':\n        # This is a kludge that will place string arrays into a\n        # single field, so at least we won't lose data.  Need to\n        # use a TDIM keyword to fix this, declaring as (slength,\n        # dim1, dim2, ...)  as mwrfits does\n\n        ntot = int(repeat) * int(option)\n\n        output_format = str(ntot) + 'A'\n    elif recformat in NUMPY2FITS:  # record format\n        if repeat != 1:\n            repeat = str(repeat)\n        else:\n            repeat = ''\n        output_format = repeat + NUMPY2FITS[recformat]\n    else:\n        raise ValueError(f'Illegal format `{format}`.')\n\n    return output_format"},{"col":4,"comment":"\n        Inserts a new card before or after an existing card; used to\n        implement support for the legacy before/after keyword arguments to\n        Header.update().\n\n        If replace=True, move an existing card with the same keyword.\n        ","endLoc":1821,"header":"def _relativeinsert(self, card, before=None, after=None, replace=False)","id":1273,"name":"_relativeinsert","nodeType":"Function","startLoc":1764,"text":"def _relativeinsert(self, card, before=None, after=None, replace=False):\n        \"\"\"\n        Inserts a new card before or after an existing card; used to\n        implement support for the legacy before/after keyword arguments to\n        Header.update().\n\n        If replace=True, move an existing card with the same keyword.\n        \"\"\"\n\n        if before is None:\n            insertionkey = after\n        else:\n            insertionkey = before\n\n        def get_insertion_idx():\n            if not (isinstance(insertionkey, numbers.Integral) and\n                    insertionkey >= len(self._cards)):\n                idx = self._cardindex(insertionkey)\n            else:\n                idx = insertionkey\n\n            if before is None:\n                idx += 1\n\n            return idx\n\n        if replace:\n            # The card presumably already exists somewhere in the header.\n            # Check whether or not we actually have to move it; if it does need\n            # to be moved we just delete it and then it will be reinserted\n            # below\n            old_idx = self._cardindex(card.keyword)\n            insertion_idx = get_insertion_idx()\n\n            if (insertion_idx >= len(self._cards) and\n                    old_idx == len(self._cards) - 1):\n                # The card would be appended to the end, but it's already at\n                # the end\n                return\n\n            if before is not None:\n                if old_idx == insertion_idx - 1:\n                    return\n            elif after is not None and old_idx == insertion_idx:\n                return\n\n            del self[old_idx]\n\n        # Even if replace=True, the insertion idx may have changed since the\n        # old card was deleted\n        idx = get_insertion_idx()\n\n        if card[0] in Card._commentary_keywords:\n            cards = reversed(self._splitcommentary(card[0], card[1]))\n        else:\n            cards = [card]\n        for c in cards:\n            self.insert(idx, c)"},{"col":4,"comment":"null","endLoc":74,"header":"@classmethod\n    def _get_simple_unit_names(cls)","id":1274,"name":"_get_simple_unit_names","nodeType":"Function","startLoc":64,"text":"@classmethod\n    def _get_simple_unit_names(cls):\n        simple_units = set(\n            u.radian.find_equivalent_units(include_prefix_units=True))\n        simple_unit_names = set()\n        # We filter out degree and hourangle, since those are treated\n        # separately.\n        for unit in simple_units:\n            if unit != u.deg and unit != u.hourangle:\n                simple_unit_names.update(unit.names)\n        return sorted(simple_unit_names)"},{"col":4,"comment":"null","endLoc":92,"header":"def __setitem__(self, key, value)","id":1275,"name":"__setitem__","nodeType":"Function","startLoc":77,"text":"def __setitem__(self, key, value):\n        if isinstance(key, str):\n            indx = _get_index(self.array.names, key)\n\n            if indx < self.start or indx > self.end - 1:\n                raise KeyError(f\"Key '{key}' does not exist.\")\n        elif isinstance(key, slice):\n            for indx in range(slice.start, slice.stop, slice.step):\n                indx = self._get_indx(indx)\n                self.array.field(indx)[self.row] = value\n        else:\n            indx = self._get_index(key)\n            if indx > self.array._nfields - 1:\n                raise IndexError('Index out of bounds')\n\n        self.array.field(indx)[self.row] = value"},{"col":0,"comment":"\n    Convert FITS format spec to record format spec.\n    ","endLoc":2357,"header":"def _convert_fits2record(format)","id":1277,"name":"_convert_fits2record","nodeType":"Function","startLoc":2322,"text":"def _convert_fits2record(format):\n    \"\"\"\n    Convert FITS format spec to record format spec.\n    \"\"\"\n\n    repeat, dtype, option = _parse_tformat(format)\n\n    if dtype in FITS2NUMPY:\n        if dtype == 'A':\n            output_format = FITS2NUMPY[dtype] + str(repeat)\n            # to accommodate both the ASCII table and binary table column\n            # format spec, i.e. A7 in ASCII table is the same as 7A in\n            # binary table, so both will produce 'a7'.\n            # Technically the FITS standard does not allow this but it's a very\n            # common mistake\n            if format.lstrip()[0] == 'A' and option != '':\n                # make sure option is integer\n                output_format = FITS2NUMPY[dtype] + str(int(option))\n        else:\n            repeat_str = ''\n            if repeat != 1:\n                repeat_str = str(repeat)\n            output_format = repeat_str + FITS2NUMPY[dtype]\n\n    elif dtype == 'X':\n        output_format = _FormatX(repeat)\n    elif dtype == 'P':\n        output_format = _FormatP.from_tform(format)\n    elif dtype == 'Q':\n        output_format = _FormatQ.from_tform(format)\n    elif dtype == 'F':\n        output_format = 'f8'\n    else:\n        raise ValueError(f'Illegal format `{format}`.')\n\n    return output_format"},{"col":0,"comment":"Create a lexer from local variables.\n\n    It automatically compiles the lexer in optimized mode, writing to\n    ``lextab`` in the same directory as the calling file.\n\n    This function is thread-safe. The returned lexer is *not* thread-safe, but\n    if it is used exclusively with a single parser returned by :func:`yacc`\n    then it will be safe.\n\n    It is only intended to work with lexers defined within the calling\n    function, rather than at class or module scope.\n\n    Parameters\n    ----------\n    lextab : str\n        Name for the file to write with the generated tables, if it does not\n        already exist (without ``.py`` suffix).\n    package : str\n        Name of a test package which should be run with pytest to regenerate\n        the output file. This is inserted into a comment in the generated\n        file.\n    reflags : int\n        Passed to ``ply.lex``.\n    ","endLoc":99,"header":"def lex(lextab, package, reflags=int(re.VERBOSE))","id":1278,"name":"lex","nodeType":"Function","startLoc":62,"text":"def lex(lextab, package, reflags=int(re.VERBOSE)):\n    \"\"\"Create a lexer from local variables.\n\n    It automatically compiles the lexer in optimized mode, writing to\n    ``lextab`` in the same directory as the calling file.\n\n    This function is thread-safe. The returned lexer is *not* thread-safe, but\n    if it is used exclusively with a single parser returned by :func:`yacc`\n    then it will be safe.\n\n    It is only intended to work with lexers defined within the calling\n    function, rather than at class or module scope.\n\n    Parameters\n    ----------\n    lextab : str\n        Name for the file to write with the generated tables, if it does not\n        already exist (without ``.py`` suffix).\n    package : str\n        Name of a test package which should be run with pytest to regenerate\n        the output file. This is inserted into a comment in the generated\n        file.\n    reflags : int\n        Passed to ``ply.lex``.\n    \"\"\"\n    from astropy.extern.ply import lex\n\n    caller_file = lex.get_caller_module_dict(2)['__file__']\n    lextab_filename = os.path.join(os.path.dirname(caller_file), lextab + '.py')\n    with _LOCK:\n        lextab_exists = os.path.exists(lextab_filename)\n        with _patch_get_caller_module_dict(lex):\n            lexer = lex.lex(optimize=True, lextab=lextab,\n                            outputdir=os.path.dirname(caller_file),\n                            reflags=reflags)\n        if not lextab_exists:\n            _add_tab_header(lextab_filename, package)\n        return lexer"},{"col":4,"comment":"Like :meth:`dict.items`.","endLoc":983,"header":"def items(self)","id":1279,"name":"items","nodeType":"Function","startLoc":979,"text":"def items(self):\n        \"\"\"Like :meth:`dict.items`.\"\"\"\n\n        for card in self._cards:\n            yield card.keyword, None if card.value == UNDEFINED else card.value"},{"col":4,"comment":"\n        Like :meth:`dict.keys`--iterating directly over the `Header`\n        instance has the same behavior.\n        ","endLoc":992,"header":"def keys(self)","id":1280,"name":"keys","nodeType":"Function","startLoc":985,"text":"def keys(self):\n        \"\"\"\n        Like :meth:`dict.keys`--iterating directly over the `Header`\n        instance has the same behavior.\n        \"\"\"\n\n        for card in self._cards:\n            yield card.keyword"},{"col":4,"comment":"Like :meth:`dict.values`.","endLoc":998,"header":"def values(self)","id":1281,"name":"values","nodeType":"Function","startLoc":994,"text":"def values(self):\n        \"\"\"Like :meth:`dict.values`.\"\"\"\n\n        for card in self._cards:\n            yield None if card.value == UNDEFINED else card.value"},{"col":4,"comment":"\n        Works like :meth:`list.pop` if no arguments or an index argument are\n        supplied; otherwise works like :meth:`dict.pop`.\n        ","endLoc":1022,"header":"def pop(self, *args)","id":1282,"name":"pop","nodeType":"Function","startLoc":1000,"text":"def pop(self, *args):\n        \"\"\"\n        Works like :meth:`list.pop` if no arguments or an index argument are\n        supplied; otherwise works like :meth:`dict.pop`.\n        \"\"\"\n\n        if len(args) > 2:\n            raise TypeError(f'Header.pop expected at most 2 arguments, got {len(args)}')\n\n        if len(args) == 0:\n            key = -1\n        else:\n            key = args[0]\n\n        try:\n            value = self[key]\n        except (KeyError, IndexError):\n            if len(args) == 2:\n                return args[1]\n            raise\n\n        del self[key]\n        return value"},{"col":4,"comment":"Similar to :meth:`dict.popitem`.","endLoc":1032,"header":"def popitem(self)","id":1283,"name":"popitem","nodeType":"Function","startLoc":1024,"text":"def popitem(self):\n        \"\"\"Similar to :meth:`dict.popitem`.\"\"\"\n\n        try:\n            k, v = next(self.items())\n        except StopIteration:\n            raise KeyError('Header is empty')\n        del self[k]\n        return k, v"},{"col":4,"comment":"Initializes internal attributes specific to FITS-isms.","endLoc":264,"header":"def _init(self)","id":1284,"name":"_init","nodeType":"Function","startLoc":254,"text":"def _init(self):\n        \"\"\"Initializes internal attributes specific to FITS-isms.\"\"\"\n\n        self._nfields = 0\n        self._converted = {}\n        self._heapoffset = 0\n        self._heapsize = 0\n        self._col_weakrefs = weakref.WeakSet()\n        self._coldefs = None\n        self._gap = 0\n        self._uint = False"},{"col":4,"comment":"\n        Given a `ColDefs` object of unknown origin, initialize a new `FITS_rec`\n        object.\n\n        .. note::\n\n            This was originally part of the ``new_table`` function in the table\n            module but was moved into a class method since most of its\n            functionality always had more to do with initializing a `FITS_rec`\n            object than anything else, and much of it also overlapped with\n            ``FITS_rec._scale_back``.\n\n        Parameters\n        ----------\n        columns : sequence of `Column` or a `ColDefs`\n            The columns from which to create the table data.  If these\n            columns have data arrays attached that data may be used in\n            initializing the new table.  Otherwise the input columns\n            will be used as a template for a new table with the requested\n            number of rows.\n\n        nrows : int\n            Number of rows in the new table.  If the input columns have data\n            associated with them, the size of the largest input column is used.\n            Otherwise the default is 0.\n\n        fill : bool\n            If `True`, will fill all cells with zeros or blanks.  If\n            `False`, copy the data from input, undefined cells will still\n            be filled with zeros/blanks.\n        ","endLoc":469,"header":"@classmethod\n    def from_columns(cls, columns, nrows=0, fill=False, character_as_bytes=False)","id":1285,"name":"from_columns","nodeType":"Function","startLoc":266,"text":"@classmethod\n    def from_columns(cls, columns, nrows=0, fill=False, character_as_bytes=False):\n        \"\"\"\n        Given a `ColDefs` object of unknown origin, initialize a new `FITS_rec`\n        object.\n\n        .. note::\n\n            This was originally part of the ``new_table`` function in the table\n            module but was moved into a class method since most of its\n            functionality always had more to do with initializing a `FITS_rec`\n            object than anything else, and much of it also overlapped with\n            ``FITS_rec._scale_back``.\n\n        Parameters\n        ----------\n        columns : sequence of `Column` or a `ColDefs`\n            The columns from which to create the table data.  If these\n            columns have data arrays attached that data may be used in\n            initializing the new table.  Otherwise the input columns\n            will be used as a template for a new table with the requested\n            number of rows.\n\n        nrows : int\n            Number of rows in the new table.  If the input columns have data\n            associated with them, the size of the largest input column is used.\n            Otherwise the default is 0.\n\n        fill : bool\n            If `True`, will fill all cells with zeros or blanks.  If\n            `False`, copy the data from input, undefined cells will still\n            be filled with zeros/blanks.\n        \"\"\"\n\n        if not isinstance(columns, ColDefs):\n            columns = ColDefs(columns)\n\n        # read the delayed data\n        for column in columns:\n            arr = column.array\n            if isinstance(arr, Delayed):\n                if arr.hdu.data is None:\n                    column.array = None\n                else:\n                    column.array = _get_recarray_field(arr.hdu.data,\n                                                       arr.field)\n        # Reset columns._arrays (which we may want to just do away with\n        # altogether\n        del columns._arrays\n\n        # use the largest column shape as the shape of the record\n        if nrows == 0:\n            for arr in columns._arrays:\n                if arr is not None:\n                    dim = arr.shape[0]\n                else:\n                    dim = 0\n                if dim > nrows:\n                    nrows = dim\n\n        raw_data = np.empty(columns.dtype.itemsize * nrows, dtype=np.uint8)\n        raw_data.fill(ord(columns._padding_byte))\n        data = np.recarray(nrows, dtype=columns.dtype, buf=raw_data).view(cls)\n        data._character_as_bytes = character_as_bytes\n\n        # Previously this assignment was made from hdu.columns, but that's a\n        # bug since if a _TableBaseHDU has a FITS_rec in its .data attribute\n        # the _TableBaseHDU.columns property is actually returned from\n        # .data._coldefs, so this assignment was circular!  Don't make that\n        # mistake again.\n        # All of this is an artifact of the fragility of the FITS_rec class,\n        # and that it can't just be initialized by columns...\n        data._coldefs = columns\n\n        # If fill is True we don't copy anything from the column arrays.  We're\n        # just using them as a template, and returning a table filled with\n        # zeros/blanks\n        if fill:\n            return data\n\n        # Otherwise we have to fill the recarray with data from the input\n        # columns\n        for idx, column in enumerate(columns):\n            # For each column in the ColDef object, determine the number of\n            # rows in that column.  This will be either the number of rows in\n            # the ndarray associated with the column, or the number of rows\n            # given in the call to this function, which ever is smaller.  If\n            # the input FILL argument is true, the number of rows is set to\n            # zero so that no data is copied from the original input data.\n            arr = column.array\n\n            if arr is None:\n                array_size = 0\n            else:\n                array_size = len(arr)\n\n            n = min(array_size, nrows)\n\n            # TODO: At least *some* of this logic is mostly redundant with the\n            # _convert_foo methods in this class; see if we can eliminate some\n            # of that duplication.\n\n            if not n:\n                # The input column had an empty array, so just use the fill\n                # value\n                continue\n\n            field = _get_recarray_field(data, idx)\n            name = column.name\n            fitsformat = column.format\n            recformat = fitsformat.recformat\n\n            outarr = field[:n]\n            inarr = arr[:n]\n\n            if isinstance(recformat, _FormatX):\n                # Data is a bit array\n                if inarr.shape[-1] == recformat.repeat:\n                    _wrapx(inarr, outarr, recformat.repeat)\n                    continue\n            elif isinstance(recformat, _FormatP):\n                data._cache_field(name, _makep(inarr, field, recformat,\n                                               nrows=nrows))\n                continue\n            # TODO: Find a better way of determining that the column is meant\n            # to be FITS L formatted\n            elif recformat[-2:] == FITS2NUMPY['L'] and inarr.dtype == bool:\n                # column is boolean\n                # The raw data field should be filled with either 'T' or 'F'\n                # (not 0).  Use 'F' as a default\n                field[:] = ord('F')\n                # Also save the original boolean array in data._converted so\n                # that it doesn't have to be re-converted\n                converted = np.zeros(field.shape, dtype=bool)\n                converted[:n] = inarr\n                data._cache_field(name, converted)\n                # TODO: Maybe this step isn't necessary at all if _scale_back\n                # will handle it?\n                inarr = np.where(inarr == np.False_, ord('F'), ord('T'))\n            elif (columns[idx]._physical_values and\n                    columns[idx]._pseudo_unsigned_ints):\n                # Temporary hack...\n                bzero = column.bzero\n                converted = np.zeros(field.shape, dtype=inarr.dtype)\n                converted[:n] = inarr\n                data._cache_field(name, converted)\n                if n < nrows:\n                    # Pre-scale rows below the input data\n                    field[n:] = -bzero\n\n                inarr = inarr - bzero\n            elif isinstance(columns, _AsciiColDefs):\n                # Regardless whether the format is character or numeric, if the\n                # input array contains characters then it's already in the raw\n                # format for ASCII tables\n                if fitsformat._pseudo_logical:\n                    # Hack to support converting from 8-bit T/F characters\n                    # Normally the column array is a chararray of 1 character\n                    # strings, but we need to view it as a normal ndarray of\n                    # 8-bit ints to fill it with ASCII codes for 'T' and 'F'\n                    outarr = field.view(np.uint8, np.ndarray)[:n]\n                elif arr.dtype.kind not in ('S', 'U'):\n                    # Set up views of numeric columns with the appropriate\n                    # numeric dtype\n                    # Fill with the appropriate blanks for the column format\n                    data._cache_field(name, np.zeros(nrows, dtype=arr.dtype))\n                    outarr = data._converted[name][:n]\n\n                outarr[:] = inarr\n                continue\n\n            if inarr.shape != outarr.shape:\n                if (inarr.dtype.kind == outarr.dtype.kind and\n                        inarr.dtype.kind in ('U', 'S') and\n                        inarr.dtype != outarr.dtype):\n\n                    inarr_rowsize = inarr[0].size\n                    inarr = inarr.flatten().view(outarr.dtype)\n\n                # This is a special case to handle input arrays with\n                # non-trivial TDIMn.\n                # By design each row of the outarray is 1-D, while each row of\n                # the input array may be n-D\n                if outarr.ndim > 1:\n                    # The normal case where the first dimension is the rows\n                    inarr_rowsize = inarr[0].size\n                    inarr = inarr.reshape(n, inarr_rowsize)\n                    outarr[:, :inarr_rowsize] = inarr\n                else:\n                    # Special case for strings where the out array only has one\n                    # dimension (the second dimension is rolled up into the\n                    # strings\n                    outarr[:n] = inarr.ravel()\n            else:\n                outarr[:] = inarr\n\n        # Now replace the original column array references with the new\n        # fields\n        # This is required to prevent the issue reported in\n        # https://github.com/spacetelescope/PyFITS/issues/99\n        for idx in range(len(columns)):\n            columns._arrays[idx] = data.field(idx)\n\n        return data"},{"col":4,"comment":"Similar to :meth:`dict.setdefault`.","endLoc":1041,"header":"def setdefault(self, key, default=None)","id":1286,"name":"setdefault","nodeType":"Function","startLoc":1034,"text":"def setdefault(self, key, default=None):\n        \"\"\"Similar to :meth:`dict.setdefault`.\"\"\"\n\n        try:\n            return self[key]\n        except (KeyError, IndexError):\n            self[key] = default\n        return default"},{"col":4,"comment":"\n        Update the Header with new keyword values, updating the values of\n        existing keywords and appending new keywords otherwise; similar to\n        `dict.update`.\n\n        `update` accepts either a dict-like object or an iterable.  In the\n        former case the keys must be header keywords and the values may be\n        either scalar values or (value, comment) tuples.  In the case of an\n        iterable the items must be (keyword, value) tuples or (keyword, value,\n        comment) tuples.\n\n        Arbitrary arguments are also accepted, in which case the update() is\n        called again with the kwargs dict as its only argument.  That is,\n\n        ::\n\n            >>> header.update(NAXIS1=100, NAXIS2=100)\n\n        is equivalent to::\n\n            header.update({'NAXIS1': 100, 'NAXIS2': 100})\n\n        .. warning::\n            As this method works similarly to `dict.update` it is very\n            different from the ``Header.update()`` method in Astropy v0.1.\n            Use of the old API was\n            **deprecated** for a long time and is now removed. Most uses of the\n            old API can be replaced as follows:\n\n            * Replace ::\n\n                  header.update(keyword, value)\n\n              with ::\n\n                  header[keyword] = value\n\n            * Replace ::\n\n                  header.update(keyword, value, comment=comment)\n\n              with ::\n\n                  header[keyword] = (value, comment)\n\n            * Replace ::\n\n                  header.update(keyword, value, before=before_keyword)\n\n              with ::\n\n                  header.insert(before_keyword, (keyword, value))\n\n            * Replace ::\n\n                  header.update(keyword, value, after=after_keyword)\n\n              with ::\n\n                  header.insert(after_keyword, (keyword, value),\n                                after=True)\n\n            See also :meth:`Header.set` which is a new method that provides an\n            interface similar to the old ``Header.update()`` and may help make\n            transition a little easier.\n\n        ","endLoc":1154,"header":"def update(self, *args, **kwargs)","id":1287,"name":"update","nodeType":"Function","startLoc":1043,"text":"def update(self, *args, **kwargs):\n        \"\"\"\n        Update the Header with new keyword values, updating the values of\n        existing keywords and appending new keywords otherwise; similar to\n        `dict.update`.\n\n        `update` accepts either a dict-like object or an iterable.  In the\n        former case the keys must be header keywords and the values may be\n        either scalar values or (value, comment) tuples.  In the case of an\n        iterable the items must be (keyword, value) tuples or (keyword, value,\n        comment) tuples.\n\n        Arbitrary arguments are also accepted, in which case the update() is\n        called again with the kwargs dict as its only argument.  That is,\n\n        ::\n\n            >>> header.update(NAXIS1=100, NAXIS2=100)\n\n        is equivalent to::\n\n            header.update({'NAXIS1': 100, 'NAXIS2': 100})\n\n        .. warning::\n            As this method works similarly to `dict.update` it is very\n            different from the ``Header.update()`` method in Astropy v0.1.\n            Use of the old API was\n            **deprecated** for a long time and is now removed. Most uses of the\n            old API can be replaced as follows:\n\n            * Replace ::\n\n                  header.update(keyword, value)\n\n              with ::\n\n                  header[keyword] = value\n\n            * Replace ::\n\n                  header.update(keyword, value, comment=comment)\n\n              with ::\n\n                  header[keyword] = (value, comment)\n\n            * Replace ::\n\n                  header.update(keyword, value, before=before_keyword)\n\n              with ::\n\n                  header.insert(before_keyword, (keyword, value))\n\n            * Replace ::\n\n                  header.update(keyword, value, after=after_keyword)\n\n              with ::\n\n                  header.insert(after_keyword, (keyword, value),\n                                after=True)\n\n            See also :meth:`Header.set` which is a new method that provides an\n            interface similar to the old ``Header.update()`` and may help make\n            transition a little easier.\n\n        \"\"\"\n\n        if args:\n            other = args[0]\n        else:\n            other = None\n\n        def update_from_dict(k, v):\n            if not isinstance(v, tuple):\n                card = Card(k, v)\n            elif 0 < len(v) <= 2:\n                card = Card(*((k,) + v))\n            else:\n                raise ValueError(\n                    'Header update value for key %r is invalid; the '\n                    'value must be either a scalar, a 1-tuple '\n                    'containing the scalar value, or a 2-tuple '\n                    'containing the value and a comment string.' % k)\n            self._update(card)\n\n        if other is None:\n            pass\n        elif isinstance(other, Header):\n            for card in other.cards:\n                self._update(card)\n        elif hasattr(other, 'items'):\n            for k, v in other.items():\n                update_from_dict(k, v)\n        elif hasattr(other, 'keys'):\n            for k in other.keys():\n                update_from_dict(k, other[k])\n        else:\n            for idx, card in enumerate(other):\n                if isinstance(card, Card):\n                    self._update(card)\n                elif isinstance(card, tuple) and (1 < len(card) <= 3):\n                    self._update(Card(*card))\n                else:\n                    raise ValueError(\n                        'Header update sequence item #{} is invalid; '\n                        'the item must either be a 2-tuple containing '\n                        'a keyword and value, or a 3-tuple containing '\n                        'a keyword, value, and comment string.'.format(idx))\n        if kwargs:\n            self.update(kwargs)"},{"col":0,"comment":"\n    Compatibility function for using the recarray base class's field method.\n    This incorporates the legacy functionality of returning string arrays as\n    Numeric-style chararray objects.\n    ","endLoc":1306,"header":"def _get_recarray_field(array, key)","id":1288,"name":"_get_recarray_field","nodeType":"Function","startLoc":1292,"text":"def _get_recarray_field(array, key):\n    \"\"\"\n    Compatibility function for using the recarray base class's field method.\n    This incorporates the legacy functionality of returning string arrays as\n    Numeric-style chararray objects.\n    \"\"\"\n\n    # Numpy >= 1.10.dev recarray no longer returns chararrays for strings\n    # This is currently needed for backwards-compatibility and for\n    # automatic truncation of trailing whitespace\n    field = np.recarray.field(array, key)\n    if (field.dtype.char in ('S', 'U') and\n            not isinstance(field, chararray.chararray)):\n        field = field.view(chararray.chararray)\n    return field"},{"col":4,"comment":"Returns the equivalent Numpy record format string.","endLoc":281,"header":"@lazyproperty\n    def recformat(self)","id":1290,"name":"recformat","nodeType":"Function","startLoc":277,"text":"@lazyproperty\n    def recformat(self):\n        \"\"\"Returns the equivalent Numpy record format string.\"\"\"\n\n        return _convert_format(self)"},{"col":4,"comment":"\n        Returns a 'canonical' string representation of this format.\n\n        This is in the proper form of rTa where T is the single character data\n        type code, a is the optional part, and r is the repeat.  If repeat == 1\n        (the default) it is left out of this representation.\n        ","endLoc":298,"header":"@lazyproperty\n    def canonical(self)","id":1291,"name":"canonical","nodeType":"Function","startLoc":283,"text":"@lazyproperty\n    def canonical(self):\n        \"\"\"\n        Returns a 'canonical' string representation of this format.\n\n        This is in the proper form of rTa where T is the single character data\n        type code, a is the optional part, and r is the repeat.  If repeat == 1\n        (the default) it is left out of this representation.\n        \"\"\"\n\n        if self.repeat == 1:\n            repeat = ''\n        else:\n            repeat = str(self.repeat)\n\n        return f'{repeat}{self.format}{self.option}'"},{"attributeType":"None","col":12,"comment":"null","endLoc":268,"id":1292,"name":"p_format","nodeType":"Attribute","startLoc":268,"text":"self.p_format"},{"attributeType":"null","col":8,"comment":"null","endLoc":256,"id":1293,"name":"repeat","nodeType":"Attribute","startLoc":256,"text":"self.repeat"},{"col":4,"comment":"null","endLoc":95,"header":"def __len__(self)","id":1294,"name":"__len__","nodeType":"Function","startLoc":94,"text":"def __len__(self):\n        return len(range(self.start, self.end, self.step))"},{"col":4,"comment":"\n        Display a single row.\n        ","endLoc":105,"header":"def __repr__(self)","id":1295,"name":"__repr__","nodeType":"Function","startLoc":97,"text":"def __repr__(self):\n        \"\"\"\n        Display a single row.\n        \"\"\"\n\n        outlist = []\n        for idx in range(len(self)):\n            outlist.append(repr(self[idx]))\n        return f\"({', '.join(outlist)})\""},{"col":4,"comment":"\n        Returns the count of the given keyword in the header, similar to\n        `list.count` if the Header object is treated as a list of keywords.\n\n        Parameters\n        ----------\n        keyword : str\n            The keyword to count instances of in the header\n\n        ","endLoc":1365,"header":"def count(self, keyword)","id":1296,"name":"count","nodeType":"Function","startLoc":1346,"text":"def count(self, keyword):\n        \"\"\"\n        Returns the count of the given keyword in the header, similar to\n        `list.count` if the Header object is treated as a list of keywords.\n\n        Parameters\n        ----------\n        keyword : str\n            The keyword to count instances of in the header\n\n        \"\"\"\n\n        keyword = Card.normalize_keyword(keyword)\n\n        # We have to look before we leap, since otherwise _keyword_indices,\n        # being a defaultdict, will create an entry for the nonexistent keyword\n        if keyword not in self._keyword_indices:\n            raise KeyError(f\"Keyword {keyword!r} not found.\")\n\n        return len(self._keyword_indices[keyword])"},{"col":4,"comment":"null","endLoc":962,"header":"def _format_comment(self)","id":1297,"name":"_format_comment","nodeType":"Function","startLoc":958,"text":"def _format_comment(self):\n        if not self.comment:\n            return ''\n        else:\n            return f' / {self._comment}'"},{"attributeType":"null","col":8,"comment":"null","endLoc":257,"id":1298,"name":"format","nodeType":"Attribute","startLoc":257,"text":"self.format"},{"attributeType":"null","col":8,"comment":"null","endLoc":255,"id":1299,"name":"self","nodeType":"Attribute","startLoc":255,"text":"self"},{"attributeType":"_FormatQ","col":16,"comment":"null","endLoc":264,"id":1300,"name":"recformat","nodeType":"Attribute","startLoc":264,"text":"recformat"},{"col":4,"comment":"\n        Get the field data of the record.\n        ","endLoc":112,"header":"def field(self, field)","id":1301,"name":"field","nodeType":"Function","startLoc":107,"text":"def field(self, field):\n        \"\"\"\n        Get the field data of the record.\n        \"\"\"\n\n        return self.__getitem__(field)"},{"col":4,"comment":"\n        Removes the first instance of the given keyword from the header similar\n        to `list.remove` if the Header object is treated as a list of keywords.\n\n        Parameters\n        ----------\n        keyword : str\n            The keyword of which to remove the first instance in the header.\n\n        ignore_missing : bool, optional\n            When True, ignores missing keywords.  Otherwise, if the keyword\n            is not present in the header a KeyError is raised.\n\n        remove_all : bool, optional\n            When True, all instances of keyword will be removed.\n            Otherwise only the first instance of the given keyword is removed.\n\n        ","endLoc":1525,"header":"def remove(self, keyword, ignore_missing=False, remove_all=False)","id":1302,"name":"remove","nodeType":"Function","startLoc":1499,"text":"def remove(self, keyword, ignore_missing=False, remove_all=False):\n        \"\"\"\n        Removes the first instance of the given keyword from the header similar\n        to `list.remove` if the Header object is treated as a list of keywords.\n\n        Parameters\n        ----------\n        keyword : str\n            The keyword of which to remove the first instance in the header.\n\n        ignore_missing : bool, optional\n            When True, ignores missing keywords.  Otherwise, if the keyword\n            is not present in the header a KeyError is raised.\n\n        remove_all : bool, optional\n            When True, all instances of keyword will be removed.\n            Otherwise only the first instance of the given keyword is removed.\n\n        \"\"\"\n        keyword = Card.normalize_keyword(keyword)\n        if keyword in self._keyword_indices:\n            del self[self._keyword_indices[keyword][0]]\n            if remove_all:\n                while keyword in self._keyword_indices:\n                    del self[self._keyword_indices[keyword][0]]\n        elif not ignore_missing:\n            raise KeyError(f\"Keyword '{keyword}' not found.\")"},{"col":4,"comment":"\n        Rename a card's keyword in the header.\n\n        Parameters\n        ----------\n        oldkeyword : str or int\n            Old keyword or card index\n\n        newkeyword : str\n            New keyword\n\n        force : bool, optional\n            When `True`, if the new keyword already exists in the header, force\n            the creation of a duplicate keyword. Otherwise a\n            `ValueError` is raised.\n        ","endLoc":1563,"header":"def rename_keyword(self, oldkeyword, newkeyword, force=False)","id":1303,"name":"rename_keyword","nodeType":"Function","startLoc":1527,"text":"def rename_keyword(self, oldkeyword, newkeyword, force=False):\n        \"\"\"\n        Rename a card's keyword in the header.\n\n        Parameters\n        ----------\n        oldkeyword : str or int\n            Old keyword or card index\n\n        newkeyword : str\n            New keyword\n\n        force : bool, optional\n            When `True`, if the new keyword already exists in the header, force\n            the creation of a duplicate keyword. Otherwise a\n            `ValueError` is raised.\n        \"\"\"\n\n        oldkeyword = Card.normalize_keyword(oldkeyword)\n        newkeyword = Card.normalize_keyword(newkeyword)\n\n        if newkeyword == 'CONTINUE':\n            raise ValueError('Can not rename to CONTINUE')\n\n        if (newkeyword in Card._commentary_keywords or\n                oldkeyword in Card._commentary_keywords):\n            if not (newkeyword in Card._commentary_keywords and\n                    oldkeyword in Card._commentary_keywords):\n                raise ValueError('Regular and commentary keys can not be '\n                                 'renamed to each other.')\n        elif not force and newkeyword in self:\n            raise ValueError(f'Intended keyword {newkeyword} already exists in header.')\n\n        idx = self.index(oldkeyword)\n        card = self._cards[idx]\n        del self[idx]\n        self.insert(idx, (newkeyword, card.value, card.comment))"},{"col":4,"comment":"\n        Break up long string value/comment into ``CONTINUE`` cards.\n        This is a primitive implementation: it will put the value\n        string in one block and the comment string in another.  Also,\n        it does not break at the blank space between words.  So it may\n        not look pretty.\n        ","endLoc":1063,"header":"def _format_long_image(self)","id":1304,"name":"_format_long_image","nodeType":"Function","startLoc":1013,"text":"def _format_long_image(self):\n        \"\"\"\n        Break up long string value/comment into ``CONTINUE`` cards.\n        This is a primitive implementation: it will put the value\n        string in one block and the comment string in another.  Also,\n        it does not break at the blank space between words.  So it may\n        not look pretty.\n        \"\"\"\n\n        if self.keyword in Card._commentary_keywords:\n            return self._format_long_commentary_image()\n\n        value_length = 67\n        comment_length = 64\n        output = []\n\n        # do the value string\n        value = self._value.replace(\"'\", \"''\")\n        words = _words_group(value, value_length)\n        for idx, word in enumerate(words):\n            if idx == 0:\n                headstr = '{:{len}}= '.format(self.keyword, len=KEYWORD_LENGTH)\n            else:\n                headstr = 'CONTINUE  '\n\n            # If this is the final CONTINUE remove the '&'\n            if not self.comment and idx == len(words) - 1:\n                value_format = \"'{}'\"\n            else:\n                value_format = \"'{}&'\"\n\n            value = value_format.format(word)\n\n            output.append(f'{headstr + value:80}')\n\n        # do the comment string\n        comment_format = \"{}\"\n\n        if self.comment:\n            words = _words_group(self.comment, comment_length)\n            for idx, word in enumerate(words):\n                # If this is the final CONTINUE remove the '&'\n                if idx == len(words) - 1:\n                    headstr = \"CONTINUE  '' / \"\n                else:\n                    headstr = \"CONTINUE  '&' / \"\n\n                comment = headstr + comment_format.format(word)\n                output.append(f'{comment:80}')\n\n        return ''.join(output)"},{"attributeType":"null","col":34,"comment":"null","endLoc":256,"id":1305,"name":"option","nodeType":"Attribute","startLoc":256,"text":"self.option"},{"col":4,"comment":"\n        If a commentary card's value is too long to fit on a single card, this\n        will render the card as multiple consecutive commentary card of the\n        same type.\n        ","endLoc":1079,"header":"def _format_long_commentary_image(self)","id":1306,"name":"_format_long_commentary_image","nodeType":"Function","startLoc":1065,"text":"def _format_long_commentary_image(self):\n        \"\"\"\n        If a commentary card's value is too long to fit on a single card, this\n        will render the card as multiple consecutive commentary card of the\n        same type.\n        \"\"\"\n\n        maxlen = Card.length - KEYWORD_LENGTH\n        value = self._format_value()\n        output = []\n        idx = 0\n        while idx < len(value):\n            output.append(str(Card(self.keyword, value[idx:idx + maxlen])))\n            idx += maxlen\n        return ''.join(output)"},{"className":"_AsciiColumnFormat","col":0,"comment":"Similar to _ColumnFormat but specifically for columns in ASCII tables.\n\n    The formats of ASCII table columns and binary table columns are inherently\n    incompatible in FITS.  They don't support the same ranges and types of\n    values, and even reuse format codes in subtly different ways.  For example\n    the format code 'Iw' in ASCII columns refers to any integer whose string\n    representation is at most w characters wide, so 'I' can represent\n    effectively any integer that will fit in a FITS columns.  Whereas for\n    binary tables 'I' very explicitly refers to a 16-bit signed integer.\n\n    Conversions between the two column formats can be performed using the\n    ``to/from_binary`` methods on this class, or the ``to/from_ascii``\n    methods on the `_ColumnFormat` class.  But again, not all conversions are\n    possible and may result in a `ValueError`.\n    ","endLoc":366,"id":1307,"nodeType":"Class","startLoc":301,"text":"class _AsciiColumnFormat(_BaseColumnFormat):\n    \"\"\"Similar to _ColumnFormat but specifically for columns in ASCII tables.\n\n    The formats of ASCII table columns and binary table columns are inherently\n    incompatible in FITS.  They don't support the same ranges and types of\n    values, and even reuse format codes in subtly different ways.  For example\n    the format code 'Iw' in ASCII columns refers to any integer whose string\n    representation is at most w characters wide, so 'I' can represent\n    effectively any integer that will fit in a FITS columns.  Whereas for\n    binary tables 'I' very explicitly refers to a 16-bit signed integer.\n\n    Conversions between the two column formats can be performed using the\n    ``to/from_binary`` methods on this class, or the ``to/from_ascii``\n    methods on the `_ColumnFormat` class.  But again, not all conversions are\n    possible and may result in a `ValueError`.\n    \"\"\"\n\n    def __new__(cls, format, strict=False):\n        self = super().__new__(cls, format)\n        self.format, self.width, self.precision = \\\n            _parse_ascii_tformat(format, strict)\n\n        # If no width has been specified, set the dtype here to default as well\n        if format == self.format:\n            self.recformat = ASCII2NUMPY[format]\n\n        # This is to support handling logical (boolean) data from binary tables\n        # in an ASCII table\n        self._pseudo_logical = False\n        return self\n\n    @classmethod\n    def from_column_format(cls, format):\n        inst = cls.from_recformat(format.recformat)\n        # Hack\n        if format.format == 'L':\n            inst._pseudo_logical = True\n        return inst\n\n    @classmethod\n    def from_recformat(cls, recformat):\n        \"\"\"Creates a column format from a Numpy record dtype format.\"\"\"\n\n        return cls(_convert_ascii_format(recformat, reverse=True))\n\n    @lazyproperty\n    def recformat(self):\n        \"\"\"Returns the equivalent Numpy record format string.\"\"\"\n\n        return _convert_ascii_format(self)\n\n    @lazyproperty\n    def canonical(self):\n        \"\"\"\n        Returns a 'canonical' string representation of this format.\n\n        This is in the proper form of Tw.d where T is the single character data\n        type code, w is the width in characters for this field, and d is the\n        number of digits after the decimal place (for format codes 'E', 'F',\n        and 'D' only).\n        \"\"\"\n\n        if self.format in ('E', 'F', 'D'):\n            return f'{self.format}{self.width}.{self.precision}'\n\n        return f'{self.format}{self.width}'"},{"col":4,"comment":"\n        Add a ``HISTORY`` card.\n\n        Parameters\n        ----------\n        value : str\n            History text to be added.\n\n        before : str or int, optional\n            Same as in `Header.update`\n\n        after : str or int, optional\n            Same as in `Header.update`\n        ","endLoc":1581,"header":"def add_history(self, value, before=None, after=None)","id":1308,"name":"add_history","nodeType":"Function","startLoc":1565,"text":"def add_history(self, value, before=None, after=None):\n        \"\"\"\n        Add a ``HISTORY`` card.\n\n        Parameters\n        ----------\n        value : str\n            History text to be added.\n\n        before : str or int, optional\n            Same as in `Header.update`\n\n        after : str or int, optional\n            Same as in `Header.update`\n        \"\"\"\n\n        self._add_commentary('HISTORY', value, before=before, after=after)"},{"col":4,"comment":"null","endLoc":338,"header":"@classmethod\n    def from_column_format(cls, format)","id":1309,"name":"from_column_format","nodeType":"Function","startLoc":332,"text":"@classmethod\n    def from_column_format(cls, format):\n        inst = cls.from_recformat(format.recformat)\n        # Hack\n        if format.format == 'L':\n            inst._pseudo_logical = True\n        return inst"},{"col":4,"comment":"\n        Add a commentary card.\n\n        If ``before`` and ``after`` are `None`, add to the last occurrence\n        of cards of the same name (except blank card).  If there is no\n        card (or blank card), append at the end.\n        ","endLoc":1939,"header":"def _add_commentary(self, key, value, before=None, after=None)","id":1310,"name":"_add_commentary","nodeType":"Function","startLoc":1926,"text":"def _add_commentary(self, key, value, before=None, after=None):\n        \"\"\"\n        Add a commentary card.\n\n        If ``before`` and ``after`` are `None`, add to the last occurrence\n        of cards of the same name (except blank card).  If there is no\n        card (or blank card), append at the end.\n        \"\"\"\n\n        if before is not None or after is not None:\n            self._relativeinsert((key, value), before=before,\n                                 after=after)\n        else:\n            self[key] = value"},{"col":4,"comment":"\n        Add a ``COMMENT`` card.\n\n        Parameters\n        ----------\n        value : str\n            Text to be added.\n\n        before : str or int, optional\n            Same as in `Header.update`\n\n        after : str or int, optional\n            Same as in `Header.update`\n        ","endLoc":1599,"header":"def add_comment(self, value, before=None, after=None)","id":1311,"name":"add_comment","nodeType":"Function","startLoc":1583,"text":"def add_comment(self, value, before=None, after=None):\n        \"\"\"\n        Add a ``COMMENT`` card.\n\n        Parameters\n        ----------\n        value : str\n            Text to be added.\n\n        before : str or int, optional\n            Same as in `Header.update`\n\n        after : str or int, optional\n            Same as in `Header.update`\n        \"\"\"\n\n        self._add_commentary('COMMENT', value, before=before, after=after)"},{"col":4,"comment":"\n        Add a blank card.\n\n        Parameters\n        ----------\n        value : str, optional\n            Text to be added.\n\n        before : str or int, optional\n            Same as in `Header.update`\n\n        after : str or int, optional\n            Same as in `Header.update`\n        ","endLoc":1617,"header":"def add_blank(self, value='', before=None, after=None)","id":1312,"name":"add_blank","nodeType":"Function","startLoc":1601,"text":"def add_blank(self, value='', before=None, after=None):\n        \"\"\"\n        Add a blank card.\n\n        Parameters\n        ----------\n        value : str, optional\n            Text to be added.\n\n        before : str or int, optional\n            Same as in `Header.update`\n\n        after : str or int, optional\n            Same as in `Header.update`\n        \"\"\"\n\n        self._add_commentary('', value, before=before, after=after)"},{"col":4,"comment":"null","endLoc":474,"header":"def __repr__(self)","id":1313,"name":"__repr__","nodeType":"Function","startLoc":471,"text":"def __repr__(self):\n        # Force use of the normal ndarray repr (rather than the new\n        # one added for recarray in Numpy 1.10) for backwards compat\n        return np.ndarray.__repr__(self)"},{"col":4,"comment":"null","endLoc":494,"header":"def __getattribute__(self, attr)","id":1314,"name":"__getattribute__","nodeType":"Function","startLoc":476,"text":"def __getattribute__(self, attr):\n        # First, see if ndarray has this attr, and return it if so. Note that\n        # this means a field with the same name as an ndarray attr cannot be\n        # accessed by attribute, this is Numpy's default behavior.\n        # We avoid using np.recarray.__getattribute__ here because after doing\n        # this check it would access the columns without doing the conversions\n        # that we need (with .field, see below).\n        try:\n            return object.__getattribute__(self, attr)\n        except AttributeError:\n            pass\n\n        # attr might still be a fieldname.  If we have column definitions,\n        # we should access this via .field, as the data may have to be scaled.\n        if self._coldefs is not None and attr in self.columns.names:\n            return self.field(attr)\n\n        # If not, just let the usual np.recarray override deal with it.\n        return super().__getattribute__(attr)"},{"col":4,"comment":"\n        Strip cards specific to a certain kind of header.\n\n        Strip cards like ``SIMPLE``, ``BITPIX``, etc. so the rest of\n        the header can be used to reconstruct another kind of header.\n        ","endLoc":1649,"header":"def strip(self)","id":1315,"name":"strip","nodeType":"Function","startLoc":1619,"text":"def strip(self):\n        \"\"\"\n        Strip cards specific to a certain kind of header.\n\n        Strip cards like ``SIMPLE``, ``BITPIX``, etc. so the rest of\n        the header can be used to reconstruct another kind of header.\n        \"\"\"\n\n        # TODO: Previously this only deleted some cards specific to an HDU if\n        # _hdutype matched that type.  But it seemed simple enough to just\n        # delete all desired cards anyways, and just ignore the KeyErrors if\n        # they don't exist.\n        # However, it might be desirable to make this extendable somehow--have\n        # a way for HDU classes to specify some headers that are specific only\n        # to that type, and should be removed otherwise.\n\n        naxis = self.get('NAXIS', 0)\n        tfields = self.get('TFIELDS', 0)\n\n        for idx in range(naxis):\n            self.remove('NAXIS' + str(idx + 1), ignore_missing=True)\n\n        for name in ('TFORM', 'TSCAL', 'TZERO', 'TNULL', 'TTYPE',\n                     'TUNIT', 'TDISP', 'TDIM', 'THEAP', 'TBCOL'):\n            for idx in range(tfields):\n                self.remove(name + str(idx + 1), ignore_missing=True)\n\n        for name in ('SIMPLE', 'XTENSION', 'BITPIX', 'NAXIS', 'EXTEND',\n                     'PCOUNT', 'GCOUNT', 'GROUPS', 'BSCALE', 'BZERO',\n                     'TFIELDS'):\n            self.remove(name, ignore_missing=True)"},{"col":4,"comment":"\n        A view of a `Column`'s data as an array.\n        ","endLoc":729,"header":"def field(self, key)","id":1316,"name":"field","nodeType":"Function","startLoc":681,"text":"def field(self, key):\n        \"\"\"\n        A view of a `Column`'s data as an array.\n        \"\"\"\n\n        # NOTE: The *column* index may not be the same as the field index in\n        # the recarray, if the column is a phantom column\n        column = self.columns[key]\n        name = column.name\n        format = column.format\n\n        if format.dtype.itemsize == 0:\n            warnings.warn(\n                'Field {!r} has a repeat count of 0 in its format code, '\n                'indicating an empty field.'.format(key))\n            return np.array([], dtype=format.dtype)\n\n        # If field's base is a FITS_rec, we can run into trouble because it\n        # contains a reference to the ._coldefs object of the original data;\n        # this can lead to a circular reference; see ticket #49\n        base = self\n        while (isinstance(base, FITS_rec) and\n                isinstance(base.base, np.recarray)):\n            base = base.base\n        # base could still be a FITS_rec in some cases, so take care to\n        # use rec.recarray.field to avoid a potential infinite\n        # recursion\n        field = _get_recarray_field(base, name)\n\n        if name not in self._converted:\n            recformat = format.recformat\n            # TODO: If we're now passing the column to these subroutines, do we\n            # really need to pass them the recformat?\n            if isinstance(recformat, _FormatP):\n                # for P format\n                converted = self._convert_p(column, field, recformat)\n            else:\n                # Handle all other column data types which are fixed-width\n                # fields\n                converted = self._convert_other(column, field, recformat)\n\n            # Note: Never assign values directly into the self._converted dict;\n            # always go through self._cache_field; this way self._converted is\n            # only used to store arrays that are not already direct views of\n            # our own data.\n            self._cache_field(name, converted)\n            return converted\n\n        return self._converted[name]"},{"col":4,"comment":"\n        `True` if the card is completely blank--that is, it has no keyword,\n        value, or comment.  It appears in the header as 80 spaces.\n\n        Returns `False` otherwise.\n        ","endLoc":527,"header":"@property\n    def is_blank(self)","id":1317,"name":"is_blank","nodeType":"Function","startLoc":508,"text":"@property\n    def is_blank(self):\n        \"\"\"\n        `True` if the card is completely blank--that is, it has no keyword,\n        value, or comment.  It appears in the header as 80 spaces.\n\n        Returns `False` otherwise.\n        \"\"\"\n\n        if not self._verified:\n            # The card image has not been parsed yet; compare directly with the\n            # string representation of a blank card\n            return self._image == BLANK_CARD\n\n        # If the keyword, value, and comment are all empty (for self.value\n        # explicitly check that it is a string value, since a blank value is\n        # returned as '')\n        return (not self.keyword and\n                (isinstance(self.value, str) and not self.value) and\n                not self.comment)"},{"col":4,"comment":"null","endLoc":874,"header":"def _fix_keyword(self)","id":1318,"name":"_fix_keyword","nodeType":"Function","startLoc":868,"text":"def _fix_keyword(self):\n        if self.field_specifier:\n            keyword, field_specifier = self._keyword.split('.', 1)\n            self._keyword = '.'.join([keyword.upper(), field_specifier])\n        else:\n            self._keyword = self._keyword.upper()\n        self._modified = True"},{"col":4,"comment":"Convert a raw table column of FITS P or Q format descriptors\n        to a VLA column with the array data returned from the heap.\n        ","endLoc":831,"header":"def _convert_p(self, column, field, recformat)","id":1319,"name":"_convert_p","nodeType":"Function","startLoc":791,"text":"def _convert_p(self, column, field, recformat):\n        \"\"\"Convert a raw table column of FITS P or Q format descriptors\n        to a VLA column with the array data returned from the heap.\n        \"\"\"\n\n        dummy = _VLF([None] * len(self), dtype=recformat.dtype)\n        raw_data = self._get_raw_data()\n\n        if raw_data is None:\n            raise OSError(\n                \"Could not find heap data for the {!r} variable-length \"\n                \"array column.\".format(column.name))\n\n        for idx in range(len(self)):\n            offset = field[idx, 1] + self._heapoffset\n            count = field[idx, 0]\n\n            if recformat.dtype == 'a':\n                dt = np.dtype(recformat.dtype + str(1))\n                arr_len = count * dt.itemsize\n                da = raw_data[offset:offset + arr_len].view(dt)\n                da = np.char.array(da.view(dtype=dt), itemsize=count)\n                dummy[idx] = decode_ascii(da)\n            else:\n                dt = np.dtype(recformat.dtype)\n                arr_len = count * dt.itemsize\n                dummy[idx] = raw_data[offset:offset + arr_len].view(dt)\n                dummy[idx].dtype = dummy[idx].dtype.newbyteorder('>')\n                # Each array in the field may now require additional\n                # scaling depending on the other scaling parameters\n                # TODO: The same scaling parameters apply to every\n                # array in the column so this is currently very slow; we\n                # really only need to check once whether any scaling will\n                # be necessary and skip this step if not\n                # TODO: Test that this works for X format; I don't think\n                # that it does--the recformat variable only applies to the P\n                # format not the X format\n                dummy[idx] = self._convert_other(column, dummy[idx],\n                                                 recformat)\n\n        return dummy"},{"col":4,"comment":"\n        Set the field data of the record.\n        ","endLoc":119,"header":"def setfield(self, field, value)","id":1320,"name":"setfield","nodeType":"Function","startLoc":114,"text":"def setfield(self, field, value):\n        \"\"\"\n        Set the field data of the record.\n        \"\"\"\n\n        self.__setitem__(field, value)"},{"col":4,"comment":"\n        Returns the base array of self that \"raw data array\" that is the\n        array in the format that it was first read from a file before it was\n        sliced or viewed as a different type in any way.\n\n        This is determined by walking through the bases until finding one that\n        has at least the same number of bytes as self, plus the heapsize.  This\n        may be the immediate .base but is not always.  This is used primarily\n        for variable-length array support which needs to be able to find the\n        heap (the raw data *may* be larger than nbytes + heapsize if it\n        contains a gap or padding).\n\n        May return ``None`` if no array resembling the \"raw data\" according to\n        the stated criteria can be found.\n        ","endLoc":1041,"header":"def _get_raw_data(self)","id":1321,"name":"_get_raw_data","nodeType":"Function","startLoc":1019,"text":"def _get_raw_data(self):\n        \"\"\"\n        Returns the base array of self that \"raw data array\" that is the\n        array in the format that it was first read from a file before it was\n        sliced or viewed as a different type in any way.\n\n        This is determined by walking through the bases until finding one that\n        has at least the same number of bytes as self, plus the heapsize.  This\n        may be the immediate .base but is not always.  This is used primarily\n        for variable-length array support which needs to be able to find the\n        heap (the raw data *may* be larger than nbytes + heapsize if it\n        contains a gap or padding).\n\n        May return ``None`` if no array resembling the \"raw data\" according to\n        the stated criteria can be found.\n        \"\"\"\n\n        raw_data_bytes = self.nbytes + self._heapsize\n        base = self\n        while hasattr(base, 'base') and base.base is not None:\n            base = base.base\n            if hasattr(base, 'nbytes') and base.nbytes >= raw_data_bytes:\n                return base"},{"col":4,"comment":"Fix the card image for fixable non-standard compliance.","endLoc":914,"header":"def _fix_value(self)","id":1322,"name":"_fix_value","nodeType":"Function","startLoc":876,"text":"def _fix_value(self):\n        \"\"\"Fix the card image for fixable non-standard compliance.\"\"\"\n\n        value = None\n        keyword, valuecomment = self._split()\n        m = self._value_NFSC_RE.match(valuecomment)\n\n        # for the unparsable case\n        if m is None:\n            try:\n                value, comment = valuecomment.split('/', 1)\n                self.value = value.strip()\n                self.comment = comment.strip()\n            except (ValueError, IndexError):\n                self.value = valuecomment\n            self._valuestring = self._value\n            return\n        elif m.group('numr') is not None:\n            numr = self._number_NFSC_RE.match(m.group('numr'))\n            value = translate(numr.group('digt'), FIX_FP_TABLE, ' ')\n            if numr.group('sign') is not None:\n                value = numr.group('sign') + value\n\n        elif m.group('cplx') is not None:\n            real = self._number_NFSC_RE.match(m.group('real'))\n            rdigt = translate(real.group('digt'), FIX_FP_TABLE, ' ')\n            if real.group('sign') is not None:\n                rdigt = real.group('sign') + rdigt\n\n            imag = self._number_NFSC_RE.match(m.group('imag'))\n            idigt = translate(imag.group('digt'), FIX_FP_TABLE, ' ')\n            if imag.group('sign') is not None:\n                idigt = imag.group('sign') + idigt\n            value = f'({rdigt}, {idigt})'\n        self._valuestring = value\n        # The value itself has not been modified, but its serialized\n        # representation (as stored in self._valuestring) has been changed, so\n        # still set this card as having been modified (see ticket #137)\n        self._modified = True"},{"col":4,"comment":"\n        Given an integer index, return the (keyword, repeat) tuple that index\n        refers to.  For most keywords the repeat will always be zero, but it\n        may be greater than zero for keywords that are duplicated (especially\n        commentary keywords).\n\n        In a sense this is the inverse of self.index, except that it also\n        supports duplicates.\n        ","endLoc":1762,"header":"def _keyword_from_index(self, idx)","id":1323,"name":"_keyword_from_index","nodeType":"Function","startLoc":1745,"text":"def _keyword_from_index(self, idx):\n        \"\"\"\n        Given an integer index, return the (keyword, repeat) tuple that index\n        refers to.  For most keywords the repeat will always be zero, but it\n        may be greater than zero for keywords that are duplicated (especially\n        commentary keywords).\n\n        In a sense this is the inverse of self.index, except that it also\n        supports duplicates.\n        \"\"\"\n\n        if idx < 0:\n            idx += len(self._cards)\n\n        keyword = self._cards[idx].keyword\n        keyword = Card.normalize_keyword(keyword)\n        repeat = self._keyword_indices[keyword].index(idx)\n        return keyword, repeat"},{"col":0,"comment":"null","endLoc":454,"header":"def get_caller_module_dict(levels)","id":1324,"name":"get_caller_module_dict","nodeType":"Function","startLoc":449,"text":"def get_caller_module_dict(levels):\n    f = sys._getframe(levels)\n    ldict = f.f_globals.copy()\n    if f.f_globals != f.f_locals:\n        ldict.update(f.f_locals)\n    return ldict"},{"attributeType":"null","col":8,"comment":"null","endLoc":799,"id":1325,"name":"_keyword_indices","nodeType":"Attribute","startLoc":799,"text":"self._keyword_indices"},{"attributeType":"null","col":8,"comment":"null","endLoc":800,"id":1326,"name":"_rvkc_indices","nodeType":"Attribute","startLoc":800,"text":"self._rvkc_indices"},{"attributeType":"null","col":8,"comment":"null","endLoc":798,"id":1327,"name":"_cards","nodeType":"Attribute","startLoc":798,"text":"self._cards"},{"attributeType":"null","col":8,"comment":"null","endLoc":116,"id":1328,"name":"_modified","nodeType":"Attribute","startLoc":116,"text":"self._modified"},{"col":4,"comment":"null","endLoc":128,"header":"@lazyproperty\n    def _bases(self)","id":1329,"name":"_bases","nodeType":"Function","startLoc":121,"text":"@lazyproperty\n    def _bases(self):\n        bases = [weakref.proxy(self)]\n        base = self.base\n        while base:\n            bases.append(base)\n            base = base.base\n        return bases"},{"className":"EarthLocation","col":0,"comment":"\n    Location on the Earth.\n\n    Initialization is first attempted assuming geocentric (x, y, z) coordinates\n    are given; if that fails, another attempt is made assuming geodetic\n    coordinates (longitude, latitude, height above a reference ellipsoid).\n    When using the geodetic forms, Longitudes are measured increasing to the\n    east, so west longitudes are negative. Internally, the coordinates are\n    stored as geocentric.\n\n    To ensure a specific type of coordinates is used, use the corresponding\n    class methods (`from_geocentric` and `from_geodetic`) or initialize the\n    arguments with names (``x``, ``y``, ``z`` for geocentric; ``lon``, ``lat``,\n    ``height`` for geodetic).  See the class methods for details.\n\n\n    Notes\n    -----\n    This class fits into the coordinates transformation framework in that it\n    encodes a position on the `~astropy.coordinates.ITRS` frame.  To get a\n    proper `~astropy.coordinates.ITRS` object from this object, use the ``itrs``\n    property.\n    ","endLoc":852,"id":1330,"nodeType":"Class","startLoc":164,"text":"class EarthLocation(u.Quantity):\n    \"\"\"\n    Location on the Earth.\n\n    Initialization is first attempted assuming geocentric (x, y, z) coordinates\n    are given; if that fails, another attempt is made assuming geodetic\n    coordinates (longitude, latitude, height above a reference ellipsoid).\n    When using the geodetic forms, Longitudes are measured increasing to the\n    east, so west longitudes are negative. Internally, the coordinates are\n    stored as geocentric.\n\n    To ensure a specific type of coordinates is used, use the corresponding\n    class methods (`from_geocentric` and `from_geodetic`) or initialize the\n    arguments with names (``x``, ``y``, ``z`` for geocentric; ``lon``, ``lat``,\n    ``height`` for geodetic).  See the class methods for details.\n\n\n    Notes\n    -----\n    This class fits into the coordinates transformation framework in that it\n    encodes a position on the `~astropy.coordinates.ITRS` frame.  To get a\n    proper `~astropy.coordinates.ITRS` object from this object, use the ``itrs``\n    property.\n    \"\"\"\n\n    _ellipsoid = 'WGS84'\n    _location_dtype = np.dtype({'names': ['x', 'y', 'z'],\n                                'formats': [np.float64]*3})\n    _array_dtype = np.dtype((np.float64, (3,)))\n\n    info = EarthLocationInfo()\n\n    def __new__(cls, *args, **kwargs):\n        # TODO: needs copy argument and better dealing with inputs.\n        if (len(args) == 1 and len(kwargs) == 0 and\n                isinstance(args[0], EarthLocation)):\n            return args[0].copy()\n        try:\n            self = cls.from_geocentric(*args, **kwargs)\n        except (u.UnitsError, TypeError) as exc_geocentric:\n            try:\n                self = cls.from_geodetic(*args, **kwargs)\n            except Exception as exc_geodetic:\n                raise TypeError('Coordinates could not be parsed as either '\n                                'geocentric or geodetic, with respective '\n                                'exceptions \"{}\" and \"{}\"'\n                                .format(exc_geocentric, exc_geodetic))\n        return self\n\n    @classmethod\n    def from_geocentric(cls, x, y, z, unit=None):\n        \"\"\"\n        Location on Earth, initialized from geocentric coordinates.\n\n        Parameters\n        ----------\n        x, y, z : `~astropy.units.Quantity` or array-like\n            Cartesian coordinates.  If not quantities, ``unit`` should be given.\n        unit : unit-like or None\n            Physical unit of the coordinate values.  If ``x``, ``y``, and/or\n            ``z`` are quantities, they will be converted to this unit.\n\n        Raises\n        ------\n        astropy.units.UnitsError\n            If the units on ``x``, ``y``, and ``z`` do not match or an invalid\n            unit is given.\n        ValueError\n            If the shapes of ``x``, ``y``, and ``z`` do not match.\n        TypeError\n            If ``x`` is not a `~astropy.units.Quantity` and no unit is given.\n        \"\"\"\n        if unit is None:\n            try:\n                unit = x.unit\n            except AttributeError:\n                raise TypeError(\"Geocentric coordinates should be Quantities \"\n                                \"unless an explicit unit is given.\") from None\n        else:\n            unit = u.Unit(unit)\n\n        if unit.physical_type != 'length':\n            raise u.UnitsError(\"Geocentric coordinates should be in \"\n                               \"units of length.\")\n\n        try:\n            x = u.Quantity(x, unit, copy=False)\n            y = u.Quantity(y, unit, copy=False)\n            z = u.Quantity(z, unit, copy=False)\n        except u.UnitsError:\n            raise u.UnitsError(\"Geocentric coordinate units should all be \"\n                               \"consistent.\")\n\n        x, y, z = np.broadcast_arrays(x, y, z)\n        struc = np.empty(x.shape, cls._location_dtype)\n        struc['x'], struc['y'], struc['z'] = x, y, z\n        return super().__new__(cls, struc, unit, copy=False)\n\n    @classmethod\n    def from_geodetic(cls, lon, lat, height=0., ellipsoid=None):\n        \"\"\"\n        Location on Earth, initialized from geodetic coordinates.\n\n        Parameters\n        ----------\n        lon : `~astropy.coordinates.Longitude` or float\n            Earth East longitude.  Can be anything that initialises an\n            `~astropy.coordinates.Angle` object (if float, in degrees).\n        lat : `~astropy.coordinates.Latitude` or float\n            Earth latitude.  Can be anything that initialises an\n            `~astropy.coordinates.Latitude` object (if float, in degrees).\n        height : `~astropy.units.Quantity` ['length'] or float, optional\n            Height above reference ellipsoid (if float, in meters; default: 0).\n        ellipsoid : str, optional\n            Name of the reference ellipsoid to use (default: 'WGS84').\n            Available ellipsoids are:  'WGS84', 'GRS80', 'WGS72'.\n\n        Raises\n        ------\n        astropy.units.UnitsError\n            If the units on ``lon`` and ``lat`` are inconsistent with angular\n            ones, or that on ``height`` with a length.\n        ValueError\n            If ``lon``, ``lat``, and ``height`` do not have the same shape, or\n            if ``ellipsoid`` is not recognized as among the ones implemented.\n\n        Notes\n        -----\n        For the conversion to geocentric coordinates, the ERFA routine\n        ``gd2gc`` is used.  See https://github.com/liberfa/erfa\n        \"\"\"\n        ellipsoid = _check_ellipsoid(ellipsoid, default=cls._ellipsoid)\n        # As wrapping fails on readonly input, we do so manually\n        lon = Angle(lon, u.degree, copy=False).wrap_at(180 * u.degree)\n        lat = Latitude(lat, u.degree, copy=False)\n        # don't convert to m by default, so we can use the height unit below.\n        if not isinstance(height, u.Quantity):\n            height = u.Quantity(height, u.m, copy=False)\n        # get geocentric coordinates.\n        geodetic = ELLIPSOIDS[ellipsoid](lon, lat, height, copy=False)\n        xyz = geodetic.to_cartesian().get_xyz(xyz_axis=-1) << height.unit\n        self = xyz.view(cls._location_dtype, cls).reshape(geodetic.shape)\n        self._ellipsoid = ellipsoid\n        return self\n\n    @classmethod\n    def of_site(cls, site_name):\n        \"\"\"\n        Return an object of this class for a known observatory/site by name.\n\n        This is intended as a quick convenience function to get basic site\n        information, not a fully-featured exhaustive registry of observatories\n        and all their properties.\n\n        Additional information about the site is stored in the ``.info.meta``\n        dictionary of sites obtained using this method (see the examples below).\n\n        .. note::\n            When this function is called, it will attempt to download site\n            information from the astropy data server. If you would like a site\n            to be added, issue a pull request to the\n            `astropy-data repository <https://github.com/astropy/astropy-data>`_ .\n            If a site cannot be found in the registry (i.e., an internet\n            connection is not available), it will fall back on a built-in list,\n            In the future, this bundled list might include a version-controlled\n            list of canonical observatories extracted from the online version,\n            but it currently only contains the Greenwich Royal Observatory as an\n            example case.\n\n\n        Parameters\n        ----------\n        site_name : str\n            Name of the observatory (case-insensitive).\n\n        Returns\n        -------\n        site : `~astropy.coordinates.EarthLocation` (or subclass) instance\n            The location of the observatory. The returned class will be the same\n            as this class.\n\n        Examples\n        --------\n\n        >>> from astropy.coordinates import EarthLocation\n        >>> keck = EarthLocation.of_site('Keck Observatory')  # doctest: +REMOTE_DATA\n        >>> keck.geodetic  # doctest: +REMOTE_DATA +FLOAT_CMP\n        GeodeticLocation(lon=<Longitude -155.47833333 deg>, lat=<Latitude 19.82833333 deg>, height=<Quantity 4160. m>)\n        >>> keck.info  # doctest: +REMOTE_DATA\n        name = W. M. Keck Observatory\n        dtype = void192\n        unit = m\n        class = EarthLocation\n        n_bad = 0\n        >>> keck.info.meta  # doctest: +REMOTE_DATA\n        {'source': 'IRAF Observatory Database', 'timezone': 'US/Hawaii'}\n\n        See Also\n        --------\n        get_site_names : the list of sites that this function can access\n        \"\"\"  # noqa\n        registry = cls._get_site_registry()\n        try:\n            el = registry[site_name]\n        except UnknownSiteException as e:\n            raise UnknownSiteException(e.site, 'EarthLocation.get_site_names',\n                                       close_names=e.close_names) from e\n\n        if cls is el.__class__:\n            return el\n        else:\n            newel = cls.from_geodetic(*el.to_geodetic())\n            newel.info.name = el.info.name\n            return newel\n\n    @classmethod\n    def of_address(cls, address, get_height=False, google_api_key=None):\n        \"\"\"\n        Return an object of this class for a given address by querying either\n        the OpenStreetMap Nominatim tool [1]_ (default) or the Google geocoding\n        API [2]_, which requires a specified API key.\n\n        This is intended as a quick convenience function to get easy access to\n        locations. If you need to specify a precise location, you should use the\n        initializer directly and pass in a longitude, latitude, and elevation.\n\n        In the background, this just issues a web query to either of\n        the APIs noted above. This is not meant to be abused! Both\n        OpenStreetMap and Google use IP-based query limiting and will ban your\n        IP if you send more than a few thousand queries per hour [2]_.\n\n        .. warning::\n            If the query returns more than one location (e.g., searching on\n            ``address='springfield'``), this function will use the **first**\n            returned location.\n\n        Parameters\n        ----------\n        address : str\n            The address to get the location for. As per the Google maps API,\n            this can be a fully specified street address (e.g., 123 Main St.,\n            New York, NY) or a city name (e.g., Danbury, CT), or etc.\n        get_height : bool, optional\n            This only works when using the Google API! See the ``google_api_key``\n            block below. Use the retrieved location to perform a second query to\n            the Google maps elevation API to retrieve the height of the input\n            address [3]_.\n        google_api_key : str, optional\n            A Google API key with the Geocoding API and (optionally) the\n            elevation API enabled. See [4]_ for more information.\n\n\n        Returns\n        -------\n        location : `~astropy.coordinates.EarthLocation` (or subclass) instance\n            The location of the input address.\n            Will be type(this class)\n\n        References\n        ----------\n        .. [1] https://nominatim.openstreetmap.org/\n        .. [2] https://developers.google.com/maps/documentation/geocoding/start\n        .. [3] https://developers.google.com/maps/documentation/elevation/start\n        .. [4] https://developers.google.com/maps/documentation/geocoding/get-api-key\n\n        \"\"\"\n\n        use_google = google_api_key is not None\n\n        # Fail fast if invalid options are passed:\n        if not use_google and get_height:\n            raise ValueError(\n                'Currently, `get_height` only works when using '\n                'the Google geocoding API, which requires passing '\n                'a Google API key with `google_api_key`. See: '\n                'https://developers.google.com/maps/documentation/geocoding/get-api-key '\n                'for information on obtaining an API key.')\n\n        if use_google:  # Google\n            pars = urllib.parse.urlencode({'address': address,\n                                           'key': google_api_key})\n            geo_url = f\"https://maps.googleapis.com/maps/api/geocode/json?{pars}\"\n\n        else:  # OpenStreetMap\n            pars = urllib.parse.urlencode({'q': address,\n                                           'format': 'json'})\n            geo_url = f\"https://nominatim.openstreetmap.org/search?{pars}\"\n\n        # get longitude and latitude location\n        err_str = f\"Unable to retrieve coordinates for address '{address}'; {{msg}}\"\n        geo_result = _get_json_result(geo_url, err_str=err_str,\n                                      use_google=use_google)\n\n        if use_google:\n            loc = geo_result[0]['geometry']['location']\n            lat = loc['lat']\n            lon = loc['lng']\n\n        else:\n            loc = geo_result[0]\n            lat = float(loc['lat'])  # strings are returned by OpenStreetMap\n            lon = float(loc['lon'])\n\n        if get_height:\n            pars = {'locations': f'{lat:.8f},{lon:.8f}',\n                    'key': google_api_key}\n            pars = urllib.parse.urlencode(pars)\n            ele_url = f\"https://maps.googleapis.com/maps/api/elevation/json?{pars}\"\n\n            err_str = f\"Unable to retrieve elevation for address '{address}'; {{msg}}\"\n            ele_result = _get_json_result(ele_url, err_str=err_str,\n                                          use_google=use_google)\n            height = ele_result[0]['elevation']*u.meter\n\n        else:\n            height = 0.\n\n        return cls.from_geodetic(lon=lon*u.deg, lat=lat*u.deg, height=height)\n\n    @classmethod\n    def get_site_names(cls):\n        \"\"\"\n        Get list of names of observatories for use with\n        `~astropy.coordinates.EarthLocation.of_site`.\n\n        .. note::\n            When this function is called, it will first attempt to\n            download site information from the astropy data server.  If it\n            cannot (i.e., an internet connection is not available), it will fall\n            back on the list included with astropy (which is a limited and dated\n            set of sites).  If you think a site should be added, issue a pull\n            request to the\n            `astropy-data repository <https://github.com/astropy/astropy-data>`_ .\n\n\n        Returns\n        -------\n        names : list of str\n            List of valid observatory names\n\n        See Also\n        --------\n        of_site : Gets the actual location object for one of the sites names\n                  this returns.\n        \"\"\"\n        return cls._get_site_registry().names\n\n    @classmethod\n    def _get_site_registry(cls, force_download=False, force_builtin=False):\n        \"\"\"\n        Gets the site registry.  The first time this either downloads or loads\n        from the data file packaged with astropy.  Subsequent calls will use the\n        cached version unless explicitly overridden.\n\n        Parameters\n        ----------\n        force_download : bool or str\n            If not False, force replacement of the cached registry with a\n            downloaded version. If a str, that will be used as the URL to\n            download from (if just True, the default URL will be used).\n        force_builtin : bool\n            If True, load from the data file bundled with astropy and set the\n            cache to that.\n\n        Returns\n        -------\n        reg : astropy.coordinates.sites.SiteRegistry\n        \"\"\"\n        # need to do this here at the bottom to avoid circular dependencies\n        from .sites import get_builtin_sites, get_downloaded_sites\n\n        if force_builtin and force_download:\n            raise ValueError('Cannot have both force_builtin and force_download True')\n\n        if force_builtin:\n            reg = cls._site_registry = get_builtin_sites()\n        else:\n            reg = getattr(cls, '_site_registry', None)\n            if force_download or not reg:\n                try:\n                    if isinstance(force_download, str):\n                        reg = get_downloaded_sites(force_download)\n                    else:\n                        reg = get_downloaded_sites()\n                except OSError:\n                    if force_download:\n                        raise\n                    msg = ('Could not access the online site list. Falling '\n                           'back on the built-in version, which is rather '\n                           'limited. If you want to retry the download, do '\n                           '{0}._get_site_registry(force_download=True)')\n                    warn(AstropyUserWarning(msg.format(cls.__name__)))\n                    reg = get_builtin_sites()\n                cls._site_registry = reg\n\n        return reg\n\n    @property\n    def ellipsoid(self):\n        \"\"\"The default ellipsoid used to convert to geodetic coordinates.\"\"\"\n        return self._ellipsoid\n\n    @ellipsoid.setter\n    def ellipsoid(self, ellipsoid):\n        self._ellipsoid = _check_ellipsoid(ellipsoid)\n\n    @property\n    def geodetic(self):\n        \"\"\"Convert to geodetic coordinates for the default ellipsoid.\"\"\"\n        return self.to_geodetic()\n\n    def to_geodetic(self, ellipsoid=None):\n        \"\"\"Convert to geodetic coordinates.\n\n        Parameters\n        ----------\n        ellipsoid : str, optional\n            Reference ellipsoid to use.  Default is the one the coordinates\n            were initialized with.  Available are: 'WGS84', 'GRS80', 'WGS72'\n\n        Returns\n        -------\n        lon, lat, height : `~astropy.units.Quantity`\n            The tuple is a ``GeodeticLocation`` namedtuple and is comprised of\n            instances of `~astropy.coordinates.Longitude`,\n            `~astropy.coordinates.Latitude`, and `~astropy.units.Quantity`.\n\n        Raises\n        ------\n        ValueError\n            if ``ellipsoid`` is not recognized as among the ones implemented.\n\n        Notes\n        -----\n        For the conversion to geodetic coordinates, the ERFA routine\n        ``gc2gd`` is used.  See https://github.com/liberfa/erfa\n        \"\"\"\n        ellipsoid = _check_ellipsoid(ellipsoid, default=self.ellipsoid)\n        xyz = self.view(self._array_dtype, u.Quantity)\n        llh = CartesianRepresentation(xyz, xyz_axis=-1, copy=False).represent_as(\n                ELLIPSOIDS[ellipsoid])\n        return GeodeticLocation(\n            Longitude(llh.lon, u.deg, wrap_angle=180*u.deg, copy=False),\n            llh.lat << u.deg, llh.height << self.unit)\n\n    @property\n    def lon(self):\n        \"\"\"Longitude of the location, for the default ellipsoid.\"\"\"\n        return self.geodetic[0]\n\n    @property\n    def lat(self):\n        \"\"\"Latitude of the location, for the default ellipsoid.\"\"\"\n        return self.geodetic[1]\n\n    @property\n    def height(self):\n        \"\"\"Height of the location, for the default ellipsoid.\"\"\"\n        return self.geodetic[2]\n\n    # mostly for symmetry with geodetic and to_geodetic.\n    @property\n    def geocentric(self):\n        \"\"\"Convert to a tuple with X, Y, and Z as quantities\"\"\"\n        return self.to_geocentric()\n\n    def to_geocentric(self):\n        \"\"\"Convert to a tuple with X, Y, and Z as quantities\"\"\"\n        return (self.x, self.y, self.z)\n\n    def get_itrs(self, obstime=None):\n        \"\"\"\n        Generates an `~astropy.coordinates.ITRS` object with the location of\n        this object at the requested ``obstime``.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time` or None\n            The ``obstime`` to apply to the new `~astropy.coordinates.ITRS`, or\n            if None, the default ``obstime`` will be used.\n\n        Returns\n        -------\n        itrs : `~astropy.coordinates.ITRS`\n            The new object in the ITRS frame\n        \"\"\"\n        # Broadcast for a single position at multiple times, but don't attempt\n        # to be more general here.\n        if obstime and self.size == 1 and obstime.shape:\n            self = np.broadcast_to(self, obstime.shape, subok=True)\n\n        # do this here to prevent a series of complicated circular imports\n        from .builtin_frames import ITRS\n        return ITRS(x=self.x, y=self.y, z=self.z, obstime=obstime)\n\n    itrs = property(get_itrs, doc=\"\"\"An `~astropy.coordinates.ITRS` object  with\n                                     for the location of this object at the\n                                     default ``obstime``.\"\"\")\n\n    def get_gcrs(self, obstime):\n        \"\"\"GCRS position with velocity at ``obstime`` as a GCRS coordinate.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time`\n            The ``obstime`` to calculate the GCRS position/velocity at.\n\n        Returns\n        -------\n        gcrs : `~astropy.coordinates.GCRS` instance\n            With velocity included.\n        \"\"\"\n        # do this here to prevent a series of complicated circular imports\n        from .builtin_frames import GCRS\n        loc, vel = self.get_gcrs_posvel(obstime)\n        loc.differentials['s'] = CartesianDifferential.from_cartesian(vel)\n        return GCRS(loc, obstime=obstime)\n\n    def _get_gcrs_posvel(self, obstime, ref_to_itrs, gcrs_to_ref):\n        \"\"\"Calculate GCRS position and velocity given transformation matrices.\n\n        The reference frame z axis must point to the Celestial Intermediate Pole\n        (as is the case for CIRS and TETE).\n\n        This private method is used in intermediate_rotation_transforms,\n        where some of the matrices are already available for the coordinate\n        transformation.\n\n        The method is faster by an order of magnitude than just adding a zero\n        velocity to ITRS and transforming to GCRS, because it avoids calculating\n        the velocity via finite differencing of the results of the transformation\n        at three separate times.\n        \"\"\"\n        # The simplest route is to transform to the reference frame where the\n        # z axis is properly aligned with the Earth's rotation axis (CIRS or\n        # TETE), then calculate the velocity, and then transform this\n        # reference position and velocity to GCRS.  For speed, though, we\n        # transform the coordinates to GCRS in one step, and calculate the\n        # velocities by rotating around the earth's axis transformed to GCRS.\n        ref_to_gcrs = matrix_transpose(gcrs_to_ref)\n        itrs_to_gcrs = ref_to_gcrs @ matrix_transpose(ref_to_itrs)\n        # Earth's rotation vector in the ref frame is rot_vec_ref = (0,0,OMEGA_EARTH),\n        # so in GCRS it is rot_vec_gcrs[..., 2] @ OMEGA_EARTH.\n        rot_vec_gcrs = CartesianRepresentation(ref_to_gcrs[..., 2] * OMEGA_EARTH,\n                                               xyz_axis=-1, copy=False)\n        # Get the position in the GCRS frame.\n        # Since we just need the cartesian representation of ITRS, avoid get_itrs().\n        itrs_cart = CartesianRepresentation(self.x, self.y, self.z, copy=False)\n        pos = itrs_cart.transform(itrs_to_gcrs)\n        vel = rot_vec_gcrs.cross(pos)\n        return pos, vel\n\n    def get_gcrs_posvel(self, obstime):\n        \"\"\"\n        Calculate the GCRS position and velocity of this object at the\n        requested ``obstime``.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time`\n            The ``obstime`` to calculate the GCRS position/velocity at.\n\n        Returns\n        -------\n        obsgeoloc : `~astropy.coordinates.CartesianRepresentation`\n            The GCRS position of the object\n        obsgeovel : `~astropy.coordinates.CartesianRepresentation`\n            The GCRS velocity of the object\n        \"\"\"\n        # Local import to prevent circular imports.\n        from .builtin_frames.intermediate_rotation_transforms import (\n            cirs_to_itrs_mat, gcrs_to_cirs_mat)\n\n        # Get gcrs_posvel by transforming via CIRS (slightly faster than TETE).\n        return self._get_gcrs_posvel(obstime,\n                                     cirs_to_itrs_mat(obstime),\n                                     gcrs_to_cirs_mat(obstime))\n\n    def gravitational_redshift(self, obstime,\n                               bodies=['sun', 'jupiter', 'moon'],\n                               masses={}):\n        \"\"\"Return the gravitational redshift at this EarthLocation.\n\n        Calculates the gravitational redshift, of order 3 m/s, due to the\n        requested solar system bodies.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time`\n            The ``obstime`` to calculate the redshift at.\n\n        bodies : iterable, optional\n            The bodies (other than the Earth) to include in the redshift\n            calculation.  List elements should be any body name\n            `get_body_barycentric` accepts.  Defaults to Jupiter, the Sun, and\n            the Moon.  Earth is always included (because the class represents\n            an *Earth* location).\n\n        masses : dict[str, `~astropy.units.Quantity`], optional\n            The mass or gravitational parameters (G * mass) to assume for the\n            bodies requested in ``bodies``. Can be used to override the\n            defaults for the Sun, Jupiter, the Moon, and the Earth, or to\n            pass in masses for other bodies.\n\n        Returns\n        -------\n        redshift : `~astropy.units.Quantity`\n            Gravitational redshift in velocity units at given obstime.\n        \"\"\"\n        # needs to be here to avoid circular imports\n        from .solar_system import get_body_barycentric\n\n        bodies = list(bodies)\n        # Ensure earth is included and last in the list.\n        if 'earth' in bodies:\n            bodies.remove('earth')\n        bodies.append('earth')\n        _masses = {'sun': consts.GM_sun,\n                   'jupiter': consts.GM_jup,\n                   'moon': consts.G * 7.34767309e22*u.kg,\n                   'earth': consts.GM_earth}\n        _masses.update(masses)\n        GMs = []\n        M_GM_equivalency = (u.kg, u.Unit(consts.G * u.kg))\n        for body in bodies:\n            try:\n                GMs.append(_masses[body].to(u.m**3/u.s**2, [M_GM_equivalency]))\n            except KeyError as err:\n                raise KeyError(f'body \"{body}\" does not have a mass.') from err\n            except u.UnitsError as exc:\n                exc.args += ('\"masses\" argument values must be masses or '\n                             'gravitational parameters.',)\n                raise\n\n        positions = [get_body_barycentric(name, obstime) for name in bodies]\n        # Calculate distances to objects other than earth.\n        distances = [(pos - positions[-1]).norm() for pos in positions[:-1]]\n        # Append distance from Earth's center for Earth's contribution.\n        distances.append(CartesianRepresentation(self.geocentric).norm())\n        # Get redshifts due to all objects.\n        redshifts = [-GM / consts.c / distance for (GM, distance) in\n                     zip(GMs, distances)]\n        # Reverse order of summing, to go from small to big, and to get\n        # \"earth\" first, which gives m/s as unit.\n        return sum(redshifts[::-1])\n\n    @property\n    def x(self):\n        \"\"\"The X component of the geocentric coordinates.\"\"\"\n        return self['x']\n\n    @property\n    def y(self):\n        \"\"\"The Y component of the geocentric coordinates.\"\"\"\n        return self['y']\n\n    @property\n    def z(self):\n        \"\"\"The Z component of the geocentric coordinates.\"\"\"\n        return self['z']\n\n    def __getitem__(self, item):\n        result = super().__getitem__(item)\n        if result.dtype is self.dtype:\n            return result.view(self.__class__)\n        else:\n            return result.view(u.Quantity)\n\n    def __array_finalize__(self, obj):\n        super().__array_finalize__(obj)\n        if hasattr(obj, '_ellipsoid'):\n            self._ellipsoid = obj._ellipsoid\n\n    def __len__(self):\n        if self.shape == ():\n            raise IndexError('0-d EarthLocation arrays cannot be indexed')\n        else:\n            return super().__len__()\n\n    def _to_value(self, unit, equivalencies=[]):\n        \"\"\"Helper method for to and to_value.\"\"\"\n        # Conversion to another unit in both ``to`` and ``to_value`` goes\n        # via this routine. To make the regular quantity routines work, we\n        # temporarily turn the structured array into a regular one.\n        array_view = self.view(self._array_dtype, np.ndarray)\n        if equivalencies == []:\n            equivalencies = self._equivalencies\n        new_array = self.unit.to(unit, array_view, equivalencies=equivalencies)\n        return new_array.view(self.dtype).reshape(self.shape)"},{"className":"Quantity","col":0,"comment":"A `~astropy.units.Quantity` represents a number with some associated unit.\n\n    See also: https://docs.astropy.org/en/stable/units/quantity.html\n\n    Parameters\n    ----------\n    value : number, `~numpy.ndarray`, `~astropy.units.Quantity` (sequence), or str\n        The numerical value of this quantity in the units given by unit.  If a\n        `Quantity` or sequence of them (or any other valid object with a\n        ``unit`` attribute), creates a new `Quantity` object, converting to\n        `unit` units as needed.  If a string, it is converted to a number or\n        `Quantity`, depending on whether a unit is present.\n\n    unit : unit-like\n        An object that represents the unit associated with the input value.\n        Must be an `~astropy.units.UnitBase` object or a string parseable by\n        the :mod:`~astropy.units` package.\n\n    dtype : ~numpy.dtype, optional\n        The dtype of the resulting Numpy array or scalar that will\n        hold the value.  If not provided, it is determined from the input,\n        except that any integer and (non-Quantity) object inputs are converted\n        to float by default.\n\n    copy : bool, optional\n        If `True` (default), then the value is copied.  Otherwise, a copy will\n        only be made if ``__array__`` returns a copy, if value is a nested\n        sequence, or if a copy is needed to satisfy an explicitly given\n        ``dtype``.  (The `False` option is intended mostly for internal use,\n        to speed up initialization where a copy is known to have been made.\n        Use with care.)\n\n    order : {'C', 'F', 'A'}, optional\n        Specify the order of the array.  As in `~numpy.array`.  This parameter\n        is ignored if the input is a `Quantity` and ``copy=False``.\n\n    subok : bool, optional\n        If `False` (default), the returned array will be forced to be a\n        `Quantity`.  Otherwise, `Quantity` subclasses will be passed through,\n        or a subclass appropriate for the unit will be used (such as\n        `~astropy.units.Dex` for ``u.dex(u.AA)``).\n\n    ndmin : int, optional\n        Specifies the minimum number of dimensions that the resulting array\n        should have.  Ones will be pre-pended to the shape as needed to meet\n        this requirement.  This parameter is ignored if the input is a\n        `Quantity` and ``copy=False``.\n\n    Raises\n    ------\n    TypeError\n        If the value provided is not a Python numeric type.\n    TypeError\n        If the unit provided is not either a :class:`~astropy.units.Unit`\n        object or a parseable string unit.\n\n    Notes\n    -----\n    Quantities can also be created by multiplying a number or array with a\n    :class:`~astropy.units.Unit`. See https://docs.astropy.org/en/latest/units/\n\n    Unless the ``dtype`` argument is explicitly specified, integer\n    or (non-Quantity) object inputs are converted to `float` by default.\n    ","endLoc":1873,"id":1331,"nodeType":"Class","startLoc":239,"text":"class Quantity(np.ndarray):\n    \"\"\"A `~astropy.units.Quantity` represents a number with some associated unit.\n\n    See also: https://docs.astropy.org/en/stable/units/quantity.html\n\n    Parameters\n    ----------\n    value : number, `~numpy.ndarray`, `~astropy.units.Quantity` (sequence), or str\n        The numerical value of this quantity in the units given by unit.  If a\n        `Quantity` or sequence of them (or any other valid object with a\n        ``unit`` attribute), creates a new `Quantity` object, converting to\n        `unit` units as needed.  If a string, it is converted to a number or\n        `Quantity`, depending on whether a unit is present.\n\n    unit : unit-like\n        An object that represents the unit associated with the input value.\n        Must be an `~astropy.units.UnitBase` object or a string parseable by\n        the :mod:`~astropy.units` package.\n\n    dtype : ~numpy.dtype, optional\n        The dtype of the resulting Numpy array or scalar that will\n        hold the value.  If not provided, it is determined from the input,\n        except that any integer and (non-Quantity) object inputs are converted\n        to float by default.\n\n    copy : bool, optional\n        If `True` (default), then the value is copied.  Otherwise, a copy will\n        only be made if ``__array__`` returns a copy, if value is a nested\n        sequence, or if a copy is needed to satisfy an explicitly given\n        ``dtype``.  (The `False` option is intended mostly for internal use,\n        to speed up initialization where a copy is known to have been made.\n        Use with care.)\n\n    order : {'C', 'F', 'A'}, optional\n        Specify the order of the array.  As in `~numpy.array`.  This parameter\n        is ignored if the input is a `Quantity` and ``copy=False``.\n\n    subok : bool, optional\n        If `False` (default), the returned array will be forced to be a\n        `Quantity`.  Otherwise, `Quantity` subclasses will be passed through,\n        or a subclass appropriate for the unit will be used (such as\n        `~astropy.units.Dex` for ``u.dex(u.AA)``).\n\n    ndmin : int, optional\n        Specifies the minimum number of dimensions that the resulting array\n        should have.  Ones will be pre-pended to the shape as needed to meet\n        this requirement.  This parameter is ignored if the input is a\n        `Quantity` and ``copy=False``.\n\n    Raises\n    ------\n    TypeError\n        If the value provided is not a Python numeric type.\n    TypeError\n        If the unit provided is not either a :class:`~astropy.units.Unit`\n        object or a parseable string unit.\n\n    Notes\n    -----\n    Quantities can also be created by multiplying a number or array with a\n    :class:`~astropy.units.Unit`. See https://docs.astropy.org/en/latest/units/\n\n    Unless the ``dtype`` argument is explicitly specified, integer\n    or (non-Quantity) object inputs are converted to `float` by default.\n    \"\"\"\n    # Need to set a class-level default for _equivalencies, or\n    # Constants can not initialize properly\n    _equivalencies = []\n\n    # Default unit for initialization; can be overridden by subclasses,\n    # possibly to `None` to indicate there is no default unit.\n    _default_unit = dimensionless_unscaled\n\n    # Ensures views have an undefined unit.\n    _unit = None\n\n    __array_priority__ = 10000\n\n    def __class_getitem__(cls, unit_shape_dtype):\n        \"\"\"Quantity Type Hints.\n\n        Unit-aware type hints are ``Annotated`` objects that encode the class,\n        the unit, and possibly shape and dtype information, depending on the\n        python and :mod:`numpy` versions.\n\n        Schematically, ``Annotated[cls[shape, dtype], unit]``\n\n        As a classmethod, the type is the class, ie ``Quantity``\n        produces an ``Annotated[Quantity, ...]`` while a subclass\n        like :class:`~astropy.coordinates.Angle` returns\n        ``Annotated[Angle, ...]``.\n\n        Parameters\n        ----------\n        unit_shape_dtype : :class:`~astropy.units.UnitBase`, str, `~astropy.units.PhysicalType`, or tuple\n            Unit specification, can be the physical type (ie str or class).\n            If tuple, then the first element is the unit specification\n            and all other elements are for `numpy.ndarray` type annotations.\n            Whether they are included depends on the python and :mod:`numpy`\n            versions.\n\n        Returns\n        -------\n        `typing.Annotated`, `typing_extensions.Annotated`, `astropy.units.Unit`, or `astropy.units.PhysicalType`\n            Return type in this preference order:\n            * if python v3.9+ : `typing.Annotated`\n            * if :mod:`typing_extensions` is installed : `typing_extensions.Annotated`\n            * `astropy.units.Unit` or `astropy.units.PhysicalType`\n\n        Raises\n        ------\n        TypeError\n            If the unit/physical_type annotation is not Unit-like or\n            PhysicalType-like.\n\n        Examples\n        --------\n        Create a unit-aware Quantity type annotation\n\n            >>> Quantity[Unit(\"s\")]\n            Annotated[Quantity, Unit(\"s\")]\n\n        See Also\n        --------\n        `~astropy.units.quantity_input`\n            Use annotations for unit checks on function arguments and results.\n\n        Notes\n        -----\n        With Python 3.9+ or :mod:`typing_extensions`, |Quantity| types are also\n        static-type compatible.\n        \"\"\"\n        # LOCAL\n        from ._typing import HAS_ANNOTATED, Annotated\n\n        # process whether [unit] or [unit, shape, ptype]\n        if isinstance(unit_shape_dtype, tuple):  # unit, shape, dtype\n            target = unit_shape_dtype[0]\n            shape_dtype = unit_shape_dtype[1:]\n        else:  # just unit\n            target = unit_shape_dtype\n            shape_dtype = ()\n\n        # Allowed unit/physical types. Errors if neither.\n        try:\n            unit = Unit(target)\n        except (TypeError, ValueError):\n            from astropy.units.physical import get_physical_type\n\n            try:\n                unit = get_physical_type(target)\n            except (TypeError, ValueError, KeyError):  # KeyError for Enum\n                raise TypeError(\"unit annotation is not a Unit or PhysicalType\") from None\n\n        # Allow to sort of work for python 3.8- / no typing_extensions\n        # instead of bailing out, return the unit for `quantity_input`\n        if not HAS_ANNOTATED:\n            warnings.warn(\"Quantity annotations are valid static type annotations only\"\n                          \" if Python is v3.9+ or `typing_extensions` is installed.\")\n            return unit\n\n        # Quantity does not (yet) properly extend the NumPy generics types,\n        # introduced in numpy v1.22+, instead just including the unit info as\n        # metadata using Annotated.\n        # TODO: ensure we do interact with NDArray.__class_getitem__.\n        return Annotated.__class_getitem__((cls, unit))\n\n    def __new__(cls, value, unit=None, dtype=None, copy=True, order=None,\n                subok=False, ndmin=0):\n\n        if unit is not None:\n            # convert unit first, to avoid multiple string->unit conversions\n            unit = Unit(unit)\n\n        # optimize speed for Quantity with no dtype given, copy=False\n        if isinstance(value, Quantity):\n            if unit is not None and unit is not value.unit:\n                value = value.to(unit)\n                # the above already makes a copy (with float dtype)\n                copy = False\n\n            if type(value) is not cls and not (subok and\n                                               isinstance(value, cls)):\n                value = value.view(cls)\n\n            if dtype is None and value.dtype.kind in 'iu':\n                dtype = float\n\n            return np.array(value, dtype=dtype, copy=copy, order=order,\n                            subok=True, ndmin=ndmin)\n\n        # Maybe str, or list/tuple of Quantity? If so, this may set value_unit.\n        # To ensure array remains fast, we short-circuit it.\n        value_unit = None\n        if not isinstance(value, np.ndarray):\n            if isinstance(value, str):\n                # The first part of the regex string matches any integer/float;\n                # the second parts adds possible trailing .+-, which will break\n                # the float function below and ensure things like 1.2.3deg\n                # will not work.\n                pattern = (r'\\s*[+-]?'\n                           r'((\\d+\\.?\\d*)|(\\.\\d+)|([nN][aA][nN])|'\n                           r'([iI][nN][fF]([iI][nN][iI][tT][yY]){0,1}))'\n                           r'([eE][+-]?\\d+)?'\n                           r'[.+-]?')\n\n                v = re.match(pattern, value)\n                unit_string = None\n                try:\n                    value = float(v.group())\n\n                except Exception:\n                    raise TypeError('Cannot parse \"{}\" as a {}. It does not '\n                                    'start with a number.'\n                                    .format(value, cls.__name__))\n\n                unit_string = v.string[v.end():].strip()\n                if unit_string:\n                    value_unit = Unit(unit_string)\n                    if unit is None:\n                        unit = value_unit  # signal no conversion needed below.\n\n            elif isiterable(value) and len(value) > 0:\n                # Iterables like lists and tuples.\n                if all(isinstance(v, Quantity) for v in value):\n                    # If a list/tuple containing only quantities, convert all\n                    # to the same unit.\n                    if unit is None:\n                        unit = value[0].unit\n                    value = [q.to_value(unit) for q in value]\n                    value_unit = unit  # signal below that conversion has been done\n                elif (dtype is None and not hasattr(value, 'dtype')\n                      and isinstance(unit, StructuredUnit)):\n                    # Special case for list/tuple of values and a structured unit:\n                    # ``np.array(value, dtype=None)`` would treat tuples as lower\n                    # levels of the array, rather than as elements of a structured\n                    # array, so we use the structure of the unit to help infer the\n                    # structured dtype of the value.\n                    dtype = unit._recursively_get_dtype(value)\n\n        if value_unit is None:\n            # If the value has a `unit` attribute and if not None\n            # (for Columns with uninitialized unit), treat it like a quantity.\n            value_unit = getattr(value, 'unit', None)\n            if value_unit is None:\n                # Default to dimensionless for no (initialized) unit attribute.\n                if unit is None:\n                    unit = cls._default_unit\n                value_unit = unit  # signal below that no conversion is needed\n            else:\n                try:\n                    value_unit = Unit(value_unit)\n                except Exception as exc:\n                    raise TypeError(\"The unit attribute {!r} of the input could \"\n                                    \"not be parsed as an astropy Unit, raising \"\n                                    \"the following exception:\\n{}\"\n                                    .format(value.unit, exc))\n\n                if unit is None:\n                    unit = value_unit\n                elif unit is not value_unit:\n                    copy = False  # copy will be made in conversion at end\n\n        value = np.array(value, dtype=dtype, copy=copy, order=order,\n                         subok=True, ndmin=ndmin)\n\n        # check that array contains numbers or long int objects\n        if (value.dtype.kind in 'OSU' and\n            not (value.dtype.kind == 'O' and\n                 isinstance(value.item(0), numbers.Number))):\n            raise TypeError(\"The value must be a valid Python or \"\n                            \"Numpy numeric type.\")\n\n        # by default, cast any integer, boolean, etc., to float\n        if dtype is None and value.dtype.kind in 'iuO':\n            value = value.astype(float)\n\n        # if we allow subclasses, allow a class from the unit.\n        if subok:\n            qcls = getattr(unit, '_quantity_class', cls)\n            if issubclass(qcls, cls):\n                cls = qcls\n\n        value = value.view(cls)\n        value._set_unit(value_unit)\n        if unit is value_unit:\n            return value\n        else:\n            # here we had non-Quantity input that had a \"unit\" attribute\n            # with a unit different from the desired one.  So, convert.\n            return value.to(unit)\n\n    def __array_finalize__(self, obj):\n        # Check whether super().__array_finalize should be called\n        # (sadly, ndarray.__array_finalize__ is None; we cannot be sure\n        # what is above us).\n        super_array_finalize = super().__array_finalize__\n        if super_array_finalize is not None:\n            super_array_finalize(obj)\n\n        # If we're a new object or viewing an ndarray, nothing has to be done.\n        if obj is None or obj.__class__ is np.ndarray:\n            return\n\n        # If our unit is not set and obj has a valid one, use it.\n        if self._unit is None:\n            unit = getattr(obj, '_unit', None)\n            if unit is not None:\n                self._set_unit(unit)\n\n        # Copy info if the original had `info` defined.  Because of the way the\n        # DataInfo works, `'info' in obj.__dict__` is False until the\n        # `info` attribute is accessed or set.\n        if 'info' in obj.__dict__:\n            self.info = obj.info\n\n    def __array_wrap__(self, obj, context=None):\n\n        if context is None:\n            # Methods like .squeeze() created a new `ndarray` and then call\n            # __array_wrap__ to turn the array into self's subclass.\n            return self._new_view(obj)\n\n        raise NotImplementedError('__array_wrap__ should not be used '\n                                  'with a context any more since all use '\n                                  'should go through array_function. '\n                                  'Please raise an issue on '\n                                  'https://github.com/astropy/astropy')\n\n    def __array_ufunc__(self, function, method, *inputs, **kwargs):\n        \"\"\"Wrap numpy ufuncs, taking care of units.\n\n        Parameters\n        ----------\n        function : callable\n            ufunc to wrap.\n        method : str\n            Ufunc method: ``__call__``, ``at``, ``reduce``, etc.\n        inputs : tuple\n            Input arrays.\n        kwargs : keyword arguments\n            As passed on, with ``out`` containing possible quantity output.\n\n        Returns\n        -------\n        result : `~astropy.units.Quantity`\n            Results of the ufunc, with the unit set properly.\n        \"\"\"\n        # Determine required conversion functions -- to bring the unit of the\n        # input to that expected (e.g., radian for np.sin), or to get\n        # consistent units between two inputs (e.g., in np.add) --\n        # and the unit of the result (or tuple of units for nout > 1).\n        converters, unit = converters_and_unit(function, method, *inputs)\n\n        out = kwargs.get('out', None)\n        # Avoid loop back by turning any Quantity output into array views.\n        if out is not None:\n            # If pre-allocated output is used, check it is suitable.\n            # This also returns array view, to ensure we don't loop back.\n            if function.nout == 1:\n                out = out[0]\n            out_array = check_output(out, unit, inputs, function=function)\n            # Ensure output argument remains a tuple.\n            kwargs['out'] = (out_array,) if function.nout == 1 else out_array\n\n        # Same for inputs, but here also convert if necessary.\n        arrays = []\n        for input_, converter in zip(inputs, converters):\n            input_ = getattr(input_, 'value', input_)\n            arrays.append(converter(input_) if converter else input_)\n\n        # Call our superclass's __array_ufunc__\n        result = super().__array_ufunc__(function, method, *arrays, **kwargs)\n        # If unit is None, a plain array is expected (e.g., comparisons), which\n        # means we're done.\n        # We're also done if the result was None (for method 'at') or\n        # NotImplemented, which can happen if other inputs/outputs override\n        # __array_ufunc__; hopefully, they can then deal with us.\n        if unit is None or result is None or result is NotImplemented:\n            return result\n\n        return self._result_as_quantity(result, unit, out)\n\n    def _result_as_quantity(self, result, unit, out):\n        \"\"\"Turn result into a quantity with the given unit.\n\n        If no output is given, it will take a view of the array as a quantity,\n        and set the unit.  If output is given, those should be quantity views\n        of the result arrays, and the function will just set the unit.\n\n        Parameters\n        ----------\n        result : ndarray or tuple thereof\n            Array(s) which need to be turned into quantity.\n        unit : `~astropy.units.Unit`\n            Unit for the quantities to be returned (or `None` if the result\n            should not be a quantity).  Should be tuple if result is a tuple.\n        out : `~astropy.units.Quantity` or None\n            Possible output quantity. Should be `None` or a tuple if result\n            is a tuple.\n\n        Returns\n        -------\n        out : `~astropy.units.Quantity`\n           With units set.\n        \"\"\"\n        if isinstance(result, (tuple, list)):\n            if out is None:\n                out = (None,) * len(result)\n            return result.__class__(\n                self._result_as_quantity(result_, unit_, out_)\n                for (result_, unit_, out_) in\n                zip(result, unit, out))\n\n        if out is None:\n            # View the result array as a Quantity with the proper unit.\n            return result if unit is None else self._new_view(result, unit)\n\n        # For given output, just set the unit. We know the unit is not None and\n        # the output is of the correct Quantity subclass, as it was passed\n        # through check_output.\n        out._set_unit(unit)\n        return out\n\n    def __quantity_subclass__(self, unit):\n        \"\"\"\n        Overridden by subclasses to change what kind of view is\n        created based on the output unit of an operation.\n\n        Parameters\n        ----------\n        unit : UnitBase\n            The unit for which the appropriate class should be returned\n\n        Returns\n        -------\n        tuple :\n            - `~astropy.units.Quantity` subclass\n            - bool: True if subclasses of the given class are ok\n        \"\"\"\n        return Quantity, True\n\n    def _new_view(self, obj=None, unit=None):\n        \"\"\"\n        Create a Quantity view of some array-like input, and set the unit\n\n        By default, return a view of ``obj`` of the same class as ``self`` and\n        with the same unit.  Subclasses can override the type of class for a\n        given unit using ``__quantity_subclass__``, and can ensure properties\n        other than the unit are copied using ``__array_finalize__``.\n\n        If the given unit defines a ``_quantity_class`` of which ``self``\n        is not an instance, a view using this class is taken.\n\n        Parameters\n        ----------\n        obj : ndarray or scalar, optional\n            The array to create a view of.  If obj is a numpy or python scalar,\n            it will be converted to an array scalar.  By default, ``self``\n            is converted.\n\n        unit : unit-like, optional\n            The unit of the resulting object.  It is used to select a\n            subclass, and explicitly assigned to the view if given.\n            If not given, the subclass and unit will be that of ``self``.\n\n        Returns\n        -------\n        view : `~astropy.units.Quantity` subclass\n        \"\"\"\n        # Determine the unit and quantity subclass that we need for the view.\n        if unit is None:\n            unit = self.unit\n            quantity_subclass = self.__class__\n        elif unit is self.unit and self.__class__ is Quantity:\n            # The second part is because we should not presume what other\n            # classes want to do for the same unit.  E.g., Constant will\n            # always want to fall back to Quantity, and relies on going\n            # through `__quantity_subclass__`.\n            quantity_subclass = Quantity\n        else:\n            unit = Unit(unit)\n            quantity_subclass = getattr(unit, '_quantity_class', Quantity)\n            if isinstance(self, quantity_subclass):\n                quantity_subclass, subok = self.__quantity_subclass__(unit)\n                if subok:\n                    quantity_subclass = self.__class__\n\n        # We only want to propagate information from ``self`` to our new view,\n        # so obj should be a regular array.  By using ``np.array``, we also\n        # convert python and numpy scalars, which cannot be viewed as arrays\n        # and thus not as Quantity either, to zero-dimensional arrays.\n        # (These are turned back into scalar in `.value`)\n        # Note that for an ndarray input, the np.array call takes only double\n        # ``obj.__class is np.ndarray``. So, not worth special-casing.\n        if obj is None:\n            obj = self.view(np.ndarray)\n        else:\n            obj = np.array(obj, copy=False, subok=True)\n\n        # Take the view, set the unit, and update possible other properties\n        # such as ``info``, ``wrap_angle`` in `Longitude`, etc.\n        view = obj.view(quantity_subclass)\n        view._set_unit(unit)\n        view.__array_finalize__(self)\n        return view\n\n    def _set_unit(self, unit):\n        \"\"\"Set the unit.\n\n        This is used anywhere the unit is set or modified, i.e., in the\n        initilizer, in ``__imul__`` and ``__itruediv__`` for in-place\n        multiplication and division by another unit, as well as in\n        ``__array_finalize__`` for wrapping up views.  For Quantity, it just\n        sets the unit, but subclasses can override it to check that, e.g.,\n        a unit is consistent.\n        \"\"\"\n        if not isinstance(unit, UnitBase):\n            if (isinstance(self._unit, StructuredUnit)\n                    or isinstance(unit, StructuredUnit)):\n                unit = StructuredUnit(unit, self.dtype)\n            else:\n                # Trying to go through a string ensures that, e.g., Magnitudes with\n                # dimensionless physical unit become Quantity with units of mag.\n                unit = Unit(str(unit), parse_strict='silent')\n                if not isinstance(unit, (UnitBase, StructuredUnit)):\n                    raise UnitTypeError(\n                        \"{} instances require normal units, not {} instances.\"\n                        .format(type(self).__name__, type(unit)))\n\n        self._unit = unit\n\n    def __deepcopy__(self, memo):\n        # If we don't define this, ``copy.deepcopy(quantity)`` will\n        # return a bare Numpy array.\n        return self.copy()\n\n    def __reduce__(self):\n        # patch to pickle Quantity objects (ndarray subclasses), see\n        # http://www.mail-archive.com/numpy-discussion@scipy.org/msg02446.html\n\n        object_state = list(super().__reduce__())\n        object_state[2] = (object_state[2], self.__dict__)\n        return tuple(object_state)\n\n    def __setstate__(self, state):\n        # patch to unpickle Quantity objects (ndarray subclasses), see\n        # http://www.mail-archive.com/numpy-discussion@scipy.org/msg02446.html\n\n        nd_state, own_state = state\n        super().__setstate__(nd_state)\n        self.__dict__.update(own_state)\n\n    info = QuantityInfo()\n\n    def _to_value(self, unit, equivalencies=[]):\n        \"\"\"Helper method for to and to_value.\"\"\"\n        if equivalencies == []:\n            equivalencies = self._equivalencies\n        if not self.dtype.names or isinstance(self.unit, StructuredUnit):\n            # Standard path, let unit to do work.\n            return self.unit.to(unit, self.view(np.ndarray),\n                                equivalencies=equivalencies)\n\n        else:\n            # The .to() method of a simple unit cannot convert a structured\n            # dtype, so we work around it, by recursing.\n            # TODO: deprecate this?\n            # Convert simple to Structured on initialization?\n            result = np.empty_like(self.view(np.ndarray))\n            for name in self.dtype.names:\n                result[name] = self[name]._to_value(unit, equivalencies)\n            return result\n\n    def to(self, unit, equivalencies=[], copy=True):\n        \"\"\"\n        Return a new `~astropy.units.Quantity` object with the specified unit.\n\n        Parameters\n        ----------\n        unit : unit-like\n            An object that represents the unit to convert to. Must be\n            an `~astropy.units.UnitBase` object or a string parseable\n            by the `~astropy.units` package.\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            If not provided or ``[]``, class default equivalencies will be used\n            (none for `~astropy.units.Quantity`, but may be set for subclasses)\n            If `None`, no equivalencies will be applied at all, not even any\n            set globally or within a context.\n\n        copy : bool, optional\n            If `True` (default), then the value is copied.  Otherwise, a copy\n            will only be made if necessary.\n\n        See also\n        --------\n        to_value : get the numerical value in a given unit.\n        \"\"\"\n        # We don't use `to_value` below since we always want to make a copy\n        # and don't want to slow down this method (esp. the scalar case).\n        unit = Unit(unit)\n        if copy:\n            # Avoid using to_value to ensure that we make a copy. We also\n            # don't want to slow down this method (esp. the scalar case).\n            value = self._to_value(unit, equivalencies)\n        else:\n            # to_value only copies if necessary\n            value = self.to_value(unit, equivalencies)\n        return self._new_view(value, unit)\n\n    def to_value(self, unit=None, equivalencies=[]):\n        \"\"\"\n        The numerical value, possibly in a different unit.\n\n        Parameters\n        ----------\n        unit : unit-like, optional\n            The unit in which the value should be given. If not given or `None`,\n            use the current unit.\n\n        equivalencies : list of tuple, optional\n            A list of equivalence pairs to try if the units are not directly\n            convertible (see :ref:`astropy:unit_equivalencies`). If not provided\n            or ``[]``, class default equivalencies will be used (none for\n            `~astropy.units.Quantity`, but may be set for subclasses).\n            If `None`, no equivalencies will be applied at all, not even any\n            set globally or within a context.\n\n        Returns\n        -------\n        value : ndarray or scalar\n            The value in the units specified. For arrays, this will be a view\n            of the data if no unit conversion was necessary.\n\n        See also\n        --------\n        to : Get a new instance in a different unit.\n        \"\"\"\n        if unit is None or unit is self.unit:\n            value = self.view(np.ndarray)\n        elif not self.dtype.names:\n            # For non-structured, we attempt a short-cut, where we just get\n            # the scale.  If that is 1, we do not have to do anything.\n            unit = Unit(unit)\n            # We want a view if the unit does not change.  One could check\n            # with \"==\", but that calculates the scale that we need anyway.\n            # TODO: would be better for `unit.to` to have an in-place flag.\n            try:\n                scale = self.unit._to(unit)\n            except Exception:\n                # Short-cut failed; try default (maybe equivalencies help).\n                value = self._to_value(unit, equivalencies)\n            else:\n                value = self.view(np.ndarray)\n                if not is_effectively_unity(scale):\n                    # not in-place!\n                    value = value * scale\n        else:\n            # For structured arrays, we go the default route.\n            value = self._to_value(unit, equivalencies)\n\n        # Index with empty tuple to decay array scalars in to numpy scalars.\n        return value if value.shape else value[()]\n\n    value = property(to_value,\n                     doc=\"\"\"The numerical value of this instance.\n\n    See also\n    --------\n    to_value : Get the numerical value in a given unit.\n    \"\"\")\n\n    @property\n    def unit(self):\n        \"\"\"\n        A `~astropy.units.UnitBase` object representing the unit of this\n        quantity.\n        \"\"\"\n\n        return self._unit\n\n    @property\n    def equivalencies(self):\n        \"\"\"\n        A list of equivalencies that will be applied by default during\n        unit conversions.\n        \"\"\"\n\n        return self._equivalencies\n\n    def _recursively_apply(self, func):\n        \"\"\"Apply function recursively to every field.\n\n        Returns a copy with the result.\n        \"\"\"\n        result = np.empty_like(self)\n        result_value = result.view(np.ndarray)\n        result_unit = ()\n        for name in self.dtype.names:\n            part = func(self[name])\n            result_value[name] = part.value\n            result_unit += (part.unit,)\n\n        result._set_unit(result_unit)\n        return result\n\n    @property\n    def si(self):\n        \"\"\"\n        Returns a copy of the current `Quantity` instance with SI units. The\n        value of the resulting object will be scaled.\n        \"\"\"\n        if self.dtype.names:\n            return self._recursively_apply(operator.attrgetter('si'))\n        si_unit = self.unit.si\n        return self._new_view(self.value * si_unit.scale,\n                              si_unit / si_unit.scale)\n\n    @property\n    def cgs(self):\n        \"\"\"\n        Returns a copy of the current `Quantity` instance with CGS units. The\n        value of the resulting object will be scaled.\n        \"\"\"\n        if self.dtype.names:\n            return self._recursively_apply(operator.attrgetter('cgs'))\n        cgs_unit = self.unit.cgs\n        return self._new_view(self.value * cgs_unit.scale,\n                              cgs_unit / cgs_unit.scale)\n\n    @property\n    def isscalar(self):\n        \"\"\"\n        True if the `value` of this quantity is a scalar, or False if it\n        is an array-like object.\n\n        .. note::\n            This is subtly different from `numpy.isscalar` in that\n            `numpy.isscalar` returns False for a zero-dimensional array\n            (e.g. ``np.array(1)``), while this is True for quantities,\n            since quantities cannot represent true numpy scalars.\n        \"\"\"\n        return not self.shape\n\n    # This flag controls whether convenience conversion members, such\n    # as `q.m` equivalent to `q.to_value(u.m)` are available.  This is\n    # not turned on on Quantity itself, but is on some subclasses of\n    # Quantity, such as `astropy.coordinates.Angle`.\n    _include_easy_conversion_members = False\n\n    @override__dir__\n    def __dir__(self):\n        \"\"\"\n        Quantities are able to directly convert to other units that\n        have the same physical type.  This function is implemented in\n        order to make autocompletion still work correctly in IPython.\n        \"\"\"\n        if not self._include_easy_conversion_members:\n            return []\n        extra_members = set()\n        equivalencies = Unit._normalize_equivalencies(self.equivalencies)\n        for equivalent in self.unit._get_units_with_same_physical_type(\n                equivalencies):\n            extra_members.update(equivalent.names)\n        return extra_members\n\n    def __getattr__(self, attr):\n        \"\"\"\n        Quantities are able to directly convert to other units that\n        have the same physical type.\n        \"\"\"\n        if not self._include_easy_conversion_members:\n            raise AttributeError(\n                f\"'{self.__class__.__name__}' object has no '{attr}' member\")\n\n        def get_virtual_unit_attribute():\n            registry = get_current_unit_registry().registry\n            to_unit = registry.get(attr, None)\n            if to_unit is None:\n                return None\n\n            try:\n                return self.unit.to(\n                    to_unit, self.value, equivalencies=self.equivalencies)\n            except UnitsError:\n                return None\n\n        value = get_virtual_unit_attribute()\n\n        if value is None:\n            raise AttributeError(\n                f\"{self.__class__.__name__} instance has no attribute '{attr}'\")\n        else:\n            return value\n\n    # Equality needs to be handled explicitly as ndarray.__eq__ gives\n    # DeprecationWarnings on any error, which is distracting, and does not\n    # deal well with structured arrays (nor does the ufunc).\n    def __eq__(self, other):\n        try:\n            other_value = self._to_own_unit(other)\n        except UnitsError:\n            return False\n        except Exception:\n            return NotImplemented\n        return self.value.__eq__(other_value)\n\n    def __ne__(self, other):\n        try:\n            other_value = self._to_own_unit(other)\n        except UnitsError:\n            return True\n        except Exception:\n            return NotImplemented\n        return self.value.__ne__(other_value)\n\n    # Unit conversion operator (<<).\n    def __lshift__(self, other):\n        try:\n            other = Unit(other, parse_strict='silent')\n        except UnitTypeError:\n            return NotImplemented\n\n        return self.__class__(self, other, copy=False, subok=True)\n\n    def __ilshift__(self, other):\n        try:\n            other = Unit(other, parse_strict='silent')\n        except UnitTypeError:\n            return NotImplemented\n\n        try:\n            factor = self.unit._to(other)\n        except Exception:\n            # Maybe via equivalencies?  Now we do make a temporary copy.\n            try:\n                value = self._to_value(other)\n            except UnitConversionError:\n                return NotImplemented\n\n            self.view(np.ndarray)[...] = value\n\n        else:\n            self.view(np.ndarray)[...] *= factor\n\n        self._set_unit(other)\n        return self\n\n    def __rlshift__(self, other):\n        if not self.isscalar:\n            return NotImplemented\n        return Unit(self).__rlshift__(other)\n\n    # Give warning for other >> self, since probably other << self was meant.\n    def __rrshift__(self, other):\n        warnings.warn(\">> is not implemented. Did you mean to convert \"\n                      \"something to this quantity as a unit using '<<'?\",\n                      AstropyWarning)\n        return NotImplemented\n\n    # Also define __rshift__ and __irshift__ so we override default ndarray\n    # behaviour, but instead of emitting a warning here, let it be done by\n    # other (which likely is a unit if this was a mistake).\n    def __rshift__(self, other):\n        return NotImplemented\n\n    def __irshift__(self, other):\n        return NotImplemented\n\n    # Arithmetic operations\n    def __mul__(self, other):\n        \"\"\" Multiplication between `Quantity` objects and other objects.\"\"\"\n\n        if isinstance(other, (UnitBase, str)):\n            try:\n                return self._new_view(self.copy(), other * self.unit)\n            except UnitsError:  # let other try to deal with it\n                return NotImplemented\n\n        return super().__mul__(other)\n\n    def __imul__(self, other):\n        \"\"\"In-place multiplication between `Quantity` objects and others.\"\"\"\n\n        if isinstance(other, (UnitBase, str)):\n            self._set_unit(other * self.unit)\n            return self\n\n        return super().__imul__(other)\n\n    def __rmul__(self, other):\n        \"\"\" Right Multiplication between `Quantity` objects and other\n        objects.\n        \"\"\"\n\n        return self.__mul__(other)\n\n    def __truediv__(self, other):\n        \"\"\" Division between `Quantity` objects and other objects.\"\"\"\n\n        if isinstance(other, (UnitBase, str)):\n            try:\n                return self._new_view(self.copy(), self.unit / other)\n            except UnitsError:  # let other try to deal with it\n                return NotImplemented\n\n        return super().__truediv__(other)\n\n    def __itruediv__(self, other):\n        \"\"\"Inplace division between `Quantity` objects and other objects.\"\"\"\n\n        if isinstance(other, (UnitBase, str)):\n            self._set_unit(self.unit / other)\n            return self\n\n        return super().__itruediv__(other)\n\n    def __rtruediv__(self, other):\n        \"\"\" Right Division between `Quantity` objects and other objects.\"\"\"\n\n        if isinstance(other, (UnitBase, str)):\n            return self._new_view(1. / self.value, other / self.unit)\n\n        return super().__rtruediv__(other)\n\n    def __pow__(self, other):\n        if isinstance(other, Fraction):\n            # Avoid getting object arrays by raising the value to a Fraction.\n            return self._new_view(self.value ** float(other),\n                                  self.unit ** other)\n\n        return super().__pow__(other)\n\n    # other overrides of special functions\n    def __hash__(self):\n        return hash(self.value) ^ hash(self.unit)\n\n    def __iter__(self):\n        if self.isscalar:\n            raise TypeError(\n                \"'{cls}' object with a scalar value is not iterable\"\n                .format(cls=self.__class__.__name__))\n\n        # Otherwise return a generator\n        def quantity_iter():\n            for val in self.value:\n                yield self._new_view(val)\n\n        return quantity_iter()\n\n    def __getitem__(self, key):\n        if isinstance(key, str) and isinstance(self.unit, StructuredUnit):\n            return self._new_view(self.view(np.ndarray)[key], self.unit[key])\n\n        try:\n            out = super().__getitem__(key)\n        except IndexError:\n            # We want zero-dimensional Quantity objects to behave like scalars,\n            # so they should raise a TypeError rather than an IndexError.\n            if self.isscalar:\n                raise TypeError(\n                    \"'{cls}' object with a scalar value does not support \"\n                    \"indexing\".format(cls=self.__class__.__name__))\n            else:\n                raise\n        # For single elements, ndarray.__getitem__ returns scalars; these\n        # need a new view as a Quantity.\n        if not isinstance(out, np.ndarray):\n            out = self._new_view(out)\n        return out\n\n    def __setitem__(self, i, value):\n        if isinstance(i, str):\n            # Indexing will cause a different unit, so by doing this in\n            # two steps we effectively try with the right unit.\n            self[i][...] = value\n            return\n\n        # update indices in info if the info property has been accessed\n        # (in which case 'info' in self.__dict__ is True; this is guaranteed\n        # to be the case if we're part of a table).\n        if not self.isscalar and 'info' in self.__dict__:\n            self.info.adjust_indices(i, value, len(self))\n        self.view(np.ndarray).__setitem__(i, self._to_own_unit(value))\n\n    # __contains__ is OK\n\n    def __bool__(self):\n        \"\"\"Quantities should always be treated as non-False; there is too much\n        potential for ambiguity otherwise.\n        \"\"\"\n        warnings.warn('The truth value of a Quantity is ambiguous. '\n                      'In the future this will raise a ValueError.',\n                      AstropyDeprecationWarning)\n        return True\n\n    def __len__(self):\n        if self.isscalar:\n            raise TypeError(\"'{cls}' object with a scalar value has no \"\n                            \"len()\".format(cls=self.__class__.__name__))\n        else:\n            return len(self.value)\n\n    # Numerical types\n    def __float__(self):\n        try:\n            return float(self.to_value(dimensionless_unscaled))\n        except (UnitsError, TypeError):\n            raise TypeError('only dimensionless scalar quantities can be '\n                            'converted to Python scalars')\n\n    def __int__(self):\n        try:\n            return int(self.to_value(dimensionless_unscaled))\n        except (UnitsError, TypeError):\n            raise TypeError('only dimensionless scalar quantities can be '\n                            'converted to Python scalars')\n\n    def __index__(self):\n        # for indices, we do not want to mess around with scaling at all,\n        # so unlike for float, int, we insist here on unscaled dimensionless\n        try:\n            assert self.unit.is_unity()\n            return self.value.__index__()\n        except Exception:\n            raise TypeError('only integer dimensionless scalar quantities '\n                            'can be converted to a Python index')\n\n    # TODO: we may want to add a hook for dimensionless quantities?\n    @property\n    def _unitstr(self):\n        if self.unit is None:\n            unitstr = _UNIT_NOT_INITIALISED\n        else:\n            unitstr = str(self.unit)\n\n        if unitstr:\n            unitstr = ' ' + unitstr\n\n        return unitstr\n\n    def to_string(self, unit=None, precision=None, format=None, subfmt=None):\n        \"\"\"\n        Generate a string representation of the quantity and its unit.\n\n        The behavior of this function can be altered via the\n        `numpy.set_printoptions` function and its various keywords.  The\n        exception to this is the ``threshold`` keyword, which is controlled via\n        the ``[units.quantity]`` configuration item ``latex_array_threshold``.\n        This is treated separately because the numpy default of 1000 is too big\n        for most browsers to handle.\n\n        Parameters\n        ----------\n        unit : unit-like, optional\n            Specifies the unit.  If not provided,\n            the unit used to initialize the quantity will be used.\n\n        precision : number, optional\n            The level of decimal precision. If `None`, or not provided,\n            it will be determined from NumPy print options.\n\n        format : str, optional\n            The format of the result. If not provided, an unadorned\n            string is returned. Supported values are:\n\n            - 'latex': Return a LaTeX-formatted string\n\n        subfmt : str, optional\n            Subformat of the result. For the moment,\n            only used for format=\"latex\". Supported values are:\n\n            - 'inline': Use ``$ ... $`` as delimiters.\n\n            - 'display': Use ``$\\\\displaystyle ... $`` as delimiters.\n\n        Returns\n        -------\n        str\n            A string with the contents of this Quantity\n        \"\"\"\n        if unit is not None and unit != self.unit:\n            return self.to(unit).to_string(\n                unit=None, precision=precision, format=format, subfmt=subfmt)\n\n        formats = {\n            None: None,\n            \"latex\": {\n                None: (\"$\", \"$\"),\n                \"inline\": (\"$\", \"$\"),\n                \"display\": (r\"$\\displaystyle \", r\"$\"),\n            },\n        }\n\n        if format not in formats:\n            raise ValueError(f\"Unknown format '{format}'\")\n        elif format is None:\n            if precision is None:\n                # Use default formatting settings\n                return f'{self.value}{self._unitstr:s}'\n            else:\n                # np.array2string properly formats arrays as well as scalars\n                return np.array2string(self.value, precision=precision,\n                                       floatmode=\"fixed\") + self._unitstr\n\n        # else, for the moment we assume format=\"latex\"\n\n        # Set the precision if set, otherwise use numpy default\n        pops = np.get_printoptions()\n        format_spec = f\".{precision if precision is not None else pops['precision']}g\"\n\n        def float_formatter(value):\n            return Latex.format_exponential_notation(value,\n                                                     format_spec=format_spec)\n\n        def complex_formatter(value):\n            return '({}{}i)'.format(\n                Latex.format_exponential_notation(value.real,\n                                                  format_spec=format_spec),\n                Latex.format_exponential_notation(value.imag,\n                                                  format_spec='+' + format_spec))\n\n        # The view is needed for the scalar case - self.value might be float.\n        latex_value = np.array2string(\n            self.view(np.ndarray),\n            threshold=(conf.latex_array_threshold\n                       if conf.latex_array_threshold > -1 else pops['threshold']),\n            formatter={'float_kind': float_formatter,\n                       'complex_kind': complex_formatter},\n            max_line_width=np.inf,\n            separator=',~')\n\n        latex_value = latex_value.replace('...', r'\\dots')\n\n        # Format unit\n        # [1:-1] strips the '$' on either side needed for math mode\n        latex_unit = (self.unit._repr_latex_()[1:-1]  # note this is unicode\n                      if self.unit is not None\n                      else _UNIT_NOT_INITIALISED)\n\n        delimiter_left, delimiter_right = formats[format][subfmt]\n\n        return rf'{delimiter_left}{latex_value} \\; {latex_unit}{delimiter_right}'\n\n    def __str__(self):\n        return self.to_string()\n\n    def __repr__(self):\n        prefixstr = '<' + self.__class__.__name__ + ' '\n        arrstr = np.array2string(self.view(np.ndarray), separator=', ',\n                                 prefix=prefixstr)\n        return f'{prefixstr}{arrstr}{self._unitstr:s}>'\n\n    def _repr_latex_(self):\n        \"\"\"\n        Generate a latex representation of the quantity and its unit.\n\n        Returns\n        -------\n        lstr\n            A LaTeX string with the contents of this Quantity\n        \"\"\"\n        # NOTE: This should change to display format in a future release\n        return self.to_string(format='latex', subfmt='inline')\n\n    def __format__(self, format_spec):\n        \"\"\"\n        Format quantities using the new-style python formatting codes\n        as specifiers for the number.\n\n        If the format specifier correctly applies itself to the value,\n        then it is used to format only the value. If it cannot be\n        applied to the value, then it is applied to the whole string.\n\n        \"\"\"\n        try:\n            value = format(self.value, format_spec)\n            full_format_spec = \"s\"\n        except ValueError:\n            value = self.value\n            full_format_spec = format_spec\n\n        return format(f\"{value}{self._unitstr:s}\",\n                      full_format_spec)\n\n    def decompose(self, bases=[]):\n        \"\"\"\n        Generates a new `Quantity` with the units\n        decomposed. Decomposed units have only irreducible units in\n        them (see `astropy.units.UnitBase.decompose`).\n\n        Parameters\n        ----------\n        bases : sequence of `~astropy.units.UnitBase`, optional\n            The bases to decompose into.  When not provided,\n            decomposes down to any irreducible units.  When provided,\n            the decomposed result will only contain the given units.\n            This will raises a `~astropy.units.UnitsError` if it's not possible\n            to do so.\n\n        Returns\n        -------\n        newq : `~astropy.units.Quantity`\n            A new object equal to this quantity with units decomposed.\n        \"\"\"\n        return self._decompose(False, bases=bases)\n\n    def _decompose(self, allowscaledunits=False, bases=[]):\n        \"\"\"\n        Generates a new `Quantity` with the units decomposed. Decomposed\n        units have only irreducible units in them (see\n        `astropy.units.UnitBase.decompose`).\n\n        Parameters\n        ----------\n        allowscaledunits : bool\n            If True, the resulting `Quantity` may have a scale factor\n            associated with it.  If False, any scaling in the unit will\n            be subsumed into the value of the resulting `Quantity`\n\n        bases : sequence of UnitBase, optional\n            The bases to decompose into.  When not provided,\n            decomposes down to any irreducible units.  When provided,\n            the decomposed result will only contain the given units.\n            This will raises a `~astropy.units.UnitsError` if it's not possible\n            to do so.\n\n        Returns\n        -------\n        newq : `~astropy.units.Quantity`\n            A new object equal to this quantity with units decomposed.\n\n        \"\"\"\n\n        new_unit = self.unit.decompose(bases=bases)\n\n        # Be careful here because self.value usually is a view of self;\n        # be sure that the original value is not being modified.\n        if not allowscaledunits and hasattr(new_unit, 'scale'):\n            new_value = self.value * new_unit.scale\n            new_unit = new_unit / new_unit.scale\n            return self._new_view(new_value, new_unit)\n        else:\n            return self._new_view(self.copy(), new_unit)\n\n    # These functions need to be overridden to take into account the units\n    # Array conversion\n    # https://numpy.org/doc/stable/reference/arrays.ndarray.html#array-conversion\n\n    def item(self, *args):\n        \"\"\"Copy an element of an array to a scalar Quantity and return it.\n\n        Like :meth:`~numpy.ndarray.item` except that it always\n        returns a `Quantity`, not a Python scalar.\n\n        \"\"\"\n        return self._new_view(super().item(*args))\n\n    def tolist(self):\n        raise NotImplementedError(\"cannot make a list of Quantities.  Get \"\n                                  \"list of values with q.value.tolist()\")\n\n    def _to_own_unit(self, value, check_precision=True):\n        try:\n            _value = value.to_value(self.unit)\n        except AttributeError:\n            # We're not a Quantity.\n            # First remove two special cases (with a fast test):\n            # 1) Maybe masked printing? MaskedArray with quantities does not\n            # work very well, but no reason to break even repr and str.\n            # 2) np.ma.masked? useful if we're a MaskedQuantity.\n            if (value is np.ma.masked\n                or (value is np.ma.masked_print_option\n                    and self.dtype.kind == 'O')):\n                return value\n            # Now, let's try a more general conversion.\n            # Plain arrays will be converted to dimensionless in the process,\n            # but anything with a unit attribute will use that.\n            try:\n                as_quantity = Quantity(value)\n                _value = as_quantity.to_value(self.unit)\n            except UnitsError:\n                # last chance: if this was not something with a unit\n                # and is all 0, inf, or nan, we treat it as arbitrary unit.\n                if (not hasattr(value, 'unit') and\n                        can_have_arbitrary_unit(as_quantity.value)):\n                    _value = as_quantity.value\n                else:\n                    raise\n\n        if self.dtype.kind == 'i' and check_precision:\n            # If, e.g., we are casting float to int, we want to fail if\n            # precision is lost, but let things pass if it works.\n            _value = np.array(_value, copy=False, subok=True)\n            if not np.can_cast(_value.dtype, self.dtype):\n                self_dtype_array = np.array(_value, self.dtype, subok=True)\n                if not np.all(np.logical_or(self_dtype_array == _value,\n                                            np.isnan(_value))):\n                    raise TypeError(\"cannot convert value type to array type \"\n                                    \"without precision loss\")\n\n        # Setting names to ensure things like equality work (note that\n        # above will have failed already if units did not match).\n        if self.dtype.names:\n            _value.dtype.names = self.dtype.names\n        return _value\n\n    def itemset(self, *args):\n        if len(args) == 0:\n            raise ValueError(\"itemset must have at least one argument\")\n\n        self.view(np.ndarray).itemset(*(args[:-1] +\n                                        (self._to_own_unit(args[-1]),)))\n\n    def tostring(self, order='C'):\n        raise NotImplementedError(\"cannot write Quantities to string.  Write \"\n                                  \"array with q.value.tostring(...).\")\n\n    def tobytes(self, order='C'):\n        raise NotImplementedError(\"cannot write Quantities to string.  Write \"\n                                  \"array with q.value.tobytes(...).\")\n\n    def tofile(self, fid, sep=\"\", format=\"%s\"):\n        raise NotImplementedError(\"cannot write Quantities to file.  Write \"\n                                  \"array with q.value.tofile(...)\")\n\n    def dump(self, file):\n        raise NotImplementedError(\"cannot dump Quantities to file.  Write \"\n                                  \"array with q.value.dump()\")\n\n    def dumps(self):\n        raise NotImplementedError(\"cannot dump Quantities to string.  Write \"\n                                  \"array with q.value.dumps()\")\n\n    # astype, byteswap, copy, view, getfield, setflags OK as is\n\n    def fill(self, value):\n        self.view(np.ndarray).fill(self._to_own_unit(value))\n\n    # Shape manipulation: resize cannot be done (does not own data), but\n    # shape, transpose, swapaxes, flatten, ravel, squeeze all OK.  Only\n    # the flat iterator needs to be overwritten, otherwise single items are\n    # returned as numbers.\n    @property\n    def flat(self):\n        \"\"\"A 1-D iterator over the Quantity array.\n\n        This returns a ``QuantityIterator`` instance, which behaves the same\n        as the `~numpy.flatiter` instance returned by `~numpy.ndarray.flat`,\n        and is similar to, but not a subclass of, Python's built-in iterator\n        object.\n        \"\"\"\n        return QuantityIterator(self)\n\n    @flat.setter\n    def flat(self, value):\n        y = self.ravel()\n        y[:] = value\n\n    # Item selection and manipulation\n    # repeat, sort, compress, diagonal OK\n    def take(self, indices, axis=None, out=None, mode='raise'):\n        out = super().take(indices, axis=axis, out=out, mode=mode)\n        # For single elements, ndarray.take returns scalars; these\n        # need a new view as a Quantity.\n        if type(out) is not type(self):\n            out = self._new_view(out)\n        return out\n\n    def put(self, indices, values, mode='raise'):\n        self.view(np.ndarray).put(indices, self._to_own_unit(values), mode)\n\n    def choose(self, choices, out=None, mode='raise'):\n        raise NotImplementedError(\"cannot choose based on quantity.  Choose \"\n                                  \"using array with q.value.choose(...)\")\n\n    # ensure we do not return indices as quantities\n    def argsort(self, axis=-1, kind='quicksort', order=None):\n        return self.view(np.ndarray).argsort(axis=axis, kind=kind, order=order)\n\n    def searchsorted(self, v, *args, **kwargs):\n        return np.searchsorted(np.array(self),\n                               self._to_own_unit(v, check_precision=False),\n                               *args, **kwargs)  # avoid numpy 1.6 problem\n\n    def argmax(self, axis=None, out=None):\n        return self.view(np.ndarray).argmax(axis, out=out)\n\n    def argmin(self, axis=None, out=None):\n        return self.view(np.ndarray).argmin(axis, out=out)\n\n    def __array_function__(self, function, types, args, kwargs):\n        \"\"\"Wrap numpy functions, taking care of units.\n\n        Parameters\n        ----------\n        function : callable\n            Numpy function to wrap\n        types : iterable of classes\n            Classes that provide an ``__array_function__`` override. Can\n            in principle be used to interact with other classes. Below,\n            mostly passed on to `~numpy.ndarray`, which can only interact\n            with subclasses.\n        args : tuple\n            Positional arguments provided in the function call.\n        kwargs : dict\n            Keyword arguments provided in the function call.\n\n        Returns\n        -------\n        result: `~astropy.units.Quantity`, `~numpy.ndarray`\n            As appropriate for the function.  If the function is not\n            supported, `NotImplemented` is returned, which will lead to\n            a `TypeError` unless another argument overrode the function.\n\n        Raises\n        ------\n        ~astropy.units.UnitsError\n            If operands have incompatible units.\n        \"\"\"\n        # A function should be in one of the following sets or dicts:\n        # 1. SUBCLASS_SAFE_FUNCTIONS (set), if the numpy implementation\n        #    supports Quantity; we pass on to ndarray.__array_function__.\n        # 2. FUNCTION_HELPERS (dict), if the numpy implementation is usable\n        #    after converting quantities to arrays with suitable units,\n        #    and possibly setting units on the result.\n        # 3. DISPATCHED_FUNCTIONS (dict), if the function makes sense but\n        #    requires a Quantity-specific implementation.\n        # 4. UNSUPPORTED_FUNCTIONS (set), if the function does not make sense.\n        # For now, since we may not yet have complete coverage, if a\n        # function is in none of the above, we simply call the numpy\n        # implementation.\n        if function in SUBCLASS_SAFE_FUNCTIONS:\n            return super().__array_function__(function, types, args, kwargs)\n\n        elif function in FUNCTION_HELPERS:\n            function_helper = FUNCTION_HELPERS[function]\n            try:\n                args, kwargs, unit, out = function_helper(*args, **kwargs)\n            except NotImplementedError:\n                return self._not_implemented_or_raise(function, types)\n\n            result = super().__array_function__(function, types, args, kwargs)\n            # Fall through to return section\n\n        elif function in DISPATCHED_FUNCTIONS:\n            dispatched_function = DISPATCHED_FUNCTIONS[function]\n            try:\n                result, unit, out = dispatched_function(*args, **kwargs)\n            except NotImplementedError:\n                return self._not_implemented_or_raise(function, types)\n\n            # Fall through to return section\n\n        elif function in UNSUPPORTED_FUNCTIONS:\n            return NotImplemented\n\n        else:\n            warnings.warn(\"function '{}' is not known to astropy's Quantity. \"\n                          \"Will run it anyway, hoping it will treat ndarray \"\n                          \"subclasses correctly. Please raise an issue at \"\n                          \"https://github.com/astropy/astropy/issues. \"\n                          .format(function.__name__), AstropyWarning)\n\n            return super().__array_function__(function, types, args, kwargs)\n\n        # If unit is None, a plain array is expected (e.g., boolean), which\n        # means we're done.\n        # We're also done if the result was NotImplemented, which can happen\n        # if other inputs/outputs override __array_function__;\n        # hopefully, they can then deal with us.\n        if unit is None or result is NotImplemented:\n            return result\n\n        return self._result_as_quantity(result, unit, out=out)\n\n    def _not_implemented_or_raise(self, function, types):\n        # Our function helper or dispatcher found that the function does not\n        # work with Quantity.  In principle, there may be another class that\n        # knows what to do with us, for which we should return NotImplemented.\n        # But if there is ndarray (or a non-Quantity subclass of it) around,\n        # it quite likely coerces, so we should just break.\n        if any(issubclass(t, np.ndarray) and not issubclass(t, Quantity)\n               for t in types):\n            raise TypeError(\"the Quantity implementation cannot handle {} \"\n                            \"with the given arguments.\"\n                            .format(function)) from None\n        else:\n            return NotImplemented\n\n    # Calculation -- override ndarray methods to take into account units.\n    # We use the corresponding numpy functions to evaluate the results, since\n    # the methods do not always allow calling with keyword arguments.\n    # For instance, np.array([0.,2.]).clip(a_min=0., a_max=1.) gives\n    # TypeError: 'a_max' is an invalid keyword argument for this function.\n    def _wrap_function(self, function, *args, unit=None, out=None, **kwargs):\n        \"\"\"Wrap a numpy function that processes self, returning a Quantity.\n\n        Parameters\n        ----------\n        function : callable\n            Numpy function to wrap.\n        args : positional arguments\n            Any positional arguments to the function beyond the first argument\n            (which will be set to ``self``).\n        kwargs : keyword arguments\n            Keyword arguments to the function.\n\n        If present, the following arguments are treated specially:\n\n        unit : `~astropy.units.Unit`\n            Unit of the output result.  If not given, the unit of ``self``.\n        out : `~astropy.units.Quantity`\n            A Quantity instance in which to store the output.\n\n        Notes\n        -----\n        Output should always be assigned via a keyword argument, otherwise\n        no proper account of the unit is taken.\n\n        Returns\n        -------\n        out : `~astropy.units.Quantity`\n            Result of the function call, with the unit set properly.\n        \"\"\"\n        if unit is None:\n            unit = self.unit\n        # Ensure we don't loop back by turning any Quantity into array views.\n        args = (self.value,) + tuple((arg.value if isinstance(arg, Quantity)\n                                      else arg) for arg in args)\n        if out is not None:\n            # If pre-allocated output is used, check it is suitable.\n            # This also returns array view, to ensure we don't loop back.\n            arrays = tuple(arg for arg in args if isinstance(arg, np.ndarray))\n            kwargs['out'] = check_output(out, unit, arrays, function=function)\n        # Apply the function and turn it back into a Quantity.\n        result = function(*args, **kwargs)\n        return self._result_as_quantity(result, unit, out)\n\n    def trace(self, offset=0, axis1=0, axis2=1, dtype=None, out=None):\n        return self._wrap_function(np.trace, offset, axis1, axis2, dtype,\n                                   out=out)\n\n    def var(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False):\n        return self._wrap_function(np.var, axis, dtype,\n                                   out=out, ddof=ddof, keepdims=keepdims,\n                                   unit=self.unit**2)\n\n    def std(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False):\n        return self._wrap_function(np.std, axis, dtype, out=out, ddof=ddof,\n                                   keepdims=keepdims)\n\n    def mean(self, axis=None, dtype=None, out=None, keepdims=False):\n        return self._wrap_function(np.mean, axis, dtype, out=out,\n                                   keepdims=keepdims)\n\n    def round(self, decimals=0, out=None):\n        return self._wrap_function(np.round, decimals, out=out)\n\n    def dot(self, b, out=None):\n        result_unit = self.unit * getattr(b, 'unit', dimensionless_unscaled)\n        return self._wrap_function(np.dot, b, out=out, unit=result_unit)\n\n    # Calculation: override methods that do not make sense.\n\n    def all(self, axis=None, out=None):\n        raise TypeError(\"cannot evaluate truth value of quantities. \"\n                        \"Evaluate array with q.value.all(...)\")\n\n    def any(self, axis=None, out=None):\n        raise TypeError(\"cannot evaluate truth value of quantities. \"\n                        \"Evaluate array with q.value.any(...)\")\n\n    # Calculation: numpy functions that can be overridden with methods.\n\n    def diff(self, n=1, axis=-1):\n        return self._wrap_function(np.diff, n, axis)\n\n    def ediff1d(self, to_end=None, to_begin=None):\n        return self._wrap_function(np.ediff1d, to_end, to_begin)\n\n    def nansum(self, axis=None, out=None, keepdims=False):\n        return self._wrap_function(np.nansum, axis,\n                                   out=out, keepdims=keepdims)\n\n    def insert(self, obj, values, axis=None):\n        \"\"\"\n        Insert values along the given axis before the given indices and return\n        a new `~astropy.units.Quantity` object.\n\n        This is a thin wrapper around the `numpy.insert` function.\n\n        Parameters\n        ----------\n        obj : int, slice or sequence of int\n            Object that defines the index or indices before which ``values`` is\n            inserted.\n        values : array-like\n            Values to insert.  If the type of ``values`` is different\n            from that of quantity, ``values`` is converted to the matching type.\n            ``values`` should be shaped so that it can be broadcast appropriately\n            The unit of ``values`` must be consistent with this quantity.\n        axis : int, optional\n            Axis along which to insert ``values``.  If ``axis`` is None then\n            the quantity array is flattened before insertion.\n\n        Returns\n        -------\n        out : `~astropy.units.Quantity`\n            A copy of quantity with ``values`` inserted.  Note that the\n            insertion does not occur in-place: a new quantity array is returned.\n\n        Examples\n        --------\n        >>> import astropy.units as u\n        >>> q = [1, 2] * u.m\n        >>> q.insert(0, 50 * u.cm)\n        <Quantity [ 0.5,  1.,  2.] m>\n\n        >>> q = [[1, 2], [3, 4]] * u.m\n        >>> q.insert(1, [10, 20] * u.m, axis=0)\n        <Quantity [[  1.,  2.],\n                   [ 10., 20.],\n                   [  3.,  4.]] m>\n\n        >>> q.insert(1, 10 * u.m, axis=1)\n        <Quantity [[  1., 10.,  2.],\n                   [  3., 10.,  4.]] m>\n\n        \"\"\"\n        out_array = np.insert(self.value, obj, self._to_own_unit(values), axis)\n        return self._new_view(out_array)"},{"attributeType":"null","col":8,"comment":"null","endLoc":49,"id":1332,"name":"array","nodeType":"Attribute","startLoc":49,"text":"self.array"},{"attributeType":"null","col":8,"comment":"null","endLoc":57,"id":1333,"name":"start","nodeType":"Attribute","startLoc":57,"text":"self.start"},{"attributeType":"null","col":20,"comment":"null","endLoc":57,"id":1334,"name":"end","nodeType":"Attribute","startLoc":57,"text":"self.end"},{"attributeType":"null","col":30,"comment":"null","endLoc":57,"id":1335,"name":"step","nodeType":"Attribute","startLoc":57,"text":"self.step"},{"attributeType":"null","col":8,"comment":"null","endLoc":50,"id":1336,"name":"row","nodeType":"Attribute","startLoc":50,"text":"self.row"},{"col":4,"comment":"Perform conversions on any other fixed-width column data types.\n\n        This may not perform any conversion at all if it's not necessary, in\n        which case the original column array is returned.\n        ","endLoc":1003,"header":"def _convert_other(self, column, field, recformat)","id":1337,"name":"_convert_other","nodeType":"Function","startLoc":874,"text":"def _convert_other(self, column, field, recformat):\n        \"\"\"Perform conversions on any other fixed-width column data types.\n\n        This may not perform any conversion at all if it's not necessary, in\n        which case the original column array is returned.\n        \"\"\"\n\n        if isinstance(recformat, _FormatX):\n            # special handling for the X format\n            return self._convert_x(field, recformat)\n\n        (_str, _bool, _number, _scale, _zero, bscale, bzero, dim) = \\\n            self._get_scale_factors(column)\n\n        indx = self.names.index(column.name)\n\n        # ASCII table, convert strings to numbers\n        # TODO:\n        # For now, check that these are ASCII columns by checking the coldefs\n        # type; in the future all columns (for binary tables, ASCII tables, or\n        # otherwise) should \"know\" what type they are already and how to handle\n        # converting their data from FITS format to native format and vice\n        # versa...\n        if not _str and isinstance(self._coldefs, _AsciiColDefs):\n            field = self._convert_ascii(column, field)\n\n        # Test that the dimensions given in dim are sensible; otherwise\n        # display a warning and ignore them\n        if dim:\n            # See if the dimensions already match, if not, make sure the\n            # number items will fit in the specified dimensions\n            if field.ndim > 1:\n                actual_shape = field.shape[1:]\n                if _str:\n                    actual_shape = actual_shape + (field.itemsize,)\n            else:\n                actual_shape = field.shape[0]\n\n            if dim == actual_shape:\n                # The array already has the correct dimensions, so we\n                # ignore dim and don't convert\n                dim = None\n            else:\n                nitems = reduce(operator.mul, dim)\n                if _str:\n                    actual_nitems = field.itemsize\n                elif len(field.shape) == 1:  # No repeat count in TFORMn, equivalent to 1\n                    actual_nitems = 1\n                else:\n                    actual_nitems = field.shape[1]\n                if nitems > actual_nitems:\n                    warnings.warn(\n                        'TDIM{} value {:d} does not fit with the size of '\n                        'the array items ({:d}).  TDIM{:d} will be ignored.'\n                        .format(indx + 1, self._coldefs[indx].dims,\n                                actual_nitems, indx + 1))\n                    dim = None\n\n        # further conversion for both ASCII and binary tables\n        # For now we've made columns responsible for *knowing* whether their\n        # data has been scaled, but we make the FITS_rec class responsible for\n        # actually doing the scaling\n        # TODO: This also needs to be fixed in the effort to make Columns\n        # responsible for scaling their arrays to/from FITS native values\n        if not column.ascii and column.format.p_format:\n            format_code = column.format.p_format\n        else:\n            # TODO: Rather than having this if/else it might be nice if the\n            # ColumnFormat class had an attribute guaranteed to give the format\n            # of actual values in a column regardless of whether the true\n            # format is something like P or Q\n            format_code = column.format.format\n\n        if (_number and (_scale or _zero) and not column._physical_values):\n            # This is to handle pseudo unsigned ints in table columns\n            # TODO: For now this only really works correctly for binary tables\n            # Should it work for ASCII tables as well?\n            if self._uint:\n                if bzero == 2**15 and format_code == 'I':\n                    field = np.array(field, dtype=np.uint16)\n                elif bzero == 2**31 and format_code == 'J':\n                    field = np.array(field, dtype=np.uint32)\n                elif bzero == 2**63 and format_code == 'K':\n                    field = np.array(field, dtype=np.uint64)\n                    bzero64 = np.uint64(2 ** 63)\n                else:\n                    field = np.array(field, dtype=np.float64)\n            else:\n                field = np.array(field, dtype=np.float64)\n\n            if _scale:\n                np.multiply(field, bscale, field)\n            if _zero:\n                if self._uint and format_code == 'K':\n                    # There is a chance of overflow, so be careful\n                    test_overflow = field.copy()\n                    try:\n                        test_overflow += bzero64\n                    except OverflowError:\n                        warnings.warn(\n                            \"Overflow detected while applying TZERO{:d}. \"\n                            \"Returning unscaled data.\".format(indx + 1))\n                    else:\n                        field = test_overflow\n                else:\n                    field += bzero\n\n            # mark the column as scaled\n            column._physical_values = True\n\n        elif _bool and field.dtype != bool:\n            field = np.equal(field, ord('T'))\n        elif _str:\n            if not self._character_as_bytes:\n                with suppress(UnicodeDecodeError):\n                    field = decode_ascii(field)\n\n        if dim:\n            # Apply the new field item dimensions\n            nitems = reduce(operator.mul, dim)\n            if field.ndim > 1:\n                field = field[:, :nitems]\n            if _str:\n                fmt = field.dtype.char\n                dtype = (f'|{fmt}{dim[-1]}', dim[:-1])\n                field.dtype = dtype\n            else:\n                field.shape = (field.shape[0],) + dim\n\n        return field"},{"attributeType":"null","col":8,"comment":"null","endLoc":58,"id":1338,"name":"base","nodeType":"Attribute","startLoc":58,"text":"self.base"},{"className":"_UnicodeArrayEncodeError","col":0,"comment":"null","endLoc":1312,"id":1339,"nodeType":"Class","startLoc":1309,"text":"class _UnicodeArrayEncodeError(UnicodeEncodeError):\n    def __init__(self, encoding, object_, start, end, reason, index):\n        super().__init__(encoding, object_, start, end, reason)\n        self.index = index"},{"col":4,"comment":"null","endLoc":1312,"header":"def __init__(self, encoding, object_, start, end, reason, index)","id":1340,"name":"__init__","nodeType":"Function","startLoc":1310,"text":"def __init__(self, encoding, object_, start, end, reason, index):\n        super().__init__(encoding, object_, start, end, reason)\n        self.index = index"},{"attributeType":"null","col":8,"comment":"null","endLoc":1312,"id":1341,"name":"index","nodeType":"Attribute","startLoc":1312,"text":"self.index"},{"col":4,"comment":"null","endLoc":1166,"header":"def _verify(self, option='warn')","id":1342,"name":"_verify","nodeType":"Function","startLoc":1081,"text":"def _verify(self, option='warn'):\n        errs = []\n        fix_text = f'Fixed {self.keyword!r} card to meet the FITS standard.'\n\n        # Don't try to verify cards that already don't meet any recognizable\n        # standard\n        if self._invalid:\n            return _ErrList(errs)\n\n        # verify the equal sign position\n        if (self.keyword not in self._commentary_keywords and\n            (self._image and self._image[:9].upper() != 'HIERARCH ' and\n             self._image.find('=') != 8)):\n            errs.append(dict(\n                err_text='Card {!r} is not FITS standard (equal sign not '\n                         'at column 8).'.format(self.keyword),\n                fix_text=fix_text,\n                fix=self._fix_value))\n\n        # verify the key, it is never fixable\n        # always fix silently the case where \"=\" is before column 9,\n        # since there is no way to communicate back to the _keys.\n        if ((self._image and self._image[:8].upper() == 'HIERARCH') or\n                self._hierarch):\n            pass\n        else:\n            if self._image:\n                # PyFITS will auto-uppercase any standard keyword, so lowercase\n                # keywords can only occur if they came from the wild\n                keyword = self._split()[0]\n                if keyword != keyword.upper():\n                    # Keyword should be uppercase unless it's a HIERARCH card\n                    errs.append(dict(\n                        err_text=f'Card keyword {keyword!r} is not upper case.',\n                        fix_text=fix_text,\n                        fix=self._fix_keyword))\n\n            keyword = self.keyword\n            if self.field_specifier:\n                keyword = keyword.split('.', 1)[0]\n\n            if not self._keywd_FSC_RE.match(keyword):\n                errs.append(dict(\n                    err_text=f'Illegal keyword name {keyword!r}',\n                    fixable=False))\n\n        # verify the value, it may be fixable\n        keyword, valuecomment = self._split()\n        if self.keyword in self._commentary_keywords:\n            # For commentary keywords all that needs to be ensured is that it\n            # contains only printable ASCII characters\n            if not self._ascii_text_re.match(valuecomment):\n                errs.append(dict(\n                    err_text='Unprintable string {!r}; commentary cards may '\n                             'only contain printable ASCII characters'.format(\n                             valuecomment),\n                    fixable=False))\n        else:\n            if not self._valuemodified:\n                m = self._value_FSC_RE.match(valuecomment)\n                # If the value of a card was replaced before the card was ever\n                # even verified, the new value can be considered valid, so we\n                # don't bother verifying the old value.  See\n                # https://github.com/astropy/astropy/issues/5408\n                if m is None:\n                    errs.append(dict(\n                        err_text=f'Card {self.keyword!r} is not FITS standard '\n                                 f'(invalid value string: {valuecomment!r}).',\n                        fix_text=fix_text,\n                        fix=self._fix_value))\n\n        # verify the comment (string), it is never fixable\n        m = self._value_NFSC_RE.match(valuecomment)\n        if m is not None:\n            comment = m.group('comm')\n            if comment is not None:\n                if not self._ascii_text_re.match(comment):\n                    errs.append(dict(\n                        err_text=f'Unprintable string {comment!r}; header '\n                                  'comments may only contain printable '\n                                  'ASCII characters',\n                        fixable=False))\n\n        errs = _ErrList([self.run_option(option, **err) for err in errs])\n        self._verified = True\n        return errs"},{"col":0,"comment":"\n    Takes a unicode array and fills the output string array with the ASCII\n    encodings (if possible) of the elements of the input array.  The two arrays\n    must be the same size (though not necessarily the same shape).\n\n    This is like an inplace version of `np.char.encode` though simpler since\n    it's only limited to ASCII, and hence the size of each character is\n    guaranteed to be 1 byte.\n\n    If any strings are non-ASCII an UnicodeArrayEncodeError is raised--this is\n    just a `UnicodeEncodeError` with an additional attribute for the index of\n    the item that couldn't be encoded.\n    ","endLoc":1347,"header":"def _ascii_encode(inarray, out=None)","id":1343,"name":"_ascii_encode","nodeType":"Function","startLoc":1315,"text":"def _ascii_encode(inarray, out=None):\n    \"\"\"\n    Takes a unicode array and fills the output string array with the ASCII\n    encodings (if possible) of the elements of the input array.  The two arrays\n    must be the same size (though not necessarily the same shape).\n\n    This is like an inplace version of `np.char.encode` though simpler since\n    it's only limited to ASCII, and hence the size of each character is\n    guaranteed to be 1 byte.\n\n    If any strings are non-ASCII an UnicodeArrayEncodeError is raised--this is\n    just a `UnicodeEncodeError` with an additional attribute for the index of\n    the item that couldn't be encoded.\n    \"\"\"\n\n    out_dtype = np.dtype((f'S{inarray.dtype.itemsize // 4}',\n                         inarray.dtype.shape))\n    if out is not None:\n        out = out.view(out_dtype)\n\n    op_dtypes = [inarray.dtype, out_dtype]\n    op_flags = [['readonly'], ['writeonly', 'allocate']]\n    it = np.nditer([inarray, out], op_dtypes=op_dtypes,\n                   op_flags=op_flags, flags=['zerosize_ok'])\n\n    try:\n        for initem, outitem in it:\n            outitem[...] = initem.item().encode('ascii')\n    except UnicodeEncodeError as exc:\n        index = np.unravel_index(it.iterindex, inarray.shape)\n        raise _UnicodeArrayEncodeError(*(exc.args + (index,)))\n\n    return it.operands[1]"},{"col":4,"comment":"Quantity Type Hints.\n\n        Unit-aware type hints are ``Annotated`` objects that encode the class,\n        the unit, and possibly shape and dtype information, depending on the\n        python and :mod:`numpy` versions.\n\n        Schematically, ``Annotated[cls[shape, dtype], unit]``\n\n        As a classmethod, the type is the class, ie ``Quantity``\n        produces an ``Annotated[Quantity, ...]`` while a subclass\n        like :class:`~astropy.coordinates.Angle` returns\n        ``Annotated[Angle, ...]``.\n\n        Parameters\n        ----------\n        unit_shape_dtype : :class:`~astropy.units.UnitBase`, str, `~astropy.units.PhysicalType`, or tuple\n            Unit specification, can be the physical type (ie str or class).\n            If tuple, then the first element is the unit specification\n            and all other elements are for `numpy.ndarray` type annotations.\n            Whether they are included depends on the python and :mod:`numpy`\n            versions.\n\n        Returns\n        -------\n        `typing.Annotated`, `typing_extensions.Annotated`, `astropy.units.Unit`, or `astropy.units.PhysicalType`\n            Return type in this preference order:\n            * if python v3.9+ : `typing.Annotated`\n            * if :mod:`typing_extensions` is installed : `typing_extensions.Annotated`\n            * `astropy.units.Unit` or `astropy.units.PhysicalType`\n\n        Raises\n        ------\n        TypeError\n            If the unit/physical_type annotation is not Unit-like or\n            PhysicalType-like.\n\n        Examples\n        --------\n        Create a unit-aware Quantity type annotation\n\n            >>> Quantity[Unit(\"s\")]\n            Annotated[Quantity, Unit(\"s\")]\n\n        See Also\n        --------\n        `~astropy.units.quantity_input`\n            Use annotations for unit checks on function arguments and results.\n\n        Notes\n        -----\n        With Python 3.9+ or :mod:`typing_extensions`, |Quantity| types are also\n        static-type compatible.\n        ","endLoc":404,"header":"def __class_getitem__(cls, unit_shape_dtype)","id":1344,"name":"__class_getitem__","nodeType":"Function","startLoc":317,"text":"def __class_getitem__(cls, unit_shape_dtype):\n        \"\"\"Quantity Type Hints.\n\n        Unit-aware type hints are ``Annotated`` objects that encode the class,\n        the unit, and possibly shape and dtype information, depending on the\n        python and :mod:`numpy` versions.\n\n        Schematically, ``Annotated[cls[shape, dtype], unit]``\n\n        As a classmethod, the type is the class, ie ``Quantity``\n        produces an ``Annotated[Quantity, ...]`` while a subclass\n        like :class:`~astropy.coordinates.Angle` returns\n        ``Annotated[Angle, ...]``.\n\n        Parameters\n        ----------\n        unit_shape_dtype : :class:`~astropy.units.UnitBase`, str, `~astropy.units.PhysicalType`, or tuple\n            Unit specification, can be the physical type (ie str or class).\n            If tuple, then the first element is the unit specification\n            and all other elements are for `numpy.ndarray` type annotations.\n            Whether they are included depends on the python and :mod:`numpy`\n            versions.\n\n        Returns\n        -------\n        `typing.Annotated`, `typing_extensions.Annotated`, `astropy.units.Unit`, or `astropy.units.PhysicalType`\n            Return type in this preference order:\n            * if python v3.9+ : `typing.Annotated`\n            * if :mod:`typing_extensions` is installed : `typing_extensions.Annotated`\n            * `astropy.units.Unit` or `astropy.units.PhysicalType`\n\n        Raises\n        ------\n        TypeError\n            If the unit/physical_type annotation is not Unit-like or\n            PhysicalType-like.\n\n        Examples\n        --------\n        Create a unit-aware Quantity type annotation\n\n            >>> Quantity[Unit(\"s\")]\n            Annotated[Quantity, Unit(\"s\")]\n\n        See Also\n        --------\n        `~astropy.units.quantity_input`\n            Use annotations for unit checks on function arguments and results.\n\n        Notes\n        -----\n        With Python 3.9+ or :mod:`typing_extensions`, |Quantity| types are also\n        static-type compatible.\n        \"\"\"\n        # LOCAL\n        from ._typing import HAS_ANNOTATED, Annotated\n\n        # process whether [unit] or [unit, shape, ptype]\n        if isinstance(unit_shape_dtype, tuple):  # unit, shape, dtype\n            target = unit_shape_dtype[0]\n            shape_dtype = unit_shape_dtype[1:]\n        else:  # just unit\n            target = unit_shape_dtype\n            shape_dtype = ()\n\n        # Allowed unit/physical types. Errors if neither.\n        try:\n            unit = Unit(target)\n        except (TypeError, ValueError):\n            from astropy.units.physical import get_physical_type\n\n            try:\n                unit = get_physical_type(target)\n            except (TypeError, ValueError, KeyError):  # KeyError for Enum\n                raise TypeError(\"unit annotation is not a Unit or PhysicalType\") from None\n\n        # Allow to sort of work for python 3.8- / no typing_extensions\n        # instead of bailing out, return the unit for `quantity_input`\n        if not HAS_ANNOTATED:\n            warnings.warn(\"Quantity annotations are valid static type annotations only\"\n                          \" if Python is v3.9+ or `typing_extensions` is installed.\")\n            return unit\n\n        # Quantity does not (yet) properly extend the NumPy generics types,\n        # introduced in numpy v1.22+, instead just including the unit info as\n        # metadata using Annotated.\n        # TODO: ensure we do interact with NDArray.__class_getitem__.\n        return Annotated.__class_getitem__((cls, unit))"},{"col":4,"comment":"Convert a raw table column to a bit array as specified by the\n        FITS X format.\n        ","endLoc":789,"header":"def _convert_x(self, field, recformat)","id":1345,"name":"_convert_x","nodeType":"Function","startLoc":782,"text":"def _convert_x(self, field, recformat):\n        \"\"\"Convert a raw table column to a bit array as specified by the\n        FITS X format.\n        \"\"\"\n\n        dummy = np.zeros(self.shape + (recformat.repeat,), dtype=np.bool_)\n        _unwrapx(field, dummy, recformat.repeat)\n        return dummy"},{"col":4,"comment":"Get all the scaling flags and factors for one column.","endLoc":1068,"header":"def _get_scale_factors(self, column)","id":1346,"name":"_get_scale_factors","nodeType":"Function","startLoc":1043,"text":"def _get_scale_factors(self, column):\n        \"\"\"Get all the scaling flags and factors for one column.\"\"\"\n\n        # TODO: Maybe this should be a method/property on Column?  Or maybe\n        # it's not really needed at all...\n        _str = column.format.format == 'A'\n        _bool = column.format.format == 'L'\n\n        _number = not (_bool or _str)\n        bscale = column.bscale\n        bzero = column.bzero\n\n        _scale = bscale not in ('', None, 1)\n        _zero = bzero not in ('', None, 0)\n\n        # ensure bscale/bzero are numbers\n        if not _scale:\n            bscale = 1\n        if not _zero:\n            bzero = 0\n\n        # column._dims gives a tuple, rather than column.dim which returns the\n        # original string format code from the FITS header...\n        dim = column._dims\n\n        return (_str, _bool, _number, _scale, _zero, bscale, bzero, dim)"},{"col":4,"comment":"\n        Special handling for ASCII table columns to convert columns containing\n        numeric types to actual numeric arrays from the string representation.\n        ","endLoc":872,"header":"def _convert_ascii(self, column, field)","id":1347,"name":"_convert_ascii","nodeType":"Function","startLoc":833,"text":"def _convert_ascii(self, column, field):\n        \"\"\"\n        Special handling for ASCII table columns to convert columns containing\n        numeric types to actual numeric arrays from the string representation.\n        \"\"\"\n\n        format = column.format\n        recformat = getattr(format, 'recformat', ASCII2NUMPY[format[0]])\n        # if the string = TNULL, return ASCIITNULL\n        nullval = str(column.null).strip().encode('ascii')\n        if len(nullval) > format.width:\n            nullval = nullval[:format.width]\n\n        # Before using .replace make sure that any trailing bytes in each\n        # column are filled with spaces, and *not*, say, nulls; this causes\n        # functions like replace to potentially leave gibberish bytes in the\n        # array buffer.\n        dummy = np.char.ljust(field, format.width)\n        dummy = np.char.replace(dummy, encode_ascii('D'), encode_ascii('E'))\n        null_fill = encode_ascii(str(ASCIITNULL).rjust(format.width))\n\n        # Convert all fields equal to the TNULL value (nullval) to empty fields.\n        # TODO: These fields really should be converted to NaN or something else undefined.\n        # Currently they are converted to empty fields, which are then set to zero.\n        dummy = np.where(np.char.strip(dummy) == nullval, null_fill, dummy)\n\n        # always replace empty fields, see https://github.com/astropy/astropy/pull/5394\n        if nullval != b'':\n            dummy = np.where(np.char.strip(dummy) == b'', null_fill, dummy)\n\n        try:\n            dummy = np.array(dummy, dtype=recformat)\n        except ValueError as exc:\n            indx = self.names.index(column.name)\n            raise ValueError(\n                '{}; the header may be missing the necessary TNULL{} '\n                'keyword or the table contains invalid data'.format(\n                    exc, indx + 1))\n\n        return dummy"},{"col":0,"comment":"\n    Returns True if any fields in a structured array have Unicode dtype.\n    ","endLoc":1356,"header":"def _has_unicode_fields(array)","id":1348,"name":"_has_unicode_fields","nodeType":"Function","startLoc":1350,"text":"def _has_unicode_fields(array):\n    \"\"\"\n    Returns True if any fields in a structured array have Unicode dtype.\n    \"\"\"\n\n    dtypes = (d[0] for d in array.dtype.fields.values())\n    return any(d.kind == 'U' for d in dtypes)"},{"col":0,"comment":"\n    Return the physical type that corresponds to a unit (or another\n    physical type representation).\n\n    Parameters\n    ----------\n    obj : quantity-like or `~astropy.units.PhysicalType`-like\n        An object that (implicitly or explicitly) has a corresponding\n        physical type. This object may be a unit, a\n        `~astropy.units.Quantity`, an object that can be converted to a\n        `~astropy.units.Quantity` (such as a number or array), a string\n        that contains a name of a physical type, or a\n        `~astropy.units.PhysicalType` instance.\n\n    Returns\n    -------\n    `~astropy.units.PhysicalType`\n        A representation of the physical type(s) of the unit.\n\n    Examples\n    --------\n    The physical type may be retrieved from a unit or a\n    `~astropy.units.Quantity`.\n\n    >>> import astropy.units as u\n    >>> u.get_physical_type(u.meter ** -2)\n    PhysicalType('column density')\n    >>> u.get_physical_type(0.62 * u.barn * u.Mpc)\n    PhysicalType('volume')\n\n    The physical type may also be retrieved by providing a `str` that\n    contains the name of a physical type.\n\n    >>> u.get_physical_type(\"energy\")\n    PhysicalType({'energy', 'torque', 'work'})\n\n    Numbers and arrays of numbers correspond to a dimensionless physical\n    type.\n\n    >>> u.get_physical_type(1)\n    PhysicalType('dimensionless')\n    ","endLoc":550,"header":"def get_physical_type(obj)","id":1349,"name":"get_physical_type","nodeType":"Function","startLoc":489,"text":"def get_physical_type(obj):\n    \"\"\"\n    Return the physical type that corresponds to a unit (or another\n    physical type representation).\n\n    Parameters\n    ----------\n    obj : quantity-like or `~astropy.units.PhysicalType`-like\n        An object that (implicitly or explicitly) has a corresponding\n        physical type. This object may be a unit, a\n        `~astropy.units.Quantity`, an object that can be converted to a\n        `~astropy.units.Quantity` (such as a number or array), a string\n        that contains a name of a physical type, or a\n        `~astropy.units.PhysicalType` instance.\n\n    Returns\n    -------\n    `~astropy.units.PhysicalType`\n        A representation of the physical type(s) of the unit.\n\n    Examples\n    --------\n    The physical type may be retrieved from a unit or a\n    `~astropy.units.Quantity`.\n\n    >>> import astropy.units as u\n    >>> u.get_physical_type(u.meter ** -2)\n    PhysicalType('column density')\n    >>> u.get_physical_type(0.62 * u.barn * u.Mpc)\n    PhysicalType('volume')\n\n    The physical type may also be retrieved by providing a `str` that\n    contains the name of a physical type.\n\n    >>> u.get_physical_type(\"energy\")\n    PhysicalType({'energy', 'torque', 'work'})\n\n    Numbers and arrays of numbers correspond to a dimensionless physical\n    type.\n\n    >>> u.get_physical_type(1)\n    PhysicalType('dimensionless')\n    \"\"\"\n    if isinstance(obj, PhysicalType):\n        return obj\n\n    if isinstance(obj, str):\n        return _physical_type_from_str(obj)\n\n    try:\n        unit = obj if isinstance(obj, core.UnitBase) else quantity.Quantity(obj, copy=False).unit\n    except TypeError as exc:\n        raise TypeError(f\"{obj} does not correspond to a physical type.\") from exc\n\n    unit = _replace_temperatures_with_kelvin(unit)\n    physical_type_id = unit._get_physical_type_id()\n    unit_has_known_physical_type = physical_type_id in _physical_unit_mapping\n\n    if unit_has_known_physical_type:\n        return _physical_unit_mapping[physical_type_id]\n    else:\n        return PhysicalType(unit, \"unknown\")"},{"attributeType":"null","col":16,"comment":"null","endLoc":11,"id":1350,"name":"np","nodeType":"Attribute","startLoc":11,"text":"np"},{"attributeType":"null","col":26,"comment":"null","endLoc":13,"id":1351,"name":"chararray","nodeType":"Attribute","startLoc":13,"text":"chararray"},{"attributeType":"null","col":4,"comment":"The length of a Card image; should always be 80 for valid FITS files.","endLoc":44,"id":1352,"name":"length","nodeType":"Attribute","startLoc":44,"text":"length"},{"attributeType":"null","col":4,"comment":"null","endLoc":48,"id":1353,"name":"_keywd_FSC_RE","nodeType":"Attribute","startLoc":48,"text":"_keywd_FSC_RE"},{"attributeType":"null","col":4,"comment":"null","endLoc":50,"id":1354,"name":"_keywd_hierarch_RE","nodeType":"Attribute","startLoc":50,"text":"_keywd_hierarch_RE"},{"attributeType":"null","col":4,"comment":"null","endLoc":57,"id":1355,"name":"_digits_FSC","nodeType":"Attribute","startLoc":57,"text":"_digits_FSC"},{"attributeType":"null","col":4,"comment":"null","endLoc":58,"id":1356,"name":"_digits_NFSC","nodeType":"Attribute","startLoc":58,"text":"_digits_NFSC"},{"attributeType":"null","col":4,"comment":"null","endLoc":59,"id":1357,"name":"_numr_FSC","nodeType":"Attribute","startLoc":59,"text":"_numr_FSC"},{"attributeType":"null","col":4,"comment":"null","endLoc":60,"id":1358,"name":"_numr_NFSC","nodeType":"Attribute","startLoc":60,"text":"_numr_NFSC"},{"attributeType":"null","col":4,"comment":"null","endLoc":65,"id":1359,"name":"_number_FSC_RE","nodeType":"Attribute","startLoc":65,"text":"_number_FSC_RE"},{"attributeType":"null","col":4,"comment":"null","endLoc":66,"id":1360,"name":"_number_NFSC_RE","nodeType":"Attribute","startLoc":66,"text":"_number_NFSC_RE"},{"attributeType":"null","col":4,"comment":"null","endLoc":71,"id":1361,"name":"_strg","nodeType":"Attribute","startLoc":71,"text":"_strg"},{"attributeType":"null","col":4,"comment":"null","endLoc":72,"id":1362,"name":"_comm_field","nodeType":"Attribute","startLoc":72,"text":"_comm_field"},{"attributeType":"null","col":4,"comment":"null","endLoc":73,"id":1363,"name":"_strg_comment_RE","nodeType":"Attribute","startLoc":73,"text":"_strg_comment_RE"},{"attributeType":"null","col":4,"comment":"null","endLoc":77,"id":1364,"name":"_ascii_text_re","nodeType":"Attribute","startLoc":77,"text":"_ascii_text_re"},{"attributeType":"null","col":4,"comment":"null","endLoc":86,"id":1365,"name":"_value_FSC_RE","nodeType":"Attribute","startLoc":86,"text":"_value_FSC_RE"},{"attributeType":"null","col":4,"comment":"null","endLoc":116,"id":1366,"name":"_value_NFSC_RE","nodeType":"Attribute","startLoc":116,"text":"_value_NFSC_RE"},{"attributeType":"null","col":4,"comment":"null","endLoc":127,"id":1367,"name":"_rvkc_identifier","nodeType":"Attribute","startLoc":127,"text":"_rvkc_identifier"},{"attributeType":"null","col":4,"comment":"null","endLoc":128,"id":1368,"name":"_rvkc_field","nodeType":"Attribute","startLoc":128,"text":"_rvkc_field"},{"attributeType":"null","col":4,"comment":"null","endLoc":129,"id":1369,"name":"_rvkc_field_specifier_s","nodeType":"Attribute","startLoc":129,"text":"_rvkc_field_specifier_s"},{"attributeType":"null","col":4,"comment":"null","endLoc":130,"id":1370,"name":"_rvkc_field_specifier_val","nodeType":"Attribute","startLoc":130,"text":"_rvkc_field_specifier_val"},{"attributeType":"null","col":4,"comment":"null","endLoc":132,"id":1371,"name":"_rvkc_keyword_val","nodeType":"Attribute","startLoc":132,"text":"_rvkc_keyword_val"},{"attributeType":"null","col":4,"comment":"null","endLoc":133,"id":1372,"name":"_rvkc_keyword_val_comm","nodeType":"Attribute","startLoc":133,"text":"_rvkc_keyword_val_comm"},{"attributeType":"null","col":4,"comment":"null","endLoc":136,"id":1373,"name":"_rvkc_field_specifier_val_RE","nodeType":"Attribute","startLoc":136,"text":"_rvkc_field_specifier_val_RE"},{"attributeType":"null","col":4,"comment":"null","endLoc":141,"id":1374,"name":"_rvkc_keyword_name_RE","nodeType":"Attribute","startLoc":141,"text":"_rvkc_keyword_name_RE"},{"fileName":"connect.py","filePath":"astropy/io/fits","id":1375,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport os\nimport re\nimport warnings\nfrom copy import deepcopy\n\nimport numpy as np\n\nfrom astropy.io import registry as io_registry\nfrom astropy import units as u\nfrom astropy.table import Table, serialize, meta, Column, MaskedColumn\nfrom astropy.time import Time\nfrom astropy.utils.data_info import serialize_context_as\nfrom astropy.utils.exceptions import (AstropyUserWarning,\n                                      AstropyDeprecationWarning)\nfrom astropy.utils.misc import NOT_OVERWRITING_MSG\nfrom . import HDUList, TableHDU, BinTableHDU, GroupsHDU, append as fits_append\nfrom .column import KEYWORD_NAMES, _fortran_to_python_format\nfrom .convenience import table_to_hdu\nfrom .hdu.hdulist import fitsopen as fits_open, FITS_SIGNATURE\nfrom .util import first\n\n\n# Keywords to remove for all tables that are read in\nREMOVE_KEYWORDS = ['XTENSION', 'BITPIX', 'NAXIS', 'NAXIS1', 'NAXIS2',\n                   'PCOUNT', 'GCOUNT', 'TFIELDS', 'THEAP']\n\n# Column-specific keywords regex\nCOLUMN_KEYWORD_REGEXP = '(' + '|'.join(KEYWORD_NAMES) + ')[0-9]+'\n\n\ndef is_column_keyword(keyword):\n    return re.match(COLUMN_KEYWORD_REGEXP, keyword) is not None\n\n\ndef is_fits(origin, filepath, fileobj, *args, **kwargs):\n    \"\"\"\n    Determine whether `origin` is a FITS file.\n\n    Parameters\n    ----------\n    origin : str or readable file-like\n        Path or file object containing a potential FITS file.\n\n    Returns\n    -------\n    is_fits : bool\n        Returns `True` if the given file is a FITS file.\n    \"\"\"\n    if fileobj is not None:\n        pos = fileobj.tell()\n        sig = fileobj.read(30)\n        fileobj.seek(pos)\n        return sig == FITS_SIGNATURE\n    elif filepath is not None:\n        if filepath.lower().endswith(('.fits', '.fits.gz', '.fit', '.fit.gz',\n                                      '.fts', '.fts.gz')):\n            return True\n    elif isinstance(args[0], (HDUList, TableHDU, BinTableHDU, GroupsHDU)):\n        return True\n    else:\n        return False\n\n\ndef _decode_mixins(tbl):\n    \"\"\"Decode a Table ``tbl`` that has astropy Columns + appropriate meta-data into\n    the corresponding table with mixin columns (as appropriate).\n    \"\"\"\n    # If available read in __serialized_columns__ meta info which is stored\n    # in FITS COMMENTS between two sentinels.\n    try:\n        i0 = tbl.meta['comments'].index('--BEGIN-ASTROPY-SERIALIZED-COLUMNS--')\n        i1 = tbl.meta['comments'].index('--END-ASTROPY-SERIALIZED-COLUMNS--')\n    except (ValueError, KeyError):\n        return tbl\n\n    # The YAML data are split into COMMENT cards, with lines longer than 70\n    # characters being split with a continuation character \\ (backslash).\n    # Strip the backslashes and join together.\n    continuation_line = False\n    lines = []\n    for line in tbl.meta['comments'][i0 + 1:i1]:\n        if continuation_line:\n            lines[-1] = lines[-1] + line[:70]\n        else:\n            lines.append(line[:70])\n        continuation_line = len(line) == 71\n\n    del tbl.meta['comments'][i0:i1 + 1]\n    if not tbl.meta['comments']:\n        del tbl.meta['comments']\n\n    info = meta.get_header_from_yaml(lines)\n\n    # Add serialized column information to table meta for use in constructing mixins\n    tbl.meta['__serialized_columns__'] = info['meta']['__serialized_columns__']\n\n    # Use the `datatype` attribute info to update column attributes that are\n    # NOT already handled via standard FITS column keys (name, dtype, unit).\n    for col in info['datatype']:\n        for attr in ['description', 'meta']:\n            if attr in col:\n                setattr(tbl[col['name']].info, attr, col[attr])\n\n    # Construct new table with mixins, using tbl.meta['__serialized_columns__']\n    # as guidance.\n    tbl = serialize._construct_mixins_from_columns(tbl)\n\n    return tbl\n\n\ndef read_table_fits(input, hdu=None, astropy_native=False, memmap=False,\n                    character_as_bytes=True, unit_parse_strict='warn'):\n    \"\"\"\n    Read a Table object from an FITS file\n\n    If the ``astropy_native`` argument is ``True``, then input FITS columns\n    which are representations of an astropy core object will be converted to\n    that class and stored in the ``Table`` as \"mixin columns\".  Currently this\n    is limited to FITS columns which adhere to the FITS Time standard, in which\n    case they will be converted to a `~astropy.time.Time` column in the output\n    table.\n\n    Parameters\n    ----------\n    input : str or file-like or compatible `astropy.io.fits` HDU object\n        If a string, the filename to read the table from. If a file object, or\n        a compatible HDU object, the object to extract the table from. The\n        following `astropy.io.fits` HDU objects can be used as input:\n        - :class:`~astropy.io.fits.hdu.table.TableHDU`\n        - :class:`~astropy.io.fits.hdu.table.BinTableHDU`\n        - :class:`~astropy.io.fits.hdu.table.GroupsHDU`\n        - :class:`~astropy.io.fits.hdu.hdulist.HDUList`\n    hdu : int or str, optional\n        The HDU to read the table from.\n    astropy_native : bool, optional\n        Read in FITS columns as native astropy objects where possible instead\n        of standard Table Column objects. Default is False.\n    memmap : bool, optional\n        Whether to use memory mapping, which accesses data on disk as needed. If\n        you are only accessing part of the data, this is often more efficient.\n        If you want to access all the values in the table, and you are able to\n        fit the table in memory, you may be better off leaving memory mapping\n        off. However, if your table would not fit in memory, you should set this\n        to `True`.\n    character_as_bytes : bool, optional\n        If `True`, string columns are stored as Numpy byte arrays (dtype ``S``)\n        and are converted on-the-fly to unicode strings when accessing\n        individual elements. If you need to use Numpy unicode arrays (dtype\n        ``U``) internally, you should set this to `False`, but note that this\n        will use more memory. If set to `False`, string columns will not be\n        memory-mapped even if ``memmap`` is `True`.\n    unit_parse_strict : str, optional\n        Behaviour when encountering invalid column units in the FITS header.\n        Default is \"warn\", which will emit a ``UnitsWarning`` and create a\n        :class:`~astropy.units.core.UnrecognizedUnit`.\n        Values are the ones allowed by the ``parse_strict`` argument of\n        :class:`~astropy.units.core.Unit`: ``raise``, ``warn`` and ``silent``.\n\n    \"\"\"\n\n    if isinstance(input, HDUList):\n\n        # Parse all table objects\n        tables = dict()\n        for ihdu, hdu_item in enumerate(input):\n            if isinstance(hdu_item, (TableHDU, BinTableHDU, GroupsHDU)):\n                tables[ihdu] = hdu_item\n\n        if len(tables) > 1:\n            if hdu is None:\n                warnings.warn(\"hdu= was not specified but multiple tables\"\n                              \" are present, reading in first available\"\n                              f\" table (hdu={first(tables)})\",\n                              AstropyUserWarning)\n                hdu = first(tables)\n\n            # hdu might not be an integer, so we first need to convert it\n            # to the correct HDU index\n            hdu = input.index_of(hdu)\n\n            if hdu in tables:\n                table = tables[hdu]\n            else:\n                raise ValueError(f\"No table found in hdu={hdu}\")\n\n        elif len(tables) == 1:\n            if hdu is not None:\n                msg = None\n                try:\n                    hdi = input.index_of(hdu)\n                except KeyError:\n                    msg = f\"Specified hdu={hdu} not found\"\n                else:\n                    if hdi >= len(input):\n                        msg = f\"Specified hdu={hdu} not found\"\n                    elif hdi not in tables:\n                        msg = f\"No table found in specified hdu={hdu}\"\n                if msg is not None:\n                    warnings.warn(f\"{msg}, reading in first available table \"\n                                  f\"(hdu={first(tables)}) instead. This will\"\n                                  \" result in an error in future versions!\",\n                                  AstropyDeprecationWarning)\n            table = tables[first(tables)]\n\n        else:\n            raise ValueError(\"No table found\")\n\n    elif isinstance(input, (TableHDU, BinTableHDU, GroupsHDU)):\n\n        table = input\n\n    else:\n\n        hdulist = fits_open(input, character_as_bytes=character_as_bytes,\n                            memmap=memmap)\n\n        try:\n            return read_table_fits(\n                hdulist, hdu=hdu,\n                astropy_native=astropy_native,\n                unit_parse_strict=unit_parse_strict,\n            )\n        finally:\n            hdulist.close()\n\n    # In the loop below we access the data using data[col.name] rather than\n    # col.array to make sure that the data is scaled correctly if needed.\n    data = table.data\n\n    columns = []\n    for col in data.columns:\n        # Check if column is masked. Here, we make a guess based on the\n        # presence of FITS mask values. For integer columns, this is simply\n        # the null header, for float and complex, the presence of NaN, and for\n        # string, empty strings.\n        # Since Multi-element columns with dtypes such as '2f8' have a subdtype,\n        # we should look up the type of column on that.\n        masked = mask = False\n        coltype = (col.dtype.subdtype[0].type if col.dtype.subdtype\n                   else col.dtype.type)\n        if col.null is not None:\n            mask = data[col.name] == col.null\n            # Return a MaskedColumn even if no elements are masked so\n            # we roundtrip better.\n            masked = True\n        elif issubclass(coltype, np.inexact):\n            mask = np.isnan(data[col.name])\n        elif issubclass(coltype, np.character):\n            mask = col.array == b''\n\n        if masked or np.any(mask):\n            column = MaskedColumn(data=data[col.name], name=col.name,\n                                  mask=mask, copy=False)\n        else:\n            column = Column(data=data[col.name], name=col.name, copy=False)\n\n        # Copy over units\n        if col.unit is not None:\n            column.unit = u.Unit(col.unit, format='fits', parse_strict=unit_parse_strict)\n\n        # Copy over display format\n        if col.disp is not None:\n            column.format = _fortran_to_python_format(col.disp)\n\n        columns.append(column)\n\n    # Create Table object\n    t = Table(columns, copy=False)\n\n    # TODO: deal properly with unsigned integers\n\n    hdr = table.header\n    if astropy_native:\n        # Avoid circular imports, and also only import if necessary.\n        from .fitstime import fits_to_time\n        hdr = fits_to_time(hdr, t)\n\n    for key, value, comment in hdr.cards:\n\n        if key in ['COMMENT', 'HISTORY']:\n            # Convert to io.ascii format\n            if key == 'COMMENT':\n                key = 'comments'\n\n            if key in t.meta:\n                t.meta[key].append(value)\n            else:\n                t.meta[key] = [value]\n\n        elif key in t.meta:  # key is duplicate\n\n            if isinstance(t.meta[key], list):\n                t.meta[key].append(value)\n            else:\n                t.meta[key] = [t.meta[key], value]\n\n        elif is_column_keyword(key) or key in REMOVE_KEYWORDS:\n\n            pass\n\n        else:\n\n            t.meta[key] = value\n\n    # TODO: implement masking\n\n    # Decode any mixin columns that have been stored as standard Columns.\n    t = _decode_mixins(t)\n\n    return t\n\n\ndef _encode_mixins(tbl):\n    \"\"\"Encode a Table ``tbl`` that may have mixin columns to a Table with only\n    astropy Columns + appropriate meta-data to allow subsequent decoding.\n    \"\"\"\n    # Determine if information will be lost without serializing meta.  This is hardcoded\n    # to the set difference between column info attributes and what FITS can store\n    # natively (name, dtype, unit).  See _get_col_attributes() in table/meta.py for where\n    # this comes from.\n    info_lost = any(any(getattr(col.info, attr, None) not in (None, {})\n                        for attr in ('description', 'meta'))\n                    for col in tbl.itercols())\n\n    # Convert the table to one with no mixins, only Column objects.  This adds\n    # meta data which is extracted with meta.get_yaml_from_table.  This ignores\n    # Time-subclass columns and leave them in the table so that the downstream\n    # FITS Time handling does the right thing.\n\n    with serialize_context_as('fits'):\n        encode_tbl = serialize.represent_mixins_as_columns(\n            tbl, exclude_classes=(Time,))\n\n    # If the encoded table is unchanged then there were no mixins.  But if there\n    # is column metadata (format, description, meta) that would be lost, then\n    # still go through the serialized columns machinery.\n    if encode_tbl is tbl and not info_lost:\n        return tbl\n\n    # Copy the meta dict if it was not copied by represent_mixins_as_columns.\n    # We will modify .meta['comments'] below and we do not want to see these\n    # comments in the input table.\n    if encode_tbl is tbl:\n        meta_copy = deepcopy(tbl.meta)\n        encode_tbl = Table(tbl.columns, meta=meta_copy, copy=False)\n\n    # Get the YAML serialization of information describing the table columns.\n    # This is re-using ECSV code that combined existing table.meta with with\n    # the extra __serialized_columns__ key.  For FITS the table.meta is handled\n    # by the native FITS connect code, so don't include that in the YAML\n    # output.\n    ser_col = '__serialized_columns__'\n\n    # encode_tbl might not have a __serialized_columns__ key if there were no mixins,\n    # but machinery below expects it to be available, so just make an empty dict.\n    encode_tbl.meta.setdefault(ser_col, {})\n\n    tbl_meta_copy = encode_tbl.meta.copy()\n    try:\n        encode_tbl.meta = {ser_col: encode_tbl.meta[ser_col]}\n        meta_yaml_lines = meta.get_yaml_from_table(encode_tbl)\n    finally:\n        encode_tbl.meta = tbl_meta_copy\n    del encode_tbl.meta[ser_col]\n\n    if 'comments' not in encode_tbl.meta:\n        encode_tbl.meta['comments'] = []\n    encode_tbl.meta['comments'].append('--BEGIN-ASTROPY-SERIALIZED-COLUMNS--')\n\n    for line in meta_yaml_lines:\n        if len(line) == 0:\n            lines = ['']\n        else:\n            # Split line into 70 character chunks for COMMENT cards\n            idxs = list(range(0, len(line) + 70, 70))\n            lines = [line[i0:i1] + '\\\\' for i0, i1 in zip(idxs[:-1], idxs[1:])]\n            lines[-1] = lines[-1][:-1]\n        encode_tbl.meta['comments'].extend(lines)\n\n    encode_tbl.meta['comments'].append('--END-ASTROPY-SERIALIZED-COLUMNS--')\n\n    return encode_tbl\n\n\ndef write_table_fits(input, output, overwrite=False, append=False):\n    \"\"\"\n    Write a Table object to a FITS file\n\n    Parameters\n    ----------\n    input : Table\n        The table to write out.\n    output : str\n        The filename to write the table to.\n    overwrite : bool\n        Whether to overwrite any existing file without warning.\n    append : bool\n        Whether to append the table to an existing file\n    \"\"\"\n\n    # Encode any mixin columns into standard Columns.\n    input = _encode_mixins(input)\n\n    table_hdu = table_to_hdu(input, character_as_bytes=True)\n\n    # Check if output file already exists\n    if isinstance(output, str) and os.path.exists(output):\n        if overwrite:\n            os.remove(output)\n        elif not append:\n            raise OSError(NOT_OVERWRITING_MSG.format(output))\n\n    if append:\n        # verify=False stops it reading and checking the existing file.\n        fits_append(output, table_hdu.data, table_hdu.header, verify=False)\n    else:\n        table_hdu.writeto(output)\n\n\nio_registry.register_reader('fits', Table, read_table_fits)\nio_registry.register_writer('fits', Table, write_table_fits)\nio_registry.register_identifier('fits', Table, is_fits)\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":148,"id":1376,"name":"_rvkc_keyword_val_comm_RE","nodeType":"Attribute","startLoc":148,"text":"_rvkc_keyword_val_comm_RE"},{"attributeType":"null","col":4,"comment":"null","endLoc":150,"id":1377,"name":"_commentary_keywords","nodeType":"Attribute","startLoc":150,"text":"_commentary_keywords"},{"attributeType":"null","col":4,"comment":"null","endLoc":151,"id":1378,"name":"_special_keywords","nodeType":"Attribute","startLoc":151,"text":"_special_keywords"},{"col":0,"comment":"Temporarily replace the module's get_caller_module_dict.\n\n    This is a function inside ``ply.lex`` and ``ply.yacc`` (each has a copy)\n    that is used to retrieve the caller's local symbols. Here, we patch the\n    function to instead retrieve the grandparent's local symbols to account\n    for a wrapper layer.\n    ","endLoc":59,"header":"@contextlib.contextmanager\ndef _patch_get_caller_module_dict(module)","id":1379,"name":"_patch_get_caller_module_dict","nodeType":"Function","startLoc":41,"text":"@contextlib.contextmanager\ndef _patch_get_caller_module_dict(module):\n    \"\"\"Temporarily replace the module's get_caller_module_dict.\n\n    This is a function inside ``ply.lex`` and ``ply.yacc`` (each has a copy)\n    that is used to retrieve the caller's local symbols. Here, we patch the\n    function to instead retrieve the grandparent's local symbols to account\n    for a wrapper layer.\n    \"\"\"\n    original = module.get_caller_module_dict\n\n    @functools.wraps(original)\n    def wrapper(levels):\n        # Add 2, not 1, because the wrapper itself adds another level\n        return original(levels + 2)\n\n    module.get_caller_module_dict = wrapper\n    yield\n    module.get_caller_module_dict = original"},{"attributeType":"null","col":4,"comment":"null","endLoc":155,"id":1380,"name":"_value_indicator","nodeType":"Attribute","startLoc":155,"text":"_value_indicator"},{"attributeType":"null","col":8,"comment":"null","endLoc":184,"id":1381,"name":"_rawkeyword","nodeType":"Attribute","startLoc":184,"text":"self._rawkeyword"},{"col":0,"comment":"null","endLoc":1046,"header":"def lex(module=None, object=None, debug=False, optimize=False, lextab='lextab',\n        reflags=int(re.VERBOSE), nowarn=False, outputdir=None, debuglog=None, errorlog=None)","id":1382,"name":"lex","nodeType":"Function","startLoc":862,"text":"def lex(module=None, object=None, debug=False, optimize=False, lextab='lextab',\n        reflags=int(re.VERBOSE), nowarn=False, outputdir=None, debuglog=None, errorlog=None):\n\n    if lextab is None:\n        lextab = 'lextab'\n\n    global lexer\n\n    ldict = None\n    stateinfo  = {'INITIAL': 'inclusive'}\n    lexobj = Lexer()\n    lexobj.lexoptimize = optimize\n    global token, input\n\n    if errorlog is None:\n        errorlog = PlyLogger(sys.stderr)\n\n    if debug:\n        if debuglog is None:\n            debuglog = PlyLogger(sys.stderr)\n\n    # Get the module dictionary used for the lexer\n    if object:\n        module = object\n\n    # Get the module dictionary used for the parser\n    if module:\n        _items = [(k, getattr(module, k)) for k in dir(module)]\n        ldict = dict(_items)\n        # If no __file__ attribute is available, try to obtain it from the __module__ instead\n        if '__file__' not in ldict:\n            ldict['__file__'] = sys.modules[ldict['__module__']].__file__\n    else:\n        ldict = get_caller_module_dict(2)\n\n    # Determine if the module is package of a package or not.\n    # If so, fix the tabmodule setting so that tables load correctly\n    pkg = ldict.get('__package__')\n    if pkg and isinstance(lextab, str):\n        if '.' not in lextab:\n            lextab = pkg + '.' + lextab\n\n    # Collect parser information from the dictionary\n    linfo = LexerReflect(ldict, log=errorlog, reflags=reflags)\n    linfo.get_all()\n    if not optimize:\n        if linfo.validate_all():\n            raise SyntaxError(\"Can't build lexer\")\n\n    if optimize and lextab:\n        try:\n            lexobj.readtab(lextab, ldict)\n            token = lexobj.token\n            input = lexobj.input\n            lexer = lexobj\n            return lexobj\n\n        except ImportError:\n            pass\n\n    # Dump some basic debugging information\n    if debug:\n        debuglog.info('lex: tokens   = %r', linfo.tokens)\n        debuglog.info('lex: literals = %r', linfo.literals)\n        debuglog.info('lex: states   = %r', linfo.stateinfo)\n\n    # Build a dictionary of valid token names\n    lexobj.lextokens = set()\n    for n in linfo.tokens:\n        lexobj.lextokens.add(n)\n\n    # Get literals specification\n    if isinstance(linfo.literals, (list, tuple)):\n        lexobj.lexliterals = type(linfo.literals[0])().join(linfo.literals)\n    else:\n        lexobj.lexliterals = linfo.literals\n\n    lexobj.lextokens_all = lexobj.lextokens | set(lexobj.lexliterals)\n\n    # Get the stateinfo dictionary\n    stateinfo = linfo.stateinfo\n\n    regexs = {}\n    # Build the master regular expressions\n    for state in stateinfo:\n        regex_list = []\n\n        # Add rules defined by functions first\n        for fname, f in linfo.funcsym[state]:\n            regex_list.append('(?P<%s>%s)' % (fname, _get_regex(f)))\n            if debug:\n                debuglog.info(\"lex: Adding rule %s -> '%s' (state '%s')\", fname, _get_regex(f), state)\n\n        # Now add all of the simple rules\n        for name, r in linfo.strsym[state]:\n            regex_list.append('(?P<%s>%s)' % (name, r))\n            if debug:\n                debuglog.info(\"lex: Adding rule %s -> '%s' (state '%s')\", name, r, state)\n\n        regexs[state] = regex_list\n\n    # Build the master regular expressions\n\n    if debug:\n        debuglog.info('lex: ==== MASTER REGEXS FOLLOW ====')\n\n    for state in regexs:\n        lexre, re_text, re_names = _form_master_re(regexs[state], reflags, ldict, linfo.toknames)\n        lexobj.lexstatere[state] = lexre\n        lexobj.lexstateretext[state] = re_text\n        lexobj.lexstaterenames[state] = re_names\n        if debug:\n            for i, text in enumerate(re_text):\n                debuglog.info(\"lex: state '%s' : regex[%d] = '%s'\", state, i, text)\n\n    # For inclusive states, we need to add the regular expressions from the INITIAL state\n    for state, stype in stateinfo.items():\n        if state != 'INITIAL' and stype == 'inclusive':\n            lexobj.lexstatere[state].extend(lexobj.lexstatere['INITIAL'])\n            lexobj.lexstateretext[state].extend(lexobj.lexstateretext['INITIAL'])\n            lexobj.lexstaterenames[state].extend(lexobj.lexstaterenames['INITIAL'])\n\n    lexobj.lexstateinfo = stateinfo\n    lexobj.lexre = lexobj.lexstatere['INITIAL']\n    lexobj.lexretext = lexobj.lexstateretext['INITIAL']\n    lexobj.lexreflags = reflags\n\n    # Set up ignore variables\n    lexobj.lexstateignore = linfo.ignore\n    lexobj.lexignore = lexobj.lexstateignore.get('INITIAL', '')\n\n    # Set up error functions\n    lexobj.lexstateerrorf = linfo.errorf\n    lexobj.lexerrorf = linfo.errorf.get('INITIAL', None)\n    if not lexobj.lexerrorf:\n        errorlog.warning('No t_error rule is defined')\n\n    # Set up eof functions\n    lexobj.lexstateeoff = linfo.eoff\n    lexobj.lexeoff = linfo.eoff.get('INITIAL', None)\n\n    # Check state information for ignore and error rules\n    for s, stype in stateinfo.items():\n        if stype == 'exclusive':\n            if s not in linfo.errorf:\n                errorlog.warning(\"No error rule is defined for exclusive state '%s'\", s)\n            if s not in linfo.ignore and lexobj.lexignore:\n                errorlog.warning(\"No ignore rule is defined for exclusive state '%s'\", s)\n        elif stype == 'inclusive':\n            if s not in linfo.errorf:\n                linfo.errorf[s] = linfo.errorf.get('INITIAL', None)\n            if s not in linfo.ignore:\n                linfo.ignore[s] = linfo.ignore.get('INITIAL', '')\n\n    # Create global versions of the token() and input() functions\n    token = lexobj.token\n    input = lexobj.input\n    lexer = lexobj\n\n    # If in optimize mode, we write the lextab\n    if lextab and optimize:\n        if outputdir is None:\n            # If no output directory is set, the location of the output files\n            # is determined according to the following rules:\n            #     - If lextab specifies a package, files go into that package directory\n            #     - Otherwise, files go in the same directory as the specifying module\n            if isinstance(lextab, types.ModuleType):\n                srcfile = lextab.__file__\n            else:\n                if '.' not in lextab:\n                    srcfile = ldict['__file__']\n                else:\n                    parts = lextab.split('.')\n                    pkgname = '.'.join(parts[:-1])\n                    exec('import %s' % pkgname)\n                    srcfile = getattr(sys.modules[pkgname], '__file__', '')\n            outputdir = os.path.dirname(srcfile)\n        try:\n            lexobj.writetab(lextab, outputdir)\n            if lextab in sys.modules:\n                del sys.modules[lextab]\n        except IOError as e:\n            errorlog.warning(\"Couldn't write lextab module %r. %s\" % (lextab, e))\n\n    return lexobj"},{"col":4,"comment":"\n        Do not store fields in _converted if one of its bases is self,\n        or if it has a common base with self.\n\n        This results in a reference cycle that cannot be broken since\n        ndarrays do not participate in cyclic garbage collection.\n        ","endLoc":757,"header":"def _cache_field(self, name, field)","id":1383,"name":"_cache_field","nodeType":"Function","startLoc":731,"text":"def _cache_field(self, name, field):\n        \"\"\"\n        Do not store fields in _converted if one of its bases is self,\n        or if it has a common base with self.\n\n        This results in a reference cycle that cannot be broken since\n        ndarrays do not participate in cyclic garbage collection.\n        \"\"\"\n\n        base = field\n        while True:\n            self_base = self\n            while True:\n                if self_base is base:\n                    return\n\n                if getattr(self_base, 'base', None) is not None:\n                    self_base = self_base.base\n                else:\n                    break\n\n            if getattr(base, 'base', None) is not None:\n                base = base.base\n            else:\n                break\n\n        self._converted[name] = field"},{"col":4,"comment":"null","endLoc":533,"header":"def __getitem__(self, key)","id":1384,"name":"__getitem__","nodeType":"Function","startLoc":496,"text":"def __getitem__(self, key):\n        if self._coldefs is None:\n            return super().__getitem__(key)\n\n        if isinstance(key, str):\n            return self.field(key)\n\n        # Have to view as a recarray then back as a FITS_rec, otherwise the\n        # circular reference fix/hack in FITS_rec.field() won't preserve\n        # the slice.\n        out = self.view(np.recarray)[key]\n        if type(out) is not np.recarray:\n            # Oops, we got a single element rather than a view. In that case,\n            # return a Record, which has no __getstate__ and is more efficient.\n            return self._record_type(self, key)\n\n        # We got a view; change it back to our class, and add stuff\n        out = out.view(type(self))\n        out._uint = self._uint\n        out._coldefs = ColDefs(self._coldefs)\n        arrays = []\n        out._converted = {}\n        for idx, name in enumerate(self._coldefs.names):\n            #\n            # Store the new arrays for the _coldefs object\n            #\n            arrays.append(self._coldefs._arrays[idx][key])\n\n            # Ensure that the sliced FITS_rec will view the same scaled\n            # columns as the original; this is one of the few cases where\n            # it is not necessary to use _cache_field()\n            if name in self._converted:\n                dummy = self._converted[name]\n                field = np.ndarray.__getitem__(dummy, key)\n                out._converted[name] = field\n\n        out._coldefs._arrays = arrays\n        return out"},{"attributeType":"null","col":8,"comment":"null","endLoc":171,"id":1385,"name":"_verified","nodeType":"Attribute","startLoc":171,"text":"self._verified"},{"attributeType":"null","col":8,"comment":"null","endLoc":200,"id":1386,"name":"_valuemodified","nodeType":"Attribute","startLoc":200,"text":"self._valuemodified"},{"attributeType":"null","col":8,"comment":"null","endLoc":179,"id":1387,"name":"_invalid","nodeType":"Attribute","startLoc":179,"text":"self._invalid"},{"attributeType":"null","col":8,"comment":"null","endLoc":181,"id":1388,"name":"_field_specifier","nodeType":"Attribute","startLoc":181,"text":"self._field_specifier"},{"col":4,"comment":"null","endLoc":142,"header":"def __init__(self)","id":1389,"name":"__init__","nodeType":"Function","startLoc":116,"text":"def __init__(self):\n        self.lexre = None             # Master regular expression. This is a list of\n                                      # tuples (re, findex) where re is a compiled\n                                      # regular expression and findex is a list\n                                      # mapping regex group numbers to rules\n        self.lexretext = None         # Current regular expression strings\n        self.lexstatere = {}          # Dictionary mapping lexer states to master regexs\n        self.lexstateretext = {}      # Dictionary mapping lexer states to regex strings\n        self.lexstaterenames = {}     # Dictionary mapping lexer states to symbol names\n        self.lexstate = 'INITIAL'     # Current lexer state\n        self.lexstatestack = []       # Stack of lexer states\n        self.lexstateinfo = None      # State information\n        self.lexstateignore = {}      # Dictionary of ignored characters for each state\n        self.lexstateerrorf = {}      # Dictionary of error functions for each state\n        self.lexstateeoff = {}        # Dictionary of eof functions for each state\n        self.lexreflags = 0           # Optional re compile flags\n        self.lexdata = None           # Actual input data (as a string)\n        self.lexpos = 0               # Current position in input text\n        self.lexlen = 0               # Length of the input text\n        self.lexerrorf = None         # Error rule (if any)\n        self.lexeoff = None           # EOF rule (if any)\n        self.lextokens = None         # List of valid tokens\n        self.lexignore = ''           # Ignored characters\n        self.lexliterals = ''         # Literal characters that can be passed through\n        self.lexmodule = None         # Module\n        self.lineno = 1               # Current line number\n        self.lexoptimize = False      # Optimized mode"},{"attributeType":"null","col":8,"comment":"null","endLoc":166,"id":1390,"name":"_image","nodeType":"Attribute","startLoc":166,"text":"self._image"},{"attributeType":"null","col":8,"comment":"null","endLoc":185,"id":1391,"name":"_rawvalue","nodeType":"Attribute","startLoc":185,"text":"self._rawvalue"},{"attributeType":"null","col":8,"comment":"null","endLoc":162,"id":1392,"name":"_keyword","nodeType":"Attribute","startLoc":162,"text":"self._keyword"},{"attributeType":"null","col":16,"comment":"null","endLoc":255,"id":1393,"name":"_value_indicator","nodeType":"Attribute","startLoc":255,"text":"self._value_indicator"},{"attributeType":"null","col":8,"comment":"null","endLoc":164,"id":1394,"name":"_comment","nodeType":"Attribute","startLoc":164,"text":"self._comment"},{"col":4,"comment":"Creates a column format from a Numpy record dtype format.","endLoc":344,"header":"@classmethod\n    def from_recformat(cls, recformat)","id":1395,"name":"from_recformat","nodeType":"Function","startLoc":340,"text":"@classmethod\n    def from_recformat(cls, recformat):\n        \"\"\"Creates a column format from a Numpy record dtype format.\"\"\"\n\n        return cls(_convert_ascii_format(recformat, reverse=True))"},{"col":0,"comment":"Convert ASCII table format spec to record format spec.","endLoc":2494,"header":"def _convert_ascii_format(format, reverse=False)","id":1396,"name":"_convert_ascii_format","nodeType":"Function","startLoc":2441,"text":"def _convert_ascii_format(format, reverse=False):\n    \"\"\"Convert ASCII table format spec to record format spec.\"\"\"\n\n    if reverse:\n        recformat, kind, dtype = _dtype_to_recformat(format)\n        itemsize = dtype.itemsize\n\n        if kind == 'a':\n            return 'A' + str(itemsize)\n        elif NUMPY2FITS.get(recformat) == 'L':\n            # Special case for logical/boolean types--for ASCII tables we\n            # represent these as single character columns containing 'T' or 'F'\n            # (a la the storage format for Logical columns in binary tables)\n            return 'A1'\n        elif kind == 'i':\n            # Use for the width the maximum required to represent integers\n            # of that byte size plus 1 for signs, but use a minimum of the\n            # default width (to keep with existing behavior)\n            width = 1 + len(str(2 ** (itemsize * 8)))\n            width = max(width, ASCII_DEFAULT_WIDTHS['I'][0])\n            return 'I' + str(width)\n        elif kind == 'f':\n            # This is tricky, but go ahead and use D if float-64, and E\n            # if float-32 with their default widths\n            if itemsize >= 8:\n                format = 'D'\n            else:\n                format = 'E'\n            width = '.'.join(str(w) for w in ASCII_DEFAULT_WIDTHS[format])\n            return format + width\n        # TODO: There may be reasonable ways to represent other Numpy types so\n        # let's see what other possibilities there are besides just 'a', 'i',\n        # and 'f'.  If it doesn't have a reasonable ASCII representation then\n        # raise an exception\n    else:\n        format, width, precision = _parse_ascii_tformat(format)\n\n        # This gives a sensible \"default\" dtype for a given ASCII\n        # format code\n        recformat = ASCII2NUMPY[format]\n\n        # The following logic is taken from CFITSIO:\n        # For integers, if the width <= 4 we can safely use 16-bit ints for all\n        # values, if width >= 10 we may need to accommodate 64-bit ints.\n        # values [for the non-standard J format code just always force 64-bit]\n        if format == 'I':\n            if width <= 4:\n                recformat = 'i2'\n            elif width > 9:\n                recformat = 'i8'\n        elif format == 'A':\n            recformat += str(width)\n\n        return recformat"},{"attributeType":"null","col":8,"comment":"null","endLoc":175,"id":1397,"name":"_hierarch","nodeType":"Attribute","startLoc":175,"text":"self._hierarch"},{"col":4,"comment":"null","endLoc":77,"header":"def __init__(self, f)","id":1398,"name":"__init__","nodeType":"Function","startLoc":76,"text":"def __init__(self, f):\n        self.f = f"},{"attributeType":"null","col":8,"comment":"null","endLoc":163,"id":1399,"name":"_value","nodeType":"Attribute","startLoc":163,"text":"self._value"},{"attributeType":"null","col":12,"comment":"null","endLoc":197,"id":1400,"name":"comment","nodeType":"Attribute","startLoc":197,"text":"self.comment"},{"attributeType":"null","col":16,"comment":"null","endLoc":192,"id":1401,"name":"keyword","nodeType":"Attribute","startLoc":192,"text":"self.keyword"},{"attributeType":"null","col":16,"comment":"null","endLoc":194,"id":1402,"name":"value","nodeType":"Attribute","startLoc":194,"text":"self.value"},{"attributeType":"null","col":8,"comment":"null","endLoc":199,"id":1403,"name":"_modified","nodeType":"Attribute","startLoc":199,"text":"self._modified"},{"attributeType":"null","col":8,"comment":"null","endLoc":165,"id":1404,"name":"_valuestring","nodeType":"Attribute","startLoc":165,"text":"self._valuestring"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":1405,"name":"BLANK_CARD","nodeType":"Attribute","startLoc":23,"text":"BLANK_CARD"},{"className":"HDUList","col":0,"comment":"\n    HDU list class.  This is the top-level FITS object.  When a FITS\n    file is opened, a `HDUList` object is returned.\n    ","endLoc":1469,"id":1406,"nodeType":"Class","startLoc":179,"text":"class HDUList(list, _Verify):\n    \"\"\"\n    HDU list class.  This is the top-level FITS object.  When a FITS\n    file is opened, a `HDUList` object is returned.\n    \"\"\"\n\n    def __init__(self, hdus=[], file=None):\n        \"\"\"\n        Construct a `HDUList` object.\n\n        Parameters\n        ----------\n        hdus : BaseHDU or sequence thereof, optional\n            The HDU object(s) to comprise the `HDUList`.  Should be\n            instances of HDU classes like `ImageHDU` or `BinTableHDU`.\n\n        file : file-like, bytes, optional\n            The opened physical file associated with the `HDUList`\n            or a bytes object containing the contents of the FITS\n            file.\n        \"\"\"\n\n        if isinstance(file, bytes):\n            self._data = file\n            self._file = None\n        else:\n            self._file = file\n            self._data = None\n\n        # For internal use only--the keyword args passed to fitsopen /\n        # HDUList.fromfile/string when opening the file\n        self._open_kwargs = {}\n        self._in_read_next_hdu = False\n\n        # If we have read all the HDUs from the file or not\n        # The assumes that all HDUs have been written when we first opened the\n        # file; we do not currently support loading additional HDUs from a file\n        # while it is being streamed to.  In the future that might be supported\n        # but for now this is only used for the purpose of lazy-loading of\n        # existing HDUs.\n        if file is None:\n            self._read_all = True\n        elif self._file is not None:\n            # Should never attempt to read HDUs in ostream mode\n            self._read_all = self._file.mode == 'ostream'\n        else:\n            self._read_all = False\n\n        if hdus is None:\n            hdus = []\n\n        # can take one HDU, as well as a list of HDU's as input\n        if isinstance(hdus, _ValidHDU):\n            hdus = [hdus]\n        elif not isinstance(hdus, (HDUList, list)):\n            raise TypeError(\"Invalid input for HDUList.\")\n\n        for idx, hdu in enumerate(hdus):\n            if not isinstance(hdu, _BaseHDU):\n                raise TypeError(f\"Element {idx} in the HDUList input is not an HDU.\")\n\n        super().__init__(hdus)\n\n        if file is None:\n            # Only do this when initializing from an existing list of HDUs\n            # When initializing from a file, this will be handled by the\n            # append method after the first HDU is read\n            self.update_extend()\n\n    def __len__(self):\n        if not self._in_read_next_hdu:\n            self.readall()\n\n        return super().__len__()\n\n    def __repr__(self):\n        # In order to correctly repr an HDUList we need to load all the\n        # HDUs as well\n        self.readall()\n\n        return super().__repr__()\n\n    def __iter__(self):\n        # While effectively this does the same as:\n        # for idx in range(len(self)):\n        #     yield self[idx]\n        # the more complicated structure is here to prevent the use of len(),\n        # which would break the lazy loading\n        for idx in itertools.count():\n            try:\n                yield self[idx]\n            except IndexError:\n                break\n\n    def __getitem__(self, key):\n        \"\"\"\n        Get an HDU from the `HDUList`, indexed by number or name.\n        \"\"\"\n\n        # If the key is a slice we need to make sure the necessary HDUs\n        # have been loaded before passing the slice on to super.\n        if isinstance(key, slice):\n            max_idx = key.stop\n            # Check for and handle the case when no maximum was\n            # specified (e.g. [1:]).\n            if max_idx is None:\n                # We need all of the HDUs, so load them\n                # and reset the maximum to the actual length.\n                max_idx = len(self)\n\n            # Just in case the max_idx is negative...\n            max_idx = self._positive_index_of(max_idx)\n\n            number_loaded = super().__len__()\n\n            if max_idx >= number_loaded:\n                # We need more than we have, try loading up to and including\n                # max_idx. Note we do not try to be clever about skipping HDUs\n                # even though key.step might conceivably allow it.\n                for i in range(number_loaded, max_idx):\n                    # Read until max_idx or to the end of the file, whichever\n                    # comes first.\n                    if not self._read_next_hdu():\n                        break\n\n            try:\n                hdus = super().__getitem__(key)\n            except IndexError as e:\n                # Raise a more helpful IndexError if the file was not fully read.\n                if self._read_all:\n                    raise e\n                else:\n                    raise IndexError('HDU not found, possibly because the index '\n                                     'is out of range, or because the file was '\n                                     'closed before all HDUs were read')\n            else:\n                return HDUList(hdus)\n\n        # Originally this used recursion, but hypothetically an HDU with\n        # a very large number of HDUs could blow the stack, so use a loop\n        # instead\n        try:\n            return self._try_while_unread_hdus(super().__getitem__,\n                                               self._positive_index_of(key))\n        except IndexError as e:\n            # Raise a more helpful IndexError if the file was not fully read.\n            if self._read_all:\n                raise e\n            else:\n                raise IndexError('HDU not found, possibly because the index '\n                                 'is out of range, or because the file was '\n                                 'closed before all HDUs were read')\n\n    def __contains__(self, item):\n        \"\"\"\n        Returns `True` if ``item`` is an ``HDU`` _in_ ``self`` or a valid\n        extension specification (e.g., integer extension number, extension\n        name, or a tuple of extension name and an extension version)\n        of a ``HDU`` in ``self``.\n\n        \"\"\"\n        try:\n            self._try_while_unread_hdus(self.index_of, item)\n        except (KeyError, ValueError):\n            return False\n\n        return True\n\n    def __setitem__(self, key, hdu):\n        \"\"\"\n        Set an HDU to the `HDUList`, indexed by number or name.\n        \"\"\"\n\n        _key = self._positive_index_of(key)\n        if isinstance(hdu, (slice, list)):\n            if _is_int(_key):\n                raise ValueError('An element in the HDUList must be an HDU.')\n            for item in hdu:\n                if not isinstance(item, _BaseHDU):\n                    raise ValueError(f'{item} is not an HDU.')\n        else:\n            if not isinstance(hdu, _BaseHDU):\n                raise ValueError(f'{hdu} is not an HDU.')\n\n        try:\n            self._try_while_unread_hdus(super().__setitem__, _key, hdu)\n        except IndexError:\n            raise IndexError(f'Extension {key} is out of bound or not found.')\n\n        self._resize = True\n        self._truncate = False\n\n    def __delitem__(self, key):\n        \"\"\"\n        Delete an HDU from the `HDUList`, indexed by number or name.\n        \"\"\"\n\n        if isinstance(key, slice):\n            end_index = len(self)\n        else:\n            key = self._positive_index_of(key)\n            end_index = len(self) - 1\n\n        self._try_while_unread_hdus(super().__delitem__, key)\n\n        if (key == end_index or key == -1 and not self._resize):\n            self._truncate = True\n        else:\n            self._truncate = False\n            self._resize = True\n\n    # Support the 'with' statement\n    def __enter__(self):\n        return self\n\n    def __exit__(self, type, value, traceback):\n        output_verify = self._open_kwargs.get('output_verify', 'exception')\n        self.close(output_verify=output_verify)\n\n    @classmethod\n    def fromfile(cls, fileobj, mode=None, memmap=None,\n                 save_backup=False, cache=True, lazy_load_hdus=True,\n                 ignore_missing_simple=False, **kwargs):\n        \"\"\"\n        Creates an `HDUList` instance from a file-like object.\n\n        The actual implementation of ``fitsopen()``, and generally shouldn't\n        be used directly.  Use :func:`open` instead (and see its\n        documentation for details of the parameters accepted by this method).\n        \"\"\"\n\n        return cls._readfrom(fileobj=fileobj, mode=mode, memmap=memmap,\n                             save_backup=save_backup, cache=cache,\n                             ignore_missing_simple=ignore_missing_simple,\n                             lazy_load_hdus=lazy_load_hdus, **kwargs)\n\n    @classmethod\n    def fromstring(cls, data, **kwargs):\n        \"\"\"\n        Creates an `HDUList` instance from a string or other in-memory data\n        buffer containing an entire FITS file.  Similar to\n        :meth:`HDUList.fromfile`, but does not accept the mode or memmap\n        arguments, as they are only relevant to reading from a file on disk.\n\n        This is useful for interfacing with other libraries such as CFITSIO,\n        and may also be useful for streaming applications.\n\n        Parameters\n        ----------\n        data : str, buffer-like, etc.\n            A string or other memory buffer containing an entire FITS file.\n            Buffer-like objects include :class:`~bytes`, :class:`~bytearray`,\n            :class:`~memoryview`, and :class:`~numpy.ndarray`.\n            It should be noted that if that memory is read-only (such as a\n            Python string) the returned :class:`HDUList`'s data portions will\n            also be read-only.\n        **kwargs : dict\n            Optional keyword arguments.  See\n            :func:`astropy.io.fits.open` for details.\n\n        Returns\n        -------\n        hdul : HDUList\n            An :class:`HDUList` object representing the in-memory FITS file.\n        \"\"\"\n\n        try:\n            # Test that the given object supports the buffer interface by\n            # ensuring an ndarray can be created from it\n            np.ndarray((), dtype='ubyte', buffer=data)\n        except TypeError:\n            raise TypeError(\n                'The provided object {} does not contain an underlying '\n                'memory buffer.  fromstring() requires an object that '\n                'supports the buffer interface such as bytes, buffer, '\n                'memoryview, ndarray, etc.  This restriction is to ensure '\n                'that efficient access to the array/table data is possible.'\n                ''.format(data))\n\n        return cls._readfrom(data=data, **kwargs)\n\n    def fileinfo(self, index):\n        \"\"\"\n        Returns a dictionary detailing information about the locations\n        of the indexed HDU within any associated file.  The values are\n        only valid after a read or write of the associated file with\n        no intervening changes to the `HDUList`.\n\n        Parameters\n        ----------\n        index : int\n            Index of HDU for which info is to be returned.\n\n        Returns\n        -------\n        fileinfo : dict or None\n\n            The dictionary details information about the locations of\n            the indexed HDU within an associated file.  Returns `None`\n            when the HDU is not associated with a file.\n\n            Dictionary contents:\n\n            ========== ========================================================\n            Key        Value\n            ========== ========================================================\n            file       File object associated with the HDU\n            filename   Name of associated file object\n            filemode   Mode in which the file was opened (readonly,\n                       update, append, denywrite, ostream)\n            resized    Flag that when `True` indicates that the data has been\n                       resized since the last read/write so the returned values\n                       may not be valid.\n            hdrLoc     Starting byte location of header in file\n            datLoc     Starting byte location of data block in file\n            datSpan    Data size including padding\n            ========== ========================================================\n\n        \"\"\"\n\n        if self._file is not None:\n            output = self[index].fileinfo()\n\n            if not output:\n                # OK, the HDU associated with this index is not yet\n                # tied to the file associated with the HDUList.  The only way\n                # to get the file object is to check each of the HDU's in the\n                # list until we find the one associated with the file.\n                f = None\n\n                for hdu in self:\n                    info = hdu.fileinfo()\n\n                    if info:\n                        f = info['file']\n                        fm = info['filemode']\n                        break\n\n                output = {'file': f, 'filemode': fm, 'hdrLoc': None,\n                          'datLoc': None, 'datSpan': None}\n\n            output['filename'] = self._file.name\n            output['resized'] = self._wasresized()\n        else:\n            output = None\n\n        return output\n\n    def __copy__(self):\n        \"\"\"\n        Return a shallow copy of an HDUList.\n\n        Returns\n        -------\n        copy : `HDUList`\n            A shallow copy of this `HDUList` object.\n\n        \"\"\"\n\n        return self[:]\n\n    # Syntactic sugar for `__copy__()` magic method\n    copy = __copy__\n\n    def __deepcopy__(self, memo=None):\n        return HDUList([hdu.copy() for hdu in self])\n\n    def pop(self, index=-1):\n        \"\"\" Remove an item from the list and return it.\n\n        Parameters\n        ----------\n        index : int, str, tuple of (string, int), optional\n            An integer value of ``index`` indicates the position from which\n            ``pop()`` removes and returns an HDU. A string value or a tuple\n            of ``(string, int)`` functions as a key for identifying the\n            HDU to be removed and returned. If ``key`` is a tuple, it is\n            of the form ``(key, ver)`` where ``ver`` is an ``EXTVER``\n            value that must match the HDU being searched for.\n\n            If the key is ambiguous (e.g. there are multiple 'SCI' extensions)\n            the first match is returned.  For a more precise match use the\n            ``(name, ver)`` pair.\n\n            If even the ``(name, ver)`` pair is ambiguous the numeric index\n            must be used to index the duplicate HDU.\n\n        Returns\n        -------\n        hdu : BaseHDU\n            The HDU object at position indicated by ``index`` or having name\n            and version specified by ``index``.\n        \"\"\"\n\n        # Make sure that HDUs are loaded before attempting to pop\n        self.readall()\n        list_index = self.index_of(index)\n        return super().pop(list_index)\n\n    def insert(self, index, hdu):\n        \"\"\"\n        Insert an HDU into the `HDUList` at the given ``index``.\n\n        Parameters\n        ----------\n        index : int\n            Index before which to insert the new HDU.\n\n        hdu : BaseHDU\n            The HDU object to insert\n        \"\"\"\n\n        if not isinstance(hdu, _BaseHDU):\n            raise ValueError(f'{hdu} is not an HDU.')\n\n        num_hdus = len(self)\n\n        if index == 0 or num_hdus == 0:\n            if num_hdus != 0:\n                # We are inserting a new Primary HDU so we need to\n                # make the current Primary HDU into an extension HDU.\n                if isinstance(self[0], GroupsHDU):\n                    raise ValueError(\n                        \"The current Primary HDU is a GroupsHDU.  \"\n                        \"It can't be made into an extension HDU, \"\n                        \"so another HDU cannot be inserted before it.\")\n\n                hdu1 = ImageHDU(self[0].data, self[0].header)\n\n                # Insert it into position 1, then delete HDU at position 0.\n                super().insert(1, hdu1)\n                super().__delitem__(0)\n\n            if not isinstance(hdu, (PrimaryHDU, _NonstandardHDU)):\n                # You passed in an Extension HDU but we need a Primary HDU.\n                # If you provided an ImageHDU then we can convert it to\n                # a primary HDU and use that.\n                if isinstance(hdu, ImageHDU):\n                    hdu = PrimaryHDU(hdu.data, hdu.header)\n                else:\n                    # You didn't provide an ImageHDU so we create a\n                    # simple Primary HDU and append that first before\n                    # we append the new Extension HDU.\n                    phdu = PrimaryHDU()\n\n                    super().insert(0, phdu)\n                    index = 1\n        else:\n            if isinstance(hdu, GroupsHDU):\n                raise ValueError('A GroupsHDU must be inserted as a '\n                                 'Primary HDU.')\n\n            if isinstance(hdu, PrimaryHDU):\n                # You passed a Primary HDU but we need an Extension HDU\n                # so create an Extension HDU from the input Primary HDU.\n                hdu = ImageHDU(hdu.data, hdu.header)\n\n        super().insert(index, hdu)\n        hdu._new = True\n        self._resize = True\n        self._truncate = False\n        # make sure the EXTEND keyword is in primary HDU if there is extension\n        self.update_extend()\n\n    def append(self, hdu):\n        \"\"\"\n        Append a new HDU to the `HDUList`.\n\n        Parameters\n        ----------\n        hdu : BaseHDU\n            HDU to add to the `HDUList`.\n        \"\"\"\n\n        if not isinstance(hdu, _BaseHDU):\n            raise ValueError('HDUList can only append an HDU.')\n\n        if len(self) > 0:\n            if isinstance(hdu, GroupsHDU):\n                raise ValueError(\n                    \"Can't append a GroupsHDU to a non-empty HDUList\")\n\n            if isinstance(hdu, PrimaryHDU):\n                # You passed a Primary HDU but we need an Extension HDU\n                # so create an Extension HDU from the input Primary HDU.\n                # TODO: This isn't necessarily sufficient to copy the HDU;\n                # _header_offset and friends need to be copied too.\n                hdu = ImageHDU(hdu.data, hdu.header)\n        else:\n            if not isinstance(hdu, (PrimaryHDU, _NonstandardHDU)):\n                # You passed in an Extension HDU but we need a Primary\n                # HDU.\n                # If you provided an ImageHDU then we can convert it to\n                # a primary HDU and use that.\n                if isinstance(hdu, ImageHDU):\n                    hdu = PrimaryHDU(hdu.data, hdu.header)\n                else:\n                    # You didn't provide an ImageHDU so we create a\n                    # simple Primary HDU and append that first before\n                    # we append the new Extension HDU.\n                    phdu = PrimaryHDU()\n                    super().append(phdu)\n\n        super().append(hdu)\n        hdu._new = True\n        self._resize = True\n        self._truncate = False\n\n        # make sure the EXTEND keyword is in primary HDU if there is extension\n        self.update_extend()\n\n    def index_of(self, key):\n        \"\"\"\n        Get the index of an HDU from the `HDUList`.\n\n        Parameters\n        ----------\n        key : int, str, tuple of (string, int) or BaseHDU\n            The key identifying the HDU.  If ``key`` is a tuple, it is of the\n            form ``(name, ver)`` where ``ver`` is an ``EXTVER`` value that must\n            match the HDU being searched for.\n\n            If the key is ambiguous (e.g. there are multiple 'SCI' extensions)\n            the first match is returned.  For a more precise match use the\n            ``(name, ver)`` pair.\n\n            If even the ``(name, ver)`` pair is ambiguous (it shouldn't be\n            but it's not impossible) the numeric index must be used to index\n            the duplicate HDU.\n\n            When ``key`` is an HDU object, this function returns the\n            index of that HDU object in the ``HDUList``.\n\n        Returns\n        -------\n        index : int\n            The index of the HDU in the `HDUList`.\n\n        Raises\n        ------\n        ValueError\n            If ``key`` is an HDU object and it is not found in the ``HDUList``.\n        KeyError\n            If an HDU specified by the ``key`` that is an extension number,\n            extension name, or a tuple of extension name and version is not\n            found in the ``HDUList``.\n\n        \"\"\"\n\n        if _is_int(key):\n            return key\n        elif isinstance(key, tuple):\n            _key, _ver = key\n        elif isinstance(key, _BaseHDU):\n            return self.index(key)\n        else:\n            _key = key\n            _ver = None\n\n        if not isinstance(_key, str):\n            raise KeyError(\n                '{} indices must be integers, extension names as strings, '\n                'or (extname, version) tuples; got {}'\n                ''.format(self.__class__.__name__, _key))\n\n        _key = (_key.strip()).upper()\n\n        found = None\n        for idx, hdu in enumerate(self):\n            name = hdu.name\n            if isinstance(name, str):\n                name = name.strip().upper()\n            # 'PRIMARY' should always work as a reference to the first HDU\n            if ((name == _key or (_key == 'PRIMARY' and idx == 0)) and\n                    (_ver is None or _ver == hdu.ver)):\n                found = idx\n                break\n\n        if (found is None):\n            raise KeyError(f'Extension {key!r} not found.')\n        else:\n            return found\n\n    def _positive_index_of(self, key):\n        \"\"\"\n        Same as index_of, but ensures always returning a positive index\n        or zero.\n\n        (Really this should be called non_negative_index_of but it felt\n        too long.)\n\n        This means that if the key is a negative integer, we have to\n        convert it to the corresponding positive index.  This means\n        knowing the length of the HDUList, which in turn means loading\n        all HDUs.  Therefore using negative indices on HDULists is inherently\n        inefficient.\n        \"\"\"\n\n        index = self.index_of(key)\n\n        if index >= 0:\n            return index\n\n        if abs(index) > len(self):\n            raise IndexError(\n                f'Extension {index} is out of bound or not found.')\n\n        return len(self) + index\n\n    def readall(self):\n        \"\"\"\n        Read data of all HDUs into memory.\n        \"\"\"\n        while self._read_next_hdu():\n            pass\n\n    @ignore_sigint\n    def flush(self, output_verify='fix', verbose=False):\n        \"\"\"\n        Force a write of the `HDUList` back to the file (for append and\n        update modes only).\n\n        Parameters\n        ----------\n        output_verify : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        verbose : bool\n            When `True`, print verbose messages\n        \"\"\"\n\n        if self._file.mode not in ('append', 'update', 'ostream'):\n            warnings.warn(\"Flush for '{}' mode is not supported.\"\n                          .format(self._file.mode), AstropyUserWarning)\n            return\n\n        save_backup = self._open_kwargs.get('save_backup', False)\n        if save_backup and self._file.mode in ('append', 'update'):\n            filename = self._file.name\n            if os.path.exists(filename):\n                # The the file doesn't actually exist anymore for some reason\n                # then there's no point in trying to make a backup\n                backup = filename + '.bak'\n                idx = 1\n                while os.path.exists(backup):\n                    backup = filename + '.bak.' + str(idx)\n                    idx += 1\n                warnings.warn('Saving a backup of {} to {}.'.format(\n                        filename, backup), AstropyUserWarning)\n                try:\n                    shutil.copy(filename, backup)\n                except OSError as exc:\n                    raise OSError('Failed to save backup to destination {}: '\n                                  '{}'.format(filename, exc))\n\n        self.verify(option=output_verify)\n\n        if self._file.mode in ('append', 'ostream'):\n            for hdu in self:\n                if verbose:\n                    try:\n                        extver = str(hdu._header['extver'])\n                    except KeyError:\n                        extver = ''\n\n                # only append HDU's which are \"new\"\n                if hdu._new:\n                    hdu._prewriteto(checksum=hdu._output_checksum)\n                    with _free_space_check(self):\n                        hdu._writeto(self._file)\n                        if verbose:\n                            print('append HDU', hdu.name, extver)\n                        hdu._new = False\n                    hdu._postwriteto()\n\n        elif self._file.mode == 'update':\n            self._flush_update()\n\n    def update_extend(self):\n        \"\"\"\n        Make sure that if the primary header needs the keyword ``EXTEND`` that\n        it has it and it is correct.\n        \"\"\"\n\n        if not len(self):\n            return\n\n        if not isinstance(self[0], PrimaryHDU):\n            # A PrimaryHDU will be automatically inserted at some point, but it\n            # might not have been added yet\n            return\n\n        hdr = self[0].header\n\n        def get_first_ext():\n            try:\n                return self[1]\n            except IndexError:\n                return None\n\n        if 'EXTEND' in hdr:\n            if not hdr['EXTEND'] and get_first_ext() is not None:\n                hdr['EXTEND'] = True\n        elif get_first_ext() is not None:\n            if hdr['NAXIS'] == 0:\n                hdr.set('EXTEND', True, after='NAXIS')\n            else:\n                n = hdr['NAXIS']\n                hdr.set('EXTEND', True, after='NAXIS' + str(n))\n\n    def writeto(self, fileobj, output_verify='exception', overwrite=False,\n                checksum=False):\n        \"\"\"\n        Write the `HDUList` to a new file.\n\n        Parameters\n        ----------\n        fileobj : str, file-like or `pathlib.Path`\n            File to write to.  If a file object, must be opened in a\n            writeable mode.\n\n        output_verify : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n\n        checksum : bool\n            When `True` adds both ``DATASUM`` and ``CHECKSUM`` cards\n            to the headers of all HDU's written to the file.\n        \"\"\"\n\n        if (len(self) == 0):\n            warnings.warn(\"There is nothing to write.\", AstropyUserWarning)\n            return\n\n        self.verify(option=output_verify)\n\n        # make sure the EXTEND keyword is there if there is extension\n        self.update_extend()\n\n        # make note of whether the input file object is already open, in which\n        # case we should not close it after writing (that should be the job\n        # of the caller)\n        closed = isinstance(fileobj, str) or fileobj_closed(fileobj)\n\n        mode = FILE_MODES[fileobj_mode(fileobj)] if isfile(fileobj) else 'ostream'\n\n        # This can accept an open file object that's open to write only, or in\n        # append/update modes but only if the file doesn't exist.\n        fileobj = _File(fileobj, mode=mode, overwrite=overwrite)\n        hdulist = self.fromfile(fileobj)\n        try:\n            dirname = os.path.dirname(hdulist._file.name)\n        except (AttributeError, TypeError):\n            dirname = None\n\n        with _free_space_check(self, dirname=dirname):\n            for hdu in self:\n                hdu._prewriteto(checksum=checksum)\n                hdu._writeto(hdulist._file)\n                hdu._postwriteto()\n        hdulist.close(output_verify=output_verify, closed=closed)\n\n    def close(self, output_verify='exception', verbose=False, closed=True):\n        \"\"\"\n        Close the associated FITS file and memmap object, if any.\n\n        Parameters\n        ----------\n        output_verify : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        verbose : bool\n            When `True`, print out verbose messages.\n\n        closed : bool\n            When `True`, close the underlying file object.\n        \"\"\"\n\n        try:\n            if (self._file and self._file.mode in ('append', 'update')\n                    and not self._file.closed):\n                self.flush(output_verify=output_verify, verbose=verbose)\n        finally:\n            if self._file and closed and hasattr(self._file, 'close'):\n                self._file.close()\n\n            # Give individual HDUs an opportunity to do on-close cleanup\n            for hdu in self:\n                hdu._close(closed=closed)\n\n    def info(self, output=None):\n        \"\"\"\n        Summarize the info of the HDUs in this `HDUList`.\n\n        Note that this function prints its results to the console---it\n        does not return a value.\n\n        Parameters\n        ----------\n        output : file-like or bool, optional\n            A file-like object to write the output to.  If `False`, does not\n            output to a file and instead returns a list of tuples representing\n            the HDU info.  Writes to ``sys.stdout`` by default.\n        \"\"\"\n\n        if output is None:\n            output = sys.stdout\n\n        if self._file is None:\n            name = '(No file associated with this HDUList)'\n        else:\n            name = self._file.name\n\n        results = [f'Filename: {name}',\n                   'No.    Name      Ver    Type      Cards   Dimensions   Format']\n\n        format = '{:3d}  {:10}  {:3} {:11}  {:5d}   {}   {}   {}'\n        default = ('', '', '', 0, (), '', '')\n        for idx, hdu in enumerate(self):\n            summary = hdu._summary()\n            if len(summary) < len(default):\n                summary += default[len(summary):]\n            summary = (idx,) + summary\n            if output:\n                results.append(format.format(*summary))\n            else:\n                results.append(summary)\n\n        if output:\n            output.write('\\n'.join(results))\n            output.write('\\n')\n            output.flush()\n        else:\n            return results[2:]\n\n    def filename(self):\n        \"\"\"\n        Return the file name associated with the HDUList object if one exists.\n        Otherwise returns None.\n\n        Returns\n        -------\n        filename : str\n            A string containing the file name associated with the HDUList\n            object if an association exists.  Otherwise returns None.\n\n        \"\"\"\n        if self._file is not None:\n            if hasattr(self._file, 'name'):\n                return self._file.name\n        return None\n\n    @classmethod\n    def _readfrom(cls, fileobj=None, data=None, mode=None, memmap=None,\n                  cache=True, lazy_load_hdus=True, ignore_missing_simple=False,\n                  **kwargs):\n        \"\"\"\n        Provides the implementations from HDUList.fromfile and\n        HDUList.fromstring, both of which wrap this method, as their\n        implementations are largely the same.\n        \"\"\"\n\n        if fileobj is not None:\n            if not isinstance(fileobj, _File):\n                # instantiate a FITS file object (ffo)\n                fileobj = _File(fileobj, mode=mode, memmap=memmap, cache=cache)\n            # The Astropy mode is determined by the _File initializer if the\n            # supplied mode was None\n            mode = fileobj.mode\n            hdulist = cls(file=fileobj)\n        else:\n            if mode is None:\n                # The default mode\n                mode = 'readonly'\n\n            hdulist = cls(file=data)\n            # This method is currently only called from HDUList.fromstring and\n            # HDUList.fromfile.  If fileobj is None then this must be the\n            # fromstring case; the data type of ``data`` will be checked in the\n            # _BaseHDU.fromstring call.\n\n        if (not ignore_missing_simple and\n                hdulist._file and\n                hdulist._file.mode != 'ostream' and\n                hdulist._file.size > 0):\n            pos = hdulist._file.tell()\n            # FITS signature is supposed to be in the first 30 bytes, but to\n            # allow reading various invalid files we will check in the first\n            # card (80 bytes).\n            simple = hdulist._file.read(80)\n            match_sig = (simple[:29] == FITS_SIGNATURE[:-1] and\n                         simple[29:30] in (b'T', b'F'))\n\n            if not match_sig:\n                # Check the SIMPLE card is there but not written correctly\n                match_sig_relaxed = re.match(rb\"SIMPLE\\s*=\\s*[T|F]\", simple)\n\n                if match_sig_relaxed:\n                    warnings.warn(\"Found a SIMPLE card but its format doesn't\"\n                                  \" respect the FITS Standard\", VerifyWarning)\n                else:\n                    if hdulist._file.close_on_error:\n                        hdulist._file.close()\n                    raise OSError(\n                        'No SIMPLE card found, this file does not appear to '\n                        'be a valid FITS file. If this is really a FITS file, '\n                        'try with ignore_missing_simple=True')\n\n            hdulist._file.seek(pos)\n\n        # Store additional keyword args that were passed to fits.open\n        hdulist._open_kwargs = kwargs\n\n        if fileobj is not None and fileobj.writeonly:\n            # Output stream--not interested in reading/parsing\n            # the HDUs--just writing to the output file\n            return hdulist\n\n        # Make sure at least the PRIMARY HDU can be read\n        read_one = hdulist._read_next_hdu()\n\n        # If we're trying to read only and no header units were found,\n        # raise an exception\n        if not read_one and mode in ('readonly', 'denywrite'):\n            # Close the file if necessary (issue #6168)\n            if hdulist._file.close_on_error:\n                hdulist._file.close()\n\n            raise OSError('Empty or corrupt FITS file')\n\n        if not lazy_load_hdus or kwargs.get('checksum') is True:\n            # Go ahead and load all HDUs\n            while hdulist._read_next_hdu():\n                pass\n\n        # initialize/reset attributes to be used in \"update/append\" mode\n        hdulist._resize = False\n        hdulist._truncate = False\n\n        return hdulist\n\n    def _try_while_unread_hdus(self, func, *args, **kwargs):\n        \"\"\"\n        Attempt an operation that accesses an HDU by index/name\n        that can fail if not all HDUs have been read yet.  Keep\n        reading HDUs until the operation succeeds or there are no\n        more HDUs to read.\n        \"\"\"\n\n        while True:\n            try:\n                return func(*args, **kwargs)\n            except Exception:\n                if self._read_next_hdu():\n                    continue\n                else:\n                    raise\n\n    def _read_next_hdu(self):\n        \"\"\"\n        Lazily load a single HDU from the fileobj or data string the `HDUList`\n        was opened from, unless no further HDUs are found.\n\n        Returns True if a new HDU was loaded, or False otherwise.\n        \"\"\"\n\n        if self._read_all:\n            return False\n\n        saved_compression_enabled = compressed.COMPRESSION_ENABLED\n        fileobj, data, kwargs = self._file, self._data, self._open_kwargs\n\n        if fileobj is not None and fileobj.closed:\n            return False\n\n        try:\n            self._in_read_next_hdu = True\n\n            if ('disable_image_compression' in kwargs and\n                    kwargs['disable_image_compression']):\n                compressed.COMPRESSION_ENABLED = False\n\n            # read all HDUs\n            try:\n                if fileobj is not None:\n                    try:\n                        # Make sure we're back to the end of the last read\n                        # HDU\n                        if len(self) > 0:\n                            last = self[len(self) - 1]\n                            if last._data_offset is not None:\n                                offset = last._data_offset + last._data_size\n                                fileobj.seek(offset, os.SEEK_SET)\n\n                        hdu = _BaseHDU.readfrom(fileobj, **kwargs)\n                    except EOFError:\n                        self._read_all = True\n                        return False\n                    except OSError:\n                        # Close the file: see\n                        # https://github.com/astropy/astropy/issues/6168\n                        #\n                        if self._file.close_on_error:\n                            self._file.close()\n\n                        if fileobj.writeonly:\n                            self._read_all = True\n                            return False\n                        else:\n                            raise\n                else:\n                    if not data:\n                        self._read_all = True\n                        return False\n                    hdu = _BaseHDU.fromstring(data, **kwargs)\n                    self._data = data[hdu._data_offset + hdu._data_size:]\n\n                super().append(hdu)\n                if len(self) == 1:\n                    # Check for an extension HDU and update the EXTEND\n                    # keyword of the primary HDU accordingly\n                    self.update_extend()\n\n                hdu._new = False\n                if 'checksum' in kwargs:\n                    hdu._output_checksum = kwargs['checksum']\n            # check in the case there is extra space after the last HDU or\n            # corrupted HDU\n            except (VerifyError, ValueError) as exc:\n                warnings.warn(\n                    'Error validating header for HDU #{} (note: Astropy '\n                    'uses zero-based indexing).\\n{}\\n'\n                    'There may be extra bytes after the last HDU or the '\n                    'file is corrupted.'.format(\n                        len(self), indent(str(exc))), VerifyWarning)\n                del exc\n                self._read_all = True\n                return False\n        finally:\n            compressed.COMPRESSION_ENABLED = saved_compression_enabled\n            self._in_read_next_hdu = False\n\n        return True\n\n    def _verify(self, option='warn'):\n        errs = _ErrList([], unit='HDU')\n\n        # the first (0th) element must be a primary HDU\n        if len(self) > 0 and (not isinstance(self[0], PrimaryHDU)) and \\\n                             (not isinstance(self[0], _NonstandardHDU)):\n            err_text = \"HDUList's 0th element is not a primary HDU.\"\n            fix_text = 'Fixed by inserting one as 0th HDU.'\n\n            def fix(self=self):\n                self.insert(0, PrimaryHDU())\n\n            err = self.run_option(option, err_text=err_text,\n                                  fix_text=fix_text, fix=fix)\n            errs.append(err)\n\n        if len(self) > 1 and ('EXTEND' not in self[0].header or\n                              self[0].header['EXTEND'] is not True):\n            err_text = ('Primary HDU does not contain an EXTEND keyword '\n                        'equal to T even though there are extension HDUs.')\n            fix_text = 'Fixed by inserting or updating the EXTEND keyword.'\n\n            def fix(header=self[0].header):\n                naxis = header['NAXIS']\n                if naxis == 0:\n                    after = 'NAXIS'\n                else:\n                    after = 'NAXIS' + str(naxis)\n                header.set('EXTEND', value=True, after=after)\n\n            errs.append(self.run_option(option, err_text=err_text,\n                                        fix_text=fix_text, fix=fix))\n\n        # each element calls their own verify\n        for idx, hdu in enumerate(self):\n            if idx > 0 and (not isinstance(hdu, ExtensionHDU)):\n                err_text = f\"HDUList's element {str(idx)} is not an extension HDU.\"\n\n                err = self.run_option(option, err_text=err_text, fixable=False)\n                errs.append(err)\n\n            else:\n                result = hdu._verify(option)\n                if result:\n                    errs.append(result)\n        return errs\n\n    def _flush_update(self):\n        \"\"\"Implements flushing changes to a file in update mode.\"\"\"\n\n        for hdu in self:\n            # Need to all _prewriteto() for each HDU first to determine if\n            # resizing will be necessary\n            hdu._prewriteto(checksum=hdu._output_checksum, inplace=True)\n\n        try:\n            self._wasresized()\n\n            # if the HDUList is resized, need to write out the entire contents of\n            # the hdulist to the file.\n            if self._resize or self._file.compression:\n                self._flush_resize()\n            else:\n                # if not resized, update in place\n                for hdu in self:\n                    hdu._writeto(self._file, inplace=True)\n\n            # reset the modification attributes after updating\n            for hdu in self:\n                hdu._header._modified = False\n        finally:\n            for hdu in self:\n                hdu._postwriteto()\n\n    def _flush_resize(self):\n        \"\"\"\n        Implements flushing changes in update mode when parts of one or more HDU\n        need to be resized.\n        \"\"\"\n\n        old_name = self._file.name\n        old_memmap = self._file.memmap\n        name = _tmp_name(old_name)\n\n        if not self._file.file_like:\n            old_mode = os.stat(old_name).st_mode\n            # The underlying file is an actual file object.  The HDUList is\n            # resized, so we need to write it to a tmp file, delete the\n            # original file, and rename the tmp file to the original file.\n            if self._file.compression == 'gzip':\n                new_file = gzip.GzipFile(name, mode='ab+')\n            elif self._file.compression == 'bzip2':\n                if not HAS_BZ2:\n                    raise ModuleNotFoundError(\n                        \"This Python installation does not provide the bz2 module.\")\n                new_file = bz2.BZ2File(name, mode='w')\n            else:\n                new_file = name\n\n            with self.fromfile(new_file, mode='append') as hdulist:\n\n                for hdu in self:\n                    hdu._writeto(hdulist._file, inplace=True, copy=True)\n                if sys.platform.startswith('win'):\n                    # Collect a list of open mmaps to the data; this well be\n                    # used later.  See below.\n                    mmaps = [(idx, _get_array_mmap(hdu.data), hdu.data)\n                             for idx, hdu in enumerate(self) if hdu._has_data]\n\n                hdulist._file.close()\n                self._file.close()\n            if sys.platform.startswith('win'):\n                # Close all open mmaps to the data.  This is only necessary on\n                # Windows, which will not allow a file to be renamed or deleted\n                # until all handles to that file have been closed.\n                for idx, mmap, arr in mmaps:\n                    if mmap is not None:\n                        mmap.close()\n\n            os.remove(self._file.name)\n\n            # reopen the renamed new file with \"update\" mode\n            os.rename(name, old_name)\n            os.chmod(old_name, old_mode)\n\n            if isinstance(new_file, gzip.GzipFile):\n                old_file = gzip.GzipFile(old_name, mode='rb+')\n            else:\n                old_file = old_name\n\n            ffo = _File(old_file, mode='update', memmap=old_memmap)\n\n            self._file = ffo\n\n            for hdu in self:\n                # Need to update the _file attribute and close any open mmaps\n                # on each HDU\n                if hdu._has_data and _get_array_mmap(hdu.data) is not None:\n                    del hdu.data\n                hdu._file = ffo\n\n            if sys.platform.startswith('win'):\n                # On Windows, all the original data mmaps were closed above.\n                # However, it's possible that the user still has references to\n                # the old data which would no longer work (possibly even cause\n                # a segfault if they try to access it).  This replaces the\n                # buffers used by the original arrays with the buffers of mmap\n                # arrays created from the new file.  This seems to work, but\n                # it's a flaming hack and carries no guarantees that it won't\n                # lead to odd behavior in practice.  Better to just not keep\n                # references to data from files that had to be resized upon\n                # flushing (on Windows--again, this is no problem on Linux).\n                for idx, mmap, arr in mmaps:\n                    if mmap is not None:\n                        # https://github.com/numpy/numpy/issues/8628\n                        with warnings.catch_warnings():\n                            warnings.simplefilter('ignore', category=DeprecationWarning)\n                            arr.data = self[idx].data.data\n                del mmaps  # Just to be sure\n\n        else:\n            # The underlying file is not a file object, it is a file like\n            # object.  We can't write out to a file, we must update the file\n            # like object in place.  To do this, we write out to a temporary\n            # file, then delete the contents in our file like object, then\n            # write the contents of the temporary file to the now empty file\n            # like object.\n            self.writeto(name)\n            hdulist = self.fromfile(name)\n            ffo = self._file\n\n            ffo.truncate(0)\n            ffo.seek(0)\n\n            for hdu in hdulist:\n                hdu._writeto(ffo, inplace=True, copy=True)\n\n            # Close the temporary file and delete it.\n            hdulist.close()\n            os.remove(hdulist._file.name)\n\n        # reset the resize attributes after updating\n        self._resize = False\n        self._truncate = False\n        for hdu in self:\n            hdu._header._modified = False\n            hdu._new = False\n            hdu._file = ffo\n\n    def _wasresized(self, verbose=False):\n        \"\"\"\n        Determine if any changes to the HDUList will require a file resize\n        when flushing the file.\n\n        Side effect of setting the objects _resize attribute.\n        \"\"\"\n\n        if not self._resize:\n\n            # determine if any of the HDU is resized\n            for hdu in self:\n                # Header:\n                nbytes = len(str(hdu._header))\n                if nbytes != (hdu._data_offset - hdu._header_offset):\n                    self._resize = True\n                    self._truncate = False\n                    if verbose:\n                        print('One or more header is resized.')\n                    break\n\n                # Data:\n                if not hdu._has_data:\n                    continue\n\n                nbytes = hdu.size\n                nbytes = nbytes + _pad_length(nbytes)\n                if nbytes != hdu._data_size:\n                    self._resize = True\n                    self._truncate = False\n                    if verbose:\n                        print('One or more data area is resized.')\n                    break\n\n            if self._truncate:\n                try:\n                    self._file.truncate(hdu._data_offset + hdu._data_size)\n                except OSError:\n                    self._resize = True\n                self._truncate = False\n\n        return self._resize"},{"col":4,"comment":"null","endLoc":565,"header":"def __setitem__(self, key, value)","id":1407,"name":"__setitem__","nodeType":"Function","startLoc":535,"text":"def __setitem__(self, key, value):\n        if self._coldefs is None:\n            return super().__setitem__(key, value)\n\n        if isinstance(key, str):\n            self[key][:] = value\n            return\n\n        if isinstance(key, slice):\n            end = min(len(self), key.stop or len(self))\n            end = max(0, end)\n            start = max(0, key.start or 0)\n            end = min(end, start + len(value))\n\n            for idx in range(start, end):\n                self.__setitem__(idx, value[idx - start])\n            return\n\n        if isinstance(value, FITS_record):\n            for idx in range(self._nfields):\n                self.field(self.names[idx])[key] = value.field(self.names[idx])\n        elif isinstance(value, (tuple, list, np.void)):\n            if self._nfields == len(value):\n                for idx in range(self._nfields):\n                    self.field(idx)[key] = value[idx]\n            else:\n                raise ValueError('Input tuple or list required to have {} '\n                                 'elements.'.format(self._nfields))\n        else:\n            raise TypeError('Assignment requires a FITS_record, tuple, or '\n                            'list as input.')"},{"col":4,"comment":"null","endLoc":252,"header":"def __len__(self)","id":1408,"name":"__len__","nodeType":"Function","startLoc":248,"text":"def __len__(self):\n        if not self._in_read_next_hdu:\n            self.readall()\n\n        return super().__len__()"},{"col":4,"comment":"Returns the equivalent Numpy record format string.","endLoc":350,"header":"@lazyproperty\n    def recformat(self)","id":1409,"name":"recformat","nodeType":"Function","startLoc":346,"text":"@lazyproperty\n    def recformat(self):\n        \"\"\"Returns the equivalent Numpy record format string.\"\"\"\n\n        return _convert_ascii_format(self)"},{"className":"Table","col":0,"comment":"A class to represent tables of heterogeneous data.\n\n    `~astropy.table.Table` provides a class for heterogeneous tabular data.\n    A key enhancement provided by the `~astropy.table.Table` class over\n    e.g. a `numpy` structured array is the ability to easily modify the\n    structure of the table by adding or removing columns, or adding new\n    rows of data.  In addition table and column metadata are fully supported.\n\n    `~astropy.table.Table` differs from `~astropy.nddata.NDData` by the\n    assumption that the input data consists of columns of homogeneous data,\n    where each column has a unique identifier and may contain additional\n    metadata such as the data unit, format, and description.\n\n    See also: https://docs.astropy.org/en/stable/table/\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, table-like object, optional\n        Data to initialize table.\n    masked : bool, optional\n        Specify whether the table is masked.\n    names : list, optional\n        Specify column names.\n    dtype : list, optional\n        Specify column data types.\n    meta : dict, optional\n        Metadata associated with the table.\n    copy : bool, optional\n        Copy the input data. If the input is a Table the ``meta`` is always\n        copied regardless of the ``copy`` parameter.\n        Default is True.\n    rows : numpy ndarray, list of list, optional\n        Row-oriented data for table instead of ``data`` argument.\n    copy_indices : bool, optional\n        Copy any indices in the input data. Default is True.\n    units : list, dict, optional\n        List or dict of units to apply to columns.\n    descriptions : list, dict, optional\n        List or dict of descriptions to apply to columns.\n    **kwargs : dict, optional\n        Additional keyword args when converting table-like object.\n    ","endLoc":3905,"id":1410,"nodeType":"Class","startLoc":542,"text":"class Table:\n    \"\"\"A class to represent tables of heterogeneous data.\n\n    `~astropy.table.Table` provides a class for heterogeneous tabular data.\n    A key enhancement provided by the `~astropy.table.Table` class over\n    e.g. a `numpy` structured array is the ability to easily modify the\n    structure of the table by adding or removing columns, or adding new\n    rows of data.  In addition table and column metadata are fully supported.\n\n    `~astropy.table.Table` differs from `~astropy.nddata.NDData` by the\n    assumption that the input data consists of columns of homogeneous data,\n    where each column has a unique identifier and may contain additional\n    metadata such as the data unit, format, and description.\n\n    See also: https://docs.astropy.org/en/stable/table/\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, table-like object, optional\n        Data to initialize table.\n    masked : bool, optional\n        Specify whether the table is masked.\n    names : list, optional\n        Specify column names.\n    dtype : list, optional\n        Specify column data types.\n    meta : dict, optional\n        Metadata associated with the table.\n    copy : bool, optional\n        Copy the input data. If the input is a Table the ``meta`` is always\n        copied regardless of the ``copy`` parameter.\n        Default is True.\n    rows : numpy ndarray, list of list, optional\n        Row-oriented data for table instead of ``data`` argument.\n    copy_indices : bool, optional\n        Copy any indices in the input data. Default is True.\n    units : list, dict, optional\n        List or dict of units to apply to columns.\n    descriptions : list, dict, optional\n        List or dict of descriptions to apply to columns.\n    **kwargs : dict, optional\n        Additional keyword args when converting table-like object.\n    \"\"\"\n\n    meta = MetaData(copy=False)\n\n    # Define class attributes for core container objects to allow for subclass\n    # customization.\n    Row = Row\n    Column = Column\n    MaskedColumn = MaskedColumn\n    TableColumns = TableColumns\n    TableFormatter = TableFormatter\n\n    # Unified I/O read and write methods from .connect\n    read = UnifiedReadWriteMethod(TableRead)\n    write = UnifiedReadWriteMethod(TableWrite)\n\n    pprint_exclude_names = PprintIncludeExclude()\n    pprint_include_names = PprintIncludeExclude()\n\n    def as_array(self, keep_byteorder=False, names=None):\n        \"\"\"\n        Return a new copy of the table in the form of a structured np.ndarray or\n        np.ma.MaskedArray object (as appropriate).\n\n        Parameters\n        ----------\n        keep_byteorder : bool, optional\n            By default the returned array has all columns in native byte\n            order.  However, if this option is `True` this preserves the\n            byte order of all columns (if any are non-native).\n\n        names : list, optional:\n            List of column names to include for returned structured array.\n            Default is to include all table columns.\n\n        Returns\n        -------\n        table_array : array or `~numpy.ma.MaskedArray`\n            Copy of table as a numpy structured array.\n            ndarray for unmasked or `~numpy.ma.MaskedArray` for masked.\n        \"\"\"\n        masked = self.masked or self.has_masked_columns or self.has_masked_values\n        empty_init = ma.empty if masked else np.empty\n        if len(self.columns) == 0:\n            return empty_init(0, dtype=None)\n\n        dtype = []\n\n        cols = self.columns.values()\n\n        if names is not None:\n            cols = [col for col in cols if col.info.name in names]\n\n        for col in cols:\n            col_descr = descr(col)\n\n            if not (col.info.dtype.isnative or keep_byteorder):\n                new_dt = np.dtype(col_descr[1]).newbyteorder('=')\n                col_descr = (col_descr[0], new_dt, col_descr[2])\n\n            dtype.append(col_descr)\n\n        data = empty_init(len(self), dtype=dtype)\n        for col in cols:\n            # When assigning from one array into a field of a structured array,\n            # Numpy will automatically swap those columns to their destination\n            # byte order where applicable\n            data[col.info.name] = col\n\n            # For masked out, masked mixin columns need to set output mask attribute.\n            if masked and has_info_class(col, MixinInfo) and hasattr(col, 'mask'):\n                data[col.info.name].mask = col.mask\n\n        return data\n\n    def __init__(self, data=None, masked=False, names=None, dtype=None,\n                 meta=None, copy=True, rows=None, copy_indices=True,\n                 units=None, descriptions=None,\n                 **kwargs):\n\n        # Set up a placeholder empty table\n        self._set_masked(masked)\n        self.columns = self.TableColumns()\n        self.formatter = self.TableFormatter()\n        self._copy_indices = True  # copy indices from this Table by default\n        self._init_indices = copy_indices  # whether to copy indices in init\n        self.primary_key = None\n\n        # Must copy if dtype are changing\n        if not copy and dtype is not None:\n            raise ValueError('Cannot specify dtype when copy=False')\n\n        # Specifies list of names found for the case of initializing table with\n        # a list of dict. If data are not list of dict then this is None.\n        names_from_list_of_dict = None\n\n        # Row-oriented input, e.g. list of lists or list of tuples, list of\n        # dict, Row instance.  Set data to something that the subsequent code\n        # will parse correctly.\n        if rows is not None:\n            if data is not None:\n                raise ValueError('Cannot supply both `data` and `rows` values')\n            if isinstance(rows, types.GeneratorType):\n                # Without this then the all(..) test below uses up the generator\n                rows = list(rows)\n\n            # Get column names if `rows` is a list of dict, otherwise this is None\n            names_from_list_of_dict = _get_names_from_list_of_dict(rows)\n            if names_from_list_of_dict:\n                data = rows\n            elif isinstance(rows, self.Row):\n                data = rows\n            else:\n                data = list(zip(*rows))\n\n        # Infer the type of the input data and set up the initialization\n        # function, number of columns, and potentially the default col names\n\n        default_names = None\n\n        # Handle custom (subclass) table attributes that are stored in meta.\n        # These are defined as class attributes using the TableAttribute\n        # descriptor.  Any such attributes get removed from kwargs here and\n        # stored for use after the table is otherwise initialized. Any values\n        # provided via kwargs will have precedence over existing values from\n        # meta (e.g. from data as a Table or meta via kwargs).\n        meta_table_attrs = {}\n        if kwargs:\n            for attr in list(kwargs):\n                descr = getattr(self.__class__, attr, None)\n                if isinstance(descr, TableAttribute):\n                    meta_table_attrs[attr] = kwargs.pop(attr)\n\n        if hasattr(data, '__astropy_table__'):\n            # Data object implements the __astropy_table__ interface method.\n            # Calling that method returns an appropriate instance of\n            # self.__class__ and respects the `copy` arg.  The returned\n            # Table object should NOT then be copied.\n            data = data.__astropy_table__(self.__class__, copy, **kwargs)\n            copy = False\n        elif kwargs:\n            raise TypeError('__init__() got unexpected keyword argument {!r}'\n                            .format(list(kwargs.keys())[0]))\n\n        if (isinstance(data, np.ndarray)\n                and data.shape == (0,)\n                and not data.dtype.names):\n            data = None\n\n        if isinstance(data, self.Row):\n            data = data._table[data._index:data._index + 1]\n\n        if isinstance(data, (list, tuple)):\n            # Get column names from `data` if it is a list of dict, otherwise this is None.\n            # This might be previously defined if `rows` was supplied as an init arg.\n            names_from_list_of_dict = (names_from_list_of_dict\n                                       or _get_names_from_list_of_dict(data))\n            if names_from_list_of_dict:\n                init_func = self._init_from_list_of_dicts\n                n_cols = len(names_from_list_of_dict)\n            else:\n                init_func = self._init_from_list\n                n_cols = len(data)\n\n        elif isinstance(data, np.ndarray):\n            if data.dtype.names:\n                init_func = self._init_from_ndarray  # _struct\n                n_cols = len(data.dtype.names)\n                default_names = data.dtype.names\n            else:\n                init_func = self._init_from_ndarray  # _homog\n                if data.shape == ():\n                    raise ValueError('Can not initialize a Table with a scalar')\n                elif len(data.shape) == 1:\n                    data = data[np.newaxis, :]\n                n_cols = data.shape[1]\n\n        elif isinstance(data, Mapping):\n            init_func = self._init_from_dict\n            default_names = list(data)\n            n_cols = len(default_names)\n\n        elif isinstance(data, Table):\n            # If user-input meta is None then use data.meta (if non-trivial)\n            if meta is None and data.meta:\n                # At this point do NOT deepcopy data.meta as this will happen after\n                # table init_func() is called.  But for table input the table meta\n                # gets a key copy here if copy=False because later a direct object ref\n                # is used.\n                meta = data.meta if copy else data.meta.copy()\n\n            # Handle indices on input table. Copy primary key and don't copy indices\n            # if the input Table is in non-copy mode.\n            self.primary_key = data.primary_key\n            self._init_indices = self._init_indices and data._copy_indices\n\n            # Extract default names, n_cols, and then overwrite ``data`` to be the\n            # table columns so we can use _init_from_list.\n            default_names = data.colnames\n            n_cols = len(default_names)\n            data = list(data.columns.values())\n\n            init_func = self._init_from_list\n\n        elif data is None:\n            if names is None:\n                if dtype is None:\n                    # Table was initialized as `t = Table()`. Set up for empty\n                    # table with names=[], data=[], and n_cols=0.\n                    # self._init_from_list() will simply return, giving the\n                    # expected empty table.\n                    names = []\n                else:\n                    try:\n                        # No data nor names but dtype is available.  This must be\n                        # valid to initialize a structured array.\n                        dtype = np.dtype(dtype)\n                        names = dtype.names\n                        dtype = [dtype[name] for name in names]\n                    except Exception:\n                        raise ValueError('dtype was specified but could not be '\n                                         'parsed for column names')\n            # names is guaranteed to be set at this point\n            init_func = self._init_from_list\n            n_cols = len(names)\n            data = [[]] * n_cols\n\n        else:\n            raise ValueError(f'Data type {type(data)} not allowed to init Table')\n\n        # Set up defaults if names and/or dtype are not specified.\n        # A value of None means the actual value will be inferred\n        # within the appropriate initialization routine, either from\n        # existing specification or auto-generated.\n\n        if dtype is None:\n            dtype = [None] * n_cols\n        elif isinstance(dtype, np.dtype):\n            if default_names is None:\n                default_names = dtype.names\n            # Convert a numpy dtype input to a list of dtypes for later use.\n            dtype = [dtype[name] for name in dtype.names]\n\n        if names is None:\n            names = default_names or [None] * n_cols\n\n        names = [None if name is None else str(name) for name in names]\n\n        self._check_names_dtype(names, dtype, n_cols)\n\n        # Finally do the real initialization\n        init_func(data, names, dtype, n_cols, copy)\n\n        # Set table meta.  If copy=True then deepcopy meta otherwise use the\n        # user-supplied meta directly.\n        if meta is not None:\n            self.meta = deepcopy(meta) if copy else meta\n\n        # Update meta with TableAttributes supplied as kwargs in Table init.\n        # This takes precedence over previously-defined meta.\n        if meta_table_attrs:\n            for attr, value in meta_table_attrs.items():\n                setattr(self, attr, value)\n\n        # Whatever happens above, the masked property should be set to a boolean\n        if self.masked not in (None, True, False):\n            raise TypeError(\"masked property must be None, True or False\")\n\n        self._set_column_attribute('unit', units)\n        self._set_column_attribute('description', descriptions)\n\n    def _set_column_attribute(self, attr, values):\n        \"\"\"Set ``attr`` for columns to ``values``, which can be either a dict (keyed by column\n        name) or a dict of name: value pairs.  This is used for handling the ``units`` and\n        ``descriptions`` kwargs to ``__init__``.\n        \"\"\"\n        if not values:\n            return\n\n        if isinstance(values, Row):\n            # For a Row object transform to an equivalent dict.\n            values = {name: values[name] for name in values.colnames}\n\n        if not isinstance(values, Mapping):\n            # If not a dict map, assume iterable and map to dict if the right length\n            if len(values) != len(self.columns):\n                raise ValueError(f'sequence of {attr} values must match number of columns')\n            values = dict(zip(self.colnames, values))\n\n        for name, value in values.items():\n            if name not in self.columns:\n                raise ValueError(f'invalid column name {name} for setting {attr} attribute')\n\n            # Special case: ignore unit if it is an empty or blank string\n            if attr == 'unit' and isinstance(value, str):\n                if value.strip() == '':\n                    value = None\n\n            if value not in (np.ma.masked, None):\n                setattr(self[name].info, attr, value)\n\n    def __getstate__(self):\n        columns = OrderedDict((key, col if isinstance(col, BaseColumn) else col_copy(col))\n                              for key, col in self.columns.items())\n        return (columns, self.meta)\n\n    def __setstate__(self, state):\n        columns, meta = state\n        self.__init__(columns, meta=meta)\n\n    @property\n    def mask(self):\n        # Dynamic view of available masks\n        if self.masked or self.has_masked_columns or self.has_masked_values:\n            mask_table = Table([getattr(col, 'mask', FalseArray(col.shape))\n                                for col in self.itercols()],\n                               names=self.colnames, copy=False)\n\n            # Set hidden attribute to force inplace setitem so that code like\n            # t.mask['a'] = [1, 0, 1] will correctly set the underlying mask.\n            # See #5556 for discussion.\n            mask_table._setitem_inplace = True\n        else:\n            mask_table = None\n\n        return mask_table\n\n    @mask.setter\n    def mask(self, val):\n        self.mask[:] = val\n\n    @property\n    def _mask(self):\n        \"\"\"This is needed so that comparison of a masked Table and a\n        MaskedArray works.  The requirement comes from numpy.ma.core\n        so don't remove this property.\"\"\"\n        return self.as_array().mask\n\n    def filled(self, fill_value=None):\n        \"\"\"Return copy of self, with masked values filled.\n\n        If input ``fill_value`` supplied then that value is used for all\n        masked entries in the table.  Otherwise the individual\n        ``fill_value`` defined for each table column is used.\n\n        Parameters\n        ----------\n        fill_value : str\n            If supplied, this ``fill_value`` is used for all masked entries\n            in the entire table.\n\n        Returns\n        -------\n        filled_table : `~astropy.table.Table`\n            New table with masked values filled\n        \"\"\"\n        if self.masked or self.has_masked_columns or self.has_masked_values:\n            # Get new columns with masked values filled, then create Table with those\n            # new cols (copy=False) but deepcopy the meta.\n            data = [col.filled(fill_value) if hasattr(col, 'filled') else col\n                    for col in self.itercols()]\n            return self.__class__(data, meta=deepcopy(self.meta), copy=False)\n        else:\n            # Return copy of the original object.\n            return self.copy()\n\n    @property\n    def indices(self):\n        '''\n        Return the indices associated with columns of the table\n        as a TableIndices object.\n        '''\n        lst = []\n        for column in self.columns.values():\n            for index in column.info.indices:\n                if sum([index is x for x in lst]) == 0:  # ensure uniqueness\n                    lst.append(index)\n        return TableIndices(lst)\n\n    @property\n    def loc(self):\n        '''\n        Return a TableLoc object that can be used for retrieving\n        rows by index in a given data range. Note that both loc\n        and iloc work only with single-column indices.\n        '''\n        return TableLoc(self)\n\n    @property\n    def loc_indices(self):\n        \"\"\"\n        Return a TableLocIndices object that can be used for retrieving\n        the row indices corresponding to given table index key value or values.\n        \"\"\"\n        return TableLocIndices(self)\n\n    @property\n    def iloc(self):\n        '''\n        Return a TableILoc object that can be used for retrieving\n        indexed rows in the order they appear in the index.\n        '''\n        return TableILoc(self)\n\n    def add_index(self, colnames, engine=None, unique=False):\n        '''\n        Insert a new index among one or more columns.\n        If there are no indices, make this index the\n        primary table index.\n\n        Parameters\n        ----------\n        colnames : str or list\n            List of column names (or a single column name) to index\n        engine : type or None\n            Indexing engine class to use, from among SortedArray, BST,\n            and SCEngine. If the supplied argument is None\n            (by default), use SortedArray.\n        unique : bool\n            Whether the values of the index must be unique. Default is False.\n        '''\n        if isinstance(colnames, str):\n            colnames = (colnames,)\n        columns = self.columns[tuple(colnames)].values()\n\n        # make sure all columns support indexing\n        for col in columns:\n            if not getattr(col.info, '_supports_indexing', False):\n                raise ValueError('Cannot create an index on column \"{}\", of '\n                                 'type \"{}\"'.format(col.info.name, type(col)))\n\n        is_primary = not self.indices\n        index = Index(columns, engine=engine, unique=unique)\n        sliced_index = SlicedIndex(index, slice(0, 0, None), original=True)\n        if is_primary:\n            self.primary_key = colnames\n        for col in columns:\n            col.info.indices.append(sliced_index)\n\n    def remove_indices(self, colname):\n        '''\n        Remove all indices involving the given column.\n        If the primary index is removed, the new primary\n        index will be the most recently added remaining\n        index.\n\n        Parameters\n        ----------\n        colname : str\n            Name of column\n        '''\n        col = self.columns[colname]\n        for index in self.indices:\n            try:\n                index.col_position(col.info.name)\n            except ValueError:\n                pass\n            else:\n                for c in index.columns:\n                    c.info.indices.remove(index)\n\n    def index_mode(self, mode):\n        '''\n        Return a context manager for an indexing mode.\n\n        Parameters\n        ----------\n        mode : str\n            Either 'freeze', 'copy_on_getitem', or 'discard_on_copy'.\n            In 'discard_on_copy' mode,\n            indices are not copied whenever columns or tables are copied.\n            In 'freeze' mode, indices are not modified whenever columns are\n            modified; at the exit of the context, indices refresh themselves\n            based on column values. This mode is intended for scenarios in\n            which one intends to make many additions or modifications in an\n            indexed column.\n            In 'copy_on_getitem' mode, indices are copied when taking column\n            slices as well as table slices, so col[i0:i1] will preserve\n            indices.\n        '''\n        return _IndexModeContext(self, mode)\n\n    def __array__(self, dtype=None):\n        \"\"\"Support converting Table to np.array via np.array(table).\n\n        Coercion to a different dtype via np.array(table, dtype) is not\n        supported and will raise a ValueError.\n        \"\"\"\n        if dtype is not None:\n            raise ValueError('Datatype coercion is not allowed')\n\n        # This limitation is because of the following unexpected result that\n        # should have made a table copy while changing the column names.\n        #\n        # >>> d = astropy.table.Table([[1,2],[3,4]])\n        # >>> np.array(d, dtype=[('a', 'i8'), ('b', 'i8')])\n        # array([(0, 0), (0, 0)],\n        #       dtype=[('a', '<i8'), ('b', '<i8')])\n\n        out = self.as_array()\n        return out.data if isinstance(out, np.ma.MaskedArray) else out\n\n    def _check_names_dtype(self, names, dtype, n_cols):\n        \"\"\"Make sure that names and dtype are both iterable and have\n        the same length as data.\n        \"\"\"\n        for inp_list, inp_str in ((dtype, 'dtype'), (names, 'names')):\n            if not isiterable(inp_list):\n                raise ValueError(f'{inp_str} must be a list or None')\n\n        if len(names) != n_cols or len(dtype) != n_cols:\n            raise ValueError(\n                'Arguments \"names\" and \"dtype\" must match number of columns')\n\n    def _init_from_list_of_dicts(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from a list of dictionaries representing rows.\"\"\"\n        # Define placeholder for missing values as a unique object that cannot\n        # every occur in user data.\n        MISSING = object()\n\n        # Gather column names that exist in the input `data`.\n        names_from_data = set()\n        for row in data:\n            names_from_data.update(row)\n\n        if set(data[0].keys()) == names_from_data:\n            names_from_data = list(data[0].keys())\n        else:\n            names_from_data = sorted(names_from_data)\n\n        # Note: if set(data[0].keys()) != names_from_data, this will give an\n        # exception later, so NO need to catch here.\n\n        # Convert list of dict into dict of list (cols), keep track of missing\n        # indexes and put in MISSING placeholders in the `cols` lists.\n        cols = {}\n        missing_indexes = defaultdict(list)\n        for name in names_from_data:\n            cols[name] = []\n            for ii, row in enumerate(data):\n                try:\n                    val = row[name]\n                except KeyError:\n                    missing_indexes[name].append(ii)\n                    val = MISSING\n                cols[name].append(val)\n\n        # Fill the missing entries with first values\n        if missing_indexes:\n            for name, indexes in missing_indexes.items():\n                col = cols[name]\n                first_val = next(val for val in col if val is not MISSING)\n                for index in indexes:\n                    col[index] = first_val\n\n        # prepare initialization\n        if all(name is None for name in names):\n            names = names_from_data\n\n        self._init_from_dict(cols, names, dtype, n_cols, copy)\n\n        # Mask the missing values if necessary, converting columns to MaskedColumn\n        # as needed.\n        if missing_indexes:\n            for name, indexes in missing_indexes.items():\n                col = self[name]\n                # Ensure that any Column subclasses with MISSING values can support\n                # setting masked values. As of astropy 4.0 the test condition below is\n                # always True since _init_from_dict cannot result in mixin columns.\n                if isinstance(col, Column) and not isinstance(col, MaskedColumn):\n                    self[name] = self.MaskedColumn(col, copy=False)\n\n                # Finally do the masking in a mixin-safe way.\n                self[name][indexes] = np.ma.masked\n        return\n\n    def _init_from_list(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from a list of column data.  A column can be a\n        Column object, np.ndarray, mixin, or any other iterable object.\n        \"\"\"\n        # Special case of initializing an empty table like `t = Table()`. No\n        # action required at this point.\n        if n_cols == 0:\n            return\n\n        cols = []\n        default_names = _auto_names(n_cols)\n\n        for col, name, default_name, dtype in zip(data, names, default_names, dtype):\n            col = self._convert_data_to_col(col, copy, default_name, dtype, name)\n\n            cols.append(col)\n\n        self._init_from_cols(cols)\n\n    def _convert_data_to_col(self, data, copy=True, default_name=None, dtype=None, name=None):\n        \"\"\"\n        Convert any allowed sequence data ``col`` to a column object that can be used\n        directly in the self.columns dict.  This could be a Column, MaskedColumn,\n        or mixin column.\n\n        The final column name is determined by::\n\n            name or data.info.name or def_name\n\n        If ``data`` has no ``info`` then ``name = name or def_name``.\n\n        The behavior of ``copy`` for Column objects is:\n        - copy=True: new class instance with a copy of data and deep copy of meta\n        - copy=False: new class instance with same data and a key-only copy of meta\n\n        For mixin columns:\n        - copy=True: new class instance with copy of data and deep copy of meta\n        - copy=False: original instance (no copy at all)\n\n        Parameters\n        ----------\n        data : object (column-like sequence)\n            Input column data\n        copy : bool\n            Make a copy\n        default_name : str\n            Default name\n        dtype : np.dtype or None\n            Data dtype\n        name : str or None\n            Column name\n\n        Returns\n        -------\n        col : Column, MaskedColumn, mixin-column type\n            Object that can be used as a column in self\n        \"\"\"\n\n        data_is_mixin = self._is_mixin_for_table(data)\n        masked_col_cls = (self.ColumnClass\n                          if issubclass(self.ColumnClass, self.MaskedColumn)\n                          else self.MaskedColumn)\n\n        try:\n            data0_is_mixin = self._is_mixin_for_table(data[0])\n        except Exception:\n            # Need broad exception, cannot predict what data[0] raises for arbitrary data\n            data0_is_mixin = False\n\n        # If the data is not an instance of Column or a mixin class, we can\n        # check the registry of mixin 'handlers' to see if the column can be\n        # converted to a mixin class\n        if (handler := get_mixin_handler(data)) is not None:\n            original_data = data\n            data = handler(data)\n            if not (data_is_mixin := self._is_mixin_for_table(data)):\n                fully_qualified_name = (original_data.__class__.__module__ + '.'\n                                        + original_data.__class__.__name__)\n                raise TypeError('Mixin handler for object of type '\n                                f'{fully_qualified_name} '\n                                'did not return a valid mixin column')\n\n        # Structured ndarray gets viewed as a mixin unless already a valid\n        # mixin class\n        if (not isinstance(data, Column) and not data_is_mixin\n                and isinstance(data, np.ndarray) and len(data.dtype) > 1):\n            data = data.view(NdarrayMixin)\n            data_is_mixin = True\n\n        # Get the final column name using precedence.  Some objects may not\n        # have an info attribute. Also avoid creating info as a side effect.\n        if not name:\n            if isinstance(data, Column):\n                name = data.name or default_name\n            elif 'info' in getattr(data, '__dict__', ()):\n                name = data.info.name or default_name\n            else:\n                name = default_name\n\n        if isinstance(data, Column):\n            # If self.ColumnClass is a subclass of col, then \"upgrade\" to ColumnClass,\n            # otherwise just use the original class.  The most common case is a\n            # table with masked=True and ColumnClass=MaskedColumn.  Then a Column\n            # gets upgraded to MaskedColumn, but the converse (pre-4.0) behavior\n            # of downgrading from MaskedColumn to Column (for non-masked table)\n            # does not happen.\n            col_cls = self._get_col_cls_for_table(data)\n\n        elif data_is_mixin:\n            # Copy the mixin column attributes if they exist since the copy below\n            # may not get this attribute.\n            col = col_copy(data, copy_indices=self._init_indices) if copy else data\n            col.info.name = name\n            return col\n\n        elif data0_is_mixin:\n            # Handle case of a sequence of a mixin, e.g. [1*u.m, 2*u.m].\n            try:\n                col = data[0].__class__(data)\n                col.info.name = name\n                return col\n            except Exception:\n                # If that didn't work for some reason, just turn it into np.array of object\n                data = np.array(data, dtype=object)\n                col_cls = self.ColumnClass\n\n        elif isinstance(data, (np.ma.MaskedArray, Masked)):\n            # Require that col_cls be a subclass of MaskedColumn, remembering\n            # that ColumnClass could be a user-defined subclass (though more-likely\n            # could be MaskedColumn).\n            col_cls = masked_col_cls\n\n        elif data is None:\n            # Special case for data passed as the None object (for broadcasting\n            # to an object column). Need to turn data into numpy `None` scalar\n            # object, otherwise `Column` interprets data=None as no data instead\n            # of a object column of `None`.\n            data = np.array(None)\n            col_cls = self.ColumnClass\n\n        elif not hasattr(data, 'dtype'):\n            # `data` is none of the above, convert to numpy array or MaskedArray\n            # assuming only that it is a scalar or sequence or N-d nested\n            # sequence. This function is relatively intricate and tries to\n            # maintain performance for common cases while handling things like\n            # list input with embedded np.ma.masked entries. If `data` is a\n            # scalar then it gets returned unchanged so the original object gets\n            # passed to `Column` later.\n            data = _convert_sequence_data_to_array(data, dtype)\n            copy = False  # Already made a copy above\n            col_cls = masked_col_cls if isinstance(data, np.ma.MaskedArray) else self.ColumnClass\n\n        else:\n            col_cls = self.ColumnClass\n\n        try:\n            col = col_cls(name=name, data=data, dtype=dtype,\n                          copy=copy, copy_indices=self._init_indices)\n        except Exception:\n            # Broad exception class since we don't know what might go wrong\n            raise ValueError('unable to convert data to Column for Table')\n\n        col = self._convert_col_for_table(col)\n\n        return col\n\n    def _init_from_ndarray(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from an ndarray structured array\"\"\"\n\n        data_names = data.dtype.names or _auto_names(n_cols)\n        struct = data.dtype.names is not None\n        names = [name or data_names[i] for i, name in enumerate(names)]\n\n        cols = ([data[name] for name in data_names] if struct else\n                [data[:, i] for i in range(n_cols)])\n\n        self._init_from_list(cols, names, dtype, n_cols, copy)\n\n    def _init_from_dict(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from a dictionary of columns\"\"\"\n\n        data_list = [data[name] for name in names]\n        self._init_from_list(data_list, names, dtype, n_cols, copy)\n\n    def _get_col_cls_for_table(self, col):\n        \"\"\"Get the correct column class to use for upgrading any Column-like object.\n\n        For a masked table, ensure any Column-like object is a subclass\n        of the table MaskedColumn.\n\n        For unmasked table, ensure any MaskedColumn-like object is a subclass\n        of the table MaskedColumn.  If not a MaskedColumn, then ensure that any\n        Column-like object is a subclass of the table Column.\n        \"\"\"\n\n        col_cls = col.__class__\n\n        if self.masked:\n            if isinstance(col, Column) and not isinstance(col, self.MaskedColumn):\n                col_cls = self.MaskedColumn\n        else:\n            if isinstance(col, MaskedColumn):\n                if not isinstance(col, self.MaskedColumn):\n                    col_cls = self.MaskedColumn\n            elif isinstance(col, Column) and not isinstance(col, self.Column):\n                col_cls = self.Column\n\n        return col_cls\n\n    def _convert_col_for_table(self, col):\n        \"\"\"\n        Make sure that all Column objects have correct base class for this type of\n        Table.  For a base Table this most commonly means setting to\n        MaskedColumn if the table is masked.  Table subclasses like QTable\n        override this method.\n        \"\"\"\n        if isinstance(col, Column) and not isinstance(col, self.ColumnClass):\n            col_cls = self._get_col_cls_for_table(col)\n            if col_cls is not col.__class__:\n                col = col_cls(col, copy=False)\n\n        return col\n\n    def _init_from_cols(self, cols):\n        \"\"\"Initialize table from a list of Column or mixin objects\"\"\"\n\n        lengths = set(len(col) for col in cols)\n        if len(lengths) > 1:\n            raise ValueError(f'Inconsistent data column lengths: {lengths}')\n\n        # Make sure that all Column-based objects have correct class.  For\n        # plain Table this is self.ColumnClass, but for instance QTable will\n        # convert columns with units to a Quantity mixin.\n        newcols = [self._convert_col_for_table(col) for col in cols]\n        self._make_table_from_cols(self, newcols)\n\n        # Deduplicate indices.  It may happen that after pickling or when\n        # initing from an existing table that column indices which had been\n        # references to a single index object got *copied* into an independent\n        # object.  This results in duplicates which will cause downstream problems.\n        index_dict = {}\n        for col in self.itercols():\n            for i, index in enumerate(col.info.indices or []):\n                names = tuple(ind_col.info.name for ind_col in index.columns)\n                if names in index_dict:\n                    col.info.indices[i] = index_dict[names]\n                else:\n                    index_dict[names] = index\n\n    def _new_from_slice(self, slice_):\n        \"\"\"Create a new table as a referenced slice from self.\"\"\"\n\n        table = self.__class__(masked=self.masked)\n        if self.meta:\n            table.meta = self.meta.copy()  # Shallow copy for slice\n        table.primary_key = self.primary_key\n\n        newcols = []\n        for col in self.columns.values():\n            newcol = col[slice_]\n\n            # Note in line below, use direct attribute access to col.indices for Column\n            # instances instead of the generic col.info.indices.  This saves about 4 usec\n            # per column.\n            if (col if isinstance(col, Column) else col.info).indices:\n                # TODO : as far as I can tell the only purpose of setting _copy_indices\n                # here is to communicate that to the initial test in `slice_indices`.\n                # Why isn't that just sent as an arg to the function?\n                col.info._copy_indices = self._copy_indices\n                newcol = col.info.slice_indices(newcol, slice_, len(col))\n\n                # Don't understand why this is forcing a value on the original column.\n                # Normally col.info does not even have a _copy_indices attribute.  Tests\n                # still pass if this line is deleted.  (Each col.info attribute access\n                # is expensive).\n                col.info._copy_indices = True\n\n            newcols.append(newcol)\n\n        self._make_table_from_cols(table, newcols, verify=False, names=self.columns.keys())\n        return table\n\n    @staticmethod\n    def _make_table_from_cols(table, cols, verify=True, names=None):\n        \"\"\"\n        Make ``table`` in-place so that it represents the given list of ``cols``.\n        \"\"\"\n        if names is None:\n            names = [col.info.name for col in cols]\n\n        # Note: we do not test for len(names) == len(cols) if names is not None.  In that\n        # case the function is being called by from \"trusted\" source (e.g. right above here)\n        # that is assumed to provide valid inputs.  In that case verify=False.\n\n        if verify:\n            if None in names:\n                raise TypeError('Cannot have None for column name')\n            if len(set(names)) != len(names):\n                raise ValueError('Duplicate column names')\n\n        table.columns = table.TableColumns((name, col) for name, col in zip(names, cols))\n\n        for col in cols:\n            table._set_col_parent_table_and_mask(col)\n\n    def _set_col_parent_table_and_mask(self, col):\n        \"\"\"\n        Set ``col.parent_table = self`` and force ``col`` to have ``mask``\n        attribute if the table is masked and ``col.mask`` does not exist.\n        \"\"\"\n        # For Column instances it is much faster to do direct attribute access\n        # instead of going through .info\n        col_info = col if isinstance(col, Column) else col.info\n        col_info.parent_table = self\n\n        # Legacy behavior for masked table\n        if self.masked and not hasattr(col, 'mask'):\n            col.mask = FalseArray(col.shape)\n\n    def itercols(self):\n        \"\"\"\n        Iterate over the columns of this table.\n\n        Examples\n        --------\n\n        To iterate over the columns of a table::\n\n            >>> t = Table([[1], [2]])\n            >>> for col in t.itercols():\n            ...     print(col)\n            col0\n            ----\n               1\n            col1\n            ----\n               2\n\n        Using ``itercols()`` is similar to  ``for col in t.columns.values()``\n        but is syntactically preferred.\n        \"\"\"\n        for colname in self.columns:\n            yield self[colname]\n\n    def _base_repr_(self, html=False, descr_vals=None, max_width=None,\n                    tableid=None, show_dtype=True, max_lines=None,\n                    tableclass=None):\n        if descr_vals is None:\n            descr_vals = [self.__class__.__name__]\n            if self.masked:\n                descr_vals.append('masked=True')\n            descr_vals.append(f'length={len(self)}')\n\n        descr = ' '.join(descr_vals)\n        if html:\n            from astropy.utils.xml.writer import xml_escape\n            descr = f'<i>{xml_escape(descr)}</i>\\n'\n        else:\n            descr = f'<{descr}>\\n'\n\n        if tableid is None:\n            tableid = f'table{id(self)}'\n\n        data_lines, outs = self.formatter._pformat_table(\n            self, tableid=tableid, html=html, max_width=max_width,\n            show_name=True, show_unit=None, show_dtype=show_dtype,\n            max_lines=max_lines, tableclass=tableclass)\n\n        out = descr + '\\n'.join(data_lines)\n\n        return out\n\n    def _repr_html_(self):\n        out = self._base_repr_(html=True, max_width=-1,\n                               tableclass=conf.default_notebook_table_class)\n        # Wrap <table> in <div>. This follows the pattern in pandas and allows\n        # table to be scrollable horizontally in VS Code notebook display.\n        out = f'<div>{out}</div>'\n        return out\n\n    def __repr__(self):\n        return self._base_repr_(html=False, max_width=None)\n\n    def __str__(self):\n        return '\\n'.join(self.pformat())\n\n    def __bytes__(self):\n        return str(self).encode('utf-8')\n\n    @property\n    def has_mixin_columns(self):\n        \"\"\"\n        True if table has any mixin columns (defined as columns that are not Column\n        subclasses).\n        \"\"\"\n        return any(has_info_class(col, MixinInfo) for col in self.columns.values())\n\n    @property\n    def has_masked_columns(self):\n        \"\"\"True if table has any ``MaskedColumn`` columns.\n\n        This does not check for mixin columns that may have masked values, use the\n        ``has_masked_values`` property in that case.\n\n        \"\"\"\n        return any(isinstance(col, MaskedColumn) for col in self.itercols())\n\n    @property\n    def has_masked_values(self):\n        \"\"\"True if column in the table has values which are masked.\n\n        This may be relatively slow for large tables as it requires checking the mask\n        values of each column.\n        \"\"\"\n        for col in self.itercols():\n            if hasattr(col, 'mask') and np.any(col.mask):\n                return True\n        else:\n            return False\n\n    def _is_mixin_for_table(self, col):\n        \"\"\"\n        Determine if ``col`` should be added to the table directly as\n        a mixin column.\n        \"\"\"\n        if isinstance(col, BaseColumn):\n            return False\n\n        # Is it a mixin but not [Masked]Quantity (which gets converted to\n        # [Masked]Column with unit set).\n        return has_info_class(col, MixinInfo) and not has_info_class(col, QuantityInfo)\n\n    @format_doc(_pprint_docs)\n    def pprint(self, max_lines=None, max_width=None, show_name=True,\n               show_unit=None, show_dtype=False, align=None):\n        \"\"\"Print a formatted string representation of the table.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default is taken from the\n        configuration item ``astropy.conf.max_lines``.  If a negative\n        value of ``max_lines`` is supplied then there is no line limit\n        applied.\n\n        The same applies for max_width except the configuration item is\n        ``astropy.conf.max_width``.\n\n        \"\"\"\n        lines, outs = self.formatter._pformat_table(self, max_lines, max_width,\n                                                    show_name=show_name, show_unit=show_unit,\n                                                    show_dtype=show_dtype, align=align)\n        if outs['show_length']:\n            lines.append(f'Length = {len(self)} rows')\n\n        n_header = outs['n_header']\n\n        for i, line in enumerate(lines):\n            if i < n_header:\n                color_print(line, 'red')\n            else:\n                print(line)\n\n    @format_doc(_pprint_docs)\n    def pprint_all(self, max_lines=-1, max_width=-1, show_name=True,\n                   show_unit=None, show_dtype=False, align=None):\n        \"\"\"Print a formatted string representation of the entire table.\n\n        This method is the same as `astropy.table.Table.pprint` except that\n        the default ``max_lines`` and ``max_width`` are both -1 so that by\n        default the entire table is printed instead of restricting to the size\n        of the screen terminal.\n\n        \"\"\"\n        return self.pprint(max_lines, max_width, show_name,\n                           show_unit, show_dtype, align)\n\n    def _make_index_row_display_table(self, index_row_name):\n        if index_row_name not in self.columns:\n            idx_col = self.ColumnClass(name=index_row_name, data=np.arange(len(self)))\n            return self.__class__([idx_col] + list(self.columns.values()),\n                                  copy=False)\n        else:\n            return self\n\n    def show_in_notebook(self, tableid=None, css=None, display_length=50,\n                         table_class='astropy-default', show_row_index='idx'):\n        \"\"\"Render the table in HTML and show it in the IPython notebook.\n\n        Parameters\n        ----------\n        tableid : str or None\n            An html ID tag for the table.  Default is ``table{id}-XXX``, where\n            id is the unique integer id of the table object, id(self), and XXX\n            is a random number to avoid conflicts when printing the same table\n            multiple times.\n        table_class : str or None\n            A string with a list of HTML classes used to style the table.\n            The special default string ('astropy-default') means that the string\n            will be retrieved from the configuration item\n            ``astropy.table.default_notebook_table_class``. Note that these\n            table classes may make use of bootstrap, as this is loaded with the\n            notebook.  See `this page <https://getbootstrap.com/css/#tables>`_\n            for the list of classes.\n        css : str\n            A valid CSS string declaring the formatting for the table. Defaults\n            to ``astropy.table.jsviewer.DEFAULT_CSS_NB``.\n        display_length : int, optional\n            Number or rows to show. Defaults to 50.\n        show_row_index : str or False\n            If this does not evaluate to False, a column with the given name\n            will be added to the version of the table that gets displayed.\n            This new column shows the index of the row in the table itself,\n            even when the displayed table is re-sorted by another column. Note\n            that if a column with this name already exists, this option will be\n            ignored. Defaults to \"idx\".\n\n        Notes\n        -----\n        Currently, unlike `show_in_browser` (with ``jsviewer=True``), this\n        method needs to access online javascript code repositories.  This is due\n        to modern browsers' limitations on accessing local files.  Hence, if you\n        call this method while offline (and don't have a cached version of\n        jquery and jquery.dataTables), you will not get the jsviewer features.\n        \"\"\"\n\n        from .jsviewer import JSViewer\n        from IPython.display import HTML\n\n        if tableid is None:\n            tableid = f'table{id(self)}-{np.random.randint(1, 1e6)}'\n\n        jsv = JSViewer(display_length=display_length)\n        if show_row_index:\n            display_table = self._make_index_row_display_table(show_row_index)\n        else:\n            display_table = self\n        if table_class == 'astropy-default':\n            table_class = conf.default_notebook_table_class\n        html = display_table._base_repr_(html=True, max_width=-1, tableid=tableid,\n                                         max_lines=-1, show_dtype=False,\n                                         tableclass=table_class)\n\n        columns = display_table.columns.values()\n        sortable_columns = [i for i, col in enumerate(columns)\n                            if col.info.dtype.kind in 'iufc']\n        html += jsv.ipynb(tableid, css=css, sort_columns=sortable_columns)\n        return HTML(html)\n\n    def show_in_browser(self, max_lines=5000, jsviewer=False,\n                        browser='default', jskwargs={'use_local_files': True},\n                        tableid=None, table_class=\"display compact\",\n                        css=None, show_row_index='idx'):\n        \"\"\"Render the table in HTML and show it in a web browser.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum number of rows to export to the table (set low by default\n            to avoid memory issues, since the browser view requires duplicating\n            the table in memory).  A negative value of ``max_lines`` indicates\n            no row limit.\n        jsviewer : bool\n            If `True`, prepends some javascript headers so that the table is\n            rendered as a `DataTables <https://datatables.net>`_ data table.\n            This allows in-browser searching & sorting.\n        browser : str\n            Any legal browser name, e.g. ``'firefox'``, ``'chrome'``,\n            ``'safari'`` (for mac, you may need to use ``'open -a\n            \"/Applications/Google Chrome.app\" {}'`` for Chrome).  If\n            ``'default'``, will use the system default browser.\n        jskwargs : dict\n            Passed to the `astropy.table.JSViewer` init. Defaults to\n            ``{'use_local_files': True}`` which means that the JavaScript\n            libraries will be served from local copies.\n        tableid : str or None\n            An html ID tag for the table.  Default is ``table{id}``, where id\n            is the unique integer id of the table object, id(self).\n        table_class : str or None\n            A string with a list of HTML classes used to style the table.\n            Default is \"display compact\", and other possible values can be\n            found in https://www.datatables.net/manual/styling/classes\n        css : str\n            A valid CSS string declaring the formatting for the table. Defaults\n            to ``astropy.table.jsviewer.DEFAULT_CSS``.\n        show_row_index : str or False\n            If this does not evaluate to False, a column with the given name\n            will be added to the version of the table that gets displayed.\n            This new column shows the index of the row in the table itself,\n            even when the displayed table is re-sorted by another column. Note\n            that if a column with this name already exists, this option will be\n            ignored. Defaults to \"idx\".\n        \"\"\"\n\n        import os\n        import webbrowser\n        import tempfile\n        from .jsviewer import DEFAULT_CSS\n        from urllib.parse import urljoin\n        from urllib.request import pathname2url\n\n        if css is None:\n            css = DEFAULT_CSS\n\n        # We can't use NamedTemporaryFile here because it gets deleted as\n        # soon as it gets garbage collected.\n        tmpdir = tempfile.mkdtemp()\n        path = os.path.join(tmpdir, 'table.html')\n\n        with open(path, 'w') as tmp:\n            if jsviewer:\n                if show_row_index:\n                    display_table = self._make_index_row_display_table(show_row_index)\n                else:\n                    display_table = self\n                display_table.write(tmp, format='jsviewer', css=css,\n                                    max_lines=max_lines, jskwargs=jskwargs,\n                                    table_id=tableid, table_class=table_class)\n            else:\n                self.write(tmp, format='html')\n\n        try:\n            br = webbrowser.get(None if browser == 'default' else browser)\n        except webbrowser.Error:\n            log.error(f\"Browser '{browser}' not found.\")\n        else:\n            br.open(urljoin('file:', pathname2url(path)))\n\n    @format_doc(_pformat_docs, id=\"{id}\")\n    def pformat(self, max_lines=None, max_width=None, show_name=True,\n                show_unit=None, show_dtype=False, html=False, tableid=None,\n                align=None, tableclass=None):\n        \"\"\"Return a list of lines for the formatted string representation of\n        the table.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default is taken from the\n        configuration item ``astropy.conf.max_lines``.  If a negative\n        value of ``max_lines`` is supplied then there is no line limit\n        applied.\n\n        The same applies for ``max_width`` except the configuration item  is\n        ``astropy.conf.max_width``.\n\n        \"\"\"\n\n        lines, outs = self.formatter._pformat_table(\n            self, max_lines, max_width, show_name=show_name,\n            show_unit=show_unit, show_dtype=show_dtype, html=html,\n            tableid=tableid, tableclass=tableclass, align=align)\n\n        if outs['show_length']:\n            lines.append(f'Length = {len(self)} rows')\n\n        return lines\n\n    @format_doc(_pformat_docs, id=\"{id}\")\n    def pformat_all(self, max_lines=-1, max_width=-1, show_name=True,\n                    show_unit=None, show_dtype=False, html=False, tableid=None,\n                    align=None, tableclass=None):\n        \"\"\"Return a list of lines for the formatted string representation of\n        the entire table.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default is taken from the\n        configuration item ``astropy.conf.max_lines``.  If a negative\n        value of ``max_lines`` is supplied then there is no line limit\n        applied.\n\n        The same applies for ``max_width`` except the configuration item  is\n        ``astropy.conf.max_width``.\n\n        \"\"\"\n\n        return self.pformat(max_lines, max_width, show_name,\n                            show_unit, show_dtype, html, tableid,\n                            align, tableclass)\n\n    def more(self, max_lines=None, max_width=None, show_name=True,\n             show_unit=None, show_dtype=False):\n        \"\"\"Interactively browse table with a paging interface.\n\n        Supported keys::\n\n          f, <space> : forward one page\n          b : back one page\n          r : refresh same page\n          n : next row\n          p : previous row\n          < : go to beginning\n          > : go to end\n          q : quit browsing\n          h : print this help\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum number of lines in table output\n\n        max_width : int or None\n            Maximum character width of output\n\n        show_name : bool\n            Include a header row for column names. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        show_dtype : bool\n            Include a header row for column dtypes. Default is True.\n        \"\"\"\n        self.formatter._more_tabcol(self, max_lines, max_width, show_name=show_name,\n                                    show_unit=show_unit, show_dtype=show_dtype)\n\n    def __getitem__(self, item):\n        if isinstance(item, str):\n            return self.columns[item]\n        elif isinstance(item, (int, np.integer)):\n            return self.Row(self, item)\n        elif (isinstance(item, np.ndarray) and item.shape == () and item.dtype.kind == 'i'):\n            return self.Row(self, item.item())\n        elif self._is_list_or_tuple_of_str(item):\n            out = self.__class__([self[x] for x in item],\n                                 copy_indices=self._copy_indices)\n            out._groups = groups.TableGroups(out, indices=self.groups._indices,\n                                             keys=self.groups._keys)\n            out.meta = self.meta.copy()  # Shallow copy for meta\n            return out\n        elif ((isinstance(item, np.ndarray) and item.size == 0)\n              or (isinstance(item, (tuple, list)) and not item)):\n            # If item is an empty array/list/tuple then return the table with no rows\n            return self._new_from_slice([])\n        elif (isinstance(item, slice)\n              or isinstance(item, np.ndarray)\n              or isinstance(item, list)\n              or isinstance(item, tuple) and all(isinstance(x, np.ndarray)\n                                                 for x in item)):\n            # here for the many ways to give a slice; a tuple of ndarray\n            # is produced by np.where, as in t[np.where(t['a'] > 2)]\n            # For all, a new table is constructed with slice of all columns\n            return self._new_from_slice(item)\n        else:\n            raise ValueError(f'Illegal type {type(item)} for table item access')\n\n    def __setitem__(self, item, value):\n        # If the item is a string then it must be the name of a column.\n        # If that column doesn't already exist then create it now.\n        if isinstance(item, str) and item not in self.colnames:\n            self.add_column(value, name=item, copy=True)\n\n        else:\n            n_cols = len(self.columns)\n\n            if isinstance(item, str):\n                # Set an existing column by first trying to replace, and if\n                # this fails do an in-place update.  See definition of mask\n                # property for discussion of the _setitem_inplace attribute.\n                if (not getattr(self, '_setitem_inplace', False)\n                        and not conf.replace_inplace):\n                    try:\n                        self._replace_column_warnings(item, value)\n                        return\n                    except Exception:\n                        pass\n                self.columns[item][:] = value\n\n            elif isinstance(item, (int, np.integer)):\n                self._set_row(idx=item, colnames=self.colnames, vals=value)\n\n            elif (isinstance(item, slice)\n                  or isinstance(item, np.ndarray)\n                  or isinstance(item, list)\n                  or (isinstance(item, tuple)  # output from np.where\n                      and all(isinstance(x, np.ndarray) for x in item))):\n\n                if isinstance(value, Table):\n                    vals = (col for col in value.columns.values())\n\n                elif isinstance(value, np.ndarray) and value.dtype.names:\n                    vals = (value[name] for name in value.dtype.names)\n\n                elif np.isscalar(value):\n                    vals = itertools.repeat(value, n_cols)\n\n                else:  # Assume this is an iterable that will work\n                    if len(value) != n_cols:\n                        raise ValueError('Right side value needs {} elements (one for each column)'\n                                         .format(n_cols))\n                    vals = value\n\n                for col, val in zip(self.columns.values(), vals):\n                    col[item] = val\n\n            else:\n                raise ValueError(f'Illegal type {type(item)} for table item access')\n\n    def __delitem__(self, item):\n        if isinstance(item, str):\n            self.remove_column(item)\n        elif isinstance(item, (int, np.integer)):\n            self.remove_row(item)\n        elif (isinstance(item, (list, tuple, np.ndarray))\n              and all(isinstance(x, str) for x in item)):\n            self.remove_columns(item)\n        elif (isinstance(item, (list, np.ndarray))\n              and np.asarray(item).dtype.kind == 'i'):\n            self.remove_rows(item)\n        elif isinstance(item, slice):\n            self.remove_rows(item)\n        else:\n            raise IndexError('illegal key or index value')\n\n    def _ipython_key_completions_(self):\n        return self.colnames\n\n    def field(self, item):\n        \"\"\"Return column[item] for recarray compatibility.\"\"\"\n        return self.columns[item]\n\n    @property\n    def masked(self):\n        return self._masked\n\n    @masked.setter\n    def masked(self, masked):\n        raise Exception('Masked attribute is read-only (use t = Table(t, masked=True)'\n                        ' to convert to a masked table)')\n\n    def _set_masked(self, masked):\n        \"\"\"\n        Set the table masked property.\n\n        Parameters\n        ----------\n        masked : bool\n            State of table masking (`True` or `False`)\n        \"\"\"\n        if masked in [True, False, None]:\n            self._masked = masked\n        else:\n            raise ValueError(\"masked should be one of True, False, None\")\n\n        self._column_class = self.MaskedColumn if self._masked else self.Column\n\n    @property\n    def ColumnClass(self):\n        if self._column_class is None:\n            return self.Column\n        else:\n            return self._column_class\n\n    @property\n    def dtype(self):\n        return np.dtype([descr(col) for col in self.columns.values()])\n\n    @property\n    def colnames(self):\n        return list(self.columns.keys())\n\n    @staticmethod\n    def _is_list_or_tuple_of_str(names):\n        \"\"\"Check that ``names`` is a tuple or list of strings\"\"\"\n        return (isinstance(names, (tuple, list)) and names\n                and all(isinstance(x, str) for x in names))\n\n    def keys(self):\n        return list(self.columns.keys())\n\n    def values(self):\n        return self.columns.values()\n\n    def items(self):\n        return self.columns.items()\n\n    def __len__(self):\n        # For performance reasons (esp. in Row) cache the first column name\n        # and use that subsequently for the table length.  If might not be\n        # available yet or the column might be gone now, in which case\n        # try again in the except block.\n        try:\n            return len(OrderedDict.__getitem__(self.columns, self._first_colname))\n        except (AttributeError, KeyError):\n            if len(self.columns) == 0:\n                return 0\n\n            # Get the first column name\n            self._first_colname = next(iter(self.columns))\n            return len(self.columns[self._first_colname])\n\n    def index_column(self, name):\n        \"\"\"\n        Return the positional index of column ``name``.\n\n        Parameters\n        ----------\n        name : str\n            column name\n\n        Returns\n        -------\n        index : int\n            Positional index of column ``name``.\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Get index of column 'b' of the table::\n\n            >>> t.index_column('b')\n            1\n        \"\"\"\n        try:\n            return self.colnames.index(name)\n        except ValueError:\n            raise ValueError(f\"Column {name} does not exist\")\n\n    def add_column(self, col, index=None, name=None, rename_duplicate=False, copy=True,\n                   default_name=None):\n        \"\"\"\n        Add a new column to the table using ``col`` as input.  If ``index``\n        is supplied then insert column before ``index`` position\n        in the list of columns, otherwise append column to the end\n        of the list.\n\n        The ``col`` input can be any data object which is acceptable as a\n        `~astropy.table.Table` column object or can be converted.  This includes\n        mixin columns and scalar or length=1 objects which get broadcast to match\n        the table length.\n\n        To add several columns at once use ``add_columns()`` or simply call\n        ``add_column()`` for each one.  There is very little performance difference\n        in the two approaches.\n\n        Parameters\n        ----------\n        col : object\n            Data object for the new column\n        index : int or None\n            Insert column before this position or at end (default).\n        name : str\n            Column name\n        rename_duplicate : bool\n            Uniquify column name if it already exist. Default is False.\n        copy : bool\n            Make a copy of the new column. Default is True.\n        default_name : str or None\n            Name to use if both ``name`` and ``col.info.name`` are not available.\n            Defaults to ``col{number_of_columns}``.\n\n        Examples\n        --------\n        Create a table with two columns 'a' and 'b', then create a third column 'c'\n        and append it to the end of the table::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> col_c = Column(name='c', data=['x', 'y'])\n            >>> t.add_column(col_c)\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n\n        Add column 'd' at position 1. Note that the column is inserted\n        before the given index::\n\n            >>> t.add_column(['a', 'b'], name='d', index=1)\n            >>> print(t)\n             a   d   b   c\n            --- --- --- ---\n              1   a 0.1   x\n              2   b 0.2   y\n\n        Add second column named 'b' with rename_duplicate::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> t.add_column(1.1, name='b', rename_duplicate=True)\n            >>> print(t)\n             a   b  b_1\n            --- --- ---\n              1 0.1 1.1\n              2 0.2 1.1\n\n        Add an unnamed column or mixin object in the table using a default name\n        or by specifying an explicit name with ``name``. Name can also be overridden::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> t.add_column(['a', 'b'])\n            >>> t.add_column(col_c, name='d')\n            >>> print(t)\n             a   b  col2  d\n            --- --- ---- ---\n              1 0.1    a   x\n              2 0.2    b   y\n        \"\"\"\n        if default_name is None:\n            default_name = f'col{len(self.columns)}'\n\n        # Convert col data to acceptable object for insertion into self.columns.\n        # Note that along with the lines above and below, this allows broadcasting\n        # of scalars to the correct shape for adding to table.\n        col = self._convert_data_to_col(col, name=name, copy=copy,\n                                        default_name=default_name)\n\n        # Assigning a scalar column to an empty table should result in an\n        # exception (see #3811).\n        if col.shape == () and len(self) == 0:\n            raise TypeError('Empty table cannot have column set to scalar value')\n        # Make col data shape correct for scalars.  The second test is to allow\n        # broadcasting an N-d element to a column, e.g. t['new'] = [[1, 2]].\n        elif (col.shape == () or col.shape[0] == 1) and len(self) > 0:\n            new_shape = (len(self),) + getattr(col, 'shape', ())[1:]\n            if isinstance(col, np.ndarray):\n                col = np.broadcast_to(col, shape=new_shape,\n                                      subok=True)\n            elif isinstance(col, ShapedLikeNDArray):\n                col = col._apply(np.broadcast_to, shape=new_shape,\n                                 subok=True)\n\n            # broadcast_to() results in a read-only array.  Apparently it only changes\n            # the view to look like the broadcasted array.  So copy.\n            col = col_copy(col)\n\n        name = col.info.name\n\n        # Ensure that new column is the right length\n        if len(self.columns) > 0 and len(col) != len(self):\n            raise ValueError('Inconsistent data column lengths')\n\n        if rename_duplicate:\n            orig_name = name\n            i = 1\n            while name in self.columns:\n                # Iterate until a unique name is found\n                name = orig_name + '_' + str(i)\n                i += 1\n            col.info.name = name\n\n        # Set col parent_table weakref and ensure col has mask attribute if table.masked\n        self._set_col_parent_table_and_mask(col)\n\n        # Add new column as last column\n        self.columns[name] = col\n\n        if index is not None:\n            # Move the other cols to the right of the new one\n            move_names = self.colnames[index:-1]\n            for move_name in move_names:\n                self.columns.move_to_end(move_name, last=True)\n\n    def add_columns(self, cols, indexes=None, names=None, copy=True, rename_duplicate=False):\n        \"\"\"\n        Add a list of new columns the table using ``cols`` data objects.  If a\n        corresponding list of ``indexes`` is supplied then insert column\n        before each ``index`` position in the *original* list of columns,\n        otherwise append columns to the end of the list.\n\n        The ``cols`` input can include any data objects which are acceptable as\n        `~astropy.table.Table` column objects or can be converted.  This includes\n        mixin columns and scalar or length=1 objects which get broadcast to match\n        the table length.\n\n        From a performance perspective there is little difference between calling\n        this method once or looping over the new columns and calling ``add_column()``\n        for each column.\n\n        Parameters\n        ----------\n        cols : list of object\n            List of data objects for the new columns\n        indexes : list of int or None\n            Insert column before this position or at end (default).\n        names : list of str\n            Column names\n        copy : bool\n            Make a copy of the new columns. Default is True.\n        rename_duplicate : bool\n            Uniquify new column names if they duplicate the existing ones.\n            Default is False.\n\n        See Also\n        --------\n        astropy.table.hstack, update, replace_column\n\n        Examples\n        --------\n        Create a table with two columns 'a' and 'b', then create columns 'c' and 'd'\n        and append them to the end of the table::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> col_c = Column(name='c', data=['x', 'y'])\n            >>> col_d = Column(name='d', data=['u', 'v'])\n            >>> t.add_columns([col_c, col_d])\n            >>> print(t)\n             a   b   c   d\n            --- --- --- ---\n              1 0.1   x   u\n              2 0.2   y   v\n\n        Add column 'c' at position 0 and column 'd' at position 1. Note that\n        the columns are inserted before the given position::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> t.add_columns([['x', 'y'], ['u', 'v']], names=['c', 'd'],\n            ...               indexes=[0, 1])\n            >>> print(t)\n             c   a   d   b\n            --- --- --- ---\n              x   1   u 0.1\n              y   2   v 0.2\n\n        Add second column 'b' and column 'c' with ``rename_duplicate``::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> t.add_columns([[1.1, 1.2], ['x', 'y']], names=('b', 'c'),\n            ...               rename_duplicate=True)\n            >>> print(t)\n             a   b  b_1  c\n            --- --- --- ---\n              1 0.1 1.1  x\n              2 0.2 1.2  y\n\n        Add unnamed columns or mixin objects in the table using default names\n        or by specifying explicit names with ``names``. Names can also be overridden::\n\n            >>> t = Table()\n            >>> col_b = Column(name='b', data=['u', 'v'])\n            >>> t.add_columns([[1, 2], col_b])\n            >>> t.add_columns([[3, 4], col_b], names=['c', 'd'])\n            >>> print(t)\n            col0  b   c   d\n            ---- --- --- ---\n               1   u   3   u\n               2   v   4   v\n        \"\"\"\n        if indexes is None:\n            indexes = [len(self.columns)] * len(cols)\n        elif len(indexes) != len(cols):\n            raise ValueError('Number of indexes must match number of cols')\n\n        if names is None:\n            names = (None,) * len(cols)\n        elif len(names) != len(cols):\n            raise ValueError('Number of names must match number of cols')\n\n        default_names = [f'col{ii + len(self.columns)}'\n                         for ii in range(len(cols))]\n\n        for ii in reversed(np.argsort(indexes)):\n            self.add_column(cols[ii], index=indexes[ii], name=names[ii],\n                            default_name=default_names[ii],\n                            rename_duplicate=rename_duplicate, copy=copy)\n\n    def _replace_column_warnings(self, name, col):\n        \"\"\"\n        Same as replace_column but issues warnings under various circumstances.\n        \"\"\"\n        warns = conf.replace_warnings\n        refcount = None\n        old_col = None\n\n        if 'refcount' in warns and name in self.colnames:\n            refcount = sys.getrefcount(self[name])\n\n        if name in self.colnames:\n            old_col = self[name]\n\n        # This may raise an exception (e.g. t['a'] = 1) in which case none of\n        # the downstream code runs.\n        self.replace_column(name, col)\n\n        if 'always' in warns:\n            warnings.warn(f\"replaced column '{name}'\",\n                          TableReplaceWarning, stacklevel=3)\n\n        if 'slice' in warns:\n            try:\n                # Check for ndarray-subclass slice.  An unsliced instance\n                # has an ndarray for the base while sliced has the same class\n                # as parent.\n                if isinstance(old_col.base, old_col.__class__):\n                    msg = (\"replaced column '{}' which looks like an array slice. \"\n                           \"The new column no longer shares memory with the \"\n                           \"original array.\".format(name))\n                    warnings.warn(msg, TableReplaceWarning, stacklevel=3)\n            except AttributeError:\n                pass\n\n        if 'refcount' in warns:\n            # Did reference count change?\n            new_refcount = sys.getrefcount(self[name])\n            if refcount != new_refcount:\n                msg = (\"replaced column '{}' and the number of references \"\n                       \"to the column changed.\".format(name))\n                warnings.warn(msg, TableReplaceWarning, stacklevel=3)\n\n        if 'attributes' in warns:\n            # Any of the standard column attributes changed?\n            changed_attrs = []\n            new_col = self[name]\n            # Check base DataInfo attributes that any column will have\n            for attr in DataInfo.attr_names:\n                if getattr(old_col.info, attr) != getattr(new_col.info, attr):\n                    changed_attrs.append(attr)\n\n            if changed_attrs:\n                msg = (\"replaced column '{}' and column attributes {} changed.\"\n                       .format(name, changed_attrs))\n                warnings.warn(msg, TableReplaceWarning, stacklevel=3)\n\n    def replace_column(self, name, col, copy=True):\n        \"\"\"\n        Replace column ``name`` with the new ``col`` object.\n\n        The behavior of ``copy`` for Column objects is:\n        - copy=True: new class instance with a copy of data and deep copy of meta\n        - copy=False: new class instance with same data and a key-only copy of meta\n\n        For mixin columns:\n        - copy=True: new class instance with copy of data and deep copy of meta\n        - copy=False: original instance (no copy at all)\n\n        Parameters\n        ----------\n        name : str\n            Name of column to replace\n        col : `~astropy.table.Column` or `~numpy.ndarray` or sequence\n            New column object to replace the existing column.\n        copy : bool\n            Make copy of the input ``col``, default=True\n\n        See Also\n        --------\n        add_columns, astropy.table.hstack, update\n\n        Examples\n        --------\n        Replace column 'a' with a float version of itself::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> float_a = t['a'].astype(float)\n            >>> t.replace_column('a', float_a)\n        \"\"\"\n        if name not in self.colnames:\n            raise ValueError(f'column name {name} is not in the table')\n\n        if self[name].info.indices:\n            raise ValueError('cannot replace a table index column')\n\n        col = self._convert_data_to_col(col, name=name, copy=copy)\n        self._set_col_parent_table_and_mask(col)\n\n        # Ensure that new column is the right length, unless it is the only column\n        # in which case re-sizing is allowed.\n        if len(self.columns) > 1 and len(col) != len(self[name]):\n            raise ValueError('length of new column must match table length')\n\n        self.columns.__setitem__(name, col, validated=True)\n\n    def remove_row(self, index):\n        \"\"\"\n        Remove a row from the table.\n\n        Parameters\n        ----------\n        index : int\n            Index of row to remove\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Remove row 1 from the table::\n\n            >>> t.remove_row(1)\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              3 0.3   z\n\n        To remove several rows at the same time use remove_rows.\n        \"\"\"\n        # check the index against the types that work with np.delete\n        if not isinstance(index, (int, np.integer)):\n            raise TypeError(\"Row index must be an integer\")\n        self.remove_rows(index)\n\n    def remove_rows(self, row_specifier):\n        \"\"\"\n        Remove rows from the table.\n\n        Parameters\n        ----------\n        row_specifier : slice or int or array of int\n            Specification for rows to remove\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Remove rows 0 and 2 from the table::\n\n            >>> t.remove_rows([0, 2])\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              2 0.2   y\n\n\n        Note that there are no warnings if the slice operator extends\n        outside the data::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> t.remove_rows(slice(10, 20, 1))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n        \"\"\"\n        # Update indices\n        for index in self.indices:\n            index.remove_rows(row_specifier)\n\n        keep_mask = np.ones(len(self), dtype=bool)\n        keep_mask[row_specifier] = False\n\n        columns = self.TableColumns()\n        for name, col in self.columns.items():\n            newcol = col[keep_mask]\n            newcol.info.parent_table = self\n            columns[name] = newcol\n\n        self._replace_cols(columns)\n\n        # Revert groups to default (ungrouped) state\n        if hasattr(self, '_groups'):\n            del self._groups\n\n    def iterrows(self, *names):\n        \"\"\"\n        Iterate over rows of table returning a tuple of values for each row.\n\n        This method is especially useful when only a subset of columns are needed.\n\n        The ``iterrows`` method can be substantially faster than using the standard\n        Table row iteration (e.g. ``for row in tbl:``), since that returns a new\n        ``~astropy.table.Row`` object for each row and accessing a column in that\n        row (e.g. ``row['col0']``) is slower than tuple access.\n\n        Parameters\n        ----------\n        names : list\n            List of column names (default to all columns if no names provided)\n\n        Returns\n        -------\n        rows : iterable\n            Iterator returns tuples of row values\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table({'a': [1, 2, 3],\n            ...            'b': [1.0, 2.5, 3.0],\n            ...            'c': ['x', 'y', 'z']})\n\n        To iterate row-wise using column names::\n\n            >>> for a, c in t.iterrows('a', 'c'):\n            ...     print(a, c)\n            1 x\n            2 y\n            3 z\n\n        \"\"\"\n        if len(names) == 0:\n            names = self.colnames\n        else:\n            for name in names:\n                if name not in self.colnames:\n                    raise ValueError(f'{name} is not a valid column name')\n\n        cols = (self[name] for name in names)\n        out = zip(*cols)\n        return out\n\n    def _set_of_names_in_colnames(self, names):\n        \"\"\"Return ``names`` as a set if valid, or raise a `KeyError`.\n\n        ``names`` is valid if all elements in it are in ``self.colnames``.\n        If ``names`` is a string then it is interpreted as a single column\n        name.\n        \"\"\"\n        names = {names} if isinstance(names, str) else set(names)\n        invalid_names = names.difference(self.colnames)\n        if len(invalid_names) == 1:\n            raise KeyError(f'column \"{invalid_names.pop()}\" does not exist')\n        elif len(invalid_names) > 1:\n            raise KeyError(f'columns {invalid_names} do not exist')\n        return names\n\n    def remove_column(self, name):\n        \"\"\"\n        Remove a column from the table.\n\n        This can also be done with::\n\n          del table[name]\n\n        Parameters\n        ----------\n        name : str\n            Name of column to remove\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Remove column 'b' from the table::\n\n            >>> t.remove_column('b')\n            >>> print(t)\n             a   c\n            --- ---\n              1   x\n              2   y\n              3   z\n\n        To remove several columns at the same time use remove_columns.\n        \"\"\"\n\n        self.remove_columns([name])\n\n    def remove_columns(self, names):\n        '''\n        Remove several columns from the table.\n\n        Parameters\n        ----------\n        names : str or iterable of str\n            Names of the columns to remove\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...     names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Remove columns 'b' and 'c' from the table::\n\n            >>> t.remove_columns(['b', 'c'])\n            >>> print(t)\n             a\n            ---\n              1\n              2\n              3\n\n        Specifying only a single column also works. Remove column 'b' from the table::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...     names=('a', 'b', 'c'))\n            >>> t.remove_columns('b')\n            >>> print(t)\n             a   c\n            --- ---\n              1   x\n              2   y\n              3   z\n\n        This gives the same as using remove_column.\n        '''\n        for name in self._set_of_names_in_colnames(names):\n            self.columns.pop(name)\n\n    def _convert_string_dtype(self, in_kind, out_kind, encode_decode_func):\n        \"\"\"\n        Convert string-like columns to/from bytestring and unicode (internal only).\n\n        Parameters\n        ----------\n        in_kind : str\n            Input dtype.kind\n        out_kind : str\n            Output dtype.kind\n        \"\"\"\n\n        for col in self.itercols():\n            if col.dtype.kind == in_kind:\n                try:\n                    # This requires ASCII and is faster by a factor of up to ~8, so\n                    # try that first.\n                    newcol = col.__class__(col, dtype=out_kind)\n                except (UnicodeEncodeError, UnicodeDecodeError):\n                    newcol = col.__class__(encode_decode_func(col, 'utf-8'))\n\n                    # Quasi-manually copy info attributes.  Unfortunately\n                    # DataInfo.__set__ does not do the right thing in this case\n                    # so newcol.info = col.info does not get the old info attributes.\n                    for attr in col.info.attr_names - col.info._attrs_no_copy - set(['dtype']):\n                        value = deepcopy(getattr(col.info, attr))\n                        setattr(newcol.info, attr, value)\n\n                self[col.name] = newcol\n\n    def convert_bytestring_to_unicode(self):\n        \"\"\"\n        Convert bytestring columns (dtype.kind='S') to unicode (dtype.kind='U')\n        using UTF-8 encoding.\n\n        Internally this changes string columns to represent each character\n        in the string with a 4-byte UCS-4 equivalent, so it is inefficient\n        for memory but allows scripts to manipulate string arrays with\n        natural syntax.\n        \"\"\"\n        self._convert_string_dtype('S', 'U', np.char.decode)\n\n    def convert_unicode_to_bytestring(self):\n        \"\"\"\n        Convert unicode columns (dtype.kind='U') to bytestring (dtype.kind='S')\n        using UTF-8 encoding.\n\n        When exporting a unicode string array to a file, it may be desirable\n        to encode unicode columns as bytestrings.\n        \"\"\"\n        self._convert_string_dtype('U', 'S', np.char.encode)\n\n    def keep_columns(self, names):\n        '''\n        Keep only the columns specified (remove the others).\n\n        Parameters\n        ----------\n        names : str or iterable of str\n            The columns to keep. All other columns will be removed.\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3],[0.1, 0.2, 0.3],['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Keep only column 'a' of the table::\n\n            >>> t.keep_columns('a')\n            >>> print(t)\n             a\n            ---\n              1\n              2\n              3\n\n        Keep columns 'a' and 'c' of the table::\n\n            >>> t = Table([[1, 2, 3],[0.1, 0.2, 0.3],['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> t.keep_columns(['a', 'c'])\n            >>> print(t)\n             a   c\n            --- ---\n              1   x\n              2   y\n              3   z\n        '''\n        names = self._set_of_names_in_colnames(names)\n        for colname in self.colnames:\n            if colname not in names:\n                self.columns.pop(colname)\n\n    def rename_column(self, name, new_name):\n        '''\n        Rename a column.\n\n        This can also be done directly with by setting the ``name`` attribute\n        for a column::\n\n          table[name].name = new_name\n\n        TODO: this won't work for mixins\n\n        Parameters\n        ----------\n        name : str\n            The current name of the column.\n        new_name : str\n            The new name for the column\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1,2],[3,4],[5,6]], names=('a','b','c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1   3   5\n              2   4   6\n\n        Renaming column 'a' to 'aa'::\n\n            >>> t.rename_column('a' , 'aa')\n            >>> print(t)\n             aa  b   c\n            --- --- ---\n              1   3   5\n              2   4   6\n        '''\n\n        if name not in self.keys():\n            raise KeyError(f\"Column {name} does not exist\")\n\n        self.columns[name].info.name = new_name\n\n    def rename_columns(self, names, new_names):\n        '''\n        Rename multiple columns.\n\n        Parameters\n        ----------\n        names : list, tuple\n            A list or tuple of existing column names.\n        new_names : list, tuple\n            A list or tuple of new column names.\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b', 'c'::\n\n            >>> t = Table([[1,2],[3,4],[5,6]], names=('a','b','c'))\n            >>> print(t)\n              a   b   c\n             --- --- ---\n              1   3   5\n              2   4   6\n\n        Renaming columns 'a' to 'aa' and 'b' to 'bb'::\n\n            >>> names = ('a','b')\n            >>> new_names = ('aa','bb')\n            >>> t.rename_columns(names, new_names)\n            >>> print(t)\n             aa  bb   c\n            --- --- ---\n              1   3   5\n              2   4   6\n        '''\n\n        if not self._is_list_or_tuple_of_str(names):\n            raise TypeError(\"input 'names' must be a tuple or a list of column names\")\n\n        if not self._is_list_or_tuple_of_str(new_names):\n            raise TypeError(\"input 'new_names' must be a tuple or a list of column names\")\n\n        if len(names) != len(new_names):\n            raise ValueError(\"input 'names' and 'new_names' list arguments must be the same length\")\n\n        for name, new_name in zip(names, new_names):\n            self.rename_column(name, new_name)\n\n    def _set_row(self, idx, colnames, vals):\n        try:\n            assert len(vals) == len(colnames)\n        except Exception:\n            raise ValueError('right hand side must be a sequence of values with '\n                             'the same length as the number of selected columns')\n\n        # Keep track of original values before setting each column so that\n        # setting row can be transactional.\n        orig_vals = []\n        cols = self.columns\n        try:\n            for name, val in zip(colnames, vals):\n                orig_vals.append(cols[name][idx])\n                cols[name][idx] = val\n        except Exception:\n            # If anything went wrong first revert the row update then raise\n            for name, val in zip(colnames, orig_vals[:-1]):\n                cols[name][idx] = val\n            raise\n\n    def add_row(self, vals=None, mask=None):\n        \"\"\"Add a new row to the end of the table.\n\n        The ``vals`` argument can be:\n\n        sequence (e.g. tuple or list)\n            Column values in the same order as table columns.\n        mapping (e.g. dict)\n            Keys corresponding to column names.  Missing values will be\n            filled with np.zeros for the column dtype.\n        `None`\n            All values filled with np.zeros for the column dtype.\n\n        This method requires that the Table object \"owns\" the underlying array\n        data.  In particular one cannot add a row to a Table that was\n        initialized with copy=False from an existing array.\n\n        The ``mask`` attribute should give (if desired) the mask for the\n        values. The type of the mask should match that of the values, i.e. if\n        ``vals`` is an iterable, then ``mask`` should also be an iterable\n        with the same length, and if ``vals`` is a mapping, then ``mask``\n        should be a dictionary.\n\n        Parameters\n        ----------\n        vals : tuple, list, dict or None\n            Use the specified values in the new row\n        mask : tuple, list, dict or None\n            Use the specified mask values in the new row\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n           >>> t = Table([[1,2],[4,5],[7,8]], names=('a','b','c'))\n           >>> print(t)\n            a   b   c\n           --- --- ---\n             1   4   7\n             2   5   8\n\n        Adding a new row with entries '3' in 'a', '6' in 'b' and '9' in 'c'::\n\n           >>> t.add_row([3,6,9])\n           >>> print(t)\n             a   b   c\n             --- --- ---\n             1   4   7\n             2   5   8\n             3   6   9\n        \"\"\"\n        self.insert_row(len(self), vals, mask)\n\n    def insert_row(self, index, vals=None, mask=None):\n        \"\"\"Add a new row before the given ``index`` position in the table.\n\n        The ``vals`` argument can be:\n\n        sequence (e.g. tuple or list)\n            Column values in the same order as table columns.\n        mapping (e.g. dict)\n            Keys corresponding to column names.  Missing values will be\n            filled with np.zeros for the column dtype.\n        `None`\n            All values filled with np.zeros for the column dtype.\n\n        The ``mask`` attribute should give (if desired) the mask for the\n        values. The type of the mask should match that of the values, i.e. if\n        ``vals`` is an iterable, then ``mask`` should also be an iterable\n        with the same length, and if ``vals`` is a mapping, then ``mask``\n        should be a dictionary.\n\n        Parameters\n        ----------\n        vals : tuple, list, dict or None\n            Use the specified values in the new row\n        mask : tuple, list, dict or None\n            Use the specified mask values in the new row\n        \"\"\"\n        colnames = self.colnames\n\n        N = len(self)\n        if index < -N or index > N:\n            raise IndexError(\"Index {} is out of bounds for table with length {}\"\n                             .format(index, N))\n        if index < 0:\n            index += N\n\n        if isinstance(vals, Mapping) or vals is None:\n            # From the vals and/or mask mappings create the corresponding lists\n            # that have entries for each table column.\n            if mask is not None and not isinstance(mask, Mapping):\n                raise TypeError(\"Mismatch between type of vals and mask\")\n\n            # Now check that the mask is specified for the same keys as the\n            # values, otherwise things get really confusing.\n            if mask is not None and set(vals.keys()) != set(mask.keys()):\n                raise ValueError('keys in mask should match keys in vals')\n\n            if vals and any(name not in colnames for name in vals):\n                raise ValueError('Keys in vals must all be valid column names')\n\n            vals_list = []\n            mask_list = []\n\n            for name in colnames:\n                if vals and name in vals:\n                    vals_list.append(vals[name])\n                    mask_list.append(False if mask is None else mask[name])\n                else:\n                    col = self[name]\n                    if hasattr(col, 'dtype'):\n                        # Make a placeholder zero element of the right type which is masked.\n                        # This assumes the appropriate insert() method will broadcast a\n                        # numpy scalar to the right shape.\n                        vals_list.append(np.zeros(shape=(), dtype=col.dtype))\n\n                        # For masked table any unsupplied values are masked by default.\n                        mask_list.append(self.masked and vals is not None)\n                    else:\n                        raise ValueError(f\"Value must be supplied for column '{name}'\")\n\n            vals = vals_list\n            mask = mask_list\n\n        if isiterable(vals):\n            if mask is not None and (not isiterable(mask) or isinstance(mask, Mapping)):\n                raise TypeError(\"Mismatch between type of vals and mask\")\n\n            if len(self.columns) != len(vals):\n                raise ValueError('Mismatch between number of vals and columns')\n\n            if mask is not None:\n                if len(self.columns) != len(mask):\n                    raise ValueError('Mismatch between number of masks and columns')\n            else:\n                mask = [False] * len(self.columns)\n\n        else:\n            raise TypeError('Vals must be an iterable or mapping or None')\n\n        # Insert val at index for each column\n        columns = self.TableColumns()\n        for name, col, val, mask_ in zip(colnames, self.columns.values(), vals, mask):\n            try:\n                # If new val is masked and the existing column does not support masking\n                # then upgrade the column to a mask-enabled type: either the table-level\n                # default ColumnClass or else MaskedColumn.\n                if mask_ and isinstance(col, Column) and not isinstance(col, MaskedColumn):\n                    col_cls = (self.ColumnClass\n                               if issubclass(self.ColumnClass, self.MaskedColumn)\n                               else self.MaskedColumn)\n                    col = col_cls(col, copy=False)\n\n                newcol = col.insert(index, val, axis=0)\n\n                if len(newcol) != N + 1:\n                    raise ValueError('Incorrect length for column {} after inserting {}'\n                                     ' (expected {}, got {})'\n                                     .format(name, val, len(newcol), N + 1))\n                newcol.info.parent_table = self\n\n                # Set mask if needed and possible\n                if mask_:\n                    if hasattr(newcol, 'mask'):\n                        newcol[index] = np.ma.masked\n                    else:\n                        raise TypeError(\"mask was supplied for column '{}' but it does not \"\n                                        \"support masked values\".format(col.info.name))\n\n                columns[name] = newcol\n\n            except Exception as err:\n                raise ValueError(\"Unable to insert row because of exception in column '{}':\\n{}\"\n                                 .format(name, err)) from err\n\n        for table_index in self.indices:\n            table_index.insert_row(index, vals, self.columns.values())\n\n        self._replace_cols(columns)\n\n        # Revert groups to default (ungrouped) state\n        if hasattr(self, '_groups'):\n            del self._groups\n\n    def _replace_cols(self, columns):\n        for col, new_col in zip(self.columns.values(), columns.values()):\n            new_col.info.indices = []\n            for index in col.info.indices:\n                index.columns[index.col_position(col.info.name)] = new_col\n                new_col.info.indices.append(index)\n\n        self.columns = columns\n\n    def update(self, other, copy=True):\n        \"\"\"\n        Perform a dictionary-style update and merge metadata.\n\n        The argument ``other`` must be a |Table|, or something that can be used\n        to initialize a table. Columns from (possibly converted) ``other`` are\n        added to this table. In case of matching column names the column from\n        this table is replaced with the one from ``other``.\n\n        Parameters\n        ----------\n        other : table-like\n            Data to update this table with.\n        copy : bool\n            Whether the updated columns should be copies of or references to\n            the originals.\n\n        See Also\n        --------\n        add_columns, astropy.table.hstack, replace_column\n\n        Examples\n        --------\n        Update a table with another table::\n\n            >>> t1 = Table({'a': ['foo', 'bar'], 'b': [0., 0.]}, meta={'i': 0})\n            >>> t2 = Table({'b': [1., 2.], 'c': [7., 11.]}, meta={'n': 2})\n            >>> t1.update(t2)\n            >>> t1\n            <Table length=2>\n             a      b       c\n            str3 float64 float64\n            ---- ------- -------\n             foo     1.0     7.0\n             bar     2.0    11.0\n            >>> t1.meta\n            {'i': 0, 'n': 2}\n\n        Update a table with a dictionary::\n\n            >>> t = Table({'a': ['foo', 'bar'], 'b': [0., 0.]})\n            >>> t.update({'b': [1., 2.]})\n            >>> t\n            <Table length=2>\n             a      b\n            str3 float64\n            ---- -------\n             foo     1.0\n             bar     2.0\n        \"\"\"\n        from .operations import _merge_table_meta\n        if not isinstance(other, Table):\n            other = self.__class__(other, copy=copy)\n        common_cols = set(self.colnames).intersection(other.colnames)\n        for name, col in other.items():\n            if name in common_cols:\n                self.replace_column(name, col, copy=copy)\n            else:\n                self.add_column(col, name=name, copy=copy)\n        _merge_table_meta(self, [self, other], metadata_conflicts='silent')\n\n    def argsort(self, keys=None, kind=None, reverse=False):\n        \"\"\"\n        Return the indices which would sort the table according to one or\n        more key columns.  This simply calls the `numpy.argsort` function on\n        the table with the ``order`` parameter set to ``keys``.\n\n        Parameters\n        ----------\n        keys : str or list of str\n            The column name(s) to order the table by\n        kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional\n            Sorting algorithm used by ``numpy.argsort``.\n        reverse : bool\n            Sort in reverse order (default=False)\n\n        Returns\n        -------\n        index_array : ndarray, int\n            Array of indices that sorts the table by the specified key\n            column(s).\n        \"\"\"\n        if isinstance(keys, str):\n            keys = [keys]\n\n        # use index sorted order if possible\n        if keys is not None:\n            index = get_index(self, names=keys)\n            if index is not None:\n                idx = np.asarray(index.sorted_data())\n                return idx[::-1] if reverse else idx\n\n        kwargs = {}\n        if keys:\n            # For multiple keys return a structured array which gets sorted,\n            # while for a single key return a single ndarray.  Sorting a\n            # one-column structured array is slower than ndarray (e.g. a\n            # factor of ~6 for a 10 million long random array), and much slower\n            # for in principle sortable columns like Time, which get stored as\n            # object arrays.\n            if len(keys) > 1:\n                kwargs['order'] = keys\n                data = self.as_array(names=keys)\n            else:\n                data = self[keys[0]]\n        else:\n            # No keys provided so sort on all columns.\n            data = self.as_array()\n\n        if kind:\n            kwargs['kind'] = kind\n\n        # np.argsort will look for a possible .argsort method (e.g., for Time),\n        # and if that fails cast to an array and try sorting that way.\n        idx = np.argsort(data, **kwargs)\n\n        return idx[::-1] if reverse else idx\n\n    def sort(self, keys=None, *, kind=None, reverse=False):\n        '''\n        Sort the table according to one or more keys. This operates\n        on the existing table and does not return a new table.\n\n        Parameters\n        ----------\n        keys : str or list of str\n            The key(s) to order the table by. If None, use the\n            primary index of the Table.\n        kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional\n            Sorting algorithm used by ``numpy.argsort``.\n        reverse : bool\n            Sort in reverse order (default=False)\n\n        Examples\n        --------\n        Create a table with 3 columns::\n\n            >>> t = Table([['Max', 'Jo', 'John'], ['Miller', 'Miller', 'Jackson'],\n            ...            [12, 15, 18]], names=('firstname', 'name', 'tel'))\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                  Max  Miller  12\n                   Jo  Miller  15\n                 John Jackson  18\n\n        Sorting according to standard sorting rules, first 'name' then 'firstname'::\n\n            >>> t.sort(['name', 'firstname'])\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                 John Jackson  18\n                   Jo  Miller  15\n                  Max  Miller  12\n\n        Sorting according to standard sorting rules, first 'firstname' then 'tel',\n        in reverse order::\n\n            >>> t.sort(['firstname', 'tel'], reverse=True)\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                  Max  Miller  12\n                 John Jackson  18\n                   Jo  Miller  15\n        '''\n        if keys is None:\n            if not self.indices:\n                raise ValueError(\"Table sort requires input keys or a table index\")\n            keys = [x.info.name for x in self.indices[0].columns]\n\n        if isinstance(keys, str):\n            keys = [keys]\n\n        indexes = self.argsort(keys, kind=kind, reverse=reverse)\n\n        with self.index_mode('freeze'):\n            for name, col in self.columns.items():\n                # Make a new sorted column.  This requires that take() also copies\n                # relevant info attributes for mixin columns.\n                new_col = col.take(indexes, axis=0)\n\n                # First statement in try: will succeed if the column supports an in-place\n                # update, and matches the legacy behavior of astropy Table.  However,\n                # some mixin classes may not support this, so in that case just drop\n                # in the entire new column. See #9553 and #9536 for discussion.\n                try:\n                    col[:] = new_col\n                except Exception:\n                    # In-place update failed for some reason, exception class not\n                    # predictable for arbitrary mixin.\n                    self[col.info.name] = new_col\n\n    def reverse(self):\n        '''\n        Reverse the row order of table rows.  The table is reversed\n        in place and there are no function arguments.\n\n        Examples\n        --------\n        Create a table with three columns::\n\n            >>> t = Table([['Max', 'Jo', 'John'], ['Miller','Miller','Jackson'],\n            ...         [12,15,18]], names=('firstname','name','tel'))\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                  Max  Miller  12\n                   Jo  Miller  15\n                 John Jackson  18\n\n        Reversing order::\n\n            >>> t.reverse()\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                 John Jackson  18\n                   Jo  Miller  15\n                  Max  Miller  12\n        '''\n        for col in self.columns.values():\n            # First statement in try: will succeed if the column supports an in-place\n            # update, and matches the legacy behavior of astropy Table.  However,\n            # some mixin classes may not support this, so in that case just drop\n            # in the entire new column. See #9836, #9553, and #9536 for discussion.\n            new_col = col[::-1]\n            try:\n                col[:] = new_col\n            except Exception:\n                # In-place update failed for some reason, exception class not\n                # predictable for arbitrary mixin.\n                self[col.info.name] = new_col\n\n        for index in self.indices:\n            index.reverse()\n\n    def round(self, decimals=0):\n        '''\n        Round numeric columns in-place to the specified number of decimals.\n        Non-numeric columns will be ignored.\n\n        Examples\n        --------\n        Create three columns with different types:\n\n            >>> t = Table([[1, 4, 5], [-25.55, 12.123, 85],\n            ...     ['a', 'b', 'c']], names=('a', 'b', 'c'))\n            >>> print(t)\n             a    b     c\n            --- ------ ---\n              1 -25.55   a\n              4 12.123   b\n              5   85.0   c\n\n        Round them all to 0:\n\n            >>> t.round(0)\n            >>> print(t)\n             a    b    c\n            --- ----- ---\n              1 -26.0   a\n              4  12.0   b\n              5  85.0   c\n\n        Round column 'a' to -1 decimal:\n\n            >>> t.round({'a':-1})\n            >>> print(t)\n             a    b    c\n            --- ----- ---\n              0 -26.0   a\n              0  12.0   b\n              0  85.0   c\n\n        Parameters\n        ----------\n        decimals: int, dict\n            Number of decimals to round the columns to. If a dict is given,\n            the columns will be rounded to the number specified as the value.\n            If a certain column is not in the dict given, it will remain the\n            same.\n        '''\n        if isinstance(decimals, Mapping):\n            decimal_values = decimals.values()\n            column_names = decimals.keys()\n        elif isinstance(decimals, int):\n            decimal_values = itertools.repeat(decimals)\n            column_names = self.colnames\n        else:\n            raise ValueError(\"'decimals' argument must be an int or a dict\")\n\n        for colname, decimal in zip(column_names, decimal_values):\n            col = self.columns[colname]\n            if np.issubdtype(col.info.dtype, np.number):\n                try:\n                    np.around(col, decimals=decimal, out=col)\n                except TypeError:\n                    # Bug in numpy see https://github.com/numpy/numpy/issues/15438\n                    col[()] = np.around(col, decimals=decimal)\n\n    def copy(self, copy_data=True):\n        '''\n        Return a copy of the table.\n\n        Parameters\n        ----------\n        copy_data : bool\n            If `True` (the default), copy the underlying data array.\n            Otherwise, use the same data array. The ``meta`` is always\n            deepcopied regardless of the value for ``copy_data``.\n        '''\n        out = self.__class__(self, copy=copy_data)\n\n        # If the current table is grouped then do the same in the copy\n        if hasattr(self, '_groups'):\n            out._groups = groups.TableGroups(out, indices=self._groups._indices,\n                                             keys=self._groups._keys)\n        return out\n\n    def __deepcopy__(self, memo=None):\n        return self.copy(True)\n\n    def __copy__(self):\n        return self.copy(False)\n\n    def __lt__(self, other):\n        return super().__lt__(other)\n\n    def __gt__(self, other):\n        return super().__gt__(other)\n\n    def __le__(self, other):\n        return super().__le__(other)\n\n    def __ge__(self, other):\n        return super().__ge__(other)\n\n    def __eq__(self, other):\n        return self._rows_equal(other)\n\n    def __ne__(self, other):\n        return ~self.__eq__(other)\n\n    def _rows_equal(self, other):\n        \"\"\"\n        Row-wise comparison of table with any other object.\n\n        This is actual implementation for __eq__.\n\n        Returns a 1-D boolean numpy array showing result of row-wise comparison.\n        This is the same as the ``==`` comparison for tables.\n\n        Parameters\n        ----------\n        other : Table or DataFrame or ndarray\n             An object to compare with table\n\n        Examples\n        --------\n        Comparing one Table with other::\n\n            >>> t1 = Table([[1,2],[4,5],[7,8]], names=('a','b','c'))\n            >>> t2 = Table([[1,2],[4,5],[7,8]], names=('a','b','c'))\n            >>> t1._rows_equal(t2)\n            array([ True,  True])\n\n        \"\"\"\n\n        if isinstance(other, Table):\n            other = other.as_array()\n\n        if self.has_masked_columns:\n            if isinstance(other, np.ma.MaskedArray):\n                result = self.as_array() == other\n            else:\n                # If mask is True, then by definition the row doesn't match\n                # because the other array is not masked.\n                false_mask = np.zeros(1, dtype=[(n, bool) for n in self.dtype.names])\n                result = (self.as_array().data == other) & (self.mask == false_mask)\n        else:\n            if isinstance(other, np.ma.MaskedArray):\n                # If mask is True, then by definition the row doesn't match\n                # because the other array is not masked.\n                false_mask = np.zeros(1, dtype=[(n, bool) for n in other.dtype.names])\n                result = (self.as_array() == other.data) & (other.mask == false_mask)\n            else:\n                result = self.as_array() == other\n\n        return result\n\n    def values_equal(self, other):\n        \"\"\"\n        Element-wise comparison of table with another table, list, or scalar.\n\n        Returns a ``Table`` with the same columns containing boolean values\n        showing result of comparison.\n\n        Parameters\n        ----------\n        other : table-like object or list or scalar\n             Object to compare with table\n\n        Examples\n        --------\n        Compare one Table with other::\n\n          >>> t1 = Table([[1, 2], [4, 5], [-7, 8]], names=('a', 'b', 'c'))\n          >>> t2 = Table([[1, 2], [-4, 5], [7, 8]], names=('a', 'b', 'c'))\n          >>> t1.values_equal(t2)\n          <Table length=2>\n           a     b     c\n          bool  bool  bool\n          ---- ----- -----\n          True False False\n          True  True  True\n\n        \"\"\"\n        if isinstance(other, Table):\n            names = other.colnames\n        else:\n            try:\n                other = Table(other, copy=False)\n                names = other.colnames\n            except Exception:\n                # Broadcast other into a dict, so e.g. other = 2 will turn into\n                # other = {'a': 2, 'b': 2} and then equality does a\n                # column-by-column broadcasting.\n                names = self.colnames\n                other = {name: other for name in names}\n\n        # Require column names match but do not require same column order\n        if set(self.colnames) != set(names):\n            raise ValueError('cannot compare tables with different column names')\n\n        eqs = []\n        for name in names:\n            try:\n                np.broadcast(self[name], other[name])  # Check if broadcast-able\n                # Catch the numpy FutureWarning related to equality checking,\n                # \"elementwise comparison failed; returning scalar instead, but\n                #  in the future will perform elementwise comparison\".  Turn this\n                # into an exception since the scalar answer is not what we want.\n                with warnings.catch_warnings(record=True) as warns:\n                    warnings.simplefilter('always')\n                    eq = self[name] == other[name]\n                    if (warns and issubclass(warns[-1].category, FutureWarning)\n                            and 'elementwise comparison failed' in str(warns[-1].message)):\n                        raise FutureWarning(warns[-1].message)\n            except Exception as err:\n                raise ValueError(f'unable to compare column {name}') from err\n\n            # Be strict about the result from the comparison. E.g. SkyCoord __eq__ is just\n            # broken and completely ignores that it should return an array.\n            if not (isinstance(eq, np.ndarray)\n                    and eq.dtype is np.dtype('bool')\n                    and len(eq) == len(self)):\n                raise TypeError(f'comparison for column {name} returned {eq} '\n                                f'instead of the expected boolean ndarray')\n\n            eqs.append(eq)\n\n        out = Table(eqs, names=names)\n\n        return out\n\n    @property\n    def groups(self):\n        if not hasattr(self, '_groups'):\n            self._groups = groups.TableGroups(self)\n        return self._groups\n\n    def group_by(self, keys):\n        \"\"\"\n        Group this table by the specified ``keys``\n\n        This effectively splits the table into groups which correspond to unique\n        values of the ``keys`` grouping object.  The output is a new\n        `~astropy.table.TableGroups` which contains a copy of this table but\n        sorted by row according to ``keys``.\n\n        The ``keys`` input to `group_by` can be specified in different ways:\n\n          - String or list of strings corresponding to table column name(s)\n          - Numpy array (homogeneous or structured) with same length as this table\n          - `~astropy.table.Table` with same length as this table\n\n        Parameters\n        ----------\n        keys : str, list of str, numpy array, or `~astropy.table.Table`\n            Key grouping object\n\n        Returns\n        -------\n        out : `~astropy.table.Table`\n            New table with groups set\n        \"\"\"\n        return groups.table_group_by(self, keys)\n\n    def to_pandas(self, index=None, use_nullable_int=True):\n        \"\"\"\n        Return a :class:`pandas.DataFrame` instance\n\n        The index of the created DataFrame is controlled by the ``index``\n        argument.  For ``index=True`` or the default ``None``, an index will be\n        specified for the DataFrame if there is a primary key index on the\n        Table *and* if it corresponds to a single column.  If ``index=False``\n        then no DataFrame index will be specified.  If ``index`` is the name of\n        a column in the table then that will be the DataFrame index.\n\n        In addition to vanilla columns or masked columns, this supports Table\n        mixin columns like Quantity, Time, or SkyCoord.  In many cases these\n        objects have no analog in pandas and will be converted to a \"encoded\"\n        representation using only Column or MaskedColumn.  The exception is\n        Time or TimeDelta columns, which will be converted to the corresponding\n        representation in pandas using ``np.datetime64`` or ``np.timedelta64``.\n        See the example below.\n\n        Parameters\n        ----------\n        index : None, bool, str\n            Specify DataFrame index mode\n        use_nullable_int : bool, default=True\n            Convert integer MaskedColumn to pandas nullable integer type.\n            If ``use_nullable_int=False`` or the pandas version does not support\n            nullable integer types (version < 0.24), then the column is converted\n            to float with NaN for missing elements and a warning is issued.\n\n        Returns\n        -------\n        dataframe : :class:`pandas.DataFrame`\n            A pandas :class:`pandas.DataFrame` instance\n\n        Raises\n        ------\n        ImportError\n            If pandas is not installed\n        ValueError\n            If the Table has multi-dimensional columns\n\n        Examples\n        --------\n        Here we convert a table with a few mixins to a\n        :class:`pandas.DataFrame` instance.\n\n          >>> import pandas as pd\n          >>> from astropy.table import QTable\n          >>> import astropy.units as u\n          >>> from astropy.time import Time, TimeDelta\n          >>> from astropy.coordinates import SkyCoord\n\n          >>> q = [1, 2] * u.m\n          >>> tm = Time([1998, 2002], format='jyear')\n          >>> sc = SkyCoord([5, 6], [7, 8], unit='deg')\n          >>> dt = TimeDelta([3, 200] * u.s)\n\n          >>> t = QTable([q, tm, sc, dt], names=['q', 'tm', 'sc', 'dt'])\n\n          >>> df = t.to_pandas(index='tm')\n          >>> with pd.option_context('display.max_columns', 20):\n          ...     print(df)\n                        q  sc.ra  sc.dec              dt\n          tm\n          1998-01-01  1.0    5.0     7.0 0 days 00:00:03\n          2002-01-01  2.0    6.0     8.0 0 days 00:03:20\n\n        \"\"\"\n        from pandas import DataFrame, Series\n\n        if index is not False:\n            if index in (None, True):\n                # Default is to use the table primary key if available and a single column\n                if self.primary_key and len(self.primary_key) == 1:\n                    index = self.primary_key[0]\n                else:\n                    index = False\n            else:\n                if index not in self.colnames:\n                    raise ValueError('index must be None, False, True or a table '\n                                     'column name')\n\n        def _encode_mixins(tbl):\n            \"\"\"Encode a Table ``tbl`` that may have mixin columns to a Table with only\n            astropy Columns + appropriate meta-data to allow subsequent decoding.\n            \"\"\"\n            from . import serialize\n            from astropy.time import TimeBase, TimeDelta\n\n            # Convert any Time or TimeDelta columns and pay attention to masking\n            time_cols = [col for col in tbl.itercols() if isinstance(col, TimeBase)]\n            if time_cols:\n\n                # Make a light copy of table and clear any indices\n                new_cols = []\n                for col in tbl.itercols():\n                    new_col = col_copy(col, copy_indices=False) if col.info.indices else col\n                    new_cols.append(new_col)\n                tbl = tbl.__class__(new_cols, copy=False)\n\n                # Certain subclasses (e.g. TimeSeries) may generate new indices on\n                # table creation, so make sure there are no indices on the table.\n                for col in tbl.itercols():\n                    col.info.indices.clear()\n\n                for col in time_cols:\n                    if isinstance(col, TimeDelta):\n                        # Convert to nanoseconds (matches astropy datetime64 support)\n                        new_col = (col.sec * 1e9).astype('timedelta64[ns]')\n                        nat = np.timedelta64('NaT')\n                    else:\n                        new_col = col.datetime64.copy()\n                        nat = np.datetime64('NaT')\n                    if col.masked:\n                        new_col[col.mask] = nat\n                    tbl[col.info.name] = new_col\n\n            # Convert the table to one with no mixins, only Column objects.\n            encode_tbl = serialize.represent_mixins_as_columns(tbl)\n            return encode_tbl\n\n        tbl = _encode_mixins(self)\n\n        badcols = [name for name, col in self.columns.items() if len(col.shape) > 1]\n        if badcols:\n            raise ValueError(\n                f'Cannot convert a table with multidimensional columns to a '\n                f'pandas DataFrame. Offending columns are: {badcols}\\n'\n                f'One can filter out such columns using:\\n'\n                f'names = [name for name in tbl.colnames if len(tbl[name].shape) <= 1]\\n'\n                f'tbl[names].to_pandas(...)')\n\n        out = OrderedDict()\n\n        for name, column in tbl.columns.items():\n            if getattr(column.dtype, 'isnative', True):\n                out[name] = column\n            else:\n                out[name] = column.data.byteswap().newbyteorder('=')\n\n            if isinstance(column, MaskedColumn) and np.any(column.mask):\n                if column.dtype.kind in ['i', 'u']:\n                    pd_dtype = column.dtype.name\n                    if use_nullable_int:\n                        # Convert int64 to Int64, uint32 to UInt32, etc for nullable types\n                        pd_dtype = pd_dtype.replace('i', 'I').replace('u', 'U')\n                    out[name] = Series(out[name], dtype=pd_dtype)\n\n                    # If pandas is older than 0.24 the type may have turned to float\n                    if column.dtype.kind != out[name].dtype.kind:\n                        warnings.warn(\n                            f\"converted column '{name}' from {column.dtype} to {out[name].dtype}\",\n                            TableReplaceWarning, stacklevel=3)\n                elif column.dtype.kind not in ['f', 'c']:\n                    out[name] = column.astype(object).filled(np.nan)\n\n        kwargs = {}\n\n        if index:\n            idx = out.pop(index)\n\n            kwargs['index'] = idx\n\n            # We add the table index to Series inputs (MaskedColumn with int values) to override\n            # its default RangeIndex, see #11432\n            for v in out.values():\n                if isinstance(v, Series):\n                    v.index = idx\n\n        df = DataFrame(out, **kwargs)\n        if index:\n            # Explicitly set the pandas DataFrame index to the original table\n            # index name.\n            df.index.name = idx.info.name\n\n        return df\n\n    @classmethod\n    def from_pandas(cls, dataframe, index=False, units=None):\n        \"\"\"\n        Create a `~astropy.table.Table` from a :class:`pandas.DataFrame` instance\n\n        In addition to converting generic numeric or string columns, this supports\n        conversion of pandas Date and Time delta columns to `~astropy.time.Time`\n        and `~astropy.time.TimeDelta` columns, respectively.\n\n        Parameters\n        ----------\n        dataframe : :class:`pandas.DataFrame`\n            A pandas :class:`pandas.DataFrame` instance\n        index : bool\n            Include the index column in the returned table (default=False)\n        units: dict\n            A dict mapping column names to to a `~astropy.units.Unit`.\n            The columns will have the specified unit in the Table.\n\n        Returns\n        -------\n        table : `~astropy.table.Table`\n            A `~astropy.table.Table` (or subclass) instance\n\n        Raises\n        ------\n        ImportError\n            If pandas is not installed\n\n        Examples\n        --------\n        Here we convert a :class:`pandas.DataFrame` instance\n        to a `~astropy.table.QTable`.\n\n          >>> import numpy as np\n          >>> import pandas as pd\n          >>> from astropy.table import QTable\n\n          >>> time = pd.Series(['1998-01-01', '2002-01-01'], dtype='datetime64[ns]')\n          >>> dt = pd.Series(np.array([1, 300], dtype='timedelta64[s]'))\n          >>> df = pd.DataFrame({'time': time})\n          >>> df['dt'] = dt\n          >>> df['x'] = [3., 4.]\n          >>> with pd.option_context('display.max_columns', 20):\n          ...     print(df)\n                  time              dt    x\n          0 1998-01-01 0 days 00:00:01  3.0\n          1 2002-01-01 0 days 00:05:00  4.0\n\n          >>> QTable.from_pandas(df)\n          <QTable length=2>\n                    time              dt       x\n                    Time          TimeDelta float64\n          ----------------------- --------- -------\n          1998-01-01T00:00:00.000       1.0     3.0\n          2002-01-01T00:00:00.000     300.0     4.0\n\n        \"\"\"\n\n        out = OrderedDict()\n\n        names = list(dataframe.columns)\n        columns = [dataframe[name] for name in names]\n        datas = [np.array(column) for column in columns]\n        masks = [np.array(column.isnull()) for column in columns]\n\n        if index:\n            index_name = dataframe.index.name or 'index'\n            while index_name in names:\n                index_name = '_' + index_name + '_'\n            names.insert(0, index_name)\n            columns.insert(0, dataframe.index)\n            datas.insert(0, np.array(dataframe.index))\n            masks.insert(0, np.zeros(len(dataframe), dtype=bool))\n\n        if units is None:\n            units = [None] * len(names)\n        else:\n            if not isinstance(units, Mapping):\n                raise TypeError('Expected a Mapping \"column-name\" -> \"unit\"')\n\n            not_found = set(units.keys()) - set(names)\n            if not_found:\n                warnings.warn(f'`units` contains additional columns: {not_found}')\n\n            units = [units.get(name) for name in names]\n\n        for name, column, data, mask, unit in zip(names, columns, datas, masks, units):\n\n            if column.dtype.kind in ['u', 'i'] and np.any(mask):\n                # Special-case support for pandas nullable int\n                np_dtype = str(column.dtype).lower()\n                data = np.zeros(shape=column.shape, dtype=np_dtype)\n                data[~mask] = column[~mask]\n                out[name] = MaskedColumn(data=data, name=name, mask=mask, unit=unit, copy=False)\n                continue\n\n            if data.dtype.kind == 'O':\n                # If all elements of an object array are string-like or np.nan\n                # then coerce back to a native numpy str/unicode array.\n                string_types = (str, bytes)\n                nan = np.nan\n                if all(isinstance(x, string_types) or x is nan for x in data):\n                    # Force any missing (null) values to b''.  Numpy will\n                    # upcast to str/unicode as needed.\n                    data[mask] = b''\n\n                    # When the numpy object array is represented as a list then\n                    # numpy initializes to the correct string or unicode type.\n                    data = np.array([x for x in data])\n\n            # Numpy datetime64\n            if data.dtype.kind == 'M':\n                from astropy.time import Time\n                out[name] = Time(data, format='datetime64')\n                if np.any(mask):\n                    out[name][mask] = np.ma.masked\n                out[name].format = 'isot'\n\n            # Numpy timedelta64\n            elif data.dtype.kind == 'm':\n                from astropy.time import TimeDelta\n                data_sec = data.astype('timedelta64[ns]').astype(np.float64) / 1e9\n                out[name] = TimeDelta(data_sec, format='sec')\n                if np.any(mask):\n                    out[name][mask] = np.ma.masked\n\n            else:\n                if np.any(mask):\n                    out[name] = MaskedColumn(data=data, name=name, mask=mask, unit=unit)\n                else:\n                    out[name] = Column(data=data, name=name, unit=unit)\n\n        return cls(out)\n\n    info = TableInfo()"},{"col":4,"comment":"\n        Returns a 'canonical' string representation of this format.\n\n        This is in the proper form of Tw.d where T is the single character data\n        type code, w is the width in characters for this field, and d is the\n        number of digits after the decimal place (for format codes 'E', 'F',\n        and 'D' only).\n        ","endLoc":366,"header":"@lazyproperty\n    def canonical(self)","id":1411,"name":"canonical","nodeType":"Function","startLoc":352,"text":"@lazyproperty\n    def canonical(self):\n        \"\"\"\n        Returns a 'canonical' string representation of this format.\n\n        This is in the proper form of Tw.d where T is the single character data\n        type code, w is the width in characters for this field, and d is the\n        number of digits after the decimal place (for format codes 'E', 'F',\n        and 'D' only).\n        \"\"\"\n\n        if self.format in ('E', 'F', 'D'):\n            return f'{self.format}{self.width}.{self.precision}'\n\n        return f'{self.format}{self.width}'"},{"attributeType":"null","col":33,"comment":"null","endLoc":320,"id":1412,"name":"precision","nodeType":"Attribute","startLoc":320,"text":"self.precision"},{"col":4,"comment":"\n        Read data of all HDUs into memory.\n        ","endLoc":793,"header":"def readall(self)","id":1413,"name":"readall","nodeType":"Function","startLoc":788,"text":"def readall(self):\n        \"\"\"\n        Read data of all HDUs into memory.\n        \"\"\"\n        while self._read_next_hdu():\n            pass"},{"attributeType":"null","col":8,"comment":"null","endLoc":329,"id":1414,"name":"_pseudo_logical","nodeType":"Attribute","startLoc":329,"text":"self._pseudo_logical"},{"attributeType":"null","col":8,"comment":"null","endLoc":320,"id":1415,"name":"format","nodeType":"Attribute","startLoc":320,"text":"self.format"},{"attributeType":"null","col":21,"comment":"null","endLoc":320,"id":1416,"name":"width","nodeType":"Attribute","startLoc":320,"text":"self.width"},{"col":0,"comment":"\n    Return the `PhysicalType` instance associated with the name of a\n    physical type.\n    ","endLoc":150,"header":"def _physical_type_from_str(name)","id":1417,"name":"_physical_type_from_str","nodeType":"Function","startLoc":137,"text":"def _physical_type_from_str(name):\n    \"\"\"\n    Return the `PhysicalType` instance associated with the name of a\n    physical type.\n    \"\"\"\n    if name == \"unknown\":\n        raise ValueError(\"cannot uniquely identify an 'unknown' physical type.\")\n\n    elif name in _attrname_physical_mapping:\n        return _attrname_physical_mapping[name]  # convert attribute-accessible\n    elif name in _name_physical_mapping:\n        return _name_physical_mapping[name]\n    else:\n        raise ValueError(f\"{name!r} is not a known physical type.\")"},{"col":4,"comment":"\n        Lazily load a single HDU from the fileobj or data string the `HDUList`\n        was opened from, unless no further HDUs are found.\n\n        Returns True if a new HDU was loaded, or False otherwise.\n        ","endLoc":1237,"header":"def _read_next_hdu(self)","id":1418,"name":"_read_next_hdu","nodeType":"Function","startLoc":1153,"text":"def _read_next_hdu(self):\n        \"\"\"\n        Lazily load a single HDU from the fileobj or data string the `HDUList`\n        was opened from, unless no further HDUs are found.\n\n        Returns True if a new HDU was loaded, or False otherwise.\n        \"\"\"\n\n        if self._read_all:\n            return False\n\n        saved_compression_enabled = compressed.COMPRESSION_ENABLED\n        fileobj, data, kwargs = self._file, self._data, self._open_kwargs\n\n        if fileobj is not None and fileobj.closed:\n            return False\n\n        try:\n            self._in_read_next_hdu = True\n\n            if ('disable_image_compression' in kwargs and\n                    kwargs['disable_image_compression']):\n                compressed.COMPRESSION_ENABLED = False\n\n            # read all HDUs\n            try:\n                if fileobj is not None:\n                    try:\n                        # Make sure we're back to the end of the last read\n                        # HDU\n                        if len(self) > 0:\n                            last = self[len(self) - 1]\n                            if last._data_offset is not None:\n                                offset = last._data_offset + last._data_size\n                                fileobj.seek(offset, os.SEEK_SET)\n\n                        hdu = _BaseHDU.readfrom(fileobj, **kwargs)\n                    except EOFError:\n                        self._read_all = True\n                        return False\n                    except OSError:\n                        # Close the file: see\n                        # https://github.com/astropy/astropy/issues/6168\n                        #\n                        if self._file.close_on_error:\n                            self._file.close()\n\n                        if fileobj.writeonly:\n                            self._read_all = True\n                            return False\n                        else:\n                            raise\n                else:\n                    if not data:\n                        self._read_all = True\n                        return False\n                    hdu = _BaseHDU.fromstring(data, **kwargs)\n                    self._data = data[hdu._data_offset + hdu._data_size:]\n\n                super().append(hdu)\n                if len(self) == 1:\n                    # Check for an extension HDU and update the EXTEND\n                    # keyword of the primary HDU accordingly\n                    self.update_extend()\n\n                hdu._new = False\n                if 'checksum' in kwargs:\n                    hdu._output_checksum = kwargs['checksum']\n            # check in the case there is extra space after the last HDU or\n            # corrupted HDU\n            except (VerifyError, ValueError) as exc:\n                warnings.warn(\n                    'Error validating header for HDU #{} (note: Astropy '\n                    'uses zero-based indexing).\\n{}\\n'\n                    'There may be extra bytes after the last HDU or the '\n                    'file is corrupted.'.format(\n                        len(self), indent(str(exc))), VerifyWarning)\n                del exc\n                self._read_all = True\n                return False\n        finally:\n            compressed.COMPRESSION_ENABLED = saved_compression_enabled\n            self._in_read_next_hdu = False\n\n        return True"},{"col":4,"comment":"null","endLoc":566,"header":"def __init__(self, ldict, log=None, reflags=0)","id":1419,"name":"__init__","nodeType":"Function","startLoc":558,"text":"def __init__(self, ldict, log=None, reflags=0):\n        self.ldict      = ldict\n        self.error_func = None\n        self.tokens     = []\n        self.reflags    = reflags\n        self.stateinfo  = {'INITIAL': 'inclusive'}\n        self.modules    = set()\n        self.error      = False\n        self.log        = PlyLogger(sys.stderr) if log is None else log"},{"attributeType":"null","col":8,"comment":"null","endLoc":319,"id":1420,"name":"self","nodeType":"Attribute","startLoc":319,"text":"self"},{"attributeType":"null","col":12,"comment":"null","endLoc":325,"id":1421,"name":"recformat","nodeType":"Attribute","startLoc":325,"text":"self.recformat"},{"className":"_FormatQ","col":0,"comment":"Carries type description of the Q format for variable length arrays.\n\n    The Q format is like the P format but uses 64-bit integers in the array\n    descriptors, allowing for heaps stored beyond 2GB into a file.\n    ","endLoc":440,"id":1422,"nodeType":"Class","startLoc":431,"text":"class _FormatQ(_FormatP):\n    \"\"\"Carries type description of the Q format for variable length arrays.\n\n    The Q format is like the P format but uses 64-bit integers in the array\n    descriptors, allowing for heaps stored beyond 2GB into a file.\n    \"\"\"\n\n    _format_code = 'Q'\n    _format_re = re.compile(_FormatP._format_re_template.format(_format_code))\n    _descriptor_format = '2i8'"},{"attributeType":"null","col":4,"comment":"null","endLoc":438,"id":1423,"name":"_format_code","nodeType":"Attribute","startLoc":438,"text":"_format_code"},{"attributeType":"null","col":4,"comment":"null","endLoc":439,"id":1424,"name":"_format_re","nodeType":"Attribute","startLoc":439,"text":"_format_re"},{"attributeType":"null","col":4,"comment":"null","endLoc":440,"id":1425,"name":"_descriptor_format","nodeType":"Attribute","startLoc":440,"text":"_descriptor_format"},{"className":"ColumnAttribute","col":0,"comment":"\n    Descriptor for attributes of `Column` that are associated with keywords\n    in the FITS header and describe properties of the column as specified in\n    the FITS standard.\n\n    Each `ColumnAttribute` may have a ``validator`` method defined on it.\n    This validates values set on this attribute to ensure that they meet the\n    FITS standard.  Invalid values will raise a warning and will not be used in\n    formatting the column.  The validator should take two arguments--the\n    `Column` it is being assigned to, and the new value for the attribute, and\n    it must raise an `AssertionError` if the value is invalid.\n\n    The `ColumnAttribute` itself is a decorator that can be used to define the\n    ``validator`` for each column attribute.  For example::\n\n        @ColumnAttribute('TTYPE')\n        def name(col, name):\n            if not isinstance(name, str):\n                raise AssertionError\n\n    The actual object returned by this decorator is the `ColumnAttribute`\n    instance though, not the ``name`` function.  As such ``name`` is not a\n    method of the class it is defined in.\n\n    The setter for `ColumnAttribute` also updates the header of any table\n    HDU this column is attached to in order to reflect the change.  The\n    ``validator`` should ensure that the value is valid for inclusion in a FITS\n    header.\n    ","endLoc":512,"id":1426,"nodeType":"Class","startLoc":443,"text":"class ColumnAttribute:\n    \"\"\"\n    Descriptor for attributes of `Column` that are associated with keywords\n    in the FITS header and describe properties of the column as specified in\n    the FITS standard.\n\n    Each `ColumnAttribute` may have a ``validator`` method defined on it.\n    This validates values set on this attribute to ensure that they meet the\n    FITS standard.  Invalid values will raise a warning and will not be used in\n    formatting the column.  The validator should take two arguments--the\n    `Column` it is being assigned to, and the new value for the attribute, and\n    it must raise an `AssertionError` if the value is invalid.\n\n    The `ColumnAttribute` itself is a decorator that can be used to define the\n    ``validator`` for each column attribute.  For example::\n\n        @ColumnAttribute('TTYPE')\n        def name(col, name):\n            if not isinstance(name, str):\n                raise AssertionError\n\n    The actual object returned by this decorator is the `ColumnAttribute`\n    instance though, not the ``name`` function.  As such ``name`` is not a\n    method of the class it is defined in.\n\n    The setter for `ColumnAttribute` also updates the header of any table\n    HDU this column is attached to in order to reflect the change.  The\n    ``validator`` should ensure that the value is valid for inclusion in a FITS\n    header.\n    \"\"\"\n\n    def __init__(self, keyword):\n        self._keyword = keyword\n        self._validator = None\n\n        # The name of the attribute associated with this keyword is currently\n        # determined from the KEYWORD_NAMES/ATTRIBUTES lists.  This could be\n        # make more flexible in the future, for example, to support custom\n        # column attributes.\n        self._attr = '_' + KEYWORD_TO_ATTRIBUTE[self._keyword]\n\n    def __get__(self, obj, objtype=None):\n        if obj is None:\n            return self\n        else:\n            return getattr(obj, self._attr)\n\n    def __set__(self, obj, value):\n        if self._validator is not None:\n            self._validator(obj, value)\n\n        old_value = getattr(obj, self._attr, None)\n        setattr(obj, self._attr, value)\n        obj._notify('column_attribute_changed', obj, self._attr[1:], old_value,\n                    value)\n\n    def __call__(self, func):\n        \"\"\"\n        Set the validator for this column attribute.\n\n        Returns ``self`` so that this can be used as a decorator, as described\n        in the docs for this class.\n        \"\"\"\n\n        self._validator = func\n\n        return self\n\n    def __repr__(self):\n        return f\"{self.__class__.__name__}('{self._keyword}')\""},{"col":4,"comment":"null","endLoc":482,"header":"def __init__(self, keyword)","id":1427,"name":"__init__","nodeType":"Function","startLoc":474,"text":"def __init__(self, keyword):\n        self._keyword = keyword\n        self._validator = None\n\n        # The name of the attribute associated with this keyword is currently\n        # determined from the KEYWORD_NAMES/ATTRIBUTES lists.  This could be\n        # make more flexible in the future, for example, to support custom\n        # column attributes.\n        self._attr = '_' + KEYWORD_TO_ATTRIBUTE[self._keyword]"},{"col":4,"comment":"null","endLoc":488,"header":"def __get__(self, obj, objtype=None)","id":1428,"name":"__get__","nodeType":"Function","startLoc":484,"text":"def __get__(self, obj, objtype=None):\n        if obj is None:\n            return self\n        else:\n            return getattr(obj, self._attr)"},{"col":4,"comment":"null","endLoc":497,"header":"def __set__(self, obj, value)","id":1429,"name":"__set__","nodeType":"Function","startLoc":490,"text":"def __set__(self, obj, value):\n        if self._validator is not None:\n            self._validator(obj, value)\n\n        old_value = getattr(obj, self._attr, None)\n        setattr(obj, self._attr, value)\n        obj._notify('column_attribute_changed', obj, self._attr[1:], old_value,\n                    value)"},{"col":4,"comment":"null","endLoc":568,"header":"def _ipython_key_completions_(self)","id":1430,"name":"_ipython_key_completions_","nodeType":"Function","startLoc":567,"text":"def _ipython_key_completions_(self):\n        return self.names"},{"col":4,"comment":"\n        The Numpy documentation lies; `numpy.ndarray.copy` is not equivalent to\n        `numpy.copy`.  Differences include that it re-views the copied array as\n        self's ndarray subclass, as though it were taking a slice; this means\n        ``__array_finalize__`` is called and the copy shares all the array\n        attributes (including ``._converted``!).  So we need to make a deep\n        copy of all those attributes so that the two arrays truly do not share\n        any data.\n        ","endLoc":584,"header":"def copy(self, order='C')","id":1431,"name":"copy","nodeType":"Function","startLoc":570,"text":"def copy(self, order='C'):\n        \"\"\"\n        The Numpy documentation lies; `numpy.ndarray.copy` is not equivalent to\n        `numpy.copy`.  Differences include that it re-views the copied array as\n        self's ndarray subclass, as though it were taking a slice; this means\n        ``__array_finalize__`` is called and the copy shares all the array\n        attributes (including ``._converted``!).  So we need to make a deep\n        copy of all those attributes so that the two arrays truly do not share\n        any data.\n        \"\"\"\n\n        new = super().copy(order=order)\n\n        new.__dict__ = copy.deepcopy(self.__dict__)\n        return new"},{"col":0,"comment":"null","endLoc":440,"header":"def _get_regex(func)","id":1432,"name":"_get_regex","nodeType":"Function","startLoc":439,"text":"def _get_regex(func):\n    return getattr(func, 'regex', func.__doc__)"},{"col":4,"comment":"A user-visible accessor for the coldefs.","endLoc":590,"header":"@property\n    def columns(self)","id":1433,"name":"columns","nodeType":"Function","startLoc":586,"text":"@property\n    def columns(self):\n        \"\"\"A user-visible accessor for the coldefs.\"\"\"\n\n        return self._coldefs"},{"col":4,"comment":"null","endLoc":610,"header":"@property\n    def _coldefs(self)","id":1434,"name":"_coldefs","nodeType":"Function","startLoc":592,"text":"@property\n    def _coldefs(self):\n        # This used to be a normal internal attribute, but it was changed to a\n        # property as a quick and transparent way to work around the reference\n        # leak bug fixed in https://github.com/astropy/astropy/pull/4539\n        #\n        # See the long comment in the Column.array property for more details\n        # on this.  But in short, FITS_rec now has a ._col_weakrefs attribute\n        # which is a WeakSet of weakrefs to each Column in _coldefs.\n        #\n        # So whenever ._coldefs is set we also add each Column in the ColDefs\n        # to the weakrefs set.  This is an easy way to find out if a Column has\n        # any references to it external to the FITS_rec (i.e. a user assigned a\n        # column to a variable).  If the column is still in _col_weakrefs then\n        # there are other references to it external to this FITS_rec.  We use\n        # that information in __del__ to save off copies of the array data\n        # for those columns to their Column.array property before our memory\n        # is freed.\n        return self.__dict__.get('_coldefs')"},{"col":4,"comment":"\n        Read the HDU from a file.  Normally an HDU should be opened with\n        :func:`open` which reads the entire HDU list in a FITS file.  But this\n        method is still provided for symmetry with :func:`writeto`.\n\n        Parameters\n        ----------\n        fileobj : file-like\n            Input FITS file.  The file's seek pointer is assumed to be at the\n            beginning of the HDU.\n\n        checksum : bool\n            If `True`, verifies that both ``DATASUM`` and ``CHECKSUM`` card\n            values (when present in the HDU header) match the header and data\n            of all HDU's in the file.\n\n        ignore_missing_end : bool\n            Do not issue an exception when opening a file that is missing an\n            ``END`` card in the last header.\n        ","endLoc":338,"header":"@classmethod\n    def readfrom(cls, fileobj, checksum=False, ignore_missing_end=False,\n                 **kwargs)","id":1435,"name":"readfrom","nodeType":"Function","startLoc":302,"text":"@classmethod\n    def readfrom(cls, fileobj, checksum=False, ignore_missing_end=False,\n                 **kwargs):\n        \"\"\"\n        Read the HDU from a file.  Normally an HDU should be opened with\n        :func:`open` which reads the entire HDU list in a FITS file.  But this\n        method is still provided for symmetry with :func:`writeto`.\n\n        Parameters\n        ----------\n        fileobj : file-like\n            Input FITS file.  The file's seek pointer is assumed to be at the\n            beginning of the HDU.\n\n        checksum : bool\n            If `True`, verifies that both ``DATASUM`` and ``CHECKSUM`` card\n            values (when present in the HDU header) match the header and data\n            of all HDU's in the file.\n\n        ignore_missing_end : bool\n            Do not issue an exception when opening a file that is missing an\n            ``END`` card in the last header.\n        \"\"\"\n\n        # TODO: Figure out a way to make it possible for the _File\n        # constructor to be a noop if the argument is already a _File\n        if not isinstance(fileobj, _File):\n            fileobj = _File(fileobj)\n\n        hdu = cls._readfrom_internal(fileobj, checksum=checksum,\n                                     ignore_missing_end=ignore_missing_end,\n                                     **kwargs)\n\n        # If the checksum had to be checked the data may have already been read\n        # from the file, in which case we don't want to seek relative\n        fileobj.seek(hdu._data_offset + hdu._data_size, os.SEEK_SET)\n        return hdu"},{"col":4,"comment":"null","endLoc":617,"header":"@_coldefs.setter\n    def _coldefs(self, cols)","id":1436,"name":"_coldefs","nodeType":"Function","startLoc":612,"text":"@_coldefs.setter\n    def _coldefs(self, cols):\n        self.__dict__['_coldefs'] = cols\n        if isinstance(cols, ColDefs):\n            for col in cols.columns:\n                self._col_weakrefs.add(col)"},{"col":0,"comment":"null","endLoc":523,"header":"def _form_master_re(relist, reflags, ldict, toknames)","id":1437,"name":"_form_master_re","nodeType":"Function","startLoc":493,"text":"def _form_master_re(relist, reflags, ldict, toknames):\n    if not relist:\n        return []\n    regex = '|'.join(relist)\n    try:\n        lexre = re.compile(regex, reflags)\n\n        # Build the index to function map for the matching engine\n        lexindexfunc = [None] * (max(lexre.groupindex.values()) + 1)\n        lexindexnames = lexindexfunc[:]\n\n        for f, i in lexre.groupindex.items():\n            handle = ldict.get(f, None)\n            if type(handle) in (types.FunctionType, types.MethodType):\n                lexindexfunc[i] = (handle, toknames[f])\n                lexindexnames[i] = f\n            elif handle is not None:\n                lexindexnames[i] = f\n                if f.find('ignore_') > 0:\n                    lexindexfunc[i] = (None, None)\n                else:\n                    lexindexfunc[i] = (None, toknames[f])\n\n        return [(lexre, lexindexfunc)], [regex], [lexindexnames]\n    except Exception:\n        m = int(len(relist)/2)\n        if m == 0:\n            m = 1\n        llist, lre, lnames = _form_master_re(relist[:m], reflags, ldict, toknames)\n        rlist, rre, rnames = _form_master_re(relist[m:], reflags, ldict, toknames)\n        return (llist+rlist), (lre+rre), (lnames+rnames)"},{"col":4,"comment":"null","endLoc":624,"header":"@_coldefs.deleter\n    def _coldefs(self)","id":1438,"name":"_coldefs","nodeType":"Function","startLoc":619,"text":"@_coldefs.deleter\n    def _coldefs(self):\n        try:\n            del self.__dict__['_coldefs']\n        except KeyError as exc:\n            raise AttributeError(exc.args[0])"},{"col":4,"comment":"null","endLoc":637,"header":"def __del__(self)","id":1439,"name":"__del__","nodeType":"Function","startLoc":626,"text":"def __del__(self):\n        try:\n            del self._coldefs\n            if self.dtype.fields is not None:\n                for col in self._col_weakrefs:\n\n                    if col.array is not None:\n                        col.array = col.array.copy()\n\n        # See issues #4690 and #4912\n        except (AttributeError, TypeError):  # pragma: no cover\n            pass"},{"col":4,"comment":"\n        Set the validator for this column attribute.\n\n        Returns ``self`` so that this can be used as a decorator, as described\n        in the docs for this class.\n        ","endLoc":509,"header":"def __call__(self, func)","id":1440,"name":"__call__","nodeType":"Function","startLoc":499,"text":"def __call__(self, func):\n        \"\"\"\n        Set the validator for this column attribute.\n\n        Returns ``self`` so that this can be used as a decorator, as described\n        in the docs for this class.\n        \"\"\"\n\n        self._validator = func\n\n        return self"},{"col":4,"comment":"null","endLoc":512,"header":"def __repr__(self)","id":1441,"name":"__repr__","nodeType":"Function","startLoc":511,"text":"def __repr__(self):\n        return f\"{self.__class__.__name__}('{self._keyword}')\""},{"attributeType":"None","col":8,"comment":"null","endLoc":476,"id":1442,"name":"_validator","nodeType":"Attribute","startLoc":476,"text":"self._validator"},{"attributeType":"null","col":8,"comment":"null","endLoc":482,"id":1443,"name":"_attr","nodeType":"Attribute","startLoc":482,"text":"self._attr"},{"attributeType":"null","col":8,"comment":"null","endLoc":475,"id":1444,"name":"_keyword","nodeType":"Attribute","startLoc":475,"text":"self._keyword"},{"col":4,"comment":"List of column names.","endLoc":648,"header":"@property\n    def names(self)","id":1445,"name":"names","nodeType":"Function","startLoc":639,"text":"@property\n    def names(self):\n        \"\"\"List of column names.\"\"\"\n\n        if self.dtype.fields:\n            return list(self.dtype.names)\n        elif getattr(self, '_coldefs', None) is not None:\n            return self._coldefs.names\n        else:\n            return None"},{"col":4,"comment":"List of column FITS formats.","endLoc":657,"header":"@property\n    def formats(self)","id":1446,"name":"formats","nodeType":"Function","startLoc":650,"text":"@property\n    def formats(self):\n        \"\"\"List of column FITS formats.\"\"\"\n\n        if getattr(self, '_coldefs', None) is not None:\n            return self._coldefs.formats\n\n        return None"},{"col":4,"comment":"\n        Returns the size of row items that would be written to the raw FITS\n        file, taking into account the possibility of unicode columns being\n        compactified.\n\n        Currently for internal use only.\n        ","endLoc":679,"header":"@property\n    def _raw_itemsize(self)","id":1447,"name":"_raw_itemsize","nodeType":"Function","startLoc":659,"text":"@property\n    def _raw_itemsize(self):\n        \"\"\"\n        Returns the size of row items that would be written to the raw FITS\n        file, taking into account the possibility of unicode columns being\n        compactified.\n\n        Currently for internal use only.\n        \"\"\"\n\n        if _has_unicode_fields(self):\n            total_itemsize = 0\n            for field in self.dtype.fields.values():\n                itemsize = field[0].itemsize\n                if field[0].kind == 'U':\n                    itemsize = itemsize // 4\n                total_itemsize += itemsize\n            return total_itemsize\n        else:\n            # Just return the normal itemsize\n            return self.itemsize"},{"className":"Column","col":0,"comment":"\n    Class which contains the definition of one column, e.g.  ``ttype``,\n    ``tform``, etc. and the array containing values for the column.\n    ","endLoc":1343,"id":1448,"nodeType":"Class","startLoc":515,"text":"class Column(NotifierMixin):\n    \"\"\"\n    Class which contains the definition of one column, e.g.  ``ttype``,\n    ``tform``, etc. and the array containing values for the column.\n    \"\"\"\n\n    def __init__(self, name=None, format=None, unit=None, null=None,\n                 bscale=None, bzero=None, disp=None, start=None, dim=None,\n                 array=None, ascii=None, coord_type=None, coord_unit=None,\n                 coord_ref_point=None, coord_ref_value=None, coord_inc=None,\n                 time_ref_pos=None):\n        \"\"\"\n        Construct a `Column` by specifying attributes.  All attributes\n        except ``format`` can be optional; see :ref:`astropy:column_creation`\n        and :ref:`astropy:creating_ascii_table` for more information regarding\n        ``TFORM`` keyword.\n\n        Parameters\n        ----------\n        name : str, optional\n            column name, corresponding to ``TTYPE`` keyword\n\n        format : str\n            column format, corresponding to ``TFORM`` keyword\n\n        unit : str, optional\n            column unit, corresponding to ``TUNIT`` keyword\n\n        null : str, optional\n            null value, corresponding to ``TNULL`` keyword\n\n        bscale : int-like, optional\n            bscale value, corresponding to ``TSCAL`` keyword\n\n        bzero : int-like, optional\n            bzero value, corresponding to ``TZERO`` keyword\n\n        disp : str, optional\n            display format, corresponding to ``TDISP`` keyword\n\n        start : int, optional\n            column starting position (ASCII table only), corresponding\n            to ``TBCOL`` keyword\n\n        dim : str, optional\n            column dimension corresponding to ``TDIM`` keyword\n\n        array : iterable, optional\n            a `list`, `numpy.ndarray` (or other iterable that can be used to\n            initialize an ndarray) providing initial data for this column.\n            The array will be automatically converted, if possible, to the data\n            format of the column.  In the case were non-trivial ``bscale``\n            and/or ``bzero`` arguments are given, the values in the array must\n            be the *physical* values--that is, the values of column as if the\n            scaling has already been applied (the array stored on the column\n            object will then be converted back to its storage values).\n\n        ascii : bool, optional\n            set `True` if this describes a column for an ASCII table; this\n            may be required to disambiguate the column format\n\n        coord_type : str, optional\n            coordinate/axis type corresponding to ``TCTYP`` keyword\n\n        coord_unit : str, optional\n            coordinate/axis unit corresponding to ``TCUNI`` keyword\n\n        coord_ref_point : int-like, optional\n            pixel coordinate of the reference point corresponding to ``TCRPX``\n            keyword\n\n        coord_ref_value : int-like, optional\n            coordinate value at reference point corresponding to ``TCRVL``\n            keyword\n\n        coord_inc : int-like, optional\n            coordinate increment at reference point corresponding to ``TCDLT``\n            keyword\n\n        time_ref_pos : str, optional\n            reference position for a time coordinate column corresponding to\n            ``TRPOS`` keyword\n        \"\"\"\n\n        if format is None:\n            raise ValueError('Must specify format to construct Column.')\n\n        # any of the input argument (except array) can be a Card or just\n        # a number/string\n        kwargs = {'ascii': ascii}\n        for attr in KEYWORD_ATTRIBUTES:\n            value = locals()[attr]  # get the argument's value\n\n            if isinstance(value, Card):\n                value = value.value\n\n            kwargs[attr] = value\n\n        valid_kwargs, invalid_kwargs = self._verify_keywords(**kwargs)\n\n        if invalid_kwargs:\n            msg = ['The following keyword arguments to Column were invalid:']\n\n            for val in invalid_kwargs.values():\n                msg.append(indent(val[1]))\n\n            raise VerifyError('\\n'.join(msg))\n\n        for attr in KEYWORD_ATTRIBUTES:\n            setattr(self, attr, valid_kwargs.get(attr))\n\n        # TODO: Try to eliminate the following two special cases\n        # for recformat and dim:\n        # This is not actually stored as an attribute on columns for some\n        # reason\n        recformat = valid_kwargs['recformat']\n\n        # The 'dim' keyword's original value is stored in self.dim, while\n        # *only* the tuple form is stored in self._dims.\n        self._dims = self.dim\n        self.dim = dim\n\n        # Awful hack to use for now to keep track of whether the column holds\n        # pseudo-unsigned int data\n        self._pseudo_unsigned_ints = False\n\n        # if the column data is not ndarray, make it to be one, i.e.\n        # input arrays can be just list or tuple, not required to be ndarray\n        # does not include Object array because there is no guarantee\n        # the elements in the object array are consistent.\n        if not isinstance(array,\n                          (np.ndarray, chararray.chararray, Delayed)):\n            try:  # try to convert to a ndarray first\n                if array is not None:\n                    array = np.array(array)\n            except Exception:\n                try:  # then try to convert it to a strings array\n                    itemsize = int(recformat[1:])\n                    array = chararray.array(array, itemsize=itemsize)\n                except ValueError:\n                    # then try variable length array\n                    # Note: This includes _FormatQ by inheritance\n                    if isinstance(recformat, _FormatP):\n                        array = _VLF(array, dtype=recformat.dtype)\n                    else:\n                        raise ValueError('Data is inconsistent with the '\n                                         'format `{}`.'.format(format))\n\n        array = self._convert_to_valid_data_type(array)\n\n        # We have required (through documentation) that arrays passed in to\n        # this constructor are already in their physical values, so we make\n        # note of that here\n        if isinstance(array, np.ndarray):\n            self._physical_values = True\n        else:\n            self._physical_values = False\n\n        self._parent_fits_rec = None\n        self.array = array\n\n    def __repr__(self):\n        text = ''\n        for attr in KEYWORD_ATTRIBUTES:\n            value = getattr(self, attr)\n            if value is not None:\n                text += attr + ' = ' + repr(value) + '; '\n        return text[:-2]\n\n    def __eq__(self, other):\n        \"\"\"\n        Two columns are equal if their name and format are the same.  Other\n        attributes aren't taken into account at this time.\n        \"\"\"\n\n        # According to the FITS standard column names must be case-insensitive\n        a = (self.name.lower(), self.format)\n        b = (other.name.lower(), other.format)\n        return a == b\n\n    def __hash__(self):\n        \"\"\"\n        Like __eq__, the hash of a column should be based on the unique column\n        name and format, and be case-insensitive with respect to the column\n        name.\n        \"\"\"\n\n        return hash((self.name.lower(), self.format))\n\n    @property\n    def array(self):\n        \"\"\"\n        The Numpy `~numpy.ndarray` associated with this `Column`.\n\n        If the column was instantiated with an array passed to the ``array``\n        argument, this will return that array.  However, if the column is\n        later added to a table, such as via `BinTableHDU.from_columns` as\n        is typically the case, this attribute will be updated to reference\n        the associated field in the table, which may no longer be the same\n        array.\n        \"\"\"\n\n        # Ideally the .array attribute never would have existed in the first\n        # place, or would have been internal-only.  This is a legacy of the\n        # older design from Astropy that needs to have continued support, for\n        # now.\n\n        # One of the main problems with this design was that it created a\n        # reference cycle.  When the .array attribute was updated after\n        # creating a FITS_rec from the column (as explained in the docstring) a\n        # reference cycle was created.  This is because the code in BinTableHDU\n        # (and a few other places) does essentially the following:\n        #\n        # data._coldefs = columns  # The ColDefs object holding this Column\n        # for col in columns:\n        #     col.array = data.field(col.name)\n        #\n        # This way each columns .array attribute now points to the field in the\n        # table data.  It's actually a pretty confusing interface (since it\n        # replaces the array originally pointed to by .array), but it's the way\n        # things have been for a long, long time.\n        #\n        # However, this results, in *many* cases, in a reference cycle.\n        # Because the array returned by data.field(col.name), while sometimes\n        # an array that owns its own data, is usually like a slice of the\n        # original data.  It has the original FITS_rec as the array .base.\n        # This results in the following reference cycle (for the n-th column):\n        #\n        #    data -> data._coldefs -> data._coldefs[n] ->\n        #     data._coldefs[n].array -> data._coldefs[n].array.base -> data\n        #\n        # Because ndarray objects do not handled by Python's garbage collector\n        # the reference cycle cannot be broken.  Therefore the FITS_rec's\n        # refcount never goes to zero, its __del__ is never called, and its\n        # memory is never freed.  This didn't occur in *all* cases, but it did\n        # occur in many cases.\n        #\n        # To get around this, Column.array is no longer a simple attribute\n        # like it was previously.  Now each Column has a ._parent_fits_rec\n        # attribute which is a weakref to a FITS_rec object.  Code that\n        # previously assigned each col.array to field in a FITS_rec (as in\n        # the example a few paragraphs above) is still used, however now\n        # array.setter checks if a reference cycle will be created.  And if\n        # so, instead of saving directly to the Column's __dict__, it creates\n        # the ._prent_fits_rec weakref, and all lookups of the column's .array\n        # go through that instead.\n        #\n        # This alone does not fully solve the problem.  Because\n        # _parent_fits_rec is a weakref, if the user ever holds a reference to\n        # the Column, but deletes all references to the underlying FITS_rec,\n        # the .array attribute would suddenly start returning None instead of\n        # the array data.  This problem is resolved on FITS_rec's end.  See the\n        # note in the FITS_rec._coldefs property for the rest of the story.\n\n        # If the Columns's array is not a reference to an existing FITS_rec,\n        # then it is just stored in self.__dict__; otherwise check the\n        # _parent_fits_rec reference if it 's still available.\n        if 'array' in self.__dict__:\n            return self.__dict__['array']\n        elif self._parent_fits_rec is not None:\n            parent = self._parent_fits_rec()\n            if parent is not None:\n                return parent[self.name]\n        else:\n            return None\n\n    @array.setter\n    def array(self, array):\n        # The following looks over the bases of the given array to check if it\n        # has a ._coldefs attribute (i.e. is a FITS_rec) and that that _coldefs\n        # contains this Column itself, and would create a reference cycle if we\n        # stored the array directly in self.__dict__.\n        # In this case it instead sets up the _parent_fits_rec weakref to the\n        # underlying FITS_rec, so that array.getter can return arrays through\n        # self._parent_fits_rec().field(self.name), rather than storing a\n        # hard reference to the field like it used to.\n        base = array\n        while True:\n            if (hasattr(base, '_coldefs') and\n                    isinstance(base._coldefs, ColDefs)):\n                for col in base._coldefs:\n                    if col is self and self._parent_fits_rec is None:\n                        self._parent_fits_rec = weakref.ref(base)\n\n                        # Just in case the user already set .array to their own\n                        # array.\n                        if 'array' in self.__dict__:\n                            del self.__dict__['array']\n                        return\n\n            if getattr(base, 'base', None) is not None:\n                base = base.base\n            else:\n                break\n\n        self.__dict__['array'] = array\n\n    @array.deleter\n    def array(self):\n        try:\n            del self.__dict__['array']\n        except KeyError:\n            pass\n\n        self._parent_fits_rec = None\n\n    @ColumnAttribute('TTYPE')\n    def name(col, name):\n        if name is None:\n            # Allow None to indicate deleting the name, or to just indicate an\n            # unspecified name (when creating a new Column).\n            return\n\n        # Check that the name meets the recommended standard--other column\n        # names are *allowed*, but will be discouraged\n        if isinstance(name, str) and not TTYPE_RE.match(name):\n            warnings.warn(\n                'It is strongly recommended that column names contain only '\n                'upper and lower-case ASCII letters, digits, or underscores '\n                'for maximum compatibility with other software '\n                '(got {!r}).'.format(name), VerifyWarning)\n\n        # This ensures that the new name can fit into a single FITS card\n        # without any special extension like CONTINUE cards or the like.\n        if (not isinstance(name, str)\n                or len(str(Card('TTYPE', name))) != CARD_LENGTH):\n            raise AssertionError(\n                'Column name must be a string able to fit in a single '\n                'FITS card--typically this means a maximum of 68 '\n                'characters, though it may be fewer if the string '\n                'contains special characters like quotes.')\n\n    @ColumnAttribute('TCTYP')\n    def coord_type(col, coord_type):\n        if coord_type is None:\n            return\n\n        if (not isinstance(coord_type, str)\n                or len(coord_type) > 8):\n            raise AssertionError(\n                'Coordinate/axis type must be a string of atmost 8 '\n                'characters.')\n\n    @ColumnAttribute('TCUNI')\n    def coord_unit(col, coord_unit):\n        if (coord_unit is not None\n                and not isinstance(coord_unit, str)):\n            raise AssertionError(\n                'Coordinate/axis unit must be a string.')\n\n    @ColumnAttribute('TCRPX')\n    def coord_ref_point(col, coord_ref_point):\n        if (coord_ref_point is not None\n                and not isinstance(coord_ref_point, numbers.Real)):\n            raise AssertionError(\n                'Pixel coordinate of the reference point must be '\n                'real floating type.')\n\n    @ColumnAttribute('TCRVL')\n    def coord_ref_value(col, coord_ref_value):\n        if (coord_ref_value is not None\n                and not isinstance(coord_ref_value, numbers.Real)):\n            raise AssertionError(\n                'Coordinate value at reference point must be real '\n                'floating type.')\n\n    @ColumnAttribute('TCDLT')\n    def coord_inc(col, coord_inc):\n        if (coord_inc is not None\n                and not isinstance(coord_inc, numbers.Real)):\n            raise AssertionError(\n                'Coordinate increment must be real floating type.')\n\n    @ColumnAttribute('TRPOS')\n    def time_ref_pos(col, time_ref_pos):\n        if (time_ref_pos is not None\n                and not isinstance(time_ref_pos, str)):\n            raise AssertionError(\n                'Time reference position must be a string.')\n\n    format = ColumnAttribute('TFORM')\n    unit = ColumnAttribute('TUNIT')\n    null = ColumnAttribute('TNULL')\n    bscale = ColumnAttribute('TSCAL')\n    bzero = ColumnAttribute('TZERO')\n    disp = ColumnAttribute('TDISP')\n    start = ColumnAttribute('TBCOL')\n    dim = ColumnAttribute('TDIM')\n\n    @lazyproperty\n    def ascii(self):\n        \"\"\"Whether this `Column` represents a column in an ASCII table.\"\"\"\n\n        return isinstance(self.format, _AsciiColumnFormat)\n\n    @lazyproperty\n    def dtype(self):\n        return self.format.dtype\n\n    def copy(self):\n        \"\"\"\n        Return a copy of this `Column`.\n        \"\"\"\n        tmp = Column(format='I')  # just use a throw-away format\n        tmp.__dict__ = self.__dict__.copy()\n        return tmp\n\n    @staticmethod\n    def _convert_format(format, cls):\n        \"\"\"The format argument to this class's initializer may come in many\n        forms.  This uses the given column format class ``cls`` to convert\n        to a format of that type.\n\n        TODO: There should be an abc base class for column format classes\n        \"\"\"\n\n        # Short circuit in case we're already a _BaseColumnFormat--there is at\n        # least one case in which this can happen\n        if isinstance(format, _BaseColumnFormat):\n            return format, format.recformat\n\n        if format in NUMPY2FITS:\n            with suppress(VerifyError):\n                # legit recarray format?\n                recformat = format\n                format = cls.from_recformat(format)\n\n        try:\n            # legit FITS format?\n            format = cls(format)\n            recformat = format.recformat\n        except VerifyError:\n            raise VerifyError(f'Illegal format `{format}`.')\n\n        return format, recformat\n\n    @classmethod\n    def _verify_keywords(cls, name=None, format=None, unit=None, null=None,\n                         bscale=None, bzero=None, disp=None, start=None,\n                         dim=None, ascii=None, coord_type=None, coord_unit=None,\n                         coord_ref_point=None, coord_ref_value=None,\n                         coord_inc=None, time_ref_pos=None):\n        \"\"\"\n        Given the keyword arguments used to initialize a Column, specifically\n        those that typically read from a FITS header (so excluding array),\n        verify that each keyword has a valid value.\n\n        Returns a 2-tuple of dicts.  The first maps valid keywords to their\n        values.  The second maps invalid keywords to a 2-tuple of their value,\n        and a message explaining why they were found invalid.\n        \"\"\"\n\n        valid = {}\n        invalid = {}\n\n        try:\n            format, recformat = cls._determine_formats(format, start, dim, ascii)\n            valid.update(format=format, recformat=recformat)\n        except (ValueError, VerifyError) as err:\n            msg = (\n                f'Column format option (TFORMn) failed verification: {err!s} '\n                'The invalid value will be ignored for the purpose of '\n                'formatting the data in this column.')\n            invalid['format'] = (format, msg)\n        except AttributeError as err:\n            msg = (\n                f'Column format option (TFORMn) must be a string with a valid '\n                f'FITS table format (got {format!s}: {err!s}). '\n                'The invalid value will be ignored for the purpose of '\n                'formatting the data in this column.')\n            invalid['format'] = (format, msg)\n\n        # Currently we don't have any validation for name, unit, bscale, or\n        # bzero so include those by default\n        # TODO: Add validation for these keywords, obviously\n        for k, v in [('name', name), ('unit', unit), ('bscale', bscale),\n                     ('bzero', bzero)]:\n            if v is not None and v != '':\n                valid[k] = v\n\n        # Validate null option\n        # Note: Enough code exists that thinks empty strings are sensible\n        # inputs for these options that we need to treat '' as None\n        if null is not None and null != '':\n            msg = None\n            if isinstance(format, _AsciiColumnFormat):\n                null = str(null)\n                if len(null) > format.width:\n                    msg = (\n                        \"ASCII table null option (TNULLn) is longer than \"\n                        \"the column's character width and will be truncated \"\n                        \"(got {!r}).\".format(null))\n            else:\n                tnull_formats = ('B', 'I', 'J', 'K')\n\n                if not _is_int(null):\n                    # Make this an exception instead of a warning, since any\n                    # non-int value is meaningless\n                    msg = (\n                        'Column null option (TNULLn) must be an integer for '\n                        'binary table columns (got {!r}).  The invalid value '\n                        'will be ignored for the purpose of formatting '\n                        'the data in this column.'.format(null))\n\n                elif not (format.format in tnull_formats or\n                          (format.format in ('P', 'Q') and\n                           format.p_format in tnull_formats)):\n                    # TODO: We should also check that TNULLn's integer value\n                    # is in the range allowed by the column's format\n                    msg = (\n                        'Column null option (TNULLn) is invalid for binary '\n                        'table columns of type {!r} (got {!r}).  The invalid '\n                        'value will be ignored for the purpose of formatting '\n                        'the data in this column.'.format(format, null))\n\n            if msg is None:\n                valid['null'] = null\n            else:\n                invalid['null'] = (null, msg)\n\n        # Validate the disp option\n        # TODO: Add full parsing and validation of TDISPn keywords\n        if disp is not None and disp != '':\n            msg = None\n            if not isinstance(disp, str):\n                msg = (\n                    f'Column disp option (TDISPn) must be a string (got '\n                    f'{disp!r}). The invalid value will be ignored for the '\n                    'purpose of formatting the data in this column.')\n\n            elif (isinstance(format, _AsciiColumnFormat) and\n                    disp[0].upper() == 'L'):\n                # disp is at least one character long and has the 'L' format\n                # which is not recognized for ASCII tables\n                msg = (\n                    \"Column disp option (TDISPn) may not use the 'L' format \"\n                    \"with ASCII table columns.  The invalid value will be \"\n                    \"ignored for the purpose of formatting the data in this \"\n                    \"column.\")\n\n            if msg is None:\n                try:\n                    _parse_tdisp_format(disp)\n                    valid['disp'] = disp\n                except VerifyError as err:\n                    msg = (\n                        f'Column disp option (TDISPn) failed verification: '\n                        f'{err!s} The invalid value will be ignored for the '\n                        'purpose of formatting the data in this column.')\n                    invalid['disp'] = (disp, msg)\n            else:\n                invalid['disp'] = (disp, msg)\n\n        # Validate the start option\n        if start is not None and start != '':\n            msg = None\n            if not isinstance(format, _AsciiColumnFormat):\n                # The 'start' option only applies to ASCII columns\n                msg = (\n                    'Column start option (TBCOLn) is not allowed for binary '\n                    'table columns (got {!r}).  The invalid keyword will be '\n                    'ignored for the purpose of formatting the data in this '\n                    'column.'.format(start))\n            else:\n                try:\n                    start = int(start)\n                except (TypeError, ValueError):\n                    pass\n\n                if not _is_int(start) or start < 1:\n                    msg = (\n                        'Column start option (TBCOLn) must be a positive integer '\n                        '(got {!r}).  The invalid value will be ignored for the '\n                        'purpose of formatting the data in this column.'.format(start))\n\n            if msg is None:\n                valid['start'] = start\n            else:\n                invalid['start'] = (start, msg)\n\n        # Process TDIMn options\n        # ASCII table columns can't have a TDIMn keyword associated with it;\n        # for now we just issue a warning and ignore it.\n        # TODO: This should be checked by the FITS verification code\n        if dim is not None and dim != '':\n            msg = None\n            dims_tuple = tuple()\n            # NOTE: If valid, the dim keyword's value in the the valid dict is\n            # a tuple, not the original string; if invalid just the original\n            # string is returned\n            if isinstance(format, _AsciiColumnFormat):\n                msg = (\n                    'Column dim option (TDIMn) is not allowed for ASCII table '\n                    'columns (got {!r}).  The invalid keyword will be ignored '\n                    'for the purpose of formatting this column.'.format(dim))\n\n            elif isinstance(dim, str):\n                dims_tuple = _parse_tdim(dim)\n            elif isinstance(dim, tuple):\n                dims_tuple = dim\n            else:\n                msg = (\n                    \"`dim` argument must be a string containing a valid value \"\n                    \"for the TDIMn header keyword associated with this column, \"\n                    \"or a tuple containing the C-order dimensions for the \"\n                    \"column.  The invalid value will be ignored for the purpose \"\n                    \"of formatting this column.\")\n\n            if dims_tuple:\n                if reduce(operator.mul, dims_tuple) > format.repeat:\n                    msg = (\n                        \"The repeat count of the column format {!r} for column {!r} \"\n                        \"is fewer than the number of elements per the TDIM \"\n                        \"argument {!r}.  The invalid TDIMn value will be ignored \"\n                        \"for the purpose of formatting this column.\".format(\n                            name, format, dim))\n\n            if msg is None:\n                valid['dim'] = dims_tuple\n            else:\n                invalid['dim'] = (dim, msg)\n\n        if coord_type is not None and coord_type != '':\n            msg = None\n            if not isinstance(coord_type, str):\n                msg = (\n                    \"Coordinate/axis type option (TCTYPn) must be a string \"\n                    \"(got {!r}). The invalid keyword will be ignored for the \"\n                    \"purpose of formatting this column.\".format(coord_type))\n            elif len(coord_type) > 8:\n                msg = (\n                    \"Coordinate/axis type option (TCTYPn) must be a string \"\n                    \"of atmost 8 characters (got {!r}). The invalid keyword \"\n                    \"will be ignored for the purpose of formatting this \"\n                    \"column.\".format(coord_type))\n\n            if msg is None:\n                valid['coord_type'] = coord_type\n            else:\n                invalid['coord_type'] = (coord_type, msg)\n\n        if coord_unit is not None and coord_unit != '':\n            msg = None\n            if not isinstance(coord_unit, str):\n                msg = (\n                    \"Coordinate/axis unit option (TCUNIn) must be a string \"\n                    \"(got {!r}). The invalid keyword will be ignored for the \"\n                    \"purpose of formatting this column.\".format(coord_unit))\n\n            if msg is None:\n                valid['coord_unit'] = coord_unit\n            else:\n                invalid['coord_unit'] = (coord_unit, msg)\n\n        for k, v in [('coord_ref_point', coord_ref_point),\n                     ('coord_ref_value', coord_ref_value),\n                     ('coord_inc', coord_inc)]:\n            if v is not None and v != '':\n                msg = None\n                if not isinstance(v, numbers.Real):\n                    msg = (\n                        \"Column {} option ({}n) must be a real floating type (got {!r}). \"\n                        \"The invalid value will be ignored for the purpose of formatting \"\n                        \"the data in this column.\".format(k, ATTRIBUTE_TO_KEYWORD[k], v))\n\n                if msg is None:\n                    valid[k] = v\n                else:\n                    invalid[k] = (v, msg)\n\n        if time_ref_pos is not None and time_ref_pos != '':\n            msg = None\n            if not isinstance(time_ref_pos, str):\n                msg = (\n                    \"Time coordinate reference position option (TRPOSn) must be \"\n                    \"a string (got {!r}). The invalid keyword will be ignored for \"\n                    \"the purpose of formatting this column.\".format(time_ref_pos))\n\n            if msg is None:\n                valid['time_ref_pos'] = time_ref_pos\n            else:\n                invalid['time_ref_pos'] = (time_ref_pos, msg)\n\n        return valid, invalid\n\n    @classmethod\n    def _determine_formats(cls, format, start, dim, ascii):\n        \"\"\"\n        Given a format string and whether or not the Column is for an\n        ASCII table (ascii=None means unspecified, but lean toward binary table\n        where ambiguous) create an appropriate _BaseColumnFormat instance for\n        the column's format, and determine the appropriate recarray format.\n\n        The values of the start and dim keyword arguments are also useful, as\n        the former is only valid for ASCII tables and the latter only for\n        BINARY tables.\n        \"\"\"\n\n        # If the given format string is unambiguously a Numpy dtype or one of\n        # the Numpy record format type specifiers supported by Astropy then that\n        # should take priority--otherwise assume it is a FITS format\n        if isinstance(format, np.dtype):\n            format, _, _ = _dtype_to_recformat(format)\n\n        # check format\n        if ascii is None and not isinstance(format, _BaseColumnFormat):\n            # We're just give a string which could be either a Numpy format\n            # code, or a format for a binary column array *or* a format for an\n            # ASCII column array--there may be many ambiguities here.  Try our\n            # best to guess what the user intended.\n            format, recformat = cls._guess_format(format, start, dim)\n        elif not ascii and not isinstance(format, _BaseColumnFormat):\n            format, recformat = cls._convert_format(format, _ColumnFormat)\n        elif ascii and not isinstance(format, _AsciiColumnFormat):\n            format, recformat = cls._convert_format(format,\n                                                    _AsciiColumnFormat)\n        else:\n            # The format is already acceptable and unambiguous\n            recformat = format.recformat\n\n        return format, recformat\n\n    @classmethod\n    def _guess_format(cls, format, start, dim):\n        if start and dim:\n            # This is impossible; this can't be a valid FITS column\n            raise ValueError(\n                'Columns cannot have both a start (TCOLn) and dim '\n                '(TDIMn) option, since the former is only applies to '\n                'ASCII tables, and the latter is only valid for binary '\n                'tables.')\n        elif start:\n            # Only ASCII table columns can have a 'start' option\n            guess_format = _AsciiColumnFormat\n        elif dim:\n            # Only binary tables can have a dim option\n            guess_format = _ColumnFormat\n        else:\n            # If the format is *technically* a valid binary column format\n            # (i.e. it has a valid format code followed by arbitrary\n            # \"optional\" codes), but it is also strictly a valid ASCII\n            # table format, then assume an ASCII table column was being\n            # requested (the more likely case, after all).\n            with suppress(VerifyError):\n                format = _AsciiColumnFormat(format, strict=True)\n\n            # A safe guess which reflects the existing behavior of previous\n            # Astropy versions\n            guess_format = _ColumnFormat\n\n        try:\n            format, recformat = cls._convert_format(format, guess_format)\n        except VerifyError:\n            # For whatever reason our guess was wrong (for example if we got\n            # just 'F' that's not a valid binary format, but it an ASCII format\n            # code albeit with the width/precision omitted\n            guess_format = (_AsciiColumnFormat\n                            if guess_format is _ColumnFormat\n                            else _ColumnFormat)\n            # If this fails too we're out of options--it is truly an invalid\n            # format, or at least not supported\n            format, recformat = cls._convert_format(format, guess_format)\n\n        return format, recformat\n\n    def _convert_to_valid_data_type(self, array):\n        # Convert the format to a type we understand\n        if isinstance(array, Delayed):\n            return array\n        elif array is None:\n            return array\n        else:\n            format = self.format\n            dims = self._dims\n\n            if dims:\n                shape = dims[:-1] if 'A' in format else dims\n                shape = (len(array),) + shape\n                array = array.reshape(shape)\n\n            if 'P' in format or 'Q' in format:\n                return array\n            elif 'A' in format:\n                if array.dtype.char in 'SU':\n                    if dims:\n                        # The 'last' dimension (first in the order given\n                        # in the TDIMn keyword itself) is the number of\n                        # characters in each string\n                        fsize = dims[-1]\n                    else:\n                        fsize = np.dtype(format.recformat).itemsize\n                    return chararray.array(array, itemsize=fsize, copy=False)\n                else:\n                    return _convert_array(array, np.dtype(format.recformat))\n            elif 'L' in format:\n                # boolean needs to be scaled back to storage values ('T', 'F')\n                if array.dtype == np.dtype('bool'):\n                    return np.where(array == np.False_, ord('F'), ord('T'))\n                else:\n                    return np.where(array == 0, ord('F'), ord('T'))\n            elif 'X' in format:\n                return _convert_array(array, np.dtype('uint8'))\n            else:\n                # Preserve byte order of the original array for now; see #77\n                numpy_format = array.dtype.byteorder + format.recformat\n\n                # Handle arrays passed in as unsigned ints as pseudo-unsigned\n                # int arrays; blatantly tacked in here for now--we need columns\n                # to have explicit knowledge of whether they treated as\n                # pseudo-unsigned\n                bzeros = {2: np.uint16(2**15), 4: np.uint32(2**31),\n                          8: np.uint64(2**63)}\n                if (array.dtype.kind == 'u' and\n                        array.dtype.itemsize in bzeros and\n                        self.bscale in (1, None, '') and\n                        self.bzero == bzeros[array.dtype.itemsize]):\n                    # Basically the array is uint, has scale == 1.0, and the\n                    # bzero is the appropriate value for a pseudo-unsigned\n                    # integer of the input dtype, then go ahead and assume that\n                    # uint is assumed\n                    numpy_format = numpy_format.replace('i', 'u')\n                    self._pseudo_unsigned_ints = True\n\n                # The .base here means we're dropping the shape information,\n                # which is only used to format recarray fields, and is not\n                # useful for converting input arrays to the correct data type\n                dtype = np.dtype(numpy_format).base\n\n                return _convert_array(array, dtype)"},{"col":4,"comment":"\n        Provides the bulk of the internal implementation for readfrom and\n        fromstring.\n\n        For some special cases, supports using a header that was already\n        created, and just using the input data for the actual array data.\n        ","endLoc":507,"header":"@classmethod\n    def _readfrom_internal(cls, data, header=None, checksum=False,\n                           ignore_missing_end=False, **kwargs)","id":1449,"name":"_readfrom_internal","nodeType":"Function","startLoc":385,"text":"@classmethod\n    def _readfrom_internal(cls, data, header=None, checksum=False,\n                           ignore_missing_end=False, **kwargs):\n        \"\"\"\n        Provides the bulk of the internal implementation for readfrom and\n        fromstring.\n\n        For some special cases, supports using a header that was already\n        created, and just using the input data for the actual array data.\n        \"\"\"\n\n        hdu_buffer = None\n        hdu_fileobj = None\n        header_offset = 0\n\n        if isinstance(data, _File):\n            if header is None:\n                header_offset = data.tell()\n                try:\n                    # First we try to read the header with the fast parser\n                    # from _BasicHeader, which will read only the standard\n                    # 8 character keywords to get the structural keywords\n                    # that are needed to build the HDU object.\n                    header_str, header = _BasicHeader.fromfile(data)\n                except Exception:\n                    # If the fast header parsing failed, then fallback to\n                    # the classic Header parser, which has better support\n                    # and reporting for the various issues that can be found\n                    # in the wild.\n                    data.seek(header_offset)\n                    header = Header.fromfile(data,\n                                             endcard=not ignore_missing_end)\n            hdu_fileobj = data\n            data_offset = data.tell()  # *after* reading the header\n        else:\n            try:\n                # Test that the given object supports the buffer interface by\n                # ensuring an ndarray can be created from it\n                np.ndarray((), dtype='ubyte', buffer=data)\n            except TypeError:\n                raise TypeError(\n                    'The provided object {!r} does not contain an underlying '\n                    'memory buffer.  fromstring() requires an object that '\n                    'supports the buffer interface such as bytes, buffer, '\n                    'memoryview, ndarray, etc.  This restriction is to ensure '\n                    'that efficient access to the array/table data is possible.'\n                    .format(data))\n\n            if header is None:\n                def block_iter(nbytes):\n                    idx = 0\n                    while idx < len(data):\n                        yield data[idx:idx + nbytes]\n                        idx += nbytes\n\n                header_str, header = Header._from_blocks(\n                    block_iter, True, '', not ignore_missing_end, True)\n\n                if len(data) > len(header_str):\n                    hdu_buffer = data\n            elif data:\n                hdu_buffer = data\n\n            header_offset = 0\n            data_offset = len(header_str)\n\n        # Determine the appropriate arguments to pass to the constructor from\n        # self._kwargs.  self._kwargs contains any number of optional arguments\n        # that may or may not be valid depending on the HDU type\n        cls = _hdu_class_from_header(cls, header)\n        sig = signature(cls.__init__)\n        new_kwargs = kwargs.copy()\n        if Parameter.VAR_KEYWORD not in (x.kind for x in sig.parameters.values()):\n            # If __init__ accepts arbitrary keyword arguments, then we can go\n            # ahead and pass all keyword arguments; otherwise we need to delete\n            # any that are invalid\n            for key in kwargs:\n                if key not in sig.parameters:\n                    del new_kwargs[key]\n\n        try:\n            hdu = cls(data=DELAYED, header=header, **new_kwargs)\n        except TypeError:\n            # This may happen because some HDU class (e.g. GroupsHDU) wants\n            # to set a keyword on the header, which is not possible with the\n            # _BasicHeader. While HDU classes should not need to modify the\n            # header in general, sometimes this is needed to fix it. So in\n            # this case we build a full Header and try again to create the\n            # HDU object.\n            if isinstance(header, _BasicHeader):\n                header = Header.fromstring(header_str)\n                hdu = cls(data=DELAYED, header=header, **new_kwargs)\n            else:\n                raise\n\n        # One of these may be None, depending on whether the data came from a\n        # file or a string buffer--later this will be further abstracted\n        hdu._file = hdu_fileobj\n        hdu._buffer = hdu_buffer\n\n        hdu._header_offset = header_offset     # beginning of the header area\n        hdu._data_offset = data_offset         # beginning of the data area\n\n        # data area size, including padding\n        size = hdu.size\n        hdu._data_size = size + _pad_length(size)\n\n        if isinstance(hdu._header, _BasicHeader):\n            # Delete the temporary _BasicHeader.\n            # We need to do this before an eventual checksum computation,\n            # since it needs to modify temporarily the header\n            #\n            # The header string is stored in the HDU._header_str attribute,\n            # so that it can be used directly when we need to create the\n            # classic Header object, without having to parse again the file.\n            del hdu._header\n            hdu._header_str = header_str\n\n        # Checksums are not checked on invalid HDU types\n        if checksum and checksum != 'remove' and isinstance(hdu, _ValidHDU):\n            hdu._verify_checksum_datasum()\n\n        return hdu"},{"col":0,"comment":"\n    If a unit contains a temperature unit besides kelvin, then replace\n    that unit with kelvin.\n\n    Temperatures cannot be converted directly between K, °F, °C, and\n    °Ra, in particular since there would be different conversions for\n    T and ΔT.  However, each of these temperatures each represents the\n    physical type.  Replacing the different temperature units with\n    kelvin allows the physical type to be treated consistently.\n    ","endLoc":178,"header":"def _replace_temperatures_with_kelvin(unit)","id":1450,"name":"_replace_temperatures_with_kelvin","nodeType":"Function","startLoc":153,"text":"def _replace_temperatures_with_kelvin(unit):\n    \"\"\"\n    If a unit contains a temperature unit besides kelvin, then replace\n    that unit with kelvin.\n\n    Temperatures cannot be converted directly between K, °F, °C, and\n    °Ra, in particular since there would be different conversions for\n    T and ΔT.  However, each of these temperatures each represents the\n    physical type.  Replacing the different temperature units with\n    kelvin allows the physical type to be treated consistently.\n    \"\"\"\n    physical_type_id = unit._get_physical_type_id()\n\n    physical_type_id_components = []\n    substitution_was_made = False\n\n    for base, power in physical_type_id:\n        if base in [\"deg_F\", \"deg_C\", \"deg_R\"]:\n            base = \"K\"\n            substitution_was_made = True\n        physical_type_id_components.append((base, power))\n\n    if substitution_was_made:\n        return core.Unit._from_physical_type_id(tuple(physical_type_id_components))\n    else:\n        return unit"},{"col":4,"comment":"\n        Update how the data is formatted depending on changes to column\n        attributes initiated by the user through the `Column` interface.\n\n        Dispatches column attribute change notifications to individual methods\n        for each attribute ``_update_column_<attr>``\n        ","endLoc":773,"header":"def _update_column_attribute_changed(self, column, idx, attr, old_value,\n                                         new_value)","id":1451,"name":"_update_column_attribute_changed","nodeType":"Function","startLoc":759,"text":"def _update_column_attribute_changed(self, column, idx, attr, old_value,\n                                         new_value):\n        \"\"\"\n        Update how the data is formatted depending on changes to column\n        attributes initiated by the user through the `Column` interface.\n\n        Dispatches column attribute change notifications to individual methods\n        for each attribute ``_update_column_<attr>``\n        \"\"\"\n\n        method_name = f'_update_column_{attr}'\n        if hasattr(self, method_name):\n            # Right now this is so we can be lazy and not implement updaters\n            # for every attribute yet--some we may not need at all, TBD\n            getattr(self, method_name)(column, idx, old_value, new_value)"},{"col":4,"comment":"null","endLoc":682,"header":"def __repr__(self)","id":1452,"name":"__repr__","nodeType":"Function","startLoc":676,"text":"def __repr__(self):\n        text = ''\n        for attr in KEYWORD_ATTRIBUTES:\n            value = getattr(self, attr)\n            if value is not None:\n                text += attr + ' = ' + repr(value) + '; '\n        return text[:-2]"},{"col":4,"comment":"Update the dtype field names when a column name is changed.","endLoc":780,"header":"def _update_column_name(self, column, idx, old_name, name)","id":1453,"name":"_update_column_name","nodeType":"Function","startLoc":775,"text":"def _update_column_name(self, column, idx, old_name, name):\n        \"\"\"Update the dtype field names when a column name is changed.\"\"\"\n\n        dtype = self.dtype\n        # Updating the names on the dtype should suffice\n        dtype.names = dtype.names[:idx] + (name,) + dtype.names[idx + 1:]"},{"col":4,"comment":"\n        Returns a pointer into the table's raw data to its heap (if present).\n\n        This is returned as a numpy byte array.\n        ","endLoc":1017,"header":"def _get_heap_data(self)","id":1454,"name":"_get_heap_data","nodeType":"Function","startLoc":1005,"text":"def _get_heap_data(self):\n        \"\"\"\n        Returns a pointer into the table's raw data to its heap (if present).\n\n        This is returned as a numpy byte array.\n        \"\"\"\n\n        if self._heapsize:\n            raw_data = self._get_raw_data().view(np.ubyte)\n            heap_end = self._heapoffset + self._heapsize\n            return raw_data[self._heapoffset:heap_end]\n        else:\n            return np.array([], dtype=np.ubyte)"},{"col":4,"comment":"\n        Two columns are equal if their name and format are the same.  Other\n        attributes aren't taken into account at this time.\n        ","endLoc":693,"header":"def __eq__(self, other)","id":1455,"name":"__eq__","nodeType":"Function","startLoc":684,"text":"def __eq__(self, other):\n        \"\"\"\n        Two columns are equal if their name and format are the same.  Other\n        attributes aren't taken into account at this time.\n        \"\"\"\n\n        # According to the FITS standard column names must be case-insensitive\n        a = (self.name.lower(), self.format)\n        b = (other.name.lower(), other.format)\n        return a == b"},{"col":4,"comment":"\n        Update the parent array, using the (latest) scaled array.\n\n        If ``update_heap_pointers`` is `False`, this will leave all the heap\n        pointers in P/Q columns as they are verbatim--it only makes sense to do\n        this if there is already data on the heap and it can be guaranteed that\n        that data has not been modified, and there is not new data to add to\n        the heap.  Currently this is only used as an optimization for\n        CompImageHDU that does its own handling of the heap.\n        ","endLoc":1170,"header":"def _scale_back(self, update_heap_pointers=True)","id":1456,"name":"_scale_back","nodeType":"Function","startLoc":1070,"text":"def _scale_back(self, update_heap_pointers=True):\n        \"\"\"\n        Update the parent array, using the (latest) scaled array.\n\n        If ``update_heap_pointers`` is `False`, this will leave all the heap\n        pointers in P/Q columns as they are verbatim--it only makes sense to do\n        this if there is already data on the heap and it can be guaranteed that\n        that data has not been modified, and there is not new data to add to\n        the heap.  Currently this is only used as an optimization for\n        CompImageHDU that does its own handling of the heap.\n        \"\"\"\n\n        # Running total for the new heap size\n        heapsize = 0\n\n        for indx, name in enumerate(self.dtype.names):\n            column = self._coldefs[indx]\n            recformat = column.format.recformat\n            raw_field = _get_recarray_field(self, indx)\n\n            # add the location offset of the heap area for each\n            # variable length column\n            if isinstance(recformat, _FormatP):\n                # Irritatingly, this can return a different dtype than just\n                # doing np.dtype(recformat.dtype); but this returns the results\n                # that we want.  For example if recformat.dtype is 'a' we want\n                # an array of characters.\n                dtype = np.array([], dtype=recformat.dtype).dtype\n\n                if update_heap_pointers and name in self._converted:\n                    # The VLA has potentially been updated, so we need to\n                    # update the array descriptors\n                    raw_field[:] = 0  # reset\n                    npts = [len(arr) for arr in self._converted[name]]\n\n                    raw_field[:len(npts), 0] = npts\n                    raw_field[1:, 1] = (np.add.accumulate(raw_field[:-1, 0]) *\n                                        dtype.itemsize)\n                    raw_field[:, 1][:] += heapsize\n\n                heapsize += raw_field[:, 0].sum() * dtype.itemsize\n                # Even if this VLA has not been read or updated, we need to\n                # include the size of its constituent arrays in the heap size\n                # total\n\n            if isinstance(recformat, _FormatX) and name in self._converted:\n                _wrapx(self._converted[name], raw_field, recformat.repeat)\n                continue\n\n            _str, _bool, _number, _scale, _zero, bscale, bzero, _ = \\\n                self._get_scale_factors(column)\n\n            field = self._converted.get(name, raw_field)\n\n            # conversion for both ASCII and binary tables\n            if _number or _str:\n                if _number and (_scale or _zero) and column._physical_values:\n                    dummy = field.copy()\n                    if _zero:\n                        dummy -= bzero\n                    if _scale:\n                        dummy /= bscale\n                    # This will set the raw values in the recarray back to\n                    # their non-physical storage values, so the column should\n                    # be mark is not scaled\n                    column._physical_values = False\n                elif _str or isinstance(self._coldefs, _AsciiColDefs):\n                    dummy = field\n                else:\n                    continue\n\n                # ASCII table, convert numbers to strings\n                if isinstance(self._coldefs, _AsciiColDefs):\n                    self._scale_back_ascii(indx, dummy, raw_field)\n                # binary table string column\n                elif isinstance(raw_field, chararray.chararray):\n                    self._scale_back_strings(indx, dummy, raw_field)\n                # all other binary table columns\n                else:\n                    if len(raw_field) and isinstance(raw_field[0],\n                                                     np.integer):\n                        dummy = np.around(dummy)\n\n                    if raw_field.shape == dummy.shape:\n                        raw_field[:] = dummy\n                    else:\n                        # Reshaping the data is necessary in cases where the\n                        # TDIMn keyword was used to shape a column's entries\n                        # into arrays\n                        raw_field[:] = dummy.ravel().view(raw_field.dtype)\n\n                del dummy\n\n            # ASCII table does not have Boolean type\n            elif _bool and name in self._converted:\n                choices = (np.array([ord('F')], dtype=np.int8)[0],\n                           np.array([ord('T')], dtype=np.int8)[0])\n                raw_field[:] = np.choose(field, choices)\n\n        # Store the updated heapsize\n        self._heapsize = heapsize"},{"col":4,"comment":"null","endLoc":2186,"header":"@classmethod\n    def _from_physical_type_id(cls, physical_type_id)","id":1457,"name":"_from_physical_type_id","nodeType":"Function","startLoc":2174,"text":"@classmethod\n    def _from_physical_type_id(cls, physical_type_id):\n        # get string bases and powers from the ID tuple\n        bases = [cls(base) for base, _ in physical_type_id]\n        powers = [power for _, power in physical_type_id]\n\n        if len(physical_type_id) == 1 and powers[0] == 1:\n            unit = bases[0]\n        else:\n            unit = CompositeUnit(1, bases, powers,\n                                 _error_check=False)\n\n        return unit"},{"col":4,"comment":"The main method to parse a FITS header from a file. The parsing is\n        done with the parse_header function implemented in Cython.","endLoc":2063,"header":"@classmethod\n    def fromfile(cls, fileobj)","id":1458,"name":"fromfile","nodeType":"Function","startLoc":2047,"text":"@classmethod\n    def fromfile(cls, fileobj):\n        \"\"\"The main method to parse a FITS header from a file. The parsing is\n        done with the parse_header function implemented in Cython.\"\"\"\n\n        close_file = False\n        if isinstance(fileobj, str):\n            fileobj = open(fileobj, 'rb')\n            close_file = True\n\n        try:\n            header_str, cards = parse_header(fileobj)\n            _check_padding(header_str, BLOCK_SIZE, False)\n            return header_str, cls(cards)\n        finally:\n            if close_file:\n                fileobj.close()"},{"col":4,"comment":"\n        Like __eq__, the hash of a column should be based on the unique column\n        name and format, and be case-insensitive with respect to the column\n        name.\n        ","endLoc":702,"header":"def __hash__(self)","id":1459,"name":"__hash__","nodeType":"Function","startLoc":695,"text":"def __hash__(self):\n        \"\"\"\n        Like __eq__, the hash of a column should be based on the unique column\n        name and format, and be case-insensitive with respect to the column\n        name.\n        \"\"\"\n\n        return hash((self.name.lower(), self.format))"},{"col":4,"comment":"\n        The Numpy `~numpy.ndarray` associated with this `Column`.\n\n        If the column was instantiated with an array passed to the ``array``\n        argument, this will return that array.  However, if the column is\n        later added to a table, such as via `BinTableHDU.from_columns` as\n        is typically the case, this attribute will be updated to reference\n        the associated field in the table, which may no longer be the same\n        array.\n        ","endLoc":779,"header":"@property\n    def array(self)","id":1460,"name":"array","nodeType":"Function","startLoc":704,"text":"@property\n    def array(self):\n        \"\"\"\n        The Numpy `~numpy.ndarray` associated with this `Column`.\n\n        If the column was instantiated with an array passed to the ``array``\n        argument, this will return that array.  However, if the column is\n        later added to a table, such as via `BinTableHDU.from_columns` as\n        is typically the case, this attribute will be updated to reference\n        the associated field in the table, which may no longer be the same\n        array.\n        \"\"\"\n\n        # Ideally the .array attribute never would have existed in the first\n        # place, or would have been internal-only.  This is a legacy of the\n        # older design from Astropy that needs to have continued support, for\n        # now.\n\n        # One of the main problems with this design was that it created a\n        # reference cycle.  When the .array attribute was updated after\n        # creating a FITS_rec from the column (as explained in the docstring) a\n        # reference cycle was created.  This is because the code in BinTableHDU\n        # (and a few other places) does essentially the following:\n        #\n        # data._coldefs = columns  # The ColDefs object holding this Column\n        # for col in columns:\n        #     col.array = data.field(col.name)\n        #\n        # This way each columns .array attribute now points to the field in the\n        # table data.  It's actually a pretty confusing interface (since it\n        # replaces the array originally pointed to by .array), but it's the way\n        # things have been for a long, long time.\n        #\n        # However, this results, in *many* cases, in a reference cycle.\n        # Because the array returned by data.field(col.name), while sometimes\n        # an array that owns its own data, is usually like a slice of the\n        # original data.  It has the original FITS_rec as the array .base.\n        # This results in the following reference cycle (for the n-th column):\n        #\n        #    data -> data._coldefs -> data._coldefs[n] ->\n        #     data._coldefs[n].array -> data._coldefs[n].array.base -> data\n        #\n        # Because ndarray objects do not handled by Python's garbage collector\n        # the reference cycle cannot be broken.  Therefore the FITS_rec's\n        # refcount never goes to zero, its __del__ is never called, and its\n        # memory is never freed.  This didn't occur in *all* cases, but it did\n        # occur in many cases.\n        #\n        # To get around this, Column.array is no longer a simple attribute\n        # like it was previously.  Now each Column has a ._parent_fits_rec\n        # attribute which is a weakref to a FITS_rec object.  Code that\n        # previously assigned each col.array to field in a FITS_rec (as in\n        # the example a few paragraphs above) is still used, however now\n        # array.setter checks if a reference cycle will be created.  And if\n        # so, instead of saving directly to the Column's __dict__, it creates\n        # the ._prent_fits_rec weakref, and all lookups of the column's .array\n        # go through that instead.\n        #\n        # This alone does not fully solve the problem.  Because\n        # _parent_fits_rec is a weakref, if the user ever holds a reference to\n        # the Column, but deletes all references to the underlying FITS_rec,\n        # the .array attribute would suddenly start returning None instead of\n        # the array data.  This problem is resolved on FITS_rec's end.  See the\n        # note in the FITS_rec._coldefs property for the rest of the story.\n\n        # If the Columns's array is not a reference to an existing FITS_rec,\n        # then it is just stored in self.__dict__; otherwise check the\n        # _parent_fits_rec reference if it 's still available.\n        if 'array' in self.__dict__:\n            return self.__dict__['array']\n        elif self._parent_fits_rec is not None:\n            parent = self._parent_fits_rec()\n            if parent is not None:\n                return parent[self.name]\n        else:\n            return None"},{"col":4,"comment":"null","endLoc":316,"header":"def __init__(self, unit, physical_types)","id":1461,"name":"__init__","nodeType":"Function","startLoc":312,"text":"def __init__(self, unit, physical_types):\n        self._unit = _replace_temperatures_with_kelvin(unit)\n        self._physical_type_id = self._unit._get_physical_type_id()\n        self._physical_type = _standardize_physical_type_names(physical_types)\n        self._physical_type_list = sorted(self._physical_type)"},{"col":4,"comment":"null","endLoc":2024,"header":"def __init__(self, cards)","id":1462,"name":"__init__","nodeType":"Function","startLoc":2014,"text":"def __init__(self, cards):\n        # dict of (keywords, card images)\n        self._raw_cards = cards\n        self._keys = list(cards.keys())\n        # dict of (keyword, Card object) storing the parsed cards\n        self._cards = {}\n        # the _BasicHeaderCards object allows to access Card objects from\n        # keyword indices\n        self.cards = _BasicHeaderCards(self)\n\n        self._modified = False"},{"col":0,"comment":"\n    Convert a string or `set` of strings into a `set` containing\n    string representations of physical types.\n\n    The strings provided in ``physical_type_input`` can each contain\n    multiple physical types that are separated by a regular slash.\n    Underscores are treated as spaces so that variable names could\n    be identical to physical type names.\n    ","endLoc":203,"header":"def _standardize_physical_type_names(physical_type_input)","id":1463,"name":"_standardize_physical_type_names","nodeType":"Function","startLoc":181,"text":"def _standardize_physical_type_names(physical_type_input):\n    \"\"\"\n    Convert a string or `set` of strings into a `set` containing\n    string representations of physical types.\n\n    The strings provided in ``physical_type_input`` can each contain\n    multiple physical types that are separated by a regular slash.\n    Underscores are treated as spaces so that variable names could\n    be identical to physical type names.\n    \"\"\"\n    if isinstance(physical_type_input, str):\n        physical_type_input = {physical_type_input}\n\n    standardized_physical_types = set()\n\n    for ptype_input in physical_type_input:\n        if not isinstance(ptype_input, str):\n            raise ValueError(f\"expecting a string, but got {ptype_input}\")\n        input_set = set(ptype_input.split(\"/\"))\n        processed_set = {s.strip().replace(\"_\", \" \") for s in input_set}\n        standardized_physical_types |= processed_set\n\n    return standardized_physical_types"},{"col":4,"comment":"null","endLoc":1984,"header":"def __init__(self, header)","id":1464,"name":"__init__","nodeType":"Function","startLoc":1983,"text":"def __init__(self, header):\n        self.header = header"},{"col":4,"comment":"\n        Convert internal array values back to ASCII table representation.\n\n        The ``input_field`` is the internal representation of the values, and\n        the ``output_field`` is the character array representing the ASCII\n        output that will be written.\n        ","endLoc":1282,"header":"def _scale_back_ascii(self, col_idx, input_field, output_field)","id":1465,"name":"_scale_back_ascii","nodeType":"Function","startLoc":1214,"text":"def _scale_back_ascii(self, col_idx, input_field, output_field):\n        \"\"\"\n        Convert internal array values back to ASCII table representation.\n\n        The ``input_field`` is the internal representation of the values, and\n        the ``output_field`` is the character array representing the ASCII\n        output that will be written.\n        \"\"\"\n\n        starts = self._coldefs.starts[:]\n        spans = self._coldefs.spans\n        format = self._coldefs[col_idx].format\n\n        # The the index of the \"end\" column of the record, beyond\n        # which we can't write\n        end = super().field(-1).itemsize\n        starts.append(end + starts[-1])\n\n        if col_idx > 0:\n            lead = starts[col_idx] - starts[col_idx - 1] - spans[col_idx - 1]\n        else:\n            lead = 0\n\n        if lead < 0:\n            warnings.warn('Column {!r} starting point overlaps the previous '\n                          'column.'.format(col_idx + 1))\n\n        trail = starts[col_idx + 1] - starts[col_idx] - spans[col_idx]\n\n        if trail < 0:\n            warnings.warn('Column {!r} ending point overlaps the next '\n                          'column.'.format(col_idx + 1))\n\n        # TODO: It would be nice if these string column formatting\n        # details were left to a specialized class, as is the case\n        # with FormatX and FormatP\n        if 'A' in format:\n            _pc = '{:'\n        else:\n            _pc = '{:>'\n\n        fmt = ''.join([_pc, format[1:], ASCII2STR[format[0]], '}',\n                       (' ' * trail)])\n\n        # Even if the format precision is 0, we should output a decimal point\n        # as long as there is space to do so--not including a decimal point in\n        # a float value is discouraged by the FITS Standard\n        trailing_decimal = (format.precision == 0 and\n                            format.format in ('F', 'E', 'D'))\n\n        # not using numarray.strings's num2char because the\n        # result is not allowed to expand (as C/Python does).\n        for jdx, value in enumerate(input_field):\n            value = fmt.format(value)\n            if len(value) > starts[col_idx + 1] - starts[col_idx]:\n                raise ValueError(\n                    \"Value {!r} does not fit into the output's itemsize of \"\n                    \"{}.\".format(value, spans[col_idx]))\n\n            if trailing_decimal and value[0] == ' ':\n                # We have some extra space in the field for the trailing\n                # decimal point\n                value = value[1:] + '.'\n\n            output_field[jdx] = value\n\n        # Replace exponent separator in floating point numbers\n        if 'D' in format:\n            output_field[:] = output_field.replace(b'E', b'D')"},{"col":4,"comment":"null","endLoc":810,"header":"@array.setter\n    def array(self, array)","id":1466,"name":"array","nodeType":"Function","startLoc":781,"text":"@array.setter\n    def array(self, array):\n        # The following looks over the bases of the given array to check if it\n        # has a ._coldefs attribute (i.e. is a FITS_rec) and that that _coldefs\n        # contains this Column itself, and would create a reference cycle if we\n        # stored the array directly in self.__dict__.\n        # In this case it instead sets up the _parent_fits_rec weakref to the\n        # underlying FITS_rec, so that array.getter can return arrays through\n        # self._parent_fits_rec().field(self.name), rather than storing a\n        # hard reference to the field like it used to.\n        base = array\n        while True:\n            if (hasattr(base, '_coldefs') and\n                    isinstance(base._coldefs, ColDefs)):\n                for col in base._coldefs:\n                    if col is self and self._parent_fits_rec is None:\n                        self._parent_fits_rec = weakref.ref(base)\n\n                        # Just in case the user already set .array to their own\n                        # array.\n                        if 'array' in self.__dict__:\n                            del self.__dict__['array']\n                        return\n\n            if getattr(base, 'base', None) is not None:\n                base = base.base\n            else:\n                break\n\n        self.__dict__['array'] = array"},{"col":0,"comment":"null","endLoc":38,"header":"def _add_tab_header(filename, package)","id":1467,"name":"_add_tab_header","nodeType":"Function","startLoc":32,"text":"def _add_tab_header(filename, package):\n    with open(filename, 'r') as f:\n        contents = f.read()\n\n    with open(filename, 'w') as f:\n        f.write(_TAB_HEADER.format(package=package))\n        f.write(contents)"},{"col":4,"comment":"null","endLoc":819,"header":"@array.deleter\n    def array(self)","id":1468,"name":"array","nodeType":"Function","startLoc":812,"text":"@array.deleter\n    def array(self):\n        try:\n            del self.__dict__['array']\n        except KeyError:\n            pass\n\n        self._parent_fits_rec = None"},{"col":4,"comment":"null","endLoc":845,"header":"@ColumnAttribute('TTYPE')\n    def name(col, name)","id":1469,"name":"name","nodeType":"Function","startLoc":821,"text":"@ColumnAttribute('TTYPE')\n    def name(col, name):\n        if name is None:\n            # Allow None to indicate deleting the name, or to just indicate an\n            # unspecified name (when creating a new Column).\n            return\n\n        # Check that the name meets the recommended standard--other column\n        # names are *allowed*, but will be discouraged\n        if isinstance(name, str) and not TTYPE_RE.match(name):\n            warnings.warn(\n                'It is strongly recommended that column names contain only '\n                'upper and lower-case ASCII letters, digits, or underscores '\n                'for maximum compatibility with other software '\n                '(got {!r}).'.format(name), VerifyWarning)\n\n        # This ensures that the new name can fit into a single FITS card\n        # without any special extension like CONTINUE cards or the like.\n        if (not isinstance(name, str)\n                or len(str(Card('TTYPE', name))) != CARD_LENGTH):\n            raise AssertionError(\n                'Column name must be a string able to fit in a single '\n                'FITS card--typically this means a maximum of 68 '\n                'characters, though it may be fewer if the string '\n                'contains special characters like quotes.')"},{"col":4,"comment":"null","endLoc":1212,"header":"def _scale_back_strings(self, col_idx, input_field, output_field)","id":1470,"name":"_scale_back_strings","nodeType":"Function","startLoc":1172,"text":"def _scale_back_strings(self, col_idx, input_field, output_field):\n        # There are a few possibilities this has to be able to handle properly\n        # The input_field, which comes from the _converted column is of dtype\n        # 'Un' so that elements read out of the array are normal str\n        # objects (i.e. unicode strings)\n        #\n        # At the other end the *output_field* may also be of type 'S' or of\n        # type 'U'.  It will *usually* be of type 'S' because when reading\n        # an existing FITS table the raw data is just ASCII strings, and\n        # represented in Numpy as an S array.  However, when a user creates\n        # a new table from scratch, they *might* pass in a column containing\n        # unicode strings (dtype 'U').  Therefore the output_field of the\n        # raw array is actually a unicode array.  But we still want to make\n        # sure the data is encodable as ASCII.  Later when we write out the\n        # array we use, in the dtype 'U' case, a different write routine\n        # that writes row by row and encodes any 'U' columns to ASCII.\n\n        # If the output_field is non-ASCII we will worry about ASCII encoding\n        # later when writing; otherwise we can do it right here\n        if input_field.dtype.kind == 'U' and output_field.dtype.kind == 'S':\n            try:\n                _ascii_encode(input_field, out=output_field)\n            except _UnicodeArrayEncodeError as exc:\n                raise ValueError(\n                    \"Could not save column '{}': Contains characters that \"\n                    \"cannot be encoded as ASCII as required by FITS, starting \"\n                    \"at the index {!r} of the column, and the index {} of \"\n                    \"the string at that location.\".format(\n                        self._coldefs[col_idx].name,\n                        exc.index[0] if len(exc.index) == 1 else exc.index,\n                        exc.start))\n        else:\n            # Otherwise go ahead and do a direct copy into--if both are type\n            # 'U' we'll handle encoding later\n            input_field = input_field.flatten().view(output_field.dtype)\n            output_field.flat[:] = input_field\n\n        # Ensure that blanks at the end of each string are\n        # converted to nulls instead of spaces, see Trac #15\n        # and #111\n        _rstrip_inplace(output_field)"},{"col":4,"comment":"null","endLoc":553,"header":"def __array_finalize__(self, obj)","id":1471,"name":"__array_finalize__","nodeType":"Function","startLoc":531,"text":"def __array_finalize__(self, obj):\n        # Check whether super().__array_finalize should be called\n        # (sadly, ndarray.__array_finalize__ is None; we cannot be sure\n        # what is above us).\n        super_array_finalize = super().__array_finalize__\n        if super_array_finalize is not None:\n            super_array_finalize(obj)\n\n        # If we're a new object or viewing an ndarray, nothing has to be done.\n        if obj is None or obj.__class__ is np.ndarray:\n            return\n\n        # If our unit is not set and obj has a valid one, use it.\n        if self._unit is None:\n            unit = getattr(obj, '_unit', None)\n            if unit is not None:\n                self._set_unit(unit)\n\n        # Copy info if the original had `info` defined.  Because of the way the\n        # DataInfo works, `'info' in obj.__dict__` is False until the\n        # `info` attribute is accessed or set.\n        if 'info' in obj.__dict__:\n            self.info = obj.info"},{"col":4,"comment":"null","endLoc":1289,"header":"def tolist(self)","id":1472,"name":"tolist","nodeType":"Function","startLoc":1284,"text":"def tolist(self):\n        # Override .tolist to take care of special case of VLF\n\n        column_lists = [self[name].tolist() for name in self.columns.names]\n\n        return [list(row) for row in zip(*column_lists)]"},{"col":4,"comment":"Set the unit.\n\n        This is used anywhere the unit is set or modified, i.e., in the\n        initilizer, in ``__imul__`` and ``__itruediv__`` for in-place\n        multiplication and division by another unit, as well as in\n        ``__array_finalize__`` for wrapping up views.  For Quantity, it just\n        sets the unit, but subclasses can override it to check that, e.g.,\n        a unit is consistent.\n        ","endLoc":769,"header":"def _set_unit(self, unit)","id":1473,"name":"_set_unit","nodeType":"Function","startLoc":746,"text":"def _set_unit(self, unit):\n        \"\"\"Set the unit.\n\n        This is used anywhere the unit is set or modified, i.e., in the\n        initilizer, in ``__imul__`` and ``__itruediv__`` for in-place\n        multiplication and division by another unit, as well as in\n        ``__array_finalize__`` for wrapping up views.  For Quantity, it just\n        sets the unit, but subclasses can override it to check that, e.g.,\n        a unit is consistent.\n        \"\"\"\n        if not isinstance(unit, UnitBase):\n            if (isinstance(self._unit, StructuredUnit)\n                    or isinstance(unit, StructuredUnit)):\n                unit = StructuredUnit(unit, self.dtype)\n            else:\n                # Trying to go through a string ensures that, e.g., Magnitudes with\n                # dimensionless physical unit become Quantity with units of mag.\n                unit = Unit(str(unit), parse_strict='silent')\n                if not isinstance(unit, (UnitBase, StructuredUnit)):\n                    raise UnitTypeError(\n                        \"{} instances require normal units, not {} instances.\"\n                        .format(type(self).__name__, type(unit)))\n\n        self._unit = unit"},{"col":4,"comment":"null","endLoc":856,"header":"@ColumnAttribute('TCTYP')\n    def coord_type(col, coord_type)","id":1474,"name":"coord_type","nodeType":"Function","startLoc":847,"text":"@ColumnAttribute('TCTYP')\n    def coord_type(col, coord_type):\n        if coord_type is None:\n            return\n\n        if (not isinstance(coord_type, str)\n                or len(coord_type) > 8):\n            raise AssertionError(\n                'Coordinate/axis type must be a string of atmost 8 '\n                'characters.')"},{"attributeType":"null","col":4,"comment":"null","endLoc":151,"id":1475,"name":"_record_type","nodeType":"Attribute","startLoc":151,"text":"_record_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":152,"id":1476,"name":"_character_as_bytes","nodeType":"Attribute","startLoc":152,"text":"_character_as_bytes"},{"col":0,"comment":"\n    Iterates through the subclasses of _BaseHDU and uses that class's\n    match_header() method to determine which subclass to instantiate.\n\n    It's important to be aware that the class hierarchy is traversed in a\n    depth-last order.  Each match_header() should identify an HDU type as\n    uniquely as possible.  Abstract types may choose to simply return False\n    or raise NotImplementedError to be skipped.\n\n    If any unexpected exceptions are raised while evaluating\n    match_header(), the type is taken to be _CorruptedHDU.\n\n    Used primarily by _BaseHDU._readfrom_internal and _BaseHDU._from_data to\n    find an appropriate HDU class to use based on values in the header.\n    ","endLoc":106,"header":"def _hdu_class_from_header(cls, header)","id":1477,"name":"_hdu_class_from_header","nodeType":"Function","startLoc":64,"text":"def _hdu_class_from_header(cls, header):\n    \"\"\"\n    Iterates through the subclasses of _BaseHDU and uses that class's\n    match_header() method to determine which subclass to instantiate.\n\n    It's important to be aware that the class hierarchy is traversed in a\n    depth-last order.  Each match_header() should identify an HDU type as\n    uniquely as possible.  Abstract types may choose to simply return False\n    or raise NotImplementedError to be skipped.\n\n    If any unexpected exceptions are raised while evaluating\n    match_header(), the type is taken to be _CorruptedHDU.\n\n    Used primarily by _BaseHDU._readfrom_internal and _BaseHDU._from_data to\n    find an appropriate HDU class to use based on values in the header.\n    \"\"\"\n\n    klass = cls  # By default, if no subclasses are defined\n    if header:\n        for c in reversed(list(itersubclasses(cls))):\n            try:\n                # HDU classes built into astropy.io.fits are always considered,\n                # but extension HDUs must be explicitly registered\n                if not (c.__module__.startswith('astropy.io.fits.') or\n                        c in cls._hdu_registry):\n                    continue\n                if c.match_header(header):\n                    klass = c\n                    break\n            except NotImplementedError:\n                continue\n            except Exception as exc:\n                warnings.warn(\n                    'An exception occurred matching an HDU header to the '\n                    'appropriate HDU type: {}'.format(exc),\n                    AstropyUserWarning)\n                warnings.warn('The HDU will be treated as corrupted.',\n                              AstropyUserWarning)\n                klass = _CorruptedHDU\n                del exc\n                break\n\n    return klass"},{"attributeType":"null","col":12,"comment":"null","endLoc":219,"id":1478,"name":"_character_as_bytes","nodeType":"Attribute","startLoc":219,"text":"self._character_as_bytes"},{"attributeType":"null","col":12,"comment":"null","endLoc":224,"id":1479,"name":"_heapsize","nodeType":"Attribute","startLoc":224,"text":"self._heapsize"},{"col":4,"comment":"null","endLoc":863,"header":"@ColumnAttribute('TCUNI')\n    def coord_unit(col, coord_unit)","id":1480,"name":"coord_unit","nodeType":"Function","startLoc":858,"text":"@ColumnAttribute('TCUNI')\n    def coord_unit(col, coord_unit):\n        if (coord_unit is not None\n                and not isinstance(coord_unit, str)):\n            raise AssertionError(\n                'Coordinate/axis unit must be a string.')"},{"col":0,"comment":"Create a parser from local variables.\n\n    It automatically compiles the parser in optimized mode, writing to\n    ``tabmodule`` in the same directory as the calling file.\n\n    This function is thread-safe, and the returned parser is also thread-safe,\n    provided that it does not share a lexer with any other parser.\n\n    It is only intended to work with parsers defined within the calling\n    function, rather than at class or module scope.\n\n    Parameters\n    ----------\n    tabmodule : str\n        Name for the file to write with the generated tables, if it does not\n        already exist (without ``.py`` suffix).\n    package : str\n        Name of a test package which should be run with pytest to regenerate\n        the output file. This is inserted into a comment in the generated\n        file.\n    ","endLoc":153,"header":"def yacc(tabmodule, package)","id":1481,"name":"yacc","nodeType":"Function","startLoc":118,"text":"def yacc(tabmodule, package):\n    \"\"\"Create a parser from local variables.\n\n    It automatically compiles the parser in optimized mode, writing to\n    ``tabmodule`` in the same directory as the calling file.\n\n    This function is thread-safe, and the returned parser is also thread-safe,\n    provided that it does not share a lexer with any other parser.\n\n    It is only intended to work with parsers defined within the calling\n    function, rather than at class or module scope.\n\n    Parameters\n    ----------\n    tabmodule : str\n        Name for the file to write with the generated tables, if it does not\n        already exist (without ``.py`` suffix).\n    package : str\n        Name of a test package which should be run with pytest to regenerate\n        the output file. This is inserted into a comment in the generated\n        file.\n    \"\"\"\n    from astropy.extern.ply import yacc\n\n    caller_file = yacc.get_caller_module_dict(2)['__file__']\n    tab_filename = os.path.join(os.path.dirname(caller_file), tabmodule + '.py')\n    with _LOCK:\n        tab_exists = os.path.exists(tab_filename)\n        with _patch_get_caller_module_dict(yacc):\n            parser = yacc.yacc(tabmodule=tabmodule,\n                               outputdir=os.path.dirname(caller_file),\n                               debug=False, optimize=True, write_tables=True)\n        if not tab_exists:\n            _add_tab_header(tab_filename, package)\n\n    return ThreadSafeParser(parser)"},{"attributeType":"null","col":12,"comment":"null","endLoc":229,"id":1482,"name":"_uint","nodeType":"Attribute","startLoc":229,"text":"self._uint"},{"col":4,"comment":"null","endLoc":871,"header":"@ColumnAttribute('TCRPX')\n    def coord_ref_point(col, coord_ref_point)","id":1483,"name":"coord_ref_point","nodeType":"Function","startLoc":865,"text":"@ColumnAttribute('TCRPX')\n    def coord_ref_point(col, coord_ref_point):\n        if (coord_ref_point is not None\n                and not isinstance(coord_ref_point, numbers.Real)):\n            raise AssertionError(\n                'Pixel coordinate of the reference point must be '\n                'real floating type.')"},{"attributeType":"null","col":12,"comment":"null","endLoc":164,"id":1484,"name":"self","nodeType":"Attribute","startLoc":164,"text":"self"},{"attributeType":"null","col":12,"comment":"null","endLoc":223,"id":1485,"name":"_heapoffset","nodeType":"Attribute","startLoc":223,"text":"self._heapoffset"},{"attributeType":"null","col":12,"comment":"null","endLoc":169,"id":1486,"name":"_nfields","nodeType":"Attribute","startLoc":169,"text":"self._nfields"},{"attributeType":"null","col":8,"comment":"null","endLoc":180,"id":1487,"name":"_col_weakrefs","nodeType":"Attribute","startLoc":180,"text":"self._col_weakrefs"},{"attributeType":"null","col":12,"comment":"null","endLoc":222,"id":1488,"name":"_converted","nodeType":"Attribute","startLoc":222,"text":"self._converted"},{"attributeType":"null","col":12,"comment":"null","endLoc":228,"id":1489,"name":"_gap","nodeType":"Attribute","startLoc":228,"text":"self._gap"},{"col":4,"comment":"null","endLoc":879,"header":"@ColumnAttribute('TCRVL')\n    def coord_ref_value(col, coord_ref_value)","id":1490,"name":"coord_ref_value","nodeType":"Function","startLoc":873,"text":"@ColumnAttribute('TCRVL')\n    def coord_ref_value(col, coord_ref_value):\n        if (coord_ref_value is not None\n                and not isinstance(coord_ref_value, numbers.Real)):\n            raise AssertionError(\n                'Coordinate value at reference point must be real '\n                'floating type.')"},{"col":4,"comment":"null","endLoc":566,"header":"def __array_wrap__(self, obj, context=None)","id":1491,"name":"__array_wrap__","nodeType":"Function","startLoc":555,"text":"def __array_wrap__(self, obj, context=None):\n\n        if context is None:\n            # Methods like .squeeze() created a new `ndarray` and then call\n            # __array_wrap__ to turn the array into self's subclass.\n            return self._new_view(obj)\n\n        raise NotImplementedError('__array_wrap__ should not be used '\n                                  'with a context any more since all use '\n                                  'should go through array_function. '\n                                  'Please raise an issue on '\n                                  'https://github.com/astropy/astropy')"},{"attributeType":"null","col":12,"comment":"null","endLoc":226,"id":1492,"name":"_coldefs","nodeType":"Attribute","startLoc":226,"text":"self._coldefs"},{"col":0,"comment":"null","endLoc":2890,"header":"def get_caller_module_dict(levels)","id":1493,"name":"get_caller_module_dict","nodeType":"Function","startLoc":2885,"text":"def get_caller_module_dict(levels):\n    f = sys._getframe(levels)\n    ldict = f.f_globals.copy()\n    if f.f_globals != f.f_locals:\n        ldict.update(f.f_locals)\n    return ldict"},{"col":4,"comment":"null","endLoc":886,"header":"@ColumnAttribute('TCDLT')\n    def coord_inc(col, coord_inc)","id":1494,"name":"coord_inc","nodeType":"Function","startLoc":881,"text":"@ColumnAttribute('TCDLT')\n    def coord_inc(col, coord_inc):\n        if (coord_inc is not None\n                and not isinstance(coord_inc, numbers.Real)):\n            raise AssertionError(\n                'Coordinate increment must be real floating type.')"},{"className":"GroupData","col":0,"comment":"\n    Random groups data object.\n\n    Allows structured access to FITS Group data in a manner analogous\n    to tables.\n    ","endLoc":249,"id":1495,"nodeType":"Class","startLoc":87,"text":"class GroupData(FITS_rec):\n    \"\"\"\n    Random groups data object.\n\n    Allows structured access to FITS Group data in a manner analogous\n    to tables.\n    \"\"\"\n\n    _record_type = Group\n\n    def __new__(cls, input=None, bitpix=None, pardata=None, parnames=[],\n                bscale=None, bzero=None, parbscales=None, parbzeros=None):\n        \"\"\"\n        Parameters\n        ----------\n        input : array or FITS_rec instance\n            input data, either the group data itself (a\n            `numpy.ndarray`) or a record array (`FITS_rec`) which will\n            contain both group parameter info and the data.  The rest\n            of the arguments are used only for the first case.\n\n        bitpix : int\n            data type as expressed in FITS ``BITPIX`` value (8, 16, 32,\n            64, -32, or -64)\n\n        pardata : sequence of array\n            parameter data, as a list of (numeric) arrays.\n\n        parnames : sequence of str\n            list of parameter names.\n\n        bscale : int\n            ``BSCALE`` of the data\n\n        bzero : int\n            ``BZERO`` of the data\n\n        parbscales : sequence of int\n            list of bscales for the parameters\n\n        parbzeros : sequence of int\n            list of bzeros for the parameters\n        \"\"\"\n\n        if not isinstance(input, FITS_rec):\n            if pardata is None:\n                npars = 0\n            else:\n                npars = len(pardata)\n\n            if parbscales is None:\n                parbscales = [None] * npars\n            if parbzeros is None:\n                parbzeros = [None] * npars\n\n            if parnames is None:\n                parnames = [f'PAR{idx + 1}' for idx in range(npars)]\n\n            if len(parnames) != npars:\n                raise ValueError('The number of parameter data arrays does '\n                                 'not match the number of parameters.')\n\n            unique_parnames = _unique_parnames(parnames + ['DATA'])\n\n            if bitpix is None:\n                bitpix = DTYPE2BITPIX[input.dtype.name]\n\n            fits_fmt = GroupsHDU._bitpix2tform[bitpix]  # -32 -> 'E'\n            format = FITS2NUMPY[fits_fmt]  # 'E' -> 'f4'\n            data_fmt = f'{str(input.shape[1:])}{format}'\n            formats = ','.join(([format] * npars) + [data_fmt])\n            gcount = input.shape[0]\n\n            cols = [Column(name=unique_parnames[idx], format=fits_fmt,\n                           bscale=parbscales[idx], bzero=parbzeros[idx])\n                    for idx in range(npars)]\n            cols.append(Column(name=unique_parnames[-1], format=fits_fmt,\n                               bscale=bscale, bzero=bzero))\n\n            coldefs = ColDefs(cols)\n\n            self = FITS_rec.__new__(cls,\n                                    np.rec.array(None,\n                                                 formats=formats,\n                                                 names=coldefs.names,\n                                                 shape=gcount))\n\n            # By default the data field will just be 'DATA', but it may be\n            # uniquified if 'DATA' is already used by one of the group names\n            self._data_field = unique_parnames[-1]\n\n            self._coldefs = coldefs\n            self.parnames = parnames\n\n            for idx, name in enumerate(unique_parnames[:-1]):\n                column = coldefs[idx]\n                # Note: _get_scale_factors is used here and in other cases\n                # below to determine whether the column has non-default\n                # scale/zero factors.\n                # TODO: Find a better way to do this than using this interface\n                scale, zero = self._get_scale_factors(column)[3:5]\n                if scale or zero:\n                    self._cache_field(name, pardata[idx])\n                else:\n                    np.rec.recarray.field(self, idx)[:] = pardata[idx]\n\n            column = coldefs[self._data_field]\n            scale, zero = self._get_scale_factors(column)[3:5]\n            if scale or zero:\n                self._cache_field(self._data_field, input)\n            else:\n                np.rec.recarray.field(self, npars)[:] = input\n        else:\n            self = FITS_rec.__new__(cls, input)\n            self.parnames = None\n        return self\n\n    def __array_finalize__(self, obj):\n        super().__array_finalize__(obj)\n        if isinstance(obj, GroupData):\n            self.parnames = obj.parnames\n        elif isinstance(obj, FITS_rec):\n            self.parnames = obj._coldefs.names\n\n    def __getitem__(self, key):\n        out = super().__getitem__(key)\n        if isinstance(out, GroupData):\n            out.parnames = self.parnames\n        return out\n\n    @property\n    def data(self):\n        \"\"\"\n        The raw group data represented as a multi-dimensional `numpy.ndarray`\n        array.\n        \"\"\"\n\n        # The last column in the coldefs is the data portion of the group\n        return self.field(self._coldefs.names[-1])\n\n    @lazyproperty\n    def _unique(self):\n        return _par_indices(self.parnames)\n\n    def par(self, parname):\n        \"\"\"\n        Get the group parameter values.\n        \"\"\"\n\n        if _is_int(parname):\n            result = self.field(parname)\n        else:\n            indx = self._unique[parname.upper()]\n            if len(indx) == 1:\n                result = self.field(indx[0])\n\n            # if more than one group parameter have the same name\n            else:\n                result = self.field(indx[0]).astype('f8')\n                for i in indx[1:]:\n                    result += self.field(i)\n\n        return result"},{"col":4,"comment":"null","endLoc":893,"header":"@ColumnAttribute('TRPOS')\n    def time_ref_pos(col, time_ref_pos)","id":1496,"name":"time_ref_pos","nodeType":"Function","startLoc":888,"text":"@ColumnAttribute('TRPOS')\n    def time_ref_pos(col, time_ref_pos):\n        if (time_ref_pos is not None\n                and not isinstance(time_ref_pos, str)):\n            raise AssertionError(\n                'Time reference position must be a string.')"},{"col":4,"comment":"Wrap numpy ufuncs, taking care of units.\n\n        Parameters\n        ----------\n        function : callable\n            ufunc to wrap.\n        method : str\n            Ufunc method: ``__call__``, ``at``, ``reduce``, etc.\n        inputs : tuple\n            Input arrays.\n        kwargs : keyword arguments\n            As passed on, with ``out`` containing possible quantity output.\n\n        Returns\n        -------\n        result : `~astropy.units.Quantity`\n            Results of the ufunc, with the unit set properly.\n        ","endLoc":620,"header":"def __array_ufunc__(self, function, method, *inputs, **kwargs)","id":1497,"name":"__array_ufunc__","nodeType":"Function","startLoc":568,"text":"def __array_ufunc__(self, function, method, *inputs, **kwargs):\n        \"\"\"Wrap numpy ufuncs, taking care of units.\n\n        Parameters\n        ----------\n        function : callable\n            ufunc to wrap.\n        method : str\n            Ufunc method: ``__call__``, ``at``, ``reduce``, etc.\n        inputs : tuple\n            Input arrays.\n        kwargs : keyword arguments\n            As passed on, with ``out`` containing possible quantity output.\n\n        Returns\n        -------\n        result : `~astropy.units.Quantity`\n            Results of the ufunc, with the unit set properly.\n        \"\"\"\n        # Determine required conversion functions -- to bring the unit of the\n        # input to that expected (e.g., radian for np.sin), or to get\n        # consistent units between two inputs (e.g., in np.add) --\n        # and the unit of the result (or tuple of units for nout > 1).\n        converters, unit = converters_and_unit(function, method, *inputs)\n\n        out = kwargs.get('out', None)\n        # Avoid loop back by turning any Quantity output into array views.\n        if out is not None:\n            # If pre-allocated output is used, check it is suitable.\n            # This also returns array view, to ensure we don't loop back.\n            if function.nout == 1:\n                out = out[0]\n            out_array = check_output(out, unit, inputs, function=function)\n            # Ensure output argument remains a tuple.\n            kwargs['out'] = (out_array,) if function.nout == 1 else out_array\n\n        # Same for inputs, but here also convert if necessary.\n        arrays = []\n        for input_, converter in zip(inputs, converters):\n            input_ = getattr(input_, 'value', input_)\n            arrays.append(converter(input_) if converter else input_)\n\n        # Call our superclass's __array_ufunc__\n        result = super().__array_ufunc__(function, method, *arrays, **kwargs)\n        # If unit is None, a plain array is expected (e.g., comparisons), which\n        # means we're done.\n        # We're also done if the result was None (for method 'at') or\n        # NotImplemented, which can happen if other inputs/outputs override\n        # __array_ufunc__; hopefully, they can then deal with us.\n        if unit is None or result is None or result is NotImplemented:\n            return result\n\n        return self._result_as_quantity(result, unit, out)"},{"col":4,"comment":"Whether this `Column` represents a column in an ASCII table.","endLoc":908,"header":"@lazyproperty\n    def ascii(self)","id":1498,"name":"ascii","nodeType":"Function","startLoc":904,"text":"@lazyproperty\n    def ascii(self):\n        \"\"\"Whether this `Column` represents a column in an ASCII table.\"\"\"\n\n        return isinstance(self.format, _AsciiColumnFormat)"},{"col":4,"comment":"null","endLoc":912,"header":"@lazyproperty\n    def dtype(self)","id":1499,"name":"dtype","nodeType":"Function","startLoc":910,"text":"@lazyproperty\n    def dtype(self):\n        return self.format.dtype"},{"col":4,"comment":"\n        Return a copy of this `Column`.\n        ","endLoc":920,"header":"def copy(self)","id":1500,"name":"copy","nodeType":"Function","startLoc":914,"text":"def copy(self):\n        \"\"\"\n        Return a copy of this `Column`.\n        \"\"\"\n        tmp = Column(format='I')  # just use a throw-away format\n        tmp.__dict__ = self.__dict__.copy()\n        return tmp"},{"col":4,"comment":"\n        Creates a new HDU object of the appropriate type from a string\n        containing the HDU's entire header and, optionally, its data.\n\n        Note: When creating a new HDU from a string without a backing file\n        object, the data of that HDU may be read-only.  It depends on whether\n        the underlying string was an immutable Python str/bytes object, or some\n        kind of read-write memory buffer such as a `memoryview`.\n\n        Parameters\n        ----------\n        data : str, bytearray, memoryview, ndarray\n            A byte string containing the HDU's header and data.\n\n        checksum : bool, optional\n            Check the HDU's checksum and/or datasum.\n\n        ignore_missing_end : bool, optional\n            Ignore a missing end card in the header data.  Note that without the\n            end card the end of the header may be ambiguous and resulted in a\n            corrupt HDU.  In this case the assumption is that the first 2880\n            block that does not begin with valid FITS header data is the\n            beginning of the data.\n\n        **kwargs : optional\n            May consist of additional keyword arguments specific to an HDU\n            type--these correspond to keywords recognized by the constructors of\n            different HDU classes such as `PrimaryHDU`, `ImageHDU`, or\n            `BinTableHDU`.  Any unrecognized keyword arguments are simply\n            ignored.\n        ","endLoc":300,"header":"@classmethod\n    def fromstring(cls, data, checksum=False, ignore_missing_end=False,\n                   **kwargs)","id":1501,"name":"fromstring","nodeType":"Function","startLoc":263,"text":"@classmethod\n    def fromstring(cls, data, checksum=False, ignore_missing_end=False,\n                   **kwargs):\n        \"\"\"\n        Creates a new HDU object of the appropriate type from a string\n        containing the HDU's entire header and, optionally, its data.\n\n        Note: When creating a new HDU from a string without a backing file\n        object, the data of that HDU may be read-only.  It depends on whether\n        the underlying string was an immutable Python str/bytes object, or some\n        kind of read-write memory buffer such as a `memoryview`.\n\n        Parameters\n        ----------\n        data : str, bytearray, memoryview, ndarray\n            A byte string containing the HDU's header and data.\n\n        checksum : bool, optional\n            Check the HDU's checksum and/or datasum.\n\n        ignore_missing_end : bool, optional\n            Ignore a missing end card in the header data.  Note that without the\n            end card the end of the header may be ambiguous and resulted in a\n            corrupt HDU.  In this case the assumption is that the first 2880\n            block that does not begin with valid FITS header data is the\n            beginning of the data.\n\n        **kwargs : optional\n            May consist of additional keyword arguments specific to an HDU\n            type--these correspond to keywords recognized by the constructors of\n            different HDU classes such as `PrimaryHDU`, `ImageHDU`, or\n            `BinTableHDU`.  Any unrecognized keyword arguments are simply\n            ignored.\n        \"\"\"\n\n        return cls._readfrom_internal(data, checksum=checksum,\n                                      ignore_missing_end=ignore_missing_end,\n                                      **kwargs)"},{"col":4,"comment":"\n        Return a new copy of the table in the form of a structured np.ndarray or\n        np.ma.MaskedArray object (as appropriate).\n\n        Parameters\n        ----------\n        keep_byteorder : bool, optional\n            By default the returned array has all columns in native byte\n            order.  However, if this option is `True` this preserves the\n            byte order of all columns (if any are non-native).\n\n        names : list, optional:\n            List of column names to include for returned structured array.\n            Default is to include all table columns.\n\n        Returns\n        -------\n        table_array : array or `~numpy.ma.MaskedArray`\n            Copy of table as a numpy structured array.\n            ndarray for unmasked or `~numpy.ma.MaskedArray` for masked.\n        ","endLoc":657,"header":"def as_array(self, keep_byteorder=False, names=None)","id":1502,"name":"as_array","nodeType":"Function","startLoc":603,"text":"def as_array(self, keep_byteorder=False, names=None):\n        \"\"\"\n        Return a new copy of the table in the form of a structured np.ndarray or\n        np.ma.MaskedArray object (as appropriate).\n\n        Parameters\n        ----------\n        keep_byteorder : bool, optional\n            By default the returned array has all columns in native byte\n            order.  However, if this option is `True` this preserves the\n            byte order of all columns (if any are non-native).\n\n        names : list, optional:\n            List of column names to include for returned structured array.\n            Default is to include all table columns.\n\n        Returns\n        -------\n        table_array : array or `~numpy.ma.MaskedArray`\n            Copy of table as a numpy structured array.\n            ndarray for unmasked or `~numpy.ma.MaskedArray` for masked.\n        \"\"\"\n        masked = self.masked or self.has_masked_columns or self.has_masked_values\n        empty_init = ma.empty if masked else np.empty\n        if len(self.columns) == 0:\n            return empty_init(0, dtype=None)\n\n        dtype = []\n\n        cols = self.columns.values()\n\n        if names is not None:\n            cols = [col for col in cols if col.info.name in names]\n\n        for col in cols:\n            col_descr = descr(col)\n\n            if not (col.info.dtype.isnative or keep_byteorder):\n                new_dt = np.dtype(col_descr[1]).newbyteorder('=')\n                col_descr = (col_descr[0], new_dt, col_descr[2])\n\n            dtype.append(col_descr)\n\n        data = empty_init(len(self), dtype=dtype)\n        for col in cols:\n            # When assigning from one array into a field of a structured array,\n            # Numpy will automatically swap those columns to their destination\n            # byte order where applicable\n            data[col.info.name] = col\n\n            # For masked out, masked mixin columns need to set output mask attribute.\n            if masked and has_info_class(col, MixinInfo) and hasattr(col, 'mask'):\n                data[col.info.name].mask = col.mask\n\n        return data"},{"col":4,"comment":"null","endLoc":259,"header":"def __repr__(self)","id":1503,"name":"__repr__","nodeType":"Function","startLoc":254,"text":"def __repr__(self):\n        # In order to correctly repr an HDUList we need to load all the\n        # HDUs as well\n        self.readall()\n\n        return super().__repr__()"},{"attributeType":"ColumnAttribute","col":4,"comment":"null","endLoc":895,"id":1504,"name":"format","nodeType":"Attribute","startLoc":895,"text":"format"},{"col":4,"comment":"null","endLoc":271,"header":"def __iter__(self)","id":1505,"name":"__iter__","nodeType":"Function","startLoc":261,"text":"def __iter__(self):\n        # While effectively this does the same as:\n        # for idx in range(len(self)):\n        #     yield self[idx]\n        # the more complicated structure is here to prevent the use of len(),\n        # which would break the lazy loading\n        for idx in itertools.count():\n            try:\n                yield self[idx]\n            except IndexError:\n                break"},{"col":4,"comment":"\n        Get an HDU from the `HDUList`, indexed by number or name.\n        ","endLoc":330,"header":"def __getitem__(self, key)","id":1506,"name":"__getitem__","nodeType":"Function","startLoc":273,"text":"def __getitem__(self, key):\n        \"\"\"\n        Get an HDU from the `HDUList`, indexed by number or name.\n        \"\"\"\n\n        # If the key is a slice we need to make sure the necessary HDUs\n        # have been loaded before passing the slice on to super.\n        if isinstance(key, slice):\n            max_idx = key.stop\n            # Check for and handle the case when no maximum was\n            # specified (e.g. [1:]).\n            if max_idx is None:\n                # We need all of the HDUs, so load them\n                # and reset the maximum to the actual length.\n                max_idx = len(self)\n\n            # Just in case the max_idx is negative...\n            max_idx = self._positive_index_of(max_idx)\n\n            number_loaded = super().__len__()\n\n            if max_idx >= number_loaded:\n                # We need more than we have, try loading up to and including\n                # max_idx. Note we do not try to be clever about skipping HDUs\n                # even though key.step might conceivably allow it.\n                for i in range(number_loaded, max_idx):\n                    # Read until max_idx or to the end of the file, whichever\n                    # comes first.\n                    if not self._read_next_hdu():\n                        break\n\n            try:\n                hdus = super().__getitem__(key)\n            except IndexError as e:\n                # Raise a more helpful IndexError if the file was not fully read.\n                if self._read_all:\n                    raise e\n                else:\n                    raise IndexError('HDU not found, possibly because the index '\n                                     'is out of range, or because the file was '\n                                     'closed before all HDUs were read')\n            else:\n                return HDUList(hdus)\n\n        # Originally this used recursion, but hypothetically an HDU with\n        # a very large number of HDUs could blow the stack, so use a loop\n        # instead\n        try:\n            return self._try_while_unread_hdus(super().__getitem__,\n                                               self._positive_index_of(key))\n        except IndexError as e:\n            # Raise a more helpful IndexError if the file was not fully read.\n            if self._read_all:\n                raise e\n            else:\n                raise IndexError('HDU not found, possibly because the index '\n                                 'is out of range, or because the file was '\n                                 'closed before all HDUs were read')"},{"attributeType":"ColumnAttribute","col":4,"comment":"null","endLoc":896,"id":1507,"name":"unit","nodeType":"Attribute","startLoc":896,"text":"unit"},{"col":4,"comment":"\n        Same as index_of, but ensures always returning a positive index\n        or zero.\n\n        (Really this should be called non_negative_index_of but it felt\n        too long.)\n\n        This means that if the key is a negative integer, we have to\n        convert it to the corresponding positive index.  This means\n        knowing the length of the HDUList, which in turn means loading\n        all HDUs.  Therefore using negative indices on HDULists is inherently\n        inefficient.\n        ","endLoc":786,"header":"def _positive_index_of(self, key)","id":1508,"name":"_positive_index_of","nodeType":"Function","startLoc":762,"text":"def _positive_index_of(self, key):\n        \"\"\"\n        Same as index_of, but ensures always returning a positive index\n        or zero.\n\n        (Really this should be called non_negative_index_of but it felt\n        too long.)\n\n        This means that if the key is a negative integer, we have to\n        convert it to the corresponding positive index.  This means\n        knowing the length of the HDUList, which in turn means loading\n        all HDUs.  Therefore using negative indices on HDULists is inherently\n        inefficient.\n        \"\"\"\n\n        index = self.index_of(key)\n\n        if index >= 0:\n            return index\n\n        if abs(index) > len(self):\n            raise IndexError(\n                f'Extension {index} is out of bound or not found.')\n\n        return len(self) + index"},{"attributeType":"ColumnAttribute","col":4,"comment":"null","endLoc":897,"id":1509,"name":"null","nodeType":"Attribute","startLoc":897,"text":"null"},{"col":4,"comment":"\n        Get the index of an HDU from the `HDUList`.\n\n        Parameters\n        ----------\n        key : int, str, tuple of (string, int) or BaseHDU\n            The key identifying the HDU.  If ``key`` is a tuple, it is of the\n            form ``(name, ver)`` where ``ver`` is an ``EXTVER`` value that must\n            match the HDU being searched for.\n\n            If the key is ambiguous (e.g. there are multiple 'SCI' extensions)\n            the first match is returned.  For a more precise match use the\n            ``(name, ver)`` pair.\n\n            If even the ``(name, ver)`` pair is ambiguous (it shouldn't be\n            but it's not impossible) the numeric index must be used to index\n            the duplicate HDU.\n\n            When ``key`` is an HDU object, this function returns the\n            index of that HDU object in the ``HDUList``.\n\n        Returns\n        -------\n        index : int\n            The index of the HDU in the `HDUList`.\n\n        Raises\n        ------\n        ValueError\n            If ``key`` is an HDU object and it is not found in the ``HDUList``.\n        KeyError\n            If an HDU specified by the ``key`` that is an extension number,\n            extension name, or a tuple of extension name and version is not\n            found in the ``HDUList``.\n\n        ","endLoc":760,"header":"def index_of(self, key)","id":1510,"name":"index_of","nodeType":"Function","startLoc":690,"text":"def index_of(self, key):\n        \"\"\"\n        Get the index of an HDU from the `HDUList`.\n\n        Parameters\n        ----------\n        key : int, str, tuple of (string, int) or BaseHDU\n            The key identifying the HDU.  If ``key`` is a tuple, it is of the\n            form ``(name, ver)`` where ``ver`` is an ``EXTVER`` value that must\n            match the HDU being searched for.\n\n            If the key is ambiguous (e.g. there are multiple 'SCI' extensions)\n            the first match is returned.  For a more precise match use the\n            ``(name, ver)`` pair.\n\n            If even the ``(name, ver)`` pair is ambiguous (it shouldn't be\n            but it's not impossible) the numeric index must be used to index\n            the duplicate HDU.\n\n            When ``key`` is an HDU object, this function returns the\n            index of that HDU object in the ``HDUList``.\n\n        Returns\n        -------\n        index : int\n            The index of the HDU in the `HDUList`.\n\n        Raises\n        ------\n        ValueError\n            If ``key`` is an HDU object and it is not found in the ``HDUList``.\n        KeyError\n            If an HDU specified by the ``key`` that is an extension number,\n            extension name, or a tuple of extension name and version is not\n            found in the ``HDUList``.\n\n        \"\"\"\n\n        if _is_int(key):\n            return key\n        elif isinstance(key, tuple):\n            _key, _ver = key\n        elif isinstance(key, _BaseHDU):\n            return self.index(key)\n        else:\n            _key = key\n            _ver = None\n\n        if not isinstance(_key, str):\n            raise KeyError(\n                '{} indices must be integers, extension names as strings, '\n                'or (extname, version) tuples; got {}'\n                ''.format(self.__class__.__name__, _key))\n\n        _key = (_key.strip()).upper()\n\n        found = None\n        for idx, hdu in enumerate(self):\n            name = hdu.name\n            if isinstance(name, str):\n                name = name.strip().upper()\n            # 'PRIMARY' should always work as a reference to the first HDU\n            if ((name == _key or (_key == 'PRIMARY' and idx == 0)) and\n                    (_ver is None or _ver == hdu.ver)):\n                found = idx\n                break\n\n        if (found is None):\n            raise KeyError(f'Extension {key!r} not found.')\n        else:\n            return found"},{"col":0,"comment":"Determine the required converters and the unit of the ufunc result.\n\n    Converters are functions required to convert to a ufunc's expected unit,\n    e.g., radian for np.sin; or to ensure units of two inputs are consistent,\n    e.g., for np.add.  In these examples, the unit of the result would be\n    dimensionless_unscaled for np.sin, and the same consistent unit for np.add.\n\n    Parameters\n    ----------\n    function : `~numpy.ufunc`\n        Numpy universal function\n    method : str\n        Method with which the function is evaluated, e.g.,\n        '__call__', 'reduce', etc.\n    *args :  `~astropy.units.Quantity` or ndarray subclass\n        Input arguments to the function\n\n    Raises\n    ------\n    TypeError : when the specified function cannot be used with Quantities\n        (e.g., np.logical_or), or when the routine does not know how to handle\n        the specified function (in which case an issue should be raised on\n        https://github.com/astropy/astropy).\n    UnitTypeError : when the conversion to the required (or consistent) units\n        is not possible.\n    ","endLoc":280,"header":"def converters_and_unit(function, method, *args)","id":1511,"name":"converters_and_unit","nodeType":"Function","startLoc":133,"text":"def converters_and_unit(function, method, *args):\n    \"\"\"Determine the required converters and the unit of the ufunc result.\n\n    Converters are functions required to convert to a ufunc's expected unit,\n    e.g., radian for np.sin; or to ensure units of two inputs are consistent,\n    e.g., for np.add.  In these examples, the unit of the result would be\n    dimensionless_unscaled for np.sin, and the same consistent unit for np.add.\n\n    Parameters\n    ----------\n    function : `~numpy.ufunc`\n        Numpy universal function\n    method : str\n        Method with which the function is evaluated, e.g.,\n        '__call__', 'reduce', etc.\n    *args :  `~astropy.units.Quantity` or ndarray subclass\n        Input arguments to the function\n\n    Raises\n    ------\n    TypeError : when the specified function cannot be used with Quantities\n        (e.g., np.logical_or), or when the routine does not know how to handle\n        the specified function (in which case an issue should be raised on\n        https://github.com/astropy/astropy).\n    UnitTypeError : when the conversion to the required (or consistent) units\n        is not possible.\n    \"\"\"\n\n    # Check whether we support this ufunc, by getting the helper function\n    # (defined in helpers) which returns a list of function(s) that convert the\n    # input(s) to the unit required for the ufunc, as well as the unit the\n    # result will have (a tuple of units if there are multiple outputs).\n    ufunc_helper = UFUNC_HELPERS[function]\n\n    if method == '__call__' or (method == 'outer' and function.nin == 2):\n        # Find out the units of the arguments passed to the ufunc; usually,\n        # at least one is a quantity, but for two-argument ufuncs, the second\n        # could also be a Numpy array, etc.  These are given unit=None.\n        units = [getattr(arg, 'unit', None) for arg in args]\n\n        # Determine possible conversion functions, and the result unit.\n        converters, result_unit = ufunc_helper(function, *units)\n\n        if any(converter is False for converter in converters):\n            # for multi-argument ufuncs with a quantity and a non-quantity,\n            # the quantity normally needs to be dimensionless, *except*\n            # if the non-quantity can have arbitrary unit, i.e., when it\n            # is all zero, infinity or NaN.  In that case, the non-quantity\n            # can just have the unit of the quantity\n            # (this allows, e.g., `q > 0.` independent of unit)\n            try:\n                # Don't fold this loop in the test above: this rare case\n                # should not make the common case slower.\n                for i, converter in enumerate(converters):\n                    if converter is not False:\n                        continue\n                    if can_have_arbitrary_unit(args[i]):\n                        converters[i] = None\n                    else:\n                        raise UnitConversionError(\n                            \"Can only apply '{}' function to \"\n                            \"dimensionless quantities when other \"\n                            \"argument is not a quantity (unless the \"\n                            \"latter is all zero/infinity/nan)\"\n                            .format(function.__name__))\n            except TypeError:\n                # _can_have_arbitrary_unit failed: arg could not be compared\n                # with zero or checked to be finite. Then, ufunc will fail too.\n                raise TypeError(\"Unsupported operand type(s) for ufunc {}: \"\n                                \"'{}'\".format(function.__name__,\n                                               ','.join([arg.__class__.__name__\n                                                         for arg in args])))\n\n        # In the case of np.power and np.float_power, the unit itself needs to\n        # be modified by an amount that depends on one of the input values,\n        # so we need to treat this as a special case.\n        # TODO: find a better way to deal with this.\n        if result_unit is False:\n            if units[0] is None or units[0] == dimensionless_unscaled:\n                result_unit = dimensionless_unscaled\n            else:\n                if units[1] is None:\n                    p = args[1]\n                else:\n                    p = args[1].to(dimensionless_unscaled).value\n\n                try:\n                    result_unit = units[0] ** p\n                except ValueError as exc:\n                    # Changing the unit does not work for, e.g., array-shaped\n                    # power, but this is OK if we're (scaled) dimensionless.\n                    try:\n                        converters[0] = units[0]._get_converter(\n                            dimensionless_unscaled)\n                    except UnitConversionError:\n                        raise exc\n                    else:\n                        result_unit = dimensionless_unscaled\n\n    else:  # methods for which the unit should stay the same\n        nin = function.nin\n        unit = getattr(args[0], 'unit', None)\n        if method == 'at' and nin <= 2:\n            if nin == 1:\n                units = [unit]\n            else:\n                units = [unit, getattr(args[2], 'unit', None)]\n\n            converters, result_unit = ufunc_helper(function, *units)\n\n            # ensure there is no 'converter' for indices (2nd argument)\n            converters.insert(1, None)\n\n        elif method in {'reduce', 'accumulate', 'reduceat'} and nin == 2:\n            converters, result_unit = ufunc_helper(function, unit, unit)\n            converters = converters[:1]\n            if method == 'reduceat':\n                # add 'scale' for indices (2nd argument)\n                converters += [None]\n\n        else:\n            if method in {'reduce', 'accumulate',\n                          'reduceat', 'outer'} and nin != 2:\n                raise ValueError(f\"{method} only supported for binary functions\")\n\n            raise TypeError(\"Unexpected ufunc method {}.  If this should \"\n                            \"work, please raise an issue on\"\n                            \"https://github.com/astropy/astropy\"\n                            .format(method))\n\n        # for all but __call__ method, scaling is not allowed\n        if unit is not None and result_unit is None:\n            raise TypeError(\"Cannot use '{1}' method on ufunc {0} with a \"\n                            \"Quantity instance as the result is not a \"\n                            \"Quantity.\".format(function.__name__, method))\n\n        if (converters[0] is not None or\n            (unit is not None and unit is not result_unit and\n             (not result_unit.is_equivalent(unit) or\n              result_unit.to(unit) != 1.))):\n            # NOTE: this cannot be the more logical UnitTypeError, since\n            # then things like np.cumprod will not longer fail (they check\n            # for TypeError).\n            raise UnitsError(\"Cannot use '{1}' method on ufunc {0} with a \"\n                             \"Quantity instance as it would change the unit.\"\n                             .format(function.__name__, method))\n\n    return converters, result_unit"},{"attributeType":"ColumnAttribute","col":4,"comment":"null","endLoc":898,"id":1512,"name":"bscale","nodeType":"Attribute","startLoc":898,"text":"bscale"},{"attributeType":"ColumnAttribute","col":4,"comment":"null","endLoc":899,"id":1513,"name":"bzero","nodeType":"Attribute","startLoc":899,"text":"bzero"},{"attributeType":"ColumnAttribute","col":4,"comment":"null","endLoc":900,"id":1514,"name":"disp","nodeType":"Attribute","startLoc":900,"text":"disp"},{"attributeType":"ColumnAttribute","col":4,"comment":"null","endLoc":901,"id":1515,"name":"start","nodeType":"Attribute","startLoc":901,"text":"start"},{"attributeType":"ColumnAttribute","col":4,"comment":"null","endLoc":902,"id":1516,"name":"dim","nodeType":"Attribute","startLoc":902,"text":"dim"},{"attributeType":"null","col":12,"comment":"null","endLoc":671,"id":1517,"name":"_physical_values","nodeType":"Attribute","startLoc":671,"text":"self._physical_values"},{"attributeType":"ColumnAttribute","col":8,"comment":"null","endLoc":634,"id":1518,"name":"_dims","nodeType":"Attribute","startLoc":634,"text":"self._dims"},{"attributeType":"null","col":8,"comment":"null","endLoc":639,"id":1519,"name":"_pseudo_unsigned_ints","nodeType":"Attribute","startLoc":639,"text":"self._pseudo_unsigned_ints"},{"attributeType":"Delayed | None","col":8,"comment":"null","endLoc":674,"id":1520,"name":"array","nodeType":"Attribute","startLoc":674,"text":"self.array"},{"col":4,"comment":"\n        Attempt an operation that accesses an HDU by index/name\n        that can fail if not all HDUs have been read yet.  Keep\n        reading HDUs until the operation succeeds or there are no\n        more HDUs to read.\n        ","endLoc":1151,"header":"def _try_while_unread_hdus(self, func, *args, **kwargs)","id":1521,"name":"_try_while_unread_hdus","nodeType":"Function","startLoc":1136,"text":"def _try_while_unread_hdus(self, func, *args, **kwargs):\n        \"\"\"\n        Attempt an operation that accesses an HDU by index/name\n        that can fail if not all HDUs have been read yet.  Keep\n        reading HDUs until the operation succeeds or there are no\n        more HDUs to read.\n        \"\"\"\n\n        while True:\n            try:\n                return func(*args, **kwargs)\n            except Exception:\n                if self._read_next_hdu():\n                    continue\n                else:\n                    raise"},{"col":4,"comment":"\n        Returns `True` if ``item`` is an ``HDU`` _in_ ``self`` or a valid\n        extension specification (e.g., integer extension number, extension\n        name, or a tuple of extension name and an extension version)\n        of a ``HDU`` in ``self``.\n\n        ","endLoc":345,"header":"def __contains__(self, item)","id":1522,"name":"__contains__","nodeType":"Function","startLoc":332,"text":"def __contains__(self, item):\n        \"\"\"\n        Returns `True` if ``item`` is an ``HDU`` _in_ ``self`` or a valid\n        extension specification (e.g., integer extension number, extension\n        name, or a tuple of extension name and an extension version)\n        of a ``HDU`` in ``self``.\n\n        \"\"\"\n        try:\n            self._try_while_unread_hdus(self.index_of, item)\n        except (KeyError, ValueError):\n            return False\n\n        return True"},{"col":0,"comment":"Test whether the items in value can have arbitrary units\n\n    Numbers whose value does not change upon a unit change, i.e.,\n    zero, infinity, or not-a-number\n\n    Parameters\n    ----------\n    value : number or array\n\n    Returns\n    -------\n    bool\n        `True` if each member is either zero or not finite, `False` otherwise\n    ","endLoc":130,"header":"def can_have_arbitrary_unit(value)","id":1523,"name":"can_have_arbitrary_unit","nodeType":"Function","startLoc":115,"text":"def can_have_arbitrary_unit(value):\n    \"\"\"Test whether the items in value can have arbitrary units\n\n    Numbers whose value does not change upon a unit change, i.e.,\n    zero, infinity, or not-a-number\n\n    Parameters\n    ----------\n    value : number or array\n\n    Returns\n    -------\n    bool\n        `True` if each member is either zero or not finite, `False` otherwise\n    \"\"\"\n    return np.all(np.logical_or(np.equal(value, 0.), ~np.isfinite(value)))"},{"col":4,"comment":"\n        Set an HDU to the `HDUList`, indexed by number or name.\n        ","endLoc":369,"header":"def __setitem__(self, key, hdu)","id":1524,"name":"__setitem__","nodeType":"Function","startLoc":347,"text":"def __setitem__(self, key, hdu):\n        \"\"\"\n        Set an HDU to the `HDUList`, indexed by number or name.\n        \"\"\"\n\n        _key = self._positive_index_of(key)\n        if isinstance(hdu, (slice, list)):\n            if _is_int(_key):\n                raise ValueError('An element in the HDUList must be an HDU.')\n            for item in hdu:\n                if not isinstance(item, _BaseHDU):\n                    raise ValueError(f'{item} is not an HDU.')\n        else:\n            if not isinstance(hdu, _BaseHDU):\n                raise ValueError(f'{hdu} is not an HDU.')\n\n        try:\n            self._try_while_unread_hdus(super().__setitem__, _key, hdu)\n        except IndexError:\n            raise IndexError(f'Extension {key} is out of bound or not found.')\n\n        self._resize = True\n        self._truncate = False"},{"col":4,"comment":"\n        Parameters\n        ----------\n        input : array or FITS_rec instance\n            input data, either the group data itself (a\n            `numpy.ndarray`) or a record array (`FITS_rec`) which will\n            contain both group parameter info and the data.  The rest\n            of the arguments are used only for the first case.\n\n        bitpix : int\n            data type as expressed in FITS ``BITPIX`` value (8, 16, 32,\n            64, -32, or -64)\n\n        pardata : sequence of array\n            parameter data, as a list of (numeric) arrays.\n\n        parnames : sequence of str\n            list of parameter names.\n\n        bscale : int\n            ``BSCALE`` of the data\n\n        bzero : int\n            ``BZERO`` of the data\n\n        parbscales : sequence of int\n            list of bscales for the parameters\n\n        parbzeros : sequence of int\n            list of bzeros for the parameters\n        ","endLoc":202,"header":"def __new__(cls, input=None, bitpix=None, pardata=None, parnames=[],\n                bscale=None, bzero=None, parbscales=None, parbzeros=None)","id":1525,"name":"__new__","nodeType":"Function","startLoc":97,"text":"def __new__(cls, input=None, bitpix=None, pardata=None, parnames=[],\n                bscale=None, bzero=None, parbscales=None, parbzeros=None):\n        \"\"\"\n        Parameters\n        ----------\n        input : array or FITS_rec instance\n            input data, either the group data itself (a\n            `numpy.ndarray`) or a record array (`FITS_rec`) which will\n            contain both group parameter info and the data.  The rest\n            of the arguments are used only for the first case.\n\n        bitpix : int\n            data type as expressed in FITS ``BITPIX`` value (8, 16, 32,\n            64, -32, or -64)\n\n        pardata : sequence of array\n            parameter data, as a list of (numeric) arrays.\n\n        parnames : sequence of str\n            list of parameter names.\n\n        bscale : int\n            ``BSCALE`` of the data\n\n        bzero : int\n            ``BZERO`` of the data\n\n        parbscales : sequence of int\n            list of bscales for the parameters\n\n        parbzeros : sequence of int\n            list of bzeros for the parameters\n        \"\"\"\n\n        if not isinstance(input, FITS_rec):\n            if pardata is None:\n                npars = 0\n            else:\n                npars = len(pardata)\n\n            if parbscales is None:\n                parbscales = [None] * npars\n            if parbzeros is None:\n                parbzeros = [None] * npars\n\n            if parnames is None:\n                parnames = [f'PAR{idx + 1}' for idx in range(npars)]\n\n            if len(parnames) != npars:\n                raise ValueError('The number of parameter data arrays does '\n                                 'not match the number of parameters.')\n\n            unique_parnames = _unique_parnames(parnames + ['DATA'])\n\n            if bitpix is None:\n                bitpix = DTYPE2BITPIX[input.dtype.name]\n\n            fits_fmt = GroupsHDU._bitpix2tform[bitpix]  # -32 -> 'E'\n            format = FITS2NUMPY[fits_fmt]  # 'E' -> 'f4'\n            data_fmt = f'{str(input.shape[1:])}{format}'\n            formats = ','.join(([format] * npars) + [data_fmt])\n            gcount = input.shape[0]\n\n            cols = [Column(name=unique_parnames[idx], format=fits_fmt,\n                           bscale=parbscales[idx], bzero=parbzeros[idx])\n                    for idx in range(npars)]\n            cols.append(Column(name=unique_parnames[-1], format=fits_fmt,\n                               bscale=bscale, bzero=bzero))\n\n            coldefs = ColDefs(cols)\n\n            self = FITS_rec.__new__(cls,\n                                    np.rec.array(None,\n                                                 formats=formats,\n                                                 names=coldefs.names,\n                                                 shape=gcount))\n\n            # By default the data field will just be 'DATA', but it may be\n            # uniquified if 'DATA' is already used by one of the group names\n            self._data_field = unique_parnames[-1]\n\n            self._coldefs = coldefs\n            self.parnames = parnames\n\n            for idx, name in enumerate(unique_parnames[:-1]):\n                column = coldefs[idx]\n                # Note: _get_scale_factors is used here and in other cases\n                # below to determine whether the column has non-default\n                # scale/zero factors.\n                # TODO: Find a better way to do this than using this interface\n                scale, zero = self._get_scale_factors(column)[3:5]\n                if scale or zero:\n                    self._cache_field(name, pardata[idx])\n                else:\n                    np.rec.recarray.field(self, idx)[:] = pardata[idx]\n\n            column = coldefs[self._data_field]\n            scale, zero = self._get_scale_factors(column)[3:5]\n            if scale or zero:\n                self._cache_field(self._data_field, input)\n            else:\n                np.rec.recarray.field(self, npars)[:] = input\n        else:\n            self = FITS_rec.__new__(cls, input)\n            self.parnames = None\n        return self"},{"col":4,"comment":"\n        Delete an HDU from the `HDUList`, indexed by number or name.\n        ","endLoc":388,"header":"def __delitem__(self, key)","id":1526,"name":"__delitem__","nodeType":"Function","startLoc":371,"text":"def __delitem__(self, key):\n        \"\"\"\n        Delete an HDU from the `HDUList`, indexed by number or name.\n        \"\"\"\n\n        if isinstance(key, slice):\n            end_index = len(self)\n        else:\n            key = self._positive_index_of(key)\n            end_index = len(self) - 1\n\n        self._try_while_unread_hdus(super().__delitem__, key)\n\n        if (key == end_index or key == -1 and not self._resize):\n            self._truncate = True\n        else:\n            self._truncate = False\n            self._resize = True"},{"col":0,"comment":"\n    Given a list of parnames, including possible duplicates, returns a new list\n    of parnames with duplicates prepended by one or more underscores to make\n    them unique.  This is also case insensitive.\n    ","endLoc":625,"header":"def _unique_parnames(names)","id":1527,"name":"_unique_parnames","nodeType":"Function","startLoc":606,"text":"def _unique_parnames(names):\n    \"\"\"\n    Given a list of parnames, including possible duplicates, returns a new list\n    of parnames with duplicates prepended by one or more underscores to make\n    them unique.  This is also case insensitive.\n    \"\"\"\n\n    upper_names = set()\n    unique_names = []\n\n    for name in names:\n        name_upper = name.upper()\n        while name_upper in upper_names:\n            name = '_' + name\n            name_upper = '_' + name_upper\n\n        unique_names.append(name)\n        upper_names.add(name_upper)\n\n    return unique_names"},{"col":4,"comment":"null","endLoc":392,"header":"def __enter__(self)","id":1528,"name":"__enter__","nodeType":"Function","startLoc":391,"text":"def __enter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":396,"header":"def __exit__(self, type, value, traceback)","id":1529,"name":"__exit__","nodeType":"Function","startLoc":394,"text":"def __exit__(self, type, value, traceback):\n        output_verify = self._open_kwargs.get('output_verify', 'exception')\n        self.close(output_verify=output_verify)"},{"col":0,"comment":"Array-interface compliant full description of a column.\n\n    This returns a 3-tuple (name, type, shape) that can always be\n    used in a structured array dtype definition.\n    ","endLoc":174,"header":"def descr(col)","id":1530,"name":"descr","nodeType":"Function","startLoc":166,"text":"def descr(col):\n    \"\"\"Array-interface compliant full description of a column.\n\n    This returns a 3-tuple (name, type, shape) that can always be\n    used in a structured array dtype definition.\n    \"\"\"\n    col_dtype = 'O' if (col.info.dtype is None) else col.info.dtype\n    col_shape = col.shape[1:] if hasattr(col, 'shape') else ()\n    return (col.info.name, col_dtype, col_shape)"},{"col":0,"comment":"Check that function output can be stored in the output array given.\n\n    Parameters\n    ----------\n    output : array or `~astropy.units.Quantity` or tuple\n        Array that should hold the function output (or tuple of such arrays).\n    unit : `~astropy.units.Unit` or None, or tuple\n        Unit that the output will have, or `None` for pure numbers (should be\n        tuple of same if output is a tuple of outputs).\n    inputs : tuple\n        Any input arguments.  These should be castable to the output.\n    function : callable\n        The function that will be producing the output.  If given, used to\n        give a more informative error message.\n\n    Returns\n    -------\n    arrays : ndarray view or tuple thereof\n        The view(s) is of ``output``.\n\n    Raises\n    ------\n    UnitTypeError : If ``unit`` is inconsistent with the class of ``output``\n\n    TypeError : If the ``inputs`` cannot be cast safely to ``output``.\n    ","endLoc":363,"header":"def check_output(output, unit, inputs, function=None)","id":1531,"name":"check_output","nodeType":"Function","startLoc":283,"text":"def check_output(output, unit, inputs, function=None):\n    \"\"\"Check that function output can be stored in the output array given.\n\n    Parameters\n    ----------\n    output : array or `~astropy.units.Quantity` or tuple\n        Array that should hold the function output (or tuple of such arrays).\n    unit : `~astropy.units.Unit` or None, or tuple\n        Unit that the output will have, or `None` for pure numbers (should be\n        tuple of same if output is a tuple of outputs).\n    inputs : tuple\n        Any input arguments.  These should be castable to the output.\n    function : callable\n        The function that will be producing the output.  If given, used to\n        give a more informative error message.\n\n    Returns\n    -------\n    arrays : ndarray view or tuple thereof\n        The view(s) is of ``output``.\n\n    Raises\n    ------\n    UnitTypeError : If ``unit`` is inconsistent with the class of ``output``\n\n    TypeError : If the ``inputs`` cannot be cast safely to ``output``.\n    \"\"\"\n    if isinstance(output, tuple):\n        return tuple(check_output(output_, unit_, inputs, function)\n                     for output_, unit_ in zip(output, unit))\n\n    # ``None`` indicates no actual array is needed.  This can happen, e.g.,\n    # with np.modf(a, out=(None, b)).\n    if output is None:\n        return None\n\n    if hasattr(output, '__quantity_subclass__'):\n        # Check that we're not trying to store a plain Numpy array or a\n        # Quantity with an inconsistent unit (e.g., not angular for Angle).\n        if unit is None:\n            raise TypeError(\"Cannot store non-quantity output{} in {} \"\n                            \"instance\".format(\n                                (f\" from {function.__name__} function\"\n                                 if function is not None else \"\"),\n                                type(output)))\n\n        q_cls, subok = output.__quantity_subclass__(unit)\n        if not (subok or q_cls is type(output)):\n            raise UnitTypeError(\n                \"Cannot store output with unit '{}'{} \"\n                \"in {} instance.  Use {} instance instead.\"\n                .format(unit, (f\" from {function.__name__} function\"\n                               if function is not None else \"\"),\n                        type(output), q_cls))\n\n        # check we can handle the dtype (e.g., that we are not int\n        # when float is required).  Note that we only do this for Quantity\n        # output; for array output, we defer to numpy's default handling.\n        # Also, any structured dtype are ignored (likely erfa ufuncs).\n        # TODO: make more logical; is this necessary at all?\n        if inputs and not output.dtype.names:\n            result_type = np.result_type(*inputs)\n            if not (result_type.names\n                    or np.can_cast(result_type, output.dtype,\n                                   casting='same_kind')):\n                raise TypeError(\"Arguments cannot be cast safely to inplace \"\n                                \"output with dtype={}\".format(output.dtype))\n        # Turn into ndarray, so we do not loop into array_wrap/array_ufunc\n        # if the output is used to store results of a function.\n        return output.view(np.ndarray)\n\n    else:\n        # output is not a Quantity, so cannot obtain a unit.\n        if not (unit is None or unit is dimensionless_unscaled):\n            raise UnitTypeError(\"Cannot store quantity with dimension \"\n                                \"{}in a non-Quantity instance.\"\n                                .format(\"\" if function is None else\n                                        \"resulting from {} function \"\n                                        .format(function.__name__)))\n\n        return output"},{"col":0,"comment":"Check if the object's info is an instance of cls.","endLoc":182,"header":"def has_info_class(obj, cls)","id":1532,"name":"has_info_class","nodeType":"Function","startLoc":177,"text":"def has_info_class(obj, cls):\n    \"\"\"Check if the object's info is an instance of cls.\"\"\"\n    # We check info on the class of the instance, since on the instance\n    # itself accessing 'info' has side effects in that it sets\n    # obj.__dict__['info'] if it does not exist already.\n    return isinstance(getattr(obj.__class__, 'info', None), cls)"},{"col":4,"comment":"null","endLoc":853,"header":"def __init__(self, data=None, masked=False, names=None, dtype=None,\n                 meta=None, copy=True, rows=None, copy_indices=True,\n                 units=None, descriptions=None,\n                 **kwargs)","id":1533,"name":"__init__","nodeType":"Function","startLoc":659,"text":"def __init__(self, data=None, masked=False, names=None, dtype=None,\n                 meta=None, copy=True, rows=None, copy_indices=True,\n                 units=None, descriptions=None,\n                 **kwargs):\n\n        # Set up a placeholder empty table\n        self._set_masked(masked)\n        self.columns = self.TableColumns()\n        self.formatter = self.TableFormatter()\n        self._copy_indices = True  # copy indices from this Table by default\n        self._init_indices = copy_indices  # whether to copy indices in init\n        self.primary_key = None\n\n        # Must copy if dtype are changing\n        if not copy and dtype is not None:\n            raise ValueError('Cannot specify dtype when copy=False')\n\n        # Specifies list of names found for the case of initializing table with\n        # a list of dict. If data are not list of dict then this is None.\n        names_from_list_of_dict = None\n\n        # Row-oriented input, e.g. list of lists or list of tuples, list of\n        # dict, Row instance.  Set data to something that the subsequent code\n        # will parse correctly.\n        if rows is not None:\n            if data is not None:\n                raise ValueError('Cannot supply both `data` and `rows` values')\n            if isinstance(rows, types.GeneratorType):\n                # Without this then the all(..) test below uses up the generator\n                rows = list(rows)\n\n            # Get column names if `rows` is a list of dict, otherwise this is None\n            names_from_list_of_dict = _get_names_from_list_of_dict(rows)\n            if names_from_list_of_dict:\n                data = rows\n            elif isinstance(rows, self.Row):\n                data = rows\n            else:\n                data = list(zip(*rows))\n\n        # Infer the type of the input data and set up the initialization\n        # function, number of columns, and potentially the default col names\n\n        default_names = None\n\n        # Handle custom (subclass) table attributes that are stored in meta.\n        # These are defined as class attributes using the TableAttribute\n        # descriptor.  Any such attributes get removed from kwargs here and\n        # stored for use after the table is otherwise initialized. Any values\n        # provided via kwargs will have precedence over existing values from\n        # meta (e.g. from data as a Table or meta via kwargs).\n        meta_table_attrs = {}\n        if kwargs:\n            for attr in list(kwargs):\n                descr = getattr(self.__class__, attr, None)\n                if isinstance(descr, TableAttribute):\n                    meta_table_attrs[attr] = kwargs.pop(attr)\n\n        if hasattr(data, '__astropy_table__'):\n            # Data object implements the __astropy_table__ interface method.\n            # Calling that method returns an appropriate instance of\n            # self.__class__ and respects the `copy` arg.  The returned\n            # Table object should NOT then be copied.\n            data = data.__astropy_table__(self.__class__, copy, **kwargs)\n            copy = False\n        elif kwargs:\n            raise TypeError('__init__() got unexpected keyword argument {!r}'\n                            .format(list(kwargs.keys())[0]))\n\n        if (isinstance(data, np.ndarray)\n                and data.shape == (0,)\n                and not data.dtype.names):\n            data = None\n\n        if isinstance(data, self.Row):\n            data = data._table[data._index:data._index + 1]\n\n        if isinstance(data, (list, tuple)):\n            # Get column names from `data` if it is a list of dict, otherwise this is None.\n            # This might be previously defined if `rows` was supplied as an init arg.\n            names_from_list_of_dict = (names_from_list_of_dict\n                                       or _get_names_from_list_of_dict(data))\n            if names_from_list_of_dict:\n                init_func = self._init_from_list_of_dicts\n                n_cols = len(names_from_list_of_dict)\n            else:\n                init_func = self._init_from_list\n                n_cols = len(data)\n\n        elif isinstance(data, np.ndarray):\n            if data.dtype.names:\n                init_func = self._init_from_ndarray  # _struct\n                n_cols = len(data.dtype.names)\n                default_names = data.dtype.names\n            else:\n                init_func = self._init_from_ndarray  # _homog\n                if data.shape == ():\n                    raise ValueError('Can not initialize a Table with a scalar')\n                elif len(data.shape) == 1:\n                    data = data[np.newaxis, :]\n                n_cols = data.shape[1]\n\n        elif isinstance(data, Mapping):\n            init_func = self._init_from_dict\n            default_names = list(data)\n            n_cols = len(default_names)\n\n        elif isinstance(data, Table):\n            # If user-input meta is None then use data.meta (if non-trivial)\n            if meta is None and data.meta:\n                # At this point do NOT deepcopy data.meta as this will happen after\n                # table init_func() is called.  But for table input the table meta\n                # gets a key copy here if copy=False because later a direct object ref\n                # is used.\n                meta = data.meta if copy else data.meta.copy()\n\n            # Handle indices on input table. Copy primary key and don't copy indices\n            # if the input Table is in non-copy mode.\n            self.primary_key = data.primary_key\n            self._init_indices = self._init_indices and data._copy_indices\n\n            # Extract default names, n_cols, and then overwrite ``data`` to be the\n            # table columns so we can use _init_from_list.\n            default_names = data.colnames\n            n_cols = len(default_names)\n            data = list(data.columns.values())\n\n            init_func = self._init_from_list\n\n        elif data is None:\n            if names is None:\n                if dtype is None:\n                    # Table was initialized as `t = Table()`. Set up for empty\n                    # table with names=[], data=[], and n_cols=0.\n                    # self._init_from_list() will simply return, giving the\n                    # expected empty table.\n                    names = []\n                else:\n                    try:\n                        # No data nor names but dtype is available.  This must be\n                        # valid to initialize a structured array.\n                        dtype = np.dtype(dtype)\n                        names = dtype.names\n                        dtype = [dtype[name] for name in names]\n                    except Exception:\n                        raise ValueError('dtype was specified but could not be '\n                                         'parsed for column names')\n            # names is guaranteed to be set at this point\n            init_func = self._init_from_list\n            n_cols = len(names)\n            data = [[]] * n_cols\n\n        else:\n            raise ValueError(f'Data type {type(data)} not allowed to init Table')\n\n        # Set up defaults if names and/or dtype are not specified.\n        # A value of None means the actual value will be inferred\n        # within the appropriate initialization routine, either from\n        # existing specification or auto-generated.\n\n        if dtype is None:\n            dtype = [None] * n_cols\n        elif isinstance(dtype, np.dtype):\n            if default_names is None:\n                default_names = dtype.names\n            # Convert a numpy dtype input to a list of dtypes for later use.\n            dtype = [dtype[name] for name in dtype.names]\n\n        if names is None:\n            names = default_names or [None] * n_cols\n\n        names = [None if name is None else str(name) for name in names]\n\n        self._check_names_dtype(names, dtype, n_cols)\n\n        # Finally do the real initialization\n        init_func(data, names, dtype, n_cols, copy)\n\n        # Set table meta.  If copy=True then deepcopy meta otherwise use the\n        # user-supplied meta directly.\n        if meta is not None:\n            self.meta = deepcopy(meta) if copy else meta\n\n        # Update meta with TableAttributes supplied as kwargs in Table init.\n        # This takes precedence over previously-defined meta.\n        if meta_table_attrs:\n            for attr, value in meta_table_attrs.items():\n                setattr(self, attr, value)\n\n        # Whatever happens above, the masked property should be set to a boolean\n        if self.masked not in (None, True, False):\n            raise TypeError(\"masked property must be None, True or False\")\n\n        self._set_column_attribute('unit', units)\n        self._set_column_attribute('description', descriptions)"},{"col":4,"comment":"\n        Close the associated FITS file and memmap object, if any.\n\n        Parameters\n        ----------\n        output_verify : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        verbose : bool\n            When `True`, print out verbose messages.\n\n        closed : bool\n            When `True`, close the underlying file object.\n        ","endLoc":983,"header":"def close(self, output_verify='exception', verbose=False, closed=True)","id":1534,"name":"close","nodeType":"Function","startLoc":953,"text":"def close(self, output_verify='exception', verbose=False, closed=True):\n        \"\"\"\n        Close the associated FITS file and memmap object, if any.\n\n        Parameters\n        ----------\n        output_verify : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        verbose : bool\n            When `True`, print out verbose messages.\n\n        closed : bool\n            When `True`, close the underlying file object.\n        \"\"\"\n\n        try:\n            if (self._file and self._file.mode in ('append', 'update')\n                    and not self._file.closed):\n                self.flush(output_verify=output_verify, verbose=verbose)\n        finally:\n            if self._file and closed and hasattr(self._file, 'close'):\n                self._file.close()\n\n            # Give individual HDUs an opportunity to do on-close cleanup\n            for hdu in self:\n                hdu._close(closed=closed)"},{"col":4,"comment":"Turn result into a quantity with the given unit.\n\n        If no output is given, it will take a view of the array as a quantity,\n        and set the unit.  If output is given, those should be quantity views\n        of the result arrays, and the function will just set the unit.\n\n        Parameters\n        ----------\n        result : ndarray or tuple thereof\n            Array(s) which need to be turned into quantity.\n        unit : `~astropy.units.Unit`\n            Unit for the quantities to be returned (or `None` if the result\n            should not be a quantity).  Should be tuple if result is a tuple.\n        out : `~astropy.units.Quantity` or None\n            Possible output quantity. Should be `None` or a tuple if result\n            is a tuple.\n\n        Returns\n        -------\n        out : `~astropy.units.Quantity`\n           With units set.\n        ","endLoc":661,"header":"def _result_as_quantity(self, result, unit, out)","id":1535,"name":"_result_as_quantity","nodeType":"Function","startLoc":622,"text":"def _result_as_quantity(self, result, unit, out):\n        \"\"\"Turn result into a quantity with the given unit.\n\n        If no output is given, it will take a view of the array as a quantity,\n        and set the unit.  If output is given, those should be quantity views\n        of the result arrays, and the function will just set the unit.\n\n        Parameters\n        ----------\n        result : ndarray or tuple thereof\n            Array(s) which need to be turned into quantity.\n        unit : `~astropy.units.Unit`\n            Unit for the quantities to be returned (or `None` if the result\n            should not be a quantity).  Should be tuple if result is a tuple.\n        out : `~astropy.units.Quantity` or None\n            Possible output quantity. Should be `None` or a tuple if result\n            is a tuple.\n\n        Returns\n        -------\n        out : `~astropy.units.Quantity`\n           With units set.\n        \"\"\"\n        if isinstance(result, (tuple, list)):\n            if out is None:\n                out = (None,) * len(result)\n            return result.__class__(\n                self._result_as_quantity(result_, unit_, out_)\n                for (result_, unit_, out_) in\n                zip(result, unit, out))\n\n        if out is None:\n            # View the result array as a Quantity with the proper unit.\n            return result if unit is None else self._new_view(result, unit)\n\n        # For given output, just set the unit. We know the unit is not None and\n        # the output is of the correct Quantity subclass, as it was passed\n        # through check_output.\n        out._set_unit(unit)\n        return out"},{"col":4,"comment":"\n        Force a write of the `HDUList` back to the file (for append and\n        update modes only).\n\n        Parameters\n        ----------\n        output_verify : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        verbose : bool\n            When `True`, print verbose messages\n        ","endLoc":859,"header":"@ignore_sigint\n    def flush(self, output_verify='fix', verbose=False)","id":1536,"name":"flush","nodeType":"Function","startLoc":795,"text":"@ignore_sigint\n    def flush(self, output_verify='fix', verbose=False):\n        \"\"\"\n        Force a write of the `HDUList` back to the file (for append and\n        update modes only).\n\n        Parameters\n        ----------\n        output_verify : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        verbose : bool\n            When `True`, print verbose messages\n        \"\"\"\n\n        if self._file.mode not in ('append', 'update', 'ostream'):\n            warnings.warn(\"Flush for '{}' mode is not supported.\"\n                          .format(self._file.mode), AstropyUserWarning)\n            return\n\n        save_backup = self._open_kwargs.get('save_backup', False)\n        if save_backup and self._file.mode in ('append', 'update'):\n            filename = self._file.name\n            if os.path.exists(filename):\n                # The the file doesn't actually exist anymore for some reason\n                # then there's no point in trying to make a backup\n                backup = filename + '.bak'\n                idx = 1\n                while os.path.exists(backup):\n                    backup = filename + '.bak.' + str(idx)\n                    idx += 1\n                warnings.warn('Saving a backup of {} to {}.'.format(\n                        filename, backup), AstropyUserWarning)\n                try:\n                    shutil.copy(filename, backup)\n                except OSError as exc:\n                    raise OSError('Failed to save backup to destination {}: '\n                                  '{}'.format(filename, exc))\n\n        self.verify(option=output_verify)\n\n        if self._file.mode in ('append', 'ostream'):\n            for hdu in self:\n                if verbose:\n                    try:\n                        extver = str(hdu._header['extver'])\n                    except KeyError:\n                        extver = ''\n\n                # only append HDU's which are \"new\"\n                if hdu._new:\n                    hdu._prewriteto(checksum=hdu._output_checksum)\n                    with _free_space_check(self):\n                        hdu._writeto(self._file)\n                        if verbose:\n                            print('append HDU', hdu.name, extver)\n                        hdu._new = False\n                    hdu._postwriteto()\n\n        elif self._file.mode == 'update':\n            self._flush_update()"},{"col":4,"comment":"\n        Set the table masked property.\n\n        Parameters\n        ----------\n        masked : bool\n            State of table masking (`True` or `False`)\n        ","endLoc":2005,"header":"def _set_masked(self, masked)","id":1537,"name":"_set_masked","nodeType":"Function","startLoc":1991,"text":"def _set_masked(self, masked):\n        \"\"\"\n        Set the table masked property.\n\n        Parameters\n        ----------\n        masked : bool\n            State of table masking (`True` or `False`)\n        \"\"\"\n        if masked in [True, False, None]:\n            self._masked = masked\n        else:\n            raise ValueError(\"masked should be one of True, False, None\")\n\n        self._column_class = self.MaskedColumn if self._masked else self.Column"},{"col":4,"comment":"null","endLoc":209,"header":"def __array_finalize__(self, obj)","id":1538,"name":"__array_finalize__","nodeType":"Function","startLoc":204,"text":"def __array_finalize__(self, obj):\n        super().__array_finalize__(obj)\n        if isinstance(obj, GroupData):\n            self.parnames = obj.parnames\n        elif isinstance(obj, FITS_rec):\n            self.parnames = obj._coldefs.names"},{"col":4,"comment":"null","endLoc":215,"header":"def __getitem__(self, key)","id":1539,"name":"__getitem__","nodeType":"Function","startLoc":211,"text":"def __getitem__(self, key):\n        out = super().__getitem__(key)\n        if isinstance(out, GroupData):\n            out.parnames = self.parnames\n        return out"},{"col":4,"comment":"\n        The raw group data represented as a multi-dimensional `numpy.ndarray`\n        array.\n        ","endLoc":225,"header":"@property\n    def data(self)","id":1540,"name":"data","nodeType":"Function","startLoc":217,"text":"@property\n    def data(self):\n        \"\"\"\n        The raw group data represented as a multi-dimensional `numpy.ndarray`\n        array.\n        \"\"\"\n\n        # The last column in the coldefs is the data portion of the group\n        return self.field(self._coldefs.names[-1])"},{"attributeType":"null","col":8,"comment":"null","endLoc":635,"id":1541,"name":"dim","nodeType":"Attribute","startLoc":635,"text":"self.dim"},{"col":4,"comment":"null","endLoc":774,"header":"def __deepcopy__(self, memo)","id":1542,"name":"__deepcopy__","nodeType":"Function","startLoc":771,"text":"def __deepcopy__(self, memo):\n        # If we don't define this, ``copy.deepcopy(quantity)`` will\n        # return a bare Numpy array.\n        return self.copy()"},{"col":4,"comment":"null","endLoc":229,"header":"@lazyproperty\n    def _unique(self)","id":1543,"name":"_unique","nodeType":"Function","startLoc":227,"text":"@lazyproperty\n    def _unique(self):\n        return _par_indices(self.parnames)"},{"col":4,"comment":"null","endLoc":782,"header":"def __reduce__(self)","id":1544,"name":"__reduce__","nodeType":"Function","startLoc":776,"text":"def __reduce__(self):\n        # patch to pickle Quantity objects (ndarray subclasses), see\n        # http://www.mail-archive.com/numpy-discussion@scipy.org/msg02446.html\n\n        object_state = list(super().__reduce__())\n        object_state[2] = (object_state[2], self.__dict__)\n        return tuple(object_state)"},{"col":0,"comment":"Return list of column names if ``rows`` is a list of dict that\n    defines table data.\n\n    If rows is not a list of dict then return None.\n    ","endLoc":199,"header":"def _get_names_from_list_of_dict(rows)","id":1545,"name":"_get_names_from_list_of_dict","nodeType":"Function","startLoc":185,"text":"def _get_names_from_list_of_dict(rows):\n    \"\"\"Return list of column names if ``rows`` is a list of dict that\n    defines table data.\n\n    If rows is not a list of dict then return None.\n    \"\"\"\n    if rows is None:\n        return None\n\n    names = set()\n    for row in rows:\n        if not isinstance(row, Mapping):\n            return None\n        names.update(row)\n    return list(names)"},{"col":4,"comment":"null","endLoc":790,"header":"def __setstate__(self, state)","id":1546,"name":"__setstate__","nodeType":"Function","startLoc":784,"text":"def __setstate__(self, state):\n        # patch to unpickle Quantity objects (ndarray subclasses), see\n        # http://www.mail-archive.com/numpy-discussion@scipy.org/msg02446.html\n\n        nd_state, own_state = state\n        super().__setstate__(nd_state)\n        self.__dict__.update(own_state)"},{"attributeType":"None","col":8,"comment":"null","endLoc":673,"id":1547,"name":"_parent_fits_rec","nodeType":"Attribute","startLoc":673,"text":"self._parent_fits_rec"},{"col":0,"comment":"\n    Given a scalar value or string, returns the minimum FITS column format\n    that can represent that value.  'minimum' is defined by the order given in\n    FORMATORDER.\n    ","endLoc":2307,"header":"def _scalar_to_format(value)","id":1548,"name":"_scalar_to_format","nodeType":"Function","startLoc":2284,"text":"def _scalar_to_format(value):\n    \"\"\"\n    Given a scalar value or string, returns the minimum FITS column format\n    that can represent that value.  'minimum' is defined by the order given in\n    FORMATORDER.\n    \"\"\"\n\n    # First, if value is a string, try to convert to the appropriate scalar\n    # value\n    for type_ in (int, float, complex):\n        try:\n            value = type_(value)\n            break\n        except ValueError:\n            continue\n\n    numpy_dtype_str = np.min_scalar_type(value).str\n    numpy_dtype_str = numpy_dtype_str[1:]  # Strip endianness\n\n    try:\n        fits_format = NUMPY2FITS[numpy_dtype_str]\n        return FITSUPCONVERTERS.get(fits_format, fits_format)\n    except KeyError:\n        return \"A\" + str(len(value))"},{"col":4,"comment":"\n        A `~astropy.units.UnitBase` object representing the unit of this\n        quantity.\n        ","endLoc":921,"header":"@property\n    def unit(self)","id":1549,"name":"unit","nodeType":"Function","startLoc":914,"text":"@property\n    def unit(self):\n        \"\"\"\n        A `~astropy.units.UnitBase` object representing the unit of this\n        quantity.\n        \"\"\"\n\n        return self._unit"},{"col":4,"comment":"\n        A list of equivalencies that will be applied by default during\n        unit conversions.\n        ","endLoc":930,"header":"@property\n    def equivalencies(self)","id":1550,"name":"equivalencies","nodeType":"Function","startLoc":923,"text":"@property\n    def equivalencies(self):\n        \"\"\"\n        A list of equivalencies that will be applied by default during\n        unit conversions.\n        \"\"\"\n\n        return self._equivalencies"},{"col":4,"comment":"Apply function recursively to every field.\n\n        Returns a copy with the result.\n        ","endLoc":946,"header":"def _recursively_apply(self, func)","id":1551,"name":"_recursively_apply","nodeType":"Function","startLoc":932,"text":"def _recursively_apply(self, func):\n        \"\"\"Apply function recursively to every field.\n\n        Returns a copy with the result.\n        \"\"\"\n        result = np.empty_like(self)\n        result_value = result.view(np.ndarray)\n        result_unit = ()\n        for name in self.dtype.names:\n            part = func(self[name])\n            result_value[name] = part.value\n            result_unit += (part.unit,)\n\n        result._set_unit(result_unit)\n        return result"},{"col":0,"comment":"\n    Compares two numpy recformats using the ordering given by FORMATORDER.\n    ","endLoc":2319,"header":"def _cmp_recformats(f1, f2)","id":1552,"name":"_cmp_recformats","nodeType":"Function","startLoc":2310,"text":"def _cmp_recformats(f1, f2):\n    \"\"\"\n    Compares two numpy recformats using the ordering given by FORMATORDER.\n    \"\"\"\n\n    if f1[0] == 'a' and f2[0] == 'a':\n        return cmp(int(f1[1:]), int(f2[1:]))\n    else:\n        f1, f2 = NUMPY2FITS[f1], NUMPY2FITS[f2]\n        return cmp(FORMATORDER.index(f1), FORMATORDER.index(f2))"},{"col":4,"comment":"\n        Returns a copy of the current `Quantity` instance with SI units. The\n        value of the resulting object will be scaled.\n        ","endLoc":958,"header":"@property\n    def si(self)","id":1553,"name":"si","nodeType":"Function","startLoc":948,"text":"@property\n    def si(self):\n        \"\"\"\n        Returns a copy of the current `Quantity` instance with SI units. The\n        value of the resulting object will be scaled.\n        \"\"\"\n        if self.dtype.names:\n            return self._recursively_apply(operator.attrgetter('si'))\n        si_unit = self.unit.si\n        return self._new_view(self.value * si_unit.scale,\n                              si_unit / si_unit.scale)"},{"col":4,"comment":"\n        Returns a copy of the current `Quantity` instance with CGS units. The\n        value of the resulting object will be scaled.\n        ","endLoc":970,"header":"@property\n    def cgs(self)","id":1554,"name":"cgs","nodeType":"Function","startLoc":960,"text":"@property\n    def cgs(self):\n        \"\"\"\n        Returns a copy of the current `Quantity` instance with CGS units. The\n        value of the resulting object will be scaled.\n        \"\"\"\n        if self.dtype.names:\n            return self._recursively_apply(operator.attrgetter('cgs'))\n        cgs_unit = self.unit.cgs\n        return self._new_view(self.value * cgs_unit.scale,\n                              cgs_unit / cgs_unit.scale)"},{"col":4,"comment":"\n        True if the `value` of this quantity is a scalar, or False if it\n        is an array-like object.\n\n        .. note::\n            This is subtly different from `numpy.isscalar` in that\n            `numpy.isscalar` returns False for a zero-dimensional array\n            (e.g. ``np.array(1)``), while this is True for quantities,\n            since quantities cannot represent true numpy scalars.\n        ","endLoc":984,"header":"@property\n    def isscalar(self)","id":1555,"name":"isscalar","nodeType":"Function","startLoc":972,"text":"@property\n    def isscalar(self):\n        \"\"\"\n        True if the `value` of this quantity is a scalar, or False if it\n        is an array-like object.\n\n        .. note::\n            This is subtly different from `numpy.isscalar` in that\n            `numpy.isscalar` returns False for a zero-dimensional array\n            (e.g. ``np.array(1)``), while this is True for quantities,\n            since quantities cannot represent true numpy scalars.\n        \"\"\"\n        return not self.shape"},{"col":4,"comment":"Implements flushing changes to a file in update mode.","endLoc":1311,"header":"def _flush_update(self)","id":1556,"name":"_flush_update","nodeType":"Function","startLoc":1286,"text":"def _flush_update(self):\n        \"\"\"Implements flushing changes to a file in update mode.\"\"\"\n\n        for hdu in self:\n            # Need to all _prewriteto() for each HDU first to determine if\n            # resizing will be necessary\n            hdu._prewriteto(checksum=hdu._output_checksum, inplace=True)\n\n        try:\n            self._wasresized()\n\n            # if the HDUList is resized, need to write out the entire contents of\n            # the hdulist to the file.\n            if self._resize or self._file.compression:\n                self._flush_resize()\n            else:\n                # if not resized, update in place\n                for hdu in self:\n                    hdu._writeto(self._file, inplace=True)\n\n            # reset the modification attributes after updating\n            for hdu in self:\n                hdu._header._modified = False\n        finally:\n            for hdu in self:\n                hdu._postwriteto()"},{"col":4,"comment":"\n        Quantities are able to directly convert to other units that\n        have the same physical type.  This function is implemented in\n        order to make autocompletion still work correctly in IPython.\n        ","endLoc":1006,"header":"@override__dir__\n    def __dir__(self)","id":1557,"name":"__dir__","nodeType":"Function","startLoc":992,"text":"@override__dir__\n    def __dir__(self):\n        \"\"\"\n        Quantities are able to directly convert to other units that\n        have the same physical type.  This function is implemented in\n        order to make autocompletion still work correctly in IPython.\n        \"\"\"\n        if not self._include_easy_conversion_members:\n            return []\n        extra_members = set()\n        equivalencies = Unit._normalize_equivalencies(self.equivalencies)\n        for equivalent in self.unit._get_units_with_same_physical_type(\n                equivalencies):\n            extra_members.update(equivalent.names)\n        return extra_members"},{"col":0,"comment":"\n    Given a list of objects, returns a mapping of objects in that list to the\n    index or indices at which that object was found in the list.\n    ","endLoc":603,"header":"def _par_indices(names)","id":1558,"name":"_par_indices","nodeType":"Function","startLoc":589,"text":"def _par_indices(names):\n    \"\"\"\n    Given a list of objects, returns a mapping of objects in that list to the\n    index or indices at which that object was found in the list.\n    \"\"\"\n\n    unique = {}\n    for idx, name in enumerate(names):\n        # Case insensitive\n        name = name.upper()\n        if name in unique:\n            unique[name].append(idx)\n        else:\n            unique[name] = [idx]\n    return unique"},{"col":4,"comment":"\n        Get the group parameter values.\n        ","endLoc":249,"header":"def par(self, parname)","id":1559,"name":"par","nodeType":"Function","startLoc":231,"text":"def par(self, parname):\n        \"\"\"\n        Get the group parameter values.\n        \"\"\"\n\n        if _is_int(parname):\n            result = self.field(parname)\n        else:\n            indx = self._unique[parname.upper()]\n            if len(indx) == 1:\n                result = self.field(indx[0])\n\n            # if more than one group parameter have the same name\n            else:\n                result = self.field(indx[0]).astype('f8')\n                for i in indx[1:]:\n                    result += self.field(i)\n\n        return result"},{"col":4,"comment":"\n        Determine if any changes to the HDUList will require a file resize\n        when flushing the file.\n\n        Side effect of setting the objects _resize attribute.\n        ","endLoc":1469,"header":"def _wasresized(self, verbose=False)","id":1560,"name":"_wasresized","nodeType":"Function","startLoc":1428,"text":"def _wasresized(self, verbose=False):\n        \"\"\"\n        Determine if any changes to the HDUList will require a file resize\n        when flushing the file.\n\n        Side effect of setting the objects _resize attribute.\n        \"\"\"\n\n        if not self._resize:\n\n            # determine if any of the HDU is resized\n            for hdu in self:\n                # Header:\n                nbytes = len(str(hdu._header))\n                if nbytes != (hdu._data_offset - hdu._header_offset):\n                    self._resize = True\n                    self._truncate = False\n                    if verbose:\n                        print('One or more header is resized.')\n                    break\n\n                # Data:\n                if not hdu._has_data:\n                    continue\n\n                nbytes = hdu.size\n                nbytes = nbytes + _pad_length(nbytes)\n                if nbytes != hdu._data_size:\n                    self._resize = True\n                    self._truncate = False\n                    if verbose:\n                        print('One or more data area is resized.')\n                    break\n\n            if self._truncate:\n                try:\n                    self._file.truncate(hdu._data_offset + hdu._data_size)\n                except OSError:\n                    self._resize = True\n                self._truncate = False\n\n        return self._resize"},{"col":4,"comment":"\n        Normalizes equivalencies, ensuring each is a 4-tuple of the form::\n\n        (from_unit, to_unit, forward_func, backward_func)\n\n        Parameters\n        ----------\n        equivalencies : list of equivalency pairs, or None\n\n        Returns\n        -------\n        A normalized list, including possible global defaults set by, e.g.,\n        `set_enabled_equivalencies`, except when `equivalencies`=`None`,\n        in which case the returned list is always empty.\n\n        Raises\n        ------\n        ValueError if an equivalency cannot be interpreted\n        ","endLoc":774,"header":"@staticmethod\n    def _normalize_equivalencies(equivalencies)","id":1561,"name":"_normalize_equivalencies","nodeType":"Function","startLoc":749,"text":"@staticmethod\n    def _normalize_equivalencies(equivalencies):\n        \"\"\"\n        Normalizes equivalencies, ensuring each is a 4-tuple of the form::\n\n        (from_unit, to_unit, forward_func, backward_func)\n\n        Parameters\n        ----------\n        equivalencies : list of equivalency pairs, or None\n\n        Returns\n        -------\n        A normalized list, including possible global defaults set by, e.g.,\n        `set_enabled_equivalencies`, except when `equivalencies`=`None`,\n        in which case the returned list is always empty.\n\n        Raises\n        ------\n        ValueError if an equivalency cannot be interpreted\n        \"\"\"\n        normalized = _normalize_equivalencies(equivalencies)\n        if equivalencies is not None:\n            normalized += get_current_unit_registry().equivalencies\n\n        return normalized"},{"col":0,"comment":"\n    Normalizes equivalencies, ensuring each is a 4-tuple of the form::\n\n    (from_unit, to_unit, forward_func, backward_func)\n\n    Parameters\n    ----------\n    equivalencies : list of equivalency pairs\n\n    Raises\n    ------\n    ValueError if an equivalency cannot be interpreted\n    ","endLoc":104,"header":"def _normalize_equivalencies(equivalencies)","id":1562,"name":"_normalize_equivalencies","nodeType":"Function","startLoc":65,"text":"def _normalize_equivalencies(equivalencies):\n    \"\"\"\n    Normalizes equivalencies, ensuring each is a 4-tuple of the form::\n\n    (from_unit, to_unit, forward_func, backward_func)\n\n    Parameters\n    ----------\n    equivalencies : list of equivalency pairs\n\n    Raises\n    ------\n    ValueError if an equivalency cannot be interpreted\n    \"\"\"\n    if equivalencies is None:\n        return []\n\n    normalized = []\n\n    for i, equiv in enumerate(equivalencies):\n        if len(equiv) == 2:\n            funit, tunit = equiv\n            a = b = lambda x: x\n        elif len(equiv) == 3:\n            funit, tunit, a = equiv\n            b = a\n        elif len(equiv) == 4:\n            funit, tunit, a, b = equiv\n        else:\n            raise ValueError(\n                f\"Invalid equivalence entry {i}: {equiv!r}\")\n        if not (funit is Unit(funit) and\n                (tunit is None or tunit is Unit(tunit)) and\n                callable(a) and\n                callable(b)):\n            raise ValueError(\n                f\"Invalid equivalence entry {i}: {equiv!r}\")\n        normalized.append((funit, tunit, a, b))\n\n    return normalized"},{"col":20,"endLoc":87,"id":1563,"nodeType":"Lambda","startLoc":87,"text":"lambda x: x"},{"col":4,"comment":"\n        Implements flushing changes in update mode when parts of one or more HDU\n        need to be resized.\n        ","endLoc":1426,"header":"def _flush_resize(self)","id":1564,"name":"_flush_resize","nodeType":"Function","startLoc":1313,"text":"def _flush_resize(self):\n        \"\"\"\n        Implements flushing changes in update mode when parts of one or more HDU\n        need to be resized.\n        \"\"\"\n\n        old_name = self._file.name\n        old_memmap = self._file.memmap\n        name = _tmp_name(old_name)\n\n        if not self._file.file_like:\n            old_mode = os.stat(old_name).st_mode\n            # The underlying file is an actual file object.  The HDUList is\n            # resized, so we need to write it to a tmp file, delete the\n            # original file, and rename the tmp file to the original file.\n            if self._file.compression == 'gzip':\n                new_file = gzip.GzipFile(name, mode='ab+')\n            elif self._file.compression == 'bzip2':\n                if not HAS_BZ2:\n                    raise ModuleNotFoundError(\n                        \"This Python installation does not provide the bz2 module.\")\n                new_file = bz2.BZ2File(name, mode='w')\n            else:\n                new_file = name\n\n            with self.fromfile(new_file, mode='append') as hdulist:\n\n                for hdu in self:\n                    hdu._writeto(hdulist._file, inplace=True, copy=True)\n                if sys.platform.startswith('win'):\n                    # Collect a list of open mmaps to the data; this well be\n                    # used later.  See below.\n                    mmaps = [(idx, _get_array_mmap(hdu.data), hdu.data)\n                             for idx, hdu in enumerate(self) if hdu._has_data]\n\n                hdulist._file.close()\n                self._file.close()\n            if sys.platform.startswith('win'):\n                # Close all open mmaps to the data.  This is only necessary on\n                # Windows, which will not allow a file to be renamed or deleted\n                # until all handles to that file have been closed.\n                for idx, mmap, arr in mmaps:\n                    if mmap is not None:\n                        mmap.close()\n\n            os.remove(self._file.name)\n\n            # reopen the renamed new file with \"update\" mode\n            os.rename(name, old_name)\n            os.chmod(old_name, old_mode)\n\n            if isinstance(new_file, gzip.GzipFile):\n                old_file = gzip.GzipFile(old_name, mode='rb+')\n            else:\n                old_file = old_name\n\n            ffo = _File(old_file, mode='update', memmap=old_memmap)\n\n            self._file = ffo\n\n            for hdu in self:\n                # Need to update the _file attribute and close any open mmaps\n                # on each HDU\n                if hdu._has_data and _get_array_mmap(hdu.data) is not None:\n                    del hdu.data\n                hdu._file = ffo\n\n            if sys.platform.startswith('win'):\n                # On Windows, all the original data mmaps were closed above.\n                # However, it's possible that the user still has references to\n                # the old data which would no longer work (possibly even cause\n                # a segfault if they try to access it).  This replaces the\n                # buffers used by the original arrays with the buffers of mmap\n                # arrays created from the new file.  This seems to work, but\n                # it's a flaming hack and carries no guarantees that it won't\n                # lead to odd behavior in practice.  Better to just not keep\n                # references to data from files that had to be resized upon\n                # flushing (on Windows--again, this is no problem on Linux).\n                for idx, mmap, arr in mmaps:\n                    if mmap is not None:\n                        # https://github.com/numpy/numpy/issues/8628\n                        with warnings.catch_warnings():\n                            warnings.simplefilter('ignore', category=DeprecationWarning)\n                            arr.data = self[idx].data.data\n                del mmaps  # Just to be sure\n\n        else:\n            # The underlying file is not a file object, it is a file like\n            # object.  We can't write out to a file, we must update the file\n            # like object in place.  To do this, we write out to a temporary\n            # file, then delete the contents in our file like object, then\n            # write the contents of the temporary file to the now empty file\n            # like object.\n            self.writeto(name)\n            hdulist = self.fromfile(name)\n            ffo = self._file\n\n            ffo.truncate(0)\n            ffo.seek(0)\n\n            for hdu in hdulist:\n                hdu._writeto(ffo, inplace=True, copy=True)\n\n            # Close the temporary file and delete it.\n            hdulist.close()\n            os.remove(hdulist._file.name)\n\n        # reset the resize attributes after updating\n        self._resize = False\n        self._truncate = False\n        for hdu in self:\n            hdu._header._modified = False\n            hdu._new = False\n            hdu._file = ffo"},{"attributeType":"null","col":4,"comment":"null","endLoc":95,"id":1565,"name":"_record_type","nodeType":"Attribute","startLoc":95,"text":"_record_type"},{"attributeType":"null","col":16,"comment":"null","endLoc":140,"id":1566,"name":"parbzeros","nodeType":"Attribute","startLoc":140,"text":"parbzeros"},{"attributeType":"null","col":16,"comment":"null","endLoc":135,"id":1567,"name":"npars","nodeType":"Attribute","startLoc":135,"text":"npars"},{"attributeType":"null","col":12,"comment":"null","endLoc":158,"id":1568,"name":"gcount","nodeType":"Attribute","startLoc":158,"text":"gcount"},{"attributeType":"null","col":12,"comment":"null","endLoc":201,"id":1569,"name":"parnames","nodeType":"Attribute","startLoc":201,"text":"self.parnames"},{"attributeType":"null","col":12,"comment":"null","endLoc":157,"id":1570,"name":"formats","nodeType":"Attribute","startLoc":157,"text":"formats"},{"attributeType":"null","col":12,"comment":"null","endLoc":155,"id":1571,"name":"format","nodeType":"Attribute","startLoc":155,"text":"format"},{"attributeType":"null","col":12,"comment":"null","endLoc":176,"id":1572,"name":"_data_field","nodeType":"Attribute","startLoc":176,"text":"self._data_field"},{"attributeType":"null","col":12,"comment":"null","endLoc":193,"id":1573,"name":"column","nodeType":"Attribute","startLoc":193,"text":"column"},{"attributeType":"null","col":12,"comment":"null","endLoc":154,"id":1574,"name":"fits_fmt","nodeType":"Attribute","startLoc":154,"text":"fits_fmt"},{"attributeType":"null","col":12,"comment":"null","endLoc":194,"id":1575,"name":"scale","nodeType":"Attribute","startLoc":194,"text":"scale"},{"attributeType":"null","col":16,"comment":"null","endLoc":152,"id":1576,"name":"bitpix","nodeType":"Attribute","startLoc":152,"text":"bitpix"},{"attributeType":"null","col":12,"comment":"null","endLoc":178,"id":1577,"name":"_coldefs","nodeType":"Attribute","startLoc":178,"text":"self._coldefs"},{"attributeType":"null","col":19,"comment":"null","endLoc":194,"id":1578,"name":"zero","nodeType":"Attribute","startLoc":194,"text":"zero"},{"attributeType":"null","col":12,"comment":"null","endLoc":149,"id":1579,"name":"unique_parnames","nodeType":"Attribute","startLoc":149,"text":"unique_parnames"},{"col":0,"comment":"\n    Turn the TDISPn fortran format pieces into a final Python format string.\n    See the format_type definitions above the TDISP_FMT_DICT. If codes is\n    changed to take advantage of the exponential specification, will need to\n    add it as another input parameter.\n\n    Parameters\n    ----------\n    tdisp : str\n        TDISPn FITS Header keyword.  Used to specify display formatting.\n\n    Returns\n    -------\n    format_string: str\n        The TDISPn keyword string translated into a Python format string.\n    ","endLoc":2578,"header":"def _fortran_to_python_format(tdisp)","id":1580,"name":"_fortran_to_python_format","nodeType":"Function","startLoc":2554,"text":"def _fortran_to_python_format(tdisp):\n    \"\"\"\n    Turn the TDISPn fortran format pieces into a final Python format string.\n    See the format_type definitions above the TDISP_FMT_DICT. If codes is\n    changed to take advantage of the exponential specification, will need to\n    add it as another input parameter.\n\n    Parameters\n    ----------\n    tdisp : str\n        TDISPn FITS Header keyword.  Used to specify display formatting.\n\n    Returns\n    -------\n    format_string: str\n        The TDISPn keyword string translated into a Python format string.\n    \"\"\"\n    format_type, width, precision, exponential = _parse_tdisp_format(tdisp)\n\n    try:\n        fmt = TDISP_FMT_DICT[format_type]\n        return fmt.format(width=width, precision=precision)\n\n    except KeyError:\n        raise VerifyError(f'Format {format_type} is not recognized.')"},{"attributeType":"null","col":12,"comment":"null","endLoc":200,"id":1581,"name":"self","nodeType":"Attribute","startLoc":200,"text":"self"},{"attributeType":"null","col":16,"comment":"null","endLoc":138,"id":1582,"name":"parbscales","nodeType":"Attribute","startLoc":138,"text":"parbscales"},{"attributeType":"null","col":12,"comment":"null","endLoc":160,"id":1583,"name":"cols","nodeType":"Attribute","startLoc":160,"text":"cols"},{"attributeType":"null","col":12,"comment":"null","endLoc":166,"id":1584,"name":"coldefs","nodeType":"Attribute","startLoc":166,"text":"coldefs"},{"attributeType":"null","col":12,"comment":"null","endLoc":156,"id":1585,"name":"data_fmt","nodeType":"Attribute","startLoc":156,"text":"data_fmt"},{"className":"Section","col":0,"comment":"\n    Image section.\n\n    Slices of this object load the corresponding section of an image array from\n    the underlying FITS file on disk, and applies any BSCALE/BZERO factors.\n\n    Section slices cannot be assigned to, and modifications to a section are\n    not saved back to the underlying file.\n\n    See the :ref:`astropy:data-sections` section of the Astropy documentation\n    for more details.\n    ","endLoc":1016,"id":1586,"nodeType":"Class","startLoc":925,"text":"class Section:\n    \"\"\"\n    Image section.\n\n    Slices of this object load the corresponding section of an image array from\n    the underlying FITS file on disk, and applies any BSCALE/BZERO factors.\n\n    Section slices cannot be assigned to, and modifications to a section are\n    not saved back to the underlying file.\n\n    See the :ref:`astropy:data-sections` section of the Astropy documentation\n    for more details.\n    \"\"\"\n\n    def __init__(self, hdu):\n        self.hdu = hdu\n\n    def __getitem__(self, key):\n        if not isinstance(key, tuple):\n            key = (key,)\n        naxis = len(self.hdu.shape)\n        return_scalar = (all(isinstance(k, (int, np.integer)) for k in key)\n                         and len(key) == naxis)\n        if not any(k is Ellipsis for k in key):\n            # We can always add a ... at the end, after making note of whether\n            # to return a scalar.\n            key += Ellipsis,\n        ellipsis_count = len([k for k in key if k is Ellipsis])\n        if len(key) - ellipsis_count > naxis or ellipsis_count > 1:\n            raise IndexError('too many indices for array')\n        # Insert extra dimensions as needed.\n        idx = next(i for i, k in enumerate(key + (Ellipsis,)) if k is Ellipsis)\n        key = key[:idx] + (slice(None),) * (naxis - len(key) + 1) + key[idx+1:]\n        return_0dim = (all(isinstance(k, (int, np.integer)) for k in key)\n                       and len(key) == naxis)\n\n        dims = []\n        offset = 0\n        # Find all leading axes for which a single point is used.\n        for idx in range(naxis):\n            axis = self.hdu.shape[idx]\n            indx = _IndexInfo(key[idx], axis)\n            offset = offset * axis + indx.offset\n            if not _is_int(key[idx]):\n                dims.append(indx.npts)\n                break\n\n        is_contiguous = indx.contiguous\n        for jdx in range(idx + 1, naxis):\n            axis = self.hdu.shape[jdx]\n            indx = _IndexInfo(key[jdx], axis)\n            dims.append(indx.npts)\n            if indx.npts == axis and indx.contiguous:\n                # The offset needs to multiply the length of all remaining axes\n                offset *= axis\n            else:\n                is_contiguous = False\n\n        if is_contiguous:\n            dims = tuple(dims) or (1,)\n            bitpix = self.hdu._orig_bitpix\n            offset = self.hdu._data_offset + offset * abs(bitpix) // 8\n            data = self.hdu._get_scaled_image_data(offset, dims)\n        else:\n            data = self._getdata(key)\n\n        if return_scalar:\n            data = data.item()\n        elif return_0dim:\n            data = data.squeeze()\n        return data\n\n    def _getdata(self, keys):\n        for idx, (key, axis) in enumerate(zip(keys, self.hdu.shape)):\n            if isinstance(key, slice):\n                ks = range(*key.indices(axis))\n                break\n            elif isiterable(key):\n                # Handle both integer and boolean arrays.\n                ks = np.arange(axis, dtype=int)[key]\n                break\n            # This should always break at some point if _getdata is called.\n\n        data = [self[keys[:idx] + (k,) + keys[idx + 1:]] for k in ks]\n\n        if any(isinstance(key, slice) or isiterable(key)\n               for key in keys[idx + 1:]):\n            # data contains multidimensional arrays; combine them.\n            return np.array(data)\n        else:\n            # Only singleton dimensions remain; concatenate in a 1D array.\n            return np.concatenate([np.atleast_1d(array) for array in data])"},{"col":4,"comment":"null","endLoc":940,"header":"def __init__(self, hdu)","id":1587,"name":"__init__","nodeType":"Function","startLoc":939,"text":"def __init__(self, hdu):\n        self.hdu = hdu"},{"col":4,"comment":"null","endLoc":995,"header":"def __getitem__(self, key)","id":1588,"name":"__getitem__","nodeType":"Function","startLoc":942,"text":"def __getitem__(self, key):\n        if not isinstance(key, tuple):\n            key = (key,)\n        naxis = len(self.hdu.shape)\n        return_scalar = (all(isinstance(k, (int, np.integer)) for k in key)\n                         and len(key) == naxis)\n        if not any(k is Ellipsis for k in key):\n            # We can always add a ... at the end, after making note of whether\n            # to return a scalar.\n            key += Ellipsis,\n        ellipsis_count = len([k for k in key if k is Ellipsis])\n        if len(key) - ellipsis_count > naxis or ellipsis_count > 1:\n            raise IndexError('too many indices for array')\n        # Insert extra dimensions as needed.\n        idx = next(i for i, k in enumerate(key + (Ellipsis,)) if k is Ellipsis)\n        key = key[:idx] + (slice(None),) * (naxis - len(key) + 1) + key[idx+1:]\n        return_0dim = (all(isinstance(k, (int, np.integer)) for k in key)\n                       and len(key) == naxis)\n\n        dims = []\n        offset = 0\n        # Find all leading axes for which a single point is used.\n        for idx in range(naxis):\n            axis = self.hdu.shape[idx]\n            indx = _IndexInfo(key[idx], axis)\n            offset = offset * axis + indx.offset\n            if not _is_int(key[idx]):\n                dims.append(indx.npts)\n                break\n\n        is_contiguous = indx.contiguous\n        for jdx in range(idx + 1, naxis):\n            axis = self.hdu.shape[jdx]\n            indx = _IndexInfo(key[jdx], axis)\n            dims.append(indx.npts)\n            if indx.npts == axis and indx.contiguous:\n                # The offset needs to multiply the length of all remaining axes\n                offset *= axis\n            else:\n                is_contiguous = False\n\n        if is_contiguous:\n            dims = tuple(dims) or (1,)\n            bitpix = self.hdu._orig_bitpix\n            offset = self.hdu._data_offset + offset * abs(bitpix) // 8\n            data = self.hdu._get_scaled_image_data(offset, dims)\n        else:\n            data = self._getdata(key)\n\n        if return_scalar:\n            data = data.item()\n        elif return_0dim:\n            data = data.squeeze()\n        return data"},{"col":0,"comment":"\n    Turn the Python format string to a TDISP FITS compliant format string. Not\n    all formats convert. these will cause a Warning and return None.\n\n    Parameters\n    ----------\n    format_string : str\n        TDISPn FITS Header keyword.  Used to specify display formatting.\n    logical_dtype : bool\n        True is this format type should be a logical type, 'L'. Needs special\n        handling.\n\n    Returns\n    -------\n    tdsip_string: str\n        The TDISPn keyword string translated into a Python format string.\n    ","endLoc":2654,"header":"def python_to_tdisp(format_string, logical_dtype=False)","id":1589,"name":"python_to_tdisp","nodeType":"Function","startLoc":2581,"text":"def python_to_tdisp(format_string, logical_dtype=False):\n    \"\"\"\n    Turn the Python format string to a TDISP FITS compliant format string. Not\n    all formats convert. these will cause a Warning and return None.\n\n    Parameters\n    ----------\n    format_string : str\n        TDISPn FITS Header keyword.  Used to specify display formatting.\n    logical_dtype : bool\n        True is this format type should be a logical type, 'L'. Needs special\n        handling.\n\n    Returns\n    -------\n    tdsip_string: str\n        The TDISPn keyword string translated into a Python format string.\n    \"\"\"\n\n    fmt_to_tdisp = {'a': 'A', 's': 'A', 'd': 'I', 'b': 'B', 'o': 'O', 'x': 'Z',\n                    'X': 'Z', 'f': 'F', 'F': 'F', 'g': 'G', 'G': 'G', 'e': 'E',\n                    'E': 'E'}\n\n    if format_string in [None, \"\", \"{}\"]:\n        return None\n\n    # Strip out extra format characters that aren't a type or a width/precision\n    if format_string[0] == '{' and format_string != \"{}\":\n        fmt_str = format_string.lstrip(\"{:\").rstrip('}')\n    elif format_string[0] == '%':\n        fmt_str = format_string.lstrip(\"%\")\n    else:\n        fmt_str = format_string\n\n    precision, sep = '', ''\n\n    # Character format, only translate right aligned, and don't take zero fills\n    if fmt_str[-1].isdigit() and fmt_str[0] == '>' and fmt_str[1] != '0':\n        ftype = fmt_to_tdisp['a']\n        width = fmt_str[1:]\n\n    elif fmt_str[-1] == 's' and fmt_str != 's':\n        ftype = fmt_to_tdisp['a']\n        width = fmt_str[:-1].lstrip('0')\n\n    # Number formats, don't take zero fills\n    elif fmt_str[-1].isalpha() and len(fmt_str) > 1 and fmt_str[0] != '0':\n        ftype = fmt_to_tdisp[fmt_str[-1]]\n        fmt_str = fmt_str[:-1]\n\n        # If format has a \".\" split out the width and precision\n        if '.' in fmt_str:\n            width, precision = fmt_str.split('.')\n            sep = '.'\n            if width == \"\":\n                ascii_key = ftype if ftype != 'G' else 'F'\n                width = str(int(precision) + (ASCII_DEFAULT_WIDTHS[ascii_key][0] -\n                                     ASCII_DEFAULT_WIDTHS[ascii_key][1]))\n        # Otherwise we just have a width\n        else:\n            width = fmt_str\n\n    else:\n        warnings.warn('Format {} cannot be mapped to the accepted '\n                      'TDISPn keyword values.  Format will not be '\n                      'moved into TDISPn keyword.'.format(format_string),\n                      AstropyUserWarning)\n        return None\n\n    # Catch logical data type, set the format type back to L in this case\n    if logical_dtype:\n        ftype = 'L'\n\n    return ftype + width + sep + precision"},{"col":4,"comment":"null","endLoc":1217,"header":"def __init__(self, indx, naxis)","id":1590,"name":"__init__","nodeType":"Function","startLoc":1199,"text":"def __init__(self, indx, naxis):\n        if _is_int(indx):\n            if 0 <= indx < naxis:\n                self.npts = 1\n                self.offset = indx\n                self.contiguous = True\n            else:\n                raise IndexError(f'Index {indx} out of range.')\n        elif isinstance(indx, slice):\n            start, stop, step = indx.indices(naxis)\n            self.npts = (stop - start) // step\n            self.offset = start\n            self.contiguous = step == 1\n        elif isiterable(indx):\n            self.npts = len(indx)\n            self.offset = 0\n            self.contiguous = False\n        else:\n            raise IndexError(f'Illegal index {indx}')"},{"col":0,"comment":"null","endLoc":342,"header":"def get_current_unit_registry()","id":1591,"name":"get_current_unit_registry","nodeType":"Function","startLoc":341,"text":"def get_current_unit_registry():\n    return _unit_registries[-1]"},{"col":4,"comment":"\n        Quantities are able to directly convert to other units that\n        have the same physical type.\n        ","endLoc":1035,"header":"def __getattr__(self, attr)","id":1592,"name":"__getattr__","nodeType":"Function","startLoc":1008,"text":"def __getattr__(self, attr):\n        \"\"\"\n        Quantities are able to directly convert to other units that\n        have the same physical type.\n        \"\"\"\n        if not self._include_easy_conversion_members:\n            raise AttributeError(\n                f\"'{self.__class__.__name__}' object has no '{attr}' member\")\n\n        def get_virtual_unit_attribute():\n            registry = get_current_unit_registry().registry\n            to_unit = registry.get(attr, None)\n            if to_unit is None:\n                return None\n\n            try:\n                return self.unit.to(\n                    to_unit, self.value, equivalencies=self.equivalencies)\n            except UnitsError:\n                return None\n\n        value = get_virtual_unit_attribute()\n\n        if value is None:\n            raise AttributeError(\n                f\"{self.__class__.__name__} instance has no attribute '{attr}'\")\n        else:\n            return value"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":1593,"name":"__all__","nodeType":"Attribute","startLoc":26,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":44,"id":1594,"name":"NUMPY2FITS","nodeType":"Attribute","startLoc":44,"text":"NUMPY2FITS"},{"attributeType":"null","col":0,"comment":"null","endLoc":58,"id":1595,"name":"FORMATORDER","nodeType":"Attribute","startLoc":58,"text":"FORMATORDER"},{"attributeType":"null","col":0,"comment":"null","endLoc":61,"id":1596,"name":"FITSUPCONVERTERS","nodeType":"Attribute","startLoc":61,"text":"FITSUPCONVERTERS"},{"attributeType":"null","col":0,"comment":"null","endLoc":78,"id":1597,"name":"ASCII_DEFAULT_WIDTHS","nodeType":"Attribute","startLoc":78,"text":"ASCII_DEFAULT_WIDTHS"},{"attributeType":"null","col":0,"comment":"null","endLoc":82,"id":1598,"name":"TDISP_RE_DICT","nodeType":"Attribute","startLoc":82,"text":"TDISP_RE_DICT"},{"attributeType":"null","col":0,"comment":"null","endLoc":120,"id":1599,"name":"TDISP_FMT_DICT","nodeType":"Attribute","startLoc":120,"text":"TDISP_FMT_DICT"},{"attributeType":"null","col":0,"comment":"null","endLoc":136,"id":1600,"name":"KEYWORD_NAMES","nodeType":"Attribute","startLoc":136,"text":"KEYWORD_NAMES"},{"attributeType":"null","col":0,"comment":"This is a list of the attributes that can be set on `Column` objects.","endLoc":139,"id":1601,"name":"KEYWORD_ATTRIBUTES","nodeType":"Attribute","startLoc":139,"text":"KEYWORD_ATTRIBUTES"},{"attributeType":"null","col":0,"comment":"null","endLoc":146,"id":1602,"name":"KEYWORD_TO_ATTRIBUTE","nodeType":"Attribute","startLoc":146,"text":"KEYWORD_TO_ATTRIBUTE"},{"attributeType":"null","col":0,"comment":"null","endLoc":148,"id":1603,"name":"ATTRIBUTE_TO_KEYWORD","nodeType":"Attribute","startLoc":148,"text":"ATTRIBUTE_TO_KEYWORD"},{"attributeType":"null","col":0,"comment":"null","endLoc":154,"id":1604,"name":"TFORMAT_RE","nodeType":"Attribute","startLoc":154,"text":"TFORMAT_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":160,"id":1605,"name":"TFORMAT_ASCII_RE","nodeType":"Attribute","startLoc":160,"text":"TFORMAT_ASCII_RE"},{"attributeType":"null","col":0,"comment":"\nRegular expression for valid table column names.  See FITS Standard v3.0 section\n7.2.2.\n","endLoc":165,"id":1606,"name":"TTYPE_RE","nodeType":"Attribute","startLoc":165,"text":"TTYPE_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":172,"id":1607,"name":"TDEF_RE","nodeType":"Attribute","startLoc":172,"text":"TDEF_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":175,"id":1608,"name":"TDIM_RE","nodeType":"Attribute","startLoc":175,"text":"TDIM_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":183,"id":1609,"name":"DEFAULT_ASCII_TNULL","nodeType":"Attribute","startLoc":183,"text":"DEFAULT_ASCII_TNULL"},{"col":0,"comment":"","endLoc":3,"header":"column.py#<anonymous>","id":1610,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['Column', 'ColDefs', 'Delayed']\n\nFITS2NUMPY = {'L': 'i1', 'B': 'u1', 'I': 'i2', 'J': 'i4', 'K': 'i8', 'E': 'f4',\n              'D': 'f8', 'C': 'c8', 'M': 'c16', 'A': 'a'}\n\nNUMPY2FITS = {val: key for key, val in FITS2NUMPY.items()}\n\nNUMPY2FITS['b1'] = 'L'\n\nNUMPY2FITS['u2'] = 'I'\n\nNUMPY2FITS['u4'] = 'J'\n\nNUMPY2FITS['u8'] = 'K'\n\nNUMPY2FITS['f2'] = 'E'\n\nFORMATORDER = ['L', 'B', 'I', 'J', 'K', 'D', 'M', 'A']\n\nFITSUPCONVERTERS = {'E': 'D', 'C': 'M'}\n\nASCII2NUMPY = {'A': 'a', 'I': 'i4', 'J': 'i8', 'F': 'f8', 'E': 'f8', 'D': 'f8'}\n\nASCII2STR = {'A': '', 'I': 'd', 'J': 'd', 'F': 'f', 'E': 'E', 'D': 'E'}\n\nASCII_DEFAULT_WIDTHS = {'A': (1, 0), 'I': (10, 0), 'J': (15, 0),\n                        'E': (15, 7), 'F': (16, 7), 'D': (25, 17)}\n\nTDISP_RE_DICT = {}\n\nTDISP_RE_DICT['F'] = re.compile(r'(?:(?P<formatc>[F])(?:(?P<width>[0-9]+)\\.{1}'\n                                r'(?P<precision>[0-9])+)+)|')\n\nTDISP_RE_DICT['A'] = TDISP_RE_DICT['L'] = \\\n    re.compile(r'(?:(?P<formatc>[AL])(?P<width>[0-9]+)+)|')\n\nTDISP_RE_DICT['I'] = TDISP_RE_DICT['B'] = \\\n    TDISP_RE_DICT['O'] = TDISP_RE_DICT['Z'] =  \\\n    re.compile(r'(?:(?P<formatc>[IBOZ])(?:(?P<width>[0-9]+)'\n               r'(?:\\.{0,1}(?P<precision>[0-9]+))?))|')\n\nTDISP_RE_DICT['E'] = TDISP_RE_DICT['G'] = \\\n    TDISP_RE_DICT['D'] = \\\n    re.compile(r'(?:(?P<formatc>[EGD])(?:(?P<width>[0-9]+)\\.'\n               r'(?P<precision>[0-9]+))+)'\n               r'(?:E{0,1}(?P<exponential>[0-9]+)?)|')\n\nTDISP_RE_DICT['EN'] = TDISP_RE_DICT['ES'] = \\\n    re.compile(r'(?:(?P<formatc>E[NS])(?:(?P<width>[0-9]+)\\.{1}'\n               r'(?P<precision>[0-9])+)+)')\n\nTDISP_FMT_DICT = {\n    'I': '{{:{width}d}}',\n    'B': '{{:{width}b}}',\n    'O': '{{:{width}o}}',\n    'Z': '{{:{width}x}}',\n    'F': '{{:{width}.{precision}f}}',\n    'G': '{{:{width}.{precision}g}}'\n}\n\nTDISP_FMT_DICT['A'] = TDISP_FMT_DICT['L'] = '{{:>{width}}}'\n\nTDISP_FMT_DICT['E'] = TDISP_FMT_DICT['D'] =  \\\n    TDISP_FMT_DICT['EN'] = TDISP_FMT_DICT['ES'] = '{{:{width}.{precision}e}}'\n\nKEYWORD_NAMES = ('TTYPE', 'TFORM', 'TUNIT', 'TNULL', 'TSCAL', 'TZERO',\n                 'TDISP', 'TBCOL', 'TDIM', 'TCTYP', 'TCUNI', 'TCRPX',\n                 'TCRVL', 'TCDLT', 'TRPOS')\n\nKEYWORD_ATTRIBUTES = ('name', 'format', 'unit', 'null', 'bscale', 'bzero',\n                      'disp', 'start', 'dim', 'coord_type', 'coord_unit',\n                      'coord_ref_point', 'coord_ref_value', 'coord_inc',\n                      'time_ref_pos')\n\n\"\"\"This is a list of the attributes that can be set on `Column` objects.\"\"\"\n\nKEYWORD_TO_ATTRIBUTE = OrderedDict(zip(KEYWORD_NAMES, KEYWORD_ATTRIBUTES))\n\nATTRIBUTE_TO_KEYWORD = OrderedDict(zip(KEYWORD_ATTRIBUTES, KEYWORD_NAMES))\n\nTFORMAT_RE = re.compile(r'(?P<repeat>^[0-9]*)(?P<format>[LXBIJKAEDCMPQ])'\n                        r'(?P<option>[!-~]*)', re.I)\n\nTFORMAT_ASCII_RE = re.compile(r'(?:(?P<format>[AIJ])(?P<width>[0-9]+)?)|'\n                              r'(?:(?P<formatf>[FED])'\n                              r'(?:(?P<widthf>[0-9]+)\\.'\n                              r'(?P<precision>[0-9]+))?)')\n\nTTYPE_RE = re.compile(r'[0-9a-zA-Z_]+')\n\n\"\"\"\nRegular expression for valid table column names.  See FITS Standard v3.0 section\n7.2.2.\n\"\"\"\n\nTDEF_RE = re.compile(r'(?P<label>^T[A-Z]*)(?P<num>[1-9][0-9 ]*$)')\n\nTDIM_RE = re.compile(r'\\(\\s*(?P<dims>(?:\\d+\\s*)(?:,\\s*\\d+\\s*)*\\s*)\\)\\s*')\n\nASCIITNULL = 0\n\nDEFAULT_ASCII_TNULL = '---'"},{"col":0,"comment":"null","endLoc":3502,"header":"def yacc(method='LALR', debug=yaccdebug, module=None, tabmodule=tab_module, start=None,\n         check_recursion=True, optimize=False, write_tables=True, debugfile=debug_file,\n         outputdir=None, debuglog=None, errorlog=None, picklefile=None)","id":1611,"name":"yacc","nodeType":"Function","startLoc":3216,"text":"def yacc(method='LALR', debug=yaccdebug, module=None, tabmodule=tab_module, start=None,\n         check_recursion=True, optimize=False, write_tables=True, debugfile=debug_file,\n         outputdir=None, debuglog=None, errorlog=None, picklefile=None):\n\n    if tabmodule is None:\n        tabmodule = tab_module\n\n    # Reference to the parsing method of the last built parser\n    global parse\n\n    # If pickling is enabled, table files are not created\n    if picklefile:\n        write_tables = 0\n\n    if errorlog is None:\n        errorlog = PlyLogger(sys.stderr)\n\n    # Get the module dictionary used for the parser\n    if module:\n        _items = [(k, getattr(module, k)) for k in dir(module)]\n        pdict = dict(_items)\n        # If no __file__ or __package__ attributes are available, try to obtain them\n        # from the __module__ instead\n        if '__file__' not in pdict:\n            pdict['__file__'] = sys.modules[pdict['__module__']].__file__\n        if '__package__' not in pdict and '__module__' in pdict:\n            if hasattr(sys.modules[pdict['__module__']], '__package__'):\n                pdict['__package__'] = sys.modules[pdict['__module__']].__package__\n    else:\n        pdict = get_caller_module_dict(2)\n\n    if outputdir is None:\n        # If no output directory is set, the location of the output files\n        # is determined according to the following rules:\n        #     - If tabmodule specifies a package, files go into that package directory\n        #     - Otherwise, files go in the same directory as the specifying module\n        if isinstance(tabmodule, types.ModuleType):\n            srcfile = tabmodule.__file__\n        else:\n            if '.' not in tabmodule:\n                srcfile = pdict['__file__']\n            else:\n                parts = tabmodule.split('.')\n                pkgname = '.'.join(parts[:-1])\n                exec('import %s' % pkgname)\n                srcfile = getattr(sys.modules[pkgname], '__file__', '')\n        outputdir = os.path.dirname(srcfile)\n\n    # Determine if the module is package of a package or not.\n    # If so, fix the tabmodule setting so that tables load correctly\n    pkg = pdict.get('__package__')\n    if pkg and isinstance(tabmodule, str):\n        if '.' not in tabmodule:\n            tabmodule = pkg + '.' + tabmodule\n\n\n\n    # Set start symbol if it's specified directly using an argument\n    if start is not None:\n        pdict['start'] = start\n\n    # Collect parser information from the dictionary\n    pinfo = ParserReflect(pdict, log=errorlog)\n    pinfo.get_all()\n\n    if pinfo.error:\n        raise YaccError('Unable to build parser')\n\n    # Check signature against table files (if any)\n    signature = pinfo.signature()\n\n    # Read the tables\n    try:\n        lr = LRTable()\n        if picklefile:\n            read_signature = lr.read_pickle(picklefile)\n        else:\n            read_signature = lr.read_table(tabmodule)\n        if optimize or (read_signature == signature):\n            try:\n                lr.bind_callables(pinfo.pdict)\n                parser = LRParser(lr, pinfo.error_func)\n                parse = parser.parse\n                return parser\n            except Exception as e:\n                errorlog.warning('There was a problem loading the table file: %r', e)\n    except VersionError as e:\n        errorlog.warning(str(e))\n    except ImportError:\n        pass\n\n    if debuglog is None:\n        if debug:\n            try:\n                debuglog = PlyLogger(open(os.path.join(outputdir, debugfile), 'w'))\n            except IOError as e:\n                errorlog.warning(\"Couldn't open %r. %s\" % (debugfile, e))\n                debuglog = NullLogger()\n        else:\n            debuglog = NullLogger()\n\n    debuglog.info('Created by PLY version %s (http://www.dabeaz.com/ply)', __version__)\n\n    errors = False\n\n    # Validate the parser information\n    if pinfo.validate_all():\n        raise YaccError('Unable to build parser')\n\n    if not pinfo.error_func:\n        errorlog.warning('no p_error() function is defined')\n\n    # Create a grammar object\n    grammar = Grammar(pinfo.tokens)\n\n    # Set precedence level for terminals\n    for term, assoc, level in pinfo.preclist:\n        try:\n            grammar.set_precedence(term, assoc, level)\n        except GrammarError as e:\n            errorlog.warning('%s', e)\n\n    # Add productions to the grammar\n    for funcname, gram in pinfo.grammar:\n        file, line, prodname, syms = gram\n        try:\n            grammar.add_production(prodname, syms, funcname, file, line)\n        except GrammarError as e:\n            errorlog.error('%s', e)\n            errors = True\n\n    # Set the grammar start symbols\n    try:\n        if start is None:\n            grammar.set_start(pinfo.start)\n        else:\n            grammar.set_start(start)\n    except GrammarError as e:\n        errorlog.error(str(e))\n        errors = True\n\n    if errors:\n        raise YaccError('Unable to build parser')\n\n    # Verify the grammar structure\n    undefined_symbols = grammar.undefined_symbols()\n    for sym, prod in undefined_symbols:\n        errorlog.error('%s:%d: Symbol %r used, but not defined as a token or a rule', prod.file, prod.line, sym)\n        errors = True\n\n    unused_terminals = grammar.unused_terminals()\n    if unused_terminals:\n        debuglog.info('')\n        debuglog.info('Unused terminals:')\n        debuglog.info('')\n        for term in unused_terminals:\n            errorlog.warning('Token %r defined, but not used', term)\n            debuglog.info('    %s', term)\n\n    # Print out all productions to the debug log\n    if debug:\n        debuglog.info('')\n        debuglog.info('Grammar')\n        debuglog.info('')\n        for n, p in enumerate(grammar.Productions):\n            debuglog.info('Rule %-5d %s', n, p)\n\n    # Find unused non-terminals\n    unused_rules = grammar.unused_rules()\n    for prod in unused_rules:\n        errorlog.warning('%s:%d: Rule %r defined, but not used', prod.file, prod.line, prod.name)\n\n    if len(unused_terminals) == 1:\n        errorlog.warning('There is 1 unused token')\n    if len(unused_terminals) > 1:\n        errorlog.warning('There are %d unused tokens', len(unused_terminals))\n\n    if len(unused_rules) == 1:\n        errorlog.warning('There is 1 unused rule')\n    if len(unused_rules) > 1:\n        errorlog.warning('There are %d unused rules', len(unused_rules))\n\n    if debug:\n        debuglog.info('')\n        debuglog.info('Terminals, with rules where they appear')\n        debuglog.info('')\n        terms = list(grammar.Terminals)\n        terms.sort()\n        for term in terms:\n            debuglog.info('%-20s : %s', term, ' '.join([str(s) for s in grammar.Terminals[term]]))\n\n        debuglog.info('')\n        debuglog.info('Nonterminals, with rules where they appear')\n        debuglog.info('')\n        nonterms = list(grammar.Nonterminals)\n        nonterms.sort()\n        for nonterm in nonterms:\n            debuglog.info('%-20s : %s', nonterm, ' '.join([str(s) for s in grammar.Nonterminals[nonterm]]))\n        debuglog.info('')\n\n    if check_recursion:\n        unreachable = grammar.find_unreachable()\n        for u in unreachable:\n            errorlog.warning('Symbol %r is unreachable', u)\n\n        infinite = grammar.infinite_cycles()\n        for inf in infinite:\n            errorlog.error('Infinite recursion detected for symbol %r', inf)\n            errors = True\n\n    unused_prec = grammar.unused_precedence()\n    for term, assoc in unused_prec:\n        errorlog.error('Precedence rule %r defined for unknown symbol %r', assoc, term)\n        errors = True\n\n    if errors:\n        raise YaccError('Unable to build parser')\n\n    # Run the LRGeneratedTable on the grammar\n    if debug:\n        errorlog.debug('Generating %s tables', method)\n\n    lr = LRGeneratedTable(grammar, method, debuglog)\n\n    if debug:\n        num_sr = len(lr.sr_conflicts)\n\n        # Report shift/reduce and reduce/reduce conflicts\n        if num_sr == 1:\n            errorlog.warning('1 shift/reduce conflict')\n        elif num_sr > 1:\n            errorlog.warning('%d shift/reduce conflicts', num_sr)\n\n        num_rr = len(lr.rr_conflicts)\n        if num_rr == 1:\n            errorlog.warning('1 reduce/reduce conflict')\n        elif num_rr > 1:\n            errorlog.warning('%d reduce/reduce conflicts', num_rr)\n\n    # Write out conflicts to the output file\n    if debug and (lr.sr_conflicts or lr.rr_conflicts):\n        debuglog.warning('')\n        debuglog.warning('Conflicts:')\n        debuglog.warning('')\n\n        for state, tok, resolution in lr.sr_conflicts:\n            debuglog.warning('shift/reduce conflict for %s in state %d resolved as %s',  tok, state, resolution)\n\n        already_reported = set()\n        for state, rule, rejected in lr.rr_conflicts:\n            if (state, id(rule), id(rejected)) in already_reported:\n                continue\n            debuglog.warning('reduce/reduce conflict in state %d resolved using rule (%s)', state, rule)\n            debuglog.warning('rejected rule (%s) in state %d', rejected, state)\n            errorlog.warning('reduce/reduce conflict in state %d resolved using rule (%s)', state, rule)\n            errorlog.warning('rejected rule (%s) in state %d', rejected, state)\n            already_reported.add((state, id(rule), id(rejected)))\n\n        warned_never = []\n        for state, rule, rejected in lr.rr_conflicts:\n            if not rejected.reduced and (rejected not in warned_never):\n                debuglog.warning('Rule (%s) is never reduced', rejected)\n                errorlog.warning('Rule (%s) is never reduced', rejected)\n                warned_never.append(rejected)\n\n    # Write the table file if requested\n    if write_tables:\n        try:\n            lr.write_table(tabmodule, outputdir, signature)\n            if tabmodule in sys.modules:\n                del sys.modules[tabmodule]\n        except IOError as e:\n            errorlog.warning(\"Couldn't create %r. %s\" % (tabmodule, e))\n\n    # Write a pickled version of the tables\n    if picklefile:\n        try:\n            lr.pickle_table(picklefile, signature)\n        except IOError as e:\n            errorlog.warning(\"Couldn't create %r. %s\" % (picklefile, e))\n\n    # Build the parser\n    lr.bind_callables(pinfo.pdict)\n    parser = LRParser(lr, pinfo.error_func)\n\n    parse = parser.parse\n    return parser"},{"col":4,"comment":"\n        Write the `HDUList` to a new file.\n\n        Parameters\n        ----------\n        fileobj : str, file-like or `pathlib.Path`\n            File to write to.  If a file object, must be opened in a\n            writeable mode.\n\n        output_verify : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n\n        checksum : bool\n            When `True` adds both ``DATASUM`` and ``CHECKSUM`` cards\n            to the headers of all HDU's written to the file.\n        ","endLoc":951,"header":"def writeto(self, fileobj, output_verify='exception', overwrite=False,\n                checksum=False)","id":1612,"name":"writeto","nodeType":"Function","startLoc":893,"text":"def writeto(self, fileobj, output_verify='exception', overwrite=False,\n                checksum=False):\n        \"\"\"\n        Write the `HDUList` to a new file.\n\n        Parameters\n        ----------\n        fileobj : str, file-like or `pathlib.Path`\n            File to write to.  If a file object, must be opened in a\n            writeable mode.\n\n        output_verify : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n\n        checksum : bool\n            When `True` adds both ``DATASUM`` and ``CHECKSUM`` cards\n            to the headers of all HDU's written to the file.\n        \"\"\"\n\n        if (len(self) == 0):\n            warnings.warn(\"There is nothing to write.\", AstropyUserWarning)\n            return\n\n        self.verify(option=output_verify)\n\n        # make sure the EXTEND keyword is there if there is extension\n        self.update_extend()\n\n        # make note of whether the input file object is already open, in which\n        # case we should not close it after writing (that should be the job\n        # of the caller)\n        closed = isinstance(fileobj, str) or fileobj_closed(fileobj)\n\n        mode = FILE_MODES[fileobj_mode(fileobj)] if isfile(fileobj) else 'ostream'\n\n        # This can accept an open file object that's open to write only, or in\n        # append/update modes but only if the file doesn't exist.\n        fileobj = _File(fileobj, mode=mode, overwrite=overwrite)\n        hdulist = self.fromfile(fileobj)\n        try:\n            dirname = os.path.dirname(hdulist._file.name)\n        except (AttributeError, TypeError):\n            dirname = None\n\n        with _free_space_check(self, dirname=dirname):\n            for hdu in self:\n                hdu._prewriteto(checksum=checksum)\n                hdu._writeto(hdulist._file)\n                hdu._postwriteto()\n        hdulist.close(output_verify=output_verify, closed=closed)"},{"col":4,"comment":"null","endLoc":1047,"header":"def __eq__(self, other)","id":1614,"name":"__eq__","nodeType":"Function","startLoc":1040,"text":"def __eq__(self, other):\n        try:\n            other_value = self._to_own_unit(other)\n        except UnitsError:\n            return False\n        except Exception:\n            return NotImplemented\n        return self.value.__eq__(other_value)"},{"col":4,"comment":"null","endLoc":1547,"header":"def _to_own_unit(self, value, check_precision=True)","id":1615,"name":"_to_own_unit","nodeType":"Function","startLoc":1504,"text":"def _to_own_unit(self, value, check_precision=True):\n        try:\n            _value = value.to_value(self.unit)\n        except AttributeError:\n            # We're not a Quantity.\n            # First remove two special cases (with a fast test):\n            # 1) Maybe masked printing? MaskedArray with quantities does not\n            # work very well, but no reason to break even repr and str.\n            # 2) np.ma.masked? useful if we're a MaskedQuantity.\n            if (value is np.ma.masked\n                or (value is np.ma.masked_print_option\n                    and self.dtype.kind == 'O')):\n                return value\n            # Now, let's try a more general conversion.\n            # Plain arrays will be converted to dimensionless in the process,\n            # but anything with a unit attribute will use that.\n            try:\n                as_quantity = Quantity(value)\n                _value = as_quantity.to_value(self.unit)\n            except UnitsError:\n                # last chance: if this was not something with a unit\n                # and is all 0, inf, or nan, we treat it as arbitrary unit.\n                if (not hasattr(value, 'unit') and\n                        can_have_arbitrary_unit(as_quantity.value)):\n                    _value = as_quantity.value\n                else:\n                    raise\n\n        if self.dtype.kind == 'i' and check_precision:\n            # If, e.g., we are casting float to int, we want to fail if\n            # precision is lost, but let things pass if it works.\n            _value = np.array(_value, copy=False, subok=True)\n            if not np.can_cast(_value.dtype, self.dtype):\n                self_dtype_array = np.array(_value, self.dtype, subok=True)\n                if not np.all(np.logical_or(self_dtype_array == _value,\n                                            np.isnan(_value))):\n                    raise TypeError(\"cannot convert value type to array type \"\n                                    \"without precision loss\")\n\n        # Setting names to ensure things like equality work (note that\n        # above will have failed already if units did not match).\n        if self.dtype.names:\n            _value.dtype.names = self.dtype.names\n        return _value"},{"col":4,"comment":"null","endLoc":110,"header":"def __init__(self, f)","id":1616,"name":"__init__","nodeType":"Function","startLoc":109,"text":"def __init__(self, f):\n        self.f = f"},{"col":4,"comment":"Make sure that names and dtype are both iterable and have\n        the same length as data.\n        ","endLoc":1096,"header":"def _check_names_dtype(self, names, dtype, n_cols)","id":1617,"name":"_check_names_dtype","nodeType":"Function","startLoc":1086,"text":"def _check_names_dtype(self, names, dtype, n_cols):\n        \"\"\"Make sure that names and dtype are both iterable and have\n        the same length as data.\n        \"\"\"\n        for inp_list, inp_str in ((dtype, 'dtype'), (names, 'names')):\n            if not isiterable(inp_list):\n                raise ValueError(f'{inp_str} must be a list or None')\n\n        if len(names) != n_cols or len(dtype) != n_cols:\n            raise ValueError(\n                'Arguments \"names\" and \"dtype\" must match number of columns')"},{"col":4,"comment":"Initialize table from a list of column data.  A column can be a\n        Column object, np.ndarray, mixin, or any other iterable object.\n        ","endLoc":1177,"header":"def _init_from_list(self, data, names, dtype, n_cols, copy)","id":1618,"name":"_init_from_list","nodeType":"Function","startLoc":1160,"text":"def _init_from_list(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from a list of column data.  A column can be a\n        Column object, np.ndarray, mixin, or any other iterable object.\n        \"\"\"\n        # Special case of initializing an empty table like `t = Table()`. No\n        # action required at this point.\n        if n_cols == 0:\n            return\n\n        cols = []\n        default_names = _auto_names(n_cols)\n\n        for col, name, default_name, dtype in zip(data, names, default_names, dtype):\n            col = self._convert_data_to_col(col, copy, default_name, dtype, name)\n\n            cols.append(col)\n\n        self._init_from_cols(cols)"},{"col":4,"comment":"null","endLoc":1056,"header":"def __ne__(self, other)","id":1619,"name":"__ne__","nodeType":"Function","startLoc":1049,"text":"def __ne__(self, other):\n        try:\n            other_value = self._to_own_unit(other)\n        except UnitsError:\n            return True\n        except Exception:\n            return NotImplemented\n        return self.value.__ne__(other_value)"},{"col":4,"comment":"null","endLoc":1065,"header":"def __lshift__(self, other)","id":1620,"name":"__lshift__","nodeType":"Function","startLoc":1059,"text":"def __lshift__(self, other):\n        try:\n            other = Unit(other, parse_strict='silent')\n        except UnitTypeError:\n            return NotImplemented\n\n        return self.__class__(self, other, copy=False, subok=True)"},{"fileName":"header.py","filePath":"astropy/io/fits","id":1621,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport collections\nimport copy\nimport itertools\nimport numbers\nimport re\nimport warnings\n\nfrom .card import Card, _pad, KEYWORD_LENGTH, UNDEFINED\nfrom .file import _File\nfrom .util import (encode_ascii, decode_ascii, fileobj_closed,\n                   fileobj_is_binary, path_like)\nfrom ._utils import parse_header\n\nfrom astropy.utils import isiterable\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n\nBLOCK_SIZE = 2880  # the FITS block size\n\n# This regular expression can match a *valid* END card which just consists of\n# the string 'END' followed by all spaces, or an *invalid* end card which\n# consists of END, followed by any character that is *not* a valid character\n# for a valid FITS keyword (that is, this is not a keyword like 'ENDER' which\n# starts with 'END' but is not 'END'), followed by any arbitrary bytes.  An\n# invalid end card may also consist of just 'END' with no trailing bytes.\nHEADER_END_RE = re.compile(encode_ascii(\n    r'(?:(?P<valid>END {77}) *)|(?P<invalid>END$|END {0,76}[^A-Z0-9_-])'))\n\n\n# According to the FITS standard the only characters that may appear in a\n# header record are the restricted ASCII chars from 0x20 through 0x7E.\nVALID_HEADER_CHARS = set(map(chr, range(0x20, 0x7F)))\nEND_CARD = 'END' + ' ' * 77\n\n\n__doctest_skip__ = ['Header', 'Header.comments', 'Header.fromtextfile',\n                    'Header.totextfile', 'Header.set', 'Header.update']\n\n\nclass Header:\n    \"\"\"\n    FITS header class.  This class exposes both a dict-like interface and a\n    list-like interface to FITS headers.\n\n    The header may be indexed by keyword and, like a dict, the associated value\n    will be returned.  When the header contains cards with duplicate keywords,\n    only the value of the first card with the given keyword will be returned.\n    It is also possible to use a 2-tuple as the index in the form (keyword,\n    n)--this returns the n-th value with that keyword, in the case where there\n    are duplicate keywords.\n\n    For example::\n\n        >>> header['NAXIS']\n        0\n        >>> header[('FOO', 1)]  # Return the value of the second FOO keyword\n        'foo'\n\n    The header may also be indexed by card number::\n\n        >>> header[0]  # Return the value of the first card in the header\n        'T'\n\n    Commentary keywords such as HISTORY and COMMENT are special cases: When\n    indexing the Header object with either 'HISTORY' or 'COMMENT' a list of all\n    the HISTORY/COMMENT values is returned::\n\n        >>> header['HISTORY']\n        This is the first history entry in this header.\n        This is the second history entry in this header.\n        ...\n\n    See the Astropy documentation for more details on working with headers.\n\n    Notes\n    -----\n    Although FITS keywords must be exclusively upper case, retrieving an item\n    in a `Header` object is case insensitive.\n    \"\"\"\n\n    def __init__(self, cards=[], copy=False):\n        \"\"\"\n        Construct a `Header` from an iterable and/or text file.\n\n        Parameters\n        ----------\n        cards : list of `Card`, optional\n            The cards to initialize the header with. Also allowed are other\n            `Header` (or `dict`-like) objects.\n\n            .. versionchanged:: 1.2\n                Allowed ``cards`` to be a `dict`-like object.\n\n        copy : bool, optional\n\n            If ``True`` copies the ``cards`` if they were another `Header`\n            instance.\n            Default is ``False``.\n\n            .. versionadded:: 1.3\n        \"\"\"\n        self.clear()\n\n        if isinstance(cards, Header):\n            if copy:\n                cards = cards.copy()\n            cards = cards.cards\n        elif isinstance(cards, dict):\n            cards = cards.items()\n\n        for card in cards:\n            self.append(card, end=True)\n\n        self._modified = False\n\n    def __len__(self):\n        return len(self._cards)\n\n    def __iter__(self):\n        for card in self._cards:\n            yield card.keyword\n\n    def __contains__(self, keyword):\n        if keyword in self._keyword_indices or keyword in self._rvkc_indices:\n            # For the most common case (single, standard form keyword lookup)\n            # this will work and is an O(1) check.  If it fails that doesn't\n            # guarantee absence, just that we have to perform the full set of\n            # checks in self._cardindex\n            return True\n        try:\n            self._cardindex(keyword)\n        except (KeyError, IndexError):\n            return False\n        return True\n\n    def __getitem__(self, key):\n        if isinstance(key, slice):\n            return self.__class__([copy.copy(c) for c in self._cards[key]])\n        elif self._haswildcard(key):\n            return self.__class__([copy.copy(self._cards[idx])\n                                   for idx in self._wildcardmatch(key)])\n        elif isinstance(key, str):\n            key = key.strip()\n            if key.upper() in Card._commentary_keywords:\n                key = key.upper()\n                # Special case for commentary cards\n                return _HeaderCommentaryCards(self, key)\n\n        if isinstance(key, tuple):\n            keyword = key[0]\n        else:\n            keyword = key\n\n        card = self._cards[self._cardindex(key)]\n\n        if card.field_specifier is not None and keyword == card.rawkeyword:\n            # This is RVKC; if only the top-level keyword was specified return\n            # the raw value, not the parsed out float value\n            return card.rawvalue\n\n        value = card.value\n        if value == UNDEFINED:\n            return None\n        return value\n\n    def __setitem__(self, key, value):\n        if self._set_slice(key, value, self):\n            return\n\n        if isinstance(value, tuple):\n            if len(value) > 2:\n                raise ValueError(\n                    'A Header item may be set with either a scalar value, '\n                    'a 1-tuple containing a scalar value, or a 2-tuple '\n                    'containing a scalar value and comment string.')\n            if len(value) == 1:\n                value, comment = value[0], None\n                if value is None:\n                    value = UNDEFINED\n            elif len(value) == 2:\n                value, comment = value\n                if value is None:\n                    value = UNDEFINED\n                if comment is None:\n                    comment = ''\n        else:\n            comment = None\n\n        card = None\n        if isinstance(key, numbers.Integral):\n            card = self._cards[key]\n        elif isinstance(key, tuple):\n            card = self._cards[self._cardindex(key)]\n        if value is None:\n            value = UNDEFINED\n        if card:\n            card.value = value\n            if comment is not None:\n                card.comment = comment\n            if card._modified:\n                self._modified = True\n        else:\n            # If we get an IndexError that should be raised; we don't allow\n            # assignment to non-existing indices\n            self._update((key, value, comment))\n\n    def __delitem__(self, key):\n        if isinstance(key, slice) or self._haswildcard(key):\n            # This is very inefficient but it's not a commonly used feature.\n            # If someone out there complains that they make heavy use of slice\n            # deletions and it's too slow, well, we can worry about it then\n            # [the solution is not too complicated--it would be wait 'til all\n            # the cards are deleted before updating _keyword_indices rather\n            # than updating it once for each card that gets deleted]\n            if isinstance(key, slice):\n                indices = range(*key.indices(len(self)))\n                # If the slice step is backwards we want to reverse it, because\n                # it will be reversed in a few lines...\n                if key.step and key.step < 0:\n                    indices = reversed(indices)\n            else:\n                indices = self._wildcardmatch(key)\n            for idx in reversed(indices):\n                del self[idx]\n            return\n        elif isinstance(key, str):\n            # delete ALL cards with the same keyword name\n            key = Card.normalize_keyword(key)\n            indices = self._keyword_indices\n            if key not in self._keyword_indices:\n                indices = self._rvkc_indices\n\n            if key not in indices:\n                # if keyword is not present raise KeyError.\n                # To delete keyword without caring if they were present,\n                # Header.remove(Keyword) can be used with optional argument ignore_missing as True\n                raise KeyError(f\"Keyword '{key}' not found.\")\n\n            for idx in reversed(indices[key]):\n                # Have to copy the indices list since it will be modified below\n                del self[idx]\n            return\n\n        idx = self._cardindex(key)\n        card = self._cards[idx]\n        keyword = card.keyword\n        del self._cards[idx]\n        keyword = Card.normalize_keyword(keyword)\n        indices = self._keyword_indices[keyword]\n        indices.remove(idx)\n        if not indices:\n            del self._keyword_indices[keyword]\n\n        # Also update RVKC indices if necessary :/\n        if card.field_specifier is not None:\n            indices = self._rvkc_indices[card.rawkeyword]\n            indices.remove(idx)\n            if not indices:\n                del self._rvkc_indices[card.rawkeyword]\n\n        # We also need to update all other indices\n        self._updateindices(idx, increment=False)\n        self._modified = True\n\n    def __repr__(self):\n        return self.tostring(sep='\\n', endcard=False, padding=False)\n\n    def __str__(self):\n        return self.tostring()\n\n    def __eq__(self, other):\n        \"\"\"\n        Two Headers are equal only if they have the exact same string\n        representation.\n        \"\"\"\n\n        return str(self) == str(other)\n\n    def __add__(self, other):\n        temp = self.copy(strip=False)\n        temp.extend(other)\n        return temp\n\n    def __iadd__(self, other):\n        self.extend(other)\n        return self\n\n    def _ipython_key_completions_(self):\n        return self.__iter__()\n\n    @property\n    def cards(self):\n        \"\"\"\n        The underlying physical cards that make up this Header; it can be\n        looked at, but it should not be modified directly.\n        \"\"\"\n\n        return _CardAccessor(self)\n\n    @property\n    def comments(self):\n        \"\"\"\n        View the comments associated with each keyword, if any.\n\n        For example, to see the comment on the NAXIS keyword:\n\n            >>> header.comments['NAXIS']\n            number of data axes\n\n        Comments can also be updated through this interface:\n\n            >>> header.comments['NAXIS'] = 'Number of data axes'\n\n        \"\"\"\n\n        return _HeaderComments(self)\n\n    @property\n    def _modified(self):\n        \"\"\"\n        Whether or not the header has been modified; this is a property so that\n        it can also check each card for modifications--cards may have been\n        modified directly without the header containing it otherwise knowing.\n        \"\"\"\n\n        modified_cards = any(c._modified for c in self._cards)\n        if modified_cards:\n            # If any cards were modified then by definition the header was\n            # modified\n            self.__dict__['_modified'] = True\n\n        return self.__dict__['_modified']\n\n    @_modified.setter\n    def _modified(self, val):\n        self.__dict__['_modified'] = val\n\n    @classmethod\n    def fromstring(cls, data, sep=''):\n        \"\"\"\n        Creates an HDU header from a byte string containing the entire header\n        data.\n\n        Parameters\n        ----------\n        data : str or bytes\n           String or bytes containing the entire header.  In the case of bytes\n           they will be decoded using latin-1 (only plain ASCII characters are\n           allowed in FITS headers but latin-1 allows us to retain any invalid\n           bytes that might appear in malformatted FITS files).\n\n        sep : str, optional\n            The string separating cards from each other, such as a newline.  By\n            default there is no card separator (as is the case in a raw FITS\n            file).  In general this is only used in cases where a header was\n            printed as text (e.g. with newlines after each card) and you want\n            to create a new `Header` from it by copy/pasting.\n\n        Examples\n        --------\n\n        >>> from astropy.io.fits import Header\n        >>> hdr = Header({'SIMPLE': True})\n        >>> Header.fromstring(hdr.tostring()) == hdr\n        True\n\n        If you want to create a `Header` from printed text it's not necessary\n        to have the exact binary structure as it would appear in a FITS file,\n        with the full 80 byte card length.  Rather, each \"card\" can end in a\n        newline and does not have to be padded out to a full card length as\n        long as it \"looks like\" a FITS header:\n\n        >>> hdr = Header.fromstring(\\\"\\\"\\\"\\\\\n        ... SIMPLE  =                    T / conforms to FITS standard\n        ... BITPIX  =                    8 / array data type\n        ... NAXIS   =                    0 / number of array dimensions\n        ... EXTEND  =                    T\n        ... \\\"\\\"\\\", sep='\\\\n')\n        >>> hdr['SIMPLE']\n        True\n        >>> hdr['BITPIX']\n        8\n        >>> len(hdr)\n        4\n\n        Returns\n        -------\n        `Header`\n            A new `Header` instance.\n        \"\"\"\n\n        cards = []\n\n        # If the card separator contains characters that may validly appear in\n        # a card, the only way to unambiguously distinguish between cards is to\n        # require that they be Card.length long.  However, if the separator\n        # contains non-valid characters (namely \\n) the cards may be split\n        # immediately at the separator\n        require_full_cardlength = set(sep).issubset(VALID_HEADER_CHARS)\n\n        if isinstance(data, bytes):\n            # FITS supports only ASCII, but decode as latin1 and just take all\n            # bytes for now; if it results in mojibake due to e.g. UTF-8\n            # encoded data in a FITS header that's OK because it shouldn't be\n            # there in the first place--accepting it here still gives us the\n            # opportunity to display warnings later during validation\n            CONTINUE = b'CONTINUE'\n            END = b'END'\n            end_card = END_CARD.encode('ascii')\n            sep = sep.encode('latin1')\n            empty = b''\n        else:\n            CONTINUE = 'CONTINUE'\n            END = 'END'\n            end_card = END_CARD\n            empty = ''\n\n        # Split the header into individual cards\n        idx = 0\n        image = []\n\n        while idx < len(data):\n            if require_full_cardlength:\n                end_idx = idx + Card.length\n            else:\n                try:\n                    end_idx = data.index(sep, idx)\n                except ValueError:\n                    end_idx = len(data)\n\n            next_image = data[idx:end_idx]\n            idx = end_idx + len(sep)\n\n            if image:\n                if next_image[:8] == CONTINUE:\n                    image.append(next_image)\n                    continue\n                cards.append(Card.fromstring(empty.join(image)))\n\n            if require_full_cardlength:\n                if next_image == end_card:\n                    image = []\n                    break\n            else:\n                if next_image.split(sep)[0].rstrip() == END:\n                    image = []\n                    break\n\n            image = [next_image]\n\n        # Add the last image that was found before the end, if any\n        if image:\n            cards.append(Card.fromstring(empty.join(image)))\n\n        return cls._fromcards(cards)\n\n    @classmethod\n    def fromfile(cls, fileobj, sep='', endcard=True, padding=True):\n        \"\"\"\n        Similar to :meth:`Header.fromstring`, but reads the header string from\n        a given file-like object or filename.\n\n        Parameters\n        ----------\n        fileobj : str, file-like\n            A filename or an open file-like object from which a FITS header is\n            to be read.  For open file handles the file pointer must be at the\n            beginning of the header.\n\n        sep : str, optional\n            The string separating cards from each other, such as a newline.  By\n            default there is no card separator (as is the case in a raw FITS\n            file).\n\n        endcard : bool, optional\n            If True (the default) the header must end with an END card in order\n            to be considered valid.  If an END card is not found an\n            `OSError` is raised.\n\n        padding : bool, optional\n            If True (the default) the header will be required to be padded out\n            to a multiple of 2880, the FITS header block size.  Otherwise any\n            padding, or lack thereof, is ignored.\n\n        Returns\n        -------\n        `Header`\n            A new `Header` instance.\n        \"\"\"\n\n        close_file = False\n\n        if isinstance(fileobj, path_like):\n            # If sep is non-empty we are trying to read a header printed to a\n            # text file, so open in text mode by default to support newline\n            # handling; if a binary-mode file object is passed in, the user is\n            # then on their own w.r.t. newline handling.\n            #\n            # Otherwise assume we are reading from an actual FITS file and open\n            # in binary mode.\n            if sep:\n                fileobj = open(fileobj, 'r', encoding='latin1')\n            else:\n                fileobj = open(fileobj, 'rb')\n\n            close_file = True\n\n        try:\n            is_binary = fileobj_is_binary(fileobj)\n\n            def block_iter(nbytes):\n                while True:\n                    data = fileobj.read(nbytes)\n\n                    if data:\n                        yield data\n                    else:\n                        break\n\n            return cls._from_blocks(block_iter, is_binary, sep, endcard,\n                                    padding)[1]\n        finally:\n            if close_file:\n                fileobj.close()\n\n    @classmethod\n    def _fromcards(cls, cards):\n        header = cls()\n        for idx, card in enumerate(cards):\n            header._cards.append(card)\n            keyword = Card.normalize_keyword(card.keyword)\n            header._keyword_indices[keyword].append(idx)\n            if card.field_specifier is not None:\n                header._rvkc_indices[card.rawkeyword].append(idx)\n\n        header._modified = False\n        return header\n\n    @classmethod\n    def _from_blocks(cls, block_iter, is_binary, sep, endcard, padding):\n        \"\"\"\n        The meat of `Header.fromfile`; in a separate method so that\n        `Header.fromfile` itself is just responsible for wrapping file\n        handling.  Also used by `_BaseHDU.fromstring`.\n\n        ``block_iter`` should be a callable which, given a block size n\n        (typically 2880 bytes as used by the FITS standard) returns an iterator\n        of byte strings of that block size.\n\n        ``is_binary`` specifies whether the returned blocks are bytes or text\n\n        Returns both the entire header *string*, and the `Header` object\n        returned by Header.fromstring on that string.\n        \"\"\"\n\n        actual_block_size = _block_size(sep)\n        clen = Card.length + len(sep)\n\n        blocks = block_iter(actual_block_size)\n\n        # Read the first header block.\n        try:\n            block = next(blocks)\n        except StopIteration:\n            raise EOFError()\n\n        if not is_binary:\n            # TODO: There needs to be error handling at *this* level for\n            # non-ASCII characters; maybe at this stage decoding latin-1 might\n            # be safer\n            block = encode_ascii(block)\n\n        read_blocks = []\n        is_eof = False\n        end_found = False\n\n        # continue reading header blocks until END card or EOF is reached\n        while True:\n            # find the END card\n            end_found, block = cls._find_end_card(block, clen)\n\n            read_blocks.append(decode_ascii(block))\n\n            if end_found:\n                break\n\n            try:\n                block = next(blocks)\n            except StopIteration:\n                is_eof = True\n                break\n\n            if not block:\n                is_eof = True\n                break\n\n            if not is_binary:\n                block = encode_ascii(block)\n\n        header_str = ''.join(read_blocks)\n        _check_padding(header_str, actual_block_size, is_eof,\n                       check_block_size=padding)\n\n        if not end_found and is_eof and endcard:\n            # TODO: Pass this error to validation framework as an ERROR,\n            # rather than raising an exception\n            raise OSError('Header missing END card.')\n\n        return header_str, cls.fromstring(header_str, sep=sep)\n\n    @classmethod\n    def _find_end_card(cls, block, card_len):\n        \"\"\"\n        Utility method to search a header block for the END card and handle\n        invalid END cards.\n\n        This method can also returned a modified copy of the input header block\n        in case an invalid end card needs to be sanitized.\n        \"\"\"\n\n        for mo in HEADER_END_RE.finditer(block):\n            # Ensure the END card was found, and it started on the\n            # boundary of a new card (see ticket #142)\n            if mo.start() % card_len != 0:\n                continue\n\n            # This must be the last header block, otherwise the\n            # file is malformatted\n            if mo.group('invalid'):\n                offset = mo.start()\n                trailing = block[offset + 3:offset + card_len - 3].rstrip()\n                if trailing:\n                    trailing = repr(trailing).lstrip('ub')\n                    # TODO: Pass this warning up to the validation framework\n                    warnings.warn(\n                        'Unexpected bytes trailing END keyword: {}; these '\n                        'bytes will be replaced with spaces on write.'.format(\n                            trailing), AstropyUserWarning)\n                else:\n                    # TODO: Pass this warning up to the validation framework\n                    warnings.warn(\n                        'Missing padding to end of the FITS block after the '\n                        'END keyword; additional spaces will be appended to '\n                        'the file upon writing to pad out to {} '\n                        'bytes.'.format(BLOCK_SIZE), AstropyUserWarning)\n\n                # Sanitize out invalid END card now that the appropriate\n                # warnings have been issued\n                block = (block[:offset] + encode_ascii(END_CARD) +\n                         block[offset + len(END_CARD):])\n\n            return True, block\n\n        return False, block\n\n    def tostring(self, sep='', endcard=True, padding=True):\n        r\"\"\"\n        Returns a string representation of the header.\n\n        By default this uses no separator between cards, adds the END card, and\n        pads the string with spaces to the next multiple of 2880 bytes.  That\n        is, it returns the header exactly as it would appear in a FITS file.\n\n        Parameters\n        ----------\n        sep : str, optional\n            The character or string with which to separate cards.  By default\n            there is no separator, but one could use ``'\\\\n'``, for example, to\n            separate each card with a new line\n\n        endcard : bool, optional\n            If True (default) adds the END card to the end of the header\n            string\n\n        padding : bool, optional\n            If True (default) pads the string with spaces out to the next\n            multiple of 2880 characters\n\n        Returns\n        -------\n        str\n            A string representing a FITS header.\n        \"\"\"\n\n        lines = []\n        for card in self._cards:\n            s = str(card)\n            # Cards with CONTINUE cards may be longer than 80 chars; so break\n            # them into multiple lines\n            while s:\n                lines.append(s[:Card.length])\n                s = s[Card.length:]\n\n        s = sep.join(lines)\n        if endcard:\n            s += sep + _pad('END')\n        if padding:\n            s += ' ' * _pad_length(len(s))\n        return s\n\n    def tofile(self, fileobj, sep='', endcard=True, padding=True,\n               overwrite=False):\n        r\"\"\"\n        Writes the header to file or file-like object.\n\n        By default this writes the header exactly as it would be written to a\n        FITS file, with the END card included and padding to the next multiple\n        of 2880 bytes.  However, aspects of this may be controlled.\n\n        Parameters\n        ----------\n        fileobj : path-like or file-like, optional\n            Either the pathname of a file, or an open file handle or file-like\n            object.\n\n        sep : str, optional\n            The character or string with which to separate cards.  By default\n            there is no separator, but one could use ``'\\\\n'``, for example, to\n            separate each card with a new line\n\n        endcard : bool, optional\n            If `True` (default) adds the END card to the end of the header\n            string\n\n        padding : bool, optional\n            If `True` (default) pads the string with spaces out to the next\n            multiple of 2880 characters\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n        \"\"\"\n\n        close_file = fileobj_closed(fileobj)\n\n        if not isinstance(fileobj, _File):\n            fileobj = _File(fileobj, mode='ostream', overwrite=overwrite)\n\n        try:\n            blocks = self.tostring(sep=sep, endcard=endcard, padding=padding)\n            actual_block_size = _block_size(sep)\n            if padding and len(blocks) % actual_block_size != 0:\n                raise OSError(\n                    'Header size ({}) is not a multiple of block '\n                    'size ({}).'.format(\n                        len(blocks) - actual_block_size + BLOCK_SIZE,\n                        BLOCK_SIZE))\n\n            fileobj.flush()\n            fileobj.write(blocks.encode('ascii'))\n            fileobj.flush()\n        finally:\n            if close_file:\n                fileobj.close()\n\n    @classmethod\n    def fromtextfile(cls, fileobj, endcard=False):\n        \"\"\"\n        Read a header from a simple text file or file-like object.\n\n        Equivalent to::\n\n            >>> Header.fromfile(fileobj, sep='\\\\n', endcard=False,\n            ...                 padding=False)\n\n        See Also\n        --------\n        fromfile\n        \"\"\"\n\n        return cls.fromfile(fileobj, sep='\\n', endcard=endcard, padding=False)\n\n    def totextfile(self, fileobj, endcard=False, overwrite=False):\n        \"\"\"\n        Write the header as text to a file or a file-like object.\n\n        Equivalent to::\n\n            >>> Header.tofile(fileobj, sep='\\\\n', endcard=False,\n            ...               padding=False, overwrite=overwrite)\n\n        See Also\n        --------\n        tofile\n        \"\"\"\n\n        self.tofile(fileobj, sep='\\n', endcard=endcard, padding=False,\n                    overwrite=overwrite)\n\n    def clear(self):\n        \"\"\"\n        Remove all cards from the header.\n        \"\"\"\n\n        self._cards = []\n        self._keyword_indices = collections.defaultdict(list)\n        self._rvkc_indices = collections.defaultdict(list)\n\n    def copy(self, strip=False):\n        \"\"\"\n        Make a copy of the :class:`Header`.\n\n        .. versionchanged:: 1.3\n            `copy.copy` and `copy.deepcopy` on a `Header` will call this\n            method.\n\n        Parameters\n        ----------\n        strip : bool, optional\n            If `True`, strip any headers that are specific to one of the\n            standard HDU types, so that this header can be used in a different\n            HDU.\n\n        Returns\n        -------\n        `Header`\n            A new :class:`Header` instance.\n        \"\"\"\n\n        tmp = self.__class__((copy.copy(card) for card in self._cards))\n        if strip:\n            tmp.strip()\n        return tmp\n\n    def __copy__(self):\n        return self.copy()\n\n    def __deepcopy__(self, *args, **kwargs):\n        return self.copy()\n\n    @classmethod\n    def fromkeys(cls, iterable, value=None):\n        \"\"\"\n        Similar to :meth:`dict.fromkeys`--creates a new `Header` from an\n        iterable of keywords and an optional default value.\n\n        This method is not likely to be particularly useful for creating real\n        world FITS headers, but it is useful for testing.\n\n        Parameters\n        ----------\n        iterable\n            Any iterable that returns strings representing FITS keywords.\n\n        value : optional\n            A default value to assign to each keyword; must be a valid type for\n            FITS keywords.\n\n        Returns\n        -------\n        `Header`\n            A new `Header` instance.\n        \"\"\"\n\n        d = cls()\n        if not isinstance(value, tuple):\n            value = (value,)\n        for key in iterable:\n            d.append((key,) + value)\n        return d\n\n    def get(self, key, default=None):\n        \"\"\"\n        Similar to :meth:`dict.get`--returns the value associated with keyword\n        in the header, or a default value if the keyword is not found.\n\n        Parameters\n        ----------\n        key : str\n            A keyword that may or may not be in the header.\n\n        default : optional\n            A default value to return if the keyword is not found in the\n            header.\n\n        Returns\n        -------\n        value: str, number, complex, bool, or ``astropy.io.fits.card.Undefined``\n            The value associated with the given keyword, or the default value\n            if the keyword is not in the header.\n        \"\"\"\n\n        try:\n            return self[key]\n        except (KeyError, IndexError):\n            return default\n\n    def set(self, keyword, value=None, comment=None, before=None, after=None):\n        \"\"\"\n        Set the value and/or comment and/or position of a specified keyword.\n\n        If the keyword does not already exist in the header, a new keyword is\n        created in the specified position, or appended to the end of the header\n        if no position is specified.\n\n        This method is similar to :meth:`Header.update` prior to Astropy v0.1.\n\n        .. note::\n            It should be noted that ``header.set(keyword, value)`` and\n            ``header.set(keyword, value, comment)`` are equivalent to\n            ``header[keyword] = value`` and\n            ``header[keyword] = (value, comment)`` respectively.\n\n            New keywords can also be inserted relative to existing keywords\n            using, for example::\n\n                >>> header.insert('NAXIS1', ('NAXIS', 2, 'Number of axes'))\n\n            to insert before an existing keyword, or::\n\n                >>> header.insert('NAXIS', ('NAXIS1', 4096), after=True)\n\n            to insert after an existing keyword.\n\n            The only advantage of using :meth:`Header.set` is that it\n            easily replaces the old usage of :meth:`Header.update` both\n            conceptually and in terms of function signature.\n\n        Parameters\n        ----------\n        keyword : str\n            A header keyword\n\n        value : str, optional\n            The value to set for the given keyword; if None the existing value\n            is kept, but '' may be used to set a blank value\n\n        comment : str, optional\n            The comment to set for the given keyword; if None the existing\n            comment is kept, but ``''`` may be used to set a blank comment\n\n        before : str, int, optional\n            Name of the keyword, or index of the `Card` before which this card\n            should be located in the header.  The argument ``before`` takes\n            precedence over ``after`` if both specified.\n\n        after : str, int, optional\n            Name of the keyword, or index of the `Card` after which this card\n            should be located in the header.\n\n        \"\"\"\n\n        # Create a temporary card that looks like the one being set; if the\n        # temporary card turns out to be a RVKC this will make it easier to\n        # deal with the idiosyncrasies thereof\n        # Don't try to make a temporary card though if they keyword looks like\n        # it might be a HIERARCH card or is otherwise invalid--this step is\n        # only for validating RVKCs.\n        if (len(keyword) <= KEYWORD_LENGTH and\n            Card._keywd_FSC_RE.match(keyword) and\n                keyword not in self._keyword_indices):\n            new_card = Card(keyword, value, comment)\n            new_keyword = new_card.keyword\n        else:\n            new_keyword = keyword\n\n        if (new_keyword not in Card._commentary_keywords and\n                new_keyword in self):\n            if comment is None:\n                comment = self.comments[keyword]\n            if value is None:\n                value = self[keyword]\n\n            self[keyword] = (value, comment)\n\n            if before is not None or after is not None:\n                card = self._cards[self._cardindex(keyword)]\n                self._relativeinsert(card, before=before, after=after,\n                                     replace=True)\n        elif before is not None or after is not None:\n            self._relativeinsert((keyword, value, comment), before=before,\n                                 after=after)\n        else:\n            self[keyword] = (value, comment)\n\n    def items(self):\n        \"\"\"Like :meth:`dict.items`.\"\"\"\n\n        for card in self._cards:\n            yield card.keyword, None if card.value == UNDEFINED else card.value\n\n    def keys(self):\n        \"\"\"\n        Like :meth:`dict.keys`--iterating directly over the `Header`\n        instance has the same behavior.\n        \"\"\"\n\n        for card in self._cards:\n            yield card.keyword\n\n    def values(self):\n        \"\"\"Like :meth:`dict.values`.\"\"\"\n\n        for card in self._cards:\n            yield None if card.value == UNDEFINED else card.value\n\n    def pop(self, *args):\n        \"\"\"\n        Works like :meth:`list.pop` if no arguments or an index argument are\n        supplied; otherwise works like :meth:`dict.pop`.\n        \"\"\"\n\n        if len(args) > 2:\n            raise TypeError(f'Header.pop expected at most 2 arguments, got {len(args)}')\n\n        if len(args) == 0:\n            key = -1\n        else:\n            key = args[0]\n\n        try:\n            value = self[key]\n        except (KeyError, IndexError):\n            if len(args) == 2:\n                return args[1]\n            raise\n\n        del self[key]\n        return value\n\n    def popitem(self):\n        \"\"\"Similar to :meth:`dict.popitem`.\"\"\"\n\n        try:\n            k, v = next(self.items())\n        except StopIteration:\n            raise KeyError('Header is empty')\n        del self[k]\n        return k, v\n\n    def setdefault(self, key, default=None):\n        \"\"\"Similar to :meth:`dict.setdefault`.\"\"\"\n\n        try:\n            return self[key]\n        except (KeyError, IndexError):\n            self[key] = default\n        return default\n\n    def update(self, *args, **kwargs):\n        \"\"\"\n        Update the Header with new keyword values, updating the values of\n        existing keywords and appending new keywords otherwise; similar to\n        `dict.update`.\n\n        `update` accepts either a dict-like object or an iterable.  In the\n        former case the keys must be header keywords and the values may be\n        either scalar values or (value, comment) tuples.  In the case of an\n        iterable the items must be (keyword, value) tuples or (keyword, value,\n        comment) tuples.\n\n        Arbitrary arguments are also accepted, in which case the update() is\n        called again with the kwargs dict as its only argument.  That is,\n\n        ::\n\n            >>> header.update(NAXIS1=100, NAXIS2=100)\n\n        is equivalent to::\n\n            header.update({'NAXIS1': 100, 'NAXIS2': 100})\n\n        .. warning::\n            As this method works similarly to `dict.update` it is very\n            different from the ``Header.update()`` method in Astropy v0.1.\n            Use of the old API was\n            **deprecated** for a long time and is now removed. Most uses of the\n            old API can be replaced as follows:\n\n            * Replace ::\n\n                  header.update(keyword, value)\n\n              with ::\n\n                  header[keyword] = value\n\n            * Replace ::\n\n                  header.update(keyword, value, comment=comment)\n\n              with ::\n\n                  header[keyword] = (value, comment)\n\n            * Replace ::\n\n                  header.update(keyword, value, before=before_keyword)\n\n              with ::\n\n                  header.insert(before_keyword, (keyword, value))\n\n            * Replace ::\n\n                  header.update(keyword, value, after=after_keyword)\n\n              with ::\n\n                  header.insert(after_keyword, (keyword, value),\n                                after=True)\n\n            See also :meth:`Header.set` which is a new method that provides an\n            interface similar to the old ``Header.update()`` and may help make\n            transition a little easier.\n\n        \"\"\"\n\n        if args:\n            other = args[0]\n        else:\n            other = None\n\n        def update_from_dict(k, v):\n            if not isinstance(v, tuple):\n                card = Card(k, v)\n            elif 0 < len(v) <= 2:\n                card = Card(*((k,) + v))\n            else:\n                raise ValueError(\n                    'Header update value for key %r is invalid; the '\n                    'value must be either a scalar, a 1-tuple '\n                    'containing the scalar value, or a 2-tuple '\n                    'containing the value and a comment string.' % k)\n            self._update(card)\n\n        if other is None:\n            pass\n        elif isinstance(other, Header):\n            for card in other.cards:\n                self._update(card)\n        elif hasattr(other, 'items'):\n            for k, v in other.items():\n                update_from_dict(k, v)\n        elif hasattr(other, 'keys'):\n            for k in other.keys():\n                update_from_dict(k, other[k])\n        else:\n            for idx, card in enumerate(other):\n                if isinstance(card, Card):\n                    self._update(card)\n                elif isinstance(card, tuple) and (1 < len(card) <= 3):\n                    self._update(Card(*card))\n                else:\n                    raise ValueError(\n                        'Header update sequence item #{} is invalid; '\n                        'the item must either be a 2-tuple containing '\n                        'a keyword and value, or a 3-tuple containing '\n                        'a keyword, value, and comment string.'.format(idx))\n        if kwargs:\n            self.update(kwargs)\n\n    def append(self, card=None, useblanks=True, bottom=False, end=False):\n        \"\"\"\n        Appends a new keyword+value card to the end of the Header, similar\n        to `list.append`.\n\n        By default if the last cards in the Header have commentary keywords,\n        this will append the new keyword before the commentary (unless the new\n        keyword is also commentary).\n\n        Also differs from `list.append` in that it can be called with no\n        arguments: In this case a blank card is appended to the end of the\n        Header.  In the case all the keyword arguments are ignored.\n\n        Parameters\n        ----------\n        card : str, tuple\n            A keyword or a (keyword, value, [comment]) tuple representing a\n            single header card; the comment is optional in which case a\n            2-tuple may be used\n\n        useblanks : bool, optional\n            If there are blank cards at the end of the Header, replace the\n            first blank card so that the total number of cards in the Header\n            does not increase.  Otherwise preserve the number of blank cards.\n\n        bottom : bool, optional\n            If True, instead of appending after the last non-commentary card,\n            append after the last non-blank card.\n\n        end : bool, optional\n            If True, ignore the useblanks and bottom options, and append at the\n            very end of the Header.\n\n        \"\"\"\n\n        if isinstance(card, str):\n            card = Card(card)\n        elif isinstance(card, tuple):\n            card = Card(*card)\n        elif card is None:\n            card = Card()\n        elif not isinstance(card, Card):\n            raise ValueError(\n                'The value appended to a Header must be either a keyword or '\n                '(keyword, value, [comment]) tuple; got: {!r}'.format(card))\n\n        if not end and card.is_blank:\n            # Blank cards should always just be appended to the end\n            end = True\n\n        if end:\n            self._cards.append(card)\n            idx = len(self._cards) - 1\n        else:\n            idx = len(self._cards) - 1\n            while idx >= 0 and self._cards[idx].is_blank:\n                idx -= 1\n\n            if not bottom and card.keyword not in Card._commentary_keywords:\n                while (idx >= 0 and\n                       self._cards[idx].keyword in Card._commentary_keywords):\n                    idx -= 1\n\n            idx += 1\n            self._cards.insert(idx, card)\n            self._updateindices(idx)\n\n        keyword = Card.normalize_keyword(card.keyword)\n        self._keyword_indices[keyword].append(idx)\n        if card.field_specifier is not None:\n            self._rvkc_indices[card.rawkeyword].append(idx)\n\n        if not end:\n            # If the appended card was a commentary card, and it was appended\n            # before existing cards with the same keyword, the indices for\n            # cards with that keyword may have changed\n            if not bottom and card.keyword in Card._commentary_keywords:\n                self._keyword_indices[keyword].sort()\n\n            # Finally, if useblanks, delete a blank cards from the end\n            if useblanks and self._countblanks():\n                # Don't do this unless there is at least one blanks at the end\n                # of the header; we need to convert the card to its string\n                # image to see how long it is.  In the vast majority of cases\n                # this will just be 80 (Card.length) but it may be longer for\n                # CONTINUE cards\n                self._useblanks(len(str(card)) // Card.length)\n\n        self._modified = True\n\n    def extend(self, cards, strip=True, unique=False, update=False,\n               update_first=False, useblanks=True, bottom=False, end=False):\n        \"\"\"\n        Appends multiple keyword+value cards to the end of the header, similar\n        to `list.extend`.\n\n        Parameters\n        ----------\n        cards : iterable\n            An iterable of (keyword, value, [comment]) tuples; see\n            `Header.append`.\n\n        strip : bool, optional\n            Remove any keywords that have meaning only to specific types of\n            HDUs, so that only more general keywords are added from extension\n            Header or Card list (default: `True`).\n\n        unique : bool, optional\n            If `True`, ensures that no duplicate keywords are appended;\n            keywords already in this header are simply discarded.  The\n            exception is commentary keywords (COMMENT, HISTORY, etc.): they are\n            only treated as duplicates if their values match.\n\n        update : bool, optional\n            If `True`, update the current header with the values and comments\n            from duplicate keywords in the input header.  This supersedes the\n            ``unique`` argument.  Commentary keywords are treated the same as\n            if ``unique=True``.\n\n        update_first : bool, optional\n            If the first keyword in the header is 'SIMPLE', and the first\n            keyword in the input header is 'XTENSION', the 'SIMPLE' keyword is\n            replaced by the 'XTENSION' keyword.  Likewise if the first keyword\n            in the header is 'XTENSION' and the first keyword in the input\n            header is 'SIMPLE', the 'XTENSION' keyword is replaced by the\n            'SIMPLE' keyword.  This behavior is otherwise dumb as to whether or\n            not the resulting header is a valid primary or extension header.\n            This is mostly provided to support backwards compatibility with the\n            old ``Header.fromTxtFile`` method, and only applies if\n            ``update=True``.\n\n        useblanks, bottom, end : bool, optional\n            These arguments are passed to :meth:`Header.append` while appending\n            new cards to the header.\n        \"\"\"\n\n        temp = self.__class__(cards)\n        if strip:\n            temp.strip()\n\n        if len(self):\n            first = self._cards[0].keyword\n        else:\n            first = None\n\n        # We don't immediately modify the header, because first we need to sift\n        # out any duplicates in the new header prior to adding them to the\n        # existing header, but while *allowing* duplicates from the header\n        # being extended from (see ticket #156)\n        extend_cards = []\n\n        for idx, card in enumerate(temp.cards):\n            keyword = card.keyword\n            if keyword not in Card._commentary_keywords:\n                if unique and not update and keyword in self:\n                    continue\n                elif update:\n                    if idx == 0 and update_first:\n                        # Dumbly update the first keyword to either SIMPLE or\n                        # XTENSION as the case may be, as was in the case in\n                        # Header.fromTxtFile\n                        if ((keyword == 'SIMPLE' and first == 'XTENSION') or\n                                (keyword == 'XTENSION' and first == 'SIMPLE')):\n                            del self[0]\n                            self.insert(0, card)\n                        else:\n                            self[keyword] = (card.value, card.comment)\n                    elif keyword in self:\n                        self[keyword] = (card.value, card.comment)\n                    else:\n                        extend_cards.append(card)\n                else:\n                    extend_cards.append(card)\n            else:\n                if (unique or update) and keyword in self:\n                    if card.is_blank:\n                        extend_cards.append(card)\n                        continue\n\n                    for value in self[keyword]:\n                        if value == card.value:\n                            break\n                    else:\n                        extend_cards.append(card)\n                else:\n                    extend_cards.append(card)\n\n        for card in extend_cards:\n            self.append(card, useblanks=useblanks, bottom=bottom, end=end)\n\n    def count(self, keyword):\n        \"\"\"\n        Returns the count of the given keyword in the header, similar to\n        `list.count` if the Header object is treated as a list of keywords.\n\n        Parameters\n        ----------\n        keyword : str\n            The keyword to count instances of in the header\n\n        \"\"\"\n\n        keyword = Card.normalize_keyword(keyword)\n\n        # We have to look before we leap, since otherwise _keyword_indices,\n        # being a defaultdict, will create an entry for the nonexistent keyword\n        if keyword not in self._keyword_indices:\n            raise KeyError(f\"Keyword {keyword!r} not found.\")\n\n        return len(self._keyword_indices[keyword])\n\n    def index(self, keyword, start=None, stop=None):\n        \"\"\"\n        Returns the index if the first instance of the given keyword in the\n        header, similar to `list.index` if the Header object is treated as a\n        list of keywords.\n\n        Parameters\n        ----------\n        keyword : str\n            The keyword to look up in the list of all keywords in the header\n\n        start : int, optional\n            The lower bound for the index\n\n        stop : int, optional\n            The upper bound for the index\n\n        \"\"\"\n\n        if start is None:\n            start = 0\n\n        if stop is None:\n            stop = len(self._cards)\n\n        if stop < start:\n            step = -1\n        else:\n            step = 1\n\n        norm_keyword = Card.normalize_keyword(keyword)\n\n        for idx in range(start, stop, step):\n            if self._cards[idx].keyword.upper() == norm_keyword:\n                return idx\n        else:\n            raise ValueError(f'The keyword {keyword!r} is not in the  header.')\n\n    def insert(self, key, card, useblanks=True, after=False):\n        \"\"\"\n        Inserts a new keyword+value card into the Header at a given location,\n        similar to `list.insert`.\n\n        Parameters\n        ----------\n        key : int, str, or tuple\n            The index into the list of header keywords before which the\n            new keyword should be inserted, or the name of a keyword before\n            which the new keyword should be inserted.  Can also accept a\n            (keyword, index) tuple for inserting around duplicate keywords.\n\n        card : str, tuple\n            A keyword or a (keyword, value, [comment]) tuple; see\n            `Header.append`\n\n        useblanks : bool, optional\n            If there are blank cards at the end of the Header, replace the\n            first blank card so that the total number of cards in the Header\n            does not increase.  Otherwise preserve the number of blank cards.\n\n        after : bool, optional\n            If set to `True`, insert *after* the specified index or keyword,\n            rather than before it.  Defaults to `False`.\n        \"\"\"\n\n        if not isinstance(key, numbers.Integral):\n            # Don't pass through ints to _cardindex because it will not take\n            # kindly to indices outside the existing number of cards in the\n            # header, which insert needs to be able to support (for example\n            # when inserting into empty headers)\n            idx = self._cardindex(key)\n        else:\n            idx = key\n\n        if after:\n            if idx == -1:\n                idx = len(self._cards)\n            else:\n                idx += 1\n\n        if idx >= len(self._cards):\n            # This is just an append (Though it must be an append absolutely to\n            # the bottom, ignoring blanks, etc.--the point of the insert method\n            # is that you get exactly what you asked for with no surprises)\n            self.append(card, end=True)\n            return\n\n        if isinstance(card, str):\n            card = Card(card)\n        elif isinstance(card, tuple):\n            card = Card(*card)\n        elif not isinstance(card, Card):\n            raise ValueError(\n                'The value inserted into a Header must be either a keyword or '\n                '(keyword, value, [comment]) tuple; got: {!r}'.format(card))\n\n        self._cards.insert(idx, card)\n\n        keyword = card.keyword\n\n        # If idx was < 0, determine the actual index according to the rules\n        # used by list.insert()\n        if idx < 0:\n            idx += len(self._cards) - 1\n            if idx < 0:\n                idx = 0\n\n        # All the keyword indices above the insertion point must be updated\n        self._updateindices(idx)\n\n        keyword = Card.normalize_keyword(keyword)\n        self._keyword_indices[keyword].append(idx)\n        count = len(self._keyword_indices[keyword])\n        if count > 1:\n            # There were already keywords with this same name\n            if keyword not in Card._commentary_keywords:\n                warnings.warn(\n                    'A {!r} keyword already exists in this header.  Inserting '\n                    'duplicate keyword.'.format(keyword), AstropyUserWarning)\n            self._keyword_indices[keyword].sort()\n\n        if card.field_specifier is not None:\n            # Update the index of RVKC as well\n            rvkc_indices = self._rvkc_indices[card.rawkeyword]\n            rvkc_indices.append(idx)\n            rvkc_indices.sort()\n\n        if useblanks:\n            self._useblanks(len(str(card)) // Card.length)\n\n        self._modified = True\n\n    def remove(self, keyword, ignore_missing=False, remove_all=False):\n        \"\"\"\n        Removes the first instance of the given keyword from the header similar\n        to `list.remove` if the Header object is treated as a list of keywords.\n\n        Parameters\n        ----------\n        keyword : str\n            The keyword of which to remove the first instance in the header.\n\n        ignore_missing : bool, optional\n            When True, ignores missing keywords.  Otherwise, if the keyword\n            is not present in the header a KeyError is raised.\n\n        remove_all : bool, optional\n            When True, all instances of keyword will be removed.\n            Otherwise only the first instance of the given keyword is removed.\n\n        \"\"\"\n        keyword = Card.normalize_keyword(keyword)\n        if keyword in self._keyword_indices:\n            del self[self._keyword_indices[keyword][0]]\n            if remove_all:\n                while keyword in self._keyword_indices:\n                    del self[self._keyword_indices[keyword][0]]\n        elif not ignore_missing:\n            raise KeyError(f\"Keyword '{keyword}' not found.\")\n\n    def rename_keyword(self, oldkeyword, newkeyword, force=False):\n        \"\"\"\n        Rename a card's keyword in the header.\n\n        Parameters\n        ----------\n        oldkeyword : str or int\n            Old keyword or card index\n\n        newkeyword : str\n            New keyword\n\n        force : bool, optional\n            When `True`, if the new keyword already exists in the header, force\n            the creation of a duplicate keyword. Otherwise a\n            `ValueError` is raised.\n        \"\"\"\n\n        oldkeyword = Card.normalize_keyword(oldkeyword)\n        newkeyword = Card.normalize_keyword(newkeyword)\n\n        if newkeyword == 'CONTINUE':\n            raise ValueError('Can not rename to CONTINUE')\n\n        if (newkeyword in Card._commentary_keywords or\n                oldkeyword in Card._commentary_keywords):\n            if not (newkeyword in Card._commentary_keywords and\n                    oldkeyword in Card._commentary_keywords):\n                raise ValueError('Regular and commentary keys can not be '\n                                 'renamed to each other.')\n        elif not force and newkeyword in self:\n            raise ValueError(f'Intended keyword {newkeyword} already exists in header.')\n\n        idx = self.index(oldkeyword)\n        card = self._cards[idx]\n        del self[idx]\n        self.insert(idx, (newkeyword, card.value, card.comment))\n\n    def add_history(self, value, before=None, after=None):\n        \"\"\"\n        Add a ``HISTORY`` card.\n\n        Parameters\n        ----------\n        value : str\n            History text to be added.\n\n        before : str or int, optional\n            Same as in `Header.update`\n\n        after : str or int, optional\n            Same as in `Header.update`\n        \"\"\"\n\n        self._add_commentary('HISTORY', value, before=before, after=after)\n\n    def add_comment(self, value, before=None, after=None):\n        \"\"\"\n        Add a ``COMMENT`` card.\n\n        Parameters\n        ----------\n        value : str\n            Text to be added.\n\n        before : str or int, optional\n            Same as in `Header.update`\n\n        after : str or int, optional\n            Same as in `Header.update`\n        \"\"\"\n\n        self._add_commentary('COMMENT', value, before=before, after=after)\n\n    def add_blank(self, value='', before=None, after=None):\n        \"\"\"\n        Add a blank card.\n\n        Parameters\n        ----------\n        value : str, optional\n            Text to be added.\n\n        before : str or int, optional\n            Same as in `Header.update`\n\n        after : str or int, optional\n            Same as in `Header.update`\n        \"\"\"\n\n        self._add_commentary('', value, before=before, after=after)\n\n    def strip(self):\n        \"\"\"\n        Strip cards specific to a certain kind of header.\n\n        Strip cards like ``SIMPLE``, ``BITPIX``, etc. so the rest of\n        the header can be used to reconstruct another kind of header.\n        \"\"\"\n\n        # TODO: Previously this only deleted some cards specific to an HDU if\n        # _hdutype matched that type.  But it seemed simple enough to just\n        # delete all desired cards anyways, and just ignore the KeyErrors if\n        # they don't exist.\n        # However, it might be desirable to make this extendable somehow--have\n        # a way for HDU classes to specify some headers that are specific only\n        # to that type, and should be removed otherwise.\n\n        naxis = self.get('NAXIS', 0)\n        tfields = self.get('TFIELDS', 0)\n\n        for idx in range(naxis):\n            self.remove('NAXIS' + str(idx + 1), ignore_missing=True)\n\n        for name in ('TFORM', 'TSCAL', 'TZERO', 'TNULL', 'TTYPE',\n                     'TUNIT', 'TDISP', 'TDIM', 'THEAP', 'TBCOL'):\n            for idx in range(tfields):\n                self.remove(name + str(idx + 1), ignore_missing=True)\n\n        for name in ('SIMPLE', 'XTENSION', 'BITPIX', 'NAXIS', 'EXTEND',\n                     'PCOUNT', 'GCOUNT', 'GROUPS', 'BSCALE', 'BZERO',\n                     'TFIELDS'):\n            self.remove(name, ignore_missing=True)\n\n    def _update(self, card):\n        \"\"\"\n        The real update code.  If keyword already exists, its value and/or\n        comment will be updated.  Otherwise a new card will be appended.\n\n        This will not create a duplicate keyword except in the case of\n        commentary cards.  The only other way to force creation of a duplicate\n        is to use the insert(), append(), or extend() methods.\n        \"\"\"\n\n        keyword, value, comment = card\n\n        # Lookups for existing/known keywords are case-insensitive\n        keyword = keyword.strip().upper()\n        if keyword.startswith('HIERARCH '):\n            keyword = keyword[9:]\n\n        if (keyword not in Card._commentary_keywords and\n                keyword in self._keyword_indices):\n            # Easy; just update the value/comment\n            idx = self._keyword_indices[keyword][0]\n            existing_card = self._cards[idx]\n            existing_card.value = value\n            if comment is not None:\n                # '' should be used to explicitly blank a comment\n                existing_card.comment = comment\n            if existing_card._modified:\n                self._modified = True\n        elif keyword in Card._commentary_keywords:\n            cards = self._splitcommentary(keyword, value)\n            if keyword in self._keyword_indices:\n                # Append after the last keyword of the same type\n                idx = self.index(keyword, start=len(self) - 1, stop=-1)\n                isblank = not (keyword or value or comment)\n                for c in reversed(cards):\n                    self.insert(idx + 1, c, useblanks=(not isblank))\n            else:\n                for c in cards:\n                    self.append(c, bottom=True)\n        else:\n            # A new keyword! self.append() will handle updating _modified\n            self.append(card)\n\n    def _cardindex(self, key):\n        \"\"\"Returns an index into the ._cards list given a valid lookup key.\"\"\"\n\n        # This used to just set key = (key, 0) and then go on to act as if the\n        # user passed in a tuple, but it's much more common to just be given a\n        # string as the key, so optimize more for that case\n        if isinstance(key, str):\n            keyword = key\n            n = 0\n        elif isinstance(key, numbers.Integral):\n            # If < 0, determine the actual index\n            if key < 0:\n                key += len(self._cards)\n            if key < 0 or key >= len(self._cards):\n                raise IndexError('Header index out of range.')\n            return key\n        elif isinstance(key, slice):\n            return key\n        elif isinstance(key, tuple):\n            if (len(key) != 2 or not isinstance(key[0], str) or\n                    not isinstance(key[1], numbers.Integral)):\n                raise ValueError(\n                    'Tuple indices must be 2-tuples consisting of a '\n                    'keyword string and an integer index.')\n            keyword, n = key\n        else:\n            raise ValueError(\n                'Header indices must be either a string, a 2-tuple, or '\n                'an integer.')\n\n        keyword = Card.normalize_keyword(keyword)\n        # Returns the index into _cards for the n-th card with the given\n        # keyword (where n is 0-based)\n        indices = self._keyword_indices.get(keyword, None)\n\n        if keyword and not indices:\n            if len(keyword) > KEYWORD_LENGTH or '.' in keyword:\n                raise KeyError(f\"Keyword {keyword!r} not found.\")\n            else:\n                # Maybe it's a RVKC?\n                indices = self._rvkc_indices.get(keyword, None)\n\n        if not indices:\n            raise KeyError(f\"Keyword {keyword!r} not found.\")\n\n        try:\n            return indices[n]\n        except IndexError:\n            raise IndexError('There are only {} {!r} cards in the '\n                             'header.'.format(len(indices), keyword))\n\n    def _keyword_from_index(self, idx):\n        \"\"\"\n        Given an integer index, return the (keyword, repeat) tuple that index\n        refers to.  For most keywords the repeat will always be zero, but it\n        may be greater than zero for keywords that are duplicated (especially\n        commentary keywords).\n\n        In a sense this is the inverse of self.index, except that it also\n        supports duplicates.\n        \"\"\"\n\n        if idx < 0:\n            idx += len(self._cards)\n\n        keyword = self._cards[idx].keyword\n        keyword = Card.normalize_keyword(keyword)\n        repeat = self._keyword_indices[keyword].index(idx)\n        return keyword, repeat\n\n    def _relativeinsert(self, card, before=None, after=None, replace=False):\n        \"\"\"\n        Inserts a new card before or after an existing card; used to\n        implement support for the legacy before/after keyword arguments to\n        Header.update().\n\n        If replace=True, move an existing card with the same keyword.\n        \"\"\"\n\n        if before is None:\n            insertionkey = after\n        else:\n            insertionkey = before\n\n        def get_insertion_idx():\n            if not (isinstance(insertionkey, numbers.Integral) and\n                    insertionkey >= len(self._cards)):\n                idx = self._cardindex(insertionkey)\n            else:\n                idx = insertionkey\n\n            if before is None:\n                idx += 1\n\n            return idx\n\n        if replace:\n            # The card presumably already exists somewhere in the header.\n            # Check whether or not we actually have to move it; if it does need\n            # to be moved we just delete it and then it will be reinserted\n            # below\n            old_idx = self._cardindex(card.keyword)\n            insertion_idx = get_insertion_idx()\n\n            if (insertion_idx >= len(self._cards) and\n                    old_idx == len(self._cards) - 1):\n                # The card would be appended to the end, but it's already at\n                # the end\n                return\n\n            if before is not None:\n                if old_idx == insertion_idx - 1:\n                    return\n            elif after is not None and old_idx == insertion_idx:\n                return\n\n            del self[old_idx]\n\n        # Even if replace=True, the insertion idx may have changed since the\n        # old card was deleted\n        idx = get_insertion_idx()\n\n        if card[0] in Card._commentary_keywords:\n            cards = reversed(self._splitcommentary(card[0], card[1]))\n        else:\n            cards = [card]\n        for c in cards:\n            self.insert(idx, c)\n\n    def _updateindices(self, idx, increment=True):\n        \"\"\"\n        For all cards with index above idx, increment or decrement its index\n        value in the keyword_indices dict.\n        \"\"\"\n        if idx > len(self._cards):\n            # Save us some effort\n            return\n\n        increment = 1 if increment else -1\n\n        for index_sets in (self._keyword_indices, self._rvkc_indices):\n            for indices in index_sets.values():\n                for jdx, keyword_index in enumerate(indices):\n                    if keyword_index >= idx:\n                        indices[jdx] += increment\n\n    def _countblanks(self):\n        \"\"\"Returns the number of blank cards at the end of the Header.\"\"\"\n\n        for idx in range(1, len(self._cards)):\n            if not self._cards[-idx].is_blank:\n                return idx - 1\n        return 0\n\n    def _useblanks(self, count):\n        for _ in range(count):\n            if self._cards[-1].is_blank:\n                del self[-1]\n            else:\n                break\n\n    def _haswildcard(self, keyword):\n        \"\"\"Return `True` if the input keyword contains a wildcard pattern.\"\"\"\n\n        return (isinstance(keyword, str) and\n                (keyword.endswith('...') or '*' in keyword or '?' in keyword))\n\n    def _wildcardmatch(self, pattern):\n        \"\"\"\n        Returns a list of indices of the cards matching the given wildcard\n        pattern.\n\n         * '*' matches 0 or more characters\n         * '?' matches a single character\n         * '...' matches 0 or more of any non-whitespace character\n        \"\"\"\n\n        pattern = pattern.replace('*', r'.*').replace('?', r'.')\n        pattern = pattern.replace('...', r'\\S*') + '$'\n        pattern_re = re.compile(pattern, re.I)\n\n        return [idx for idx, card in enumerate(self._cards)\n                if pattern_re.match(card.keyword)]\n\n    def _set_slice(self, key, value, target):\n        \"\"\"\n        Used to implement Header.__setitem__ and CardAccessor.__setitem__.\n        \"\"\"\n\n        if isinstance(key, slice) or self._haswildcard(key):\n            if isinstance(key, slice):\n                indices = range(*key.indices(len(target)))\n            else:\n                indices = self._wildcardmatch(key)\n\n            if isinstance(value, str) or not isiterable(value):\n                value = itertools.repeat(value, len(indices))\n\n            for idx, val in zip(indices, value):\n                target[idx] = val\n\n            return True\n\n        return False\n\n    def _splitcommentary(self, keyword, value):\n        \"\"\"\n        Given a commentary keyword and value, returns a list of the one or more\n        cards needed to represent the full value.  This is primarily used to\n        create the multiple commentary cards needed to represent a long value\n        that won't fit into a single commentary card.\n        \"\"\"\n\n        # The maximum value in each card can be the maximum card length minus\n        # the maximum key length (which can include spaces if they key length\n        # less than 8\n        maxlen = Card.length - KEYWORD_LENGTH\n        valuestr = str(value)\n\n        if len(valuestr) <= maxlen:\n            # The value can fit in a single card\n            cards = [Card(keyword, value)]\n        else:\n            # The value must be split across multiple consecutive commentary\n            # cards\n            idx = 0\n            cards = []\n            while idx < len(valuestr):\n                cards.append(Card(keyword, valuestr[idx:idx + maxlen]))\n                idx += maxlen\n        return cards\n\n    def _add_commentary(self, key, value, before=None, after=None):\n        \"\"\"\n        Add a commentary card.\n\n        If ``before`` and ``after`` are `None`, add to the last occurrence\n        of cards of the same name (except blank card).  If there is no\n        card (or blank card), append at the end.\n        \"\"\"\n\n        if before is not None or after is not None:\n            self._relativeinsert((key, value), before=before,\n                                 after=after)\n        else:\n            self[key] = value\n\n\ncollections.abc.MutableSequence.register(Header)\ncollections.abc.MutableMapping.register(Header)\n\n\nclass _DelayedHeader:\n    \"\"\"\n    Descriptor used to create the Header object from the header string that\n    was stored in HDU._header_str when parsing the file.\n    \"\"\"\n\n    def __get__(self, obj, owner=None):\n        try:\n            return obj.__dict__['_header']\n        except KeyError:\n            if obj._header_str is not None:\n                hdr = Header.fromstring(obj._header_str)\n                obj._header_str = None\n            else:\n                raise AttributeError(\"'{}' object has no attribute '_header'\"\n                                     .format(obj.__class__.__name__))\n\n            obj.__dict__['_header'] = hdr\n            return hdr\n\n    def __set__(self, obj, val):\n        obj.__dict__['_header'] = val\n\n    def __delete__(self, obj):\n        del obj.__dict__['_header']\n\n\nclass _BasicHeaderCards:\n    \"\"\"\n    This class allows to access cards with the _BasicHeader.cards attribute.\n\n    This is needed because during the HDU class detection, some HDUs uses\n    the .cards interface.  Cards cannot be modified here as the _BasicHeader\n    object will be deleted once the HDU object is created.\n\n    \"\"\"\n\n    def __init__(self, header):\n        self.header = header\n\n    def __getitem__(self, key):\n        # .cards is a list of cards, so key here is an integer.\n        # get the keyword name from its index.\n        key = self.header._keys[key]\n        # then we get the card from the _BasicHeader._cards list, or parse it\n        # if needed.\n        try:\n            return self.header._cards[key]\n        except KeyError:\n            cardstr = self.header._raw_cards[key]\n            card = Card.fromstring(cardstr)\n            self.header._cards[key] = card\n            return card\n\n\nclass _BasicHeader(collections.abc.Mapping):\n    \"\"\"This class provides a fast header parsing, without all the additional\n    features of the Header class. Here only standard keywords are parsed, no\n    support for CONTINUE, HIERARCH, COMMENT, HISTORY, or rvkc.\n\n    The raw card images are stored and parsed only if needed. The idea is that\n    to create the HDU objects, only a small subset of standard cards is needed.\n    Once a card is parsed, which is deferred to the Card class, the Card object\n    is kept in a cache. This is useful because a small subset of cards is used\n    a lot in the HDU creation process (NAXIS, XTENSION, ...).\n\n    \"\"\"\n\n    def __init__(self, cards):\n        # dict of (keywords, card images)\n        self._raw_cards = cards\n        self._keys = list(cards.keys())\n        # dict of (keyword, Card object) storing the parsed cards\n        self._cards = {}\n        # the _BasicHeaderCards object allows to access Card objects from\n        # keyword indices\n        self.cards = _BasicHeaderCards(self)\n\n        self._modified = False\n\n    def __getitem__(self, key):\n        if isinstance(key, numbers.Integral):\n            key = self._keys[key]\n\n        try:\n            return self._cards[key].value\n        except KeyError:\n            # parse the Card and store it\n            cardstr = self._raw_cards[key]\n            self._cards[key] = card = Card.fromstring(cardstr)\n            return card.value\n\n    def __len__(self):\n        return len(self._raw_cards)\n\n    def __iter__(self):\n        return iter(self._raw_cards)\n\n    def index(self, keyword):\n        return self._keys.index(keyword)\n\n    @classmethod\n    def fromfile(cls, fileobj):\n        \"\"\"The main method to parse a FITS header from a file. The parsing is\n        done with the parse_header function implemented in Cython.\"\"\"\n\n        close_file = False\n        if isinstance(fileobj, str):\n            fileobj = open(fileobj, 'rb')\n            close_file = True\n\n        try:\n            header_str, cards = parse_header(fileobj)\n            _check_padding(header_str, BLOCK_SIZE, False)\n            return header_str, cls(cards)\n        finally:\n            if close_file:\n                fileobj.close()\n\n\nclass _CardAccessor:\n    \"\"\"\n    This is a generic class for wrapping a Header in such a way that you can\n    use the header's slice/filtering capabilities to return a subset of cards\n    and do something with them.\n\n    This is sort of the opposite notion of the old CardList class--whereas\n    Header used to use CardList to get lists of cards, this uses Header to get\n    lists of cards.\n    \"\"\"\n\n    # TODO: Consider giving this dict/list methods like Header itself\n    def __init__(self, header):\n        self._header = header\n\n    def __repr__(self):\n        return '\\n'.join(repr(c) for c in self._header._cards)\n\n    def __len__(self):\n        return len(self._header._cards)\n\n    def __iter__(self):\n        return iter(self._header._cards)\n\n    def __eq__(self, other):\n        # If the `other` item is a scalar we will still treat it as equal if\n        # this _CardAccessor only contains one item\n        if not isiterable(other) or isinstance(other, str):\n            if len(self) == 1:\n                other = [other]\n            else:\n                return False\n\n        for a, b in itertools.zip_longest(self, other):\n            if a != b:\n                return False\n        else:\n            return True\n\n    def __ne__(self, other):\n        return not (self == other)\n\n    def __getitem__(self, item):\n        if isinstance(item, slice) or self._header._haswildcard(item):\n            return self.__class__(self._header[item])\n\n        idx = self._header._cardindex(item)\n        return self._header._cards[idx]\n\n    def _setslice(self, item, value):\n        \"\"\"\n        Helper for implementing __setitem__ on _CardAccessor subclasses; slices\n        should always be handled in this same way.\n        \"\"\"\n\n        if isinstance(item, slice) or self._header._haswildcard(item):\n            if isinstance(item, slice):\n                indices = range(*item.indices(len(self)))\n            else:\n                indices = self._header._wildcardmatch(item)\n            if isinstance(value, str) or not isiterable(value):\n                value = itertools.repeat(value, len(indices))\n            for idx, val in zip(indices, value):\n                self[idx] = val\n            return True\n        return False\n\n\nclass _HeaderComments(_CardAccessor):\n    \"\"\"\n    A class used internally by the Header class for the Header.comments\n    attribute access.\n\n    This object can be used to display all the keyword comments in the Header,\n    or look up the comments on specific keywords.  It allows all the same forms\n    of keyword lookup as the Header class itself, but returns comments instead\n    of values.\n    \"\"\"\n\n    def __iter__(self):\n        for card in self._header._cards:\n            yield card.comment\n\n    def __repr__(self):\n        \"\"\"Returns a simple list of all keywords and their comments.\"\"\"\n\n        keyword_length = KEYWORD_LENGTH\n        for card in self._header._cards:\n            keyword_length = max(keyword_length, len(card.keyword))\n        return '\\n'.join('{:>{len}}  {}'.format(c.keyword, c.comment,\n                                                len=keyword_length)\n                         for c in self._header._cards)\n\n    def __getitem__(self, item):\n        \"\"\"\n        Slices and filter strings return a new _HeaderComments containing the\n        returned cards.  Otherwise the comment of a single card is returned.\n        \"\"\"\n\n        item = super().__getitem__(item)\n        if isinstance(item, _HeaderComments):\n            # The item key was a slice\n            return item\n        return item.comment\n\n    def __setitem__(self, item, comment):\n        \"\"\"\n        Set/update the comment on specified card or cards.\n\n        Slice/filter updates work similarly to how Header.__setitem__ works.\n        \"\"\"\n\n        if self._header._set_slice(item, comment, self):\n            return\n\n        # In this case, key/index errors should be raised; don't update\n        # comments of nonexistent cards\n        idx = self._header._cardindex(item)\n        value = self._header[idx]\n        self._header[idx] = (value, comment)\n\n\nclass _HeaderCommentaryCards(_CardAccessor):\n    \"\"\"\n    This is used to return a list-like sequence over all the values in the\n    header for a given commentary keyword, such as HISTORY.\n    \"\"\"\n\n    def __init__(self, header, keyword=''):\n        super().__init__(header)\n        self._keyword = keyword\n        self._count = self._header.count(self._keyword)\n        self._indices = slice(self._count).indices(self._count)\n\n    # __len__ and __iter__ need to be overridden from the base class due to the\n    # different approach this class has to take for slicing\n    def __len__(self):\n        return len(range(*self._indices))\n\n    def __iter__(self):\n        for idx in range(*self._indices):\n            yield self._header[(self._keyword, idx)]\n\n    def __repr__(self):\n        return '\\n'.join(str(x) for x in self)\n\n    def __getitem__(self, idx):\n        if isinstance(idx, slice):\n            n = self.__class__(self._header, self._keyword)\n            n._indices = idx.indices(self._count)\n            return n\n        elif not isinstance(idx, numbers.Integral):\n            raise ValueError(f'{self._keyword} index must be an integer')\n\n        idx = list(range(*self._indices))[idx]\n        return self._header[(self._keyword, idx)]\n\n    def __setitem__(self, item, value):\n        \"\"\"\n        Set the value of a specified commentary card or cards.\n\n        Slice/filter updates work similarly to how Header.__setitem__ works.\n        \"\"\"\n\n        if self._header._set_slice(item, value, self):\n            return\n\n        # In this case, key/index errors should be raised; don't update\n        # comments of nonexistent cards\n        self._header[(self._keyword, item)] = value\n\n\ndef _block_size(sep):\n    \"\"\"\n    Determine the size of a FITS header block if a non-blank separator is used\n    between cards.\n    \"\"\"\n\n    return BLOCK_SIZE + (len(sep) * (BLOCK_SIZE // Card.length - 1))\n\n\ndef _pad_length(stringlen):\n    \"\"\"Bytes needed to pad the input stringlen to the next FITS block.\"\"\"\n\n    return (BLOCK_SIZE - (stringlen % BLOCK_SIZE)) % BLOCK_SIZE\n\n\ndef _check_padding(header_str, block_size, is_eof, check_block_size=True):\n    # Strip any zero-padding (see ticket #106)\n    if header_str and header_str[-1] == '\\0':\n        if is_eof and header_str.strip('\\0') == '':\n            # TODO: Pass this warning to validation framework\n            warnings.warn(\n                'Unexpected extra padding at the end of the file.  This '\n                'padding may not be preserved when saving changes.',\n                AstropyUserWarning)\n            raise EOFError()\n        else:\n            # Replace the illegal null bytes with spaces as required by\n            # the FITS standard, and issue a nasty warning\n            # TODO: Pass this warning to validation framework\n            warnings.warn(\n                'Header block contains null bytes instead of spaces for '\n                'padding, and is not FITS-compliant. Nulls may be '\n                'replaced with spaces upon writing.', AstropyUserWarning)\n            header_str.replace('\\0', ' ')\n\n    if check_block_size and (len(header_str) % block_size) != 0:\n        # This error message ignores the length of the separator for\n        # now, but maybe it shouldn't?\n        actual_len = len(header_str) - block_size + BLOCK_SIZE\n        # TODO: Pass this error to validation framework\n        raise ValueError(f'Header size is not multiple of {BLOCK_SIZE}: {actual_len}')\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":1622,"name":"KEYWORD_LENGTH","nodeType":"Attribute","startLoc":24,"text":"KEYWORD_LENGTH"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":1623,"name":"UNDEFINED","nodeType":"Attribute","startLoc":39,"text":"UNDEFINED"},{"col":4,"comment":"null","endLoc":1088,"header":"def __ilshift__(self, other)","id":1624,"name":"__ilshift__","nodeType":"Function","startLoc":1067,"text":"def __ilshift__(self, other):\n        try:\n            other = Unit(other, parse_strict='silent')\n        except UnitTypeError:\n            return NotImplemented\n\n        try:\n            factor = self.unit._to(other)\n        except Exception:\n            # Maybe via equivalencies?  Now we do make a temporary copy.\n            try:\n                value = self._to_value(other)\n            except UnitConversionError:\n                return NotImplemented\n\n            self.view(np.ndarray)[...] = value\n\n        else:\n            self.view(np.ndarray)[...] *= factor\n\n        self._set_unit(other)\n        return self"},{"className":"_DelayedHeader","col":0,"comment":"\n    Descriptor used to create the Header object from the header string that\n    was stored in HDU._header_str when parsing the file.\n    ","endLoc":1970,"id":1625,"nodeType":"Class","startLoc":1946,"text":"class _DelayedHeader:\n    \"\"\"\n    Descriptor used to create the Header object from the header string that\n    was stored in HDU._header_str when parsing the file.\n    \"\"\"\n\n    def __get__(self, obj, owner=None):\n        try:\n            return obj.__dict__['_header']\n        except KeyError:\n            if obj._header_str is not None:\n                hdr = Header.fromstring(obj._header_str)\n                obj._header_str = None\n            else:\n                raise AttributeError(\"'{}' object has no attribute '_header'\"\n                                     .format(obj.__class__.__name__))\n\n            obj.__dict__['_header'] = hdr\n            return hdr\n\n    def __set__(self, obj, val):\n        obj.__dict__['_header'] = val\n\n    def __delete__(self, obj):\n        del obj.__dict__['_header']"},{"col":4,"comment":"null","endLoc":1964,"header":"def __get__(self, obj, owner=None)","id":1626,"name":"__get__","nodeType":"Function","startLoc":1952,"text":"def __get__(self, obj, owner=None):\n        try:\n            return obj.__dict__['_header']\n        except KeyError:\n            if obj._header_str is not None:\n                hdr = Header.fromstring(obj._header_str)\n                obj._header_str = None\n            else:\n                raise AttributeError(\"'{}' object has no attribute '_header'\"\n                                     .format(obj.__class__.__name__))\n\n            obj.__dict__['_header'] = hdr\n            return hdr"},{"col":4,"comment":"null","endLoc":1016,"header":"def _getdata(self, keys)","id":1627,"name":"_getdata","nodeType":"Function","startLoc":997,"text":"def _getdata(self, keys):\n        for idx, (key, axis) in enumerate(zip(keys, self.hdu.shape)):\n            if isinstance(key, slice):\n                ks = range(*key.indices(axis))\n                break\n            elif isiterable(key):\n                # Handle both integer and boolean arrays.\n                ks = np.arange(axis, dtype=int)[key]\n                break\n            # This should always break at some point if _getdata is called.\n\n        data = [self[keys[:idx] + (k,) + keys[idx + 1:]] for k in ks]\n\n        if any(isinstance(key, slice) or isiterable(key)\n               for key in keys[idx + 1:]):\n            # data contains multidimensional arrays; combine them.\n            return np.array(data)\n        else:\n            # Only singleton dimensions remain; concatenate in a 1D array.\n            return np.concatenate([np.atleast_1d(array) for array in data])"},{"col":4,"comment":"null","endLoc":1967,"header":"def __set__(self, obj, val)","id":1628,"name":"__set__","nodeType":"Function","startLoc":1966,"text":"def __set__(self, obj, val):\n        obj.__dict__['_header'] = val"},{"col":4,"comment":"null","endLoc":1970,"header":"def __delete__(self, obj)","id":1629,"name":"__delete__","nodeType":"Function","startLoc":1969,"text":"def __delete__(self, obj):\n        del obj.__dict__['_header']"},{"col":4,"comment":"null","endLoc":1093,"header":"def __rlshift__(self, other)","id":1630,"name":"__rlshift__","nodeType":"Function","startLoc":1090,"text":"def __rlshift__(self, other):\n        if not self.isscalar:\n            return NotImplemented\n        return Unit(self).__rlshift__(other)"},{"className":"_BasicHeaderCards","col":0,"comment":"\n    This class allows to access cards with the _BasicHeader.cards attribute.\n\n    This is needed because during the HDU class detection, some HDUs uses\n    the .cards interface.  Cards cannot be modified here as the _BasicHeader\n    object will be deleted once the HDU object is created.\n\n    ","endLoc":1998,"id":1631,"nodeType":"Class","startLoc":1973,"text":"class _BasicHeaderCards:\n    \"\"\"\n    This class allows to access cards with the _BasicHeader.cards attribute.\n\n    This is needed because during the HDU class detection, some HDUs uses\n    the .cards interface.  Cards cannot be modified here as the _BasicHeader\n    object will be deleted once the HDU object is created.\n\n    \"\"\"\n\n    def __init__(self, header):\n        self.header = header\n\n    def __getitem__(self, key):\n        # .cards is a list of cards, so key here is an integer.\n        # get the keyword name from its index.\n        key = self.header._keys[key]\n        # then we get the card from the _BasicHeader._cards list, or parse it\n        # if needed.\n        try:\n            return self.header._cards[key]\n        except KeyError:\n            cardstr = self.header._raw_cards[key]\n            card = Card.fromstring(cardstr)\n            self.header._cards[key] = card\n            return card"},{"col":4,"comment":"null","endLoc":1998,"header":"def __getitem__(self, key)","id":1632,"name":"__getitem__","nodeType":"Function","startLoc":1986,"text":"def __getitem__(self, key):\n        # .cards is a list of cards, so key here is an integer.\n        # get the keyword name from its index.\n        key = self.header._keys[key]\n        # then we get the card from the _BasicHeader._cards list, or parse it\n        # if needed.\n        try:\n            return self.header._cards[key]\n        except KeyError:\n            cardstr = self.header._raw_cards[key]\n            card = Card.fromstring(cardstr)\n            self.header._cards[key] = card\n            return card"},{"attributeType":"null","col":8,"comment":"null","endLoc":1984,"id":1633,"name":"header","nodeType":"Attribute","startLoc":1984,"text":"self.header"},{"col":4,"comment":"null","endLoc":1100,"header":"def __rrshift__(self, other)","id":1634,"name":"__rrshift__","nodeType":"Function","startLoc":1096,"text":"def __rrshift__(self, other):\n        warnings.warn(\">> is not implemented. Did you mean to convert \"\n                      \"something to this quantity as a unit using '<<'?\",\n                      AstropyWarning)\n        return NotImplemented"},{"className":"_BasicHeader","col":0,"comment":"This class provides a fast header parsing, without all the additional\n    features of the Header class. Here only standard keywords are parsed, no\n    support for CONTINUE, HIERARCH, COMMENT, HISTORY, or rvkc.\n\n    The raw card images are stored and parsed only if needed. The idea is that\n    to create the HDU objects, only a small subset of standard cards is needed.\n    Once a card is parsed, which is deferred to the Card class, the Card object\n    is kept in a cache. This is useful because a small subset of cards is used\n    a lot in the HDU creation process (NAXIS, XTENSION, ...).\n\n    ","endLoc":2063,"id":1635,"nodeType":"Class","startLoc":2001,"text":"class _BasicHeader(collections.abc.Mapping):\n    \"\"\"This class provides a fast header parsing, without all the additional\n    features of the Header class. Here only standard keywords are parsed, no\n    support for CONTINUE, HIERARCH, COMMENT, HISTORY, or rvkc.\n\n    The raw card images are stored and parsed only if needed. The idea is that\n    to create the HDU objects, only a small subset of standard cards is needed.\n    Once a card is parsed, which is deferred to the Card class, the Card object\n    is kept in a cache. This is useful because a small subset of cards is used\n    a lot in the HDU creation process (NAXIS, XTENSION, ...).\n\n    \"\"\"\n\n    def __init__(self, cards):\n        # dict of (keywords, card images)\n        self._raw_cards = cards\n        self._keys = list(cards.keys())\n        # dict of (keyword, Card object) storing the parsed cards\n        self._cards = {}\n        # the _BasicHeaderCards object allows to access Card objects from\n        # keyword indices\n        self.cards = _BasicHeaderCards(self)\n\n        self._modified = False\n\n    def __getitem__(self, key):\n        if isinstance(key, numbers.Integral):\n            key = self._keys[key]\n\n        try:\n            return self._cards[key].value\n        except KeyError:\n            # parse the Card and store it\n            cardstr = self._raw_cards[key]\n            self._cards[key] = card = Card.fromstring(cardstr)\n            return card.value\n\n    def __len__(self):\n        return len(self._raw_cards)\n\n    def __iter__(self):\n        return iter(self._raw_cards)\n\n    def index(self, keyword):\n        return self._keys.index(keyword)\n\n    @classmethod\n    def fromfile(cls, fileobj):\n        \"\"\"The main method to parse a FITS header from a file. The parsing is\n        done with the parse_header function implemented in Cython.\"\"\"\n\n        close_file = False\n        if isinstance(fileobj, str):\n            fileobj = open(fileobj, 'rb')\n            close_file = True\n\n        try:\n            header_str, cards = parse_header(fileobj)\n            _check_padding(header_str, BLOCK_SIZE, False)\n            return header_str, cls(cards)\n        finally:\n            if close_file:\n                fileobj.close()"},{"col":4,"comment":"null","endLoc":1106,"header":"def __rshift__(self, other)","id":1636,"name":"__rshift__","nodeType":"Function","startLoc":1105,"text":"def __rshift__(self, other):\n        return NotImplemented"},{"col":4,"comment":"null","endLoc":1109,"header":"def __irshift__(self, other)","id":1637,"name":"__irshift__","nodeType":"Function","startLoc":1108,"text":"def __irshift__(self, other):\n        return NotImplemented"},{"col":4,"comment":" Multiplication between `Quantity` objects and other objects.","endLoc":1121,"header":"def __mul__(self, other)","id":1638,"name":"__mul__","nodeType":"Function","startLoc":1112,"text":"def __mul__(self, other):\n        \"\"\" Multiplication between `Quantity` objects and other objects.\"\"\"\n\n        if isinstance(other, (UnitBase, str)):\n            try:\n                return self._new_view(self.copy(), other * self.unit)\n            except UnitsError:  # let other try to deal with it\n                return NotImplemented\n\n        return super().__mul__(other)"},{"col":4,"comment":"In-place multiplication between `Quantity` objects and others.","endLoc":1130,"header":"def __imul__(self, other)","id":1639,"name":"__imul__","nodeType":"Function","startLoc":1123,"text":"def __imul__(self, other):\n        \"\"\"In-place multiplication between `Quantity` objects and others.\"\"\"\n\n        if isinstance(other, (UnitBase, str)):\n            self._set_unit(other * self.unit)\n            return self\n\n        return super().__imul__(other)"},{"col":4,"comment":"null","endLoc":2036,"header":"def __getitem__(self, key)","id":1640,"name":"__getitem__","nodeType":"Function","startLoc":2026,"text":"def __getitem__(self, key):\n        if isinstance(key, numbers.Integral):\n            key = self._keys[key]\n\n        try:\n            return self._cards[key].value\n        except KeyError:\n            # parse the Card and store it\n            cardstr = self._raw_cards[key]\n            self._cards[key] = card = Card.fromstring(cardstr)\n            return card.value"},{"col":4,"comment":"null","endLoc":2039,"header":"def __len__(self)","id":1641,"name":"__len__","nodeType":"Function","startLoc":2038,"text":"def __len__(self):\n        return len(self._raw_cards)"},{"col":4,"comment":"null","endLoc":2042,"header":"def __iter__(self)","id":1642,"name":"__iter__","nodeType":"Function","startLoc":2041,"text":"def __iter__(self):\n        return iter(self._raw_cards)"},{"col":4,"comment":" Right Multiplication between `Quantity` objects and other\n        objects.\n        ","endLoc":1137,"header":"def __rmul__(self, other)","id":1643,"name":"__rmul__","nodeType":"Function","startLoc":1132,"text":"def __rmul__(self, other):\n        \"\"\" Right Multiplication between `Quantity` objects and other\n        objects.\n        \"\"\"\n\n        return self.__mul__(other)"},{"col":4,"comment":"null","endLoc":2045,"header":"def index(self, keyword)","id":1644,"name":"index","nodeType":"Function","startLoc":2044,"text":"def index(self, keyword):\n        return self._keys.index(keyword)"},{"col":4,"comment":"null","endLoc":2951,"header":"def __init__(self, pdict, log=None)","id":1645,"name":"__init__","nodeType":"Function","startLoc":2939,"text":"def __init__(self, pdict, log=None):\n        self.pdict      = pdict\n        self.start      = None\n        self.error_func = None\n        self.tokens     = None\n        self.modules    = set()\n        self.grammar    = []\n        self.error      = False\n\n        if log is None:\n            self.log = PlyLogger(sys.stderr)\n        else:\n            self.log = log"},{"attributeType":"{keys}","col":8,"comment":"null","endLoc":2016,"id":1646,"name":"_raw_cards","nodeType":"Attribute","startLoc":2016,"text":"self._raw_cards"},{"col":4,"comment":"\n        Creates an `HDUList` instance from a string or other in-memory data\n        buffer containing an entire FITS file.  Similar to\n        :meth:`HDUList.fromfile`, but does not accept the mode or memmap\n        arguments, as they are only relevant to reading from a file on disk.\n\n        This is useful for interfacing with other libraries such as CFITSIO,\n        and may also be useful for streaming applications.\n\n        Parameters\n        ----------\n        data : str, buffer-like, etc.\n            A string or other memory buffer containing an entire FITS file.\n            Buffer-like objects include :class:`~bytes`, :class:`~bytearray`,\n            :class:`~memoryview`, and :class:`~numpy.ndarray`.\n            It should be noted that if that memory is read-only (such as a\n            Python string) the returned :class:`HDUList`'s data portions will\n            also be read-only.\n        **kwargs : dict\n            Optional keyword arguments.  See\n            :func:`astropy.io.fits.open` for details.\n\n        Returns\n        -------\n        hdul : HDUList\n            An :class:`HDUList` object representing the in-memory FITS file.\n        ","endLoc":458,"header":"@classmethod\n    def fromstring(cls, data, **kwargs)","id":1647,"name":"fromstring","nodeType":"Function","startLoc":415,"text":"@classmethod\n    def fromstring(cls, data, **kwargs):\n        \"\"\"\n        Creates an `HDUList` instance from a string or other in-memory data\n        buffer containing an entire FITS file.  Similar to\n        :meth:`HDUList.fromfile`, but does not accept the mode or memmap\n        arguments, as they are only relevant to reading from a file on disk.\n\n        This is useful for interfacing with other libraries such as CFITSIO,\n        and may also be useful for streaming applications.\n\n        Parameters\n        ----------\n        data : str, buffer-like, etc.\n            A string or other memory buffer containing an entire FITS file.\n            Buffer-like objects include :class:`~bytes`, :class:`~bytearray`,\n            :class:`~memoryview`, and :class:`~numpy.ndarray`.\n            It should be noted that if that memory is read-only (such as a\n            Python string) the returned :class:`HDUList`'s data portions will\n            also be read-only.\n        **kwargs : dict\n            Optional keyword arguments.  See\n            :func:`astropy.io.fits.open` for details.\n\n        Returns\n        -------\n        hdul : HDUList\n            An :class:`HDUList` object representing the in-memory FITS file.\n        \"\"\"\n\n        try:\n            # Test that the given object supports the buffer interface by\n            # ensuring an ndarray can be created from it\n            np.ndarray((), dtype='ubyte', buffer=data)\n        except TypeError:\n            raise TypeError(\n                'The provided object {} does not contain an underlying '\n                'memory buffer.  fromstring() requires an object that '\n                'supports the buffer interface such as bytes, buffer, '\n                'memoryview, ndarray, etc.  This restriction is to ensure '\n                'that efficient access to the array/table data is possible.'\n                ''.format(data))\n\n        return cls._readfrom(data=data, **kwargs)"},{"col":4,"comment":" Division between `Quantity` objects and other objects.","endLoc":1148,"header":"def __truediv__(self, other)","id":1648,"name":"__truediv__","nodeType":"Function","startLoc":1139,"text":"def __truediv__(self, other):\n        \"\"\" Division between `Quantity` objects and other objects.\"\"\"\n\n        if isinstance(other, (UnitBase, str)):\n            try:\n                return self._new_view(self.copy(), self.unit / other)\n            except UnitsError:  # let other try to deal with it\n                return NotImplemented\n\n        return super().__truediv__(other)"},{"attributeType":"_BasicHeaderCards","col":8,"comment":"null","endLoc":2022,"id":1649,"name":"cards","nodeType":"Attribute","startLoc":2022,"text":"self.cards"},{"attributeType":"null","col":8,"comment":"null","endLoc":940,"id":1650,"name":"hdu","nodeType":"Attribute","startLoc":940,"text":"self.hdu"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.io.fits`.\n    ","endLoc":59,"id":1651,"nodeType":"Class","startLoc":22,"text":"class Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.io.fits`.\n    \"\"\"\n\n    enable_record_valued_keyword_cards = _config.ConfigItem(\n        True,\n        'If True, enable support for record-valued keywords as described by '\n        'FITS WCS distortion paper. Otherwise they are treated as normal '\n        'keywords.',\n        aliases=['astropy.io.fits.enabled_record_valued_keyword_cards'])\n    extension_name_case_sensitive = _config.ConfigItem(\n        False,\n        'If True, extension names (i.e. the ``EXTNAME`` keyword) should be '\n        'treated as case-sensitive.')\n    strip_header_whitespace = _config.ConfigItem(\n        True,\n        'If True, automatically remove trailing whitespace for string values in'\n        ' headers. Otherwise the values are returned verbatim, with all '\n        'whitespace intact.')\n    use_memmap = _config.ConfigItem(\n        True,\n        'If True, use memory-mapped file access to read/write the data in '\n        'FITS files. This generally provides better performance, especially '\n        'for large files, but may affect performance in I/O-heavy '\n        'applications.')\n    lazy_load_hdus = _config.ConfigItem(\n        True,\n        'If True, use lazy loading of HDUs when opening FITS files by '\n        'default; that is fits.open() will only seek for and read HDUs on '\n        'demand rather than reading all HDUs at once.  See the documentation '\n        'for fits.open() for more datails.')\n    enable_uint = _config.ConfigItem(\n        True,\n        'If True, default to recognizing the convention for representing '\n        'unsigned integers in FITS--if an array has BITPIX > 0, BSCALE = 1, '\n        'and BZERO = 2**BITPIX, represent the data as unsigned integers '\n        'per this convention.')"},{"col":0,"comment":"null","endLoc":46,"header":"def _auto_names(n_cols)","id":1652,"name":"_auto_names","nodeType":"Function","startLoc":44,"text":"def _auto_names(n_cols):\n    from . import conf\n    return [str(conf.auto_colname).format(i) for i in range(n_cols)]"},{"attributeType":"null","col":8,"comment":"null","endLoc":2019,"id":1653,"name":"_cards","nodeType":"Attribute","startLoc":2019,"text":"self._cards"},{"attributeType":"null","col":8,"comment":"null","endLoc":2024,"id":1654,"name":"_modified","nodeType":"Attribute","startLoc":2024,"text":"self._modified"},{"col":4,"comment":"Inplace division between `Quantity` objects and other objects.","endLoc":1157,"header":"def __itruediv__(self, other)","id":1655,"name":"__itruediv__","nodeType":"Function","startLoc":1150,"text":"def __itruediv__(self, other):\n        \"\"\"Inplace division between `Quantity` objects and other objects.\"\"\"\n\n        if isinstance(other, (UnitBase, str)):\n            self._set_unit(self.unit / other)\n            return self\n\n        return super().__itruediv__(other)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2017,"id":1656,"name":"_keys","nodeType":"Attribute","startLoc":2017,"text":"self._keys"},{"className":"_CardAccessor","col":0,"comment":"\n    This is a generic class for wrapping a Header in such a way that you can\n    use the header's slice/filtering capabilities to return a subset of cards\n    and do something with them.\n\n    This is sort of the opposite notion of the old CardList class--whereas\n    Header used to use CardList to get lists of cards, this uses Header to get\n    lists of cards.\n    ","endLoc":2131,"id":1657,"nodeType":"Class","startLoc":2066,"text":"class _CardAccessor:\n    \"\"\"\n    This is a generic class for wrapping a Header in such a way that you can\n    use the header's slice/filtering capabilities to return a subset of cards\n    and do something with them.\n\n    This is sort of the opposite notion of the old CardList class--whereas\n    Header used to use CardList to get lists of cards, this uses Header to get\n    lists of cards.\n    \"\"\"\n\n    # TODO: Consider giving this dict/list methods like Header itself\n    def __init__(self, header):\n        self._header = header\n\n    def __repr__(self):\n        return '\\n'.join(repr(c) for c in self._header._cards)\n\n    def __len__(self):\n        return len(self._header._cards)\n\n    def __iter__(self):\n        return iter(self._header._cards)\n\n    def __eq__(self, other):\n        # If the `other` item is a scalar we will still treat it as equal if\n        # this _CardAccessor only contains one item\n        if not isiterable(other) or isinstance(other, str):\n            if len(self) == 1:\n                other = [other]\n            else:\n                return False\n\n        for a, b in itertools.zip_longest(self, other):\n            if a != b:\n                return False\n        else:\n            return True\n\n    def __ne__(self, other):\n        return not (self == other)\n\n    def __getitem__(self, item):\n        if isinstance(item, slice) or self._header._haswildcard(item):\n            return self.__class__(self._header[item])\n\n        idx = self._header._cardindex(item)\n        return self._header._cards[idx]\n\n    def _setslice(self, item, value):\n        \"\"\"\n        Helper for implementing __setitem__ on _CardAccessor subclasses; slices\n        should always be handled in this same way.\n        \"\"\"\n\n        if isinstance(item, slice) or self._header._haswildcard(item):\n            if isinstance(item, slice):\n                indices = range(*item.indices(len(self)))\n            else:\n                indices = self._header._wildcardmatch(item)\n            if isinstance(value, str) or not isiterable(value):\n                value = itertools.repeat(value, len(indices))\n            for idx, val in zip(indices, value):\n                self[idx] = val\n            return True\n        return False"},{"col":4,"comment":"null","endLoc":2082,"header":"def __repr__(self)","id":1658,"name":"__repr__","nodeType":"Function","startLoc":2081,"text":"def __repr__(self):\n        return '\\n'.join(repr(c) for c in self._header._cards)"},{"col":4,"comment":"null","endLoc":2085,"header":"def __len__(self)","id":1659,"name":"__len__","nodeType":"Function","startLoc":2084,"text":"def __len__(self):\n        return len(self._header._cards)"},{"col":4,"comment":"null","endLoc":2088,"header":"def __iter__(self)","id":1660,"name":"__iter__","nodeType":"Function","startLoc":2087,"text":"def __iter__(self):\n        return iter(self._header._cards)"},{"col":4,"comment":"null","endLoc":2103,"header":"def __eq__(self, other)","id":1661,"name":"__eq__","nodeType":"Function","startLoc":2090,"text":"def __eq__(self, other):\n        # If the `other` item is a scalar we will still treat it as equal if\n        # this _CardAccessor only contains one item\n        if not isiterable(other) or isinstance(other, str):\n            if len(self) == 1:\n                other = [other]\n            else:\n                return False\n\n        for a, b in itertools.zip_longest(self, other):\n            if a != b:\n                return False\n        else:\n            return True"},{"col":4,"comment":" Right Division between `Quantity` objects and other objects.","endLoc":1165,"header":"def __rtruediv__(self, other)","id":1662,"name":"__rtruediv__","nodeType":"Function","startLoc":1159,"text":"def __rtruediv__(self, other):\n        \"\"\" Right Division between `Quantity` objects and other objects.\"\"\"\n\n        if isinstance(other, (UnitBase, str)):\n            return self._new_view(1. / self.value, other / self.unit)\n\n        return super().__rtruediv__(other)"},{"col":4,"comment":"null","endLoc":1173,"header":"def __pow__(self, other)","id":1663,"name":"__pow__","nodeType":"Function","startLoc":1167,"text":"def __pow__(self, other):\n        if isinstance(other, Fraction):\n            # Avoid getting object arrays by raising the value to a Fraction.\n            return self._new_view(self.value ** float(other),\n                                  self.unit ** other)\n\n        return super().__pow__(other)"},{"col":4,"comment":"null","endLoc":2106,"header":"def __ne__(self, other)","id":1664,"name":"__ne__","nodeType":"Function","startLoc":2105,"text":"def __ne__(self, other):\n        return not (self == other)"},{"col":4,"comment":"null","endLoc":2113,"header":"def __getitem__(self, item)","id":1665,"name":"__getitem__","nodeType":"Function","startLoc":2108,"text":"def __getitem__(self, item):\n        if isinstance(item, slice) or self._header._haswildcard(item):\n            return self.__class__(self._header[item])\n\n        idx = self._header._cardindex(item)\n        return self._header._cards[idx]"},{"col":4,"comment":"\n        Returns a dictionary detailing information about the locations\n        of the indexed HDU within any associated file.  The values are\n        only valid after a read or write of the associated file with\n        no intervening changes to the `HDUList`.\n\n        Parameters\n        ----------\n        index : int\n            Index of HDU for which info is to be returned.\n\n        Returns\n        -------\n        fileinfo : dict or None\n\n            The dictionary details information about the locations of\n            the indexed HDU within an associated file.  Returns `None`\n            when the HDU is not associated with a file.\n\n            Dictionary contents:\n\n            ========== ========================================================\n            Key        Value\n            ========== ========================================================\n            file       File object associated with the HDU\n            filename   Name of associated file object\n            filemode   Mode in which the file was opened (readonly,\n                       update, append, denywrite, ostream)\n            resized    Flag that when `True` indicates that the data has been\n                       resized since the last read/write so the returned values\n                       may not be valid.\n            hdrLoc     Starting byte location of header in file\n            datLoc     Starting byte location of data block in file\n            datSpan    Data size including padding\n            ========== ========================================================\n\n        ","endLoc":525,"header":"def fileinfo(self, index)","id":1666,"name":"fileinfo","nodeType":"Function","startLoc":460,"text":"def fileinfo(self, index):\n        \"\"\"\n        Returns a dictionary detailing information about the locations\n        of the indexed HDU within any associated file.  The values are\n        only valid after a read or write of the associated file with\n        no intervening changes to the `HDUList`.\n\n        Parameters\n        ----------\n        index : int\n            Index of HDU for which info is to be returned.\n\n        Returns\n        -------\n        fileinfo : dict or None\n\n            The dictionary details information about the locations of\n            the indexed HDU within an associated file.  Returns `None`\n            when the HDU is not associated with a file.\n\n            Dictionary contents:\n\n            ========== ========================================================\n            Key        Value\n            ========== ========================================================\n            file       File object associated with the HDU\n            filename   Name of associated file object\n            filemode   Mode in which the file was opened (readonly,\n                       update, append, denywrite, ostream)\n            resized    Flag that when `True` indicates that the data has been\n                       resized since the last read/write so the returned values\n                       may not be valid.\n            hdrLoc     Starting byte location of header in file\n            datLoc     Starting byte location of data block in file\n            datSpan    Data size including padding\n            ========== ========================================================\n\n        \"\"\"\n\n        if self._file is not None:\n            output = self[index].fileinfo()\n\n            if not output:\n                # OK, the HDU associated with this index is not yet\n                # tied to the file associated with the HDUList.  The only way\n                # to get the file object is to check each of the HDU's in the\n                # list until we find the one associated with the file.\n                f = None\n\n                for hdu in self:\n                    info = hdu.fileinfo()\n\n                    if info:\n                        f = info['file']\n                        fm = info['filemode']\n                        break\n\n                output = {'file': f, 'filemode': fm, 'hdrLoc': None,\n                          'datLoc': None, 'datSpan': None}\n\n            output['filename'] = self._file.name\n            output['resized'] = self._wasresized()\n        else:\n            output = None\n\n        return output"},{"col":4,"comment":"null","endLoc":1978,"header":"def __init__(self)","id":1667,"name":"__init__","nodeType":"Function","startLoc":1974,"text":"def __init__(self):\n        self.lr_action = None\n        self.lr_goto = None\n        self.lr_productions = None\n        self.lr_method = None"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":27,"id":1668,"name":"enable_record_valued_keyword_cards","nodeType":"Attribute","startLoc":27,"text":"enable_record_valued_keyword_cards"},{"col":4,"comment":"null","endLoc":1177,"header":"def __hash__(self)","id":1669,"name":"__hash__","nodeType":"Function","startLoc":1176,"text":"def __hash__(self):\n        return hash(self.value) ^ hash(self.unit)"},{"col":4,"comment":"null","endLoc":1190,"header":"def __iter__(self)","id":1670,"name":"__iter__","nodeType":"Function","startLoc":1179,"text":"def __iter__(self):\n        if self.isscalar:\n            raise TypeError(\n                \"'{cls}' object with a scalar value is not iterable\"\n                .format(cls=self.__class__.__name__))\n\n        # Otherwise return a generator\n        def quantity_iter():\n            for val in self.value:\n                yield self._new_view(val)\n\n        return quantity_iter()"},{"col":4,"comment":"null","endLoc":1211,"header":"def __getitem__(self, key)","id":1672,"name":"__getitem__","nodeType":"Function","startLoc":1192,"text":"def __getitem__(self, key):\n        if isinstance(key, str) and isinstance(self.unit, StructuredUnit):\n            return self._new_view(self.view(np.ndarray)[key], self.unit[key])\n\n        try:\n            out = super().__getitem__(key)\n        except IndexError:\n            # We want zero-dimensional Quantity objects to behave like scalars,\n            # so they should raise a TypeError rather than an IndexError.\n            if self.isscalar:\n                raise TypeError(\n                    \"'{cls}' object with a scalar value does not support \"\n                    \"indexing\".format(cls=self.__class__.__name__))\n            else:\n                raise\n        # For single elements, ndarray.__getitem__ returns scalars; these\n        # need a new view as a Quantity.\n        if not isinstance(out, np.ndarray):\n            out = self._new_view(out)\n        return out"},{"col":4,"comment":"null","endLoc":294,"header":"def __init__(self, lrtab, errorf)","id":1673,"name":"__init__","nodeType":"Function","startLoc":288,"text":"def __init__(self, lrtab, errorf):\n        self.productions = lrtab.lr_productions\n        self.action = lrtab.lr_action\n        self.goto = lrtab.lr_goto\n        self.errorfunc = errorf\n        self.set_defaulted_states()\n        self.errorok = True"},{"col":4,"comment":"\n        Return a shallow copy of an HDUList.\n\n        Returns\n        -------\n        copy : `HDUList`\n            A shallow copy of this `HDUList` object.\n\n        ","endLoc":538,"header":"def __copy__(self)","id":1674,"name":"__copy__","nodeType":"Function","startLoc":527,"text":"def __copy__(self):\n        \"\"\"\n        Return a shallow copy of an HDUList.\n\n        Returns\n        -------\n        copy : `HDUList`\n            A shallow copy of this `HDUList` object.\n\n        \"\"\"\n\n        return self[:]"},{"col":4,"comment":"null","endLoc":544,"header":"def __deepcopy__(self, memo=None)","id":1675,"name":"__deepcopy__","nodeType":"Function","startLoc":543,"text":"def __deepcopy__(self, memo=None):\n        return HDUList([hdu.copy() for hdu in self])"},{"col":4,"comment":" Remove an item from the list and return it.\n\n        Parameters\n        ----------\n        index : int, str, tuple of (string, int), optional\n            An integer value of ``index`` indicates the position from which\n            ``pop()`` removes and returns an HDU. A string value or a tuple\n            of ``(string, int)`` functions as a key for identifying the\n            HDU to be removed and returned. If ``key`` is a tuple, it is\n            of the form ``(key, ver)`` where ``ver`` is an ``EXTVER``\n            value that must match the HDU being searched for.\n\n            If the key is ambiguous (e.g. there are multiple 'SCI' extensions)\n            the first match is returned.  For a more precise match use the\n            ``(name, ver)`` pair.\n\n            If even the ``(name, ver)`` pair is ambiguous the numeric index\n            must be used to index the duplicate HDU.\n\n        Returns\n        -------\n        hdu : BaseHDU\n            The HDU object at position indicated by ``index`` or having name\n            and version specified by ``index``.\n        ","endLoc":576,"header":"def pop(self, index=-1)","id":1676,"name":"pop","nodeType":"Function","startLoc":546,"text":"def pop(self, index=-1):\n        \"\"\" Remove an item from the list and return it.\n\n        Parameters\n        ----------\n        index : int, str, tuple of (string, int), optional\n            An integer value of ``index`` indicates the position from which\n            ``pop()`` removes and returns an HDU. A string value or a tuple\n            of ``(string, int)`` functions as a key for identifying the\n            HDU to be removed and returned. If ``key`` is a tuple, it is\n            of the form ``(key, ver)`` where ``ver`` is an ``EXTVER``\n            value that must match the HDU being searched for.\n\n            If the key is ambiguous (e.g. there are multiple 'SCI' extensions)\n            the first match is returned.  For a more precise match use the\n            ``(name, ver)`` pair.\n\n            If even the ``(name, ver)`` pair is ambiguous the numeric index\n            must be used to index the duplicate HDU.\n\n        Returns\n        -------\n        hdu : BaseHDU\n            The HDU object at position indicated by ``index`` or having name\n            and version specified by ``index``.\n        \"\"\"\n\n        # Make sure that HDUs are loaded before attempting to pop\n        self.readall()\n        list_index = self.index_of(index)\n        return super().pop(list_index)"},{"col":4,"comment":"null","endLoc":1225,"header":"def __setitem__(self, i, value)","id":1677,"name":"__setitem__","nodeType":"Function","startLoc":1213,"text":"def __setitem__(self, i, value):\n        if isinstance(i, str):\n            # Indexing will cause a different unit, so by doing this in\n            # two steps we effectively try with the right unit.\n            self[i][...] = value\n            return\n\n        # update indices in info if the info property has been accessed\n        # (in which case 'info' in self.__dict__ is True; this is guaranteed\n        # to be the case if we're part of a table).\n        if not self.isscalar and 'info' in self.__dict__:\n            self.info.adjust_indices(i, value, len(self))\n        self.view(np.ndarray).__setitem__(i, self._to_own_unit(value))"},{"col":4,"comment":"\n        Helper for implementing __setitem__ on _CardAccessor subclasses; slices\n        should always be handled in this same way.\n        ","endLoc":2131,"header":"def _setslice(self, item, value)","id":1678,"name":"_setslice","nodeType":"Function","startLoc":2115,"text":"def _setslice(self, item, value):\n        \"\"\"\n        Helper for implementing __setitem__ on _CardAccessor subclasses; slices\n        should always be handled in this same way.\n        \"\"\"\n\n        if isinstance(item, slice) or self._header._haswildcard(item):\n            if isinstance(item, slice):\n                indices = range(*item.indices(len(self)))\n            else:\n                indices = self._header._wildcardmatch(item)\n            if isinstance(value, str) or not isiterable(value):\n                value = itertools.repeat(value, len(indices))\n            for idx, val in zip(indices, value):\n                self[idx] = val\n            return True\n        return False"},{"col":4,"comment":"\n        Insert an HDU into the `HDUList` at the given ``index``.\n\n        Parameters\n        ----------\n        index : int\n            Index before which to insert the new HDU.\n\n        hdu : BaseHDU\n            The HDU object to insert\n        ","endLoc":641,"header":"def insert(self, index, hdu)","id":1679,"name":"insert","nodeType":"Function","startLoc":578,"text":"def insert(self, index, hdu):\n        \"\"\"\n        Insert an HDU into the `HDUList` at the given ``index``.\n\n        Parameters\n        ----------\n        index : int\n            Index before which to insert the new HDU.\n\n        hdu : BaseHDU\n            The HDU object to insert\n        \"\"\"\n\n        if not isinstance(hdu, _BaseHDU):\n            raise ValueError(f'{hdu} is not an HDU.')\n\n        num_hdus = len(self)\n\n        if index == 0 or num_hdus == 0:\n            if num_hdus != 0:\n                # We are inserting a new Primary HDU so we need to\n                # make the current Primary HDU into an extension HDU.\n                if isinstance(self[0], GroupsHDU):\n                    raise ValueError(\n                        \"The current Primary HDU is a GroupsHDU.  \"\n                        \"It can't be made into an extension HDU, \"\n                        \"so another HDU cannot be inserted before it.\")\n\n                hdu1 = ImageHDU(self[0].data, self[0].header)\n\n                # Insert it into position 1, then delete HDU at position 0.\n                super().insert(1, hdu1)\n                super().__delitem__(0)\n\n            if not isinstance(hdu, (PrimaryHDU, _NonstandardHDU)):\n                # You passed in an Extension HDU but we need a Primary HDU.\n                # If you provided an ImageHDU then we can convert it to\n                # a primary HDU and use that.\n                if isinstance(hdu, ImageHDU):\n                    hdu = PrimaryHDU(hdu.data, hdu.header)\n                else:\n                    # You didn't provide an ImageHDU so we create a\n                    # simple Primary HDU and append that first before\n                    # we append the new Extension HDU.\n                    phdu = PrimaryHDU()\n\n                    super().insert(0, phdu)\n                    index = 1\n        else:\n            if isinstance(hdu, GroupsHDU):\n                raise ValueError('A GroupsHDU must be inserted as a '\n                                 'Primary HDU.')\n\n            if isinstance(hdu, PrimaryHDU):\n                # You passed a Primary HDU but we need an Extension HDU\n                # so create an Extension HDU from the input Primary HDU.\n                hdu = ImageHDU(hdu.data, hdu.header)\n\n        super().insert(index, hdu)\n        hdu._new = True\n        self._resize = True\n        self._truncate = False\n        # make sure the EXTEND keyword is in primary HDU if there is extension\n        self.update_extend()"},{"col":4,"comment":"Quantities should always be treated as non-False; there is too much\n        potential for ambiguity otherwise.\n        ","endLoc":1236,"header":"def __bool__(self)","id":1680,"name":"__bool__","nodeType":"Function","startLoc":1229,"text":"def __bool__(self):\n        \"\"\"Quantities should always be treated as non-False; there is too much\n        potential for ambiguity otherwise.\n        \"\"\"\n        warnings.warn('The truth value of a Quantity is ambiguous. '\n                      'In the future this will raise a ValueError.',\n                      AstropyDeprecationWarning)\n        return True"},{"col":4,"comment":"null","endLoc":1243,"header":"def __len__(self)","id":1681,"name":"__len__","nodeType":"Function","startLoc":1238,"text":"def __len__(self):\n        if self.isscalar:\n            raise TypeError(\"'{cls}' object with a scalar value has no \"\n                            \"len()\".format(cls=self.__class__.__name__))\n        else:\n            return len(self.value)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2079,"id":1682,"name":"_header","nodeType":"Attribute","startLoc":2079,"text":"self._header"},{"className":"_HeaderComments","col":0,"comment":"\n    A class used internally by the Header class for the Header.comments\n    attribute access.\n\n    This object can be used to display all the keyword comments in the Header,\n    or look up the comments on specific keywords.  It allows all the same forms\n    of keyword lookup as the Header class itself, but returns comments instead\n    of values.\n    ","endLoc":2185,"id":1683,"nodeType":"Class","startLoc":2134,"text":"class _HeaderComments(_CardAccessor):\n    \"\"\"\n    A class used internally by the Header class for the Header.comments\n    attribute access.\n\n    This object can be used to display all the keyword comments in the Header,\n    or look up the comments on specific keywords.  It allows all the same forms\n    of keyword lookup as the Header class itself, but returns comments instead\n    of values.\n    \"\"\"\n\n    def __iter__(self):\n        for card in self._header._cards:\n            yield card.comment\n\n    def __repr__(self):\n        \"\"\"Returns a simple list of all keywords and their comments.\"\"\"\n\n        keyword_length = KEYWORD_LENGTH\n        for card in self._header._cards:\n            keyword_length = max(keyword_length, len(card.keyword))\n        return '\\n'.join('{:>{len}}  {}'.format(c.keyword, c.comment,\n                                                len=keyword_length)\n                         for c in self._header._cards)\n\n    def __getitem__(self, item):\n        \"\"\"\n        Slices and filter strings return a new _HeaderComments containing the\n        returned cards.  Otherwise the comment of a single card is returned.\n        \"\"\"\n\n        item = super().__getitem__(item)\n        if isinstance(item, _HeaderComments):\n            # The item key was a slice\n            return item\n        return item.comment\n\n    def __setitem__(self, item, comment):\n        \"\"\"\n        Set/update the comment on specified card or cards.\n\n        Slice/filter updates work similarly to how Header.__setitem__ works.\n        \"\"\"\n\n        if self._header._set_slice(item, comment, self):\n            return\n\n        # In this case, key/index errors should be raised; don't update\n        # comments of nonexistent cards\n        idx = self._header._cardindex(item)\n        value = self._header[idx]\n        self._header[idx] = (value, comment)"},{"col":4,"comment":"null","endLoc":2147,"header":"def __iter__(self)","id":1684,"name":"__iter__","nodeType":"Function","startLoc":2145,"text":"def __iter__(self):\n        for card in self._header._cards:\n            yield card.comment"},{"col":4,"comment":"Returns a simple list of all keywords and their comments.","endLoc":2157,"header":"def __repr__(self)","id":1685,"name":"__repr__","nodeType":"Function","startLoc":2149,"text":"def __repr__(self):\n        \"\"\"Returns a simple list of all keywords and their comments.\"\"\"\n\n        keyword_length = KEYWORD_LENGTH\n        for card in self._header._cards:\n            keyword_length = max(keyword_length, len(card.keyword))\n        return '\\n'.join('{:>{len}}  {}'.format(c.keyword, c.comment,\n                                                len=keyword_length)\n                         for c in self._header._cards)"},{"col":4,"comment":"null","endLoc":1251,"header":"def __float__(self)","id":1686,"name":"__float__","nodeType":"Function","startLoc":1246,"text":"def __float__(self):\n        try:\n            return float(self.to_value(dimensionless_unscaled))\n        except (UnitsError, TypeError):\n            raise TypeError('only dimensionless scalar quantities can be '\n                            'converted to Python scalars')"},{"col":4,"comment":"\n        Slices and filter strings return a new _HeaderComments containing the\n        returned cards.  Otherwise the comment of a single card is returned.\n        ","endLoc":2169,"header":"def __getitem__(self, item)","id":1687,"name":"__getitem__","nodeType":"Function","startLoc":2159,"text":"def __getitem__(self, item):\n        \"\"\"\n        Slices and filter strings return a new _HeaderComments containing the\n        returned cards.  Otherwise the comment of a single card is returned.\n        \"\"\"\n\n        item = super().__getitem__(item)\n        if isinstance(item, _HeaderComments):\n            # The item key was a slice\n            return item\n        return item.comment"},{"col":4,"comment":"null","endLoc":320,"header":"def set_defaulted_states(self)","id":1688,"name":"set_defaulted_states","nodeType":"Function","startLoc":315,"text":"def set_defaulted_states(self):\n        self.defaulted_states = {}\n        for state, actions in self.action.items():\n            rules = list(actions.values())\n            if len(rules) == 1 and rules[0] < 0:\n                self.defaulted_states[state] = rules[0]"},{"col":4,"comment":"null","endLoc":1258,"header":"def __int__(self)","id":1689,"name":"__int__","nodeType":"Function","startLoc":1253,"text":"def __int__(self):\n        try:\n            return int(self.to_value(dimensionless_unscaled))\n        except (UnitsError, TypeError):\n            raise TypeError('only dimensionless scalar quantities can be '\n                            'converted to Python scalars')"},{"col":4,"comment":"\n        Set/update the comment on specified card or cards.\n\n        Slice/filter updates work similarly to how Header.__setitem__ works.\n        ","endLoc":2185,"header":"def __setitem__(self, item, comment)","id":1690,"name":"__setitem__","nodeType":"Function","startLoc":2171,"text":"def __setitem__(self, item, comment):\n        \"\"\"\n        Set/update the comment on specified card or cards.\n\n        Slice/filter updates work similarly to how Header.__setitem__ works.\n        \"\"\"\n\n        if self._header._set_slice(item, comment, self):\n            return\n\n        # In this case, key/index errors should be raised; don't update\n        # comments of nonexistent cards\n        idx = self._header._cardindex(item)\n        value = self._header[idx]\n        self._header[idx] = (value, comment)"},{"col":4,"comment":"null","endLoc":1268,"header":"def __index__(self)","id":1691,"name":"__index__","nodeType":"Function","startLoc":1260,"text":"def __index__(self):\n        # for indices, we do not want to mess around with scaling at all,\n        # so unlike for float, int, we insist here on unscaled dimensionless\n        try:\n            assert self.unit.is_unity()\n            return self.value.__index__()\n        except Exception:\n            raise TypeError('only integer dimensionless scalar quantities '\n                            'can be converted to a Python index')"},{"className":"_HeaderCommentaryCards","col":0,"comment":"\n    This is used to return a list-like sequence over all the values in the\n    header for a given commentary keyword, such as HISTORY.\n    ","endLoc":2235,"id":1692,"nodeType":"Class","startLoc":2188,"text":"class _HeaderCommentaryCards(_CardAccessor):\n    \"\"\"\n    This is used to return a list-like sequence over all the values in the\n    header for a given commentary keyword, such as HISTORY.\n    \"\"\"\n\n    def __init__(self, header, keyword=''):\n        super().__init__(header)\n        self._keyword = keyword\n        self._count = self._header.count(self._keyword)\n        self._indices = slice(self._count).indices(self._count)\n\n    # __len__ and __iter__ need to be overridden from the base class due to the\n    # different approach this class has to take for slicing\n    def __len__(self):\n        return len(range(*self._indices))\n\n    def __iter__(self):\n        for idx in range(*self._indices):\n            yield self._header[(self._keyword, idx)]\n\n    def __repr__(self):\n        return '\\n'.join(str(x) for x in self)\n\n    def __getitem__(self, idx):\n        if isinstance(idx, slice):\n            n = self.__class__(self._header, self._keyword)\n            n._indices = idx.indices(self._count)\n            return n\n        elif not isinstance(idx, numbers.Integral):\n            raise ValueError(f'{self._keyword} index must be an integer')\n\n        idx = list(range(*self._indices))[idx]\n        return self._header[(self._keyword, idx)]\n\n    def __setitem__(self, item, value):\n        \"\"\"\n        Set the value of a specified commentary card or cards.\n\n        Slice/filter updates work similarly to how Header.__setitem__ works.\n        \"\"\"\n\n        if self._header._set_slice(item, value, self):\n            return\n\n        # In this case, key/index errors should be raised; don't update\n        # comments of nonexistent cards\n        self._header[(self._keyword, item)] = value"},{"col":4,"comment":"null","endLoc":1281,"header":"@property\n    def _unitstr(self)","id":1693,"name":"_unitstr","nodeType":"Function","startLoc":1271,"text":"@property\n    def _unitstr(self):\n        if self.unit is None:\n            unitstr = _UNIT_NOT_INITIALISED\n        else:\n            unitstr = str(self.unit)\n\n        if unitstr:\n            unitstr = ' ' + unitstr\n\n        return unitstr"},{"col":4,"comment":"null","endLoc":2203,"header":"def __len__(self)","id":1694,"name":"__len__","nodeType":"Function","startLoc":2202,"text":"def __len__(self):\n        return len(range(*self._indices))"},{"col":4,"comment":"\n        Generate a string representation of the quantity and its unit.\n\n        The behavior of this function can be altered via the\n        `numpy.set_printoptions` function and its various keywords.  The\n        exception to this is the ``threshold`` keyword, which is controlled via\n        the ``[units.quantity]`` configuration item ``latex_array_threshold``.\n        This is treated separately because the numpy default of 1000 is too big\n        for most browsers to handle.\n\n        Parameters\n        ----------\n        unit : unit-like, optional\n            Specifies the unit.  If not provided,\n            the unit used to initialize the quantity will be used.\n\n        precision : number, optional\n            The level of decimal precision. If `None`, or not provided,\n            it will be determined from NumPy print options.\n\n        format : str, optional\n            The format of the result. If not provided, an unadorned\n            string is returned. Supported values are:\n\n            - 'latex': Return a LaTeX-formatted string\n\n        subfmt : str, optional\n            Subformat of the result. For the moment,\n            only used for format=\"latex\". Supported values are:\n\n            - 'inline': Use ``$ ... $`` as delimiters.\n\n            - 'display': Use ``$\\displaystyle ... $`` as delimiters.\n\n        Returns\n        -------\n        str\n            A string with the contents of this Quantity\n        ","endLoc":1384,"header":"def to_string(self, unit=None, precision=None, format=None, subfmt=None)","id":1695,"name":"to_string","nodeType":"Function","startLoc":1283,"text":"def to_string(self, unit=None, precision=None, format=None, subfmt=None):\n        \"\"\"\n        Generate a string representation of the quantity and its unit.\n\n        The behavior of this function can be altered via the\n        `numpy.set_printoptions` function and its various keywords.  The\n        exception to this is the ``threshold`` keyword, which is controlled via\n        the ``[units.quantity]`` configuration item ``latex_array_threshold``.\n        This is treated separately because the numpy default of 1000 is too big\n        for most browsers to handle.\n\n        Parameters\n        ----------\n        unit : unit-like, optional\n            Specifies the unit.  If not provided,\n            the unit used to initialize the quantity will be used.\n\n        precision : number, optional\n            The level of decimal precision. If `None`, or not provided,\n            it will be determined from NumPy print options.\n\n        format : str, optional\n            The format of the result. If not provided, an unadorned\n            string is returned. Supported values are:\n\n            - 'latex': Return a LaTeX-formatted string\n\n        subfmt : str, optional\n            Subformat of the result. For the moment,\n            only used for format=\"latex\". Supported values are:\n\n            - 'inline': Use ``$ ... $`` as delimiters.\n\n            - 'display': Use ``$\\\\displaystyle ... $`` as delimiters.\n\n        Returns\n        -------\n        str\n            A string with the contents of this Quantity\n        \"\"\"\n        if unit is not None and unit != self.unit:\n            return self.to(unit).to_string(\n                unit=None, precision=precision, format=format, subfmt=subfmt)\n\n        formats = {\n            None: None,\n            \"latex\": {\n                None: (\"$\", \"$\"),\n                \"inline\": (\"$\", \"$\"),\n                \"display\": (r\"$\\displaystyle \", r\"$\"),\n            },\n        }\n\n        if format not in formats:\n            raise ValueError(f\"Unknown format '{format}'\")\n        elif format is None:\n            if precision is None:\n                # Use default formatting settings\n                return f'{self.value}{self._unitstr:s}'\n            else:\n                # np.array2string properly formats arrays as well as scalars\n                return np.array2string(self.value, precision=precision,\n                                       floatmode=\"fixed\") + self._unitstr\n\n        # else, for the moment we assume format=\"latex\"\n\n        # Set the precision if set, otherwise use numpy default\n        pops = np.get_printoptions()\n        format_spec = f\".{precision if precision is not None else pops['precision']}g\"\n\n        def float_formatter(value):\n            return Latex.format_exponential_notation(value,\n                                                     format_spec=format_spec)\n\n        def complex_formatter(value):\n            return '({}{}i)'.format(\n                Latex.format_exponential_notation(value.real,\n                                                  format_spec=format_spec),\n                Latex.format_exponential_notation(value.imag,\n                                                  format_spec='+' + format_spec))\n\n        # The view is needed for the scalar case - self.value might be float.\n        latex_value = np.array2string(\n            self.view(np.ndarray),\n            threshold=(conf.latex_array_threshold\n                       if conf.latex_array_threshold > -1 else pops['threshold']),\n            formatter={'float_kind': float_formatter,\n                       'complex_kind': complex_formatter},\n            max_line_width=np.inf,\n            separator=',~')\n\n        latex_value = latex_value.replace('...', r'\\dots')\n\n        # Format unit\n        # [1:-1] strips the '$' on either side needed for math mode\n        latex_unit = (self.unit._repr_latex_()[1:-1]  # note this is unicode\n                      if self.unit is not None\n                      else _UNIT_NOT_INITIALISED)\n\n        delimiter_left, delimiter_right = formats[format][subfmt]\n\n        return rf'{delimiter_left}{latex_value} \\; {latex_unit}{delimiter_right}'"},{"col":4,"comment":"null","endLoc":2207,"header":"def __iter__(self)","id":1696,"name":"__iter__","nodeType":"Function","startLoc":2205,"text":"def __iter__(self):\n        for idx in range(*self._indices):\n            yield self._header[(self._keyword, idx)]"},{"col":4,"comment":"null","endLoc":2210,"header":"def __repr__(self)","id":1697,"name":"__repr__","nodeType":"Function","startLoc":2209,"text":"def __repr__(self):\n        return '\\n'.join(str(x) for x in self)"},{"col":4,"comment":"null","endLoc":2221,"header":"def __getitem__(self, idx)","id":1698,"name":"__getitem__","nodeType":"Function","startLoc":2212,"text":"def __getitem__(self, idx):\n        if isinstance(idx, slice):\n            n = self.__class__(self._header, self._keyword)\n            n._indices = idx.indices(self._count)\n            return n\n        elif not isinstance(idx, numbers.Integral):\n            raise ValueError(f'{self._keyword} index must be an integer')\n\n        idx = list(range(*self._indices))[idx]\n        return self._header[(self._keyword, idx)]"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":33,"id":1699,"name":"extension_name_case_sensitive","nodeType":"Attribute","startLoc":33,"text":"extension_name_case_sensitive"},{"col":4,"comment":"\n        Construct an image HDU.\n\n        Parameters\n        ----------\n        data : array\n            The data in the HDU.\n\n        header : `~astropy.io.fits.Header`\n            The header to be used (as a template).  If ``header`` is\n            `None`, a minimal header will be provided.\n\n        name : str, optional\n            The name of the HDU, will be the value of the keyword\n            ``EXTNAME``.\n\n        do_not_scale_image_data : bool, optional\n            If `True`, image data is not scaled using BSCALE/BZERO values\n            when read. (default: False)\n\n        uint : bool, optional\n            Interpret signed integer data where ``BZERO`` is the\n            central value and ``BSCALE == 1`` as unsigned integer\n            data.  For example, ``int16`` data with ``BZERO = 32768``\n            and ``BSCALE = 1`` would be treated as ``uint16`` data.\n            (default: True)\n\n        scale_back : bool, optional\n            If `True`, when saving changes to a file that contained scaled\n            image data, restore the data to the original type and reapply the\n            original BSCALE/BZERO values.  This could lead to loss of accuracy\n            if scaling back to integer values after performing floating point\n            operations on the data.  Pseudo-unsigned integers are automatically\n            rescaled unless scale_back is explicitly set to `False`.\n            (default: None)\n\n        ver : int > 0 or None, optional\n            The ver of the HDU, will be the value of the keyword ``EXTVER``.\n            If not given or None, it defaults to the value of the ``EXTVER``\n            card of the ``header`` or 1.\n            (default: None)\n        ","endLoc":1173,"header":"def __init__(self, data=None, header=None, name=None,\n                 do_not_scale_image_data=False, uint=True, scale_back=None,\n                 ver=None)","id":1700,"name":"__init__","nodeType":"Function","startLoc":1121,"text":"def __init__(self, data=None, header=None, name=None,\n                 do_not_scale_image_data=False, uint=True, scale_back=None,\n                 ver=None):\n        \"\"\"\n        Construct an image HDU.\n\n        Parameters\n        ----------\n        data : array\n            The data in the HDU.\n\n        header : `~astropy.io.fits.Header`\n            The header to be used (as a template).  If ``header`` is\n            `None`, a minimal header will be provided.\n\n        name : str, optional\n            The name of the HDU, will be the value of the keyword\n            ``EXTNAME``.\n\n        do_not_scale_image_data : bool, optional\n            If `True`, image data is not scaled using BSCALE/BZERO values\n            when read. (default: False)\n\n        uint : bool, optional\n            Interpret signed integer data where ``BZERO`` is the\n            central value and ``BSCALE == 1`` as unsigned integer\n            data.  For example, ``int16`` data with ``BZERO = 32768``\n            and ``BSCALE = 1`` would be treated as ``uint16`` data.\n            (default: True)\n\n        scale_back : bool, optional\n            If `True`, when saving changes to a file that contained scaled\n            image data, restore the data to the original type and reapply the\n            original BSCALE/BZERO values.  This could lead to loss of accuracy\n            if scaling back to integer values after performing floating point\n            operations on the data.  Pseudo-unsigned integers are automatically\n            rescaled unless scale_back is explicitly set to `False`.\n            (default: None)\n\n        ver : int > 0 or None, optional\n            The ver of the HDU, will be the value of the keyword ``EXTVER``.\n            If not given or None, it defaults to the value of the ``EXTVER``\n            card of the ``header`` or 1.\n            (default: None)\n        \"\"\"\n\n        # This __init__ currently does nothing differently from the base class,\n        # and is only explicitly defined for the docstring.\n\n        super().__init__(\n            data=data, header=header, name=name,\n            do_not_scale_image_data=do_not_scale_image_data, uint=uint,\n            scale_back=scale_back, ver=ver)"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":37,"id":1701,"name":"strip_header_whitespace","nodeType":"Attribute","startLoc":37,"text":"strip_header_whitespace"},{"col":4,"comment":"\n        Set the value of a specified commentary card or cards.\n\n        Slice/filter updates work similarly to how Header.__setitem__ works.\n        ","endLoc":2235,"header":"def __setitem__(self, item, value)","id":1702,"name":"__setitem__","nodeType":"Function","startLoc":2223,"text":"def __setitem__(self, item, value):\n        \"\"\"\n        Set the value of a specified commentary card or cards.\n\n        Slice/filter updates work similarly to how Header.__setitem__ works.\n        \"\"\"\n\n        if self._header._set_slice(item, value, self):\n            return\n\n        # In this case, key/index errors should be raised; don't update\n        # comments of nonexistent cards\n        self._header[(self._keyword, item)] = value"},{"attributeType":"null","col":8,"comment":"null","endLoc":2197,"id":1703,"name":"_count","nodeType":"Attribute","startLoc":2197,"text":"self._count"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":42,"id":1704,"name":"use_memmap","nodeType":"Attribute","startLoc":42,"text":"use_memmap"},{"attributeType":"null","col":8,"comment":"null","endLoc":2198,"id":1705,"name":"_indices","nodeType":"Attribute","startLoc":2198,"text":"self._indices"},{"col":4,"comment":"\n        Formats a value in exponential notation for LaTeX.\n\n        Parameters\n        ----------\n        val : number\n            The value to be formatted\n\n        format_spec : str, optional\n            Format used to split up mantissa and exponent\n\n        Returns\n        -------\n        latex_string : str\n            The value in exponential notation in a format suitable for LaTeX.\n        ","endLoc":129,"header":"@classmethod\n    def format_exponential_notation(cls, val, format_spec=\".8g\")","id":1706,"name":"format_exponential_notation","nodeType":"Function","startLoc":93,"text":"@classmethod\n    def format_exponential_notation(cls, val, format_spec=\".8g\"):\n        \"\"\"\n        Formats a value in exponential notation for LaTeX.\n\n        Parameters\n        ----------\n        val : number\n            The value to be formatted\n\n        format_spec : str, optional\n            Format used to split up mantissa and exponent\n\n        Returns\n        -------\n        latex_string : str\n            The value in exponential notation in a format suitable for LaTeX.\n        \"\"\"\n        if np.isfinite(val):\n            m, ex = utils.split_mantissa_exponent(val, format_spec)\n\n            parts = []\n            if m:\n                parts.append(m)\n            if ex:\n                parts.append(f\"10^{{{ex}}}\")\n\n            return r\" \\times \".join(parts)\n        else:\n            if np.isnan(val):\n                return r'{\\rm NaN}'\n            elif val > 0:\n                # positive infinity\n                return r'\\infty'\n            else:\n                # negative infinity\n                return r'-\\infty'"},{"attributeType":"null","col":8,"comment":"null","endLoc":2196,"id":1707,"name":"_keyword","nodeType":"Attribute","startLoc":2196,"text":"self._keyword"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":48,"id":1708,"name":"lazy_load_hdus","nodeType":"Attribute","startLoc":48,"text":"lazy_load_hdus"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":1709,"name":"BLOCK_SIZE","nodeType":"Attribute","startLoc":20,"text":"BLOCK_SIZE"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":1710,"name":"HEADER_END_RE","nodeType":"Attribute","startLoc":28,"text":"HEADER_END_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":34,"id":1711,"name":"VALID_HEADER_CHARS","nodeType":"Attribute","startLoc":34,"text":"VALID_HEADER_CHARS"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":1712,"name":"END_CARD","nodeType":"Attribute","startLoc":35,"text":"END_CARD"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":1713,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":38,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":3,"header":"header.py#<anonymous>","id":1714,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"BLOCK_SIZE = 2880  # the FITS block size\n\nHEADER_END_RE = re.compile(encode_ascii(\n    r'(?:(?P<valid>END {77}) *)|(?P<invalid>END$|END {0,76}[^A-Z0-9_-])'))\n\nVALID_HEADER_CHARS = set(map(chr, range(0x20, 0x7F)))\n\nEND_CARD = 'END' + ' ' * 77\n\n__doctest_skip__ = ['Header', 'Header.comments', 'Header.fromtextfile',\n                    'Header.totextfile', 'Header.set', 'Header.update']\n\ncollections.abc.MutableSequence.register(Header)\n\ncollections.abc.MutableMapping.register(Header)"},{"fileName":"convenience.py","filePath":"astropy/io/fits","id":1715,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\n\"\"\"\nConvenience functions\n=====================\n\nThe functions in this module provide shortcuts for some of the most basic\noperations on FITS files, such as reading and updating the header.  They are\nincluded directly in the 'astropy.io.fits' namespace so that they can be used\nlike::\n\n    astropy.io.fits.getheader(...)\n\nThese functions are primarily for convenience when working with FITS files in\nthe command-line interpreter.  If performing several operations on the same\nfile, such as in a script, it is better to *not* use these functions, as each\none must open and re-parse the file.  In such cases it is better to use\n:func:`astropy.io.fits.open` and work directly with the\n:class:`astropy.io.fits.HDUList` object and underlying HDU objects.\n\nSeveral of the convenience functions, such as `getheader` and `getdata` support\nspecial arguments for selecting which HDU to use when working with a\nmulti-extension FITS file.  There are a few supported argument formats for\nselecting the HDU.  See the documentation for `getdata` for an\nexplanation of all the different formats.\n\n.. warning::\n    All arguments to convenience functions other than the filename that are\n    *not* for selecting the HDU should be passed in as keyword\n    arguments.  This is to avoid ambiguity and conflicts with the\n    HDU arguments.  For example, to set NAXIS=1 on the Primary HDU:\n\n    Wrong::\n\n        astropy.io.fits.setval('myimage.fits', 'NAXIS', 1)\n\n    The above example will try to set the NAXIS value on the first extension\n    HDU to blank.  That is, the argument '1' is assumed to specify an\n    HDU.\n\n    Right::\n\n        astropy.io.fits.setval('myimage.fits', 'NAXIS', value=1)\n\n    This will set the NAXIS keyword to 1 on the primary HDU (the default).  To\n    specify the first extension HDU use::\n\n        astropy.io.fits.setval('myimage.fits', 'NAXIS', value=1, ext=1)\n\n    This complexity arises out of the attempt to simultaneously support\n    multiple argument formats that were used in past versions of PyFITS.\n    Unfortunately, it is not possible to support all formats without\n    introducing some ambiguity.  A future Astropy release may standardize\n    around a single format and officially deprecate the other formats.\n\"\"\"\n\nimport operator\nimport os\nimport warnings\n\nimport numpy as np\n\nfrom .diff import FITSDiff, HDUDiff\nfrom .file import FILE_MODES, _File\nfrom .hdu.base import _BaseHDU, _ValidHDU\nfrom .hdu.hdulist import fitsopen, HDUList\nfrom .hdu.image import PrimaryHDU, ImageHDU\nfrom .hdu.table import BinTableHDU\nfrom .header import Header\nfrom .util import (fileobj_closed, fileobj_name, fileobj_mode, _is_int,\n                   _is_dask_array)\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n\n__all__ = ['getheader', 'getdata', 'getval', 'setval', 'delval', 'writeto',\n           'append', 'update', 'info', 'tabledump', 'tableload',\n           'table_to_hdu', 'printdiff']\n\n\ndef getheader(filename, *args, **kwargs):\n    \"\"\"\n    Get the header from an HDU of a FITS file.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        File to get header from.  If an opened file object, its mode\n        must be one of the following rb, rb+, or ab+).\n\n    ext, extname, extver\n        The rest of the arguments are for HDU specification.  See the\n        `getdata` documentation for explanations/examples.\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n\n    Returns\n    -------\n    header : `Header` object\n    \"\"\"\n\n    mode, closed = _get_file_mode(filename)\n    hdulist, extidx = _getext(filename, mode, *args, **kwargs)\n    try:\n        hdu = hdulist[extidx]\n        header = hdu.header\n    finally:\n        hdulist.close(closed=closed)\n\n    return header\n\n\ndef getdata(filename, *args, header=None, lower=None, upper=None, view=None,\n            **kwargs):\n    \"\"\"\n    Get the data from an HDU of a FITS file (and optionally the\n    header).\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        File to get data from.  If opened, mode must be one of the\n        following rb, rb+, or ab+.\n\n    ext\n        The rest of the arguments are for HDU specification.\n        They are flexible and are best illustrated by examples.\n\n        No extra arguments implies the primary HDU::\n\n            getdata('in.fits')\n\n        .. note::\n            Exclusive to ``getdata``: if ``ext`` is not specified\n            and primary header contains no data, ``getdata`` attempts\n            to retrieve data from first extension HDU.\n\n        By HDU number::\n\n            getdata('in.fits', 0)      # the primary HDU\n            getdata('in.fits', 2)      # the second extension HDU\n            getdata('in.fits', ext=2)  # the second extension HDU\n\n        By name, i.e., ``EXTNAME`` value (if unique)::\n\n            getdata('in.fits', 'sci')\n            getdata('in.fits', extname='sci')  # equivalent\n\n        Note ``EXTNAME`` values are not case sensitive\n\n        By combination of ``EXTNAME`` and EXTVER`` as separate\n        arguments or as a tuple::\n\n            getdata('in.fits', 'sci', 2)  # EXTNAME='SCI' & EXTVER=2\n            getdata('in.fits', extname='sci', extver=2)  # equivalent\n            getdata('in.fits', ('sci', 2))  # equivalent\n\n        Ambiguous or conflicting specifications will raise an exception::\n\n            getdata('in.fits', ext=('sci',1), extname='err', extver=2)\n\n    header : bool, optional\n        If `True`, return the data and the header of the specified HDU as a\n        tuple.\n\n    lower, upper : bool, optional\n        If ``lower`` or ``upper`` are `True`, the field names in the\n        returned data object will be converted to lower or upper case,\n        respectively.\n\n    view : ndarray, optional\n        When given, the data will be returned wrapped in the given ndarray\n        subclass by calling::\n\n           data.view(view)\n\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n\n    Returns\n    -------\n    array : ndarray or `~numpy.recarray` or `~astropy.io.fits.Group`\n        Type depends on the type of the extension being referenced.\n\n        If the optional keyword ``header`` is set to `True`, this\n        function will return a (``data``, ``header``) tuple.\n\n    Raises\n    ------\n    IndexError\n        If no data is found in searched HDUs.\n    \"\"\"\n\n    mode, closed = _get_file_mode(filename)\n\n    ext = kwargs.get('ext')\n    extname = kwargs.get('extname')\n    extver = kwargs.get('extver')\n    ext_given = not (len(args) == 0 and ext is None and\n                     extname is None and extver is None)\n\n    hdulist, extidx = _getext(filename, mode, *args, **kwargs)\n    try:\n        hdu = hdulist[extidx]\n        data = hdu.data\n        if data is None:\n            if ext_given:\n                raise IndexError(f\"No data in HDU #{extidx}.\")\n\n            # fallback to the first extension HDU\n            if len(hdulist) == 1:\n                raise IndexError(\n                    \"No data in Primary HDU and no extension HDU found.\"\n                    )\n            hdu = hdulist[1]\n            data = hdu.data\n            if data is None:\n                raise IndexError(\n                    \"No data in either Primary or first extension HDUs.\"\n                    )\n\n        if header:\n            hdr = hdu.header\n    finally:\n        hdulist.close(closed=closed)\n\n    # Change case of names if requested\n    trans = None\n    if lower:\n        trans = operator.methodcaller('lower')\n    elif upper:\n        trans = operator.methodcaller('upper')\n    if trans:\n        if data.dtype.names is None:\n            # this data does not have fields\n            return\n        if data.dtype.descr[0][0] == '':\n            # this data does not have fields\n            return\n        data.dtype.names = [trans(n) for n in data.dtype.names]\n\n    # allow different views into the underlying ndarray.  Keep the original\n    # view just in case there is a problem\n    if isinstance(view, type) and issubclass(view, np.ndarray):\n        data = data.view(view)\n\n    if header:\n        return data, hdr\n    else:\n        return data\n\n\ndef getval(filename, keyword, *args, **kwargs):\n    \"\"\"\n    Get a keyword's value from a header in a FITS file.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        Name of the FITS file, or file object (if opened, mode must be\n        one of the following rb, rb+, or ab+).\n\n    keyword : str\n        Keyword name\n\n    ext, extname, extver\n        The rest of the arguments are for HDU specification.\n        See `getdata` for explanations/examples.\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n        *Note:* This function automatically specifies ``do_not_scale_image_data\n        = True`` when opening the file so that values can be retrieved from the\n        unmodified header.\n\n    Returns\n    -------\n    keyword value : str, int, or float\n    \"\"\"\n\n    if 'do_not_scale_image_data' not in kwargs:\n        kwargs['do_not_scale_image_data'] = True\n\n    hdr = getheader(filename, *args, **kwargs)\n    return hdr[keyword]\n\n\ndef setval(filename, keyword, *args, value=None, comment=None, before=None,\n           after=None, savecomment=False, **kwargs):\n    \"\"\"\n    Set a keyword's value from a header in a FITS file.\n\n    If the keyword already exists, it's value/comment will be updated.\n    If it does not exist, a new card will be created and it will be\n    placed before or after the specified location.  If no ``before`` or\n    ``after`` is specified, it will be appended at the end.\n\n    When updating more than one keyword in a file, this convenience\n    function is a much less efficient approach compared with opening\n    the file for update, modifying the header, and closing the file.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        Name of the FITS file, or file object If opened, mode must be update\n        (rb+).  An opened file object or `~gzip.GzipFile` object will be closed\n        upon return.\n\n    keyword : str\n        Keyword name\n\n    value : str, int, float, optional\n        Keyword value (default: `None`, meaning don't modify)\n\n    comment : str, optional\n        Keyword comment, (default: `None`, meaning don't modify)\n\n    before : str, int, optional\n        Name of the keyword, or index of the card before which the new card\n        will be placed.  The argument ``before`` takes precedence over\n        ``after`` if both are specified (default: `None`).\n\n    after : str, int, optional\n        Name of the keyword, or index of the card after which the new card will\n        be placed. (default: `None`).\n\n    savecomment : bool, optional\n        When `True`, preserve the current comment for an existing keyword.  The\n        argument ``savecomment`` takes precedence over ``comment`` if both\n        specified.  If ``comment`` is not specified then the current comment\n        will automatically be preserved  (default: `False`).\n\n    ext, extname, extver\n        The rest of the arguments are for HDU specification.\n        See `getdata` for explanations/examples.\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n        *Note:* This function automatically specifies ``do_not_scale_image_data\n        = True`` when opening the file so that values can be retrieved from the\n        unmodified header.\n    \"\"\"\n\n    if 'do_not_scale_image_data' not in kwargs:\n        kwargs['do_not_scale_image_data'] = True\n\n    closed = fileobj_closed(filename)\n    hdulist, extidx = _getext(filename, 'update', *args, **kwargs)\n    try:\n        if keyword in hdulist[extidx].header and savecomment:\n            comment = None\n        hdulist[extidx].header.set(keyword, value, comment, before, after)\n    finally:\n        hdulist.close(closed=closed)\n\n\ndef delval(filename, keyword, *args, **kwargs):\n    \"\"\"\n    Delete all instances of keyword from a header in a FITS file.\n\n    Parameters\n    ----------\n\n    filename : path-like or file-like\n        Name of the FITS file, or file object If opened, mode must be update\n        (rb+).  An opened file object or `~gzip.GzipFile` object will be closed\n        upon return.\n\n    keyword : str, int\n        Keyword name or index\n\n    ext, extname, extver\n        The rest of the arguments are for HDU specification.\n        See `getdata` for explanations/examples.\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n        *Note:* This function automatically specifies ``do_not_scale_image_data\n        = True`` when opening the file so that values can be retrieved from the\n        unmodified header.\n    \"\"\"\n\n    if 'do_not_scale_image_data' not in kwargs:\n        kwargs['do_not_scale_image_data'] = True\n\n    closed = fileobj_closed(filename)\n    hdulist, extidx = _getext(filename, 'update', *args, **kwargs)\n    try:\n        del hdulist[extidx].header[keyword]\n    finally:\n        hdulist.close(closed=closed)\n\n\ndef writeto(filename, data, header=None, output_verify='exception',\n            overwrite=False, checksum=False):\n    \"\"\"\n    Create a new FITS file using the supplied data/header.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        File to write to.  If opened, must be opened in a writable binary\n        mode such as 'wb' or 'ab+'.\n\n    data : array or `~numpy.recarray` or `~astropy.io.fits.Group`\n        data to write to the new file\n\n    header : `Header` object, optional\n        the header associated with ``data``. If `None`, a header\n        of the appropriate type is created for the supplied data. This\n        argument is optional.\n\n    output_verify : str\n        Output verification option.  Must be one of ``\"fix\"``, ``\"silentfix\"``,\n        ``\"ignore\"``, ``\"warn\"``, or ``\"exception\"``.  May also be any\n        combination of ``\"fix\"`` or ``\"silentfix\"`` with ``\"+ignore\"``,\n        ``+warn``, or ``+exception\" (e.g. ``\"fix+warn\"``).  See\n        :ref:`astropy:verify` for more info.\n\n    overwrite : bool, optional\n        If ``True``, overwrite the output file if it exists. Raises an\n        ``OSError`` if ``False`` and the output file exists. Default is\n        ``False``.\n\n    checksum : bool, optional\n        If `True`, adds both ``DATASUM`` and ``CHECKSUM`` cards to the\n        headers of all HDU's written to the file.\n    \"\"\"\n\n    hdu = _makehdu(data, header)\n    if hdu.is_image and not isinstance(hdu, PrimaryHDU):\n        hdu = PrimaryHDU(data, header=header)\n    hdu.writeto(filename, overwrite=overwrite, output_verify=output_verify,\n                checksum=checksum)\n\n\ndef table_to_hdu(table, character_as_bytes=False):\n    \"\"\"\n    Convert an `~astropy.table.Table` object to a FITS\n    `~astropy.io.fits.BinTableHDU`.\n\n    Parameters\n    ----------\n    table : astropy.table.Table\n        The table to convert.\n    character_as_bytes : bool\n        Whether to return bytes for string columns when accessed from the HDU.\n        By default this is `False` and (unicode) strings are returned, but for\n        large tables this may use up a lot of memory.\n\n    Returns\n    -------\n    table_hdu : `~astropy.io.fits.BinTableHDU`\n        The FITS binary table HDU.\n    \"\"\"\n    # Avoid circular imports\n    from .connect import is_column_keyword, REMOVE_KEYWORDS\n    from .column import python_to_tdisp\n\n    # Header to store Time related metadata\n    hdr = None\n\n    # Not all tables with mixin columns are supported\n    if table.has_mixin_columns:\n        # Import is done here, in order to avoid it at build time as erfa is not\n        # yet available then.\n        from astropy.table.column import BaseColumn\n        from astropy.time import Time\n        from astropy.units import Quantity\n        from .fitstime import time_to_fits\n\n        # Only those columns which are instances of BaseColumn, Quantity or Time can\n        # be written\n        unsupported_cols = table.columns.not_isinstance((BaseColumn, Quantity, Time))\n        if unsupported_cols:\n            unsupported_names = [col.info.name for col in unsupported_cols]\n            raise ValueError(f'cannot write table with mixin column(s) '\n                             f'{unsupported_names}')\n\n        time_cols = table.columns.isinstance(Time)\n        if time_cols:\n            table, hdr = time_to_fits(table)\n\n    # Create a new HDU object\n    tarray = table.as_array()\n    if isinstance(tarray, np.ma.MaskedArray):\n        # Fill masked values carefully:\n        # float column's default mask value needs to be Nan and\n        # string column's default mask should be an empty string.\n        # Note: getting the fill value for the structured array is\n        # more reliable than for individual columns for string entries.\n        # (no 'N/A' for a single-element string, where it should be 'N').\n        default_fill_value = np.ma.default_fill_value(tarray.dtype)\n        for colname, (coldtype, _) in tarray.dtype.fields.items():\n            if np.all(tarray.fill_value[colname] == default_fill_value[colname]):\n                # Since multi-element columns with dtypes such as '2f8' have\n                # a subdtype, we should look up the type of column on that.\n                coltype = (coldtype.subdtype[0].type\n                           if coldtype.subdtype else coldtype.type)\n                if issubclass(coltype, np.complexfloating):\n                    tarray.fill_value[colname] = complex(np.nan, np.nan)\n                elif issubclass(coltype, np.inexact):\n                    tarray.fill_value[colname] = np.nan\n                elif issubclass(coltype, np.character):\n                    tarray.fill_value[colname] = ''\n\n        # TODO: it might be better to construct the FITS table directly from\n        # the Table columns, rather than go via a structured array.\n        table_hdu = BinTableHDU.from_columns(tarray.filled(), header=hdr,\n                                             character_as_bytes=character_as_bytes)\n        for col in table_hdu.columns:\n            # Binary FITS tables support TNULL *only* for integer data columns\n            # TODO: Determine a schema for handling non-integer masked columns\n            # with non-default fill values in FITS (if at all possible).\n            int_formats = ('B', 'I', 'J', 'K')\n            if not (col.format in int_formats or\n                    col.format.p_format in int_formats):\n                continue\n\n            fill_value = tarray[col.name].fill_value\n            col.null = fill_value.astype(int)\n    else:\n        table_hdu = BinTableHDU.from_columns(tarray, header=hdr,\n                                             character_as_bytes=character_as_bytes)\n\n    # Set units and format display for output HDU\n    for col in table_hdu.columns:\n\n        if table[col.name].info.format is not None:\n            # check for boolean types, special format case\n            logical = table[col.name].info.dtype == bool\n\n            tdisp_format = python_to_tdisp(table[col.name].info.format,\n                                           logical_dtype=logical)\n            if tdisp_format is not None:\n                col.disp = tdisp_format\n\n        unit = table[col.name].unit\n        if unit is not None:\n            # Local imports to avoid importing units when it is not required,\n            # e.g. for command-line scripts\n            from astropy.units import Unit\n            from astropy.units.format.fits import UnitScaleError\n            try:\n                col.unit = unit.to_string(format='fits')\n            except UnitScaleError:\n                scale = unit.scale\n                raise UnitScaleError(\n                    f\"The column '{col.name}' could not be stored in FITS \"\n                    f\"format because it has a scale '({str(scale)})' that \"\n                    f\"is not recognized by the FITS standard. Either scale \"\n                    f\"the data or change the units.\")\n            except ValueError:\n                # Warn that the unit is lost, but let the details depend on\n                # whether the column was serialized (because it was a\n                # quantity), since then the unit can be recovered by astropy.\n                warning = (\n                    f\"The unit '{unit.to_string()}' could not be saved in \"\n                    f\"native FITS format \")\n                if any('SerializedColumn' in item and 'name: '+col.name in item\n                       for item in table.meta.get('comments', [])):\n                    warning += (\n                        \"and hence will be lost to non-astropy fits readers. \"\n                        \"Within astropy, the unit can roundtrip using QTable, \"\n                        \"though one has to enable the unit before reading.\")\n                else:\n                    warning += (\n                        \"and cannot be recovered in reading. It can roundtrip \"\n                        \"within astropy by using QTable both to write and read \"\n                        \"back, though one has to enable the unit before reading.\")\n                warnings.warn(warning, AstropyUserWarning)\n\n            else:\n                # Try creating a Unit to issue a warning if the unit is not\n                # FITS compliant\n                Unit(col.unit, format='fits', parse_strict='warn')\n\n    # Column-specific override keywords for coordinate columns\n    coord_meta = table.meta.pop('__coordinate_columns__', {})\n    for col_name, col_info in coord_meta.items():\n        col = table_hdu.columns[col_name]\n        # Set the column coordinate attributes from data saved earlier.\n        # Note: have to set these, even if we have no data.\n        for attr in 'coord_type', 'coord_unit':\n            setattr(col, attr, col_info.get(attr, None))\n        trpos = col_info.get('time_ref_pos', None)\n        if trpos is not None:\n            setattr(col, 'time_ref_pos', trpos)\n\n    for key, value in table.meta.items():\n        if is_column_keyword(key.upper()) or key.upper() in REMOVE_KEYWORDS:\n            warnings.warn(\n                f\"Meta-data keyword {key} will be ignored since it conflicts \"\n                f\"with a FITS reserved keyword\", AstropyUserWarning)\n            continue\n\n        # Convert to FITS format\n        if key == 'comments':\n            key = 'comment'\n\n        if isinstance(value, list):\n            for item in value:\n                try:\n                    table_hdu.header.append((key, item))\n                except ValueError:\n                    warnings.warn(\n                        f\"Attribute `{key}` of type {type(value)} cannot be \"\n                        f\"added to FITS Header - skipping\", AstropyUserWarning)\n        else:\n            try:\n                table_hdu.header[key] = value\n            except ValueError:\n                warnings.warn(\n                    f\"Attribute `{key}` of type {type(value)} cannot be \"\n                    f\"added to FITS Header - skipping\", AstropyUserWarning)\n    return table_hdu\n\n\ndef append(filename, data, header=None, checksum=False, verify=True, **kwargs):\n    \"\"\"\n    Append the header/data to FITS file if filename exists, create if not.\n\n    If only ``data`` is supplied, a minimal header is created.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        File to write to.  If opened, must be opened for update (rb+) unless it\n        is a new file, then it must be opened for append (ab+).  A file or\n        `~gzip.GzipFile` object opened for update will be closed after return.\n\n    data : array, :class:`~astropy.table.Table`, or `~astropy.io.fits.Group`\n        The new data used for appending.\n\n    header : `Header` object, optional\n        The header associated with ``data``.  If `None`, an appropriate header\n        will be created for the data object supplied.\n\n    checksum : bool, optional\n        When `True` adds both ``DATASUM`` and ``CHECKSUM`` cards to the header\n        of the HDU when written to the file.\n\n    verify : bool, optional\n        When `True`, the existing FITS file will be read in to verify it for\n        correctness before appending.  When `False`, content is simply appended\n        to the end of the file.  Setting ``verify`` to `False` can be much\n        faster.\n\n    **kwargs\n        Additional arguments are passed to:\n\n        - `~astropy.io.fits.writeto` if the file does not exist or is empty.\n          In this case ``output_verify`` is the only possible argument.\n        - `~astropy.io.fits.open` if ``verify`` is True or if ``filename``\n          is a file object.\n        - Otherwise no additional arguments can be used.\n\n    \"\"\"\n    name, closed, noexist_or_empty = _stat_filename_or_fileobj(filename)\n\n    if noexist_or_empty:\n        #\n        # The input file or file like object either doesn't exits or is\n        # empty.  Use the writeto convenience function to write the\n        # output to the empty object.\n        #\n        writeto(filename, data, header, checksum=checksum, **kwargs)\n    else:\n        hdu = _makehdu(data, header)\n\n        if isinstance(hdu, PrimaryHDU):\n            hdu = ImageHDU(data, header)\n\n        if verify or not closed:\n            f = fitsopen(filename, mode='append', **kwargs)\n            try:\n                f.append(hdu)\n\n                # Set a flag in the HDU so that only this HDU gets a checksum\n                # when writing the file.\n                hdu._output_checksum = checksum\n            finally:\n                f.close(closed=closed)\n        else:\n            f = _File(filename, mode='append')\n            try:\n                hdu._output_checksum = checksum\n                hdu._writeto(f)\n            finally:\n                f.close()\n\n\ndef update(filename, data, *args, **kwargs):\n    \"\"\"\n    Update the specified HDU with the input data/header.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        File to update.  If opened, mode must be update (rb+).  An opened file\n        object or `~gzip.GzipFile` object will be closed upon return.\n\n    data : array, `~astropy.table.Table`, or `~astropy.io.fits.Group`\n        The new data used for updating.\n\n    header : `Header` object, optional\n        The header associated with ``data``.  If `None`, an appropriate header\n        will be created for the data object supplied.\n\n    ext, extname, extver\n        The rest of the arguments are flexible: the 3rd argument can be the\n        header associated with the data.  If the 3rd argument is not a\n        `Header`, it (and other positional arguments) are assumed to be the\n        HDU specification(s).  Header and HDU specs can also be\n        keyword arguments.  For example::\n\n            update(file, dat, hdr, 'sci')  # update the 'sci' extension\n            update(file, dat, 3)  # update the 3rd extension HDU\n            update(file, dat, hdr, 3)  # update the 3rd extension HDU\n            update(file, dat, 'sci', 2)  # update the 2nd extension HDU named 'sci'\n            update(file, dat, 3, header=hdr)  # update the 3rd extension HDU\n            update(file, dat, header=hdr, ext=5)  # update the 5th extension HDU\n\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n    \"\"\"\n\n    # The arguments to this function are a bit trickier to deal with than others\n    # in this module, since the documentation has promised that the header\n    # argument can be an optional positional argument.\n    if args and isinstance(args[0], Header):\n        header = args[0]\n        args = args[1:]\n    else:\n        header = None\n    # The header can also be a keyword argument--if both are provided the\n    # keyword takes precedence\n    header = kwargs.pop('header', header)\n\n    new_hdu = _makehdu(data, header)\n\n    closed = fileobj_closed(filename)\n\n    hdulist, _ext = _getext(filename, 'update', *args, **kwargs)\n    try:\n        hdulist[_ext] = new_hdu\n    finally:\n        hdulist.close(closed=closed)\n\n\ndef info(filename, output=None, **kwargs):\n    \"\"\"\n    Print the summary information on a FITS file.\n\n    This includes the name, type, length of header, data shape and type\n    for each HDU.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        FITS file to obtain info from.  If opened, mode must be one of\n        the following: rb, rb+, or ab+ (i.e. the file must be readable).\n\n    output : file, bool, optional\n        A file-like object to write the output to.  If ``False``, does not\n        output to a file and instead returns a list of tuples representing the\n        HDU info.  Writes to ``sys.stdout`` by default.\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n        *Note:* This function sets ``ignore_missing_end=True`` by default.\n    \"\"\"\n\n    mode, closed = _get_file_mode(filename, default='readonly')\n    # Set the default value for the ignore_missing_end parameter\n    if 'ignore_missing_end' not in kwargs:\n        kwargs['ignore_missing_end'] = True\n\n    f = fitsopen(filename, mode=mode, **kwargs)\n    try:\n        ret = f.info(output=output)\n    finally:\n        if closed:\n            f.close()\n\n    return ret\n\n\ndef printdiff(inputa, inputb, *args, **kwargs):\n    \"\"\"\n    Compare two parts of a FITS file, including entire FITS files,\n    FITS `HDUList` objects and FITS ``HDU`` objects.\n\n    Parameters\n    ----------\n    inputa : str, `HDUList` object, or ``HDU`` object\n        The filename of a FITS file, `HDUList`, or ``HDU``\n        object to compare to ``inputb``.\n\n    inputb : str, `HDUList` object, or ``HDU`` object\n        The filename of a FITS file, `HDUList`, or ``HDU``\n        object to compare to ``inputa``.\n\n    ext, extname, extver\n        Additional positional arguments are for HDU specification if your\n        inputs are string filenames (will not work if\n        ``inputa`` and ``inputb`` are ``HDU`` objects or `HDUList` objects).\n        They are flexible and are best illustrated by examples.  In addition\n        to using these arguments positionally you can directly call the\n        keyword parameters ``ext``, ``extname``.\n\n        By HDU number::\n\n            printdiff('inA.fits', 'inB.fits', 0)      # the primary HDU\n            printdiff('inA.fits', 'inB.fits', 2)      # the second extension HDU\n            printdiff('inA.fits', 'inB.fits', ext=2)  # the second extension HDU\n\n        By name, i.e., ``EXTNAME`` value (if unique). ``EXTNAME`` values are\n        not case sensitive:\n\n            printdiff('inA.fits', 'inB.fits', 'sci')\n            printdiff('inA.fits', 'inB.fits', extname='sci')  # equivalent\n\n        By combination of ``EXTNAME`` and ``EXTVER`` as separate\n        arguments or as a tuple::\n\n            printdiff('inA.fits', 'inB.fits', 'sci', 2)    # EXTNAME='SCI'\n                                                           # & EXTVER=2\n            printdiff('inA.fits', 'inB.fits', extname='sci', extver=2)\n                                                           # equivalent\n            printdiff('inA.fits', 'inB.fits', ('sci', 2))  # equivalent\n\n        Ambiguous or conflicting specifications will raise an exception::\n\n            printdiff('inA.fits', 'inB.fits',\n                      ext=('sci', 1), extname='err', extver=2)\n\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `~astropy.io.fits.FITSDiff`.\n\n    Notes\n    -----\n    The primary use for the `printdiff` function is to allow quick print out\n    of a FITS difference report and will write to ``sys.stdout``.\n    To save the diff report to a file please use `~astropy.io.fits.FITSDiff`\n    directly.\n    \"\"\"\n\n    # Pop extension keywords\n    extension = {key: kwargs.pop(key) for key in ['ext', 'extname', 'extver']\n                 if key in kwargs}\n    has_extensions = args or extension\n\n    if isinstance(inputa, str) and has_extensions:\n        # Use handy _getext to interpret any ext keywords, but\n        # will need to close a if  fails\n        modea, closeda = _get_file_mode(inputa)\n        modeb, closedb = _get_file_mode(inputb)\n\n        hdulista, extidxa = _getext(inputa, modea, *args, **extension)\n        # Have to close a if b doesn't make it\n        try:\n            hdulistb, extidxb = _getext(inputb, modeb, *args, **extension)\n        except Exception:\n            hdulista.close(closed=closeda)\n            raise\n\n        try:\n            hdua = hdulista[extidxa]\n            hdub = hdulistb[extidxb]\n            # See below print for note\n            print(HDUDiff(hdua, hdub, **kwargs).report())\n\n        finally:\n            hdulista.close(closed=closeda)\n            hdulistb.close(closed=closedb)\n\n    # If input is not a string, can feed HDU objects or HDUList directly,\n    # but can't currently handle extensions\n    elif isinstance(inputa, _ValidHDU) and has_extensions:\n        raise ValueError(\"Cannot use extension keywords when providing an \"\n                         \"HDU object.\")\n\n    elif isinstance(inputa, _ValidHDU) and not has_extensions:\n        print(HDUDiff(inputa, inputb, **kwargs).report())\n\n    elif isinstance(inputa, HDUList) and has_extensions:\n        raise NotImplementedError(\"Extension specification with HDUList \"\n                                  \"objects not implemented.\")\n\n    # This function is EXCLUSIVELY for printing the diff report to screen\n    # in a one-liner call, hence the use of print instead of logging\n    else:\n        print(FITSDiff(inputa, inputb, **kwargs).report())\n\n\ndef tabledump(filename, datafile=None, cdfile=None, hfile=None, ext=1,\n              overwrite=False):\n    \"\"\"\n    Dump a table HDU to a file in ASCII format.  The table may be\n    dumped in three separate files, one containing column definitions,\n    one containing header parameters, and one for table data.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        Input fits file.\n\n    datafile : path-like or file-like, optional\n        Output data file.  The default is the root name of the input\n        fits file appended with an underscore, followed by the\n        extension number (ext), followed by the extension ``.txt``.\n\n    cdfile : path-like or file-like, optional\n        Output column definitions file.  The default is `None`,\n        no column definitions output is produced.\n\n    hfile : path-like or file-like, optional\n        Output header parameters file.  The default is `None`,\n        no header parameters output is produced.\n\n    ext : int\n        The number of the extension containing the table HDU to be\n        dumped.\n\n    overwrite : bool, optional\n        If ``True``, overwrite the output file if it exists. Raises an\n        ``OSError`` if ``False`` and the output file exists. Default is\n        ``False``.\n\n    Notes\n    -----\n    The primary use for the `tabledump` function is to allow editing in a\n    standard text editor of the table data and parameters.  The\n    `tableload` function can be used to reassemble the table from the\n    three ASCII files.\n    \"\"\"\n\n    # allow file object to already be opened in any of the valid modes\n    # and leave the file in the same state (opened or closed) as when\n    # the function was called\n\n    mode, closed = _get_file_mode(filename, default='readonly')\n    f = fitsopen(filename, mode=mode)\n\n    # Create the default data file name if one was not provided\n    try:\n        if not datafile:\n            root, tail = os.path.splitext(f._file.name)\n            datafile = root + '_' + repr(ext) + '.txt'\n\n        # Dump the data from the HDU to the files\n        f[ext].dump(datafile, cdfile, hfile, overwrite)\n    finally:\n        if closed:\n            f.close()\n\n\nif isinstance(tabledump.__doc__, str):\n    tabledump.__doc__ += BinTableHDU._tdump_file_format.replace('\\n', '\\n    ')\n\n\ndef tableload(datafile, cdfile, hfile=None):\n    \"\"\"\n    Create a table from the input ASCII files.  The input is from up\n    to three separate files, one containing column definitions, one\n    containing header parameters, and one containing column data.  The\n    header parameters file is not required.  When the header\n    parameters file is absent a minimal header is constructed.\n\n    Parameters\n    ----------\n    datafile : path-like or file-like\n        Input data file containing the table data in ASCII format.\n\n    cdfile : path-like or file-like\n        Input column definition file containing the names, formats,\n        display formats, physical units, multidimensional array\n        dimensions, undefined values, scale factors, and offsets\n        associated with the columns in the table.\n\n    hfile : path-like or file-like, optional\n        Input parameter definition file containing the header\n        parameter definitions to be associated with the table.\n        If `None`, a minimal header is constructed.\n\n    Notes\n    -----\n    The primary use for the `tableload` function is to allow the input of\n    ASCII data that was edited in a standard text editor of the table\n    data and parameters.  The tabledump function can be used to create the\n    initial ASCII files.\n    \"\"\"\n\n    return BinTableHDU.load(datafile, cdfile, hfile, replace=True)\n\n\nif isinstance(tableload.__doc__, str):\n    tableload.__doc__ += BinTableHDU._tdump_file_format.replace('\\n', '\\n    ')\n\n\ndef _getext(filename, mode, *args, ext=None, extname=None, extver=None,\n            **kwargs):\n    \"\"\"\n    Open the input file, return the `HDUList` and the extension.\n\n    This supports several different styles of extension selection.  See the\n    :func:`getdata()` documentation for the different possibilities.\n    \"\"\"\n\n    err_msg = ('Redundant/conflicting extension arguments(s): {}'.format(\n            {'args': args, 'ext': ext, 'extname': extname,\n             'extver': extver}))\n\n    # This code would be much simpler if just one way of specifying an\n    # extension were picked.  But now we need to support all possible ways for\n    # the time being.\n    if len(args) == 1:\n        # Must be either an extension number, an extension name, or an\n        # (extname, extver) tuple\n        if _is_int(args[0]) or (isinstance(ext, tuple) and len(ext) == 2):\n            if ext is not None or extname is not None or extver is not None:\n                raise TypeError(err_msg)\n            ext = args[0]\n        elif isinstance(args[0], str):\n            # The first arg is an extension name; it could still be valid\n            # to provide an extver kwarg\n            if ext is not None or extname is not None:\n                raise TypeError(err_msg)\n            extname = args[0]\n        else:\n            # Take whatever we have as the ext argument; we'll validate it\n            # below\n            ext = args[0]\n    elif len(args) == 2:\n        # Must be an extname and extver\n        if ext is not None or extname is not None or extver is not None:\n            raise TypeError(err_msg)\n        extname = args[0]\n        extver = args[1]\n    elif len(args) > 2:\n        raise TypeError('Too many positional arguments.')\n\n    if (ext is not None and\n            not (_is_int(ext) or\n                 (isinstance(ext, tuple) and len(ext) == 2 and\n                  isinstance(ext[0], str) and _is_int(ext[1])))):\n        raise ValueError(\n            'The ext keyword must be either an extension number '\n            '(zero-indexed) or a (extname, extver) tuple.')\n    if extname is not None and not isinstance(extname, str):\n        raise ValueError('The extname argument must be a string.')\n    if extver is not None and not _is_int(extver):\n        raise ValueError('The extver argument must be an integer.')\n\n    if ext is None and extname is None and extver is None:\n        ext = 0\n    elif ext is not None and (extname is not None or extver is not None):\n        raise TypeError(err_msg)\n    elif extname:\n        if extver:\n            ext = (extname, extver)\n        else:\n            ext = (extname, 1)\n    elif extver and extname is None:\n        raise TypeError('extver alone cannot specify an extension.')\n\n    hdulist = fitsopen(filename, mode=mode, **kwargs)\n\n    return hdulist, ext\n\n\ndef _makehdu(data, header):\n    if header is None:\n        header = Header()\n    hdu = _BaseHDU._from_data(data, header)\n    if hdu.__class__ in (_BaseHDU, _ValidHDU):\n        # The HDU type was unrecognized, possibly due to a\n        # nonexistent/incomplete header\n        if ((isinstance(data, np.ndarray) and data.dtype.fields is not None) or\n                isinstance(data, np.recarray)):\n            hdu = BinTableHDU(data, header=header)\n        elif isinstance(data, np.ndarray) or _is_dask_array(data):\n            hdu = ImageHDU(data, header=header)\n        else:\n            raise KeyError('Data must be a numpy array.')\n    return hdu\n\n\ndef _stat_filename_or_fileobj(filename):\n    if isinstance(filename, os.PathLike):\n        filename = os.fspath(filename)\n    closed = fileobj_closed(filename)\n    name = fileobj_name(filename) or ''\n\n    try:\n        loc = filename.tell()\n    except AttributeError:\n        loc = 0\n\n    noexist_or_empty = ((name and\n                         (not os.path.exists(name) or\n                          (os.path.getsize(name) == 0)))\n                        or (not name and loc == 0))\n\n    return name, closed, noexist_or_empty\n\n\ndef _get_file_mode(filename, default='readonly'):\n    \"\"\"\n    Allow file object to already be opened in any of the valid modes and\n    and leave the file in the same state (opened or closed) as when\n    the function was called.\n    \"\"\"\n\n    mode = default\n    closed = fileobj_closed(filename)\n\n    fmode = fileobj_mode(filename)\n    if fmode is not None:\n        mode = FILE_MODES.get(fmode)\n        if mode is None:\n            raise OSError(\n                \"File mode of the input file object ({!r}) cannot be used to \"\n                \"read/write FITS files.\".format(fmode))\n\n    return mode, closed\n"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":54,"id":1716,"name":"enable_uint","nodeType":"Attribute","startLoc":54,"text":"enable_uint"},{"col":4,"comment":"null","endLoc":1509,"header":"def __init__(self, terminals)","id":1717,"name":"__init__","nodeType":"Function","startLoc":1476,"text":"def __init__(self, terminals):\n        self.Productions  = [None]  # A list of all of the productions.  The first\n                                    # entry is always reserved for the purpose of\n                                    # building an augmented grammar\n\n        self.Prodnames    = {}      # A dictionary mapping the names of nonterminals to a list of all\n                                    # productions of that nonterminal.\n\n        self.Prodmap      = {}      # A dictionary that is only used to detect duplicate\n                                    # productions.\n\n        self.Terminals    = {}      # A dictionary mapping the names of terminal symbols to a\n                                    # list of the rules where they are used.\n\n        for term in terminals:\n            self.Terminals[term] = []\n\n        self.Terminals['error'] = []\n\n        self.Nonterminals = {}      # A dictionary mapping names of nonterminals to a list\n                                    # of rule numbers where they are used.\n\n        self.First        = {}      # A dictionary of precomputed FIRST(x) symbols\n\n        self.Follow       = {}      # A dictionary of precomputed FOLLOW(x) symbols\n\n        self.Precedence   = {}      # Precedence rules for each terminal. Contains tuples of the\n                                    # form ('right',level) or ('nonassoc', level) or ('left',level)\n\n        self.UsedPrecedence = set() # Precedence rules that were actually used by the grammer.\n                                    # This is only used to provide error checking and to generate\n                                    # a warning about unused precedence rules.\n\n        self.Start = None           # Starting symbol for the grammar"},{"col":0,"comment":"\n    Given a number, split it into its mantissa and base 10 exponent\n    parts, each as strings.  If the exponent is too small, it may be\n    returned as the empty string.\n\n    Parameters\n    ----------\n    v : float\n\n    format_spec : str, optional\n        Number representation formatting string\n\n    Returns\n    -------\n    mantissa, exponent : tuple of strings\n    ","endLoc":76,"header":"def split_mantissa_exponent(v, format_spec=\".8g\")","id":1718,"name":"split_mantissa_exponent","nodeType":"Function","startLoc":46,"text":"def split_mantissa_exponent(v, format_spec=\".8g\"):\n    \"\"\"\n    Given a number, split it into its mantissa and base 10 exponent\n    parts, each as strings.  If the exponent is too small, it may be\n    returned as the empty string.\n\n    Parameters\n    ----------\n    v : float\n\n    format_spec : str, optional\n        Number representation formatting string\n\n    Returns\n    -------\n    mantissa, exponent : tuple of strings\n    \"\"\"\n    x = format(v, format_spec).split('e')\n    if x[0] != '1.' + '0' * (len(x[0]) - 2):\n        m = x[0]\n    else:\n        m = ''\n\n    if len(x) == 2:\n        ex = x[1].lstrip(\"0+\")\n        if len(ex) > 0 and ex[0] == '-':\n            ex = '-' + ex[1:].lstrip('0')\n    else:\n        ex = ''\n\n    return m, ex"},{"className":"FITSDiff","col":0,"comment":"Diff two FITS files by filename, or two `HDUList` objects.\n\n    `FITSDiff` objects have the following diff attributes:\n\n    - ``diff_hdu_count``: If the FITS files being compared have different\n      numbers of HDUs, this contains a 2-tuple of the number of HDUs in each\n      file.\n\n    - ``diff_hdus``: If any HDUs with the same index are different, this\n      contains a list of 2-tuples of the HDU index and the `HDUDiff` object\n      representing the differences between the two HDUs.\n    ","endLoc":419,"id":1719,"nodeType":"Class","startLoc":185,"text":"class FITSDiff(_BaseDiff):\n    \"\"\"Diff two FITS files by filename, or two `HDUList` objects.\n\n    `FITSDiff` objects have the following diff attributes:\n\n    - ``diff_hdu_count``: If the FITS files being compared have different\n      numbers of HDUs, this contains a 2-tuple of the number of HDUs in each\n      file.\n\n    - ``diff_hdus``: If any HDUs with the same index are different, this\n      contains a list of 2-tuples of the HDU index and the `HDUDiff` object\n      representing the differences between the two HDUs.\n    \"\"\"\n\n    def __init__(self, a, b, ignore_hdus=[], ignore_keywords=[],\n                 ignore_comments=[], ignore_fields=[],\n                 numdiffs=10, rtol=0.0, atol=0.0,\n                 ignore_blanks=True, ignore_blank_cards=True):\n        \"\"\"\n        Parameters\n        ----------\n        a : str or `HDUList`\n            The filename of a FITS file on disk, or an `HDUList` object.\n\n        b : str or `HDUList`\n            The filename of a FITS file on disk, or an `HDUList` object to\n            compare to the first file.\n\n        ignore_hdus : sequence, optional\n            HDU names to ignore when comparing two FITS files or HDU lists; the\n            presence of these HDUs and their contents are ignored.  Wildcard\n            strings may also be included in the list.\n\n        ignore_keywords : sequence, optional\n            Header keywords to ignore when comparing two headers; the presence\n            of these keywords and their values are ignored.  Wildcard strings\n            may also be included in the list.\n\n        ignore_comments : sequence, optional\n            A list of header keywords whose comments should be ignored in the\n            comparison.  May contain wildcard strings as with ignore_keywords.\n\n        ignore_fields : sequence, optional\n            The (case-insensitive) names of any table columns to ignore if any\n            table data is to be compared.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\\\left| a - b \\\\right| > \\\\text{atol} + \\\\text{rtol} \\\\cdot \\\\left| b \\\\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n\n        ignore_blanks : bool, optional\n            Ignore extra whitespace at the end of string values either in\n            headers or data. Extra leading whitespace is not ignored\n            (default: True).\n\n        ignore_blank_cards : bool, optional\n            Ignore all cards that are blank, i.e. they only contain\n            whitespace (default: True).\n        \"\"\"\n\n        if isinstance(a, (str, os.PathLike)):\n            try:\n                a = fitsopen(a)\n            except Exception as exc:\n                raise OSError(\"error opening file a ({}): {}: {}\".format(\n                        a, exc.__class__.__name__, exc.args[0]))\n            close_a = True\n        else:\n            close_a = False\n\n        if isinstance(b, (str, os.PathLike)):\n            try:\n                b = fitsopen(b)\n            except Exception as exc:\n                raise OSError(\"error opening file b ({}): {}: {}\".format(\n                        b, exc.__class__.__name__, exc.args[0]))\n            close_b = True\n        else:\n            close_b = False\n\n        # Normalize keywords/fields to ignore to upper case\n        self.ignore_hdus = set(k.upper() for k in ignore_hdus)\n        self.ignore_keywords = set(k.upper() for k in ignore_keywords)\n        self.ignore_comments = set(k.upper() for k in ignore_comments)\n        self.ignore_fields = set(k.upper() for k in ignore_fields)\n\n        self.numdiffs = numdiffs\n        self.rtol = rtol\n        self.atol = atol\n\n        self.ignore_blanks = ignore_blanks\n        self.ignore_blank_cards = ignore_blank_cards\n\n        # Some hdu names may be pattern wildcards.  Find them.\n        self.ignore_hdu_patterns = set()\n        for name in list(self.ignore_hdus):\n            if name != '*' and glob.has_magic(name):\n                self.ignore_hdus.remove(name)\n                self.ignore_hdu_patterns.add(name)\n\n        self.diff_hdu_count = ()\n        self.diff_hdus = []\n\n        try:\n            super().__init__(a, b)\n        finally:\n            if close_a:\n                a.close()\n            if close_b:\n                b.close()\n\n    def _diff(self):\n        if len(self.a) != len(self.b):\n            self.diff_hdu_count = (len(self.a), len(self.b))\n\n        # Record filenames for use later in _report\n        self.filenamea = self.a.filename()\n        if not self.filenamea:\n            self.filenamea = f'<{self.a.__class__.__name__} object at {id(self.a):#x}>'\n\n        self.filenameb = self.b.filename()\n        if not self.filenameb:\n            self.filenameb = f'<{self.b.__class__.__name__} object at {id(self.b):#x}>'\n\n        if self.ignore_hdus:\n            self.a = HDUList([h for h in self.a if h.name not in self.ignore_hdus])\n            self.b = HDUList([h for h in self.b if h.name not in self.ignore_hdus])\n        if self.ignore_hdu_patterns:\n            a_names = [hdu.name for hdu in self.a]\n            b_names = [hdu.name for hdu in self.b]\n            for pattern in self.ignore_hdu_patterns:\n                self.a = HDUList([h for h in self.a if h.name not in fnmatch.filter(\n                    a_names, pattern)])\n                self.b = HDUList([h for h in self.b if h.name not in fnmatch.filter(\n                    b_names, pattern)])\n\n        # For now, just compare the extensions one by one in order.\n        # Might allow some more sophisticated types of diffing later.\n\n        # TODO: Somehow or another simplify the passing around of diff\n        # options--this will become important as the number of options grows\n        for idx in range(min(len(self.a), len(self.b))):\n            hdu_diff = HDUDiff.fromdiff(self, self.a[idx], self.b[idx])\n\n            if not hdu_diff.identical:\n                if self.a[idx].name == self.b[idx].name and self.a[idx].ver == self.b[idx].ver:\n                    self.diff_hdus.append((idx, hdu_diff, self.a[idx].name, self.a[idx].ver))\n                else:\n                    self.diff_hdus.append((idx, hdu_diff, \"\", self.a[idx].ver))\n\n    def _report(self):\n        wrapper = textwrap.TextWrapper(initial_indent='  ',\n                                       subsequent_indent='  ')\n\n        self._fileobj.write('\\n')\n        self._writeln(f' fitsdiff: {__version__}')\n        self._writeln(f' a: {self.filenamea}\\n b: {self.filenameb}')\n\n        if self.ignore_hdus:\n            ignore_hdus = ' '.join(sorted(self.ignore_hdus))\n            self._writeln(f' HDU(s) not to be compared:\\n{wrapper.fill(ignore_hdus)}')\n\n        if self.ignore_hdu_patterns:\n            ignore_hdu_patterns = ' '.join(sorted(self.ignore_hdu_patterns))\n            self._writeln(' HDU(s) not to be compared:\\n{}'\n                          .format(wrapper.fill(ignore_hdu_patterns)))\n\n        if self.ignore_keywords:\n            ignore_keywords = ' '.join(sorted(self.ignore_keywords))\n            self._writeln(' Keyword(s) not to be compared:\\n{}'\n                          .format(wrapper.fill(ignore_keywords)))\n\n        if self.ignore_comments:\n            ignore_comments = ' '.join(sorted(self.ignore_comments))\n            self._writeln(' Keyword(s) whose comments are not to be compared'\n                          ':\\n{}'.format(wrapper.fill(ignore_comments)))\n\n        if self.ignore_fields:\n            ignore_fields = ' '.join(sorted(self.ignore_fields))\n            self._writeln(' Table column(s) not to be compared:\\n{}'\n                          .format(wrapper.fill(ignore_fields)))\n\n        self._writeln(' Maximum number of different data values to be '\n                      'reported: {}'.format(self.numdiffs))\n        self._writeln(' Relative tolerance: {}, Absolute tolerance: {}'\n                      .format(self.rtol, self.atol))\n\n        if self.diff_hdu_count:\n            self._fileobj.write('\\n')\n            self._writeln('Files contain different numbers of HDUs:')\n            self._writeln(f' a: {self.diff_hdu_count[0]}')\n            self._writeln(f' b: {self.diff_hdu_count[1]}')\n\n            if not self.diff_hdus:\n                self._writeln('No differences found between common HDUs.')\n                return\n        elif not self.diff_hdus:\n            self._fileobj.write('\\n')\n            self._writeln('No differences found.')\n            return\n\n        for idx, hdu_diff, extname, extver in self.diff_hdus:\n            # print out the extension heading\n            if idx == 0:\n                self._fileobj.write('\\n')\n                self._writeln('Primary HDU:')\n            else:\n                self._fileobj.write('\\n')\n                if extname:\n                    self._writeln(f'Extension HDU {idx} ({extname}, {extver}):')\n                else:\n                    self._writeln(f'Extension HDU {idx}:')\n            hdu_diff.report(self._fileobj, indent=self._indent + 1)"},{"col":4,"comment":"\n        Append a new HDU to the `HDUList`.\n\n        Parameters\n        ----------\n        hdu : BaseHDU\n            HDU to add to the `HDUList`.\n        ","endLoc":688,"header":"def append(self, hdu)","id":1720,"name":"append","nodeType":"Function","startLoc":643,"text":"def append(self, hdu):\n        \"\"\"\n        Append a new HDU to the `HDUList`.\n\n        Parameters\n        ----------\n        hdu : BaseHDU\n            HDU to add to the `HDUList`.\n        \"\"\"\n\n        if not isinstance(hdu, _BaseHDU):\n            raise ValueError('HDUList can only append an HDU.')\n\n        if len(self) > 0:\n            if isinstance(hdu, GroupsHDU):\n                raise ValueError(\n                    \"Can't append a GroupsHDU to a non-empty HDUList\")\n\n            if isinstance(hdu, PrimaryHDU):\n                # You passed a Primary HDU but we need an Extension HDU\n                # so create an Extension HDU from the input Primary HDU.\n                # TODO: This isn't necessarily sufficient to copy the HDU;\n                # _header_offset and friends need to be copied too.\n                hdu = ImageHDU(hdu.data, hdu.header)\n        else:\n            if not isinstance(hdu, (PrimaryHDU, _NonstandardHDU)):\n                # You passed in an Extension HDU but we need a Primary\n                # HDU.\n                # If you provided an ImageHDU then we can convert it to\n                # a primary HDU and use that.\n                if isinstance(hdu, ImageHDU):\n                    hdu = PrimaryHDU(hdu.data, hdu.header)\n                else:\n                    # You didn't provide an ImageHDU so we create a\n                    # simple Primary HDU and append that first before\n                    # we append the new Extension HDU.\n                    phdu = PrimaryHDU()\n                    super().append(phdu)\n\n        super().append(hdu)\n        hdu._new = True\n        self._resize = True\n        self._truncate = False\n\n        # make sure the EXTEND keyword is in primary HDU if there is extension\n        self.update_extend()"},{"col":4,"comment":"null","endLoc":1387,"header":"def __str__(self)","id":1721,"name":"__str__","nodeType":"Function","startLoc":1386,"text":"def __str__(self):\n        return self.to_string()"},{"col":4,"comment":"null","endLoc":1393,"header":"def __repr__(self)","id":1722,"name":"__repr__","nodeType":"Function","startLoc":1389,"text":"def __repr__(self):\n        prefixstr = '<' + self.__class__.__name__ + ' '\n        arrstr = np.array2string(self.view(np.ndarray), separator=', ',\n                                 prefix=prefixstr)\n        return f'{prefixstr}{arrstr}{self._unitstr:s}>'"},{"col":4,"comment":"\n        Generate a latex representation of the quantity and its unit.\n\n        Returns\n        -------\n        lstr\n            A LaTeX string with the contents of this Quantity\n        ","endLoc":1405,"header":"def _repr_latex_(self)","id":1723,"name":"_repr_latex_","nodeType":"Function","startLoc":1395,"text":"def _repr_latex_(self):\n        \"\"\"\n        Generate a latex representation of the quantity and its unit.\n\n        Returns\n        -------\n        lstr\n            A LaTeX string with the contents of this Quantity\n        \"\"\"\n        # NOTE: This should change to display format in a future release\n        return self.to_string(format='latex', subfmt='inline')"},{"col":4,"comment":"\n        Format quantities using the new-style python formatting codes\n        as specifiers for the number.\n\n        If the format specifier correctly applies itself to the value,\n        then it is used to format only the value. If it cannot be\n        applied to the value, then it is applied to the whole string.\n\n        ","endLoc":1425,"header":"def __format__(self, format_spec)","id":1724,"name":"__format__","nodeType":"Function","startLoc":1407,"text":"def __format__(self, format_spec):\n        \"\"\"\n        Format quantities using the new-style python formatting codes\n        as specifiers for the number.\n\n        If the format specifier correctly applies itself to the value,\n        then it is used to format only the value. If it cannot be\n        applied to the value, then it is applied to the whole string.\n\n        \"\"\"\n        try:\n            value = format(self.value, format_spec)\n            full_format_spec = \"s\"\n        except ValueError:\n            value = self.value\n            full_format_spec = format_spec\n\n        return format(f\"{value}{self._unitstr:s}\",\n                      full_format_spec)"},{"col":4,"comment":"\n        Generates a new `Quantity` with the units\n        decomposed. Decomposed units have only irreducible units in\n        them (see `astropy.units.UnitBase.decompose`).\n\n        Parameters\n        ----------\n        bases : sequence of `~astropy.units.UnitBase`, optional\n            The bases to decompose into.  When not provided,\n            decomposes down to any irreducible units.  When provided,\n            the decomposed result will only contain the given units.\n            This will raises a `~astropy.units.UnitsError` if it's not possible\n            to do so.\n\n        Returns\n        -------\n        newq : `~astropy.units.Quantity`\n            A new object equal to this quantity with units decomposed.\n        ","endLoc":1447,"header":"def decompose(self, bases=[])","id":1725,"name":"decompose","nodeType":"Function","startLoc":1427,"text":"def decompose(self, bases=[]):\n        \"\"\"\n        Generates a new `Quantity` with the units\n        decomposed. Decomposed units have only irreducible units in\n        them (see `astropy.units.UnitBase.decompose`).\n\n        Parameters\n        ----------\n        bases : sequence of `~astropy.units.UnitBase`, optional\n            The bases to decompose into.  When not provided,\n            decomposes down to any irreducible units.  When provided,\n            the decomposed result will only contain the given units.\n            This will raises a `~astropy.units.UnitsError` if it's not possible\n            to do so.\n\n        Returns\n        -------\n        newq : `~astropy.units.Quantity`\n            A new object equal to this quantity with units decomposed.\n        \"\"\"\n        return self._decompose(False, bases=bases)"},{"col":4,"comment":"\n        Generates a new `Quantity` with the units decomposed. Decomposed\n        units have only irreducible units in them (see\n        `astropy.units.UnitBase.decompose`).\n\n        Parameters\n        ----------\n        allowscaledunits : bool\n            If True, the resulting `Quantity` may have a scale factor\n            associated with it.  If False, any scaling in the unit will\n            be subsumed into the value of the resulting `Quantity`\n\n        bases : sequence of UnitBase, optional\n            The bases to decompose into.  When not provided,\n            decomposes down to any irreducible units.  When provided,\n            the decomposed result will only contain the given units.\n            This will raises a `~astropy.units.UnitsError` if it's not possible\n            to do so.\n\n        Returns\n        -------\n        newq : `~astropy.units.Quantity`\n            A new object equal to this quantity with units decomposed.\n\n        ","endLoc":1485,"header":"def _decompose(self, allowscaledunits=False, bases=[])","id":1726,"name":"_decompose","nodeType":"Function","startLoc":1449,"text":"def _decompose(self, allowscaledunits=False, bases=[]):\n        \"\"\"\n        Generates a new `Quantity` with the units decomposed. Decomposed\n        units have only irreducible units in them (see\n        `astropy.units.UnitBase.decompose`).\n\n        Parameters\n        ----------\n        allowscaledunits : bool\n            If True, the resulting `Quantity` may have a scale factor\n            associated with it.  If False, any scaling in the unit will\n            be subsumed into the value of the resulting `Quantity`\n\n        bases : sequence of UnitBase, optional\n            The bases to decompose into.  When not provided,\n            decomposes down to any irreducible units.  When provided,\n            the decomposed result will only contain the given units.\n            This will raises a `~astropy.units.UnitsError` if it's not possible\n            to do so.\n\n        Returns\n        -------\n        newq : `~astropy.units.Quantity`\n            A new object equal to this quantity with units decomposed.\n\n        \"\"\"\n\n        new_unit = self.unit.decompose(bases=bases)\n\n        # Be careful here because self.value usually is a view of self;\n        # be sure that the original value is not being modified.\n        if not allowscaledunits and hasattr(new_unit, 'scale'):\n            new_value = self.value * new_unit.scale\n            new_unit = new_unit / new_unit.scale\n            return self._new_view(new_value, new_unit)\n        else:\n            return self._new_view(self.copy(), new_unit)"},{"col":4,"comment":"Copy an element of an array to a scalar Quantity and return it.\n\n        Like :meth:`~numpy.ndarray.item` except that it always\n        returns a `Quantity`, not a Python scalar.\n\n        ","endLoc":1498,"header":"def item(self, *args)","id":1727,"name":"item","nodeType":"Function","startLoc":1491,"text":"def item(self, *args):\n        \"\"\"Copy an element of an array to a scalar Quantity and return it.\n\n        Like :meth:`~numpy.ndarray.item` except that it always\n        returns a `Quantity`, not a Python scalar.\n\n        \"\"\"\n        return self._new_view(super().item(*args))"},{"col":4,"comment":"null","endLoc":1502,"header":"def tolist(self)","id":1728,"name":"tolist","nodeType":"Function","startLoc":1500,"text":"def tolist(self):\n        raise NotImplementedError(\"cannot make a list of Quantities.  Get \"\n                                  \"list of values with q.value.tolist()\")"},{"col":4,"comment":"null","endLoc":1554,"header":"def itemset(self, *args)","id":1729,"name":"itemset","nodeType":"Function","startLoc":1549,"text":"def itemset(self, *args):\n        if len(args) == 0:\n            raise ValueError(\"itemset must have at least one argument\")\n\n        self.view(np.ndarray).itemset(*(args[:-1] +\n                                        (self._to_own_unit(args[-1]),)))"},{"className":"_BaseDiff","col":0,"comment":"\n    Base class for all FITS diff objects.\n\n    When instantiating a FITS diff object, the first two arguments are always\n    the two objects to diff (two FITS files, two FITS headers, etc.).\n    Instantiating a ``_BaseDiff`` also causes the diff itself to be executed.\n    The returned ``_BaseDiff`` instance has a number of attribute that describe\n    the results of the diff operation.\n\n    The most basic attribute, present on all ``_BaseDiff`` instances, is\n    ``.identical`` which is `True` if the two objects being compared are\n    identical according to the diff method for objects of that type.\n    ","endLoc":182,"id":1730,"nodeType":"Class","startLoc":42,"text":"class _BaseDiff:\n    \"\"\"\n    Base class for all FITS diff objects.\n\n    When instantiating a FITS diff object, the first two arguments are always\n    the two objects to diff (two FITS files, two FITS headers, etc.).\n    Instantiating a ``_BaseDiff`` also causes the diff itself to be executed.\n    The returned ``_BaseDiff`` instance has a number of attribute that describe\n    the results of the diff operation.\n\n    The most basic attribute, present on all ``_BaseDiff`` instances, is\n    ``.identical`` which is `True` if the two objects being compared are\n    identical according to the diff method for objects of that type.\n    \"\"\"\n\n    def __init__(self, a, b):\n        \"\"\"\n        The ``_BaseDiff`` class does not implement a ``_diff`` method and\n        should not be instantiated directly. Instead instantiate the\n        appropriate subclass of ``_BaseDiff`` for the objects being compared\n        (for example, use `HeaderDiff` to compare two `Header` objects.\n        \"\"\"\n\n        self.a = a\n        self.b = b\n\n        # For internal use in report output\n        self._fileobj = None\n        self._indent = 0\n\n        self._diff()\n\n    def __bool__(self):\n        \"\"\"\n        A ``_BaseDiff`` object acts as `True` in a boolean context if the two\n        objects compared are identical.  Otherwise it acts as `False`.\n        \"\"\"\n\n        return not self.identical\n\n    @classmethod\n    def fromdiff(cls, other, a, b):\n        \"\"\"\n        Returns a new Diff object of a specific subclass from an existing diff\n        object, passing on the values for any arguments they share in common\n        (such as ignore_keywords).\n\n        For example::\n\n            >>> from astropy.io import fits\n            >>> hdul1, hdul2 = fits.HDUList(), fits.HDUList()\n            >>> headera, headerb = fits.Header(), fits.Header()\n            >>> fd = fits.FITSDiff(hdul1, hdul2, ignore_keywords=['*'])\n            >>> hd = fits.HeaderDiff.fromdiff(fd, headera, headerb)\n            >>> list(hd.ignore_keywords)\n            ['*']\n        \"\"\"\n\n        sig = signature(cls.__init__)\n        # The first 3 arguments of any Diff initializer are self, a, and b.\n        kwargs = {}\n        for arg in list(sig.parameters.keys())[3:]:\n            if hasattr(other, arg):\n                kwargs[arg] = getattr(other, arg)\n\n        return cls(a, b, **kwargs)\n\n    @property\n    def identical(self):\n        \"\"\"\n        `True` if all the ``.diff_*`` attributes on this diff instance are\n        empty, implying that no differences were found.\n\n        Any subclass of ``_BaseDiff`` must have at least one ``.diff_*``\n        attribute, which contains a non-empty value if and only if some\n        difference was found between the two objects being compared.\n        \"\"\"\n\n        return not any(getattr(self, attr) for attr in self.__dict__\n                       if attr.startswith('diff_'))\n\n    def report(self, fileobj=None, indent=0, overwrite=False):\n        \"\"\"\n        Generates a text report on the differences (if any) between two\n        objects, and either returns it as a string or writes it to a file-like\n        object.\n\n        Parameters\n        ----------\n        fileobj : file-like, string, or None, optional\n            If `None`, this method returns the report as a string. Otherwise it\n            returns `None` and writes the report to the given file-like object\n            (which must have a ``.write()`` method at a minimum), or to a new\n            file at the path specified.\n\n        indent : int\n            The number of 4 space tabs to indent the report.\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n\n        Returns\n        -------\n        report : str or None\n        \"\"\"\n\n        return_string = False\n        filepath = None\n\n        if isinstance(fileobj, str):\n            if os.path.exists(fileobj) and not overwrite:\n                raise OSError(NOT_OVERWRITING_MSG.format(fileobj))\n            else:\n                filepath = fileobj\n                fileobj = open(filepath, 'w')\n        elif fileobj is None:\n            fileobj = io.StringIO()\n            return_string = True\n\n        self._fileobj = fileobj\n        self._indent = indent  # This is used internally by _writeln\n\n        try:\n            self._report()\n        finally:\n            if filepath:\n                fileobj.close()\n\n        if return_string:\n            return fileobj.getvalue()\n\n    def _writeln(self, text):\n        self._fileobj.write(fixed_width_indent(text, self._indent) + '\\n')\n\n    def _diff(self):\n        raise NotImplementedError\n\n    def _report(self):\n        raise NotImplementedError"},{"col":4,"comment":"\n        The ``_BaseDiff`` class does not implement a ``_diff`` method and\n        should not be instantiated directly. Instead instantiate the\n        appropriate subclass of ``_BaseDiff`` for the objects being compared\n        (for example, use `HeaderDiff` to compare two `Header` objects.\n        ","endLoc":72,"header":"def __init__(self, a, b)","id":1731,"name":"__init__","nodeType":"Function","startLoc":57,"text":"def __init__(self, a, b):\n        \"\"\"\n        The ``_BaseDiff`` class does not implement a ``_diff`` method and\n        should not be instantiated directly. Instead instantiate the\n        appropriate subclass of ``_BaseDiff`` for the objects being compared\n        (for example, use `HeaderDiff` to compare two `Header` objects.\n        \"\"\"\n\n        self.a = a\n        self.b = b\n\n        # For internal use in report output\n        self._fileobj = None\n        self._indent = 0\n\n        self._diff()"},{"col":4,"comment":"null","endLoc":179,"header":"def _diff(self)","id":1732,"name":"_diff","nodeType":"Function","startLoc":178,"text":"def _diff(self):\n        raise NotImplementedError"},{"col":4,"comment":"\n        A ``_BaseDiff`` object acts as `True` in a boolean context if the two\n        objects compared are identical.  Otherwise it acts as `False`.\n        ","endLoc":80,"header":"def __bool__(self)","id":1733,"name":"__bool__","nodeType":"Function","startLoc":74,"text":"def __bool__(self):\n        \"\"\"\n        A ``_BaseDiff`` object acts as `True` in a boolean context if the two\n        objects compared are identical.  Otherwise it acts as `False`.\n        \"\"\"\n\n        return not self.identical"},{"col":4,"comment":"\n        Returns a new Diff object of a specific subclass from an existing diff\n        object, passing on the values for any arguments they share in common\n        (such as ignore_keywords).\n\n        For example::\n\n            >>> from astropy.io import fits\n            >>> hdul1, hdul2 = fits.HDUList(), fits.HDUList()\n            >>> headera, headerb = fits.Header(), fits.Header()\n            >>> fd = fits.FITSDiff(hdul1, hdul2, ignore_keywords=['*'])\n            >>> hd = fits.HeaderDiff.fromdiff(fd, headera, headerb)\n            >>> list(hd.ignore_keywords)\n            ['*']\n        ","endLoc":107,"header":"@classmethod\n    def fromdiff(cls, other, a, b)","id":1734,"name":"fromdiff","nodeType":"Function","startLoc":82,"text":"@classmethod\n    def fromdiff(cls, other, a, b):\n        \"\"\"\n        Returns a new Diff object of a specific subclass from an existing diff\n        object, passing on the values for any arguments they share in common\n        (such as ignore_keywords).\n\n        For example::\n\n            >>> from astropy.io import fits\n            >>> hdul1, hdul2 = fits.HDUList(), fits.HDUList()\n            >>> headera, headerb = fits.Header(), fits.Header()\n            >>> fd = fits.FITSDiff(hdul1, hdul2, ignore_keywords=['*'])\n            >>> hd = fits.HeaderDiff.fromdiff(fd, headera, headerb)\n            >>> list(hd.ignore_keywords)\n            ['*']\n        \"\"\"\n\n        sig = signature(cls.__init__)\n        # The first 3 arguments of any Diff initializer are self, a, and b.\n        kwargs = {}\n        for arg in list(sig.parameters.keys())[3:]:\n            if hasattr(other, arg):\n                kwargs[arg] = getattr(other, arg)\n\n        return cls(a, b, **kwargs)"},{"col":4,"comment":"null","endLoc":1558,"header":"def tostring(self, order='C')","id":1735,"name":"tostring","nodeType":"Function","startLoc":1556,"text":"def tostring(self, order='C'):\n        raise NotImplementedError(\"cannot write Quantities to string.  Write \"\n                                  \"array with q.value.tostring(...).\")"},{"col":4,"comment":"null","endLoc":1562,"header":"def tobytes(self, order='C')","id":1736,"name":"tobytes","nodeType":"Function","startLoc":1560,"text":"def tobytes(self, order='C'):\n        raise NotImplementedError(\"cannot write Quantities to string.  Write \"\n                                  \"array with q.value.tobytes(...).\")"},{"col":4,"comment":"null","endLoc":1566,"header":"def tofile(self, fid, sep=\"\", format=\"%s\")","id":1737,"name":"tofile","nodeType":"Function","startLoc":1564,"text":"def tofile(self, fid, sep=\"\", format=\"%s\"):\n        raise NotImplementedError(\"cannot write Quantities to file.  Write \"\n                                  \"array with q.value.tofile(...)\")"},{"col":4,"comment":"null","endLoc":1570,"header":"def dump(self, file)","id":1738,"name":"dump","nodeType":"Function","startLoc":1568,"text":"def dump(self, file):\n        raise NotImplementedError(\"cannot dump Quantities to file.  Write \"\n                                  \"array with q.value.dump()\")"},{"col":4,"comment":"null","endLoc":1574,"header":"def dumps(self)","id":1739,"name":"dumps","nodeType":"Function","startLoc":1572,"text":"def dumps(self):\n        raise NotImplementedError(\"cannot dump Quantities to string.  Write \"\n                                  \"array with q.value.dumps()\")"},{"col":4,"comment":"null","endLoc":1579,"header":"def fill(self, value)","id":1740,"name":"fill","nodeType":"Function","startLoc":1578,"text":"def fill(self, value):\n        self.view(np.ndarray).fill(self._to_own_unit(value))"},{"col":4,"comment":"\n        `True` if all the ``.diff_*`` attributes on this diff instance are\n        empty, implying that no differences were found.\n\n        Any subclass of ``_BaseDiff`` must have at least one ``.diff_*``\n        attribute, which contains a non-empty value if and only if some\n        difference was found between the two objects being compared.\n        ","endLoc":121,"header":"@property\n    def identical(self)","id":1741,"name":"identical","nodeType":"Function","startLoc":109,"text":"@property\n    def identical(self):\n        \"\"\"\n        `True` if all the ``.diff_*`` attributes on this diff instance are\n        empty, implying that no differences were found.\n\n        Any subclass of ``_BaseDiff`` must have at least one ``.diff_*``\n        attribute, which contains a non-empty value if and only if some\n        difference was found between the two objects being compared.\n        \"\"\"\n\n        return not any(getattr(self, attr) for attr in self.__dict__\n                       if attr.startswith('diff_'))"},{"col":4,"comment":"A 1-D iterator over the Quantity array.\n\n        This returns a ``QuantityIterator`` instance, which behaves the same\n        as the `~numpy.flatiter` instance returned by `~numpy.ndarray.flat`,\n        and is similar to, but not a subclass of, Python's built-in iterator\n        object.\n        ","endLoc":1594,"header":"@property\n    def flat(self)","id":1742,"name":"flat","nodeType":"Function","startLoc":1585,"text":"@property\n    def flat(self):\n        \"\"\"A 1-D iterator over the Quantity array.\n\n        This returns a ``QuantityIterator`` instance, which behaves the same\n        as the `~numpy.flatiter` instance returned by `~numpy.ndarray.flat`,\n        and is similar to, but not a subclass of, Python's built-in iterator\n        object.\n        \"\"\"\n        return QuantityIterator(self)"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":62,"id":1743,"name":"conf","nodeType":"Attribute","startLoc":62,"text":"conf"},{"col":4,"comment":"\n        Generates a text report on the differences (if any) between two\n        objects, and either returns it as a string or writes it to a file-like\n        object.\n\n        Parameters\n        ----------\n        fileobj : file-like, string, or None, optional\n            If `None`, this method returns the report as a string. Otherwise it\n            returns `None` and writes the report to the given file-like object\n            (which must have a ``.write()`` method at a minimum), or to a new\n            file at the path specified.\n\n        indent : int\n            The number of 4 space tabs to indent the report.\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n\n        Returns\n        -------\n        report : str or None\n        ","endLoc":173,"header":"def report(self, fileobj=None, indent=0, overwrite=False)","id":1744,"name":"report","nodeType":"Function","startLoc":123,"text":"def report(self, fileobj=None, indent=0, overwrite=False):\n        \"\"\"\n        Generates a text report on the differences (if any) between two\n        objects, and either returns it as a string or writes it to a file-like\n        object.\n\n        Parameters\n        ----------\n        fileobj : file-like, string, or None, optional\n            If `None`, this method returns the report as a string. Otherwise it\n            returns `None` and writes the report to the given file-like object\n            (which must have a ``.write()`` method at a minimum), or to a new\n            file at the path specified.\n\n        indent : int\n            The number of 4 space tabs to indent the report.\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n\n        Returns\n        -------\n        report : str or None\n        \"\"\"\n\n        return_string = False\n        filepath = None\n\n        if isinstance(fileobj, str):\n            if os.path.exists(fileobj) and not overwrite:\n                raise OSError(NOT_OVERWRITING_MSG.format(fileobj))\n            else:\n                filepath = fileobj\n                fileobj = open(filepath, 'w')\n        elif fileobj is None:\n            fileobj = io.StringIO()\n            return_string = True\n\n        self._fileobj = fileobj\n        self._indent = indent  # This is used internally by _writeln\n\n        try:\n            self._report()\n        finally:\n            if filepath:\n                fileobj.close()\n\n        if return_string:\n            return fileobj.getvalue()"},{"col":4,"comment":"\n        Summarize the info of the HDUs in this `HDUList`.\n\n        Note that this function prints its results to the console---it\n        does not return a value.\n\n        Parameters\n        ----------\n        output : file-like or bool, optional\n            A file-like object to write the output to.  If `False`, does not\n            output to a file and instead returns a list of tuples representing\n            the HDU info.  Writes to ``sys.stdout`` by default.\n        ","endLoc":1028,"header":"def info(self, output=None)","id":1745,"name":"info","nodeType":"Function","startLoc":985,"text":"def info(self, output=None):\n        \"\"\"\n        Summarize the info of the HDUs in this `HDUList`.\n\n        Note that this function prints its results to the console---it\n        does not return a value.\n\n        Parameters\n        ----------\n        output : file-like or bool, optional\n            A file-like object to write the output to.  If `False`, does not\n            output to a file and instead returns a list of tuples representing\n            the HDU info.  Writes to ``sys.stdout`` by default.\n        \"\"\"\n\n        if output is None:\n            output = sys.stdout\n\n        if self._file is None:\n            name = '(No file associated with this HDUList)'\n        else:\n            name = self._file.name\n\n        results = [f'Filename: {name}',\n                   'No.    Name      Ver    Type      Cards   Dimensions   Format']\n\n        format = '{:3d}  {:10}  {:3} {:11}  {:5d}   {}   {}   {}'\n        default = ('', '', '', 0, (), '', '')\n        for idx, hdu in enumerate(self):\n            summary = hdu._summary()\n            if len(summary) < len(default):\n                summary += default[len(summary):]\n            summary = (idx,) + summary\n            if output:\n                results.append(format.format(*summary))\n            else:\n                results.append(summary)\n\n        if output:\n            output.write('\\n'.join(results))\n            output.write('\\n')\n            output.flush()\n        else:\n            return results[2:]"},{"col":4,"comment":"null","endLoc":88,"header":"def __init__(self, q)","id":1746,"name":"__init__","nodeType":"Function","startLoc":86,"text":"def __init__(self, q):\n        self._quantity = q\n        self._dataiter = q.view(np.ndarray).flat"},{"col":4,"comment":"null","endLoc":1599,"header":"@flat.setter\n    def flat(self, value)","id":1747,"name":"flat","nodeType":"Function","startLoc":1596,"text":"@flat.setter\n    def flat(self, value):\n        y = self.ravel()\n        y[:] = value"},{"col":4,"comment":"null","endLoc":1609,"header":"def take(self, indices, axis=None, out=None, mode='raise')","id":1748,"name":"take","nodeType":"Function","startLoc":1603,"text":"def take(self, indices, axis=None, out=None, mode='raise'):\n        out = super().take(indices, axis=axis, out=out, mode=mode)\n        # For single elements, ndarray.take returns scalars; these\n        # need a new view as a Quantity.\n        if type(out) is not type(self):\n            out = self._new_view(out)\n        return out"},{"col":4,"comment":"null","endLoc":182,"header":"def _report(self)","id":1749,"name":"_report","nodeType":"Function","startLoc":181,"text":"def _report(self):\n        raise NotImplementedError"},{"col":4,"comment":"null","endLoc":176,"header":"def _writeln(self, text)","id":1750,"name":"_writeln","nodeType":"Function","startLoc":175,"text":"def _writeln(self, text):\n        self._fileobj.write(fixed_width_indent(text, self._indent) + '\\n')"},{"col":4,"comment":"null","endLoc":1612,"header":"def put(self, indices, values, mode='raise')","id":1751,"name":"put","nodeType":"Function","startLoc":1611,"text":"def put(self, indices, values, mode='raise'):\n        self.view(np.ndarray).put(indices, self._to_own_unit(values), mode)"},{"col":4,"comment":"null","endLoc":1616,"header":"def choose(self, choices, out=None, mode='raise')","id":1752,"name":"choose","nodeType":"Function","startLoc":1614,"text":"def choose(self, choices, out=None, mode='raise'):\n        raise NotImplementedError(\"cannot choose based on quantity.  Choose \"\n                                  \"using array with q.value.choose(...)\")"},{"col":4,"comment":"null","endLoc":1620,"header":"def argsort(self, axis=-1, kind='quicksort', order=None)","id":1753,"name":"argsort","nodeType":"Function","startLoc":1619,"text":"def argsort(self, axis=-1, kind='quicksort', order=None):\n        return self.view(np.ndarray).argsort(axis=axis, kind=kind, order=order)"},{"attributeType":"null","col":8,"comment":"null","endLoc":65,"id":1754,"name":"a","nodeType":"Attribute","startLoc":65,"text":"self.a"},{"attributeType":"null","col":8,"comment":"null","endLoc":66,"id":1755,"name":"b","nodeType":"Attribute","startLoc":66,"text":"self.b"},{"col":4,"comment":"null","endLoc":1625,"header":"def searchsorted(self, v, *args, **kwargs)","id":1756,"name":"searchsorted","nodeType":"Function","startLoc":1622,"text":"def searchsorted(self, v, *args, **kwargs):\n        return np.searchsorted(np.array(self),\n                               self._to_own_unit(v, check_precision=False),\n                               *args, **kwargs)  # avoid numpy 1.6 problem"},{"col":4,"comment":"\n        Return the file name associated with the HDUList object if one exists.\n        Otherwise returns None.\n\n        Returns\n        -------\n        filename : str\n            A string containing the file name associated with the HDUList\n            object if an association exists.  Otherwise returns None.\n\n        ","endLoc":1045,"header":"def filename(self)","id":1757,"name":"filename","nodeType":"Function","startLoc":1030,"text":"def filename(self):\n        \"\"\"\n        Return the file name associated with the HDUList object if one exists.\n        Otherwise returns None.\n\n        Returns\n        -------\n        filename : str\n            A string containing the file name associated with the HDUList\n            object if an association exists.  Otherwise returns None.\n\n        \"\"\"\n        if self._file is not None:\n            if hasattr(self._file, 'name'):\n                return self._file.name\n        return None"},{"attributeType":"null","col":8,"comment":"null","endLoc":70,"id":1758,"name":"_indent","nodeType":"Attribute","startLoc":70,"text":"self._indent"},{"col":4,"comment":"null","endLoc":1284,"header":"def _verify(self, option='warn')","id":1759,"name":"_verify","nodeType":"Function","startLoc":1239,"text":"def _verify(self, option='warn'):\n        errs = _ErrList([], unit='HDU')\n\n        # the first (0th) element must be a primary HDU\n        if len(self) > 0 and (not isinstance(self[0], PrimaryHDU)) and \\\n                             (not isinstance(self[0], _NonstandardHDU)):\n            err_text = \"HDUList's 0th element is not a primary HDU.\"\n            fix_text = 'Fixed by inserting one as 0th HDU.'\n\n            def fix(self=self):\n                self.insert(0, PrimaryHDU())\n\n            err = self.run_option(option, err_text=err_text,\n                                  fix_text=fix_text, fix=fix)\n            errs.append(err)\n\n        if len(self) > 1 and ('EXTEND' not in self[0].header or\n                              self[0].header['EXTEND'] is not True):\n            err_text = ('Primary HDU does not contain an EXTEND keyword '\n                        'equal to T even though there are extension HDUs.')\n            fix_text = 'Fixed by inserting or updating the EXTEND keyword.'\n\n            def fix(header=self[0].header):\n                naxis = header['NAXIS']\n                if naxis == 0:\n                    after = 'NAXIS'\n                else:\n                    after = 'NAXIS' + str(naxis)\n                header.set('EXTEND', value=True, after=after)\n\n            errs.append(self.run_option(option, err_text=err_text,\n                                        fix_text=fix_text, fix=fix))\n\n        # each element calls their own verify\n        for idx, hdu in enumerate(self):\n            if idx > 0 and (not isinstance(hdu, ExtensionHDU)):\n                err_text = f\"HDUList's element {str(idx)} is not an extension HDU.\"\n\n                err = self.run_option(option, err_text=err_text, fixable=False)\n                errs.append(err)\n\n            else:\n                result = hdu._verify(option)\n                if result:\n                    errs.append(result)\n        return errs"},{"attributeType":"null","col":8,"comment":"null","endLoc":69,"id":1760,"name":"_fileobj","nodeType":"Attribute","startLoc":69,"text":"self._fileobj"},{"col":4,"comment":"\n        Parameters\n        ----------\n        a : str or `HDUList`\n            The filename of a FITS file on disk, or an `HDUList` object.\n\n        b : str or `HDUList`\n            The filename of a FITS file on disk, or an `HDUList` object to\n            compare to the first file.\n\n        ignore_hdus : sequence, optional\n            HDU names to ignore when comparing two FITS files or HDU lists; the\n            presence of these HDUs and their contents are ignored.  Wildcard\n            strings may also be included in the list.\n\n        ignore_keywords : sequence, optional\n            Header keywords to ignore when comparing two headers; the presence\n            of these keywords and their values are ignored.  Wildcard strings\n            may also be included in the list.\n\n        ignore_comments : sequence, optional\n            A list of header keywords whose comments should be ignored in the\n            comparison.  May contain wildcard strings as with ignore_keywords.\n\n        ignore_fields : sequence, optional\n            The (case-insensitive) names of any table columns to ignore if any\n            table data is to be compared.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\left| a - b \\right| > \\text{atol} + \\text{rtol} \\cdot \\left| b \\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n\n        ignore_blanks : bool, optional\n            Ignore extra whitespace at the end of string values either in\n            headers or data. Extra leading whitespace is not ignored\n            (default: True).\n\n        ignore_blank_cards : bool, optional\n            Ignore all cards that are blank, i.e. they only contain\n            whitespace (default: True).\n        ","endLoc":316,"header":"def __init__(self, a, b, ignore_hdus=[], ignore_keywords=[],\n                 ignore_comments=[], ignore_fields=[],\n                 numdiffs=10, rtol=0.0, atol=0.0,\n                 ignore_blanks=True, ignore_blank_cards=True)","id":1761,"name":"__init__","nodeType":"Function","startLoc":199,"text":"def __init__(self, a, b, ignore_hdus=[], ignore_keywords=[],\n                 ignore_comments=[], ignore_fields=[],\n                 numdiffs=10, rtol=0.0, atol=0.0,\n                 ignore_blanks=True, ignore_blank_cards=True):\n        \"\"\"\n        Parameters\n        ----------\n        a : str or `HDUList`\n            The filename of a FITS file on disk, or an `HDUList` object.\n\n        b : str or `HDUList`\n            The filename of a FITS file on disk, or an `HDUList` object to\n            compare to the first file.\n\n        ignore_hdus : sequence, optional\n            HDU names to ignore when comparing two FITS files or HDU lists; the\n            presence of these HDUs and their contents are ignored.  Wildcard\n            strings may also be included in the list.\n\n        ignore_keywords : sequence, optional\n            Header keywords to ignore when comparing two headers; the presence\n            of these keywords and their values are ignored.  Wildcard strings\n            may also be included in the list.\n\n        ignore_comments : sequence, optional\n            A list of header keywords whose comments should be ignored in the\n            comparison.  May contain wildcard strings as with ignore_keywords.\n\n        ignore_fields : sequence, optional\n            The (case-insensitive) names of any table columns to ignore if any\n            table data is to be compared.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\\\left| a - b \\\\right| > \\\\text{atol} + \\\\text{rtol} \\\\cdot \\\\left| b \\\\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n\n        ignore_blanks : bool, optional\n            Ignore extra whitespace at the end of string values either in\n            headers or data. Extra leading whitespace is not ignored\n            (default: True).\n\n        ignore_blank_cards : bool, optional\n            Ignore all cards that are blank, i.e. they only contain\n            whitespace (default: True).\n        \"\"\"\n\n        if isinstance(a, (str, os.PathLike)):\n            try:\n                a = fitsopen(a)\n            except Exception as exc:\n                raise OSError(\"error opening file a ({}): {}: {}\".format(\n                        a, exc.__class__.__name__, exc.args[0]))\n            close_a = True\n        else:\n            close_a = False\n\n        if isinstance(b, (str, os.PathLike)):\n            try:\n                b = fitsopen(b)\n            except Exception as exc:\n                raise OSError(\"error opening file b ({}): {}: {}\".format(\n                        b, exc.__class__.__name__, exc.args[0]))\n            close_b = True\n        else:\n            close_b = False\n\n        # Normalize keywords/fields to ignore to upper case\n        self.ignore_hdus = set(k.upper() for k in ignore_hdus)\n        self.ignore_keywords = set(k.upper() for k in ignore_keywords)\n        self.ignore_comments = set(k.upper() for k in ignore_comments)\n        self.ignore_fields = set(k.upper() for k in ignore_fields)\n\n        self.numdiffs = numdiffs\n        self.rtol = rtol\n        self.atol = atol\n\n        self.ignore_blanks = ignore_blanks\n        self.ignore_blank_cards = ignore_blank_cards\n\n        # Some hdu names may be pattern wildcards.  Find them.\n        self.ignore_hdu_patterns = set()\n        for name in list(self.ignore_hdus):\n            if name != '*' and glob.has_magic(name):\n                self.ignore_hdus.remove(name)\n                self.ignore_hdu_patterns.add(name)\n\n        self.diff_hdu_count = ()\n        self.diff_hdus = []\n\n        try:\n            super().__init__(a, b)\n        finally:\n            if close_a:\n                a.close()\n            if close_b:\n                b.close()"},{"col":4,"comment":"null","endLoc":1628,"header":"def argmax(self, axis=None, out=None)","id":1762,"name":"argmax","nodeType":"Function","startLoc":1627,"text":"def argmax(self, axis=None, out=None):\n        return self.view(np.ndarray).argmax(axis, out=out)"},{"col":4,"comment":"null","endLoc":1631,"header":"def argmin(self, axis=None, out=None)","id":1763,"name":"argmin","nodeType":"Function","startLoc":1630,"text":"def argmin(self, axis=None, out=None):\n        return self.view(np.ndarray).argmin(axis, out=out)"},{"attributeType":"null","col":0,"comment":"null","endLoc":86,"id":1764,"name":"__all__","nodeType":"Attribute","startLoc":86,"text":"__all__"},{"col":4,"comment":"Wrap numpy functions, taking care of units.\n\n        Parameters\n        ----------\n        function : callable\n            Numpy function to wrap\n        types : iterable of classes\n            Classes that provide an ``__array_function__`` override. Can\n            in principle be used to interact with other classes. Below,\n            mostly passed on to `~numpy.ndarray`, which can only interact\n            with subclasses.\n        args : tuple\n            Positional arguments provided in the function call.\n        kwargs : dict\n            Keyword arguments provided in the function call.\n\n        Returns\n        -------\n        result: `~astropy.units.Quantity`, `~numpy.ndarray`\n            As appropriate for the function.  If the function is not\n            supported, `NotImplemented` is returned, which will lead to\n            a `TypeError` unless another argument overrode the function.\n\n        Raises\n        ------\n        ~astropy.units.UnitsError\n            If operands have incompatible units.\n        ","endLoc":1716,"header":"def __array_function__(self, function, types, args, kwargs)","id":1765,"name":"__array_function__","nodeType":"Function","startLoc":1633,"text":"def __array_function__(self, function, types, args, kwargs):\n        \"\"\"Wrap numpy functions, taking care of units.\n\n        Parameters\n        ----------\n        function : callable\n            Numpy function to wrap\n        types : iterable of classes\n            Classes that provide an ``__array_function__`` override. Can\n            in principle be used to interact with other classes. Below,\n            mostly passed on to `~numpy.ndarray`, which can only interact\n            with subclasses.\n        args : tuple\n            Positional arguments provided in the function call.\n        kwargs : dict\n            Keyword arguments provided in the function call.\n\n        Returns\n        -------\n        result: `~astropy.units.Quantity`, `~numpy.ndarray`\n            As appropriate for the function.  If the function is not\n            supported, `NotImplemented` is returned, which will lead to\n            a `TypeError` unless another argument overrode the function.\n\n        Raises\n        ------\n        ~astropy.units.UnitsError\n            If operands have incompatible units.\n        \"\"\"\n        # A function should be in one of the following sets or dicts:\n        # 1. SUBCLASS_SAFE_FUNCTIONS (set), if the numpy implementation\n        #    supports Quantity; we pass on to ndarray.__array_function__.\n        # 2. FUNCTION_HELPERS (dict), if the numpy implementation is usable\n        #    after converting quantities to arrays with suitable units,\n        #    and possibly setting units on the result.\n        # 3. DISPATCHED_FUNCTIONS (dict), if the function makes sense but\n        #    requires a Quantity-specific implementation.\n        # 4. UNSUPPORTED_FUNCTIONS (set), if the function does not make sense.\n        # For now, since we may not yet have complete coverage, if a\n        # function is in none of the above, we simply call the numpy\n        # implementation.\n        if function in SUBCLASS_SAFE_FUNCTIONS:\n            return super().__array_function__(function, types, args, kwargs)\n\n        elif function in FUNCTION_HELPERS:\n            function_helper = FUNCTION_HELPERS[function]\n            try:\n                args, kwargs, unit, out = function_helper(*args, **kwargs)\n            except NotImplementedError:\n                return self._not_implemented_or_raise(function, types)\n\n            result = super().__array_function__(function, types, args, kwargs)\n            # Fall through to return section\n\n        elif function in DISPATCHED_FUNCTIONS:\n            dispatched_function = DISPATCHED_FUNCTIONS[function]\n            try:\n                result, unit, out = dispatched_function(*args, **kwargs)\n            except NotImplementedError:\n                return self._not_implemented_or_raise(function, types)\n\n            # Fall through to return section\n\n        elif function in UNSUPPORTED_FUNCTIONS:\n            return NotImplemented\n\n        else:\n            warnings.warn(\"function '{}' is not known to astropy's Quantity. \"\n                          \"Will run it anyway, hoping it will treat ndarray \"\n                          \"subclasses correctly. Please raise an issue at \"\n                          \"https://github.com/astropy/astropy/issues. \"\n                          .format(function.__name__), AstropyWarning)\n\n            return super().__array_function__(function, types, args, kwargs)\n\n        # If unit is None, a plain array is expected (e.g., boolean), which\n        # means we're done.\n        # We're also done if the result was NotImplemented, which can happen\n        # if other inputs/outputs override __array_function__;\n        # hopefully, they can then deal with us.\n        if unit is None or result is NotImplemented:\n            return result\n\n        return self._result_as_quantity(result, unit, out=out)"},{"col":0,"comment":"","endLoc":13,"header":"__init__.py#<anonymous>","id":1766,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nA package for reading and writing FITS files and manipulating their\ncontents.\n\nA module for reading and writing Flexible Image Transport System\n(FITS) files.  This file format was endorsed by the International\nAstronomical Union in 1999 and mandated by NASA as the standard format\nfor storing high energy astrophysics data.  For details of the FITS\nstandard, see the NASA/Science Office of Standards and Technology\npublication, NOST 100-2.0.\n\"\"\"\n\nconf = Conf()\n\n__all__ = (['Conf', 'conf'] + card.__all__ + column.__all__ +\n           convenience.__all__ + hdu.__all__ +\n           ['FITS_record', 'FITS_rec', 'GroupData', 'open', 'Section',\n            'Header', 'VerifyError', 'conf'])"},{"col":4,"comment":"null","endLoc":1730,"header":"def _not_implemented_or_raise(self, function, types)","id":1767,"name":"_not_implemented_or_raise","nodeType":"Function","startLoc":1718,"text":"def _not_implemented_or_raise(self, function, types):\n        # Our function helper or dispatcher found that the function does not\n        # work with Quantity.  In principle, there may be another class that\n        # knows what to do with us, for which we should return NotImplemented.\n        # But if there is ndarray (or a non-Quantity subclass of it) around,\n        # it quite likely coerces, so we should just break.\n        if any(issubclass(t, np.ndarray) and not issubclass(t, Quantity)\n               for t in types):\n            raise TypeError(\"the Quantity implementation cannot handle {} \"\n                            \"with the given arguments.\"\n                            .format(function)) from None\n        else:\n            return NotImplemented"},{"fileName":"card.py","filePath":"astropy/io/fits","id":1768,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport re\nimport warnings\n\nimport numpy as np\n\nfrom .util import _str_to_num, _is_int, translate, _words_group\nfrom .verify import _Verify, _ErrList, VerifyError, VerifyWarning\n\nfrom . import conf\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n\n__all__ = ['Card', 'Undefined']\n\n\nFIX_FP_TABLE = str.maketrans('de', 'DE')\nFIX_FP_TABLE2 = str.maketrans('dD', 'eE')\n\n\nCARD_LENGTH = 80\nBLANK_CARD = ' ' * CARD_LENGTH\nKEYWORD_LENGTH = 8  # The max length for FITS-standard keywords\n\nVALUE_INDICATOR = '= '  # The standard FITS value indicator\nVALUE_INDICATOR_LEN = len(VALUE_INDICATOR)\nHIERARCH_VALUE_INDICATOR = '='  # HIERARCH cards may use a shortened indicator\n\n\nclass Undefined:\n    \"\"\"Undefined value.\"\"\"\n\n    def __init__(self):\n        # This __init__ is required to be here for Sphinx documentation\n        pass\n\n\nUNDEFINED = Undefined()\n\n\nclass Card(_Verify):\n\n    length = CARD_LENGTH\n    \"\"\"The length of a Card image; should always be 80 for valid FITS files.\"\"\"\n\n    # String for a FITS standard compliant (FSC) keyword.\n    _keywd_FSC_RE = re.compile(r'^[A-Z0-9_-]{0,%d}$' % KEYWORD_LENGTH)\n    # This will match any printable ASCII character excluding '='\n    _keywd_hierarch_RE = re.compile(r'^(?:HIERARCH +)?(?:^[ -<>-~]+ ?)+$',\n                                    re.I)\n\n    # A number sub-string, either an integer or a float in fixed or\n    # scientific notation.  One for FSC and one for non-FSC (NFSC) format:\n    # NFSC allows lower case of DE for exponent, allows space between sign,\n    # digits, exponent sign, and exponents\n    _digits_FSC = r'(\\.\\d+|\\d+(\\.\\d*)?)([DE][+-]?\\d+)?'\n    _digits_NFSC = r'(\\.\\d+|\\d+(\\.\\d*)?) *([deDE] *[+-]? *\\d+)?'\n    _numr_FSC = r'[+-]?' + _digits_FSC\n    _numr_NFSC = r'[+-]? *' + _digits_NFSC\n\n    # This regex helps delete leading zeros from numbers, otherwise\n    # Python might evaluate them as octal values (this is not-greedy, however,\n    # so it may not strip leading zeros from a float, which is fine)\n    _number_FSC_RE = re.compile(rf'(?P<sign>[+-])?0*?(?P<digt>{_digits_FSC})')\n    _number_NFSC_RE = \\\n            re.compile(rf'(?P<sign>[+-])? *0*?(?P<digt>{_digits_NFSC})')\n\n    # Used in cards using the CONTINUE convention which expect a string\n    # followed by an optional comment\n    _strg = r'\\'(?P<strg>([ -~]+?|\\'\\'|) *?)\\'(?=$|/| )'\n    _comm_field = r'(?P<comm_field>(?P<sepr>/ *)(?P<comm>(.|\\n)*))'\n    _strg_comment_RE = re.compile(f'({_strg})? *{_comm_field}?')\n\n    # FSC commentary card string which must contain printable ASCII characters.\n    # Note: \\Z matches the end of the string without allowing newlines\n    _ascii_text_re = re.compile(r'[ -~]*\\Z')\n\n    # Checks for a valid value/comment string.  It returns a match object\n    # for a valid value/comment string.\n    # The valu group will return a match if a FITS string, boolean,\n    # number, or complex value is found, otherwise it will return\n    # None, meaning the keyword is undefined.  The comment field will\n    # return a match if the comment separator is found, though the\n    # comment maybe an empty string.\n    _value_FSC_RE = re.compile(\n        r'(?P<valu_field> *'\n            r'(?P<valu>'\n\n                #  The <strg> regex is not correct for all cases, but\n                #  it comes pretty darn close.  It appears to find the\n                #  end of a string rather well, but will accept\n                #  strings with an odd number of single quotes,\n                #  instead of issuing an error.  The FITS standard\n                #  appears vague on this issue and only states that a\n                #  string should not end with two single quotes,\n                #  whereas it should not end with an even number of\n                #  quotes to be precise.\n                #\n                #  Note that a non-greedy match is done for a string,\n                #  since a greedy match will find a single-quote after\n                #  the comment separator resulting in an incorrect\n                #  match.\n                rf'{_strg}|'\n                r'(?P<bool>[FT])|'\n                r'(?P<numr>' + _numr_FSC + r')|'\n                r'(?P<cplx>\\( *'\n                    r'(?P<real>' + _numr_FSC + r') *, *'\n                    r'(?P<imag>' + _numr_FSC + r') *\\))'\n            r')? *)'\n        r'(?P<comm_field>'\n            r'(?P<sepr>/ *)'\n            r'(?P<comm>[!-~][ -~]*)?'\n        r')?$')\n\n    _value_NFSC_RE = re.compile(\n        r'(?P<valu_field> *'\n            r'(?P<valu>'\n                rf'{_strg}|'\n                r'(?P<bool>[FT])|'\n                r'(?P<numr>' + _numr_NFSC + r')|'\n                r'(?P<cplx>\\( *'\n                    r'(?P<real>' + _numr_NFSC + r') *, *'\n                    r'(?P<imag>' + _numr_NFSC + r') *\\))'\n            fr')? *){_comm_field}?$')\n\n    _rvkc_identifier = r'[a-zA-Z_]\\w*'\n    _rvkc_field = _rvkc_identifier + r'(\\.\\d+)?'\n    _rvkc_field_specifier_s = fr'{_rvkc_field}(\\.{_rvkc_field})*'\n    _rvkc_field_specifier_val = (r'(?P<keyword>{}): +(?P<val>{})'.format(\n            _rvkc_field_specifier_s, _numr_FSC))\n    _rvkc_keyword_val = fr'\\'(?P<rawval>{_rvkc_field_specifier_val})\\''\n    _rvkc_keyword_val_comm = (r' *{} *(/ *(?P<comm>[ -~]*))?$'.format(\n            _rvkc_keyword_val))\n\n    _rvkc_field_specifier_val_RE = re.compile(_rvkc_field_specifier_val + '$')\n\n    # regular expression to extract the key and the field specifier from a\n    # string that is being used to index into a card list that contains\n    # record value keyword cards (ex. 'DP1.AXIS.1')\n    _rvkc_keyword_name_RE = (\n        re.compile(r'(?P<keyword>{})\\.(?P<field_specifier>{})$'.format(\n                _rvkc_identifier, _rvkc_field_specifier_s)))\n\n    # regular expression to extract the field specifier and value and comment\n    # from the string value of a record value keyword card\n    # (ex \"'AXIS.1: 1' / a comment\")\n    _rvkc_keyword_val_comm_RE = re.compile(_rvkc_keyword_val_comm)\n\n    _commentary_keywords = {'', 'COMMENT', 'HISTORY', 'END'}\n    _special_keywords = _commentary_keywords.union(['CONTINUE'])\n\n    # The default value indicator; may be changed if required by a convention\n    # (namely HIERARCH cards)\n    _value_indicator = VALUE_INDICATOR\n\n    def __init__(self, keyword=None, value=None, comment=None, **kwargs):\n        # For backwards compatibility, support the 'key' keyword argument:\n        if keyword is None and 'key' in kwargs:\n            keyword = kwargs['key']\n\n        self._keyword = None\n        self._value = None\n        self._comment = None\n        self._valuestring = None\n        self._image = None\n\n        # This attribute is set to False when creating the card from a card\n        # image to ensure that the contents of the image get verified at some\n        # point\n        self._verified = True\n\n        # A flag to conveniently mark whether or not this was a valid HIERARCH\n        # card\n        self._hierarch = False\n\n        # If the card could not be parsed according the the FITS standard or\n        # any recognized non-standard conventions, this will be True\n        self._invalid = False\n\n        self._field_specifier = None\n\n        # These are used primarily only by RVKCs\n        self._rawkeyword = None\n        self._rawvalue = None\n\n        if not (keyword is not None and value is not None and\n                self._check_if_rvkc(keyword, value)):\n            # If _check_if_rvkc passes, it will handle setting the keyword and\n            # value\n            if keyword is not None:\n                self.keyword = keyword\n            if value is not None:\n                self.value = value\n\n        if comment is not None:\n            self.comment = comment\n\n        self._modified = False\n        self._valuemodified = False\n\n    def __repr__(self):\n        return repr((self.keyword, self.value, self.comment))\n\n    def __str__(self):\n        return self.image\n\n    def __len__(self):\n        return 3\n\n    def __getitem__(self, index):\n        return (self.keyword, self.value, self.comment)[index]\n\n    @property\n    def keyword(self):\n        \"\"\"Returns the keyword name parsed from the card image.\"\"\"\n        if self._keyword is not None:\n            return self._keyword\n        elif self._image:\n            self._keyword = self._parse_keyword()\n            return self._keyword\n        else:\n            self.keyword = ''\n            return ''\n\n    @keyword.setter\n    def keyword(self, keyword):\n        \"\"\"Set the key attribute; once set it cannot be modified.\"\"\"\n        if self._keyword is not None:\n            raise AttributeError(\n                'Once set, the Card keyword may not be modified')\n        elif isinstance(keyword, str):\n            # Be nice and remove trailing whitespace--some FITS code always\n            # pads keywords out with spaces; leading whitespace, however,\n            # should be strictly disallowed.\n            keyword = keyword.rstrip()\n            keyword_upper = keyword.upper()\n            if (len(keyword) <= KEYWORD_LENGTH and\n                    self._keywd_FSC_RE.match(keyword_upper)):\n                # For keywords with length > 8 they will be HIERARCH cards,\n                # and can have arbitrary case keywords\n                if keyword_upper == 'END':\n                    raise ValueError(\"Keyword 'END' not allowed.\")\n                keyword = keyword_upper\n            elif self._keywd_hierarch_RE.match(keyword):\n                # In prior versions of PyFITS (*) HIERARCH cards would only be\n                # created if the user-supplied keyword explicitly started with\n                # 'HIERARCH '.  Now we will create them automatically for long\n                # keywords, but we still want to support the old behavior too;\n                # the old behavior makes it possible to create HIERARCH cards\n                # that would otherwise be recognized as RVKCs\n                # (*) This has never affected Astropy, because it was changed\n                # before PyFITS was merged into Astropy!\n                self._hierarch = True\n                self._value_indicator = HIERARCH_VALUE_INDICATOR\n\n                if keyword_upper[:9] == 'HIERARCH ':\n                    # The user explicitly asked for a HIERARCH card, so don't\n                    # bug them about it...\n                    keyword = keyword[9:].strip()\n                else:\n                    # We'll gladly create a HIERARCH card, but a warning is\n                    # also displayed\n                    warnings.warn(\n                        'Keyword name {!r} is greater than 8 characters or '\n                        'contains characters not allowed by the FITS '\n                        'standard; a HIERARCH card will be created.'.format(\n                            keyword), VerifyWarning)\n            else:\n                raise ValueError(f'Illegal keyword name: {keyword!r}.')\n            self._keyword = keyword\n            self._modified = True\n        else:\n            raise ValueError(f'Keyword name {keyword!r} is not a string.')\n\n    @property\n    def value(self):\n        \"\"\"The value associated with the keyword stored in this card.\"\"\"\n\n        if self.field_specifier:\n            return float(self._value)\n\n        if self._value is not None:\n            value = self._value\n        elif self._valuestring is not None or self._image:\n            value = self._value = self._parse_value()\n        else:\n            if self._keyword == '':\n                self._value = value = ''\n            else:\n                self._value = value = UNDEFINED\n\n        if conf.strip_header_whitespace and isinstance(value, str):\n            value = value.rstrip()\n\n        return value\n\n    @value.setter\n    def value(self, value):\n        if self._invalid:\n            raise ValueError(\n                'The value of invalid/unparsable cards cannot set.  Either '\n                'delete this card from the header or replace it.')\n\n        if value is None:\n            value = UNDEFINED\n\n        try:\n            oldvalue = self.value\n        except VerifyError:\n            # probably a parsing error, falling back to the internal _value\n            # which should be None. This may happen while calling _fix_value.\n            oldvalue = self._value\n\n        if oldvalue is None:\n            oldvalue = UNDEFINED\n\n        if not isinstance(value,\n                          (str, int, float, complex, bool, Undefined,\n                           np.floating, np.integer, np.complexfloating,\n                           np.bool_)):\n            raise ValueError(f'Illegal value: {value!r}.')\n\n        if isinstance(value, (float, np.float32)) and (np.isnan(value) or\n                                                       np.isinf(value)):\n            # value is checked for both float and np.float32 instances\n            # since np.float32 is not considered a Python float.\n            raise ValueError(\"Floating point {!r} values are not allowed \"\n                             \"in FITS headers.\".format(value))\n\n        elif isinstance(value, str):\n            m = self._ascii_text_re.match(value)\n            if not m:\n                raise ValueError(\n                    'FITS header values must contain standard printable ASCII '\n                    'characters; {!r} contains characters not representable in '\n                    'ASCII or non-printable characters.'.format(value))\n        elif isinstance(value, np.bool_):\n            value = bool(value)\n\n        if (conf.strip_header_whitespace and\n                (isinstance(oldvalue, str) and isinstance(value, str))):\n            # Ignore extra whitespace when comparing the new value to the old\n            different = oldvalue.rstrip() != value.rstrip()\n        elif isinstance(oldvalue, bool) or isinstance(value, bool):\n            different = oldvalue is not value\n        else:\n            different = (oldvalue != value or\n                         not isinstance(value, type(oldvalue)))\n\n        if different:\n            self._value = value\n            self._rawvalue = None\n            self._modified = True\n            self._valuestring = None\n            self._valuemodified = True\n            if self.field_specifier:\n                try:\n                    self._value = _int_or_float(self._value)\n                except ValueError:\n                    raise ValueError(f'value {self._value} is not a float')\n\n    @value.deleter\n    def value(self):\n        if self._invalid:\n            raise ValueError(\n                'The value of invalid/unparsable cards cannot deleted.  '\n                'Either delete this card from the header or replace it.')\n\n        if not self.field_specifier:\n            self.value = ''\n        else:\n            raise AttributeError('Values cannot be deleted from record-valued '\n                                 'keyword cards')\n\n    @property\n    def rawkeyword(self):\n        \"\"\"On record-valued keyword cards this is the name of the standard <= 8\n        character FITS keyword that this RVKC is stored in.  Otherwise it is\n        the card's normal keyword.\n        \"\"\"\n\n        if self._rawkeyword is not None:\n            return self._rawkeyword\n        elif self.field_specifier is not None:\n            self._rawkeyword = self.keyword.split('.', 1)[0]\n            return self._rawkeyword\n        else:\n            return self.keyword\n\n    @property\n    def rawvalue(self):\n        \"\"\"On record-valued keyword cards this is the raw string value in\n        the ``<field-specifier>: <value>`` format stored in the card in order\n        to represent a RVKC.  Otherwise it is the card's normal value.\n        \"\"\"\n\n        if self._rawvalue is not None:\n            return self._rawvalue\n        elif self.field_specifier is not None:\n            self._rawvalue = f'{self.field_specifier}: {self.value}'\n            return self._rawvalue\n        else:\n            return self.value\n\n    @property\n    def comment(self):\n        \"\"\"Get the comment attribute from the card image if not already set.\"\"\"\n\n        if self._comment is not None:\n            return self._comment\n        elif self._image:\n            self._comment = self._parse_comment()\n            return self._comment\n        else:\n            self._comment = ''\n            return ''\n\n    @comment.setter\n    def comment(self, comment):\n        if self._invalid:\n            raise ValueError(\n                'The comment of invalid/unparsable cards cannot set.  Either '\n                'delete this card from the header or replace it.')\n\n        if comment is None:\n            comment = ''\n\n        if isinstance(comment, str):\n            m = self._ascii_text_re.match(comment)\n            if not m:\n                raise ValueError(\n                    'FITS header comments must contain standard printable '\n                    'ASCII characters; {!r} contains characters not '\n                    'representable in ASCII or non-printable characters.'\n                    .format(comment))\n\n        try:\n            oldcomment = self.comment\n        except VerifyError:\n            # probably a parsing error, falling back to the internal _comment\n            # which should be None.\n            oldcomment = self._comment\n\n        if oldcomment is None:\n            oldcomment = ''\n        if comment != oldcomment:\n            self._comment = comment\n            self._modified = True\n\n    @comment.deleter\n    def comment(self):\n        if self._invalid:\n            raise ValueError(\n                'The comment of invalid/unparsable cards cannot deleted.  '\n                'Either delete this card from the header or replace it.')\n\n        self.comment = ''\n\n    @property\n    def field_specifier(self):\n        \"\"\"\n        The field-specifier of record-valued keyword cards; always `None` on\n        normal cards.\n        \"\"\"\n\n        # Ensure that the keyword exists and has been parsed--the will set the\n        # internal _field_specifier attribute if this is a RVKC.\n        if self.keyword:\n            return self._field_specifier\n        else:\n            return None\n\n    @field_specifier.setter\n    def field_specifier(self, field_specifier):\n        if not field_specifier:\n            raise ValueError('The field-specifier may not be blank in '\n                             'record-valued keyword cards.')\n        elif not self.field_specifier:\n            raise AttributeError('Cannot coerce cards to be record-valued '\n                                 'keyword cards by setting the '\n                                 'field_specifier attribute')\n        elif field_specifier != self.field_specifier:\n            self._field_specifier = field_specifier\n            # The keyword need also be updated\n            keyword = self._keyword.split('.', 1)[0]\n            self._keyword = '.'.join([keyword, field_specifier])\n            self._modified = True\n\n    @field_specifier.deleter\n    def field_specifier(self):\n        raise AttributeError('The field_specifier attribute may not be '\n                             'deleted from record-valued keyword cards.')\n\n    @property\n    def image(self):\n        \"\"\"\n        The card \"image\", that is, the 80 byte character string that represents\n        this card in an actual FITS header.\n        \"\"\"\n\n        if self._image and not self._verified:\n            self.verify('fix+warn')\n        if self._image is None or self._modified:\n            self._image = self._format_image()\n        return self._image\n\n    @property\n    def is_blank(self):\n        \"\"\"\n        `True` if the card is completely blank--that is, it has no keyword,\n        value, or comment.  It appears in the header as 80 spaces.\n\n        Returns `False` otherwise.\n        \"\"\"\n\n        if not self._verified:\n            # The card image has not been parsed yet; compare directly with the\n            # string representation of a blank card\n            return self._image == BLANK_CARD\n\n        # If the keyword, value, and comment are all empty (for self.value\n        # explicitly check that it is a string value, since a blank value is\n        # returned as '')\n        return (not self.keyword and\n                (isinstance(self.value, str) and not self.value) and\n                not self.comment)\n\n    @classmethod\n    def fromstring(cls, image):\n        \"\"\"\n        Construct a `Card` object from a (raw) string. It will pad the string\n        if it is not the length of a card image (80 columns).  If the card\n        image is longer than 80 columns, assume it contains ``CONTINUE``\n        card(s).\n        \"\"\"\n\n        card = cls()\n        if isinstance(image, bytes):\n            # FITS supports only ASCII, but decode as latin1 and just take all\n            # bytes for now; if it results in mojibake due to e.g. UTF-8\n            # encoded data in a FITS header that's OK because it shouldn't be\n            # there in the first place\n            image = image.decode('latin1')\n\n        card._image = _pad(image)\n        card._verified = False\n        return card\n\n    @classmethod\n    def normalize_keyword(cls, keyword):\n        \"\"\"\n        `classmethod` to convert a keyword value that may contain a\n        field-specifier to uppercase.  The effect is to raise the key to\n        uppercase and leave the field specifier in its original case.\n\n        Parameters\n        ----------\n        keyword : or str\n            A keyword value or a ``keyword.field-specifier`` value\n        \"\"\"\n\n        # Test first for the most common case: a standard FITS keyword provided\n        # in standard all-caps\n        if (len(keyword) <= KEYWORD_LENGTH and\n                cls._keywd_FSC_RE.match(keyword)):\n            return keyword\n\n        # Test if this is a record-valued keyword\n        match = cls._rvkc_keyword_name_RE.match(keyword)\n\n        if match:\n            return '.'.join((match.group('keyword').strip().upper(),\n                             match.group('field_specifier')))\n        elif len(keyword) > 9 and keyword[:9].upper() == 'HIERARCH ':\n            # Remove 'HIERARCH' from HIERARCH keywords; this could lead to\n            # ambiguity if there is actually a keyword card containing\n            # \"HIERARCH HIERARCH\", but shame on you if you do that.\n            return keyword[9:].strip().upper()\n        else:\n            # A normal FITS keyword, but provided in non-standard case\n            return keyword.strip().upper()\n\n    def _check_if_rvkc(self, *args):\n        \"\"\"\n        Determine whether or not the card is a record-valued keyword card.\n\n        If one argument is given, that argument is treated as a full card image\n        and parsed as such.  If two arguments are given, the first is treated\n        as the card keyword (including the field-specifier if the card is\n        intended as a RVKC), and the second as the card value OR the first value\n        can be the base keyword, and the second value the 'field-specifier:\n        value' string.\n\n        If the check passes the ._keyword, ._value, and .field_specifier\n        keywords are set.\n\n        Examples\n        --------\n        ::\n\n            self._check_if_rvkc('DP1', 'AXIS.1: 2')\n            self._check_if_rvkc('DP1.AXIS.1', 2)\n            self._check_if_rvkc('DP1     = AXIS.1: 2')\n        \"\"\"\n\n        if not conf.enable_record_valued_keyword_cards:\n            return False\n\n        if len(args) == 1:\n            return self._check_if_rvkc_image(*args)\n        elif len(args) == 2:\n            keyword, value = args\n            if not isinstance(keyword, str):\n                return False\n            if keyword in self._commentary_keywords:\n                return False\n            match = self._rvkc_keyword_name_RE.match(keyword)\n            if match and isinstance(value, (int, float)):\n                self._init_rvkc(match.group('keyword'),\n                                match.group('field_specifier'), None, value)\n                return True\n\n            # Testing for ': ' is a quick way to avoid running the full regular\n            # expression, speeding this up for the majority of cases\n            if isinstance(value, str) and value.find(': ') > 0:\n                match = self._rvkc_field_specifier_val_RE.match(value)\n                if match and self._keywd_FSC_RE.match(keyword):\n                    self._init_rvkc(keyword, match.group('keyword'), value,\n                                    match.group('val'))\n                    return True\n\n    def _check_if_rvkc_image(self, *args):\n        \"\"\"\n        Implements `Card._check_if_rvkc` for the case of an unparsed card\n        image.  If given one argument this is the full intact image.  If given\n        two arguments the card has already been split between keyword and\n        value+comment at the standard value indicator '= '.\n        \"\"\"\n\n        if len(args) == 1:\n            image = args[0]\n            eq_idx = image.find(VALUE_INDICATOR)\n            if eq_idx < 0 or eq_idx > 9:\n                return False\n            keyword = image[:eq_idx]\n            rest = image[eq_idx + VALUE_INDICATOR_LEN:]\n        else:\n            keyword, rest = args\n\n        rest = rest.lstrip()\n\n        # This test allows us to skip running the full regular expression for\n        # the majority of cards that do not contain strings or that definitely\n        # do not contain RVKC field-specifiers; it's very much a\n        # micro-optimization but it does make a measurable difference\n        if not rest or rest[0] != \"'\" or rest.find(': ') < 2:\n            return False\n\n        match = self._rvkc_keyword_val_comm_RE.match(rest)\n        if match:\n            self._init_rvkc(keyword, match.group('keyword'),\n                            match.group('rawval'), match.group('val'))\n            return True\n\n    def _init_rvkc(self, keyword, field_specifier, field, value):\n        \"\"\"\n        Sort of addendum to Card.__init__ to set the appropriate internal\n        attributes if the card was determined to be a RVKC.\n        \"\"\"\n\n        keyword_upper = keyword.upper()\n        self._keyword = '.'.join((keyword_upper, field_specifier))\n        self._rawkeyword = keyword_upper\n        self._field_specifier = field_specifier\n        self._value = _int_or_float(value)\n        self._rawvalue = field\n\n    def _parse_keyword(self):\n        keyword = self._image[:KEYWORD_LENGTH].strip()\n        keyword_upper = keyword.upper()\n\n        if keyword_upper in self._special_keywords:\n            return keyword_upper\n        elif (keyword_upper == 'HIERARCH' and self._image[8] == ' ' and\n              HIERARCH_VALUE_INDICATOR in self._image):\n            # This is valid HIERARCH card as described by the HIERARCH keyword\n            # convention:\n            # http://fits.gsfc.nasa.gov/registry/hierarch_keyword.html\n            self._hierarch = True\n            self._value_indicator = HIERARCH_VALUE_INDICATOR\n            keyword = self._image.split(HIERARCH_VALUE_INDICATOR, 1)[0][9:]\n            return keyword.strip()\n        else:\n            val_ind_idx = self._image.find(VALUE_INDICATOR)\n            if 0 <= val_ind_idx <= KEYWORD_LENGTH:\n                # The value indicator should appear in byte 8, but we are\n                # flexible and allow this to be fixed\n                if val_ind_idx < KEYWORD_LENGTH:\n                    keyword = keyword[:val_ind_idx]\n                    keyword_upper = keyword_upper[:val_ind_idx]\n\n                rest = self._image[val_ind_idx + VALUE_INDICATOR_LEN:]\n\n                # So far this looks like a standard FITS keyword; check whether\n                # the value represents a RVKC; if so then we pass things off to\n                # the RVKC parser\n                if self._check_if_rvkc_image(keyword, rest):\n                    return self._keyword\n\n                return keyword_upper\n            else:\n                warnings.warn(\n                    'The following header keyword is invalid or follows an '\n                    'unrecognized non-standard convention:\\n{}'\n                    .format(self._image), AstropyUserWarning)\n                self._invalid = True\n                return keyword\n\n    def _parse_value(self):\n        \"\"\"Extract the keyword value from the card image.\"\"\"\n\n        # for commentary cards, no need to parse further\n        # Likewise for invalid cards\n        if self.keyword.upper() in self._commentary_keywords or self._invalid:\n            return self._image[KEYWORD_LENGTH:].rstrip()\n\n        if self._check_if_rvkc(self._image):\n            return self._value\n\n        m = self._value_NFSC_RE.match(self._split()[1])\n\n        if m is None:\n            raise VerifyError(\"Unparsable card ({}), fix it first with \"\n                              \".verify('fix').\".format(self.keyword))\n\n        if m.group('bool') is not None:\n            value = m.group('bool') == 'T'\n        elif m.group('strg') is not None:\n            value = re.sub(\"''\", \"'\", m.group('strg'))\n        elif m.group('numr') is not None:\n            #  Check for numbers with leading 0s.\n            numr = self._number_NFSC_RE.match(m.group('numr'))\n            digt = translate(numr.group('digt'), FIX_FP_TABLE2, ' ')\n            if numr.group('sign') is None:\n                sign = ''\n            else:\n                sign = numr.group('sign')\n            value = _str_to_num(sign + digt)\n\n        elif m.group('cplx') is not None:\n            #  Check for numbers with leading 0s.\n            real = self._number_NFSC_RE.match(m.group('real'))\n            rdigt = translate(real.group('digt'), FIX_FP_TABLE2, ' ')\n            if real.group('sign') is None:\n                rsign = ''\n            else:\n                rsign = real.group('sign')\n            value = _str_to_num(rsign + rdigt)\n            imag = self._number_NFSC_RE.match(m.group('imag'))\n            idigt = translate(imag.group('digt'), FIX_FP_TABLE2, ' ')\n            if imag.group('sign') is None:\n                isign = ''\n            else:\n                isign = imag.group('sign')\n            value += _str_to_num(isign + idigt) * 1j\n        else:\n            value = UNDEFINED\n\n        if not self._valuestring:\n            self._valuestring = m.group('valu')\n        return value\n\n    def _parse_comment(self):\n        \"\"\"Extract the keyword value from the card image.\"\"\"\n\n        # for commentary cards, no need to parse further\n        # likewise for invalid/unparsable cards\n        if self.keyword in Card._commentary_keywords or self._invalid:\n            return ''\n\n        valuecomment = self._split()[1]\n        m = self._value_NFSC_RE.match(valuecomment)\n        comment = ''\n        if m is not None:\n            # Don't combine this if statement with the one above, because\n            # we only want the elif case to run if this was not a valid\n            # card at all\n            if m.group('comm'):\n                comment = m.group('comm').rstrip()\n        elif '/' in valuecomment:\n            # The value in this FITS file was not in a valid/known format.  In\n            # this case the best we can do is guess that everything after the\n            # first / was meant to be the comment\n            comment = valuecomment.split('/', 1)[1].strip()\n\n        return comment\n\n    def _split(self):\n        \"\"\"\n        Split the card image between the keyword and the rest of the card.\n        \"\"\"\n\n        if self._image is not None:\n            # If we already have a card image, don't try to rebuild a new card\n            # image, which self.image would do\n            image = self._image\n        else:\n            image = self.image\n\n        # Split cards with CONTINUE cards or commentary keywords with long\n        # values\n        if len(self._image) > self.length:\n            values = []\n            comments = []\n            keyword = None\n            for card in self._itersubcards():\n                kw, vc = card._split()\n                if keyword is None:\n                    keyword = kw\n\n                if keyword in self._commentary_keywords:\n                    values.append(vc)\n                    continue\n\n                # Should match a string followed by a comment; if not it\n                # might be an invalid Card, so we just take it verbatim\n                m = self._strg_comment_RE.match(vc)\n                if not m:\n                    return kw, vc\n\n                value = m.group('strg') or ''\n                value = value.rstrip().replace(\"''\", \"'\")\n                if value and value[-1] == '&':\n                    value = value[:-1]\n                values.append(value)\n                comment = m.group('comm')\n                if comment:\n                    comments.append(comment.rstrip())\n\n            if keyword in self._commentary_keywords:\n                valuecomment = ''.join(values)\n            else:\n                # CONTINUE card\n                valuecomment = f\"'{''.join(values)}' / {' '.join(comments)}\"\n            return keyword, valuecomment\n\n        if self.keyword in self._special_keywords:\n            keyword, valuecomment = image.split(' ', 1)\n        else:\n            try:\n                delim_index = image.index(self._value_indicator)\n            except ValueError:\n                delim_index = None\n\n            # The equal sign may not be any higher than column 10; anything\n            # past that must be considered part of the card value\n            if delim_index is None:\n                keyword = image[:KEYWORD_LENGTH]\n                valuecomment = image[KEYWORD_LENGTH:]\n            elif delim_index > 10 and image[:9] != 'HIERARCH ':\n                keyword = image[:8]\n                valuecomment = image[8:]\n            else:\n                keyword, valuecomment = image.split(self._value_indicator, 1)\n        return keyword.strip(), valuecomment.strip()\n\n    def _fix_keyword(self):\n        if self.field_specifier:\n            keyword, field_specifier = self._keyword.split('.', 1)\n            self._keyword = '.'.join([keyword.upper(), field_specifier])\n        else:\n            self._keyword = self._keyword.upper()\n        self._modified = True\n\n    def _fix_value(self):\n        \"\"\"Fix the card image for fixable non-standard compliance.\"\"\"\n\n        value = None\n        keyword, valuecomment = self._split()\n        m = self._value_NFSC_RE.match(valuecomment)\n\n        # for the unparsable case\n        if m is None:\n            try:\n                value, comment = valuecomment.split('/', 1)\n                self.value = value.strip()\n                self.comment = comment.strip()\n            except (ValueError, IndexError):\n                self.value = valuecomment\n            self._valuestring = self._value\n            return\n        elif m.group('numr') is not None:\n            numr = self._number_NFSC_RE.match(m.group('numr'))\n            value = translate(numr.group('digt'), FIX_FP_TABLE, ' ')\n            if numr.group('sign') is not None:\n                value = numr.group('sign') + value\n\n        elif m.group('cplx') is not None:\n            real = self._number_NFSC_RE.match(m.group('real'))\n            rdigt = translate(real.group('digt'), FIX_FP_TABLE, ' ')\n            if real.group('sign') is not None:\n                rdigt = real.group('sign') + rdigt\n\n            imag = self._number_NFSC_RE.match(m.group('imag'))\n            idigt = translate(imag.group('digt'), FIX_FP_TABLE, ' ')\n            if imag.group('sign') is not None:\n                idigt = imag.group('sign') + idigt\n            value = f'({rdigt}, {idigt})'\n        self._valuestring = value\n        # The value itself has not been modified, but its serialized\n        # representation (as stored in self._valuestring) has been changed, so\n        # still set this card as having been modified (see ticket #137)\n        self._modified = True\n\n    def _format_keyword(self):\n        if self.keyword:\n            if self.field_specifier:\n                return '{:{len}}'.format(self.keyword.split('.', 1)[0],\n                                         len=KEYWORD_LENGTH)\n            elif self._hierarch:\n                return f'HIERARCH {self.keyword} '\n            else:\n                return '{:{len}}'.format(self.keyword, len=KEYWORD_LENGTH)\n        else:\n            return ' ' * KEYWORD_LENGTH\n\n    def _format_value(self):\n        # value string\n        float_types = (float, np.floating, complex, np.complexfloating)\n\n        # Force the value to be parsed out first\n        value = self.value\n        # But work with the underlying raw value instead (to preserve\n        # whitespace, for now...)\n        value = self._value\n\n        if self.keyword in self._commentary_keywords:\n            # The value of a commentary card must be just a raw unprocessed\n            # string\n            value = str(value)\n        elif (self._valuestring and not self._valuemodified and\n              isinstance(self.value, float_types)):\n            # Keep the existing formatting for float/complex numbers\n            value = f'{self._valuestring:>20}'\n        elif self.field_specifier:\n            value = _format_value(self._value).strip()\n            value = f\"'{self.field_specifier}: {value}'\"\n        else:\n            value = _format_value(value)\n\n        # For HIERARCH cards the value should be shortened to conserve space\n        if not self.field_specifier and len(self.keyword) > KEYWORD_LENGTH:\n            value = value.strip()\n\n        return value\n\n    def _format_comment(self):\n        if not self.comment:\n            return ''\n        else:\n            return f' / {self._comment}'\n\n    def _format_image(self):\n        keyword = self._format_keyword()\n\n        value = self._format_value()\n        is_commentary = keyword.strip() in self._commentary_keywords\n        if is_commentary:\n            comment = ''\n        else:\n            comment = self._format_comment()\n\n        # equal sign string\n        # by default use the standard value indicator even for HIERARCH cards;\n        # later we may abbreviate it if necessary\n        delimiter = VALUE_INDICATOR\n        if is_commentary:\n            delimiter = ''\n\n        # put all parts together\n        output = ''.join([keyword, delimiter, value, comment])\n\n        # For HIERARCH cards we can save a bit of space if necessary by\n        # removing the space between the keyword and the equals sign; I'm\n        # guessing this is part of the HIEARCH card specification\n        keywordvalue_length = len(keyword) + len(delimiter) + len(value)\n        if (keywordvalue_length > self.length and\n                keyword.startswith('HIERARCH')):\n            if (keywordvalue_length == self.length + 1 and keyword[-1] == ' '):\n                output = ''.join([keyword[:-1], delimiter, value, comment])\n            else:\n                # I guess the HIERARCH card spec is incompatible with CONTINUE\n                # cards\n                raise ValueError('The header keyword {!r} with its value is '\n                                 'too long'.format(self.keyword))\n\n        if len(output) <= self.length:\n            output = f'{output:80}'\n        else:\n            # longstring case (CONTINUE card)\n            # try not to use CONTINUE if the string value can fit in one line.\n            # Instead, just truncate the comment\n            if (isinstance(self.value, str) and\n                    len(value) > (self.length - 10)):\n                output = self._format_long_image()\n            else:\n                warnings.warn('Card is too long, comment will be truncated.',\n                              VerifyWarning)\n                output = output[:Card.length]\n        return output\n\n    def _format_long_image(self):\n        \"\"\"\n        Break up long string value/comment into ``CONTINUE`` cards.\n        This is a primitive implementation: it will put the value\n        string in one block and the comment string in another.  Also,\n        it does not break at the blank space between words.  So it may\n        not look pretty.\n        \"\"\"\n\n        if self.keyword in Card._commentary_keywords:\n            return self._format_long_commentary_image()\n\n        value_length = 67\n        comment_length = 64\n        output = []\n\n        # do the value string\n        value = self._value.replace(\"'\", \"''\")\n        words = _words_group(value, value_length)\n        for idx, word in enumerate(words):\n            if idx == 0:\n                headstr = '{:{len}}= '.format(self.keyword, len=KEYWORD_LENGTH)\n            else:\n                headstr = 'CONTINUE  '\n\n            # If this is the final CONTINUE remove the '&'\n            if not self.comment and idx == len(words) - 1:\n                value_format = \"'{}'\"\n            else:\n                value_format = \"'{}&'\"\n\n            value = value_format.format(word)\n\n            output.append(f'{headstr + value:80}')\n\n        # do the comment string\n        comment_format = \"{}\"\n\n        if self.comment:\n            words = _words_group(self.comment, comment_length)\n            for idx, word in enumerate(words):\n                # If this is the final CONTINUE remove the '&'\n                if idx == len(words) - 1:\n                    headstr = \"CONTINUE  '' / \"\n                else:\n                    headstr = \"CONTINUE  '&' / \"\n\n                comment = headstr + comment_format.format(word)\n                output.append(f'{comment:80}')\n\n        return ''.join(output)\n\n    def _format_long_commentary_image(self):\n        \"\"\"\n        If a commentary card's value is too long to fit on a single card, this\n        will render the card as multiple consecutive commentary card of the\n        same type.\n        \"\"\"\n\n        maxlen = Card.length - KEYWORD_LENGTH\n        value = self._format_value()\n        output = []\n        idx = 0\n        while idx < len(value):\n            output.append(str(Card(self.keyword, value[idx:idx + maxlen])))\n            idx += maxlen\n        return ''.join(output)\n\n    def _verify(self, option='warn'):\n        errs = []\n        fix_text = f'Fixed {self.keyword!r} card to meet the FITS standard.'\n\n        # Don't try to verify cards that already don't meet any recognizable\n        # standard\n        if self._invalid:\n            return _ErrList(errs)\n\n        # verify the equal sign position\n        if (self.keyword not in self._commentary_keywords and\n            (self._image and self._image[:9].upper() != 'HIERARCH ' and\n             self._image.find('=') != 8)):\n            errs.append(dict(\n                err_text='Card {!r} is not FITS standard (equal sign not '\n                         'at column 8).'.format(self.keyword),\n                fix_text=fix_text,\n                fix=self._fix_value))\n\n        # verify the key, it is never fixable\n        # always fix silently the case where \"=\" is before column 9,\n        # since there is no way to communicate back to the _keys.\n        if ((self._image and self._image[:8].upper() == 'HIERARCH') or\n                self._hierarch):\n            pass\n        else:\n            if self._image:\n                # PyFITS will auto-uppercase any standard keyword, so lowercase\n                # keywords can only occur if they came from the wild\n                keyword = self._split()[0]\n                if keyword != keyword.upper():\n                    # Keyword should be uppercase unless it's a HIERARCH card\n                    errs.append(dict(\n                        err_text=f'Card keyword {keyword!r} is not upper case.',\n                        fix_text=fix_text,\n                        fix=self._fix_keyword))\n\n            keyword = self.keyword\n            if self.field_specifier:\n                keyword = keyword.split('.', 1)[0]\n\n            if not self._keywd_FSC_RE.match(keyword):\n                errs.append(dict(\n                    err_text=f'Illegal keyword name {keyword!r}',\n                    fixable=False))\n\n        # verify the value, it may be fixable\n        keyword, valuecomment = self._split()\n        if self.keyword in self._commentary_keywords:\n            # For commentary keywords all that needs to be ensured is that it\n            # contains only printable ASCII characters\n            if not self._ascii_text_re.match(valuecomment):\n                errs.append(dict(\n                    err_text='Unprintable string {!r}; commentary cards may '\n                             'only contain printable ASCII characters'.format(\n                             valuecomment),\n                    fixable=False))\n        else:\n            if not self._valuemodified:\n                m = self._value_FSC_RE.match(valuecomment)\n                # If the value of a card was replaced before the card was ever\n                # even verified, the new value can be considered valid, so we\n                # don't bother verifying the old value.  See\n                # https://github.com/astropy/astropy/issues/5408\n                if m is None:\n                    errs.append(dict(\n                        err_text=f'Card {self.keyword!r} is not FITS standard '\n                                 f'(invalid value string: {valuecomment!r}).',\n                        fix_text=fix_text,\n                        fix=self._fix_value))\n\n        # verify the comment (string), it is never fixable\n        m = self._value_NFSC_RE.match(valuecomment)\n        if m is not None:\n            comment = m.group('comm')\n            if comment is not None:\n                if not self._ascii_text_re.match(comment):\n                    errs.append(dict(\n                        err_text=f'Unprintable string {comment!r}; header '\n                                  'comments may only contain printable '\n                                  'ASCII characters',\n                        fixable=False))\n\n        errs = _ErrList([self.run_option(option, **err) for err in errs])\n        self._verified = True\n        return errs\n\n    def _itersubcards(self):\n        \"\"\"\n        If the card image is greater than 80 characters, it should consist of a\n        normal card followed by one or more CONTINUE card.  This method returns\n        the subcards that make up this logical card.\n\n        This can also support the case where a HISTORY or COMMENT card has a\n        long value that is stored internally as multiple concatenated card\n        images.\n        \"\"\"\n\n        ncards = len(self._image) // Card.length\n\n        for idx in range(0, Card.length * ncards, Card.length):\n            card = Card.fromstring(self._image[idx:idx + Card.length])\n            if idx > 0 and card.keyword.upper() not in self._special_keywords:\n                raise VerifyError(\n                        'Long card images must have CONTINUE cards after '\n                        'the first card or have commentary keywords like '\n                        'HISTORY or COMMENT.')\n\n            if not isinstance(card.value, str):\n                raise VerifyError('CONTINUE cards must have string values.')\n\n            yield card\n\n\ndef _int_or_float(s):\n    \"\"\"\n    Converts an a string to an int if possible, or to a float.\n\n    If the string is neither a string or a float a value error is raised.\n    \"\"\"\n\n    if isinstance(s, float):\n        # Already a float so just pass through\n        return s\n\n    try:\n        return int(s)\n    except (ValueError, TypeError):\n        try:\n            return float(s)\n        except (ValueError, TypeError) as e:\n            raise ValueError(str(e))\n\n\ndef _format_value(value):\n    \"\"\"\n    Converts a card value to its appropriate string representation as\n    defined by the FITS format.\n    \"\"\"\n\n    # string value should occupies at least 8 columns, unless it is\n    # a null string\n    if isinstance(value, str):\n        if value == '':\n            return \"''\"\n        else:\n            exp_val_str = value.replace(\"'\", \"''\")\n            val_str = f\"'{exp_val_str:8}'\"\n            return f'{val_str:20}'\n\n    # must be before int checking since bool is also int\n    elif isinstance(value, (bool, np.bool_)):\n        return f'{repr(value)[0]:>20}'  # T or F\n\n    elif _is_int(value):\n        return f'{value:>20d}'\n\n    elif isinstance(value, (float, np.floating)):\n        return f'{_format_float(value):>20}'\n\n    elif isinstance(value, (complex, np.complexfloating)):\n        val_str = f'({_format_float(value.real)}, {_format_float(value.imag)})'\n        return f'{val_str:>20}'\n\n    elif isinstance(value, Undefined):\n        return ''\n    else:\n        return ''\n\n\ndef _format_float(value):\n    \"\"\"Format a floating number to make sure it gets the decimal point.\"\"\"\n\n    value_str = f'{value:.16G}'\n    if '.' not in value_str and 'E' not in value_str:\n        value_str += '.0'\n    elif 'E' in value_str:\n        # On some Windows builds of Python (and possibly other platforms?) the\n        # exponent is zero-padded out to, it seems, three digits.  Normalize\n        # the format to pad only to two digits.\n        significand, exponent = value_str.split('E')\n        if exponent[0] in ('+', '-'):\n            sign = exponent[0]\n            exponent = exponent[1:]\n        else:\n            sign = ''\n        value_str = f'{significand}E{sign}{int(exponent):02d}'\n\n    # Limit the value string to at most 20 characters.\n    str_len = len(value_str)\n\n    if str_len > 20:\n        idx = value_str.find('E')\n\n        if idx < 0:\n            value_str = value_str[:20]\n        else:\n            value_str = value_str[:20 - (str_len - idx)] + value_str[idx:]\n\n    return value_str\n\n\ndef _pad(input):\n    \"\"\"Pad blank space to the input string to be multiple of 80.\"\"\"\n\n    _len = len(input)\n    if _len == Card.length:\n        return input\n    elif _len > Card.length:\n        strlen = _len % Card.length\n        if strlen == 0:\n            return input\n        else:\n            return input + ' ' * (Card.length - strlen)\n\n    # minimum length is 80\n    else:\n        strlen = _len % Card.length\n        return input + ' ' * (Card.length - strlen)\n"},{"className":"Undefined","col":0,"comment":"Undefined value.","endLoc":36,"id":1769,"nodeType":"Class","startLoc":31,"text":"class Undefined:\n    \"\"\"Undefined value.\"\"\"\n\n    def __init__(self):\n        # This __init__ is required to be here for Sphinx documentation\n        pass"},{"col":4,"comment":"null","endLoc":36,"header":"def __init__(self)","id":1770,"name":"__init__","nodeType":"Function","startLoc":34,"text":"def __init__(self):\n        # This __init__ is required to be here for Sphinx documentation\n        pass"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":1771,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":1772,"name":"FIX_FP_TABLE","nodeType":"Attribute","startLoc":18,"text":"FIX_FP_TABLE"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":1773,"name":"FIX_FP_TABLE2","nodeType":"Attribute","startLoc":19,"text":"FIX_FP_TABLE2"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":1774,"name":"VALUE_INDICATOR","nodeType":"Attribute","startLoc":26,"text":"VALUE_INDICATOR"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":1775,"name":"VALUE_INDICATOR_LEN","nodeType":"Attribute","startLoc":27,"text":"VALUE_INDICATOR_LEN"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":1776,"name":"HIERARCH_VALUE_INDICATOR","nodeType":"Attribute","startLoc":28,"text":"HIERARCH_VALUE_INDICATOR"},{"col":0,"comment":"","endLoc":3,"header":"card.py#<anonymous>","id":1777,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['Card', 'Undefined']\n\nFIX_FP_TABLE = str.maketrans('de', 'DE')\n\nFIX_FP_TABLE2 = str.maketrans('dD', 'eE')\n\nCARD_LENGTH = 80\n\nBLANK_CARD = ' ' * CARD_LENGTH\n\nKEYWORD_LENGTH = 8  # The max length for FITS-standard keywords\n\nVALUE_INDICATOR = '= '  # The standard FITS value indicator\n\nVALUE_INDICATOR_LEN = len(VALUE_INDICATOR)\n\nHIERARCH_VALUE_INDICATOR = '='  # HIERARCH cards may use a shortened indicator\n\nUNDEFINED = Undefined()"},{"id":1778,"name":"astropy/io/fits/hdu","nodeType":"Package"},{"fileName":"hdulist.py","filePath":"astropy/io/fits/hdu","id":1779,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport gzip\nimport itertools\nimport os\nimport re\nimport shutil\nimport sys\nimport warnings\n\nimport numpy as np\n\nfrom . import compressed\nfrom .base import _BaseHDU, _ValidHDU, _NonstandardHDU, ExtensionHDU\nfrom .groups import GroupsHDU\nfrom .image import PrimaryHDU, ImageHDU\nfrom astropy.io.fits.file import _File, FILE_MODES\nfrom astropy.io.fits.header import _pad_length\nfrom astropy.io.fits.util import (_free_space_check, _get_array_mmap, _is_int,\n                                  _tmp_name, fileobj_closed, fileobj_mode,\n                                  ignore_sigint, isfile)\nfrom astropy.io.fits.verify import _Verify, _ErrList, VerifyError, VerifyWarning\nfrom astropy.utils import indent\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n# NOTE: Python can be built without bz2.\nfrom astropy.utils.compat.optional_deps import HAS_BZ2\nif HAS_BZ2:\n    import bz2\n\n__all__ = [\"HDUList\", \"fitsopen\"]\n\n# FITS file signature as per RFC 4047\nFITS_SIGNATURE = b'SIMPLE  =                    T'\n\n\ndef fitsopen(name, mode='readonly', memmap=None, save_backup=False,\n             cache=True, lazy_load_hdus=None, ignore_missing_simple=False,\n             **kwargs):\n    \"\"\"Factory function to open a FITS file and return an `HDUList` object.\n\n    Parameters\n    ----------\n    name : str, file-like or `pathlib.Path`\n        File to be opened.\n\n    mode : str, optional\n        Open mode, 'readonly', 'update', 'append', 'denywrite', or\n        'ostream'. Default is 'readonly'.\n\n        If ``name`` is a file object that is already opened, ``mode`` must\n        match the mode the file was opened with, readonly (rb), update (rb+),\n        append (ab+), ostream (w), denywrite (rb)).\n\n    memmap : bool, optional\n        Is memory mapping to be used? This value is obtained from the\n        configuration item ``astropy.io.fits.Conf.use_memmap``.\n        Default is `True`.\n\n    save_backup : bool, optional\n        If the file was opened in update or append mode, this ensures that\n        a backup of the original file is saved before any changes are flushed.\n        The backup has the same name as the original file with \".bak\" appended.\n        If \"file.bak\" already exists then \"file.bak.1\" is used, and so on.\n        Default is `False`.\n\n    cache : bool, optional\n        If the file name is a URL, `~astropy.utils.data.download_file` is used\n        to open the file.  This specifies whether or not to save the file\n        locally in Astropy's download cache. Default is `True`.\n\n    lazy_load_hdus : bool, optional\n        To avoid reading all the HDUs and headers in a FITS file immediately\n        upon opening.  This is an optimization especially useful for large\n        files, as FITS has no way of determining the number and offsets of all\n        the HDUs in a file without scanning through the file and reading all\n        the headers. Default is `True`.\n\n        To disable lazy loading and read all HDUs immediately (the old\n        behavior) use ``lazy_load_hdus=False``.  This can lead to fewer\n        surprises--for example with lazy loading enabled, ``len(hdul)``\n        can be slow, as it means the entire FITS file needs to be read in\n        order to determine the number of HDUs.  ``lazy_load_hdus=False``\n        ensures that all HDUs have already been loaded after the file has\n        been opened.\n\n        .. versionadded:: 1.3\n\n    uint : bool, optional\n        Interpret signed integer data where ``BZERO`` is the central value and\n        ``BSCALE == 1`` as unsigned integer data.  For example, ``int16`` data\n        with ``BZERO = 32768`` and ``BSCALE = 1`` would be treated as\n        ``uint16`` data. Default is `True` so that the pseudo-unsigned\n        integer convention is assumed.\n\n    ignore_missing_end : bool, optional\n        Do not raise an exception when opening a file that is missing an\n        ``END`` card in the last header. Default is `False`.\n\n    ignore_missing_simple : bool, optional\n        Do not raise an exception when the SIMPLE keyword is missing. Note\n        that io.fits will raise a warning if a SIMPLE card is present but\n        written in a way that does not follow the FITS Standard.\n        Default is `False`.\n\n        .. versionadded:: 4.2\n\n    checksum : bool, str, optional\n        If `True`, verifies that both ``DATASUM`` and ``CHECKSUM`` card values\n        (when present in the HDU header) match the header and data of all HDU's\n        in the file.  Updates to a file that already has a checksum will\n        preserve and update the existing checksums unless this argument is\n        given a value of 'remove', in which case the CHECKSUM and DATASUM\n        values are not checked, and are removed when saving changes to the\n        file. Default is `False`.\n\n    disable_image_compression : bool, optional\n        If `True`, treats compressed image HDU's like normal binary table\n        HDU's.  Default is `False`.\n\n    do_not_scale_image_data : bool, optional\n        If `True`, image data is not scaled using BSCALE/BZERO values\n        when read.  Default is `False`.\n\n    character_as_bytes : bool, optional\n        Whether to return bytes for string columns, otherwise unicode strings\n        are returned, but this does not respect memory mapping and loads the\n        whole column in memory when accessed. Default is `False`.\n\n    ignore_blank : bool, optional\n        If `True`, the BLANK keyword is ignored if present.\n        Default is `False`.\n\n    scale_back : bool, optional\n        If `True`, when saving changes to a file that contained scaled image\n        data, restore the data to the original type and reapply the original\n        BSCALE/BZERO values. This could lead to loss of accuracy if scaling\n        back to integer values after performing floating point operations on\n        the data. Default is `False`.\n\n    output_verify : str\n        Output verification option.  Must be one of ``\"fix\"``,\n        ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n        ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n        ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n        (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n    Returns\n    -------\n    hdulist : `HDUList`\n        `HDUList` containing all of the header data units in the file.\n\n    \"\"\"\n\n    from astropy.io.fits import conf\n\n    if memmap is None:\n        # distinguish between True (kwarg explicitly set)\n        # and None (preference for memmap in config, might be ignored)\n        memmap = None if conf.use_memmap else False\n    else:\n        memmap = bool(memmap)\n\n    if lazy_load_hdus is None:\n        lazy_load_hdus = conf.lazy_load_hdus\n    else:\n        lazy_load_hdus = bool(lazy_load_hdus)\n\n    if 'uint' not in kwargs:\n        kwargs['uint'] = conf.enable_uint\n\n    if not name:\n        raise ValueError(f'Empty filename: {name!r}')\n\n    return HDUList.fromfile(name, mode, memmap, save_backup, cache,\n                            lazy_load_hdus, ignore_missing_simple, **kwargs)\n\n\nclass HDUList(list, _Verify):\n    \"\"\"\n    HDU list class.  This is the top-level FITS object.  When a FITS\n    file is opened, a `HDUList` object is returned.\n    \"\"\"\n\n    def __init__(self, hdus=[], file=None):\n        \"\"\"\n        Construct a `HDUList` object.\n\n        Parameters\n        ----------\n        hdus : BaseHDU or sequence thereof, optional\n            The HDU object(s) to comprise the `HDUList`.  Should be\n            instances of HDU classes like `ImageHDU` or `BinTableHDU`.\n\n        file : file-like, bytes, optional\n            The opened physical file associated with the `HDUList`\n            or a bytes object containing the contents of the FITS\n            file.\n        \"\"\"\n\n        if isinstance(file, bytes):\n            self._data = file\n            self._file = None\n        else:\n            self._file = file\n            self._data = None\n\n        # For internal use only--the keyword args passed to fitsopen /\n        # HDUList.fromfile/string when opening the file\n        self._open_kwargs = {}\n        self._in_read_next_hdu = False\n\n        # If we have read all the HDUs from the file or not\n        # The assumes that all HDUs have been written when we first opened the\n        # file; we do not currently support loading additional HDUs from a file\n        # while it is being streamed to.  In the future that might be supported\n        # but for now this is only used for the purpose of lazy-loading of\n        # existing HDUs.\n        if file is None:\n            self._read_all = True\n        elif self._file is not None:\n            # Should never attempt to read HDUs in ostream mode\n            self._read_all = self._file.mode == 'ostream'\n        else:\n            self._read_all = False\n\n        if hdus is None:\n            hdus = []\n\n        # can take one HDU, as well as a list of HDU's as input\n        if isinstance(hdus, _ValidHDU):\n            hdus = [hdus]\n        elif not isinstance(hdus, (HDUList, list)):\n            raise TypeError(\"Invalid input for HDUList.\")\n\n        for idx, hdu in enumerate(hdus):\n            if not isinstance(hdu, _BaseHDU):\n                raise TypeError(f\"Element {idx} in the HDUList input is not an HDU.\")\n\n        super().__init__(hdus)\n\n        if file is None:\n            # Only do this when initializing from an existing list of HDUs\n            # When initializing from a file, this will be handled by the\n            # append method after the first HDU is read\n            self.update_extend()\n\n    def __len__(self):\n        if not self._in_read_next_hdu:\n            self.readall()\n\n        return super().__len__()\n\n    def __repr__(self):\n        # In order to correctly repr an HDUList we need to load all the\n        # HDUs as well\n        self.readall()\n\n        return super().__repr__()\n\n    def __iter__(self):\n        # While effectively this does the same as:\n        # for idx in range(len(self)):\n        #     yield self[idx]\n        # the more complicated structure is here to prevent the use of len(),\n        # which would break the lazy loading\n        for idx in itertools.count():\n            try:\n                yield self[idx]\n            except IndexError:\n                break\n\n    def __getitem__(self, key):\n        \"\"\"\n        Get an HDU from the `HDUList`, indexed by number or name.\n        \"\"\"\n\n        # If the key is a slice we need to make sure the necessary HDUs\n        # have been loaded before passing the slice on to super.\n        if isinstance(key, slice):\n            max_idx = key.stop\n            # Check for and handle the case when no maximum was\n            # specified (e.g. [1:]).\n            if max_idx is None:\n                # We need all of the HDUs, so load them\n                # and reset the maximum to the actual length.\n                max_idx = len(self)\n\n            # Just in case the max_idx is negative...\n            max_idx = self._positive_index_of(max_idx)\n\n            number_loaded = super().__len__()\n\n            if max_idx >= number_loaded:\n                # We need more than we have, try loading up to and including\n                # max_idx. Note we do not try to be clever about skipping HDUs\n                # even though key.step might conceivably allow it.\n                for i in range(number_loaded, max_idx):\n                    # Read until max_idx or to the end of the file, whichever\n                    # comes first.\n                    if not self._read_next_hdu():\n                        break\n\n            try:\n                hdus = super().__getitem__(key)\n            except IndexError as e:\n                # Raise a more helpful IndexError if the file was not fully read.\n                if self._read_all:\n                    raise e\n                else:\n                    raise IndexError('HDU not found, possibly because the index '\n                                     'is out of range, or because the file was '\n                                     'closed before all HDUs were read')\n            else:\n                return HDUList(hdus)\n\n        # Originally this used recursion, but hypothetically an HDU with\n        # a very large number of HDUs could blow the stack, so use a loop\n        # instead\n        try:\n            return self._try_while_unread_hdus(super().__getitem__,\n                                               self._positive_index_of(key))\n        except IndexError as e:\n            # Raise a more helpful IndexError if the file was not fully read.\n            if self._read_all:\n                raise e\n            else:\n                raise IndexError('HDU not found, possibly because the index '\n                                 'is out of range, or because the file was '\n                                 'closed before all HDUs were read')\n\n    def __contains__(self, item):\n        \"\"\"\n        Returns `True` if ``item`` is an ``HDU`` _in_ ``self`` or a valid\n        extension specification (e.g., integer extension number, extension\n        name, or a tuple of extension name and an extension version)\n        of a ``HDU`` in ``self``.\n\n        \"\"\"\n        try:\n            self._try_while_unread_hdus(self.index_of, item)\n        except (KeyError, ValueError):\n            return False\n\n        return True\n\n    def __setitem__(self, key, hdu):\n        \"\"\"\n        Set an HDU to the `HDUList`, indexed by number or name.\n        \"\"\"\n\n        _key = self._positive_index_of(key)\n        if isinstance(hdu, (slice, list)):\n            if _is_int(_key):\n                raise ValueError('An element in the HDUList must be an HDU.')\n            for item in hdu:\n                if not isinstance(item, _BaseHDU):\n                    raise ValueError(f'{item} is not an HDU.')\n        else:\n            if not isinstance(hdu, _BaseHDU):\n                raise ValueError(f'{hdu} is not an HDU.')\n\n        try:\n            self._try_while_unread_hdus(super().__setitem__, _key, hdu)\n        except IndexError:\n            raise IndexError(f'Extension {key} is out of bound or not found.')\n\n        self._resize = True\n        self._truncate = False\n\n    def __delitem__(self, key):\n        \"\"\"\n        Delete an HDU from the `HDUList`, indexed by number or name.\n        \"\"\"\n\n        if isinstance(key, slice):\n            end_index = len(self)\n        else:\n            key = self._positive_index_of(key)\n            end_index = len(self) - 1\n\n        self._try_while_unread_hdus(super().__delitem__, key)\n\n        if (key == end_index or key == -1 and not self._resize):\n            self._truncate = True\n        else:\n            self._truncate = False\n            self._resize = True\n\n    # Support the 'with' statement\n    def __enter__(self):\n        return self\n\n    def __exit__(self, type, value, traceback):\n        output_verify = self._open_kwargs.get('output_verify', 'exception')\n        self.close(output_verify=output_verify)\n\n    @classmethod\n    def fromfile(cls, fileobj, mode=None, memmap=None,\n                 save_backup=False, cache=True, lazy_load_hdus=True,\n                 ignore_missing_simple=False, **kwargs):\n        \"\"\"\n        Creates an `HDUList` instance from a file-like object.\n\n        The actual implementation of ``fitsopen()``, and generally shouldn't\n        be used directly.  Use :func:`open` instead (and see its\n        documentation for details of the parameters accepted by this method).\n        \"\"\"\n\n        return cls._readfrom(fileobj=fileobj, mode=mode, memmap=memmap,\n                             save_backup=save_backup, cache=cache,\n                             ignore_missing_simple=ignore_missing_simple,\n                             lazy_load_hdus=lazy_load_hdus, **kwargs)\n\n    @classmethod\n    def fromstring(cls, data, **kwargs):\n        \"\"\"\n        Creates an `HDUList` instance from a string or other in-memory data\n        buffer containing an entire FITS file.  Similar to\n        :meth:`HDUList.fromfile`, but does not accept the mode or memmap\n        arguments, as they are only relevant to reading from a file on disk.\n\n        This is useful for interfacing with other libraries such as CFITSIO,\n        and may also be useful for streaming applications.\n\n        Parameters\n        ----------\n        data : str, buffer-like, etc.\n            A string or other memory buffer containing an entire FITS file.\n            Buffer-like objects include :class:`~bytes`, :class:`~bytearray`,\n            :class:`~memoryview`, and :class:`~numpy.ndarray`.\n            It should be noted that if that memory is read-only (such as a\n            Python string) the returned :class:`HDUList`'s data portions will\n            also be read-only.\n        **kwargs : dict\n            Optional keyword arguments.  See\n            :func:`astropy.io.fits.open` for details.\n\n        Returns\n        -------\n        hdul : HDUList\n            An :class:`HDUList` object representing the in-memory FITS file.\n        \"\"\"\n\n        try:\n            # Test that the given object supports the buffer interface by\n            # ensuring an ndarray can be created from it\n            np.ndarray((), dtype='ubyte', buffer=data)\n        except TypeError:\n            raise TypeError(\n                'The provided object {} does not contain an underlying '\n                'memory buffer.  fromstring() requires an object that '\n                'supports the buffer interface such as bytes, buffer, '\n                'memoryview, ndarray, etc.  This restriction is to ensure '\n                'that efficient access to the array/table data is possible.'\n                ''.format(data))\n\n        return cls._readfrom(data=data, **kwargs)\n\n    def fileinfo(self, index):\n        \"\"\"\n        Returns a dictionary detailing information about the locations\n        of the indexed HDU within any associated file.  The values are\n        only valid after a read or write of the associated file with\n        no intervening changes to the `HDUList`.\n\n        Parameters\n        ----------\n        index : int\n            Index of HDU for which info is to be returned.\n\n        Returns\n        -------\n        fileinfo : dict or None\n\n            The dictionary details information about the locations of\n            the indexed HDU within an associated file.  Returns `None`\n            when the HDU is not associated with a file.\n\n            Dictionary contents:\n\n            ========== ========================================================\n            Key        Value\n            ========== ========================================================\n            file       File object associated with the HDU\n            filename   Name of associated file object\n            filemode   Mode in which the file was opened (readonly,\n                       update, append, denywrite, ostream)\n            resized    Flag that when `True` indicates that the data has been\n                       resized since the last read/write so the returned values\n                       may not be valid.\n            hdrLoc     Starting byte location of header in file\n            datLoc     Starting byte location of data block in file\n            datSpan    Data size including padding\n            ========== ========================================================\n\n        \"\"\"\n\n        if self._file is not None:\n            output = self[index].fileinfo()\n\n            if not output:\n                # OK, the HDU associated with this index is not yet\n                # tied to the file associated with the HDUList.  The only way\n                # to get the file object is to check each of the HDU's in the\n                # list until we find the one associated with the file.\n                f = None\n\n                for hdu in self:\n                    info = hdu.fileinfo()\n\n                    if info:\n                        f = info['file']\n                        fm = info['filemode']\n                        break\n\n                output = {'file': f, 'filemode': fm, 'hdrLoc': None,\n                          'datLoc': None, 'datSpan': None}\n\n            output['filename'] = self._file.name\n            output['resized'] = self._wasresized()\n        else:\n            output = None\n\n        return output\n\n    def __copy__(self):\n        \"\"\"\n        Return a shallow copy of an HDUList.\n\n        Returns\n        -------\n        copy : `HDUList`\n            A shallow copy of this `HDUList` object.\n\n        \"\"\"\n\n        return self[:]\n\n    # Syntactic sugar for `__copy__()` magic method\n    copy = __copy__\n\n    def __deepcopy__(self, memo=None):\n        return HDUList([hdu.copy() for hdu in self])\n\n    def pop(self, index=-1):\n        \"\"\" Remove an item from the list and return it.\n\n        Parameters\n        ----------\n        index : int, str, tuple of (string, int), optional\n            An integer value of ``index`` indicates the position from which\n            ``pop()`` removes and returns an HDU. A string value or a tuple\n            of ``(string, int)`` functions as a key for identifying the\n            HDU to be removed and returned. If ``key`` is a tuple, it is\n            of the form ``(key, ver)`` where ``ver`` is an ``EXTVER``\n            value that must match the HDU being searched for.\n\n            If the key is ambiguous (e.g. there are multiple 'SCI' extensions)\n            the first match is returned.  For a more precise match use the\n            ``(name, ver)`` pair.\n\n            If even the ``(name, ver)`` pair is ambiguous the numeric index\n            must be used to index the duplicate HDU.\n\n        Returns\n        -------\n        hdu : BaseHDU\n            The HDU object at position indicated by ``index`` or having name\n            and version specified by ``index``.\n        \"\"\"\n\n        # Make sure that HDUs are loaded before attempting to pop\n        self.readall()\n        list_index = self.index_of(index)\n        return super().pop(list_index)\n\n    def insert(self, index, hdu):\n        \"\"\"\n        Insert an HDU into the `HDUList` at the given ``index``.\n\n        Parameters\n        ----------\n        index : int\n            Index before which to insert the new HDU.\n\n        hdu : BaseHDU\n            The HDU object to insert\n        \"\"\"\n\n        if not isinstance(hdu, _BaseHDU):\n            raise ValueError(f'{hdu} is not an HDU.')\n\n        num_hdus = len(self)\n\n        if index == 0 or num_hdus == 0:\n            if num_hdus != 0:\n                # We are inserting a new Primary HDU so we need to\n                # make the current Primary HDU into an extension HDU.\n                if isinstance(self[0], GroupsHDU):\n                    raise ValueError(\n                        \"The current Primary HDU is a GroupsHDU.  \"\n                        \"It can't be made into an extension HDU, \"\n                        \"so another HDU cannot be inserted before it.\")\n\n                hdu1 = ImageHDU(self[0].data, self[0].header)\n\n                # Insert it into position 1, then delete HDU at position 0.\n                super().insert(1, hdu1)\n                super().__delitem__(0)\n\n            if not isinstance(hdu, (PrimaryHDU, _NonstandardHDU)):\n                # You passed in an Extension HDU but we need a Primary HDU.\n                # If you provided an ImageHDU then we can convert it to\n                # a primary HDU and use that.\n                if isinstance(hdu, ImageHDU):\n                    hdu = PrimaryHDU(hdu.data, hdu.header)\n                else:\n                    # You didn't provide an ImageHDU so we create a\n                    # simple Primary HDU and append that first before\n                    # we append the new Extension HDU.\n                    phdu = PrimaryHDU()\n\n                    super().insert(0, phdu)\n                    index = 1\n        else:\n            if isinstance(hdu, GroupsHDU):\n                raise ValueError('A GroupsHDU must be inserted as a '\n                                 'Primary HDU.')\n\n            if isinstance(hdu, PrimaryHDU):\n                # You passed a Primary HDU but we need an Extension HDU\n                # so create an Extension HDU from the input Primary HDU.\n                hdu = ImageHDU(hdu.data, hdu.header)\n\n        super().insert(index, hdu)\n        hdu._new = True\n        self._resize = True\n        self._truncate = False\n        # make sure the EXTEND keyword is in primary HDU if there is extension\n        self.update_extend()\n\n    def append(self, hdu):\n        \"\"\"\n        Append a new HDU to the `HDUList`.\n\n        Parameters\n        ----------\n        hdu : BaseHDU\n            HDU to add to the `HDUList`.\n        \"\"\"\n\n        if not isinstance(hdu, _BaseHDU):\n            raise ValueError('HDUList can only append an HDU.')\n\n        if len(self) > 0:\n            if isinstance(hdu, GroupsHDU):\n                raise ValueError(\n                    \"Can't append a GroupsHDU to a non-empty HDUList\")\n\n            if isinstance(hdu, PrimaryHDU):\n                # You passed a Primary HDU but we need an Extension HDU\n                # so create an Extension HDU from the input Primary HDU.\n                # TODO: This isn't necessarily sufficient to copy the HDU;\n                # _header_offset and friends need to be copied too.\n                hdu = ImageHDU(hdu.data, hdu.header)\n        else:\n            if not isinstance(hdu, (PrimaryHDU, _NonstandardHDU)):\n                # You passed in an Extension HDU but we need a Primary\n                # HDU.\n                # If you provided an ImageHDU then we can convert it to\n                # a primary HDU and use that.\n                if isinstance(hdu, ImageHDU):\n                    hdu = PrimaryHDU(hdu.data, hdu.header)\n                else:\n                    # You didn't provide an ImageHDU so we create a\n                    # simple Primary HDU and append that first before\n                    # we append the new Extension HDU.\n                    phdu = PrimaryHDU()\n                    super().append(phdu)\n\n        super().append(hdu)\n        hdu._new = True\n        self._resize = True\n        self._truncate = False\n\n        # make sure the EXTEND keyword is in primary HDU if there is extension\n        self.update_extend()\n\n    def index_of(self, key):\n        \"\"\"\n        Get the index of an HDU from the `HDUList`.\n\n        Parameters\n        ----------\n        key : int, str, tuple of (string, int) or BaseHDU\n            The key identifying the HDU.  If ``key`` is a tuple, it is of the\n            form ``(name, ver)`` where ``ver`` is an ``EXTVER`` value that must\n            match the HDU being searched for.\n\n            If the key is ambiguous (e.g. there are multiple 'SCI' extensions)\n            the first match is returned.  For a more precise match use the\n            ``(name, ver)`` pair.\n\n            If even the ``(name, ver)`` pair is ambiguous (it shouldn't be\n            but it's not impossible) the numeric index must be used to index\n            the duplicate HDU.\n\n            When ``key`` is an HDU object, this function returns the\n            index of that HDU object in the ``HDUList``.\n\n        Returns\n        -------\n        index : int\n            The index of the HDU in the `HDUList`.\n\n        Raises\n        ------\n        ValueError\n            If ``key`` is an HDU object and it is not found in the ``HDUList``.\n        KeyError\n            If an HDU specified by the ``key`` that is an extension number,\n            extension name, or a tuple of extension name and version is not\n            found in the ``HDUList``.\n\n        \"\"\"\n\n        if _is_int(key):\n            return key\n        elif isinstance(key, tuple):\n            _key, _ver = key\n        elif isinstance(key, _BaseHDU):\n            return self.index(key)\n        else:\n            _key = key\n            _ver = None\n\n        if not isinstance(_key, str):\n            raise KeyError(\n                '{} indices must be integers, extension names as strings, '\n                'or (extname, version) tuples; got {}'\n                ''.format(self.__class__.__name__, _key))\n\n        _key = (_key.strip()).upper()\n\n        found = None\n        for idx, hdu in enumerate(self):\n            name = hdu.name\n            if isinstance(name, str):\n                name = name.strip().upper()\n            # 'PRIMARY' should always work as a reference to the first HDU\n            if ((name == _key or (_key == 'PRIMARY' and idx == 0)) and\n                    (_ver is None or _ver == hdu.ver)):\n                found = idx\n                break\n\n        if (found is None):\n            raise KeyError(f'Extension {key!r} not found.')\n        else:\n            return found\n\n    def _positive_index_of(self, key):\n        \"\"\"\n        Same as index_of, but ensures always returning a positive index\n        or zero.\n\n        (Really this should be called non_negative_index_of but it felt\n        too long.)\n\n        This means that if the key is a negative integer, we have to\n        convert it to the corresponding positive index.  This means\n        knowing the length of the HDUList, which in turn means loading\n        all HDUs.  Therefore using negative indices on HDULists is inherently\n        inefficient.\n        \"\"\"\n\n        index = self.index_of(key)\n\n        if index >= 0:\n            return index\n\n        if abs(index) > len(self):\n            raise IndexError(\n                f'Extension {index} is out of bound or not found.')\n\n        return len(self) + index\n\n    def readall(self):\n        \"\"\"\n        Read data of all HDUs into memory.\n        \"\"\"\n        while self._read_next_hdu():\n            pass\n\n    @ignore_sigint\n    def flush(self, output_verify='fix', verbose=False):\n        \"\"\"\n        Force a write of the `HDUList` back to the file (for append and\n        update modes only).\n\n        Parameters\n        ----------\n        output_verify : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        verbose : bool\n            When `True`, print verbose messages\n        \"\"\"\n\n        if self._file.mode not in ('append', 'update', 'ostream'):\n            warnings.warn(\"Flush for '{}' mode is not supported.\"\n                          .format(self._file.mode), AstropyUserWarning)\n            return\n\n        save_backup = self._open_kwargs.get('save_backup', False)\n        if save_backup and self._file.mode in ('append', 'update'):\n            filename = self._file.name\n            if os.path.exists(filename):\n                # The the file doesn't actually exist anymore for some reason\n                # then there's no point in trying to make a backup\n                backup = filename + '.bak'\n                idx = 1\n                while os.path.exists(backup):\n                    backup = filename + '.bak.' + str(idx)\n                    idx += 1\n                warnings.warn('Saving a backup of {} to {}.'.format(\n                        filename, backup), AstropyUserWarning)\n                try:\n                    shutil.copy(filename, backup)\n                except OSError as exc:\n                    raise OSError('Failed to save backup to destination {}: '\n                                  '{}'.format(filename, exc))\n\n        self.verify(option=output_verify)\n\n        if self._file.mode in ('append', 'ostream'):\n            for hdu in self:\n                if verbose:\n                    try:\n                        extver = str(hdu._header['extver'])\n                    except KeyError:\n                        extver = ''\n\n                # only append HDU's which are \"new\"\n                if hdu._new:\n                    hdu._prewriteto(checksum=hdu._output_checksum)\n                    with _free_space_check(self):\n                        hdu._writeto(self._file)\n                        if verbose:\n                            print('append HDU', hdu.name, extver)\n                        hdu._new = False\n                    hdu._postwriteto()\n\n        elif self._file.mode == 'update':\n            self._flush_update()\n\n    def update_extend(self):\n        \"\"\"\n        Make sure that if the primary header needs the keyword ``EXTEND`` that\n        it has it and it is correct.\n        \"\"\"\n\n        if not len(self):\n            return\n\n        if not isinstance(self[0], PrimaryHDU):\n            # A PrimaryHDU will be automatically inserted at some point, but it\n            # might not have been added yet\n            return\n\n        hdr = self[0].header\n\n        def get_first_ext():\n            try:\n                return self[1]\n            except IndexError:\n                return None\n\n        if 'EXTEND' in hdr:\n            if not hdr['EXTEND'] and get_first_ext() is not None:\n                hdr['EXTEND'] = True\n        elif get_first_ext() is not None:\n            if hdr['NAXIS'] == 0:\n                hdr.set('EXTEND', True, after='NAXIS')\n            else:\n                n = hdr['NAXIS']\n                hdr.set('EXTEND', True, after='NAXIS' + str(n))\n\n    def writeto(self, fileobj, output_verify='exception', overwrite=False,\n                checksum=False):\n        \"\"\"\n        Write the `HDUList` to a new file.\n\n        Parameters\n        ----------\n        fileobj : str, file-like or `pathlib.Path`\n            File to write to.  If a file object, must be opened in a\n            writeable mode.\n\n        output_verify : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n\n        checksum : bool\n            When `True` adds both ``DATASUM`` and ``CHECKSUM`` cards\n            to the headers of all HDU's written to the file.\n        \"\"\"\n\n        if (len(self) == 0):\n            warnings.warn(\"There is nothing to write.\", AstropyUserWarning)\n            return\n\n        self.verify(option=output_verify)\n\n        # make sure the EXTEND keyword is there if there is extension\n        self.update_extend()\n\n        # make note of whether the input file object is already open, in which\n        # case we should not close it after writing (that should be the job\n        # of the caller)\n        closed = isinstance(fileobj, str) or fileobj_closed(fileobj)\n\n        mode = FILE_MODES[fileobj_mode(fileobj)] if isfile(fileobj) else 'ostream'\n\n        # This can accept an open file object that's open to write only, or in\n        # append/update modes but only if the file doesn't exist.\n        fileobj = _File(fileobj, mode=mode, overwrite=overwrite)\n        hdulist = self.fromfile(fileobj)\n        try:\n            dirname = os.path.dirname(hdulist._file.name)\n        except (AttributeError, TypeError):\n            dirname = None\n\n        with _free_space_check(self, dirname=dirname):\n            for hdu in self:\n                hdu._prewriteto(checksum=checksum)\n                hdu._writeto(hdulist._file)\n                hdu._postwriteto()\n        hdulist.close(output_verify=output_verify, closed=closed)\n\n    def close(self, output_verify='exception', verbose=False, closed=True):\n        \"\"\"\n        Close the associated FITS file and memmap object, if any.\n\n        Parameters\n        ----------\n        output_verify : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        verbose : bool\n            When `True`, print out verbose messages.\n\n        closed : bool\n            When `True`, close the underlying file object.\n        \"\"\"\n\n        try:\n            if (self._file and self._file.mode in ('append', 'update')\n                    and not self._file.closed):\n                self.flush(output_verify=output_verify, verbose=verbose)\n        finally:\n            if self._file and closed and hasattr(self._file, 'close'):\n                self._file.close()\n\n            # Give individual HDUs an opportunity to do on-close cleanup\n            for hdu in self:\n                hdu._close(closed=closed)\n\n    def info(self, output=None):\n        \"\"\"\n        Summarize the info of the HDUs in this `HDUList`.\n\n        Note that this function prints its results to the console---it\n        does not return a value.\n\n        Parameters\n        ----------\n        output : file-like or bool, optional\n            A file-like object to write the output to.  If `False`, does not\n            output to a file and instead returns a list of tuples representing\n            the HDU info.  Writes to ``sys.stdout`` by default.\n        \"\"\"\n\n        if output is None:\n            output = sys.stdout\n\n        if self._file is None:\n            name = '(No file associated with this HDUList)'\n        else:\n            name = self._file.name\n\n        results = [f'Filename: {name}',\n                   'No.    Name      Ver    Type      Cards   Dimensions   Format']\n\n        format = '{:3d}  {:10}  {:3} {:11}  {:5d}   {}   {}   {}'\n        default = ('', '', '', 0, (), '', '')\n        for idx, hdu in enumerate(self):\n            summary = hdu._summary()\n            if len(summary) < len(default):\n                summary += default[len(summary):]\n            summary = (idx,) + summary\n            if output:\n                results.append(format.format(*summary))\n            else:\n                results.append(summary)\n\n        if output:\n            output.write('\\n'.join(results))\n            output.write('\\n')\n            output.flush()\n        else:\n            return results[2:]\n\n    def filename(self):\n        \"\"\"\n        Return the file name associated with the HDUList object if one exists.\n        Otherwise returns None.\n\n        Returns\n        -------\n        filename : str\n            A string containing the file name associated with the HDUList\n            object if an association exists.  Otherwise returns None.\n\n        \"\"\"\n        if self._file is not None:\n            if hasattr(self._file, 'name'):\n                return self._file.name\n        return None\n\n    @classmethod\n    def _readfrom(cls, fileobj=None, data=None, mode=None, memmap=None,\n                  cache=True, lazy_load_hdus=True, ignore_missing_simple=False,\n                  **kwargs):\n        \"\"\"\n        Provides the implementations from HDUList.fromfile and\n        HDUList.fromstring, both of which wrap this method, as their\n        implementations are largely the same.\n        \"\"\"\n\n        if fileobj is not None:\n            if not isinstance(fileobj, _File):\n                # instantiate a FITS file object (ffo)\n                fileobj = _File(fileobj, mode=mode, memmap=memmap, cache=cache)\n            # The Astropy mode is determined by the _File initializer if the\n            # supplied mode was None\n            mode = fileobj.mode\n            hdulist = cls(file=fileobj)\n        else:\n            if mode is None:\n                # The default mode\n                mode = 'readonly'\n\n            hdulist = cls(file=data)\n            # This method is currently only called from HDUList.fromstring and\n            # HDUList.fromfile.  If fileobj is None then this must be the\n            # fromstring case; the data type of ``data`` will be checked in the\n            # _BaseHDU.fromstring call.\n\n        if (not ignore_missing_simple and\n                hdulist._file and\n                hdulist._file.mode != 'ostream' and\n                hdulist._file.size > 0):\n            pos = hdulist._file.tell()\n            # FITS signature is supposed to be in the first 30 bytes, but to\n            # allow reading various invalid files we will check in the first\n            # card (80 bytes).\n            simple = hdulist._file.read(80)\n            match_sig = (simple[:29] == FITS_SIGNATURE[:-1] and\n                         simple[29:30] in (b'T', b'F'))\n\n            if not match_sig:\n                # Check the SIMPLE card is there but not written correctly\n                match_sig_relaxed = re.match(rb\"SIMPLE\\s*=\\s*[T|F]\", simple)\n\n                if match_sig_relaxed:\n                    warnings.warn(\"Found a SIMPLE card but its format doesn't\"\n                                  \" respect the FITS Standard\", VerifyWarning)\n                else:\n                    if hdulist._file.close_on_error:\n                        hdulist._file.close()\n                    raise OSError(\n                        'No SIMPLE card found, this file does not appear to '\n                        'be a valid FITS file. If this is really a FITS file, '\n                        'try with ignore_missing_simple=True')\n\n            hdulist._file.seek(pos)\n\n        # Store additional keyword args that were passed to fits.open\n        hdulist._open_kwargs = kwargs\n\n        if fileobj is not None and fileobj.writeonly:\n            # Output stream--not interested in reading/parsing\n            # the HDUs--just writing to the output file\n            return hdulist\n\n        # Make sure at least the PRIMARY HDU can be read\n        read_one = hdulist._read_next_hdu()\n\n        # If we're trying to read only and no header units were found,\n        # raise an exception\n        if not read_one and mode in ('readonly', 'denywrite'):\n            # Close the file if necessary (issue #6168)\n            if hdulist._file.close_on_error:\n                hdulist._file.close()\n\n            raise OSError('Empty or corrupt FITS file')\n\n        if not lazy_load_hdus or kwargs.get('checksum') is True:\n            # Go ahead and load all HDUs\n            while hdulist._read_next_hdu():\n                pass\n\n        # initialize/reset attributes to be used in \"update/append\" mode\n        hdulist._resize = False\n        hdulist._truncate = False\n\n        return hdulist\n\n    def _try_while_unread_hdus(self, func, *args, **kwargs):\n        \"\"\"\n        Attempt an operation that accesses an HDU by index/name\n        that can fail if not all HDUs have been read yet.  Keep\n        reading HDUs until the operation succeeds or there are no\n        more HDUs to read.\n        \"\"\"\n\n        while True:\n            try:\n                return func(*args, **kwargs)\n            except Exception:\n                if self._read_next_hdu():\n                    continue\n                else:\n                    raise\n\n    def _read_next_hdu(self):\n        \"\"\"\n        Lazily load a single HDU from the fileobj or data string the `HDUList`\n        was opened from, unless no further HDUs are found.\n\n        Returns True if a new HDU was loaded, or False otherwise.\n        \"\"\"\n\n        if self._read_all:\n            return False\n\n        saved_compression_enabled = compressed.COMPRESSION_ENABLED\n        fileobj, data, kwargs = self._file, self._data, self._open_kwargs\n\n        if fileobj is not None and fileobj.closed:\n            return False\n\n        try:\n            self._in_read_next_hdu = True\n\n            if ('disable_image_compression' in kwargs and\n                    kwargs['disable_image_compression']):\n                compressed.COMPRESSION_ENABLED = False\n\n            # read all HDUs\n            try:\n                if fileobj is not None:\n                    try:\n                        # Make sure we're back to the end of the last read\n                        # HDU\n                        if len(self) > 0:\n                            last = self[len(self) - 1]\n                            if last._data_offset is not None:\n                                offset = last._data_offset + last._data_size\n                                fileobj.seek(offset, os.SEEK_SET)\n\n                        hdu = _BaseHDU.readfrom(fileobj, **kwargs)\n                    except EOFError:\n                        self._read_all = True\n                        return False\n                    except OSError:\n                        # Close the file: see\n                        # https://github.com/astropy/astropy/issues/6168\n                        #\n                        if self._file.close_on_error:\n                            self._file.close()\n\n                        if fileobj.writeonly:\n                            self._read_all = True\n                            return False\n                        else:\n                            raise\n                else:\n                    if not data:\n                        self._read_all = True\n                        return False\n                    hdu = _BaseHDU.fromstring(data, **kwargs)\n                    self._data = data[hdu._data_offset + hdu._data_size:]\n\n                super().append(hdu)\n                if len(self) == 1:\n                    # Check for an extension HDU and update the EXTEND\n                    # keyword of the primary HDU accordingly\n                    self.update_extend()\n\n                hdu._new = False\n                if 'checksum' in kwargs:\n                    hdu._output_checksum = kwargs['checksum']\n            # check in the case there is extra space after the last HDU or\n            # corrupted HDU\n            except (VerifyError, ValueError) as exc:\n                warnings.warn(\n                    'Error validating header for HDU #{} (note: Astropy '\n                    'uses zero-based indexing).\\n{}\\n'\n                    'There may be extra bytes after the last HDU or the '\n                    'file is corrupted.'.format(\n                        len(self), indent(str(exc))), VerifyWarning)\n                del exc\n                self._read_all = True\n                return False\n        finally:\n            compressed.COMPRESSION_ENABLED = saved_compression_enabled\n            self._in_read_next_hdu = False\n\n        return True\n\n    def _verify(self, option='warn'):\n        errs = _ErrList([], unit='HDU')\n\n        # the first (0th) element must be a primary HDU\n        if len(self) > 0 and (not isinstance(self[0], PrimaryHDU)) and \\\n                             (not isinstance(self[0], _NonstandardHDU)):\n            err_text = \"HDUList's 0th element is not a primary HDU.\"\n            fix_text = 'Fixed by inserting one as 0th HDU.'\n\n            def fix(self=self):\n                self.insert(0, PrimaryHDU())\n\n            err = self.run_option(option, err_text=err_text,\n                                  fix_text=fix_text, fix=fix)\n            errs.append(err)\n\n        if len(self) > 1 and ('EXTEND' not in self[0].header or\n                              self[0].header['EXTEND'] is not True):\n            err_text = ('Primary HDU does not contain an EXTEND keyword '\n                        'equal to T even though there are extension HDUs.')\n            fix_text = 'Fixed by inserting or updating the EXTEND keyword.'\n\n            def fix(header=self[0].header):\n                naxis = header['NAXIS']\n                if naxis == 0:\n                    after = 'NAXIS'\n                else:\n                    after = 'NAXIS' + str(naxis)\n                header.set('EXTEND', value=True, after=after)\n\n            errs.append(self.run_option(option, err_text=err_text,\n                                        fix_text=fix_text, fix=fix))\n\n        # each element calls their own verify\n        for idx, hdu in enumerate(self):\n            if idx > 0 and (not isinstance(hdu, ExtensionHDU)):\n                err_text = f\"HDUList's element {str(idx)} is not an extension HDU.\"\n\n                err = self.run_option(option, err_text=err_text, fixable=False)\n                errs.append(err)\n\n            else:\n                result = hdu._verify(option)\n                if result:\n                    errs.append(result)\n        return errs\n\n    def _flush_update(self):\n        \"\"\"Implements flushing changes to a file in update mode.\"\"\"\n\n        for hdu in self:\n            # Need to all _prewriteto() for each HDU first to determine if\n            # resizing will be necessary\n            hdu._prewriteto(checksum=hdu._output_checksum, inplace=True)\n\n        try:\n            self._wasresized()\n\n            # if the HDUList is resized, need to write out the entire contents of\n            # the hdulist to the file.\n            if self._resize or self._file.compression:\n                self._flush_resize()\n            else:\n                # if not resized, update in place\n                for hdu in self:\n                    hdu._writeto(self._file, inplace=True)\n\n            # reset the modification attributes after updating\n            for hdu in self:\n                hdu._header._modified = False\n        finally:\n            for hdu in self:\n                hdu._postwriteto()\n\n    def _flush_resize(self):\n        \"\"\"\n        Implements flushing changes in update mode when parts of one or more HDU\n        need to be resized.\n        \"\"\"\n\n        old_name = self._file.name\n        old_memmap = self._file.memmap\n        name = _tmp_name(old_name)\n\n        if not self._file.file_like:\n            old_mode = os.stat(old_name).st_mode\n            # The underlying file is an actual file object.  The HDUList is\n            # resized, so we need to write it to a tmp file, delete the\n            # original file, and rename the tmp file to the original file.\n            if self._file.compression == 'gzip':\n                new_file = gzip.GzipFile(name, mode='ab+')\n            elif self._file.compression == 'bzip2':\n                if not HAS_BZ2:\n                    raise ModuleNotFoundError(\n                        \"This Python installation does not provide the bz2 module.\")\n                new_file = bz2.BZ2File(name, mode='w')\n            else:\n                new_file = name\n\n            with self.fromfile(new_file, mode='append') as hdulist:\n\n                for hdu in self:\n                    hdu._writeto(hdulist._file, inplace=True, copy=True)\n                if sys.platform.startswith('win'):\n                    # Collect a list of open mmaps to the data; this well be\n                    # used later.  See below.\n                    mmaps = [(idx, _get_array_mmap(hdu.data), hdu.data)\n                             for idx, hdu in enumerate(self) if hdu._has_data]\n\n                hdulist._file.close()\n                self._file.close()\n            if sys.platform.startswith('win'):\n                # Close all open mmaps to the data.  This is only necessary on\n                # Windows, which will not allow a file to be renamed or deleted\n                # until all handles to that file have been closed.\n                for idx, mmap, arr in mmaps:\n                    if mmap is not None:\n                        mmap.close()\n\n            os.remove(self._file.name)\n\n            # reopen the renamed new file with \"update\" mode\n            os.rename(name, old_name)\n            os.chmod(old_name, old_mode)\n\n            if isinstance(new_file, gzip.GzipFile):\n                old_file = gzip.GzipFile(old_name, mode='rb+')\n            else:\n                old_file = old_name\n\n            ffo = _File(old_file, mode='update', memmap=old_memmap)\n\n            self._file = ffo\n\n            for hdu in self:\n                # Need to update the _file attribute and close any open mmaps\n                # on each HDU\n                if hdu._has_data and _get_array_mmap(hdu.data) is not None:\n                    del hdu.data\n                hdu._file = ffo\n\n            if sys.platform.startswith('win'):\n                # On Windows, all the original data mmaps were closed above.\n                # However, it's possible that the user still has references to\n                # the old data which would no longer work (possibly even cause\n                # a segfault if they try to access it).  This replaces the\n                # buffers used by the original arrays with the buffers of mmap\n                # arrays created from the new file.  This seems to work, but\n                # it's a flaming hack and carries no guarantees that it won't\n                # lead to odd behavior in practice.  Better to just not keep\n                # references to data from files that had to be resized upon\n                # flushing (on Windows--again, this is no problem on Linux).\n                for idx, mmap, arr in mmaps:\n                    if mmap is not None:\n                        # https://github.com/numpy/numpy/issues/8628\n                        with warnings.catch_warnings():\n                            warnings.simplefilter('ignore', category=DeprecationWarning)\n                            arr.data = self[idx].data.data\n                del mmaps  # Just to be sure\n\n        else:\n            # The underlying file is not a file object, it is a file like\n            # object.  We can't write out to a file, we must update the file\n            # like object in place.  To do this, we write out to a temporary\n            # file, then delete the contents in our file like object, then\n            # write the contents of the temporary file to the now empty file\n            # like object.\n            self.writeto(name)\n            hdulist = self.fromfile(name)\n            ffo = self._file\n\n            ffo.truncate(0)\n            ffo.seek(0)\n\n            for hdu in hdulist:\n                hdu._writeto(ffo, inplace=True, copy=True)\n\n            # Close the temporary file and delete it.\n            hdulist.close()\n            os.remove(hdulist._file.name)\n\n        # reset the resize attributes after updating\n        self._resize = False\n        self._truncate = False\n        for hdu in self:\n            hdu._header._modified = False\n            hdu._new = False\n            hdu._file = ffo\n\n    def _wasresized(self, verbose=False):\n        \"\"\"\n        Determine if any changes to the HDUList will require a file resize\n        when flushing the file.\n\n        Side effect of setting the objects _resize attribute.\n        \"\"\"\n\n        if not self._resize:\n\n            # determine if any of the HDU is resized\n            for hdu in self:\n                # Header:\n                nbytes = len(str(hdu._header))\n                if nbytes != (hdu._data_offset - hdu._header_offset):\n                    self._resize = True\n                    self._truncate = False\n                    if verbose:\n                        print('One or more header is resized.')\n                    break\n\n                # Data:\n                if not hdu._has_data:\n                    continue\n\n                nbytes = hdu.size\n                nbytes = nbytes + _pad_length(nbytes)\n                if nbytes != hdu._data_size:\n                    self._resize = True\n                    self._truncate = False\n                    if verbose:\n                        print('One or more data area is resized.')\n                    break\n\n            if self._truncate:\n                try:\n                    self._file.truncate(hdu._data_offset + hdu._data_size)\n                except OSError:\n                    self._resize = True\n                self._truncate = False\n\n        return self._resize\n"},{"className":"_BaseHDU","col":0,"comment":"Base class for all HDU (header data unit) classes.","endLoc":755,"id":1780,"nodeType":"Class","startLoc":111,"text":"class _BaseHDU:\n    \"\"\"Base class for all HDU (header data unit) classes.\"\"\"\n\n    _hdu_registry = set()\n\n    # This HDU type is part of the FITS standard\n    _standard = True\n\n    # Byte to use for padding out blocks\n    _padding_byte = '\\x00'\n\n    _default_name = ''\n\n    # _header uses a descriptor to delay the loading of the fits.Header object\n    # until it is necessary.\n    _header = _DelayedHeader()\n\n    def __init__(self, data=None, header=None, *args, **kwargs):\n        if header is None:\n            header = Header()\n        self._header = header\n        self._header_str = None\n        self._file = None\n        self._buffer = None\n        self._header_offset = None\n        self._data_offset = None\n        self._data_size = None\n\n        # This internal variable is used to track whether the data attribute\n        # still points to the same data array as when the HDU was originally\n        # created (this does not track whether the data is actually the same\n        # content-wise)\n        self._data_replaced = False\n        self._data_needs_rescale = False\n        self._new = True\n        self._output_checksum = False\n\n        if 'DATASUM' in self._header and 'CHECKSUM' not in self._header:\n            self._output_checksum = 'datasum'\n        elif 'CHECKSUM' in self._header:\n            self._output_checksum = True\n\n    def __init_subclass__(cls, **kwargs):\n        # Add the same data.deleter to all HDUs with a data property.\n        # It's unfortunate, but there's otherwise no straightforward way\n        # that a property can inherit setters/deleters of the property of the\n        # same name on base classes.\n        data_prop = cls.__dict__.get('data', None)\n        if (isinstance(data_prop, (lazyproperty, property))\n                and data_prop.fdel is None):\n            # Don't do anything if the class has already explicitly\n            # set the deleter for its data property\n            def data(self):\n                # The deleter\n                if self._file is not None and self._data_loaded:\n                    data_refcount = sys.getrefcount(self.data)\n                    # Manually delete *now* so that FITS_rec.__del__\n                    # cleanup can happen if applicable\n                    del self.__dict__['data']\n                    # Don't even do this unless the *only* reference to the\n                    # .data array was the one we're deleting by deleting\n                    # this attribute; if any other references to the array\n                    # are hanging around (perhaps the user ran ``data =\n                    # hdu.data``) don't even consider this:\n                    if data_refcount == 2:\n                        self._file._maybe_close_mmap()\n\n            setattr(cls, 'data', data_prop.deleter(data))\n\n        return super().__init_subclass__(**kwargs)\n\n    @property\n    def header(self):\n        return self._header\n\n    @header.setter\n    def header(self, value):\n        self._header = value\n\n    @property\n    def name(self):\n        # Convert the value to a string to be flexible in some pathological\n        # cases (see ticket #96)\n        return str(self._header.get('EXTNAME', self._default_name))\n\n    @name.setter\n    def name(self, value):\n        if not isinstance(value, str):\n            raise TypeError(\"'name' attribute must be a string\")\n        if not conf.extension_name_case_sensitive:\n            value = value.upper()\n        if 'EXTNAME' in self._header:\n            self._header['EXTNAME'] = value\n        else:\n            self._header['EXTNAME'] = (value, 'extension name')\n\n    @property\n    def ver(self):\n        return self._header.get('EXTVER', 1)\n\n    @ver.setter\n    def ver(self, value):\n        if not _is_int(value):\n            raise TypeError(\"'ver' attribute must be an integer\")\n        if 'EXTVER' in self._header:\n            self._header['EXTVER'] = value\n        else:\n            self._header['EXTVER'] = (value, 'extension value')\n\n    @property\n    def level(self):\n        return self._header.get('EXTLEVEL', 1)\n\n    @level.setter\n    def level(self, value):\n        if not _is_int(value):\n            raise TypeError(\"'level' attribute must be an integer\")\n        if 'EXTLEVEL' in self._header:\n            self._header['EXTLEVEL'] = value\n        else:\n            self._header['EXTLEVEL'] = (value, 'extension level')\n\n    @property\n    def is_image(self):\n        return (\n            self.name == 'PRIMARY' or\n            ('XTENSION' in self._header and\n             (self._header['XTENSION'] == 'IMAGE' or\n              (self._header['XTENSION'] == 'BINTABLE' and\n               'ZIMAGE' in self._header and self._header['ZIMAGE'] is True))))\n\n    @property\n    def _data_loaded(self):\n        return ('data' in self.__dict__ and self.data is not DELAYED)\n\n    @property\n    def _has_data(self):\n        return self._data_loaded and self.data is not None\n\n    @classmethod\n    def register_hdu(cls, hducls):\n        cls._hdu_registry.add(hducls)\n\n    @classmethod\n    def unregister_hdu(cls, hducls):\n        if hducls in cls._hdu_registry:\n            cls._hdu_registry.remove(hducls)\n\n    @classmethod\n    def match_header(cls, header):\n        raise NotImplementedError\n\n    @classmethod\n    def fromstring(cls, data, checksum=False, ignore_missing_end=False,\n                   **kwargs):\n        \"\"\"\n        Creates a new HDU object of the appropriate type from a string\n        containing the HDU's entire header and, optionally, its data.\n\n        Note: When creating a new HDU from a string without a backing file\n        object, the data of that HDU may be read-only.  It depends on whether\n        the underlying string was an immutable Python str/bytes object, or some\n        kind of read-write memory buffer such as a `memoryview`.\n\n        Parameters\n        ----------\n        data : str, bytearray, memoryview, ndarray\n            A byte string containing the HDU's header and data.\n\n        checksum : bool, optional\n            Check the HDU's checksum and/or datasum.\n\n        ignore_missing_end : bool, optional\n            Ignore a missing end card in the header data.  Note that without the\n            end card the end of the header may be ambiguous and resulted in a\n            corrupt HDU.  In this case the assumption is that the first 2880\n            block that does not begin with valid FITS header data is the\n            beginning of the data.\n\n        **kwargs : optional\n            May consist of additional keyword arguments specific to an HDU\n            type--these correspond to keywords recognized by the constructors of\n            different HDU classes such as `PrimaryHDU`, `ImageHDU`, or\n            `BinTableHDU`.  Any unrecognized keyword arguments are simply\n            ignored.\n        \"\"\"\n\n        return cls._readfrom_internal(data, checksum=checksum,\n                                      ignore_missing_end=ignore_missing_end,\n                                      **kwargs)\n\n    @classmethod\n    def readfrom(cls, fileobj, checksum=False, ignore_missing_end=False,\n                 **kwargs):\n        \"\"\"\n        Read the HDU from a file.  Normally an HDU should be opened with\n        :func:`open` which reads the entire HDU list in a FITS file.  But this\n        method is still provided for symmetry with :func:`writeto`.\n\n        Parameters\n        ----------\n        fileobj : file-like\n            Input FITS file.  The file's seek pointer is assumed to be at the\n            beginning of the HDU.\n\n        checksum : bool\n            If `True`, verifies that both ``DATASUM`` and ``CHECKSUM`` card\n            values (when present in the HDU header) match the header and data\n            of all HDU's in the file.\n\n        ignore_missing_end : bool\n            Do not issue an exception when opening a file that is missing an\n            ``END`` card in the last header.\n        \"\"\"\n\n        # TODO: Figure out a way to make it possible for the _File\n        # constructor to be a noop if the argument is already a _File\n        if not isinstance(fileobj, _File):\n            fileobj = _File(fileobj)\n\n        hdu = cls._readfrom_internal(fileobj, checksum=checksum,\n                                     ignore_missing_end=ignore_missing_end,\n                                     **kwargs)\n\n        # If the checksum had to be checked the data may have already been read\n        # from the file, in which case we don't want to seek relative\n        fileobj.seek(hdu._data_offset + hdu._data_size, os.SEEK_SET)\n        return hdu\n\n    def writeto(self, name, output_verify='exception', overwrite=False,\n                checksum=False):\n        \"\"\"\n        Write the HDU to a new file. This is a convenience method to\n        provide a user easier output interface if only one HDU needs\n        to be written to a file.\n\n        Parameters\n        ----------\n        name : path-like or file-like\n            Output FITS file.  If the file object is already opened, it must\n            be opened in a writeable mode.\n\n        output_verify : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n\n        checksum : bool\n            When `True` adds both ``DATASUM`` and ``CHECKSUM`` cards\n            to the header of the HDU when written to the file.\n        \"\"\"\n\n        from .hdulist import HDUList\n\n        hdulist = HDUList([self])\n        hdulist.writeto(name, output_verify, overwrite=overwrite,\n                        checksum=checksum)\n\n    @classmethod\n    def _from_data(cls, data, header, **kwargs):\n        \"\"\"\n        Instantiate the HDU object after guessing the HDU class from the\n        FITS Header.\n        \"\"\"\n        klass = _hdu_class_from_header(cls, header)\n        return klass(data=data, header=header, **kwargs)\n\n    @classmethod\n    def _readfrom_internal(cls, data, header=None, checksum=False,\n                           ignore_missing_end=False, **kwargs):\n        \"\"\"\n        Provides the bulk of the internal implementation for readfrom and\n        fromstring.\n\n        For some special cases, supports using a header that was already\n        created, and just using the input data for the actual array data.\n        \"\"\"\n\n        hdu_buffer = None\n        hdu_fileobj = None\n        header_offset = 0\n\n        if isinstance(data, _File):\n            if header is None:\n                header_offset = data.tell()\n                try:\n                    # First we try to read the header with the fast parser\n                    # from _BasicHeader, which will read only the standard\n                    # 8 character keywords to get the structural keywords\n                    # that are needed to build the HDU object.\n                    header_str, header = _BasicHeader.fromfile(data)\n                except Exception:\n                    # If the fast header parsing failed, then fallback to\n                    # the classic Header parser, which has better support\n                    # and reporting for the various issues that can be found\n                    # in the wild.\n                    data.seek(header_offset)\n                    header = Header.fromfile(data,\n                                             endcard=not ignore_missing_end)\n            hdu_fileobj = data\n            data_offset = data.tell()  # *after* reading the header\n        else:\n            try:\n                # Test that the given object supports the buffer interface by\n                # ensuring an ndarray can be created from it\n                np.ndarray((), dtype='ubyte', buffer=data)\n            except TypeError:\n                raise TypeError(\n                    'The provided object {!r} does not contain an underlying '\n                    'memory buffer.  fromstring() requires an object that '\n                    'supports the buffer interface such as bytes, buffer, '\n                    'memoryview, ndarray, etc.  This restriction is to ensure '\n                    'that efficient access to the array/table data is possible.'\n                    .format(data))\n\n            if header is None:\n                def block_iter(nbytes):\n                    idx = 0\n                    while idx < len(data):\n                        yield data[idx:idx + nbytes]\n                        idx += nbytes\n\n                header_str, header = Header._from_blocks(\n                    block_iter, True, '', not ignore_missing_end, True)\n\n                if len(data) > len(header_str):\n                    hdu_buffer = data\n            elif data:\n                hdu_buffer = data\n\n            header_offset = 0\n            data_offset = len(header_str)\n\n        # Determine the appropriate arguments to pass to the constructor from\n        # self._kwargs.  self._kwargs contains any number of optional arguments\n        # that may or may not be valid depending on the HDU type\n        cls = _hdu_class_from_header(cls, header)\n        sig = signature(cls.__init__)\n        new_kwargs = kwargs.copy()\n        if Parameter.VAR_KEYWORD not in (x.kind for x in sig.parameters.values()):\n            # If __init__ accepts arbitrary keyword arguments, then we can go\n            # ahead and pass all keyword arguments; otherwise we need to delete\n            # any that are invalid\n            for key in kwargs:\n                if key not in sig.parameters:\n                    del new_kwargs[key]\n\n        try:\n            hdu = cls(data=DELAYED, header=header, **new_kwargs)\n        except TypeError:\n            # This may happen because some HDU class (e.g. GroupsHDU) wants\n            # to set a keyword on the header, which is not possible with the\n            # _BasicHeader. While HDU classes should not need to modify the\n            # header in general, sometimes this is needed to fix it. So in\n            # this case we build a full Header and try again to create the\n            # HDU object.\n            if isinstance(header, _BasicHeader):\n                header = Header.fromstring(header_str)\n                hdu = cls(data=DELAYED, header=header, **new_kwargs)\n            else:\n                raise\n\n        # One of these may be None, depending on whether the data came from a\n        # file or a string buffer--later this will be further abstracted\n        hdu._file = hdu_fileobj\n        hdu._buffer = hdu_buffer\n\n        hdu._header_offset = header_offset     # beginning of the header area\n        hdu._data_offset = data_offset         # beginning of the data area\n\n        # data area size, including padding\n        size = hdu.size\n        hdu._data_size = size + _pad_length(size)\n\n        if isinstance(hdu._header, _BasicHeader):\n            # Delete the temporary _BasicHeader.\n            # We need to do this before an eventual checksum computation,\n            # since it needs to modify temporarily the header\n            #\n            # The header string is stored in the HDU._header_str attribute,\n            # so that it can be used directly when we need to create the\n            # classic Header object, without having to parse again the file.\n            del hdu._header\n            hdu._header_str = header_str\n\n        # Checksums are not checked on invalid HDU types\n        if checksum and checksum != 'remove' and isinstance(hdu, _ValidHDU):\n            hdu._verify_checksum_datasum()\n\n        return hdu\n\n    def _get_raw_data(self, shape, code, offset):\n        \"\"\"\n        Return raw array from either the HDU's memory buffer or underlying\n        file.\n        \"\"\"\n\n        if isinstance(shape, int):\n            shape = (shape,)\n\n        if self._buffer:\n            return np.ndarray(shape, dtype=code, buffer=self._buffer,\n                              offset=offset)\n        elif self._file:\n            return self._file.readarray(offset=offset, dtype=code, shape=shape)\n        else:\n            return None\n\n    # TODO: Rework checksum handling so that it's not necessary to add a\n    # checksum argument here\n    # TODO: The BaseHDU class shouldn't even handle checksums since they're\n    # only implemented on _ValidHDU...\n    def _prewriteto(self, checksum=False, inplace=False):\n        self._update_pseudo_int_scale_keywords()\n\n        # Handle checksum\n        self._update_checksum(checksum)\n\n    def _update_pseudo_int_scale_keywords(self):\n        \"\"\"\n        If the data is signed int 8, unsigned int 16, 32, or 64,\n        add BSCALE/BZERO cards to header.\n        \"\"\"\n\n        if (self._has_data and self._standard and\n                _is_pseudo_integer(self.data.dtype)):\n            # CompImageHDUs need TFIELDS immediately after GCOUNT,\n            # so BSCALE has to go after TFIELDS if it exists.\n            if 'TFIELDS' in self._header:\n                self._header.set('BSCALE', 1, after='TFIELDS')\n            elif 'GCOUNT' in self._header:\n                self._header.set('BSCALE', 1, after='GCOUNT')\n            else:\n                self._header.set('BSCALE', 1)\n            self._header.set('BZERO', _pseudo_zero(self.data.dtype),\n                             after='BSCALE')\n\n    def _update_checksum(self, checksum, checksum_keyword='CHECKSUM',\n                         datasum_keyword='DATASUM'):\n        \"\"\"Update the 'CHECKSUM' and 'DATASUM' keywords in the header (or\n        keywords with equivalent semantics given by the ``checksum_keyword``\n        and ``datasum_keyword`` arguments--see for example ``CompImageHDU``\n        for an example of why this might need to be overridden).\n        \"\"\"\n\n        # If the data is loaded it isn't necessarily 'modified', but we have no\n        # way of knowing for sure\n        modified = self._header._modified or self._data_loaded\n\n        if checksum == 'remove':\n            if checksum_keyword in self._header:\n                del self._header[checksum_keyword]\n\n            if datasum_keyword in self._header:\n                del self._header[datasum_keyword]\n        elif (modified or self._new or\n                (checksum and ('CHECKSUM' not in self._header or\n                               'DATASUM' not in self._header or\n                               not self._checksum_valid or\n                               not self._datasum_valid))):\n            if checksum == 'datasum':\n                self.add_datasum(datasum_keyword=datasum_keyword)\n            elif checksum:\n                self.add_checksum(checksum_keyword=checksum_keyword,\n                                  datasum_keyword=datasum_keyword)\n\n    def _postwriteto(self):\n        # If data is unsigned integer 16, 32 or 64, remove the\n        # BSCALE/BZERO cards\n        if (self._has_data and self._standard and\n                _is_pseudo_integer(self.data.dtype)):\n            for keyword in ('BSCALE', 'BZERO'):\n                with suppress(KeyError):\n                    del self._header[keyword]\n\n    def _writeheader(self, fileobj):\n        offset = 0\n        with suppress(AttributeError, OSError):\n            offset = fileobj.tell()\n\n        self._header.tofile(fileobj)\n\n        try:\n            size = fileobj.tell() - offset\n        except (AttributeError, OSError):\n            size = len(str(self._header))\n\n        return offset, size\n\n    def _writedata(self, fileobj):\n        size = 0\n        fileobj.flush()\n        try:\n            offset = fileobj.tell()\n        except (AttributeError, OSError):\n            offset = 0\n\n        if self._data_loaded or self._data_needs_rescale:\n            if self.data is not None:\n                size += self._writedata_internal(fileobj)\n            # pad the FITS data block\n            # to avoid a bug in the lustre filesystem client, don't\n            # write zero-byte objects\n            if size > 0 and _pad_length(size) > 0:\n                padding = _pad_length(size) * self._padding_byte\n                # TODO: Not that this is ever likely, but if for some odd\n                # reason _padding_byte is > 0x80 this will fail; but really if\n                # somebody's custom fits format is doing that, they're doing it\n                # wrong and should be reprimanded harshly.\n                fileobj.write(padding.encode('ascii'))\n                size += len(padding)\n        else:\n            # The data has not been modified or does not need need to be\n            # rescaled, so it can be copied, unmodified, directly from an\n            # existing file or buffer\n            size += self._writedata_direct_copy(fileobj)\n\n        # flush, to make sure the content is written\n        fileobj.flush()\n\n        # return both the location and the size of the data area\n        return offset, size\n\n    def _writedata_internal(self, fileobj):\n        \"\"\"\n        The beginning and end of most _writedata() implementations are the\n        same, but the details of writing the data array itself can vary between\n        HDU types, so that should be implemented in this method.\n\n        Should return the size in bytes of the data written.\n        \"\"\"\n\n        fileobj.writearray(self.data)\n        return self.data.size * self.data.itemsize\n\n    def _writedata_direct_copy(self, fileobj):\n        \"\"\"Copies the data directly from one file/buffer to the new file.\n\n        For now this is handled by loading the raw data from the existing data\n        (including any padding) via a memory map or from an already in-memory\n        buffer and using Numpy's existing file-writing facilities to write to\n        the new file.\n\n        If this proves too slow a more direct approach may be used.\n        \"\"\"\n        raw = self._get_raw_data(self._data_size, 'ubyte', self._data_offset)\n        if raw is not None:\n            fileobj.writearray(raw)\n            return raw.nbytes\n        else:\n            return 0\n\n    # TODO: This is the start of moving HDU writing out of the _File class;\n    # Though right now this is an internal private method (though still used by\n    # HDUList, eventually the plan is to have this be moved into writeto()\n    # somehow...\n    def _writeto(self, fileobj, inplace=False, copy=False):\n        try:\n            dirname = os.path.dirname(fileobj._file.name)\n        except (AttributeError, TypeError):\n            dirname = None\n\n        with _free_space_check(self, dirname):\n            self._writeto_internal(fileobj, inplace, copy)\n\n    def _writeto_internal(self, fileobj, inplace, copy):\n        # For now fileobj is assumed to be a _File object\n        if not inplace or self._new:\n            header_offset, _ = self._writeheader(fileobj)\n            data_offset, data_size = self._writedata(fileobj)\n\n            # Set the various data location attributes on newly-written HDUs\n            if self._new:\n                self._header_offset = header_offset\n                self._data_offset = data_offset\n                self._data_size = data_size\n            return\n\n        hdrloc = self._header_offset\n        hdrsize = self._data_offset - self._header_offset\n        datloc = self._data_offset\n        datsize = self._data_size\n\n        if self._header._modified:\n            # Seek to the original header location in the file\n            self._file.seek(hdrloc)\n            # This should update hdrloc with he header location in the new file\n            hdrloc, hdrsize = self._writeheader(fileobj)\n\n            # If the data is to be written below with self._writedata, that\n            # will also properly update the data location; but it should be\n            # updated here too\n            datloc = hdrloc + hdrsize\n        elif copy:\n            # Seek to the original header location in the file\n            self._file.seek(hdrloc)\n            # Before writing, update the hdrloc with the current file position,\n            # which is the hdrloc for the new file\n            hdrloc = fileobj.tell()\n            fileobj.write(self._file.read(hdrsize))\n            # The header size is unchanged, but the data location may be\n            # different from before depending on if previous HDUs were resized\n            datloc = fileobj.tell()\n\n        if self._data_loaded:\n            if self.data is not None:\n                # Seek through the array's bases for an memmap'd array; we\n                # can't rely on the _File object to give us this info since\n                # the user may have replaced the previous mmap'd array\n                if copy or self._data_replaced:\n                    # Of course, if we're copying the data to a new file\n                    # we don't care about flushing the original mmap;\n                    # instead just read it into the new file\n                    array_mmap = None\n                else:\n                    array_mmap = _get_array_mmap(self.data)\n\n                if array_mmap is not None:\n                    array_mmap.flush()\n                else:\n                    self._file.seek(self._data_offset)\n                    datloc, datsize = self._writedata(fileobj)\n        elif copy:\n            datsize = self._writedata_direct_copy(fileobj)\n\n        self._header_offset = hdrloc\n        self._data_offset = datloc\n        self._data_size = datsize\n        self._data_replaced = False\n\n    def _close(self, closed=True):\n        # If the data was mmap'd, close the underlying mmap (this will\n        # prevent any future access to the .data attribute if there are\n        # not other references to it; if there are other references then\n        # it is up to the user to clean those up\n        if (closed and self._data_loaded and\n                _get_array_mmap(self.data) is not None):\n            del self.data"},{"col":4,"comment":"null","endLoc":355,"header":"def _diff(self)","id":1781,"name":"_diff","nodeType":"Function","startLoc":318,"text":"def _diff(self):\n        if len(self.a) != len(self.b):\n            self.diff_hdu_count = (len(self.a), len(self.b))\n\n        # Record filenames for use later in _report\n        self.filenamea = self.a.filename()\n        if not self.filenamea:\n            self.filenamea = f'<{self.a.__class__.__name__} object at {id(self.a):#x}>'\n\n        self.filenameb = self.b.filename()\n        if not self.filenameb:\n            self.filenameb = f'<{self.b.__class__.__name__} object at {id(self.b):#x}>'\n\n        if self.ignore_hdus:\n            self.a = HDUList([h for h in self.a if h.name not in self.ignore_hdus])\n            self.b = HDUList([h for h in self.b if h.name not in self.ignore_hdus])\n        if self.ignore_hdu_patterns:\n            a_names = [hdu.name for hdu in self.a]\n            b_names = [hdu.name for hdu in self.b]\n            for pattern in self.ignore_hdu_patterns:\n                self.a = HDUList([h for h in self.a if h.name not in fnmatch.filter(\n                    a_names, pattern)])\n                self.b = HDUList([h for h in self.b if h.name not in fnmatch.filter(\n                    b_names, pattern)])\n\n        # For now, just compare the extensions one by one in order.\n        # Might allow some more sophisticated types of diffing later.\n\n        # TODO: Somehow or another simplify the passing around of diff\n        # options--this will become important as the number of options grows\n        for idx in range(min(len(self.a), len(self.b))):\n            hdu_diff = HDUDiff.fromdiff(self, self.a[idx], self.b[idx])\n\n            if not hdu_diff.identical:\n                if self.a[idx].name == self.b[idx].name and self.a[idx].ver == self.b[idx].ver:\n                    self.diff_hdus.append((idx, hdu_diff, self.a[idx].name, self.a[idx].ver))\n                else:\n                    self.diff_hdus.append((idx, hdu_diff, \"\", self.a[idx].ver))"},{"col":4,"comment":"null","endLoc":180,"header":"def __init_subclass__(cls, **kwargs)","id":1782,"name":"__init_subclass__","nodeType":"Function","startLoc":153,"text":"def __init_subclass__(cls, **kwargs):\n        # Add the same data.deleter to all HDUs with a data property.\n        # It's unfortunate, but there's otherwise no straightforward way\n        # that a property can inherit setters/deleters of the property of the\n        # same name on base classes.\n        data_prop = cls.__dict__.get('data', None)\n        if (isinstance(data_prop, (lazyproperty, property))\n                and data_prop.fdel is None):\n            # Don't do anything if the class has already explicitly\n            # set the deleter for its data property\n            def data(self):\n                # The deleter\n                if self._file is not None and self._data_loaded:\n                    data_refcount = sys.getrefcount(self.data)\n                    # Manually delete *now* so that FITS_rec.__del__\n                    # cleanup can happen if applicable\n                    del self.__dict__['data']\n                    # Don't even do this unless the *only* reference to the\n                    # .data array was the one we're deleting by deleting\n                    # this attribute; if any other references to the array\n                    # are hanging around (perhaps the user ran ``data =\n                    # hdu.data``) don't even consider this:\n                    if data_refcount == 2:\n                        self._file._maybe_close_mmap()\n\n            setattr(cls, 'data', data_prop.deleter(data))\n\n        return super().__init_subclass__(**kwargs)"},{"col":4,"comment":"null","endLoc":184,"header":"@property\n    def header(self)","id":1783,"name":"header","nodeType":"Function","startLoc":182,"text":"@property\n    def header(self):\n        return self._header"},{"col":4,"comment":"null","endLoc":188,"header":"@header.setter\n    def header(self, value)","id":1784,"name":"header","nodeType":"Function","startLoc":186,"text":"@header.setter\n    def header(self, value):\n        self._header = value"},{"col":4,"comment":"null","endLoc":194,"header":"@property\n    def name(self)","id":1785,"name":"name","nodeType":"Function","startLoc":190,"text":"@property\n    def name(self):\n        # Convert the value to a string to be flexible in some pathological\n        # cases (see ticket #96)\n        return str(self._header.get('EXTNAME', self._default_name))"},{"col":4,"comment":"Wrap a numpy function that processes self, returning a Quantity.\n\n        Parameters\n        ----------\n        function : callable\n            Numpy function to wrap.\n        args : positional arguments\n            Any positional arguments to the function beyond the first argument\n            (which will be set to ``self``).\n        kwargs : keyword arguments\n            Keyword arguments to the function.\n\n        If present, the following arguments are treated specially:\n\n        unit : `~astropy.units.Unit`\n            Unit of the output result.  If not given, the unit of ``self``.\n        out : `~astropy.units.Quantity`\n            A Quantity instance in which to store the output.\n\n        Notes\n        -----\n        Output should always be assigned via a keyword argument, otherwise\n        no proper account of the unit is taken.\n\n        Returns\n        -------\n        out : `~astropy.units.Quantity`\n            Result of the function call, with the unit set properly.\n        ","endLoc":1779,"header":"def _wrap_function(self, function, *args, unit=None, out=None, **kwargs)","id":1786,"name":"_wrap_function","nodeType":"Function","startLoc":1737,"text":"def _wrap_function(self, function, *args, unit=None, out=None, **kwargs):\n        \"\"\"Wrap a numpy function that processes self, returning a Quantity.\n\n        Parameters\n        ----------\n        function : callable\n            Numpy function to wrap.\n        args : positional arguments\n            Any positional arguments to the function beyond the first argument\n            (which will be set to ``self``).\n        kwargs : keyword arguments\n            Keyword arguments to the function.\n\n        If present, the following arguments are treated specially:\n\n        unit : `~astropy.units.Unit`\n            Unit of the output result.  If not given, the unit of ``self``.\n        out : `~astropy.units.Quantity`\n            A Quantity instance in which to store the output.\n\n        Notes\n        -----\n        Output should always be assigned via a keyword argument, otherwise\n        no proper account of the unit is taken.\n\n        Returns\n        -------\n        out : `~astropy.units.Quantity`\n            Result of the function call, with the unit set properly.\n        \"\"\"\n        if unit is None:\n            unit = self.unit\n        # Ensure we don't loop back by turning any Quantity into array views.\n        args = (self.value,) + tuple((arg.value if isinstance(arg, Quantity)\n                                      else arg) for arg in args)\n        if out is not None:\n            # If pre-allocated output is used, check it is suitable.\n            # This also returns array view, to ensure we don't loop back.\n            arrays = tuple(arg for arg in args if isinstance(arg, np.ndarray))\n            kwargs['out'] = check_output(out, unit, arrays, function=function)\n        # Apply the function and turn it back into a Quantity.\n        result = function(*args, **kwargs)\n        return self._result_as_quantity(result, unit, out)"},{"col":4,"comment":"null","endLoc":205,"header":"@name.setter\n    def name(self, value)","id":1787,"name":"name","nodeType":"Function","startLoc":196,"text":"@name.setter\n    def name(self, value):\n        if not isinstance(value, str):\n            raise TypeError(\"'name' attribute must be a string\")\n        if not conf.extension_name_case_sensitive:\n            value = value.upper()\n        if 'EXTNAME' in self._header:\n            self._header['EXTNAME'] = value\n        else:\n            self._header['EXTNAME'] = (value, 'extension name')"},{"col":4,"comment":"null","endLoc":209,"header":"@property\n    def ver(self)","id":1788,"name":"ver","nodeType":"Function","startLoc":207,"text":"@property\n    def ver(self):\n        return self._header.get('EXTVER', 1)"},{"col":4,"comment":"null","endLoc":218,"header":"@ver.setter\n    def ver(self, value)","id":1789,"name":"ver","nodeType":"Function","startLoc":211,"text":"@ver.setter\n    def ver(self, value):\n        if not _is_int(value):\n            raise TypeError(\"'ver' attribute must be an integer\")\n        if 'EXTVER' in self._header:\n            self._header['EXTVER'] = value\n        else:\n            self._header['EXTVER'] = (value, 'extension value')"},{"col":4,"comment":"null","endLoc":222,"header":"@property\n    def level(self)","id":1790,"name":"level","nodeType":"Function","startLoc":220,"text":"@property\n    def level(self):\n        return self._header.get('EXTLEVEL', 1)"},{"col":4,"comment":"null","endLoc":231,"header":"@level.setter\n    def level(self, value)","id":1791,"name":"level","nodeType":"Function","startLoc":224,"text":"@level.setter\n    def level(self, value):\n        if not _is_int(value):\n            raise TypeError(\"'level' attribute must be an integer\")\n        if 'EXTLEVEL' in self._header:\n            self._header['EXTLEVEL'] = value\n        else:\n            self._header['EXTLEVEL'] = (value, 'extension level')"},{"col":4,"comment":"null","endLoc":240,"header":"@property\n    def is_image(self)","id":1792,"name":"is_image","nodeType":"Function","startLoc":233,"text":"@property\n    def is_image(self):\n        return (\n            self.name == 'PRIMARY' or\n            ('XTENSION' in self._header and\n             (self._header['XTENSION'] == 'IMAGE' or\n              (self._header['XTENSION'] == 'BINTABLE' and\n               'ZIMAGE' in self._header and self._header['ZIMAGE'] is True))))"},{"col":4,"comment":"null","endLoc":244,"header":"@property\n    def _data_loaded(self)","id":1793,"name":"_data_loaded","nodeType":"Function","startLoc":242,"text":"@property\n    def _data_loaded(self):\n        return ('data' in self.__dict__ and self.data is not DELAYED)"},{"col":4,"comment":"null","endLoc":248,"header":"@property\n    def _has_data(self)","id":1794,"name":"_has_data","nodeType":"Function","startLoc":246,"text":"@property\n    def _has_data(self):\n        return self._data_loaded and self.data is not None"},{"col":4,"comment":"null","endLoc":252,"header":"@classmethod\n    def register_hdu(cls, hducls)","id":1795,"name":"register_hdu","nodeType":"Function","startLoc":250,"text":"@classmethod\n    def register_hdu(cls, hducls):\n        cls._hdu_registry.add(hducls)"},{"col":4,"comment":"null","endLoc":257,"header":"@classmethod\n    def unregister_hdu(cls, hducls)","id":1796,"name":"unregister_hdu","nodeType":"Function","startLoc":254,"text":"@classmethod\n    def unregister_hdu(cls, hducls):\n        if hducls in cls._hdu_registry:\n            cls._hdu_registry.remove(hducls)"},{"col":4,"comment":"null","endLoc":261,"header":"@classmethod\n    def match_header(cls, header)","id":1797,"name":"match_header","nodeType":"Function","startLoc":259,"text":"@classmethod\n    def match_header(cls, header):\n        raise NotImplementedError"},{"col":4,"comment":"\n        Write the HDU to a new file. This is a convenience method to\n        provide a user easier output interface if only one HDU needs\n        to be written to a file.\n\n        Parameters\n        ----------\n        name : path-like or file-like\n            Output FITS file.  If the file object is already opened, it must\n            be opened in a writeable mode.\n\n        output_verify : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n\n        checksum : bool\n            When `True` adds both ``DATASUM`` and ``CHECKSUM`` cards\n            to the header of the HDU when written to the file.\n        ","endLoc":374,"header":"def writeto(self, name, output_verify='exception', overwrite=False,\n                checksum=False)","id":1798,"name":"writeto","nodeType":"Function","startLoc":340,"text":"def writeto(self, name, output_verify='exception', overwrite=False,\n                checksum=False):\n        \"\"\"\n        Write the HDU to a new file. This is a convenience method to\n        provide a user easier output interface if only one HDU needs\n        to be written to a file.\n\n        Parameters\n        ----------\n        name : path-like or file-like\n            Output FITS file.  If the file object is already opened, it must\n            be opened in a writeable mode.\n\n        output_verify : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n\n        checksum : bool\n            When `True` adds both ``DATASUM`` and ``CHECKSUM`` cards\n            to the header of the HDU when written to the file.\n        \"\"\"\n\n        from .hdulist import HDUList\n\n        hdulist = HDUList([self])\n        hdulist.writeto(name, output_verify, overwrite=overwrite,\n                        checksum=checksum)"},{"col":4,"comment":"null","endLoc":1783,"header":"def trace(self, offset=0, axis1=0, axis2=1, dtype=None, out=None)","id":1799,"name":"trace","nodeType":"Function","startLoc":1781,"text":"def trace(self, offset=0, axis1=0, axis2=1, dtype=None, out=None):\n        return self._wrap_function(np.trace, offset, axis1, axis2, dtype,\n                                   out=out)"},{"col":4,"comment":"null","endLoc":2135,"header":"def __init__(self, grammar, method='LALR', log=None)","id":1800,"name":"__init__","nodeType":"Function","startLoc":2102,"text":"def __init__(self, grammar, method='LALR', log=None):\n        if method not in ['SLR', 'LALR']:\n            raise LALRError('Unsupported method %s' % method)\n\n        self.grammar = grammar\n        self.lr_method = method\n\n        # Set up the logger\n        if not log:\n            log = NullLogger()\n        self.log = log\n\n        # Internal attributes\n        self.lr_action     = {}        # Action table\n        self.lr_goto       = {}        # Goto table\n        self.lr_productions  = grammar.Productions    # Copy of grammar Production array\n        self.lr_goto_cache = {}        # Cache of computed gotos\n        self.lr0_cidhash   = {}        # Cache of closures\n\n        self._add_count    = 0         # Internal counter used to detect cycles\n\n        # Diagonistic information filled in by the table generator\n        self.sr_conflict   = 0\n        self.rr_conflict   = 0\n        self.conflicts     = []        # List of conflicts\n\n        self.sr_conflicts  = []\n        self.rr_conflicts  = []\n\n        # Build the tables\n        self.grammar.build_lritems()\n        self.grammar.compute_first()\n        self.grammar.compute_follow()\n        self.lr_parse_table()"},{"col":4,"comment":"null","endLoc":1788,"header":"def var(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False)","id":1801,"name":"var","nodeType":"Function","startLoc":1785,"text":"def var(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False):\n        return self._wrap_function(np.var, axis, dtype,\n                                   out=out, ddof=ddof, keepdims=keepdims,\n                                   unit=self.unit**2)"},{"col":4,"comment":"null","endLoc":419,"header":"def _report(self)","id":1802,"name":"_report","nodeType":"Function","startLoc":357,"text":"def _report(self):\n        wrapper = textwrap.TextWrapper(initial_indent='  ',\n                                       subsequent_indent='  ')\n\n        self._fileobj.write('\\n')\n        self._writeln(f' fitsdiff: {__version__}')\n        self._writeln(f' a: {self.filenamea}\\n b: {self.filenameb}')\n\n        if self.ignore_hdus:\n            ignore_hdus = ' '.join(sorted(self.ignore_hdus))\n            self._writeln(f' HDU(s) not to be compared:\\n{wrapper.fill(ignore_hdus)}')\n\n        if self.ignore_hdu_patterns:\n            ignore_hdu_patterns = ' '.join(sorted(self.ignore_hdu_patterns))\n            self._writeln(' HDU(s) not to be compared:\\n{}'\n                          .format(wrapper.fill(ignore_hdu_patterns)))\n\n        if self.ignore_keywords:\n            ignore_keywords = ' '.join(sorted(self.ignore_keywords))\n            self._writeln(' Keyword(s) not to be compared:\\n{}'\n                          .format(wrapper.fill(ignore_keywords)))\n\n        if self.ignore_comments:\n            ignore_comments = ' '.join(sorted(self.ignore_comments))\n            self._writeln(' Keyword(s) whose comments are not to be compared'\n                          ':\\n{}'.format(wrapper.fill(ignore_comments)))\n\n        if self.ignore_fields:\n            ignore_fields = ' '.join(sorted(self.ignore_fields))\n            self._writeln(' Table column(s) not to be compared:\\n{}'\n                          .format(wrapper.fill(ignore_fields)))\n\n        self._writeln(' Maximum number of different data values to be '\n                      'reported: {}'.format(self.numdiffs))\n        self._writeln(' Relative tolerance: {}, Absolute tolerance: {}'\n                      .format(self.rtol, self.atol))\n\n        if self.diff_hdu_count:\n            self._fileobj.write('\\n')\n            self._writeln('Files contain different numbers of HDUs:')\n            self._writeln(f' a: {self.diff_hdu_count[0]}')\n            self._writeln(f' b: {self.diff_hdu_count[1]}')\n\n            if not self.diff_hdus:\n                self._writeln('No differences found between common HDUs.')\n                return\n        elif not self.diff_hdus:\n            self._fileobj.write('\\n')\n            self._writeln('No differences found.')\n            return\n\n        for idx, hdu_diff, extname, extver in self.diff_hdus:\n            # print out the extension heading\n            if idx == 0:\n                self._fileobj.write('\\n')\n                self._writeln('Primary HDU:')\n            else:\n                self._fileobj.write('\\n')\n                if extname:\n                    self._writeln(f'Extension HDU {idx} ({extname}, {extver}):')\n                else:\n                    self._writeln(f'Extension HDU {idx}:')\n            hdu_diff.report(self._fileobj, indent=self._indent + 1)"},{"col":4,"comment":"null","endLoc":1792,"header":"def std(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False)","id":1803,"name":"std","nodeType":"Function","startLoc":1790,"text":"def std(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False):\n        return self._wrap_function(np.std, axis, dtype, out=out, ddof=ddof,\n                                   keepdims=keepdims)"},{"col":4,"comment":"null","endLoc":1796,"header":"def mean(self, axis=None, dtype=None, out=None, keepdims=False)","id":1804,"name":"mean","nodeType":"Function","startLoc":1794,"text":"def mean(self, axis=None, dtype=None, out=None, keepdims=False):\n        return self._wrap_function(np.mean, axis, dtype, out=out,\n                                   keepdims=keepdims)"},{"col":4,"comment":"null","endLoc":1799,"header":"def round(self, decimals=0, out=None)","id":1805,"name":"round","nodeType":"Function","startLoc":1798,"text":"def round(self, decimals=0, out=None):\n        return self._wrap_function(np.round, decimals, out=out)"},{"col":4,"comment":"null","endLoc":1803,"header":"def dot(self, b, out=None)","id":1806,"name":"dot","nodeType":"Function","startLoc":1801,"text":"def dot(self, b, out=None):\n        result_unit = self.unit * getattr(b, 'unit', dimensionless_unscaled)\n        return self._wrap_function(np.dot, b, out=out, unit=result_unit)"},{"col":4,"comment":"null","endLoc":1809,"header":"def all(self, axis=None, out=None)","id":1807,"name":"all","nodeType":"Function","startLoc":1807,"text":"def all(self, axis=None, out=None):\n        raise TypeError(\"cannot evaluate truth value of quantities. \"\n                        \"Evaluate array with q.value.all(...)\")"},{"col":4,"comment":"null","endLoc":1813,"header":"def any(self, axis=None, out=None)","id":1808,"name":"any","nodeType":"Function","startLoc":1811,"text":"def any(self, axis=None, out=None):\n        raise TypeError(\"cannot evaluate truth value of quantities. \"\n                        \"Evaluate array with q.value.any(...)\")"},{"col":4,"comment":"null","endLoc":1818,"header":"def diff(self, n=1, axis=-1)","id":1809,"name":"diff","nodeType":"Function","startLoc":1817,"text":"def diff(self, n=1, axis=-1):\n        return self._wrap_function(np.diff, n, axis)"},{"col":4,"comment":"null","endLoc":1821,"header":"def ediff1d(self, to_end=None, to_begin=None)","id":1810,"name":"ediff1d","nodeType":"Function","startLoc":1820,"text":"def ediff1d(self, to_end=None, to_begin=None):\n        return self._wrap_function(np.ediff1d, to_end, to_begin)"},{"col":4,"comment":"null","endLoc":1825,"header":"def nansum(self, axis=None, out=None, keepdims=False)","id":1811,"name":"nansum","nodeType":"Function","startLoc":1823,"text":"def nansum(self, axis=None, out=None, keepdims=False):\n        return self._wrap_function(np.nansum, axis,\n                                   out=out, keepdims=keepdims)"},{"col":4,"comment":"\n        Insert values along the given axis before the given indices and return\n        a new `~astropy.units.Quantity` object.\n\n        This is a thin wrapper around the `numpy.insert` function.\n\n        Parameters\n        ----------\n        obj : int, slice or sequence of int\n            Object that defines the index or indices before which ``values`` is\n            inserted.\n        values : array-like\n            Values to insert.  If the type of ``values`` is different\n            from that of quantity, ``values`` is converted to the matching type.\n            ``values`` should be shaped so that it can be broadcast appropriately\n            The unit of ``values`` must be consistent with this quantity.\n        axis : int, optional\n            Axis along which to insert ``values``.  If ``axis`` is None then\n            the quantity array is flattened before insertion.\n\n        Returns\n        -------\n        out : `~astropy.units.Quantity`\n            A copy of quantity with ``values`` inserted.  Note that the\n            insertion does not occur in-place: a new quantity array is returned.\n\n        Examples\n        --------\n        >>> import astropy.units as u\n        >>> q = [1, 2] * u.m\n        >>> q.insert(0, 50 * u.cm)\n        <Quantity [ 0.5,  1.,  2.] m>\n\n        >>> q = [[1, 2], [3, 4]] * u.m\n        >>> q.insert(1, [10, 20] * u.m, axis=0)\n        <Quantity [[  1.,  2.],\n                   [ 10., 20.],\n                   [  3.,  4.]] m>\n\n        >>> q.insert(1, 10 * u.m, axis=1)\n        <Quantity [[  1., 10.,  2.],\n                   [  3., 10.,  4.]] m>\n\n        ","endLoc":1873,"header":"def insert(self, obj, values, axis=None)","id":1812,"name":"insert","nodeType":"Function","startLoc":1827,"text":"def insert(self, obj, values, axis=None):\n        \"\"\"\n        Insert values along the given axis before the given indices and return\n        a new `~astropy.units.Quantity` object.\n\n        This is a thin wrapper around the `numpy.insert` function.\n\n        Parameters\n        ----------\n        obj : int, slice or sequence of int\n            Object that defines the index or indices before which ``values`` is\n            inserted.\n        values : array-like\n            Values to insert.  If the type of ``values`` is different\n            from that of quantity, ``values`` is converted to the matching type.\n            ``values`` should be shaped so that it can be broadcast appropriately\n            The unit of ``values`` must be consistent with this quantity.\n        axis : int, optional\n            Axis along which to insert ``values``.  If ``axis`` is None then\n            the quantity array is flattened before insertion.\n\n        Returns\n        -------\n        out : `~astropy.units.Quantity`\n            A copy of quantity with ``values`` inserted.  Note that the\n            insertion does not occur in-place: a new quantity array is returned.\n\n        Examples\n        --------\n        >>> import astropy.units as u\n        >>> q = [1, 2] * u.m\n        >>> q.insert(0, 50 * u.cm)\n        <Quantity [ 0.5,  1.,  2.] m>\n\n        >>> q = [[1, 2], [3, 4]] * u.m\n        >>> q.insert(1, [10, 20] * u.m, axis=0)\n        <Quantity [[  1.,  2.],\n                   [ 10., 20.],\n                   [  3.,  4.]] m>\n\n        >>> q.insert(1, 10 * u.m, axis=1)\n        <Quantity [[  1., 10.,  2.],\n                   [  3., 10.,  4.]] m>\n\n        \"\"\"\n        out_array = np.insert(self.value, obj, self._to_own_unit(values), axis)\n        return self._new_view(out_array)"},{"attributeType":"null","col":4,"comment":"null","endLoc":306,"id":1813,"name":"_equivalencies","nodeType":"Attribute","startLoc":306,"text":"_equivalencies"},{"attributeType":"null","col":4,"comment":"null","endLoc":310,"id":1814,"name":"_default_unit","nodeType":"Attribute","startLoc":310,"text":"_default_unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":313,"id":1815,"name":"_unit","nodeType":"Attribute","startLoc":313,"text":"_unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":315,"id":1816,"name":"__array_priority__","nodeType":"Attribute","startLoc":315,"text":"__array_priority__"},{"attributeType":"null","col":12,"comment":"null","endLoc":332,"id":1817,"name":"a","nodeType":"Attribute","startLoc":332,"text":"self.a"},{"attributeType":"null","col":8,"comment":"null","endLoc":297,"id":1818,"name":"ignore_blanks","nodeType":"Attribute","startLoc":297,"text":"self.ignore_blanks"},{"attributeType":"null","col":4,"comment":"null","endLoc":792,"id":1819,"name":"info","nodeType":"Attribute","startLoc":792,"text":"info"},{"attributeType":"null","col":12,"comment":"null","endLoc":333,"id":1820,"name":"b","nodeType":"Attribute","startLoc":333,"text":"self.b"},{"attributeType":"null","col":4,"comment":"null","endLoc":906,"id":1821,"name":"value","nodeType":"Attribute","startLoc":906,"text":"value"},{"attributeType":"null","col":8,"comment":"null","endLoc":289,"id":1822,"name":"ignore_keywords","nodeType":"Attribute","startLoc":289,"text":"self.ignore_keywords"},{"attributeType":"null","col":8,"comment":"null","endLoc":298,"id":1823,"name":"ignore_blank_cards","nodeType":"Attribute","startLoc":298,"text":"self.ignore_blank_cards"},{"attributeType":"null","col":4,"comment":"null","endLoc":990,"id":1824,"name":"_include_easy_conversion_members","nodeType":"Attribute","startLoc":990,"text":"_include_easy_conversion_members"},{"attributeType":"null","col":8,"comment":"null","endLoc":293,"id":1825,"name":"numdiffs","nodeType":"Attribute","startLoc":293,"text":"self.numdiffs"},{"attributeType":"null","col":8,"comment":"null","endLoc":288,"id":1826,"name":"ignore_hdus","nodeType":"Attribute","startLoc":288,"text":"self.ignore_hdus"},{"attributeType":"null","col":8,"comment":"null","endLoc":307,"id":1827,"name":"diff_hdu_count","nodeType":"Attribute","startLoc":307,"text":"self.diff_hdu_count"},{"attributeType":"null","col":8,"comment":"null","endLoc":294,"id":1828,"name":"rtol","nodeType":"Attribute","startLoc":294,"text":"self.rtol"},{"attributeType":"null","col":20,"comment":"null","endLoc":498,"id":1829,"name":"unit","nodeType":"Attribute","startLoc":498,"text":"unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":769,"id":1830,"name":"_unit","nodeType":"Attribute","startLoc":769,"text":"self._unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":327,"id":1831,"name":"filenameb","nodeType":"Attribute","startLoc":327,"text":"self.filenameb"},{"attributeType":"null","col":8,"comment":"null","endLoc":323,"id":1832,"name":"filenamea","nodeType":"Attribute","startLoc":323,"text":"self.filenamea"},{"attributeType":"null","col":8,"comment":"null","endLoc":301,"id":1833,"name":"ignore_hdu_patterns","nodeType":"Attribute","startLoc":301,"text":"self.ignore_hdu_patterns"},{"attributeType":"null","col":8,"comment":"null","endLoc":308,"id":1834,"name":"diff_hdus","nodeType":"Attribute","startLoc":308,"text":"self.diff_hdus"},{"attributeType":"null","col":8,"comment":"null","endLoc":290,"id":1835,"name":"ignore_comments","nodeType":"Attribute","startLoc":290,"text":"self.ignore_comments"},{"attributeType":"null","col":8,"comment":"null","endLoc":295,"id":1836,"name":"atol","nodeType":"Attribute","startLoc":295,"text":"self.atol"},{"attributeType":"null","col":8,"comment":"null","endLoc":291,"id":1837,"name":"ignore_fields","nodeType":"Attribute","startLoc":291,"text":"self.ignore_fields"},{"className":"HDUDiff","col":0,"comment":"\n    Diff two HDU objects, including their headers and their data (but only if\n    both HDUs contain the same type of data (image, table, or unknown).\n\n    `HDUDiff` objects have the following diff attributes:\n\n    - ``diff_extnames``: If the two HDUs have different EXTNAME values, this\n      contains a 2-tuple of the different extension names.\n\n    - ``diff_extvers``: If the two HDUS have different EXTVER values, this\n      contains a 2-tuple of the different extension versions.\n\n    - ``diff_extlevels``: If the two HDUs have different EXTLEVEL values, this\n      contains a 2-tuple of the different extension levels.\n\n    - ``diff_extension_types``: If the two HDUs have different XTENSION values,\n      this contains a 2-tuple of the different extension types.\n\n    - ``diff_headers``: Contains a `HeaderDiff` object for the headers of the\n      two HDUs. This will always contain an object--it may be determined\n      whether the headers are different through ``diff_headers.identical``.\n\n    - ``diff_data``: Contains either a `ImageDataDiff`, `TableDataDiff`, or\n      `RawDataDiff` as appropriate for the data in the HDUs, and only if the\n      two HDUs have non-empty data of the same type (`RawDataDiff` is used for\n      HDUs containing non-empty data of an indeterminate type).\n    ","endLoc":603,"id":1838,"nodeType":"Class","startLoc":422,"text":"class HDUDiff(_BaseDiff):\n    \"\"\"\n    Diff two HDU objects, including their headers and their data (but only if\n    both HDUs contain the same type of data (image, table, or unknown).\n\n    `HDUDiff` objects have the following diff attributes:\n\n    - ``diff_extnames``: If the two HDUs have different EXTNAME values, this\n      contains a 2-tuple of the different extension names.\n\n    - ``diff_extvers``: If the two HDUS have different EXTVER values, this\n      contains a 2-tuple of the different extension versions.\n\n    - ``diff_extlevels``: If the two HDUs have different EXTLEVEL values, this\n      contains a 2-tuple of the different extension levels.\n\n    - ``diff_extension_types``: If the two HDUs have different XTENSION values,\n      this contains a 2-tuple of the different extension types.\n\n    - ``diff_headers``: Contains a `HeaderDiff` object for the headers of the\n      two HDUs. This will always contain an object--it may be determined\n      whether the headers are different through ``diff_headers.identical``.\n\n    - ``diff_data``: Contains either a `ImageDataDiff`, `TableDataDiff`, or\n      `RawDataDiff` as appropriate for the data in the HDUs, and only if the\n      two HDUs have non-empty data of the same type (`RawDataDiff` is used for\n      HDUs containing non-empty data of an indeterminate type).\n    \"\"\"\n\n    def __init__(self, a, b, ignore_keywords=[], ignore_comments=[],\n                 ignore_fields=[], numdiffs=10, rtol=0.0, atol=0.0,\n                 ignore_blanks=True, ignore_blank_cards=True):\n        \"\"\"\n        Parameters\n        ----------\n        a : BaseHDU\n            An HDU object.\n\n        b : BaseHDU\n            An HDU object to compare to the first HDU object.\n\n        ignore_keywords : sequence, optional\n            Header keywords to ignore when comparing two headers; the presence\n            of these keywords and their values are ignored.  Wildcard strings\n            may also be included in the list.\n\n        ignore_comments : sequence, optional\n            A list of header keywords whose comments should be ignored in the\n            comparison.  May contain wildcard strings as with ignore_keywords.\n\n        ignore_fields : sequence, optional\n            The (case-insensitive) names of any table columns to ignore if any\n            table data is to be compared.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\\\left| a - b \\\\right| > \\\\text{atol} + \\\\text{rtol} \\\\cdot \\\\left| b \\\\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n\n        ignore_blanks : bool, optional\n            Ignore extra whitespace at the end of string values either in\n            headers or data. Extra leading whitespace is not ignored\n            (default: True).\n\n        ignore_blank_cards : bool, optional\n            Ignore all cards that are blank, i.e. they only contain\n            whitespace (default: True).\n        \"\"\"\n\n        self.ignore_keywords = {k.upper() for k in ignore_keywords}\n        self.ignore_comments = {k.upper() for k in ignore_comments}\n        self.ignore_fields = {k.upper() for k in ignore_fields}\n\n        self.rtol = rtol\n        self.atol = atol\n\n        self.numdiffs = numdiffs\n        self.ignore_blanks = ignore_blanks\n        self.ignore_blank_cards = ignore_blank_cards\n\n        self.diff_extnames = ()\n        self.diff_extvers = ()\n        self.diff_extlevels = ()\n        self.diff_extension_types = ()\n        self.diff_headers = None\n        self.diff_data = None\n\n        super().__init__(a, b)\n\n    def _diff(self):\n        if self.a.name != self.b.name:\n            self.diff_extnames = (self.a.name, self.b.name)\n\n        if self.a.ver != self.b.ver:\n            self.diff_extvers = (self.a.ver, self.b.ver)\n\n        if self.a.level != self.b.level:\n            self.diff_extlevels = (self.a.level, self.b.level)\n\n        if self.a.header.get('XTENSION') != self.b.header.get('XTENSION'):\n            self.diff_extension_types = (self.a.header.get('XTENSION'),\n                                         self.b.header.get('XTENSION'))\n\n        self.diff_headers = HeaderDiff.fromdiff(self, self.a.header.copy(),\n                                                self.b.header.copy())\n\n        if self.a.data is None or self.b.data is None:\n            # TODO: Perhaps have some means of marking this case\n            pass\n        elif self.a.is_image and self.b.is_image:\n            self.diff_data = ImageDataDiff.fromdiff(self, self.a.data,\n                                                    self.b.data)\n            # Clean up references to (possibly) memmapped arrays so they can\n            # be closed by .close()\n            self.diff_data.a = None\n            self.diff_data.b = None\n        elif (isinstance(self.a, _TableLikeHDU) and\n              isinstance(self.b, _TableLikeHDU)):\n            # TODO: Replace this if/when _BaseHDU grows a .is_table property\n            self.diff_data = TableDataDiff.fromdiff(self, self.a.data,\n                                                    self.b.data)\n            # Clean up references to (possibly) memmapped arrays so they can\n            # be closed by .close()\n            self.diff_data.a = None\n            self.diff_data.b = None\n        elif not self.diff_extension_types:\n            # Don't diff the data for unequal extension types that are not\n            # recognized image or table types\n            self.diff_data = RawDataDiff.fromdiff(self, self.a.data,\n                                                  self.b.data)\n            # Clean up references to (possibly) memmapped arrays so they can\n            # be closed by .close()\n            self.diff_data.a = None\n            self.diff_data.b = None\n\n    def _report(self):\n        if self.identical:\n            self._writeln(\" No differences found.\")\n        if self.diff_extension_types:\n            self._writeln(\" Extension types differ:\\n  a: {}\\n  \"\n                          \"b: {}\".format(*self.diff_extension_types))\n        if self.diff_extnames:\n            self._writeln(\" Extension names differ:\\n  a: {}\\n  \"\n                          \"b: {}\".format(*self.diff_extnames))\n        if self.diff_extvers:\n            self._writeln(\" Extension versions differ:\\n  a: {}\\n  \"\n                          \"b: {}\".format(*self.diff_extvers))\n\n        if self.diff_extlevels:\n            self._writeln(\" Extension levels differ:\\n  a: {}\\n  \"\n                          \"b: {}\".format(*self.diff_extlevels))\n\n        if not self.diff_headers.identical:\n            self._fileobj.write('\\n')\n            self._writeln(\" Headers contain differences:\")\n            self.diff_headers.report(self._fileobj, indent=self._indent + 1)\n\n        if self.diff_data is not None and not self.diff_data.identical:\n            self._fileobj.write('\\n')\n            self._writeln(\" Data contains differences:\")\n            self.diff_data.report(self._fileobj, indent=self._indent + 1)"},{"attributeType":"null","col":16,"comment":"null","endLoc":445,"id":1839,"name":"v","nodeType":"Attribute","startLoc":445,"text":"v"},{"col":4,"comment":"\n        Parameters\n        ----------\n        a : BaseHDU\n            An HDU object.\n\n        b : BaseHDU\n            An HDU object to compare to the first HDU object.\n\n        ignore_keywords : sequence, optional\n            Header keywords to ignore when comparing two headers; the presence\n            of these keywords and their values are ignored.  Wildcard strings\n            may also be included in the list.\n\n        ignore_comments : sequence, optional\n            A list of header keywords whose comments should be ignored in the\n            comparison.  May contain wildcard strings as with ignore_keywords.\n\n        ignore_fields : sequence, optional\n            The (case-insensitive) names of any table columns to ignore if any\n            table data is to be compared.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\left| a - b \\right| > \\text{atol} + \\text{rtol} \\cdot \\left| b \\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n\n        ignore_blanks : bool, optional\n            Ignore extra whitespace at the end of string values either in\n            headers or data. Extra leading whitespace is not ignored\n            (default: True).\n\n        ignore_blank_cards : bool, optional\n            Ignore all cards that are blank, i.e. they only contain\n            whitespace (default: True).\n        ","endLoc":530,"header":"def __init__(self, a, b, ignore_keywords=[], ignore_comments=[],\n                 ignore_fields=[], numdiffs=10, rtol=0.0, atol=0.0,\n                 ignore_blanks=True, ignore_blank_cards=True)","id":1840,"name":"__init__","nodeType":"Function","startLoc":451,"text":"def __init__(self, a, b, ignore_keywords=[], ignore_comments=[],\n                 ignore_fields=[], numdiffs=10, rtol=0.0, atol=0.0,\n                 ignore_blanks=True, ignore_blank_cards=True):\n        \"\"\"\n        Parameters\n        ----------\n        a : BaseHDU\n            An HDU object.\n\n        b : BaseHDU\n            An HDU object to compare to the first HDU object.\n\n        ignore_keywords : sequence, optional\n            Header keywords to ignore when comparing two headers; the presence\n            of these keywords and their values are ignored.  Wildcard strings\n            may also be included in the list.\n\n        ignore_comments : sequence, optional\n            A list of header keywords whose comments should be ignored in the\n            comparison.  May contain wildcard strings as with ignore_keywords.\n\n        ignore_fields : sequence, optional\n            The (case-insensitive) names of any table columns to ignore if any\n            table data is to be compared.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\\\left| a - b \\\\right| > \\\\text{atol} + \\\\text{rtol} \\\\cdot \\\\left| b \\\\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n\n        ignore_blanks : bool, optional\n            Ignore extra whitespace at the end of string values either in\n            headers or data. Extra leading whitespace is not ignored\n            (default: True).\n\n        ignore_blank_cards : bool, optional\n            Ignore all cards that are blank, i.e. they only contain\n            whitespace (default: True).\n        \"\"\"\n\n        self.ignore_keywords = {k.upper() for k in ignore_keywords}\n        self.ignore_comments = {k.upper() for k in ignore_comments}\n        self.ignore_fields = {k.upper() for k in ignore_fields}\n\n        self.rtol = rtol\n        self.atol = atol\n\n        self.numdiffs = numdiffs\n        self.ignore_blanks = ignore_blanks\n        self.ignore_blank_cards = ignore_blank_cards\n\n        self.diff_extnames = ()\n        self.diff_extvers = ()\n        self.diff_extlevels = ()\n        self.diff_extension_types = ()\n        self.diff_headers = None\n        self.diff_data = None\n\n        super().__init__(a, b)"},{"attributeType":"null","col":16,"comment":"null","endLoc":439,"id":1841,"name":"pattern","nodeType":"Attribute","startLoc":439,"text":"pattern"},{"attributeType":"null","col":20,"comment":"null","endLoc":477,"id":1842,"name":"dtype","nodeType":"Attribute","startLoc":477,"text":"dtype"},{"attributeType":"null","col":20,"comment":"null","endLoc":490,"id":1843,"name":"value_unit","nodeType":"Attribute","startLoc":490,"text":"value_unit"},{"attributeType":"null","col":20,"comment":"null","endLoc":500,"id":1844,"name":"copy","nodeType":"Attribute","startLoc":500,"text":"copy"},{"attributeType":"null","col":16,"comment":"null","endLoc":520,"id":1845,"name":"cls","nodeType":"Attribute","startLoc":520,"text":"cls"},{"attributeType":"null","col":8,"comment":"null","endLoc":522,"id":1846,"name":"value","nodeType":"Attribute","startLoc":522,"text":"value"},{"col":4,"comment":"null","endLoc":576,"header":"def _diff(self)","id":1847,"name":"_diff","nodeType":"Function","startLoc":532,"text":"def _diff(self):\n        if self.a.name != self.b.name:\n            self.diff_extnames = (self.a.name, self.b.name)\n\n        if self.a.ver != self.b.ver:\n            self.diff_extvers = (self.a.ver, self.b.ver)\n\n        if self.a.level != self.b.level:\n            self.diff_extlevels = (self.a.level, self.b.level)\n\n        if self.a.header.get('XTENSION') != self.b.header.get('XTENSION'):\n            self.diff_extension_types = (self.a.header.get('XTENSION'),\n                                         self.b.header.get('XTENSION'))\n\n        self.diff_headers = HeaderDiff.fromdiff(self, self.a.header.copy(),\n                                                self.b.header.copy())\n\n        if self.a.data is None or self.b.data is None:\n            # TODO: Perhaps have some means of marking this case\n            pass\n        elif self.a.is_image and self.b.is_image:\n            self.diff_data = ImageDataDiff.fromdiff(self, self.a.data,\n                                                    self.b.data)\n            # Clean up references to (possibly) memmapped arrays so they can\n            # be closed by .close()\n            self.diff_data.a = None\n            self.diff_data.b = None\n        elif (isinstance(self.a, _TableLikeHDU) and\n              isinstance(self.b, _TableLikeHDU)):\n            # TODO: Replace this if/when _BaseHDU grows a .is_table property\n            self.diff_data = TableDataDiff.fromdiff(self, self.a.data,\n                                                    self.b.data)\n            # Clean up references to (possibly) memmapped arrays so they can\n            # be closed by .close()\n            self.diff_data.a = None\n            self.diff_data.b = None\n        elif not self.diff_extension_types:\n            # Don't diff the data for unequal extension types that are not\n            # recognized image or table types\n            self.diff_data = RawDataDiff.fromdiff(self, self.a.data,\n                                                  self.b.data)\n            # Clean up references to (possibly) memmapped arrays so they can\n            # be closed by .close()\n            self.diff_data.a = None\n            self.diff_data.b = None"},{"attributeType":"null","col":12,"comment":"null","endLoc":518,"id":1848,"name":"qcls","nodeType":"Attribute","startLoc":518,"text":"qcls"},{"attributeType":"null","col":16,"comment":"null","endLoc":455,"id":1849,"name":"unit_string","nodeType":"Attribute","startLoc":455,"text":"unit_string"},{"attributeType":"null","col":12,"comment":"null","endLoc":553,"id":1850,"name":"info","nodeType":"Attribute","startLoc":553,"text":"self.info"},{"col":4,"comment":"\n        Return an object of this class for a known observatory/site by name.\n\n        This is intended as a quick convenience function to get basic site\n        information, not a fully-featured exhaustive registry of observatories\n        and all their properties.\n\n        Additional information about the site is stored in the ``.info.meta``\n        dictionary of sites obtained using this method (see the examples below).\n\n        .. note::\n            When this function is called, it will attempt to download site\n            information from the astropy data server. If you would like a site\n            to be added, issue a pull request to the\n            `astropy-data repository <https://github.com/astropy/astropy-data>`_ .\n            If a site cannot be found in the registry (i.e., an internet\n            connection is not available), it will fall back on a built-in list,\n            In the future, this bundled list might include a version-controlled\n            list of canonical observatories extracted from the online version,\n            but it currently only contains the Greenwich Royal Observatory as an\n            example case.\n\n\n        Parameters\n        ----------\n        site_name : str\n            Name of the observatory (case-insensitive).\n\n        Returns\n        -------\n        site : `~astropy.coordinates.EarthLocation` (or subclass) instance\n            The location of the observatory. The returned class will be the same\n            as this class.\n\n        Examples\n        --------\n\n        >>> from astropy.coordinates import EarthLocation\n        >>> keck = EarthLocation.of_site('Keck Observatory')  # doctest: +REMOTE_DATA\n        >>> keck.geodetic  # doctest: +REMOTE_DATA +FLOAT_CMP\n        GeodeticLocation(lon=<Longitude -155.47833333 deg>, lat=<Latitude 19.82833333 deg>, height=<Quantity 4160. m>)\n        >>> keck.info  # doctest: +REMOTE_DATA\n        name = W. M. Keck Observatory\n        dtype = void192\n        unit = m\n        class = EarthLocation\n        n_bad = 0\n        >>> keck.info.meta  # doctest: +REMOTE_DATA\n        {'source': 'IRAF Observatory Database', 'timezone': 'US/Hawaii'}\n\n        See Also\n        --------\n        get_site_names : the list of sites that this function can access\n        ","endLoc":377,"header":"@classmethod\n    def of_site(cls, site_name)","id":1851,"name":"of_site","nodeType":"Function","startLoc":309,"text":"@classmethod\n    def of_site(cls, site_name):\n        \"\"\"\n        Return an object of this class for a known observatory/site by name.\n\n        This is intended as a quick convenience function to get basic site\n        information, not a fully-featured exhaustive registry of observatories\n        and all their properties.\n\n        Additional information about the site is stored in the ``.info.meta``\n        dictionary of sites obtained using this method (see the examples below).\n\n        .. note::\n            When this function is called, it will attempt to download site\n            information from the astropy data server. If you would like a site\n            to be added, issue a pull request to the\n            `astropy-data repository <https://github.com/astropy/astropy-data>`_ .\n            If a site cannot be found in the registry (i.e., an internet\n            connection is not available), it will fall back on a built-in list,\n            In the future, this bundled list might include a version-controlled\n            list of canonical observatories extracted from the online version,\n            but it currently only contains the Greenwich Royal Observatory as an\n            example case.\n\n\n        Parameters\n        ----------\n        site_name : str\n            Name of the observatory (case-insensitive).\n\n        Returns\n        -------\n        site : `~astropy.coordinates.EarthLocation` (or subclass) instance\n            The location of the observatory. The returned class will be the same\n            as this class.\n\n        Examples\n        --------\n\n        >>> from astropy.coordinates import EarthLocation\n        >>> keck = EarthLocation.of_site('Keck Observatory')  # doctest: +REMOTE_DATA\n        >>> keck.geodetic  # doctest: +REMOTE_DATA +FLOAT_CMP\n        GeodeticLocation(lon=<Longitude -155.47833333 deg>, lat=<Latitude 19.82833333 deg>, height=<Quantity 4160. m>)\n        >>> keck.info  # doctest: +REMOTE_DATA\n        name = W. M. Keck Observatory\n        dtype = void192\n        unit = m\n        class = EarthLocation\n        n_bad = 0\n        >>> keck.info.meta  # doctest: +REMOTE_DATA\n        {'source': 'IRAF Observatory Database', 'timezone': 'US/Hawaii'}\n\n        See Also\n        --------\n        get_site_names : the list of sites that this function can access\n        \"\"\"  # noqa\n        registry = cls._get_site_registry()\n        try:\n            el = registry[site_name]\n        except UnknownSiteException as e:\n            raise UnknownSiteException(e.site, 'EarthLocation.get_site_names',\n                                       close_names=e.close_names) from e\n\n        if cls is el.__class__:\n            return el\n        else:\n            newel = cls.from_geodetic(*el.to_geodetic())\n            newel.info.name = el.info.name\n            return newel"},{"col":4,"comment":"null","endLoc":2719,"header":"def lr_parse_table(self)","id":1852,"name":"lr_parse_table","nodeType":"Function","startLoc":2534,"text":"def lr_parse_table(self):\n        Productions = self.grammar.Productions\n        Precedence  = self.grammar.Precedence\n        goto   = self.lr_goto         # Goto array\n        action = self.lr_action       # Action array\n        log    = self.log             # Logger for output\n\n        actionp = {}                  # Action production array (temporary)\n\n        log.info('Parsing method: %s', self.lr_method)\n\n        # Step 1: Construct C = { I0, I1, ... IN}, collection of LR(0) items\n        # This determines the number of states\n\n        C = self.lr0_items()\n\n        if self.lr_method == 'LALR':\n            self.add_lalr_lookaheads(C)\n\n        # Build the parser table, state by state\n        st = 0\n        for I in C:\n            # Loop over each production in I\n            actlist = []              # List of actions\n            st_action  = {}\n            st_actionp = {}\n            st_goto    = {}\n            log.info('')\n            log.info('state %d', st)\n            log.info('')\n            for p in I:\n                log.info('    (%d) %s', p.number, p)\n            log.info('')\n\n            for p in I:\n                    if p.len == p.lr_index + 1:\n                        if p.name == \"S'\":\n                            # Start symbol. Accept!\n                            st_action['$end'] = 0\n                            st_actionp['$end'] = p\n                        else:\n                            # We are at the end of a production.  Reduce!\n                            if self.lr_method == 'LALR':\n                                laheads = p.lookaheads[st]\n                            else:\n                                laheads = self.grammar.Follow[p.name]\n                            for a in laheads:\n                                actlist.append((a, p, 'reduce using rule %d (%s)' % (p.number, p)))\n                                r = st_action.get(a)\n                                if r is not None:\n                                    # Whoa. Have a shift/reduce or reduce/reduce conflict\n                                    if r > 0:\n                                        # Need to decide on shift or reduce here\n                                        # By default we favor shifting. Need to add\n                                        # some precedence rules here.\n\n                                        # Shift precedence comes from the token\n                                        sprec, slevel = Precedence.get(a, ('right', 0))\n\n                                        # Reduce precedence comes from rule being reduced (p)\n                                        rprec, rlevel = Productions[p.number].prec\n\n                                        if (slevel < rlevel) or ((slevel == rlevel) and (rprec == 'left')):\n                                            # We really need to reduce here.\n                                            st_action[a] = -p.number\n                                            st_actionp[a] = p\n                                            if not slevel and not rlevel:\n                                                log.info('  ! shift/reduce conflict for %s resolved as reduce', a)\n                                                self.sr_conflicts.append((st, a, 'reduce'))\n                                            Productions[p.number].reduced += 1\n                                        elif (slevel == rlevel) and (rprec == 'nonassoc'):\n                                            st_action[a] = None\n                                        else:\n                                            # Hmmm. Guess we'll keep the shift\n                                            if not rlevel:\n                                                log.info('  ! shift/reduce conflict for %s resolved as shift', a)\n                                                self.sr_conflicts.append((st, a, 'shift'))\n                                    elif r < 0:\n                                        # Reduce/reduce conflict.   In this case, we favor the rule\n                                        # that was defined first in the grammar file\n                                        oldp = Productions[-r]\n                                        pp = Productions[p.number]\n                                        if oldp.line > pp.line:\n                                            st_action[a] = -p.number\n                                            st_actionp[a] = p\n                                            chosenp, rejectp = pp, oldp\n                                            Productions[p.number].reduced += 1\n                                            Productions[oldp.number].reduced -= 1\n                                        else:\n                                            chosenp, rejectp = oldp, pp\n                                        self.rr_conflicts.append((st, chosenp, rejectp))\n                                        log.info('  ! reduce/reduce conflict for %s resolved using rule %d (%s)',\n                                                 a, st_actionp[a].number, st_actionp[a])\n                                    else:\n                                        raise LALRError('Unknown conflict in state %d' % st)\n                                else:\n                                    st_action[a] = -p.number\n                                    st_actionp[a] = p\n                                    Productions[p.number].reduced += 1\n                    else:\n                        i = p.lr_index\n                        a = p.prod[i+1]       # Get symbol right after the \".\"\n                        if a in self.grammar.Terminals:\n                            g = self.lr0_goto(I, a)\n                            j = self.lr0_cidhash.get(id(g), -1)\n                            if j >= 0:\n                                # We are in a shift state\n                                actlist.append((a, p, 'shift and go to state %d' % j))\n                                r = st_action.get(a)\n                                if r is not None:\n                                    # Whoa have a shift/reduce or shift/shift conflict\n                                    if r > 0:\n                                        if r != j:\n                                            raise LALRError('Shift/shift conflict in state %d' % st)\n                                    elif r < 0:\n                                        # Do a precedence check.\n                                        #   -  if precedence of reduce rule is higher, we reduce.\n                                        #   -  if precedence of reduce is same and left assoc, we reduce.\n                                        #   -  otherwise we shift\n\n                                        # Shift precedence comes from the token\n                                        sprec, slevel = Precedence.get(a, ('right', 0))\n\n                                        # Reduce precedence comes from the rule that could have been reduced\n                                        rprec, rlevel = Productions[st_actionp[a].number].prec\n\n                                        if (slevel > rlevel) or ((slevel == rlevel) and (rprec == 'right')):\n                                            # We decide to shift here... highest precedence to shift\n                                            Productions[st_actionp[a].number].reduced -= 1\n                                            st_action[a] = j\n                                            st_actionp[a] = p\n                                            if not rlevel:\n                                                log.info('  ! shift/reduce conflict for %s resolved as shift', a)\n                                                self.sr_conflicts.append((st, a, 'shift'))\n                                        elif (slevel == rlevel) and (rprec == 'nonassoc'):\n                                            st_action[a] = None\n                                        else:\n                                            # Hmmm. Guess we'll keep the reduce\n                                            if not slevel and not rlevel:\n                                                log.info('  ! shift/reduce conflict for %s resolved as reduce', a)\n                                                self.sr_conflicts.append((st, a, 'reduce'))\n\n                                    else:\n                                        raise LALRError('Unknown conflict in state %d' % st)\n                                else:\n                                    st_action[a] = j\n                                    st_actionp[a] = p\n\n            # Print the actions associated with each terminal\n            _actprint = {}\n            for a, p, m in actlist:\n                if a in st_action:\n                    if p is st_actionp[a]:\n                        log.info('    %-15s %s', a, m)\n                        _actprint[(a, m)] = 1\n            log.info('')\n            # Print the actions that were not used. (debugging)\n            not_used = 0\n            for a, p, m in actlist:\n                if a in st_action:\n                    if p is not st_actionp[a]:\n                        if not (a, m) in _actprint:\n                            log.debug('  ! %-15s [ %s ]', a, m)\n                            not_used = 1\n                            _actprint[(a, m)] = 1\n            if not_used:\n                log.debug('')\n\n            # Construct the goto table for this state\n\n            nkeys = {}\n            for ii in I:\n                for s in ii.usyms:\n                    if s in self.grammar.Nonterminals:\n                        nkeys[s] = None\n            for n in nkeys:\n                g = self.lr0_goto(I, n)\n                j = self.lr0_cidhash.get(id(g), -1)\n                if j >= 0:\n                    st_goto[n] = j\n                    log.info('    %-30s shift and go to state %d', n, j)\n\n            action[st] = st_action\n            actionp[st] = st_actionp\n            goto[st] = st_goto\n            st += 1"},{"col":4,"comment":"\n        Instantiate the HDU object after guessing the HDU class from the\n        FITS Header.\n        ","endLoc":383,"header":"@classmethod\n    def _from_data(cls, data, header, **kwargs)","id":1853,"name":"_from_data","nodeType":"Function","startLoc":376,"text":"@classmethod\n    def _from_data(cls, data, header, **kwargs):\n        \"\"\"\n        Instantiate the HDU object after guessing the HDU class from the\n        FITS Header.\n        \"\"\"\n        klass = _hdu_class_from_header(cls, header)\n        return klass(data=data, header=header, **kwargs)"},{"col":4,"comment":"\n        Gets the site registry.  The first time this either downloads or loads\n        from the data file packaged with astropy.  Subsequent calls will use the\n        cached version unless explicitly overridden.\n\n        Parameters\n        ----------\n        force_download : bool or str\n            If not False, force replacement of the cached registry with a\n            downloaded version. If a str, that will be used as the URL to\n            download from (if just True, the default URL will be used).\n        force_builtin : bool\n            If True, load from the data file bundled with astropy and set the\n            cache to that.\n\n        Returns\n        -------\n        reg : astropy.coordinates.sites.SiteRegistry\n        ","endLoc":559,"header":"@classmethod\n    def _get_site_registry(cls, force_download=False, force_builtin=False)","id":1854,"name":"_get_site_registry","nodeType":"Function","startLoc":511,"text":"@classmethod\n    def _get_site_registry(cls, force_download=False, force_builtin=False):\n        \"\"\"\n        Gets the site registry.  The first time this either downloads or loads\n        from the data file packaged with astropy.  Subsequent calls will use the\n        cached version unless explicitly overridden.\n\n        Parameters\n        ----------\n        force_download : bool or str\n            If not False, force replacement of the cached registry with a\n            downloaded version. If a str, that will be used as the URL to\n            download from (if just True, the default URL will be used).\n        force_builtin : bool\n            If True, load from the data file bundled with astropy and set the\n            cache to that.\n\n        Returns\n        -------\n        reg : astropy.coordinates.sites.SiteRegistry\n        \"\"\"\n        # need to do this here at the bottom to avoid circular dependencies\n        from .sites import get_builtin_sites, get_downloaded_sites\n\n        if force_builtin and force_download:\n            raise ValueError('Cannot have both force_builtin and force_download True')\n\n        if force_builtin:\n            reg = cls._site_registry = get_builtin_sites()\n        else:\n            reg = getattr(cls, '_site_registry', None)\n            if force_download or not reg:\n                try:\n                    if isinstance(force_download, str):\n                        reg = get_downloaded_sites(force_download)\n                    else:\n                        reg = get_downloaded_sites()\n                except OSError:\n                    if force_download:\n                        raise\n                    msg = ('Could not access the online site list. Falling '\n                           'back on the built-in version, which is rather '\n                           'limited. If you want to retry the download, do '\n                           '{0}._get_site_registry(force_download=True)')\n                    warn(AstropyUserWarning(msg.format(cls.__name__)))\n                    reg = get_builtin_sites()\n                cls._site_registry = reg\n\n        return reg"},{"col":0,"comment":"\n    Load observatory database from data/observatories.json and parse them into\n    a SiteRegistry.\n    ","endLoc":124,"header":"def get_builtin_sites()","id":1855,"name":"get_builtin_sites","nodeType":"Function","startLoc":118,"text":"def get_builtin_sites():\n    \"\"\"\n    Load observatory database from data/observatories.json and parse them into\n    a SiteRegistry.\n    \"\"\"\n    jsondb = json.loads(get_pkg_data_contents('data/sites.json'))\n    return SiteRegistry.from_json(jsondb)"},{"col":0,"comment":"\n    Retrieves a data file from the standard locations and returns its\n    contents as a bytes object.\n\n    Parameters\n    ----------\n    data_name : str\n        Name/location of the desired data file.  One of the following:\n\n            * The name of a data file included in the source\n              distribution.  The path is relative to the module\n              calling this function.  For example, if calling from\n              ``astropy.pkname``, use ``'data/file.dat'`` to get the\n              file in ``astropy/pkgname/data/file.dat``.  Double-dots\n              can be used to go up a level.  In the same example, use\n              ``'../data/file.dat'`` to get ``astropy/data/file.dat``.\n            * If a matching local file does not exist, the Astropy\n              data server will be queried for the file.\n            * A hash like that produced by `compute_hash` can be\n              requested, prefixed by 'hash/'\n              e.g. 'hash/34c33b3eb0d56eb9462003af249eff28'.  The hash\n              will first be searched for locally, and if not found,\n              the Astropy data server will be queried.\n            * A URL to some other file.\n\n    package : str, optional\n        If specified, look for a file relative to the given package, rather\n        than the default of looking relative to the calling module's package.\n\n\n    encoding : str, optional\n        When `None` (default), returns a file-like object with a\n        ``read`` method that returns `str` (``unicode``) objects, using\n        `locale.getpreferredencoding` as an encoding.  This matches\n        the default behavior of the built-in `open` when no ``mode``\n        argument is provided.\n\n        When ``'binary'``, returns a file-like object where its ``read``\n        method returns `bytes` objects.\n\n        When another string, it is the name of an encoding, and the\n        file-like object's ``read`` method will return `str` (``unicode``)\n        objects, decoded from binary using the given encoding.\n\n    cache : bool\n        If True, the file will be downloaded and saved locally or the\n        already-cached local copy will be accessed. If False, the\n        file-like object will directly access the resource (e.g. if a\n        remote URL is accessed, an object like that from\n        `urllib.request.urlopen` is returned).\n\n    Returns\n    -------\n    contents : bytes\n        The complete contents of the file as a bytes object.\n\n    Raises\n    ------\n    urllib.error.URLError\n        If a remote file cannot be found.\n    OSError\n        If problems occur writing or reading a local file.\n\n    See Also\n    --------\n    get_pkg_data_fileobj : returns a file-like object with the data\n    get_pkg_data_filename : returns a local name for a file containing the data\n    ","endLoc":733,"header":"def get_pkg_data_contents(data_name, package=None, encoding=None, cache=True)","id":1856,"name":"get_pkg_data_contents","nodeType":"Function","startLoc":660,"text":"def get_pkg_data_contents(data_name, package=None, encoding=None, cache=True):\n    \"\"\"\n    Retrieves a data file from the standard locations and returns its\n    contents as a bytes object.\n\n    Parameters\n    ----------\n    data_name : str\n        Name/location of the desired data file.  One of the following:\n\n            * The name of a data file included in the source\n              distribution.  The path is relative to the module\n              calling this function.  For example, if calling from\n              ``astropy.pkname``, use ``'data/file.dat'`` to get the\n              file in ``astropy/pkgname/data/file.dat``.  Double-dots\n              can be used to go up a level.  In the same example, use\n              ``'../data/file.dat'`` to get ``astropy/data/file.dat``.\n            * If a matching local file does not exist, the Astropy\n              data server will be queried for the file.\n            * A hash like that produced by `compute_hash` can be\n              requested, prefixed by 'hash/'\n              e.g. 'hash/34c33b3eb0d56eb9462003af249eff28'.  The hash\n              will first be searched for locally, and if not found,\n              the Astropy data server will be queried.\n            * A URL to some other file.\n\n    package : str, optional\n        If specified, look for a file relative to the given package, rather\n        than the default of looking relative to the calling module's package.\n\n\n    encoding : str, optional\n        When `None` (default), returns a file-like object with a\n        ``read`` method that returns `str` (``unicode``) objects, using\n        `locale.getpreferredencoding` as an encoding.  This matches\n        the default behavior of the built-in `open` when no ``mode``\n        argument is provided.\n\n        When ``'binary'``, returns a file-like object where its ``read``\n        method returns `bytes` objects.\n\n        When another string, it is the name of an encoding, and the\n        file-like object's ``read`` method will return `str` (``unicode``)\n        objects, decoded from binary using the given encoding.\n\n    cache : bool\n        If True, the file will be downloaded and saved locally or the\n        already-cached local copy will be accessed. If False, the\n        file-like object will directly access the resource (e.g. if a\n        remote URL is accessed, an object like that from\n        `urllib.request.urlopen` is returned).\n\n    Returns\n    -------\n    contents : bytes\n        The complete contents of the file as a bytes object.\n\n    Raises\n    ------\n    urllib.error.URLError\n        If a remote file cannot be found.\n    OSError\n        If problems occur writing or reading a local file.\n\n    See Also\n    --------\n    get_pkg_data_fileobj : returns a file-like object with the data\n    get_pkg_data_filename : returns a local name for a file containing the data\n    \"\"\"\n\n    with get_pkg_data_fileobj(data_name, package=package, encoding=encoding,\n                              cache=cache) as fd:\n        contents = fd.read()\n    return contents"},{"col":4,"comment":"null","endLoc":603,"header":"def _report(self)","id":1857,"name":"_report","nodeType":"Function","startLoc":578,"text":"def _report(self):\n        if self.identical:\n            self._writeln(\" No differences found.\")\n        if self.diff_extension_types:\n            self._writeln(\" Extension types differ:\\n  a: {}\\n  \"\n                          \"b: {}\".format(*self.diff_extension_types))\n        if self.diff_extnames:\n            self._writeln(\" Extension names differ:\\n  a: {}\\n  \"\n                          \"b: {}\".format(*self.diff_extnames))\n        if self.diff_extvers:\n            self._writeln(\" Extension versions differ:\\n  a: {}\\n  \"\n                          \"b: {}\".format(*self.diff_extvers))\n\n        if self.diff_extlevels:\n            self._writeln(\" Extension levels differ:\\n  a: {}\\n  \"\n                          \"b: {}\".format(*self.diff_extlevels))\n\n        if not self.diff_headers.identical:\n            self._fileobj.write('\\n')\n            self._writeln(\" Headers contain differences:\")\n            self.diff_headers.report(self._fileobj, indent=self._indent + 1)\n\n        if self.diff_data is not None and not self.diff_data.identical:\n            self._fileobj.write('\\n')\n            self._writeln(\" Data contains differences:\")\n            self.diff_data.report(self._fileobj, indent=self._indent + 1)"},{"col":4,"comment":"\n        Convert any allowed sequence data ``col`` to a column object that can be used\n        directly in the self.columns dict.  This could be a Column, MaskedColumn,\n        or mixin column.\n\n        The final column name is determined by::\n\n            name or data.info.name or def_name\n\n        If ``data`` has no ``info`` then ``name = name or def_name``.\n\n        The behavior of ``copy`` for Column objects is:\n        - copy=True: new class instance with a copy of data and deep copy of meta\n        - copy=False: new class instance with same data and a key-only copy of meta\n\n        For mixin columns:\n        - copy=True: new class instance with copy of data and deep copy of meta\n        - copy=False: original instance (no copy at all)\n\n        Parameters\n        ----------\n        data : object (column-like sequence)\n            Input column data\n        copy : bool\n            Make a copy\n        default_name : str\n            Default name\n        dtype : np.dtype or None\n            Data dtype\n        name : str or None\n            Column name\n\n        Returns\n        -------\n        col : Column, MaskedColumn, mixin-column type\n            Object that can be used as a column in self\n        ","endLoc":1324,"header":"def _convert_data_to_col(self, data, copy=True, default_name=None, dtype=None, name=None)","id":1858,"name":"_convert_data_to_col","nodeType":"Function","startLoc":1179,"text":"def _convert_data_to_col(self, data, copy=True, default_name=None, dtype=None, name=None):\n        \"\"\"\n        Convert any allowed sequence data ``col`` to a column object that can be used\n        directly in the self.columns dict.  This could be a Column, MaskedColumn,\n        or mixin column.\n\n        The final column name is determined by::\n\n            name or data.info.name or def_name\n\n        If ``data`` has no ``info`` then ``name = name or def_name``.\n\n        The behavior of ``copy`` for Column objects is:\n        - copy=True: new class instance with a copy of data and deep copy of meta\n        - copy=False: new class instance with same data and a key-only copy of meta\n\n        For mixin columns:\n        - copy=True: new class instance with copy of data and deep copy of meta\n        - copy=False: original instance (no copy at all)\n\n        Parameters\n        ----------\n        data : object (column-like sequence)\n            Input column data\n        copy : bool\n            Make a copy\n        default_name : str\n            Default name\n        dtype : np.dtype or None\n            Data dtype\n        name : str or None\n            Column name\n\n        Returns\n        -------\n        col : Column, MaskedColumn, mixin-column type\n            Object that can be used as a column in self\n        \"\"\"\n\n        data_is_mixin = self._is_mixin_for_table(data)\n        masked_col_cls = (self.ColumnClass\n                          if issubclass(self.ColumnClass, self.MaskedColumn)\n                          else self.MaskedColumn)\n\n        try:\n            data0_is_mixin = self._is_mixin_for_table(data[0])\n        except Exception:\n            # Need broad exception, cannot predict what data[0] raises for arbitrary data\n            data0_is_mixin = False\n\n        # If the data is not an instance of Column or a mixin class, we can\n        # check the registry of mixin 'handlers' to see if the column can be\n        # converted to a mixin class\n        if (handler := get_mixin_handler(data)) is not None:\n            original_data = data\n            data = handler(data)\n            if not (data_is_mixin := self._is_mixin_for_table(data)):\n                fully_qualified_name = (original_data.__class__.__module__ + '.'\n                                        + original_data.__class__.__name__)\n                raise TypeError('Mixin handler for object of type '\n                                f'{fully_qualified_name} '\n                                'did not return a valid mixin column')\n\n        # Structured ndarray gets viewed as a mixin unless already a valid\n        # mixin class\n        if (not isinstance(data, Column) and not data_is_mixin\n                and isinstance(data, np.ndarray) and len(data.dtype) > 1):\n            data = data.view(NdarrayMixin)\n            data_is_mixin = True\n\n        # Get the final column name using precedence.  Some objects may not\n        # have an info attribute. Also avoid creating info as a side effect.\n        if not name:\n            if isinstance(data, Column):\n                name = data.name or default_name\n            elif 'info' in getattr(data, '__dict__', ()):\n                name = data.info.name or default_name\n            else:\n                name = default_name\n\n        if isinstance(data, Column):\n            # If self.ColumnClass is a subclass of col, then \"upgrade\" to ColumnClass,\n            # otherwise just use the original class.  The most common case is a\n            # table with masked=True and ColumnClass=MaskedColumn.  Then a Column\n            # gets upgraded to MaskedColumn, but the converse (pre-4.0) behavior\n            # of downgrading from MaskedColumn to Column (for non-masked table)\n            # does not happen.\n            col_cls = self._get_col_cls_for_table(data)\n\n        elif data_is_mixin:\n            # Copy the mixin column attributes if they exist since the copy below\n            # may not get this attribute.\n            col = col_copy(data, copy_indices=self._init_indices) if copy else data\n            col.info.name = name\n            return col\n\n        elif data0_is_mixin:\n            # Handle case of a sequence of a mixin, e.g. [1*u.m, 2*u.m].\n            try:\n                col = data[0].__class__(data)\n                col.info.name = name\n                return col\n            except Exception:\n                # If that didn't work for some reason, just turn it into np.array of object\n                data = np.array(data, dtype=object)\n                col_cls = self.ColumnClass\n\n        elif isinstance(data, (np.ma.MaskedArray, Masked)):\n            # Require that col_cls be a subclass of MaskedColumn, remembering\n            # that ColumnClass could be a user-defined subclass (though more-likely\n            # could be MaskedColumn).\n            col_cls = masked_col_cls\n\n        elif data is None:\n            # Special case for data passed as the None object (for broadcasting\n            # to an object column). Need to turn data into numpy `None` scalar\n            # object, otherwise `Column` interprets data=None as no data instead\n            # of a object column of `None`.\n            data = np.array(None)\n            col_cls = self.ColumnClass\n\n        elif not hasattr(data, 'dtype'):\n            # `data` is none of the above, convert to numpy array or MaskedArray\n            # assuming only that it is a scalar or sequence or N-d nested\n            # sequence. This function is relatively intricate and tries to\n            # maintain performance for common cases while handling things like\n            # list input with embedded np.ma.masked entries. If `data` is a\n            # scalar then it gets returned unchanged so the original object gets\n            # passed to `Column` later.\n            data = _convert_sequence_data_to_array(data, dtype)\n            copy = False  # Already made a copy above\n            col_cls = masked_col_cls if isinstance(data, np.ma.MaskedArray) else self.ColumnClass\n\n        else:\n            col_cls = self.ColumnClass\n\n        try:\n            col = col_cls(name=name, data=data, dtype=dtype,\n                          copy=copy, copy_indices=self._init_indices)\n        except Exception:\n            # Broad exception class since we don't know what might go wrong\n            raise ValueError('unable to convert data to Column for Table')\n\n        col = self._convert_col_for_table(col)\n\n        return col"},{"attributeType":"null","col":8,"comment":"null","endLoc":520,"id":1859,"name":"ignore_blanks","nodeType":"Attribute","startLoc":520,"text":"self.ignore_blanks"},{"attributeType":"null","col":8,"comment":"null","endLoc":523,"id":1860,"name":"diff_extnames","nodeType":"Attribute","startLoc":523,"text":"self.diff_extnames"},{"attributeType":"null","col":8,"comment":"null","endLoc":512,"id":1861,"name":"ignore_keywords","nodeType":"Attribute","startLoc":512,"text":"self.ignore_keywords"},{"attributeType":"null","col":8,"comment":"null","endLoc":521,"id":1862,"name":"ignore_blank_cards","nodeType":"Attribute","startLoc":521,"text":"self.ignore_blank_cards"},{"attributeType":"null","col":8,"comment":"null","endLoc":519,"id":1863,"name":"numdiffs","nodeType":"Attribute","startLoc":519,"text":"self.numdiffs"},{"attributeType":"null","col":8,"comment":"null","endLoc":516,"id":1864,"name":"rtol","nodeType":"Attribute","startLoc":516,"text":"self.rtol"},{"attributeType":"null","col":8,"comment":"null","endLoc":524,"id":1865,"name":"diff_extvers","nodeType":"Attribute","startLoc":524,"text":"self.diff_extvers"},{"attributeType":"null","col":8,"comment":"null","endLoc":525,"id":1866,"name":"diff_extlevels","nodeType":"Attribute","startLoc":525,"text":"self.diff_extlevels"},{"attributeType":"null","col":8,"comment":"null","endLoc":528,"id":1867,"name":"diff_data","nodeType":"Attribute","startLoc":528,"text":"self.diff_data"},{"attributeType":"null","col":8,"comment":"null","endLoc":527,"id":1868,"name":"diff_headers","nodeType":"Attribute","startLoc":527,"text":"self.diff_headers"},{"attributeType":"null","col":8,"comment":"null","endLoc":513,"id":1869,"name":"ignore_comments","nodeType":"Attribute","startLoc":513,"text":"self.ignore_comments"},{"attributeType":"null","col":8,"comment":"null","endLoc":517,"id":1870,"name":"atol","nodeType":"Attribute","startLoc":517,"text":"self.atol"},{"attributeType":"null","col":8,"comment":"null","endLoc":526,"id":1871,"name":"diff_extension_types","nodeType":"Attribute","startLoc":526,"text":"self.diff_extension_types"},{"attributeType":"null","col":8,"comment":"null","endLoc":514,"id":1872,"name":"ignore_fields","nodeType":"Attribute","startLoc":514,"text":"self.ignore_fields"},{"col":4,"comment":"\n        Determine if ``col`` should be added to the table directly as\n        a mixin column.\n        ","endLoc":1590,"header":"def _is_mixin_for_table(self, col)","id":1873,"name":"_is_mixin_for_table","nodeType":"Function","startLoc":1580,"text":"def _is_mixin_for_table(self, col):\n        \"\"\"\n        Determine if ``col`` should be added to the table directly as\n        a mixin column.\n        \"\"\"\n        if isinstance(col, BaseColumn):\n            return False\n\n        # Is it a mixin but not [Masked]Quantity (which gets converted to\n        # [Masked]Column with unit set).\n        return has_info_class(col, MixinInfo) and not has_info_class(col, QuantityInfo)"},{"col":0,"comment":"\n    Retrieves a data file from the standard locations for the package and\n    provides the file as a file-like object that reads bytes.\n\n    Parameters\n    ----------\n    data_name : str\n        Name/location of the desired data file.  One of the following:\n\n            * The name of a data file included in the source\n              distribution.  The path is relative to the module\n              calling this function.  For example, if calling from\n              ``astropy.pkname``, use ``'data/file.dat'`` to get the\n              file in ``astropy/pkgname/data/file.dat``.  Double-dots\n              can be used to go up a level.  In the same example, use\n              ``'../data/file.dat'`` to get ``astropy/data/file.dat``.\n            * If a matching local file does not exist, the Astropy\n              data server will be queried for the file.\n            * A hash like that produced by `compute_hash` can be\n              requested, prefixed by 'hash/'\n              e.g. 'hash/34c33b3eb0d56eb9462003af249eff28'.  The hash\n              will first be searched for locally, and if not found,\n              the Astropy data server will be queried.\n\n    package : str, optional\n        If specified, look for a file relative to the given package, rather\n        than the default of looking relative to the calling module's package.\n\n    encoding : str, optional\n        When `None` (default), returns a file-like object with a\n        ``read`` method returns `str` (``unicode``) objects, using\n        `locale.getpreferredencoding` as an encoding.  This matches\n        the default behavior of the built-in `open` when no ``mode``\n        argument is provided.\n\n        When ``'binary'``, returns a file-like object where its ``read``\n        method returns `bytes` objects.\n\n        When another string, it is the name of an encoding, and the\n        file-like object's ``read`` method will return `str` (``unicode``)\n        objects, decoded from binary using the given encoding.\n\n    cache : bool\n        If True, the file will be downloaded and saved locally or the\n        already-cached local copy will be accessed. If False, the\n        file-like object will directly access the resource (e.g. if a\n        remote URL is accessed, an object like that from\n        `urllib.request.urlopen` is returned).\n\n    Returns\n    -------\n    fileobj : file-like\n        An object with the contents of the data file available via\n        ``read`` function.  Can be used as part of a ``with`` statement,\n        automatically closing itself after the ``with`` block.\n\n    Raises\n    ------\n    urllib.error.URLError\n        If a remote file cannot be found.\n    OSError\n        If problems occur writing or reading a local file.\n\n    Examples\n    --------\n\n    This will retrieve a data file and its contents for the `astropy.wcs`\n    tests::\n\n        >>> from astropy.utils.data import get_pkg_data_fileobj\n        >>> with get_pkg_data_fileobj('data/3d_cd.hdr',\n        ...                           package='astropy.wcs.tests') as fobj:\n        ...     fcontents = fobj.read()\n        ...\n\n    This next example would download a data file from the astropy data server\n    because the ``allsky/allsky_rosat.fits`` file is not present in the\n    source distribution.  It will also save the file locally so the\n    next time it is accessed it won't need to be downloaded.::\n\n        >>> from astropy.utils.data import get_pkg_data_fileobj\n        >>> with get_pkg_data_fileobj('allsky/allsky_rosat.fits',\n        ...                           encoding='binary') as fobj:  # doctest: +REMOTE_DATA +IGNORE_OUTPUT\n        ...     fcontents = fobj.read()\n        ...\n        Downloading http://data.astropy.org/allsky/allsky_rosat.fits [Done]\n\n    This does the same thing but does *not* cache it locally::\n\n        >>> with get_pkg_data_fileobj('allsky/allsky_rosat.fits',\n        ...                           encoding='binary', cache=False) as fobj:  # doctest: +REMOTE_DATA +IGNORE_OUTPUT\n        ...     fcontents = fobj.read()\n        ...\n        Downloading http://data.astropy.org/allsky/allsky_rosat.fits [Done]\n\n    See Also\n    --------\n    get_pkg_data_contents : returns the contents of a file or url as a bytes object\n    get_pkg_data_filename : returns a local name for a file containing the data\n    ","endLoc":541,"header":"@contextlib.contextmanager\ndef get_pkg_data_fileobj(data_name, package=None, encoding=None, cache=True)","id":1874,"name":"get_pkg_data_fileobj","nodeType":"Function","startLoc":420,"text":"@contextlib.contextmanager\ndef get_pkg_data_fileobj(data_name, package=None, encoding=None, cache=True):\n    \"\"\"\n    Retrieves a data file from the standard locations for the package and\n    provides the file as a file-like object that reads bytes.\n\n    Parameters\n    ----------\n    data_name : str\n        Name/location of the desired data file.  One of the following:\n\n            * The name of a data file included in the source\n              distribution.  The path is relative to the module\n              calling this function.  For example, if calling from\n              ``astropy.pkname``, use ``'data/file.dat'`` to get the\n              file in ``astropy/pkgname/data/file.dat``.  Double-dots\n              can be used to go up a level.  In the same example, use\n              ``'../data/file.dat'`` to get ``astropy/data/file.dat``.\n            * If a matching local file does not exist, the Astropy\n              data server will be queried for the file.\n            * A hash like that produced by `compute_hash` can be\n              requested, prefixed by 'hash/'\n              e.g. 'hash/34c33b3eb0d56eb9462003af249eff28'.  The hash\n              will first be searched for locally, and if not found,\n              the Astropy data server will be queried.\n\n    package : str, optional\n        If specified, look for a file relative to the given package, rather\n        than the default of looking relative to the calling module's package.\n\n    encoding : str, optional\n        When `None` (default), returns a file-like object with a\n        ``read`` method returns `str` (``unicode``) objects, using\n        `locale.getpreferredencoding` as an encoding.  This matches\n        the default behavior of the built-in `open` when no ``mode``\n        argument is provided.\n\n        When ``'binary'``, returns a file-like object where its ``read``\n        method returns `bytes` objects.\n\n        When another string, it is the name of an encoding, and the\n        file-like object's ``read`` method will return `str` (``unicode``)\n        objects, decoded from binary using the given encoding.\n\n    cache : bool\n        If True, the file will be downloaded and saved locally or the\n        already-cached local copy will be accessed. If False, the\n        file-like object will directly access the resource (e.g. if a\n        remote URL is accessed, an object like that from\n        `urllib.request.urlopen` is returned).\n\n    Returns\n    -------\n    fileobj : file-like\n        An object with the contents of the data file available via\n        ``read`` function.  Can be used as part of a ``with`` statement,\n        automatically closing itself after the ``with`` block.\n\n    Raises\n    ------\n    urllib.error.URLError\n        If a remote file cannot be found.\n    OSError\n        If problems occur writing or reading a local file.\n\n    Examples\n    --------\n\n    This will retrieve a data file and its contents for the `astropy.wcs`\n    tests::\n\n        >>> from astropy.utils.data import get_pkg_data_fileobj\n        >>> with get_pkg_data_fileobj('data/3d_cd.hdr',\n        ...                           package='astropy.wcs.tests') as fobj:\n        ...     fcontents = fobj.read()\n        ...\n\n    This next example would download a data file from the astropy data server\n    because the ``allsky/allsky_rosat.fits`` file is not present in the\n    source distribution.  It will also save the file locally so the\n    next time it is accessed it won't need to be downloaded.::\n\n        >>> from astropy.utils.data import get_pkg_data_fileobj\n        >>> with get_pkg_data_fileobj('allsky/allsky_rosat.fits',\n        ...                           encoding='binary') as fobj:  # doctest: +REMOTE_DATA +IGNORE_OUTPUT\n        ...     fcontents = fobj.read()\n        ...\n        Downloading http://data.astropy.org/allsky/allsky_rosat.fits [Done]\n\n    This does the same thing but does *not* cache it locally::\n\n        >>> with get_pkg_data_fileobj('allsky/allsky_rosat.fits',\n        ...                           encoding='binary', cache=False) as fobj:  # doctest: +REMOTE_DATA +IGNORE_OUTPUT\n        ...     fcontents = fobj.read()\n        ...\n        Downloading http://data.astropy.org/allsky/allsky_rosat.fits [Done]\n\n    See Also\n    --------\n    get_pkg_data_contents : returns the contents of a file or url as a bytes object\n    get_pkg_data_filename : returns a local name for a file containing the data\n    \"\"\"  # noqa\n\n    datafn = get_pkg_data_path(data_name, package=package)\n    if os.path.isdir(datafn):\n        raise OSError(\"Tried to access a data file that's actually \"\n                      \"a package data directory\")\n    elif os.path.isfile(datafn):  # local file\n        with get_readable_fileobj(datafn, encoding=encoding) as fileobj:\n            yield fileobj\n    else:  # remote file\n        with get_readable_fileobj(\n            conf.dataurl + data_name,\n            encoding=encoding,\n            cache=cache,\n            sources=[conf.dataurl + data_name,\n                     conf.dataurl_mirror + data_name],\n        ) as fileobj:\n            # We read a byte to trigger any URLErrors\n            fileobj.read(1)\n            fileobj.seek(0)\n            yield fileobj"},{"col":4,"comment":"\n        Return raw array from either the HDU's memory buffer or underlying\n        file.\n        ","endLoc":524,"header":"def _get_raw_data(self, shape, code, offset)","id":1875,"name":"_get_raw_data","nodeType":"Function","startLoc":509,"text":"def _get_raw_data(self, shape, code, offset):\n        \"\"\"\n        Return raw array from either the HDU's memory buffer or underlying\n        file.\n        \"\"\"\n\n        if isinstance(shape, int):\n            shape = (shape,)\n\n        if self._buffer:\n            return np.ndarray(shape, dtype=code, buffer=self._buffer,\n                              offset=offset)\n        elif self._file:\n            return self._file.readarray(offset=offset, dtype=code, shape=shape)\n        else:\n            return None"},{"className":"_ValidHDU","col":0,"comment":"\n    Base class for all HDUs which are not corrupted.\n    ","endLoc":1540,"id":1876,"nodeType":"Class","startLoc":900,"text":"class _ValidHDU(_BaseHDU, _Verify):\n    \"\"\"\n    Base class for all HDUs which are not corrupted.\n    \"\"\"\n\n    def __init__(self, data=None, header=None, name=None, ver=None, **kwargs):\n        super().__init__(data=data, header=header)\n\n        if (header is not None and\n                not isinstance(header, (Header, _BasicHeader))):\n            # TODO: Instead maybe try initializing a new Header object from\n            # whatever is passed in as the header--there are various types\n            # of objects that could work for this...\n            raise ValueError('header must be a Header object')\n\n        # NOTE:  private data members _checksum and _datasum are used by the\n        # utility script \"fitscheck\" to detect missing checksums.\n        self._checksum = None\n        self._checksum_valid = None\n        self._datasum = None\n        self._datasum_valid = None\n\n        if name is not None:\n            self.name = name\n        if ver is not None:\n            self.ver = ver\n\n    @classmethod\n    def match_header(cls, header):\n        \"\"\"\n        Matches any HDU that is not recognized as having either the SIMPLE or\n        XTENSION keyword in its header's first card, but is nonetheless not\n        corrupted.\n\n        TODO: Maybe it would make more sense to use _NonstandardHDU in this\n        case?  Not sure...\n        \"\"\"\n\n        return first(header.keys()) not in ('SIMPLE', 'XTENSION')\n\n    @property\n    def size(self):\n        \"\"\"\n        Size (in bytes) of the data portion of the HDU.\n        \"\"\"\n\n        size = 0\n        naxis = self._header.get('NAXIS', 0)\n        if naxis > 0:\n            size = 1\n            for idx in range(naxis):\n                size = size * self._header['NAXIS' + str(idx + 1)]\n            bitpix = self._header['BITPIX']\n            gcount = self._header.get('GCOUNT', 1)\n            pcount = self._header.get('PCOUNT', 0)\n            size = abs(bitpix) * gcount * (pcount + size) // 8\n        return size\n\n    def filebytes(self):\n        \"\"\"\n        Calculates and returns the number of bytes that this HDU will write to\n        a file.\n        \"\"\"\n\n        f = _File()\n        # TODO: Fix this once new HDU writing API is settled on\n        return self._writeheader(f)[1] + self._writedata(f)[1]\n\n    def fileinfo(self):\n        \"\"\"\n        Returns a dictionary detailing information about the locations\n        of this HDU within any associated file.  The values are only\n        valid after a read or write of the associated file with no\n        intervening changes to the `HDUList`.\n\n        Returns\n        -------\n        dict or None\n            The dictionary details information about the locations of\n            this HDU within an associated file.  Returns `None` when\n            the HDU is not associated with a file.\n\n            Dictionary contents:\n\n            ========== ================================================\n            Key        Value\n            ========== ================================================\n            file       File object associated with the HDU\n            filemode   Mode in which the file was opened (readonly, copyonwrite,\n                       update, append, ostream)\n            hdrLoc     Starting byte location of header in file\n            datLoc     Starting byte location of data block in file\n            datSpan    Data size including padding\n            ========== ================================================\n        \"\"\"\n\n        if hasattr(self, '_file') and self._file:\n            return {'file': self._file, 'filemode': self._file.mode,\n                    'hdrLoc': self._header_offset, 'datLoc': self._data_offset,\n                    'datSpan': self._data_size}\n        else:\n            return None\n\n    def copy(self):\n        \"\"\"\n        Make a copy of the HDU, both header and data are copied.\n        \"\"\"\n\n        if self.data is not None:\n            data = self.data.copy()\n        else:\n            data = None\n        return self.__class__(data=data, header=self._header.copy())\n\n    def _verify(self, option='warn'):\n        errs = _ErrList([], unit='Card')\n\n        is_valid = BITPIX2DTYPE.__contains__\n\n        # Verify location and value of mandatory keywords.\n        # Do the first card here, instead of in the respective HDU classes, so\n        # the checking is in order, in case of required cards in wrong order.\n        if isinstance(self, ExtensionHDU):\n            firstkey = 'XTENSION'\n            firstval = self._extension\n        else:\n            firstkey = 'SIMPLE'\n            firstval = True\n\n        self.req_cards(firstkey, 0, None, firstval, option, errs)\n        self.req_cards('BITPIX', 1, lambda v: (_is_int(v) and is_valid(v)), 8,\n                       option, errs)\n        self.req_cards('NAXIS', 2,\n                       lambda v: (_is_int(v) and 0 <= v <= 999), 0,\n                       option, errs)\n\n        naxis = self._header.get('NAXIS', 0)\n        if naxis < 1000:\n            for ax in range(3, naxis + 3):\n                key = 'NAXIS' + str(ax - 2)\n                self.req_cards(key, ax,\n                               lambda v: (_is_int(v) and v >= 0),\n                               _extract_number(self._header[key], default=1),\n                               option, errs)\n\n            # Remove NAXISj cards where j is not in range 1, naxis inclusive.\n            for keyword in self._header:\n                if keyword.startswith('NAXIS') and len(keyword) > 5:\n                    try:\n                        number = int(keyword[5:])\n                        if number <= 0 or number > naxis:\n                            raise ValueError\n                    except ValueError:\n                        err_text = (\"NAXISj keyword out of range ('{}' when \"\n                                    \"NAXIS == {})\".format(keyword, naxis))\n\n                        def fix(self=self, keyword=keyword):\n                            del self._header[keyword]\n\n                        errs.append(\n                            self.run_option(option=option, err_text=err_text,\n                                            fix=fix, fix_text=\"Deleted.\"))\n\n        # Verify that the EXTNAME keyword exists and is a string\n        if 'EXTNAME' in self._header:\n            if not isinstance(self._header['EXTNAME'], str):\n                err_text = 'The EXTNAME keyword must have a string value.'\n                fix_text = 'Converted the EXTNAME keyword to a string value.'\n\n                def fix(header=self._header):\n                    header['EXTNAME'] = str(header['EXTNAME'])\n\n                errs.append(self.run_option(option, err_text=err_text,\n                                            fix_text=fix_text, fix=fix))\n\n        # verify each card\n        for card in self._header.cards:\n            errs.append(card._verify(option))\n\n        return errs\n\n    # TODO: Improve this API a little bit--for one, most of these arguments\n    # could be optional\n    def req_cards(self, keyword, pos, test, fix_value, option, errlist):\n        \"\"\"\n        Check the existence, location, and value of a required `Card`.\n\n        Parameters\n        ----------\n        keyword : str\n            The keyword to validate\n\n        pos : int, callable\n            If an ``int``, this specifies the exact location this card should\n            have in the header.  Remember that Python is zero-indexed, so this\n            means ``pos=0`` requires the card to be the first card in the\n            header.  If given a callable, it should take one argument--the\n            actual position of the keyword--and return `True` or `False`.  This\n            can be used for custom evaluation.  For example if\n            ``pos=lambda idx: idx > 10`` this will check that the keyword's\n            index is greater than 10.\n\n        test : callable\n            This should be a callable (generally a function) that is passed the\n            value of the given keyword and returns `True` or `False`.  This can\n            be used to validate the value associated with the given keyword.\n\n        fix_value : str, int, float, complex, bool, None\n            A valid value for a FITS keyword to to use if the given ``test``\n            fails to replace an invalid value.  In other words, this provides\n            a default value to use as a replacement if the keyword's current\n            value is invalid.  If `None`, there is no replacement value and the\n            keyword is unfixable.\n\n        option : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        errlist : list\n            A list of validation errors already found in the FITS file; this is\n            used primarily for the validation system to collect errors across\n            multiple HDUs and multiple calls to `req_cards`.\n\n        Notes\n        -----\n        If ``pos=None``, the card can be anywhere in the header.  If the card\n        does not exist, the new card will have the ``fix_value`` as its value\n        when created.  Also check the card's value by using the ``test``\n        argument.\n        \"\"\"\n\n        errs = errlist\n        fix = None\n\n        try:\n            index = self._header.index(keyword)\n        except ValueError:\n            index = None\n\n        fixable = fix_value is not None\n\n        insert_pos = len(self._header) + 1\n\n        # If pos is an int, insert at the given position (and convert it to a\n        # lambda)\n        if _is_int(pos):\n            insert_pos = pos\n            pos = lambda x: x == insert_pos\n\n        # if the card does not exist\n        if index is None:\n            err_text = f\"'{keyword}' card does not exist.\"\n            fix_text = f\"Fixed by inserting a new '{keyword}' card.\"\n            if fixable:\n                # use repr to accommodate both string and non-string types\n                # Boolean is also OK in this constructor\n                card = (keyword, fix_value)\n\n                def fix(self=self, insert_pos=insert_pos, card=card):\n                    self._header.insert(insert_pos, card)\n\n            errs.append(self.run_option(option, err_text=err_text,\n                        fix_text=fix_text, fix=fix, fixable=fixable))\n        else:\n            # if the supposed location is specified\n            if pos is not None:\n                if not pos(index):\n                    err_text = f\"'{keyword}' card at the wrong place (card {index}).\"\n                    fix_text = f\"Fixed by moving it to the right place (card {insert_pos}).\"\n\n                    def fix(self=self, index=index, insert_pos=insert_pos):\n                        card = self._header.cards[index]\n                        del self._header[index]\n                        self._header.insert(insert_pos, card)\n\n                    errs.append(self.run_option(option, err_text=err_text,\n                                fix_text=fix_text, fix=fix))\n\n            # if value checking is specified\n            if test:\n                val = self._header[keyword]\n                if not test(val):\n                    err_text = f\"'{keyword}' card has invalid value '{val}'.\"\n                    fix_text = f\"Fixed by setting a new value '{fix_value}'.\"\n\n                    if fixable:\n                        def fix(self=self, keyword=keyword, val=fix_value):\n                            self._header[keyword] = fix_value\n\n                    errs.append(self.run_option(option, err_text=err_text,\n                                fix_text=fix_text, fix=fix, fixable=fixable))\n\n        return errs\n\n    def add_datasum(self, when=None, datasum_keyword='DATASUM'):\n        \"\"\"\n        Add the ``DATASUM`` card to this HDU with the value set to the\n        checksum calculated for the data.\n\n        Parameters\n        ----------\n        when : str, optional\n            Comment string for the card that by default represents the\n            time when the checksum was calculated\n\n        datasum_keyword : str, optional\n            The name of the header keyword to store the datasum value in;\n            this is typically 'DATASUM' per convention, but there exist\n            use cases in which a different keyword should be used\n\n        Returns\n        -------\n        checksum : int\n            The calculated datasum\n\n        Notes\n        -----\n        For testing purposes, provide a ``when`` argument to enable the comment\n        value in the card to remain consistent.  This will enable the\n        generation of a ``CHECKSUM`` card with a consistent value.\n        \"\"\"\n\n        cs = self._calculate_datasum()\n\n        if when is None:\n            when = f'data unit checksum updated {self._get_timestamp()}'\n\n        self._header[datasum_keyword] = (str(cs), when)\n        return cs\n\n    def add_checksum(self, when=None, override_datasum=False,\n                     checksum_keyword='CHECKSUM', datasum_keyword='DATASUM'):\n        \"\"\"\n        Add the ``CHECKSUM`` and ``DATASUM`` cards to this HDU with\n        the values set to the checksum calculated for the HDU and the\n        data respectively.  The addition of the ``DATASUM`` card may\n        be overridden.\n\n        Parameters\n        ----------\n        when : str, optional\n            comment string for the cards; by default the comments\n            will represent the time when the checksum was calculated\n        override_datasum : bool, optional\n            add the ``CHECKSUM`` card only\n        checksum_keyword : str, optional\n            The name of the header keyword to store the checksum value in; this\n            is typically 'CHECKSUM' per convention, but there exist use cases\n            in which a different keyword should be used\n\n        datasum_keyword : str, optional\n            See ``checksum_keyword``\n\n        Notes\n        -----\n        For testing purposes, first call `add_datasum` with a ``when``\n        argument, then call `add_checksum` with a ``when`` argument and\n        ``override_datasum`` set to `True`.  This will provide consistent\n        comments for both cards and enable the generation of a ``CHECKSUM``\n        card with a consistent value.\n        \"\"\"\n\n        if not override_datasum:\n            # Calculate and add the data checksum to the header.\n            data_cs = self.add_datasum(when, datasum_keyword=datasum_keyword)\n        else:\n            # Just calculate the data checksum\n            data_cs = self._calculate_datasum()\n\n        if when is None:\n            when = f'HDU checksum updated {self._get_timestamp()}'\n\n        # Add the CHECKSUM card to the header with a value of all zeros.\n        if datasum_keyword in self._header:\n            self._header.set(checksum_keyword, '0' * 16, when,\n                             before=datasum_keyword)\n        else:\n            self._header.set(checksum_keyword, '0' * 16, when)\n\n        csum = self._calculate_checksum(data_cs,\n                                        checksum_keyword=checksum_keyword)\n        self._header[checksum_keyword] = csum\n\n    def verify_datasum(self):\n        \"\"\"\n        Verify that the value in the ``DATASUM`` keyword matches the value\n        calculated for the ``DATASUM`` of the current HDU data.\n\n        Returns\n        -------\n        valid : int\n            - 0 - failure\n            - 1 - success\n            - 2 - no ``DATASUM`` keyword present\n        \"\"\"\n\n        if 'DATASUM' in self._header:\n            datasum = self._calculate_datasum()\n            if datasum == int(self._header['DATASUM']):\n                return 1\n            else:\n                # Failed\n                return 0\n        else:\n            return 2\n\n    def verify_checksum(self):\n        \"\"\"\n        Verify that the value in the ``CHECKSUM`` keyword matches the\n        value calculated for the current HDU CHECKSUM.\n\n        Returns\n        -------\n        valid : int\n            - 0 - failure\n            - 1 - success\n            - 2 - no ``CHECKSUM`` keyword present\n        \"\"\"\n\n        if 'CHECKSUM' in self._header:\n            if 'DATASUM' in self._header:\n                datasum = self._calculate_datasum()\n            else:\n                datasum = 0\n            checksum = self._calculate_checksum(datasum)\n            if checksum == self._header['CHECKSUM']:\n                return 1\n            else:\n                # Failed\n                return 0\n        else:\n            return 2\n\n    def _verify_checksum_datasum(self):\n        \"\"\"\n        Verify the checksum/datasum values if the cards exist in the header.\n        Simply displays warnings if either the checksum or datasum don't match.\n        \"\"\"\n\n        if 'CHECKSUM' in self._header:\n            self._checksum = self._header['CHECKSUM']\n            self._checksum_valid = self.verify_checksum()\n            if not self._checksum_valid:\n                warnings.warn(\n                    'Checksum verification failed for HDU {}.\\n'.format(\n                        (self.name, self.ver)), AstropyUserWarning)\n\n        if 'DATASUM' in self._header:\n            self._datasum = self._header['DATASUM']\n            self._datasum_valid = self.verify_datasum()\n            if not self._datasum_valid:\n                warnings.warn(\n                    'Datasum verification failed for HDU {}.\\n'.format(\n                        (self.name, self.ver)), AstropyUserWarning)\n\n    def _get_timestamp(self):\n        \"\"\"\n        Return the current timestamp in ISO 8601 format, with microseconds\n        stripped off.\n\n        Ex.: 2007-05-30T19:05:11\n        \"\"\"\n\n        return datetime.datetime.now().isoformat()[:19]\n\n    def _calculate_datasum(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        \"\"\"\n\n        if not self._data_loaded:\n            # This is the case where the data has not been read from the file\n            # yet.  We find the data in the file, read it, and calculate the\n            # datasum.\n            if self.size > 0:\n                raw_data = self._get_raw_data(self._data_size, 'ubyte',\n                                              self._data_offset)\n                return self._compute_checksum(raw_data)\n            else:\n                return 0\n        elif self.data is not None:\n            return self._compute_checksum(self.data.view('ubyte'))\n        else:\n            return 0\n\n    def _calculate_checksum(self, datasum, checksum_keyword='CHECKSUM'):\n        \"\"\"\n        Calculate the value of the ``CHECKSUM`` card in the HDU.\n        \"\"\"\n\n        old_checksum = self._header[checksum_keyword]\n        self._header[checksum_keyword] = '0' * 16\n\n        # Convert the header to bytes.\n        s = self._header.tostring().encode('utf8')\n\n        # Calculate the checksum of the Header and data.\n        cs = self._compute_checksum(np.frombuffer(s, dtype='ubyte'), datasum)\n\n        # Encode the checksum into a string.\n        s = self._char_encode(~cs)\n\n        # Return the header card value.\n        self._header[checksum_keyword] = old_checksum\n\n        return s\n\n    def _compute_checksum(self, data, sum32=0):\n        \"\"\"\n        Compute the ones-complement checksum of a sequence of bytes.\n\n        Parameters\n        ----------\n        data\n            a memory region to checksum\n\n        sum32\n            incremental checksum value from another region\n\n        Returns\n        -------\n        ones complement checksum\n        \"\"\"\n\n        blocklen = 2880\n        sum32 = np.uint32(sum32)\n        for i in range(0, len(data), blocklen):\n            length = min(blocklen, len(data) - i)   # ????\n            sum32 = self._compute_hdu_checksum(data[i:i + length], sum32)\n        return sum32\n\n    def _compute_hdu_checksum(self, data, sum32=0):\n        \"\"\"\n        Translated from FITS Checksum Proposal by Seaman, Pence, and Rots.\n        Use uint32 literals as a hedge against type promotion to int64.\n\n        This code should only be called with blocks of 2880 bytes\n        Longer blocks result in non-standard checksums with carry overflow\n        Historically,  this code *was* called with larger blocks and for that\n        reason still needs to be for backward compatibility.\n        \"\"\"\n\n        u8 = np.uint32(8)\n        u16 = np.uint32(16)\n        uFFFF = np.uint32(0xFFFF)\n\n        if data.nbytes % 2:\n            last = data[-1]\n            data = data[:-1]\n        else:\n            last = np.uint32(0)\n\n        data = data.view('>u2')\n\n        hi = sum32 >> u16\n        lo = sum32 & uFFFF\n        hi += np.add.reduce(data[0::2], dtype=np.uint64)\n        lo += np.add.reduce(data[1::2], dtype=np.uint64)\n\n        if (data.nbytes // 2) % 2:\n            lo += last << u8\n        else:\n            hi += last << u8\n\n        hicarry = hi >> u16\n        locarry = lo >> u16\n\n        while hicarry or locarry:\n            hi = (hi & uFFFF) + locarry\n            lo = (lo & uFFFF) + hicarry\n            hicarry = hi >> u16\n            locarry = lo >> u16\n\n        return (hi << u16) + lo\n\n    # _MASK and _EXCLUDE used for encoding the checksum value into a character\n    # string.\n    _MASK = [0xFF000000,\n             0x00FF0000,\n             0x0000FF00,\n             0x000000FF]\n\n    _EXCLUDE = [0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40,\n                0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60]\n\n    def _encode_byte(self, byte):\n        \"\"\"\n        Encode a single byte.\n        \"\"\"\n\n        quotient = byte // 4 + ord('0')\n        remainder = byte % 4\n\n        ch = np.array(\n            [(quotient + remainder), quotient, quotient, quotient],\n            dtype='int32')\n\n        check = True\n        while check:\n            check = False\n            for x in self._EXCLUDE:\n                for j in [0, 2]:\n                    if ch[j] == x or ch[j + 1] == x:\n                        ch[j] += 1\n                        ch[j + 1] -= 1\n                        check = True\n        return ch\n\n    def _char_encode(self, value):\n        \"\"\"\n        Encodes the checksum ``value`` using the algorithm described\n        in SPR section A.7.2 and returns it as a 16 character string.\n\n        Parameters\n        ----------\n        value\n            a checksum\n\n        Returns\n        -------\n        ascii encoded checksum\n        \"\"\"\n\n        value = np.uint32(value)\n\n        asc = np.zeros((16,), dtype='byte')\n        ascii = np.zeros((16,), dtype='byte')\n\n        for i in range(4):\n            byte = (value & self._MASK[i]) >> ((3 - i) * 8)\n            ch = self._encode_byte(byte)\n            for j in range(4):\n                asc[4 * j + i] = ch[j]\n\n        for i in range(16):\n            ascii[i] = asc[(i + 15) % 16]\n\n        return decode_ascii(ascii.tobytes())"},{"col":4,"comment":"\n        Matches any HDU that is not recognized as having either the SIMPLE or\n        XTENSION keyword in its header's first card, but is nonetheless not\n        corrupted.\n\n        TODO: Maybe it would make more sense to use _NonstandardHDU in this\n        case?  Not sure...\n        ","endLoc":938,"header":"@classmethod\n    def match_header(cls, header)","id":1877,"name":"match_header","nodeType":"Function","startLoc":927,"text":"@classmethod\n    def match_header(cls, header):\n        \"\"\"\n        Matches any HDU that is not recognized as having either the SIMPLE or\n        XTENSION keyword in its header's first card, but is nonetheless not\n        corrupted.\n\n        TODO: Maybe it would make more sense to use _NonstandardHDU in this\n        case?  Not sure...\n        \"\"\"\n\n        return first(header.keys()) not in ('SIMPLE', 'XTENSION')"},{"attributeType":"function","col":4,"comment":"null","endLoc":541,"id":1878,"name":"copy","nodeType":"Attribute","startLoc":541,"text":"copy"},{"attributeType":"null","col":12,"comment":"null","endLoc":206,"id":1879,"name":"_data","nodeType":"Attribute","startLoc":206,"text":"self._data"},{"attributeType":"null","col":12,"comment":"null","endLoc":205,"id":1880,"name":"_file","nodeType":"Attribute","startLoc":205,"text":"self._file"},{"attributeType":"null","col":8,"comment":"null","endLoc":211,"id":1881,"name":"_in_read_next_hdu","nodeType":"Attribute","startLoc":211,"text":"self._in_read_next_hdu"},{"col":4,"comment":"null","endLoc":534,"header":"def _prewriteto(self, checksum=False, inplace=False)","id":1882,"name":"_prewriteto","nodeType":"Function","startLoc":530,"text":"def _prewriteto(self, checksum=False, inplace=False):\n        self._update_pseudo_int_scale_keywords()\n\n        # Handle checksum\n        self._update_checksum(checksum)"},{"col":4,"comment":"\n        If the data is signed int 8, unsigned int 16, 32, or 64,\n        add BSCALE/BZERO cards to header.\n        ","endLoc":553,"header":"def _update_pseudo_int_scale_keywords(self)","id":1883,"name":"_update_pseudo_int_scale_keywords","nodeType":"Function","startLoc":536,"text":"def _update_pseudo_int_scale_keywords(self):\n        \"\"\"\n        If the data is signed int 8, unsigned int 16, 32, or 64,\n        add BSCALE/BZERO cards to header.\n        \"\"\"\n\n        if (self._has_data and self._standard and\n                _is_pseudo_integer(self.data.dtype)):\n            # CompImageHDUs need TFIELDS immediately after GCOUNT,\n            # so BSCALE has to go after TFIELDS if it exists.\n            if 'TFIELDS' in self._header:\n                self._header.set('BSCALE', 1, after='TFIELDS')\n            elif 'GCOUNT' in self._header:\n                self._header.set('BSCALE', 1, after='GCOUNT')\n            else:\n                self._header.set('BSCALE', 1)\n            self._header.set('BZERO', _pseudo_zero(self.data.dtype),\n                             after='BSCALE')"},{"attributeType":"null","col":8,"comment":"null","endLoc":369,"id":1884,"name":"_truncate","nodeType":"Attribute","startLoc":369,"text":"self._truncate"},{"attributeType":"null","col":12,"comment":"null","endLoc":225,"id":1885,"name":"_read_all","nodeType":"Attribute","startLoc":225,"text":"self._read_all"},{"col":4,"comment":"null","endLoc":2226,"header":"def lr0_items(self)","id":1886,"name":"lr0_items","nodeType":"Function","startLoc":2200,"text":"def lr0_items(self):\n        C = [self.lr0_closure([self.grammar.Productions[0].lr_next])]\n        i = 0\n        for I in C:\n            self.lr0_cidhash[id(I)] = i\n            i += 1\n\n        # Loop over the items in C and each grammar symbols\n        i = 0\n        while i < len(C):\n            I = C[i]\n            i += 1\n\n            # Collect all of the symbols that could possibly be in the goto(I,X) sets\n            asyms = {}\n            for ii in I:\n                for s in ii.usyms:\n                    asyms[s] = None\n\n            for x in asyms:\n                g = self.lr0_goto(I, x)\n                if not g or id(g) in self.lr0_cidhash:\n                    continue\n                self.lr0_cidhash[id(g)] = len(C)\n                C.append(g)\n\n        return C"},{"attributeType":"null","col":8,"comment":"null","endLoc":210,"id":1887,"name":"_open_kwargs","nodeType":"Attribute","startLoc":210,"text":"self._open_kwargs"},{"attributeType":"null","col":8,"comment":"null","endLoc":368,"id":1888,"name":"_resize","nodeType":"Attribute","startLoc":368,"text":"self._resize"},{"col":4,"comment":"Update the 'CHECKSUM' and 'DATASUM' keywords in the header (or\n        keywords with equivalent semantics given by the ``checksum_keyword``\n        and ``datasum_keyword`` arguments--see for example ``CompImageHDU``\n        for an example of why this might need to be overridden).\n        ","endLoc":582,"header":"def _update_checksum(self, checksum, checksum_keyword='CHECKSUM',\n                         datasum_keyword='DATASUM')","id":1889,"name":"_update_checksum","nodeType":"Function","startLoc":555,"text":"def _update_checksum(self, checksum, checksum_keyword='CHECKSUM',\n                         datasum_keyword='DATASUM'):\n        \"\"\"Update the 'CHECKSUM' and 'DATASUM' keywords in the header (or\n        keywords with equivalent semantics given by the ``checksum_keyword``\n        and ``datasum_keyword`` arguments--see for example ``CompImageHDU``\n        for an example of why this might need to be overridden).\n        \"\"\"\n\n        # If the data is loaded it isn't necessarily 'modified', but we have no\n        # way of knowing for sure\n        modified = self._header._modified or self._data_loaded\n\n        if checksum == 'remove':\n            if checksum_keyword in self._header:\n                del self._header[checksum_keyword]\n\n            if datasum_keyword in self._header:\n                del self._header[datasum_keyword]\n        elif (modified or self._new or\n                (checksum and ('CHECKSUM' not in self._header or\n                               'DATASUM' not in self._header or\n                               not self._checksum_valid or\n                               not self._datasum_valid))):\n            if checksum == 'datasum':\n                self.add_datasum(datasum_keyword=datasum_keyword)\n            elif checksum:\n                self.add_checksum(checksum_keyword=checksum_keyword,\n                                  datasum_keyword=datasum_keyword)"},{"col":4,"comment":"\n        Size (in bytes) of the data portion of the HDU.\n        ","endLoc":956,"header":"@property\n    def size(self)","id":1890,"name":"size","nodeType":"Function","startLoc":940,"text":"@property\n    def size(self):\n        \"\"\"\n        Size (in bytes) of the data portion of the HDU.\n        \"\"\"\n\n        size = 0\n        naxis = self._header.get('NAXIS', 0)\n        if naxis > 0:\n            size = 1\n            for idx in range(naxis):\n                size = size * self._header['NAXIS' + str(idx + 1)]\n            bitpix = self._header['BITPIX']\n            gcount = self._header.get('GCOUNT', 1)\n            pcount = self._header.get('PCOUNT', 0)\n            size = abs(bitpix) * gcount * (pcount + size) // 8\n        return size"},{"className":"_TableLikeHDU","col":0,"comment":"\n    A class for HDUs that have table-like data.  This is used for both\n    Binary/ASCII tables as well as Random Access Group HDUs (which are\n    otherwise too dissimilar for tables to use _TableBaseHDU directly).\n    ","endLoc":233,"id":1891,"nodeType":"Class","startLoc":46,"text":"class _TableLikeHDU(_ValidHDU):\n    \"\"\"\n    A class for HDUs that have table-like data.  This is used for both\n    Binary/ASCII tables as well as Random Access Group HDUs (which are\n    otherwise too dissimilar for tables to use _TableBaseHDU directly).\n    \"\"\"\n\n    _data_type = FITS_rec\n    _columns_type = ColDefs\n\n    # TODO: Temporary flag representing whether uints are enabled; remove this\n    # after restructuring to support uints by default on a per-column basis\n    _uint = False\n\n    @classmethod\n    def match_header(cls, header):\n        \"\"\"\n        This is an abstract HDU type for HDUs that contain table-like data.\n        This is even more abstract than _TableBaseHDU which is specifically for\n        the standard ASCII and Binary Table types.\n        \"\"\"\n\n        raise NotImplementedError\n\n    @classmethod\n    def from_columns(cls, columns, header=None, nrows=0, fill=False,\n                     character_as_bytes=False, **kwargs):\n        \"\"\"\n        Given either a `ColDefs` object, a sequence of `Column` objects,\n        or another table HDU or table data (a `FITS_rec` or multi-field\n        `numpy.ndarray` or `numpy.recarray` object, return a new table HDU of\n        the class this method was called on using the column definition from\n        the input.\n\n        See also `FITS_rec.from_columns`.\n\n        Parameters\n        ----------\n        columns : sequence of `Column`, `ColDefs` -like\n            The columns from which to create the table data, or an object with\n            a column-like structure from which a `ColDefs` can be instantiated.\n            This includes an existing `BinTableHDU` or `TableHDU`, or a\n            `numpy.recarray` to give some examples.\n\n            If these columns have data arrays attached that data may be used in\n            initializing the new table.  Otherwise the input columns will be\n            used as a template for a new table with the requested number of\n            rows.\n\n        header : `Header`\n            An optional `Header` object to instantiate the new HDU yet.  Header\n            keywords specifically related to defining the table structure (such\n            as the \"TXXXn\" keywords like TTYPEn) will be overridden by the\n            supplied column definitions, but all other informational and data\n            model-specific keywords are kept.\n\n        nrows : int\n            Number of rows in the new table.  If the input columns have data\n            associated with them, the size of the largest input column is used.\n            Otherwise the default is 0.\n\n        fill : bool\n            If `True`, will fill all cells with zeros or blanks.  If `False`,\n            copy the data from input, undefined cells will still be filled with\n            zeros/blanks.\n\n        character_as_bytes : bool\n            Whether to return bytes for string columns when accessed from the\n            HDU. By default this is `False` and (unicode) strings are returned,\n            but for large tables this may use up a lot of memory.\n\n        Notes\n        -----\n        Any additional keyword arguments accepted by the HDU class's\n        ``__init__`` may also be passed in as keyword arguments.\n        \"\"\"\n\n        coldefs = cls._columns_type(columns)\n        data = FITS_rec.from_columns(coldefs, nrows=nrows, fill=fill,\n                                     character_as_bytes=character_as_bytes)\n        hdu = cls(data=data, header=header, character_as_bytes=character_as_bytes, **kwargs)\n        coldefs._add_listener(hdu)\n        return hdu\n\n    @lazyproperty\n    def columns(self):\n        \"\"\"\n        The :class:`ColDefs` objects describing the columns in this table.\n        \"\"\"\n\n        # The base class doesn't make any assumptions about where the column\n        # definitions come from, so just return an empty ColDefs\n        return ColDefs([])\n\n    @property\n    def _nrows(self):\n        \"\"\"\n        table-like HDUs must provide an attribute that specifies the number of\n        rows in the HDU's table.\n\n        For now this is an internal-only attribute.\n        \"\"\"\n\n        raise NotImplementedError\n\n    def _get_tbdata(self):\n        \"\"\"Get the table data from an input HDU object.\"\"\"\n\n        columns = self.columns\n\n        # TODO: Details related to variable length arrays need to be dealt with\n        # specifically in the BinTableHDU class, since they're a detail\n        # specific to FITS binary tables\n        if (any(type(r) in (_FormatP, _FormatQ)\n                for r in columns._recformats) and\n                self._data_size is not None and\n                self._data_size > self._theap):\n            # We have a heap; include it in the raw_data\n            raw_data = self._get_raw_data(self._data_size, np.uint8,\n                                          self._data_offset)\n            tbsize = self._header['NAXIS1'] * self._header['NAXIS2']\n            data = raw_data[:tbsize].view(dtype=columns.dtype,\n                                          type=np.rec.recarray)\n        else:\n            raw_data = self._get_raw_data(self._nrows, columns.dtype,\n                                          self._data_offset)\n            if raw_data is None:\n                # This can happen when a brand new table HDU is being created\n                # and no data has been assigned to the columns, which case just\n                # return an empty array\n                raw_data = np.array([], dtype=columns.dtype)\n\n            data = raw_data.view(np.rec.recarray)\n\n        self._init_tbdata(data)\n        data = data.view(self._data_type)\n        columns._add_listener(data)\n        return data\n\n    def _init_tbdata(self, data):\n        columns = self.columns\n\n        data.dtype = data.dtype.newbyteorder('>')\n\n        # hack to enable pseudo-uint support\n        data._uint = self._uint\n\n        # pass datLoc, for P format\n        data._heapoffset = self._theap\n        data._heapsize = self._header['PCOUNT']\n        tbsize = self._header['NAXIS1'] * self._header['NAXIS2']\n        data._gap = self._theap - tbsize\n\n        # pass the attributes\n        for idx, col in enumerate(columns):\n            # get the data for each column object from the rec.recarray\n            col.array = data.field(idx)\n\n        # delete the _arrays attribute so that it is recreated to point to the\n        # new data placed in the column object above\n        del columns._arrays\n\n    def _update_load_data(self):\n        \"\"\"Load the data if asked to.\"\"\"\n        if not self._data_loaded:\n            self.data\n\n    def _update_column_added(self, columns, column):\n        \"\"\"\n        Update the data upon addition of a new column through the `ColDefs`\n        interface.\n        \"\"\"\n        # recreate data from the columns\n        self.data = FITS_rec.from_columns(\n            self.columns, nrows=self._nrows, fill=False,\n            character_as_bytes=self._character_as_bytes\n        )\n\n    def _update_column_removed(self, columns, col_idx):\n        \"\"\"\n        Update the data upon removal of a column through the `ColDefs`\n        interface.\n        \"\"\"\n        # recreate data from the columns\n        self.data = FITS_rec.from_columns(\n            self.columns, nrows=self._nrows, fill=False,\n            character_as_bytes=self._character_as_bytes\n        )"},{"col":4,"comment":"null","endLoc":115,"header":"@classmethod\n    def from_json(cls, jsondb)","id":1892,"name":"from_json","nodeType":"Function","startLoc":100,"text":"@classmethod\n    def from_json(cls, jsondb):\n        reg = cls()\n        for site in jsondb:\n            site_info = jsondb[site].copy()\n            location = EarthLocation.from_geodetic(site_info.pop('longitude') * u.Unit(site_info.pop('longitude_unit')),\n                                                   site_info.pop('latitude') * u.Unit(site_info.pop('latitude_unit')),\n                                                   site_info.pop('elevation') * u.Unit(site_info.pop('elevation_unit')))\n            location.info.name = site_info.pop('name')\n            aliases = site_info.pop('aliases')\n            location.info.meta = site_info  # whatever is left\n\n            reg.add_site([site] + aliases, location)\n\n        reg._loaded_jsondb = jsondb\n        return reg"},{"col":4,"comment":"null","endLoc":591,"header":"def _postwriteto(self)","id":1893,"name":"_postwriteto","nodeType":"Function","startLoc":584,"text":"def _postwriteto(self):\n        # If data is unsigned integer 16, 32 or 64, remove the\n        # BSCALE/BZERO cards\n        if (self._has_data and self._standard and\n                _is_pseudo_integer(self.data.dtype)):\n            for keyword in ('BSCALE', 'BZERO'):\n                with suppress(KeyError):\n                    del self._header[keyword]"},{"col":0,"comment":"\n    Given an arbitrary object, return the matching mixin handler (if any).\n\n    Parameters\n    ----------\n    obj : object or str\n        The object to find a mixin handler for, or a fully qualified name.\n\n    Returns\n    -------\n    handler : None or func\n        Then matching handler, if found, or `None`\n    ","endLoc":64,"header":"def get_mixin_handler(obj)","id":1894,"name":"get_mixin_handler","nodeType":"Function","startLoc":47,"text":"def get_mixin_handler(obj):\n    \"\"\"\n    Given an arbitrary object, return the matching mixin handler (if any).\n\n    Parameters\n    ----------\n    obj : object or str\n        The object to find a mixin handler for, or a fully qualified name.\n\n    Returns\n    -------\n    handler : None or func\n        Then matching handler, if found, or `None`\n    \"\"\"\n    if isinstance(obj, str):\n        return _handlers.get(obj, None)\n    else:\n        return _handlers.get(obj.__class__.__module__ + '.' + obj.__class__.__name__, None)"},{"col":4,"comment":"\n        Calculates and returns the number of bytes that this HDU will write to\n        a file.\n        ","endLoc":966,"header":"def filebytes(self)","id":1895,"name":"filebytes","nodeType":"Function","startLoc":958,"text":"def filebytes(self):\n        \"\"\"\n        Calculates and returns the number of bytes that this HDU will write to\n        a file.\n        \"\"\"\n\n        f = _File()\n        # TODO: Fix this once new HDU writing API is settled on\n        return self._writeheader(f)[1] + self._writedata(f)[1]"},{"col":4,"comment":"null","endLoc":605,"header":"def _writeheader(self, fileobj)","id":1896,"name":"_writeheader","nodeType":"Function","startLoc":593,"text":"def _writeheader(self, fileobj):\n        offset = 0\n        with suppress(AttributeError, OSError):\n            offset = fileobj.tell()\n\n        self._header.tofile(fileobj)\n\n        try:\n            size = fileobj.tell() - offset\n        except (AttributeError, OSError):\n            size = len(str(self._header))\n\n        return offset, size"},{"col":4,"comment":"null","endLoc":639,"header":"def _writedata(self, fileobj)","id":1897,"name":"_writedata","nodeType":"Function","startLoc":607,"text":"def _writedata(self, fileobj):\n        size = 0\n        fileobj.flush()\n        try:\n            offset = fileobj.tell()\n        except (AttributeError, OSError):\n            offset = 0\n\n        if self._data_loaded or self._data_needs_rescale:\n            if self.data is not None:\n                size += self._writedata_internal(fileobj)\n            # pad the FITS data block\n            # to avoid a bug in the lustre filesystem client, don't\n            # write zero-byte objects\n            if size > 0 and _pad_length(size) > 0:\n                padding = _pad_length(size) * self._padding_byte\n                # TODO: Not that this is ever likely, but if for some odd\n                # reason _padding_byte is > 0x80 this will fail; but really if\n                # somebody's custom fits format is doing that, they're doing it\n                # wrong and should be reprimanded harshly.\n                fileobj.write(padding.encode('ascii'))\n                size += len(padding)\n        else:\n            # The data has not been modified or does not need need to be\n            # rescaled, so it can be copied, unmodified, directly from an\n            # existing file or buffer\n            size += self._writedata_direct_copy(fileobj)\n\n        # flush, to make sure the content is written\n        fileobj.flush()\n\n        # return both the location and the size of the data area\n        return offset, size"},{"col":4,"comment":"\n        The beginning and end of most _writedata() implementations are the\n        same, but the details of writing the data array itself can vary between\n        HDU types, so that should be implemented in this method.\n\n        Should return the size in bytes of the data written.\n        ","endLoc":651,"header":"def _writedata_internal(self, fileobj)","id":1898,"name":"_writedata_internal","nodeType":"Function","startLoc":641,"text":"def _writedata_internal(self, fileobj):\n        \"\"\"\n        The beginning and end of most _writedata() implementations are the\n        same, but the details of writing the data array itself can vary between\n        HDU types, so that should be implemented in this method.\n\n        Should return the size in bytes of the data written.\n        \"\"\"\n\n        fileobj.writearray(self.data)\n        return self.data.size * self.data.itemsize"},{"col":4,"comment":"Get the correct column class to use for upgrading any Column-like object.\n\n        For a masked table, ensure any Column-like object is a subclass\n        of the table MaskedColumn.\n\n        For unmasked table, ensure any MaskedColumn-like object is a subclass\n        of the table MaskedColumn.  If not a MaskedColumn, then ensure that any\n        Column-like object is a subclass of the table Column.\n        ","endLoc":1367,"header":"def _get_col_cls_for_table(self, col)","id":1899,"name":"_get_col_cls_for_table","nodeType":"Function","startLoc":1344,"text":"def _get_col_cls_for_table(self, col):\n        \"\"\"Get the correct column class to use for upgrading any Column-like object.\n\n        For a masked table, ensure any Column-like object is a subclass\n        of the table MaskedColumn.\n\n        For unmasked table, ensure any MaskedColumn-like object is a subclass\n        of the table MaskedColumn.  If not a MaskedColumn, then ensure that any\n        Column-like object is a subclass of the table Column.\n        \"\"\"\n\n        col_cls = col.__class__\n\n        if self.masked:\n            if isinstance(col, Column) and not isinstance(col, self.MaskedColumn):\n                col_cls = self.MaskedColumn\n        else:\n            if isinstance(col, MaskedColumn):\n                if not isinstance(col, self.MaskedColumn):\n                    col_cls = self.MaskedColumn\n            elif isinstance(col, Column) and not isinstance(col, self.Column):\n                col_cls = self.Column\n\n        return col_cls"},{"col":0,"comment":"\n    Mixin-safe version of Column.copy() (with copy_data=True).\n\n    Parameters\n    ----------\n    col : Column or mixin column\n        Input column\n    copy_indices : bool\n        Copy the column ``indices`` attribute\n\n    Returns\n    -------\n    col : Copy of input column\n    ","endLoc":87,"header":"def col_copy(col, copy_indices=True)","id":1900,"name":"col_copy","nodeType":"Function","startLoc":58,"text":"def col_copy(col, copy_indices=True):\n    \"\"\"\n    Mixin-safe version of Column.copy() (with copy_data=True).\n\n    Parameters\n    ----------\n    col : Column or mixin column\n        Input column\n    copy_indices : bool\n        Copy the column ``indices`` attribute\n\n    Returns\n    -------\n    col : Copy of input column\n    \"\"\"\n    if isinstance(col, BaseColumn):\n        return col.copy()\n\n    newcol = col.copy() if hasattr(col, 'copy') else deepcopy(col)\n    # If the column has info defined, we copy it and adjust any indices\n    # to point to the copied column.  By guarding with the if statement,\n    # we avoid side effects (of creating the default info instance).\n    if 'info' in col.__dict__:\n        newcol.info = col.info\n        if copy_indices and col.info.indices:\n            newcol.info.indices = deepcopy(col.info.indices)\n            for index in newcol.info.indices:\n                index.replace_col(col, newcol)\n\n    return newcol"},{"col":4,"comment":"null","endLoc":2156,"header":"def lr0_closure(self, I)","id":1901,"name":"lr0_closure","nodeType":"Function","startLoc":2139,"text":"def lr0_closure(self, I):\n        self._add_count += 1\n\n        # Add everything in I to J\n        J = I[:]\n        didadd = True\n        while didadd:\n            didadd = False\n            for j in J:\n                for x in j.lr_after:\n                    if getattr(x, 'lr0_added', 0) == self._add_count:\n                        continue\n                    # Add B --> .G to J\n                    J.append(x.lr_next)\n                    x.lr0_added = self._add_count\n                    didadd = True\n\n        return J"},{"col":4,"comment":"Copies the data directly from one file/buffer to the new file.\n\n        For now this is handled by loading the raw data from the existing data\n        (including any padding) via a memory map or from an already in-memory\n        buffer and using Numpy's existing file-writing facilities to write to\n        the new file.\n\n        If this proves too slow a more direct approach may be used.\n        ","endLoc":668,"header":"def _writedata_direct_copy(self, fileobj)","id":1902,"name":"_writedata_direct_copy","nodeType":"Function","startLoc":653,"text":"def _writedata_direct_copy(self, fileobj):\n        \"\"\"Copies the data directly from one file/buffer to the new file.\n\n        For now this is handled by loading the raw data from the existing data\n        (including any padding) via a memory map or from an already in-memory\n        buffer and using Numpy's existing file-writing facilities to write to\n        the new file.\n\n        If this proves too slow a more direct approach may be used.\n        \"\"\"\n        raw = self._get_raw_data(self._data_size, 'ubyte', self._data_offset)\n        if raw is not None:\n            fileobj.writearray(raw)\n            return raw.nbytes\n        else:\n            return 0"},{"col":4,"comment":"null","endLoc":681,"header":"def _writeto(self, fileobj, inplace=False, copy=False)","id":1903,"name":"_writeto","nodeType":"Function","startLoc":674,"text":"def _writeto(self, fileobj, inplace=False, copy=False):\n        try:\n            dirname = os.path.dirname(fileobj._file.name)\n        except (AttributeError, TypeError):\n            dirname = None\n\n        with _free_space_check(self, dirname):\n            self._writeto_internal(fileobj, inplace, copy)"},{"col":4,"comment":"\n        Returns a dictionary detailing information about the locations\n        of this HDU within any associated file.  The values are only\n        valid after a read or write of the associated file with no\n        intervening changes to the `HDUList`.\n\n        Returns\n        -------\n        dict or None\n            The dictionary details information about the locations of\n            this HDU within an associated file.  Returns `None` when\n            the HDU is not associated with a file.\n\n            Dictionary contents:\n\n            ========== ================================================\n            Key        Value\n            ========== ================================================\n            file       File object associated with the HDU\n            filemode   Mode in which the file was opened (readonly, copyonwrite,\n                       update, append, ostream)\n            hdrLoc     Starting byte location of header in file\n            datLoc     Starting byte location of data block in file\n            datSpan    Data size including padding\n            ========== ================================================\n        ","endLoc":1001,"header":"def fileinfo(self)","id":1904,"name":"fileinfo","nodeType":"Function","startLoc":968,"text":"def fileinfo(self):\n        \"\"\"\n        Returns a dictionary detailing information about the locations\n        of this HDU within any associated file.  The values are only\n        valid after a read or write of the associated file with no\n        intervening changes to the `HDUList`.\n\n        Returns\n        -------\n        dict or None\n            The dictionary details information about the locations of\n            this HDU within an associated file.  Returns `None` when\n            the HDU is not associated with a file.\n\n            Dictionary contents:\n\n            ========== ================================================\n            Key        Value\n            ========== ================================================\n            file       File object associated with the HDU\n            filemode   Mode in which the file was opened (readonly, copyonwrite,\n                       update, append, ostream)\n            hdrLoc     Starting byte location of header in file\n            datLoc     Starting byte location of data block in file\n            datSpan    Data size including padding\n            ========== ================================================\n        \"\"\"\n\n        if hasattr(self, '_file') and self._file:\n            return {'file': self._file, 'filemode': self._file.mode,\n                    'hdrLoc': self._header_offset, 'datLoc': self._data_offset,\n                    'datSpan': self._data_size}\n        else:\n            return None"},{"col":4,"comment":"\n        Make a copy of the HDU, both header and data are copied.\n        ","endLoc":1012,"header":"def copy(self)","id":1905,"name":"copy","nodeType":"Function","startLoc":1003,"text":"def copy(self):\n        \"\"\"\n        Make a copy of the HDU, both header and data are copied.\n        \"\"\"\n\n        if self.data is not None:\n            data = self.data.copy()\n        else:\n            data = None\n        return self.__class__(data=data, header=self._header.copy())"},{"col":4,"comment":"null","endLoc":1079,"header":"def _verify(self, option='warn')","id":1906,"name":"_verify","nodeType":"Function","startLoc":1014,"text":"def _verify(self, option='warn'):\n        errs = _ErrList([], unit='Card')\n\n        is_valid = BITPIX2DTYPE.__contains__\n\n        # Verify location and value of mandatory keywords.\n        # Do the first card here, instead of in the respective HDU classes, so\n        # the checking is in order, in case of required cards in wrong order.\n        if isinstance(self, ExtensionHDU):\n            firstkey = 'XTENSION'\n            firstval = self._extension\n        else:\n            firstkey = 'SIMPLE'\n            firstval = True\n\n        self.req_cards(firstkey, 0, None, firstval, option, errs)\n        self.req_cards('BITPIX', 1, lambda v: (_is_int(v) and is_valid(v)), 8,\n                       option, errs)\n        self.req_cards('NAXIS', 2,\n                       lambda v: (_is_int(v) and 0 <= v <= 999), 0,\n                       option, errs)\n\n        naxis = self._header.get('NAXIS', 0)\n        if naxis < 1000:\n            for ax in range(3, naxis + 3):\n                key = 'NAXIS' + str(ax - 2)\n                self.req_cards(key, ax,\n                               lambda v: (_is_int(v) and v >= 0),\n                               _extract_number(self._header[key], default=1),\n                               option, errs)\n\n            # Remove NAXISj cards where j is not in range 1, naxis inclusive.\n            for keyword in self._header:\n                if keyword.startswith('NAXIS') and len(keyword) > 5:\n                    try:\n                        number = int(keyword[5:])\n                        if number <= 0 or number > naxis:\n                            raise ValueError\n                    except ValueError:\n                        err_text = (\"NAXISj keyword out of range ('{}' when \"\n                                    \"NAXIS == {})\".format(keyword, naxis))\n\n                        def fix(self=self, keyword=keyword):\n                            del self._header[keyword]\n\n                        errs.append(\n                            self.run_option(option=option, err_text=err_text,\n                                            fix=fix, fix_text=\"Deleted.\"))\n\n        # Verify that the EXTNAME keyword exists and is a string\n        if 'EXTNAME' in self._header:\n            if not isinstance(self._header['EXTNAME'], str):\n                err_text = 'The EXTNAME keyword must have a string value.'\n                fix_text = 'Converted the EXTNAME keyword to a string value.'\n\n                def fix(header=self._header):\n                    header['EXTNAME'] = str(header['EXTNAME'])\n\n                errs.append(self.run_option(option, err_text=err_text,\n                                            fix_text=fix_text, fix=fix))\n\n        # verify each card\n        for card in self._header.cards:\n            errs.append(card._verify(option))\n\n        return errs"},{"col":0,"comment":"Convert N-d sequence-like data to ndarray or MaskedArray.\n\n    This is the core function for converting Python lists or list of lists to a\n    numpy array. This handles embedded np.ma.masked constants in ``data`` along\n    with the special case of an homogeneous list of MaskedArray elements.\n\n    Considerations:\n\n    - np.ma.array is about 50 times slower than np.array for list input. This\n      function avoids using np.ma.array on list input.\n    - np.array emits a UserWarning for embedded np.ma.masked, but only for int\n      or float inputs. For those it converts to np.nan and forces float dtype.\n      For other types np.array is inconsistent, for instance converting\n      np.ma.masked to \"0.0\" for str types.\n    - Searching in pure Python for np.ma.masked in ``data`` is comparable in\n      speed to calling ``np.array(data)``.\n    - This function may end up making two additional copies of input ``data``.\n\n    Parameters\n    ----------\n    data : N-d sequence\n        Input data, typically list or list of lists\n    dtype : None or dtype-like\n        Output datatype (None lets np.array choose)\n\n    Returns\n    -------\n    np_data : np.ndarray or np.ma.MaskedArray\n\n    ","endLoc":287,"header":"def _convert_sequence_data_to_array(data, dtype=None)","id":1907,"name":"_convert_sequence_data_to_array","nodeType":"Function","startLoc":149,"text":"def _convert_sequence_data_to_array(data, dtype=None):\n    \"\"\"Convert N-d sequence-like data to ndarray or MaskedArray.\n\n    This is the core function for converting Python lists or list of lists to a\n    numpy array. This handles embedded np.ma.masked constants in ``data`` along\n    with the special case of an homogeneous list of MaskedArray elements.\n\n    Considerations:\n\n    - np.ma.array is about 50 times slower than np.array for list input. This\n      function avoids using np.ma.array on list input.\n    - np.array emits a UserWarning for embedded np.ma.masked, but only for int\n      or float inputs. For those it converts to np.nan and forces float dtype.\n      For other types np.array is inconsistent, for instance converting\n      np.ma.masked to \"0.0\" for str types.\n    - Searching in pure Python for np.ma.masked in ``data`` is comparable in\n      speed to calling ``np.array(data)``.\n    - This function may end up making two additional copies of input ``data``.\n\n    Parameters\n    ----------\n    data : N-d sequence\n        Input data, typically list or list of lists\n    dtype : None or dtype-like\n        Output datatype (None lets np.array choose)\n\n    Returns\n    -------\n    np_data : np.ndarray or np.ma.MaskedArray\n\n    \"\"\"\n    np_ma_masked = np.ma.masked  # Avoid repeated lookups of this object\n\n    # Special case of an homogeneous list of MaskedArray elements (see #8977).\n    # np.ma.masked is an instance of MaskedArray, so exclude those values.\n    if (hasattr(data, '__len__')\n        and len(data) > 0\n        and all(isinstance(val, np.ma.MaskedArray)\n                and val is not np_ma_masked for val in data)):\n        np_data = np.ma.array(data, dtype=dtype)\n        return np_data\n\n    # First convert data to a plain ndarray. If there are instances of np.ma.masked\n    # in the data this will issue a warning for int and float.\n    with warnings.catch_warnings(record=True) as warns:\n        # Ensure this warning from numpy is always enabled and that it is not\n        # converted to an error (which can happen during pytest).\n        warnings.filterwarnings('always', category=UserWarning,\n                                message='.*converting a masked element.*')\n        # FutureWarning in numpy 1.21. See https://github.com/astropy/astropy/issues/11291\n        # and https://github.com/numpy/numpy/issues/18425.\n        warnings.filterwarnings('always', category=FutureWarning,\n                                message='.*Promotion of numbers and bools to strings.*')\n        try:\n            np_data = np.array(data, dtype=dtype)\n        except np.ma.MaskError:\n            # Catches case of dtype=int with masked values, instead let it\n            # convert to float\n            np_data = np.array(data)\n        except Exception:\n            # Conversion failed for some reason, e.g. [2, 1*u.m] gives TypeError in Quantity.\n            # First try to interpret the data as Quantity. If that still fails then fall\n            # through to object\n            try:\n                np_data = Quantity(data, dtype)\n            except Exception:\n                dtype = object\n                np_data = np.array(data, dtype=dtype)\n\n    if np_data.ndim == 0 or (np_data.ndim > 0 and len(np_data) == 0):\n        # Implies input was a scalar or an empty list (e.g. initializing an\n        # empty table with pre-declared names and dtypes but no data).  Here we\n        # need to fall through to initializing with the original data=[].\n        return data\n\n    # If there were no warnings and the data are int or float, then we are done.\n    # Other dtypes like string or complex can have masked values and the\n    # np.array() conversion gives the wrong answer (e.g. converting np.ma.masked\n    # to the string \"0.0\").\n    if len(warns) == 0 and np_data.dtype.kind in ('i', 'f'):\n        return np_data\n\n    # Now we need to determine if there is an np.ma.masked anywhere in input data.\n\n    # Make a statement like below to look for np.ma.masked in a nested sequence.\n    # Because np.array(data) succeeded we know that `data` has a regular N-d\n    # structure. Find ma_masked:\n    #   any(any(any(d2 is ma_masked for d2 in d1) for d1 in d0) for d0 in data)\n    # Using this eval avoids creating a copy of `data` in the more-usual case of\n    # no masked elements.\n    any_statement = 'd0 is ma_masked'\n    for ii in reversed(range(np_data.ndim)):\n        if ii == 0:\n            any_statement = f'any({any_statement} for d0 in data)'\n        elif ii == np_data.ndim - 1:\n            any_statement = f'any(d{ii} is ma_masked for d{ii} in d{ii-1})'\n        else:\n            any_statement = f'any({any_statement} for d{ii} in d{ii-1})'\n    context = {'ma_masked': np.ma.masked, 'data': data}\n    has_masked = eval(any_statement, context)\n\n    # If there are any masks then explicitly change each one to a fill value and\n    # set a mask boolean array. If not has_masked then we're done.\n    if has_masked:\n        mask = np.zeros(np_data.shape, dtype=bool)\n        data_filled = np.array(data, dtype=object)\n\n        # Make type-appropriate fill value based on initial conversion.\n        if np_data.dtype.kind == 'U':\n            fill = ''\n        elif np_data.dtype.kind == 'S':\n            fill = b''\n        else:\n            # Zero works for every numeric type.\n            fill = 0\n\n        ranges = [range(dim) for dim in np_data.shape]\n        for idxs in itertools.product(*ranges):\n            val = data_filled[idxs]\n            if val is np_ma_masked:\n                data_filled[idxs] = fill\n                mask[idxs] = True\n            elif isinstance(val, bool) and dtype is None:\n                # If we see a bool and dtype not specified then assume bool for\n                # the entire array. Not perfect but in most practical cases OK.\n                # Unfortunately numpy types [False, 0] as int, not bool (and\n                # [False, np.ma.masked] => array([0.0, np.nan])).\n                dtype = bool\n\n        # If no dtype is provided then need to convert back to list so np.array\n        # does type autodetection.\n        if dtype is None:\n            data_filled = data_filled.tolist()\n\n        # Use np.array first to convert `data` to ndarray (fast) and then make\n        # masked array from an ndarray with mask (fast) instead of from `data`.\n        np_data = np.ma.array(np.array(data_filled, dtype=dtype), mask=mask)\n\n    return np_data"},{"col":4,"comment":"null","endLoc":746,"header":"def _writeto_internal(self, fileobj, inplace, copy)","id":1908,"name":"_writeto_internal","nodeType":"Function","startLoc":683,"text":"def _writeto_internal(self, fileobj, inplace, copy):\n        # For now fileobj is assumed to be a _File object\n        if not inplace or self._new:\n            header_offset, _ = self._writeheader(fileobj)\n            data_offset, data_size = self._writedata(fileobj)\n\n            # Set the various data location attributes on newly-written HDUs\n            if self._new:\n                self._header_offset = header_offset\n                self._data_offset = data_offset\n                self._data_size = data_size\n            return\n\n        hdrloc = self._header_offset\n        hdrsize = self._data_offset - self._header_offset\n        datloc = self._data_offset\n        datsize = self._data_size\n\n        if self._header._modified:\n            # Seek to the original header location in the file\n            self._file.seek(hdrloc)\n            # This should update hdrloc with he header location in the new file\n            hdrloc, hdrsize = self._writeheader(fileobj)\n\n            # If the data is to be written below with self._writedata, that\n            # will also properly update the data location; but it should be\n            # updated here too\n            datloc = hdrloc + hdrsize\n        elif copy:\n            # Seek to the original header location in the file\n            self._file.seek(hdrloc)\n            # Before writing, update the hdrloc with the current file position,\n            # which is the hdrloc for the new file\n            hdrloc = fileobj.tell()\n            fileobj.write(self._file.read(hdrsize))\n            # The header size is unchanged, but the data location may be\n            # different from before depending on if previous HDUs were resized\n            datloc = fileobj.tell()\n\n        if self._data_loaded:\n            if self.data is not None:\n                # Seek through the array's bases for an memmap'd array; we\n                # can't rely on the _File object to give us this info since\n                # the user may have replaced the previous mmap'd array\n                if copy or self._data_replaced:\n                    # Of course, if we're copying the data to a new file\n                    # we don't care about flushing the original mmap;\n                    # instead just read it into the new file\n                    array_mmap = None\n                else:\n                    array_mmap = _get_array_mmap(self.data)\n\n                if array_mmap is not None:\n                    array_mmap.flush()\n                else:\n                    self._file.seek(self._data_offset)\n                    datloc, datsize = self._writedata(fileobj)\n        elif copy:\n            datsize = self._writedata_direct_copy(fileobj)\n\n        self._header_offset = hdrloc\n        self._data_offset = datloc\n        self._data_size = datsize\n        self._data_replaced = False"},{"col":4,"comment":"\n        Check the existence, location, and value of a required `Card`.\n\n        Parameters\n        ----------\n        keyword : str\n            The keyword to validate\n\n        pos : int, callable\n            If an ``int``, this specifies the exact location this card should\n            have in the header.  Remember that Python is zero-indexed, so this\n            means ``pos=0`` requires the card to be the first card in the\n            header.  If given a callable, it should take one argument--the\n            actual position of the keyword--and return `True` or `False`.  This\n            can be used for custom evaluation.  For example if\n            ``pos=lambda idx: idx > 10`` this will check that the keyword's\n            index is greater than 10.\n\n        test : callable\n            This should be a callable (generally a function) that is passed the\n            value of the given keyword and returns `True` or `False`.  This can\n            be used to validate the value associated with the given keyword.\n\n        fix_value : str, int, float, complex, bool, None\n            A valid value for a FITS keyword to to use if the given ``test``\n            fails to replace an invalid value.  In other words, this provides\n            a default value to use as a replacement if the keyword's current\n            value is invalid.  If `None`, there is no replacement value and the\n            keyword is unfixable.\n\n        option : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        errlist : list\n            A list of validation errors already found in the FITS file; this is\n            used primarily for the validation system to collect errors across\n            multiple HDUs and multiple calls to `req_cards`.\n\n        Notes\n        -----\n        If ``pos=None``, the card can be anywhere in the header.  If the card\n        does not exist, the new card will have the ``fix_value`` as its value\n        when created.  Also check the card's value by using the ``test``\n        argument.\n        ","endLoc":1195,"header":"def req_cards(self, keyword, pos, test, fix_value, option, errlist)","id":1909,"name":"req_cards","nodeType":"Function","startLoc":1083,"text":"def req_cards(self, keyword, pos, test, fix_value, option, errlist):\n        \"\"\"\n        Check the existence, location, and value of a required `Card`.\n\n        Parameters\n        ----------\n        keyword : str\n            The keyword to validate\n\n        pos : int, callable\n            If an ``int``, this specifies the exact location this card should\n            have in the header.  Remember that Python is zero-indexed, so this\n            means ``pos=0`` requires the card to be the first card in the\n            header.  If given a callable, it should take one argument--the\n            actual position of the keyword--and return `True` or `False`.  This\n            can be used for custom evaluation.  For example if\n            ``pos=lambda idx: idx > 10`` this will check that the keyword's\n            index is greater than 10.\n\n        test : callable\n            This should be a callable (generally a function) that is passed the\n            value of the given keyword and returns `True` or `False`.  This can\n            be used to validate the value associated with the given keyword.\n\n        fix_value : str, int, float, complex, bool, None\n            A valid value for a FITS keyword to to use if the given ``test``\n            fails to replace an invalid value.  In other words, this provides\n            a default value to use as a replacement if the keyword's current\n            value is invalid.  If `None`, there is no replacement value and the\n            keyword is unfixable.\n\n        option : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        errlist : list\n            A list of validation errors already found in the FITS file; this is\n            used primarily for the validation system to collect errors across\n            multiple HDUs and multiple calls to `req_cards`.\n\n        Notes\n        -----\n        If ``pos=None``, the card can be anywhere in the header.  If the card\n        does not exist, the new card will have the ``fix_value`` as its value\n        when created.  Also check the card's value by using the ``test``\n        argument.\n        \"\"\"\n\n        errs = errlist\n        fix = None\n\n        try:\n            index = self._header.index(keyword)\n        except ValueError:\n            index = None\n\n        fixable = fix_value is not None\n\n        insert_pos = len(self._header) + 1\n\n        # If pos is an int, insert at the given position (and convert it to a\n        # lambda)\n        if _is_int(pos):\n            insert_pos = pos\n            pos = lambda x: x == insert_pos\n\n        # if the card does not exist\n        if index is None:\n            err_text = f\"'{keyword}' card does not exist.\"\n            fix_text = f\"Fixed by inserting a new '{keyword}' card.\"\n            if fixable:\n                # use repr to accommodate both string and non-string types\n                # Boolean is also OK in this constructor\n                card = (keyword, fix_value)\n\n                def fix(self=self, insert_pos=insert_pos, card=card):\n                    self._header.insert(insert_pos, card)\n\n            errs.append(self.run_option(option, err_text=err_text,\n                        fix_text=fix_text, fix=fix, fixable=fixable))\n        else:\n            # if the supposed location is specified\n            if pos is not None:\n                if not pos(index):\n                    err_text = f\"'{keyword}' card at the wrong place (card {index}).\"\n                    fix_text = f\"Fixed by moving it to the right place (card {insert_pos}).\"\n\n                    def fix(self=self, index=index, insert_pos=insert_pos):\n                        card = self._header.cards[index]\n                        del self._header[index]\n                        self._header.insert(insert_pos, card)\n\n                    errs.append(self.run_option(option, err_text=err_text,\n                                fix_text=fix_text, fix=fix))\n\n            # if value checking is specified\n            if test:\n                val = self._header[keyword]\n                if not test(val):\n                    err_text = f\"'{keyword}' card has invalid value '{val}'.\"\n                    fix_text = f\"Fixed by setting a new value '{fix_value}'.\"\n\n                    if fixable:\n                        def fix(self=self, keyword=keyword, val=fix_value):\n                            self._header[keyword] = fix_value\n\n                    errs.append(self.run_option(option, err_text=err_text,\n                                fix_text=fix_text, fix=fix, fixable=fixable))\n\n        return errs"},{"col":18,"endLoc":1150,"id":1910,"nodeType":"Lambda","startLoc":1150,"text":"lambda x: x == insert_pos"},{"col":4,"comment":"null","endLoc":755,"header":"def _close(self, closed=True)","id":1911,"name":"_close","nodeType":"Function","startLoc":748,"text":"def _close(self, closed=True):\n        # If the data was mmap'd, close the underlying mmap (this will\n        # prevent any future access to the .data attribute if there are\n        # not other references to it; if there are other references then\n        # it is up to the user to clean those up\n        if (closed and self._data_loaded and\n                _get_array_mmap(self.data) is not None):\n            del self.data"},{"attributeType":"null","col":4,"comment":"null","endLoc":114,"id":1912,"name":"_hdu_registry","nodeType":"Attribute","startLoc":114,"text":"_hdu_registry"},{"attributeType":"null","col":4,"comment":"null","endLoc":117,"id":1913,"name":"_standard","nodeType":"Attribute","startLoc":117,"text":"_standard"},{"attributeType":"null","col":4,"comment":"null","endLoc":120,"id":1914,"name":"_padding_byte","nodeType":"Attribute","startLoc":120,"text":"_padding_byte"},{"attributeType":"null","col":4,"comment":"null","endLoc":122,"id":1915,"name":"_default_name","nodeType":"Attribute","startLoc":122,"text":"_default_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":126,"id":1916,"name":"_header","nodeType":"Attribute","startLoc":126,"text":"_header"},{"attributeType":"null","col":8,"comment":"null","endLoc":137,"id":1917,"name":"_data_size","nodeType":"Attribute","startLoc":137,"text":"self._data_size"},{"attributeType":"null","col":8,"comment":"null","endLoc":133,"id":1918,"name":"_file","nodeType":"Attribute","startLoc":133,"text":"self._file"},{"attributeType":"null","col":8,"comment":"null","endLoc":134,"id":1919,"name":"_buffer","nodeType":"Attribute","startLoc":134,"text":"self._buffer"},{"attributeType":"null","col":8,"comment":"null","endLoc":144,"id":1920,"name":"_data_needs_rescale","nodeType":"Attribute","startLoc":144,"text":"self._data_needs_rescale"},{"attributeType":"null","col":12,"comment":"null","endLoc":151,"id":1921,"name":"_output_checksum","nodeType":"Attribute","startLoc":151,"text":"self._output_checksum"},{"attributeType":"null","col":8,"comment":"null","endLoc":135,"id":1922,"name":"_header_offset","nodeType":"Attribute","startLoc":135,"text":"self._header_offset"},{"attributeType":"null","col":8,"comment":"null","endLoc":131,"id":1923,"name":"_header","nodeType":"Attribute","startLoc":131,"text":"self._header"},{"attributeType":"null","col":8,"comment":"null","endLoc":136,"id":1924,"name":"_data_offset","nodeType":"Attribute","startLoc":136,"text":"self._data_offset"},{"attributeType":"null","col":8,"comment":"null","endLoc":143,"id":1925,"name":"_data_replaced","nodeType":"Attribute","startLoc":143,"text":"self._data_replaced"},{"attributeType":"null","col":8,"comment":"null","endLoc":132,"id":1926,"name":"_header_str","nodeType":"Attribute","startLoc":132,"text":"self._header_str"},{"attributeType":"null","col":8,"comment":"null","endLoc":145,"id":1927,"name":"_new","nodeType":"Attribute","startLoc":145,"text":"self._new"},{"className":"_NonstandardHDU","col":0,"comment":"\n    A Non-standard HDU class.\n\n    This class is used for a Primary HDU when the ``SIMPLE`` Card has\n    a value of `False`.  A non-standard HDU comes from a file that\n    resembles a FITS file but departs from the standards in some\n    significant way.  One example would be files where the numbers are\n    in the DEC VAX internal storage format rather than the standard\n    FITS most significant byte first.  The header for this HDU should\n    be valid.  The data for this HDU is read from the file as a byte\n    stream that begins at the first byte after the header ``END`` card\n    and continues until the end of the file.\n    ","endLoc":897,"id":1928,"nodeType":"Class","startLoc":806,"text":"class _NonstandardHDU(_BaseHDU, _Verify):\n    \"\"\"\n    A Non-standard HDU class.\n\n    This class is used for a Primary HDU when the ``SIMPLE`` Card has\n    a value of `False`.  A non-standard HDU comes from a file that\n    resembles a FITS file but departs from the standards in some\n    significant way.  One example would be files where the numbers are\n    in the DEC VAX internal storage format rather than the standard\n    FITS most significant byte first.  The header for this HDU should\n    be valid.  The data for this HDU is read from the file as a byte\n    stream that begins at the first byte after the header ``END`` card\n    and continues until the end of the file.\n    \"\"\"\n\n    _standard = False\n\n    @classmethod\n    def match_header(cls, header):\n        \"\"\"\n        Matches any HDU that has the 'SIMPLE' keyword but is not a standard\n        Primary or Groups HDU.\n        \"\"\"\n\n        # The SIMPLE keyword must be in the first card\n        card = header.cards[0]\n\n        # The check that 'GROUPS' is missing is a bit redundant, since the\n        # match_header for GroupsHDU will always be called before this one.\n        if card.keyword == 'SIMPLE':\n            if 'GROUPS' not in header and card.value is False:\n                return True\n            else:\n                raise InvalidHDUException\n        else:\n            return False\n\n    @property\n    def size(self):\n        \"\"\"\n        Returns the size (in bytes) of the HDU's data part.\n        \"\"\"\n\n        if self._buffer is not None:\n            return len(self._buffer) - self._data_offset\n\n        return self._file.size - self._data_offset\n\n    def _writedata(self, fileobj):\n        \"\"\"\n        Differs from the base class :class:`_writedata` in that it doesn't\n        automatically add padding, and treats the data as a string of raw bytes\n        instead of an array.\n        \"\"\"\n\n        offset = 0\n        size = 0\n\n        fileobj.flush()\n        try:\n            offset = fileobj.tell()\n        except OSError:\n            offset = 0\n\n        if self.data is not None:\n            fileobj.write(self.data)\n            # flush, to make sure the content is written\n            fileobj.flush()\n            size = len(self.data)\n\n        # return both the location and the size of the data area\n        return offset, size\n\n    def _summary(self):\n        return (self.name, self.ver, 'NonstandardHDU', len(self._header))\n\n    @lazyproperty\n    def data(self):\n        \"\"\"\n        Return the file data.\n        \"\"\"\n\n        return self._get_raw_data(self.size, 'ubyte', self._data_offset)\n\n    def _verify(self, option='warn'):\n        errs = _ErrList([], unit='Card')\n\n        # verify each card\n        for card in self._header.cards:\n            errs.append(card._verify(option))\n\n        return errs"},{"col":36,"endLoc":1030,"id":1929,"nodeType":"Lambda","startLoc":1030,"text":"lambda v: (_is_int(v) and is_valid(v))"},{"col":4,"comment":"\n        Matches any HDU that has the 'SIMPLE' keyword but is not a standard\n        Primary or Groups HDU.\n        ","endLoc":841,"header":"@classmethod\n    def match_header(cls, header)","id":1930,"name":"match_header","nodeType":"Function","startLoc":823,"text":"@classmethod\n    def match_header(cls, header):\n        \"\"\"\n        Matches any HDU that has the 'SIMPLE' keyword but is not a standard\n        Primary or Groups HDU.\n        \"\"\"\n\n        # The SIMPLE keyword must be in the first card\n        card = header.cards[0]\n\n        # The check that 'GROUPS' is missing is a bit redundant, since the\n        # match_header for GroupsHDU will always be called before this one.\n        if card.keyword == 'SIMPLE':\n            if 'GROUPS' not in header and card.value is False:\n                return True\n            else:\n                raise InvalidHDUException\n        else:\n            return False"},{"col":4,"comment":"\n        Returns the size (in bytes) of the HDU's data part.\n        ","endLoc":852,"header":"@property\n    def size(self)","id":1931,"name":"size","nodeType":"Function","startLoc":843,"text":"@property\n    def size(self):\n        \"\"\"\n        Returns the size (in bytes) of the HDU's data part.\n        \"\"\"\n\n        if self._buffer is not None:\n            return len(self._buffer) - self._data_offset\n\n        return self._file.size - self._data_offset"},{"col":4,"comment":"\n        Differs from the base class :class:`_writedata` in that it doesn't\n        automatically add padding, and treats the data as a string of raw bytes\n        instead of an array.\n        ","endLoc":877,"header":"def _writedata(self, fileobj)","id":1932,"name":"_writedata","nodeType":"Function","startLoc":854,"text":"def _writedata(self, fileobj):\n        \"\"\"\n        Differs from the base class :class:`_writedata` in that it doesn't\n        automatically add padding, and treats the data as a string of raw bytes\n        instead of an array.\n        \"\"\"\n\n        offset = 0\n        size = 0\n\n        fileobj.flush()\n        try:\n            offset = fileobj.tell()\n        except OSError:\n            offset = 0\n\n        if self.data is not None:\n            fileobj.write(self.data)\n            # flush, to make sure the content is written\n            fileobj.flush()\n            size = len(self.data)\n\n        # return both the location and the size of the data area\n        return offset, size"},{"col":23,"endLoc":1033,"id":1933,"nodeType":"Lambda","startLoc":1033,"text":"lambda v: (_is_int(v) and 0 <= v <= 999)"},{"col":4,"comment":"null","endLoc":880,"header":"def _summary(self)","id":1934,"name":"_summary","nodeType":"Function","startLoc":879,"text":"def _summary(self):\n        return (self.name, self.ver, 'NonstandardHDU', len(self._header))"},{"col":4,"comment":"\n        Return the file data.\n        ","endLoc":888,"header":"@lazyproperty\n    def data(self)","id":1935,"name":"data","nodeType":"Function","startLoc":882,"text":"@lazyproperty\n    def data(self):\n        \"\"\"\n        Return the file data.\n        \"\"\"\n\n        return self._get_raw_data(self.size, 'ubyte', self._data_offset)"},{"col":4,"comment":"null","endLoc":2197,"header":"def lr0_goto(self, I, x)","id":1936,"name":"lr0_goto","nodeType":"Function","startLoc":2165,"text":"def lr0_goto(self, I, x):\n        # First we look for a previously cached entry\n        g = self.lr_goto_cache.get((id(I), x))\n        if g:\n            return g\n\n        # Now we generate the goto set in a way that guarantees uniqueness\n        # of the result\n\n        s = self.lr_goto_cache.get(x)\n        if not s:\n            s = {}\n            self.lr_goto_cache[x] = s\n\n        gs = []\n        for p in I:\n            n = p.lr_next\n            if n and n.lr_before == x:\n                s1 = s.get(id(n))\n                if not s1:\n                    s1 = {}\n                    s[id(n)] = s1\n                gs.append(n)\n                s = s1\n        g = s.get('$end')\n        if not g:\n            if gs:\n                g = self.lr0_closure(gs)\n                s['$end'] = g\n            else:\n                s['$end'] = gs\n        self.lr_goto_cache[(id(I), x)] = g\n        return g"},{"col":4,"comment":"null","endLoc":897,"header":"def _verify(self, option='warn')","id":1937,"name":"_verify","nodeType":"Function","startLoc":890,"text":"def _verify(self, option='warn'):\n        errs = _ErrList([], unit='Card')\n\n        # verify each card\n        for card in self._header.cards:\n            errs.append(card._verify(option))\n\n        return errs"},{"col":31,"endLoc":1041,"id":1938,"nodeType":"Lambda","startLoc":1041,"text":"lambda v: (_is_int(v) and v >= 0)"},{"attributeType":"null","col":4,"comment":"null","endLoc":821,"id":1939,"name":"_standard","nodeType":"Attribute","startLoc":821,"text":"_standard"},{"className":"ExtensionHDU","col":0,"comment":"\n    An extension HDU class.\n\n    This class is the base class for the `TableHDU`, `ImageHDU`, and\n    `BinTableHDU` classes.\n    ","endLoc":1589,"id":1940,"nodeType":"Class","startLoc":1543,"text":"class ExtensionHDU(_ValidHDU):\n    \"\"\"\n    An extension HDU class.\n\n    This class is the base class for the `TableHDU`, `ImageHDU`, and\n    `BinTableHDU` classes.\n    \"\"\"\n\n    _extension = ''\n\n    @classmethod\n    def match_header(cls, header):\n        \"\"\"\n        This class should never be instantiated directly.  Either a standard\n        extension HDU type should be used for a specific extension, or\n        NonstandardExtHDU should be used.\n        \"\"\"\n\n        raise NotImplementedError\n\n    def writeto(self, name, output_verify='exception', overwrite=False,\n                checksum=False):\n        \"\"\"\n        Works similarly to the normal writeto(), but prepends a default\n        `PrimaryHDU` are required by extension HDUs (which cannot stand on\n        their own).\n        \"\"\"\n\n        from .hdulist import HDUList\n        from .image import PrimaryHDU\n\n        hdulist = HDUList([PrimaryHDU(), self])\n        hdulist.writeto(name, output_verify, overwrite=overwrite,\n                        checksum=checksum)\n\n    def _verify(self, option='warn'):\n\n        errs = super()._verify(option=option)\n\n        # Verify location and value of mandatory keywords.\n        naxis = self._header.get('NAXIS', 0)\n        self.req_cards('PCOUNT', naxis + 3, lambda v: (_is_int(v) and v >= 0),\n                       0, option, errs)\n        self.req_cards('GCOUNT', naxis + 4, lambda v: (_is_int(v) and v == 1),\n                       1, option, errs)\n\n        return errs"},{"col":4,"comment":"\n        This class should never be instantiated directly.  Either a standard\n        extension HDU type should be used for a specific extension, or\n        NonstandardExtHDU should be used.\n        ","endLoc":1561,"header":"@classmethod\n    def match_header(cls, header)","id":1941,"name":"match_header","nodeType":"Function","startLoc":1553,"text":"@classmethod\n    def match_header(cls, header):\n        \"\"\"\n        This class should never be instantiated directly.  Either a standard\n        extension HDU type should be used for a specific extension, or\n        NonstandardExtHDU should be used.\n        \"\"\"\n\n        raise NotImplementedError"},{"col":4,"comment":"\n        Works similarly to the normal writeto(), but prepends a default\n        `PrimaryHDU` are required by extension HDUs (which cannot stand on\n        their own).\n        ","endLoc":1576,"header":"def writeto(self, name, output_verify='exception', overwrite=False,\n                checksum=False)","id":1942,"name":"writeto","nodeType":"Function","startLoc":1563,"text":"def writeto(self, name, output_verify='exception', overwrite=False,\n                checksum=False):\n        \"\"\"\n        Works similarly to the normal writeto(), but prepends a default\n        `PrimaryHDU` are required by extension HDUs (which cannot stand on\n        their own).\n        \"\"\"\n\n        from .hdulist import HDUList\n        from .image import PrimaryHDU\n\n        hdulist = HDUList([PrimaryHDU(), self])\n        hdulist.writeto(name, output_verify, overwrite=overwrite,\n                        checksum=checksum)"},{"col":4,"comment":"\n        Add the ``DATASUM`` card to this HDU with the value set to the\n        checksum calculated for the data.\n\n        Parameters\n        ----------\n        when : str, optional\n            Comment string for the card that by default represents the\n            time when the checksum was calculated\n\n        datasum_keyword : str, optional\n            The name of the header keyword to store the datasum value in;\n            this is typically 'DATASUM' per convention, but there exist\n            use cases in which a different keyword should be used\n\n        Returns\n        -------\n        checksum : int\n            The calculated datasum\n\n        Notes\n        -----\n        For testing purposes, provide a ``when`` argument to enable the comment\n        value in the card to remain consistent.  This will enable the\n        generation of a ``CHECKSUM`` card with a consistent value.\n        ","endLoc":1231,"header":"def add_datasum(self, when=None, datasum_keyword='DATASUM')","id":1943,"name":"add_datasum","nodeType":"Function","startLoc":1197,"text":"def add_datasum(self, when=None, datasum_keyword='DATASUM'):\n        \"\"\"\n        Add the ``DATASUM`` card to this HDU with the value set to the\n        checksum calculated for the data.\n\n        Parameters\n        ----------\n        when : str, optional\n            Comment string for the card that by default represents the\n            time when the checksum was calculated\n\n        datasum_keyword : str, optional\n            The name of the header keyword to store the datasum value in;\n            this is typically 'DATASUM' per convention, but there exist\n            use cases in which a different keyword should be used\n\n        Returns\n        -------\n        checksum : int\n            The calculated datasum\n\n        Notes\n        -----\n        For testing purposes, provide a ``when`` argument to enable the comment\n        value in the card to remain consistent.  This will enable the\n        generation of a ``CHECKSUM`` card with a consistent value.\n        \"\"\"\n\n        cs = self._calculate_datasum()\n\n        if when is None:\n            when = f'data unit checksum updated {self._get_timestamp()}'\n\n        self._header[datasum_keyword] = (str(cs), when)\n        return cs"},{"col":4,"comment":"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        ","endLoc":1386,"header":"def _calculate_datasum(self)","id":1944,"name":"_calculate_datasum","nodeType":"Function","startLoc":1368,"text":"def _calculate_datasum(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        \"\"\"\n\n        if not self._data_loaded:\n            # This is the case where the data has not been read from the file\n            # yet.  We find the data in the file, read it, and calculate the\n            # datasum.\n            if self.size > 0:\n                raw_data = self._get_raw_data(self._data_size, 'ubyte',\n                                              self._data_offset)\n                return self._compute_checksum(raw_data)\n            else:\n                return 0\n        elif self.data is not None:\n            return self._compute_checksum(self.data.view('ubyte'))\n        else:\n            return 0"},{"col":4,"comment":"null","endLoc":1589,"header":"def _verify(self, option='warn')","id":1945,"name":"_verify","nodeType":"Function","startLoc":1578,"text":"def _verify(self, option='warn'):\n\n        errs = super()._verify(option=option)\n\n        # Verify location and value of mandatory keywords.\n        naxis = self._header.get('NAXIS', 0)\n        self.req_cards('PCOUNT', naxis + 3, lambda v: (_is_int(v) and v >= 0),\n                       0, option, errs)\n        self.req_cards('GCOUNT', naxis + 4, lambda v: (_is_int(v) and v == 1),\n                       1, option, errs)\n\n        return errs"},{"col":4,"comment":"null","endLoc":2012,"header":"@property\n    def ColumnClass(self)","id":1946,"name":"ColumnClass","nodeType":"Function","startLoc":2007,"text":"@property\n    def ColumnClass(self):\n        if self._column_class is None:\n            return self.Column\n        else:\n            return self._column_class"},{"col":4,"comment":"\n        Compute the ones-complement checksum of a sequence of bytes.\n\n        Parameters\n        ----------\n        data\n            a memory region to checksum\n\n        sum32\n            incremental checksum value from another region\n\n        Returns\n        -------\n        ones complement checksum\n        ","endLoc":1432,"header":"def _compute_checksum(self, data, sum32=0)","id":1947,"name":"_compute_checksum","nodeType":"Function","startLoc":1410,"text":"def _compute_checksum(self, data, sum32=0):\n        \"\"\"\n        Compute the ones-complement checksum of a sequence of bytes.\n\n        Parameters\n        ----------\n        data\n            a memory region to checksum\n\n        sum32\n            incremental checksum value from another region\n\n        Returns\n        -------\n        ones complement checksum\n        \"\"\"\n\n        blocklen = 2880\n        sum32 = np.uint32(sum32)\n        for i in range(0, len(data), blocklen):\n            length = min(blocklen, len(data) - i)   # ????\n            sum32 = self._compute_hdu_checksum(data[i:i + length], sum32)\n        return sum32"},{"col":4,"comment":"\n        Make sure that all Column objects have correct base class for this type of\n        Table.  For a base Table this most commonly means setting to\n        MaskedColumn if the table is masked.  Table subclasses like QTable\n        override this method.\n        ","endLoc":1381,"header":"def _convert_col_for_table(self, col)","id":1948,"name":"_convert_col_for_table","nodeType":"Function","startLoc":1369,"text":"def _convert_col_for_table(self, col):\n        \"\"\"\n        Make sure that all Column objects have correct base class for this type of\n        Table.  For a base Table this most commonly means setting to\n        MaskedColumn if the table is masked.  Table subclasses like QTable\n        override this method.\n        \"\"\"\n        if isinstance(col, Column) and not isinstance(col, self.ColumnClass):\n            col_cls = self._get_col_cls_for_table(col)\n            if col_cls is not col.__class__:\n                col = col_cls(col, copy=False)\n\n        return col"},{"col":4,"comment":"\n        Translated from FITS Checksum Proposal by Seaman, Pence, and Rots.\n        Use uint32 literals as a hedge against type promotion to int64.\n\n        This code should only be called with blocks of 2880 bytes\n        Longer blocks result in non-standard checksums with carry overflow\n        Historically,  this code *was* called with larger blocks and for that\n        reason still needs to be for backward compatibility.\n        ","endLoc":1476,"header":"def _compute_hdu_checksum(self, data, sum32=0)","id":1949,"name":"_compute_hdu_checksum","nodeType":"Function","startLoc":1434,"text":"def _compute_hdu_checksum(self, data, sum32=0):\n        \"\"\"\n        Translated from FITS Checksum Proposal by Seaman, Pence, and Rots.\n        Use uint32 literals as a hedge against type promotion to int64.\n\n        This code should only be called with blocks of 2880 bytes\n        Longer blocks result in non-standard checksums with carry overflow\n        Historically,  this code *was* called with larger blocks and for that\n        reason still needs to be for backward compatibility.\n        \"\"\"\n\n        u8 = np.uint32(8)\n        u16 = np.uint32(16)\n        uFFFF = np.uint32(0xFFFF)\n\n        if data.nbytes % 2:\n            last = data[-1]\n            data = data[:-1]\n        else:\n            last = np.uint32(0)\n\n        data = data.view('>u2')\n\n        hi = sum32 >> u16\n        lo = sum32 & uFFFF\n        hi += np.add.reduce(data[0::2], dtype=np.uint64)\n        lo += np.add.reduce(data[1::2], dtype=np.uint64)\n\n        if (data.nbytes // 2) % 2:\n            lo += last << u8\n        else:\n            hi += last << u8\n\n        hicarry = hi >> u16\n        locarry = lo >> u16\n\n        while hicarry or locarry:\n            hi = (hi & uFFFF) + locarry\n            lo = (lo & uFFFF) + hicarry\n            hicarry = hi >> u16\n            locarry = lo >> u16\n\n        return (hi << u16) + lo"},{"col":44,"endLoc":1584,"id":1950,"nodeType":"Lambda","startLoc":1584,"text":"lambda v: (_is_int(v) and v >= 0)"},{"col":44,"endLoc":1586,"id":1951,"nodeType":"Lambda","startLoc":1586,"text":"lambda v: (_is_int(v) and v == 1)"},{"col":4,"comment":"null","endLoc":2527,"header":"def add_lalr_lookaheads(self, C)","id":1952,"name":"add_lalr_lookaheads","nodeType":"Function","startLoc":2510,"text":"def add_lalr_lookaheads(self, C):\n        # Determine all of the nullable nonterminals\n        nullable = self.compute_nullable_nonterminals()\n\n        # Find all non-terminal transitions\n        trans = self.find_nonterminal_transitions(C)\n\n        # Compute read sets\n        readsets = self.compute_read_sets(C, trans, nullable)\n\n        # Compute lookback/includes relations\n        lookd, included = self.compute_lookback_includes(C, trans, nullable)\n\n        # Compute LALR FOLLOW sets\n        followsets = self.compute_follow_sets(trans, readsets, included)\n\n        # Add all of the lookaheads\n        self.add_lookaheads(lookd, followsets)"},{"col":4,"comment":"null","endLoc":2272,"header":"def compute_nullable_nonterminals(self)","id":1953,"name":"compute_nullable_nonterminals","nodeType":"Function","startLoc":2256,"text":"def compute_nullable_nonterminals(self):\n        nullable = set()\n        num_nullable = 0\n        while True:\n            for p in self.grammar.Productions[1:]:\n                if p.len == 0:\n                    nullable.add(p.name)\n                    continue\n                for t in p.prod:\n                    if t not in nullable:\n                        break\n                else:\n                    nullable.add(p.name)\n            if len(nullable) == num_nullable:\n                break\n            num_nullable = len(nullable)\n        return nullable"},{"attributeType":"null","col":4,"comment":"null","endLoc":1551,"id":1954,"name":"_extension","nodeType":"Attribute","startLoc":1551,"text":"_extension"},{"col":4,"comment":"Initialize table from a list of Column or mixin objects","endLoc":1407,"header":"def _init_from_cols(self, cols)","id":1955,"name":"_init_from_cols","nodeType":"Function","startLoc":1383,"text":"def _init_from_cols(self, cols):\n        \"\"\"Initialize table from a list of Column or mixin objects\"\"\"\n\n        lengths = set(len(col) for col in cols)\n        if len(lengths) > 1:\n            raise ValueError(f'Inconsistent data column lengths: {lengths}')\n\n        # Make sure that all Column-based objects have correct class.  For\n        # plain Table this is self.ColumnClass, but for instance QTable will\n        # convert columns with units to a Quantity mixin.\n        newcols = [self._convert_col_for_table(col) for col in cols]\n        self._make_table_from_cols(self, newcols)\n\n        # Deduplicate indices.  It may happen that after pickling or when\n        # initing from an existing table that column indices which had been\n        # references to a single index object got *copied* into an independent\n        # object.  This results in duplicates which will cause downstream problems.\n        index_dict = {}\n        for col in self.itercols():\n            for i, index in enumerate(col.info.indices or []):\n                names = tuple(ind_col.info.name for ind_col in index.columns)\n                if names in index_dict:\n                    col.info.indices[i] = index_dict[names]\n                else:\n                    index_dict[names] = index"},{"className":"GroupsHDU","col":0,"comment":"\n    FITS Random Groups HDU class.\n\n    See the :ref:`astropy:random-groups` section in the Astropy documentation\n    for more details on working with this type of HDU.\n    ","endLoc":586,"id":1956,"nodeType":"Class","startLoc":252,"text":"class GroupsHDU(PrimaryHDU, _TableLikeHDU):\n    \"\"\"\n    FITS Random Groups HDU class.\n\n    See the :ref:`astropy:random-groups` section in the Astropy documentation\n    for more details on working with this type of HDU.\n    \"\"\"\n\n    _bitpix2tform = {8: 'B', 16: 'I', 32: 'J', 64: 'K', -32: 'E', -64: 'D'}\n    _data_type = GroupData\n    _data_field = 'DATA'\n    \"\"\"\n    The name of the table record array field that will contain the group data\n    for each group; 'DATA' by default, but may be preceded by any number of\n    underscores if 'DATA' is already a parameter name\n    \"\"\"\n\n    def __init__(self, data=None, header=None):\n        super().__init__(data=data, header=header)\n        if data is not DELAYED:\n            self.update_header()\n\n        # Update the axes; GROUPS HDUs should always have at least one axis\n        if len(self._axes) <= 0:\n            self._axes = [0]\n            self._header['NAXIS'] = 1\n            self._header.set('NAXIS1', 0, after='NAXIS')\n\n    @classmethod\n    def match_header(cls, header):\n        keyword = header.cards[0].keyword\n        return (keyword == 'SIMPLE' and 'GROUPS' in header and\n                header['GROUPS'] is True)\n\n    @lazyproperty\n    def data(self):\n        \"\"\"\n        The data of a random group FITS file will be like a binary table's\n        data.\n        \"\"\"\n\n        if self._axes == [0]:\n            return\n\n        data = self._get_tbdata()\n        data._coldefs = self.columns\n        data.parnames = self.parnames\n        del self.columns\n        return data\n\n    @lazyproperty\n    def parnames(self):\n        \"\"\"The names of the group parameters as described by the header.\"\"\"\n\n        pcount = self._header['PCOUNT']\n        # The FITS standard doesn't really say what to do if a parname is\n        # missing, so for now just assume that won't happen\n        return [self._header['PTYPE' + str(idx + 1)] for idx in range(pcount)]\n\n    @lazyproperty\n    def columns(self):\n        if self._has_data and hasattr(self.data, '_coldefs'):\n            return self.data._coldefs\n\n        format = self._bitpix2tform[self._header['BITPIX']]\n        pcount = self._header['PCOUNT']\n        parnames = []\n        bscales = []\n        bzeros = []\n\n        for idx in range(pcount):\n            bscales.append(self._header.get('PSCAL' + str(idx + 1), None))\n            bzeros.append(self._header.get('PZERO' + str(idx + 1), None))\n            parnames.append(self._header['PTYPE' + str(idx + 1)])\n\n        formats = [format] * len(parnames)\n        dim = [None] * len(parnames)\n\n        # Now create columns from collected parameters, but first add the DATA\n        # column too, to contain the group data.\n        parnames.append('DATA')\n        bscales.append(self._header.get('BSCALE'))\n        bzeros.append(self._header.get('BZEROS'))\n        data_shape = self.shape[:-1]\n        formats.append(str(int(np.prod(data_shape))) + format)\n        dim.append(data_shape)\n        parnames = _unique_parnames(parnames)\n\n        self._data_field = parnames[-1]\n\n        cols = [Column(name=name, format=fmt, bscale=bscale, bzero=bzero,\n                       dim=dim)\n                for name, fmt, bscale, bzero, dim in\n                zip(parnames, formats, bscales, bzeros, dim)]\n\n        coldefs = ColDefs(cols)\n        return coldefs\n\n    @property\n    def _nrows(self):\n        if not self._data_loaded:\n            # The number of 'groups' equates to the number of rows in the table\n            # representation of the data\n            return self._header.get('GCOUNT', 0)\n        else:\n            return len(self.data)\n\n    @lazyproperty\n    def _theap(self):\n        # Only really a lazyproperty for symmetry with _TableBaseHDU\n        return 0\n\n    @property\n    def is_image(self):\n        return False\n\n    @property\n    def size(self):\n        \"\"\"\n        Returns the size (in bytes) of the HDU's data part.\n        \"\"\"\n\n        size = 0\n        naxis = self._header.get('NAXIS', 0)\n\n        # for random group image, NAXIS1 should be 0, so we skip NAXIS1.\n        if naxis > 1:\n            size = 1\n            for idx in range(1, naxis):\n                size = size * self._header['NAXIS' + str(idx + 1)]\n            bitpix = self._header['BITPIX']\n            gcount = self._header.get('GCOUNT', 1)\n            pcount = self._header.get('PCOUNT', 0)\n            size = abs(bitpix) * gcount * (pcount + size) // 8\n        return size\n\n    def update_header(self):\n        old_naxis = self._header.get('NAXIS', 0)\n\n        if self._data_loaded:\n            if isinstance(self.data, GroupData):\n                self._axes = list(self.data.data.shape)[1:]\n                self._axes.reverse()\n                self._axes = [0] + self._axes\n                field0 = self.data.dtype.names[0]\n                field0_code = self.data.dtype.fields[field0][0].name\n            elif self.data is None:\n                self._axes = [0]\n                field0_code = 'uint8'  # For lack of a better default\n            else:\n                raise ValueError('incorrect array type')\n\n            self._header['BITPIX'] = DTYPE2BITPIX[field0_code]\n\n        self._header['NAXIS'] = len(self._axes)\n\n        # add NAXISi if it does not exist\n        for idx, axis in enumerate(self._axes):\n            if (idx == 0):\n                after = 'NAXIS'\n            else:\n                after = 'NAXIS' + str(idx)\n\n            self._header.set('NAXIS' + str(idx + 1), axis, after=after)\n\n        # delete extra NAXISi's\n        for idx in range(len(self._axes) + 1, old_naxis + 1):\n            try:\n                del self._header['NAXIS' + str(idx)]\n            except KeyError:\n                pass\n\n        if self._has_data and isinstance(self.data, GroupData):\n            self._header.set('GROUPS', True,\n                             after='NAXIS' + str(len(self._axes)))\n            self._header.set('PCOUNT', len(self.data.parnames), after='GROUPS')\n            self._header.set('GCOUNT', len(self.data), after='PCOUNT')\n\n            column = self.data._coldefs[self._data_field]\n            scale, zero = self.data._get_scale_factors(column)[3:5]\n            if scale:\n                self._header.set('BSCALE', column.bscale)\n            if zero:\n                self._header.set('BZERO', column.bzero)\n\n            for idx, name in enumerate(self.data.parnames):\n                self._header.set('PTYPE' + str(idx + 1), name)\n                column = self.data._coldefs[idx]\n                scale, zero = self.data._get_scale_factors(column)[3:5]\n                if scale:\n                    self._header.set('PSCAL' + str(idx + 1), column.bscale)\n                if zero:\n                    self._header.set('PZERO' + str(idx + 1), column.bzero)\n\n        # Update the position of the EXTEND keyword if it already exists\n        if 'EXTEND' in self._header:\n            if len(self._axes):\n                after = 'NAXIS' + str(len(self._axes))\n            else:\n                after = 'NAXIS'\n            self._header.set('EXTEND', after=after)\n\n    def _writedata_internal(self, fileobj):\n        \"\"\"\n        Basically copy/pasted from `_ImageBaseHDU._writedata_internal()`, but\n        we have to get the data's byte order a different way...\n\n        TODO: Might be nice to store some indication of the data's byte order\n        as an attribute or function so that we don't have to do this.\n        \"\"\"\n\n        size = 0\n\n        if self.data is not None:\n            self.data._scale_back()\n\n            # Based on the system type, determine the byteorders that\n            # would need to be swapped to get to big-endian output\n            if sys.byteorder == 'little':\n                swap_types = ('<', '=')\n            else:\n                swap_types = ('<',)\n            # deal with unsigned integer 16, 32 and 64 data\n            if _is_pseudo_integer(self.data.dtype):\n                # Convert the unsigned array to signed\n                output = np.array(\n                    self.data - _pseudo_zero(self.data.dtype),\n                    dtype=f'>i{self.data.dtype.itemsize}')\n                should_swap = False\n            else:\n                output = self.data\n                fname = self.data.dtype.names[0]\n                byteorder = self.data.dtype.fields[fname][0].str[0]\n                should_swap = (byteorder in swap_types)\n\n            if should_swap:\n                if output.flags.writeable:\n                    output.byteswap(True)\n                    try:\n                        fileobj.writearray(output)\n                    finally:\n                        output.byteswap(True)\n                else:\n                    # For read-only arrays, there is no way around making\n                    # a byteswapped copy of the data.\n                    fileobj.writearray(output.byteswap(False))\n            else:\n                fileobj.writearray(output)\n\n            size += output.size * output.itemsize\n        return size\n\n    def _verify(self, option='warn'):\n        errs = super()._verify(option=option)\n\n        # Verify locations and values of mandatory keywords.\n        self.req_cards('NAXIS', 2,\n                       lambda v: (_is_int(v) and 1 <= v <= 999), 1,\n                       option, errs)\n        self.req_cards('NAXIS1', 3, lambda v: (_is_int(v) and v == 0), 0,\n                       option, errs)\n\n        after = self._header['NAXIS'] + 3\n        pos = lambda x: x >= after\n\n        self.req_cards('GCOUNT', pos, _is_int, 1, option, errs)\n        self.req_cards('PCOUNT', pos, _is_int, 0, option, errs)\n        self.req_cards('GROUPS', pos, lambda v: (v is True), True, option,\n                       errs)\n        return errs\n\n    def _calculate_datasum(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        \"\"\"\n\n        if self._has_data:\n\n            # We have the data to be used.\n\n            # Check the byte order of the data.  If it is little endian we\n            # must swap it before calculating the datasum.\n            # TODO: Maybe check this on a per-field basis instead of assuming\n            # that all fields have the same byte order?\n            byteorder = \\\n                self.data.dtype.fields[self.data.dtype.names[0]][0].str[0]\n\n            if byteorder != '>':\n                if self.data.flags.writeable:\n                    byteswapped = True\n                    d = self.data.byteswap(True)\n                    d.dtype = d.dtype.newbyteorder('>')\n                else:\n                    # If the data is not writeable, we just make a byteswapped\n                    # copy and don't bother changing it back after\n                    d = self.data.byteswap(False)\n                    d.dtype = d.dtype.newbyteorder('>')\n                    byteswapped = False\n            else:\n                byteswapped = False\n                d = self.data\n\n            byte_data = d.view(type=np.ndarray, dtype=np.ubyte)\n\n            cs = self._compute_checksum(byte_data)\n\n            # If the data was byteswapped in this method then return it to\n            # its original little-endian order.\n            if byteswapped:\n                d.byteswap(True)\n                d.dtype = d.dtype.newbyteorder('<')\n\n            return cs\n        else:\n            # This is the case where the data has not been read from the file\n            # yet.  We can handle that in a generic manner so we do it in the\n            # base class.  The other possibility is that there is no data at\n            # all.  This can also be handled in a generic manner.\n            return super()._calculate_datasum()\n\n    def _summary(self):\n        summary = super()._summary()\n        name, ver, classname, length, shape, format, gcount = summary\n\n        # Drop the first axis from the shape\n        if shape:\n            shape = shape[1:]\n\n            if shape and all(shape):\n                # Update the format\n                format = self.columns[0].dtype.name\n\n        # Update the GCOUNT report\n        gcount = f'{self._gcount} Groups  {self._pcount} Parameters'\n        return (name, ver, classname, length, shape, format, gcount)"},{"col":4,"comment":"null","endLoc":2294,"header":"def find_nonterminal_transitions(self, C)","id":1957,"name":"find_nonterminal_transitions","nodeType":"Function","startLoc":2285,"text":"def find_nonterminal_transitions(self, C):\n        trans = []\n        for stateno, state in enumerate(C):\n            for p in state:\n                if p.lr_index < p.len - 1:\n                    t = (stateno, p.prod[p.lr_index+1])\n                    if t[1] in self.grammar.Nonterminals:\n                        if t not in trans:\n                            trans.append(t)\n        return trans"},{"col":4,"comment":"null","endLoc":2456,"header":"def compute_read_sets(self, C, ntrans, nullable)","id":1958,"name":"compute_read_sets","nodeType":"Function","startLoc":2452,"text":"def compute_read_sets(self, C, ntrans, nullable):\n        FP = lambda x: self.dr_relation(C, x, nullable)\n        R =  lambda x: self.reads_relation(C, x, nullable)\n        F = digraph(ntrans, R, FP)\n        return F"},{"col":4,"comment":"\n        Return the current timestamp in ISO 8601 format, with microseconds\n        stripped off.\n\n        Ex.: 2007-05-30T19:05:11\n        ","endLoc":1366,"header":"def _get_timestamp(self)","id":1959,"name":"_get_timestamp","nodeType":"Function","startLoc":1358,"text":"def _get_timestamp(self):\n        \"\"\"\n        Return the current timestamp in ISO 8601 format, with microseconds\n        stripped off.\n\n        Ex.: 2007-05-30T19:05:11\n        \"\"\"\n\n        return datetime.datetime.now().isoformat()[:19]"},{"col":4,"comment":"\n        Make ``table`` in-place so that it represents the given list of ``cols``.\n        ","endLoc":1463,"header":"@staticmethod\n    def _make_table_from_cols(table, cols, verify=True, names=None)","id":1960,"name":"_make_table_from_cols","nodeType":"Function","startLoc":1442,"text":"@staticmethod\n    def _make_table_from_cols(table, cols, verify=True, names=None):\n        \"\"\"\n        Make ``table`` in-place so that it represents the given list of ``cols``.\n        \"\"\"\n        if names is None:\n            names = [col.info.name for col in cols]\n\n        # Note: we do not test for len(names) == len(cols) if names is not None.  In that\n        # case the function is being called by from \"trusted\" source (e.g. right above here)\n        # that is assumed to provide valid inputs.  In that case verify=False.\n\n        if verify:\n            if None in names:\n                raise TypeError('Cannot have None for column name')\n            if len(set(names)) != len(names):\n                raise ValueError('Duplicate column names')\n\n        table.columns = table.TableColumns((name, col) for name, col in zip(names, cols))\n\n        for col in cols:\n            table._set_col_parent_table_and_mask(col)"},{"col":4,"comment":"null","endLoc":2321,"header":"def dr_relation(self, C, trans, nullable)","id":1961,"name":"dr_relation","nodeType":"Function","startLoc":2305,"text":"def dr_relation(self, C, trans, nullable):\n        state, N = trans\n        terms = []\n\n        g = self.lr0_goto(C[state], N)\n        for p in g:\n            if p.lr_index < p.len - 1:\n                a = p.prod[p.lr_index+1]\n                if a in self.grammar.Terminals:\n                    if a not in terms:\n                        terms.append(a)\n\n        # This extra bit is to handle the start state\n        if state == 0 and N == self.grammar.Productions[0].prod[0]:\n            terms.append('$end')\n\n        return terms"},{"col":4,"comment":"\n        Add the ``CHECKSUM`` and ``DATASUM`` cards to this HDU with\n        the values set to the checksum calculated for the HDU and the\n        data respectively.  The addition of the ``DATASUM`` card may\n        be overridden.\n\n        Parameters\n        ----------\n        when : str, optional\n            comment string for the cards; by default the comments\n            will represent the time when the checksum was calculated\n        override_datasum : bool, optional\n            add the ``CHECKSUM`` card only\n        checksum_keyword : str, optional\n            The name of the header keyword to store the checksum value in; this\n            is typically 'CHECKSUM' per convention, but there exist use cases\n            in which a different keyword should be used\n\n        datasum_keyword : str, optional\n            See ``checksum_keyword``\n\n        Notes\n        -----\n        For testing purposes, first call `add_datasum` with a ``when``\n        argument, then call `add_checksum` with a ``when`` argument and\n        ``override_datasum`` set to `True`.  This will provide consistent\n        comments for both cards and enable the generation of a ``CHECKSUM``\n        card with a consistent value.\n        ","endLoc":1284,"header":"def add_checksum(self, when=None, override_datasum=False,\n                     checksum_keyword='CHECKSUM', datasum_keyword='DATASUM')","id":1962,"name":"add_checksum","nodeType":"Function","startLoc":1233,"text":"def add_checksum(self, when=None, override_datasum=False,\n                     checksum_keyword='CHECKSUM', datasum_keyword='DATASUM'):\n        \"\"\"\n        Add the ``CHECKSUM`` and ``DATASUM`` cards to this HDU with\n        the values set to the checksum calculated for the HDU and the\n        data respectively.  The addition of the ``DATASUM`` card may\n        be overridden.\n\n        Parameters\n        ----------\n        when : str, optional\n            comment string for the cards; by default the comments\n            will represent the time when the checksum was calculated\n        override_datasum : bool, optional\n            add the ``CHECKSUM`` card only\n        checksum_keyword : str, optional\n            The name of the header keyword to store the checksum value in; this\n            is typically 'CHECKSUM' per convention, but there exist use cases\n            in which a different keyword should be used\n\n        datasum_keyword : str, optional\n            See ``checksum_keyword``\n\n        Notes\n        -----\n        For testing purposes, first call `add_datasum` with a ``when``\n        argument, then call `add_checksum` with a ``when`` argument and\n        ``override_datasum`` set to `True`.  This will provide consistent\n        comments for both cards and enable the generation of a ``CHECKSUM``\n        card with a consistent value.\n        \"\"\"\n\n        if not override_datasum:\n            # Calculate and add the data checksum to the header.\n            data_cs = self.add_datasum(when, datasum_keyword=datasum_keyword)\n        else:\n            # Just calculate the data checksum\n            data_cs = self._calculate_datasum()\n\n        if when is None:\n            when = f'HDU checksum updated {self._get_timestamp()}'\n\n        # Add the CHECKSUM card to the header with a value of all zeros.\n        if datasum_keyword in self._header:\n            self._header.set(checksum_keyword, '0' * 16, when,\n                             before=datasum_keyword)\n        else:\n            self._header.set(checksum_keyword, '0' * 16, when)\n\n        csum = self._calculate_checksum(data_cs,\n                                        checksum_keyword=checksum_keyword)\n        self._header[checksum_keyword] = csum"},{"col":4,"comment":"\n        This is an abstract HDU type for HDUs that contain table-like data.\n        This is even more abstract than _TableBaseHDU which is specifically for\n        the standard ASCII and Binary Table types.\n        ","endLoc":68,"header":"@classmethod\n    def match_header(cls, header)","id":1963,"name":"match_header","nodeType":"Function","startLoc":60,"text":"@classmethod\n    def match_header(cls, header):\n        \"\"\"\n        This is an abstract HDU type for HDUs that contain table-like data.\n        This is even more abstract than _TableBaseHDU which is specifically for\n        the standard ASCII and Binary Table types.\n        \"\"\"\n\n        raise NotImplementedError"},{"col":4,"comment":"\n        Given either a `ColDefs` object, a sequence of `Column` objects,\n        or another table HDU or table data (a `FITS_rec` or multi-field\n        `numpy.ndarray` or `numpy.recarray` object, return a new table HDU of\n        the class this method was called on using the column definition from\n        the input.\n\n        See also `FITS_rec.from_columns`.\n\n        Parameters\n        ----------\n        columns : sequence of `Column`, `ColDefs` -like\n            The columns from which to create the table data, or an object with\n            a column-like structure from which a `ColDefs` can be instantiated.\n            This includes an existing `BinTableHDU` or `TableHDU`, or a\n            `numpy.recarray` to give some examples.\n\n            If these columns have data arrays attached that data may be used in\n            initializing the new table.  Otherwise the input columns will be\n            used as a template for a new table with the requested number of\n            rows.\n\n        header : `Header`\n            An optional `Header` object to instantiate the new HDU yet.  Header\n            keywords specifically related to defining the table structure (such\n            as the \"TXXXn\" keywords like TTYPEn) will be overridden by the\n            supplied column definitions, but all other informational and data\n            model-specific keywords are kept.\n\n        nrows : int\n            Number of rows in the new table.  If the input columns have data\n            associated with them, the size of the largest input column is used.\n            Otherwise the default is 0.\n\n        fill : bool\n            If `True`, will fill all cells with zeros or blanks.  If `False`,\n            copy the data from input, undefined cells will still be filled with\n            zeros/blanks.\n\n        character_as_bytes : bool\n            Whether to return bytes for string columns when accessed from the\n            HDU. By default this is `False` and (unicode) strings are returned,\n            but for large tables this may use up a lot of memory.\n\n        Notes\n        -----\n        Any additional keyword arguments accepted by the HDU class's\n        ``__init__`` may also be passed in as keyword arguments.\n        ","endLoc":128,"header":"@classmethod\n    def from_columns(cls, columns, header=None, nrows=0, fill=False,\n                     character_as_bytes=False, **kwargs)","id":1964,"name":"from_columns","nodeType":"Function","startLoc":70,"text":"@classmethod\n    def from_columns(cls, columns, header=None, nrows=0, fill=False,\n                     character_as_bytes=False, **kwargs):\n        \"\"\"\n        Given either a `ColDefs` object, a sequence of `Column` objects,\n        or another table HDU or table data (a `FITS_rec` or multi-field\n        `numpy.ndarray` or `numpy.recarray` object, return a new table HDU of\n        the class this method was called on using the column definition from\n        the input.\n\n        See also `FITS_rec.from_columns`.\n\n        Parameters\n        ----------\n        columns : sequence of `Column`, `ColDefs` -like\n            The columns from which to create the table data, or an object with\n            a column-like structure from which a `ColDefs` can be instantiated.\n            This includes an existing `BinTableHDU` or `TableHDU`, or a\n            `numpy.recarray` to give some examples.\n\n            If these columns have data arrays attached that data may be used in\n            initializing the new table.  Otherwise the input columns will be\n            used as a template for a new table with the requested number of\n            rows.\n\n        header : `Header`\n            An optional `Header` object to instantiate the new HDU yet.  Header\n            keywords specifically related to defining the table structure (such\n            as the \"TXXXn\" keywords like TTYPEn) will be overridden by the\n            supplied column definitions, but all other informational and data\n            model-specific keywords are kept.\n\n        nrows : int\n            Number of rows in the new table.  If the input columns have data\n            associated with them, the size of the largest input column is used.\n            Otherwise the default is 0.\n\n        fill : bool\n            If `True`, will fill all cells with zeros or blanks.  If `False`,\n            copy the data from input, undefined cells will still be filled with\n            zeros/blanks.\n\n        character_as_bytes : bool\n            Whether to return bytes for string columns when accessed from the\n            HDU. By default this is `False` and (unicode) strings are returned,\n            but for large tables this may use up a lot of memory.\n\n        Notes\n        -----\n        Any additional keyword arguments accepted by the HDU class's\n        ``__init__`` may also be passed in as keyword arguments.\n        \"\"\"\n\n        coldefs = cls._columns_type(columns)\n        data = FITS_rec.from_columns(coldefs, nrows=nrows, fill=fill,\n                                     character_as_bytes=character_as_bytes)\n        hdu = cls(data=data, header=header, character_as_bytes=character_as_bytes, **kwargs)\n        coldefs._add_listener(hdu)\n        return hdu"},{"col":4,"comment":"\n        Iterate over the columns of this table.\n\n        Examples\n        --------\n\n        To iterate over the columns of a table::\n\n            >>> t = Table([[1], [2]])\n            >>> for col in t.itercols():\n            ...     print(col)\n            col0\n            ----\n               1\n            col1\n            ----\n               2\n\n        Using ``itercols()`` is similar to  ``for col in t.columns.values()``\n        but is syntactically preferred.\n        ","endLoc":1502,"header":"def itercols(self)","id":1965,"name":"itercols","nodeType":"Function","startLoc":1479,"text":"def itercols(self):\n        \"\"\"\n        Iterate over the columns of this table.\n\n        Examples\n        --------\n\n        To iterate over the columns of a table::\n\n            >>> t = Table([[1], [2]])\n            >>> for col in t.itercols():\n            ...     print(col)\n            col0\n            ----\n               1\n            col1\n            ----\n               2\n\n        Using ``itercols()`` is similar to  ``for col in t.columns.values()``\n        but is syntactically preferred.\n        \"\"\"\n        for colname in self.columns:\n            yield self[colname]"},{"col":4,"comment":"Initialize table from a dictionary of columns","endLoc":1342,"header":"def _init_from_dict(self, data, names, dtype, n_cols, copy)","id":1966,"name":"_init_from_dict","nodeType":"Function","startLoc":1338,"text":"def _init_from_dict(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from a dictionary of columns\"\"\"\n\n        data_list = [data[name] for name in names]\n        self._init_from_list(data_list, names, dtype, n_cols, copy)"},{"col":4,"comment":"Initialize table from an ndarray structured array","endLoc":1336,"header":"def _init_from_ndarray(self, data, names, dtype, n_cols, copy)","id":1967,"name":"_init_from_ndarray","nodeType":"Function","startLoc":1326,"text":"def _init_from_ndarray(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from an ndarray structured array\"\"\"\n\n        data_names = data.dtype.names or _auto_names(n_cols)\n        struct = data.dtype.names is not None\n        names = [name or data_names[i] for i, name in enumerate(names)]\n\n        cols = ([data[name] for name in data_names] if struct else\n                [data[:, i] for i in range(n_cols)])\n\n        self._init_from_list(cols, names, dtype, n_cols, copy)"},{"col":4,"comment":"\n        Calculate the value of the ``CHECKSUM`` card in the HDU.\n        ","endLoc":1408,"header":"def _calculate_checksum(self, datasum, checksum_keyword='CHECKSUM')","id":1968,"name":"_calculate_checksum","nodeType":"Function","startLoc":1388,"text":"def _calculate_checksum(self, datasum, checksum_keyword='CHECKSUM'):\n        \"\"\"\n        Calculate the value of the ``CHECKSUM`` card in the HDU.\n        \"\"\"\n\n        old_checksum = self._header[checksum_keyword]\n        self._header[checksum_keyword] = '0' * 16\n\n        # Convert the header to bytes.\n        s = self._header.tostring().encode('utf8')\n\n        # Calculate the checksum of the Header and data.\n        cs = self._compute_checksum(np.frombuffer(s, dtype='ubyte'), datasum)\n\n        # Encode the checksum into a string.\n        s = self._char_encode(~cs)\n\n        # Return the header card value.\n        self._header[checksum_keyword] = old_checksum\n\n        return s"},{"col":13,"endLoc":2453,"id":1969,"nodeType":"Lambda","startLoc":2453,"text":"lambda x: self.dr_relation(C, x, nullable)"},{"col":4,"comment":"Initialize table from a list of dictionaries representing rows.","endLoc":1158,"header":"def _init_from_list_of_dicts(self, data, names, dtype, n_cols, copy)","id":1970,"name":"_init_from_list_of_dicts","nodeType":"Function","startLoc":1098,"text":"def _init_from_list_of_dicts(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from a list of dictionaries representing rows.\"\"\"\n        # Define placeholder for missing values as a unique object that cannot\n        # every occur in user data.\n        MISSING = object()\n\n        # Gather column names that exist in the input `data`.\n        names_from_data = set()\n        for row in data:\n            names_from_data.update(row)\n\n        if set(data[0].keys()) == names_from_data:\n            names_from_data = list(data[0].keys())\n        else:\n            names_from_data = sorted(names_from_data)\n\n        # Note: if set(data[0].keys()) != names_from_data, this will give an\n        # exception later, so NO need to catch here.\n\n        # Convert list of dict into dict of list (cols), keep track of missing\n        # indexes and put in MISSING placeholders in the `cols` lists.\n        cols = {}\n        missing_indexes = defaultdict(list)\n        for name in names_from_data:\n            cols[name] = []\n            for ii, row in enumerate(data):\n                try:\n                    val = row[name]\n                except KeyError:\n                    missing_indexes[name].append(ii)\n                    val = MISSING\n                cols[name].append(val)\n\n        # Fill the missing entries with first values\n        if missing_indexes:\n            for name, indexes in missing_indexes.items():\n                col = cols[name]\n                first_val = next(val for val in col if val is not MISSING)\n                for index in indexes:\n                    col[index] = first_val\n\n        # prepare initialization\n        if all(name is None for name in names):\n            names = names_from_data\n\n        self._init_from_dict(cols, names, dtype, n_cols, copy)\n\n        # Mask the missing values if necessary, converting columns to MaskedColumn\n        # as needed.\n        if missing_indexes:\n            for name, indexes in missing_indexes.items():\n                col = self[name]\n                # Ensure that any Column subclasses with MISSING values can support\n                # setting masked values. As of astropy 4.0 the test condition below is\n                # always True since _init_from_dict cannot result in mixin columns.\n                if isinstance(col, Column) and not isinstance(col, MaskedColumn):\n                    self[name] = self.MaskedColumn(col, copy=False)\n\n                # Finally do the masking in a mixin-safe way.\n                self[name][indexes] = np.ma.masked\n        return"},{"col":4,"comment":"\n        Encodes the checksum ``value`` using the algorithm described\n        in SPR section A.7.2 and returns it as a 16 character string.\n\n        Parameters\n        ----------\n        value\n            a checksum\n\n        Returns\n        -------\n        ascii encoded checksum\n        ","endLoc":1540,"header":"def _char_encode(self, value)","id":1971,"name":"_char_encode","nodeType":"Function","startLoc":1511,"text":"def _char_encode(self, value):\n        \"\"\"\n        Encodes the checksum ``value`` using the algorithm described\n        in SPR section A.7.2 and returns it as a 16 character string.\n\n        Parameters\n        ----------\n        value\n            a checksum\n\n        Returns\n        -------\n        ascii encoded checksum\n        \"\"\"\n\n        value = np.uint32(value)\n\n        asc = np.zeros((16,), dtype='byte')\n        ascii = np.zeros((16,), dtype='byte')\n\n        for i in range(4):\n            byte = (value & self._MASK[i]) >> ((3 - i) * 8)\n            ch = self._encode_byte(byte)\n            for j in range(4):\n                asc[4 * j + i] = ch[j]\n\n        for i in range(16):\n            ascii[i] = asc[(i + 15) % 16]\n\n        return decode_ascii(ascii.tobytes())"},{"col":4,"comment":"null","endLoc":2342,"header":"def reads_relation(self, C, trans, empty)","id":1972,"name":"reads_relation","nodeType":"Function","startLoc":2329,"text":"def reads_relation(self, C, trans, empty):\n        # Look for empty transitions\n        rel = []\n        state, N = trans\n\n        g = self.lr0_goto(C[state], N)\n        j = self.lr0_cidhash.get(id(g), -1)\n        for p in g:\n            if p.lr_index < p.len - 1:\n                a = p.prod[p.lr_index + 1]\n                if a in empty:\n                    rel.append((j, a))\n\n        return rel"},{"col":4,"comment":"\n        Encode a single byte.\n        ","endLoc":1509,"header":"def _encode_byte(self, byte)","id":1973,"name":"_encode_byte","nodeType":"Function","startLoc":1488,"text":"def _encode_byte(self, byte):\n        \"\"\"\n        Encode a single byte.\n        \"\"\"\n\n        quotient = byte // 4 + ord('0')\n        remainder = byte % 4\n\n        ch = np.array(\n            [(quotient + remainder), quotient, quotient, quotient],\n            dtype='int32')\n\n        check = True\n        while check:\n            check = False\n            for x in self._EXCLUDE:\n                for j in [0, 2]:\n                    if ch[j] == x or ch[j + 1] == x:\n                        ch[j] += 1\n                        ch[j + 1] -= 1\n                        check = True\n        return ch"},{"className":"PrimaryHDU","col":0,"comment":"\n    FITS primary HDU class.\n    ","endLoc":1111,"id":1974,"nodeType":"Class","startLoc":1019,"text":"class PrimaryHDU(_ImageBaseHDU):\n    \"\"\"\n    FITS primary HDU class.\n    \"\"\"\n\n    _default_name = 'PRIMARY'\n\n    def __init__(self, data=None, header=None, do_not_scale_image_data=False,\n                 ignore_blank=False,\n                 uint=True, scale_back=None):\n        \"\"\"\n        Construct a primary HDU.\n\n        Parameters\n        ----------\n        data : array or ``astropy.io.fits.hdu.base.DELAYED``, optional\n            The data in the HDU.\n\n        header : `~astropy.io.fits.Header`, optional\n            The header to be used (as a template).  If ``header`` is `None`, a\n            minimal header will be provided.\n\n        do_not_scale_image_data : bool, optional\n            If `True`, image data is not scaled using BSCALE/BZERO values\n            when read. (default: False)\n\n        ignore_blank : bool, optional\n            If `True`, the BLANK header keyword will be ignored if present.\n            Otherwise, pixels equal to this value will be replaced with\n            NaNs. (default: False)\n\n        uint : bool, optional\n            Interpret signed integer data where ``BZERO`` is the\n            central value and ``BSCALE == 1`` as unsigned integer\n            data.  For example, ``int16`` data with ``BZERO = 32768``\n            and ``BSCALE = 1`` would be treated as ``uint16`` data.\n            (default: True)\n\n        scale_back : bool, optional\n            If `True`, when saving changes to a file that contained scaled\n            image data, restore the data to the original type and reapply the\n            original BSCALE/BZERO values.  This could lead to loss of accuracy\n            if scaling back to integer values after performing floating point\n            operations on the data.  Pseudo-unsigned integers are automatically\n            rescaled unless scale_back is explicitly set to `False`.\n            (default: None)\n        \"\"\"\n\n        super().__init__(\n            data=data, header=header,\n            do_not_scale_image_data=do_not_scale_image_data, uint=uint,\n            ignore_blank=ignore_blank,\n            scale_back=scale_back)\n\n        # insert the keywords EXTEND\n        if header is None:\n            dim = self._header['NAXIS']\n            if dim == 0:\n                dim = ''\n            self._header.set('EXTEND', True, after='NAXIS' + str(dim))\n\n    @classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        # Due to problems discussed in #5808, we cannot assume the 'GROUPS'\n        # keyword to be True/False, have to check the value\n        return (card.keyword == 'SIMPLE' and\n                ('GROUPS' not in header or header['GROUPS'] != True) and  # noqa\n                card.value)\n\n    def update_header(self):\n        super().update_header()\n\n        # Update the position of the EXTEND keyword if it already exists\n        if 'EXTEND' in self._header:\n            if len(self._axes):\n                after = 'NAXIS' + str(len(self._axes))\n            else:\n                after = 'NAXIS'\n            self._header.set('EXTEND', after=after)\n\n    def _verify(self, option='warn'):\n        errs = super()._verify(option=option)\n\n        # Verify location and value of mandatory keywords.\n        # The EXTEND keyword is only mandatory if the HDU has extensions; this\n        # condition is checked by the HDUList object.  However, if we already\n        # have an EXTEND keyword check that its position is correct\n        if 'EXTEND' in self._header:\n            naxis = self._header.get('NAXIS', 0)\n            self.req_cards('EXTEND', naxis + 3, lambda v: isinstance(v, bool),\n                           True, option, errs)\n        return errs"},{"col":13,"endLoc":2454,"id":1975,"nodeType":"Lambda","startLoc":2454,"text":"lambda x: self.reads_relation(C, x, nullable)"},{"col":4,"comment":"\n        Verify that the value in the ``DATASUM`` keyword matches the value\n        calculated for the ``DATASUM`` of the current HDU data.\n\n        Returns\n        -------\n        valid : int\n            - 0 - failure\n            - 1 - success\n            - 2 - no ``DATASUM`` keyword present\n        ","endLoc":1307,"header":"def verify_datasum(self)","id":1976,"name":"verify_datasum","nodeType":"Function","startLoc":1286,"text":"def verify_datasum(self):\n        \"\"\"\n        Verify that the value in the ``DATASUM`` keyword matches the value\n        calculated for the ``DATASUM`` of the current HDU data.\n\n        Returns\n        -------\n        valid : int\n            - 0 - failure\n            - 1 - success\n            - 2 - no ``DATASUM`` keyword present\n        \"\"\"\n\n        if 'DATASUM' in self._header:\n            datasum = self._calculate_datasum()\n            if datasum == int(self._header['DATASUM']):\n                return 1\n            else:\n                # Failed\n                return 0\n        else:\n            return 2"},{"col":0,"comment":"null","endLoc":2066,"header":"def digraph(X, R, FP)","id":1977,"name":"digraph","nodeType":"Function","startLoc":2057,"text":"def digraph(X, R, FP):\n    N = {}\n    for x in X:\n        N[x] = 0\n    stack = []\n    F = {}\n    for x in X:\n        if N[x] == 0:\n            traverse(x, N, stack, F, X, R, FP)\n    return F"},{"col":0,"comment":"null","endLoc":2089,"header":"def traverse(x, N, stack, F, X, R, FP)","id":1978,"name":"traverse","nodeType":"Function","startLoc":2068,"text":"def traverse(x, N, stack, F, X, R, FP):\n    stack.append(x)\n    d = len(stack)\n    N[x] = d\n    F[x] = FP(x)             # F(X) <- F'(x)\n\n    rel = R(x)               # Get y's related to x\n    for y in rel:\n        if N[y] == 0:\n            traverse(y, N, stack, F, X, R, FP)\n        N[x] = min(N[x], N[y])\n        for a in F.get(y, []):\n            if a not in F[x]:\n                F[x].append(a)\n    if N[x] == d:\n        N[stack[-1]] = MAXINT\n        F[stack[-1]] = F[x]\n        element = stack.pop()\n        while element != x:\n            N[stack[-1]] = MAXINT\n            F[stack[-1]] = F[x]\n            element = stack.pop()"},{"col":4,"comment":"\n        Verify that the value in the ``CHECKSUM`` keyword matches the\n        value calculated for the current HDU CHECKSUM.\n\n        Returns\n        -------\n        valid : int\n            - 0 - failure\n            - 1 - success\n            - 2 - no ``CHECKSUM`` keyword present\n        ","endLoc":1334,"header":"def verify_checksum(self)","id":1979,"name":"verify_checksum","nodeType":"Function","startLoc":1309,"text":"def verify_checksum(self):\n        \"\"\"\n        Verify that the value in the ``CHECKSUM`` keyword matches the\n        value calculated for the current HDU CHECKSUM.\n\n        Returns\n        -------\n        valid : int\n            - 0 - failure\n            - 1 - success\n            - 2 - no ``CHECKSUM`` keyword present\n        \"\"\"\n\n        if 'CHECKSUM' in self._header:\n            if 'DATASUM' in self._header:\n                datasum = self._calculate_datasum()\n            else:\n                datasum = 0\n            checksum = self._calculate_checksum(datasum)\n            if checksum == self._header['CHECKSUM']:\n                return 1\n            else:\n                # Failed\n                return 0\n        else:\n            return 2"},{"col":4,"comment":"\n        Verify the checksum/datasum values if the cards exist in the header.\n        Simply displays warnings if either the checksum or datasum don't match.\n        ","endLoc":1356,"header":"def _verify_checksum_datasum(self)","id":1980,"name":"_verify_checksum_datasum","nodeType":"Function","startLoc":1336,"text":"def _verify_checksum_datasum(self):\n        \"\"\"\n        Verify the checksum/datasum values if the cards exist in the header.\n        Simply displays warnings if either the checksum or datasum don't match.\n        \"\"\"\n\n        if 'CHECKSUM' in self._header:\n            self._checksum = self._header['CHECKSUM']\n            self._checksum_valid = self.verify_checksum()\n            if not self._checksum_valid:\n                warnings.warn(\n                    'Checksum verification failed for HDU {}.\\n'.format(\n                        (self.name, self.ver)), AstropyUserWarning)\n\n        if 'DATASUM' in self._header:\n            self._datasum = self._header['DATASUM']\n            self._datasum_valid = self.verify_datasum()\n            if not self._datasum_valid:\n                warnings.warn(\n                    'Datasum verification failed for HDU {}.\\n'.format(\n                        (self.name, self.ver)), AstropyUserWarning)"},{"col":4,"comment":"null","endLoc":2438,"header":"def compute_lookback_includes(self, C, trans, nullable)","id":1981,"name":"compute_lookback_includes","nodeType":"Function","startLoc":2372,"text":"def compute_lookback_includes(self, C, trans, nullable):\n        lookdict = {}          # Dictionary of lookback relations\n        includedict = {}       # Dictionary of include relations\n\n        # Make a dictionary of non-terminal transitions\n        dtrans = {}\n        for t in trans:\n            dtrans[t] = 1\n\n        # Loop over all transitions and compute lookbacks and includes\n        for state, N in trans:\n            lookb = []\n            includes = []\n            for p in C[state]:\n                if p.name != N:\n                    continue\n\n                # Okay, we have a name match.  We now follow the production all the way\n                # through the state machine until we get the . on the right hand side\n\n                lr_index = p.lr_index\n                j = state\n                while lr_index < p.len - 1:\n                    lr_index = lr_index + 1\n                    t = p.prod[lr_index]\n\n                    # Check to see if this symbol and state are a non-terminal transition\n                    if (j, t) in dtrans:\n                        # Yes.  Okay, there is some chance that this is an includes relation\n                        # the only way to know for certain is whether the rest of the\n                        # production derives empty\n\n                        li = lr_index + 1\n                        while li < p.len:\n                            if p.prod[li] in self.grammar.Terminals:\n                                break      # No forget it\n                            if p.prod[li] not in nullable:\n                                break\n                            li = li + 1\n                        else:\n                            # Appears to be a relation between (j,t) and (state,N)\n                            includes.append((j, t))\n\n                    g = self.lr0_goto(C[j], t)               # Go to next set\n                    j = self.lr0_cidhash.get(id(g), -1)      # Go to next state\n\n                # When we get here, j is the final state, now we have to locate the production\n                for r in C[j]:\n                    if r.name != p.name:\n                        continue\n                    if r.len != p.len:\n                        continue\n                    i = 0\n                    # This look is comparing a production \". A B C\" with \"A B C .\"\n                    while i < r.lr_index:\n                        if r.prod[i] != p.prod[i+1]:\n                            break\n                        i = i + 1\n                    else:\n                        lookb.append((j, r))\n            for i in includes:\n                if i not in includedict:\n                    includedict[i] = []\n                includedict[i].append((state, N))\n            lookdict[(state, N)] = lookb\n\n        return lookdict, includedict"},{"className":"_ImageBaseHDU","col":0,"comment":"FITS image HDU base class.\n\n    Attributes\n    ----------\n    header\n        image header\n\n    data\n        image data\n    ","endLoc":922,"id":1982,"nodeType":"Class","startLoc":21,"text":"class _ImageBaseHDU(_ValidHDU):\n    \"\"\"FITS image HDU base class.\n\n    Attributes\n    ----------\n    header\n        image header\n\n    data\n        image data\n    \"\"\"\n\n    standard_keyword_comments = {\n        'SIMPLE': 'conforms to FITS standard',\n        'XTENSION': 'Image extension',\n        'BITPIX': 'array data type',\n        'NAXIS': 'number of array dimensions',\n        'GROUPS': 'has groups',\n        'PCOUNT': 'number of parameters',\n        'GCOUNT': 'number of groups'\n    }\n\n    def __init__(self, data=None, header=None, do_not_scale_image_data=False,\n                 uint=True, scale_back=False, ignore_blank=False, **kwargs):\n\n        from .groups import GroupsHDU\n\n        super().__init__(data=data, header=header)\n\n        if data is DELAYED:\n            # Presumably if data is DELAYED then this HDU is coming from an\n            # open file, and was not created in memory\n            if header is None:\n                # this should never happen\n                raise ValueError('No header to setup HDU.')\n        else:\n            # TODO: Some of this card manipulation should go into the\n            # PrimaryHDU and GroupsHDU subclasses\n            # construct a list of cards of minimal header\n            if isinstance(self, ExtensionHDU):\n                c0 = ('XTENSION', 'IMAGE',\n                      self.standard_keyword_comments['XTENSION'])\n            else:\n                c0 = ('SIMPLE', True, self.standard_keyword_comments['SIMPLE'])\n            cards = [\n                c0,\n                ('BITPIX', 8, self.standard_keyword_comments['BITPIX']),\n                ('NAXIS', 0, self.standard_keyword_comments['NAXIS'])]\n\n            if isinstance(self, GroupsHDU):\n                cards.append(('GROUPS', True,\n                             self.standard_keyword_comments['GROUPS']))\n\n            if isinstance(self, (ExtensionHDU, GroupsHDU)):\n                cards.append(('PCOUNT', 0,\n                              self.standard_keyword_comments['PCOUNT']))\n                cards.append(('GCOUNT', 1,\n                              self.standard_keyword_comments['GCOUNT']))\n\n            if header is not None:\n                orig = header.copy()\n                header = Header(cards)\n                header.extend(orig, strip=True, update=True, end=True)\n            else:\n                header = Header(cards)\n\n            self._header = header\n\n        self._do_not_scale_image_data = do_not_scale_image_data\n\n        self._uint = uint\n        self._scale_back = scale_back\n\n        # Keep track of whether BZERO/BSCALE were set from the header so that\n        # values for self._orig_bzero and self._orig_bscale can be set\n        # properly, if necessary, once the data has been set.\n        bzero_in_header = 'BZERO' in self._header\n        bscale_in_header = 'BSCALE' in self._header\n        self._bzero = self._header.get('BZERO', 0)\n        self._bscale = self._header.get('BSCALE', 1)\n\n        # Save off other important values from the header needed to interpret\n        # the image data\n        self._axes = [self._header.get('NAXIS' + str(axis + 1), 0)\n                      for axis in range(self._header.get('NAXIS', 0))]\n\n        # Not supplying a default for BITPIX makes sense because BITPIX\n        # is either in the header or should be determined from the dtype of\n        # the data (which occurs when the data is set).\n        self._bitpix = self._header.get('BITPIX')\n        self._gcount = self._header.get('GCOUNT', 1)\n        self._pcount = self._header.get('PCOUNT', 0)\n        self._blank = None if ignore_blank else self._header.get('BLANK')\n        self._verify_blank()\n\n        self._orig_bitpix = self._bitpix\n        self._orig_blank = self._header.get('BLANK')\n\n        # These get set again below, but need to be set to sensible defaults\n        # here.\n        self._orig_bzero = self._bzero\n        self._orig_bscale = self._bscale\n\n        # Set the name attribute if it was provided (if this is an ImageHDU\n        # this will result in setting the EXTNAME keyword of the header as\n        # well)\n        if 'name' in kwargs and kwargs['name']:\n            self.name = kwargs['name']\n        if 'ver' in kwargs and kwargs['ver']:\n            self.ver = kwargs['ver']\n\n        # Set to True if the data or header is replaced, indicating that\n        # update_header should be called\n        self._modified = False\n\n        if data is DELAYED:\n            if (not do_not_scale_image_data and\n                    (self._bscale != 1 or self._bzero != 0)):\n                # This indicates that when the data is accessed or written out\n                # to a new file it will need to be rescaled\n                self._data_needs_rescale = True\n            return\n        else:\n            # Setting data will update the header and set _bitpix, _bzero,\n            # and _bscale to the appropriate BITPIX for the data, and always\n            # sets _bzero=0 and _bscale=1.\n            self.data = data\n\n            # Check again for BITPIX/BSCALE/BZERO in case they changed when the\n            # data was assigned. This can happen, for example, if the input\n            # data is an unsigned int numpy array.\n            self._bitpix = self._header.get('BITPIX')\n\n            # Do not provide default values for BZERO and BSCALE here because\n            # the keywords will have been deleted in the header if appropriate\n            # after scaling. We do not want to put them back in if they\n            # should not be there.\n            self._bzero = self._header.get('BZERO')\n            self._bscale = self._header.get('BSCALE')\n\n        # Handle case where there was no BZERO/BSCALE in the initial header\n        # but there should be a BSCALE/BZERO now that the data has been set.\n        if not bzero_in_header:\n            self._orig_bzero = self._bzero\n        if not bscale_in_header:\n            self._orig_bscale = self._bscale\n\n    @classmethod\n    def match_header(cls, header):\n        \"\"\"\n        _ImageBaseHDU is sort of an abstract class for HDUs containing image\n        data (as opposed to table data) and should never be used directly.\n        \"\"\"\n\n        raise NotImplementedError\n\n    @property\n    def is_image(self):\n        return True\n\n    @property\n    def section(self):\n        \"\"\"\n        Access a section of the image array without loading the entire array\n        into memory.  The :class:`Section` object returned by this attribute is\n        not meant to be used directly by itself.  Rather, slices of the section\n        return the appropriate slice of the data, and loads *only* that section\n        into memory.\n\n        Sections are mostly obsoleted by memmap support, but should still be\n        used to deal with very large scaled images.  See the\n        :ref:`astropy:data-sections` section of the Astropy documentation for\n        more details.\n        \"\"\"\n\n        return Section(self)\n\n    @property\n    def shape(self):\n        \"\"\"\n        Shape of the image array--should be equivalent to ``self.data.shape``.\n        \"\"\"\n\n        # Determine from the values read from the header\n        return tuple(reversed(self._axes))\n\n    @property\n    def header(self):\n        return self._header\n\n    @header.setter\n    def header(self, header):\n        self._header = header\n        self._modified = True\n        self.update_header()\n\n    @lazyproperty\n    def data(self):\n        \"\"\"\n        Image/array data as a `~numpy.ndarray`.\n\n        Please remember that the order of axes on an Numpy array are opposite\n        of the order specified in the FITS file.  For example for a 2D image\n        the \"rows\" or y-axis are the first dimension, and the \"columns\" or\n        x-axis are the second dimension.\n\n        If the data is scaled using the BZERO and BSCALE parameters, this\n        attribute returns the data scaled to its physical values unless the\n        file was opened with ``do_not_scale_image_data=True``.\n        \"\"\"\n\n        if len(self._axes) < 1:\n            return\n\n        data = self._get_scaled_image_data(self._data_offset, self.shape)\n        self._update_header_scale_info(data.dtype)\n\n        return data\n\n    @data.setter\n    def data(self, data):\n        if 'data' in self.__dict__ and self.__dict__['data'] is not None:\n            if self.__dict__['data'] is data:\n                return\n            else:\n                self._data_replaced = True\n            was_unsigned = _is_pseudo_integer(self.__dict__['data'].dtype)\n        else:\n            self._data_replaced = True\n            was_unsigned = False\n\n        if (data is not None\n                and not isinstance(data, np.ndarray)\n                and not _is_dask_array(data)):\n            # Try to coerce the data into a numpy array--this will work, on\n            # some level, for most objects\n            try:\n                data = np.array(data)\n            except Exception:\n                raise TypeError('data object {!r} could not be coerced into an '\n                                'ndarray'.format(data))\n\n            if data.shape == ():\n                raise TypeError('data object {!r} should have at least one '\n                                'dimension'.format(data))\n\n        self.__dict__['data'] = data\n        self._modified = True\n\n        if self.data is None:\n            self._axes = []\n        else:\n            # Set new values of bitpix, bzero, and bscale now, but wait to\n            # revise original values until header is updated.\n            self._bitpix = DTYPE2BITPIX[data.dtype.name]\n            self._bscale = 1\n            self._bzero = 0\n            self._blank = None\n            self._axes = list(data.shape)\n            self._axes.reverse()\n\n        # Update the header, including adding BZERO/BSCALE if new data is\n        # unsigned. Does not change the values of self._bitpix,\n        # self._orig_bitpix, etc.\n        self.update_header()\n        if (data is not None and was_unsigned):\n            self._update_header_scale_info(data.dtype)\n\n        # Keep _orig_bitpix as it was until header update is done, then\n        # set it, to allow easier handling of the case of unsigned\n        # integer data being converted to something else. Setting these here\n        # is needed only for the case do_not_scale_image_data=True when\n        # setting the data to unsigned int.\n\n        # If necessary during initialization, i.e. if BSCALE and BZERO were\n        # not in the header but the data was unsigned, the attributes below\n        # will be update in __init__.\n        self._orig_bitpix = self._bitpix\n        self._orig_bscale = self._bscale\n        self._orig_bzero = self._bzero\n\n        # returning the data signals to lazyproperty that we've already handled\n        # setting self.__dict__['data']\n        return data\n\n    def update_header(self):\n        \"\"\"\n        Update the header keywords to agree with the data.\n        \"\"\"\n\n        if not (self._modified or self._header._modified or\n                (self._has_data and self.shape != self.data.shape)):\n            # Not likely that anything needs updating\n            return\n\n        old_naxis = self._header.get('NAXIS', 0)\n\n        if 'BITPIX' not in self._header:\n            bitpix_comment = self.standard_keyword_comments['BITPIX']\n        else:\n            bitpix_comment = self._header.comments['BITPIX']\n\n        # Update the BITPIX keyword and ensure it's in the correct\n        # location in the header\n        self._header.set('BITPIX', self._bitpix, bitpix_comment, after=0)\n\n        # If the data's shape has changed (this may have happened without our\n        # noticing either via a direct update to the data.shape attribute) we\n        # need to update the internal self._axes\n        if self._has_data and self.shape != self.data.shape:\n            self._axes = list(self.data.shape)\n            self._axes.reverse()\n\n        # Update the NAXIS keyword and ensure it's in the correct location in\n        # the header\n        if 'NAXIS' in self._header:\n            naxis_comment = self._header.comments['NAXIS']\n        else:\n            naxis_comment = self.standard_keyword_comments['NAXIS']\n        self._header.set('NAXIS', len(self._axes), naxis_comment,\n                         after='BITPIX')\n\n        # TODO: This routine is repeated in several different classes--it\n        # should probably be made available as a method on all standard HDU\n        # types\n        # add NAXISi if it does not exist\n        for idx, axis in enumerate(self._axes):\n            naxisn = 'NAXIS' + str(idx + 1)\n            if naxisn in self._header:\n                self._header[naxisn] = axis\n            else:\n                if (idx == 0):\n                    after = 'NAXIS'\n                else:\n                    after = 'NAXIS' + str(idx)\n                self._header.set(naxisn, axis, after=after)\n\n        # delete extra NAXISi's\n        for idx in range(len(self._axes) + 1, old_naxis + 1):\n            try:\n                del self._header['NAXIS' + str(idx)]\n            except KeyError:\n                pass\n\n        if 'BLANK' in self._header:\n            self._blank = self._header['BLANK']\n\n        # Add BSCALE/BZERO to header if data is unsigned int.\n        self._update_pseudo_int_scale_keywords()\n\n        self._modified = False\n\n    def _update_header_scale_info(self, dtype=None):\n        \"\"\"\n        Delete BSCALE/BZERO from header if necessary.\n        \"\"\"\n\n        # Note that _dtype_for_bitpix determines the dtype based on the\n        # \"original\" values of bitpix, bscale, and bzero, stored in\n        # self._orig_bitpix, etc. It contains the logic for determining which\n        # special cases of BZERO/BSCALE, if any, are auto-detected as following\n        # the FITS unsigned int convention.\n\n        # Added original_was_unsigned with the intent of facilitating the\n        # special case of do_not_scale_image_data=True and uint=True\n        # eventually.\n        # FIXME: unused, maybe it should be useful?\n        # if self._dtype_for_bitpix() is not None:\n        #     original_was_unsigned = self._dtype_for_bitpix().kind == 'u'\n        # else:\n        #     original_was_unsigned = False\n\n        if (self._do_not_scale_image_data or\n                (self._orig_bzero == 0 and self._orig_bscale == 1)):\n            return\n\n        if dtype is None:\n            dtype = self._dtype_for_bitpix()\n\n        if (dtype is not None and dtype.kind == 'u' and\n                (self._scale_back or self._scale_back is None)):\n            # Data is pseudo-unsigned integers, and the scale_back option\n            # was not explicitly set to False, so preserve all the scale\n            # factors\n            return\n\n        for keyword in ['BSCALE', 'BZERO']:\n            try:\n                del self._header[keyword]\n                # Since _update_header_scale_info can, currently, be called\n                # *after* _prewriteto(), replace these with blank cards so\n                # the header size doesn't change\n                self._header.append()\n            except KeyError:\n                pass\n\n        if dtype is None:\n            dtype = self._dtype_for_bitpix()\n        if dtype is not None:\n            self._header['BITPIX'] = DTYPE2BITPIX[dtype.name]\n\n        self._bzero = 0\n        self._bscale = 1\n        self._bitpix = self._header['BITPIX']\n        self._blank = self._header.pop('BLANK', None)\n\n    def scale(self, type=None, option='old', bscale=None, bzero=None):\n        \"\"\"\n        Scale image data by using ``BSCALE``/``BZERO``.\n\n        Call to this method will scale `data` and update the keywords of\n        ``BSCALE`` and ``BZERO`` in the HDU's header.  This method should only\n        be used right before writing to the output file, as the data will be\n        scaled and is therefore not very usable after the call.\n\n        Parameters\n        ----------\n        type : str, optional\n            destination data type, use a string representing a numpy\n            dtype name, (e.g. ``'uint8'``, ``'int16'``, ``'float32'``\n            etc.).  If is `None`, use the current data type.\n\n        option : str, optional\n            How to scale the data: ``\"old\"`` uses the original ``BSCALE`` and\n            ``BZERO`` values from when the data was read/created (defaulting to\n            1 and 0 if they don't exist). For integer data only, ``\"minmax\"``\n            uses the minimum and maximum of the data to scale. User-specified\n            ``bscale``/``bzero`` values always take precedence.\n\n        bscale, bzero : int, optional\n            User-specified ``BSCALE`` and ``BZERO`` values\n        \"\"\"\n\n        # Disable blank support for now\n        self._scale_internal(type=type, option=option, bscale=bscale,\n                             bzero=bzero, blank=None)\n\n    def _scale_internal(self, type=None, option='old', bscale=None, bzero=None,\n                        blank=0):\n        \"\"\"\n        This is an internal implementation of the `scale` method, which\n        also supports handling BLANK properly.\n\n        TODO: This is only needed for fixing #3865 without introducing any\n        public API changes.  We should support BLANK better when rescaling\n        data, and when that is added the need for this internal interface\n        should go away.\n\n        Note: the default of ``blank=0`` merely reflects the current behavior,\n        and is not necessarily a deliberate choice (better would be to disallow\n        conversion of floats to ints without specifying a BLANK if there are\n        NaN/inf values).\n        \"\"\"\n\n        if self.data is None:\n            return\n\n        # Determine the destination (numpy) data type\n        if type is None:\n            type = BITPIX2DTYPE[self._bitpix]\n        _type = getattr(np, type)\n\n        # Determine how to scale the data\n        # bscale and bzero takes priority\n        if bscale is not None and bzero is not None:\n            _scale = bscale\n            _zero = bzero\n        elif bscale is not None:\n            _scale = bscale\n            _zero = 0\n        elif bzero is not None:\n            _scale = 1\n            _zero = bzero\n        elif (option == 'old' and self._orig_bscale is not None and\n                self._orig_bzero is not None):\n            _scale = self._orig_bscale\n            _zero = self._orig_bzero\n        elif option == 'minmax' and not issubclass(_type, np.floating):\n            if _is_dask_array(self.data):\n                min = self.data.min().compute()\n                max = self.data.max().compute()\n            else:\n                min = np.minimum.reduce(self.data.flat)\n                max = np.maximum.reduce(self.data.flat)\n\n            if _type == np.uint8:  # uint8 case\n                _zero = min\n                _scale = (max - min) / (2.0 ** 8 - 1)\n            else:\n                _zero = (max + min) / 2.0\n\n                # throw away -2^N\n                nbytes = 8 * _type().itemsize\n                _scale = (max - min) / (2.0 ** nbytes - 2)\n        else:\n            _scale = 1\n            _zero = 0\n\n        # Do the scaling\n        if _zero != 0:\n            if _is_dask_array(self.data):\n                self.data = self.data - _zero\n            else:\n                # 0.9.6.3 to avoid out of range error for BZERO = +32768\n                # We have to explicitly cast _zero to prevent numpy from raising an\n                # error when doing self.data -= zero, and we do this instead of\n                # self.data = self.data - zero to avoid doubling memory usage.\n                np.add(self.data, -_zero, out=self.data, casting='unsafe')\n            self._header['BZERO'] = _zero\n        else:\n            try:\n                del self._header['BZERO']\n            except KeyError:\n                pass\n\n        if _scale and _scale != 1:\n            self.data = self.data / _scale\n            self._header['BSCALE'] = _scale\n        else:\n            try:\n                del self._header['BSCALE']\n            except KeyError:\n                pass\n\n        # Set blanks\n        if blank is not None and issubclass(_type, np.integer):\n            # TODO: Perhaps check that the requested BLANK value fits in the\n            # integer type being scaled to?\n            self.data[np.isnan(self.data)] = blank\n            self._header['BLANK'] = blank\n\n        if self.data.dtype.type != _type:\n            self.data = np.array(np.around(self.data), dtype=_type)\n\n        # Update the BITPIX Card to match the data\n        self._bitpix = DTYPE2BITPIX[self.data.dtype.name]\n        self._bzero = self._header.get('BZERO', 0)\n        self._bscale = self._header.get('BSCALE', 1)\n        self._blank = blank\n        self._header['BITPIX'] = self._bitpix\n\n        # Since the image has been manually scaled, the current\n        # bitpix/bzero/bscale now serve as the 'original' scaling of the image,\n        # as though the original image has been completely replaced\n        self._orig_bitpix = self._bitpix\n        self._orig_bzero = self._bzero\n        self._orig_bscale = self._bscale\n        self._orig_blank = self._blank\n\n    def _verify(self, option='warn'):\n        # update_header can fix some things that would otherwise cause\n        # verification to fail, so do that now...\n        self.update_header()\n        self._verify_blank()\n\n        return super()._verify(option)\n\n    def _verify_blank(self):\n        # Probably not the best place for this (it should probably happen\n        # in _verify as well) but I want to be able to raise this warning\n        # both when the HDU is created and when written\n        if self._blank is None:\n            return\n\n        messages = []\n        # TODO: Once the FITSSchema framewhere is merged these warnings\n        # should be handled by the schema\n        if not _is_int(self._blank):\n            messages.append(\n                \"Invalid value for 'BLANK' keyword in header: {!r} \"\n                \"The 'BLANK' keyword must be an integer.  It will be \"\n                \"ignored in the meantime.\".format(self._blank))\n            self._blank = None\n        if not self._bitpix > 0:\n            messages.append(\n                \"Invalid 'BLANK' keyword in header.  The 'BLANK' keyword \"\n                \"is only applicable to integer data, and will be ignored \"\n                \"in this HDU.\")\n            self._blank = None\n\n        for msg in messages:\n            warnings.warn(msg, VerifyWarning)\n\n    def _prewriteto(self, checksum=False, inplace=False):\n        if self._scale_back:\n            self._scale_internal(BITPIX2DTYPE[self._orig_bitpix],\n                                 blank=self._orig_blank)\n\n        self.update_header()\n        if not inplace and self._data_needs_rescale:\n            # Go ahead and load the scaled image data and update the header\n            # with the correct post-rescaling headers\n            _ = self.data\n\n        return super()._prewriteto(checksum, inplace)\n\n    def _writedata_internal(self, fileobj):\n        size = 0\n\n        if self.data is None:\n            return size\n        elif _is_dask_array(self.data):\n            return self._writeinternal_dask(fileobj)\n        else:\n            # Based on the system type, determine the byteorders that\n            # would need to be swapped to get to big-endian output\n            if sys.byteorder == 'little':\n                swap_types = ('<', '=')\n            else:\n                swap_types = ('<',)\n            # deal with unsigned integer 16, 32 and 64 data\n            if _is_pseudo_integer(self.data.dtype):\n                # Convert the unsigned array to signed\n                output = np.array(\n                    self.data - _pseudo_zero(self.data.dtype),\n                    dtype=f'>i{self.data.dtype.itemsize}')\n                should_swap = False\n            else:\n                output = self.data\n                byteorder = output.dtype.str[0]\n                should_swap = (byteorder in swap_types)\n\n            if should_swap:\n                if output.flags.writeable:\n                    output.byteswap(True)\n                    try:\n                        fileobj.writearray(output)\n                    finally:\n                        output.byteswap(True)\n                else:\n                    # For read-only arrays, there is no way around making\n                    # a byteswapped copy of the data.\n                    fileobj.writearray(output.byteswap(False))\n            else:\n                fileobj.writearray(output)\n\n            size += output.size * output.itemsize\n\n            return size\n\n    def _writeinternal_dask(self, fileobj):\n\n        if sys.byteorder == 'little':\n            swap_types = ('<', '=')\n        else:\n            swap_types = ('<',)\n        # deal with unsigned integer 16, 32 and 64 data\n        if _is_pseudo_integer(self.data.dtype):\n            raise NotImplementedError(\"This dtype isn't currently supported with dask.\")\n        else:\n            output = self.data\n            byteorder = output.dtype.str[0]\n            should_swap = (byteorder in swap_types)\n\n        if should_swap:\n            from dask.utils import M\n            # NOTE: the inplace flag to byteswap needs to be False otherwise the array is\n            # byteswapped in place every time it is computed and this affects\n            # the input dask array.\n            output = output.map_blocks(M.byteswap, False).map_blocks(M.newbyteorder, \"S\")\n\n        initial_position = fileobj.tell()\n        n_bytes = output.nbytes\n\n        # Extend the file n_bytes into the future\n        fileobj.seek(initial_position + n_bytes - 1)\n        fileobj.write(b'\\0')\n        fileobj.flush()\n\n        if fileobj.fileobj_mode not in ('rb+', 'wb+', 'ab+'):\n            # Use another file handle if the current one is not in\n            # read/write mode\n            fp = open(fileobj.name, mode='rb+')\n            should_close = True\n        else:\n            fp = fileobj._file\n            should_close = False\n\n        try:\n            outmmap = mmap.mmap(fp.fileno(),\n                                length=initial_position + n_bytes,\n                                access=mmap.ACCESS_WRITE)\n\n            outarr = np.ndarray(shape=output.shape,\n                                dtype=output.dtype,\n                                offset=initial_position,\n                                buffer=outmmap)\n\n            output.store(outarr, lock=True, compute=True)\n        finally:\n            if should_close:\n                fp.close()\n            outmmap.close()\n\n        # On Windows closing the memmap causes the file pointer to return to 0, so\n        # we need to go back to the end of the data (since padding may be written\n        # after)\n        fileobj.seek(initial_position + n_bytes)\n\n        return n_bytes\n\n    def _dtype_for_bitpix(self):\n        \"\"\"\n        Determine the dtype that the data should be converted to depending on\n        the BITPIX value in the header, and possibly on the BSCALE value as\n        well.  Returns None if there should not be any change.\n        \"\"\"\n\n        bitpix = self._orig_bitpix\n        # Handle possible conversion to uints if enabled\n        if self._uint and self._orig_bscale == 1:\n            if bitpix == 8 and self._orig_bzero == -128:\n                return np.dtype('int8')\n\n            for bits, dtype in ((16, np.dtype('uint16')),\n                                (32, np.dtype('uint32')),\n                                (64, np.dtype('uint64'))):\n                if bitpix == bits and self._orig_bzero == 1 << (bits - 1):\n                    return dtype\n\n        if bitpix > 16:  # scale integers to Float64\n            return np.dtype('float64')\n        elif bitpix > 0:  # scale integers to Float32\n            return np.dtype('float32')\n\n    def _convert_pseudo_integer(self, data):\n        \"\"\"\n        Handle \"pseudo-unsigned\" integers, if the user requested it.  Returns\n        the converted data array if so; otherwise returns None.\n\n        In this case case, we don't need to handle BLANK to convert it to NAN,\n        since we can't do NaNs with integers, anyway, i.e. the user is\n        responsible for managing blanks.\n        \"\"\"\n\n        dtype = self._dtype_for_bitpix()\n        # bool(dtype) is always False--have to explicitly compare to None; this\n        # caused a fair amount of hair loss\n        if dtype is not None and dtype.kind == 'u':\n            # Convert the input raw data into an unsigned integer array and\n            # then scale the data adjusting for the value of BZERO.  Note that\n            # we subtract the value of BZERO instead of adding because of the\n            # way numpy converts the raw signed array into an unsigned array.\n            bits = dtype.itemsize * 8\n            data = np.array(data, dtype=dtype)\n            data -= np.uint64(1 << (bits - 1))\n\n            return data\n\n    def _get_scaled_image_data(self, offset, shape):\n        \"\"\"\n        Internal function for reading image data from a file and apply scale\n        factors to it.  Normally this is used for the entire image, but it\n        supports alternate offset/shape for Section support.\n        \"\"\"\n\n        code = BITPIX2DTYPE[self._orig_bitpix]\n\n        raw_data = self._get_raw_data(shape, code, offset)\n        raw_data.dtype = raw_data.dtype.newbyteorder('>')\n\n        if self._do_not_scale_image_data or (\n                self._orig_bzero == 0 and self._orig_bscale == 1 and\n                self._blank is None):\n            # No further conversion of the data is necessary\n            return raw_data\n\n        try:\n            if self._file.strict_memmap:\n                raise ValueError(\"Cannot load a memory-mapped image: \"\n                                 \"BZERO/BSCALE/BLANK header keywords present. \"\n                                 \"Set memmap=False.\")\n        except AttributeError:  # strict_memmap not set\n            pass\n\n        data = None\n        if not (self._orig_bzero == 0 and self._orig_bscale == 1):\n            data = self._convert_pseudo_integer(raw_data)\n\n        if data is None:\n            # In these cases, we end up with floating-point arrays and have to\n            # apply bscale and bzero. We may have to handle BLANK and convert\n            # to NaN in the resulting floating-point arrays.\n            # The BLANK keyword should only be applied for integer data (this\n            # is checked in __init__ but it can't hurt to double check here)\n            blanks = None\n\n            if self._blank is not None and self._bitpix > 0:\n                blanks = raw_data.flat == self._blank\n                # The size of blanks in bytes is the number of elements in\n                # raw_data.flat.  However, if we use np.where instead we will\n                # only use 8 bytes for each index where the condition is true.\n                # So if the number of blank items is fewer than\n                # len(raw_data.flat) / 8, using np.where will use less memory\n                if blanks.sum() < len(blanks) / 8:\n                    blanks = np.where(blanks)\n\n            new_dtype = self._dtype_for_bitpix()\n            if new_dtype is not None:\n                data = np.array(raw_data, dtype=new_dtype)\n            else:  # floating point cases\n                if self._file is not None and self._file.memmap:\n                    data = raw_data.copy()\n                elif not raw_data.flags.writeable:\n                    # create a writeable copy if needed\n                    data = raw_data.copy()\n                # if not memmap, use the space already in memory\n                else:\n                    data = raw_data\n\n            del raw_data\n\n            if self._orig_bscale != 1:\n                np.multiply(data, self._orig_bscale, data)\n            if self._orig_bzero != 0:\n                data += self._orig_bzero\n\n            if self._blank:\n                data.flat[blanks] = np.nan\n\n        return data\n\n    def _summary(self):\n        \"\"\"\n        Summarize the HDU: name, dimensions, and formats.\n        \"\"\"\n\n        class_name = self.__class__.__name__\n\n        # if data is touched, use data info.\n        if self._data_loaded:\n            if self.data is None:\n                format = ''\n            else:\n                format = self.data.dtype.name\n                format = format[format.rfind('.')+1:]\n        else:\n            if self.shape and all(self.shape):\n                # Only show the format if all the dimensions are non-zero\n                # if data is not touched yet, use header info.\n                format = BITPIX2DTYPE[self._bitpix]\n            else:\n                format = ''\n\n            if (format and not self._do_not_scale_image_data and\n                    (self._orig_bscale != 1 or self._orig_bzero != 0)):\n                new_dtype = self._dtype_for_bitpix()\n                if new_dtype is not None:\n                    format += f' (rescales to {new_dtype.name})'\n\n        # Display shape in FITS-order\n        shape = tuple(reversed(self.shape))\n\n        return (self.name, self.ver, class_name, len(self._header), shape, format, '')\n\n    def _calculate_datasum(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        \"\"\"\n\n        if self._has_data:\n\n            # We have the data to be used.\n            d = self.data\n\n            # First handle the special case where the data is unsigned integer\n            # 16, 32 or 64\n            if _is_pseudo_integer(self.data.dtype):\n                d = np.array(self.data - _pseudo_zero(self.data.dtype),\n                             dtype=f'i{self.data.dtype.itemsize}')\n\n            # Check the byte order of the data.  If it is little endian we\n            # must swap it before calculating the datasum.\n            if d.dtype.str[0] != '>':\n                if d.flags.writeable:\n                    byteswapped = True\n                    d = d.byteswap(True)\n                    d.dtype = d.dtype.newbyteorder('>')\n                else:\n                    # If the data is not writeable, we just make a byteswapped\n                    # copy and don't bother changing it back after\n                    d = d.byteswap(False)\n                    d.dtype = d.dtype.newbyteorder('>')\n                    byteswapped = False\n            else:\n                byteswapped = False\n\n            cs = self._compute_checksum(d.flatten().view(np.uint8))\n\n            # If the data was byteswapped in this method then return it to\n            # its original little-endian order.\n            if byteswapped and not _is_pseudo_integer(self.data.dtype):\n                d.byteswap(True)\n                d.dtype = d.dtype.newbyteorder('<')\n\n            return cs\n        else:\n            # This is the case where the data has not been read from the file\n            # yet.  We can handle that in a generic manner so we do it in the\n            # base class.  The other possibility is that there is no data at\n            # all.  This can also be handled in a generic manner.\n            return super()._calculate_datasum()"},{"attributeType":"null","col":4,"comment":"null","endLoc":1480,"id":1983,"name":"_MASK","nodeType":"Attribute","startLoc":1480,"text":"_MASK"},{"attributeType":"null","col":4,"comment":"null","endLoc":1485,"id":1984,"name":"_EXCLUDE","nodeType":"Attribute","startLoc":1485,"text":"_EXCLUDE"},{"attributeType":"null","col":8,"comment":"null","endLoc":917,"id":1985,"name":"_checksum","nodeType":"Attribute","startLoc":917,"text":"self._checksum"},{"attributeType":"null","col":8,"comment":"null","endLoc":918,"id":1986,"name":"_checksum_valid","nodeType":"Attribute","startLoc":918,"text":"self._checksum_valid"},{"attributeType":"null","col":12,"comment":"null","endLoc":925,"id":1987,"name":"ver","nodeType":"Attribute","startLoc":925,"text":"self.ver"},{"attributeType":"null","col":8,"comment":"null","endLoc":919,"id":1988,"name":"_datasum","nodeType":"Attribute","startLoc":919,"text":"self._datasum"},{"attributeType":"null","col":8,"comment":"null","endLoc":920,"id":1989,"name":"_datasum_valid","nodeType":"Attribute","startLoc":920,"text":"self._datasum_valid"},{"attributeType":"null","col":12,"comment":"null","endLoc":923,"id":1990,"name":"name","nodeType":"Attribute","startLoc":923,"text":"self.name"},{"col":4,"comment":"null","endLoc":2478,"header":"def compute_follow_sets(self, ntrans, readsets, inclsets)","id":1991,"name":"compute_follow_sets","nodeType":"Function","startLoc":2474,"text":"def compute_follow_sets(self, ntrans, readsets, inclsets):\n        FP = lambda x: readsets[x]\n        R  = lambda x: inclsets.get(x, [])\n        F = digraph(ntrans, R, FP)\n        return F"},{"col":13,"endLoc":2475,"id":1992,"nodeType":"Lambda","startLoc":2475,"text":"lambda x: readsets[x]"},{"col":4,"comment":"\n        The :class:`ColDefs` objects describing the columns in this table.\n        ","endLoc":138,"header":"@lazyproperty\n    def columns(self)","id":1993,"name":"columns","nodeType":"Function","startLoc":130,"text":"@lazyproperty\n    def columns(self):\n        \"\"\"\n        The :class:`ColDefs` objects describing the columns in this table.\n        \"\"\"\n\n        # The base class doesn't make any assumptions about where the column\n        # definitions come from, so just return an empty ColDefs\n        return ColDefs([])"},{"col":13,"endLoc":2476,"id":1994,"nodeType":"Lambda","startLoc":2476,"text":"lambda x: inclsets.get(x, [])"},{"className":"ImageHDU","col":0,"comment":"\n    FITS image extension HDU class.\n    ","endLoc":1195,"id":1995,"nodeType":"Class","startLoc":1114,"text":"class ImageHDU(_ImageBaseHDU, ExtensionHDU):\n    \"\"\"\n    FITS image extension HDU class.\n    \"\"\"\n\n    _extension = 'IMAGE'\n\n    def __init__(self, data=None, header=None, name=None,\n                 do_not_scale_image_data=False, uint=True, scale_back=None,\n                 ver=None):\n        \"\"\"\n        Construct an image HDU.\n\n        Parameters\n        ----------\n        data : array\n            The data in the HDU.\n\n        header : `~astropy.io.fits.Header`\n            The header to be used (as a template).  If ``header`` is\n            `None`, a minimal header will be provided.\n\n        name : str, optional\n            The name of the HDU, will be the value of the keyword\n            ``EXTNAME``.\n\n        do_not_scale_image_data : bool, optional\n            If `True`, image data is not scaled using BSCALE/BZERO values\n            when read. (default: False)\n\n        uint : bool, optional\n            Interpret signed integer data where ``BZERO`` is the\n            central value and ``BSCALE == 1`` as unsigned integer\n            data.  For example, ``int16`` data with ``BZERO = 32768``\n            and ``BSCALE = 1`` would be treated as ``uint16`` data.\n            (default: True)\n\n        scale_back : bool, optional\n            If `True`, when saving changes to a file that contained scaled\n            image data, restore the data to the original type and reapply the\n            original BSCALE/BZERO values.  This could lead to loss of accuracy\n            if scaling back to integer values after performing floating point\n            operations on the data.  Pseudo-unsigned integers are automatically\n            rescaled unless scale_back is explicitly set to `False`.\n            (default: None)\n\n        ver : int > 0 or None, optional\n            The ver of the HDU, will be the value of the keyword ``EXTVER``.\n            If not given or None, it defaults to the value of the ``EXTVER``\n            card of the ``header`` or 1.\n            (default: None)\n        \"\"\"\n\n        # This __init__ currently does nothing differently from the base class,\n        # and is only explicitly defined for the docstring.\n\n        super().__init__(\n            data=data, header=header, name=name,\n            do_not_scale_image_data=do_not_scale_image_data, uint=uint,\n            scale_back=scale_back, ver=ver)\n\n    @classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n        return card.keyword == 'XTENSION' and xtension == cls._extension\n\n    def _verify(self, option='warn'):\n        \"\"\"\n        ImageHDU verify method.\n        \"\"\"\n\n        errs = super()._verify(option=option)\n        naxis = self._header.get('NAXIS', 0)\n        # PCOUNT must == 0, GCOUNT must == 1; the former is verified in\n        # ExtensionHDU._verify, however ExtensionHDU._verify allows PCOUNT\n        # to be >= 0, so we need to check it here\n        self.req_cards('PCOUNT', naxis + 3, lambda v: (_is_int(v) and v == 0),\n                       0, option, errs)\n        return errs"},{"col":4,"comment":"null","endLoc":2501,"header":"def add_lookaheads(self, lookbacks, followset)","id":1996,"name":"add_lookaheads","nodeType":"Function","startLoc":2492,"text":"def add_lookaheads(self, lookbacks, followset):\n        for trans, lb in lookbacks.items():\n            # Loop over productions in lookback\n            for state, p in lb:\n                if state not in p.lookaheads:\n                    p.lookaheads[state] = []\n                f = followset.get(trans, [])\n                for a in f:\n                    if a not in p.lookaheads[state]:\n                        p.lookaheads[state].append(a)"},{"col":4,"comment":"null","endLoc":37,"header":"def __init__(self)","id":1998,"name":"__init__","nodeType":"Function","startLoc":33,"text":"def __init__(self):\n        # the keys to this are always lower-case\n        self._lowercase_names_to_locations = {}\n        # these can be whatever case is appropriate\n        self._names = []"},{"col":4,"comment":"\n        _ImageBaseHDU is sort of an abstract class for HDUs containing image\n        data (as opposed to table data) and should never be used directly.\n        ","endLoc":175,"header":"@classmethod\n    def match_header(cls, header)","id":1999,"name":"match_header","nodeType":"Function","startLoc":168,"text":"@classmethod\n    def match_header(cls, header):\n        \"\"\"\n        _ImageBaseHDU is sort of an abstract class for HDUs containing image\n        data (as opposed to table data) and should never be used directly.\n        \"\"\"\n\n        raise NotImplementedError"},{"col":4,"comment":"null","endLoc":179,"header":"@property\n    def is_image(self)","id":2000,"name":"is_image","nodeType":"Function","startLoc":177,"text":"@property\n    def is_image(self):\n        return True"},{"col":4,"comment":"\n        Access a section of the image array without loading the entire array\n        into memory.  The :class:`Section` object returned by this attribute is\n        not meant to be used directly by itself.  Rather, slices of the section\n        return the appropriate slice of the data, and loads *only* that section\n        into memory.\n\n        Sections are mostly obsoleted by memmap support, but should still be\n        used to deal with very large scaled images.  See the\n        :ref:`astropy:data-sections` section of the Astropy documentation for\n        more details.\n        ","endLoc":196,"header":"@property\n    def section(self)","id":2001,"name":"section","nodeType":"Function","startLoc":181,"text":"@property\n    def section(self):\n        \"\"\"\n        Access a section of the image array without loading the entire array\n        into memory.  The :class:`Section` object returned by this attribute is\n        not meant to be used directly by itself.  Rather, slices of the section\n        return the appropriate slice of the data, and loads *only* that section\n        into memory.\n\n        Sections are mostly obsoleted by memmap support, but should still be\n        used to deal with very large scaled images.  See the\n        :ref:`astropy:data-sections` section of the Astropy documentation for\n        more details.\n        \"\"\"\n\n        return Section(self)"},{"col":4,"comment":"\n        table-like HDUs must provide an attribute that specifies the number of\n        rows in the HDU's table.\n\n        For now this is an internal-only attribute.\n        ","endLoc":149,"header":"@property\n    def _nrows(self)","id":2002,"name":"_nrows","nodeType":"Function","startLoc":140,"text":"@property\n    def _nrows(self):\n        \"\"\"\n        table-like HDUs must provide an attribute that specifies the number of\n        rows in the HDU's table.\n\n        For now this is an internal-only attribute.\n        \"\"\"\n\n        raise NotImplementedError"},{"col":4,"comment":"Get the table data from an input HDU object.","endLoc":183,"header":"def _get_tbdata(self)","id":2003,"name":"_get_tbdata","nodeType":"Function","startLoc":151,"text":"def _get_tbdata(self):\n        \"\"\"Get the table data from an input HDU object.\"\"\"\n\n        columns = self.columns\n\n        # TODO: Details related to variable length arrays need to be dealt with\n        # specifically in the BinTableHDU class, since they're a detail\n        # specific to FITS binary tables\n        if (any(type(r) in (_FormatP, _FormatQ)\n                for r in columns._recformats) and\n                self._data_size is not None and\n                self._data_size > self._theap):\n            # We have a heap; include it in the raw_data\n            raw_data = self._get_raw_data(self._data_size, np.uint8,\n                                          self._data_offset)\n            tbsize = self._header['NAXIS1'] * self._header['NAXIS2']\n            data = raw_data[:tbsize].view(dtype=columns.dtype,\n                                          type=np.rec.recarray)\n        else:\n            raw_data = self._get_raw_data(self._nrows, columns.dtype,\n                                          self._data_offset)\n            if raw_data is None:\n                # This can happen when a brand new table HDU is being created\n                # and no data has been assigned to the columns, which case just\n                # return an empty array\n                raw_data = np.array([], dtype=columns.dtype)\n\n            data = raw_data.view(np.rec.recarray)\n\n        self._init_tbdata(data)\n        data = data.view(self._data_type)\n        columns._add_listener(data)\n        return data"},{"col":4,"comment":"\n        Shape of the image array--should be equivalent to ``self.data.shape``.\n        ","endLoc":205,"header":"@property\n    def shape(self)","id":2004,"name":"shape","nodeType":"Function","startLoc":198,"text":"@property\n    def shape(self):\n        \"\"\"\n        Shape of the image array--should be equivalent to ``self.data.shape``.\n        \"\"\"\n\n        # Determine from the values read from the header\n        return tuple(reversed(self._axes))"},{"col":4,"comment":"null","endLoc":209,"header":"@property\n    def header(self)","id":2005,"name":"header","nodeType":"Function","startLoc":207,"text":"@property\n    def header(self):\n        return self._header"},{"col":4,"comment":"null","endLoc":215,"header":"@header.setter\n    def header(self, header)","id":2006,"name":"header","nodeType":"Function","startLoc":211,"text":"@header.setter\n    def header(self, header):\n        self._header = header\n        self._modified = True\n        self.update_header()"},{"col":4,"comment":"Set ``attr`` for columns to ``values``, which can be either a dict (keyed by column\n        name) or a dict of name: value pairs.  This is used for handling the ``units`` and\n        ``descriptions`` kwargs to ``__init__``.\n        ","endLoc":883,"header":"def _set_column_attribute(self, attr, values)","id":2007,"name":"_set_column_attribute","nodeType":"Function","startLoc":855,"text":"def _set_column_attribute(self, attr, values):\n        \"\"\"Set ``attr`` for columns to ``values``, which can be either a dict (keyed by column\n        name) or a dict of name: value pairs.  This is used for handling the ``units`` and\n        ``descriptions`` kwargs to ``__init__``.\n        \"\"\"\n        if not values:\n            return\n\n        if isinstance(values, Row):\n            # For a Row object transform to an equivalent dict.\n            values = {name: values[name] for name in values.colnames}\n\n        if not isinstance(values, Mapping):\n            # If not a dict map, assume iterable and map to dict if the right length\n            if len(values) != len(self.columns):\n                raise ValueError(f'sequence of {attr} values must match number of columns')\n            values = dict(zip(self.colnames, values))\n\n        for name, value in values.items():\n            if name not in self.columns:\n                raise ValueError(f'invalid column name {name} for setting {attr} attribute')\n\n            # Special case: ignore unit if it is an empty or blank string\n            if attr == 'unit' and isinstance(value, str):\n                if value.strip() == '':\n                    value = None\n\n            if value not in (np.ma.masked, None):\n                setattr(self[name].info, attr, value)"},{"col":4,"comment":"\n        Image/array data as a `~numpy.ndarray`.\n\n        Please remember that the order of axes on an Numpy array are opposite\n        of the order specified in the FITS file.  For example for a 2D image\n        the \"rows\" or y-axis are the first dimension, and the \"columns\" or\n        x-axis are the second dimension.\n\n        If the data is scaled using the BZERO and BSCALE parameters, this\n        attribute returns the data scaled to its physical values unless the\n        file was opened with ``do_not_scale_image_data=True``.\n        ","endLoc":238,"header":"@lazyproperty\n    def data(self)","id":2008,"name":"data","nodeType":"Function","startLoc":217,"text":"@lazyproperty\n    def data(self):\n        \"\"\"\n        Image/array data as a `~numpy.ndarray`.\n\n        Please remember that the order of axes on an Numpy array are opposite\n        of the order specified in the FITS file.  For example for a 2D image\n        the \"rows\" or y-axis are the first dimension, and the \"columns\" or\n        x-axis are the second dimension.\n\n        If the data is scaled using the BZERO and BSCALE parameters, this\n        attribute returns the data scaled to its physical values unless the\n        file was opened with ``do_not_scale_image_data=True``.\n        \"\"\"\n\n        if len(self._axes) < 1:\n            return\n\n        data = self._get_scaled_image_data(self._data_offset, self.shape)\n        self._update_header_scale_info(data.dtype)\n\n        return data"},{"col":4,"comment":"\n        Update the header keywords to agree with the data.\n        ","endLoc":371,"header":"def update_header(self)","id":2009,"name":"update_header","nodeType":"Function","startLoc":306,"text":"def update_header(self):\n        \"\"\"\n        Update the header keywords to agree with the data.\n        \"\"\"\n\n        if not (self._modified or self._header._modified or\n                (self._has_data and self.shape != self.data.shape)):\n            # Not likely that anything needs updating\n            return\n\n        old_naxis = self._header.get('NAXIS', 0)\n\n        if 'BITPIX' not in self._header:\n            bitpix_comment = self.standard_keyword_comments['BITPIX']\n        else:\n            bitpix_comment = self._header.comments['BITPIX']\n\n        # Update the BITPIX keyword and ensure it's in the correct\n        # location in the header\n        self._header.set('BITPIX', self._bitpix, bitpix_comment, after=0)\n\n        # If the data's shape has changed (this may have happened without our\n        # noticing either via a direct update to the data.shape attribute) we\n        # need to update the internal self._axes\n        if self._has_data and self.shape != self.data.shape:\n            self._axes = list(self.data.shape)\n            self._axes.reverse()\n\n        # Update the NAXIS keyword and ensure it's in the correct location in\n        # the header\n        if 'NAXIS' in self._header:\n            naxis_comment = self._header.comments['NAXIS']\n        else:\n            naxis_comment = self.standard_keyword_comments['NAXIS']\n        self._header.set('NAXIS', len(self._axes), naxis_comment,\n                         after='BITPIX')\n\n        # TODO: This routine is repeated in several different classes--it\n        # should probably be made available as a method on all standard HDU\n        # types\n        # add NAXISi if it does not exist\n        for idx, axis in enumerate(self._axes):\n            naxisn = 'NAXIS' + str(idx + 1)\n            if naxisn in self._header:\n                self._header[naxisn] = axis\n            else:\n                if (idx == 0):\n                    after = 'NAXIS'\n                else:\n                    after = 'NAXIS' + str(idx)\n                self._header.set(naxisn, axis, after=after)\n\n        # delete extra NAXISi's\n        for idx in range(len(self._axes) + 1, old_naxis + 1):\n            try:\n                del self._header['NAXIS' + str(idx)]\n            except KeyError:\n                pass\n\n        if 'BLANK' in self._header:\n            self._blank = self._header['BLANK']\n\n        # Add BSCALE/BZERO to header if data is unsigned int.\n        self._update_pseudo_int_scale_keywords()\n\n        self._modified = False"},{"col":4,"comment":"\n        Internal function for reading image data from a file and apply scale\n        factors to it.  Normally this is used for the entire image, but it\n        supports alternate offset/shape for Section support.\n        ","endLoc":841,"header":"def _get_scaled_image_data(self, offset, shape)","id":2010,"name":"_get_scaled_image_data","nodeType":"Function","startLoc":770,"text":"def _get_scaled_image_data(self, offset, shape):\n        \"\"\"\n        Internal function for reading image data from a file and apply scale\n        factors to it.  Normally this is used for the entire image, but it\n        supports alternate offset/shape for Section support.\n        \"\"\"\n\n        code = BITPIX2DTYPE[self._orig_bitpix]\n\n        raw_data = self._get_raw_data(shape, code, offset)\n        raw_data.dtype = raw_data.dtype.newbyteorder('>')\n\n        if self._do_not_scale_image_data or (\n                self._orig_bzero == 0 and self._orig_bscale == 1 and\n                self._blank is None):\n            # No further conversion of the data is necessary\n            return raw_data\n\n        try:\n            if self._file.strict_memmap:\n                raise ValueError(\"Cannot load a memory-mapped image: \"\n                                 \"BZERO/BSCALE/BLANK header keywords present. \"\n                                 \"Set memmap=False.\")\n        except AttributeError:  # strict_memmap not set\n            pass\n\n        data = None\n        if not (self._orig_bzero == 0 and self._orig_bscale == 1):\n            data = self._convert_pseudo_integer(raw_data)\n\n        if data is None:\n            # In these cases, we end up with floating-point arrays and have to\n            # apply bscale and bzero. We may have to handle BLANK and convert\n            # to NaN in the resulting floating-point arrays.\n            # The BLANK keyword should only be applied for integer data (this\n            # is checked in __init__ but it can't hurt to double check here)\n            blanks = None\n\n            if self._blank is not None and self._bitpix > 0:\n                blanks = raw_data.flat == self._blank\n                # The size of blanks in bytes is the number of elements in\n                # raw_data.flat.  However, if we use np.where instead we will\n                # only use 8 bytes for each index where the condition is true.\n                # So if the number of blank items is fewer than\n                # len(raw_data.flat) / 8, using np.where will use less memory\n                if blanks.sum() < len(blanks) / 8:\n                    blanks = np.where(blanks)\n\n            new_dtype = self._dtype_for_bitpix()\n            if new_dtype is not None:\n                data = np.array(raw_data, dtype=new_dtype)\n            else:  # floating point cases\n                if self._file is not None and self._file.memmap:\n                    data = raw_data.copy()\n                elif not raw_data.flags.writeable:\n                    # create a writeable copy if needed\n                    data = raw_data.copy()\n                # if not memmap, use the space already in memory\n                else:\n                    data = raw_data\n\n            del raw_data\n\n            if self._orig_bscale != 1:\n                np.multiply(data, self._orig_bscale, data)\n            if self._orig_bzero != 0:\n                data += self._orig_bzero\n\n            if self._blank:\n                data.flat[blanks] = np.nan\n\n        return data"},{"col":4,"comment":"null","endLoc":206,"header":"def _init_tbdata(self, data)","id":2011,"name":"_init_tbdata","nodeType":"Function","startLoc":185,"text":"def _init_tbdata(self, data):\n        columns = self.columns\n\n        data.dtype = data.dtype.newbyteorder('>')\n\n        # hack to enable pseudo-uint support\n        data._uint = self._uint\n\n        # pass datLoc, for P format\n        data._heapoffset = self._theap\n        data._heapsize = self._header['PCOUNT']\n        tbsize = self._header['NAXIS1'] * self._header['NAXIS2']\n        data._gap = self._theap - tbsize\n\n        # pass the attributes\n        for idx, col in enumerate(columns):\n            # get the data for each column object from the rec.recarray\n            col.array = data.field(idx)\n\n        # delete the _arrays attribute so that it is recreated to point to the\n        # new data placed in the column object above\n        del columns._arrays"},{"col":4,"comment":"Load the data if asked to.","endLoc":211,"header":"def _update_load_data(self)","id":2012,"name":"_update_load_data","nodeType":"Function","startLoc":208,"text":"def _update_load_data(self):\n        \"\"\"Load the data if asked to.\"\"\"\n        if not self._data_loaded:\n            self.data"},{"col":4,"comment":"\n        Update the data upon addition of a new column through the `ColDefs`\n        interface.\n        ","endLoc":222,"header":"def _update_column_added(self, columns, column)","id":2013,"name":"_update_column_added","nodeType":"Function","startLoc":213,"text":"def _update_column_added(self, columns, column):\n        \"\"\"\n        Update the data upon addition of a new column through the `ColDefs`\n        interface.\n        \"\"\"\n        # recreate data from the columns\n        self.data = FITS_rec.from_columns(\n            self.columns, nrows=self._nrows, fill=False,\n            character_as_bytes=self._character_as_bytes\n        )"},{"col":4,"comment":"\n        Update the data upon removal of a column through the `ColDefs`\n        interface.\n        ","endLoc":233,"header":"def _update_column_removed(self, columns, col_idx)","id":2014,"name":"_update_column_removed","nodeType":"Function","startLoc":224,"text":"def _update_column_removed(self, columns, col_idx):\n        \"\"\"\n        Update the data upon removal of a column through the `ColDefs`\n        interface.\n        \"\"\"\n        # recreate data from the columns\n        self.data = FITS_rec.from_columns(\n            self.columns, nrows=self._nrows, fill=False,\n            character_as_bytes=self._character_as_bytes\n        )"},{"attributeType":"null","col":4,"comment":"null","endLoc":53,"id":2015,"name":"_data_type","nodeType":"Attribute","startLoc":53,"text":"_data_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":54,"id":2016,"name":"_columns_type","nodeType":"Attribute","startLoc":54,"text":"_columns_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":58,"id":2017,"name":"_uint","nodeType":"Attribute","startLoc":58,"text":"_uint"},{"attributeType":"null","col":8,"comment":"null","endLoc":219,"id":2018,"name":"data","nodeType":"Attribute","startLoc":219,"text":"self.data"},{"col":4,"comment":"null","endLoc":304,"header":"@data.setter\n    def data(self, data)","id":2019,"name":"data","nodeType":"Function","startLoc":240,"text":"@data.setter\n    def data(self, data):\n        if 'data' in self.__dict__ and self.__dict__['data'] is not None:\n            if self.__dict__['data'] is data:\n                return\n            else:\n                self._data_replaced = True\n            was_unsigned = _is_pseudo_integer(self.__dict__['data'].dtype)\n        else:\n            self._data_replaced = True\n            was_unsigned = False\n\n        if (data is not None\n                and not isinstance(data, np.ndarray)\n                and not _is_dask_array(data)):\n            # Try to coerce the data into a numpy array--this will work, on\n            # some level, for most objects\n            try:\n                data = np.array(data)\n            except Exception:\n                raise TypeError('data object {!r} could not be coerced into an '\n                                'ndarray'.format(data))\n\n            if data.shape == ():\n                raise TypeError('data object {!r} should have at least one '\n                                'dimension'.format(data))\n\n        self.__dict__['data'] = data\n        self._modified = True\n\n        if self.data is None:\n            self._axes = []\n        else:\n            # Set new values of bitpix, bzero, and bscale now, but wait to\n            # revise original values until header is updated.\n            self._bitpix = DTYPE2BITPIX[data.dtype.name]\n            self._bscale = 1\n            self._bzero = 0\n            self._blank = None\n            self._axes = list(data.shape)\n            self._axes.reverse()\n\n        # Update the header, including adding BZERO/BSCALE if new data is\n        # unsigned. Does not change the values of self._bitpix,\n        # self._orig_bitpix, etc.\n        self.update_header()\n        if (data is not None and was_unsigned):\n            self._update_header_scale_info(data.dtype)\n\n        # Keep _orig_bitpix as it was until header update is done, then\n        # set it, to allow easier handling of the case of unsigned\n        # integer data being converted to something else. Setting these here\n        # is needed only for the case do_not_scale_image_data=True when\n        # setting the data to unsigned int.\n\n        # If necessary during initialization, i.e. if BSCALE and BZERO were\n        # not in the header but the data was unsigned, the attributes below\n        # will be update in __init__.\n        self._orig_bitpix = self._bitpix\n        self._orig_bscale = self._bscale\n        self._orig_bzero = self._bzero\n\n        # returning the data signals to lazyproperty that we've already handled\n        # setting self.__dict__['data']\n        return data"},{"col":0,"comment":"\n    Write a diff report between two values to the specified file-like object.\n\n    Parameters\n    ----------\n    a, b\n        Values to compare. Anything that can be turned into strings\n        and compared using :py:mod:`difflib` should work.\n\n    fileobj : object\n        File-like object to write to.\n        The default is ``sys.stdout``, which writes to terminal.\n\n    indent_width : int\n        Character column(s) to indent.\n\n    Returns\n    -------\n    identical : bool\n        `True` if no diff, else `False`.\n\n    ","endLoc":138,"header":"def report_diff_values(a, b, fileobj=sys.stdout, indent_width=0)","id":2020,"name":"report_diff_values","nodeType":"Function","startLoc":46,"text":"def report_diff_values(a, b, fileobj=sys.stdout, indent_width=0):\n    \"\"\"\n    Write a diff report between two values to the specified file-like object.\n\n    Parameters\n    ----------\n    a, b\n        Values to compare. Anything that can be turned into strings\n        and compared using :py:mod:`difflib` should work.\n\n    fileobj : object\n        File-like object to write to.\n        The default is ``sys.stdout``, which writes to terminal.\n\n    indent_width : int\n        Character column(s) to indent.\n\n    Returns\n    -------\n    identical : bool\n        `True` if no diff, else `False`.\n\n    \"\"\"\n    if isinstance(a, np.ndarray) and isinstance(b, np.ndarray):\n        if a.shape != b.shape:\n            fileobj.write(\n                fixed_width_indent('  Different array shapes:\\n',\n                                   indent_width))\n            report_diff_values(str(a.shape), str(b.shape), fileobj=fileobj,\n                               indent_width=indent_width + 1)\n            return False\n\n        diff_indices = np.transpose(np.where(a != b))\n        num_diffs = diff_indices.shape[0]\n\n        for idx in diff_indices[:3]:\n            lidx = idx.tolist()\n            fileobj.write(\n                fixed_width_indent(f'  at {lidx!r}:\\n', indent_width))\n            report_diff_values(a[tuple(idx)], b[tuple(idx)], fileobj=fileobj,\n                               indent_width=indent_width + 1)\n\n        if num_diffs > 3:\n            fileobj.write(fixed_width_indent(\n                f'  ...and at {num_diffs - 3:d} more indices.\\n',\n                indent_width))\n            return False\n\n        return num_diffs == 0\n\n    typea = type(a)\n    typeb = type(b)\n\n    if typea == typeb:\n        lnpad = ' '\n        sign_a = 'a>'\n        sign_b = 'b>'\n        if isinstance(a, numbers.Number):\n            a = repr(a)\n            b = repr(b)\n        else:\n            a = str(a)\n            b = str(b)\n    else:\n        padding = max(len(typea.__name__), len(typeb.__name__)) + 3\n        lnpad = (padding + 1) * ' '\n        sign_a = ('(' + typea.__name__ + ') ').rjust(padding) + 'a>'\n        sign_b = ('(' + typeb.__name__ + ') ').rjust(padding) + 'b>'\n\n        is_a_str = isinstance(a, str)\n        is_b_str = isinstance(b, str)\n        a = (repr(a) if ((is_a_str and not is_b_str) or\n                         (not is_a_str and isinstance(a, numbers.Number)))\n             else str(a))\n        b = (repr(b) if ((is_b_str and not is_a_str) or\n                         (not is_b_str and isinstance(b, numbers.Number)))\n             else str(b))\n\n    identical = True\n\n    for line in difflib.ndiff(a.splitlines(), b.splitlines()):\n        if line[0] == '-':\n            identical = False\n            line = sign_a + line[1:]\n        elif line[0] == '+':\n            identical = False\n            line = sign_b + line[1:]\n        else:\n            line = lnpad + line\n        fileobj.write(fixed_width_indent(\n            '  {}\\n'.format(line.rstrip('\\n')), indent_width))\n\n    return identical"},{"col":4,"comment":"\n        Handle \"pseudo-unsigned\" integers, if the user requested it.  Returns\n        the converted data array if so; otherwise returns None.\n\n        In this case case, we don't need to handle BLANK to convert it to NAN,\n        since we can't do NaNs with integers, anyway, i.e. the user is\n        responsible for managing blanks.\n        ","endLoc":768,"header":"def _convert_pseudo_integer(self, data)","id":2021,"name":"_convert_pseudo_integer","nodeType":"Function","startLoc":746,"text":"def _convert_pseudo_integer(self, data):\n        \"\"\"\n        Handle \"pseudo-unsigned\" integers, if the user requested it.  Returns\n        the converted data array if so; otherwise returns None.\n\n        In this case case, we don't need to handle BLANK to convert it to NAN,\n        since we can't do NaNs with integers, anyway, i.e. the user is\n        responsible for managing blanks.\n        \"\"\"\n\n        dtype = self._dtype_for_bitpix()\n        # bool(dtype) is always False--have to explicitly compare to None; this\n        # caused a fair amount of hair loss\n        if dtype is not None and dtype.kind == 'u':\n            # Convert the input raw data into an unsigned integer array and\n            # then scale the data adjusting for the value of BZERO.  Note that\n            # we subtract the value of BZERO instead of adding because of the\n            # way numpy converts the raw signed array into an unsigned array.\n            bits = dtype.itemsize * 8\n            data = np.array(data, dtype=dtype)\n            data -= np.uint64(1 << (bits - 1))\n\n            return data"},{"col":4,"comment":"\n        Determine the dtype that the data should be converted to depending on\n        the BITPIX value in the header, and possibly on the BSCALE value as\n        well.  Returns None if there should not be any change.\n        ","endLoc":744,"header":"def _dtype_for_bitpix(self)","id":2022,"name":"_dtype_for_bitpix","nodeType":"Function","startLoc":722,"text":"def _dtype_for_bitpix(self):\n        \"\"\"\n        Determine the dtype that the data should be converted to depending on\n        the BITPIX value in the header, and possibly on the BSCALE value as\n        well.  Returns None if there should not be any change.\n        \"\"\"\n\n        bitpix = self._orig_bitpix\n        # Handle possible conversion to uints if enabled\n        if self._uint and self._orig_bscale == 1:\n            if bitpix == 8 and self._orig_bzero == -128:\n                return np.dtype('int8')\n\n            for bits, dtype in ((16, np.dtype('uint16')),\n                                (32, np.dtype('uint32')),\n                                (64, np.dtype('uint64'))):\n                if bitpix == bits and self._orig_bzero == 1 << (bits - 1):\n                    return dtype\n\n        if bitpix > 16:  # scale integers to Float64\n            return np.dtype('float64')\n        elif bitpix > 0:  # scale integers to Float32\n            return np.dtype('float32')"},{"col":0,"comment":"\n    Load observatory database from data.astropy.org and parse into a SiteRegistry\n    ","endLoc":140,"header":"def get_downloaded_sites(jsonurl=None)","id":2023,"name":"get_downloaded_sites","nodeType":"Function","startLoc":127,"text":"def get_downloaded_sites(jsonurl=None):\n    \"\"\"\n    Load observatory database from data.astropy.org and parse into a SiteRegistry\n    \"\"\"\n\n    # we explicitly set the encoding because the default is to leave it set by\n    # the users' locale, which may fail if it's not matched to the sites.json\n    if jsonurl is None:\n        content = get_pkg_data_contents('coordinates/sites.json', encoding='UTF-8')\n    else:\n        content = get_file_contents(jsonurl, encoding='UTF-8')\n\n    jsondb = json.loads(content)\n    return SiteRegistry.from_json(jsondb)"},{"col":4,"comment":"\n        Delete BSCALE/BZERO from header if necessary.\n        ","endLoc":425,"header":"def _update_header_scale_info(self, dtype=None)","id":2024,"name":"_update_header_scale_info","nodeType":"Function","startLoc":373,"text":"def _update_header_scale_info(self, dtype=None):\n        \"\"\"\n        Delete BSCALE/BZERO from header if necessary.\n        \"\"\"\n\n        # Note that _dtype_for_bitpix determines the dtype based on the\n        # \"original\" values of bitpix, bscale, and bzero, stored in\n        # self._orig_bitpix, etc. It contains the logic for determining which\n        # special cases of BZERO/BSCALE, if any, are auto-detected as following\n        # the FITS unsigned int convention.\n\n        # Added original_was_unsigned with the intent of facilitating the\n        # special case of do_not_scale_image_data=True and uint=True\n        # eventually.\n        # FIXME: unused, maybe it should be useful?\n        # if self._dtype_for_bitpix() is not None:\n        #     original_was_unsigned = self._dtype_for_bitpix().kind == 'u'\n        # else:\n        #     original_was_unsigned = False\n\n        if (self._do_not_scale_image_data or\n                (self._orig_bzero == 0 and self._orig_bscale == 1)):\n            return\n\n        if dtype is None:\n            dtype = self._dtype_for_bitpix()\n\n        if (dtype is not None and dtype.kind == 'u' and\n                (self._scale_back or self._scale_back is None)):\n            # Data is pseudo-unsigned integers, and the scale_back option\n            # was not explicitly set to False, so preserve all the scale\n            # factors\n            return\n\n        for keyword in ['BSCALE', 'BZERO']:\n            try:\n                del self._header[keyword]\n                # Since _update_header_scale_info can, currently, be called\n                # *after* _prewriteto(), replace these with blank cards so\n                # the header size doesn't change\n                self._header.append()\n            except KeyError:\n                pass\n\n        if dtype is None:\n            dtype = self._dtype_for_bitpix()\n        if dtype is not None:\n            self._header['BITPIX'] = DTYPE2BITPIX[dtype.name]\n\n        self._bzero = 0\n        self._bscale = 1\n        self._bitpix = self._header['BITPIX']\n        self._blank = self._header.pop('BLANK', None)"},{"col":4,"comment":"\n        Scale image data by using ``BSCALE``/``BZERO``.\n\n        Call to this method will scale `data` and update the keywords of\n        ``BSCALE`` and ``BZERO`` in the HDU's header.  This method should only\n        be used right before writing to the output file, as the data will be\n        scaled and is therefore not very usable after the call.\n\n        Parameters\n        ----------\n        type : str, optional\n            destination data type, use a string representing a numpy\n            dtype name, (e.g. ``'uint8'``, ``'int16'``, ``'float32'``\n            etc.).  If is `None`, use the current data type.\n\n        option : str, optional\n            How to scale the data: ``\"old\"`` uses the original ``BSCALE`` and\n            ``BZERO`` values from when the data was read/created (defaulting to\n            1 and 0 if they don't exist). For integer data only, ``\"minmax\"``\n            uses the minimum and maximum of the data to scale. User-specified\n            ``bscale``/``bzero`` values always take precedence.\n\n        bscale, bzero : int, optional\n            User-specified ``BSCALE`` and ``BZERO`` values\n        ","endLoc":456,"header":"def scale(self, type=None, option='old', bscale=None, bzero=None)","id":2025,"name":"scale","nodeType":"Function","startLoc":427,"text":"def scale(self, type=None, option='old', bscale=None, bzero=None):\n        \"\"\"\n        Scale image data by using ``BSCALE``/``BZERO``.\n\n        Call to this method will scale `data` and update the keywords of\n        ``BSCALE`` and ``BZERO`` in the HDU's header.  This method should only\n        be used right before writing to the output file, as the data will be\n        scaled and is therefore not very usable after the call.\n\n        Parameters\n        ----------\n        type : str, optional\n            destination data type, use a string representing a numpy\n            dtype name, (e.g. ``'uint8'``, ``'int16'``, ``'float32'``\n            etc.).  If is `None`, use the current data type.\n\n        option : str, optional\n            How to scale the data: ``\"old\"`` uses the original ``BSCALE`` and\n            ``BZERO`` values from when the data was read/created (defaulting to\n            1 and 0 if they don't exist). For integer data only, ``\"minmax\"``\n            uses the minimum and maximum of the data to scale. User-specified\n            ``bscale``/``bzero`` values always take precedence.\n\n        bscale, bzero : int, optional\n            User-specified ``BSCALE`` and ``BZERO`` values\n        \"\"\"\n\n        # Disable blank support for now\n        self._scale_internal(type=type, option=option, bscale=bscale,\n                             bzero=bzero, blank=None)"},{"col":4,"comment":"\n        This is an internal implementation of the `scale` method, which\n        also supports handling BLANK properly.\n\n        TODO: This is only needed for fixing #3865 without introducing any\n        public API changes.  We should support BLANK better when rescaling\n        data, and when that is added the need for this internal interface\n        should go away.\n\n        Note: the default of ``blank=0`` merely reflects the current behavior,\n        and is not necessarily a deliberate choice (better would be to disallow\n        conversion of floats to ints without specifying a BLANK if there are\n        NaN/inf values).\n        ","endLoc":568,"header":"def _scale_internal(self, type=None, option='old', bscale=None, bzero=None,\n                        blank=0)","id":2026,"name":"_scale_internal","nodeType":"Function","startLoc":458,"text":"def _scale_internal(self, type=None, option='old', bscale=None, bzero=None,\n                        blank=0):\n        \"\"\"\n        This is an internal implementation of the `scale` method, which\n        also supports handling BLANK properly.\n\n        TODO: This is only needed for fixing #3865 without introducing any\n        public API changes.  We should support BLANK better when rescaling\n        data, and when that is added the need for this internal interface\n        should go away.\n\n        Note: the default of ``blank=0`` merely reflects the current behavior,\n        and is not necessarily a deliberate choice (better would be to disallow\n        conversion of floats to ints without specifying a BLANK if there are\n        NaN/inf values).\n        \"\"\"\n\n        if self.data is None:\n            return\n\n        # Determine the destination (numpy) data type\n        if type is None:\n            type = BITPIX2DTYPE[self._bitpix]\n        _type = getattr(np, type)\n\n        # Determine how to scale the data\n        # bscale and bzero takes priority\n        if bscale is not None and bzero is not None:\n            _scale = bscale\n            _zero = bzero\n        elif bscale is not None:\n            _scale = bscale\n            _zero = 0\n        elif bzero is not None:\n            _scale = 1\n            _zero = bzero\n        elif (option == 'old' and self._orig_bscale is not None and\n                self._orig_bzero is not None):\n            _scale = self._orig_bscale\n            _zero = self._orig_bzero\n        elif option == 'minmax' and not issubclass(_type, np.floating):\n            if _is_dask_array(self.data):\n                min = self.data.min().compute()\n                max = self.data.max().compute()\n            else:\n                min = np.minimum.reduce(self.data.flat)\n                max = np.maximum.reduce(self.data.flat)\n\n            if _type == np.uint8:  # uint8 case\n                _zero = min\n                _scale = (max - min) / (2.0 ** 8 - 1)\n            else:\n                _zero = (max + min) / 2.0\n\n                # throw away -2^N\n                nbytes = 8 * _type().itemsize\n                _scale = (max - min) / (2.0 ** nbytes - 2)\n        else:\n            _scale = 1\n            _zero = 0\n\n        # Do the scaling\n        if _zero != 0:\n            if _is_dask_array(self.data):\n                self.data = self.data - _zero\n            else:\n                # 0.9.6.3 to avoid out of range error for BZERO = +32768\n                # We have to explicitly cast _zero to prevent numpy from raising an\n                # error when doing self.data -= zero, and we do this instead of\n                # self.data = self.data - zero to avoid doubling memory usage.\n                np.add(self.data, -_zero, out=self.data, casting='unsafe')\n            self._header['BZERO'] = _zero\n        else:\n            try:\n                del self._header['BZERO']\n            except KeyError:\n                pass\n\n        if _scale and _scale != 1:\n            self.data = self.data / _scale\n            self._header['BSCALE'] = _scale\n        else:\n            try:\n                del self._header['BSCALE']\n            except KeyError:\n                pass\n\n        # Set blanks\n        if blank is not None and issubclass(_type, np.integer):\n            # TODO: Perhaps check that the requested BLANK value fits in the\n            # integer type being scaled to?\n            self.data[np.isnan(self.data)] = blank\n            self._header['BLANK'] = blank\n\n        if self.data.dtype.type != _type:\n            self.data = np.array(np.around(self.data), dtype=_type)\n\n        # Update the BITPIX Card to match the data\n        self._bitpix = DTYPE2BITPIX[self.data.dtype.name]\n        self._bzero = self._header.get('BZERO', 0)\n        self._bscale = self._header.get('BSCALE', 1)\n        self._blank = blank\n        self._header['BITPIX'] = self._bitpix\n\n        # Since the image has been manually scaled, the current\n        # bitpix/bzero/bscale now serve as the 'original' scaling of the image,\n        # as though the original image has been completely replaced\n        self._orig_bitpix = self._bitpix\n        self._orig_bzero = self._bzero\n        self._orig_bscale = self._bscale\n        self._orig_blank = self._blank"},{"col":4,"comment":"null","endLoc":888,"header":"def __getstate__(self)","id":2027,"name":"__getstate__","nodeType":"Function","startLoc":885,"text":"def __getstate__(self):\n        columns = OrderedDict((key, col if isinstance(col, BaseColumn) else col_copy(col))\n                              for key, col in self.columns.items())\n        return (columns, self.meta)"},{"col":4,"comment":"null","endLoc":576,"header":"def _verify(self, option='warn')","id":2028,"name":"_verify","nodeType":"Function","startLoc":570,"text":"def _verify(self, option='warn'):\n        # update_header can fix some things that would otherwise cause\n        # verification to fail, so do that now...\n        self.update_header()\n        self._verify_blank()\n\n        return super()._verify(option)"},{"col":4,"comment":"null","endLoc":892,"header":"def __setstate__(self, state)","id":2029,"name":"__setstate__","nodeType":"Function","startLoc":890,"text":"def __setstate__(self, state):\n        columns, meta = state\n        self.__init__(columns, meta=meta)"},{"col":4,"comment":"null","endLoc":615,"header":"def _prewriteto(self, checksum=False, inplace=False)","id":2030,"name":"_prewriteto","nodeType":"Function","startLoc":604,"text":"def _prewriteto(self, checksum=False, inplace=False):\n        if self._scale_back:\n            self._scale_internal(BITPIX2DTYPE[self._orig_bitpix],\n                                 blank=self._orig_blank)\n\n        self.update_header()\n        if not inplace and self._data_needs_rescale:\n            # Go ahead and load the scaled image data and update the header\n            # with the correct post-rescaling headers\n            _ = self.data\n\n        return super()._prewriteto(checksum, inplace)"},{"col":4,"comment":"null","endLoc":659,"header":"def _writedata_internal(self, fileobj)","id":2031,"name":"_writedata_internal","nodeType":"Function","startLoc":617,"text":"def _writedata_internal(self, fileobj):\n        size = 0\n\n        if self.data is None:\n            return size\n        elif _is_dask_array(self.data):\n            return self._writeinternal_dask(fileobj)\n        else:\n            # Based on the system type, determine the byteorders that\n            # would need to be swapped to get to big-endian output\n            if sys.byteorder == 'little':\n                swap_types = ('<', '=')\n            else:\n                swap_types = ('<',)\n            # deal with unsigned integer 16, 32 and 64 data\n            if _is_pseudo_integer(self.data.dtype):\n                # Convert the unsigned array to signed\n                output = np.array(\n                    self.data - _pseudo_zero(self.data.dtype),\n                    dtype=f'>i{self.data.dtype.itemsize}')\n                should_swap = False\n            else:\n                output = self.data\n                byteorder = output.dtype.str[0]\n                should_swap = (byteorder in swap_types)\n\n            if should_swap:\n                if output.flags.writeable:\n                    output.byteswap(True)\n                    try:\n                        fileobj.writearray(output)\n                    finally:\n                        output.byteswap(True)\n                else:\n                    # For read-only arrays, there is no way around making\n                    # a byteswapped copy of the data.\n                    fileobj.writearray(output.byteswap(False))\n            else:\n                fileobj.writearray(output)\n\n            size += output.size * output.itemsize\n\n            return size"},{"col":4,"comment":"null","endLoc":175,"header":"def __init__(self, site, attribute, close_names=None)","id":2032,"name":"__init__","nodeType":"Function","startLoc":168,"text":"def __init__(self, site, attribute, close_names=None):\n        message = f\"Site '{site}' not in database. Use {attribute} to see available sites.\"\n        if close_names:\n            message += \" Did you mean one of: '{}'?'\".format(\"', '\".join(close_names))\n        self.site = site\n        self.attribute = attribute\n        self.close_names = close_names\n        return super().__init__(message)"},{"col":4,"comment":"null","endLoc":720,"header":"def _writeinternal_dask(self, fileobj)","id":2033,"name":"_writeinternal_dask","nodeType":"Function","startLoc":661,"text":"def _writeinternal_dask(self, fileobj):\n\n        if sys.byteorder == 'little':\n            swap_types = ('<', '=')\n        else:\n            swap_types = ('<',)\n        # deal with unsigned integer 16, 32 and 64 data\n        if _is_pseudo_integer(self.data.dtype):\n            raise NotImplementedError(\"This dtype isn't currently supported with dask.\")\n        else:\n            output = self.data\n            byteorder = output.dtype.str[0]\n            should_swap = (byteorder in swap_types)\n\n        if should_swap:\n            from dask.utils import M\n            # NOTE: the inplace flag to byteswap needs to be False otherwise the array is\n            # byteswapped in place every time it is computed and this affects\n            # the input dask array.\n            output = output.map_blocks(M.byteswap, False).map_blocks(M.newbyteorder, \"S\")\n\n        initial_position = fileobj.tell()\n        n_bytes = output.nbytes\n\n        # Extend the file n_bytes into the future\n        fileobj.seek(initial_position + n_bytes - 1)\n        fileobj.write(b'\\0')\n        fileobj.flush()\n\n        if fileobj.fileobj_mode not in ('rb+', 'wb+', 'ab+'):\n            # Use another file handle if the current one is not in\n            # read/write mode\n            fp = open(fileobj.name, mode='rb+')\n            should_close = True\n        else:\n            fp = fileobj._file\n            should_close = False\n\n        try:\n            outmmap = mmap.mmap(fp.fileno(),\n                                length=initial_position + n_bytes,\n                                access=mmap.ACCESS_WRITE)\n\n            outarr = np.ndarray(shape=output.shape,\n                                dtype=output.dtype,\n                                offset=initial_position,\n                                buffer=outmmap)\n\n            output.store(outarr, lock=True, compute=True)\n        finally:\n            if should_close:\n                fp.close()\n            outmmap.close()\n\n        # On Windows closing the memmap causes the file pointer to return to 0, so\n        # we need to go back to the end of the data (since padding may be written\n        # after)\n        fileobj.seek(initial_position + n_bytes)\n\n        return n_bytes"},{"col":4,"comment":"\n        Summarize the HDU: name, dimensions, and formats.\n        ","endLoc":874,"header":"def _summary(self)","id":2034,"name":"_summary","nodeType":"Function","startLoc":843,"text":"def _summary(self):\n        \"\"\"\n        Summarize the HDU: name, dimensions, and formats.\n        \"\"\"\n\n        class_name = self.__class__.__name__\n\n        # if data is touched, use data info.\n        if self._data_loaded:\n            if self.data is None:\n                format = ''\n            else:\n                format = self.data.dtype.name\n                format = format[format.rfind('.')+1:]\n        else:\n            if self.shape and all(self.shape):\n                # Only show the format if all the dimensions are non-zero\n                # if data is not touched yet, use header info.\n                format = BITPIX2DTYPE[self._bitpix]\n            else:\n                format = ''\n\n            if (format and not self._do_not_scale_image_data and\n                    (self._orig_bscale != 1 or self._orig_bzero != 0)):\n                new_dtype = self._dtype_for_bitpix()\n                if new_dtype is not None:\n                    format += f' (rescales to {new_dtype.name})'\n\n        # Display shape in FITS-order\n        shape = tuple(reversed(self.shape))\n\n        return (self.name, self.ver, class_name, len(self._header), shape, format, '')"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":2035,"name":"fixed_width_indent","nodeType":"Attribute","startLoc":15,"text":"fixed_width_indent"},{"col":0,"comment":"\n    A version of :func:`numpy.allclose` that returns the indices\n    where the two arrays differ, instead of just a boolean value.\n\n    Parameters\n    ----------\n    a, b : array-like\n        Input arrays to compare.\n\n    rtol, atol : float\n        Relative and absolute tolerances as accepted by\n        :func:`numpy.allclose`.\n\n    Returns\n    -------\n    idx : tuple of array\n        Indices where the two arrays differ.\n\n    ","endLoc":171,"header":"def where_not_allclose(a, b, rtol=1e-5, atol=1e-8)","id":2036,"name":"where_not_allclose","nodeType":"Function","startLoc":141,"text":"def where_not_allclose(a, b, rtol=1e-5, atol=1e-8):\n    \"\"\"\n    A version of :func:`numpy.allclose` that returns the indices\n    where the two arrays differ, instead of just a boolean value.\n\n    Parameters\n    ----------\n    a, b : array-like\n        Input arrays to compare.\n\n    rtol, atol : float\n        Relative and absolute tolerances as accepted by\n        :func:`numpy.allclose`.\n\n    Returns\n    -------\n    idx : tuple of array\n        Indices where the two arrays differ.\n\n    \"\"\"\n    # Create fixed mask arrays to handle INF and NaN; currently INF and NaN\n    # are handled as equivalent\n    if not np.all(np.isfinite(a)):\n        a = np.ma.fix_invalid(a).data\n    if not np.all(np.isfinite(b)):\n        b = np.ma.fix_invalid(b).data\n\n    if atol == 0.0 and rtol == 0.0:\n        # Use a faster comparison for the most simple (and common) case\n        return np.where(a != b)\n    return np.where(np.abs(a - b) > (atol + rtol * np.abs(b)))"},{"col":4,"comment":"null","endLoc":909,"header":"@property\n    def mask(self)","id":2037,"name":"mask","nodeType":"Function","startLoc":894,"text":"@property\n    def mask(self):\n        # Dynamic view of available masks\n        if self.masked or self.has_masked_columns or self.has_masked_values:\n            mask_table = Table([getattr(col, 'mask', FalseArray(col.shape))\n                                for col in self.itercols()],\n                               names=self.colnames, copy=False)\n\n            # Set hidden attribute to force inplace setitem so that code like\n            # t.mask['a'] = [1, 0, 1] will correctly set the underlying mask.\n            # See #5556 for discussion.\n            mask_table._setitem_inplace = True\n        else:\n            mask_table = None\n\n        return mask_table"},{"col":0,"comment":"\n    Diff two scalar values. If both values are floats, they are compared to\n    within the given absolute and relative tolerance.\n\n    Parameters\n    ----------\n    a, b : int, float, str\n        Scalar values to compare.\n\n    rtol, atol : float\n        Relative and absolute tolerances as accepted by\n        :func:`numpy.allclose`.\n\n    Returns\n    -------\n    is_different : bool\n        `True` if they are different, else `False`.\n\n    ","endLoc":43,"header":"def diff_values(a, b, rtol=0.0, atol=0.0)","id":2038,"name":"diff_values","nodeType":"Function","startLoc":18,"text":"def diff_values(a, b, rtol=0.0, atol=0.0):\n    \"\"\"\n    Diff two scalar values. If both values are floats, they are compared to\n    within the given absolute and relative tolerance.\n\n    Parameters\n    ----------\n    a, b : int, float, str\n        Scalar values to compare.\n\n    rtol, atol : float\n        Relative and absolute tolerances as accepted by\n        :func:`numpy.allclose`.\n\n    Returns\n    -------\n    is_different : bool\n        `True` if they are different, else `False`.\n\n    \"\"\"\n    if isinstance(a, float) and isinstance(b, float):\n        if np.isnan(a) and np.isnan(b):\n            return False\n        return not np.allclose(a, b, rtol=rtol, atol=atol)\n    else:\n        return a != b"},{"col":4,"comment":"\n        Return an object of this class for a given address by querying either\n        the OpenStreetMap Nominatim tool [1]_ (default) or the Google geocoding\n        API [2]_, which requires a specified API key.\n\n        This is intended as a quick convenience function to get easy access to\n        locations. If you need to specify a precise location, you should use the\n        initializer directly and pass in a longitude, latitude, and elevation.\n\n        In the background, this just issues a web query to either of\n        the APIs noted above. This is not meant to be abused! Both\n        OpenStreetMap and Google use IP-based query limiting and will ban your\n        IP if you send more than a few thousand queries per hour [2]_.\n\n        .. warning::\n            If the query returns more than one location (e.g., searching on\n            ``address='springfield'``), this function will use the **first**\n            returned location.\n\n        Parameters\n        ----------\n        address : str\n            The address to get the location for. As per the Google maps API,\n            this can be a fully specified street address (e.g., 123 Main St.,\n            New York, NY) or a city name (e.g., Danbury, CT), or etc.\n        get_height : bool, optional\n            This only works when using the Google API! See the ``google_api_key``\n            block below. Use the retrieved location to perform a second query to\n            the Google maps elevation API to retrieve the height of the input\n            address [3]_.\n        google_api_key : str, optional\n            A Google API key with the Geocoding API and (optionally) the\n            elevation API enabled. See [4]_ for more information.\n\n\n        Returns\n        -------\n        location : `~astropy.coordinates.EarthLocation` (or subclass) instance\n            The location of the input address.\n            Will be type(this class)\n\n        References\n        ----------\n        .. [1] https://nominatim.openstreetmap.org/\n        .. [2] https://developers.google.com/maps/documentation/geocoding/start\n        .. [3] https://developers.google.com/maps/documentation/elevation/start\n        .. [4] https://developers.google.com/maps/documentation/geocoding/get-api-key\n\n        ","endLoc":481,"header":"@classmethod\n    def of_address(cls, address, get_height=False, google_api_key=None)","id":2039,"name":"of_address","nodeType":"Function","startLoc":379,"text":"@classmethod\n    def of_address(cls, address, get_height=False, google_api_key=None):\n        \"\"\"\n        Return an object of this class for a given address by querying either\n        the OpenStreetMap Nominatim tool [1]_ (default) or the Google geocoding\n        API [2]_, which requires a specified API key.\n\n        This is intended as a quick convenience function to get easy access to\n        locations. If you need to specify a precise location, you should use the\n        initializer directly and pass in a longitude, latitude, and elevation.\n\n        In the background, this just issues a web query to either of\n        the APIs noted above. This is not meant to be abused! Both\n        OpenStreetMap and Google use IP-based query limiting and will ban your\n        IP if you send more than a few thousand queries per hour [2]_.\n\n        .. warning::\n            If the query returns more than one location (e.g., searching on\n            ``address='springfield'``), this function will use the **first**\n            returned location.\n\n        Parameters\n        ----------\n        address : str\n            The address to get the location for. As per the Google maps API,\n            this can be a fully specified street address (e.g., 123 Main St.,\n            New York, NY) or a city name (e.g., Danbury, CT), or etc.\n        get_height : bool, optional\n            This only works when using the Google API! See the ``google_api_key``\n            block below. Use the retrieved location to perform a second query to\n            the Google maps elevation API to retrieve the height of the input\n            address [3]_.\n        google_api_key : str, optional\n            A Google API key with the Geocoding API and (optionally) the\n            elevation API enabled. See [4]_ for more information.\n\n\n        Returns\n        -------\n        location : `~astropy.coordinates.EarthLocation` (or subclass) instance\n            The location of the input address.\n            Will be type(this class)\n\n        References\n        ----------\n        .. [1] https://nominatim.openstreetmap.org/\n        .. [2] https://developers.google.com/maps/documentation/geocoding/start\n        .. [3] https://developers.google.com/maps/documentation/elevation/start\n        .. [4] https://developers.google.com/maps/documentation/geocoding/get-api-key\n\n        \"\"\"\n\n        use_google = google_api_key is not None\n\n        # Fail fast if invalid options are passed:\n        if not use_google and get_height:\n            raise ValueError(\n                'Currently, `get_height` only works when using '\n                'the Google geocoding API, which requires passing '\n                'a Google API key with `google_api_key`. See: '\n                'https://developers.google.com/maps/documentation/geocoding/get-api-key '\n                'for information on obtaining an API key.')\n\n        if use_google:  # Google\n            pars = urllib.parse.urlencode({'address': address,\n                                           'key': google_api_key})\n            geo_url = f\"https://maps.googleapis.com/maps/api/geocode/json?{pars}\"\n\n        else:  # OpenStreetMap\n            pars = urllib.parse.urlencode({'q': address,\n                                           'format': 'json'})\n            geo_url = f\"https://nominatim.openstreetmap.org/search?{pars}\"\n\n        # get longitude and latitude location\n        err_str = f\"Unable to retrieve coordinates for address '{address}'; {{msg}}\"\n        geo_result = _get_json_result(geo_url, err_str=err_str,\n                                      use_google=use_google)\n\n        if use_google:\n            loc = geo_result[0]['geometry']['location']\n            lat = loc['lat']\n            lon = loc['lng']\n\n        else:\n            loc = geo_result[0]\n            lat = float(loc['lat'])  # strings are returned by OpenStreetMap\n            lon = float(loc['lon'])\n\n        if get_height:\n            pars = {'locations': f'{lat:.8f},{lon:.8f}',\n                    'key': google_api_key}\n            pars = urllib.parse.urlencode(pars)\n            ele_url = f\"https://maps.googleapis.com/maps/api/elevation/json?{pars}\"\n\n            err_str = f\"Unable to retrieve elevation for address '{address}'; {{msg}}\"\n            ele_result = _get_json_result(ele_url, err_str=err_str,\n                                          use_google=use_google)\n            height = ele_result[0]['elevation']*u.meter\n\n        else:\n            height = 0.\n\n        return cls.from_geodetic(lon=lon*u.deg, lat=lat*u.deg, height=height)"},{"col":4,"comment":"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        ","endLoc":922,"header":"def _calculate_datasum(self)","id":2040,"name":"_calculate_datasum","nodeType":"Function","startLoc":876,"text":"def _calculate_datasum(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        \"\"\"\n\n        if self._has_data:\n\n            # We have the data to be used.\n            d = self.data\n\n            # First handle the special case where the data is unsigned integer\n            # 16, 32 or 64\n            if _is_pseudo_integer(self.data.dtype):\n                d = np.array(self.data - _pseudo_zero(self.data.dtype),\n                             dtype=f'i{self.data.dtype.itemsize}')\n\n            # Check the byte order of the data.  If it is little endian we\n            # must swap it before calculating the datasum.\n            if d.dtype.str[0] != '>':\n                if d.flags.writeable:\n                    byteswapped = True\n                    d = d.byteswap(True)\n                    d.dtype = d.dtype.newbyteorder('>')\n                else:\n                    # If the data is not writeable, we just make a byteswapped\n                    # copy and don't bother changing it back after\n                    d = d.byteswap(False)\n                    d.dtype = d.dtype.newbyteorder('>')\n                    byteswapped = False\n            else:\n                byteswapped = False\n\n            cs = self._compute_checksum(d.flatten().view(np.uint8))\n\n            # If the data was byteswapped in this method then return it to\n            # its original little-endian order.\n            if byteswapped and not _is_pseudo_integer(self.data.dtype):\n                d.byteswap(True)\n                d.dtype = d.dtype.newbyteorder('<')\n\n            return cs\n        else:\n            # This is the case where the data has not been read from the file\n            # yet.  We can handle that in a generic manner so we do it in the\n            # base class.  The other possibility is that there is no data at\n            # all.  This can also be handled in a generic manner.\n            return super()._calculate_datasum()"},{"className":"HeaderDiff","col":0,"comment":"\n    Diff two `Header` objects.\n\n    `HeaderDiff` objects have the following diff attributes:\n\n    - ``diff_keyword_count``: If the two headers contain a different number of\n      keywords, this contains a 2-tuple of the keyword count for each header.\n\n    - ``diff_keywords``: If either header contains one or more keywords that\n      don't appear at all in the other header, this contains a 2-tuple\n      consisting of a list of the keywords only appearing in header a, and a\n      list of the keywords only appearing in header b.\n\n    - ``diff_duplicate_keywords``: If a keyword appears in both headers at\n      least once, but contains a different number of duplicates (for example, a\n      different number of HISTORY cards in each header), an item is added to\n      this dict with the keyword as the key, and a 2-tuple of the different\n      counts of that keyword as the value.  For example::\n\n          {'HISTORY': (20, 19)}\n\n      means that header a contains 20 HISTORY cards, while header b contains\n      only 19 HISTORY cards.\n\n    - ``diff_keyword_values``: If any of the common keyword between the two\n      headers have different values, they appear in this dict.  It has a\n      structure similar to ``diff_duplicate_keywords``, with the keyword as the\n      key, and a 2-tuple of the different values as the value.  For example::\n\n          {'NAXIS': (2, 3)}\n\n      means that the NAXIS keyword has a value of 2 in header a, and a value of\n      3 in header b.  This excludes any keywords matched by the\n      ``ignore_keywords`` list.\n\n    - ``diff_keyword_comments``: Like ``diff_keyword_values``, but contains\n      differences between keyword comments.\n\n    `HeaderDiff` objects also have a ``common_keywords`` attribute that lists\n    all keywords that appear in both headers.\n    ","endLoc":904,"id":2041,"nodeType":"Class","startLoc":606,"text":"class HeaderDiff(_BaseDiff):\n    \"\"\"\n    Diff two `Header` objects.\n\n    `HeaderDiff` objects have the following diff attributes:\n\n    - ``diff_keyword_count``: If the two headers contain a different number of\n      keywords, this contains a 2-tuple of the keyword count for each header.\n\n    - ``diff_keywords``: If either header contains one or more keywords that\n      don't appear at all in the other header, this contains a 2-tuple\n      consisting of a list of the keywords only appearing in header a, and a\n      list of the keywords only appearing in header b.\n\n    - ``diff_duplicate_keywords``: If a keyword appears in both headers at\n      least once, but contains a different number of duplicates (for example, a\n      different number of HISTORY cards in each header), an item is added to\n      this dict with the keyword as the key, and a 2-tuple of the different\n      counts of that keyword as the value.  For example::\n\n          {'HISTORY': (20, 19)}\n\n      means that header a contains 20 HISTORY cards, while header b contains\n      only 19 HISTORY cards.\n\n    - ``diff_keyword_values``: If any of the common keyword between the two\n      headers have different values, they appear in this dict.  It has a\n      structure similar to ``diff_duplicate_keywords``, with the keyword as the\n      key, and a 2-tuple of the different values as the value.  For example::\n\n          {'NAXIS': (2, 3)}\n\n      means that the NAXIS keyword has a value of 2 in header a, and a value of\n      3 in header b.  This excludes any keywords matched by the\n      ``ignore_keywords`` list.\n\n    - ``diff_keyword_comments``: Like ``diff_keyword_values``, but contains\n      differences between keyword comments.\n\n    `HeaderDiff` objects also have a ``common_keywords`` attribute that lists\n    all keywords that appear in both headers.\n    \"\"\"\n\n    def __init__(self, a, b, ignore_keywords=[], ignore_comments=[],\n                 rtol=0.0, atol=0.0, ignore_blanks=True, ignore_blank_cards=True):\n        \"\"\"\n        Parameters\n        ----------\n        a : `~astropy.io.fits.Header` or string or bytes\n            A header.\n\n        b : `~astropy.io.fits.Header` or string or bytes\n            A header to compare to the first header.\n\n        ignore_keywords : sequence, optional\n            Header keywords to ignore when comparing two headers; the presence\n            of these keywords and their values are ignored.  Wildcard strings\n            may also be included in the list.\n\n        ignore_comments : sequence, optional\n            A list of header keywords whose comments should be ignored in the\n            comparison.  May contain wildcard strings as with ignore_keywords.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\\\left| a - b \\\\right| > \\\\text{atol} + \\\\text{rtol} \\\\cdot \\\\left| b \\\\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n\n        ignore_blanks : bool, optional\n            Ignore extra whitespace at the end of string values either in\n            headers or data. Extra leading whitespace is not ignored\n            (default: True).\n\n        ignore_blank_cards : bool, optional\n            Ignore all cards that are blank, i.e. they only contain\n            whitespace (default: True).\n        \"\"\"\n\n        self.ignore_keywords = {k.upper() for k in ignore_keywords}\n        self.ignore_comments = {k.upper() for k in ignore_comments}\n\n        self.rtol = rtol\n        self.atol = atol\n\n        self.ignore_blanks = ignore_blanks\n        self.ignore_blank_cards = ignore_blank_cards\n\n        self.ignore_keyword_patterns = set()\n        self.ignore_comment_patterns = set()\n        for keyword in list(self.ignore_keywords):\n            keyword = keyword.upper()\n            if keyword != '*' and glob.has_magic(keyword):\n                self.ignore_keywords.remove(keyword)\n                self.ignore_keyword_patterns.add(keyword)\n        for keyword in list(self.ignore_comments):\n            keyword = keyword.upper()\n            if keyword != '*' and glob.has_magic(keyword):\n                self.ignore_comments.remove(keyword)\n                self.ignore_comment_patterns.add(keyword)\n\n        # Keywords appearing in each header\n        self.common_keywords = []\n\n        # Set to the number of keywords in each header if the counts differ\n        self.diff_keyword_count = ()\n\n        # Set if the keywords common to each header (excluding ignore_keywords)\n        # appear in different positions within the header\n        # TODO: Implement this\n        self.diff_keyword_positions = ()\n\n        # Keywords unique to each header (excluding keywords in\n        # ignore_keywords)\n        self.diff_keywords = ()\n\n        # Keywords that have different numbers of duplicates in each header\n        # (excluding keywords in ignore_keywords)\n        self.diff_duplicate_keywords = {}\n\n        # Keywords common to each header but having different values (excluding\n        # keywords in ignore_keywords)\n        self.diff_keyword_values = defaultdict(list)\n\n        # Keywords common to each header but having different comments\n        # (excluding keywords in ignore_keywords or in ignore_comments)\n        self.diff_keyword_comments = defaultdict(list)\n\n        if isinstance(a, str):\n            a = Header.fromstring(a)\n        if isinstance(b, str):\n            b = Header.fromstring(b)\n\n        if not (isinstance(a, Header) and isinstance(b, Header)):\n            raise TypeError('HeaderDiff can only diff astropy.io.fits.Header '\n                            'objects or strings containing FITS headers.')\n\n        super().__init__(a, b)\n\n    # TODO: This doesn't pay much attention to the *order* of the keywords,\n    # except in the case of duplicate keywords.  The order should be checked\n    # too, or at least it should be an option.\n    def _diff(self):\n        if self.ignore_blank_cards:\n            cardsa = [c for c in self.a.cards if str(c) != BLANK_CARD]\n            cardsb = [c for c in self.b.cards if str(c) != BLANK_CARD]\n        else:\n            cardsa = list(self.a.cards)\n            cardsb = list(self.b.cards)\n\n        # build dictionaries of keyword values and comments\n        def get_header_values_comments(cards):\n            values = {}\n            comments = {}\n            for card in cards:\n                value = card.value\n                if self.ignore_blanks and isinstance(value, str):\n                    value = value.rstrip()\n                values.setdefault(card.keyword, []).append(value)\n                comments.setdefault(card.keyword, []).append(card.comment)\n            return values, comments\n\n        valuesa, commentsa = get_header_values_comments(cardsa)\n        valuesb, commentsb = get_header_values_comments(cardsb)\n\n        # Normalize all keyword to upper-case for comparison's sake;\n        # TODO: HIERARCH keywords should be handled case-sensitively I think\n        keywordsa = {k.upper() for k in valuesa}\n        keywordsb = {k.upper() for k in valuesb}\n\n        self.common_keywords = sorted(keywordsa.intersection(keywordsb))\n        if len(cardsa) != len(cardsb):\n            self.diff_keyword_count = (len(cardsa), len(cardsb))\n\n        # Any other diff attributes should exclude ignored keywords\n        keywordsa = keywordsa.difference(self.ignore_keywords)\n        keywordsb = keywordsb.difference(self.ignore_keywords)\n        if self.ignore_keyword_patterns:\n            for pattern in self.ignore_keyword_patterns:\n                keywordsa = keywordsa.difference(fnmatch.filter(keywordsa,\n                                                                pattern))\n                keywordsb = keywordsb.difference(fnmatch.filter(keywordsb,\n                                                                pattern))\n\n        if '*' in self.ignore_keywords:\n            # Any other differences between keywords are to be ignored\n            return\n\n        left_only_keywords = sorted(keywordsa.difference(keywordsb))\n        right_only_keywords = sorted(keywordsb.difference(keywordsa))\n\n        if left_only_keywords or right_only_keywords:\n            self.diff_keywords = (left_only_keywords, right_only_keywords)\n\n        # Compare count of each common keyword\n        for keyword in self.common_keywords:\n            if keyword in self.ignore_keywords:\n                continue\n            if self.ignore_keyword_patterns:\n                skip = False\n                for pattern in self.ignore_keyword_patterns:\n                    if fnmatch.fnmatch(keyword, pattern):\n                        skip = True\n                        break\n                if skip:\n                    continue\n\n            counta = len(valuesa[keyword])\n            countb = len(valuesb[keyword])\n            if counta != countb:\n                self.diff_duplicate_keywords[keyword] = (counta, countb)\n\n            # Compare keywords' values and comments\n            for a, b in zip(valuesa[keyword], valuesb[keyword]):\n                if diff_values(a, b, rtol=self.rtol, atol=self.atol):\n                    self.diff_keyword_values[keyword].append((a, b))\n                else:\n                    # If there are duplicate keywords we need to be able to\n                    # index each duplicate; if the values of a duplicate\n                    # are identical use None here\n                    self.diff_keyword_values[keyword].append(None)\n\n            if not any(self.diff_keyword_values[keyword]):\n                # No differences found; delete the array of Nones\n                del self.diff_keyword_values[keyword]\n\n            if '*' in self.ignore_comments or keyword in self.ignore_comments:\n                continue\n            if self.ignore_comment_patterns:\n                skip = False\n                for pattern in self.ignore_comment_patterns:\n                    if fnmatch.fnmatch(keyword, pattern):\n                        skip = True\n                        break\n                if skip:\n                    continue\n\n            for a, b in zip(commentsa[keyword], commentsb[keyword]):\n                if diff_values(a, b):\n                    self.diff_keyword_comments[keyword].append((a, b))\n                else:\n                    self.diff_keyword_comments[keyword].append(None)\n\n            if not any(self.diff_keyword_comments[keyword]):\n                del self.diff_keyword_comments[keyword]\n\n    def _report(self):\n        if self.diff_keyword_count:\n            self._writeln(' Headers have different number of cards:')\n            self._writeln(f'  a: {self.diff_keyword_count[0]}')\n            self._writeln(f'  b: {self.diff_keyword_count[1]}')\n        if self.diff_keywords:\n            for keyword in self.diff_keywords[0]:\n                if keyword in Card._commentary_keywords:\n                    val = self.a[keyword][0]\n                else:\n                    val = self.a[keyword]\n                self._writeln(f' Extra keyword {keyword!r:8} in a: {val!r}')\n            for keyword in self.diff_keywords[1]:\n                if keyword in Card._commentary_keywords:\n                    val = self.b[keyword][0]\n                else:\n                    val = self.b[keyword]\n                self._writeln(f' Extra keyword {keyword!r:8} in b: {val!r}')\n\n        if self.diff_duplicate_keywords:\n            for keyword, count in sorted(self.diff_duplicate_keywords.items()):\n                self._writeln(f' Inconsistent duplicates of keyword {keyword!r:8}:')\n                self._writeln('  Occurs {} time(s) in a, {} times in (b)'\n                              .format(*count))\n\n        if self.diff_keyword_values or self.diff_keyword_comments:\n            for keyword in self.common_keywords:\n                report_diff_keyword_attr(self._fileobj, 'values',\n                                         self.diff_keyword_values, keyword,\n                                         ind=self._indent)\n                report_diff_keyword_attr(self._fileobj, 'comments',\n                                         self.diff_keyword_comments, keyword,\n                                         ind=self._indent)"},{"col":4,"comment":"\n        Parameters\n        ----------\n        a : `~astropy.io.fits.Header` or string or bytes\n            A header.\n\n        b : `~astropy.io.fits.Header` or string or bytes\n            A header to compare to the first header.\n\n        ignore_keywords : sequence, optional\n            Header keywords to ignore when comparing two headers; the presence\n            of these keywords and their values are ignored.  Wildcard strings\n            may also be included in the list.\n\n        ignore_comments : sequence, optional\n            A list of header keywords whose comments should be ignored in the\n            comparison.  May contain wildcard strings as with ignore_keywords.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\left| a - b \\right| > \\text{atol} + \\text{rtol} \\cdot \\left| b \\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n\n        ignore_blanks : bool, optional\n            Ignore extra whitespace at the end of string values either in\n            headers or data. Extra leading whitespace is not ignored\n            (default: True).\n\n        ignore_blank_cards : bool, optional\n            Ignore all cards that are blank, i.e. they only contain\n            whitespace (default: True).\n        ","endLoc":763,"header":"def __init__(self, a, b, ignore_keywords=[], ignore_comments=[],\n                 rtol=0.0, atol=0.0, ignore_blanks=True, ignore_blank_cards=True)","id":2042,"name":"__init__","nodeType":"Function","startLoc":649,"text":"def __init__(self, a, b, ignore_keywords=[], ignore_comments=[],\n                 rtol=0.0, atol=0.0, ignore_blanks=True, ignore_blank_cards=True):\n        \"\"\"\n        Parameters\n        ----------\n        a : `~astropy.io.fits.Header` or string or bytes\n            A header.\n\n        b : `~astropy.io.fits.Header` or string or bytes\n            A header to compare to the first header.\n\n        ignore_keywords : sequence, optional\n            Header keywords to ignore when comparing two headers; the presence\n            of these keywords and their values are ignored.  Wildcard strings\n            may also be included in the list.\n\n        ignore_comments : sequence, optional\n            A list of header keywords whose comments should be ignored in the\n            comparison.  May contain wildcard strings as with ignore_keywords.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\\\left| a - b \\\\right| > \\\\text{atol} + \\\\text{rtol} \\\\cdot \\\\left| b \\\\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n\n        ignore_blanks : bool, optional\n            Ignore extra whitespace at the end of string values either in\n            headers or data. Extra leading whitespace is not ignored\n            (default: True).\n\n        ignore_blank_cards : bool, optional\n            Ignore all cards that are blank, i.e. they only contain\n            whitespace (default: True).\n        \"\"\"\n\n        self.ignore_keywords = {k.upper() for k in ignore_keywords}\n        self.ignore_comments = {k.upper() for k in ignore_comments}\n\n        self.rtol = rtol\n        self.atol = atol\n\n        self.ignore_blanks = ignore_blanks\n        self.ignore_blank_cards = ignore_blank_cards\n\n        self.ignore_keyword_patterns = set()\n        self.ignore_comment_patterns = set()\n        for keyword in list(self.ignore_keywords):\n            keyword = keyword.upper()\n            if keyword != '*' and glob.has_magic(keyword):\n                self.ignore_keywords.remove(keyword)\n                self.ignore_keyword_patterns.add(keyword)\n        for keyword in list(self.ignore_comments):\n            keyword = keyword.upper()\n            if keyword != '*' and glob.has_magic(keyword):\n                self.ignore_comments.remove(keyword)\n                self.ignore_comment_patterns.add(keyword)\n\n        # Keywords appearing in each header\n        self.common_keywords = []\n\n        # Set to the number of keywords in each header if the counts differ\n        self.diff_keyword_count = ()\n\n        # Set if the keywords common to each header (excluding ignore_keywords)\n        # appear in different positions within the header\n        # TODO: Implement this\n        self.diff_keyword_positions = ()\n\n        # Keywords unique to each header (excluding keywords in\n        # ignore_keywords)\n        self.diff_keywords = ()\n\n        # Keywords that have different numbers of duplicates in each header\n        # (excluding keywords in ignore_keywords)\n        self.diff_duplicate_keywords = {}\n\n        # Keywords common to each header but having different values (excluding\n        # keywords in ignore_keywords)\n        self.diff_keyword_values = defaultdict(list)\n\n        # Keywords common to each header but having different comments\n        # (excluding keywords in ignore_keywords or in ignore_comments)\n        self.diff_keyword_comments = defaultdict(list)\n\n        if isinstance(a, str):\n            a = Header.fromstring(a)\n        if isinstance(b, str):\n            b = Header.fromstring(b)\n\n        if not (isinstance(a, Header) and isinstance(b, Header)):\n            raise TypeError('HeaderDiff can only diff astropy.io.fits.Header '\n                            'objects or strings containing FITS headers.')\n\n        super().__init__(a, b)"},{"col":0,"comment":"null","endLoc":96,"header":"def _get_json_result(url, err_str, use_google)","id":2043,"name":"_get_json_result","nodeType":"Function","startLoc":60,"text":"def _get_json_result(url, err_str, use_google):\n\n    # need to do this here to prevent a series of complicated circular imports\n    from .name_resolve import NameResolveError\n    try:\n        # Retrieve JSON response from Google maps API\n        resp = urllib.request.urlopen(url, timeout=data.conf.remote_timeout)\n        resp_data = json.loads(resp.read().decode('utf8'))\n\n    except urllib.error.URLError as e:\n        # This catches a timeout error, see:\n        #   http://stackoverflow.com/questions/2712524/handling-urllib2s-timeout-python\n        if isinstance(e.reason, socket.timeout):\n            raise NameResolveError(err_str.format(msg=\"connection timed out\")) from e\n        else:\n            raise NameResolveError(err_str.format(msg=e.reason)) from e\n\n    except socket.timeout:\n        # There are some cases where urllib2 does not catch socket.timeout\n        # especially while receiving response data on an already previously\n        # working request\n        raise NameResolveError(err_str.format(msg=\"connection timed out\"))\n\n    if use_google:\n        results = resp_data.get('results', [])\n\n        if resp_data.get('status', None) != 'OK':\n            raise NameResolveError(err_str.format(msg=\"unknown failure with \"\n                                                  \"Google API\"))\n\n    else:  # OpenStreetMap returns a list\n        results = resp_data\n\n    if not results:\n        raise NameResolveError(err_str.format(msg=\"no results returned\"))\n\n    return results"},{"attributeType":"null","col":4,"comment":"null","endLoc":33,"id":2044,"name":"standard_keyword_comments","nodeType":"Attribute","startLoc":33,"text":"standard_keyword_comments"},{"attributeType":"null","col":12,"comment":"null","endLoc":130,"id":2045,"name":"ver","nodeType":"Attribute","startLoc":130,"text":"self.ver"},{"attributeType":"null","col":8,"comment":"null","endLoc":89,"id":2046,"name":"_do_not_scale_image_data","nodeType":"Attribute","startLoc":89,"text":"self._do_not_scale_image_data"},{"attributeType":"null","col":16,"comment":"null","endLoc":141,"id":2047,"name":"_data_needs_rescale","nodeType":"Attribute","startLoc":141,"text":"self._data_needs_rescale"},{"attributeType":"null","col":12,"comment":"null","endLoc":147,"id":2048,"name":"data","nodeType":"Attribute","startLoc":147,"text":"self.data"},{"attributeType":"null","col":12,"comment":"null","endLoc":166,"id":2049,"name":"_orig_bscale","nodeType":"Attribute","startLoc":166,"text":"self._orig_bscale"},{"attributeType":"null","col":8,"comment":"null","endLoc":113,"id":2050,"name":"_blank","nodeType":"Attribute","startLoc":113,"text":"self._blank"},{"col":4,"comment":"null","endLoc":108,"header":"def __new__(cls, shape)","id":2051,"name":"__new__","nodeType":"Function","startLoc":106,"text":"def __new__(cls, shape):\n        obj = np.zeros(shape, dtype=bool).view(cls)\n        return obj"},{"attributeType":"null","col":12,"comment":"null","endLoc":87,"id":2052,"name":"_header","nodeType":"Attribute","startLoc":87,"text":"self._header"},{"attributeType":"null","col":8,"comment":"null","endLoc":91,"id":2053,"name":"_uint","nodeType":"Attribute","startLoc":91,"text":"self._uint"},{"attributeType":"null","col":8,"comment":"null","endLoc":112,"id":2054,"name":"_pcount","nodeType":"Attribute","startLoc":112,"text":"self._pcount"},{"attributeType":"null","col":12,"comment":"null","endLoc":159,"id":2055,"name":"_bscale","nodeType":"Attribute","startLoc":159,"text":"self._bscale"},{"attributeType":"null","col":8,"comment":"null","endLoc":104,"id":2057,"name":"_axes","nodeType":"Attribute","startLoc":104,"text":"self._axes"},{"attributeType":"null","col":8,"comment":"null","endLoc":116,"id":2058,"name":"_orig_bitpix","nodeType":"Attribute","startLoc":116,"text":"self._orig_bitpix"},{"attributeType":"null","col":12,"comment":"null","endLoc":164,"id":2059,"name":"_orig_bzero","nodeType":"Attribute","startLoc":164,"text":"self._orig_bzero"},{"attributeType":"null","col":12,"comment":"null","endLoc":158,"id":2060,"name":"_bzero","nodeType":"Attribute","startLoc":158,"text":"self._bzero"},{"attributeType":"null","col":8,"comment":"null","endLoc":92,"id":2061,"name":"_scale_back","nodeType":"Attribute","startLoc":92,"text":"self._scale_back"},{"attributeType":"null","col":8,"comment":"null","endLoc":117,"id":2062,"name":"_orig_blank","nodeType":"Attribute","startLoc":117,"text":"self._orig_blank"},{"attributeType":"null","col":12,"comment":"null","endLoc":128,"id":2063,"name":"name","nodeType":"Attribute","startLoc":128,"text":"self.name"},{"attributeType":"null","col":12,"comment":"null","endLoc":152,"id":2064,"name":"_bitpix","nodeType":"Attribute","startLoc":152,"text":"self._bitpix"},{"attributeType":"null","col":16,"comment":"null","endLoc":246,"id":2065,"name":"_data_replaced","nodeType":"Attribute","startLoc":246,"text":"self._data_replaced"},{"attributeType":"null","col":8,"comment":"null","endLoc":111,"id":2067,"name":"_gcount","nodeType":"Attribute","startLoc":111,"text":"self._gcount"},{"attributeType":"null","col":8,"comment":"null","endLoc":134,"id":2068,"name":"_modified","nodeType":"Attribute","startLoc":134,"text":"self._modified"},{"col":4,"comment":"null","endLoc":1181,"header":"@classmethod\n    def match_header(cls, header)","id":2069,"name":"match_header","nodeType":"Function","startLoc":1175,"text":"@classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n        return card.keyword == 'XTENSION' and xtension == cls._extension"},{"col":4,"comment":"\n        ImageHDU verify method.\n        ","endLoc":1195,"header":"def _verify(self, option='warn')","id":2070,"name":"_verify","nodeType":"Function","startLoc":1183,"text":"def _verify(self, option='warn'):\n        \"\"\"\n        ImageHDU verify method.\n        \"\"\"\n\n        errs = super()._verify(option=option)\n        naxis = self._header.get('NAXIS', 0)\n        # PCOUNT must == 0, GCOUNT must == 1; the former is verified in\n        # ExtensionHDU._verify, however ExtensionHDU._verify allows PCOUNT\n        # to be >= 0, so we need to check it here\n        self.req_cards('PCOUNT', naxis + 3, lambda v: (_is_int(v) and v == 0),\n                       0, option, errs)\n        return errs"},{"col":4,"comment":"null","endLoc":1087,"header":"@classmethod\n    def match_header(cls, header)","id":2071,"name":"match_header","nodeType":"Function","startLoc":1080,"text":"@classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        # Due to problems discussed in #5808, we cannot assume the 'GROUPS'\n        # keyword to be True/False, have to check the value\n        return (card.keyword == 'SIMPLE' and\n                ('GROUPS' not in header or header['GROUPS'] != True) and  # noqa\n                card.value)"},{"col":4,"comment":"null","endLoc":1098,"header":"def update_header(self)","id":2072,"name":"update_header","nodeType":"Function","startLoc":1089,"text":"def update_header(self):\n        super().update_header()\n\n        # Update the position of the EXTEND keyword if it already exists\n        if 'EXTEND' in self._header:\n            if len(self._axes):\n                after = 'NAXIS' + str(len(self._axes))\n            else:\n                after = 'NAXIS'\n            self._header.set('EXTEND', after=after)"},{"col":4,"comment":"null","endLoc":913,"header":"@mask.setter\n    def mask(self, val)","id":2073,"name":"mask","nodeType":"Function","startLoc":911,"text":"@mask.setter\n    def mask(self, val):\n        self.mask[:] = val"},{"col":4,"comment":"This is needed so that comparison of a masked Table and a\n        MaskedArray works.  The requirement comes from numpy.ma.core\n        so don't remove this property.","endLoc":920,"header":"@property\n    def _mask(self)","id":2074,"name":"_mask","nodeType":"Function","startLoc":915,"text":"@property\n    def _mask(self):\n        \"\"\"This is needed so that comparison of a masked Table and a\n        MaskedArray works.  The requirement comes from numpy.ma.core\n        so don't remove this property.\"\"\"\n        return self.as_array().mask"},{"col":4,"comment":"Return copy of self, with masked values filled.\n\n        If input ``fill_value`` supplied then that value is used for all\n        masked entries in the table.  Otherwise the individual\n        ``fill_value`` defined for each table column is used.\n\n        Parameters\n        ----------\n        fill_value : str\n            If supplied, this ``fill_value`` is used for all masked entries\n            in the entire table.\n\n        Returns\n        -------\n        filled_table : `~astropy.table.Table`\n            New table with masked values filled\n        ","endLoc":948,"header":"def filled(self, fill_value=None)","id":2075,"name":"filled","nodeType":"Function","startLoc":922,"text":"def filled(self, fill_value=None):\n        \"\"\"Return copy of self, with masked values filled.\n\n        If input ``fill_value`` supplied then that value is used for all\n        masked entries in the table.  Otherwise the individual\n        ``fill_value`` defined for each table column is used.\n\n        Parameters\n        ----------\n        fill_value : str\n            If supplied, this ``fill_value`` is used for all masked entries\n            in the entire table.\n\n        Returns\n        -------\n        filled_table : `~astropy.table.Table`\n            New table with masked values filled\n        \"\"\"\n        if self.masked or self.has_masked_columns or self.has_masked_values:\n            # Get new columns with masked values filled, then create Table with those\n            # new cols (copy=False) but deepcopy the meta.\n            data = [col.filled(fill_value) if hasattr(col, 'filled') else col\n                    for col in self.itercols()]\n            return self.__class__(data, meta=deepcopy(self.meta), copy=False)\n        else:\n            # Return copy of the original object.\n            return self.copy()"},{"col":4,"comment":"null","endLoc":1111,"header":"def _verify(self, option='warn')","id":2076,"name":"_verify","nodeType":"Function","startLoc":1100,"text":"def _verify(self, option='warn'):\n        errs = super()._verify(option=option)\n\n        # Verify location and value of mandatory keywords.\n        # The EXTEND keyword is only mandatory if the HDU has extensions; this\n        # condition is checked by the HDUList object.  However, if we already\n        # have an EXTEND keyword check that its position is correct\n        if 'EXTEND' in self._header:\n            naxis = self._header.get('NAXIS', 0)\n            self.req_cards('EXTEND', naxis + 3, lambda v: isinstance(v, bool),\n                           True, option, errs)\n        return errs"},{"col":44,"endLoc":1193,"id":2077,"nodeType":"Lambda","startLoc":1193,"text":"lambda v: (_is_int(v) and v == 0)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1119,"id":2078,"name":"_extension","nodeType":"Attribute","startLoc":1119,"text":"_extension"},{"className":"BinTableHDU","col":0,"comment":"\n    Binary table HDU class.\n\n    Parameters\n    ----------\n    data : array, `FITS_rec`, or `~astropy.table.Table`\n        Data to be used.\n    header : `Header`\n        Header to be used.\n    name : str\n        Name to be populated in ``EXTNAME`` keyword.\n    uint : bool, optional\n        Set to `True` if the table contains unsigned integer columns.\n    ver : int > 0 or None, optional\n        The ver of the HDU, will be the value of the keyword ``EXTVER``.\n        If not given or None, it defaults to the value of the ``EXTVER``\n        card of the ``header`` or 1.\n        (default: None)\n    character_as_bytes : bool\n        Whether to return bytes for string columns. By default this is `False`\n        and (unicode) strings are returned, but this does not respect memory\n        mapping and loads the whole column in memory when accessed.\n\n    ","endLoc":1477,"id":2079,"nodeType":"Class","startLoc":822,"text":"class BinTableHDU(_TableBaseHDU):\n    \"\"\"\n    Binary table HDU class.\n\n    Parameters\n    ----------\n    data : array, `FITS_rec`, or `~astropy.table.Table`\n        Data to be used.\n    header : `Header`\n        Header to be used.\n    name : str\n        Name to be populated in ``EXTNAME`` keyword.\n    uint : bool, optional\n        Set to `True` if the table contains unsigned integer columns.\n    ver : int > 0 or None, optional\n        The ver of the HDU, will be the value of the keyword ``EXTVER``.\n        If not given or None, it defaults to the value of the ``EXTVER``\n        card of the ``header`` or 1.\n        (default: None)\n    character_as_bytes : bool\n        Whether to return bytes for string columns. By default this is `False`\n        and (unicode) strings are returned, but this does not respect memory\n        mapping and loads the whole column in memory when accessed.\n\n    \"\"\"\n\n    _extension = 'BINTABLE'\n    _ext_comment = 'binary table extension'\n\n    def __init__(self, data=None, header=None, name=None, uint=False, ver=None,\n                 character_as_bytes=False):\n        from astropy.table import Table\n        if isinstance(data, Table):\n            from astropy.io.fits.convenience import table_to_hdu\n            hdu = table_to_hdu(data)\n            if header is not None:\n                hdu.header.update(header)\n            data = hdu.data\n            header = hdu.header\n\n        super().__init__(data, header, name=name, uint=uint, ver=ver,\n                         character_as_bytes=character_as_bytes)\n\n    @classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n        return (card.keyword == 'XTENSION' and\n                xtension in (cls._extension, 'A3DTABLE'))\n\n    def _calculate_datasum_with_heap(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card given the input data\n        \"\"\"\n\n        with _binary_table_byte_swap(self.data) as data:\n            dout = data.view(type=np.ndarray, dtype=np.ubyte)\n            csum = self._compute_checksum(dout)\n\n            # Now add in the heap data to the checksum (we can skip any gap\n            # between the table and the heap since it's all zeros and doesn't\n            # contribute to the checksum\n            if data._get_raw_data() is None:\n                # This block is still needed because\n                # test_variable_length_table_data leads to ._get_raw_data\n                # returning None which means _get_heap_data doesn't work.\n                # Which happens when the data is loaded in memory rather than\n                # being unloaded on disk\n                for idx in range(data._nfields):\n                    if isinstance(data.columns._recformats[idx], _FormatP):\n                        for coldata in data.field(idx):\n                            # coldata should already be byteswapped from the call\n                            # to _binary_table_byte_swap\n                            if not len(coldata):\n                                continue\n\n                            csum = self._compute_checksum(coldata, csum)\n            else:\n                csum = self._compute_checksum(data._get_heap_data(), csum)\n\n            return csum\n\n    def _calculate_datasum(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        \"\"\"\n\n        if self._has_data:\n            # This method calculates the datasum while incorporating any\n            # heap data, which is obviously not handled from the base\n            # _calculate_datasum\n            return self._calculate_datasum_with_heap()\n        else:\n            # This is the case where the data has not been read from the file\n            # yet.  We can handle that in a generic manner so we do it in the\n            # base class.  The other possibility is that there is no data at\n            # all.  This can also be handled in a generic manner.\n            return super()._calculate_datasum()\n\n    def _writedata_internal(self, fileobj):\n        size = 0\n\n        if self.data is None:\n            return size\n\n        with _binary_table_byte_swap(self.data) as data:\n            if _has_unicode_fields(data):\n                # If the raw data was a user-supplied recarray, we can't write\n                # unicode columns directly to the file, so we have to switch\n                # to a slower row-by-row write\n                self._writedata_by_row(fileobj)\n            else:\n                fileobj.writearray(data)\n                # write out the heap of variable length array columns this has\n                # to be done after the \"regular\" data is written (above)\n                # to avoid a bug in the lustre filesystem client, don't\n                # write 0-byte objects\n                if data._gap > 0:\n                    fileobj.write((data._gap * '\\0').encode('ascii'))\n\n            nbytes = data._gap\n\n            if not self._manages_own_heap:\n                # Write the heap data one column at a time, in the order\n                # that the data pointers appear in the column (regardless\n                # if that data pointer has a different, previous heap\n                # offset listed)\n                for idx in range(data._nfields):\n                    if not isinstance(data.columns._recformats[idx],\n                                      _FormatP):\n                        continue\n\n                    field = self.data.field(idx)\n                    for row in field:\n                        if len(row) > 0:\n                            nbytes += row.nbytes\n                            fileobj.writearray(row)\n            else:\n                heap_data = data._get_heap_data()\n                if len(heap_data) > 0:\n                    nbytes += len(heap_data)\n                    fileobj.writearray(heap_data)\n\n            data._heapsize = nbytes - data._gap\n            size += nbytes\n\n        size += self.data.size * self.data._raw_itemsize\n\n        return size\n\n    def _writedata_by_row(self, fileobj):\n        fields = [self.data.field(idx)\n                  for idx in range(len(self.data.columns))]\n\n        # Creating Record objects is expensive (as in\n        # `for row in self.data:` so instead we just iterate over the row\n        # indices and get one field at a time:\n        for idx in range(len(self.data)):\n            for field in fields:\n                item = field[idx]\n                field_width = None\n\n                if field.dtype.kind == 'U':\n                    # Read the field *width* by reading past the field kind.\n                    i = field.dtype.str.index(field.dtype.kind)\n                    field_width = int(field.dtype.str[i+1:])\n                    item = np.char.encode(item, 'ascii')\n\n                fileobj.writearray(item)\n                if field_width is not None:\n                    j = item.dtype.str.index(item.dtype.kind)\n                    item_length = int(item.dtype.str[j+1:])\n                    # Fix padding problem (see #5296).\n                    padding = '\\x00'*(field_width - item_length)\n                    fileobj.write(padding.encode('ascii'))\n\n    _tdump_file_format = textwrap.dedent(\"\"\"\n\n        - **datafile:** Each line of the data file represents one row of table\n          data.  The data is output one column at a time in column order.  If\n          a column contains an array, each element of the column array in the\n          current row is output before moving on to the next column.  Each row\n          ends with a new line.\n\n          Integer data is output right-justified in a 21-character field\n          followed by a blank.  Floating point data is output right justified\n          using 'g' format in a 21-character field with 15 digits of\n          precision, followed by a blank.  String data that does not contain\n          whitespace is output left-justified in a field whose width matches\n          the width specified in the ``TFORM`` header parameter for the\n          column, followed by a blank.  When the string data contains\n          whitespace characters, the string is enclosed in quotation marks\n          (``\"\"``).  For the last data element in a row, the trailing blank in\n          the field is replaced by a new line character.\n\n          For column data containing variable length arrays ('P' format), the\n          array data is preceded by the string ``'VLA_Length= '`` and the\n          integer length of the array for that row, left-justified in a\n          21-character field, followed by a blank.\n\n          .. note::\n\n              This format does *not* support variable length arrays using the\n              ('Q' format) due to difficult to overcome ambiguities. What this\n              means is that this file format cannot support VLA columns in\n              tables stored in files that are over 2 GB in size.\n\n          For column data representing a bit field ('X' format), each bit\n          value in the field is output right-justified in a 21-character field\n          as 1 (for true) or 0 (for false).\n\n        - **cdfile:** Each line of the column definitions file provides the\n          definitions for one column in the table.  The line is broken up into\n          8, sixteen-character fields.  The first field provides the column\n          name (``TTYPEn``).  The second field provides the column format\n          (``TFORMn``).  The third field provides the display format\n          (``TDISPn``).  The fourth field provides the physical units\n          (``TUNITn``).  The fifth field provides the dimensions for a\n          multidimensional array (``TDIMn``).  The sixth field provides the\n          value that signifies an undefined value (``TNULLn``).  The seventh\n          field provides the scale factor (``TSCALn``).  The eighth field\n          provides the offset value (``TZEROn``).  A field value of ``\"\"`` is\n          used to represent the case where no value is provided.\n\n        - **hfile:** Each line of the header parameters file provides the\n          definition of a single HDU header card as represented by the card\n          image.\n      \"\"\")\n\n    def dump(self, datafile=None, cdfile=None, hfile=None, overwrite=False):\n        \"\"\"\n        Dump the table HDU to a file in ASCII format.  The table may be dumped\n        in three separate files, one containing column definitions, one\n        containing header parameters, and one for table data.\n\n        Parameters\n        ----------\n        datafile : path-like or file-like, optional\n            Output data file.  The default is the root name of the\n            fits file associated with this HDU appended with the\n            extension ``.txt``.\n\n        cdfile : path-like or file-like, optional\n            Output column definitions file.  The default is `None`, no\n            column definitions output is produced.\n\n        hfile : path-like or file-like, optional\n            Output header parameters file.  The default is `None`,\n            no header parameters output is produced.\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n\n        Notes\n        -----\n        The primary use for the `dump` method is to allow viewing and editing\n        the table data and parameters in a standard text editor.\n        The `load` method can be used to create a new table from the three\n        plain text (ASCII) files.\n        \"\"\"\n\n        # check if the output files already exist\n        exist = []\n        files = [datafile, cdfile, hfile]\n\n        for f in files:\n            if isinstance(f, str):\n                if os.path.exists(f) and os.path.getsize(f) != 0:\n                    if overwrite:\n                        os.remove(f)\n                    else:\n                        exist.append(f)\n\n        if exist:\n            raise OSError('  '.join([f\"File '{f}' already exists.\"\n                                     for f in exist])+\"  If you mean to \"\n                                                      \"replace the file(s) \"\n                                                      \"then use the argument \"\n                                                      \"'overwrite=True'.\")\n\n        # Process the data\n        self._dump_data(datafile)\n\n        # Process the column definitions\n        if cdfile:\n            self._dump_coldefs(cdfile)\n\n        # Process the header parameters\n        if hfile:\n            self._header.tofile(hfile, sep='\\n', endcard=False, padding=False)\n\n    if isinstance(dump.__doc__, str):\n        dump.__doc__ += _tdump_file_format.replace('\\n', '\\n        ')\n\n    def load(cls, datafile, cdfile=None, hfile=None, replace=False,\n             header=None):\n        \"\"\"\n        Create a table from the input ASCII files.  The input is from up to\n        three separate files, one containing column definitions, one containing\n        header parameters, and one containing column data.\n\n        The column definition and header parameters files are not required.\n        When absent the column definitions and/or header parameters are taken\n        from the header object given in the header argument; otherwise sensible\n        defaults are inferred (though this mode is not recommended).\n\n        Parameters\n        ----------\n        datafile : path-like or file-like\n            Input data file containing the table data in ASCII format.\n\n        cdfile : path-like or file-like, optional\n            Input column definition file containing the names,\n            formats, display formats, physical units, multidimensional\n            array dimensions, undefined values, scale factors, and\n            offsets associated with the columns in the table.  If\n            `None`, the column definitions are taken from the current\n            values in this object.\n\n        hfile : path-like or file-like, optional\n            Input parameter definition file containing the header\n            parameter definitions to be associated with the table.  If\n            `None`, the header parameter definitions are taken from\n            the current values in this objects header.\n\n        replace : bool, optional\n            When `True`, indicates that the entire header should be\n            replaced with the contents of the ASCII file instead of\n            just updating the current header.\n\n        header : `~astropy.io.fits.Header`, optional\n            When the cdfile and hfile are missing, use this Header object in\n            the creation of the new table and HDU.  Otherwise this Header\n            supersedes the keywords from hfile, which is only used to update\n            values not present in this Header, unless ``replace=True`` in which\n            this Header's values are completely replaced with the values from\n            hfile.\n\n        Notes\n        -----\n        The primary use for the `load` method is to allow the input of ASCII\n        data that was edited in a standard text editor of the table data and\n        parameters.  The `dump` method can be used to create the initial ASCII\n        files.\n        \"\"\"\n\n        # Process the parameter file\n        if header is None:\n            header = Header()\n\n        if hfile:\n            if replace:\n                header = Header.fromtextfile(hfile)\n            else:\n                header.extend(Header.fromtextfile(hfile), update=True,\n                              update_first=True)\n\n        coldefs = None\n        # Process the column definitions file\n        if cdfile:\n            coldefs = cls._load_coldefs(cdfile)\n\n        # Process the data file\n        data = cls._load_data(datafile, coldefs)\n        if coldefs is None:\n            coldefs = ColDefs(data)\n\n        # Create a new HDU using the supplied header and data\n        hdu = cls(data=data, header=header)\n        hdu.columns = coldefs\n        return hdu\n\n    if isinstance(load.__doc__, str):\n        load.__doc__ += _tdump_file_format.replace('\\n', '\\n        ')\n\n    load = classmethod(load)\n    # Have to create a classmethod from this here instead of as a decorator;\n    # otherwise we can't update __doc__\n\n    def _dump_data(self, fileobj):\n        \"\"\"\n        Write the table data in the ASCII format read by BinTableHDU.load()\n        to fileobj.\n        \"\"\"\n\n        if not fileobj and self._file:\n            root = os.path.splitext(self._file.name)[0]\n            fileobj = root + '.txt'\n\n        close_file = False\n\n        if isinstance(fileobj, str):\n            fileobj = open(fileobj, 'w')\n            close_file = True\n\n        linewriter = csv.writer(fileobj, dialect=FITSTableDumpDialect)\n\n        # Process each row of the table and output one row at a time\n        def format_value(val, format):\n            if format[0] == 'S':\n                itemsize = int(format[1:])\n                return '{:{size}}'.format(val, size=itemsize)\n            elif format in np.typecodes['AllInteger']:\n                # output integer\n                return f'{val:21d}'\n            elif format in np.typecodes['Complex']:\n                return f'{val.real:21.15g}+{val.imag:.15g}j'\n            elif format in np.typecodes['Float']:\n                # output floating point\n                return f'{val:#21.15g}'\n\n        for row in self.data:\n            line = []   # the line for this row of the table\n\n            # Process each column of the row.\n            for column in self.columns:\n                # format of data in a variable length array\n                # where None means it is not a VLA:\n                vla_format = None\n                format = _convert_format(column.format)\n\n                if isinstance(format, _FormatP):\n                    # P format means this is a variable length array so output\n                    # the length of the array for this row and set the format\n                    # for the VLA data\n                    line.append('VLA_Length=')\n                    line.append(f'{len(row[column.name]):21d}')\n                    _, dtype, option = _parse_tformat(column.format)\n                    vla_format = FITS2NUMPY[option[0]][0]\n\n                if vla_format:\n                    # Output the data for each element in the array\n                    for val in row[column.name].flat:\n                        line.append(format_value(val, vla_format))\n                else:\n                    # The column data is a single element\n                    dtype = self.data.dtype.fields[column.name][0]\n                    array_format = dtype.char\n                    if array_format == 'V':\n                        array_format = dtype.base.char\n                    if array_format == 'S':\n                        array_format += str(dtype.itemsize)\n\n                    if dtype.char == 'V':\n                        for value in row[column.name].flat:\n                            line.append(format_value(value, array_format))\n                    else:\n                        line.append(format_value(row[column.name],\n                                    array_format))\n            linewriter.writerow(line)\n        if close_file:\n            fileobj.close()\n\n    def _dump_coldefs(self, fileobj):\n        \"\"\"\n        Write the column definition parameters in the ASCII format read by\n        BinTableHDU.load() to fileobj.\n        \"\"\"\n\n        close_file = False\n\n        if isinstance(fileobj, str):\n            fileobj = open(fileobj, 'w')\n            close_file = True\n\n        # Process each column of the table and output the result to the\n        # file one at a time\n        for column in self.columns:\n            line = [column.name, column.format]\n            attrs = ['disp', 'unit', 'dim', 'null', 'bscale', 'bzero']\n            line += ['{!s:16s}'.format(value if value else '\"\"')\n                     for value in (getattr(column, attr) for attr in attrs)]\n            fileobj.write(' '.join(line))\n            fileobj.write('\\n')\n\n        if close_file:\n            fileobj.close()\n\n    @classmethod\n    def _load_data(cls, fileobj, coldefs=None):\n        \"\"\"\n        Read the table data from the ASCII file output by BinTableHDU.dump().\n        \"\"\"\n\n        close_file = False\n\n        if isinstance(fileobj, str):\n            fileobj = open(fileobj, 'r')\n            close_file = True\n\n        initialpos = fileobj.tell()  # We'll be returning here later\n        linereader = csv.reader(fileobj, dialect=FITSTableDumpDialect)\n\n        # First we need to do some preprocessing on the file to find out how\n        # much memory we'll need to reserve for the table.  This is necessary\n        # even if we already have the coldefs in order to determine how many\n        # rows to reserve memory for\n        vla_lengths = []\n        recformats = []\n        names = []\n        nrows = 0\n        if coldefs is not None:\n            recformats = coldefs._recformats\n            names = coldefs.names\n\n        def update_recformats(value, idx):\n            fitsformat = _scalar_to_format(value)\n            recformat = _convert_format(fitsformat)\n            if idx >= len(recformats):\n                recformats.append(recformat)\n            else:\n                if _cmp_recformats(recformats[idx], recformat) < 0:\n                    recformats[idx] = recformat\n\n        # TODO: The handling of VLAs could probably be simplified a bit\n        for row in linereader:\n            nrows += 1\n            if coldefs is not None:\n                continue\n            col = 0\n            idx = 0\n            while idx < len(row):\n                if row[idx] == 'VLA_Length=':\n                    if col < len(vla_lengths):\n                        vla_length = vla_lengths[col]\n                    else:\n                        vla_length = int(row[idx + 1])\n                        vla_lengths.append(vla_length)\n                    idx += 2\n                    while vla_length:\n                        update_recformats(row[idx], col)\n                        vla_length -= 1\n                        idx += 1\n                    col += 1\n                else:\n                    if col >= len(vla_lengths):\n                        vla_lengths.append(None)\n                    update_recformats(row[idx], col)\n                    col += 1\n                    idx += 1\n\n        # Update the recformats for any VLAs\n        for idx, length in enumerate(vla_lengths):\n            if length is not None:\n                recformats[idx] = str(length) + recformats[idx]\n\n        dtype = np.rec.format_parser(recformats, names, None).dtype\n\n        # TODO: In the future maybe enable loading a bit at a time so that we\n        # can convert from this format to an actual FITS file on disk without\n        # needing enough physical memory to hold the entire thing at once\n        hdu = BinTableHDU.from_columns(np.recarray(shape=1, dtype=dtype),\n                                       nrows=nrows, fill=True)\n\n        # TODO: It seems to me a lot of this could/should be handled from\n        # within the FITS_rec class rather than here.\n        data = hdu.data\n        for idx, length in enumerate(vla_lengths):\n            if length is not None:\n                arr = data.columns._arrays[idx]\n                dt = recformats[idx][len(str(length)):]\n\n                # NOTE: FormatQ not supported here; it's hard to determine\n                # whether or not it will be necessary to use a wider descriptor\n                # type. The function documentation will have to serve as a\n                # warning that this is not supported.\n                recformats[idx] = _FormatP(dt, max=length)\n                data.columns._recformats[idx] = recformats[idx]\n                name = data.columns.names[idx]\n                data._cache_field(name, _makep(arr, arr, recformats[idx]))\n\n        def format_value(col, val):\n            # Special formatting for a couple particular data types\n            if recformats[col] == FITS2NUMPY['L']:\n                return bool(int(val))\n            elif recformats[col] == FITS2NUMPY['M']:\n                # For some reason, in arrays/fields where numpy expects a\n                # complex it's not happy to take a string representation\n                # (though it's happy to do that in other contexts), so we have\n                # to convert the string representation for it:\n                return complex(val)\n            else:\n                return val\n\n        # Jump back to the start of the data and create a new line reader\n        fileobj.seek(initialpos)\n        linereader = csv.reader(fileobj, dialect=FITSTableDumpDialect)\n        for row, line in enumerate(linereader):\n            col = 0\n            idx = 0\n            while idx < len(line):\n                if line[idx] == 'VLA_Length=':\n                    vla_len = vla_lengths[col]\n                    idx += 2\n                    slice_ = slice(idx, idx + vla_len)\n                    data[row][col][:] = line[idx:idx + vla_len]\n                    idx += vla_len\n                elif dtype[col].shape:\n                    # This is an array column\n                    array_size = int(np.multiply.reduce(dtype[col].shape))\n                    slice_ = slice(idx, idx + array_size)\n                    idx += array_size\n                else:\n                    slice_ = None\n\n                if slice_ is None:\n                    # This is a scalar row element\n                    data[row][col] = format_value(col, line[idx])\n                    idx += 1\n                else:\n                    data[row][col].flat[:] = [format_value(col, val)\n                                              for val in line[slice_]]\n\n                col += 1\n\n        if close_file:\n            fileobj.close()\n\n        return data\n\n    @classmethod\n    def _load_coldefs(cls, fileobj):\n        \"\"\"\n        Read the table column definitions from the ASCII file output by\n        BinTableHDU.dump().\n        \"\"\"\n\n        close_file = False\n\n        if isinstance(fileobj, str):\n            fileobj = open(fileobj, 'r')\n            close_file = True\n\n        columns = []\n\n        for line in fileobj:\n            words = line[:-1].split()\n            kwargs = {}\n            for key in ['name', 'format', 'disp', 'unit', 'dim']:\n                kwargs[key] = words.pop(0).replace('\"\"', '')\n\n            for key in ['null', 'bscale', 'bzero']:\n                word = words.pop(0).replace('\"\"', '')\n                if word:\n                    word = _str_to_num(word)\n                kwargs[key] = word\n            columns.append(Column(**kwargs))\n\n        if close_file:\n            fileobj.close()\n\n        return ColDefs(columns)"},{"className":"_TableBaseHDU","col":0,"comment":"\n    FITS table extension base HDU class.\n\n    Parameters\n    ----------\n    data : array\n        Data to be used.\n    header : `Header` instance\n        Header to be used. If the ``data`` is also specified, header keywords\n        specifically related to defining the table structure (such as the\n        \"TXXXn\" keywords like TTYPEn) will be overridden by the supplied column\n        definitions, but all other informational and data model-specific\n        keywords are kept.\n    name : str\n        Name to be populated in ``EXTNAME`` keyword.\n    uint : bool, optional\n        Set to `True` if the table contains unsigned integer columns.\n    ver : int > 0 or None, optional\n        The ver of the HDU, will be the value of the keyword ``EXTVER``.\n        If not given or None, it defaults to the value of the ``EXTVER``\n        card of the ``header`` or 1.\n        (default: None)\n    character_as_bytes : bool\n        Whether to return bytes for string columns. By default this is `False`\n        and (unicode) strings are returned, but this does not respect memory\n        mapping and loads the whole column in memory when accessed.\n    ","endLoc":705,"id":2080,"nodeType":"Class","startLoc":236,"text":"class _TableBaseHDU(ExtensionHDU, _TableLikeHDU):\n    \"\"\"\n    FITS table extension base HDU class.\n\n    Parameters\n    ----------\n    data : array\n        Data to be used.\n    header : `Header` instance\n        Header to be used. If the ``data`` is also specified, header keywords\n        specifically related to defining the table structure (such as the\n        \"TXXXn\" keywords like TTYPEn) will be overridden by the supplied column\n        definitions, but all other informational and data model-specific\n        keywords are kept.\n    name : str\n        Name to be populated in ``EXTNAME`` keyword.\n    uint : bool, optional\n        Set to `True` if the table contains unsigned integer columns.\n    ver : int > 0 or None, optional\n        The ver of the HDU, will be the value of the keyword ``EXTVER``.\n        If not given or None, it defaults to the value of the ``EXTVER``\n        card of the ``header`` or 1.\n        (default: None)\n    character_as_bytes : bool\n        Whether to return bytes for string columns. By default this is `False`\n        and (unicode) strings are returned, but this does not respect memory\n        mapping and loads the whole column in memory when accessed.\n    \"\"\"\n\n    _manages_own_heap = False\n    \"\"\"\n    This flag implies that when writing VLA tables (P/Q format) the heap\n    pointers that go into P/Q table columns should not be reordered or\n    rearranged in any way by the default heap management code.\n\n    This is included primarily as an optimization for compressed image HDUs\n    which perform their own heap maintenance.\n    \"\"\"\n\n    def __init__(self, data=None, header=None, name=None, uint=False, ver=None,\n                 character_as_bytes=False):\n\n        super().__init__(data=data, header=header, name=name, ver=ver)\n\n        self._uint = uint\n        self._character_as_bytes = character_as_bytes\n\n        if data is DELAYED:\n            # this should never happen\n            if header is None:\n                raise ValueError('No header to setup HDU.')\n\n            # if the file is read the first time, no need to copy, and keep it\n            # unchanged\n            else:\n                self._header = header\n        else:\n            # construct a list of cards of minimal header\n            cards = [\n                ('XTENSION', self._extension, self._ext_comment),\n                ('BITPIX', 8, 'array data type'),\n                ('NAXIS', 2, 'number of array dimensions'),\n                ('NAXIS1', 0, 'length of dimension 1'),\n                ('NAXIS2', 0, 'length of dimension 2'),\n                ('PCOUNT', 0, 'number of group parameters'),\n                ('GCOUNT', 1, 'number of groups'),\n                ('TFIELDS', 0, 'number of table fields')]\n\n            if header is not None:\n\n                # Make a \"copy\" (not just a view) of the input header, since it\n                # may get modified.  the data is still a \"view\" (for now)\n                hcopy = header.copy(strip=True)\n                cards.extend(hcopy.cards)\n\n            self._header = Header(cards)\n\n            if isinstance(data, np.ndarray) and data.dtype.fields is not None:\n                # self._data_type is FITS_rec.\n                if isinstance(data, self._data_type):\n                    self.data = data\n                else:\n                    self.data = self._data_type.from_columns(data)\n\n                # TEMP: Special column keywords are normally overwritten by attributes\n                # from Column objects. In Astropy 3.0, several new keywords are now\n                # recognized as being special column keywords, but we don't\n                # automatically clear them yet, as we need to raise a deprecation\n                # warning for at least one major version.\n                if header is not None:\n                    future_ignore = set()\n                    for keyword in header.keys():\n                        match = TDEF_RE.match(keyword)\n                        try:\n                            base_keyword = match.group('label')\n                        except Exception:\n                            continue                # skip if there is no match\n                        if base_keyword in {'TCTYP', 'TCUNI', 'TCRPX', 'TCRVL', 'TCDLT', 'TRPOS'}:\n                            future_ignore.add(base_keyword)\n                    if future_ignore:\n                        keys = ', '.join(x + 'n' for x in sorted(future_ignore))\n                        warnings.warn(\"The following keywords are now recognized as special \"\n                                      \"column-related attributes and should be set via the \"\n                                      \"Column objects: {}. In future, these values will be \"\n                                      \"dropped from manually specified headers automatically \"\n                                      \"and replaced with values generated based on the \"\n                                      \"Column objects.\".format(keys), AstropyDeprecationWarning)\n\n                # TODO: Too much of the code in this class uses header keywords\n                # in making calculations related to the data size.  This is\n                # unreliable, however, in cases when users mess with the header\n                # unintentionally--code that does this should be cleaned up.\n                self._header['NAXIS1'] = self.data._raw_itemsize\n                self._header['NAXIS2'] = self.data.shape[0]\n                self._header['TFIELDS'] = len(self.data._coldefs)\n\n                self.columns = self.data._coldefs\n                self.columns._add_listener(self.data)\n                self.update()\n\n                with suppress(TypeError, AttributeError):\n                    # Make the ndarrays in the Column objects of the ColDefs\n                    # object of the HDU reference the same ndarray as the HDU's\n                    # FITS_rec object.\n                    for idx, col in enumerate(self.columns):\n                        col.array = self.data.field(idx)\n\n                    # Delete the _arrays attribute so that it is recreated to\n                    # point to the new data placed in the column objects above\n                    del self.columns._arrays\n            elif data is None:\n                pass\n            else:\n                raise TypeError('Table data has incorrect type.')\n\n        # Ensure that the correct EXTNAME is set on the new header if one was\n        # created, or that it overrides the existing EXTNAME if different\n        if name:\n            self.name = name\n        if ver is not None:\n            self.ver = ver\n\n    @classmethod\n    def match_header(cls, header):\n        \"\"\"\n        This is an abstract type that implements the shared functionality of\n        the ASCII and Binary Table HDU types, which should be used instead of\n        this.\n        \"\"\"\n\n        raise NotImplementedError\n\n    @lazyproperty\n    def columns(self):\n        \"\"\"\n        The :class:`ColDefs` objects describing the columns in this table.\n        \"\"\"\n\n        if self._has_data and hasattr(self.data, '_coldefs'):\n            return self.data._coldefs\n        return self._columns_type(self)\n\n    @lazyproperty\n    def data(self):\n        data = self._get_tbdata()\n        data._coldefs = self.columns\n        data._character_as_bytes = self._character_as_bytes\n        # Columns should now just return a reference to the data._coldefs\n        del self.columns\n        return data\n\n    @data.setter\n    def data(self, data):\n        if 'data' in self.__dict__:\n            if self.__dict__['data'] is data:\n                return\n            else:\n                self._data_replaced = True\n        else:\n            self._data_replaced = True\n\n        self._modified = True\n\n        if data is None and self.columns:\n            # Create a new table with the same columns, but empty rows\n            formats = ','.join(self.columns._recformats)\n            data = np.rec.array(None, formats=formats,\n                                names=self.columns.names,\n                                shape=0)\n\n        if isinstance(data, np.ndarray) and data.dtype.fields is not None:\n            # Go ahead and always make a view, even if the data is already the\n            # correct class (self._data_type) so we can update things like the\n            # column defs, if necessary\n            data = data.view(self._data_type)\n\n            if not isinstance(data.columns, self._columns_type):\n                # This would be the place, if the input data was for an ASCII\n                # table and this is binary table, or vice versa, to convert the\n                # data to the appropriate format for the table type\n                new_columns = self._columns_type(data.columns)\n                data = FITS_rec.from_columns(new_columns)\n\n            if 'data' in self.__dict__:\n                self.columns._remove_listener(self.__dict__['data'])\n            self.__dict__['data'] = data\n\n            self.columns = self.data.columns\n            self.columns._add_listener(self.data)\n            self.update()\n\n            with suppress(TypeError, AttributeError):\n                # Make the ndarrays in the Column objects of the ColDefs\n                # object of the HDU reference the same ndarray as the HDU's\n                # FITS_rec object.\n                for idx, col in enumerate(self.columns):\n                    col.array = self.data.field(idx)\n\n                # Delete the _arrays attribute so that it is recreated to\n                # point to the new data placed in the column objects above\n                del self.columns._arrays\n        elif data is None:\n            pass\n        else:\n            raise TypeError('Table data has incorrect type.')\n\n        # returning the data signals to lazyproperty that we've already handled\n        # setting self.__dict__['data']\n        return data\n\n    @property\n    def _nrows(self):\n        if not self._data_loaded:\n            return self._header.get('NAXIS2', 0)\n        else:\n            return len(self.data)\n\n    @lazyproperty\n    def _theap(self):\n        size = self._header['NAXIS1'] * self._header['NAXIS2']\n        return self._header.get('THEAP', size)\n\n    # TODO: Need to either rename this to update_header, for symmetry with the\n    # Image HDUs, or just at some point deprecate it and remove it altogether,\n    # since header updates should occur automatically when necessary...\n    def update(self):\n        \"\"\"\n        Update header keywords to reflect recent changes of columns.\n        \"\"\"\n\n        self._header.set('NAXIS1', self.data._raw_itemsize, after='NAXIS')\n        self._header.set('NAXIS2', self.data.shape[0], after='NAXIS1')\n        self._header.set('TFIELDS', len(self.columns), after='GCOUNT')\n\n        self._clear_table_keywords()\n        self._populate_table_keywords()\n\n    def copy(self):\n        \"\"\"\n        Make a copy of the table HDU, both header and data are copied.\n        \"\"\"\n\n        # touch the data, so it's defined (in the case of reading from a\n        # FITS file)\n        return self.__class__(data=self.data.copy(),\n                              header=self._header.copy())\n\n    def _prewriteto(self, checksum=False, inplace=False):\n        if self._has_data:\n            self.data._scale_back(\n                update_heap_pointers=not self._manages_own_heap)\n            # check TFIELDS and NAXIS2\n            self._header['TFIELDS'] = len(self.data._coldefs)\n            self._header['NAXIS2'] = self.data.shape[0]\n\n            # calculate PCOUNT, for variable length tables\n            tbsize = self._header['NAXIS1'] * self._header['NAXIS2']\n            heapstart = self._header.get('THEAP', tbsize)\n            self.data._gap = heapstart - tbsize\n            pcount = self.data._heapsize + self.data._gap\n            if pcount > 0:\n                self._header['PCOUNT'] = pcount\n\n            # update the other T****n keywords\n            self._populate_table_keywords()\n\n            # update TFORM for variable length columns\n            for idx in range(self.data._nfields):\n                format = self.data._coldefs._recformats[idx]\n                if isinstance(format, _FormatP):\n                    _max = self.data.field(idx).max\n                    # May be either _FormatP or _FormatQ\n                    format_cls = format.__class__\n                    format = format_cls(format.dtype, repeat=format.repeat,\n                                        max=_max)\n                    self._header['TFORM' + str(idx + 1)] = format.tform\n        return super()._prewriteto(checksum, inplace)\n\n    def _verify(self, option='warn'):\n        \"\"\"\n        _TableBaseHDU verify method.\n        \"\"\"\n\n        errs = super()._verify(option=option)\n        if not (isinstance(self._header[0], str) and\n                self._header[0].rstrip() == self._extension):\n\n            err_text = 'The XTENSION keyword must match the HDU type.'\n            fix_text = f'Converted the XTENSION keyword to {self._extension}.'\n\n            def fix(header=self._header):\n                header[0] = (self._extension, self._ext_comment)\n\n            errs.append(self.run_option(option, err_text=err_text,\n                                        fix_text=fix_text, fix=fix))\n\n        self.req_cards('NAXIS', None, lambda v: (v == 2), 2, option, errs)\n        self.req_cards('BITPIX', None, lambda v: (v == 8), 8, option, errs)\n        self.req_cards('TFIELDS', 7,\n                       lambda v: (_is_int(v) and v >= 0 and v <= 999), 0,\n                       option, errs)\n        tfields = self._header['TFIELDS']\n        for idx in range(tfields):\n            self.req_cards('TFORM' + str(idx + 1), None, None, None, option,\n                           errs)\n        return errs\n\n    def _summary(self):\n        \"\"\"\n        Summarize the HDU: name, dimensions, and formats.\n        \"\"\"\n\n        class_name = self.__class__.__name__\n\n        # if data is touched, use data info.\n        if self._data_loaded:\n            if self.data is None:\n                nrows = 0\n            else:\n                nrows = len(self.data)\n\n            ncols = len(self.columns)\n            format = self.columns.formats\n\n        # if data is not touched yet, use header info.\n        else:\n            nrows = self._header['NAXIS2']\n            ncols = self._header['TFIELDS']\n            format = ', '.join([self._header['TFORM' + str(j + 1)]\n                                for j in range(ncols)])\n            format = f'[{format}]'\n        dims = f\"{nrows}R x {ncols}C\"\n        ncards = len(self._header)\n\n        return (self.name, self.ver, class_name, ncards, dims, format)\n\n    def _update_column_removed(self, columns, idx):\n        super()._update_column_removed(columns, idx)\n\n        # Fix the header to reflect the column removal\n        self._clear_table_keywords(index=idx)\n\n    def _update_column_attribute_changed(self, column, col_idx, attr,\n                                         old_value, new_value):\n        \"\"\"\n        Update the header when one of the column objects is updated.\n        \"\"\"\n\n        # base_keyword is the keyword without the index such as TDIM\n        # while keyword is like TDIM1\n        base_keyword = ATTRIBUTE_TO_KEYWORD[attr]\n        keyword = base_keyword + str(col_idx + 1)\n\n        if keyword in self._header:\n            if new_value is None:\n                # If the new value is None, i.e. None was assigned to the\n                # column attribute, then treat this as equivalent to deleting\n                # that attribute\n                del self._header[keyword]\n            else:\n                self._header[keyword] = new_value\n        else:\n            keyword_idx = KEYWORD_NAMES.index(base_keyword)\n            # Determine the appropriate keyword to insert this one before/after\n            # if it did not already exist in the header\n            for before_keyword in reversed(KEYWORD_NAMES[:keyword_idx]):\n                before_keyword += str(col_idx + 1)\n                if before_keyword in self._header:\n                    self._header.insert(before_keyword, (keyword, new_value),\n                                        after=True)\n                    break\n            else:\n                for after_keyword in KEYWORD_NAMES[keyword_idx + 1:]:\n                    after_keyword += str(col_idx + 1)\n                    if after_keyword in self._header:\n                        self._header.insert(after_keyword,\n                                            (keyword, new_value))\n                        break\n                else:\n                    # Just append\n                    self._header[keyword] = new_value\n\n    def _clear_table_keywords(self, index=None):\n        \"\"\"\n        Wipe out any existing table definition keywords from the header.\n\n        If specified, only clear keywords for the given table index (shifting\n        up keywords for any other columns).  The index is zero-based.\n        Otherwise keywords for all columns.\n        \"\"\"\n\n        # First collect all the table structure related keyword in the header\n        # into a single list so we can then sort them by index, which will be\n        # useful later for updating the header in a sensible order (since the\n        # header *might* not already be written in a reasonable order)\n        table_keywords = []\n\n        for idx, keyword in enumerate(self._header.keys()):\n            match = TDEF_RE.match(keyword)\n            try:\n                base_keyword = match.group('label')\n            except Exception:\n                continue                # skip if there is no match\n\n            if base_keyword in KEYWORD_TO_ATTRIBUTE:\n\n                # TEMP: For Astropy 3.0 we don't clear away the following keywords\n                # as we are first raising a deprecation warning that these will be\n                # dropped automatically if they were specified in the header. We\n                # can remove this once we are happy to break backward-compatibility\n                if base_keyword in {'TCTYP', 'TCUNI', 'TCRPX', 'TCRVL', 'TCDLT', 'TRPOS'}:\n                    continue\n\n                num = int(match.group('num')) - 1  # convert to zero-base\n                table_keywords.append((idx, match.group(0), base_keyword,\n                                       num))\n\n        # First delete\n        rev_sorted_idx_0 = sorted(table_keywords, key=operator.itemgetter(0),\n                                  reverse=True)\n        for idx, keyword, _, num in rev_sorted_idx_0:\n            if index is None or index == num:\n                del self._header[idx]\n\n        # Now shift up remaining column keywords if only one column was cleared\n        if index is not None:\n            sorted_idx_3 = sorted(table_keywords, key=operator.itemgetter(3))\n            for _, keyword, base_keyword, num in sorted_idx_3:\n                if num <= index:\n                    continue\n\n                old_card = self._header.cards[keyword]\n                new_card = (base_keyword + str(num), old_card.value,\n                            old_card.comment)\n                self._header.insert(keyword, new_card)\n                del self._header[keyword]\n\n            # Also decrement TFIELDS\n            if 'TFIELDS' in self._header:\n                self._header['TFIELDS'] -= 1\n\n    def _populate_table_keywords(self):\n        \"\"\"Populate the new table definition keywords from the header.\"\"\"\n\n        for idx, column in enumerate(self.columns):\n            for keyword, attr in KEYWORD_TO_ATTRIBUTE.items():\n                val = getattr(column, attr)\n                if val is not None:\n                    keyword = keyword + str(idx + 1)\n                    self._header[keyword] = val"},{"col":48,"endLoc":1109,"id":2081,"nodeType":"Lambda","startLoc":1109,"text":"lambda v: isinstance(v, bool)"},{"col":4,"comment":"\n        Get list of names of observatories for use with\n        `~astropy.coordinates.EarthLocation.of_site`.\n\n        .. note::\n            When this function is called, it will first attempt to\n            download site information from the astropy data server.  If it\n            cannot (i.e., an internet connection is not available), it will fall\n            back on the list included with astropy (which is a limited and dated\n            set of sites).  If you think a site should be added, issue a pull\n            request to the\n            `astropy-data repository <https://github.com/astropy/astropy-data>`_ .\n\n\n        Returns\n        -------\n        names : list of str\n            List of valid observatory names\n\n        See Also\n        --------\n        of_site : Gets the actual location object for one of the sites names\n                  this returns.\n        ","endLoc":509,"header":"@classmethod\n    def get_site_names(cls)","id":2082,"name":"get_site_names","nodeType":"Function","startLoc":483,"text":"@classmethod\n    def get_site_names(cls):\n        \"\"\"\n        Get list of names of observatories for use with\n        `~astropy.coordinates.EarthLocation.of_site`.\n\n        .. note::\n            When this function is called, it will first attempt to\n            download site information from the astropy data server.  If it\n            cannot (i.e., an internet connection is not available), it will fall\n            back on the list included with astropy (which is a limited and dated\n            set of sites).  If you think a site should be added, issue a pull\n            request to the\n            `astropy-data repository <https://github.com/astropy/astropy-data>`_ .\n\n\n        Returns\n        -------\n        names : list of str\n            List of valid observatory names\n\n        See Also\n        --------\n        of_site : Gets the actual location object for one of the sites names\n                  this returns.\n        \"\"\"\n        return cls._get_site_registry().names"},{"attributeType":"null","col":4,"comment":"null","endLoc":1024,"id":2083,"name":"_default_name","nodeType":"Attribute","startLoc":1024,"text":"_default_name"},{"col":4,"comment":"null","endLoc":376,"header":"def __init__(self, data=None, header=None, name=None, uint=False, ver=None,\n                 character_as_bytes=False)","id":2084,"name":"__init__","nodeType":"Function","startLoc":275,"text":"def __init__(self, data=None, header=None, name=None, uint=False, ver=None,\n                 character_as_bytes=False):\n\n        super().__init__(data=data, header=header, name=name, ver=ver)\n\n        self._uint = uint\n        self._character_as_bytes = character_as_bytes\n\n        if data is DELAYED:\n            # this should never happen\n            if header is None:\n                raise ValueError('No header to setup HDU.')\n\n            # if the file is read the first time, no need to copy, and keep it\n            # unchanged\n            else:\n                self._header = header\n        else:\n            # construct a list of cards of minimal header\n            cards = [\n                ('XTENSION', self._extension, self._ext_comment),\n                ('BITPIX', 8, 'array data type'),\n                ('NAXIS', 2, 'number of array dimensions'),\n                ('NAXIS1', 0, 'length of dimension 1'),\n                ('NAXIS2', 0, 'length of dimension 2'),\n                ('PCOUNT', 0, 'number of group parameters'),\n                ('GCOUNT', 1, 'number of groups'),\n                ('TFIELDS', 0, 'number of table fields')]\n\n            if header is not None:\n\n                # Make a \"copy\" (not just a view) of the input header, since it\n                # may get modified.  the data is still a \"view\" (for now)\n                hcopy = header.copy(strip=True)\n                cards.extend(hcopy.cards)\n\n            self._header = Header(cards)\n\n            if isinstance(data, np.ndarray) and data.dtype.fields is not None:\n                # self._data_type is FITS_rec.\n                if isinstance(data, self._data_type):\n                    self.data = data\n                else:\n                    self.data = self._data_type.from_columns(data)\n\n                # TEMP: Special column keywords are normally overwritten by attributes\n                # from Column objects. In Astropy 3.0, several new keywords are now\n                # recognized as being special column keywords, but we don't\n                # automatically clear them yet, as we need to raise a deprecation\n                # warning for at least one major version.\n                if header is not None:\n                    future_ignore = set()\n                    for keyword in header.keys():\n                        match = TDEF_RE.match(keyword)\n                        try:\n                            base_keyword = match.group('label')\n                        except Exception:\n                            continue                # skip if there is no match\n                        if base_keyword in {'TCTYP', 'TCUNI', 'TCRPX', 'TCRVL', 'TCDLT', 'TRPOS'}:\n                            future_ignore.add(base_keyword)\n                    if future_ignore:\n                        keys = ', '.join(x + 'n' for x in sorted(future_ignore))\n                        warnings.warn(\"The following keywords are now recognized as special \"\n                                      \"column-related attributes and should be set via the \"\n                                      \"Column objects: {}. In future, these values will be \"\n                                      \"dropped from manually specified headers automatically \"\n                                      \"and replaced with values generated based on the \"\n                                      \"Column objects.\".format(keys), AstropyDeprecationWarning)\n\n                # TODO: Too much of the code in this class uses header keywords\n                # in making calculations related to the data size.  This is\n                # unreliable, however, in cases when users mess with the header\n                # unintentionally--code that does this should be cleaned up.\n                self._header['NAXIS1'] = self.data._raw_itemsize\n                self._header['NAXIS2'] = self.data.shape[0]\n                self._header['TFIELDS'] = len(self.data._coldefs)\n\n                self.columns = self.data._coldefs\n                self.columns._add_listener(self.data)\n                self.update()\n\n                with suppress(TypeError, AttributeError):\n                    # Make the ndarrays in the Column objects of the ColDefs\n                    # object of the HDU reference the same ndarray as the HDU's\n                    # FITS_rec object.\n                    for idx, col in enumerate(self.columns):\n                        col.array = self.data.field(idx)\n\n                    # Delete the _arrays attribute so that it is recreated to\n                    # point to the new data placed in the column objects above\n                    del self.columns._arrays\n            elif data is None:\n                pass\n            else:\n                raise TypeError('Table data has incorrect type.')\n\n        # Ensure that the correct EXTNAME is set on the new header if one was\n        # created, or that it overrides the existing EXTNAME if different\n        if name:\n            self.name = name\n        if ver is not None:\n            self.ver = ver"},{"col":4,"comment":"null","endLoc":278,"header":"def __init__(self, data=None, header=None)","id":2085,"name":"__init__","nodeType":"Function","startLoc":269,"text":"def __init__(self, data=None, header=None):\n        super().__init__(data=data, header=header)\n        if data is not DELAYED:\n            self.update_header()\n\n        # Update the axes; GROUPS HDUs should always have at least one axis\n        if len(self._axes) <= 0:\n            self._axes = [0]\n            self._header['NAXIS'] = 1\n            self._header.set('NAXIS1', 0, after='NAXIS')"},{"col":4,"comment":"The default ellipsoid used to convert to geodetic coordinates.","endLoc":564,"header":"@property\n    def ellipsoid(self)","id":2086,"name":"ellipsoid","nodeType":"Function","startLoc":561,"text":"@property\n    def ellipsoid(self):\n        \"\"\"The default ellipsoid used to convert to geodetic coordinates.\"\"\"\n        return self._ellipsoid"},{"col":4,"comment":"null","endLoc":568,"header":"@ellipsoid.setter\n    def ellipsoid(self, ellipsoid)","id":2087,"name":"ellipsoid","nodeType":"Function","startLoc":566,"text":"@ellipsoid.setter\n    def ellipsoid(self, ellipsoid):\n        self._ellipsoid = _check_ellipsoid(ellipsoid)"},{"col":4,"comment":"\n        Return a copy of the table.\n\n        Parameters\n        ----------\n        copy_data : bool\n            If `True` (the default), copy the underlying data array.\n            Otherwise, use the same data array. The ``meta`` is always\n            deepcopied regardless of the value for ``copy_data``.\n        ","endLoc":3412,"header":"def copy(self, copy_data=True)","id":2088,"name":"copy","nodeType":"Function","startLoc":3395,"text":"def copy(self, copy_data=True):\n        '''\n        Return a copy of the table.\n\n        Parameters\n        ----------\n        copy_data : bool\n            If `True` (the default), copy the underlying data array.\n            Otherwise, use the same data array. The ``meta`` is always\n            deepcopied regardless of the value for ``copy_data``.\n        '''\n        out = self.__class__(self, copy=copy_data)\n\n        # If the current table is grouped then do the same in the copy\n        if hasattr(self, '_groups'):\n            out._groups = groups.TableGroups(out, indices=self._groups._indices,\n                                             keys=self._groups._keys)\n        return out"},{"col":4,"comment":"Convert to geodetic coordinates for the default ellipsoid.","endLoc":573,"header":"@property\n    def geodetic(self)","id":2089,"name":"geodetic","nodeType":"Function","startLoc":570,"text":"@property\n    def geodetic(self):\n        \"\"\"Convert to geodetic coordinates for the default ellipsoid.\"\"\"\n        return self.to_geodetic()"},{"col":4,"comment":"Convert to geodetic coordinates.\n\n        Parameters\n        ----------\n        ellipsoid : str, optional\n            Reference ellipsoid to use.  Default is the one the coordinates\n            were initialized with.  Available are: 'WGS84', 'GRS80', 'WGS72'\n\n        Returns\n        -------\n        lon, lat, height : `~astropy.units.Quantity`\n            The tuple is a ``GeodeticLocation`` namedtuple and is comprised of\n            instances of `~astropy.coordinates.Longitude`,\n            `~astropy.coordinates.Latitude`, and `~astropy.units.Quantity`.\n\n        Raises\n        ------\n        ValueError\n            if ``ellipsoid`` is not recognized as among the ones implemented.\n\n        Notes\n        -----\n        For the conversion to geodetic coordinates, the ERFA routine\n        ``gc2gd`` is used.  See https://github.com/liberfa/erfa\n        ","endLoc":607,"header":"def to_geodetic(self, ellipsoid=None)","id":2090,"name":"to_geodetic","nodeType":"Function","startLoc":575,"text":"def to_geodetic(self, ellipsoid=None):\n        \"\"\"Convert to geodetic coordinates.\n\n        Parameters\n        ----------\n        ellipsoid : str, optional\n            Reference ellipsoid to use.  Default is the one the coordinates\n            were initialized with.  Available are: 'WGS84', 'GRS80', 'WGS72'\n\n        Returns\n        -------\n        lon, lat, height : `~astropy.units.Quantity`\n            The tuple is a ``GeodeticLocation`` namedtuple and is comprised of\n            instances of `~astropy.coordinates.Longitude`,\n            `~astropy.coordinates.Latitude`, and `~astropy.units.Quantity`.\n\n        Raises\n        ------\n        ValueError\n            if ``ellipsoid`` is not recognized as among the ones implemented.\n\n        Notes\n        -----\n        For the conversion to geodetic coordinates, the ERFA routine\n        ``gc2gd`` is used.  See https://github.com/liberfa/erfa\n        \"\"\"\n        ellipsoid = _check_ellipsoid(ellipsoid, default=self.ellipsoid)\n        xyz = self.view(self._array_dtype, u.Quantity)\n        llh = CartesianRepresentation(xyz, xyz_axis=-1, copy=False).represent_as(\n                ELLIPSOIDS[ellipsoid])\n        return GeodeticLocation(\n            Longitude(llh.lon, u.deg, wrap_angle=180*u.deg, copy=False),\n            llh.lat << u.deg, llh.height << self.unit)"},{"col":4,"comment":"null","endLoc":310,"header":"def __init__(self, parent_table, indices=None, keys=None)","id":2091,"name":"__init__","nodeType":"Function","startLoc":307,"text":"def __init__(self, parent_table, indices=None, keys=None):\n        self.parent_table = parent_table  # parent Table\n        self._indices = indices\n        self._keys = keys"},{"col":4,"comment":"null","endLoc":452,"header":"def update_header(self)","id":2092,"name":"update_header","nodeType":"Function","startLoc":388,"text":"def update_header(self):\n        old_naxis = self._header.get('NAXIS', 0)\n\n        if self._data_loaded:\n            if isinstance(self.data, GroupData):\n                self._axes = list(self.data.data.shape)[1:]\n                self._axes.reverse()\n                self._axes = [0] + self._axes\n                field0 = self.data.dtype.names[0]\n                field0_code = self.data.dtype.fields[field0][0].name\n            elif self.data is None:\n                self._axes = [0]\n                field0_code = 'uint8'  # For lack of a better default\n            else:\n                raise ValueError('incorrect array type')\n\n            self._header['BITPIX'] = DTYPE2BITPIX[field0_code]\n\n        self._header['NAXIS'] = len(self._axes)\n\n        # add NAXISi if it does not exist\n        for idx, axis in enumerate(self._axes):\n            if (idx == 0):\n                after = 'NAXIS'\n            else:\n                after = 'NAXIS' + str(idx)\n\n            self._header.set('NAXIS' + str(idx + 1), axis, after=after)\n\n        # delete extra NAXISi's\n        for idx in range(len(self._axes) + 1, old_naxis + 1):\n            try:\n                del self._header['NAXIS' + str(idx)]\n            except KeyError:\n                pass\n\n        if self._has_data and isinstance(self.data, GroupData):\n            self._header.set('GROUPS', True,\n                             after='NAXIS' + str(len(self._axes)))\n            self._header.set('PCOUNT', len(self.data.parnames), after='GROUPS')\n            self._header.set('GCOUNT', len(self.data), after='PCOUNT')\n\n            column = self.data._coldefs[self._data_field]\n            scale, zero = self.data._get_scale_factors(column)[3:5]\n            if scale:\n                self._header.set('BSCALE', column.bscale)\n            if zero:\n                self._header.set('BZERO', column.bzero)\n\n            for idx, name in enumerate(self.data.parnames):\n                self._header.set('PTYPE' + str(idx + 1), name)\n                column = self.data._coldefs[idx]\n                scale, zero = self.data._get_scale_factors(column)[3:5]\n                if scale:\n                    self._header.set('PSCAL' + str(idx + 1), column.bscale)\n                if zero:\n                    self._header.set('PZERO' + str(idx + 1), column.bzero)\n\n        # Update the position of the EXTEND keyword if it already exists\n        if 'EXTEND' in self._header:\n            if len(self._axes):\n                after = 'NAXIS' + str(len(self._axes))\n            else:\n                after = 'NAXIS'\n            self._header.set('EXTEND', after=after)"},{"col":4,"comment":"\n        Return the indices associated with columns of the table\n        as a TableIndices object.\n        ","endLoc":961,"header":"@property\n    def indices(self)","id":2093,"name":"indices","nodeType":"Function","startLoc":950,"text":"@property\n    def indices(self):\n        '''\n        Return the indices associated with columns of the table\n        as a TableIndices object.\n        '''\n        lst = []\n        for column in self.columns.values():\n            for index in column.info.indices:\n                if sum([index is x for x in lst]) == 0:  # ensure uniqueness\n                    lst.append(index)\n        return TableIndices(lst)"},{"col":4,"comment":"null","endLoc":770,"header":"def __init__(self, lst)","id":2094,"name":"__init__","nodeType":"Function","startLoc":769,"text":"def __init__(self, lst):\n        super().__init__(lst)"},{"col":4,"comment":"null","endLoc":110,"header":"def __init__(self, parser)","id":2095,"name":"__init__","nodeType":"Function","startLoc":108,"text":"def __init__(self, parser):\n        self.parser = parser\n        self._lock = threading.RLock()"},{"col":4,"comment":"\n        Return a TableLoc object that can be used for retrieving\n        rows by index in a given data range. Note that both loc\n        and iloc work only with single-column indices.\n        ","endLoc":970,"header":"@property\n    def loc(self)","id":2096,"name":"loc","nodeType":"Function","startLoc":963,"text":"@property\n    def loc(self):\n        '''\n        Return a TableLoc object that can be used for retrieving\n        rows by index in a given data range. Note that both loc\n        and iloc work only with single-column indices.\n        '''\n        return TableLoc(self)"},{"col":4,"comment":"null","endLoc":1313,"header":"def __init__(self, x, y=None, z=None, unit=None, xyz_axis=None,\n                 differentials=None, copy=True)","id":2097,"name":"__init__","nodeType":"Function","startLoc":1264,"text":"def __init__(self, x, y=None, z=None, unit=None, xyz_axis=None,\n                 differentials=None, copy=True):\n\n        if y is None and z is None:\n            if isinstance(x, np.ndarray) and x.dtype.kind not in 'OV':\n                # Short-cut for 3-D array input.\n                x = u.Quantity(x, unit, copy=copy, subok=True)\n                # Keep a link to the array with all three coordinates\n                # so that we can return it quickly if needed in get_xyz.\n                self._xyz = x\n                if xyz_axis:\n                    x = np.moveaxis(x, xyz_axis, 0)\n                    self._xyz_axis = xyz_axis\n                else:\n                    self._xyz_axis = 0\n\n                self._x, self._y, self._z = x\n                self._differentials = self._validate_differentials(differentials)\n                return\n\n            elif (isinstance(x, CartesianRepresentation)\n                  and unit is None and xyz_axis is None):\n                if differentials is None:\n                    differentials = x._differentials\n\n                return super().__init__(x, differentials=differentials,\n                                        copy=copy)\n\n            else:\n                x, y, z = x\n\n        if xyz_axis is not None:\n            raise ValueError(\"xyz_axis should only be set if x, y, and z are \"\n                             \"in a single array passed in through x, \"\n                             \"i.e., y and z should not be not given.\")\n\n        if y is None or z is None:\n            raise ValueError(\"x, y, and z are required to instantiate {}\"\n                             .format(self.__class__.__name__))\n\n        if unit is not None:\n            x = u.Quantity(x, unit, copy=copy, subok=True)\n            y = u.Quantity(y, unit, copy=copy, subok=True)\n            z = u.Quantity(z, unit, copy=copy, subok=True)\n            copy = False\n\n        super().__init__(x, y, z, copy=copy, differentials=differentials)\n        if not (self._x.unit.is_equivalent(self._y.unit) and\n                self._x.unit.is_equivalent(self._z.unit)):\n            raise u.UnitsError(\"x, y, and z should have matching physical types\")"},{"col":4,"comment":"null","endLoc":314,"header":"def parse(self, angle, unit, debug=False)","id":2098,"name":"parse","nodeType":"Function","startLoc":300,"text":"def parse(self, angle, unit, debug=False):\n        try:\n            found_angle, found_unit = self._thread_local._parser.parse(\n                angle, lexer=self._thread_local._lexer, debug=debug)\n        except ValueError as e:\n            if str(e):\n                raise ValueError(f\"{str(e)} in angle {angle!r}\") from e\n            else:\n                raise ValueError(\n                    f\"Syntax error parsing angle {angle!r}\")  from e\n\n        if unit is None and found_unit is None:\n            raise u.UnitsError(\"No unit specified\")\n\n        return found_angle, found_unit"},{"col":4,"comment":"null","endLoc":814,"header":"def __init__(self, table)","id":2099,"name":"__init__","nodeType":"Function","startLoc":810,"text":"def __init__(self, table):\n        self.table = table\n        self.indices = table.indices\n        if len(self.indices) == 0:\n            raise ValueError(\"Cannot create TableLoc object with no indices\")"},{"col":4,"comment":"\n        Return a TableLocIndices object that can be used for retrieving\n        the row indices corresponding to given table index key value or values.\n        ","endLoc":978,"header":"@property\n    def loc_indices(self)","id":2100,"name":"loc_indices","nodeType":"Function","startLoc":972,"text":"@property\n    def loc_indices(self):\n        \"\"\"\n        Return a TableLocIndices object that can be used for retrieving\n        the row indices corresponding to given table index key value or values.\n        \"\"\"\n        return TableLocIndices(self)"},{"col":4,"comment":"\n        Return a TableILoc object that can be used for retrieving\n        indexed rows in the order they appear in the index.\n        ","endLoc":986,"header":"@property\n    def iloc(self)","id":2101,"name":"iloc","nodeType":"Function","startLoc":980,"text":"@property\n    def iloc(self):\n        '''\n        Return a TableILoc object that can be used for retrieving\n        indexed rows in the order they appear in the index.\n        '''\n        return TableILoc(self)"},{"col":4,"comment":"\n        Wrap the `~astropy.coordinates.Angle` object at the given ``wrap_angle``.\n\n        This method forces all the angle values to be within a contiguous\n        360 degree range so that ``wrap_angle - 360d <= angle <\n        wrap_angle``. By default a new Angle object is returned, but if the\n        ``inplace`` argument is `True` then the `~astropy.coordinates.Angle`\n        object is wrapped in place and nothing is returned.\n\n        For instance::\n\n          >>> from astropy.coordinates import Angle\n          >>> import astropy.units as u\n          >>> a = Angle([-20.0, 150.0, 350.0] * u.deg)\n\n          >>> a.wrap_at(360 * u.deg).degree  # Wrap into range 0 to 360 degrees  # doctest: +FLOAT_CMP\n          array([340., 150., 350.])\n\n          >>> a.wrap_at('180d', inplace=True)  # Wrap into range -180 to 180 degrees  # doctest: +FLOAT_CMP\n          >>> a.degree  # doctest: +FLOAT_CMP\n          array([-20., 150., -10.])\n\n        Parameters\n        ----------\n        wrap_angle : angle-like\n            Specifies a single value for the wrap angle.  This can be any\n            object that can initialize an `~astropy.coordinates.Angle` object,\n            e.g. ``'180d'``, ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.\n\n        inplace : bool\n            If `True` then wrap the object in place instead of returning\n            a new `~astropy.coordinates.Angle`\n\n        Returns\n        -------\n        out : Angle or None\n            If ``inplace is False`` (default), return new\n            `~astropy.coordinates.Angle` object with angles wrapped accordingly.\n            Otherwise wrap in place and return `None`.\n        ","endLoc":443,"header":"def wrap_at(self, wrap_angle, inplace=False)","id":2102,"name":"wrap_at","nodeType":"Function","startLoc":398,"text":"def wrap_at(self, wrap_angle, inplace=False):\n        \"\"\"\n        Wrap the `~astropy.coordinates.Angle` object at the given ``wrap_angle``.\n\n        This method forces all the angle values to be within a contiguous\n        360 degree range so that ``wrap_angle - 360d <= angle <\n        wrap_angle``. By default a new Angle object is returned, but if the\n        ``inplace`` argument is `True` then the `~astropy.coordinates.Angle`\n        object is wrapped in place and nothing is returned.\n\n        For instance::\n\n          >>> from astropy.coordinates import Angle\n          >>> import astropy.units as u\n          >>> a = Angle([-20.0, 150.0, 350.0] * u.deg)\n\n          >>> a.wrap_at(360 * u.deg).degree  # Wrap into range 0 to 360 degrees  # doctest: +FLOAT_CMP\n          array([340., 150., 350.])\n\n          >>> a.wrap_at('180d', inplace=True)  # Wrap into range -180 to 180 degrees  # doctest: +FLOAT_CMP\n          >>> a.degree  # doctest: +FLOAT_CMP\n          array([-20., 150., -10.])\n\n        Parameters\n        ----------\n        wrap_angle : angle-like\n            Specifies a single value for the wrap angle.  This can be any\n            object that can initialize an `~astropy.coordinates.Angle` object,\n            e.g. ``'180d'``, ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.\n\n        inplace : bool\n            If `True` then wrap the object in place instead of returning\n            a new `~astropy.coordinates.Angle`\n\n        Returns\n        -------\n        out : Angle or None\n            If ``inplace is False`` (default), return new\n            `~astropy.coordinates.Angle` object with angles wrapped accordingly.\n            Otherwise wrap in place and return `None`.\n        \"\"\"\n        wrap_angle = Angle(wrap_angle, copy=False)  # Convert to an Angle\n        if not inplace:\n            self = self.copy()\n        self._wrap_at(wrap_angle)\n        return None if inplace else self"},{"col":4,"comment":"null","endLoc":933,"header":"def __init__(self, table)","id":2103,"name":"__init__","nodeType":"Function","startLoc":932,"text":"def __init__(self, table):\n        super().__init__(table)"},{"col":4,"comment":"\n        Implementation that assumes ``angle`` is already validated\n        and that wrapping is inplace.\n        ","endLoc":396,"header":"def _wrap_at(self, wrap_angle)","id":2104,"name":"_wrap_at","nodeType":"Function","startLoc":372,"text":"def _wrap_at(self, wrap_angle):\n        \"\"\"\n        Implementation that assumes ``angle`` is already validated\n        and that wrapping is inplace.\n        \"\"\"\n        # Convert the wrap angle and 360 degrees to the native unit of\n        # this Angle, then do all the math on raw Numpy arrays rather\n        # than Quantity objects for speed.\n        a360 = u.degree.to(self.unit, 360.0)\n        wrap_angle = wrap_angle.to_value(self.unit)\n        wrap_angle_floor = wrap_angle - a360\n        self_angle = self.view(np.ndarray)\n        # Do the wrapping, but only if any angles need to be wrapped\n        #\n        # This invalid catch block is needed both for the floor division\n        # and for the comparisons later on (latter not really needed\n        # any more for >= 1.19 (NUMPY_LT_1_19), but former is).\n        with np.errstate(invalid='ignore'):\n            wraps = (self_angle - wrap_angle_floor) // a360\n            np.nan_to_num(wraps, copy=False)\n            if np.any(wraps != 0):\n                self_angle -= wraps*a360\n                # Rounding errors can cause problems.\n                self_angle[self_angle >= wrap_angle] -= a360\n                self_angle[self_angle < wrap_angle_floor] += a360"},{"col":4,"comment":"\n        Insert a new index among one or more columns.\n        If there are no indices, make this index the\n        primary table index.\n\n        Parameters\n        ----------\n        colnames : str or list\n            List of column names (or a single column name) to index\n        engine : type or None\n            Indexing engine class to use, from among SortedArray, BST,\n            and SCEngine. If the supplied argument is None\n            (by default), use SortedArray.\n        unique : bool\n            Whether the values of the index must be unique. Default is False.\n        ","endLoc":1021,"header":"def add_index(self, colnames, engine=None, unique=False)","id":2105,"name":"add_index","nodeType":"Function","startLoc":988,"text":"def add_index(self, colnames, engine=None, unique=False):\n        '''\n        Insert a new index among one or more columns.\n        If there are no indices, make this index the\n        primary table index.\n\n        Parameters\n        ----------\n        colnames : str or list\n            List of column names (or a single column name) to index\n        engine : type or None\n            Indexing engine class to use, from among SortedArray, BST,\n            and SCEngine. If the supplied argument is None\n            (by default), use SortedArray.\n        unique : bool\n            Whether the values of the index must be unique. Default is False.\n        '''\n        if isinstance(colnames, str):\n            colnames = (colnames,)\n        columns = self.columns[tuple(colnames)].values()\n\n        # make sure all columns support indexing\n        for col in columns:\n            if not getattr(col.info, '_supports_indexing', False):\n                raise ValueError('Cannot create an index on column \"{}\", of '\n                                 'type \"{}\"'.format(col.info.name, type(col)))\n\n        is_primary = not self.indices\n        index = Index(columns, engine=engine, unique=unique)\n        sliced_index = SlicedIndex(index, slice(0, 0, None), original=True)\n        if is_primary:\n            self.primary_key = colnames\n        for col in columns:\n            col.info.indices.append(sliced_index)"},{"col":4,"comment":"null","endLoc":565,"header":"def __new__(cls, angle, unit=None, **kwargs)","id":2106,"name":"__new__","nodeType":"Function","startLoc":559,"text":"def __new__(cls, angle, unit=None, **kwargs):\n        # Forbid creating a Lat from a Long.\n        if isinstance(angle, Longitude):\n            raise TypeError(\"A Latitude angle cannot be created from a Longitude angle\")\n        self = super().__new__(cls, angle, unit=unit, **kwargs)\n        self._validate_angles()\n        return self"},{"col":4,"comment":"\n        Update header keywords to reflect recent changes of columns.\n        ","endLoc":491,"header":"def update(self)","id":2107,"name":"update","nodeType":"Function","startLoc":481,"text":"def update(self):\n        \"\"\"\n        Update header keywords to reflect recent changes of columns.\n        \"\"\"\n\n        self._header.set('NAXIS1', self.data._raw_itemsize, after='NAXIS')\n        self._header.set('NAXIS2', self.data.shape[0], after='NAXIS1')\n        self._header.set('TFIELDS', len(self.columns), after='GCOUNT')\n\n        self._clear_table_keywords()\n        self._populate_table_keywords()"},{"col":4,"comment":"null","endLoc":284,"header":"@classmethod\n    def match_header(cls, header)","id":2108,"name":"match_header","nodeType":"Function","startLoc":280,"text":"@classmethod\n    def match_header(cls, header):\n        keyword = header.cards[0].keyword\n        return (keyword == 'SIMPLE' and 'GROUPS' in header and\n                header['GROUPS'] is True)"},{"col":4,"comment":"\n        The data of a random group FITS file will be like a binary table's\n        data.\n        ","endLoc":300,"header":"@lazyproperty\n    def data(self)","id":2109,"name":"data","nodeType":"Function","startLoc":286,"text":"@lazyproperty\n    def data(self):\n        \"\"\"\n        The data of a random group FITS file will be like a binary table's\n        data.\n        \"\"\"\n\n        if self._axes == [0]:\n            return\n\n        data = self._get_tbdata()\n        data._coldefs = self.columns\n        data.parnames = self.parnames\n        del self.columns\n        return data"},{"col":4,"comment":"The names of the group parameters as described by the header.","endLoc":309,"header":"@lazyproperty\n    def parnames(self)","id":2110,"name":"parnames","nodeType":"Function","startLoc":302,"text":"@lazyproperty\n    def parnames(self):\n        \"\"\"The names of the group parameters as described by the header.\"\"\"\n\n        pcount = self._header['PCOUNT']\n        # The FITS standard doesn't really say what to do if a parname is\n        # missing, so for now just assume that won't happen\n        return [self._header['PTYPE' + str(idx + 1)] for idx in range(pcount)]"},{"col":4,"comment":"null","endLoc":348,"header":"@lazyproperty\n    def columns(self)","id":2111,"name":"columns","nodeType":"Function","startLoc":311,"text":"@lazyproperty\n    def columns(self):\n        if self._has_data and hasattr(self.data, '_coldefs'):\n            return self.data._coldefs\n\n        format = self._bitpix2tform[self._header['BITPIX']]\n        pcount = self._header['PCOUNT']\n        parnames = []\n        bscales = []\n        bzeros = []\n\n        for idx in range(pcount):\n            bscales.append(self._header.get('PSCAL' + str(idx + 1), None))\n            bzeros.append(self._header.get('PZERO' + str(idx + 1), None))\n            parnames.append(self._header['PTYPE' + str(idx + 1)])\n\n        formats = [format] * len(parnames)\n        dim = [None] * len(parnames)\n\n        # Now create columns from collected parameters, but first add the DATA\n        # column too, to contain the group data.\n        parnames.append('DATA')\n        bscales.append(self._header.get('BSCALE'))\n        bzeros.append(self._header.get('BZEROS'))\n        data_shape = self.shape[:-1]\n        formats.append(str(int(np.prod(data_shape))) + format)\n        dim.append(data_shape)\n        parnames = _unique_parnames(parnames)\n\n        self._data_field = parnames[-1]\n\n        cols = [Column(name=name, format=fmt, bscale=bscale, bzero=bzero,\n                       dim=dim)\n                for name, fmt, bscale, bzero, dim in\n                zip(parnames, formats, bscales, bzeros, dim)]\n\n        coldefs = ColDefs(cols)\n        return coldefs"},{"col":4,"comment":"\n        Wipe out any existing table definition keywords from the header.\n\n        If specified, only clear keywords for the given table index (shifting\n        up keywords for any other columns).  The index is zero-based.\n        Otherwise keywords for all columns.\n        ","endLoc":695,"header":"def _clear_table_keywords(self, index=None)","id":2112,"name":"_clear_table_keywords","nodeType":"Function","startLoc":638,"text":"def _clear_table_keywords(self, index=None):\n        \"\"\"\n        Wipe out any existing table definition keywords from the header.\n\n        If specified, only clear keywords for the given table index (shifting\n        up keywords for any other columns).  The index is zero-based.\n        Otherwise keywords for all columns.\n        \"\"\"\n\n        # First collect all the table structure related keyword in the header\n        # into a single list so we can then sort them by index, which will be\n        # useful later for updating the header in a sensible order (since the\n        # header *might* not already be written in a reasonable order)\n        table_keywords = []\n\n        for idx, keyword in enumerate(self._header.keys()):\n            match = TDEF_RE.match(keyword)\n            try:\n                base_keyword = match.group('label')\n            except Exception:\n                continue                # skip if there is no match\n\n            if base_keyword in KEYWORD_TO_ATTRIBUTE:\n\n                # TEMP: For Astropy 3.0 we don't clear away the following keywords\n                # as we are first raising a deprecation warning that these will be\n                # dropped automatically if they were specified in the header. We\n                # can remove this once we are happy to break backward-compatibility\n                if base_keyword in {'TCTYP', 'TCUNI', 'TCRPX', 'TCRVL', 'TCDLT', 'TRPOS'}:\n                    continue\n\n                num = int(match.group('num')) - 1  # convert to zero-base\n                table_keywords.append((idx, match.group(0), base_keyword,\n                                       num))\n\n        # First delete\n        rev_sorted_idx_0 = sorted(table_keywords, key=operator.itemgetter(0),\n                                  reverse=True)\n        for idx, keyword, _, num in rev_sorted_idx_0:\n            if index is None or index == num:\n                del self._header[idx]\n\n        # Now shift up remaining column keywords if only one column was cleared\n        if index is not None:\n            sorted_idx_3 = sorted(table_keywords, key=operator.itemgetter(3))\n            for _, keyword, base_keyword, num in sorted_idx_3:\n                if num <= index:\n                    continue\n\n                old_card = self._header.cards[keyword]\n                new_card = (base_keyword + str(num), old_card.value,\n                            old_card.comment)\n                self._header.insert(keyword, new_card)\n                del self._header[keyword]\n\n            # Also decrement TFIELDS\n            if 'TFIELDS' in self._header:\n                self._header['TFIELDS'] -= 1"},{"col":4,"comment":"null","endLoc":870,"header":"def _diff(self)","id":2113,"name":"_diff","nodeType":"Function","startLoc":768,"text":"def _diff(self):\n        if self.ignore_blank_cards:\n            cardsa = [c for c in self.a.cards if str(c) != BLANK_CARD]\n            cardsb = [c for c in self.b.cards if str(c) != BLANK_CARD]\n        else:\n            cardsa = list(self.a.cards)\n            cardsb = list(self.b.cards)\n\n        # build dictionaries of keyword values and comments\n        def get_header_values_comments(cards):\n            values = {}\n            comments = {}\n            for card in cards:\n                value = card.value\n                if self.ignore_blanks and isinstance(value, str):\n                    value = value.rstrip()\n                values.setdefault(card.keyword, []).append(value)\n                comments.setdefault(card.keyword, []).append(card.comment)\n            return values, comments\n\n        valuesa, commentsa = get_header_values_comments(cardsa)\n        valuesb, commentsb = get_header_values_comments(cardsb)\n\n        # Normalize all keyword to upper-case for comparison's sake;\n        # TODO: HIERARCH keywords should be handled case-sensitively I think\n        keywordsa = {k.upper() for k in valuesa}\n        keywordsb = {k.upper() for k in valuesb}\n\n        self.common_keywords = sorted(keywordsa.intersection(keywordsb))\n        if len(cardsa) != len(cardsb):\n            self.diff_keyword_count = (len(cardsa), len(cardsb))\n\n        # Any other diff attributes should exclude ignored keywords\n        keywordsa = keywordsa.difference(self.ignore_keywords)\n        keywordsb = keywordsb.difference(self.ignore_keywords)\n        if self.ignore_keyword_patterns:\n            for pattern in self.ignore_keyword_patterns:\n                keywordsa = keywordsa.difference(fnmatch.filter(keywordsa,\n                                                                pattern))\n                keywordsb = keywordsb.difference(fnmatch.filter(keywordsb,\n                                                                pattern))\n\n        if '*' in self.ignore_keywords:\n            # Any other differences between keywords are to be ignored\n            return\n\n        left_only_keywords = sorted(keywordsa.difference(keywordsb))\n        right_only_keywords = sorted(keywordsb.difference(keywordsa))\n\n        if left_only_keywords or right_only_keywords:\n            self.diff_keywords = (left_only_keywords, right_only_keywords)\n\n        # Compare count of each common keyword\n        for keyword in self.common_keywords:\n            if keyword in self.ignore_keywords:\n                continue\n            if self.ignore_keyword_patterns:\n                skip = False\n                for pattern in self.ignore_keyword_patterns:\n                    if fnmatch.fnmatch(keyword, pattern):\n                        skip = True\n                        break\n                if skip:\n                    continue\n\n            counta = len(valuesa[keyword])\n            countb = len(valuesb[keyword])\n            if counta != countb:\n                self.diff_duplicate_keywords[keyword] = (counta, countb)\n\n            # Compare keywords' values and comments\n            for a, b in zip(valuesa[keyword], valuesb[keyword]):\n                if diff_values(a, b, rtol=self.rtol, atol=self.atol):\n                    self.diff_keyword_values[keyword].append((a, b))\n                else:\n                    # If there are duplicate keywords we need to be able to\n                    # index each duplicate; if the values of a duplicate\n                    # are identical use None here\n                    self.diff_keyword_values[keyword].append(None)\n\n            if not any(self.diff_keyword_values[keyword]):\n                # No differences found; delete the array of Nones\n                del self.diff_keyword_values[keyword]\n\n            if '*' in self.ignore_comments or keyword in self.ignore_comments:\n                continue\n            if self.ignore_comment_patterns:\n                skip = False\n                for pattern in self.ignore_comment_patterns:\n                    if fnmatch.fnmatch(keyword, pattern):\n                        skip = True\n                        break\n                if skip:\n                    continue\n\n            for a, b in zip(commentsa[keyword], commentsb[keyword]):\n                if diff_values(a, b):\n                    self.diff_keyword_comments[keyword].append((a, b))\n                else:\n                    self.diff_keyword_comments[keyword].append(None)\n\n            if not any(self.diff_keyword_comments[keyword]):\n                del self.diff_keyword_comments[keyword]"},{"col":4,"comment":"Populate the new table definition keywords from the header.","endLoc":705,"header":"def _populate_table_keywords(self)","id":2114,"name":"_populate_table_keywords","nodeType":"Function","startLoc":697,"text":"def _populate_table_keywords(self):\n        \"\"\"Populate the new table definition keywords from the header.\"\"\"\n\n        for idx, column in enumerate(self.columns):\n            for keyword, attr in KEYWORD_TO_ATTRIBUTE.items():\n                val = getattr(column, attr)\n                if val is not None:\n                    keyword = keyword + str(idx + 1)\n                    self._header[keyword] = val"},{"col":4,"comment":"null","endLoc":118,"header":"def __init__(self, columns, engine=None, unique=False)","id":2115,"name":"__init__","nodeType":"Function","startLoc":66,"text":"def __init__(self, columns, engine=None, unique=False):\n        # Local imports to avoid import problems.\n        from .table import Table, Column\n        from astropy.time import Time\n\n        if columns is not None:\n            columns = list(columns)\n\n        if engine is not None and not isinstance(engine, type):\n            # create from data\n            self.engine = engine.__class__\n            self.data = engine\n            self.columns = columns\n            return\n\n        # by default, use SortedArray\n        self.engine = engine or SortedArray\n\n        if columns is None:  # this creates a special exception for deep copying\n            columns = []\n            data = []\n            row_index = []\n        elif len(columns) == 0:\n            raise ValueError(\"Cannot create index without at least one column\")\n        elif len(columns) == 1:\n            col = columns[0]\n            row_index = Column(col.argsort())\n            data = Table([col[row_index]])\n        else:\n            num_rows = len(columns[0])\n\n            # replace Time columns with approximate form and remainder\n            new_columns = []\n            for col in columns:\n                if isinstance(col, Time):\n                    new_columns.append(col.jd)\n                    remainder = col - col.__class__(col.jd, format='jd', scale=col.scale)\n                    new_columns.append(remainder.jd)\n                else:\n                    new_columns.append(col)\n\n            # sort the table lexicographically and keep row numbers\n            table = Table(columns + [np.arange(num_rows)], copy_indices=False)\n            sort_columns = new_columns[::-1]\n            try:\n                lines = table[np.lexsort(sort_columns)]\n            except TypeError:  # arbitrary mixins might not work with lexsort\n                lines = table[table.argsort()]\n            data = lines[lines.colnames[:-1]]\n            row_index = lines[lines.colnames[-1]]\n\n        self.data = self.engine(data, row_index, unique=unique)\n        self.columns = columns"},{"col":4,"comment":"\n        This is an abstract type that implements the shared functionality of\n        the ASCII and Binary Table HDU types, which should be used instead of\n        this.\n        ","endLoc":386,"header":"@classmethod\n    def match_header(cls, header)","id":2116,"name":"match_header","nodeType":"Function","startLoc":378,"text":"@classmethod\n    def match_header(cls, header):\n        \"\"\"\n        This is an abstract type that implements the shared functionality of\n        the ASCII and Binary Table HDU types, which should be used instead of\n        this.\n        \"\"\"\n\n        raise NotImplementedError"},{"col":4,"comment":"\n        The :class:`ColDefs` objects describing the columns in this table.\n        ","endLoc":396,"header":"@lazyproperty\n    def columns(self)","id":2117,"name":"columns","nodeType":"Function","startLoc":388,"text":"@lazyproperty\n    def columns(self):\n        \"\"\"\n        The :class:`ColDefs` objects describing the columns in this table.\n        \"\"\"\n\n        if self._has_data and hasattr(self.data, '_coldefs'):\n            return self.data._coldefs\n        return self._columns_type(self)"},{"col":4,"comment":"null","endLoc":405,"header":"@lazyproperty\n    def data(self)","id":2118,"name":"data","nodeType":"Function","startLoc":398,"text":"@lazyproperty\n    def data(self):\n        data = self._get_tbdata()\n        data._coldefs = self.columns\n        data._character_as_bytes = self._character_as_bytes\n        # Columns should now just return a reference to the data._coldefs\n        del self.columns\n        return data"},{"col":4,"comment":"null","endLoc":464,"header":"@data.setter\n    def data(self, data)","id":2119,"name":"data","nodeType":"Function","startLoc":407,"text":"@data.setter\n    def data(self, data):\n        if 'data' in self.__dict__:\n            if self.__dict__['data'] is data:\n                return\n            else:\n                self._data_replaced = True\n        else:\n            self._data_replaced = True\n\n        self._modified = True\n\n        if data is None and self.columns:\n            # Create a new table with the same columns, but empty rows\n            formats = ','.join(self.columns._recformats)\n            data = np.rec.array(None, formats=formats,\n                                names=self.columns.names,\n                                shape=0)\n\n        if isinstance(data, np.ndarray) and data.dtype.fields is not None:\n            # Go ahead and always make a view, even if the data is already the\n            # correct class (self._data_type) so we can update things like the\n            # column defs, if necessary\n            data = data.view(self._data_type)\n\n            if not isinstance(data.columns, self._columns_type):\n                # This would be the place, if the input data was for an ASCII\n                # table and this is binary table, or vice versa, to convert the\n                # data to the appropriate format for the table type\n                new_columns = self._columns_type(data.columns)\n                data = FITS_rec.from_columns(new_columns)\n\n            if 'data' in self.__dict__:\n                self.columns._remove_listener(self.__dict__['data'])\n            self.__dict__['data'] = data\n\n            self.columns = self.data.columns\n            self.columns._add_listener(self.data)\n            self.update()\n\n            with suppress(TypeError, AttributeError):\n                # Make the ndarrays in the Column objects of the ColDefs\n                # object of the HDU reference the same ndarray as the HDU's\n                # FITS_rec object.\n                for idx, col in enumerate(self.columns):\n                    col.array = self.data.field(idx)\n\n                # Delete the _arrays attribute so that it is recreated to\n                # point to the new data placed in the column objects above\n                del self.columns._arrays\n        elif data is None:\n            pass\n        else:\n            raise TypeError('Table data has incorrect type.')\n\n        # returning the data signals to lazyproperty that we've already handled\n        # setting self.__dict__['data']\n        return data"},{"col":4,"comment":"null","endLoc":471,"header":"@property\n    def _nrows(self)","id":2120,"name":"_nrows","nodeType":"Function","startLoc":466,"text":"@property\n    def _nrows(self):\n        if not self._data_loaded:\n            return self._header.get('NAXIS2', 0)\n        else:\n            return len(self.data)"},{"col":4,"comment":"null","endLoc":476,"header":"@lazyproperty\n    def _theap(self)","id":2121,"name":"_theap","nodeType":"Function","startLoc":473,"text":"@lazyproperty\n    def _theap(self):\n        size = self._header['NAXIS1'] * self._header['NAXIS2']\n        return self._header.get('THEAP', size)"},{"col":4,"comment":"\n        Make a copy of the table HDU, both header and data are copied.\n        ","endLoc":501,"header":"def copy(self)","id":2123,"name":"copy","nodeType":"Function","startLoc":493,"text":"def copy(self):\n        \"\"\"\n        Make a copy of the table HDU, both header and data are copied.\n        \"\"\"\n\n        # touch the data, so it's defined (in the case of reading from a\n        # FITS file)\n        return self.__class__(data=self.data.copy(),\n                              header=self._header.copy())"},{"col":4,"comment":"null","endLoc":532,"header":"def _prewriteto(self, checksum=False, inplace=False)","id":2124,"name":"_prewriteto","nodeType":"Function","startLoc":503,"text":"def _prewriteto(self, checksum=False, inplace=False):\n        if self._has_data:\n            self.data._scale_back(\n                update_heap_pointers=not self._manages_own_heap)\n            # check TFIELDS and NAXIS2\n            self._header['TFIELDS'] = len(self.data._coldefs)\n            self._header['NAXIS2'] = self.data.shape[0]\n\n            # calculate PCOUNT, for variable length tables\n            tbsize = self._header['NAXIS1'] * self._header['NAXIS2']\n            heapstart = self._header.get('THEAP', tbsize)\n            self.data._gap = heapstart - tbsize\n            pcount = self.data._heapsize + self.data._gap\n            if pcount > 0:\n                self._header['PCOUNT'] = pcount\n\n            # update the other T****n keywords\n            self._populate_table_keywords()\n\n            # update TFORM for variable length columns\n            for idx in range(self.data._nfields):\n                format = self.data._coldefs._recformats[idx]\n                if isinstance(format, _FormatP):\n                    _max = self.data.field(idx).max\n                    # May be either _FormatP or _FormatQ\n                    format_cls = format.__class__\n                    format = format_cls(format.dtype, repeat=format.repeat,\n                                        max=_max)\n                    self._header['TFORM' + str(idx + 1)] = format.tform\n        return super()._prewriteto(checksum, inplace)"},{"col":4,"comment":"null","endLoc":357,"header":"@property\n    def _nrows(self)","id":2125,"name":"_nrows","nodeType":"Function","startLoc":350,"text":"@property\n    def _nrows(self):\n        if not self._data_loaded:\n            # The number of 'groups' equates to the number of rows in the table\n            # representation of the data\n            return self._header.get('GCOUNT', 0)\n        else:\n            return len(self.data)"},{"col":4,"comment":"null","endLoc":1080,"header":"def __new__(cls, data=None, name=None,\n                dtype=None, shape=(), length=0,\n                description=None, unit=None, format=None, meta=None,\n                copy=False, copy_indices=True)","id":2126,"name":"__new__","nodeType":"Function","startLoc":1068,"text":"def __new__(cls, data=None, name=None,\n                dtype=None, shape=(), length=0,\n                description=None, unit=None, format=None, meta=None,\n                copy=False, copy_indices=True):\n\n        if isinstance(data, MaskedColumn) and np.any(data.mask):\n            raise TypeError(\"Cannot convert a MaskedColumn with masked value to a Column\")\n\n        self = super().__new__(\n            cls, data=data, name=name, dtype=dtype, shape=shape, length=length,\n            description=description, unit=unit, format=format, meta=meta,\n            copy=copy, copy_indices=copy_indices)\n        return self"},{"col":4,"comment":"null","endLoc":362,"header":"@lazyproperty\n    def _theap(self)","id":2127,"name":"_theap","nodeType":"Function","startLoc":359,"text":"@lazyproperty\n    def _theap(self):\n        # Only really a lazyproperty for symmetry with _TableBaseHDU\n        return 0"},{"col":4,"comment":"null","endLoc":366,"header":"@property\n    def is_image(self)","id":2128,"name":"is_image","nodeType":"Function","startLoc":364,"text":"@property\n    def is_image(self):\n        return False"},{"col":4,"comment":"\n        Returns the size (in bytes) of the HDU's data part.\n        ","endLoc":386,"header":"@property\n    def size(self)","id":2129,"name":"size","nodeType":"Function","startLoc":368,"text":"@property\n    def size(self):\n        \"\"\"\n        Returns the size (in bytes) of the HDU's data part.\n        \"\"\"\n\n        size = 0\n        naxis = self._header.get('NAXIS', 0)\n\n        # for random group image, NAXIS1 should be 0, so we skip NAXIS1.\n        if naxis > 1:\n            size = 1\n            for idx in range(1, naxis):\n                size = size * self._header['NAXIS' + str(idx + 1)]\n            bitpix = self._header['BITPIX']\n            gcount = self._header.get('GCOUNT', 1)\n            pcount = self._header.get('PCOUNT', 0)\n            size = abs(bitpix) * gcount * (pcount + size) // 8\n        return size"},{"col":4,"comment":"\n        Basically copy/pasted from `_ImageBaseHDU._writedata_internal()`, but\n        we have to get the data's byte order a different way...\n\n        TODO: Might be nice to store some indication of the data's byte order\n        as an attribute or function so that we don't have to do this.\n        ","endLoc":502,"header":"def _writedata_internal(self, fileobj)","id":2130,"name":"_writedata_internal","nodeType":"Function","startLoc":454,"text":"def _writedata_internal(self, fileobj):\n        \"\"\"\n        Basically copy/pasted from `_ImageBaseHDU._writedata_internal()`, but\n        we have to get the data's byte order a different way...\n\n        TODO: Might be nice to store some indication of the data's byte order\n        as an attribute or function so that we don't have to do this.\n        \"\"\"\n\n        size = 0\n\n        if self.data is not None:\n            self.data._scale_back()\n\n            # Based on the system type, determine the byteorders that\n            # would need to be swapped to get to big-endian output\n            if sys.byteorder == 'little':\n                swap_types = ('<', '=')\n            else:\n                swap_types = ('<',)\n            # deal with unsigned integer 16, 32 and 64 data\n            if _is_pseudo_integer(self.data.dtype):\n                # Convert the unsigned array to signed\n                output = np.array(\n                    self.data - _pseudo_zero(self.data.dtype),\n                    dtype=f'>i{self.data.dtype.itemsize}')\n                should_swap = False\n            else:\n                output = self.data\n                fname = self.data.dtype.names[0]\n                byteorder = self.data.dtype.fields[fname][0].str[0]\n                should_swap = (byteorder in swap_types)\n\n            if should_swap:\n                if output.flags.writeable:\n                    output.byteswap(True)\n                    try:\n                        fileobj.writearray(output)\n                    finally:\n                        output.byteswap(True)\n                else:\n                    # For read-only arrays, there is no way around making\n                    # a byteswapped copy of the data.\n                    fileobj.writearray(output.byteswap(False))\n            else:\n                fileobj.writearray(output)\n\n            size += output.size * output.itemsize\n        return size"},{"col":4,"comment":"\n        _TableBaseHDU verify method.\n        ","endLoc":561,"header":"def _verify(self, option='warn')","id":2131,"name":"_verify","nodeType":"Function","startLoc":534,"text":"def _verify(self, option='warn'):\n        \"\"\"\n        _TableBaseHDU verify method.\n        \"\"\"\n\n        errs = super()._verify(option=option)\n        if not (isinstance(self._header[0], str) and\n                self._header[0].rstrip() == self._extension):\n\n            err_text = 'The XTENSION keyword must match the HDU type.'\n            fix_text = f'Converted the XTENSION keyword to {self._extension}.'\n\n            def fix(header=self._header):\n                header[0] = (self._extension, self._ext_comment)\n\n            errs.append(self.run_option(option, err_text=err_text,\n                                        fix_text=fix_text, fix=fix))\n\n        self.req_cards('NAXIS', None, lambda v: (v == 2), 2, option, errs)\n        self.req_cards('BITPIX', None, lambda v: (v == 8), 8, option, errs)\n        self.req_cards('TFIELDS', 7,\n                       lambda v: (_is_int(v) and v >= 0 and v <= 999), 0,\n                       option, errs)\n        tfields = self._header['TFIELDS']\n        for idx in range(tfields):\n            self.req_cards('TFORM' + str(idx + 1), None, None, None, option,\n                           errs)\n        return errs"},{"col":4,"comment":"null","endLoc":521,"header":"def _verify(self, option='warn')","id":2132,"name":"_verify","nodeType":"Function","startLoc":504,"text":"def _verify(self, option='warn'):\n        errs = super()._verify(option=option)\n\n        # Verify locations and values of mandatory keywords.\n        self.req_cards('NAXIS', 2,\n                       lambda v: (_is_int(v) and 1 <= v <= 999), 1,\n                       option, errs)\n        self.req_cards('NAXIS1', 3, lambda v: (_is_int(v) and v == 0), 0,\n                       option, errs)\n\n        after = self._header['NAXIS'] + 3\n        pos = lambda x: x >= after\n\n        self.req_cards('GCOUNT', pos, _is_int, 1, option, errs)\n        self.req_cards('PCOUNT', pos, _is_int, 0, option, errs)\n        self.req_cards('GROUPS', pos, lambda v: (v is True), True, option,\n                       errs)\n        return errs"},{"col":23,"endLoc":509,"id":2133,"nodeType":"Lambda","startLoc":509,"text":"lambda v: (_is_int(v) and 1 <= v <= 999)"},{"col":4,"comment":"null","endLoc":1546,"header":"def __init__(self, val, val2=None, format=None, scale=None,\n                 precision=None, in_subfmt=None, out_subfmt=None,\n                 location=None, copy=False)","id":2134,"name":"__init__","nodeType":"Function","startLoc":1503,"text":"def __init__(self, val, val2=None, format=None, scale=None,\n                 precision=None, in_subfmt=None, out_subfmt=None,\n                 location=None, copy=False):\n\n        if location is not None:\n            from astropy.coordinates import EarthLocation\n            if isinstance(location, EarthLocation):\n                self.location = location\n            else:\n                self.location = EarthLocation(*location)\n            if self.location.size == 1:\n                self.location = self.location.squeeze()\n        else:\n            if not hasattr(self, 'location'):\n                self.location = None\n\n        if isinstance(val, Time):\n            # Update _time formatting parameters if explicitly specified\n            if precision is not None:\n                self._time.precision = precision\n            if in_subfmt is not None:\n                self._time.in_subfmt = in_subfmt\n            if out_subfmt is not None:\n                self._time.out_subfmt = out_subfmt\n            self.SCALES = TIME_TYPES[self.scale]\n            if scale is not None:\n                self._set_scale(scale)\n        else:\n            self._init_from_vals(val, val2, format, scale, copy,\n                                 precision, in_subfmt, out_subfmt)\n            self.SCALES = TIME_TYPES[self.scale]\n\n        if self.location is not None and (self.location.size > 1\n                                          and self.location.shape != self.shape):\n            try:\n                # check the location can be broadcast to self's shape.\n                self.location = np.broadcast_to(self.location, self.shape,\n                                                subok=True)\n            except Exception as err:\n                raise ValueError('The location with shape {} cannot be '\n                                 'broadcast against time with shape {}. '\n                                 'Typically, either give a single location or '\n                                 'one for each time.'\n                                 .format(self.location.shape, self.shape)) from err"},{"col":36,"endLoc":511,"id":2135,"nodeType":"Lambda","startLoc":511,"text":"lambda v: (_is_int(v) and v == 0)"},{"col":14,"endLoc":515,"id":2136,"nodeType":"Lambda","startLoc":515,"text":"lambda x: x >= after"},{"col":38,"endLoc":519,"id":2137,"nodeType":"Lambda","startLoc":519,"text":"lambda v: (v is True)"},{"col":4,"comment":"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        ","endLoc":570,"header":"def _calculate_datasum(self)","id":2138,"name":"_calculate_datasum","nodeType":"Function","startLoc":523,"text":"def _calculate_datasum(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        \"\"\"\n\n        if self._has_data:\n\n            # We have the data to be used.\n\n            # Check the byte order of the data.  If it is little endian we\n            # must swap it before calculating the datasum.\n            # TODO: Maybe check this on a per-field basis instead of assuming\n            # that all fields have the same byte order?\n            byteorder = \\\n                self.data.dtype.fields[self.data.dtype.names[0]][0].str[0]\n\n            if byteorder != '>':\n                if self.data.flags.writeable:\n                    byteswapped = True\n                    d = self.data.byteswap(True)\n                    d.dtype = d.dtype.newbyteorder('>')\n                else:\n                    # If the data is not writeable, we just make a byteswapped\n                    # copy and don't bother changing it back after\n                    d = self.data.byteswap(False)\n                    d.dtype = d.dtype.newbyteorder('>')\n                    byteswapped = False\n            else:\n                byteswapped = False\n                d = self.data\n\n            byte_data = d.view(type=np.ndarray, dtype=np.ubyte)\n\n            cs = self._compute_checksum(byte_data)\n\n            # If the data was byteswapped in this method then return it to\n            # its original little-endian order.\n            if byteswapped:\n                d.byteswap(True)\n                d.dtype = d.dtype.newbyteorder('<')\n\n            return cs\n        else:\n            # This is the case where the data has not been read from the file\n            # yet.  We can handle that in a generic manner so we do it in the\n            # base class.  The other possibility is that there is no data at\n            # all.  This can also be handled in a generic manner.\n            return super()._calculate_datasum()"},{"col":38,"endLoc":552,"id":2139,"nodeType":"Lambda","startLoc":552,"text":"lambda v: (v == 2)"},{"col":4,"comment":"null","endLoc":586,"header":"def _summary(self)","id":2140,"name":"_summary","nodeType":"Function","startLoc":572,"text":"def _summary(self):\n        summary = super()._summary()\n        name, ver, classname, length, shape, format, gcount = summary\n\n        # Drop the first axis from the shape\n        if shape:\n            shape = shape[1:]\n\n            if shape and all(shape):\n                # Update the format\n                format = self.columns[0].dtype.name\n\n        # Update the GCOUNT report\n        gcount = f'{self._gcount} Groups  {self._pcount} Parameters'\n        return (name, ver, classname, length, shape, format, gcount)"},{"col":39,"endLoc":553,"id":2141,"nodeType":"Lambda","startLoc":553,"text":"lambda v: (v == 8)"},{"attributeType":"null","col":4,"comment":"null","endLoc":260,"id":2142,"name":"_bitpix2tform","nodeType":"Attribute","startLoc":260,"text":"_bitpix2tform"},{"attributeType":"null","col":4,"comment":"null","endLoc":261,"id":2143,"name":"_data_type","nodeType":"Attribute","startLoc":261,"text":"_data_type"},{"attributeType":"null","col":4,"comment":"\n    The name of the table record array field that will contain the group data\n    for each group; 'DATA' by default, but may be preceded by any number of\n    underscores if 'DATA' is already a parameter name\n    ","endLoc":262,"id":2144,"name":"_data_field","nodeType":"Attribute","startLoc":262,"text":"_data_field"},{"attributeType":"null","col":8,"comment":"null","endLoc":340,"id":2145,"name":"_data_field","nodeType":"Attribute","startLoc":340,"text":"self._data_field"},{"col":4,"comment":"null","endLoc":447,"header":"def __new__(cls, data=None, name=None,\n                dtype=None, shape=(), length=0,\n                description=None, unit=None, format=None, meta=None,\n                copy=False, copy_indices=True)","id":2146,"name":"__new__","nodeType":"Function","startLoc":394,"text":"def __new__(cls, data=None, name=None,\n                dtype=None, shape=(), length=0,\n                description=None, unit=None, format=None, meta=None,\n                copy=False, copy_indices=True):\n        if data is None:\n            self_data = np.zeros((length,)+shape, dtype=dtype)\n        elif isinstance(data, BaseColumn) and hasattr(data, '_name'):\n            # When unpickling a MaskedColumn, ``data`` will be a bare\n            # BaseColumn with none of the expected attributes.  In this case\n            # do NOT execute this block which initializes from ``data``\n            # attributes.\n            self_data = np.array(data.data, dtype=dtype, copy=copy)\n            if description is None:\n                description = data.description\n            if unit is None:\n                unit = unit or data.unit\n            if format is None:\n                format = data.format\n            if meta is None:\n                meta = data.meta\n            if name is None:\n                name = data.name\n        elif isinstance(data, Quantity):\n            if unit is None:\n                self_data = np.array(data, dtype=dtype, copy=copy)\n                unit = data.unit\n            else:\n                self_data = Quantity(data, unit, dtype=dtype, copy=copy).value\n            # If 'info' has been defined, copy basic properties (if needed).\n            if 'info' in data.__dict__:\n                if description is None:\n                    description = data.info.description\n                if format is None:\n                    format = data.info.format\n                if meta is None:\n                    meta = data.info.meta\n\n        else:\n            if np.dtype(dtype).char == 'S':\n                data = cls._encode_str(data)\n            self_data = np.array(data, dtype=dtype, copy=copy)\n\n        self = self_data.view(cls)\n        self._name = None if name is None else str(name)\n        self._parent_table = None\n        self.unit = unit\n        self._format = format\n        self.description = description\n        self.meta = meta\n        self.indices = deepcopy(getattr(data, 'indices', [])) if copy_indices else []\n        for index in self.indices:\n            index.replace_col(data, self)\n\n        return self"},{"attributeType":"null","col":12,"comment":"null","endLoc":276,"id":2147,"name":"_axes","nodeType":"Attribute","startLoc":276,"text":"self._axes"},{"col":4,"comment":"\n        Validate that the provided differentials are appropriate for this\n        representation and recast/reshape as necessary and then return.\n\n        Note that this does *not* set the differentials on\n        ``self._differentials``, but rather leaves that for the caller.\n        ","endLoc":735,"header":"def _validate_differentials(self, differentials)","id":2148,"name":"_validate_differentials","nodeType":"Function","startLoc":676,"text":"def _validate_differentials(self, differentials):\n        \"\"\"\n        Validate that the provided differentials are appropriate for this\n        representation and recast/reshape as necessary and then return.\n\n        Note that this does *not* set the differentials on\n        ``self._differentials``, but rather leaves that for the caller.\n        \"\"\"\n\n        # Now handle the actual validation of any specified differential classes\n        if differentials is None:\n            differentials = dict()\n\n        elif isinstance(differentials, BaseDifferential):\n            # We can't handle auto-determining the key for this combo\n            if (isinstance(differentials, RadialDifferential) and\n                    isinstance(self, UnitSphericalRepresentation)):\n                raise ValueError(\"To attach a RadialDifferential to a \"\n                                 \"UnitSphericalRepresentation, you must supply \"\n                                 \"a dictionary with an appropriate key.\")\n\n            key = differentials._get_deriv_key(self)\n            differentials = {key: differentials}\n\n        for key in differentials:\n            try:\n                diff = differentials[key]\n            except TypeError as err:\n                raise TypeError(\"'differentials' argument must be a \"\n                                \"dictionary-like object\") from err\n\n            diff._check_base(self)\n\n            if (isinstance(diff, RadialDifferential) and\n                    isinstance(self, UnitSphericalRepresentation)):\n                # We trust the passing of a key for a RadialDifferential\n                # attached to a UnitSphericalRepresentation because it will not\n                # have a paired component name (UnitSphericalRepresentation has\n                # no .distance) to automatically determine the expected key\n                pass\n\n            else:\n                expected_key = diff._get_deriv_key(self)\n                if key != expected_key:\n                    raise ValueError(\"For differential object '{}', expected \"\n                                     \"unit key = '{}' but received key = '{}'\"\n                                     .format(repr(diff), expected_key, key))\n\n            # For now, we are very rigid: differentials must have the same shape\n            # as the representation. This makes it easier to handle __getitem__\n            # and any other shape-changing operations on representations that\n            # have associated differentials\n            if diff.shape != self.shape:\n                # TODO: message of IncompatibleShapeError is not customizable,\n                #       so use a valueerror instead?\n                raise ValueError(\"Shape of differentials must be the same \"\n                                 \"as the shape of the representation ({} vs \"\n                                 \"{})\".format(diff.shape, self.shape))\n\n        return differentials"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":2149,"name":"__all__","nodeType":"Attribute","startLoc":31,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":34,"id":2150,"name":"FITS_SIGNATURE","nodeType":"Attribute","startLoc":34,"text":"FITS_SIGNATURE"},{"col":23,"endLoc":555,"id":2151,"nodeType":"Lambda","startLoc":555,"text":"lambda v: (_is_int(v) and v >= 0 and v <= 999)"},{"col":0,"comment":"","endLoc":3,"header":"hdulist.py#<anonymous>","id":2152,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"if HAS_BZ2:\n    import bz2\n\n__all__ = [\"HDUList\", \"fitsopen\"]\n\nFITS_SIGNATURE = b'SIMPLE  =                    T'"},{"fileName":"nonstandard.py","filePath":"astropy/io/fits/hdu","id":2153,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport gzip\nimport io\n\nfrom astropy.io.fits.file import _File\nfrom .base import NonstandardExtHDU\nfrom .hdulist import HDUList\nfrom astropy.io.fits.header import Header, _pad_length\nfrom astropy.io.fits.util import fileobj_name\n\nfrom astropy.utils import lazyproperty\n\n\nclass FitsHDU(NonstandardExtHDU):\n    \"\"\"\n    A non-standard extension HDU for encapsulating entire FITS files within a\n    single HDU of a container FITS file.  These HDUs have an extension (that is\n    an XTENSION keyword) of FITS.\n\n    The FITS file contained in the HDU's data can be accessed by the `hdulist`\n    attribute which returns the contained FITS file as an `HDUList` object.\n    \"\"\"\n\n    _extension = 'FITS'\n\n    @lazyproperty\n    def hdulist(self):\n        self._file.seek(self._data_offset)\n        fileobj = io.BytesIO()\n        # Read the data into a BytesIO--reading directly from the file\n        # won't work (at least for gzipped files) due to problems deep\n        # within the gzip module that make it difficult to read gzip files\n        # embedded in another file\n        fileobj.write(self._file.read(self.size))\n        fileobj.seek(0)\n        if self._header['COMPRESS']:\n            fileobj = gzip.GzipFile(fileobj=fileobj)\n        return HDUList.fromfile(fileobj, mode='readonly')\n\n    @classmethod\n    def fromfile(cls, filename, compress=False):\n        \"\"\"\n        Like `FitsHDU.fromhdulist()`, but creates a FitsHDU from a file on\n        disk.\n\n        Parameters\n        ----------\n        filename : str\n            The path to the file to read into a FitsHDU\n        compress : bool, optional\n            Gzip compress the FITS file\n        \"\"\"\n\n        with HDUList.fromfile(filename) as hdulist:\n            return cls.fromhdulist(hdulist, compress=compress)\n\n    @classmethod\n    def fromhdulist(cls, hdulist, compress=False):\n        \"\"\"\n        Creates a new FitsHDU from a given HDUList object.\n\n        Parameters\n        ----------\n        hdulist : HDUList\n            A valid Headerlet object.\n        compress : bool, optional\n            Gzip compress the FITS file\n        \"\"\"\n\n        fileobj = bs = io.BytesIO()\n        if compress:\n            if hasattr(hdulist, '_file'):\n                name = fileobj_name(hdulist._file)\n            else:\n                name = None\n            fileobj = gzip.GzipFile(name, mode='wb', fileobj=bs)\n\n        hdulist.writeto(fileobj)\n\n        if compress:\n            fileobj.close()\n\n        # A proper HDUList should still be padded out to a multiple of 2880\n        # technically speaking\n        padding = (_pad_length(bs.tell()) * cls._padding_byte).encode('ascii')\n        bs.write(padding)\n\n        bs.seek(0)\n\n        cards = [\n            ('XTENSION', cls._extension, 'FITS extension'),\n            ('BITPIX', 8, 'array data type'),\n            ('NAXIS', 1, 'number of array dimensions'),\n            ('NAXIS1', len(bs.getvalue()), 'Axis length'),\n            ('PCOUNT', 0, 'number of parameters'),\n            ('GCOUNT', 1, 'number of groups'),\n        ]\n\n        # Add the XINDn keywords proposed by Perry, though nothing is done with\n        # these at the moment\n        if len(hdulist) > 1:\n            for idx, hdu in enumerate(hdulist[1:]):\n                cards.append(('XIND' + str(idx + 1), hdu._header_offset,\n                              f'byte offset of extension {idx + 1}'))\n\n        cards.append(('COMPRESS', compress, 'Uses gzip compression'))\n        header = Header(cards)\n        return cls._readfrom_internal(_File(bs), header=header)\n\n    @classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        if card.keyword != 'XTENSION':\n            return False\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n        return xtension == cls._extension\n\n    # TODO: Add header verification\n\n    def _summary(self):\n        # TODO: Perhaps make this more descriptive...\n        return (self.name, self.ver, self.__class__.__name__, len(self._header))\n"},{"col":4,"comment":"\n        Summarize the HDU: name, dimensions, and formats.\n        ","endLoc":590,"header":"def _summary(self)","id":2154,"name":"_summary","nodeType":"Function","startLoc":563,"text":"def _summary(self):\n        \"\"\"\n        Summarize the HDU: name, dimensions, and formats.\n        \"\"\"\n\n        class_name = self.__class__.__name__\n\n        # if data is touched, use data info.\n        if self._data_loaded:\n            if self.data is None:\n                nrows = 0\n            else:\n                nrows = len(self.data)\n\n            ncols = len(self.columns)\n            format = self.columns.formats\n\n        # if data is not touched yet, use header info.\n        else:\n            nrows = self._header['NAXIS2']\n            ncols = self._header['TFIELDS']\n            format = ', '.join([self._header['TFORM' + str(j + 1)]\n                                for j in range(ncols)])\n            format = f'[{format}]'\n        dims = f\"{nrows}R x {ncols}C\"\n        ncards = len(self._header)\n\n        return (self.name, self.ver, class_name, ncards, dims, format)"},{"col":4,"comment":"null","endLoc":596,"header":"def _update_column_removed(self, columns, idx)","id":2155,"name":"_update_column_removed","nodeType":"Function","startLoc":592,"text":"def _update_column_removed(self, columns, idx):\n        super()._update_column_removed(columns, idx)\n\n        # Fix the header to reflect the column removal\n        self._clear_table_keywords(index=idx)"},{"col":4,"comment":"\n        Update the header when one of the column objects is updated.\n        ","endLoc":636,"header":"def _update_column_attribute_changed(self, column, col_idx, attr,\n                                         old_value, new_value)","id":2156,"name":"_update_column_attribute_changed","nodeType":"Function","startLoc":598,"text":"def _update_column_attribute_changed(self, column, col_idx, attr,\n                                         old_value, new_value):\n        \"\"\"\n        Update the header when one of the column objects is updated.\n        \"\"\"\n\n        # base_keyword is the keyword without the index such as TDIM\n        # while keyword is like TDIM1\n        base_keyword = ATTRIBUTE_TO_KEYWORD[attr]\n        keyword = base_keyword + str(col_idx + 1)\n\n        if keyword in self._header:\n            if new_value is None:\n                # If the new value is None, i.e. None was assigned to the\n                # column attribute, then treat this as equivalent to deleting\n                # that attribute\n                del self._header[keyword]\n            else:\n                self._header[keyword] = new_value\n        else:\n            keyword_idx = KEYWORD_NAMES.index(base_keyword)\n            # Determine the appropriate keyword to insert this one before/after\n            # if it did not already exist in the header\n            for before_keyword in reversed(KEYWORD_NAMES[:keyword_idx]):\n                before_keyword += str(col_idx + 1)\n                if before_keyword in self._header:\n                    self._header.insert(before_keyword, (keyword, new_value),\n                                        after=True)\n                    break\n            else:\n                for after_keyword in KEYWORD_NAMES[keyword_idx + 1:]:\n                    after_keyword += str(col_idx + 1)\n                    if after_keyword in self._header:\n                        self._header.insert(after_keyword,\n                                            (keyword, new_value))\n                        break\n                else:\n                    # Just append\n                    self._header[keyword] = new_value"},{"className":"NonstandardExtHDU","col":0,"comment":"\n    A Non-standard Extension HDU class.\n\n    This class is used for an Extension HDU when the ``XTENSION``\n    `Card` has a non-standard value.  In this case, Astropy can figure\n    out how big the data is but not what it is.  The data for this HDU\n    is read from the file as a byte stream that begins at the first\n    byte after the header ``END`` card and continues until the\n    beginning of the next header or the end of the file.\n    ","endLoc":1641,"id":2157,"nodeType":"Class","startLoc":1597,"text":"class NonstandardExtHDU(ExtensionHDU):\n    \"\"\"\n    A Non-standard Extension HDU class.\n\n    This class is used for an Extension HDU when the ``XTENSION``\n    `Card` has a non-standard value.  In this case, Astropy can figure\n    out how big the data is but not what it is.  The data for this HDU\n    is read from the file as a byte stream that begins at the first\n    byte after the header ``END`` card and continues until the\n    beginning of the next header or the end of the file.\n    \"\"\"\n\n    _standard = False\n\n    @classmethod\n    def match_header(cls, header):\n        \"\"\"\n        Matches any extension HDU that is not one of the standard extension HDU\n        types.\n        \"\"\"\n\n        card = header.cards[0]\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n        # A3DTABLE is not really considered a 'standard' extension, as it was\n        # sort of the prototype for BINTABLE; however, since our BINTABLE\n        # implementation handles A3DTABLE HDUs it is listed here.\n        standard_xtensions = ('IMAGE', 'TABLE', 'BINTABLE', 'A3DTABLE')\n        # The check that xtension is not one of the standard types should be\n        # redundant.\n        return (card.keyword == 'XTENSION' and\n                xtension not in standard_xtensions)\n\n    def _summary(self):\n        axes = tuple(self.data.shape)\n        return (self.name, self.ver, 'NonstandardExtHDU', len(self._header), axes)\n\n    @lazyproperty\n    def data(self):\n        \"\"\"\n        Return the file data.\n        \"\"\"\n\n        return self._get_raw_data(self.size, 'ubyte', self._data_offset)"},{"col":4,"comment":"\n        Encode anything that is unicode-ish as utf-8.  This method is only\n        called for Py3+.\n        ","endLoc":994,"header":"@staticmethod\n    def _encode_str(value)","id":2158,"name":"_encode_str","nodeType":"Function","startLoc":976,"text":"@staticmethod\n    def _encode_str(value):\n        \"\"\"\n        Encode anything that is unicode-ish as utf-8.  This method is only\n        called for Py3+.\n        \"\"\"\n        if isinstance(value, str):\n            value = value.encode('utf-8')\n        elif isinstance(value, bytes) or value is np.ma.masked:\n            pass\n        else:\n            arr = np.asarray(value)\n            if arr.dtype.char == 'U':\n                arr = np.char.encode(arr, encoding='utf-8')\n                if isinstance(value, np.ma.MaskedArray):\n                    arr = np.ma.array(arr, mask=value.mask, copy=False)\n            value = arr\n\n        return value"},{"col":4,"comment":"null","endLoc":674,"header":"def __init__(self, *args, differentials=None, **kwargs)","id":2159,"name":"__init__","nodeType":"Function","startLoc":668,"text":"def __init__(self, *args, differentials=None, **kwargs):\n        # Handle any differentials passed in.\n        super().__init__(*args, **kwargs)\n        if (differentials is None\n                and args and isinstance(args[0], self.__class__)):\n            differentials = args[0]._differentials\n        self._differentials = self._validate_differentials(differentials)"},{"col":4,"comment":"\n        Matches any extension HDU that is not one of the standard extension HDU\n        types.\n        ","endLoc":1629,"header":"@classmethod\n    def match_header(cls, header)","id":2160,"name":"match_header","nodeType":"Function","startLoc":1611,"text":"@classmethod\n    def match_header(cls, header):\n        \"\"\"\n        Matches any extension HDU that is not one of the standard extension HDU\n        types.\n        \"\"\"\n\n        card = header.cards[0]\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n        # A3DTABLE is not really considered a 'standard' extension, as it was\n        # sort of the prototype for BINTABLE; however, since our BINTABLE\n        # implementation handles A3DTABLE HDUs it is listed here.\n        standard_xtensions = ('IMAGE', 'TABLE', 'BINTABLE', 'A3DTABLE')\n        # The check that xtension is not one of the standard types should be\n        # redundant.\n        return (card.keyword == 'XTENSION' and\n                xtension not in standard_xtensions)"},{"col":4,"comment":"null","endLoc":904,"header":"def _report(self)","id":2161,"name":"_report","nodeType":"Function","startLoc":872,"text":"def _report(self):\n        if self.diff_keyword_count:\n            self._writeln(' Headers have different number of cards:')\n            self._writeln(f'  a: {self.diff_keyword_count[0]}')\n            self._writeln(f'  b: {self.diff_keyword_count[1]}')\n        if self.diff_keywords:\n            for keyword in self.diff_keywords[0]:\n                if keyword in Card._commentary_keywords:\n                    val = self.a[keyword][0]\n                else:\n                    val = self.a[keyword]\n                self._writeln(f' Extra keyword {keyword!r:8} in a: {val!r}')\n            for keyword in self.diff_keywords[1]:\n                if keyword in Card._commentary_keywords:\n                    val = self.b[keyword][0]\n                else:\n                    val = self.b[keyword]\n                self._writeln(f' Extra keyword {keyword!r:8} in b: {val!r}')\n\n        if self.diff_duplicate_keywords:\n            for keyword, count in sorted(self.diff_duplicate_keywords.items()):\n                self._writeln(f' Inconsistent duplicates of keyword {keyword!r:8}:')\n                self._writeln('  Occurs {} time(s) in a, {} times in (b)'\n                              .format(*count))\n\n        if self.diff_keyword_values or self.diff_keyword_comments:\n            for keyword in self.common_keywords:\n                report_diff_keyword_attr(self._fileobj, 'values',\n                                         self.diff_keyword_values, keyword,\n                                         ind=self._indent)\n                report_diff_keyword_attr(self._fileobj, 'comments',\n                                         self.diff_keyword_comments, keyword,\n                                         ind=self._indent)"},{"col":4,"comment":"null","endLoc":1633,"header":"def _summary(self)","id":2162,"name":"_summary","nodeType":"Function","startLoc":1631,"text":"def _summary(self):\n        axes = tuple(self.data.shape)\n        return (self.name, self.ver, 'NonstandardExtHDU', len(self._header), axes)"},{"col":4,"comment":"\n        Return the file data.\n        ","endLoc":1641,"header":"@lazyproperty\n    def data(self)","id":2163,"name":"data","nodeType":"Function","startLoc":1635,"text":"@lazyproperty\n    def data(self):\n        \"\"\"\n        Return the file data.\n        \"\"\"\n\n        return self._get_raw_data(self.size, 'ubyte', self._data_offset)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1609,"id":2164,"name":"_standard","nodeType":"Attribute","startLoc":1609,"text":"_standard"},{"col":4,"comment":"null","endLoc":259,"header":"def __init__(self, *args, **kwargs)","id":2165,"name":"__init__","nodeType":"Function","startLoc":182,"text":"def __init__(self, *args, **kwargs):\n        # make argument a list, so we can pop them off.\n        args = list(args)\n        components = self.components\n        if (args and isinstance(args[0], self.__class__)\n                and all(arg is None for arg in args[1:])):\n            rep_or_diff = args[0]\n            copy = kwargs.pop('copy', True)\n            attrs = [getattr(rep_or_diff, component)\n                     for component in components]\n            if 'info' in rep_or_diff.__dict__:\n                self.info = rep_or_diff.info\n\n            if kwargs:\n                raise TypeError(f'unexpected keyword arguments for case '\n                                f'where class instance is passed in: {kwargs}')\n\n        else:\n            attrs = []\n            for component in components:\n                try:\n                    attr = args.pop(0) if args else kwargs.pop(component)\n                except KeyError:\n                    raise TypeError(f'__init__() missing 1 required positional '\n                                    f'argument: {component!r}') from None\n\n                if attr is None:\n                    raise TypeError(f'__init__() missing 1 required positional '\n                                    f'argument: {component!r} (or first '\n                                    f'argument should be an instance of '\n                                    f'{self.__class__.__name__}).')\n\n                attrs.append(attr)\n\n            copy = args.pop(0) if args else kwargs.pop('copy', True)\n\n            if args:\n                raise TypeError(f'unexpected arguments: {args}')\n\n            if kwargs:\n                for component in components:\n                    if component in kwargs:\n                        raise TypeError(f\"__init__() got multiple values for \"\n                                        f\"argument {component!r}\")\n\n                raise TypeError(f'unexpected keyword arguments: {kwargs}')\n\n        # Pass attributes through the required initializing classes.\n        attrs = [self.attr_classes[component](attr, copy=copy, subok=True)\n                 for component, attr in zip(components, attrs)]\n        try:\n            bc_attrs = np.broadcast_arrays(*attrs, subok=True)\n        except ValueError  as err:\n            if len(components) <= 2:\n                c_str = ' and '.join(components)\n            else:\n                c_str = ', '.join(components[:2]) + ', and ' + components[2]\n            raise ValueError(f\"Input parameters {c_str} cannot be broadcast\") from err\n\n        # The output of np.broadcast_arrays() has limitations on writeability, so we perform\n        # additional handling to enable writeability in most situations.  This is primarily\n        # relevant for allowing the changing of the wrap angle of longitude components.\n        #\n        # If the shape has changed for a given component, broadcasting is needed:\n        #     If copy=True, we make a copy of the broadcasted array to ensure writeability.\n        #         Note that array had already been copied prior to the broadcasting.\n        #         TODO: Find a way to avoid the double copy.\n        #     If copy=False, we use the broadcasted array, and writeability may still be\n        #         limited.\n        # If the shape has not changed for a given component, we can proceed with using the\n        #     non-broadcasted array, which avoids writeability issues from np.broadcast_arrays().\n        attrs = [(bc_attr.copy() if copy else bc_attr) if bc_attr.shape != attr.shape else attr\n                 for attr, bc_attr in zip(attrs, bc_attrs)]\n\n        # Set private attributes for the attributes. (If not defined explicitly\n        # on the class, the metaclass will define properties to access these.)\n        for component, attr in zip(components, attrs):\n            setattr(self, '_' + component, attr)"},{"attributeType":"null","col":4,"comment":"\n    This flag implies that when writing VLA tables (P/Q format) the heap\n    pointers that go into P/Q table columns should not be reordered or\n    rearranged in any way by the default heap management code.\n\n    This is included primarily as an optimization for compressed image HDUs\n    which perform their own heap maintenance.\n    ","endLoc":265,"id":2166,"name":"_manages_own_heap","nodeType":"Attribute","startLoc":265,"text":"_manages_own_heap"},{"attributeType":"null","col":8,"comment":"null","endLoc":281,"id":2167,"name":"_character_as_bytes","nodeType":"Attribute","startLoc":281,"text":"self._character_as_bytes"},{"className":"FitsHDU","col":0,"comment":"\n    A non-standard extension HDU for encapsulating entire FITS files within a\n    single HDU of a container FITS file.  These HDUs have an extension (that is\n    an XTENSION keyword) of FITS.\n\n    The FITS file contained in the HDU's data can be accessed by the `hdulist`\n    attribute which returns the contained FITS file as an `HDUList` object.\n    ","endLoc":125,"id":2168,"nodeType":"Class","startLoc":15,"text":"class FitsHDU(NonstandardExtHDU):\n    \"\"\"\n    A non-standard extension HDU for encapsulating entire FITS files within a\n    single HDU of a container FITS file.  These HDUs have an extension (that is\n    an XTENSION keyword) of FITS.\n\n    The FITS file contained in the HDU's data can be accessed by the `hdulist`\n    attribute which returns the contained FITS file as an `HDUList` object.\n    \"\"\"\n\n    _extension = 'FITS'\n\n    @lazyproperty\n    def hdulist(self):\n        self._file.seek(self._data_offset)\n        fileobj = io.BytesIO()\n        # Read the data into a BytesIO--reading directly from the file\n        # won't work (at least for gzipped files) due to problems deep\n        # within the gzip module that make it difficult to read gzip files\n        # embedded in another file\n        fileobj.write(self._file.read(self.size))\n        fileobj.seek(0)\n        if self._header['COMPRESS']:\n            fileobj = gzip.GzipFile(fileobj=fileobj)\n        return HDUList.fromfile(fileobj, mode='readonly')\n\n    @classmethod\n    def fromfile(cls, filename, compress=False):\n        \"\"\"\n        Like `FitsHDU.fromhdulist()`, but creates a FitsHDU from a file on\n        disk.\n\n        Parameters\n        ----------\n        filename : str\n            The path to the file to read into a FitsHDU\n        compress : bool, optional\n            Gzip compress the FITS file\n        \"\"\"\n\n        with HDUList.fromfile(filename) as hdulist:\n            return cls.fromhdulist(hdulist, compress=compress)\n\n    @classmethod\n    def fromhdulist(cls, hdulist, compress=False):\n        \"\"\"\n        Creates a new FitsHDU from a given HDUList object.\n\n        Parameters\n        ----------\n        hdulist : HDUList\n            A valid Headerlet object.\n        compress : bool, optional\n            Gzip compress the FITS file\n        \"\"\"\n\n        fileobj = bs = io.BytesIO()\n        if compress:\n            if hasattr(hdulist, '_file'):\n                name = fileobj_name(hdulist._file)\n            else:\n                name = None\n            fileobj = gzip.GzipFile(name, mode='wb', fileobj=bs)\n\n        hdulist.writeto(fileobj)\n\n        if compress:\n            fileobj.close()\n\n        # A proper HDUList should still be padded out to a multiple of 2880\n        # technically speaking\n        padding = (_pad_length(bs.tell()) * cls._padding_byte).encode('ascii')\n        bs.write(padding)\n\n        bs.seek(0)\n\n        cards = [\n            ('XTENSION', cls._extension, 'FITS extension'),\n            ('BITPIX', 8, 'array data type'),\n            ('NAXIS', 1, 'number of array dimensions'),\n            ('NAXIS1', len(bs.getvalue()), 'Axis length'),\n            ('PCOUNT', 0, 'number of parameters'),\n            ('GCOUNT', 1, 'number of groups'),\n        ]\n\n        # Add the XINDn keywords proposed by Perry, though nothing is done with\n        # these at the moment\n        if len(hdulist) > 1:\n            for idx, hdu in enumerate(hdulist[1:]):\n                cards.append(('XIND' + str(idx + 1), hdu._header_offset,\n                              f'byte offset of extension {idx + 1}'))\n\n        cards.append(('COMPRESS', compress, 'Uses gzip compression'))\n        header = Header(cards)\n        return cls._readfrom_internal(_File(bs), header=header)\n\n    @classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        if card.keyword != 'XTENSION':\n            return False\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n        return xtension == cls._extension\n\n    # TODO: Add header verification\n\n    def _summary(self):\n        # TODO: Perhaps make this more descriptive...\n        return (self.name, self.ver, self.__class__.__name__, len(self._header))"},{"attributeType":"null","col":12,"comment":"null","endLoc":376,"id":2169,"name":"ver","nodeType":"Attribute","startLoc":376,"text":"self.ver"},{"col":4,"comment":"null","endLoc":39,"header":"@lazyproperty\n    def hdulist(self)","id":2170,"name":"hdulist","nodeType":"Function","startLoc":27,"text":"@lazyproperty\n    def hdulist(self):\n        self._file.seek(self._data_offset)\n        fileobj = io.BytesIO()\n        # Read the data into a BytesIO--reading directly from the file\n        # won't work (at least for gzipped files) due to problems deep\n        # within the gzip module that make it difficult to read gzip files\n        # embedded in another file\n        fileobj.write(self._file.read(self.size))\n        fileobj.seek(0)\n        if self._header['COMPRESS']:\n            fileobj = gzip.GzipFile(fileobj=fileobj)\n        return HDUList.fromfile(fileobj, mode='readonly')"},{"attributeType":"null","col":20,"comment":"null","endLoc":318,"id":2171,"name":"data","nodeType":"Attribute","startLoc":318,"text":"self.data"},{"attributeType":"null","col":16,"comment":"null","endLoc":352,"id":2172,"name":"columns","nodeType":"Attribute","startLoc":352,"text":"self.columns"},{"attributeType":"null","col":8,"comment":"null","endLoc":280,"id":2173,"name":"_uint","nodeType":"Attribute","startLoc":280,"text":"self._uint"},{"attributeType":"null","col":12,"comment":"null","endLoc":311,"id":2174,"name":"_header","nodeType":"Attribute","startLoc":311,"text":"self._header"},{"attributeType":"null","col":12,"comment":"null","endLoc":374,"id":2175,"name":"name","nodeType":"Attribute","startLoc":374,"text":"self.name"},{"attributeType":"null","col":16,"comment":"null","endLoc":413,"id":2176,"name":"_data_replaced","nodeType":"Attribute","startLoc":413,"text":"self._data_replaced"},{"attributeType":"null","col":8,"comment":"null","endLoc":417,"id":2177,"name":"_modified","nodeType":"Attribute","startLoc":417,"text":"self._modified"},{"col":4,"comment":"null","endLoc":863,"header":"def __init__(self, data=None, header=None, name=None, uint=False, ver=None,\n                 character_as_bytes=False)","id":2178,"name":"__init__","nodeType":"Function","startLoc":851,"text":"def __init__(self, data=None, header=None, name=None, uint=False, ver=None,\n                 character_as_bytes=False):\n        from astropy.table import Table\n        if isinstance(data, Table):\n            from astropy.io.fits.convenience import table_to_hdu\n            hdu = table_to_hdu(data)\n            if header is not None:\n                hdu.header.update(header)\n            data = hdu.data\n            header = hdu.header\n\n        super().__init__(data, header, name=name, uint=uint, ver=ver,\n                         character_as_bytes=character_as_bytes)"},{"col":0,"comment":"\n    Convert an `~astropy.table.Table` object to a FITS\n    `~astropy.io.fits.BinTableHDU`.\n\n    Parameters\n    ----------\n    table : astropy.table.Table\n        The table to convert.\n    character_as_bytes : bool\n        Whether to return bytes for string columns when accessed from the HDU.\n        By default this is `False` and (unicode) strings are returned, but for\n        large tables this may use up a lot of memory.\n\n    Returns\n    -------\n    table_hdu : `~astropy.io.fits.BinTableHDU`\n        The FITS binary table HDU.\n    ","endLoc":617,"header":"def table_to_hdu(table, character_as_bytes=False)","id":2179,"name":"table_to_hdu","nodeType":"Function","startLoc":438,"text":"def table_to_hdu(table, character_as_bytes=False):\n    \"\"\"\n    Convert an `~astropy.table.Table` object to a FITS\n    `~astropy.io.fits.BinTableHDU`.\n\n    Parameters\n    ----------\n    table : astropy.table.Table\n        The table to convert.\n    character_as_bytes : bool\n        Whether to return bytes for string columns when accessed from the HDU.\n        By default this is `False` and (unicode) strings are returned, but for\n        large tables this may use up a lot of memory.\n\n    Returns\n    -------\n    table_hdu : `~astropy.io.fits.BinTableHDU`\n        The FITS binary table HDU.\n    \"\"\"\n    # Avoid circular imports\n    from .connect import is_column_keyword, REMOVE_KEYWORDS\n    from .column import python_to_tdisp\n\n    # Header to store Time related metadata\n    hdr = None\n\n    # Not all tables with mixin columns are supported\n    if table.has_mixin_columns:\n        # Import is done here, in order to avoid it at build time as erfa is not\n        # yet available then.\n        from astropy.table.column import BaseColumn\n        from astropy.time import Time\n        from astropy.units import Quantity\n        from .fitstime import time_to_fits\n\n        # Only those columns which are instances of BaseColumn, Quantity or Time can\n        # be written\n        unsupported_cols = table.columns.not_isinstance((BaseColumn, Quantity, Time))\n        if unsupported_cols:\n            unsupported_names = [col.info.name for col in unsupported_cols]\n            raise ValueError(f'cannot write table with mixin column(s) '\n                             f'{unsupported_names}')\n\n        time_cols = table.columns.isinstance(Time)\n        if time_cols:\n            table, hdr = time_to_fits(table)\n\n    # Create a new HDU object\n    tarray = table.as_array()\n    if isinstance(tarray, np.ma.MaskedArray):\n        # Fill masked values carefully:\n        # float column's default mask value needs to be Nan and\n        # string column's default mask should be an empty string.\n        # Note: getting the fill value for the structured array is\n        # more reliable than for individual columns for string entries.\n        # (no 'N/A' for a single-element string, where it should be 'N').\n        default_fill_value = np.ma.default_fill_value(tarray.dtype)\n        for colname, (coldtype, _) in tarray.dtype.fields.items():\n            if np.all(tarray.fill_value[colname] == default_fill_value[colname]):\n                # Since multi-element columns with dtypes such as '2f8' have\n                # a subdtype, we should look up the type of column on that.\n                coltype = (coldtype.subdtype[0].type\n                           if coldtype.subdtype else coldtype.type)\n                if issubclass(coltype, np.complexfloating):\n                    tarray.fill_value[colname] = complex(np.nan, np.nan)\n                elif issubclass(coltype, np.inexact):\n                    tarray.fill_value[colname] = np.nan\n                elif issubclass(coltype, np.character):\n                    tarray.fill_value[colname] = ''\n\n        # TODO: it might be better to construct the FITS table directly from\n        # the Table columns, rather than go via a structured array.\n        table_hdu = BinTableHDU.from_columns(tarray.filled(), header=hdr,\n                                             character_as_bytes=character_as_bytes)\n        for col in table_hdu.columns:\n            # Binary FITS tables support TNULL *only* for integer data columns\n            # TODO: Determine a schema for handling non-integer masked columns\n            # with non-default fill values in FITS (if at all possible).\n            int_formats = ('B', 'I', 'J', 'K')\n            if not (col.format in int_formats or\n                    col.format.p_format in int_formats):\n                continue\n\n            fill_value = tarray[col.name].fill_value\n            col.null = fill_value.astype(int)\n    else:\n        table_hdu = BinTableHDU.from_columns(tarray, header=hdr,\n                                             character_as_bytes=character_as_bytes)\n\n    # Set units and format display for output HDU\n    for col in table_hdu.columns:\n\n        if table[col.name].info.format is not None:\n            # check for boolean types, special format case\n            logical = table[col.name].info.dtype == bool\n\n            tdisp_format = python_to_tdisp(table[col.name].info.format,\n                                           logical_dtype=logical)\n            if tdisp_format is not None:\n                col.disp = tdisp_format\n\n        unit = table[col.name].unit\n        if unit is not None:\n            # Local imports to avoid importing units when it is not required,\n            # e.g. for command-line scripts\n            from astropy.units import Unit\n            from astropy.units.format.fits import UnitScaleError\n            try:\n                col.unit = unit.to_string(format='fits')\n            except UnitScaleError:\n                scale = unit.scale\n                raise UnitScaleError(\n                    f\"The column '{col.name}' could not be stored in FITS \"\n                    f\"format because it has a scale '({str(scale)})' that \"\n                    f\"is not recognized by the FITS standard. Either scale \"\n                    f\"the data or change the units.\")\n            except ValueError:\n                # Warn that the unit is lost, but let the details depend on\n                # whether the column was serialized (because it was a\n                # quantity), since then the unit can be recovered by astropy.\n                warning = (\n                    f\"The unit '{unit.to_string()}' could not be saved in \"\n                    f\"native FITS format \")\n                if any('SerializedColumn' in item and 'name: '+col.name in item\n                       for item in table.meta.get('comments', [])):\n                    warning += (\n                        \"and hence will be lost to non-astropy fits readers. \"\n                        \"Within astropy, the unit can roundtrip using QTable, \"\n                        \"though one has to enable the unit before reading.\")\n                else:\n                    warning += (\n                        \"and cannot be recovered in reading. It can roundtrip \"\n                        \"within astropy by using QTable both to write and read \"\n                        \"back, though one has to enable the unit before reading.\")\n                warnings.warn(warning, AstropyUserWarning)\n\n            else:\n                # Try creating a Unit to issue a warning if the unit is not\n                # FITS compliant\n                Unit(col.unit, format='fits', parse_strict='warn')\n\n    # Column-specific override keywords for coordinate columns\n    coord_meta = table.meta.pop('__coordinate_columns__', {})\n    for col_name, col_info in coord_meta.items():\n        col = table_hdu.columns[col_name]\n        # Set the column coordinate attributes from data saved earlier.\n        # Note: have to set these, even if we have no data.\n        for attr in 'coord_type', 'coord_unit':\n            setattr(col, attr, col_info.get(attr, None))\n        trpos = col_info.get('time_ref_pos', None)\n        if trpos is not None:\n            setattr(col, 'time_ref_pos', trpos)\n\n    for key, value in table.meta.items():\n        if is_column_keyword(key.upper()) or key.upper() in REMOVE_KEYWORDS:\n            warnings.warn(\n                f\"Meta-data keyword {key} will be ignored since it conflicts \"\n                f\"with a FITS reserved keyword\", AstropyUserWarning)\n            continue\n\n        # Convert to FITS format\n        if key == 'comments':\n            key = 'comment'\n\n        if isinstance(value, list):\n            for item in value:\n                try:\n                    table_hdu.header.append((key, item))\n                except ValueError:\n                    warnings.warn(\n                        f\"Attribute `{key}` of type {type(value)} cannot be \"\n                        f\"added to FITS Header - skipping\", AstropyUserWarning)\n        else:\n            try:\n                table_hdu.header[key] = value\n            except ValueError:\n                warnings.warn(\n                    f\"Attribute `{key}` of type {type(value)} cannot be \"\n                    f\"added to FITS Header - skipping\", AstropyUserWarning)\n    return table_hdu"},{"col":4,"comment":"null","endLoc":431,"header":"def __init__(self, index, index_slice, original=False)","id":2180,"name":"__init__","nodeType":"Function","startLoc":420,"text":"def __init__(self, index, index_slice, original=False):\n        self.index = index\n        self.original = original\n        self._frozen = False\n\n        if isinstance(index_slice, tuple):\n            self.start, self._stop, self.step = index_slice\n        elif isinstance(index_slice, slice):  # index_slice is an actual slice\n            num_rows = len(index.columns[0])\n            self.start, self._stop, self.step = index_slice.indices(num_rows)\n        else:\n            raise TypeError('index_slice must be tuple or slice')"},{"col":4,"comment":"\n        Remove all indices involving the given column.\n        If the primary index is removed, the new primary\n        index will be the most recently added remaining\n        index.\n\n        Parameters\n        ----------\n        colname : str\n            Name of column\n        ","endLoc":1043,"header":"def remove_indices(self, colname)","id":2181,"name":"remove_indices","nodeType":"Function","startLoc":1023,"text":"def remove_indices(self, colname):\n        '''\n        Remove all indices involving the given column.\n        If the primary index is removed, the new primary\n        index will be the most recently added remaining\n        index.\n\n        Parameters\n        ----------\n        colname : str\n            Name of column\n        '''\n        col = self.columns[colname]\n        for index in self.indices:\n            try:\n                index.col_position(col.info.name)\n            except ValueError:\n                pass\n            else:\n                for c in index.columns:\n                    c.info.indices.remove(index)"},{"col":4,"comment":"\n        Return a context manager for an indexing mode.\n\n        Parameters\n        ----------\n        mode : str\n            Either 'freeze', 'copy_on_getitem', or 'discard_on_copy'.\n            In 'discard_on_copy' mode,\n            indices are not copied whenever columns or tables are copied.\n            In 'freeze' mode, indices are not modified whenever columns are\n            modified; at the exit of the context, indices refresh themselves\n            based on column values. This mode is intended for scenarios in\n            which one intends to make many additions or modifications in an\n            indexed column.\n            In 'copy_on_getitem' mode, indices are copied when taking column\n            slices as well as table slices, so col[i0:i1] will preserve\n            indices.\n        ","endLoc":1064,"header":"def index_mode(self, mode)","id":2182,"name":"index_mode","nodeType":"Function","startLoc":1045,"text":"def index_mode(self, mode):\n        '''\n        Return a context manager for an indexing mode.\n\n        Parameters\n        ----------\n        mode : str\n            Either 'freeze', 'copy_on_getitem', or 'discard_on_copy'.\n            In 'discard_on_copy' mode,\n            indices are not copied whenever columns or tables are copied.\n            In 'freeze' mode, indices are not modified whenever columns are\n            modified; at the exit of the context, indices refresh themselves\n            based on column values. This mode is intended for scenarios in\n            which one intends to make many additions or modifications in an\n            indexed column.\n            In 'copy_on_getitem' mode, indices are copied when taking column\n            slices as well as table slices, so col[i0:i1] will preserve\n            indices.\n        '''\n        return _IndexModeContext(self, mode)"},{"col":4,"comment":"\n        Parameters\n        ----------\n        table : Table\n            The table to which the mode should be applied\n        mode : str\n            Either 'freeze', 'copy_on_getitem', or 'discard_on_copy'.\n            In 'discard_on_copy' mode,\n            indices are not copied whenever columns or tables are copied.\n            In 'freeze' mode, indices are not modified whenever columns are\n            modified; at the exit of the context, indices refresh themselves\n            based on column values. This mode is intended for scenarios in\n            which one intends to make many additions or modifications on an\n            indexed column.\n            In 'copy_on_getitem' mode, indices are copied when taking column\n            slices as well as table slices, so col[i0:i1] will preserve\n            indices.\n        ","endLoc":701,"header":"def __init__(self, table, mode)","id":2183,"name":"__init__","nodeType":"Function","startLoc":675,"text":"def __init__(self, table, mode):\n        '''\n        Parameters\n        ----------\n        table : Table\n            The table to which the mode should be applied\n        mode : str\n            Either 'freeze', 'copy_on_getitem', or 'discard_on_copy'.\n            In 'discard_on_copy' mode,\n            indices are not copied whenever columns or tables are copied.\n            In 'freeze' mode, indices are not modified whenever columns are\n            modified; at the exit of the context, indices refresh themselves\n            based on column values. This mode is intended for scenarios in\n            which one intends to make many additions or modifications on an\n            indexed column.\n            In 'copy_on_getitem' mode, indices are copied when taking column\n            slices as well as table slices, so col[i0:i1] will preserve\n            indices.\n        '''\n        self.table = table\n        self.mode = mode\n        # Used by copy_on_getitem\n        self._orig_classes = []\n        if mode not in ('freeze', 'discard_on_copy', 'copy_on_getitem'):\n            raise ValueError(\"Expected a mode of either 'freeze', \"\n                             \"'discard_on_copy', or 'copy_on_getitem', got \"\n                             \"'{}'\".format(mode))"},{"col":4,"comment":"Support converting Table to np.array via np.array(table).\n\n        Coercion to a different dtype via np.array(table, dtype) is not\n        supported and will raise a ValueError.\n        ","endLoc":1084,"header":"def __array__(self, dtype=None)","id":2184,"name":"__array__","nodeType":"Function","startLoc":1066,"text":"def __array__(self, dtype=None):\n        \"\"\"Support converting Table to np.array via np.array(table).\n\n        Coercion to a different dtype via np.array(table, dtype) is not\n        supported and will raise a ValueError.\n        \"\"\"\n        if dtype is not None:\n            raise ValueError('Datatype coercion is not allowed')\n\n        # This limitation is because of the following unexpected result that\n        # should have made a table copy while changing the column names.\n        #\n        # >>> d = astropy.table.Table([[1,2],[3,4]])\n        # >>> np.array(d, dtype=[('a', 'i8'), ('b', 'i8')])\n        # array([(0, 0), (0, 0)],\n        #       dtype=[('a', '<i8'), ('b', '<i8')])\n\n        out = self.as_array()\n        return out.data if isinstance(out, np.ma.MaskedArray) else out"},{"col":4,"comment":"\n        Like `FitsHDU.fromhdulist()`, but creates a FitsHDU from a file on\n        disk.\n\n        Parameters\n        ----------\n        filename : str\n            The path to the file to read into a FitsHDU\n        compress : bool, optional\n            Gzip compress the FITS file\n        ","endLoc":56,"header":"@classmethod\n    def fromfile(cls, filename, compress=False)","id":2185,"name":"fromfile","nodeType":"Function","startLoc":41,"text":"@classmethod\n    def fromfile(cls, filename, compress=False):\n        \"\"\"\n        Like `FitsHDU.fromhdulist()`, but creates a FitsHDU from a file on\n        disk.\n\n        Parameters\n        ----------\n        filename : str\n            The path to the file to read into a FitsHDU\n        compress : bool, optional\n            Gzip compress the FITS file\n        \"\"\"\n\n        with HDUList.fromfile(filename) as hdulist:\n            return cls.fromhdulist(hdulist, compress=compress)"},{"col":4,"comment":"Create a new table as a referenced slice from self.","endLoc":1440,"header":"def _new_from_slice(self, slice_)","id":2186,"name":"_new_from_slice","nodeType":"Function","startLoc":1409,"text":"def _new_from_slice(self, slice_):\n        \"\"\"Create a new table as a referenced slice from self.\"\"\"\n\n        table = self.__class__(masked=self.masked)\n        if self.meta:\n            table.meta = self.meta.copy()  # Shallow copy for slice\n        table.primary_key = self.primary_key\n\n        newcols = []\n        for col in self.columns.values():\n            newcol = col[slice_]\n\n            # Note in line below, use direct attribute access to col.indices for Column\n            # instances instead of the generic col.info.indices.  This saves about 4 usec\n            # per column.\n            if (col if isinstance(col, Column) else col.info).indices:\n                # TODO : as far as I can tell the only purpose of setting _copy_indices\n                # here is to communicate that to the initial test in `slice_indices`.\n                # Why isn't that just sent as an arg to the function?\n                col.info._copy_indices = self._copy_indices\n                newcol = col.info.slice_indices(newcol, slice_, len(col))\n\n                # Don't understand why this is forcing a value on the original column.\n                # Normally col.info does not even have a _copy_indices attribute.  Tests\n                # still pass if this line is deleted.  (Each col.info attribute access\n                # is expensive).\n                col.info._copy_indices = True\n\n            newcols.append(newcol)\n\n        self._make_table_from_cols(table, newcols, verify=False, names=self.columns.keys())\n        return table"},{"col":0,"comment":"\n    Write a diff between two header keyword values or comments to the specified\n    file-like object.\n    ","endLoc":1469,"header":"def report_diff_keyword_attr(fileobj, attr, diffs, keyword, ind=0)","id":2187,"name":"report_diff_keyword_attr","nodeType":"Function","startLoc":1450,"text":"def report_diff_keyword_attr(fileobj, attr, diffs, keyword, ind=0):\n    \"\"\"\n    Write a diff between two header keyword values or comments to the specified\n    file-like object.\n    \"\"\"\n\n    if keyword in diffs:\n        vals = diffs[keyword]\n        for idx, val in enumerate(vals):\n            if val is None:\n                continue\n            if idx == 0:\n                dup = ''\n            else:\n                dup = f'[{idx + 1}]'\n            fileobj.write(\n                fixed_width_indent(' Keyword {:8}{} has different {}:\\n'\n                                   .format(keyword, dup, attr), ind))\n            report_diff_values(val[0], val[1], fileobj=fileobj,\n                               indent_width=ind + 1)"},{"attributeType":"null","col":8,"comment":"null","endLoc":711,"id":2188,"name":"ignore_blanks","nodeType":"Attribute","startLoc":711,"text":"self.ignore_blanks"},{"attributeType":"null","col":8,"comment":"null","endLoc":715,"id":2189,"name":"ignore_comment_patterns","nodeType":"Attribute","startLoc":715,"text":"self.ignore_comment_patterns"},{"attributeType":"null","col":8,"comment":"null","endLoc":728,"id":2190,"name":"common_keywords","nodeType":"Attribute","startLoc":728,"text":"self.common_keywords"},{"attributeType":"null","col":8,"comment":"null","endLoc":705,"id":2191,"name":"ignore_keywords","nodeType":"Attribute","startLoc":705,"text":"self.ignore_keywords"},{"attributeType":"null","col":8,"comment":"null","endLoc":712,"id":2192,"name":"ignore_blank_cards","nodeType":"Attribute","startLoc":712,"text":"self.ignore_blank_cards"},{"col":4,"comment":"\n        Set ``col.parent_table = self`` and force ``col`` to have ``mask``\n        attribute if the table is masked and ``col.mask`` does not exist.\n        ","endLoc":1477,"header":"def _set_col_parent_table_and_mask(self, col)","id":2193,"name":"_set_col_parent_table_and_mask","nodeType":"Function","startLoc":1465,"text":"def _set_col_parent_table_and_mask(self, col):\n        \"\"\"\n        Set ``col.parent_table = self`` and force ``col`` to have ``mask``\n        attribute if the table is masked and ``col.mask`` does not exist.\n        \"\"\"\n        # For Column instances it is much faster to do direct attribute access\n        # instead of going through .info\n        col_info = col if isinstance(col, Column) else col.info\n        col_info.parent_table = self\n\n        # Legacy behavior for masked table\n        if self.masked and not hasattr(col, 'mask'):\n            col.mask = FalseArray(col.shape)"},{"attributeType":"null","col":8,"comment":"null","endLoc":731,"id":2194,"name":"diff_keyword_count","nodeType":"Attribute","startLoc":731,"text":"self.diff_keyword_count"},{"attributeType":"null","col":8,"comment":"null","endLoc":740,"id":2195,"name":"diff_keywords","nodeType":"Attribute","startLoc":740,"text":"self.diff_keywords"},{"attributeType":"null","col":8,"comment":"null","endLoc":708,"id":2196,"name":"rtol","nodeType":"Attribute","startLoc":708,"text":"self.rtol"},{"col":4,"comment":"null","endLoc":1530,"header":"def _base_repr_(self, html=False, descr_vals=None, max_width=None,\n                    tableid=None, show_dtype=True, max_lines=None,\n                    tableclass=None)","id":2197,"name":"_base_repr_","nodeType":"Function","startLoc":1504,"text":"def _base_repr_(self, html=False, descr_vals=None, max_width=None,\n                    tableid=None, show_dtype=True, max_lines=None,\n                    tableclass=None):\n        if descr_vals is None:\n            descr_vals = [self.__class__.__name__]\n            if self.masked:\n                descr_vals.append('masked=True')\n            descr_vals.append(f'length={len(self)}')\n\n        descr = ' '.join(descr_vals)\n        if html:\n            from astropy.utils.xml.writer import xml_escape\n            descr = f'<i>{xml_escape(descr)}</i>\\n'\n        else:\n            descr = f'<{descr}>\\n'\n\n        if tableid is None:\n            tableid = f'table{id(self)}'\n\n        data_lines, outs = self.formatter._pformat_table(\n            self, tableid=tableid, html=html, max_width=max_width,\n            show_name=True, show_unit=None, show_dtype=show_dtype,\n            max_lines=max_lines, tableclass=tableclass)\n\n        out = descr + '\\n'.join(data_lines)\n\n        return out"},{"attributeType":"null","col":8,"comment":"null","endLoc":736,"id":2198,"name":"diff_keyword_positions","nodeType":"Attribute","startLoc":736,"text":"self.diff_keyword_positions"},{"attributeType":"null","col":8,"comment":"null","endLoc":748,"id":2199,"name":"diff_keyword_values","nodeType":"Attribute","startLoc":748,"text":"self.diff_keyword_values"},{"attributeType":"null","col":8,"comment":"null","endLoc":714,"id":2200,"name":"ignore_keyword_patterns","nodeType":"Attribute","startLoc":714,"text":"self.ignore_keyword_patterns"},{"attributeType":"null","col":8,"comment":"null","endLoc":752,"id":2201,"name":"diff_keyword_comments","nodeType":"Attribute","startLoc":752,"text":"self.diff_keyword_comments"},{"attributeType":"null","col":8,"comment":"null","endLoc":744,"id":2202,"name":"diff_duplicate_keywords","nodeType":"Attribute","startLoc":744,"text":"self.diff_duplicate_keywords"},{"attributeType":"null","col":8,"comment":"null","endLoc":706,"id":2203,"name":"ignore_comments","nodeType":"Attribute","startLoc":706,"text":"self.ignore_comments"},{"attributeType":"null","col":8,"comment":"null","endLoc":709,"id":2204,"name":"atol","nodeType":"Attribute","startLoc":709,"text":"self.atol"},{"className":"ImageDataDiff","col":0,"comment":"\n    Diff two image data arrays (really any array from a PRIMARY HDU or an IMAGE\n    extension HDU, though the data unit is assumed to be \"pixels\").\n\n    `ImageDataDiff` objects have the following diff attributes:\n\n    - ``diff_dimensions``: If the two arrays contain either a different number\n      of dimensions or different sizes in any dimension, this contains a\n      2-tuple of the shapes of each array.  Currently no further comparison is\n      performed on images that don't have the exact same dimensions.\n\n    - ``diff_pixels``: If the two images contain any different pixels, this\n      contains a list of 2-tuples of the array index where the difference was\n      found, and another 2-tuple containing the different values.  For example,\n      if the pixel at (0, 0) contains different values this would look like::\n\n          [(0, 0), (1.1, 2.2)]\n\n      where 1.1 and 2.2 are the values of that pixel in each array.  This\n      array only contains up to ``self.numdiffs`` differences, for storage\n      efficiency.\n\n    - ``diff_total``: The total number of different pixels found between the\n      arrays.  Although ``diff_pixels`` does not necessarily contain all the\n      different pixel values, this can be used to get a count of the total\n      number of differences found.\n\n    - ``diff_ratio``: Contains the ratio of ``diff_total`` to the total number\n      of pixels in the arrays.\n    ","endLoc":1059,"id":2205,"nodeType":"Class","startLoc":912,"text":"class ImageDataDiff(_BaseDiff):\n    \"\"\"\n    Diff two image data arrays (really any array from a PRIMARY HDU or an IMAGE\n    extension HDU, though the data unit is assumed to be \"pixels\").\n\n    `ImageDataDiff` objects have the following diff attributes:\n\n    - ``diff_dimensions``: If the two arrays contain either a different number\n      of dimensions or different sizes in any dimension, this contains a\n      2-tuple of the shapes of each array.  Currently no further comparison is\n      performed on images that don't have the exact same dimensions.\n\n    - ``diff_pixels``: If the two images contain any different pixels, this\n      contains a list of 2-tuples of the array index where the difference was\n      found, and another 2-tuple containing the different values.  For example,\n      if the pixel at (0, 0) contains different values this would look like::\n\n          [(0, 0), (1.1, 2.2)]\n\n      where 1.1 and 2.2 are the values of that pixel in each array.  This\n      array only contains up to ``self.numdiffs`` differences, for storage\n      efficiency.\n\n    - ``diff_total``: The total number of different pixels found between the\n      arrays.  Although ``diff_pixels`` does not necessarily contain all the\n      different pixel values, this can be used to get a count of the total\n      number of differences found.\n\n    - ``diff_ratio``: Contains the ratio of ``diff_total`` to the total number\n      of pixels in the arrays.\n    \"\"\"\n\n    def __init__(self, a, b, numdiffs=10, rtol=0.0, atol=0.0):\n        \"\"\"\n        Parameters\n        ----------\n        a : BaseHDU\n            An HDU object.\n\n        b : BaseHDU\n            An HDU object to compare to the first HDU object.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\\\left| a - b \\\\right| > \\\\text{atol} + \\\\text{rtol} \\\\cdot \\\\left| b \\\\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n        \"\"\"\n\n        self.numdiffs = numdiffs\n        self.rtol = rtol\n        self.atol = atol\n\n        self.diff_dimensions = ()\n        self.diff_pixels = []\n        self.diff_ratio = 0\n\n        # self.diff_pixels only holds up to numdiffs differing pixels, but this\n        # self.diff_total stores the total count of differences between\n        # the images, but not the different values\n        self.diff_total = 0\n\n        super().__init__(a, b)\n\n    def _diff(self):\n        if self.a.shape != self.b.shape:\n            self.diff_dimensions = (self.a.shape, self.b.shape)\n            # Don't do any further comparison if the dimensions differ\n            # TODO: Perhaps we could, however, diff just the intersection\n            # between the two images\n            return\n\n        # Find the indices where the values are not equal\n        # If neither a nor b are floating point (or complex), ignore rtol and\n        # atol\n        if not (np.issubdtype(self.a.dtype, np.inexact) or\n                np.issubdtype(self.b.dtype, np.inexact)):\n            rtol = 0\n            atol = 0\n        else:\n            rtol = self.rtol\n            atol = self.atol\n\n        diffs = where_not_allclose(self.a, self.b, atol=atol, rtol=rtol)\n\n        self.diff_total = len(diffs[0])\n\n        if self.diff_total == 0:\n            # Then we're done\n            return\n\n        if self.numdiffs < 0:\n            numdiffs = self.diff_total\n        else:\n            numdiffs = self.numdiffs\n\n        self.diff_pixels = [(idx, (self.a[idx], self.b[idx]))\n                            for idx in islice(zip(*diffs), 0, numdiffs)]\n        self.diff_ratio = float(self.diff_total) / float(len(self.a.flat))\n\n    def _report(self):\n        if self.diff_dimensions:\n            dimsa = ' x '.join(str(d) for d in\n                               reversed(self.diff_dimensions[0]))\n            dimsb = ' x '.join(str(d) for d in\n                               reversed(self.diff_dimensions[1]))\n            self._writeln(' Data dimensions differ:')\n            self._writeln(f'  a: {dimsa}')\n            self._writeln(f'  b: {dimsb}')\n            # For now we don't do any further comparison if the dimensions\n            # differ; though in the future it might be nice to be able to\n            # compare at least where the images intersect\n            self._writeln(' No further data comparison performed.')\n            return\n\n        if not self.diff_pixels:\n            return\n\n        for index, values in self.diff_pixels:\n            index = [x + 1 for x in reversed(index)]\n            self._writeln(f' Data differs at {index}:')\n            report_diff_values(values[0], values[1], fileobj=self._fileobj,\n                               indent_width=self._indent + 1)\n\n        if self.diff_total > self.numdiffs:\n            self._writeln(' ...')\n        self._writeln(' {} different pixels found ({:.2%} different).'\n                      .format(self.diff_total, self.diff_ratio))"},{"col":4,"comment":"Convert coordinates to another representation.\n\n        If the instance is of the requested class, it is returned unmodified.\n        By default, conversion is done via Cartesian coordinates.\n        Also note that orientation information at the origin is *not* preserved by\n        conversions through Cartesian coordinates. See the docstring for\n        :meth:`~astropy.coordinates.BaseRepresentationOrDifferential.to_cartesian`\n        for an example.\n\n        Parameters\n        ----------\n        other_class : `~astropy.coordinates.BaseRepresentation` subclass\n            The type of representation to turn the coordinates into.\n        differential_class : dict of `~astropy.coordinates.BaseDifferential`, optional\n            Classes in which the differentials should be represented.\n            Can be a single class if only a single differential is attached,\n            otherwise it should be a `dict` keyed by the same keys as the\n            differentials.\n        ","endLoc":880,"header":"def represent_as(self, other_class, differential_class=None)","id":2206,"name":"represent_as","nodeType":"Function","startLoc":842,"text":"def represent_as(self, other_class, differential_class=None):\n        \"\"\"Convert coordinates to another representation.\n\n        If the instance is of the requested class, it is returned unmodified.\n        By default, conversion is done via Cartesian coordinates.\n        Also note that orientation information at the origin is *not* preserved by\n        conversions through Cartesian coordinates. See the docstring for\n        :meth:`~astropy.coordinates.BaseRepresentationOrDifferential.to_cartesian`\n        for an example.\n\n        Parameters\n        ----------\n        other_class : `~astropy.coordinates.BaseRepresentation` subclass\n            The type of representation to turn the coordinates into.\n        differential_class : dict of `~astropy.coordinates.BaseDifferential`, optional\n            Classes in which the differentials should be represented.\n            Can be a single class if only a single differential is attached,\n            otherwise it should be a `dict` keyed by the same keys as the\n            differentials.\n        \"\"\"\n        if other_class is self.__class__ and not differential_class:\n            return self.without_differentials()\n\n        else:\n            if isinstance(other_class, str):\n                raise ValueError(\"Input to a representation's represent_as \"\n                                 \"must be a class, not a string. For \"\n                                 \"strings, use frame objects\")\n\n            if other_class is not self.__class__:\n                # The default is to convert via cartesian coordinates\n                new_rep = other_class.from_cartesian(self.to_cartesian())\n            else:\n                new_rep = self\n\n            new_rep._differentials = self._re_represent_differentials(\n                new_rep, differential_class)\n\n            return new_rep"},{"col":4,"comment":"Return a copy of the representation without attached differentials.\n\n        Returns\n        -------\n        `~astropy.coordinates.BaseRepresentation` subclass instance\n            A shallow copy of this representation, without any differentials.\n            If no differentials were present, no copy is made.\n        ","endLoc":953,"header":"def without_differentials(self)","id":2207,"name":"without_differentials","nodeType":"Function","startLoc":939,"text":"def without_differentials(self):\n        \"\"\"Return a copy of the representation without attached differentials.\n\n        Returns\n        -------\n        `~astropy.coordinates.BaseRepresentation` subclass instance\n            A shallow copy of this representation, without any differentials.\n            If no differentials were present, no copy is made.\n        \"\"\"\n\n        if not self._differentials:\n            return self\n\n        args = [getattr(self, component) for component in self.components]\n        return self.__class__(*args, copy=False)"},{"col":4,"comment":"\n        Parameters\n        ----------\n        a : BaseHDU\n            An HDU object.\n\n        b : BaseHDU\n            An HDU object to compare to the first HDU object.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\left| a - b \\right| > \\text{atol} + \\text{rtol} \\cdot \\left| b \\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n        ","endLoc":994,"header":"def __init__(self, a, b, numdiffs=10, rtol=0.0, atol=0.0)","id":2208,"name":"__init__","nodeType":"Function","startLoc":944,"text":"def __init__(self, a, b, numdiffs=10, rtol=0.0, atol=0.0):\n        \"\"\"\n        Parameters\n        ----------\n        a : BaseHDU\n            An HDU object.\n\n        b : BaseHDU\n            An HDU object to compare to the first HDU object.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\\\left| a - b \\\\right| > \\\\text{atol} + \\\\text{rtol} \\\\cdot \\\\left| b \\\\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n        \"\"\"\n\n        self.numdiffs = numdiffs\n        self.rtol = rtol\n        self.atol = atol\n\n        self.diff_dimensions = ()\n        self.diff_pixels = []\n        self.diff_ratio = 0\n\n        # self.diff_pixels only holds up to numdiffs differing pixels, but this\n        # self.diff_total stores the total count of differences between\n        # the images, but not the different values\n        self.diff_total = 0\n\n        super().__init__(a, b)"},{"col":0,"comment":"\n    Replace Time columns in a Table with non-mixin columns containing\n    each element as a vector of two doubles (jd1, jd2) and return a FITS\n    header with appropriate time coordinate keywords.\n    jd = jd1 + jd2 represents time in the Julian Date format with\n    high-precision.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        The table whose Time columns are to be replaced.\n\n    Returns\n    -------\n    table : `~astropy.table.Table`\n        The table with replaced Time columns\n    hdr : `~astropy.io.fits.header.Header`\n        Header containing global time reference frame FITS keywords\n    ","endLoc":604,"header":"def time_to_fits(table)","id":2209,"name":"time_to_fits","nodeType":"Function","startLoc":501,"text":"def time_to_fits(table):\n    \"\"\"\n    Replace Time columns in a Table with non-mixin columns containing\n    each element as a vector of two doubles (jd1, jd2) and return a FITS\n    header with appropriate time coordinate keywords.\n    jd = jd1 + jd2 represents time in the Julian Date format with\n    high-precision.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        The table whose Time columns are to be replaced.\n\n    Returns\n    -------\n    table : `~astropy.table.Table`\n        The table with replaced Time columns\n    hdr : `~astropy.io.fits.header.Header`\n        Header containing global time reference frame FITS keywords\n    \"\"\"\n    # Make a light copy of table (to the extent possible) and clear any indices along\n    # the way. Indices are not serialized and cause problems later, but they are not\n    # needed here so just drop.  For Column subclasses take advantage of copy() method,\n    # but for others it is required to actually copy the data if there are attached\n    # indices.  See #8077 and #9009 for further discussion.\n    new_cols = []\n    for col in table.itercols():\n        if isinstance(col, Column):\n            new_col = col.copy(copy_data=False)  # Also drops any indices\n        else:\n            new_col = col_copy(col, copy_indices=False) if col.info.indices else col\n        new_cols.append(new_col)\n    newtable = table.__class__(new_cols, copy=False)\n    newtable.meta = table.meta\n\n    # Global time coordinate frame keywords\n    hdr = Header([Card(keyword=key, value=val[0], comment=val[1])\n                  for key, val in GLOBAL_TIME_INFO.items()])\n\n    # Store coordinate column-specific metadata\n    newtable.meta['__coordinate_columns__'] = defaultdict(OrderedDict)\n    coord_meta = newtable.meta['__coordinate_columns__']\n\n    time_cols = table.columns.isinstance(Time)\n\n    # Geocentric location\n    location = None\n\n    for col in time_cols:\n        # By default, Time objects are written in full precision, i.e. we store both\n        # jd1 and jd2 (serialize_method['fits'] = 'jd1_jd2'). Formatted values for\n        # Time can be stored if the user explicitly chooses to do so.\n        col_cls = MaskedColumn if col.masked else Column\n        if col.info.serialize_method['fits'] == 'formatted_value':\n            newtable.replace_column(col.info.name, col_cls(col.value))\n            continue\n\n        # The following is necessary to deal with multi-dimensional ``Time`` objects\n        # (i.e. where Time.shape is non-trivial).\n        jd12 = np.stack([col.jd1, col.jd2], axis=-1)\n        # Roll the 0th (innermost) axis backwards, until it lies in the last position\n        # (jd12.ndim)\n        newtable.replace_column(col.info.name, col_cls(jd12, unit='d'))\n\n        # Time column-specific override keywords\n        coord_meta[col.info.name]['coord_type'] = col.scale.upper()\n        coord_meta[col.info.name]['coord_unit'] = 'd'\n\n        # Time column reference position\n        if getattr(col, 'location') is None:\n            coord_meta[col.info.name]['time_ref_pos'] = None\n            if location is not None:\n                warnings.warn(\n                    'Time Column \"{}\" has no specified location, but global Time '\n                    'Position is present, which will be the default for this column '\n                    'in FITS specification.'.format(col.info.name),\n                    AstropyUserWarning)\n        else:\n            coord_meta[col.info.name]['time_ref_pos'] = 'TOPOCENTER'\n            # Compatibility of Time Scales and Reference Positions\n            if col.scale in BARYCENTRIC_SCALES:\n                warnings.warn(\n                    'Earth Location \"TOPOCENTER\" for Time Column \"{}\" is incompatible '\n                    'with scale \"{}\".'.format(col.info.name, col.scale.upper()),\n                    AstropyUserWarning)\n\n            if location is None:\n                # Set global geocentric location\n                location = col.location\n                if location.size > 1:\n                    for dim in ('x', 'y', 'z'):\n                        newtable.add_column(Column(getattr(location, dim).to_value(u.m)),\n                                            name=f'OBSGEO-{dim.upper()}')\n                else:\n                    hdr.extend([Card(keyword=f'OBSGEO-{dim.upper()}',\n                                     value=getattr(location, dim).to_value(u.m))\n                                for dim in ('x', 'y', 'z')])\n            elif np.any(location != col.location):\n                raise ValueError('Multiple Time Columns with different geocentric '\n                                 'observatory locations ({}, {}) encountered.'\n                                 'This is not supported by the FITS standard.'\n                                 .format(location, col.location))\n\n    return newtable, hdr"},{"col":4,"comment":"Convert the representation to its Cartesian form.\n\n        Note that any differentials get dropped.\n        Also note that orientation information at the origin is *not* preserved by\n        conversions through Cartesian coordinates. For example, transforming\n        an angular position defined at distance=0 through cartesian coordinates\n        and back will lose the original angular coordinates::\n\n            >>> import astropy.units as u\n            >>> import astropy.coordinates as coord\n            >>> rep = coord.SphericalRepresentation(\n            ...     lon=15*u.deg,\n            ...     lat=-11*u.deg,\n            ...     distance=0*u.pc)\n            >>> rep.to_cartesian().represent_as(coord.SphericalRepresentation)\n            <SphericalRepresentation (lon, lat, distance) in (rad, rad, pc)\n                (0., 0., 0.)>\n\n        Returns\n        -------\n        cartrepr : `CartesianRepresentation`\n            The representation in Cartesian form.\n        ","endLoc":324,"header":"@abc.abstractmethod\n    def to_cartesian(self)","id":2210,"name":"to_cartesian","nodeType":"Function","startLoc":298,"text":"@abc.abstractmethod\n    def to_cartesian(self):\n        \"\"\"Convert the representation to its Cartesian form.\n\n        Note that any differentials get dropped.\n        Also note that orientation information at the origin is *not* preserved by\n        conversions through Cartesian coordinates. For example, transforming\n        an angular position defined at distance=0 through cartesian coordinates\n        and back will lose the original angular coordinates::\n\n            >>> import astropy.units as u\n            >>> import astropy.coordinates as coord\n            >>> rep = coord.SphericalRepresentation(\n            ...     lon=15*u.deg,\n            ...     lat=-11*u.deg,\n            ...     distance=0*u.pc)\n            >>> rep.to_cartesian().represent_as(coord.SphericalRepresentation)\n            <SphericalRepresentation (lon, lat, distance) in (rad, rad, pc)\n                (0., 0., 0.)>\n\n        Returns\n        -------\n        cartrepr : `CartesianRepresentation`\n            The representation in Cartesian form.\n        \"\"\"\n        # Note: the above docstring gets overridden for differentials.\n        raise NotImplementedError()"},{"col":4,"comment":"\n        Creates a new FitsHDU from a given HDUList object.\n\n        Parameters\n        ----------\n        hdulist : HDUList\n            A valid Headerlet object.\n        compress : bool, optional\n            Gzip compress the FITS file\n        ","endLoc":109,"header":"@classmethod\n    def fromhdulist(cls, hdulist, compress=False)","id":2211,"name":"fromhdulist","nodeType":"Function","startLoc":58,"text":"@classmethod\n    def fromhdulist(cls, hdulist, compress=False):\n        \"\"\"\n        Creates a new FitsHDU from a given HDUList object.\n\n        Parameters\n        ----------\n        hdulist : HDUList\n            A valid Headerlet object.\n        compress : bool, optional\n            Gzip compress the FITS file\n        \"\"\"\n\n        fileobj = bs = io.BytesIO()\n        if compress:\n            if hasattr(hdulist, '_file'):\n                name = fileobj_name(hdulist._file)\n            else:\n                name = None\n            fileobj = gzip.GzipFile(name, mode='wb', fileobj=bs)\n\n        hdulist.writeto(fileobj)\n\n        if compress:\n            fileobj.close()\n\n        # A proper HDUList should still be padded out to a multiple of 2880\n        # technically speaking\n        padding = (_pad_length(bs.tell()) * cls._padding_byte).encode('ascii')\n        bs.write(padding)\n\n        bs.seek(0)\n\n        cards = [\n            ('XTENSION', cls._extension, 'FITS extension'),\n            ('BITPIX', 8, 'array data type'),\n            ('NAXIS', 1, 'number of array dimensions'),\n            ('NAXIS1', len(bs.getvalue()), 'Axis length'),\n            ('PCOUNT', 0, 'number of parameters'),\n            ('GCOUNT', 1, 'number of groups'),\n        ]\n\n        # Add the XINDn keywords proposed by Perry, though nothing is done with\n        # these at the moment\n        if len(hdulist) > 1:\n            for idx, hdu in enumerate(hdulist[1:]):\n                cards.append(('XIND' + str(idx + 1), hdu._header_offset,\n                              f'byte offset of extension {idx + 1}'))\n\n        cards.append(('COMPRESS', compress, 'Uses gzip compression'))\n        header = Header(cards)\n        return cls._readfrom_internal(_File(bs), header=header)"},{"col":4,"comment":"null","endLoc":119,"header":"@classmethod\n    def match_header(cls, header)","id":2212,"name":"match_header","nodeType":"Function","startLoc":111,"text":"@classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        if card.keyword != 'XTENSION':\n            return False\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n        return xtension == cls._extension"},{"col":4,"comment":"Re-represent the differentials to the specified classes.\n\n        This returns a new dictionary with the same keys but with the\n        attached differentials converted to the new differential classes.\n        ","endLoc":840,"header":"def _re_represent_differentials(self, new_rep, differential_class)","id":2213,"name":"_re_represent_differentials","nodeType":"Function","startLoc":794,"text":"def _re_represent_differentials(self, new_rep, differential_class):\n        \"\"\"Re-represent the differentials to the specified classes.\n\n        This returns a new dictionary with the same keys but with the\n        attached differentials converted to the new differential classes.\n        \"\"\"\n        if differential_class is None:\n            return dict()\n\n        if not self.differentials and differential_class:\n            raise ValueError(\"No differentials associated with this \"\n                             \"representation!\")\n\n        elif (len(self.differentials) == 1 and\n                inspect.isclass(differential_class) and\n                issubclass(differential_class, BaseDifferential)):\n            # TODO: is there a better way to do this?\n            differential_class = {\n                list(self.differentials.keys())[0]: differential_class\n            }\n\n        elif differential_class.keys() != self.differentials.keys():\n            raise ValueError(\"Desired differential classes must be passed in \"\n                             \"as a dictionary with keys equal to a string \"\n                             \"representation of the unit of the derivative \"\n                             \"for each differential stored with this \"\n                             \"representation object ({0})\"\n                             .format(self.differentials))\n\n        new_diffs = dict()\n        for k in self.differentials:\n            diff = self.differentials[k]\n            try:\n                new_diffs[k] = diff.represent_as(differential_class[k],\n                                                 base=self)\n            except Exception as err:\n                if (differential_class[k] not in\n                        new_rep._compatible_differentials):\n                    raise TypeError(\"Desired differential class {} is not \"\n                                    \"compatible with the desired \"\n                                    \"representation class {}\"\n                                    .format(differential_class[k],\n                                            new_rep.__class__)) from err\n                else:\n                    raise\n\n        return new_diffs"},{"col":4,"comment":"null","endLoc":1030,"header":"def _diff(self)","id":2214,"name":"_diff","nodeType":"Function","startLoc":996,"text":"def _diff(self):\n        if self.a.shape != self.b.shape:\n            self.diff_dimensions = (self.a.shape, self.b.shape)\n            # Don't do any further comparison if the dimensions differ\n            # TODO: Perhaps we could, however, diff just the intersection\n            # between the two images\n            return\n\n        # Find the indices where the values are not equal\n        # If neither a nor b are floating point (or complex), ignore rtol and\n        # atol\n        if not (np.issubdtype(self.a.dtype, np.inexact) or\n                np.issubdtype(self.b.dtype, np.inexact)):\n            rtol = 0\n            atol = 0\n        else:\n            rtol = self.rtol\n            atol = self.atol\n\n        diffs = where_not_allclose(self.a, self.b, atol=atol, rtol=rtol)\n\n        self.diff_total = len(diffs[0])\n\n        if self.diff_total == 0:\n            # Then we're done\n            return\n\n        if self.numdiffs < 0:\n            numdiffs = self.diff_total\n        else:\n            numdiffs = self.numdiffs\n\n        self.diff_pixels = [(idx, (self.a[idx], self.b[idx]))\n                            for idx in islice(zip(*diffs), 0, numdiffs)]\n        self.diff_ratio = float(self.diff_total) / float(len(self.a.flat))"},{"col":4,"comment":"null","endLoc":125,"header":"def _summary(self)","id":2215,"name":"_summary","nodeType":"Function","startLoc":123,"text":"def _summary(self):\n        # TODO: Perhaps make this more descriptive...\n        return (self.name, self.ver, self.__class__.__name__, len(self._header))"},{"attributeType":"null","col":4,"comment":"null","endLoc":25,"id":2216,"name":"_extension","nodeType":"Attribute","startLoc":25,"text":"_extension"},{"fileName":"__init__.py","filePath":"astropy/io/fits/hdu","id":2217,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nfrom .base import (register_hdu, unregister_hdu, DELAYED, BITPIX2DTYPE,\n                   DTYPE2BITPIX)\nfrom .compressed import CompImageHDU\nfrom .groups import GroupsHDU, GroupData, Group\nfrom .hdulist import HDUList\nfrom .image import PrimaryHDU, ImageHDU\nfrom .nonstandard import FitsHDU\nfrom .streaming import StreamingHDU\nfrom .table import TableHDU, BinTableHDU\n\n__all__ = ['HDUList', 'PrimaryHDU', 'ImageHDU', 'TableHDU', 'BinTableHDU',\n           'GroupsHDU', 'GroupData', 'Group', 'CompImageHDU', 'FitsHDU',\n           'StreamingHDU', 'register_hdu', 'unregister_hdu', 'DELAYED',\n           'BITPIX2DTYPE', 'DTYPE2BITPIX']\n"},{"attributeType":"function","col":0,"comment":"null","endLoc":765,"id":2218,"name":"register_hdu","nodeType":"Attribute","startLoc":765,"text":"register_hdu"},{"attributeType":"function","col":0,"comment":"null","endLoc":766,"id":2219,"name":"unregister_hdu","nodeType":"Attribute","startLoc":766,"text":"unregister_hdu"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":2220,"name":"DELAYED","nodeType":"Attribute","startLoc":39,"text":"DELAYED"},{"attributeType":"null","col":0,"comment":"Maps FITS BITPIX values to Numpy dtype names.","endLoc":42,"id":2221,"name":"BITPIX2DTYPE","nodeType":"Attribute","startLoc":42,"text":"BITPIX2DTYPE"},{"attributeType":"null","col":0,"comment":"\nMaps Numpy dtype names to FITS BITPIX values (this includes unsigned\nintegers, with the assumption that the pseudo-unsigned integer convention\nwill be used in this case.\n","endLoc":46,"id":2222,"name":"DTYPE2BITPIX","nodeType":"Attribute","startLoc":46,"text":"DTYPE2BITPIX"},{"className":"CompImageHDU","col":0,"comment":"\n    Compressed Image HDU class.\n    ","endLoc":1976,"id":2223,"nodeType":"Class","startLoc":380,"text":"class CompImageHDU(BinTableHDU):\n    \"\"\"\n    Compressed Image HDU class.\n    \"\"\"\n\n    _manages_own_heap = True\n    \"\"\"\n    The calls to CFITSIO lay out the heap data in memory, and we write it out\n    the same way CFITSIO organizes it.  In principle this would break if a user\n    manually changes the underlying compressed data by hand, but there is no\n    reason they would want to do that (and if they do that's their\n    responsibility).\n    \"\"\"\n\n    _default_name = \"COMPRESSED_IMAGE\"\n\n    def __init__(self, data=None, header=None, name=None,\n                 compression_type=DEFAULT_COMPRESSION_TYPE,\n                 tile_size=None,\n                 hcomp_scale=DEFAULT_HCOMP_SCALE,\n                 hcomp_smooth=DEFAULT_HCOMP_SMOOTH,\n                 quantize_level=DEFAULT_QUANTIZE_LEVEL,\n                 quantize_method=DEFAULT_QUANTIZE_METHOD,\n                 dither_seed=DEFAULT_DITHER_SEED,\n                 do_not_scale_image_data=False,\n                 uint=False, scale_back=False, **kwargs):\n        \"\"\"\n        Parameters\n        ----------\n        data : array, optional\n            Uncompressed image data\n\n        header : `~astropy.io.fits.Header`, optional\n            Header to be associated with the image; when reading the HDU from a\n            file (data=DELAYED), the header read from the file\n\n        name : str, optional\n            The ``EXTNAME`` value; if this value is `None`, then the name from\n            the input image header will be used; if there is no name in the\n            input image header then the default name ``COMPRESSED_IMAGE`` is\n            used.\n\n        compression_type : str, optional\n            Compression algorithm: one of\n            ``'RICE_1'``, ``'RICE_ONE'``, ``'PLIO_1'``, ``'GZIP_1'``,\n            ``'GZIP_2'``, ``'HCOMPRESS_1'``\n\n        tile_size : int, optional\n            Compression tile sizes.  Default treats each row of image as a\n            tile.\n\n        hcomp_scale : float, optional\n            HCOMPRESS scale parameter\n\n        hcomp_smooth : float, optional\n            HCOMPRESS smooth parameter\n\n        quantize_level : float, optional\n            Floating point quantization level; see note below\n\n        quantize_method : int, optional\n            Floating point quantization dithering method; can be either\n            ``NO_DITHER`` (-1; default), ``SUBTRACTIVE_DITHER_1`` (1), or\n            ``SUBTRACTIVE_DITHER_2`` (2); see note below\n\n        dither_seed : int, optional\n            Random seed to use for dithering; can be either an integer in the\n            range 1 to 1000 (inclusive), ``DITHER_SEED_CLOCK`` (0; default), or\n            ``DITHER_SEED_CHECKSUM`` (-1); see note below\n\n        Notes\n        -----\n        The astropy.io.fits package supports 2 methods of image compression:\n\n            1) The entire FITS file may be externally compressed with the gzip\n               or pkzip utility programs, producing a ``*.gz`` or ``*.zip``\n               file, respectively.  When reading compressed files of this type,\n               Astropy first uncompresses the entire file into a temporary file\n               before performing the requested read operations.  The\n               astropy.io.fits package does not support writing to these types\n               of compressed files.  This type of compression is supported in\n               the ``_File`` class, not in the `CompImageHDU` class.  The file\n               compression type is recognized by the ``.gz`` or ``.zip`` file\n               name extension.\n\n            2) The `CompImageHDU` class supports the FITS tiled image\n               compression convention in which the image is subdivided into a\n               grid of rectangular tiles, and each tile of pixels is\n               individually compressed.  The details of this FITS compression\n               convention are described at the `FITS Support Office web site\n               <https://fits.gsfc.nasa.gov/registry/tilecompression.html>`_.\n               Basically, the compressed image tiles are stored in rows of a\n               variable length array column in a FITS binary table.  The\n               astropy.io.fits recognizes that this binary table extension\n               contains an image and treats it as if it were an image\n               extension.  Under this tile-compression format, FITS header\n               keywords remain uncompressed.  At this time, Astropy does not\n               support the ability to extract and uncompress sections of the\n               image without having to uncompress the entire image.\n\n        The astropy.io.fits package supports 3 general-purpose compression\n        algorithms plus one other special-purpose compression technique that is\n        designed for data masks with positive integer pixel values.  The 3\n        general purpose algorithms are GZIP, Rice, and HCOMPRESS, and the\n        special-purpose technique is the IRAF pixel list compression technique\n        (PLIO).  The ``compression_type`` parameter defines the compression\n        algorithm to be used.\n\n        The FITS image can be subdivided into any desired rectangular grid of\n        compression tiles.  With the GZIP, Rice, and PLIO algorithms, the\n        default is to take each row of the image as a tile.  The HCOMPRESS\n        algorithm is inherently 2-dimensional in nature, so the default in this\n        case is to take 16 rows of the image per tile.  In most cases, it makes\n        little difference what tiling pattern is used, so the default tiles are\n        usually adequate.  In the case of very small images, it could be more\n        efficient to compress the whole image as a single tile.  Note that the\n        image dimensions are not required to be an integer multiple of the tile\n        dimensions; if not, then the tiles at the edges of the image will be\n        smaller than the other tiles.  The ``tile_size`` parameter may be\n        provided as a list of tile sizes, one for each dimension in the image.\n        For example a ``tile_size`` value of ``[100,100]`` would divide a 300 X\n        300 image into 9 100 X 100 tiles.\n\n        The 4 supported image compression algorithms are all 'lossless' when\n        applied to integer FITS images; the pixel values are preserved exactly\n        with no loss of information during the compression and uncompression\n        process.  In addition, the HCOMPRESS algorithm supports a 'lossy'\n        compression mode that will produce larger amount of image compression.\n        This is achieved by specifying a non-zero value for the ``hcomp_scale``\n        parameter.  Since the amount of compression that is achieved depends\n        directly on the RMS noise in the image, it is usually more convenient\n        to specify the ``hcomp_scale`` factor relative to the RMS noise.\n        Setting ``hcomp_scale = 2.5`` means use a scale factor that is 2.5\n        times the calculated RMS noise in the image tile.  In some cases it may\n        be desirable to specify the exact scaling to be used, instead of\n        specifying it relative to the calculated noise value.  This may be done\n        by specifying the negative of the desired scale value (typically in the\n        range -2 to -100).\n\n        Very high compression factors (of 100 or more) can be achieved by using\n        large ``hcomp_scale`` values, however, this can produce undesirable\n        'blocky' artifacts in the compressed image.  A variation of the\n        HCOMPRESS algorithm (called HSCOMPRESS) can be used in this case to\n        apply a small amount of smoothing of the image when it is uncompressed\n        to help cover up these artifacts.  This smoothing is purely cosmetic\n        and does not cause any significant change to the image pixel values.\n        Setting the ``hcomp_smooth`` parameter to 1 will engage the smoothing\n        algorithm.\n\n        Floating point FITS images (which have ``BITPIX`` = -32 or -64) usually\n        contain too much 'noise' in the least significant bits of the mantissa\n        of the pixel values to be effectively compressed with any lossless\n        algorithm.  Consequently, floating point images are first quantized\n        into scaled integer pixel values (and thus throwing away much of the\n        noise) before being compressed with the specified algorithm (either\n        GZIP, RICE, or HCOMPRESS).  This technique produces much higher\n        compression factors than simply using the GZIP utility to externally\n        compress the whole FITS file, but it also means that the original\n        floating point value pixel values are not exactly preserved.  When done\n        properly, this integer scaling technique will only discard the\n        insignificant noise while still preserving all the real information in\n        the image.  The amount of precision that is retained in the pixel\n        values is controlled by the ``quantize_level`` parameter.  Larger\n        values will result in compressed images whose pixels more closely match\n        the floating point pixel values, but at the same time the amount of\n        compression that is achieved will be reduced.  Users should experiment\n        with different values for this parameter to determine the optimal value\n        that preserves all the useful information in the image, without\n        needlessly preserving all the 'noise' which will hurt the compression\n        efficiency.\n\n        The default value for the ``quantize_level`` scale factor is 16, which\n        means that scaled integer pixel values will be quantized such that the\n        difference between adjacent integer values will be 1/16th of the noise\n        level in the image background.  An optimized algorithm is used to\n        accurately estimate the noise in the image.  As an example, if the RMS\n        noise in the background pixels of an image = 32.0, then the spacing\n        between adjacent scaled integer pixel values will equal 2.0 by default.\n        Note that the RMS noise is independently calculated for each tile of\n        the image, so the resulting integer scaling factor may fluctuate\n        slightly for each tile.  In some cases, it may be desirable to specify\n        the exact quantization level to be used, instead of specifying it\n        relative to the calculated noise value.  This may be done by specifying\n        the negative of desired quantization level for the value of\n        ``quantize_level``.  In the previous example, one could specify\n        ``quantize_level = -2.0`` so that the quantized integer levels differ\n        by 2.0.  Larger negative values for ``quantize_level`` means that the\n        levels are more coarsely-spaced, and will produce higher compression\n        factors.\n\n        The quantization algorithm can also apply one of two random dithering\n        methods in order to reduce bias in the measured intensity of background\n        regions.  The default method, specified with the constant\n        ``SUBTRACTIVE_DITHER_1`` adds dithering to the zero-point of the\n        quantization array itself rather than adding noise to the actual image.\n        The random noise is added on a pixel-by-pixel basis, so in order\n        restore each pixel from its integer value to its floating point value\n        it is necessary to replay the same sequence of random numbers for each\n        pixel (see below).  The other method, ``SUBTRACTIVE_DITHER_2``, is\n        exactly like the first except that before dithering any pixel with a\n        floating point value of ``0.0`` is replaced with the special integer\n        value ``-2147483647``.  When the image is uncompressed, pixels with\n        this value are restored back to ``0.0`` exactly.  Finally, a value of\n        ``NO_DITHER`` disables dithering entirely.\n\n        As mentioned above, when using the subtractive dithering algorithm it\n        is necessary to be able to generate a (pseudo-)random sequence of noise\n        for each pixel, and replay that same sequence upon decompressing.  To\n        facilitate this, a random seed between 1 and 10000 (inclusive) is used\n        to seed a random number generator, and that seed is stored in the\n        ``ZDITHER0`` keyword in the header of the compressed HDU.  In order to\n        use that seed to generate the same sequence of random numbers the same\n        random number generator must be used at compression and decompression\n        time; for that reason the tiled image convention provides an\n        implementation of a very simple pseudo-random number generator.  The\n        seed itself can be provided in one of three ways, controllable by the\n        ``dither_seed`` argument:  It may be specified manually, or it may be\n        generated arbitrarily based on the system's clock\n        (``DITHER_SEED_CLOCK``) or based on a checksum of the pixels in the\n        image's first tile (``DITHER_SEED_CHECKSUM``).  The clock-based method\n        is the default, and is sufficient to ensure that the value is\n        reasonably \"arbitrary\" and that the same seed is unlikely to be\n        generated sequentially.  The checksum method, on the other hand,\n        ensures that the same seed is used every time for a specific image.\n        This is particularly useful for software testing as it ensures that the\n        same image will always use the same seed.\n        \"\"\"\n\n        if not COMPRESSION_SUPPORTED:\n            # TODO: Raise a more specific Exception type\n            raise Exception('The astropy.io.fits.compression module is not '\n                            'available.  Creation of compressed image HDUs is '\n                            'disabled.')\n\n        compression_type = CMTYPE_ALIASES.get(compression_type, compression_type)\n\n        if data is DELAYED:\n            # Reading the HDU from a file\n            super().__init__(data=data, header=header)\n        else:\n            # Create at least a skeleton HDU that matches the input\n            # header and data (if any were input)\n            super().__init__(data=None, header=header)\n\n            # Store the input image data\n            self.data = data\n\n            # Update the table header (_header) to the compressed\n            # image format and to match the input data (if any);\n            # Create the image header (_image_header) from the input\n            # image header (if any) and ensure it matches the input\n            # data; Create the initially empty table data array to\n            # hold the compressed data.\n            self._update_header_data(header, name,\n                                     compression_type=compression_type,\n                                     tile_size=tile_size,\n                                     hcomp_scale=hcomp_scale,\n                                     hcomp_smooth=hcomp_smooth,\n                                     quantize_level=quantize_level,\n                                     quantize_method=quantize_method,\n                                     dither_seed=dither_seed)\n\n        # TODO: A lot of this should be passed on to an internal image HDU o\n        # something like that, see ticket #88\n        self._do_not_scale_image_data = do_not_scale_image_data\n        self._uint = uint\n        self._scale_back = scale_back\n\n        self._axes = [self._header.get('ZNAXIS' + str(axis + 1), 0)\n                      for axis in range(self._header.get('ZNAXIS', 0))]\n\n        # store any scale factors from the table header\n        if do_not_scale_image_data:\n            self._bzero = 0\n            self._bscale = 1\n        else:\n            self._bzero = self._header.get('BZERO', 0)\n            self._bscale = self._header.get('BSCALE', 1)\n        self._bitpix = self._header['ZBITPIX']\n\n        self._orig_bzero = self._bzero\n        self._orig_bscale = self._bscale\n        self._orig_bitpix = self._bitpix\n\n    def _remove_unnecessary_default_extnames(self, header):\n        \"\"\"Remove default EXTNAME values if they are unnecessary.\n\n        Some data files (eg from CFHT) can have the default EXTNAME and\n        an explicit value.  This method removes the default if a more\n        specific header exists. It also removes any duplicate default\n        values.\n        \"\"\"\n        if 'EXTNAME' in header:\n            indices = header._keyword_indices['EXTNAME']\n            # Only continue if there is more than one found\n            n_extname = len(indices)\n            if n_extname > 1:\n                extnames_to_remove = [index for index in indices\n                                      if header[index] == self._default_name]\n                if len(extnames_to_remove) == n_extname:\n                    # Keep the first (they are all the same)\n                    extnames_to_remove.pop(0)\n                # Remove them all in reverse order to keep the index unchanged.\n                for index in reversed(sorted(extnames_to_remove)):\n                    del header[index]\n\n    @property\n    def name(self):\n        # Convert the value to a string to be flexible in some pathological\n        # cases (see ticket #96)\n        # Similar to base class but uses .header rather than ._header\n        return str(self.header.get('EXTNAME', self._default_name))\n\n    @name.setter\n    def name(self, value):\n        # This is a copy of the base class but using .header instead\n        # of ._header to ensure that the name stays in sync.\n        if not isinstance(value, str):\n            raise TypeError(\"'name' attribute must be a string\")\n        if not conf.extension_name_case_sensitive:\n            value = value.upper()\n        if 'EXTNAME' in self.header:\n            self.header['EXTNAME'] = value\n        else:\n            self.header['EXTNAME'] = (value, 'extension name')\n\n    @classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        if card.keyword != 'XTENSION':\n            return False\n\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n\n        if xtension not in ('BINTABLE', 'A3DTABLE'):\n            return False\n\n        if 'ZIMAGE' not in header or not header['ZIMAGE']:\n            return False\n\n        if COMPRESSION_SUPPORTED and COMPRESSION_ENABLED:\n            return True\n        elif not COMPRESSION_SUPPORTED:\n            warnings.warn('Failure matching header to a compressed image '\n                          'HDU: The compression module is not available.\\n'\n                          'The HDU will be treated as a Binary Table HDU.',\n                          AstropyUserWarning)\n            return False\n        else:\n            # Compression is supported but disabled; just pass silently (#92)\n            return False\n\n    def _update_header_data(self, image_header,\n                            name=None,\n                            compression_type=None,\n                            tile_size=None,\n                            hcomp_scale=None,\n                            hcomp_smooth=None,\n                            quantize_level=None,\n                            quantize_method=None,\n                            dither_seed=None):\n        \"\"\"\n        Update the table header (`_header`) to the compressed\n        image format and to match the input data (if any).  Create\n        the image header (`_image_header`) from the input image\n        header (if any) and ensure it matches the input\n        data. Create the initially-empty table data array to hold\n        the compressed data.\n\n        This method is mainly called internally, but a user may wish to\n        call this method after assigning new data to the `CompImageHDU`\n        object that is of a different type.\n\n        Parameters\n        ----------\n        image_header : `~astropy.io.fits.Header`\n            header to be associated with the image\n\n        name : str, optional\n            the ``EXTNAME`` value; if this value is `None`, then the name from\n            the input image header will be used; if there is no name in the\n            input image header then the default name 'COMPRESSED_IMAGE' is used\n\n        compression_type : str, optional\n            compression algorithm 'RICE_1', 'PLIO_1', 'GZIP_1', 'GZIP_2',\n            'HCOMPRESS_1'; if this value is `None`, use value already in the\n            header; if no value already in the header, use 'RICE_1'\n\n        tile_size : sequence of int, optional\n            compression tile sizes as a list; if this value is `None`, use\n            value already in the header; if no value already in the header,\n            treat each row of image as a tile\n\n        hcomp_scale : float, optional\n            HCOMPRESS scale parameter; if this value is `None`, use the value\n            already in the header; if no value already in the header, use 1\n\n        hcomp_smooth : float, optional\n            HCOMPRESS smooth parameter; if this value is `None`, use the value\n            already in the header; if no value already in the header, use 0\n\n        quantize_level : float, optional\n            floating point quantization level; if this value is `None`, use the\n            value already in the header; if no value already in header, use 16\n\n        quantize_method : int, optional\n            floating point quantization dithering method; can be either\n            NO_DITHER (-1), SUBTRACTIVE_DITHER_1 (1; default), or\n            SUBTRACTIVE_DITHER_2 (2)\n\n        dither_seed : int, optional\n            random seed to use for dithering; can be either an integer in the\n            range 1 to 1000 (inclusive), DITHER_SEED_CLOCK (0; default), or\n            DITHER_SEED_CHECKSUM (-1)\n        \"\"\"\n\n        # Clean up EXTNAME duplicates\n        self._remove_unnecessary_default_extnames(self._header)\n\n        image_hdu = ImageHDU(data=self.data, header=self._header)\n        self._image_header = CompImageHeader(self._header, image_hdu.header)\n        self._axes = image_hdu._axes\n        del image_hdu\n\n        # Determine based on the size of the input data whether to use the Q\n        # column format to store compressed data or the P format.\n        # The Q format is used only if the uncompressed data is larger than\n        # 4 GB.  This is not a perfect heuristic, as one can contrive an input\n        # array which, when compressed, the entire binary table representing\n        # the compressed data is larger than 4GB.  That said, this is the same\n        # heuristic used by CFITSIO, so this should give consistent results.\n        # And the cases where this heuristic is insufficient are extreme and\n        # almost entirely contrived corner cases, so it will do for now\n        if self._has_data:\n            huge_hdu = self.data.nbytes > 2 ** 32\n        else:\n            huge_hdu = False\n\n        # Update the extension name in the table header\n        if not name and 'EXTNAME' not in self._header:\n            # Do not sync this with the image header since the default\n            # name is specific to the table header.\n            self._header.set('EXTNAME', self._default_name,\n                             'name of this binary table extension',\n                             after='TFIELDS')\n        elif name:\n            # Force the name into table and image headers.\n            self.name = name\n\n        # Set the compression type in the table header.\n        if compression_type:\n            if compression_type not in COMPRESSION_TYPES:\n                warnings.warn(\n                    'Unknown compression type provided (supported are {}). '\n                    'Default ({}) compression will be used.'\n                    .format(', '.join(map(repr, COMPRESSION_TYPES)),\n                            DEFAULT_COMPRESSION_TYPE),\n                    AstropyUserWarning)\n                compression_type = DEFAULT_COMPRESSION_TYPE\n\n            self._header.set('ZCMPTYPE', compression_type,\n                             'compression algorithm', after='TFIELDS')\n        else:\n            compression_type = self._header.get('ZCMPTYPE',\n                                                DEFAULT_COMPRESSION_TYPE)\n            compression_type = CMTYPE_ALIASES.get(compression_type,\n                                                  compression_type)\n\n        # If the input image header had BSCALE/BZERO cards, then insert\n        # them in the table header.\n\n        if image_header:\n            bzero = image_header.get('BZERO', 0.0)\n            bscale = image_header.get('BSCALE', 1.0)\n            after_keyword = 'EXTNAME'\n\n            if bscale != 1.0:\n                self._header.set('BSCALE', bscale, after=after_keyword)\n                after_keyword = 'BSCALE'\n\n            if bzero != 0.0:\n                self._header.set('BZERO', bzero, after=after_keyword)\n\n        try:\n            bitpix_comment = image_header.comments['BITPIX']\n        except (AttributeError, KeyError):\n            bitpix_comment = 'data type of original image'\n\n        try:\n            naxis_comment = image_header.comments['NAXIS']\n        except (AttributeError, KeyError):\n            naxis_comment = 'dimension of original image'\n\n        # Set the label for the first column in the table\n\n        self._header.set('TTYPE1', 'COMPRESSED_DATA', 'label for field 1',\n                         after='TFIELDS')\n\n        # Set the data format for the first column.  It is dependent\n        # on the requested compression type.\n\n        if compression_type == 'PLIO_1':\n            tform1 = '1QI' if huge_hdu else '1PI'\n        else:\n            tform1 = '1QB' if huge_hdu else '1PB'\n\n        self._header.set('TFORM1', tform1,\n                         'data format of field: variable length array',\n                         after='TTYPE1')\n\n        # Create the first column for the table.  This column holds the\n        # compressed data.\n        col1 = Column(name=self._header['TTYPE1'], format=tform1)\n\n        # Create the additional columns required for floating point\n        # data and calculate the width of the output table.\n\n        zbitpix = self._image_header['BITPIX']\n\n        if zbitpix < 0 and quantize_level != 0.0:\n            # floating point image has 'COMPRESSED_DATA',\n            # 'UNCOMPRESSED_DATA', 'ZSCALE', and 'ZZERO' columns (unless using\n            # lossless compression, per CFITSIO)\n            ncols = 4\n\n            # CFITSIO 3.28 and up automatically use the GZIP_COMPRESSED_DATA\n            # store floating point data that couldn't be quantized, instead\n            # of the UNCOMPRESSED_DATA column.  There's no way to control\n            # this behavior so the only way to determine which behavior will\n            # be employed is via the CFITSIO version\n\n            ttype2 = 'GZIP_COMPRESSED_DATA'\n            # The required format for the GZIP_COMPRESSED_DATA is actually\n            # missing from the standard docs, but CFITSIO suggests it\n            # should be 1PB, which is logical.\n            tform2 = '1QB' if huge_hdu else '1PB'\n\n            # Set up the second column for the table that will hold any\n            # uncompressable data.\n            self._header.set('TTYPE2', ttype2, 'label for field 2',\n                             after='TFORM1')\n\n            self._header.set('TFORM2', tform2,\n                             'data format of field: variable length array',\n                             after='TTYPE2')\n\n            col2 = Column(name=ttype2, format=tform2)\n\n            # Set up the third column for the table that will hold\n            # the scale values for quantized data.\n            self._header.set('TTYPE3', 'ZSCALE', 'label for field 3',\n                             after='TFORM2')\n            self._header.set('TFORM3', '1D',\n                             'data format of field: 8-byte DOUBLE',\n                             after='TTYPE3')\n            col3 = Column(name=self._header['TTYPE3'],\n                          format=self._header['TFORM3'])\n\n            # Set up the fourth column for the table that will hold\n            # the zero values for the quantized data.\n            self._header.set('TTYPE4', 'ZZERO', 'label for field 4',\n                             after='TFORM3')\n            self._header.set('TFORM4', '1D',\n                             'data format of field: 8-byte DOUBLE',\n                             after='TTYPE4')\n            after = 'TFORM4'\n            col4 = Column(name=self._header['TTYPE4'],\n                          format=self._header['TFORM4'])\n\n            # Create the ColDefs object for the table\n            cols = ColDefs([col1, col2, col3, col4])\n        else:\n            # default table has just one 'COMPRESSED_DATA' column\n            ncols = 1\n            after = 'TFORM1'\n\n            # remove any header cards for the additional columns that\n            # may be left over from the previous data\n            to_remove = ['TTYPE2', 'TFORM2', 'TTYPE3', 'TFORM3', 'TTYPE4',\n                         'TFORM4']\n\n            for k in to_remove:\n                try:\n                    del self._header[k]\n                except KeyError:\n                    pass\n\n            # Create the ColDefs object for the table\n            cols = ColDefs([col1])\n\n        # Update the table header with the width of the table, the\n        # number of fields in the table, the indicator for a compressed\n        # image HDU, the data type of the image data and the number of\n        # dimensions in the image data array.\n        self._header.set('NAXIS1', cols.dtype.itemsize,\n                         'width of table in bytes')\n        self._header.set('TFIELDS', ncols, 'number of fields in each row',\n                         after='GCOUNT')\n        self._header.set('ZIMAGE', True, 'extension contains compressed image',\n                         after=after)\n        self._header.set('ZBITPIX', zbitpix,\n                         bitpix_comment, after='ZIMAGE')\n        self._header.set('ZNAXIS', self._image_header['NAXIS'], naxis_comment,\n                         after='ZBITPIX')\n\n        # Strip the table header of all the ZNAZISn and ZTILEn keywords\n        # that may be left over from the previous data\n\n        for idx in itertools.count(1):\n            try:\n                del self._header['ZNAXIS' + str(idx)]\n                del self._header['ZTILE' + str(idx)]\n            except KeyError:\n                break\n\n        # Verify that any input tile size parameter is the appropriate\n        # size to match the HDU's data.\n\n        naxis = self._image_header['NAXIS']\n\n        if not tile_size:\n            tile_size = []\n        elif len(tile_size) != naxis:\n            warnings.warn('Provided tile size not appropriate for the data.  '\n                          'Default tile size will be used.', AstropyUserWarning)\n            tile_size = []\n\n        # Set default tile dimensions for HCOMPRESS_1\n\n        if compression_type == 'HCOMPRESS_1':\n            if (self._image_header['NAXIS1'] < 4 or\n                    self._image_header['NAXIS2'] < 4):\n                raise ValueError('Hcompress minimum image dimension is '\n                                 '4 pixels')\n            elif tile_size:\n                if tile_size[0] < 4 or tile_size[1] < 4:\n                    # user specified tile size is too small\n                    raise ValueError('Hcompress minimum tile dimension is '\n                                     '4 pixels')\n                major_dims = len([ts for ts in tile_size if ts > 1])\n                if major_dims > 2:\n                    raise ValueError(\n                        'HCOMPRESS can only support 2-dimensional tile sizes.'\n                        'All but two of the tile_size dimensions must be set '\n                        'to 1.')\n\n            if tile_size and (tile_size[0] == 0 and tile_size[1] == 0):\n                # compress the whole image as a single tile\n                tile_size[0] = self._image_header['NAXIS1']\n                tile_size[1] = self._image_header['NAXIS2']\n\n                for i in range(2, naxis):\n                    # set all higher tile dimensions = 1\n                    tile_size[i] = 1\n            elif not tile_size:\n                # The Hcompress algorithm is inherently 2D in nature, so the\n                # row by row tiling that is used for other compression\n                # algorithms is not appropriate.  If the image has less than 30\n                # rows, then the entire image will be compressed as a single\n                # tile.  Otherwise the tiles will consist of 16 rows of the\n                # image.  This keeps the tiles to a reasonable size, and it\n                # also includes enough rows to allow good compression\n                # efficiency.  It the last tile of the image happens to contain\n                # less than 4 rows, then find another tile size with between 14\n                # and 30 rows (preferably even), so that the last tile has at\n                # least 4 rows.\n\n                # 1st tile dimension is the row length of the image\n                tile_size.append(self._image_header['NAXIS1'])\n\n                if self._image_header['NAXIS2'] <= 30:\n                    tile_size.append(self._image_header['NAXIS1'])\n                else:\n                    # look for another good tile dimension\n                    naxis2 = self._image_header['NAXIS2']\n                    for dim in [16, 24, 20, 30, 28, 26, 22, 18, 14]:\n                        if naxis2 % dim == 0 or naxis2 % dim > 3:\n                            tile_size.append(dim)\n                            break\n                    else:\n                        tile_size.append(17)\n\n                for i in range(2, naxis):\n                    # set all higher tile dimensions = 1\n                    tile_size.append(1)\n\n            # check if requested tile size causes the last tile to have\n            # less than 4 pixels\n\n            remain = self._image_header['NAXIS1'] % tile_size[0]  # 1st dimen\n\n            if remain > 0 and remain < 4:\n                tile_size[0] += 1  # try increasing tile size by 1\n\n                remain = self._image_header['NAXIS1'] % tile_size[0]\n\n                if remain > 0 and remain < 4:\n                    raise ValueError('Last tile along 1st dimension has '\n                                     'less than 4 pixels')\n\n            remain = self._image_header['NAXIS2'] % tile_size[1]  # 2nd dimen\n\n            if remain > 0 and remain < 4:\n                tile_size[1] += 1  # try increasing tile size by 1\n\n                remain = self._image_header['NAXIS2'] % tile_size[1]\n\n                if remain > 0 and remain < 4:\n                    raise ValueError('Last tile along 2nd dimension has '\n                                     'less than 4 pixels')\n\n        # Set up locations for writing the next cards in the header.\n        last_znaxis = 'ZNAXIS'\n\n        if self._image_header['NAXIS'] > 0:\n            after1 = 'ZNAXIS1'\n        else:\n            after1 = 'ZNAXIS'\n\n        # Calculate the number of rows in the output table and\n        # write the ZNAXISn and ZTILEn cards to the table header.\n        nrows = 0\n\n        for idx, axis in enumerate(self._axes):\n            naxis = 'NAXIS' + str(idx + 1)\n            znaxis = 'ZNAXIS' + str(idx + 1)\n            ztile = 'ZTILE' + str(idx + 1)\n\n            if tile_size and len(tile_size) >= idx + 1:\n                ts = tile_size[idx]\n            else:\n                if ztile not in self._header:\n                    # Default tile size\n                    if not idx:\n                        ts = self._image_header['NAXIS1']\n                    else:\n                        ts = 1\n                else:\n                    ts = self._header[ztile]\n                tile_size.append(ts)\n\n            if not nrows:\n                nrows = (axis - 1) // ts + 1\n            else:\n                nrows *= ((axis - 1) // ts + 1)\n\n            if image_header and naxis in image_header:\n                self._header.set(znaxis, axis, image_header.comments[naxis],\n                                 after=last_znaxis)\n            else:\n                self._header.set(znaxis, axis,\n                                 'length of original image axis',\n                                 after=last_znaxis)\n\n            self._header.set(ztile, ts, 'size of tiles to be compressed',\n                             after=after1)\n            last_znaxis = znaxis\n            after1 = ztile\n\n        # Set the NAXIS2 header card in the table hdu to the number of\n        # rows in the table.\n        self._header.set('NAXIS2', nrows, 'number of rows in table')\n\n        self.columns = cols\n\n        # Set the compression parameters in the table header.\n\n        # First, setup the values to be used for the compression parameters\n        # in case none were passed in.  This will be either the value\n        # already in the table header for that parameter or the default\n        # value.\n        for idx in itertools.count(1):\n            zname = 'ZNAME' + str(idx)\n            if zname not in self._header:\n                break\n            zval = 'ZVAL' + str(idx)\n            if self._header[zname] == 'NOISEBIT':\n                if quantize_level is None:\n                    quantize_level = self._header[zval]\n            if self._header[zname] == 'SCALE   ':\n                if hcomp_scale is None:\n                    hcomp_scale = self._header[zval]\n            if self._header[zname] == 'SMOOTH  ':\n                if hcomp_smooth is None:\n                    hcomp_smooth = self._header[zval]\n\n        if quantize_level is None:\n            quantize_level = DEFAULT_QUANTIZE_LEVEL\n\n        if hcomp_scale is None:\n            hcomp_scale = DEFAULT_HCOMP_SCALE\n\n        if hcomp_smooth is None:\n            hcomp_smooth = DEFAULT_HCOMP_SCALE\n\n        # Next, strip the table header of all the ZNAMEn and ZVALn keywords\n        # that may be left over from the previous data\n        for idx in itertools.count(1):\n            zname = 'ZNAME' + str(idx)\n            if zname not in self._header:\n                break\n            zval = 'ZVAL' + str(idx)\n            del self._header[zname]\n            del self._header[zval]\n\n        # Finally, put the appropriate keywords back based on the\n        # compression type.\n\n        after_keyword = 'ZCMPTYPE'\n        idx = 1\n\n        if compression_type == 'RICE_1':\n            self._header.set('ZNAME1', 'BLOCKSIZE', 'compression block size',\n                             after=after_keyword)\n            self._header.set('ZVAL1', DEFAULT_BLOCK_SIZE, 'pixels per block',\n                             after='ZNAME1')\n\n            self._header.set('ZNAME2', 'BYTEPIX',\n                             'bytes per pixel (1, 2, 4, or 8)', after='ZVAL1')\n\n            if self._header['ZBITPIX'] == 8:\n                bytepix = 1\n            elif self._header['ZBITPIX'] == 16:\n                bytepix = 2\n            else:\n                bytepix = DEFAULT_BYTE_PIX\n\n            self._header.set('ZVAL2', bytepix,\n                             'bytes per pixel (1, 2, 4, or 8)',\n                             after='ZNAME2')\n            after_keyword = 'ZVAL2'\n            idx = 3\n        elif compression_type == 'HCOMPRESS_1':\n            self._header.set('ZNAME1', 'SCALE', 'HCOMPRESS scale factor',\n                             after=after_keyword)\n            self._header.set('ZVAL1', hcomp_scale, 'HCOMPRESS scale factor',\n                             after='ZNAME1')\n            self._header.set('ZNAME2', 'SMOOTH', 'HCOMPRESS smooth option',\n                             after='ZVAL1')\n            self._header.set('ZVAL2', hcomp_smooth, 'HCOMPRESS smooth option',\n                             after='ZNAME2')\n            after_keyword = 'ZVAL2'\n            idx = 3\n\n        if self._image_header['BITPIX'] < 0:   # floating point image\n            self._header.set('ZNAME' + str(idx), 'NOISEBIT',\n                             'floating point quantization level',\n                             after=after_keyword)\n            self._header.set('ZVAL' + str(idx), quantize_level,\n                             'floating point quantization level',\n                             after='ZNAME' + str(idx))\n\n            # Add the dither method and seed\n            if quantize_method:\n                if quantize_method not in [NO_DITHER, SUBTRACTIVE_DITHER_1,\n                                           SUBTRACTIVE_DITHER_2]:\n                    name = QUANTIZE_METHOD_NAMES[DEFAULT_QUANTIZE_METHOD]\n                    warnings.warn('Unknown quantization method provided.  '\n                                  'Default method ({}) used.'.format(name))\n                    quantize_method = DEFAULT_QUANTIZE_METHOD\n\n                if quantize_method == NO_DITHER:\n                    zquantiz_comment = 'No dithering during quantization'\n                else:\n                    zquantiz_comment = 'Pixel Quantization Algorithm'\n\n                self._header.set('ZQUANTIZ',\n                                 QUANTIZE_METHOD_NAMES[quantize_method],\n                                 zquantiz_comment,\n                                 after='ZVAL' + str(idx))\n            else:\n                # If the ZQUANTIZ keyword is missing the default is to assume\n                # no dithering, rather than whatever DEFAULT_QUANTIZE_METHOD\n                # is set to\n                quantize_method = self._header.get('ZQUANTIZ', NO_DITHER)\n\n                if isinstance(quantize_method, str):\n                    for k, v in QUANTIZE_METHOD_NAMES.items():\n                        if v.upper() == quantize_method:\n                            quantize_method = k\n                            break\n                    else:\n                        quantize_method = NO_DITHER\n\n            if quantize_method == NO_DITHER:\n                if 'ZDITHER0' in self._header:\n                    # If dithering isn't being used then there's no reason to\n                    # keep the ZDITHER0 keyword\n                    del self._header['ZDITHER0']\n            else:\n                if dither_seed:\n                    dither_seed = self._generate_dither_seed(dither_seed)\n                elif 'ZDITHER0' in self._header:\n                    dither_seed = self._header['ZDITHER0']\n                else:\n                    dither_seed = self._generate_dither_seed(\n                            DEFAULT_DITHER_SEED)\n\n                self._header.set('ZDITHER0', dither_seed,\n                                 'dithering offset when quantizing floats',\n                                 after='ZQUANTIZ')\n\n        if image_header:\n            # Move SIMPLE card from the image header to the\n            # table header as ZSIMPLE card.\n\n            if 'SIMPLE' in image_header:\n                self._header.set('ZSIMPLE', image_header['SIMPLE'],\n                                 image_header.comments['SIMPLE'],\n                                 before='ZBITPIX')\n\n            # Move EXTEND card from the image header to the\n            # table header as ZEXTEND card.\n\n            if 'EXTEND' in image_header:\n                self._header.set('ZEXTEND', image_header['EXTEND'],\n                                 image_header.comments['EXTEND'])\n\n            # Move BLOCKED card from the image header to the\n            # table header as ZBLOCKED card.\n\n            if 'BLOCKED' in image_header:\n                self._header.set('ZBLOCKED', image_header['BLOCKED'],\n                                 image_header.comments['BLOCKED'])\n\n            # Move XTENSION card from the image header to the\n            # table header as ZTENSION card.\n\n            # Since we only handle compressed IMAGEs, ZTENSION should\n            # always be IMAGE, even if the caller has passed in a header\n            # for some other type of extension.\n            if 'XTENSION' in image_header:\n                self._header.set('ZTENSION', 'IMAGE',\n                                 image_header.comments['XTENSION'],\n                                 before='ZBITPIX')\n\n            # Move PCOUNT and GCOUNT cards from image header to the table\n            # header as ZPCOUNT and ZGCOUNT cards.\n\n            if 'PCOUNT' in image_header:\n                self._header.set('ZPCOUNT', image_header['PCOUNT'],\n                                 image_header.comments['PCOUNT'],\n                                 after=last_znaxis)\n\n            if 'GCOUNT' in image_header:\n                self._header.set('ZGCOUNT', image_header['GCOUNT'],\n                                 image_header.comments['GCOUNT'],\n                                 after='ZPCOUNT')\n\n            # Move CHECKSUM and DATASUM cards from the image header to the\n            # table header as XHECKSUM and XDATASUM cards.\n\n            if 'CHECKSUM' in image_header:\n                self._header.set('ZHECKSUM', image_header['CHECKSUM'],\n                                 image_header.comments['CHECKSUM'])\n\n            if 'DATASUM' in image_header:\n                self._header.set('ZDATASUM', image_header['DATASUM'],\n                                 image_header.comments['DATASUM'])\n        else:\n            # Move XTENSION card from the image header to the\n            # table header as ZTENSION card.\n\n            # Since we only handle compressed IMAGEs, ZTENSION should\n            # always be IMAGE, even if the caller has passed in a header\n            # for some other type of extension.\n            if 'XTENSION' in self._image_header:\n                self._header.set('ZTENSION', 'IMAGE',\n                                 self._image_header.comments['XTENSION'],\n                                 before='ZBITPIX')\n\n            # Move PCOUNT and GCOUNT cards from image header to the table\n            # header as ZPCOUNT and ZGCOUNT cards.\n\n            if 'PCOUNT' in self._image_header:\n                self._header.set('ZPCOUNT', self._image_header['PCOUNT'],\n                                 self._image_header.comments['PCOUNT'],\n                                 after=last_znaxis)\n\n            if 'GCOUNT' in self._image_header:\n                self._header.set('ZGCOUNT', self._image_header['GCOUNT'],\n                                 self._image_header.comments['GCOUNT'],\n                                 after='ZPCOUNT')\n\n        # When we have an image checksum we need to ensure that the same\n        # number of blank cards exist in the table header as there were in\n        # the image header.  This allows those blank cards to be carried\n        # over to the image header when the hdu is uncompressed.\n\n        if 'ZHECKSUM' in self._header:\n            required_blanks = image_header._countblanks()\n            image_blanks = self._image_header._countblanks()\n            table_blanks = self._header._countblanks()\n\n            for _ in range(required_blanks - image_blanks):\n                self._image_header.append()\n                table_blanks += 1\n\n            for _ in range(required_blanks - table_blanks):\n                self._header.append()\n\n    @lazyproperty\n    def data(self):\n        # The data attribute is the image data (not the table data).\n        data = compression.decompress_hdu(self)\n\n        if data is None:\n            return data\n\n        # Scale the data if necessary\n        if (self._orig_bzero != 0 or self._orig_bscale != 1):\n            new_dtype = self._dtype_for_bitpix()\n            data = np.array(data, dtype=new_dtype)\n\n            zblank = None\n\n            if 'ZBLANK' in self.compressed_data.columns.names:\n                zblank = self.compressed_data['ZBLANK']\n            else:\n                if 'ZBLANK' in self._header:\n                    zblank = np.array(self._header['ZBLANK'], dtype='int32')\n                elif 'BLANK' in self._header:\n                    zblank = np.array(self._header['BLANK'], dtype='int32')\n\n            if zblank is not None:\n                blanks = (data == zblank)\n\n            if self._bscale != 1:\n                np.multiply(data, self._bscale, data)\n            if self._bzero != 0:\n                # We have to explicitly cast self._bzero to prevent numpy from\n                # raising an error when doing self.data += self._bzero, and we\n                # do this instead of self.data = self.data + self._bzero to\n                # avoid doubling memory usage.\n                np.add(data, self._bzero, out=data, casting='unsafe')\n\n            if zblank is not None:\n                data = np.where(blanks, np.nan, data)\n\n        # Right out of _ImageBaseHDU.data\n        self._update_header_scale_info(data.dtype)\n\n        return data\n\n    @data.setter\n    def data(self, data):\n        if (data is not None) and (not isinstance(data, np.ndarray) or\n                data.dtype.fields is not None):\n            raise TypeError('CompImageHDU data has incorrect type:{}; '\n                            'dtype.fields = {}'.format(\n                    type(data), data.dtype.fields))\n\n    @lazyproperty\n    def compressed_data(self):\n        # First we will get the table data (the compressed\n        # data) from the file, if there is any.\n        compressed_data = super().data\n        if isinstance(compressed_data, np.rec.recarray):\n            # Make sure not to use 'del self.data' so we don't accidentally\n            # go through the self.data.fdel and close the mmap underlying\n            # the compressed_data array\n            del self.__dict__['data']\n            return compressed_data\n        else:\n            # This will actually set self.compressed_data with the\n            # pre-allocated space for the compression data; this is something I\n            # might do away with in the future\n            self._update_compressed_data()\n\n        return self.compressed_data\n\n    @compressed_data.deleter\n    def compressed_data(self):\n        # Deleting the compressed_data attribute has to be handled\n        # with a little care to prevent a reference leak\n        # First delete the ._coldefs attributes under it to break a possible\n        # reference cycle\n        if 'compressed_data' in self.__dict__:\n            del self.__dict__['compressed_data']._coldefs\n\n            # Now go ahead and delete from self.__dict__; normally\n            # lazyproperty.__delete__ does this for us, but we can prempt it to\n            # do some additional cleanup\n            del self.__dict__['compressed_data']\n\n            # If this file was mmap'd, numpy.memmap will hold open a file\n            # handle until the underlying mmap object is garbage-collected;\n            # since this reference leak can sometimes hang around longer than\n            # welcome go ahead and force a garbage collection\n            gc.collect()\n\n    @property\n    def shape(self):\n        \"\"\"\n        Shape of the image array--should be equivalent to ``self.data.shape``.\n        \"\"\"\n\n        # Determine from the values read from the header\n        return tuple(reversed(self._axes))\n\n    @lazyproperty\n    def header(self):\n        # The header attribute is the header for the image data.  It\n        # is not actually stored in the object dictionary.  Instead,\n        # the _image_header is stored.  If the _image_header attribute\n        # has already been defined we just return it.  If not, we must\n        # create it from the table header (the _header attribute).\n        if hasattr(self, '_image_header'):\n            return self._image_header\n\n        # Clean up any possible doubled EXTNAME keywords that use\n        # the default. Do this on the original header to ensure\n        # duplicates are removed cleanly.\n        self._remove_unnecessary_default_extnames(self._header)\n\n        # Start with a copy of the table header.\n        image_header = self._header.copy()\n\n        # Delete cards that are related to the table.  And move\n        # the values of those cards that relate to the image from\n        # their corresponding table cards.  These include\n        # ZBITPIX -> BITPIX, ZNAXIS -> NAXIS, and ZNAXISn -> NAXISn.\n        # (Note: Used set here instead of list in case there are any duplicate\n        # keywords, which there may be in some pathological cases:\n        # https://github.com/astropy/astropy/issues/2750\n        for keyword in set(image_header):\n            if CompImageHeader._is_reserved_keyword(keyword, warn=False):\n                del image_header[keyword]\n\n        if 'ZSIMPLE' in self._header:\n            image_header.set('SIMPLE', self._header['ZSIMPLE'],\n                             self._header.comments['ZSIMPLE'], before=0)\n        elif 'ZTENSION' in self._header:\n            if self._header['ZTENSION'] != 'IMAGE':\n                warnings.warn(\"ZTENSION keyword in compressed \"\n                              \"extension != 'IMAGE'\", AstropyUserWarning)\n            image_header.set('XTENSION', 'IMAGE',\n                             self._header.comments['ZTENSION'], before=0)\n        else:\n            image_header.set('XTENSION', 'IMAGE', before=0)\n\n        image_header.set('BITPIX', self._header['ZBITPIX'],\n                         self._header.comments['ZBITPIX'], before=1)\n\n        image_header.set('NAXIS', self._header['ZNAXIS'],\n                         self._header.comments['ZNAXIS'], before=2)\n\n        last_naxis = 'NAXIS'\n        for idx in range(image_header['NAXIS']):\n            znaxis = 'ZNAXIS' + str(idx + 1)\n            naxis = znaxis[1:]\n            image_header.set(naxis, self._header[znaxis],\n                             self._header.comments[znaxis],\n                             after=last_naxis)\n            last_naxis = naxis\n\n        # Delete any other spurious NAXISn keywords:\n        naxis = image_header['NAXIS']\n        for keyword in list(image_header['NAXIS?*']):\n            try:\n                n = int(keyword[5:])\n            except Exception:\n                continue\n\n            if n > naxis:\n                del image_header[keyword]\n\n        # Although PCOUNT and GCOUNT are considered mandatory for IMAGE HDUs,\n        # ZPCOUNT and ZGCOUNT are optional, probably because for IMAGE HDUs\n        # their values are always 0 and 1 respectively\n        if 'ZPCOUNT' in self._header:\n            image_header.set('PCOUNT', self._header['ZPCOUNT'],\n                             self._header.comments['ZPCOUNT'],\n                             after=last_naxis)\n        else:\n            image_header.set('PCOUNT', 0, after=last_naxis)\n\n        if 'ZGCOUNT' in self._header:\n            image_header.set('GCOUNT', self._header['ZGCOUNT'],\n                             self._header.comments['ZGCOUNT'],\n                             after='PCOUNT')\n        else:\n            image_header.set('GCOUNT', 1, after='PCOUNT')\n\n        if 'ZEXTEND' in self._header:\n            image_header.set('EXTEND', self._header['ZEXTEND'],\n                             self._header.comments['ZEXTEND'])\n\n        if 'ZBLOCKED' in self._header:\n            image_header.set('BLOCKED', self._header['ZBLOCKED'],\n                             self._header.comments['ZBLOCKED'])\n\n        # Move the ZHECKSUM and ZDATASUM cards to the image header\n        # as CHECKSUM and DATASUM\n        if 'ZHECKSUM' in self._header:\n            image_header.set('CHECKSUM', self._header['ZHECKSUM'],\n                             self._header.comments['ZHECKSUM'])\n\n        if 'ZDATASUM' in self._header:\n            image_header.set('DATASUM', self._header['ZDATASUM'],\n                             self._header.comments['ZDATASUM'])\n\n        # Remove the EXTNAME card if the value in the table header\n        # is the default value of COMPRESSED_IMAGE.\n        if ('EXTNAME' in image_header and\n                image_header['EXTNAME'] == self._default_name):\n            del image_header['EXTNAME']\n\n        # Look to see if there are any blank cards in the table\n        # header.  If there are, there should be the same number\n        # of blank cards in the image header.  Add blank cards to\n        # the image header to make it so.\n        table_blanks = self._header._countblanks()\n        image_blanks = image_header._countblanks()\n\n        for _ in range(table_blanks - image_blanks):\n            image_header.append()\n\n        # Create the CompImageHeader that syncs with the table header, and save\n        # it off to self._image_header so it can be referenced later\n        # unambiguously\n        self._image_header = CompImageHeader(self._header, image_header)\n\n        return self._image_header\n\n    def _summary(self):\n        \"\"\"\n        Summarize the HDU: name, dimensions, and formats.\n        \"\"\"\n        class_name = self.__class__.__name__\n\n        # if data is touched, use data info.\n        if self._data_loaded:\n            if self.data is None:\n                _shape, _format = (), ''\n            else:\n\n                # the shape will be in the order of NAXIS's which is the\n                # reverse of the numarray shape\n                _shape = list(self.data.shape)\n                _format = self.data.dtype.name\n                _shape.reverse()\n                _shape = tuple(_shape)\n                _format = _format[_format.rfind('.') + 1:]\n\n        # if data is not touched yet, use header info.\n        else:\n            _shape = ()\n\n            for idx in range(self.header['NAXIS']):\n                _shape += (self.header['NAXIS' + str(idx + 1)],)\n\n            _format = BITPIX2DTYPE[self.header['BITPIX']]\n\n        return (self.name, self.ver, class_name, len(self.header), _shape,\n                _format)\n\n    def _update_compressed_data(self):\n        \"\"\"\n        Compress the image data so that it may be written to a file.\n        \"\"\"\n\n        # Check to see that the image_header matches the image data\n        image_bitpix = DTYPE2BITPIX[self.data.dtype.name]\n\n        if image_bitpix != self._orig_bitpix or self.data.shape != self.shape:\n            self._update_header_data(self.header)\n\n        # TODO: This is copied right out of _ImageBaseHDU._writedata_internal;\n        # it would be cool if we could use an internal ImageHDU and use that to\n        # write to a buffer for compression or something. See ticket #88\n        # deal with unsigned integer 16, 32 and 64 data\n        old_data = self.data\n        if _is_pseudo_integer(self.data.dtype):\n            # Convert the unsigned array to signed\n            self.data = np.array(\n                self.data - _pseudo_zero(self.data.dtype),\n                dtype=f'=i{self.data.dtype.itemsize}')\n            should_swap = False\n        else:\n            should_swap = not self.data.dtype.isnative\n\n        if should_swap:\n\n            if self.data.flags.writeable:\n                self.data.byteswap(True)\n            else:\n                # For read-only arrays, there is no way around making\n                # a byteswapped copy of the data.\n                self.data = self.data.byteswap(False)\n\n        try:\n            nrows = self._header['NAXIS2']\n            tbsize = self._header['NAXIS1'] * nrows\n\n            self._header['PCOUNT'] = 0\n            if 'THEAP' in self._header:\n                del self._header['THEAP']\n            self._theap = tbsize\n\n            # First delete the original compressed data, if it exists\n            del self.compressed_data\n\n            # Make sure that the data is contiguous otherwise CFITSIO\n            # will not write the expected data\n            self.data = np.ascontiguousarray(self.data)\n\n            # Compress the data.\n            # The current implementation of compress_hdu assumes the empty\n            # compressed data table has already been initialized in\n            # self.compressed_data, and writes directly to it\n            # compress_hdu returns the size of the heap for the written\n            # compressed image table\n            heapsize, self.compressed_data = compression.compress_hdu(self)\n        finally:\n            # if data was byteswapped return it to its original order\n            if should_swap:\n                self.data.byteswap(True)\n            self.data = old_data\n\n        # CFITSIO will write the compressed data in big-endian order\n        dtype = self.columns.dtype.newbyteorder('>')\n        buf = self.compressed_data\n        compressed_data = buf[:self._theap].view(dtype=dtype,\n                                                 type=np.rec.recarray)\n        self.compressed_data = compressed_data.view(FITS_rec)\n        self.compressed_data._coldefs = self.columns\n        self.compressed_data._heapoffset = self._theap\n        self.compressed_data._heapsize = heapsize\n\n    def scale(self, type=None, option='old', bscale=1, bzero=0):\n        \"\"\"\n        Scale image data by using ``BSCALE`` and ``BZERO``.\n\n        Calling this method will scale ``self.data`` and update the keywords of\n        ``BSCALE`` and ``BZERO`` in ``self._header`` and ``self._image_header``.\n        This method should only be used right before writing to the output\n        file, as the data will be scaled and is therefore not very usable after\n        the call.\n\n        Parameters\n        ----------\n\n        type : str, optional\n            destination data type, use a string representing a numpy dtype\n            name, (e.g. ``'uint8'``, ``'int16'``, ``'float32'`` etc.).  If is\n            `None`, use the current data type.\n\n        option : str, optional\n            how to scale the data: if ``\"old\"``, use the original ``BSCALE``\n            and ``BZERO`` values when the data was read/created. If\n            ``\"minmax\"``, use the minimum and maximum of the data to scale.\n            The option will be overwritten by any user-specified bscale/bzero\n            values.\n\n        bscale, bzero : int, optional\n            user specified ``BSCALE`` and ``BZERO`` values.\n        \"\"\"\n\n        if self.data is None:\n            return\n\n        # Determine the destination (numpy) data type\n        if type is None:\n            type = BITPIX2DTYPE[self._bitpix]\n        _type = getattr(np, type)\n\n        # Determine how to scale the data\n        # bscale and bzero takes priority\n        if (bscale != 1 or bzero != 0):\n            _scale = bscale\n            _zero = bzero\n        else:\n            if option == 'old':\n                _scale = self._orig_bscale\n                _zero = self._orig_bzero\n            elif option == 'minmax':\n                if isinstance(_type, np.floating):\n                    _scale = 1\n                    _zero = 0\n                else:\n                    _min = np.minimum.reduce(self.data.flat)\n                    _max = np.maximum.reduce(self.data.flat)\n\n                    if _type == np.uint8:  # uint8 case\n                        _zero = _min\n                        _scale = (_max - _min) / (2. ** 8 - 1)\n                    else:\n                        _zero = (_max + _min) / 2.\n\n                        # throw away -2^N\n                        _scale = (_max - _min) / (2. ** (8 * _type.bytes) - 2)\n\n        # Do the scaling\n        if _zero != 0:\n            # We have to explicitly cast self._bzero to prevent numpy from\n            # raising an error when doing self.data -= _zero, and we\n            # do this instead of self.data = self.data - _zero to\n            # avoid doubling memory usage.\n            np.subtract(self.data, _zero, out=self.data, casting='unsafe')\n            self.header['BZERO'] = _zero\n        else:\n            # Delete from both headers\n            for header in (self.header, self._header):\n                with suppress(KeyError):\n                    del header['BZERO']\n\n        if _scale != 1:\n            self.data /= _scale\n            self.header['BSCALE'] = _scale\n        else:\n            for header in (self.header, self._header):\n                with suppress(KeyError):\n                    del header['BSCALE']\n\n        if self.data.dtype.type != _type:\n            self.data = np.array(np.around(self.data), dtype=_type)  # 0.7.7.1\n\n        # Update the BITPIX Card to match the data\n        self._bitpix = DTYPE2BITPIX[self.data.dtype.name]\n        self._bzero = self.header.get('BZERO', 0)\n        self._bscale = self.header.get('BSCALE', 1)\n        # Update BITPIX for the image header specifically\n        # TODO: Make this more clear by using self._image_header, but only once\n        # this has been fixed so that the _image_header attribute is guaranteed\n        # to be valid\n        self.header['BITPIX'] = self._bitpix\n\n        # Update the table header to match the scaled data\n        self._update_header_data(self.header)\n\n        # Since the image has been manually scaled, the current\n        # bitpix/bzero/bscale now serve as the 'original' scaling of the image,\n        # as though the original image has been completely replaced\n        self._orig_bitpix = self._bitpix\n        self._orig_bzero = self._bzero\n        self._orig_bscale = self._bscale\n\n    def _prewriteto(self, checksum=False, inplace=False):\n        if self._scale_back:\n            self.scale(BITPIX2DTYPE[self._orig_bitpix])\n\n        if self._has_data:\n            self._update_compressed_data()\n\n            # Use methods in the superclass to update the header with\n            # scale/checksum keywords based on the data type of the image data\n            self._update_pseudo_int_scale_keywords()\n\n            # Shove the image header and data into a new ImageHDU and use that\n            # to compute the image checksum\n            image_hdu = ImageHDU(data=self.data, header=self.header)\n            image_hdu._update_checksum(checksum)\n            if 'CHECKSUM' in image_hdu.header:\n                # This will also pass through to the ZHECKSUM keyword and\n                # ZDATASUM keyword\n                self._image_header.set('CHECKSUM',\n                                       image_hdu.header['CHECKSUM'],\n                                       image_hdu.header.comments['CHECKSUM'])\n            if 'DATASUM' in image_hdu.header:\n                self._image_header.set('DATASUM', image_hdu.header['DATASUM'],\n                                       image_hdu.header.comments['DATASUM'])\n            # Store a temporary backup of self.data in a different attribute;\n            # see below\n            self._imagedata = self.data\n\n            # Now we need to perform an ugly hack to set the compressed data as\n            # the .data attribute on the HDU so that the call to _writedata\n            # handles it properly\n            self.__dict__['data'] = self.compressed_data\n\n        return super()._prewriteto(checksum=checksum, inplace=inplace)\n\n    def _writeheader(self, fileobj):\n        \"\"\"\n        Bypasses `BinTableHDU._writeheader()` which updates the header with\n        metadata about the data that is meaningless here; another reason\n        why this class maybe shouldn't inherit directly from BinTableHDU...\n        \"\"\"\n\n        return ExtensionHDU._writeheader(self, fileobj)\n\n    def _writedata(self, fileobj):\n        \"\"\"\n        Wrap the basic ``_writedata`` method to restore the ``.data``\n        attribute to the uncompressed image data in the case of an exception.\n        \"\"\"\n\n        try:\n            return super()._writedata(fileobj)\n        finally:\n            # Restore the .data attribute to its rightful value (if any)\n            if hasattr(self, '_imagedata'):\n                self.__dict__['data'] = self._imagedata\n                del self._imagedata\n            else:\n                del self.data\n\n    def _close(self, closed=True):\n        super()._close(closed=closed)\n\n        # Also make sure to close access to the compressed data mmaps\n        if (closed and self._data_loaded and\n                _get_array_mmap(self.compressed_data) is not None):\n            del self.compressed_data\n\n    # TODO: This was copied right out of _ImageBaseHDU; get rid of it once we\n    # find a way to rewrite this class as either a subclass or wrapper for an\n    # ImageHDU\n    def _dtype_for_bitpix(self):\n        \"\"\"\n        Determine the dtype that the data should be converted to depending on\n        the BITPIX value in the header, and possibly on the BSCALE value as\n        well.  Returns None if there should not be any change.\n        \"\"\"\n\n        bitpix = self._orig_bitpix\n        # Handle possible conversion to uints if enabled\n        if self._uint and self._orig_bscale == 1:\n            for bits, dtype in ((16, np.dtype('uint16')),\n                                (32, np.dtype('uint32')),\n                                (64, np.dtype('uint64'))):\n                if bitpix == bits and self._orig_bzero == 1 << (bits - 1):\n                    return dtype\n\n        if bitpix > 16:  # scale integers to Float64\n            return np.dtype('float64')\n        elif bitpix > 0:  # scale integers to Float32\n            return np.dtype('float32')\n\n    def _update_header_scale_info(self, dtype=None):\n        if (not self._do_not_scale_image_data and\n                not (self._orig_bzero == 0 and self._orig_bscale == 1)):\n            for keyword in ['BSCALE', 'BZERO']:\n                # Make sure to delete from both the image header and the table\n                # header; later this will be streamlined\n                for header in (self.header, self._header):\n                    with suppress(KeyError):\n                        del header[keyword]\n                        # Since _update_header_scale_info can, currently, be\n                        # called *after* _prewriteto(), replace these with\n                        # blank cards so the header size doesn't change\n                        header.append()\n\n            if dtype is None:\n                dtype = self._dtype_for_bitpix()\n            if dtype is not None:\n                self.header['BITPIX'] = DTYPE2BITPIX[dtype.name]\n\n            self._bzero = 0\n            self._bscale = 1\n            self._bitpix = self.header['BITPIX']\n\n    def _generate_dither_seed(self, seed):\n        if not _is_int(seed):\n            raise TypeError(\"Seed must be an integer\")\n\n        if not -1 <= seed <= 10000:\n            raise ValueError(\n                \"Seed for random dithering must be either between 1 and \"\n                \"10000 inclusive, 0 for autogeneration from the system \"\n                \"clock, or -1 for autogeneration from a checksum of the first \"\n                \"image tile (got {})\".format(seed))\n\n        if seed == DITHER_SEED_CHECKSUM:\n            # Determine the tile dimensions from the ZTILEn keywords\n            naxis = self._header['ZNAXIS']\n            tile_dims = [self._header[f'ZTILE{idx + 1}']\n                         for idx in range(naxis)]\n            tile_dims.reverse()\n\n            # Get the first tile by using the tile dimensions as the end\n            # indices of slices (starting from 0)\n            first_tile = self.data[tuple(slice(d) for d in tile_dims)]\n\n            # The checksum algorithm used is literally just the sum of the bytes\n            # of the tile data (not its actual floating point values).  Integer\n            # overflow is irrelevant.\n            csum = first_tile.view(dtype='uint8').sum()\n\n            # Since CFITSIO uses an unsigned long (which may be different on\n            # different platforms) go ahead and truncate the sum to its\n            # unsigned long value and take the result modulo 10000\n            return (ctypes.c_ulong(csum).value % 10000) + 1\n        elif seed == DITHER_SEED_CLOCK:\n            # This isn't exactly the same algorithm as CFITSIO, but that's okay\n            # since the result is meant to be arbitrary. The primary difference\n            # is that CFITSIO incorporates the HDU number into the result in\n            # the hopes of heading off the possibility of the same seed being\n            # generated for two HDUs at the same time.  Here instead we just\n            # add in the HDU object's id\n            return ((sum(int(x) for x in math.modf(time.time())) + id(self)) %\n                    10000) + 1\n        else:\n            return seed"},{"col":4,"comment":"null","endLoc":674,"header":"def __new__(cls, angle, unit=None, wrap_angle=None, **kwargs)","id":2224,"name":"__new__","nodeType":"Function","startLoc":665,"text":"def __new__(cls, angle, unit=None, wrap_angle=None, **kwargs):\n        # Forbid creating a Long from a Lat.\n        if isinstance(angle, Latitude):\n            raise TypeError(\"A Longitude angle cannot be created from \"\n                            \"a Latitude angle.\")\n        self = super().__new__(cls, angle, unit=unit, **kwargs)\n        if wrap_angle is None:\n            wrap_angle = getattr(angle, 'wrap_angle', self._default_wrap_angle)\n        self.wrap_angle = wrap_angle  # angle-like b/c property setter\n        return self"},{"col":4,"comment":"null","endLoc":1059,"header":"def _report(self)","id":2225,"name":"_report","nodeType":"Function","startLoc":1032,"text":"def _report(self):\n        if self.diff_dimensions:\n            dimsa = ' x '.join(str(d) for d in\n                               reversed(self.diff_dimensions[0]))\n            dimsb = ' x '.join(str(d) for d in\n                               reversed(self.diff_dimensions[1]))\n            self._writeln(' Data dimensions differ:')\n            self._writeln(f'  a: {dimsa}')\n            self._writeln(f'  b: {dimsb}')\n            # For now we don't do any further comparison if the dimensions\n            # differ; though in the future it might be nice to be able to\n            # compare at least where the images intersect\n            self._writeln(' No further data comparison performed.')\n            return\n\n        if not self.diff_pixels:\n            return\n\n        for index, values in self.diff_pixels:\n            index = [x + 1 for x in reversed(index)]\n            self._writeln(f' Data differs at {index}:')\n            report_diff_values(values[0], values[1], fileobj=self._fileobj,\n                               indent_width=self._indent + 1)\n\n        if self.diff_total > self.numdiffs:\n            self._writeln(' ...')\n        self._writeln(' {} different pixels found ({:.2%} different).'\n                      .format(self.diff_total, self.diff_ratio))"},{"col":4,"comment":"null","endLoc":1538,"header":"def _repr_html_(self)","id":2226,"name":"_repr_html_","nodeType":"Function","startLoc":1532,"text":"def _repr_html_(self):\n        out = self._base_repr_(html=True, max_width=-1,\n                               tableclass=conf.default_notebook_table_class)\n        # Wrap <table> in <div>. This follows the pattern in pandas and allows\n        # table to be scrollable horizontally in VS Code notebook display.\n        out = f'<div>{out}</div>'\n        return out"},{"col":4,"comment":"Longitude of the location, for the default ellipsoid.","endLoc":612,"header":"@property\n    def lon(self)","id":2227,"name":"lon","nodeType":"Function","startLoc":609,"text":"@property\n    def lon(self):\n        \"\"\"Longitude of the location, for the default ellipsoid.\"\"\"\n        return self.geodetic[0]"},{"col":4,"comment":"Latitude of the location, for the default ellipsoid.","endLoc":617,"header":"@property\n    def lat(self)","id":2228,"name":"lat","nodeType":"Function","startLoc":614,"text":"@property\n    def lat(self):\n        \"\"\"Latitude of the location, for the default ellipsoid.\"\"\"\n        return self.geodetic[1]"},{"col":4,"comment":"Height of the location, for the default ellipsoid.","endLoc":622,"header":"@property\n    def height(self)","id":2229,"name":"height","nodeType":"Function","startLoc":619,"text":"@property\n    def height(self):\n        \"\"\"Height of the location, for the default ellipsoid.\"\"\"\n        return self.geodetic[2]"},{"col":4,"comment":"Convert to a tuple with X, Y, and Z as quantities","endLoc":628,"header":"@property\n    def geocentric(self)","id":2230,"name":"geocentric","nodeType":"Function","startLoc":625,"text":"@property\n    def geocentric(self):\n        \"\"\"Convert to a tuple with X, Y, and Z as quantities\"\"\"\n        return self.to_geocentric()"},{"col":4,"comment":"null","endLoc":1541,"header":"def __repr__(self)","id":2231,"name":"__repr__","nodeType":"Function","startLoc":1540,"text":"def __repr__(self):\n        return self._base_repr_(html=False, max_width=None)"},{"col":4,"comment":"Convert to a tuple with X, Y, and Z as quantities","endLoc":632,"header":"def to_geocentric(self)","id":2232,"name":"to_geocentric","nodeType":"Function","startLoc":630,"text":"def to_geocentric(self):\n        \"\"\"Convert to a tuple with X, Y, and Z as quantities\"\"\"\n        return (self.x, self.y, self.z)"},{"col":4,"comment":"\n        Generates an `~astropy.coordinates.ITRS` object with the location of\n        this object at the requested ``obstime``.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time` or None\n            The ``obstime`` to apply to the new `~astropy.coordinates.ITRS`, or\n            if None, the default ``obstime`` will be used.\n\n        Returns\n        -------\n        itrs : `~astropy.coordinates.ITRS`\n            The new object in the ITRS frame\n        ","endLoc":657,"header":"def get_itrs(self, obstime=None)","id":2233,"name":"get_itrs","nodeType":"Function","startLoc":634,"text":"def get_itrs(self, obstime=None):\n        \"\"\"\n        Generates an `~astropy.coordinates.ITRS` object with the location of\n        this object at the requested ``obstime``.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time` or None\n            The ``obstime`` to apply to the new `~astropy.coordinates.ITRS`, or\n            if None, the default ``obstime`` will be used.\n\n        Returns\n        -------\n        itrs : `~astropy.coordinates.ITRS`\n            The new object in the ITRS frame\n        \"\"\"\n        # Broadcast for a single position at multiple times, but don't attempt\n        # to be more general here.\n        if obstime and self.size == 1 and obstime.shape:\n            self = np.broadcast_to(self, obstime.shape, subok=True)\n\n        # do this here to prevent a series of complicated circular imports\n        from .builtin_frames import ITRS\n        return ITRS(x=self.x, y=self.y, z=self.z, obstime=obstime)"},{"col":4,"comment":"null","endLoc":1544,"header":"def __str__(self)","id":2234,"name":"__str__","nodeType":"Function","startLoc":1543,"text":"def __str__(self):\n        return '\\n'.join(self.pformat())"},{"col":4,"comment":"Return a list of lines for the formatted string representation of\n        the table.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default is taken from the\n        configuration item ``astropy.conf.max_lines``.  If a negative\n        value of ``max_lines`` is supplied then there is no line limit\n        applied.\n\n        The same applies for ``max_width`` except the configuration item  is\n        ``astropy.conf.max_width``.\n\n        ","endLoc":1814,"header":"@format_doc(_pformat_docs, id=\"{id}\")\n    def pformat(self, max_lines=None, max_width=None, show_name=True,\n                show_unit=None, show_dtype=False, html=False, tableid=None,\n                align=None, tableclass=None)","id":2235,"name":"pformat","nodeType":"Function","startLoc":1787,"text":"@format_doc(_pformat_docs, id=\"{id}\")\n    def pformat(self, max_lines=None, max_width=None, show_name=True,\n                show_unit=None, show_dtype=False, html=False, tableid=None,\n                align=None, tableclass=None):\n        \"\"\"Return a list of lines for the formatted string representation of\n        the table.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default is taken from the\n        configuration item ``astropy.conf.max_lines``.  If a negative\n        value of ``max_lines`` is supplied then there is no line limit\n        applied.\n\n        The same applies for ``max_width`` except the configuration item  is\n        ``astropy.conf.max_width``.\n\n        \"\"\"\n\n        lines, outs = self.formatter._pformat_table(\n            self, max_lines, max_width, show_name=show_name,\n            show_unit=show_unit, show_dtype=show_dtype, html=html,\n            tableid=tableid, tableclass=tableclass, align=align)\n\n        if outs['show_length']:\n            lines.append(f'Length = {len(self)} rows')\n\n        return lines"},{"col":0,"comment":"\n    Replaces the docstring of the decorated object and then formats it.\n\n    The formatting works like :meth:`str.format` and if the decorated object\n    already has a docstring this docstring can be included in the new\n    documentation if you use the ``{__doc__}`` placeholder.\n    Its primary use is for reusing a *long* docstring in multiple functions\n    when it is the same or only slightly different between them.\n\n    Parameters\n    ----------\n    docstring : str or object or None\n        The docstring that will replace the docstring of the decorated\n        object. If it is an object like a function or class it will\n        take the docstring of this object. If it is a string it will use the\n        string itself. One special case is if the string is ``None`` then\n        it will use the decorated functions docstring and formats it.\n\n    args :\n        passed to :meth:`str.format`.\n\n    kwargs :\n        passed to :meth:`str.format`. If the function has a (not empty)\n        docstring the original docstring is added to the kwargs with the\n        keyword ``'__doc__'``.\n\n    Raises\n    ------\n    ValueError\n        If the ``docstring`` (or interpreted docstring if it was ``None``\n        or not a string) is empty.\n\n    IndexError, KeyError\n        If a placeholder in the (interpreted) ``docstring`` was not filled. see\n        :meth:`str.format` for more information.\n\n    Notes\n    -----\n    Using this decorator allows, for example Sphinx, to parse the\n    correct docstring.\n\n    Examples\n    --------\n\n    Replacing the current docstring is very easy::\n\n        >>> from astropy.utils.decorators import format_doc\n        >>> @format_doc('''Perform num1 + num2''')\n        ... def add(num1, num2):\n        ...     return num1+num2\n        ...\n        >>> help(add) # doctest: +SKIP\n        Help on function add in module __main__:\n        <BLANKLINE>\n        add(num1, num2)\n            Perform num1 + num2\n\n    sometimes instead of replacing you only want to add to it::\n\n        >>> doc = '''\n        ...       {__doc__}\n        ...       Parameters\n        ...       ----------\n        ...       num1, num2 : Numbers\n        ...       Returns\n        ...       -------\n        ...       result: Number\n        ...       '''\n        >>> @format_doc(doc)\n        ... def add(num1, num2):\n        ...     '''Perform addition.'''\n        ...     return num1+num2\n        ...\n        >>> help(add) # doctest: +SKIP\n        Help on function add in module __main__:\n        <BLANKLINE>\n        add(num1, num2)\n            Perform addition.\n            Parameters\n            ----------\n            num1, num2 : Numbers\n            Returns\n            -------\n            result : Number\n\n    in case one might want to format it further::\n\n        >>> doc = '''\n        ...       Perform {0}.\n        ...       Parameters\n        ...       ----------\n        ...       num1, num2 : Numbers\n        ...       Returns\n        ...       -------\n        ...       result: Number\n        ...           result of num1 {op} num2\n        ...       {__doc__}\n        ...       '''\n        >>> @format_doc(doc, 'addition', op='+')\n        ... def add(num1, num2):\n        ...     return num1+num2\n        ...\n        >>> @format_doc(doc, 'subtraction', op='-')\n        ... def subtract(num1, num2):\n        ...     '''Notes: This one has additional notes.'''\n        ...     return num1-num2\n        ...\n        >>> help(add) # doctest: +SKIP\n        Help on function add in module __main__:\n        <BLANKLINE>\n        add(num1, num2)\n            Perform addition.\n            Parameters\n            ----------\n            num1, num2 : Numbers\n            Returns\n            -------\n            result : Number\n                result of num1 + num2\n        >>> help(subtract) # doctest: +SKIP\n        Help on function subtract in module __main__:\n        <BLANKLINE>\n        subtract(num1, num2)\n            Perform subtraction.\n            Parameters\n            ----------\n            num1, num2 : Numbers\n            Returns\n            -------\n            result : Number\n                result of num1 - num2\n            Notes : This one has additional notes.\n\n    These methods can be combined an even taking the docstring from another\n    object is possible as docstring attribute. You just have to specify the\n    object::\n\n        >>> @format_doc(add)\n        ... def another_add(num1, num2):\n        ...     return num1 + num2\n        ...\n        >>> help(another_add) # doctest: +SKIP\n        Help on function another_add in module __main__:\n        <BLANKLINE>\n        another_add(num1, num2)\n            Perform addition.\n            Parameters\n            ----------\n            num1, num2 : Numbers\n            Returns\n            -------\n            result : Number\n                result of num1 + num2\n\n    But be aware that this decorator *only* formats the given docstring not\n    the strings passed as ``args`` or ``kwargs`` (not even the original\n    docstring)::\n\n        >>> @format_doc(doc, 'addition', op='+')\n        ... def yet_another_add(num1, num2):\n        ...    '''This one is good for {0}.'''\n        ...    return num1 + num2\n        ...\n        >>> help(yet_another_add) # doctest: +SKIP\n        Help on function yet_another_add in module __main__:\n        <BLANKLINE>\n        yet_another_add(num1, num2)\n            Perform addition.\n            Parameters\n            ----------\n            num1, num2 : Numbers\n            Returns\n            -------\n            result : Number\n                result of num1 + num2\n            This one is good for {0}.\n\n    To work around it you could specify the docstring to be ``None``::\n\n        >>> @format_doc(None, 'addition')\n        ... def last_add_i_swear(num1, num2):\n        ...    '''This one is good for {0}.'''\n        ...    return num1 + num2\n        ...\n        >>> help(last_add_i_swear) # doctest: +SKIP\n        Help on function last_add_i_swear in module __main__:\n        <BLANKLINE>\n        last_add_i_swear(num1, num2)\n            This one is good for addition.\n\n    Using it with ``None`` as docstring allows to use the decorator twice\n    on an object to first parse the new docstring and then to parse the\n    original docstring or the ``args`` and ``kwargs``.\n    ","endLoc":1088,"header":"def format_doc(docstring, *args, **kwargs)","id":2236,"name":"format_doc","nodeType":"Function","startLoc":869,"text":"def format_doc(docstring, *args, **kwargs):\n    \"\"\"\n    Replaces the docstring of the decorated object and then formats it.\n\n    The formatting works like :meth:`str.format` and if the decorated object\n    already has a docstring this docstring can be included in the new\n    documentation if you use the ``{__doc__}`` placeholder.\n    Its primary use is for reusing a *long* docstring in multiple functions\n    when it is the same or only slightly different between them.\n\n    Parameters\n    ----------\n    docstring : str or object or None\n        The docstring that will replace the docstring of the decorated\n        object. If it is an object like a function or class it will\n        take the docstring of this object. If it is a string it will use the\n        string itself. One special case is if the string is ``None`` then\n        it will use the decorated functions docstring and formats it.\n\n    args :\n        passed to :meth:`str.format`.\n\n    kwargs :\n        passed to :meth:`str.format`. If the function has a (not empty)\n        docstring the original docstring is added to the kwargs with the\n        keyword ``'__doc__'``.\n\n    Raises\n    ------\n    ValueError\n        If the ``docstring`` (or interpreted docstring if it was ``None``\n        or not a string) is empty.\n\n    IndexError, KeyError\n        If a placeholder in the (interpreted) ``docstring`` was not filled. see\n        :meth:`str.format` for more information.\n\n    Notes\n    -----\n    Using this decorator allows, for example Sphinx, to parse the\n    correct docstring.\n\n    Examples\n    --------\n\n    Replacing the current docstring is very easy::\n\n        >>> from astropy.utils.decorators import format_doc\n        >>> @format_doc('''Perform num1 + num2''')\n        ... def add(num1, num2):\n        ...     return num1+num2\n        ...\n        >>> help(add) # doctest: +SKIP\n        Help on function add in module __main__:\n        <BLANKLINE>\n        add(num1, num2)\n            Perform num1 + num2\n\n    sometimes instead of replacing you only want to add to it::\n\n        >>> doc = '''\n        ...       {__doc__}\n        ...       Parameters\n        ...       ----------\n        ...       num1, num2 : Numbers\n        ...       Returns\n        ...       -------\n        ...       result: Number\n        ...       '''\n        >>> @format_doc(doc)\n        ... def add(num1, num2):\n        ...     '''Perform addition.'''\n        ...     return num1+num2\n        ...\n        >>> help(add) # doctest: +SKIP\n        Help on function add in module __main__:\n        <BLANKLINE>\n        add(num1, num2)\n            Perform addition.\n            Parameters\n            ----------\n            num1, num2 : Numbers\n            Returns\n            -------\n            result : Number\n\n    in case one might want to format it further::\n\n        >>> doc = '''\n        ...       Perform {0}.\n        ...       Parameters\n        ...       ----------\n        ...       num1, num2 : Numbers\n        ...       Returns\n        ...       -------\n        ...       result: Number\n        ...           result of num1 {op} num2\n        ...       {__doc__}\n        ...       '''\n        >>> @format_doc(doc, 'addition', op='+')\n        ... def add(num1, num2):\n        ...     return num1+num2\n        ...\n        >>> @format_doc(doc, 'subtraction', op='-')\n        ... def subtract(num1, num2):\n        ...     '''Notes: This one has additional notes.'''\n        ...     return num1-num2\n        ...\n        >>> help(add) # doctest: +SKIP\n        Help on function add in module __main__:\n        <BLANKLINE>\n        add(num1, num2)\n            Perform addition.\n            Parameters\n            ----------\n            num1, num2 : Numbers\n            Returns\n            -------\n            result : Number\n                result of num1 + num2\n        >>> help(subtract) # doctest: +SKIP\n        Help on function subtract in module __main__:\n        <BLANKLINE>\n        subtract(num1, num2)\n            Perform subtraction.\n            Parameters\n            ----------\n            num1, num2 : Numbers\n            Returns\n            -------\n            result : Number\n                result of num1 - num2\n            Notes : This one has additional notes.\n\n    These methods can be combined an even taking the docstring from another\n    object is possible as docstring attribute. You just have to specify the\n    object::\n\n        >>> @format_doc(add)\n        ... def another_add(num1, num2):\n        ...     return num1 + num2\n        ...\n        >>> help(another_add) # doctest: +SKIP\n        Help on function another_add in module __main__:\n        <BLANKLINE>\n        another_add(num1, num2)\n            Perform addition.\n            Parameters\n            ----------\n            num1, num2 : Numbers\n            Returns\n            -------\n            result : Number\n                result of num1 + num2\n\n    But be aware that this decorator *only* formats the given docstring not\n    the strings passed as ``args`` or ``kwargs`` (not even the original\n    docstring)::\n\n        >>> @format_doc(doc, 'addition', op='+')\n        ... def yet_another_add(num1, num2):\n        ...    '''This one is good for {0}.'''\n        ...    return num1 + num2\n        ...\n        >>> help(yet_another_add) # doctest: +SKIP\n        Help on function yet_another_add in module __main__:\n        <BLANKLINE>\n        yet_another_add(num1, num2)\n            Perform addition.\n            Parameters\n            ----------\n            num1, num2 : Numbers\n            Returns\n            -------\n            result : Number\n                result of num1 + num2\n            This one is good for {0}.\n\n    To work around it you could specify the docstring to be ``None``::\n\n        >>> @format_doc(None, 'addition')\n        ... def last_add_i_swear(num1, num2):\n        ...    '''This one is good for {0}.'''\n        ...    return num1 + num2\n        ...\n        >>> help(last_add_i_swear) # doctest: +SKIP\n        Help on function last_add_i_swear in module __main__:\n        <BLANKLINE>\n        last_add_i_swear(num1, num2)\n            This one is good for addition.\n\n    Using it with ``None`` as docstring allows to use the decorator twice\n    on an object to first parse the new docstring and then to parse the\n    original docstring or the ``args`` and ``kwargs``.\n    \"\"\"\n    def set_docstring(obj):\n        if docstring is None:\n            # None means: use the objects __doc__\n            doc = obj.__doc__\n            # Delete documentation in this case so we don't end up with\n            # awkwardly self-inserted docs.\n            obj.__doc__ = None\n        elif isinstance(docstring, str):\n            # String: use the string that was given\n            doc = docstring\n        else:\n            # Something else: Use the __doc__ of this\n            doc = docstring.__doc__\n\n        if not doc:\n            # In case the docstring is empty it's probably not what was wanted.\n            raise ValueError('docstring must be a string or containing a '\n                             'docstring that is not empty.')\n\n        # If the original has a not-empty docstring append it to the format\n        # kwargs.\n        kwargs['__doc__'] = obj.__doc__ or ''\n        obj.__doc__ = doc.format(*args, **kwargs)\n        return obj\n    return set_docstring"},{"col":4,"comment":"null","endLoc":1547,"header":"def __bytes__(self)","id":2237,"name":"__bytes__","nodeType":"Function","startLoc":1546,"text":"def __bytes__(self):\n        return str(self).encode('utf-8')"},{"col":4,"comment":"\n        True if table has any mixin columns (defined as columns that are not Column\n        subclasses).\n        ","endLoc":1555,"header":"@property\n    def has_mixin_columns(self)","id":2238,"name":"has_mixin_columns","nodeType":"Function","startLoc":1549,"text":"@property\n    def has_mixin_columns(self):\n        \"\"\"\n        True if table has any mixin columns (defined as columns that are not Column\n        subclasses).\n        \"\"\"\n        return any(has_info_class(col, MixinInfo) for col in self.columns.values())"},{"col":4,"comment":"\n        This is the key routine that actually does time scale conversions.\n        This is not public and not connected to the read-only scale property.\n        ","endLoc":596,"header":"def _set_scale(self, scale)","id":2239,"name":"_set_scale","nodeType":"Function","startLoc":539,"text":"def _set_scale(self, scale):\n        \"\"\"\n        This is the key routine that actually does time scale conversions.\n        This is not public and not connected to the read-only scale property.\n        \"\"\"\n\n        if scale == self.scale:\n            return\n        if scale not in self.SCALES:\n            raise ValueError(\"Scale {!r} is not in the allowed scales {}\"\n                             .format(scale, sorted(self.SCALES)))\n\n        if scale == 'utc' or self.scale == 'utc':\n            # If doing a transform involving UTC then check that the leap\n            # seconds table is up to date.\n            _check_leapsec()\n\n        # Determine the chain of scale transformations to get from the current\n        # scale to the new scale.  MULTI_HOPS contains a dict of all\n        # transformations (xforms) that require intermediate xforms.\n        # The MULTI_HOPS dict is keyed by (sys1, sys2) in alphabetical order.\n        xform = (self.scale, scale)\n        xform_sort = tuple(sorted(xform))\n        multi = MULTI_HOPS.get(xform_sort, ())\n        xforms = xform_sort[:1] + multi + xform_sort[-1:]\n        # If we made the reverse xform then reverse it now.\n        if xform_sort != xform:\n            xforms = tuple(reversed(xforms))\n\n        # Transform the jd1,2 pairs through the chain of scale xforms.\n        jd1, jd2 = self._time.jd1, self._time.jd2_filled\n        for sys1, sys2 in zip(xforms[:-1], xforms[1:]):\n            # Some xforms require an additional delta_ argument that is\n            # provided through Time methods.  These values may be supplied by\n            # the user or computed based on available approximations.  The\n            # get_delta_ methods are available for only one combination of\n            # sys1, sys2 though the property applies for both xform directions.\n            args = [jd1, jd2]\n            for sys12 in ((sys1, sys2), (sys2, sys1)):\n                dt_method = '_get_delta_{}_{}'.format(*sys12)\n                try:\n                    get_dt = getattr(self, dt_method)\n                except AttributeError:\n                    pass\n                else:\n                    args.append(get_dt(jd1, jd2))\n                    break\n\n            conv_func = getattr(erfa, sys1 + sys2)\n            jd1, jd2 = conv_func(*args)\n\n        jd1, jd2 = day_frac(jd1, jd2)\n        if self.masked:\n            jd2[self.mask] = np.nan\n\n        self._time = self.FORMATS[self.format](jd1, jd2, scale, self.precision,\n                                               self.in_subfmt, self.out_subfmt,\n                                               from_jd=True)"},{"col":0,"comment":"null","endLoc":2796,"header":"def _check_leapsec()","id":2240,"name":"_check_leapsec","nodeType":"Function","startLoc":2781,"text":"def _check_leapsec():\n    global _LEAP_SECONDS_CHECK\n    if _LEAP_SECONDS_CHECK != _LeapSecondsCheck.DONE:\n        from astropy.utils import iers\n        with _LEAP_SECONDS_LOCK:\n            # There are three ways we can get here:\n            # 1. First call (NOT_STARTED).\n            # 2. Re-entrant call (RUNNING). We skip the initialisation\n            #    and don't worry about leap second errors.\n            # 3. Another thread which raced with the first call\n            #    (RUNNING). The first thread has relinquished the\n            #    lock to us, so initialization is complete.\n            if _LEAP_SECONDS_CHECK == _LeapSecondsCheck.NOT_STARTED:\n                _LEAP_SECONDS_CHECK = _LeapSecondsCheck.RUNNING\n                update_leap_seconds()\n                _LEAP_SECONDS_CHECK = _LeapSecondsCheck.DONE"},{"col":4,"comment":"True if table has any ``MaskedColumn`` columns.\n\n        This does not check for mixin columns that may have masked values, use the\n        ``has_masked_values`` property in that case.\n\n        ","endLoc":1565,"header":"@property\n    def has_masked_columns(self)","id":2241,"name":"has_masked_columns","nodeType":"Function","startLoc":1557,"text":"@property\n    def has_masked_columns(self):\n        \"\"\"True if table has any ``MaskedColumn`` columns.\n\n        This does not check for mixin columns that may have masked values, use the\n        ``has_masked_values`` property in that case.\n\n        \"\"\"\n        return any(isinstance(col, MaskedColumn) for col in self.itercols())"},{"col":0,"comment":"If the current ERFA leap second table is out of date, try to update it.\n\n    Uses `astropy.utils.iers.LeapSeconds.auto_open` to try to find an\n    up-to-date table.  See that routine for the definition of \"out of date\".\n\n    In order to make it safe to call this any time, all exceptions are turned\n    into warnings,\n\n    Parameters\n    ----------\n    files : list of path-like, optional\n        List of files/URLs to attempt to open.  By default, uses defined by\n        `astropy.utils.iers.LeapSeconds.auto_open`, which includes the table\n        used by ERFA itself, so if that is up to date, nothing will happen.\n\n    Returns\n    -------\n    n_update : int\n        Number of items updated.\n\n    ","endLoc":2830,"header":"def update_leap_seconds(files=None)","id":2242,"name":"update_leap_seconds","nodeType":"Function","startLoc":2799,"text":"def update_leap_seconds(files=None):\n    \"\"\"If the current ERFA leap second table is out of date, try to update it.\n\n    Uses `astropy.utils.iers.LeapSeconds.auto_open` to try to find an\n    up-to-date table.  See that routine for the definition of \"out of date\".\n\n    In order to make it safe to call this any time, all exceptions are turned\n    into warnings,\n\n    Parameters\n    ----------\n    files : list of path-like, optional\n        List of files/URLs to attempt to open.  By default, uses defined by\n        `astropy.utils.iers.LeapSeconds.auto_open`, which includes the table\n        used by ERFA itself, so if that is up to date, nothing will happen.\n\n    Returns\n    -------\n    n_update : int\n        Number of items updated.\n\n    \"\"\"\n    try:\n        from astropy.utils import iers\n\n        table = iers.LeapSeconds.auto_open(files)\n        return erfa.leap_seconds.update(table)\n\n    except Exception as exc:\n        warn(\"leap-second auto-update failed due to the following \"\n             f\"exception: {exc!r}\", AstropyWarning)\n        return 0"},{"col":4,"comment":"True if column in the table has values which are masked.\n\n        This may be relatively slow for large tables as it requires checking the mask\n        values of each column.\n        ","endLoc":1578,"header":"@property\n    def has_masked_values(self)","id":2243,"name":"has_masked_values","nodeType":"Function","startLoc":1567,"text":"@property\n    def has_masked_values(self):\n        \"\"\"True if column in the table has values which are masked.\n\n        This may be relatively slow for large tables as it requires checking the mask\n        values of each column.\n        \"\"\"\n        for col in self.itercols():\n            if hasattr(col, 'mask') and np.any(col.mask):\n                return True\n        else:\n            return False"},{"col":4,"comment":"Attempt to get an up-to-date leap-second list.\n\n        The routine will try the files in sequence until it finds one\n        whose expiration date is \"good enough\" (see below).  If none\n        are good enough, it returns the one with the most recent expiration\n        date, warning if that file is expired.\n\n        For remote files that are cached already, the cached file is tried\n        first before attempting to retrieve it again.\n\n        Parameters\n        ----------\n        files : list of path-like, optional\n            List of files/URLs to attempt to open.  By default, uses\n            ``cls._auto_open_files``.\n\n        Returns\n        -------\n        leap_seconds : `~astropy.utils.iers.LeapSeconds`\n            Up to date leap-second table\n\n        Notes\n        -----\n        Bulletin C is released about 10 days after a possible leap second is\n        introduced, i.e., mid-January or mid-July.  Expiration days are thus\n        generally at least 150 days after the present.  We look for a file\n        that expires more than 180 - `~astropy.utils.iers.Conf.auto_max_age`\n        after the present.\n        ","endLoc":1034,"header":"@classmethod\n    def auto_open(cls, files=None)","id":2244,"name":"auto_open","nodeType":"Function","startLoc":955,"text":"@classmethod\n    def auto_open(cls, files=None):\n        \"\"\"Attempt to get an up-to-date leap-second list.\n\n        The routine will try the files in sequence until it finds one\n        whose expiration date is \"good enough\" (see below).  If none\n        are good enough, it returns the one with the most recent expiration\n        date, warning if that file is expired.\n\n        For remote files that are cached already, the cached file is tried\n        first before attempting to retrieve it again.\n\n        Parameters\n        ----------\n        files : list of path-like, optional\n            List of files/URLs to attempt to open.  By default, uses\n            ``cls._auto_open_files``.\n\n        Returns\n        -------\n        leap_seconds : `~astropy.utils.iers.LeapSeconds`\n            Up to date leap-second table\n\n        Notes\n        -----\n        Bulletin C is released about 10 days after a possible leap second is\n        introduced, i.e., mid-January or mid-July.  Expiration days are thus\n        generally at least 150 days after the present.  We look for a file\n        that expires more than 180 - `~astropy.utils.iers.Conf.auto_max_age`\n        after the present.\n        \"\"\"\n        offset = 180 - (30 if conf.auto_max_age is None else conf.auto_max_age)\n        good_enough = cls._today() + TimeDelta(offset, format='jd')\n\n        if files is None:\n            # Basic files to go over (entries in _auto_open_files can be\n            # configuration items, which we want to be sure are up to date).\n            files = [getattr(conf, f, f) for f in cls._auto_open_files]\n\n        # Remove empty entries.\n        files = [f for f in files if f]\n\n        # Our trials start with normal files and remote ones that are\n        # already in cache.  The bools here indicate that the cache\n        # should be used.\n        trials = [(f, True) for f in files\n                  if not urlparse(f).netloc or is_url_in_cache(f)]\n        # If we are allowed to download, we try downloading new versions\n        # if none of the above worked.\n        if conf.auto_download:\n            trials += [(f, False) for f in files if urlparse(f).netloc]\n\n        self = None\n        err_list = []\n        # Go through all entries, and return the first one that\n        # is not expired, or the most up to date one.\n        for f, allow_cache in trials:\n            if not allow_cache:\n                clear_download_cache(f)\n\n            try:\n                trial = cls.open(f, cache=True)\n            except Exception as exc:\n                err_list.append(exc)\n                continue\n\n            if self is None or trial.expires > self.expires:\n                self = trial\n                self.meta['data_url'] = str(f)\n                if self.expires > good_enough:\n                    break\n\n        if self is None:\n            raise ValueError('none of the files could be read. The '\n                             'following errors were raised:\\n' + str(err_list))\n\n        if self.expires < self._today() and conf.auto_max_age is not None:\n            warn('leap-second file is expired.', IERSStaleWarning)\n\n        return self"},{"col":4,"comment":"Print a formatted string representation of the table.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default is taken from the\n        configuration item ``astropy.conf.max_lines``.  If a negative\n        value of ``max_lines`` is supplied then there is no line limit\n        applied.\n\n        The same applies for max_width except the configuration item is\n        ``astropy.conf.max_width``.\n\n        ","endLoc":1620,"header":"@format_doc(_pprint_docs)\n    def pprint(self, max_lines=None, max_width=None, show_name=True,\n               show_unit=None, show_dtype=False, align=None)","id":2245,"name":"pprint","nodeType":"Function","startLoc":1592,"text":"@format_doc(_pprint_docs)\n    def pprint(self, max_lines=None, max_width=None, show_name=True,\n               show_unit=None, show_dtype=False, align=None):\n        \"\"\"Print a formatted string representation of the table.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default is taken from the\n        configuration item ``astropy.conf.max_lines``.  If a negative\n        value of ``max_lines`` is supplied then there is no line limit\n        applied.\n\n        The same applies for max_width except the configuration item is\n        ``astropy.conf.max_width``.\n\n        \"\"\"\n        lines, outs = self.formatter._pformat_table(self, max_lines, max_width,\n                                                    show_name=show_name, show_unit=show_unit,\n                                                    show_dtype=show_dtype, align=align)\n        if outs['show_length']:\n            lines.append(f'Length = {len(self)} rows')\n\n        n_header = outs['n_header']\n\n        for i, line in enumerate(lines):\n            if i < n_header:\n                color_print(line, 'red')\n            else:\n                print(line)"},{"col":4,"comment":"null","endLoc":365,"header":"def __init__(self, *args, copy=True, representation_type=None,\n                 differential_type=None, **kwargs)","id":2246,"name":"__init__","nodeType":"Function","startLoc":294,"text":"def __init__(self, *args, copy=True, representation_type=None,\n                 differential_type=None, **kwargs):\n        self._attr_names_with_defaults = []\n\n        self._representation = self._infer_representation(representation_type, differential_type)\n        self._data = self._infer_data(args, copy, kwargs)  # possibly None.\n\n        # Set frame attributes, if any\n\n        values = {}\n        for fnm, fdefault in self.get_frame_attr_names().items():\n            # Read-only frame attributes are defined as FrameAttribute\n            # descriptors which are not settable, so set 'real' attributes as\n            # the name prefaced with an underscore.\n\n            if fnm in kwargs:\n                value = kwargs.pop(fnm)\n                setattr(self, '_' + fnm, value)\n                # Validate attribute by getting it. If the instance has data,\n                # this also checks its shape is OK. If not, we do it below.\n                values[fnm] = getattr(self, fnm)\n            else:\n                setattr(self, '_' + fnm, fdefault)\n                self._attr_names_with_defaults.append(fnm)\n\n        if kwargs:\n            raise TypeError(\n                f'Coordinate frame {self.__class__.__name__} got unexpected '\n                f'keywords: {list(kwargs)}')\n\n        # We do ``is None`` because self._data might evaluate to false for\n        # empty arrays or data == 0\n        if self._data is None:\n            # No data: we still need to check that any non-scalar attributes\n            # have consistent shapes. Collect them for all attributes with\n            # size > 1 (which should be array-like and thus have a shape).\n            shapes = {fnm: value.shape for fnm, value in values.items()\n                      if getattr(value, 'shape', ())}\n            if shapes:\n                if len(shapes) > 1:\n                    try:\n                        self._no_data_shape = check_broadcast(*shapes.values())\n                    except ValueError as err:\n                        raise ValueError(\n                            f\"non-scalar attributes with inconsistent shapes: {shapes}\") from err\n\n                    # Above, we checked that it is possible to broadcast all\n                    # shapes.  By getting and thus validating the attributes,\n                    # we verify that the attributes can in fact be broadcast.\n                    for fnm in shapes:\n                        getattr(self, fnm)\n                else:\n                    self._no_data_shape = shapes.popitem()[1]\n\n            else:\n                self._no_data_shape = ()\n\n        # The logic of this block is not related to the previous one\n        if self._data is not None:\n            # This makes the cache keys backwards-compatible, but also adds\n            # support for having differentials attached to the frame data\n            # representation object.\n            if 's' in self._data.differentials:\n                # TODO: assumes a velocity unit differential\n                key = (self._data.__class__.__name__,\n                       self._data.differentials['s'].__class__.__name__,\n                       False)\n            else:\n                key = (self._data.__class__.__name__, False)\n\n            # Set up representation cache.\n            self.cache['representation'][key] = self._data"},{"col":4,"comment":"Print a formatted string representation of the entire table.\n\n        This method is the same as `astropy.table.Table.pprint` except that\n        the default ``max_lines`` and ``max_width`` are both -1 so that by\n        default the entire table is printed instead of restricting to the size\n        of the screen terminal.\n\n        ","endLoc":1634,"header":"@format_doc(_pprint_docs)\n    def pprint_all(self, max_lines=-1, max_width=-1, show_name=True,\n                   show_unit=None, show_dtype=False, align=None)","id":2247,"name":"pprint_all","nodeType":"Function","startLoc":1622,"text":"@format_doc(_pprint_docs)\n    def pprint_all(self, max_lines=-1, max_width=-1, show_name=True,\n                   show_unit=None, show_dtype=False, align=None):\n        \"\"\"Print a formatted string representation of the entire table.\n\n        This method is the same as `astropy.table.Table.pprint` except that\n        the default ``max_lines`` and ``max_width`` are both -1 so that by\n        default the entire table is printed instead of restricting to the size\n        of the screen terminal.\n\n        \"\"\"\n        return self.pprint(max_lines, max_width, show_name,\n                           show_unit, show_dtype, align)"},{"col":4,"comment":"\n        Parameters\n        ----------\n        data : array, optional\n            Uncompressed image data\n\n        header : `~astropy.io.fits.Header`, optional\n            Header to be associated with the image; when reading the HDU from a\n            file (data=DELAYED), the header read from the file\n\n        name : str, optional\n            The ``EXTNAME`` value; if this value is `None`, then the name from\n            the input image header will be used; if there is no name in the\n            input image header then the default name ``COMPRESSED_IMAGE`` is\n            used.\n\n        compression_type : str, optional\n            Compression algorithm: one of\n            ``'RICE_1'``, ``'RICE_ONE'``, ``'PLIO_1'``, ``'GZIP_1'``,\n            ``'GZIP_2'``, ``'HCOMPRESS_1'``\n\n        tile_size : int, optional\n            Compression tile sizes.  Default treats each row of image as a\n            tile.\n\n        hcomp_scale : float, optional\n            HCOMPRESS scale parameter\n\n        hcomp_smooth : float, optional\n            HCOMPRESS smooth parameter\n\n        quantize_level : float, optional\n            Floating point quantization level; see note below\n\n        quantize_method : int, optional\n            Floating point quantization dithering method; can be either\n            ``NO_DITHER`` (-1; default), ``SUBTRACTIVE_DITHER_1`` (1), or\n            ``SUBTRACTIVE_DITHER_2`` (2); see note below\n\n        dither_seed : int, optional\n            Random seed to use for dithering; can be either an integer in the\n            range 1 to 1000 (inclusive), ``DITHER_SEED_CLOCK`` (0; default), or\n            ``DITHER_SEED_CHECKSUM`` (-1); see note below\n\n        Notes\n        -----\n        The astropy.io.fits package supports 2 methods of image compression:\n\n            1) The entire FITS file may be externally compressed with the gzip\n               or pkzip utility programs, producing a ``*.gz`` or ``*.zip``\n               file, respectively.  When reading compressed files of this type,\n               Astropy first uncompresses the entire file into a temporary file\n               before performing the requested read operations.  The\n               astropy.io.fits package does not support writing to these types\n               of compressed files.  This type of compression is supported in\n               the ``_File`` class, not in the `CompImageHDU` class.  The file\n               compression type is recognized by the ``.gz`` or ``.zip`` file\n               name extension.\n\n            2) The `CompImageHDU` class supports the FITS tiled image\n               compression convention in which the image is subdivided into a\n               grid of rectangular tiles, and each tile of pixels is\n               individually compressed.  The details of this FITS compression\n               convention are described at the `FITS Support Office web site\n               <https://fits.gsfc.nasa.gov/registry/tilecompression.html>`_.\n               Basically, the compressed image tiles are stored in rows of a\n               variable length array column in a FITS binary table.  The\n               astropy.io.fits recognizes that this binary table extension\n               contains an image and treats it as if it were an image\n               extension.  Under this tile-compression format, FITS header\n               keywords remain uncompressed.  At this time, Astropy does not\n               support the ability to extract and uncompress sections of the\n               image without having to uncompress the entire image.\n\n        The astropy.io.fits package supports 3 general-purpose compression\n        algorithms plus one other special-purpose compression technique that is\n        designed for data masks with positive integer pixel values.  The 3\n        general purpose algorithms are GZIP, Rice, and HCOMPRESS, and the\n        special-purpose technique is the IRAF pixel list compression technique\n        (PLIO).  The ``compression_type`` parameter defines the compression\n        algorithm to be used.\n\n        The FITS image can be subdivided into any desired rectangular grid of\n        compression tiles.  With the GZIP, Rice, and PLIO algorithms, the\n        default is to take each row of the image as a tile.  The HCOMPRESS\n        algorithm is inherently 2-dimensional in nature, so the default in this\n        case is to take 16 rows of the image per tile.  In most cases, it makes\n        little difference what tiling pattern is used, so the default tiles are\n        usually adequate.  In the case of very small images, it could be more\n        efficient to compress the whole image as a single tile.  Note that the\n        image dimensions are not required to be an integer multiple of the tile\n        dimensions; if not, then the tiles at the edges of the image will be\n        smaller than the other tiles.  The ``tile_size`` parameter may be\n        provided as a list of tile sizes, one for each dimension in the image.\n        For example a ``tile_size`` value of ``[100,100]`` would divide a 300 X\n        300 image into 9 100 X 100 tiles.\n\n        The 4 supported image compression algorithms are all 'lossless' when\n        applied to integer FITS images; the pixel values are preserved exactly\n        with no loss of information during the compression and uncompression\n        process.  In addition, the HCOMPRESS algorithm supports a 'lossy'\n        compression mode that will produce larger amount of image compression.\n        This is achieved by specifying a non-zero value for the ``hcomp_scale``\n        parameter.  Since the amount of compression that is achieved depends\n        directly on the RMS noise in the image, it is usually more convenient\n        to specify the ``hcomp_scale`` factor relative to the RMS noise.\n        Setting ``hcomp_scale = 2.5`` means use a scale factor that is 2.5\n        times the calculated RMS noise in the image tile.  In some cases it may\n        be desirable to specify the exact scaling to be used, instead of\n        specifying it relative to the calculated noise value.  This may be done\n        by specifying the negative of the desired scale value (typically in the\n        range -2 to -100).\n\n        Very high compression factors (of 100 or more) can be achieved by using\n        large ``hcomp_scale`` values, however, this can produce undesirable\n        'blocky' artifacts in the compressed image.  A variation of the\n        HCOMPRESS algorithm (called HSCOMPRESS) can be used in this case to\n        apply a small amount of smoothing of the image when it is uncompressed\n        to help cover up these artifacts.  This smoothing is purely cosmetic\n        and does not cause any significant change to the image pixel values.\n        Setting the ``hcomp_smooth`` parameter to 1 will engage the smoothing\n        algorithm.\n\n        Floating point FITS images (which have ``BITPIX`` = -32 or -64) usually\n        contain too much 'noise' in the least significant bits of the mantissa\n        of the pixel values to be effectively compressed with any lossless\n        algorithm.  Consequently, floating point images are first quantized\n        into scaled integer pixel values (and thus throwing away much of the\n        noise) before being compressed with the specified algorithm (either\n        GZIP, RICE, or HCOMPRESS).  This technique produces much higher\n        compression factors than simply using the GZIP utility to externally\n        compress the whole FITS file, but it also means that the original\n        floating point value pixel values are not exactly preserved.  When done\n        properly, this integer scaling technique will only discard the\n        insignificant noise while still preserving all the real information in\n        the image.  The amount of precision that is retained in the pixel\n        values is controlled by the ``quantize_level`` parameter.  Larger\n        values will result in compressed images whose pixels more closely match\n        the floating point pixel values, but at the same time the amount of\n        compression that is achieved will be reduced.  Users should experiment\n        with different values for this parameter to determine the optimal value\n        that preserves all the useful information in the image, without\n        needlessly preserving all the 'noise' which will hurt the compression\n        efficiency.\n\n        The default value for the ``quantize_level`` scale factor is 16, which\n        means that scaled integer pixel values will be quantized such that the\n        difference between adjacent integer values will be 1/16th of the noise\n        level in the image background.  An optimized algorithm is used to\n        accurately estimate the noise in the image.  As an example, if the RMS\n        noise in the background pixels of an image = 32.0, then the spacing\n        between adjacent scaled integer pixel values will equal 2.0 by default.\n        Note that the RMS noise is independently calculated for each tile of\n        the image, so the resulting integer scaling factor may fluctuate\n        slightly for each tile.  In some cases, it may be desirable to specify\n        the exact quantization level to be used, instead of specifying it\n        relative to the calculated noise value.  This may be done by specifying\n        the negative of desired quantization level for the value of\n        ``quantize_level``.  In the previous example, one could specify\n        ``quantize_level = -2.0`` so that the quantized integer levels differ\n        by 2.0.  Larger negative values for ``quantize_level`` means that the\n        levels are more coarsely-spaced, and will produce higher compression\n        factors.\n\n        The quantization algorithm can also apply one of two random dithering\n        methods in order to reduce bias in the measured intensity of background\n        regions.  The default method, specified with the constant\n        ``SUBTRACTIVE_DITHER_1`` adds dithering to the zero-point of the\n        quantization array itself rather than adding noise to the actual image.\n        The random noise is added on a pixel-by-pixel basis, so in order\n        restore each pixel from its integer value to its floating point value\n        it is necessary to replay the same sequence of random numbers for each\n        pixel (see below).  The other method, ``SUBTRACTIVE_DITHER_2``, is\n        exactly like the first except that before dithering any pixel with a\n        floating point value of ``0.0`` is replaced with the special integer\n        value ``-2147483647``.  When the image is uncompressed, pixels with\n        this value are restored back to ``0.0`` exactly.  Finally, a value of\n        ``NO_DITHER`` disables dithering entirely.\n\n        As mentioned above, when using the subtractive dithering algorithm it\n        is necessary to be able to generate a (pseudo-)random sequence of noise\n        for each pixel, and replay that same sequence upon decompressing.  To\n        facilitate this, a random seed between 1 and 10000 (inclusive) is used\n        to seed a random number generator, and that seed is stored in the\n        ``ZDITHER0`` keyword in the header of the compressed HDU.  In order to\n        use that seed to generate the same sequence of random numbers the same\n        random number generator must be used at compression and decompression\n        time; for that reason the tiled image convention provides an\n        implementation of a very simple pseudo-random number generator.  The\n        seed itself can be provided in one of three ways, controllable by the\n        ``dither_seed`` argument:  It may be specified manually, or it may be\n        generated arbitrarily based on the system's clock\n        (``DITHER_SEED_CLOCK``) or based on a checksum of the pixels in the\n        image's first tile (``DITHER_SEED_CHECKSUM``).  The clock-based method\n        is the default, and is sufficient to ensure that the value is\n        reasonably \"arbitrary\" and that the same seed is unlikely to be\n        generated sequentially.  The checksum method, on the other hand,\n        ensures that the same seed is used every time for a specific image.\n        This is particularly useful for software testing as it ensures that the\n        same image will always use the same seed.\n        ","endLoc":662,"header":"def __init__(self, data=None, header=None, name=None,\n                 compression_type=DEFAULT_COMPRESSION_TYPE,\n                 tile_size=None,\n                 hcomp_scale=DEFAULT_HCOMP_SCALE,\n                 hcomp_smooth=DEFAULT_HCOMP_SMOOTH,\n                 quantize_level=DEFAULT_QUANTIZE_LEVEL,\n                 quantize_method=DEFAULT_QUANTIZE_METHOD,\n                 dither_seed=DEFAULT_DITHER_SEED,\n                 do_not_scale_image_data=False,\n                 uint=False, scale_back=False, **kwargs)","id":2248,"name":"__init__","nodeType":"Function","startLoc":396,"text":"def __init__(self, data=None, header=None, name=None,\n                 compression_type=DEFAULT_COMPRESSION_TYPE,\n                 tile_size=None,\n                 hcomp_scale=DEFAULT_HCOMP_SCALE,\n                 hcomp_smooth=DEFAULT_HCOMP_SMOOTH,\n                 quantize_level=DEFAULT_QUANTIZE_LEVEL,\n                 quantize_method=DEFAULT_QUANTIZE_METHOD,\n                 dither_seed=DEFAULT_DITHER_SEED,\n                 do_not_scale_image_data=False,\n                 uint=False, scale_back=False, **kwargs):\n        \"\"\"\n        Parameters\n        ----------\n        data : array, optional\n            Uncompressed image data\n\n        header : `~astropy.io.fits.Header`, optional\n            Header to be associated with the image; when reading the HDU from a\n            file (data=DELAYED), the header read from the file\n\n        name : str, optional\n            The ``EXTNAME`` value; if this value is `None`, then the name from\n            the input image header will be used; if there is no name in the\n            input image header then the default name ``COMPRESSED_IMAGE`` is\n            used.\n\n        compression_type : str, optional\n            Compression algorithm: one of\n            ``'RICE_1'``, ``'RICE_ONE'``, ``'PLIO_1'``, ``'GZIP_1'``,\n            ``'GZIP_2'``, ``'HCOMPRESS_1'``\n\n        tile_size : int, optional\n            Compression tile sizes.  Default treats each row of image as a\n            tile.\n\n        hcomp_scale : float, optional\n            HCOMPRESS scale parameter\n\n        hcomp_smooth : float, optional\n            HCOMPRESS smooth parameter\n\n        quantize_level : float, optional\n            Floating point quantization level; see note below\n\n        quantize_method : int, optional\n            Floating point quantization dithering method; can be either\n            ``NO_DITHER`` (-1; default), ``SUBTRACTIVE_DITHER_1`` (1), or\n            ``SUBTRACTIVE_DITHER_2`` (2); see note below\n\n        dither_seed : int, optional\n            Random seed to use for dithering; can be either an integer in the\n            range 1 to 1000 (inclusive), ``DITHER_SEED_CLOCK`` (0; default), or\n            ``DITHER_SEED_CHECKSUM`` (-1); see note below\n\n        Notes\n        -----\n        The astropy.io.fits package supports 2 methods of image compression:\n\n            1) The entire FITS file may be externally compressed with the gzip\n               or pkzip utility programs, producing a ``*.gz`` or ``*.zip``\n               file, respectively.  When reading compressed files of this type,\n               Astropy first uncompresses the entire file into a temporary file\n               before performing the requested read operations.  The\n               astropy.io.fits package does not support writing to these types\n               of compressed files.  This type of compression is supported in\n               the ``_File`` class, not in the `CompImageHDU` class.  The file\n               compression type is recognized by the ``.gz`` or ``.zip`` file\n               name extension.\n\n            2) The `CompImageHDU` class supports the FITS tiled image\n               compression convention in which the image is subdivided into a\n               grid of rectangular tiles, and each tile of pixels is\n               individually compressed.  The details of this FITS compression\n               convention are described at the `FITS Support Office web site\n               <https://fits.gsfc.nasa.gov/registry/tilecompression.html>`_.\n               Basically, the compressed image tiles are stored in rows of a\n               variable length array column in a FITS binary table.  The\n               astropy.io.fits recognizes that this binary table extension\n               contains an image and treats it as if it were an image\n               extension.  Under this tile-compression format, FITS header\n               keywords remain uncompressed.  At this time, Astropy does not\n               support the ability to extract and uncompress sections of the\n               image without having to uncompress the entire image.\n\n        The astropy.io.fits package supports 3 general-purpose compression\n        algorithms plus one other special-purpose compression technique that is\n        designed for data masks with positive integer pixel values.  The 3\n        general purpose algorithms are GZIP, Rice, and HCOMPRESS, and the\n        special-purpose technique is the IRAF pixel list compression technique\n        (PLIO).  The ``compression_type`` parameter defines the compression\n        algorithm to be used.\n\n        The FITS image can be subdivided into any desired rectangular grid of\n        compression tiles.  With the GZIP, Rice, and PLIO algorithms, the\n        default is to take each row of the image as a tile.  The HCOMPRESS\n        algorithm is inherently 2-dimensional in nature, so the default in this\n        case is to take 16 rows of the image per tile.  In most cases, it makes\n        little difference what tiling pattern is used, so the default tiles are\n        usually adequate.  In the case of very small images, it could be more\n        efficient to compress the whole image as a single tile.  Note that the\n        image dimensions are not required to be an integer multiple of the tile\n        dimensions; if not, then the tiles at the edges of the image will be\n        smaller than the other tiles.  The ``tile_size`` parameter may be\n        provided as a list of tile sizes, one for each dimension in the image.\n        For example a ``tile_size`` value of ``[100,100]`` would divide a 300 X\n        300 image into 9 100 X 100 tiles.\n\n        The 4 supported image compression algorithms are all 'lossless' when\n        applied to integer FITS images; the pixel values are preserved exactly\n        with no loss of information during the compression and uncompression\n        process.  In addition, the HCOMPRESS algorithm supports a 'lossy'\n        compression mode that will produce larger amount of image compression.\n        This is achieved by specifying a non-zero value for the ``hcomp_scale``\n        parameter.  Since the amount of compression that is achieved depends\n        directly on the RMS noise in the image, it is usually more convenient\n        to specify the ``hcomp_scale`` factor relative to the RMS noise.\n        Setting ``hcomp_scale = 2.5`` means use a scale factor that is 2.5\n        times the calculated RMS noise in the image tile.  In some cases it may\n        be desirable to specify the exact scaling to be used, instead of\n        specifying it relative to the calculated noise value.  This may be done\n        by specifying the negative of the desired scale value (typically in the\n        range -2 to -100).\n\n        Very high compression factors (of 100 or more) can be achieved by using\n        large ``hcomp_scale`` values, however, this can produce undesirable\n        'blocky' artifacts in the compressed image.  A variation of the\n        HCOMPRESS algorithm (called HSCOMPRESS) can be used in this case to\n        apply a small amount of smoothing of the image when it is uncompressed\n        to help cover up these artifacts.  This smoothing is purely cosmetic\n        and does not cause any significant change to the image pixel values.\n        Setting the ``hcomp_smooth`` parameter to 1 will engage the smoothing\n        algorithm.\n\n        Floating point FITS images (which have ``BITPIX`` = -32 or -64) usually\n        contain too much 'noise' in the least significant bits of the mantissa\n        of the pixel values to be effectively compressed with any lossless\n        algorithm.  Consequently, floating point images are first quantized\n        into scaled integer pixel values (and thus throwing away much of the\n        noise) before being compressed with the specified algorithm (either\n        GZIP, RICE, or HCOMPRESS).  This technique produces much higher\n        compression factors than simply using the GZIP utility to externally\n        compress the whole FITS file, but it also means that the original\n        floating point value pixel values are not exactly preserved.  When done\n        properly, this integer scaling technique will only discard the\n        insignificant noise while still preserving all the real information in\n        the image.  The amount of precision that is retained in the pixel\n        values is controlled by the ``quantize_level`` parameter.  Larger\n        values will result in compressed images whose pixels more closely match\n        the floating point pixel values, but at the same time the amount of\n        compression that is achieved will be reduced.  Users should experiment\n        with different values for this parameter to determine the optimal value\n        that preserves all the useful information in the image, without\n        needlessly preserving all the 'noise' which will hurt the compression\n        efficiency.\n\n        The default value for the ``quantize_level`` scale factor is 16, which\n        means that scaled integer pixel values will be quantized such that the\n        difference between adjacent integer values will be 1/16th of the noise\n        level in the image background.  An optimized algorithm is used to\n        accurately estimate the noise in the image.  As an example, if the RMS\n        noise in the background pixels of an image = 32.0, then the spacing\n        between adjacent scaled integer pixel values will equal 2.0 by default.\n        Note that the RMS noise is independently calculated for each tile of\n        the image, so the resulting integer scaling factor may fluctuate\n        slightly for each tile.  In some cases, it may be desirable to specify\n        the exact quantization level to be used, instead of specifying it\n        relative to the calculated noise value.  This may be done by specifying\n        the negative of desired quantization level for the value of\n        ``quantize_level``.  In the previous example, one could specify\n        ``quantize_level = -2.0`` so that the quantized integer levels differ\n        by 2.0.  Larger negative values for ``quantize_level`` means that the\n        levels are more coarsely-spaced, and will produce higher compression\n        factors.\n\n        The quantization algorithm can also apply one of two random dithering\n        methods in order to reduce bias in the measured intensity of background\n        regions.  The default method, specified with the constant\n        ``SUBTRACTIVE_DITHER_1`` adds dithering to the zero-point of the\n        quantization array itself rather than adding noise to the actual image.\n        The random noise is added on a pixel-by-pixel basis, so in order\n        restore each pixel from its integer value to its floating point value\n        it is necessary to replay the same sequence of random numbers for each\n        pixel (see below).  The other method, ``SUBTRACTIVE_DITHER_2``, is\n        exactly like the first except that before dithering any pixel with a\n        floating point value of ``0.0`` is replaced with the special integer\n        value ``-2147483647``.  When the image is uncompressed, pixels with\n        this value are restored back to ``0.0`` exactly.  Finally, a value of\n        ``NO_DITHER`` disables dithering entirely.\n\n        As mentioned above, when using the subtractive dithering algorithm it\n        is necessary to be able to generate a (pseudo-)random sequence of noise\n        for each pixel, and replay that same sequence upon decompressing.  To\n        facilitate this, a random seed between 1 and 10000 (inclusive) is used\n        to seed a random number generator, and that seed is stored in the\n        ``ZDITHER0`` keyword in the header of the compressed HDU.  In order to\n        use that seed to generate the same sequence of random numbers the same\n        random number generator must be used at compression and decompression\n        time; for that reason the tiled image convention provides an\n        implementation of a very simple pseudo-random number generator.  The\n        seed itself can be provided in one of three ways, controllable by the\n        ``dither_seed`` argument:  It may be specified manually, or it may be\n        generated arbitrarily based on the system's clock\n        (``DITHER_SEED_CLOCK``) or based on a checksum of the pixels in the\n        image's first tile (``DITHER_SEED_CHECKSUM``).  The clock-based method\n        is the default, and is sufficient to ensure that the value is\n        reasonably \"arbitrary\" and that the same seed is unlikely to be\n        generated sequentially.  The checksum method, on the other hand,\n        ensures that the same seed is used every time for a specific image.\n        This is particularly useful for software testing as it ensures that the\n        same image will always use the same seed.\n        \"\"\"\n\n        if not COMPRESSION_SUPPORTED:\n            # TODO: Raise a more specific Exception type\n            raise Exception('The astropy.io.fits.compression module is not '\n                            'available.  Creation of compressed image HDUs is '\n                            'disabled.')\n\n        compression_type = CMTYPE_ALIASES.get(compression_type, compression_type)\n\n        if data is DELAYED:\n            # Reading the HDU from a file\n            super().__init__(data=data, header=header)\n        else:\n            # Create at least a skeleton HDU that matches the input\n            # header and data (if any were input)\n            super().__init__(data=None, header=header)\n\n            # Store the input image data\n            self.data = data\n\n            # Update the table header (_header) to the compressed\n            # image format and to match the input data (if any);\n            # Create the image header (_image_header) from the input\n            # image header (if any) and ensure it matches the input\n            # data; Create the initially empty table data array to\n            # hold the compressed data.\n            self._update_header_data(header, name,\n                                     compression_type=compression_type,\n                                     tile_size=tile_size,\n                                     hcomp_scale=hcomp_scale,\n                                     hcomp_smooth=hcomp_smooth,\n                                     quantize_level=quantize_level,\n                                     quantize_method=quantize_method,\n                                     dither_seed=dither_seed)\n\n        # TODO: A lot of this should be passed on to an internal image HDU o\n        # something like that, see ticket #88\n        self._do_not_scale_image_data = do_not_scale_image_data\n        self._uint = uint\n        self._scale_back = scale_back\n\n        self._axes = [self._header.get('ZNAXIS' + str(axis + 1), 0)\n                      for axis in range(self._header.get('ZNAXIS', 0))]\n\n        # store any scale factors from the table header\n        if do_not_scale_image_data:\n            self._bzero = 0\n            self._bscale = 1\n        else:\n            self._bzero = self._header.get('BZERO', 0)\n            self._bscale = self._header.get('BSCALE', 1)\n        self._bitpix = self._header['ZBITPIX']\n\n        self._orig_bzero = self._bzero\n        self._orig_bscale = self._bscale\n        self._orig_bitpix = self._bitpix"},{"col":4,"comment":"null","endLoc":1642,"header":"def _make_index_row_display_table(self, index_row_name)","id":2249,"name":"_make_index_row_display_table","nodeType":"Function","startLoc":1636,"text":"def _make_index_row_display_table(self, index_row_name):\n        if index_row_name not in self.columns:\n            idx_col = self.ColumnClass(name=index_row_name, data=np.arange(len(self)))\n            return self.__class__([idx_col] + list(self.columns.values()),\n                                  copy=False)\n        else:\n            return self"},{"col":4,"comment":"Render the table in HTML and show it in the IPython notebook.\n\n        Parameters\n        ----------\n        tableid : str or None\n            An html ID tag for the table.  Default is ``table{id}-XXX``, where\n            id is the unique integer id of the table object, id(self), and XXX\n            is a random number to avoid conflicts when printing the same table\n            multiple times.\n        table_class : str or None\n            A string with a list of HTML classes used to style the table.\n            The special default string ('astropy-default') means that the string\n            will be retrieved from the configuration item\n            ``astropy.table.default_notebook_table_class``. Note that these\n            table classes may make use of bootstrap, as this is loaded with the\n            notebook.  See `this page <https://getbootstrap.com/css/#tables>`_\n            for the list of classes.\n        css : str\n            A valid CSS string declaring the formatting for the table. Defaults\n            to ``astropy.table.jsviewer.DEFAULT_CSS_NB``.\n        display_length : int, optional\n            Number or rows to show. Defaults to 50.\n        show_row_index : str or False\n            If this does not evaluate to False, a column with the given name\n            will be added to the version of the table that gets displayed.\n            This new column shows the index of the row in the table itself,\n            even when the displayed table is re-sorted by another column. Note\n            that if a column with this name already exists, this option will be\n            ignored. Defaults to \"idx\".\n\n        Notes\n        -----\n        Currently, unlike `show_in_browser` (with ``jsviewer=True``), this\n        method needs to access online javascript code repositories.  This is due\n        to modern browsers' limitations on accessing local files.  Hence, if you\n        call this method while offline (and don't have a cached version of\n        jquery and jquery.dataTables), you will not get the jsviewer features.\n        ","endLoc":1706,"header":"def show_in_notebook(self, tableid=None, css=None, display_length=50,\n                         table_class='astropy-default', show_row_index='idx')","id":2250,"name":"show_in_notebook","nodeType":"Function","startLoc":1644,"text":"def show_in_notebook(self, tableid=None, css=None, display_length=50,\n                         table_class='astropy-default', show_row_index='idx'):\n        \"\"\"Render the table in HTML and show it in the IPython notebook.\n\n        Parameters\n        ----------\n        tableid : str or None\n            An html ID tag for the table.  Default is ``table{id}-XXX``, where\n            id is the unique integer id of the table object, id(self), and XXX\n            is a random number to avoid conflicts when printing the same table\n            multiple times.\n        table_class : str or None\n            A string with a list of HTML classes used to style the table.\n            The special default string ('astropy-default') means that the string\n            will be retrieved from the configuration item\n            ``astropy.table.default_notebook_table_class``. Note that these\n            table classes may make use of bootstrap, as this is loaded with the\n            notebook.  See `this page <https://getbootstrap.com/css/#tables>`_\n            for the list of classes.\n        css : str\n            A valid CSS string declaring the formatting for the table. Defaults\n            to ``astropy.table.jsviewer.DEFAULT_CSS_NB``.\n        display_length : int, optional\n            Number or rows to show. Defaults to 50.\n        show_row_index : str or False\n            If this does not evaluate to False, a column with the given name\n            will be added to the version of the table that gets displayed.\n            This new column shows the index of the row in the table itself,\n            even when the displayed table is re-sorted by another column. Note\n            that if a column with this name already exists, this option will be\n            ignored. Defaults to \"idx\".\n\n        Notes\n        -----\n        Currently, unlike `show_in_browser` (with ``jsviewer=True``), this\n        method needs to access online javascript code repositories.  This is due\n        to modern browsers' limitations on accessing local files.  Hence, if you\n        call this method while offline (and don't have a cached version of\n        jquery and jquery.dataTables), you will not get the jsviewer features.\n        \"\"\"\n\n        from .jsviewer import JSViewer\n        from IPython.display import HTML\n\n        if tableid is None:\n            tableid = f'table{id(self)}-{np.random.randint(1, 1e6)}'\n\n        jsv = JSViewer(display_length=display_length)\n        if show_row_index:\n            display_table = self._make_index_row_display_table(show_row_index)\n        else:\n            display_table = self\n        if table_class == 'astropy-default':\n            table_class = conf.default_notebook_table_class\n        html = display_table._base_repr_(html=True, max_width=-1, tableid=tableid,\n                                         max_lines=-1, show_dtype=False,\n                                         tableclass=table_class)\n\n        columns = display_table.columns.values()\n        sortable_columns = [i for i, col in enumerate(columns)\n                            if col.info.dtype.kind in 'iufc']\n        html += jsv.ipynb(tableid, css=css, sort_columns=sortable_columns)\n        return HTML(html)"},{"col":4,"comment":"null","endLoc":132,"header":"def __init__(self, use_local_files=False, display_length=50)","id":2251,"name":"__init__","nodeType":"Function","startLoc":125,"text":"def __init__(self, use_local_files=False, display_length=50):\n        self._use_local_files = use_local_files\n        self.display_length_menu = [[10, 25, 50, 100, 500, 1000, -1],\n                                    [10, 25, 50, 100, 500, 1000, \"All\"]]\n        self.display_length = display_length\n        for L in self.display_length_menu:\n            if display_length not in L:\n                L.insert(0, display_length)"},{"col":4,"comment":"null","endLoc":953,"header":"@staticmethod\n    def _today()","id":2252,"name":"_today","nodeType":"Function","startLoc":948,"text":"@staticmethod\n    def _today():\n        # Get current day in scale='tai' without going through a scale change\n        # (so we do not need leap seconds).\n        s = '{0.year:04d}-{0.month:02d}-{0.day:02d}'.format(datetime.utcnow())\n        return Time(s, scale='tai', format='iso', out_subfmt='date')"},{"col":4,"comment":"Render the table in HTML and show it in a web browser.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum number of rows to export to the table (set low by default\n            to avoid memory issues, since the browser view requires duplicating\n            the table in memory).  A negative value of ``max_lines`` indicates\n            no row limit.\n        jsviewer : bool\n            If `True`, prepends some javascript headers so that the table is\n            rendered as a `DataTables <https://datatables.net>`_ data table.\n            This allows in-browser searching & sorting.\n        browser : str\n            Any legal browser name, e.g. ``'firefox'``, ``'chrome'``,\n            ``'safari'`` (for mac, you may need to use ``'open -a\n            \"/Applications/Google Chrome.app\" {}'`` for Chrome).  If\n            ``'default'``, will use the system default browser.\n        jskwargs : dict\n            Passed to the `astropy.table.JSViewer` init. Defaults to\n            ``{'use_local_files': True}`` which means that the JavaScript\n            libraries will be served from local copies.\n        tableid : str or None\n            An html ID tag for the table.  Default is ``table{id}``, where id\n            is the unique integer id of the table object, id(self).\n        table_class : str or None\n            A string with a list of HTML classes used to style the table.\n            Default is \"display compact\", and other possible values can be\n            found in https://www.datatables.net/manual/styling/classes\n        css : str\n            A valid CSS string declaring the formatting for the table. Defaults\n            to ``astropy.table.jsviewer.DEFAULT_CSS``.\n        show_row_index : str or False\n            If this does not evaluate to False, a column with the given name\n            will be added to the version of the table that gets displayed.\n            This new column shows the index of the row in the table itself,\n            even when the displayed table is re-sorted by another column. Note\n            that if a column with this name already exists, this option will be\n            ignored. Defaults to \"idx\".\n        ","endLoc":1785,"header":"def show_in_browser(self, max_lines=5000, jsviewer=False,\n                        browser='default', jskwargs={'use_local_files': True},\n                        tableid=None, table_class=\"display compact\",\n                        css=None, show_row_index='idx')","id":2253,"name":"show_in_browser","nodeType":"Function","startLoc":1708,"text":"def show_in_browser(self, max_lines=5000, jsviewer=False,\n                        browser='default', jskwargs={'use_local_files': True},\n                        tableid=None, table_class=\"display compact\",\n                        css=None, show_row_index='idx'):\n        \"\"\"Render the table in HTML and show it in a web browser.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum number of rows to export to the table (set low by default\n            to avoid memory issues, since the browser view requires duplicating\n            the table in memory).  A negative value of ``max_lines`` indicates\n            no row limit.\n        jsviewer : bool\n            If `True`, prepends some javascript headers so that the table is\n            rendered as a `DataTables <https://datatables.net>`_ data table.\n            This allows in-browser searching & sorting.\n        browser : str\n            Any legal browser name, e.g. ``'firefox'``, ``'chrome'``,\n            ``'safari'`` (for mac, you may need to use ``'open -a\n            \"/Applications/Google Chrome.app\" {}'`` for Chrome).  If\n            ``'default'``, will use the system default browser.\n        jskwargs : dict\n            Passed to the `astropy.table.JSViewer` init. Defaults to\n            ``{'use_local_files': True}`` which means that the JavaScript\n            libraries will be served from local copies.\n        tableid : str or None\n            An html ID tag for the table.  Default is ``table{id}``, where id\n            is the unique integer id of the table object, id(self).\n        table_class : str or None\n            A string with a list of HTML classes used to style the table.\n            Default is \"display compact\", and other possible values can be\n            found in https://www.datatables.net/manual/styling/classes\n        css : str\n            A valid CSS string declaring the formatting for the table. Defaults\n            to ``astropy.table.jsviewer.DEFAULT_CSS``.\n        show_row_index : str or False\n            If this does not evaluate to False, a column with the given name\n            will be added to the version of the table that gets displayed.\n            This new column shows the index of the row in the table itself,\n            even when the displayed table is re-sorted by another column. Note\n            that if a column with this name already exists, this option will be\n            ignored. Defaults to \"idx\".\n        \"\"\"\n\n        import os\n        import webbrowser\n        import tempfile\n        from .jsviewer import DEFAULT_CSS\n        from urllib.parse import urljoin\n        from urllib.request import pathname2url\n\n        if css is None:\n            css = DEFAULT_CSS\n\n        # We can't use NamedTemporaryFile here because it gets deleted as\n        # soon as it gets garbage collected.\n        tmpdir = tempfile.mkdtemp()\n        path = os.path.join(tmpdir, 'table.html')\n\n        with open(path, 'w') as tmp:\n            if jsviewer:\n                if show_row_index:\n                    display_table = self._make_index_row_display_table(show_row_index)\n                else:\n                    display_table = self\n                display_table.write(tmp, format='jsviewer', css=css,\n                                    max_lines=max_lines, jskwargs=jskwargs,\n                                    table_id=tableid, table_class=table_class)\n            else:\n                self.write(tmp, format='html')\n\n        try:\n            br = webbrowser.get(None if browser == 'default' else browser)\n        except webbrowser.Error:\n            log.error(f\"Browser '{browser}' not found.\")\n        else:\n            br.open(urljoin('file:', pathname2url(path)))"},{"col":4,"comment":"\n        Update the table header (`_header`) to the compressed\n        image format and to match the input data (if any).  Create\n        the image header (`_image_header`) from the input image\n        header (if any) and ensure it matches the input\n        data. Create the initially-empty table data array to hold\n        the compressed data.\n\n        This method is mainly called internally, but a user may wish to\n        call this method after assigning new data to the `CompImageHDU`\n        object that is of a different type.\n\n        Parameters\n        ----------\n        image_header : `~astropy.io.fits.Header`\n            header to be associated with the image\n\n        name : str, optional\n            the ``EXTNAME`` value; if this value is `None`, then the name from\n            the input image header will be used; if there is no name in the\n            input image header then the default name 'COMPRESSED_IMAGE' is used\n\n        compression_type : str, optional\n            compression algorithm 'RICE_1', 'PLIO_1', 'GZIP_1', 'GZIP_2',\n            'HCOMPRESS_1'; if this value is `None`, use value already in the\n            header; if no value already in the header, use 'RICE_1'\n\n        tile_size : sequence of int, optional\n            compression tile sizes as a list; if this value is `None`, use\n            value already in the header; if no value already in the header,\n            treat each row of image as a tile\n\n        hcomp_scale : float, optional\n            HCOMPRESS scale parameter; if this value is `None`, use the value\n            already in the header; if no value already in the header, use 1\n\n        hcomp_smooth : float, optional\n            HCOMPRESS smooth parameter; if this value is `None`, use the value\n            already in the header; if no value already in the header, use 0\n\n        quantize_level : float, optional\n            floating point quantization level; if this value is `None`, use the\n            value already in the header; if no value already in header, use 16\n\n        quantize_method : int, optional\n            floating point quantization dithering method; can be either\n            NO_DITHER (-1), SUBTRACTIVE_DITHER_1 (1; default), or\n            SUBTRACTIVE_DITHER_2 (2)\n\n        dither_seed : int, optional\n            random seed to use for dithering; can be either an integer in the\n            range 1 to 1000 (inclusive), DITHER_SEED_CLOCK (0; default), or\n            DITHER_SEED_CHECKSUM (-1)\n        ","endLoc":1381,"header":"def _update_header_data(self, image_header,\n                            name=None,\n                            compression_type=None,\n                            tile_size=None,\n                            hcomp_scale=None,\n                            hcomp_smooth=None,\n                            quantize_level=None,\n                            quantize_method=None,\n                            dither_seed=None)","id":2254,"name":"_update_header_data","nodeType":"Function","startLoc":734,"text":"def _update_header_data(self, image_header,\n                            name=None,\n                            compression_type=None,\n                            tile_size=None,\n                            hcomp_scale=None,\n                            hcomp_smooth=None,\n                            quantize_level=None,\n                            quantize_method=None,\n                            dither_seed=None):\n        \"\"\"\n        Update the table header (`_header`) to the compressed\n        image format and to match the input data (if any).  Create\n        the image header (`_image_header`) from the input image\n        header (if any) and ensure it matches the input\n        data. Create the initially-empty table data array to hold\n        the compressed data.\n\n        This method is mainly called internally, but a user may wish to\n        call this method after assigning new data to the `CompImageHDU`\n        object that is of a different type.\n\n        Parameters\n        ----------\n        image_header : `~astropy.io.fits.Header`\n            header to be associated with the image\n\n        name : str, optional\n            the ``EXTNAME`` value; if this value is `None`, then the name from\n            the input image header will be used; if there is no name in the\n            input image header then the default name 'COMPRESSED_IMAGE' is used\n\n        compression_type : str, optional\n            compression algorithm 'RICE_1', 'PLIO_1', 'GZIP_1', 'GZIP_2',\n            'HCOMPRESS_1'; if this value is `None`, use value already in the\n            header; if no value already in the header, use 'RICE_1'\n\n        tile_size : sequence of int, optional\n            compression tile sizes as a list; if this value is `None`, use\n            value already in the header; if no value already in the header,\n            treat each row of image as a tile\n\n        hcomp_scale : float, optional\n            HCOMPRESS scale parameter; if this value is `None`, use the value\n            already in the header; if no value already in the header, use 1\n\n        hcomp_smooth : float, optional\n            HCOMPRESS smooth parameter; if this value is `None`, use the value\n            already in the header; if no value already in the header, use 0\n\n        quantize_level : float, optional\n            floating point quantization level; if this value is `None`, use the\n            value already in the header; if no value already in header, use 16\n\n        quantize_method : int, optional\n            floating point quantization dithering method; can be either\n            NO_DITHER (-1), SUBTRACTIVE_DITHER_1 (1; default), or\n            SUBTRACTIVE_DITHER_2 (2)\n\n        dither_seed : int, optional\n            random seed to use for dithering; can be either an integer in the\n            range 1 to 1000 (inclusive), DITHER_SEED_CLOCK (0; default), or\n            DITHER_SEED_CHECKSUM (-1)\n        \"\"\"\n\n        # Clean up EXTNAME duplicates\n        self._remove_unnecessary_default_extnames(self._header)\n\n        image_hdu = ImageHDU(data=self.data, header=self._header)\n        self._image_header = CompImageHeader(self._header, image_hdu.header)\n        self._axes = image_hdu._axes\n        del image_hdu\n\n        # Determine based on the size of the input data whether to use the Q\n        # column format to store compressed data or the P format.\n        # The Q format is used only if the uncompressed data is larger than\n        # 4 GB.  This is not a perfect heuristic, as one can contrive an input\n        # array which, when compressed, the entire binary table representing\n        # the compressed data is larger than 4GB.  That said, this is the same\n        # heuristic used by CFITSIO, so this should give consistent results.\n        # And the cases where this heuristic is insufficient are extreme and\n        # almost entirely contrived corner cases, so it will do for now\n        if self._has_data:\n            huge_hdu = self.data.nbytes > 2 ** 32\n        else:\n            huge_hdu = False\n\n        # Update the extension name in the table header\n        if not name and 'EXTNAME' not in self._header:\n            # Do not sync this with the image header since the default\n            # name is specific to the table header.\n            self._header.set('EXTNAME', self._default_name,\n                             'name of this binary table extension',\n                             after='TFIELDS')\n        elif name:\n            # Force the name into table and image headers.\n            self.name = name\n\n        # Set the compression type in the table header.\n        if compression_type:\n            if compression_type not in COMPRESSION_TYPES:\n                warnings.warn(\n                    'Unknown compression type provided (supported are {}). '\n                    'Default ({}) compression will be used.'\n                    .format(', '.join(map(repr, COMPRESSION_TYPES)),\n                            DEFAULT_COMPRESSION_TYPE),\n                    AstropyUserWarning)\n                compression_type = DEFAULT_COMPRESSION_TYPE\n\n            self._header.set('ZCMPTYPE', compression_type,\n                             'compression algorithm', after='TFIELDS')\n        else:\n            compression_type = self._header.get('ZCMPTYPE',\n                                                DEFAULT_COMPRESSION_TYPE)\n            compression_type = CMTYPE_ALIASES.get(compression_type,\n                                                  compression_type)\n\n        # If the input image header had BSCALE/BZERO cards, then insert\n        # them in the table header.\n\n        if image_header:\n            bzero = image_header.get('BZERO', 0.0)\n            bscale = image_header.get('BSCALE', 1.0)\n            after_keyword = 'EXTNAME'\n\n            if bscale != 1.0:\n                self._header.set('BSCALE', bscale, after=after_keyword)\n                after_keyword = 'BSCALE'\n\n            if bzero != 0.0:\n                self._header.set('BZERO', bzero, after=after_keyword)\n\n        try:\n            bitpix_comment = image_header.comments['BITPIX']\n        except (AttributeError, KeyError):\n            bitpix_comment = 'data type of original image'\n\n        try:\n            naxis_comment = image_header.comments['NAXIS']\n        except (AttributeError, KeyError):\n            naxis_comment = 'dimension of original image'\n\n        # Set the label for the first column in the table\n\n        self._header.set('TTYPE1', 'COMPRESSED_DATA', 'label for field 1',\n                         after='TFIELDS')\n\n        # Set the data format for the first column.  It is dependent\n        # on the requested compression type.\n\n        if compression_type == 'PLIO_1':\n            tform1 = '1QI' if huge_hdu else '1PI'\n        else:\n            tform1 = '1QB' if huge_hdu else '1PB'\n\n        self._header.set('TFORM1', tform1,\n                         'data format of field: variable length array',\n                         after='TTYPE1')\n\n        # Create the first column for the table.  This column holds the\n        # compressed data.\n        col1 = Column(name=self._header['TTYPE1'], format=tform1)\n\n        # Create the additional columns required for floating point\n        # data and calculate the width of the output table.\n\n        zbitpix = self._image_header['BITPIX']\n\n        if zbitpix < 0 and quantize_level != 0.0:\n            # floating point image has 'COMPRESSED_DATA',\n            # 'UNCOMPRESSED_DATA', 'ZSCALE', and 'ZZERO' columns (unless using\n            # lossless compression, per CFITSIO)\n            ncols = 4\n\n            # CFITSIO 3.28 and up automatically use the GZIP_COMPRESSED_DATA\n            # store floating point data that couldn't be quantized, instead\n            # of the UNCOMPRESSED_DATA column.  There's no way to control\n            # this behavior so the only way to determine which behavior will\n            # be employed is via the CFITSIO version\n\n            ttype2 = 'GZIP_COMPRESSED_DATA'\n            # The required format for the GZIP_COMPRESSED_DATA is actually\n            # missing from the standard docs, but CFITSIO suggests it\n            # should be 1PB, which is logical.\n            tform2 = '1QB' if huge_hdu else '1PB'\n\n            # Set up the second column for the table that will hold any\n            # uncompressable data.\n            self._header.set('TTYPE2', ttype2, 'label for field 2',\n                             after='TFORM1')\n\n            self._header.set('TFORM2', tform2,\n                             'data format of field: variable length array',\n                             after='TTYPE2')\n\n            col2 = Column(name=ttype2, format=tform2)\n\n            # Set up the third column for the table that will hold\n            # the scale values for quantized data.\n            self._header.set('TTYPE3', 'ZSCALE', 'label for field 3',\n                             after='TFORM2')\n            self._header.set('TFORM3', '1D',\n                             'data format of field: 8-byte DOUBLE',\n                             after='TTYPE3')\n            col3 = Column(name=self._header['TTYPE3'],\n                          format=self._header['TFORM3'])\n\n            # Set up the fourth column for the table that will hold\n            # the zero values for the quantized data.\n            self._header.set('TTYPE4', 'ZZERO', 'label for field 4',\n                             after='TFORM3')\n            self._header.set('TFORM4', '1D',\n                             'data format of field: 8-byte DOUBLE',\n                             after='TTYPE4')\n            after = 'TFORM4'\n            col4 = Column(name=self._header['TTYPE4'],\n                          format=self._header['TFORM4'])\n\n            # Create the ColDefs object for the table\n            cols = ColDefs([col1, col2, col3, col4])\n        else:\n            # default table has just one 'COMPRESSED_DATA' column\n            ncols = 1\n            after = 'TFORM1'\n\n            # remove any header cards for the additional columns that\n            # may be left over from the previous data\n            to_remove = ['TTYPE2', 'TFORM2', 'TTYPE3', 'TFORM3', 'TTYPE4',\n                         'TFORM4']\n\n            for k in to_remove:\n                try:\n                    del self._header[k]\n                except KeyError:\n                    pass\n\n            # Create the ColDefs object for the table\n            cols = ColDefs([col1])\n\n        # Update the table header with the width of the table, the\n        # number of fields in the table, the indicator for a compressed\n        # image HDU, the data type of the image data and the number of\n        # dimensions in the image data array.\n        self._header.set('NAXIS1', cols.dtype.itemsize,\n                         'width of table in bytes')\n        self._header.set('TFIELDS', ncols, 'number of fields in each row',\n                         after='GCOUNT')\n        self._header.set('ZIMAGE', True, 'extension contains compressed image',\n                         after=after)\n        self._header.set('ZBITPIX', zbitpix,\n                         bitpix_comment, after='ZIMAGE')\n        self._header.set('ZNAXIS', self._image_header['NAXIS'], naxis_comment,\n                         after='ZBITPIX')\n\n        # Strip the table header of all the ZNAZISn and ZTILEn keywords\n        # that may be left over from the previous data\n\n        for idx in itertools.count(1):\n            try:\n                del self._header['ZNAXIS' + str(idx)]\n                del self._header['ZTILE' + str(idx)]\n            except KeyError:\n                break\n\n        # Verify that any input tile size parameter is the appropriate\n        # size to match the HDU's data.\n\n        naxis = self._image_header['NAXIS']\n\n        if not tile_size:\n            tile_size = []\n        elif len(tile_size) != naxis:\n            warnings.warn('Provided tile size not appropriate for the data.  '\n                          'Default tile size will be used.', AstropyUserWarning)\n            tile_size = []\n\n        # Set default tile dimensions for HCOMPRESS_1\n\n        if compression_type == 'HCOMPRESS_1':\n            if (self._image_header['NAXIS1'] < 4 or\n                    self._image_header['NAXIS2'] < 4):\n                raise ValueError('Hcompress minimum image dimension is '\n                                 '4 pixels')\n            elif tile_size:\n                if tile_size[0] < 4 or tile_size[1] < 4:\n                    # user specified tile size is too small\n                    raise ValueError('Hcompress minimum tile dimension is '\n                                     '4 pixels')\n                major_dims = len([ts for ts in tile_size if ts > 1])\n                if major_dims > 2:\n                    raise ValueError(\n                        'HCOMPRESS can only support 2-dimensional tile sizes.'\n                        'All but two of the tile_size dimensions must be set '\n                        'to 1.')\n\n            if tile_size and (tile_size[0] == 0 and tile_size[1] == 0):\n                # compress the whole image as a single tile\n                tile_size[0] = self._image_header['NAXIS1']\n                tile_size[1] = self._image_header['NAXIS2']\n\n                for i in range(2, naxis):\n                    # set all higher tile dimensions = 1\n                    tile_size[i] = 1\n            elif not tile_size:\n                # The Hcompress algorithm is inherently 2D in nature, so the\n                # row by row tiling that is used for other compression\n                # algorithms is not appropriate.  If the image has less than 30\n                # rows, then the entire image will be compressed as a single\n                # tile.  Otherwise the tiles will consist of 16 rows of the\n                # image.  This keeps the tiles to a reasonable size, and it\n                # also includes enough rows to allow good compression\n                # efficiency.  It the last tile of the image happens to contain\n                # less than 4 rows, then find another tile size with between 14\n                # and 30 rows (preferably even), so that the last tile has at\n                # least 4 rows.\n\n                # 1st tile dimension is the row length of the image\n                tile_size.append(self._image_header['NAXIS1'])\n\n                if self._image_header['NAXIS2'] <= 30:\n                    tile_size.append(self._image_header['NAXIS1'])\n                else:\n                    # look for another good tile dimension\n                    naxis2 = self._image_header['NAXIS2']\n                    for dim in [16, 24, 20, 30, 28, 26, 22, 18, 14]:\n                        if naxis2 % dim == 0 or naxis2 % dim > 3:\n                            tile_size.append(dim)\n                            break\n                    else:\n                        tile_size.append(17)\n\n                for i in range(2, naxis):\n                    # set all higher tile dimensions = 1\n                    tile_size.append(1)\n\n            # check if requested tile size causes the last tile to have\n            # less than 4 pixels\n\n            remain = self._image_header['NAXIS1'] % tile_size[0]  # 1st dimen\n\n            if remain > 0 and remain < 4:\n                tile_size[0] += 1  # try increasing tile size by 1\n\n                remain = self._image_header['NAXIS1'] % tile_size[0]\n\n                if remain > 0 and remain < 4:\n                    raise ValueError('Last tile along 1st dimension has '\n                                     'less than 4 pixels')\n\n            remain = self._image_header['NAXIS2'] % tile_size[1]  # 2nd dimen\n\n            if remain > 0 and remain < 4:\n                tile_size[1] += 1  # try increasing tile size by 1\n\n                remain = self._image_header['NAXIS2'] % tile_size[1]\n\n                if remain > 0 and remain < 4:\n                    raise ValueError('Last tile along 2nd dimension has '\n                                     'less than 4 pixels')\n\n        # Set up locations for writing the next cards in the header.\n        last_znaxis = 'ZNAXIS'\n\n        if self._image_header['NAXIS'] > 0:\n            after1 = 'ZNAXIS1'\n        else:\n            after1 = 'ZNAXIS'\n\n        # Calculate the number of rows in the output table and\n        # write the ZNAXISn and ZTILEn cards to the table header.\n        nrows = 0\n\n        for idx, axis in enumerate(self._axes):\n            naxis = 'NAXIS' + str(idx + 1)\n            znaxis = 'ZNAXIS' + str(idx + 1)\n            ztile = 'ZTILE' + str(idx + 1)\n\n            if tile_size and len(tile_size) >= idx + 1:\n                ts = tile_size[idx]\n            else:\n                if ztile not in self._header:\n                    # Default tile size\n                    if not idx:\n                        ts = self._image_header['NAXIS1']\n                    else:\n                        ts = 1\n                else:\n                    ts = self._header[ztile]\n                tile_size.append(ts)\n\n            if not nrows:\n                nrows = (axis - 1) // ts + 1\n            else:\n                nrows *= ((axis - 1) // ts + 1)\n\n            if image_header and naxis in image_header:\n                self._header.set(znaxis, axis, image_header.comments[naxis],\n                                 after=last_znaxis)\n            else:\n                self._header.set(znaxis, axis,\n                                 'length of original image axis',\n                                 after=last_znaxis)\n\n            self._header.set(ztile, ts, 'size of tiles to be compressed',\n                             after=after1)\n            last_znaxis = znaxis\n            after1 = ztile\n\n        # Set the NAXIS2 header card in the table hdu to the number of\n        # rows in the table.\n        self._header.set('NAXIS2', nrows, 'number of rows in table')\n\n        self.columns = cols\n\n        # Set the compression parameters in the table header.\n\n        # First, setup the values to be used for the compression parameters\n        # in case none were passed in.  This will be either the value\n        # already in the table header for that parameter or the default\n        # value.\n        for idx in itertools.count(1):\n            zname = 'ZNAME' + str(idx)\n            if zname not in self._header:\n                break\n            zval = 'ZVAL' + str(idx)\n            if self._header[zname] == 'NOISEBIT':\n                if quantize_level is None:\n                    quantize_level = self._header[zval]\n            if self._header[zname] == 'SCALE   ':\n                if hcomp_scale is None:\n                    hcomp_scale = self._header[zval]\n            if self._header[zname] == 'SMOOTH  ':\n                if hcomp_smooth is None:\n                    hcomp_smooth = self._header[zval]\n\n        if quantize_level is None:\n            quantize_level = DEFAULT_QUANTIZE_LEVEL\n\n        if hcomp_scale is None:\n            hcomp_scale = DEFAULT_HCOMP_SCALE\n\n        if hcomp_smooth is None:\n            hcomp_smooth = DEFAULT_HCOMP_SCALE\n\n        # Next, strip the table header of all the ZNAMEn and ZVALn keywords\n        # that may be left over from the previous data\n        for idx in itertools.count(1):\n            zname = 'ZNAME' + str(idx)\n            if zname not in self._header:\n                break\n            zval = 'ZVAL' + str(idx)\n            del self._header[zname]\n            del self._header[zval]\n\n        # Finally, put the appropriate keywords back based on the\n        # compression type.\n\n        after_keyword = 'ZCMPTYPE'\n        idx = 1\n\n        if compression_type == 'RICE_1':\n            self._header.set('ZNAME1', 'BLOCKSIZE', 'compression block size',\n                             after=after_keyword)\n            self._header.set('ZVAL1', DEFAULT_BLOCK_SIZE, 'pixels per block',\n                             after='ZNAME1')\n\n            self._header.set('ZNAME2', 'BYTEPIX',\n                             'bytes per pixel (1, 2, 4, or 8)', after='ZVAL1')\n\n            if self._header['ZBITPIX'] == 8:\n                bytepix = 1\n            elif self._header['ZBITPIX'] == 16:\n                bytepix = 2\n            else:\n                bytepix = DEFAULT_BYTE_PIX\n\n            self._header.set('ZVAL2', bytepix,\n                             'bytes per pixel (1, 2, 4, or 8)',\n                             after='ZNAME2')\n            after_keyword = 'ZVAL2'\n            idx = 3\n        elif compression_type == 'HCOMPRESS_1':\n            self._header.set('ZNAME1', 'SCALE', 'HCOMPRESS scale factor',\n                             after=after_keyword)\n            self._header.set('ZVAL1', hcomp_scale, 'HCOMPRESS scale factor',\n                             after='ZNAME1')\n            self._header.set('ZNAME2', 'SMOOTH', 'HCOMPRESS smooth option',\n                             after='ZVAL1')\n            self._header.set('ZVAL2', hcomp_smooth, 'HCOMPRESS smooth option',\n                             after='ZNAME2')\n            after_keyword = 'ZVAL2'\n            idx = 3\n\n        if self._image_header['BITPIX'] < 0:   # floating point image\n            self._header.set('ZNAME' + str(idx), 'NOISEBIT',\n                             'floating point quantization level',\n                             after=after_keyword)\n            self._header.set('ZVAL' + str(idx), quantize_level,\n                             'floating point quantization level',\n                             after='ZNAME' + str(idx))\n\n            # Add the dither method and seed\n            if quantize_method:\n                if quantize_method not in [NO_DITHER, SUBTRACTIVE_DITHER_1,\n                                           SUBTRACTIVE_DITHER_2]:\n                    name = QUANTIZE_METHOD_NAMES[DEFAULT_QUANTIZE_METHOD]\n                    warnings.warn('Unknown quantization method provided.  '\n                                  'Default method ({}) used.'.format(name))\n                    quantize_method = DEFAULT_QUANTIZE_METHOD\n\n                if quantize_method == NO_DITHER:\n                    zquantiz_comment = 'No dithering during quantization'\n                else:\n                    zquantiz_comment = 'Pixel Quantization Algorithm'\n\n                self._header.set('ZQUANTIZ',\n                                 QUANTIZE_METHOD_NAMES[quantize_method],\n                                 zquantiz_comment,\n                                 after='ZVAL' + str(idx))\n            else:\n                # If the ZQUANTIZ keyword is missing the default is to assume\n                # no dithering, rather than whatever DEFAULT_QUANTIZE_METHOD\n                # is set to\n                quantize_method = self._header.get('ZQUANTIZ', NO_DITHER)\n\n                if isinstance(quantize_method, str):\n                    for k, v in QUANTIZE_METHOD_NAMES.items():\n                        if v.upper() == quantize_method:\n                            quantize_method = k\n                            break\n                    else:\n                        quantize_method = NO_DITHER\n\n            if quantize_method == NO_DITHER:\n                if 'ZDITHER0' in self._header:\n                    # If dithering isn't being used then there's no reason to\n                    # keep the ZDITHER0 keyword\n                    del self._header['ZDITHER0']\n            else:\n                if dither_seed:\n                    dither_seed = self._generate_dither_seed(dither_seed)\n                elif 'ZDITHER0' in self._header:\n                    dither_seed = self._header['ZDITHER0']\n                else:\n                    dither_seed = self._generate_dither_seed(\n                            DEFAULT_DITHER_SEED)\n\n                self._header.set('ZDITHER0', dither_seed,\n                                 'dithering offset when quantizing floats',\n                                 after='ZQUANTIZ')\n\n        if image_header:\n            # Move SIMPLE card from the image header to the\n            # table header as ZSIMPLE card.\n\n            if 'SIMPLE' in image_header:\n                self._header.set('ZSIMPLE', image_header['SIMPLE'],\n                                 image_header.comments['SIMPLE'],\n                                 before='ZBITPIX')\n\n            # Move EXTEND card from the image header to the\n            # table header as ZEXTEND card.\n\n            if 'EXTEND' in image_header:\n                self._header.set('ZEXTEND', image_header['EXTEND'],\n                                 image_header.comments['EXTEND'])\n\n            # Move BLOCKED card from the image header to the\n            # table header as ZBLOCKED card.\n\n            if 'BLOCKED' in image_header:\n                self._header.set('ZBLOCKED', image_header['BLOCKED'],\n                                 image_header.comments['BLOCKED'])\n\n            # Move XTENSION card from the image header to the\n            # table header as ZTENSION card.\n\n            # Since we only handle compressed IMAGEs, ZTENSION should\n            # always be IMAGE, even if the caller has passed in a header\n            # for some other type of extension.\n            if 'XTENSION' in image_header:\n                self._header.set('ZTENSION', 'IMAGE',\n                                 image_header.comments['XTENSION'],\n                                 before='ZBITPIX')\n\n            # Move PCOUNT and GCOUNT cards from image header to the table\n            # header as ZPCOUNT and ZGCOUNT cards.\n\n            if 'PCOUNT' in image_header:\n                self._header.set('ZPCOUNT', image_header['PCOUNT'],\n                                 image_header.comments['PCOUNT'],\n                                 after=last_znaxis)\n\n            if 'GCOUNT' in image_header:\n                self._header.set('ZGCOUNT', image_header['GCOUNT'],\n                                 image_header.comments['GCOUNT'],\n                                 after='ZPCOUNT')\n\n            # Move CHECKSUM and DATASUM cards from the image header to the\n            # table header as XHECKSUM and XDATASUM cards.\n\n            if 'CHECKSUM' in image_header:\n                self._header.set('ZHECKSUM', image_header['CHECKSUM'],\n                                 image_header.comments['CHECKSUM'])\n\n            if 'DATASUM' in image_header:\n                self._header.set('ZDATASUM', image_header['DATASUM'],\n                                 image_header.comments['DATASUM'])\n        else:\n            # Move XTENSION card from the image header to the\n            # table header as ZTENSION card.\n\n            # Since we only handle compressed IMAGEs, ZTENSION should\n            # always be IMAGE, even if the caller has passed in a header\n            # for some other type of extension.\n            if 'XTENSION' in self._image_header:\n                self._header.set('ZTENSION', 'IMAGE',\n                                 self._image_header.comments['XTENSION'],\n                                 before='ZBITPIX')\n\n            # Move PCOUNT and GCOUNT cards from image header to the table\n            # header as ZPCOUNT and ZGCOUNT cards.\n\n            if 'PCOUNT' in self._image_header:\n                self._header.set('ZPCOUNT', self._image_header['PCOUNT'],\n                                 self._image_header.comments['PCOUNT'],\n                                 after=last_znaxis)\n\n            if 'GCOUNT' in self._image_header:\n                self._header.set('ZGCOUNT', self._image_header['GCOUNT'],\n                                 self._image_header.comments['GCOUNT'],\n                                 after='ZPCOUNT')\n\n        # When we have an image checksum we need to ensure that the same\n        # number of blank cards exist in the table header as there were in\n        # the image header.  This allows those blank cards to be carried\n        # over to the image header when the hdu is uncompressed.\n\n        if 'ZHECKSUM' in self._header:\n            required_blanks = image_header._countblanks()\n            image_blanks = self._image_header._countblanks()\n            table_blanks = self._header._countblanks()\n\n            for _ in range(required_blanks - image_blanks):\n                self._image_header.append()\n                table_blanks += 1\n\n            for _ in range(required_blanks - table_blanks):\n                self._header.append()"},{"col":4,"comment":"null","endLoc":2327,"header":"def __init__(self, val, val2=None, format=None, scale=None, copy=False)","id":2255,"name":"__init__","nodeType":"Function","startLoc":2318,"text":"def __init__(self, val, val2=None, format=None, scale=None, copy=False):\n        if isinstance(val, TimeDelta):\n            if scale is not None:\n                self._set_scale(scale)\n        else:\n            format = format or self._get_format(val)\n            self._init_from_vals(val, val2, format, scale, copy)\n\n            if scale is not None:\n                self.SCALES = TIME_DELTA_TYPES[scale]"},{"col":4,"comment":"Remove default EXTNAME values if they are unnecessary.\n\n        Some data files (eg from CFHT) can have the default EXTNAME and\n        an explicit value.  This method removes the default if a more\n        specific header exists. It also removes any duplicate default\n        values.\n        ","endLoc":684,"header":"def _remove_unnecessary_default_extnames(self, header)","id":2256,"name":"_remove_unnecessary_default_extnames","nodeType":"Function","startLoc":664,"text":"def _remove_unnecessary_default_extnames(self, header):\n        \"\"\"Remove default EXTNAME values if they are unnecessary.\n\n        Some data files (eg from CFHT) can have the default EXTNAME and\n        an explicit value.  This method removes the default if a more\n        specific header exists. It also removes any duplicate default\n        values.\n        \"\"\"\n        if 'EXTNAME' in header:\n            indices = header._keyword_indices['EXTNAME']\n            # Only continue if there is more than one found\n            n_extname = len(indices)\n            if n_extname > 1:\n                extnames_to_remove = [index for index in indices\n                                      if header[index] == self._default_name]\n                if len(extnames_to_remove) == n_extname:\n                    # Keep the first (they are all the same)\n                    extnames_to_remove.pop(0)\n                # Remove them all in reverse order to keep the index unchanged.\n                for index in reversed(sorted(extnames_to_remove)):\n                    del header[index]"},{"col":4,"comment":"Return a list of lines for the formatted string representation of\n        the entire table.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default is taken from the\n        configuration item ``astropy.conf.max_lines``.  If a negative\n        value of ``max_lines`` is supplied then there is no line limit\n        applied.\n\n        The same applies for ``max_width`` except the configuration item  is\n        ``astropy.conf.max_width``.\n\n        ","endLoc":1837,"header":"@format_doc(_pformat_docs, id=\"{id}\")\n    def pformat_all(self, max_lines=-1, max_width=-1, show_name=True,\n                    show_unit=None, show_dtype=False, html=False, tableid=None,\n                    align=None, tableclass=None)","id":2257,"name":"pformat_all","nodeType":"Function","startLoc":1816,"text":"@format_doc(_pformat_docs, id=\"{id}\")\n    def pformat_all(self, max_lines=-1, max_width=-1, show_name=True,\n                    show_unit=None, show_dtype=False, html=False, tableid=None,\n                    align=None, tableclass=None):\n        \"\"\"Return a list of lines for the formatted string representation of\n        the entire table.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default is taken from the\n        configuration item ``astropy.conf.max_lines``.  If a negative\n        value of ``max_lines`` is supplied then there is no line limit\n        applied.\n\n        The same applies for ``max_width`` except the configuration item  is\n        ``astropy.conf.max_width``.\n\n        \"\"\"\n\n        return self.pformat(max_lines, max_width, show_name,\n                            show_unit, show_dtype, html, tableid,\n                            align, tableclass)"},{"col":4,"comment":"\n        This is the key routine that actually does time scale conversions.\n        This is not public and not connected to the read-only scale property.\n        ","endLoc":2375,"header":"def _set_scale(self, scale)","id":2258,"name":"_set_scale","nodeType":"Function","startLoc":2352,"text":"def _set_scale(self, scale):\n        \"\"\"\n        This is the key routine that actually does time scale conversions.\n        This is not public and not connected to the read-only scale property.\n        \"\"\"\n\n        if scale == self.scale:\n            return\n        if scale not in self.SCALES:\n            raise ValueError(\"Scale {!r} is not in the allowed scales {}\"\n                             .format(scale, sorted(self.SCALES)))\n\n        # For TimeDelta, there can only be a change in scale factor,\n        # which is written as time2 - time1 = scale_offset * time1\n        scale_offset = SCALE_OFFSETS[(self.scale, scale)]\n        if scale_offset is None:\n            self._time.scale = scale\n        else:\n            jd1, jd2 = self._time.jd1, self._time.jd2\n            offset1, offset2 = day_frac(jd1, jd2, factor=scale_offset)\n            self._time = self.FORMATS[self.format](\n                jd1 + offset1, jd2 + offset2, scale,\n                self.precision, self.in_subfmt,\n                self.out_subfmt, from_jd=True)"},{"col":4,"comment":"Interactively browse table with a paging interface.\n\n        Supported keys::\n\n          f, <space> : forward one page\n          b : back one page\n          r : refresh same page\n          n : next row\n          p : previous row\n          < : go to beginning\n          > : go to end\n          q : quit browsing\n          h : print this help\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum number of lines in table output\n\n        max_width : int or None\n            Maximum character width of output\n\n        show_name : bool\n            Include a header row for column names. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        show_dtype : bool\n            Include a header row for column dtypes. Default is True.\n        ","endLoc":1875,"header":"def more(self, max_lines=None, max_width=None, show_name=True,\n             show_unit=None, show_dtype=False)","id":2259,"name":"more","nodeType":"Function","startLoc":1839,"text":"def more(self, max_lines=None, max_width=None, show_name=True,\n             show_unit=None, show_dtype=False):\n        \"\"\"Interactively browse table with a paging interface.\n\n        Supported keys::\n\n          f, <space> : forward one page\n          b : back one page\n          r : refresh same page\n          n : next row\n          p : previous row\n          < : go to beginning\n          > : go to end\n          q : quit browsing\n          h : print this help\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum number of lines in table output\n\n        max_width : int or None\n            Maximum character width of output\n\n        show_name : bool\n            Include a header row for column names. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        show_dtype : bool\n            Include a header row for column dtypes. Default is True.\n        \"\"\"\n        self.formatter._more_tabcol(self, max_lines, max_width, show_name=show_name,\n                                    show_unit=show_unit, show_dtype=show_dtype)"},{"col":4,"comment":"null","endLoc":1905,"header":"def __getitem__(self, item)","id":2260,"name":"__getitem__","nodeType":"Function","startLoc":1877,"text":"def __getitem__(self, item):\n        if isinstance(item, str):\n            return self.columns[item]\n        elif isinstance(item, (int, np.integer)):\n            return self.Row(self, item)\n        elif (isinstance(item, np.ndarray) and item.shape == () and item.dtype.kind == 'i'):\n            return self.Row(self, item.item())\n        elif self._is_list_or_tuple_of_str(item):\n            out = self.__class__([self[x] for x in item],\n                                 copy_indices=self._copy_indices)\n            out._groups = groups.TableGroups(out, indices=self.groups._indices,\n                                             keys=self.groups._keys)\n            out.meta = self.meta.copy()  # Shallow copy for meta\n            return out\n        elif ((isinstance(item, np.ndarray) and item.size == 0)\n              or (isinstance(item, (tuple, list)) and not item)):\n            # If item is an empty array/list/tuple then return the table with no rows\n            return self._new_from_slice([])\n        elif (isinstance(item, slice)\n              or isinstance(item, np.ndarray)\n              or isinstance(item, list)\n              or isinstance(item, tuple) and all(isinstance(x, np.ndarray)\n                                                 for x in item)):\n            # here for the many ways to give a slice; a tuple of ndarray\n            # is produced by np.where, as in t[np.where(t['a'] > 2)]\n            # For all, a new table is constructed with slice of all columns\n            return self._new_from_slice(item)\n        else:\n            raise ValueError(f'Illegal type {type(item)} for table item access')"},{"col":0,"comment":"Return the sum of ``val1`` and ``val2`` as two float64s.\n\n    The returned floats are an integer part and the fractional remainder,\n    with the latter guaranteed to be within -0.5 and 0.5 (inclusive on\n    either side, as the integer is rounded to even).\n\n    The arithmetic is all done with exact floating point operations so no\n    precision is lost to rounding error.  It is assumed the sum is less\n    than about 1e16, otherwise the remainder will be greater than 1.0.\n\n    Parameters\n    ----------\n    val1, val2 : array of float\n        Values to be summed.\n    factor : float, optional\n        If given, multiply the sum by it.\n    divisor : float, optional\n        If given, divide the sum by it.\n\n    Returns\n    -------\n    day, frac : float64\n        Integer and fractional part of val1 + val2.\n    ","endLoc":72,"header":"def day_frac(val1, val2, factor=None, divisor=None)","id":2261,"name":"day_frac","nodeType":"Function","startLoc":18,"text":"def day_frac(val1, val2, factor=None, divisor=None):\n    \"\"\"Return the sum of ``val1`` and ``val2`` as two float64s.\n\n    The returned floats are an integer part and the fractional remainder,\n    with the latter guaranteed to be within -0.5 and 0.5 (inclusive on\n    either side, as the integer is rounded to even).\n\n    The arithmetic is all done with exact floating point operations so no\n    precision is lost to rounding error.  It is assumed the sum is less\n    than about 1e16, otherwise the remainder will be greater than 1.0.\n\n    Parameters\n    ----------\n    val1, val2 : array of float\n        Values to be summed.\n    factor : float, optional\n        If given, multiply the sum by it.\n    divisor : float, optional\n        If given, divide the sum by it.\n\n    Returns\n    -------\n    day, frac : float64\n        Integer and fractional part of val1 + val2.\n    \"\"\"\n    # Add val1 and val2 exactly, returning the result as two float64s.\n    # The first is the approximate sum (with some floating point error)\n    # and the second is the error of the float64 sum.\n    sum12, err12 = two_sum(val1, val2)\n\n    if factor is not None:\n        sum12, carry = two_product(sum12, factor)\n        carry += err12 * factor\n        sum12, err12 = two_sum(sum12, carry)\n\n    if divisor is not None:\n        q1 = sum12 / divisor\n        p1, p2 = two_product(q1, divisor)\n        d1, d2 = two_sum(sum12, -p1)\n        d2 += err12\n        d2 -= p2\n        q2 = (d1 + d2) / divisor  # 3-part float fine here; nothing can be lost\n        sum12, err12 = two_sum(q1, q2)\n\n    # get integer fraction\n    day = np.round(sum12)\n    extra, frac = two_sum(sum12, -day)\n    frac += extra + err12\n    # Our fraction can now have gotten >0.5 or <-0.5, which means we would\n    # loose one bit of precision. So, correct for that.\n    excess = np.round(frac)\n    day += excess\n    extra, frac = two_sum(sum12, -day)\n    frac += extra + err12\n    return day, frac"},{"col":4,"comment":"null","endLoc":114,"header":"def __init__(self, table_header, image_header)","id":2262,"name":"__init__","nodeType":"Function","startLoc":109,"text":"def __init__(self, table_header, image_header):\n        self._cards = image_header._cards\n        self._keyword_indices = image_header._keyword_indices\n        self._rvkc_indices = image_header._rvkc_indices\n        self._modified = image_header._modified\n        self._table_header = table_header"},{"col":0,"comment":"\n    Add ``a`` and ``b`` exactly, returning the result as two float64s.\n    The first is the approximate sum (with some floating point error)\n    and the second is the error of the float64 sum.\n\n    Using the procedure of Shewchuk, 1997,\n    Discrete & Computational Geometry 18(3):305-363\n    http://www.cs.berkeley.edu/~jrs/papers/robustr.pdf\n\n    Returns\n    -------\n    sum, err : float64\n        Approximate sum of a + b and the exact floating point error\n    ","endLoc":138,"header":"def two_sum(a, b)","id":2263,"name":"two_sum","nodeType":"Function","startLoc":118,"text":"def two_sum(a, b):\n    \"\"\"\n    Add ``a`` and ``b`` exactly, returning the result as two float64s.\n    The first is the approximate sum (with some floating point error)\n    and the second is the error of the float64 sum.\n\n    Using the procedure of Shewchuk, 1997,\n    Discrete & Computational Geometry 18(3):305-363\n    http://www.cs.berkeley.edu/~jrs/papers/robustr.pdf\n\n    Returns\n    -------\n    sum, err : float64\n        Approximate sum of a + b and the exact floating point error\n    \"\"\"\n    x = a + b\n    eb = x - a  # bvirtual in Shewchuk\n    ea = x - eb  # avirtual in Shewchuk\n    eb = b - eb  # broundoff in Shewchuk\n    ea = a - ea  # aroundoff in Shewchuk\n    return x, ea + eb"},{"col":0,"comment":"\n    Multiple ``a`` and ``b`` exactly, returning the result as two float64s.\n    The first is the approximate product (with some floating point error)\n    and the second is the error of the float64 product.\n\n    Uses the procedure of Shewchuk, 1997,\n    Discrete & Computational Geometry 18(3):305-363\n    http://www.cs.berkeley.edu/~jrs/papers/robustr.pdf\n\n    Returns\n    -------\n    prod, err : float64\n        Approximate product a * b and the exact floating point error\n    ","endLoc":167,"header":"def two_product(a, b)","id":2264,"name":"two_product","nodeType":"Function","startLoc":141,"text":"def two_product(a, b):\n    \"\"\"\n    Multiple ``a`` and ``b`` exactly, returning the result as two float64s.\n    The first is the approximate product (with some floating point error)\n    and the second is the error of the float64 product.\n\n    Uses the procedure of Shewchuk, 1997,\n    Discrete & Computational Geometry 18(3):305-363\n    http://www.cs.berkeley.edu/~jrs/papers/robustr.pdf\n\n    Returns\n    -------\n    prod, err : float64\n        Approximate product a * b and the exact floating point error\n    \"\"\"\n    x = a * b\n    ah, al = split(a)\n    bh, bl = split(b)\n    y1 = ah * bh\n    y = x - y1\n    y2 = al * bh\n    y -= y2\n    y3 = ah * bl\n    y -= y3\n    y4 = al * bl\n    y = y4 - y\n    return x, y"},{"col":4,"comment":"Check that ``names`` is a tuple or list of strings","endLoc":2026,"header":"@staticmethod\n    def _is_list_or_tuple_of_str(names)","id":2265,"name":"_is_list_or_tuple_of_str","nodeType":"Function","startLoc":2022,"text":"@staticmethod\n    def _is_list_or_tuple_of_str(names):\n        \"\"\"Check that ``names`` is a tuple or list of strings\"\"\"\n        return (isinstance(names, (tuple, list)) and names\n                and all(isinstance(x, str) for x in names))"},{"col":0,"comment":"\n    Split float64 in two aligned parts.\n\n    Uses the procedure of Shewchuk, 1997,\n    Discrete & Computational Geometry 18(3):305-363\n    http://www.cs.berkeley.edu/~jrs/papers/robustr.pdf\n\n    ","endLoc":183,"header":"def split(a)","id":2266,"name":"split","nodeType":"Function","startLoc":170,"text":"def split(a):\n    \"\"\"\n    Split float64 in two aligned parts.\n\n    Uses the procedure of Shewchuk, 1997,\n    Discrete & Computational Geometry 18(3):305-363\n    http://www.cs.berkeley.edu/~jrs/papers/robustr.pdf\n\n    \"\"\"\n    c = 134217729. * a  # 2**27+1.\n    abig = c - a\n    ah = c - abig\n    al = a - ah\n    return ah, al"},{"col":4,"comment":"null","endLoc":2338,"header":"@staticmethod\n    def _get_format(val)","id":2267,"name":"_get_format","nodeType":"Function","startLoc":2329,"text":"@staticmethod\n    def _get_format(val):\n        if isinstance(val, timedelta):\n            return 'datetime'\n\n        if getattr(val, 'unit', None) is None:\n            warn('Numerical value without unit or explicit format passed to'\n                 ' TimeDelta, assuming days', TimeDeltaMissingUnitWarning)\n\n        return 'jd'"},{"col":4,"comment":"null","endLoc":1957,"header":"def __setitem__(self, item, value)","id":2268,"name":"__setitem__","nodeType":"Function","startLoc":1907,"text":"def __setitem__(self, item, value):\n        # If the item is a string then it must be the name of a column.\n        # If that column doesn't already exist then create it now.\n        if isinstance(item, str) and item not in self.colnames:\n            self.add_column(value, name=item, copy=True)\n\n        else:\n            n_cols = len(self.columns)\n\n            if isinstance(item, str):\n                # Set an existing column by first trying to replace, and if\n                # this fails do an in-place update.  See definition of mask\n                # property for discussion of the _setitem_inplace attribute.\n                if (not getattr(self, '_setitem_inplace', False)\n                        and not conf.replace_inplace):\n                    try:\n                        self._replace_column_warnings(item, value)\n                        return\n                    except Exception:\n                        pass\n                self.columns[item][:] = value\n\n            elif isinstance(item, (int, np.integer)):\n                self._set_row(idx=item, colnames=self.colnames, vals=value)\n\n            elif (isinstance(item, slice)\n                  or isinstance(item, np.ndarray)\n                  or isinstance(item, list)\n                  or (isinstance(item, tuple)  # output from np.where\n                      and all(isinstance(x, np.ndarray) for x in item))):\n\n                if isinstance(value, Table):\n                    vals = (col for col in value.columns.values())\n\n                elif isinstance(value, np.ndarray) and value.dtype.names:\n                    vals = (value[name] for name in value.dtype.names)\n\n                elif np.isscalar(value):\n                    vals = itertools.repeat(value, n_cols)\n\n                else:  # Assume this is an iterable that will work\n                    if len(value) != n_cols:\n                        raise ValueError('Right side value needs {} elements (one for each column)'\n                                         .format(n_cols))\n                    vals = value\n\n                for col, val in zip(self.columns.values(), vals):\n                    col[item] = val\n\n            else:\n                raise ValueError(f'Illegal type {type(item)} for table item access')"},{"col":4,"comment":"\n        Set the internal _format, scale, and _time attrs from user\n        inputs.  This handles coercion into the correct shapes and\n        some basic input validation.\n        ","endLoc":401,"header":"def _init_from_vals(self, val, val2, format, scale, copy,\n                        precision=None, in_subfmt=None, out_subfmt=None)","id":2269,"name":"_init_from_vals","nodeType":"Function","startLoc":346,"text":"def _init_from_vals(self, val, val2, format, scale, copy,\n                        precision=None, in_subfmt=None, out_subfmt=None):\n        \"\"\"\n        Set the internal _format, scale, and _time attrs from user\n        inputs.  This handles coercion into the correct shapes and\n        some basic input validation.\n        \"\"\"\n        if precision is None:\n            precision = 3\n        if in_subfmt is None:\n            in_subfmt = '*'\n        if out_subfmt is None:\n            out_subfmt = '*'\n\n        # Coerce val into an array\n        val = _make_array(val, copy)\n\n        # If val2 is not None, ensure consistency\n        if val2 is not None:\n            val2 = _make_array(val2, copy)\n            try:\n                np.broadcast(val, val2)\n            except ValueError:\n                raise ValueError('Input val and val2 have inconsistent shape; '\n                                 'they cannot be broadcast together.')\n\n        if scale is not None:\n            if not (isinstance(scale, str)\n                    and scale.lower() in self.SCALES):\n                raise ScaleValueError(\"Scale {!r} is not in the allowed scales \"\n                                      \"{}\".format(scale,\n                                                  sorted(self.SCALES)))\n\n        # If either of the input val, val2 are masked arrays then\n        # find the masked elements and fill them.\n        mask, val, val2 = _check_for_masked_and_fill(val, val2)\n\n        # Parse / convert input values into internal jd1, jd2 based on format\n        self._time = self._get_time_fmt(val, val2, format, scale,\n                                        precision, in_subfmt, out_subfmt)\n        self._format = self._time.name\n\n        # Hack from #9969 to allow passing the location value that has been\n        # collected by the TimeAstropyTime format class up to the Time level.\n        # TODO: find a nicer way.\n        if hasattr(self._time, '_location'):\n            self.location = self._time._location\n            del self._time._location\n\n        # If any inputs were masked then masked jd2 accordingly.  From above\n        # routine ``mask`` must be either Python bool False or an bool ndarray\n        # with shape broadcastable to jd2.\n        if mask is not False:\n            mask = np.broadcast_to(mask, self._time.jd2.shape)\n            self._time.jd1[mask] = 2451544.5  # Set to JD for 2000-01-01\n            self._time.jd2[mask] = np.nan"},{"col":0,"comment":"\n    Take ``val`` and convert/reshape to an array.  If ``copy`` is `True`\n    then copy input values.\n\n    Returns\n    -------\n    val : ndarray\n        Array version of ``val``.\n    ","endLoc":2707,"header":"def _make_array(val, copy=False)","id":2270,"name":"_make_array","nodeType":"Function","startLoc":2680,"text":"def _make_array(val, copy=False):\n    \"\"\"\n    Take ``val`` and convert/reshape to an array.  If ``copy`` is `True`\n    then copy input values.\n\n    Returns\n    -------\n    val : ndarray\n        Array version of ``val``.\n    \"\"\"\n    if isinstance(val, (tuple, list)) and len(val) > 0 and isinstance(val[0], Time):\n        dtype = object\n    else:\n        dtype = None\n\n    val = np.array(val, copy=copy, subok=True, dtype=dtype)\n\n    # Allow only float64, string or object arrays as input\n    # (object is for datetime, maybe add more specific test later?)\n    # This also ensures the right byteorder for float64 (closes #2942).\n    if val.dtype.kind == \"f\" and val.dtype.itemsize >= np.dtype(np.float64).itemsize:\n        pass\n    elif val.dtype.kind in 'OSUMaV':\n        pass\n    else:\n        val = np.asanyarray(val, dtype=np.float64)\n\n    return val"},{"col":4,"comment":"\n        Add a new column to the table using ``col`` as input.  If ``index``\n        is supplied then insert column before ``index`` position\n        in the list of columns, otherwise append column to the end\n        of the list.\n\n        The ``col`` input can be any data object which is acceptable as a\n        `~astropy.table.Table` column object or can be converted.  This includes\n        mixin columns and scalar or length=1 objects which get broadcast to match\n        the table length.\n\n        To add several columns at once use ``add_columns()`` or simply call\n        ``add_column()`` for each one.  There is very little performance difference\n        in the two approaches.\n\n        Parameters\n        ----------\n        col : object\n            Data object for the new column\n        index : int or None\n            Insert column before this position or at end (default).\n        name : str\n            Column name\n        rename_duplicate : bool\n            Uniquify column name if it already exist. Default is False.\n        copy : bool\n            Make a copy of the new column. Default is True.\n        default_name : str or None\n            Name to use if both ``name`` and ``col.info.name`` are not available.\n            Defaults to ``col{number_of_columns}``.\n\n        Examples\n        --------\n        Create a table with two columns 'a' and 'b', then create a third column 'c'\n        and append it to the end of the table::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> col_c = Column(name='c', data=['x', 'y'])\n            >>> t.add_column(col_c)\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n\n        Add column 'd' at position 1. Note that the column is inserted\n        before the given index::\n\n            >>> t.add_column(['a', 'b'], name='d', index=1)\n            >>> print(t)\n             a   d   b   c\n            --- --- --- ---\n              1   a 0.1   x\n              2   b 0.2   y\n\n        Add second column named 'b' with rename_duplicate::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> t.add_column(1.1, name='b', rename_duplicate=True)\n            >>> print(t)\n             a   b  b_1\n            --- --- ---\n              1 0.1 1.1\n              2 0.2 1.1\n\n        Add an unnamed column or mixin object in the table using a default name\n        or by specifying an explicit name with ``name``. Name can also be overridden::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> t.add_column(['a', 'b'])\n            >>> t.add_column(col_c, name='d')\n            >>> print(t)\n             a   b  col2  d\n            --- --- ---- ---\n              1 0.1    a   x\n              2 0.2    b   y\n        ","endLoc":2221,"header":"def add_column(self, col, index=None, name=None, rename_duplicate=False, copy=True,\n                   default_name=None)","id":2271,"name":"add_column","nodeType":"Function","startLoc":2089,"text":"def add_column(self, col, index=None, name=None, rename_duplicate=False, copy=True,\n                   default_name=None):\n        \"\"\"\n        Add a new column to the table using ``col`` as input.  If ``index``\n        is supplied then insert column before ``index`` position\n        in the list of columns, otherwise append column to the end\n        of the list.\n\n        The ``col`` input can be any data object which is acceptable as a\n        `~astropy.table.Table` column object or can be converted.  This includes\n        mixin columns and scalar or length=1 objects which get broadcast to match\n        the table length.\n\n        To add several columns at once use ``add_columns()`` or simply call\n        ``add_column()`` for each one.  There is very little performance difference\n        in the two approaches.\n\n        Parameters\n        ----------\n        col : object\n            Data object for the new column\n        index : int or None\n            Insert column before this position or at end (default).\n        name : str\n            Column name\n        rename_duplicate : bool\n            Uniquify column name if it already exist. Default is False.\n        copy : bool\n            Make a copy of the new column. Default is True.\n        default_name : str or None\n            Name to use if both ``name`` and ``col.info.name`` are not available.\n            Defaults to ``col{number_of_columns}``.\n\n        Examples\n        --------\n        Create a table with two columns 'a' and 'b', then create a third column 'c'\n        and append it to the end of the table::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> col_c = Column(name='c', data=['x', 'y'])\n            >>> t.add_column(col_c)\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n\n        Add column 'd' at position 1. Note that the column is inserted\n        before the given index::\n\n            >>> t.add_column(['a', 'b'], name='d', index=1)\n            >>> print(t)\n             a   d   b   c\n            --- --- --- ---\n              1   a 0.1   x\n              2   b 0.2   y\n\n        Add second column named 'b' with rename_duplicate::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> t.add_column(1.1, name='b', rename_duplicate=True)\n            >>> print(t)\n             a   b  b_1\n            --- --- ---\n              1 0.1 1.1\n              2 0.2 1.1\n\n        Add an unnamed column or mixin object in the table using a default name\n        or by specifying an explicit name with ``name``. Name can also be overridden::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> t.add_column(['a', 'b'])\n            >>> t.add_column(col_c, name='d')\n            >>> print(t)\n             a   b  col2  d\n            --- --- ---- ---\n              1 0.1    a   x\n              2 0.2    b   y\n        \"\"\"\n        if default_name is None:\n            default_name = f'col{len(self.columns)}'\n\n        # Convert col data to acceptable object for insertion into self.columns.\n        # Note that along with the lines above and below, this allows broadcasting\n        # of scalars to the correct shape for adding to table.\n        col = self._convert_data_to_col(col, name=name, copy=copy,\n                                        default_name=default_name)\n\n        # Assigning a scalar column to an empty table should result in an\n        # exception (see #3811).\n        if col.shape == () and len(self) == 0:\n            raise TypeError('Empty table cannot have column set to scalar value')\n        # Make col data shape correct for scalars.  The second test is to allow\n        # broadcasting an N-d element to a column, e.g. t['new'] = [[1, 2]].\n        elif (col.shape == () or col.shape[0] == 1) and len(self) > 0:\n            new_shape = (len(self),) + getattr(col, 'shape', ())[1:]\n            if isinstance(col, np.ndarray):\n                col = np.broadcast_to(col, shape=new_shape,\n                                      subok=True)\n            elif isinstance(col, ShapedLikeNDArray):\n                col = col._apply(np.broadcast_to, shape=new_shape,\n                                 subok=True)\n\n            # broadcast_to() results in a read-only array.  Apparently it only changes\n            # the view to look like the broadcasted array.  So copy.\n            col = col_copy(col)\n\n        name = col.info.name\n\n        # Ensure that new column is the right length\n        if len(self.columns) > 0 and len(col) != len(self):\n            raise ValueError('Inconsistent data column lengths')\n\n        if rename_duplicate:\n            orig_name = name\n            i = 1\n            while name in self.columns:\n                # Iterate until a unique name is found\n                name = orig_name + '_' + str(i)\n                i += 1\n            col.info.name = name\n\n        # Set col parent_table weakref and ensure col has mask attribute if table.masked\n        self._set_col_parent_table_and_mask(col)\n\n        # Add new column as last column\n        self.columns[name] = col\n\n        if index is not None:\n            # Move the other cols to the right of the new one\n            move_names = self.colnames[index:-1]\n            for move_name in move_names:\n                self.columns.move_to_end(move_name, last=True)"},{"col":4,"comment":"\n        Same as replace_column but issues warnings under various circumstances.\n        ","endLoc":2381,"header":"def _replace_column_warnings(self, name, col)","id":2272,"name":"_replace_column_warnings","nodeType":"Function","startLoc":2326,"text":"def _replace_column_warnings(self, name, col):\n        \"\"\"\n        Same as replace_column but issues warnings under various circumstances.\n        \"\"\"\n        warns = conf.replace_warnings\n        refcount = None\n        old_col = None\n\n        if 'refcount' in warns and name in self.colnames:\n            refcount = sys.getrefcount(self[name])\n\n        if name in self.colnames:\n            old_col = self[name]\n\n        # This may raise an exception (e.g. t['a'] = 1) in which case none of\n        # the downstream code runs.\n        self.replace_column(name, col)\n\n        if 'always' in warns:\n            warnings.warn(f\"replaced column '{name}'\",\n                          TableReplaceWarning, stacklevel=3)\n\n        if 'slice' in warns:\n            try:\n                # Check for ndarray-subclass slice.  An unsliced instance\n                # has an ndarray for the base while sliced has the same class\n                # as parent.\n                if isinstance(old_col.base, old_col.__class__):\n                    msg = (\"replaced column '{}' which looks like an array slice. \"\n                           \"The new column no longer shares memory with the \"\n                           \"original array.\".format(name))\n                    warnings.warn(msg, TableReplaceWarning, stacklevel=3)\n            except AttributeError:\n                pass\n\n        if 'refcount' in warns:\n            # Did reference count change?\n            new_refcount = sys.getrefcount(self[name])\n            if refcount != new_refcount:\n                msg = (\"replaced column '{}' and the number of references \"\n                       \"to the column changed.\".format(name))\n                warnings.warn(msg, TableReplaceWarning, stacklevel=3)\n\n        if 'attributes' in warns:\n            # Any of the standard column attributes changed?\n            changed_attrs = []\n            new_col = self[name]\n            # Check base DataInfo attributes that any column will have\n            for attr in DataInfo.attr_names:\n                if getattr(old_col.info, attr) != getattr(new_col.info, attr):\n                    changed_attrs.append(attr)\n\n            if changed_attrs:\n                msg = (\"replaced column '{}' and column attributes {} changed.\"\n                       .format(name, changed_attrs))\n                warnings.warn(msg, TableReplaceWarning, stacklevel=3)"},{"col":0,"comment":"null","endLoc":35,"header":"def is_column_keyword(keyword)","id":2273,"name":"is_column_keyword","nodeType":"Function","startLoc":34,"text":"def is_column_keyword(keyword):\n    return re.match(COLUMN_KEYWORD_REGEXP, keyword) is not None"},{"col":4,"comment":"\n        Replace column ``name`` with the new ``col`` object.\n\n        The behavior of ``copy`` for Column objects is:\n        - copy=True: new class instance with a copy of data and deep copy of meta\n        - copy=False: new class instance with same data and a key-only copy of meta\n\n        For mixin columns:\n        - copy=True: new class instance with copy of data and deep copy of meta\n        - copy=False: original instance (no copy at all)\n\n        Parameters\n        ----------\n        name : str\n            Name of column to replace\n        col : `~astropy.table.Column` or `~numpy.ndarray` or sequence\n            New column object to replace the existing column.\n        copy : bool\n            Make copy of the input ``col``, default=True\n\n        See Also\n        --------\n        add_columns, astropy.table.hstack, update\n\n        Examples\n        --------\n        Replace column 'a' with a float version of itself::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> float_a = t['a'].astype(float)\n            >>> t.replace_column('a', float_a)\n        ","endLoc":2430,"header":"def replace_column(self, name, col, copy=True)","id":2274,"name":"replace_column","nodeType":"Function","startLoc":2383,"text":"def replace_column(self, name, col, copy=True):\n        \"\"\"\n        Replace column ``name`` with the new ``col`` object.\n\n        The behavior of ``copy`` for Column objects is:\n        - copy=True: new class instance with a copy of data and deep copy of meta\n        - copy=False: new class instance with same data and a key-only copy of meta\n\n        For mixin columns:\n        - copy=True: new class instance with copy of data and deep copy of meta\n        - copy=False: original instance (no copy at all)\n\n        Parameters\n        ----------\n        name : str\n            Name of column to replace\n        col : `~astropy.table.Column` or `~numpy.ndarray` or sequence\n            New column object to replace the existing column.\n        copy : bool\n            Make copy of the input ``col``, default=True\n\n        See Also\n        --------\n        add_columns, astropy.table.hstack, update\n\n        Examples\n        --------\n        Replace column 'a' with a float version of itself::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> float_a = t['a'].astype(float)\n            >>> t.replace_column('a', float_a)\n        \"\"\"\n        if name not in self.colnames:\n            raise ValueError(f'column name {name} is not in the table')\n\n        if self[name].info.indices:\n            raise ValueError('cannot replace a table index column')\n\n        col = self._convert_data_to_col(col, name=name, copy=copy)\n        self._set_col_parent_table_and_mask(col)\n\n        # Ensure that new column is the right length, unless it is the only column\n        # in which case re-sizing is allowed.\n        if len(self.columns) > 1 and len(col) != len(self[name]):\n            raise ValueError('length of new column must match table length')\n\n        self.columns.__setitem__(name, col, validated=True)"},{"col":0,"comment":"\n    If ``val`` or ``val2`` are masked arrays then fill them and cast\n    to ndarray.\n\n    Returns a mask corresponding to the logical-or of masked elements\n    in ``val`` and ``val2``.  If neither is masked then the return ``mask``\n    is ``None``.\n\n    If either ``val`` or ``val2`` are masked then they are replaced\n    with filled versions of themselves.\n\n    Parameters\n    ----------\n    val : ndarray or MaskedArray\n        Input val\n    val2 : ndarray or MaskedArray\n        Input val2\n\n    Returns\n    -------\n    mask, val, val2: ndarray or None\n        Mask: (None or bool ndarray), val, val2: ndarray\n    ","endLoc":2768,"header":"def _check_for_masked_and_fill(val, val2)","id":2275,"name":"_check_for_masked_and_fill","nodeType":"Function","startLoc":2710,"text":"def _check_for_masked_and_fill(val, val2):\n    \"\"\"\n    If ``val`` or ``val2`` are masked arrays then fill them and cast\n    to ndarray.\n\n    Returns a mask corresponding to the logical-or of masked elements\n    in ``val`` and ``val2``.  If neither is masked then the return ``mask``\n    is ``None``.\n\n    If either ``val`` or ``val2`` are masked then they are replaced\n    with filled versions of themselves.\n\n    Parameters\n    ----------\n    val : ndarray or MaskedArray\n        Input val\n    val2 : ndarray or MaskedArray\n        Input val2\n\n    Returns\n    -------\n    mask, val, val2: ndarray or None\n        Mask: (None or bool ndarray), val, val2: ndarray\n    \"\"\"\n    def get_as_filled_ndarray(mask, val):\n        \"\"\"\n        Fill the given MaskedArray ``val`` from the first non-masked\n        element in the array.  This ensures that upstream Time initialization\n        will succeed.\n\n        Note that nothing happens if there are no masked elements.\n        \"\"\"\n        fill_value = None\n\n        if np.any(val.mask):\n            # Final mask is the logical-or of inputs\n            mask = mask | val.mask\n\n            # First unmasked element.  If all elements are masked then\n            # use fill_value=None from above which will use val.fill_value.\n            # As long as the user has set this appropriately then all will\n            # be fine.\n            val_unmasked = val.compressed()  # 1-d ndarray of unmasked values\n            if len(val_unmasked) > 0:\n                fill_value = val_unmasked[0]\n\n        # Fill the input ``val``.  If fill_value is None then this just returns\n        # an ndarray view of val (no copy).\n        val = val.filled(fill_value)\n\n        return mask, val\n\n    mask = False\n    if isinstance(val, np.ma.MaskedArray):\n        mask, val = get_as_filled_ndarray(mask, val)\n    if isinstance(val2, np.ma.MaskedArray):\n        mask, val2 = get_as_filled_ndarray(mask, val2)\n\n    return mask, val, val2"},{"col":4,"comment":"null","endLoc":2897,"header":"def _set_row(self, idx, colnames, vals)","id":2276,"name":"_set_row","nodeType":"Function","startLoc":2878,"text":"def _set_row(self, idx, colnames, vals):\n        try:\n            assert len(vals) == len(colnames)\n        except Exception:\n            raise ValueError('right hand side must be a sequence of values with '\n                             'the same length as the number of selected columns')\n\n        # Keep track of original values before setting each column so that\n        # setting row can be transactional.\n        orig_vals = []\n        cols = self.columns\n        try:\n            for name, val in zip(colnames, vals):\n                orig_vals.append(cols[name][idx])\n                cols[name][idx] = val\n        except Exception:\n            # If anything went wrong first revert the row update then raise\n            for name, val in zip(colnames, orig_vals[:-1]):\n                cols[name][idx] = val\n            raise"},{"col":4,"comment":"null","endLoc":872,"header":"@classmethod\n    def match_header(cls, header)","id":2278,"name":"match_header","nodeType":"Function","startLoc":865,"text":"@classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n        return (card.keyword == 'XTENSION' and\n                xtension in (cls._extension, 'A3DTABLE'))"},{"col":4,"comment":"\n        Calculate the value for the ``DATASUM`` card given the input data\n        ","endLoc":904,"header":"def _calculate_datasum_with_heap(self)","id":2279,"name":"_calculate_datasum_with_heap","nodeType":"Function","startLoc":874,"text":"def _calculate_datasum_with_heap(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card given the input data\n        \"\"\"\n\n        with _binary_table_byte_swap(self.data) as data:\n            dout = data.view(type=np.ndarray, dtype=np.ubyte)\n            csum = self._compute_checksum(dout)\n\n            # Now add in the heap data to the checksum (we can skip any gap\n            # between the table and the heap since it's all zeros and doesn't\n            # contribute to the checksum\n            if data._get_raw_data() is None:\n                # This block is still needed because\n                # test_variable_length_table_data leads to ._get_raw_data\n                # returning None which means _get_heap_data doesn't work.\n                # Which happens when the data is loaded in memory rather than\n                # being unloaded on disk\n                for idx in range(data._nfields):\n                    if isinstance(data.columns._recformats[idx], _FormatP):\n                        for coldata in data.field(idx):\n                            # coldata should already be byteswapped from the call\n                            # to _binary_table_byte_swap\n                            if not len(coldata):\n                                continue\n\n                            csum = self._compute_checksum(coldata, csum)\n            else:\n                csum = self._compute_checksum(data._get_heap_data(), csum)\n\n            return csum"},{"col":4,"comment":"\n        Given the supplied val, val2, format and scale try to instantiate\n        the corresponding TimeFormat class to convert the input values into\n        the internal jd1 and jd2.\n\n        If format is `None` and the input is a string-type or object array then\n        guess available formats and stop when one matches.\n        ","endLoc":460,"header":"def _get_time_fmt(self, val, val2, format, scale,\n                      precision, in_subfmt, out_subfmt)","id":2280,"name":"_get_time_fmt","nodeType":"Function","startLoc":403,"text":"def _get_time_fmt(self, val, val2, format, scale,\n                      precision, in_subfmt, out_subfmt):\n        \"\"\"\n        Given the supplied val, val2, format and scale try to instantiate\n        the corresponding TimeFormat class to convert the input values into\n        the internal jd1 and jd2.\n\n        If format is `None` and the input is a string-type or object array then\n        guess available formats and stop when one matches.\n        \"\"\"\n\n        if (format is None\n                and (val.dtype.kind in ('S', 'U', 'O', 'M') or val.dtype.names)):\n            # Input is a string, object, datetime, or a table-like ndarray\n            # (structured array, recarray). These input types can be\n            # uniquely identified by the format classes.\n            formats = [(name, cls) for name, cls in self.FORMATS.items()\n                       if issubclass(cls, TimeUnique)]\n\n            # AstropyTime is a pseudo-format that isn't in the TIME_FORMATS registry,\n            # but try to guess it at the end.\n            formats.append(('astropy_time', TimeAstropyTime))\n\n        elif not (isinstance(format, str)\n                  and format.lower() in self.FORMATS):\n            if format is None:\n                raise ValueError(\"No time format was given, and the input is \"\n                                 \"not unique\")\n            else:\n                raise ValueError(\"Format {!r} is not one of the allowed \"\n                                 \"formats {}\".format(format,\n                                                     sorted(self.FORMATS)))\n        else:\n            formats = [(format, self.FORMATS[format])]\n\n        assert formats\n        problems = {}\n        for name, cls in formats:\n            try:\n                return cls(val, val2, scale, precision, in_subfmt, out_subfmt)\n            except UnitConversionError:\n                raise\n            except (ValueError, TypeError) as err:\n                # If ``format`` specified then there is only one possibility, so raise\n                # immediately and include the upstream exception message to make it\n                # easier for user to see what is wrong.\n                if len(formats) == 1:\n                    raise ValueError(\n                        f'Input values did not match the format class {format}:'\n                        + os.linesep\n                        + f'{err.__class__.__name__}: {err}'\n                    ) from err\n                else:\n                    problems[name] = err\n        else:\n            raise ValueError(f'Input values did not match any of the formats '\n                             f'where the format keyword is optional: '\n                             f'{problems}') from problems[formats[0][0]]"},{"col":0,"comment":"\n    Ensures that all the data of a binary FITS table (represented as a FITS_rec\n    object) is in a big-endian byte order.  Columns are swapped in-place one\n    at a time, and then returned to their previous byte order when this context\n    manager exits.\n\n    Because a new dtype is needed to represent the byte-swapped columns, the\n    new dtype is temporarily applied as well.\n    ","endLoc":1546,"header":"@contextlib.contextmanager\ndef _binary_table_byte_swap(data)","id":2281,"name":"_binary_table_byte_swap","nodeType":"Function","startLoc":1480,"text":"@contextlib.contextmanager\ndef _binary_table_byte_swap(data):\n    \"\"\"\n    Ensures that all the data of a binary FITS table (represented as a FITS_rec\n    object) is in a big-endian byte order.  Columns are swapped in-place one\n    at a time, and then returned to their previous byte order when this context\n    manager exits.\n\n    Because a new dtype is needed to represent the byte-swapped columns, the\n    new dtype is temporarily applied as well.\n    \"\"\"\n\n    orig_dtype = data.dtype\n\n    names = []\n    formats = []\n    offsets = []\n\n    to_swap = []\n\n    if sys.byteorder == 'little':\n        swap_types = ('<', '=')\n    else:\n        swap_types = ('<',)\n\n    for idx, name in enumerate(orig_dtype.names):\n        field = _get_recarray_field(data, idx)\n\n        field_dtype, field_offset = orig_dtype.fields[name]\n        names.append(name)\n        formats.append(field_dtype)\n        offsets.append(field_offset)\n\n        if isinstance(field, chararray.chararray):\n            continue\n\n        # only swap unswapped\n        # must use field_dtype.base here since for multi-element dtypes,\n        # the .str with be '|V<N>' where <N> is the total bytes per element\n        if field.itemsize > 1 and field_dtype.base.str[0] in swap_types:\n            to_swap.append(field)\n            # Override the dtype for this field in the new record dtype with\n            # the byteswapped version\n            formats[-1] = field_dtype.newbyteorder()\n\n        # deal with var length table\n        recformat = data.columns._recformats[idx]\n        if isinstance(recformat, _FormatP):\n            coldata = data.field(idx)\n            for c in coldata:\n                if (not isinstance(c, chararray.chararray) and\n                        c.itemsize > 1 and c.dtype.str[0] in swap_types):\n                    to_swap.append(c)\n\n    for arr in reversed(to_swap):\n        arr.byteswap(True)\n\n    data.dtype = np.dtype({'names': names,\n                           'formats': formats,\n                           'offsets': offsets})\n\n    yield data\n\n    for arr in to_swap:\n        arr.byteswap(True)\n\n    data.dtype = orig_dtype"},{"col":4,"comment":"null","endLoc":392,"header":"def _infer_representation(self, representation_type, differential_type)","id":2282,"name":"_infer_representation","nodeType":"Function","startLoc":367,"text":"def _infer_representation(self, representation_type, differential_type):\n        if representation_type is None and differential_type is None:\n            return {'base': self.default_representation, 's': self.default_differential}\n\n        if representation_type is None:\n            representation_type = self.default_representation\n\n        if (inspect.isclass(differential_type)\n                and issubclass(differential_type, r.BaseDifferential)):\n            # TODO: assumes the differential class is for the velocity\n            # differential\n            differential_type = {'s': differential_type}\n\n        elif isinstance(differential_type, str):\n            # TODO: assumes the differential class is for the velocity\n            # differential\n            diff_cls = r.DIFFERENTIAL_CLASSES[differential_type]\n            differential_type = {'s': diff_cls}\n\n        elif differential_type is None:\n            if representation_type == self.default_representation:\n                differential_type = {'s': self.default_differential}\n            else:\n                differential_type = {'s': 'base'}  # see set_representation_cls()\n\n        return _get_repr_classes(representation_type, **differential_type)"},{"col":0,"comment":"Get valid representation and differential classes.\n\n    Parameters\n    ----------\n    base : str or `~astropy.coordinates.BaseRepresentation` subclass\n        class for the representation of the base coordinates.  If a string,\n        it is looked up among the known representation classes.\n    **differentials : dict of str or `~astropy.coordinates.BaseDifferentials`\n        Keys are like for normal differentials, i.e., 's' for a first\n        derivative in time, etc.  If an item is set to `None`, it will be\n        guessed from the base class.\n\n    Returns\n    -------\n    repr_classes : dict of subclasses\n        The base class is keyed by 'base'; the others by the keys of\n        ``diffferentials``.\n    ","endLoc":111,"header":"def _get_repr_classes(base, **differentials)","id":2283,"name":"_get_repr_classes","nodeType":"Function","startLoc":73,"text":"def _get_repr_classes(base, **differentials):\n    \"\"\"Get valid representation and differential classes.\n\n    Parameters\n    ----------\n    base : str or `~astropy.coordinates.BaseRepresentation` subclass\n        class for the representation of the base coordinates.  If a string,\n        it is looked up among the known representation classes.\n    **differentials : dict of str or `~astropy.coordinates.BaseDifferentials`\n        Keys are like for normal differentials, i.e., 's' for a first\n        derivative in time, etc.  If an item is set to `None`, it will be\n        guessed from the base class.\n\n    Returns\n    -------\n    repr_classes : dict of subclasses\n        The base class is keyed by 'base'; the others by the keys of\n        ``diffferentials``.\n    \"\"\"\n    base = _get_repr_cls(base)\n    repr_classes = {'base': base}\n\n    for name, differential_type in differentials.items():\n        if differential_type == 'base':\n            # We don't want to fail for this case.\n            differential_type = r.DIFFERENTIAL_CLASSES.get(base.get_name(), None)\n\n        elif differential_type in r.DIFFERENTIAL_CLASSES:\n            differential_type = r.DIFFERENTIAL_CLASSES[differential_type]\n\n        elif (differential_type is not None\n              and (not isinstance(differential_type, type)\n                   or not issubclass(differential_type, r.BaseDifferential))):\n            raise ValueError(\n                'Differential is {!r} but must be a BaseDifferential class '\n                'or one of the string aliases {}'.format(\n                    differential_type, list(r.DIFFERENTIAL_CLASSES)))\n        repr_classes[name] = differential_type\n    return repr_classes"},{"col":0,"comment":"\n    Return a valid representation class from ``value`` or raise exception.\n    ","endLoc":51,"header":"def _get_repr_cls(value)","id":2284,"name":"_get_repr_cls","nodeType":"Function","startLoc":38,"text":"def _get_repr_cls(value):\n    \"\"\"\n    Return a valid representation class from ``value`` or raise exception.\n    \"\"\"\n\n    if value in r.REPRESENTATION_CLASSES:\n        value = r.REPRESENTATION_CLASSES[value]\n    elif (not isinstance(value, type) or\n          not issubclass(value, r.BaseRepresentation)):\n        raise ValueError(\n            'Representation is {!r} but must be a BaseRepresentation class '\n            'or one of the string aliases {}'.format(\n                value, list(r.REPRESENTATION_CLASSES)))\n    return value"},{"col":0,"comment":"Check if a download for ``url_key`` is in the cache.\n\n    The provided ``url_key`` will be the name used in the cache. The contents\n    may have been downloaded from this URL or from a mirror or they may have\n    been provided by the user. See `~download_file` for details.\n\n    Parameters\n    ----------\n    url_key : str\n        The URL retrieved\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n\n    Returns\n    -------\n    in_cache : bool\n        `True` if a download for ``url_key`` is in the cache, `False` if not\n        or if the cache does not exist at all.\n\n    See Also\n    --------\n    cache_contents : obtain a dictionary listing everything in the cache\n    ","endLoc":1448,"header":"def is_url_in_cache(url_key, pkgname='astropy')","id":2285,"name":"is_url_in_cache","nodeType":"Function","startLoc":1416,"text":"def is_url_in_cache(url_key, pkgname='astropy'):\n    \"\"\"Check if a download for ``url_key`` is in the cache.\n\n    The provided ``url_key`` will be the name used in the cache. The contents\n    may have been downloaded from this URL or from a mirror or they may have\n    been provided by the user. See `~download_file` for details.\n\n    Parameters\n    ----------\n    url_key : str\n        The URL retrieved\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n\n    Returns\n    -------\n    in_cache : bool\n        `True` if a download for ``url_key`` is in the cache, `False` if not\n        or if the cache does not exist at all.\n\n    See Also\n    --------\n    cache_contents : obtain a dictionary listing everything in the cache\n    \"\"\"\n    try:\n        dldir = _get_download_cache_loc(pkgname)\n    except OSError:\n        return False\n    filename = os.path.join(dldir, _url_to_dirname(url_key), \"contents\")\n    return os.path.exists(filename)"},{"col":0,"comment":"Clears the data file cache by deleting the local file(s).\n\n    If a URL is provided, it will be the name used in the cache. The contents\n    may have been downloaded from this URL or from a mirror or they may have\n    been provided by the user. See `~download_file` for details.\n\n    For the purposes of this function, a file can also be identified by a hash\n    of its contents or by the filename under which the data is stored (as\n    returned by `~download_file`, for example).\n\n    Parameters\n    ----------\n    hashorurl : str or None\n        If None, the whole cache is cleared.  Otherwise, specify\n        a hash for the cached file that is supposed to be deleted,\n        the full path to a file in the cache that should be deleted,\n        or a URL that should be removed from the cache if present.\n\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n    ","endLoc":1684,"header":"def clear_download_cache(hashorurl=None, pkgname='astropy')","id":2286,"name":"clear_download_cache","nodeType":"Function","startLoc":1619,"text":"def clear_download_cache(hashorurl=None, pkgname='astropy'):\n    \"\"\"Clears the data file cache by deleting the local file(s).\n\n    If a URL is provided, it will be the name used in the cache. The contents\n    may have been downloaded from this URL or from a mirror or they may have\n    been provided by the user. See `~download_file` for details.\n\n    For the purposes of this function, a file can also be identified by a hash\n    of its contents or by the filename under which the data is stored (as\n    returned by `~download_file`, for example).\n\n    Parameters\n    ----------\n    hashorurl : str or None\n        If None, the whole cache is cleared.  Otherwise, specify\n        a hash for the cached file that is supposed to be deleted,\n        the full path to a file in the cache that should be deleted,\n        or a URL that should be removed from the cache if present.\n\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n    \"\"\"\n    try:\n        dldir = _get_download_cache_loc(pkgname)\n    except OSError as e:\n        # Problem arose when trying to open the cache\n        # Just a warning, though\n        msg = 'Not clearing data cache - cache inaccessible due to '\n        estr = '' if len(e.args) < 1 else (': ' + str(e))\n        warn(CacheMissingWarning(msg + e.__class__.__name__ + estr))\n        return\n    try:\n        if hashorurl is None:\n            # Optional: delete old incompatible caches too\n            _rmtree(dldir)\n        elif _is_url(hashorurl):\n            filepath = os.path.join(dldir, _url_to_dirname(hashorurl))\n            _rmtree(filepath)\n        else:\n            # Not a URL, it should be either a filename or a hash\n            filepath = os.path.join(dldir, hashorurl)\n            rp = os.path.relpath(filepath, dldir)\n            if rp.startswith(\"..\"):\n                raise RuntimeError(\n                    f\"attempted to use clear_download_cache on the path \"\n                    f\"{filepath} outside the data cache directory {dldir}\")\n            d, f = os.path.split(rp)\n            if d and f in [\"contents\", \"url\"]:\n                # It's a filename not the hash of a URL\n                # so we want to zap the directory containing the\n                # files \"url\" and \"contents\"\n                filepath = os.path.join(dldir, d)\n            if os.path.exists(filepath):\n                _rmtree(filepath)\n            elif (len(hashorurl) == 2*hashlib.md5().digest_size\n                    and re.match(r\"[0-9a-f]+\", hashorurl)):\n                # It's the hash of some file contents, we have to find the right file\n                filename = _find_hash_fn(hashorurl)\n                if filename is not None:\n                    clear_download_cache(filename)\n    except OSError as e:\n        msg = 'Not clearing data from cache - problem arose '\n        estr = '' if len(e.args) < 1 else (': ' + str(e))\n        warn(CacheMissingWarning(msg + e.__class__.__name__ + estr))"},{"col":4,"comment":"null","endLoc":1973,"header":"def __delitem__(self, item)","id":2287,"name":"__delitem__","nodeType":"Function","startLoc":1959,"text":"def __delitem__(self, item):\n        if isinstance(item, str):\n            self.remove_column(item)\n        elif isinstance(item, (int, np.integer)):\n            self.remove_row(item)\n        elif (isinstance(item, (list, tuple, np.ndarray))\n              and all(isinstance(x, str) for x in item)):\n            self.remove_columns(item)\n        elif (isinstance(item, (list, np.ndarray))\n              and np.asarray(item).dtype.kind == 'i'):\n            self.remove_rows(item)\n        elif isinstance(item, slice):\n            self.remove_rows(item)\n        else:\n            raise IndexError('illegal key or index value')"},{"col":4,"comment":"\n        Remove a column from the table.\n\n        This can also be done with::\n\n          del table[name]\n\n        Parameters\n        ----------\n        name : str\n            Name of column to remove\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Remove column 'b' from the table::\n\n            >>> t.remove_column('b')\n            >>> print(t)\n             a   c\n            --- ---\n              1   x\n              2   y\n              3   z\n\n        To remove several columns at the same time use remove_columns.\n        ","endLoc":2636,"header":"def remove_column(self, name)","id":2288,"name":"remove_column","nodeType":"Function","startLoc":2597,"text":"def remove_column(self, name):\n        \"\"\"\n        Remove a column from the table.\n\n        This can also be done with::\n\n          del table[name]\n\n        Parameters\n        ----------\n        name : str\n            Name of column to remove\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Remove column 'b' from the table::\n\n            >>> t.remove_column('b')\n            >>> print(t)\n             a   c\n            --- ---\n              1   x\n              2   y\n              3   z\n\n        To remove several columns at the same time use remove_columns.\n        \"\"\"\n\n        self.remove_columns([name])"},{"col":4,"comment":"\n        Remove several columns from the table.\n\n        Parameters\n        ----------\n        names : str or iterable of str\n            Names of the columns to remove\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...     names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Remove columns 'b' and 'c' from the table::\n\n            >>> t.remove_columns(['b', 'c'])\n            >>> print(t)\n             a\n            ---\n              1\n              2\n              3\n\n        Specifying only a single column also works. Remove column 'b' from the table::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...     names=('a', 'b', 'c'))\n            >>> t.remove_columns('b')\n            >>> print(t)\n             a   c\n            --- ---\n              1   x\n              2   y\n              3   z\n\n        This gives the same as using remove_column.\n        ","endLoc":2685,"header":"def remove_columns(self, names)","id":2289,"name":"remove_columns","nodeType":"Function","startLoc":2638,"text":"def remove_columns(self, names):\n        '''\n        Remove several columns from the table.\n\n        Parameters\n        ----------\n        names : str or iterable of str\n            Names of the columns to remove\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...     names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Remove columns 'b' and 'c' from the table::\n\n            >>> t.remove_columns(['b', 'c'])\n            >>> print(t)\n             a\n            ---\n              1\n              2\n              3\n\n        Specifying only a single column also works. Remove column 'b' from the table::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...     names=('a', 'b', 'c'))\n            >>> t.remove_columns('b')\n            >>> print(t)\n             a   c\n            --- ---\n              1   x\n              2   y\n              3   z\n\n        This gives the same as using remove_column.\n        '''\n        for name in self._set_of_names_in_colnames(names):\n            self.columns.pop(name)"},{"col":4,"comment":"Open a leap-second list.\n\n        Parameters\n        ----------\n        file : path-like or None\n            Full local or network path to the file holding leap-second data,\n            for passing on to the various ``from_`` class methods.\n            If 'erfa', return the data used by the ERFA library.\n            If `None`, use default locations from file and configuration to\n            find a table that is not expired.\n        cache : bool\n            Whether to use cache. Defaults to False, since leap-second files\n            are regularly updated.\n\n        Returns\n        -------\n        leap_seconds : `~astropy.utils.iers.LeapSeconds`\n            Table with 'year', 'month', and 'tai_utc' columns, plus possibly\n            others.\n\n        Notes\n        -----\n        Bulletin C is released about 10 days after a possible leap second is\n        introduced, i.e., mid-January or mid-July.  Expiration days are thus\n        generally at least 150 days after the present.  For the auto-loading,\n        a list comprised of the table shipped with astropy, and files and\n        URLs in `~astropy.utils.iers.Conf` are tried, returning the first\n        that is sufficiently new, or the newest among them all.\n        ","endLoc":946,"header":"@classmethod\n    def open(cls, file=None, cache=False)","id":2290,"name":"open","nodeType":"Function","startLoc":902,"text":"@classmethod\n    def open(cls, file=None, cache=False):\n        \"\"\"Open a leap-second list.\n\n        Parameters\n        ----------\n        file : path-like or None\n            Full local or network path to the file holding leap-second data,\n            for passing on to the various ``from_`` class methods.\n            If 'erfa', return the data used by the ERFA library.\n            If `None`, use default locations from file and configuration to\n            find a table that is not expired.\n        cache : bool\n            Whether to use cache. Defaults to False, since leap-second files\n            are regularly updated.\n\n        Returns\n        -------\n        leap_seconds : `~astropy.utils.iers.LeapSeconds`\n            Table with 'year', 'month', and 'tai_utc' columns, plus possibly\n            others.\n\n        Notes\n        -----\n        Bulletin C is released about 10 days after a possible leap second is\n        introduced, i.e., mid-January or mid-July.  Expiration days are thus\n        generally at least 150 days after the present.  For the auto-loading,\n        a list comprised of the table shipped with astropy, and files and\n        URLs in `~astropy.utils.iers.Conf` are tried, returning the first\n        that is sufficiently new, or the newest among them all.\n        \"\"\"\n        if file is None:\n            return cls.auto_open()\n\n        if file.lower() == 'erfa':\n            return cls.from_erfa()\n\n        if urlparse(file).netloc:\n            file = download_file(file, cache=cache)\n\n        # Just try both reading methods.\n        try:\n            return cls.from_iers_leap_seconds(file)\n        except Exception:\n            return cls.from_leap_seconds_list(file)"},{"col":4,"comment":"Create table from the leap-second list in ERFA.\n\n        Parameters\n        ----------\n        built_in : bool\n            If `False` (default), retrieve the list currently used by ERFA,\n            which may have been updated.  If `True`, retrieve the list shipped\n            with erfa.\n        ","endLoc":1136,"header":"@classmethod\n    def from_erfa(cls, built_in=False)","id":2291,"name":"from_erfa","nodeType":"Function","startLoc":1114,"text":"@classmethod\n    def from_erfa(cls, built_in=False):\n        \"\"\"Create table from the leap-second list in ERFA.\n\n        Parameters\n        ----------\n        built_in : bool\n            If `False` (default), retrieve the list currently used by ERFA,\n            which may have been updated.  If `True`, retrieve the list shipped\n            with erfa.\n        \"\"\"\n        current = cls(erfa.leap_seconds.get())\n        current._expires = Time('{0.year:04d}-{0.month:02d}-{0.day:02d}'\n                                .format(erfa.leap_seconds.expires),\n                                scale='tai')\n        if not built_in:\n            return current\n\n        try:\n            erfa.leap_seconds.set(None)  # reset to defaults\n            return cls.from_erfa(built_in=False)\n        finally:\n            erfa.leap_seconds.set(current)"},{"col":4,"comment":"Return ``names`` as a set if valid, or raise a `KeyError`.\n\n        ``names`` is valid if all elements in it are in ``self.colnames``.\n        If ``names`` is a string then it is interpreted as a single column\n        name.\n        ","endLoc":2595,"header":"def _set_of_names_in_colnames(self, names)","id":2292,"name":"_set_of_names_in_colnames","nodeType":"Function","startLoc":2582,"text":"def _set_of_names_in_colnames(self, names):\n        \"\"\"Return ``names`` as a set if valid, or raise a `KeyError`.\n\n        ``names`` is valid if all elements in it are in ``self.colnames``.\n        If ``names`` is a string then it is interpreted as a single column\n        name.\n        \"\"\"\n        names = {names} if isinstance(names, str) else set(names)\n        invalid_names = names.difference(self.colnames)\n        if len(invalid_names) == 1:\n            raise KeyError(f'column \"{invalid_names.pop()}\" does not exist')\n        elif len(invalid_names) > 1:\n            raise KeyError(f'columns {invalid_names} do not exist')\n        return names"},{"col":4,"comment":"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        ","endLoc":921,"header":"def _calculate_datasum(self)","id":2293,"name":"_calculate_datasum","nodeType":"Function","startLoc":906,"text":"def _calculate_datasum(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        \"\"\"\n\n        if self._has_data:\n            # This method calculates the datasum while incorporating any\n            # heap data, which is obviously not handled from the base\n            # _calculate_datasum\n            return self._calculate_datasum_with_heap()\n        else:\n            # This is the case where the data has not been read from the file\n            # yet.  We can handle that in a generic manner so we do it in the\n            # base class.  The other possibility is that there is no data at\n            # all.  This can also be handled in a generic manner.\n            return super()._calculate_datasum()"},{"col":4,"comment":"null","endLoc":972,"header":"def _writedata_internal(self, fileobj)","id":2294,"name":"_writedata_internal","nodeType":"Function","startLoc":923,"text":"def _writedata_internal(self, fileobj):\n        size = 0\n\n        if self.data is None:\n            return size\n\n        with _binary_table_byte_swap(self.data) as data:\n            if _has_unicode_fields(data):\n                # If the raw data was a user-supplied recarray, we can't write\n                # unicode columns directly to the file, so we have to switch\n                # to a slower row-by-row write\n                self._writedata_by_row(fileobj)\n            else:\n                fileobj.writearray(data)\n                # write out the heap of variable length array columns this has\n                # to be done after the \"regular\" data is written (above)\n                # to avoid a bug in the lustre filesystem client, don't\n                # write 0-byte objects\n                if data._gap > 0:\n                    fileobj.write((data._gap * '\\0').encode('ascii'))\n\n            nbytes = data._gap\n\n            if not self._manages_own_heap:\n                # Write the heap data one column at a time, in the order\n                # that the data pointers appear in the column (regardless\n                # if that data pointer has a different, previous heap\n                # offset listed)\n                for idx in range(data._nfields):\n                    if not isinstance(data.columns._recformats[idx],\n                                      _FormatP):\n                        continue\n\n                    field = self.data.field(idx)\n                    for row in field:\n                        if len(row) > 0:\n                            nbytes += row.nbytes\n                            fileobj.writearray(row)\n            else:\n                heap_data = data._get_heap_data()\n                if len(heap_data) > 0:\n                    nbytes += len(heap_data)\n                    fileobj.writearray(heap_data)\n\n            data._heapsize = nbytes - data._gap\n            size += nbytes\n\n        size += self.data.size * self.data._raw_itemsize\n\n        return size"},{"col":4,"comment":"null","endLoc":998,"header":"def _writedata_by_row(self, fileobj)","id":2295,"name":"_writedata_by_row","nodeType":"Function","startLoc":974,"text":"def _writedata_by_row(self, fileobj):\n        fields = [self.data.field(idx)\n                  for idx in range(len(self.data.columns))]\n\n        # Creating Record objects is expensive (as in\n        # `for row in self.data:` so instead we just iterate over the row\n        # indices and get one field at a time:\n        for idx in range(len(self.data)):\n            for field in fields:\n                item = field[idx]\n                field_width = None\n\n                if field.dtype.kind == 'U':\n                    # Read the field *width* by reading past the field kind.\n                    i = field.dtype.str.index(field.dtype.kind)\n                    field_width = int(field.dtype.str[i+1:])\n                    item = np.char.encode(item, 'ascii')\n\n                fileobj.writearray(item)\n                if field_width is not None:\n                    j = item.dtype.str.index(item.dtype.kind)\n                    item_length = int(item.dtype.str[j+1:])\n                    # Fix padding problem (see #5296).\n                    padding = '\\x00'*(field_width - item_length)\n                    fileobj.write(padding.encode('ascii'))"},{"col":4,"comment":"null","endLoc":543,"header":"def _infer_data(self, args, copy, kwargs)","id":2296,"name":"_infer_data","nodeType":"Function","startLoc":394,"text":"def _infer_data(self, args, copy, kwargs):\n        # if not set below, this is a frame with no data\n        representation_data = None\n        differential_data = None\n\n        args = list(args)  # need to be able to pop them\n        if (len(args) > 0) and (isinstance(args[0], r.BaseRepresentation) or\n                                args[0] is None):\n            representation_data = args.pop(0)  # This can still be None\n            if len(args) > 0:\n                raise TypeError(\n                    'Cannot create a frame with both a representation object '\n                    'and other positional arguments')\n\n            if representation_data is not None:\n                diffs = representation_data.differentials\n                differential_data = diffs.get('s', None)\n                if ((differential_data is None and len(diffs) > 0) or\n                        (differential_data is not None and len(diffs) > 1)):\n                    raise ValueError('Multiple differentials are associated '\n                                     'with the representation object passed in '\n                                     'to the frame initializer. Only a single '\n                                     'velocity differential is supported. Got: '\n                                     '{}'.format(diffs))\n\n        else:\n            representation_cls = self.get_representation_cls()\n            # Get any representation data passed in to the frame initializer\n            # using keyword or positional arguments for the component names\n            repr_kwargs = {}\n            for nmkw, nmrep in self.representation_component_names.items():\n                if len(args) > 0:\n                    # first gather up positional args\n                    repr_kwargs[nmrep] = args.pop(0)\n                elif nmkw in kwargs:\n                    repr_kwargs[nmrep] = kwargs.pop(nmkw)\n\n            # special-case the Spherical->UnitSpherical if no `distance`\n\n            if repr_kwargs:\n                # TODO: determine how to get rid of the part before the \"try\" -\n                # currently removing it has a performance regression for\n                # unitspherical because of the try-related overhead.\n                # Also frames have no way to indicate what the \"distance\" is\n                if repr_kwargs.get('distance', True) is None:\n                    del repr_kwargs['distance']\n\n                if (issubclass(representation_cls,\n                               r.SphericalRepresentation)\n                        and 'distance' not in repr_kwargs):\n                    representation_cls = representation_cls._unit_representation\n\n                try:\n                    representation_data = representation_cls(copy=copy,\n                                                             **repr_kwargs)\n                except TypeError as e:\n                    # this except clause is here to make the names of the\n                    # attributes more human-readable.  Without this the names\n                    # come from the representation instead of the frame's\n                    # attribute names.\n                    try:\n                        representation_data = (\n                            representation_cls._unit_representation(\n                                copy=copy, **repr_kwargs))\n                    except Exception:\n                        msg = str(e)\n                        names = self.get_representation_component_names()\n                        for frame_name, repr_name in names.items():\n                            msg = msg.replace(repr_name, frame_name)\n                        msg = msg.replace('__init__()',\n                                          f'{self.__class__.__name__}()')\n                        e.args = (msg,)\n                        raise e\n\n            # Now we handle the Differential data:\n            # Get any differential data passed in to the frame initializer\n            # using keyword or positional arguments for the component names\n            differential_cls = self.get_representation_cls('s')\n            diff_component_names = self.get_representation_component_names('s')\n            diff_kwargs = {}\n            for nmkw, nmrep in diff_component_names.items():\n                if len(args) > 0:\n                    # first gather up positional args\n                    diff_kwargs[nmrep] = args.pop(0)\n                elif nmkw in kwargs:\n                    diff_kwargs[nmrep] = kwargs.pop(nmkw)\n\n            if diff_kwargs:\n                if (hasattr(differential_cls, '_unit_differential')\n                        and 'd_distance' not in diff_kwargs):\n                    differential_cls = differential_cls._unit_differential\n\n                elif len(diff_kwargs) == 1 and 'd_distance' in diff_kwargs:\n                    differential_cls = r.RadialDifferential\n\n                try:\n                    differential_data = differential_cls(copy=copy,\n                                                         **diff_kwargs)\n                except TypeError as e:\n                    # this except clause is here to make the names of the\n                    # attributes more human-readable.  Without this the names\n                    # come from the representation instead of the frame's\n                    # attribute names.\n                    msg = str(e)\n                    names = self.get_representation_component_names('s')\n                    for frame_name, repr_name in names.items():\n                        msg = msg.replace(repr_name, frame_name)\n                    msg = msg.replace('__init__()',\n                                      f'{self.__class__.__name__}()')\n                    e.args = (msg,)\n                    raise\n\n        if len(args) > 0:\n            raise TypeError(\n                '{}.__init__ had {} remaining unhandled arguments'.format(\n                    self.__class__.__name__, len(args)))\n\n        if representation_data is None and differential_data is not None:\n            raise ValueError(\"Cannot pass in differential component data \"\n                             \"without positional (representation) data.\")\n\n        if differential_data:\n            # Check that differential data provided has units compatible\n            # with time-derivative of representation data.\n            # NOTE: there is no dimensionless time while lengths can be\n            # dimensionless (u.dimensionless_unscaled).\n            for comp in representation_data.components:\n                if (diff_comp := f'd_{comp}') in differential_data.components:\n                    current_repr_unit = representation_data._units[comp]\n                    current_diff_unit = differential_data._units[diff_comp]\n                    expected_unit = current_repr_unit / u.s\n                    if not current_diff_unit.is_equivalent(expected_unit):\n                        for key, val in self.get_representation_component_names().items():\n                            if val == comp:\n                                current_repr_name = key\n                                break\n                        for key, val in self.get_representation_component_names('s').items():\n                            if val == diff_comp:\n                                current_diff_name = key\n                                break\n                        raise ValueError(\n                            f'{current_repr_name} has unit \"{current_repr_unit}\" with physical '\n                            f'type \"{current_repr_unit.physical_type}\", but {current_diff_name} '\n                            f'has incompatible unit \"{current_diff_unit}\" with physical type '\n                            f'\"{current_diff_unit.physical_type}\" instead of the expected '\n                            f'\"{(expected_unit).physical_type}\".')\n\n            representation_data = representation_data.with_differentials({'s': differential_data})\n\n        return representation_data"},{"col":4,"comment":"\n        Remove a row from the table.\n\n        Parameters\n        ----------\n        index : int\n            Index of row to remove\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Remove row 1 from the table::\n\n            >>> t.remove_row(1)\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              3 0.3   z\n\n        To remove several rows at the same time use remove_rows.\n        ","endLoc":2468,"header":"def remove_row(self, index)","id":2297,"name":"remove_row","nodeType":"Function","startLoc":2432,"text":"def remove_row(self, index):\n        \"\"\"\n        Remove a row from the table.\n\n        Parameters\n        ----------\n        index : int\n            Index of row to remove\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Remove row 1 from the table::\n\n            >>> t.remove_row(1)\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              3 0.3   z\n\n        To remove several rows at the same time use remove_rows.\n        \"\"\"\n        # check the index against the types that work with np.delete\n        if not isinstance(index, (int, np.integer)):\n            raise TypeError(\"Row index must be an integer\")\n        self.remove_rows(index)"},{"col":4,"comment":"\n        Remove rows from the table.\n\n        Parameters\n        ----------\n        row_specifier : slice or int or array of int\n            Specification for rows to remove\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Remove rows 0 and 2 from the table::\n\n            >>> t.remove_rows([0, 2])\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              2 0.2   y\n\n\n        Note that there are no warnings if the slice operator extends\n        outside the data::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> t.remove_rows(slice(10, 20, 1))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n        ","endLoc":2531,"header":"def remove_rows(self, row_specifier)","id":2298,"name":"remove_rows","nodeType":"Function","startLoc":2470,"text":"def remove_rows(self, row_specifier):\n        \"\"\"\n        Remove rows from the table.\n\n        Parameters\n        ----------\n        row_specifier : slice or int or array of int\n            Specification for rows to remove\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Remove rows 0 and 2 from the table::\n\n            >>> t.remove_rows([0, 2])\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              2 0.2   y\n\n\n        Note that there are no warnings if the slice operator extends\n        outside the data::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> t.remove_rows(slice(10, 20, 1))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n        \"\"\"\n        # Update indices\n        for index in self.indices:\n            index.remove_rows(row_specifier)\n\n        keep_mask = np.ones(len(self), dtype=bool)\n        keep_mask[row_specifier] = False\n\n        columns = self.TableColumns()\n        for name, col in self.columns.items():\n            newcol = col[keep_mask]\n            newcol.info.parent_table = self\n            columns[name] = newcol\n\n        self._replace_cols(columns)\n\n        # Revert groups to default (ungrouped) state\n        if hasattr(self, '_groups'):\n            del self._groups"},{"col":0,"comment":"\n    Overload astropy.utils.data.download_file within iers module to use a\n    custom (longer) wait time.  This just passes through ``*args`` and\n    ``**kwargs`` after temporarily setting the download_file remote timeout to\n    the local ``iers.conf.remote_timeout`` value.\n    ","endLoc":94,"header":"def download_file(*args, **kwargs)","id":2299,"name":"download_file","nodeType":"Function","startLoc":83,"text":"def download_file(*args, **kwargs):\n    \"\"\"\n    Overload astropy.utils.data.download_file within iers module to use a\n    custom (longer) wait time.  This just passes through ``*args`` and\n    ``**kwargs`` after temporarily setting the download_file remote timeout to\n    the local ``iers.conf.remote_timeout`` value.\n    \"\"\"\n    kwargs.setdefault('http_headers', {'User-Agent': 'astropy/iers',\n                                       'Accept': '*/*'})\n\n    with utils.data.conf.set_temp('remote_timeout', conf.remote_timeout):\n        return utils.data.download_file(*args, **kwargs)"},{"col":4,"comment":"null","endLoc":3091,"header":"def _replace_cols(self, columns)","id":2300,"name":"_replace_cols","nodeType":"Function","startLoc":3084,"text":"def _replace_cols(self, columns):\n        for col, new_col in zip(self.columns.values(), columns.values()):\n            new_col.info.indices = []\n            for index in col.info.indices:\n                index.columns[index.col_position(col.info.name)] = new_col\n                new_col.info.indices.append(index)\n\n        self.columns = columns"},{"col":4,"comment":"Create a table from a file like the IERS ``Leap_Second.dat``.\n\n        Parameters\n        ----------\n        file : path-like, optional\n            Full local or network path to the file holding leap-second data\n            in a format consistent with that used by IERS.  By default, uses\n            ``iers.IERS_LEAP_SECOND_FILE``.\n\n        Notes\n        -----\n        The file *must* contain the expiration date in a comment line, like\n        '#  File expires on 28 June 2020'\n        ","endLoc":1080,"header":"@classmethod\n    def from_iers_leap_seconds(cls, file=IERS_LEAP_SECOND_FILE)","id":2301,"name":"from_iers_leap_seconds","nodeType":"Function","startLoc":1063,"text":"@classmethod\n    def from_iers_leap_seconds(cls, file=IERS_LEAP_SECOND_FILE):\n        \"\"\"Create a table from a file like the IERS ``Leap_Second.dat``.\n\n        Parameters\n        ----------\n        file : path-like, optional\n            Full local or network path to the file holding leap-second data\n            in a format consistent with that used by IERS.  By default, uses\n            ``iers.IERS_LEAP_SECOND_FILE``.\n\n        Notes\n        -----\n        The file *must* contain the expiration date in a comment line, like\n        '#  File expires on 28 June 2020'\n        \"\"\"\n        return cls._read_leap_seconds(\n            file, names=['mjd', 'day', 'month', 'year', 'tai_utc'])"},{"col":4,"comment":"Read a file, identifying expiration by matching 'File expires'","endLoc":1061,"header":"@classmethod\n    def _read_leap_seconds(cls, file, **kwargs)","id":2302,"name":"_read_leap_seconds","nodeType":"Function","startLoc":1041,"text":"@classmethod\n    def _read_leap_seconds(cls, file, **kwargs):\n        \"\"\"Read a file, identifying expiration by matching 'File expires'\"\"\"\n        expires = None\n        # Find expiration date.\n        with get_readable_fileobj(file) as fh:\n            lines = fh.readlines()\n            for line in lines:\n                match = cls._re_expires.match(line)\n                if match:\n                    day, month, year = match.groups()[0].split()\n                    month_nb = MONTH_ABBR.index(month[:3]) + 1\n                    expires = Time(f'{year}-{month_nb:02d}-{day}',\n                                   scale='tai', out_subfmt='date')\n                    break\n            else:\n                raise ValueError(f'did not find expiration date in {file}')\n\n        self = cls.read(lines, format='ascii.no_header', **kwargs)\n        self._expires = expires\n        return self"},{"attributeType":"null","col":8,"comment":"null","endLoc":992,"id":2303,"name":"diff_total","nodeType":"Attribute","startLoc":992,"text":"self.diff_total"},{"attributeType":"null","col":8,"comment":"null","endLoc":987,"id":2304,"name":"diff_ratio","nodeType":"Attribute","startLoc":987,"text":"self.diff_ratio"},{"attributeType":"null","col":8,"comment":"null","endLoc":981,"id":2305,"name":"numdiffs","nodeType":"Attribute","startLoc":981,"text":"self.numdiffs"},{"attributeType":"null","col":8,"comment":"null","endLoc":986,"id":2306,"name":"diff_pixels","nodeType":"Attribute","startLoc":986,"text":"self.diff_pixels"},{"attributeType":"null","col":8,"comment":"null","endLoc":982,"id":2307,"name":"rtol","nodeType":"Attribute","startLoc":982,"text":"self.rtol"},{"col":4,"comment":"Create a table from a file like the IETF ``leap-seconds.list``.\n\n        Parameters\n        ----------\n        file : path-like, optional\n            Full local or network path to the file holding leap-second data\n            in a format consistent with that used by IETF.  Up to date versions\n            can be retrieved from ``iers.IETF_LEAP_SECOND_URL``.\n\n        Notes\n        -----\n        The file *must* contain the expiration date in a comment line, like\n        '# File expires on:  28 June 2020'\n        ","endLoc":1112,"header":"@classmethod\n    def from_leap_seconds_list(cls, file)","id":2308,"name":"from_leap_seconds_list","nodeType":"Function","startLoc":1082,"text":"@classmethod\n    def from_leap_seconds_list(cls, file):\n        \"\"\"Create a table from a file like the IETF ``leap-seconds.list``.\n\n        Parameters\n        ----------\n        file : path-like, optional\n            Full local or network path to the file holding leap-second data\n            in a format consistent with that used by IETF.  Up to date versions\n            can be retrieved from ``iers.IETF_LEAP_SECOND_URL``.\n\n        Notes\n        -----\n        The file *must* contain the expiration date in a comment line, like\n        '# File expires on:  28 June 2020'\n        \"\"\"\n        from astropy.io.ascii import convert_numpy  # Here to avoid circular import\n\n        names = ['ntp_seconds', 'tai_utc', 'comment', 'day', 'month', 'year']\n        # Note: ntp_seconds does not fit in 32 bit, so causes problems on\n        # 32-bit systems without the np.int64 converter.\n        self = cls._read_leap_seconds(\n            file, names=names, include_names=names[:2],\n            converters={'ntp_seconds': [convert_numpy(np.int64)]})\n        self['mjd'] = (self['ntp_seconds']/86400 + 15020).round()\n        # Note: cannot use Time.ymdhms, since that might require leap seconds.\n        isot = Time(self['mjd'], format='mjd', scale='tai').isot\n        ymd = np.array([[int(part) for part in t.partition('T')[0].split('-')]\n                        for t in isot])\n        self['year'], self['month'], self['day'] = ymd.T\n        return self"},{"col":4,"comment":"null","endLoc":1976,"header":"def _ipython_key_completions_(self)","id":2309,"name":"_ipython_key_completions_","nodeType":"Function","startLoc":1975,"text":"def _ipython_key_completions_(self):\n        return self.colnames"},{"col":4,"comment":"Return column[item] for recarray compatibility.","endLoc":1980,"header":"def field(self, item)","id":2310,"name":"field","nodeType":"Function","startLoc":1978,"text":"def field(self, item):\n        \"\"\"Return column[item] for recarray compatibility.\"\"\"\n        return self.columns[item]"},{"col":4,"comment":"null","endLoc":1984,"header":"@property\n    def masked(self)","id":2311,"name":"masked","nodeType":"Function","startLoc":1982,"text":"@property\n    def masked(self):\n        return self._masked"},{"col":4,"comment":"null","endLoc":1989,"header":"@masked.setter\n    def masked(self, masked)","id":2312,"name":"masked","nodeType":"Function","startLoc":1986,"text":"@masked.setter\n    def masked(self, masked):\n        raise Exception('Masked attribute is read-only (use t = Table(t, masked=True)'\n                        ' to convert to a masked table)')"},{"col":4,"comment":"\n        Dump the table HDU to a file in ASCII format.  The table may be dumped\n        in three separate files, one containing column definitions, one\n        containing header parameters, and one for table data.\n\n        Parameters\n        ----------\n        datafile : path-like or file-like, optional\n            Output data file.  The default is the root name of the\n            fits file associated with this HDU appended with the\n            extension ``.txt``.\n\n        cdfile : path-like or file-like, optional\n            Output column definitions file.  The default is `None`, no\n            column definitions output is produced.\n\n        hfile : path-like or file-like, optional\n            Output header parameters file.  The default is `None`,\n            no header parameters output is produced.\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n\n        Notes\n        -----\n        The primary use for the `dump` method is to allow viewing and editing\n        the table data and parameters in a standard text editor.\n        The `load` method can be used to create a new table from the three\n        plain text (ASCII) files.\n        ","endLoc":1115,"header":"def dump(self, datafile=None, cdfile=None, hfile=None, overwrite=False)","id":2313,"name":"dump","nodeType":"Function","startLoc":1053,"text":"def dump(self, datafile=None, cdfile=None, hfile=None, overwrite=False):\n        \"\"\"\n        Dump the table HDU to a file in ASCII format.  The table may be dumped\n        in three separate files, one containing column definitions, one\n        containing header parameters, and one for table data.\n\n        Parameters\n        ----------\n        datafile : path-like or file-like, optional\n            Output data file.  The default is the root name of the\n            fits file associated with this HDU appended with the\n            extension ``.txt``.\n\n        cdfile : path-like or file-like, optional\n            Output column definitions file.  The default is `None`, no\n            column definitions output is produced.\n\n        hfile : path-like or file-like, optional\n            Output header parameters file.  The default is `None`,\n            no header parameters output is produced.\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n\n        Notes\n        -----\n        The primary use for the `dump` method is to allow viewing and editing\n        the table data and parameters in a standard text editor.\n        The `load` method can be used to create a new table from the three\n        plain text (ASCII) files.\n        \"\"\"\n\n        # check if the output files already exist\n        exist = []\n        files = [datafile, cdfile, hfile]\n\n        for f in files:\n            if isinstance(f, str):\n                if os.path.exists(f) and os.path.getsize(f) != 0:\n                    if overwrite:\n                        os.remove(f)\n                    else:\n                        exist.append(f)\n\n        if exist:\n            raise OSError('  '.join([f\"File '{f}' already exists.\"\n                                     for f in exist])+\"  If you mean to \"\n                                                      \"replace the file(s) \"\n                                                      \"then use the argument \"\n                                                      \"'overwrite=True'.\")\n\n        # Process the data\n        self._dump_data(datafile)\n\n        # Process the column definitions\n        if cdfile:\n            self._dump_coldefs(cdfile)\n\n        # Process the header parameters\n        if hfile:\n            self._header.tofile(hfile, sep='\\n', endcard=False, padding=False)"},{"col":4,"comment":"null","endLoc":2016,"header":"@property\n    def dtype(self)","id":2314,"name":"dtype","nodeType":"Function","startLoc":2014,"text":"@property\n    def dtype(self):\n        return np.dtype([descr(col) for col in self.columns.values()])"},{"attributeType":"null","col":8,"comment":"null","endLoc":983,"id":2315,"name":"atol","nodeType":"Attribute","startLoc":983,"text":"self.atol"},{"col":0,"comment":"Return a tuple containing a function which converts a list into a numpy\n    array and the type produced by the converter function.\n\n    Parameters\n    ----------\n    numpy_type : numpy data-type\n        The numpy type required of an array returned by ``converter``. Must be a\n        valid `numpy type <https://numpy.org/doc/stable/user/basics.types.html>`_\n        (e.g., numpy.uint, numpy.int8, numpy.int64, numpy.float64) or a python\n        type covered by a numpy type (e.g., int, float, str, bool).\n\n    Returns\n    -------\n    converter : callable\n        ``converter`` is a function which accepts a list and converts it to a\n        numpy array of type ``numpy_type``.\n    converter_type : type\n        ``converter_type`` tracks the generic data type produced by the\n        converter function.\n\n    Raises\n    ------\n    ValueError\n        Raised by ``converter`` if the list elements could not be converted to\n        the required type.\n    ","endLoc":1012,"header":"def convert_numpy(numpy_type)","id":2316,"name":"convert_numpy","nodeType":"Function","startLoc":941,"text":"def convert_numpy(numpy_type):\n    \"\"\"Return a tuple containing a function which converts a list into a numpy\n    array and the type produced by the converter function.\n\n    Parameters\n    ----------\n    numpy_type : numpy data-type\n        The numpy type required of an array returned by ``converter``. Must be a\n        valid `numpy type <https://numpy.org/doc/stable/user/basics.types.html>`_\n        (e.g., numpy.uint, numpy.int8, numpy.int64, numpy.float64) or a python\n        type covered by a numpy type (e.g., int, float, str, bool).\n\n    Returns\n    -------\n    converter : callable\n        ``converter`` is a function which accepts a list and converts it to a\n        numpy array of type ``numpy_type``.\n    converter_type : type\n        ``converter_type`` tracks the generic data type produced by the\n        converter function.\n\n    Raises\n    ------\n    ValueError\n        Raised by ``converter`` if the list elements could not be converted to\n        the required type.\n    \"\"\"\n\n    # Infer converter type from an instance of numpy_type.\n    type_name = numpy.array([], dtype=numpy_type).dtype.name\n    if 'int' in type_name:\n        converter_type = IntType\n    elif 'float' in type_name:\n        converter_type = FloatType\n    elif 'bool' in type_name:\n        converter_type = BoolType\n    elif 'str' in type_name:\n        converter_type = StrType\n    else:\n        converter_type = AllType\n\n    def bool_converter(vals):\n        \"\"\"\n        Convert values \"False\" and \"True\" to bools.  Raise an exception\n        for any other string values.\n        \"\"\"\n        if len(vals) == 0:\n            return numpy.array([], dtype=bool)\n\n        # Try a smaller subset first for a long array\n        if len(vals) > 10000:\n            svals = numpy.asarray(vals[:1000])\n            if not numpy.all((svals == 'False')\n                             | (svals == 'True')\n                             | (svals == '0')\n                             | (svals == '1')):\n                raise ValueError('bool input strings must be False, True, 0, 1, or \"\"')\n        vals = numpy.asarray(vals)\n\n        trues = (vals == 'True') | (vals == '1')\n        falses = (vals == 'False') | (vals == '0')\n        if not numpy.all(trues | falses):\n            raise ValueError('bool input strings must be only False, True, 0, 1, or \"\"')\n\n        return trues\n\n    def generic_converter(vals):\n        return numpy.array(vals, numpy_type)\n\n    converter = bool_converter if converter_type is BoolType else generic_converter\n\n    return converter, converter_type"},{"col":4,"comment":"\n        Write the table data in the ASCII format read by BinTableHDU.load()\n        to fileobj.\n        ","endLoc":1277,"header":"def _dump_data(self, fileobj)","id":2317,"name":"_dump_data","nodeType":"Function","startLoc":1205,"text":"def _dump_data(self, fileobj):\n        \"\"\"\n        Write the table data in the ASCII format read by BinTableHDU.load()\n        to fileobj.\n        \"\"\"\n\n        if not fileobj and self._file:\n            root = os.path.splitext(self._file.name)[0]\n            fileobj = root + '.txt'\n\n        close_file = False\n\n        if isinstance(fileobj, str):\n            fileobj = open(fileobj, 'w')\n            close_file = True\n\n        linewriter = csv.writer(fileobj, dialect=FITSTableDumpDialect)\n\n        # Process each row of the table and output one row at a time\n        def format_value(val, format):\n            if format[0] == 'S':\n                itemsize = int(format[1:])\n                return '{:{size}}'.format(val, size=itemsize)\n            elif format in np.typecodes['AllInteger']:\n                # output integer\n                return f'{val:21d}'\n            elif format in np.typecodes['Complex']:\n                return f'{val.real:21.15g}+{val.imag:.15g}j'\n            elif format in np.typecodes['Float']:\n                # output floating point\n                return f'{val:#21.15g}'\n\n        for row in self.data:\n            line = []   # the line for this row of the table\n\n            # Process each column of the row.\n            for column in self.columns:\n                # format of data in a variable length array\n                # where None means it is not a VLA:\n                vla_format = None\n                format = _convert_format(column.format)\n\n                if isinstance(format, _FormatP):\n                    # P format means this is a variable length array so output\n                    # the length of the array for this row and set the format\n                    # for the VLA data\n                    line.append('VLA_Length=')\n                    line.append(f'{len(row[column.name]):21d}')\n                    _, dtype, option = _parse_tformat(column.format)\n                    vla_format = FITS2NUMPY[option[0]][0]\n\n                if vla_format:\n                    # Output the data for each element in the array\n                    for val in row[column.name].flat:\n                        line.append(format_value(val, vla_format))\n                else:\n                    # The column data is a single element\n                    dtype = self.data.dtype.fields[column.name][0]\n                    array_format = dtype.char\n                    if array_format == 'V':\n                        array_format = dtype.base.char\n                    if array_format == 'S':\n                        array_format += str(dtype.itemsize)\n\n                    if dtype.char == 'V':\n                        for value in row[column.name].flat:\n                            line.append(format_value(value, array_format))\n                    else:\n                        line.append(format_value(row[column.name],\n                                    array_format))\n            linewriter.writerow(line)\n        if close_file:\n            fileobj.close()"},{"attributeType":"null","col":8,"comment":"null","endLoc":985,"id":2318,"name":"diff_dimensions","nodeType":"Attribute","startLoc":985,"text":"self.diff_dimensions"},{"className":"RawDataDiff","col":0,"comment":"\n    `RawDataDiff` is just a special case of `ImageDataDiff` where the images\n    are one-dimensional, and the data is treated as a 1-dimensional array of\n    bytes instead of pixel values.  This is used to compare the data of two\n    non-standard extension HDUs that were not recognized as containing image or\n    table data.\n\n    `ImageDataDiff` objects have the following diff attributes:\n\n    - ``diff_dimensions``: Same as the ``diff_dimensions`` attribute of\n      `ImageDataDiff` objects. Though the \"dimension\" of each array is just an\n      integer representing the number of bytes in the data.\n\n    - ``diff_bytes``: Like the ``diff_pixels`` attribute of `ImageDataDiff`\n      objects, but renamed to reflect the minor semantic difference that these\n      are raw bytes and not pixel values.  Also the indices are integers\n      instead of tuples.\n\n    - ``diff_total`` and ``diff_ratio``: Same as `ImageDataDiff`.\n    ","endLoc":1137,"id":2319,"nodeType":"Class","startLoc":1062,"text":"class RawDataDiff(ImageDataDiff):\n    \"\"\"\n    `RawDataDiff` is just a special case of `ImageDataDiff` where the images\n    are one-dimensional, and the data is treated as a 1-dimensional array of\n    bytes instead of pixel values.  This is used to compare the data of two\n    non-standard extension HDUs that were not recognized as containing image or\n    table data.\n\n    `ImageDataDiff` objects have the following diff attributes:\n\n    - ``diff_dimensions``: Same as the ``diff_dimensions`` attribute of\n      `ImageDataDiff` objects. Though the \"dimension\" of each array is just an\n      integer representing the number of bytes in the data.\n\n    - ``diff_bytes``: Like the ``diff_pixels`` attribute of `ImageDataDiff`\n      objects, but renamed to reflect the minor semantic difference that these\n      are raw bytes and not pixel values.  Also the indices are integers\n      instead of tuples.\n\n    - ``diff_total`` and ``diff_ratio``: Same as `ImageDataDiff`.\n    \"\"\"\n\n    def __init__(self, a, b, numdiffs=10):\n        \"\"\"\n        Parameters\n        ----------\n        a : BaseHDU\n            An HDU object.\n\n        b : BaseHDU\n            An HDU object to compare to the first HDU object.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n        \"\"\"\n\n        self.diff_dimensions = ()\n        self.diff_bytes = []\n\n        super().__init__(a, b, numdiffs=numdiffs)\n\n    def _diff(self):\n        super()._diff()\n        if self.diff_dimensions:\n            self.diff_dimensions = (self.diff_dimensions[0][0],\n                                    self.diff_dimensions[1][0])\n\n        self.diff_bytes = [(x[0], y) for x, y in self.diff_pixels]\n        del self.diff_pixels\n\n    def _report(self):\n        if self.diff_dimensions:\n            self._writeln(' Data sizes differ:')\n            self._writeln(f'  a: {self.diff_dimensions[0]} bytes')\n            self._writeln(f'  b: {self.diff_dimensions[1]} bytes')\n            # For now we don't do any further comparison if the dimensions\n            # differ; though in the future it might be nice to be able to\n            # compare at least where the images intersect\n            self._writeln(' No further data comparison performed.')\n            return\n\n        if not self.diff_bytes:\n            return\n\n        for index, values in self.diff_bytes:\n            self._writeln(f' Data differs at byte {index}:')\n            report_diff_values(values[0], values[1], fileobj=self._fileobj,\n                               indent_width=self._indent + 1)\n\n        self._writeln(' ...')\n        self._writeln(' {} different bytes found ({:.2%} different).'\n                      .format(self.diff_total, self.diff_ratio))"},{"col":4,"comment":"\n        Parameters\n        ----------\n        a : BaseHDU\n            An HDU object.\n\n        b : BaseHDU\n            An HDU object to compare to the first HDU object.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n        ","endLoc":1105,"header":"def __init__(self, a, b, numdiffs=10)","id":2320,"name":"__init__","nodeType":"Function","startLoc":1084,"text":"def __init__(self, a, b, numdiffs=10):\n        \"\"\"\n        Parameters\n        ----------\n        a : BaseHDU\n            An HDU object.\n\n        b : BaseHDU\n            An HDU object to compare to the first HDU object.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n        \"\"\"\n\n        self.diff_dimensions = ()\n        self.diff_bytes = []\n\n        super().__init__(a, b, numdiffs=numdiffs)"},{"col":4,"comment":"null","endLoc":1114,"header":"def _diff(self)","id":2321,"name":"_diff","nodeType":"Function","startLoc":1107,"text":"def _diff(self):\n        super()._diff()\n        if self.diff_dimensions:\n            self.diff_dimensions = (self.diff_dimensions[0][0],\n                                    self.diff_dimensions[1][0])\n\n        self.diff_bytes = [(x[0], y) for x, y in self.diff_pixels]\n        del self.diff_pixels"},{"col":4,"comment":"null","endLoc":1137,"header":"def _report(self)","id":2322,"name":"_report","nodeType":"Function","startLoc":1116,"text":"def _report(self):\n        if self.diff_dimensions:\n            self._writeln(' Data sizes differ:')\n            self._writeln(f'  a: {self.diff_dimensions[0]} bytes')\n            self._writeln(f'  b: {self.diff_dimensions[1]} bytes')\n            # For now we don't do any further comparison if the dimensions\n            # differ; though in the future it might be nice to be able to\n            # compare at least where the images intersect\n            self._writeln(' No further data comparison performed.')\n            return\n\n        if not self.diff_bytes:\n            return\n\n        for index, values in self.diff_bytes:\n            self._writeln(f' Data differs at byte {index}:')\n            report_diff_values(values[0], values[1], fileobj=self._fileobj,\n                               indent_width=self._indent + 1)\n\n        self._writeln(' ...')\n        self._writeln(' {} different bytes found ({:.2%} different).'\n                      .format(self.diff_total, self.diff_ratio))"},{"col":4,"comment":"The class used for part of this frame's data.\n\n        Parameters\n        ----------\n        which : ('base', 's', `None`)\n            The class of which part to return.  'base' means the class used to\n            represent the coordinates; 's' the first derivative to time, i.e.,\n            the class representing the proper motion and/or radial velocity.\n            If `None`, return a dict with both.\n\n        Returns\n        -------\n        representation : `~astropy.coordinates.BaseRepresentation` or `~astropy.coordinates.BaseDifferential`.\n        ","endLoc":718,"header":"def get_representation_cls(self, which='base')","id":2323,"name":"get_representation_cls","nodeType":"Function","startLoc":700,"text":"def get_representation_cls(self, which='base'):\n        \"\"\"The class used for part of this frame's data.\n\n        Parameters\n        ----------\n        which : ('base', 's', `None`)\n            The class of which part to return.  'base' means the class used to\n            represent the coordinates; 's' the first derivative to time, i.e.,\n            the class representing the proper motion and/or radial velocity.\n            If `None`, return a dict with both.\n\n        Returns\n        -------\n        representation : `~astropy.coordinates.BaseRepresentation` or `~astropy.coordinates.BaseDifferential`.\n        \"\"\"\n        if which is not None:\n            return self._representation[which]\n        else:\n            return self._representation"},{"col":4,"comment":"null","endLoc":2020,"header":"@property\n    def colnames(self)","id":2324,"name":"colnames","nodeType":"Function","startLoc":2018,"text":"@property\n    def colnames(self):\n        return list(self.columns.keys())"},{"col":4,"comment":"null","endLoc":2029,"header":"def keys(self)","id":2325,"name":"keys","nodeType":"Function","startLoc":2028,"text":"def keys(self):\n        return list(self.columns.keys())"},{"col":4,"comment":"null","endLoc":2032,"header":"def values(self)","id":2326,"name":"values","nodeType":"Function","startLoc":2031,"text":"def values(self):\n        return self.columns.values()"},{"col":4,"comment":"null","endLoc":2035,"header":"def items(self)","id":2327,"name":"items","nodeType":"Function","startLoc":2034,"text":"def items(self):\n        return self.columns.items()"},{"col":4,"comment":"null","endLoc":2050,"header":"def __len__(self)","id":2329,"name":"__len__","nodeType":"Function","startLoc":2037,"text":"def __len__(self):\n        # For performance reasons (esp. in Row) cache the first column name\n        # and use that subsequently for the table length.  If might not be\n        # available yet or the column might be gone now, in which case\n        # try again in the except block.\n        try:\n            return len(OrderedDict.__getitem__(self.columns, self._first_colname))\n        except (AttributeError, KeyError):\n            if len(self.columns) == 0:\n                return 0\n\n            # Get the first column name\n            self._first_colname = next(iter(self.columns))\n            return len(self.columns[self._first_colname])"},{"col":4,"comment":"\n        Return the positional index of column ``name``.\n\n        Parameters\n        ----------\n        name : str\n            column name\n\n        Returns\n        -------\n        index : int\n            Positional index of column ``name``.\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Get index of column 'b' of the table::\n\n            >>> t.index_column('b')\n            1\n        ","endLoc":2087,"header":"def index_column(self, name)","id":2330,"name":"index_column","nodeType":"Function","startLoc":2052,"text":"def index_column(self, name):\n        \"\"\"\n        Return the positional index of column ``name``.\n\n        Parameters\n        ----------\n        name : str\n            column name\n\n        Returns\n        -------\n        index : int\n            Positional index of column ``name``.\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Get index of column 'b' of the table::\n\n            >>> t.index_column('b')\n            1\n        \"\"\"\n        try:\n            return self.colnames.index(name)\n        except ValueError:\n            raise ValueError(f\"Column {name} does not exist\")"},{"col":4,"comment":"\n        Add a list of new columns the table using ``cols`` data objects.  If a\n        corresponding list of ``indexes`` is supplied then insert column\n        before each ``index`` position in the *original* list of columns,\n        otherwise append columns to the end of the list.\n\n        The ``cols`` input can include any data objects which are acceptable as\n        `~astropy.table.Table` column objects or can be converted.  This includes\n        mixin columns and scalar or length=1 objects which get broadcast to match\n        the table length.\n\n        From a performance perspective there is little difference between calling\n        this method once or looping over the new columns and calling ``add_column()``\n        for each column.\n\n        Parameters\n        ----------\n        cols : list of object\n            List of data objects for the new columns\n        indexes : list of int or None\n            Insert column before this position or at end (default).\n        names : list of str\n            Column names\n        copy : bool\n            Make a copy of the new columns. Default is True.\n        rename_duplicate : bool\n            Uniquify new column names if they duplicate the existing ones.\n            Default is False.\n\n        See Also\n        --------\n        astropy.table.hstack, update, replace_column\n\n        Examples\n        --------\n        Create a table with two columns 'a' and 'b', then create columns 'c' and 'd'\n        and append them to the end of the table::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> col_c = Column(name='c', data=['x', 'y'])\n            >>> col_d = Column(name='d', data=['u', 'v'])\n            >>> t.add_columns([col_c, col_d])\n            >>> print(t)\n             a   b   c   d\n            --- --- --- ---\n              1 0.1   x   u\n              2 0.2   y   v\n\n        Add column 'c' at position 0 and column 'd' at position 1. Note that\n        the columns are inserted before the given position::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> t.add_columns([['x', 'y'], ['u', 'v']], names=['c', 'd'],\n            ...               indexes=[0, 1])\n            >>> print(t)\n             c   a   d   b\n            --- --- --- ---\n              x   1   u 0.1\n              y   2   v 0.2\n\n        Add second column 'b' and column 'c' with ``rename_duplicate``::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> t.add_columns([[1.1, 1.2], ['x', 'y']], names=('b', 'c'),\n            ...               rename_duplicate=True)\n            >>> print(t)\n             a   b  b_1  c\n            --- --- --- ---\n              1 0.1 1.1  x\n              2 0.2 1.2  y\n\n        Add unnamed columns or mixin objects in the table using default names\n        or by specifying explicit names with ``names``. Names can also be overridden::\n\n            >>> t = Table()\n            >>> col_b = Column(name='b', data=['u', 'v'])\n            >>> t.add_columns([[1, 2], col_b])\n            >>> t.add_columns([[3, 4], col_b], names=['c', 'd'])\n            >>> print(t)\n            col0  b   c   d\n            ---- --- --- ---\n               1   u   3   u\n               2   v   4   v\n        ","endLoc":2324,"header":"def add_columns(self, cols, indexes=None, names=None, copy=True, rename_duplicate=False)","id":2331,"name":"add_columns","nodeType":"Function","startLoc":2223,"text":"def add_columns(self, cols, indexes=None, names=None, copy=True, rename_duplicate=False):\n        \"\"\"\n        Add a list of new columns the table using ``cols`` data objects.  If a\n        corresponding list of ``indexes`` is supplied then insert column\n        before each ``index`` position in the *original* list of columns,\n        otherwise append columns to the end of the list.\n\n        The ``cols`` input can include any data objects which are acceptable as\n        `~astropy.table.Table` column objects or can be converted.  This includes\n        mixin columns and scalar or length=1 objects which get broadcast to match\n        the table length.\n\n        From a performance perspective there is little difference between calling\n        this method once or looping over the new columns and calling ``add_column()``\n        for each column.\n\n        Parameters\n        ----------\n        cols : list of object\n            List of data objects for the new columns\n        indexes : list of int or None\n            Insert column before this position or at end (default).\n        names : list of str\n            Column names\n        copy : bool\n            Make a copy of the new columns. Default is True.\n        rename_duplicate : bool\n            Uniquify new column names if they duplicate the existing ones.\n            Default is False.\n\n        See Also\n        --------\n        astropy.table.hstack, update, replace_column\n\n        Examples\n        --------\n        Create a table with two columns 'a' and 'b', then create columns 'c' and 'd'\n        and append them to the end of the table::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> col_c = Column(name='c', data=['x', 'y'])\n            >>> col_d = Column(name='d', data=['u', 'v'])\n            >>> t.add_columns([col_c, col_d])\n            >>> print(t)\n             a   b   c   d\n            --- --- --- ---\n              1 0.1   x   u\n              2 0.2   y   v\n\n        Add column 'c' at position 0 and column 'd' at position 1. Note that\n        the columns are inserted before the given position::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> t.add_columns([['x', 'y'], ['u', 'v']], names=['c', 'd'],\n            ...               indexes=[0, 1])\n            >>> print(t)\n             c   a   d   b\n            --- --- --- ---\n              x   1   u 0.1\n              y   2   v 0.2\n\n        Add second column 'b' and column 'c' with ``rename_duplicate``::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> t.add_columns([[1.1, 1.2], ['x', 'y']], names=('b', 'c'),\n            ...               rename_duplicate=True)\n            >>> print(t)\n             a   b  b_1  c\n            --- --- --- ---\n              1 0.1 1.1  x\n              2 0.2 1.2  y\n\n        Add unnamed columns or mixin objects in the table using default names\n        or by specifying explicit names with ``names``. Names can also be overridden::\n\n            >>> t = Table()\n            >>> col_b = Column(name='b', data=['u', 'v'])\n            >>> t.add_columns([[1, 2], col_b])\n            >>> t.add_columns([[3, 4], col_b], names=['c', 'd'])\n            >>> print(t)\n            col0  b   c   d\n            ---- --- --- ---\n               1   u   3   u\n               2   v   4   v\n        \"\"\"\n        if indexes is None:\n            indexes = [len(self.columns)] * len(cols)\n        elif len(indexes) != len(cols):\n            raise ValueError('Number of indexes must match number of cols')\n\n        if names is None:\n            names = (None,) * len(cols)\n        elif len(names) != len(cols):\n            raise ValueError('Number of names must match number of cols')\n\n        default_names = [f'col{ii + len(self.columns)}'\n                         for ii in range(len(cols))]\n\n        for ii in reversed(np.argsort(indexes)):\n            self.add_column(cols[ii], index=indexes[ii], name=names[ii],\n                            default_name=default_names[ii],\n                            rename_duplicate=rename_duplicate, copy=copy)"},{"col":4,"comment":"\n        Write the column definition parameters in the ASCII format read by\n        BinTableHDU.load() to fileobj.\n        ","endLoc":1302,"header":"def _dump_coldefs(self, fileobj)","id":2332,"name":"_dump_coldefs","nodeType":"Function","startLoc":1279,"text":"def _dump_coldefs(self, fileobj):\n        \"\"\"\n        Write the column definition parameters in the ASCII format read by\n        BinTableHDU.load() to fileobj.\n        \"\"\"\n\n        close_file = False\n\n        if isinstance(fileobj, str):\n            fileobj = open(fileobj, 'w')\n            close_file = True\n\n        # Process each column of the table and output the result to the\n        # file one at a time\n        for column in self.columns:\n            line = [column.name, column.format]\n            attrs = ['disp', 'unit', 'dim', 'null', 'bscale', 'bzero']\n            line += ['{!s:16s}'.format(value if value else '\"\"')\n                     for value in (getattr(column, attr) for attr in attrs)]\n            fileobj.write(' '.join(line))\n            fileobj.write('\\n')\n\n        if close_file:\n            fileobj.close()"},{"col":4,"comment":"null","endLoc":825,"header":"def get_representation_component_names(self, which='base')","id":2333,"name":"get_representation_component_names","nodeType":"Function","startLoc":816,"text":"def get_representation_component_names(self, which='base'):\n        out = {}\n        repr_or_diff_cls = self.get_representation_cls(which)\n        if repr_or_diff_cls is None:\n            return out\n        data_names = repr_or_diff_cls.attr_classes.keys()\n        repr_names = self.representation_info[repr_or_diff_cls]['names']\n        for repr_name, data_name in zip(repr_names, data_names):\n            out[repr_name] = data_name\n        return out"},{"attributeType":"null","col":8,"comment":"null","endLoc":1102,"id":2334,"name":"diff_dimensions","nodeType":"Attribute","startLoc":1102,"text":"self.diff_dimensions"},{"attributeType":"null","col":8,"comment":"null","endLoc":1103,"id":2335,"name":"diff_bytes","nodeType":"Attribute","startLoc":1103,"text":"self.diff_bytes"},{"className":"TableDataDiff","col":0,"comment":"\n    Diff two table data arrays. It doesn't matter whether the data originally\n    came from a binary or ASCII table--the data should be passed in as a\n    recarray.\n\n    `TableDataDiff` objects have the following diff attributes:\n\n    - ``diff_column_count``: If the tables being compared have different\n      numbers of columns, this contains a 2-tuple of the column count in each\n      table.  Even if the tables have different column counts, an attempt is\n      still made to compare any columns they have in common.\n\n    - ``diff_columns``: If either table contains columns unique to that table,\n      either in name or format, this contains a 2-tuple of lists. The first\n      element is a list of columns (these are full `Column` objects) that\n      appear only in table a.  The second element is a list of tables that\n      appear only in table b.  This only lists columns with different column\n      definitions, and has nothing to do with the data in those columns.\n\n    - ``diff_column_names``: This is like ``diff_columns``, but lists only the\n      names of columns unique to either table, rather than the full `Column`\n      objects.\n\n    - ``diff_column_attributes``: Lists columns that are in both tables but\n      have different secondary attributes, such as TUNIT or TDISP.  The format\n      is a list of 2-tuples: The first a tuple of the column name and the\n      attribute, the second a tuple of the different values.\n\n    - ``diff_values``: `TableDataDiff` compares the data in each table on a\n      column-by-column basis.  If any different data is found, it is added to\n      this list.  The format of this list is similar to the ``diff_pixels``\n      attribute on `ImageDataDiff` objects, though the \"index\" consists of a\n      (column_name, row) tuple.  For example::\n\n          [('TARGET', 0), ('NGC1001', 'NGC1002')]\n\n      shows that the tables contain different values in the 0-th row of the\n      'TARGET' column.\n\n    - ``diff_total`` and ``diff_ratio``: Same as `ImageDataDiff`.\n\n    `TableDataDiff` objects also have a ``common_columns`` attribute that lists\n    the `Column` objects for columns that are identical in both tables, and a\n    ``common_column_names`` attribute which contains a set of the names of\n    those columns.\n    ","endLoc":1447,"id":2336,"nodeType":"Class","startLoc":1140,"text":"class TableDataDiff(_BaseDiff):\n    \"\"\"\n    Diff two table data arrays. It doesn't matter whether the data originally\n    came from a binary or ASCII table--the data should be passed in as a\n    recarray.\n\n    `TableDataDiff` objects have the following diff attributes:\n\n    - ``diff_column_count``: If the tables being compared have different\n      numbers of columns, this contains a 2-tuple of the column count in each\n      table.  Even if the tables have different column counts, an attempt is\n      still made to compare any columns they have in common.\n\n    - ``diff_columns``: If either table contains columns unique to that table,\n      either in name or format, this contains a 2-tuple of lists. The first\n      element is a list of columns (these are full `Column` objects) that\n      appear only in table a.  The second element is a list of tables that\n      appear only in table b.  This only lists columns with different column\n      definitions, and has nothing to do with the data in those columns.\n\n    - ``diff_column_names``: This is like ``diff_columns``, but lists only the\n      names of columns unique to either table, rather than the full `Column`\n      objects.\n\n    - ``diff_column_attributes``: Lists columns that are in both tables but\n      have different secondary attributes, such as TUNIT or TDISP.  The format\n      is a list of 2-tuples: The first a tuple of the column name and the\n      attribute, the second a tuple of the different values.\n\n    - ``diff_values``: `TableDataDiff` compares the data in each table on a\n      column-by-column basis.  If any different data is found, it is added to\n      this list.  The format of this list is similar to the ``diff_pixels``\n      attribute on `ImageDataDiff` objects, though the \"index\" consists of a\n      (column_name, row) tuple.  For example::\n\n          [('TARGET', 0), ('NGC1001', 'NGC1002')]\n\n      shows that the tables contain different values in the 0-th row of the\n      'TARGET' column.\n\n    - ``diff_total`` and ``diff_ratio``: Same as `ImageDataDiff`.\n\n    `TableDataDiff` objects also have a ``common_columns`` attribute that lists\n    the `Column` objects for columns that are identical in both tables, and a\n    ``common_column_names`` attribute which contains a set of the names of\n    those columns.\n    \"\"\"\n\n    def __init__(self, a, b, ignore_fields=[], numdiffs=10, rtol=0.0, atol=0.0):\n        \"\"\"\n        Parameters\n        ----------\n        a : BaseHDU\n            An HDU object.\n\n        b : BaseHDU\n            An HDU object to compare to the first HDU object.\n\n        ignore_fields : sequence, optional\n            The (case-insensitive) names of any table columns to ignore if any\n            table data is to be compared.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\\\left| a - b \\\\right| > \\\\text{atol} + \\\\text{rtol} \\\\cdot \\\\left| b \\\\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n        \"\"\"\n\n        self.ignore_fields = set(ignore_fields)\n        self.numdiffs = numdiffs\n        self.rtol = rtol\n        self.atol = atol\n\n        self.common_columns = []\n        self.common_column_names = set()\n\n        # self.diff_columns contains columns with different column definitions,\n        # but not different column data. Column data is only compared in\n        # columns that have the same definitions\n        self.diff_rows = ()\n        self.diff_column_count = ()\n        self.diff_columns = ()\n\n        # If two columns have the same name+format, but other attributes are\n        # different (such as TUNIT or such) they are listed here\n        self.diff_column_attributes = []\n\n        # Like self.diff_columns, but just contains a list of the column names\n        # unique to each table, and in the order they appear in the tables\n        self.diff_column_names = ()\n        self.diff_values = []\n\n        self.diff_ratio = 0\n        self.diff_total = 0\n\n        super().__init__(a, b)\n\n    def _diff(self):\n        # Much of the code for comparing columns is similar to the code for\n        # comparing headers--consider refactoring\n        colsa = self.a.columns\n        colsb = self.b.columns\n\n        if len(colsa) != len(colsb):\n            self.diff_column_count = (len(colsa), len(colsb))\n\n        # Even if the number of columns are unequal, we still do comparison of\n        # any common columns\n        colsa = {c.name.lower(): c for c in colsa}\n        colsb = {c.name.lower(): c for c in colsb}\n\n        if '*' in self.ignore_fields:\n            # If all columns are to be ignored, ignore any further differences\n            # between the columns\n            return\n\n        # Keep the user's original ignore_fields list for reporting purposes,\n        # but internally use a case-insensitive version\n        ignore_fields = {f.lower() for f in self.ignore_fields}\n\n        # It might be nice if there were a cleaner way to do this, but for now\n        # it'll do\n        for fieldname in ignore_fields:\n            fieldname = fieldname.lower()\n            if fieldname in colsa:\n                del colsa[fieldname]\n            if fieldname in colsb:\n                del colsb[fieldname]\n\n        colsa_set = set(colsa.values())\n        colsb_set = set(colsb.values())\n        self.common_columns = sorted(colsa_set.intersection(colsb_set),\n                                     key=operator.attrgetter('name'))\n\n        self.common_column_names = {col.name.lower()\n                                    for col in self.common_columns}\n\n        left_only_columns = {col.name.lower(): col\n                             for col in colsa_set.difference(colsb_set)}\n        right_only_columns = {col.name.lower(): col\n                              for col in colsb_set.difference(colsa_set)}\n\n        if left_only_columns or right_only_columns:\n            self.diff_columns = (left_only_columns, right_only_columns)\n            self.diff_column_names = ([], [])\n\n        if left_only_columns:\n            for col in self.a.columns:\n                if col.name.lower() in left_only_columns:\n                    self.diff_column_names[0].append(col.name)\n\n        if right_only_columns:\n            for col in self.b.columns:\n                if col.name.lower() in right_only_columns:\n                    self.diff_column_names[1].append(col.name)\n\n        # If the tables have a different number of rows, we don't compare the\n        # columns right now.\n        # TODO: It might be nice to optionally compare the first n rows where n\n        # is the minimum of the row counts between the two tables.\n        if len(self.a) != len(self.b):\n            self.diff_rows = (len(self.a), len(self.b))\n            return\n\n        # If the tables contain no rows there's no data to compare, so we're\n        # done at this point. (See ticket #178)\n        if len(self.a) == len(self.b) == 0:\n            return\n\n        # Like in the old fitsdiff, compare tables on a column by column basis\n        # The difficulty here is that, while FITS column names are meant to be\n        # case-insensitive, Astropy still allows, for the sake of flexibility,\n        # two columns with the same name but different case.  When columns are\n        # accessed in FITS tables, a case-sensitive is tried first, and failing\n        # that a case-insensitive match is made.\n        # It's conceivable that the same column could appear in both tables\n        # being compared, but with different case.\n        # Though it *may* lead to inconsistencies in these rare cases, this\n        # just assumes that there are no duplicated column names in either\n        # table, and that the column names can be treated case-insensitively.\n        for col in self.common_columns:\n            name_lower = col.name.lower()\n            if name_lower in ignore_fields:\n                continue\n\n            cola = colsa[name_lower]\n            colb = colsb[name_lower]\n\n            for attr, _ in _COL_ATTRS:\n                vala = getattr(cola, attr, None)\n                valb = getattr(colb, attr, None)\n                if diff_values(vala, valb):\n                    self.diff_column_attributes.append(\n                        ((col.name.upper(), attr), (vala, valb)))\n\n            arra = self.a[col.name]\n            arrb = self.b[col.name]\n\n            if (np.issubdtype(arra.dtype, np.floating) and\n                    np.issubdtype(arrb.dtype, np.floating)):\n                diffs = where_not_allclose(arra, arrb,\n                                           rtol=self.rtol,\n                                           atol=self.atol)\n            elif 'P' in col.format:\n                diffs = ([idx for idx in range(len(arra))\n                          if not np.allclose(arra[idx], arrb[idx],\n                                             rtol=self.rtol,\n                                             atol=self.atol)],)\n            else:\n                diffs = np.where(arra != arrb)\n\n            self.diff_total += len(set(diffs[0]))\n\n            if self.numdiffs >= 0:\n                if len(self.diff_values) >= self.numdiffs:\n                    # Don't save any more diff values\n                    continue\n\n                # Add no more diff'd values than this\n                max_diffs = self.numdiffs - len(self.diff_values)\n            else:\n                max_diffs = len(diffs[0])\n\n            last_seen_idx = None\n            for idx in islice(diffs[0], 0, max_diffs):\n                if idx == last_seen_idx:\n                    # Skip duplicate indices, which my occur when the column\n                    # data contains multi-dimensional values; we're only\n                    # interested in storing row-by-row differences\n                    continue\n                last_seen_idx = idx\n                self.diff_values.append(((col.name, idx),\n                                         (arra[idx], arrb[idx])))\n\n        total_values = len(self.a) * len(self.a.dtype.fields)\n        self.diff_ratio = float(self.diff_total) / float(total_values)\n\n    def _report(self):\n        if self.diff_column_count:\n            self._writeln(' Tables have different number of columns:')\n            self._writeln(f'  a: {self.diff_column_count[0]}')\n            self._writeln(f'  b: {self.diff_column_count[1]}')\n\n        if self.diff_column_names:\n            # Show columns with names unique to either table\n            for name in self.diff_column_names[0]:\n                format = self.diff_columns[0][name.lower()].format\n                self._writeln(f' Extra column {name} of format {format} in a')\n            for name in self.diff_column_names[1]:\n                format = self.diff_columns[1][name.lower()].format\n                self._writeln(f' Extra column {name} of format {format} in b')\n\n        col_attrs = dict(_COL_ATTRS)\n        # Now go through each table again and show columns with common\n        # names but other property differences...\n        for col_attr, vals in self.diff_column_attributes:\n            name, attr = col_attr\n            self._writeln(f' Column {name} has different {col_attrs[attr]}:')\n            report_diff_values(vals[0], vals[1], fileobj=self._fileobj,\n                               indent_width=self._indent + 1)\n\n        if self.diff_rows:\n            self._writeln(' Table rows differ:')\n            self._writeln(f'  a: {self.diff_rows[0]}')\n            self._writeln(f'  b: {self.diff_rows[1]}')\n            self._writeln(' No further data comparison performed.')\n            return\n\n        if not self.diff_values:\n            return\n\n        # Finally, let's go through and report column data differences:\n        for indx, values in self.diff_values:\n            self._writeln(' Column {} data differs in row {}:'.format(*indx))\n            report_diff_values(values[0], values[1], fileobj=self._fileobj,\n                               indent_width=self._indent + 1)\n\n        if self.diff_values and self.numdiffs < self.diff_total:\n            self._writeln(' ...{} additional difference(s) found.'.format(\n                                self.diff_total - self.numdiffs))\n\n        if self.diff_total > self.numdiffs:\n            self._writeln(' ...')\n\n        self._writeln(' {} different table data element(s) found '\n                      '({:.2%} different).'\n                      .format(self.diff_total, self.diff_ratio))"},{"col":4,"comment":"\n        Parameters\n        ----------\n        a : BaseHDU\n            An HDU object.\n\n        b : BaseHDU\n            An HDU object to compare to the first HDU object.\n\n        ignore_fields : sequence, optional\n            The (case-insensitive) names of any table columns to ignore if any\n            table data is to be compared.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\left| a - b \\right| > \\text{atol} + \\text{rtol} \\cdot \\left| b \\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n        ","endLoc":1256,"header":"def __init__(self, a, b, ignore_fields=[], numdiffs=10, rtol=0.0, atol=0.0)","id":2337,"name":"__init__","nodeType":"Function","startLoc":1188,"text":"def __init__(self, a, b, ignore_fields=[], numdiffs=10, rtol=0.0, atol=0.0):\n        \"\"\"\n        Parameters\n        ----------\n        a : BaseHDU\n            An HDU object.\n\n        b : BaseHDU\n            An HDU object to compare to the first HDU object.\n\n        ignore_fields : sequence, optional\n            The (case-insensitive) names of any table columns to ignore if any\n            table data is to be compared.\n\n        numdiffs : int, optional\n            The number of pixel/table values to output when reporting HDU data\n            differences.  Though the count of differences is the same either\n            way, this allows controlling the number of different values that\n            are kept in memory or output.  If a negative value is given, then\n            numdiffs is treated as unlimited (default: 10).\n\n        rtol : float, optional\n            The relative difference to allow when comparing two float values\n            either in header values, image arrays, or table columns\n            (default: 0.0). Values which satisfy the expression\n\n            .. math::\n\n                \\\\left| a - b \\\\right| > \\\\text{atol} + \\\\text{rtol} \\\\cdot \\\\left| b \\\\right|\n\n            are considered to be different.\n            The underlying function used for comparison is `numpy.allclose`.\n\n            .. versionadded:: 2.0\n\n        atol : float, optional\n            The allowed absolute difference. See also ``rtol`` parameter.\n\n            .. versionadded:: 2.0\n        \"\"\"\n\n        self.ignore_fields = set(ignore_fields)\n        self.numdiffs = numdiffs\n        self.rtol = rtol\n        self.atol = atol\n\n        self.common_columns = []\n        self.common_column_names = set()\n\n        # self.diff_columns contains columns with different column definitions,\n        # but not different column data. Column data is only compared in\n        # columns that have the same definitions\n        self.diff_rows = ()\n        self.diff_column_count = ()\n        self.diff_columns = ()\n\n        # If two columns have the same name+format, but other attributes are\n        # different (such as TUNIT or such) they are listed here\n        self.diff_column_attributes = []\n\n        # Like self.diff_columns, but just contains a list of the column names\n        # unique to each table, and in the order they appear in the tables\n        self.diff_column_names = ()\n        self.diff_values = []\n\n        self.diff_ratio = 0\n        self.diff_total = 0\n\n        super().__init__(a, b)"},{"col":4,"comment":"null","endLoc":1396,"header":"def _diff(self)","id":2338,"name":"_diff","nodeType":"Function","startLoc":1258,"text":"def _diff(self):\n        # Much of the code for comparing columns is similar to the code for\n        # comparing headers--consider refactoring\n        colsa = self.a.columns\n        colsb = self.b.columns\n\n        if len(colsa) != len(colsb):\n            self.diff_column_count = (len(colsa), len(colsb))\n\n        # Even if the number of columns are unequal, we still do comparison of\n        # any common columns\n        colsa = {c.name.lower(): c for c in colsa}\n        colsb = {c.name.lower(): c for c in colsb}\n\n        if '*' in self.ignore_fields:\n            # If all columns are to be ignored, ignore any further differences\n            # between the columns\n            return\n\n        # Keep the user's original ignore_fields list for reporting purposes,\n        # but internally use a case-insensitive version\n        ignore_fields = {f.lower() for f in self.ignore_fields}\n\n        # It might be nice if there were a cleaner way to do this, but for now\n        # it'll do\n        for fieldname in ignore_fields:\n            fieldname = fieldname.lower()\n            if fieldname in colsa:\n                del colsa[fieldname]\n            if fieldname in colsb:\n                del colsb[fieldname]\n\n        colsa_set = set(colsa.values())\n        colsb_set = set(colsb.values())\n        self.common_columns = sorted(colsa_set.intersection(colsb_set),\n                                     key=operator.attrgetter('name'))\n\n        self.common_column_names = {col.name.lower()\n                                    for col in self.common_columns}\n\n        left_only_columns = {col.name.lower(): col\n                             for col in colsa_set.difference(colsb_set)}\n        right_only_columns = {col.name.lower(): col\n                              for col in colsb_set.difference(colsa_set)}\n\n        if left_only_columns or right_only_columns:\n            self.diff_columns = (left_only_columns, right_only_columns)\n            self.diff_column_names = ([], [])\n\n        if left_only_columns:\n            for col in self.a.columns:\n                if col.name.lower() in left_only_columns:\n                    self.diff_column_names[0].append(col.name)\n\n        if right_only_columns:\n            for col in self.b.columns:\n                if col.name.lower() in right_only_columns:\n                    self.diff_column_names[1].append(col.name)\n\n        # If the tables have a different number of rows, we don't compare the\n        # columns right now.\n        # TODO: It might be nice to optionally compare the first n rows where n\n        # is the minimum of the row counts between the two tables.\n        if len(self.a) != len(self.b):\n            self.diff_rows = (len(self.a), len(self.b))\n            return\n\n        # If the tables contain no rows there's no data to compare, so we're\n        # done at this point. (See ticket #178)\n        if len(self.a) == len(self.b) == 0:\n            return\n\n        # Like in the old fitsdiff, compare tables on a column by column basis\n        # The difficulty here is that, while FITS column names are meant to be\n        # case-insensitive, Astropy still allows, for the sake of flexibility,\n        # two columns with the same name but different case.  When columns are\n        # accessed in FITS tables, a case-sensitive is tried first, and failing\n        # that a case-insensitive match is made.\n        # It's conceivable that the same column could appear in both tables\n        # being compared, but with different case.\n        # Though it *may* lead to inconsistencies in these rare cases, this\n        # just assumes that there are no duplicated column names in either\n        # table, and that the column names can be treated case-insensitively.\n        for col in self.common_columns:\n            name_lower = col.name.lower()\n            if name_lower in ignore_fields:\n                continue\n\n            cola = colsa[name_lower]\n            colb = colsb[name_lower]\n\n            for attr, _ in _COL_ATTRS:\n                vala = getattr(cola, attr, None)\n                valb = getattr(colb, attr, None)\n                if diff_values(vala, valb):\n                    self.diff_column_attributes.append(\n                        ((col.name.upper(), attr), (vala, valb)))\n\n            arra = self.a[col.name]\n            arrb = self.b[col.name]\n\n            if (np.issubdtype(arra.dtype, np.floating) and\n                    np.issubdtype(arrb.dtype, np.floating)):\n                diffs = where_not_allclose(arra, arrb,\n                                           rtol=self.rtol,\n                                           atol=self.atol)\n            elif 'P' in col.format:\n                diffs = ([idx for idx in range(len(arra))\n                          if not np.allclose(arra[idx], arrb[idx],\n                                             rtol=self.rtol,\n                                             atol=self.atol)],)\n            else:\n                diffs = np.where(arra != arrb)\n\n            self.diff_total += len(set(diffs[0]))\n\n            if self.numdiffs >= 0:\n                if len(self.diff_values) >= self.numdiffs:\n                    # Don't save any more diff values\n                    continue\n\n                # Add no more diff'd values than this\n                max_diffs = self.numdiffs - len(self.diff_values)\n            else:\n                max_diffs = len(diffs[0])\n\n            last_seen_idx = None\n            for idx in islice(diffs[0], 0, max_diffs):\n                if idx == last_seen_idx:\n                    # Skip duplicate indices, which my occur when the column\n                    # data contains multi-dimensional values; we're only\n                    # interested in storing row-by-row differences\n                    continue\n                last_seen_idx = idx\n                self.diff_values.append(((col.name, idx),\n                                         (arra[idx], arrb[idx])))\n\n        total_values = len(self.a) * len(self.a.dtype.fields)\n        self.diff_ratio = float(self.diff_total) / float(total_values)"},{"col":4,"comment":"\n        Create a table from the input ASCII files.  The input is from up to\n        three separate files, one containing column definitions, one containing\n        header parameters, and one containing column data.\n\n        The column definition and header parameters files are not required.\n        When absent the column definitions and/or header parameters are taken\n        from the header object given in the header argument; otherwise sensible\n        defaults are inferred (though this mode is not recommended).\n\n        Parameters\n        ----------\n        datafile : path-like or file-like\n            Input data file containing the table data in ASCII format.\n\n        cdfile : path-like or file-like, optional\n            Input column definition file containing the names,\n            formats, display formats, physical units, multidimensional\n            array dimensions, undefined values, scale factors, and\n            offsets associated with the columns in the table.  If\n            `None`, the column definitions are taken from the current\n            values in this object.\n\n        hfile : path-like or file-like, optional\n            Input parameter definition file containing the header\n            parameter definitions to be associated with the table.  If\n            `None`, the header parameter definitions are taken from\n            the current values in this objects header.\n\n        replace : bool, optional\n            When `True`, indicates that the entire header should be\n            replaced with the contents of the ASCII file instead of\n            just updating the current header.\n\n        header : `~astropy.io.fits.Header`, optional\n            When the cdfile and hfile are missing, use this Header object in\n            the creation of the new table and HDU.  Otherwise this Header\n            supersedes the keywords from hfile, which is only used to update\n            values not present in this Header, unless ``replace=True`` in which\n            this Header's values are completely replaced with the values from\n            hfile.\n\n        Notes\n        -----\n        The primary use for the `load` method is to allow the input of ASCII\n        data that was edited in a standard text editor of the table data and\n        parameters.  The `dump` method can be used to create the initial ASCII\n        files.\n        ","endLoc":1196,"header":"def load(cls, datafile, cdfile=None, hfile=None, replace=False,\n             header=None)","id":2339,"name":"load","nodeType":"Function","startLoc":1120,"text":"def load(cls, datafile, cdfile=None, hfile=None, replace=False,\n             header=None):\n        \"\"\"\n        Create a table from the input ASCII files.  The input is from up to\n        three separate files, one containing column definitions, one containing\n        header parameters, and one containing column data.\n\n        The column definition and header parameters files are not required.\n        When absent the column definitions and/or header parameters are taken\n        from the header object given in the header argument; otherwise sensible\n        defaults are inferred (though this mode is not recommended).\n\n        Parameters\n        ----------\n        datafile : path-like or file-like\n            Input data file containing the table data in ASCII format.\n\n        cdfile : path-like or file-like, optional\n            Input column definition file containing the names,\n            formats, display formats, physical units, multidimensional\n            array dimensions, undefined values, scale factors, and\n            offsets associated with the columns in the table.  If\n            `None`, the column definitions are taken from the current\n            values in this object.\n\n        hfile : path-like or file-like, optional\n            Input parameter definition file containing the header\n            parameter definitions to be associated with the table.  If\n            `None`, the header parameter definitions are taken from\n            the current values in this objects header.\n\n        replace : bool, optional\n            When `True`, indicates that the entire header should be\n            replaced with the contents of the ASCII file instead of\n            just updating the current header.\n\n        header : `~astropy.io.fits.Header`, optional\n            When the cdfile and hfile are missing, use this Header object in\n            the creation of the new table and HDU.  Otherwise this Header\n            supersedes the keywords from hfile, which is only used to update\n            values not present in this Header, unless ``replace=True`` in which\n            this Header's values are completely replaced with the values from\n            hfile.\n\n        Notes\n        -----\n        The primary use for the `load` method is to allow the input of ASCII\n        data that was edited in a standard text editor of the table data and\n        parameters.  The `dump` method can be used to create the initial ASCII\n        files.\n        \"\"\"\n\n        # Process the parameter file\n        if header is None:\n            header = Header()\n\n        if hfile:\n            if replace:\n                header = Header.fromtextfile(hfile)\n            else:\n                header.extend(Header.fromtextfile(hfile), update=True,\n                              update_first=True)\n\n        coldefs = None\n        # Process the column definitions file\n        if cdfile:\n            coldefs = cls._load_coldefs(cdfile)\n\n        # Process the data file\n        data = cls._load_data(datafile, coldefs)\n        if coldefs is None:\n            coldefs = ColDefs(data)\n\n        # Create a new HDU using the supplied header and data\n        hdu = cls(data=data, header=header)\n        hdu.columns = coldefs\n        return hdu"},{"col":4,"comment":"\n        Iterate over rows of table returning a tuple of values for each row.\n\n        This method is especially useful when only a subset of columns are needed.\n\n        The ``iterrows`` method can be substantially faster than using the standard\n        Table row iteration (e.g. ``for row in tbl:``), since that returns a new\n        ``~astropy.table.Row`` object for each row and accessing a column in that\n        row (e.g. ``row['col0']``) is slower than tuple access.\n\n        Parameters\n        ----------\n        names : list\n            List of column names (default to all columns if no names provided)\n\n        Returns\n        -------\n        rows : iterable\n            Iterator returns tuples of row values\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table({'a': [1, 2, 3],\n            ...            'b': [1.0, 2.5, 3.0],\n            ...            'c': ['x', 'y', 'z']})\n\n        To iterate row-wise using column names::\n\n            >>> for a, c in t.iterrows('a', 'c'):\n            ...     print(a, c)\n            1 x\n            2 y\n            3 z\n\n        ","endLoc":2580,"header":"def iterrows(self, *names)","id":2340,"name":"iterrows","nodeType":"Function","startLoc":2533,"text":"def iterrows(self, *names):\n        \"\"\"\n        Iterate over rows of table returning a tuple of values for each row.\n\n        This method is especially useful when only a subset of columns are needed.\n\n        The ``iterrows`` method can be substantially faster than using the standard\n        Table row iteration (e.g. ``for row in tbl:``), since that returns a new\n        ``~astropy.table.Row`` object for each row and accessing a column in that\n        row (e.g. ``row['col0']``) is slower than tuple access.\n\n        Parameters\n        ----------\n        names : list\n            List of column names (default to all columns if no names provided)\n\n        Returns\n        -------\n        rows : iterable\n            Iterator returns tuples of row values\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table({'a': [1, 2, 3],\n            ...            'b': [1.0, 2.5, 3.0],\n            ...            'c': ['x', 'y', 'z']})\n\n        To iterate row-wise using column names::\n\n            >>> for a, c in t.iterrows('a', 'c'):\n            ...     print(a, c)\n            1 x\n            2 y\n            3 z\n\n        \"\"\"\n        if len(names) == 0:\n            names = self.colnames\n        else:\n            for name in names:\n                if name not in self.colnames:\n                    raise ValueError(f'{name} is not a valid column name')\n\n        cols = (self[name] for name in names)\n        out = zip(*cols)\n        return out"},{"col":4,"comment":"\n        Convert string-like columns to/from bytestring and unicode (internal only).\n\n        Parameters\n        ----------\n        in_kind : str\n            Input dtype.kind\n        out_kind : str\n            Output dtype.kind\n        ","endLoc":2715,"header":"def _convert_string_dtype(self, in_kind, out_kind, encode_decode_func)","id":2341,"name":"_convert_string_dtype","nodeType":"Function","startLoc":2687,"text":"def _convert_string_dtype(self, in_kind, out_kind, encode_decode_func):\n        \"\"\"\n        Convert string-like columns to/from bytestring and unicode (internal only).\n\n        Parameters\n        ----------\n        in_kind : str\n            Input dtype.kind\n        out_kind : str\n            Output dtype.kind\n        \"\"\"\n\n        for col in self.itercols():\n            if col.dtype.kind == in_kind:\n                try:\n                    # This requires ASCII and is faster by a factor of up to ~8, so\n                    # try that first.\n                    newcol = col.__class__(col, dtype=out_kind)\n                except (UnicodeEncodeError, UnicodeDecodeError):\n                    newcol = col.__class__(encode_decode_func(col, 'utf-8'))\n\n                    # Quasi-manually copy info attributes.  Unfortunately\n                    # DataInfo.__set__ does not do the right thing in this case\n                    # so newcol.info = col.info does not get the old info attributes.\n                    for attr in col.info.attr_names - col.info._attrs_no_copy - set(['dtype']):\n                        value = deepcopy(getattr(col.info, attr))\n                        setattr(newcol.info, attr, value)\n\n                self[col.name] = newcol"},{"col":4,"comment":"\n        Convert bytestring columns (dtype.kind='S') to unicode (dtype.kind='U')\n        using UTF-8 encoding.\n\n        Internally this changes string columns to represent each character\n        in the string with a 4-byte UCS-4 equivalent, so it is inefficient\n        for memory but allows scripts to manipulate string arrays with\n        natural syntax.\n        ","endLoc":2727,"header":"def convert_bytestring_to_unicode(self)","id":2342,"name":"convert_bytestring_to_unicode","nodeType":"Function","startLoc":2717,"text":"def convert_bytestring_to_unicode(self):\n        \"\"\"\n        Convert bytestring columns (dtype.kind='S') to unicode (dtype.kind='U')\n        using UTF-8 encoding.\n\n        Internally this changes string columns to represent each character\n        in the string with a 4-byte UCS-4 equivalent, so it is inefficient\n        for memory but allows scripts to manipulate string arrays with\n        natural syntax.\n        \"\"\"\n        self._convert_string_dtype('S', 'U', np.char.decode)"},{"col":4,"comment":"\n        Convert unicode columns (dtype.kind='U') to bytestring (dtype.kind='S')\n        using UTF-8 encoding.\n\n        When exporting a unicode string array to a file, it may be desirable\n        to encode unicode columns as bytestrings.\n        ","endLoc":2737,"header":"def convert_unicode_to_bytestring(self)","id":2343,"name":"convert_unicode_to_bytestring","nodeType":"Function","startLoc":2729,"text":"def convert_unicode_to_bytestring(self):\n        \"\"\"\n        Convert unicode columns (dtype.kind='U') to bytestring (dtype.kind='S')\n        using UTF-8 encoding.\n\n        When exporting a unicode string array to a file, it may be desirable\n        to encode unicode columns as bytestrings.\n        \"\"\"\n        self._convert_string_dtype('U', 'S', np.char.encode)"},{"col":4,"comment":"null","endLoc":698,"header":"@classmethod\n    def get_frame_attr_names(cls)","id":2344,"name":"get_frame_attr_names","nodeType":"Function","startLoc":695,"text":"@classmethod\n    def get_frame_attr_names(cls):\n        return {name: getattr(cls, name)\n                for name in cls.frame_attributes}"},{"col":4,"comment":"\n        Keep only the columns specified (remove the others).\n\n        Parameters\n        ----------\n        names : str or iterable of str\n            The columns to keep. All other columns will be removed.\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3],[0.1, 0.2, 0.3],['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Keep only column 'a' of the table::\n\n            >>> t.keep_columns('a')\n            >>> print(t)\n             a\n            ---\n              1\n              2\n              3\n\n        Keep columns 'a' and 'c' of the table::\n\n            >>> t = Table([[1, 2, 3],[0.1, 0.2, 0.3],['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> t.keep_columns(['a', 'c'])\n            >>> print(t)\n             a   c\n            --- ---\n              1   x\n              2   y\n              3   z\n        ","endLoc":2786,"header":"def keep_columns(self, names)","id":2345,"name":"keep_columns","nodeType":"Function","startLoc":2739,"text":"def keep_columns(self, names):\n        '''\n        Keep only the columns specified (remove the others).\n\n        Parameters\n        ----------\n        names : str or iterable of str\n            The columns to keep. All other columns will be removed.\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3],[0.1, 0.2, 0.3],['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Keep only column 'a' of the table::\n\n            >>> t.keep_columns('a')\n            >>> print(t)\n             a\n            ---\n              1\n              2\n              3\n\n        Keep columns 'a' and 'c' of the table::\n\n            >>> t = Table([[1, 2, 3],[0.1, 0.2, 0.3],['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> t.keep_columns(['a', 'c'])\n            >>> print(t)\n             a   c\n            --- ---\n              1   x\n              2   y\n              3   z\n        '''\n        names = self._set_of_names_in_colnames(names)\n        for colname in self.colnames:\n            if colname not in names:\n                self.columns.pop(colname)"},{"col":4,"comment":"null","endLoc":1976,"header":"def _generate_dither_seed(self, seed)","id":2346,"name":"_generate_dither_seed","nodeType":"Function","startLoc":1935,"text":"def _generate_dither_seed(self, seed):\n        if not _is_int(seed):\n            raise TypeError(\"Seed must be an integer\")\n\n        if not -1 <= seed <= 10000:\n            raise ValueError(\n                \"Seed for random dithering must be either between 1 and \"\n                \"10000 inclusive, 0 for autogeneration from the system \"\n                \"clock, or -1 for autogeneration from a checksum of the first \"\n                \"image tile (got {})\".format(seed))\n\n        if seed == DITHER_SEED_CHECKSUM:\n            # Determine the tile dimensions from the ZTILEn keywords\n            naxis = self._header['ZNAXIS']\n            tile_dims = [self._header[f'ZTILE{idx + 1}']\n                         for idx in range(naxis)]\n            tile_dims.reverse()\n\n            # Get the first tile by using the tile dimensions as the end\n            # indices of slices (starting from 0)\n            first_tile = self.data[tuple(slice(d) for d in tile_dims)]\n\n            # The checksum algorithm used is literally just the sum of the bytes\n            # of the tile data (not its actual floating point values).  Integer\n            # overflow is irrelevant.\n            csum = first_tile.view(dtype='uint8').sum()\n\n            # Since CFITSIO uses an unsigned long (which may be different on\n            # different platforms) go ahead and truncate the sum to its\n            # unsigned long value and take the result modulo 10000\n            return (ctypes.c_ulong(csum).value % 10000) + 1\n        elif seed == DITHER_SEED_CLOCK:\n            # This isn't exactly the same algorithm as CFITSIO, but that's okay\n            # since the result is meant to be arbitrary. The primary difference\n            # is that CFITSIO incorporates the HDU number into the result in\n            # the hopes of heading off the possibility of the same seed being\n            # generated for two HDUs at the same time.  Here instead we just\n            # add in the HDU object's id\n            return ((sum(int(x) for x in math.modf(time.time())) + id(self)) %\n                    10000) + 1\n        else:\n            return seed"},{"col":4,"comment":"\n        Read the table column definitions from the ASCII file output by\n        BinTableHDU.dump().\n        ","endLoc":1477,"header":"@classmethod\n    def _load_coldefs(cls, fileobj)","id":2347,"name":"_load_coldefs","nodeType":"Function","startLoc":1446,"text":"@classmethod\n    def _load_coldefs(cls, fileobj):\n        \"\"\"\n        Read the table column definitions from the ASCII file output by\n        BinTableHDU.dump().\n        \"\"\"\n\n        close_file = False\n\n        if isinstance(fileobj, str):\n            fileobj = open(fileobj, 'r')\n            close_file = True\n\n        columns = []\n\n        for line in fileobj:\n            words = line[:-1].split()\n            kwargs = {}\n            for key in ['name', 'format', 'disp', 'unit', 'dim']:\n                kwargs[key] = words.pop(0).replace('\"\"', '')\n\n            for key in ['null', 'bscale', 'bzero']:\n                word = words.pop(0).replace('\"\"', '')\n                if word:\n                    word = _str_to_num(word)\n                kwargs[key] = word\n            columns.append(Column(**kwargs))\n\n        if close_file:\n            fileobj.close()\n\n        return ColDefs(columns)"},{"col":4,"comment":"\n        Rename a column.\n\n        This can also be done directly with by setting the ``name`` attribute\n        for a column::\n\n          table[name].name = new_name\n\n        TODO: this won't work for mixins\n\n        Parameters\n        ----------\n        name : str\n            The current name of the column.\n        new_name : str\n            The new name for the column\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1,2],[3,4],[5,6]], names=('a','b','c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1   3   5\n              2   4   6\n\n        Renaming column 'a' to 'aa'::\n\n            >>> t.rename_column('a' , 'aa')\n            >>> print(t)\n             aa  b   c\n            --- --- ---\n              1   3   5\n              2   4   6\n        ","endLoc":2830,"header":"def rename_column(self, name, new_name)","id":2348,"name":"rename_column","nodeType":"Function","startLoc":2788,"text":"def rename_column(self, name, new_name):\n        '''\n        Rename a column.\n\n        This can also be done directly with by setting the ``name`` attribute\n        for a column::\n\n          table[name].name = new_name\n\n        TODO: this won't work for mixins\n\n        Parameters\n        ----------\n        name : str\n            The current name of the column.\n        new_name : str\n            The new name for the column\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1,2],[3,4],[5,6]], names=('a','b','c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1   3   5\n              2   4   6\n\n        Renaming column 'a' to 'aa'::\n\n            >>> t.rename_column('a' , 'aa')\n            >>> print(t)\n             aa  b   c\n            --- --- ---\n              1   3   5\n              2   4   6\n        '''\n\n        if name not in self.keys():\n            raise KeyError(f\"Column {name} does not exist\")\n\n        self.columns[name].info.name = new_name"},{"col":0,"comment":"\n    Determines whether two or more Numpy arrays can be broadcast with each\n    other based on their shape tuple alone.\n\n    Parameters\n    ----------\n    *shapes : tuple\n        All shapes to include in the comparison.  If only one shape is given it\n        is passed through unmodified.  If no shapes are given returns an empty\n        `tuple`.\n\n    Returns\n    -------\n    broadcast : `tuple`\n        If all shapes are mutually broadcastable, returns a tuple of the full\n        broadcast shape.\n    ","endLoc":353,"header":"def check_broadcast(*shapes)","id":2349,"name":"check_broadcast","nodeType":"Function","startLoc":308,"text":"def check_broadcast(*shapes):\n    \"\"\"\n    Determines whether two or more Numpy arrays can be broadcast with each\n    other based on their shape tuple alone.\n\n    Parameters\n    ----------\n    *shapes : tuple\n        All shapes to include in the comparison.  If only one shape is given it\n        is passed through unmodified.  If no shapes are given returns an empty\n        `tuple`.\n\n    Returns\n    -------\n    broadcast : `tuple`\n        If all shapes are mutually broadcastable, returns a tuple of the full\n        broadcast shape.\n    \"\"\"\n\n    if len(shapes) == 0:\n        return ()\n    elif len(shapes) == 1:\n        return shapes[0]\n\n    reversed_shapes = (reversed(shape) for shape in shapes)\n\n    full_shape = []\n\n    for dims in zip_longest(*reversed_shapes, fillvalue=1):\n        max_dim = 1\n        max_dim_idx = None\n        for idx, dim in enumerate(dims):\n            if dim == 1:\n                continue\n\n            if max_dim == 1:\n                # The first dimension of size greater than 1\n                max_dim = dim\n                max_dim_idx = idx\n            elif dim != max_dim:\n                raise IncompatibleShapeError(\n                    shapes[max_dim_idx], max_dim_idx, shapes[idx], idx)\n\n        full_shape.append(max_dim)\n\n    return tuple(full_shape[::-1])"},{"col":4,"comment":"\n        Rename multiple columns.\n\n        Parameters\n        ----------\n        names : list, tuple\n            A list or tuple of existing column names.\n        new_names : list, tuple\n            A list or tuple of new column names.\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b', 'c'::\n\n            >>> t = Table([[1,2],[3,4],[5,6]], names=('a','b','c'))\n            >>> print(t)\n              a   b   c\n             --- --- ---\n              1   3   5\n              2   4   6\n\n        Renaming columns 'a' to 'aa' and 'b' to 'bb'::\n\n            >>> names = ('a','b')\n            >>> new_names = ('aa','bb')\n            >>> t.rename_columns(names, new_names)\n            >>> print(t)\n             aa  bb   c\n            --- --- ---\n              1   3   5\n              2   4   6\n        ","endLoc":2876,"header":"def rename_columns(self, names, new_names)","id":2350,"name":"rename_columns","nodeType":"Function","startLoc":2832,"text":"def rename_columns(self, names, new_names):\n        '''\n        Rename multiple columns.\n\n        Parameters\n        ----------\n        names : list, tuple\n            A list or tuple of existing column names.\n        new_names : list, tuple\n            A list or tuple of new column names.\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b', 'c'::\n\n            >>> t = Table([[1,2],[3,4],[5,6]], names=('a','b','c'))\n            >>> print(t)\n              a   b   c\n             --- --- ---\n              1   3   5\n              2   4   6\n\n        Renaming columns 'a' to 'aa' and 'b' to 'bb'::\n\n            >>> names = ('a','b')\n            >>> new_names = ('aa','bb')\n            >>> t.rename_columns(names, new_names)\n            >>> print(t)\n             aa  bb   c\n            --- --- ---\n              1   3   5\n              2   4   6\n        '''\n\n        if not self._is_list_or_tuple_of_str(names):\n            raise TypeError(\"input 'names' must be a tuple or a list of column names\")\n\n        if not self._is_list_or_tuple_of_str(new_names):\n            raise TypeError(\"input 'new_names' must be a tuple or a list of column names\")\n\n        if len(names) != len(new_names):\n            raise ValueError(\"input 'names' and 'new_names' list arguments must be the same length\")\n\n        for name, new_name in zip(names, new_names):\n            self.rename_column(name, new_name)"},{"col":4,"comment":"Add a new row to the end of the table.\n\n        The ``vals`` argument can be:\n\n        sequence (e.g. tuple or list)\n            Column values in the same order as table columns.\n        mapping (e.g. dict)\n            Keys corresponding to column names.  Missing values will be\n            filled with np.zeros for the column dtype.\n        `None`\n            All values filled with np.zeros for the column dtype.\n\n        This method requires that the Table object \"owns\" the underlying array\n        data.  In particular one cannot add a row to a Table that was\n        initialized with copy=False from an existing array.\n\n        The ``mask`` attribute should give (if desired) the mask for the\n        values. The type of the mask should match that of the values, i.e. if\n        ``vals`` is an iterable, then ``mask`` should also be an iterable\n        with the same length, and if ``vals`` is a mapping, then ``mask``\n        should be a dictionary.\n\n        Parameters\n        ----------\n        vals : tuple, list, dict or None\n            Use the specified values in the new row\n        mask : tuple, list, dict or None\n            Use the specified mask values in the new row\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n           >>> t = Table([[1,2],[4,5],[7,8]], names=('a','b','c'))\n           >>> print(t)\n            a   b   c\n           --- --- ---\n             1   4   7\n             2   5   8\n\n        Adding a new row with entries '3' in 'a', '6' in 'b' and '9' in 'c'::\n\n           >>> t.add_row([3,6,9])\n           >>> print(t)\n             a   b   c\n             --- --- ---\n             1   4   7\n             2   5   8\n             3   6   9\n        ","endLoc":2950,"header":"def add_row(self, vals=None, mask=None)","id":2351,"name":"add_row","nodeType":"Function","startLoc":2899,"text":"def add_row(self, vals=None, mask=None):\n        \"\"\"Add a new row to the end of the table.\n\n        The ``vals`` argument can be:\n\n        sequence (e.g. tuple or list)\n            Column values in the same order as table columns.\n        mapping (e.g. dict)\n            Keys corresponding to column names.  Missing values will be\n            filled with np.zeros for the column dtype.\n        `None`\n            All values filled with np.zeros for the column dtype.\n\n        This method requires that the Table object \"owns\" the underlying array\n        data.  In particular one cannot add a row to a Table that was\n        initialized with copy=False from an existing array.\n\n        The ``mask`` attribute should give (if desired) the mask for the\n        values. The type of the mask should match that of the values, i.e. if\n        ``vals`` is an iterable, then ``mask`` should also be an iterable\n        with the same length, and if ``vals`` is a mapping, then ``mask``\n        should be a dictionary.\n\n        Parameters\n        ----------\n        vals : tuple, list, dict or None\n            Use the specified values in the new row\n        mask : tuple, list, dict or None\n            Use the specified mask values in the new row\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n           >>> t = Table([[1,2],[4,5],[7,8]], names=('a','b','c'))\n           >>> print(t)\n            a   b   c\n           --- --- ---\n             1   4   7\n             2   5   8\n\n        Adding a new row with entries '3' in 'a', '6' in 'b' and '9' in 'c'::\n\n           >>> t.add_row([3,6,9])\n           >>> print(t)\n             a   b   c\n             --- --- ---\n             1   4   7\n             2   5   8\n             3   6   9\n        \"\"\"\n        self.insert_row(len(self), vals, mask)"},{"col":4,"comment":"Add a new row before the given ``index`` position in the table.\n\n        The ``vals`` argument can be:\n\n        sequence (e.g. tuple or list)\n            Column values in the same order as table columns.\n        mapping (e.g. dict)\n            Keys corresponding to column names.  Missing values will be\n            filled with np.zeros for the column dtype.\n        `None`\n            All values filled with np.zeros for the column dtype.\n\n        The ``mask`` attribute should give (if desired) the mask for the\n        values. The type of the mask should match that of the values, i.e. if\n        ``vals`` is an iterable, then ``mask`` should also be an iterable\n        with the same length, and if ``vals`` is a mapping, then ``mask``\n        should be a dictionary.\n\n        Parameters\n        ----------\n        vals : tuple, list, dict or None\n            Use the specified values in the new row\n        mask : tuple, list, dict or None\n            Use the specified mask values in the new row\n        ","endLoc":3082,"header":"def insert_row(self, index, vals=None, mask=None)","id":2352,"name":"insert_row","nodeType":"Function","startLoc":2952,"text":"def insert_row(self, index, vals=None, mask=None):\n        \"\"\"Add a new row before the given ``index`` position in the table.\n\n        The ``vals`` argument can be:\n\n        sequence (e.g. tuple or list)\n            Column values in the same order as table columns.\n        mapping (e.g. dict)\n            Keys corresponding to column names.  Missing values will be\n            filled with np.zeros for the column dtype.\n        `None`\n            All values filled with np.zeros for the column dtype.\n\n        The ``mask`` attribute should give (if desired) the mask for the\n        values. The type of the mask should match that of the values, i.e. if\n        ``vals`` is an iterable, then ``mask`` should also be an iterable\n        with the same length, and if ``vals`` is a mapping, then ``mask``\n        should be a dictionary.\n\n        Parameters\n        ----------\n        vals : tuple, list, dict or None\n            Use the specified values in the new row\n        mask : tuple, list, dict or None\n            Use the specified mask values in the new row\n        \"\"\"\n        colnames = self.colnames\n\n        N = len(self)\n        if index < -N or index > N:\n            raise IndexError(\"Index {} is out of bounds for table with length {}\"\n                             .format(index, N))\n        if index < 0:\n            index += N\n\n        if isinstance(vals, Mapping) or vals is None:\n            # From the vals and/or mask mappings create the corresponding lists\n            # that have entries for each table column.\n            if mask is not None and not isinstance(mask, Mapping):\n                raise TypeError(\"Mismatch between type of vals and mask\")\n\n            # Now check that the mask is specified for the same keys as the\n            # values, otherwise things get really confusing.\n            if mask is not None and set(vals.keys()) != set(mask.keys()):\n                raise ValueError('keys in mask should match keys in vals')\n\n            if vals and any(name not in colnames for name in vals):\n                raise ValueError('Keys in vals must all be valid column names')\n\n            vals_list = []\n            mask_list = []\n\n            for name in colnames:\n                if vals and name in vals:\n                    vals_list.append(vals[name])\n                    mask_list.append(False if mask is None else mask[name])\n                else:\n                    col = self[name]\n                    if hasattr(col, 'dtype'):\n                        # Make a placeholder zero element of the right type which is masked.\n                        # This assumes the appropriate insert() method will broadcast a\n                        # numpy scalar to the right shape.\n                        vals_list.append(np.zeros(shape=(), dtype=col.dtype))\n\n                        # For masked table any unsupplied values are masked by default.\n                        mask_list.append(self.masked and vals is not None)\n                    else:\n                        raise ValueError(f\"Value must be supplied for column '{name}'\")\n\n            vals = vals_list\n            mask = mask_list\n\n        if isiterable(vals):\n            if mask is not None and (not isiterable(mask) or isinstance(mask, Mapping)):\n                raise TypeError(\"Mismatch between type of vals and mask\")\n\n            if len(self.columns) != len(vals):\n                raise ValueError('Mismatch between number of vals and columns')\n\n            if mask is not None:\n                if len(self.columns) != len(mask):\n                    raise ValueError('Mismatch between number of masks and columns')\n            else:\n                mask = [False] * len(self.columns)\n\n        else:\n            raise TypeError('Vals must be an iterable or mapping or None')\n\n        # Insert val at index for each column\n        columns = self.TableColumns()\n        for name, col, val, mask_ in zip(colnames, self.columns.values(), vals, mask):\n            try:\n                # If new val is masked and the existing column does not support masking\n                # then upgrade the column to a mask-enabled type: either the table-level\n                # default ColumnClass or else MaskedColumn.\n                if mask_ and isinstance(col, Column) and not isinstance(col, MaskedColumn):\n                    col_cls = (self.ColumnClass\n                               if issubclass(self.ColumnClass, self.MaskedColumn)\n                               else self.MaskedColumn)\n                    col = col_cls(col, copy=False)\n\n                newcol = col.insert(index, val, axis=0)\n\n                if len(newcol) != N + 1:\n                    raise ValueError('Incorrect length for column {} after inserting {}'\n                                     ' (expected {}, got {})'\n                                     .format(name, val, len(newcol), N + 1))\n                newcol.info.parent_table = self\n\n                # Set mask if needed and possible\n                if mask_:\n                    if hasattr(newcol, 'mask'):\n                        newcol[index] = np.ma.masked\n                    else:\n                        raise TypeError(\"mask was supplied for column '{}' but it does not \"\n                                        \"support masked values\".format(col.info.name))\n\n                columns[name] = newcol\n\n            except Exception as err:\n                raise ValueError(\"Unable to insert row because of exception in column '{}':\\n{}\"\n                                 .format(name, err)) from err\n\n        for table_index in self.indices:\n            table_index.insert_row(index, vals, self.columns.values())\n\n        self._replace_cols(columns)\n\n        # Revert groups to default (ungrouped) state\n        if hasattr(self, '_groups'):\n            del self._groups"},{"col":4,"comment":"null","endLoc":305,"header":"def __init__(self, shape_a, shape_a_idx, shape_b, shape_b_idx)","id":2353,"name":"__init__","nodeType":"Function","startLoc":304,"text":"def __init__(self, shape_a, shape_a_idx, shape_b, shape_b_idx):\n        super().__init__(shape_a, shape_a_idx, shape_b, shape_b_idx)"},{"col":4,"comment":"\n        Read the table data from the ASCII file output by BinTableHDU.dump().\n        ","endLoc":1444,"header":"@classmethod\n    def _load_data(cls, fileobj, coldefs=None)","id":2354,"name":"_load_data","nodeType":"Function","startLoc":1304,"text":"@classmethod\n    def _load_data(cls, fileobj, coldefs=None):\n        \"\"\"\n        Read the table data from the ASCII file output by BinTableHDU.dump().\n        \"\"\"\n\n        close_file = False\n\n        if isinstance(fileobj, str):\n            fileobj = open(fileobj, 'r')\n            close_file = True\n\n        initialpos = fileobj.tell()  # We'll be returning here later\n        linereader = csv.reader(fileobj, dialect=FITSTableDumpDialect)\n\n        # First we need to do some preprocessing on the file to find out how\n        # much memory we'll need to reserve for the table.  This is necessary\n        # even if we already have the coldefs in order to determine how many\n        # rows to reserve memory for\n        vla_lengths = []\n        recformats = []\n        names = []\n        nrows = 0\n        if coldefs is not None:\n            recformats = coldefs._recformats\n            names = coldefs.names\n\n        def update_recformats(value, idx):\n            fitsformat = _scalar_to_format(value)\n            recformat = _convert_format(fitsformat)\n            if idx >= len(recformats):\n                recformats.append(recformat)\n            else:\n                if _cmp_recformats(recformats[idx], recformat) < 0:\n                    recformats[idx] = recformat\n\n        # TODO: The handling of VLAs could probably be simplified a bit\n        for row in linereader:\n            nrows += 1\n            if coldefs is not None:\n                continue\n            col = 0\n            idx = 0\n            while idx < len(row):\n                if row[idx] == 'VLA_Length=':\n                    if col < len(vla_lengths):\n                        vla_length = vla_lengths[col]\n                    else:\n                        vla_length = int(row[idx + 1])\n                        vla_lengths.append(vla_length)\n                    idx += 2\n                    while vla_length:\n                        update_recformats(row[idx], col)\n                        vla_length -= 1\n                        idx += 1\n                    col += 1\n                else:\n                    if col >= len(vla_lengths):\n                        vla_lengths.append(None)\n                    update_recformats(row[idx], col)\n                    col += 1\n                    idx += 1\n\n        # Update the recformats for any VLAs\n        for idx, length in enumerate(vla_lengths):\n            if length is not None:\n                recformats[idx] = str(length) + recformats[idx]\n\n        dtype = np.rec.format_parser(recformats, names, None).dtype\n\n        # TODO: In the future maybe enable loading a bit at a time so that we\n        # can convert from this format to an actual FITS file on disk without\n        # needing enough physical memory to hold the entire thing at once\n        hdu = BinTableHDU.from_columns(np.recarray(shape=1, dtype=dtype),\n                                       nrows=nrows, fill=True)\n\n        # TODO: It seems to me a lot of this could/should be handled from\n        # within the FITS_rec class rather than here.\n        data = hdu.data\n        for idx, length in enumerate(vla_lengths):\n            if length is not None:\n                arr = data.columns._arrays[idx]\n                dt = recformats[idx][len(str(length)):]\n\n                # NOTE: FormatQ not supported here; it's hard to determine\n                # whether or not it will be necessary to use a wider descriptor\n                # type. The function documentation will have to serve as a\n                # warning that this is not supported.\n                recformats[idx] = _FormatP(dt, max=length)\n                data.columns._recformats[idx] = recformats[idx]\n                name = data.columns.names[idx]\n                data._cache_field(name, _makep(arr, arr, recformats[idx]))\n\n        def format_value(col, val):\n            # Special formatting for a couple particular data types\n            if recformats[col] == FITS2NUMPY['L']:\n                return bool(int(val))\n            elif recformats[col] == FITS2NUMPY['M']:\n                # For some reason, in arrays/fields where numpy expects a\n                # complex it's not happy to take a string representation\n                # (though it's happy to do that in other contexts), so we have\n                # to convert the string representation for it:\n                return complex(val)\n            else:\n                return val\n\n        # Jump back to the start of the data and create a new line reader\n        fileobj.seek(initialpos)\n        linereader = csv.reader(fileobj, dialect=FITSTableDumpDialect)\n        for row, line in enumerate(linereader):\n            col = 0\n            idx = 0\n            while idx < len(line):\n                if line[idx] == 'VLA_Length=':\n                    vla_len = vla_lengths[col]\n                    idx += 2\n                    slice_ = slice(idx, idx + vla_len)\n                    data[row][col][:] = line[idx:idx + vla_len]\n                    idx += vla_len\n                elif dtype[col].shape:\n                    # This is an array column\n                    array_size = int(np.multiply.reduce(dtype[col].shape))\n                    slice_ = slice(idx, idx + array_size)\n                    idx += array_size\n                else:\n                    slice_ = None\n\n                if slice_ is None:\n                    # This is a scalar row element\n                    data[row][col] = format_value(col, line[idx])\n                    idx += 1\n                else:\n                    data[row][col].flat[:] = [format_value(col, val)\n                                              for val in line[slice_]]\n\n                col += 1\n\n        if close_file:\n            fileobj.close()\n\n        return data"},{"col":4,"comment":"GCRS position with velocity at ``obstime`` as a GCRS coordinate.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time`\n            The ``obstime`` to calculate the GCRS position/velocity at.\n\n        Returns\n        -------\n        gcrs : `~astropy.coordinates.GCRS` instance\n            With velocity included.\n        ","endLoc":680,"header":"def get_gcrs(self, obstime)","id":2355,"name":"get_gcrs","nodeType":"Function","startLoc":663,"text":"def get_gcrs(self, obstime):\n        \"\"\"GCRS position with velocity at ``obstime`` as a GCRS coordinate.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time`\n            The ``obstime`` to calculate the GCRS position/velocity at.\n\n        Returns\n        -------\n        gcrs : `~astropy.coordinates.GCRS` instance\n            With velocity included.\n        \"\"\"\n        # do this here to prevent a series of complicated circular imports\n        from .builtin_frames import GCRS\n        loc, vel = self.get_gcrs_posvel(obstime)\n        loc.differentials['s'] = CartesianDifferential.from_cartesian(vel)\n        return GCRS(loc, obstime=obstime)"},{"col":4,"comment":"\n        Calculate the GCRS position and velocity of this object at the\n        requested ``obstime``.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time`\n            The ``obstime`` to calculate the GCRS position/velocity at.\n\n        Returns\n        -------\n        obsgeoloc : `~astropy.coordinates.CartesianRepresentation`\n            The GCRS position of the object\n        obsgeovel : `~astropy.coordinates.CartesianRepresentation`\n            The GCRS velocity of the object\n        ","endLoc":740,"header":"def get_gcrs_posvel(self, obstime)","id":2356,"name":"get_gcrs_posvel","nodeType":"Function","startLoc":716,"text":"def get_gcrs_posvel(self, obstime):\n        \"\"\"\n        Calculate the GCRS position and velocity of this object at the\n        requested ``obstime``.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time`\n            The ``obstime`` to calculate the GCRS position/velocity at.\n\n        Returns\n        -------\n        obsgeoloc : `~astropy.coordinates.CartesianRepresentation`\n            The GCRS position of the object\n        obsgeovel : `~astropy.coordinates.CartesianRepresentation`\n            The GCRS velocity of the object\n        \"\"\"\n        # Local import to prevent circular imports.\n        from .builtin_frames.intermediate_rotation_transforms import (\n            cirs_to_itrs_mat, gcrs_to_cirs_mat)\n\n        # Get gcrs_posvel by transforming via CIRS (slightly faster than TETE).\n        return self._get_gcrs_posvel(obstime,\n                                     cirs_to_itrs_mat(obstime),\n                                     gcrs_to_cirs_mat(obstime))"},{"col":0,"comment":"null","endLoc":62,"header":"def cirs_to_itrs_mat(time)","id":2357,"name":"cirs_to_itrs_mat","nodeType":"Function","startLoc":50,"text":"def cirs_to_itrs_mat(time):\n    # compute the polar motion p-matrix\n    xp, yp = get_polar_motion(time)\n    sp = erfa.sp00(*get_jd12(time, 'tt'))\n    pmmat = erfa.pom00(xp, yp, sp)\n\n    # now determine the Earth Rotation Angle for the input obstime\n    # era00 accepts UT1, so we convert if need be\n    era = erfa.era00(*get_jd12(time, 'ut1'))\n\n    # c2tcio expects a GCRS->CIRS matrix, but we just set that to an I-matrix\n    # because we're already in CIRS\n    return erfa.c2tcio(np.eye(3), era, pmmat)"},{"col":4,"comment":"null","endLoc":350,"header":"def __init__(self, *args, copy=True, **kwargs)","id":2358,"name":"__init__","nodeType":"Function","startLoc":286,"text":"def __init__(self, *args, copy=True, **kwargs):\n\n        # these are frame attributes set on this SkyCoord but *not* a part of\n        # the frame object this SkyCoord contains\n        self._extra_frameattr_names = set()\n\n        # If all that is passed in is a frame instance that already has data,\n        # we should bypass all of the parsing and logic below. This is here\n        # to make this the fastest way to create a SkyCoord instance. Many of\n        # the classmethods implemented for performance enhancements will use\n        # this as the initialization path\n        if (len(args) == 1 and len(kwargs) == 0\n                and isinstance(args[0], (BaseCoordinateFrame, SkyCoord))):\n\n            coords = args[0]\n            if isinstance(coords, SkyCoord):\n                self._extra_frameattr_names = coords._extra_frameattr_names\n                self.info = coords.info\n\n                # Copy over any extra frame attributes\n                for attr_name in self._extra_frameattr_names:\n                    # Setting it will also validate it.\n                    setattr(self, attr_name, getattr(coords, attr_name))\n\n                coords = coords.frame\n\n            if not coords.has_data:\n                raise ValueError('Cannot initialize from a coordinate frame '\n                                 'instance without coordinate data')\n\n            if copy:\n                self._sky_coord_frame = coords.copy()\n            else:\n                self._sky_coord_frame = coords\n\n        else:\n            # Get the frame instance without coordinate data but with all frame\n            # attributes set - these could either have been passed in with the\n            # frame as an instance, or passed in as kwargs here\n            frame_cls, frame_kwargs = _get_frame_without_data(args, kwargs)\n\n            # Parse the args and kwargs to assemble a sanitized and validated\n            # kwargs dict for initializing attributes for this object and for\n            # creating the internal self._sky_coord_frame object\n            args = list(args)  # Make it mutable\n            skycoord_kwargs, components, info = _parse_coordinate_data(\n                frame_cls(**frame_kwargs), args, kwargs)\n\n            # In the above two parsing functions, these kwargs were identified\n            # as valid frame attributes for *some* frame, but not the frame that\n            # this SkyCoord will have. We keep these attributes as special\n            # skycoord frame attributes:\n            for attr in skycoord_kwargs:\n                # Setting it will also validate it.\n                setattr(self, attr, skycoord_kwargs[attr])\n\n            if info is not None:\n                self.info = info\n\n            # Finally make the internal coordinate object.\n            frame_kwargs.update(components)\n            self._sky_coord_frame = frame_cls(copy=copy, **frame_kwargs)\n\n            if not self._sky_coord_frame.has_data:\n                raise ValueError('Cannot create a SkyCoord without data')"},{"col":0,"comment":"\n    gets the two polar motion components in radians for use with apio\n    ","endLoc":70,"header":"def get_polar_motion(time)","id":2361,"name":"get_polar_motion","nodeType":"Function","startLoc":42,"text":"def get_polar_motion(time):\n    \"\"\"\n    gets the two polar motion components in radians for use with apio\n    \"\"\"\n    # Get the polar motion from the IERS table\n    iers_table = iers.earth_orientation_table.get()\n    xp, yp, status = iers_table.pm_xy(time, return_status=True)\n\n    wmsg = (\n        'Tried to get polar motions for times {} IERS data is '\n        'valid. Defaulting to polar motion from the 50-yr mean for those. '\n        'This may affect precision at the arcsec level. Please check your '\n        'astropy.utils.iers.conf.iers_auto_url and point it to a newer '\n        'version if necessary.'\n    )\n    if np.any(status == iers.TIME_BEFORE_IERS_RANGE):\n        xp[status == iers.TIME_BEFORE_IERS_RANGE] = _DEFAULT_PM[0]\n        yp[status == iers.TIME_BEFORE_IERS_RANGE] = _DEFAULT_PM[1]\n\n        warnings.warn(wmsg.format('before'), AstropyWarning)\n\n    if np.any(status == iers.TIME_BEYOND_IERS_RANGE):\n\n        xp[status == iers.TIME_BEYOND_IERS_RANGE] = _DEFAULT_PM[0]\n        yp[status == iers.TIME_BEYOND_IERS_RANGE] = _DEFAULT_PM[1]\n\n        warnings.warn(wmsg.format('after'), AstropyWarning)\n\n    return xp.to_value(u.radian), yp.to_value(u.radian)"},{"attributeType":"null","col":4,"comment":"null","endLoc":848,"id":2362,"name":"_extension","nodeType":"Attribute","startLoc":848,"text":"_extension"},{"attributeType":"null","col":4,"comment":"null","endLoc":849,"id":2363,"name":"_ext_comment","nodeType":"Attribute","startLoc":849,"text":"_ext_comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":1000,"id":2364,"name":"_tdump_file_format","nodeType":"Attribute","startLoc":1000,"text":"_tdump_file_format"},{"attributeType":"null","col":4,"comment":"null","endLoc":1201,"id":2365,"name":"load","nodeType":"Attribute","startLoc":1201,"text":"load"},{"col":0,"comment":"\n    Get the header from an HDU of a FITS file.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        File to get header from.  If an opened file object, its mode\n        must be one of the following rb, rb+, or ab+).\n\n    ext, extname, extver\n        The rest of the arguments are for HDU specification.  See the\n        `getdata` documentation for explanations/examples.\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n\n    Returns\n    -------\n    header : `Header` object\n    ","endLoc":110,"header":"def getheader(filename, *args, **kwargs)","id":2366,"name":"getheader","nodeType":"Function","startLoc":80,"text":"def getheader(filename, *args, **kwargs):\n    \"\"\"\n    Get the header from an HDU of a FITS file.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        File to get header from.  If an opened file object, its mode\n        must be one of the following rb, rb+, or ab+).\n\n    ext, extname, extver\n        The rest of the arguments are for HDU specification.  See the\n        `getdata` documentation for explanations/examples.\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n\n    Returns\n    -------\n    header : `Header` object\n    \"\"\"\n\n    mode, closed = _get_file_mode(filename)\n    hdulist, extidx = _getext(filename, mode, *args, **kwargs)\n    try:\n        hdu = hdulist[extidx]\n        header = hdu.header\n    finally:\n        hdulist.close(closed=closed)\n\n    return header"},{"col":0,"comment":"\n    Allow file object to already be opened in any of the valid modes and\n    and leave the file in the same state (opened or closed) as when\n    the function was called.\n    ","endLoc":1130,"header":"def _get_file_mode(filename, default='readonly')","id":2367,"name":"_get_file_mode","nodeType":"Function","startLoc":1112,"text":"def _get_file_mode(filename, default='readonly'):\n    \"\"\"\n    Allow file object to already be opened in any of the valid modes and\n    and leave the file in the same state (opened or closed) as when\n    the function was called.\n    \"\"\"\n\n    mode = default\n    closed = fileobj_closed(filename)\n\n    fmode = fileobj_mode(filename)\n    if fmode is not None:\n        mode = FILE_MODES.get(fmode)\n        if mode is None:\n            raise OSError(\n                \"File mode of the input file object ({!r}) cannot be used to \"\n                \"read/write FITS files.\".format(fmode))\n\n    return mode, closed"},{"col":0,"comment":"\n    Open the input file, return the `HDUList` and the extension.\n\n    This supports several different styles of extension selection.  See the\n    :func:`getdata()` documentation for the different possibilities.\n    ","endLoc":1073,"header":"def _getext(filename, mode, *args, ext=None, extname=None, extver=None,\n            **kwargs)","id":2368,"name":"_getext","nodeType":"Function","startLoc":1005,"text":"def _getext(filename, mode, *args, ext=None, extname=None, extver=None,\n            **kwargs):\n    \"\"\"\n    Open the input file, return the `HDUList` and the extension.\n\n    This supports several different styles of extension selection.  See the\n    :func:`getdata()` documentation for the different possibilities.\n    \"\"\"\n\n    err_msg = ('Redundant/conflicting extension arguments(s): {}'.format(\n            {'args': args, 'ext': ext, 'extname': extname,\n             'extver': extver}))\n\n    # This code would be much simpler if just one way of specifying an\n    # extension were picked.  But now we need to support all possible ways for\n    # the time being.\n    if len(args) == 1:\n        # Must be either an extension number, an extension name, or an\n        # (extname, extver) tuple\n        if _is_int(args[0]) or (isinstance(ext, tuple) and len(ext) == 2):\n            if ext is not None or extname is not None or extver is not None:\n                raise TypeError(err_msg)\n            ext = args[0]\n        elif isinstance(args[0], str):\n            # The first arg is an extension name; it could still be valid\n            # to provide an extver kwarg\n            if ext is not None or extname is not None:\n                raise TypeError(err_msg)\n            extname = args[0]\n        else:\n            # Take whatever we have as the ext argument; we'll validate it\n            # below\n            ext = args[0]\n    elif len(args) == 2:\n        # Must be an extname and extver\n        if ext is not None or extname is not None or extver is not None:\n            raise TypeError(err_msg)\n        extname = args[0]\n        extver = args[1]\n    elif len(args) > 2:\n        raise TypeError('Too many positional arguments.')\n\n    if (ext is not None and\n            not (_is_int(ext) or\n                 (isinstance(ext, tuple) and len(ext) == 2 and\n                  isinstance(ext[0], str) and _is_int(ext[1])))):\n        raise ValueError(\n            'The ext keyword must be either an extension number '\n            '(zero-indexed) or a (extname, extver) tuple.')\n    if extname is not None and not isinstance(extname, str):\n        raise ValueError('The extname argument must be a string.')\n    if extver is not None and not _is_int(extver):\n        raise ValueError('The extver argument must be an integer.')\n\n    if ext is None and extname is None and extver is None:\n        ext = 0\n    elif ext is not None and (extname is not None or extver is not None):\n        raise TypeError(err_msg)\n    elif extname:\n        if extver:\n            ext = (extname, extver)\n        else:\n            ext = (extname, 1)\n    elif extver and extname is None:\n        raise TypeError('extver alone cannot specify an extension.')\n\n    hdulist = fitsopen(filename, mode=mode, **kwargs)\n\n    return hdulist, ext"},{"col":0,"comment":"\n    Gets ``jd1`` and ``jd2`` from a time object in a particular scale.\n\n    Parameters\n    ----------\n    time : `~astropy.time.Time`\n        The time to get the jds for\n    scale : str\n        The time scale to get the jds for\n\n    Returns\n    -------\n    jd1 : float\n    jd2 : float\n    ","endLoc":123,"header":"def get_jd12(time, scale)","id":2369,"name":"get_jd12","nodeType":"Function","startLoc":98,"text":"def get_jd12(time, scale):\n    \"\"\"\n    Gets ``jd1`` and ``jd2`` from a time object in a particular scale.\n\n    Parameters\n    ----------\n    time : `~astropy.time.Time`\n        The time to get the jds for\n    scale : str\n        The time scale to get the jds for\n\n    Returns\n    -------\n    jd1 : float\n    jd2 : float\n    \"\"\"\n    if time.scale == scale:\n        newtime = time\n    else:\n        try:\n            newtime = getattr(time, scale)\n        except iers.IERSRangeError as e:\n            _warn_iers(e)\n            newtime = time\n\n    return newtime.jd1, newtime.jd2"},{"col":0,"comment":"\n    Generate a warning for an IERSRangeerror\n\n    Parameters\n    ----------\n    ierserr : An `~astropy.utils.iers.IERSRangeError`\n    ","endLoc":82,"header":"def _warn_iers(ierserr)","id":2370,"name":"_warn_iers","nodeType":"Function","startLoc":73,"text":"def _warn_iers(ierserr):\n    \"\"\"\n    Generate a warning for an IERSRangeerror\n\n    Parameters\n    ----------\n    ierserr : An `~astropy.utils.iers.IERSRangeError`\n    \"\"\"\n    msg = '{0} Assuming UT1-UTC=0 for coordinate transformations.'\n    warnings.warn(msg.format(ierserr.args[0]), AstropyWarning)"},{"col":0,"comment":"\n    Determines the coordinate frame from input SkyCoord args and kwargs.\n\n    This function extracts (removes) all frame attributes from the kwargs and\n    determines the frame class either using the kwargs, or using the first\n    element in the args (if a single frame object is passed in, for example).\n    This function allows a frame to be specified as a string like 'icrs' or a\n    frame class like ICRS, or an instance ICRS(), as long as the instance frame\n    attributes don't conflict with kwargs passed in (which could require a\n    three-way merge with the coordinate data possibly specified via the args).\n    ","endLoc":208,"header":"def _get_frame_without_data(args, kwargs)","id":2371,"name":"_get_frame_without_data","nodeType":"Function","startLoc":62,"text":"def _get_frame_without_data(args, kwargs):\n    \"\"\"\n    Determines the coordinate frame from input SkyCoord args and kwargs.\n\n    This function extracts (removes) all frame attributes from the kwargs and\n    determines the frame class either using the kwargs, or using the first\n    element in the args (if a single frame object is passed in, for example).\n    This function allows a frame to be specified as a string like 'icrs' or a\n    frame class like ICRS, or an instance ICRS(), as long as the instance frame\n    attributes don't conflict with kwargs passed in (which could require a\n    three-way merge with the coordinate data possibly specified via the args).\n    \"\"\"\n    from .sky_coordinate import SkyCoord\n\n    # We eventually (hopefully) fill and return these by extracting the frame\n    # and frame attributes from the input:\n    frame_cls = None\n    frame_cls_kwargs = {}\n\n    # The first place to check: the frame could be specified explicitly\n    frame = kwargs.pop('frame', None)\n\n    if frame is not None:\n        # Here the frame was explicitly passed in as a keyword argument.\n\n        # If the frame is an instance or SkyCoord, we extract the attributes\n        # and split the instance into the frame class and an attributes dict\n\n        if isinstance(frame, SkyCoord):\n            # If the frame was passed as a SkyCoord, we also want to preserve\n            # any extra attributes (e.g., obstime) if they are not already\n            # specified in the kwargs. We preserve these extra attributes by\n            # adding them to the kwargs dict:\n            for attr in frame._extra_frameattr_names:\n                if (attr in kwargs and\n                        np.any(getattr(frame, attr) != kwargs[attr])):\n                    # This SkyCoord attribute passed in with the frame= object\n                    # conflicts with an attribute passed in directly to the\n                    # SkyCoord initializer as a kwarg:\n                    raise ValueError(_conflict_err_msg\n                                     .format(attr, getattr(frame, attr),\n                                             kwargs[attr], 'SkyCoord'))\n                else:\n                    kwargs[attr] = getattr(frame, attr)\n            frame = frame.frame\n\n        if isinstance(frame, BaseCoordinateFrame):\n            # Extract any frame attributes\n            for attr in frame.get_frame_attr_names():\n                # If the frame was specified as an instance, we have to make\n                # sure that no frame attributes were specified as kwargs - this\n                # would require a potential three-way merge:\n                if attr in kwargs:\n                    raise ValueError(\"Cannot specify frame attribute '{}' \"\n                                     \"directly as an argument to SkyCoord \"\n                                     \"because a frame instance was passed in. \"\n                                     \"Either pass a frame class, or modify the \"\n                                     \"frame attributes of the input frame \"\n                                     \"instance.\".format(attr))\n                elif not frame.is_frame_attr_default(attr):\n                    kwargs[attr] = getattr(frame, attr)\n\n            frame_cls = frame.__class__\n\n            # Make sure we propagate representation/differential _type choices,\n            # unless these are specified directly in the kwargs:\n            kwargs.setdefault('representation_type', frame.representation_type)\n            kwargs.setdefault('differential_type', frame.differential_type)\n\n        if frame_cls is None:  # frame probably a string\n            frame_cls = _get_frame_class(frame)\n\n    # Check that the new frame doesn't conflict with existing coordinate frame\n    # if a coordinate is supplied in the args list.  If the frame still had not\n    # been set by this point and a coordinate was supplied, then use that frame.\n    for arg in args:\n        # this catches the \"single list passed in\" case.  For that case we want\n        # to allow the first argument to set the class.  That's OK because\n        # _parse_coordinate_arg goes and checks that the frames match between\n        # the first and all the others\n        if (isinstance(arg, (Sequence, np.ndarray)) and\n                len(args) == 1 and len(arg) > 0):\n            arg = arg[0]\n\n        coord_frame_obj = coord_frame_cls = None\n        if isinstance(arg, BaseCoordinateFrame):\n            coord_frame_obj = arg\n        elif isinstance(arg, SkyCoord):\n            coord_frame_obj = arg.frame\n        if coord_frame_obj is not None:\n            coord_frame_cls = coord_frame_obj.__class__\n            frame_diff = coord_frame_obj.get_representation_cls('s')\n            if frame_diff is not None:\n                # we do this check because otherwise if there's no default\n                # differential (i.e. it is None), the code below chokes. but\n                # None still gets through if the user *requests* it\n                kwargs.setdefault('differential_type', frame_diff)\n\n            for attr in coord_frame_obj.get_frame_attr_names():\n                if (attr in kwargs and\n                        not coord_frame_obj.is_frame_attr_default(attr) and\n                        np.any(kwargs[attr] != getattr(coord_frame_obj, attr))):\n                    raise ValueError(\"Frame attribute '{}' has conflicting \"\n                                     \"values between the input coordinate data \"\n                                     \"and either keyword arguments or the \"\n                                     \"frame specification (frame=...): \"\n                                     \"{} =/= {}\"\n                                     .format(attr,\n                                             getattr(coord_frame_obj, attr),\n                                             kwargs[attr]))\n\n                elif (attr not in kwargs and\n                        not coord_frame_obj.is_frame_attr_default(attr)):\n                    kwargs[attr] = getattr(coord_frame_obj, attr)\n\n        if coord_frame_cls is not None:\n            if frame_cls is None:\n                frame_cls = coord_frame_cls\n            elif frame_cls is not coord_frame_cls:\n                raise ValueError(\"Cannot override frame='{}' of input \"\n                                 \"coordinate with new frame='{}'. Instead, \"\n                                 \"transform the coordinate.\"\n                                 .format(coord_frame_cls.__name__,\n                                         frame_cls.__name__))\n\n    if frame_cls is None:\n        frame_cls = ICRS\n\n    # By now, frame_cls should be set - if it's not, something went wrong\n    if not issubclass(frame_cls, BaseCoordinateFrame):\n        # We should hopefully never get here...\n        raise ValueError(f'Frame class has unexpected type: {frame_cls.__name__}')\n\n    for attr in frame_cls.frame_attributes:\n        if attr in kwargs:\n            frame_cls_kwargs[attr] = kwargs.pop(attr)\n\n    if 'representation_type' in kwargs:\n        frame_cls_kwargs['representation_type'] = _get_repr_cls(\n            kwargs.pop('representation_type'))\n\n    differential_type = kwargs.pop('differential_type', None)\n    if differential_type is not None:\n        frame_cls_kwargs['differential_type'] = _get_diff_cls(\n            differential_type)\n\n    return frame_cls, frame_cls_kwargs"},{"col":0,"comment":"null","endLoc":47,"header":"def gcrs_to_cirs_mat(time)","id":2372,"name":"gcrs_to_cirs_mat","nodeType":"Function","startLoc":45,"text":"def gcrs_to_cirs_mat(time):\n    # celestial-to-intermediate matrix\n    return erfa.c2i06a(*get_jd12(time, 'tt'))"},{"col":4,"comment":"Calculate GCRS position and velocity given transformation matrices.\n\n        The reference frame z axis must point to the Celestial Intermediate Pole\n        (as is the case for CIRS and TETE).\n\n        This private method is used in intermediate_rotation_transforms,\n        where some of the matrices are already available for the coordinate\n        transformation.\n\n        The method is faster by an order of magnitude than just adding a zero\n        velocity to ITRS and transforming to GCRS, because it avoids calculating\n        the velocity via finite differencing of the results of the transformation\n        at three separate times.\n        ","endLoc":714,"header":"def _get_gcrs_posvel(self, obstime, ref_to_itrs, gcrs_to_ref)","id":2373,"name":"_get_gcrs_posvel","nodeType":"Function","startLoc":682,"text":"def _get_gcrs_posvel(self, obstime, ref_to_itrs, gcrs_to_ref):\n        \"\"\"Calculate GCRS position and velocity given transformation matrices.\n\n        The reference frame z axis must point to the Celestial Intermediate Pole\n        (as is the case for CIRS and TETE).\n\n        This private method is used in intermediate_rotation_transforms,\n        where some of the matrices are already available for the coordinate\n        transformation.\n\n        The method is faster by an order of magnitude than just adding a zero\n        velocity to ITRS and transforming to GCRS, because it avoids calculating\n        the velocity via finite differencing of the results of the transformation\n        at three separate times.\n        \"\"\"\n        # The simplest route is to transform to the reference frame where the\n        # z axis is properly aligned with the Earth's rotation axis (CIRS or\n        # TETE), then calculate the velocity, and then transform this\n        # reference position and velocity to GCRS.  For speed, though, we\n        # transform the coordinates to GCRS in one step, and calculate the\n        # velocities by rotating around the earth's axis transformed to GCRS.\n        ref_to_gcrs = matrix_transpose(gcrs_to_ref)\n        itrs_to_gcrs = ref_to_gcrs @ matrix_transpose(ref_to_itrs)\n        # Earth's rotation vector in the ref frame is rot_vec_ref = (0,0,OMEGA_EARTH),\n        # so in GCRS it is rot_vec_gcrs[..., 2] @ OMEGA_EARTH.\n        rot_vec_gcrs = CartesianRepresentation(ref_to_gcrs[..., 2] * OMEGA_EARTH,\n                                               xyz_axis=-1, copy=False)\n        # Get the position in the GCRS frame.\n        # Since we just need the cartesian representation of ITRS, avoid get_itrs().\n        itrs_cart = CartesianRepresentation(self.x, self.y, self.z, copy=False)\n        pos = itrs_cart.transform(itrs_to_gcrs)\n        vel = rot_vec_gcrs.cross(pos)\n        return pos, vel"},{"col":4,"comment":"\n        Perform a dictionary-style update and merge metadata.\n\n        The argument ``other`` must be a |Table|, or something that can be used\n        to initialize a table. Columns from (possibly converted) ``other`` are\n        added to this table. In case of matching column names the column from\n        this table is replaced with the one from ``other``.\n\n        Parameters\n        ----------\n        other : table-like\n            Data to update this table with.\n        copy : bool\n            Whether the updated columns should be copies of or references to\n            the originals.\n\n        See Also\n        --------\n        add_columns, astropy.table.hstack, replace_column\n\n        Examples\n        --------\n        Update a table with another table::\n\n            >>> t1 = Table({'a': ['foo', 'bar'], 'b': [0., 0.]}, meta={'i': 0})\n            >>> t2 = Table({'b': [1., 2.], 'c': [7., 11.]}, meta={'n': 2})\n            >>> t1.update(t2)\n            >>> t1\n            <Table length=2>\n             a      b       c\n            str3 float64 float64\n            ---- ------- -------\n             foo     1.0     7.0\n             bar     2.0    11.0\n            >>> t1.meta\n            {'i': 0, 'n': 2}\n\n        Update a table with a dictionary::\n\n            >>> t = Table({'a': ['foo', 'bar'], 'b': [0., 0.]})\n            >>> t.update({'b': [1., 2.]})\n            >>> t\n            <Table length=2>\n             a      b\n            str3 float64\n            ---- -------\n             foo     1.0\n             bar     2.0\n        ","endLoc":3152,"header":"def update(self, other, copy=True)","id":2374,"name":"update","nodeType":"Function","startLoc":3093,"text":"def update(self, other, copy=True):\n        \"\"\"\n        Perform a dictionary-style update and merge metadata.\n\n        The argument ``other`` must be a |Table|, or something that can be used\n        to initialize a table. Columns from (possibly converted) ``other`` are\n        added to this table. In case of matching column names the column from\n        this table is replaced with the one from ``other``.\n\n        Parameters\n        ----------\n        other : table-like\n            Data to update this table with.\n        copy : bool\n            Whether the updated columns should be copies of or references to\n            the originals.\n\n        See Also\n        --------\n        add_columns, astropy.table.hstack, replace_column\n\n        Examples\n        --------\n        Update a table with another table::\n\n            >>> t1 = Table({'a': ['foo', 'bar'], 'b': [0., 0.]}, meta={'i': 0})\n            >>> t2 = Table({'b': [1., 2.], 'c': [7., 11.]}, meta={'n': 2})\n            >>> t1.update(t2)\n            >>> t1\n            <Table length=2>\n             a      b       c\n            str3 float64 float64\n            ---- ------- -------\n             foo     1.0     7.0\n             bar     2.0    11.0\n            >>> t1.meta\n            {'i': 0, 'n': 2}\n\n        Update a table with a dictionary::\n\n            >>> t = Table({'a': ['foo', 'bar'], 'b': [0., 0.]})\n            >>> t.update({'b': [1., 2.]})\n            >>> t\n            <Table length=2>\n             a      b\n            str3 float64\n            ---- -------\n             foo     1.0\n             bar     2.0\n        \"\"\"\n        from .operations import _merge_table_meta\n        if not isinstance(other, Table):\n            other = self.__class__(other, copy=copy)\n        common_cols = set(self.colnames).intersection(other.colnames)\n        for name, col in other.items():\n            if name in common_cols:\n                self.replace_column(name, col, copy=copy)\n            else:\n                self.add_column(col, name=name, copy=copy)\n        _merge_table_meta(self, [self, other], metadata_conflicts='silent')"},{"col":0,"comment":"Transpose a matrix or stack of matrices by swapping the last two axes.\n\n    This function mostly exists for readability; seeing ``.swapaxes(-2, -1)``\n    it is not that obvious that one does a transpose.  Note that one cannot\n    use `~numpy.ndarray.T`, as this transposes all axes and thus does not\n    work for stacks of matrices.\n    ","endLoc":38,"header":"def matrix_transpose(matrix)","id":2375,"name":"matrix_transpose","nodeType":"Function","startLoc":30,"text":"def matrix_transpose(matrix):\n    \"\"\"Transpose a matrix or stack of matrices by swapping the last two axes.\n\n    This function mostly exists for readability; seeing ``.swapaxes(-2, -1)``\n    it is not that obvious that one does a transpose.  Note that one cannot\n    use `~numpy.ndarray.T`, as this transposes all axes and thus does not\n    work for stacks of matrices.\n    \"\"\"\n    return matrix.swapaxes(-2, -1)"},{"col":0,"comment":"null","endLoc":38,"header":"def _merge_table_meta(out, tables, metadata_conflicts='warn')","id":2376,"name":"_merge_table_meta","nodeType":"Function","startLoc":34,"text":"def _merge_table_meta(out, tables, metadata_conflicts='warn'):\n    out_meta = deepcopy(tables[0].meta)\n    for table in tables[1:]:\n        out_meta = metadata.merge(out_meta, table.meta, metadata_conflicts=metadata_conflicts)\n    out.meta.update(out_meta)"},{"col":4,"comment":"null","endLoc":2810,"header":"@classmethod\n    def from_cartesian(cls, other, base=None)","id":2377,"name":"from_cartesian","nodeType":"Function","startLoc":2808,"text":"@classmethod\n    def from_cartesian(cls, other, base=None):\n        return cls(*[getattr(other, c) for c in other.components])"},{"col":4,"comment":"null","endLoc":1447,"header":"def _report(self)","id":2378,"name":"_report","nodeType":"Function","startLoc":1398,"text":"def _report(self):\n        if self.diff_column_count:\n            self._writeln(' Tables have different number of columns:')\n            self._writeln(f'  a: {self.diff_column_count[0]}')\n            self._writeln(f'  b: {self.diff_column_count[1]}')\n\n        if self.diff_column_names:\n            # Show columns with names unique to either table\n            for name in self.diff_column_names[0]:\n                format = self.diff_columns[0][name.lower()].format\n                self._writeln(f' Extra column {name} of format {format} in a')\n            for name in self.diff_column_names[1]:\n                format = self.diff_columns[1][name.lower()].format\n                self._writeln(f' Extra column {name} of format {format} in b')\n\n        col_attrs = dict(_COL_ATTRS)\n        # Now go through each table again and show columns with common\n        # names but other property differences...\n        for col_attr, vals in self.diff_column_attributes:\n            name, attr = col_attr\n            self._writeln(f' Column {name} has different {col_attrs[attr]}:')\n            report_diff_values(vals[0], vals[1], fileobj=self._fileobj,\n                               indent_width=self._indent + 1)\n\n        if self.diff_rows:\n            self._writeln(' Table rows differ:')\n            self._writeln(f'  a: {self.diff_rows[0]}')\n            self._writeln(f'  b: {self.diff_rows[1]}')\n            self._writeln(' No further data comparison performed.')\n            return\n\n        if not self.diff_values:\n            return\n\n        # Finally, let's go through and report column data differences:\n        for indx, values in self.diff_values:\n            self._writeln(' Column {} data differs in row {}:'.format(*indx))\n            report_diff_values(values[0], values[1], fileobj=self._fileobj,\n                               indent_width=self._indent + 1)\n\n        if self.diff_values and self.numdiffs < self.diff_total:\n            self._writeln(' ...{} additional difference(s) found.'.format(\n                                self.diff_total - self.numdiffs))\n\n        if self.diff_total > self.numdiffs:\n            self._writeln(' ...')\n\n        self._writeln(' {} different table data element(s) found '\n                      '({:.2%} different).'\n                      .format(self.diff_total, self.diff_ratio))"},{"col":4,"comment":"null","endLoc":2802,"header":"def __init__(self, d_x, d_y=None, d_z=None, unit=None, xyz_axis=None,\n                 copy=True)","id":2379,"name":"__init__","nodeType":"Function","startLoc":2762,"text":"def __init__(self, d_x, d_y=None, d_z=None, unit=None, xyz_axis=None,\n                 copy=True):\n\n        if d_y is None and d_z is None:\n            if isinstance(d_x, np.ndarray) and d_x.dtype.kind not in 'OV':\n                # Short-cut for 3-D array input.\n                d_x = u.Quantity(d_x, unit, copy=copy, subok=True)\n                # Keep a link to the array with all three coordinates\n                # so that we can return it quickly if needed in get_xyz.\n                self._d_xyz = d_x\n                if xyz_axis:\n                    d_x = np.moveaxis(d_x, xyz_axis, 0)\n                    self._xyz_axis = xyz_axis\n                else:\n                    self._xyz_axis = 0\n\n                self._d_x, self._d_y, self._d_z = d_x\n                return\n\n            else:\n                d_x, d_y, d_z = d_x\n\n        if xyz_axis is not None:\n            raise ValueError(\"xyz_axis should only be set if d_x, d_y, and d_z \"\n                             \"are in a single array passed in through d_x, \"\n                             \"i.e., d_y and d_z should not be not given.\")\n\n        if d_y is None or d_z is None:\n            raise ValueError(\"d_x, d_y, and d_z are required to instantiate {}\"\n                             .format(self.__class__.__name__))\n\n        if unit is not None:\n            d_x = u.Quantity(d_x, unit, copy=copy, subok=True)\n            d_y = u.Quantity(d_y, unit, copy=copy, subok=True)\n            d_z = u.Quantity(d_z, unit, copy=copy, subok=True)\n            copy = False\n\n        super().__init__(d_x, d_y, d_z, copy=copy)\n        if not (self._d_x.unit.is_equivalent(self._d_y.unit) and\n                self._d_x.unit.is_equivalent(self._d_z.unit)):\n            raise u.UnitsError('d_x, d_y and d_z should have equivalent units.')"},{"col":0,"comment":"\n    Get a frame class from the input `frame`, which could be a frame name\n    string, or frame class.\n    ","endLoc":53,"header":"def _get_frame_class(frame)","id":2380,"name":"_get_frame_class","nodeType":"Function","startLoc":32,"text":"def _get_frame_class(frame):\n    \"\"\"\n    Get a frame class from the input `frame`, which could be a frame name\n    string, or frame class.\n    \"\"\"\n\n    if isinstance(frame, str):\n        frame_names = frame_transform_graph.get_names()\n        if frame not in frame_names:\n            raise ValueError('Coordinate frame name \"{}\" is not a known '\n                             'coordinate frame ({})'\n                             .format(frame, sorted(frame_names)))\n        frame_cls = frame_transform_graph.lookup_name(frame)\n\n    elif inspect.isclass(frame) and issubclass(frame, BaseCoordinateFrame):\n        frame_cls = frame\n\n    else:\n        raise ValueError(\"Coordinate frame must be a frame name or frame \"\n                         \"class, not a '{}'\".format(frame.__class__.__name__))\n\n    return frame_cls"},{"col":0,"comment":"\n    Get the data from an HDU of a FITS file (and optionally the\n    header).\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        File to get data from.  If opened, mode must be one of the\n        following rb, rb+, or ab+.\n\n    ext\n        The rest of the arguments are for HDU specification.\n        They are flexible and are best illustrated by examples.\n\n        No extra arguments implies the primary HDU::\n\n            getdata('in.fits')\n\n        .. note::\n            Exclusive to ``getdata``: if ``ext`` is not specified\n            and primary header contains no data, ``getdata`` attempts\n            to retrieve data from first extension HDU.\n\n        By HDU number::\n\n            getdata('in.fits', 0)      # the primary HDU\n            getdata('in.fits', 2)      # the second extension HDU\n            getdata('in.fits', ext=2)  # the second extension HDU\n\n        By name, i.e., ``EXTNAME`` value (if unique)::\n\n            getdata('in.fits', 'sci')\n            getdata('in.fits', extname='sci')  # equivalent\n\n        Note ``EXTNAME`` values are not case sensitive\n\n        By combination of ``EXTNAME`` and EXTVER`` as separate\n        arguments or as a tuple::\n\n            getdata('in.fits', 'sci', 2)  # EXTNAME='SCI' & EXTVER=2\n            getdata('in.fits', extname='sci', extver=2)  # equivalent\n            getdata('in.fits', ('sci', 2))  # equivalent\n\n        Ambiguous or conflicting specifications will raise an exception::\n\n            getdata('in.fits', ext=('sci',1), extname='err', extver=2)\n\n    header : bool, optional\n        If `True`, return the data and the header of the specified HDU as a\n        tuple.\n\n    lower, upper : bool, optional\n        If ``lower`` or ``upper`` are `True`, the field names in the\n        returned data object will be converted to lower or upper case,\n        respectively.\n\n    view : ndarray, optional\n        When given, the data will be returned wrapped in the given ndarray\n        subclass by calling::\n\n           data.view(view)\n\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n\n    Returns\n    -------\n    array : ndarray or `~numpy.recarray` or `~astropy.io.fits.Group`\n        Type depends on the type of the extension being referenced.\n\n        If the optional keyword ``header`` is set to `True`, this\n        function will return a (``data``, ``header``) tuple.\n\n    Raises\n    ------\n    IndexError\n        If no data is found in searched HDUs.\n    ","endLoc":251,"header":"def getdata(filename, *args, header=None, lower=None, upper=None, view=None,\n            **kwargs)","id":2381,"name":"getdata","nodeType":"Function","startLoc":113,"text":"def getdata(filename, *args, header=None, lower=None, upper=None, view=None,\n            **kwargs):\n    \"\"\"\n    Get the data from an HDU of a FITS file (and optionally the\n    header).\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        File to get data from.  If opened, mode must be one of the\n        following rb, rb+, or ab+.\n\n    ext\n        The rest of the arguments are for HDU specification.\n        They are flexible and are best illustrated by examples.\n\n        No extra arguments implies the primary HDU::\n\n            getdata('in.fits')\n\n        .. note::\n            Exclusive to ``getdata``: if ``ext`` is not specified\n            and primary header contains no data, ``getdata`` attempts\n            to retrieve data from first extension HDU.\n\n        By HDU number::\n\n            getdata('in.fits', 0)      # the primary HDU\n            getdata('in.fits', 2)      # the second extension HDU\n            getdata('in.fits', ext=2)  # the second extension HDU\n\n        By name, i.e., ``EXTNAME`` value (if unique)::\n\n            getdata('in.fits', 'sci')\n            getdata('in.fits', extname='sci')  # equivalent\n\n        Note ``EXTNAME`` values are not case sensitive\n\n        By combination of ``EXTNAME`` and EXTVER`` as separate\n        arguments or as a tuple::\n\n            getdata('in.fits', 'sci', 2)  # EXTNAME='SCI' & EXTVER=2\n            getdata('in.fits', extname='sci', extver=2)  # equivalent\n            getdata('in.fits', ('sci', 2))  # equivalent\n\n        Ambiguous or conflicting specifications will raise an exception::\n\n            getdata('in.fits', ext=('sci',1), extname='err', extver=2)\n\n    header : bool, optional\n        If `True`, return the data and the header of the specified HDU as a\n        tuple.\n\n    lower, upper : bool, optional\n        If ``lower`` or ``upper`` are `True`, the field names in the\n        returned data object will be converted to lower or upper case,\n        respectively.\n\n    view : ndarray, optional\n        When given, the data will be returned wrapped in the given ndarray\n        subclass by calling::\n\n           data.view(view)\n\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n\n    Returns\n    -------\n    array : ndarray or `~numpy.recarray` or `~astropy.io.fits.Group`\n        Type depends on the type of the extension being referenced.\n\n        If the optional keyword ``header`` is set to `True`, this\n        function will return a (``data``, ``header``) tuple.\n\n    Raises\n    ------\n    IndexError\n        If no data is found in searched HDUs.\n    \"\"\"\n\n    mode, closed = _get_file_mode(filename)\n\n    ext = kwargs.get('ext')\n    extname = kwargs.get('extname')\n    extver = kwargs.get('extver')\n    ext_given = not (len(args) == 0 and ext is None and\n                     extname is None and extver is None)\n\n    hdulist, extidx = _getext(filename, mode, *args, **kwargs)\n    try:\n        hdu = hdulist[extidx]\n        data = hdu.data\n        if data is None:\n            if ext_given:\n                raise IndexError(f\"No data in HDU #{extidx}.\")\n\n            # fallback to the first extension HDU\n            if len(hdulist) == 1:\n                raise IndexError(\n                    \"No data in Primary HDU and no extension HDU found.\"\n                    )\n            hdu = hdulist[1]\n            data = hdu.data\n            if data is None:\n                raise IndexError(\n                    \"No data in either Primary or first extension HDUs.\"\n                    )\n\n        if header:\n            hdr = hdu.header\n    finally:\n        hdulist.close(closed=closed)\n\n    # Change case of names if requested\n    trans = None\n    if lower:\n        trans = operator.methodcaller('lower')\n    elif upper:\n        trans = operator.methodcaller('upper')\n    if trans:\n        if data.dtype.names is None:\n            # this data does not have fields\n            return\n        if data.dtype.descr[0][0] == '':\n            # this data does not have fields\n            return\n        data.dtype.names = [trans(n) for n in data.dtype.names]\n\n    # allow different views into the underlying ndarray.  Keep the original\n    # view just in case there is a problem\n    if isinstance(view, type) and issubclass(view, np.ndarray):\n        data = data.view(view)\n\n    if header:\n        return data, hdr\n    else:\n        return data"},{"col":0,"comment":"\n    Return a valid differential class from ``value`` or raise exception.\n\n    As originally created, this is only used in the SkyCoord initializer, so if\n    that is refactored, this function my no longer be necessary.\n    ","endLoc":70,"header":"def _get_diff_cls(value)","id":2382,"name":"_get_diff_cls","nodeType":"Function","startLoc":54,"text":"def _get_diff_cls(value):\n    \"\"\"\n    Return a valid differential class from ``value`` or raise exception.\n\n    As originally created, this is only used in the SkyCoord initializer, so if\n    that is refactored, this function my no longer be necessary.\n    \"\"\"\n\n    if value in r.DIFFERENTIAL_CLASSES:\n        value = r.DIFFERENTIAL_CLASSES[value]\n    elif (not isinstance(value, type) or\n          not issubclass(value, r.BaseDifferential)):\n        raise ValueError(\n            'Differential is {!r} but must be a BaseDifferential class '\n            'or one of the string aliases {}'.format(\n                value, list(r.DIFFERENTIAL_CLASSES)))\n    return value"},{"col":0,"comment":"\n    Merge the ``left`` and ``right`` metadata objects.\n\n    This is a simplistic and limited implementation at this point.\n    ","endLoc":368,"header":"def merge(left, right, merge_func=None, metadata_conflicts='warn',\n          warn_str_func=_warn_str_func,\n          error_str_func=_error_str_func)","id":2383,"name":"merge","nodeType":"Function","startLoc":303,"text":"def merge(left, right, merge_func=None, metadata_conflicts='warn',\n          warn_str_func=_warn_str_func,\n          error_str_func=_error_str_func):\n    \"\"\"\n    Merge the ``left`` and ``right`` metadata objects.\n\n    This is a simplistic and limited implementation at this point.\n    \"\"\"\n    if not _both_isinstance(left, right, dict):\n        raise MergeConflictError('Can only merge two dict-based objects')\n\n    out = deepcopy(left)\n\n    for key, val in right.items():\n        # If no conflict then insert val into out dict and continue\n        if key not in out:\n            out[key] = deepcopy(val)\n            continue\n\n        # There is a conflict that must be resolved\n        if _both_isinstance(left[key], right[key], dict):\n            out[key] = merge(left[key], right[key], merge_func,\n                             metadata_conflicts=metadata_conflicts)\n\n        else:\n            try:\n                if merge_func is None:\n                    for left_type, right_type, merge_cls in MERGE_STRATEGIES:\n                        if not merge_cls.enabled:\n                            continue\n                        if (isinstance(left[key], left_type) and\n                                isinstance(right[key], right_type)):\n                            out[key] = merge_cls.merge(left[key], right[key])\n                            break\n                    else:\n                        raise MergeConflictError\n                else:\n                    out[key] = merge_func(left[key], right[key])\n            except MergeConflictError:\n\n                # Pick the metadata item that is not None, or they are both not\n                # None, then if they are equal, there is no conflict, and if\n                # they are different, there is a conflict and we pick the one\n                # on the right (or raise an error).\n\n                if left[key] is None:\n                    # This may not seem necessary since out[key] gets set to\n                    # right[key], but not all objects support != which is\n                    # needed for one of the if clauses.\n                    out[key] = right[key]\n                elif right[key] is None:\n                    out[key] = left[key]\n                elif _not_equal(left[key], right[key]):\n                    if metadata_conflicts == 'warn':\n                        warnings.warn(warn_str_func(key, left[key], right[key]),\n                                      MergeConflictWarning)\n                    elif metadata_conflicts == 'error':\n                        raise MergeConflictError(error_str_func(key, left[key], right[key]))\n                    elif metadata_conflicts != 'silent':\n                        raise ValueError('metadata_conflicts argument must be one '\n                                         'of \"silent\", \"warn\", or \"error\"')\n                    out[key] = right[key]\n                else:\n                    out[key] = right[key]\n\n    return out"},{"col":0,"comment":"\n    Extract coordinate data from the args and kwargs passed to SkyCoord.\n\n    By this point, we assume that all of the frame attributes have been\n    extracted from kwargs (see _get_frame_without_data()), so all that are left\n    are (1) extra SkyCoord attributes, and (2) the coordinate data, specified in\n    any of the valid ways.\n    ","endLoc":325,"header":"def _parse_coordinate_data(frame, args, kwargs)","id":2384,"name":"_parse_coordinate_data","nodeType":"Function","startLoc":211,"text":"def _parse_coordinate_data(frame, args, kwargs):\n    \"\"\"\n    Extract coordinate data from the args and kwargs passed to SkyCoord.\n\n    By this point, we assume that all of the frame attributes have been\n    extracted from kwargs (see _get_frame_without_data()), so all that are left\n    are (1) extra SkyCoord attributes, and (2) the coordinate data, specified in\n    any of the valid ways.\n    \"\"\"\n    valid_skycoord_kwargs = {}\n    valid_components = {}\n    info = None\n\n    # Look through the remaining kwargs to see if any are valid attribute names\n    # by asking the frame transform graph:\n    attr_names = list(kwargs.keys())\n    for attr in attr_names:\n        if attr in frame_transform_graph.frame_attributes:\n            valid_skycoord_kwargs[attr] = kwargs.pop(attr)\n\n    # By this point in parsing the arguments, anything left in the args and\n    # kwargs should be data. Either as individual components, or a list of\n    # objects, or a representation, etc.\n\n    # Get units of components\n    units = _get_representation_component_units(args, kwargs)\n\n    # Grab any frame-specific attr names like `ra` or `l` or `distance` from\n    # kwargs and move them to valid_components.\n    valid_components.update(_get_representation_attrs(frame, units, kwargs))\n\n    # Error if anything is still left in kwargs\n    if kwargs:\n        # The next few lines add a more user-friendly error message to a\n        # common and confusing situation when the user specifies, e.g.,\n        # `pm_ra` when they really should be passing `pm_ra_cosdec`. The\n        # extra error should only turn on when the positional representation\n        # is spherical, and when the component 'pm_<lon>' is passed.\n        pm_message = ''\n        if frame.representation_type == SphericalRepresentation:\n            frame_names = list(frame.get_representation_component_names().keys())\n            lon_name = frame_names[0]\n            lat_name = frame_names[1]\n\n            if f'pm_{lon_name}' in list(kwargs.keys()):\n                pm_message = ('\\n\\n By default, most frame classes expect '\n                              'the longitudinal proper motion to include '\n                              'the cos(latitude) term, named '\n                              '`pm_{}_cos{}`. Did you mean to pass in '\n                              'this component?'\n                              .format(lon_name, lat_name))\n\n        raise ValueError('Unrecognized keyword argument(s) {}{}'\n                         .format(', '.join(f\"'{key}'\"\n                                           for key in kwargs),\n                                 pm_message))\n\n    # Finally deal with the unnamed args.  This figures out what the arg[0]\n    # is and returns a dict with appropriate key/values for initializing\n    # frame class. Note that differentials are *never* valid args, only\n    # kwargs.  So they are not accounted for here (unless they're in a frame\n    # or SkyCoord object)\n    if args:\n        if len(args) == 1:\n            # One arg which must be a coordinate.  In this case coord_kwargs\n            # will contain keys like 'ra', 'dec', 'distance' along with any\n            # frame attributes like equinox or obstime which were explicitly\n            # specified in the coordinate object (i.e. non-default).\n            _skycoord_kwargs, _components = _parse_coordinate_arg(\n                args[0], frame, units, kwargs)\n\n            # Copy other 'info' attr only if it has actually been defined.\n            if 'info' in getattr(args[0], '__dict__', ()):\n                info = args[0].info\n\n        elif len(args) <= 3:\n            _skycoord_kwargs = {}\n            _components = {}\n\n            frame_attr_names = frame.representation_component_names.keys()\n            repr_attr_names = frame.representation_component_names.values()\n\n            for arg, frame_attr_name, repr_attr_name, unit in zip(args, frame_attr_names,\n                                                                  repr_attr_names, units):\n                attr_class = frame.representation_type.attr_classes[repr_attr_name]\n                _components[frame_attr_name] = attr_class(arg, unit=unit)\n\n        else:\n            raise ValueError('Must supply no more than three positional arguments, got {}'\n                             .format(len(args)))\n\n        # The next two loops copy the component and skycoord attribute data into\n        # their final, respective \"valid_\" dictionaries. For each, we check that\n        # there are no relevant conflicts with values specified by the user\n        # through other means:\n\n        # First validate the component data\n        for attr, coord_value in _components.items():\n            if attr in valid_components:\n                raise ValueError(_conflict_err_msg\n                                 .format(attr, coord_value,\n                                         valid_components[attr], 'SkyCoord'))\n            valid_components[attr] = coord_value\n\n        # Now validate the custom SkyCoord attributes\n        for attr, value in _skycoord_kwargs.items():\n            if (attr in valid_skycoord_kwargs and\n                    np.any(valid_skycoord_kwargs[attr] != value)):\n                raise ValueError(_conflict_err_msg\n                                 .format(attr, value,\n                                         valid_skycoord_kwargs[attr],\n                                         'SkyCoord'))\n            valid_skycoord_kwargs[attr] = value\n\n    return valid_skycoord_kwargs, valid_components, info"},{"col":0,"comment":"\n    Get the unit from kwargs for the *representation* components (not the\n    differentials).\n    ","endLoc":356,"header":"def _get_representation_component_units(args, kwargs)","id":2385,"name":"_get_representation_component_units","nodeType":"Function","startLoc":328,"text":"def _get_representation_component_units(args, kwargs):\n    \"\"\"\n    Get the unit from kwargs for the *representation* components (not the\n    differentials).\n    \"\"\"\n    if 'unit' not in kwargs:\n        units = [None, None, None]\n\n    else:\n        units = kwargs.pop('unit')\n\n        if isinstance(units, str):\n            units = [x.strip() for x in units.split(',')]\n            # Allow for input like unit='deg' or unit='m'\n            if len(units) == 1:\n                units = [units[0], units[0], units[0]]\n        elif isinstance(units, (Unit, IrreducibleUnit)):\n            units = [units, units, units]\n\n        try:\n            units = [(Unit(x) if x else None) for x in units]\n            units.extend(None for x in range(3 - len(units)))\n            if len(units) > 3:\n                raise ValueError()\n        except Exception as err:\n            raise ValueError('Unit keyword must have one to three unit values as '\n                             'tuple or comma-separated string.') from err\n\n    return units"},{"col":4,"comment":"null","endLoc":691,"header":"@property\n    def name(self)","id":2386,"name":"name","nodeType":"Function","startLoc":686,"text":"@property\n    def name(self):\n        # Convert the value to a string to be flexible in some pathological\n        # cases (see ticket #96)\n        # Similar to base class but uses .header rather than ._header\n        return str(self.header.get('EXTNAME', self._default_name))"},{"col":0,"comment":"\n    Get a keyword's value from a header in a FITS file.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        Name of the FITS file, or file object (if opened, mode must be\n        one of the following rb, rb+, or ab+).\n\n    keyword : str\n        Keyword name\n\n    ext, extname, extver\n        The rest of the arguments are for HDU specification.\n        See `getdata` for explanations/examples.\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n        *Note:* This function automatically specifies ``do_not_scale_image_data\n        = True`` when opening the file so that values can be retrieved from the\n        unmodified header.\n\n    Returns\n    -------\n    keyword value : str, int, or float\n    ","endLoc":286,"header":"def getval(filename, keyword, *args, **kwargs)","id":2387,"name":"getval","nodeType":"Function","startLoc":254,"text":"def getval(filename, keyword, *args, **kwargs):\n    \"\"\"\n    Get a keyword's value from a header in a FITS file.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        Name of the FITS file, or file object (if opened, mode must be\n        one of the following rb, rb+, or ab+).\n\n    keyword : str\n        Keyword name\n\n    ext, extname, extver\n        The rest of the arguments are for HDU specification.\n        See `getdata` for explanations/examples.\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n        *Note:* This function automatically specifies ``do_not_scale_image_data\n        = True`` when opening the file so that values can be retrieved from the\n        unmodified header.\n\n    Returns\n    -------\n    keyword value : str, int, or float\n    \"\"\"\n\n    if 'do_not_scale_image_data' not in kwargs:\n        kwargs['do_not_scale_image_data'] = True\n\n    hdr = getheader(filename, *args, **kwargs)\n    return hdr[keyword]"},{"col":0,"comment":"\n    Set a keyword's value from a header in a FITS file.\n\n    If the keyword already exists, it's value/comment will be updated.\n    If it does not exist, a new card will be created and it will be\n    placed before or after the specified location.  If no ``before`` or\n    ``after`` is specified, it will be appended at the end.\n\n    When updating more than one keyword in a file, this convenience\n    function is a much less efficient approach compared with opening\n    the file for update, modifying the header, and closing the file.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        Name of the FITS file, or file object If opened, mode must be update\n        (rb+).  An opened file object or `~gzip.GzipFile` object will be closed\n        upon return.\n\n    keyword : str\n        Keyword name\n\n    value : str, int, float, optional\n        Keyword value (default: `None`, meaning don't modify)\n\n    comment : str, optional\n        Keyword comment, (default: `None`, meaning don't modify)\n\n    before : str, int, optional\n        Name of the keyword, or index of the card before which the new card\n        will be placed.  The argument ``before`` takes precedence over\n        ``after`` if both are specified (default: `None`).\n\n    after : str, int, optional\n        Name of the keyword, or index of the card after which the new card will\n        be placed. (default: `None`).\n\n    savecomment : bool, optional\n        When `True`, preserve the current comment for an existing keyword.  The\n        argument ``savecomment`` takes precedence over ``comment`` if both\n        specified.  If ``comment`` is not specified then the current comment\n        will automatically be preserved  (default: `False`).\n\n    ext, extname, extver\n        The rest of the arguments are for HDU specification.\n        See `getdata` for explanations/examples.\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n        *Note:* This function automatically specifies ``do_not_scale_image_data\n        = True`` when opening the file so that values can be retrieved from the\n        unmodified header.\n    ","endLoc":355,"header":"def setval(filename, keyword, *args, value=None, comment=None, before=None,\n           after=None, savecomment=False, **kwargs)","id":2388,"name":"setval","nodeType":"Function","startLoc":289,"text":"def setval(filename, keyword, *args, value=None, comment=None, before=None,\n           after=None, savecomment=False, **kwargs):\n    \"\"\"\n    Set a keyword's value from a header in a FITS file.\n\n    If the keyword already exists, it's value/comment will be updated.\n    If it does not exist, a new card will be created and it will be\n    placed before or after the specified location.  If no ``before`` or\n    ``after`` is specified, it will be appended at the end.\n\n    When updating more than one keyword in a file, this convenience\n    function is a much less efficient approach compared with opening\n    the file for update, modifying the header, and closing the file.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        Name of the FITS file, or file object If opened, mode must be update\n        (rb+).  An opened file object or `~gzip.GzipFile` object will be closed\n        upon return.\n\n    keyword : str\n        Keyword name\n\n    value : str, int, float, optional\n        Keyword value (default: `None`, meaning don't modify)\n\n    comment : str, optional\n        Keyword comment, (default: `None`, meaning don't modify)\n\n    before : str, int, optional\n        Name of the keyword, or index of the card before which the new card\n        will be placed.  The argument ``before`` takes precedence over\n        ``after`` if both are specified (default: `None`).\n\n    after : str, int, optional\n        Name of the keyword, or index of the card after which the new card will\n        be placed. (default: `None`).\n\n    savecomment : bool, optional\n        When `True`, preserve the current comment for an existing keyword.  The\n        argument ``savecomment`` takes precedence over ``comment`` if both\n        specified.  If ``comment`` is not specified then the current comment\n        will automatically be preserved  (default: `False`).\n\n    ext, extname, extver\n        The rest of the arguments are for HDU specification.\n        See `getdata` for explanations/examples.\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n        *Note:* This function automatically specifies ``do_not_scale_image_data\n        = True`` when opening the file so that values can be retrieved from the\n        unmodified header.\n    \"\"\"\n\n    if 'do_not_scale_image_data' not in kwargs:\n        kwargs['do_not_scale_image_data'] = True\n\n    closed = fileobj_closed(filename)\n    hdulist, extidx = _getext(filename, 'update', *args, **kwargs)\n    try:\n        if keyword in hdulist[extidx].header and savecomment:\n            comment = None\n        hdulist[extidx].header.set(keyword, value, comment, before, after)\n    finally:\n        hdulist.close(closed=closed)"},{"col":0,"comment":"\n    Delete all instances of keyword from a header in a FITS file.\n\n    Parameters\n    ----------\n\n    filename : path-like or file-like\n        Name of the FITS file, or file object If opened, mode must be update\n        (rb+).  An opened file object or `~gzip.GzipFile` object will be closed\n        upon return.\n\n    keyword : str, int\n        Keyword name or index\n\n    ext, extname, extver\n        The rest of the arguments are for HDU specification.\n        See `getdata` for explanations/examples.\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n        *Note:* This function automatically specifies ``do_not_scale_image_data\n        = True`` when opening the file so that values can be retrieved from the\n        unmodified header.\n    ","endLoc":392,"header":"def delval(filename, keyword, *args, **kwargs)","id":2389,"name":"delval","nodeType":"Function","startLoc":358,"text":"def delval(filename, keyword, *args, **kwargs):\n    \"\"\"\n    Delete all instances of keyword from a header in a FITS file.\n\n    Parameters\n    ----------\n\n    filename : path-like or file-like\n        Name of the FITS file, or file object If opened, mode must be update\n        (rb+).  An opened file object or `~gzip.GzipFile` object will be closed\n        upon return.\n\n    keyword : str, int\n        Keyword name or index\n\n    ext, extname, extver\n        The rest of the arguments are for HDU specification.\n        See `getdata` for explanations/examples.\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n        *Note:* This function automatically specifies ``do_not_scale_image_data\n        = True`` when opening the file so that values can be retrieved from the\n        unmodified header.\n    \"\"\"\n\n    if 'do_not_scale_image_data' not in kwargs:\n        kwargs['do_not_scale_image_data'] = True\n\n    closed = fileobj_closed(filename)\n    hdulist, extidx = _getext(filename, 'update', *args, **kwargs)\n    try:\n        del hdulist[extidx].header[keyword]\n    finally:\n        hdulist.close(closed=closed)"},{"col":0,"comment":"null","endLoc":205,"header":"def _both_isinstance(left, right, cls)","id":2390,"name":"_both_isinstance","nodeType":"Function","startLoc":204,"text":"def _both_isinstance(left, right, cls):\n    return isinstance(left, cls) and isinstance(right, cls)"},{"col":0,"comment":"\n    Create a new FITS file using the supplied data/header.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        File to write to.  If opened, must be opened in a writable binary\n        mode such as 'wb' or 'ab+'.\n\n    data : array or `~numpy.recarray` or `~astropy.io.fits.Group`\n        data to write to the new file\n\n    header : `Header` object, optional\n        the header associated with ``data``. If `None`, a header\n        of the appropriate type is created for the supplied data. This\n        argument is optional.\n\n    output_verify : str\n        Output verification option.  Must be one of ``\"fix\"``, ``\"silentfix\"``,\n        ``\"ignore\"``, ``\"warn\"``, or ``\"exception\"``.  May also be any\n        combination of ``\"fix\"`` or ``\"silentfix\"`` with ``\"+ignore\"``,\n        ``+warn``, or ``+exception\" (e.g. ``\"fix+warn\"``).  See\n        :ref:`astropy:verify` for more info.\n\n    overwrite : bool, optional\n        If ``True``, overwrite the output file if it exists. Raises an\n        ``OSError`` if ``False`` and the output file exists. Default is\n        ``False``.\n\n    checksum : bool, optional\n        If `True`, adds both ``DATASUM`` and ``CHECKSUM`` cards to the\n        headers of all HDU's written to the file.\n    ","endLoc":435,"header":"def writeto(filename, data, header=None, output_verify='exception',\n            overwrite=False, checksum=False)","id":2391,"name":"writeto","nodeType":"Function","startLoc":395,"text":"def writeto(filename, data, header=None, output_verify='exception',\n            overwrite=False, checksum=False):\n    \"\"\"\n    Create a new FITS file using the supplied data/header.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        File to write to.  If opened, must be opened in a writable binary\n        mode such as 'wb' or 'ab+'.\n\n    data : array or `~numpy.recarray` or `~astropy.io.fits.Group`\n        data to write to the new file\n\n    header : `Header` object, optional\n        the header associated with ``data``. If `None`, a header\n        of the appropriate type is created for the supplied data. This\n        argument is optional.\n\n    output_verify : str\n        Output verification option.  Must be one of ``\"fix\"``, ``\"silentfix\"``,\n        ``\"ignore\"``, ``\"warn\"``, or ``\"exception\"``.  May also be any\n        combination of ``\"fix\"`` or ``\"silentfix\"`` with ``\"+ignore\"``,\n        ``+warn``, or ``+exception\" (e.g. ``\"fix+warn\"``).  See\n        :ref:`astropy:verify` for more info.\n\n    overwrite : bool, optional\n        If ``True``, overwrite the output file if it exists. Raises an\n        ``OSError`` if ``False`` and the output file exists. Default is\n        ``False``.\n\n    checksum : bool, optional\n        If `True`, adds both ``DATASUM`` and ``CHECKSUM`` cards to the\n        headers of all HDU's written to the file.\n    \"\"\"\n\n    hdu = _makehdu(data, header)\n    if hdu.is_image and not isinstance(hdu, PrimaryHDU):\n        hdu = PrimaryHDU(data, header=header)\n    hdu.writeto(filename, overwrite=overwrite, output_verify=output_verify,\n                checksum=checksum)"},{"col":0,"comment":"null","endLoc":1090,"header":"def _makehdu(data, header)","id":2392,"name":"_makehdu","nodeType":"Function","startLoc":1076,"text":"def _makehdu(data, header):\n    if header is None:\n        header = Header()\n    hdu = _BaseHDU._from_data(data, header)\n    if hdu.__class__ in (_BaseHDU, _ValidHDU):\n        # The HDU type was unrecognized, possibly due to a\n        # nonexistent/incomplete header\n        if ((isinstance(data, np.ndarray) and data.dtype.fields is not None) or\n                isinstance(data, np.recarray)):\n            hdu = BinTableHDU(data, header=header)\n        elif isinstance(data, np.ndarray) or _is_dask_array(data):\n            hdu = ImageHDU(data, header=header)\n        else:\n            raise KeyError('Data must be a numpy array.')\n    return hdu"},{"col":4,"comment":"null","endLoc":704,"header":"@name.setter\n    def name(self, value)","id":2393,"name":"name","nodeType":"Function","startLoc":693,"text":"@name.setter\n    def name(self, value):\n        # This is a copy of the base class but using .header instead\n        # of ._header to ensure that the name stays in sync.\n        if not isinstance(value, str):\n            raise TypeError(\"'name' attribute must be a string\")\n        if not conf.extension_name_case_sensitive:\n            value = value.upper()\n        if 'EXTNAME' in self.header:\n            self.header['EXTNAME'] = value\n        else:\n            self.header['EXTNAME'] = (value, 'extension name')"},{"col":4,"comment":"null","endLoc":732,"header":"@classmethod\n    def match_header(cls, header)","id":2394,"name":"match_header","nodeType":"Function","startLoc":706,"text":"@classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        if card.keyword != 'XTENSION':\n            return False\n\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n\n        if xtension not in ('BINTABLE', 'A3DTABLE'):\n            return False\n\n        if 'ZIMAGE' not in header or not header['ZIMAGE']:\n            return False\n\n        if COMPRESSION_SUPPORTED and COMPRESSION_ENABLED:\n            return True\n        elif not COMPRESSION_SUPPORTED:\n            warnings.warn('Failure matching header to a compressed image '\n                          'HDU: The compression module is not available.\\n'\n                          'The HDU will be treated as a Binary Table HDU.',\n                          AstropyUserWarning)\n            return False\n        else:\n            # Compression is supported but disabled; just pass silently (#92)\n            return False"},{"col":4,"comment":"null","endLoc":1424,"header":"@lazyproperty\n    def data(self)","id":2395,"name":"data","nodeType":"Function","startLoc":1383,"text":"@lazyproperty\n    def data(self):\n        # The data attribute is the image data (not the table data).\n        data = compression.decompress_hdu(self)\n\n        if data is None:\n            return data\n\n        # Scale the data if necessary\n        if (self._orig_bzero != 0 or self._orig_bscale != 1):\n            new_dtype = self._dtype_for_bitpix()\n            data = np.array(data, dtype=new_dtype)\n\n            zblank = None\n\n            if 'ZBLANK' in self.compressed_data.columns.names:\n                zblank = self.compressed_data['ZBLANK']\n            else:\n                if 'ZBLANK' in self._header:\n                    zblank = np.array(self._header['ZBLANK'], dtype='int32')\n                elif 'BLANK' in self._header:\n                    zblank = np.array(self._header['BLANK'], dtype='int32')\n\n            if zblank is not None:\n                blanks = (data == zblank)\n\n            if self._bscale != 1:\n                np.multiply(data, self._bscale, data)\n            if self._bzero != 0:\n                # We have to explicitly cast self._bzero to prevent numpy from\n                # raising an error when doing self.data += self._bzero, and we\n                # do this instead of self.data = self.data + self._bzero to\n                # avoid doubling memory usage.\n                np.add(data, self._bzero, out=data, casting='unsafe')\n\n            if zblank is not None:\n                data = np.where(blanks, np.nan, data)\n\n        # Right out of _ImageBaseHDU.data\n        self._update_header_scale_info(data.dtype)\n\n        return data"},{"col":0,"comment":"\n    Find instances of the \"representation attributes\" for specifying data\n    for this frame.  Pop them off of kwargs, run through the appropriate class\n    constructor (to validate and apply unit), and put into the output\n    valid_kwargs.  \"Representation attributes\" are the frame-specific aliases\n    for the underlying data values in the representation, e.g. \"ra\" for \"lon\"\n    for many equatorial spherical representations, or \"w\" for \"x\" in the\n    cartesian representation of Galactic.\n\n    This also gets any *differential* kwargs, because they go into the same\n    frame initializer later on.\n    ","endLoc":610,"header":"def _get_representation_attrs(frame, units, kwargs)","id":2396,"name":"_get_representation_attrs","nodeType":"Function","startLoc":567,"text":"def _get_representation_attrs(frame, units, kwargs):\n    \"\"\"\n    Find instances of the \"representation attributes\" for specifying data\n    for this frame.  Pop them off of kwargs, run through the appropriate class\n    constructor (to validate and apply unit), and put into the output\n    valid_kwargs.  \"Representation attributes\" are the frame-specific aliases\n    for the underlying data values in the representation, e.g. \"ra\" for \"lon\"\n    for many equatorial spherical representations, or \"w\" for \"x\" in the\n    cartesian representation of Galactic.\n\n    This also gets any *differential* kwargs, because they go into the same\n    frame initializer later on.\n    \"\"\"\n    frame_attr_names = frame.representation_component_names.keys()\n    repr_attr_classes = frame.representation_type.attr_classes.values()\n\n    valid_kwargs = {}\n    for frame_attr_name, repr_attr_class, unit in zip(frame_attr_names, repr_attr_classes, units):\n        value = kwargs.pop(frame_attr_name, None)\n        if value is not None:\n            try:\n                valid_kwargs[frame_attr_name] = repr_attr_class(value, unit=unit)\n            except u.UnitConversionError as err:\n                error_message = (\n                    f\"Unit '{unit}' ({unit.physical_type}) could not be applied to '{frame_attr_name}'. \"\n                    \"This can occur when passing units for some coordinate components \"\n                    \"when other components are specified as Quantity objects. \"\n                    \"Either pass a list of units for all components (and unit-less coordinate data), \"\n                    \"or pass Quantities for all components.\"\n                )\n                raise u.UnitConversionError(error_message) from err\n\n    # also check the differentials.  They aren't included in the units keyword,\n    # so we only look for the names.\n\n    differential_type = frame.differential_type\n    if differential_type is not None:\n        for frame_name, repr_name in frame.get_representation_component_names('s').items():\n            diff_attr_class = differential_type.attr_classes[repr_name]\n            value = kwargs.pop(frame_name, None)\n            if value is not None:\n                valid_kwargs[frame_name] = diff_attr_class(value)\n\n    return valid_kwargs"},{"col":4,"comment":"\n        Determine the dtype that the data should be converted to depending on\n        the BITPIX value in the header, and possibly on the BSCALE value as\n        well.  Returns None if there should not be any change.\n        ","endLoc":1910,"header":"def _dtype_for_bitpix(self)","id":2397,"name":"_dtype_for_bitpix","nodeType":"Function","startLoc":1891,"text":"def _dtype_for_bitpix(self):\n        \"\"\"\n        Determine the dtype that the data should be converted to depending on\n        the BITPIX value in the header, and possibly on the BSCALE value as\n        well.  Returns None if there should not be any change.\n        \"\"\"\n\n        bitpix = self._orig_bitpix\n        # Handle possible conversion to uints if enabled\n        if self._uint and self._orig_bscale == 1:\n            for bits, dtype in ((16, np.dtype('uint16')),\n                                (32, np.dtype('uint32')),\n                                (64, np.dtype('uint64'))):\n                if bitpix == bits and self._orig_bzero == 1 << (bits - 1):\n                    return dtype\n\n        if bitpix > 16:  # scale integers to Float64\n            return np.dtype('float64')\n        elif bitpix > 0:  # scale integers to Float32\n            return np.dtype('float32')"},{"col":4,"comment":"null","endLoc":1933,"header":"def _update_header_scale_info(self, dtype=None)","id":2398,"name":"_update_header_scale_info","nodeType":"Function","startLoc":1912,"text":"def _update_header_scale_info(self, dtype=None):\n        if (not self._do_not_scale_image_data and\n                not (self._orig_bzero == 0 and self._orig_bscale == 1)):\n            for keyword in ['BSCALE', 'BZERO']:\n                # Make sure to delete from both the image header and the table\n                # header; later this will be streamlined\n                for header in (self.header, self._header):\n                    with suppress(KeyError):\n                        del header[keyword]\n                        # Since _update_header_scale_info can, currently, be\n                        # called *after* _prewriteto(), replace these with\n                        # blank cards so the header size doesn't change\n                        header.append()\n\n            if dtype is None:\n                dtype = self._dtype_for_bitpix()\n            if dtype is not None:\n                self.header['BITPIX'] = DTYPE2BITPIX[dtype.name]\n\n            self._bzero = 0\n            self._bscale = 1\n            self._bitpix = self.header['BITPIX']"},{"col":4,"comment":"Return the gravitational redshift at this EarthLocation.\n\n        Calculates the gravitational redshift, of order 3 m/s, due to the\n        requested solar system bodies.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time`\n            The ``obstime`` to calculate the redshift at.\n\n        bodies : iterable, optional\n            The bodies (other than the Earth) to include in the redshift\n            calculation.  List elements should be any body name\n            `get_body_barycentric` accepts.  Defaults to Jupiter, the Sun, and\n            the Moon.  Earth is always included (because the class represents\n            an *Earth* location).\n\n        masses : dict[str, `~astropy.units.Quantity`], optional\n            The mass or gravitational parameters (G * mass) to assume for the\n            bodies requested in ``bodies``. Can be used to override the\n            defaults for the Sun, Jupiter, the Moon, and the Earth, or to\n            pass in masses for other bodies.\n\n        Returns\n        -------\n        redshift : `~astropy.units.Quantity`\n            Gravitational redshift in velocity units at given obstime.\n        ","endLoc":808,"header":"def gravitational_redshift(self, obstime,\n                               bodies=['sun', 'jupiter', 'moon'],\n                               masses={})","id":2399,"name":"gravitational_redshift","nodeType":"Function","startLoc":742,"text":"def gravitational_redshift(self, obstime,\n                               bodies=['sun', 'jupiter', 'moon'],\n                               masses={}):\n        \"\"\"Return the gravitational redshift at this EarthLocation.\n\n        Calculates the gravitational redshift, of order 3 m/s, due to the\n        requested solar system bodies.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time`\n            The ``obstime`` to calculate the redshift at.\n\n        bodies : iterable, optional\n            The bodies (other than the Earth) to include in the redshift\n            calculation.  List elements should be any body name\n            `get_body_barycentric` accepts.  Defaults to Jupiter, the Sun, and\n            the Moon.  Earth is always included (because the class represents\n            an *Earth* location).\n\n        masses : dict[str, `~astropy.units.Quantity`], optional\n            The mass or gravitational parameters (G * mass) to assume for the\n            bodies requested in ``bodies``. Can be used to override the\n            defaults for the Sun, Jupiter, the Moon, and the Earth, or to\n            pass in masses for other bodies.\n\n        Returns\n        -------\n        redshift : `~astropy.units.Quantity`\n            Gravitational redshift in velocity units at given obstime.\n        \"\"\"\n        # needs to be here to avoid circular imports\n        from .solar_system import get_body_barycentric\n\n        bodies = list(bodies)\n        # Ensure earth is included and last in the list.\n        if 'earth' in bodies:\n            bodies.remove('earth')\n        bodies.append('earth')\n        _masses = {'sun': consts.GM_sun,\n                   'jupiter': consts.GM_jup,\n                   'moon': consts.G * 7.34767309e22*u.kg,\n                   'earth': consts.GM_earth}\n        _masses.update(masses)\n        GMs = []\n        M_GM_equivalency = (u.kg, u.Unit(consts.G * u.kg))\n        for body in bodies:\n            try:\n                GMs.append(_masses[body].to(u.m**3/u.s**2, [M_GM_equivalency]))\n            except KeyError as err:\n                raise KeyError(f'body \"{body}\" does not have a mass.') from err\n            except u.UnitsError as exc:\n                exc.args += ('\"masses\" argument values must be masses or '\n                             'gravitational parameters.',)\n                raise\n\n        positions = [get_body_barycentric(name, obstime) for name in bodies]\n        # Calculate distances to objects other than earth.\n        distances = [(pos - positions[-1]).norm() for pos in positions[:-1]]\n        # Append distance from Earth's center for Earth's contribution.\n        distances.append(CartesianRepresentation(self.geocentric).norm())\n        # Get redshifts due to all objects.\n        redshifts = [-GM / consts.c / distance for (GM, distance) in\n                     zip(GMs, distances)]\n        # Reverse order of summing, to go from small to big, and to get\n        # \"earth\" first, which gives m/s as unit.\n        return sum(redshifts[::-1])"},{"col":4,"comment":"null","endLoc":1432,"header":"@data.setter\n    def data(self, data)","id":2400,"name":"data","nodeType":"Function","startLoc":1426,"text":"@data.setter\n    def data(self, data):\n        if (data is not None) and (not isinstance(data, np.ndarray) or\n                data.dtype.fields is not None):\n            raise TypeError('CompImageHDU data has incorrect type:{}; '\n                            'dtype.fields = {}'.format(\n                    type(data), data.dtype.fields))"},{"col":0,"comment":"null","endLoc":212,"header":"def _not_equal(left, right)","id":2401,"name":"_not_equal","nodeType":"Function","startLoc":208,"text":"def _not_equal(left, right):\n    try:\n        return bool(left != right)\n    except Exception:\n        return True"},{"col":4,"comment":"null","endLoc":1451,"header":"@lazyproperty\n    def compressed_data(self)","id":2402,"name":"compressed_data","nodeType":"Function","startLoc":1434,"text":"@lazyproperty\n    def compressed_data(self):\n        # First we will get the table data (the compressed\n        # data) from the file, if there is any.\n        compressed_data = super().data\n        if isinstance(compressed_data, np.rec.recarray):\n            # Make sure not to use 'del self.data' so we don't accidentally\n            # go through the self.data.fdel and close the mmap underlying\n            # the compressed_data array\n            del self.__dict__['data']\n            return compressed_data\n        else:\n            # This will actually set self.compressed_data with the\n            # pre-allocated space for the compression data; this is something I\n            # might do away with in the future\n            self._update_compressed_data()\n\n        return self.compressed_data"},{"col":4,"comment":"\n        Return the indices which would sort the table according to one or\n        more key columns.  This simply calls the `numpy.argsort` function on\n        the table with the ``order`` parameter set to ``keys``.\n\n        Parameters\n        ----------\n        keys : str or list of str\n            The column name(s) to order the table by\n        kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional\n            Sorting algorithm used by ``numpy.argsort``.\n        reverse : bool\n            Sort in reverse order (default=False)\n\n        Returns\n        -------\n        index_array : ndarray, int\n            Array of indices that sorts the table by the specified key\n            column(s).\n        ","endLoc":3209,"header":"def argsort(self, keys=None, kind=None, reverse=False)","id":2403,"name":"argsort","nodeType":"Function","startLoc":3154,"text":"def argsort(self, keys=None, kind=None, reverse=False):\n        \"\"\"\n        Return the indices which would sort the table according to one or\n        more key columns.  This simply calls the `numpy.argsort` function on\n        the table with the ``order`` parameter set to ``keys``.\n\n        Parameters\n        ----------\n        keys : str or list of str\n            The column name(s) to order the table by\n        kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional\n            Sorting algorithm used by ``numpy.argsort``.\n        reverse : bool\n            Sort in reverse order (default=False)\n\n        Returns\n        -------\n        index_array : ndarray, int\n            Array of indices that sorts the table by the specified key\n            column(s).\n        \"\"\"\n        if isinstance(keys, str):\n            keys = [keys]\n\n        # use index sorted order if possible\n        if keys is not None:\n            index = get_index(self, names=keys)\n            if index is not None:\n                idx = np.asarray(index.sorted_data())\n                return idx[::-1] if reverse else idx\n\n        kwargs = {}\n        if keys:\n            # For multiple keys return a structured array which gets sorted,\n            # while for a single key return a single ndarray.  Sorting a\n            # one-column structured array is slower than ndarray (e.g. a\n            # factor of ~6 for a 10 million long random array), and much slower\n            # for in principle sortable columns like Time, which get stored as\n            # object arrays.\n            if len(keys) > 1:\n                kwargs['order'] = keys\n                data = self.as_array(names=keys)\n            else:\n                data = self[keys[0]]\n        else:\n            # No keys provided so sort on all columns.\n            data = self.as_array()\n\n        if kind:\n            kwargs['kind'] = kind\n\n        # np.argsort will look for a possible .argsort method (e.g., for Time),\n        # and if that fails cast to an array and try sorting that way.\n        idx = np.argsort(data, **kwargs)\n\n        return idx[::-1] if reverse else idx"},{"col":0,"comment":"Calculate the barycentric position of a solar system body.\n\n    Parameters\n    ----------\n    body : str or list of tuple\n        The solar system body for which to calculate positions.  Can also be a\n        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL\n        kernel.\n    time : `~astropy.time.Time`\n        Time of observation.\n    ephemeris : str, optional\n        Ephemeris to use.  By default, use the one set with\n        ``astropy.coordinates.solar_system_ephemeris.set``\n\n    Returns\n    -------\n    position : `~astropy.coordinates.CartesianRepresentation`\n        Barycentric (ICRS) position of the body in cartesian coordinates\n\n    See also\n    --------\n    get_body_barycentric_posvel : to calculate both position and velocity.\n\n    Notes\n    -----\n    {_EPHEMERIS_NOTE}\n    ","endLoc":373,"header":"def get_body_barycentric(body, time, ephemeris=None)","id":2404,"name":"get_body_barycentric","nodeType":"Function","startLoc":344,"text":"def get_body_barycentric(body, time, ephemeris=None):\n    \"\"\"Calculate the barycentric position of a solar system body.\n\n    Parameters\n    ----------\n    body : str or list of tuple\n        The solar system body for which to calculate positions.  Can also be a\n        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL\n        kernel.\n    time : `~astropy.time.Time`\n        Time of observation.\n    ephemeris : str, optional\n        Ephemeris to use.  By default, use the one set with\n        ``astropy.coordinates.solar_system_ephemeris.set``\n\n    Returns\n    -------\n    position : `~astropy.coordinates.CartesianRepresentation`\n        Barycentric (ICRS) position of the body in cartesian coordinates\n\n    See also\n    --------\n    get_body_barycentric_posvel : to calculate both position and velocity.\n\n    Notes\n    -----\n    {_EPHEMERIS_NOTE}\n    \"\"\"\n    return _get_body_barycentric_posvel(body, time, ephemeris,\n                                        get_velocity=False)"},{"col":4,"comment":"\n        Compress the image data so that it may be written to a file.\n        ","endLoc":1710,"header":"def _update_compressed_data(self)","id":2405,"name":"_update_compressed_data","nodeType":"Function","startLoc":1639,"text":"def _update_compressed_data(self):\n        \"\"\"\n        Compress the image data so that it may be written to a file.\n        \"\"\"\n\n        # Check to see that the image_header matches the image data\n        image_bitpix = DTYPE2BITPIX[self.data.dtype.name]\n\n        if image_bitpix != self._orig_bitpix or self.data.shape != self.shape:\n            self._update_header_data(self.header)\n\n        # TODO: This is copied right out of _ImageBaseHDU._writedata_internal;\n        # it would be cool if we could use an internal ImageHDU and use that to\n        # write to a buffer for compression or something. See ticket #88\n        # deal with unsigned integer 16, 32 and 64 data\n        old_data = self.data\n        if _is_pseudo_integer(self.data.dtype):\n            # Convert the unsigned array to signed\n            self.data = np.array(\n                self.data - _pseudo_zero(self.data.dtype),\n                dtype=f'=i{self.data.dtype.itemsize}')\n            should_swap = False\n        else:\n            should_swap = not self.data.dtype.isnative\n\n        if should_swap:\n\n            if self.data.flags.writeable:\n                self.data.byteswap(True)\n            else:\n                # For read-only arrays, there is no way around making\n                # a byteswapped copy of the data.\n                self.data = self.data.byteswap(False)\n\n        try:\n            nrows = self._header['NAXIS2']\n            tbsize = self._header['NAXIS1'] * nrows\n\n            self._header['PCOUNT'] = 0\n            if 'THEAP' in self._header:\n                del self._header['THEAP']\n            self._theap = tbsize\n\n            # First delete the original compressed data, if it exists\n            del self.compressed_data\n\n            # Make sure that the data is contiguous otherwise CFITSIO\n            # will not write the expected data\n            self.data = np.ascontiguousarray(self.data)\n\n            # Compress the data.\n            # The current implementation of compress_hdu assumes the empty\n            # compressed data table has already been initialized in\n            # self.compressed_data, and writes directly to it\n            # compress_hdu returns the size of the heap for the written\n            # compressed image table\n            heapsize, self.compressed_data = compression.compress_hdu(self)\n        finally:\n            # if data was byteswapped return it to its original order\n            if should_swap:\n                self.data.byteswap(True)\n            self.data = old_data\n\n        # CFITSIO will write the compressed data in big-endian order\n        dtype = self.columns.dtype.newbyteorder('>')\n        buf = self.compressed_data\n        compressed_data = buf[:self._theap].view(dtype=dtype,\n                                                 type=np.rec.recarray)\n        self.compressed_data = compressed_data.view(FITS_rec)\n        self.compressed_data._coldefs = self.columns\n        self.compressed_data._heapoffset = self._theap\n        self.compressed_data._heapsize = heapsize"},{"col":0,"comment":"\n    Inputs a table and some subset of its columns as table_copy.\n    List or tuple containing names of columns as names,and returns an index\n    corresponding to this subset or list or None if no such index exists.\n\n    Parameters\n    ----------\n    table : `Table`\n        Input table\n    table_copy : `Table`, optional\n        Subset of the columns in the ``table`` argument\n    names : list, tuple, optional\n        Subset of column names in the ``table`` argument\n\n    Returns\n    -------\n    Index of columns or None\n\n    ","endLoc":639,"header":"def get_index(table, table_copy=None, names=None)","id":2406,"name":"get_index","nodeType":"Function","startLoc":598,"text":"def get_index(table, table_copy=None, names=None):\n    \"\"\"\n    Inputs a table and some subset of its columns as table_copy.\n    List or tuple containing names of columns as names,and returns an index\n    corresponding to this subset or list or None if no such index exists.\n\n    Parameters\n    ----------\n    table : `Table`\n        Input table\n    table_copy : `Table`, optional\n        Subset of the columns in the ``table`` argument\n    names : list, tuple, optional\n        Subset of column names in the ``table`` argument\n\n    Returns\n    -------\n    Index of columns or None\n\n    \"\"\"\n    if names is not None and table_copy is not None:\n        raise ValueError('one and only one argument from \"table_copy\" or'\n                         ' \"names\" is required')\n\n    if names is None and table_copy is None:\n        raise ValueError('one and only one argument from \"table_copy\" or'\n                         ' \"names\" is required')\n\n    if names is not None:\n        names = set(names)\n    else:\n        names = set(table_copy.colnames)\n\n    if not names <= set(table.colnames):\n        raise ValueError(f'{names} is not a subset of table columns')\n\n    for name in names:\n        for index in table[name].info.indices:\n            if set([col.info.name for col in index.columns]) == names:\n                return index\n\n    return None"},{"col":0,"comment":"\n    Single unnamed arg supplied.  This must be:\n    - Coordinate frame with data\n    - Representation\n    - SkyCoord\n    - List or tuple of:\n      - String which splits into two values\n      - Iterable with two values\n      - SkyCoord, frame, or representation objects.\n\n    Returns a dict mapping coordinate attribute names to values (or lists of\n    values)\n    ","endLoc":564,"header":"def _parse_coordinate_arg(coords, frame, units, init_kwargs)","id":2407,"name":"_parse_coordinate_arg","nodeType":"Function","startLoc":359,"text":"def _parse_coordinate_arg(coords, frame, units, init_kwargs):\n    \"\"\"\n    Single unnamed arg supplied.  This must be:\n    - Coordinate frame with data\n    - Representation\n    - SkyCoord\n    - List or tuple of:\n      - String which splits into two values\n      - Iterable with two values\n      - SkyCoord, frame, or representation objects.\n\n    Returns a dict mapping coordinate attribute names to values (or lists of\n    values)\n    \"\"\"\n    from .sky_coordinate import SkyCoord\n\n    is_scalar = False  # Differentiate between scalar and list input\n    # valid_kwargs = {}  # Returned dict of lon, lat, and distance (optional)\n    components = {}\n    skycoord_kwargs = {}\n\n    frame_attr_names = list(frame.representation_component_names.keys())\n    repr_attr_names = list(frame.representation_component_names.values())\n    repr_attr_classes = list(frame.representation_type.attr_classes.values())\n    n_attr_names = len(repr_attr_names)\n\n    # Turn a single string into a list of strings for convenience\n    if isinstance(coords, str):\n        is_scalar = True\n        coords = [coords]\n\n    if isinstance(coords, (SkyCoord, BaseCoordinateFrame)):\n        # Note that during parsing of `frame` it is checked that any coordinate\n        # args have the same frame as explicitly supplied, so don't worry here.\n\n        if not coords.has_data:\n            raise ValueError('Cannot initialize from a frame without coordinate data')\n\n        data = coords.data.represent_as(frame.representation_type)\n\n        values = []  # List of values corresponding to representation attrs\n        repr_attr_name_to_drop = []\n        for repr_attr_name in repr_attr_names:\n            # If coords did not have an explicit distance then don't include in initializers.\n            if (isinstance(coords.data, UnitSphericalRepresentation) and\n                    repr_attr_name == 'distance'):\n                repr_attr_name_to_drop.append(repr_attr_name)\n                continue\n\n            # Get the value from `data` in the eventual representation\n            values.append(getattr(data, repr_attr_name))\n\n        # drop the ones that were skipped because they were distances\n        for nametodrop in repr_attr_name_to_drop:\n            nameidx = repr_attr_names.index(nametodrop)\n            del repr_attr_names[nameidx]\n            del units[nameidx]\n            del frame_attr_names[nameidx]\n            del repr_attr_classes[nameidx]\n\n        if coords.data.differentials and 's' in coords.data.differentials:\n            orig_vel = coords.data.differentials['s']\n            vel = coords.data.represent_as(frame.representation_type, frame.get_representation_cls('s')).differentials['s']\n            for frname, reprname in frame.get_representation_component_names('s').items():\n                if (reprname == 'd_distance' and\n                        not hasattr(orig_vel, reprname) and\n                        'unit' in orig_vel.get_name()):\n                    continue\n                values.append(getattr(vel, reprname))\n                units.append(None)\n                frame_attr_names.append(frname)\n                repr_attr_names.append(reprname)\n                repr_attr_classes.append(vel.attr_classes[reprname])\n\n        for attr in frame_transform_graph.frame_attributes:\n            value = getattr(coords, attr, None)\n            use_value = (isinstance(coords, SkyCoord) or\n                         attr not in coords.get_frame_attr_names())\n            if use_value and value is not None:\n                skycoord_kwargs[attr] = value\n\n    elif isinstance(coords, BaseRepresentation):\n        if coords.differentials and 's' in coords.differentials:\n            diffs = frame.get_representation_cls('s')\n            data = coords.represent_as(frame.representation_type, diffs)\n            values = [getattr(data, repr_attr_name) for repr_attr_name in repr_attr_names]\n            for frname, reprname in frame.get_representation_component_names('s').items():\n                values.append(getattr(data.differentials['s'], reprname))\n                units.append(None)\n                frame_attr_names.append(frname)\n                repr_attr_names.append(reprname)\n                repr_attr_classes.append(data.differentials['s'].attr_classes[reprname])\n\n        else:\n            data = coords.represent_as(frame.representation_type)\n            values = [getattr(data, repr_attr_name) for repr_attr_name in repr_attr_names]\n\n    elif (isinstance(coords, np.ndarray) and coords.dtype.kind in 'if' and\n          coords.ndim == 2 and coords.shape[1] <= 3):\n        # 2-d array of coordinate values.  Handle specially for efficiency.\n        values = coords.transpose()  # Iterates over repr attrs\n\n    elif isinstance(coords, (Sequence, np.ndarray)):\n        # Handles list-like input.\n\n        vals = []\n        is_ra_dec_representation = ('ra' in frame.representation_component_names and\n                                    'dec' in frame.representation_component_names)\n        coord_types = (SkyCoord, BaseCoordinateFrame, BaseRepresentation)\n        if any(isinstance(coord, coord_types) for coord in coords):\n            # this parsing path is used when there are coordinate-like objects\n            # in the list - instead of creating lists of values, we create\n            # SkyCoords from the list elements and then combine them.\n            scs = [SkyCoord(coord, **init_kwargs) for coord in coords]\n\n            # Check that all frames are equivalent\n            for sc in scs[1:]:\n                if not sc.is_equivalent_frame(scs[0]):\n                    raise ValueError(\"List of inputs don't have equivalent \"\n                                     \"frames: {} != {}\".format(sc, scs[0]))\n\n            # Now use the first to determine if they are all UnitSpherical\n            allunitsphrepr = isinstance(scs[0].data, UnitSphericalRepresentation)\n\n            # get the frame attributes from the first coord in the list, because\n            # from the above we know it matches all the others.  First copy over\n            # the attributes that are in the frame itself, then copy over any\n            # extras in the SkyCoord\n            for fattrnm in scs[0].frame.frame_attributes:\n                skycoord_kwargs[fattrnm] = getattr(scs[0].frame, fattrnm)\n            for fattrnm in scs[0]._extra_frameattr_names:\n                skycoord_kwargs[fattrnm] = getattr(scs[0], fattrnm)\n\n            # Now combine the values, to be used below\n            values = []\n            for data_attr_name, repr_attr_name in zip(frame_attr_names, repr_attr_names):\n                if allunitsphrepr and repr_attr_name == 'distance':\n                    # if they are *all* UnitSpherical, don't give a distance\n                    continue\n                data_vals = []\n                for sc in scs:\n                    data_val = getattr(sc, data_attr_name)\n                    data_vals.append(data_val.reshape(1,) if sc.isscalar else data_val)\n                concat_vals = np.concatenate(data_vals)\n                # Hack because np.concatenate doesn't fully work with Quantity\n                if isinstance(concat_vals, u.Quantity):\n                    concat_vals._unit = data_val.unit\n                values.append(concat_vals)\n        else:\n            # none of the elements are \"frame-like\"\n            # turn into a list of lists like [[v1_0, v2_0, v3_0], ... [v1_N, v2_N, v3_N]]\n            for coord in coords:\n                if isinstance(coord, str):\n                    coord1 = coord.split()\n                    if len(coord1) == 6:\n                        coord = (' '.join(coord1[:3]), ' '.join(coord1[3:]))\n                    elif is_ra_dec_representation:\n                        coord = _parse_ra_dec(coord)\n                    else:\n                        coord = coord1\n                vals.append(coord)  # Assumes coord is a sequence at this point\n\n            # Do some basic validation of the list elements: all have a length and all\n            # lengths the same\n            try:\n                n_coords = sorted(set(len(x) for x in vals))\n            except Exception as err:\n                raise ValueError('One or more elements of input sequence '\n                                 'does not have a length.') from err\n\n            if len(n_coords) > 1:\n                raise ValueError('Input coordinate values must have '\n                                 'same number of elements, found {}'.format(n_coords))\n            n_coords = n_coords[0]\n\n            # Must have no more coord inputs than representation attributes\n            if n_coords > n_attr_names:\n                raise ValueError('Input coordinates have {} values but '\n                                 'representation {} only accepts {}'\n                                 .format(n_coords,\n                                         frame.representation_type.get_name(),\n                                         n_attr_names))\n\n            # Now transpose vals to get [(v1_0 .. v1_N), (v2_0 .. v2_N), (v3_0 .. v3_N)]\n            # (ok since we know it is exactly rectangular).  (Note: can't just use zip(*values)\n            # because Longitude et al distinguishes list from tuple so [a1, a2, ..] is needed\n            # while (a1, a2, ..) doesn't work.\n            values = [list(x) for x in zip(*vals)]\n\n            if is_scalar:\n                values = [x[0] for x in values]\n    else:\n        raise ValueError('Cannot parse coordinates from first argument')\n\n    # Finally we have a list of values from which to create the keyword args\n    # for the frame initialization.  Validate by running through the appropriate\n    # class initializer and supply units (which might be None).\n    try:\n        for frame_attr_name, repr_attr_class, value, unit in zip(\n                frame_attr_names, repr_attr_classes, values, units):\n            components[frame_attr_name] = repr_attr_class(value, unit=unit,\n                                                          copy=False)\n    except Exception as err:\n        raise ValueError('Cannot parse first argument data \"{}\" for attribute '\n                         '{}'.format(value, frame_attr_name)) from err\n    return skycoord_kwargs, components"},{"col":0,"comment":"Calculate the barycentric position (and velocity) of a solar system body.\n\n    Parameters\n    ----------\n    body : str or other\n        The solar system body for which to calculate positions.  Can also be a\n        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL\n        kernel.\n    time : `~astropy.time.Time`\n        Time of observation.\n    ephemeris : str, optional\n        Ephemeris to use.  By default, use the one set with\n        ``astropy.coordinates.solar_system_ephemeris.set``\n    get_velocity : bool, optional\n        Whether or not to calculate the velocity as well as the position.\n\n    Returns\n    -------\n    position : `~astropy.coordinates.CartesianRepresentation` or tuple\n        Barycentric (ICRS) position or tuple of position and velocity.\n\n    Notes\n    -----\n    Whether or not velocities are calculated makes little difference for the\n    built-in ephemerides, but for most JPL ephemeris files, the execution time\n    roughly doubles.\n    ","endLoc":308,"header":"def _get_body_barycentric_posvel(body, time, ephemeris=None,\n                                 get_velocity=True)","id":2408,"name":"_get_body_barycentric_posvel","nodeType":"Function","startLoc":182,"text":"def _get_body_barycentric_posvel(body, time, ephemeris=None,\n                                 get_velocity=True):\n    \"\"\"Calculate the barycentric position (and velocity) of a solar system body.\n\n    Parameters\n    ----------\n    body : str or other\n        The solar system body for which to calculate positions.  Can also be a\n        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL\n        kernel.\n    time : `~astropy.time.Time`\n        Time of observation.\n    ephemeris : str, optional\n        Ephemeris to use.  By default, use the one set with\n        ``astropy.coordinates.solar_system_ephemeris.set``\n    get_velocity : bool, optional\n        Whether or not to calculate the velocity as well as the position.\n\n    Returns\n    -------\n    position : `~astropy.coordinates.CartesianRepresentation` or tuple\n        Barycentric (ICRS) position or tuple of position and velocity.\n\n    Notes\n    -----\n    Whether or not velocities are calculated makes little difference for the\n    built-in ephemerides, but for most JPL ephemeris files, the execution time\n    roughly doubles.\n    \"\"\"\n    # If the ephemeris is to be taken from solar_system_ephemeris, or the one\n    # it already contains, use the kernel there.  Otherwise, open the ephemeris,\n    # possibly downloading it, but make sure the file is closed at the end.\n    default_kernel = ephemeris is None or ephemeris is solar_system_ephemeris._value\n    kernel = None\n    try:\n        if default_kernel:\n            if solar_system_ephemeris.get() is None:\n                raise ValueError(_EPHEMERIS_NOTE)\n            kernel = solar_system_ephemeris.kernel\n        else:\n            kernel = _get_kernel(ephemeris)\n\n        jd1, jd2 = get_jd12(time, 'tdb')\n        if kernel is None:\n            body = body.lower()\n            earth_pv_helio, earth_pv_bary = erfa.epv00(jd1, jd2)\n            if body == 'earth':\n                body_pv_bary = earth_pv_bary\n\n            elif body == 'moon':\n                # The moon98 documentation notes that it takes TT, but that TDB leads\n                # to errors smaller than the uncertainties in the algorithm.\n                # moon98 returns the astrometric position relative to the Earth.\n                moon_pv_geo = erfa.moon98(jd1, jd2)\n                body_pv_bary = erfa.pvppv(moon_pv_geo, earth_pv_bary)\n            else:\n                sun_pv_bary = erfa.pvmpv(earth_pv_bary, earth_pv_helio)\n                if body == 'sun':\n                    body_pv_bary = sun_pv_bary\n                else:\n                    try:\n                        body_index = PLAN94_BODY_NAME_TO_PLANET_INDEX[body]\n                    except KeyError:\n                        raise KeyError(\"{}'s position and velocity cannot be \"\n                                       \"calculated with the '{}' ephemeris.\"\n                                       .format(body, ephemeris))\n                    body_pv_helio = erfa.plan94(jd1, jd2, body_index)\n                    body_pv_bary = erfa.pvppv(body_pv_helio, sun_pv_bary)\n\n            body_pos_bary = CartesianRepresentation(\n                body_pv_bary['p'], unit=u.au, xyz_axis=-1, copy=False)\n            if get_velocity:\n                body_vel_bary = CartesianRepresentation(\n                    body_pv_bary['v'], unit=u.au/u.day, xyz_axis=-1,\n                    copy=False)\n\n        else:\n            if isinstance(body, str):\n                # Look up kernel chain for JPL ephemeris, based on name\n                try:\n                    kernel_spec = BODY_NAME_TO_KERNEL_SPEC[body.lower()]\n                except KeyError:\n                    raise KeyError(\"{}'s position cannot be calculated with \"\n                                   \"the {} ephemeris.\".format(body, ephemeris))\n            else:\n                # otherwise, assume the user knows what their doing and intentionally\n                # passed in a kernel chain\n                kernel_spec = body\n\n            # jplephem cannot handle multi-D arrays, so convert to 1D here.\n            jd1_shape = getattr(jd1, 'shape', ())\n            if len(jd1_shape) > 1:\n                jd1, jd2 = jd1.ravel(), jd2.ravel()\n                # Note that we use the new jd1.shape here to create a 1D result array.\n                # It is reshaped below.\n            body_posvel_bary = np.zeros((2 if get_velocity else 1, 3) +\n                                        getattr(jd1, 'shape', ()))\n            for pair in kernel_spec:\n                spk = kernel[pair]\n                if spk.data_type == 3:\n                    # Type 3 kernels contain both position and velocity.\n                    posvel = spk.compute(jd1, jd2)\n                    if get_velocity:\n                        body_posvel_bary += posvel.reshape(body_posvel_bary.shape)\n                    else:\n                        body_posvel_bary[0] += posvel[:4]\n                else:\n                    # spk.generate first yields the position and then the\n                    # derivative. If no velocities are desired, body_posvel_bary\n                    # has only one element and thus the loop ends after a single\n                    # iteration, avoiding the velocity calculation.\n                    for body_p_or_v, p_or_v in zip(body_posvel_bary,\n                                                   spk.generate(jd1, jd2)):\n                        body_p_or_v += p_or_v\n\n            body_posvel_bary.shape = body_posvel_bary.shape[:2] + jd1_shape\n            body_pos_bary = CartesianRepresentation(body_posvel_bary[0],\n                                                    unit=u.km, copy=False)\n            if get_velocity:\n                body_vel_bary = CartesianRepresentation(body_posvel_bary[1],\n                                                        unit=u.km/u.day, copy=False)\n\n        return (body_pos_bary, body_vel_bary) if get_velocity else body_pos_bary\n\n    finally:\n        if not default_kernel and kernel is not None:\n            kernel.daf.file.close()"},{"col":4,"comment":"null","endLoc":1471,"header":"@compressed_data.deleter\n    def compressed_data(self)","id":2409,"name":"compressed_data","nodeType":"Function","startLoc":1453,"text":"@compressed_data.deleter\n    def compressed_data(self):\n        # Deleting the compressed_data attribute has to be handled\n        # with a little care to prevent a reference leak\n        # First delete the ._coldefs attributes under it to break a possible\n        # reference cycle\n        if 'compressed_data' in self.__dict__:\n            del self.__dict__['compressed_data']._coldefs\n\n            # Now go ahead and delete from self.__dict__; normally\n            # lazyproperty.__delete__ does this for us, but we can prempt it to\n            # do some additional cleanup\n            del self.__dict__['compressed_data']\n\n            # If this file was mmap'd, numpy.memmap will hold open a file\n            # handle until the underlying mmap object is garbage-collected;\n            # since this reference leak can sometimes hang around longer than\n            # welcome go ahead and force a garbage collection\n            gc.collect()"},{"col":4,"comment":"\n        Shape of the image array--should be equivalent to ``self.data.shape``.\n        ","endLoc":1480,"header":"@property\n    def shape(self)","id":2410,"name":"shape","nodeType":"Function","startLoc":1473,"text":"@property\n    def shape(self):\n        \"\"\"\n        Shape of the image array--should be equivalent to ``self.data.shape``.\n        \"\"\"\n\n        # Determine from the values read from the header\n        return tuple(reversed(self._axes))"},{"col":4,"comment":"null","endLoc":1605,"header":"@lazyproperty\n    def header(self)","id":2411,"name":"header","nodeType":"Function","startLoc":1482,"text":"@lazyproperty\n    def header(self):\n        # The header attribute is the header for the image data.  It\n        # is not actually stored in the object dictionary.  Instead,\n        # the _image_header is stored.  If the _image_header attribute\n        # has already been defined we just return it.  If not, we must\n        # create it from the table header (the _header attribute).\n        if hasattr(self, '_image_header'):\n            return self._image_header\n\n        # Clean up any possible doubled EXTNAME keywords that use\n        # the default. Do this on the original header to ensure\n        # duplicates are removed cleanly.\n        self._remove_unnecessary_default_extnames(self._header)\n\n        # Start with a copy of the table header.\n        image_header = self._header.copy()\n\n        # Delete cards that are related to the table.  And move\n        # the values of those cards that relate to the image from\n        # their corresponding table cards.  These include\n        # ZBITPIX -> BITPIX, ZNAXIS -> NAXIS, and ZNAXISn -> NAXISn.\n        # (Note: Used set here instead of list in case there are any duplicate\n        # keywords, which there may be in some pathological cases:\n        # https://github.com/astropy/astropy/issues/2750\n        for keyword in set(image_header):\n            if CompImageHeader._is_reserved_keyword(keyword, warn=False):\n                del image_header[keyword]\n\n        if 'ZSIMPLE' in self._header:\n            image_header.set('SIMPLE', self._header['ZSIMPLE'],\n                             self._header.comments['ZSIMPLE'], before=0)\n        elif 'ZTENSION' in self._header:\n            if self._header['ZTENSION'] != 'IMAGE':\n                warnings.warn(\"ZTENSION keyword in compressed \"\n                              \"extension != 'IMAGE'\", AstropyUserWarning)\n            image_header.set('XTENSION', 'IMAGE',\n                             self._header.comments['ZTENSION'], before=0)\n        else:\n            image_header.set('XTENSION', 'IMAGE', before=0)\n\n        image_header.set('BITPIX', self._header['ZBITPIX'],\n                         self._header.comments['ZBITPIX'], before=1)\n\n        image_header.set('NAXIS', self._header['ZNAXIS'],\n                         self._header.comments['ZNAXIS'], before=2)\n\n        last_naxis = 'NAXIS'\n        for idx in range(image_header['NAXIS']):\n            znaxis = 'ZNAXIS' + str(idx + 1)\n            naxis = znaxis[1:]\n            image_header.set(naxis, self._header[znaxis],\n                             self._header.comments[znaxis],\n                             after=last_naxis)\n            last_naxis = naxis\n\n        # Delete any other spurious NAXISn keywords:\n        naxis = image_header['NAXIS']\n        for keyword in list(image_header['NAXIS?*']):\n            try:\n                n = int(keyword[5:])\n            except Exception:\n                continue\n\n            if n > naxis:\n                del image_header[keyword]\n\n        # Although PCOUNT and GCOUNT are considered mandatory for IMAGE HDUs,\n        # ZPCOUNT and ZGCOUNT are optional, probably because for IMAGE HDUs\n        # their values are always 0 and 1 respectively\n        if 'ZPCOUNT' in self._header:\n            image_header.set('PCOUNT', self._header['ZPCOUNT'],\n                             self._header.comments['ZPCOUNT'],\n                             after=last_naxis)\n        else:\n            image_header.set('PCOUNT', 0, after=last_naxis)\n\n        if 'ZGCOUNT' in self._header:\n            image_header.set('GCOUNT', self._header['ZGCOUNT'],\n                             self._header.comments['ZGCOUNT'],\n                             after='PCOUNT')\n        else:\n            image_header.set('GCOUNT', 1, after='PCOUNT')\n\n        if 'ZEXTEND' in self._header:\n            image_header.set('EXTEND', self._header['ZEXTEND'],\n                             self._header.comments['ZEXTEND'])\n\n        if 'ZBLOCKED' in self._header:\n            image_header.set('BLOCKED', self._header['ZBLOCKED'],\n                             self._header.comments['ZBLOCKED'])\n\n        # Move the ZHECKSUM and ZDATASUM cards to the image header\n        # as CHECKSUM and DATASUM\n        if 'ZHECKSUM' in self._header:\n            image_header.set('CHECKSUM', self._header['ZHECKSUM'],\n                             self._header.comments['ZHECKSUM'])\n\n        if 'ZDATASUM' in self._header:\n            image_header.set('DATASUM', self._header['ZDATASUM'],\n                             self._header.comments['ZDATASUM'])\n\n        # Remove the EXTNAME card if the value in the table header\n        # is the default value of COMPRESSED_IMAGE.\n        if ('EXTNAME' in image_header and\n                image_header['EXTNAME'] == self._default_name):\n            del image_header['EXTNAME']\n\n        # Look to see if there are any blank cards in the table\n        # header.  If there are, there should be the same number\n        # of blank cards in the image header.  Add blank cards to\n        # the image header to make it so.\n        table_blanks = self._header._countblanks()\n        image_blanks = image_header._countblanks()\n\n        for _ in range(table_blanks - image_blanks):\n            image_header.append()\n\n        # Create the CompImageHeader that syncs with the table header, and save\n        # it off to self._image_header so it can be referenced later\n        # unambiguously\n        self._image_header = CompImageHeader(self._header, image_header)\n\n        return self._image_header"},{"attributeType":"null","col":8,"comment":"null","endLoc":1254,"id":2412,"name":"diff_total","nodeType":"Attribute","startLoc":1254,"text":"self.diff_total"},{"attributeType":"null","col":8,"comment":"null","endLoc":1240,"id":2413,"name":"diff_rows","nodeType":"Attribute","startLoc":1240,"text":"self.diff_rows"},{"attributeType":"null","col":8,"comment":"null","endLoc":1250,"id":2414,"name":"diff_column_names","nodeType":"Attribute","startLoc":1250,"text":"self.diff_column_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":1230,"id":2415,"name":"numdiffs","nodeType":"Attribute","startLoc":1230,"text":"self.numdiffs"},{"attributeType":"null","col":8,"comment":"null","endLoc":1246,"id":2416,"name":"diff_column_attributes","nodeType":"Attribute","startLoc":1246,"text":"self.diff_column_attributes"},{"attributeType":"null","col":8,"comment":"null","endLoc":1242,"id":2417,"name":"diff_columns","nodeType":"Attribute","startLoc":1242,"text":"self.diff_columns"},{"col":0,"comment":"\n    Try importing jplephem, download/retrieve from cache the Satellite Planet\n    Kernel corresponding to the given ephemeris.\n    ","endLoc":179,"header":"def _get_kernel(value)","id":2418,"name":"_get_kernel","nodeType":"Function","startLoc":147,"text":"def _get_kernel(value):\n    \"\"\"\n    Try importing jplephem, download/retrieve from cache the Satellite Planet\n    Kernel corresponding to the given ephemeris.\n    \"\"\"\n    if value is None or value.lower() == 'builtin':\n        return None\n\n    try:\n        from jplephem.spk import SPK\n    except ImportError:\n        raise ImportError(\"Solar system JPL ephemeris calculations require \"\n                          \"the jplephem package \"\n                          \"(https://pypi.org/project/jplephem/)\")\n\n    if value.lower() == 'jpl':\n        value = DEFAULT_JPL_EPHEMERIS\n\n    if value.lower() in ('de430', 'de432s', 'de440', 'de440s'):\n        value = ('https://naif.jpl.nasa.gov/pub/naif/generic_kernels'\n                 '/spk/planets/{:s}.bsp'.format(value.lower()))\n\n    elif os.path.isfile(value):\n        return SPK.open(value)\n\n    else:\n        try:\n            urlparse(value)\n        except Exception:\n            raise ValueError('{} was not one of the standard strings and '\n                             'could not be parsed as a file path or URL'.format(value))\n\n    return SPK.open(download_file(value, cache=True))"},{"attributeType":"null","col":8,"comment":"null","endLoc":1241,"id":2419,"name":"diff_column_count","nodeType":"Attribute","startLoc":1241,"text":"self.diff_column_count"},{"attributeType":"null","col":8,"comment":"null","endLoc":1231,"id":2420,"name":"rtol","nodeType":"Attribute","startLoc":1231,"text":"self.rtol"},{"col":4,"comment":"\n        Sort the table according to one or more keys. This operates\n        on the existing table and does not return a new table.\n\n        Parameters\n        ----------\n        keys : str or list of str\n            The key(s) to order the table by. If None, use the\n            primary index of the Table.\n        kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional\n            Sorting algorithm used by ``numpy.argsort``.\n        reverse : bool\n            Sort in reverse order (default=False)\n\n        Examples\n        --------\n        Create a table with 3 columns::\n\n            >>> t = Table([['Max', 'Jo', 'John'], ['Miller', 'Miller', 'Jackson'],\n            ...            [12, 15, 18]], names=('firstname', 'name', 'tel'))\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                  Max  Miller  12\n                   Jo  Miller  15\n                 John Jackson  18\n\n        Sorting according to standard sorting rules, first 'name' then 'firstname'::\n\n            >>> t.sort(['name', 'firstname'])\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                 John Jackson  18\n                   Jo  Miller  15\n                  Max  Miller  12\n\n        Sorting according to standard sorting rules, first 'firstname' then 'tel',\n        in reverse order::\n\n            >>> t.sort(['firstname', 'tel'], reverse=True)\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                  Max  Miller  12\n                 John Jackson  18\n                   Jo  Miller  15\n        ","endLoc":3285,"header":"def sort(self, keys=None, *, kind=None, reverse=False)","id":2421,"name":"sort","nodeType":"Function","startLoc":3211,"text":"def sort(self, keys=None, *, kind=None, reverse=False):\n        '''\n        Sort the table according to one or more keys. This operates\n        on the existing table and does not return a new table.\n\n        Parameters\n        ----------\n        keys : str or list of str\n            The key(s) to order the table by. If None, use the\n            primary index of the Table.\n        kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional\n            Sorting algorithm used by ``numpy.argsort``.\n        reverse : bool\n            Sort in reverse order (default=False)\n\n        Examples\n        --------\n        Create a table with 3 columns::\n\n            >>> t = Table([['Max', 'Jo', 'John'], ['Miller', 'Miller', 'Jackson'],\n            ...            [12, 15, 18]], names=('firstname', 'name', 'tel'))\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                  Max  Miller  12\n                   Jo  Miller  15\n                 John Jackson  18\n\n        Sorting according to standard sorting rules, first 'name' then 'firstname'::\n\n            >>> t.sort(['name', 'firstname'])\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                 John Jackson  18\n                   Jo  Miller  15\n                  Max  Miller  12\n\n        Sorting according to standard sorting rules, first 'firstname' then 'tel',\n        in reverse order::\n\n            >>> t.sort(['firstname', 'tel'], reverse=True)\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                  Max  Miller  12\n                 John Jackson  18\n                   Jo  Miller  15\n        '''\n        if keys is None:\n            if not self.indices:\n                raise ValueError(\"Table sort requires input keys or a table index\")\n            keys = [x.info.name for x in self.indices[0].columns]\n\n        if isinstance(keys, str):\n            keys = [keys]\n\n        indexes = self.argsort(keys, kind=kind, reverse=reverse)\n\n        with self.index_mode('freeze'):\n            for name, col in self.columns.items():\n                # Make a new sorted column.  This requires that take() also copies\n                # relevant info attributes for mixin columns.\n                new_col = col.take(indexes, axis=0)\n\n                # First statement in try: will succeed if the column supports an in-place\n                # update, and matches the legacy behavior of astropy Table.  However,\n                # some mixin classes may not support this, so in that case just drop\n                # in the entire new column. See #9553 and #9536 for discussion.\n                try:\n                    col[:] = new_col\n                except Exception:\n                    # In-place update failed for some reason, exception class not\n                    # predictable for arbitrary mixin.\n                    self[col.info.name] = new_col"},{"attributeType":"null","col":8,"comment":"null","endLoc":1234,"id":2422,"name":"common_columns","nodeType":"Attribute","startLoc":1234,"text":"self.common_columns"},{"attributeType":"null","col":8,"comment":"null","endLoc":1235,"id":2423,"name":"common_column_names","nodeType":"Attribute","startLoc":1235,"text":"self.common_column_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":1253,"id":2424,"name":"diff_ratio","nodeType":"Attribute","startLoc":1253,"text":"self.diff_ratio"},{"attributeType":"null","col":8,"comment":"null","endLoc":1251,"id":2425,"name":"diff_values","nodeType":"Attribute","startLoc":1251,"text":"self.diff_values"},{"attributeType":"null","col":8,"comment":"null","endLoc":1232,"id":2426,"name":"atol","nodeType":"Attribute","startLoc":1232,"text":"self.atol"},{"attributeType":"null","col":8,"comment":"null","endLoc":1229,"id":2427,"name":"ignore_fields","nodeType":"Attribute","startLoc":1229,"text":"self.ignore_fields"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":2428,"name":"__all__","nodeType":"Attribute","startLoc":33,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":2429,"name":"_COL_ATTRS","nodeType":"Attribute","startLoc":37,"text":"_COL_ATTRS"},{"col":0,"comment":"","endLoc":7,"header":"diff.py#<anonymous>","id":2430,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nFacilities for diffing two FITS files.  Includes objects for diffing entire\nFITS files, individual HDUs, FITS headers, or just FITS data.\n\nUsed to implement the fitsdiff program.\n\"\"\"\n\n__all__ = ['FITSDiff', 'HDUDiff', 'HeaderDiff', 'ImageDataDiff', 'RawDataDiff',\n           'TableDataDiff']\n\n_COL_ATTRS = [('unit', 'units'), ('null', 'null values'),\n              ('bscale', 'bscales'), ('bzero', 'bzeros'),\n              ('disp', 'display formats'), ('dim', 'dimensions')]"},{"col":4,"comment":"\n        Reverse the row order of table rows.  The table is reversed\n        in place and there are no function arguments.\n\n        Examples\n        --------\n        Create a table with three columns::\n\n            >>> t = Table([['Max', 'Jo', 'John'], ['Miller','Miller','Jackson'],\n            ...         [12,15,18]], names=('firstname','name','tel'))\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                  Max  Miller  12\n                   Jo  Miller  15\n                 John Jackson  18\n\n        Reversing order::\n\n            >>> t.reverse()\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                 John Jackson  18\n                   Jo  Miller  15\n                  Max  Miller  12\n        ","endLoc":3329,"header":"def reverse(self)","id":2431,"name":"reverse","nodeType":"Function","startLoc":3287,"text":"def reverse(self):\n        '''\n        Reverse the row order of table rows.  The table is reversed\n        in place and there are no function arguments.\n\n        Examples\n        --------\n        Create a table with three columns::\n\n            >>> t = Table([['Max', 'Jo', 'John'], ['Miller','Miller','Jackson'],\n            ...         [12,15,18]], names=('firstname','name','tel'))\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                  Max  Miller  12\n                   Jo  Miller  15\n                 John Jackson  18\n\n        Reversing order::\n\n            >>> t.reverse()\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                 John Jackson  18\n                   Jo  Miller  15\n                  Max  Miller  12\n        '''\n        for col in self.columns.values():\n            # First statement in try: will succeed if the column supports an in-place\n            # update, and matches the legacy behavior of astropy Table.  However,\n            # some mixin classes may not support this, so in that case just drop\n            # in the entire new column. See #9836, #9553, and #9536 for discussion.\n            new_col = col[::-1]\n            try:\n                col[:] = new_col\n            except Exception:\n                # In-place update failed for some reason, exception class not\n                # predictable for arbitrary mixin.\n                self[col.info.name] = new_col\n\n        for index in self.indices:\n            index.reverse()"},{"col":4,"comment":"\n        Round numeric columns in-place to the specified number of decimals.\n        Non-numeric columns will be ignored.\n\n        Examples\n        --------\n        Create three columns with different types:\n\n            >>> t = Table([[1, 4, 5], [-25.55, 12.123, 85],\n            ...     ['a', 'b', 'c']], names=('a', 'b', 'c'))\n            >>> print(t)\n             a    b     c\n            --- ------ ---\n              1 -25.55   a\n              4 12.123   b\n              5   85.0   c\n\n        Round them all to 0:\n\n            >>> t.round(0)\n            >>> print(t)\n             a    b    c\n            --- ----- ---\n              1 -26.0   a\n              4  12.0   b\n              5  85.0   c\n\n        Round column 'a' to -1 decimal:\n\n            >>> t.round({'a':-1})\n            >>> print(t)\n             a    b    c\n            --- ----- ---\n              0 -26.0   a\n              0  12.0   b\n              0  85.0   c\n\n        Parameters\n        ----------\n        decimals: int, dict\n            Number of decimals to round the columns to. If a dict is given,\n            the columns will be rounded to the number specified as the value.\n            If a certain column is not in the dict given, it will remain the\n            same.\n        ","endLoc":3393,"header":"def round(self, decimals=0)","id":2432,"name":"round","nodeType":"Function","startLoc":3331,"text":"def round(self, decimals=0):\n        '''\n        Round numeric columns in-place to the specified number of decimals.\n        Non-numeric columns will be ignored.\n\n        Examples\n        --------\n        Create three columns with different types:\n\n            >>> t = Table([[1, 4, 5], [-25.55, 12.123, 85],\n            ...     ['a', 'b', 'c']], names=('a', 'b', 'c'))\n            >>> print(t)\n             a    b     c\n            --- ------ ---\n              1 -25.55   a\n              4 12.123   b\n              5   85.0   c\n\n        Round them all to 0:\n\n            >>> t.round(0)\n            >>> print(t)\n             a    b    c\n            --- ----- ---\n              1 -26.0   a\n              4  12.0   b\n              5  85.0   c\n\n        Round column 'a' to -1 decimal:\n\n            >>> t.round({'a':-1})\n            >>> print(t)\n             a    b    c\n            --- ----- ---\n              0 -26.0   a\n              0  12.0   b\n              0  85.0   c\n\n        Parameters\n        ----------\n        decimals: int, dict\n            Number of decimals to round the columns to. If a dict is given,\n            the columns will be rounded to the number specified as the value.\n            If a certain column is not in the dict given, it will remain the\n            same.\n        '''\n        if isinstance(decimals, Mapping):\n            decimal_values = decimals.values()\n            column_names = decimals.keys()\n        elif isinstance(decimals, int):\n            decimal_values = itertools.repeat(decimals)\n            column_names = self.colnames\n        else:\n            raise ValueError(\"'decimals' argument must be an int or a dict\")\n\n        for colname, decimal in zip(column_names, decimal_values):\n            col = self.columns[colname]\n            if np.issubdtype(col.info.dtype, np.number):\n                try:\n                    np.around(col, decimals=decimal, out=col)\n                except TypeError:\n                    # Bug in numpy see https://github.com/numpy/numpy/issues/15438\n                    col[()] = np.around(col, decimals=decimal)"},{"col":4,"comment":"null","endLoc":336,"header":"@classmethod\n    def _is_reserved_keyword(cls, keyword, warn=True)","id":2433,"name":"_is_reserved_keyword","nodeType":"Function","startLoc":304,"text":"@classmethod\n    def _is_reserved_keyword(cls, keyword, warn=True):\n        msg = ('Keyword {!r} is reserved for use by the FITS Tiled Image '\n               'Convention and will not be stored in the header for the '\n               'image being compressed.'.format(keyword))\n\n        if keyword == 'TFIELDS':\n            if warn:\n                warnings.warn(msg)\n            return True\n\n        m = TDEF_RE.match(keyword)\n\n        if m and m.group('label').upper() in TABLE_KEYWORD_NAMES:\n            if warn:\n                warnings.warn(msg)\n            return True\n\n        m = cls._zdef_re.match(keyword)\n\n        if m:\n            label = m.group('label').upper()\n            num = m.group('num')\n            if num is not None and label in cls._indexed_compression_keywords:\n                if warn:\n                    warnings.warn(msg)\n                return True\n            elif label in cls._compression_keywords:\n                if warn:\n                    warnings.warn(msg)\n                return True\n\n        return False"},{"fileName":"table.py","filePath":"astropy/io/fits/hdu","id":2434,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\n\nimport contextlib\nimport csv\nimport operator\nimport os\nimport re\nimport sys\nimport textwrap\nimport warnings\nfrom contextlib import suppress\n\nimport numpy as np\nfrom numpy import char as chararray\n\nfrom .base import DELAYED, _ValidHDU, ExtensionHDU\n# This module may have many dependencies on astropy.io.fits.column, but\n# astropy.io.fits.column has fewer dependencies overall, so it's easier to\n# keep table/column-related utilities in astropy.io.fits.column\nfrom astropy.io.fits.column import (FITS2NUMPY, KEYWORD_NAMES, KEYWORD_TO_ATTRIBUTE,\n                      ATTRIBUTE_TO_KEYWORD, TDEF_RE, Column, ColDefs,\n                      _AsciiColDefs, _FormatP, _FormatQ, _makep,\n                      _parse_tformat, _scalar_to_format, _convert_format,\n                      _cmp_recformats)\nfrom astropy.io.fits.fitsrec import FITS_rec, _get_recarray_field, _has_unicode_fields\nfrom astropy.io.fits.header import Header, _pad_length\nfrom astropy.io.fits.util import _is_int, _str_to_num\n\nfrom astropy.utils import lazyproperty\nfrom astropy.utils.exceptions import AstropyDeprecationWarning\n\n\nclass FITSTableDumpDialect(csv.excel):\n    \"\"\"\n    A CSV dialect for the Astropy format of ASCII dumps of FITS tables.\n    \"\"\"\n\n    delimiter = ' '\n    lineterminator = '\\n'\n    quotechar = '\"'\n    quoting = csv.QUOTE_ALL\n    skipinitialspace = True\n\n\nclass _TableLikeHDU(_ValidHDU):\n    \"\"\"\n    A class for HDUs that have table-like data.  This is used for both\n    Binary/ASCII tables as well as Random Access Group HDUs (which are\n    otherwise too dissimilar for tables to use _TableBaseHDU directly).\n    \"\"\"\n\n    _data_type = FITS_rec\n    _columns_type = ColDefs\n\n    # TODO: Temporary flag representing whether uints are enabled; remove this\n    # after restructuring to support uints by default on a per-column basis\n    _uint = False\n\n    @classmethod\n    def match_header(cls, header):\n        \"\"\"\n        This is an abstract HDU type for HDUs that contain table-like data.\n        This is even more abstract than _TableBaseHDU which is specifically for\n        the standard ASCII and Binary Table types.\n        \"\"\"\n\n        raise NotImplementedError\n\n    @classmethod\n    def from_columns(cls, columns, header=None, nrows=0, fill=False,\n                     character_as_bytes=False, **kwargs):\n        \"\"\"\n        Given either a `ColDefs` object, a sequence of `Column` objects,\n        or another table HDU or table data (a `FITS_rec` or multi-field\n        `numpy.ndarray` or `numpy.recarray` object, return a new table HDU of\n        the class this method was called on using the column definition from\n        the input.\n\n        See also `FITS_rec.from_columns`.\n\n        Parameters\n        ----------\n        columns : sequence of `Column`, `ColDefs` -like\n            The columns from which to create the table data, or an object with\n            a column-like structure from which a `ColDefs` can be instantiated.\n            This includes an existing `BinTableHDU` or `TableHDU`, or a\n            `numpy.recarray` to give some examples.\n\n            If these columns have data arrays attached that data may be used in\n            initializing the new table.  Otherwise the input columns will be\n            used as a template for a new table with the requested number of\n            rows.\n\n        header : `Header`\n            An optional `Header` object to instantiate the new HDU yet.  Header\n            keywords specifically related to defining the table structure (such\n            as the \"TXXXn\" keywords like TTYPEn) will be overridden by the\n            supplied column definitions, but all other informational and data\n            model-specific keywords are kept.\n\n        nrows : int\n            Number of rows in the new table.  If the input columns have data\n            associated with them, the size of the largest input column is used.\n            Otherwise the default is 0.\n\n        fill : bool\n            If `True`, will fill all cells with zeros or blanks.  If `False`,\n            copy the data from input, undefined cells will still be filled with\n            zeros/blanks.\n\n        character_as_bytes : bool\n            Whether to return bytes for string columns when accessed from the\n            HDU. By default this is `False` and (unicode) strings are returned,\n            but for large tables this may use up a lot of memory.\n\n        Notes\n        -----\n        Any additional keyword arguments accepted by the HDU class's\n        ``__init__`` may also be passed in as keyword arguments.\n        \"\"\"\n\n        coldefs = cls._columns_type(columns)\n        data = FITS_rec.from_columns(coldefs, nrows=nrows, fill=fill,\n                                     character_as_bytes=character_as_bytes)\n        hdu = cls(data=data, header=header, character_as_bytes=character_as_bytes, **kwargs)\n        coldefs._add_listener(hdu)\n        return hdu\n\n    @lazyproperty\n    def columns(self):\n        \"\"\"\n        The :class:`ColDefs` objects describing the columns in this table.\n        \"\"\"\n\n        # The base class doesn't make any assumptions about where the column\n        # definitions come from, so just return an empty ColDefs\n        return ColDefs([])\n\n    @property\n    def _nrows(self):\n        \"\"\"\n        table-like HDUs must provide an attribute that specifies the number of\n        rows in the HDU's table.\n\n        For now this is an internal-only attribute.\n        \"\"\"\n\n        raise NotImplementedError\n\n    def _get_tbdata(self):\n        \"\"\"Get the table data from an input HDU object.\"\"\"\n\n        columns = self.columns\n\n        # TODO: Details related to variable length arrays need to be dealt with\n        # specifically in the BinTableHDU class, since they're a detail\n        # specific to FITS binary tables\n        if (any(type(r) in (_FormatP, _FormatQ)\n                for r in columns._recformats) and\n                self._data_size is not None and\n                self._data_size > self._theap):\n            # We have a heap; include it in the raw_data\n            raw_data = self._get_raw_data(self._data_size, np.uint8,\n                                          self._data_offset)\n            tbsize = self._header['NAXIS1'] * self._header['NAXIS2']\n            data = raw_data[:tbsize].view(dtype=columns.dtype,\n                                          type=np.rec.recarray)\n        else:\n            raw_data = self._get_raw_data(self._nrows, columns.dtype,\n                                          self._data_offset)\n            if raw_data is None:\n                # This can happen when a brand new table HDU is being created\n                # and no data has been assigned to the columns, which case just\n                # return an empty array\n                raw_data = np.array([], dtype=columns.dtype)\n\n            data = raw_data.view(np.rec.recarray)\n\n        self._init_tbdata(data)\n        data = data.view(self._data_type)\n        columns._add_listener(data)\n        return data\n\n    def _init_tbdata(self, data):\n        columns = self.columns\n\n        data.dtype = data.dtype.newbyteorder('>')\n\n        # hack to enable pseudo-uint support\n        data._uint = self._uint\n\n        # pass datLoc, for P format\n        data._heapoffset = self._theap\n        data._heapsize = self._header['PCOUNT']\n        tbsize = self._header['NAXIS1'] * self._header['NAXIS2']\n        data._gap = self._theap - tbsize\n\n        # pass the attributes\n        for idx, col in enumerate(columns):\n            # get the data for each column object from the rec.recarray\n            col.array = data.field(idx)\n\n        # delete the _arrays attribute so that it is recreated to point to the\n        # new data placed in the column object above\n        del columns._arrays\n\n    def _update_load_data(self):\n        \"\"\"Load the data if asked to.\"\"\"\n        if not self._data_loaded:\n            self.data\n\n    def _update_column_added(self, columns, column):\n        \"\"\"\n        Update the data upon addition of a new column through the `ColDefs`\n        interface.\n        \"\"\"\n        # recreate data from the columns\n        self.data = FITS_rec.from_columns(\n            self.columns, nrows=self._nrows, fill=False,\n            character_as_bytes=self._character_as_bytes\n        )\n\n    def _update_column_removed(self, columns, col_idx):\n        \"\"\"\n        Update the data upon removal of a column through the `ColDefs`\n        interface.\n        \"\"\"\n        # recreate data from the columns\n        self.data = FITS_rec.from_columns(\n            self.columns, nrows=self._nrows, fill=False,\n            character_as_bytes=self._character_as_bytes\n        )\n\n\nclass _TableBaseHDU(ExtensionHDU, _TableLikeHDU):\n    \"\"\"\n    FITS table extension base HDU class.\n\n    Parameters\n    ----------\n    data : array\n        Data to be used.\n    header : `Header` instance\n        Header to be used. If the ``data`` is also specified, header keywords\n        specifically related to defining the table structure (such as the\n        \"TXXXn\" keywords like TTYPEn) will be overridden by the supplied column\n        definitions, but all other informational and data model-specific\n        keywords are kept.\n    name : str\n        Name to be populated in ``EXTNAME`` keyword.\n    uint : bool, optional\n        Set to `True` if the table contains unsigned integer columns.\n    ver : int > 0 or None, optional\n        The ver of the HDU, will be the value of the keyword ``EXTVER``.\n        If not given or None, it defaults to the value of the ``EXTVER``\n        card of the ``header`` or 1.\n        (default: None)\n    character_as_bytes : bool\n        Whether to return bytes for string columns. By default this is `False`\n        and (unicode) strings are returned, but this does not respect memory\n        mapping and loads the whole column in memory when accessed.\n    \"\"\"\n\n    _manages_own_heap = False\n    \"\"\"\n    This flag implies that when writing VLA tables (P/Q format) the heap\n    pointers that go into P/Q table columns should not be reordered or\n    rearranged in any way by the default heap management code.\n\n    This is included primarily as an optimization for compressed image HDUs\n    which perform their own heap maintenance.\n    \"\"\"\n\n    def __init__(self, data=None, header=None, name=None, uint=False, ver=None,\n                 character_as_bytes=False):\n\n        super().__init__(data=data, header=header, name=name, ver=ver)\n\n        self._uint = uint\n        self._character_as_bytes = character_as_bytes\n\n        if data is DELAYED:\n            # this should never happen\n            if header is None:\n                raise ValueError('No header to setup HDU.')\n\n            # if the file is read the first time, no need to copy, and keep it\n            # unchanged\n            else:\n                self._header = header\n        else:\n            # construct a list of cards of minimal header\n            cards = [\n                ('XTENSION', self._extension, self._ext_comment),\n                ('BITPIX', 8, 'array data type'),\n                ('NAXIS', 2, 'number of array dimensions'),\n                ('NAXIS1', 0, 'length of dimension 1'),\n                ('NAXIS2', 0, 'length of dimension 2'),\n                ('PCOUNT', 0, 'number of group parameters'),\n                ('GCOUNT', 1, 'number of groups'),\n                ('TFIELDS', 0, 'number of table fields')]\n\n            if header is not None:\n\n                # Make a \"copy\" (not just a view) of the input header, since it\n                # may get modified.  the data is still a \"view\" (for now)\n                hcopy = header.copy(strip=True)\n                cards.extend(hcopy.cards)\n\n            self._header = Header(cards)\n\n            if isinstance(data, np.ndarray) and data.dtype.fields is not None:\n                # self._data_type is FITS_rec.\n                if isinstance(data, self._data_type):\n                    self.data = data\n                else:\n                    self.data = self._data_type.from_columns(data)\n\n                # TEMP: Special column keywords are normally overwritten by attributes\n                # from Column objects. In Astropy 3.0, several new keywords are now\n                # recognized as being special column keywords, but we don't\n                # automatically clear them yet, as we need to raise a deprecation\n                # warning for at least one major version.\n                if header is not None:\n                    future_ignore = set()\n                    for keyword in header.keys():\n                        match = TDEF_RE.match(keyword)\n                        try:\n                            base_keyword = match.group('label')\n                        except Exception:\n                            continue                # skip if there is no match\n                        if base_keyword in {'TCTYP', 'TCUNI', 'TCRPX', 'TCRVL', 'TCDLT', 'TRPOS'}:\n                            future_ignore.add(base_keyword)\n                    if future_ignore:\n                        keys = ', '.join(x + 'n' for x in sorted(future_ignore))\n                        warnings.warn(\"The following keywords are now recognized as special \"\n                                      \"column-related attributes and should be set via the \"\n                                      \"Column objects: {}. In future, these values will be \"\n                                      \"dropped from manually specified headers automatically \"\n                                      \"and replaced with values generated based on the \"\n                                      \"Column objects.\".format(keys), AstropyDeprecationWarning)\n\n                # TODO: Too much of the code in this class uses header keywords\n                # in making calculations related to the data size.  This is\n                # unreliable, however, in cases when users mess with the header\n                # unintentionally--code that does this should be cleaned up.\n                self._header['NAXIS1'] = self.data._raw_itemsize\n                self._header['NAXIS2'] = self.data.shape[0]\n                self._header['TFIELDS'] = len(self.data._coldefs)\n\n                self.columns = self.data._coldefs\n                self.columns._add_listener(self.data)\n                self.update()\n\n                with suppress(TypeError, AttributeError):\n                    # Make the ndarrays in the Column objects of the ColDefs\n                    # object of the HDU reference the same ndarray as the HDU's\n                    # FITS_rec object.\n                    for idx, col in enumerate(self.columns):\n                        col.array = self.data.field(idx)\n\n                    # Delete the _arrays attribute so that it is recreated to\n                    # point to the new data placed in the column objects above\n                    del self.columns._arrays\n            elif data is None:\n                pass\n            else:\n                raise TypeError('Table data has incorrect type.')\n\n        # Ensure that the correct EXTNAME is set on the new header if one was\n        # created, or that it overrides the existing EXTNAME if different\n        if name:\n            self.name = name\n        if ver is not None:\n            self.ver = ver\n\n    @classmethod\n    def match_header(cls, header):\n        \"\"\"\n        This is an abstract type that implements the shared functionality of\n        the ASCII and Binary Table HDU types, which should be used instead of\n        this.\n        \"\"\"\n\n        raise NotImplementedError\n\n    @lazyproperty\n    def columns(self):\n        \"\"\"\n        The :class:`ColDefs` objects describing the columns in this table.\n        \"\"\"\n\n        if self._has_data and hasattr(self.data, '_coldefs'):\n            return self.data._coldefs\n        return self._columns_type(self)\n\n    @lazyproperty\n    def data(self):\n        data = self._get_tbdata()\n        data._coldefs = self.columns\n        data._character_as_bytes = self._character_as_bytes\n        # Columns should now just return a reference to the data._coldefs\n        del self.columns\n        return data\n\n    @data.setter\n    def data(self, data):\n        if 'data' in self.__dict__:\n            if self.__dict__['data'] is data:\n                return\n            else:\n                self._data_replaced = True\n        else:\n            self._data_replaced = True\n\n        self._modified = True\n\n        if data is None and self.columns:\n            # Create a new table with the same columns, but empty rows\n            formats = ','.join(self.columns._recformats)\n            data = np.rec.array(None, formats=formats,\n                                names=self.columns.names,\n                                shape=0)\n\n        if isinstance(data, np.ndarray) and data.dtype.fields is not None:\n            # Go ahead and always make a view, even if the data is already the\n            # correct class (self._data_type) so we can update things like the\n            # column defs, if necessary\n            data = data.view(self._data_type)\n\n            if not isinstance(data.columns, self._columns_type):\n                # This would be the place, if the input data was for an ASCII\n                # table and this is binary table, or vice versa, to convert the\n                # data to the appropriate format for the table type\n                new_columns = self._columns_type(data.columns)\n                data = FITS_rec.from_columns(new_columns)\n\n            if 'data' in self.__dict__:\n                self.columns._remove_listener(self.__dict__['data'])\n            self.__dict__['data'] = data\n\n            self.columns = self.data.columns\n            self.columns._add_listener(self.data)\n            self.update()\n\n            with suppress(TypeError, AttributeError):\n                # Make the ndarrays in the Column objects of the ColDefs\n                # object of the HDU reference the same ndarray as the HDU's\n                # FITS_rec object.\n                for idx, col in enumerate(self.columns):\n                    col.array = self.data.field(idx)\n\n                # Delete the _arrays attribute so that it is recreated to\n                # point to the new data placed in the column objects above\n                del self.columns._arrays\n        elif data is None:\n            pass\n        else:\n            raise TypeError('Table data has incorrect type.')\n\n        # returning the data signals to lazyproperty that we've already handled\n        # setting self.__dict__['data']\n        return data\n\n    @property\n    def _nrows(self):\n        if not self._data_loaded:\n            return self._header.get('NAXIS2', 0)\n        else:\n            return len(self.data)\n\n    @lazyproperty\n    def _theap(self):\n        size = self._header['NAXIS1'] * self._header['NAXIS2']\n        return self._header.get('THEAP', size)\n\n    # TODO: Need to either rename this to update_header, for symmetry with the\n    # Image HDUs, or just at some point deprecate it and remove it altogether,\n    # since header updates should occur automatically when necessary...\n    def update(self):\n        \"\"\"\n        Update header keywords to reflect recent changes of columns.\n        \"\"\"\n\n        self._header.set('NAXIS1', self.data._raw_itemsize, after='NAXIS')\n        self._header.set('NAXIS2', self.data.shape[0], after='NAXIS1')\n        self._header.set('TFIELDS', len(self.columns), after='GCOUNT')\n\n        self._clear_table_keywords()\n        self._populate_table_keywords()\n\n    def copy(self):\n        \"\"\"\n        Make a copy of the table HDU, both header and data are copied.\n        \"\"\"\n\n        # touch the data, so it's defined (in the case of reading from a\n        # FITS file)\n        return self.__class__(data=self.data.copy(),\n                              header=self._header.copy())\n\n    def _prewriteto(self, checksum=False, inplace=False):\n        if self._has_data:\n            self.data._scale_back(\n                update_heap_pointers=not self._manages_own_heap)\n            # check TFIELDS and NAXIS2\n            self._header['TFIELDS'] = len(self.data._coldefs)\n            self._header['NAXIS2'] = self.data.shape[0]\n\n            # calculate PCOUNT, for variable length tables\n            tbsize = self._header['NAXIS1'] * self._header['NAXIS2']\n            heapstart = self._header.get('THEAP', tbsize)\n            self.data._gap = heapstart - tbsize\n            pcount = self.data._heapsize + self.data._gap\n            if pcount > 0:\n                self._header['PCOUNT'] = pcount\n\n            # update the other T****n keywords\n            self._populate_table_keywords()\n\n            # update TFORM for variable length columns\n            for idx in range(self.data._nfields):\n                format = self.data._coldefs._recformats[idx]\n                if isinstance(format, _FormatP):\n                    _max = self.data.field(idx).max\n                    # May be either _FormatP or _FormatQ\n                    format_cls = format.__class__\n                    format = format_cls(format.dtype, repeat=format.repeat,\n                                        max=_max)\n                    self._header['TFORM' + str(idx + 1)] = format.tform\n        return super()._prewriteto(checksum, inplace)\n\n    def _verify(self, option='warn'):\n        \"\"\"\n        _TableBaseHDU verify method.\n        \"\"\"\n\n        errs = super()._verify(option=option)\n        if not (isinstance(self._header[0], str) and\n                self._header[0].rstrip() == self._extension):\n\n            err_text = 'The XTENSION keyword must match the HDU type.'\n            fix_text = f'Converted the XTENSION keyword to {self._extension}.'\n\n            def fix(header=self._header):\n                header[0] = (self._extension, self._ext_comment)\n\n            errs.append(self.run_option(option, err_text=err_text,\n                                        fix_text=fix_text, fix=fix))\n\n        self.req_cards('NAXIS', None, lambda v: (v == 2), 2, option, errs)\n        self.req_cards('BITPIX', None, lambda v: (v == 8), 8, option, errs)\n        self.req_cards('TFIELDS', 7,\n                       lambda v: (_is_int(v) and v >= 0 and v <= 999), 0,\n                       option, errs)\n        tfields = self._header['TFIELDS']\n        for idx in range(tfields):\n            self.req_cards('TFORM' + str(idx + 1), None, None, None, option,\n                           errs)\n        return errs\n\n    def _summary(self):\n        \"\"\"\n        Summarize the HDU: name, dimensions, and formats.\n        \"\"\"\n\n        class_name = self.__class__.__name__\n\n        # if data is touched, use data info.\n        if self._data_loaded:\n            if self.data is None:\n                nrows = 0\n            else:\n                nrows = len(self.data)\n\n            ncols = len(self.columns)\n            format = self.columns.formats\n\n        # if data is not touched yet, use header info.\n        else:\n            nrows = self._header['NAXIS2']\n            ncols = self._header['TFIELDS']\n            format = ', '.join([self._header['TFORM' + str(j + 1)]\n                                for j in range(ncols)])\n            format = f'[{format}]'\n        dims = f\"{nrows}R x {ncols}C\"\n        ncards = len(self._header)\n\n        return (self.name, self.ver, class_name, ncards, dims, format)\n\n    def _update_column_removed(self, columns, idx):\n        super()._update_column_removed(columns, idx)\n\n        # Fix the header to reflect the column removal\n        self._clear_table_keywords(index=idx)\n\n    def _update_column_attribute_changed(self, column, col_idx, attr,\n                                         old_value, new_value):\n        \"\"\"\n        Update the header when one of the column objects is updated.\n        \"\"\"\n\n        # base_keyword is the keyword without the index such as TDIM\n        # while keyword is like TDIM1\n        base_keyword = ATTRIBUTE_TO_KEYWORD[attr]\n        keyword = base_keyword + str(col_idx + 1)\n\n        if keyword in self._header:\n            if new_value is None:\n                # If the new value is None, i.e. None was assigned to the\n                # column attribute, then treat this as equivalent to deleting\n                # that attribute\n                del self._header[keyword]\n            else:\n                self._header[keyword] = new_value\n        else:\n            keyword_idx = KEYWORD_NAMES.index(base_keyword)\n            # Determine the appropriate keyword to insert this one before/after\n            # if it did not already exist in the header\n            for before_keyword in reversed(KEYWORD_NAMES[:keyword_idx]):\n                before_keyword += str(col_idx + 1)\n                if before_keyword in self._header:\n                    self._header.insert(before_keyword, (keyword, new_value),\n                                        after=True)\n                    break\n            else:\n                for after_keyword in KEYWORD_NAMES[keyword_idx + 1:]:\n                    after_keyword += str(col_idx + 1)\n                    if after_keyword in self._header:\n                        self._header.insert(after_keyword,\n                                            (keyword, new_value))\n                        break\n                else:\n                    # Just append\n                    self._header[keyword] = new_value\n\n    def _clear_table_keywords(self, index=None):\n        \"\"\"\n        Wipe out any existing table definition keywords from the header.\n\n        If specified, only clear keywords for the given table index (shifting\n        up keywords for any other columns).  The index is zero-based.\n        Otherwise keywords for all columns.\n        \"\"\"\n\n        # First collect all the table structure related keyword in the header\n        # into a single list so we can then sort them by index, which will be\n        # useful later for updating the header in a sensible order (since the\n        # header *might* not already be written in a reasonable order)\n        table_keywords = []\n\n        for idx, keyword in enumerate(self._header.keys()):\n            match = TDEF_RE.match(keyword)\n            try:\n                base_keyword = match.group('label')\n            except Exception:\n                continue                # skip if there is no match\n\n            if base_keyword in KEYWORD_TO_ATTRIBUTE:\n\n                # TEMP: For Astropy 3.0 we don't clear away the following keywords\n                # as we are first raising a deprecation warning that these will be\n                # dropped automatically if they were specified in the header. We\n                # can remove this once we are happy to break backward-compatibility\n                if base_keyword in {'TCTYP', 'TCUNI', 'TCRPX', 'TCRVL', 'TCDLT', 'TRPOS'}:\n                    continue\n\n                num = int(match.group('num')) - 1  # convert to zero-base\n                table_keywords.append((idx, match.group(0), base_keyword,\n                                       num))\n\n        # First delete\n        rev_sorted_idx_0 = sorted(table_keywords, key=operator.itemgetter(0),\n                                  reverse=True)\n        for idx, keyword, _, num in rev_sorted_idx_0:\n            if index is None or index == num:\n                del self._header[idx]\n\n        # Now shift up remaining column keywords if only one column was cleared\n        if index is not None:\n            sorted_idx_3 = sorted(table_keywords, key=operator.itemgetter(3))\n            for _, keyword, base_keyword, num in sorted_idx_3:\n                if num <= index:\n                    continue\n\n                old_card = self._header.cards[keyword]\n                new_card = (base_keyword + str(num), old_card.value,\n                            old_card.comment)\n                self._header.insert(keyword, new_card)\n                del self._header[keyword]\n\n            # Also decrement TFIELDS\n            if 'TFIELDS' in self._header:\n                self._header['TFIELDS'] -= 1\n\n    def _populate_table_keywords(self):\n        \"\"\"Populate the new table definition keywords from the header.\"\"\"\n\n        for idx, column in enumerate(self.columns):\n            for keyword, attr in KEYWORD_TO_ATTRIBUTE.items():\n                val = getattr(column, attr)\n                if val is not None:\n                    keyword = keyword + str(idx + 1)\n                    self._header[keyword] = val\n\n\nclass TableHDU(_TableBaseHDU):\n    \"\"\"\n    FITS ASCII table extension HDU class.\n\n    Parameters\n    ----------\n    data : array or `FITS_rec`\n        Data to be used.\n    header : `Header`\n        Header to be used.\n    name : str\n        Name to be populated in ``EXTNAME`` keyword.\n    ver : int > 0 or None, optional\n        The ver of the HDU, will be the value of the keyword ``EXTVER``.\n        If not given or None, it defaults to the value of the ``EXTVER``\n        card of the ``header`` or 1.\n        (default: None)\n    character_as_bytes : bool\n        Whether to return bytes for string columns. By default this is `False`\n        and (unicode) strings are returned, but this does not respect memory\n        mapping and loads the whole column in memory when accessed.\n\n    \"\"\"\n\n    _extension = 'TABLE'\n    _ext_comment = 'ASCII table extension'\n\n    _padding_byte = ' '\n    _columns_type = _AsciiColDefs\n\n    __format_RE = re.compile(\n        r'(?P<code>[ADEFIJ])(?P<width>\\d+)(?:\\.(?P<prec>\\d+))?')\n\n    def __init__(self, data=None, header=None, name=None, ver=None, character_as_bytes=False):\n        super().__init__(data, header, name=name, ver=ver, character_as_bytes=character_as_bytes)\n\n    @classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n        return card.keyword == 'XTENSION' and xtension == cls._extension\n\n    def _get_tbdata(self):\n        columns = self.columns\n        names = [n for idx, n in enumerate(columns.names)]\n\n        # determine if there are duplicate field names and if there\n        # are throw an exception\n        dup = np.rec.find_duplicate(names)\n\n        if dup:\n            raise ValueError(f\"Duplicate field names: {dup}\")\n\n        # TODO: Determine if this extra logic is necessary--I feel like the\n        # _AsciiColDefs class should be responsible for telling the table what\n        # its dtype should be...\n        itemsize = columns.spans[-1] + columns.starts[-1] - 1\n        dtype = {}\n\n        for idx in range(len(columns)):\n            data_type = 'S' + str(columns.spans[idx])\n\n            if idx == len(columns) - 1:\n                # The last column is padded out to the value of NAXIS1\n                if self._header['NAXIS1'] > itemsize:\n                    data_type = 'S' + str(columns.spans[idx] +\n                                self._header['NAXIS1'] - itemsize)\n            dtype[columns.names[idx]] = (data_type, columns.starts[idx] - 1)\n\n        raw_data = self._get_raw_data(self._nrows, dtype, self._data_offset)\n        data = raw_data.view(np.rec.recarray)\n        self._init_tbdata(data)\n        return data.view(self._data_type)\n\n    def _calculate_datasum(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        \"\"\"\n\n        if self._has_data:\n            # We have the data to be used.\n            # We need to pad the data to a block length before calculating\n            # the datasum.\n            bytes_array = self.data.view(type=np.ndarray, dtype=np.ubyte)\n            padding = np.frombuffer(_pad_length(self.size) * b' ',\n                                    dtype=np.ubyte)\n\n            d = np.append(bytes_array, padding)\n\n            cs = self._compute_checksum(d)\n            return cs\n        else:\n            # This is the case where the data has not been read from the file\n            # yet.  We can handle that in a generic manner so we do it in the\n            # base class.  The other possibility is that there is no data at\n            # all.  This can also be handled in a generic manner.\n            return super()._calculate_datasum()\n\n    def _verify(self, option='warn'):\n        \"\"\"\n        `TableHDU` verify method.\n        \"\"\"\n\n        errs = super()._verify(option=option)\n        self.req_cards('PCOUNT', None, lambda v: (v == 0), 0, option, errs)\n        tfields = self._header['TFIELDS']\n        for idx in range(tfields):\n            self.req_cards('TBCOL' + str(idx + 1), None, _is_int, None, option,\n                           errs)\n        return errs\n\n\nclass BinTableHDU(_TableBaseHDU):\n    \"\"\"\n    Binary table HDU class.\n\n    Parameters\n    ----------\n    data : array, `FITS_rec`, or `~astropy.table.Table`\n        Data to be used.\n    header : `Header`\n        Header to be used.\n    name : str\n        Name to be populated in ``EXTNAME`` keyword.\n    uint : bool, optional\n        Set to `True` if the table contains unsigned integer columns.\n    ver : int > 0 or None, optional\n        The ver of the HDU, will be the value of the keyword ``EXTVER``.\n        If not given or None, it defaults to the value of the ``EXTVER``\n        card of the ``header`` or 1.\n        (default: None)\n    character_as_bytes : bool\n        Whether to return bytes for string columns. By default this is `False`\n        and (unicode) strings are returned, but this does not respect memory\n        mapping and loads the whole column in memory when accessed.\n\n    \"\"\"\n\n    _extension = 'BINTABLE'\n    _ext_comment = 'binary table extension'\n\n    def __init__(self, data=None, header=None, name=None, uint=False, ver=None,\n                 character_as_bytes=False):\n        from astropy.table import Table\n        if isinstance(data, Table):\n            from astropy.io.fits.convenience import table_to_hdu\n            hdu = table_to_hdu(data)\n            if header is not None:\n                hdu.header.update(header)\n            data = hdu.data\n            header = hdu.header\n\n        super().__init__(data, header, name=name, uint=uint, ver=ver,\n                         character_as_bytes=character_as_bytes)\n\n    @classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n        return (card.keyword == 'XTENSION' and\n                xtension in (cls._extension, 'A3DTABLE'))\n\n    def _calculate_datasum_with_heap(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card given the input data\n        \"\"\"\n\n        with _binary_table_byte_swap(self.data) as data:\n            dout = data.view(type=np.ndarray, dtype=np.ubyte)\n            csum = self._compute_checksum(dout)\n\n            # Now add in the heap data to the checksum (we can skip any gap\n            # between the table and the heap since it's all zeros and doesn't\n            # contribute to the checksum\n            if data._get_raw_data() is None:\n                # This block is still needed because\n                # test_variable_length_table_data leads to ._get_raw_data\n                # returning None which means _get_heap_data doesn't work.\n                # Which happens when the data is loaded in memory rather than\n                # being unloaded on disk\n                for idx in range(data._nfields):\n                    if isinstance(data.columns._recformats[idx], _FormatP):\n                        for coldata in data.field(idx):\n                            # coldata should already be byteswapped from the call\n                            # to _binary_table_byte_swap\n                            if not len(coldata):\n                                continue\n\n                            csum = self._compute_checksum(coldata, csum)\n            else:\n                csum = self._compute_checksum(data._get_heap_data(), csum)\n\n            return csum\n\n    def _calculate_datasum(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        \"\"\"\n\n        if self._has_data:\n            # This method calculates the datasum while incorporating any\n            # heap data, which is obviously not handled from the base\n            # _calculate_datasum\n            return self._calculate_datasum_with_heap()\n        else:\n            # This is the case where the data has not been read from the file\n            # yet.  We can handle that in a generic manner so we do it in the\n            # base class.  The other possibility is that there is no data at\n            # all.  This can also be handled in a generic manner.\n            return super()._calculate_datasum()\n\n    def _writedata_internal(self, fileobj):\n        size = 0\n\n        if self.data is None:\n            return size\n\n        with _binary_table_byte_swap(self.data) as data:\n            if _has_unicode_fields(data):\n                # If the raw data was a user-supplied recarray, we can't write\n                # unicode columns directly to the file, so we have to switch\n                # to a slower row-by-row write\n                self._writedata_by_row(fileobj)\n            else:\n                fileobj.writearray(data)\n                # write out the heap of variable length array columns this has\n                # to be done after the \"regular\" data is written (above)\n                # to avoid a bug in the lustre filesystem client, don't\n                # write 0-byte objects\n                if data._gap > 0:\n                    fileobj.write((data._gap * '\\0').encode('ascii'))\n\n            nbytes = data._gap\n\n            if not self._manages_own_heap:\n                # Write the heap data one column at a time, in the order\n                # that the data pointers appear in the column (regardless\n                # if that data pointer has a different, previous heap\n                # offset listed)\n                for idx in range(data._nfields):\n                    if not isinstance(data.columns._recformats[idx],\n                                      _FormatP):\n                        continue\n\n                    field = self.data.field(idx)\n                    for row in field:\n                        if len(row) > 0:\n                            nbytes += row.nbytes\n                            fileobj.writearray(row)\n            else:\n                heap_data = data._get_heap_data()\n                if len(heap_data) > 0:\n                    nbytes += len(heap_data)\n                    fileobj.writearray(heap_data)\n\n            data._heapsize = nbytes - data._gap\n            size += nbytes\n\n        size += self.data.size * self.data._raw_itemsize\n\n        return size\n\n    def _writedata_by_row(self, fileobj):\n        fields = [self.data.field(idx)\n                  for idx in range(len(self.data.columns))]\n\n        # Creating Record objects is expensive (as in\n        # `for row in self.data:` so instead we just iterate over the row\n        # indices and get one field at a time:\n        for idx in range(len(self.data)):\n            for field in fields:\n                item = field[idx]\n                field_width = None\n\n                if field.dtype.kind == 'U':\n                    # Read the field *width* by reading past the field kind.\n                    i = field.dtype.str.index(field.dtype.kind)\n                    field_width = int(field.dtype.str[i+1:])\n                    item = np.char.encode(item, 'ascii')\n\n                fileobj.writearray(item)\n                if field_width is not None:\n                    j = item.dtype.str.index(item.dtype.kind)\n                    item_length = int(item.dtype.str[j+1:])\n                    # Fix padding problem (see #5296).\n                    padding = '\\x00'*(field_width - item_length)\n                    fileobj.write(padding.encode('ascii'))\n\n    _tdump_file_format = textwrap.dedent(\"\"\"\n\n        - **datafile:** Each line of the data file represents one row of table\n          data.  The data is output one column at a time in column order.  If\n          a column contains an array, each element of the column array in the\n          current row is output before moving on to the next column.  Each row\n          ends with a new line.\n\n          Integer data is output right-justified in a 21-character field\n          followed by a blank.  Floating point data is output right justified\n          using 'g' format in a 21-character field with 15 digits of\n          precision, followed by a blank.  String data that does not contain\n          whitespace is output left-justified in a field whose width matches\n          the width specified in the ``TFORM`` header parameter for the\n          column, followed by a blank.  When the string data contains\n          whitespace characters, the string is enclosed in quotation marks\n          (``\"\"``).  For the last data element in a row, the trailing blank in\n          the field is replaced by a new line character.\n\n          For column data containing variable length arrays ('P' format), the\n          array data is preceded by the string ``'VLA_Length= '`` and the\n          integer length of the array for that row, left-justified in a\n          21-character field, followed by a blank.\n\n          .. note::\n\n              This format does *not* support variable length arrays using the\n              ('Q' format) due to difficult to overcome ambiguities. What this\n              means is that this file format cannot support VLA columns in\n              tables stored in files that are over 2 GB in size.\n\n          For column data representing a bit field ('X' format), each bit\n          value in the field is output right-justified in a 21-character field\n          as 1 (for true) or 0 (for false).\n\n        - **cdfile:** Each line of the column definitions file provides the\n          definitions for one column in the table.  The line is broken up into\n          8, sixteen-character fields.  The first field provides the column\n          name (``TTYPEn``).  The second field provides the column format\n          (``TFORMn``).  The third field provides the display format\n          (``TDISPn``).  The fourth field provides the physical units\n          (``TUNITn``).  The fifth field provides the dimensions for a\n          multidimensional array (``TDIMn``).  The sixth field provides the\n          value that signifies an undefined value (``TNULLn``).  The seventh\n          field provides the scale factor (``TSCALn``).  The eighth field\n          provides the offset value (``TZEROn``).  A field value of ``\"\"`` is\n          used to represent the case where no value is provided.\n\n        - **hfile:** Each line of the header parameters file provides the\n          definition of a single HDU header card as represented by the card\n          image.\n      \"\"\")\n\n    def dump(self, datafile=None, cdfile=None, hfile=None, overwrite=False):\n        \"\"\"\n        Dump the table HDU to a file in ASCII format.  The table may be dumped\n        in three separate files, one containing column definitions, one\n        containing header parameters, and one for table data.\n\n        Parameters\n        ----------\n        datafile : path-like or file-like, optional\n            Output data file.  The default is the root name of the\n            fits file associated with this HDU appended with the\n            extension ``.txt``.\n\n        cdfile : path-like or file-like, optional\n            Output column definitions file.  The default is `None`, no\n            column definitions output is produced.\n\n        hfile : path-like or file-like, optional\n            Output header parameters file.  The default is `None`,\n            no header parameters output is produced.\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n\n        Notes\n        -----\n        The primary use for the `dump` method is to allow viewing and editing\n        the table data and parameters in a standard text editor.\n        The `load` method can be used to create a new table from the three\n        plain text (ASCII) files.\n        \"\"\"\n\n        # check if the output files already exist\n        exist = []\n        files = [datafile, cdfile, hfile]\n\n        for f in files:\n            if isinstance(f, str):\n                if os.path.exists(f) and os.path.getsize(f) != 0:\n                    if overwrite:\n                        os.remove(f)\n                    else:\n                        exist.append(f)\n\n        if exist:\n            raise OSError('  '.join([f\"File '{f}' already exists.\"\n                                     for f in exist])+\"  If you mean to \"\n                                                      \"replace the file(s) \"\n                                                      \"then use the argument \"\n                                                      \"'overwrite=True'.\")\n\n        # Process the data\n        self._dump_data(datafile)\n\n        # Process the column definitions\n        if cdfile:\n            self._dump_coldefs(cdfile)\n\n        # Process the header parameters\n        if hfile:\n            self._header.tofile(hfile, sep='\\n', endcard=False, padding=False)\n\n    if isinstance(dump.__doc__, str):\n        dump.__doc__ += _tdump_file_format.replace('\\n', '\\n        ')\n\n    def load(cls, datafile, cdfile=None, hfile=None, replace=False,\n             header=None):\n        \"\"\"\n        Create a table from the input ASCII files.  The input is from up to\n        three separate files, one containing column definitions, one containing\n        header parameters, and one containing column data.\n\n        The column definition and header parameters files are not required.\n        When absent the column definitions and/or header parameters are taken\n        from the header object given in the header argument; otherwise sensible\n        defaults are inferred (though this mode is not recommended).\n\n        Parameters\n        ----------\n        datafile : path-like or file-like\n            Input data file containing the table data in ASCII format.\n\n        cdfile : path-like or file-like, optional\n            Input column definition file containing the names,\n            formats, display formats, physical units, multidimensional\n            array dimensions, undefined values, scale factors, and\n            offsets associated with the columns in the table.  If\n            `None`, the column definitions are taken from the current\n            values in this object.\n\n        hfile : path-like or file-like, optional\n            Input parameter definition file containing the header\n            parameter definitions to be associated with the table.  If\n            `None`, the header parameter definitions are taken from\n            the current values in this objects header.\n\n        replace : bool, optional\n            When `True`, indicates that the entire header should be\n            replaced with the contents of the ASCII file instead of\n            just updating the current header.\n\n        header : `~astropy.io.fits.Header`, optional\n            When the cdfile and hfile are missing, use this Header object in\n            the creation of the new table and HDU.  Otherwise this Header\n            supersedes the keywords from hfile, which is only used to update\n            values not present in this Header, unless ``replace=True`` in which\n            this Header's values are completely replaced with the values from\n            hfile.\n\n        Notes\n        -----\n        The primary use for the `load` method is to allow the input of ASCII\n        data that was edited in a standard text editor of the table data and\n        parameters.  The `dump` method can be used to create the initial ASCII\n        files.\n        \"\"\"\n\n        # Process the parameter file\n        if header is None:\n            header = Header()\n\n        if hfile:\n            if replace:\n                header = Header.fromtextfile(hfile)\n            else:\n                header.extend(Header.fromtextfile(hfile), update=True,\n                              update_first=True)\n\n        coldefs = None\n        # Process the column definitions file\n        if cdfile:\n            coldefs = cls._load_coldefs(cdfile)\n\n        # Process the data file\n        data = cls._load_data(datafile, coldefs)\n        if coldefs is None:\n            coldefs = ColDefs(data)\n\n        # Create a new HDU using the supplied header and data\n        hdu = cls(data=data, header=header)\n        hdu.columns = coldefs\n        return hdu\n\n    if isinstance(load.__doc__, str):\n        load.__doc__ += _tdump_file_format.replace('\\n', '\\n        ')\n\n    load = classmethod(load)\n    # Have to create a classmethod from this here instead of as a decorator;\n    # otherwise we can't update __doc__\n\n    def _dump_data(self, fileobj):\n        \"\"\"\n        Write the table data in the ASCII format read by BinTableHDU.load()\n        to fileobj.\n        \"\"\"\n\n        if not fileobj and self._file:\n            root = os.path.splitext(self._file.name)[0]\n            fileobj = root + '.txt'\n\n        close_file = False\n\n        if isinstance(fileobj, str):\n            fileobj = open(fileobj, 'w')\n            close_file = True\n\n        linewriter = csv.writer(fileobj, dialect=FITSTableDumpDialect)\n\n        # Process each row of the table and output one row at a time\n        def format_value(val, format):\n            if format[0] == 'S':\n                itemsize = int(format[1:])\n                return '{:{size}}'.format(val, size=itemsize)\n            elif format in np.typecodes['AllInteger']:\n                # output integer\n                return f'{val:21d}'\n            elif format in np.typecodes['Complex']:\n                return f'{val.real:21.15g}+{val.imag:.15g}j'\n            elif format in np.typecodes['Float']:\n                # output floating point\n                return f'{val:#21.15g}'\n\n        for row in self.data:\n            line = []   # the line for this row of the table\n\n            # Process each column of the row.\n            for column in self.columns:\n                # format of data in a variable length array\n                # where None means it is not a VLA:\n                vla_format = None\n                format = _convert_format(column.format)\n\n                if isinstance(format, _FormatP):\n                    # P format means this is a variable length array so output\n                    # the length of the array for this row and set the format\n                    # for the VLA data\n                    line.append('VLA_Length=')\n                    line.append(f'{len(row[column.name]):21d}')\n                    _, dtype, option = _parse_tformat(column.format)\n                    vla_format = FITS2NUMPY[option[0]][0]\n\n                if vla_format:\n                    # Output the data for each element in the array\n                    for val in row[column.name].flat:\n                        line.append(format_value(val, vla_format))\n                else:\n                    # The column data is a single element\n                    dtype = self.data.dtype.fields[column.name][0]\n                    array_format = dtype.char\n                    if array_format == 'V':\n                        array_format = dtype.base.char\n                    if array_format == 'S':\n                        array_format += str(dtype.itemsize)\n\n                    if dtype.char == 'V':\n                        for value in row[column.name].flat:\n                            line.append(format_value(value, array_format))\n                    else:\n                        line.append(format_value(row[column.name],\n                                    array_format))\n            linewriter.writerow(line)\n        if close_file:\n            fileobj.close()\n\n    def _dump_coldefs(self, fileobj):\n        \"\"\"\n        Write the column definition parameters in the ASCII format read by\n        BinTableHDU.load() to fileobj.\n        \"\"\"\n\n        close_file = False\n\n        if isinstance(fileobj, str):\n            fileobj = open(fileobj, 'w')\n            close_file = True\n\n        # Process each column of the table and output the result to the\n        # file one at a time\n        for column in self.columns:\n            line = [column.name, column.format]\n            attrs = ['disp', 'unit', 'dim', 'null', 'bscale', 'bzero']\n            line += ['{!s:16s}'.format(value if value else '\"\"')\n                     for value in (getattr(column, attr) for attr in attrs)]\n            fileobj.write(' '.join(line))\n            fileobj.write('\\n')\n\n        if close_file:\n            fileobj.close()\n\n    @classmethod\n    def _load_data(cls, fileobj, coldefs=None):\n        \"\"\"\n        Read the table data from the ASCII file output by BinTableHDU.dump().\n        \"\"\"\n\n        close_file = False\n\n        if isinstance(fileobj, str):\n            fileobj = open(fileobj, 'r')\n            close_file = True\n\n        initialpos = fileobj.tell()  # We'll be returning here later\n        linereader = csv.reader(fileobj, dialect=FITSTableDumpDialect)\n\n        # First we need to do some preprocessing on the file to find out how\n        # much memory we'll need to reserve for the table.  This is necessary\n        # even if we already have the coldefs in order to determine how many\n        # rows to reserve memory for\n        vla_lengths = []\n        recformats = []\n        names = []\n        nrows = 0\n        if coldefs is not None:\n            recformats = coldefs._recformats\n            names = coldefs.names\n\n        def update_recformats(value, idx):\n            fitsformat = _scalar_to_format(value)\n            recformat = _convert_format(fitsformat)\n            if idx >= len(recformats):\n                recformats.append(recformat)\n            else:\n                if _cmp_recformats(recformats[idx], recformat) < 0:\n                    recformats[idx] = recformat\n\n        # TODO: The handling of VLAs could probably be simplified a bit\n        for row in linereader:\n            nrows += 1\n            if coldefs is not None:\n                continue\n            col = 0\n            idx = 0\n            while idx < len(row):\n                if row[idx] == 'VLA_Length=':\n                    if col < len(vla_lengths):\n                        vla_length = vla_lengths[col]\n                    else:\n                        vla_length = int(row[idx + 1])\n                        vla_lengths.append(vla_length)\n                    idx += 2\n                    while vla_length:\n                        update_recformats(row[idx], col)\n                        vla_length -= 1\n                        idx += 1\n                    col += 1\n                else:\n                    if col >= len(vla_lengths):\n                        vla_lengths.append(None)\n                    update_recformats(row[idx], col)\n                    col += 1\n                    idx += 1\n\n        # Update the recformats for any VLAs\n        for idx, length in enumerate(vla_lengths):\n            if length is not None:\n                recformats[idx] = str(length) + recformats[idx]\n\n        dtype = np.rec.format_parser(recformats, names, None).dtype\n\n        # TODO: In the future maybe enable loading a bit at a time so that we\n        # can convert from this format to an actual FITS file on disk without\n        # needing enough physical memory to hold the entire thing at once\n        hdu = BinTableHDU.from_columns(np.recarray(shape=1, dtype=dtype),\n                                       nrows=nrows, fill=True)\n\n        # TODO: It seems to me a lot of this could/should be handled from\n        # within the FITS_rec class rather than here.\n        data = hdu.data\n        for idx, length in enumerate(vla_lengths):\n            if length is not None:\n                arr = data.columns._arrays[idx]\n                dt = recformats[idx][len(str(length)):]\n\n                # NOTE: FormatQ not supported here; it's hard to determine\n                # whether or not it will be necessary to use a wider descriptor\n                # type. The function documentation will have to serve as a\n                # warning that this is not supported.\n                recformats[idx] = _FormatP(dt, max=length)\n                data.columns._recformats[idx] = recformats[idx]\n                name = data.columns.names[idx]\n                data._cache_field(name, _makep(arr, arr, recformats[idx]))\n\n        def format_value(col, val):\n            # Special formatting for a couple particular data types\n            if recformats[col] == FITS2NUMPY['L']:\n                return bool(int(val))\n            elif recformats[col] == FITS2NUMPY['M']:\n                # For some reason, in arrays/fields where numpy expects a\n                # complex it's not happy to take a string representation\n                # (though it's happy to do that in other contexts), so we have\n                # to convert the string representation for it:\n                return complex(val)\n            else:\n                return val\n\n        # Jump back to the start of the data and create a new line reader\n        fileobj.seek(initialpos)\n        linereader = csv.reader(fileobj, dialect=FITSTableDumpDialect)\n        for row, line in enumerate(linereader):\n            col = 0\n            idx = 0\n            while idx < len(line):\n                if line[idx] == 'VLA_Length=':\n                    vla_len = vla_lengths[col]\n                    idx += 2\n                    slice_ = slice(idx, idx + vla_len)\n                    data[row][col][:] = line[idx:idx + vla_len]\n                    idx += vla_len\n                elif dtype[col].shape:\n                    # This is an array column\n                    array_size = int(np.multiply.reduce(dtype[col].shape))\n                    slice_ = slice(idx, idx + array_size)\n                    idx += array_size\n                else:\n                    slice_ = None\n\n                if slice_ is None:\n                    # This is a scalar row element\n                    data[row][col] = format_value(col, line[idx])\n                    idx += 1\n                else:\n                    data[row][col].flat[:] = [format_value(col, val)\n                                              for val in line[slice_]]\n\n                col += 1\n\n        if close_file:\n            fileobj.close()\n\n        return data\n\n    @classmethod\n    def _load_coldefs(cls, fileobj):\n        \"\"\"\n        Read the table column definitions from the ASCII file output by\n        BinTableHDU.dump().\n        \"\"\"\n\n        close_file = False\n\n        if isinstance(fileobj, str):\n            fileobj = open(fileobj, 'r')\n            close_file = True\n\n        columns = []\n\n        for line in fileobj:\n            words = line[:-1].split()\n            kwargs = {}\n            for key in ['name', 'format', 'disp', 'unit', 'dim']:\n                kwargs[key] = words.pop(0).replace('\"\"', '')\n\n            for key in ['null', 'bscale', 'bzero']:\n                word = words.pop(0).replace('\"\"', '')\n                if word:\n                    word = _str_to_num(word)\n                kwargs[key] = word\n            columns.append(Column(**kwargs))\n\n        if close_file:\n            fileobj.close()\n\n        return ColDefs(columns)\n\n\n@contextlib.contextmanager\ndef _binary_table_byte_swap(data):\n    \"\"\"\n    Ensures that all the data of a binary FITS table (represented as a FITS_rec\n    object) is in a big-endian byte order.  Columns are swapped in-place one\n    at a time, and then returned to their previous byte order when this context\n    manager exits.\n\n    Because a new dtype is needed to represent the byte-swapped columns, the\n    new dtype is temporarily applied as well.\n    \"\"\"\n\n    orig_dtype = data.dtype\n\n    names = []\n    formats = []\n    offsets = []\n\n    to_swap = []\n\n    if sys.byteorder == 'little':\n        swap_types = ('<', '=')\n    else:\n        swap_types = ('<',)\n\n    for idx, name in enumerate(orig_dtype.names):\n        field = _get_recarray_field(data, idx)\n\n        field_dtype, field_offset = orig_dtype.fields[name]\n        names.append(name)\n        formats.append(field_dtype)\n        offsets.append(field_offset)\n\n        if isinstance(field, chararray.chararray):\n            continue\n\n        # only swap unswapped\n        # must use field_dtype.base here since for multi-element dtypes,\n        # the .str with be '|V<N>' where <N> is the total bytes per element\n        if field.itemsize > 1 and field_dtype.base.str[0] in swap_types:\n            to_swap.append(field)\n            # Override the dtype for this field in the new record dtype with\n            # the byteswapped version\n            formats[-1] = field_dtype.newbyteorder()\n\n        # deal with var length table\n        recformat = data.columns._recformats[idx]\n        if isinstance(recformat, _FormatP):\n            coldata = data.field(idx)\n            for c in coldata:\n                if (not isinstance(c, chararray.chararray) and\n                        c.itemsize > 1 and c.dtype.str[0] in swap_types):\n                    to_swap.append(c)\n\n    for arr in reversed(to_swap):\n        arr.byteswap(True)\n\n    data.dtype = np.dtype({'names': names,\n                           'formats': formats,\n                           'offsets': offsets})\n\n    yield data\n\n    for arr in to_swap:\n        arr.byteswap(True)\n\n    data.dtype = orig_dtype\n"},{"col":4,"comment":"null","endLoc":3415,"header":"def __deepcopy__(self, memo=None)","id":2435,"name":"__deepcopy__","nodeType":"Function","startLoc":3414,"text":"def __deepcopy__(self, memo=None):\n        return self.copy(True)"},{"col":4,"comment":"null","endLoc":3418,"header":"def __copy__(self)","id":2436,"name":"__copy__","nodeType":"Function","startLoc":3417,"text":"def __copy__(self):\n        return self.copy(False)"},{"col":4,"comment":"null","endLoc":3421,"header":"def __lt__(self, other)","id":2437,"name":"__lt__","nodeType":"Function","startLoc":3420,"text":"def __lt__(self, other):\n        return super().__lt__(other)"},{"col":4,"comment":"null","endLoc":3424,"header":"def __gt__(self, other)","id":2438,"name":"__gt__","nodeType":"Function","startLoc":3423,"text":"def __gt__(self, other):\n        return super().__gt__(other)"},{"col":4,"comment":"null","endLoc":3427,"header":"def __le__(self, other)","id":2439,"name":"__le__","nodeType":"Function","startLoc":3426,"text":"def __le__(self, other):\n        return super().__le__(other)"},{"className":"AstropyDeprecationWarning","col":0,"comment":"\n    A warning class to indicate a deprecated feature.\n    ","endLoc":43,"id":2440,"nodeType":"Class","startLoc":40,"text":"class AstropyDeprecationWarning(AstropyWarning):\n    \"\"\"\n    A warning class to indicate a deprecated feature.\n    \"\"\""},{"col":4,"comment":"null","endLoc":3430,"header":"def __ge__(self, other)","id":2441,"name":"__ge__","nodeType":"Function","startLoc":3429,"text":"def __ge__(self, other):\n        return super().__ge__(other)"},{"className":"FITSTableDumpDialect","col":0,"comment":"\n    A CSV dialect for the Astropy format of ASCII dumps of FITS tables.\n    ","endLoc":43,"id":2442,"nodeType":"Class","startLoc":34,"text":"class FITSTableDumpDialect(csv.excel):\n    \"\"\"\n    A CSV dialect for the Astropy format of ASCII dumps of FITS tables.\n    \"\"\"\n\n    delimiter = ' '\n    lineterminator = '\\n'\n    quotechar = '\"'\n    quoting = csv.QUOTE_ALL\n    skipinitialspace = True"},{"attributeType":"null","col":4,"comment":"null","endLoc":39,"id":2443,"name":"delimiter","nodeType":"Attribute","startLoc":39,"text":"delimiter"},{"attributeType":"null","col":4,"comment":"null","endLoc":40,"id":2444,"name":"lineterminator","nodeType":"Attribute","startLoc":40,"text":"lineterminator"},{"attributeType":"null","col":4,"comment":"null","endLoc":41,"id":2445,"name":"quotechar","nodeType":"Attribute","startLoc":41,"text":"quotechar"},{"col":4,"comment":"null","endLoc":3433,"header":"def __eq__(self, other)","id":2446,"name":"__eq__","nodeType":"Function","startLoc":3432,"text":"def __eq__(self, other):\n        return self._rows_equal(other)"},{"attributeType":"null","col":4,"comment":"null","endLoc":42,"id":2447,"name":"quoting","nodeType":"Attribute","startLoc":42,"text":"quoting"},{"attributeType":"null","col":4,"comment":"null","endLoc":43,"id":2448,"name":"skipinitialspace","nodeType":"Attribute","startLoc":43,"text":"skipinitialspace"},{"className":"TableHDU","col":0,"comment":"\n    FITS ASCII table extension HDU class.\n\n    Parameters\n    ----------\n    data : array or `FITS_rec`\n        Data to be used.\n    header : `Header`\n        Header to be used.\n    name : str\n        Name to be populated in ``EXTNAME`` keyword.\n    ver : int > 0 or None, optional\n        The ver of the HDU, will be the value of the keyword ``EXTVER``.\n        If not given or None, it defaults to the value of the ``EXTVER``\n        card of the ``header`` or 1.\n        (default: None)\n    character_as_bytes : bool\n        Whether to return bytes for string columns. By default this is `False`\n        and (unicode) strings are returned, but this does not respect memory\n        mapping and loads the whole column in memory when accessed.\n\n    ","endLoc":819,"id":2449,"nodeType":"Class","startLoc":708,"text":"class TableHDU(_TableBaseHDU):\n    \"\"\"\n    FITS ASCII table extension HDU class.\n\n    Parameters\n    ----------\n    data : array or `FITS_rec`\n        Data to be used.\n    header : `Header`\n        Header to be used.\n    name : str\n        Name to be populated in ``EXTNAME`` keyword.\n    ver : int > 0 or None, optional\n        The ver of the HDU, will be the value of the keyword ``EXTVER``.\n        If not given or None, it defaults to the value of the ``EXTVER``\n        card of the ``header`` or 1.\n        (default: None)\n    character_as_bytes : bool\n        Whether to return bytes for string columns. By default this is `False`\n        and (unicode) strings are returned, but this does not respect memory\n        mapping and loads the whole column in memory when accessed.\n\n    \"\"\"\n\n    _extension = 'TABLE'\n    _ext_comment = 'ASCII table extension'\n\n    _padding_byte = ' '\n    _columns_type = _AsciiColDefs\n\n    __format_RE = re.compile(\n        r'(?P<code>[ADEFIJ])(?P<width>\\d+)(?:\\.(?P<prec>\\d+))?')\n\n    def __init__(self, data=None, header=None, name=None, ver=None, character_as_bytes=False):\n        super().__init__(data, header, name=name, ver=ver, character_as_bytes=character_as_bytes)\n\n    @classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n        return card.keyword == 'XTENSION' and xtension == cls._extension\n\n    def _get_tbdata(self):\n        columns = self.columns\n        names = [n for idx, n in enumerate(columns.names)]\n\n        # determine if there are duplicate field names and if there\n        # are throw an exception\n        dup = np.rec.find_duplicate(names)\n\n        if dup:\n            raise ValueError(f\"Duplicate field names: {dup}\")\n\n        # TODO: Determine if this extra logic is necessary--I feel like the\n        # _AsciiColDefs class should be responsible for telling the table what\n        # its dtype should be...\n        itemsize = columns.spans[-1] + columns.starts[-1] - 1\n        dtype = {}\n\n        for idx in range(len(columns)):\n            data_type = 'S' + str(columns.spans[idx])\n\n            if idx == len(columns) - 1:\n                # The last column is padded out to the value of NAXIS1\n                if self._header['NAXIS1'] > itemsize:\n                    data_type = 'S' + str(columns.spans[idx] +\n                                self._header['NAXIS1'] - itemsize)\n            dtype[columns.names[idx]] = (data_type, columns.starts[idx] - 1)\n\n        raw_data = self._get_raw_data(self._nrows, dtype, self._data_offset)\n        data = raw_data.view(np.rec.recarray)\n        self._init_tbdata(data)\n        return data.view(self._data_type)\n\n    def _calculate_datasum(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        \"\"\"\n\n        if self._has_data:\n            # We have the data to be used.\n            # We need to pad the data to a block length before calculating\n            # the datasum.\n            bytes_array = self.data.view(type=np.ndarray, dtype=np.ubyte)\n            padding = np.frombuffer(_pad_length(self.size) * b' ',\n                                    dtype=np.ubyte)\n\n            d = np.append(bytes_array, padding)\n\n            cs = self._compute_checksum(d)\n            return cs\n        else:\n            # This is the case where the data has not been read from the file\n            # yet.  We can handle that in a generic manner so we do it in the\n            # base class.  The other possibility is that there is no data at\n            # all.  This can also be handled in a generic manner.\n            return super()._calculate_datasum()\n\n    def _verify(self, option='warn'):\n        \"\"\"\n        `TableHDU` verify method.\n        \"\"\"\n\n        errs = super()._verify(option=option)\n        self.req_cards('PCOUNT', None, lambda v: (v == 0), 0, option, errs)\n        tfields = self._header['TFIELDS']\n        for idx in range(tfields):\n            self.req_cards('TBCOL' + str(idx + 1), None, _is_int, None, option,\n                           errs)\n        return errs"},{"col":4,"comment":"null","endLoc":742,"header":"def __init__(self, data=None, header=None, name=None, ver=None, character_as_bytes=False)","id":2450,"name":"__init__","nodeType":"Function","startLoc":741,"text":"def __init__(self, data=None, header=None, name=None, ver=None, character_as_bytes=False):\n        super().__init__(data, header, name=name, ver=ver, character_as_bytes=character_as_bytes)"},{"col":4,"comment":"\n        Row-wise comparison of table with any other object.\n\n        This is actual implementation for __eq__.\n\n        Returns a 1-D boolean numpy array showing result of row-wise comparison.\n        This is the same as the ``==`` comparison for tables.\n\n        Parameters\n        ----------\n        other : Table or DataFrame or ndarray\n             An object to compare with table\n\n        Examples\n        --------\n        Comparing one Table with other::\n\n            >>> t1 = Table([[1,2],[4,5],[7,8]], names=('a','b','c'))\n            >>> t2 = Table([[1,2],[4,5],[7,8]], names=('a','b','c'))\n            >>> t1._rows_equal(t2)\n            array([ True,  True])\n\n        ","endLoc":3483,"header":"def _rows_equal(self, other)","id":2451,"name":"_rows_equal","nodeType":"Function","startLoc":3438,"text":"def _rows_equal(self, other):\n        \"\"\"\n        Row-wise comparison of table with any other object.\n\n        This is actual implementation for __eq__.\n\n        Returns a 1-D boolean numpy array showing result of row-wise comparison.\n        This is the same as the ``==`` comparison for tables.\n\n        Parameters\n        ----------\n        other : Table or DataFrame or ndarray\n             An object to compare with table\n\n        Examples\n        --------\n        Comparing one Table with other::\n\n            >>> t1 = Table([[1,2],[4,5],[7,8]], names=('a','b','c'))\n            >>> t2 = Table([[1,2],[4,5],[7,8]], names=('a','b','c'))\n            >>> t1._rows_equal(t2)\n            array([ True,  True])\n\n        \"\"\"\n\n        if isinstance(other, Table):\n            other = other.as_array()\n\n        if self.has_masked_columns:\n            if isinstance(other, np.ma.MaskedArray):\n                result = self.as_array() == other\n            else:\n                # If mask is True, then by definition the row doesn't match\n                # because the other array is not masked.\n                false_mask = np.zeros(1, dtype=[(n, bool) for n in self.dtype.names])\n                result = (self.as_array().data == other) & (self.mask == false_mask)\n        else:\n            if isinstance(other, np.ma.MaskedArray):\n                # If mask is True, then by definition the row doesn't match\n                # because the other array is not masked.\n                false_mask = np.zeros(1, dtype=[(n, bool) for n in other.dtype.names])\n                result = (self.as_array() == other.data) & (other.mask == false_mask)\n            else:\n                result = self.as_array() == other\n\n        return result"},{"col":4,"comment":"null","endLoc":3436,"header":"def __ne__(self, other)","id":2452,"name":"__ne__","nodeType":"Function","startLoc":3435,"text":"def __ne__(self, other):\n        return ~self.__eq__(other)"},{"col":4,"comment":"\n        Element-wise comparison of table with another table, list, or scalar.\n\n        Returns a ``Table`` with the same columns containing boolean values\n        showing result of comparison.\n\n        Parameters\n        ----------\n        other : table-like object or list or scalar\n             Object to compare with table\n\n        Examples\n        --------\n        Compare one Table with other::\n\n          >>> t1 = Table([[1, 2], [4, 5], [-7, 8]], names=('a', 'b', 'c'))\n          >>> t2 = Table([[1, 2], [-4, 5], [7, 8]], names=('a', 'b', 'c'))\n          >>> t1.values_equal(t2)\n          <Table length=2>\n           a     b     c\n          bool  bool  bool\n          ---- ----- -----\n          True False False\n          True  True  True\n\n        ","endLoc":3558,"header":"def values_equal(self, other)","id":2453,"name":"values_equal","nodeType":"Function","startLoc":3485,"text":"def values_equal(self, other):\n        \"\"\"\n        Element-wise comparison of table with another table, list, or scalar.\n\n        Returns a ``Table`` with the same columns containing boolean values\n        showing result of comparison.\n\n        Parameters\n        ----------\n        other : table-like object or list or scalar\n             Object to compare with table\n\n        Examples\n        --------\n        Compare one Table with other::\n\n          >>> t1 = Table([[1, 2], [4, 5], [-7, 8]], names=('a', 'b', 'c'))\n          >>> t2 = Table([[1, 2], [-4, 5], [7, 8]], names=('a', 'b', 'c'))\n          >>> t1.values_equal(t2)\n          <Table length=2>\n           a     b     c\n          bool  bool  bool\n          ---- ----- -----\n          True False False\n          True  True  True\n\n        \"\"\"\n        if isinstance(other, Table):\n            names = other.colnames\n        else:\n            try:\n                other = Table(other, copy=False)\n                names = other.colnames\n            except Exception:\n                # Broadcast other into a dict, so e.g. other = 2 will turn into\n                # other = {'a': 2, 'b': 2} and then equality does a\n                # column-by-column broadcasting.\n                names = self.colnames\n                other = {name: other for name in names}\n\n        # Require column names match but do not require same column order\n        if set(self.colnames) != set(names):\n            raise ValueError('cannot compare tables with different column names')\n\n        eqs = []\n        for name in names:\n            try:\n                np.broadcast(self[name], other[name])  # Check if broadcast-able\n                # Catch the numpy FutureWarning related to equality checking,\n                # \"elementwise comparison failed; returning scalar instead, but\n                #  in the future will perform elementwise comparison\".  Turn this\n                # into an exception since the scalar answer is not what we want.\n                with warnings.catch_warnings(record=True) as warns:\n                    warnings.simplefilter('always')\n                    eq = self[name] == other[name]\n                    if (warns and issubclass(warns[-1].category, FutureWarning)\n                            and 'elementwise comparison failed' in str(warns[-1].message)):\n                        raise FutureWarning(warns[-1].message)\n            except Exception as err:\n                raise ValueError(f'unable to compare column {name}') from err\n\n            # Be strict about the result from the comparison. E.g. SkyCoord __eq__ is just\n            # broken and completely ignores that it should return an array.\n            if not (isinstance(eq, np.ndarray)\n                    and eq.dtype is np.dtype('bool')\n                    and len(eq) == len(self)):\n                raise TypeError(f'comparison for column {name} returned {eq} '\n                                f'instead of the expected boolean ndarray')\n\n            eqs.append(eq)\n\n        out = Table(eqs, names=names)\n\n        return out"},{"col":4,"comment":"\n        Summarize the HDU: name, dimensions, and formats.\n        ","endLoc":1637,"header":"def _summary(self)","id":2454,"name":"_summary","nodeType":"Function","startLoc":1607,"text":"def _summary(self):\n        \"\"\"\n        Summarize the HDU: name, dimensions, and formats.\n        \"\"\"\n        class_name = self.__class__.__name__\n\n        # if data is touched, use data info.\n        if self._data_loaded:\n            if self.data is None:\n                _shape, _format = (), ''\n            else:\n\n                # the shape will be in the order of NAXIS's which is the\n                # reverse of the numarray shape\n                _shape = list(self.data.shape)\n                _format = self.data.dtype.name\n                _shape.reverse()\n                _shape = tuple(_shape)\n                _format = _format[_format.rfind('.') + 1:]\n\n        # if data is not touched yet, use header info.\n        else:\n            _shape = ()\n\n            for idx in range(self.header['NAXIS']):\n                _shape += (self.header['NAXIS' + str(idx + 1)],)\n\n            _format = BITPIX2DTYPE[self.header['BITPIX']]\n\n        return (self.name, self.ver, class_name, len(self.header), _shape,\n                _format)"},{"col":4,"comment":"null","endLoc":750,"header":"@classmethod\n    def match_header(cls, header)","id":2455,"name":"match_header","nodeType":"Function","startLoc":744,"text":"@classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n        return card.keyword == 'XTENSION' and xtension == cls._extension"},{"col":4,"comment":"null","endLoc":782,"header":"def _get_tbdata(self)","id":2456,"name":"_get_tbdata","nodeType":"Function","startLoc":752,"text":"def _get_tbdata(self):\n        columns = self.columns\n        names = [n for idx, n in enumerate(columns.names)]\n\n        # determine if there are duplicate field names and if there\n        # are throw an exception\n        dup = np.rec.find_duplicate(names)\n\n        if dup:\n            raise ValueError(f\"Duplicate field names: {dup}\")\n\n        # TODO: Determine if this extra logic is necessary--I feel like the\n        # _AsciiColDefs class should be responsible for telling the table what\n        # its dtype should be...\n        itemsize = columns.spans[-1] + columns.starts[-1] - 1\n        dtype = {}\n\n        for idx in range(len(columns)):\n            data_type = 'S' + str(columns.spans[idx])\n\n            if idx == len(columns) - 1:\n                # The last column is padded out to the value of NAXIS1\n                if self._header['NAXIS1'] > itemsize:\n                    data_type = 'S' + str(columns.spans[idx] +\n                                self._header['NAXIS1'] - itemsize)\n            dtype[columns.names[idx]] = (data_type, columns.starts[idx] - 1)\n\n        raw_data = self._get_raw_data(self._nrows, dtype, self._data_offset)\n        data = raw_data.view(np.rec.recarray)\n        self._init_tbdata(data)\n        return data.view(self._data_type)"},{"col":4,"comment":"\n        Scale image data by using ``BSCALE`` and ``BZERO``.\n\n        Calling this method will scale ``self.data`` and update the keywords of\n        ``BSCALE`` and ``BZERO`` in ``self._header`` and ``self._image_header``.\n        This method should only be used right before writing to the output\n        file, as the data will be scaled and is therefore not very usable after\n        the call.\n\n        Parameters\n        ----------\n\n        type : str, optional\n            destination data type, use a string representing a numpy dtype\n            name, (e.g. ``'uint8'``, ``'int16'``, ``'float32'`` etc.).  If is\n            `None`, use the current data type.\n\n        option : str, optional\n            how to scale the data: if ``\"old\"``, use the original ``BSCALE``\n            and ``BZERO`` values when the data was read/created. If\n            ``\"minmax\"``, use the minimum and maximum of the data to scale.\n            The option will be overwritten by any user-specified bscale/bzero\n            values.\n\n        bscale, bzero : int, optional\n            user specified ``BSCALE`` and ``BZERO`` values.\n        ","endLoc":1818,"header":"def scale(self, type=None, option='old', bscale=1, bzero=0)","id":2457,"name":"scale","nodeType":"Function","startLoc":1712,"text":"def scale(self, type=None, option='old', bscale=1, bzero=0):\n        \"\"\"\n        Scale image data by using ``BSCALE`` and ``BZERO``.\n\n        Calling this method will scale ``self.data`` and update the keywords of\n        ``BSCALE`` and ``BZERO`` in ``self._header`` and ``self._image_header``.\n        This method should only be used right before writing to the output\n        file, as the data will be scaled and is therefore not very usable after\n        the call.\n\n        Parameters\n        ----------\n\n        type : str, optional\n            destination data type, use a string representing a numpy dtype\n            name, (e.g. ``'uint8'``, ``'int16'``, ``'float32'`` etc.).  If is\n            `None`, use the current data type.\n\n        option : str, optional\n            how to scale the data: if ``\"old\"``, use the original ``BSCALE``\n            and ``BZERO`` values when the data was read/created. If\n            ``\"minmax\"``, use the minimum and maximum of the data to scale.\n            The option will be overwritten by any user-specified bscale/bzero\n            values.\n\n        bscale, bzero : int, optional\n            user specified ``BSCALE`` and ``BZERO`` values.\n        \"\"\"\n\n        if self.data is None:\n            return\n\n        # Determine the destination (numpy) data type\n        if type is None:\n            type = BITPIX2DTYPE[self._bitpix]\n        _type = getattr(np, type)\n\n        # Determine how to scale the data\n        # bscale and bzero takes priority\n        if (bscale != 1 or bzero != 0):\n            _scale = bscale\n            _zero = bzero\n        else:\n            if option == 'old':\n                _scale = self._orig_bscale\n                _zero = self._orig_bzero\n            elif option == 'minmax':\n                if isinstance(_type, np.floating):\n                    _scale = 1\n                    _zero = 0\n                else:\n                    _min = np.minimum.reduce(self.data.flat)\n                    _max = np.maximum.reduce(self.data.flat)\n\n                    if _type == np.uint8:  # uint8 case\n                        _zero = _min\n                        _scale = (_max - _min) / (2. ** 8 - 1)\n                    else:\n                        _zero = (_max + _min) / 2.\n\n                        # throw away -2^N\n                        _scale = (_max - _min) / (2. ** (8 * _type.bytes) - 2)\n\n        # Do the scaling\n        if _zero != 0:\n            # We have to explicitly cast self._bzero to prevent numpy from\n            # raising an error when doing self.data -= _zero, and we\n            # do this instead of self.data = self.data - _zero to\n            # avoid doubling memory usage.\n            np.subtract(self.data, _zero, out=self.data, casting='unsafe')\n            self.header['BZERO'] = _zero\n        else:\n            # Delete from both headers\n            for header in (self.header, self._header):\n                with suppress(KeyError):\n                    del header['BZERO']\n\n        if _scale != 1:\n            self.data /= _scale\n            self.header['BSCALE'] = _scale\n        else:\n            for header in (self.header, self._header):\n                with suppress(KeyError):\n                    del header['BSCALE']\n\n        if self.data.dtype.type != _type:\n            self.data = np.array(np.around(self.data), dtype=_type)  # 0.7.7.1\n\n        # Update the BITPIX Card to match the data\n        self._bitpix = DTYPE2BITPIX[self.data.dtype.name]\n        self._bzero = self.header.get('BZERO', 0)\n        self._bscale = self.header.get('BSCALE', 1)\n        # Update BITPIX for the image header specifically\n        # TODO: Make this more clear by using self._image_header, but only once\n        # this has been fixed so that the _image_header attribute is guaranteed\n        # to be valid\n        self.header['BITPIX'] = self._bitpix\n\n        # Update the table header to match the scaled data\n        self._update_header_data(self.header)\n\n        # Since the image has been manually scaled, the current\n        # bitpix/bzero/bscale now serve as the 'original' scaling of the image,\n        # as though the original image has been completely replaced\n        self._orig_bitpix = self._bitpix\n        self._orig_bzero = self._bzero\n        self._orig_bscale = self._bscale"},{"col":4,"comment":"null","endLoc":3564,"header":"@property\n    def groups(self)","id":2458,"name":"groups","nodeType":"Function","startLoc":3560,"text":"@property\n    def groups(self):\n        if not hasattr(self, '_groups'):\n            self._groups = groups.TableGroups(self)\n        return self._groups"},{"col":4,"comment":"\n        Group this table by the specified ``keys``\n\n        This effectively splits the table into groups which correspond to unique\n        values of the ``keys`` grouping object.  The output is a new\n        `~astropy.table.TableGroups` which contains a copy of this table but\n        sorted by row according to ``keys``.\n\n        The ``keys`` input to `group_by` can be specified in different ways:\n\n          - String or list of strings corresponding to table column name(s)\n          - Numpy array (homogeneous or structured) with same length as this table\n          - `~astropy.table.Table` with same length as this table\n\n        Parameters\n        ----------\n        keys : str, list of str, numpy array, or `~astropy.table.Table`\n            Key grouping object\n\n        Returns\n        -------\n        out : `~astropy.table.Table`\n            New table with groups set\n        ","endLoc":3591,"header":"def group_by(self, keys)","id":2459,"name":"group_by","nodeType":"Function","startLoc":3566,"text":"def group_by(self, keys):\n        \"\"\"\n        Group this table by the specified ``keys``\n\n        This effectively splits the table into groups which correspond to unique\n        values of the ``keys`` grouping object.  The output is a new\n        `~astropy.table.TableGroups` which contains a copy of this table but\n        sorted by row according to ``keys``.\n\n        The ``keys`` input to `group_by` can be specified in different ways:\n\n          - String or list of strings corresponding to table column name(s)\n          - Numpy array (homogeneous or structured) with same length as this table\n          - `~astropy.table.Table` with same length as this table\n\n        Parameters\n        ----------\n        keys : str, list of str, numpy array, or `~astropy.table.Table`\n            Key grouping object\n\n        Returns\n        -------\n        out : `~astropy.table.Table`\n            New table with groups set\n        \"\"\"\n        return groups.table_group_by(self, keys)"},{"col":0,"comment":"null","endLoc":18,"header":"def table_group_by(table, keys)","id":2460,"name":"table_group_by","nodeType":"Function","startLoc":15,"text":"def table_group_by(table, keys):\n    # index copies are unnecessary and slow down _table_group_by\n    with table.index_mode('discard_on_copy'):\n        return _table_group_by(table, keys)"},{"col":0,"comment":"\n    Parse RA and Dec values from a coordinate string. Currently the\n    following formats are supported:\n\n     * space separated 6-value format\n     * space separated <6-value format, this requires a plus or minus sign\n       separation between RA and Dec\n     * sign separated format\n     * JHHMMSS.ss+DDMMSS.ss format, with up to two optional decimal digits\n     * JDDDMMSS.ss+DDMMSS.ss format, with up to two optional decimal digits\n\n    Parameters\n    ----------\n    coord_str : str\n        Coordinate string to parse.\n\n    Returns\n    -------\n    coord : str or list of str\n        Parsed coordinate values.\n    ","endLoc":663,"header":"def _parse_ra_dec(coord_str)","id":2461,"name":"_parse_ra_dec","nodeType":"Function","startLoc":613,"text":"def _parse_ra_dec(coord_str):\n    \"\"\"\n    Parse RA and Dec values from a coordinate string. Currently the\n    following formats are supported:\n\n     * space separated 6-value format\n     * space separated <6-value format, this requires a plus or minus sign\n       separation between RA and Dec\n     * sign separated format\n     * JHHMMSS.ss+DDMMSS.ss format, with up to two optional decimal digits\n     * JDDDMMSS.ss+DDMMSS.ss format, with up to two optional decimal digits\n\n    Parameters\n    ----------\n    coord_str : str\n        Coordinate string to parse.\n\n    Returns\n    -------\n    coord : str or list of str\n        Parsed coordinate values.\n    \"\"\"\n\n    if isinstance(coord_str, str):\n        coord1 = coord_str.split()\n    else:\n        # This exception should never be raised from SkyCoord\n        raise TypeError('coord_str must be a single str')\n\n    if len(coord1) == 6:\n        coord = (' '.join(coord1[:3]), ' '.join(coord1[3:]))\n    elif len(coord1) > 2:\n        coord = PLUS_MINUS_RE.split(coord_str)\n        coord = (coord[0], ' '.join(coord[1:]))\n    elif len(coord1) == 1:\n        match_j = J_PREFIXED_RA_DEC_RE.match(coord_str)\n        if match_j:\n            coord = match_j.groups()\n            if len(coord[0].split('.')[0]) == 7:\n                coord = (f'{coord[0][0:3]} {coord[0][3:5]} {coord[0][5:]}',\n                         f'{coord[1][0:3]} {coord[1][3:5]} {coord[1][5:]}')\n            else:\n                coord = (f'{coord[0][0:2]} {coord[0][2:4]} {coord[0][4:]}',\n                         f'{coord[1][0:3]} {coord[1][3:5]} {coord[1][5:]}')\n        else:\n            coord = PLUS_MINUS_RE.split(coord_str)\n            coord = (coord[0], ' '.join(coord[1:]))\n    else:\n        coord = coord1\n\n    return coord"},{"col":0,"comment":"\n    Append the header/data to FITS file if filename exists, create if not.\n\n    If only ``data`` is supplied, a minimal header is created.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        File to write to.  If opened, must be opened for update (rb+) unless it\n        is a new file, then it must be opened for append (ab+).  A file or\n        `~gzip.GzipFile` object opened for update will be closed after return.\n\n    data : array, :class:`~astropy.table.Table`, or `~astropy.io.fits.Group`\n        The new data used for appending.\n\n    header : `Header` object, optional\n        The header associated with ``data``.  If `None`, an appropriate header\n        will be created for the data object supplied.\n\n    checksum : bool, optional\n        When `True` adds both ``DATASUM`` and ``CHECKSUM`` cards to the header\n        of the HDU when written to the file.\n\n    verify : bool, optional\n        When `True`, the existing FITS file will be read in to verify it for\n        correctness before appending.  When `False`, content is simply appended\n        to the end of the file.  Setting ``verify`` to `False` can be much\n        faster.\n\n    **kwargs\n        Additional arguments are passed to:\n\n        - `~astropy.io.fits.writeto` if the file does not exist or is empty.\n          In this case ``output_verify`` is the only possible argument.\n        - `~astropy.io.fits.open` if ``verify`` is True or if ``filename``\n          is a file object.\n        - Otherwise no additional arguments can be used.\n\n    ","endLoc":691,"header":"def append(filename, data, header=None, checksum=False, verify=True, **kwargs)","id":2462,"name":"append","nodeType":"Function","startLoc":620,"text":"def append(filename, data, header=None, checksum=False, verify=True, **kwargs):\n    \"\"\"\n    Append the header/data to FITS file if filename exists, create if not.\n\n    If only ``data`` is supplied, a minimal header is created.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        File to write to.  If opened, must be opened for update (rb+) unless it\n        is a new file, then it must be opened for append (ab+).  A file or\n        `~gzip.GzipFile` object opened for update will be closed after return.\n\n    data : array, :class:`~astropy.table.Table`, or `~astropy.io.fits.Group`\n        The new data used for appending.\n\n    header : `Header` object, optional\n        The header associated with ``data``.  If `None`, an appropriate header\n        will be created for the data object supplied.\n\n    checksum : bool, optional\n        When `True` adds both ``DATASUM`` and ``CHECKSUM`` cards to the header\n        of the HDU when written to the file.\n\n    verify : bool, optional\n        When `True`, the existing FITS file will be read in to verify it for\n        correctness before appending.  When `False`, content is simply appended\n        to the end of the file.  Setting ``verify`` to `False` can be much\n        faster.\n\n    **kwargs\n        Additional arguments are passed to:\n\n        - `~astropy.io.fits.writeto` if the file does not exist or is empty.\n          In this case ``output_verify`` is the only possible argument.\n        - `~astropy.io.fits.open` if ``verify`` is True or if ``filename``\n          is a file object.\n        - Otherwise no additional arguments can be used.\n\n    \"\"\"\n    name, closed, noexist_or_empty = _stat_filename_or_fileobj(filename)\n\n    if noexist_or_empty:\n        #\n        # The input file or file like object either doesn't exits or is\n        # empty.  Use the writeto convenience function to write the\n        # output to the empty object.\n        #\n        writeto(filename, data, header, checksum=checksum, **kwargs)\n    else:\n        hdu = _makehdu(data, header)\n\n        if isinstance(hdu, PrimaryHDU):\n            hdu = ImageHDU(data, header)\n\n        if verify or not closed:\n            f = fitsopen(filename, mode='append', **kwargs)\n            try:\n                f.append(hdu)\n\n                # Set a flag in the HDU so that only this HDU gets a checksum\n                # when writing the file.\n                hdu._output_checksum = checksum\n            finally:\n                f.close(closed=closed)\n        else:\n            f = _File(filename, mode='append')\n            try:\n                hdu._output_checksum = checksum\n                hdu._writeto(f)\n            finally:\n                f.close()"},{"col":0,"comment":"null","endLoc":1109,"header":"def _stat_filename_or_fileobj(filename)","id":2463,"name":"_stat_filename_or_fileobj","nodeType":"Function","startLoc":1093,"text":"def _stat_filename_or_fileobj(filename):\n    if isinstance(filename, os.PathLike):\n        filename = os.fspath(filename)\n    closed = fileobj_closed(filename)\n    name = fileobj_name(filename) or ''\n\n    try:\n        loc = filename.tell()\n    except AttributeError:\n        loc = 0\n\n    noexist_or_empty = ((name and\n                         (not os.path.exists(name) or\n                          (os.path.getsize(name) == 0)))\n                        or (not name and loc == 0))\n\n    return name, closed, noexist_or_empty"},{"col":0,"comment":"\n    Get groups for ``table`` on specified ``keys``.\n\n    Parameters\n    ----------\n    table : `Table`\n        Table to group\n    keys : str, list of str, `Table`, or Numpy array\n        Grouping key specifier\n\n    Returns\n    -------\n    grouped_table : Table object with groups attr set accordingly\n    ","endLoc":110,"header":"def _table_group_by(table, keys)","id":2464,"name":"_table_group_by","nodeType":"Function","startLoc":21,"text":"def _table_group_by(table, keys):\n    \"\"\"\n    Get groups for ``table`` on specified ``keys``.\n\n    Parameters\n    ----------\n    table : `Table`\n        Table to group\n    keys : str, list of str, `Table`, or Numpy array\n        Grouping key specifier\n\n    Returns\n    -------\n    grouped_table : Table object with groups attr set accordingly\n    \"\"\"\n    from .table import Table\n    from .serialize import represent_mixins_as_columns\n\n    # Pre-convert string to tuple of strings, or Table to the underlying structured array\n    if isinstance(keys, str):\n        keys = (keys,)\n\n    if isinstance(keys, (list, tuple)):\n        for name in keys:\n            if name not in table.colnames:\n                raise ValueError(f'Table does not have key column {name!r}')\n            if table.masked and np.any(table[name].mask):\n                raise ValueError(f'Missing values in key column {name!r} are not allowed')\n\n        # Make a column slice of the table without copying\n        table_keys = table.__class__([table[key] for key in keys], copy=False)\n\n        # If available get a pre-existing index for these columns\n        table_index = get_index_by_names(table, keys)\n        grouped_by_table_cols = True\n\n    elif isinstance(keys, (np.ndarray, Table)):\n        table_keys = keys\n        if len(table_keys) != len(table):\n            raise ValueError('Input keys array length {} does not match table length {}'\n                             .format(len(table_keys), len(table)))\n        table_index = None\n        grouped_by_table_cols = False\n\n    else:\n        raise TypeError('Keys input must be string, list, tuple, Table or numpy array, but got {}'\n                        .format(type(keys)))\n\n    # If there is not already an available index and table_keys is a Table then ensure\n    # that all cols (including mixins) are in a form that can sorted with the code below.\n    if not table_index and isinstance(table_keys, Table):\n        table_keys = represent_mixins_as_columns(table_keys)\n\n    # Get the argsort index `idx_sort`, accounting for particulars\n    try:\n        # take advantage of index internal sort if possible\n        if table_index is not None:\n            idx_sort = table_index.sorted_data()\n        else:\n            idx_sort = table_keys.argsort(kind='mergesort')\n        stable_sort = True\n    except TypeError:\n        # Some versions (likely 1.6 and earlier) of numpy don't support\n        # 'mergesort' for all data types.  MacOSX (Darwin) doesn't have a stable\n        # sort by default, nor does Windows, while Linux does (or appears to).\n        idx_sort = table_keys.argsort()\n        stable_sort = platform.system() not in ('Darwin', 'Windows')\n\n    # Finally do the actual sort of table_keys values\n    table_keys = table_keys[idx_sort]\n\n    # Get all keys\n    diffs = np.concatenate(([True], table_keys[1:] != table_keys[:-1], [True]))\n    indices = np.flatnonzero(diffs)\n\n    # If the sort is not stable (preserves original table order) then sort idx_sort in\n    # place within each group.\n    if not stable_sort:\n        for i0, i1 in zip(indices[:-1], indices[1:]):\n            idx_sort[i0:i1].sort()\n\n    # Make a new table and set the _groups to the appropriate TableGroups object.\n    # Take the subset of the original keys at the indices values (group boundaries).\n    out = table.__class__(table[idx_sort])\n    out_keys = table_keys[indices[:-1]]\n    if isinstance(out_keys, Table):\n        out_keys.meta['grouped_by_table_cols'] = grouped_by_table_cols\n    out._groups = TableGroups(out, indices=indices, keys=out_keys)\n\n    return out"},{"col":4,"comment":"null","endLoc":1853,"header":"def _prewriteto(self, checksum=False, inplace=False)","id":2465,"name":"_prewriteto","nodeType":"Function","startLoc":1820,"text":"def _prewriteto(self, checksum=False, inplace=False):\n        if self._scale_back:\n            self.scale(BITPIX2DTYPE[self._orig_bitpix])\n\n        if self._has_data:\n            self._update_compressed_data()\n\n            # Use methods in the superclass to update the header with\n            # scale/checksum keywords based on the data type of the image data\n            self._update_pseudo_int_scale_keywords()\n\n            # Shove the image header and data into a new ImageHDU and use that\n            # to compute the image checksum\n            image_hdu = ImageHDU(data=self.data, header=self.header)\n            image_hdu._update_checksum(checksum)\n            if 'CHECKSUM' in image_hdu.header:\n                # This will also pass through to the ZHECKSUM keyword and\n                # ZDATASUM keyword\n                self._image_header.set('CHECKSUM',\n                                       image_hdu.header['CHECKSUM'],\n                                       image_hdu.header.comments['CHECKSUM'])\n            if 'DATASUM' in image_hdu.header:\n                self._image_header.set('DATASUM', image_hdu.header['DATASUM'],\n                                       image_hdu.header.comments['DATASUM'])\n            # Store a temporary backup of self.data in a different attribute;\n            # see below\n            self._imagedata = self.data\n\n            # Now we need to perform an ugly hack to set the compressed data as\n            # the .data attribute on the HDU so that the call to _writedata\n            # handles it properly\n            self.__dict__['data'] = self.compressed_data\n\n        return super()._prewriteto(checksum=checksum, inplace=inplace)"},{"col":0,"comment":"\n    Returns an index in ``table`` corresponding to the ``names`` columns or None\n    if no such index exists.\n\n    Parameters\n    ----------\n    table : `Table`\n        Input table\n    nmaes : tuple, list\n        Column names\n    ","endLoc":660,"header":"def get_index_by_names(table, names)","id":2466,"name":"get_index_by_names","nodeType":"Function","startLoc":642,"text":"def get_index_by_names(table, names):\n    '''\n    Returns an index in ``table`` corresponding to the ``names`` columns or None\n    if no such index exists.\n\n    Parameters\n    ----------\n    table : `Table`\n        Input table\n    nmaes : tuple, list\n        Column names\n    '''\n    names = list(names)\n    for index in table.indices:\n        index_names = [col.info.name for col in index.columns]\n        if index_names == names:\n            return index\n    else:\n        return None"},{"col":4,"comment":"\n        Bypasses `BinTableHDU._writeheader()` which updates the header with\n        metadata about the data that is meaningless here; another reason\n        why this class maybe shouldn't inherit directly from BinTableHDU...\n        ","endLoc":1862,"header":"def _writeheader(self, fileobj)","id":2467,"name":"_writeheader","nodeType":"Function","startLoc":1855,"text":"def _writeheader(self, fileobj):\n        \"\"\"\n        Bypasses `BinTableHDU._writeheader()` which updates the header with\n        metadata about the data that is meaningless here; another reason\n        why this class maybe shouldn't inherit directly from BinTableHDU...\n        \"\"\"\n\n        return ExtensionHDU._writeheader(self, fileobj)"},{"col":0,"comment":"Represent input Table ``tbl`` using only `~astropy.table.Column`\n    or  `~astropy.table.MaskedColumn` objects.\n\n    This function represents any mixin columns like `~astropy.time.Time` in\n    ``tbl`` to one or more plain ``~astropy.table.Column`` objects and returns\n    a new Table.  A single mixin column may be split into multiple column\n    components as needed for fully representing the column.  This includes the\n    possibility of recursive splitting, as shown in the example below.  The\n    new column names are formed as ``<column_name>.<component>``, e.g.\n    ``sc.ra`` for a `~astropy.coordinates.SkyCoord` column named ``sc``.\n\n    In addition to splitting columns, this function updates the table ``meta``\n    dictionary to include a dict named ``__serialized_columns__`` which provides\n    additional information needed to construct the original mixin columns from\n    the split columns.\n\n    This function is used by astropy I/O when writing tables to ECSV, FITS,\n    HDF5 formats.\n\n    Note that if the table does not include any mixin columns then the original\n    table is returned with no update to ``meta``.\n\n    Parameters\n    ----------\n    tbl : `~astropy.table.Table` or subclass\n        Table to represent mixins as Columns\n    exclude_classes : tuple of class\n        Exclude any mixin columns which are instannces of any classes in the tuple\n\n    Returns\n    -------\n    tbl : `~astropy.table.Table`\n        New Table with updated columns, or else the original input ``tbl``\n\n    Examples\n    --------\n    >>> from astropy.table import Table, represent_mixins_as_columns\n    >>> from astropy.time import Time\n    >>> from astropy.coordinates import SkyCoord\n\n    >>> x = [100.0, 200.0]\n    >>> obstime = Time([1999.0, 2000.0], format='jyear')\n    >>> sc = SkyCoord([1, 2], [3, 4], unit='deg', obstime=obstime)\n    >>> tbl = Table([sc, x], names=['sc', 'x'])\n    >>> represent_mixins_as_columns(tbl)\n    <Table length=2>\n     sc.ra   sc.dec sc.obstime.jd1 sc.obstime.jd2    x\n      deg     deg\n    float64 float64    float64        float64     float64\n    ------- ------- -------------- -------------- -------\n        1.0     3.0      2451180.0          -0.25   100.0\n        2.0     4.0      2451545.0            0.0   200.0\n\n    ","endLoc":263,"header":"def represent_mixins_as_columns(tbl, exclude_classes=())","id":2468,"name":"represent_mixins_as_columns","nodeType":"Function","startLoc":174,"text":"def represent_mixins_as_columns(tbl, exclude_classes=()):\n    \"\"\"Represent input Table ``tbl`` using only `~astropy.table.Column`\n    or  `~astropy.table.MaskedColumn` objects.\n\n    This function represents any mixin columns like `~astropy.time.Time` in\n    ``tbl`` to one or more plain ``~astropy.table.Column`` objects and returns\n    a new Table.  A single mixin column may be split into multiple column\n    components as needed for fully representing the column.  This includes the\n    possibility of recursive splitting, as shown in the example below.  The\n    new column names are formed as ``<column_name>.<component>``, e.g.\n    ``sc.ra`` for a `~astropy.coordinates.SkyCoord` column named ``sc``.\n\n    In addition to splitting columns, this function updates the table ``meta``\n    dictionary to include a dict named ``__serialized_columns__`` which provides\n    additional information needed to construct the original mixin columns from\n    the split columns.\n\n    This function is used by astropy I/O when writing tables to ECSV, FITS,\n    HDF5 formats.\n\n    Note that if the table does not include any mixin columns then the original\n    table is returned with no update to ``meta``.\n\n    Parameters\n    ----------\n    tbl : `~astropy.table.Table` or subclass\n        Table to represent mixins as Columns\n    exclude_classes : tuple of class\n        Exclude any mixin columns which are instannces of any classes in the tuple\n\n    Returns\n    -------\n    tbl : `~astropy.table.Table`\n        New Table with updated columns, or else the original input ``tbl``\n\n    Examples\n    --------\n    >>> from astropy.table import Table, represent_mixins_as_columns\n    >>> from astropy.time import Time\n    >>> from astropy.coordinates import SkyCoord\n\n    >>> x = [100.0, 200.0]\n    >>> obstime = Time([1999.0, 2000.0], format='jyear')\n    >>> sc = SkyCoord([1, 2], [3, 4], unit='deg', obstime=obstime)\n    >>> tbl = Table([sc, x], names=['sc', 'x'])\n    >>> represent_mixins_as_columns(tbl)\n    <Table length=2>\n     sc.ra   sc.dec sc.obstime.jd1 sc.obstime.jd2    x\n      deg     deg\n    float64 float64    float64        float64     float64\n    ------- ------- -------------- -------------- -------\n        1.0     3.0      2451180.0          -0.25   100.0\n        2.0     4.0      2451545.0            0.0   200.0\n\n    \"\"\"\n    # Dict of metadata for serializing each column, keyed by column name.\n    # Gets filled in place by _represent_mixin_as_column().\n    mixin_cols = {}\n\n    # List of columns for the output table.  For plain Column objects\n    # this will just be the original column object.\n    new_cols = []\n\n    # Go through table columns and represent each column as one or more\n    # plain Column objects (in new_cols) + metadata (in mixin_cols).\n    for col in tbl.itercols():\n        _represent_mixin_as_column(col, col.info.name, new_cols, mixin_cols,\n                                   exclude_classes=exclude_classes)\n\n    # If no metadata was created then just return the original table.\n    if mixin_cols:\n        meta = deepcopy(tbl.meta)\n        meta['__serialized_columns__'] = mixin_cols\n        out = Table(new_cols, meta=meta, copy=False)\n    else:\n        out = tbl\n\n    for col in out.itercols():\n        if not isinstance(col, Column) and col.__class__ not in exclude_classes:\n            # This catches columns for which info has not been set up right and\n            # therefore were not converted. See the corresponding test in\n            # test_mixin.py for an example.\n            raise TypeError(\n                'failed to represent column '\n                f'{col.info.name!r} ({col.__class__.__name__}) as one '\n                'or more Column subclasses. This looks like a mixin class '\n                'that does not have the correct _represent_as_dict() method '\n                'in the class `info` attribute.')\n\n    return out"},{"col":4,"comment":"\n        Wrap the basic ``_writedata`` method to restore the ``.data``\n        attribute to the uncompressed image data in the case of an exception.\n        ","endLoc":1878,"header":"def _writedata(self, fileobj)","id":2469,"name":"_writedata","nodeType":"Function","startLoc":1864,"text":"def _writedata(self, fileobj):\n        \"\"\"\n        Wrap the basic ``_writedata`` method to restore the ``.data``\n        attribute to the uncompressed image data in the case of an exception.\n        \"\"\"\n\n        try:\n            return super()._writedata(fileobj)\n        finally:\n            # Restore the .data attribute to its rightful value (if any)\n            if hasattr(self, '_imagedata'):\n                self.__dict__['data'] = self._imagedata\n                del self._imagedata\n            else:\n                del self.data"},{"col":4,"comment":"null","endLoc":1886,"header":"def _close(self, closed=True)","id":2470,"name":"_close","nodeType":"Function","startLoc":1880,"text":"def _close(self, closed=True):\n        super()._close(closed=closed)\n\n        # Also make sure to close access to the compressed data mmaps\n        if (closed and self._data_loaded and\n                _get_array_mmap(self.compressed_data) is not None):\n            del self.compressed_data"},{"attributeType":"null","col":4,"comment":"\n    The calls to CFITSIO lay out the heap data in memory, and we write it out\n    the same way CFITSIO organizes it.  In principle this would break if a user\n    manually changes the underlying compressed data by hand, but there is no\n    reason they would want to do that (and if they do that's their\n    responsibility).\n    ","endLoc":385,"id":2471,"name":"_manages_own_heap","nodeType":"Attribute","startLoc":385,"text":"_manages_own_heap"},{"attributeType":"null","col":4,"comment":"null","endLoc":394,"id":2472,"name":"_default_name","nodeType":"Attribute","startLoc":394,"text":"_default_name"},{"attributeType":"null","col":12,"comment":"null","endLoc":625,"id":2473,"name":"data","nodeType":"Attribute","startLoc":625,"text":"self.data"},{"attributeType":"null","col":8,"comment":"null","endLoc":644,"id":2474,"name":"_do_not_scale_image_data","nodeType":"Attribute","startLoc":644,"text":"self._do_not_scale_image_data"},{"attributeType":"null","col":8,"comment":"null","endLoc":802,"id":2475,"name":"_image_header","nodeType":"Attribute","startLoc":802,"text":"self._image_header"},{"attributeType":"null","col":8,"comment":"null","endLoc":661,"id":2476,"name":"_orig_bscale","nodeType":"Attribute","startLoc":661,"text":"self._orig_bscale"},{"attributeType":"null","col":8,"comment":"null","endLoc":1145,"id":2477,"name":"columns","nodeType":"Attribute","startLoc":1145,"text":"self.columns"},{"attributeType":"null","col":8,"comment":"null","endLoc":645,"id":2478,"name":"_uint","nodeType":"Attribute","startLoc":645,"text":"self._uint"},{"col":0,"comment":"Carry out processing needed to serialize ``col`` in an output table\n    consisting purely of plain ``Column`` or ``MaskedColumn`` columns.  This\n    relies on the object determine if any transformation is required and may\n    depend on the ``serialize_method`` and ``serialize_context`` context\n    variables.  For instance a ``MaskedColumn`` may be stored directly to\n    FITS, but can also be serialized as separate data and mask columns.\n\n    This function builds up a list of plain columns in the ``new_cols`` arg (which\n    is passed as a persistent list).  This includes both plain columns from the\n    original table and plain columns that represent data from serialized columns\n    (e.g. ``jd1`` and ``jd2`` arrays from a ``Time`` column).\n\n    For serialized columns the ``mixin_cols`` dict is updated with required\n    attributes and information to subsequently reconstruct the table.\n\n    Table mixin columns are always serialized and get represented by one\n    or more data columns.  In earlier versions of the code *only* mixin\n    columns were serialized, hence the use within this code of \"mixin\"\n    to imply serialization.  Starting with version 3.1, the non-mixin\n    ``MaskedColumn`` can also be serialized.\n    ","endLoc":171,"header":"def _represent_mixin_as_column(col, name, new_cols, mixin_cols,\n                               exclude_classes=())","id":2479,"name":"_represent_mixin_as_column","nodeType":"Function","startLoc":72,"text":"def _represent_mixin_as_column(col, name, new_cols, mixin_cols,\n                               exclude_classes=()):\n    \"\"\"Carry out processing needed to serialize ``col`` in an output table\n    consisting purely of plain ``Column`` or ``MaskedColumn`` columns.  This\n    relies on the object determine if any transformation is required and may\n    depend on the ``serialize_method`` and ``serialize_context`` context\n    variables.  For instance a ``MaskedColumn`` may be stored directly to\n    FITS, but can also be serialized as separate data and mask columns.\n\n    This function builds up a list of plain columns in the ``new_cols`` arg (which\n    is passed as a persistent list).  This includes both plain columns from the\n    original table and plain columns that represent data from serialized columns\n    (e.g. ``jd1`` and ``jd2`` arrays from a ``Time`` column).\n\n    For serialized columns the ``mixin_cols`` dict is updated with required\n    attributes and information to subsequently reconstruct the table.\n\n    Table mixin columns are always serialized and get represented by one\n    or more data columns.  In earlier versions of the code *only* mixin\n    columns were serialized, hence the use within this code of \"mixin\"\n    to imply serialization.  Starting with version 3.1, the non-mixin\n    ``MaskedColumn`` can also be serialized.\n    \"\"\"\n    obj_attrs = col.info._represent_as_dict()\n\n    # If serialization is not required (see function docstring above)\n    # or explicitly specified as excluded, then treat as a normal column.\n    if not obj_attrs or col.__class__ in exclude_classes:\n        new_cols.append(col)\n        return\n\n    # Subtlety here is handling mixin info attributes.  The basic list of such\n    # attributes is: 'name', 'unit', 'dtype', 'format', 'description', 'meta'.\n    # - name: handled directly [DON'T store]\n    # - unit: DON'T store if this is a parent attribute\n    # - dtype: captured in plain Column if relevant [DON'T store]\n    # - format: possibly irrelevant but settable post-object creation [DO store]\n    # - description: DO store\n    # - meta: DO store\n    info = {}\n    for attr, nontrivial in (('unit', lambda x: x is not None and x != ''),\n                             ('format', lambda x: x is not None),\n                             ('description', lambda x: x is not None),\n                             ('meta', lambda x: x)):\n        col_attr = getattr(col.info, attr)\n        if nontrivial(col_attr):\n            info[attr] = col_attr\n\n    # Find column attributes that have the same length as the column itself.\n    # These will be stored in the table as new columns (aka \"data attributes\").\n    # Examples include SkyCoord.ra (what is typically considered the data and is\n    # always an array) and Skycoord.obs_time (which can be a scalar or an\n    # array).\n    data_attrs = [key for key, value in obj_attrs.items() if\n                  getattr(value, 'shape', ())[:1] == col.shape[:1]]\n\n    for data_attr in data_attrs:\n        data = obj_attrs[data_attr]\n\n        # New column name combines the old name and attribute\n        # (e.g. skycoord.ra, skycoord.dec).unless it is the primary data\n        # attribute for the column (e.g. value for Quantity or data for\n        # MaskedColumn).  For primary data, we attempt to store any info on\n        # the format, etc., on the column, but not for ancillary data (e.g.,\n        # no sense to use a float format for a mask).\n        is_primary = data_attr == col.info._represent_as_dict_primary_data\n        if is_primary:\n            new_name = name\n            new_info = info\n        else:\n            new_name = name + '.' + data_attr\n            new_info = {}\n\n        if not has_info_class(data, MixinInfo):\n            col_cls = MaskedColumn if (hasattr(data, 'mask')\n                                       and np.any(data.mask)) else Column\n            new_cols.append(col_cls(data, name=new_name, **new_info))\n            obj_attrs[data_attr] = SerializedColumn({'name': new_name})\n            if is_primary:\n                # Don't store info in the __serialized_columns__ dict for this column\n                # since this is redundant with info stored on the new column.\n                info = {}\n        else:\n            # recurse. This will define obj_attrs[new_name].\n            _represent_mixin_as_column(data, new_name, new_cols, obj_attrs)\n            obj_attrs[data_attr] = SerializedColumn(obj_attrs.pop(new_name))\n\n    # Strip out from info any attributes defined by the parent,\n    # and store whatever remains.\n    for attr in col.info.attrs_from_parent:\n        if attr in info:\n            del info[attr]\n    if info:\n        obj_attrs['__info__'] = info\n\n    # Store the fully qualified class name\n    obj_attrs.setdefault('__class__',\n                         col.__module__ + '.' + col.__class__.__name__)\n\n    mixin_cols[name] = obj_attrs"},{"col":4,"comment":"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.\n\n        Note that any associated differentials will be dropped during this\n        operation.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        ","endLoc":1437,"header":"def norm(self)","id":2480,"name":"norm","nodeType":"Function","startLoc":1422,"text":"def norm(self):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.\n\n        Note that any associated differentials will be dropped during this\n        operation.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\n        # erfa pm: Modulus of p-vector.\n        return erfa_ufunc.pm(self.get_xyz(xyz_axis=-1))"},{"attributeType":"null","col":22,"comment":"null","endLoc":1695,"id":2481,"name":"compressed_data","nodeType":"Attribute","startLoc":1695,"text":"self.compressed_data"},{"attributeType":"null","col":12,"comment":"null","endLoc":657,"id":2482,"name":"_bscale","nodeType":"Attribute","startLoc":657,"text":"self._bscale"},{"attributeType":"null","col":8,"comment":"null","endLoc":648,"id":2483,"name":"_axes","nodeType":"Attribute","startLoc":648,"text":"self._axes"},{"col":0,"comment":"\n    Set the differentials to be stationary on a coordinate object.\n    ","endLoc":119,"header":"def attach_zero_velocities(coord)","id":2484,"name":"attach_zero_velocities","nodeType":"Function","startLoc":114,"text":"def attach_zero_velocities(coord):\n    \"\"\"\n    Set the differentials to be stationary on a coordinate object.\n    \"\"\"\n    new_data = coord.cartesian.with_differentials(ZERO_VELOCITIES)\n    return coord.realize_frame(new_data)"},{"col":4,"comment":"Return a vector array of the x, y, and z coordinates.\n\n        Parameters\n        ----------\n        xyz_axis : int, optional\n            The axis in the final array along which the x, y, z components\n            should be stored (default: 0).\n\n        Returns\n        -------\n        xyz : `~astropy.units.Quantity`\n            With dimension 3 along ``xyz_axis``.  Note that, if possible,\n            this will be a view.\n        ","endLoc":1351,"header":"def get_xyz(self, xyz_axis=0)","id":2485,"name":"get_xyz","nodeType":"Function","startLoc":1327,"text":"def get_xyz(self, xyz_axis=0):\n        \"\"\"Return a vector array of the x, y, and z coordinates.\n\n        Parameters\n        ----------\n        xyz_axis : int, optional\n            The axis in the final array along which the x, y, z components\n            should be stored (default: 0).\n\n        Returns\n        -------\n        xyz : `~astropy.units.Quantity`\n            With dimension 3 along ``xyz_axis``.  Note that, if possible,\n            this will be a view.\n        \"\"\"\n        if self._xyz is not None:\n            if self._xyz_axis == xyz_axis:\n                return self._xyz\n            else:\n                return np.moveaxis(self._xyz, self._xyz_axis, xyz_axis)\n\n        # Create combined array.  TO DO: keep it in _xyz for repeated use?\n        # But then in-place changes have to cancel it. Likely best to\n        # also update components.\n        return np.stack([self._x, self._y, self._z], axis=xyz_axis)"},{"attributeType":"null","col":8,"comment":"null","endLoc":660,"id":2486,"name":"_orig_bzero","nodeType":"Attribute","startLoc":660,"text":"self._orig_bzero"},{"col":38,"endLoc":112,"id":2487,"nodeType":"Lambda","startLoc":112,"text":"lambda x: x is not None and x != ''"},{"col":40,"endLoc":113,"id":2488,"nodeType":"Lambda","startLoc":113,"text":"lambda x: x is not None"},{"col":45,"endLoc":114,"id":2489,"nodeType":"Lambda","startLoc":114,"text":"lambda x: x is not None"},{"col":38,"endLoc":115,"id":2490,"nodeType":"Lambda","startLoc":115,"text":"lambda x: x"},{"col":4,"comment":"The X component of the geocentric coordinates.","endLoc":813,"header":"@property\n    def x(self)","id":2491,"name":"x","nodeType":"Function","startLoc":810,"text":"@property\n    def x(self):\n        \"\"\"The X component of the geocentric coordinates.\"\"\"\n        return self['x']"},{"col":4,"comment":"The Y component of the geocentric coordinates.","endLoc":818,"header":"@property\n    def y(self)","id":2492,"name":"y","nodeType":"Function","startLoc":815,"text":"@property\n    def y(self):\n        \"\"\"The Y component of the geocentric coordinates.\"\"\"\n        return self['y']"},{"col":4,"comment":"The Z component of the geocentric coordinates.","endLoc":823,"header":"@property\n    def z(self)","id":2493,"name":"z","nodeType":"Function","startLoc":820,"text":"@property\n    def z(self):\n        \"\"\"The Z component of the geocentric coordinates.\"\"\"\n        return self['z']"},{"col":4,"comment":"null","endLoc":830,"header":"def __getitem__(self, item)","id":2494,"name":"__getitem__","nodeType":"Function","startLoc":825,"text":"def __getitem__(self, item):\n        result = super().__getitem__(item)\n        if result.dtype is self.dtype:\n            return result.view(self.__class__)\n        else:\n            return result.view(u.Quantity)"},{"col":4,"comment":"null","endLoc":835,"header":"def __array_finalize__(self, obj)","id":2495,"name":"__array_finalize__","nodeType":"Function","startLoc":832,"text":"def __array_finalize__(self, obj):\n        super().__array_finalize__(obj)\n        if hasattr(obj, '_ellipsoid'):\n            self._ellipsoid = obj._ellipsoid"},{"attributeType":"null","col":8,"comment":"null","endLoc":662,"id":2496,"name":"_orig_bitpix","nodeType":"Attribute","startLoc":662,"text":"self._orig_bitpix"},{"col":4,"comment":"null","endLoc":841,"header":"def __len__(self)","id":2497,"name":"__len__","nodeType":"Function","startLoc":837,"text":"def __len__(self):\n        if self.shape == ():\n            raise IndexError('0-d EarthLocation arrays cannot be indexed')\n        else:\n            return super().__len__()"},{"col":4,"comment":"Helper method for to and to_value.","endLoc":852,"header":"def _to_value(self, unit, equivalencies=[])","id":2498,"name":"_to_value","nodeType":"Function","startLoc":843,"text":"def _to_value(self, unit, equivalencies=[]):\n        \"\"\"Helper method for to and to_value.\"\"\"\n        # Conversion to another unit in both ``to`` and ``to_value`` goes\n        # via this routine. To make the regular quantity routines work, we\n        # temporarily turn the structured array into a regular one.\n        array_view = self.view(self._array_dtype, np.ndarray)\n        if equivalencies == []:\n            equivalencies = self._equivalencies\n        new_array = self.unit.to(unit, array_view, equivalencies=equivalencies)\n        return new_array.view(self.dtype).reshape(self.shape)"},{"attributeType":"null","col":12,"comment":"null","endLoc":1680,"id":2499,"name":"_theap","nodeType":"Attribute","startLoc":1680,"text":"self._theap"},{"attributeType":"null","col":12,"comment":"null","endLoc":656,"id":2500,"name":"_bzero","nodeType":"Attribute","startLoc":656,"text":"self._bzero"},{"attributeType":"null","col":8,"comment":"null","endLoc":646,"id":2501,"name":"_scale_back","nodeType":"Attribute","startLoc":646,"text":"self._scale_back"},{"attributeType":"null","col":4,"comment":"null","endLoc":189,"id":2502,"name":"_ellipsoid","nodeType":"Attribute","startLoc":189,"text":"_ellipsoid"},{"attributeType":"null","col":4,"comment":"null","endLoc":190,"id":2503,"name":"_location_dtype","nodeType":"Attribute","startLoc":190,"text":"_location_dtype"},{"attributeType":"null","col":4,"comment":"null","endLoc":192,"id":2504,"name":"_array_dtype","nodeType":"Attribute","startLoc":192,"text":"_array_dtype"},{"attributeType":"null","col":4,"comment":"null","endLoc":194,"id":2505,"name":"info","nodeType":"Attribute","startLoc":194,"text":"info"},{"attributeType":"null","col":4,"comment":"null","endLoc":659,"id":2506,"name":"itrs","nodeType":"Attribute","startLoc":659,"text":"itrs"},{"attributeType":"null","col":18,"comment":"null","endLoc":539,"id":2507,"name":"_site_registry","nodeType":"Attribute","startLoc":539,"text":"cls._site_registry"},{"attributeType":"null","col":16,"comment":"null","endLoc":205,"id":2508,"name":"self","nodeType":"Attribute","startLoc":205,"text":"self"},{"attributeType":"null","col":8,"comment":"null","endLoc":568,"id":2509,"name":"_ellipsoid","nodeType":"Attribute","startLoc":568,"text":"self._ellipsoid"},{"className":"Column","col":0,"comment":"Define a data column for use in a Table object.\n\n    Parameters\n    ----------\n    data : list, ndarray, or None\n        Column data values\n    name : str\n        Column name and key for reference within Table\n    dtype : `~numpy.dtype`-like\n        Data type for column\n    shape : tuple or ()\n        Dimensions of a single row element in the column data\n    length : int or 0\n        Number of row elements in column data\n    description : str or None\n        Full description of column\n    unit : str or None\n        Physical unit\n    format : str, None, or callable\n        Format string for outputting column values.  This can be an\n        \"old-style\" (``format % value``) or \"new-style\" (`str.format`)\n        format specification string or a function or any callable object that\n        accepts a single value and returns a string.\n    meta : dict-like or None\n        Meta-data associated with the column\n\n    Examples\n    --------\n    A Column can be created in two different ways:\n\n    - Provide a ``data`` value but not ``shape`` or ``length`` (which are\n      inferred from the data).\n\n      Examples::\n\n        col = Column(data=[1, 2], name='name')  # shape=(2,)\n        col = Column(data=[[1, 2], [3, 4]], name='name')  # shape=(2, 2)\n        col = Column(data=[1, 2], name='name', dtype=float)\n        col = Column(data=np.array([1, 2]), name='name')\n        col = Column(data=['hello', 'world'], name='name')\n\n      The ``dtype`` argument can be any value which is an acceptable\n      fixed-size data-type initializer for the numpy.dtype() method.  See\n      `<https://numpy.org/doc/stable/reference/arrays.dtypes.html>`_.\n      Examples include:\n\n      - Python non-string type (float, int, bool)\n      - Numpy non-string type (e.g. np.float32, np.int64, np.bool\\_)\n      - Numpy.dtype array-protocol type strings (e.g. 'i4', 'f8', 'S15')\n\n      If no ``dtype`` value is provide then the type is inferred using\n      ``np.array(data)``.\n\n    - Provide ``length`` and optionally ``shape``, but not ``data``\n\n      Examples::\n\n        col = Column(name='name', length=5)\n        col = Column(name='name', dtype=int, length=10, shape=(3,4))\n\n      The default ``dtype`` is ``np.float64``.  The ``shape`` argument is the\n      array shape of a single cell in the column.\n    ","endLoc":1238,"id":2510,"nodeType":"Class","startLoc":1003,"text":"class Column(BaseColumn):\n    \"\"\"Define a data column for use in a Table object.\n\n    Parameters\n    ----------\n    data : list, ndarray, or None\n        Column data values\n    name : str\n        Column name and key for reference within Table\n    dtype : `~numpy.dtype`-like\n        Data type for column\n    shape : tuple or ()\n        Dimensions of a single row element in the column data\n    length : int or 0\n        Number of row elements in column data\n    description : str or None\n        Full description of column\n    unit : str or None\n        Physical unit\n    format : str, None, or callable\n        Format string for outputting column values.  This can be an\n        \"old-style\" (``format % value``) or \"new-style\" (`str.format`)\n        format specification string or a function or any callable object that\n        accepts a single value and returns a string.\n    meta : dict-like or None\n        Meta-data associated with the column\n\n    Examples\n    --------\n    A Column can be created in two different ways:\n\n    - Provide a ``data`` value but not ``shape`` or ``length`` (which are\n      inferred from the data).\n\n      Examples::\n\n        col = Column(data=[1, 2], name='name')  # shape=(2,)\n        col = Column(data=[[1, 2], [3, 4]], name='name')  # shape=(2, 2)\n        col = Column(data=[1, 2], name='name', dtype=float)\n        col = Column(data=np.array([1, 2]), name='name')\n        col = Column(data=['hello', 'world'], name='name')\n\n      The ``dtype`` argument can be any value which is an acceptable\n      fixed-size data-type initializer for the numpy.dtype() method.  See\n      `<https://numpy.org/doc/stable/reference/arrays.dtypes.html>`_.\n      Examples include:\n\n      - Python non-string type (float, int, bool)\n      - Numpy non-string type (e.g. np.float32, np.int64, np.bool\\\\_)\n      - Numpy.dtype array-protocol type strings (e.g. 'i4', 'f8', 'S15')\n\n      If no ``dtype`` value is provide then the type is inferred using\n      ``np.array(data)``.\n\n    - Provide ``length`` and optionally ``shape``, but not ``data``\n\n      Examples::\n\n        col = Column(name='name', length=5)\n        col = Column(name='name', dtype=int, length=10, shape=(3,4))\n\n      The default ``dtype`` is ``np.float64``.  The ``shape`` argument is the\n      array shape of a single cell in the column.\n    \"\"\"\n\n    def __new__(cls, data=None, name=None,\n                dtype=None, shape=(), length=0,\n                description=None, unit=None, format=None, meta=None,\n                copy=False, copy_indices=True):\n\n        if isinstance(data, MaskedColumn) and np.any(data.mask):\n            raise TypeError(\"Cannot convert a MaskedColumn with masked value to a Column\")\n\n        self = super().__new__(\n            cls, data=data, name=name, dtype=dtype, shape=shape, length=length,\n            description=description, unit=unit, format=format, meta=meta,\n            copy=copy, copy_indices=copy_indices)\n        return self\n\n    def __setattr__(self, item, value):\n        if not isinstance(self, MaskedColumn) and item == \"mask\":\n            raise AttributeError(\"cannot set mask value to a column in non-masked Table\")\n        super().__setattr__(item, value)\n\n        if item == 'unit' and issubclass(self.dtype.type, np.number):\n            try:\n                converted = self.parent_table._convert_col_for_table(self)\n            except AttributeError:  # Either no parent table or parent table is None\n                pass\n            else:\n                if converted is not self:\n                    self.parent_table.replace_column(self.name, converted)\n\n    def _base_repr_(self, html=False):\n        # If scalar then just convert to correct numpy type and use numpy repr\n        if self.ndim == 0:\n            return repr(self.item())\n\n        descr_vals = [self.__class__.__name__]\n        unit = None if self.unit is None else str(self.unit)\n        shape = None if self.ndim <= 1 else self.shape[1:]\n        for attr, val in (('name', self.name),\n                          ('dtype', dtype_info_name(self.dtype)),\n                          ('shape', shape),\n                          ('unit', unit),\n                          ('format', self.format),\n                          ('description', self.description),\n                          ('length', len(self))):\n\n            if val is not None:\n                descr_vals.append(f'{attr}={val!r}')\n\n        descr = '<' + ' '.join(descr_vals) + '>\\n'\n\n        if html:\n            from astropy.utils.xml.writer import xml_escape\n            descr = xml_escape(descr)\n\n        data_lines, outs = self._formatter._pformat_col(\n            self, show_name=False, show_unit=False, show_length=False, html=html)\n\n        out = descr + '\\n'.join(data_lines)\n\n        return out\n\n    def _repr_html_(self):\n        return self._base_repr_(html=True)\n\n    def __repr__(self):\n        return self._base_repr_(html=False)\n\n    def __str__(self):\n        # If scalar then just convert to correct numpy type and use numpy repr\n        if self.ndim == 0:\n            return str(self.item())\n\n        lines, outs = self._formatter._pformat_col(self)\n        return '\\n'.join(lines)\n\n    def __bytes__(self):\n        return str(self).encode('utf-8')\n\n    def _check_string_truncate(self, value):\n        \"\"\"\n        Emit a warning if any elements of ``value`` will be truncated when\n        ``value`` is assigned to self.\n        \"\"\"\n        # Convert input ``value`` to the string dtype of this column and\n        # find the length of the longest string in the array.\n        value = np.asanyarray(value, dtype=self.dtype.type)\n        if value.size == 0:\n            return\n        value_str_len = np.char.str_len(value).max()\n\n        # Parse the array-protocol typestring (e.g. '|U15') of self.dtype which\n        # has the character repeat count on the right side.\n        self_str_len = dtype_bytes_or_chars(self.dtype)\n\n        if value_str_len > self_str_len:\n            warnings.warn('truncated right side string(s) longer than {} '\n                          'character(s) during assignment'\n                          .format(self_str_len),\n                          StringTruncateWarning,\n                          stacklevel=3)\n\n    def __setitem__(self, index, value):\n        if self.dtype.char == 'S':\n            value = self._encode_str(value)\n\n        # Issue warning for string assignment that truncates ``value``\n        if issubclass(self.dtype.type, np.character):\n            self._check_string_truncate(value)\n\n        # update indices\n        self.info.adjust_indices(index, value, len(self))\n\n        # Set items using a view of the underlying data, as it gives an\n        # order-of-magnitude speed-up. [#2994]\n        self.data[index] = value\n\n    __eq__ = _make_compare('__eq__')\n    __ne__ = _make_compare('__ne__')\n    __gt__ = _make_compare('__gt__')\n    __lt__ = _make_compare('__lt__')\n    __ge__ = _make_compare('__ge__')\n    __le__ = _make_compare('__le__')\n\n    def insert(self, obj, values, axis=0):\n        \"\"\"\n        Insert values before the given indices in the column and return\n        a new `~astropy.table.Column` object.\n\n        Parameters\n        ----------\n        obj : int, slice or sequence of int\n            Object that defines the index or indices before which ``values`` is\n            inserted.\n        values : array-like\n            Value(s) to insert.  If the type of ``values`` is different from\n            that of the column, ``values`` is converted to the matching type.\n            ``values`` should be shaped so that it can be broadcast appropriately.\n        axis : int, optional\n            Axis along which to insert ``values``.  If ``axis`` is None then\n            the column array is flattened before insertion.  Default is 0,\n            which will insert a row.\n\n        Returns\n        -------\n        out : `~astropy.table.Column`\n            A copy of column with ``values`` and ``mask`` inserted.  Note that the\n            insertion does not occur in-place: a new column is returned.\n        \"\"\"\n        if self.dtype.kind == 'O':\n            # Even if values is array-like (e.g. [1,2,3]), insert as a single\n            # object.  Numpy.insert instead inserts each element in an array-like\n            # input individually.\n            data = np.insert(self, obj, None, axis=axis)\n            data[obj] = values\n        else:\n            self_for_insert = _expand_string_array_for_values(self, values)\n            data = np.insert(self_for_insert, obj, values, axis=axis)\n\n        out = data.view(self.__class__)\n        out.__array_finalize__(self)\n        return out\n\n    # We do this to make the methods show up in the API docs\n    name = BaseColumn.name\n    unit = BaseColumn.unit\n    copy = BaseColumn.copy\n    more = BaseColumn.more\n    pprint = BaseColumn.pprint\n    pformat = BaseColumn.pformat\n    convert_unit_to = BaseColumn.convert_unit_to\n    quantity = BaseColumn.quantity\n    to = BaseColumn.to"},{"className":"BaseColumn","col":0,"comment":"null","endLoc":1000,"id":2511,"nodeType":"Class","startLoc":390,"text":"class BaseColumn(_ColumnGetitemShim, np.ndarray):\n\n    meta = MetaData()\n\n    def __new__(cls, data=None, name=None,\n                dtype=None, shape=(), length=0,\n                description=None, unit=None, format=None, meta=None,\n                copy=False, copy_indices=True):\n        if data is None:\n            self_data = np.zeros((length,)+shape, dtype=dtype)\n        elif isinstance(data, BaseColumn) and hasattr(data, '_name'):\n            # When unpickling a MaskedColumn, ``data`` will be a bare\n            # BaseColumn with none of the expected attributes.  In this case\n            # do NOT execute this block which initializes from ``data``\n            # attributes.\n            self_data = np.array(data.data, dtype=dtype, copy=copy)\n            if description is None:\n                description = data.description\n            if unit is None:\n                unit = unit or data.unit\n            if format is None:\n                format = data.format\n            if meta is None:\n                meta = data.meta\n            if name is None:\n                name = data.name\n        elif isinstance(data, Quantity):\n            if unit is None:\n                self_data = np.array(data, dtype=dtype, copy=copy)\n                unit = data.unit\n            else:\n                self_data = Quantity(data, unit, dtype=dtype, copy=copy).value\n            # If 'info' has been defined, copy basic properties (if needed).\n            if 'info' in data.__dict__:\n                if description is None:\n                    description = data.info.description\n                if format is None:\n                    format = data.info.format\n                if meta is None:\n                    meta = data.info.meta\n\n        else:\n            if np.dtype(dtype).char == 'S':\n                data = cls._encode_str(data)\n            self_data = np.array(data, dtype=dtype, copy=copy)\n\n        self = self_data.view(cls)\n        self._name = None if name is None else str(name)\n        self._parent_table = None\n        self.unit = unit\n        self._format = format\n        self.description = description\n        self.meta = meta\n        self.indices = deepcopy(getattr(data, 'indices', [])) if copy_indices else []\n        for index in self.indices:\n            index.replace_col(data, self)\n\n        return self\n\n    @property\n    def data(self):\n        return self.view(np.ndarray)\n\n    @property\n    def value(self):\n        return self.data\n\n    @property\n    def parent_table(self):\n        # Note: It seems there are some cases where _parent_table is not set,\n        # such after restoring from a pickled Column.  Perhaps that should be\n        # fixed, but this is also okay for now.\n        if getattr(self, '_parent_table', None) is None:\n            return None\n        else:\n            return self._parent_table()\n\n    @parent_table.setter\n    def parent_table(self, table):\n        if table is None:\n            self._parent_table = None\n        else:\n            self._parent_table = weakref.ref(table)\n\n    info = ColumnInfo()\n\n    def copy(self, order='C', data=None, copy_data=True):\n        \"\"\"\n        Return a copy of the current instance.\n\n        If ``data`` is supplied then a view (reference) of ``data`` is used,\n        and ``copy_data`` is ignored.\n\n        Parameters\n        ----------\n        order : {'C', 'F', 'A', 'K'}, optional\n            Controls the memory layout of the copy. 'C' means C-order,\n            'F' means F-order, 'A' means 'F' if ``a`` is Fortran contiguous,\n            'C' otherwise. 'K' means match the layout of ``a`` as closely\n            as possible. (Note that this function and :func:numpy.copy are very\n            similar, but have different default values for their order=\n            arguments.)  Default is 'C'.\n        data : array, optional\n            If supplied then use a view of ``data`` instead of the instance\n            data.  This allows copying the instance attributes and meta.\n        copy_data : bool, optional\n            Make a copy of the internal numpy array instead of using a\n            reference.  Default is True.\n\n        Returns\n        -------\n        col : Column or MaskedColumn\n            Copy of the current column (same type as original)\n        \"\"\"\n        if data is None:\n            data = self.data\n            if copy_data:\n                data = data.copy(order)\n\n        out = data.view(self.__class__)\n        out.__array_finalize__(self)\n\n        # If there is meta on the original column then deepcopy (since \"copy\" of column\n        # implies complete independence from original).  __array_finalize__ will have already\n        # made a light copy.  I'm not sure how to avoid that initial light copy.\n        if self.meta is not None:\n            out.meta = self.meta  # MetaData descriptor does a deepcopy here\n\n        # for MaskedColumn, MaskedArray.__array_finalize__ also copies mask\n        # from self, which is not the idea here, so undo\n        if isinstance(self, MaskedColumn):\n            out._mask = data._mask\n\n        self._copy_groups(out)\n\n        return out\n\n    def __setstate__(self, state):\n        \"\"\"\n        Restore the internal state of the Column/MaskedColumn for pickling\n        purposes.  This requires that the last element of ``state`` is a\n        5-tuple that has Column-specific state values.\n        \"\"\"\n        # Get the Column attributes\n        names = ('_name', '_unit', '_format', 'description', 'meta', 'indices')\n        attrs = {name: val for name, val in zip(names, state[-1])}\n\n        state = state[:-1]\n\n        # Using super().__setstate__(state) gives\n        # \"TypeError 'int' object is not iterable\", raised in\n        # astropy.table._column_mixins._ColumnGetitemShim.__setstate_cython__()\n        # Previously, it seems to have given an infinite recursion.\n        # Hence, manually call the right super class to actually set up\n        # the array object.\n        super_class = ma.MaskedArray if isinstance(self, ma.MaskedArray) else np.ndarray\n        super_class.__setstate__(self, state)\n\n        # Set the Column attributes\n        for name, val in attrs.items():\n            setattr(self, name, val)\n        self._parent_table = None\n\n    def __reduce__(self):\n        \"\"\"\n        Return a 3-tuple for pickling a Column.  Use the super-class\n        functionality but then add in a 5-tuple of Column-specific values\n        that get used in __setstate__.\n        \"\"\"\n        super_class = ma.MaskedArray if isinstance(self, ma.MaskedArray) else np.ndarray\n        reconstruct_func, reconstruct_func_args, state = super_class.__reduce__(self)\n\n        # Define Column-specific attrs and meta that gets added to state.\n        column_state = (self.name, self.unit, self.format, self.description,\n                        self.meta, self.indices)\n        state = state + (column_state,)\n\n        return reconstruct_func, reconstruct_func_args, state\n\n    def __array_finalize__(self, obj):\n        # Obj will be none for direct call to Column() creator\n        if obj is None:\n            return\n\n        if callable(super().__array_finalize__):\n            super().__array_finalize__(obj)\n\n        # Self was created from template (e.g. obj[slice] or (obj * 2))\n        # or viewcast e.g. obj.view(Column).  In either case we want to\n        # init Column attributes for self from obj if possible.\n        self.parent_table = None\n        if not hasattr(self, 'indices'):  # may have been copied in __new__\n            self.indices = []\n        self._copy_attrs(obj)\n        if 'info' in getattr(obj, '__dict__', {}):\n            self.info = obj.info\n\n    def __array_wrap__(self, out_arr, context=None):\n        \"\"\"\n        __array_wrap__ is called at the end of every ufunc.\n\n        Normally, we want a Column object back and do not have to do anything\n        special. But there are two exceptions:\n\n        1) If the output shape is different (e.g. for reduction ufuncs\n           like sum() or mean()), a Column still linking to a parent_table\n           makes little sense, so we return the output viewed as the\n           column content (ndarray or MaskedArray).\n           For this case, we use \"[()]\" to select everything, and to ensure we\n           convert a zero rank array to a scalar. (For some reason np.sum()\n           returns a zero rank scalar array while np.mean() returns a scalar;\n           So the [()] is needed for this case.\n\n        2) When the output is created by any function that returns a boolean\n           we also want to consistently return an array rather than a column\n           (see #1446 and #1685)\n        \"\"\"\n        out_arr = super().__array_wrap__(out_arr, context)\n        if (self.shape != out_arr.shape\n            or (isinstance(out_arr, BaseColumn)\n                and (context is not None\n                     and context[0] in _comparison_functions))):\n            return out_arr.data[()]\n        else:\n            return out_arr\n\n    @property\n    def name(self):\n        \"\"\"\n        The name of this column.\n        \"\"\"\n        return self._name\n\n    @name.setter\n    def name(self, val):\n        if val is not None:\n            val = str(val)\n\n        if self.parent_table is not None:\n            table = self.parent_table\n            table.columns._rename_column(self.name, val)\n\n        self._name = val\n\n    @property\n    def format(self):\n        \"\"\"\n        Format string for displaying values in this column.\n        \"\"\"\n\n        return self._format\n\n    @format.setter\n    def format(self, format_string):\n\n        prev_format = getattr(self, '_format', None)\n\n        self._format = format_string  # set new format string\n\n        try:\n            # test whether it formats without error exemplarily\n            self.pformat(max_lines=1)\n        except Exception as err:\n            # revert to restore previous format if there was one\n            self._format = prev_format\n            raise ValueError(\n                \"Invalid format for column '{}': could not display \"\n                \"values in this column using this format\".format(\n                    self.name)) from err\n\n    @property\n    def descr(self):\n        \"\"\"Array-interface compliant full description of the column.\n\n        This returns a 3-tuple (name, type, shape) that can always be\n        used in a structured array dtype definition.\n        \"\"\"\n        return (self.name, self.dtype.str, self.shape[1:])\n\n    def iter_str_vals(self):\n        \"\"\"\n        Return an iterator that yields the string-formatted values of this\n        column.\n\n        Returns\n        -------\n        str_vals : iterator\n            Column values formatted as strings\n        \"\"\"\n        # Iterate over formatted values with no max number of lines, no column\n        # name, no unit, and ignoring the returned header info in outs.\n        _pformat_col_iter = self._formatter._pformat_col_iter\n        for str_val in _pformat_col_iter(self, -1, show_name=False, show_unit=False,\n                                         show_dtype=False, outs={}):\n            yield str_val\n\n    def attrs_equal(self, col):\n        \"\"\"Compare the column attributes of ``col`` to this object.\n\n        The comparison attributes are: ``name``, ``unit``, ``dtype``,\n        ``format``, ``description``, and ``meta``.\n\n        Parameters\n        ----------\n        col : Column\n            Comparison column\n\n        Returns\n        -------\n        equal : bool\n            True if all attributes are equal\n        \"\"\"\n        if not isinstance(col, BaseColumn):\n            raise ValueError('Comparison `col` must be a Column or '\n                             'MaskedColumn object')\n\n        attrs = ('name', 'unit', 'dtype', 'format', 'description', 'meta')\n        equal = all(getattr(self, x) == getattr(col, x) for x in attrs)\n\n        return equal\n\n    @property\n    def _formatter(self):\n        return FORMATTER if (self.parent_table is None) else self.parent_table.formatter\n\n    def pformat(self, max_lines=None, show_name=True, show_unit=False, show_dtype=False,\n                html=False):\n        \"\"\"Return a list of formatted string representation of column values.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default will be\n        determined using the ``astropy.conf.max_lines`` configuration\n        item. If a negative value of ``max_lines`` is supplied then\n        there is no line limit applied.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum lines of output (header + data rows)\n\n        show_name : bool\n            Include column name. Default is True.\n\n        show_unit : bool\n            Include a header row for unit. Default is False.\n\n        show_dtype : bool\n            Include column dtype. Default is False.\n\n        html : bool\n            Format the output as an HTML table. Default is False.\n\n        Returns\n        -------\n        lines : list\n            List of lines with header and formatted column values\n\n        \"\"\"\n        _pformat_col = self._formatter._pformat_col\n        lines, outs = _pformat_col(self, max_lines, show_name=show_name,\n                                   show_unit=show_unit, show_dtype=show_dtype,\n                                   html=html)\n        return lines\n\n    def pprint(self, max_lines=None, show_name=True, show_unit=False, show_dtype=False):\n        \"\"\"Print a formatted string representation of column values.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default will be\n        determined using the ``astropy.conf.max_lines`` configuration\n        item. If a negative value of ``max_lines`` is supplied then\n        there is no line limit applied.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum number of values in output\n\n        show_name : bool\n            Include column name. Default is True.\n\n        show_unit : bool\n            Include a header row for unit. Default is False.\n\n        show_dtype : bool\n            Include column dtype. Default is True.\n        \"\"\"\n        _pformat_col = self._formatter._pformat_col\n        lines, outs = _pformat_col(self, max_lines, show_name=show_name, show_unit=show_unit,\n                                   show_dtype=show_dtype)\n\n        n_header = outs['n_header']\n        for i, line in enumerate(lines):\n            if i < n_header:\n                color_print(line, 'red')\n            else:\n                print(line)\n\n    def more(self, max_lines=None, show_name=True, show_unit=False):\n        \"\"\"Interactively browse column with a paging interface.\n\n        Supported keys::\n\n          f, <space> : forward one page\n          b : back one page\n          r : refresh same page\n          n : next row\n          p : previous row\n          < : go to beginning\n          > : go to end\n          q : quit browsing\n          h : print this help\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum number of lines in table output.\n\n        show_name : bool\n            Include a header row for column names. Default is True.\n\n        show_unit : bool\n            Include a header row for unit. Default is False.\n\n        \"\"\"\n        _more_tabcol = self._formatter._more_tabcol\n        _more_tabcol(self, max_lines=max_lines, show_name=show_name,\n                     show_unit=show_unit)\n\n    @property\n    def unit(self):\n        \"\"\"\n        The unit associated with this column.  May be a string or a\n        `astropy.units.UnitBase` instance.\n\n        Setting the ``unit`` property does not change the values of the\n        data.  To perform a unit conversion, use ``convert_unit_to``.\n        \"\"\"\n        return self._unit\n\n    @unit.setter\n    def unit(self, unit):\n        if unit is None:\n            self._unit = None\n        else:\n            self._unit = Unit(unit, parse_strict='silent')\n\n    @unit.deleter\n    def unit(self):\n        self._unit = None\n\n    def searchsorted(self, v, side='left', sorter=None):\n        # For bytes type data, encode the `v` value as UTF-8 (if necessary) before\n        # calling searchsorted. This prevents a factor of 1000 slowdown in\n        # searchsorted in this case.\n        a = self.data\n        if a.dtype.kind == 'S' and not isinstance(v, bytes):\n            v = np.asarray(v)\n            if v.dtype.kind == 'U':\n                v = np.char.encode(v, 'utf-8')\n        return np.searchsorted(a, v, side=side, sorter=sorter)\n    searchsorted.__doc__ = np.ndarray.searchsorted.__doc__\n\n    def convert_unit_to(self, new_unit, equivalencies=[]):\n        \"\"\"\n        Converts the values of the column in-place from the current\n        unit to the given unit.\n\n        To change the unit associated with this column without\n        actually changing the data values, simply set the ``unit``\n        property.\n\n        Parameters\n        ----------\n        new_unit : str or `astropy.units.UnitBase` instance\n            The unit to convert to.\n\n        equivalencies : list of tuple\n           A list of equivalence pairs to try if the unit are not\n           directly convertible.  See :ref:`astropy:unit_equivalencies`.\n\n        Raises\n        ------\n        astropy.units.UnitsError\n            If units are inconsistent\n        \"\"\"\n        if self.unit is None:\n            raise ValueError(\"No unit set on column\")\n        self.data[:] = self.unit.to(\n            new_unit, self.data, equivalencies=equivalencies)\n        self.unit = new_unit\n\n    @property\n    def groups(self):\n        if not hasattr(self, '_groups'):\n            self._groups = groups.ColumnGroups(self)\n        return self._groups\n\n    def group_by(self, keys):\n        \"\"\"\n        Group this column by the specified ``keys``\n\n        This effectively splits the column into groups which correspond to\n        unique values of the ``keys`` grouping object.  The output is a new\n        `Column` or `MaskedColumn` which contains a copy of this column but\n        sorted by row according to ``keys``.\n\n        The ``keys`` input to ``group_by`` must be a numpy array with the\n        same length as this column.\n\n        Parameters\n        ----------\n        keys : numpy array\n            Key grouping object\n\n        Returns\n        -------\n        out : Column\n            New column with groups attribute set accordingly\n        \"\"\"\n        return groups.column_group_by(self, keys)\n\n    def _copy_groups(self, out):\n        \"\"\"\n        Copy current groups into a copy of self ``out``\n        \"\"\"\n        if self.parent_table:\n            if hasattr(self.parent_table, '_groups'):\n                out._groups = groups.ColumnGroups(out, indices=self.parent_table._groups._indices)\n        elif hasattr(self, '_groups'):\n            out._groups = groups.ColumnGroups(out, indices=self._groups._indices)\n\n    # Strip off the BaseColumn-ness for repr and str so that\n    # MaskedColumn.data __repr__ does not include masked_BaseColumn(data =\n    # [1 2], ...).\n    def __repr__(self):\n        return np.asarray(self).__repr__()\n\n    @property\n    def quantity(self):\n        \"\"\"\n        A view of this table column as a `~astropy.units.Quantity` object with\n        units given by the Column's `unit` parameter.\n        \"\"\"\n        # the Quantity initializer is used here because it correctly fails\n        # if the column's values are non-numeric (like strings), while .view\n        # will happily return a quantity with gibberish for numerical values\n        return Quantity(self, self.unit, copy=False, dtype=self.dtype, order='A', subok=True)\n\n    def to(self, unit, equivalencies=[], **kwargs):\n        \"\"\"\n        Converts this table column to a `~astropy.units.Quantity` object with\n        the requested units.\n\n        Parameters\n        ----------\n        unit : unit-like\n            The unit to convert to (i.e., a valid argument to the\n            :meth:`astropy.units.Quantity.to` method).\n        equivalencies : list of tuple\n            Equivalencies to use for this conversion.  See\n            :meth:`astropy.units.Quantity.to` for more details.\n\n        Returns\n        -------\n        quantity : `~astropy.units.Quantity`\n            A quantity object with the contents of this column in the units\n            ``unit``.\n        \"\"\"\n        return self.quantity.to(unit, equivalencies)\n\n    def _copy_attrs(self, obj):\n        \"\"\"\n        Copy key column attributes from ``obj`` to self\n        \"\"\"\n        for attr in ('name', 'unit', '_format', 'description'):\n            val = getattr(obj, attr, None)\n            setattr(self, attr, val)\n\n        # Light copy of meta if it is not empty\n        obj_meta = getattr(obj, 'meta', None)\n        if obj_meta:\n            self.meta = obj_meta.copy()\n\n    @staticmethod\n    def _encode_str(value):\n        \"\"\"\n        Encode anything that is unicode-ish as utf-8.  This method is only\n        called for Py3+.\n        \"\"\"\n        if isinstance(value, str):\n            value = value.encode('utf-8')\n        elif isinstance(value, bytes) or value is np.ma.masked:\n            pass\n        else:\n            arr = np.asarray(value)\n            if arr.dtype.char == 'U':\n                arr = np.char.encode(arr, encoding='utf-8')\n                if isinstance(value, np.ma.MaskedArray):\n                    arr = np.ma.array(arr, mask=value.mask, copy=False)\n            value = arr\n\n        return value\n\n    def tolist(self):\n        if self.dtype.kind == 'S':\n            return np.chararray.decode(self, encoding='utf-8').tolist()\n        else:\n            return super().tolist()"},{"col":4,"comment":"null","endLoc":451,"header":"@property\n    def data(self)","id":2512,"name":"data","nodeType":"Function","startLoc":449,"text":"@property\n    def data(self):\n        return self.view(np.ndarray)"},{"col":4,"comment":"null","endLoc":455,"header":"@property\n    def value(self)","id":2513,"name":"value","nodeType":"Function","startLoc":453,"text":"@property\n    def value(self):\n        return self.data"},{"col":4,"comment":"null","endLoc":465,"header":"@property\n    def parent_table(self)","id":2514,"name":"parent_table","nodeType":"Function","startLoc":457,"text":"@property\n    def parent_table(self):\n        # Note: It seems there are some cases where _parent_table is not set,\n        # such after restoring from a pickled Column.  Perhaps that should be\n        # fixed, but this is also okay for now.\n        if getattr(self, '_parent_table', None) is None:\n            return None\n        else:\n            return self._parent_table()"},{"col":4,"comment":"null","endLoc":472,"header":"@parent_table.setter\n    def parent_table(self, table)","id":2515,"name":"parent_table","nodeType":"Function","startLoc":467,"text":"@parent_table.setter\n    def parent_table(self, table):\n        if table is None:\n            self._parent_table = None\n        else:\n            self._parent_table = weakref.ref(table)"},{"col":0,"comment":"\n    Given an original coordinate object, update the differentials so that\n    the final coordinate is at the same location as the original coordinate\n    but co-moving with the velocity reference object.\n\n    If preserve_original_frame is set to True, the resulting object will be in\n    the frame of the original coordinate, otherwise it will be in the frame of\n    the velocity reference.\n    ","endLoc":111,"header":"def update_differentials_to_match(original, velocity_reference, preserve_observer_frame=False)","id":2516,"name":"update_differentials_to_match","nodeType":"Function","startLoc":71,"text":"def update_differentials_to_match(original, velocity_reference, preserve_observer_frame=False):\n    \"\"\"\n    Given an original coordinate object, update the differentials so that\n    the final coordinate is at the same location as the original coordinate\n    but co-moving with the velocity reference object.\n\n    If preserve_original_frame is set to True, the resulting object will be in\n    the frame of the original coordinate, otherwise it will be in the frame of\n    the velocity reference.\n    \"\"\"\n\n    if not velocity_reference.data.differentials:\n        raise ValueError(\"Reference frame has no velocities\")\n\n    # If the reference has an obstime already defined, we should ignore\n    # it and stick with the original observer obstime.\n    if 'obstime' in velocity_reference.frame_attributes and hasattr(original, 'obstime'):\n        velocity_reference = velocity_reference.replicate(obstime=original.obstime)\n\n    # We transform both coordinates to ICRS for simplicity and because we know\n    # it's a simple frame that is not time-dependent (it could be that both\n    # the original and velocity_reference frame are time-dependent)\n\n    original_icrs = original.transform_to(ICRS())\n    velocity_reference_icrs = velocity_reference.transform_to(ICRS())\n\n    differentials = velocity_reference_icrs.data.represent_as(CartesianRepresentation,\n                                                              CartesianDifferential).differentials\n\n    data_with_differentials = (original_icrs.data.represent_as(CartesianRepresentation)\n                               .with_differentials(differentials))\n\n    final_icrs = original_icrs.realize_frame(data_with_differentials)\n\n    if preserve_observer_frame:\n        final = final_icrs.transform_to(original)\n    else:\n        final = final_icrs.transform_to(velocity_reference)\n\n    return final.replicate(representation_type=CartesianRepresentation,\n                           differential_type=CartesianDifferential)"},{"col":4,"comment":"\n        Return a copy of the current instance.\n\n        If ``data`` is supplied then a view (reference) of ``data`` is used,\n        and ``copy_data`` is ignored.\n\n        Parameters\n        ----------\n        order : {'C', 'F', 'A', 'K'}, optional\n            Controls the memory layout of the copy. 'C' means C-order,\n            'F' means F-order, 'A' means 'F' if ``a`` is Fortran contiguous,\n            'C' otherwise. 'K' means match the layout of ``a`` as closely\n            as possible. (Note that this function and :func:numpy.copy are very\n            similar, but have different default values for their order=\n            arguments.)  Default is 'C'.\n        data : array, optional\n            If supplied then use a view of ``data`` instead of the instance\n            data.  This allows copying the instance attributes and meta.\n        copy_data : bool, optional\n            Make a copy of the internal numpy array instead of using a\n            reference.  Default is True.\n\n        Returns\n        -------\n        col : Column or MaskedColumn\n            Copy of the current column (same type as original)\n        ","endLoc":525,"header":"def copy(self, order='C', data=None, copy_data=True)","id":2517,"name":"copy","nodeType":"Function","startLoc":476,"text":"def copy(self, order='C', data=None, copy_data=True):\n        \"\"\"\n        Return a copy of the current instance.\n\n        If ``data`` is supplied then a view (reference) of ``data`` is used,\n        and ``copy_data`` is ignored.\n\n        Parameters\n        ----------\n        order : {'C', 'F', 'A', 'K'}, optional\n            Controls the memory layout of the copy. 'C' means C-order,\n            'F' means F-order, 'A' means 'F' if ``a`` is Fortran contiguous,\n            'C' otherwise. 'K' means match the layout of ``a`` as closely\n            as possible. (Note that this function and :func:numpy.copy are very\n            similar, but have different default values for their order=\n            arguments.)  Default is 'C'.\n        data : array, optional\n            If supplied then use a view of ``data`` instead of the instance\n            data.  This allows copying the instance attributes and meta.\n        copy_data : bool, optional\n            Make a copy of the internal numpy array instead of using a\n            reference.  Default is True.\n\n        Returns\n        -------\n        col : Column or MaskedColumn\n            Copy of the current column (same type as original)\n        \"\"\"\n        if data is None:\n            data = self.data\n            if copy_data:\n                data = data.copy(order)\n\n        out = data.view(self.__class__)\n        out.__array_finalize__(self)\n\n        # If there is meta on the original column then deepcopy (since \"copy\" of column\n        # implies complete independence from original).  __array_finalize__ will have already\n        # made a light copy.  I'm not sure how to avoid that initial light copy.\n        if self.meta is not None:\n            out.meta = self.meta  # MetaData descriptor does a deepcopy here\n\n        # for MaskedColumn, MaskedArray.__array_finalize__ also copies mask\n        # from self, which is not the idea here, so undo\n        if isinstance(self, MaskedColumn):\n            out._mask = data._mask\n\n        self._copy_groups(out)\n\n        return out"},{"attributeType":"null","col":12,"comment":"null","endLoc":1846,"id":2518,"name":"_imagedata","nodeType":"Attribute","startLoc":1846,"text":"self._imagedata"},{"col":4,"comment":"\n        Copy current groups into a copy of self ``out``\n        ","endLoc":922,"header":"def _copy_groups(self, out)","id":2519,"name":"_copy_groups","nodeType":"Function","startLoc":914,"text":"def _copy_groups(self, out):\n        \"\"\"\n        Copy current groups into a copy of self ``out``\n        \"\"\"\n        if self.parent_table:\n            if hasattr(self.parent_table, '_groups'):\n                out._groups = groups.ColumnGroups(out, indices=self.parent_table._groups._indices)\n        elif hasattr(self, '_groups'):\n            out._groups = groups.ColumnGroups(out, indices=self._groups._indices)"},{"attributeType":"null","col":12,"comment":"null","endLoc":829,"id":2520,"name":"name","nodeType":"Attribute","startLoc":829,"text":"self.name"},{"attributeType":"null","col":8,"comment":"null","endLoc":658,"id":2521,"name":"_bitpix","nodeType":"Attribute","startLoc":658,"text":"self._bitpix"},{"className":"Group","col":0,"comment":"\n    One group of the random group data.\n    ","endLoc":84,"id":2522,"nodeType":"Class","startLoc":16,"text":"class Group(FITS_record):\n    \"\"\"\n    One group of the random group data.\n    \"\"\"\n\n    def __init__(self, input, row=0, start=None, end=None, step=None,\n                 base=None):\n        super().__init__(input, row, start, end, step, base)\n\n    @property\n    def parnames(self):\n        return self.array.parnames\n\n    @property\n    def data(self):\n        # The last column in the coldefs is the data portion of the group\n        return self.field(self.array._coldefs.names[-1])\n\n    @lazyproperty\n    def _unique(self):\n        return _par_indices(self.parnames)\n\n    def par(self, parname):\n        \"\"\"\n        Get the group parameter value.\n        \"\"\"\n\n        if _is_int(parname):\n            result = self.array[self.row][parname]\n        else:\n            indx = self._unique[parname.upper()]\n            if len(indx) == 1:\n                result = self.array[self.row][indx[0]]\n\n            # if more than one group parameter have the same name\n            else:\n                result = self.array[self.row][indx[0]].astype('f8')\n                for i in indx[1:]:\n                    result += self.array[self.row][i]\n\n        return result\n\n    def setpar(self, parname, value):\n        \"\"\"\n        Set the group parameter value.\n        \"\"\"\n\n        # TODO: It would be nice if, instead of requiring a multi-part value to\n        # be an array, there were an *option* to automatically split the value\n        # into multiple columns if it doesn't already fit in the array data\n        # type.\n\n        if _is_int(parname):\n            self.array[self.row][parname] = value\n        else:\n            indx = self._unique[parname.upper()]\n            if len(indx) == 1:\n                self.array[self.row][indx[0]] = value\n\n            # if more than one group parameter have the same name, the\n            # value must be a list (or tuple) containing arrays\n            else:\n                if isinstance(value, (list, tuple)) and \\\n                   len(indx) == len(value):\n                    for i in range(len(indx)):\n                        self.array[self.row][indx[i]] = value[i]\n                else:\n                    raise ValueError('Parameter value must be a sequence with '\n                                     '{} arrays/numbers.'.format(len(indx)))"},{"col":4,"comment":"null","endLoc":23,"header":"def __init__(self, input, row=0, start=None, end=None, step=None,\n                 base=None)","id":2523,"name":"__init__","nodeType":"Function","startLoc":21,"text":"def __init__(self, input, row=0, start=None, end=None, step=None,\n                 base=None):\n        super().__init__(input, row, start, end, step, base)"},{"col":4,"comment":"null","endLoc":219,"header":"def __init__(self, parent_column, indices=None, keys=None)","id":2524,"name":"__init__","nodeType":"Function","startLoc":215,"text":"def __init__(self, parent_column, indices=None, keys=None):\n        self.parent_column = parent_column  # parent Column\n        self.parent_table = parent_column.parent_table\n        self._indices = indices\n        self._keys = keys"},{"col":4,"comment":"\n        Restore the internal state of the Column/MaskedColumn for pickling\n        purposes.  This requires that the last element of ``state`` is a\n        5-tuple that has Column-specific state values.\n        ","endLoc":551,"header":"def __setstate__(self, state)","id":2525,"name":"__setstate__","nodeType":"Function","startLoc":527,"text":"def __setstate__(self, state):\n        \"\"\"\n        Restore the internal state of the Column/MaskedColumn for pickling\n        purposes.  This requires that the last element of ``state`` is a\n        5-tuple that has Column-specific state values.\n        \"\"\"\n        # Get the Column attributes\n        names = ('_name', '_unit', '_format', 'description', 'meta', 'indices')\n        attrs = {name: val for name, val in zip(names, state[-1])}\n\n        state = state[:-1]\n\n        # Using super().__setstate__(state) gives\n        # \"TypeError 'int' object is not iterable\", raised in\n        # astropy.table._column_mixins._ColumnGetitemShim.__setstate_cython__()\n        # Previously, it seems to have given an infinite recursion.\n        # Hence, manually call the right super class to actually set up\n        # the array object.\n        super_class = ma.MaskedArray if isinstance(self, ma.MaskedArray) else np.ndarray\n        super_class.__setstate__(self, state)\n\n        # Set the Column attributes\n        for name, val in attrs.items():\n            setattr(self, name, val)\n        self._parent_table = None"},{"col":4,"comment":"\n        Return a 3-tuple for pickling a Column.  Use the super-class\n        functionality but then add in a 5-tuple of Column-specific values\n        that get used in __setstate__.\n        ","endLoc":567,"header":"def __reduce__(self)","id":2526,"name":"__reduce__","nodeType":"Function","startLoc":553,"text":"def __reduce__(self):\n        \"\"\"\n        Return a 3-tuple for pickling a Column.  Use the super-class\n        functionality but then add in a 5-tuple of Column-specific values\n        that get used in __setstate__.\n        \"\"\"\n        super_class = ma.MaskedArray if isinstance(self, ma.MaskedArray) else np.ndarray\n        reconstruct_func, reconstruct_func_args, state = super_class.__reduce__(self)\n\n        # Define Column-specific attrs and meta that gets added to state.\n        column_state = (self.name, self.unit, self.format, self.description,\n                        self.meta, self.indices)\n        state = state + (column_state,)\n\n        return reconstruct_func, reconstruct_func_args, state"},{"col":4,"comment":"null","endLoc":27,"header":"@property\n    def parnames(self)","id":2527,"name":"parnames","nodeType":"Function","startLoc":25,"text":"@property\n    def parnames(self):\n        return self.array.parnames"},{"col":4,"comment":"null","endLoc":32,"header":"@property\n    def data(self)","id":2528,"name":"data","nodeType":"Function","startLoc":29,"text":"@property\n    def data(self):\n        # The last column in the coldefs is the data portion of the group\n        return self.field(self.array._coldefs.names[-1])"},{"col":4,"comment":"null","endLoc":585,"header":"def __array_finalize__(self, obj)","id":2529,"name":"__array_finalize__","nodeType":"Function","startLoc":569,"text":"def __array_finalize__(self, obj):\n        # Obj will be none for direct call to Column() creator\n        if obj is None:\n            return\n\n        if callable(super().__array_finalize__):\n            super().__array_finalize__(obj)\n\n        # Self was created from template (e.g. obj[slice] or (obj * 2))\n        # or viewcast e.g. obj.view(Column).  In either case we want to\n        # init Column attributes for self from obj if possible.\n        self.parent_table = None\n        if not hasattr(self, 'indices'):  # may have been copied in __new__\n            self.indices = []\n        self._copy_attrs(obj)\n        if 'info' in getattr(obj, '__dict__', {}):\n            self.info = obj.info"},{"col":4,"comment":"null","endLoc":36,"header":"@lazyproperty\n    def _unique(self)","id":2530,"name":"_unique","nodeType":"Function","startLoc":34,"text":"@lazyproperty\n    def _unique(self):\n        return _par_indices(self.parnames)"},{"col":4,"comment":"\n        Get the group parameter value.\n        ","endLoc":56,"header":"def par(self, parname)","id":2531,"name":"par","nodeType":"Function","startLoc":38,"text":"def par(self, parname):\n        \"\"\"\n        Get the group parameter value.\n        \"\"\"\n\n        if _is_int(parname):\n            result = self.array[self.row][parname]\n        else:\n            indx = self._unique[parname.upper()]\n            if len(indx) == 1:\n                result = self.array[self.row][indx[0]]\n\n            # if more than one group parameter have the same name\n            else:\n                result = self.array[self.row][indx[0]].astype('f8')\n                for i in indx[1:]:\n                    result += self.array[self.row][i]\n\n        return result"},{"col":4,"comment":"\n        Copy key column attributes from ``obj`` to self\n        ","endLoc":974,"header":"def _copy_attrs(self, obj)","id":2532,"name":"_copy_attrs","nodeType":"Function","startLoc":963,"text":"def _copy_attrs(self, obj):\n        \"\"\"\n        Copy key column attributes from ``obj`` to self\n        \"\"\"\n        for attr in ('name', 'unit', '_format', 'description'):\n            val = getattr(obj, attr, None)\n            setattr(self, attr, val)\n\n        # Light copy of meta if it is not empty\n        obj_meta = getattr(obj, 'meta', None)\n        if obj_meta:\n            self.meta = obj_meta.copy()"},{"col":4,"comment":"\n        Set the group parameter value.\n        ","endLoc":84,"header":"def setpar(self, parname, value)","id":2533,"name":"setpar","nodeType":"Function","startLoc":58,"text":"def setpar(self, parname, value):\n        \"\"\"\n        Set the group parameter value.\n        \"\"\"\n\n        # TODO: It would be nice if, instead of requiring a multi-part value to\n        # be an array, there were an *option* to automatically split the value\n        # into multiple columns if it doesn't already fit in the array data\n        # type.\n\n        if _is_int(parname):\n            self.array[self.row][parname] = value\n        else:\n            indx = self._unique[parname.upper()]\n            if len(indx) == 1:\n                self.array[self.row][indx[0]] = value\n\n            # if more than one group parameter have the same name, the\n            # value must be a list (or tuple) containing arrays\n            else:\n                if isinstance(value, (list, tuple)) and \\\n                   len(indx) == len(value):\n                    for i in range(len(indx)):\n                        self.array[self.row][indx[i]] = value[i]\n                else:\n                    raise ValueError('Parameter value must be a sequence with '\n                                     '{} arrays/numbers.'.format(len(indx)))"},{"col":4,"comment":"\n        Return a :class:`pandas.DataFrame` instance\n\n        The index of the created DataFrame is controlled by the ``index``\n        argument.  For ``index=True`` or the default ``None``, an index will be\n        specified for the DataFrame if there is a primary key index on the\n        Table *and* if it corresponds to a single column.  If ``index=False``\n        then no DataFrame index will be specified.  If ``index`` is the name of\n        a column in the table then that will be the DataFrame index.\n\n        In addition to vanilla columns or masked columns, this supports Table\n        mixin columns like Quantity, Time, or SkyCoord.  In many cases these\n        objects have no analog in pandas and will be converted to a \"encoded\"\n        representation using only Column or MaskedColumn.  The exception is\n        Time or TimeDelta columns, which will be converted to the corresponding\n        representation in pandas using ``np.datetime64`` or ``np.timedelta64``.\n        See the example below.\n\n        Parameters\n        ----------\n        index : None, bool, str\n            Specify DataFrame index mode\n        use_nullable_int : bool, default=True\n            Convert integer MaskedColumn to pandas nullable integer type.\n            If ``use_nullable_int=False`` or the pandas version does not support\n            nullable integer types (version < 0.24), then the column is converted\n            to float with NaN for missing elements and a warning is issued.\n\n        Returns\n        -------\n        dataframe : :class:`pandas.DataFrame`\n            A pandas :class:`pandas.DataFrame` instance\n\n        Raises\n        ------\n        ImportError\n            If pandas is not installed\n        ValueError\n            If the Table has multi-dimensional columns\n\n        Examples\n        --------\n        Here we convert a table with a few mixins to a\n        :class:`pandas.DataFrame` instance.\n\n          >>> import pandas as pd\n          >>> from astropy.table import QTable\n          >>> import astropy.units as u\n          >>> from astropy.time import Time, TimeDelta\n          >>> from astropy.coordinates import SkyCoord\n\n          >>> q = [1, 2] * u.m\n          >>> tm = Time([1998, 2002], format='jyear')\n          >>> sc = SkyCoord([5, 6], [7, 8], unit='deg')\n          >>> dt = TimeDelta([3, 200] * u.s)\n\n          >>> t = QTable([q, tm, sc, dt], names=['q', 'tm', 'sc', 'dt'])\n\n          >>> df = t.to_pandas(index='tm')\n          >>> with pd.option_context('display.max_columns', 20):\n          ...     print(df)\n                        q  sc.ra  sc.dec              dt\n          tm\n          1998-01-01  1.0    5.0     7.0 0 days 00:00:03\n          2002-01-01  2.0    6.0     8.0 0 days 00:03:20\n\n        ","endLoc":3768,"header":"def to_pandas(self, index=None, use_nullable_int=True)","id":2534,"name":"to_pandas","nodeType":"Function","startLoc":3593,"text":"def to_pandas(self, index=None, use_nullable_int=True):\n        \"\"\"\n        Return a :class:`pandas.DataFrame` instance\n\n        The index of the created DataFrame is controlled by the ``index``\n        argument.  For ``index=True`` or the default ``None``, an index will be\n        specified for the DataFrame if there is a primary key index on the\n        Table *and* if it corresponds to a single column.  If ``index=False``\n        then no DataFrame index will be specified.  If ``index`` is the name of\n        a column in the table then that will be the DataFrame index.\n\n        In addition to vanilla columns or masked columns, this supports Table\n        mixin columns like Quantity, Time, or SkyCoord.  In many cases these\n        objects have no analog in pandas and will be converted to a \"encoded\"\n        representation using only Column or MaskedColumn.  The exception is\n        Time or TimeDelta columns, which will be converted to the corresponding\n        representation in pandas using ``np.datetime64`` or ``np.timedelta64``.\n        See the example below.\n\n        Parameters\n        ----------\n        index : None, bool, str\n            Specify DataFrame index mode\n        use_nullable_int : bool, default=True\n            Convert integer MaskedColumn to pandas nullable integer type.\n            If ``use_nullable_int=False`` or the pandas version does not support\n            nullable integer types (version < 0.24), then the column is converted\n            to float with NaN for missing elements and a warning is issued.\n\n        Returns\n        -------\n        dataframe : :class:`pandas.DataFrame`\n            A pandas :class:`pandas.DataFrame` instance\n\n        Raises\n        ------\n        ImportError\n            If pandas is not installed\n        ValueError\n            If the Table has multi-dimensional columns\n\n        Examples\n        --------\n        Here we convert a table with a few mixins to a\n        :class:`pandas.DataFrame` instance.\n\n          >>> import pandas as pd\n          >>> from astropy.table import QTable\n          >>> import astropy.units as u\n          >>> from astropy.time import Time, TimeDelta\n          >>> from astropy.coordinates import SkyCoord\n\n          >>> q = [1, 2] * u.m\n          >>> tm = Time([1998, 2002], format='jyear')\n          >>> sc = SkyCoord([5, 6], [7, 8], unit='deg')\n          >>> dt = TimeDelta([3, 200] * u.s)\n\n          >>> t = QTable([q, tm, sc, dt], names=['q', 'tm', 'sc', 'dt'])\n\n          >>> df = t.to_pandas(index='tm')\n          >>> with pd.option_context('display.max_columns', 20):\n          ...     print(df)\n                        q  sc.ra  sc.dec              dt\n          tm\n          1998-01-01  1.0    5.0     7.0 0 days 00:00:03\n          2002-01-01  2.0    6.0     8.0 0 days 00:03:20\n\n        \"\"\"\n        from pandas import DataFrame, Series\n\n        if index is not False:\n            if index in (None, True):\n                # Default is to use the table primary key if available and a single column\n                if self.primary_key and len(self.primary_key) == 1:\n                    index = self.primary_key[0]\n                else:\n                    index = False\n            else:\n                if index not in self.colnames:\n                    raise ValueError('index must be None, False, True or a table '\n                                     'column name')\n\n        def _encode_mixins(tbl):\n            \"\"\"Encode a Table ``tbl`` that may have mixin columns to a Table with only\n            astropy Columns + appropriate meta-data to allow subsequent decoding.\n            \"\"\"\n            from . import serialize\n            from astropy.time import TimeBase, TimeDelta\n\n            # Convert any Time or TimeDelta columns and pay attention to masking\n            time_cols = [col for col in tbl.itercols() if isinstance(col, TimeBase)]\n            if time_cols:\n\n                # Make a light copy of table and clear any indices\n                new_cols = []\n                for col in tbl.itercols():\n                    new_col = col_copy(col, copy_indices=False) if col.info.indices else col\n                    new_cols.append(new_col)\n                tbl = tbl.__class__(new_cols, copy=False)\n\n                # Certain subclasses (e.g. TimeSeries) may generate new indices on\n                # table creation, so make sure there are no indices on the table.\n                for col in tbl.itercols():\n                    col.info.indices.clear()\n\n                for col in time_cols:\n                    if isinstance(col, TimeDelta):\n                        # Convert to nanoseconds (matches astropy datetime64 support)\n                        new_col = (col.sec * 1e9).astype('timedelta64[ns]')\n                        nat = np.timedelta64('NaT')\n                    else:\n                        new_col = col.datetime64.copy()\n                        nat = np.datetime64('NaT')\n                    if col.masked:\n                        new_col[col.mask] = nat\n                    tbl[col.info.name] = new_col\n\n            # Convert the table to one with no mixins, only Column objects.\n            encode_tbl = serialize.represent_mixins_as_columns(tbl)\n            return encode_tbl\n\n        tbl = _encode_mixins(self)\n\n        badcols = [name for name, col in self.columns.items() if len(col.shape) > 1]\n        if badcols:\n            raise ValueError(\n                f'Cannot convert a table with multidimensional columns to a '\n                f'pandas DataFrame. Offending columns are: {badcols}\\n'\n                f'One can filter out such columns using:\\n'\n                f'names = [name for name in tbl.colnames if len(tbl[name].shape) <= 1]\\n'\n                f'tbl[names].to_pandas(...)')\n\n        out = OrderedDict()\n\n        for name, column in tbl.columns.items():\n            if getattr(column.dtype, 'isnative', True):\n                out[name] = column\n            else:\n                out[name] = column.data.byteswap().newbyteorder('=')\n\n            if isinstance(column, MaskedColumn) and np.any(column.mask):\n                if column.dtype.kind in ['i', 'u']:\n                    pd_dtype = column.dtype.name\n                    if use_nullable_int:\n                        # Convert int64 to Int64, uint32 to UInt32, etc for nullable types\n                        pd_dtype = pd_dtype.replace('i', 'I').replace('u', 'U')\n                    out[name] = Series(out[name], dtype=pd_dtype)\n\n                    # If pandas is older than 0.24 the type may have turned to float\n                    if column.dtype.kind != out[name].dtype.kind:\n                        warnings.warn(\n                            f\"converted column '{name}' from {column.dtype} to {out[name].dtype}\",\n                            TableReplaceWarning, stacklevel=3)\n                elif column.dtype.kind not in ['f', 'c']:\n                    out[name] = column.astype(object).filled(np.nan)\n\n        kwargs = {}\n\n        if index:\n            idx = out.pop(index)\n\n            kwargs['index'] = idx\n\n            # We add the table index to Series inputs (MaskedColumn with int values) to override\n            # its default RangeIndex, see #11432\n            for v in out.values():\n                if isinstance(v, Series):\n                    v.index = idx\n\n        df = DataFrame(out, **kwargs)\n        if index:\n            # Explicitly set the pandas DataFrame index to the original table\n            # index name.\n            df.index.name = idx.info.name\n\n        return df"},{"className":"StreamingHDU","col":0,"comment":"\n    A class that provides the capability to stream data to a FITS file\n    instead of requiring data to all be written at once.\n\n    The following pseudocode illustrates its use::\n\n        header = astropy.io.fits.Header()\n\n        for all the cards you need in the header:\n            header[key] = (value, comment)\n\n        shdu = astropy.io.fits.StreamingHDU('filename.fits', header)\n\n        for each piece of data:\n            shdu.write(data)\n\n        shdu.close()\n    ","endLoc":229,"id":2535,"nodeType":"Class","startLoc":15,"text":"class StreamingHDU:\n    \"\"\"\n    A class that provides the capability to stream data to a FITS file\n    instead of requiring data to all be written at once.\n\n    The following pseudocode illustrates its use::\n\n        header = astropy.io.fits.Header()\n\n        for all the cards you need in the header:\n            header[key] = (value, comment)\n\n        shdu = astropy.io.fits.StreamingHDU('filename.fits', header)\n\n        for each piece of data:\n            shdu.write(data)\n\n        shdu.close()\n    \"\"\"\n\n    def __init__(self, name, header):\n        \"\"\"\n        Construct a `StreamingHDU` object given a file name and a header.\n\n        Parameters\n        ----------\n        name : path-like or file-like\n            The file to which the header and data will be streamed. If opened,\n            the file object must be opened in a writeable binary mode such as\n            'wb' or 'ab+'.\n\n        header : `Header` instance\n            The header object associated with the data to be written\n            to the file.\n\n        Notes\n        -----\n        The file will be opened and the header appended to the end of\n        the file.  If the file does not already exist, it will be\n        created, and if the header represents a Primary header, it\n        will be written to the beginning of the file.  If the file\n        does not exist and the provided header is not a Primary\n        header, a default Primary HDU will be inserted at the\n        beginning of the file and the provided header will be added as\n        the first extension.  If the file does already exist, but the\n        provided header represents a Primary header, the header will\n        be modified to an image extension header and appended to the\n        end of the file.\n        \"\"\"\n\n        if isinstance(name, gzip.GzipFile):\n            raise TypeError('StreamingHDU not supported for GzipFile objects.')\n\n        self._header = header.copy()\n\n        # handle a file object instead of a file name\n        filename = fileobj_name(name) or ''\n\n        # Check if the file already exists.  If it does not, check to see\n        # if we were provided with a Primary Header.  If not we will need\n        # to prepend a default PrimaryHDU to the file before writing the\n        # given header.\n\n        newfile = False\n\n        if filename:\n            if not os.path.exists(filename) or os.path.getsize(filename) == 0:\n                newfile = True\n        elif (hasattr(name, 'len') and name.len == 0):\n            newfile = True\n\n        if newfile:\n            if 'SIMPLE' not in self._header:\n                hdulist = HDUList([PrimaryHDU()])\n                hdulist.writeto(name, 'exception')\n        else:\n\n            # This will not be the first extension in the file so we\n            # must change the Primary header provided into an image\n            # extension header.\n\n            if 'SIMPLE' in self._header:\n                self._header.set('XTENSION', 'IMAGE', 'Image extension',\n                                 after='SIMPLE')\n                del self._header['SIMPLE']\n\n                if 'PCOUNT' not in self._header:\n                    dim = self._header['NAXIS']\n\n                    if dim == 0:\n                        dim = ''\n                    else:\n                        dim = str(dim)\n\n                    self._header.set('PCOUNT', 0, 'number of parameters',\n                                     after='NAXIS' + dim)\n\n                if 'GCOUNT' not in self._header:\n                    self._header.set('GCOUNT', 1, 'number of groups',\n                                     after='PCOUNT')\n\n        self._ffo = _File(name, 'append')\n\n        # TODO : Fix this once the HDU writing API is cleaned up\n        tmp_hdu = _BaseHDU()\n        # Passing self._header as an argument to _BaseHDU() will cause its\n        # values to be modified in undesired ways...need to have a better way\n        # of doing this\n        tmp_hdu._header = self._header\n        self._header_offset = tmp_hdu._writeheader(self._ffo)[0]\n        self._data_offset = self._ffo.tell()\n        self._size = self.size\n\n        if self._size != 0:\n            self.writecomplete = False\n        else:\n            self.writecomplete = True\n\n    # Support the 'with' statement\n    def __enter__(self):\n        return self\n\n    def __exit__(self, type, value, traceback):\n        self.close()\n\n    def write(self, data):\n        \"\"\"\n        Write the given data to the stream.\n\n        Parameters\n        ----------\n        data : ndarray\n            Data to stream to the file.\n\n        Returns\n        -------\n        writecomplete : int\n            Flag that when `True` indicates that all of the required\n            data has been written to the stream.\n\n        Notes\n        -----\n        Only the amount of data specified in the header provided to the class\n        constructor may be written to the stream.  If the provided data would\n        cause the stream to overflow, an `OSError` exception is\n        raised and the data is not written. Once sufficient data has been\n        written to the stream to satisfy the amount specified in the header,\n        the stream is padded to fill a complete FITS block and no more data\n        will be accepted. An attempt to write more data after the stream has\n        been filled will raise an `OSError` exception. If the\n        dtype of the input data does not match what is expected by the header,\n        a `TypeError` exception is raised.\n        \"\"\"\n\n        size = self._ffo.tell() - self._data_offset\n\n        if self.writecomplete or size + data.nbytes > self._size:\n            raise OSError('Attempt to write more data to the stream than the '\n                          'header specified.')\n\n        if BITPIX2DTYPE[self._header['BITPIX']] != data.dtype.name:\n            raise TypeError('Supplied data does not match the type specified '\n                            'in the header.')\n\n        if data.dtype.str[0] != '>':\n            # byteswap little endian arrays before writing\n            output = data.byteswap()\n        else:\n            output = data\n\n        self._ffo.writearray(output)\n\n        if self._ffo.tell() - self._data_offset == self._size:\n            # the stream is full so pad the data to the next FITS block\n            self._ffo.write(_pad_length(self._size) * '\\0')\n            self.writecomplete = True\n\n        self._ffo.flush()\n\n        return self.writecomplete\n\n    @property\n    def size(self):\n        \"\"\"\n        Return the size (in bytes) of the data portion of the HDU.\n        \"\"\"\n\n        size = 0\n        naxis = self._header.get('NAXIS', 0)\n\n        if naxis > 0:\n            simple = self._header.get('SIMPLE', 'F')\n            random_groups = self._header.get('GROUPS', 'F')\n\n            if simple == 'T' and random_groups == 'T':\n                groups = 1\n            else:\n                groups = 0\n\n            size = 1\n\n            for idx in range(groups, naxis):\n                size = size * self._header['NAXIS' + str(idx + 1)]\n            bitpix = self._header['BITPIX']\n            gcount = self._header.get('GCOUNT', 1)\n            pcount = self._header.get('PCOUNT', 0)\n            size = abs(bitpix) * gcount * (pcount + size) // 8\n        return size\n\n    def close(self):\n        \"\"\"\n        Close the physical FITS file.\n        \"\"\"\n\n        self._ffo.close()"},{"col":0,"comment":"\n    Update the specified HDU with the input data/header.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        File to update.  If opened, mode must be update (rb+).  An opened file\n        object or `~gzip.GzipFile` object will be closed upon return.\n\n    data : array, `~astropy.table.Table`, or `~astropy.io.fits.Group`\n        The new data used for updating.\n\n    header : `Header` object, optional\n        The header associated with ``data``.  If `None`, an appropriate header\n        will be created for the data object supplied.\n\n    ext, extname, extver\n        The rest of the arguments are flexible: the 3rd argument can be the\n        header associated with the data.  If the 3rd argument is not a\n        `Header`, it (and other positional arguments) are assumed to be the\n        HDU specification(s).  Header and HDU specs can also be\n        keyword arguments.  For example::\n\n            update(file, dat, hdr, 'sci')  # update the 'sci' extension\n            update(file, dat, 3)  # update the 3rd extension HDU\n            update(file, dat, hdr, 3)  # update the 3rd extension HDU\n            update(file, dat, 'sci', 2)  # update the 2nd extension HDU named 'sci'\n            update(file, dat, 3, header=hdr)  # update the 3rd extension HDU\n            update(file, dat, header=hdr, ext=5)  # update the 5th extension HDU\n\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n    ","endLoc":750,"header":"def update(filename, data, *args, **kwargs)","id":2536,"name":"update","nodeType":"Function","startLoc":694,"text":"def update(filename, data, *args, **kwargs):\n    \"\"\"\n    Update the specified HDU with the input data/header.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        File to update.  If opened, mode must be update (rb+).  An opened file\n        object or `~gzip.GzipFile` object will be closed upon return.\n\n    data : array, `~astropy.table.Table`, or `~astropy.io.fits.Group`\n        The new data used for updating.\n\n    header : `Header` object, optional\n        The header associated with ``data``.  If `None`, an appropriate header\n        will be created for the data object supplied.\n\n    ext, extname, extver\n        The rest of the arguments are flexible: the 3rd argument can be the\n        header associated with the data.  If the 3rd argument is not a\n        `Header`, it (and other positional arguments) are assumed to be the\n        HDU specification(s).  Header and HDU specs can also be\n        keyword arguments.  For example::\n\n            update(file, dat, hdr, 'sci')  # update the 'sci' extension\n            update(file, dat, 3)  # update the 3rd extension HDU\n            update(file, dat, hdr, 3)  # update the 3rd extension HDU\n            update(file, dat, 'sci', 2)  # update the 2nd extension HDU named 'sci'\n            update(file, dat, 3, header=hdr)  # update the 3rd extension HDU\n            update(file, dat, header=hdr, ext=5)  # update the 5th extension HDU\n\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n    \"\"\"\n\n    # The arguments to this function are a bit trickier to deal with than others\n    # in this module, since the documentation has promised that the header\n    # argument can be an optional positional argument.\n    if args and isinstance(args[0], Header):\n        header = args[0]\n        args = args[1:]\n    else:\n        header = None\n    # The header can also be a keyword argument--if both are provided the\n    # keyword takes precedence\n    header = kwargs.pop('header', header)\n\n    new_hdu = _makehdu(data, header)\n\n    closed = fileobj_closed(filename)\n\n    hdulist, _ext = _getext(filename, 'update', *args, **kwargs)\n    try:\n        hdulist[_ext] = new_hdu\n    finally:\n        hdulist.close(closed=closed)"},{"col":4,"comment":"\n        Construct a `StreamingHDU` object given a file name and a header.\n\n        Parameters\n        ----------\n        name : path-like or file-like\n            The file to which the header and data will be streamed. If opened,\n            the file object must be opened in a writeable binary mode such as\n            'wb' or 'ab+'.\n\n        header : `Header` instance\n            The header object associated with the data to be written\n            to the file.\n\n        Notes\n        -----\n        The file will be opened and the header appended to the end of\n        the file.  If the file does not already exist, it will be\n        created, and if the header represents a Primary header, it\n        will be written to the beginning of the file.  If the file\n        does not exist and the provided header is not a Primary\n        header, a default Primary HDU will be inserted at the\n        beginning of the file and the provided header will be added as\n        the first extension.  If the file does already exist, but the\n        provided header represents a Primary header, the header will\n        be modified to an image extension header and appended to the\n        end of the file.\n        ","endLoc":131,"header":"def __init__(self, name, header)","id":2537,"name":"__init__","nodeType":"Function","startLoc":35,"text":"def __init__(self, name, header):\n        \"\"\"\n        Construct a `StreamingHDU` object given a file name and a header.\n\n        Parameters\n        ----------\n        name : path-like or file-like\n            The file to which the header and data will be streamed. If opened,\n            the file object must be opened in a writeable binary mode such as\n            'wb' or 'ab+'.\n\n        header : `Header` instance\n            The header object associated with the data to be written\n            to the file.\n\n        Notes\n        -----\n        The file will be opened and the header appended to the end of\n        the file.  If the file does not already exist, it will be\n        created, and if the header represents a Primary header, it\n        will be written to the beginning of the file.  If the file\n        does not exist and the provided header is not a Primary\n        header, a default Primary HDU will be inserted at the\n        beginning of the file and the provided header will be added as\n        the first extension.  If the file does already exist, but the\n        provided header represents a Primary header, the header will\n        be modified to an image extension header and appended to the\n        end of the file.\n        \"\"\"\n\n        if isinstance(name, gzip.GzipFile):\n            raise TypeError('StreamingHDU not supported for GzipFile objects.')\n\n        self._header = header.copy()\n\n        # handle a file object instead of a file name\n        filename = fileobj_name(name) or ''\n\n        # Check if the file already exists.  If it does not, check to see\n        # if we were provided with a Primary Header.  If not we will need\n        # to prepend a default PrimaryHDU to the file before writing the\n        # given header.\n\n        newfile = False\n\n        if filename:\n            if not os.path.exists(filename) or os.path.getsize(filename) == 0:\n                newfile = True\n        elif (hasattr(name, 'len') and name.len == 0):\n            newfile = True\n\n        if newfile:\n            if 'SIMPLE' not in self._header:\n                hdulist = HDUList([PrimaryHDU()])\n                hdulist.writeto(name, 'exception')\n        else:\n\n            # This will not be the first extension in the file so we\n            # must change the Primary header provided into an image\n            # extension header.\n\n            if 'SIMPLE' in self._header:\n                self._header.set('XTENSION', 'IMAGE', 'Image extension',\n                                 after='SIMPLE')\n                del self._header['SIMPLE']\n\n                if 'PCOUNT' not in self._header:\n                    dim = self._header['NAXIS']\n\n                    if dim == 0:\n                        dim = ''\n                    else:\n                        dim = str(dim)\n\n                    self._header.set('PCOUNT', 0, 'number of parameters',\n                                     after='NAXIS' + dim)\n\n                if 'GCOUNT' not in self._header:\n                    self._header.set('GCOUNT', 1, 'number of groups',\n                                     after='PCOUNT')\n\n        self._ffo = _File(name, 'append')\n\n        # TODO : Fix this once the HDU writing API is cleaned up\n        tmp_hdu = _BaseHDU()\n        # Passing self._header as an argument to _BaseHDU() will cause its\n        # values to be modified in undesired ways...need to have a better way\n        # of doing this\n        tmp_hdu._header = self._header\n        self._header_offset = tmp_hdu._writeheader(self._ffo)[0]\n        self._data_offset = self._ffo.tell()\n        self._size = self.size\n\n        if self._size != 0:\n            self.writecomplete = False\n        else:\n            self.writecomplete = True"},{"col":4,"comment":"\n        __array_wrap__ is called at the end of every ufunc.\n\n        Normally, we want a Column object back and do not have to do anything\n        special. But there are two exceptions:\n\n        1) If the output shape is different (e.g. for reduction ufuncs\n           like sum() or mean()), a Column still linking to a parent_table\n           makes little sense, so we return the output viewed as the\n           column content (ndarray or MaskedArray).\n           For this case, we use \"[()]\" to select everything, and to ensure we\n           convert a zero rank array to a scalar. (For some reason np.sum()\n           returns a zero rank scalar array while np.mean() returns a scalar;\n           So the [()] is needed for this case.\n\n        2) When the output is created by any function that returns a boolean\n           we also want to consistently return an array rather than a column\n           (see #1446 and #1685)\n        ","endLoc":614,"header":"def __array_wrap__(self, out_arr, context=None)","id":2538,"name":"__array_wrap__","nodeType":"Function","startLoc":587,"text":"def __array_wrap__(self, out_arr, context=None):\n        \"\"\"\n        __array_wrap__ is called at the end of every ufunc.\n\n        Normally, we want a Column object back and do not have to do anything\n        special. But there are two exceptions:\n\n        1) If the output shape is different (e.g. for reduction ufuncs\n           like sum() or mean()), a Column still linking to a parent_table\n           makes little sense, so we return the output viewed as the\n           column content (ndarray or MaskedArray).\n           For this case, we use \"[()]\" to select everything, and to ensure we\n           convert a zero rank array to a scalar. (For some reason np.sum()\n           returns a zero rank scalar array while np.mean() returns a scalar;\n           So the [()] is needed for this case.\n\n        2) When the output is created by any function that returns a boolean\n           we also want to consistently return an array rather than a column\n           (see #1446 and #1685)\n        \"\"\"\n        out_arr = super().__array_wrap__(out_arr, context)\n        if (self.shape != out_arr.shape\n            or (isinstance(out_arr, BaseColumn)\n                and (context is not None\n                     and context[0] in _comparison_functions))):\n            return out_arr.data[()]\n        else:\n            return out_arr"},{"col":4,"comment":"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        ","endLoc":806,"header":"def _calculate_datasum(self)","id":2539,"name":"_calculate_datasum","nodeType":"Function","startLoc":784,"text":"def _calculate_datasum(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        \"\"\"\n\n        if self._has_data:\n            # We have the data to be used.\n            # We need to pad the data to a block length before calculating\n            # the datasum.\n            bytes_array = self.data.view(type=np.ndarray, dtype=np.ubyte)\n            padding = np.frombuffer(_pad_length(self.size) * b' ',\n                                    dtype=np.ubyte)\n\n            d = np.append(bytes_array, padding)\n\n            cs = self._compute_checksum(d)\n            return cs\n        else:\n            # This is the case where the data has not been read from the file\n            # yet.  We can handle that in a generic manner so we do it in the\n            # base class.  The other possibility is that there is no data at\n            # all.  This can also be handled in a generic manner.\n            return super()._calculate_datasum()"},{"col":4,"comment":"\n        The name of this column.\n        ","endLoc":621,"header":"@property\n    def name(self)","id":2540,"name":"name","nodeType":"Function","startLoc":616,"text":"@property\n    def name(self):\n        \"\"\"\n        The name of this column.\n        \"\"\"\n        return self._name"},{"col":4,"comment":"null","endLoc":632,"header":"@name.setter\n    def name(self, val)","id":2541,"name":"name","nodeType":"Function","startLoc":623,"text":"@name.setter\n    def name(self, val):\n        if val is not None:\n            val = str(val)\n\n        if self.parent_table is not None:\n            table = self.parent_table\n            table.columns._rename_column(self.name, val)\n\n        self._name = val"},{"col":4,"comment":"\n        Format string for displaying values in this column.\n        ","endLoc":640,"header":"@property\n    def format(self)","id":2542,"name":"format","nodeType":"Function","startLoc":634,"text":"@property\n    def format(self):\n        \"\"\"\n        Format string for displaying values in this column.\n        \"\"\"\n\n        return self._format"},{"col":4,"comment":"null","endLoc":658,"header":"@format.setter\n    def format(self, format_string)","id":2543,"name":"format","nodeType":"Function","startLoc":642,"text":"@format.setter\n    def format(self, format_string):\n\n        prev_format = getattr(self, '_format', None)\n\n        self._format = format_string  # set new format string\n\n        try:\n            # test whether it formats without error exemplarily\n            self.pformat(max_lines=1)\n        except Exception as err:\n            # revert to restore previous format if there was one\n            self._format = prev_format\n            raise ValueError(\n                \"Invalid format for column '{}': could not display \"\n                \"values in this column using this format\".format(\n                    self.name)) from err"},{"col":4,"comment":"Return a list of formatted string representation of column values.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default will be\n        determined using the ``astropy.conf.max_lines`` configuration\n        item. If a negative value of ``max_lines`` is supplied then\n        there is no line limit applied.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum lines of output (header + data rows)\n\n        show_name : bool\n            Include column name. Default is True.\n\n        show_unit : bool\n            Include a header row for unit. Default is False.\n\n        show_dtype : bool\n            Include column dtype. Default is False.\n\n        html : bool\n            Format the output as an HTML table. Default is False.\n\n        Returns\n        -------\n        lines : list\n            List of lines with header and formatted column values\n\n        ","endLoc":753,"header":"def pformat(self, max_lines=None, show_name=True, show_unit=False, show_dtype=False,\n                html=False)","id":2544,"name":"pformat","nodeType":"Function","startLoc":715,"text":"def pformat(self, max_lines=None, show_name=True, show_unit=False, show_dtype=False,\n                html=False):\n        \"\"\"Return a list of formatted string representation of column values.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default will be\n        determined using the ``astropy.conf.max_lines`` configuration\n        item. If a negative value of ``max_lines`` is supplied then\n        there is no line limit applied.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum lines of output (header + data rows)\n\n        show_name : bool\n            Include column name. Default is True.\n\n        show_unit : bool\n            Include a header row for unit. Default is False.\n\n        show_dtype : bool\n            Include column dtype. Default is False.\n\n        html : bool\n            Format the output as an HTML table. Default is False.\n\n        Returns\n        -------\n        lines : list\n            List of lines with header and formatted column values\n\n        \"\"\"\n        _pformat_col = self._formatter._pformat_col\n        lines, outs = _pformat_col(self, max_lines, show_name=show_name,\n                                   show_unit=show_unit, show_dtype=show_dtype,\n                                   html=html)\n        return lines"},{"col":4,"comment":"Array-interface compliant full description of the column.\n\n        This returns a 3-tuple (name, type, shape) that can always be\n        used in a structured array dtype definition.\n        ","endLoc":667,"header":"@property\n    def descr(self)","id":2545,"name":"descr","nodeType":"Function","startLoc":660,"text":"@property\n    def descr(self):\n        \"\"\"Array-interface compliant full description of the column.\n\n        This returns a 3-tuple (name, type, shape) that can always be\n        used in a structured array dtype definition.\n        \"\"\"\n        return (self.name, self.dtype.str, self.shape[1:])"},{"col":4,"comment":"\n        Return an iterator that yields the string-formatted values of this\n        column.\n\n        Returns\n        -------\n        str_vals : iterator\n            Column values formatted as strings\n        ","endLoc":684,"header":"def iter_str_vals(self)","id":2546,"name":"iter_str_vals","nodeType":"Function","startLoc":669,"text":"def iter_str_vals(self):\n        \"\"\"\n        Return an iterator that yields the string-formatted values of this\n        column.\n\n        Returns\n        -------\n        str_vals : iterator\n            Column values formatted as strings\n        \"\"\"\n        # Iterate over formatted values with no max number of lines, no column\n        # name, no unit, and ignoring the returned header info in outs.\n        _pformat_col_iter = self._formatter._pformat_col_iter\n        for str_val in _pformat_col_iter(self, -1, show_name=False, show_unit=False,\n                                         show_dtype=False, outs={}):\n            yield str_val"},{"col":4,"comment":"\n        `TableHDU` verify method.\n        ","endLoc":819,"header":"def _verify(self, option='warn')","id":2547,"name":"_verify","nodeType":"Function","startLoc":808,"text":"def _verify(self, option='warn'):\n        \"\"\"\n        `TableHDU` verify method.\n        \"\"\"\n\n        errs = super()._verify(option=option)\n        self.req_cards('PCOUNT', None, lambda v: (v == 0), 0, option, errs)\n        tfields = self._header['TFIELDS']\n        for idx in range(tfields):\n            self.req_cards('TBCOL' + str(idx + 1), None, _is_int, None, option,\n                           errs)\n        return errs"},{"col":4,"comment":"Compare the column attributes of ``col`` to this object.\n\n        The comparison attributes are: ``name``, ``unit``, ``dtype``,\n        ``format``, ``description``, and ``meta``.\n\n        Parameters\n        ----------\n        col : Column\n            Comparison column\n\n        Returns\n        -------\n        equal : bool\n            True if all attributes are equal\n        ","endLoc":709,"header":"def attrs_equal(self, col)","id":2548,"name":"attrs_equal","nodeType":"Function","startLoc":686,"text":"def attrs_equal(self, col):\n        \"\"\"Compare the column attributes of ``col`` to this object.\n\n        The comparison attributes are: ``name``, ``unit``, ``dtype``,\n        ``format``, ``description``, and ``meta``.\n\n        Parameters\n        ----------\n        col : Column\n            Comparison column\n\n        Returns\n        -------\n        equal : bool\n            True if all attributes are equal\n        \"\"\"\n        if not isinstance(col, BaseColumn):\n            raise ValueError('Comparison `col` must be a Column or '\n                             'MaskedColumn object')\n\n        attrs = ('name', 'unit', 'dtype', 'format', 'description', 'meta')\n        equal = all(getattr(self, x) == getattr(col, x) for x in attrs)\n\n        return equal"},{"col":0,"comment":"\n    Print the summary information on a FITS file.\n\n    This includes the name, type, length of header, data shape and type\n    for each HDU.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        FITS file to obtain info from.  If opened, mode must be one of\n        the following: rb, rb+, or ab+ (i.e. the file must be readable).\n\n    output : file, bool, optional\n        A file-like object to write the output to.  If ``False``, does not\n        output to a file and instead returns a list of tuples representing the\n        HDU info.  Writes to ``sys.stdout`` by default.\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n        *Note:* This function sets ``ignore_missing_end=True`` by default.\n    ","endLoc":788,"header":"def info(filename, output=None, **kwargs)","id":2549,"name":"info","nodeType":"Function","startLoc":753,"text":"def info(filename, output=None, **kwargs):\n    \"\"\"\n    Print the summary information on a FITS file.\n\n    This includes the name, type, length of header, data shape and type\n    for each HDU.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        FITS file to obtain info from.  If opened, mode must be one of\n        the following: rb, rb+, or ab+ (i.e. the file must be readable).\n\n    output : file, bool, optional\n        A file-like object to write the output to.  If ``False``, does not\n        output to a file and instead returns a list of tuples representing the\n        HDU info.  Writes to ``sys.stdout`` by default.\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n        *Note:* This function sets ``ignore_missing_end=True`` by default.\n    \"\"\"\n\n    mode, closed = _get_file_mode(filename, default='readonly')\n    # Set the default value for the ignore_missing_end parameter\n    if 'ignore_missing_end' not in kwargs:\n        kwargs['ignore_missing_end'] = True\n\n    f = fitsopen(filename, mode=mode, **kwargs)\n    try:\n        ret = f.info(output=output)\n    finally:\n        if closed:\n            f.close()\n\n    return ret"},{"col":4,"comment":"null","endLoc":713,"header":"@property\n    def _formatter(self)","id":2550,"name":"_formatter","nodeType":"Function","startLoc":711,"text":"@property\n    def _formatter(self):\n        return FORMATTER if (self.parent_table is None) else self.parent_table.formatter"},{"col":4,"comment":"Print a formatted string representation of column values.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default will be\n        determined using the ``astropy.conf.max_lines`` configuration\n        item. If a negative value of ``max_lines`` is supplied then\n        there is no line limit applied.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum number of values in output\n\n        show_name : bool\n            Include column name. Default is True.\n\n        show_unit : bool\n            Include a header row for unit. Default is False.\n\n        show_dtype : bool\n            Include column dtype. Default is True.\n        ","endLoc":788,"header":"def pprint(self, max_lines=None, show_name=True, show_unit=False, show_dtype=False)","id":2551,"name":"pprint","nodeType":"Function","startLoc":755,"text":"def pprint(self, max_lines=None, show_name=True, show_unit=False, show_dtype=False):\n        \"\"\"Print a formatted string representation of column values.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default will be\n        determined using the ``astropy.conf.max_lines`` configuration\n        item. If a negative value of ``max_lines`` is supplied then\n        there is no line limit applied.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum number of values in output\n\n        show_name : bool\n            Include column name. Default is True.\n\n        show_unit : bool\n            Include a header row for unit. Default is False.\n\n        show_dtype : bool\n            Include column dtype. Default is True.\n        \"\"\"\n        _pformat_col = self._formatter._pformat_col\n        lines, outs = _pformat_col(self, max_lines, show_name=show_name, show_unit=show_unit,\n                                   show_dtype=show_dtype)\n\n        n_header = outs['n_header']\n        for i, line in enumerate(lines):\n            if i < n_header:\n                color_print(line, 'red')\n            else:\n                print(line)"},{"col":4,"comment":"Interactively browse column with a paging interface.\n\n        Supported keys::\n\n          f, <space> : forward one page\n          b : back one page\n          r : refresh same page\n          n : next row\n          p : previous row\n          < : go to beginning\n          > : go to end\n          q : quit browsing\n          h : print this help\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum number of lines in table output.\n\n        show_name : bool\n            Include a header row for column names. Default is True.\n\n        show_unit : bool\n            Include a header row for unit. Default is False.\n\n        ","endLoc":819,"header":"def more(self, max_lines=None, show_name=True, show_unit=False)","id":2552,"name":"more","nodeType":"Function","startLoc":790,"text":"def more(self, max_lines=None, show_name=True, show_unit=False):\n        \"\"\"Interactively browse column with a paging interface.\n\n        Supported keys::\n\n          f, <space> : forward one page\n          b : back one page\n          r : refresh same page\n          n : next row\n          p : previous row\n          < : go to beginning\n          > : go to end\n          q : quit browsing\n          h : print this help\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum number of lines in table output.\n\n        show_name : bool\n            Include a header row for column names. Default is True.\n\n        show_unit : bool\n            Include a header row for unit. Default is False.\n\n        \"\"\"\n        _more_tabcol = self._formatter._more_tabcol\n        _more_tabcol(self, max_lines=max_lines, show_name=show_name,\n                     show_unit=show_unit)"},{"col":4,"comment":"\n        The unit associated with this column.  May be a string or a\n        `astropy.units.UnitBase` instance.\n\n        Setting the ``unit`` property does not change the values of the\n        data.  To perform a unit conversion, use ``convert_unit_to``.\n        ","endLoc":830,"header":"@property\n    def unit(self)","id":2553,"name":"unit","nodeType":"Function","startLoc":821,"text":"@property\n    def unit(self):\n        \"\"\"\n        The unit associated with this column.  May be a string or a\n        `astropy.units.UnitBase` instance.\n\n        Setting the ``unit`` property does not change the values of the\n        data.  To perform a unit conversion, use ``convert_unit_to``.\n        \"\"\"\n        return self._unit"},{"col":4,"comment":"null","endLoc":837,"header":"@unit.setter\n    def unit(self, unit)","id":2554,"name":"unit","nodeType":"Function","startLoc":832,"text":"@unit.setter\n    def unit(self, unit):\n        if unit is None:\n            self._unit = None\n        else:\n            self._unit = Unit(unit, parse_strict='silent')"},{"col":4,"comment":"null","endLoc":841,"header":"@unit.deleter\n    def unit(self)","id":2555,"name":"unit","nodeType":"Function","startLoc":839,"text":"@unit.deleter\n    def unit(self):\n        self._unit = None"},{"col":4,"comment":"null","endLoc":852,"header":"def searchsorted(self, v, side='left', sorter=None)","id":2556,"name":"searchsorted","nodeType":"Function","startLoc":843,"text":"def searchsorted(self, v, side='left', sorter=None):\n        # For bytes type data, encode the `v` value as UTF-8 (if necessary) before\n        # calling searchsorted. This prevents a factor of 1000 slowdown in\n        # searchsorted in this case.\n        a = self.data\n        if a.dtype.kind == 'S' and not isinstance(v, bytes):\n            v = np.asarray(v)\n            if v.dtype.kind == 'U':\n                v = np.char.encode(v, 'utf-8')\n        return np.searchsorted(a, v, side=side, sorter=sorter)"},{"col":4,"comment":"\n        Converts the values of the column in-place from the current\n        unit to the given unit.\n\n        To change the unit associated with this column without\n        actually changing the data values, simply set the ``unit``\n        property.\n\n        Parameters\n        ----------\n        new_unit : str or `astropy.units.UnitBase` instance\n            The unit to convert to.\n\n        equivalencies : list of tuple\n           A list of equivalence pairs to try if the unit are not\n           directly convertible.  See :ref:`astropy:unit_equivalencies`.\n\n        Raises\n        ------\n        astropy.units.UnitsError\n            If units are inconsistent\n        ","endLoc":882,"header":"def convert_unit_to(self, new_unit, equivalencies=[])","id":2557,"name":"convert_unit_to","nodeType":"Function","startLoc":855,"text":"def convert_unit_to(self, new_unit, equivalencies=[]):\n        \"\"\"\n        Converts the values of the column in-place from the current\n        unit to the given unit.\n\n        To change the unit associated with this column without\n        actually changing the data values, simply set the ``unit``\n        property.\n\n        Parameters\n        ----------\n        new_unit : str or `astropy.units.UnitBase` instance\n            The unit to convert to.\n\n        equivalencies : list of tuple\n           A list of equivalence pairs to try if the unit are not\n           directly convertible.  See :ref:`astropy:unit_equivalencies`.\n\n        Raises\n        ------\n        astropy.units.UnitsError\n            If units are inconsistent\n        \"\"\"\n        if self.unit is None:\n            raise ValueError(\"No unit set on column\")\n        self.data[:] = self.unit.to(\n            new_unit, self.data, equivalencies=equivalencies)\n        self.unit = new_unit"},{"col":0,"comment":"\n    Compare two parts of a FITS file, including entire FITS files,\n    FITS `HDUList` objects and FITS ``HDU`` objects.\n\n    Parameters\n    ----------\n    inputa : str, `HDUList` object, or ``HDU`` object\n        The filename of a FITS file, `HDUList`, or ``HDU``\n        object to compare to ``inputb``.\n\n    inputb : str, `HDUList` object, or ``HDU`` object\n        The filename of a FITS file, `HDUList`, or ``HDU``\n        object to compare to ``inputa``.\n\n    ext, extname, extver\n        Additional positional arguments are for HDU specification if your\n        inputs are string filenames (will not work if\n        ``inputa`` and ``inputb`` are ``HDU`` objects or `HDUList` objects).\n        They are flexible and are best illustrated by examples.  In addition\n        to using these arguments positionally you can directly call the\n        keyword parameters ``ext``, ``extname``.\n\n        By HDU number::\n\n            printdiff('inA.fits', 'inB.fits', 0)      # the primary HDU\n            printdiff('inA.fits', 'inB.fits', 2)      # the second extension HDU\n            printdiff('inA.fits', 'inB.fits', ext=2)  # the second extension HDU\n\n        By name, i.e., ``EXTNAME`` value (if unique). ``EXTNAME`` values are\n        not case sensitive:\n\n            printdiff('inA.fits', 'inB.fits', 'sci')\n            printdiff('inA.fits', 'inB.fits', extname='sci')  # equivalent\n\n        By combination of ``EXTNAME`` and ``EXTVER`` as separate\n        arguments or as a tuple::\n\n            printdiff('inA.fits', 'inB.fits', 'sci', 2)    # EXTNAME='SCI'\n                                                           # & EXTVER=2\n            printdiff('inA.fits', 'inB.fits', extname='sci', extver=2)\n                                                           # equivalent\n            printdiff('inA.fits', 'inB.fits', ('sci', 2))  # equivalent\n\n        Ambiguous or conflicting specifications will raise an exception::\n\n            printdiff('inA.fits', 'inB.fits',\n                      ext=('sci', 1), extname='err', extver=2)\n\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `~astropy.io.fits.FITSDiff`.\n\n    Notes\n    -----\n    The primary use for the `printdiff` function is to allow quick print out\n    of a FITS difference report and will write to ``sys.stdout``.\n    To save the diff report to a file please use `~astropy.io.fits.FITSDiff`\n    directly.\n    ","endLoc":897,"header":"def printdiff(inputa, inputb, *args, **kwargs)","id":2558,"name":"printdiff","nodeType":"Function","startLoc":791,"text":"def printdiff(inputa, inputb, *args, **kwargs):\n    \"\"\"\n    Compare two parts of a FITS file, including entire FITS files,\n    FITS `HDUList` objects and FITS ``HDU`` objects.\n\n    Parameters\n    ----------\n    inputa : str, `HDUList` object, or ``HDU`` object\n        The filename of a FITS file, `HDUList`, or ``HDU``\n        object to compare to ``inputb``.\n\n    inputb : str, `HDUList` object, or ``HDU`` object\n        The filename of a FITS file, `HDUList`, or ``HDU``\n        object to compare to ``inputa``.\n\n    ext, extname, extver\n        Additional positional arguments are for HDU specification if your\n        inputs are string filenames (will not work if\n        ``inputa`` and ``inputb`` are ``HDU`` objects or `HDUList` objects).\n        They are flexible and are best illustrated by examples.  In addition\n        to using these arguments positionally you can directly call the\n        keyword parameters ``ext``, ``extname``.\n\n        By HDU number::\n\n            printdiff('inA.fits', 'inB.fits', 0)      # the primary HDU\n            printdiff('inA.fits', 'inB.fits', 2)      # the second extension HDU\n            printdiff('inA.fits', 'inB.fits', ext=2)  # the second extension HDU\n\n        By name, i.e., ``EXTNAME`` value (if unique). ``EXTNAME`` values are\n        not case sensitive:\n\n            printdiff('inA.fits', 'inB.fits', 'sci')\n            printdiff('inA.fits', 'inB.fits', extname='sci')  # equivalent\n\n        By combination of ``EXTNAME`` and ``EXTVER`` as separate\n        arguments or as a tuple::\n\n            printdiff('inA.fits', 'inB.fits', 'sci', 2)    # EXTNAME='SCI'\n                                                           # & EXTVER=2\n            printdiff('inA.fits', 'inB.fits', extname='sci', extver=2)\n                                                           # equivalent\n            printdiff('inA.fits', 'inB.fits', ('sci', 2))  # equivalent\n\n        Ambiguous or conflicting specifications will raise an exception::\n\n            printdiff('inA.fits', 'inB.fits',\n                      ext=('sci', 1), extname='err', extver=2)\n\n    **kwargs\n        Any additional keyword arguments to be passed to\n        `~astropy.io.fits.FITSDiff`.\n\n    Notes\n    -----\n    The primary use for the `printdiff` function is to allow quick print out\n    of a FITS difference report and will write to ``sys.stdout``.\n    To save the diff report to a file please use `~astropy.io.fits.FITSDiff`\n    directly.\n    \"\"\"\n\n    # Pop extension keywords\n    extension = {key: kwargs.pop(key) for key in ['ext', 'extname', 'extver']\n                 if key in kwargs}\n    has_extensions = args or extension\n\n    if isinstance(inputa, str) and has_extensions:\n        # Use handy _getext to interpret any ext keywords, but\n        # will need to close a if  fails\n        modea, closeda = _get_file_mode(inputa)\n        modeb, closedb = _get_file_mode(inputb)\n\n        hdulista, extidxa = _getext(inputa, modea, *args, **extension)\n        # Have to close a if b doesn't make it\n        try:\n            hdulistb, extidxb = _getext(inputb, modeb, *args, **extension)\n        except Exception:\n            hdulista.close(closed=closeda)\n            raise\n\n        try:\n            hdua = hdulista[extidxa]\n            hdub = hdulistb[extidxb]\n            # See below print for note\n            print(HDUDiff(hdua, hdub, **kwargs).report())\n\n        finally:\n            hdulista.close(closed=closeda)\n            hdulistb.close(closed=closedb)\n\n    # If input is not a string, can feed HDU objects or HDUList directly,\n    # but can't currently handle extensions\n    elif isinstance(inputa, _ValidHDU) and has_extensions:\n        raise ValueError(\"Cannot use extension keywords when providing an \"\n                         \"HDU object.\")\n\n    elif isinstance(inputa, _ValidHDU) and not has_extensions:\n        print(HDUDiff(inputa, inputb, **kwargs).report())\n\n    elif isinstance(inputa, HDUList) and has_extensions:\n        raise NotImplementedError(\"Extension specification with HDUList \"\n                                  \"objects not implemented.\")\n\n    # This function is EXCLUSIVELY for printing the diff report to screen\n    # in a one-liner call, hence the use of print instead of logging\n    else:\n        print(FITSDiff(inputa, inputb, **kwargs).report())"},{"col":4,"comment":"null","endLoc":888,"header":"@property\n    def groups(self)","id":2559,"name":"groups","nodeType":"Function","startLoc":884,"text":"@property\n    def groups(self):\n        if not hasattr(self, '_groups'):\n            self._groups = groups.ColumnGroups(self)\n        return self._groups"},{"col":4,"comment":"\n        Group this column by the specified ``keys``\n\n        This effectively splits the column into groups which correspond to\n        unique values of the ``keys`` grouping object.  The output is a new\n        `Column` or `MaskedColumn` which contains a copy of this column but\n        sorted by row according to ``keys``.\n\n        The ``keys`` input to ``group_by`` must be a numpy array with the\n        same length as this column.\n\n        Parameters\n        ----------\n        keys : numpy array\n            Key grouping object\n\n        Returns\n        -------\n        out : Column\n            New column with groups attribute set accordingly\n        ","endLoc":912,"header":"def group_by(self, keys)","id":2560,"name":"group_by","nodeType":"Function","startLoc":890,"text":"def group_by(self, keys):\n        \"\"\"\n        Group this column by the specified ``keys``\n\n        This effectively splits the column into groups which correspond to\n        unique values of the ``keys`` grouping object.  The output is a new\n        `Column` or `MaskedColumn` which contains a copy of this column but\n        sorted by row according to ``keys``.\n\n        The ``keys`` input to ``group_by`` must be a numpy array with the\n        same length as this column.\n\n        Parameters\n        ----------\n        keys : numpy array\n            Key grouping object\n\n        Returns\n        -------\n        out : Column\n            New column with groups attribute set accordingly\n        \"\"\"\n        return groups.column_group_by(self, keys)"},{"col":0,"comment":"\n    Get groups for ``column`` on specified ``keys``\n\n    Parameters\n    ----------\n    column : Column object\n        Column to group\n    keys : Table or Numpy array of same length as col\n        Grouping key specifier\n\n    Returns\n    -------\n    grouped_column : Column object with groups attr set accordingly\n    ","endLoc":154,"header":"def column_group_by(column, keys)","id":2561,"name":"column_group_by","nodeType":"Function","startLoc":113,"text":"def column_group_by(column, keys):\n    \"\"\"\n    Get groups for ``column`` on specified ``keys``\n\n    Parameters\n    ----------\n    column : Column object\n        Column to group\n    keys : Table or Numpy array of same length as col\n        Grouping key specifier\n\n    Returns\n    -------\n    grouped_column : Column object with groups attr set accordingly\n    \"\"\"\n    from .table import Table\n    from .serialize import represent_mixins_as_columns\n\n    if isinstance(keys, Table):\n        keys = represent_mixins_as_columns(keys)\n        keys = keys.as_array()\n\n    if not isinstance(keys, np.ndarray):\n        raise TypeError(f'Keys input must be numpy array, but got {type(keys)}')\n\n    if len(keys) != len(column):\n        raise ValueError('Input keys array length {} does not match column length {}'\n                         .format(len(keys), len(column)))\n\n    idx_sort = keys.argsort()\n    keys = keys[idx_sort]\n\n    # Get all keys\n    diffs = np.concatenate(([True], keys[1:] != keys[:-1], [True]))\n    indices = np.flatnonzero(diffs)\n\n    # Make a new column and set the _groups to the appropriate ColumnGroups object.\n    # Take the subset of the original keys at the indices values (group boundaries).\n    out = column.__class__(column[idx_sort])\n    out._groups = ColumnGroups(out, indices=indices, keys=keys[indices[:-1]])\n\n    return out"},{"col":4,"comment":"null","endLoc":222,"header":"@u.quantity_input(radial_velocity=u.km/u.s)\n    def __new__(cls, value, unit=None,\n                observer=None, target=None,\n                radial_velocity=None, redshift=None,\n                **kwargs)","id":2562,"name":"__new__","nodeType":"Function","startLoc":170,"text":"@u.quantity_input(radial_velocity=u.km/u.s)\n    def __new__(cls, value, unit=None,\n                observer=None, target=None,\n                radial_velocity=None, redshift=None,\n                **kwargs):\n\n        obj = super().__new__(cls, value, unit=unit, **kwargs)\n\n        # There are two main modes of operation in this class. Either the\n        # observer and target are both defined, in which case the radial\n        # velocity and redshift are automatically computed from these, or\n        # only one of the observer and target are specified, along with a\n        # manually specified radial velocity or redshift. So if a target and\n        # observer are both specified, we can't also accept a radial velocity\n        # or redshift.\n        if target is not None and observer is not None:\n            if radial_velocity is not None or redshift is not None:\n                raise ValueError(\"Cannot specify radial velocity or redshift if both \"\n                                 \"target and observer are specified\")\n\n        # We only deal with redshifts here and in the redshift property.\n        # Otherwise internally we always deal with velocities.\n        if redshift is not None:\n            if radial_velocity is not None:\n                raise ValueError(\"Cannot set both a radial velocity and redshift\")\n            redshift = u.Quantity(redshift)\n            # For now, we can't specify redshift=u.one in quantity_input above\n            # and have it work with plain floats, but if that is fixed, for\n            # example as in https://github.com/astropy/astropy/pull/10232, we\n            # can remove the check here and add redshift=u.one to the decorator\n            if not redshift.unit.is_equivalent(u.one):\n                raise u.UnitsError('redshift should be dimensionless')\n            radial_velocity = redshift.to(u.km / u.s, u.doppler_redshift())\n\n        # If we're initializing from an existing SpectralCoord, keep any\n        # parameters that aren't being overridden\n        if observer is None:\n            observer = getattr(value, 'observer', None)\n        if target is None:\n            target = getattr(value, 'target', None)\n\n        # As mentioned above, we should only specify the radial velocity\n        # manually if either or both the observer and target are not\n        # specified.\n        if observer is None or target is None:\n            if radial_velocity is None:\n                radial_velocity = getattr(value, 'radial_velocity', None)\n\n        obj._radial_velocity = radial_velocity\n        obj._observer = cls._validate_coordinate(observer, label='observer')\n        obj._target = cls._validate_coordinate(target, label='target')\n\n        return obj"},{"col":4,"comment":"null","endLoc":928,"header":"def __repr__(self)","id":2564,"name":"__repr__","nodeType":"Function","startLoc":927,"text":"def __repr__(self):\n        return np.asarray(self).__repr__()"},{"col":4,"comment":"\n        A view of this table column as a `~astropy.units.Quantity` object with\n        units given by the Column's `unit` parameter.\n        ","endLoc":939,"header":"@property\n    def quantity(self)","id":2565,"name":"quantity","nodeType":"Function","startLoc":930,"text":"@property\n    def quantity(self):\n        \"\"\"\n        A view of this table column as a `~astropy.units.Quantity` object with\n        units given by the Column's `unit` parameter.\n        \"\"\"\n        # the Quantity initializer is used here because it correctly fails\n        # if the column's values are non-numeric (like strings), while .view\n        # will happily return a quantity with gibberish for numerical values\n        return Quantity(self, self.unit, copy=False, dtype=self.dtype, order='A', subok=True)"},{"col":4,"comment":"\n        A decorator for validating the units of arguments to functions.\n\n        Unit specifications can be provided as keyword arguments to the\n        decorator, or by using function annotation syntax. Arguments to the\n        decorator take precedence over any function annotations present.\n\n        A `~astropy.units.UnitsError` will be raised if the unit attribute of\n        the argument is not equivalent to the unit specified to the decorator or\n        in the annotation. If the argument has no unit attribute, i.e. it is not\n        a Quantity object, a `ValueError` will be raised unless the argument is\n        an annotation. This is to allow non Quantity annotations to pass\n        through.\n\n        Where an equivalency is specified in the decorator, the function will be\n        executed with that equivalency in force.\n\n        Notes\n        -----\n\n        The checking of arguments inside variable arguments to a function is not\n        supported (i.e. \\*arg or \\**kwargs).\n\n        The original function is accessible by the attributed ``__wrapped__``.\n        See :func:`functools.wraps` for details.\n\n        Examples\n        --------\n\n        .. code-block:: python\n\n            import astropy.units as u\n            @u.quantity_input(myangle=u.arcsec)\n            def myfunction(myangle):\n                return myangle**2\n\n\n        .. code-block:: python\n\n            import astropy.units as u\n            @u.quantity_input\n            def myfunction(myangle: u.arcsec):\n                return myangle**2\n\n        Or using a unit-aware Quantity annotation.\n\n        .. code-block:: python\n\n            @u.quantity_input\n            def myfunction(myangle: u.Quantity[u.arcsec]):\n                return myangle**2\n\n        Also you can specify a return value annotation, which will\n        cause the function to always return a `~astropy.units.Quantity` in that\n        unit.\n\n        .. code-block:: python\n\n            import astropy.units as u\n            @u.quantity_input\n            def myfunction(myangle: u.arcsec) -> u.deg**2:\n                return myangle**2\n\n        Using equivalencies::\n\n            import astropy.units as u\n            @u.quantity_input(myenergy=u.eV, equivalencies=u.mass_energy())\n            def myfunction(myenergy):\n                return myenergy**2\n\n        ","endLoc":215,"header":"@classmethod\n    def as_decorator(cls, func=None, **kwargs)","id":2566,"name":"as_decorator","nodeType":"Function","startLoc":138,"text":"@classmethod\n    def as_decorator(cls, func=None, **kwargs):\n        r\"\"\"\n        A decorator for validating the units of arguments to functions.\n\n        Unit specifications can be provided as keyword arguments to the\n        decorator, or by using function annotation syntax. Arguments to the\n        decorator take precedence over any function annotations present.\n\n        A `~astropy.units.UnitsError` will be raised if the unit attribute of\n        the argument is not equivalent to the unit specified to the decorator or\n        in the annotation. If the argument has no unit attribute, i.e. it is not\n        a Quantity object, a `ValueError` will be raised unless the argument is\n        an annotation. This is to allow non Quantity annotations to pass\n        through.\n\n        Where an equivalency is specified in the decorator, the function will be\n        executed with that equivalency in force.\n\n        Notes\n        -----\n\n        The checking of arguments inside variable arguments to a function is not\n        supported (i.e. \\*arg or \\**kwargs).\n\n        The original function is accessible by the attributed ``__wrapped__``.\n        See :func:`functools.wraps` for details.\n\n        Examples\n        --------\n\n        .. code-block:: python\n\n            import astropy.units as u\n            @u.quantity_input(myangle=u.arcsec)\n            def myfunction(myangle):\n                return myangle**2\n\n\n        .. code-block:: python\n\n            import astropy.units as u\n            @u.quantity_input\n            def myfunction(myangle: u.arcsec):\n                return myangle**2\n\n        Or using a unit-aware Quantity annotation.\n\n        .. code-block:: python\n\n            @u.quantity_input\n            def myfunction(myangle: u.Quantity[u.arcsec]):\n                return myangle**2\n\n        Also you can specify a return value annotation, which will\n        cause the function to always return a `~astropy.units.Quantity` in that\n        unit.\n\n        .. code-block:: python\n\n            import astropy.units as u\n            @u.quantity_input\n            def myfunction(myangle: u.arcsec) -> u.deg**2:\n                return myangle**2\n\n        Using equivalencies::\n\n            import astropy.units as u\n            @u.quantity_input(myenergy=u.eV, equivalencies=u.mass_energy())\n            def myfunction(myenergy):\n                return myenergy**2\n\n        \"\"\"\n        self = cls(**kwargs)\n        if func is not None and not kwargs:\n            return self(func)\n        else:\n            return self"},{"col":4,"comment":"\n        Converts this table column to a `~astropy.units.Quantity` object with\n        the requested units.\n\n        Parameters\n        ----------\n        unit : unit-like\n            The unit to convert to (i.e., a valid argument to the\n            :meth:`astropy.units.Quantity.to` method).\n        equivalencies : list of tuple\n            Equivalencies to use for this conversion.  See\n            :meth:`astropy.units.Quantity.to` for more details.\n\n        Returns\n        -------\n        quantity : `~astropy.units.Quantity`\n            A quantity object with the contents of this column in the units\n            ``unit``.\n        ","endLoc":961,"header":"def to(self, unit, equivalencies=[], **kwargs)","id":2567,"name":"to","nodeType":"Function","startLoc":941,"text":"def to(self, unit, equivalencies=[], **kwargs):\n        \"\"\"\n        Converts this table column to a `~astropy.units.Quantity` object with\n        the requested units.\n\n        Parameters\n        ----------\n        unit : unit-like\n            The unit to convert to (i.e., a valid argument to the\n            :meth:`astropy.units.Quantity.to` method).\n        equivalencies : list of tuple\n            Equivalencies to use for this conversion.  See\n            :meth:`astropy.units.Quantity.to` for more details.\n\n        Returns\n        -------\n        quantity : `~astropy.units.Quantity`\n            A quantity object with the contents of this column in the units\n            ``unit``.\n        \"\"\"\n        return self.quantity.to(unit, equivalencies)"},{"col":4,"comment":"null","endLoc":1000,"header":"def tolist(self)","id":2568,"name":"tolist","nodeType":"Function","startLoc":996,"text":"def tolist(self):\n        if self.dtype.kind == 'S':\n            return np.chararray.decode(self, encoding='utf-8').tolist()\n        else:\n            return super().tolist()"},{"attributeType":"null","col":4,"comment":"null","endLoc":392,"id":2569,"name":"meta","nodeType":"Attribute","startLoc":392,"text":"meta"},{"attributeType":"null","col":4,"comment":"null","endLoc":474,"id":2570,"name":"info","nodeType":"Attribute","startLoc":474,"text":"info"},{"attributeType":"null","col":4,"comment":"null","endLoc":853,"id":2571,"name":"__doc__","nodeType":"Attribute","startLoc":853,"text":"searchsorted.__doc__"},{"attributeType":"null","col":16,"comment":"null","endLoc":433,"id":2572,"name":"data","nodeType":"Attribute","startLoc":433,"text":"data"},{"attributeType":"null","col":8,"comment":"null","endLoc":437,"id":2573,"name":"_name","nodeType":"Attribute","startLoc":437,"text":"self._name"},{"attributeType":"null","col":20,"comment":"null","endLoc":427,"id":2574,"name":"format","nodeType":"Attribute","startLoc":427,"text":"format"},{"attributeType":"null","col":8,"comment":"null","endLoc":441,"id":2575,"name":"description","nodeType":"Attribute","startLoc":441,"text":"self.description"},{"attributeType":"null","col":8,"comment":"null","endLoc":438,"id":2576,"name":"_parent_table","nodeType":"Attribute","startLoc":438,"text":"self._parent_table"},{"attributeType":"null","col":8,"comment":"null","endLoc":580,"id":2577,"name":"parent_table","nodeType":"Attribute","startLoc":580,"text":"self.parent_table"},{"attributeType":"null","col":12,"comment":"null","endLoc":434,"id":2578,"name":"self_data","nodeType":"Attribute","startLoc":434,"text":"self_data"},{"attributeType":"null","col":8,"comment":"null","endLoc":439,"id":2579,"name":"unit","nodeType":"Attribute","startLoc":439,"text":"self.unit"},{"col":4,"comment":"null","endLoc":135,"header":"def __enter__(self)","id":2580,"name":"__enter__","nodeType":"Function","startLoc":134,"text":"def __enter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":138,"header":"def __exit__(self, type, value, traceback)","id":2581,"name":"__exit__","nodeType":"Function","startLoc":137,"text":"def __exit__(self, type, value, traceback):\n        self.close()"},{"attributeType":"null","col":8,"comment":"null","endLoc":443,"id":2582,"name":"indices","nodeType":"Attribute","startLoc":443,"text":"self.indices"},{"attributeType":"null","col":12,"comment":"null","endLoc":835,"id":2583,"name":"_unit","nodeType":"Attribute","startLoc":835,"text":"self._unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":442,"id":2584,"name":"meta","nodeType":"Attribute","startLoc":442,"text":"self.meta"},{"attributeType":"null","col":16,"comment":"null","endLoc":415,"id":2585,"name":"name","nodeType":"Attribute","startLoc":415,"text":"name"},{"attributeType":"null","col":8,"comment":"null","endLoc":436,"id":2586,"name":"self","nodeType":"Attribute","startLoc":436,"text":"self"},{"attributeType":"null","col":8,"comment":"null","endLoc":440,"id":2587,"name":"_format","nodeType":"Attribute","startLoc":440,"text":"self._format"},{"attributeType":"null","col":12,"comment":"null","endLoc":887,"id":2588,"name":"_groups","nodeType":"Attribute","startLoc":887,"text":"self._groups"},{"attributeType":"null","col":12,"comment":"null","endLoc":585,"id":2589,"name":"info","nodeType":"Attribute","startLoc":585,"text":"self.info"},{"col":4,"comment":"null","endLoc":1094,"header":"def __setattr__(self, item, value)","id":2590,"name":"__setattr__","nodeType":"Function","startLoc":1082,"text":"def __setattr__(self, item, value):\n        if not isinstance(self, MaskedColumn) and item == \"mask\":\n            raise AttributeError(\"cannot set mask value to a column in non-masked Table\")\n        super().__setattr__(item, value)\n\n        if item == 'unit' and issubclass(self.dtype.type, np.number):\n            try:\n                converted = self.parent_table._convert_col_for_table(self)\n            except AttributeError:  # Either no parent table or parent table is None\n                pass\n            else:\n                if converted is not self:\n                    self.parent_table.replace_column(self.name, converted)"},{"col":4,"comment":"null","endLoc":220,"header":"def __init__(self, func=None, strict_dimensionless=False, **kwargs)","id":2591,"name":"__init__","nodeType":"Function","startLoc":217,"text":"def __init__(self, func=None, strict_dimensionless=False, **kwargs):\n        self.equivalencies = kwargs.pop('equivalencies', [])\n        self.decorator_kwargs = kwargs\n        self.strict_dimensionless = strict_dimensionless"},{"col":4,"comment":"\n        Close the physical FITS file.\n        ","endLoc":229,"header":"def close(self)","id":2592,"name":"close","nodeType":"Function","startLoc":224,"text":"def close(self):\n        \"\"\"\n        Close the physical FITS file.\n        \"\"\"\n\n        self._ffo.close()"},{"col":4,"comment":"\n        Write the given data to the stream.\n\n        Parameters\n        ----------\n        data : ndarray\n            Data to stream to the file.\n\n        Returns\n        -------\n        writecomplete : int\n            Flag that when `True` indicates that all of the required\n            data has been written to the stream.\n\n        Notes\n        -----\n        Only the amount of data specified in the header provided to the class\n        constructor may be written to the stream.  If the provided data would\n        cause the stream to overflow, an `OSError` exception is\n        raised and the data is not written. Once sufficient data has been\n        written to the stream to satisfy the amount specified in the header,\n        the stream is padded to fill a complete FITS block and no more data\n        will be accepted. An attempt to write more data after the stream has\n        been filled will raise an `OSError` exception. If the\n        dtype of the input data does not match what is expected by the header,\n        a `TypeError` exception is raised.\n        ","endLoc":194,"header":"def write(self, data)","id":2593,"name":"write","nodeType":"Function","startLoc":140,"text":"def write(self, data):\n        \"\"\"\n        Write the given data to the stream.\n\n        Parameters\n        ----------\n        data : ndarray\n            Data to stream to the file.\n\n        Returns\n        -------\n        writecomplete : int\n            Flag that when `True` indicates that all of the required\n            data has been written to the stream.\n\n        Notes\n        -----\n        Only the amount of data specified in the header provided to the class\n        constructor may be written to the stream.  If the provided data would\n        cause the stream to overflow, an `OSError` exception is\n        raised and the data is not written. Once sufficient data has been\n        written to the stream to satisfy the amount specified in the header,\n        the stream is padded to fill a complete FITS block and no more data\n        will be accepted. An attempt to write more data after the stream has\n        been filled will raise an `OSError` exception. If the\n        dtype of the input data does not match what is expected by the header,\n        a `TypeError` exception is raised.\n        \"\"\"\n\n        size = self._ffo.tell() - self._data_offset\n\n        if self.writecomplete or size + data.nbytes > self._size:\n            raise OSError('Attempt to write more data to the stream than the '\n                          'header specified.')\n\n        if BITPIX2DTYPE[self._header['BITPIX']] != data.dtype.name:\n            raise TypeError('Supplied data does not match the type specified '\n                            'in the header.')\n\n        if data.dtype.str[0] != '>':\n            # byteswap little endian arrays before writing\n            output = data.byteswap()\n        else:\n            output = data\n\n        self._ffo.writearray(output)\n\n        if self._ffo.tell() - self._data_offset == self._size:\n            # the stream is full so pad the data to the next FITS block\n            self._ffo.write(_pad_length(self._size) * '\\0')\n            self.writecomplete = True\n\n        self._ffo.flush()\n\n        return self.writecomplete"},{"col":4,"comment":"null","endLoc":1126,"header":"def _base_repr_(self, html=False)","id":2594,"name":"_base_repr_","nodeType":"Function","startLoc":1096,"text":"def _base_repr_(self, html=False):\n        # If scalar then just convert to correct numpy type and use numpy repr\n        if self.ndim == 0:\n            return repr(self.item())\n\n        descr_vals = [self.__class__.__name__]\n        unit = None if self.unit is None else str(self.unit)\n        shape = None if self.ndim <= 1 else self.shape[1:]\n        for attr, val in (('name', self.name),\n                          ('dtype', dtype_info_name(self.dtype)),\n                          ('shape', shape),\n                          ('unit', unit),\n                          ('format', self.format),\n                          ('description', self.description),\n                          ('length', len(self))):\n\n            if val is not None:\n                descr_vals.append(f'{attr}={val!r}')\n\n        descr = '<' + ' '.join(descr_vals) + '>\\n'\n\n        if html:\n            from astropy.utils.xml.writer import xml_escape\n            descr = xml_escape(descr)\n\n        data_lines, outs = self._formatter._pformat_col(\n            self, show_name=False, show_unit=False, show_length=False, html=html)\n\n        out = descr + '\\n'.join(data_lines)\n\n        return out"},{"col":4,"comment":"\n        Return the size (in bytes) of the data portion of the HDU.\n        ","endLoc":222,"header":"@property\n    def size(self)","id":2595,"name":"size","nodeType":"Function","startLoc":196,"text":"@property\n    def size(self):\n        \"\"\"\n        Return the size (in bytes) of the data portion of the HDU.\n        \"\"\"\n\n        size = 0\n        naxis = self._header.get('NAXIS', 0)\n\n        if naxis > 0:\n            simple = self._header.get('SIMPLE', 'F')\n            random_groups = self._header.get('GROUPS', 'F')\n\n            if simple == 'T' and random_groups == 'T':\n                groups = 1\n            else:\n                groups = 0\n\n            size = 1\n\n            for idx in range(groups, naxis):\n                size = size * self._header['NAXIS' + str(idx + 1)]\n            bitpix = self._header['BITPIX']\n            gcount = self._header.get('GCOUNT', 1)\n            pcount = self._header.get('PCOUNT', 0)\n            size = abs(bitpix) * gcount * (pcount + size) // 8\n        return size"},{"col":39,"endLoc":814,"id":2596,"nodeType":"Lambda","startLoc":814,"text":"lambda v: (v == 0)"},{"col":0,"comment":"Return a human-oriented string name of the ``dtype`` arg.\n    This can be use by astropy methods that present type information about\n    a data object.\n\n    The output is mostly equivalent to ``dtype.name`` which takes the form\n    <type_name>[B] where <type_name> is like ``int`` or ``bool`` and [B] is an\n    optional number of bits which gets included only for numeric types.\n\n    The output is shown below for ``bytes`` and ``str`` types, with <N> being\n    the number of characters. This representation corresponds to the Python\n    type that matches the dtype::\n\n      Numpy          S<N>      U<N>\n      Python      bytes<N>   str<N>\n\n    Parameters\n    ----------\n    dtype : str, `~numpy.dtype`, type\n        Input as an object that can be converted via :class:`numpy.dtype`.\n\n    Returns\n    -------\n    dtype_info_name : str\n        String name of ``dtype``\n    ","endLoc":98,"header":"def dtype_info_name(dtype)","id":2597,"name":"dtype_info_name","nodeType":"Function","startLoc":64,"text":"def dtype_info_name(dtype):\n    \"\"\"Return a human-oriented string name of the ``dtype`` arg.\n    This can be use by astropy methods that present type information about\n    a data object.\n\n    The output is mostly equivalent to ``dtype.name`` which takes the form\n    <type_name>[B] where <type_name> is like ``int`` or ``bool`` and [B] is an\n    optional number of bits which gets included only for numeric types.\n\n    The output is shown below for ``bytes`` and ``str`` types, with <N> being\n    the number of characters. This representation corresponds to the Python\n    type that matches the dtype::\n\n      Numpy          S<N>      U<N>\n      Python      bytes<N>   str<N>\n\n    Parameters\n    ----------\n    dtype : str, `~numpy.dtype`, type\n        Input as an object that can be converted via :class:`numpy.dtype`.\n\n    Returns\n    -------\n    dtype_info_name : str\n        String name of ``dtype``\n    \"\"\"\n    dtype = np.dtype(dtype)\n    if dtype.kind in ('S', 'U'):\n        type_name = 'bytes' if dtype.kind == 'S' else 'str'\n        length = re.search(r'(\\d+)', dtype.str).group(1)\n        out = type_name + length\n    else:\n        out = dtype.name\n\n    return out"},{"col":0,"comment":"\n    Dump a table HDU to a file in ASCII format.  The table may be\n    dumped in three separate files, one containing column definitions,\n    one containing header parameters, and one for table data.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        Input fits file.\n\n    datafile : path-like or file-like, optional\n        Output data file.  The default is the root name of the input\n        fits file appended with an underscore, followed by the\n        extension number (ext), followed by the extension ``.txt``.\n\n    cdfile : path-like or file-like, optional\n        Output column definitions file.  The default is `None`,\n        no column definitions output is produced.\n\n    hfile : path-like or file-like, optional\n        Output header parameters file.  The default is `None`,\n        no header parameters output is produced.\n\n    ext : int\n        The number of the extension containing the table HDU to be\n        dumped.\n\n    overwrite : bool, optional\n        If ``True``, overwrite the output file if it exists. Raises an\n        ``OSError`` if ``False`` and the output file exists. Default is\n        ``False``.\n\n    Notes\n    -----\n    The primary use for the `tabledump` function is to allow editing in a\n    standard text editor of the table data and parameters.  The\n    `tableload` function can be used to reassemble the table from the\n    three ASCII files.\n    ","endLoc":959,"header":"def tabledump(filename, datafile=None, cdfile=None, hfile=None, ext=1,\n              overwrite=False)","id":2598,"name":"tabledump","nodeType":"Function","startLoc":900,"text":"def tabledump(filename, datafile=None, cdfile=None, hfile=None, ext=1,\n              overwrite=False):\n    \"\"\"\n    Dump a table HDU to a file in ASCII format.  The table may be\n    dumped in three separate files, one containing column definitions,\n    one containing header parameters, and one for table data.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        Input fits file.\n\n    datafile : path-like or file-like, optional\n        Output data file.  The default is the root name of the input\n        fits file appended with an underscore, followed by the\n        extension number (ext), followed by the extension ``.txt``.\n\n    cdfile : path-like or file-like, optional\n        Output column definitions file.  The default is `None`,\n        no column definitions output is produced.\n\n    hfile : path-like or file-like, optional\n        Output header parameters file.  The default is `None`,\n        no header parameters output is produced.\n\n    ext : int\n        The number of the extension containing the table HDU to be\n        dumped.\n\n    overwrite : bool, optional\n        If ``True``, overwrite the output file if it exists. Raises an\n        ``OSError`` if ``False`` and the output file exists. Default is\n        ``False``.\n\n    Notes\n    -----\n    The primary use for the `tabledump` function is to allow editing in a\n    standard text editor of the table data and parameters.  The\n    `tableload` function can be used to reassemble the table from the\n    three ASCII files.\n    \"\"\"\n\n    # allow file object to already be opened in any of the valid modes\n    # and leave the file in the same state (opened or closed) as when\n    # the function was called\n\n    mode, closed = _get_file_mode(filename, default='readonly')\n    f = fitsopen(filename, mode=mode)\n\n    # Create the default data file name if one was not provided\n    try:\n        if not datafile:\n            root, tail = os.path.splitext(f._file.name)\n            datafile = root + '_' + repr(ext) + '.txt'\n\n        # Dump the data from the HDU to the files\n        f[ext].dump(datafile, cdfile, hfile, overwrite)\n    finally:\n        if closed:\n            f.close()"},{"col":4,"comment":"null","endLoc":69,"header":"def __new__(cls, value, unit=None,\n                doppler_rest=None, doppler_convention=None,\n                **kwargs)","id":2599,"name":"__new__","nodeType":"Function","startLoc":53,"text":"def __new__(cls, value, unit=None,\n                doppler_rest=None, doppler_convention=None,\n                **kwargs):\n\n        obj = super().__new__(cls, value, unit=unit, **kwargs)\n\n        # If we're initializing from an existing SpectralQuantity, keep any\n        # parameters that aren't being overridden\n        if doppler_rest is None:\n            doppler_rest = getattr(value, 'doppler_rest', None)\n        if doppler_convention is None:\n            doppler_convention = getattr(value, 'doppler_convention', None)\n\n        obj._doppler_rest = doppler_rest\n        obj._doppler_convention = doppler_convention\n\n        return obj"},{"col":4,"comment":"\n        Create a `~astropy.table.Table` from a :class:`pandas.DataFrame` instance\n\n        In addition to converting generic numeric or string columns, this supports\n        conversion of pandas Date and Time delta columns to `~astropy.time.Time`\n        and `~astropy.time.TimeDelta` columns, respectively.\n\n        Parameters\n        ----------\n        dataframe : :class:`pandas.DataFrame`\n            A pandas :class:`pandas.DataFrame` instance\n        index : bool\n            Include the index column in the returned table (default=False)\n        units: dict\n            A dict mapping column names to to a `~astropy.units.Unit`.\n            The columns will have the specified unit in the Table.\n\n        Returns\n        -------\n        table : `~astropy.table.Table`\n            A `~astropy.table.Table` (or subclass) instance\n\n        Raises\n        ------\n        ImportError\n            If pandas is not installed\n\n        Examples\n        --------\n        Here we convert a :class:`pandas.DataFrame` instance\n        to a `~astropy.table.QTable`.\n\n          >>> import numpy as np\n          >>> import pandas as pd\n          >>> from astropy.table import QTable\n\n          >>> time = pd.Series(['1998-01-01', '2002-01-01'], dtype='datetime64[ns]')\n          >>> dt = pd.Series(np.array([1, 300], dtype='timedelta64[s]'))\n          >>> df = pd.DataFrame({'time': time})\n          >>> df['dt'] = dt\n          >>> df['x'] = [3., 4.]\n          >>> with pd.option_context('display.max_columns', 20):\n          ...     print(df)\n                  time              dt    x\n          0 1998-01-01 0 days 00:00:01  3.0\n          1 2002-01-01 0 days 00:05:00  4.0\n\n          >>> QTable.from_pandas(df)\n          <QTable length=2>\n                    time              dt       x\n                    Time          TimeDelta float64\n          ----------------------- --------- -------\n          1998-01-01T00:00:00.000       1.0     3.0\n          2002-01-01T00:00:00.000     300.0     4.0\n\n        ","endLoc":3903,"header":"@classmethod\n    def from_pandas(cls, dataframe, index=False, units=None)","id":2600,"name":"from_pandas","nodeType":"Function","startLoc":3770,"text":"@classmethod\n    def from_pandas(cls, dataframe, index=False, units=None):\n        \"\"\"\n        Create a `~astropy.table.Table` from a :class:`pandas.DataFrame` instance\n\n        In addition to converting generic numeric or string columns, this supports\n        conversion of pandas Date and Time delta columns to `~astropy.time.Time`\n        and `~astropy.time.TimeDelta` columns, respectively.\n\n        Parameters\n        ----------\n        dataframe : :class:`pandas.DataFrame`\n            A pandas :class:`pandas.DataFrame` instance\n        index : bool\n            Include the index column in the returned table (default=False)\n        units: dict\n            A dict mapping column names to to a `~astropy.units.Unit`.\n            The columns will have the specified unit in the Table.\n\n        Returns\n        -------\n        table : `~astropy.table.Table`\n            A `~astropy.table.Table` (or subclass) instance\n\n        Raises\n        ------\n        ImportError\n            If pandas is not installed\n\n        Examples\n        --------\n        Here we convert a :class:`pandas.DataFrame` instance\n        to a `~astropy.table.QTable`.\n\n          >>> import numpy as np\n          >>> import pandas as pd\n          >>> from astropy.table import QTable\n\n          >>> time = pd.Series(['1998-01-01', '2002-01-01'], dtype='datetime64[ns]')\n          >>> dt = pd.Series(np.array([1, 300], dtype='timedelta64[s]'))\n          >>> df = pd.DataFrame({'time': time})\n          >>> df['dt'] = dt\n          >>> df['x'] = [3., 4.]\n          >>> with pd.option_context('display.max_columns', 20):\n          ...     print(df)\n                  time              dt    x\n          0 1998-01-01 0 days 00:00:01  3.0\n          1 2002-01-01 0 days 00:05:00  4.0\n\n          >>> QTable.from_pandas(df)\n          <QTable length=2>\n                    time              dt       x\n                    Time          TimeDelta float64\n          ----------------------- --------- -------\n          1998-01-01T00:00:00.000       1.0     3.0\n          2002-01-01T00:00:00.000     300.0     4.0\n\n        \"\"\"\n\n        out = OrderedDict()\n\n        names = list(dataframe.columns)\n        columns = [dataframe[name] for name in names]\n        datas = [np.array(column) for column in columns]\n        masks = [np.array(column.isnull()) for column in columns]\n\n        if index:\n            index_name = dataframe.index.name or 'index'\n            while index_name in names:\n                index_name = '_' + index_name + '_'\n            names.insert(0, index_name)\n            columns.insert(0, dataframe.index)\n            datas.insert(0, np.array(dataframe.index))\n            masks.insert(0, np.zeros(len(dataframe), dtype=bool))\n\n        if units is None:\n            units = [None] * len(names)\n        else:\n            if not isinstance(units, Mapping):\n                raise TypeError('Expected a Mapping \"column-name\" -> \"unit\"')\n\n            not_found = set(units.keys()) - set(names)\n            if not_found:\n                warnings.warn(f'`units` contains additional columns: {not_found}')\n\n            units = [units.get(name) for name in names]\n\n        for name, column, data, mask, unit in zip(names, columns, datas, masks, units):\n\n            if column.dtype.kind in ['u', 'i'] and np.any(mask):\n                # Special-case support for pandas nullable int\n                np_dtype = str(column.dtype).lower()\n                data = np.zeros(shape=column.shape, dtype=np_dtype)\n                data[~mask] = column[~mask]\n                out[name] = MaskedColumn(data=data, name=name, mask=mask, unit=unit, copy=False)\n                continue\n\n            if data.dtype.kind == 'O':\n                # If all elements of an object array are string-like or np.nan\n                # then coerce back to a native numpy str/unicode array.\n                string_types = (str, bytes)\n                nan = np.nan\n                if all(isinstance(x, string_types) or x is nan for x in data):\n                    # Force any missing (null) values to b''.  Numpy will\n                    # upcast to str/unicode as needed.\n                    data[mask] = b''\n\n                    # When the numpy object array is represented as a list then\n                    # numpy initializes to the correct string or unicode type.\n                    data = np.array([x for x in data])\n\n            # Numpy datetime64\n            if data.dtype.kind == 'M':\n                from astropy.time import Time\n                out[name] = Time(data, format='datetime64')\n                if np.any(mask):\n                    out[name][mask] = np.ma.masked\n                out[name].format = 'isot'\n\n            # Numpy timedelta64\n            elif data.dtype.kind == 'm':\n                from astropy.time import TimeDelta\n                data_sec = data.astype('timedelta64[ns]').astype(np.float64) / 1e9\n                out[name] = TimeDelta(data_sec, format='sec')\n                if np.any(mask):\n                    out[name][mask] = np.ma.masked\n\n            else:\n                if np.any(mask):\n                    out[name] = MaskedColumn(data=data, name=name, mask=mask, unit=unit)\n                else:\n                    out[name] = Column(data=data, name=name, unit=unit)\n\n        return cls(out)"},{"attributeType":"function","col":8,"comment":"null","endLoc":126,"id":2601,"name":"_size","nodeType":"Attribute","startLoc":126,"text":"self._size"},{"attributeType":"null","col":8,"comment":"null","endLoc":124,"id":2602,"name":"_header_offset","nodeType":"Attribute","startLoc":124,"text":"self._header_offset"},{"attributeType":"null","col":12,"comment":"null","endLoc":131,"id":2603,"name":"writecomplete","nodeType":"Attribute","startLoc":131,"text":"self.writecomplete"},{"attributeType":"null","col":8,"comment":"null","endLoc":68,"id":2604,"name":"_header","nodeType":"Attribute","startLoc":68,"text":"self._header"},{"attributeType":"null","col":8,"comment":"null","endLoc":125,"id":2605,"name":"_data_offset","nodeType":"Attribute","startLoc":125,"text":"self._data_offset"},{"attributeType":"null","col":8,"comment":"null","endLoc":116,"id":2606,"name":"_ffo","nodeType":"Attribute","startLoc":116,"text":"self._ffo"},{"col":0,"comment":"\n    Create a table from the input ASCII files.  The input is from up\n    to three separate files, one containing column definitions, one\n    containing header parameters, and one containing column data.  The\n    header parameters file is not required.  When the header\n    parameters file is absent a minimal header is constructed.\n\n    Parameters\n    ----------\n    datafile : path-like or file-like\n        Input data file containing the table data in ASCII format.\n\n    cdfile : path-like or file-like\n        Input column definition file containing the names, formats,\n        display formats, physical units, multidimensional array\n        dimensions, undefined values, scale factors, and offsets\n        associated with the columns in the table.\n\n    hfile : path-like or file-like, optional\n        Input parameter definition file containing the header\n        parameter definitions to be associated with the table.\n        If `None`, a minimal header is constructed.\n\n    Notes\n    -----\n    The primary use for the `tableload` function is to allow the input of\n    ASCII data that was edited in a standard text editor of the table\n    data and parameters.  The tabledump function can be used to create the\n    initial ASCII files.\n    ","endLoc":998,"header":"def tableload(datafile, cdfile, hfile=None)","id":2607,"name":"tableload","nodeType":"Function","startLoc":966,"text":"def tableload(datafile, cdfile, hfile=None):\n    \"\"\"\n    Create a table from the input ASCII files.  The input is from up\n    to three separate files, one containing column definitions, one\n    containing header parameters, and one containing column data.  The\n    header parameters file is not required.  When the header\n    parameters file is absent a minimal header is constructed.\n\n    Parameters\n    ----------\n    datafile : path-like or file-like\n        Input data file containing the table data in ASCII format.\n\n    cdfile : path-like or file-like\n        Input column definition file containing the names, formats,\n        display formats, physical units, multidimensional array\n        dimensions, undefined values, scale factors, and offsets\n        associated with the columns in the table.\n\n    hfile : path-like or file-like, optional\n        Input parameter definition file containing the header\n        parameter definitions to be associated with the table.\n        If `None`, a minimal header is constructed.\n\n    Notes\n    -----\n    The primary use for the `tableload` function is to allow the input of\n    ASCII data that was edited in a standard text editor of the table\n    data and parameters.  The tabledump function can be used to create the\n    initial ASCII files.\n    \"\"\"\n\n    return BinTableHDU.load(datafile, cdfile, hfile, replace=True)"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":2608,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"__init__.py#<anonymous>","id":2609,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['HDUList', 'PrimaryHDU', 'ImageHDU', 'TableHDU', 'BinTableHDU',\n           'GroupsHDU', 'GroupData', 'Group', 'CompImageHDU', 'FitsHDU',\n           'StreamingHDU', 'register_hdu', 'unregister_hdu', 'DELAYED',\n           'BITPIX2DTYPE', 'DTYPE2BITPIX']"},{"attributeType":"null","col":4,"comment":"null","endLoc":732,"id":2610,"name":"_extension","nodeType":"Attribute","startLoc":732,"text":"_extension"},{"attributeType":"null","col":4,"comment":"null","endLoc":733,"id":2611,"name":"_ext_comment","nodeType":"Attribute","startLoc":733,"text":"_ext_comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":735,"id":2612,"name":"_padding_byte","nodeType":"Attribute","startLoc":735,"text":"_padding_byte"},{"attributeType":"null","col":0,"comment":"null","endLoc":75,"id":2613,"name":"__all__","nodeType":"Attribute","startLoc":75,"text":"__all__"},{"col":0,"comment":"","endLoc":55,"header":"convenience.py#<anonymous>","id":2614,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nConvenience functions\n=====================\n\nThe functions in this module provide shortcuts for some of the most basic\noperations on FITS files, such as reading and updating the header.  They are\nincluded directly in the 'astropy.io.fits' namespace so that they can be used\nlike::\n\n    astropy.io.fits.getheader(...)\n\nThese functions are primarily for convenience when working with FITS files in\nthe command-line interpreter.  If performing several operations on the same\nfile, such as in a script, it is better to *not* use these functions, as each\none must open and re-parse the file.  In such cases it is better to use\n:func:`astropy.io.fits.open` and work directly with the\n:class:`astropy.io.fits.HDUList` object and underlying HDU objects.\n\nSeveral of the convenience functions, such as `getheader` and `getdata` support\nspecial arguments for selecting which HDU to use when working with a\nmulti-extension FITS file.  There are a few supported argument formats for\nselecting the HDU.  See the documentation for `getdata` for an\nexplanation of all the different formats.\n\n.. warning::\n    All arguments to convenience functions other than the filename that are\n    *not* for selecting the HDU should be passed in as keyword\n    arguments.  This is to avoid ambiguity and conflicts with the\n    HDU arguments.  For example, to set NAXIS=1 on the Primary HDU:\n\n    Wrong::\n\n        astropy.io.fits.setval('myimage.fits', 'NAXIS', 1)\n\n    The above example will try to set the NAXIS value on the first extension\n    HDU to blank.  That is, the argument '1' is assumed to specify an\n    HDU.\n\n    Right::\n\n        astropy.io.fits.setval('myimage.fits', 'NAXIS', value=1)\n\n    This will set the NAXIS keyword to 1 on the primary HDU (the default).  To\n    specify the first extension HDU use::\n\n        astropy.io.fits.setval('myimage.fits', 'NAXIS', value=1, ext=1)\n\n    This complexity arises out of the attempt to simultaneously support\n    multiple argument formats that were used in past versions of PyFITS.\n    Unfortunately, it is not possible to support all formats without\n    introducing some ambiguity.  A future Astropy release may standardize\n    around a single format and officially deprecate the other formats.\n\"\"\"\n\n__all__ = ['getheader', 'getdata', 'getval', 'setval', 'delval', 'writeto',\n           'append', 'update', 'info', 'tabledump', 'tableload',\n           'table_to_hdu', 'printdiff']\n\nif isinstance(tabledump.__doc__, str):\n    tabledump.__doc__ += BinTableHDU._tdump_file_format.replace('\\n', '\\n    ')\n\nif isinstance(tableload.__doc__, str):\n    tableload.__doc__ += BinTableHDU._tdump_file_format.replace('\\n', '\\n    ')"},{"attributeType":"_AsciiColDefs","col":4,"comment":"null","endLoc":736,"id":2615,"name":"_columns_type","nodeType":"Attribute","startLoc":736,"text":"_columns_type"},{"fileName":"streaming.py","filePath":"astropy/io/fits/hdu","id":2616,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport gzip\nimport os\n\nfrom .base import _BaseHDU, BITPIX2DTYPE\nfrom .hdulist import HDUList\nfrom .image import PrimaryHDU\n\nfrom astropy.io.fits.file import _File\nfrom astropy.io.fits.header import _pad_length\nfrom astropy.io.fits.util import fileobj_name\n\n\nclass StreamingHDU:\n    \"\"\"\n    A class that provides the capability to stream data to a FITS file\n    instead of requiring data to all be written at once.\n\n    The following pseudocode illustrates its use::\n\n        header = astropy.io.fits.Header()\n\n        for all the cards you need in the header:\n            header[key] = (value, comment)\n\n        shdu = astropy.io.fits.StreamingHDU('filename.fits', header)\n\n        for each piece of data:\n            shdu.write(data)\n\n        shdu.close()\n    \"\"\"\n\n    def __init__(self, name, header):\n        \"\"\"\n        Construct a `StreamingHDU` object given a file name and a header.\n\n        Parameters\n        ----------\n        name : path-like or file-like\n            The file to which the header and data will be streamed. If opened,\n            the file object must be opened in a writeable binary mode such as\n            'wb' or 'ab+'.\n\n        header : `Header` instance\n            The header object associated with the data to be written\n            to the file.\n\n        Notes\n        -----\n        The file will be opened and the header appended to the end of\n        the file.  If the file does not already exist, it will be\n        created, and if the header represents a Primary header, it\n        will be written to the beginning of the file.  If the file\n        does not exist and the provided header is not a Primary\n        header, a default Primary HDU will be inserted at the\n        beginning of the file and the provided header will be added as\n        the first extension.  If the file does already exist, but the\n        provided header represents a Primary header, the header will\n        be modified to an image extension header and appended to the\n        end of the file.\n        \"\"\"\n\n        if isinstance(name, gzip.GzipFile):\n            raise TypeError('StreamingHDU not supported for GzipFile objects.')\n\n        self._header = header.copy()\n\n        # handle a file object instead of a file name\n        filename = fileobj_name(name) or ''\n\n        # Check if the file already exists.  If it does not, check to see\n        # if we were provided with a Primary Header.  If not we will need\n        # to prepend a default PrimaryHDU to the file before writing the\n        # given header.\n\n        newfile = False\n\n        if filename:\n            if not os.path.exists(filename) or os.path.getsize(filename) == 0:\n                newfile = True\n        elif (hasattr(name, 'len') and name.len == 0):\n            newfile = True\n\n        if newfile:\n            if 'SIMPLE' not in self._header:\n                hdulist = HDUList([PrimaryHDU()])\n                hdulist.writeto(name, 'exception')\n        else:\n\n            # This will not be the first extension in the file so we\n            # must change the Primary header provided into an image\n            # extension header.\n\n            if 'SIMPLE' in self._header:\n                self._header.set('XTENSION', 'IMAGE', 'Image extension',\n                                 after='SIMPLE')\n                del self._header['SIMPLE']\n\n                if 'PCOUNT' not in self._header:\n                    dim = self._header['NAXIS']\n\n                    if dim == 0:\n                        dim = ''\n                    else:\n                        dim = str(dim)\n\n                    self._header.set('PCOUNT', 0, 'number of parameters',\n                                     after='NAXIS' + dim)\n\n                if 'GCOUNT' not in self._header:\n                    self._header.set('GCOUNT', 1, 'number of groups',\n                                     after='PCOUNT')\n\n        self._ffo = _File(name, 'append')\n\n        # TODO : Fix this once the HDU writing API is cleaned up\n        tmp_hdu = _BaseHDU()\n        # Passing self._header as an argument to _BaseHDU() will cause its\n        # values to be modified in undesired ways...need to have a better way\n        # of doing this\n        tmp_hdu._header = self._header\n        self._header_offset = tmp_hdu._writeheader(self._ffo)[0]\n        self._data_offset = self._ffo.tell()\n        self._size = self.size\n\n        if self._size != 0:\n            self.writecomplete = False\n        else:\n            self.writecomplete = True\n\n    # Support the 'with' statement\n    def __enter__(self):\n        return self\n\n    def __exit__(self, type, value, traceback):\n        self.close()\n\n    def write(self, data):\n        \"\"\"\n        Write the given data to the stream.\n\n        Parameters\n        ----------\n        data : ndarray\n            Data to stream to the file.\n\n        Returns\n        -------\n        writecomplete : int\n            Flag that when `True` indicates that all of the required\n            data has been written to the stream.\n\n        Notes\n        -----\n        Only the amount of data specified in the header provided to the class\n        constructor may be written to the stream.  If the provided data would\n        cause the stream to overflow, an `OSError` exception is\n        raised and the data is not written. Once sufficient data has been\n        written to the stream to satisfy the amount specified in the header,\n        the stream is padded to fill a complete FITS block and no more data\n        will be accepted. An attempt to write more data after the stream has\n        been filled will raise an `OSError` exception. If the\n        dtype of the input data does not match what is expected by the header,\n        a `TypeError` exception is raised.\n        \"\"\"\n\n        size = self._ffo.tell() - self._data_offset\n\n        if self.writecomplete or size + data.nbytes > self._size:\n            raise OSError('Attempt to write more data to the stream than the '\n                          'header specified.')\n\n        if BITPIX2DTYPE[self._header['BITPIX']] != data.dtype.name:\n            raise TypeError('Supplied data does not match the type specified '\n                            'in the header.')\n\n        if data.dtype.str[0] != '>':\n            # byteswap little endian arrays before writing\n            output = data.byteswap()\n        else:\n            output = data\n\n        self._ffo.writearray(output)\n\n        if self._ffo.tell() - self._data_offset == self._size:\n            # the stream is full so pad the data to the next FITS block\n            self._ffo.write(_pad_length(self._size) * '\\0')\n            self.writecomplete = True\n\n        self._ffo.flush()\n\n        return self.writecomplete\n\n    @property\n    def size(self):\n        \"\"\"\n        Return the size (in bytes) of the data portion of the HDU.\n        \"\"\"\n\n        size = 0\n        naxis = self._header.get('NAXIS', 0)\n\n        if naxis > 0:\n            simple = self._header.get('SIMPLE', 'F')\n            random_groups = self._header.get('GROUPS', 'F')\n\n            if simple == 'T' and random_groups == 'T':\n                groups = 1\n            else:\n                groups = 0\n\n            size = 1\n\n            for idx in range(groups, naxis):\n                size = size * self._header['NAXIS' + str(idx + 1)]\n            bitpix = self._header['BITPIX']\n            gcount = self._header.get('GCOUNT', 1)\n            pcount = self._header.get('PCOUNT', 0)\n            size = abs(bitpix) * gcount * (pcount + size) // 8\n        return size\n\n    def close(self):\n        \"\"\"\n        Close the physical FITS file.\n        \"\"\"\n\n        self._ffo.close()\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":738,"id":2617,"name":"__format_RE","nodeType":"Attribute","startLoc":738,"text":"__format_RE"},{"fileName":"compressed.py","filePath":"astropy/io/fits/hdu","id":2618,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport ctypes\nimport gc\nimport itertools\nimport math\nimport re\nimport time\nimport warnings\nfrom contextlib import suppress\n\nimport numpy as np\n\nfrom .base import DELAYED, ExtensionHDU, BITPIX2DTYPE, DTYPE2BITPIX\nfrom .image import ImageHDU\nfrom .table import BinTableHDU\nfrom astropy.io.fits import conf\nfrom astropy.io.fits.card import Card\nfrom astropy.io.fits.column import Column, ColDefs, TDEF_RE\nfrom astropy.io.fits.column import KEYWORD_NAMES as TABLE_KEYWORD_NAMES\nfrom astropy.io.fits.fitsrec import FITS_rec\nfrom astropy.io.fits.header import Header\nfrom astropy.io.fits.util import (_is_pseudo_integer, _pseudo_zero, _is_int,\n                                  _get_array_mmap)\n\nfrom astropy.utils import lazyproperty\nfrom astropy.utils.exceptions import AstropyUserWarning\n\ntry:\n    from astropy.io.fits import compression\n    COMPRESSION_SUPPORTED = COMPRESSION_ENABLED = True\nexcept ImportError:\n    COMPRESSION_SUPPORTED = COMPRESSION_ENABLED = False\n\n\n# Quantization dithering method constants; these are right out of fitsio.h\nNO_DITHER = -1\nSUBTRACTIVE_DITHER_1 = 1\nSUBTRACTIVE_DITHER_2 = 2\nQUANTIZE_METHOD_NAMES = {\n    NO_DITHER: 'NO_DITHER',\n    SUBTRACTIVE_DITHER_1: 'SUBTRACTIVE_DITHER_1',\n    SUBTRACTIVE_DITHER_2: 'SUBTRACTIVE_DITHER_2'\n}\nDITHER_SEED_CLOCK = 0\nDITHER_SEED_CHECKSUM = -1\n\nCOMPRESSION_TYPES = ('RICE_1', 'GZIP_1', 'GZIP_2', 'PLIO_1', 'HCOMPRESS_1')\n\n# Default compression parameter values\nDEFAULT_COMPRESSION_TYPE = 'RICE_1'\nDEFAULT_QUANTIZE_LEVEL = 16.\nDEFAULT_QUANTIZE_METHOD = NO_DITHER\nDEFAULT_DITHER_SEED = DITHER_SEED_CLOCK\nDEFAULT_HCOMP_SCALE = 0\nDEFAULT_HCOMP_SMOOTH = 0\nDEFAULT_BLOCK_SIZE = 32\nDEFAULT_BYTE_PIX = 4\n\nCMTYPE_ALIASES = {'RICE_ONE': 'RICE_1'}\n\nCOMPRESSION_KEYWORDS = {'ZIMAGE', 'ZCMPTYPE', 'ZBITPIX', 'ZNAXIS', 'ZMASKCMP',\n                        'ZSIMPLE', 'ZTENSION', 'ZEXTEND'}\n\n\nclass CompImageHeader(Header):\n    \"\"\"\n    Header object for compressed image HDUs designed to keep the compression\n    header and the underlying image header properly synchronized.\n\n    This essentially wraps the image header, so that all values are read from\n    and written to the image header.  However, updates to the image header will\n    also update the table header where appropriate.\n\n    Note that if no image header is passed in, the code will instantiate a\n    regular `~astropy.io.fits.Header`.\n    \"\"\"\n\n    # TODO: The difficulty of implementing this screams a need to rewrite this\n    # module\n\n    _keyword_remaps = {\n        'SIMPLE': 'ZSIMPLE', 'XTENSION': 'ZTENSION', 'BITPIX': 'ZBITPIX',\n        'NAXIS': 'ZNAXIS', 'EXTEND': 'ZEXTEND', 'BLOCKED': 'ZBLOCKED',\n        'PCOUNT': 'ZPCOUNT', 'GCOUNT': 'ZGCOUNT', 'CHECKSUM': 'ZHECKSUM',\n        'DATASUM': 'ZDATASUM'\n    }\n\n    _zdef_re = re.compile(r'(?P<label>^[Zz][a-zA-Z]*)(?P<num>[1-9][0-9 ]*$)?')\n    _compression_keywords = set(_keyword_remaps.values()).union(\n        ['ZIMAGE', 'ZCMPTYPE', 'ZMASKCMP', 'ZQUANTIZ', 'ZDITHER0'])\n    _indexed_compression_keywords = {'ZNAXIS', 'ZTILE', 'ZNAME', 'ZVAL'}\n    # TODO: Once it place it should be possible to manage some of this through\n    # the schema system, but it's not quite ready for that yet.  Also it still\n    # makes more sense to change CompImageHDU to subclass ImageHDU :/\n\n    def __new__(cls, table_header, image_header=None):\n        # 2019-09-14 (MHvK): No point wrapping anything if no image_header is\n        # given.  This happens if __getitem__ and copy are called - our super\n        # class will aim to initialize a new, possibly partially filled\n        # header, but we cannot usefully deal with that.\n        # TODO: the above suggests strongly we should *not* subclass from\n        # Header.  See also comment above about the need for reorganization.\n        if image_header is None:\n            return Header(table_header)\n        else:\n            return super().__new__(cls)\n\n    def __init__(self, table_header, image_header):\n        self._cards = image_header._cards\n        self._keyword_indices = image_header._keyword_indices\n        self._rvkc_indices = image_header._rvkc_indices\n        self._modified = image_header._modified\n        self._table_header = table_header\n\n    # We need to override and Header methods that can modify the header, and\n    # ensure that they sync with the underlying _table_header\n\n    def __setitem__(self, key, value):\n        # This isn't pretty, but if the `key` is either an int or a tuple we\n        # need to figure out what keyword name that maps to before doing\n        # anything else; these checks will be repeated later in the\n        # super().__setitem__ call but I don't see another way around it\n        # without some major refactoring\n        if self._set_slice(key, value, self):\n            return\n\n        if isinstance(key, int):\n            keyword, index = self._keyword_from_index(key)\n        elif isinstance(key, tuple):\n            keyword, index = key\n        else:\n            # We don't want to specify and index otherwise, because that will\n            # break the behavior for new keywords and for commentary keywords\n            keyword, index = key, None\n\n        if self._is_reserved_keyword(keyword):\n            return\n\n        super().__setitem__(key, value)\n\n        if index is not None:\n            remapped_keyword = self._remap_keyword(keyword)\n            self._table_header[remapped_keyword, index] = value\n        # Else this will pass through to ._update\n\n    def __delitem__(self, key):\n        if isinstance(key, slice) or self._haswildcard(key):\n            # If given a slice pass that on to the superclass and bail out\n            # early; we only want to make updates to _table_header when given\n            # a key specifying a single keyword\n            return super().__delitem__(key)\n\n        if isinstance(key, int):\n            keyword, index = self._keyword_from_index(key)\n        elif isinstance(key, tuple):\n            keyword, index = key\n        else:\n            keyword, index = key, None\n\n        if key not in self:\n            raise KeyError(f\"Keyword {key!r} not found.\")\n\n        super().__delitem__(key)\n\n        remapped_keyword = self._remap_keyword(keyword)\n\n        if remapped_keyword in self._table_header:\n            if index is not None:\n                del self._table_header[(remapped_keyword, index)]\n            else:\n                del self._table_header[remapped_keyword]\n\n    def append(self, card=None, useblanks=True, bottom=False, end=False):\n        # This logic unfortunately needs to be duplicated from the base class\n        # in order to determine the keyword\n        if isinstance(card, str):\n            card = Card(card)\n        elif isinstance(card, tuple):\n            card = Card(*card)\n        elif card is None:\n            card = Card()\n        elif not isinstance(card, Card):\n            raise ValueError(\n                'The value appended to a Header must be either a keyword or '\n                '(keyword, value, [comment]) tuple; got: {!r}'.format(card))\n\n        if self._is_reserved_keyword(card.keyword):\n            return\n\n        super().append(card=card, useblanks=useblanks, bottom=bottom, end=end)\n\n        remapped_keyword = self._remap_keyword(card.keyword)\n\n        # card.keyword strips the HIERARCH if present so this must be added\n        # back to avoid a warning.\n        if str(card).startswith(\"HIERARCH \") and not remapped_keyword.startswith(\"HIERARCH \"):\n            remapped_keyword = \"HIERARCH \" + remapped_keyword\n\n        card = Card(remapped_keyword, card.value, card.comment)\n\n        # Here we disable the use of blank cards, because the call above to\n        # Header.append may have already deleted a blank card in the table\n        # header, thanks to inheritance: Header.append calls 'del self[-1]'\n        # to delete a blank card, which calls CompImageHeader.__deltitem__,\n        # which deletes the blank card both in the image and the table headers!\n        self._table_header.append(card=card, useblanks=False,\n                                  bottom=bottom, end=end)\n\n    def insert(self, key, card, useblanks=True, after=False):\n        if isinstance(key, int):\n            # Determine condition to pass through to append\n            if after:\n                if key == -1:\n                    key = len(self._cards)\n                else:\n                    key += 1\n\n            if key >= len(self._cards):\n                self.append(card, end=True)\n                return\n\n        if isinstance(card, str):\n            card = Card(card)\n        elif isinstance(card, tuple):\n            card = Card(*card)\n        elif not isinstance(card, Card):\n            raise ValueError(\n                'The value inserted into a Header must be either a keyword or '\n                '(keyword, value, [comment]) tuple; got: {!r}'.format(card))\n\n        if self._is_reserved_keyword(card.keyword):\n            return\n\n        # Now the tricky part is to determine where to insert in the table\n        # header.  If given a numerical index we need to map that to the\n        # corresponding index in the table header.  Although rare, there may be\n        # cases where there is no mapping in which case we just try the same\n        # index\n        # NOTE: It is crucial that remapped_index in particular is figured out\n        # before the image header is modified\n        remapped_index = self._remap_index(key)\n        remapped_keyword = self._remap_keyword(card.keyword)\n\n        super().insert(key, card, useblanks=useblanks, after=after)\n\n        card = Card(remapped_keyword, card.value, card.comment)\n\n        # Here we disable the use of blank cards, because the call above to\n        # Header.insert may have already deleted a blank card in the table\n        # header, thanks to inheritance: Header.insert calls 'del self[-1]'\n        # to delete a blank card, which calls CompImageHeader.__delitem__,\n        # which deletes the blank card both in the image and the table headers!\n        self._table_header.insert(remapped_index, card, useblanks=False,\n                                  after=after)\n\n    def _update(self, card):\n        keyword = card[0]\n\n        if self._is_reserved_keyword(keyword):\n            return\n\n        super()._update(card)\n\n        if keyword in Card._commentary_keywords:\n            # Otherwise this will result in a duplicate insertion\n            return\n\n        remapped_keyword = self._remap_keyword(keyword)\n        self._table_header._update((remapped_keyword,) + card[1:])\n\n    # Last piece needed (I think) for synchronizing with the real header\n    # This one is tricky since _relativeinsert calls insert\n    def _relativeinsert(self, card, before=None, after=None, replace=False):\n        keyword = card[0]\n\n        if self._is_reserved_keyword(keyword):\n            return\n\n        # Now we have to figure out how to remap 'before' and 'after'\n        if before is None:\n            if isinstance(after, int):\n                remapped_after = self._remap_index(after)\n            else:\n                remapped_after = self._remap_keyword(after)\n            remapped_before = None\n        else:\n            if isinstance(before, int):\n                remapped_before = self._remap_index(before)\n            else:\n                remapped_before = self._remap_keyword(before)\n            remapped_after = None\n\n        super()._relativeinsert(card, before=before, after=after,\n                                replace=replace)\n\n        remapped_keyword = self._remap_keyword(keyword)\n\n        card = Card(remapped_keyword, card[1], card[2])\n        self._table_header._relativeinsert(card, before=remapped_before,\n                                           after=remapped_after,\n                                           replace=replace)\n\n    @classmethod\n    def _is_reserved_keyword(cls, keyword, warn=True):\n        msg = ('Keyword {!r} is reserved for use by the FITS Tiled Image '\n               'Convention and will not be stored in the header for the '\n               'image being compressed.'.format(keyword))\n\n        if keyword == 'TFIELDS':\n            if warn:\n                warnings.warn(msg)\n            return True\n\n        m = TDEF_RE.match(keyword)\n\n        if m and m.group('label').upper() in TABLE_KEYWORD_NAMES:\n            if warn:\n                warnings.warn(msg)\n            return True\n\n        m = cls._zdef_re.match(keyword)\n\n        if m:\n            label = m.group('label').upper()\n            num = m.group('num')\n            if num is not None and label in cls._indexed_compression_keywords:\n                if warn:\n                    warnings.warn(msg)\n                return True\n            elif label in cls._compression_keywords:\n                if warn:\n                    warnings.warn(msg)\n                return True\n\n        return False\n\n    @classmethod\n    def _remap_keyword(cls, keyword):\n        # Given a keyword that one might set on an image, remap that keyword to\n        # the name used for it in the COMPRESSED HDU header\n        # This is mostly just a lookup in _keyword_remaps, but needs handling\n        # for NAXISn keywords\n\n        is_naxisn = False\n        if keyword[:5] == 'NAXIS':\n            with suppress(ValueError):\n                index = int(keyword[5:])\n                is_naxisn = index > 0\n\n        if is_naxisn:\n            return f'ZNAXIS{index}'\n\n        # If the keyword does not need to be remapped then just return the\n        # original keyword\n        return cls._keyword_remaps.get(keyword, keyword)\n\n    def _remap_index(self, idx):\n        # Given an integer index into this header, map that to the index in the\n        # table header for the same card.  If the card doesn't exist in the\n        # table header (generally should *not* be the case) this will just\n        # return the same index\n        # This *does* also accept a keyword or (keyword, repeat) tuple and\n        # obtains the associated numerical index with self._cardindex\n        if not isinstance(idx, int):\n            idx = self._cardindex(idx)\n\n        keyword, repeat = self._keyword_from_index(idx)\n        remapped_insert_keyword = self._remap_keyword(keyword)\n\n        with suppress(IndexError, KeyError):\n            idx = self._table_header._cardindex((remapped_insert_keyword,\n                                                 repeat))\n\n        return idx\n\n\n# TODO: Fix this class so that it doesn't actually inherit from BinTableHDU,\n# but instead has an internal BinTableHDU reference\nclass CompImageHDU(BinTableHDU):\n    \"\"\"\n    Compressed Image HDU class.\n    \"\"\"\n\n    _manages_own_heap = True\n    \"\"\"\n    The calls to CFITSIO lay out the heap data in memory, and we write it out\n    the same way CFITSIO organizes it.  In principle this would break if a user\n    manually changes the underlying compressed data by hand, but there is no\n    reason they would want to do that (and if they do that's their\n    responsibility).\n    \"\"\"\n\n    _default_name = \"COMPRESSED_IMAGE\"\n\n    def __init__(self, data=None, header=None, name=None,\n                 compression_type=DEFAULT_COMPRESSION_TYPE,\n                 tile_size=None,\n                 hcomp_scale=DEFAULT_HCOMP_SCALE,\n                 hcomp_smooth=DEFAULT_HCOMP_SMOOTH,\n                 quantize_level=DEFAULT_QUANTIZE_LEVEL,\n                 quantize_method=DEFAULT_QUANTIZE_METHOD,\n                 dither_seed=DEFAULT_DITHER_SEED,\n                 do_not_scale_image_data=False,\n                 uint=False, scale_back=False, **kwargs):\n        \"\"\"\n        Parameters\n        ----------\n        data : array, optional\n            Uncompressed image data\n\n        header : `~astropy.io.fits.Header`, optional\n            Header to be associated with the image; when reading the HDU from a\n            file (data=DELAYED), the header read from the file\n\n        name : str, optional\n            The ``EXTNAME`` value; if this value is `None`, then the name from\n            the input image header will be used; if there is no name in the\n            input image header then the default name ``COMPRESSED_IMAGE`` is\n            used.\n\n        compression_type : str, optional\n            Compression algorithm: one of\n            ``'RICE_1'``, ``'RICE_ONE'``, ``'PLIO_1'``, ``'GZIP_1'``,\n            ``'GZIP_2'``, ``'HCOMPRESS_1'``\n\n        tile_size : int, optional\n            Compression tile sizes.  Default treats each row of image as a\n            tile.\n\n        hcomp_scale : float, optional\n            HCOMPRESS scale parameter\n\n        hcomp_smooth : float, optional\n            HCOMPRESS smooth parameter\n\n        quantize_level : float, optional\n            Floating point quantization level; see note below\n\n        quantize_method : int, optional\n            Floating point quantization dithering method; can be either\n            ``NO_DITHER`` (-1; default), ``SUBTRACTIVE_DITHER_1`` (1), or\n            ``SUBTRACTIVE_DITHER_2`` (2); see note below\n\n        dither_seed : int, optional\n            Random seed to use for dithering; can be either an integer in the\n            range 1 to 1000 (inclusive), ``DITHER_SEED_CLOCK`` (0; default), or\n            ``DITHER_SEED_CHECKSUM`` (-1); see note below\n\n        Notes\n        -----\n        The astropy.io.fits package supports 2 methods of image compression:\n\n            1) The entire FITS file may be externally compressed with the gzip\n               or pkzip utility programs, producing a ``*.gz`` or ``*.zip``\n               file, respectively.  When reading compressed files of this type,\n               Astropy first uncompresses the entire file into a temporary file\n               before performing the requested read operations.  The\n               astropy.io.fits package does not support writing to these types\n               of compressed files.  This type of compression is supported in\n               the ``_File`` class, not in the `CompImageHDU` class.  The file\n               compression type is recognized by the ``.gz`` or ``.zip`` file\n               name extension.\n\n            2) The `CompImageHDU` class supports the FITS tiled image\n               compression convention in which the image is subdivided into a\n               grid of rectangular tiles, and each tile of pixels is\n               individually compressed.  The details of this FITS compression\n               convention are described at the `FITS Support Office web site\n               <https://fits.gsfc.nasa.gov/registry/tilecompression.html>`_.\n               Basically, the compressed image tiles are stored in rows of a\n               variable length array column in a FITS binary table.  The\n               astropy.io.fits recognizes that this binary table extension\n               contains an image and treats it as if it were an image\n               extension.  Under this tile-compression format, FITS header\n               keywords remain uncompressed.  At this time, Astropy does not\n               support the ability to extract and uncompress sections of the\n               image without having to uncompress the entire image.\n\n        The astropy.io.fits package supports 3 general-purpose compression\n        algorithms plus one other special-purpose compression technique that is\n        designed for data masks with positive integer pixel values.  The 3\n        general purpose algorithms are GZIP, Rice, and HCOMPRESS, and the\n        special-purpose technique is the IRAF pixel list compression technique\n        (PLIO).  The ``compression_type`` parameter defines the compression\n        algorithm to be used.\n\n        The FITS image can be subdivided into any desired rectangular grid of\n        compression tiles.  With the GZIP, Rice, and PLIO algorithms, the\n        default is to take each row of the image as a tile.  The HCOMPRESS\n        algorithm is inherently 2-dimensional in nature, so the default in this\n        case is to take 16 rows of the image per tile.  In most cases, it makes\n        little difference what tiling pattern is used, so the default tiles are\n        usually adequate.  In the case of very small images, it could be more\n        efficient to compress the whole image as a single tile.  Note that the\n        image dimensions are not required to be an integer multiple of the tile\n        dimensions; if not, then the tiles at the edges of the image will be\n        smaller than the other tiles.  The ``tile_size`` parameter may be\n        provided as a list of tile sizes, one for each dimension in the image.\n        For example a ``tile_size`` value of ``[100,100]`` would divide a 300 X\n        300 image into 9 100 X 100 tiles.\n\n        The 4 supported image compression algorithms are all 'lossless' when\n        applied to integer FITS images; the pixel values are preserved exactly\n        with no loss of information during the compression and uncompression\n        process.  In addition, the HCOMPRESS algorithm supports a 'lossy'\n        compression mode that will produce larger amount of image compression.\n        This is achieved by specifying a non-zero value for the ``hcomp_scale``\n        parameter.  Since the amount of compression that is achieved depends\n        directly on the RMS noise in the image, it is usually more convenient\n        to specify the ``hcomp_scale`` factor relative to the RMS noise.\n        Setting ``hcomp_scale = 2.5`` means use a scale factor that is 2.5\n        times the calculated RMS noise in the image tile.  In some cases it may\n        be desirable to specify the exact scaling to be used, instead of\n        specifying it relative to the calculated noise value.  This may be done\n        by specifying the negative of the desired scale value (typically in the\n        range -2 to -100).\n\n        Very high compression factors (of 100 or more) can be achieved by using\n        large ``hcomp_scale`` values, however, this can produce undesirable\n        'blocky' artifacts in the compressed image.  A variation of the\n        HCOMPRESS algorithm (called HSCOMPRESS) can be used in this case to\n        apply a small amount of smoothing of the image when it is uncompressed\n        to help cover up these artifacts.  This smoothing is purely cosmetic\n        and does not cause any significant change to the image pixel values.\n        Setting the ``hcomp_smooth`` parameter to 1 will engage the smoothing\n        algorithm.\n\n        Floating point FITS images (which have ``BITPIX`` = -32 or -64) usually\n        contain too much 'noise' in the least significant bits of the mantissa\n        of the pixel values to be effectively compressed with any lossless\n        algorithm.  Consequently, floating point images are first quantized\n        into scaled integer pixel values (and thus throwing away much of the\n        noise) before being compressed with the specified algorithm (either\n        GZIP, RICE, or HCOMPRESS).  This technique produces much higher\n        compression factors than simply using the GZIP utility to externally\n        compress the whole FITS file, but it also means that the original\n        floating point value pixel values are not exactly preserved.  When done\n        properly, this integer scaling technique will only discard the\n        insignificant noise while still preserving all the real information in\n        the image.  The amount of precision that is retained in the pixel\n        values is controlled by the ``quantize_level`` parameter.  Larger\n        values will result in compressed images whose pixels more closely match\n        the floating point pixel values, but at the same time the amount of\n        compression that is achieved will be reduced.  Users should experiment\n        with different values for this parameter to determine the optimal value\n        that preserves all the useful information in the image, without\n        needlessly preserving all the 'noise' which will hurt the compression\n        efficiency.\n\n        The default value for the ``quantize_level`` scale factor is 16, which\n        means that scaled integer pixel values will be quantized such that the\n        difference between adjacent integer values will be 1/16th of the noise\n        level in the image background.  An optimized algorithm is used to\n        accurately estimate the noise in the image.  As an example, if the RMS\n        noise in the background pixels of an image = 32.0, then the spacing\n        between adjacent scaled integer pixel values will equal 2.0 by default.\n        Note that the RMS noise is independently calculated for each tile of\n        the image, so the resulting integer scaling factor may fluctuate\n        slightly for each tile.  In some cases, it may be desirable to specify\n        the exact quantization level to be used, instead of specifying it\n        relative to the calculated noise value.  This may be done by specifying\n        the negative of desired quantization level for the value of\n        ``quantize_level``.  In the previous example, one could specify\n        ``quantize_level = -2.0`` so that the quantized integer levels differ\n        by 2.0.  Larger negative values for ``quantize_level`` means that the\n        levels are more coarsely-spaced, and will produce higher compression\n        factors.\n\n        The quantization algorithm can also apply one of two random dithering\n        methods in order to reduce bias in the measured intensity of background\n        regions.  The default method, specified with the constant\n        ``SUBTRACTIVE_DITHER_1`` adds dithering to the zero-point of the\n        quantization array itself rather than adding noise to the actual image.\n        The random noise is added on a pixel-by-pixel basis, so in order\n        restore each pixel from its integer value to its floating point value\n        it is necessary to replay the same sequence of random numbers for each\n        pixel (see below).  The other method, ``SUBTRACTIVE_DITHER_2``, is\n        exactly like the first except that before dithering any pixel with a\n        floating point value of ``0.0`` is replaced with the special integer\n        value ``-2147483647``.  When the image is uncompressed, pixels with\n        this value are restored back to ``0.0`` exactly.  Finally, a value of\n        ``NO_DITHER`` disables dithering entirely.\n\n        As mentioned above, when using the subtractive dithering algorithm it\n        is necessary to be able to generate a (pseudo-)random sequence of noise\n        for each pixel, and replay that same sequence upon decompressing.  To\n        facilitate this, a random seed between 1 and 10000 (inclusive) is used\n        to seed a random number generator, and that seed is stored in the\n        ``ZDITHER0`` keyword in the header of the compressed HDU.  In order to\n        use that seed to generate the same sequence of random numbers the same\n        random number generator must be used at compression and decompression\n        time; for that reason the tiled image convention provides an\n        implementation of a very simple pseudo-random number generator.  The\n        seed itself can be provided in one of three ways, controllable by the\n        ``dither_seed`` argument:  It may be specified manually, or it may be\n        generated arbitrarily based on the system's clock\n        (``DITHER_SEED_CLOCK``) or based on a checksum of the pixels in the\n        image's first tile (``DITHER_SEED_CHECKSUM``).  The clock-based method\n        is the default, and is sufficient to ensure that the value is\n        reasonably \"arbitrary\" and that the same seed is unlikely to be\n        generated sequentially.  The checksum method, on the other hand,\n        ensures that the same seed is used every time for a specific image.\n        This is particularly useful for software testing as it ensures that the\n        same image will always use the same seed.\n        \"\"\"\n\n        if not COMPRESSION_SUPPORTED:\n            # TODO: Raise a more specific Exception type\n            raise Exception('The astropy.io.fits.compression module is not '\n                            'available.  Creation of compressed image HDUs is '\n                            'disabled.')\n\n        compression_type = CMTYPE_ALIASES.get(compression_type, compression_type)\n\n        if data is DELAYED:\n            # Reading the HDU from a file\n            super().__init__(data=data, header=header)\n        else:\n            # Create at least a skeleton HDU that matches the input\n            # header and data (if any were input)\n            super().__init__(data=None, header=header)\n\n            # Store the input image data\n            self.data = data\n\n            # Update the table header (_header) to the compressed\n            # image format and to match the input data (if any);\n            # Create the image header (_image_header) from the input\n            # image header (if any) and ensure it matches the input\n            # data; Create the initially empty table data array to\n            # hold the compressed data.\n            self._update_header_data(header, name,\n                                     compression_type=compression_type,\n                                     tile_size=tile_size,\n                                     hcomp_scale=hcomp_scale,\n                                     hcomp_smooth=hcomp_smooth,\n                                     quantize_level=quantize_level,\n                                     quantize_method=quantize_method,\n                                     dither_seed=dither_seed)\n\n        # TODO: A lot of this should be passed on to an internal image HDU o\n        # something like that, see ticket #88\n        self._do_not_scale_image_data = do_not_scale_image_data\n        self._uint = uint\n        self._scale_back = scale_back\n\n        self._axes = [self._header.get('ZNAXIS' + str(axis + 1), 0)\n                      for axis in range(self._header.get('ZNAXIS', 0))]\n\n        # store any scale factors from the table header\n        if do_not_scale_image_data:\n            self._bzero = 0\n            self._bscale = 1\n        else:\n            self._bzero = self._header.get('BZERO', 0)\n            self._bscale = self._header.get('BSCALE', 1)\n        self._bitpix = self._header['ZBITPIX']\n\n        self._orig_bzero = self._bzero\n        self._orig_bscale = self._bscale\n        self._orig_bitpix = self._bitpix\n\n    def _remove_unnecessary_default_extnames(self, header):\n        \"\"\"Remove default EXTNAME values if they are unnecessary.\n\n        Some data files (eg from CFHT) can have the default EXTNAME and\n        an explicit value.  This method removes the default if a more\n        specific header exists. It also removes any duplicate default\n        values.\n        \"\"\"\n        if 'EXTNAME' in header:\n            indices = header._keyword_indices['EXTNAME']\n            # Only continue if there is more than one found\n            n_extname = len(indices)\n            if n_extname > 1:\n                extnames_to_remove = [index for index in indices\n                                      if header[index] == self._default_name]\n                if len(extnames_to_remove) == n_extname:\n                    # Keep the first (they are all the same)\n                    extnames_to_remove.pop(0)\n                # Remove them all in reverse order to keep the index unchanged.\n                for index in reversed(sorted(extnames_to_remove)):\n                    del header[index]\n\n    @property\n    def name(self):\n        # Convert the value to a string to be flexible in some pathological\n        # cases (see ticket #96)\n        # Similar to base class but uses .header rather than ._header\n        return str(self.header.get('EXTNAME', self._default_name))\n\n    @name.setter\n    def name(self, value):\n        # This is a copy of the base class but using .header instead\n        # of ._header to ensure that the name stays in sync.\n        if not isinstance(value, str):\n            raise TypeError(\"'name' attribute must be a string\")\n        if not conf.extension_name_case_sensitive:\n            value = value.upper()\n        if 'EXTNAME' in self.header:\n            self.header['EXTNAME'] = value\n        else:\n            self.header['EXTNAME'] = (value, 'extension name')\n\n    @classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        if card.keyword != 'XTENSION':\n            return False\n\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n\n        if xtension not in ('BINTABLE', 'A3DTABLE'):\n            return False\n\n        if 'ZIMAGE' not in header or not header['ZIMAGE']:\n            return False\n\n        if COMPRESSION_SUPPORTED and COMPRESSION_ENABLED:\n            return True\n        elif not COMPRESSION_SUPPORTED:\n            warnings.warn('Failure matching header to a compressed image '\n                          'HDU: The compression module is not available.\\n'\n                          'The HDU will be treated as a Binary Table HDU.',\n                          AstropyUserWarning)\n            return False\n        else:\n            # Compression is supported but disabled; just pass silently (#92)\n            return False\n\n    def _update_header_data(self, image_header,\n                            name=None,\n                            compression_type=None,\n                            tile_size=None,\n                            hcomp_scale=None,\n                            hcomp_smooth=None,\n                            quantize_level=None,\n                            quantize_method=None,\n                            dither_seed=None):\n        \"\"\"\n        Update the table header (`_header`) to the compressed\n        image format and to match the input data (if any).  Create\n        the image header (`_image_header`) from the input image\n        header (if any) and ensure it matches the input\n        data. Create the initially-empty table data array to hold\n        the compressed data.\n\n        This method is mainly called internally, but a user may wish to\n        call this method after assigning new data to the `CompImageHDU`\n        object that is of a different type.\n\n        Parameters\n        ----------\n        image_header : `~astropy.io.fits.Header`\n            header to be associated with the image\n\n        name : str, optional\n            the ``EXTNAME`` value; if this value is `None`, then the name from\n            the input image header will be used; if there is no name in the\n            input image header then the default name 'COMPRESSED_IMAGE' is used\n\n        compression_type : str, optional\n            compression algorithm 'RICE_1', 'PLIO_1', 'GZIP_1', 'GZIP_2',\n            'HCOMPRESS_1'; if this value is `None`, use value already in the\n            header; if no value already in the header, use 'RICE_1'\n\n        tile_size : sequence of int, optional\n            compression tile sizes as a list; if this value is `None`, use\n            value already in the header; if no value already in the header,\n            treat each row of image as a tile\n\n        hcomp_scale : float, optional\n            HCOMPRESS scale parameter; if this value is `None`, use the value\n            already in the header; if no value already in the header, use 1\n\n        hcomp_smooth : float, optional\n            HCOMPRESS smooth parameter; if this value is `None`, use the value\n            already in the header; if no value already in the header, use 0\n\n        quantize_level : float, optional\n            floating point quantization level; if this value is `None`, use the\n            value already in the header; if no value already in header, use 16\n\n        quantize_method : int, optional\n            floating point quantization dithering method; can be either\n            NO_DITHER (-1), SUBTRACTIVE_DITHER_1 (1; default), or\n            SUBTRACTIVE_DITHER_2 (2)\n\n        dither_seed : int, optional\n            random seed to use for dithering; can be either an integer in the\n            range 1 to 1000 (inclusive), DITHER_SEED_CLOCK (0; default), or\n            DITHER_SEED_CHECKSUM (-1)\n        \"\"\"\n\n        # Clean up EXTNAME duplicates\n        self._remove_unnecessary_default_extnames(self._header)\n\n        image_hdu = ImageHDU(data=self.data, header=self._header)\n        self._image_header = CompImageHeader(self._header, image_hdu.header)\n        self._axes = image_hdu._axes\n        del image_hdu\n\n        # Determine based on the size of the input data whether to use the Q\n        # column format to store compressed data or the P format.\n        # The Q format is used only if the uncompressed data is larger than\n        # 4 GB.  This is not a perfect heuristic, as one can contrive an input\n        # array which, when compressed, the entire binary table representing\n        # the compressed data is larger than 4GB.  That said, this is the same\n        # heuristic used by CFITSIO, so this should give consistent results.\n        # And the cases where this heuristic is insufficient are extreme and\n        # almost entirely contrived corner cases, so it will do for now\n        if self._has_data:\n            huge_hdu = self.data.nbytes > 2 ** 32\n        else:\n            huge_hdu = False\n\n        # Update the extension name in the table header\n        if not name and 'EXTNAME' not in self._header:\n            # Do not sync this with the image header since the default\n            # name is specific to the table header.\n            self._header.set('EXTNAME', self._default_name,\n                             'name of this binary table extension',\n                             after='TFIELDS')\n        elif name:\n            # Force the name into table and image headers.\n            self.name = name\n\n        # Set the compression type in the table header.\n        if compression_type:\n            if compression_type not in COMPRESSION_TYPES:\n                warnings.warn(\n                    'Unknown compression type provided (supported are {}). '\n                    'Default ({}) compression will be used.'\n                    .format(', '.join(map(repr, COMPRESSION_TYPES)),\n                            DEFAULT_COMPRESSION_TYPE),\n                    AstropyUserWarning)\n                compression_type = DEFAULT_COMPRESSION_TYPE\n\n            self._header.set('ZCMPTYPE', compression_type,\n                             'compression algorithm', after='TFIELDS')\n        else:\n            compression_type = self._header.get('ZCMPTYPE',\n                                                DEFAULT_COMPRESSION_TYPE)\n            compression_type = CMTYPE_ALIASES.get(compression_type,\n                                                  compression_type)\n\n        # If the input image header had BSCALE/BZERO cards, then insert\n        # them in the table header.\n\n        if image_header:\n            bzero = image_header.get('BZERO', 0.0)\n            bscale = image_header.get('BSCALE', 1.0)\n            after_keyword = 'EXTNAME'\n\n            if bscale != 1.0:\n                self._header.set('BSCALE', bscale, after=after_keyword)\n                after_keyword = 'BSCALE'\n\n            if bzero != 0.0:\n                self._header.set('BZERO', bzero, after=after_keyword)\n\n        try:\n            bitpix_comment = image_header.comments['BITPIX']\n        except (AttributeError, KeyError):\n            bitpix_comment = 'data type of original image'\n\n        try:\n            naxis_comment = image_header.comments['NAXIS']\n        except (AttributeError, KeyError):\n            naxis_comment = 'dimension of original image'\n\n        # Set the label for the first column in the table\n\n        self._header.set('TTYPE1', 'COMPRESSED_DATA', 'label for field 1',\n                         after='TFIELDS')\n\n        # Set the data format for the first column.  It is dependent\n        # on the requested compression type.\n\n        if compression_type == 'PLIO_1':\n            tform1 = '1QI' if huge_hdu else '1PI'\n        else:\n            tform1 = '1QB' if huge_hdu else '1PB'\n\n        self._header.set('TFORM1', tform1,\n                         'data format of field: variable length array',\n                         after='TTYPE1')\n\n        # Create the first column for the table.  This column holds the\n        # compressed data.\n        col1 = Column(name=self._header['TTYPE1'], format=tform1)\n\n        # Create the additional columns required for floating point\n        # data and calculate the width of the output table.\n\n        zbitpix = self._image_header['BITPIX']\n\n        if zbitpix < 0 and quantize_level != 0.0:\n            # floating point image has 'COMPRESSED_DATA',\n            # 'UNCOMPRESSED_DATA', 'ZSCALE', and 'ZZERO' columns (unless using\n            # lossless compression, per CFITSIO)\n            ncols = 4\n\n            # CFITSIO 3.28 and up automatically use the GZIP_COMPRESSED_DATA\n            # store floating point data that couldn't be quantized, instead\n            # of the UNCOMPRESSED_DATA column.  There's no way to control\n            # this behavior so the only way to determine which behavior will\n            # be employed is via the CFITSIO version\n\n            ttype2 = 'GZIP_COMPRESSED_DATA'\n            # The required format for the GZIP_COMPRESSED_DATA is actually\n            # missing from the standard docs, but CFITSIO suggests it\n            # should be 1PB, which is logical.\n            tform2 = '1QB' if huge_hdu else '1PB'\n\n            # Set up the second column for the table that will hold any\n            # uncompressable data.\n            self._header.set('TTYPE2', ttype2, 'label for field 2',\n                             after='TFORM1')\n\n            self._header.set('TFORM2', tform2,\n                             'data format of field: variable length array',\n                             after='TTYPE2')\n\n            col2 = Column(name=ttype2, format=tform2)\n\n            # Set up the third column for the table that will hold\n            # the scale values for quantized data.\n            self._header.set('TTYPE3', 'ZSCALE', 'label for field 3',\n                             after='TFORM2')\n            self._header.set('TFORM3', '1D',\n                             'data format of field: 8-byte DOUBLE',\n                             after='TTYPE3')\n            col3 = Column(name=self._header['TTYPE3'],\n                          format=self._header['TFORM3'])\n\n            # Set up the fourth column for the table that will hold\n            # the zero values for the quantized data.\n            self._header.set('TTYPE4', 'ZZERO', 'label for field 4',\n                             after='TFORM3')\n            self._header.set('TFORM4', '1D',\n                             'data format of field: 8-byte DOUBLE',\n                             after='TTYPE4')\n            after = 'TFORM4'\n            col4 = Column(name=self._header['TTYPE4'],\n                          format=self._header['TFORM4'])\n\n            # Create the ColDefs object for the table\n            cols = ColDefs([col1, col2, col3, col4])\n        else:\n            # default table has just one 'COMPRESSED_DATA' column\n            ncols = 1\n            after = 'TFORM1'\n\n            # remove any header cards for the additional columns that\n            # may be left over from the previous data\n            to_remove = ['TTYPE2', 'TFORM2', 'TTYPE3', 'TFORM3', 'TTYPE4',\n                         'TFORM4']\n\n            for k in to_remove:\n                try:\n                    del self._header[k]\n                except KeyError:\n                    pass\n\n            # Create the ColDefs object for the table\n            cols = ColDefs([col1])\n\n        # Update the table header with the width of the table, the\n        # number of fields in the table, the indicator for a compressed\n        # image HDU, the data type of the image data and the number of\n        # dimensions in the image data array.\n        self._header.set('NAXIS1', cols.dtype.itemsize,\n                         'width of table in bytes')\n        self._header.set('TFIELDS', ncols, 'number of fields in each row',\n                         after='GCOUNT')\n        self._header.set('ZIMAGE', True, 'extension contains compressed image',\n                         after=after)\n        self._header.set('ZBITPIX', zbitpix,\n                         bitpix_comment, after='ZIMAGE')\n        self._header.set('ZNAXIS', self._image_header['NAXIS'], naxis_comment,\n                         after='ZBITPIX')\n\n        # Strip the table header of all the ZNAZISn and ZTILEn keywords\n        # that may be left over from the previous data\n\n        for idx in itertools.count(1):\n            try:\n                del self._header['ZNAXIS' + str(idx)]\n                del self._header['ZTILE' + str(idx)]\n            except KeyError:\n                break\n\n        # Verify that any input tile size parameter is the appropriate\n        # size to match the HDU's data.\n\n        naxis = self._image_header['NAXIS']\n\n        if not tile_size:\n            tile_size = []\n        elif len(tile_size) != naxis:\n            warnings.warn('Provided tile size not appropriate for the data.  '\n                          'Default tile size will be used.', AstropyUserWarning)\n            tile_size = []\n\n        # Set default tile dimensions for HCOMPRESS_1\n\n        if compression_type == 'HCOMPRESS_1':\n            if (self._image_header['NAXIS1'] < 4 or\n                    self._image_header['NAXIS2'] < 4):\n                raise ValueError('Hcompress minimum image dimension is '\n                                 '4 pixels')\n            elif tile_size:\n                if tile_size[0] < 4 or tile_size[1] < 4:\n                    # user specified tile size is too small\n                    raise ValueError('Hcompress minimum tile dimension is '\n                                     '4 pixels')\n                major_dims = len([ts for ts in tile_size if ts > 1])\n                if major_dims > 2:\n                    raise ValueError(\n                        'HCOMPRESS can only support 2-dimensional tile sizes.'\n                        'All but two of the tile_size dimensions must be set '\n                        'to 1.')\n\n            if tile_size and (tile_size[0] == 0 and tile_size[1] == 0):\n                # compress the whole image as a single tile\n                tile_size[0] = self._image_header['NAXIS1']\n                tile_size[1] = self._image_header['NAXIS2']\n\n                for i in range(2, naxis):\n                    # set all higher tile dimensions = 1\n                    tile_size[i] = 1\n            elif not tile_size:\n                # The Hcompress algorithm is inherently 2D in nature, so the\n                # row by row tiling that is used for other compression\n                # algorithms is not appropriate.  If the image has less than 30\n                # rows, then the entire image will be compressed as a single\n                # tile.  Otherwise the tiles will consist of 16 rows of the\n                # image.  This keeps the tiles to a reasonable size, and it\n                # also includes enough rows to allow good compression\n                # efficiency.  It the last tile of the image happens to contain\n                # less than 4 rows, then find another tile size with between 14\n                # and 30 rows (preferably even), so that the last tile has at\n                # least 4 rows.\n\n                # 1st tile dimension is the row length of the image\n                tile_size.append(self._image_header['NAXIS1'])\n\n                if self._image_header['NAXIS2'] <= 30:\n                    tile_size.append(self._image_header['NAXIS1'])\n                else:\n                    # look for another good tile dimension\n                    naxis2 = self._image_header['NAXIS2']\n                    for dim in [16, 24, 20, 30, 28, 26, 22, 18, 14]:\n                        if naxis2 % dim == 0 or naxis2 % dim > 3:\n                            tile_size.append(dim)\n                            break\n                    else:\n                        tile_size.append(17)\n\n                for i in range(2, naxis):\n                    # set all higher tile dimensions = 1\n                    tile_size.append(1)\n\n            # check if requested tile size causes the last tile to have\n            # less than 4 pixels\n\n            remain = self._image_header['NAXIS1'] % tile_size[0]  # 1st dimen\n\n            if remain > 0 and remain < 4:\n                tile_size[0] += 1  # try increasing tile size by 1\n\n                remain = self._image_header['NAXIS1'] % tile_size[0]\n\n                if remain > 0 and remain < 4:\n                    raise ValueError('Last tile along 1st dimension has '\n                                     'less than 4 pixels')\n\n            remain = self._image_header['NAXIS2'] % tile_size[1]  # 2nd dimen\n\n            if remain > 0 and remain < 4:\n                tile_size[1] += 1  # try increasing tile size by 1\n\n                remain = self._image_header['NAXIS2'] % tile_size[1]\n\n                if remain > 0 and remain < 4:\n                    raise ValueError('Last tile along 2nd dimension has '\n                                     'less than 4 pixels')\n\n        # Set up locations for writing the next cards in the header.\n        last_znaxis = 'ZNAXIS'\n\n        if self._image_header['NAXIS'] > 0:\n            after1 = 'ZNAXIS1'\n        else:\n            after1 = 'ZNAXIS'\n\n        # Calculate the number of rows in the output table and\n        # write the ZNAXISn and ZTILEn cards to the table header.\n        nrows = 0\n\n        for idx, axis in enumerate(self._axes):\n            naxis = 'NAXIS' + str(idx + 1)\n            znaxis = 'ZNAXIS' + str(idx + 1)\n            ztile = 'ZTILE' + str(idx + 1)\n\n            if tile_size and len(tile_size) >= idx + 1:\n                ts = tile_size[idx]\n            else:\n                if ztile not in self._header:\n                    # Default tile size\n                    if not idx:\n                        ts = self._image_header['NAXIS1']\n                    else:\n                        ts = 1\n                else:\n                    ts = self._header[ztile]\n                tile_size.append(ts)\n\n            if not nrows:\n                nrows = (axis - 1) // ts + 1\n            else:\n                nrows *= ((axis - 1) // ts + 1)\n\n            if image_header and naxis in image_header:\n                self._header.set(znaxis, axis, image_header.comments[naxis],\n                                 after=last_znaxis)\n            else:\n                self._header.set(znaxis, axis,\n                                 'length of original image axis',\n                                 after=last_znaxis)\n\n            self._header.set(ztile, ts, 'size of tiles to be compressed',\n                             after=after1)\n            last_znaxis = znaxis\n            after1 = ztile\n\n        # Set the NAXIS2 header card in the table hdu to the number of\n        # rows in the table.\n        self._header.set('NAXIS2', nrows, 'number of rows in table')\n\n        self.columns = cols\n\n        # Set the compression parameters in the table header.\n\n        # First, setup the values to be used for the compression parameters\n        # in case none were passed in.  This will be either the value\n        # already in the table header for that parameter or the default\n        # value.\n        for idx in itertools.count(1):\n            zname = 'ZNAME' + str(idx)\n            if zname not in self._header:\n                break\n            zval = 'ZVAL' + str(idx)\n            if self._header[zname] == 'NOISEBIT':\n                if quantize_level is None:\n                    quantize_level = self._header[zval]\n            if self._header[zname] == 'SCALE   ':\n                if hcomp_scale is None:\n                    hcomp_scale = self._header[zval]\n            if self._header[zname] == 'SMOOTH  ':\n                if hcomp_smooth is None:\n                    hcomp_smooth = self._header[zval]\n\n        if quantize_level is None:\n            quantize_level = DEFAULT_QUANTIZE_LEVEL\n\n        if hcomp_scale is None:\n            hcomp_scale = DEFAULT_HCOMP_SCALE\n\n        if hcomp_smooth is None:\n            hcomp_smooth = DEFAULT_HCOMP_SCALE\n\n        # Next, strip the table header of all the ZNAMEn and ZVALn keywords\n        # that may be left over from the previous data\n        for idx in itertools.count(1):\n            zname = 'ZNAME' + str(idx)\n            if zname not in self._header:\n                break\n            zval = 'ZVAL' + str(idx)\n            del self._header[zname]\n            del self._header[zval]\n\n        # Finally, put the appropriate keywords back based on the\n        # compression type.\n\n        after_keyword = 'ZCMPTYPE'\n        idx = 1\n\n        if compression_type == 'RICE_1':\n            self._header.set('ZNAME1', 'BLOCKSIZE', 'compression block size',\n                             after=after_keyword)\n            self._header.set('ZVAL1', DEFAULT_BLOCK_SIZE, 'pixels per block',\n                             after='ZNAME1')\n\n            self._header.set('ZNAME2', 'BYTEPIX',\n                             'bytes per pixel (1, 2, 4, or 8)', after='ZVAL1')\n\n            if self._header['ZBITPIX'] == 8:\n                bytepix = 1\n            elif self._header['ZBITPIX'] == 16:\n                bytepix = 2\n            else:\n                bytepix = DEFAULT_BYTE_PIX\n\n            self._header.set('ZVAL2', bytepix,\n                             'bytes per pixel (1, 2, 4, or 8)',\n                             after='ZNAME2')\n            after_keyword = 'ZVAL2'\n            idx = 3\n        elif compression_type == 'HCOMPRESS_1':\n            self._header.set('ZNAME1', 'SCALE', 'HCOMPRESS scale factor',\n                             after=after_keyword)\n            self._header.set('ZVAL1', hcomp_scale, 'HCOMPRESS scale factor',\n                             after='ZNAME1')\n            self._header.set('ZNAME2', 'SMOOTH', 'HCOMPRESS smooth option',\n                             after='ZVAL1')\n            self._header.set('ZVAL2', hcomp_smooth, 'HCOMPRESS smooth option',\n                             after='ZNAME2')\n            after_keyword = 'ZVAL2'\n            idx = 3\n\n        if self._image_header['BITPIX'] < 0:   # floating point image\n            self._header.set('ZNAME' + str(idx), 'NOISEBIT',\n                             'floating point quantization level',\n                             after=after_keyword)\n            self._header.set('ZVAL' + str(idx), quantize_level,\n                             'floating point quantization level',\n                             after='ZNAME' + str(idx))\n\n            # Add the dither method and seed\n            if quantize_method:\n                if quantize_method not in [NO_DITHER, SUBTRACTIVE_DITHER_1,\n                                           SUBTRACTIVE_DITHER_2]:\n                    name = QUANTIZE_METHOD_NAMES[DEFAULT_QUANTIZE_METHOD]\n                    warnings.warn('Unknown quantization method provided.  '\n                                  'Default method ({}) used.'.format(name))\n                    quantize_method = DEFAULT_QUANTIZE_METHOD\n\n                if quantize_method == NO_DITHER:\n                    zquantiz_comment = 'No dithering during quantization'\n                else:\n                    zquantiz_comment = 'Pixel Quantization Algorithm'\n\n                self._header.set('ZQUANTIZ',\n                                 QUANTIZE_METHOD_NAMES[quantize_method],\n                                 zquantiz_comment,\n                                 after='ZVAL' + str(idx))\n            else:\n                # If the ZQUANTIZ keyword is missing the default is to assume\n                # no dithering, rather than whatever DEFAULT_QUANTIZE_METHOD\n                # is set to\n                quantize_method = self._header.get('ZQUANTIZ', NO_DITHER)\n\n                if isinstance(quantize_method, str):\n                    for k, v in QUANTIZE_METHOD_NAMES.items():\n                        if v.upper() == quantize_method:\n                            quantize_method = k\n                            break\n                    else:\n                        quantize_method = NO_DITHER\n\n            if quantize_method == NO_DITHER:\n                if 'ZDITHER0' in self._header:\n                    # If dithering isn't being used then there's no reason to\n                    # keep the ZDITHER0 keyword\n                    del self._header['ZDITHER0']\n            else:\n                if dither_seed:\n                    dither_seed = self._generate_dither_seed(dither_seed)\n                elif 'ZDITHER0' in self._header:\n                    dither_seed = self._header['ZDITHER0']\n                else:\n                    dither_seed = self._generate_dither_seed(\n                            DEFAULT_DITHER_SEED)\n\n                self._header.set('ZDITHER0', dither_seed,\n                                 'dithering offset when quantizing floats',\n                                 after='ZQUANTIZ')\n\n        if image_header:\n            # Move SIMPLE card from the image header to the\n            # table header as ZSIMPLE card.\n\n            if 'SIMPLE' in image_header:\n                self._header.set('ZSIMPLE', image_header['SIMPLE'],\n                                 image_header.comments['SIMPLE'],\n                                 before='ZBITPIX')\n\n            # Move EXTEND card from the image header to the\n            # table header as ZEXTEND card.\n\n            if 'EXTEND' in image_header:\n                self._header.set('ZEXTEND', image_header['EXTEND'],\n                                 image_header.comments['EXTEND'])\n\n            # Move BLOCKED card from the image header to the\n            # table header as ZBLOCKED card.\n\n            if 'BLOCKED' in image_header:\n                self._header.set('ZBLOCKED', image_header['BLOCKED'],\n                                 image_header.comments['BLOCKED'])\n\n            # Move XTENSION card from the image header to the\n            # table header as ZTENSION card.\n\n            # Since we only handle compressed IMAGEs, ZTENSION should\n            # always be IMAGE, even if the caller has passed in a header\n            # for some other type of extension.\n            if 'XTENSION' in image_header:\n                self._header.set('ZTENSION', 'IMAGE',\n                                 image_header.comments['XTENSION'],\n                                 before='ZBITPIX')\n\n            # Move PCOUNT and GCOUNT cards from image header to the table\n            # header as ZPCOUNT and ZGCOUNT cards.\n\n            if 'PCOUNT' in image_header:\n                self._header.set('ZPCOUNT', image_header['PCOUNT'],\n                                 image_header.comments['PCOUNT'],\n                                 after=last_znaxis)\n\n            if 'GCOUNT' in image_header:\n                self._header.set('ZGCOUNT', image_header['GCOUNT'],\n                                 image_header.comments['GCOUNT'],\n                                 after='ZPCOUNT')\n\n            # Move CHECKSUM and DATASUM cards from the image header to the\n            # table header as XHECKSUM and XDATASUM cards.\n\n            if 'CHECKSUM' in image_header:\n                self._header.set('ZHECKSUM', image_header['CHECKSUM'],\n                                 image_header.comments['CHECKSUM'])\n\n            if 'DATASUM' in image_header:\n                self._header.set('ZDATASUM', image_header['DATASUM'],\n                                 image_header.comments['DATASUM'])\n        else:\n            # Move XTENSION card from the image header to the\n            # table header as ZTENSION card.\n\n            # Since we only handle compressed IMAGEs, ZTENSION should\n            # always be IMAGE, even if the caller has passed in a header\n            # for some other type of extension.\n            if 'XTENSION' in self._image_header:\n                self._header.set('ZTENSION', 'IMAGE',\n                                 self._image_header.comments['XTENSION'],\n                                 before='ZBITPIX')\n\n            # Move PCOUNT and GCOUNT cards from image header to the table\n            # header as ZPCOUNT and ZGCOUNT cards.\n\n            if 'PCOUNT' in self._image_header:\n                self._header.set('ZPCOUNT', self._image_header['PCOUNT'],\n                                 self._image_header.comments['PCOUNT'],\n                                 after=last_znaxis)\n\n            if 'GCOUNT' in self._image_header:\n                self._header.set('ZGCOUNT', self._image_header['GCOUNT'],\n                                 self._image_header.comments['GCOUNT'],\n                                 after='ZPCOUNT')\n\n        # When we have an image checksum we need to ensure that the same\n        # number of blank cards exist in the table header as there were in\n        # the image header.  This allows those blank cards to be carried\n        # over to the image header when the hdu is uncompressed.\n\n        if 'ZHECKSUM' in self._header:\n            required_blanks = image_header._countblanks()\n            image_blanks = self._image_header._countblanks()\n            table_blanks = self._header._countblanks()\n\n            for _ in range(required_blanks - image_blanks):\n                self._image_header.append()\n                table_blanks += 1\n\n            for _ in range(required_blanks - table_blanks):\n                self._header.append()\n\n    @lazyproperty\n    def data(self):\n        # The data attribute is the image data (not the table data).\n        data = compression.decompress_hdu(self)\n\n        if data is None:\n            return data\n\n        # Scale the data if necessary\n        if (self._orig_bzero != 0 or self._orig_bscale != 1):\n            new_dtype = self._dtype_for_bitpix()\n            data = np.array(data, dtype=new_dtype)\n\n            zblank = None\n\n            if 'ZBLANK' in self.compressed_data.columns.names:\n                zblank = self.compressed_data['ZBLANK']\n            else:\n                if 'ZBLANK' in self._header:\n                    zblank = np.array(self._header['ZBLANK'], dtype='int32')\n                elif 'BLANK' in self._header:\n                    zblank = np.array(self._header['BLANK'], dtype='int32')\n\n            if zblank is not None:\n                blanks = (data == zblank)\n\n            if self._bscale != 1:\n                np.multiply(data, self._bscale, data)\n            if self._bzero != 0:\n                # We have to explicitly cast self._bzero to prevent numpy from\n                # raising an error when doing self.data += self._bzero, and we\n                # do this instead of self.data = self.data + self._bzero to\n                # avoid doubling memory usage.\n                np.add(data, self._bzero, out=data, casting='unsafe')\n\n            if zblank is not None:\n                data = np.where(blanks, np.nan, data)\n\n        # Right out of _ImageBaseHDU.data\n        self._update_header_scale_info(data.dtype)\n\n        return data\n\n    @data.setter\n    def data(self, data):\n        if (data is not None) and (not isinstance(data, np.ndarray) or\n                data.dtype.fields is not None):\n            raise TypeError('CompImageHDU data has incorrect type:{}; '\n                            'dtype.fields = {}'.format(\n                    type(data), data.dtype.fields))\n\n    @lazyproperty\n    def compressed_data(self):\n        # First we will get the table data (the compressed\n        # data) from the file, if there is any.\n        compressed_data = super().data\n        if isinstance(compressed_data, np.rec.recarray):\n            # Make sure not to use 'del self.data' so we don't accidentally\n            # go through the self.data.fdel and close the mmap underlying\n            # the compressed_data array\n            del self.__dict__['data']\n            return compressed_data\n        else:\n            # This will actually set self.compressed_data with the\n            # pre-allocated space for the compression data; this is something I\n            # might do away with in the future\n            self._update_compressed_data()\n\n        return self.compressed_data\n\n    @compressed_data.deleter\n    def compressed_data(self):\n        # Deleting the compressed_data attribute has to be handled\n        # with a little care to prevent a reference leak\n        # First delete the ._coldefs attributes under it to break a possible\n        # reference cycle\n        if 'compressed_data' in self.__dict__:\n            del self.__dict__['compressed_data']._coldefs\n\n            # Now go ahead and delete from self.__dict__; normally\n            # lazyproperty.__delete__ does this for us, but we can prempt it to\n            # do some additional cleanup\n            del self.__dict__['compressed_data']\n\n            # If this file was mmap'd, numpy.memmap will hold open a file\n            # handle until the underlying mmap object is garbage-collected;\n            # since this reference leak can sometimes hang around longer than\n            # welcome go ahead and force a garbage collection\n            gc.collect()\n\n    @property\n    def shape(self):\n        \"\"\"\n        Shape of the image array--should be equivalent to ``self.data.shape``.\n        \"\"\"\n\n        # Determine from the values read from the header\n        return tuple(reversed(self._axes))\n\n    @lazyproperty\n    def header(self):\n        # The header attribute is the header for the image data.  It\n        # is not actually stored in the object dictionary.  Instead,\n        # the _image_header is stored.  If the _image_header attribute\n        # has already been defined we just return it.  If not, we must\n        # create it from the table header (the _header attribute).\n        if hasattr(self, '_image_header'):\n            return self._image_header\n\n        # Clean up any possible doubled EXTNAME keywords that use\n        # the default. Do this on the original header to ensure\n        # duplicates are removed cleanly.\n        self._remove_unnecessary_default_extnames(self._header)\n\n        # Start with a copy of the table header.\n        image_header = self._header.copy()\n\n        # Delete cards that are related to the table.  And move\n        # the values of those cards that relate to the image from\n        # their corresponding table cards.  These include\n        # ZBITPIX -> BITPIX, ZNAXIS -> NAXIS, and ZNAXISn -> NAXISn.\n        # (Note: Used set here instead of list in case there are any duplicate\n        # keywords, which there may be in some pathological cases:\n        # https://github.com/astropy/astropy/issues/2750\n        for keyword in set(image_header):\n            if CompImageHeader._is_reserved_keyword(keyword, warn=False):\n                del image_header[keyword]\n\n        if 'ZSIMPLE' in self._header:\n            image_header.set('SIMPLE', self._header['ZSIMPLE'],\n                             self._header.comments['ZSIMPLE'], before=0)\n        elif 'ZTENSION' in self._header:\n            if self._header['ZTENSION'] != 'IMAGE':\n                warnings.warn(\"ZTENSION keyword in compressed \"\n                              \"extension != 'IMAGE'\", AstropyUserWarning)\n            image_header.set('XTENSION', 'IMAGE',\n                             self._header.comments['ZTENSION'], before=0)\n        else:\n            image_header.set('XTENSION', 'IMAGE', before=0)\n\n        image_header.set('BITPIX', self._header['ZBITPIX'],\n                         self._header.comments['ZBITPIX'], before=1)\n\n        image_header.set('NAXIS', self._header['ZNAXIS'],\n                         self._header.comments['ZNAXIS'], before=2)\n\n        last_naxis = 'NAXIS'\n        for idx in range(image_header['NAXIS']):\n            znaxis = 'ZNAXIS' + str(idx + 1)\n            naxis = znaxis[1:]\n            image_header.set(naxis, self._header[znaxis],\n                             self._header.comments[znaxis],\n                             after=last_naxis)\n            last_naxis = naxis\n\n        # Delete any other spurious NAXISn keywords:\n        naxis = image_header['NAXIS']\n        for keyword in list(image_header['NAXIS?*']):\n            try:\n                n = int(keyword[5:])\n            except Exception:\n                continue\n\n            if n > naxis:\n                del image_header[keyword]\n\n        # Although PCOUNT and GCOUNT are considered mandatory for IMAGE HDUs,\n        # ZPCOUNT and ZGCOUNT are optional, probably because for IMAGE HDUs\n        # their values are always 0 and 1 respectively\n        if 'ZPCOUNT' in self._header:\n            image_header.set('PCOUNT', self._header['ZPCOUNT'],\n                             self._header.comments['ZPCOUNT'],\n                             after=last_naxis)\n        else:\n            image_header.set('PCOUNT', 0, after=last_naxis)\n\n        if 'ZGCOUNT' in self._header:\n            image_header.set('GCOUNT', self._header['ZGCOUNT'],\n                             self._header.comments['ZGCOUNT'],\n                             after='PCOUNT')\n        else:\n            image_header.set('GCOUNT', 1, after='PCOUNT')\n\n        if 'ZEXTEND' in self._header:\n            image_header.set('EXTEND', self._header['ZEXTEND'],\n                             self._header.comments['ZEXTEND'])\n\n        if 'ZBLOCKED' in self._header:\n            image_header.set('BLOCKED', self._header['ZBLOCKED'],\n                             self._header.comments['ZBLOCKED'])\n\n        # Move the ZHECKSUM and ZDATASUM cards to the image header\n        # as CHECKSUM and DATASUM\n        if 'ZHECKSUM' in self._header:\n            image_header.set('CHECKSUM', self._header['ZHECKSUM'],\n                             self._header.comments['ZHECKSUM'])\n\n        if 'ZDATASUM' in self._header:\n            image_header.set('DATASUM', self._header['ZDATASUM'],\n                             self._header.comments['ZDATASUM'])\n\n        # Remove the EXTNAME card if the value in the table header\n        # is the default value of COMPRESSED_IMAGE.\n        if ('EXTNAME' in image_header and\n                image_header['EXTNAME'] == self._default_name):\n            del image_header['EXTNAME']\n\n        # Look to see if there are any blank cards in the table\n        # header.  If there are, there should be the same number\n        # of blank cards in the image header.  Add blank cards to\n        # the image header to make it so.\n        table_blanks = self._header._countblanks()\n        image_blanks = image_header._countblanks()\n\n        for _ in range(table_blanks - image_blanks):\n            image_header.append()\n\n        # Create the CompImageHeader that syncs with the table header, and save\n        # it off to self._image_header so it can be referenced later\n        # unambiguously\n        self._image_header = CompImageHeader(self._header, image_header)\n\n        return self._image_header\n\n    def _summary(self):\n        \"\"\"\n        Summarize the HDU: name, dimensions, and formats.\n        \"\"\"\n        class_name = self.__class__.__name__\n\n        # if data is touched, use data info.\n        if self._data_loaded:\n            if self.data is None:\n                _shape, _format = (), ''\n            else:\n\n                # the shape will be in the order of NAXIS's which is the\n                # reverse of the numarray shape\n                _shape = list(self.data.shape)\n                _format = self.data.dtype.name\n                _shape.reverse()\n                _shape = tuple(_shape)\n                _format = _format[_format.rfind('.') + 1:]\n\n        # if data is not touched yet, use header info.\n        else:\n            _shape = ()\n\n            for idx in range(self.header['NAXIS']):\n                _shape += (self.header['NAXIS' + str(idx + 1)],)\n\n            _format = BITPIX2DTYPE[self.header['BITPIX']]\n\n        return (self.name, self.ver, class_name, len(self.header), _shape,\n                _format)\n\n    def _update_compressed_data(self):\n        \"\"\"\n        Compress the image data so that it may be written to a file.\n        \"\"\"\n\n        # Check to see that the image_header matches the image data\n        image_bitpix = DTYPE2BITPIX[self.data.dtype.name]\n\n        if image_bitpix != self._orig_bitpix or self.data.shape != self.shape:\n            self._update_header_data(self.header)\n\n        # TODO: This is copied right out of _ImageBaseHDU._writedata_internal;\n        # it would be cool if we could use an internal ImageHDU and use that to\n        # write to a buffer for compression or something. See ticket #88\n        # deal with unsigned integer 16, 32 and 64 data\n        old_data = self.data\n        if _is_pseudo_integer(self.data.dtype):\n            # Convert the unsigned array to signed\n            self.data = np.array(\n                self.data - _pseudo_zero(self.data.dtype),\n                dtype=f'=i{self.data.dtype.itemsize}')\n            should_swap = False\n        else:\n            should_swap = not self.data.dtype.isnative\n\n        if should_swap:\n\n            if self.data.flags.writeable:\n                self.data.byteswap(True)\n            else:\n                # For read-only arrays, there is no way around making\n                # a byteswapped copy of the data.\n                self.data = self.data.byteswap(False)\n\n        try:\n            nrows = self._header['NAXIS2']\n            tbsize = self._header['NAXIS1'] * nrows\n\n            self._header['PCOUNT'] = 0\n            if 'THEAP' in self._header:\n                del self._header['THEAP']\n            self._theap = tbsize\n\n            # First delete the original compressed data, if it exists\n            del self.compressed_data\n\n            # Make sure that the data is contiguous otherwise CFITSIO\n            # will not write the expected data\n            self.data = np.ascontiguousarray(self.data)\n\n            # Compress the data.\n            # The current implementation of compress_hdu assumes the empty\n            # compressed data table has already been initialized in\n            # self.compressed_data, and writes directly to it\n            # compress_hdu returns the size of the heap for the written\n            # compressed image table\n            heapsize, self.compressed_data = compression.compress_hdu(self)\n        finally:\n            # if data was byteswapped return it to its original order\n            if should_swap:\n                self.data.byteswap(True)\n            self.data = old_data\n\n        # CFITSIO will write the compressed data in big-endian order\n        dtype = self.columns.dtype.newbyteorder('>')\n        buf = self.compressed_data\n        compressed_data = buf[:self._theap].view(dtype=dtype,\n                                                 type=np.rec.recarray)\n        self.compressed_data = compressed_data.view(FITS_rec)\n        self.compressed_data._coldefs = self.columns\n        self.compressed_data._heapoffset = self._theap\n        self.compressed_data._heapsize = heapsize\n\n    def scale(self, type=None, option='old', bscale=1, bzero=0):\n        \"\"\"\n        Scale image data by using ``BSCALE`` and ``BZERO``.\n\n        Calling this method will scale ``self.data`` and update the keywords of\n        ``BSCALE`` and ``BZERO`` in ``self._header`` and ``self._image_header``.\n        This method should only be used right before writing to the output\n        file, as the data will be scaled and is therefore not very usable after\n        the call.\n\n        Parameters\n        ----------\n\n        type : str, optional\n            destination data type, use a string representing a numpy dtype\n            name, (e.g. ``'uint8'``, ``'int16'``, ``'float32'`` etc.).  If is\n            `None`, use the current data type.\n\n        option : str, optional\n            how to scale the data: if ``\"old\"``, use the original ``BSCALE``\n            and ``BZERO`` values when the data was read/created. If\n            ``\"minmax\"``, use the minimum and maximum of the data to scale.\n            The option will be overwritten by any user-specified bscale/bzero\n            values.\n\n        bscale, bzero : int, optional\n            user specified ``BSCALE`` and ``BZERO`` values.\n        \"\"\"\n\n        if self.data is None:\n            return\n\n        # Determine the destination (numpy) data type\n        if type is None:\n            type = BITPIX2DTYPE[self._bitpix]\n        _type = getattr(np, type)\n\n        # Determine how to scale the data\n        # bscale and bzero takes priority\n        if (bscale != 1 or bzero != 0):\n            _scale = bscale\n            _zero = bzero\n        else:\n            if option == 'old':\n                _scale = self._orig_bscale\n                _zero = self._orig_bzero\n            elif option == 'minmax':\n                if isinstance(_type, np.floating):\n                    _scale = 1\n                    _zero = 0\n                else:\n                    _min = np.minimum.reduce(self.data.flat)\n                    _max = np.maximum.reduce(self.data.flat)\n\n                    if _type == np.uint8:  # uint8 case\n                        _zero = _min\n                        _scale = (_max - _min) / (2. ** 8 - 1)\n                    else:\n                        _zero = (_max + _min) / 2.\n\n                        # throw away -2^N\n                        _scale = (_max - _min) / (2. ** (8 * _type.bytes) - 2)\n\n        # Do the scaling\n        if _zero != 0:\n            # We have to explicitly cast self._bzero to prevent numpy from\n            # raising an error when doing self.data -= _zero, and we\n            # do this instead of self.data = self.data - _zero to\n            # avoid doubling memory usage.\n            np.subtract(self.data, _zero, out=self.data, casting='unsafe')\n            self.header['BZERO'] = _zero\n        else:\n            # Delete from both headers\n            for header in (self.header, self._header):\n                with suppress(KeyError):\n                    del header['BZERO']\n\n        if _scale != 1:\n            self.data /= _scale\n            self.header['BSCALE'] = _scale\n        else:\n            for header in (self.header, self._header):\n                with suppress(KeyError):\n                    del header['BSCALE']\n\n        if self.data.dtype.type != _type:\n            self.data = np.array(np.around(self.data), dtype=_type)  # 0.7.7.1\n\n        # Update the BITPIX Card to match the data\n        self._bitpix = DTYPE2BITPIX[self.data.dtype.name]\n        self._bzero = self.header.get('BZERO', 0)\n        self._bscale = self.header.get('BSCALE', 1)\n        # Update BITPIX for the image header specifically\n        # TODO: Make this more clear by using self._image_header, but only once\n        # this has been fixed so that the _image_header attribute is guaranteed\n        # to be valid\n        self.header['BITPIX'] = self._bitpix\n\n        # Update the table header to match the scaled data\n        self._update_header_data(self.header)\n\n        # Since the image has been manually scaled, the current\n        # bitpix/bzero/bscale now serve as the 'original' scaling of the image,\n        # as though the original image has been completely replaced\n        self._orig_bitpix = self._bitpix\n        self._orig_bzero = self._bzero\n        self._orig_bscale = self._bscale\n\n    def _prewriteto(self, checksum=False, inplace=False):\n        if self._scale_back:\n            self.scale(BITPIX2DTYPE[self._orig_bitpix])\n\n        if self._has_data:\n            self._update_compressed_data()\n\n            # Use methods in the superclass to update the header with\n            # scale/checksum keywords based on the data type of the image data\n            self._update_pseudo_int_scale_keywords()\n\n            # Shove the image header and data into a new ImageHDU and use that\n            # to compute the image checksum\n            image_hdu = ImageHDU(data=self.data, header=self.header)\n            image_hdu._update_checksum(checksum)\n            if 'CHECKSUM' in image_hdu.header:\n                # This will also pass through to the ZHECKSUM keyword and\n                # ZDATASUM keyword\n                self._image_header.set('CHECKSUM',\n                                       image_hdu.header['CHECKSUM'],\n                                       image_hdu.header.comments['CHECKSUM'])\n            if 'DATASUM' in image_hdu.header:\n                self._image_header.set('DATASUM', image_hdu.header['DATASUM'],\n                                       image_hdu.header.comments['DATASUM'])\n            # Store a temporary backup of self.data in a different attribute;\n            # see below\n            self._imagedata = self.data\n\n            # Now we need to perform an ugly hack to set the compressed data as\n            # the .data attribute on the HDU so that the call to _writedata\n            # handles it properly\n            self.__dict__['data'] = self.compressed_data\n\n        return super()._prewriteto(checksum=checksum, inplace=inplace)\n\n    def _writeheader(self, fileobj):\n        \"\"\"\n        Bypasses `BinTableHDU._writeheader()` which updates the header with\n        metadata about the data that is meaningless here; another reason\n        why this class maybe shouldn't inherit directly from BinTableHDU...\n        \"\"\"\n\n        return ExtensionHDU._writeheader(self, fileobj)\n\n    def _writedata(self, fileobj):\n        \"\"\"\n        Wrap the basic ``_writedata`` method to restore the ``.data``\n        attribute to the uncompressed image data in the case of an exception.\n        \"\"\"\n\n        try:\n            return super()._writedata(fileobj)\n        finally:\n            # Restore the .data attribute to its rightful value (if any)\n            if hasattr(self, '_imagedata'):\n                self.__dict__['data'] = self._imagedata\n                del self._imagedata\n            else:\n                del self.data\n\n    def _close(self, closed=True):\n        super()._close(closed=closed)\n\n        # Also make sure to close access to the compressed data mmaps\n        if (closed and self._data_loaded and\n                _get_array_mmap(self.compressed_data) is not None):\n            del self.compressed_data\n\n    # TODO: This was copied right out of _ImageBaseHDU; get rid of it once we\n    # find a way to rewrite this class as either a subclass or wrapper for an\n    # ImageHDU\n    def _dtype_for_bitpix(self):\n        \"\"\"\n        Determine the dtype that the data should be converted to depending on\n        the BITPIX value in the header, and possibly on the BSCALE value as\n        well.  Returns None if there should not be any change.\n        \"\"\"\n\n        bitpix = self._orig_bitpix\n        # Handle possible conversion to uints if enabled\n        if self._uint and self._orig_bscale == 1:\n            for bits, dtype in ((16, np.dtype('uint16')),\n                                (32, np.dtype('uint32')),\n                                (64, np.dtype('uint64'))):\n                if bitpix == bits and self._orig_bzero == 1 << (bits - 1):\n                    return dtype\n\n        if bitpix > 16:  # scale integers to Float64\n            return np.dtype('float64')\n        elif bitpix > 0:  # scale integers to Float32\n            return np.dtype('float32')\n\n    def _update_header_scale_info(self, dtype=None):\n        if (not self._do_not_scale_image_data and\n                not (self._orig_bzero == 0 and self._orig_bscale == 1)):\n            for keyword in ['BSCALE', 'BZERO']:\n                # Make sure to delete from both the image header and the table\n                # header; later this will be streamlined\n                for header in (self.header, self._header):\n                    with suppress(KeyError):\n                        del header[keyword]\n                        # Since _update_header_scale_info can, currently, be\n                        # called *after* _prewriteto(), replace these with\n                        # blank cards so the header size doesn't change\n                        header.append()\n\n            if dtype is None:\n                dtype = self._dtype_for_bitpix()\n            if dtype is not None:\n                self.header['BITPIX'] = DTYPE2BITPIX[dtype.name]\n\n            self._bzero = 0\n            self._bscale = 1\n            self._bitpix = self.header['BITPIX']\n\n    def _generate_dither_seed(self, seed):\n        if not _is_int(seed):\n            raise TypeError(\"Seed must be an integer\")\n\n        if not -1 <= seed <= 10000:\n            raise ValueError(\n                \"Seed for random dithering must be either between 1 and \"\n                \"10000 inclusive, 0 for autogeneration from the system \"\n                \"clock, or -1 for autogeneration from a checksum of the first \"\n                \"image tile (got {})\".format(seed))\n\n        if seed == DITHER_SEED_CHECKSUM:\n            # Determine the tile dimensions from the ZTILEn keywords\n            naxis = self._header['ZNAXIS']\n            tile_dims = [self._header[f'ZTILE{idx + 1}']\n                         for idx in range(naxis)]\n            tile_dims.reverse()\n\n            # Get the first tile by using the tile dimensions as the end\n            # indices of slices (starting from 0)\n            first_tile = self.data[tuple(slice(d) for d in tile_dims)]\n\n            # The checksum algorithm used is literally just the sum of the bytes\n            # of the tile data (not its actual floating point values).  Integer\n            # overflow is irrelevant.\n            csum = first_tile.view(dtype='uint8').sum()\n\n            # Since CFITSIO uses an unsigned long (which may be different on\n            # different platforms) go ahead and truncate the sum to its\n            # unsigned long value and take the result modulo 10000\n            return (ctypes.c_ulong(csum).value % 10000) + 1\n        elif seed == DITHER_SEED_CLOCK:\n            # This isn't exactly the same algorithm as CFITSIO, but that's okay\n            # since the result is meant to be arbitrary. The primary difference\n            # is that CFITSIO incorporates the HDU number into the result in\n            # the hopes of heading off the possibility of the same seed being\n            # generated for two HDUs at the same time.  Here instead we just\n            # add in the HDU object's id\n            return ((sum(int(x) for x in math.modf(time.time())) + id(self)) %\n                    10000) + 1\n        else:\n            return seed\n"},{"fileName":"groups.py","filePath":"astropy/io/fits/hdu","id":2619,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport sys\nimport numpy as np\n\nfrom .base import DTYPE2BITPIX, DELAYED\nfrom .image import PrimaryHDU\nfrom .table import _TableLikeHDU\nfrom astropy.io.fits.column import Column, ColDefs, FITS2NUMPY\nfrom astropy.io.fits.fitsrec import FITS_rec, FITS_record\nfrom astropy.io.fits.util import _is_int, _is_pseudo_integer, _pseudo_zero\n\nfrom astropy.utils import lazyproperty\n\n\nclass Group(FITS_record):\n    \"\"\"\n    One group of the random group data.\n    \"\"\"\n\n    def __init__(self, input, row=0, start=None, end=None, step=None,\n                 base=None):\n        super().__init__(input, row, start, end, step, base)\n\n    @property\n    def parnames(self):\n        return self.array.parnames\n\n    @property\n    def data(self):\n        # The last column in the coldefs is the data portion of the group\n        return self.field(self.array._coldefs.names[-1])\n\n    @lazyproperty\n    def _unique(self):\n        return _par_indices(self.parnames)\n\n    def par(self, parname):\n        \"\"\"\n        Get the group parameter value.\n        \"\"\"\n\n        if _is_int(parname):\n            result = self.array[self.row][parname]\n        else:\n            indx = self._unique[parname.upper()]\n            if len(indx) == 1:\n                result = self.array[self.row][indx[0]]\n\n            # if more than one group parameter have the same name\n            else:\n                result = self.array[self.row][indx[0]].astype('f8')\n                for i in indx[1:]:\n                    result += self.array[self.row][i]\n\n        return result\n\n    def setpar(self, parname, value):\n        \"\"\"\n        Set the group parameter value.\n        \"\"\"\n\n        # TODO: It would be nice if, instead of requiring a multi-part value to\n        # be an array, there were an *option* to automatically split the value\n        # into multiple columns if it doesn't already fit in the array data\n        # type.\n\n        if _is_int(parname):\n            self.array[self.row][parname] = value\n        else:\n            indx = self._unique[parname.upper()]\n            if len(indx) == 1:\n                self.array[self.row][indx[0]] = value\n\n            # if more than one group parameter have the same name, the\n            # value must be a list (or tuple) containing arrays\n            else:\n                if isinstance(value, (list, tuple)) and \\\n                   len(indx) == len(value):\n                    for i in range(len(indx)):\n                        self.array[self.row][indx[i]] = value[i]\n                else:\n                    raise ValueError('Parameter value must be a sequence with '\n                                     '{} arrays/numbers.'.format(len(indx)))\n\n\nclass GroupData(FITS_rec):\n    \"\"\"\n    Random groups data object.\n\n    Allows structured access to FITS Group data in a manner analogous\n    to tables.\n    \"\"\"\n\n    _record_type = Group\n\n    def __new__(cls, input=None, bitpix=None, pardata=None, parnames=[],\n                bscale=None, bzero=None, parbscales=None, parbzeros=None):\n        \"\"\"\n        Parameters\n        ----------\n        input : array or FITS_rec instance\n            input data, either the group data itself (a\n            `numpy.ndarray`) or a record array (`FITS_rec`) which will\n            contain both group parameter info and the data.  The rest\n            of the arguments are used only for the first case.\n\n        bitpix : int\n            data type as expressed in FITS ``BITPIX`` value (8, 16, 32,\n            64, -32, or -64)\n\n        pardata : sequence of array\n            parameter data, as a list of (numeric) arrays.\n\n        parnames : sequence of str\n            list of parameter names.\n\n        bscale : int\n            ``BSCALE`` of the data\n\n        bzero : int\n            ``BZERO`` of the data\n\n        parbscales : sequence of int\n            list of bscales for the parameters\n\n        parbzeros : sequence of int\n            list of bzeros for the parameters\n        \"\"\"\n\n        if not isinstance(input, FITS_rec):\n            if pardata is None:\n                npars = 0\n            else:\n                npars = len(pardata)\n\n            if parbscales is None:\n                parbscales = [None] * npars\n            if parbzeros is None:\n                parbzeros = [None] * npars\n\n            if parnames is None:\n                parnames = [f'PAR{idx + 1}' for idx in range(npars)]\n\n            if len(parnames) != npars:\n                raise ValueError('The number of parameter data arrays does '\n                                 'not match the number of parameters.')\n\n            unique_parnames = _unique_parnames(parnames + ['DATA'])\n\n            if bitpix is None:\n                bitpix = DTYPE2BITPIX[input.dtype.name]\n\n            fits_fmt = GroupsHDU._bitpix2tform[bitpix]  # -32 -> 'E'\n            format = FITS2NUMPY[fits_fmt]  # 'E' -> 'f4'\n            data_fmt = f'{str(input.shape[1:])}{format}'\n            formats = ','.join(([format] * npars) + [data_fmt])\n            gcount = input.shape[0]\n\n            cols = [Column(name=unique_parnames[idx], format=fits_fmt,\n                           bscale=parbscales[idx], bzero=parbzeros[idx])\n                    for idx in range(npars)]\n            cols.append(Column(name=unique_parnames[-1], format=fits_fmt,\n                               bscale=bscale, bzero=bzero))\n\n            coldefs = ColDefs(cols)\n\n            self = FITS_rec.__new__(cls,\n                                    np.rec.array(None,\n                                                 formats=formats,\n                                                 names=coldefs.names,\n                                                 shape=gcount))\n\n            # By default the data field will just be 'DATA', but it may be\n            # uniquified if 'DATA' is already used by one of the group names\n            self._data_field = unique_parnames[-1]\n\n            self._coldefs = coldefs\n            self.parnames = parnames\n\n            for idx, name in enumerate(unique_parnames[:-1]):\n                column = coldefs[idx]\n                # Note: _get_scale_factors is used here and in other cases\n                # below to determine whether the column has non-default\n                # scale/zero factors.\n                # TODO: Find a better way to do this than using this interface\n                scale, zero = self._get_scale_factors(column)[3:5]\n                if scale or zero:\n                    self._cache_field(name, pardata[idx])\n                else:\n                    np.rec.recarray.field(self, idx)[:] = pardata[idx]\n\n            column = coldefs[self._data_field]\n            scale, zero = self._get_scale_factors(column)[3:5]\n            if scale or zero:\n                self._cache_field(self._data_field, input)\n            else:\n                np.rec.recarray.field(self, npars)[:] = input\n        else:\n            self = FITS_rec.__new__(cls, input)\n            self.parnames = None\n        return self\n\n    def __array_finalize__(self, obj):\n        super().__array_finalize__(obj)\n        if isinstance(obj, GroupData):\n            self.parnames = obj.parnames\n        elif isinstance(obj, FITS_rec):\n            self.parnames = obj._coldefs.names\n\n    def __getitem__(self, key):\n        out = super().__getitem__(key)\n        if isinstance(out, GroupData):\n            out.parnames = self.parnames\n        return out\n\n    @property\n    def data(self):\n        \"\"\"\n        The raw group data represented as a multi-dimensional `numpy.ndarray`\n        array.\n        \"\"\"\n\n        # The last column in the coldefs is the data portion of the group\n        return self.field(self._coldefs.names[-1])\n\n    @lazyproperty\n    def _unique(self):\n        return _par_indices(self.parnames)\n\n    def par(self, parname):\n        \"\"\"\n        Get the group parameter values.\n        \"\"\"\n\n        if _is_int(parname):\n            result = self.field(parname)\n        else:\n            indx = self._unique[parname.upper()]\n            if len(indx) == 1:\n                result = self.field(indx[0])\n\n            # if more than one group parameter have the same name\n            else:\n                result = self.field(indx[0]).astype('f8')\n                for i in indx[1:]:\n                    result += self.field(i)\n\n        return result\n\n\nclass GroupsHDU(PrimaryHDU, _TableLikeHDU):\n    \"\"\"\n    FITS Random Groups HDU class.\n\n    See the :ref:`astropy:random-groups` section in the Astropy documentation\n    for more details on working with this type of HDU.\n    \"\"\"\n\n    _bitpix2tform = {8: 'B', 16: 'I', 32: 'J', 64: 'K', -32: 'E', -64: 'D'}\n    _data_type = GroupData\n    _data_field = 'DATA'\n    \"\"\"\n    The name of the table record array field that will contain the group data\n    for each group; 'DATA' by default, but may be preceded by any number of\n    underscores if 'DATA' is already a parameter name\n    \"\"\"\n\n    def __init__(self, data=None, header=None):\n        super().__init__(data=data, header=header)\n        if data is not DELAYED:\n            self.update_header()\n\n        # Update the axes; GROUPS HDUs should always have at least one axis\n        if len(self._axes) <= 0:\n            self._axes = [0]\n            self._header['NAXIS'] = 1\n            self._header.set('NAXIS1', 0, after='NAXIS')\n\n    @classmethod\n    def match_header(cls, header):\n        keyword = header.cards[0].keyword\n        return (keyword == 'SIMPLE' and 'GROUPS' in header and\n                header['GROUPS'] is True)\n\n    @lazyproperty\n    def data(self):\n        \"\"\"\n        The data of a random group FITS file will be like a binary table's\n        data.\n        \"\"\"\n\n        if self._axes == [0]:\n            return\n\n        data = self._get_tbdata()\n        data._coldefs = self.columns\n        data.parnames = self.parnames\n        del self.columns\n        return data\n\n    @lazyproperty\n    def parnames(self):\n        \"\"\"The names of the group parameters as described by the header.\"\"\"\n\n        pcount = self._header['PCOUNT']\n        # The FITS standard doesn't really say what to do if a parname is\n        # missing, so for now just assume that won't happen\n        return [self._header['PTYPE' + str(idx + 1)] for idx in range(pcount)]\n\n    @lazyproperty\n    def columns(self):\n        if self._has_data and hasattr(self.data, '_coldefs'):\n            return self.data._coldefs\n\n        format = self._bitpix2tform[self._header['BITPIX']]\n        pcount = self._header['PCOUNT']\n        parnames = []\n        bscales = []\n        bzeros = []\n\n        for idx in range(pcount):\n            bscales.append(self._header.get('PSCAL' + str(idx + 1), None))\n            bzeros.append(self._header.get('PZERO' + str(idx + 1), None))\n            parnames.append(self._header['PTYPE' + str(idx + 1)])\n\n        formats = [format] * len(parnames)\n        dim = [None] * len(parnames)\n\n        # Now create columns from collected parameters, but first add the DATA\n        # column too, to contain the group data.\n        parnames.append('DATA')\n        bscales.append(self._header.get('BSCALE'))\n        bzeros.append(self._header.get('BZEROS'))\n        data_shape = self.shape[:-1]\n        formats.append(str(int(np.prod(data_shape))) + format)\n        dim.append(data_shape)\n        parnames = _unique_parnames(parnames)\n\n        self._data_field = parnames[-1]\n\n        cols = [Column(name=name, format=fmt, bscale=bscale, bzero=bzero,\n                       dim=dim)\n                for name, fmt, bscale, bzero, dim in\n                zip(parnames, formats, bscales, bzeros, dim)]\n\n        coldefs = ColDefs(cols)\n        return coldefs\n\n    @property\n    def _nrows(self):\n        if not self._data_loaded:\n            # The number of 'groups' equates to the number of rows in the table\n            # representation of the data\n            return self._header.get('GCOUNT', 0)\n        else:\n            return len(self.data)\n\n    @lazyproperty\n    def _theap(self):\n        # Only really a lazyproperty for symmetry with _TableBaseHDU\n        return 0\n\n    @property\n    def is_image(self):\n        return False\n\n    @property\n    def size(self):\n        \"\"\"\n        Returns the size (in bytes) of the HDU's data part.\n        \"\"\"\n\n        size = 0\n        naxis = self._header.get('NAXIS', 0)\n\n        # for random group image, NAXIS1 should be 0, so we skip NAXIS1.\n        if naxis > 1:\n            size = 1\n            for idx in range(1, naxis):\n                size = size * self._header['NAXIS' + str(idx + 1)]\n            bitpix = self._header['BITPIX']\n            gcount = self._header.get('GCOUNT', 1)\n            pcount = self._header.get('PCOUNT', 0)\n            size = abs(bitpix) * gcount * (pcount + size) // 8\n        return size\n\n    def update_header(self):\n        old_naxis = self._header.get('NAXIS', 0)\n\n        if self._data_loaded:\n            if isinstance(self.data, GroupData):\n                self._axes = list(self.data.data.shape)[1:]\n                self._axes.reverse()\n                self._axes = [0] + self._axes\n                field0 = self.data.dtype.names[0]\n                field0_code = self.data.dtype.fields[field0][0].name\n            elif self.data is None:\n                self._axes = [0]\n                field0_code = 'uint8'  # For lack of a better default\n            else:\n                raise ValueError('incorrect array type')\n\n            self._header['BITPIX'] = DTYPE2BITPIX[field0_code]\n\n        self._header['NAXIS'] = len(self._axes)\n\n        # add NAXISi if it does not exist\n        for idx, axis in enumerate(self._axes):\n            if (idx == 0):\n                after = 'NAXIS'\n            else:\n                after = 'NAXIS' + str(idx)\n\n            self._header.set('NAXIS' + str(idx + 1), axis, after=after)\n\n        # delete extra NAXISi's\n        for idx in range(len(self._axes) + 1, old_naxis + 1):\n            try:\n                del self._header['NAXIS' + str(idx)]\n            except KeyError:\n                pass\n\n        if self._has_data and isinstance(self.data, GroupData):\n            self._header.set('GROUPS', True,\n                             after='NAXIS' + str(len(self._axes)))\n            self._header.set('PCOUNT', len(self.data.parnames), after='GROUPS')\n            self._header.set('GCOUNT', len(self.data), after='PCOUNT')\n\n            column = self.data._coldefs[self._data_field]\n            scale, zero = self.data._get_scale_factors(column)[3:5]\n            if scale:\n                self._header.set('BSCALE', column.bscale)\n            if zero:\n                self._header.set('BZERO', column.bzero)\n\n            for idx, name in enumerate(self.data.parnames):\n                self._header.set('PTYPE' + str(idx + 1), name)\n                column = self.data._coldefs[idx]\n                scale, zero = self.data._get_scale_factors(column)[3:5]\n                if scale:\n                    self._header.set('PSCAL' + str(idx + 1), column.bscale)\n                if zero:\n                    self._header.set('PZERO' + str(idx + 1), column.bzero)\n\n        # Update the position of the EXTEND keyword if it already exists\n        if 'EXTEND' in self._header:\n            if len(self._axes):\n                after = 'NAXIS' + str(len(self._axes))\n            else:\n                after = 'NAXIS'\n            self._header.set('EXTEND', after=after)\n\n    def _writedata_internal(self, fileobj):\n        \"\"\"\n        Basically copy/pasted from `_ImageBaseHDU._writedata_internal()`, but\n        we have to get the data's byte order a different way...\n\n        TODO: Might be nice to store some indication of the data's byte order\n        as an attribute or function so that we don't have to do this.\n        \"\"\"\n\n        size = 0\n\n        if self.data is not None:\n            self.data._scale_back()\n\n            # Based on the system type, determine the byteorders that\n            # would need to be swapped to get to big-endian output\n            if sys.byteorder == 'little':\n                swap_types = ('<', '=')\n            else:\n                swap_types = ('<',)\n            # deal with unsigned integer 16, 32 and 64 data\n            if _is_pseudo_integer(self.data.dtype):\n                # Convert the unsigned array to signed\n                output = np.array(\n                    self.data - _pseudo_zero(self.data.dtype),\n                    dtype=f'>i{self.data.dtype.itemsize}')\n                should_swap = False\n            else:\n                output = self.data\n                fname = self.data.dtype.names[0]\n                byteorder = self.data.dtype.fields[fname][0].str[0]\n                should_swap = (byteorder in swap_types)\n\n            if should_swap:\n                if output.flags.writeable:\n                    output.byteswap(True)\n                    try:\n                        fileobj.writearray(output)\n                    finally:\n                        output.byteswap(True)\n                else:\n                    # For read-only arrays, there is no way around making\n                    # a byteswapped copy of the data.\n                    fileobj.writearray(output.byteswap(False))\n            else:\n                fileobj.writearray(output)\n\n            size += output.size * output.itemsize\n        return size\n\n    def _verify(self, option='warn'):\n        errs = super()._verify(option=option)\n\n        # Verify locations and values of mandatory keywords.\n        self.req_cards('NAXIS', 2,\n                       lambda v: (_is_int(v) and 1 <= v <= 999), 1,\n                       option, errs)\n        self.req_cards('NAXIS1', 3, lambda v: (_is_int(v) and v == 0), 0,\n                       option, errs)\n\n        after = self._header['NAXIS'] + 3\n        pos = lambda x: x >= after\n\n        self.req_cards('GCOUNT', pos, _is_int, 1, option, errs)\n        self.req_cards('PCOUNT', pos, _is_int, 0, option, errs)\n        self.req_cards('GROUPS', pos, lambda v: (v is True), True, option,\n                       errs)\n        return errs\n\n    def _calculate_datasum(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        \"\"\"\n\n        if self._has_data:\n\n            # We have the data to be used.\n\n            # Check the byte order of the data.  If it is little endian we\n            # must swap it before calculating the datasum.\n            # TODO: Maybe check this on a per-field basis instead of assuming\n            # that all fields have the same byte order?\n            byteorder = \\\n                self.data.dtype.fields[self.data.dtype.names[0]][0].str[0]\n\n            if byteorder != '>':\n                if self.data.flags.writeable:\n                    byteswapped = True\n                    d = self.data.byteswap(True)\n                    d.dtype = d.dtype.newbyteorder('>')\n                else:\n                    # If the data is not writeable, we just make a byteswapped\n                    # copy and don't bother changing it back after\n                    d = self.data.byteswap(False)\n                    d.dtype = d.dtype.newbyteorder('>')\n                    byteswapped = False\n            else:\n                byteswapped = False\n                d = self.data\n\n            byte_data = d.view(type=np.ndarray, dtype=np.ubyte)\n\n            cs = self._compute_checksum(byte_data)\n\n            # If the data was byteswapped in this method then return it to\n            # its original little-endian order.\n            if byteswapped:\n                d.byteswap(True)\n                d.dtype = d.dtype.newbyteorder('<')\n\n            return cs\n        else:\n            # This is the case where the data has not been read from the file\n            # yet.  We can handle that in a generic manner so we do it in the\n            # base class.  The other possibility is that there is no data at\n            # all.  This can also be handled in a generic manner.\n            return super()._calculate_datasum()\n\n    def _summary(self):\n        summary = super()._summary()\n        name, ver, classname, length, shape, format, gcount = summary\n\n        # Drop the first axis from the shape\n        if shape:\n            shape = shape[1:]\n\n            if shape and all(shape):\n                # Update the format\n                format = self.columns[0].dtype.name\n\n        # Update the GCOUNT report\n        gcount = f'{self._gcount} Groups  {self._pcount} Parameters'\n        return (name, ver, classname, length, shape, format, gcount)\n\n\ndef _par_indices(names):\n    \"\"\"\n    Given a list of objects, returns a mapping of objects in that list to the\n    index or indices at which that object was found in the list.\n    \"\"\"\n\n    unique = {}\n    for idx, name in enumerate(names):\n        # Case insensitive\n        name = name.upper()\n        if name in unique:\n            unique[name].append(idx)\n        else:\n            unique[name] = [idx]\n    return unique\n\n\ndef _unique_parnames(names):\n    \"\"\"\n    Given a list of parnames, including possible duplicates, returns a new list\n    of parnames with duplicates prepended by one or more underscores to make\n    them unique.  This is also case insensitive.\n    \"\"\"\n\n    upper_names = set()\n    unique_names = []\n\n    for name in names:\n        name_upper = name.upper()\n        while name_upper in upper_names:\n            name = '_' + name\n            name_upper = '_' + name_upper\n\n        unique_names.append(name)\n        upper_names.add(name_upper)\n\n    return unique_names\n"},{"className":"CompImageHeader","col":0,"comment":"\n    Header object for compressed image HDUs designed to keep the compression\n    header and the underlying image header properly synchronized.\n\n    This essentially wraps the image header, so that all values are read from\n    and written to the image header.  However, updates to the image header will\n    also update the table header where appropriate.\n\n    Note that if no image header is passed in, the code will instantiate a\n    regular `~astropy.io.fits.Header`.\n    ","endLoc":375,"id":2620,"nodeType":"Class","startLoc":66,"text":"class CompImageHeader(Header):\n    \"\"\"\n    Header object for compressed image HDUs designed to keep the compression\n    header and the underlying image header properly synchronized.\n\n    This essentially wraps the image header, so that all values are read from\n    and written to the image header.  However, updates to the image header will\n    also update the table header where appropriate.\n\n    Note that if no image header is passed in, the code will instantiate a\n    regular `~astropy.io.fits.Header`.\n    \"\"\"\n\n    # TODO: The difficulty of implementing this screams a need to rewrite this\n    # module\n\n    _keyword_remaps = {\n        'SIMPLE': 'ZSIMPLE', 'XTENSION': 'ZTENSION', 'BITPIX': 'ZBITPIX',\n        'NAXIS': 'ZNAXIS', 'EXTEND': 'ZEXTEND', 'BLOCKED': 'ZBLOCKED',\n        'PCOUNT': 'ZPCOUNT', 'GCOUNT': 'ZGCOUNT', 'CHECKSUM': 'ZHECKSUM',\n        'DATASUM': 'ZDATASUM'\n    }\n\n    _zdef_re = re.compile(r'(?P<label>^[Zz][a-zA-Z]*)(?P<num>[1-9][0-9 ]*$)?')\n    _compression_keywords = set(_keyword_remaps.values()).union(\n        ['ZIMAGE', 'ZCMPTYPE', 'ZMASKCMP', 'ZQUANTIZ', 'ZDITHER0'])\n    _indexed_compression_keywords = {'ZNAXIS', 'ZTILE', 'ZNAME', 'ZVAL'}\n    # TODO: Once it place it should be possible to manage some of this through\n    # the schema system, but it's not quite ready for that yet.  Also it still\n    # makes more sense to change CompImageHDU to subclass ImageHDU :/\n\n    def __new__(cls, table_header, image_header=None):\n        # 2019-09-14 (MHvK): No point wrapping anything if no image_header is\n        # given.  This happens if __getitem__ and copy are called - our super\n        # class will aim to initialize a new, possibly partially filled\n        # header, but we cannot usefully deal with that.\n        # TODO: the above suggests strongly we should *not* subclass from\n        # Header.  See also comment above about the need for reorganization.\n        if image_header is None:\n            return Header(table_header)\n        else:\n            return super().__new__(cls)\n\n    def __init__(self, table_header, image_header):\n        self._cards = image_header._cards\n        self._keyword_indices = image_header._keyword_indices\n        self._rvkc_indices = image_header._rvkc_indices\n        self._modified = image_header._modified\n        self._table_header = table_header\n\n    # We need to override and Header methods that can modify the header, and\n    # ensure that they sync with the underlying _table_header\n\n    def __setitem__(self, key, value):\n        # This isn't pretty, but if the `key` is either an int or a tuple we\n        # need to figure out what keyword name that maps to before doing\n        # anything else; these checks will be repeated later in the\n        # super().__setitem__ call but I don't see another way around it\n        # without some major refactoring\n        if self._set_slice(key, value, self):\n            return\n\n        if isinstance(key, int):\n            keyword, index = self._keyword_from_index(key)\n        elif isinstance(key, tuple):\n            keyword, index = key\n        else:\n            # We don't want to specify and index otherwise, because that will\n            # break the behavior for new keywords and for commentary keywords\n            keyword, index = key, None\n\n        if self._is_reserved_keyword(keyword):\n            return\n\n        super().__setitem__(key, value)\n\n        if index is not None:\n            remapped_keyword = self._remap_keyword(keyword)\n            self._table_header[remapped_keyword, index] = value\n        # Else this will pass through to ._update\n\n    def __delitem__(self, key):\n        if isinstance(key, slice) or self._haswildcard(key):\n            # If given a slice pass that on to the superclass and bail out\n            # early; we only want to make updates to _table_header when given\n            # a key specifying a single keyword\n            return super().__delitem__(key)\n\n        if isinstance(key, int):\n            keyword, index = self._keyword_from_index(key)\n        elif isinstance(key, tuple):\n            keyword, index = key\n        else:\n            keyword, index = key, None\n\n        if key not in self:\n            raise KeyError(f\"Keyword {key!r} not found.\")\n\n        super().__delitem__(key)\n\n        remapped_keyword = self._remap_keyword(keyword)\n\n        if remapped_keyword in self._table_header:\n            if index is not None:\n                del self._table_header[(remapped_keyword, index)]\n            else:\n                del self._table_header[remapped_keyword]\n\n    def append(self, card=None, useblanks=True, bottom=False, end=False):\n        # This logic unfortunately needs to be duplicated from the base class\n        # in order to determine the keyword\n        if isinstance(card, str):\n            card = Card(card)\n        elif isinstance(card, tuple):\n            card = Card(*card)\n        elif card is None:\n            card = Card()\n        elif not isinstance(card, Card):\n            raise ValueError(\n                'The value appended to a Header must be either a keyword or '\n                '(keyword, value, [comment]) tuple; got: {!r}'.format(card))\n\n        if self._is_reserved_keyword(card.keyword):\n            return\n\n        super().append(card=card, useblanks=useblanks, bottom=bottom, end=end)\n\n        remapped_keyword = self._remap_keyword(card.keyword)\n\n        # card.keyword strips the HIERARCH if present so this must be added\n        # back to avoid a warning.\n        if str(card).startswith(\"HIERARCH \") and not remapped_keyword.startswith(\"HIERARCH \"):\n            remapped_keyword = \"HIERARCH \" + remapped_keyword\n\n        card = Card(remapped_keyword, card.value, card.comment)\n\n        # Here we disable the use of blank cards, because the call above to\n        # Header.append may have already deleted a blank card in the table\n        # header, thanks to inheritance: Header.append calls 'del self[-1]'\n        # to delete a blank card, which calls CompImageHeader.__deltitem__,\n        # which deletes the blank card both in the image and the table headers!\n        self._table_header.append(card=card, useblanks=False,\n                                  bottom=bottom, end=end)\n\n    def insert(self, key, card, useblanks=True, after=False):\n        if isinstance(key, int):\n            # Determine condition to pass through to append\n            if after:\n                if key == -1:\n                    key = len(self._cards)\n                else:\n                    key += 1\n\n            if key >= len(self._cards):\n                self.append(card, end=True)\n                return\n\n        if isinstance(card, str):\n            card = Card(card)\n        elif isinstance(card, tuple):\n            card = Card(*card)\n        elif not isinstance(card, Card):\n            raise ValueError(\n                'The value inserted into a Header must be either a keyword or '\n                '(keyword, value, [comment]) tuple; got: {!r}'.format(card))\n\n        if self._is_reserved_keyword(card.keyword):\n            return\n\n        # Now the tricky part is to determine where to insert in the table\n        # header.  If given a numerical index we need to map that to the\n        # corresponding index in the table header.  Although rare, there may be\n        # cases where there is no mapping in which case we just try the same\n        # index\n        # NOTE: It is crucial that remapped_index in particular is figured out\n        # before the image header is modified\n        remapped_index = self._remap_index(key)\n        remapped_keyword = self._remap_keyword(card.keyword)\n\n        super().insert(key, card, useblanks=useblanks, after=after)\n\n        card = Card(remapped_keyword, card.value, card.comment)\n\n        # Here we disable the use of blank cards, because the call above to\n        # Header.insert may have already deleted a blank card in the table\n        # header, thanks to inheritance: Header.insert calls 'del self[-1]'\n        # to delete a blank card, which calls CompImageHeader.__delitem__,\n        # which deletes the blank card both in the image and the table headers!\n        self._table_header.insert(remapped_index, card, useblanks=False,\n                                  after=after)\n\n    def _update(self, card):\n        keyword = card[0]\n\n        if self._is_reserved_keyword(keyword):\n            return\n\n        super()._update(card)\n\n        if keyword in Card._commentary_keywords:\n            # Otherwise this will result in a duplicate insertion\n            return\n\n        remapped_keyword = self._remap_keyword(keyword)\n        self._table_header._update((remapped_keyword,) + card[1:])\n\n    # Last piece needed (I think) for synchronizing with the real header\n    # This one is tricky since _relativeinsert calls insert\n    def _relativeinsert(self, card, before=None, after=None, replace=False):\n        keyword = card[0]\n\n        if self._is_reserved_keyword(keyword):\n            return\n\n        # Now we have to figure out how to remap 'before' and 'after'\n        if before is None:\n            if isinstance(after, int):\n                remapped_after = self._remap_index(after)\n            else:\n                remapped_after = self._remap_keyword(after)\n            remapped_before = None\n        else:\n            if isinstance(before, int):\n                remapped_before = self._remap_index(before)\n            else:\n                remapped_before = self._remap_keyword(before)\n            remapped_after = None\n\n        super()._relativeinsert(card, before=before, after=after,\n                                replace=replace)\n\n        remapped_keyword = self._remap_keyword(keyword)\n\n        card = Card(remapped_keyword, card[1], card[2])\n        self._table_header._relativeinsert(card, before=remapped_before,\n                                           after=remapped_after,\n                                           replace=replace)\n\n    @classmethod\n    def _is_reserved_keyword(cls, keyword, warn=True):\n        msg = ('Keyword {!r} is reserved for use by the FITS Tiled Image '\n               'Convention and will not be stored in the header for the '\n               'image being compressed.'.format(keyword))\n\n        if keyword == 'TFIELDS':\n            if warn:\n                warnings.warn(msg)\n            return True\n\n        m = TDEF_RE.match(keyword)\n\n        if m and m.group('label').upper() in TABLE_KEYWORD_NAMES:\n            if warn:\n                warnings.warn(msg)\n            return True\n\n        m = cls._zdef_re.match(keyword)\n\n        if m:\n            label = m.group('label').upper()\n            num = m.group('num')\n            if num is not None and label in cls._indexed_compression_keywords:\n                if warn:\n                    warnings.warn(msg)\n                return True\n            elif label in cls._compression_keywords:\n                if warn:\n                    warnings.warn(msg)\n                return True\n\n        return False\n\n    @classmethod\n    def _remap_keyword(cls, keyword):\n        # Given a keyword that one might set on an image, remap that keyword to\n        # the name used for it in the COMPRESSED HDU header\n        # This is mostly just a lookup in _keyword_remaps, but needs handling\n        # for NAXISn keywords\n\n        is_naxisn = False\n        if keyword[:5] == 'NAXIS':\n            with suppress(ValueError):\n                index = int(keyword[5:])\n                is_naxisn = index > 0\n\n        if is_naxisn:\n            return f'ZNAXIS{index}'\n\n        # If the keyword does not need to be remapped then just return the\n        # original keyword\n        return cls._keyword_remaps.get(keyword, keyword)\n\n    def _remap_index(self, idx):\n        # Given an integer index into this header, map that to the index in the\n        # table header for the same card.  If the card doesn't exist in the\n        # table header (generally should *not* be the case) this will just\n        # return the same index\n        # This *does* also accept a keyword or (keyword, repeat) tuple and\n        # obtains the associated numerical index with self._cardindex\n        if not isinstance(idx, int):\n            idx = self._cardindex(idx)\n\n        keyword, repeat = self._keyword_from_index(idx)\n        remapped_insert_keyword = self._remap_keyword(keyword)\n\n        with suppress(IndexError, KeyError):\n            idx = self._table_header._cardindex((remapped_insert_keyword,\n                                                 repeat))\n\n        return idx"},{"fileName":"base.py","filePath":"astropy/io/fits/hdu","id":2621,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\n\nimport datetime\nimport os\nimport sys\nimport warnings\nfrom contextlib import suppress\nfrom inspect import signature, Parameter\n\nimport numpy as np\n\nfrom astropy.io.fits import conf\nfrom astropy.io.fits.file import _File\nfrom astropy.io.fits.header import (Header, _BasicHeader, _pad_length,\n                                    _DelayedHeader)\nfrom astropy.io.fits.util import (_is_int, _is_pseudo_integer, _pseudo_zero,\n                    itersubclasses, decode_ascii, _get_array_mmap, first,\n                    _free_space_check, _extract_number)\nfrom astropy.io.fits.verify import _Verify, _ErrList\n\nfrom astropy.utils import lazyproperty\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n\n__all__ = [\n    \"DELAYED\",\n    # classes\n    \"InvalidHDUException\",\n    \"ExtensionHDU\",\n    \"NonstandardExtHDU\",\n]\n\n\nclass _Delayed:\n    pass\n\n\nDELAYED = _Delayed()\n\n\nBITPIX2DTYPE = {8: 'uint8', 16: 'int16', 32: 'int32', 64: 'int64',\n                -32: 'float32', -64: 'float64'}\n\"\"\"Maps FITS BITPIX values to Numpy dtype names.\"\"\"\n\nDTYPE2BITPIX = {'int8': 8, 'uint8': 8, 'int16': 16, 'uint16': 16,\n                'int32': 32, 'uint32': 32, 'int64': 64, 'uint64': 64,\n                'float32': -32, 'float64': -64}\n\"\"\"\nMaps Numpy dtype names to FITS BITPIX values (this includes unsigned\nintegers, with the assumption that the pseudo-unsigned integer convention\nwill be used in this case.\n\"\"\"\n\n\nclass InvalidHDUException(Exception):\n    \"\"\"\n    A custom exception class used mainly to signal to _BaseHDU.__new__ that\n    an HDU cannot possibly be considered valid, and must be assumed to be\n    corrupted.\n    \"\"\"\n\n\ndef _hdu_class_from_header(cls, header):\n    \"\"\"\n    Iterates through the subclasses of _BaseHDU and uses that class's\n    match_header() method to determine which subclass to instantiate.\n\n    It's important to be aware that the class hierarchy is traversed in a\n    depth-last order.  Each match_header() should identify an HDU type as\n    uniquely as possible.  Abstract types may choose to simply return False\n    or raise NotImplementedError to be skipped.\n\n    If any unexpected exceptions are raised while evaluating\n    match_header(), the type is taken to be _CorruptedHDU.\n\n    Used primarily by _BaseHDU._readfrom_internal and _BaseHDU._from_data to\n    find an appropriate HDU class to use based on values in the header.\n    \"\"\"\n\n    klass = cls  # By default, if no subclasses are defined\n    if header:\n        for c in reversed(list(itersubclasses(cls))):\n            try:\n                # HDU classes built into astropy.io.fits are always considered,\n                # but extension HDUs must be explicitly registered\n                if not (c.__module__.startswith('astropy.io.fits.') or\n                        c in cls._hdu_registry):\n                    continue\n                if c.match_header(header):\n                    klass = c\n                    break\n            except NotImplementedError:\n                continue\n            except Exception as exc:\n                warnings.warn(\n                    'An exception occurred matching an HDU header to the '\n                    'appropriate HDU type: {}'.format(exc),\n                    AstropyUserWarning)\n                warnings.warn('The HDU will be treated as corrupted.',\n                              AstropyUserWarning)\n                klass = _CorruptedHDU\n                del exc\n                break\n\n    return klass\n\n\n# TODO: Come up with a better __repr__ for HDUs (and for HDULists, for that\n# matter)\nclass _BaseHDU:\n    \"\"\"Base class for all HDU (header data unit) classes.\"\"\"\n\n    _hdu_registry = set()\n\n    # This HDU type is part of the FITS standard\n    _standard = True\n\n    # Byte to use for padding out blocks\n    _padding_byte = '\\x00'\n\n    _default_name = ''\n\n    # _header uses a descriptor to delay the loading of the fits.Header object\n    # until it is necessary.\n    _header = _DelayedHeader()\n\n    def __init__(self, data=None, header=None, *args, **kwargs):\n        if header is None:\n            header = Header()\n        self._header = header\n        self._header_str = None\n        self._file = None\n        self._buffer = None\n        self._header_offset = None\n        self._data_offset = None\n        self._data_size = None\n\n        # This internal variable is used to track whether the data attribute\n        # still points to the same data array as when the HDU was originally\n        # created (this does not track whether the data is actually the same\n        # content-wise)\n        self._data_replaced = False\n        self._data_needs_rescale = False\n        self._new = True\n        self._output_checksum = False\n\n        if 'DATASUM' in self._header and 'CHECKSUM' not in self._header:\n            self._output_checksum = 'datasum'\n        elif 'CHECKSUM' in self._header:\n            self._output_checksum = True\n\n    def __init_subclass__(cls, **kwargs):\n        # Add the same data.deleter to all HDUs with a data property.\n        # It's unfortunate, but there's otherwise no straightforward way\n        # that a property can inherit setters/deleters of the property of the\n        # same name on base classes.\n        data_prop = cls.__dict__.get('data', None)\n        if (isinstance(data_prop, (lazyproperty, property))\n                and data_prop.fdel is None):\n            # Don't do anything if the class has already explicitly\n            # set the deleter for its data property\n            def data(self):\n                # The deleter\n                if self._file is not None and self._data_loaded:\n                    data_refcount = sys.getrefcount(self.data)\n                    # Manually delete *now* so that FITS_rec.__del__\n                    # cleanup can happen if applicable\n                    del self.__dict__['data']\n                    # Don't even do this unless the *only* reference to the\n                    # .data array was the one we're deleting by deleting\n                    # this attribute; if any other references to the array\n                    # are hanging around (perhaps the user ran ``data =\n                    # hdu.data``) don't even consider this:\n                    if data_refcount == 2:\n                        self._file._maybe_close_mmap()\n\n            setattr(cls, 'data', data_prop.deleter(data))\n\n        return super().__init_subclass__(**kwargs)\n\n    @property\n    def header(self):\n        return self._header\n\n    @header.setter\n    def header(self, value):\n        self._header = value\n\n    @property\n    def name(self):\n        # Convert the value to a string to be flexible in some pathological\n        # cases (see ticket #96)\n        return str(self._header.get('EXTNAME', self._default_name))\n\n    @name.setter\n    def name(self, value):\n        if not isinstance(value, str):\n            raise TypeError(\"'name' attribute must be a string\")\n        if not conf.extension_name_case_sensitive:\n            value = value.upper()\n        if 'EXTNAME' in self._header:\n            self._header['EXTNAME'] = value\n        else:\n            self._header['EXTNAME'] = (value, 'extension name')\n\n    @property\n    def ver(self):\n        return self._header.get('EXTVER', 1)\n\n    @ver.setter\n    def ver(self, value):\n        if not _is_int(value):\n            raise TypeError(\"'ver' attribute must be an integer\")\n        if 'EXTVER' in self._header:\n            self._header['EXTVER'] = value\n        else:\n            self._header['EXTVER'] = (value, 'extension value')\n\n    @property\n    def level(self):\n        return self._header.get('EXTLEVEL', 1)\n\n    @level.setter\n    def level(self, value):\n        if not _is_int(value):\n            raise TypeError(\"'level' attribute must be an integer\")\n        if 'EXTLEVEL' in self._header:\n            self._header['EXTLEVEL'] = value\n        else:\n            self._header['EXTLEVEL'] = (value, 'extension level')\n\n    @property\n    def is_image(self):\n        return (\n            self.name == 'PRIMARY' or\n            ('XTENSION' in self._header and\n             (self._header['XTENSION'] == 'IMAGE' or\n              (self._header['XTENSION'] == 'BINTABLE' and\n               'ZIMAGE' in self._header and self._header['ZIMAGE'] is True))))\n\n    @property\n    def _data_loaded(self):\n        return ('data' in self.__dict__ and self.data is not DELAYED)\n\n    @property\n    def _has_data(self):\n        return self._data_loaded and self.data is not None\n\n    @classmethod\n    def register_hdu(cls, hducls):\n        cls._hdu_registry.add(hducls)\n\n    @classmethod\n    def unregister_hdu(cls, hducls):\n        if hducls in cls._hdu_registry:\n            cls._hdu_registry.remove(hducls)\n\n    @classmethod\n    def match_header(cls, header):\n        raise NotImplementedError\n\n    @classmethod\n    def fromstring(cls, data, checksum=False, ignore_missing_end=False,\n                   **kwargs):\n        \"\"\"\n        Creates a new HDU object of the appropriate type from a string\n        containing the HDU's entire header and, optionally, its data.\n\n        Note: When creating a new HDU from a string without a backing file\n        object, the data of that HDU may be read-only.  It depends on whether\n        the underlying string was an immutable Python str/bytes object, or some\n        kind of read-write memory buffer such as a `memoryview`.\n\n        Parameters\n        ----------\n        data : str, bytearray, memoryview, ndarray\n            A byte string containing the HDU's header and data.\n\n        checksum : bool, optional\n            Check the HDU's checksum and/or datasum.\n\n        ignore_missing_end : bool, optional\n            Ignore a missing end card in the header data.  Note that without the\n            end card the end of the header may be ambiguous and resulted in a\n            corrupt HDU.  In this case the assumption is that the first 2880\n            block that does not begin with valid FITS header data is the\n            beginning of the data.\n\n        **kwargs : optional\n            May consist of additional keyword arguments specific to an HDU\n            type--these correspond to keywords recognized by the constructors of\n            different HDU classes such as `PrimaryHDU`, `ImageHDU`, or\n            `BinTableHDU`.  Any unrecognized keyword arguments are simply\n            ignored.\n        \"\"\"\n\n        return cls._readfrom_internal(data, checksum=checksum,\n                                      ignore_missing_end=ignore_missing_end,\n                                      **kwargs)\n\n    @classmethod\n    def readfrom(cls, fileobj, checksum=False, ignore_missing_end=False,\n                 **kwargs):\n        \"\"\"\n        Read the HDU from a file.  Normally an HDU should be opened with\n        :func:`open` which reads the entire HDU list in a FITS file.  But this\n        method is still provided for symmetry with :func:`writeto`.\n\n        Parameters\n        ----------\n        fileobj : file-like\n            Input FITS file.  The file's seek pointer is assumed to be at the\n            beginning of the HDU.\n\n        checksum : bool\n            If `True`, verifies that both ``DATASUM`` and ``CHECKSUM`` card\n            values (when present in the HDU header) match the header and data\n            of all HDU's in the file.\n\n        ignore_missing_end : bool\n            Do not issue an exception when opening a file that is missing an\n            ``END`` card in the last header.\n        \"\"\"\n\n        # TODO: Figure out a way to make it possible for the _File\n        # constructor to be a noop if the argument is already a _File\n        if not isinstance(fileobj, _File):\n            fileobj = _File(fileobj)\n\n        hdu = cls._readfrom_internal(fileobj, checksum=checksum,\n                                     ignore_missing_end=ignore_missing_end,\n                                     **kwargs)\n\n        # If the checksum had to be checked the data may have already been read\n        # from the file, in which case we don't want to seek relative\n        fileobj.seek(hdu._data_offset + hdu._data_size, os.SEEK_SET)\n        return hdu\n\n    def writeto(self, name, output_verify='exception', overwrite=False,\n                checksum=False):\n        \"\"\"\n        Write the HDU to a new file. This is a convenience method to\n        provide a user easier output interface if only one HDU needs\n        to be written to a file.\n\n        Parameters\n        ----------\n        name : path-like or file-like\n            Output FITS file.  If the file object is already opened, it must\n            be opened in a writeable mode.\n\n        output_verify : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        overwrite : bool, optional\n            If ``True``, overwrite the output file if it exists. Raises an\n            ``OSError`` if ``False`` and the output file exists. Default is\n            ``False``.\n\n        checksum : bool\n            When `True` adds both ``DATASUM`` and ``CHECKSUM`` cards\n            to the header of the HDU when written to the file.\n        \"\"\"\n\n        from .hdulist import HDUList\n\n        hdulist = HDUList([self])\n        hdulist.writeto(name, output_verify, overwrite=overwrite,\n                        checksum=checksum)\n\n    @classmethod\n    def _from_data(cls, data, header, **kwargs):\n        \"\"\"\n        Instantiate the HDU object after guessing the HDU class from the\n        FITS Header.\n        \"\"\"\n        klass = _hdu_class_from_header(cls, header)\n        return klass(data=data, header=header, **kwargs)\n\n    @classmethod\n    def _readfrom_internal(cls, data, header=None, checksum=False,\n                           ignore_missing_end=False, **kwargs):\n        \"\"\"\n        Provides the bulk of the internal implementation for readfrom and\n        fromstring.\n\n        For some special cases, supports using a header that was already\n        created, and just using the input data for the actual array data.\n        \"\"\"\n\n        hdu_buffer = None\n        hdu_fileobj = None\n        header_offset = 0\n\n        if isinstance(data, _File):\n            if header is None:\n                header_offset = data.tell()\n                try:\n                    # First we try to read the header with the fast parser\n                    # from _BasicHeader, which will read only the standard\n                    # 8 character keywords to get the structural keywords\n                    # that are needed to build the HDU object.\n                    header_str, header = _BasicHeader.fromfile(data)\n                except Exception:\n                    # If the fast header parsing failed, then fallback to\n                    # the classic Header parser, which has better support\n                    # and reporting for the various issues that can be found\n                    # in the wild.\n                    data.seek(header_offset)\n                    header = Header.fromfile(data,\n                                             endcard=not ignore_missing_end)\n            hdu_fileobj = data\n            data_offset = data.tell()  # *after* reading the header\n        else:\n            try:\n                # Test that the given object supports the buffer interface by\n                # ensuring an ndarray can be created from it\n                np.ndarray((), dtype='ubyte', buffer=data)\n            except TypeError:\n                raise TypeError(\n                    'The provided object {!r} does not contain an underlying '\n                    'memory buffer.  fromstring() requires an object that '\n                    'supports the buffer interface such as bytes, buffer, '\n                    'memoryview, ndarray, etc.  This restriction is to ensure '\n                    'that efficient access to the array/table data is possible.'\n                    .format(data))\n\n            if header is None:\n                def block_iter(nbytes):\n                    idx = 0\n                    while idx < len(data):\n                        yield data[idx:idx + nbytes]\n                        idx += nbytes\n\n                header_str, header = Header._from_blocks(\n                    block_iter, True, '', not ignore_missing_end, True)\n\n                if len(data) > len(header_str):\n                    hdu_buffer = data\n            elif data:\n                hdu_buffer = data\n\n            header_offset = 0\n            data_offset = len(header_str)\n\n        # Determine the appropriate arguments to pass to the constructor from\n        # self._kwargs.  self._kwargs contains any number of optional arguments\n        # that may or may not be valid depending on the HDU type\n        cls = _hdu_class_from_header(cls, header)\n        sig = signature(cls.__init__)\n        new_kwargs = kwargs.copy()\n        if Parameter.VAR_KEYWORD not in (x.kind for x in sig.parameters.values()):\n            # If __init__ accepts arbitrary keyword arguments, then we can go\n            # ahead and pass all keyword arguments; otherwise we need to delete\n            # any that are invalid\n            for key in kwargs:\n                if key not in sig.parameters:\n                    del new_kwargs[key]\n\n        try:\n            hdu = cls(data=DELAYED, header=header, **new_kwargs)\n        except TypeError:\n            # This may happen because some HDU class (e.g. GroupsHDU) wants\n            # to set a keyword on the header, which is not possible with the\n            # _BasicHeader. While HDU classes should not need to modify the\n            # header in general, sometimes this is needed to fix it. So in\n            # this case we build a full Header and try again to create the\n            # HDU object.\n            if isinstance(header, _BasicHeader):\n                header = Header.fromstring(header_str)\n                hdu = cls(data=DELAYED, header=header, **new_kwargs)\n            else:\n                raise\n\n        # One of these may be None, depending on whether the data came from a\n        # file or a string buffer--later this will be further abstracted\n        hdu._file = hdu_fileobj\n        hdu._buffer = hdu_buffer\n\n        hdu._header_offset = header_offset     # beginning of the header area\n        hdu._data_offset = data_offset         # beginning of the data area\n\n        # data area size, including padding\n        size = hdu.size\n        hdu._data_size = size + _pad_length(size)\n\n        if isinstance(hdu._header, _BasicHeader):\n            # Delete the temporary _BasicHeader.\n            # We need to do this before an eventual checksum computation,\n            # since it needs to modify temporarily the header\n            #\n            # The header string is stored in the HDU._header_str attribute,\n            # so that it can be used directly when we need to create the\n            # classic Header object, without having to parse again the file.\n            del hdu._header\n            hdu._header_str = header_str\n\n        # Checksums are not checked on invalid HDU types\n        if checksum and checksum != 'remove' and isinstance(hdu, _ValidHDU):\n            hdu._verify_checksum_datasum()\n\n        return hdu\n\n    def _get_raw_data(self, shape, code, offset):\n        \"\"\"\n        Return raw array from either the HDU's memory buffer or underlying\n        file.\n        \"\"\"\n\n        if isinstance(shape, int):\n            shape = (shape,)\n\n        if self._buffer:\n            return np.ndarray(shape, dtype=code, buffer=self._buffer,\n                              offset=offset)\n        elif self._file:\n            return self._file.readarray(offset=offset, dtype=code, shape=shape)\n        else:\n            return None\n\n    # TODO: Rework checksum handling so that it's not necessary to add a\n    # checksum argument here\n    # TODO: The BaseHDU class shouldn't even handle checksums since they're\n    # only implemented on _ValidHDU...\n    def _prewriteto(self, checksum=False, inplace=False):\n        self._update_pseudo_int_scale_keywords()\n\n        # Handle checksum\n        self._update_checksum(checksum)\n\n    def _update_pseudo_int_scale_keywords(self):\n        \"\"\"\n        If the data is signed int 8, unsigned int 16, 32, or 64,\n        add BSCALE/BZERO cards to header.\n        \"\"\"\n\n        if (self._has_data and self._standard and\n                _is_pseudo_integer(self.data.dtype)):\n            # CompImageHDUs need TFIELDS immediately after GCOUNT,\n            # so BSCALE has to go after TFIELDS if it exists.\n            if 'TFIELDS' in self._header:\n                self._header.set('BSCALE', 1, after='TFIELDS')\n            elif 'GCOUNT' in self._header:\n                self._header.set('BSCALE', 1, after='GCOUNT')\n            else:\n                self._header.set('BSCALE', 1)\n            self._header.set('BZERO', _pseudo_zero(self.data.dtype),\n                             after='BSCALE')\n\n    def _update_checksum(self, checksum, checksum_keyword='CHECKSUM',\n                         datasum_keyword='DATASUM'):\n        \"\"\"Update the 'CHECKSUM' and 'DATASUM' keywords in the header (or\n        keywords with equivalent semantics given by the ``checksum_keyword``\n        and ``datasum_keyword`` arguments--see for example ``CompImageHDU``\n        for an example of why this might need to be overridden).\n        \"\"\"\n\n        # If the data is loaded it isn't necessarily 'modified', but we have no\n        # way of knowing for sure\n        modified = self._header._modified or self._data_loaded\n\n        if checksum == 'remove':\n            if checksum_keyword in self._header:\n                del self._header[checksum_keyword]\n\n            if datasum_keyword in self._header:\n                del self._header[datasum_keyword]\n        elif (modified or self._new or\n                (checksum and ('CHECKSUM' not in self._header or\n                               'DATASUM' not in self._header or\n                               not self._checksum_valid or\n                               not self._datasum_valid))):\n            if checksum == 'datasum':\n                self.add_datasum(datasum_keyword=datasum_keyword)\n            elif checksum:\n                self.add_checksum(checksum_keyword=checksum_keyword,\n                                  datasum_keyword=datasum_keyword)\n\n    def _postwriteto(self):\n        # If data is unsigned integer 16, 32 or 64, remove the\n        # BSCALE/BZERO cards\n        if (self._has_data and self._standard and\n                _is_pseudo_integer(self.data.dtype)):\n            for keyword in ('BSCALE', 'BZERO'):\n                with suppress(KeyError):\n                    del self._header[keyword]\n\n    def _writeheader(self, fileobj):\n        offset = 0\n        with suppress(AttributeError, OSError):\n            offset = fileobj.tell()\n\n        self._header.tofile(fileobj)\n\n        try:\n            size = fileobj.tell() - offset\n        except (AttributeError, OSError):\n            size = len(str(self._header))\n\n        return offset, size\n\n    def _writedata(self, fileobj):\n        size = 0\n        fileobj.flush()\n        try:\n            offset = fileobj.tell()\n        except (AttributeError, OSError):\n            offset = 0\n\n        if self._data_loaded or self._data_needs_rescale:\n            if self.data is not None:\n                size += self._writedata_internal(fileobj)\n            # pad the FITS data block\n            # to avoid a bug in the lustre filesystem client, don't\n            # write zero-byte objects\n            if size > 0 and _pad_length(size) > 0:\n                padding = _pad_length(size) * self._padding_byte\n                # TODO: Not that this is ever likely, but if for some odd\n                # reason _padding_byte is > 0x80 this will fail; but really if\n                # somebody's custom fits format is doing that, they're doing it\n                # wrong and should be reprimanded harshly.\n                fileobj.write(padding.encode('ascii'))\n                size += len(padding)\n        else:\n            # The data has not been modified or does not need need to be\n            # rescaled, so it can be copied, unmodified, directly from an\n            # existing file or buffer\n            size += self._writedata_direct_copy(fileobj)\n\n        # flush, to make sure the content is written\n        fileobj.flush()\n\n        # return both the location and the size of the data area\n        return offset, size\n\n    def _writedata_internal(self, fileobj):\n        \"\"\"\n        The beginning and end of most _writedata() implementations are the\n        same, but the details of writing the data array itself can vary between\n        HDU types, so that should be implemented in this method.\n\n        Should return the size in bytes of the data written.\n        \"\"\"\n\n        fileobj.writearray(self.data)\n        return self.data.size * self.data.itemsize\n\n    def _writedata_direct_copy(self, fileobj):\n        \"\"\"Copies the data directly from one file/buffer to the new file.\n\n        For now this is handled by loading the raw data from the existing data\n        (including any padding) via a memory map or from an already in-memory\n        buffer and using Numpy's existing file-writing facilities to write to\n        the new file.\n\n        If this proves too slow a more direct approach may be used.\n        \"\"\"\n        raw = self._get_raw_data(self._data_size, 'ubyte', self._data_offset)\n        if raw is not None:\n            fileobj.writearray(raw)\n            return raw.nbytes\n        else:\n            return 0\n\n    # TODO: This is the start of moving HDU writing out of the _File class;\n    # Though right now this is an internal private method (though still used by\n    # HDUList, eventually the plan is to have this be moved into writeto()\n    # somehow...\n    def _writeto(self, fileobj, inplace=False, copy=False):\n        try:\n            dirname = os.path.dirname(fileobj._file.name)\n        except (AttributeError, TypeError):\n            dirname = None\n\n        with _free_space_check(self, dirname):\n            self._writeto_internal(fileobj, inplace, copy)\n\n    def _writeto_internal(self, fileobj, inplace, copy):\n        # For now fileobj is assumed to be a _File object\n        if not inplace or self._new:\n            header_offset, _ = self._writeheader(fileobj)\n            data_offset, data_size = self._writedata(fileobj)\n\n            # Set the various data location attributes on newly-written HDUs\n            if self._new:\n                self._header_offset = header_offset\n                self._data_offset = data_offset\n                self._data_size = data_size\n            return\n\n        hdrloc = self._header_offset\n        hdrsize = self._data_offset - self._header_offset\n        datloc = self._data_offset\n        datsize = self._data_size\n\n        if self._header._modified:\n            # Seek to the original header location in the file\n            self._file.seek(hdrloc)\n            # This should update hdrloc with he header location in the new file\n            hdrloc, hdrsize = self._writeheader(fileobj)\n\n            # If the data is to be written below with self._writedata, that\n            # will also properly update the data location; but it should be\n            # updated here too\n            datloc = hdrloc + hdrsize\n        elif copy:\n            # Seek to the original header location in the file\n            self._file.seek(hdrloc)\n            # Before writing, update the hdrloc with the current file position,\n            # which is the hdrloc for the new file\n            hdrloc = fileobj.tell()\n            fileobj.write(self._file.read(hdrsize))\n            # The header size is unchanged, but the data location may be\n            # different from before depending on if previous HDUs were resized\n            datloc = fileobj.tell()\n\n        if self._data_loaded:\n            if self.data is not None:\n                # Seek through the array's bases for an memmap'd array; we\n                # can't rely on the _File object to give us this info since\n                # the user may have replaced the previous mmap'd array\n                if copy or self._data_replaced:\n                    # Of course, if we're copying the data to a new file\n                    # we don't care about flushing the original mmap;\n                    # instead just read it into the new file\n                    array_mmap = None\n                else:\n                    array_mmap = _get_array_mmap(self.data)\n\n                if array_mmap is not None:\n                    array_mmap.flush()\n                else:\n                    self._file.seek(self._data_offset)\n                    datloc, datsize = self._writedata(fileobj)\n        elif copy:\n            datsize = self._writedata_direct_copy(fileobj)\n\n        self._header_offset = hdrloc\n        self._data_offset = datloc\n        self._data_size = datsize\n        self._data_replaced = False\n\n    def _close(self, closed=True):\n        # If the data was mmap'd, close the underlying mmap (this will\n        # prevent any future access to the .data attribute if there are\n        # not other references to it; if there are other references then\n        # it is up to the user to clean those up\n        if (closed and self._data_loaded and\n                _get_array_mmap(self.data) is not None):\n            del self.data\n\n\n# For backwards-compatibility, though nobody should have\n# been using this directly:\n_AllHDU = _BaseHDU\n\n# For convenience...\n# TODO: register_hdu could be made into a class decorator which would be pretty\n# cool, but only once 2.6 support is dropped.\nregister_hdu = _BaseHDU.register_hdu\nunregister_hdu = _BaseHDU.unregister_hdu\n\n\nclass _CorruptedHDU(_BaseHDU):\n    \"\"\"\n    A Corrupted HDU class.\n\n    This class is used when one or more mandatory `Card`s are\n    corrupted (unparsable), such as the ``BITPIX``, ``NAXIS``, or\n    ``END`` cards.  A corrupted HDU usually means that the data size\n    cannot be calculated or the ``END`` card is not found.  In the case\n    of a missing ``END`` card, the `Header` may also contain the binary\n    data\n\n    .. note::\n       In future, it may be possible to decipher where the last block\n       of the `Header` ends, but this task may be difficult when the\n       extension is a `TableHDU` containing ASCII data.\n    \"\"\"\n\n    @property\n    def size(self):\n        \"\"\"\n        Returns the size (in bytes) of the HDU's data part.\n        \"\"\"\n\n        # Note: On compressed files this might report a negative size; but the\n        # file is corrupt anyways so I'm not too worried about it.\n        if self._buffer is not None:\n            return len(self._buffer) - self._data_offset\n\n        return self._file.size - self._data_offset\n\n    def _summary(self):\n        return (self.name, self.ver, 'CorruptedHDU')\n\n    def verify(self):\n        pass\n\n\nclass _NonstandardHDU(_BaseHDU, _Verify):\n    \"\"\"\n    A Non-standard HDU class.\n\n    This class is used for a Primary HDU when the ``SIMPLE`` Card has\n    a value of `False`.  A non-standard HDU comes from a file that\n    resembles a FITS file but departs from the standards in some\n    significant way.  One example would be files where the numbers are\n    in the DEC VAX internal storage format rather than the standard\n    FITS most significant byte first.  The header for this HDU should\n    be valid.  The data for this HDU is read from the file as a byte\n    stream that begins at the first byte after the header ``END`` card\n    and continues until the end of the file.\n    \"\"\"\n\n    _standard = False\n\n    @classmethod\n    def match_header(cls, header):\n        \"\"\"\n        Matches any HDU that has the 'SIMPLE' keyword but is not a standard\n        Primary or Groups HDU.\n        \"\"\"\n\n        # The SIMPLE keyword must be in the first card\n        card = header.cards[0]\n\n        # The check that 'GROUPS' is missing is a bit redundant, since the\n        # match_header for GroupsHDU will always be called before this one.\n        if card.keyword == 'SIMPLE':\n            if 'GROUPS' not in header and card.value is False:\n                return True\n            else:\n                raise InvalidHDUException\n        else:\n            return False\n\n    @property\n    def size(self):\n        \"\"\"\n        Returns the size (in bytes) of the HDU's data part.\n        \"\"\"\n\n        if self._buffer is not None:\n            return len(self._buffer) - self._data_offset\n\n        return self._file.size - self._data_offset\n\n    def _writedata(self, fileobj):\n        \"\"\"\n        Differs from the base class :class:`_writedata` in that it doesn't\n        automatically add padding, and treats the data as a string of raw bytes\n        instead of an array.\n        \"\"\"\n\n        offset = 0\n        size = 0\n\n        fileobj.flush()\n        try:\n            offset = fileobj.tell()\n        except OSError:\n            offset = 0\n\n        if self.data is not None:\n            fileobj.write(self.data)\n            # flush, to make sure the content is written\n            fileobj.flush()\n            size = len(self.data)\n\n        # return both the location and the size of the data area\n        return offset, size\n\n    def _summary(self):\n        return (self.name, self.ver, 'NonstandardHDU', len(self._header))\n\n    @lazyproperty\n    def data(self):\n        \"\"\"\n        Return the file data.\n        \"\"\"\n\n        return self._get_raw_data(self.size, 'ubyte', self._data_offset)\n\n    def _verify(self, option='warn'):\n        errs = _ErrList([], unit='Card')\n\n        # verify each card\n        for card in self._header.cards:\n            errs.append(card._verify(option))\n\n        return errs\n\n\nclass _ValidHDU(_BaseHDU, _Verify):\n    \"\"\"\n    Base class for all HDUs which are not corrupted.\n    \"\"\"\n\n    def __init__(self, data=None, header=None, name=None, ver=None, **kwargs):\n        super().__init__(data=data, header=header)\n\n        if (header is not None and\n                not isinstance(header, (Header, _BasicHeader))):\n            # TODO: Instead maybe try initializing a new Header object from\n            # whatever is passed in as the header--there are various types\n            # of objects that could work for this...\n            raise ValueError('header must be a Header object')\n\n        # NOTE:  private data members _checksum and _datasum are used by the\n        # utility script \"fitscheck\" to detect missing checksums.\n        self._checksum = None\n        self._checksum_valid = None\n        self._datasum = None\n        self._datasum_valid = None\n\n        if name is not None:\n            self.name = name\n        if ver is not None:\n            self.ver = ver\n\n    @classmethod\n    def match_header(cls, header):\n        \"\"\"\n        Matches any HDU that is not recognized as having either the SIMPLE or\n        XTENSION keyword in its header's first card, but is nonetheless not\n        corrupted.\n\n        TODO: Maybe it would make more sense to use _NonstandardHDU in this\n        case?  Not sure...\n        \"\"\"\n\n        return first(header.keys()) not in ('SIMPLE', 'XTENSION')\n\n    @property\n    def size(self):\n        \"\"\"\n        Size (in bytes) of the data portion of the HDU.\n        \"\"\"\n\n        size = 0\n        naxis = self._header.get('NAXIS', 0)\n        if naxis > 0:\n            size = 1\n            for idx in range(naxis):\n                size = size * self._header['NAXIS' + str(idx + 1)]\n            bitpix = self._header['BITPIX']\n            gcount = self._header.get('GCOUNT', 1)\n            pcount = self._header.get('PCOUNT', 0)\n            size = abs(bitpix) * gcount * (pcount + size) // 8\n        return size\n\n    def filebytes(self):\n        \"\"\"\n        Calculates and returns the number of bytes that this HDU will write to\n        a file.\n        \"\"\"\n\n        f = _File()\n        # TODO: Fix this once new HDU writing API is settled on\n        return self._writeheader(f)[1] + self._writedata(f)[1]\n\n    def fileinfo(self):\n        \"\"\"\n        Returns a dictionary detailing information about the locations\n        of this HDU within any associated file.  The values are only\n        valid after a read or write of the associated file with no\n        intervening changes to the `HDUList`.\n\n        Returns\n        -------\n        dict or None\n            The dictionary details information about the locations of\n            this HDU within an associated file.  Returns `None` when\n            the HDU is not associated with a file.\n\n            Dictionary contents:\n\n            ========== ================================================\n            Key        Value\n            ========== ================================================\n            file       File object associated with the HDU\n            filemode   Mode in which the file was opened (readonly, copyonwrite,\n                       update, append, ostream)\n            hdrLoc     Starting byte location of header in file\n            datLoc     Starting byte location of data block in file\n            datSpan    Data size including padding\n            ========== ================================================\n        \"\"\"\n\n        if hasattr(self, '_file') and self._file:\n            return {'file': self._file, 'filemode': self._file.mode,\n                    'hdrLoc': self._header_offset, 'datLoc': self._data_offset,\n                    'datSpan': self._data_size}\n        else:\n            return None\n\n    def copy(self):\n        \"\"\"\n        Make a copy of the HDU, both header and data are copied.\n        \"\"\"\n\n        if self.data is not None:\n            data = self.data.copy()\n        else:\n            data = None\n        return self.__class__(data=data, header=self._header.copy())\n\n    def _verify(self, option='warn'):\n        errs = _ErrList([], unit='Card')\n\n        is_valid = BITPIX2DTYPE.__contains__\n\n        # Verify location and value of mandatory keywords.\n        # Do the first card here, instead of in the respective HDU classes, so\n        # the checking is in order, in case of required cards in wrong order.\n        if isinstance(self, ExtensionHDU):\n            firstkey = 'XTENSION'\n            firstval = self._extension\n        else:\n            firstkey = 'SIMPLE'\n            firstval = True\n\n        self.req_cards(firstkey, 0, None, firstval, option, errs)\n        self.req_cards('BITPIX', 1, lambda v: (_is_int(v) and is_valid(v)), 8,\n                       option, errs)\n        self.req_cards('NAXIS', 2,\n                       lambda v: (_is_int(v) and 0 <= v <= 999), 0,\n                       option, errs)\n\n        naxis = self._header.get('NAXIS', 0)\n        if naxis < 1000:\n            for ax in range(3, naxis + 3):\n                key = 'NAXIS' + str(ax - 2)\n                self.req_cards(key, ax,\n                               lambda v: (_is_int(v) and v >= 0),\n                               _extract_number(self._header[key], default=1),\n                               option, errs)\n\n            # Remove NAXISj cards where j is not in range 1, naxis inclusive.\n            for keyword in self._header:\n                if keyword.startswith('NAXIS') and len(keyword) > 5:\n                    try:\n                        number = int(keyword[5:])\n                        if number <= 0 or number > naxis:\n                            raise ValueError\n                    except ValueError:\n                        err_text = (\"NAXISj keyword out of range ('{}' when \"\n                                    \"NAXIS == {})\".format(keyword, naxis))\n\n                        def fix(self=self, keyword=keyword):\n                            del self._header[keyword]\n\n                        errs.append(\n                            self.run_option(option=option, err_text=err_text,\n                                            fix=fix, fix_text=\"Deleted.\"))\n\n        # Verify that the EXTNAME keyword exists and is a string\n        if 'EXTNAME' in self._header:\n            if not isinstance(self._header['EXTNAME'], str):\n                err_text = 'The EXTNAME keyword must have a string value.'\n                fix_text = 'Converted the EXTNAME keyword to a string value.'\n\n                def fix(header=self._header):\n                    header['EXTNAME'] = str(header['EXTNAME'])\n\n                errs.append(self.run_option(option, err_text=err_text,\n                                            fix_text=fix_text, fix=fix))\n\n        # verify each card\n        for card in self._header.cards:\n            errs.append(card._verify(option))\n\n        return errs\n\n    # TODO: Improve this API a little bit--for one, most of these arguments\n    # could be optional\n    def req_cards(self, keyword, pos, test, fix_value, option, errlist):\n        \"\"\"\n        Check the existence, location, and value of a required `Card`.\n\n        Parameters\n        ----------\n        keyword : str\n            The keyword to validate\n\n        pos : int, callable\n            If an ``int``, this specifies the exact location this card should\n            have in the header.  Remember that Python is zero-indexed, so this\n            means ``pos=0`` requires the card to be the first card in the\n            header.  If given a callable, it should take one argument--the\n            actual position of the keyword--and return `True` or `False`.  This\n            can be used for custom evaluation.  For example if\n            ``pos=lambda idx: idx > 10`` this will check that the keyword's\n            index is greater than 10.\n\n        test : callable\n            This should be a callable (generally a function) that is passed the\n            value of the given keyword and returns `True` or `False`.  This can\n            be used to validate the value associated with the given keyword.\n\n        fix_value : str, int, float, complex, bool, None\n            A valid value for a FITS keyword to to use if the given ``test``\n            fails to replace an invalid value.  In other words, this provides\n            a default value to use as a replacement if the keyword's current\n            value is invalid.  If `None`, there is no replacement value and the\n            keyword is unfixable.\n\n        option : str\n            Output verification option.  Must be one of ``\"fix\"``,\n            ``\"silentfix\"``, ``\"ignore\"``, ``\"warn\"``, or\n            ``\"exception\"``.  May also be any combination of ``\"fix\"`` or\n            ``\"silentfix\"`` with ``\"+ignore\"``, ``+warn``, or ``+exception\"\n            (e.g. ``\"fix+warn\"``).  See :ref:`astropy:verify` for more info.\n\n        errlist : list\n            A list of validation errors already found in the FITS file; this is\n            used primarily for the validation system to collect errors across\n            multiple HDUs and multiple calls to `req_cards`.\n\n        Notes\n        -----\n        If ``pos=None``, the card can be anywhere in the header.  If the card\n        does not exist, the new card will have the ``fix_value`` as its value\n        when created.  Also check the card's value by using the ``test``\n        argument.\n        \"\"\"\n\n        errs = errlist\n        fix = None\n\n        try:\n            index = self._header.index(keyword)\n        except ValueError:\n            index = None\n\n        fixable = fix_value is not None\n\n        insert_pos = len(self._header) + 1\n\n        # If pos is an int, insert at the given position (and convert it to a\n        # lambda)\n        if _is_int(pos):\n            insert_pos = pos\n            pos = lambda x: x == insert_pos\n\n        # if the card does not exist\n        if index is None:\n            err_text = f\"'{keyword}' card does not exist.\"\n            fix_text = f\"Fixed by inserting a new '{keyword}' card.\"\n            if fixable:\n                # use repr to accommodate both string and non-string types\n                # Boolean is also OK in this constructor\n                card = (keyword, fix_value)\n\n                def fix(self=self, insert_pos=insert_pos, card=card):\n                    self._header.insert(insert_pos, card)\n\n            errs.append(self.run_option(option, err_text=err_text,\n                        fix_text=fix_text, fix=fix, fixable=fixable))\n        else:\n            # if the supposed location is specified\n            if pos is not None:\n                if not pos(index):\n                    err_text = f\"'{keyword}' card at the wrong place (card {index}).\"\n                    fix_text = f\"Fixed by moving it to the right place (card {insert_pos}).\"\n\n                    def fix(self=self, index=index, insert_pos=insert_pos):\n                        card = self._header.cards[index]\n                        del self._header[index]\n                        self._header.insert(insert_pos, card)\n\n                    errs.append(self.run_option(option, err_text=err_text,\n                                fix_text=fix_text, fix=fix))\n\n            # if value checking is specified\n            if test:\n                val = self._header[keyword]\n                if not test(val):\n                    err_text = f\"'{keyword}' card has invalid value '{val}'.\"\n                    fix_text = f\"Fixed by setting a new value '{fix_value}'.\"\n\n                    if fixable:\n                        def fix(self=self, keyword=keyword, val=fix_value):\n                            self._header[keyword] = fix_value\n\n                    errs.append(self.run_option(option, err_text=err_text,\n                                fix_text=fix_text, fix=fix, fixable=fixable))\n\n        return errs\n\n    def add_datasum(self, when=None, datasum_keyword='DATASUM'):\n        \"\"\"\n        Add the ``DATASUM`` card to this HDU with the value set to the\n        checksum calculated for the data.\n\n        Parameters\n        ----------\n        when : str, optional\n            Comment string for the card that by default represents the\n            time when the checksum was calculated\n\n        datasum_keyword : str, optional\n            The name of the header keyword to store the datasum value in;\n            this is typically 'DATASUM' per convention, but there exist\n            use cases in which a different keyword should be used\n\n        Returns\n        -------\n        checksum : int\n            The calculated datasum\n\n        Notes\n        -----\n        For testing purposes, provide a ``when`` argument to enable the comment\n        value in the card to remain consistent.  This will enable the\n        generation of a ``CHECKSUM`` card with a consistent value.\n        \"\"\"\n\n        cs = self._calculate_datasum()\n\n        if when is None:\n            when = f'data unit checksum updated {self._get_timestamp()}'\n\n        self._header[datasum_keyword] = (str(cs), when)\n        return cs\n\n    def add_checksum(self, when=None, override_datasum=False,\n                     checksum_keyword='CHECKSUM', datasum_keyword='DATASUM'):\n        \"\"\"\n        Add the ``CHECKSUM`` and ``DATASUM`` cards to this HDU with\n        the values set to the checksum calculated for the HDU and the\n        data respectively.  The addition of the ``DATASUM`` card may\n        be overridden.\n\n        Parameters\n        ----------\n        when : str, optional\n            comment string for the cards; by default the comments\n            will represent the time when the checksum was calculated\n        override_datasum : bool, optional\n            add the ``CHECKSUM`` card only\n        checksum_keyword : str, optional\n            The name of the header keyword to store the checksum value in; this\n            is typically 'CHECKSUM' per convention, but there exist use cases\n            in which a different keyword should be used\n\n        datasum_keyword : str, optional\n            See ``checksum_keyword``\n\n        Notes\n        -----\n        For testing purposes, first call `add_datasum` with a ``when``\n        argument, then call `add_checksum` with a ``when`` argument and\n        ``override_datasum`` set to `True`.  This will provide consistent\n        comments for both cards and enable the generation of a ``CHECKSUM``\n        card with a consistent value.\n        \"\"\"\n\n        if not override_datasum:\n            # Calculate and add the data checksum to the header.\n            data_cs = self.add_datasum(when, datasum_keyword=datasum_keyword)\n        else:\n            # Just calculate the data checksum\n            data_cs = self._calculate_datasum()\n\n        if when is None:\n            when = f'HDU checksum updated {self._get_timestamp()}'\n\n        # Add the CHECKSUM card to the header with a value of all zeros.\n        if datasum_keyword in self._header:\n            self._header.set(checksum_keyword, '0' * 16, when,\n                             before=datasum_keyword)\n        else:\n            self._header.set(checksum_keyword, '0' * 16, when)\n\n        csum = self._calculate_checksum(data_cs,\n                                        checksum_keyword=checksum_keyword)\n        self._header[checksum_keyword] = csum\n\n    def verify_datasum(self):\n        \"\"\"\n        Verify that the value in the ``DATASUM`` keyword matches the value\n        calculated for the ``DATASUM`` of the current HDU data.\n\n        Returns\n        -------\n        valid : int\n            - 0 - failure\n            - 1 - success\n            - 2 - no ``DATASUM`` keyword present\n        \"\"\"\n\n        if 'DATASUM' in self._header:\n            datasum = self._calculate_datasum()\n            if datasum == int(self._header['DATASUM']):\n                return 1\n            else:\n                # Failed\n                return 0\n        else:\n            return 2\n\n    def verify_checksum(self):\n        \"\"\"\n        Verify that the value in the ``CHECKSUM`` keyword matches the\n        value calculated for the current HDU CHECKSUM.\n\n        Returns\n        -------\n        valid : int\n            - 0 - failure\n            - 1 - success\n            - 2 - no ``CHECKSUM`` keyword present\n        \"\"\"\n\n        if 'CHECKSUM' in self._header:\n            if 'DATASUM' in self._header:\n                datasum = self._calculate_datasum()\n            else:\n                datasum = 0\n            checksum = self._calculate_checksum(datasum)\n            if checksum == self._header['CHECKSUM']:\n                return 1\n            else:\n                # Failed\n                return 0\n        else:\n            return 2\n\n    def _verify_checksum_datasum(self):\n        \"\"\"\n        Verify the checksum/datasum values if the cards exist in the header.\n        Simply displays warnings if either the checksum or datasum don't match.\n        \"\"\"\n\n        if 'CHECKSUM' in self._header:\n            self._checksum = self._header['CHECKSUM']\n            self._checksum_valid = self.verify_checksum()\n            if not self._checksum_valid:\n                warnings.warn(\n                    'Checksum verification failed for HDU {}.\\n'.format(\n                        (self.name, self.ver)), AstropyUserWarning)\n\n        if 'DATASUM' in self._header:\n            self._datasum = self._header['DATASUM']\n            self._datasum_valid = self.verify_datasum()\n            if not self._datasum_valid:\n                warnings.warn(\n                    'Datasum verification failed for HDU {}.\\n'.format(\n                        (self.name, self.ver)), AstropyUserWarning)\n\n    def _get_timestamp(self):\n        \"\"\"\n        Return the current timestamp in ISO 8601 format, with microseconds\n        stripped off.\n\n        Ex.: 2007-05-30T19:05:11\n        \"\"\"\n\n        return datetime.datetime.now().isoformat()[:19]\n\n    def _calculate_datasum(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        \"\"\"\n\n        if not self._data_loaded:\n            # This is the case where the data has not been read from the file\n            # yet.  We find the data in the file, read it, and calculate the\n            # datasum.\n            if self.size > 0:\n                raw_data = self._get_raw_data(self._data_size, 'ubyte',\n                                              self._data_offset)\n                return self._compute_checksum(raw_data)\n            else:\n                return 0\n        elif self.data is not None:\n            return self._compute_checksum(self.data.view('ubyte'))\n        else:\n            return 0\n\n    def _calculate_checksum(self, datasum, checksum_keyword='CHECKSUM'):\n        \"\"\"\n        Calculate the value of the ``CHECKSUM`` card in the HDU.\n        \"\"\"\n\n        old_checksum = self._header[checksum_keyword]\n        self._header[checksum_keyword] = '0' * 16\n\n        # Convert the header to bytes.\n        s = self._header.tostring().encode('utf8')\n\n        # Calculate the checksum of the Header and data.\n        cs = self._compute_checksum(np.frombuffer(s, dtype='ubyte'), datasum)\n\n        # Encode the checksum into a string.\n        s = self._char_encode(~cs)\n\n        # Return the header card value.\n        self._header[checksum_keyword] = old_checksum\n\n        return s\n\n    def _compute_checksum(self, data, sum32=0):\n        \"\"\"\n        Compute the ones-complement checksum of a sequence of bytes.\n\n        Parameters\n        ----------\n        data\n            a memory region to checksum\n\n        sum32\n            incremental checksum value from another region\n\n        Returns\n        -------\n        ones complement checksum\n        \"\"\"\n\n        blocklen = 2880\n        sum32 = np.uint32(sum32)\n        for i in range(0, len(data), blocklen):\n            length = min(blocklen, len(data) - i)   # ????\n            sum32 = self._compute_hdu_checksum(data[i:i + length], sum32)\n        return sum32\n\n    def _compute_hdu_checksum(self, data, sum32=0):\n        \"\"\"\n        Translated from FITS Checksum Proposal by Seaman, Pence, and Rots.\n        Use uint32 literals as a hedge against type promotion to int64.\n\n        This code should only be called with blocks of 2880 bytes\n        Longer blocks result in non-standard checksums with carry overflow\n        Historically,  this code *was* called with larger blocks and for that\n        reason still needs to be for backward compatibility.\n        \"\"\"\n\n        u8 = np.uint32(8)\n        u16 = np.uint32(16)\n        uFFFF = np.uint32(0xFFFF)\n\n        if data.nbytes % 2:\n            last = data[-1]\n            data = data[:-1]\n        else:\n            last = np.uint32(0)\n\n        data = data.view('>u2')\n\n        hi = sum32 >> u16\n        lo = sum32 & uFFFF\n        hi += np.add.reduce(data[0::2], dtype=np.uint64)\n        lo += np.add.reduce(data[1::2], dtype=np.uint64)\n\n        if (data.nbytes // 2) % 2:\n            lo += last << u8\n        else:\n            hi += last << u8\n\n        hicarry = hi >> u16\n        locarry = lo >> u16\n\n        while hicarry or locarry:\n            hi = (hi & uFFFF) + locarry\n            lo = (lo & uFFFF) + hicarry\n            hicarry = hi >> u16\n            locarry = lo >> u16\n\n        return (hi << u16) + lo\n\n    # _MASK and _EXCLUDE used for encoding the checksum value into a character\n    # string.\n    _MASK = [0xFF000000,\n             0x00FF0000,\n             0x0000FF00,\n             0x000000FF]\n\n    _EXCLUDE = [0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40,\n                0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60]\n\n    def _encode_byte(self, byte):\n        \"\"\"\n        Encode a single byte.\n        \"\"\"\n\n        quotient = byte // 4 + ord('0')\n        remainder = byte % 4\n\n        ch = np.array(\n            [(quotient + remainder), quotient, quotient, quotient],\n            dtype='int32')\n\n        check = True\n        while check:\n            check = False\n            for x in self._EXCLUDE:\n                for j in [0, 2]:\n                    if ch[j] == x or ch[j + 1] == x:\n                        ch[j] += 1\n                        ch[j + 1] -= 1\n                        check = True\n        return ch\n\n    def _char_encode(self, value):\n        \"\"\"\n        Encodes the checksum ``value`` using the algorithm described\n        in SPR section A.7.2 and returns it as a 16 character string.\n\n        Parameters\n        ----------\n        value\n            a checksum\n\n        Returns\n        -------\n        ascii encoded checksum\n        \"\"\"\n\n        value = np.uint32(value)\n\n        asc = np.zeros((16,), dtype='byte')\n        ascii = np.zeros((16,), dtype='byte')\n\n        for i in range(4):\n            byte = (value & self._MASK[i]) >> ((3 - i) * 8)\n            ch = self._encode_byte(byte)\n            for j in range(4):\n                asc[4 * j + i] = ch[j]\n\n        for i in range(16):\n            ascii[i] = asc[(i + 15) % 16]\n\n        return decode_ascii(ascii.tobytes())\n\n\nclass ExtensionHDU(_ValidHDU):\n    \"\"\"\n    An extension HDU class.\n\n    This class is the base class for the `TableHDU`, `ImageHDU`, and\n    `BinTableHDU` classes.\n    \"\"\"\n\n    _extension = ''\n\n    @classmethod\n    def match_header(cls, header):\n        \"\"\"\n        This class should never be instantiated directly.  Either a standard\n        extension HDU type should be used for a specific extension, or\n        NonstandardExtHDU should be used.\n        \"\"\"\n\n        raise NotImplementedError\n\n    def writeto(self, name, output_verify='exception', overwrite=False,\n                checksum=False):\n        \"\"\"\n        Works similarly to the normal writeto(), but prepends a default\n        `PrimaryHDU` are required by extension HDUs (which cannot stand on\n        their own).\n        \"\"\"\n\n        from .hdulist import HDUList\n        from .image import PrimaryHDU\n\n        hdulist = HDUList([PrimaryHDU(), self])\n        hdulist.writeto(name, output_verify, overwrite=overwrite,\n                        checksum=checksum)\n\n    def _verify(self, option='warn'):\n\n        errs = super()._verify(option=option)\n\n        # Verify location and value of mandatory keywords.\n        naxis = self._header.get('NAXIS', 0)\n        self.req_cards('PCOUNT', naxis + 3, lambda v: (_is_int(v) and v >= 0),\n                       0, option, errs)\n        self.req_cards('GCOUNT', naxis + 4, lambda v: (_is_int(v) and v == 1),\n                       1, option, errs)\n\n        return errs\n\n\n# For backwards compatibility, though this needs to be deprecated\n# TODO: Mark this as deprecated\n_ExtensionHDU = ExtensionHDU\n\n\nclass NonstandardExtHDU(ExtensionHDU):\n    \"\"\"\n    A Non-standard Extension HDU class.\n\n    This class is used for an Extension HDU when the ``XTENSION``\n    `Card` has a non-standard value.  In this case, Astropy can figure\n    out how big the data is but not what it is.  The data for this HDU\n    is read from the file as a byte stream that begins at the first\n    byte after the header ``END`` card and continues until the\n    beginning of the next header or the end of the file.\n    \"\"\"\n\n    _standard = False\n\n    @classmethod\n    def match_header(cls, header):\n        \"\"\"\n        Matches any extension HDU that is not one of the standard extension HDU\n        types.\n        \"\"\"\n\n        card = header.cards[0]\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n        # A3DTABLE is not really considered a 'standard' extension, as it was\n        # sort of the prototype for BINTABLE; however, since our BINTABLE\n        # implementation handles A3DTABLE HDUs it is listed here.\n        standard_xtensions = ('IMAGE', 'TABLE', 'BINTABLE', 'A3DTABLE')\n        # The check that xtension is not one of the standard types should be\n        # redundant.\n        return (card.keyword == 'XTENSION' and\n                xtension not in standard_xtensions)\n\n    def _summary(self):\n        axes = tuple(self.data.shape)\n        return (self.name, self.ver, 'NonstandardExtHDU', len(self._header), axes)\n\n    @lazyproperty\n    def data(self):\n        \"\"\"\n        Return the file data.\n        \"\"\"\n\n        return self._get_raw_data(self.size, 'ubyte', self._data_offset)\n\n\n# TODO: Mark this as deprecated\n_NonstandardExtHDU = NonstandardExtHDU\n"},{"fileName":"image.py","filePath":"astropy/io/fits/hdu","id":2622,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport sys\nimport mmap\nimport warnings\n\nimport numpy as np\n\nfrom .base import DELAYED, _ValidHDU, ExtensionHDU, BITPIX2DTYPE, DTYPE2BITPIX\nfrom astropy.io.fits.header import Header\nfrom astropy.io.fits.util import (_is_pseudo_integer, _pseudo_zero, _is_int,\n                                  _is_dask_array)\nfrom astropy.io.fits.verify import VerifyWarning\n\nfrom astropy.utils import isiterable, lazyproperty\n\n\n__all__ = [\"Section\", \"PrimaryHDU\", \"ImageHDU\"]\n\n\nclass _ImageBaseHDU(_ValidHDU):\n    \"\"\"FITS image HDU base class.\n\n    Attributes\n    ----------\n    header\n        image header\n\n    data\n        image data\n    \"\"\"\n\n    standard_keyword_comments = {\n        'SIMPLE': 'conforms to FITS standard',\n        'XTENSION': 'Image extension',\n        'BITPIX': 'array data type',\n        'NAXIS': 'number of array dimensions',\n        'GROUPS': 'has groups',\n        'PCOUNT': 'number of parameters',\n        'GCOUNT': 'number of groups'\n    }\n\n    def __init__(self, data=None, header=None, do_not_scale_image_data=False,\n                 uint=True, scale_back=False, ignore_blank=False, **kwargs):\n\n        from .groups import GroupsHDU\n\n        super().__init__(data=data, header=header)\n\n        if data is DELAYED:\n            # Presumably if data is DELAYED then this HDU is coming from an\n            # open file, and was not created in memory\n            if header is None:\n                # this should never happen\n                raise ValueError('No header to setup HDU.')\n        else:\n            # TODO: Some of this card manipulation should go into the\n            # PrimaryHDU and GroupsHDU subclasses\n            # construct a list of cards of minimal header\n            if isinstance(self, ExtensionHDU):\n                c0 = ('XTENSION', 'IMAGE',\n                      self.standard_keyword_comments['XTENSION'])\n            else:\n                c0 = ('SIMPLE', True, self.standard_keyword_comments['SIMPLE'])\n            cards = [\n                c0,\n                ('BITPIX', 8, self.standard_keyword_comments['BITPIX']),\n                ('NAXIS', 0, self.standard_keyword_comments['NAXIS'])]\n\n            if isinstance(self, GroupsHDU):\n                cards.append(('GROUPS', True,\n                             self.standard_keyword_comments['GROUPS']))\n\n            if isinstance(self, (ExtensionHDU, GroupsHDU)):\n                cards.append(('PCOUNT', 0,\n                              self.standard_keyword_comments['PCOUNT']))\n                cards.append(('GCOUNT', 1,\n                              self.standard_keyword_comments['GCOUNT']))\n\n            if header is not None:\n                orig = header.copy()\n                header = Header(cards)\n                header.extend(orig, strip=True, update=True, end=True)\n            else:\n                header = Header(cards)\n\n            self._header = header\n\n        self._do_not_scale_image_data = do_not_scale_image_data\n\n        self._uint = uint\n        self._scale_back = scale_back\n\n        # Keep track of whether BZERO/BSCALE were set from the header so that\n        # values for self._orig_bzero and self._orig_bscale can be set\n        # properly, if necessary, once the data has been set.\n        bzero_in_header = 'BZERO' in self._header\n        bscale_in_header = 'BSCALE' in self._header\n        self._bzero = self._header.get('BZERO', 0)\n        self._bscale = self._header.get('BSCALE', 1)\n\n        # Save off other important values from the header needed to interpret\n        # the image data\n        self._axes = [self._header.get('NAXIS' + str(axis + 1), 0)\n                      for axis in range(self._header.get('NAXIS', 0))]\n\n        # Not supplying a default for BITPIX makes sense because BITPIX\n        # is either in the header or should be determined from the dtype of\n        # the data (which occurs when the data is set).\n        self._bitpix = self._header.get('BITPIX')\n        self._gcount = self._header.get('GCOUNT', 1)\n        self._pcount = self._header.get('PCOUNT', 0)\n        self._blank = None if ignore_blank else self._header.get('BLANK')\n        self._verify_blank()\n\n        self._orig_bitpix = self._bitpix\n        self._orig_blank = self._header.get('BLANK')\n\n        # These get set again below, but need to be set to sensible defaults\n        # here.\n        self._orig_bzero = self._bzero\n        self._orig_bscale = self._bscale\n\n        # Set the name attribute if it was provided (if this is an ImageHDU\n        # this will result in setting the EXTNAME keyword of the header as\n        # well)\n        if 'name' in kwargs and kwargs['name']:\n            self.name = kwargs['name']\n        if 'ver' in kwargs and kwargs['ver']:\n            self.ver = kwargs['ver']\n\n        # Set to True if the data or header is replaced, indicating that\n        # update_header should be called\n        self._modified = False\n\n        if data is DELAYED:\n            if (not do_not_scale_image_data and\n                    (self._bscale != 1 or self._bzero != 0)):\n                # This indicates that when the data is accessed or written out\n                # to a new file it will need to be rescaled\n                self._data_needs_rescale = True\n            return\n        else:\n            # Setting data will update the header and set _bitpix, _bzero,\n            # and _bscale to the appropriate BITPIX for the data, and always\n            # sets _bzero=0 and _bscale=1.\n            self.data = data\n\n            # Check again for BITPIX/BSCALE/BZERO in case they changed when the\n            # data was assigned. This can happen, for example, if the input\n            # data is an unsigned int numpy array.\n            self._bitpix = self._header.get('BITPIX')\n\n            # Do not provide default values for BZERO and BSCALE here because\n            # the keywords will have been deleted in the header if appropriate\n            # after scaling. We do not want to put them back in if they\n            # should not be there.\n            self._bzero = self._header.get('BZERO')\n            self._bscale = self._header.get('BSCALE')\n\n        # Handle case where there was no BZERO/BSCALE in the initial header\n        # but there should be a BSCALE/BZERO now that the data has been set.\n        if not bzero_in_header:\n            self._orig_bzero = self._bzero\n        if not bscale_in_header:\n            self._orig_bscale = self._bscale\n\n    @classmethod\n    def match_header(cls, header):\n        \"\"\"\n        _ImageBaseHDU is sort of an abstract class for HDUs containing image\n        data (as opposed to table data) and should never be used directly.\n        \"\"\"\n\n        raise NotImplementedError\n\n    @property\n    def is_image(self):\n        return True\n\n    @property\n    def section(self):\n        \"\"\"\n        Access a section of the image array without loading the entire array\n        into memory.  The :class:`Section` object returned by this attribute is\n        not meant to be used directly by itself.  Rather, slices of the section\n        return the appropriate slice of the data, and loads *only* that section\n        into memory.\n\n        Sections are mostly obsoleted by memmap support, but should still be\n        used to deal with very large scaled images.  See the\n        :ref:`astropy:data-sections` section of the Astropy documentation for\n        more details.\n        \"\"\"\n\n        return Section(self)\n\n    @property\n    def shape(self):\n        \"\"\"\n        Shape of the image array--should be equivalent to ``self.data.shape``.\n        \"\"\"\n\n        # Determine from the values read from the header\n        return tuple(reversed(self._axes))\n\n    @property\n    def header(self):\n        return self._header\n\n    @header.setter\n    def header(self, header):\n        self._header = header\n        self._modified = True\n        self.update_header()\n\n    @lazyproperty\n    def data(self):\n        \"\"\"\n        Image/array data as a `~numpy.ndarray`.\n\n        Please remember that the order of axes on an Numpy array are opposite\n        of the order specified in the FITS file.  For example for a 2D image\n        the \"rows\" or y-axis are the first dimension, and the \"columns\" or\n        x-axis are the second dimension.\n\n        If the data is scaled using the BZERO and BSCALE parameters, this\n        attribute returns the data scaled to its physical values unless the\n        file was opened with ``do_not_scale_image_data=True``.\n        \"\"\"\n\n        if len(self._axes) < 1:\n            return\n\n        data = self._get_scaled_image_data(self._data_offset, self.shape)\n        self._update_header_scale_info(data.dtype)\n\n        return data\n\n    @data.setter\n    def data(self, data):\n        if 'data' in self.__dict__ and self.__dict__['data'] is not None:\n            if self.__dict__['data'] is data:\n                return\n            else:\n                self._data_replaced = True\n            was_unsigned = _is_pseudo_integer(self.__dict__['data'].dtype)\n        else:\n            self._data_replaced = True\n            was_unsigned = False\n\n        if (data is not None\n                and not isinstance(data, np.ndarray)\n                and not _is_dask_array(data)):\n            # Try to coerce the data into a numpy array--this will work, on\n            # some level, for most objects\n            try:\n                data = np.array(data)\n            except Exception:\n                raise TypeError('data object {!r} could not be coerced into an '\n                                'ndarray'.format(data))\n\n            if data.shape == ():\n                raise TypeError('data object {!r} should have at least one '\n                                'dimension'.format(data))\n\n        self.__dict__['data'] = data\n        self._modified = True\n\n        if self.data is None:\n            self._axes = []\n        else:\n            # Set new values of bitpix, bzero, and bscale now, but wait to\n            # revise original values until header is updated.\n            self._bitpix = DTYPE2BITPIX[data.dtype.name]\n            self._bscale = 1\n            self._bzero = 0\n            self._blank = None\n            self._axes = list(data.shape)\n            self._axes.reverse()\n\n        # Update the header, including adding BZERO/BSCALE if new data is\n        # unsigned. Does not change the values of self._bitpix,\n        # self._orig_bitpix, etc.\n        self.update_header()\n        if (data is not None and was_unsigned):\n            self._update_header_scale_info(data.dtype)\n\n        # Keep _orig_bitpix as it was until header update is done, then\n        # set it, to allow easier handling of the case of unsigned\n        # integer data being converted to something else. Setting these here\n        # is needed only for the case do_not_scale_image_data=True when\n        # setting the data to unsigned int.\n\n        # If necessary during initialization, i.e. if BSCALE and BZERO were\n        # not in the header but the data was unsigned, the attributes below\n        # will be update in __init__.\n        self._orig_bitpix = self._bitpix\n        self._orig_bscale = self._bscale\n        self._orig_bzero = self._bzero\n\n        # returning the data signals to lazyproperty that we've already handled\n        # setting self.__dict__['data']\n        return data\n\n    def update_header(self):\n        \"\"\"\n        Update the header keywords to agree with the data.\n        \"\"\"\n\n        if not (self._modified or self._header._modified or\n                (self._has_data and self.shape != self.data.shape)):\n            # Not likely that anything needs updating\n            return\n\n        old_naxis = self._header.get('NAXIS', 0)\n\n        if 'BITPIX' not in self._header:\n            bitpix_comment = self.standard_keyword_comments['BITPIX']\n        else:\n            bitpix_comment = self._header.comments['BITPIX']\n\n        # Update the BITPIX keyword and ensure it's in the correct\n        # location in the header\n        self._header.set('BITPIX', self._bitpix, bitpix_comment, after=0)\n\n        # If the data's shape has changed (this may have happened without our\n        # noticing either via a direct update to the data.shape attribute) we\n        # need to update the internal self._axes\n        if self._has_data and self.shape != self.data.shape:\n            self._axes = list(self.data.shape)\n            self._axes.reverse()\n\n        # Update the NAXIS keyword and ensure it's in the correct location in\n        # the header\n        if 'NAXIS' in self._header:\n            naxis_comment = self._header.comments['NAXIS']\n        else:\n            naxis_comment = self.standard_keyword_comments['NAXIS']\n        self._header.set('NAXIS', len(self._axes), naxis_comment,\n                         after='BITPIX')\n\n        # TODO: This routine is repeated in several different classes--it\n        # should probably be made available as a method on all standard HDU\n        # types\n        # add NAXISi if it does not exist\n        for idx, axis in enumerate(self._axes):\n            naxisn = 'NAXIS' + str(idx + 1)\n            if naxisn in self._header:\n                self._header[naxisn] = axis\n            else:\n                if (idx == 0):\n                    after = 'NAXIS'\n                else:\n                    after = 'NAXIS' + str(idx)\n                self._header.set(naxisn, axis, after=after)\n\n        # delete extra NAXISi's\n        for idx in range(len(self._axes) + 1, old_naxis + 1):\n            try:\n                del self._header['NAXIS' + str(idx)]\n            except KeyError:\n                pass\n\n        if 'BLANK' in self._header:\n            self._blank = self._header['BLANK']\n\n        # Add BSCALE/BZERO to header if data is unsigned int.\n        self._update_pseudo_int_scale_keywords()\n\n        self._modified = False\n\n    def _update_header_scale_info(self, dtype=None):\n        \"\"\"\n        Delete BSCALE/BZERO from header if necessary.\n        \"\"\"\n\n        # Note that _dtype_for_bitpix determines the dtype based on the\n        # \"original\" values of bitpix, bscale, and bzero, stored in\n        # self._orig_bitpix, etc. It contains the logic for determining which\n        # special cases of BZERO/BSCALE, if any, are auto-detected as following\n        # the FITS unsigned int convention.\n\n        # Added original_was_unsigned with the intent of facilitating the\n        # special case of do_not_scale_image_data=True and uint=True\n        # eventually.\n        # FIXME: unused, maybe it should be useful?\n        # if self._dtype_for_bitpix() is not None:\n        #     original_was_unsigned = self._dtype_for_bitpix().kind == 'u'\n        # else:\n        #     original_was_unsigned = False\n\n        if (self._do_not_scale_image_data or\n                (self._orig_bzero == 0 and self._orig_bscale == 1)):\n            return\n\n        if dtype is None:\n            dtype = self._dtype_for_bitpix()\n\n        if (dtype is not None and dtype.kind == 'u' and\n                (self._scale_back or self._scale_back is None)):\n            # Data is pseudo-unsigned integers, and the scale_back option\n            # was not explicitly set to False, so preserve all the scale\n            # factors\n            return\n\n        for keyword in ['BSCALE', 'BZERO']:\n            try:\n                del self._header[keyword]\n                # Since _update_header_scale_info can, currently, be called\n                # *after* _prewriteto(), replace these with blank cards so\n                # the header size doesn't change\n                self._header.append()\n            except KeyError:\n                pass\n\n        if dtype is None:\n            dtype = self._dtype_for_bitpix()\n        if dtype is not None:\n            self._header['BITPIX'] = DTYPE2BITPIX[dtype.name]\n\n        self._bzero = 0\n        self._bscale = 1\n        self._bitpix = self._header['BITPIX']\n        self._blank = self._header.pop('BLANK', None)\n\n    def scale(self, type=None, option='old', bscale=None, bzero=None):\n        \"\"\"\n        Scale image data by using ``BSCALE``/``BZERO``.\n\n        Call to this method will scale `data` and update the keywords of\n        ``BSCALE`` and ``BZERO`` in the HDU's header.  This method should only\n        be used right before writing to the output file, as the data will be\n        scaled and is therefore not very usable after the call.\n\n        Parameters\n        ----------\n        type : str, optional\n            destination data type, use a string representing a numpy\n            dtype name, (e.g. ``'uint8'``, ``'int16'``, ``'float32'``\n            etc.).  If is `None`, use the current data type.\n\n        option : str, optional\n            How to scale the data: ``\"old\"`` uses the original ``BSCALE`` and\n            ``BZERO`` values from when the data was read/created (defaulting to\n            1 and 0 if they don't exist). For integer data only, ``\"minmax\"``\n            uses the minimum and maximum of the data to scale. User-specified\n            ``bscale``/``bzero`` values always take precedence.\n\n        bscale, bzero : int, optional\n            User-specified ``BSCALE`` and ``BZERO`` values\n        \"\"\"\n\n        # Disable blank support for now\n        self._scale_internal(type=type, option=option, bscale=bscale,\n                             bzero=bzero, blank=None)\n\n    def _scale_internal(self, type=None, option='old', bscale=None, bzero=None,\n                        blank=0):\n        \"\"\"\n        This is an internal implementation of the `scale` method, which\n        also supports handling BLANK properly.\n\n        TODO: This is only needed for fixing #3865 without introducing any\n        public API changes.  We should support BLANK better when rescaling\n        data, and when that is added the need for this internal interface\n        should go away.\n\n        Note: the default of ``blank=0`` merely reflects the current behavior,\n        and is not necessarily a deliberate choice (better would be to disallow\n        conversion of floats to ints without specifying a BLANK if there are\n        NaN/inf values).\n        \"\"\"\n\n        if self.data is None:\n            return\n\n        # Determine the destination (numpy) data type\n        if type is None:\n            type = BITPIX2DTYPE[self._bitpix]\n        _type = getattr(np, type)\n\n        # Determine how to scale the data\n        # bscale and bzero takes priority\n        if bscale is not None and bzero is not None:\n            _scale = bscale\n            _zero = bzero\n        elif bscale is not None:\n            _scale = bscale\n            _zero = 0\n        elif bzero is not None:\n            _scale = 1\n            _zero = bzero\n        elif (option == 'old' and self._orig_bscale is not None and\n                self._orig_bzero is not None):\n            _scale = self._orig_bscale\n            _zero = self._orig_bzero\n        elif option == 'minmax' and not issubclass(_type, np.floating):\n            if _is_dask_array(self.data):\n                min = self.data.min().compute()\n                max = self.data.max().compute()\n            else:\n                min = np.minimum.reduce(self.data.flat)\n                max = np.maximum.reduce(self.data.flat)\n\n            if _type == np.uint8:  # uint8 case\n                _zero = min\n                _scale = (max - min) / (2.0 ** 8 - 1)\n            else:\n                _zero = (max + min) / 2.0\n\n                # throw away -2^N\n                nbytes = 8 * _type().itemsize\n                _scale = (max - min) / (2.0 ** nbytes - 2)\n        else:\n            _scale = 1\n            _zero = 0\n\n        # Do the scaling\n        if _zero != 0:\n            if _is_dask_array(self.data):\n                self.data = self.data - _zero\n            else:\n                # 0.9.6.3 to avoid out of range error for BZERO = +32768\n                # We have to explicitly cast _zero to prevent numpy from raising an\n                # error when doing self.data -= zero, and we do this instead of\n                # self.data = self.data - zero to avoid doubling memory usage.\n                np.add(self.data, -_zero, out=self.data, casting='unsafe')\n            self._header['BZERO'] = _zero\n        else:\n            try:\n                del self._header['BZERO']\n            except KeyError:\n                pass\n\n        if _scale and _scale != 1:\n            self.data = self.data / _scale\n            self._header['BSCALE'] = _scale\n        else:\n            try:\n                del self._header['BSCALE']\n            except KeyError:\n                pass\n\n        # Set blanks\n        if blank is not None and issubclass(_type, np.integer):\n            # TODO: Perhaps check that the requested BLANK value fits in the\n            # integer type being scaled to?\n            self.data[np.isnan(self.data)] = blank\n            self._header['BLANK'] = blank\n\n        if self.data.dtype.type != _type:\n            self.data = np.array(np.around(self.data), dtype=_type)\n\n        # Update the BITPIX Card to match the data\n        self._bitpix = DTYPE2BITPIX[self.data.dtype.name]\n        self._bzero = self._header.get('BZERO', 0)\n        self._bscale = self._header.get('BSCALE', 1)\n        self._blank = blank\n        self._header['BITPIX'] = self._bitpix\n\n        # Since the image has been manually scaled, the current\n        # bitpix/bzero/bscale now serve as the 'original' scaling of the image,\n        # as though the original image has been completely replaced\n        self._orig_bitpix = self._bitpix\n        self._orig_bzero = self._bzero\n        self._orig_bscale = self._bscale\n        self._orig_blank = self._blank\n\n    def _verify(self, option='warn'):\n        # update_header can fix some things that would otherwise cause\n        # verification to fail, so do that now...\n        self.update_header()\n        self._verify_blank()\n\n        return super()._verify(option)\n\n    def _verify_blank(self):\n        # Probably not the best place for this (it should probably happen\n        # in _verify as well) but I want to be able to raise this warning\n        # both when the HDU is created and when written\n        if self._blank is None:\n            return\n\n        messages = []\n        # TODO: Once the FITSSchema framewhere is merged these warnings\n        # should be handled by the schema\n        if not _is_int(self._blank):\n            messages.append(\n                \"Invalid value for 'BLANK' keyword in header: {!r} \"\n                \"The 'BLANK' keyword must be an integer.  It will be \"\n                \"ignored in the meantime.\".format(self._blank))\n            self._blank = None\n        if not self._bitpix > 0:\n            messages.append(\n                \"Invalid 'BLANK' keyword in header.  The 'BLANK' keyword \"\n                \"is only applicable to integer data, and will be ignored \"\n                \"in this HDU.\")\n            self._blank = None\n\n        for msg in messages:\n            warnings.warn(msg, VerifyWarning)\n\n    def _prewriteto(self, checksum=False, inplace=False):\n        if self._scale_back:\n            self._scale_internal(BITPIX2DTYPE[self._orig_bitpix],\n                                 blank=self._orig_blank)\n\n        self.update_header()\n        if not inplace and self._data_needs_rescale:\n            # Go ahead and load the scaled image data and update the header\n            # with the correct post-rescaling headers\n            _ = self.data\n\n        return super()._prewriteto(checksum, inplace)\n\n    def _writedata_internal(self, fileobj):\n        size = 0\n\n        if self.data is None:\n            return size\n        elif _is_dask_array(self.data):\n            return self._writeinternal_dask(fileobj)\n        else:\n            # Based on the system type, determine the byteorders that\n            # would need to be swapped to get to big-endian output\n            if sys.byteorder == 'little':\n                swap_types = ('<', '=')\n            else:\n                swap_types = ('<',)\n            # deal with unsigned integer 16, 32 and 64 data\n            if _is_pseudo_integer(self.data.dtype):\n                # Convert the unsigned array to signed\n                output = np.array(\n                    self.data - _pseudo_zero(self.data.dtype),\n                    dtype=f'>i{self.data.dtype.itemsize}')\n                should_swap = False\n            else:\n                output = self.data\n                byteorder = output.dtype.str[0]\n                should_swap = (byteorder in swap_types)\n\n            if should_swap:\n                if output.flags.writeable:\n                    output.byteswap(True)\n                    try:\n                        fileobj.writearray(output)\n                    finally:\n                        output.byteswap(True)\n                else:\n                    # For read-only arrays, there is no way around making\n                    # a byteswapped copy of the data.\n                    fileobj.writearray(output.byteswap(False))\n            else:\n                fileobj.writearray(output)\n\n            size += output.size * output.itemsize\n\n            return size\n\n    def _writeinternal_dask(self, fileobj):\n\n        if sys.byteorder == 'little':\n            swap_types = ('<', '=')\n        else:\n            swap_types = ('<',)\n        # deal with unsigned integer 16, 32 and 64 data\n        if _is_pseudo_integer(self.data.dtype):\n            raise NotImplementedError(\"This dtype isn't currently supported with dask.\")\n        else:\n            output = self.data\n            byteorder = output.dtype.str[0]\n            should_swap = (byteorder in swap_types)\n\n        if should_swap:\n            from dask.utils import M\n            # NOTE: the inplace flag to byteswap needs to be False otherwise the array is\n            # byteswapped in place every time it is computed and this affects\n            # the input dask array.\n            output = output.map_blocks(M.byteswap, False).map_blocks(M.newbyteorder, \"S\")\n\n        initial_position = fileobj.tell()\n        n_bytes = output.nbytes\n\n        # Extend the file n_bytes into the future\n        fileobj.seek(initial_position + n_bytes - 1)\n        fileobj.write(b'\\0')\n        fileobj.flush()\n\n        if fileobj.fileobj_mode not in ('rb+', 'wb+', 'ab+'):\n            # Use another file handle if the current one is not in\n            # read/write mode\n            fp = open(fileobj.name, mode='rb+')\n            should_close = True\n        else:\n            fp = fileobj._file\n            should_close = False\n\n        try:\n            outmmap = mmap.mmap(fp.fileno(),\n                                length=initial_position + n_bytes,\n                                access=mmap.ACCESS_WRITE)\n\n            outarr = np.ndarray(shape=output.shape,\n                                dtype=output.dtype,\n                                offset=initial_position,\n                                buffer=outmmap)\n\n            output.store(outarr, lock=True, compute=True)\n        finally:\n            if should_close:\n                fp.close()\n            outmmap.close()\n\n        # On Windows closing the memmap causes the file pointer to return to 0, so\n        # we need to go back to the end of the data (since padding may be written\n        # after)\n        fileobj.seek(initial_position + n_bytes)\n\n        return n_bytes\n\n    def _dtype_for_bitpix(self):\n        \"\"\"\n        Determine the dtype that the data should be converted to depending on\n        the BITPIX value in the header, and possibly on the BSCALE value as\n        well.  Returns None if there should not be any change.\n        \"\"\"\n\n        bitpix = self._orig_bitpix\n        # Handle possible conversion to uints if enabled\n        if self._uint and self._orig_bscale == 1:\n            if bitpix == 8 and self._orig_bzero == -128:\n                return np.dtype('int8')\n\n            for bits, dtype in ((16, np.dtype('uint16')),\n                                (32, np.dtype('uint32')),\n                                (64, np.dtype('uint64'))):\n                if bitpix == bits and self._orig_bzero == 1 << (bits - 1):\n                    return dtype\n\n        if bitpix > 16:  # scale integers to Float64\n            return np.dtype('float64')\n        elif bitpix > 0:  # scale integers to Float32\n            return np.dtype('float32')\n\n    def _convert_pseudo_integer(self, data):\n        \"\"\"\n        Handle \"pseudo-unsigned\" integers, if the user requested it.  Returns\n        the converted data array if so; otherwise returns None.\n\n        In this case case, we don't need to handle BLANK to convert it to NAN,\n        since we can't do NaNs with integers, anyway, i.e. the user is\n        responsible for managing blanks.\n        \"\"\"\n\n        dtype = self._dtype_for_bitpix()\n        # bool(dtype) is always False--have to explicitly compare to None; this\n        # caused a fair amount of hair loss\n        if dtype is not None and dtype.kind == 'u':\n            # Convert the input raw data into an unsigned integer array and\n            # then scale the data adjusting for the value of BZERO.  Note that\n            # we subtract the value of BZERO instead of adding because of the\n            # way numpy converts the raw signed array into an unsigned array.\n            bits = dtype.itemsize * 8\n            data = np.array(data, dtype=dtype)\n            data -= np.uint64(1 << (bits - 1))\n\n            return data\n\n    def _get_scaled_image_data(self, offset, shape):\n        \"\"\"\n        Internal function for reading image data from a file and apply scale\n        factors to it.  Normally this is used for the entire image, but it\n        supports alternate offset/shape for Section support.\n        \"\"\"\n\n        code = BITPIX2DTYPE[self._orig_bitpix]\n\n        raw_data = self._get_raw_data(shape, code, offset)\n        raw_data.dtype = raw_data.dtype.newbyteorder('>')\n\n        if self._do_not_scale_image_data or (\n                self._orig_bzero == 0 and self._orig_bscale == 1 and\n                self._blank is None):\n            # No further conversion of the data is necessary\n            return raw_data\n\n        try:\n            if self._file.strict_memmap:\n                raise ValueError(\"Cannot load a memory-mapped image: \"\n                                 \"BZERO/BSCALE/BLANK header keywords present. \"\n                                 \"Set memmap=False.\")\n        except AttributeError:  # strict_memmap not set\n            pass\n\n        data = None\n        if not (self._orig_bzero == 0 and self._orig_bscale == 1):\n            data = self._convert_pseudo_integer(raw_data)\n\n        if data is None:\n            # In these cases, we end up with floating-point arrays and have to\n            # apply bscale and bzero. We may have to handle BLANK and convert\n            # to NaN in the resulting floating-point arrays.\n            # The BLANK keyword should only be applied for integer data (this\n            # is checked in __init__ but it can't hurt to double check here)\n            blanks = None\n\n            if self._blank is not None and self._bitpix > 0:\n                blanks = raw_data.flat == self._blank\n                # The size of blanks in bytes is the number of elements in\n                # raw_data.flat.  However, if we use np.where instead we will\n                # only use 8 bytes for each index where the condition is true.\n                # So if the number of blank items is fewer than\n                # len(raw_data.flat) / 8, using np.where will use less memory\n                if blanks.sum() < len(blanks) / 8:\n                    blanks = np.where(blanks)\n\n            new_dtype = self._dtype_for_bitpix()\n            if new_dtype is not None:\n                data = np.array(raw_data, dtype=new_dtype)\n            else:  # floating point cases\n                if self._file is not None and self._file.memmap:\n                    data = raw_data.copy()\n                elif not raw_data.flags.writeable:\n                    # create a writeable copy if needed\n                    data = raw_data.copy()\n                # if not memmap, use the space already in memory\n                else:\n                    data = raw_data\n\n            del raw_data\n\n            if self._orig_bscale != 1:\n                np.multiply(data, self._orig_bscale, data)\n            if self._orig_bzero != 0:\n                data += self._orig_bzero\n\n            if self._blank:\n                data.flat[blanks] = np.nan\n\n        return data\n\n    def _summary(self):\n        \"\"\"\n        Summarize the HDU: name, dimensions, and formats.\n        \"\"\"\n\n        class_name = self.__class__.__name__\n\n        # if data is touched, use data info.\n        if self._data_loaded:\n            if self.data is None:\n                format = ''\n            else:\n                format = self.data.dtype.name\n                format = format[format.rfind('.')+1:]\n        else:\n            if self.shape and all(self.shape):\n                # Only show the format if all the dimensions are non-zero\n                # if data is not touched yet, use header info.\n                format = BITPIX2DTYPE[self._bitpix]\n            else:\n                format = ''\n\n            if (format and not self._do_not_scale_image_data and\n                    (self._orig_bscale != 1 or self._orig_bzero != 0)):\n                new_dtype = self._dtype_for_bitpix()\n                if new_dtype is not None:\n                    format += f' (rescales to {new_dtype.name})'\n\n        # Display shape in FITS-order\n        shape = tuple(reversed(self.shape))\n\n        return (self.name, self.ver, class_name, len(self._header), shape, format, '')\n\n    def _calculate_datasum(self):\n        \"\"\"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        \"\"\"\n\n        if self._has_data:\n\n            # We have the data to be used.\n            d = self.data\n\n            # First handle the special case where the data is unsigned integer\n            # 16, 32 or 64\n            if _is_pseudo_integer(self.data.dtype):\n                d = np.array(self.data - _pseudo_zero(self.data.dtype),\n                             dtype=f'i{self.data.dtype.itemsize}')\n\n            # Check the byte order of the data.  If it is little endian we\n            # must swap it before calculating the datasum.\n            if d.dtype.str[0] != '>':\n                if d.flags.writeable:\n                    byteswapped = True\n                    d = d.byteswap(True)\n                    d.dtype = d.dtype.newbyteorder('>')\n                else:\n                    # If the data is not writeable, we just make a byteswapped\n                    # copy and don't bother changing it back after\n                    d = d.byteswap(False)\n                    d.dtype = d.dtype.newbyteorder('>')\n                    byteswapped = False\n            else:\n                byteswapped = False\n\n            cs = self._compute_checksum(d.flatten().view(np.uint8))\n\n            # If the data was byteswapped in this method then return it to\n            # its original little-endian order.\n            if byteswapped and not _is_pseudo_integer(self.data.dtype):\n                d.byteswap(True)\n                d.dtype = d.dtype.newbyteorder('<')\n\n            return cs\n        else:\n            # This is the case where the data has not been read from the file\n            # yet.  We can handle that in a generic manner so we do it in the\n            # base class.  The other possibility is that there is no data at\n            # all.  This can also be handled in a generic manner.\n            return super()._calculate_datasum()\n\n\nclass Section:\n    \"\"\"\n    Image section.\n\n    Slices of this object load the corresponding section of an image array from\n    the underlying FITS file on disk, and applies any BSCALE/BZERO factors.\n\n    Section slices cannot be assigned to, and modifications to a section are\n    not saved back to the underlying file.\n\n    See the :ref:`astropy:data-sections` section of the Astropy documentation\n    for more details.\n    \"\"\"\n\n    def __init__(self, hdu):\n        self.hdu = hdu\n\n    def __getitem__(self, key):\n        if not isinstance(key, tuple):\n            key = (key,)\n        naxis = len(self.hdu.shape)\n        return_scalar = (all(isinstance(k, (int, np.integer)) for k in key)\n                         and len(key) == naxis)\n        if not any(k is Ellipsis for k in key):\n            # We can always add a ... at the end, after making note of whether\n            # to return a scalar.\n            key += Ellipsis,\n        ellipsis_count = len([k for k in key if k is Ellipsis])\n        if len(key) - ellipsis_count > naxis or ellipsis_count > 1:\n            raise IndexError('too many indices for array')\n        # Insert extra dimensions as needed.\n        idx = next(i for i, k in enumerate(key + (Ellipsis,)) if k is Ellipsis)\n        key = key[:idx] + (slice(None),) * (naxis - len(key) + 1) + key[idx+1:]\n        return_0dim = (all(isinstance(k, (int, np.integer)) for k in key)\n                       and len(key) == naxis)\n\n        dims = []\n        offset = 0\n        # Find all leading axes for which a single point is used.\n        for idx in range(naxis):\n            axis = self.hdu.shape[idx]\n            indx = _IndexInfo(key[idx], axis)\n            offset = offset * axis + indx.offset\n            if not _is_int(key[idx]):\n                dims.append(indx.npts)\n                break\n\n        is_contiguous = indx.contiguous\n        for jdx in range(idx + 1, naxis):\n            axis = self.hdu.shape[jdx]\n            indx = _IndexInfo(key[jdx], axis)\n            dims.append(indx.npts)\n            if indx.npts == axis and indx.contiguous:\n                # The offset needs to multiply the length of all remaining axes\n                offset *= axis\n            else:\n                is_contiguous = False\n\n        if is_contiguous:\n            dims = tuple(dims) or (1,)\n            bitpix = self.hdu._orig_bitpix\n            offset = self.hdu._data_offset + offset * abs(bitpix) // 8\n            data = self.hdu._get_scaled_image_data(offset, dims)\n        else:\n            data = self._getdata(key)\n\n        if return_scalar:\n            data = data.item()\n        elif return_0dim:\n            data = data.squeeze()\n        return data\n\n    def _getdata(self, keys):\n        for idx, (key, axis) in enumerate(zip(keys, self.hdu.shape)):\n            if isinstance(key, slice):\n                ks = range(*key.indices(axis))\n                break\n            elif isiterable(key):\n                # Handle both integer and boolean arrays.\n                ks = np.arange(axis, dtype=int)[key]\n                break\n            # This should always break at some point if _getdata is called.\n\n        data = [self[keys[:idx] + (k,) + keys[idx + 1:]] for k in ks]\n\n        if any(isinstance(key, slice) or isiterable(key)\n               for key in keys[idx + 1:]):\n            # data contains multidimensional arrays; combine them.\n            return np.array(data)\n        else:\n            # Only singleton dimensions remain; concatenate in a 1D array.\n            return np.concatenate([np.atleast_1d(array) for array in data])\n\n\nclass PrimaryHDU(_ImageBaseHDU):\n    \"\"\"\n    FITS primary HDU class.\n    \"\"\"\n\n    _default_name = 'PRIMARY'\n\n    def __init__(self, data=None, header=None, do_not_scale_image_data=False,\n                 ignore_blank=False,\n                 uint=True, scale_back=None):\n        \"\"\"\n        Construct a primary HDU.\n\n        Parameters\n        ----------\n        data : array or ``astropy.io.fits.hdu.base.DELAYED``, optional\n            The data in the HDU.\n\n        header : `~astropy.io.fits.Header`, optional\n            The header to be used (as a template).  If ``header`` is `None`, a\n            minimal header will be provided.\n\n        do_not_scale_image_data : bool, optional\n            If `True`, image data is not scaled using BSCALE/BZERO values\n            when read. (default: False)\n\n        ignore_blank : bool, optional\n            If `True`, the BLANK header keyword will be ignored if present.\n            Otherwise, pixels equal to this value will be replaced with\n            NaNs. (default: False)\n\n        uint : bool, optional\n            Interpret signed integer data where ``BZERO`` is the\n            central value and ``BSCALE == 1`` as unsigned integer\n            data.  For example, ``int16`` data with ``BZERO = 32768``\n            and ``BSCALE = 1`` would be treated as ``uint16`` data.\n            (default: True)\n\n        scale_back : bool, optional\n            If `True`, when saving changes to a file that contained scaled\n            image data, restore the data to the original type and reapply the\n            original BSCALE/BZERO values.  This could lead to loss of accuracy\n            if scaling back to integer values after performing floating point\n            operations on the data.  Pseudo-unsigned integers are automatically\n            rescaled unless scale_back is explicitly set to `False`.\n            (default: None)\n        \"\"\"\n\n        super().__init__(\n            data=data, header=header,\n            do_not_scale_image_data=do_not_scale_image_data, uint=uint,\n            ignore_blank=ignore_blank,\n            scale_back=scale_back)\n\n        # insert the keywords EXTEND\n        if header is None:\n            dim = self._header['NAXIS']\n            if dim == 0:\n                dim = ''\n            self._header.set('EXTEND', True, after='NAXIS' + str(dim))\n\n    @classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        # Due to problems discussed in #5808, we cannot assume the 'GROUPS'\n        # keyword to be True/False, have to check the value\n        return (card.keyword == 'SIMPLE' and\n                ('GROUPS' not in header or header['GROUPS'] != True) and  # noqa\n                card.value)\n\n    def update_header(self):\n        super().update_header()\n\n        # Update the position of the EXTEND keyword if it already exists\n        if 'EXTEND' in self._header:\n            if len(self._axes):\n                after = 'NAXIS' + str(len(self._axes))\n            else:\n                after = 'NAXIS'\n            self._header.set('EXTEND', after=after)\n\n    def _verify(self, option='warn'):\n        errs = super()._verify(option=option)\n\n        # Verify location and value of mandatory keywords.\n        # The EXTEND keyword is only mandatory if the HDU has extensions; this\n        # condition is checked by the HDUList object.  However, if we already\n        # have an EXTEND keyword check that its position is correct\n        if 'EXTEND' in self._header:\n            naxis = self._header.get('NAXIS', 0)\n            self.req_cards('EXTEND', naxis + 3, lambda v: isinstance(v, bool),\n                           True, option, errs)\n        return errs\n\n\nclass ImageHDU(_ImageBaseHDU, ExtensionHDU):\n    \"\"\"\n    FITS image extension HDU class.\n    \"\"\"\n\n    _extension = 'IMAGE'\n\n    def __init__(self, data=None, header=None, name=None,\n                 do_not_scale_image_data=False, uint=True, scale_back=None,\n                 ver=None):\n        \"\"\"\n        Construct an image HDU.\n\n        Parameters\n        ----------\n        data : array\n            The data in the HDU.\n\n        header : `~astropy.io.fits.Header`\n            The header to be used (as a template).  If ``header`` is\n            `None`, a minimal header will be provided.\n\n        name : str, optional\n            The name of the HDU, will be the value of the keyword\n            ``EXTNAME``.\n\n        do_not_scale_image_data : bool, optional\n            If `True`, image data is not scaled using BSCALE/BZERO values\n            when read. (default: False)\n\n        uint : bool, optional\n            Interpret signed integer data where ``BZERO`` is the\n            central value and ``BSCALE == 1`` as unsigned integer\n            data.  For example, ``int16`` data with ``BZERO = 32768``\n            and ``BSCALE = 1`` would be treated as ``uint16`` data.\n            (default: True)\n\n        scale_back : bool, optional\n            If `True`, when saving changes to a file that contained scaled\n            image data, restore the data to the original type and reapply the\n            original BSCALE/BZERO values.  This could lead to loss of accuracy\n            if scaling back to integer values after performing floating point\n            operations on the data.  Pseudo-unsigned integers are automatically\n            rescaled unless scale_back is explicitly set to `False`.\n            (default: None)\n\n        ver : int > 0 or None, optional\n            The ver of the HDU, will be the value of the keyword ``EXTVER``.\n            If not given or None, it defaults to the value of the ``EXTVER``\n            card of the ``header`` or 1.\n            (default: None)\n        \"\"\"\n\n        # This __init__ currently does nothing differently from the base class,\n        # and is only explicitly defined for the docstring.\n\n        super().__init__(\n            data=data, header=header, name=name,\n            do_not_scale_image_data=do_not_scale_image_data, uint=uint,\n            scale_back=scale_back, ver=ver)\n\n    @classmethod\n    def match_header(cls, header):\n        card = header.cards[0]\n        xtension = card.value\n        if isinstance(xtension, str):\n            xtension = xtension.rstrip()\n        return card.keyword == 'XTENSION' and xtension == cls._extension\n\n    def _verify(self, option='warn'):\n        \"\"\"\n        ImageHDU verify method.\n        \"\"\"\n\n        errs = super()._verify(option=option)\n        naxis = self._header.get('NAXIS', 0)\n        # PCOUNT must == 0, GCOUNT must == 1; the former is verified in\n        # ExtensionHDU._verify, however ExtensionHDU._verify allows PCOUNT\n        # to be >= 0, so we need to check it here\n        self.req_cards('PCOUNT', naxis + 3, lambda v: (_is_int(v) and v == 0),\n                       0, option, errs)\n        return errs\n\n\nclass _IndexInfo:\n    def __init__(self, indx, naxis):\n        if _is_int(indx):\n            if 0 <= indx < naxis:\n                self.npts = 1\n                self.offset = indx\n                self.contiguous = True\n            else:\n                raise IndexError(f'Index {indx} out of range.')\n        elif isinstance(indx, slice):\n            start, stop, step = indx.indices(naxis)\n            self.npts = (stop - start) // step\n            self.offset = start\n            self.contiguous = step == 1\n        elif isiterable(indx):\n            self.npts = len(indx)\n            self.offset = 0\n            self.contiguous = False\n        else:\n            raise IndexError(f'Illegal index {indx}')\n"},{"className":"_Delayed","col":0,"comment":"null","endLoc":36,"id":2623,"nodeType":"Class","startLoc":35,"text":"class _Delayed:\n    pass"},{"className":"InvalidHDUException","col":0,"comment":"\n    A custom exception class used mainly to signal to _BaseHDU.__new__ that\n    an HDU cannot possibly be considered valid, and must be assumed to be\n    corrupted.\n    ","endLoc":61,"id":2624,"nodeType":"Class","startLoc":56,"text":"class InvalidHDUException(Exception):\n    \"\"\"\n    A custom exception class used mainly to signal to _BaseHDU.__new__ that\n    an HDU cannot possibly be considered valid, and must be assumed to be\n    corrupted.\n    \"\"\""},{"col":4,"comment":"null","endLoc":107,"header":"def __new__(cls, table_header, image_header=None)","id":2625,"name":"__new__","nodeType":"Function","startLoc":97,"text":"def __new__(cls, table_header, image_header=None):\n        # 2019-09-14 (MHvK): No point wrapping anything if no image_header is\n        # given.  This happens if __getitem__ and copy are called - our super\n        # class will aim to initialize a new, possibly partially filled\n        # header, but we cannot usefully deal with that.\n        # TODO: the above suggests strongly we should *not* subclass from\n        # Header.  See also comment above about the need for reorganization.\n        if image_header is None:\n            return Header(table_header)\n        else:\n            return super().__new__(cls)"},{"className":"_CorruptedHDU","col":0,"comment":"\n    A Corrupted HDU class.\n\n    This class is used when one or more mandatory `Card`s are\n    corrupted (unparsable), such as the ``BITPIX``, ``NAXIS``, or\n    ``END`` cards.  A corrupted HDU usually means that the data size\n    cannot be calculated or the ``END`` card is not found.  In the case\n    of a missing ``END`` card, the `Header` may also contain the binary\n    data\n\n    .. note::\n       In future, it may be possible to decipher where the last block\n       of the `Header` ends, but this task may be difficult when the\n       extension is a `TableHDU` containing ASCII data.\n    ","endLoc":803,"id":2626,"nodeType":"Class","startLoc":769,"text":"class _CorruptedHDU(_BaseHDU):\n    \"\"\"\n    A Corrupted HDU class.\n\n    This class is used when one or more mandatory `Card`s are\n    corrupted (unparsable), such as the ``BITPIX``, ``NAXIS``, or\n    ``END`` cards.  A corrupted HDU usually means that the data size\n    cannot be calculated or the ``END`` card is not found.  In the case\n    of a missing ``END`` card, the `Header` may also contain the binary\n    data\n\n    .. note::\n       In future, it may be possible to decipher where the last block\n       of the `Header` ends, but this task may be difficult when the\n       extension is a `TableHDU` containing ASCII data.\n    \"\"\"\n\n    @property\n    def size(self):\n        \"\"\"\n        Returns the size (in bytes) of the HDU's data part.\n        \"\"\"\n\n        # Note: On compressed files this might report a negative size; but the\n        # file is corrupt anyways so I'm not too worried about it.\n        if self._buffer is not None:\n            return len(self._buffer) - self._data_offset\n\n        return self._file.size - self._data_offset\n\n    def _summary(self):\n        return (self.name, self.ver, 'CorruptedHDU')\n\n    def verify(self):\n        pass"},{"col":4,"comment":"\n        Returns the size (in bytes) of the HDU's data part.\n        ","endLoc":797,"header":"@property\n    def size(self)","id":2627,"name":"size","nodeType":"Function","startLoc":786,"text":"@property\n    def size(self):\n        \"\"\"\n        Returns the size (in bytes) of the HDU's data part.\n        \"\"\"\n\n        # Note: On compressed files this might report a negative size; but the\n        # file is corrupt anyways so I'm not too worried about it.\n        if self._buffer is not None:\n            return len(self._buffer) - self._data_offset\n\n        return self._file.size - self._data_offset"},{"col":4,"comment":"null","endLoc":800,"header":"def _summary(self)","id":2628,"name":"_summary","nodeType":"Function","startLoc":799,"text":"def _summary(self):\n        return (self.name, self.ver, 'CorruptedHDU')"},{"col":4,"comment":"null","endLoc":803,"header":"def verify(self)","id":2629,"name":"verify","nodeType":"Function","startLoc":802,"text":"def verify(self):\n        pass"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":2630,"name":"__all__","nodeType":"Attribute","startLoc":26,"text":"__all__"},{"attributeType":"_BaseHDU","col":0,"comment":"null","endLoc":760,"id":2631,"name":"_AllHDU","nodeType":"Attribute","startLoc":760,"text":"_AllHDU"},{"className":"_IndexInfo","col":0,"comment":"null","endLoc":1217,"id":2632,"nodeType":"Class","startLoc":1198,"text":"class _IndexInfo:\n    def __init__(self, indx, naxis):\n        if _is_int(indx):\n            if 0 <= indx < naxis:\n                self.npts = 1\n                self.offset = indx\n                self.contiguous = True\n            else:\n                raise IndexError(f'Index {indx} out of range.')\n        elif isinstance(indx, slice):\n            start, stop, step = indx.indices(naxis)\n            self.npts = (stop - start) // step\n            self.offset = start\n            self.contiguous = step == 1\n        elif isiterable(indx):\n            self.npts = len(indx)\n            self.offset = 0\n            self.contiguous = False\n        else:\n            raise IndexError(f'Illegal index {indx}')"},{"attributeType":"ExtensionHDU","col":0,"comment":"null","endLoc":1594,"id":2633,"name":"_ExtensionHDU","nodeType":"Attribute","startLoc":1594,"text":"_ExtensionHDU"},{"attributeType":"null","col":12,"comment":"null","endLoc":1213,"id":2634,"name":"npts","nodeType":"Attribute","startLoc":1213,"text":"self.npts"},{"attributeType":"NonstandardExtHDU","col":0,"comment":"null","endLoc":1645,"id":2635,"name":"_NonstandardExtHDU","nodeType":"Attribute","startLoc":1645,"text":"_NonstandardExtHDU"},{"col":0,"comment":"","endLoc":4,"header":"base.py#<anonymous>","id":2636,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = [\n    \"DELAYED\",\n    # classes\n    \"InvalidHDUException\",\n    \"ExtensionHDU\",\n    \"NonstandardExtHDU\",\n]\n\nDELAYED = _Delayed()\n\nBITPIX2DTYPE = {8: 'uint8', 16: 'int16', 32: 'int32', 64: 'int64',\n                -32: 'float32', -64: 'float64'}\n\n\"\"\"Maps FITS BITPIX values to Numpy dtype names.\"\"\"\n\nDTYPE2BITPIX = {'int8': 8, 'uint8': 8, 'int16': 16, 'uint16': 16,\n                'int32': 32, 'uint32': 32, 'int64': 64, 'uint64': 64,\n                'float32': -32, 'float64': -64}\n\n\"\"\"\nMaps Numpy dtype names to FITS BITPIX values (this includes unsigned\nintegers, with the assumption that the pseudo-unsigned integer convention\nwill be used in this case.\n\"\"\"\n\n_AllHDU = _BaseHDU\n\nregister_hdu = _BaseHDU.register_hdu\n\nunregister_hdu = _BaseHDU.unregister_hdu\n\n_ExtensionHDU = ExtensionHDU\n\n_NonstandardExtHDU = NonstandardExtHDU"},{"attributeType":"null","col":12,"comment":"null","endLoc":1214,"id":2637,"name":"offset","nodeType":"Attribute","startLoc":1214,"text":"self.offset"},{"attributeType":"null","col":12,"comment":"null","endLoc":1215,"id":2638,"name":"contiguous","nodeType":"Attribute","startLoc":1215,"text":"self.contiguous"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":2639,"name":"__all__","nodeType":"Attribute","startLoc":18,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"image.py#<anonymous>","id":2640,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = [\"Section\", \"PrimaryHDU\", \"ImageHDU\"]"},{"col":0,"comment":"\n    Returns the equivalence between Doppler redshift (unitless) and radial velocity.\n\n    .. note::\n\n        This equivalency is not compatible with cosmological\n        redshift in `astropy.cosmology.units`.\n\n    ","endLoc":533,"header":"def doppler_redshift()","id":2641,"name":"doppler_redshift","nodeType":"Function","startLoc":511,"text":"def doppler_redshift():\n    \"\"\"\n    Returns the equivalence between Doppler redshift (unitless) and radial velocity.\n\n    .. note::\n\n        This equivalency is not compatible with cosmological\n        redshift in `astropy.cosmology.units`.\n\n    \"\"\"\n    rv_unit = si.km / si.s\n    C_KMS = _si.c.to_value(rv_unit)\n\n    def convert_z_to_rv(z):\n        zponesq = (1 + z) ** 2\n        return C_KMS * (zponesq - 1) / (zponesq + 1)\n\n    def convert_rv_to_z(rv):\n        beta = rv / C_KMS\n        return np.sqrt((1 + beta) / (1 - beta)) - 1\n\n    return Equivalency([(dimensionless_unscaled, rv_unit, convert_z_to_rv, convert_rv_to_z)],\n                       \"doppler_redshift\")"},{"col":4,"comment":"null","endLoc":145,"header":"def __setitem__(self, key, value)","id":2642,"name":"__setitem__","nodeType":"Function","startLoc":119,"text":"def __setitem__(self, key, value):\n        # This isn't pretty, but if the `key` is either an int or a tuple we\n        # need to figure out what keyword name that maps to before doing\n        # anything else; these checks will be repeated later in the\n        # super().__setitem__ call but I don't see another way around it\n        # without some major refactoring\n        if self._set_slice(key, value, self):\n            return\n\n        if isinstance(key, int):\n            keyword, index = self._keyword_from_index(key)\n        elif isinstance(key, tuple):\n            keyword, index = key\n        else:\n            # We don't want to specify and index otherwise, because that will\n            # break the behavior for new keywords and for commentary keywords\n            keyword, index = key, None\n\n        if self._is_reserved_keyword(keyword):\n            return\n\n        super().__setitem__(key, value)\n\n        if index is not None:\n            remapped_keyword = self._remap_keyword(keyword)\n            self._table_header[remapped_keyword, index] = value\n        # Else this will pass through to ._update"},{"id":2643,"name":"astropy/io/fits/src","nodeType":"Package"},{"id":2644,"name":"compressionmodule.h","nodeType":"TextFile","path":"astropy/io/fits/src","text":"#ifndef _COMPRESSIONMODULE_H\n#define _COMPRESSIONMODULE_H\n\n\n/* CFITSIO version-specific feature support */\n#ifndef CFITSIO_MAJOR\n    // Define a minimized version\n    #define CFITSIO_MAJOR 0\n    #ifdef _MSC_VER\n        #pragma warning ( \"CFITSIO_MAJOR not defined; your CFITSIO version may be too old; compile at your own risk\" )\n    #else\n        #warning \"CFITSIO_MAJOR not defined; your CFITSIO version may be too old; compile at your own risk\"\n    #endif\n#endif\n\n#ifndef CFITSIO_MINOR\n    #define CFITSIO_MINOR 0\n#endif\n\n\n#if CFITSIO_MAJOR == 3 && CFITSIO_MINOR < 35\n    #ifdef _MSC_VER\n        #pragma warning ( \"your CFITSIO version is too old; use 3.35 or later\" )\n    #else\n        #warning \"your CFITSIO version is too old; use 3.35 or later\"\n    #endif\n#endif\n\n\n/* These defaults mirror the defaults in io.fits.hdu.compressed */\n#define DEFAULT_COMPRESSION_TYPE \"RICE_1\"\n#define DEFAULT_QUANTIZE_LEVEL 16.0\n#define DEFAULT_HCOMP_SCALE 0\n#define DEFAULT_HCOMP_SMOOTH 0\n#define DEFAULT_BLOCK_SIZE 32\n#define DEFAULT_BYTE_PIX 4\n\n/* This constant is defined by cfitsio in imcompress.c */\n#define NO_QUANTIZE 9999\n\n#endif\n"},{"col":4,"comment":"null","endLoc":1129,"header":"def _repr_html_(self)","id":2645,"name":"_repr_html_","nodeType":"Function","startLoc":1128,"text":"def _repr_html_(self):\n        return self._base_repr_(html=True)"},{"id":2646,"name":"compressionmodule.c","nodeType":"TextFile","path":"astropy/io/fits/src","text":"/* \"compression module */\n\n/*****************************************************************************/\n/*                                                                           */\n/* The compression software is a python module implemented in C that, when   */\n/* accessed through the astropy module, supports the storage of compressed   */\n/* images in FITS binary tables.  An n-dimensional image is divided into a   */\n/* rectangular grid of subimages or 'tiles'.  Each tile is then compressed   */\n/* as a continuous block of data, and the resulting compressed byte stream   */\n/* is stored in a row of a variable length column in a FITS binary table.    */\n/* The default tiling pattern treats each row of a 2-dimensional image      */\n/* (or higher dimensional cube) as a tile, such that each tile contains      */\n/* NAXIS1 pixels.                                                            */\n/*                                                                           */\n/* This module contains three functions that are callable from python.  The  */\n/* first is compress_hdu.  This function takes an                            */\n/* astropy.io.fits.CompImageHDU object containing the uncompressed image     */\n/* data and returns the compressed data for all tiles into the               */\n/* .compressed_data attribute of that HDU.                                   */\n/*                                                                           */\n/* The second function is decompress_hdu.  It takes an                       */\n/* astropy.io.fits.CompImageHDU object that already has compressed data in   */\n/* its .compressed_data attribute.  It returns the decompressed image data   */\n/* into the HDU's .data attribute.                                           */\n/*                                                                           */\n/* Copyright (C) 2013 Association of Universities for Research in Astronomy  */\n/* (AURA)                                                                    */\n/*                                                                           */\n/* Redistribution and use in source and binary forms, with or without        */\n/* modification, are permitted provided that the following conditions are    */\n/* met:                                                                      */\n/*                                                                           */\n/*    1. Redistributions of source code must retain the above copyright      */\n/*      notice, this list of conditions and the following disclaimer.        */\n/*                                                                           */\n/*    2. Redistributions in binary form must reproduce the above             */\n/*      copyright notice, this list of conditions and the following          */\n/*      disclaimer in the documentation and/or other materials provided      */\n/*      with the distribution.                                               */\n/*                                                                           */\n/*    3. The name of AURA and its representatives may not be used to         */\n/*      endorse or promote products derived from this software without       */\n/*      specific prior written permission.                                   */\n/*                                                                           */\n/* THIS SOFTWARE IS PROVIDED BY AURA ``AS IS'' AND ANY EXPRESS OR IMPLIED    */\n/* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF      */\n/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE                  */\n/* DISCLAIMED. IN NO EVENT SHALL AURA BE LIABLE FOR ANY DIRECT, INDIRECT,    */\n/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,      */\n/* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS     */\n/* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND    */\n/* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR     */\n/* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE    */\n/* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH          */\n/* DAMAGE.                                                                   */\n/*                                                                           */\n/* Some of the source code used by this module was copied and modified from  */\n/* the FITSIO software that was written by William Pence at the High Energy  */\n/* Astrophysic Science Archive Research Center (HEASARC) at the NASA Goddard */\n/* Space Flight Center.  That software contained the following copyright and */\n/* warranty notices:                                                         */\n/*                                                                           */\n/* Copyright (Unpublished--all rights reserved under the copyright laws of   */\n/* the United States), U.S. Government as represented by the Administrator   */\n/* of the National Aeronautics and Space Administration.  No copyright is    */\n/* claimed in the United States under Title 17, U.S. Code.                   */\n/*                                                                           */\n/* Permission to freely use, copy, modify, and distribute this software      */\n/* and its documentation without fee is hereby granted, provided that this   */\n/* copyright notice and disclaimer of warranty appears in all copies.        */\n/*                                                                           */\n/* DISCLAIMER:                                                               */\n/*                                                                           */\n/* THE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND,        */\n/* EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO,   */\n/* ANY WARRANTY THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY        */\n/* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR           */\n/* PURPOSE, AND FREEDOM FROM INFRINGEMENT, AND ANY WARRANTY THAT THE         */\n/* DOCUMENTATION WILL CONFORM TO THE SOFTWARE, OR ANY WARRANTY THAT THE      */\n/* SOFTWARE WILL BE ERROR FREE.  IN NO EVENT SHALL NASA BE LIABLE FOR ANY    */\n/* DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL OR      */\n/* CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR IN ANY WAY      */\n/* CONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY,         */\n/* CONTRACT, TORT , OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY     */\n/* PERSONS OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED   */\n/* FROM, OR AROSE OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR          */\n/* SERVICES PROVIDED HEREUNDER.\"                                             */\n/*                                                                           */\n/*****************************************************************************/\n\n/* Include the Python C API */\n\n#include <float.h>\n#include <limits.h>\n#include <math.h>\n#include <string.h>\n\n#include <Python.h>\n#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\n#include <numpy/arrayobject.h>\n#include <fitsio2.h>\n#include \"compressionmodule.h\"\n\n\n/* These defaults mirror the defaults in astropy.io.fits.hdu.compressed */\n#define DEFAULT_COMPRESSION_TYPE \"RICE_1\"\n#define DEFAULT_QUANTIZE_LEVEL 16.0\n#define DEFAULT_HCOMP_SCALE 0\n#define DEFAULT_HCOMP_SMOOTH 0\n#define DEFAULT_BLOCK_SIZE 32\n#define DEFAULT_BYTE_PIX 4\n\n/* Flags to pass to get_header_* functions to control error messages. */\ntypedef enum {\n    HDR_NOFLAG = 0,\n    HDR_FAIL_KEY_MISSING = 1 << 0,\n    HDR_FAIL_VAL_NEGATIVE = 1 << 1,\n} HeaderGetFlags;\n\n\n/* Report any error based on the status returned from cfitsio. */\nvoid process_status_err(int status)\n{\n   PyObject* except_type;\n   char      err_msg[81];\n   char      def_err_msg[81];\n\n   err_msg[0] = '\\0';\n   def_err_msg[0] = '\\0';\n\n   switch (status) {\n      case MEMORY_ALLOCATION:\n         except_type = PyExc_MemoryError;\n         break;\n      case OVERFLOW_ERR:\n         except_type = PyExc_OverflowError;\n         break;\n      case BAD_COL_NUM:\n         strcpy(def_err_msg, \"bad column number\");\n         except_type = PyExc_ValueError;\n         break;\n      case BAD_PIX_NUM:\n         strcpy(def_err_msg, \"bad pixel number\");\n         except_type = PyExc_ValueError;\n         break;\n      case NEG_AXIS:\n         strcpy(def_err_msg, \"negative axis number\");\n         except_type = PyExc_ValueError;\n         break;\n      case BAD_DATATYPE:\n         strcpy(def_err_msg, \"bad data type\");\n         except_type = PyExc_TypeError;\n         break;\n      case NO_COMPRESSED_TILE:\n         strcpy(def_err_msg, \"no compressed or uncompressed data for tile.\");\n         except_type = PyExc_ValueError;\n         break;\n      default:\n         except_type = PyExc_RuntimeError;\n         break;\n   }\n\n   if (fits_read_errmsg(err_msg)) {\n      PyErr_SetString(except_type, err_msg);\n   } else if (*def_err_msg) {\n      PyErr_SetString(except_type, def_err_msg);\n   } else {\n      PyErr_Format(except_type, \"unknown error %i.\", status);\n   }\n}\n\n\nvoid bitpix_to_datatypes(int bitpix, int* datatype, int* npdatatype) {\n    /* Given a FITS BITPIX value, returns the appropriate CFITSIO type code and\n       Numpy type code for that BITPIX into datatype and npdatatype\n       respectively.\n     */\n    switch (bitpix) {\n        case BYTE_IMG:\n            *datatype = TBYTE;\n            *npdatatype = NPY_UINT8;\n            break;\n        case SHORT_IMG:\n            *datatype = TSHORT;\n            *npdatatype = NPY_INT16;\n            break;\n        case LONG_IMG:\n            *datatype = TINT;\n            *npdatatype = NPY_INT32;\n            break;\n        case LONGLONG_IMG:\n            *datatype = TLONGLONG;\n            *npdatatype = NPY_LONGLONG;\n            break;\n        case FLOAT_IMG:\n            *datatype = TFLOAT;\n            *npdatatype = NPY_FLOAT;\n            break;\n        case DOUBLE_IMG:\n            *datatype = TDOUBLE;\n            *npdatatype = NPY_DOUBLE;\n            break;\n        default:\n            PyErr_Format(PyExc_ValueError, \"Invalid value for BITPIX: %d\",\n                         bitpix);\n            break;\n   }\n\n   return;\n}\n\n\n\nint compress_type_from_string(char* zcmptype) {\n    if (0 == strcmp(zcmptype, \"RICE_1\")) {\n        return RICE_1;\n    } else if (0 == strcmp(zcmptype, \"GZIP_1\")) {\n        return GZIP_1;\n    } else if (0 == strcmp(zcmptype, \"GZIP_2\")) {\n        return GZIP_2;\n    } else if (0 == strcmp(zcmptype, \"PLIO_1\")) {\n        return PLIO_1;\n    } else if (0 == strcmp(zcmptype, \"HCOMPRESS_1\")) {\n        return HCOMPRESS_1;\n    }\n    /* CFITSIO adds a compression type alias for RICE_1 compression\n       as a flag for using subtractive_dither_2 */\n    else if (0 == strcmp(zcmptype, \"RICE_ONE\")) {\n        return RICE_1;\n    }\n    else {\n        PyErr_Format(PyExc_ValueError, \"Unrecognized compression type: %s\",\n                     zcmptype);\n        return -1;\n    }\n}\n\n\nPyObject *\nget_header_value(PyObject* header, const char* key, HeaderGetFlags flags) {\n    PyObject* hdrkey;\n    PyObject* hdrval;\n    hdrkey = PyUnicode_FromString(key);\n    if (hdrkey == NULL) {\n        return NULL;\n    }\n    hdrval = PyObject_GetItem(header, hdrkey);\n    Py_DECREF(hdrkey);\n    if ((flags & HDR_FAIL_KEY_MISSING) == 0) {\n        /* Normally we have a default so we want to ignore the exception in\n           any case. But if the flag was given this step must be skipped. */\n        PyErr_Clear();\n    }\n    return hdrval;\n}\n\n\n// TODO: It might be possible to simplify these further by making the\n// conversion function (eg. PyString_AsString) an argument to a macro or\n// something, but I'm not sure yet how easy it is to generalize the error\n// handling\n/* The get_header_* functions resemble \"Header.get\" where \"def\" is the default\n   value, \"keyword\" is a string representing the header-key and the result is\n   stored in \"val\".\n   The function returns 0 on success, 1 if the header didn't have the keyword\n   and the default was applied and -1 (with an exception set) if an Exception\n   happened (like a MemoryError or Overflow).\n*/\n#define GET_HEADER_SUCCESS 0\n#define GET_HEADER_DEFAULT_USED 1\n#define GET_HEADER_FAILED -1\nint get_header_string(PyObject* header, const char* keyword, char* val,\n                      const char* def, HeaderGetFlags flags) {\n    /* nonnegative doesn't make sense for strings*/\n    assert(!(flags & HDR_FAIL_VAL_NEGATIVE));\n    PyObject* keyval = get_header_value(header, keyword, flags);\n\n    if (keyval == NULL) {\n        strncpy(val, def, 72);\n        return PyErr_Occurred() ? GET_HEADER_FAILED : GET_HEADER_DEFAULT_USED;\n    }\n    PyObject* tmp = PyUnicode_AsLatin1String(keyval);\n    // FITS header values should always be ASCII, but Latin1 is on the\n    // safe side\n    Py_DECREF(keyval);\n    if (tmp == NULL) {\n        /* could always fail to allocate the memory or such like. */\n        return GET_HEADER_FAILED;\n    }\n    strncpy(val, PyBytes_AsString(tmp), 72);\n    Py_DECREF(tmp);\n    return GET_HEADER_SUCCESS;\n}\n\n\nint get_header_long(PyObject* header, const char* keyword, long* val, long def,\n                    HeaderGetFlags flags) {\n    PyObject* keyval = get_header_value(header, keyword, flags);\n\n    if (keyval == NULL) {\n        *val = def;\n        return PyErr_Occurred() ? GET_HEADER_FAILED : GET_HEADER_DEFAULT_USED;\n    }\n    long tmp = PyLong_AsLong(keyval);\n    Py_DECREF(keyval);\n    if (PyErr_Occurred()) {\n        return GET_HEADER_FAILED;\n    }\n    if ((flags & HDR_FAIL_VAL_NEGATIVE) && (tmp < 0)) {\n        PyErr_Format(PyExc_ValueError, \"%s should not be negative.\", keyword);\n        return GET_HEADER_FAILED;\n    }\n    *val = tmp;\n    return GET_HEADER_SUCCESS;\n}\n\n\nint get_header_int(PyObject* header, const char* keyword, int* val, int def,\n                   HeaderGetFlags flags) {\n    long tmp;\n    int ret = get_header_long(header, keyword, &tmp, def, flags);\n    if (ret == GET_HEADER_SUCCESS) {\n        if (tmp >= INT_MIN && tmp <= INT_MAX) {\n            *val = (int) tmp;\n        } else {\n            PyErr_Format(PyExc_OverflowError, \"Cannot convert %ld to C 'int'\", tmp);\n            ret = GET_HEADER_FAILED;\n        }\n    }\n    return ret;\n}\n\n\nint get_header_double(PyObject* header, const char* keyword, double* val,\n                      double def, HeaderGetFlags flags) {\n    /* nonnegative isn't currently used for doubles/floats. But if needed one\n       could simply remove the assert again and implement the negative check. */\n    assert(!(flags & HDR_FAIL_VAL_NEGATIVE));\n    PyObject* keyval = get_header_value(header, keyword, flags);\n\n    if (keyval == NULL) {\n        *val = def;\n        return PyErr_Occurred() ? GET_HEADER_FAILED : GET_HEADER_DEFAULT_USED;\n    }\n    double tmp = PyFloat_AsDouble(keyval);\n    Py_DECREF(keyval);\n    if (PyErr_Occurred()) {\n        return GET_HEADER_FAILED;\n    }\n    *val = tmp;\n    return GET_HEADER_SUCCESS;\n}\n\n\nint get_header_float(PyObject* header, const char* keyword, float* val,\n                     float def, HeaderGetFlags flags) {\n    double tmp;\n    int ret = get_header_double(header, keyword, &tmp, def, flags);\n    if (ret == GET_HEADER_SUCCESS) {\n        if (tmp == 0.0 || (fabs(tmp) >= FLT_MIN && fabs(tmp) <= FLT_MAX)) {\n            *val = (float) tmp;\n        } else {\n            PyErr_SetString(PyExc_OverflowError,\n                            \"Cannot convert 'double' to 'float'\");\n            ret = GET_HEADER_FAILED;\n        }\n    }\n    return ret;\n}\n\n\nint get_header_longlong(PyObject* header, const char* keyword, long long* val,\n                        long long def, HeaderGetFlags flags) {\n    PyObject* keyval = get_header_value(header, keyword, flags);\n\n    if (keyval == NULL) {\n        *val = def;\n        return PyErr_Occurred() ? GET_HEADER_FAILED : GET_HEADER_DEFAULT_USED;\n    }\n    long long tmp = PyLong_AsLongLong(keyval);\n    Py_DECREF(keyval);\n    if (PyErr_Occurred()) {\n        return GET_HEADER_FAILED;\n    }\n    if ((flags & HDR_FAIL_VAL_NEGATIVE) && (tmp < 0)) {\n        PyErr_Format(PyExc_ValueError, \"%s should not be negative.\", keyword);\n        return GET_HEADER_FAILED;\n    }\n    *val = tmp;\n    return GET_HEADER_SUCCESS;\n}\n\n\nvoid tcolumns_from_header(fitsfile* fileptr, PyObject* header,\n                          tcolumn** columns) {\n    // Creates the array of tcolumn structures from the table column keywords\n    // read from the astropy.io.fits.Header object; caller is responsible for\n    // freeing the memory allocated for this array\n\n    tcolumn* column;\n    char tkw[9];\n\n    int tfields;\n    char ttype[72];\n    char tform[72];\n    int dtcode;\n    long trepeat;\n    long twidth;\n    long long totalwidth;\n    int status = 0;\n    int idx;\n\n    if (get_header_int(header, \"TFIELDS\", &tfields, 0, HDR_FAIL_VAL_NEGATIVE) == GET_HEADER_FAILED) {\n        return;\n    }\n    /* To avoid issues in the loop we need to limit the number of TFIELDs to\n       999. Otherwise we would exceed the maximum length of the keyword name of\n       8. This could lead to multiple accesses of the same header keyword with\n       snprintf because we limit it to 8 characters + null-termination. */\n    if (tfields > 999) {\n        PyErr_SetString(PyExc_ValueError, \"The TFIELDS value exceeds 999.\");\n        return;\n    }\n\n    // This used to use PyMem_New, but don't do that; CFITSIO will later\n    // free() this object when the file is closed, so just use malloc here\n    // *columns = column = PyMem_New(tcolumn, (size_t) tfields);\n    *columns = column = calloc((size_t) tfields, sizeof(tcolumn));\n    if (column == NULL) {\n        PyErr_SetString(PyExc_MemoryError,\n                        \"Couldn't allocate memory for columns.\");\n        return;\n    }\n\n\n    for (idx = 1; idx <= tfields; idx++, column++) {\n        /* set some invalid defaults */\n        column->ttype[0] = '\\0';\n        column->tbcol = 0;\n        column->tdatatype = -9999; /* this default used by cfitsio */\n        column->trepeat = 1;\n        column->strnull[0] = '\\0';\n        column->tform[0] = '\\0';\n        column->twidth = 0;\n\n        snprintf(tkw, 9, \"TTYPE%u\", idx);\n        if (get_header_string(header, tkw, ttype, \"\", HDR_NOFLAG) == GET_HEADER_FAILED) {\n            return;\n        }\n        strncpy(column->ttype, ttype, 69);\n        column->ttype[69] = '\\0';\n\n        snprintf(tkw, 9, \"TFORM%u\", idx);\n        if (get_header_string(header, tkw, tform, \"\", HDR_NOFLAG) == GET_HEADER_FAILED) {\n            return;\n        }\n        strncpy(column->tform, tform, 9);\n        column->tform[9] = '\\0';\n        fits_binary_tform(tform, &dtcode, &trepeat, &twidth, &status);\n        if (status != 0) {\n            process_status_err(status);\n            return;\n        }\n\n        column->tdatatype = dtcode;\n        column->trepeat = trepeat;\n        column->twidth = twidth;\n\n        snprintf(tkw, 9, \"TSCAL%u\", idx);\n        if (get_header_double(header, tkw, &(column->tscale), 1.0, HDR_NOFLAG) == GET_HEADER_FAILED) {\n            return;\n        }\n\n        snprintf(tkw, 9, \"TZERO%u\", idx);\n        if (get_header_double(header, tkw, &(column->tzero), 0.0, HDR_NOFLAG) == GET_HEADER_FAILED) {\n            return;\n        }\n\n        snprintf(tkw, 9, \"TNULL%u\", idx);\n        if (get_header_longlong(header, tkw, &(column->tnull), NULL_UNDEFINED, HDR_NOFLAG) == GET_HEADER_FAILED) {\n            return;\n        }\n    }\n\n    fileptr->Fptr->tableptr = *columns;\n    fileptr->Fptr->tfield = tfields;\n\n    // This routine from CFITSIO calculates the byte offset of each column\n    // and stores it in the column->tbcol field\n    ffgtbc(fileptr, &totalwidth, &status);\n    if (status != 0) {\n        process_status_err(status);\n    }\n\n    return;\n}\n\n\n\nvoid configure_compression(fitsfile* fileptr, PyObject* header) {\n    /* Configure the compression-related elements in the fitsfile struct\n       using values in the FITS header. */\n\n    FITSfile* Fptr;\n\n    int tfields;\n    tcolumn* columns;\n\n    char keyword[9];\n    char zname[72];\n    int znaxis;\n    char tmp[72];\n    float version;\n\n    int idx;\n\n    Fptr = fileptr->Fptr;\n    tfields = Fptr->tfield;\n    columns = Fptr->tableptr;\n\n    int tmp_retval;\n\n    // Get the ZBITPIX header value; if this is missing we're in trouble\n    if (get_header_int(header, \"ZBITPIX\", &(Fptr->zbitpix), 0, HDR_FAIL_KEY_MISSING) != GET_HEADER_SUCCESS) {\n        return;\n    }\n\n    // By default assume there is no ZBLANK column and check for ZBLANK or\n    // BLANK in the header\n    Fptr->cn_zblank = Fptr->cn_zzero = Fptr->cn_zscale = -1;\n    Fptr->cn_uncompressed = 0;\n    Fptr->cn_gzip_data = 0;\n\n    // Check for a ZBLANK, ZZERO, ZSCALE, and\n    // UNCOMPRESSED_DATA/GZIP_COMPRESSED_DATA columns in the compressed data\n    // table\n    for (idx = 0; idx < tfields; idx++) {\n        if (0 == strncmp(columns[idx].ttype, \"UNCOMPRESSED_DATA\", 18)) {\n            Fptr->cn_uncompressed = idx + 1;\n        } else if (0 == strncmp(columns[idx].ttype,\n                                \"GZIP_COMPRESSED_DATA\", 21)) {\n            Fptr->cn_gzip_data = idx + 1;\n        } else if (0 == strncmp(columns[idx].ttype, \"ZSCALE\", 7)) {\n            Fptr->cn_zscale = idx + 1;\n        } else if (0 == strncmp(columns[idx].ttype, \"ZZERO\", 6)) {\n            Fptr->cn_zzero = idx + 1;\n        } else if (0 == strncmp(columns[idx].ttype, \"ZBLANK\", 7)) {\n            Fptr->cn_zblank = idx + 1;\n        }\n    }\n\n    Fptr->zblank = 0;\n    if (Fptr->cn_zblank < 1) {\n        // No ZBLANK column--check the ZBLANK and BLANK heard keywords\n        switch (get_header_int(header, \"ZBLANK\", &(Fptr->zblank), 0, HDR_NOFLAG)) {\n          case GET_HEADER_FAILED:\n            return;\n          case GET_HEADER_DEFAULT_USED:\n            // ZBLANK keyword not found\n            if (get_header_int(header, \"BLANK\", &(Fptr->zblank), 0, HDR_NOFLAG) == GET_HEADER_FAILED) {\n              return;\n            }\n            break;\n          default:\n            break;\n        }\n    }\n\n    Fptr->zscale = 1.0;\n    if (Fptr->cn_zscale < 1) {\n        switch (get_header_double(header, \"ZSCALE\", &(Fptr->zscale), 1.0, HDR_NOFLAG)) {\n          case GET_HEADER_FAILED:\n            return;\n          case GET_HEADER_DEFAULT_USED:\n            Fptr->cn_zscale = 0;\n            break;\n          default:\n            break;\n        }\n    }\n    Fptr->cn_bscale = Fptr->zscale;\n\n    Fptr->zzero = 0.0;\n    if (Fptr->cn_zzero < 1) {\n        switch (get_header_double(header, \"ZZERO\", &(Fptr->zzero), 0.0, HDR_NOFLAG)) {\n          case GET_HEADER_FAILED:\n            return;\n          case GET_HEADER_DEFAULT_USED:\n            Fptr->cn_zzero = 0;\n            break;\n          default:\n            break;\n        }\n    }\n    Fptr->cn_bzero = Fptr->zzero;\n\n    if (get_header_string(header, \"ZCMPTYPE\", tmp, DEFAULT_COMPRESSION_TYPE, HDR_NOFLAG) == GET_HEADER_FAILED) {\n        return;\n    }\n    strncpy(Fptr->zcmptype, tmp, 11);\n    Fptr->zcmptype[strlen(tmp)] = '\\0';\n\n    Fptr->compress_type = compress_type_from_string(Fptr->zcmptype);\n    if (PyErr_Occurred()) {\n        return;\n    }\n\n    if (get_header_int(header, \"ZNAXIS\", &znaxis, 0, HDR_NOFLAG) == GET_HEADER_FAILED) {\n        return;\n    }\n    Fptr->zndim = znaxis;\n\n    if (znaxis > MAX_COMPRESS_DIM) {\n        // The CFITSIO compression code currently only supports up to 6\n        // dimensions by default.\n        znaxis = MAX_COMPRESS_DIM;\n    }\n\n    Fptr->tilerow = NULL;\n    Fptr->maxtilelen = 1;\n    for (idx = 1; idx <= znaxis; idx++) {\n        snprintf(keyword, 9, \"ZNAXIS%u\", idx);\n        if (get_header_long(header, keyword, Fptr->znaxis + idx - 1, 0, HDR_NOFLAG) == GET_HEADER_FAILED) {\n            return;\n        }\n        snprintf(keyword, 9, \"ZTILE%u\", idx);\n        if (get_header_long(header, keyword, Fptr->tilesize + idx - 1, 0, HDR_NOFLAG) == GET_HEADER_FAILED) {\n            return;\n        }\n        Fptr->maxtilelen *= Fptr->tilesize[idx - 1];\n    }\n\n    // Set some more default compression options\n    Fptr->rice_blocksize = DEFAULT_BLOCK_SIZE;\n    Fptr->rice_bytepix = DEFAULT_BYTE_PIX;\n    Fptr->quantize_level = DEFAULT_QUANTIZE_LEVEL;\n    Fptr->hcomp_smooth = DEFAULT_HCOMP_SMOOTH;\n    Fptr->hcomp_scale = DEFAULT_HCOMP_SCALE;\n\n    // Now process the ZVALn keywords\n    idx = 1;\n    while (1) {\n        snprintf(keyword, 9, \"ZNAME%u\", idx);\n        // Assumes there are no gaps in the ZNAMEn keywords; this same\n        // assumption was made in the Python code.  This could be done slightly\n        // more flexibly by using a wildcard slice of the header\n        tmp_retval = get_header_string(header, keyword, zname, \"\", HDR_NOFLAG);\n        if (tmp_retval == GET_HEADER_FAILED) {\n            return;\n        } else if (tmp_retval == 1) {\n            break;\n        }\n\n        snprintf(keyword, 9, \"ZVAL%u\", idx);\n        if (Fptr->compress_type == RICE_1) {\n            if (0 == strcmp(zname, \"BLOCKSIZE\")) {\n                if (get_header_int(header, keyword, &(Fptr->rice_blocksize),\n                                   DEFAULT_BLOCK_SIZE, HDR_NOFLAG) == GET_HEADER_FAILED) {\n                    return;\n                }\n            } else if (0 == strcmp(zname, \"BYTEPIX\")) {\n                if (get_header_int(header, keyword, &(Fptr->rice_bytepix),\n                                   DEFAULT_BYTE_PIX, HDR_NOFLAG) == GET_HEADER_FAILED) {\n                    return;\n                }\n            }\n        } else if (Fptr->compress_type == HCOMPRESS_1) {\n            if (0 == strcmp(zname, \"SMOOTH\")) {\n                if (get_header_int(header, keyword, &(Fptr->hcomp_smooth),\n                                   DEFAULT_HCOMP_SMOOTH, HDR_NOFLAG) == GET_HEADER_FAILED) {\n                    return;\n                }\n            } else if (0 == strcmp(zname, \"SCALE\")) {\n                if (get_header_float(header, keyword, &(Fptr->hcomp_scale),\n                                     DEFAULT_HCOMP_SCALE, HDR_NOFLAG) == GET_HEADER_FAILED) {\n                    return;\n                }\n            }\n        }\n        if (Fptr->zbitpix < 0 && 0 == strcmp(zname, \"NOISEBIT\")) {\n            if (get_header_float(header, keyword, &(Fptr->quantize_level),\n                                 DEFAULT_QUANTIZE_LEVEL, HDR_NOFLAG) == GET_HEADER_FAILED) {\n                return;\n            }\n            if (Fptr->quantize_level == 0.0) {\n                /* NOISEBIT == 0 is equivalent to no quantize */\n                Fptr->quantize_level = NO_QUANTIZE;\n            }\n        }\n\n        idx++;\n    }\n\n    /* The ZQUANTIZ keyword determines the quantization algorithm; NO_QUANTIZE\n       implies lossless compression */\n    tmp_retval = get_header_string(header, \"ZQUANTIZ\", tmp, \"\", HDR_NOFLAG);\n    if (tmp_retval == GET_HEADER_FAILED) {\n        return;\n    } else if (tmp_retval == GET_HEADER_SUCCESS) {\n        /* Ugh; the fact that cfitsio defines its version as a float makes\n           preprocessor comparison impossible */\n        fits_get_version(&version);\n        if (0 == strcmp(tmp, \"NONE\")) {\n            Fptr->quantize_level = NO_QUANTIZE;\n        } else if (0 == strcmp(tmp, \"SUBTRACTIVE_DITHER_1\")) {\n            // Added in CFITSIO 3.35, this also changed the name of the\n            // quantize_dither struct member to quantize_method\n            Fptr->quantize_method = SUBTRACTIVE_DITHER_1;\n        } else if (0 == strcmp(tmp, \"SUBTRACTIVE_DITHER_2\")) {\n            Fptr->quantize_method = SUBTRACTIVE_DITHER_2;\n        } else {\n            Fptr->quantize_method = NO_DITHER;\n        }\n    } else {\n        Fptr->quantize_method = NO_DITHER;\n    }\n\n    if (Fptr->quantize_method != NO_DITHER) {\n        switch (get_header_int(header, \"ZDITHER0\", &(Fptr->dither_seed), 0, HDR_NOFLAG)) {\n          case GET_HEADER_FAILED:\n            return;\n          case GET_HEADER_DEFAULT_USED: // ZDITHER0 keyword not found\n            Fptr->dither_seed = 0;\n            Fptr->request_dither_seed = 0;\n            break;\n          default:\n            break;\n        }\n    }\n\n    Fptr->compressimg = 1;\n    Fptr->maxelem = imcomp_calc_max_elem(Fptr->compress_type,\n                                         Fptr->maxtilelen,\n                                         Fptr->zbitpix,\n                                         Fptr->rice_blocksize);\n    Fptr->cn_compressed = 1;\n    return;\n}\n\n\nvoid init_output_buffer(PyObject* hdu, void** buf, size_t* bufsize) {\n    // Determines a good size for the output data buffer and allocates\n    // memory for it, returning the address and size of the allocated\n    // memory into **buf and *bufsize respectively.\n\n    PyObject* header = NULL;\n    char keyword[9];\n    char tmp[72];\n    int znaxis;\n    int compress_type;\n    int zbitpix;\n    int rice_blocksize = 0;\n    long long rowlen;\n    long long nrows;\n    long maxelem;\n    long tilelen;\n    unsigned long maxtilelen = 1;\n    int idx;\n\n    header = PyObject_GetAttrString(hdu, \"_header\");\n    if (header == NULL) {\n        return;\n    }\n\n    if (get_header_int(header, \"ZNAXIS\", &znaxis, 0,\n                       HDR_FAIL_KEY_MISSING | HDR_FAIL_VAL_NEGATIVE) != GET_HEADER_SUCCESS) {\n        goto fail;\n    }\n\n    if (znaxis > 999) {\n        PyErr_SetString(PyExc_ValueError, \"ZNAXIS is greater than 999.\");\n        goto fail;\n    }\n\n    for (idx = 1; idx <= znaxis; idx++) {\n        snprintf(keyword, 9, \"ZTILE%u\", idx);\n        if (get_header_long(header, keyword, &tilelen, 1, HDR_NOFLAG) == GET_HEADER_FAILED) {\n            goto fail;\n        }\n        maxtilelen *= tilelen;\n    }\n\n    if (get_header_string(header, \"ZCMPTYPE\", tmp, DEFAULT_COMPRESSION_TYPE, HDR_NOFLAG) == GET_HEADER_FAILED) {\n        goto fail;\n    }\n    compress_type = compress_type_from_string(tmp);\n    if (PyErr_Occurred()) {\n        goto fail;\n    }\n    if (compress_type == RICE_1) {\n        if (get_header_int(header, \"ZVAL1\", &rice_blocksize, 0, HDR_NOFLAG) == GET_HEADER_FAILED) {\n            goto fail;\n        }\n    }\n\n    /* Because we calculate the size of the buffer based on these values they\n       must not be negative. Otherwise it would wrap around during the casting\n       to size_t and give huge values. */\n    if (get_header_longlong(header, \"NAXIS1\", &rowlen, 0, HDR_FAIL_VAL_NEGATIVE) == GET_HEADER_FAILED) {\n        goto fail;\n    }\n    if (get_header_longlong(header, \"NAXIS2\", &nrows, 0, HDR_FAIL_VAL_NEGATIVE) == GET_HEADER_FAILED) {\n        goto fail;\n    }\n\n    // Get the ZBITPIX header value; if this is missing we're in trouble\n    if (get_header_int(header, \"ZBITPIX\", &zbitpix, 0, HDR_FAIL_KEY_MISSING) != GET_HEADER_SUCCESS) {\n        goto fail;\n    }\n\n    maxelem = imcomp_calc_max_elem(compress_type, maxtilelen, zbitpix,\n                                   rice_blocksize);\n\n    *bufsize = ((size_t) (rowlen * nrows) + (nrows * maxelem));\n\n    if (*bufsize < IOBUFLEN) {\n        // We must have a full FITS block at a minimum\n        *bufsize = IOBUFLEN;\n    } else if (*bufsize % IOBUFLEN != 0) {\n        // Still make sure to pad out to a multiple of 2880 byte blocks\n        // otherwise CFITSIO can get read errors when it tries to read\n        // a partial block that goes past the end of the file\n        *bufsize += ((size_t) (IOBUFLEN - (*bufsize % IOBUFLEN)));\n    }\n\n    *buf = calloc(*bufsize, sizeof(char));\n    if (*buf == NULL) {\n        // Checking if calloc failed.\n        PyErr_SetString(PyExc_MemoryError,\n                        \"Failed to allocate memory for output data buffer.\");\n        goto fail;\n    }\n\nfail:\n    Py_DECREF(header);\n    return;\n}\n\n\nvoid get_hdu_data_base(PyObject* hdu, void** buf, size_t* bufsize) {\n    // Given a pointer to an HDU object, returns a pointer to the deepest base\n    // array of that HDU's data array into **buf, and the size of that array\n    // into *bufsize.\n\n    PyArrayObject* data = NULL;\n    PyArrayObject* base;\n    PyArrayObject* tmp;\n\n    data = (PyArrayObject*) PyObject_GetAttrString(hdu, \"compressed_data\");\n    if (data == NULL) {\n        goto fail;\n    }\n\n    // Walk the array data bases until we find the lowest ndarray base; for\n    // CompImageHDUs there should always be at least one contiguous byte array\n    // allocated for the table and its heap\n    if (!PyObject_TypeCheck(data, &PyArray_Type)) {\n        PyErr_SetString(PyExc_TypeError,\n                        \"CompImageHDU.compressed_data must be a numpy.ndarray\");\n        goto fail;\n    }\n\n    tmp = base = data;\n    while (PyObject_TypeCheck((PyObject*) tmp, &PyArray_Type)) {\n        base = tmp;\n        *bufsize = (size_t) PyArray_NBYTES(base);\n        tmp = (PyArrayObject*) PyArray_BASE(base);\n        if (tmp == NULL) {\n            break;\n        }\n    }\n\n    *buf = PyArray_DATA(base);\nfail:\n    Py_XDECREF(data);\n    return;\n}\n\n\nvoid open_from_hdu(fitsfile** fileptr, void** buf, size_t* bufsize,\n                   PyObject* hdu, tcolumn** columns, int mode) {\n\n    PyObject* header = NULL;\n    FITSfile* Fptr;\n\n    int status = 0;\n    long long rowlen;\n    long long nrows;\n    long long heapsize;\n    long long theap;\n\n    header = PyObject_GetAttrString(hdu, \"_header\");\n    if (header == NULL) {\n        goto fail;\n    }\n\n    if (get_header_longlong(header, \"NAXIS1\", &rowlen, 0, HDR_NOFLAG) == GET_HEADER_FAILED) {\n        goto fail;\n    }\n    if (get_header_longlong(header, \"NAXIS2\", &nrows, 0, HDR_NOFLAG) == GET_HEADER_FAILED) {\n        goto fail;\n    }\n\n    // The PCOUNT keyword contains the number of bytes in the table heap\n    if (get_header_longlong(header, \"PCOUNT\", &heapsize, 0, HDR_FAIL_VAL_NEGATIVE) == GET_HEADER_FAILED) {\n        goto fail;\n    }\n\n    // The THEAP keyword gives the offset of the heap from the beginning of\n    // the HDU data portion; normally this offset is 0 but it can be set\n    // to something else with THEAP\n    if (get_header_longlong(header, \"THEAP\", &theap, 0, HDR_NOFLAG) == GET_HEADER_FAILED) {\n        goto fail;\n    }\n\n    fits_create_memfile(fileptr, buf, bufsize, 0, realloc, &status);\n    if (status != 0) {\n        process_status_err(status);\n        goto fail;\n    }\n\n    Fptr = (*fileptr)->Fptr;\n\n    // Now we have some fun munging some of the elements in the fitsfile struct\n    Fptr->writemode = mode;\n    Fptr->open_count = 1;\n    Fptr->hdutype = BINARY_TBL;  /* This is a binary table HDU */\n    Fptr->lasthdu = 1;\n    Fptr->headstart[0] = 0;\n    Fptr->headend = 0;\n    Fptr->datastart = 0;  /* There is no header, data starts at 0 */\n    Fptr->origrows = Fptr->numrows = nrows;\n    Fptr->rowlength = rowlen;\n    if (theap != 0) {\n        Fptr->heapstart = theap;\n    } else {\n        Fptr->heapstart = rowlen * nrows;\n    }\n\n    Fptr->heapsize = heapsize;\n\n    // Configure the array of table column structs from the Astropy header\n    // instead of allowing CFITSIO to try to read from the header\n    tcolumns_from_header(*fileptr, header, columns);\n    if (PyErr_Occurred()) {\n        goto fail;\n    }\n\n    // If any errors occur in this function they'll bubble up from here to\n    // compression_decompress_hdu\n    configure_compression(*fileptr, header);\n\nfail:\n    Py_XDECREF(header);\n    return;\n}\n\n\nPyObject* compression_compress_hdu(PyObject* self, PyObject* args)\n{\n    PyObject* hdu;\n    PyObject* retval = NULL;\n    tcolumn* columns = NULL;\n\n    void* outbuf = NULL;\n    size_t outbufsize;\n\n    PyObject* tmp_indata;\n    PyArrayObject* indata = NULL;\n    PyArrayObject* tmp;\n    npy_intp znaxis;\n    int datatype;\n    int npdatatype;\n    unsigned long long heapsize;\n\n    fitsfile* fileptr = NULL;\n    FITSfile* Fptr = NULL;\n    int status = 0;\n\n    if (!PyArg_ParseTuple(args, \"O:compression.compress_hdu\", &hdu)) {\n        return NULL;\n    }\n\n    // For HDU compression never use CFITSIO to write directly to the file;\n    // although there's nothing wrong with CFITSIO, right now that would cause\n    // too much confusion to Astropy's internal book keeping.\n    // We just need to get the compressed bytes and Astropy will handle the\n    // writing of them.\n    init_output_buffer(hdu, &outbuf, &outbufsize);\n    if (outbuf == NULL) {\n        return NULL;\n    }\n\n    open_from_hdu(&fileptr, &outbuf, &outbufsize, hdu, &columns, READWRITE);\n    if (PyErr_Occurred()) {\n        goto fail;\n    }\n\n    Fptr = fileptr->Fptr;\n\n    bitpix_to_datatypes(Fptr->zbitpix, &datatype, &npdatatype);\n    if (PyErr_Occurred()) {\n        goto fail;\n    }\n\n    /* The data attribute could be something different from an array, i.e. None */\n    tmp_indata = PyObject_GetAttrString(hdu, \"data\");\n    if (tmp_indata == NULL) {\n        goto fail;\n    }\n\n    if (!PyObject_TypeCheck(tmp_indata, &PyArray_Type)) {\n        PyErr_SetString(PyExc_TypeError,\n                        \"CompImageHDU.data must be a numpy.ndarray\");\n        Py_DECREF(tmp_indata);\n        goto fail;\n    }\n\n    indata = (PyArrayObject*) tmp_indata;\n\n    fits_write_img(fileptr, datatype, 1, PyArray_SIZE(indata),\n                   PyArray_DATA(indata), &status);\n    if (status != 0) {\n        process_status_err(status);\n        goto fail;\n    }\n\n    fits_flush_buffer(fileptr, 1, &status);\n    if (status != 0) {\n        process_status_err(status);\n        goto fail;\n    }\n\n    // Previously this used outbufsize as the size to use for the new Numpy\n    // byte array. However outbufsize is usually larger than necessary to\n    // store all the compressed data exactly; instead use the exact size\n    // of the compressed data from the heapsize plus the size of the table\n    // itself\n    heapsize = (unsigned long long) Fptr->heapsize;\n    znaxis = (npy_intp) (Fptr->heapstart + heapsize);\n\n    if (znaxis < outbufsize) {\n        void* tmp_outbuf = NULL;\n        // Go ahead and truncate to the size in znaxis to free the\n        // redundant allocation\n        if (znaxis == 0) {\n            /* This really shouldn't happen, but if it did, we would have a\n               problem because realloc would deallocate outbuf AND return NULL.\n               */\n            PyErr_SetString(PyExc_ValueError,\n                            \"Calculated array size is zero. This shouldn't happen!\");\n            goto fail;\n        }\n        tmp_outbuf = realloc(outbuf, (size_t) znaxis);\n        if (tmp_outbuf == NULL) {\n            PyErr_SetString(PyExc_MemoryError,\n                            \"Couldn't resize the output-buffer.\");\n            goto fail;\n        }\n        outbuf = tmp_outbuf;\n    }\n\n    tmp = (PyArrayObject*) PyArray_SimpleNewFromData(1, &znaxis, NPY_UBYTE,\n                                                     outbuf);\n    if (tmp == NULL) {\n        /* Really not sure if it's always safe to free outbuf when\n           PyArray_SimpleNewFromData failed (which is unlikely but could happen)\n           but it seems like if it fails then the outbuf NEEDS to be freed... */\n        goto fail;\n    }\n    PyArray_ENABLEFLAGS(tmp, NPY_ARRAY_OWNDATA);\n    /* From this point on outbuf MUST NOT BE FREED! */\n\n    // Leaves refcount of tmp untouched, so its refcount should remain as 1\n    retval = Py_BuildValue(\"KN\", heapsize, tmp);\n    if (retval == NULL) {\n        Py_DECREF(tmp);\n        goto cleanup;\n    }\n\n    goto cleanup;\n\nfail:\n    if (outbuf != NULL) {\n        // At this point outbuf should never not be NULL, but in principle\n        // buggy code somewhere in CFITSIO or Numpy could set it to NULL\n        free(outbuf);\n    }\ncleanup:\n    if (columns != NULL) {\n        free(columns);\n        /* See https://github.com/astropy/astropy/pull/4489\n           We can only set the tableptr to NULL if Fptr is actually not NULL.\n           */\n        if (fileptr != NULL && fileptr->Fptr != NULL) {\n            fileptr->Fptr->tableptr = NULL;\n        }\n    }\n\n    if (fileptr != NULL) {\n        status = 1; // Disable header-related errors\n        fits_close_file(fileptr, &status);\n        if (status != 1) {\n            process_status_err(status);\n            retval = NULL;\n        }\n    }\n\n    Py_XDECREF(indata);\n\n    // Clear any messages remaining in CFITSIO's error stack\n    fits_clear_errmsg();\n\n    return retval;\n}\n\n\nPyObject* compression_decompress_hdu(PyObject* self, PyObject* args)\n{\n\n    PyObject* hdu;\n    tcolumn* columns = NULL;\n\n    void* inbuf;\n    size_t inbufsize;\n\n    PyArrayObject* outdata = NULL;\n    int datatype;\n    int npdatatype;\n    npy_intp zndim;\n    npy_intp* znaxis = NULL;\n    long arrsize;\n\n    fitsfile* fileptr = NULL;\n    int anynul = 0;\n    int status = 0;\n    int idx;\n\n    int free_columns_manually = 1;\n\n    if (!PyArg_ParseTuple(args, \"O:compression.decompress_hdu\", &hdu)) {\n        return NULL;\n    }\n\n    // Grab a pointer to the input data from the HDU's compressed_data\n    // attribute\n    get_hdu_data_base(hdu, &inbuf, &inbufsize);\n    if (PyErr_Occurred()) {\n        return NULL;\n    } else if (inbufsize == 0) {\n        // The compressed data buffer is empty (probably zero rows, for an\n        // empty \"compressed\" image.  Just return None in this case.\n        Py_RETURN_NONE;\n    }\n\n    open_from_hdu(&fileptr, &inbuf, &inbufsize, hdu, &columns, READONLY);\n    if (PyErr_Occurred()) {\n        goto fail;\n    }\n\n    bitpix_to_datatypes(fileptr->Fptr->zbitpix, &datatype, &npdatatype);\n    if (PyErr_Occurred()) {\n        goto fail;\n    }\n\n    zndim = (npy_intp)fileptr->Fptr->zndim;\n    znaxis = PyMem_Malloc(sizeof(npy_intp) * zndim);\n    if (znaxis == NULL) {\n        goto fail;\n    }\n\n    arrsize = 1;\n    for (idx = 0; idx < zndim; idx++) {\n        znaxis[zndim - idx - 1] = fileptr->Fptr->znaxis[idx];\n        arrsize *= fileptr->Fptr->znaxis[idx];\n    }\n\n    /* Create and allocate a new array for the decompressed data */\n    outdata = (PyArrayObject*) PyArray_SimpleNew(zndim, znaxis, npdatatype);\n    if (outdata == NULL) {\n        goto fail;\n    }\n\n    fits_read_img(fileptr, datatype, 1, arrsize, NULL, PyArray_DATA(outdata),\n                  &anynul, &status);\n    /* At this point we need to let CFITSIO clean up the tableptr and the\n       compressed tile cache. */\n    free_columns_manually = 0;\n    if (status != 0) {\n        process_status_err(status);\n        Py_DECREF(outdata);\n        outdata = NULL;\n    }\n\nfail:\n    // CFITSIO will free this object in the ffchdu function by way of\n    // fits_close_file; we need to let CFITSIO handle this so that it also\n    // cleans up the compressed tile cache - but that's only necessary in case\n    // we called \"fits_read_img\"...\n    if (free_columns_manually && columns != NULL) {\n        free(columns);\n        if (fileptr != NULL && fileptr->Fptr != NULL) {\n            fileptr->Fptr->tableptr = NULL;\n        }\n    }\n\n    if (fileptr != NULL) {\n        status = 1;// Disable header-related errors\n        fits_close_file(fileptr, &status);\n        if (status != 1) {\n            process_status_err(status);\n            outdata = NULL;\n        }\n    }\n\n    if (znaxis != NULL) {\n        PyMem_Free(znaxis);\n    }\n\n    // Clear any messages remaining in CFITSIO's error stack\n    fits_clear_errmsg();\n\n    return (PyObject*) outdata;\n}\n\n\n/* CFITSIO version float as returned by fits_get_version() */\nstatic double cfitsio_version;\n\n\nint compression_module_init(PyObject* module) {\n    /* Python version-independent initialization routine for the\n       compression module. Returns 0 on success and -1 (with exception set)\n       on failure. */\n    PyObject* tmp;\n    float version_tmp;\n    int ret;\n\n    fits_get_version(&version_tmp);\n    cfitsio_version = (double) version_tmp;\n    /* The conversion to double can lead to some rounding errors; round to the\n       nearest 3 decimal places, which should be accurate for any past or\n       current CFITSIO version. This is why relying on floats for version\n       comparison isn't generally a bright idea... */\n    cfitsio_version = floor((1000 * version_tmp + 0.5)) / 1000;\n\n    tmp = PyFloat_FromDouble(cfitsio_version);\n    if (tmp == NULL) {\n        return -1;\n    }\n    ret = PyObject_SetAttrString(module, \"CFITSIO_VERSION\", tmp);\n    Py_DECREF(tmp);\n    return ret;\n}\n\n\n/* Method table mapping names to wrappers */\nstatic PyMethodDef compression_methods[] =\n{\n   {\"compress_hdu\", compression_compress_hdu, METH_VARARGS},\n   {\"decompress_hdu\", compression_decompress_hdu, METH_VARARGS},\n   {NULL, NULL}\n};\n\nstatic struct PyModuleDef compressionmodule = {\n    PyModuleDef_HEAD_INIT,\n    \"compression\",\n    \"astropy.compression module\",\n    -1, /* No global state */\n    compression_methods\n};\n\nPyObject *\nPyInit_compression(void)\n{\n    PyObject* module = PyModule_Create(&compressionmodule);\n    if (module == NULL) {\n        return NULL;\n    }\n    if (compression_module_init(module)) {\n        Py_DECREF(module);\n        return NULL;\n    }\n\n    /* Needed to use Numpy routines */\n    /* Note -- import_array() is a macro that behaves differently in Python2.x\n     * vs. Python 3. See the discussion at:\n     * https://groups.google.com/d/topic/astropy-dev/6_AesAsCauM/discussion\n     */\n    import_array();\n    return module;\n}\n"},{"id":2647,"name":"astropy/io/fits/tests","nodeType":"Package"},{"id":2648,"name":"cfitsio_verify.c","nodeType":"TextFile","path":"astropy/io/fits/tests","text":"/* This script verifies .fits checksums using CFITSIO to demonstrate\ncompatibility with Astropy.   Since running it requires compiling and\nlinking against cfitsio,  the script is included as a maintenance\nasset but not automatically compiled and run.\n\nAfter installing cfitsio to ~/include and ~/lib,  I built cfitsio_verify\nlike this:\n\n% gcc cfitsio_verify.c -I~/include -L~/lib -lcfitsio -lm -o cfitsio_verify\n\nRun cfitsio_verify like this:\n\n% cfitsio_verify tmp.fits\n\nTODO: Compile this as an optional extension module and write unit tests that\nuse it; if compilation fails any such tests should be skipped.\n\n*/\n\n#include <fitsio.h>\n\nchar * verify_status(int status)\n{\n\tif (status == 1) {\n\t\treturn \"ok\";\n\t} else if (status == 0) {\n\t\treturn \"missing\";\n\t} else if (status == -1) {\n\t\treturn \"error\";\n\t}\n}\n\nint main(int argc, char *argv[])\n{\n\tfitsfile *fptr;\n\tint i, j, status, dataok, hduok, hdunum, hdutype;\n\tchar *hdustr, *datastr;\n\n\tfor (i=1; i<argc; i++) {\n\n\t\tfits_open_file(&fptr, argv[i], READONLY, &status);\n\t\tif (status) {\n\t\t\tfits_report_error(stderr, status);\n\t\t\texit(-1);\n\t\t}\n\n\t\tfits_get_num_hdus(fptr, &hdunum, &status);\n\t\tif (status) {\n\t\t\tfprintf(stderr, \"Bad get_num_hdus status for '%s' = %d\",\n\t\t\t\targv[i], status);\n\t\t\texit(-1);\n\t\t}\n\n\t\tfor (j=0; j<hdunum; j++) {\n\t\t\tfits_movabs_hdu(fptr, hdunum, &hdutype, &status);\n\t\t\tif (status) {\n\t\t\t\tfprintf(stderr, \"Bad movabs status for '%s[%d]' = %d.\",\n\t\t\t\t\targv[i], j, status);\n\t\t\t\texit(-1);\n\t\t\t}\n\t\t\tfits_verify_chksum(fptr, &dataok, &hduok, &status);\n\t\t\tif (status) {\n\t\t\t\tfprintf(stderr, \"Bad verify status for '%s[%d]' = %d.\",\n\t\t\t\t\targv[i], j, status);\n\t\t\t\texit(-1);\n\t\t\t}\n\t\t\tdatastr = verify_status(dataok);\n\t\t\thdustr = verify_status(hduok);\n\t\t\tprintf(\"Verifying '%s[%d]'  data='%s'   hdu='%s'.\\n\",\n\t\t\t       argv[i], j, datastr, hdustr);\n\t\t}\n\t}\n}\n"},{"col":4,"comment":"null","endLoc":1132,"header":"def __repr__(self)","id":2649,"name":"__repr__","nodeType":"Function","startLoc":1131,"text":"def __repr__(self):\n        return self._base_repr_(html=False)"},{"col":4,"comment":"null","endLoc":1140,"header":"def __str__(self)","id":2650,"name":"__str__","nodeType":"Function","startLoc":1134,"text":"def __str__(self):\n        # If scalar then just convert to correct numpy type and use numpy repr\n        if self.ndim == 0:\n            return str(self.item())\n\n        lines, outs = self._formatter._pformat_col(self)\n        return '\\n'.join(lines)"},{"col":4,"comment":"null","endLoc":1437,"header":"def __new__(cls, data=None, name=None, mask=None, fill_value=None,\n                dtype=None, shape=(), length=0,\n                description=None, unit=None, format=None, meta=None,\n                copy=False, copy_indices=True)","id":2651,"name":"__new__","nodeType":"Function","startLoc":1381,"text":"def __new__(cls, data=None, name=None, mask=None, fill_value=None,\n                dtype=None, shape=(), length=0,\n                description=None, unit=None, format=None, meta=None,\n                copy=False, copy_indices=True):\n\n        if mask is None:\n            # If mask is None then we need to determine the mask (if any) from the data.\n            # The naive method is looking for a mask attribute on data, but this can fail,\n            # see #8816.  Instead use ``MaskedArray`` to do the work.\n            mask = ma.MaskedArray(data).mask\n            if mask is np.ma.nomask:\n                # Handle odd-ball issue with np.ma.nomask (numpy #13758), and see below.\n                mask = False\n            elif copy:\n                mask = mask.copy()\n\n        elif mask is np.ma.nomask:\n            # Force the creation of a full mask array as nomask is tricky to\n            # use and will fail in an unexpected manner when setting a value\n            # to the mask.\n            mask = False\n        else:\n            mask = deepcopy(mask)\n\n        # Create self using MaskedArray as a wrapper class, following the example of\n        # class MSubArray in\n        # https://github.com/numpy/numpy/blob/maintenance/1.8.x/numpy/ma/tests/test_subclassing.py\n        # This pattern makes it so that __array_finalize__ is called as expected (e.g. #1471 and\n        # https://github.com/astropy/astropy/commit/ff6039e8)\n\n        # First just pass through all args and kwargs to BaseColumn, then wrap that object\n        # with MaskedArray.\n        self_data = BaseColumn(data, dtype=dtype, shape=shape, length=length, name=name,\n                               unit=unit, format=format, description=description,\n                               meta=meta, copy=copy, copy_indices=copy_indices)\n        self = ma.MaskedArray.__new__(cls, data=self_data, mask=mask)\n        # The above process preserves info relevant for Column, but this does\n        # not include serialize_method (and possibly other future attributes)\n        # relevant for MaskedColumn, so we set info explicitly.\n        if 'info' in getattr(data, '__dict__', {}):\n            self.info = data.info\n\n        # Note: do not set fill_value in the MaskedArray constructor because this does not\n        # go through the fill_value workarounds.\n        if fill_value is None and getattr(data, 'fill_value', None) is not None:\n            # Coerce the fill_value to the correct type since `data` may be a\n            # different dtype than self.\n            fill_value = np.array(data.fill_value, self.dtype)[()]\n        self.fill_value = fill_value\n\n        self.parent_table = None\n\n        # needs to be done here since self doesn't come from BaseColumn.__new__\n        for index in self.indices:\n            index.replace_col(self_data, self)\n\n        return self"},{"fileName":"__init__.py","filePath":"astropy/io/fits/tests","id":2652,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport os\nimport shutil\nimport stat\nimport tempfile\nimport time\n\nfrom astropy.io import fits\n\n\nclass FitsTestCase:\n    def setup(self):\n        self.data_dir = os.path.join(os.path.dirname(__file__), 'data')\n        self.temp_dir = tempfile.mkdtemp(prefix='fits-test-')\n\n        # Restore global settings to defaults\n        # TODO: Replace this when there's a better way to in the config API to\n        # force config values to their defaults\n        fits.conf.enable_record_valued_keyword_cards = True\n        fits.conf.extension_name_case_sensitive = False\n        fits.conf.strip_header_whitespace = True\n        fits.conf.use_memmap = True\n\n    def teardown(self):\n        if hasattr(self, 'temp_dir') and os.path.exists(self.temp_dir):\n            tries = 3\n            while tries:\n                try:\n                    shutil.rmtree(self.temp_dir)\n                    break\n                except OSError:\n                    # Probably couldn't delete the file because for whatever\n                    # reason a handle to it is still open/hasn't been\n                    # garbage-collected\n                    time.sleep(0.5)\n                    tries -= 1\n\n        fits.conf.reset('enable_record_valued_keyword_cards')\n        fits.conf.reset('extension_name_case_sensitive')\n        fits.conf.reset('strip_header_whitespace')\n        fits.conf.reset('use_memmap')\n\n    def copy_file(self, filename):\n        \"\"\"Copies a backup of a test data file to the temp dir and sets its\n        mode to writeable.\n        \"\"\"\n\n        shutil.copy(self.data(filename), self.temp(filename))\n        os.chmod(self.temp(filename), stat.S_IREAD | stat.S_IWRITE)\n\n    def data(self, filename):\n        \"\"\"Returns the path to a test data file.\"\"\"\n\n        return os.path.join(self.data_dir, filename)\n\n    def temp(self, filename):\n        \"\"\" Returns the full path to a file in the test temp dir.\"\"\"\n\n        return os.path.join(self.temp_dir, filename)\n"},{"id":2653,"name":"astropy/io/fits/tests/data","nodeType":"Package"},{"id":2654,"name":"history_header.fits","nodeType":"TextFile","path":"astropy/io/fits/tests/data","text":"SIMPLE  =                    T / conforms to FITS standard                      BITPIX  =                    8 / array data type                                NAXIS   =                    0 / number of array dimensions                     HISTORY I updated this file on 02/03/2011                                       HISTORY I updated this file on 02/04/2011                                       END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"className":"FitsTestCase","col":0,"comment":"null","endLoc":60,"id":2655,"nodeType":"Class","startLoc":12,"text":"class FitsTestCase:\n    def setup(self):\n        self.data_dir = os.path.join(os.path.dirname(__file__), 'data')\n        self.temp_dir = tempfile.mkdtemp(prefix='fits-test-')\n\n        # Restore global settings to defaults\n        # TODO: Replace this when there's a better way to in the config API to\n        # force config values to their defaults\n        fits.conf.enable_record_valued_keyword_cards = True\n        fits.conf.extension_name_case_sensitive = False\n        fits.conf.strip_header_whitespace = True\n        fits.conf.use_memmap = True\n\n    def teardown(self):\n        if hasattr(self, 'temp_dir') and os.path.exists(self.temp_dir):\n            tries = 3\n            while tries:\n                try:\n                    shutil.rmtree(self.temp_dir)\n                    break\n                except OSError:\n                    # Probably couldn't delete the file because for whatever\n                    # reason a handle to it is still open/hasn't been\n                    # garbage-collected\n                    time.sleep(0.5)\n                    tries -= 1\n\n        fits.conf.reset('enable_record_valued_keyword_cards')\n        fits.conf.reset('extension_name_case_sensitive')\n        fits.conf.reset('strip_header_whitespace')\n        fits.conf.reset('use_memmap')\n\n    def copy_file(self, filename):\n        \"\"\"Copies a backup of a test data file to the temp dir and sets its\n        mode to writeable.\n        \"\"\"\n\n        shutil.copy(self.data(filename), self.temp(filename))\n        os.chmod(self.temp(filename), stat.S_IREAD | stat.S_IWRITE)\n\n    def data(self, filename):\n        \"\"\"Returns the path to a test data file.\"\"\"\n\n        return os.path.join(self.data_dir, filename)\n\n    def temp(self, filename):\n        \"\"\" Returns the full path to a file in the test temp dir.\"\"\"\n\n        return os.path.join(self.temp_dir, filename)"},{"col":4,"comment":"null","endLoc":23,"header":"def setup(self)","id":2656,"name":"setup","nodeType":"Function","startLoc":13,"text":"def setup(self):\n        self.data_dir = os.path.join(os.path.dirname(__file__), 'data')\n        self.temp_dir = tempfile.mkdtemp(prefix='fits-test-')\n\n        # Restore global settings to defaults\n        # TODO: Replace this when there's a better way to in the config API to\n        # force config values to their defaults\n        fits.conf.enable_record_valued_keyword_cards = True\n        fits.conf.extension_name_case_sensitive = False\n        fits.conf.strip_header_whitespace = True\n        fits.conf.use_memmap = True"},{"id":2657,"name":"ascii.fits","nodeType":"TextFile","path":"astropy/io/fits/tests/data","text":"SIMPLE  =                    T / file does conform to FITS standard             BITPIX  =                   16 / number of bits per data pixel                  NAXIS   =                    0 / number of data axes                            EXTEND  =                    T / FITS dataset may contain extensions            COMMENT   FITS (Flexible Image Transport System) format defined in Astronomy andCOMMENT   Astrophysics Supplement Series v44/p363, v44/p371, v73/p359, v73/p365.COMMENT   Contact the NASA Science Office of Standards and Technology for the   COMMENT   FITS Definition document #100 and other FITS information.             END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             XTENSION= 'TABLE   '           / ASCII table extension                          BITPIX  =                    8 / 8-bit ASCII characters                         NAXIS   =                    2 / 2-dimensional ASCII table                      NAXIS1  =                   16 / width of table in characters                   NAXIS2  =                    5                                                  PCOUNT  =                    0 / no group parameters (required keyword)         GCOUNT  =                    1 / one data group (required)                      TFIELDS =                    2                                                  TTYPE1  = 'a       '           / label for field   1                            TBCOL1  =                    1 / beginning column of field   1                  TFORM1  = 'E10.4   '           / Fortran-77 format of field                     TUNIT1  = 'pixels  '           / physical unit of field                         TTYPE2  = 'b       '           / label for field   2                            TBCOL2  =                   12 / beginning column of field   2                  TFORM2  = 'I5      '           / Fortran-77 format of field                     TUNIT2  = 'counts  '           / physical unit of field                         TNULL1  = '*       '           / string representing an undefined value         TNULL2  = '*       '           / string representing an undefined value         HISTORY   This FITS file was created by the FCREATE task.                       HISTORY   fcreate3.0d at 23/4/97 9:21:56.                                       END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             .10123E+02    37.52000E+01    23.15610E+02    17*          *    .34500E+03   345                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                "},{"col":4,"comment":"null","endLoc":42,"header":"def teardown(self)","id":2658,"name":"teardown","nodeType":"Function","startLoc":25,"text":"def teardown(self):\n        if hasattr(self, 'temp_dir') and os.path.exists(self.temp_dir):\n            tries = 3\n            while tries:\n                try:\n                    shutil.rmtree(self.temp_dir)\n                    break\n                except OSError:\n                    # Probably couldn't delete the file because for whatever\n                    # reason a handle to it is still open/hasn't been\n                    # garbage-collected\n                    time.sleep(0.5)\n                    tries -= 1\n\n        fits.conf.reset('enable_record_valued_keyword_cards')\n        fits.conf.reset('extension_name_case_sensitive')\n        fits.conf.reset('strip_header_whitespace')\n        fits.conf.reset('use_memmap')"},{"col":4,"comment":"null","endLoc":1143,"header":"def __bytes__(self)","id":2659,"name":"__bytes__","nodeType":"Function","startLoc":1142,"text":"def __bytes__(self):\n        return str(self).encode('utf-8')"},{"col":4,"comment":"null","endLoc":46,"header":"def __init__(self, equiv_list, name='', kwargs=None)","id":2660,"name":"__init__","nodeType":"Function","startLoc":43,"text":"def __init__(self, equiv_list, name='', kwargs=None):\n        self.data = equiv_list\n        self.name = [name]\n        self.kwargs = [kwargs] if kwargs is not None else [dict()]"},{"id":2661,"name":"ascii_i4-i20.fits","nodeType":"TextFile","path":"astropy/io/fits/tests/data","text":"SIMPLE  =                    T / conforms to FITS standard                      BITPIX  =                    8 / array data type                                NAXIS   =                    0 / number of array dimensions                     EXTEND  =                    T                                                  END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             XTENSION= 'TABLE   '           / ASCII table extension                          BITPIX  =                    8 / array data type                                NAXIS   =                    2 / number of array dimensions                     NAXIS1  =                   50 / length of dimension 1                          NAXIS2  =                    5 / length of dimension 2                          PCOUNT  =                    0 / number of group parameters                     GCOUNT  =                    1 / number of groups                               TFIELDS =                    5 / number of table fields                         TTYPE1  = 'col0    '                                                            TFORM1  = 'I8      '                                                            TBCOL1  =                    1                                                  TTYPE2  = 'col1    '                                                            TFORM2  = 'I8      '                                                            TBCOL2  =                    9                                                  TTYPE3  = 'col2    '                                                            TFORM3  = 'I10     '                                                            TBCOL3  =                   17                                                  TTYPE4  = 'col3    '                                                            TFORM4  = 'I20     '                                                            TBCOL4  =                   27                                                  TTYPE5  = 'col4    '                                                            TFORM5  = 'I4      '                                                            TBCOL5  =                   47                                                  END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    8      16       256               65536 256 8388608167772162147483647 92233720368547758078192-4194304-8388608-536870912-9223372036854775808-512      10      20        30                  40  50 8388608167772162147483647 92233720368547758078192                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      "},{"col":4,"comment":"\n        Emit a warning if any elements of ``value`` will be truncated when\n        ``value`` is assigned to self.\n        ","endLoc":1166,"header":"def _check_string_truncate(self, value)","id":2662,"name":"_check_string_truncate","nodeType":"Function","startLoc":1145,"text":"def _check_string_truncate(self, value):\n        \"\"\"\n        Emit a warning if any elements of ``value`` will be truncated when\n        ``value`` is assigned to self.\n        \"\"\"\n        # Convert input ``value`` to the string dtype of this column and\n        # find the length of the longest string in the array.\n        value = np.asanyarray(value, dtype=self.dtype.type)\n        if value.size == 0:\n            return\n        value_str_len = np.char.str_len(value).max()\n\n        # Parse the array-protocol typestring (e.g. '|U15') of self.dtype which\n        # has the character repeat count on the right side.\n        self_str_len = dtype_bytes_or_chars(self.dtype)\n\n        if value_str_len > self_str_len:\n            warnings.warn('truncated right side string(s) longer than {} '\n                          'character(s) during assignment'\n                          .format(self_str_len),\n                          StringTruncateWarning,\n                          stacklevel=3)"},{"id":2663,"name":"verify.fits","nodeType":"TextFile","path":"astropy/io/fits/tests/data","text":"SIMPLE  =                    T / conforms to FITS standard                      NAXIS   =                    0 / NUMBER OF AXES                                 BITPIX  =                    8 / BITS PER PIXEL                                 END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"id":2664,"name":"astropy/io/fits/tests/data/invalid","nodeType":"Package"},{"id":2665,"name":"group_invalid.fits","nodeType":"TextFile","path":"astropy/io/fits/tests/data/invalid","text":"SIMPLE  =                    T / conforms to FITS standard                      BITPIX  =                    8 / array data type                                NAXIS   =                    0 / number of array dimensions                     EXTEND  =                    T                                                  GROUPS  =                    T / has groups                                     PCOUNT  =                    0 / number of parameters                           GCOUNT  =                    1 / number of groups                               END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"col":0,"comment":"\n    Parse the number out of a dtype.str value like '<U5' or '<f8'.\n\n    See #5819 for discussion on the need for this function for getting\n    the number of characters corresponding to a string dtype.\n\n    Parameters\n    ----------\n    dtype : numpy dtype object\n        Input dtype\n\n    Returns\n    -------\n    bytes_or_chars : int or None\n        Bits (for numeric types) or characters (for string types)\n    ","endLoc":860,"header":"def dtype_bytes_or_chars(dtype)","id":2666,"name":"dtype_bytes_or_chars","nodeType":"Function","startLoc":841,"text":"def dtype_bytes_or_chars(dtype):\n    \"\"\"\n    Parse the number out of a dtype.str value like '<U5' or '<f8'.\n\n    See #5819 for discussion on the need for this function for getting\n    the number of characters corresponding to a string dtype.\n\n    Parameters\n    ----------\n    dtype : numpy dtype object\n        Input dtype\n\n    Returns\n    -------\n    bytes_or_chars : int or None\n        Bits (for numeric types) or characters (for string types)\n    \"\"\"\n    match = re.search(r'(\\d+)$', dtype.str)\n    out = int(match.group(1)) if match else None\n    return out"},{"id":2667,"name":"astropy/io/fits/scripts","nodeType":"Package"},{"fileName":"fitsinfo.py","filePath":"astropy/io/fits/scripts","id":2668,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\n``fitsinfo`` is a command-line script based on astropy.io.fits for\nprinting a summary of the HDUs in one or more FITS files(s) to the\nstandard output.\n\nExample usage of ``fitsinfo``:\n\n1. Print a summary of the HDUs in a FITS file::\n\n    $ fitsinfo filename.fits\n\n    Filename: filename.fits\n    No.    Name         Type      Cards   Dimensions   Format\n    0    PRIMARY     PrimaryHDU     138   ()\n    1    SCI         ImageHDU        61   (800, 800)   int16\n    2    SCI         ImageHDU        61   (800, 800)   int16\n    3    SCI         ImageHDU        61   (800, 800)   int16\n    4    SCI         ImageHDU        61   (800, 800)   int16\n\n2. Print a summary of HDUs of all the FITS files in the current directory::\n\n    $ fitsinfo *.fits\n\"\"\"\n\nimport argparse\nimport astropy.io.fits as fits\nfrom astropy import log, __version__\n\n\nDESCRIPTION = \"\"\"\nPrint a summary of the HDUs in a FITS file(s).\n\nThis script is part of the Astropy package. See\nhttps://docs.astropy.org/en/latest/io/fits/usage/scripts.html#module-astropy.io.fits.scripts.fitsinfo\nfor further documentation.\n\"\"\".strip()\n\n\ndef fitsinfo(filename):\n    \"\"\"\n    Print a summary of the HDUs in a FITS file.\n\n    Parameters\n    ----------\n    filename : str\n        The path to a FITS file.\n    \"\"\"\n\n    try:\n        fits.info(filename)\n    except OSError as e:\n        log.error(str(e))\n    return\n\n\ndef main(args=None):\n    \"\"\"The main function called by the `fitsinfo` script.\"\"\"\n    parser = argparse.ArgumentParser(\n        description=DESCRIPTION,\n        formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument(\n        '--version', action='version',\n        version=f'%(prog)s {__version__}')\n    parser.add_argument('filename', nargs='+',\n                        help='Path to one or more FITS files. '\n                             'Wildcards are supported.')\n    args = parser.parse_args(args)\n\n    for idx, filename in enumerate(args.filename):\n        if idx > 0:\n            print()\n        fitsinfo(filename)\n"},{"col":4,"comment":"\n        Checks the type of the frame and whether a velocity differential and a\n        distance has been defined on the frame object.\n\n        If no distance is defined, the target is assumed to be \"really far\n        away\", and the observer is assumed to be \"in the solar system\".\n\n        Parameters\n        ----------\n        coord : `~astropy.coordinates.BaseCoordinateFrame`\n            The new frame to be used for target or observer.\n        label : str, optional\n            The name of the object being validated (e.g. 'target' or 'observer'),\n            which is then used in error messages.\n        ","endLoc":281,"header":"@staticmethod\n    def _validate_coordinate(coord, label='')","id":2669,"name":"_validate_coordinate","nodeType":"Function","startLoc":230,"text":"@staticmethod\n    def _validate_coordinate(coord, label=''):\n        \"\"\"\n        Checks the type of the frame and whether a velocity differential and a\n        distance has been defined on the frame object.\n\n        If no distance is defined, the target is assumed to be \"really far\n        away\", and the observer is assumed to be \"in the solar system\".\n\n        Parameters\n        ----------\n        coord : `~astropy.coordinates.BaseCoordinateFrame`\n            The new frame to be used for target or observer.\n        label : str, optional\n            The name of the object being validated (e.g. 'target' or 'observer'),\n            which is then used in error messages.\n        \"\"\"\n\n        if coord is None:\n            return\n\n        if not issubclass(coord.__class__, BaseCoordinateFrame):\n            if isinstance(coord, SkyCoord):\n                coord = coord.frame\n            else:\n                raise TypeError(f\"{label} must be a SkyCoord or coordinate frame instance\")\n\n        # If the distance is not well-defined, ensure that it works properly\n        # for generating differentials\n        # TODO: change this to not set the distance and yield a warning once\n        # there's a good way to address this in astropy.coordinates\n        # https://github.com/astropy/astropy/issues/10247\n        with np.errstate(all='ignore'):\n            distance = getattr(coord, 'distance', None)\n        if distance is not None and distance.unit.physical_type == 'dimensionless':\n            coord = SkyCoord(coord, distance=DEFAULT_DISTANCE)\n            warnings.warn(\n                \"Distance on coordinate object is dimensionless, an \"\n                f\"arbitrary distance value of {DEFAULT_DISTANCE} will be set instead.\",\n                NoDistanceWarning)\n\n        # If the observer frame does not contain information about the\n        # velocity of the system, assume that the velocity is zero in the\n        # system.\n        if 's' not in coord.data.differentials:\n            warnings.warn(\n                f\"No velocity defined on frame, assuming {ZERO_VELOCITIES}.\",\n                NoVelocityWarning)\n\n            coord = attach_zero_velocities(coord)\n\n        return coord"},{"col":4,"comment":"Copies a backup of a test data file to the temp dir and sets its\n        mode to writeable.\n        ","endLoc":50,"header":"def copy_file(self, filename)","id":2670,"name":"copy_file","nodeType":"Function","startLoc":44,"text":"def copy_file(self, filename):\n        \"\"\"Copies a backup of a test data file to the temp dir and sets its\n        mode to writeable.\n        \"\"\"\n\n        shutil.copy(self.data(filename), self.temp(filename))\n        os.chmod(self.temp(filename), stat.S_IREAD | stat.S_IWRITE)"},{"col":0,"comment":"\n    Print a summary of the HDUs in a FITS file.\n\n    Parameters\n    ----------\n    filename : str\n        The path to a FITS file.\n    ","endLoc":54,"header":"def fitsinfo(filename)","id":2671,"name":"fitsinfo","nodeType":"Function","startLoc":40,"text":"def fitsinfo(filename):\n    \"\"\"\n    Print a summary of the HDUs in a FITS file.\n\n    Parameters\n    ----------\n    filename : str\n        The path to a FITS file.\n    \"\"\"\n\n    try:\n        fits.info(filename)\n    except OSError as e:\n        log.error(str(e))\n    return"},{"col":4,"comment":"null","endLoc":1181,"header":"def __setitem__(self, index, value)","id":2672,"name":"__setitem__","nodeType":"Function","startLoc":1168,"text":"def __setitem__(self, index, value):\n        if self.dtype.char == 'S':\n            value = self._encode_str(value)\n\n        # Issue warning for string assignment that truncates ``value``\n        if issubclass(self.dtype.type, np.character):\n            self._check_string_truncate(value)\n\n        # update indices\n        self.info.adjust_indices(index, value, len(self))\n\n        # Set items using a view of the underlying data, as it gives an\n        # order-of-magnitude speed-up. [#2994]\n        self.data[index] = value"},{"col":0,"comment":"The main function called by the `fitsinfo` script.","endLoc":73,"header":"def main(args=None)","id":2673,"name":"main","nodeType":"Function","startLoc":57,"text":"def main(args=None):\n    \"\"\"The main function called by the `fitsinfo` script.\"\"\"\n    parser = argparse.ArgumentParser(\n        description=DESCRIPTION,\n        formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument(\n        '--version', action='version',\n        version=f'%(prog)s {__version__}')\n    parser.add_argument('filename', nargs='+',\n                        help='Path to one or more FITS files. '\n                             'Wildcards are supported.')\n    args = parser.parse_args(args)\n\n    for idx, filename in enumerate(args.filename):\n        if idx > 0:\n            print()\n        fitsinfo(filename)"},{"attributeType":"null","col":26,"comment":"null","endLoc":27,"id":2674,"name":"fits","nodeType":"Attribute","startLoc":27,"text":"fits"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":2675,"name":"DESCRIPTION","nodeType":"Attribute","startLoc":31,"text":"DESCRIPTION"},{"col":4,"comment":"\n        Insert values before the given indices in the column and return\n        a new `~astropy.table.Column` object.\n\n        Parameters\n        ----------\n        obj : int, slice or sequence of int\n            Object that defines the index or indices before which ``values`` is\n            inserted.\n        values : array-like\n            Value(s) to insert.  If the type of ``values`` is different from\n            that of the column, ``values`` is converted to the matching type.\n            ``values`` should be shaped so that it can be broadcast appropriately.\n        axis : int, optional\n            Axis along which to insert ``values``.  If ``axis`` is None then\n            the column array is flattened before insertion.  Default is 0,\n            which will insert a row.\n\n        Returns\n        -------\n        out : `~astropy.table.Column`\n            A copy of column with ``values`` and ``mask`` inserted.  Note that the\n            insertion does not occur in-place: a new column is returned.\n        ","endLoc":1227,"header":"def insert(self, obj, values, axis=0)","id":2676,"name":"insert","nodeType":"Function","startLoc":1190,"text":"def insert(self, obj, values, axis=0):\n        \"\"\"\n        Insert values before the given indices in the column and return\n        a new `~astropy.table.Column` object.\n\n        Parameters\n        ----------\n        obj : int, slice or sequence of int\n            Object that defines the index or indices before which ``values`` is\n            inserted.\n        values : array-like\n            Value(s) to insert.  If the type of ``values`` is different from\n            that of the column, ``values`` is converted to the matching type.\n            ``values`` should be shaped so that it can be broadcast appropriately.\n        axis : int, optional\n            Axis along which to insert ``values``.  If ``axis`` is None then\n            the column array is flattened before insertion.  Default is 0,\n            which will insert a row.\n\n        Returns\n        -------\n        out : `~astropy.table.Column`\n            A copy of column with ``values`` and ``mask`` inserted.  Note that the\n            insertion does not occur in-place: a new column is returned.\n        \"\"\"\n        if self.dtype.kind == 'O':\n            # Even if values is array-like (e.g. [1,2,3]), insert as a single\n            # object.  Numpy.insert instead inserts each element in an array-like\n            # input individually.\n            data = np.insert(self, obj, None, axis=axis)\n            data[obj] = values\n        else:\n            self_for_insert = _expand_string_array_for_values(self, values)\n            data = np.insert(self_for_insert, obj, values, axis=axis)\n\n        out = data.view(self.__class__)\n        out.__array_finalize__(self)\n        return out"},{"col":0,"comment":"","endLoc":24,"header":"fitsinfo.py#<anonymous>","id":2677,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n``fitsinfo`` is a command-line script based on astropy.io.fits for\nprinting a summary of the HDUs in one or more FITS files(s) to the\nstandard output.\n\nExample usage of ``fitsinfo``:\n\n1. Print a summary of the HDUs in a FITS file::\n\n    $ fitsinfo filename.fits\n\n    Filename: filename.fits\n    No.    Name         Type      Cards   Dimensions   Format\n    0    PRIMARY     PrimaryHDU     138   ()\n    1    SCI         ImageHDU        61   (800, 800)   int16\n    2    SCI         ImageHDU        61   (800, 800)   int16\n    3    SCI         ImageHDU        61   (800, 800)   int16\n    4    SCI         ImageHDU        61   (800, 800)   int16\n\n2. Print a summary of HDUs of all the FITS files in the current directory::\n\n    $ fitsinfo *.fits\n\"\"\"\n\nDESCRIPTION = \"\"\"\nPrint a summary of the HDUs in a FITS file(s).\n\nThis script is part of the Astropy package. See\nhttps://docs.astropy.org/en/latest/io/fits/usage/scripts.html#module-astropy.io.fits.scripts.fitsinfo\nfor further documentation.\n\"\"\".strip()"},{"col":0,"comment":"\n    For string-dtype return a version of ``arr`` that is wide enough for ``values``.\n    If ``arr`` is not string-dtype or does not need expansion then return ``arr``.\n\n    Parameters\n    ----------\n    arr : np.ndarray\n        Input array\n    values : scalar or array-like\n        Values for width comparison for string arrays\n\n    Returns\n    -------\n    arr_expanded : np.ndarray\n\n    ","endLoc":146,"header":"def _expand_string_array_for_values(arr, values)","id":2678,"name":"_expand_string_array_for_values","nodeType":"Function","startLoc":117,"text":"def _expand_string_array_for_values(arr, values):\n    \"\"\"\n    For string-dtype return a version of ``arr`` that is wide enough for ``values``.\n    If ``arr`` is not string-dtype or does not need expansion then return ``arr``.\n\n    Parameters\n    ----------\n    arr : np.ndarray\n        Input array\n    values : scalar or array-like\n        Values for width comparison for string arrays\n\n    Returns\n    -------\n    arr_expanded : np.ndarray\n\n    \"\"\"\n    if arr.dtype.kind in ('U', 'S') and values is not np.ma.masked:\n        # Find the length of the longest string in the new values.\n        values_str_len = np.char.str_len(values).max()\n\n        # Determine character repeat count of arr.dtype.  Returns a positive\n        # int or None (something like 'U0' is not possible in numpy).  If new values\n        # are longer than current then make a new (wider) version of arr.\n        arr_str_len = dtype_bytes_or_chars(arr.dtype)\n        if arr_str_len and values_str_len > arr_str_len:\n            arr_dtype = arr.dtype.byteorder + arr.dtype.kind + str(values_str_len)\n            arr = arr.astype(arr_dtype)\n\n    return arr"},{"fileName":"fitscheck.py","filePath":"astropy/io/fits/scripts","id":2679,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\n``fitscheck`` is a command line script based on astropy.io.fits for verifying\nand updating the CHECKSUM and DATASUM keywords of .fits files.  ``fitscheck``\ncan also detect and often fix other FITS standards violations.  ``fitscheck``\nfacilitates re-writing the non-standard checksums originally generated by\nastropy.io.fits with standard checksums which will interoperate with CFITSIO.\n\n``fitscheck`` will refuse to write new checksums if the checksum keywords are\nmissing or their values are bad.  Use ``--force`` to write new checksums\nregardless of whether or not they currently exist or pass.  Use\n``--ignore-missing`` to tolerate missing checksum keywords without comment.\n\nExample uses of fitscheck:\n\n1. Add checksums::\n\n    $ fitscheck --write *.fits\n\n2. Write new checksums, even if existing checksums are bad or missing::\n\n    $ fitscheck --write --force *.fits\n\n3. Verify standard checksums and FITS compliance without changing the files::\n\n    $ fitscheck --compliance *.fits\n\n4. Only check and fix compliance problems,  ignoring checksums::\n\n    $ fitscheck --checksum none --compliance --write *.fits\n\n5. Verify standard interoperable checksums::\n\n    $ fitscheck *.fits\n\n6. Delete checksum keywords::\n\n    $ fitscheck --checksum remove --write *.fits\n\n\"\"\"\n\n\nimport sys\nimport logging\nimport argparse\nimport warnings\n\nfrom astropy.io import fits\nfrom astropy import __version__\n\nlog = logging.getLogger('fitscheck')\n\nDESCRIPTION = \"\"\"\ne.g. fitscheck example.fits\n\nVerifies and optionally re-writes the CHECKSUM and DATASUM keywords\nfor a .fits file.\nOptionally detects and fixes FITS standard compliance problems.\n\nThis script is part of the Astropy package. See\nhttps://docs.astropy.org/en/latest/io/fits/usage/scripts.html#module-astropy.io.fits.scripts.fitscheck\nfor further documentation.\n\"\"\".strip()\n\n\ndef handle_options(args):\n    if not len(args):\n        args = ['-h']\n\n    parser = argparse.ArgumentParser(\n        description=DESCRIPTION,\n        formatter_class=argparse.RawDescriptionHelpFormatter)\n\n    parser.add_argument(\n        '--version', action='version',\n        version=f'%(prog)s {__version__}')\n\n    parser.add_argument(\n        'fits_files', metavar='file', nargs='+',\n        help='.fits files to process.')\n\n    parser.add_argument(\n        '-k', '--checksum', dest='checksum_kind',\n        choices=['standard', 'remove', 'none'],\n        help='Choose FITS checksum mode or none.  Defaults standard.',\n        default='standard')\n\n    parser.add_argument(\n        '-w', '--write', dest='write_file',\n        help='Write out file checksums and/or FITS compliance fixes.',\n        default=False, action='store_true')\n\n    parser.add_argument(\n        '-f', '--force', dest='force',\n        help='Do file update even if original checksum was bad.',\n        default=False, action='store_true')\n\n    parser.add_argument(\n        '-c', '--compliance', dest='compliance',\n        help='Do FITS compliance checking; fix if possible.',\n        default=False, action='store_true')\n\n    parser.add_argument(\n        '-i', '--ignore-missing', dest='ignore_missing',\n        help='Ignore missing checksums.',\n        default=False, action='store_true')\n\n    parser.add_argument(\n        '-v', '--verbose', dest='verbose', help='Generate extra output.',\n        default=False, action='store_true')\n\n    global OPTIONS\n    OPTIONS = parser.parse_args(args)\n\n    if OPTIONS.checksum_kind == 'none':\n        OPTIONS.checksum_kind = False\n    elif OPTIONS.checksum_kind == 'standard':\n        OPTIONS.checksum_kind = True\n    elif OPTIONS.checksum_kind == 'remove':\n        OPTIONS.write_file = True\n        OPTIONS.force = True\n\n    return OPTIONS.fits_files\n\n\ndef setup_logging():\n    log.handlers.clear()\n\n    if OPTIONS.verbose:\n        log.setLevel(logging.INFO)\n    else:\n        log.setLevel(logging.WARNING)\n\n    handler = logging.StreamHandler()\n    handler.setFormatter(logging.Formatter('%(message)s'))\n    log.addHandler(handler)\n\n\ndef verify_checksums(filename):\n    \"\"\"\n    Prints a message if any HDU in `filename` has a bad checksum or datasum.\n    \"\"\"\n    with warnings.catch_warnings(record=True) as wlist:\n        warnings.simplefilter('always')\n        with fits.open(filename, checksum=OPTIONS.checksum_kind) as hdulist:\n            for i, hdu in enumerate(hdulist):\n                # looping on HDUs is needed to read them and verify the\n                # checksums\n                if not OPTIONS.ignore_missing:\n                    if not hdu._checksum:\n                        log.warning('MISSING {!r} .. Checksum not found '\n                                    'in HDU #{}'.format(filename, i))\n                        return 1\n                    if not hdu._datasum:\n                        log.warning('MISSING {!r} .. Datasum not found '\n                                    'in HDU #{}'.format(filename, i))\n                        return 1\n\n    for w in wlist:\n        if str(w.message).startswith(('Checksum verification failed',\n                                      'Datasum verification failed')):\n            log.warning('BAD %r %s', filename, str(w.message))\n            return 1\n\n    log.info(f'OK {filename!r}')\n    return 0\n\n\ndef verify_compliance(filename):\n    \"\"\"Check for FITS standard compliance.\"\"\"\n\n    with fits.open(filename) as hdulist:\n        try:\n            hdulist.verify('exception')\n        except fits.VerifyError as exc:\n            log.warning('NONCOMPLIANT %r .. %s',\n                        filename, str(exc).replace('\\n', ' '))\n            return 1\n    return 0\n\n\ndef update(filename):\n    \"\"\"\n    Sets the ``CHECKSUM`` and ``DATASUM`` keywords for each HDU of `filename`.\n\n    Also updates fixes standards violations if possible and requested.\n    \"\"\"\n\n    output_verify = 'silentfix' if OPTIONS.compliance else 'ignore'\n\n    # For unit tests we reset temporarily the warning filters. Indeed, before\n    # updating the checksums, fits.open will verify the existing checksums and\n    # raise warnings, which are later caught and converted to log.warning...\n    # which is an issue when testing, using the \"error\" action to convert\n    # warnings to exceptions.\n    with warnings.catch_warnings():\n        warnings.resetwarnings()\n        with fits.open(filename, do_not_scale_image_data=True,\n                       checksum=OPTIONS.checksum_kind, mode='update') as hdulist:\n            hdulist.flush(output_verify=output_verify)\n\n\ndef process_file(filename):\n    \"\"\"\n    Handle a single .fits file,  returning the count of checksum and compliance\n    errors.\n    \"\"\"\n\n    try:\n        checksum_errors = verify_checksums(filename)\n        if OPTIONS.compliance:\n            compliance_errors = verify_compliance(filename)\n        else:\n            compliance_errors = 0\n        if OPTIONS.write_file and checksum_errors == 0 or OPTIONS.force:\n            update(filename)\n        return checksum_errors + compliance_errors\n    except Exception as e:\n        log.error(f'EXCEPTION {filename!r} .. {e}')\n        return 1\n\n\ndef main(args=None):\n    \"\"\"\n    Processes command line parameters into options and files,  then checks\n    or update FITS DATASUM and CHECKSUM keywords for the specified files.\n    \"\"\"\n\n    errors = 0\n    fits_files = handle_options(args or sys.argv[1:])\n    setup_logging()\n    for filename in fits_files:\n        errors += process_file(filename)\n    if errors:\n        log.warning(f'{errors} errors')\n    return int(bool(errors))\n"},{"col":4,"comment":"Returns the path to a test data file.","endLoc":55,"header":"def data(self, filename)","id":2680,"name":"data","nodeType":"Function","startLoc":52,"text":"def data(self, filename):\n        \"\"\"Returns the path to a test data file.\"\"\"\n\n        return os.path.join(self.data_dir, filename)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1183,"id":2681,"name":"__eq__","nodeType":"Attribute","startLoc":1183,"text":"__eq__"},{"col":0,"comment":"null","endLoc":123,"header":"def handle_options(args)","id":2682,"name":"handle_options","nodeType":"Function","startLoc":66,"text":"def handle_options(args):\n    if not len(args):\n        args = ['-h']\n\n    parser = argparse.ArgumentParser(\n        description=DESCRIPTION,\n        formatter_class=argparse.RawDescriptionHelpFormatter)\n\n    parser.add_argument(\n        '--version', action='version',\n        version=f'%(prog)s {__version__}')\n\n    parser.add_argument(\n        'fits_files', metavar='file', nargs='+',\n        help='.fits files to process.')\n\n    parser.add_argument(\n        '-k', '--checksum', dest='checksum_kind',\n        choices=['standard', 'remove', 'none'],\n        help='Choose FITS checksum mode or none.  Defaults standard.',\n        default='standard')\n\n    parser.add_argument(\n        '-w', '--write', dest='write_file',\n        help='Write out file checksums and/or FITS compliance fixes.',\n        default=False, action='store_true')\n\n    parser.add_argument(\n        '-f', '--force', dest='force',\n        help='Do file update even if original checksum was bad.',\n        default=False, action='store_true')\n\n    parser.add_argument(\n        '-c', '--compliance', dest='compliance',\n        help='Do FITS compliance checking; fix if possible.',\n        default=False, action='store_true')\n\n    parser.add_argument(\n        '-i', '--ignore-missing', dest='ignore_missing',\n        help='Ignore missing checksums.',\n        default=False, action='store_true')\n\n    parser.add_argument(\n        '-v', '--verbose', dest='verbose', help='Generate extra output.',\n        default=False, action='store_true')\n\n    global OPTIONS\n    OPTIONS = parser.parse_args(args)\n\n    if OPTIONS.checksum_kind == 'none':\n        OPTIONS.checksum_kind = False\n    elif OPTIONS.checksum_kind == 'standard':\n        OPTIONS.checksum_kind = True\n    elif OPTIONS.checksum_kind == 'remove':\n        OPTIONS.write_file = True\n        OPTIONS.force = True\n\n    return OPTIONS.fits_files"},{"attributeType":"null","col":4,"comment":"null","endLoc":1184,"id":2683,"name":"__ne__","nodeType":"Attribute","startLoc":1184,"text":"__ne__"},{"attributeType":"null","col":4,"comment":"null","endLoc":1185,"id":2684,"name":"__gt__","nodeType":"Attribute","startLoc":1185,"text":"__gt__"},{"attributeType":"null","col":4,"comment":"null","endLoc":1186,"id":2685,"name":"__lt__","nodeType":"Attribute","startLoc":1186,"text":"__lt__"},{"attributeType":"null","col":4,"comment":"null","endLoc":1187,"id":2686,"name":"__ge__","nodeType":"Attribute","startLoc":1187,"text":"__ge__"},{"col":4,"comment":" Returns the full path to a file in the test temp dir.","endLoc":60,"header":"def temp(self, filename)","id":2687,"name":"temp","nodeType":"Function","startLoc":57,"text":"def temp(self, filename):\n        \"\"\" Returns the full path to a file in the test temp dir.\"\"\"\n\n        return os.path.join(self.temp_dir, filename)"},{"col":0,"comment":"null","endLoc":136,"header":"def setup_logging()","id":2688,"name":"setup_logging","nodeType":"Function","startLoc":126,"text":"def setup_logging():\n    log.handlers.clear()\n\n    if OPTIONS.verbose:\n        log.setLevel(logging.INFO)\n    else:\n        log.setLevel(logging.WARNING)\n\n    handler = logging.StreamHandler()\n    handler.setFormatter(logging.Formatter('%(message)s'))\n    log.addHandler(handler)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1188,"id":2689,"name":"__le__","nodeType":"Attribute","startLoc":1188,"text":"__le__"},{"col":4,"comment":"null","endLoc":356,"header":"@classmethod\n    def _remap_keyword(cls, keyword)","id":2690,"name":"_remap_keyword","nodeType":"Function","startLoc":338,"text":"@classmethod\n    def _remap_keyword(cls, keyword):\n        # Given a keyword that one might set on an image, remap that keyword to\n        # the name used for it in the COMPRESSED HDU header\n        # This is mostly just a lookup in _keyword_remaps, but needs handling\n        # for NAXISn keywords\n\n        is_naxisn = False\n        if keyword[:5] == 'NAXIS':\n            with suppress(ValueError):\n                index = int(keyword[5:])\n                is_naxisn = index > 0\n\n        if is_naxisn:\n            return f'ZNAXIS{index}'\n\n        # If the keyword does not need to be remapped then just return the\n        # original keyword\n        return cls._keyword_remaps.get(keyword, keyword)"},{"attributeType":"null","col":8,"comment":"null","endLoc":15,"id":2691,"name":"temp_dir","nodeType":"Attribute","startLoc":15,"text":"self.temp_dir"},{"attributeType":"null","col":8,"comment":"null","endLoc":14,"id":2692,"name":"data_dir","nodeType":"Attribute","startLoc":14,"text":"self.data_dir"},{"attributeType":"null","col":4,"comment":"null","endLoc":1230,"id":2693,"name":"name","nodeType":"Attribute","startLoc":1230,"text":"name"},{"col":4,"comment":"null","endLoc":172,"header":"def __delitem__(self, key)","id":2694,"name":"__delitem__","nodeType":"Function","startLoc":147,"text":"def __delitem__(self, key):\n        if isinstance(key, slice) or self._haswildcard(key):\n            # If given a slice pass that on to the superclass and bail out\n            # early; we only want to make updates to _table_header when given\n            # a key specifying a single keyword\n            return super().__delitem__(key)\n\n        if isinstance(key, int):\n            keyword, index = self._keyword_from_index(key)\n        elif isinstance(key, tuple):\n            keyword, index = key\n        else:\n            keyword, index = key, None\n\n        if key not in self:\n            raise KeyError(f\"Keyword {key!r} not found.\")\n\n        super().__delitem__(key)\n\n        remapped_keyword = self._remap_keyword(keyword)\n\n        if remapped_keyword in self._table_header:\n            if index is not None:\n                del self._table_header[(remapped_keyword, index)]\n            else:\n                del self._table_header[remapped_keyword]"},{"attributeType":"None","col":4,"comment":"null","endLoc":1231,"id":2695,"name":"unit","nodeType":"Attribute","startLoc":1231,"text":"unit"},{"col":0,"comment":"\n    Return the equivalency pairs for the relativistic convention for velocity.\n\n    The full relativistic convention for the relation between velocity and frequency is:\n\n    :math:`V = c \\frac{f_0^2 - f^2}{f_0^2 + f^2} ;  f(V) = f_0 \\frac{\\left(1 - (V/c)^2\\right)^{1/2}}{(1+V/c)}`\n\n    Parameters\n    ----------\n    rest : `~astropy.units.Quantity`\n        Any quantity supported by the standard spectral equivalencies\n        (wavelength, energy, frequency, wave number).\n\n    References\n    ----------\n    `NRAO site defining the conventions <https://www.gb.nrao.edu/~fghigo/gbtdoc/doppler.html>`_\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> CO_restfreq = 115.27120*u.GHz  # rest frequency of 12 CO 1-0 in GHz\n    >>> relativistic_CO_equiv = u.doppler_relativistic(CO_restfreq)\n    >>> measured_freq = 115.2832*u.GHz\n    >>> relativistic_velocity = measured_freq.to(u.km/u.s, equivalencies=relativistic_CO_equiv)\n    >>> relativistic_velocity  # doctest: +FLOAT_CMP\n    <Quantity -31.207467619351537 km / s>\n    >>> measured_velocity = 1250 * u.km/u.s\n    >>> relativistic_frequency = measured_velocity.to(u.GHz, equivalencies=relativistic_CO_equiv)\n    >>> relativistic_frequency  # doctest: +FLOAT_CMP\n    <Quantity 114.79156866993588 GHz>\n    >>> relativistic_wavelength = measured_velocity.to(u.mm, equivalencies=relativistic_CO_equiv)\n    >>> relativistic_wavelength  # doctest: +FLOAT_CMP\n    <Quantity 2.6116243681798923 mm>\n    ","endLoc":508,"header":"def doppler_relativistic(rest)","id":2696,"name":"doppler_relativistic","nodeType":"Function","startLoc":438,"text":"def doppler_relativistic(rest):\n    r\"\"\"\n    Return the equivalency pairs for the relativistic convention for velocity.\n\n    The full relativistic convention for the relation between velocity and frequency is:\n\n    :math:`V = c \\frac{f_0^2 - f^2}{f_0^2 + f^2} ;  f(V) = f_0 \\frac{\\left(1 - (V/c)^2\\right)^{1/2}}{(1+V/c)}`\n\n    Parameters\n    ----------\n    rest : `~astropy.units.Quantity`\n        Any quantity supported by the standard spectral equivalencies\n        (wavelength, energy, frequency, wave number).\n\n    References\n    ----------\n    `NRAO site defining the conventions <https://www.gb.nrao.edu/~fghigo/gbtdoc/doppler.html>`_\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> CO_restfreq = 115.27120*u.GHz  # rest frequency of 12 CO 1-0 in GHz\n    >>> relativistic_CO_equiv = u.doppler_relativistic(CO_restfreq)\n    >>> measured_freq = 115.2832*u.GHz\n    >>> relativistic_velocity = measured_freq.to(u.km/u.s, equivalencies=relativistic_CO_equiv)\n    >>> relativistic_velocity  # doctest: +FLOAT_CMP\n    <Quantity -31.207467619351537 km / s>\n    >>> measured_velocity = 1250 * u.km/u.s\n    >>> relativistic_frequency = measured_velocity.to(u.GHz, equivalencies=relativistic_CO_equiv)\n    >>> relativistic_frequency  # doctest: +FLOAT_CMP\n    <Quantity 114.79156866993588 GHz>\n    >>> relativistic_wavelength = measured_velocity.to(u.mm, equivalencies=relativistic_CO_equiv)\n    >>> relativistic_wavelength  # doctest: +FLOAT_CMP\n    <Quantity 2.6116243681798923 mm>\n    \"\"\"  # noqa: E501\n\n    assert_is_spectral_unit(rest)\n\n    ckms = _si.c.to_value('km/s')\n\n    def to_vel_freq(x):\n        restfreq = rest.to_value(si.Hz, equivalencies=spectral())\n        return (restfreq**2-x**2) / (restfreq**2+x**2) * ckms\n\n    def from_vel_freq(x):\n        restfreq = rest.to_value(si.Hz, equivalencies=spectral())\n        voverc = x/ckms\n        return restfreq * ((1-voverc) / (1+(voverc)))**0.5\n\n    def to_vel_wav(x):\n        restwav = rest.to_value(si.AA, spectral())\n        return (x**2-restwav**2) / (restwav**2+x**2) * ckms\n\n    def from_vel_wav(x):\n        restwav = rest.to_value(si.AA, spectral())\n        voverc = x/ckms\n        return restwav * ((1+voverc) / (1-voverc))**0.5\n\n    def to_vel_en(x):\n        resten = rest.to_value(si.eV, spectral())\n        return (resten**2-x**2) / (resten**2+x**2) * ckms\n\n    def from_vel_en(x):\n        resten = rest.to_value(si.eV, spectral())\n        voverc = x/ckms\n        return resten * ((1-voverc) / (1+(voverc)))**0.5\n\n    return Equivalency([(si.Hz, si.km/si.s, to_vel_freq, from_vel_freq),\n                        (si.AA, si.km/si.s, to_vel_wav, from_vel_wav),\n                        (si.eV, si.km/si.s, to_vel_en, from_vel_en),\n                        ], \"doppler_relativistic\", {'rest': rest})"},{"attributeType":"null","col":4,"comment":"null","endLoc":1232,"id":2697,"name":"copy","nodeType":"Attribute","startLoc":1232,"text":"copy"},{"col":0,"comment":"null","endLoc":769,"header":"def assert_is_spectral_unit(value)","id":2698,"name":"assert_is_spectral_unit","nodeType":"Function","startLoc":764,"text":"def assert_is_spectral_unit(value):\n    try:\n        value.to(si.Hz, spectral())\n    except (AttributeError, UnitsError) as ex:\n        raise UnitsError(\"The 'rest' value must be a spectral equivalent \"\n                         \"(frequency, wavelength, or energy).\")"},{"col":0,"comment":"\n    Returns a list of equivalence pairs that handle spectral\n    wavelength, wave number, frequency, and energy equivalencies.\n\n    Allows conversions between wavelength units, wave number units,\n    frequency units, and energy units as they relate to light.\n\n    There are two types of wave number:\n\n        * spectroscopic - :math:`1 / \\lambda` (per meter)\n        * angular - :math:`2 \\pi / \\lambda` (radian per meter)\n\n    ","endLoc":138,"header":"def spectral()","id":2699,"name":"spectral","nodeType":"Function","startLoc":106,"text":"def spectral():\n    \"\"\"\n    Returns a list of equivalence pairs that handle spectral\n    wavelength, wave number, frequency, and energy equivalencies.\n\n    Allows conversions between wavelength units, wave number units,\n    frequency units, and energy units as they relate to light.\n\n    There are two types of wave number:\n\n        * spectroscopic - :math:`1 / \\\\lambda` (per meter)\n        * angular - :math:`2 \\\\pi / \\\\lambda` (radian per meter)\n\n    \"\"\"\n    hc = _si.h.value * _si.c.value\n    two_pi = 2.0 * np.pi\n    inv_m_spec = si.m ** -1\n    inv_m_ang = si.radian / si.m\n\n    return Equivalency([\n        (si.m, si.Hz, lambda x: _si.c.value / x),\n        (si.m, si.J, lambda x: hc / x),\n        (si.Hz, si.J, lambda x: _si.h.value * x, lambda x: x / _si.h.value),\n        (si.m, inv_m_spec, lambda x: 1.0 / x),\n        (si.Hz, inv_m_spec, lambda x: x / _si.c.value,\n         lambda x: _si.c.value * x),\n        (si.J, inv_m_spec, lambda x: x / hc, lambda x: hc * x),\n        (inv_m_spec, inv_m_ang, lambda x: x * two_pi, lambda x: x / two_pi),\n        (si.m, inv_m_ang, lambda x: two_pi / x),\n        (si.Hz, inv_m_ang, lambda x: two_pi * x / _si.c.value,\n         lambda x: _si.c.value * x / two_pi),\n        (si.J, inv_m_ang, lambda x: x * two_pi / hc, lambda x: hc * x / two_pi)\n    ], \"spectral\")"},{"col":22,"endLoc":126,"id":2700,"nodeType":"Lambda","startLoc":126,"text":"lambda x: _si.c.value / x"},{"col":21,"endLoc":127,"id":2701,"nodeType":"Lambda","startLoc":127,"text":"lambda x: hc / x"},{"col":22,"endLoc":128,"id":2702,"nodeType":"Lambda","startLoc":128,"text":"lambda x: _si.h.value * x"},{"col":49,"endLoc":128,"id":2703,"nodeType":"Lambda","startLoc":128,"text":"lambda x: x / _si.h.value"},{"col":27,"endLoc":129,"id":2704,"nodeType":"Lambda","startLoc":129,"text":"lambda x: 1.0 / x"},{"col":28,"endLoc":130,"id":2705,"nodeType":"Lambda","startLoc":130,"text":"lambda x: x / _si.c.value"},{"col":9,"endLoc":131,"id":2706,"nodeType":"Lambda","startLoc":131,"text":"lambda x: _si.c.value * x"},{"col":27,"endLoc":132,"id":2707,"nodeType":"Lambda","startLoc":132,"text":"lambda x: x / hc"},{"col":45,"endLoc":132,"id":2708,"nodeType":"Lambda","startLoc":132,"text":"lambda x: hc * x"},{"col":32,"endLoc":133,"id":2709,"nodeType":"Lambda","startLoc":133,"text":"lambda x: x * two_pi"},{"col":54,"endLoc":133,"id":2710,"nodeType":"Lambda","startLoc":133,"text":"lambda x: x / two_pi"},{"col":26,"endLoc":134,"id":2711,"nodeType":"Lambda","startLoc":134,"text":"lambda x: two_pi / x"},{"col":27,"endLoc":135,"id":2712,"nodeType":"Lambda","startLoc":135,"text":"lambda x: two_pi * x / _si.c.value"},{"col":9,"endLoc":136,"id":2713,"nodeType":"Lambda","startLoc":136,"text":"lambda x: _si.c.value * x / two_pi"},{"col":26,"endLoc":137,"id":2714,"nodeType":"Lambda","startLoc":137,"text":"lambda x: x * two_pi / hc"},{"col":53,"endLoc":137,"id":2715,"nodeType":"Lambda","startLoc":137,"text":"lambda x: hc * x / two_pi"},{"col":0,"comment":"\n    Prints a message if any HDU in `filename` has a bad checksum or datasum.\n    ","endLoc":166,"header":"def verify_checksums(filename)","id":2716,"name":"verify_checksums","nodeType":"Function","startLoc":139,"text":"def verify_checksums(filename):\n    \"\"\"\n    Prints a message if any HDU in `filename` has a bad checksum or datasum.\n    \"\"\"\n    with warnings.catch_warnings(record=True) as wlist:\n        warnings.simplefilter('always')\n        with fits.open(filename, checksum=OPTIONS.checksum_kind) as hdulist:\n            for i, hdu in enumerate(hdulist):\n                # looping on HDUs is needed to read them and verify the\n                # checksums\n                if not OPTIONS.ignore_missing:\n                    if not hdu._checksum:\n                        log.warning('MISSING {!r} .. Checksum not found '\n                                    'in HDU #{}'.format(filename, i))\n                        return 1\n                    if not hdu._datasum:\n                        log.warning('MISSING {!r} .. Datasum not found '\n                                    'in HDU #{}'.format(filename, i))\n                        return 1\n\n    for w in wlist:\n        if str(w.message).startswith(('Checksum verification failed',\n                                      'Datasum verification failed')):\n            log.warning('BAD %r %s', filename, str(w.message))\n            return 1\n\n    log.info(f'OK {filename!r}')\n    return 0"},{"attributeType":"null","col":4,"comment":"null","endLoc":1233,"id":2717,"name":"more","nodeType":"Attribute","startLoc":1233,"text":"more"},{"attributeType":"null","col":4,"comment":"null","endLoc":1234,"id":2718,"name":"pprint","nodeType":"Attribute","startLoc":1234,"text":"pprint"},{"attributeType":"null","col":4,"comment":"null","endLoc":586,"id":2719,"name":"meta","nodeType":"Attribute","startLoc":586,"text":"meta"},{"attributeType":"null","col":4,"comment":"null","endLoc":1235,"id":2720,"name":"pformat","nodeType":"Attribute","startLoc":1235,"text":"pformat"},{"fileName":"fitsheader.py","filePath":"astropy/io/fits/scripts","id":2721,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\n``fitsheader`` is a command line script based on astropy.io.fits for printing\nthe header(s) of one or more FITS file(s) to the standard output in a human-\nreadable format.\n\nExample uses of fitsheader:\n\n1. Print the header of all the HDUs of a .fits file::\n\n    $ fitsheader filename.fits\n\n2. Print the header of the third and fifth HDU extension::\n\n    $ fitsheader --extension 3 --extension 5 filename.fits\n\n3. Print the header of a named extension, e.g. select the HDU containing\n   keywords EXTNAME='SCI' and EXTVER='2'::\n\n    $ fitsheader --extension \"SCI,2\" filename.fits\n\n4. Print only specific keywords::\n\n    $ fitsheader --keyword BITPIX --keyword NAXIS filename.fits\n\n5. Print keywords NAXIS, NAXIS1, NAXIS2, etc using a wildcard::\n\n    $ fitsheader --keyword NAXIS* filename.fits\n\n6. Dump the header keywords of all the files in the current directory into a\n   machine-readable csv file::\n\n    $ fitsheader --table ascii.csv *.fits > keywords.csv\n\n7. Specify hierarchical keywords with the dotted or spaced notation::\n\n    $ fitsheader --keyword ESO.INS.ID filename.fits\n    $ fitsheader --keyword \"ESO INS ID\" filename.fits\n\n8. Compare the headers of different fites files, following ESO's ``fitsort``\n   format::\n\n    $ fitsheader --fitsort --extension 0 --keyword ESO.INS.ID *.fits\n\n9. Same as above, sorting the output along a specified keyword::\n\n    $ fitsheader -f DATE-OBS -e 0 -k DATE-OBS -k ESO.INS.ID *.fits\n\nNote that compressed images (HDUs of type\n:class:`~astropy.io.fits.CompImageHDU`) really have two headers: a real\nBINTABLE header to describe the compressed data, and a fake IMAGE header\nrepresenting the image that was compressed. Astropy returns the latter by\ndefault. You must supply the ``--compressed`` option if you require the real\nheader that describes the compression.\n\nWith Astropy installed, please run ``fitsheader --help`` to see the full usage\ndocumentation.\n\"\"\"\n\nimport sys\nimport argparse\n\nimport numpy as np\n\nfrom astropy.io import fits\nfrom astropy import log, __version__\n\n\nDESCRIPTION = \"\"\"\nPrint the header(s) of a FITS file. Optional arguments allow the desired\nextension(s), keyword(s), and output format to be specified.\nNote that in the case of a compressed image, the decompressed header is\nshown by default.\n\nThis script is part of the Astropy package. See\nhttps://docs.astropy.org/en/latest/io/fits/usage/scripts.html#module-astropy.io.fits.scripts.fitsheader\nfor further documentation.\n\"\"\".strip()\n\n\nclass ExtensionNotFoundException(Exception):\n    \"\"\"Raised if an HDU extension requested by the user does not exist.\"\"\"\n    pass\n\n\nclass HeaderFormatter:\n    \"\"\"Class to format the header(s) of a FITS file for display by the\n    `fitsheader` tool; essentially a wrapper around a `HDUList` object.\n\n    Example usage:\n    fmt = HeaderFormatter('/path/to/file.fits')\n    print(fmt.parse(extensions=[0, 3], keywords=['NAXIS', 'BITPIX']))\n\n    Parameters\n    ----------\n    filename : str\n        Path to a single FITS file.\n    verbose : bool\n        Verbose flag, to show more information about missing extensions,\n        keywords, etc.\n\n    Raises\n    ------\n    OSError\n        If `filename` does not exist or cannot be read.\n    \"\"\"\n\n    def __init__(self, filename, verbose=True):\n        self.filename = filename\n        self.verbose = verbose\n        self._hdulist = fits.open(filename)\n\n    def parse(self, extensions=None, keywords=None, compressed=False):\n        \"\"\"Returns the FITS file header(s) in a readable format.\n\n        Parameters\n        ----------\n        extensions : list of int or str, optional\n            Format only specific HDU(s), identified by number or name.\n            The name can be composed of the \"EXTNAME\" or \"EXTNAME,EXTVER\"\n            keywords.\n\n        keywords : list of str, optional\n            Keywords for which the value(s) should be returned.\n            If not specified, then the entire header is returned.\n\n        compressed : bool, optional\n            If True, shows the header describing the compression, rather than\n            the header obtained after decompression. (Affects FITS files\n            containing `CompImageHDU` extensions only.)\n\n        Returns\n        -------\n        formatted_header : str or astropy.table.Table\n            Traditional 80-char wide format in the case of `HeaderFormatter`;\n            an Astropy Table object in the case of `TableHeaderFormatter`.\n        \"\"\"\n        # `hdukeys` will hold the keys of the HDUList items to display\n        if extensions is None:\n            hdukeys = range(len(self._hdulist))  # Display all by default\n        else:\n            hdukeys = []\n            for ext in extensions:\n                try:\n                    # HDU may be specified by number\n                    hdukeys.append(int(ext))\n                except ValueError:\n                    # The user can specify \"EXTNAME\" or \"EXTNAME,EXTVER\"\n                    parts = ext.split(',')\n                    if len(parts) > 1:\n                        extname = ','.join(parts[0:-1])\n                        extver = int(parts[-1])\n                        hdukeys.append((extname, extver))\n                    else:\n                        hdukeys.append(ext)\n\n        # Having established which HDUs the user wants, we now format these:\n        return self._parse_internal(hdukeys, keywords, compressed)\n\n    def _parse_internal(self, hdukeys, keywords, compressed):\n        \"\"\"The meat of the formatting; in a separate method to allow overriding.\n        \"\"\"\n        result = []\n        for idx, hdu in enumerate(hdukeys):\n            try:\n                cards = self._get_cards(hdu, keywords, compressed)\n            except ExtensionNotFoundException:\n                continue\n\n            if idx > 0:  # Separate HDUs by a blank line\n                result.append('\\n')\n            result.append(f'# HDU {hdu} in {self.filename}:\\n')\n            for c in cards:\n                result.append(f'{c}\\n')\n        return ''.join(result)\n\n    def _get_cards(self, hdukey, keywords, compressed):\n        \"\"\"Returns a list of `astropy.io.fits.card.Card` objects.\n\n        This function will return the desired header cards, taking into\n        account the user's preference to see the compressed or uncompressed\n        version.\n\n        Parameters\n        ----------\n        hdukey : int or str\n            Key of a single HDU in the HDUList.\n\n        keywords : list of str, optional\n            Keywords for which the cards should be returned.\n\n        compressed : bool, optional\n            If True, shows the header describing the compression.\n\n        Raises\n        ------\n        ExtensionNotFoundException\n            If the hdukey does not correspond to an extension.\n        \"\"\"\n        # First we obtain the desired header\n        try:\n            if compressed:\n                # In the case of a compressed image, return the header before\n                # decompression (not the default behavior)\n                header = self._hdulist[hdukey]._header\n            else:\n                header = self._hdulist[hdukey].header\n        except (IndexError, KeyError):\n            message = f'{self.filename}: Extension {hdukey} not found.'\n            if self.verbose:\n                log.warning(message)\n            raise ExtensionNotFoundException(message)\n\n        if not keywords:  # return all cards\n            cards = header.cards\n        else:  # specific keywords are requested\n            cards = []\n            for kw in keywords:\n                try:\n                    crd = header.cards[kw]\n                    if isinstance(crd, fits.card.Card):  # Single card\n                        cards.append(crd)\n                    else:  # Allow for wildcard access\n                        cards.extend(crd)\n                except KeyError:  # Keyword does not exist\n                    if self.verbose:\n                        log.warning('{filename} (HDU {hdukey}): '\n                                    'Keyword {kw} not found.'.format(\n                                        filename=self.filename,\n                                        hdukey=hdukey,\n                                        kw=kw))\n        return cards\n\n    def close(self):\n        self._hdulist.close()\n\n\nclass TableHeaderFormatter(HeaderFormatter):\n    \"\"\"Class to convert the header(s) of a FITS file into a Table object.\n    The table returned by the `parse` method will contain four columns:\n    filename, hdu, keyword, and value.\n\n    Subclassed from HeaderFormatter, which contains the meat of the formatting.\n    \"\"\"\n\n    def _parse_internal(self, hdukeys, keywords, compressed):\n        \"\"\"Method called by the parse method in the parent class.\"\"\"\n        tablerows = []\n        for hdu in hdukeys:\n            try:\n                for card in self._get_cards(hdu, keywords, compressed):\n                    tablerows.append({'filename': self.filename,\n                                      'hdu': hdu,\n                                      'keyword': card.keyword,\n                                      'value': str(card.value)})\n            except ExtensionNotFoundException:\n                pass\n\n        if tablerows:\n            from astropy import table\n            return table.Table(tablerows)\n        return None\n\n\ndef print_headers_traditional(args):\n    \"\"\"Prints FITS header(s) using the traditional 80-char format.\n\n    Parameters\n    ----------\n    args : argparse.Namespace\n        Arguments passed from the command-line as defined below.\n    \"\"\"\n    for idx, filename in enumerate(args.filename):  # support wildcards\n        if idx > 0 and not args.keywords:\n            print()  # print a newline between different files\n\n        formatter = None\n        try:\n            formatter = HeaderFormatter(filename)\n            print(formatter.parse(args.extensions,\n                                  args.keywords,\n                                  args.compressed), end='')\n        except OSError as e:\n            log.error(str(e))\n        finally:\n            if formatter:\n                formatter.close()\n\n\ndef print_headers_as_table(args):\n    \"\"\"Prints FITS header(s) in a machine-readable table format.\n\n    Parameters\n    ----------\n    args : argparse.Namespace\n        Arguments passed from the command-line as defined below.\n    \"\"\"\n    tables = []\n    # Create a Table object for each file\n    for filename in args.filename:  # Support wildcards\n        formatter = None\n        try:\n            formatter = TableHeaderFormatter(filename)\n            tbl = formatter.parse(args.extensions,\n                                  args.keywords,\n                                  args.compressed)\n            if tbl:\n                tables.append(tbl)\n        except OSError as e:\n            log.error(str(e))  # file not found or unreadable\n        finally:\n            if formatter:\n                formatter.close()\n\n    # Concatenate the tables\n    if len(tables) == 0:\n        return False\n    elif len(tables) == 1:\n        resulting_table = tables[0]\n    else:\n        from astropy import table\n        resulting_table = table.vstack(tables)\n    # Print the string representation of the concatenated table\n    resulting_table.write(sys.stdout, format=args.table)\n\n\ndef print_headers_as_comparison(args):\n    \"\"\"Prints FITS header(s) with keywords as columns.\n\n    This follows the dfits+fitsort format.\n\n    Parameters\n    ----------\n    args : argparse.Namespace\n        Arguments passed from the command-line as defined below.\n    \"\"\"\n    from astropy import table\n    tables = []\n    # Create a Table object for each file\n    for filename in args.filename:  # Support wildcards\n        formatter = None\n        try:\n            formatter = TableHeaderFormatter(filename, verbose=False)\n            tbl = formatter.parse(args.extensions,\n                                  args.keywords,\n                                  args.compressed)\n            if tbl:\n                # Remove empty keywords\n                tbl = tbl[np.where(tbl['keyword'] != '')]\n            else:\n                tbl = table.Table([[filename]], names=('filename',))\n            tables.append(tbl)\n        except OSError as e:\n            log.error(str(e))  # file not found or unreadable\n        finally:\n            if formatter:\n                formatter.close()\n\n    # Concatenate the tables\n    if len(tables) == 0:\n        return False\n    elif len(tables) == 1:\n        resulting_table = tables[0]\n    else:\n        resulting_table = table.vstack(tables)\n\n    # If we obtained more than one hdu, merge hdu and keywords columns\n    hdus = resulting_table['hdu']\n    if np.ma.isMaskedArray(hdus):\n        hdus = hdus.compressed()\n    if len(np.unique(hdus)) > 1:\n        for tab in tables:\n            new_column = table.Column(\n                [f\"{row['hdu']}:{row['keyword']}\" for row in tab])\n            tab.add_column(new_column, name='hdu+keyword')\n        keyword_column_name = 'hdu+keyword'\n    else:\n        keyword_column_name = 'keyword'\n\n    # Check how many hdus we are processing\n    final_tables = []\n    for tab in tables:\n        final_table = [table.Column([tab['filename'][0]], name='filename')]\n        if 'value' in tab.colnames:\n            for row in tab:\n                if row['keyword'] in ('COMMENT', 'HISTORY'):\n                    continue\n                final_table.append(table.Column([row['value']],\n                                                name=row[keyword_column_name]))\n        final_tables.append(table.Table(final_table))\n    final_table = table.vstack(final_tables)\n    # Sort if requested\n    if args.fitsort is not True:  # then it must be a keyword, therefore sort\n        final_table.sort(args.fitsort)\n    # Reorganise to keyword by columns\n    final_table.pprint(max_lines=-1, max_width=-1)\n\n\nclass KeywordAppendAction(argparse.Action):\n    def __call__(self, parser, namespace, values, option_string=None):\n        keyword = values.replace('.', ' ')\n        if namespace.keywords is None:\n            namespace.keywords = []\n        if keyword not in namespace.keywords:\n            namespace.keywords.append(keyword)\n\n\ndef main(args=None):\n    \"\"\"This is the main function called by the `fitsheader` script.\"\"\"\n\n    parser = argparse.ArgumentParser(\n        description=DESCRIPTION,\n        formatter_class=argparse.RawDescriptionHelpFormatter)\n\n    parser.add_argument(\n        '--version', action='version',\n        version=f'%(prog)s {__version__}')\n\n    parser.add_argument('-e', '--extension', metavar='HDU',\n                        action='append', dest='extensions',\n                        help='specify the extension by name or number; '\n                             'this argument can be repeated '\n                             'to select multiple extensions')\n    parser.add_argument('-k', '--keyword', metavar='KEYWORD',\n                        action=KeywordAppendAction, dest='keywords',\n                        help='specify a keyword; this argument can be '\n                             'repeated to select multiple keywords; '\n                             'also supports wildcards')\n    parser.add_argument('-t', '--table',\n                        nargs='?', default=False, metavar='FORMAT',\n                        help='print the header(s) in machine-readable table '\n                             'format; the default format is '\n                             '\"ascii.fixed_width\" (can be \"ascii.csv\", '\n                             '\"ascii.html\", \"ascii.latex\", \"fits\", etc)')\n    parser.add_argument('-f', '--fitsort', action='store_true',\n                        help='print the headers as a table with each unique '\n                             'keyword in a given column (fitsort format); '\n                             'if a SORT_KEYWORD is specified, the result will be '\n                             'sorted along that keyword')\n    parser.add_argument('-c', '--compressed', action='store_true',\n                        help='for compressed image data, '\n                             'show the true header which describes '\n                             'the compression rather than the data')\n    parser.add_argument('filename', nargs='+',\n                        help='path to one or more files; '\n                             'wildcards are supported')\n    args = parser.parse_args(args)\n\n    # If `--table` was used but no format specified,\n    # then use ascii.fixed_width by default\n    if args.table is None:\n        args.table = 'ascii.fixed_width'\n\n    # Now print the desired headers\n    try:\n        if args.table:\n            print_headers_as_table(args)\n        elif args.fitsort:\n            print_headers_as_comparison(args)\n        else:\n            print_headers_traditional(args)\n    except OSError:\n        # A 'Broken pipe' OSError may occur when stdout is closed prematurely,\n        # eg. when calling `fitsheader file.fits | head`. We let this pass.\n        pass\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":1236,"id":2722,"name":"convert_unit_to","nodeType":"Attribute","startLoc":1236,"text":"convert_unit_to"},{"attributeType":"null","col":4,"comment":"null","endLoc":1237,"id":2723,"name":"quantity","nodeType":"Attribute","startLoc":1237,"text":"quantity"},{"attributeType":"null","col":4,"comment":"null","endLoc":590,"id":2724,"name":"Row","nodeType":"Attribute","startLoc":590,"text":"Row"},{"attributeType":"null","col":4,"comment":"null","endLoc":591,"id":2725,"name":"Column","nodeType":"Attribute","startLoc":591,"text":"Column"},{"attributeType":"null","col":4,"comment":"null","endLoc":1238,"id":2726,"name":"to","nodeType":"Attribute","startLoc":1238,"text":"to"},{"attributeType":"null","col":4,"comment":"null","endLoc":592,"id":2727,"name":"MaskedColumn","nodeType":"Attribute","startLoc":592,"text":"MaskedColumn"},{"attributeType":"null","col":4,"comment":"null","endLoc":593,"id":2728,"name":"TableColumns","nodeType":"Attribute","startLoc":593,"text":"TableColumns"},{"attributeType":"null","col":4,"comment":"null","endLoc":594,"id":2729,"name":"TableFormatter","nodeType":"Attribute","startLoc":594,"text":"TableFormatter"},{"attributeType":"null","col":4,"comment":"null","endLoc":597,"id":2730,"name":"read","nodeType":"Attribute","startLoc":597,"text":"read"},{"attributeType":"null","col":8,"comment":"null","endLoc":1076,"id":2731,"name":"self","nodeType":"Attribute","startLoc":1076,"text":"self"},{"attributeType":"null","col":4,"comment":"null","endLoc":598,"id":2732,"name":"write","nodeType":"Attribute","startLoc":598,"text":"write"},{"attributeType":"null","col":4,"comment":"null","endLoc":600,"id":2733,"name":"pprint_exclude_names","nodeType":"Attribute","startLoc":600,"text":"pprint_exclude_names"},{"className":"MaskedColumn","col":0,"comment":"Define a masked data column for use in a Table object.\n\n    Parameters\n    ----------\n    data : list, ndarray, or None\n        Column data values\n    name : str\n        Column name and key for reference within Table\n    mask : list, ndarray or None\n        Boolean mask for which True indicates missing or invalid data\n    fill_value : float, int, str, or None\n        Value used when filling masked column elements\n    dtype : `~numpy.dtype`-like\n        Data type for column\n    shape : tuple or ()\n        Dimensions of a single row element in the column data\n    length : int or 0\n        Number of row elements in column data\n    description : str or None\n        Full description of column\n    unit : str or None\n        Physical unit\n    format : str, None, or callable\n        Format string for outputting column values.  This can be an\n        \"old-style\" (``format % value``) or \"new-style\" (`str.format`)\n        format specification string or a function or any callable object that\n        accepts a single value and returns a string.\n    meta : dict-like or None\n        Meta-data associated with the column\n\n    Examples\n    --------\n    A MaskedColumn is similar to a Column except that it includes ``mask`` and\n    ``fill_value`` attributes.  It can be created in two different ways:\n\n    - Provide a ``data`` value but not ``shape`` or ``length`` (which are\n      inferred from the data).\n\n      Examples::\n\n        col = MaskedColumn(data=[1, 2], name='name')\n        col = MaskedColumn(data=[1, 2], name='name', mask=[True, False])\n        col = MaskedColumn(data=[1, 2], name='name', dtype=float, fill_value=99)\n\n      The ``mask`` argument will be cast as a boolean array and specifies\n      which elements are considered to be missing or invalid.\n\n      The ``dtype`` argument can be any value which is an acceptable\n      fixed-size data-type initializer for the numpy.dtype() method.  See\n      `<https://numpy.org/doc/stable/reference/arrays.dtypes.html>`_.\n      Examples include:\n\n      - Python non-string type (float, int, bool)\n      - Numpy non-string type (e.g. np.float32, np.int64, np.bool\\_)\n      - Numpy.dtype array-protocol type strings (e.g. 'i4', 'f8', 'S15')\n\n      If no ``dtype`` value is provide then the type is inferred using\n      ``np.array(data)``.  When ``data`` is provided then the ``shape``\n      and ``length`` arguments are ignored.\n\n    - Provide ``length`` and optionally ``shape``, but not ``data``\n\n      Examples::\n\n        col = MaskedColumn(name='name', length=5)\n        col = MaskedColumn(name='name', dtype=int, length=10, shape=(3,4))\n\n      The default ``dtype`` is ``np.float64``.  The ``shape`` argument is the\n      array shape of a single cell in the column.\n    ","endLoc":1605,"id":2734,"nodeType":"Class","startLoc":1308,"text":"class MaskedColumn(Column, _MaskedColumnGetitemShim, ma.MaskedArray):\n    \"\"\"Define a masked data column for use in a Table object.\n\n    Parameters\n    ----------\n    data : list, ndarray, or None\n        Column data values\n    name : str\n        Column name and key for reference within Table\n    mask : list, ndarray or None\n        Boolean mask for which True indicates missing or invalid data\n    fill_value : float, int, str, or None\n        Value used when filling masked column elements\n    dtype : `~numpy.dtype`-like\n        Data type for column\n    shape : tuple or ()\n        Dimensions of a single row element in the column data\n    length : int or 0\n        Number of row elements in column data\n    description : str or None\n        Full description of column\n    unit : str or None\n        Physical unit\n    format : str, None, or callable\n        Format string for outputting column values.  This can be an\n        \"old-style\" (``format % value``) or \"new-style\" (`str.format`)\n        format specification string or a function or any callable object that\n        accepts a single value and returns a string.\n    meta : dict-like or None\n        Meta-data associated with the column\n\n    Examples\n    --------\n    A MaskedColumn is similar to a Column except that it includes ``mask`` and\n    ``fill_value`` attributes.  It can be created in two different ways:\n\n    - Provide a ``data`` value but not ``shape`` or ``length`` (which are\n      inferred from the data).\n\n      Examples::\n\n        col = MaskedColumn(data=[1, 2], name='name')\n        col = MaskedColumn(data=[1, 2], name='name', mask=[True, False])\n        col = MaskedColumn(data=[1, 2], name='name', dtype=float, fill_value=99)\n\n      The ``mask`` argument will be cast as a boolean array and specifies\n      which elements are considered to be missing or invalid.\n\n      The ``dtype`` argument can be any value which is an acceptable\n      fixed-size data-type initializer for the numpy.dtype() method.  See\n      `<https://numpy.org/doc/stable/reference/arrays.dtypes.html>`_.\n      Examples include:\n\n      - Python non-string type (float, int, bool)\n      - Numpy non-string type (e.g. np.float32, np.int64, np.bool\\\\_)\n      - Numpy.dtype array-protocol type strings (e.g. 'i4', 'f8', 'S15')\n\n      If no ``dtype`` value is provide then the type is inferred using\n      ``np.array(data)``.  When ``data`` is provided then the ``shape``\n      and ``length`` arguments are ignored.\n\n    - Provide ``length`` and optionally ``shape``, but not ``data``\n\n      Examples::\n\n        col = MaskedColumn(name='name', length=5)\n        col = MaskedColumn(name='name', dtype=int, length=10, shape=(3,4))\n\n      The default ``dtype`` is ``np.float64``.  The ``shape`` argument is the\n      array shape of a single cell in the column.\n    \"\"\"\n    info = MaskedColumnInfo()\n\n    def __new__(cls, data=None, name=None, mask=None, fill_value=None,\n                dtype=None, shape=(), length=0,\n                description=None, unit=None, format=None, meta=None,\n                copy=False, copy_indices=True):\n\n        if mask is None:\n            # If mask is None then we need to determine the mask (if any) from the data.\n            # The naive method is looking for a mask attribute on data, but this can fail,\n            # see #8816.  Instead use ``MaskedArray`` to do the work.\n            mask = ma.MaskedArray(data).mask\n            if mask is np.ma.nomask:\n                # Handle odd-ball issue with np.ma.nomask (numpy #13758), and see below.\n                mask = False\n            elif copy:\n                mask = mask.copy()\n\n        elif mask is np.ma.nomask:\n            # Force the creation of a full mask array as nomask is tricky to\n            # use and will fail in an unexpected manner when setting a value\n            # to the mask.\n            mask = False\n        else:\n            mask = deepcopy(mask)\n\n        # Create self using MaskedArray as a wrapper class, following the example of\n        # class MSubArray in\n        # https://github.com/numpy/numpy/blob/maintenance/1.8.x/numpy/ma/tests/test_subclassing.py\n        # This pattern makes it so that __array_finalize__ is called as expected (e.g. #1471 and\n        # https://github.com/astropy/astropy/commit/ff6039e8)\n\n        # First just pass through all args and kwargs to BaseColumn, then wrap that object\n        # with MaskedArray.\n        self_data = BaseColumn(data, dtype=dtype, shape=shape, length=length, name=name,\n                               unit=unit, format=format, description=description,\n                               meta=meta, copy=copy, copy_indices=copy_indices)\n        self = ma.MaskedArray.__new__(cls, data=self_data, mask=mask)\n        # The above process preserves info relevant for Column, but this does\n        # not include serialize_method (and possibly other future attributes)\n        # relevant for MaskedColumn, so we set info explicitly.\n        if 'info' in getattr(data, '__dict__', {}):\n            self.info = data.info\n\n        # Note: do not set fill_value in the MaskedArray constructor because this does not\n        # go through the fill_value workarounds.\n        if fill_value is None and getattr(data, 'fill_value', None) is not None:\n            # Coerce the fill_value to the correct type since `data` may be a\n            # different dtype than self.\n            fill_value = np.array(data.fill_value, self.dtype)[()]\n        self.fill_value = fill_value\n\n        self.parent_table = None\n\n        # needs to be done here since self doesn't come from BaseColumn.__new__\n        for index in self.indices:\n            index.replace_col(self_data, self)\n\n        return self\n\n    @property\n    def fill_value(self):\n        return self.get_fill_value()  # defer to native ma.MaskedArray method\n\n    @fill_value.setter\n    def fill_value(self, val):\n        \"\"\"Set fill value both in the masked column view and in the parent table\n        if it exists.  Setting one or the other alone doesn't work.\"\"\"\n\n        # another ma bug workaround: If the value of fill_value for a string array is\n        # requested but not yet set then it gets created as 'N/A'.  From this point onward\n        # any new fill_values are truncated to 3 characters.  Note that this does not\n        # occur if the masked array is a structured array (as in the previous block that\n        # deals with the parent table).\n        #\n        # >>> x = ma.array(['xxxx'])\n        # >>> x.fill_value  # fill_value now gets represented as an 'S3' array\n        # 'N/A'\n        # >>> x.fill_value='yyyy'\n        # >>> x.fill_value\n        # 'yyy'\n        #\n        # To handle this we are forced to reset a private variable first:\n        self._fill_value = None\n\n        self.set_fill_value(val)  # defer to native ma.MaskedArray method\n\n    @property\n    def data(self):\n        \"\"\"The plain MaskedArray data held by this column.\"\"\"\n        out = self.view(np.ma.MaskedArray)\n        # By default, a MaskedArray view will set the _baseclass to be the\n        # same as that of our own class, i.e., BaseColumn.  Since we want\n        # to return a plain MaskedArray, we reset the baseclass accordingly.\n        out._baseclass = np.ndarray\n        return out\n\n    def filled(self, fill_value=None):\n        \"\"\"Return a copy of self, with masked values filled with a given value.\n\n        Parameters\n        ----------\n        fill_value : scalar; optional\n            The value to use for invalid entries (`None` by default).  If\n            `None`, the ``fill_value`` attribute of the array is used\n            instead.\n\n        Returns\n        -------\n        filled_column : Column\n            A copy of ``self`` with masked entries replaced by `fill_value`\n            (be it the function argument or the attribute of ``self``).\n        \"\"\"\n        if fill_value is None:\n            fill_value = self.fill_value\n\n        data = super().filled(fill_value)\n        # Use parent table definition of Column if available\n        column_cls = self.parent_table.Column if (self.parent_table is not None) else Column\n\n        out = column_cls(name=self.name, data=data, unit=self.unit,\n                         format=self.format, description=self.description,\n                         meta=deepcopy(self.meta))\n        return out\n\n    def insert(self, obj, values, mask=None, axis=0):\n        \"\"\"\n        Insert values along the given axis before the given indices and return\n        a new `~astropy.table.MaskedColumn` object.\n\n        Parameters\n        ----------\n        obj : int, slice or sequence of int\n            Object that defines the index or indices before which ``values`` is\n            inserted.\n        values : array-like\n            Value(s) to insert.  If the type of ``values`` is different from\n            that of the column, ``values`` is converted to the matching type.\n            ``values`` should be shaped so that it can be broadcast appropriately.\n        mask : bool or array-like\n            Mask value(s) to insert.  If not supplied, and values does not have\n            a mask either, then False is used.\n        axis : int, optional\n            Axis along which to insert ``values``.  If ``axis`` is None then\n            the column array is flattened before insertion.  Default is 0,\n            which will insert a row.\n\n        Returns\n        -------\n        out : `~astropy.table.MaskedColumn`\n            A copy of column with ``values`` and ``mask`` inserted.  Note that the\n            insertion does not occur in-place: a new masked column is returned.\n        \"\"\"\n        self_ma = self.data  # self viewed as MaskedArray\n\n        if self.dtype.kind == 'O':\n            # Even if values is array-like (e.g. [1,2,3]), insert as a single\n            # object.  Numpy.insert instead inserts each element in an array-like\n            # input individually.\n            new_data = np.insert(self_ma.data, obj, None, axis=axis)\n            new_data[obj] = values\n        else:\n            self_ma = _expand_string_array_for_values(self_ma, values)\n            new_data = np.insert(self_ma.data, obj, values, axis=axis)\n\n        if mask is None:\n            mask = getattr(values, 'mask', np.ma.nomask)\n            if mask is np.ma.nomask:\n                if self.dtype.kind == 'O':\n                    mask = False\n                else:\n                    mask = np.zeros(np.shape(values), dtype=bool)\n\n        new_mask = np.insert(self_ma.mask, obj, mask, axis=axis)\n        new_ma = np.ma.array(new_data, mask=new_mask, copy=False)\n\n        out = new_ma.view(self.__class__)\n        out.parent_table = None\n        out.indices = []\n        out._copy_attrs(self)\n        out.fill_value = self.fill_value\n\n        return out\n\n    def _copy_attrs_slice(self, out):\n        # Fixes issue #3023: when calling getitem with a MaskedArray subclass\n        # the original object attributes are not copied.\n        if out.__class__ is self.__class__:\n            # TODO: this part is essentially the same as what is done in\n            # __array_finalize__ and could probably be called directly in our\n            # override of __getitem__ in _columns_mixins.pyx). Refactor?\n            if 'info' in self.__dict__:\n                out.info = self.info\n            out.parent_table = None\n            # we need this because __getitem__ does a shallow copy of indices\n            if out.indices is self.indices:\n                out.indices = []\n            out._copy_attrs(self)\n        return out\n\n    def __setitem__(self, index, value):\n        # Issue warning for string assignment that truncates ``value``\n        if self.dtype.char == 'S':\n            value = self._encode_str(value)\n\n        if issubclass(self.dtype.type, np.character):\n            # Account for a bug in np.ma.MaskedArray setitem.\n            # https://github.com/numpy/numpy/issues/8624\n            value = np.ma.asanyarray(value, dtype=self.dtype.type)\n\n            # Check for string truncation after filling masked items with\n            # empty (zero-length) string.  Note that filled() does not make\n            # a copy if there are no masked items.\n            self._check_string_truncate(value.filled(''))\n\n        # update indices\n        self.info.adjust_indices(index, value, len(self))\n\n        ma.MaskedArray.__setitem__(self, index, value)\n\n    # We do this to make the methods show up in the API docs\n    name = BaseColumn.name\n    copy = BaseColumn.copy\n    more = BaseColumn.more\n    pprint = BaseColumn.pprint\n    pformat = BaseColumn.pformat\n    convert_unit_to = BaseColumn.convert_unit_to"},{"col":4,"comment":"null","endLoc":208,"header":"def append(self, card=None, useblanks=True, bottom=False, end=False)","id":2735,"name":"append","nodeType":"Function","startLoc":174,"text":"def append(self, card=None, useblanks=True, bottom=False, end=False):\n        # This logic unfortunately needs to be duplicated from the base class\n        # in order to determine the keyword\n        if isinstance(card, str):\n            card = Card(card)\n        elif isinstance(card, tuple):\n            card = Card(*card)\n        elif card is None:\n            card = Card()\n        elif not isinstance(card, Card):\n            raise ValueError(\n                'The value appended to a Header must be either a keyword or '\n                '(keyword, value, [comment]) tuple; got: {!r}'.format(card))\n\n        if self._is_reserved_keyword(card.keyword):\n            return\n\n        super().append(card=card, useblanks=useblanks, bottom=bottom, end=end)\n\n        remapped_keyword = self._remap_keyword(card.keyword)\n\n        # card.keyword strips the HIERARCH if present so this must be added\n        # back to avoid a warning.\n        if str(card).startswith(\"HIERARCH \") and not remapped_keyword.startswith(\"HIERARCH \"):\n            remapped_keyword = \"HIERARCH \" + remapped_keyword\n\n        card = Card(remapped_keyword, card.value, card.comment)\n\n        # Here we disable the use of blank cards, because the call above to\n        # Header.append may have already deleted a blank card in the table\n        # header, thanks to inheritance: Header.append calls 'del self[-1]'\n        # to delete a blank card, which calls CompImageHeader.__deltitem__,\n        # which deletes the blank card both in the image and the table headers!\n        self._table_header.append(card=card, useblanks=False,\n                                  bottom=bottom, end=end)"},{"col":4,"comment":"null","endLoc":1441,"header":"@property\n    def fill_value(self)","id":2736,"name":"fill_value","nodeType":"Function","startLoc":1439,"text":"@property\n    def fill_value(self):\n        return self.get_fill_value()  # defer to native ma.MaskedArray method"},{"attributeType":"null","col":4,"comment":"null","endLoc":601,"id":2737,"name":"pprint_include_names","nodeType":"Attribute","startLoc":601,"text":"pprint_include_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":3905,"id":2738,"name":"info","nodeType":"Attribute","startLoc":3905,"text":"info"},{"col":4,"comment":"Set fill value both in the masked column view and in the parent table\n        if it exists.  Setting one or the other alone doesn't work.","endLoc":1464,"header":"@fill_value.setter\n    def fill_value(self, val)","id":2739,"name":"fill_value","nodeType":"Function","startLoc":1443,"text":"@fill_value.setter\n    def fill_value(self, val):\n        \"\"\"Set fill value both in the masked column view and in the parent table\n        if it exists.  Setting one or the other alone doesn't work.\"\"\"\n\n        # another ma bug workaround: If the value of fill_value for a string array is\n        # requested but not yet set then it gets created as 'N/A'.  From this point onward\n        # any new fill_values are truncated to 3 characters.  Note that this does not\n        # occur if the masked array is a structured array (as in the previous block that\n        # deals with the parent table).\n        #\n        # >>> x = ma.array(['xxxx'])\n        # >>> x.fill_value  # fill_value now gets represented as an 'S3' array\n        # 'N/A'\n        # >>> x.fill_value='yyyy'\n        # >>> x.fill_value\n        # 'yyy'\n        #\n        # To handle this we are forced to reset a private variable first:\n        self._fill_value = None\n\n        self.set_fill_value(val)  # defer to native ma.MaskedArray method"},{"col":4,"comment":"The plain MaskedArray data held by this column.","endLoc":1474,"header":"@property\n    def data(self)","id":2740,"name":"data","nodeType":"Function","startLoc":1466,"text":"@property\n    def data(self):\n        \"\"\"The plain MaskedArray data held by this column.\"\"\"\n        out = self.view(np.ma.MaskedArray)\n        # By default, a MaskedArray view will set the _baseclass to be the\n        # same as that of our own class, i.e., BaseColumn.  Since we want\n        # to return a plain MaskedArray, we reset the baseclass accordingly.\n        out._baseclass = np.ndarray\n        return out"},{"col":0,"comment":"Check for FITS standard compliance.","endLoc":179,"header":"def verify_compliance(filename)","id":2741,"name":"verify_compliance","nodeType":"Function","startLoc":169,"text":"def verify_compliance(filename):\n    \"\"\"Check for FITS standard compliance.\"\"\"\n\n    with fits.open(filename) as hdulist:\n        try:\n            hdulist.verify('exception')\n        except fits.VerifyError as exc:\n            log.warning('NONCOMPLIANT %r .. %s',\n                        filename, str(exc).replace('\\n', ' '))\n            return 1\n    return 0"},{"attributeType":"null","col":8,"comment":"null","endLoc":667,"id":2742,"name":"formatter","nodeType":"Attribute","startLoc":667,"text":"self.formatter"},{"attributeType":"null","col":8,"comment":"null","endLoc":2005,"id":2743,"name":"_column_class","nodeType":"Attribute","startLoc":2005,"text":"self._column_class"},{"col":4,"comment":"Return a copy of self, with masked values filled with a given value.\n\n        Parameters\n        ----------\n        fill_value : scalar; optional\n            The value to use for invalid entries (`None` by default).  If\n            `None`, the ``fill_value`` attribute of the array is used\n            instead.\n\n        Returns\n        -------\n        filled_column : Column\n            A copy of ``self`` with masked entries replaced by `fill_value`\n            (be it the function argument or the attribute of ``self``).\n        ","endLoc":1502,"header":"def filled(self, fill_value=None)","id":2744,"name":"filled","nodeType":"Function","startLoc":1476,"text":"def filled(self, fill_value=None):\n        \"\"\"Return a copy of self, with masked values filled with a given value.\n\n        Parameters\n        ----------\n        fill_value : scalar; optional\n            The value to use for invalid entries (`None` by default).  If\n            `None`, the ``fill_value`` attribute of the array is used\n            instead.\n\n        Returns\n        -------\n        filled_column : Column\n            A copy of ``self`` with masked entries replaced by `fill_value`\n            (be it the function argument or the attribute of ``self``).\n        \"\"\"\n        if fill_value is None:\n            fill_value = self.fill_value\n\n        data = super().filled(fill_value)\n        # Use parent table definition of Column if available\n        column_cls = self.parent_table.Column if (self.parent_table is not None) else Column\n\n        out = column_cls(name=self.name, data=data, unit=self.unit,\n                         format=self.format, description=self.description,\n                         meta=deepcopy(self.meta))\n        return out"},{"attributeType":"null","col":12,"comment":"null","endLoc":2049,"id":2745,"name":"_first_colname","nodeType":"Attribute","startLoc":2049,"text":"self._first_colname"},{"attributeType":"null","col":8,"comment":"null","endLoc":666,"id":2746,"name":"columns","nodeType":"Attribute","startLoc":666,"text":"self.columns"},{"attributeType":"null","col":12,"comment":"null","endLoc":840,"id":2747,"name":"meta","nodeType":"Attribute","startLoc":840,"text":"self.meta"},{"attributeType":"null","col":8,"comment":"null","endLoc":668,"id":2748,"name":"_copy_indices","nodeType":"Attribute","startLoc":668,"text":"self._copy_indices"},{"col":4,"comment":"\n        Insert values along the given axis before the given indices and return\n        a new `~astropy.table.MaskedColumn` object.\n\n        Parameters\n        ----------\n        obj : int, slice or sequence of int\n            Object that defines the index or indices before which ``values`` is\n            inserted.\n        values : array-like\n            Value(s) to insert.  If the type of ``values`` is different from\n            that of the column, ``values`` is converted to the matching type.\n            ``values`` should be shaped so that it can be broadcast appropriately.\n        mask : bool or array-like\n            Mask value(s) to insert.  If not supplied, and values does not have\n            a mask either, then False is used.\n        axis : int, optional\n            Axis along which to insert ``values``.  If ``axis`` is None then\n            the column array is flattened before insertion.  Default is 0,\n            which will insert a row.\n\n        Returns\n        -------\n        out : `~astropy.table.MaskedColumn`\n            A copy of column with ``values`` and ``mask`` inserted.  Note that the\n            insertion does not occur in-place: a new masked column is returned.\n        ","endLoc":1561,"header":"def insert(self, obj, values, mask=None, axis=0)","id":2749,"name":"insert","nodeType":"Function","startLoc":1504,"text":"def insert(self, obj, values, mask=None, axis=0):\n        \"\"\"\n        Insert values along the given axis before the given indices and return\n        a new `~astropy.table.MaskedColumn` object.\n\n        Parameters\n        ----------\n        obj : int, slice or sequence of int\n            Object that defines the index or indices before which ``values`` is\n            inserted.\n        values : array-like\n            Value(s) to insert.  If the type of ``values`` is different from\n            that of the column, ``values`` is converted to the matching type.\n            ``values`` should be shaped so that it can be broadcast appropriately.\n        mask : bool or array-like\n            Mask value(s) to insert.  If not supplied, and values does not have\n            a mask either, then False is used.\n        axis : int, optional\n            Axis along which to insert ``values``.  If ``axis`` is None then\n            the column array is flattened before insertion.  Default is 0,\n            which will insert a row.\n\n        Returns\n        -------\n        out : `~astropy.table.MaskedColumn`\n            A copy of column with ``values`` and ``mask`` inserted.  Note that the\n            insertion does not occur in-place: a new masked column is returned.\n        \"\"\"\n        self_ma = self.data  # self viewed as MaskedArray\n\n        if self.dtype.kind == 'O':\n            # Even if values is array-like (e.g. [1,2,3]), insert as a single\n            # object.  Numpy.insert instead inserts each element in an array-like\n            # input individually.\n            new_data = np.insert(self_ma.data, obj, None, axis=axis)\n            new_data[obj] = values\n        else:\n            self_ma = _expand_string_array_for_values(self_ma, values)\n            new_data = np.insert(self_ma.data, obj, values, axis=axis)\n\n        if mask is None:\n            mask = getattr(values, 'mask', np.ma.nomask)\n            if mask is np.ma.nomask:\n                if self.dtype.kind == 'O':\n                    mask = False\n                else:\n                    mask = np.zeros(np.shape(values), dtype=bool)\n\n        new_mask = np.insert(self_ma.mask, obj, mask, axis=axis)\n        new_ma = np.ma.array(new_data, mask=new_mask, copy=False)\n\n        out = new_ma.view(self.__class__)\n        out.parent_table = None\n        out.indices = []\n        out._copy_attrs(self)\n        out.fill_value = self.fill_value\n\n        return out"},{"attributeType":"null","col":12,"comment":"null","endLoc":2001,"id":2750,"name":"_masked","nodeType":"Attribute","startLoc":2001,"text":"self._masked"},{"attributeType":"null","col":12,"comment":"null","endLoc":777,"id":2751,"name":"primary_key","nodeType":"Attribute","startLoc":777,"text":"self.primary_key"},{"attributeType":"null","col":12,"comment":"null","endLoc":3563,"id":2752,"name":"_groups","nodeType":"Attribute","startLoc":3563,"text":"self._groups"},{"col":4,"comment":"null","endLoc":1577,"header":"def _copy_attrs_slice(self, out)","id":2753,"name":"_copy_attrs_slice","nodeType":"Function","startLoc":1563,"text":"def _copy_attrs_slice(self, out):\n        # Fixes issue #3023: when calling getitem with a MaskedArray subclass\n        # the original object attributes are not copied.\n        if out.__class__ is self.__class__:\n            # TODO: this part is essentially the same as what is done in\n            # __array_finalize__ and could probably be called directly in our\n            # override of __getitem__ in _columns_mixins.pyx). Refactor?\n            if 'info' in self.__dict__:\n                out.info = self.info\n            out.parent_table = None\n            # we need this because __getitem__ does a shallow copy of indices\n            if out.indices is self.indices:\n                out.indices = []\n            out._copy_attrs(self)\n        return out"},{"className":"ExtensionNotFoundException","col":0,"comment":"Raised if an HDU extension requested by the user does not exist.","endLoc":83,"id":2754,"nodeType":"Class","startLoc":81,"text":"class ExtensionNotFoundException(Exception):\n    \"\"\"Raised if an HDU extension requested by the user does not exist.\"\"\"\n    pass"},{"attributeType":"null","col":12,"comment":"null","endLoc":778,"id":2755,"name":"_init_indices","nodeType":"Attribute","startLoc":778,"text":"self._init_indices"},{"col":4,"comment":"null","endLoc":1597,"header":"def __setitem__(self, index, value)","id":2756,"name":"__setitem__","nodeType":"Function","startLoc":1579,"text":"def __setitem__(self, index, value):\n        # Issue warning for string assignment that truncates ``value``\n        if self.dtype.char == 'S':\n            value = self._encode_str(value)\n\n        if issubclass(self.dtype.type, np.character):\n            # Account for a bug in np.ma.MaskedArray setitem.\n            # https://github.com/numpy/numpy/issues/8624\n            value = np.ma.asanyarray(value, dtype=self.dtype.type)\n\n            # Check for string truncation after filling masked items with\n            # empty (zero-length) string.  Note that filled() does not make\n            # a copy if there are no masked items.\n            self._check_string_truncate(value.filled(''))\n\n        # update indices\n        self.info.adjust_indices(index, value, len(self))\n\n        ma.MaskedArray.__setitem__(self, index, value)"},{"col":0,"comment":"\n    Sets the ``CHECKSUM`` and ``DATASUM`` keywords for each HDU of `filename`.\n\n    Also updates fixes standards violations if possible and requested.\n    ","endLoc":200,"header":"def update(filename)","id":2757,"name":"update","nodeType":"Function","startLoc":182,"text":"def update(filename):\n    \"\"\"\n    Sets the ``CHECKSUM`` and ``DATASUM`` keywords for each HDU of `filename`.\n\n    Also updates fixes standards violations if possible and requested.\n    \"\"\"\n\n    output_verify = 'silentfix' if OPTIONS.compliance else 'ignore'\n\n    # For unit tests we reset temporarily the warning filters. Indeed, before\n    # updating the checksums, fits.open will verify the existing checksums and\n    # raise warnings, which are later caught and converted to log.warning...\n    # which is an issue when testing, using the \"error\" action to convert\n    # warnings to exceptions.\n    with warnings.catch_warnings():\n        warnings.resetwarnings()\n        with fits.open(filename, do_not_scale_image_data=True,\n                       checksum=OPTIONS.checksum_kind, mode='update') as hdulist:\n            hdulist.flush(output_verify=output_verify)"},{"className":"Time","col":0,"comment":"\n    Represent and manipulate times and dates for astronomy.\n\n    A `Time` object is initialized with one or more times in the ``val``\n    argument.  The input times in ``val`` must conform to the specified\n    ``format`` and must correspond to the specified time ``scale``.  The\n    optional ``val2`` time input should be supplied only for numeric input\n    formats (e.g. JD) where very high precision (better than 64-bit precision)\n    is required.\n\n    The allowed values for ``format`` can be listed with::\n\n      >>> list(Time.FORMATS)\n      ['jd', 'mjd', 'decimalyear', 'unix', 'unix_tai', 'cxcsec', 'gps', 'plot_date',\n       'stardate', 'datetime', 'ymdhms', 'iso', 'isot', 'yday', 'datetime64',\n       'fits', 'byear', 'jyear', 'byear_str', 'jyear_str']\n\n    See also: http://docs.astropy.org/en/stable/time/\n\n    Parameters\n    ----------\n    val : sequence, ndarray, number, str, bytes, or `~astropy.time.Time` object\n        Value(s) to initialize the time or times.  Bytes are decoded as ascii.\n    val2 : sequence, ndarray, or number; optional\n        Value(s) to initialize the time or times.  Only used for numerical\n        input, to help preserve precision.\n    format : str, optional\n        Format of input value(s)\n    scale : str, optional\n        Time scale of input value(s), must be one of the following:\n        ('tai', 'tcb', 'tcg', 'tdb', 'tt', 'ut1', 'utc')\n    precision : int, optional\n        Digits of precision in string representation of time\n    in_subfmt : str, optional\n        Unix glob to select subformats for parsing input times\n    out_subfmt : str, optional\n        Unix glob to select subformat for outputting times\n    location : `~astropy.coordinates.EarthLocation` or tuple, optional\n        If given as an tuple, it should be able to initialize an\n        an EarthLocation instance, i.e., either contain 3 items with units of\n        length for geocentric coordinates, or contain a longitude, latitude,\n        and an optional height for geodetic coordinates.\n        Can be a single location, or one for each input time.\n        If not given, assumed to be the center of the Earth for time scale\n        transformations to and from the solar-system barycenter.\n    copy : bool, optional\n        Make a copy of the input values\n    ","endLoc":2241,"id":2758,"nodeType":"Class","startLoc":1437,"text":"class Time(TimeBase):\n    \"\"\"\n    Represent and manipulate times and dates for astronomy.\n\n    A `Time` object is initialized with one or more times in the ``val``\n    argument.  The input times in ``val`` must conform to the specified\n    ``format`` and must correspond to the specified time ``scale``.  The\n    optional ``val2`` time input should be supplied only for numeric input\n    formats (e.g. JD) where very high precision (better than 64-bit precision)\n    is required.\n\n    The allowed values for ``format`` can be listed with::\n\n      >>> list(Time.FORMATS)\n      ['jd', 'mjd', 'decimalyear', 'unix', 'unix_tai', 'cxcsec', 'gps', 'plot_date',\n       'stardate', 'datetime', 'ymdhms', 'iso', 'isot', 'yday', 'datetime64',\n       'fits', 'byear', 'jyear', 'byear_str', 'jyear_str']\n\n    See also: http://docs.astropy.org/en/stable/time/\n\n    Parameters\n    ----------\n    val : sequence, ndarray, number, str, bytes, or `~astropy.time.Time` object\n        Value(s) to initialize the time or times.  Bytes are decoded as ascii.\n    val2 : sequence, ndarray, or number; optional\n        Value(s) to initialize the time or times.  Only used for numerical\n        input, to help preserve precision.\n    format : str, optional\n        Format of input value(s)\n    scale : str, optional\n        Time scale of input value(s), must be one of the following:\n        ('tai', 'tcb', 'tcg', 'tdb', 'tt', 'ut1', 'utc')\n    precision : int, optional\n        Digits of precision in string representation of time\n    in_subfmt : str, optional\n        Unix glob to select subformats for parsing input times\n    out_subfmt : str, optional\n        Unix glob to select subformat for outputting times\n    location : `~astropy.coordinates.EarthLocation` or tuple, optional\n        If given as an tuple, it should be able to initialize an\n        an EarthLocation instance, i.e., either contain 3 items with units of\n        length for geocentric coordinates, or contain a longitude, latitude,\n        and an optional height for geodetic coordinates.\n        Can be a single location, or one for each input time.\n        If not given, assumed to be the center of the Earth for time scale\n        transformations to and from the solar-system barycenter.\n    copy : bool, optional\n        Make a copy of the input values\n    \"\"\"\n    SCALES = TIME_SCALES\n    \"\"\"List of time scales\"\"\"\n\n    FORMATS = TIME_FORMATS\n    \"\"\"Dict of time formats\"\"\"\n\n    def __new__(cls, val, val2=None, format=None, scale=None,\n                precision=None, in_subfmt=None, out_subfmt=None,\n                location=None, copy=False):\n\n        if isinstance(val, Time):\n            self = val.replicate(format=format, copy=copy, cls=cls)\n        else:\n            self = super().__new__(cls)\n\n        return self\n\n    def __init__(self, val, val2=None, format=None, scale=None,\n                 precision=None, in_subfmt=None, out_subfmt=None,\n                 location=None, copy=False):\n\n        if location is not None:\n            from astropy.coordinates import EarthLocation\n            if isinstance(location, EarthLocation):\n                self.location = location\n            else:\n                self.location = EarthLocation(*location)\n            if self.location.size == 1:\n                self.location = self.location.squeeze()\n        else:\n            if not hasattr(self, 'location'):\n                self.location = None\n\n        if isinstance(val, Time):\n            # Update _time formatting parameters if explicitly specified\n            if precision is not None:\n                self._time.precision = precision\n            if in_subfmt is not None:\n                self._time.in_subfmt = in_subfmt\n            if out_subfmt is not None:\n                self._time.out_subfmt = out_subfmt\n            self.SCALES = TIME_TYPES[self.scale]\n            if scale is not None:\n                self._set_scale(scale)\n        else:\n            self._init_from_vals(val, val2, format, scale, copy,\n                                 precision, in_subfmt, out_subfmt)\n            self.SCALES = TIME_TYPES[self.scale]\n\n        if self.location is not None and (self.location.size > 1\n                                          and self.location.shape != self.shape):\n            try:\n                # check the location can be broadcast to self's shape.\n                self.location = np.broadcast_to(self.location, self.shape,\n                                                subok=True)\n            except Exception as err:\n                raise ValueError('The location with shape {} cannot be '\n                                 'broadcast against time with shape {}. '\n                                 'Typically, either give a single location or '\n                                 'one for each time.'\n                                 .format(self.location.shape, self.shape)) from err\n\n    def _make_value_equivalent(self, item, value):\n        \"\"\"Coerce setitem value into an equivalent Time object\"\"\"\n\n        # If there is a vector location then broadcast to the Time shape\n        # and then select with ``item``\n        if self.location is not None and self.location.shape:\n            self_location = np.broadcast_to(self.location, self.shape, subok=True)[item]\n        else:\n            self_location = self.location\n\n        if isinstance(value, Time):\n            # Make sure locations are compatible.  Location can be either None or\n            # a Location object.\n            if self_location is None and value.location is None:\n                match = True\n            elif ((self_location is None and value.location is not None)\n                  or (self_location is not None and value.location is None)):\n                match = False\n            else:\n                match = np.all(self_location == value.location)\n            if not match:\n                raise ValueError('cannot set to Time with different location: '\n                                 'expected location={} and '\n                                 'got location={}'\n                                 .format(self_location, value.location))\n        else:\n            try:\n                value = self.__class__(value, scale=self.scale, location=self_location)\n            except Exception:\n                try:\n                    value = self.__class__(value, scale=self.scale, format=self.format,\n                                           location=self_location)\n                except Exception as err:\n                    raise ValueError('cannot convert value to a compatible Time object: {}'\n                                     .format(err))\n        return value\n\n    @classmethod\n    def now(cls):\n        \"\"\"\n        Creates a new object corresponding to the instant in time this\n        method is called.\n\n        .. note::\n            \"Now\" is determined using the `~datetime.datetime.utcnow`\n            function, so its accuracy and precision is determined by that\n            function.  Generally that means it is set by the accuracy of\n            your system clock.\n\n        Returns\n        -------\n        nowtime : :class:`~astropy.time.Time`\n            A new `Time` object (or a subclass of `Time` if this is called from\n            such a subclass) at the current time.\n        \"\"\"\n        # call `utcnow` immediately to be sure it's ASAP\n        dtnow = datetime.utcnow()\n        return cls(val=dtnow, format='datetime', scale='utc')\n\n    info = TimeInfo()\n\n    @classmethod\n    def strptime(cls, time_string, format_string, **kwargs):\n        \"\"\"\n        Parse a string to a Time according to a format specification.\n        See `time.strptime` documentation for format specification.\n\n        >>> Time.strptime('2012-Jun-30 23:59:60', '%Y-%b-%d %H:%M:%S')\n        <Time object: scale='utc' format='isot' value=2012-06-30T23:59:60.000>\n\n        Parameters\n        ----------\n        time_string : str, sequence, or ndarray\n            Objects containing time data of type string\n        format_string : str\n            String specifying format of time_string.\n        kwargs : dict\n            Any keyword arguments for ``Time``.  If the ``format`` keyword\n            argument is present, this will be used as the Time format.\n\n        Returns\n        -------\n        time_obj : `~astropy.time.Time`\n            A new `~astropy.time.Time` object corresponding to the input\n            ``time_string``.\n\n        \"\"\"\n        time_array = np.asarray(time_string)\n\n        if time_array.dtype.kind not in ('U', 'S'):\n            err = \"Expected type is string, a bytes-like object or a sequence\"\\\n                  \" of these. Got dtype '{}'\".format(time_array.dtype.kind)\n            raise TypeError(err)\n\n        to_string = (str if time_array.dtype.kind == 'U' else\n                     lambda x: str(x.item(), encoding='ascii'))\n        iterator = np.nditer([time_array, None],\n                             op_dtypes=[time_array.dtype, 'U30'])\n\n        for time, formatted in iterator:\n            tt, fraction = _strptime._strptime(to_string(time), format_string)\n            time_tuple = tt[:6] + (fraction,)\n            formatted[...] = '{:04}-{:02}-{:02}T{:02}:{:02}:{:02}.{:06}'\\\n                .format(*time_tuple)\n\n        format = kwargs.pop('format', None)\n        out = cls(*iterator.operands[1:], format='isot', **kwargs)\n        if format is not None:\n            out.format = format\n\n        return out\n\n    def strftime(self, format_spec):\n        \"\"\"\n        Convert Time to a string or a numpy.array of strings according to a\n        format specification.\n        See `time.strftime` documentation for format specification.\n\n        Parameters\n        ----------\n        format_spec : str\n            Format definition of return string.\n\n        Returns\n        -------\n        formatted : str or numpy.array\n            String or numpy.array of strings formatted according to the given\n            format string.\n\n        \"\"\"\n        formatted_strings = []\n        for sk in self.replicate('iso')._time.str_kwargs():\n            date_tuple = date(sk['year'], sk['mon'], sk['day']).timetuple()\n            datetime_tuple = (sk['year'], sk['mon'], sk['day'],\n                              sk['hour'], sk['min'], sk['sec'],\n                              date_tuple[6], date_tuple[7], -1)\n            fmtd_str = format_spec\n            if '%f' in fmtd_str:\n                fmtd_str = fmtd_str.replace('%f', '{frac:0{precision}}'.format(\n                    frac=sk['fracsec'], precision=self.precision))\n            fmtd_str = strftime(fmtd_str, datetime_tuple)\n            formatted_strings.append(fmtd_str)\n\n        if self.isscalar:\n            return formatted_strings[0]\n        else:\n            return np.array(formatted_strings).reshape(self.shape)\n\n    def light_travel_time(self, skycoord, kind='barycentric', location=None, ephemeris=None):\n        \"\"\"Light travel time correction to the barycentre or heliocentre.\n\n        The frame transformations used to calculate the location of the solar\n        system barycentre and the heliocentre rely on the erfa routine epv00,\n        which is consistent with the JPL DE405 ephemeris to an accuracy of\n        11.2 km, corresponding to a light travel time of 4 microseconds.\n\n        The routine assumes the source(s) are at large distance, i.e., neglects\n        finite-distance effects.\n\n        Parameters\n        ----------\n        skycoord : `~astropy.coordinates.SkyCoord`\n            The sky location to calculate the correction for.\n        kind : str, optional\n            ``'barycentric'`` (default) or ``'heliocentric'``\n        location : `~astropy.coordinates.EarthLocation`, optional\n            The location of the observatory to calculate the correction for.\n            If no location is given, the ``location`` attribute of the Time\n            object is used\n        ephemeris : str, optional\n            Solar system ephemeris to use (e.g., 'builtin', 'jpl'). By default,\n            use the one set with ``astropy.coordinates.solar_system_ephemeris.set``.\n            For more information, see `~astropy.coordinates.solar_system_ephemeris`.\n\n        Returns\n        -------\n        time_offset : `~astropy.time.TimeDelta`\n            The time offset between the barycentre or Heliocentre and Earth,\n            in TDB seconds.  Should be added to the original time to get the\n            time in the Solar system barycentre or the Heliocentre.\n            Also, the time conversion to BJD will then include the relativistic correction as well.\n        \"\"\"\n\n        if kind.lower() not in ('barycentric', 'heliocentric'):\n            raise ValueError(\"'kind' parameter must be one of 'heliocentric' \"\n                             \"or 'barycentric'\")\n\n        if location is None:\n            if self.location is None:\n                raise ValueError('An EarthLocation needs to be set or passed '\n                                 'in to calculate bary- or heliocentric '\n                                 'corrections')\n            location = self.location\n\n        from astropy.coordinates import (UnitSphericalRepresentation, CartesianRepresentation,\n                                         HCRS, ICRS, GCRS, solar_system_ephemeris)\n\n        # ensure sky location is ICRS compatible\n        if not skycoord.is_transformable_to(ICRS()):\n            raise ValueError(\"Given skycoord is not transformable to the ICRS\")\n\n        # get location of observatory in ITRS coordinates at this Time\n        try:\n            itrs = location.get_itrs(obstime=self)\n        except Exception:\n            raise ValueError(\"Supplied location does not have a valid `get_itrs` method\")\n\n        with solar_system_ephemeris.set(ephemeris):\n            if kind.lower() == 'heliocentric':\n                # convert to heliocentric coordinates, aligned with ICRS\n                cpos = itrs.transform_to(HCRS(obstime=self)).cartesian.xyz\n            else:\n                # first we need to convert to GCRS coordinates with the correct\n                # obstime, since ICRS coordinates have no frame time\n                gcrs_coo = itrs.transform_to(GCRS(obstime=self))\n                # convert to barycentric (BCRS) coordinates, aligned with ICRS\n                cpos = gcrs_coo.transform_to(ICRS()).cartesian.xyz\n\n        # get unit ICRS vector to star\n        spos = (skycoord.icrs.represent_as(UnitSphericalRepresentation).\n                represent_as(CartesianRepresentation).xyz)\n\n        # Move X,Y,Z to last dimension, to enable possible broadcasting below.\n        cpos = np.rollaxis(cpos, 0, cpos.ndim)\n        spos = np.rollaxis(spos, 0, spos.ndim)\n\n        # calculate light travel time correction\n        tcor_val = (spos * cpos).sum(axis=-1) / const.c\n        return TimeDelta(tcor_val, scale='tdb')\n\n    def earth_rotation_angle(self, longitude=None):\n        \"\"\"Calculate local Earth rotation angle.\n\n        Parameters\n        ----------\n        longitude : `~astropy.units.Quantity`, `~astropy.coordinates.EarthLocation`, str, or None; optional\n            The longitude on the Earth at which to compute the Earth rotation\n            angle (taken from a location as needed).  If `None` (default), taken\n            from the ``location`` attribute of the Time instance. If the special\n            string 'tio', the result will be relative to the Terrestrial\n            Intermediate Origin (TIO) (i.e., the output of `~erfa.era00`).\n\n        Returns\n        -------\n        `~astropy.coordinates.Longitude`\n            Local Earth rotation angle with units of hourangle.\n\n        See Also\n        --------\n        astropy.time.Time.sidereal_time\n\n        References\n        ----------\n        IAU 2006 NFA Glossary\n        (currently located at: https://syrte.obspm.fr/iauWGnfa/NFA_Glossary.html)\n\n        Notes\n        -----\n        The difference between apparent sidereal time and Earth rotation angle\n        is the equation of the origins, which is the angle between the Celestial\n        Intermediate Origin (CIO) and the equinox. Applying apparent sidereal\n        time to the hour angle yields the true apparent Right Ascension with\n        respect to the equinox, while applying the Earth rotation angle yields\n        the intermediate (CIRS) Right Ascension with respect to the CIO.\n\n        The result includes the TIO locator (s'), which positions the Terrestrial\n        Intermediate Origin on the equator of the Celestial Intermediate Pole (CIP)\n        and is rigorously corrected for polar motion.\n        (except when ``longitude='tio'``).\n\n        \"\"\"\n        if isinstance(longitude, str) and longitude == 'tio':\n            longitude = 0\n            include_tio = False\n        else:\n            include_tio = True\n\n        return self._sid_time_or_earth_rot_ang(longitude=longitude,\n                                               function=erfa.era00, scales=('ut1',),\n                                               include_tio=include_tio)\n\n    def sidereal_time(self, kind, longitude=None, model=None):\n        \"\"\"Calculate sidereal time.\n\n        Parameters\n        ----------\n        kind : str\n            ``'mean'`` or ``'apparent'``, i.e., accounting for precession\n            only, or also for nutation.\n        longitude : `~astropy.units.Quantity`, `~astropy.coordinates.EarthLocation`, str, or None; optional\n            The longitude on the Earth at which to compute the Earth rotation\n            angle (taken from a location as needed).  If `None` (default), taken\n            from the ``location`` attribute of the Time instance. If the special\n            string  'greenwich' or 'tio', the result will be relative to longitude\n            0 for models before 2000, and relative to the Terrestrial Intermediate\n            Origin (TIO) for later ones (i.e., the output of the relevant ERFA\n            function that calculates greenwich sidereal time).\n        model : str or None; optional\n            Precession (and nutation) model to use.  The available ones are:\n            - {0}: {1}\n            - {2}: {3}\n            If `None` (default), the last (most recent) one from the appropriate\n            list above is used.\n\n        Returns\n        -------\n        `~astropy.coordinates.Longitude`\n            Local sidereal time, with units of hourangle.\n\n        See Also\n        --------\n        astropy.time.Time.earth_rotation_angle\n\n        References\n        ----------\n        IAU 2006 NFA Glossary\n        (currently located at: https://syrte.obspm.fr/iauWGnfa/NFA_Glossary.html)\n\n        Notes\n        -----\n        The difference between apparent sidereal time and Earth rotation angle\n        is the equation of the origins, which is the angle between the Celestial\n        Intermediate Origin (CIO) and the equinox. Applying apparent sidereal\n        time to the hour angle yields the true apparent Right Ascension with\n        respect to the equinox, while applying the Earth rotation angle yields\n        the intermediate (CIRS) Right Ascension with respect to the CIO.\n\n        For the IAU precession models from 2000 onwards, the result includes the\n        TIO locator (s'), which positions the Terrestrial Intermediate Origin on\n        the equator of the Celestial Intermediate Pole (CIP) and is rigorously\n        corrected for polar motion (except when ``longitude='tio'`` or ``'greenwich'``).\n\n        \"\"\"  # docstring is formatted below\n\n        if kind.lower() not in SIDEREAL_TIME_MODELS.keys():\n            raise ValueError('The kind of sidereal time has to be {}'.format(\n                ' or '.join(sorted(SIDEREAL_TIME_MODELS.keys()))))\n\n        available_models = SIDEREAL_TIME_MODELS[kind.lower()]\n\n        if model is None:\n            model = sorted(available_models.keys())[-1]\n        elif model.upper() not in available_models:\n            raise ValueError(\n                'Model {} not implemented for {} sidereal time; '\n                'available models are {}'\n                .format(model, kind, sorted(available_models.keys())))\n\n        model_kwargs = available_models[model.upper()]\n\n        if isinstance(longitude, str) and longitude in ('tio', 'greenwich'):\n            longitude = 0\n            model_kwargs = model_kwargs.copy()\n            model_kwargs['include_tio'] = False\n\n        return self._sid_time_or_earth_rot_ang(longitude=longitude, **model_kwargs)\n\n    if isinstance(sidereal_time.__doc__, str):\n        sidereal_time.__doc__ = sidereal_time.__doc__.format(\n            'apparent', sorted(SIDEREAL_TIME_MODELS['apparent'].keys()),\n            'mean', sorted(SIDEREAL_TIME_MODELS['mean'].keys()))\n\n    def _sid_time_or_earth_rot_ang(self, longitude, function, scales, include_tio=True):\n        \"\"\"Calculate a local sidereal time or Earth rotation angle.\n\n        Parameters\n        ----------\n        longitude : `~astropy.units.Quantity`, `~astropy.coordinates.EarthLocation`, str, or None; optional\n            The longitude on the Earth at which to compute the Earth rotation\n            angle (taken from a location as needed).  If `None` (default), taken\n            from the ``location`` attribute of the Time instance.\n        function : callable\n            The ERFA function to use.\n        scales : tuple of str\n            The time scales that the function requires on input.\n        include_tio : bool, optional\n            Whether to includes the TIO locator corrected for polar motion.\n            Should be `False` for pre-2000 IAU models.  Default: `True`.\n\n        Returns\n        -------\n        `~astropy.coordinates.Longitude`\n            Local sidereal time or Earth rotation angle, with units of hourangle.\n\n        \"\"\"\n        from astropy.coordinates import Longitude, EarthLocation\n        from astropy.coordinates.builtin_frames.utils import get_polar_motion\n        from astropy.coordinates.matrix_utilities import rotation_matrix\n\n        if longitude is None:\n            if self.location is None:\n                raise ValueError('No longitude is given but the location for '\n                                 'the Time object is not set.')\n            longitude = self.location.lon\n        elif isinstance(longitude, EarthLocation):\n            longitude = longitude.lon\n        else:\n            # Sanity check on input; default unit is degree.\n            longitude = Longitude(longitude, u.degree, copy=False)\n\n        theta = self._call_erfa(function, scales)\n\n        if include_tio:\n            # TODO: this duplicates part of coordinates.erfa_astrom.ErfaAstrom.apio;\n            # maybe posisble to factor out to one or the other.\n            sp = self._call_erfa(erfa.sp00, ('tt',))\n            xp, yp = get_polar_motion(self)\n            # Form the rotation matrix, CIRS to apparent [HA,Dec].\n            r = (rotation_matrix(longitude, 'z')\n                 @ rotation_matrix(-yp, 'x', unit=u.radian)\n                 @ rotation_matrix(-xp, 'y', unit=u.radian)\n                 @ rotation_matrix(theta+sp, 'z', unit=u.radian))\n            # Solve for angle.\n            angle = np.arctan2(r[..., 0, 1], r[..., 0, 0]) << u.radian\n\n        else:\n            angle = longitude + (theta << u.radian)\n\n        return Longitude(angle, u.hourangle)\n\n    def _call_erfa(self, function, scales):\n        # TODO: allow erfa functions to be used on Time with __array_ufunc__.\n        erfa_parameters = [getattr(getattr(self, scale)._time, jd_part)\n                           for scale in scales\n                           for jd_part in ('jd1', 'jd2_filled')]\n\n        result = function(*erfa_parameters)\n\n        if self.masked:\n            result[self.mask] = np.nan\n\n        return result\n\n    def get_delta_ut1_utc(self, iers_table=None, return_status=False):\n        \"\"\"Find UT1 - UTC differences by interpolating in IERS Table.\n\n        Parameters\n        ----------\n        iers_table : `~astropy.utils.iers.IERS`, optional\n            Table containing UT1-UTC differences from IERS Bulletins A\n            and/or B.  Default: `~astropy.utils.iers.earth_orientation_table`\n            (which in turn defaults to the combined version provided by\n            `~astropy.utils.iers.IERS_Auto`).\n        return_status : bool\n            Whether to return status values.  If `False` (default), iers\n            raises `IndexError` if any time is out of the range\n            covered by the IERS table.\n\n        Returns\n        -------\n        ut1_utc : float or float array\n            UT1-UTC, interpolated in IERS Table\n        status : int or int array\n            Status values (if ``return_status=`True```)::\n            ``astropy.utils.iers.FROM_IERS_B``\n            ``astropy.utils.iers.FROM_IERS_A``\n            ``astropy.utils.iers.FROM_IERS_A_PREDICTION``\n            ``astropy.utils.iers.TIME_BEFORE_IERS_RANGE``\n            ``astropy.utils.iers.TIME_BEYOND_IERS_RANGE``\n\n        Notes\n        -----\n        In normal usage, UT1-UTC differences are calculated automatically\n        on the first instance ut1 is needed.\n\n        Examples\n        --------\n        To check in code whether any times are before the IERS table range::\n\n            >>> from astropy.utils.iers import TIME_BEFORE_IERS_RANGE\n            >>> t = Time(['1961-01-01', '2000-01-01'], scale='utc')\n            >>> delta, status = t.get_delta_ut1_utc(return_status=True)  # doctest: +REMOTE_DATA\n            >>> status == TIME_BEFORE_IERS_RANGE  # doctest: +REMOTE_DATA\n            array([ True, False]...)\n        \"\"\"\n        if iers_table is None:\n            from astropy.utils.iers import earth_orientation_table\n            iers_table = earth_orientation_table.get()\n\n        return iers_table.ut1_utc(self.utc, return_status=return_status)\n\n    # Property for ERFA DUT arg = UT1 - UTC\n    def _get_delta_ut1_utc(self, jd1=None, jd2=None):\n        \"\"\"\n        Get ERFA DUT arg = UT1 - UTC.  This getter takes optional jd1 and\n        jd2 args because it gets called that way when converting time scales.\n        If delta_ut1_utc is not yet set, this will interpolate them from the\n        the IERS table.\n        \"\"\"\n        # Sec. 4.3.1: the arg DUT is the quantity delta_UT1 = UT1 - UTC in\n        # seconds. It is obtained from tables published by the IERS.\n        if not hasattr(self, '_delta_ut1_utc'):\n            from astropy.utils.iers import earth_orientation_table\n            iers_table = earth_orientation_table.get()\n            # jd1, jd2 are normally set (see above), except if delta_ut1_utc\n            # is access directly; ensure we behave as expected for that case\n            if jd1 is None:\n                self_utc = self.utc\n                jd1, jd2 = self_utc._time.jd1, self_utc._time.jd2_filled\n                scale = 'utc'\n            else:\n                scale = self.scale\n            # interpolate UT1-UTC in IERS table\n            delta = iers_table.ut1_utc(jd1, jd2)\n            # if we interpolated using UT1 jds, we may be off by one\n            # second near leap seconds (and very slightly off elsewhere)\n            if scale == 'ut1':\n                # calculate UTC using the offset we got; the ERFA routine\n                # is tolerant of leap seconds, so will do this right\n                jd1_utc, jd2_utc = erfa.ut1utc(jd1, jd2, delta.to_value(u.s))\n                # calculate a better estimate using the nearly correct UTC\n                delta = iers_table.ut1_utc(jd1_utc, jd2_utc)\n\n            self._set_delta_ut1_utc(delta)\n\n        return self._delta_ut1_utc\n\n    def _set_delta_ut1_utc(self, val):\n        del self.cache\n        if hasattr(val, 'to'):  # Matches Quantity but also TimeDelta.\n            val = val.to(u.second).value\n        val = self._match_shape(val)\n        self._delta_ut1_utc = val\n\n    # Note can't use @property because _get_delta_tdb_tt is explicitly\n    # called with the optional jd1 and jd2 args.\n    delta_ut1_utc = property(_get_delta_ut1_utc, _set_delta_ut1_utc)\n    \"\"\"UT1 - UTC time scale offset\"\"\"\n\n    # Property for ERFA DTR arg = TDB - TT\n    def _get_delta_tdb_tt(self, jd1=None, jd2=None):\n        if not hasattr(self, '_delta_tdb_tt'):\n            # If jd1 and jd2 are not provided (which is the case for property\n            # attribute access) then require that the time scale is TT or TDB.\n            # Otherwise the computations here are not correct.\n            if jd1 is None or jd2 is None:\n                if self.scale not in ('tt', 'tdb'):\n                    raise ValueError('Accessing the delta_tdb_tt attribute '\n                                     'is only possible for TT or TDB time '\n                                     'scales')\n                else:\n                    jd1 = self._time.jd1\n                    jd2 = self._time.jd2_filled\n\n            # First go from the current input time (which is either\n            # TDB or TT) to an approximate UT1.  Since TT and TDB are\n            # pretty close (few msec?), assume TT.  Similarly, since the\n            # UT1 terms are very small, use UTC instead of UT1.\n            njd1, njd2 = erfa.tttai(jd1, jd2)\n            njd1, njd2 = erfa.taiutc(njd1, njd2)\n            # subtract 0.5, so UT is fraction of the day from midnight\n            ut = day_frac(njd1 - 0.5, njd2)[1]\n\n            if self.location is None:\n                # Assume geocentric.\n                self._delta_tdb_tt = erfa.dtdb(jd1, jd2, ut, 0., 0., 0.)\n            else:\n                location = self.location\n                # Geodetic params needed for d_tdb_tt()\n                lon = location.lon\n                rxy = np.hypot(location.x, location.y)\n                z = location.z\n                self._delta_tdb_tt = erfa.dtdb(\n                    jd1, jd2, ut, lon.to_value(u.radian),\n                    rxy.to_value(u.km), z.to_value(u.km))\n\n        return self._delta_tdb_tt\n\n    def _set_delta_tdb_tt(self, val):\n        del self.cache\n        if hasattr(val, 'to'):  # Matches Quantity but also TimeDelta.\n            val = val.to(u.second).value\n        val = self._match_shape(val)\n        self._delta_tdb_tt = val\n\n    # Note can't use @property because _get_delta_tdb_tt is explicitly\n    # called with the optional jd1 and jd2 args.\n    delta_tdb_tt = property(_get_delta_tdb_tt, _set_delta_tdb_tt)\n    \"\"\"TDB - TT time scale offset\"\"\"\n\n    def __sub__(self, other):\n        # T      - Tdelta = T\n        # T      - T      = Tdelta\n        other_is_delta = not isinstance(other, Time)\n        if other_is_delta:  # T - Tdelta\n            # Check other is really a TimeDelta or something that can initialize.\n            if not isinstance(other, TimeDelta):\n                try:\n                    other = TimeDelta(other)\n                except Exception:\n                    return NotImplemented\n\n            # we need a constant scale to calculate, which is guaranteed for\n            # TimeDelta, but not for Time (which can be UTC)\n            out = self.replicate()\n            if self.scale in other.SCALES:\n                if other.scale not in (out.scale, None):\n                    other = getattr(other, out.scale)\n            else:\n                if other.scale is None:\n                    out._set_scale('tai')\n                else:\n                    if self.scale not in TIME_TYPES[other.scale]:\n                        raise TypeError(\"Cannot subtract Time and TimeDelta instances \"\n                                        \"with scales '{}' and '{}'\"\n                                        .format(self.scale, other.scale))\n                    out._set_scale(other.scale)\n            # remove attributes that are invalidated by changing time\n            for attr in ('_delta_ut1_utc', '_delta_tdb_tt'):\n                if hasattr(out, attr):\n                    delattr(out, attr)\n\n        else:  # T - T\n            # the scales should be compatible (e.g., cannot convert TDB to LOCAL)\n            if other.scale not in self.SCALES:\n                raise TypeError(\"Cannot subtract Time instances \"\n                                \"with scales '{}' and '{}'\"\n                                .format(self.scale, other.scale))\n            self_time = (self._time if self.scale in TIME_DELTA_SCALES\n                         else self.tai._time)\n            # set up TimeDelta, subtraction to be done shortly\n            out = TimeDelta(self_time.jd1, self_time.jd2, format='jd',\n                            scale=self_time.scale)\n\n            if other.scale != out.scale:\n                other = getattr(other, out.scale)\n\n        jd1 = out._time.jd1 - other._time.jd1\n        jd2 = out._time.jd2 - other._time.jd2\n\n        out._time.jd1, out._time.jd2 = day_frac(jd1, jd2)\n\n        if other_is_delta:\n            # Go back to left-side scale if needed\n            out._set_scale(self.scale)\n\n        return out\n\n    def __add__(self, other):\n        # T      + Tdelta = T\n        # T      + T      = error\n        if isinstance(other, Time):\n            raise OperandTypeError(self, other, '+')\n\n        # Check other is really a TimeDelta or something that can initialize.\n        if not isinstance(other, TimeDelta):\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                return NotImplemented\n\n        # ideally, we calculate in the scale of the Time item, since that is\n        # what we want the output in, but this may not be possible, since\n        # TimeDelta cannot be converted arbitrarily\n        out = self.replicate()\n        if self.scale in other.SCALES:\n            if other.scale not in (out.scale, None):\n                other = getattr(other, out.scale)\n        else:\n            if other.scale is None:\n                out._set_scale('tai')\n            else:\n                if self.scale not in TIME_TYPES[other.scale]:\n                    raise TypeError(\"Cannot add Time and TimeDelta instances \"\n                                    \"with scales '{}' and '{}'\"\n                                    .format(self.scale, other.scale))\n                out._set_scale(other.scale)\n        # remove attributes that are invalidated by changing time\n        for attr in ('_delta_ut1_utc', '_delta_tdb_tt'):\n            if hasattr(out, attr):\n                delattr(out, attr)\n\n        jd1 = out._time.jd1 + other._time.jd1\n        jd2 = out._time.jd2 + other._time.jd2\n\n        out._time.jd1, out._time.jd2 = day_frac(jd1, jd2)\n\n        # Go back to left-side scale if needed\n        out._set_scale(self.scale)\n\n        return out\n\n    # Reverse addition is possible: <something-Tdelta-ish> + T\n    # but there is no case of <something> - T, so no __rsub__.\n    def __radd__(self, other):\n        return self.__add__(other)\n\n    def to_datetime(self, timezone=None):\n        # TODO: this could likely go through to_value, as long as that\n        # had an **kwargs part that was just passed on to _time.\n        tm = self.replicate(format='datetime')\n        return tm._shaped_like_input(tm._time.to_value(timezone))\n\n    to_datetime.__doc__ = TimeDatetime.to_value.__doc__"},{"className":"HeaderFormatter","col":0,"comment":"Class to format the header(s) of a FITS file for display by the\n    `fitsheader` tool; essentially a wrapper around a `HDUList` object.\n\n    Example usage:\n    fmt = HeaderFormatter('/path/to/file.fits')\n    print(fmt.parse(extensions=[0, 3], keywords=['NAXIS', 'BITPIX']))\n\n    Parameters\n    ----------\n    filename : str\n        Path to a single FITS file.\n    verbose : bool\n        Verbose flag, to show more information about missing extensions,\n        keywords, etc.\n\n    Raises\n    ------\n    OSError\n        If `filename` does not exist or cannot be read.\n    ","endLoc":235,"id":2759,"nodeType":"Class","startLoc":86,"text":"class HeaderFormatter:\n    \"\"\"Class to format the header(s) of a FITS file for display by the\n    `fitsheader` tool; essentially a wrapper around a `HDUList` object.\n\n    Example usage:\n    fmt = HeaderFormatter('/path/to/file.fits')\n    print(fmt.parse(extensions=[0, 3], keywords=['NAXIS', 'BITPIX']))\n\n    Parameters\n    ----------\n    filename : str\n        Path to a single FITS file.\n    verbose : bool\n        Verbose flag, to show more information about missing extensions,\n        keywords, etc.\n\n    Raises\n    ------\n    OSError\n        If `filename` does not exist or cannot be read.\n    \"\"\"\n\n    def __init__(self, filename, verbose=True):\n        self.filename = filename\n        self.verbose = verbose\n        self._hdulist = fits.open(filename)\n\n    def parse(self, extensions=None, keywords=None, compressed=False):\n        \"\"\"Returns the FITS file header(s) in a readable format.\n\n        Parameters\n        ----------\n        extensions : list of int or str, optional\n            Format only specific HDU(s), identified by number or name.\n            The name can be composed of the \"EXTNAME\" or \"EXTNAME,EXTVER\"\n            keywords.\n\n        keywords : list of str, optional\n            Keywords for which the value(s) should be returned.\n            If not specified, then the entire header is returned.\n\n        compressed : bool, optional\n            If True, shows the header describing the compression, rather than\n            the header obtained after decompression. (Affects FITS files\n            containing `CompImageHDU` extensions only.)\n\n        Returns\n        -------\n        formatted_header : str or astropy.table.Table\n            Traditional 80-char wide format in the case of `HeaderFormatter`;\n            an Astropy Table object in the case of `TableHeaderFormatter`.\n        \"\"\"\n        # `hdukeys` will hold the keys of the HDUList items to display\n        if extensions is None:\n            hdukeys = range(len(self._hdulist))  # Display all by default\n        else:\n            hdukeys = []\n            for ext in extensions:\n                try:\n                    # HDU may be specified by number\n                    hdukeys.append(int(ext))\n                except ValueError:\n                    # The user can specify \"EXTNAME\" or \"EXTNAME,EXTVER\"\n                    parts = ext.split(',')\n                    if len(parts) > 1:\n                        extname = ','.join(parts[0:-1])\n                        extver = int(parts[-1])\n                        hdukeys.append((extname, extver))\n                    else:\n                        hdukeys.append(ext)\n\n        # Having established which HDUs the user wants, we now format these:\n        return self._parse_internal(hdukeys, keywords, compressed)\n\n    def _parse_internal(self, hdukeys, keywords, compressed):\n        \"\"\"The meat of the formatting; in a separate method to allow overriding.\n        \"\"\"\n        result = []\n        for idx, hdu in enumerate(hdukeys):\n            try:\n                cards = self._get_cards(hdu, keywords, compressed)\n            except ExtensionNotFoundException:\n                continue\n\n            if idx > 0:  # Separate HDUs by a blank line\n                result.append('\\n')\n            result.append(f'# HDU {hdu} in {self.filename}:\\n')\n            for c in cards:\n                result.append(f'{c}\\n')\n        return ''.join(result)\n\n    def _get_cards(self, hdukey, keywords, compressed):\n        \"\"\"Returns a list of `astropy.io.fits.card.Card` objects.\n\n        This function will return the desired header cards, taking into\n        account the user's preference to see the compressed or uncompressed\n        version.\n\n        Parameters\n        ----------\n        hdukey : int or str\n            Key of a single HDU in the HDUList.\n\n        keywords : list of str, optional\n            Keywords for which the cards should be returned.\n\n        compressed : bool, optional\n            If True, shows the header describing the compression.\n\n        Raises\n        ------\n        ExtensionNotFoundException\n            If the hdukey does not correspond to an extension.\n        \"\"\"\n        # First we obtain the desired header\n        try:\n            if compressed:\n                # In the case of a compressed image, return the header before\n                # decompression (not the default behavior)\n                header = self._hdulist[hdukey]._header\n            else:\n                header = self._hdulist[hdukey].header\n        except (IndexError, KeyError):\n            message = f'{self.filename}: Extension {hdukey} not found.'\n            if self.verbose:\n                log.warning(message)\n            raise ExtensionNotFoundException(message)\n\n        if not keywords:  # return all cards\n            cards = header.cards\n        else:  # specific keywords are requested\n            cards = []\n            for kw in keywords:\n                try:\n                    crd = header.cards[kw]\n                    if isinstance(crd, fits.card.Card):  # Single card\n                        cards.append(crd)\n                    else:  # Allow for wildcard access\n                        cards.extend(crd)\n                except KeyError:  # Keyword does not exist\n                    if self.verbose:\n                        log.warning('{filename} (HDU {hdukey}): '\n                                    'Keyword {kw} not found.'.format(\n                                        filename=self.filename,\n                                        hdukey=hdukey,\n                                        kw=kw))\n        return cards\n\n    def close(self):\n        self._hdulist.close()"},{"col":4,"comment":"null","endLoc":111,"header":"def __init__(self, filename, verbose=True)","id":2760,"name":"__init__","nodeType":"Function","startLoc":108,"text":"def __init__(self, filename, verbose=True):\n        self.filename = filename\n        self.verbose = verbose\n        self._hdulist = fits.open(filename)"},{"col":4,"comment":"Returns the FITS file header(s) in a readable format.\n\n        Parameters\n        ----------\n        extensions : list of int or str, optional\n            Format only specific HDU(s), identified by number or name.\n            The name can be composed of the \"EXTNAME\" or \"EXTNAME,EXTVER\"\n            keywords.\n\n        keywords : list of str, optional\n            Keywords for which the value(s) should be returned.\n            If not specified, then the entire header is returned.\n\n        compressed : bool, optional\n            If True, shows the header describing the compression, rather than\n            the header obtained after decompression. (Affects FITS files\n            containing `CompImageHDU` extensions only.)\n\n        Returns\n        -------\n        formatted_header : str or astropy.table.Table\n            Traditional 80-char wide format in the case of `HeaderFormatter`;\n            an Astropy Table object in the case of `TableHeaderFormatter`.\n        ","endLoc":158,"header":"def parse(self, extensions=None, keywords=None, compressed=False)","id":2761,"name":"parse","nodeType":"Function","startLoc":113,"text":"def parse(self, extensions=None, keywords=None, compressed=False):\n        \"\"\"Returns the FITS file header(s) in a readable format.\n\n        Parameters\n        ----------\n        extensions : list of int or str, optional\n            Format only specific HDU(s), identified by number or name.\n            The name can be composed of the \"EXTNAME\" or \"EXTNAME,EXTVER\"\n            keywords.\n\n        keywords : list of str, optional\n            Keywords for which the value(s) should be returned.\n            If not specified, then the entire header is returned.\n\n        compressed : bool, optional\n            If True, shows the header describing the compression, rather than\n            the header obtained after decompression. (Affects FITS files\n            containing `CompImageHDU` extensions only.)\n\n        Returns\n        -------\n        formatted_header : str or astropy.table.Table\n            Traditional 80-char wide format in the case of `HeaderFormatter`;\n            an Astropy Table object in the case of `TableHeaderFormatter`.\n        \"\"\"\n        # `hdukeys` will hold the keys of the HDUList items to display\n        if extensions is None:\n            hdukeys = range(len(self._hdulist))  # Display all by default\n        else:\n            hdukeys = []\n            for ext in extensions:\n                try:\n                    # HDU may be specified by number\n                    hdukeys.append(int(ext))\n                except ValueError:\n                    # The user can specify \"EXTNAME\" or \"EXTNAME,EXTVER\"\n                    parts = ext.split(',')\n                    if len(parts) > 1:\n                        extname = ','.join(parts[0:-1])\n                        extver = int(parts[-1])\n                        hdukeys.append((extname, extver))\n                    else:\n                        hdukeys.append(ext)\n\n        # Having established which HDUs the user wants, we now format these:\n        return self._parse_internal(hdukeys, keywords, compressed)"},{"className":"TimeBase","col":0,"comment":"Base time class from which Time and TimeDelta inherit.","endLoc":1434,"id":2762,"nodeType":"Class","startLoc":332,"text":"class TimeBase(ShapedLikeNDArray):\n    \"\"\"Base time class from which Time and TimeDelta inherit.\"\"\"\n\n    # Make sure that reverse arithmetic (e.g., TimeDelta.__rmul__)\n    # gets called over the __mul__ of Numpy arrays.\n    __array_priority__ = 20000\n\n    # Declare that Time can be used as a Table column by defining the\n    # attribute where column attributes will be stored.\n    _astropy_column_attrs = None\n\n    def __getnewargs__(self):\n        return (self._time,)\n\n    def _init_from_vals(self, val, val2, format, scale, copy,\n                        precision=None, in_subfmt=None, out_subfmt=None):\n        \"\"\"\n        Set the internal _format, scale, and _time attrs from user\n        inputs.  This handles coercion into the correct shapes and\n        some basic input validation.\n        \"\"\"\n        if precision is None:\n            precision = 3\n        if in_subfmt is None:\n            in_subfmt = '*'\n        if out_subfmt is None:\n            out_subfmt = '*'\n\n        # Coerce val into an array\n        val = _make_array(val, copy)\n\n        # If val2 is not None, ensure consistency\n        if val2 is not None:\n            val2 = _make_array(val2, copy)\n            try:\n                np.broadcast(val, val2)\n            except ValueError:\n                raise ValueError('Input val and val2 have inconsistent shape; '\n                                 'they cannot be broadcast together.')\n\n        if scale is not None:\n            if not (isinstance(scale, str)\n                    and scale.lower() in self.SCALES):\n                raise ScaleValueError(\"Scale {!r} is not in the allowed scales \"\n                                      \"{}\".format(scale,\n                                                  sorted(self.SCALES)))\n\n        # If either of the input val, val2 are masked arrays then\n        # find the masked elements and fill them.\n        mask, val, val2 = _check_for_masked_and_fill(val, val2)\n\n        # Parse / convert input values into internal jd1, jd2 based on format\n        self._time = self._get_time_fmt(val, val2, format, scale,\n                                        precision, in_subfmt, out_subfmt)\n        self._format = self._time.name\n\n        # Hack from #9969 to allow passing the location value that has been\n        # collected by the TimeAstropyTime format class up to the Time level.\n        # TODO: find a nicer way.\n        if hasattr(self._time, '_location'):\n            self.location = self._time._location\n            del self._time._location\n\n        # If any inputs were masked then masked jd2 accordingly.  From above\n        # routine ``mask`` must be either Python bool False or an bool ndarray\n        # with shape broadcastable to jd2.\n        if mask is not False:\n            mask = np.broadcast_to(mask, self._time.jd2.shape)\n            self._time.jd1[mask] = 2451544.5  # Set to JD for 2000-01-01\n            self._time.jd2[mask] = np.nan\n\n    def _get_time_fmt(self, val, val2, format, scale,\n                      precision, in_subfmt, out_subfmt):\n        \"\"\"\n        Given the supplied val, val2, format and scale try to instantiate\n        the corresponding TimeFormat class to convert the input values into\n        the internal jd1 and jd2.\n\n        If format is `None` and the input is a string-type or object array then\n        guess available formats and stop when one matches.\n        \"\"\"\n\n        if (format is None\n                and (val.dtype.kind in ('S', 'U', 'O', 'M') or val.dtype.names)):\n            # Input is a string, object, datetime, or a table-like ndarray\n            # (structured array, recarray). These input types can be\n            # uniquely identified by the format classes.\n            formats = [(name, cls) for name, cls in self.FORMATS.items()\n                       if issubclass(cls, TimeUnique)]\n\n            # AstropyTime is a pseudo-format that isn't in the TIME_FORMATS registry,\n            # but try to guess it at the end.\n            formats.append(('astropy_time', TimeAstropyTime))\n\n        elif not (isinstance(format, str)\n                  and format.lower() in self.FORMATS):\n            if format is None:\n                raise ValueError(\"No time format was given, and the input is \"\n                                 \"not unique\")\n            else:\n                raise ValueError(\"Format {!r} is not one of the allowed \"\n                                 \"formats {}\".format(format,\n                                                     sorted(self.FORMATS)))\n        else:\n            formats = [(format, self.FORMATS[format])]\n\n        assert formats\n        problems = {}\n        for name, cls in formats:\n            try:\n                return cls(val, val2, scale, precision, in_subfmt, out_subfmt)\n            except UnitConversionError:\n                raise\n            except (ValueError, TypeError) as err:\n                # If ``format`` specified then there is only one possibility, so raise\n                # immediately and include the upstream exception message to make it\n                # easier for user to see what is wrong.\n                if len(formats) == 1:\n                    raise ValueError(\n                        f'Input values did not match the format class {format}:'\n                        + os.linesep\n                        + f'{err.__class__.__name__}: {err}'\n                    ) from err\n                else:\n                    problems[name] = err\n        else:\n            raise ValueError(f'Input values did not match any of the formats '\n                             f'where the format keyword is optional: '\n                             f'{problems}') from problems[formats[0][0]]\n\n    @property\n    def writeable(self):\n        return self._time.jd1.flags.writeable & self._time.jd2.flags.writeable\n\n    @writeable.setter\n    def writeable(self, value):\n        self._time.jd1.flags.writeable = value\n        self._time.jd2.flags.writeable = value\n\n    @property\n    def format(self):\n        \"\"\"\n        Get or set time format.\n\n        The format defines the way times are represented when accessed via the\n        ``.value`` attribute.  By default it is the same as the format used for\n        initializing the `Time` instance, but it can be set to any other value\n        that could be used for initialization.  These can be listed with::\n\n          >>> list(Time.FORMATS)\n          ['jd', 'mjd', 'decimalyear', 'unix', 'unix_tai', 'cxcsec', 'gps', 'plot_date',\n           'stardate', 'datetime', 'ymdhms', 'iso', 'isot', 'yday', 'datetime64',\n           'fits', 'byear', 'jyear', 'byear_str', 'jyear_str']\n        \"\"\"\n        return self._format\n\n    @format.setter\n    def format(self, format):\n        \"\"\"Set time format\"\"\"\n        if format not in self.FORMATS:\n            raise ValueError(f'format must be one of {list(self.FORMATS)}')\n        format_cls = self.FORMATS[format]\n\n        # Get the new TimeFormat object to contain time in new format.  Possibly\n        # coerce in/out_subfmt to '*' (default) if existing subfmt values are\n        # not valid in the new format.\n        self._time = format_cls(\n            self._time.jd1, self._time.jd2,\n            self._time._scale, self.precision,\n            in_subfmt=format_cls._get_allowed_subfmt(self.in_subfmt),\n            out_subfmt=format_cls._get_allowed_subfmt(self.out_subfmt),\n            from_jd=True)\n\n        self._format = format\n\n    def __repr__(self):\n        return (\"<{} object: scale='{}' format='{}' value={}>\"\n                .format(self.__class__.__name__, self.scale, self.format,\n                        getattr(self, self.format)))\n\n    def __str__(self):\n        return str(getattr(self, self.format))\n\n    def __hash__(self):\n\n        try:\n            loc = getattr(self, 'location', None)\n            if loc is not None:\n                loc = loc.x.to_value(u.m), loc.y.to_value(u.m), loc.z.to_value(u.m)\n\n            return hash((self.jd1, self.jd2, self.scale, loc))\n\n        except TypeError:\n            if self.ndim != 0:\n                reason = '(must be scalar)'\n            elif self.masked:\n                reason = '(value is masked)'\n            else:\n                raise\n\n            raise TypeError(f\"unhashable type: '{self.__class__.__name__}' {reason}\")\n\n    @property\n    def scale(self):\n        \"\"\"Time scale\"\"\"\n        return self._time.scale\n\n    def _set_scale(self, scale):\n        \"\"\"\n        This is the key routine that actually does time scale conversions.\n        This is not public and not connected to the read-only scale property.\n        \"\"\"\n\n        if scale == self.scale:\n            return\n        if scale not in self.SCALES:\n            raise ValueError(\"Scale {!r} is not in the allowed scales {}\"\n                             .format(scale, sorted(self.SCALES)))\n\n        if scale == 'utc' or self.scale == 'utc':\n            # If doing a transform involving UTC then check that the leap\n            # seconds table is up to date.\n            _check_leapsec()\n\n        # Determine the chain of scale transformations to get from the current\n        # scale to the new scale.  MULTI_HOPS contains a dict of all\n        # transformations (xforms) that require intermediate xforms.\n        # The MULTI_HOPS dict is keyed by (sys1, sys2) in alphabetical order.\n        xform = (self.scale, scale)\n        xform_sort = tuple(sorted(xform))\n        multi = MULTI_HOPS.get(xform_sort, ())\n        xforms = xform_sort[:1] + multi + xform_sort[-1:]\n        # If we made the reverse xform then reverse it now.\n        if xform_sort != xform:\n            xforms = tuple(reversed(xforms))\n\n        # Transform the jd1,2 pairs through the chain of scale xforms.\n        jd1, jd2 = self._time.jd1, self._time.jd2_filled\n        for sys1, sys2 in zip(xforms[:-1], xforms[1:]):\n            # Some xforms require an additional delta_ argument that is\n            # provided through Time methods.  These values may be supplied by\n            # the user or computed based on available approximations.  The\n            # get_delta_ methods are available for only one combination of\n            # sys1, sys2 though the property applies for both xform directions.\n            args = [jd1, jd2]\n            for sys12 in ((sys1, sys2), (sys2, sys1)):\n                dt_method = '_get_delta_{}_{}'.format(*sys12)\n                try:\n                    get_dt = getattr(self, dt_method)\n                except AttributeError:\n                    pass\n                else:\n                    args.append(get_dt(jd1, jd2))\n                    break\n\n            conv_func = getattr(erfa, sys1 + sys2)\n            jd1, jd2 = conv_func(*args)\n\n        jd1, jd2 = day_frac(jd1, jd2)\n        if self.masked:\n            jd2[self.mask] = np.nan\n\n        self._time = self.FORMATS[self.format](jd1, jd2, scale, self.precision,\n                                               self.in_subfmt, self.out_subfmt,\n                                               from_jd=True)\n\n    @property\n    def precision(self):\n        \"\"\"\n        Decimal precision when outputting seconds as floating point (int\n        value between 0 and 9 inclusive).\n        \"\"\"\n        return self._time.precision\n\n    @precision.setter\n    def precision(self, val):\n        del self.cache\n        if not isinstance(val, int) or val < 0 or val > 9:\n            raise ValueError('precision attribute must be an int between '\n                             '0 and 9')\n        self._time.precision = val\n\n    @property\n    def in_subfmt(self):\n        \"\"\"\n        Unix wildcard pattern to select subformats for parsing string input\n        times.\n        \"\"\"\n        return self._time.in_subfmt\n\n    @in_subfmt.setter\n    def in_subfmt(self, val):\n        self._time.in_subfmt = val\n        del self.cache\n\n    @property\n    def out_subfmt(self):\n        \"\"\"\n        Unix wildcard pattern to select subformats for outputting times.\n        \"\"\"\n        return self._time.out_subfmt\n\n    @out_subfmt.setter\n    def out_subfmt(self, val):\n        # Setting the out_subfmt property here does validation of ``val``\n        self._time.out_subfmt = val\n        del self.cache\n\n    @property\n    def shape(self):\n        \"\"\"The shape of the time instances.\n\n        Like `~numpy.ndarray.shape`, can be set to a new shape by assigning a\n        tuple.  Note that if different instances share some but not all\n        underlying data, setting the shape of one instance can make the other\n        instance unusable.  Hence, it is strongly recommended to get new,\n        reshaped instances with the ``reshape`` method.\n\n        Raises\n        ------\n        ValueError\n            If the new shape has the wrong total number of elements.\n        AttributeError\n            If the shape of the ``jd1``, ``jd2``, ``location``,\n            ``delta_ut1_utc``, or ``delta_tdb_tt`` attributes cannot be changed\n            without the arrays being copied.  For these cases, use the\n            `Time.reshape` method (which copies any arrays that cannot be\n            reshaped in-place).\n        \"\"\"\n        return self._time.jd1.shape\n\n    @shape.setter\n    def shape(self, shape):\n        del self.cache\n\n        # We have to keep track of arrays that were already reshaped,\n        # since we may have to return those to their original shape if a later\n        # shape-setting fails.\n        reshaped = []\n        oldshape = self.shape\n\n        # In-place reshape of data/attributes.  Need to access _time.jd1/2 not\n        # self.jd1/2 because the latter are not guaranteed to be the actual\n        # data, and in fact should not be directly changeable from the public\n        # API.\n        for obj, attr in ((self._time, 'jd1'),\n                          (self._time, 'jd2'),\n                          (self, '_delta_ut1_utc'),\n                          (self, '_delta_tdb_tt'),\n                          (self, 'location')):\n            val = getattr(obj, attr, None)\n            if val is not None and val.size > 1:\n                try:\n                    val.shape = shape\n                except Exception:\n                    for val2 in reshaped:\n                        val2.shape = oldshape\n                    raise\n                else:\n                    reshaped.append(val)\n\n    def _shaped_like_input(self, value):\n        if self._time.jd1.shape:\n            if isinstance(value, np.ndarray):\n                return value\n            else:\n                raise TypeError(\n                    f\"JD is an array ({self._time.jd1!r}) but value \"\n                    f\"is not ({value!r})\")\n        else:\n            # zero-dimensional array, is it safe to unbox?\n            if (isinstance(value, np.ndarray)\n                    and not value.shape\n                    and not np.ma.is_masked(value)):\n                if value.dtype.kind == 'M':\n                    # existing test doesn't want datetime64 converted\n                    return value[()]\n                elif value.dtype.fields:\n                    # Unpack but keep field names; .item() doesn't\n                    # Still don't get python types in the fields\n                    return value[()]\n                else:\n                    return value.item()\n            else:\n                return value\n\n    @property\n    def jd1(self):\n        \"\"\"\n        First of the two doubles that internally store time value(s) in JD.\n        \"\"\"\n        jd1 = self._time.mask_if_needed(self._time.jd1)\n        return self._shaped_like_input(jd1)\n\n    @property\n    def jd2(self):\n        \"\"\"\n        Second of the two doubles that internally store time value(s) in JD.\n        \"\"\"\n        jd2 = self._time.mask_if_needed(self._time.jd2)\n        return self._shaped_like_input(jd2)\n\n    def to_value(self, format, subfmt='*'):\n        \"\"\"Get time values expressed in specified output format.\n\n        This method allows representing the ``Time`` object in the desired\n        output ``format`` and optional sub-format ``subfmt``.  Available\n        built-in formats include ``jd``, ``mjd``, ``iso``, and so forth. Each\n        format can have its own sub-formats\n\n        For built-in numerical formats like ``jd`` or ``unix``, ``subfmt`` can\n        be one of 'float', 'long', 'decimal', 'str', or 'bytes'.  Here, 'long'\n        uses ``numpy.longdouble`` for somewhat enhanced precision (with\n        the enhancement depending on platform), and 'decimal'\n        :class:`decimal.Decimal` for full precision.  For 'str' and 'bytes', the\n        number of digits is also chosen such that time values are represented\n        accurately.\n\n        For built-in date-like string formats, one of 'date_hms', 'date_hm', or\n        'date' (or 'longdate_hms', etc., for 5-digit years in\n        `~astropy.time.TimeFITS`).  For sub-formats including seconds, the\n        number of digits used for the fractional seconds is as set by\n        `~astropy.time.Time.precision`.\n\n        Parameters\n        ----------\n        format : str\n            The format in which one wants the time values. Default: the current\n            format.\n        subfmt : str or None, optional\n            Value or wildcard pattern to select the sub-format in which the\n            values should be given.  The default of '*' picks the first\n            available for a given format, i.e., 'float' or 'date_hms'.\n            If `None`, use the instance's ``out_subfmt``.\n\n        \"\"\"\n        # TODO: add a precision argument (but ensure it is keyword argument\n        # only, to make life easier for TimeDelta.to_value()).\n        if format not in self.FORMATS:\n            raise ValueError(f'format must be one of {list(self.FORMATS)}')\n\n        cache = self.cache['format']\n        # Try to keep cache behaviour like it was in astropy < 4.0.\n        key = format if subfmt is None else (format, subfmt)\n        if key not in cache:\n            if format == self.format:\n                tm = self\n            else:\n                tm = self.replicate(format=format)\n\n            # Some TimeFormat subclasses may not be able to handle being passes\n            # on a out_subfmt. This includes some core classes like\n            # TimeBesselianEpochString that do not have any allowed subfmts. But\n            # those do deal with `self.out_subfmt` internally, so if subfmt is\n            # the same, we do not pass it on.\n            kwargs = {}\n            if subfmt is not None and subfmt != tm.out_subfmt:\n                kwargs['out_subfmt'] = subfmt\n            try:\n                value = tm._time.to_value(parent=tm, **kwargs)\n            except TypeError as exc:\n                # Try validating subfmt, e.g. for formats like 'jyear_str' that\n                # do not implement out_subfmt in to_value() (because there are\n                # no allowed subformats).  If subfmt is not valid this gives the\n                # same exception as would have occurred if the call to\n                # `to_value()` had succeeded.\n                tm._time._select_subfmts(subfmt)\n\n                # Subfmt was valid, so fall back to the original exception to see\n                # if it was lack of support for out_subfmt as a call arg.\n                if \"unexpected keyword argument 'out_subfmt'\" in str(exc):\n                    raise ValueError(\n                        f\"to_value() method for format {format!r} does not \"\n                        f\"support passing a 'subfmt' argument\") from None\n                else:\n                    # Some unforeseen exception so raise.\n                    raise\n\n            value = tm._shaped_like_input(value)\n            cache[key] = value\n        return cache[key]\n\n    @property\n    def value(self):\n        \"\"\"Time value(s) in current format\"\"\"\n        return self.to_value(self.format, None)\n\n    @property\n    def masked(self):\n        return self._time.masked\n\n    @property\n    def mask(self):\n        return self._time.mask\n\n    def insert(self, obj, values, axis=0):\n        \"\"\"\n        Insert values before the given indices in the column and return\n        a new `~astropy.time.Time` or  `~astropy.time.TimeDelta` object.\n\n        The values to be inserted must conform to the rules for in-place setting\n        of ``Time`` objects (see ``Get and set values`` in the ``Time``\n        documentation).\n\n        The API signature matches the ``np.insert`` API, but is more limited.\n        The specification of insert index ``obj`` must be a single integer,\n        and the ``axis`` must be ``0`` for simple row insertion before the\n        index.\n\n        Parameters\n        ----------\n        obj : int\n            Integer index before which ``values`` is inserted.\n        values : array-like\n            Value(s) to insert.  If the type of ``values`` is different\n            from that of quantity, ``values`` is converted to the matching type.\n        axis : int, optional\n            Axis along which to insert ``values``.  Default is 0, which is the\n            only allowed value and will insert a row.\n\n        Returns\n        -------\n        out : `~astropy.time.Time` subclass\n            New time object with inserted value(s)\n\n        \"\"\"\n        # Validate inputs: obj arg is integer, axis=0, self is not a scalar, and\n        # input index is in bounds.\n        try:\n            idx0 = operator.index(obj)\n        except TypeError:\n            raise TypeError('obj arg must be an integer')\n\n        if axis != 0:\n            raise ValueError('axis must be 0')\n\n        if not self.shape:\n            raise TypeError('cannot insert into scalar {} object'\n                            .format(self.__class__.__name__))\n\n        if abs(idx0) > len(self):\n            raise IndexError('index {} is out of bounds for axis 0 with size {}'\n                             .format(idx0, len(self)))\n\n        # Turn negative index into positive\n        if idx0 < 0:\n            idx0 = len(self) + idx0\n\n        # For non-Time object, use numpy to help figure out the length.  (Note annoying\n        # case of a string input that has a length which is not the length we want).\n        if not isinstance(values, self.__class__):\n            values = np.asarray(values)\n        n_values = len(values) if values.shape else 1\n\n        # Finally make the new object with the correct length and set values for the\n        # three sections, before insert, the insert, and after the insert.\n        out = self.__class__.info.new_like([self], len(self) + n_values, name=self.info.name)\n\n        out._time.jd1[:idx0] = self._time.jd1[:idx0]\n        out._time.jd2[:idx0] = self._time.jd2[:idx0]\n\n        # This uses the Time setting machinery to coerce and validate as necessary.\n        out[idx0:idx0 + n_values] = values\n\n        out._time.jd1[idx0 + n_values:] = self._time.jd1[idx0:]\n        out._time.jd2[idx0 + n_values:] = self._time.jd2[idx0:]\n\n        return out\n\n    def __setitem__(self, item, value):\n        if not self.writeable:\n            if self.shape:\n                raise ValueError('{} object is read-only. Make a '\n                                 'copy() or set \"writeable\" attribute to True.'\n                                 .format(self.__class__.__name__))\n            else:\n                raise ValueError('scalar {} object is read-only.'\n                                 .format(self.__class__.__name__))\n\n        # Any use of setitem results in immediate cache invalidation\n        del self.cache\n\n        # Setting invalidates transform deltas\n        for attr in ('_delta_tdb_tt', '_delta_ut1_utc'):\n            if hasattr(self, attr):\n                delattr(self, attr)\n\n        if value is np.ma.masked or value is np.nan:\n            self._time.jd2[item] = np.nan\n            return\n\n        value = self._make_value_equivalent(item, value)\n\n        # Finally directly set the jd1/2 values.  Locations are known to match.\n        if self.scale is not None:\n            value = getattr(value, self.scale)\n        self._time.jd1[item] = value._time.jd1\n        self._time.jd2[item] = value._time.jd2\n\n    def isclose(self, other, atol=None):\n        \"\"\"Returns a boolean or boolean array where two Time objects are\n        element-wise equal within a time tolerance.\n\n        This evaluates the expression below::\n\n          abs(self - other) <= atol\n\n        Parameters\n        ----------\n        other : `~astropy.time.Time`\n            Time object for comparison.\n        atol : `~astropy.units.Quantity` or `~astropy.time.TimeDelta`\n            Absolute tolerance for equality with units of time (e.g. ``u.s`` or\n            ``u.day``). Default is two bits in the 128-bit JD time representation,\n            equivalent to about 40 picosecs.\n        \"\"\"\n        if atol is None:\n            # Note: use 2 bits instead of 1 bit based on experience in precision\n            # tests, since taking the difference with a UTC time means one has\n            # to do a scale change.\n            atol = 2 * np.finfo(float).eps * u.day\n\n        if not isinstance(atol, (u.Quantity, TimeDelta)):\n            raise TypeError(\"'atol' argument must be a Quantity or TimeDelta instance, got \"\n                            f'{atol.__class__.__name__} instead')\n\n        try:\n            # Separate these out so user sees where the problem is\n            dt = self - other\n            dt = abs(dt)\n            out = dt <= atol\n        except Exception as err:\n            raise TypeError(\"'other' argument must support subtraction with Time \"\n                            f\"and return a value that supports comparison with \"\n                            f\"{atol.__class__.__name__}: {err}\")\n\n        return out\n\n    def copy(self, format=None):\n        \"\"\"\n        Return a fully independent copy the Time object, optionally changing\n        the format.\n\n        If ``format`` is supplied then the time format of the returned Time\n        object will be set accordingly, otherwise it will be unchanged from the\n        original.\n\n        In this method a full copy of the internal time arrays will be made.\n        The internal time arrays are normally not changeable by the user so in\n        most cases the ``replicate()`` method should be used.\n\n        Parameters\n        ----------\n        format : str, optional\n            Time format of the copy.\n\n        Returns\n        -------\n        tm : Time object\n            Copy of this object\n        \"\"\"\n        return self._apply('copy', format=format)\n\n    def replicate(self, format=None, copy=False, cls=None):\n        \"\"\"\n        Return a replica of the Time object, optionally changing the format.\n\n        If ``format`` is supplied then the time format of the returned Time\n        object will be set accordingly, otherwise it will be unchanged from the\n        original.\n\n        If ``copy`` is set to `True` then a full copy of the internal time arrays\n        will be made.  By default the replica will use a reference to the\n        original arrays when possible to save memory.  The internal time arrays\n        are normally not changeable by the user so in most cases it should not\n        be necessary to set ``copy`` to `True`.\n\n        The convenience method copy() is available in which ``copy`` is `True`\n        by default.\n\n        Parameters\n        ----------\n        format : str, optional\n            Time format of the replica.\n        copy : bool, optional\n            Return a true copy instead of using references where possible.\n\n        Returns\n        -------\n        tm : Time object\n            Replica of this object\n        \"\"\"\n        return self._apply('copy' if copy else 'replicate', format=format, cls=cls)\n\n    def _apply(self, method, *args, format=None, cls=None, **kwargs):\n        \"\"\"Create a new time object, possibly applying a method to the arrays.\n\n        Parameters\n        ----------\n        method : str or callable\n            If string, can be 'replicate'  or the name of a relevant\n            `~numpy.ndarray` method. In the former case, a new time instance\n            with unchanged internal data is created, while in the latter the\n            method is applied to the internal ``jd1`` and ``jd2`` arrays, as\n            well as to possible ``location``, ``_delta_ut1_utc``, and\n            ``_delta_tdb_tt`` arrays.\n            If a callable, it is directly applied to the above arrays.\n            Examples: 'copy', '__getitem__', 'reshape', `~numpy.broadcast_to`.\n        args : tuple\n            Any positional arguments for ``method``.\n        kwargs : dict\n            Any keyword arguments for ``method``.  If the ``format`` keyword\n            argument is present, this will be used as the Time format of the\n            replica.\n\n        Examples\n        --------\n        Some ways this is used internally::\n\n            copy : ``_apply('copy')``\n            replicate : ``_apply('replicate')``\n            reshape : ``_apply('reshape', new_shape)``\n            index or slice : ``_apply('__getitem__', item)``\n            broadcast : ``_apply(np.broadcast, shape=new_shape)``\n        \"\"\"\n        new_format = self.format if format is None else format\n\n        if callable(method):\n            apply_method = lambda array: method(array, *args, **kwargs)\n\n        else:\n            if method == 'replicate':\n                apply_method = None\n            else:\n                apply_method = operator.methodcaller(method, *args, **kwargs)\n\n        jd1, jd2 = self._time.jd1, self._time.jd2\n        if apply_method:\n            jd1 = apply_method(jd1)\n            jd2 = apply_method(jd2)\n\n        # Get a new instance of our class and set its attributes directly.\n        tm = super().__new__(cls or self.__class__)\n        tm._time = TimeJD(jd1, jd2, self.scale, precision=0,\n                          in_subfmt='*', out_subfmt='*', from_jd=True)\n\n        # Optional ndarray attributes.\n        for attr in ('_delta_ut1_utc', '_delta_tdb_tt', 'location'):\n            try:\n                val = getattr(self, attr)\n            except AttributeError:\n                continue\n\n            if apply_method:\n                # Apply the method to any value arrays (though skip if there is\n                # only an array scalar and the method would return a view,\n                # since in that case nothing would change).\n                if getattr(val, 'shape', ()):\n                    val = apply_method(val)\n                elif method == 'copy' or method == 'flatten':\n                    # flatten should copy also for a single element array, but\n                    # we cannot use it directly for array scalars, since it\n                    # always returns a one-dimensional array. So, just copy.\n                    val = copy.copy(val)\n\n            setattr(tm, attr, val)\n\n        # Copy other 'info' attr only if it has actually been defined and the\n        # time object is not a scalar (issue #10688).\n        # See PR #3898 for further explanation and justification, along\n        # with Quantity.__array_finalize__\n        if 'info' in self.__dict__:\n            tm.info = self.info\n\n        # Make the new internal _time object corresponding to the format\n        # in the copy.  If the format is unchanged this process is lightweight\n        # and does not create any new arrays.\n        if new_format not in tm.FORMATS:\n            raise ValueError(f'format must be one of {list(tm.FORMATS)}')\n\n        NewFormat = tm.FORMATS[new_format]\n\n        tm._time = NewFormat(\n            tm._time.jd1, tm._time.jd2,\n            tm._time._scale,\n            precision=self.precision,\n            in_subfmt=NewFormat._get_allowed_subfmt(self.in_subfmt),\n            out_subfmt=NewFormat._get_allowed_subfmt(self.out_subfmt),\n            from_jd=True)\n        tm._format = new_format\n        tm.SCALES = self.SCALES\n\n        return tm\n\n    def __copy__(self):\n        \"\"\"\n        Overrides the default behavior of the `copy.copy` function in\n        the python stdlib to behave like `Time.copy`. Does *not* make a\n        copy of the JD arrays - only copies by reference.\n        \"\"\"\n        return self.replicate()\n\n    def __deepcopy__(self, memo):\n        \"\"\"\n        Overrides the default behavior of the `copy.deepcopy` function\n        in the python stdlib to behave like `Time.copy`. Does make a\n        copy of the JD arrays.\n        \"\"\"\n        return self.copy()\n\n    def _advanced_index(self, indices, axis=None, keepdims=False):\n        \"\"\"Turn argmin, argmax output into an advanced index.\n\n        Argmin, argmax output contains indices along a given axis in an array\n        shaped like the other dimensions.  To use this to get values at the\n        correct location, a list is constructed in which the other axes are\n        indexed sequentially.  For ``keepdims`` is ``True``, the net result is\n        the same as constructing an index grid with ``np.ogrid`` and then\n        replacing the ``axis`` item with ``indices`` with its shaped expanded\n        at ``axis``. For ``keepdims`` is ``False``, the result is the same but\n        with the ``axis`` dimension removed from all list entries.\n\n        For ``axis`` is ``None``, this calls :func:`~numpy.unravel_index`.\n\n        Parameters\n        ----------\n        indices : array\n            Output of argmin or argmax.\n        axis : int or None\n            axis along which argmin or argmax was used.\n        keepdims : bool\n            Whether to construct indices that keep or remove the axis along\n            which argmin or argmax was used.  Default: ``False``.\n\n        Returns\n        -------\n        advanced_index : list of arrays\n            Suitable for use as an advanced index.\n        \"\"\"\n        if axis is None:\n            return np.unravel_index(indices, self.shape)\n\n        ndim = self.ndim\n        if axis < 0:\n            axis = axis + ndim\n\n        if keepdims and indices.ndim < self.ndim:\n            indices = np.expand_dims(indices, axis)\n\n        index = [indices\n                 if i == axis\n                 else np.arange(s).reshape(\n                     (1,) * (i if keepdims or i < axis else i - 1)\n                     + (s,)\n                     + (1,) * (ndim - i - (1 if keepdims or i > axis else 2))\n                 )\n                 for i, s in enumerate(self.shape)]\n\n        return tuple(index)\n\n    def argmin(self, axis=None, out=None):\n        \"\"\"Return indices of the minimum values along the given axis.\n\n        This is similar to :meth:`~numpy.ndarray.argmin`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used.  See :func:`~numpy.argmin` for detailed documentation.\n        \"\"\"\n        # First get the minimum at normal precision.\n        jd1, jd2 = self.jd1, self.jd2\n        approx = np.min(jd1 + jd2, axis, keepdims=True)\n\n        # Approx is very close to the true minimum, and by subtracting it at\n        # full precision, all numbers near 0 can be represented correctly,\n        # so we can be sure we get the true minimum.\n        # The below is effectively what would be done for\n        # dt = (self - self.__class__(approx, format='jd')).jd\n        # which translates to:\n        # approx_jd1, approx_jd2 = day_frac(approx, 0.)\n        # dt = (self.jd1 - approx_jd1) + (self.jd2 - approx_jd2)\n        dt = (jd1 - approx) + jd2\n\n        return dt.argmin(axis, out)\n\n    def argmax(self, axis=None, out=None):\n        \"\"\"Return indices of the maximum values along the given axis.\n\n        This is similar to :meth:`~numpy.ndarray.argmax`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used.  See :func:`~numpy.argmax` for detailed documentation.\n        \"\"\"\n        # For procedure, see comment on argmin.\n        jd1, jd2 = self.jd1, self.jd2\n        approx = np.max(jd1 + jd2, axis, keepdims=True)\n\n        dt = (jd1 - approx) + jd2\n\n        return dt.argmax(axis, out)\n\n    def argsort(self, axis=-1):\n        \"\"\"Returns the indices that would sort the time array.\n\n        This is similar to :meth:`~numpy.ndarray.argsort`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used, and that corresponding attributes are copied.  Internally,\n        it uses :func:`~numpy.lexsort`, and hence no sort method can be chosen.\n        \"\"\"\n        # For procedure, see comment on argmin.\n        jd1, jd2 = self.jd1, self.jd2\n        approx = jd1 + jd2\n        remainder = (jd1 - approx) + jd2\n\n        if axis is None:\n            return np.lexsort((remainder.ravel(), approx.ravel()))\n        else:\n            return np.lexsort(keys=(remainder, approx), axis=axis)\n\n    def min(self, axis=None, out=None, keepdims=False):\n        \"\"\"Minimum along a given axis.\n\n        This is similar to :meth:`~numpy.ndarray.min`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used, and that corresponding attributes are copied.\n\n        Note that the ``out`` argument is present only for compatibility with\n        ``np.min``; since `Time` instances are immutable, it is not possible\n        to have an actual ``out`` to store the result in.\n        \"\"\"\n        if out is not None:\n            raise ValueError(\"Since `Time` instances are immutable, ``out`` \"\n                             \"cannot be set to anything but ``None``.\")\n        return self[self._advanced_index(self.argmin(axis), axis, keepdims)]\n\n    def max(self, axis=None, out=None, keepdims=False):\n        \"\"\"Maximum along a given axis.\n\n        This is similar to :meth:`~numpy.ndarray.max`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used, and that corresponding attributes are copied.\n\n        Note that the ``out`` argument is present only for compatibility with\n        ``np.max``; since `Time` instances are immutable, it is not possible\n        to have an actual ``out`` to store the result in.\n        \"\"\"\n        if out is not None:\n            raise ValueError(\"Since `Time` instances are immutable, ``out`` \"\n                             \"cannot be set to anything but ``None``.\")\n        return self[self._advanced_index(self.argmax(axis), axis, keepdims)]\n\n    def ptp(self, axis=None, out=None, keepdims=False):\n        \"\"\"Peak to peak (maximum - minimum) along a given axis.\n\n        This is similar to :meth:`~numpy.ndarray.ptp`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used.\n\n        Note that the ``out`` argument is present only for compatibility with\n        `~numpy.ptp`; since `Time` instances are immutable, it is not possible\n        to have an actual ``out`` to store the result in.\n        \"\"\"\n        if out is not None:\n            raise ValueError(\"Since `Time` instances are immutable, ``out`` \"\n                             \"cannot be set to anything but ``None``.\")\n        return (self.max(axis, keepdims=keepdims)\n                - self.min(axis, keepdims=keepdims))\n\n    def sort(self, axis=-1):\n        \"\"\"Return a copy sorted along the specified axis.\n\n        This is similar to :meth:`~numpy.ndarray.sort`, but internally uses\n        indexing with :func:`~numpy.lexsort` to ensure that the full precision\n        given by the two doubles ``jd1`` and ``jd2`` is kept, and that\n        corresponding attributes are properly sorted and copied as well.\n\n        Parameters\n        ----------\n        axis : int or None\n            Axis to be sorted.  If ``None``, the flattened array is sorted.\n            By default, sort over the last axis.\n        \"\"\"\n        return self[self._advanced_index(self.argsort(axis), axis,\n                                         keepdims=True)]\n\n    @property\n    def cache(self):\n        \"\"\"\n        Return the cache associated with this instance.\n        \"\"\"\n        return self._time.cache\n\n    @cache.deleter\n    def cache(self):\n        del self._time.cache\n\n    def __getattr__(self, attr):\n        \"\"\"\n        Get dynamic attributes to output format or do timescale conversion.\n        \"\"\"\n        if attr in self.SCALES and self.scale is not None:\n            cache = self.cache['scale']\n            if attr not in cache:\n                if attr == self.scale:\n                    tm = self\n                else:\n                    tm = self.replicate()\n                    tm._set_scale(attr)\n                    if tm.shape:\n                        # Prevent future modification of cached array-like object\n                        tm.writeable = False\n                cache[attr] = tm\n            return cache[attr]\n\n        elif attr in self.FORMATS:\n            return self.to_value(attr, subfmt=None)\n\n        elif attr in TIME_SCALES:  # allowed ones done above (self.SCALES)\n            if self.scale is None:\n                raise ScaleValueError(\"Cannot convert TimeDelta with \"\n                                      \"undefined scale to any defined scale.\")\n            else:\n                raise ScaleValueError(\"Cannot convert {} with scale \"\n                                      \"'{}' to scale '{}'\"\n                                      .format(self.__class__.__name__,\n                                              self.scale, attr))\n\n        else:\n            # Should raise AttributeError\n            return self.__getattribute__(attr)\n\n    @override__dir__\n    def __dir__(self):\n        result = set(self.SCALES)\n        result.update(self.FORMATS)\n        return result\n\n    def _match_shape(self, val):\n        \"\"\"\n        Ensure that `val` is matched to length of self.  If val has length 1\n        then broadcast, otherwise cast to double and make sure shape matches.\n        \"\"\"\n        val = _make_array(val, copy=True)  # be conservative and copy\n        if val.size > 1 and val.shape != self.shape:\n            try:\n                # check the value can be broadcast to the shape of self.\n                val = np.broadcast_to(val, self.shape, subok=True)\n            except Exception:\n                raise ValueError('Attribute shape must match or be '\n                                 'broadcastable to that of Time object. '\n                                 'Typically, give either a single value or '\n                                 'one for each time.')\n\n        return val\n\n    def _time_comparison(self, other, op):\n        \"\"\"If other is of same class as self, compare difference in self.scale.\n        Otherwise, return NotImplemented\n        \"\"\"\n        if other.__class__ is not self.__class__:\n            try:\n                other = self.__class__(other, scale=self.scale)\n            except Exception:\n                # Let other have a go.\n                return NotImplemented\n\n        if(self.scale is not None and self.scale not in other.SCALES\n           or other.scale is not None and other.scale not in self.SCALES):\n            # Other will also not be able to do it, so raise a TypeError\n            # immediately, allowing us to explain why it doesn't work.\n            raise TypeError(\"Cannot compare {} instances with scales \"\n                            \"'{}' and '{}'\".format(self.__class__.__name__,\n                                                   self.scale, other.scale))\n\n        if self.scale is not None and other.scale is not None:\n            other = getattr(other, self.scale)\n\n        return op((self.jd1 - other.jd1) + (self.jd2 - other.jd2), 0.)\n\n    def __lt__(self, other):\n        return self._time_comparison(other, operator.lt)\n\n    def __le__(self, other):\n        return self._time_comparison(other, operator.le)\n\n    def __eq__(self, other):\n        \"\"\"\n        If other is an incompatible object for comparison, return `False`.\n        Otherwise, return `True` if the time difference between self and\n        other is zero.\n        \"\"\"\n        return self._time_comparison(other, operator.eq)\n\n    def __ne__(self, other):\n        \"\"\"\n        If other is an incompatible object for comparison, return `True`.\n        Otherwise, return `False` if the time difference between self and\n        other is zero.\n        \"\"\"\n        return self._time_comparison(other, operator.ne)\n\n    def __gt__(self, other):\n        return self._time_comparison(other, operator.gt)\n\n    def __ge__(self, other):\n        return self._time_comparison(other, operator.ge)"},{"col":0,"comment":"\n    Handle a single .fits file,  returning the count of checksum and compliance\n    errors.\n    ","endLoc":220,"header":"def process_file(filename)","id":2763,"name":"process_file","nodeType":"Function","startLoc":203,"text":"def process_file(filename):\n    \"\"\"\n    Handle a single .fits file,  returning the count of checksum and compliance\n    errors.\n    \"\"\"\n\n    try:\n        checksum_errors = verify_checksums(filename)\n        if OPTIONS.compliance:\n            compliance_errors = verify_compliance(filename)\n        else:\n            compliance_errors = 0\n        if OPTIONS.write_file and checksum_errors == 0 or OPTIONS.force:\n            update(filename)\n        return checksum_errors + compliance_errors\n    except Exception as e:\n        log.error(f'EXCEPTION {filename!r} .. {e}')\n        return 1"},{"attributeType":"null","col":4,"comment":"null","endLoc":1379,"id":2764,"name":"info","nodeType":"Attribute","startLoc":1379,"text":"info"},{"className":"ShapedLikeNDArray","col":0,"comment":"Mixin class to provide shape-changing methods.\n\n    The class proper is assumed to have some underlying data, which are arrays\n    or array-like structures. It must define a ``shape`` property, which gives\n    the shape of those data, as well as an ``_apply`` method that creates a new\n    instance in which a `~numpy.ndarray` method has been applied to those.\n\n    Furthermore, for consistency with `~numpy.ndarray`, it is recommended to\n    define a setter for the ``shape`` property, which, like the\n    `~numpy.ndarray.shape` property allows in-place reshaping the internal data\n    (and, unlike the ``reshape`` method raises an exception if this is not\n    possible).\n\n    This class also defines default implementations for ``ndim`` and ``size``\n    properties, calculating those from the ``shape``.  These can be overridden\n    by subclasses if there are faster ways to obtain those numbers.\n\n    ","endLoc":300,"id":2765,"nodeType":"Class","startLoc":137,"text":"class ShapedLikeNDArray(NDArrayShapeMethods, metaclass=abc.ABCMeta):\n    \"\"\"Mixin class to provide shape-changing methods.\n\n    The class proper is assumed to have some underlying data, which are arrays\n    or array-like structures. It must define a ``shape`` property, which gives\n    the shape of those data, as well as an ``_apply`` method that creates a new\n    instance in which a `~numpy.ndarray` method has been applied to those.\n\n    Furthermore, for consistency with `~numpy.ndarray`, it is recommended to\n    define a setter for the ``shape`` property, which, like the\n    `~numpy.ndarray.shape` property allows in-place reshaping the internal data\n    (and, unlike the ``reshape`` method raises an exception if this is not\n    possible).\n\n    This class also defines default implementations for ``ndim`` and ``size``\n    properties, calculating those from the ``shape``.  These can be overridden\n    by subclasses if there are faster ways to obtain those numbers.\n\n    \"\"\"\n\n    # Note to developers: if new methods are added here, be sure to check that\n    # they work properly with the classes that use this, such as Time and\n    # BaseRepresentation, i.e., look at their ``_apply`` methods and add\n    # relevant tests.  This is particularly important for methods that imply\n    # copies rather than views of data (see the special-case treatment of\n    # 'flatten' in Time).\n\n    @property\n    @abc.abstractmethod\n    def shape(self):\n        \"\"\"The shape of the underlying data.\"\"\"\n\n    @abc.abstractmethod\n    def _apply(method, *args, **kwargs):\n        \"\"\"Create a new instance, with ``method`` applied to underlying data.\n\n        The method is any of the shape-changing methods for `~numpy.ndarray`\n        (``reshape``, ``swapaxes``, etc.), as well as those picking particular\n        elements (``__getitem__``, ``take``, etc.). It will be applied to the\n        underlying arrays (e.g., ``jd1`` and ``jd2`` in `~astropy.time.Time`),\n        with the results used to create a new instance.\n\n        Parameters\n        ----------\n        method : str\n            Method to be applied to the instance's internal data arrays.\n        args : tuple\n            Any positional arguments for ``method``.\n        kwargs : dict\n            Any keyword arguments for ``method``.\n\n        \"\"\"\n\n    @property\n    def ndim(self):\n        \"\"\"The number of dimensions of the instance and underlying arrays.\"\"\"\n        return len(self.shape)\n\n    @property\n    def size(self):\n        \"\"\"The size of the object, as calculated from its shape.\"\"\"\n        size = 1\n        for sh in self.shape:\n            size *= sh\n        return size\n\n    @property\n    def isscalar(self):\n        return self.shape == ()\n\n    def __len__(self):\n        if self.isscalar:\n            raise TypeError(\"Scalar {!r} object has no len()\"\n                            .format(self.__class__.__name__))\n        return self.shape[0]\n\n    def __bool__(self):\n        \"\"\"Any instance should evaluate to True, except when it is empty.\"\"\"\n        return self.size > 0\n\n    def __getitem__(self, item):\n        try:\n            return self._apply('__getitem__', item)\n        except IndexError:\n            if self.isscalar:\n                raise TypeError('scalar {!r} object is not subscriptable.'\n                                .format(self.__class__.__name__))\n            else:\n                raise\n\n    def __iter__(self):\n        if self.isscalar:\n            raise TypeError('scalar {!r} object is not iterable.'\n                            .format(self.__class__.__name__))\n\n        # We cannot just write a generator here, since then the above error\n        # would only be raised once we try to use the iterator, rather than\n        # upon its definition using iter(self).\n        def self_iter():\n            for idx in range(len(self)):\n                yield self[idx]\n\n        return self_iter()\n\n    # Functions that change shape or essentially do indexing.\n    _APPLICABLE_FUNCTIONS = {\n        np.moveaxis, np.rollaxis,\n        np.atleast_1d, np.atleast_2d, np.atleast_3d, np.expand_dims,\n        np.broadcast_to, np.flip, np.fliplr, np.flipud, np.rot90,\n        np.roll, np.delete,\n        }\n\n    # Functions that themselves defer to a method. Those are all\n    # defined in np.core.fromnumeric, but exclude alen as well as\n    # sort and partition, which make copies before calling the method.\n    _METHOD_FUNCTIONS = {getattr(np, name):\n                         {'amax': 'max', 'amin': 'min', 'around': 'round',\n                          'round_': 'round', 'alltrue': 'all',\n                          'sometrue': 'any'}.get(name, name)\n                         for name in np.core.fromnumeric.__all__\n                         if name not in ['alen', 'sort', 'partition']}\n    # Add np.copy, which we may as well let defer to our method.\n    _METHOD_FUNCTIONS[np.copy] = 'copy'\n\n    # Could be made to work with a bit of effort:\n    # np.where, np.compress, np.extract,\n    # np.diag_indices_from, np.triu_indices_from, np.tril_indices_from\n    # np.tile, np.repeat (need .repeat method)\n    # TODO: create a proper implementation.\n    # Furthermore, some arithmetic functions such as np.mean, np.median,\n    # could work for Time, and many more for TimeDelta, so those should\n    # override __array_function__.\n    def __array_function__(self, function, types, args, kwargs):\n        \"\"\"Wrap numpy functions that make sense.\"\"\"\n        if function in self._APPLICABLE_FUNCTIONS:\n            if function is np.broadcast_to:\n                # Ensure that any ndarray subclasses used are\n                # properly propagated.\n                kwargs.setdefault('subok', True)\n            elif (function in {np.atleast_1d,\n                               np.atleast_2d,\n                               np.atleast_3d}\n                  and len(args) > 1):\n                return tuple(function(arg, **kwargs) for arg in args)\n\n            if self is not args[0]:\n                return NotImplemented\n\n            return self._apply(function, *args[1:], **kwargs)\n\n        # For functions that defer to methods, use the corresponding\n        # method/attribute if we have it.  Otherwise, fall through.\n        if self is args[0] and function in self._METHOD_FUNCTIONS:\n            method = getattr(self, self._METHOD_FUNCTIONS[function], None)\n            if method is not None:\n                if callable(method):\n                    return method(*args[1:], **kwargs)\n                else:\n                    # For np.shape, etc., just return the attribute.\n                    return method\n\n        # Fall-back, just pass the arguments on since perhaps the function\n        # works already (see above).\n        return function.__wrapped__(*args, **kwargs)"},{"className":"NDArrayShapeMethods","col":0,"comment":"Mixin class to provide shape-changing methods.\n\n    The class proper is assumed to have some underlying data, which are arrays\n    or array-like structures. It must define a ``shape`` property, which gives\n    the shape of those data, as well as an ``_apply`` method that creates a new\n    instance in which a `~numpy.ndarray` method has been applied to those.\n\n    Furthermore, for consistency with `~numpy.ndarray`, it is recommended to\n    define a setter for the ``shape`` property, which, like the\n    `~numpy.ndarray.shape` property allows in-place reshaping the internal data\n    (and, unlike the ``reshape`` method raises an exception if this is not\n    possible).\n\n    This class only provides the shape-changing methods and is meant in\n    particular for `~numpy.ndarray` subclasses that need to keep track of\n    other arrays.  For other classes, `~astropy.utils.shapes.ShapedLikeNDArray`\n    is recommended.\n\n    ","endLoc":134,"id":2766,"nodeType":"Class","startLoc":13,"text":"class NDArrayShapeMethods:\n    \"\"\"Mixin class to provide shape-changing methods.\n\n    The class proper is assumed to have some underlying data, which are arrays\n    or array-like structures. It must define a ``shape`` property, which gives\n    the shape of those data, as well as an ``_apply`` method that creates a new\n    instance in which a `~numpy.ndarray` method has been applied to those.\n\n    Furthermore, for consistency with `~numpy.ndarray`, it is recommended to\n    define a setter for the ``shape`` property, which, like the\n    `~numpy.ndarray.shape` property allows in-place reshaping the internal data\n    (and, unlike the ``reshape`` method raises an exception if this is not\n    possible).\n\n    This class only provides the shape-changing methods and is meant in\n    particular for `~numpy.ndarray` subclasses that need to keep track of\n    other arrays.  For other classes, `~astropy.utils.shapes.ShapedLikeNDArray`\n    is recommended.\n\n    \"\"\"\n\n    # Note to developers: if new methods are added here, be sure to check that\n    # they work properly with the classes that use this, such as Time and\n    # BaseRepresentation, i.e., look at their ``_apply`` methods and add\n    # relevant tests.  This is particularly important for methods that imply\n    # copies rather than views of data (see the special-case treatment of\n    # 'flatten' in Time).\n\n    def __getitem__(self, item):\n        return self._apply('__getitem__', item)\n\n    def copy(self, *args, **kwargs):\n        \"\"\"Return an instance containing copies of the internal data.\n\n        Parameters are as for :meth:`~numpy.ndarray.copy`.\n        \"\"\"\n        return self._apply('copy', *args, **kwargs)\n\n    def reshape(self, *args, **kwargs):\n        \"\"\"Returns an instance containing the same data with a new shape.\n\n        Parameters are as for :meth:`~numpy.ndarray.reshape`.  Note that it is\n        not always possible to change the shape of an array without copying the\n        data (see :func:`~numpy.reshape` documentation). If you want an error\n        to be raise if the data is copied, you should assign the new shape to\n        the shape attribute (note: this may not be implemented for all classes\n        using ``NDArrayShapeMethods``).\n        \"\"\"\n        return self._apply('reshape', *args, **kwargs)\n\n    def ravel(self, *args, **kwargs):\n        \"\"\"Return an instance with the array collapsed into one dimension.\n\n        Parameters are as for :meth:`~numpy.ndarray.ravel`. Note that it is\n        not always possible to unravel an array without copying the data.\n        If you want an error to be raise if the data is copied, you should\n        should assign shape ``(-1,)`` to the shape attribute.\n        \"\"\"\n        return self._apply('ravel', *args, **kwargs)\n\n    def flatten(self, *args, **kwargs):\n        \"\"\"Return a copy with the array collapsed into one dimension.\n\n        Parameters are as for :meth:`~numpy.ndarray.flatten`.\n        \"\"\"\n        return self._apply('flatten', *args, **kwargs)\n\n    def transpose(self, *args, **kwargs):\n        \"\"\"Return an instance with the data transposed.\n\n        Parameters are as for :meth:`~numpy.ndarray.transpose`.  All internal\n        data are views of the data of the original.\n        \"\"\"\n        return self._apply('transpose', *args, **kwargs)\n\n    @property\n    def T(self):\n        \"\"\"Return an instance with the data transposed.\n\n        Parameters are as for :attr:`~numpy.ndarray.T`.  All internal\n        data are views of the data of the original.\n        \"\"\"\n        if self.ndim < 2:\n            return self\n        else:\n            return self.transpose()\n\n    def swapaxes(self, *args, **kwargs):\n        \"\"\"Return an instance with the given axes interchanged.\n\n        Parameters are as for :meth:`~numpy.ndarray.swapaxes`:\n        ``axis1, axis2``.  All internal data are views of the data of the\n        original.\n        \"\"\"\n        return self._apply('swapaxes', *args, **kwargs)\n\n    def diagonal(self, *args, **kwargs):\n        \"\"\"Return an instance with the specified diagonals.\n\n        Parameters are as for :meth:`~numpy.ndarray.diagonal`.  All internal\n        data are views of the data of the original.\n        \"\"\"\n        return self._apply('diagonal', *args, **kwargs)\n\n    def squeeze(self, *args, **kwargs):\n        \"\"\"Return an instance with single-dimensional shape entries removed\n\n        Parameters are as for :meth:`~numpy.ndarray.squeeze`.  All internal\n        data are views of the data of the original.\n        \"\"\"\n        return self._apply('squeeze', *args, **kwargs)\n\n    def take(self, indices, axis=None, out=None, mode='raise'):\n        \"\"\"Return a new instance formed from the elements at the given indices.\n\n        Parameters are as for :meth:`~numpy.ndarray.take`, except that,\n        obviously, no output array can be given.\n        \"\"\"\n        if out is not None:\n            return NotImplementedError(\"cannot pass 'out' argument to 'take.\")\n\n        return self._apply('take', indices, axis=axis, mode=mode)"},{"col":4,"comment":"null","endLoc":42,"header":"def __getitem__(self, item)","id":2767,"name":"__getitem__","nodeType":"Function","startLoc":41,"text":"def __getitem__(self, item):\n        return self._apply('__getitem__', item)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1600,"id":2768,"name":"name","nodeType":"Attribute","startLoc":1600,"text":"name"},{"col":4,"comment":"Return an instance containing copies of the internal data.\n\n        Parameters are as for :meth:`~numpy.ndarray.copy`.\n        ","endLoc":49,"header":"def copy(self, *args, **kwargs)","id":2769,"name":"copy","nodeType":"Function","startLoc":44,"text":"def copy(self, *args, **kwargs):\n        \"\"\"Return an instance containing copies of the internal data.\n\n        Parameters are as for :meth:`~numpy.ndarray.copy`.\n        \"\"\"\n        return self._apply('copy', *args, **kwargs)"},{"col":4,"comment":"Returns an instance containing the same data with a new shape.\n\n        Parameters are as for :meth:`~numpy.ndarray.reshape`.  Note that it is\n        not always possible to change the shape of an array without copying the\n        data (see :func:`~numpy.reshape` documentation). If you want an error\n        to be raise if the data is copied, you should assign the new shape to\n        the shape attribute (note: this may not be implemented for all classes\n        using ``NDArrayShapeMethods``).\n        ","endLoc":61,"header":"def reshape(self, *args, **kwargs)","id":2770,"name":"reshape","nodeType":"Function","startLoc":51,"text":"def reshape(self, *args, **kwargs):\n        \"\"\"Returns an instance containing the same data with a new shape.\n\n        Parameters are as for :meth:`~numpy.ndarray.reshape`.  Note that it is\n        not always possible to change the shape of an array without copying the\n        data (see :func:`~numpy.reshape` documentation). If you want an error\n        to be raise if the data is copied, you should assign the new shape to\n        the shape attribute (note: this may not be implemented for all classes\n        using ``NDArrayShapeMethods``).\n        \"\"\"\n        return self._apply('reshape', *args, **kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1601,"id":2771,"name":"copy","nodeType":"Attribute","startLoc":1601,"text":"copy"},{"col":4,"comment":"Return an instance with the array collapsed into one dimension.\n\n        Parameters are as for :meth:`~numpy.ndarray.ravel`. Note that it is\n        not always possible to unravel an array without copying the data.\n        If you want an error to be raise if the data is copied, you should\n        should assign shape ``(-1,)`` to the shape attribute.\n        ","endLoc":71,"header":"def ravel(self, *args, **kwargs)","id":2772,"name":"ravel","nodeType":"Function","startLoc":63,"text":"def ravel(self, *args, **kwargs):\n        \"\"\"Return an instance with the array collapsed into one dimension.\n\n        Parameters are as for :meth:`~numpy.ndarray.ravel`. Note that it is\n        not always possible to unravel an array without copying the data.\n        If you want an error to be raise if the data is copied, you should\n        should assign shape ``(-1,)`` to the shape attribute.\n        \"\"\"\n        return self._apply('ravel', *args, **kwargs)"},{"col":4,"comment":"null","endLoc":255,"header":"def insert(self, key, card, useblanks=True, after=False)","id":2773,"name":"insert","nodeType":"Function","startLoc":210,"text":"def insert(self, key, card, useblanks=True, after=False):\n        if isinstance(key, int):\n            # Determine condition to pass through to append\n            if after:\n                if key == -1:\n                    key = len(self._cards)\n                else:\n                    key += 1\n\n            if key >= len(self._cards):\n                self.append(card, end=True)\n                return\n\n        if isinstance(card, str):\n            card = Card(card)\n        elif isinstance(card, tuple):\n            card = Card(*card)\n        elif not isinstance(card, Card):\n            raise ValueError(\n                'The value inserted into a Header must be either a keyword or '\n                '(keyword, value, [comment]) tuple; got: {!r}'.format(card))\n\n        if self._is_reserved_keyword(card.keyword):\n            return\n\n        # Now the tricky part is to determine where to insert in the table\n        # header.  If given a numerical index we need to map that to the\n        # corresponding index in the table header.  Although rare, there may be\n        # cases where there is no mapping in which case we just try the same\n        # index\n        # NOTE: It is crucial that remapped_index in particular is figured out\n        # before the image header is modified\n        remapped_index = self._remap_index(key)\n        remapped_keyword = self._remap_keyword(card.keyword)\n\n        super().insert(key, card, useblanks=useblanks, after=after)\n\n        card = Card(remapped_keyword, card.value, card.comment)\n\n        # Here we disable the use of blank cards, because the call above to\n        # Header.insert may have already deleted a blank card in the table\n        # header, thanks to inheritance: Header.insert calls 'del self[-1]'\n        # to delete a blank card, which calls CompImageHeader.__delitem__,\n        # which deletes the blank card both in the image and the table headers!\n        self._table_header.insert(remapped_index, card, useblanks=False,\n                                  after=after)"},{"col":4,"comment":"Return a copy with the array collapsed into one dimension.\n\n        Parameters are as for :meth:`~numpy.ndarray.flatten`.\n        ","endLoc":78,"header":"def flatten(self, *args, **kwargs)","id":2774,"name":"flatten","nodeType":"Function","startLoc":73,"text":"def flatten(self, *args, **kwargs):\n        \"\"\"Return a copy with the array collapsed into one dimension.\n\n        Parameters are as for :meth:`~numpy.ndarray.flatten`.\n        \"\"\"\n        return self._apply('flatten', *args, **kwargs)"},{"col":0,"comment":"\n    Processes command line parameters into options and files,  then checks\n    or update FITS DATASUM and CHECKSUM keywords for the specified files.\n    ","endLoc":236,"header":"def main(args=None)","id":2775,"name":"main","nodeType":"Function","startLoc":223,"text":"def main(args=None):\n    \"\"\"\n    Processes command line parameters into options and files,  then checks\n    or update FITS DATASUM and CHECKSUM keywords for the specified files.\n    \"\"\"\n\n    errors = 0\n    fits_files = handle_options(args or sys.argv[1:])\n    setup_logging()\n    for filename in fits_files:\n        errors += process_file(filename)\n    if errors:\n        log.warning(f'{errors} errors')\n    return int(bool(errors))"},{"attributeType":"null","col":4,"comment":"null","endLoc":1602,"id":2776,"name":"more","nodeType":"Attribute","startLoc":1602,"text":"more"},{"col":4,"comment":"Return an instance with the data transposed.\n\n        Parameters are as for :meth:`~numpy.ndarray.transpose`.  All internal\n        data are views of the data of the original.\n        ","endLoc":86,"header":"def transpose(self, *args, **kwargs)","id":2777,"name":"transpose","nodeType":"Function","startLoc":80,"text":"def transpose(self, *args, **kwargs):\n        \"\"\"Return an instance with the data transposed.\n\n        Parameters are as for :meth:`~numpy.ndarray.transpose`.  All internal\n        data are views of the data of the original.\n        \"\"\"\n        return self._apply('transpose', *args, **kwargs)"},{"col":4,"comment":"Return an instance with the data transposed.\n\n        Parameters are as for :attr:`~numpy.ndarray.T`.  All internal\n        data are views of the data of the original.\n        ","endLoc":98,"header":"@property\n    def T(self)","id":2778,"name":"T","nodeType":"Function","startLoc":88,"text":"@property\n    def T(self):\n        \"\"\"Return an instance with the data transposed.\n\n        Parameters are as for :attr:`~numpy.ndarray.T`.  All internal\n        data are views of the data of the original.\n        \"\"\"\n        if self.ndim < 2:\n            return self\n        else:\n            return self.transpose()"},{"col":4,"comment":"Return an instance with the given axes interchanged.\n\n        Parameters are as for :meth:`~numpy.ndarray.swapaxes`:\n        ``axis1, axis2``.  All internal data are views of the data of the\n        original.\n        ","endLoc":107,"header":"def swapaxes(self, *args, **kwargs)","id":2779,"name":"swapaxes","nodeType":"Function","startLoc":100,"text":"def swapaxes(self, *args, **kwargs):\n        \"\"\"Return an instance with the given axes interchanged.\n\n        Parameters are as for :meth:`~numpy.ndarray.swapaxes`:\n        ``axis1, axis2``.  All internal data are views of the data of the\n        original.\n        \"\"\"\n        return self._apply('swapaxes', *args, **kwargs)"},{"attributeType":"null","col":0,"comment":"null","endLoc":51,"id":2780,"name":"log","nodeType":"Attribute","startLoc":51,"text":"log"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":2781,"name":"DESCRIPTION","nodeType":"Attribute","startLoc":53,"text":"DESCRIPTION"},{"col":0,"comment":"","endLoc":40,"header":"fitscheck.py#<anonymous>","id":2782,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n``fitscheck`` is a command line script based on astropy.io.fits for verifying\nand updating the CHECKSUM and DATASUM keywords of .fits files.  ``fitscheck``\ncan also detect and often fix other FITS standards violations.  ``fitscheck``\nfacilitates re-writing the non-standard checksums originally generated by\nastropy.io.fits with standard checksums which will interoperate with CFITSIO.\n\n``fitscheck`` will refuse to write new checksums if the checksum keywords are\nmissing or their values are bad.  Use ``--force`` to write new checksums\nregardless of whether or not they currently exist or pass.  Use\n``--ignore-missing`` to tolerate missing checksum keywords without comment.\n\nExample uses of fitscheck:\n\n1. Add checksums::\n\n    $ fitscheck --write *.fits\n\n2. Write new checksums, even if existing checksums are bad or missing::\n\n    $ fitscheck --write --force *.fits\n\n3. Verify standard checksums and FITS compliance without changing the files::\n\n    $ fitscheck --compliance *.fits\n\n4. Only check and fix compliance problems,  ignoring checksums::\n\n    $ fitscheck --checksum none --compliance --write *.fits\n\n5. Verify standard interoperable checksums::\n\n    $ fitscheck *.fits\n\n6. Delete checksum keywords::\n\n    $ fitscheck --checksum remove --write *.fits\n\n\"\"\"\n\nlog = logging.getLogger('fitscheck')\n\nDESCRIPTION = \"\"\"\ne.g. fitscheck example.fits\n\nVerifies and optionally re-writes the CHECKSUM and DATASUM keywords\nfor a .fits file.\nOptionally detects and fixes FITS standard compliance problems.\n\nThis script is part of the Astropy package. See\nhttps://docs.astropy.org/en/latest/io/fits/usage/scripts.html#module-astropy.io.fits.scripts.fitscheck\nfor further documentation.\n\"\"\".strip()"},{"col":4,"comment":"Return an instance with the specified diagonals.\n\n        Parameters are as for :meth:`~numpy.ndarray.diagonal`.  All internal\n        data are views of the data of the original.\n        ","endLoc":115,"header":"def diagonal(self, *args, **kwargs)","id":2783,"name":"diagonal","nodeType":"Function","startLoc":109,"text":"def diagonal(self, *args, **kwargs):\n        \"\"\"Return an instance with the specified diagonals.\n\n        Parameters are as for :meth:`~numpy.ndarray.diagonal`.  All internal\n        data are views of the data of the original.\n        \"\"\"\n        return self._apply('diagonal', *args, **kwargs)"},{"fileName":"fitsdiff.py","filePath":"astropy/io/fits/scripts","id":2784,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport argparse\nimport glob\nimport logging\nimport os\nimport sys\n\nfrom astropy.io import fits\nfrom astropy.io.fits.util import fill\nfrom astropy import __version__\n\n\nlog = logging.getLogger('fitsdiff')\n\n\nDESCRIPTION = \"\"\"\nCompare two FITS image files and report the differences in header keywords and\ndata.\n\n    fitsdiff [options] filename1 filename2\n\nwhere filename1 filename2 are the two files to be compared.  They may also be\nwild cards, in such cases, they must be enclosed by double or single quotes, or\nthey may be directory names.  If both are directory names, all files in each of\nthe directories will be included; if only one is a directory name, then the\ndirectory name will be prefixed to the file name(s) specified by the other\nargument.  for example::\n\n    fitsdiff \"*.fits\" \"/machine/data1\"\n\nwill compare all FITS files in the current directory to the corresponding files\nin the directory /machine/data1.\n\nThis script is part of the Astropy package. See\nhttps://docs.astropy.org/en/latest/io/fits/usage/scripts.html#fitsdiff\nfor further documentation.\n\"\"\".strip()\n\n\nEPILOG = fill(\"\"\"\nIf the two files are identical within the specified conditions, it will report\n\"No difference is found.\" If the value(s) of -c and -k takes the form\n'@filename', list is in the text file 'filename', and each line in that text\nfile contains one keyword.\n\nExample\n-------\n\n    fitsdiff -k filename,filtnam1 -n 5 -r 1.e-6 test1.fits test2\n\nThis command will compare files test1.fits and test2.fits, report maximum of 5\ndifferent pixels values per extension, only report data values larger than\n1.e-6 relative to each other, and will neglect the different values of keywords\nFILENAME and FILTNAM1 (or their very existence).\n\nfitsdiff command-line arguments can also be set using the environment variable\nFITSDIFF_SETTINGS.  If the FITSDIFF_SETTINGS environment variable is present,\neach argument present will override the corresponding argument on the\ncommand-line unless the --exact option is specified.  The FITSDIFF_SETTINGS\nenvironment variable exists to make it easier to change the\nbehavior of fitsdiff on a global level, such as in a set of regression tests.\n\"\"\".strip(), width=80)\n\n\nclass StoreListAction(argparse.Action):\n    def __init__(self, option_strings, dest, nargs=None, **kwargs):\n        if nargs is not None:\n            raise ValueError(\"nargs not allowed\")\n        super().__init__(option_strings, dest, nargs, **kwargs)\n\n    def __call__(self, parser, namespace, values, option_string=None):\n        setattr(namespace, self.dest, [])\n        # Accept either a comma-separated list or a filename (starting with @)\n        # containing a value on each line\n        if values and values[0] == '@':\n            value = values[1:]\n            if not os.path.exists(value):\n                log.warning(f'{self.dest} argument {value} does not exist')\n                return\n            try:\n                values = [v.strip() for v in open(value, 'r').readlines()]\n                setattr(namespace, self.dest, values)\n            except OSError as exc:\n                log.warning('reading {} for {} failed: {}; ignoring this '\n                            'argument'.format(value, self.dest, exc))\n                del exc\n        else:\n            setattr(namespace, self.dest,\n                    [v.strip() for v in values.split(',')])\n\n\ndef handle_options(argv=None):\n    parser = argparse.ArgumentParser(\n        description=DESCRIPTION, epilog=EPILOG,\n        formatter_class=argparse.RawDescriptionHelpFormatter)\n\n    parser.add_argument(\n        '--version', action='version',\n        version=f'%(prog)s {__version__}')\n\n    parser.add_argument(\n        'fits_files', metavar='file', nargs='+',\n        help='.fits files to process.')\n\n    parser.add_argument(\n        '-q', '--quiet', action='store_true',\n        help='Produce no output and just return a status code.')\n\n    parser.add_argument(\n        '-n', '--num-diffs', type=int, default=10, dest='numdiffs',\n        metavar='INTEGER',\n        help='Max number of data differences (image pixel or table element) '\n             'to report per extension (default %(default)s).')\n\n    parser.add_argument(\n        '-r', '--rtol', '--relative-tolerance', type=float, default=None,\n        dest='rtol', metavar='NUMBER',\n        help='The relative tolerance for comparison of two numbers, '\n             'specifically two floating point numbers.  This applies to data '\n             'in both images and tables, and to floating point keyword values '\n             'in headers (default %(default)s).')\n\n    parser.add_argument(\n        '-a', '--atol', '--absolute-tolerance', type=float, default=None,\n        dest='atol', metavar='NUMBER',\n        help='The absolute tolerance for comparison of two numbers, '\n             'specifically two floating point numbers.  This applies to data '\n             'in both images and tables, and to floating point keyword values '\n             'in headers (default %(default)s).')\n\n    parser.add_argument(\n        '-b', '--no-ignore-blanks', action='store_false',\n        dest='ignore_blanks', default=True,\n        help=\"Don't ignore trailing blanks (whitespace) in string values.  \"\n             \"Otherwise trailing blanks both in header keywords/values and in \"\n             \"table column values) are not treated as significant i.e., \"\n             \"without this option 'ABCDEF   ' and 'ABCDEF' are considered \"\n             \"equivalent. \")\n\n    parser.add_argument(\n        '--no-ignore-blank-cards', action='store_false',\n        dest='ignore_blank_cards', default=True,\n        help=\"Don't ignore entirely blank cards in headers.  Normally fitsdiff \"\n             \"does not consider blank cards when comparing headers, but this \"\n             \"will ensure that even blank cards match up. \")\n\n    parser.add_argument(\n        '--exact', action='store_true',\n        dest='exact_comparisons', default=False,\n        help=\"Report ALL differences, \"\n             \"overriding command-line options and FITSDIFF_SETTINGS. \")\n\n    parser.add_argument(\n        '-o', '--output-file', metavar='FILE',\n        help='Output results to this file; otherwise results are printed to '\n             'stdout.')\n\n    parser.add_argument(\n        '-u', '--ignore-hdus', action=StoreListAction,\n        default=[], dest='ignore_hdus',\n        metavar='HDU_NAMES',\n        help='Comma-separated list of HDU names not to be compared.  HDU '\n             'names may contain wildcard patterns.')\n\n    group = parser.add_argument_group('Header Comparison Options')\n\n    group.add_argument(\n        '-k', '--ignore-keywords', action=StoreListAction,\n        default=[], dest='ignore_keywords',\n        metavar='KEYWORDS',\n        help='Comma-separated list of keywords not to be compared.  Keywords '\n             'may contain wildcard patterns.  To exclude all keywords, use '\n             '\"*\"; make sure to have double or single quotes around the '\n             'asterisk on the command-line.')\n\n    group.add_argument(\n        '-c', '--ignore-comments', action=StoreListAction,\n        default=[], dest='ignore_comments',\n        metavar='COMMENTS',\n        help='Comma-separated list of keywords whose comments will not be '\n             'compared.  Wildcards may be used as with --ignore-keywords.')\n\n    group = parser.add_argument_group('Table Comparison Options')\n\n    group.add_argument(\n        '-f', '--ignore-fields', action=StoreListAction,\n        default=[], dest='ignore_fields',\n        metavar='COLUMNS',\n        help='Comma-separated list of fields (i.e. columns) not to be '\n             'compared.  All columns may be excluded using \"*\" as with '\n             '--ignore-keywords.')\n\n    options = parser.parse_args(argv)\n\n    # Determine which filenames to compare\n    if len(options.fits_files) != 2:\n        parser.error('\\nfitsdiff requires two arguments; '\n                     'see `fitsdiff --help` for more details.')\n\n    return options\n\n\ndef setup_logging(outfile=None):\n    log.setLevel(logging.INFO)\n    error_handler = logging.StreamHandler(sys.stderr)\n    error_handler.setFormatter(logging.Formatter('%(levelname)s: %(message)s'))\n    error_handler.setLevel(logging.WARNING)\n    log.addHandler(error_handler)\n\n    if outfile is not None:\n        output_handler = logging.FileHandler(outfile)\n    else:\n        output_handler = logging.StreamHandler()\n\n        class LevelFilter(logging.Filter):\n            \"\"\"Log only messages matching the specified level.\"\"\"\n\n            def __init__(self, name='', level=logging.NOTSET):\n                logging.Filter.__init__(self, name)\n                self.level = level\n\n            def filter(self, rec):\n                return rec.levelno == self.level\n\n        # File output logs all messages, but stdout logs only INFO messages\n        # (since errors are already logged to stderr)\n        output_handler.addFilter(LevelFilter(level=logging.INFO))\n\n    output_handler.setFormatter(logging.Formatter('%(message)s'))\n    log.addHandler(output_handler)\n\n\ndef match_files(paths):\n    if os.path.isfile(paths[0]) and os.path.isfile(paths[1]):\n        # shortcut if both paths are files\n        return [paths]\n\n    dirnames = [None, None]\n    filelists = [None, None]\n\n    for i, path in enumerate(paths):\n        if glob.has_magic(path):\n            files = [os.path.split(f) for f in glob.glob(path)]\n            if not files:\n                log.error('Wildcard pattern %r did not match any files.', path)\n                sys.exit(2)\n\n            dirs, files = list(zip(*files))\n            if len(set(dirs)) > 1:\n                log.error('Wildcard pattern %r should match only one '\n                          'directory.', path)\n                sys.exit(2)\n\n            dirnames[i] = set(dirs).pop()\n            filelists[i] = sorted(files)\n        elif os.path.isdir(path):\n            dirnames[i] = path\n            filelists[i] = [f for f in sorted(os.listdir(path))\n                            if os.path.isfile(os.path.join(path, f))]\n        elif os.path.isfile(path):\n            dirnames[i] = os.path.dirname(path)\n            filelists[i] = [os.path.basename(path)]\n        else:\n            log.error(\n                '%r is not an existing file, directory, or wildcard '\n                'pattern; see `fitsdiff --help` for more usage help.', path)\n            sys.exit(2)\n\n        dirnames[i] = os.path.abspath(dirnames[i])\n\n    filematch = set(filelists[0]) & set(filelists[1])\n\n    for a, b in [(0, 1), (1, 0)]:\n        if len(filelists[a]) > len(filematch) and not os.path.isdir(paths[a]):\n            for extra in sorted(set(filelists[a]) - filematch):\n                log.warning('%r has no match in %r', extra, dirnames[b])\n\n    return [(os.path.join(dirnames[0], f),\n             os.path.join(dirnames[1], f)) for f in filematch]\n\n\ndef main(args=None):\n    args = args or sys.argv[1:]\n\n    if 'FITSDIFF_SETTINGS' in os.environ:\n        args = os.environ['FITSDIFF_SETTINGS'].split() + args\n\n    opts = handle_options(args)\n\n    if opts.rtol is None:\n        opts.rtol = 0.0\n    if opts.atol is None:\n        opts.atol = 0.0\n\n    if opts.exact_comparisons:\n        # override the options so that each is the most restrictive\n        opts.ignore_keywords = []\n        opts.ignore_comments = []\n        opts.ignore_fields = []\n        opts.rtol = 0.0\n        opts.atol = 0.0\n        opts.ignore_blanks = False\n        opts.ignore_blank_cards = False\n\n    if not opts.quiet:\n        setup_logging(opts.output_file)\n    files = match_files(opts.fits_files)\n\n    close_file = False\n    if opts.quiet:\n        out_file = None\n    elif opts.output_file:\n        out_file = open(opts.output_file, 'w')\n        close_file = True\n    else:\n        out_file = sys.stdout\n\n    identical = []\n    try:\n        for a, b in files:\n            # TODO: pass in any additional arguments here too\n            diff = fits.diff.FITSDiff(\n                a, b,\n                ignore_hdus=opts.ignore_hdus,\n                ignore_keywords=opts.ignore_keywords,\n                ignore_comments=opts.ignore_comments,\n                ignore_fields=opts.ignore_fields,\n                numdiffs=opts.numdiffs,\n                rtol=opts.rtol,\n                atol=opts.atol,\n                ignore_blanks=opts.ignore_blanks,\n                ignore_blank_cards=opts.ignore_blank_cards)\n\n            diff.report(fileobj=out_file)\n            identical.append(diff.identical)\n\n        return int(not all(identical))\n    finally:\n        if close_file:\n            out_file.close()\n        # Close the file if used for the logging output, and remove handlers to\n        # avoid having them multiple times for unit tests.\n        for handler in log.handlers:\n            if isinstance(handler, logging.FileHandler):\n                handler.close()\n            log.removeHandler(handler)\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":1603,"id":2785,"name":"pprint","nodeType":"Attribute","startLoc":1603,"text":"pprint"},{"col":4,"comment":"Return an instance with single-dimensional shape entries removed\n\n        Parameters are as for :meth:`~numpy.ndarray.squeeze`.  All internal\n        data are views of the data of the original.\n        ","endLoc":123,"header":"def squeeze(self, *args, **kwargs)","id":2786,"name":"squeeze","nodeType":"Function","startLoc":117,"text":"def squeeze(self, *args, **kwargs):\n        \"\"\"Return an instance with single-dimensional shape entries removed\n\n        Parameters are as for :meth:`~numpy.ndarray.squeeze`.  All internal\n        data are views of the data of the original.\n        \"\"\"\n        return self._apply('squeeze', *args, **kwargs)"},{"col":4,"comment":"Return a new instance formed from the elements at the given indices.\n\n        Parameters are as for :meth:`~numpy.ndarray.take`, except that,\n        obviously, no output array can be given.\n        ","endLoc":134,"header":"def take(self, indices, axis=None, out=None, mode='raise')","id":2787,"name":"take","nodeType":"Function","startLoc":125,"text":"def take(self, indices, axis=None, out=None, mode='raise'):\n        \"\"\"Return a new instance formed from the elements at the given indices.\n\n        Parameters are as for :meth:`~numpy.ndarray.take`, except that,\n        obviously, no output array can be given.\n        \"\"\"\n        if out is not None:\n            return NotImplementedError(\"cannot pass 'out' argument to 'take.\")\n\n        return self._apply('take', indices, axis=axis, mode=mode)"},{"col":4,"comment":"The shape of the underlying data.","endLoc":167,"header":"@property\n    @abc.abstractmethod\n    def shape(self)","id":2788,"name":"shape","nodeType":"Function","startLoc":164,"text":"@property\n    @abc.abstractmethod\n    def shape(self):\n        \"\"\"The shape of the underlying data.\"\"\""},{"col":4,"comment":"Create a new instance, with ``method`` applied to underlying data.\n\n        The method is any of the shape-changing methods for `~numpy.ndarray`\n        (``reshape``, ``swapaxes``, etc.), as well as those picking particular\n        elements (``__getitem__``, ``take``, etc.). It will be applied to the\n        underlying arrays (e.g., ``jd1`` and ``jd2`` in `~astropy.time.Time`),\n        with the results used to create a new instance.\n\n        Parameters\n        ----------\n        method : str\n            Method to be applied to the instance's internal data arrays.\n        args : tuple\n            Any positional arguments for ``method``.\n        kwargs : dict\n            Any keyword arguments for ``method``.\n\n        ","endLoc":188,"header":"@abc.abstractmethod\n    def _apply(method, *args, **kwargs)","id":2789,"name":"_apply","nodeType":"Function","startLoc":169,"text":"@abc.abstractmethod\n    def _apply(method, *args, **kwargs):\n        \"\"\"Create a new instance, with ``method`` applied to underlying data.\n\n        The method is any of the shape-changing methods for `~numpy.ndarray`\n        (``reshape``, ``swapaxes``, etc.), as well as those picking particular\n        elements (``__getitem__``, ``take``, etc.). It will be applied to the\n        underlying arrays (e.g., ``jd1`` and ``jd2`` in `~astropy.time.Time`),\n        with the results used to create a new instance.\n\n        Parameters\n        ----------\n        method : str\n            Method to be applied to the instance's internal data arrays.\n        args : tuple\n            Any positional arguments for ``method``.\n        kwargs : dict\n            Any keyword arguments for ``method``.\n\n        \"\"\""},{"col":4,"comment":"The number of dimensions of the instance and underlying arrays.","endLoc":193,"header":"@property\n    def ndim(self)","id":2790,"name":"ndim","nodeType":"Function","startLoc":190,"text":"@property\n    def ndim(self):\n        \"\"\"The number of dimensions of the instance and underlying arrays.\"\"\"\n        return len(self.shape)"},{"col":4,"comment":"The size of the object, as calculated from its shape.","endLoc":201,"header":"@property\n    def size(self)","id":2791,"name":"size","nodeType":"Function","startLoc":195,"text":"@property\n    def size(self):\n        \"\"\"The size of the object, as calculated from its shape.\"\"\"\n        size = 1\n        for sh in self.shape:\n            size *= sh\n        return size"},{"col":4,"comment":"null","endLoc":205,"header":"@property\n    def isscalar(self)","id":2792,"name":"isscalar","nodeType":"Function","startLoc":203,"text":"@property\n    def isscalar(self):\n        return self.shape == ()"},{"col":4,"comment":"null","endLoc":211,"header":"def __len__(self)","id":2793,"name":"__len__","nodeType":"Function","startLoc":207,"text":"def __len__(self):\n        if self.isscalar:\n            raise TypeError(\"Scalar {!r} object has no len()\"\n                            .format(self.__class__.__name__))\n        return self.shape[0]"},{"attributeType":"null","col":4,"comment":"null","endLoc":1604,"id":2794,"name":"pformat","nodeType":"Attribute","startLoc":1604,"text":"pformat"},{"col":4,"comment":"Any instance should evaluate to True, except when it is empty.","endLoc":215,"header":"def __bool__(self)","id":2795,"name":"__bool__","nodeType":"Function","startLoc":213,"text":"def __bool__(self):\n        \"\"\"Any instance should evaluate to True, except when it is empty.\"\"\"\n        return self.size > 0"},{"col":4,"comment":"null","endLoc":225,"header":"def __getitem__(self, item)","id":2796,"name":"__getitem__","nodeType":"Function","startLoc":217,"text":"def __getitem__(self, item):\n        try:\n            return self._apply('__getitem__', item)\n        except IndexError:\n            if self.isscalar:\n                raise TypeError('scalar {!r} object is not subscriptable.'\n                                .format(self.__class__.__name__))\n            else:\n                raise"},{"attributeType":"null","col":4,"comment":"null","endLoc":1605,"id":2797,"name":"convert_unit_to","nodeType":"Attribute","startLoc":1605,"text":"convert_unit_to"},{"className":"StoreListAction","col":0,"comment":"null","endLoc":89,"id":2798,"nodeType":"Class","startLoc":65,"text":"class StoreListAction(argparse.Action):\n    def __init__(self, option_strings, dest, nargs=None, **kwargs):\n        if nargs is not None:\n            raise ValueError(\"nargs not allowed\")\n        super().__init__(option_strings, dest, nargs, **kwargs)\n\n    def __call__(self, parser, namespace, values, option_string=None):\n        setattr(namespace, self.dest, [])\n        # Accept either a comma-separated list or a filename (starting with @)\n        # containing a value on each line\n        if values and values[0] == '@':\n            value = values[1:]\n            if not os.path.exists(value):\n                log.warning(f'{self.dest} argument {value} does not exist')\n                return\n            try:\n                values = [v.strip() for v in open(value, 'r').readlines()]\n                setattr(namespace, self.dest, values)\n            except OSError as exc:\n                log.warning('reading {} for {} failed: {}; ignoring this '\n                            'argument'.format(value, self.dest, exc))\n                del exc\n        else:\n            setattr(namespace, self.dest,\n                    [v.strip() for v in values.split(',')])"},{"col":4,"comment":"null","endLoc":239,"header":"def __iter__(self)","id":2799,"name":"__iter__","nodeType":"Function","startLoc":227,"text":"def __iter__(self):\n        if self.isscalar:\n            raise TypeError('scalar {!r} object is not iterable.'\n                            .format(self.__class__.__name__))\n\n        # We cannot just write a generator here, since then the above error\n        # would only be raised once we try to use the iterator, rather than\n        # upon its definition using iter(self).\n        def self_iter():\n            for idx in range(len(self)):\n                yield self[idx]\n\n        return self_iter()"},{"attributeType":"null","col":8,"comment":"null","endLoc":1413,"id":2800,"name":"self_data","nodeType":"Attribute","startLoc":1413,"text":"self_data"},{"col":4,"comment":"Wrap numpy functions that make sense.","endLoc":300,"header":"def __array_function__(self, function, types, args, kwargs)","id":2802,"name":"__array_function__","nodeType":"Function","startLoc":269,"text":"def __array_function__(self, function, types, args, kwargs):\n        \"\"\"Wrap numpy functions that make sense.\"\"\"\n        if function in self._APPLICABLE_FUNCTIONS:\n            if function is np.broadcast_to:\n                # Ensure that any ndarray subclasses used are\n                # properly propagated.\n                kwargs.setdefault('subok', True)\n            elif (function in {np.atleast_1d,\n                               np.atleast_2d,\n                               np.atleast_3d}\n                  and len(args) > 1):\n                return tuple(function(arg, **kwargs) for arg in args)\n\n            if self is not args[0]:\n                return NotImplemented\n\n            return self._apply(function, *args[1:], **kwargs)\n\n        # For functions that defer to methods, use the corresponding\n        # method/attribute if we have it.  Otherwise, fall through.\n        if self is args[0] and function in self._METHOD_FUNCTIONS:\n            method = getattr(self, self._METHOD_FUNCTIONS[function], None)\n            if method is not None:\n                if callable(method):\n                    return method(*args[1:], **kwargs)\n                else:\n                    # For np.shape, etc., just return the attribute.\n                    return method\n\n        # Fall-back, just pass the arguments on since perhaps the function\n        # works already (see above).\n        return function.__wrapped__(*args, **kwargs)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1429,"id":2803,"name":"fill_value","nodeType":"Attribute","startLoc":1429,"text":"self.fill_value"},{"col":4,"comment":"null","endLoc":69,"header":"def __init__(self, option_strings, dest, nargs=None, **kwargs)","id":2804,"name":"__init__","nodeType":"Function","startLoc":66,"text":"def __init__(self, option_strings, dest, nargs=None, **kwargs):\n        if nargs is not None:\n            raise ValueError(\"nargs not allowed\")\n        super().__init__(option_strings, dest, nargs, **kwargs)"},{"col":4,"comment":"null","endLoc":335,"header":"@property\n    def world_axis_object_classes(self)","id":2805,"name":"world_axis_object_classes","nodeType":"Function","startLoc":333,"text":"@property\n    def world_axis_object_classes(self):\n        return self._get_components_and_classes()[1]"},{"attributeType":"null","col":8,"comment":"null","endLoc":1416,"id":2806,"name":"self","nodeType":"Attribute","startLoc":1416,"text":"self"},{"col":4,"comment":"null","endLoc":339,"header":"@property\n    def serialized_classes(self)","id":2807,"name":"serialized_classes","nodeType":"Function","startLoc":337,"text":"@property\n    def serialized_classes(self):\n        return False"},{"attributeType":"null","col":16,"comment":"null","endLoc":368,"id":2808,"name":"_components_and_classes_cache","nodeType":"Attribute","startLoc":368,"text":"self._components_and_classes_cache"},{"attributeType":"null","col":8,"comment":"null","endLoc":1431,"id":2809,"name":"parent_table","nodeType":"Attribute","startLoc":1431,"text":"self.parent_table"},{"attributeType":"null","col":12,"comment":"null","endLoc":1403,"id":2810,"name":"mask","nodeType":"Attribute","startLoc":1403,"text":"mask"},{"attributeType":"null","col":12,"comment":"null","endLoc":1421,"id":2811,"name":"info","nodeType":"Attribute","startLoc":1421,"text":"self.info"},{"attributeType":"null","col":8,"comment":"null","endLoc":1462,"id":2812,"name":"_fill_value","nodeType":"Attribute","startLoc":1462,"text":"self._fill_value"},{"col":4,"comment":"null","endLoc":89,"header":"def __call__(self, parser, namespace, values, option_string=None)","id":2813,"name":"__call__","nodeType":"Function","startLoc":71,"text":"def __call__(self, parser, namespace, values, option_string=None):\n        setattr(namespace, self.dest, [])\n        # Accept either a comma-separated list or a filename (starting with @)\n        # containing a value on each line\n        if values and values[0] == '@':\n            value = values[1:]\n            if not os.path.exists(value):\n                log.warning(f'{self.dest} argument {value} does not exist')\n                return\n            try:\n                values = [v.strip() for v in open(value, 'r').readlines()]\n                setattr(namespace, self.dest, values)\n            except OSError as exc:\n                log.warning('reading {} for {} failed: {}; ignoring this '\n                            'argument'.format(value, self.dest, exc))\n                del exc\n        else:\n            setattr(namespace, self.dest,\n                    [v.strip() for v in values.split(',')])"},{"attributeType":"null","col":12,"comment":"null","endLoc":220,"id":2814,"name":"pixel_shape","nodeType":"Attribute","startLoc":220,"text":"self.pixel_shape"},{"attributeType":"null","col":12,"comment":"null","endLoc":249,"id":2815,"name":"_pixel_bounds","nodeType":"Attribute","startLoc":249,"text":"self._pixel_bounds"},{"attributeType":"null","col":12,"comment":"null","endLoc":234,"id":2816,"name":"_naxis","nodeType":"Attribute","startLoc":234,"text":"self._naxis"},{"col":4,"comment":"null","endLoc":555,"header":"def __copy__(self)","id":2817,"name":"__copy__","nodeType":"Function","startLoc":548,"text":"def __copy__(self):\n        new_copy = self.__class__()\n        WCSBase.__init__(new_copy, self.sip,\n                         (self.cpdis1, self.cpdis2),\n                         self.wcs,\n                         (self.det2im1, self.det2im2))\n        new_copy.__dict__.update(self.__dict__)\n        return new_copy"},{"attributeType":"null","col":4,"comment":"null","endLoc":242,"id":2818,"name":"_APPLICABLE_FUNCTIONS","nodeType":"Attribute","startLoc":242,"text":"_APPLICABLE_FUNCTIONS"},{"attributeType":"null","col":4,"comment":"null","endLoc":252,"id":2819,"name":"_METHOD_FUNCTIONS","nodeType":"Attribute","startLoc":252,"text":"_METHOD_FUNCTIONS"},{"col":4,"comment":"null","endLoc":344,"header":"def __getnewargs__(self)","id":2820,"name":"__getnewargs__","nodeType":"Function","startLoc":343,"text":"def __getnewargs__(self):\n        return (self._time,)"},{"col":4,"comment":"null","endLoc":464,"header":"@property\n    def writeable(self)","id":2821,"name":"writeable","nodeType":"Function","startLoc":462,"text":"@property\n    def writeable(self):\n        return self._time.jd1.flags.writeable & self._time.jd2.flags.writeable"},{"col":4,"comment":"null","endLoc":469,"header":"@writeable.setter\n    def writeable(self, value)","id":2822,"name":"writeable","nodeType":"Function","startLoc":466,"text":"@writeable.setter\n    def writeable(self, value):\n        self._time.jd1.flags.writeable = value\n        self._time.jd2.flags.writeable = value"},{"col":4,"comment":"\n        Get or set time format.\n\n        The format defines the way times are represented when accessed via the\n        ``.value`` attribute.  By default it is the same as the format used for\n        initializing the `Time` instance, but it can be set to any other value\n        that could be used for initialization.  These can be listed with::\n\n          >>> list(Time.FORMATS)\n          ['jd', 'mjd', 'decimalyear', 'unix', 'unix_tai', 'cxcsec', 'gps', 'plot_date',\n           'stardate', 'datetime', 'ymdhms', 'iso', 'isot', 'yday', 'datetime64',\n           'fits', 'byear', 'jyear', 'byear_str', 'jyear_str']\n        ","endLoc":486,"header":"@property\n    def format(self)","id":2823,"name":"format","nodeType":"Function","startLoc":471,"text":"@property\n    def format(self):\n        \"\"\"\n        Get or set time format.\n\n        The format defines the way times are represented when accessed via the\n        ``.value`` attribute.  By default it is the same as the format used for\n        initializing the `Time` instance, but it can be set to any other value\n        that could be used for initialization.  These can be listed with::\n\n          >>> list(Time.FORMATS)\n          ['jd', 'mjd', 'decimalyear', 'unix', 'unix_tai', 'cxcsec', 'gps', 'plot_date',\n           'stardate', 'datetime', 'ymdhms', 'iso', 'isot', 'yday', 'datetime64',\n           'fits', 'byear', 'jyear', 'byear_str', 'jyear_str']\n        \"\"\"\n        return self._format"},{"col":4,"comment":"Set time format","endLoc":505,"header":"@format.setter\n    def format(self, format)","id":2824,"name":"format","nodeType":"Function","startLoc":488,"text":"@format.setter\n    def format(self, format):\n        \"\"\"Set time format\"\"\"\n        if format not in self.FORMATS:\n            raise ValueError(f'format must be one of {list(self.FORMATS)}')\n        format_cls = self.FORMATS[format]\n\n        # Get the new TimeFormat object to contain time in new format.  Possibly\n        # coerce in/out_subfmt to '*' (default) if existing subfmt values are\n        # not valid in the new format.\n        self._time = format_cls(\n            self._time.jd1, self._time.jd2,\n            self._time._scale, self.precision,\n            in_subfmt=format_cls._get_allowed_subfmt(self.in_subfmt),\n            out_subfmt=format_cls._get_allowed_subfmt(self.out_subfmt),\n            from_jd=True)\n\n        self._format = format"},{"col":4,"comment":"null","endLoc":510,"header":"def __repr__(self)","id":2825,"name":"__repr__","nodeType":"Function","startLoc":507,"text":"def __repr__(self):\n        return (\"<{} object: scale='{}' format='{}' value={}>\"\n                .format(self.__class__.__name__, self.scale, self.format,\n                        getattr(self, self.format)))"},{"col":4,"comment":"null","endLoc":513,"header":"def __str__(self)","id":2826,"name":"__str__","nodeType":"Function","startLoc":512,"text":"def __str__(self):\n        return str(getattr(self, self.format))"},{"col":4,"comment":"null","endLoc":532,"header":"def __hash__(self)","id":2827,"name":"__hash__","nodeType":"Function","startLoc":515,"text":"def __hash__(self):\n\n        try:\n            loc = getattr(self, 'location', None)\n            if loc is not None:\n                loc = loc.x.to_value(u.m), loc.y.to_value(u.m), loc.z.to_value(u.m)\n\n            return hash((self.jd1, self.jd2, self.scale, loc))\n\n        except TypeError:\n            if self.ndim != 0:\n                reason = '(must be scalar)'\n            elif self.masked:\n                reason = '(value is masked)'\n            else:\n                raise\n\n            raise TypeError(f\"unhashable type: '{self.__class__.__name__}' {reason}\")"},{"className":"TimeDelta","col":0,"comment":"\n    Represent the time difference between two times.\n\n    A TimeDelta object is initialized with one or more times in the ``val``\n    argument.  The input times in ``val`` must conform to the specified\n    ``format``.  The optional ``val2`` time input should be supplied only for\n    numeric input formats (e.g. JD) where very high precision (better than\n    64-bit precision) is required.\n\n    The allowed values for ``format`` can be listed with::\n\n      >>> list(TimeDelta.FORMATS)\n      ['sec', 'jd', 'datetime']\n\n    Note that for time differences, the scale can be among three groups:\n    geocentric ('tai', 'tt', 'tcg'), barycentric ('tcb', 'tdb'), and rotational\n    ('ut1'). Within each of these, the scales for time differences are the\n    same. Conversion between geocentric and barycentric is possible, as there\n    is only a scale factor change, but one cannot convert to or from 'ut1', as\n    this requires knowledge of the actual times, not just their difference. For\n    a similar reason, 'utc' is not a valid scale for a time difference: a UTC\n    day is not always 86400 seconds.\n\n    See also:\n\n    - https://docs.astropy.org/en/stable/time/\n    - https://docs.astropy.org/en/stable/time/index.html#time-deltas\n\n    Parameters\n    ----------\n    val : sequence, ndarray, number, `~astropy.units.Quantity` or `~astropy.time.TimeDelta` object\n        Value(s) to initialize the time difference(s). Any quantities will\n        be converted appropriately (with care taken to avoid rounding\n        errors for regular time units).\n    val2 : sequence, ndarray, number, or `~astropy.units.Quantity`; optional\n        Additional values, as needed to preserve precision.\n    format : str, optional\n        Format of input value(s). For numerical inputs without units,\n        \"jd\" is assumed and values are interpreted as days.\n        A deprecation warning is raised in this case. To avoid the warning,\n        either specify the format or add units to the input values.\n    scale : str, optional\n        Time scale of input value(s), must be one of the following values:\n        ('tdb', 'tt', 'ut1', 'tcg', 'tcb', 'tai'). If not given (or\n        ``None``), the scale is arbitrary; when added or subtracted from a\n        ``Time`` instance, it will be used without conversion.\n    copy : bool, optional\n        Make a copy of the input values\n    ","endLoc":2673,"id":2828,"nodeType":"Class","startLoc":2249,"text":"class TimeDelta(TimeBase):\n    \"\"\"\n    Represent the time difference between two times.\n\n    A TimeDelta object is initialized with one or more times in the ``val``\n    argument.  The input times in ``val`` must conform to the specified\n    ``format``.  The optional ``val2`` time input should be supplied only for\n    numeric input formats (e.g. JD) where very high precision (better than\n    64-bit precision) is required.\n\n    The allowed values for ``format`` can be listed with::\n\n      >>> list(TimeDelta.FORMATS)\n      ['sec', 'jd', 'datetime']\n\n    Note that for time differences, the scale can be among three groups:\n    geocentric ('tai', 'tt', 'tcg'), barycentric ('tcb', 'tdb'), and rotational\n    ('ut1'). Within each of these, the scales for time differences are the\n    same. Conversion between geocentric and barycentric is possible, as there\n    is only a scale factor change, but one cannot convert to or from 'ut1', as\n    this requires knowledge of the actual times, not just their difference. For\n    a similar reason, 'utc' is not a valid scale for a time difference: a UTC\n    day is not always 86400 seconds.\n\n    See also:\n\n    - https://docs.astropy.org/en/stable/time/\n    - https://docs.astropy.org/en/stable/time/index.html#time-deltas\n\n    Parameters\n    ----------\n    val : sequence, ndarray, number, `~astropy.units.Quantity` or `~astropy.time.TimeDelta` object\n        Value(s) to initialize the time difference(s). Any quantities will\n        be converted appropriately (with care taken to avoid rounding\n        errors for regular time units).\n    val2 : sequence, ndarray, number, or `~astropy.units.Quantity`; optional\n        Additional values, as needed to preserve precision.\n    format : str, optional\n        Format of input value(s). For numerical inputs without units,\n        \"jd\" is assumed and values are interpreted as days.\n        A deprecation warning is raised in this case. To avoid the warning,\n        either specify the format or add units to the input values.\n    scale : str, optional\n        Time scale of input value(s), must be one of the following values:\n        ('tdb', 'tt', 'ut1', 'tcg', 'tcb', 'tai'). If not given (or\n        ``None``), the scale is arbitrary; when added or subtracted from a\n        ``Time`` instance, it will be used without conversion.\n    copy : bool, optional\n        Make a copy of the input values\n    \"\"\"\n    SCALES = TIME_DELTA_SCALES\n    \"\"\"List of time delta scales.\"\"\"\n\n    FORMATS = TIME_DELTA_FORMATS\n    \"\"\"Dict of time delta formats.\"\"\"\n\n    info = TimeDeltaInfo()\n\n    def __new__(cls, val, val2=None, format=None, scale=None,\n                precision=None, in_subfmt=None, out_subfmt=None,\n                location=None, copy=False):\n\n        if isinstance(val, TimeDelta):\n            self = val.replicate(format=format, copy=copy, cls=cls)\n        else:\n            self = super().__new__(cls)\n\n        return self\n\n    def __init__(self, val, val2=None, format=None, scale=None, copy=False):\n        if isinstance(val, TimeDelta):\n            if scale is not None:\n                self._set_scale(scale)\n        else:\n            format = format or self._get_format(val)\n            self._init_from_vals(val, val2, format, scale, copy)\n\n            if scale is not None:\n                self.SCALES = TIME_DELTA_TYPES[scale]\n\n    @staticmethod\n    def _get_format(val):\n        if isinstance(val, timedelta):\n            return 'datetime'\n\n        if getattr(val, 'unit', None) is None:\n            warn('Numerical value without unit or explicit format passed to'\n                 ' TimeDelta, assuming days', TimeDeltaMissingUnitWarning)\n\n        return 'jd'\n\n    def replicate(self, *args, **kwargs):\n        out = super().replicate(*args, **kwargs)\n        out.SCALES = self.SCALES\n        return out\n\n    def to_datetime(self):\n        \"\"\"\n        Convert to ``datetime.timedelta`` object.\n        \"\"\"\n        tm = self.replicate(format='datetime')\n        return tm._shaped_like_input(tm._time.value)\n\n    def _set_scale(self, scale):\n        \"\"\"\n        This is the key routine that actually does time scale conversions.\n        This is not public and not connected to the read-only scale property.\n        \"\"\"\n\n        if scale == self.scale:\n            return\n        if scale not in self.SCALES:\n            raise ValueError(\"Scale {!r} is not in the allowed scales {}\"\n                             .format(scale, sorted(self.SCALES)))\n\n        # For TimeDelta, there can only be a change in scale factor,\n        # which is written as time2 - time1 = scale_offset * time1\n        scale_offset = SCALE_OFFSETS[(self.scale, scale)]\n        if scale_offset is None:\n            self._time.scale = scale\n        else:\n            jd1, jd2 = self._time.jd1, self._time.jd2\n            offset1, offset2 = day_frac(jd1, jd2, factor=scale_offset)\n            self._time = self.FORMATS[self.format](\n                jd1 + offset1, jd2 + offset2, scale,\n                self.precision, self.in_subfmt,\n                self.out_subfmt, from_jd=True)\n\n    def _add_sub(self, other, op):\n        \"\"\"Perform common elements of addition / subtraction for two delta times\"\"\"\n        # If not a TimeDelta then see if it can be turned into a TimeDelta.\n        if not isinstance(other, TimeDelta):\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                return NotImplemented\n\n        # the scales should be compatible (e.g., cannot convert TDB to TAI)\n        if(self.scale is not None and self.scale not in other.SCALES\n           or other.scale is not None and other.scale not in self.SCALES):\n            raise TypeError(\"Cannot add TimeDelta instances with scales \"\n                            \"'{}' and '{}'\".format(self.scale, other.scale))\n\n        # adjust the scale of other if the scale of self is set (or no scales)\n        if self.scale is not None or other.scale is None:\n            out = self.replicate()\n            if other.scale is not None:\n                other = getattr(other, self.scale)\n        else:\n            out = other.replicate()\n\n        jd1 = op(self._time.jd1, other._time.jd1)\n        jd2 = op(self._time.jd2, other._time.jd2)\n\n        out._time.jd1, out._time.jd2 = day_frac(jd1, jd2)\n\n        return out\n\n    def __add__(self, other):\n        # If other is a Time then use Time.__add__ to do the calculation.\n        if isinstance(other, Time):\n            return other.__add__(self)\n\n        return self._add_sub(other, operator.add)\n\n    def __sub__(self, other):\n        # TimeDelta - Time is an error\n        if isinstance(other, Time):\n            raise OperandTypeError(self, other, '-')\n\n        return self._add_sub(other, operator.sub)\n\n    def __radd__(self, other):\n        return self.__add__(other)\n\n    def __rsub__(self, other):\n        out = self.__sub__(other)\n        return -out\n\n    def __neg__(self):\n        \"\"\"Negation of a `TimeDelta` object.\"\"\"\n        new = self.copy()\n        new._time.jd1 = -self._time.jd1\n        new._time.jd2 = -self._time.jd2\n        return new\n\n    def __abs__(self):\n        \"\"\"Absolute value of a `TimeDelta` object.\"\"\"\n        jd1, jd2 = self._time.jd1, self._time.jd2\n        negative = jd1 + jd2 < 0\n        new = self.copy()\n        new._time.jd1 = np.where(negative, -jd1, jd1)\n        new._time.jd2 = np.where(negative, -jd2, jd2)\n        return new\n\n    def __mul__(self, other):\n        \"\"\"Multiplication of `TimeDelta` objects by numbers/arrays.\"\"\"\n        # Check needed since otherwise the self.jd1 * other multiplication\n        # would enter here again (via __rmul__)\n        if isinstance(other, Time):\n            raise OperandTypeError(self, other, '*')\n        elif ((isinstance(other, u.UnitBase)\n               and other == u.dimensionless_unscaled)\n                or (isinstance(other, str) and other == '')):\n            return self.copy()\n\n        # If other is something consistent with a dimensionless quantity\n        # (could just be a float or an array), then we can just multiple in.\n        try:\n            other = u.Quantity(other, u.dimensionless_unscaled, copy=False)\n        except Exception:\n            # If not consistent with a dimensionless quantity, try downgrading\n            # self to a quantity and see if things work.\n            try:\n                return self.to(u.day) * other\n            except Exception:\n                # The various ways we could multiply all failed;\n                # returning NotImplemented to give other a final chance.\n                return NotImplemented\n\n        jd1, jd2 = day_frac(self.jd1, self.jd2, factor=other.value)\n        out = TimeDelta(jd1, jd2, format='jd', scale=self.scale)\n\n        if self.format != 'jd':\n            out = out.replicate(format=self.format)\n        return out\n\n    def __rmul__(self, other):\n        \"\"\"Multiplication of numbers/arrays with `TimeDelta` objects.\"\"\"\n        return self.__mul__(other)\n\n    def __truediv__(self, other):\n        \"\"\"Division of `TimeDelta` objects by numbers/arrays.\"\"\"\n        # Cannot do __mul__(1./other) as that looses precision\n        if ((isinstance(other, u.UnitBase)\n             and other == u.dimensionless_unscaled)\n                or (isinstance(other, str) and other == '')):\n            return self.copy()\n\n        # If other is something consistent with a dimensionless quantity\n        # (could just be a float or an array), then we can just divide in.\n        try:\n            other = u.Quantity(other, u.dimensionless_unscaled, copy=False)\n        except Exception:\n            # If not consistent with a dimensionless quantity, try downgrading\n            # self to a quantity and see if things work.\n            try:\n                return self.to(u.day) / other\n            except Exception:\n                # The various ways we could divide all failed;\n                # returning NotImplemented to give other a final chance.\n                return NotImplemented\n\n        jd1, jd2 = day_frac(self.jd1, self.jd2, divisor=other.value)\n        out = TimeDelta(jd1, jd2, format='jd', scale=self.scale)\n\n        if self.format != 'jd':\n            out = out.replicate(format=self.format)\n        return out\n\n    def __rtruediv__(self, other):\n        \"\"\"Division by `TimeDelta` objects of numbers/arrays.\"\"\"\n        # Here, we do not have to worry about returning NotImplemented,\n        # since other has already had a chance to look at us.\n        return other / self.to(u.day)\n\n    def to(self, unit, equivalencies=[]):\n        \"\"\"\n        Convert to a quantity in the specified unit.\n\n        Parameters\n        ----------\n        unit : unit-like\n            The unit to convert to.\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not directly\n            convertible (see :ref:`astropy:unit_equivalencies`). If `None`, no\n            equivalencies will be applied at all, not even any set globallyq\n            or within a context.\n\n        Returns\n        -------\n        quantity : `~astropy.units.Quantity`\n            The quantity in the units specified.\n\n        See also\n        --------\n        to_value : get the numerical value in a given unit.\n        \"\"\"\n        return u.Quantity(self._time.jd1 + self._time.jd2,\n                          u.day).to(unit, equivalencies=equivalencies)\n\n    def to_value(self, *args, **kwargs):\n        \"\"\"Get time delta values expressed in specified output format or unit.\n\n        This method is flexible and handles both conversion to a specified\n        ``TimeDelta`` format / sub-format AND conversion to a specified unit.\n        If positional argument(s) are provided then the first one is checked\n        to see if it is a valid ``TimeDelta`` format, and next it is checked\n        to see if it is a valid unit or unit string.\n\n        To convert to a ``TimeDelta`` format and optional sub-format the options\n        are::\n\n          tm = TimeDelta(1.0 * u.s)\n          tm.to_value('jd')  # equivalent of tm.jd\n          tm.to_value('jd', 'decimal')  # convert to 'jd' as a Decimal object\n          tm.to_value('jd', subfmt='decimal')\n          tm.to_value(format='jd', subfmt='decimal')\n\n        To convert to a unit with optional equivalencies, the options are::\n\n          tm.to_value('hr')  # convert to u.hr (hours)\n          tm.to_value('hr', [])  # specify equivalencies as a positional arg\n          tm.to_value('hr', equivalencies=[])\n          tm.to_value(unit='hr', equivalencies=[])\n\n        The built-in `~astropy.time.TimeDelta` options for ``format`` are:\n        {'jd', 'sec', 'datetime'}.\n\n        For the two numerical formats 'jd' and 'sec', the available ``subfmt``\n        options are: {'float', 'long', 'decimal', 'str', 'bytes'}. Here, 'long'\n        uses ``numpy.longdouble`` for somewhat enhanced precision (with the\n        enhancement depending on platform), and 'decimal' instances of\n        :class:`decimal.Decimal` for full precision.  For the 'str' and 'bytes'\n        sub-formats, the number of digits is also chosen such that time values\n        are represented accurately.  Default: as set by ``out_subfmt`` (which by\n        default picks the first available for a given format, i.e., 'float').\n\n        Parameters\n        ----------\n        format : str, optional\n            The format in which one wants the `~astropy.time.TimeDelta` values.\n            Default: the current format.\n        subfmt : str, optional\n            Possible sub-format in which the values should be given. Default: as\n            set by ``out_subfmt`` (which by default picks the first available\n            for a given format, i.e., 'float' or 'date_hms').\n        unit : `~astropy.units.UnitBase` instance or str, optional\n            The unit in which the value should be given.\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not directly\n            convertible (see :ref:`astropy:unit_equivalencies`). If `None`, no\n            equivalencies will be applied at all, not even any set globally or\n            within a context.\n\n        Returns\n        -------\n        value : ndarray or scalar\n            The value in the format or units specified.\n\n        See also\n        --------\n        to : Convert to a `~astropy.units.Quantity` instance in a given unit.\n        value : The time value in the current format.\n\n        \"\"\"\n        if not (args or kwargs):\n            raise TypeError('to_value() missing required format or unit argument')\n\n        # TODO: maybe allow 'subfmt' also for units, keeping full precision\n        # (effectively, by doing the reverse of quantity_day_frac)?\n        # This way, only equivalencies could lead to possible precision loss.\n        if ('format' in kwargs\n                or (args != () and (args[0] is None or args[0] in self.FORMATS))):\n            # Super-class will error with duplicate arguments, etc.\n            return super().to_value(*args, **kwargs)\n\n        # With positional arguments, we try parsing the first one as a unit,\n        # so that on failure we can give a more informative exception.\n        if args:\n            try:\n                unit = u.Unit(args[0])\n            except ValueError as exc:\n                raise ValueError(\"first argument is not one of the known \"\n                                 \"formats ({}) and failed to parse as a unit.\"\n                                 .format(list(self.FORMATS))) from exc\n            args = (unit,) + args[1:]\n\n        return u.Quantity(self._time.jd1 + self._time.jd2,\n                          u.day).to_value(*args, **kwargs)\n\n    def _make_value_equivalent(self, item, value):\n        \"\"\"Coerce setitem value into an equivalent TimeDelta object\"\"\"\n        if not isinstance(value, TimeDelta):\n            try:\n                value = self.__class__(value, scale=self.scale, format=self.format)\n            except Exception as err:\n                raise ValueError('cannot convert value to a compatible TimeDelta '\n                                 'object: {}'.format(err))\n        return value\n\n    def isclose(self, other, atol=None, rtol=0.0):\n        \"\"\"Returns a boolean or boolean array where two TimeDelta objects are\n        element-wise equal within a time tolerance.\n\n        This effectively evaluates the expression below::\n\n          abs(self - other) <= atol + rtol * abs(other)\n\n        Parameters\n        ----------\n        other : `~astropy.units.Quantity` or `~astropy.time.TimeDelta`\n            Quantity or TimeDelta object for comparison.\n        atol : `~astropy.units.Quantity` or `~astropy.time.TimeDelta`\n            Absolute tolerance for equality with units of time (e.g. ``u.s`` or\n            ``u.day``). Default is one bit in the 128-bit JD time representation,\n            equivalent to about 20 picosecs.\n        rtol : float\n            Relative tolerance for equality\n        \"\"\"\n        try:\n            other_day = other.to_value(u.day)\n        except Exception as err:\n            raise TypeError(f\"'other' argument must support conversion to days: {err}\")\n\n        if atol is None:\n            atol = np.finfo(float).eps * u.day\n\n        if not isinstance(atol, (u.Quantity, TimeDelta)):\n            raise TypeError(\"'atol' argument must be a Quantity or TimeDelta instance, got \"\n                            f'{atol.__class__.__name__} instead')\n\n        return np.isclose(self.to_value(u.day), other_day,\n                          rtol=rtol, atol=atol.to_value(u.day))"},{"col":4,"comment":"null","endLoc":2316,"header":"def __new__(cls, val, val2=None, format=None, scale=None,\n                precision=None, in_subfmt=None, out_subfmt=None,\n                location=None, copy=False)","id":2829,"name":"__new__","nodeType":"Function","startLoc":2307,"text":"def __new__(cls, val, val2=None, format=None, scale=None,\n                precision=None, in_subfmt=None, out_subfmt=None,\n                location=None, copy=False):\n\n        if isinstance(val, TimeDelta):\n            self = val.replicate(format=format, copy=copy, cls=cls)\n        else:\n            self = super().__new__(cls)\n\n        return self"},{"col":0,"comment":"null","endLoc":200,"header":"def handle_options(argv=None)","id":2830,"name":"handle_options","nodeType":"Function","startLoc":92,"text":"def handle_options(argv=None):\n    parser = argparse.ArgumentParser(\n        description=DESCRIPTION, epilog=EPILOG,\n        formatter_class=argparse.RawDescriptionHelpFormatter)\n\n    parser.add_argument(\n        '--version', action='version',\n        version=f'%(prog)s {__version__}')\n\n    parser.add_argument(\n        'fits_files', metavar='file', nargs='+',\n        help='.fits files to process.')\n\n    parser.add_argument(\n        '-q', '--quiet', action='store_true',\n        help='Produce no output and just return a status code.')\n\n    parser.add_argument(\n        '-n', '--num-diffs', type=int, default=10, dest='numdiffs',\n        metavar='INTEGER',\n        help='Max number of data differences (image pixel or table element) '\n             'to report per extension (default %(default)s).')\n\n    parser.add_argument(\n        '-r', '--rtol', '--relative-tolerance', type=float, default=None,\n        dest='rtol', metavar='NUMBER',\n        help='The relative tolerance for comparison of two numbers, '\n             'specifically two floating point numbers.  This applies to data '\n             'in both images and tables, and to floating point keyword values '\n             'in headers (default %(default)s).')\n\n    parser.add_argument(\n        '-a', '--atol', '--absolute-tolerance', type=float, default=None,\n        dest='atol', metavar='NUMBER',\n        help='The absolute tolerance for comparison of two numbers, '\n             'specifically two floating point numbers.  This applies to data '\n             'in both images and tables, and to floating point keyword values '\n             'in headers (default %(default)s).')\n\n    parser.add_argument(\n        '-b', '--no-ignore-blanks', action='store_false',\n        dest='ignore_blanks', default=True,\n        help=\"Don't ignore trailing blanks (whitespace) in string values.  \"\n             \"Otherwise trailing blanks both in header keywords/values and in \"\n             \"table column values) are not treated as significant i.e., \"\n             \"without this option 'ABCDEF   ' and 'ABCDEF' are considered \"\n             \"equivalent. \")\n\n    parser.add_argument(\n        '--no-ignore-blank-cards', action='store_false',\n        dest='ignore_blank_cards', default=True,\n        help=\"Don't ignore entirely blank cards in headers.  Normally fitsdiff \"\n             \"does not consider blank cards when comparing headers, but this \"\n             \"will ensure that even blank cards match up. \")\n\n    parser.add_argument(\n        '--exact', action='store_true',\n        dest='exact_comparisons', default=False,\n        help=\"Report ALL differences, \"\n             \"overriding command-line options and FITSDIFF_SETTINGS. \")\n\n    parser.add_argument(\n        '-o', '--output-file', metavar='FILE',\n        help='Output results to this file; otherwise results are printed to '\n             'stdout.')\n\n    parser.add_argument(\n        '-u', '--ignore-hdus', action=StoreListAction,\n        default=[], dest='ignore_hdus',\n        metavar='HDU_NAMES',\n        help='Comma-separated list of HDU names not to be compared.  HDU '\n             'names may contain wildcard patterns.')\n\n    group = parser.add_argument_group('Header Comparison Options')\n\n    group.add_argument(\n        '-k', '--ignore-keywords', action=StoreListAction,\n        default=[], dest='ignore_keywords',\n        metavar='KEYWORDS',\n        help='Comma-separated list of keywords not to be compared.  Keywords '\n             'may contain wildcard patterns.  To exclude all keywords, use '\n             '\"*\"; make sure to have double or single quotes around the '\n             'asterisk on the command-line.')\n\n    group.add_argument(\n        '-c', '--ignore-comments', action=StoreListAction,\n        default=[], dest='ignore_comments',\n        metavar='COMMENTS',\n        help='Comma-separated list of keywords whose comments will not be '\n             'compared.  Wildcards may be used as with --ignore-keywords.')\n\n    group = parser.add_argument_group('Table Comparison Options')\n\n    group.add_argument(\n        '-f', '--ignore-fields', action=StoreListAction,\n        default=[], dest='ignore_fields',\n        metavar='COLUMNS',\n        help='Comma-separated list of fields (i.e. columns) not to be '\n             'compared.  All columns may be excluded using \"*\" as with '\n             '--ignore-keywords.')\n\n    options = parser.parse_args(argv)\n\n    # Determine which filenames to compare\n    if len(options.fits_files) != 2:\n        parser.error('\\nfitsdiff requires two arguments; '\n                     'see `fitsdiff --help` for more details.')\n\n    return options"},{"col":4,"comment":"Time scale","endLoc":537,"header":"@property\n    def scale(self)","id":2831,"name":"scale","nodeType":"Function","startLoc":534,"text":"@property\n    def scale(self):\n        \"\"\"Time scale\"\"\"\n        return self._time.scale"},{"col":4,"comment":"\n        Decimal precision when outputting seconds as floating point (int\n        value between 0 and 9 inclusive).\n        ","endLoc":604,"header":"@property\n    def precision(self)","id":2832,"name":"precision","nodeType":"Function","startLoc":598,"text":"@property\n    def precision(self):\n        \"\"\"\n        Decimal precision when outputting seconds as floating point (int\n        value between 0 and 9 inclusive).\n        \"\"\"\n        return self._time.precision"},{"col":4,"comment":"null","endLoc":612,"header":"@precision.setter\n    def precision(self, val)","id":2833,"name":"precision","nodeType":"Function","startLoc":606,"text":"@precision.setter\n    def precision(self, val):\n        del self.cache\n        if not isinstance(val, int) or val < 0 or val > 9:\n            raise ValueError('precision attribute must be an int between '\n                             '0 and 9')\n        self._time.precision = val"},{"col":4,"comment":"null","endLoc":570,"header":"def __deepcopy__(self, memo)","id":2834,"name":"__deepcopy__","nodeType":"Function","startLoc":557,"text":"def __deepcopy__(self, memo):\n        from copy import deepcopy\n\n        new_copy = self.__class__()\n        new_copy.naxis = deepcopy(self.naxis, memo)\n        WCSBase.__init__(new_copy, deepcopy(self.sip, memo),\n                         (deepcopy(self.cpdis1, memo),\n                          deepcopy(self.cpdis2, memo)),\n                         deepcopy(self.wcs, memo),\n                         (deepcopy(self.det2im1, memo),\n                          deepcopy(self.det2im2, memo)))\n        for key, val in self.__dict__.items():\n            new_copy.__dict__[key] = deepcopy(val, memo)\n        return new_copy"},{"col":4,"comment":"\n        Unix wildcard pattern to select subformats for parsing string input\n        times.\n        ","endLoc":620,"header":"@property\n    def in_subfmt(self)","id":2835,"name":"in_subfmt","nodeType":"Function","startLoc":614,"text":"@property\n    def in_subfmt(self):\n        \"\"\"\n        Unix wildcard pattern to select subformats for parsing string input\n        times.\n        \"\"\"\n        return self._time.in_subfmt"},{"col":4,"comment":"null","endLoc":625,"header":"@in_subfmt.setter\n    def in_subfmt(self, val)","id":2836,"name":"in_subfmt","nodeType":"Function","startLoc":622,"text":"@in_subfmt.setter\n    def in_subfmt(self, val):\n        self._time.in_subfmt = val\n        del self.cache"},{"col":4,"comment":"\n        Unix wildcard pattern to select subformats for outputting times.\n        ","endLoc":632,"header":"@property\n    def out_subfmt(self)","id":2837,"name":"out_subfmt","nodeType":"Function","startLoc":627,"text":"@property\n    def out_subfmt(self):\n        \"\"\"\n        Unix wildcard pattern to select subformats for outputting times.\n        \"\"\"\n        return self._time.out_subfmt"},{"col":4,"comment":"null","endLoc":638,"header":"@out_subfmt.setter\n    def out_subfmt(self, val)","id":2838,"name":"out_subfmt","nodeType":"Function","startLoc":634,"text":"@out_subfmt.setter\n    def out_subfmt(self, val):\n        # Setting the out_subfmt property here does validation of ``val``\n        self._time.out_subfmt = val\n        del self.cache"},{"col":4,"comment":"The shape of the time instances.\n\n        Like `~numpy.ndarray.shape`, can be set to a new shape by assigning a\n        tuple.  Note that if different instances share some but not all\n        underlying data, setting the shape of one instance can make the other\n        instance unusable.  Hence, it is strongly recommended to get new,\n        reshaped instances with the ``reshape`` method.\n\n        Raises\n        ------\n        ValueError\n            If the new shape has the wrong total number of elements.\n        AttributeError\n            If the shape of the ``jd1``, ``jd2``, ``location``,\n            ``delta_ut1_utc``, or ``delta_tdb_tt`` attributes cannot be changed\n            without the arrays being copied.  For these cases, use the\n            `Time.reshape` method (which copies any arrays that cannot be\n            reshaped in-place).\n        ","endLoc":661,"header":"@property\n    def shape(self)","id":2839,"name":"shape","nodeType":"Function","startLoc":640,"text":"@property\n    def shape(self):\n        \"\"\"The shape of the time instances.\n\n        Like `~numpy.ndarray.shape`, can be set to a new shape by assigning a\n        tuple.  Note that if different instances share some but not all\n        underlying data, setting the shape of one instance can make the other\n        instance unusable.  Hence, it is strongly recommended to get new,\n        reshaped instances with the ``reshape`` method.\n\n        Raises\n        ------\n        ValueError\n            If the new shape has the wrong total number of elements.\n        AttributeError\n            If the shape of the ``jd1``, ``jd2``, ``location``,\n            ``delta_ut1_utc``, or ``delta_tdb_tt`` attributes cannot be changed\n            without the arrays being copied.  For these cases, use the\n            `Time.reshape` method (which copies any arrays that cannot be\n            reshaped in-place).\n        \"\"\"\n        return self._time.jd1.shape"},{"col":4,"comment":"null","endLoc":691,"header":"@shape.setter\n    def shape(self, shape)","id":2840,"name":"shape","nodeType":"Function","startLoc":663,"text":"@shape.setter\n    def shape(self, shape):\n        del self.cache\n\n        # We have to keep track of arrays that were already reshaped,\n        # since we may have to return those to their original shape if a later\n        # shape-setting fails.\n        reshaped = []\n        oldshape = self.shape\n\n        # In-place reshape of data/attributes.  Need to access _time.jd1/2 not\n        # self.jd1/2 because the latter are not guaranteed to be the actual\n        # data, and in fact should not be directly changeable from the public\n        # API.\n        for obj, attr in ((self._time, 'jd1'),\n                          (self._time, 'jd2'),\n                          (self, '_delta_ut1_utc'),\n                          (self, '_delta_tdb_tt'),\n                          (self, 'location')):\n            val = getattr(obj, attr, None)\n            if val is not None and val.size > 1:\n                try:\n                    val.shape = shape\n                except Exception:\n                    for val2 in reshaped:\n                        val2.shape = oldshape\n                    raise\n                else:\n                    reshaped.append(val)"},{"col":4,"comment":"null","endLoc":716,"header":"def _shaped_like_input(self, value)","id":2841,"name":"_shaped_like_input","nodeType":"Function","startLoc":693,"text":"def _shaped_like_input(self, value):\n        if self._time.jd1.shape:\n            if isinstance(value, np.ndarray):\n                return value\n            else:\n                raise TypeError(\n                    f\"JD is an array ({self._time.jd1!r}) but value \"\n                    f\"is not ({value!r})\")\n        else:\n            # zero-dimensional array, is it safe to unbox?\n            if (isinstance(value, np.ndarray)\n                    and not value.shape\n                    and not np.ma.is_masked(value)):\n                if value.dtype.kind == 'M':\n                    # existing test doesn't want datetime64 converted\n                    return value[()]\n                elif value.dtype.fields:\n                    # Unpack but keep field names; .item() doesn't\n                    # Still don't get python types in the fields\n                    return value[()]\n                else:\n                    return value.item()\n            else:\n                return value"},{"col":4,"comment":"null","endLoc":2343,"header":"def replicate(self, *args, **kwargs)","id":2842,"name":"replicate","nodeType":"Function","startLoc":2340,"text":"def replicate(self, *args, **kwargs):\n        out = super().replicate(*args, **kwargs)\n        out.SCALES = self.SCALES\n        return out"},{"col":4,"comment":"\n        First of the two doubles that internally store time value(s) in JD.\n        ","endLoc":724,"header":"@property\n    def jd1(self)","id":2843,"name":"jd1","nodeType":"Function","startLoc":718,"text":"@property\n    def jd1(self):\n        \"\"\"\n        First of the two doubles that internally store time value(s) in JD.\n        \"\"\"\n        jd1 = self._time.mask_if_needed(self._time.jd1)\n        return self._shaped_like_input(jd1)"},{"col":4,"comment":"\n        Return a replica of the Time object, optionally changing the format.\n\n        If ``format`` is supplied then the time format of the returned Time\n        object will be set accordingly, otherwise it will be unchanged from the\n        original.\n\n        If ``copy`` is set to `True` then a full copy of the internal time arrays\n        will be made.  By default the replica will use a reference to the\n        original arrays when possible to save memory.  The internal time arrays\n        are normally not changeable by the user so in most cases it should not\n        be necessary to set ``copy`` to `True`.\n\n        The convenience method copy() is available in which ``copy`` is `True`\n        by default.\n\n        Parameters\n        ----------\n        format : str, optional\n            Time format of the replica.\n        copy : bool, optional\n            Return a true copy instead of using references where possible.\n\n        Returns\n        -------\n        tm : Time object\n            Replica of this object\n        ","endLoc":1024,"header":"def replicate(self, format=None, copy=False, cls=None)","id":2844,"name":"replicate","nodeType":"Function","startLoc":995,"text":"def replicate(self, format=None, copy=False, cls=None):\n        \"\"\"\n        Return a replica of the Time object, optionally changing the format.\n\n        If ``format`` is supplied then the time format of the returned Time\n        object will be set accordingly, otherwise it will be unchanged from the\n        original.\n\n        If ``copy`` is set to `True` then a full copy of the internal time arrays\n        will be made.  By default the replica will use a reference to the\n        original arrays when possible to save memory.  The internal time arrays\n        are normally not changeable by the user so in most cases it should not\n        be necessary to set ``copy`` to `True`.\n\n        The convenience method copy() is available in which ``copy`` is `True`\n        by default.\n\n        Parameters\n        ----------\n        format : str, optional\n            Time format of the replica.\n        copy : bool, optional\n            Return a true copy instead of using references where possible.\n\n        Returns\n        -------\n        tm : Time object\n            Replica of this object\n        \"\"\"\n        return self._apply('copy' if copy else 'replicate', format=format, cls=cls)"},{"col":4,"comment":"\n        Second of the two doubles that internally store time value(s) in JD.\n        ","endLoc":732,"header":"@property\n    def jd2(self)","id":2845,"name":"jd2","nodeType":"Function","startLoc":726,"text":"@property\n    def jd2(self):\n        \"\"\"\n        Second of the two doubles that internally store time value(s) in JD.\n        \"\"\"\n        jd2 = self._time.mask_if_needed(self._time.jd2)\n        return self._shaped_like_input(jd2)"},{"col":4,"comment":"Get time values expressed in specified output format.\n\n        This method allows representing the ``Time`` object in the desired\n        output ``format`` and optional sub-format ``subfmt``.  Available\n        built-in formats include ``jd``, ``mjd``, ``iso``, and so forth. Each\n        format can have its own sub-formats\n\n        For built-in numerical formats like ``jd`` or ``unix``, ``subfmt`` can\n        be one of 'float', 'long', 'decimal', 'str', or 'bytes'.  Here, 'long'\n        uses ``numpy.longdouble`` for somewhat enhanced precision (with\n        the enhancement depending on platform), and 'decimal'\n        :class:`decimal.Decimal` for full precision.  For 'str' and 'bytes', the\n        number of digits is also chosen such that time values are represented\n        accurately.\n\n        For built-in date-like string formats, one of 'date_hms', 'date_hm', or\n        'date' (or 'longdate_hms', etc., for 5-digit years in\n        `~astropy.time.TimeFITS`).  For sub-formats including seconds, the\n        number of digits used for the fractional seconds is as set by\n        `~astropy.time.Time.precision`.\n\n        Parameters\n        ----------\n        format : str\n            The format in which one wants the time values. Default: the current\n            format.\n        subfmt : str or None, optional\n            Value or wildcard pattern to select the sub-format in which the\n            values should be given.  The default of '*' picks the first\n            available for a given format, i.e., 'float' or 'date_hms'.\n            If `None`, use the instance's ``out_subfmt``.\n\n        ","endLoc":812,"header":"def to_value(self, format, subfmt='*')","id":2846,"name":"to_value","nodeType":"Function","startLoc":734,"text":"def to_value(self, format, subfmt='*'):\n        \"\"\"Get time values expressed in specified output format.\n\n        This method allows representing the ``Time`` object in the desired\n        output ``format`` and optional sub-format ``subfmt``.  Available\n        built-in formats include ``jd``, ``mjd``, ``iso``, and so forth. Each\n        format can have its own sub-formats\n\n        For built-in numerical formats like ``jd`` or ``unix``, ``subfmt`` can\n        be one of 'float', 'long', 'decimal', 'str', or 'bytes'.  Here, 'long'\n        uses ``numpy.longdouble`` for somewhat enhanced precision (with\n        the enhancement depending on platform), and 'decimal'\n        :class:`decimal.Decimal` for full precision.  For 'str' and 'bytes', the\n        number of digits is also chosen such that time values are represented\n        accurately.\n\n        For built-in date-like string formats, one of 'date_hms', 'date_hm', or\n        'date' (or 'longdate_hms', etc., for 5-digit years in\n        `~astropy.time.TimeFITS`).  For sub-formats including seconds, the\n        number of digits used for the fractional seconds is as set by\n        `~astropy.time.Time.precision`.\n\n        Parameters\n        ----------\n        format : str\n            The format in which one wants the time values. Default: the current\n            format.\n        subfmt : str or None, optional\n            Value or wildcard pattern to select the sub-format in which the\n            values should be given.  The default of '*' picks the first\n            available for a given format, i.e., 'float' or 'date_hms'.\n            If `None`, use the instance's ``out_subfmt``.\n\n        \"\"\"\n        # TODO: add a precision argument (but ensure it is keyword argument\n        # only, to make life easier for TimeDelta.to_value()).\n        if format not in self.FORMATS:\n            raise ValueError(f'format must be one of {list(self.FORMATS)}')\n\n        cache = self.cache['format']\n        # Try to keep cache behaviour like it was in astropy < 4.0.\n        key = format if subfmt is None else (format, subfmt)\n        if key not in cache:\n            if format == self.format:\n                tm = self\n            else:\n                tm = self.replicate(format=format)\n\n            # Some TimeFormat subclasses may not be able to handle being passes\n            # on a out_subfmt. This includes some core classes like\n            # TimeBesselianEpochString that do not have any allowed subfmts. But\n            # those do deal with `self.out_subfmt` internally, so if subfmt is\n            # the same, we do not pass it on.\n            kwargs = {}\n            if subfmt is not None and subfmt != tm.out_subfmt:\n                kwargs['out_subfmt'] = subfmt\n            try:\n                value = tm._time.to_value(parent=tm, **kwargs)\n            except TypeError as exc:\n                # Try validating subfmt, e.g. for formats like 'jyear_str' that\n                # do not implement out_subfmt in to_value() (because there are\n                # no allowed subformats).  If subfmt is not valid this gives the\n                # same exception as would have occurred if the call to\n                # `to_value()` had succeeded.\n                tm._time._select_subfmts(subfmt)\n\n                # Subfmt was valid, so fall back to the original exception to see\n                # if it was lack of support for out_subfmt as a call arg.\n                if \"unexpected keyword argument 'out_subfmt'\" in str(exc):\n                    raise ValueError(\n                        f\"to_value() method for format {format!r} does not \"\n                        f\"support passing a 'subfmt' argument\") from None\n                else:\n                    # Some unforeseen exception so raise.\n                    raise\n\n            value = tm._shaped_like_input(value)\n            cache[key] = value\n        return cache[key]"},{"col":0,"comment":"null","endLoc":230,"header":"def setup_logging(outfile=None)","id":2847,"name":"setup_logging","nodeType":"Function","startLoc":203,"text":"def setup_logging(outfile=None):\n    log.setLevel(logging.INFO)\n    error_handler = logging.StreamHandler(sys.stderr)\n    error_handler.setFormatter(logging.Formatter('%(levelname)s: %(message)s'))\n    error_handler.setLevel(logging.WARNING)\n    log.addHandler(error_handler)\n\n    if outfile is not None:\n        output_handler = logging.FileHandler(outfile)\n    else:\n        output_handler = logging.StreamHandler()\n\n        class LevelFilter(logging.Filter):\n            \"\"\"Log only messages matching the specified level.\"\"\"\n\n            def __init__(self, name='', level=logging.NOTSET):\n                logging.Filter.__init__(self, name)\n                self.level = level\n\n            def filter(self, rec):\n                return rec.levelno == self.level\n\n        # File output logs all messages, but stdout logs only INFO messages\n        # (since errors are already logged to stderr)\n        output_handler.addFilter(LevelFilter(level=logging.INFO))\n\n    output_handler.setFormatter(logging.Formatter('%(message)s'))\n    log.addHandler(output_handler)"},{"col":4,"comment":"Create a new time object, possibly applying a method to the arrays.\n\n        Parameters\n        ----------\n        method : str or callable\n            If string, can be 'replicate'  or the name of a relevant\n            `~numpy.ndarray` method. In the former case, a new time instance\n            with unchanged internal data is created, while in the latter the\n            method is applied to the internal ``jd1`` and ``jd2`` arrays, as\n            well as to possible ``location``, ``_delta_ut1_utc``, and\n            ``_delta_tdb_tt`` arrays.\n            If a callable, it is directly applied to the above arrays.\n            Examples: 'copy', '__getitem__', 'reshape', `~numpy.broadcast_to`.\n        args : tuple\n            Any positional arguments for ``method``.\n        kwargs : dict\n            Any keyword arguments for ``method``.  If the ``format`` keyword\n            argument is present, this will be used as the Time format of the\n            replica.\n\n        Examples\n        --------\n        Some ways this is used internally::\n\n            copy : ``_apply('copy')``\n            replicate : ``_apply('replicate')``\n            reshape : ``_apply('reshape', new_shape)``\n            index or slice : ``_apply('__getitem__', item)``\n            broadcast : ``_apply(np.broadcast, shape=new_shape)``\n        ","endLoc":1124,"header":"def _apply(self, method, *args, format=None, cls=None, **kwargs)","id":2848,"name":"_apply","nodeType":"Function","startLoc":1026,"text":"def _apply(self, method, *args, format=None, cls=None, **kwargs):\n        \"\"\"Create a new time object, possibly applying a method to the arrays.\n\n        Parameters\n        ----------\n        method : str or callable\n            If string, can be 'replicate'  or the name of a relevant\n            `~numpy.ndarray` method. In the former case, a new time instance\n            with unchanged internal data is created, while in the latter the\n            method is applied to the internal ``jd1`` and ``jd2`` arrays, as\n            well as to possible ``location``, ``_delta_ut1_utc``, and\n            ``_delta_tdb_tt`` arrays.\n            If a callable, it is directly applied to the above arrays.\n            Examples: 'copy', '__getitem__', 'reshape', `~numpy.broadcast_to`.\n        args : tuple\n            Any positional arguments for ``method``.\n        kwargs : dict\n            Any keyword arguments for ``method``.  If the ``format`` keyword\n            argument is present, this will be used as the Time format of the\n            replica.\n\n        Examples\n        --------\n        Some ways this is used internally::\n\n            copy : ``_apply('copy')``\n            replicate : ``_apply('replicate')``\n            reshape : ``_apply('reshape', new_shape)``\n            index or slice : ``_apply('__getitem__', item)``\n            broadcast : ``_apply(np.broadcast, shape=new_shape)``\n        \"\"\"\n        new_format = self.format if format is None else format\n\n        if callable(method):\n            apply_method = lambda array: method(array, *args, **kwargs)\n\n        else:\n            if method == 'replicate':\n                apply_method = None\n            else:\n                apply_method = operator.methodcaller(method, *args, **kwargs)\n\n        jd1, jd2 = self._time.jd1, self._time.jd2\n        if apply_method:\n            jd1 = apply_method(jd1)\n            jd2 = apply_method(jd2)\n\n        # Get a new instance of our class and set its attributes directly.\n        tm = super().__new__(cls or self.__class__)\n        tm._time = TimeJD(jd1, jd2, self.scale, precision=0,\n                          in_subfmt='*', out_subfmt='*', from_jd=True)\n\n        # Optional ndarray attributes.\n        for attr in ('_delta_ut1_utc', '_delta_tdb_tt', 'location'):\n            try:\n                val = getattr(self, attr)\n            except AttributeError:\n                continue\n\n            if apply_method:\n                # Apply the method to any value arrays (though skip if there is\n                # only an array scalar and the method would return a view,\n                # since in that case nothing would change).\n                if getattr(val, 'shape', ()):\n                    val = apply_method(val)\n                elif method == 'copy' or method == 'flatten':\n                    # flatten should copy also for a single element array, but\n                    # we cannot use it directly for array scalars, since it\n                    # always returns a one-dimensional array. So, just copy.\n                    val = copy.copy(val)\n\n            setattr(tm, attr, val)\n\n        # Copy other 'info' attr only if it has actually been defined and the\n        # time object is not a scalar (issue #10688).\n        # See PR #3898 for further explanation and justification, along\n        # with Quantity.__array_finalize__\n        if 'info' in self.__dict__:\n            tm.info = self.info\n\n        # Make the new internal _time object corresponding to the format\n        # in the copy.  If the format is unchanged this process is lightweight\n        # and does not create any new arrays.\n        if new_format not in tm.FORMATS:\n            raise ValueError(f'format must be one of {list(tm.FORMATS)}')\n\n        NewFormat = tm.FORMATS[new_format]\n\n        tm._time = NewFormat(\n            tm._time.jd1, tm._time.jd2,\n            tm._time._scale,\n            precision=self.precision,\n            in_subfmt=NewFormat._get_allowed_subfmt(self.in_subfmt),\n            out_subfmt=NewFormat._get_allowed_subfmt(self.out_subfmt),\n            from_jd=True)\n        tm._format = new_format\n        tm.SCALES = self.SCALES\n\n        return tm"},{"col":4,"comment":"Time value(s) in current format","endLoc":817,"header":"@property\n    def value(self)","id":2849,"name":"value","nodeType":"Function","startLoc":814,"text":"@property\n    def value(self):\n        \"\"\"Time value(s) in current format\"\"\"\n        return self.to_value(self.format, None)"},{"col":27,"endLoc":1060,"id":2850,"nodeType":"Lambda","startLoc":1060,"text":"lambda array: method(array, *args, **kwargs)"},{"col":4,"comment":"null","endLoc":821,"header":"@property\n    def masked(self)","id":2851,"name":"masked","nodeType":"Function","startLoc":819,"text":"@property\n    def masked(self):\n        return self._time.masked"},{"col":4,"comment":"null","endLoc":825,"header":"@property\n    def mask(self)","id":2852,"name":"mask","nodeType":"Function","startLoc":823,"text":"@property\n    def mask(self):\n        return self._time.mask"},{"col":4,"comment":"\n        Insert values before the given indices in the column and return\n        a new `~astropy.time.Time` or  `~astropy.time.TimeDelta` object.\n\n        The values to be inserted must conform to the rules for in-place setting\n        of ``Time`` objects (see ``Get and set values`` in the ``Time``\n        documentation).\n\n        The API signature matches the ``np.insert`` API, but is more limited.\n        The specification of insert index ``obj`` must be a single integer,\n        and the ``axis`` must be ``0`` for simple row insertion before the\n        index.\n\n        Parameters\n        ----------\n        obj : int\n            Integer index before which ``values`` is inserted.\n        values : array-like\n            Value(s) to insert.  If the type of ``values`` is different\n            from that of quantity, ``values`` is converted to the matching type.\n        axis : int, optional\n            Axis along which to insert ``values``.  Default is 0, which is the\n            only allowed value and will insert a row.\n\n        Returns\n        -------\n        out : `~astropy.time.Time` subclass\n            New time object with inserted value(s)\n\n        ","endLoc":899,"header":"def insert(self, obj, values, axis=0)","id":2853,"name":"insert","nodeType":"Function","startLoc":827,"text":"def insert(self, obj, values, axis=0):\n        \"\"\"\n        Insert values before the given indices in the column and return\n        a new `~astropy.time.Time` or  `~astropy.time.TimeDelta` object.\n\n        The values to be inserted must conform to the rules for in-place setting\n        of ``Time`` objects (see ``Get and set values`` in the ``Time``\n        documentation).\n\n        The API signature matches the ``np.insert`` API, but is more limited.\n        The specification of insert index ``obj`` must be a single integer,\n        and the ``axis`` must be ``0`` for simple row insertion before the\n        index.\n\n        Parameters\n        ----------\n        obj : int\n            Integer index before which ``values`` is inserted.\n        values : array-like\n            Value(s) to insert.  If the type of ``values`` is different\n            from that of quantity, ``values`` is converted to the matching type.\n        axis : int, optional\n            Axis along which to insert ``values``.  Default is 0, which is the\n            only allowed value and will insert a row.\n\n        Returns\n        -------\n        out : `~astropy.time.Time` subclass\n            New time object with inserted value(s)\n\n        \"\"\"\n        # Validate inputs: obj arg is integer, axis=0, self is not a scalar, and\n        # input index is in bounds.\n        try:\n            idx0 = operator.index(obj)\n        except TypeError:\n            raise TypeError('obj arg must be an integer')\n\n        if axis != 0:\n            raise ValueError('axis must be 0')\n\n        if not self.shape:\n            raise TypeError('cannot insert into scalar {} object'\n                            .format(self.__class__.__name__))\n\n        if abs(idx0) > len(self):\n            raise IndexError('index {} is out of bounds for axis 0 with size {}'\n                             .format(idx0, len(self)))\n\n        # Turn negative index into positive\n        if idx0 < 0:\n            idx0 = len(self) + idx0\n\n        # For non-Time object, use numpy to help figure out the length.  (Note annoying\n        # case of a string input that has a length which is not the length we want).\n        if not isinstance(values, self.__class__):\n            values = np.asarray(values)\n        n_values = len(values) if values.shape else 1\n\n        # Finally make the new object with the correct length and set values for the\n        # three sections, before insert, the insert, and after the insert.\n        out = self.__class__.info.new_like([self], len(self) + n_values, name=self.info.name)\n\n        out._time.jd1[:idx0] = self._time.jd1[:idx0]\n        out._time.jd2[:idx0] = self._time.jd2[:idx0]\n\n        # This uses the Time setting machinery to coerce and validate as necessary.\n        out[idx0:idx0 + n_values] = values\n\n        out._time.jd1[idx0 + n_values:] = self._time.jd1[idx0:]\n        out._time.jd2[idx0 + n_values:] = self._time.jd2[idx0:]\n\n        return out"},{"col":0,"comment":"null","endLoc":279,"header":"def match_files(paths)","id":2855,"name":"match_files","nodeType":"Function","startLoc":233,"text":"def match_files(paths):\n    if os.path.isfile(paths[0]) and os.path.isfile(paths[1]):\n        # shortcut if both paths are files\n        return [paths]\n\n    dirnames = [None, None]\n    filelists = [None, None]\n\n    for i, path in enumerate(paths):\n        if glob.has_magic(path):\n            files = [os.path.split(f) for f in glob.glob(path)]\n            if not files:\n                log.error('Wildcard pattern %r did not match any files.', path)\n                sys.exit(2)\n\n            dirs, files = list(zip(*files))\n            if len(set(dirs)) > 1:\n                log.error('Wildcard pattern %r should match only one '\n                          'directory.', path)\n                sys.exit(2)\n\n            dirnames[i] = set(dirs).pop()\n            filelists[i] = sorted(files)\n        elif os.path.isdir(path):\n            dirnames[i] = path\n            filelists[i] = [f for f in sorted(os.listdir(path))\n                            if os.path.isfile(os.path.join(path, f))]\n        elif os.path.isfile(path):\n            dirnames[i] = os.path.dirname(path)\n            filelists[i] = [os.path.basename(path)]\n        else:\n            log.error(\n                '%r is not an existing file, directory, or wildcard '\n                'pattern; see `fitsdiff --help` for more usage help.', path)\n            sys.exit(2)\n\n        dirnames[i] = os.path.abspath(dirnames[i])\n\n    filematch = set(filelists[0]) & set(filelists[1])\n\n    for a, b in [(0, 1), (1, 0)]:\n        if len(filelists[a]) > len(filematch) and not os.path.isdir(paths[a]):\n            for extra in sorted(set(filelists[a]) - filematch):\n                log.warning('%r has no match in %r', extra, dirnames[b])\n\n    return [(os.path.join(dirnames[0], f),\n             os.path.join(dirnames[1], f)) for f in filematch]"},{"col":4,"comment":"null","endLoc":375,"header":"def _remap_index(self, idx)","id":2856,"name":"_remap_index","nodeType":"Function","startLoc":358,"text":"def _remap_index(self, idx):\n        # Given an integer index into this header, map that to the index in the\n        # table header for the same card.  If the card doesn't exist in the\n        # table header (generally should *not* be the case) this will just\n        # return the same index\n        # This *does* also accept a keyword or (keyword, repeat) tuple and\n        # obtains the associated numerical index with self._cardindex\n        if not isinstance(idx, int):\n            idx = self._cardindex(idx)\n\n        keyword, repeat = self._keyword_from_index(idx)\n        remapped_insert_keyword = self._remap_keyword(keyword)\n\n        with suppress(IndexError, KeyError):\n            idx = self._table_header._cardindex((remapped_insert_keyword,\n                                                 repeat))\n\n        return idx"},{"col":4,"comment":"null","endLoc":270,"header":"def _update(self, card)","id":2857,"name":"_update","nodeType":"Function","startLoc":257,"text":"def _update(self, card):\n        keyword = card[0]\n\n        if self._is_reserved_keyword(keyword):\n            return\n\n        super()._update(card)\n\n        if keyword in Card._commentary_keywords:\n            # Otherwise this will result in a duplicate insertion\n            return\n\n        remapped_keyword = self._remap_keyword(keyword)\n        self._table_header._update((remapped_keyword,) + card[1:])"},{"col":4,"comment":"null","endLoc":929,"header":"def __setitem__(self, item, value)","id":2858,"name":"__setitem__","nodeType":"Function","startLoc":901,"text":"def __setitem__(self, item, value):\n        if not self.writeable:\n            if self.shape:\n                raise ValueError('{} object is read-only. Make a '\n                                 'copy() or set \"writeable\" attribute to True.'\n                                 .format(self.__class__.__name__))\n            else:\n                raise ValueError('scalar {} object is read-only.'\n                                 .format(self.__class__.__name__))\n\n        # Any use of setitem results in immediate cache invalidation\n        del self.cache\n\n        # Setting invalidates transform deltas\n        for attr in ('_delta_tdb_tt', '_delta_ut1_utc'):\n            if hasattr(self, attr):\n                delattr(self, attr)\n\n        if value is np.ma.masked or value is np.nan:\n            self._time.jd2[item] = np.nan\n            return\n\n        value = self._make_value_equivalent(item, value)\n\n        # Finally directly set the jd1/2 values.  Locations are known to match.\n        if self.scale is not None:\n            value = getattr(value, self.scale)\n        self._time.jd1[item] = value._time.jd1\n        self._time.jd2[item] = value._time.jd2"},{"col":4,"comment":"\n        Return a shallow copy of the object.\n\n        Convenience method so user doesn't have to import the\n        :mod:`copy` stdlib module.\n\n        .. warning::\n            Use `deepcopy` instead of `copy` unless you know why you need a\n            shallow copy.\n        ","endLoc":583,"header":"def copy(self)","id":2859,"name":"copy","nodeType":"Function","startLoc":572,"text":"def copy(self):\n        \"\"\"\n        Return a shallow copy of the object.\n\n        Convenience method so user doesn't have to import the\n        :mod:`copy` stdlib module.\n\n        .. warning::\n            Use `deepcopy` instead of `copy` unless you know why you need a\n            shallow copy.\n        \"\"\"\n        return copy.copy(self)"},{"col":4,"comment":"\n        Return a deep copy of the object.\n\n        Convenience method so user doesn't have to import the\n        :mod:`copy` stdlib module.\n        ","endLoc":592,"header":"def deepcopy(self)","id":2860,"name":"deepcopy","nodeType":"Function","startLoc":585,"text":"def deepcopy(self):\n        \"\"\"\n        Return a deep copy of the object.\n\n        Convenience method so user doesn't have to import the\n        :mod:`copy` stdlib module.\n        \"\"\"\n        return copy.deepcopy(self)"},{"col":4,"comment":"null","endLoc":623,"header":"def sub(self, axes=None)","id":2861,"name":"sub","nodeType":"Function","startLoc":594,"text":"def sub(self, axes=None):\n\n        copy = self.deepcopy()\n\n        # We need to know which axes have been dropped, but there is no easy\n        # way to do this with the .sub function, so instead we assign UUIDs to\n        # the CNAME parameters in copy.wcs. We can later access the original\n        # CNAME properties from self.wcs.\n        cname_uuid = [str(uuid.uuid4()) for i in range(copy.wcs.naxis)]\n        copy.wcs.cname = cname_uuid\n\n        # Subset the WCS\n        copy.wcs = copy.wcs.sub(axes)\n        copy.naxis = copy.wcs.naxis\n\n        # Construct a list of dimensions from the original WCS in the order\n        # in which they appear in the final WCS.\n        keep = [cname_uuid.index(cname) if cname in cname_uuid else None\n                for cname in copy.wcs.cname]\n\n        # Restore the original CNAMEs\n        copy.wcs.cname = ['' if i is None else self.wcs.cname[i] for i in keep]\n\n        # Subset pixel_shape and pixel_bounds\n        if self.pixel_shape:\n            copy.pixel_shape = tuple([None if i is None else self.pixel_shape[i] for i in keep])\n        if self.pixel_bounds:\n            copy.pixel_bounds = [None if i is None else self.pixel_bounds[i] for i in keep]\n\n        return copy"},{"col":4,"comment":"The meat of the formatting; in a separate method to allow overriding.\n        ","endLoc":175,"header":"def _parse_internal(self, hdukeys, keywords, compressed)","id":2862,"name":"_parse_internal","nodeType":"Function","startLoc":160,"text":"def _parse_internal(self, hdukeys, keywords, compressed):\n        \"\"\"The meat of the formatting; in a separate method to allow overriding.\n        \"\"\"\n        result = []\n        for idx, hdu in enumerate(hdukeys):\n            try:\n                cards = self._get_cards(hdu, keywords, compressed)\n            except ExtensionNotFoundException:\n                continue\n\n            if idx > 0:  # Separate HDUs by a blank line\n                result.append('\\n')\n            result.append(f'# HDU {hdu} in {self.filename}:\\n')\n            for c in cards:\n                result.append(f'{c}\\n')\n        return ''.join(result)"},{"col":4,"comment":"Returns a list of `astropy.io.fits.card.Card` objects.\n\n        This function will return the desired header cards, taking into\n        account the user's preference to see the compressed or uncompressed\n        version.\n\n        Parameters\n        ----------\n        hdukey : int or str\n            Key of a single HDU in the HDUList.\n\n        keywords : list of str, optional\n            Keywords for which the cards should be returned.\n\n        compressed : bool, optional\n            If True, shows the header describing the compression.\n\n        Raises\n        ------\n        ExtensionNotFoundException\n            If the hdukey does not correspond to an extension.\n        ","endLoc":232,"header":"def _get_cards(self, hdukey, keywords, compressed)","id":2863,"name":"_get_cards","nodeType":"Function","startLoc":177,"text":"def _get_cards(self, hdukey, keywords, compressed):\n        \"\"\"Returns a list of `astropy.io.fits.card.Card` objects.\n\n        This function will return the desired header cards, taking into\n        account the user's preference to see the compressed or uncompressed\n        version.\n\n        Parameters\n        ----------\n        hdukey : int or str\n            Key of a single HDU in the HDUList.\n\n        keywords : list of str, optional\n            Keywords for which the cards should be returned.\n\n        compressed : bool, optional\n            If True, shows the header describing the compression.\n\n        Raises\n        ------\n        ExtensionNotFoundException\n            If the hdukey does not correspond to an extension.\n        \"\"\"\n        # First we obtain the desired header\n        try:\n            if compressed:\n                # In the case of a compressed image, return the header before\n                # decompression (not the default behavior)\n                header = self._hdulist[hdukey]._header\n            else:\n                header = self._hdulist[hdukey].header\n        except (IndexError, KeyError):\n            message = f'{self.filename}: Extension {hdukey} not found.'\n            if self.verbose:\n                log.warning(message)\n            raise ExtensionNotFoundException(message)\n\n        if not keywords:  # return all cards\n            cards = header.cards\n        else:  # specific keywords are requested\n            cards = []\n            for kw in keywords:\n                try:\n                    crd = header.cards[kw]\n                    if isinstance(crd, fits.card.Card):  # Single card\n                        cards.append(crd)\n                    else:  # Allow for wildcard access\n                        cards.extend(crd)\n                except KeyError:  # Keyword does not exist\n                    if self.verbose:\n                        log.warning('{filename} (HDU {hdukey}): '\n                                    'Keyword {kw} not found.'.format(\n                                        filename=self.filename,\n                                        hdukey=hdukey,\n                                        kw=kw))\n        return cards"},{"col":4,"comment":"null","endLoc":120,"header":"def __init__(self, val1, val2, scale, precision,\n                 in_subfmt, out_subfmt, from_jd=False)","id":2864,"name":"__init__","nodeType":"Function","startLoc":106,"text":"def __init__(self, val1, val2, scale, precision,\n                 in_subfmt, out_subfmt, from_jd=False):\n        self.scale = scale  # validation of scale done later with _check_scale\n        self.precision = precision\n        self.in_subfmt = in_subfmt\n        self.out_subfmt = out_subfmt\n\n        self._jd1, self._jd2 = None, None\n\n        if from_jd:\n            self.jd1 = val1\n            self.jd2 = val2\n        else:\n            val1, val2 = self._check_val_type(val1, val2)\n            self.set_jds(val1, val2)"},{"col":4,"comment":"Returns a boolean or boolean array where two Time objects are\n        element-wise equal within a time tolerance.\n\n        This evaluates the expression below::\n\n          abs(self - other) <= atol\n\n        Parameters\n        ----------\n        other : `~astropy.time.Time`\n            Time object for comparison.\n        atol : `~astropy.units.Quantity` or `~astropy.time.TimeDelta`\n            Absolute tolerance for equality with units of time (e.g. ``u.s`` or\n            ``u.day``). Default is two bits in the 128-bit JD time representation,\n            equivalent to about 40 picosecs.\n        ","endLoc":968,"header":"def isclose(self, other, atol=None)","id":2865,"name":"isclose","nodeType":"Function","startLoc":931,"text":"def isclose(self, other, atol=None):\n        \"\"\"Returns a boolean or boolean array where two Time objects are\n        element-wise equal within a time tolerance.\n\n        This evaluates the expression below::\n\n          abs(self - other) <= atol\n\n        Parameters\n        ----------\n        other : `~astropy.time.Time`\n            Time object for comparison.\n        atol : `~astropy.units.Quantity` or `~astropy.time.TimeDelta`\n            Absolute tolerance for equality with units of time (e.g. ``u.s`` or\n            ``u.day``). Default is two bits in the 128-bit JD time representation,\n            equivalent to about 40 picosecs.\n        \"\"\"\n        if atol is None:\n            # Note: use 2 bits instead of 1 bit based on experience in precision\n            # tests, since taking the difference with a UTC time means one has\n            # to do a scale change.\n            atol = 2 * np.finfo(float).eps * u.day\n\n        if not isinstance(atol, (u.Quantity, TimeDelta)):\n            raise TypeError(\"'atol' argument must be a Quantity or TimeDelta instance, got \"\n                            f'{atol.__class__.__name__} instead')\n\n        try:\n            # Separate these out so user sees where the problem is\n            dt = self - other\n            dt = abs(dt)\n            out = dt <= atol\n        except Exception as err:\n            raise TypeError(\"'other' argument must support subtraction with Time \"\n                            f\"and return a value that supports comparison with \"\n                            f\"{atol.__class__.__name__}: {err}\")\n\n        return out"},{"col":4,"comment":"null","endLoc":235,"header":"def close(self)","id":2866,"name":"close","nodeType":"Function","startLoc":234,"text":"def close(self):\n        self._hdulist.close()"},{"col":4,"comment":"\n        Calculates the footprint of the image on the sky.\n\n        A footprint is defined as the positions of the corners of the\n        image on the sky after all available distortions have been\n        applied.\n\n        Parameters\n        ----------\n        header : `~astropy.io.fits.Header` object, optional\n            Used to get ``NAXIS1`` and ``NAXIS2``\n            header and axes are mutually exclusive, alternative ways\n            to provide the same information.\n\n        undistort : bool, optional\n            If `True`, take SIP and distortion lookup table into\n            account\n\n        axes : (int, int), optional\n            If provided, use the given sequence as the shape of the\n            image.  Otherwise, use the ``NAXIS1`` and ``NAXIS2``\n            keywords from the header that was used to create this\n            `WCS` object.\n\n        center : bool, optional\n            If `True` use the center of the pixel, otherwise use the corner.\n\n        Returns\n        -------\n        coord : (4, 2) array of (*x*, *y*) coordinates.\n            The order is clockwise starting with the bottom left corner.\n        ","endLoc":789,"header":"def calc_footprint(self, header=None, undistort=True, axes=None, center=True)","id":2867,"name":"calc_footprint","nodeType":"Function","startLoc":722,"text":"def calc_footprint(self, header=None, undistort=True, axes=None, center=True):\n        \"\"\"\n        Calculates the footprint of the image on the sky.\n\n        A footprint is defined as the positions of the corners of the\n        image on the sky after all available distortions have been\n        applied.\n\n        Parameters\n        ----------\n        header : `~astropy.io.fits.Header` object, optional\n            Used to get ``NAXIS1`` and ``NAXIS2``\n            header and axes are mutually exclusive, alternative ways\n            to provide the same information.\n\n        undistort : bool, optional\n            If `True`, take SIP and distortion lookup table into\n            account\n\n        axes : (int, int), optional\n            If provided, use the given sequence as the shape of the\n            image.  Otherwise, use the ``NAXIS1`` and ``NAXIS2``\n            keywords from the header that was used to create this\n            `WCS` object.\n\n        center : bool, optional\n            If `True` use the center of the pixel, otherwise use the corner.\n\n        Returns\n        -------\n        coord : (4, 2) array of (*x*, *y*) coordinates.\n            The order is clockwise starting with the bottom left corner.\n        \"\"\"\n        if axes is not None:\n            naxis1, naxis2 = axes\n        else:\n            if header is None:\n                try:\n                    # classes that inherit from WCS and define naxis1/2\n                    # do not require a header parameter\n                    naxis1, naxis2 = self.pixel_shape\n                except (AttributeError, TypeError):\n                    warnings.warn(\n                        \"Need a valid header in order to calculate footprint\\n\", AstropyUserWarning)\n                    return None\n            else:\n                naxis1 = header.get('NAXIS1', None)\n                naxis2 = header.get('NAXIS2', None)\n\n        if naxis1 is None or naxis2 is None:\n            raise ValueError(\n                    \"Image size could not be determined.\")\n\n        if center:\n            corners = np.array([[1, 1],\n                                [1, naxis2],\n                                [naxis1, naxis2],\n                                [naxis1, 1]], dtype=np.float64)\n        else:\n            corners = np.array([[0.5, 0.5],\n                                [0.5, naxis2 + 0.5],\n                                [naxis1 + 0.5, naxis2 + 0.5],\n                                [naxis1 + 0.5, 0.5]], dtype=np.float64)\n\n        if undistort:\n            return self.all_pix2world(corners, 1)\n        else:\n            return self.wcs_pix2world(corners, 1)"},{"attributeType":"null","col":8,"comment":"null","endLoc":109,"id":2868,"name":"filename","nodeType":"Attribute","startLoc":109,"text":"self.filename"},{"col":4,"comment":"\n        Return a fully independent copy the Time object, optionally changing\n        the format.\n\n        If ``format`` is supplied then the time format of the returned Time\n        object will be set accordingly, otherwise it will be unchanged from the\n        original.\n\n        In this method a full copy of the internal time arrays will be made.\n        The internal time arrays are normally not changeable by the user so in\n        most cases the ``replicate()`` method should be used.\n\n        Parameters\n        ----------\n        format : str, optional\n            Time format of the copy.\n\n        Returns\n        -------\n        tm : Time object\n            Copy of this object\n        ","endLoc":993,"header":"def copy(self, format=None)","id":2869,"name":"copy","nodeType":"Function","startLoc":970,"text":"def copy(self, format=None):\n        \"\"\"\n        Return a fully independent copy the Time object, optionally changing\n        the format.\n\n        If ``format`` is supplied then the time format of the returned Time\n        object will be set accordingly, otherwise it will be unchanged from the\n        original.\n\n        In this method a full copy of the internal time arrays will be made.\n        The internal time arrays are normally not changeable by the user so in\n        most cases the ``replicate()`` method should be used.\n\n        Parameters\n        ----------\n        format : str, optional\n            Time format of the copy.\n\n        Returns\n        -------\n        tm : Time object\n            Copy of this object\n        \"\"\"\n        return self._apply('copy', format=format)"},{"col":4,"comment":"null","endLoc":302,"header":"def _relativeinsert(self, card, before=None, after=None, replace=False)","id":2870,"name":"_relativeinsert","nodeType":"Function","startLoc":274,"text":"def _relativeinsert(self, card, before=None, after=None, replace=False):\n        keyword = card[0]\n\n        if self._is_reserved_keyword(keyword):\n            return\n\n        # Now we have to figure out how to remap 'before' and 'after'\n        if before is None:\n            if isinstance(after, int):\n                remapped_after = self._remap_index(after)\n            else:\n                remapped_after = self._remap_keyword(after)\n            remapped_before = None\n        else:\n            if isinstance(before, int):\n                remapped_before = self._remap_index(before)\n            else:\n                remapped_before = self._remap_keyword(before)\n            remapped_after = None\n\n        super()._relativeinsert(card, before=before, after=after,\n                                replace=replace)\n\n        remapped_keyword = self._remap_keyword(keyword)\n\n        card = Card(remapped_keyword, card[1], card[2])\n        self._table_header._relativeinsert(card, before=remapped_before,\n                                           after=remapped_after,\n                                           replace=replace)"},{"attributeType":"HDUList","col":8,"comment":"null","endLoc":111,"id":2871,"name":"_hdulist","nodeType":"Attribute","startLoc":111,"text":"self._hdulist"},{"attributeType":"null","col":8,"comment":"null","endLoc":110,"id":2872,"name":"verbose","nodeType":"Attribute","startLoc":110,"text":"self.verbose"},{"className":"TableHeaderFormatter","col":0,"comment":"Class to convert the header(s) of a FITS file into a Table object.\n    The table returned by the `parse` method will contain four columns:\n    filename, hdu, keyword, and value.\n\n    Subclassed from HeaderFormatter, which contains the meat of the formatting.\n    ","endLoc":262,"id":2873,"nodeType":"Class","startLoc":238,"text":"class TableHeaderFormatter(HeaderFormatter):\n    \"\"\"Class to convert the header(s) of a FITS file into a Table object.\n    The table returned by the `parse` method will contain four columns:\n    filename, hdu, keyword, and value.\n\n    Subclassed from HeaderFormatter, which contains the meat of the formatting.\n    \"\"\"\n\n    def _parse_internal(self, hdukeys, keywords, compressed):\n        \"\"\"Method called by the parse method in the parent class.\"\"\"\n        tablerows = []\n        for hdu in hdukeys:\n            try:\n                for card in self._get_cards(hdu, keywords, compressed):\n                    tablerows.append({'filename': self.filename,\n                                      'hdu': hdu,\n                                      'keyword': card.keyword,\n                                      'value': str(card.value)})\n            except ExtensionNotFoundException:\n                pass\n\n        if tablerows:\n            from astropy import table\n            return table.Table(tablerows)\n        return None"},{"col":4,"comment":"Method called by the parse method in the parent class.","endLoc":262,"header":"def _parse_internal(self, hdukeys, keywords, compressed)","id":2874,"name":"_parse_internal","nodeType":"Function","startLoc":246,"text":"def _parse_internal(self, hdukeys, keywords, compressed):\n        \"\"\"Method called by the parse method in the parent class.\"\"\"\n        tablerows = []\n        for hdu in hdukeys:\n            try:\n                for card in self._get_cards(hdu, keywords, compressed):\n                    tablerows.append({'filename': self.filename,\n                                      'hdu': hdu,\n                                      'keyword': card.keyword,\n                                      'value': str(card.value)})\n            except ExtensionNotFoundException:\n                pass\n\n        if tablerows:\n            from astropy import table\n            return table.Table(tablerows)\n        return None"},{"col":4,"comment":"\n        Overrides the default behavior of the `copy.copy` function in\n        the python stdlib to behave like `Time.copy`. Does *not* make a\n        copy of the JD arrays - only copies by reference.\n        ","endLoc":1132,"header":"def __copy__(self)","id":2875,"name":"__copy__","nodeType":"Function","startLoc":1126,"text":"def __copy__(self):\n        \"\"\"\n        Overrides the default behavior of the `copy.copy` function in\n        the python stdlib to behave like `Time.copy`. Does *not* make a\n        copy of the JD arrays - only copies by reference.\n        \"\"\"\n        return self.replicate()"},{"col":0,"comment":"null","endLoc":346,"header":"def main(args=None)","id":2876,"name":"main","nodeType":"Function","startLoc":282,"text":"def main(args=None):\n    args = args or sys.argv[1:]\n\n    if 'FITSDIFF_SETTINGS' in os.environ:\n        args = os.environ['FITSDIFF_SETTINGS'].split() + args\n\n    opts = handle_options(args)\n\n    if opts.rtol is None:\n        opts.rtol = 0.0\n    if opts.atol is None:\n        opts.atol = 0.0\n\n    if opts.exact_comparisons:\n        # override the options so that each is the most restrictive\n        opts.ignore_keywords = []\n        opts.ignore_comments = []\n        opts.ignore_fields = []\n        opts.rtol = 0.0\n        opts.atol = 0.0\n        opts.ignore_blanks = False\n        opts.ignore_blank_cards = False\n\n    if not opts.quiet:\n        setup_logging(opts.output_file)\n    files = match_files(opts.fits_files)\n\n    close_file = False\n    if opts.quiet:\n        out_file = None\n    elif opts.output_file:\n        out_file = open(opts.output_file, 'w')\n        close_file = True\n    else:\n        out_file = sys.stdout\n\n    identical = []\n    try:\n        for a, b in files:\n            # TODO: pass in any additional arguments here too\n            diff = fits.diff.FITSDiff(\n                a, b,\n                ignore_hdus=opts.ignore_hdus,\n                ignore_keywords=opts.ignore_keywords,\n                ignore_comments=opts.ignore_comments,\n                ignore_fields=opts.ignore_fields,\n                numdiffs=opts.numdiffs,\n                rtol=opts.rtol,\n                atol=opts.atol,\n                ignore_blanks=opts.ignore_blanks,\n                ignore_blank_cards=opts.ignore_blank_cards)\n\n            diff.report(fileobj=out_file)\n            identical.append(diff.identical)\n\n        return int(not all(identical))\n    finally:\n        if close_file:\n            out_file.close()\n        # Close the file if used for the logging output, and remove handlers to\n        # avoid having them multiple times for unit tests.\n        for handler in log.handlers:\n            if isinstance(handler, logging.FileHandler):\n                handler.close()\n            log.removeHandler(handler)"},{"col":4,"comment":"null","endLoc":1358,"header":"def all_pix2world(self, *args, **kwargs)","id":2877,"name":"all_pix2world","nodeType":"Function","startLoc":1356,"text":"def all_pix2world(self, *args, **kwargs):\n        return self._array_converter(\n            self._all_pix2world, 'output', *args, **kwargs)"},{"col":4,"comment":"\n        Overrides the default behavior of the `copy.deepcopy` function\n        in the python stdlib to behave like `Time.copy`. Does make a\n        copy of the JD arrays.\n        ","endLoc":1140,"header":"def __deepcopy__(self, memo)","id":2878,"name":"__deepcopy__","nodeType":"Function","startLoc":1134,"text":"def __deepcopy__(self, memo):\n        \"\"\"\n        Overrides the default behavior of the `copy.deepcopy` function\n        in the python stdlib to behave like `Time.copy`. Does make a\n        copy of the JD arrays.\n        \"\"\"\n        return self.copy()"},{"col":4,"comment":"Turn argmin, argmax output into an advanced index.\n\n        Argmin, argmax output contains indices along a given axis in an array\n        shaped like the other dimensions.  To use this to get values at the\n        correct location, a list is constructed in which the other axes are\n        indexed sequentially.  For ``keepdims`` is ``True``, the net result is\n        the same as constructing an index grid with ``np.ogrid`` and then\n        replacing the ``axis`` item with ``indices`` with its shaped expanded\n        at ``axis``. For ``keepdims`` is ``False``, the result is the same but\n        with the ``axis`` dimension removed from all list entries.\n\n        For ``axis`` is ``None``, this calls :func:`~numpy.unravel_index`.\n\n        Parameters\n        ----------\n        indices : array\n            Output of argmin or argmax.\n        axis : int or None\n            axis along which argmin or argmax was used.\n        keepdims : bool\n            Whether to construct indices that keep or remove the axis along\n            which argmin or argmax was used.  Default: ``False``.\n\n        Returns\n        -------\n        advanced_index : list of arrays\n            Suitable for use as an advanced index.\n        ","endLoc":1190,"header":"def _advanced_index(self, indices, axis=None, keepdims=False)","id":2879,"name":"_advanced_index","nodeType":"Function","startLoc":1142,"text":"def _advanced_index(self, indices, axis=None, keepdims=False):\n        \"\"\"Turn argmin, argmax output into an advanced index.\n\n        Argmin, argmax output contains indices along a given axis in an array\n        shaped like the other dimensions.  To use this to get values at the\n        correct location, a list is constructed in which the other axes are\n        indexed sequentially.  For ``keepdims`` is ``True``, the net result is\n        the same as constructing an index grid with ``np.ogrid`` and then\n        replacing the ``axis`` item with ``indices`` with its shaped expanded\n        at ``axis``. For ``keepdims`` is ``False``, the result is the same but\n        with the ``axis`` dimension removed from all list entries.\n\n        For ``axis`` is ``None``, this calls :func:`~numpy.unravel_index`.\n\n        Parameters\n        ----------\n        indices : array\n            Output of argmin or argmax.\n        axis : int or None\n            axis along which argmin or argmax was used.\n        keepdims : bool\n            Whether to construct indices that keep or remove the axis along\n            which argmin or argmax was used.  Default: ``False``.\n\n        Returns\n        -------\n        advanced_index : list of arrays\n            Suitable for use as an advanced index.\n        \"\"\"\n        if axis is None:\n            return np.unravel_index(indices, self.shape)\n\n        ndim = self.ndim\n        if axis < 0:\n            axis = axis + ndim\n\n        if keepdims and indices.ndim < self.ndim:\n            indices = np.expand_dims(indices, axis)\n\n        index = [indices\n                 if i == axis\n                 else np.arange(s).reshape(\n                     (1,) * (i if keepdims or i < axis else i - 1)\n                     + (s,)\n                     + (1,) * (ndim - i - (1 if keepdims or i > axis else 2))\n                 )\n                 for i, s in enumerate(self.shape)]\n\n        return tuple(index)"},{"col":4,"comment":"Return indices of the minimum values along the given axis.\n\n        This is similar to :meth:`~numpy.ndarray.argmin`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used.  See :func:`~numpy.argmin` for detailed documentation.\n        ","endLoc":1213,"header":"def argmin(self, axis=None, out=None)","id":2880,"name":"argmin","nodeType":"Function","startLoc":1192,"text":"def argmin(self, axis=None, out=None):\n        \"\"\"Return indices of the minimum values along the given axis.\n\n        This is similar to :meth:`~numpy.ndarray.argmin`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used.  See :func:`~numpy.argmin` for detailed documentation.\n        \"\"\"\n        # First get the minimum at normal precision.\n        jd1, jd2 = self.jd1, self.jd2\n        approx = np.min(jd1 + jd2, axis, keepdims=True)\n\n        # Approx is very close to the true minimum, and by subtracting it at\n        # full precision, all numbers near 0 can be represented correctly,\n        # so we can be sure we get the true minimum.\n        # The below is effectively what would be done for\n        # dt = (self - self.__class__(approx, format='jd')).jd\n        # which translates to:\n        # approx_jd1, approx_jd2 = day_frac(approx, 0.)\n        # dt = (self.jd1 - approx_jd1) + (self.jd2 - approx_jd2)\n        dt = (jd1 - approx) + jd2\n\n        return dt.argmin(axis, out)"},{"col":4,"comment":"\n        Writes a `distortion paper`_ type lookup table to the given\n        `~astropy.io.fits.HDUList`.\n        ","endLoc":939,"header":"def _write_det2im(self, hdulist)","id":2881,"name":"_write_det2im","nodeType":"Function","startLoc":894,"text":"def _write_det2im(self, hdulist):\n        \"\"\"\n        Writes a `distortion paper`_ type lookup table to the given\n        `~astropy.io.fits.HDUList`.\n        \"\"\"\n\n        if self.det2im1 is None and self.det2im2 is None:\n            return\n        dist = 'D2IMDIS'\n        d_kw = 'D2IM'\n\n        def write_d2i(num, det2im):\n            if det2im is None:\n                return\n\n            hdulist[0].header[f'{dist}{num:d}'] = (\n                'LOOKUP', 'Detector to image correction type')\n            hdulist[0].header[f'{d_kw}{num:d}.EXTVER'] = (\n                num, 'Version number of WCSDVARR extension')\n            hdulist[0].header[f'{d_kw}{num:d}.NAXES'] = (\n                len(det2im.data.shape), 'Number of independent variables in D2IM function')\n\n            for i in range(det2im.data.ndim):\n                jth = {1: '1st', 2: '2nd', 3: '3rd'}.get(i + 1, f'{i + 1}th')\n                hdulist[0].header[f'{d_kw}{num:d}.AXIS.{i + 1:d}'] = (\n                    i + 1, f'Axis number of the {jth} variable in a D2IM function')\n\n            image = fits.ImageHDU(det2im.data, name='D2IMARR')\n            header = image.header\n\n            header['CRPIX1'] = (det2im.crpix[0],\n                                'Coordinate system reference pixel')\n            header['CRPIX2'] = (det2im.crpix[1],\n                                'Coordinate system reference pixel')\n            header['CRVAL1'] = (det2im.crval[0],\n                                'Coordinate system value at reference pixel')\n            header['CRVAL2'] = (det2im.crval[1],\n                                'Coordinate system value at reference pixel')\n            header['CDELT1'] = (det2im.cdelt[0],\n                                'Coordinate increment along axis')\n            header['CDELT2'] = (det2im.cdelt[1],\n                                'Coordinate increment along axis')\n            image.ver = int(hdulist[0].header[f'{d_kw}{num:d}.EXTVER'])\n            hdulist.append(image)\n        write_d2i(1, self.det2im1)\n        write_d2i(2, self.det2im2)"},{"attributeType":"null","col":4,"comment":"null","endLoc":82,"id":2882,"name":"_keyword_remaps","nodeType":"Attribute","startLoc":82,"text":"_keyword_remaps"},{"attributeType":"null","col":4,"comment":"null","endLoc":89,"id":2883,"name":"_zdef_re","nodeType":"Attribute","startLoc":89,"text":"_zdef_re"},{"attributeType":"null","col":4,"comment":"null","endLoc":90,"id":2884,"name":"_compression_keywords","nodeType":"Attribute","startLoc":90,"text":"_compression_keywords"},{"attributeType":"null","col":4,"comment":"null","endLoc":92,"id":2885,"name":"_indexed_compression_keywords","nodeType":"Attribute","startLoc":92,"text":"_indexed_compression_keywords"},{"attributeType":"null","col":8,"comment":"null","endLoc":114,"id":2886,"name":"_table_header","nodeType":"Attribute","startLoc":114,"text":"self._table_header"},{"attributeType":"null","col":8,"comment":"null","endLoc":111,"id":2887,"name":"_keyword_indices","nodeType":"Attribute","startLoc":111,"text":"self._keyword_indices"},{"col":4,"comment":"Return indices of the maximum values along the given axis.\n\n        This is similar to :meth:`~numpy.ndarray.argmax`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used.  See :func:`~numpy.argmax` for detailed documentation.\n        ","endLoc":1228,"header":"def argmax(self, axis=None, out=None)","id":2888,"name":"argmax","nodeType":"Function","startLoc":1215,"text":"def argmax(self, axis=None, out=None):\n        \"\"\"Return indices of the maximum values along the given axis.\n\n        This is similar to :meth:`~numpy.ndarray.argmax`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used.  See :func:`~numpy.argmax` for detailed documentation.\n        \"\"\"\n        # For procedure, see comment on argmin.\n        jd1, jd2 = self.jd1, self.jd2\n        approx = np.max(jd1 + jd2, axis, keepdims=True)\n\n        dt = (jd1 - approx) + jd2\n\n        return dt.argmax(axis, out)"},{"attributeType":"null","col":8,"comment":"null","endLoc":112,"id":2889,"name":"_rvkc_indices","nodeType":"Attribute","startLoc":112,"text":"self._rvkc_indices"},{"col":4,"comment":"Returns the indices that would sort the time array.\n\n        This is similar to :meth:`~numpy.ndarray.argsort`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used, and that corresponding attributes are copied.  Internally,\n        it uses :func:`~numpy.lexsort`, and hence no sort method can be chosen.\n        ","endLoc":1246,"header":"def argsort(self, axis=-1)","id":2890,"name":"argsort","nodeType":"Function","startLoc":1230,"text":"def argsort(self, axis=-1):\n        \"\"\"Returns the indices that would sort the time array.\n\n        This is similar to :meth:`~numpy.ndarray.argsort`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used, and that corresponding attributes are copied.  Internally,\n        it uses :func:`~numpy.lexsort`, and hence no sort method can be chosen.\n        \"\"\"\n        # For procedure, see comment on argmin.\n        jd1, jd2 = self.jd1, self.jd2\n        approx = jd1 + jd2\n        remainder = (jd1 - approx) + jd2\n\n        if axis is None:\n            return np.lexsort((remainder.ravel(), approx.ravel()))\n        else:\n            return np.lexsort(keys=(remainder, approx), axis=axis)"},{"attributeType":"null","col":8,"comment":"null","endLoc":110,"id":2891,"name":"_cards","nodeType":"Attribute","startLoc":110,"text":"self._cards"},{"attributeType":"null","col":8,"comment":"null","endLoc":113,"id":2892,"name":"_modified","nodeType":"Attribute","startLoc":113,"text":"self._modified"},{"attributeType":"null","col":4,"comment":"null","endLoc":31,"id":2893,"name":"COMPRESSION_SUPPORTED","nodeType":"Attribute","startLoc":31,"text":"COMPRESSION_SUPPORTED"},{"col":4,"comment":"Minimum along a given axis.\n\n        This is similar to :meth:`~numpy.ndarray.min`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used, and that corresponding attributes are copied.\n\n        Note that the ``out`` argument is present only for compatibility with\n        ``np.min``; since `Time` instances are immutable, it is not possible\n        to have an actual ``out`` to store the result in.\n        ","endLoc":1262,"header":"def min(self, axis=None, out=None, keepdims=False)","id":2894,"name":"min","nodeType":"Function","startLoc":1248,"text":"def min(self, axis=None, out=None, keepdims=False):\n        \"\"\"Minimum along a given axis.\n\n        This is similar to :meth:`~numpy.ndarray.min`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used, and that corresponding attributes are copied.\n\n        Note that the ``out`` argument is present only for compatibility with\n        ``np.min``; since `Time` instances are immutable, it is not possible\n        to have an actual ``out`` to store the result in.\n        \"\"\"\n        if out is not None:\n            raise ValueError(\"Since `Time` instances are immutable, ``out`` \"\n                             \"cannot be set to anything but ``None``.\")\n        return self[self._advanced_index(self.argmin(axis), axis, keepdims)]"},{"attributeType":"null","col":28,"comment":"null","endLoc":31,"id":2895,"name":"COMPRESSION_ENABLED","nodeType":"Attribute","startLoc":31,"text":"COMPRESSION_ENABLED"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":2896,"name":"NO_DITHER","nodeType":"Attribute","startLoc":37,"text":"NO_DITHER"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":2897,"name":"SUBTRACTIVE_DITHER_1","nodeType":"Attribute","startLoc":38,"text":"SUBTRACTIVE_DITHER_1"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":2898,"name":"SUBTRACTIVE_DITHER_2","nodeType":"Attribute","startLoc":39,"text":"SUBTRACTIVE_DITHER_2"},{"attributeType":"null","col":0,"comment":"null","endLoc":40,"id":2899,"name":"QUANTIZE_METHOD_NAMES","nodeType":"Attribute","startLoc":40,"text":"QUANTIZE_METHOD_NAMES"},{"attributeType":"null","col":0,"comment":"null","endLoc":45,"id":2900,"name":"DITHER_SEED_CLOCK","nodeType":"Attribute","startLoc":45,"text":"DITHER_SEED_CLOCK"},{"attributeType":"null","col":0,"comment":"null","endLoc":46,"id":2901,"name":"DITHER_SEED_CHECKSUM","nodeType":"Attribute","startLoc":46,"text":"DITHER_SEED_CHECKSUM"},{"attributeType":"null","col":0,"comment":"null","endLoc":48,"id":2902,"name":"COMPRESSION_TYPES","nodeType":"Attribute","startLoc":48,"text":"COMPRESSION_TYPES"},{"attributeType":"null","col":0,"comment":"null","endLoc":51,"id":2903,"name":"DEFAULT_COMPRESSION_TYPE","nodeType":"Attribute","startLoc":51,"text":"DEFAULT_COMPRESSION_TYPE"},{"attributeType":"null","col":0,"comment":"null","endLoc":52,"id":2904,"name":"DEFAULT_QUANTIZE_LEVEL","nodeType":"Attribute","startLoc":52,"text":"DEFAULT_QUANTIZE_LEVEL"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":2905,"name":"DEFAULT_QUANTIZE_METHOD","nodeType":"Attribute","startLoc":53,"text":"DEFAULT_QUANTIZE_METHOD"},{"attributeType":"null","col":0,"comment":"null","endLoc":54,"id":2906,"name":"DEFAULT_DITHER_SEED","nodeType":"Attribute","startLoc":54,"text":"DEFAULT_DITHER_SEED"},{"col":4,"comment":"Maximum along a given axis.\n\n        This is similar to :meth:`~numpy.ndarray.max`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used, and that corresponding attributes are copied.\n\n        Note that the ``out`` argument is present only for compatibility with\n        ``np.max``; since `Time` instances are immutable, it is not possible\n        to have an actual ``out`` to store the result in.\n        ","endLoc":1278,"header":"def max(self, axis=None, out=None, keepdims=False)","id":2907,"name":"max","nodeType":"Function","startLoc":1264,"text":"def max(self, axis=None, out=None, keepdims=False):\n        \"\"\"Maximum along a given axis.\n\n        This is similar to :meth:`~numpy.ndarray.max`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used, and that corresponding attributes are copied.\n\n        Note that the ``out`` argument is present only for compatibility with\n        ``np.max``; since `Time` instances are immutable, it is not possible\n        to have an actual ``out`` to store the result in.\n        \"\"\"\n        if out is not None:\n            raise ValueError(\"Since `Time` instances are immutable, ``out`` \"\n                             \"cannot be set to anything but ``None``.\")\n        return self[self._advanced_index(self.argmax(axis), axis, keepdims)]"},{"attributeType":"null","col":0,"comment":"null","endLoc":55,"id":2909,"name":"DEFAULT_HCOMP_SCALE","nodeType":"Attribute","startLoc":55,"text":"DEFAULT_HCOMP_SCALE"},{"attributeType":"null","col":0,"comment":"null","endLoc":56,"id":2910,"name":"DEFAULT_HCOMP_SMOOTH","nodeType":"Attribute","startLoc":56,"text":"DEFAULT_HCOMP_SMOOTH"},{"attributeType":"null","col":0,"comment":"null","endLoc":57,"id":2911,"name":"DEFAULT_BLOCK_SIZE","nodeType":"Attribute","startLoc":57,"text":"DEFAULT_BLOCK_SIZE"},{"attributeType":"null","col":0,"comment":"null","endLoc":58,"id":2912,"name":"DEFAULT_BYTE_PIX","nodeType":"Attribute","startLoc":58,"text":"DEFAULT_BYTE_PIX"},{"col":4,"comment":"\n        Write out `distortion paper`_ keywords to the given\n        `~astropy.io.fits.HDUList`.\n        ","endLoc":1058,"header":"def _write_distortion_kw(self, hdulist, dist='CPDIS')","id":2913,"name":"_write_distortion_kw","nodeType":"Function","startLoc":1015,"text":"def _write_distortion_kw(self, hdulist, dist='CPDIS'):\n        \"\"\"\n        Write out `distortion paper`_ keywords to the given\n        `~astropy.io.fits.HDUList`.\n        \"\"\"\n        if self.cpdis1 is None and self.cpdis2 is None:\n            return\n\n        if dist == 'CPDIS':\n            d_kw = 'DP'\n        else:\n            d_kw = 'DQ'\n\n        def write_dist(num, cpdis):\n            if cpdis is None:\n                return\n\n            hdulist[0].header[f'{dist}{num:d}'] = (\n                'LOOKUP', 'Prior distortion function type')\n            hdulist[0].header[f'{d_kw}{num:d}.EXTVER'] = (\n                num, 'Version number of WCSDVARR extension')\n            hdulist[0].header[f'{d_kw}{num:d}.NAXES'] = (\n                len(cpdis.data.shape), f'Number of independent variables in {dist} function')\n\n            for i in range(cpdis.data.ndim):\n                jth = {1: '1st', 2: '2nd', 3: '3rd'}.get(i + 1, f'{i + 1}th')\n                hdulist[0].header[f'{d_kw}{num:d}.AXIS.{i + 1:d}'] = (\n                    i + 1,\n                    f'Axis number of the {jth} variable in a {dist} function')\n\n            image = fits.ImageHDU(cpdis.data, name='WCSDVARR')\n            header = image.header\n\n            header['CRPIX1'] = (cpdis.crpix[0], 'Coordinate system reference pixel')\n            header['CRPIX2'] = (cpdis.crpix[1], 'Coordinate system reference pixel')\n            header['CRVAL1'] = (cpdis.crval[0], 'Coordinate system value at reference pixel')\n            header['CRVAL2'] = (cpdis.crval[1], 'Coordinate system value at reference pixel')\n            header['CDELT1'] = (cpdis.cdelt[0], 'Coordinate increment along axis')\n            header['CDELT2'] = (cpdis.cdelt[1], 'Coordinate increment along axis')\n            image.ver = int(hdulist[0].header[f'{d_kw}{num:d}.EXTVER'])\n            hdulist.append(image)\n\n        write_dist(1, self.cpdis1)\n        write_dist(2, self.cpdis2)"},{"attributeType":"null","col":0,"comment":"null","endLoc":60,"id":2914,"name":"CMTYPE_ALIASES","nodeType":"Attribute","startLoc":60,"text":"CMTYPE_ALIASES"},{"col":4,"comment":"Peak to peak (maximum - minimum) along a given axis.\n\n        This is similar to :meth:`~numpy.ndarray.ptp`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used.\n\n        Note that the ``out`` argument is present only for compatibility with\n        `~numpy.ptp`; since `Time` instances are immutable, it is not possible\n        to have an actual ``out`` to store the result in.\n        ","endLoc":1295,"header":"def ptp(self, axis=None, out=None, keepdims=False)","id":2915,"name":"ptp","nodeType":"Function","startLoc":1280,"text":"def ptp(self, axis=None, out=None, keepdims=False):\n        \"\"\"Peak to peak (maximum - minimum) along a given axis.\n\n        This is similar to :meth:`~numpy.ndarray.ptp`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used.\n\n        Note that the ``out`` argument is present only for compatibility with\n        `~numpy.ptp`; since `Time` instances are immutable, it is not possible\n        to have an actual ``out`` to store the result in.\n        \"\"\"\n        if out is not None:\n            raise ValueError(\"Since `Time` instances are immutable, ``out`` \"\n                             \"cannot be set to anything but ``None``.\")\n        return (self.max(axis, keepdims=keepdims)\n                - self.min(axis, keepdims=keepdims))"},{"attributeType":"null","col":0,"comment":"null","endLoc":62,"id":2916,"name":"COMPRESSION_KEYWORDS","nodeType":"Attribute","startLoc":62,"text":"COMPRESSION_KEYWORDS"},{"col":0,"comment":"","endLoc":3,"header":"compressed.py#<anonymous>","id":2917,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"try:\n    from astropy.io.fits import compression\n    COMPRESSION_SUPPORTED = COMPRESSION_ENABLED = True\nexcept ImportError:\n    COMPRESSION_SUPPORTED = COMPRESSION_ENABLED = False\n\nNO_DITHER = -1\n\nSUBTRACTIVE_DITHER_1 = 1\n\nSUBTRACTIVE_DITHER_2 = 2\n\nQUANTIZE_METHOD_NAMES = {\n    NO_DITHER: 'NO_DITHER',\n    SUBTRACTIVE_DITHER_1: 'SUBTRACTIVE_DITHER_1',\n    SUBTRACTIVE_DITHER_2: 'SUBTRACTIVE_DITHER_2'\n}\n\nDITHER_SEED_CLOCK = 0\n\nDITHER_SEED_CHECKSUM = -1\n\nCOMPRESSION_TYPES = ('RICE_1', 'GZIP_1', 'GZIP_2', 'PLIO_1', 'HCOMPRESS_1')\n\nDEFAULT_COMPRESSION_TYPE = 'RICE_1'\n\nDEFAULT_QUANTIZE_LEVEL = 16.\n\nDEFAULT_QUANTIZE_METHOD = NO_DITHER\n\nDEFAULT_DITHER_SEED = DITHER_SEED_CLOCK\n\nDEFAULT_HCOMP_SCALE = 0\n\nDEFAULT_HCOMP_SMOOTH = 0\n\nDEFAULT_BLOCK_SIZE = 32\n\nDEFAULT_BYTE_PIX = 4\n\nCMTYPE_ALIASES = {'RICE_ONE': 'RICE_1'}\n\nCOMPRESSION_KEYWORDS = {'ZIMAGE', 'ZCMPTYPE', 'ZBITPIX', 'ZNAXIS', 'ZMASKCMP',\n                        'ZSIMPLE', 'ZTENSION', 'ZEXTEND'}"},{"col":4,"comment":"Return a copy sorted along the specified axis.\n\n        This is similar to :meth:`~numpy.ndarray.sort`, but internally uses\n        indexing with :func:`~numpy.lexsort` to ensure that the full precision\n        given by the two doubles ``jd1`` and ``jd2`` is kept, and that\n        corresponding attributes are properly sorted and copied as well.\n\n        Parameters\n        ----------\n        axis : int or None\n            Axis to be sorted.  If ``None``, the flattened array is sorted.\n            By default, sort over the last axis.\n        ","endLoc":1312,"header":"def sort(self, axis=-1)","id":2918,"name":"sort","nodeType":"Function","startLoc":1297,"text":"def sort(self, axis=-1):\n        \"\"\"Return a copy sorted along the specified axis.\n\n        This is similar to :meth:`~numpy.ndarray.sort`, but internally uses\n        indexing with :func:`~numpy.lexsort` to ensure that the full precision\n        given by the two doubles ``jd1`` and ``jd2`` is kept, and that\n        corresponding attributes are properly sorted and copied as well.\n\n        Parameters\n        ----------\n        axis : int or None\n            Axis to be sorted.  If ``None``, the flattened array is sorted.\n            By default, sort over the last axis.\n        \"\"\"\n        return self[self._advanced_index(self.argsort(axis), axis,\n                                         keepdims=True)]"},{"fileName":"__init__.py","filePath":"astropy/io/fits/scripts","id":2919,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis subpackage contains implementations of command-line scripts that are\nincluded with Astropy.\n\nThe actual scripts that are installed in bin/ are simple wrappers for these\nmodules that will run in any Python version.\n\"\"\"\n"},{"col":0,"comment":"","endLoc":8,"header":"__init__.py#<anonymous>","id":2921,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis subpackage contains implementations of command-line scripts that are\nincluded with Astropy.\n\nThe actual scripts that are installed in bin/ are simple wrappers for these\nmodules that will run in any Python version.\n\"\"\""},{"col":4,"comment":"null","endLoc":1890,"header":"def _all_world2pix(self, world, origin, tolerance, maxiter, adaptive,\n                       detect_divergence, quiet)","id":2922,"name":"_all_world2pix","nodeType":"Function","startLoc":1496,"text":"def _all_world2pix(self, world, origin, tolerance, maxiter, adaptive,\n                       detect_divergence, quiet):\n        # ############################################################\n        # #          DESCRIPTION OF THE NUMERICAL METHOD            ##\n        # ############################################################\n        # In this section I will outline the method of solving\n        # the inverse problem of converting world coordinates to\n        # pixel coordinates (*inverse* of the direct transformation\n        # `all_pix2world`) and I will summarize some of the aspects\n        # of the method proposed here and some of the issues of the\n        # original `all_world2pix` (in relation to this method)\n        # discussed in https://github.com/astropy/astropy/issues/1977\n        # A more detailed discussion can be found here:\n        # https://github.com/astropy/astropy/pull/2373\n        #\n        #\n        #                  ### Background ###\n        #\n        #\n        # I will refer here to the [SIP Paper]\n        # (http://fits.gsfc.nasa.gov/registry/sip/SIP_distortion_v1_0.pdf).\n        # According to this paper, the effect of distortions as\n        # described in *their* equation (1) is:\n        #\n        # (1)   x = CD*(u+f(u)),\n        #\n        # where `x` is a *vector* of \"intermediate spherical\n        # coordinates\" (equivalent to (x,y) in the paper) and `u`\n        # is a *vector* of \"pixel coordinates\", and `f` is a vector\n        # function describing geometrical distortions\n        # (see equations 2 and 3 in SIP Paper.\n        # However, I prefer to use `w` for \"intermediate world\n        # coordinates\", `x` for pixel coordinates, and assume that\n        # transformation `W` performs the **linear**\n        # (CD matrix + projection onto celestial sphere) part of the\n        # conversion from pixel coordinates to world coordinates.\n        # Then we can re-write (1) as:\n        #\n        # (2)   w = W*(x+f(x)) = T(x)\n        #\n        # In `astropy.wcs.WCS` transformation `W` is represented by\n        # the `wcs_pix2world` member, while the combined (\"total\")\n        # transformation (linear part + distortions) is performed by\n        # `all_pix2world`. Below I summarize the notations and their\n        # equivalents in `astropy.wcs.WCS`:\n        #\n        # | Equation term | astropy.WCS/meaning          |\n        # | ------------- | ---------------------------- |\n        # | `x`           | pixel coordinates            |\n        # | `w`           | world coordinates            |\n        # | `W`           | `wcs_pix2world()`            |\n        # | `W^{-1}`      | `wcs_world2pix()`            |\n        # | `T`           | `all_pix2world()`            |\n        # | `x+f(x)`      | `pix2foc()`                  |\n        #\n        #\n        #      ### Direct Solving of Equation (2)  ###\n        #\n        #\n        # In order to find the pixel coordinates that correspond to\n        # given world coordinates `w`, it is necessary to invert\n        # equation (2): `x=T^{-1}(w)`, or solve equation `w==T(x)`\n        # for `x`. However, this approach has the following\n        # disadvantages:\n        #    1. It requires unnecessary transformations (see next\n        #       section).\n        #    2. It is prone to \"RA wrapping\" issues as described in\n        # https://github.com/astropy/astropy/issues/1977\n        # (essentially because `all_pix2world` may return points with\n        # a different phase than user's input `w`).\n        #\n        #\n        #      ### Description of the Method Used here ###\n        #\n        #\n        # By applying inverse linear WCS transformation (`W^{-1}`)\n        # to both sides of equation (2) and introducing notation `x'`\n        # (prime) for the pixels coordinates obtained from the world\n        # coordinates by applying inverse *linear* WCS transformation\n        # (\"focal plane coordinates\"):\n        #\n        # (3)   x' = W^{-1}(w)\n        #\n        # we obtain the following equation:\n        #\n        # (4)   x' = x+f(x),\n        #\n        # or,\n        #\n        # (5)   x = x'-f(x)\n        #\n        # This equation is well suited for solving using the method\n        # of fixed-point iterations\n        # (http://en.wikipedia.org/wiki/Fixed-point_iteration):\n        #\n        # (6)   x_{i+1} = x'-f(x_i)\n        #\n        # As an initial value of the pixel coordinate `x_0` we take\n        # \"focal plane coordinate\" `x'=W^{-1}(w)=wcs_world2pix(w)`.\n        # We stop iterations when `|x_{i+1}-x_i|<tolerance`. We also\n        # consider the process to be diverging if\n        # `|x_{i+1}-x_i|>|x_i-x_{i-1}|`\n        # **when** `|x_{i+1}-x_i|>=tolerance` (when current\n        # approximation is close to the true solution,\n        # `|x_{i+1}-x_i|>|x_i-x_{i-1}|` may be due to rounding errors\n        # and we ignore such \"divergences\" when\n        # `|x_{i+1}-x_i|<tolerance`). It may appear that checking for\n        # `|x_{i+1}-x_i|<tolerance` in order to ignore divergence is\n        # unnecessary since the iterative process should stop anyway,\n        # however, the proposed implementation of this iterative\n        # process is completely vectorized and, therefore, we may\n        # continue iterating over *some* points even though they have\n        # converged to within a specified tolerance (while iterating\n        # over other points that have not yet converged to\n        # a solution).\n        #\n        # In order to efficiently implement iterative process (6)\n        # using available methods in `astropy.wcs.WCS`, we add and\n        # subtract `x_i` from the right side of equation (6):\n        #\n        # (7)   x_{i+1} = x'-(x_i+f(x_i))+x_i = x'-pix2foc(x_i)+x_i,\n        #\n        # where `x'=wcs_world2pix(w)` and it is computed only *once*\n        # before the beginning of the iterative process (and we also\n        # set `x_0=x'`). By using `pix2foc` at each iteration instead\n        # of `all_pix2world` we get about 25% increase in performance\n        # (by not performing the linear `W` transformation at each\n        # step) and we also avoid the \"RA wrapping\" issue described\n        # above (by working in focal plane coordinates and avoiding\n        # pix->world transformations).\n        #\n        # As an added benefit, the process converges to the correct\n        # solution in just one iteration when distortions are not\n        # present (compare to\n        # https://github.com/astropy/astropy/issues/1977 and\n        # https://github.com/astropy/astropy/pull/2294): in this case\n        # `pix2foc` is the identical transformation\n        # `x_i=pix2foc(x_i)` and from equation (7) we get:\n        #\n        # x' = x_0 = wcs_world2pix(w)\n        # x_1 = x' - pix2foc(x_0) + x_0 = x' - pix2foc(x') + x' = x'\n        #     = wcs_world2pix(w) = x_0\n        # =>\n        # |x_1-x_0| = 0 < tolerance (with tolerance > 0)\n        #\n        # However, for performance reasons, it is still better to\n        # avoid iterations altogether and return the exact linear\n        # solution (`wcs_world2pix`) right-away when non-linear\n        # distortions are not present by checking that attributes\n        # `sip`, `cpdis1`, `cpdis2`, `det2im1`, and `det2im2` are\n        # *all* `None`.\n        #\n        #\n        #         ### Outline of the Algorithm ###\n        #\n        #\n        # While the proposed code is relatively long (considering\n        # the simplicity of the algorithm), this is due to: 1)\n        # checking if iterative solution is necessary at all; 2)\n        # checking for divergence; 3) re-implementation of the\n        # completely vectorized algorithm as an \"adaptive\" vectorized\n        # algorithm (for cases when some points diverge for which we\n        # want to stop iterations). In my tests, the adaptive version\n        # of the algorithm is about 50% slower than non-adaptive\n        # version for all HST images.\n        #\n        # The essential part of the vectorized non-adaptive algorithm\n        # (without divergence and other checks) can be described\n        # as follows:\n        #\n        #     pix0 = self.wcs_world2pix(world, origin)\n        #     pix  = pix0.copy() # 0-order solution\n        #\n        #     for k in range(maxiter):\n        #         # find correction to the previous solution:\n        #         dpix = self.pix2foc(pix, origin) - pix0\n        #\n        #         # compute norm (L2) of the correction:\n        #         dn = np.linalg.norm(dpix, axis=1)\n        #\n        #         # apply correction:\n        #         pix -= dpix\n        #\n        #         # check convergence:\n        #         if np.max(dn) < tolerance:\n        #             break\n        #\n        #    return pix\n        #\n        # Here, the input parameter `world` can be a `MxN` array\n        # where `M` is the number of coordinate axes in WCS and `N`\n        # is the number of points to be converted simultaneously to\n        # image coordinates.\n        #\n        #\n        #                ###  IMPORTANT NOTE:  ###\n        #\n        # If, in the future releases of the `~astropy.wcs`,\n        # `pix2foc` will not apply all the required distortion\n        # corrections then in the code below, calls to `pix2foc` will\n        # have to be replaced with\n        # wcs_world2pix(all_pix2world(pix_list, origin), origin)\n        #\n\n        # ############################################################\n        # #            INITIALIZE ITERATIVE PROCESS:                ##\n        # ############################################################\n\n        # initial approximation (linear WCS based only)\n        pix0 = self.wcs_world2pix(world, origin)\n\n        # Check that an iterative solution is required at all\n        # (when any of the non-CD-matrix-based corrections are\n        # present). If not required return the initial\n        # approximation (pix0).\n        if not self.has_distortion:\n            # No non-WCS corrections detected so\n            # simply return initial approximation:\n            return pix0\n\n        pix = pix0.copy()  # 0-order solution\n\n        # initial correction:\n        dpix = self.pix2foc(pix, origin) - pix0\n\n        # Update initial solution:\n        pix -= dpix\n\n        # Norm (L2) squared of the correction:\n        dn = np.sum(dpix*dpix, axis=1)\n        dnprev = dn.copy()  # if adaptive else dn\n        tol2 = tolerance**2\n\n        # Prepare for iterative process\n        k = 1\n        ind = None\n        inddiv = None\n\n        # Turn off numpy runtime warnings for 'invalid' and 'over':\n        old_invalid = np.geterr()['invalid']\n        old_over = np.geterr()['over']\n        np.seterr(invalid='ignore', over='ignore')\n\n        # ############################################################\n        # #                NON-ADAPTIVE ITERATIONS:                 ##\n        # ############################################################\n        if not adaptive:\n            # Fixed-point iterations:\n            while (np.nanmax(dn) >= tol2 and k < maxiter):\n                # Find correction to the previous solution:\n                dpix = self.pix2foc(pix, origin) - pix0\n\n                # Compute norm (L2) squared of the correction:\n                dn = np.sum(dpix*dpix, axis=1)\n\n                # Check for divergence (we do this in two stages\n                # to optimize performance for the most common\n                # scenario when successive approximations converge):\n                if detect_divergence:\n                    divergent = (dn >= dnprev)\n                    if np.any(divergent):\n                        # Find solutions that have not yet converged:\n                        slowconv = (dn >= tol2)\n                        inddiv, = np.where(divergent & slowconv)\n\n                        if inddiv.shape[0] > 0:\n                            # Update indices of elements that\n                            # still need correction:\n                            conv = (dn < dnprev)\n                            iconv = np.where(conv)\n\n                            # Apply correction:\n                            dpixgood = dpix[iconv]\n                            pix[iconv] -= dpixgood\n                            dpix[iconv] = dpixgood\n\n                            # For the next iteration choose\n                            # non-divergent points that have not yet\n                            # converged to the requested accuracy:\n                            ind, = np.where(slowconv & conv)\n                            pix0 = pix0[ind]\n                            dnprev[ind] = dn[ind]\n                            k += 1\n\n                            # Switch to adaptive iterations:\n                            adaptive = True\n                            break\n                    # Save current correction magnitudes for later:\n                    dnprev = dn\n\n                # Apply correction:\n                pix -= dpix\n                k += 1\n\n        # ############################################################\n        # #                  ADAPTIVE ITERATIONS:                   ##\n        # ############################################################\n        if adaptive:\n            if ind is None:\n                ind, = np.where(np.isfinite(pix).all(axis=1))\n                pix0 = pix0[ind]\n\n            # \"Adaptive\" fixed-point iterations:\n            while (ind.shape[0] > 0 and k < maxiter):\n                # Find correction to the previous solution:\n                dpixnew = self.pix2foc(pix[ind], origin) - pix0\n\n                # Compute norm (L2) of the correction:\n                dnnew = np.sum(np.square(dpixnew), axis=1)\n\n                # Bookkeeping of corrections:\n                dnprev[ind] = dn[ind].copy()\n                dn[ind] = dnnew\n\n                if detect_divergence:\n                    # Find indices of pixels that are converging:\n                    conv = (dnnew < dnprev[ind])\n                    iconv = np.where(conv)\n                    iiconv = ind[iconv]\n\n                    # Apply correction:\n                    dpixgood = dpixnew[iconv]\n                    pix[iiconv] -= dpixgood\n                    dpix[iiconv] = dpixgood\n\n                    # Find indices of solutions that have not yet\n                    # converged to the requested accuracy\n                    # AND that do not diverge:\n                    subind, = np.where((dnnew >= tol2) & conv)\n\n                else:\n                    # Apply correction:\n                    pix[ind] -= dpixnew\n                    dpix[ind] = dpixnew\n\n                    # Find indices of solutions that have not yet\n                    # converged to the requested accuracy:\n                    subind, = np.where(dnnew >= tol2)\n\n                # Choose solutions that need more iterations:\n                ind = ind[subind]\n                pix0 = pix0[subind]\n\n                k += 1\n\n        # ############################################################\n        # #         FINAL DETECTION OF INVALID, DIVERGING,          ##\n        # #         AND FAILED-TO-CONVERGE POINTS                   ##\n        # ############################################################\n        # Identify diverging and/or invalid points:\n        invalid = ((~np.all(np.isfinite(pix), axis=1)) &\n                   (np.all(np.isfinite(world), axis=1)))\n\n        # When detect_divergence==False, dnprev is outdated\n        # (it is the norm of the very first correction).\n        # Still better than nothing...\n        inddiv, = np.where(((dn >= tol2) & (dn >= dnprev)) | invalid)\n        if inddiv.shape[0] == 0:\n            inddiv = None\n\n        # Identify points that did not converge within 'maxiter'\n        # iterations:\n        if k >= maxiter:\n            ind, = np.where((dn >= tol2) & (dn < dnprev) & (~invalid))\n            if ind.shape[0] == 0:\n                ind = None\n        else:\n            ind = None\n\n        # Restore previous numpy error settings:\n        np.seterr(invalid=old_invalid, over=old_over)\n\n        # ############################################################\n        # #  RAISE EXCEPTION IF DIVERGING OR TOO SLOWLY CONVERGING  ##\n        # #  DATA POINTS HAVE BEEN DETECTED:                        ##\n        # ############################################################\n        if (ind is not None or inddiv is not None) and not quiet:\n            if inddiv is None:\n                raise NoConvergence(\n                    \"'WCS.all_world2pix' failed to \"\n                    \"converge to the requested accuracy after {:d} \"\n                    \"iterations.\".format(k), best_solution=pix,\n                    accuracy=np.abs(dpix), niter=k,\n                    slow_conv=ind, divergent=None)\n            else:\n                raise NoConvergence(\n                    \"'WCS.all_world2pix' failed to \"\n                    \"converge to the requested accuracy.\\n\"\n                    \"After {:d} iterations, the solution is diverging \"\n                    \"at least for one input point.\"\n                    .format(k), best_solution=pix,\n                    accuracy=np.abs(dpix), niter=k,\n                    slow_conv=ind, divergent=inddiv)\n\n        return pix"},{"id":2923,"name":"astropy/io/misc","nodeType":"Package"},{"fileName":"parquet.py","filePath":"astropy/io/misc","id":2924,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis package contains functions for reading and writing Parquet\ntables that are not meant to be used directly, but instead are\navailable as readers/writers in `astropy.table`.  See\n:ref:`astropy:table_io` for more details.\n\"\"\"\n\nimport os\nimport warnings\n\nimport numpy as np\n\n# NOTE: Do not import anything from astropy.table here.\n# https://github.com/astropy/astropy/issues/6604\nfrom astropy.utils.exceptions import AstropyUserWarning\nfrom astropy.utils.misc import NOT_OVERWRITING_MSG\n\nfrom astropy.utils import minversion\n\n\nPARQUET_SIGNATURE = b'PAR1'\n\n__all__ = []  # nothing is publicly scoped\n\n\ndef parquet_identify(origin, filepath, fileobj, *args, **kwargs):\n    \"\"\"Checks if input is in the Parquet format.\n\n    Parameters\n    ----------\n    origin : Any\n    filepath : str or None\n    fileobj : `~pyarrow.NativeFile` or None\n    *args, **kwargs\n\n    Returns\n    -------\n    is_parquet : bool\n        True if 'fileobj' is not None and is a pyarrow file, or if\n        'filepath' is a string ending with '.parquet' or '.parq'.\n        False otherwise.\n    \"\"\"\n    if fileobj is not None:\n        try:  # safely test if pyarrow file\n            pos = fileobj.tell()  # store current stream position\n        except AttributeError:\n            return False\n\n        signature = fileobj.read(4)  # read first 4 bytes\n        fileobj.seek(pos)  # return to original location\n\n        return signature == PARQUET_SIGNATURE\n    elif filepath is not None:\n        return filepath.endswith(('.parquet', '.parq'))\n    else:\n        return False\n\n\ndef read_table_parquet(input, include_names=None, exclude_names=None,\n                       schema_only=False, filters=None):\n    \"\"\"\n    Read a Table object from a Parquet file.\n\n    This requires `pyarrow <https://arrow.apache.org/docs/python/>`_\n    to be installed.\n\n    The ``filters`` parameter consists of predicates that are expressed\n    in disjunctive normal form (DNF), like ``[[('x', '=', 0), ...], ...]``.\n    DNF allows arbitrary boolean logical combinations of single column\n    predicates. The innermost tuples each describe a single column predicate.\n    The list of inner predicates is interpreted as a conjunction (AND),\n    forming a more selective and multiple column predicate. Finally, the most\n    outer list combines these filters as a disjunction (OR).\n\n    Predicates may also be passed as List[Tuple]. This form is interpreted\n    as a single conjunction. To express OR in predicates, one must\n    use the (preferred) List[List[Tuple]] notation.\n\n    Each tuple has format: (``key``, ``op``, ``value``) and compares the\n    ``key`` with the ``value``.\n    The supported ``op`` are:  ``=`` or ``==``, ``!=``, ``<``, ``>``, ``<=``,\n    ``>=``, ``in`` and ``not in``. If the ``op`` is ``in`` or ``not in``, the\n    ``value`` must be a collection such as a ``list``, a ``set`` or a\n    ``tuple``.\n\n    Examples:\n\n    .. code-block:: python\n\n        ('x', '=', 0)\n        ('y', 'in', ['a', 'b', 'c'])\n        ('z', 'not in', {'a','b'})\n\n    Parameters\n    ----------\n    input : str or path-like or file-like object\n        If a string or path-like object, the filename to read the table from.\n        If a file-like object, the stream to read data.\n    include_names : list [str], optional\n        List of names to include in output. If not supplied, then\n        include all columns.\n    exclude_names : list [str], optional\n        List of names to exclude from output (applied after ``include_names``).\n        If not supplied then no columns are excluded.\n    schema_only : bool, optional\n        Only read the schema/metadata with table information.\n    filters : list [tuple] or list [list [tuple] ] or None, optional\n        Rows which do not match the filter predicate will be removed from\n        scanned data.  See `pyarrow.parquet.read_table()` for details.\n\n    Returns\n    -------\n    table : `~astropy.table.Table`\n        Table will have zero rows and only metadata information\n        if schema_only is True.\n    \"\"\"\n    pa, parquet, _ = get_pyarrow()\n\n    if not isinstance(input, (str, os.PathLike)):\n        # The 'read' attribute is the key component of a generic\n        # file-like object.\n        if not hasattr(input, 'read'):\n            raise TypeError(\"pyarrow can only open path-like or file-like objects.\")\n\n    schema = parquet.read_schema(input)\n\n    # Pyarrow stores all metadata as byte-strings, so we convert\n    # to UTF-8 strings here.\n    if schema.metadata is not None:\n        md = {k.decode('UTF-8'): v.decode('UTF-8') for k, v in schema.metadata.items()}\n    else:\n        md = {}\n\n    from astropy.table import Table, meta, serialize\n\n    # parse metadata from table yaml\n    meta_dict = {}\n    if 'table_meta_yaml' in md:\n        meta_yaml = md.pop('table_meta_yaml').split('\\n')\n        meta_hdr = meta.get_header_from_yaml(meta_yaml)\n        if 'meta' in meta_hdr:\n            meta_dict = meta_hdr['meta']\n    else:\n        meta_hdr = None\n\n    # parse and set serialized columns\n    full_table_columns = {name: name for name in schema.names}\n    has_serialized_columns = False\n    if '__serialized_columns__' in meta_dict:\n        has_serialized_columns = True\n        serialized_columns = meta_dict['__serialized_columns__']\n        for scol in serialized_columns:\n            for name in _get_names(serialized_columns[scol]):\n                full_table_columns[name] = scol\n\n    use_names = set(full_table_columns.values())\n    # Apply include_names before exclude_names\n    if include_names is not None:\n        use_names.intersection_update(include_names)\n    if exclude_names is not None:\n        use_names.difference_update(exclude_names)\n    # Preserve column ordering via list, and use this dict trick\n    # to remove duplicates and preserve ordering (for mixin columns)\n    use_names = list(dict.fromkeys([x for x in full_table_columns.values() if x in use_names]))\n\n    # names_to_read is a list of actual serialized column names, where\n    # e.g. the requested name 'time' becomes ['time.jd1', 'time.jd2']\n    names_to_read = []\n    for name in use_names:\n        names = [n for n, col in full_table_columns.items() if name == col]\n        names_to_read.extend(names)\n\n    if not names_to_read:\n        raise ValueError(\"No include_names specified were found in the table.\")\n\n    # We need to pop any unread serialized columns out of the meta_dict.\n    if has_serialized_columns:\n        for scol in list(meta_dict['__serialized_columns__'].keys()):\n            if scol not in use_names:\n                meta_dict['__serialized_columns__'].pop(scol)\n\n    # whether to return the whole table or a formatted empty table.\n    if not schema_only:\n        # Read the pyarrow table, specifying columns and filters.\n        pa_table = parquet.read_table(input, columns=names_to_read, filters=filters)\n        num_rows = pa_table.num_rows\n    else:\n        num_rows = 0\n\n    # Now need to convert parquet table to Astropy\n    dtype = []\n    for name in names_to_read:\n        # Pyarrow string and byte columns do not have native length information\n        # so we must determine those here.\n        if schema.field(name).type not in (pa.string(), pa.binary()):\n            # Convert the pyarrow type into a numpy dtype (which is returned\n            # by the to_pandas_type() method).\n            dtype.append(schema.field(name).type.to_pandas_dtype())\n            continue\n\n        # Special-case for string and binary columns\n        md_name = f'table::len::{name}'\n        if md_name in md:\n            # String/bytes length from header.\n            strlen = int(md[md_name])\n        elif schema_only:  # Find the maximum string length.\n            # Choose an arbitrary string length since\n            # are not reading in the table.\n            strlen = 10\n            warnings.warn(f\"No {md_name} found in metadata. \"\n                          f\"Guessing {{strlen}} for schema.\",\n                          AstropyUserWarning)\n        else:\n            strlen = max([len(row.as_py()) for row in pa_table[name]])\n            warnings.warn(f\"No {md_name} found in metadata. \"\n                          f\"Using longest string ({{strlen}} characters).\",\n                          AstropyUserWarning)\n        dtype.append(f'U{strlen}' if schema.field(name).type == pa.string() else f'|S{strlen}')\n\n    # Create the empty numpy record array to store the pyarrow data.\n    data = np.zeros(num_rows, dtype=list(zip(names_to_read, dtype)))\n\n    if not schema_only:\n        # Convert each column in the pyarrow table to a numpy array\n        for name in names_to_read:\n            data[name][:] = pa_table[name].to_numpy()\n\n    table = Table(data=data, meta=meta_dict)\n\n    if meta_hdr is not None:\n        # Set description, format, unit, meta from the column\n        # metadata that was serialized with the table.\n        header_cols = dict((x['name'], x) for x in meta_hdr['datatype'])\n        for col in table.columns.values():\n            for attr in ('description', 'format', 'unit', 'meta'):\n                if attr in header_cols[col.name]:\n                    setattr(col, attr, header_cols[col.name][attr])\n\n    # Convert all compound columns to astropy objects\n    # (e.g. time.jd1, time.jd2 into a single time column)\n    table = serialize._construct_mixins_from_columns(table)\n\n    return table\n\n\ndef write_table_parquet(table, output, overwrite=False):\n    \"\"\"\n    Write a Table object to a Parquet file\n\n    This requires `pyarrow <https://arrow.apache.org/docs/python/>`_\n    to be installed.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        Data table that is to be written to file.\n    output : str or path-like\n        The filename to write the table to.\n    overwrite : bool, optional\n        Whether to overwrite any existing file without warning. Default `False`.\n    \"\"\"\n\n    from astropy.table import meta, serialize\n    from astropy.utils.data_info import serialize_context_as\n\n    pa, parquet, writer_version = get_pyarrow()\n\n    if not isinstance(output, (str, os.PathLike)):\n        raise TypeError(f'`output` should be a string or path-like, not {output}')\n\n    # Convert all compound columns into serialized column names, where\n    # e.g. 'time' becomes ['time.jd1', 'time.jd2'].\n    with serialize_context_as('parquet'):\n        encode_table = serialize.represent_mixins_as_columns(table)\n    # We store the encoded serialization metadata as a yaml string.\n    meta_yaml = meta.get_yaml_from_table(encode_table)\n    meta_yaml_str = '\\n'.join(meta_yaml)\n\n    metadata = {}\n    for name, col in encode_table.columns.items():\n        # Parquet will retain the datatypes of columns, but string and\n        # byte column length is lost.  Therefore, we special-case these\n        # types to record the length for precise round-tripping.\n        if col.dtype.type is np.str_:\n            metadata[f'table::len::{name}'] = str(col.dtype.itemsize//4)\n        elif col.dtype.type is np.bytes_:\n            metadata[f'table::len::{name}'] = str(col.dtype.itemsize)\n\n        metadata['table_meta_yaml'] = meta_yaml_str\n\n    # Pyarrow stores all metadata as byte strings, so we explicitly encode\n    # our unicode strings in metadata as UTF-8 byte strings here.\n    metadata_encode = {k.encode('UTF-8'): v.encode('UTF-8') for k, v in metadata.items()}\n\n    # Build the pyarrow schema by converting from the numpy dtype of each\n    # column to an equivalent pyarrow type with from_numpy_dtype()\n    type_list = [(name, pa.from_numpy_dtype(encode_table.dtype[name].type))\n                 for name in encode_table.dtype.names]\n    schema = pa.schema(type_list, metadata=metadata_encode)\n\n    if os.path.exists(output):\n        if overwrite:\n            # We must remove the file prior to writing below.\n            os.remove(output)\n        else:\n            raise OSError(NOT_OVERWRITING_MSG.format(output))\n\n    # We use version='2.0' for full support of datatypes including uint32.\n    with parquet.ParquetWriter(output, schema, version=writer_version) as writer:\n        # Convert each Table column to a pyarrow array\n        arrays = [pa.array(col) for col in encode_table.itercols()]\n        # Create a pyarrow table from the list of arrays and the schema\n        pa_table = pa.Table.from_arrays(arrays, schema=schema)\n        # Write the pyarrow table to a file\n        writer.write_table(pa_table)\n\n\ndef _get_names(_dict):\n    \"\"\"Recursively find the names in a serialized column dictionary.\n\n    Parameters\n    ----------\n    _dict : `dict`\n        Dictionary from astropy __serialized_columns__\n\n    Returns\n    -------\n    all_names : `list` [`str`]\n        All the column names mentioned in _dict and sub-dicts.\n    \"\"\"\n    all_names = []\n    for k, v in _dict.items():\n        if isinstance(v, dict):\n            all_names.extend(_get_names(v))\n        elif k == 'name':\n            all_names.append(v)\n    return all_names\n\n\ndef register_parquet():\n    \"\"\"\n    Register Parquet with Unified I/O.\n    \"\"\"\n    from astropy.io import registry as io_registry\n    from astropy.table import Table\n\n    io_registry.register_reader('parquet', Table, read_table_parquet)\n    io_registry.register_writer('parquet', Table, write_table_parquet)\n    io_registry.register_identifier('parquet', Table, parquet_identify)\n\n\ndef get_pyarrow():\n    try:\n        import pyarrow as pa\n        from pyarrow import parquet\n    except ImportError:\n        raise Exception(\"pyarrow is required to read and write parquet files\")\n\n    if minversion(pa, '6.0.0'):\n        writer_version = '2.4'\n    else:\n        writer_version = '2.0'\n\n    return pa, parquet, writer_version\n"},{"className":"KeywordAppendAction","col":0,"comment":"null","endLoc":405,"id":2925,"nodeType":"Class","startLoc":399,"text":"class KeywordAppendAction(argparse.Action):\n    def __call__(self, parser, namespace, values, option_string=None):\n        keyword = values.replace('.', ' ')\n        if namespace.keywords is None:\n            namespace.keywords = []\n        if keyword not in namespace.keywords:\n            namespace.keywords.append(keyword)"},{"col":4,"comment":"null","endLoc":405,"header":"def __call__(self, parser, namespace, values, option_string=None)","id":2926,"name":"__call__","nodeType":"Function","startLoc":400,"text":"def __call__(self, parser, namespace, values, option_string=None):\n        keyword = values.replace('.', ' ')\n        if namespace.keywords is None:\n            namespace.keywords = []\n        if keyword not in namespace.keywords:\n            namespace.keywords.append(keyword)"},{"col":4,"comment":"\n        Return the cache associated with this instance.\n        ","endLoc":1319,"header":"@property\n    def cache(self)","id":2927,"name":"cache","nodeType":"Function","startLoc":1314,"text":"@property\n    def cache(self):\n        \"\"\"\n        Return the cache associated with this instance.\n        \"\"\"\n        return self._time.cache"},{"col":4,"comment":"null","endLoc":1323,"header":"@cache.deleter\n    def cache(self)","id":2928,"name":"cache","nodeType":"Function","startLoc":1321,"text":"@cache.deleter\n    def cache(self):\n        del self._time.cache"},{"col":4,"comment":"\n        Get dynamic attributes to output format or do timescale conversion.\n        ","endLoc":1358,"header":"def __getattr__(self, attr)","id":2929,"name":"__getattr__","nodeType":"Function","startLoc":1325,"text":"def __getattr__(self, attr):\n        \"\"\"\n        Get dynamic attributes to output format or do timescale conversion.\n        \"\"\"\n        if attr in self.SCALES and self.scale is not None:\n            cache = self.cache['scale']\n            if attr not in cache:\n                if attr == self.scale:\n                    tm = self\n                else:\n                    tm = self.replicate()\n                    tm._set_scale(attr)\n                    if tm.shape:\n                        # Prevent future modification of cached array-like object\n                        tm.writeable = False\n                cache[attr] = tm\n            return cache[attr]\n\n        elif attr in self.FORMATS:\n            return self.to_value(attr, subfmt=None)\n\n        elif attr in TIME_SCALES:  # allowed ones done above (self.SCALES)\n            if self.scale is None:\n                raise ScaleValueError(\"Cannot convert TimeDelta with \"\n                                      \"undefined scale to any defined scale.\")\n            else:\n                raise ScaleValueError(\"Cannot convert {} with scale \"\n                                      \"'{}' to scale '{}'\"\n                                      .format(self.__class__.__name__,\n                                              self.scale, attr))\n\n        else:\n            # Should raise AttributeError\n            return self.__getattribute__(attr)"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":2930,"name":"log","nodeType":"Attribute","startLoc":13,"text":"log"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":2931,"name":"DESCRIPTION","nodeType":"Attribute","startLoc":16,"text":"DESCRIPTION"},{"attributeType":"null","col":0,"comment":"null","endLoc":40,"id":2932,"name":"EPILOG","nodeType":"Attribute","startLoc":40,"text":"EPILOG"},{"col":0,"comment":"","endLoc":2,"header":"fitsdiff.py#<anonymous>","id":2933,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"log = logging.getLogger('fitsdiff')\n\nDESCRIPTION = \"\"\"\nCompare two FITS image files and report the differences in header keywords and\ndata.\n\n    fitsdiff [options] filename1 filename2\n\nwhere filename1 filename2 are the two files to be compared.  They may also be\nwild cards, in such cases, they must be enclosed by double or single quotes, or\nthey may be directory names.  If both are directory names, all files in each of\nthe directories will be included; if only one is a directory name, then the\ndirectory name will be prefixed to the file name(s) specified by the other\nargument.  for example::\n\n    fitsdiff \"*.fits\" \"/machine/data1\"\n\nwill compare all FITS files in the current directory to the corresponding files\nin the directory /machine/data1.\n\nThis script is part of the Astropy package. See\nhttps://docs.astropy.org/en/latest/io/fits/usage/scripts.html#fitsdiff\nfor further documentation.\n\"\"\".strip()\n\nEPILOG = fill(\"\"\"\nIf the two files are identical within the specified conditions, it will report\n\"No difference is found.\" If the value(s) of -c and -k takes the form\n'@filename', list is in the text file 'filename', and each line in that text\nfile contains one keyword.\n\nExample\n-------\n\n    fitsdiff -k filename,filtnam1 -n 5 -r 1.e-6 test1.fits test2\n\nThis command will compare files test1.fits and test2.fits, report maximum of 5\ndifferent pixels values per extension, only report data values larger than\n1.e-6 relative to each other, and will neglect the different values of keywords\nFILENAME and FILTNAM1 (or their very existence).\n\nfitsdiff command-line arguments can also be set using the environment variable\nFITSDIFF_SETTINGS.  If the FITSDIFF_SETTINGS environment variable is present,\neach argument present will override the corresponding argument on the\ncommand-line unless the --exact option is specified.  The FITSDIFF_SETTINGS\nenvironment variable exists to make it easier to change the\nbehavior of fitsdiff on a global level, such as in a set of regression tests.\n\"\"\".strip(), width=80)"},{"col":0,"comment":"Prints FITS header(s) using the traditional 80-char format.\n\n    Parameters\n    ----------\n    args : argparse.Namespace\n        Arguments passed from the command-line as defined below.\n    ","endLoc":287,"header":"def print_headers_traditional(args)","id":2934,"name":"print_headers_traditional","nodeType":"Function","startLoc":265,"text":"def print_headers_traditional(args):\n    \"\"\"Prints FITS header(s) using the traditional 80-char format.\n\n    Parameters\n    ----------\n    args : argparse.Namespace\n        Arguments passed from the command-line as defined below.\n    \"\"\"\n    for idx, filename in enumerate(args.filename):  # support wildcards\n        if idx > 0 and not args.keywords:\n            print()  # print a newline between different files\n\n        formatter = None\n        try:\n            formatter = HeaderFormatter(filename)\n            print(formatter.parse(args.extensions,\n                                  args.keywords,\n                                  args.compressed), end='')\n        except OSError as e:\n            log.error(str(e))\n        finally:\n            if formatter:\n                formatter.close()"},{"col":0,"comment":"\n    Returns `True` if the specified Python module satisfies a minimum version\n    requirement, and `False` if not.\n\n    .. deprecated::\n        ``version_path`` is not used anymore and is deprecated in\n        ``astropy`` 5.0.\n\n    Parameters\n    ----------\n    module : module or `str`\n        An imported module of which to check the version, or the name of\n        that module (in which case an import of that module is attempted--\n        if this fails `False` is returned).\n\n    version : `str`\n        The version as a string that this module must have at a minimum (e.g.\n        ``'0.12'``).\n\n    inclusive : `bool`\n        The specified version meets the requirement inclusively (i.e. ``>=``)\n        as opposed to strictly greater than (default: `True`).\n\n    Examples\n    --------\n\n    >>> import astropy\n    >>> minversion(astropy, '0.4.4')\n    True\n    ","endLoc":169,"header":"@deprecated_renamed_argument('version_path', None, '5.0')\ndef minversion(module, version, inclusive=True, version_path='__version__')","id":2935,"name":"minversion","nodeType":"Function","startLoc":108,"text":"@deprecated_renamed_argument('version_path', None, '5.0')\ndef minversion(module, version, inclusive=True, version_path='__version__'):\n    \"\"\"\n    Returns `True` if the specified Python module satisfies a minimum version\n    requirement, and `False` if not.\n\n    .. deprecated::\n        ``version_path`` is not used anymore and is deprecated in\n        ``astropy`` 5.0.\n\n    Parameters\n    ----------\n    module : module or `str`\n        An imported module of which to check the version, or the name of\n        that module (in which case an import of that module is attempted--\n        if this fails `False` is returned).\n\n    version : `str`\n        The version as a string that this module must have at a minimum (e.g.\n        ``'0.12'``).\n\n    inclusive : `bool`\n        The specified version meets the requirement inclusively (i.e. ``>=``)\n        as opposed to strictly greater than (default: `True`).\n\n    Examples\n    --------\n\n    >>> import astropy\n    >>> minversion(astropy, '0.4.4')\n    True\n    \"\"\"\n    if isinstance(module, types.ModuleType):\n        module_name = module.__name__\n        module_version = getattr(module, '__version__', None)\n    elif isinstance(module, str):\n        module_name = module\n        module_version = None\n        try:\n            module = resolve_name(module_name)\n        except ImportError:\n            return False\n    else:\n        raise ValueError('module argument must be an actual imported '\n                         'module, or the import name of the module; '\n                         f'got {repr(module)}')\n\n    if module_version is None:\n        try:\n            module_version = metadata.version(module_name)\n        except metadata.PackageNotFoundError:\n            # Maybe the distribution name is different from package name.\n            # Calling packages_distributions is costly so we do it only\n            # if necessary, as only a few packages don't have the same\n            # distribution name.\n            dist_names = packages_distributions()\n            module_version = metadata.version(dist_names[module_name][0])\n\n    if inclusive:\n        return Version(module_version) >= Version(version)\n    else:\n        return Version(module_version) > Version(version)"},{"fileName":"__init__.py","filePath":"astropy/io/misc","id":2936,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis package contains miscellaneous utility functions for data\ninput/output with astropy.\n\"\"\"\n\nfrom .pickle_helpers import *\n"},{"col":0,"comment":"","endLoc":5,"header":"__init__.py#<anonymous>","id":2937,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis package contains miscellaneous utility functions for data\ninput/output with astropy.\n\"\"\""},{"col":0,"comment":"Deprecate a _renamed_ or _removed_ function argument.\n\n    The decorator assumes that the argument with the ``old_name`` was removed\n    from the function signature and the ``new_name`` replaced it at the\n    **same position** in the signature.  If the ``old_name`` argument is\n    given when calling the decorated function the decorator will catch it and\n    issue a deprecation warning and pass it on as ``new_name`` argument.\n\n    Parameters\n    ----------\n    old_name : str or sequence of str\n        The old name of the argument.\n\n    new_name : str or sequence of str or None\n        The new name of the argument. Set this to `None` to remove the\n        argument ``old_name`` instead of renaming it.\n\n    since : str or number or sequence of str or number\n        The release at which the old argument became deprecated.\n\n    arg_in_kwargs : bool or sequence of bool, optional\n        If the argument is not a named argument (for example it\n        was meant to be consumed by ``**kwargs``) set this to\n        ``True``.  Otherwise the decorator will throw an Exception\n        if the ``new_name`` cannot be found in the signature of\n        the decorated function.\n        Default is ``False``.\n\n    relax : bool or sequence of bool, optional\n        If ``False`` a ``TypeError`` is raised if both ``new_name`` and\n        ``old_name`` are given.  If ``True`` the value for ``new_name`` is used\n        and a Warning is issued.\n        Default is ``False``.\n\n    pending : bool or sequence of bool, optional\n        If ``True`` this will hide the deprecation warning and ignore the\n        corresponding ``relax`` parameter value.\n        Default is ``False``.\n\n    warning_type : Warning\n        Warning to be issued.\n        Default is `~astropy.utils.exceptions.AstropyDeprecationWarning`.\n\n    alternative : str, optional\n        An alternative function or class name that the user may use in\n        place of the deprecated object if ``new_name`` is None. The deprecation\n        warning will tell the user about this alternative if provided.\n\n    message : str, optional\n        A custom warning message. If provided then ``since`` and\n        ``alternative`` options will have no effect.\n\n    Raises\n    ------\n    TypeError\n        If the new argument name cannot be found in the function\n        signature and arg_in_kwargs was False or if it is used to\n        deprecate the name of the ``*args``-, ``**kwargs``-like arguments.\n        At runtime such an Error is raised if both the new_name\n        and old_name were specified when calling the function and\n        \"relax=False\".\n\n    Notes\n    -----\n    The decorator should be applied to a function where the **name**\n    of an argument was changed but it applies the same logic.\n\n    .. warning::\n        If ``old_name`` is a list or tuple the ``new_name`` and ``since`` must\n        also be a list or tuple with the same number of entries. ``relax`` and\n        ``arg_in_kwarg`` can be a single bool (applied to all) or also a\n        list/tuple with the same number of entries like ``new_name``, etc.\n\n    Examples\n    --------\n    The deprecation warnings are not shown in the following examples.\n\n    To deprecate a positional or keyword argument::\n\n        >>> from astropy.utils.decorators import deprecated_renamed_argument\n        >>> @deprecated_renamed_argument('sig', 'sigma', '1.0')\n        ... def test(sigma):\n        ...     return sigma\n\n        >>> test(2)\n        2\n        >>> test(sigma=2)\n        2\n        >>> test(sig=2)  # doctest: +SKIP\n        2\n\n    To deprecate an argument caught inside the ``**kwargs`` the\n    ``arg_in_kwargs`` has to be set::\n\n        >>> @deprecated_renamed_argument('sig', 'sigma', '1.0',\n        ...                             arg_in_kwargs=True)\n        ... def test(**kwargs):\n        ...     return kwargs['sigma']\n\n        >>> test(sigma=2)\n        2\n        >>> test(sig=2)  # doctest: +SKIP\n        2\n\n    By default providing the new and old keyword will lead to an Exception. If\n    a Warning is desired set the ``relax`` argument::\n\n        >>> @deprecated_renamed_argument('sig', 'sigma', '1.0', relax=True)\n        ... def test(sigma):\n        ...     return sigma\n\n        >>> test(sig=2)  # doctest: +SKIP\n        2\n\n    It is also possible to replace multiple arguments. The ``old_name``,\n    ``new_name`` and ``since`` have to be `tuple` or `list` and contain the\n    same number of entries::\n\n        >>> @deprecated_renamed_argument(['a', 'b'], ['alpha', 'beta'],\n        ...                              ['1.0', 1.2])\n        ... def test(alpha, beta):\n        ...     return alpha, beta\n\n        >>> test(a=2, b=3)  # doctest: +SKIP\n        (2, 3)\n\n    In this case ``arg_in_kwargs`` and ``relax`` can be a single value (which\n    is applied to all renamed arguments) or must also be a `tuple` or `list`\n    with values for each of the arguments.\n\n    ","endLoc":549,"header":"def deprecated_renamed_argument(old_name, new_name, since,\n                                arg_in_kwargs=False, relax=False,\n                                pending=False,\n                                warning_type=AstropyDeprecationWarning,\n                                alternative='', message='')","id":2938,"name":"deprecated_renamed_argument","nodeType":"Function","startLoc":280,"text":"def deprecated_renamed_argument(old_name, new_name, since,\n                                arg_in_kwargs=False, relax=False,\n                                pending=False,\n                                warning_type=AstropyDeprecationWarning,\n                                alternative='', message=''):\n    \"\"\"Deprecate a _renamed_ or _removed_ function argument.\n\n    The decorator assumes that the argument with the ``old_name`` was removed\n    from the function signature and the ``new_name`` replaced it at the\n    **same position** in the signature.  If the ``old_name`` argument is\n    given when calling the decorated function the decorator will catch it and\n    issue a deprecation warning and pass it on as ``new_name`` argument.\n\n    Parameters\n    ----------\n    old_name : str or sequence of str\n        The old name of the argument.\n\n    new_name : str or sequence of str or None\n        The new name of the argument. Set this to `None` to remove the\n        argument ``old_name`` instead of renaming it.\n\n    since : str or number or sequence of str or number\n        The release at which the old argument became deprecated.\n\n    arg_in_kwargs : bool or sequence of bool, optional\n        If the argument is not a named argument (for example it\n        was meant to be consumed by ``**kwargs``) set this to\n        ``True``.  Otherwise the decorator will throw an Exception\n        if the ``new_name`` cannot be found in the signature of\n        the decorated function.\n        Default is ``False``.\n\n    relax : bool or sequence of bool, optional\n        If ``False`` a ``TypeError`` is raised if both ``new_name`` and\n        ``old_name`` are given.  If ``True`` the value for ``new_name`` is used\n        and a Warning is issued.\n        Default is ``False``.\n\n    pending : bool or sequence of bool, optional\n        If ``True`` this will hide the deprecation warning and ignore the\n        corresponding ``relax`` parameter value.\n        Default is ``False``.\n\n    warning_type : Warning\n        Warning to be issued.\n        Default is `~astropy.utils.exceptions.AstropyDeprecationWarning`.\n\n    alternative : str, optional\n        An alternative function or class name that the user may use in\n        place of the deprecated object if ``new_name`` is None. The deprecation\n        warning will tell the user about this alternative if provided.\n\n    message : str, optional\n        A custom warning message. If provided then ``since`` and\n        ``alternative`` options will have no effect.\n\n    Raises\n    ------\n    TypeError\n        If the new argument name cannot be found in the function\n        signature and arg_in_kwargs was False or if it is used to\n        deprecate the name of the ``*args``-, ``**kwargs``-like arguments.\n        At runtime such an Error is raised if both the new_name\n        and old_name were specified when calling the function and\n        \"relax=False\".\n\n    Notes\n    -----\n    The decorator should be applied to a function where the **name**\n    of an argument was changed but it applies the same logic.\n\n    .. warning::\n        If ``old_name`` is a list or tuple the ``new_name`` and ``since`` must\n        also be a list or tuple with the same number of entries. ``relax`` and\n        ``arg_in_kwarg`` can be a single bool (applied to all) or also a\n        list/tuple with the same number of entries like ``new_name``, etc.\n\n    Examples\n    --------\n    The deprecation warnings are not shown in the following examples.\n\n    To deprecate a positional or keyword argument::\n\n        >>> from astropy.utils.decorators import deprecated_renamed_argument\n        >>> @deprecated_renamed_argument('sig', 'sigma', '1.0')\n        ... def test(sigma):\n        ...     return sigma\n\n        >>> test(2)\n        2\n        >>> test(sigma=2)\n        2\n        >>> test(sig=2)  # doctest: +SKIP\n        2\n\n    To deprecate an argument caught inside the ``**kwargs`` the\n    ``arg_in_kwargs`` has to be set::\n\n        >>> @deprecated_renamed_argument('sig', 'sigma', '1.0',\n        ...                             arg_in_kwargs=True)\n        ... def test(**kwargs):\n        ...     return kwargs['sigma']\n\n        >>> test(sigma=2)\n        2\n        >>> test(sig=2)  # doctest: +SKIP\n        2\n\n    By default providing the new and old keyword will lead to an Exception. If\n    a Warning is desired set the ``relax`` argument::\n\n        >>> @deprecated_renamed_argument('sig', 'sigma', '1.0', relax=True)\n        ... def test(sigma):\n        ...     return sigma\n\n        >>> test(sig=2)  # doctest: +SKIP\n        2\n\n    It is also possible to replace multiple arguments. The ``old_name``,\n    ``new_name`` and ``since`` have to be `tuple` or `list` and contain the\n    same number of entries::\n\n        >>> @deprecated_renamed_argument(['a', 'b'], ['alpha', 'beta'],\n        ...                              ['1.0', 1.2])\n        ... def test(alpha, beta):\n        ...     return alpha, beta\n\n        >>> test(a=2, b=3)  # doctest: +SKIP\n        (2, 3)\n\n    In this case ``arg_in_kwargs`` and ``relax`` can be a single value (which\n    is applied to all renamed arguments) or must also be a `tuple` or `list`\n    with values for each of the arguments.\n\n    \"\"\"\n    cls_iter = (list, tuple)\n    if isinstance(old_name, cls_iter):\n        n = len(old_name)\n        # Assume that new_name and since are correct (tuple/list with the\n        # appropriate length) in the spirit of the \"consenting adults\". But the\n        # optional parameters may not be set, so if these are not iterables\n        # wrap them.\n        if not isinstance(arg_in_kwargs, cls_iter):\n            arg_in_kwargs = [arg_in_kwargs] * n\n        if not isinstance(relax, cls_iter):\n            relax = [relax] * n\n        if not isinstance(pending, cls_iter):\n            pending = [pending] * n\n        if not isinstance(message, cls_iter):\n            message = [message] * n\n    else:\n        # To allow a uniform approach later on, wrap all arguments in lists.\n        n = 1\n        old_name = [old_name]\n        new_name = [new_name]\n        since = [since]\n        arg_in_kwargs = [arg_in_kwargs]\n        relax = [relax]\n        pending = [pending]\n        message = [message]\n\n    def decorator(function):\n        # The named arguments of the function.\n        arguments = signature(function).parameters\n        keys = list(arguments.keys())\n        position = [None] * n\n\n        for i in range(n):\n            # Determine the position of the argument.\n            if arg_in_kwargs[i]:\n                pass\n            else:\n                if new_name[i] is None:\n                    param = arguments[old_name[i]]\n                elif new_name[i] in arguments:\n                    param = arguments[new_name[i]]\n                # In case the argument is not found in the list of arguments\n                # the only remaining possibility is that it should be caught\n                # by some kind of **kwargs argument.\n                # This case has to be explicitly specified, otherwise throw\n                # an exception!\n                else:\n                    raise TypeError(\n                        f'\"{new_name[i]}\" was not specified in the function '\n                        'signature. If it was meant to be part of '\n                        '\"**kwargs\" then set \"arg_in_kwargs\" to \"True\"')\n\n                # There are several possibilities now:\n\n                # 1.) Positional or keyword argument:\n                if param.kind == param.POSITIONAL_OR_KEYWORD:\n                    if new_name[i] is None:\n                        position[i] = keys.index(old_name[i])\n                    else:\n                        position[i] = keys.index(new_name[i])\n\n                # 2.) Keyword only argument:\n                elif param.kind == param.KEYWORD_ONLY:\n                    # These cannot be specified by position.\n                    position[i] = None\n\n                # 3.) positional-only argument, varargs, varkwargs or some\n                #     unknown type:\n                else:\n                    raise TypeError(f'cannot replace argument \"{new_name[i]}\" '\n                                    f'of kind {repr(param.kind)}.')\n\n        @functools.wraps(function)\n        def wrapper(*args, **kwargs):\n            for i in range(n):\n                msg = message[i] or (f'\"{old_name[i]}\" was deprecated in '\n                                     f'version {since[i]} and will be removed '\n                                     'in a future version. ')\n                # The only way to have oldkeyword inside the function is\n                # that it is passed as kwarg because the oldkeyword\n                # parameter was renamed to newkeyword.\n                if old_name[i] in kwargs:\n                    value = kwargs.pop(old_name[i])\n                    # Display the deprecation warning only when it's not\n                    # pending.\n                    if not pending[i]:\n                        if not message[i]:\n                            if new_name[i] is not None:\n                                msg += f'Use argument \"{new_name[i]}\" instead.'\n                            elif alternative:\n                                msg += f'\\n        Use {alternative} instead.'\n                        warnings.warn(msg, warning_type, stacklevel=2)\n\n                    # Check if the newkeyword was given as well.\n                    newarg_in_args = (position[i] is not None and\n                                      len(args) > position[i])\n                    newarg_in_kwargs = new_name[i] in kwargs\n\n                    if newarg_in_args or newarg_in_kwargs:\n                        if not pending[i]:\n                            # If both are given print a Warning if relax is\n                            # True or raise an Exception is relax is False.\n                            if relax[i]:\n                                warnings.warn(\n                                    f'\"{old_name[i]}\" and \"{new_name[i]}\" '\n                                    'keywords were set. '\n                                    f'Using the value of \"{new_name[i]}\".',\n                                    AstropyUserWarning)\n                            else:\n                                raise TypeError(\n                                    f'cannot specify both \"{old_name[i]}\" and '\n                                    f'\"{new_name[i]}\".')\n                    else:\n                        # Pass the value of the old argument with the\n                        # name of the new argument to the function\n                        if new_name[i] is not None:\n                            kwargs[new_name[i]] = value\n                        # If old argument has no replacement, cast it back.\n                        # https://github.com/astropy/astropy/issues/9914\n                        else:\n                            kwargs[old_name[i]] = value\n\n                # Deprecated keyword without replacement is given as\n                # positional argument.\n                elif (not pending[i] and not new_name[i] and position[i] and\n                      len(args) > position[i]):\n                    if alternative and not message[i]:\n                        msg += f'\\n        Use {alternative} instead.'\n                    warnings.warn(msg, warning_type, stacklevel=2)\n\n            return function(*args, **kwargs)\n\n        return wrapper\n    return decorator"},{"fileName":"yaml.py","filePath":"astropy/io/misc","id":2939,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module contains functions for serializing core astropy objects via the\nYAML protocol.\nIt provides functions `~astropy.io.misc.yaml.dump`,\n`~astropy.io.misc.yaml.load`, and `~astropy.io.misc.yaml.load_all` which\ncall the corresponding functions in `PyYaml <https://pyyaml.org>`_ but use the\n`~astropy.io.misc.yaml.AstropyDumper` and `~astropy.io.misc.yaml.AstropyLoader`\nclasses to define custom YAML tags for the following astropy classes:\n- `astropy.units.Unit`\n- `astropy.units.Quantity`\n- `astropy.time.Time`\n- `astropy.time.TimeDelta`\n- `astropy.coordinates.SkyCoord`\n- `astropy.coordinates.Angle`\n- `astropy.coordinates.Latitude`\n- `astropy.coordinates.Longitude`\n- `astropy.coordinates.EarthLocation`\n- `astropy.table.SerializedColumn`\n\nExample\n=======\n::\n  >>> from astropy.io.misc import yaml\n  >>> import astropy.units as u\n  >>> from astropy.time import Time\n  >>> from astropy.coordinates import EarthLocation\n  >>> t = Time(2457389.0, format='mjd',\n  ...          location=EarthLocation(1000, 2000, 3000, unit=u.km))\n  >>> td = yaml.dump(t)\n  >>> print(td)\n  !astropy.time.Time\n  format: mjd\n  in_subfmt: '*'\n  jd1: 4857390.0\n  jd2: -0.5\n  location: !astropy.coordinates.earth.EarthLocation\n    ellipsoid: WGS84\n    x: !astropy.units.Quantity\n      unit: &id001 !astropy.units.Unit {unit: km}\n      value: 1000.0\n    y: !astropy.units.Quantity\n      unit: *id001\n      value: 2000.0\n    z: !astropy.units.Quantity\n      unit: *id001\n      value: 3000.0\n  out_subfmt: '*'\n  precision: 3\n  scale: utc\n  >>> ty = yaml.load(td)\n  >>> ty\n  <Time object: scale='utc' format='mjd' value=2457389.0>\n  >>> ty.location  # doctest: +FLOAT_CMP\n  <EarthLocation (1000., 2000., 3000.) km>\n\"\"\"\n\nimport base64\n\nimport numpy as np\nimport yaml\n\nfrom astropy.time import Time, TimeDelta\nfrom astropy import units as u\nfrom astropy import coordinates as coords\nfrom astropy.table import SerializedColumn\n\n\n__all__ = ['AstropyLoader', 'AstropyDumper', 'load', 'load_all', 'dump']\n\n\ndef _unit_representer(dumper, obj):\n    out = {'unit': str(obj.to_string())}\n    return dumper.represent_mapping('!astropy.units.Unit', out)\n\n\ndef _unit_constructor(loader, node):\n    map = loader.construct_mapping(node)\n    return u.Unit(map['unit'], parse_strict='warn')\n\n\ndef _serialized_column_representer(dumper, obj):\n    out = dumper.represent_mapping('!astropy.table.SerializedColumn', obj)\n    return out\n\n\ndef _serialized_column_constructor(loader, node):\n    map = loader.construct_mapping(node)\n    return SerializedColumn(map)\n\n\ndef _time_representer(dumper, obj):\n    out = obj.info._represent_as_dict()\n    return dumper.represent_mapping('!astropy.time.Time', out)\n\n\ndef _time_constructor(loader, node):\n    map = loader.construct_mapping(node)\n    out = Time.info._construct_from_dict(map)\n    return out\n\n\ndef _timedelta_representer(dumper, obj):\n    out = obj.info._represent_as_dict()\n    return dumper.represent_mapping('!astropy.time.TimeDelta', out)\n\n\ndef _timedelta_constructor(loader, node):\n    map = loader.construct_mapping(node)\n    out = TimeDelta.info._construct_from_dict(map)\n    return out\n\n\ndef _ndarray_representer(dumper, obj):\n    if not (obj.flags['C_CONTIGUOUS'] or obj.flags['F_CONTIGUOUS']):\n        obj = np.ascontiguousarray(obj)\n\n    if np.isfortran(obj):\n        obj = obj.T\n        order = 'F'\n    else:\n        order = 'C'\n\n    data_b64 = base64.b64encode(obj.tobytes())\n\n    out = dict(buffer=data_b64,\n               dtype=str(obj.dtype) if not obj.dtype.fields else obj.dtype.descr,\n               shape=obj.shape,\n               order=order)\n\n    return dumper.represent_mapping('!numpy.ndarray', out)\n\n\ndef _ndarray_constructor(loader, node):\n    # Convert mapping to a dict useful for initializing ndarray.\n    # Need deep=True since for structured dtype, the contents\n    # include lists and tuples, which need recursion via\n    # construct_sequence.\n    map = loader.construct_mapping(node, deep=True)\n    map['buffer'] = base64.b64decode(map['buffer'])\n    return np.ndarray(**map)\n\n\ndef _void_representer(dumper, obj):\n    data_b64 = base64.b64encode(obj.tobytes())\n    out = dict(buffer=data_b64,\n               dtype=str(obj.dtype) if not obj.dtype.fields else obj.dtype.descr)\n    return dumper.represent_mapping('!numpy.void', out)\n\n\ndef _void_constructor(loader, node):\n    # Interpret as node as an array scalar and then index to change to void.\n    map = loader.construct_mapping(node, deep=True)\n    map['buffer'] = base64.b64decode(map['buffer'])\n    return np.ndarray(shape=(), **map)[()]\n\n\ndef _quantity_representer(tag):\n    def representer(dumper, obj):\n        out = obj.info._represent_as_dict()\n        return dumper.represent_mapping(tag, out)\n    return representer\n\n\ndef _quantity_constructor(cls):\n    def constructor(loader, node):\n        map = loader.construct_mapping(node)\n        return cls.info._construct_from_dict(map)\n    return constructor\n\n\ndef _skycoord_representer(dumper, obj):\n    map = obj.info._represent_as_dict()\n    out = dumper.represent_mapping('!astropy.coordinates.sky_coordinate.SkyCoord',\n                                   map)\n    return out\n\n\ndef _skycoord_constructor(loader, node):\n    map = loader.construct_mapping(node)\n    out = coords.SkyCoord.info._construct_from_dict(map)\n    return out\n\n\n# Straight from yaml's Representer\ndef _complex_representer(self, data):\n    if data.imag == 0.0:\n        data = f'{data.real!r}'\n    elif data.real == 0.0:\n        data = f'{data.imag!r}j'\n    elif data.imag > 0:\n        data = f'{data.real!r}+{data.imag!r}j'\n    else:\n        data = f'{data.real!r}{data.imag!r}j'\n    return self.represent_scalar('tag:yaml.org,2002:python/complex', data)\n\n\ndef _complex_constructor(loader, node):\n    map = loader.construct_scalar(node)\n    return complex(map)\n\n\nclass AstropyLoader(yaml.SafeLoader):\n    \"\"\"\n    Custom SafeLoader that constructs astropy core objects as well\n    as Python tuple and unicode objects.\n\n    This class is not directly instantiated by user code, but instead is\n    used to maintain the available constructor functions that are\n    called when parsing a YAML stream.  See the `PyYaml documentation\n    <https://pyyaml.org/wiki/PyYAMLDocumentation>`_ for details of the\n    class signature.\n    \"\"\"\n\n    def _construct_python_tuple(self, node):\n        return tuple(self.construct_sequence(node))\n\n    def _construct_python_unicode(self, node):\n        return self.construct_scalar(node)\n\n\nclass AstropyDumper(yaml.SafeDumper):\n    \"\"\"\n    Custom SafeDumper that represents astropy core objects as well\n    as Python tuple and unicode objects.\n\n    This class is not directly instantiated by user code, but instead is\n    used to maintain the available representer functions that are\n    called when generating a YAML stream from an object.  See the\n    `PyYaml documentation <https://pyyaml.org/wiki/PyYAMLDocumentation>`_\n    for details of the class signature.\n    \"\"\"\n\n    def _represent_tuple(self, data):\n        return self.represent_sequence('tag:yaml.org,2002:python/tuple', data)\n\n\nAstropyDumper.add_multi_representer(u.UnitBase, _unit_representer)\nAstropyDumper.add_multi_representer(u.FunctionUnitBase, _unit_representer)\nAstropyDumper.add_multi_representer(u.StructuredUnit, _unit_representer)\nAstropyDumper.add_representer(tuple, AstropyDumper._represent_tuple)\nAstropyDumper.add_representer(np.ndarray, _ndarray_representer)\nAstropyDumper.add_representer(np.void, _void_representer)\nAstropyDumper.add_representer(Time, _time_representer)\nAstropyDumper.add_representer(TimeDelta, _timedelta_representer)\nAstropyDumper.add_representer(coords.SkyCoord, _skycoord_representer)\nAstropyDumper.add_representer(SerializedColumn, _serialized_column_representer)\n\n# Numpy dtypes\nAstropyDumper.add_representer(np.bool_, yaml.representer.SafeRepresenter.represent_bool)\nfor np_type in [np.int_, np.intc, np.intp, np.int8, np.int16, np.int32,\n                np.int64, np.uint8, np.uint16, np.uint32, np.uint64]:\n    AstropyDumper.add_representer(np_type,\n                                    yaml.representer.SafeRepresenter.represent_int)\nfor np_type in [np.float_, np.float16, np.float32, np.float64,\n                np.longdouble]:\n    AstropyDumper.add_representer(np_type,\n                                    yaml.representer.SafeRepresenter.represent_float)\nfor np_type in [np.complex_, complex, np.complex64, np.complex128]:\n    AstropyDumper.add_representer(np_type, _complex_representer)\n\nAstropyLoader.add_constructor('tag:yaml.org,2002:python/complex',\n                                _complex_constructor)\nAstropyLoader.add_constructor('tag:yaml.org,2002:python/tuple',\n                                AstropyLoader._construct_python_tuple)\nAstropyLoader.add_constructor('tag:yaml.org,2002:python/unicode',\n                                AstropyLoader._construct_python_unicode)\nAstropyLoader.add_constructor('!astropy.units.Unit', _unit_constructor)\nAstropyLoader.add_constructor('!numpy.ndarray', _ndarray_constructor)\nAstropyLoader.add_constructor('!numpy.void', _void_constructor)\nAstropyLoader.add_constructor('!astropy.time.Time', _time_constructor)\nAstropyLoader.add_constructor('!astropy.time.TimeDelta', _timedelta_constructor)\nAstropyLoader.add_constructor('!astropy.coordinates.sky_coordinate.SkyCoord',\n                                _skycoord_constructor)\nAstropyLoader.add_constructor('!astropy.table.SerializedColumn',\n                                _serialized_column_constructor)\n\nfor cls, tag in ((u.Quantity, '!astropy.units.Quantity'),\n                    (u.Magnitude, '!astropy.units.Magnitude'),\n                    (u.Dex, '!astropy.units.Dex'),\n                    (u.Decibel, '!astropy.units.Decibel'),\n                    (coords.Angle, '!astropy.coordinates.Angle'),\n                    (coords.Latitude, '!astropy.coordinates.Latitude'),\n                    (coords.Longitude, '!astropy.coordinates.Longitude'),\n                    (coords.EarthLocation, '!astropy.coordinates.earth.EarthLocation')):\n    AstropyDumper.add_multi_representer(cls, _quantity_representer(tag))\n    AstropyLoader.add_constructor(tag, _quantity_constructor(cls))\n\nfor cls in (list(coords.representation.REPRESENTATION_CLASSES.values())\n            + list(coords.representation.DIFFERENTIAL_CLASSES.values())):\n    name = cls.__name__\n    # Add representations/differentials defined in astropy.\n    if name in coords.representation.__all__:\n        tag = '!astropy.coordinates.' + name\n        AstropyDumper.add_multi_representer(cls, _quantity_representer(tag))\n        AstropyLoader.add_constructor(tag, _quantity_constructor(cls))\n\n\ndef load(stream):\n    \"\"\"Parse the first YAML document in a stream using the AstropyLoader and\n    produce the corresponding Python object.\n\n    Parameters\n    ----------\n    stream : str or file-like\n        YAML input\n\n    Returns\n    -------\n    obj : object\n        Object corresponding to YAML document\n    \"\"\"\n    return yaml.load(stream, Loader=AstropyLoader)\n\n\ndef load_all(stream):\n    \"\"\"Parse the all YAML documents in a stream using the AstropyLoader class and\n    produce the corresponding Python object.\n\n    Parameters\n    ----------\n    stream : str or file-like\n        YAML input\n\n    Returns\n    -------\n    obj : object\n        Object corresponding to YAML document\n\n    \"\"\"\n    return yaml.load_all(stream, Loader=AstropyLoader)\n\n\ndef dump(data, stream=None, **kwargs):\n    \"\"\"Serialize a Python object into a YAML stream using the AstropyDumper class.\n    If stream is None, return the produced string instead.\n\n    Parameters\n    ----------\n    data : object\n        Object to serialize to YAML\n    stream : file-like, optional\n        YAML output (if not supplied a string is returned)\n    **kwargs\n        Other keyword arguments that get passed to yaml.dump()\n\n    Returns\n    -------\n    out : str or None\n        If no ``stream`` is supplied then YAML output is returned as str\n\n    \"\"\"\n    kwargs['Dumper'] = AstropyDumper\n    kwargs.setdefault('default_flow_style', None)\n    return yaml.dump(data, stream=stream, **kwargs)\n"},{"col":4,"comment":"Input value validation, typically overridden by derived classes","endLoc":296,"header":"def _check_val_type(self, val1, val2)","id":2940,"name":"_check_val_type","nodeType":"Function","startLoc":240,"text":"def _check_val_type(self, val1, val2):\n        \"\"\"Input value validation, typically overridden by derived classes\"\"\"\n        # val1 cannot contain nan, but val2 can contain nan\n        isfinite1 = np.isfinite(val1)\n        if val1.size > 1:  # Calling .all() on a scalar is surprisingly slow\n            isfinite1 = isfinite1.all()  # Note: arr.all() about 3x faster than np.all(arr)\n        elif val1.size == 0:\n            isfinite1 = False\n        ok1 = (val1.dtype.kind == 'f' and val1.dtype.itemsize >= 8\n               and isfinite1 or val1.size == 0)\n        ok2 = val2 is None or (\n            val2.dtype.kind == 'f' and val2.dtype.itemsize >= 8\n            and not np.any(np.isinf(val2))) or val2.size == 0\n        if not (ok1 and ok2):\n            raise TypeError('Input values for {} class must be finite doubles'\n                            .format(self.name))\n\n        if getattr(val1, 'unit', None) is not None:\n            # Convert any quantity-likes to days first, attempting to be\n            # careful with the conversion, so that, e.g., large numbers of\n            # seconds get converted without losing precision because\n            # 1/86400 is not exactly representable as a float.\n            val1 = u.Quantity(val1, copy=False)\n            if val2 is not None:\n                val2 = u.Quantity(val2, copy=False)\n\n            try:\n                val1, val2 = quantity_day_frac(val1, val2)\n            except u.UnitsError:\n                raise u.UnitConversionError(\n                    \"only quantities with time units can be \"\n                    \"used to instantiate Time instances.\")\n            # We now have days, but the format may expect another unit.\n            # On purpose, multiply with 1./day_unit because typically it is\n            # 1./erfa.DAYSEC, and inverting it recovers the integer.\n            # (This conversion will get undone in format's set_jds, hence\n            # there may be room for optimizing this.)\n            factor = 1. / getattr(self, 'unit', 1.)\n            if factor != 1.:\n                val1, carry = two_product(val1, factor)\n                carry += val2 * factor\n                val1, val2 = two_sum(val1, carry)\n\n        elif getattr(val2, 'unit', None) is not None:\n            raise TypeError('Cannot mix float and Quantity inputs')\n\n        if val2 is None:\n            val2 = np.array(0, dtype=val1.dtype)\n\n        def asarray_or_scalar(val):\n            \"\"\"\n            Remove ndarray subclasses since for jd1/jd2 we want a pure ndarray\n            or a Python or numpy scalar.\n            \"\"\"\n            return np.asarray(val) if isinstance(val, np.ndarray) else val\n\n        return asarray_or_scalar(val1), asarray_or_scalar(val2)"},{"className":"SerializedColumn","col":0,"comment":"\n    Subclass of dict that is a used in the representation to contain the name\n    (and possible other info) for a mixin attribute (either primary data or an\n    array-like attribute) that is serialized as a column in the table.\n\n    Normally contains the single key ``name`` with the name of the column in the\n    table.\n    ","endLoc":69,"id":2941,"nodeType":"Class","startLoc":60,"text":"class SerializedColumn(dict):\n    \"\"\"\n    Subclass of dict that is a used in the representation to contain the name\n    (and possible other info) for a mixin attribute (either primary data or an\n    array-like attribute) that is serialized as a column in the table.\n\n    Normally contains the single key ``name`` with the name of the column in the\n    table.\n    \"\"\"\n    pass"},{"col":0,"comment":"Prints FITS header(s) in a machine-readable table format.\n\n    Parameters\n    ----------\n    args : argparse.Namespace\n        Arguments passed from the command-line as defined below.\n    ","endLoc":324,"header":"def print_headers_as_table(args)","id":2942,"name":"print_headers_as_table","nodeType":"Function","startLoc":290,"text":"def print_headers_as_table(args):\n    \"\"\"Prints FITS header(s) in a machine-readable table format.\n\n    Parameters\n    ----------\n    args : argparse.Namespace\n        Arguments passed from the command-line as defined below.\n    \"\"\"\n    tables = []\n    # Create a Table object for each file\n    for filename in args.filename:  # Support wildcards\n        formatter = None\n        try:\n            formatter = TableHeaderFormatter(filename)\n            tbl = formatter.parse(args.extensions,\n                                  args.keywords,\n                                  args.compressed)\n            if tbl:\n                tables.append(tbl)\n        except OSError as e:\n            log.error(str(e))  # file not found or unreadable\n        finally:\n            if formatter:\n                formatter.close()\n\n    # Concatenate the tables\n    if len(tables) == 0:\n        return False\n    elif len(tables) == 1:\n        resulting_table = tables[0]\n    else:\n        from astropy import table\n        resulting_table = table.vstack(tables)\n    # Print the string representation of the concatenated table\n    resulting_table.write(sys.stdout, format=args.table)"},{"col":4,"comment":"null","endLoc":2297,"header":"def pix2foc(self, *args)","id":2943,"name":"pix2foc","nodeType":"Function","startLoc":2296,"text":"def pix2foc(self, *args):\n        return self._array_converter(self._pix2foc, None, *args)"},{"className":"AstropyLoader","col":0,"comment":"\n    Custom SafeLoader that constructs astropy core objects as well\n    as Python tuple and unicode objects.\n\n    This class is not directly instantiated by user code, but instead is\n    used to maintain the available constructor functions that are\n    called when parsing a YAML stream.  See the `PyYaml documentation\n    <https://pyyaml.org/wiki/PyYAMLDocumentation>`_ for details of the\n    class signature.\n    ","endLoc":220,"id":2944,"nodeType":"Class","startLoc":204,"text":"class AstropyLoader(yaml.SafeLoader):\n    \"\"\"\n    Custom SafeLoader that constructs astropy core objects as well\n    as Python tuple and unicode objects.\n\n    This class is not directly instantiated by user code, but instead is\n    used to maintain the available constructor functions that are\n    called when parsing a YAML stream.  See the `PyYaml documentation\n    <https://pyyaml.org/wiki/PyYAMLDocumentation>`_ for details of the\n    class signature.\n    \"\"\"\n\n    def _construct_python_tuple(self, node):\n        return tuple(self.construct_sequence(node))\n\n    def _construct_python_unicode(self, node):\n        return self.construct_scalar(node)"},{"col":4,"comment":"\n        Return a mapping of top-level packages to their distributions.\n        Note: copied from https://github.com/python/importlib_metadata/pull/287\n        ","endLoc":33,"header":"def packages_distributions()","id":2945,"name":"packages_distributions","nodeType":"Function","startLoc":24,"text":"def packages_distributions():\n        \"\"\"\n        Return a mapping of top-level packages to their distributions.\n        Note: copied from https://github.com/python/importlib_metadata/pull/287\n        \"\"\"\n        pkg_to_dist = collections.defaultdict(list)\n        for dist in metadata.distributions():\n            for pkg in (dist.read_text('top_level.txt') or '').split():\n                pkg_to_dist[pkg].append(dist.metadata['Name'])\n        return dict(pkg_to_dist)"},{"col":0,"comment":"Like ``day_frac``, but for quantities with units of time.\n\n    The quantities are separately converted to days. Here, we need to take\n    care with the conversion since while the routines here can do accurate\n    multiplication, the conversion factor itself may not be accurate.  For\n    instance, if the quantity is in seconds, the conversion factor is\n    1./86400., which is not exactly representable as a float.\n\n    To work around this, for conversion factors less than unity, rather than\n    multiply by that possibly inaccurate factor, the value is divided by the\n    conversion factor of a day to that unit (i.e., by 86400. for seconds).  For\n    conversion factors larger than 1, such as 365.25 for years, we do just\n    multiply.  With this scheme, one has precise conversion factors for all\n    regular time units that astropy defines.  Note, however, that it does not\n    necessarily work for all custom time units, and cannot work when conversion\n    to time is via an equivalency.  For those cases, one remains limited by the\n    fact that Quantity calculations are done in double precision, not in\n    quadruple precision as for time.\n    ","endLoc":115,"header":"def quantity_day_frac(val1, val2=None)","id":2946,"name":"quantity_day_frac","nodeType":"Function","startLoc":75,"text":"def quantity_day_frac(val1, val2=None):\n    \"\"\"Like ``day_frac``, but for quantities with units of time.\n\n    The quantities are separately converted to days. Here, we need to take\n    care with the conversion since while the routines here can do accurate\n    multiplication, the conversion factor itself may not be accurate.  For\n    instance, if the quantity is in seconds, the conversion factor is\n    1./86400., which is not exactly representable as a float.\n\n    To work around this, for conversion factors less than unity, rather than\n    multiply by that possibly inaccurate factor, the value is divided by the\n    conversion factor of a day to that unit (i.e., by 86400. for seconds).  For\n    conversion factors larger than 1, such as 365.25 for years, we do just\n    multiply.  With this scheme, one has precise conversion factors for all\n    regular time units that astropy defines.  Note, however, that it does not\n    necessarily work for all custom time units, and cannot work when conversion\n    to time is via an equivalency.  For those cases, one remains limited by the\n    fact that Quantity calculations are done in double precision, not in\n    quadruple precision as for time.\n    \"\"\"\n    if val2 is not None:\n        res11, res12 = quantity_day_frac(val1)\n        res21, res22 = quantity_day_frac(val2)\n        # This summation is can at most lose 1 ULP in the second number.\n        return res11 + res21, res12 + res22\n\n    try:\n        factor = val1.unit.to(u.day)\n    except Exception:\n        # Not a simple scaling, so cannot do the full-precision one.\n        # But at least try normal conversion, since equivalencies may be set.\n        return val1.to_value(u.day), 0.\n\n    if factor == 1.:\n        return day_frac(val1.value, 0.)\n\n    if factor > 1:\n        return day_frac(val1.value, 0., factor=factor)\n    else:\n        divisor = u.day.to(val1.unit)\n        return day_frac(val1.value, 0., divisor=divisor)"},{"col":4,"comment":"null","endLoc":1364,"header":"@override__dir__\n    def __dir__(self)","id":2947,"name":"__dir__","nodeType":"Function","startLoc":1360,"text":"@override__dir__\n    def __dir__(self):\n        result = set(self.SCALES)\n        result.update(self.FORMATS)\n        return result"},{"col":4,"comment":"\n        Ensure that `val` is matched to length of self.  If val has length 1\n        then broadcast, otherwise cast to double and make sure shape matches.\n        ","endLoc":1382,"header":"def _match_shape(self, val)","id":2948,"name":"_match_shape","nodeType":"Function","startLoc":1366,"text":"def _match_shape(self, val):\n        \"\"\"\n        Ensure that `val` is matched to length of self.  If val has length 1\n        then broadcast, otherwise cast to double and make sure shape matches.\n        \"\"\"\n        val = _make_array(val, copy=True)  # be conservative and copy\n        if val.size > 1 and val.shape != self.shape:\n            try:\n                # check the value can be broadcast to the shape of self.\n                val = np.broadcast_to(val, self.shape, subok=True)\n            except Exception:\n                raise ValueError('Attribute shape must match or be '\n                                 'broadcastable to that of Time object. '\n                                 'Typically, give either a single value or '\n                                 'one for each time.')\n\n        return val"},{"col":4,"comment":"If other is of same class as self, compare difference in self.scale.\n        Otherwise, return NotImplemented\n        ","endLoc":1406,"header":"def _time_comparison(self, other, op)","id":2949,"name":"_time_comparison","nodeType":"Function","startLoc":1384,"text":"def _time_comparison(self, other, op):\n        \"\"\"If other is of same class as self, compare difference in self.scale.\n        Otherwise, return NotImplemented\n        \"\"\"\n        if other.__class__ is not self.__class__:\n            try:\n                other = self.__class__(other, scale=self.scale)\n            except Exception:\n                # Let other have a go.\n                return NotImplemented\n\n        if(self.scale is not None and self.scale not in other.SCALES\n           or other.scale is not None and other.scale not in self.SCALES):\n            # Other will also not be able to do it, so raise a TypeError\n            # immediately, allowing us to explain why it doesn't work.\n            raise TypeError(\"Cannot compare {} instances with scales \"\n                            \"'{}' and '{}'\".format(self.__class__.__name__,\n                                                   self.scale, other.scale))\n\n        if self.scale is not None and other.scale is not None:\n            other = getattr(other, self.scale)\n\n        return op((self.jd1 - other.jd1) + (self.jd2 - other.jd2), 0.)"},{"col":4,"comment":"null","endLoc":217,"header":"def _construct_python_tuple(self, node)","id":2950,"name":"_construct_python_tuple","nodeType":"Function","startLoc":216,"text":"def _construct_python_tuple(self, node):\n        return tuple(self.construct_sequence(node))"},{"col":0,"comment":"Checks if input is in the Parquet format.\n\n    Parameters\n    ----------\n    origin : Any\n    filepath : str or None\n    fileobj : `~pyarrow.NativeFile` or None\n    *args, **kwargs\n\n    Returns\n    -------\n    is_parquet : bool\n        True if 'fileobj' is not None and is a pyarrow file, or if\n        'filepath' is a string ending with '.parquet' or '.parq'.\n        False otherwise.\n    ","endLoc":57,"header":"def parquet_identify(origin, filepath, fileobj, *args, **kwargs)","id":2951,"name":"parquet_identify","nodeType":"Function","startLoc":27,"text":"def parquet_identify(origin, filepath, fileobj, *args, **kwargs):\n    \"\"\"Checks if input is in the Parquet format.\n\n    Parameters\n    ----------\n    origin : Any\n    filepath : str or None\n    fileobj : `~pyarrow.NativeFile` or None\n    *args, **kwargs\n\n    Returns\n    -------\n    is_parquet : bool\n        True if 'fileobj' is not None and is a pyarrow file, or if\n        'filepath' is a string ending with '.parquet' or '.parq'.\n        False otherwise.\n    \"\"\"\n    if fileobj is not None:\n        try:  # safely test if pyarrow file\n            pos = fileobj.tell()  # store current stream position\n        except AttributeError:\n            return False\n\n        signature = fileobj.read(4)  # read first 4 bytes\n        fileobj.seek(pos)  # return to original location\n\n        return signature == PARQUET_SIGNATURE\n    elif filepath is not None:\n        return filepath.endswith(('.parquet', '.parq'))\n    else:\n        return False"},{"col":0,"comment":"\n    Stack tables vertically (along rows)\n\n    A ``join_type`` of 'exact' means that the tables must all have exactly\n    the same column names (though the order can vary).  If ``join_type``\n    is 'inner' then the intersection of common columns will be the output.\n    A value of 'outer' (default) means the output will have the union of\n    all columns, with table values being masked where no common values are\n    available.\n\n    Parameters\n    ----------\n    tables : `~astropy.table.Table` or `~astropy.table.Row` or list thereof\n        Table(s) to stack along rows (vertically) with the current table\n    join_type : str\n        Join type ('inner' | 'exact' | 'outer'), default is 'outer'\n    metadata_conflicts : str\n        How to proceed with metadata conflicts. This should be one of:\n            * ``'silent'``: silently pick the last conflicting meta-data value\n            * ``'warn'``: pick the last conflicting meta-data value, but emit a warning (default)\n            * ``'error'``: raise an exception.\n\n    Returns\n    -------\n    stacked_table : `~astropy.table.Table` object\n        New table containing the stacked data from the input tables.\n\n    Examples\n    --------\n    To stack two tables along rows do::\n\n      >>> from astropy.table import vstack, Table\n      >>> t1 = Table({'a': [1, 2], 'b': [3, 4]}, names=('a', 'b'))\n      >>> t2 = Table({'a': [5, 6], 'b': [7, 8]}, names=('a', 'b'))\n      >>> print(t1)\n       a   b\n      --- ---\n        1   3\n        2   4\n      >>> print(t2)\n       a   b\n      --- ---\n        5   7\n        6   8\n      >>> print(vstack([t1, t2]))\n       a   b\n      --- ---\n        1   3\n        2   4\n        5   7\n        6   8\n    ","endLoc":656,"header":"def vstack(tables, join_type='outer', metadata_conflicts='warn')","id":2952,"name":"vstack","nodeType":"Function","startLoc":591,"text":"def vstack(tables, join_type='outer', metadata_conflicts='warn'):\n    \"\"\"\n    Stack tables vertically (along rows)\n\n    A ``join_type`` of 'exact' means that the tables must all have exactly\n    the same column names (though the order can vary).  If ``join_type``\n    is 'inner' then the intersection of common columns will be the output.\n    A value of 'outer' (default) means the output will have the union of\n    all columns, with table values being masked where no common values are\n    available.\n\n    Parameters\n    ----------\n    tables : `~astropy.table.Table` or `~astropy.table.Row` or list thereof\n        Table(s) to stack along rows (vertically) with the current table\n    join_type : str\n        Join type ('inner' | 'exact' | 'outer'), default is 'outer'\n    metadata_conflicts : str\n        How to proceed with metadata conflicts. This should be one of:\n            * ``'silent'``: silently pick the last conflicting meta-data value\n            * ``'warn'``: pick the last conflicting meta-data value, but emit a warning (default)\n            * ``'error'``: raise an exception.\n\n    Returns\n    -------\n    stacked_table : `~astropy.table.Table` object\n        New table containing the stacked data from the input tables.\n\n    Examples\n    --------\n    To stack two tables along rows do::\n\n      >>> from astropy.table import vstack, Table\n      >>> t1 = Table({'a': [1, 2], 'b': [3, 4]}, names=('a', 'b'))\n      >>> t2 = Table({'a': [5, 6], 'b': [7, 8]}, names=('a', 'b'))\n      >>> print(t1)\n       a   b\n      --- ---\n        1   3\n        2   4\n      >>> print(t2)\n       a   b\n      --- ---\n        5   7\n        6   8\n      >>> print(vstack([t1, t2]))\n       a   b\n      --- ---\n        1   3\n        2   4\n        5   7\n        6   8\n    \"\"\"\n    _check_join_type(join_type, 'vstack')\n\n    tables = _get_list_of_tables(tables)  # validates input\n    if len(tables) == 1:\n        return tables[0]  # no point in stacking a single table\n    col_name_map = OrderedDict()\n\n    out = _vstack(tables, join_type, col_name_map, metadata_conflicts)\n\n    # Merge table metadata\n    _merge_table_meta(out, tables, metadata_conflicts=metadata_conflicts)\n\n    return out"},{"col":0,"comment":"Check join_type arg in hstack and vstack.\n\n    This specifically checks for the common mistake of call vstack(t1, t2)\n    instead of vstack([t1, t2]). The subsequent check of\n    ``join_type in ('inner', ..)`` does not raise in this case.\n    ","endLoc":1328,"header":"def _check_join_type(join_type, func_name)","id":2953,"name":"_check_join_type","nodeType":"Function","startLoc":1312,"text":"def _check_join_type(join_type, func_name):\n    \"\"\"Check join_type arg in hstack and vstack.\n\n    This specifically checks for the common mistake of call vstack(t1, t2)\n    instead of vstack([t1, t2]). The subsequent check of\n    ``join_type in ('inner', ..)`` does not raise in this case.\n    \"\"\"\n    if not isinstance(join_type, str):\n        msg = '`join_type` arg must be a string'\n        if isinstance(join_type, Table):\n            msg += ('. Did you accidentally '\n                    f'call {func_name}(t1, t2, ..) instead of '\n                    f'{func_name}([t1, t2], ..)?')\n        raise TypeError(msg)\n\n    if join_type not in ('inner', 'exact', 'outer'):\n        raise ValueError(\"`join_type` arg must be one of 'inner', 'exact' or 'outer'\")"},{"col":4,"comment":"null","endLoc":1409,"header":"def __lt__(self, other)","id":2954,"name":"__lt__","nodeType":"Function","startLoc":1408,"text":"def __lt__(self, other):\n        return self._time_comparison(other, operator.lt)"},{"col":4,"comment":"null","endLoc":220,"header":"def _construct_python_unicode(self, node)","id":2956,"name":"_construct_python_unicode","nodeType":"Function","startLoc":219,"text":"def _construct_python_unicode(self, node):\n        return self.construct_scalar(node)"},{"col":4,"comment":"null","endLoc":1412,"header":"def __le__(self, other)","id":2957,"name":"__le__","nodeType":"Function","startLoc":1411,"text":"def __le__(self, other):\n        return self._time_comparison(other, operator.le)"},{"col":4,"comment":"\n        Set internal jd1 and jd2 from val1 and val2.  Must be provided\n        by derived classes.\n        ","endLoc":326,"header":"def set_jds(self, val1, val2)","id":2958,"name":"set_jds","nodeType":"Function","startLoc":321,"text":"def set_jds(self, val1, val2):\n        \"\"\"\n        Set internal jd1 and jd2 from val1 and val2.  Must be provided\n        by derived classes.\n        \"\"\"\n        raise NotImplementedError"},{"col":0,"comment":"\n    Check that tables is a Table or sequence of Tables.  Returns the\n    corresponding list of Tables.\n    ","endLoc":70,"header":"def _get_list_of_tables(tables)","id":2959,"name":"_get_list_of_tables","nodeType":"Function","startLoc":41,"text":"def _get_list_of_tables(tables):\n    \"\"\"\n    Check that tables is a Table or sequence of Tables.  Returns the\n    corresponding list of Tables.\n    \"\"\"\n\n    # Make sure we have a list of things\n    if not isinstance(tables, Sequence):\n        tables = [tables]\n\n    # Make sure there is something to stack\n    if len(tables) == 0:\n        raise ValueError('no values provided to stack.')\n\n    # Convert inputs (Table, Row, or anything column-like) to Tables.\n    # Special case that Quantity converts to a QTable.\n    for ii, val in enumerate(tables):\n        if isinstance(val, Table):\n            pass\n        elif isinstance(val, Row):\n            tables[ii] = Table(val)\n        elif isinstance(val, Quantity):\n            tables[ii] = QTable([val])\n        else:\n            try:\n                tables[ii] = Table([val])\n            except (ValueError, TypeError) as err:\n                raise TypeError(f'Cannot convert {val} to table column.') from err\n\n    return tables"},{"col":4,"comment":"\n        If other is an incompatible object for comparison, return `False`.\n        Otherwise, return `True` if the time difference between self and\n        other is zero.\n        ","endLoc":1420,"header":"def __eq__(self, other)","id":2960,"name":"__eq__","nodeType":"Function","startLoc":1414,"text":"def __eq__(self, other):\n        \"\"\"\n        If other is an incompatible object for comparison, return `False`.\n        Otherwise, return `True` if the time difference between self and\n        other is zero.\n        \"\"\"\n        return self._time_comparison(other, operator.eq)"},{"col":4,"comment":"\n        If other is an incompatible object for comparison, return `True`.\n        Otherwise, return `False` if the time difference between self and\n        other is zero.\n        ","endLoc":1428,"header":"def __ne__(self, other)","id":2961,"name":"__ne__","nodeType":"Function","startLoc":1422,"text":"def __ne__(self, other):\n        \"\"\"\n        If other is an incompatible object for comparison, return `True`.\n        Otherwise, return `False` if the time difference between self and\n        other is zero.\n        \"\"\"\n        return self._time_comparison(other, operator.ne)"},{"col":0,"comment":"\n    Read a Table object from a Parquet file.\n\n    This requires `pyarrow <https://arrow.apache.org/docs/python/>`_\n    to be installed.\n\n    The ``filters`` parameter consists of predicates that are expressed\n    in disjunctive normal form (DNF), like ``[[('x', '=', 0), ...], ...]``.\n    DNF allows arbitrary boolean logical combinations of single column\n    predicates. The innermost tuples each describe a single column predicate.\n    The list of inner predicates is interpreted as a conjunction (AND),\n    forming a more selective and multiple column predicate. Finally, the most\n    outer list combines these filters as a disjunction (OR).\n\n    Predicates may also be passed as List[Tuple]. This form is interpreted\n    as a single conjunction. To express OR in predicates, one must\n    use the (preferred) List[List[Tuple]] notation.\n\n    Each tuple has format: (``key``, ``op``, ``value``) and compares the\n    ``key`` with the ``value``.\n    The supported ``op`` are:  ``=`` or ``==``, ``!=``, ``<``, ``>``, ``<=``,\n    ``>=``, ``in`` and ``not in``. If the ``op`` is ``in`` or ``not in``, the\n    ``value`` must be a collection such as a ``list``, a ``set`` or a\n    ``tuple``.\n\n    Examples:\n\n    .. code-block:: python\n\n        ('x', '=', 0)\n        ('y', 'in', ['a', 'b', 'c'])\n        ('z', 'not in', {'a','b'})\n\n    Parameters\n    ----------\n    input : str or path-like or file-like object\n        If a string or path-like object, the filename to read the table from.\n        If a file-like object, the stream to read data.\n    include_names : list [str], optional\n        List of names to include in output. If not supplied, then\n        include all columns.\n    exclude_names : list [str], optional\n        List of names to exclude from output (applied after ``include_names``).\n        If not supplied then no columns are excluded.\n    schema_only : bool, optional\n        Only read the schema/metadata with table information.\n    filters : list [tuple] or list [list [tuple] ] or None, optional\n        Rows which do not match the filter predicate will be removed from\n        scanned data.  See `pyarrow.parquet.read_table()` for details.\n\n    Returns\n    -------\n    table : `~astropy.table.Table`\n        Table will have zero rows and only metadata information\n        if schema_only is True.\n    ","endLoc":244,"header":"def read_table_parquet(input, include_names=None, exclude_names=None,\n                       schema_only=False, filters=None)","id":2962,"name":"read_table_parquet","nodeType":"Function","startLoc":60,"text":"def read_table_parquet(input, include_names=None, exclude_names=None,\n                       schema_only=False, filters=None):\n    \"\"\"\n    Read a Table object from a Parquet file.\n\n    This requires `pyarrow <https://arrow.apache.org/docs/python/>`_\n    to be installed.\n\n    The ``filters`` parameter consists of predicates that are expressed\n    in disjunctive normal form (DNF), like ``[[('x', '=', 0), ...], ...]``.\n    DNF allows arbitrary boolean logical combinations of single column\n    predicates. The innermost tuples each describe a single column predicate.\n    The list of inner predicates is interpreted as a conjunction (AND),\n    forming a more selective and multiple column predicate. Finally, the most\n    outer list combines these filters as a disjunction (OR).\n\n    Predicates may also be passed as List[Tuple]. This form is interpreted\n    as a single conjunction. To express OR in predicates, one must\n    use the (preferred) List[List[Tuple]] notation.\n\n    Each tuple has format: (``key``, ``op``, ``value``) and compares the\n    ``key`` with the ``value``.\n    The supported ``op`` are:  ``=`` or ``==``, ``!=``, ``<``, ``>``, ``<=``,\n    ``>=``, ``in`` and ``not in``. If the ``op`` is ``in`` or ``not in``, the\n    ``value`` must be a collection such as a ``list``, a ``set`` or a\n    ``tuple``.\n\n    Examples:\n\n    .. code-block:: python\n\n        ('x', '=', 0)\n        ('y', 'in', ['a', 'b', 'c'])\n        ('z', 'not in', {'a','b'})\n\n    Parameters\n    ----------\n    input : str or path-like or file-like object\n        If a string or path-like object, the filename to read the table from.\n        If a file-like object, the stream to read data.\n    include_names : list [str], optional\n        List of names to include in output. If not supplied, then\n        include all columns.\n    exclude_names : list [str], optional\n        List of names to exclude from output (applied after ``include_names``).\n        If not supplied then no columns are excluded.\n    schema_only : bool, optional\n        Only read the schema/metadata with table information.\n    filters : list [tuple] or list [list [tuple] ] or None, optional\n        Rows which do not match the filter predicate will be removed from\n        scanned data.  See `pyarrow.parquet.read_table()` for details.\n\n    Returns\n    -------\n    table : `~astropy.table.Table`\n        Table will have zero rows and only metadata information\n        if schema_only is True.\n    \"\"\"\n    pa, parquet, _ = get_pyarrow()\n\n    if not isinstance(input, (str, os.PathLike)):\n        # The 'read' attribute is the key component of a generic\n        # file-like object.\n        if not hasattr(input, 'read'):\n            raise TypeError(\"pyarrow can only open path-like or file-like objects.\")\n\n    schema = parquet.read_schema(input)\n\n    # Pyarrow stores all metadata as byte-strings, so we convert\n    # to UTF-8 strings here.\n    if schema.metadata is not None:\n        md = {k.decode('UTF-8'): v.decode('UTF-8') for k, v in schema.metadata.items()}\n    else:\n        md = {}\n\n    from astropy.table import Table, meta, serialize\n\n    # parse metadata from table yaml\n    meta_dict = {}\n    if 'table_meta_yaml' in md:\n        meta_yaml = md.pop('table_meta_yaml').split('\\n')\n        meta_hdr = meta.get_header_from_yaml(meta_yaml)\n        if 'meta' in meta_hdr:\n            meta_dict = meta_hdr['meta']\n    else:\n        meta_hdr = None\n\n    # parse and set serialized columns\n    full_table_columns = {name: name for name in schema.names}\n    has_serialized_columns = False\n    if '__serialized_columns__' in meta_dict:\n        has_serialized_columns = True\n        serialized_columns = meta_dict['__serialized_columns__']\n        for scol in serialized_columns:\n            for name in _get_names(serialized_columns[scol]):\n                full_table_columns[name] = scol\n\n    use_names = set(full_table_columns.values())\n    # Apply include_names before exclude_names\n    if include_names is not None:\n        use_names.intersection_update(include_names)\n    if exclude_names is not None:\n        use_names.difference_update(exclude_names)\n    # Preserve column ordering via list, and use this dict trick\n    # to remove duplicates and preserve ordering (for mixin columns)\n    use_names = list(dict.fromkeys([x for x in full_table_columns.values() if x in use_names]))\n\n    # names_to_read is a list of actual serialized column names, where\n    # e.g. the requested name 'time' becomes ['time.jd1', 'time.jd2']\n    names_to_read = []\n    for name in use_names:\n        names = [n for n, col in full_table_columns.items() if name == col]\n        names_to_read.extend(names)\n\n    if not names_to_read:\n        raise ValueError(\"No include_names specified were found in the table.\")\n\n    # We need to pop any unread serialized columns out of the meta_dict.\n    if has_serialized_columns:\n        for scol in list(meta_dict['__serialized_columns__'].keys()):\n            if scol not in use_names:\n                meta_dict['__serialized_columns__'].pop(scol)\n\n    # whether to return the whole table or a formatted empty table.\n    if not schema_only:\n        # Read the pyarrow table, specifying columns and filters.\n        pa_table = parquet.read_table(input, columns=names_to_read, filters=filters)\n        num_rows = pa_table.num_rows\n    else:\n        num_rows = 0\n\n    # Now need to convert parquet table to Astropy\n    dtype = []\n    for name in names_to_read:\n        # Pyarrow string and byte columns do not have native length information\n        # so we must determine those here.\n        if schema.field(name).type not in (pa.string(), pa.binary()):\n            # Convert the pyarrow type into a numpy dtype (which is returned\n            # by the to_pandas_type() method).\n            dtype.append(schema.field(name).type.to_pandas_dtype())\n            continue\n\n        # Special-case for string and binary columns\n        md_name = f'table::len::{name}'\n        if md_name in md:\n            # String/bytes length from header.\n            strlen = int(md[md_name])\n        elif schema_only:  # Find the maximum string length.\n            # Choose an arbitrary string length since\n            # are not reading in the table.\n            strlen = 10\n            warnings.warn(f\"No {md_name} found in metadata. \"\n                          f\"Guessing {{strlen}} for schema.\",\n                          AstropyUserWarning)\n        else:\n            strlen = max([len(row.as_py()) for row in pa_table[name]])\n            warnings.warn(f\"No {md_name} found in metadata. \"\n                          f\"Using longest string ({{strlen}} characters).\",\n                          AstropyUserWarning)\n        dtype.append(f'U{strlen}' if schema.field(name).type == pa.string() else f'|S{strlen}')\n\n    # Create the empty numpy record array to store the pyarrow data.\n    data = np.zeros(num_rows, dtype=list(zip(names_to_read, dtype)))\n\n    if not schema_only:\n        # Convert each column in the pyarrow table to a numpy array\n        for name in names_to_read:\n            data[name][:] = pa_table[name].to_numpy()\n\n    table = Table(data=data, meta=meta_dict)\n\n    if meta_hdr is not None:\n        # Set description, format, unit, meta from the column\n        # metadata that was serialized with the table.\n        header_cols = dict((x['name'], x) for x in meta_hdr['datatype'])\n        for col in table.columns.values():\n            for attr in ('description', 'format', 'unit', 'meta'):\n                if attr in header_cols[col.name]:\n                    setattr(col, attr, header_cols[col.name][attr])\n\n    # Convert all compound columns to astropy objects\n    # (e.g. time.jd1, time.jd2 into a single time column)\n    table = serialize._construct_mixins_from_columns(table)\n\n    return table"},{"col":4,"comment":"null","endLoc":1431,"header":"def __gt__(self, other)","id":2963,"name":"__gt__","nodeType":"Function","startLoc":1430,"text":"def __gt__(self, other):\n        return self._time_comparison(other, operator.gt)"},{"col":4,"comment":"null","endLoc":1434,"header":"def __ge__(self, other)","id":2964,"name":"__ge__","nodeType":"Function","startLoc":1433,"text":"def __ge__(self, other):\n        return self._time_comparison(other, operator.ge)"},{"col":4,"comment":"\n        Convert to ``datetime.timedelta`` object.\n        ","endLoc":2350,"header":"def to_datetime(self)","id":2965,"name":"to_datetime","nodeType":"Function","startLoc":2345,"text":"def to_datetime(self):\n        \"\"\"\n        Convert to ``datetime.timedelta`` object.\n        \"\"\"\n        tm = self.replicate(format='datetime')\n        return tm._shaped_like_input(tm._time.value)"},{"className":"AstropyDumper","col":0,"comment":"\n    Custom SafeDumper that represents astropy core objects as well\n    as Python tuple and unicode objects.\n\n    This class is not directly instantiated by user code, but instead is\n    used to maintain the available representer functions that are\n    called when generating a YAML stream from an object.  See the\n    `PyYaml documentation <https://pyyaml.org/wiki/PyYAMLDocumentation>`_\n    for details of the class signature.\n    ","endLoc":236,"id":2966,"nodeType":"Class","startLoc":223,"text":"class AstropyDumper(yaml.SafeDumper):\n    \"\"\"\n    Custom SafeDumper that represents astropy core objects as well\n    as Python tuple and unicode objects.\n\n    This class is not directly instantiated by user code, but instead is\n    used to maintain the available representer functions that are\n    called when generating a YAML stream from an object.  See the\n    `PyYaml documentation <https://pyyaml.org/wiki/PyYAMLDocumentation>`_\n    for details of the class signature.\n    \"\"\"\n\n    def _represent_tuple(self, data):\n        return self.represent_sequence('tag:yaml.org,2002:python/tuple', data)"},{"attributeType":"null","col":4,"comment":"null","endLoc":337,"id":2967,"name":"__array_priority__","nodeType":"Attribute","startLoc":337,"text":"__array_priority__"},{"attributeType":"null","col":4,"comment":"null","endLoc":341,"id":2968,"name":"_astropy_column_attrs","nodeType":"Attribute","startLoc":341,"text":"_astropy_column_attrs"},{"attributeType":"null","col":8,"comment":"null","endLoc":386,"id":2969,"name":"_format","nodeType":"Attribute","startLoc":386,"text":"self._format"},{"col":4,"comment":"null","endLoc":236,"header":"def _represent_tuple(self, data)","id":2970,"name":"_represent_tuple","nodeType":"Function","startLoc":235,"text":"def _represent_tuple(self, data):\n        return self.represent_sequence('tag:yaml.org,2002:python/tuple', data)"},{"attributeType":"null","col":12,"comment":"null","endLoc":392,"id":2971,"name":"location","nodeType":"Attribute","startLoc":392,"text":"self.location"},{"attributeType":"null","col":8,"comment":"null","endLoc":384,"id":2972,"name":"_time","nodeType":"Attribute","startLoc":384,"text":"self._time"},{"col":4,"comment":"null","endLoc":1501,"header":"def __new__(cls, val, val2=None, format=None, scale=None,\n                precision=None, in_subfmt=None, out_subfmt=None,\n                location=None, copy=False)","id":2973,"name":"__new__","nodeType":"Function","startLoc":1492,"text":"def __new__(cls, val, val2=None, format=None, scale=None,\n                precision=None, in_subfmt=None, out_subfmt=None,\n                location=None, copy=False):\n\n        if isinstance(val, Time):\n            self = val.replicate(format=format, copy=copy, cls=cls)\n        else:\n            self = super().__new__(cls)\n\n        return self"},{"col":4,"comment":"Perform common elements of addition / subtraction for two delta times","endLoc":2405,"header":"def _add_sub(self, other, op)","id":2974,"name":"_add_sub","nodeType":"Function","startLoc":2377,"text":"def _add_sub(self, other, op):\n        \"\"\"Perform common elements of addition / subtraction for two delta times\"\"\"\n        # If not a TimeDelta then see if it can be turned into a TimeDelta.\n        if not isinstance(other, TimeDelta):\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                return NotImplemented\n\n        # the scales should be compatible (e.g., cannot convert TDB to TAI)\n        if(self.scale is not None and self.scale not in other.SCALES\n           or other.scale is not None and other.scale not in self.SCALES):\n            raise TypeError(\"Cannot add TimeDelta instances with scales \"\n                            \"'{}' and '{}'\".format(self.scale, other.scale))\n\n        # adjust the scale of other if the scale of self is set (or no scales)\n        if self.scale is not None or other.scale is None:\n            out = self.replicate()\n            if other.scale is not None:\n                other = getattr(other, self.scale)\n        else:\n            out = other.replicate()\n\n        jd1 = op(self._time.jd1, other._time.jd1)\n        jd2 = op(self._time.jd2, other._time.jd2)\n\n        out._time.jd1, out._time.jd2 = day_frac(jd1, jd2)\n\n        return out"},{"col":4,"comment":"null","endLoc":224,"header":"def __init__(self, *args, best_solution=None, accuracy=None, niter=None,\n                 divergent=None, slow_conv=None, **kwargs)","id":2975,"name":"__init__","nodeType":"Function","startLoc":210,"text":"def __init__(self, *args, best_solution=None, accuracy=None, niter=None,\n                 divergent=None, slow_conv=None, **kwargs):\n        super().__init__(*args)\n\n        self.best_solution = best_solution\n        self.accuracy = accuracy\n        self.niter = niter\n        self.divergent = divergent\n        self.slow_conv = slow_conv\n\n        if kwargs:\n            warnings.warn(\"Function received unexpected arguments ({}) these \"\n                          \"are ignored but will raise an Exception in the \"\n                          \"future.\".format(list(kwargs)),\n                          AstropyDeprecationWarning)"},{"col":0,"comment":"null","endLoc":365,"header":"def get_pyarrow()","id":2976,"name":"get_pyarrow","nodeType":"Function","startLoc":353,"text":"def get_pyarrow():\n    try:\n        import pyarrow as pa\n        from pyarrow import parquet\n    except ImportError:\n        raise Exception(\"pyarrow is required to read and write parquet files\")\n\n    if minversion(pa, '6.0.0'):\n        writer_version = '2.4'\n    else:\n        writer_version = '2.0'\n\n    return pa, parquet, writer_version"},{"col":4,"comment":"Coerce setitem value into an equivalent Time object","endLoc":1583,"header":"def _make_value_equivalent(self, item, value)","id":2977,"name":"_make_value_equivalent","nodeType":"Function","startLoc":1548,"text":"def _make_value_equivalent(self, item, value):\n        \"\"\"Coerce setitem value into an equivalent Time object\"\"\"\n\n        # If there is a vector location then broadcast to the Time shape\n        # and then select with ``item``\n        if self.location is not None and self.location.shape:\n            self_location = np.broadcast_to(self.location, self.shape, subok=True)[item]\n        else:\n            self_location = self.location\n\n        if isinstance(value, Time):\n            # Make sure locations are compatible.  Location can be either None or\n            # a Location object.\n            if self_location is None and value.location is None:\n                match = True\n            elif ((self_location is None and value.location is not None)\n                  or (self_location is not None and value.location is None)):\n                match = False\n            else:\n                match = np.all(self_location == value.location)\n            if not match:\n                raise ValueError('cannot set to Time with different location: '\n                                 'expected location={} and '\n                                 'got location={}'\n                                 .format(self_location, value.location))\n        else:\n            try:\n                value = self.__class__(value, scale=self.scale, location=self_location)\n            except Exception:\n                try:\n                    value = self.__class__(value, scale=self.scale, format=self.format,\n                                           location=self_location)\n                except Exception as err:\n                    raise ValueError('cannot convert value to a compatible Time object: {}'\n                                     .format(err))\n        return value"},{"col":0,"comment":"null","endLoc":75,"header":"def _unit_representer(dumper, obj)","id":2978,"name":"_unit_representer","nodeType":"Function","startLoc":73,"text":"def _unit_representer(dumper, obj):\n    out = {'unit': str(obj.to_string())}\n    return dumper.represent_mapping('!astropy.units.Unit', out)"},{"col":4,"comment":"null","endLoc":1905,"header":"@deprecated_renamed_argument('accuracy', 'tolerance', '4.3')\n    def all_world2pix(self, *args, tolerance=1e-4, maxiter=20, adaptive=False,\n                      detect_divergence=True, quiet=False, **kwargs)","id":2979,"name":"all_world2pix","nodeType":"Function","startLoc":1892,"text":"@deprecated_renamed_argument('accuracy', 'tolerance', '4.3')\n    def all_world2pix(self, *args, tolerance=1e-4, maxiter=20, adaptive=False,\n                      detect_divergence=True, quiet=False, **kwargs):\n        if self.wcs is None:\n            raise ValueError(\"No basic WCS settings were created.\")\n\n        return self._array_converter(\n            lambda *args, **kwargs:\n            self._all_world2pix(\n                *args, tolerance=tolerance, maxiter=maxiter,\n                adaptive=adaptive, detect_divergence=detect_divergence,\n                quiet=quiet),\n            'input', *args, **kwargs\n        )"},{"col":0,"comment":"null","endLoc":80,"header":"def _unit_constructor(loader, node)","id":2980,"name":"_unit_constructor","nodeType":"Function","startLoc":78,"text":"def _unit_constructor(loader, node):\n    map = loader.construct_mapping(node)\n    return u.Unit(map['unit'], parse_strict='warn')"},{"col":0,"comment":"null","endLoc":85,"header":"def _serialized_column_representer(dumper, obj)","id":2981,"name":"_serialized_column_representer","nodeType":"Function","startLoc":83,"text":"def _serialized_column_representer(dumper, obj):\n    out = dumper.represent_mapping('!astropy.table.SerializedColumn', obj)\n    return out"},{"col":12,"endLoc":1903,"id":2982,"nodeType":"Lambda","startLoc":1899,"text":"lambda *args, **kwargs:\n            self._all_world2pix(\n                *args, tolerance=tolerance, maxiter=maxiter,\n                adaptive=adaptive, detect_divergence=detect_divergence,\n                quiet=quiet)"},{"col":4,"comment":"\n        Creates a new object corresponding to the instant in time this\n        method is called.\n\n        .. note::\n            \"Now\" is determined using the `~datetime.datetime.utcnow`\n            function, so its accuracy and precision is determined by that\n            function.  Generally that means it is set by the accuracy of\n            your system clock.\n\n        Returns\n        -------\n        nowtime : :class:`~astropy.time.Time`\n            A new `Time` object (or a subclass of `Time` if this is called from\n            such a subclass) at the current time.\n        ","endLoc":1605,"header":"@classmethod\n    def now(cls)","id":2983,"name":"now","nodeType":"Function","startLoc":1585,"text":"@classmethod\n    def now(cls):\n        \"\"\"\n        Creates a new object corresponding to the instant in time this\n        method is called.\n\n        .. note::\n            \"Now\" is determined using the `~datetime.datetime.utcnow`\n            function, so its accuracy and precision is determined by that\n            function.  Generally that means it is set by the accuracy of\n            your system clock.\n\n        Returns\n        -------\n        nowtime : :class:`~astropy.time.Time`\n            A new `Time` object (or a subclass of `Time` if this is called from\n            such a subclass) at the current time.\n        \"\"\"\n        # call `utcnow` immediately to be sure it's ASAP\n        dtnow = datetime.utcnow()\n        return cls(val=dtnow, format='datetime', scale='utc')"},{"col":4,"comment":"null","endLoc":2327,"header":"def p4_pix2foc(self, *args)","id":2984,"name":"p4_pix2foc","nodeType":"Function","startLoc":2326,"text":"def p4_pix2foc(self, *args):\n        return self._array_converter(self._p4_pix2foc, None, *args)"},{"col":0,"comment":"null","endLoc":90,"header":"def _serialized_column_constructor(loader, node)","id":2985,"name":"_serialized_column_constructor","nodeType":"Function","startLoc":88,"text":"def _serialized_column_constructor(loader, node):\n    map = loader.construct_mapping(node)\n    return SerializedColumn(map)"},{"col":0,"comment":"\n    Stack Tables vertically (by rows)\n\n    A ``join_type`` of 'exact' (default) means that the arrays must all\n    have exactly the same column names (though the order can vary).  If\n    ``join_type`` is 'inner' then the intersection of common columns will\n    be the output.  A value of 'outer' means the output will have the union of\n    all columns, with array values being masked where no common values are\n    available.\n\n    Parameters\n    ----------\n    arrays : list of Tables\n        Tables to stack by rows (vertically)\n    join_type : str\n        Join type ('inner' | 'exact' | 'outer'), default is 'outer'\n    col_name_map : empty dict or None\n        If passed as a dict then it will be updated in-place with the\n        mapping of output to input column names.\n\n    Returns\n    -------\n    stacked_table : `~astropy.table.Table` object\n        New table containing the stacked data from the input tables.\n    ","endLoc":1434,"header":"def _vstack(arrays, join_type='outer', col_name_map=None, metadata_conflicts='warn')","id":2986,"name":"_vstack","nodeType":"Function","startLoc":1331,"text":"def _vstack(arrays, join_type='outer', col_name_map=None, metadata_conflicts='warn'):\n    \"\"\"\n    Stack Tables vertically (by rows)\n\n    A ``join_type`` of 'exact' (default) means that the arrays must all\n    have exactly the same column names (though the order can vary).  If\n    ``join_type`` is 'inner' then the intersection of common columns will\n    be the output.  A value of 'outer' means the output will have the union of\n    all columns, with array values being masked where no common values are\n    available.\n\n    Parameters\n    ----------\n    arrays : list of Tables\n        Tables to stack by rows (vertically)\n    join_type : str\n        Join type ('inner' | 'exact' | 'outer'), default is 'outer'\n    col_name_map : empty dict or None\n        If passed as a dict then it will be updated in-place with the\n        mapping of output to input column names.\n\n    Returns\n    -------\n    stacked_table : `~astropy.table.Table` object\n        New table containing the stacked data from the input tables.\n    \"\"\"\n    # Store user-provided col_name_map until the end\n    _col_name_map = col_name_map\n\n    # Trivial case of one input array\n    if len(arrays) == 1:\n        return arrays[0]\n\n    # Start by assuming an outer match where all names go to output\n    names = set(itertools.chain(*[arr.colnames for arr in arrays]))\n    col_name_map = get_col_name_map(arrays, names)\n\n    # If require_match is True then the output must have exactly the same\n    # number of columns as each input array\n    if join_type == 'exact':\n        for names in col_name_map.values():\n            if any(x is None for x in names):\n                raise TableMergeError('Inconsistent columns in input arrays '\n                                      \"(use 'inner' or 'outer' join_type to \"\n                                      \"allow non-matching columns)\")\n        join_type = 'outer'\n\n    # For an inner join, keep only columns where all input arrays have that column\n    if join_type == 'inner':\n        col_name_map = OrderedDict((name, in_names) for name, in_names in col_name_map.items()\n                                   if all(x is not None for x in in_names))\n        if len(col_name_map) == 0:\n            raise TableMergeError('Input arrays have no columns in common')\n\n    lens = [len(arr) for arr in arrays]\n    n_rows = sum(lens)\n    out = _get_out_class(arrays)()\n\n    for out_name, in_names in col_name_map.items():\n        # List of input arrays that contribute to this output column\n        cols = [arr[name] for arr, name in zip(arrays, in_names) if name is not None]\n\n        col_cls = _get_out_class(cols)\n        if not hasattr(col_cls.info, 'new_like'):\n            raise NotImplementedError('vstack unavailable for mixin column type(s): {}'\n                                      .format(col_cls.__name__))\n        try:\n            col = col_cls.info.new_like(cols, n_rows, metadata_conflicts, out_name)\n        except metadata.MergeConflictError as err:\n            # Beautify the error message when we are trying to merge columns with incompatible\n            # types by including the name of the columns that originated the error.\n            raise TableMergeError(\"The '{}' columns have incompatible types: {}\"\n                                  .format(out_name, err._incompat_types)) from err\n\n        idx0 = 0\n        for name, array in zip(in_names, arrays):\n            idx1 = idx0 + len(array)\n            if name in array.colnames:\n                col[idx0:idx1] = array[name]\n            else:\n                # If col is a Column but not MaskedColumn then upgrade at this point\n                # because masking is required.\n                if isinstance(col, Column) and not isinstance(col, MaskedColumn):\n                    col = out.MaskedColumn(col, copy=False)\n\n                if isinstance(col, Quantity) and not isinstance(col, Masked):\n                    col = Masked(col, copy=False)\n\n                try:\n                    col[idx0:idx1] = col.info.mask_val\n                except Exception as err:\n                    raise NotImplementedError(\n                        \"vstack requires masking column '{}' but column\"\n                        \" type {} does not support masking\"\n                        .format(out_name, col.__class__.__name__)) from err\n            idx0 = idx1\n\n        out[out_name] = col\n\n    # If col_name_map supplied as a dict input, then update.\n    if isinstance(_col_name_map, Mapping):\n        _col_name_map.update(col_name_map)\n\n    return out"},{"col":4,"comment":"null","endLoc":2356,"header":"def det2im(self, *args)","id":2987,"name":"det2im","nodeType":"Function","startLoc":2355,"text":"def det2im(self, *args):\n        return self._array_converter(self._det2im, None, *args)"},{"col":4,"comment":"\n        Parse a string to a Time according to a format specification.\n        See `time.strptime` documentation for format specification.\n\n        >>> Time.strptime('2012-Jun-30 23:59:60', '%Y-%b-%d %H:%M:%S')\n        <Time object: scale='utc' format='isot' value=2012-06-30T23:59:60.000>\n\n        Parameters\n        ----------\n        time_string : str, sequence, or ndarray\n            Objects containing time data of type string\n        format_string : str\n            String specifying format of time_string.\n        kwargs : dict\n            Any keyword arguments for ``Time``.  If the ``format`` keyword\n            argument is present, this will be used as the Time format.\n\n        Returns\n        -------\n        time_obj : `~astropy.time.Time`\n            A new `~astropy.time.Time` object corresponding to the input\n            ``time_string``.\n\n        ","endLoc":1658,"header":"@classmethod\n    def strptime(cls, time_string, format_string, **kwargs)","id":2988,"name":"strptime","nodeType":"Function","startLoc":1609,"text":"@classmethod\n    def strptime(cls, time_string, format_string, **kwargs):\n        \"\"\"\n        Parse a string to a Time according to a format specification.\n        See `time.strptime` documentation for format specification.\n\n        >>> Time.strptime('2012-Jun-30 23:59:60', '%Y-%b-%d %H:%M:%S')\n        <Time object: scale='utc' format='isot' value=2012-06-30T23:59:60.000>\n\n        Parameters\n        ----------\n        time_string : str, sequence, or ndarray\n            Objects containing time data of type string\n        format_string : str\n            String specifying format of time_string.\n        kwargs : dict\n            Any keyword arguments for ``Time``.  If the ``format`` keyword\n            argument is present, this will be used as the Time format.\n\n        Returns\n        -------\n        time_obj : `~astropy.time.Time`\n            A new `~astropy.time.Time` object corresponding to the input\n            ``time_string``.\n\n        \"\"\"\n        time_array = np.asarray(time_string)\n\n        if time_array.dtype.kind not in ('U', 'S'):\n            err = \"Expected type is string, a bytes-like object or a sequence\"\\\n                  \" of these. Got dtype '{}'\".format(time_array.dtype.kind)\n            raise TypeError(err)\n\n        to_string = (str if time_array.dtype.kind == 'U' else\n                     lambda x: str(x.item(), encoding='ascii'))\n        iterator = np.nditer([time_array, None],\n                             op_dtypes=[time_array.dtype, 'U30'])\n\n        for time, formatted in iterator:\n            tt, fraction = _strptime._strptime(to_string(time), format_string)\n            time_tuple = tt[:6] + (fraction,)\n            formatted[...] = '{:04}-{:02}-{:02}T{:02}:{:02}:{:02}.{:06}'\\\n                .format(*time_tuple)\n\n        format = kwargs.pop('format', None)\n        out = cls(*iterator.operands[1:], format='isot', **kwargs)\n        if format is not None:\n            out.format = format\n\n        return out"},{"col":0,"comment":"\n    Find the column names mapping when merging the list of tables\n    ``arrays``.  It is assumed that col names in ``common_names`` are to be\n    merged into a single column while the rest will be uniquely represented\n    in the output.  The args ``uniq_col_name`` and ``table_names`` specify\n    how to rename columns in case of conflicts.\n\n    Returns a dict mapping each output column name to the input(s).  This takes the form\n    {outname : (col_name_0, col_name_1, ...), ... }.  For key columns all of input names\n    will be present, while for the other non-key columns the value will be (col_name_0,\n    None, ..) or (None, col_name_1, ..) etc.\n    ","endLoc":919,"header":"def get_col_name_map(arrays, common_names, uniq_col_name='{col_name}_{table_name}',\n                     table_names=None)","id":2989,"name":"get_col_name_map","nodeType":"Function","startLoc":866,"text":"def get_col_name_map(arrays, common_names, uniq_col_name='{col_name}_{table_name}',\n                     table_names=None):\n    \"\"\"\n    Find the column names mapping when merging the list of tables\n    ``arrays``.  It is assumed that col names in ``common_names`` are to be\n    merged into a single column while the rest will be uniquely represented\n    in the output.  The args ``uniq_col_name`` and ``table_names`` specify\n    how to rename columns in case of conflicts.\n\n    Returns a dict mapping each output column name to the input(s).  This takes the form\n    {outname : (col_name_0, col_name_1, ...), ... }.  For key columns all of input names\n    will be present, while for the other non-key columns the value will be (col_name_0,\n    None, ..) or (None, col_name_1, ..) etc.\n    \"\"\"\n\n    col_name_map = collections.defaultdict(lambda: [None] * len(arrays))\n    col_name_list = []\n\n    if table_names is None:\n        table_names = [str(ii + 1) for ii in range(len(arrays))]\n\n    for idx, array in enumerate(arrays):\n        table_name = table_names[idx]\n        for name in array.colnames:\n            out_name = name\n\n            if name in common_names:\n                # If name is in the list of common_names then insert into\n                # the column name list, but just once.\n                if name not in col_name_list:\n                    col_name_list.append(name)\n            else:\n                # If name is not one of the common column outputs, and it collides\n                # with the names in one of the other arrays, then rename\n                others = list(arrays)\n                others.pop(idx)\n                if any(name in other.colnames for other in others):\n                    out_name = uniq_col_name.format(table_name=table_name, col_name=name)\n                col_name_list.append(out_name)\n\n            col_name_map[out_name][idx] = name\n\n    # Check for duplicate output column names\n    col_name_count = Counter(col_name_list)\n    repeated_names = [name for name, count in col_name_count.items() if count > 1]\n    if repeated_names:\n        raise TableMergeError('Merging column names resulted in duplicates: {}.  '\n                              'Change uniq_col_name or table_names args to fix this.'\n                              .format(repeated_names))\n\n    # Convert col_name_map to a regular dict with tuple (immutable) values\n    col_name_map = OrderedDict((name, col_name_map[name]) for name in col_name_list)\n\n    return col_name_map"},{"col":43,"endLoc":881,"id":2990,"nodeType":"Lambda","startLoc":881,"text":"lambda: [None] * len(arrays)"},{"col":4,"comment":"null","endLoc":2392,"header":"def sip_pix2foc(self, *args)","id":2991,"name":"sip_pix2foc","nodeType":"Function","startLoc":2384,"text":"def sip_pix2foc(self, *args):\n        if self.sip is None:\n            if len(args) == 2:\n                return args[0]\n            elif len(args) == 3:\n                return args[:2]\n            else:\n                raise TypeError(\"Wrong number of arguments\")\n        return self._array_converter(self.sip.pix2foc, None, *args)"},{"col":21,"endLoc":1643,"id":2992,"nodeType":"Lambda","startLoc":1643,"text":"lambda x: str(x.item(), encoding='ascii')"},{"col":4,"comment":"null","endLoc":2433,"header":"def sip_foc2pix(self, *args)","id":2993,"name":"sip_foc2pix","nodeType":"Function","startLoc":2425,"text":"def sip_foc2pix(self, *args):\n        if self.sip is None:\n            if len(args) == 2:\n                return args[0]\n            elif len(args) == 3:\n                return args[:2]\n            else:\n                raise TypeError(\"Wrong number of arguments\")\n        return self._array_converter(self.sip.foc2pix, None, *args)"},{"col":4,"comment":"\n        Calculate pixel scales along each axis of the image pixel at\n        the ``CRPIX`` location once it is projected onto the\n        \"plane of intermediate world coordinates\" as defined in\n        `Greisen & Calabretta 2002, A&A, 395, 1061 <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1061G>`_.\n\n        .. note::\n            This method is concerned **only** about the transformation\n            \"image plane\"->\"projection plane\" and **not** about the\n            transformation \"celestial sphere\"->\"projection plane\"->\"image plane\".\n            Therefore, this function ignores distortions arising due to\n            non-linear nature of most projections.\n\n        .. note::\n            This method only returns sensible answers if the WCS contains\n            celestial axes, i.e., the `~astropy.wcs.WCS.celestial` WCS object.\n\n        Returns\n        -------\n        scale : list of `~astropy.units.Quantity`\n            A vector of projection plane increments corresponding to each\n            pixel side (axis).\n\n        See Also\n        --------\n        astropy.wcs.utils.proj_plane_pixel_scales\n\n        ","endLoc":2494,"header":"def proj_plane_pixel_scales(self)","id":2994,"name":"proj_plane_pixel_scales","nodeType":"Function","startLoc":2462,"text":"def proj_plane_pixel_scales(self):\n        \"\"\"\n        Calculate pixel scales along each axis of the image pixel at\n        the ``CRPIX`` location once it is projected onto the\n        \"plane of intermediate world coordinates\" as defined in\n        `Greisen & Calabretta 2002, A&A, 395, 1061 <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1061G>`_.\n\n        .. note::\n            This method is concerned **only** about the transformation\n            \"image plane\"->\"projection plane\" and **not** about the\n            transformation \"celestial sphere\"->\"projection plane\"->\"image plane\".\n            Therefore, this function ignores distortions arising due to\n            non-linear nature of most projections.\n\n        .. note::\n            This method only returns sensible answers if the WCS contains\n            celestial axes, i.e., the `~astropy.wcs.WCS.celestial` WCS object.\n\n        Returns\n        -------\n        scale : list of `~astropy.units.Quantity`\n            A vector of projection plane increments corresponding to each\n            pixel side (axis).\n\n        See Also\n        --------\n        astropy.wcs.utils.proj_plane_pixel_scales\n\n        \"\"\"  # noqa: E501\n        from astropy.wcs.utils import proj_plane_pixel_scales  # Avoid circular import\n        values = proj_plane_pixel_scales(self)\n        units = [u.Unit(x) for x in self.wcs.cunit]\n        return [value * unit for (value, unit) in zip(values, units)]  # Can have different units"},{"col":0,"comment":"null","endLoc":95,"header":"def _time_representer(dumper, obj)","id":2995,"name":"_time_representer","nodeType":"Function","startLoc":93,"text":"def _time_representer(dumper, obj):\n    out = obj.info._represent_as_dict()\n    return dumper.represent_mapping('!astropy.time.Time', out)"},{"col":0,"comment":"Return a 2-tuple consisting of a time struct and an int containing\n    the number of microseconds based on the input string and the\n    format string.","endLoc":507,"header":"def _strptime(data_string, format=\"%a %b %d %H:%M:%S %Y\")","id":2996,"name":"_strptime","nodeType":"Function","startLoc":310,"text":"def _strptime(data_string, format=\"%a %b %d %H:%M:%S %Y\"):\n    \"\"\"Return a 2-tuple consisting of a time struct and an int containing\n    the number of microseconds based on the input string and the\n    format string.\"\"\"\n\n    for index, arg in enumerate([data_string, format]):\n        if not isinstance(arg, str):\n            msg = \"strptime() argument {} must be str, not {}\"\n            raise TypeError(msg.format(index, type(arg)))\n\n    global _TimeRE_cache, _regex_cache\n    with _cache_lock:\n        locale_time = _TimeRE_cache.locale_time\n        if (_getlang() != locale_time.lang or\n            time.tzname != locale_time.tzname or\n            time.daylight != locale_time.daylight):\n            _TimeRE_cache = TimeRE()\n            _regex_cache.clear()\n            locale_time = _TimeRE_cache.locale_time\n        if len(_regex_cache) > _CACHE_MAX_SIZE:\n            _regex_cache.clear()\n        format_regex = _regex_cache.get(format)\n        if not format_regex:\n            try:\n                format_regex = _TimeRE_cache.compile(format)\n            # KeyError raised when a bad format is found; can be specified as\n            # \\\\, in which case it was a stray % but with a space after it\n            except KeyError as err:\n                bad_directive = err.args[0]\n                if bad_directive == \"\\\\\":\n                    bad_directive = \"%\"\n                del err\n                raise ValueError(\"'%s' is a bad directive in format '%s'\" %\n                                    (bad_directive, format)) from None\n            # IndexError only occurs when the format string is \"%\"\n            except IndexError:\n                raise ValueError(\"stray %% in format '%s'\" % format) from None\n            _regex_cache[format] = format_regex\n    found = format_regex.match(data_string)\n    if not found:\n        raise ValueError(\"time data %r does not match format %r\" %\n                         (data_string, format))\n    if len(data_string) != found.end():\n        raise ValueError(\"unconverted data remains: %s\" %\n                          data_string[found.end():])\n\n    year = None\n    month = day = 1\n    hour = minute = second = fraction = 0\n    tz = -1\n    tzoffset = None\n    # Default to -1 to signify that values not known; not critical to have,\n    # though\n    week_of_year = -1\n    week_of_year_start = -1\n    # weekday and julian defaulted to None so as to signal need to calculate\n    # values\n    weekday = julian = None\n    found_dict = found.groupdict()\n    for group_key in found_dict.keys():\n        # Directives not explicitly handled below:\n        #   c, x, X\n        #      handled by making out of other directives\n        #   U, W\n        #      worthless without day of the week\n        if group_key == 'y':\n            year = int(found_dict['y'])\n            # Open Group specification for strptime() states that a %y\n            #value in the range of [00, 68] is in the century 2000, while\n            #[69,99] is in the century 1900\n            if year <= 68:\n                year += 2000\n            else:\n                year += 1900\n        elif group_key == 'Y':\n            year = int(found_dict['Y'])\n        elif group_key == 'm':\n            month = int(found_dict['m'])\n        elif group_key == 'B':\n            month = locale_time.f_month.index(found_dict['B'].lower())\n        elif group_key == 'b':\n            month = locale_time.a_month.index(found_dict['b'].lower())\n        elif group_key == 'd':\n            day = int(found_dict['d'])\n        elif group_key == 'H':\n            hour = int(found_dict['H'])\n        elif group_key == 'I':\n            hour = int(found_dict['I'])\n            ampm = found_dict.get('p', '').lower()\n            # If there was no AM/PM indicator, we'll treat this like AM\n            if ampm in ('', locale_time.am_pm[0]):\n                # We're in AM so the hour is correct unless we're\n                # looking at 12 midnight.\n                # 12 midnight == 12 AM == hour 0\n                if hour == 12:\n                    hour = 0\n            elif ampm == locale_time.am_pm[1]:\n                # We're in PM so we need to add 12 to the hour unless\n                # we're looking at 12 noon.\n                # 12 noon == 12 PM == hour 12\n                if hour != 12:\n                    hour += 12\n        elif group_key == 'M':\n            minute = int(found_dict['M'])\n        elif group_key == 'S':\n            second = int(found_dict['S'])\n        elif group_key == 'f':\n            s = found_dict['f']\n            # Pad to always return microseconds.\n            s += \"0\" * (6 - len(s))\n            fraction = int(s)\n        elif group_key == 'A':\n            weekday = locale_time.f_weekday.index(found_dict['A'].lower())\n        elif group_key == 'a':\n            weekday = locale_time.a_weekday.index(found_dict['a'].lower())\n        elif group_key == 'w':\n            weekday = int(found_dict['w'])\n            if weekday == 0:\n                weekday = 6\n            else:\n                weekday -= 1\n        elif group_key == 'j':\n            julian = int(found_dict['j'])\n        elif group_key in ('U', 'W'):\n            week_of_year = int(found_dict[group_key])\n            if group_key == 'U':\n                # U starts week on Sunday.\n                week_of_year_start = 6\n            else:\n                # W starts week on Monday.\n                week_of_year_start = 0\n        elif group_key == 'z':\n            z = found_dict['z']\n            tzoffset = int(z[1:3]) * 60 + int(z[3:5])\n            if z.startswith(\"-\"):\n                tzoffset = -tzoffset\n        elif group_key == 'Z':\n            # Since -1 is default value only need to worry about setting tz if\n            # it can be something other than -1.\n            found_zone = found_dict['Z'].lower()\n            for value, tz_values in enumerate(locale_time.timezone):\n                if found_zone in tz_values:\n                    # Deal with bad locale setup where timezone names are the\n                    # same and yet time.daylight is true; too ambiguous to\n                    # be able to tell what timezone has daylight savings\n                    if (time.tzname[0] == time.tzname[1] and\n                       time.daylight and found_zone not in (\"utc\", \"gmt\")):\n                        break\n                    else:\n                        tz = value\n                        break\n    leap_year_fix = False\n    if year is None and month == 2 and day == 29:\n        year = 1904  # 1904 is first leap year of 20th century\n        leap_year_fix = True\n    elif year is None:\n        year = 1900\n    # If we know the week of the year and what day of that week, we can figure\n    # out the Julian day of the year.\n    if julian is None and week_of_year != -1 and weekday is not None:\n        week_starts_Mon = True if week_of_year_start == 0 else False\n        julian = _calc_julian_from_U_or_W(year, week_of_year, weekday,\n                                            week_starts_Mon)\n        if julian <= 0:\n            year -= 1\n            yday = 366 if calendar.isleap(year) else 365\n            julian += yday\n    # Cannot pre-calculate datetime_date() since can change in Julian\n    # calculation and thus could have different value for the day of the week\n    # calculation.\n    if julian is None:\n        # Need to add 1 to result since first day of the year is 1, not 0.\n        julian = datetime_date(year, month, day).toordinal() - \\\n                  datetime_date(year, 1, 1).toordinal() + 1\n    else:  # Assume that if they bothered to include Julian day it will\n           # be accurate.\n        datetime_result = datetime_date.fromordinal((julian - 1) + datetime_date(year, 1, 1).toordinal())\n        year = datetime_result.year\n        month = datetime_result.month\n        day = datetime_result.day\n    if weekday is None:\n        weekday = datetime_date(year, month, day).weekday()\n    # Add timezone info\n    tzname = found_dict.get(\"Z\")\n    if tzoffset is not None:\n        gmtoff = tzoffset * 60\n    else:\n        gmtoff = None\n\n    if leap_year_fix:\n        # the caller didn't supply a year but asked for Feb 29th. We couldn't\n        # use the default of 1900 for computations. We set it back to ensure\n        # that February 29th is smaller than March 1st.\n        year = 1900\n\n    return (year, month, day,\n            hour, minute, second,\n            weekday, julian, tz, tzname, gmtoff), fraction"},{"col":4,"comment":"\n        For a **celestial** WCS (see `astropy.wcs.WCS.celestial`), returns pixel\n        area of the image pixel at the ``CRPIX`` location once it is projected\n        onto the \"plane of intermediate world coordinates\" as defined in\n        `Greisen & Calabretta 2002, A&A, 395, 1061 <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1061G>`_.\n\n        .. note::\n            This function is concerned **only** about the transformation\n            \"image plane\"->\"projection plane\" and **not** about the\n            transformation \"celestial sphere\"->\"projection plane\"->\"image plane\".\n            Therefore, this function ignores distortions arising due to\n            non-linear nature of most projections.\n\n        .. note::\n            This method only returns sensible answers if the WCS contains\n            celestial axes, i.e., the `~astropy.wcs.WCS.celestial` WCS object.\n\n        Returns\n        -------\n        area : `~astropy.units.Quantity`\n            Area (in the projection plane) of the pixel at ``CRPIX`` location.\n\n        Raises\n        ------\n        ValueError\n            Pixel area is defined only for 2D pixels. Most likely the\n            `~astropy.wcs.Wcsprm.cd` matrix of the `~astropy.wcs.WCS.celestial`\n            WCS is not a square matrix of second order.\n\n        Notes\n        -----\n\n        Depending on the application, square root of the pixel area can be used to\n        represent a single pixel scale of an equivalent square pixel\n        whose area is equal to the area of a generally non-square pixel.\n\n        See Also\n        --------\n        astropy.wcs.utils.proj_plane_pixel_area\n\n        ","endLoc":2541,"header":"def proj_plane_pixel_area(self)","id":2997,"name":"proj_plane_pixel_area","nodeType":"Function","startLoc":2496,"text":"def proj_plane_pixel_area(self):\n        \"\"\"\n        For a **celestial** WCS (see `astropy.wcs.WCS.celestial`), returns pixel\n        area of the image pixel at the ``CRPIX`` location once it is projected\n        onto the \"plane of intermediate world coordinates\" as defined in\n        `Greisen & Calabretta 2002, A&A, 395, 1061 <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1061G>`_.\n\n        .. note::\n            This function is concerned **only** about the transformation\n            \"image plane\"->\"projection plane\" and **not** about the\n            transformation \"celestial sphere\"->\"projection plane\"->\"image plane\".\n            Therefore, this function ignores distortions arising due to\n            non-linear nature of most projections.\n\n        .. note::\n            This method only returns sensible answers if the WCS contains\n            celestial axes, i.e., the `~astropy.wcs.WCS.celestial` WCS object.\n\n        Returns\n        -------\n        area : `~astropy.units.Quantity`\n            Area (in the projection plane) of the pixel at ``CRPIX`` location.\n\n        Raises\n        ------\n        ValueError\n            Pixel area is defined only for 2D pixels. Most likely the\n            `~astropy.wcs.Wcsprm.cd` matrix of the `~astropy.wcs.WCS.celestial`\n            WCS is not a square matrix of second order.\n\n        Notes\n        -----\n\n        Depending on the application, square root of the pixel area can be used to\n        represent a single pixel scale of an equivalent square pixel\n        whose area is equal to the area of a generally non-square pixel.\n\n        See Also\n        --------\n        astropy.wcs.utils.proj_plane_pixel_area\n\n        \"\"\"  # noqa: E501\n        from astropy.wcs.utils import proj_plane_pixel_area  # Avoid circular import\n        value = proj_plane_pixel_area(self)\n        unit = u.Unit(self.wcs.cunit[0]) * u.Unit(self.wcs.cunit[1])  # 2D only\n        return value * unit"},{"col":0,"comment":"null","endLoc":101,"header":"def _time_constructor(loader, node)","id":2998,"name":"_time_constructor","nodeType":"Function","startLoc":98,"text":"def _time_constructor(loader, node):\n    map = loader.construct_mapping(node)\n    out = Time.info._construct_from_dict(map)\n    return out"},{"col":0,"comment":"\n    For a **celestial** WCS (see `astropy.wcs.WCS.celestial`) returns pixel\n    area of the image pixel at the ``CRPIX`` location once it is projected\n    onto the \"plane of intermediate world coordinates\" as defined in\n    `Greisen & Calabretta 2002, A&A, 395, 1061 <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1061G>`_.\n\n    .. note::\n        This function is concerned **only** about the transformation\n        \"image plane\"->\"projection plane\" and **not** about the\n        transformation \"celestial sphere\"->\"projection plane\"->\"image plane\".\n        Therefore, this function ignores distortions arising due to\n        non-linear nature of most projections.\n\n    .. note::\n        In order to compute the area of pixels corresponding to celestial\n        axes only, this function uses the `~astropy.wcs.WCS.celestial` WCS\n        object of the input ``wcs``.  This is different from the\n        `~astropy.wcs.utils.proj_plane_pixel_scales` function\n        that computes the scales for the axes of the input WCS itself.\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.WCS`\n        A world coordinate system object.\n\n    Returns\n    -------\n    area : float\n        Area (in the projection plane) of the pixel at ``CRPIX`` location.\n        The units of the returned result are the same as the units of\n        the `~astropy.wcs.Wcsprm.cdelt`, `~astropy.wcs.Wcsprm.crval`,\n        and `~astropy.wcs.Wcsprm.cd` for the celestial WCS and can be\n        obtained by inquiring the value of `~astropy.wcs.Wcsprm.cunit`\n        property of the `~astropy.wcs.WCS.celestial` WCS object.\n\n    Raises\n    ------\n    ValueError\n        Pixel area is defined only for 2D pixels. Most likely the\n        `~astropy.wcs.Wcsprm.cd` matrix of the `~astropy.wcs.WCS.celestial`\n        WCS is not a square matrix of second order.\n\n    Notes\n    -----\n\n    Depending on the application, square root of the pixel area can be used to\n    represent a single pixel scale of an equivalent square pixel\n    whose area is equal to the area of a generally non-square pixel.\n\n    See Also\n    --------\n    astropy.wcs.utils.proj_plane_pixel_scales\n\n    ","endLoc":396,"header":"def proj_plane_pixel_area(wcs)","id":2999,"name":"proj_plane_pixel_area","nodeType":"Function","startLoc":338,"text":"def proj_plane_pixel_area(wcs):\n    \"\"\"\n    For a **celestial** WCS (see `astropy.wcs.WCS.celestial`) returns pixel\n    area of the image pixel at the ``CRPIX`` location once it is projected\n    onto the \"plane of intermediate world coordinates\" as defined in\n    `Greisen & Calabretta 2002, A&A, 395, 1061 <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1061G>`_.\n\n    .. note::\n        This function is concerned **only** about the transformation\n        \"image plane\"->\"projection plane\" and **not** about the\n        transformation \"celestial sphere\"->\"projection plane\"->\"image plane\".\n        Therefore, this function ignores distortions arising due to\n        non-linear nature of most projections.\n\n    .. note::\n        In order to compute the area of pixels corresponding to celestial\n        axes only, this function uses the `~astropy.wcs.WCS.celestial` WCS\n        object of the input ``wcs``.  This is different from the\n        `~astropy.wcs.utils.proj_plane_pixel_scales` function\n        that computes the scales for the axes of the input WCS itself.\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.WCS`\n        A world coordinate system object.\n\n    Returns\n    -------\n    area : float\n        Area (in the projection plane) of the pixel at ``CRPIX`` location.\n        The units of the returned result are the same as the units of\n        the `~astropy.wcs.Wcsprm.cdelt`, `~astropy.wcs.Wcsprm.crval`,\n        and `~astropy.wcs.Wcsprm.cd` for the celestial WCS and can be\n        obtained by inquiring the value of `~astropy.wcs.Wcsprm.cunit`\n        property of the `~astropy.wcs.WCS.celestial` WCS object.\n\n    Raises\n    ------\n    ValueError\n        Pixel area is defined only for 2D pixels. Most likely the\n        `~astropy.wcs.Wcsprm.cd` matrix of the `~astropy.wcs.WCS.celestial`\n        WCS is not a square matrix of second order.\n\n    Notes\n    -----\n\n    Depending on the application, square root of the pixel area can be used to\n    represent a single pixel scale of an equivalent square pixel\n    whose area is equal to the area of a generally non-square pixel.\n\n    See Also\n    --------\n    astropy.wcs.utils.proj_plane_pixel_scales\n\n    \"\"\"\n    psm = wcs.celestial.pixel_scale_matrix\n    if psm.shape != (2, 2):\n        raise ValueError(\"Pixel area is defined only for 2D pixels.\")\n    return np.abs(np.linalg.det(psm))"},{"col":4,"comment":"null","endLoc":2412,"header":"def __add__(self, other)","id":3000,"name":"__add__","nodeType":"Function","startLoc":2407,"text":"def __add__(self, other):\n        # If other is a Time then use Time.__add__ to do the calculation.\n        if isinstance(other, Time):\n            return other.__add__(self)\n\n        return self._add_sub(other, operator.add)"},{"col":0,"comment":"null","endLoc":106,"header":"def _timedelta_representer(dumper, obj)","id":3001,"name":"_timedelta_representer","nodeType":"Function","startLoc":104,"text":"def _timedelta_representer(dumper, obj):\n    out = obj.info._represent_as_dict()\n    return dumper.represent_mapping('!astropy.time.TimeDelta', out)"},{"col":4,"comment":"null","endLoc":2419,"header":"def __sub__(self, other)","id":3002,"name":"__sub__","nodeType":"Function","startLoc":2414,"text":"def __sub__(self, other):\n        # TimeDelta - Time is an error\n        if isinstance(other, Time):\n            raise OperandTypeError(self, other, '-')\n\n        return self._add_sub(other, operator.sub)"},{"col":4,"comment":"\n        Generate an `~astropy.io.fits.HDUList` object with all of the\n        information stored in this object.  This should be logically identical\n        to the input FITS file, but it will be normalized in a number of ways.\n\n        See `to_header` for some warnings about the output produced.\n\n        Parameters\n        ----------\n\n        relax : bool or int, optional\n            Degree of permissiveness:\n\n            - `False` (default): Write all extensions that are\n              considered to be safe and recommended.\n\n            - `True`: Write all recognized informal extensions of the\n              WCS standard.\n\n            - `int`: a bit field selecting specific extensions to\n              write.  See :ref:`astropy:relaxwrite` for details.\n\n        key : str\n            The name of a particular WCS transform to use.  This may be\n            either ``' '`` or ``'A'``-``'Z'`` and corresponds to the ``\"a\"``\n            part of the ``CTYPEia`` cards.\n\n        Returns\n        -------\n        hdulist : `~astropy.io.fits.HDUList`\n        ","endLoc":2584,"header":"def to_fits(self, relax=False, key=None)","id":3003,"name":"to_fits","nodeType":"Function","startLoc":2543,"text":"def to_fits(self, relax=False, key=None):\n        \"\"\"\n        Generate an `~astropy.io.fits.HDUList` object with all of the\n        information stored in this object.  This should be logically identical\n        to the input FITS file, but it will be normalized in a number of ways.\n\n        See `to_header` for some warnings about the output produced.\n\n        Parameters\n        ----------\n\n        relax : bool or int, optional\n            Degree of permissiveness:\n\n            - `False` (default): Write all extensions that are\n              considered to be safe and recommended.\n\n            - `True`: Write all recognized informal extensions of the\n              WCS standard.\n\n            - `int`: a bit field selecting specific extensions to\n              write.  See :ref:`astropy:relaxwrite` for details.\n\n        key : str\n            The name of a particular WCS transform to use.  This may be\n            either ``' '`` or ``'A'``-``'Z'`` and corresponds to the ``\"a\"``\n            part of the ``CTYPEia`` cards.\n\n        Returns\n        -------\n        hdulist : `~astropy.io.fits.HDUList`\n        \"\"\"\n\n        header = self.to_header(relax=relax, key=key)\n\n        hdu = fits.PrimaryHDU(header=header)\n        hdulist = fits.HDUList(hdu)\n\n        self._write_det2im(hdulist)\n        self._write_distortion_kw(hdulist)\n\n        return hdulist"},{"col":4,"comment":"null","endLoc":2778,"header":"def __init__(self, left, right, op=None)","id":3004,"name":"__init__","nodeType":"Function","startLoc":2772,"text":"def __init__(self, left, right, op=None):\n        op_string = '' if op is None else f' for {op}'\n        super().__init__(\n            \"Unsupported operand type(s){}: \"\n            \"'{}' and '{}'\".format(op_string,\n                                   left.__class__.__name__,\n                                   right.__class__.__name__))"},{"col":0,"comment":"\n    Get a header dict from input ``lines`` which should be valid YAML.  This\n    input will typically be created by get_yaml_from_header.  The output is a\n    dictionary which describes all the table and column meta.\n\n    The get_cols() method in the io/ascii/ecsv.py file should be used as a\n    guide to using the information when constructing a table using this\n    header dict information.\n\n    Parameters\n    ----------\n    lines : list\n        List of text lines with YAML header content\n\n    Returns\n    -------\n    header : dict\n        Dictionary describing table and column meta\n\n    ","endLoc":423,"header":"def get_header_from_yaml(lines)","id":3005,"name":"get_header_from_yaml","nodeType":"Function","startLoc":385,"text":"def get_header_from_yaml(lines):\n    \"\"\"\n    Get a header dict from input ``lines`` which should be valid YAML.  This\n    input will typically be created by get_yaml_from_header.  The output is a\n    dictionary which describes all the table and column meta.\n\n    The get_cols() method in the io/ascii/ecsv.py file should be used as a\n    guide to using the information when constructing a table using this\n    header dict information.\n\n    Parameters\n    ----------\n    lines : list\n        List of text lines with YAML header content\n\n    Returns\n    -------\n    header : dict\n        Dictionary describing table and column meta\n\n    \"\"\"\n    from astropy.io.misc.yaml import AstropyLoader\n\n    class TableLoader(AstropyLoader):\n        \"\"\"\n        Custom Loader that constructs OrderedDict from an !!omap object.\n        This does nothing but provide a namespace for adding the\n        custom odict constructor.\n        \"\"\"\n\n    TableLoader.add_constructor('tag:yaml.org,2002:omap', _construct_odict)\n    # Now actually load the YAML data structure into `meta`\n    header_yaml = textwrap.dedent('\\n'.join(lines))\n    try:\n        header = yaml.load(header_yaml, Loader=TableLoader)\n    except Exception as err:\n        raise YamlParseError() from err\n\n    return header"},{"col":0,"comment":"null","endLoc":112,"header":"def _timedelta_constructor(loader, node)","id":3006,"name":"_timedelta_constructor","nodeType":"Function","startLoc":109,"text":"def _timedelta_constructor(loader, node):\n    map = loader.construct_mapping(node)\n    out = TimeDelta.info._construct_from_dict(map)\n    return out"},{"col":4,"comment":"null","endLoc":2422,"header":"def __radd__(self, other)","id":3007,"name":"__radd__","nodeType":"Function","startLoc":2421,"text":"def __radd__(self, other):\n        return self.__add__(other)"},{"col":4,"comment":"null","endLoc":2426,"header":"def __rsub__(self, other)","id":3008,"name":"__rsub__","nodeType":"Function","startLoc":2424,"text":"def __rsub__(self, other):\n        out = self.__sub__(other)\n        return -out"},{"col":4,"comment":"Negation of a `TimeDelta` object.","endLoc":2433,"header":"def __neg__(self)","id":3009,"name":"__neg__","nodeType":"Function","startLoc":2428,"text":"def __neg__(self):\n        \"\"\"Negation of a `TimeDelta` object.\"\"\"\n        new = self.copy()\n        new._time.jd1 = -self._time.jd1\n        new._time.jd2 = -self._time.jd2\n        return new"},{"col":4,"comment":"Absolute value of a `TimeDelta` object.","endLoc":2442,"header":"def __abs__(self)","id":3010,"name":"__abs__","nodeType":"Function","startLoc":2435,"text":"def __abs__(self):\n        \"\"\"Absolute value of a `TimeDelta` object.\"\"\"\n        jd1, jd2 = self._time.jd1, self._time.jd2\n        negative = jd1 + jd2 < 0\n        new = self.copy()\n        new._time.jd1 = np.where(negative, -jd1, jd1)\n        new._time.jd2 = np.where(negative, -jd2, jd2)\n        return new"},{"col":0,"comment":"null","endLoc":132,"header":"def _ndarray_representer(dumper, obj)","id":3011,"name":"_ndarray_representer","nodeType":"Function","startLoc":115,"text":"def _ndarray_representer(dumper, obj):\n    if not (obj.flags['C_CONTIGUOUS'] or obj.flags['F_CONTIGUOUS']):\n        obj = np.ascontiguousarray(obj)\n\n    if np.isfortran(obj):\n        obj = obj.T\n        order = 'F'\n    else:\n        order = 'C'\n\n    data_b64 = base64.b64encode(obj.tobytes())\n\n    out = dict(buffer=data_b64,\n               dtype=str(obj.dtype) if not obj.dtype.fields else obj.dtype.descr,\n               shape=obj.shape,\n               order=order)\n\n    return dumper.represent_mapping('!numpy.ndarray', out)"},{"col":4,"comment":"Multiplication of `TimeDelta` objects by numbers/arrays.","endLoc":2474,"header":"def __mul__(self, other)","id":3012,"name":"__mul__","nodeType":"Function","startLoc":2444,"text":"def __mul__(self, other):\n        \"\"\"Multiplication of `TimeDelta` objects by numbers/arrays.\"\"\"\n        # Check needed since otherwise the self.jd1 * other multiplication\n        # would enter here again (via __rmul__)\n        if isinstance(other, Time):\n            raise OperandTypeError(self, other, '*')\n        elif ((isinstance(other, u.UnitBase)\n               and other == u.dimensionless_unscaled)\n                or (isinstance(other, str) and other == '')):\n            return self.copy()\n\n        # If other is something consistent with a dimensionless quantity\n        # (could just be a float or an array), then we can just multiple in.\n        try:\n            other = u.Quantity(other, u.dimensionless_unscaled, copy=False)\n        except Exception:\n            # If not consistent with a dimensionless quantity, try downgrading\n            # self to a quantity and see if things work.\n            try:\n                return self.to(u.day) * other\n            except Exception:\n                # The various ways we could multiply all failed;\n                # returning NotImplemented to give other a final chance.\n                return NotImplemented\n\n        jd1, jd2 = day_frac(self.jd1, self.jd2, factor=other.value)\n        out = TimeDelta(jd1, jd2, format='jd', scale=self.scale)\n\n        if self.format != 'jd':\n            out = out.replicate(format=self.format)\n        return out"},{"col":0,"comment":"null","endLoc":142,"header":"def _ndarray_constructor(loader, node)","id":3013,"name":"_ndarray_constructor","nodeType":"Function","startLoc":135,"text":"def _ndarray_constructor(loader, node):\n    # Convert mapping to a dict useful for initializing ndarray.\n    # Need deep=True since for structured dtype, the contents\n    # include lists and tuples, which need recursion via\n    # construct_sequence.\n    map = loader.construct_mapping(node, deep=True)\n    map['buffer'] = base64.b64decode(map['buffer'])\n    return np.ndarray(**map)"},{"col":4,"comment":"\n        Identical to `to_header`, but returns a string containing the\n        header cards.\n        ","endLoc":2795,"header":"def to_header_string(self, relax=None)","id":3014,"name":"to_header_string","nodeType":"Function","startLoc":2790,"text":"def to_header_string(self, relax=None):\n        \"\"\"\n        Identical to `to_header`, but returns a string containing the\n        header cards.\n        \"\"\"\n        return str(self.to_header(relax))"},{"col":4,"comment":"\n        Writes out a `ds9`_ style regions file. It can be loaded\n        directly by `ds9`_.\n\n        Parameters\n        ----------\n        filename : str, optional\n            Output file name - default is ``'footprint.reg'``\n\n        color : str, optional\n            Color to use when plotting the line.\n\n        width : int, optional\n            Width of the region line.\n\n        coordsys : str, optional\n            Coordinate system. If not specified (default), the ``radesys``\n            value is used. For all possible values, see\n            http://ds9.si.edu/doc/ref/region.html#RegionFileFormat\n\n        ","endLoc":2841,"header":"def footprint_to_file(self, filename='footprint.reg', color='green',\n                          width=2, coordsys=None)","id":3015,"name":"footprint_to_file","nodeType":"Function","startLoc":2797,"text":"def footprint_to_file(self, filename='footprint.reg', color='green',\n                          width=2, coordsys=None):\n        \"\"\"\n        Writes out a `ds9`_ style regions file. It can be loaded\n        directly by `ds9`_.\n\n        Parameters\n        ----------\n        filename : str, optional\n            Output file name - default is ``'footprint.reg'``\n\n        color : str, optional\n            Color to use when plotting the line.\n\n        width : int, optional\n            Width of the region line.\n\n        coordsys : str, optional\n            Coordinate system. If not specified (default), the ``radesys``\n            value is used. For all possible values, see\n            http://ds9.si.edu/doc/ref/region.html#RegionFileFormat\n\n        \"\"\"\n        comments = ('# Region file format: DS9 version 4.0 \\n'\n                    '# global color=green font=\"helvetica 12 bold '\n                    'select=1 highlite=1 edit=1 move=1 delete=1 '\n                    'include=1 fixed=0 source\\n')\n\n        coordsys = coordsys or self.wcs.radesys\n\n        if coordsys not in ('PHYSICAL', 'IMAGE', 'FK4', 'B1950', 'FK5',\n                            'J2000', 'GALACTIC', 'ECLIPTIC', 'ICRS', 'LINEAR',\n                            'AMPLIFIER', 'DETECTOR'):\n            raise ValueError(\"Coordinate system '{}' is not supported. A valid\"\n                             \" one can be given with the 'coordsys' argument.\"\n                             .format(coordsys))\n\n        with open(filename, mode='w') as f:\n            f.write(comments)\n            f.write(f'{coordsys}\\n')\n            f.write('polygon(')\n            ftpr = self.calc_footprint()\n            if ftpr is not None:\n                ftpr.tofile(f, sep=',')\n                f.write(f') # color={color}, width={width:d} \\n')"},{"col":0,"comment":"Recursively find the names in a serialized column dictionary.\n\n    Parameters\n    ----------\n    _dict : `dict`\n        Dictionary from astropy __serialized_columns__\n\n    Returns\n    -------\n    all_names : `list` [`str`]\n        All the column names mentioned in _dict and sub-dicts.\n    ","endLoc":338,"header":"def _get_names(_dict)","id":3016,"name":"_get_names","nodeType":"Function","startLoc":319,"text":"def _get_names(_dict):\n    \"\"\"Recursively find the names in a serialized column dictionary.\n\n    Parameters\n    ----------\n    _dict : `dict`\n        Dictionary from astropy __serialized_columns__\n\n    Returns\n    -------\n    all_names : `list` [`str`]\n        All the column names mentioned in _dict and sub-dicts.\n    \"\"\"\n    all_names = []\n    for k, v in _dict.items():\n        if isinstance(v, dict):\n            all_names.extend(_get_names(v))\n        elif k == 'name':\n            all_names.append(v)\n    return all_names"},{"col":0,"comment":"null","endLoc":149,"header":"def _void_representer(dumper, obj)","id":3017,"name":"_void_representer","nodeType":"Function","startLoc":145,"text":"def _void_representer(dumper, obj):\n    data_b64 = base64.b64encode(obj.tobytes())\n    out = dict(buffer=data_b64,\n               dtype=str(obj.dtype) if not obj.dtype.fields else obj.dtype.descr)\n    return dumper.represent_mapping('!numpy.void', out)"},{"col":0,"comment":"\n    From a list of input objects ``objs`` get merged output object class.\n\n    This is just taken as the deepest subclass. This doesn't handle complicated\n    inheritance schemes, but as a special case, classes which share ``info``\n    are taken to be compatible.\n    ","endLoc":91,"header":"def _get_out_class(objs)","id":3018,"name":"_get_out_class","nodeType":"Function","startLoc":73,"text":"def _get_out_class(objs):\n    \"\"\"\n    From a list of input objects ``objs`` get merged output object class.\n\n    This is just taken as the deepest subclass. This doesn't handle complicated\n    inheritance schemes, but as a special case, classes which share ``info``\n    are taken to be compatible.\n    \"\"\"\n    out_class = objs[0].__class__\n    for obj in objs[1:]:\n        if issubclass(obj.__class__, out_class):\n            out_class = obj.__class__\n\n    if any(not (issubclass(out_class, obj.__class__)\n                or out_class.info is obj.__class__.info) for obj in objs):\n        raise ValueError('unmergeable object classes {}'\n                         .format([obj.__class__.__name__ for obj in objs]))\n\n    return out_class"},{"col":4,"comment":"\n        Convert to a quantity in the specified unit.\n\n        Parameters\n        ----------\n        unit : unit-like\n            The unit to convert to.\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not directly\n            convertible (see :ref:`astropy:unit_equivalencies`). If `None`, no\n            equivalencies will be applied at all, not even any set globallyq\n            or within a context.\n\n        Returns\n        -------\n        quantity : `~astropy.units.Quantity`\n            The quantity in the units specified.\n\n        See also\n        --------\n        to_value : get the numerical value in a given unit.\n        ","endLoc":2539,"header":"def to(self, unit, equivalencies=[])","id":3019,"name":"to","nodeType":"Function","startLoc":2515,"text":"def to(self, unit, equivalencies=[]):\n        \"\"\"\n        Convert to a quantity in the specified unit.\n\n        Parameters\n        ----------\n        unit : unit-like\n            The unit to convert to.\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not directly\n            convertible (see :ref:`astropy:unit_equivalencies`). If `None`, no\n            equivalencies will be applied at all, not even any set globallyq\n            or within a context.\n\n        Returns\n        -------\n        quantity : `~astropy.units.Quantity`\n            The quantity in the units specified.\n\n        See also\n        --------\n        to_value : get the numerical value in a given unit.\n        \"\"\"\n        return u.Quantity(self._time.jd1 + self._time.jd2,\n                          u.day).to(unit, equivalencies=equivalencies)"},{"col":0,"comment":"null","endLoc":39,"header":"def _getlang()","id":3020,"name":"_getlang","nodeType":"Function","startLoc":37,"text":"def _getlang():\n    # Figure out what the current language is set to.\n    return locale.getlocale(locale.LC_TIME)"},{"col":0,"comment":"null","endLoc":156,"header":"def _void_constructor(loader, node)","id":3021,"name":"_void_constructor","nodeType":"Function","startLoc":152,"text":"def _void_constructor(loader, node):\n    # Interpret as node as an array scalar and then index to change to void.\n    map = loader.construct_mapping(node, deep=True)\n    map['buffer'] = base64.b64decode(map['buffer'])\n    return np.ndarray(shape=(), **map)[()]"},{"col":0,"comment":"null","endLoc":163,"header":"def _quantity_representer(tag)","id":3022,"name":"_quantity_representer","nodeType":"Function","startLoc":159,"text":"def _quantity_representer(tag):\n    def representer(dumper, obj):\n        out = obj.info._represent_as_dict()\n        return dumper.represent_mapping(tag, out)\n    return representer"},{"col":4,"comment":"null","endLoc":2859,"header":"def printwcs(self)","id":3023,"name":"printwcs","nodeType":"Function","startLoc":2858,"text":"def printwcs(self):\n        print(repr(self))"},{"col":4,"comment":"Multiplication of numbers/arrays with `TimeDelta` objects.","endLoc":2478,"header":"def __rmul__(self, other)","id":3024,"name":"__rmul__","nodeType":"Function","startLoc":2476,"text":"def __rmul__(self, other):\n        \"\"\"Multiplication of numbers/arrays with `TimeDelta` objects.\"\"\"\n        return self.__mul__(other)"},{"col":0,"comment":"null","endLoc":170,"header":"def _quantity_constructor(cls)","id":3025,"name":"_quantity_constructor","nodeType":"Function","startLoc":166,"text":"def _quantity_constructor(cls):\n    def constructor(loader, node):\n        map = loader.construct_mapping(node)\n        return cls.info._construct_from_dict(map)\n    return constructor"},{"col":4,"comment":"\n        Return a short description. Simply porting the behavior from\n        the `printwcs()` method.\n        ","endLoc":2893,"header":"def __repr__(self)","id":3026,"name":"__repr__","nodeType":"Function","startLoc":2861,"text":"def __repr__(self):\n        '''\n        Return a short description. Simply porting the behavior from\n        the `printwcs()` method.\n        '''\n        description = [\"WCS Keywords\\n\",\n                       f\"Number of WCS axes: {self.naxis!r}\"]\n        sfmt = ' : ' + \"\".join([\"{\"+f\"{i}\"+\"!r}  \" for i in range(self.naxis)])\n\n        keywords = ['CTYPE', 'CRVAL', 'CRPIX']\n        values = [self.wcs.ctype, self.wcs.crval, self.wcs.crpix]\n        for keyword, value in zip(keywords, values):\n            description.append(keyword+sfmt.format(*value))\n\n        if hasattr(self.wcs, 'pc'):\n            for i in range(self.naxis):\n                s = ''\n                for j in range(self.naxis):\n                    s += ''.join(['PC', str(i+1), '_', str(j+1), ' '])\n                s += sfmt\n                description.append(s.format(*self.wcs.pc[i]))\n            s = 'CDELT' + sfmt\n            description.append(s.format(*self.wcs.cdelt))\n        elif hasattr(self.wcs, 'cd'):\n            for i in range(self.naxis):\n                s = ''\n                for j in range(self.naxis):\n                    s += \"\".join(['CD', str(i+1), '_', str(j+1), ' '])\n                s += sfmt\n                description.append(s.format(*self.wcs.cd[i]))\n\n        description.append(f\"NAXIS : {'  '.join(map(str, self._naxis))}\")\n        return '\\n'.join(description)"},{"col":4,"comment":"Division of `TimeDelta` objects by numbers/arrays.","endLoc":2507,"header":"def __truediv__(self, other)","id":3027,"name":"__truediv__","nodeType":"Function","startLoc":2480,"text":"def __truediv__(self, other):\n        \"\"\"Division of `TimeDelta` objects by numbers/arrays.\"\"\"\n        # Cannot do __mul__(1./other) as that looses precision\n        if ((isinstance(other, u.UnitBase)\n             and other == u.dimensionless_unscaled)\n                or (isinstance(other, str) and other == '')):\n            return self.copy()\n\n        # If other is something consistent with a dimensionless quantity\n        # (could just be a float or an array), then we can just divide in.\n        try:\n            other = u.Quantity(other, u.dimensionless_unscaled, copy=False)\n        except Exception:\n            # If not consistent with a dimensionless quantity, try downgrading\n            # self to a quantity and see if things work.\n            try:\n                return self.to(u.day) / other\n            except Exception:\n                # The various ways we could divide all failed;\n                # returning NotImplemented to give other a final chance.\n                return NotImplemented\n\n        jd1, jd2 = day_frac(self.jd1, self.jd2, divisor=other.value)\n        out = TimeDelta(jd1, jd2, format='jd', scale=self.scale)\n\n        if self.format != 'jd':\n            out = out.replicate(format=self.format)\n        return out"},{"col":0,"comment":"null","endLoc":177,"header":"def _skycoord_representer(dumper, obj)","id":3028,"name":"_skycoord_representer","nodeType":"Function","startLoc":173,"text":"def _skycoord_representer(dumper, obj):\n    map = obj.info._represent_as_dict()\n    out = dumper.represent_mapping('!astropy.coordinates.sky_coordinate.SkyCoord',\n                                   map)\n    return out"},{"col":4,"comment":"Create keys/values.\n\n        Order of execution is important for dependency reasons.\n\n        ","endLoc":234,"header":"def __init__(self, locale_time=None)","id":3029,"name":"__init__","nodeType":"Function","startLoc":193,"text":"def __init__(self, locale_time=None):\n        \"\"\"Create keys/values.\n\n        Order of execution is important for dependency reasons.\n\n        \"\"\"\n        if locale_time:\n            self.locale_time = locale_time\n        else:\n            self.locale_time = LocaleTime()\n        base = super()\n        base.__init__({\n            # The \" \\d\" part of the regex is to make %c from ANSI C work\n            'd': r\"(?P<d>3[0-1]|[1-2]\\d|0[1-9]|[1-9]| [1-9])\",\n            'f': r\"(?P<f>[0-9]{1,6})\",\n            'H': r\"(?P<H>2[0-3]|[0-1]\\d|\\d)\",\n            'I': r\"(?P<I>1[0-2]|0[1-9]|[1-9])\",\n            'j': r\"(?P<j>36[0-6]|3[0-5]\\d|[1-2]\\d\\d|0[1-9]\\d|00[1-9]|[1-9]\\d|0[1-9]|[1-9])\",\n            'm': r\"(?P<m>1[0-2]|0[1-9]|[1-9])\",\n            'M': r\"(?P<M>[0-5]\\d|\\d)\",\n            'S': r\"(?P<S>6[0-1]|[0-5]\\d|\\d)\",\n            'U': r\"(?P<U>5[0-3]|[0-4]\\d|\\d)\",\n            'w': r\"(?P<w>[0-6])\",\n            # W is set below by using 'U'\n            'y': r\"(?P<y>\\d\\d)\",\n            #XXX: Does 'Y' need to worry about having less or more than\n            #     4 digits?\n            'Y': r\"(?P<Y>\\d\\d\\d\\d)\",\n            'z': r\"(?P<z>[+-]\\d\\d[0-5]\\d)\",\n            'A': self.__seqToRE(self.locale_time.f_weekday, 'A'),\n            'a': self.__seqToRE(self.locale_time.a_weekday, 'a'),\n            'B': self.__seqToRE(self.locale_time.f_month[1:], 'B'),\n            'b': self.__seqToRE(self.locale_time.a_month[1:], 'b'),\n            'p': self.__seqToRE(self.locale_time.am_pm, 'p'),\n            'Z': self.__seqToRE((tz for tz_names in self.locale_time.timezone\n                                        for tz in tz_names),\n                                'Z'),\n            '%': '%'})\n        base.__setitem__('W', base.__getitem__('U').replace('U', 'W'))\n        base.__setitem__('c', self.pattern(self.locale_time.LC_date_time))\n        base.__setitem__('x', self.pattern(self.locale_time.LC_date))\n        base.__setitem__('X', self.pattern(self.locale_time.LC_time))"},{"col":0,"comment":"null","endLoc":183,"header":"def _skycoord_constructor(loader, node)","id":3030,"name":"_skycoord_constructor","nodeType":"Function","startLoc":180,"text":"def _skycoord_constructor(loader, node):\n    map = loader.construct_mapping(node)\n    out = coords.SkyCoord.info._construct_from_dict(map)\n    return out"},{"col":4,"comment":"Division by `TimeDelta` objects of numbers/arrays.","endLoc":2513,"header":"def __rtruediv__(self, other)","id":3031,"name":"__rtruediv__","nodeType":"Function","startLoc":2509,"text":"def __rtruediv__(self, other):\n        \"\"\"Division by `TimeDelta` objects of numbers/arrays.\"\"\"\n        # Here, we do not have to worry about returning NotImplemented,\n        # since other has already had a chance to look at us.\n        return other / self.to(u.day)"},{"col":4,"comment":"Set all attributes.\n\n        Order of methods called matters for dependency reasons.\n\n        The locale language is set at the offset and then checked again before\n        exiting.  This is to make sure that the attributes were not set with a\n        mix of information from more than one locale.  This would most likely\n        happen when using threads where one thread calls a locale-dependent\n        function while another thread changes the locale while the function in\n        the other thread is still running.  Proper coding would call for\n        locks to prevent changing the locale while locale-dependent code is\n        running.  The check here is done in case someone does not think about\n        doing this.\n\n        Only other possible issue is if someone changed the timezone and did\n        not call tz.tzset .  That is an issue for the programmer, though,\n        since changing the timezone is worthless without that call.\n\n        ","endLoc":89,"header":"def __init__(self)","id":3032,"name":"__init__","nodeType":"Function","startLoc":60,"text":"def __init__(self):\n        \"\"\"Set all attributes.\n\n        Order of methods called matters for dependency reasons.\n\n        The locale language is set at the offset and then checked again before\n        exiting.  This is to make sure that the attributes were not set with a\n        mix of information from more than one locale.  This would most likely\n        happen when using threads where one thread calls a locale-dependent\n        function while another thread changes the locale while the function in\n        the other thread is still running.  Proper coding would call for\n        locks to prevent changing the locale while locale-dependent code is\n        running.  The check here is done in case someone does not think about\n        doing this.\n\n        Only other possible issue is if someone changed the timezone and did\n        not call tz.tzset .  That is an issue for the programmer, though,\n        since changing the timezone is worthless without that call.\n\n        \"\"\"\n        self.lang = _getlang()\n        self.__calc_weekday()\n        self.__calc_month()\n        self.__calc_am_pm()\n        self.__calc_timezone()\n        self.__calc_date_time()\n        if _getlang() != self.lang:\n            raise ValueError(\"locale changed during initialization\")\n        if time.tzname != self.tzname or time.daylight != self.daylight:\n            raise ValueError(\"timezone changed during initialization\")"},{"col":4,"comment":"null","endLoc":79,"header":"def __new__(cls, *args, **kwargs)","id":3033,"name":"__new__","nodeType":"Function","startLoc":69,"text":"def __new__(cls, *args, **kwargs):\n        if cls is Masked:\n            # Initializing with Masked itself means we're in \"factory mode\".\n            if not kwargs and len(args) == 1 and isinstance(args[0], type):\n                # Create a new masked class.\n                return cls._get_masked_cls(args[0])\n            else:\n                return cls._get_masked_instance(*args, **kwargs)\n        else:\n            # Otherwise we're a subclass and should just pass information on.\n            return super().__new__(cls, *args, **kwargs)"},{"col":4,"comment":"Get time delta values expressed in specified output format or unit.\n\n        This method is flexible and handles both conversion to a specified\n        ``TimeDelta`` format / sub-format AND conversion to a specified unit.\n        If positional argument(s) are provided then the first one is checked\n        to see if it is a valid ``TimeDelta`` format, and next it is checked\n        to see if it is a valid unit or unit string.\n\n        To convert to a ``TimeDelta`` format and optional sub-format the options\n        are::\n\n          tm = TimeDelta(1.0 * u.s)\n          tm.to_value('jd')  # equivalent of tm.jd\n          tm.to_value('jd', 'decimal')  # convert to 'jd' as a Decimal object\n          tm.to_value('jd', subfmt='decimal')\n          tm.to_value(format='jd', subfmt='decimal')\n\n        To convert to a unit with optional equivalencies, the options are::\n\n          tm.to_value('hr')  # convert to u.hr (hours)\n          tm.to_value('hr', [])  # specify equivalencies as a positional arg\n          tm.to_value('hr', equivalencies=[])\n          tm.to_value(unit='hr', equivalencies=[])\n\n        The built-in `~astropy.time.TimeDelta` options for ``format`` are:\n        {'jd', 'sec', 'datetime'}.\n\n        For the two numerical formats 'jd' and 'sec', the available ``subfmt``\n        options are: {'float', 'long', 'decimal', 'str', 'bytes'}. Here, 'long'\n        uses ``numpy.longdouble`` for somewhat enhanced precision (with the\n        enhancement depending on platform), and 'decimal' instances of\n        :class:`decimal.Decimal` for full precision.  For the 'str' and 'bytes'\n        sub-formats, the number of digits is also chosen such that time values\n        are represented accurately.  Default: as set by ``out_subfmt`` (which by\n        default picks the first available for a given format, i.e., 'float').\n\n        Parameters\n        ----------\n        format : str, optional\n            The format in which one wants the `~astropy.time.TimeDelta` values.\n            Default: the current format.\n        subfmt : str, optional\n            Possible sub-format in which the values should be given. Default: as\n            set by ``out_subfmt`` (which by default picks the first available\n            for a given format, i.e., 'float' or 'date_hms').\n        unit : `~astropy.units.UnitBase` instance or str, optional\n            The unit in which the value should be given.\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not directly\n            convertible (see :ref:`astropy:unit_equivalencies`). If `None`, no\n            equivalencies will be applied at all, not even any set globally or\n            within a context.\n\n        Returns\n        -------\n        value : ndarray or scalar\n            The value in the format or units specified.\n\n        See also\n        --------\n        to : Convert to a `~astropy.units.Quantity` instance in a given unit.\n        value : The time value in the current format.\n\n        ","endLoc":2629,"header":"def to_value(self, *args, **kwargs)","id":3034,"name":"to_value","nodeType":"Function","startLoc":2541,"text":"def to_value(self, *args, **kwargs):\n        \"\"\"Get time delta values expressed in specified output format or unit.\n\n        This method is flexible and handles both conversion to a specified\n        ``TimeDelta`` format / sub-format AND conversion to a specified unit.\n        If positional argument(s) are provided then the first one is checked\n        to see if it is a valid ``TimeDelta`` format, and next it is checked\n        to see if it is a valid unit or unit string.\n\n        To convert to a ``TimeDelta`` format and optional sub-format the options\n        are::\n\n          tm = TimeDelta(1.0 * u.s)\n          tm.to_value('jd')  # equivalent of tm.jd\n          tm.to_value('jd', 'decimal')  # convert to 'jd' as a Decimal object\n          tm.to_value('jd', subfmt='decimal')\n          tm.to_value(format='jd', subfmt='decimal')\n\n        To convert to a unit with optional equivalencies, the options are::\n\n          tm.to_value('hr')  # convert to u.hr (hours)\n          tm.to_value('hr', [])  # specify equivalencies as a positional arg\n          tm.to_value('hr', equivalencies=[])\n          tm.to_value(unit='hr', equivalencies=[])\n\n        The built-in `~astropy.time.TimeDelta` options for ``format`` are:\n        {'jd', 'sec', 'datetime'}.\n\n        For the two numerical formats 'jd' and 'sec', the available ``subfmt``\n        options are: {'float', 'long', 'decimal', 'str', 'bytes'}. Here, 'long'\n        uses ``numpy.longdouble`` for somewhat enhanced precision (with the\n        enhancement depending on platform), and 'decimal' instances of\n        :class:`decimal.Decimal` for full precision.  For the 'str' and 'bytes'\n        sub-formats, the number of digits is also chosen such that time values\n        are represented accurately.  Default: as set by ``out_subfmt`` (which by\n        default picks the first available for a given format, i.e., 'float').\n\n        Parameters\n        ----------\n        format : str, optional\n            The format in which one wants the `~astropy.time.TimeDelta` values.\n            Default: the current format.\n        subfmt : str, optional\n            Possible sub-format in which the values should be given. Default: as\n            set by ``out_subfmt`` (which by default picks the first available\n            for a given format, i.e., 'float' or 'date_hms').\n        unit : `~astropy.units.UnitBase` instance or str, optional\n            The unit in which the value should be given.\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not directly\n            convertible (see :ref:`astropy:unit_equivalencies`). If `None`, no\n            equivalencies will be applied at all, not even any set globally or\n            within a context.\n\n        Returns\n        -------\n        value : ndarray or scalar\n            The value in the format or units specified.\n\n        See also\n        --------\n        to : Convert to a `~astropy.units.Quantity` instance in a given unit.\n        value : The time value in the current format.\n\n        \"\"\"\n        if not (args or kwargs):\n            raise TypeError('to_value() missing required format or unit argument')\n\n        # TODO: maybe allow 'subfmt' also for units, keeping full precision\n        # (effectively, by doing the reverse of quantity_day_frac)?\n        # This way, only equivalencies could lead to possible precision loss.\n        if ('format' in kwargs\n                or (args != () and (args[0] is None or args[0] in self.FORMATS))):\n            # Super-class will error with duplicate arguments, etc.\n            return super().to_value(*args, **kwargs)\n\n        # With positional arguments, we try parsing the first one as a unit,\n        # so that on failure we can give a more informative exception.\n        if args:\n            try:\n                unit = u.Unit(args[0])\n            except ValueError as exc:\n                raise ValueError(\"first argument is not one of the known \"\n                                 \"formats ({}) and failed to parse as a unit.\"\n                                 .format(list(self.FORMATS))) from exc\n            args = (unit,) + args[1:]\n\n        return u.Quantity(self._time.jd1 + self._time.jd2,\n                          u.day).to_value(*args, **kwargs)"},{"col":4,"comment":"null","endLoc":106,"header":"def __calc_weekday(self)","id":3035,"name":"__calc_weekday","nodeType":"Function","startLoc":100,"text":"def __calc_weekday(self):\n        # Set self.a_weekday and self.f_weekday using the calendar\n        # module.\n        a_weekday = [calendar.day_abbr[i].lower() for i in range(7)]\n        f_weekday = [calendar.day_name[i].lower() for i in range(7)]\n        self.a_weekday = a_weekday\n        self.f_weekday = f_weekday"},{"col":4,"comment":"null","endLoc":113,"header":"def __calc_month(self)","id":3036,"name":"__calc_month","nodeType":"Function","startLoc":108,"text":"def __calc_month(self):\n        # Set self.f_month and self.a_month using the calendar module.\n        a_month = [calendar.month_abbr[i].lower() for i in range(13)]\n        f_month = [calendar.month_name[i].lower() for i in range(13)]\n        self.a_month = a_month\n        self.f_month = f_month"},{"col":4,"comment":"Coerce setitem value into an equivalent TimeDelta object","endLoc":2639,"header":"def _make_value_equivalent(self, item, value)","id":3037,"name":"_make_value_equivalent","nodeType":"Function","startLoc":2631,"text":"def _make_value_equivalent(self, item, value):\n        \"\"\"Coerce setitem value into an equivalent TimeDelta object\"\"\"\n        if not isinstance(value, TimeDelta):\n            try:\n                value = self.__class__(value, scale=self.scale, format=self.format)\n            except Exception as err:\n                raise ValueError('cannot convert value to a compatible TimeDelta '\n                                 'object: {}'.format(err))\n        return value"},{"col":4,"comment":"null","endLoc":125,"header":"def __calc_am_pm(self)","id":3038,"name":"__calc_am_pm","nodeType":"Function","startLoc":115,"text":"def __calc_am_pm(self):\n        # Set self.am_pm by using time.strftime().\n\n        # The magic date (1999,3,17,hour,44,55,2,76,0) is not really that\n        # magical; just happened to have used it everywhere else where a\n        # static date was needed.\n        am_pm = []\n        for hour in (1, 22):\n            time_tuple = time.struct_time((1999,3,17,hour,44,55,2,76,0))\n            am_pm.append(time.strftime(\"%p\", time_tuple).lower())\n        self.am_pm = am_pm"},{"col":4,"comment":"\n        Similar to `self.wcsprm.axis_types <astropy.wcs.Wcsprm.axis_types>`\n        but provides the information in a more Python-friendly format.\n\n        Returns\n        -------\n        result : list of dict\n\n            Returns a list of dictionaries, one for each axis, each\n            containing attributes about the type of that axis.\n\n            Each dictionary has the following keys:\n\n            - 'coordinate_type':\n\n              - None: Non-specific coordinate type.\n\n              - 'stokes': Stokes coordinate.\n\n              - 'celestial': Celestial coordinate (including ``CUBEFACE``).\n\n              - 'spectral': Spectral coordinate.\n\n            - 'scale':\n\n              - 'linear': Linear axis.\n\n              - 'quantized': Quantized axis (``STOKES``, ``CUBEFACE``).\n\n              - 'non-linear celestial': Non-linear celestial axis.\n\n              - 'non-linear spectral': Non-linear spectral axis.\n\n              - 'logarithmic': Logarithmic axis.\n\n              - 'tabular': Tabular axis.\n\n            - 'group'\n\n              - Group number, e.g. lookup table number\n\n            - 'number'\n\n              - For celestial axes:\n\n                - 0: Longitude coordinate.\n\n                - 1: Latitude coordinate.\n\n                - 2: ``CUBEFACE`` number.\n\n              - For lookup tables:\n\n                - the axis number in a multidimensional table.\n\n            ``CTYPEia`` in ``\"4-3\"`` form with unrecognized algorithm code will\n            generate an error.\n        ","endLoc":2990,"header":"def get_axis_types(self)","id":3039,"name":"get_axis_types","nodeType":"Function","startLoc":2895,"text":"def get_axis_types(self):\n        \"\"\"\n        Similar to `self.wcsprm.axis_types <astropy.wcs.Wcsprm.axis_types>`\n        but provides the information in a more Python-friendly format.\n\n        Returns\n        -------\n        result : list of dict\n\n            Returns a list of dictionaries, one for each axis, each\n            containing attributes about the type of that axis.\n\n            Each dictionary has the following keys:\n\n            - 'coordinate_type':\n\n              - None: Non-specific coordinate type.\n\n              - 'stokes': Stokes coordinate.\n\n              - 'celestial': Celestial coordinate (including ``CUBEFACE``).\n\n              - 'spectral': Spectral coordinate.\n\n            - 'scale':\n\n              - 'linear': Linear axis.\n\n              - 'quantized': Quantized axis (``STOKES``, ``CUBEFACE``).\n\n              - 'non-linear celestial': Non-linear celestial axis.\n\n              - 'non-linear spectral': Non-linear spectral axis.\n\n              - 'logarithmic': Logarithmic axis.\n\n              - 'tabular': Tabular axis.\n\n            - 'group'\n\n              - Group number, e.g. lookup table number\n\n            - 'number'\n\n              - For celestial axes:\n\n                - 0: Longitude coordinate.\n\n                - 1: Latitude coordinate.\n\n                - 2: ``CUBEFACE`` number.\n\n              - For lookup tables:\n\n                - the axis number in a multidimensional table.\n\n            ``CTYPEia`` in ``\"4-3\"`` form with unrecognized algorithm code will\n            generate an error.\n        \"\"\"\n        if self.wcs is None:\n            raise AttributeError(\n                \"This WCS object does not have a wcsprm object.\")\n\n        coordinate_type_map = {\n            0: None,\n            1: 'stokes',\n            2: 'celestial',\n            3: 'spectral'}\n\n        scale_map = {\n            0: 'linear',\n            1: 'quantized',\n            2: 'non-linear celestial',\n            3: 'non-linear spectral',\n            4: 'logarithmic',\n            5: 'tabular'}\n\n        result = []\n        for axis_type in self.wcs.axis_types:\n            subresult = {}\n\n            coordinate_type = (axis_type // 1000) % 10\n            subresult['coordinate_type'] = coordinate_type_map[coordinate_type]\n\n            scale = (axis_type // 100) % 10\n            subresult['scale'] = scale_map[scale]\n\n            group = (axis_type // 10) % 10\n            subresult['group'] = group\n\n            number = axis_type % 10\n            subresult['number'] = number\n\n            result.append(subresult)\n\n        return result"},{"col":4,"comment":"Returns a boolean or boolean array where two TimeDelta objects are\n        element-wise equal within a time tolerance.\n\n        This effectively evaluates the expression below::\n\n          abs(self - other) <= atol + rtol * abs(other)\n\n        Parameters\n        ----------\n        other : `~astropy.units.Quantity` or `~astropy.time.TimeDelta`\n            Quantity or TimeDelta object for comparison.\n        atol : `~astropy.units.Quantity` or `~astropy.time.TimeDelta`\n            Absolute tolerance for equality with units of time (e.g. ``u.s`` or\n            ``u.day``). Default is one bit in the 128-bit JD time representation,\n            equivalent to about 20 picosecs.\n        rtol : float\n            Relative tolerance for equality\n        ","endLoc":2673,"header":"def isclose(self, other, atol=None, rtol=0.0)","id":3040,"name":"isclose","nodeType":"Function","startLoc":2641,"text":"def isclose(self, other, atol=None, rtol=0.0):\n        \"\"\"Returns a boolean or boolean array where two TimeDelta objects are\n        element-wise equal within a time tolerance.\n\n        This effectively evaluates the expression below::\n\n          abs(self - other) <= atol + rtol * abs(other)\n\n        Parameters\n        ----------\n        other : `~astropy.units.Quantity` or `~astropy.time.TimeDelta`\n            Quantity or TimeDelta object for comparison.\n        atol : `~astropy.units.Quantity` or `~astropy.time.TimeDelta`\n            Absolute tolerance for equality with units of time (e.g. ``u.s`` or\n            ``u.day``). Default is one bit in the 128-bit JD time representation,\n            equivalent to about 20 picosecs.\n        rtol : float\n            Relative tolerance for equality\n        \"\"\"\n        try:\n            other_day = other.to_value(u.day)\n        except Exception as err:\n            raise TypeError(f\"'other' argument must support conversion to days: {err}\")\n\n        if atol is None:\n            atol = np.finfo(float).eps * u.day\n\n        if not isinstance(atol, (u.Quantity, TimeDelta)):\n            raise TypeError(\"'atol' argument must be a Quantity or TimeDelta instance, got \"\n                            f'{atol.__class__.__name__} instead')\n\n        return np.isclose(self.to_value(u.day), other_day,\n                          rtol=rtol, atol=atol.to_value(u.day))"},{"col":4,"comment":"null","endLoc":187,"header":"def __calc_timezone(self)","id":3041,"name":"__calc_timezone","nodeType":"Function","startLoc":172,"text":"def __calc_timezone(self):\n        # Set self.timezone by using time.tzname.\n        # Do not worry about possibility of time.tzname[0] == time.tzname[1]\n        # and time.daylight; handle that in strptime.\n        try:\n            time.tzset()\n        except AttributeError:\n            pass\n        self.tzname = time.tzname\n        self.daylight = time.daylight\n        no_saving = frozenset({\"utc\", \"gmt\", self.tzname[0].lower()})\n        if self.daylight:\n            has_saving = frozenset({self.tzname[1].lower()})\n        else:\n            has_saving = frozenset()\n        self.timezone = (no_saving, has_saving)"},{"col":4,"comment":"\n        Support pickling of WCS objects.  This is done by serializing\n        to an in-memory FITS file and dumping that as a string.\n        ","endLoc":3007,"header":"def __reduce__(self)","id":3042,"name":"__reduce__","nodeType":"Function","startLoc":2992,"text":"def __reduce__(self):\n        \"\"\"\n        Support pickling of WCS objects.  This is done by serializing\n        to an in-memory FITS file and dumping that as a string.\n        \"\"\"\n\n        hdulist = self.to_fits(relax=True)\n\n        buffer = io.BytesIO()\n        hdulist.writeto(buffer)\n\n        dct = self.__dict__.copy()\n        dct['_alt_wcskey'] = self.wcs.alt\n\n        return (__WCS_unpickle__,\n                (self.__class__, dct, buffer.getvalue(),))"},{"col":0,"comment":"null","endLoc":196,"header":"def _complex_representer(self, data)","id":3043,"name":"_complex_representer","nodeType":"Function","startLoc":187,"text":"def _complex_representer(self, data):\n    if data.imag == 0.0:\n        data = f'{data.real!r}'\n    elif data.real == 0.0:\n        data = f'{data.imag!r}j'\n    elif data.imag > 0:\n        data = f'{data.real!r}+{data.imag!r}j'\n    else:\n        data = f'{data.real!r}{data.imag!r}j'\n    return self.represent_scalar('tag:yaml.org,2002:python/complex', data)"},{"attributeType":"null","col":4,"comment":"List of time delta scales.","endLoc":2299,"id":3044,"name":"SCALES","nodeType":"Attribute","startLoc":2299,"text":"SCALES"},{"col":4,"comment":"null","endLoc":170,"header":"def __calc_date_time(self)","id":3045,"name":"__calc_date_time","nodeType":"Function","startLoc":127,"text":"def __calc_date_time(self):\n        # Set self.date_time, self.date, & self.time by using\n        # time.strftime().\n\n        # Use (1999,3,17,22,44,55,2,76,0) for magic date because the amount of\n        # overloaded numbers is minimized.  The order in which searches for\n        # values within the format string is very important; it eliminates\n        # possible ambiguity for what something represents.\n        time_tuple = time.struct_time((1999,3,17,22,44,55,2,76,0))\n        date_time = [None, None, None]\n        date_time[0] = time.strftime(\"%c\", time_tuple).lower()\n        date_time[1] = time.strftime(\"%x\", time_tuple).lower()\n        date_time[2] = time.strftime(\"%X\", time_tuple).lower()\n        replacement_pairs = [('%', '%%'), (self.f_weekday[2], '%A'),\n                    (self.f_month[3], '%B'), (self.a_weekday[2], '%a'),\n                    (self.a_month[3], '%b'), (self.am_pm[1], '%p'),\n                    ('1999', '%Y'), ('99', '%y'), ('22', '%H'),\n                    ('44', '%M'), ('55', '%S'), ('76', '%j'),\n                    ('17', '%d'), ('03', '%m'), ('3', '%m'),\n                    # '3' needed for when no leading zero.\n                    ('2', '%w'), ('10', '%I')]\n        replacement_pairs.extend([(tz, \"%Z\") for tz_values in self.timezone\n                                                for tz in tz_values])\n        for offset,directive in ((0,'%c'), (1,'%x'), (2,'%X')):\n            current_format = date_time[offset]\n            for old, new in replacement_pairs:\n                # Must deal with possible lack of locale info\n                # manifesting itself as the empty string (e.g., Swedish's\n                # lack of AM/PM info) or a platform returning a tuple of empty\n                # strings (e.g., MacOS 9 having timezone as ('','')).\n                if old:\n                    current_format = current_format.replace(old, new)\n            # If %W is used, then Sunday, 2005-01-03 will fall on week 0 since\n            # 2005-01-03 occurs before the first Monday of the year.  Otherwise\n            # %U is used.\n            time_tuple = time.struct_time((1999,1,3,1,1,1,6,3,0))\n            if '00' in time.strftime(directive, time_tuple):\n                U_W = '%W'\n            else:\n                U_W = '%U'\n            date_time[offset] = current_format.replace('11', U_W)\n        self.LC_date_time = date_time[0]\n        self.LC_date = date_time[1]\n        self.LC_time = date_time[2]"},{"col":0,"comment":"null","endLoc":201,"header":"def _complex_constructor(loader, node)","id":3046,"name":"_complex_constructor","nodeType":"Function","startLoc":199,"text":"def _complex_constructor(loader, node):\n    map = loader.construct_scalar(node)\n    return complex(map)"},{"attributeType":"null","col":4,"comment":"Dict of time delta formats.","endLoc":2302,"id":3047,"name":"FORMATS","nodeType":"Attribute","startLoc":2302,"text":"FORMATS"},{"col":0,"comment":"Parse the first YAML document in a stream using the AstropyLoader and\n    produce the corresponding Python object.\n\n    Parameters\n    ----------\n    stream : str or file-like\n        YAML input\n\n    Returns\n    -------\n    obj : object\n        Object corresponding to YAML document\n    ","endLoc":314,"header":"def load(stream)","id":3048,"name":"load","nodeType":"Function","startLoc":300,"text":"def load(stream):\n    \"\"\"Parse the first YAML document in a stream using the AstropyLoader and\n    produce the corresponding Python object.\n\n    Parameters\n    ----------\n    stream : str or file-like\n        YAML input\n\n    Returns\n    -------\n    obj : object\n        Object corresponding to YAML document\n    \"\"\"\n    return yaml.load(stream, Loader=AstropyLoader)"},{"col":0,"comment":"Parse the all YAML documents in a stream using the AstropyLoader class and\n    produce the corresponding Python object.\n\n    Parameters\n    ----------\n    stream : str or file-like\n        YAML input\n\n    Returns\n    -------\n    obj : object\n        Object corresponding to YAML document\n\n    ","endLoc":332,"header":"def load_all(stream)","id":3049,"name":"load_all","nodeType":"Function","startLoc":317,"text":"def load_all(stream):\n    \"\"\"Parse the all YAML documents in a stream using the AstropyLoader class and\n    produce the corresponding Python object.\n\n    Parameters\n    ----------\n    stream : str or file-like\n        YAML input\n\n    Returns\n    -------\n    obj : object\n        Object corresponding to YAML document\n\n    \"\"\"\n    return yaml.load_all(stream, Loader=AstropyLoader)"},{"col":0,"comment":"Serialize a Python object into a YAML stream using the AstropyDumper class.\n    If stream is None, return the produced string instead.\n\n    Parameters\n    ----------\n    data : object\n        Object to serialize to YAML\n    stream : file-like, optional\n        YAML output (if not supplied a string is returned)\n    **kwargs\n        Other keyword arguments that get passed to yaml.dump()\n\n    Returns\n    -------\n    out : str or None\n        If no ``stream`` is supplied then YAML output is returned as str\n\n    ","endLoc":356,"header":"def dump(data, stream=None, **kwargs)","id":3050,"name":"dump","nodeType":"Function","startLoc":335,"text":"def dump(data, stream=None, **kwargs):\n    \"\"\"Serialize a Python object into a YAML stream using the AstropyDumper class.\n    If stream is None, return the produced string instead.\n\n    Parameters\n    ----------\n    data : object\n        Object to serialize to YAML\n    stream : file-like, optional\n        YAML output (if not supplied a string is returned)\n    **kwargs\n        Other keyword arguments that get passed to yaml.dump()\n\n    Returns\n    -------\n    out : str or None\n        If no ``stream`` is supplied then YAML output is returned as str\n\n    \"\"\"\n    kwargs['Dumper'] = AstropyDumper\n    kwargs.setdefault('default_flow_style', None)\n    return yaml.dump(data, stream=stream, **kwargs)"},{"col":4,"comment":"\n        Remove an axis from the WCS.\n\n        Parameters\n        ----------\n        wcs : `~astropy.wcs.WCS`\n            The WCS with naxis to be chopped to naxis-1\n        dropax : int\n            The index of the WCS to drop, counting from 0 (i.e., python convention,\n            not FITS convention)\n\n        Returns\n        -------\n        `~astropy.wcs.WCS`\n            A new `~astropy.wcs.WCS` instance with one axis fewer\n        ","endLoc":3032,"header":"def dropaxis(self, dropax)","id":3051,"name":"dropaxis","nodeType":"Function","startLoc":3009,"text":"def dropaxis(self, dropax):\n        \"\"\"\n        Remove an axis from the WCS.\n\n        Parameters\n        ----------\n        wcs : `~astropy.wcs.WCS`\n            The WCS with naxis to be chopped to naxis-1\n        dropax : int\n            The index of the WCS to drop, counting from 0 (i.e., python convention,\n            not FITS convention)\n\n        Returns\n        -------\n        `~astropy.wcs.WCS`\n            A new `~astropy.wcs.WCS` instance with one axis fewer\n        \"\"\"\n        inds = list(range(self.wcs.naxis))\n        inds.pop(dropax)\n\n        # axis 0 has special meaning to sub\n        # if wcs.wcs.ctype == ['RA','DEC','VLSR'], you want\n        # wcs.sub([1,2]) to get 'RA','DEC' back\n        return self.sub([i+1 for i in inds])"},{"attributeType":"null","col":16,"comment":"null","endLoc":61,"id":3052,"name":"np","nodeType":"Attribute","startLoc":61,"text":"np"},{"attributeType":"null","col":29,"comment":"null","endLoc":65,"id":3053,"name":"u","nodeType":"Attribute","startLoc":65,"text":"u"},{"attributeType":"null","col":35,"comment":"null","endLoc":66,"id":3054,"name":"coords","nodeType":"Attribute","startLoc":66,"text":"coords"},{"attributeType":"null","col":0,"comment":"null","endLoc":70,"id":3055,"name":"__all__","nodeType":"Attribute","startLoc":70,"text":"__all__"},{"attributeType":"null","col":4,"comment":"null","endLoc":252,"id":3056,"name":"np_type","nodeType":"Attribute","startLoc":252,"text":"np_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":256,"id":3057,"name":"np_type","nodeType":"Attribute","startLoc":256,"text":"np_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":260,"id":3058,"name":"np_type","nodeType":"Attribute","startLoc":260,"text":"np_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":279,"id":3059,"name":"cls","nodeType":"Attribute","startLoc":279,"text":"cls"},{"attributeType":"null","col":4,"comment":"null","endLoc":2305,"id":3060,"name":"info","nodeType":"Attribute","startLoc":2305,"text":"info"},{"col":4,"comment":"\n        Swap axes in a WCS.\n\n        Parameters\n        ----------\n        wcs : `~astropy.wcs.WCS`\n            The WCS to have its axes swapped\n        ax0 : int\n        ax1 : int\n            The indices of the WCS to be swapped, counting from 0 (i.e., python\n            convention, not FITS convention)\n\n        Returns\n        -------\n        `~astropy.wcs.WCS`\n            A new `~astropy.wcs.WCS` instance with the same number of axes,\n            but two swapped\n        ","endLoc":3056,"header":"def swapaxes(self, ax0, ax1)","id":3061,"name":"swapaxes","nodeType":"Function","startLoc":3034,"text":"def swapaxes(self, ax0, ax1):\n        \"\"\"\n        Swap axes in a WCS.\n\n        Parameters\n        ----------\n        wcs : `~astropy.wcs.WCS`\n            The WCS to have its axes swapped\n        ax0 : int\n        ax1 : int\n            The indices of the WCS to be swapped, counting from 0 (i.e., python\n            convention, not FITS convention)\n\n        Returns\n        -------\n        `~astropy.wcs.WCS`\n            A new `~astropy.wcs.WCS` instance with the same number of axes,\n            but two swapped\n        \"\"\"\n        inds = list(range(self.wcs.naxis))\n        inds[ax0], inds[ax1] = inds[ax1], inds[ax0]\n\n        return self.sub([i+1 for i in inds])"},{"attributeType":"null","col":16,"comment":"null","endLoc":2327,"id":3062,"name":"SCALES","nodeType":"Attribute","startLoc":2327,"text":"self.SCALES"},{"col":4,"comment":"Convert a list to a regex string for matching a directive.\n\n        Want possible matching values to be from longest to shortest.  This\n        prevents the possibility of a match occurring for a value that also\n        a substring of a larger value that should have matched (e.g., 'abc'\n        matching when 'abcdef' should have been the match).\n\n        ","endLoc":253,"header":"def __seqToRE(self, to_convert, directive)","id":3063,"name":"__seqToRE","nodeType":"Function","startLoc":236,"text":"def __seqToRE(self, to_convert, directive):\n        \"\"\"Convert a list to a regex string for matching a directive.\n\n        Want possible matching values to be from longest to shortest.  This\n        prevents the possibility of a match occurring for a value that also\n        a substring of a larger value that should have matched (e.g., 'abc'\n        matching when 'abcdef' should have been the match).\n\n        \"\"\"\n        to_convert = sorted(to_convert, key=len, reverse=True)\n        for value in to_convert:\n            if value != '':\n                break\n        else:\n            return ''\n        regex = '|'.join(re_escape(stuff) for stuff in to_convert)\n        regex = '(?P<%s>%s' % (directive, regex)\n        return '%s)' % regex"},{"col":4,"comment":"\n        Reorient the WCS such that the celestial axes are first, followed by\n        the spectral axis, followed by any others.\n        Assumes at least celestial axes are present.\n        ","endLoc":3064,"header":"def reorient_celestial_first(self)","id":3064,"name":"reorient_celestial_first","nodeType":"Function","startLoc":3058,"text":"def reorient_celestial_first(self):\n        \"\"\"\n        Reorient the WCS such that the celestial axes are first, followed by\n        the spectral axis, followed by any others.\n        Assumes at least celestial axes are present.\n        \"\"\"\n        return self.sub([WCSSUB_CELESTIAL, WCSSUB_SPECTRAL, WCSSUB_STOKES])  # Defined by C-ext  # noqa: F821 E501"},{"col":4,"comment":"\n        Slice a WCS instance using a Numpy slice. The order of the slice should\n        be reversed (as for the data) compared to the natural WCS order.\n\n        Parameters\n        ----------\n        view : tuple\n            A tuple containing the same number of slices as the WCS system.\n            The ``step`` method, the third argument to a slice, is not\n            presently supported.\n        numpy_order : bool\n            Use numpy order, i.e. slice the WCS so that an identical slice\n            applied to a numpy array will slice the array and WCS in the same\n            way. If set to `False`, the WCS will be sliced in FITS order,\n            meaning the first slice will be applied to the *last* numpy index\n            but the *first* WCS axis.\n\n        Returns\n        -------\n        wcs_new : `~astropy.wcs.WCS`\n            A new resampled WCS axis\n        ","endLoc":3160,"header":"def slice(self, view, numpy_order=True)","id":3065,"name":"slice","nodeType":"Function","startLoc":3066,"text":"def slice(self, view, numpy_order=True):\n        \"\"\"\n        Slice a WCS instance using a Numpy slice. The order of the slice should\n        be reversed (as for the data) compared to the natural WCS order.\n\n        Parameters\n        ----------\n        view : tuple\n            A tuple containing the same number of slices as the WCS system.\n            The ``step`` method, the third argument to a slice, is not\n            presently supported.\n        numpy_order : bool\n            Use numpy order, i.e. slice the WCS so that an identical slice\n            applied to a numpy array will slice the array and WCS in the same\n            way. If set to `False`, the WCS will be sliced in FITS order,\n            meaning the first slice will be applied to the *last* numpy index\n            but the *first* WCS axis.\n\n        Returns\n        -------\n        wcs_new : `~astropy.wcs.WCS`\n            A new resampled WCS axis\n        \"\"\"\n        if hasattr(view, '__len__') and len(view) > self.wcs.naxis:\n            raise ValueError(\"Must have # of slices <= # of WCS axes\")\n        elif not hasattr(view, '__len__'):  # view MUST be an iterable\n            view = [view]\n\n        if not all(isinstance(x, slice) for x in view):\n            # We need to drop some dimensions, but this may not always be\n            # possible with .sub due to correlated axes, so instead we use the\n            # generalized slicing infrastructure from astropy.wcs.wcsapi.\n            return SlicedFITSWCS(self, view)\n\n        # NOTE: we could in principle use SlicedFITSWCS as above for all slicing,\n        # but in the simple case where there are no axes dropped, we can just\n        # create a full WCS object with updated WCS parameters which is faster\n        # for this specific case and also backward-compatible.\n\n        wcs_new = self.deepcopy()\n        if wcs_new.sip is not None:\n            sip_crpix = wcs_new.sip.crpix.tolist()\n\n        for i, iview in enumerate(view):\n            if iview.step is not None and iview.step < 0:\n                raise NotImplementedError(\"Reversing an axis is not \"\n                                          \"implemented.\")\n\n            if numpy_order:\n                wcs_index = self.wcs.naxis - 1 - i\n            else:\n                wcs_index = i\n\n            if iview.step is not None and iview.start is None:\n                # Slice from \"None\" is equivalent to slice from 0 (but one\n                # might want to downsample, so allow slices with\n                # None,None,step or None,stop,step)\n                iview = slice(0, iview.stop, iview.step)\n\n            if iview.start is not None:\n                if iview.step not in (None, 1):\n                    crpix = self.wcs.crpix[wcs_index]\n                    cdelt = self.wcs.cdelt[wcs_index]\n                    # equivalently (keep this comment so you can compare eqns):\n                    # wcs_new.wcs.crpix[wcs_index] =\n                    # (crpix - iview.start)*iview.step + 0.5 - iview.step/2.\n                    crp = ((crpix - iview.start - 1.)/iview.step\n                           + 0.5 + 1./iview.step/2.)\n                    wcs_new.wcs.crpix[wcs_index] = crp\n                    if wcs_new.sip is not None:\n                        sip_crpix[wcs_index] = crp\n                    wcs_new.wcs.cdelt[wcs_index] = cdelt * iview.step\n                else:\n                    wcs_new.wcs.crpix[wcs_index] -= iview.start\n                    if wcs_new.sip is not None:\n                        sip_crpix[wcs_index] -= iview.start\n\n            try:\n                # range requires integers but the other attributes can also\n                # handle arbitrary values, so this needs to be in a try/except.\n                nitems = len(builtins.range(self._naxis[wcs_index])[iview])\n            except TypeError as exc:\n                if 'indices must be integers' not in str(exc):\n                    raise\n                warnings.warn(\"NAXIS{} attribute is not updated because at \"\n                              \"least one index ('{}') is no integer.\"\n                              \"\".format(wcs_index, iview), AstropyUserWarning)\n            else:\n                wcs_new._naxis[wcs_index] = nitems\n\n        if wcs_new.sip is not None:\n            wcs_new.sip = Sip(self.sip.a, self.sip.b, self.sip.ap, self.sip.bp,\n                              sip_crpix)\n\n        return wcs_new"},{"attributeType":"null","col":12,"comment":"null","endLoc":2314,"id":3066,"name":"self","nodeType":"Attribute","startLoc":2314,"text":"self"},{"col":4,"comment":"Return regex pattern for the format string.\n\n        Need to make sure that any characters that might be interpreted as\n        regex syntax are escaped.\n\n        ","endLoc":276,"header":"def pattern(self, format)","id":3067,"name":"pattern","nodeType":"Function","startLoc":255,"text":"def pattern(self, format):\n        \"\"\"Return regex pattern for the format string.\n\n        Need to make sure that any characters that might be interpreted as\n        regex syntax are escaped.\n\n        \"\"\"\n        processed_format = ''\n        # The sub() call escapes all characters that might be misconstrued\n        # as regex syntax.  Cannot use re.escape since we have to deal with\n        # format directives (%m, etc.).\n        regex_chars = re_compile(r\"([\\\\.^$*+?\\(\\){}\\[\\]|])\")\n        format = regex_chars.sub(r\"\\\\\\1\", format)\n        whitespace_replacement = re_compile(r'\\s+')\n        format = whitespace_replacement.sub(r'\\\\s+', format)\n        while '%' in format:\n            directive_index = format.index('%')+1\n            processed_format = \"%s%s%s\" % (processed_format,\n                                           format[:directive_index-1],\n                                           self[format[directive_index]])\n            format = format[directive_index+1:]\n        return \"%s%s\" % (processed_format, format)"},{"attributeType":"null","col":12,"comment":"null","endLoc":2372,"id":3068,"name":"_time","nodeType":"Attribute","startLoc":2372,"text":"self._time"},{"col":4,"comment":"Get the masked wrapper for a given data class.\n\n        If the data class does not exist yet but is a subclass of any of the\n        registered base data classes, it is automatically generated\n        (except we skip `~numpy.ma.MaskedArray` subclasses, since then the\n        masking mechanisms would interfere).\n        ","endLoc":162,"header":"@classmethod\n    def _get_masked_cls(cls, data_cls)","id":3069,"name":"_get_masked_cls","nodeType":"Function","startLoc":126,"text":"@classmethod\n    def _get_masked_cls(cls, data_cls):\n        \"\"\"Get the masked wrapper for a given data class.\n\n        If the data class does not exist yet but is a subclass of any of the\n        registered base data classes, it is automatically generated\n        (except we skip `~numpy.ma.MaskedArray` subclasses, since then the\n        masking mechanisms would interfere).\n        \"\"\"\n        if issubclass(data_cls, (Masked, np.ma.MaskedArray)):\n            return data_cls\n\n        masked_cls = cls._masked_classes.get(data_cls)\n        if masked_cls is None:\n            # Walk through MRO and find closest base data class.\n            # Note: right now, will basically always be ndarray, but\n            # one could imagine needing some special care for one subclass,\n            # which would then get its own entry.  E.g., if MaskedAngle\n            # defined something special, then MaskedLongitude should depend\n            # on it.\n            for mro_item in data_cls.__mro__:\n                base_cls = cls._base_classes.get(mro_item)\n                if base_cls is not None:\n                    break\n            else:\n                # Just hope that MaskedNDArray can handle it.\n                # TODO: this covers the case where a user puts in a list or so,\n                # but for those one could just explicitly do something like\n                # _masked_classes[list] = MaskedNDArray.\n                return MaskedNDArray\n\n            # Create (and therefore register) new Masked subclass for the\n            # given data_cls.\n            masked_cls = type('Masked' + data_cls.__name__,\n                              (data_cls, base_cls), {}, data_cls=data_cls)\n\n        return masked_cls"},{"attributeType":"null","col":0,"comment":"null","endLoc":64,"id":3070,"name":"BARYCENTRIC_SCALES","nodeType":"Attribute","startLoc":64,"text":"BARYCENTRIC_SCALES"},{"attributeType":"null","col":0,"comment":"null","endLoc":44,"id":3071,"name":"FITS_DEPRECATED_SCALES","nodeType":"Attribute","startLoc":44,"text":"FITS_DEPRECATED_SCALES"},{"col":0,"comment":"\n    Check if the FITS header keyword is a time column-specific keyword.\n\n    Parameters\n    ----------\n    keyword : str\n        FITS keyword.\n    ","endLoc":60,"header":"def is_time_column_keyword(keyword)","id":3072,"name":"is_time_column_keyword","nodeType":"Function","startLoc":51,"text":"def is_time_column_keyword(keyword):\n    \"\"\"\n    Check if the FITS header keyword is a time column-specific keyword.\n\n    Parameters\n    ----------\n    keyword : str\n        FITS keyword.\n    \"\"\"\n    return re.match(COLUMN_TIME_KEYWORD_REGEXP, keyword) is not None"},{"col":0,"comment":"\n    Given the global time reference frame information, verify that\n    each global time coordinate attribute will be given a valid value.\n\n    Parameters\n    ----------\n    global_info : dict\n        Global time reference frame information.\n    ","endLoc":165,"header":"def _verify_global_info(global_info)","id":3073,"name":"_verify_global_info","nodeType":"Function","startLoc":69,"text":"def _verify_global_info(global_info):\n    \"\"\"\n    Given the global time reference frame information, verify that\n    each global time coordinate attribute will be given a valid value.\n\n    Parameters\n    ----------\n    global_info : dict\n        Global time reference frame information.\n    \"\"\"\n\n    # Translate FITS deprecated scale into astropy scale, or else just convert\n    # to lower case for further checks.\n    global_info['scale'] = FITS_DEPRECATED_SCALES.get(global_info['TIMESYS'],\n                                                      global_info['TIMESYS'].lower())\n\n    # Verify global time scale\n    if global_info['scale'] not in Time.SCALES:\n\n        # 'GPS' and 'LOCAL' are FITS recognized time scale values\n        # but are not supported by astropy.\n\n        if global_info['scale'] == 'gps':\n            warnings.warn(\n                'Global time scale (TIMESYS) has a FITS recognized time scale '\n                'value \"GPS\". In Astropy, \"GPS\" is a time from epoch format '\n                'which runs synchronously with TAI; GPS is approximately 19 s '\n                'ahead of TAI. Hence, this format will be used.', AstropyUserWarning)\n            # Assume that the values are in GPS format\n            global_info['scale'] = 'tai'\n            global_info['format'] = 'gps'\n\n        if global_info['scale'] == 'local':\n            warnings.warn(\n                'Global time scale (TIMESYS) has a FITS recognized time scale '\n                'value \"LOCAL\". However, the standard states that \"LOCAL\" should be '\n                'tied to one of the existing scales because it is intrinsically '\n                'unreliable and/or ill-defined. Astropy will thus use the default '\n                'global time scale \"UTC\" instead of \"LOCAL\".', AstropyUserWarning)\n            # Default scale 'UTC'\n            global_info['scale'] = 'utc'\n            global_info['format'] = None\n\n        else:\n            raise AssertionError(\n                'Global time scale (TIMESYS) should have a FITS recognized '\n                'time scale value (got {!r}). The FITS standard states that '\n                'the use of local time scales should be restricted to alternate '\n                'coordinates.'.format(global_info['TIMESYS']))\n    else:\n        # Scale is already set\n        global_info['format'] = None\n\n    # Check if geocentric global location is specified\n    obs_geo = [global_info[attr] for attr in ('OBSGEO-X', 'OBSGEO-Y', 'OBSGEO-Z')\n               if attr in global_info]\n\n    # Location full specification is (X, Y, Z)\n    if len(obs_geo) == 3:\n        global_info['location'] = EarthLocation.from_geocentric(*obs_geo, unit=u.m)\n    else:\n        # Check if geodetic global location is specified (since geocentric failed)\n\n        # First warn the user if geocentric location is partially specified\n        if obs_geo:\n            warnings.warn(\n                'The geocentric observatory location {} is not completely '\n                'specified (X, Y, Z) and will be ignored.'.format(obs_geo),\n                AstropyUserWarning)\n\n        # Check geodetic location\n        obs_geo = [global_info[attr] for attr in ('OBSGEO-L', 'OBSGEO-B', 'OBSGEO-H')\n                   if attr in global_info]\n\n        if len(obs_geo) == 3:\n            global_info['location'] = EarthLocation.from_geodetic(*obs_geo)\n        else:\n            # Since both geocentric and geodetic locations are not specified,\n            # location will be None.\n\n            # Warn the user if geodetic location is partially specified\n            if obs_geo:\n                warnings.warn(\n                    'The geodetic observatory location {} is not completely '\n                    'specified (lon, lat, alt) and will be ignored.'.format(obs_geo),\n                    AstropyUserWarning)\n            global_info['location'] = None\n\n    # Get global time reference\n    # Keywords are listed in order of precedence, as stated by the standard\n    for key, format_ in (('MJDREF', 'mjd'), ('JDREF', 'jd'), ('DATEREF', 'fits')):\n        if key in global_info:\n            global_info['ref_time'] = {'val': global_info[key], 'format': format_}\n            break\n    else:\n        # If none of the three keywords is present, MJDREF = 0.0 must be assumed\n        global_info['ref_time'] = {'val': 0, 'format': 'mjd'}"},{"col":4,"comment":"null","endLoc":124,"header":"@classmethod\n    def _get_masked_instance(cls, data, mask=None, copy=False)","id":3074,"name":"_get_masked_instance","nodeType":"Function","startLoc":117,"text":"@classmethod\n    def _get_masked_instance(cls, data, mask=None, copy=False):\n        data, data_mask = cls._get_data_and_mask(data)\n        if mask is None:\n            mask = False if data_mask is None else data_mask\n\n        masked_cls = cls._get_masked_cls(data.__class__)\n        return masked_cls.from_unmasked(data, mask, copy)"},{"col":4,"comment":"Split data into unmasked and mask, if present.\n\n        Parameters\n        ----------\n        data : array-like\n            Possibly masked item, judged by whether it has a ``mask`` attribute.\n            If so, checks for being an instance of `~astropy.utils.masked.Masked`\n            or `~numpy.ma.MaskedArray`, and gets unmasked data appropriately.\n        allow_ma_masked : bool, optional\n            Whether or not to process `~numpy.ma.masked`, i.e., an item that\n            implies no data but the presence of a mask.\n\n        Returns\n        -------\n        unmasked, mask : array-like\n            Unmasked will be `None` for `~numpy.ma.masked`.\n\n        Raises\n        ------\n        ValueError\n            If `~numpy.ma.masked` is passed in and ``allow_ma_masked`` is not set.\n\n        ","endLoc":204,"header":"@classmethod\n    def _get_data_and_mask(cls, data, allow_ma_masked=False)","id":3075,"name":"_get_data_and_mask","nodeType":"Function","startLoc":164,"text":"@classmethod\n    def _get_data_and_mask(cls, data, allow_ma_masked=False):\n        \"\"\"Split data into unmasked and mask, if present.\n\n        Parameters\n        ----------\n        data : array-like\n            Possibly masked item, judged by whether it has a ``mask`` attribute.\n            If so, checks for being an instance of `~astropy.utils.masked.Masked`\n            or `~numpy.ma.MaskedArray`, and gets unmasked data appropriately.\n        allow_ma_masked : bool, optional\n            Whether or not to process `~numpy.ma.masked`, i.e., an item that\n            implies no data but the presence of a mask.\n\n        Returns\n        -------\n        unmasked, mask : array-like\n            Unmasked will be `None` for `~numpy.ma.masked`.\n\n        Raises\n        ------\n        ValueError\n            If `~numpy.ma.masked` is passed in and ``allow_ma_masked`` is not set.\n\n        \"\"\"\n        mask = getattr(data, 'mask', None)\n        if mask is not None:\n            try:\n                data = data.unmasked\n            except AttributeError:\n                if not isinstance(data, np.ma.MaskedArray):\n                    raise\n                if data is np.ma.masked:\n                    if allow_ma_masked:\n                        data = None\n                    else:\n                        raise ValueError('cannot handle np.ma.masked here.') from None\n                else:\n                    data = data.data\n\n        return data, mask"},{"col":0,"comment":"Prints FITS header(s) with keywords as columns.\n\n    This follows the dfits+fitsort format.\n\n    Parameters\n    ----------\n    args : argparse.Namespace\n        Arguments passed from the command-line as defined below.\n    ","endLoc":396,"header":"def print_headers_as_comparison(args)","id":3076,"name":"print_headers_as_comparison","nodeType":"Function","startLoc":327,"text":"def print_headers_as_comparison(args):\n    \"\"\"Prints FITS header(s) with keywords as columns.\n\n    This follows the dfits+fitsort format.\n\n    Parameters\n    ----------\n    args : argparse.Namespace\n        Arguments passed from the command-line as defined below.\n    \"\"\"\n    from astropy import table\n    tables = []\n    # Create a Table object for each file\n    for filename in args.filename:  # Support wildcards\n        formatter = None\n        try:\n            formatter = TableHeaderFormatter(filename, verbose=False)\n            tbl = formatter.parse(args.extensions,\n                                  args.keywords,\n                                  args.compressed)\n            if tbl:\n                # Remove empty keywords\n                tbl = tbl[np.where(tbl['keyword'] != '')]\n            else:\n                tbl = table.Table([[filename]], names=('filename',))\n            tables.append(tbl)\n        except OSError as e:\n            log.error(str(e))  # file not found or unreadable\n        finally:\n            if formatter:\n                formatter.close()\n\n    # Concatenate the tables\n    if len(tables) == 0:\n        return False\n    elif len(tables) == 1:\n        resulting_table = tables[0]\n    else:\n        resulting_table = table.vstack(tables)\n\n    # If we obtained more than one hdu, merge hdu and keywords columns\n    hdus = resulting_table['hdu']\n    if np.ma.isMaskedArray(hdus):\n        hdus = hdus.compressed()\n    if len(np.unique(hdus)) > 1:\n        for tab in tables:\n            new_column = table.Column(\n                [f\"{row['hdu']}:{row['keyword']}\" for row in tab])\n            tab.add_column(new_column, name='hdu+keyword')\n        keyword_column_name = 'hdu+keyword'\n    else:\n        keyword_column_name = 'keyword'\n\n    # Check how many hdus we are processing\n    final_tables = []\n    for tab in tables:\n        final_table = [table.Column([tab['filename'][0]], name='filename')]\n        if 'value' in tab.colnames:\n            for row in tab:\n                if row['keyword'] in ('COMMENT', 'HISTORY'):\n                    continue\n                final_table.append(table.Column([row['value']],\n                                                name=row[keyword_column_name]))\n        final_tables.append(table.Table(final_table))\n    final_table = table.vstack(final_tables)\n    # Sort if requested\n    if args.fitsort is not True:  # then it must be a keyword, therefore sort\n        final_table.sort(args.fitsort)\n    # Reorganise to keyword by columns\n    final_table.pprint(max_lines=-1, max_width=-1)"},{"col":4,"comment":"null","endLoc":154,"header":"def __init__(self, wcs, slices)","id":3077,"name":"__init__","nodeType":"Function","startLoc":122,"text":"def __init__(self, wcs, slices):\n\n        slices = sanitize_slices(slices, wcs.pixel_n_dim)\n\n        if isinstance(wcs, SlicedLowLevelWCS):\n            # Here we combine the current slices with the previous slices\n            # to avoid ending up with many nested WCSes\n            self._wcs = wcs._wcs\n            slices_original = wcs._slices_array.copy()\n            for ipixel in range(wcs.pixel_n_dim):\n                ipixel_orig = wcs._wcs.pixel_n_dim - 1 - wcs._pixel_keep[ipixel]\n                ipixel_new = wcs.pixel_n_dim - 1 - ipixel\n                slices_original[ipixel_orig] = combine_slices(slices_original[ipixel_orig],\n                                                              slices[ipixel_new])\n            self._slices_array = slices_original\n        else:\n            self._wcs = wcs\n            self._slices_array = slices\n\n        self._slices_pixel = self._slices_array[::-1]\n\n        # figure out which pixel dimensions have been kept, then use axis correlation\n        # matrix to figure out which world dims are kept\n        self._pixel_keep = np.nonzero([not isinstance(self._slices_pixel[ip], numbers.Integral)\n                                       for ip in range(self._wcs.pixel_n_dim)])[0]\n\n        # axis_correlation_matrix[world, pixel]\n        self._world_keep = np.nonzero(\n            self._wcs.axis_correlation_matrix[:, self._pixel_keep].any(axis=1))[0]\n\n        if len(self._pixel_keep) == 0 or len(self._world_keep) == 0:\n            raise ValueError(\"Cannot slice WCS: the resulting WCS should have \"\n                             \"at least one pixel and one world dimension.\")"},{"col":0,"comment":"Calculate the Julian day based on the year, week of the year, and day of\n    the week, with week_start_day representing whether the week of the year\n    assumes the week starts on Sunday or Monday (6 or 0).","endLoc":307,"header":"def _calc_julian_from_U_or_W(year, week_of_year, day_of_week, week_starts_Mon)","id":3078,"name":"_calc_julian_from_U_or_W","nodeType":"Function","startLoc":289,"text":"def _calc_julian_from_U_or_W(year, week_of_year, day_of_week, week_starts_Mon):\n    \"\"\"Calculate the Julian day based on the year, week of the year, and day of\n    the week, with week_start_day representing whether the week of the year\n    assumes the week starts on Sunday or Monday (6 or 0).\"\"\"\n    first_weekday = datetime_date(year, 1, 1).weekday()\n    # If we are dealing with the %U directive (week starts on Sunday), it's\n    # easier to just shift the view to Sunday being the first day of the\n    # week.\n    if not week_starts_Mon:\n        first_weekday = (first_weekday + 1) % 7\n        day_of_week = (day_of_week + 1) % 7\n    # Need to watch out for a week 0 (when the first day of the year is not\n    # the same as that specified by %U or %W).\n    week_0_length = (7 - first_weekday) % 7\n    if week_of_year == 0:\n        return 1 + day_of_week - first_weekday\n    else:\n        days_to_week = week_0_length + (7 * (week_of_year - 1))\n        return 1 + days_to_week + day_of_week"},{"col":0,"comment":"null","endLoc":382,"header":"def _construct_mixins_from_columns(tbl)","id":3079,"name":"_construct_mixins_from_columns","nodeType":"Function","startLoc":362,"text":"def _construct_mixins_from_columns(tbl):\n    if '__serialized_columns__' not in tbl.meta:\n        return tbl\n\n    meta = tbl.meta.copy()\n    mixin_cols = meta.pop('__serialized_columns__')\n\n    out = _TableLite(tbl.columns)\n\n    for new_name, obj_attrs in mixin_cols.items():\n        _construct_mixin_from_columns(new_name, obj_attrs, out)\n\n    # If no quantity subclasses are in the output then output as Table.\n    # For instance ascii.read(file, format='ecsv') doesn't specify an\n    # output class and should return the minimal table class that\n    # represents the table file.\n    has_quantities = any(isinstance(col.info, QuantityInfo)\n                         for col in out.itercols())\n    out_cls = QTable if has_quantities else Table\n\n    return out_cls(list(out.values()), names=out.colnames, copy=False, meta=meta)"},{"attributeType":"null","col":9,"comment":"null","endLoc":279,"id":3080,"name":"tag","nodeType":"Attribute","startLoc":279,"text":"tag"},{"attributeType":"null","col":4,"comment":"null","endLoc":290,"id":3081,"name":"cls","nodeType":"Attribute","startLoc":290,"text":"cls"},{"attributeType":"null","col":4,"comment":"null","endLoc":292,"id":3082,"name":"name","nodeType":"Attribute","startLoc":292,"text":"name"},{"col":0,"comment":"null","endLoc":359,"header":"def _construct_mixin_from_columns(new_name, obj_attrs, out)","id":3083,"name":"_construct_mixin_from_columns","nodeType":"Function","startLoc":315,"text":"def _construct_mixin_from_columns(new_name, obj_attrs, out):\n    data_attrs_map = {}\n    for name, val in obj_attrs.items():\n        if isinstance(val, SerializedColumn):\n            if 'name' in val:\n                data_attrs_map[val['name']] = name\n            else:\n                out_name = f'{new_name}.{name}'\n                _construct_mixin_from_columns(out_name, val, out)\n                data_attrs_map[out_name] = name\n\n    for name in data_attrs_map.values():\n        del obj_attrs[name]\n\n    # Get the index where to add new column\n    idx = min(out.colnames.index(name) for name in data_attrs_map)\n\n    # Name is the column name in the table (e.g. \"coord.ra\") and\n    # data_attr is the object attribute name  (e.g. \"ra\").  A different\n    # example would be a formatted time object that would have (e.g.)\n    # \"time_col\" and \"value\", respectively.\n    for name, data_attr in data_attrs_map.items():\n        obj_attrs[data_attr] = out[name]\n        del out[name]\n\n    info = obj_attrs.pop('__info__', {})\n    if len(data_attrs_map) == 1:\n        # col is the first and only serialized column; in that case, use info\n        # stored on the column. First step is to get that first column which\n        # has been moved from `out` to `obj_attrs` above.\n        data_attr = next(iter(data_attrs_map.values()))\n        col = obj_attrs[data_attr]\n\n        # Now copy the relevant attributes\n        for attr, nontrivial in (('unit', lambda x: x not in (None, '')),\n                                 ('format', lambda x: x is not None),\n                                 ('description', lambda x: x is not None),\n                                 ('meta', lambda x: x)):\n            col_attr = getattr(col.info, attr)\n            if nontrivial(col_attr):\n                info[attr] = col_attr\n\n    info['name'] = new_name\n    col = _construct_mixin_from_obj_attrs_and_info(obj_attrs, info)\n    out.add_column(col, index=idx)"},{"col":4,"comment":"\n        Convert Time to a string or a numpy.array of strings according to a\n        format specification.\n        See `time.strftime` documentation for format specification.\n\n        Parameters\n        ----------\n        format_spec : str\n            Format definition of return string.\n\n        Returns\n        -------\n        formatted : str or numpy.array\n            String or numpy.array of strings formatted according to the given\n            format string.\n\n        ","endLoc":1694,"header":"def strftime(self, format_spec)","id":3084,"name":"strftime","nodeType":"Function","startLoc":1660,"text":"def strftime(self, format_spec):\n        \"\"\"\n        Convert Time to a string or a numpy.array of strings according to a\n        format specification.\n        See `time.strftime` documentation for format specification.\n\n        Parameters\n        ----------\n        format_spec : str\n            Format definition of return string.\n\n        Returns\n        -------\n        formatted : str or numpy.array\n            String or numpy.array of strings formatted according to the given\n            format string.\n\n        \"\"\"\n        formatted_strings = []\n        for sk in self.replicate('iso')._time.str_kwargs():\n            date_tuple = date(sk['year'], sk['mon'], sk['day']).timetuple()\n            datetime_tuple = (sk['year'], sk['mon'], sk['day'],\n                              sk['hour'], sk['min'], sk['sec'],\n                              date_tuple[6], date_tuple[7], -1)\n            fmtd_str = format_spec\n            if '%f' in fmtd_str:\n                fmtd_str = fmtd_str.replace('%f', '{frac:0{precision}}'.format(\n                    frac=sk['fracsec'], precision=self.precision))\n            fmtd_str = strftime(fmtd_str, datetime_tuple)\n            formatted_strings.append(fmtd_str)\n\n        if self.isscalar:\n            return formatted_strings[0]\n        else:\n            return np.array(formatted_strings).reshape(self.shape)"},{"col":0,"comment":"\n    Given the column-specific time reference frame information, verify that\n    each column-specific time coordinate attribute has a valid value.\n    Return True if the coordinate column is time, or else return False.\n\n    Parameters\n    ----------\n    global_info : dict\n        Global time reference frame information.\n    column_info : dict\n        Column-specific time reference frame override information.\n    ","endLoc":276,"header":"def _verify_column_info(column_info, global_info)","id":3085,"name":"_verify_column_info","nodeType":"Function","startLoc":168,"text":"def _verify_column_info(column_info, global_info):\n    \"\"\"\n    Given the column-specific time reference frame information, verify that\n    each column-specific time coordinate attribute has a valid value.\n    Return True if the coordinate column is time, or else return False.\n\n    Parameters\n    ----------\n    global_info : dict\n        Global time reference frame information.\n    column_info : dict\n        Column-specific time reference frame override information.\n    \"\"\"\n\n    scale = column_info.get('TCTYP', None)\n    unit = column_info.get('TCUNI', None)\n    location = column_info.get('TRPOS', None)\n\n    if scale is not None:\n\n        # Non-linear coordinate types have \"4-3\" form and are not time coordinates\n        if TCTYP_RE_TYPE.match(scale[:5]) and TCTYP_RE_ALGO.match(scale[5:]):\n            return False\n\n        elif scale.lower() in Time.SCALES:\n            column_info['scale'] = scale.lower()\n            column_info['format'] = None\n\n        elif scale in FITS_DEPRECATED_SCALES.keys():\n            column_info['scale'] = FITS_DEPRECATED_SCALES[scale]\n            column_info['format'] = None\n\n        # TCTYPn (scale) = 'TIME' indicates that the column scale is\n        # controlled by the global scale.\n        elif scale == 'TIME':\n            column_info['scale'] = global_info['scale']\n            column_info['format'] = global_info['format']\n\n        elif scale == 'GPS':\n            warnings.warn(\n                'Table column \"{}\" has a FITS recognized time scale value \"GPS\". '\n                'In Astropy, \"GPS\" is a time from epoch format which runs '\n                'synchronously with TAI; GPS runs ahead of TAI approximately '\n                'by 19 s. Hence, this format will be used.'.format(column_info),\n                AstropyUserWarning)\n            column_info['scale'] = 'tai'\n            column_info['format'] = 'gps'\n\n        elif scale == 'LOCAL':\n            warnings.warn(\n                'Table column \"{}\" has a FITS recognized time scale value \"LOCAL\". '\n                'However, the standard states that \"LOCAL\" should be tied to one '\n                'of the existing scales because it is intrinsically unreliable '\n                'and/or ill-defined. Astropy will thus use the global time scale '\n                '(TIMESYS) as the default.'. format(column_info),\n                AstropyUserWarning)\n            column_info['scale'] = global_info['scale']\n            column_info['format'] = global_info['format']\n\n        else:\n            # Coordinate type is either an unrecognized local time scale\n            # or a linear coordinate type\n            return False\n\n    # If TCUNIn is a time unit or TRPOSn is specified, the column is a time\n    # coordinate. This has to be tested since TCTYP (scale) is not specified.\n    elif (unit is not None and unit in FITS_TIME_UNIT) or location is not None:\n        column_info['scale'] = global_info['scale']\n        column_info['format'] = global_info['format']\n\n    # None of the conditions for time coordinate columns is satisfied\n    else:\n        return False\n\n    # Check if column-specific reference position TRPOSn is specified\n    if location is not None:\n\n        # Observatory position (location) needs to be specified only\n        # for 'TOPOCENTER'.\n        if location == 'TOPOCENTER':\n            column_info['location'] = global_info['location']\n            if column_info['location'] is None:\n                warnings.warn(\n                    'Time column reference position \"TRPOSn\" value is \"TOPOCENTER\". '\n                    'However, the observatory position is not properly specified. '\n                    'The FITS standard does not support this and hence reference '\n                    'position will be ignored.', AstropyUserWarning)\n        else:\n            column_info['location'] = None\n\n    # Warn user about ignoring global reference position when TRPOSn is\n    # not specified\n    elif global_info['TREFPOS'] == 'TOPOCENTER':\n\n        if global_info['location'] is not None:\n            warnings.warn(\n                'Time column reference position \"TRPOSn\" is not specified. The '\n                'default value for it is \"TOPOCENTER\", and the observatory position '\n                'has been specified. However, for supporting column-specific location, '\n                'reference position will be ignored for this column.',\n                AstropyUserWarning)\n        column_info['location'] = None\n    else:\n        column_info['location'] = None\n\n    # Get reference time\n    column_info['ref_time'] = global_info['ref_time']\n\n    return True"},{"col":42,"endLoc":349,"id":3086,"nodeType":"Lambda","startLoc":349,"text":"lambda x: x not in (None, '')"},{"col":44,"endLoc":350,"id":3087,"nodeType":"Lambda","startLoc":350,"text":"lambda x: x is not None"},{"col":49,"endLoc":351,"id":3088,"nodeType":"Lambda","startLoc":351,"text":"lambda x: x is not None"},{"col":42,"endLoc":352,"id":3089,"nodeType":"Lambda","startLoc":352,"text":"lambda x: x"},{"col":0,"comment":"null","endLoc":285,"header":"def _construct_mixin_from_obj_attrs_and_info(obj_attrs, info)","id":3090,"name":"_construct_mixin_from_obj_attrs_and_info","nodeType":"Function","startLoc":266,"text":"def _construct_mixin_from_obj_attrs_and_info(obj_attrs, info):\n    cls_full_name = obj_attrs.pop('__class__')\n\n    # If this is a supported class then import the class and run\n    # the _construct_from_col method.  Prevent accidentally running\n    # untrusted code by only importing known astropy classes.\n    if cls_full_name not in __construct_mixin_classes:\n        raise ValueError(f'unsupported class for construct {cls_full_name}')\n\n    mod_name, cls_name = re.match(r'(.+)\\.(\\w+)', cls_full_name).groups()\n    module = import_module(mod_name)\n    cls = getattr(module, cls_name)\n    for attr, value in info.items():\n        if attr in cls.info.attrs_from_parent:\n            obj_attrs[attr] = value\n    mixin = cls.info._construct_from_dict(obj_attrs)\n    for attr, value in info.items():\n        if attr not in obj_attrs:\n            setattr(mixin.info, attr, value)\n    return mixin"},{"col":0,"comment":"\n    Given a slice as input sanitise it to an easier to parse format.format\n\n    This function returns a list ``ndim`` long containing slice objects (or ints).\n    ","endLoc":58,"header":"def sanitize_slices(slices, ndim)","id":3091,"name":"sanitize_slices","nodeType":"Function","startLoc":15,"text":"def sanitize_slices(slices, ndim):\n    \"\"\"\n    Given a slice as input sanitise it to an easier to parse format.format\n\n    This function returns a list ``ndim`` long containing slice objects (or ints).\n    \"\"\"\n\n    if not isinstance(slices, (tuple, list)):  # We just have a single int\n        slices = (slices,)\n\n    if len(slices) > ndim:\n        raise ValueError(\n            f\"The dimensionality of the specified slice {slices} can not be greater \"\n            f\"than the dimensionality ({ndim}) of the wcs.\")\n\n    if any((isiterable(s) for s in slices)):\n        raise IndexError(\"This slice is invalid, only integer or range slices are supported.\")\n\n    slices = list(slices)\n\n    if Ellipsis in slices:\n        if slices.count(Ellipsis) > 1:\n            raise IndexError(\"an index can only have a single ellipsis ('...')\")\n\n        # Replace the Ellipsis with the correct number of slice(None)s\n        e_ind = slices.index(Ellipsis)\n        slices.remove(Ellipsis)\n        n_e = ndim - len(slices)\n        for i in range(n_e):\n            ind = e_ind + i\n            slices.insert(ind, slice(None))\n\n    for i in range(ndim):\n        if i < len(slices):\n            slc = slices[i]\n            if isinstance(slc, slice):\n                if slc.step and slc.step != 1:\n                    raise IndexError(\"Slicing WCS with a step is not supported.\")\n            elif not isinstance(slc, numbers.Integral):\n                raise IndexError(\"Only integer or range slices are accepted.\")\n        else:\n            slices.append(slice(None))\n\n    return slices"},{"col":4,"comment":"Light travel time correction to the barycentre or heliocentre.\n\n        The frame transformations used to calculate the location of the solar\n        system barycentre and the heliocentre rely on the erfa routine epv00,\n        which is consistent with the JPL DE405 ephemeris to an accuracy of\n        11.2 km, corresponding to a light travel time of 4 microseconds.\n\n        The routine assumes the source(s) are at large distance, i.e., neglects\n        finite-distance effects.\n\n        Parameters\n        ----------\n        skycoord : `~astropy.coordinates.SkyCoord`\n            The sky location to calculate the correction for.\n        kind : str, optional\n            ``'barycentric'`` (default) or ``'heliocentric'``\n        location : `~astropy.coordinates.EarthLocation`, optional\n            The location of the observatory to calculate the correction for.\n            If no location is given, the ``location`` attribute of the Time\n            object is used\n        ephemeris : str, optional\n            Solar system ephemeris to use (e.g., 'builtin', 'jpl'). By default,\n            use the one set with ``astropy.coordinates.solar_system_ephemeris.set``.\n            For more information, see `~astropy.coordinates.solar_system_ephemeris`.\n\n        Returns\n        -------\n        time_offset : `~astropy.time.TimeDelta`\n            The time offset between the barycentre or Heliocentre and Earth,\n            in TDB seconds.  Should be added to the original time to get the\n            time in the Solar system barycentre or the Heliocentre.\n            Also, the time conversion to BJD will then include the relativistic correction as well.\n        ","endLoc":1776,"header":"def light_travel_time(self, skycoord, kind='barycentric', location=None, ephemeris=None)","id":3092,"name":"light_travel_time","nodeType":"Function","startLoc":1696,"text":"def light_travel_time(self, skycoord, kind='barycentric', location=None, ephemeris=None):\n        \"\"\"Light travel time correction to the barycentre or heliocentre.\n\n        The frame transformations used to calculate the location of the solar\n        system barycentre and the heliocentre rely on the erfa routine epv00,\n        which is consistent with the JPL DE405 ephemeris to an accuracy of\n        11.2 km, corresponding to a light travel time of 4 microseconds.\n\n        The routine assumes the source(s) are at large distance, i.e., neglects\n        finite-distance effects.\n\n        Parameters\n        ----------\n        skycoord : `~astropy.coordinates.SkyCoord`\n            The sky location to calculate the correction for.\n        kind : str, optional\n            ``'barycentric'`` (default) or ``'heliocentric'``\n        location : `~astropy.coordinates.EarthLocation`, optional\n            The location of the observatory to calculate the correction for.\n            If no location is given, the ``location`` attribute of the Time\n            object is used\n        ephemeris : str, optional\n            Solar system ephemeris to use (e.g., 'builtin', 'jpl'). By default,\n            use the one set with ``astropy.coordinates.solar_system_ephemeris.set``.\n            For more information, see `~astropy.coordinates.solar_system_ephemeris`.\n\n        Returns\n        -------\n        time_offset : `~astropy.time.TimeDelta`\n            The time offset between the barycentre or Heliocentre and Earth,\n            in TDB seconds.  Should be added to the original time to get the\n            time in the Solar system barycentre or the Heliocentre.\n            Also, the time conversion to BJD will then include the relativistic correction as well.\n        \"\"\"\n\n        if kind.lower() not in ('barycentric', 'heliocentric'):\n            raise ValueError(\"'kind' parameter must be one of 'heliocentric' \"\n                             \"or 'barycentric'\")\n\n        if location is None:\n            if self.location is None:\n                raise ValueError('An EarthLocation needs to be set or passed '\n                                 'in to calculate bary- or heliocentric '\n                                 'corrections')\n            location = self.location\n\n        from astropy.coordinates import (UnitSphericalRepresentation, CartesianRepresentation,\n                                         HCRS, ICRS, GCRS, solar_system_ephemeris)\n\n        # ensure sky location is ICRS compatible\n        if not skycoord.is_transformable_to(ICRS()):\n            raise ValueError(\"Given skycoord is not transformable to the ICRS\")\n\n        # get location of observatory in ITRS coordinates at this Time\n        try:\n            itrs = location.get_itrs(obstime=self)\n        except Exception:\n            raise ValueError(\"Supplied location does not have a valid `get_itrs` method\")\n\n        with solar_system_ephemeris.set(ephemeris):\n            if kind.lower() == 'heliocentric':\n                # convert to heliocentric coordinates, aligned with ICRS\n                cpos = itrs.transform_to(HCRS(obstime=self)).cartesian.xyz\n            else:\n                # first we need to convert to GCRS coordinates with the correct\n                # obstime, since ICRS coordinates have no frame time\n                gcrs_coo = itrs.transform_to(GCRS(obstime=self))\n                # convert to barycentric (BCRS) coordinates, aligned with ICRS\n                cpos = gcrs_coo.transform_to(ICRS()).cartesian.xyz\n\n        # get unit ICRS vector to star\n        spos = (skycoord.icrs.represent_as(UnitSphericalRepresentation).\n                represent_as(CartesianRepresentation).xyz)\n\n        # Move X,Y,Z to last dimension, to enable possible broadcasting below.\n        cpos = np.rollaxis(cpos, 0, cpos.ndim)\n        spos = np.rollaxis(spos, 0, spos.ndim)\n\n        # calculate light travel time correction\n        tcor_val = (spos * cpos).sum(axis=-1) / const.c\n        return TimeDelta(tcor_val, scale='tdb')"},{"attributeType":"null","col":8,"comment":"null","endLoc":295,"id":3093,"name":"tag","nodeType":"Attribute","startLoc":295,"text":"tag"},{"col":0,"comment":"","endLoc":57,"header":"yaml.py#<anonymous>","id":3094,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module contains functions for serializing core astropy objects via the\nYAML protocol.\nIt provides functions `~astropy.io.misc.yaml.dump`,\n`~astropy.io.misc.yaml.load`, and `~astropy.io.misc.yaml.load_all` which\ncall the corresponding functions in `PyYaml <https://pyyaml.org>`_ but use the\n`~astropy.io.misc.yaml.AstropyDumper` and `~astropy.io.misc.yaml.AstropyLoader`\nclasses to define custom YAML tags for the following astropy classes:\n- `astropy.units.Unit`\n- `astropy.units.Quantity`\n- `astropy.time.Time`\n- `astropy.time.TimeDelta`\n- `astropy.coordinates.SkyCoord`\n- `astropy.coordinates.Angle`\n- `astropy.coordinates.Latitude`\n- `astropy.coordinates.Longitude`\n- `astropy.coordinates.EarthLocation`\n- `astropy.table.SerializedColumn`\n\nExample\n=======\n::\n  >>> from astropy.io.misc import yaml\n  >>> import astropy.units as u\n  >>> from astropy.time import Time\n  >>> from astropy.coordinates import EarthLocation\n  >>> t = Time(2457389.0, format='mjd',\n  ...          location=EarthLocation(1000, 2000, 3000, unit=u.km))\n  >>> td = yaml.dump(t)\n  >>> print(td)\n  !astropy.time.Time\n  format: mjd\n  in_subfmt: '*'\n  jd1: 4857390.0\n  jd2: -0.5\n  location: !astropy.coordinates.earth.EarthLocation\n    ellipsoid: WGS84\n    x: !astropy.units.Quantity\n      unit: &id001 !astropy.units.Unit {unit: km}\n      value: 1000.0\n    y: !astropy.units.Quantity\n      unit: *id001\n      value: 2000.0\n    z: !astropy.units.Quantity\n      unit: *id001\n      value: 3000.0\n  out_subfmt: '*'\n  precision: 3\n  scale: utc\n  >>> ty = yaml.load(td)\n  >>> ty\n  <Time object: scale='utc' format='mjd' value=2457389.0>\n  >>> ty.location  # doctest: +FLOAT_CMP\n  <EarthLocation (1000., 2000., 3000.) km>\n\"\"\"\n\n__all__ = ['AstropyLoader', 'AstropyDumper', 'load', 'load_all', 'dump']\n\nAstropyDumper.add_multi_representer(u.UnitBase, _unit_representer)\n\nAstropyDumper.add_multi_representer(u.FunctionUnitBase, _unit_representer)\n\nAstropyDumper.add_multi_representer(u.StructuredUnit, _unit_representer)\n\nAstropyDumper.add_representer(tuple, AstropyDumper._represent_tuple)\n\nAstropyDumper.add_representer(np.ndarray, _ndarray_representer)\n\nAstropyDumper.add_representer(np.void, _void_representer)\n\nAstropyDumper.add_representer(Time, _time_representer)\n\nAstropyDumper.add_representer(TimeDelta, _timedelta_representer)\n\nAstropyDumper.add_representer(coords.SkyCoord, _skycoord_representer)\n\nAstropyDumper.add_representer(SerializedColumn, _serialized_column_representer)\n\nAstropyDumper.add_representer(np.bool_, yaml.representer.SafeRepresenter.represent_bool)\n\nfor np_type in [np.int_, np.intc, np.intp, np.int8, np.int16, np.int32,\n                np.int64, np.uint8, np.uint16, np.uint32, np.uint64]:\n    AstropyDumper.add_representer(np_type,\n                                    yaml.representer.SafeRepresenter.represent_int)\n\nfor np_type in [np.float_, np.float16, np.float32, np.float64,\n                np.longdouble]:\n    AstropyDumper.add_representer(np_type,\n                                    yaml.representer.SafeRepresenter.represent_float)\n\nfor np_type in [np.complex_, complex, np.complex64, np.complex128]:\n    AstropyDumper.add_representer(np_type, _complex_representer)\n\nAstropyLoader.add_constructor('tag:yaml.org,2002:python/complex',\n                                _complex_constructor)\n\nAstropyLoader.add_constructor('tag:yaml.org,2002:python/tuple',\n                                AstropyLoader._construct_python_tuple)\n\nAstropyLoader.add_constructor('tag:yaml.org,2002:python/unicode',\n                                AstropyLoader._construct_python_unicode)\n\nAstropyLoader.add_constructor('!astropy.units.Unit', _unit_constructor)\n\nAstropyLoader.add_constructor('!numpy.ndarray', _ndarray_constructor)\n\nAstropyLoader.add_constructor('!numpy.void', _void_constructor)\n\nAstropyLoader.add_constructor('!astropy.time.Time', _time_constructor)\n\nAstropyLoader.add_constructor('!astropy.time.TimeDelta', _timedelta_constructor)\n\nAstropyLoader.add_constructor('!astropy.coordinates.sky_coordinate.SkyCoord',\n                                _skycoord_constructor)\n\nAstropyLoader.add_constructor('!astropy.table.SerializedColumn',\n                                _serialized_column_constructor)\n\nfor cls, tag in ((u.Quantity, '!astropy.units.Quantity'),\n                    (u.Magnitude, '!astropy.units.Magnitude'),\n                    (u.Dex, '!astropy.units.Dex'),\n                    (u.Decibel, '!astropy.units.Decibel'),\n                    (coords.Angle, '!astropy.coordinates.Angle'),\n                    (coords.Latitude, '!astropy.coordinates.Latitude'),\n                    (coords.Longitude, '!astropy.coordinates.Longitude'),\n                    (coords.EarthLocation, '!astropy.coordinates.earth.EarthLocation')):\n    AstropyDumper.add_multi_representer(cls, _quantity_representer(tag))\n    AstropyLoader.add_constructor(tag, _quantity_constructor(cls))\n\nfor cls in (list(coords.representation.REPRESENTATION_CLASSES.values())\n            + list(coords.representation.DIFFERENTIAL_CLASSES.values())):\n    name = cls.__name__\n    # Add representations/differentials defined in astropy.\n    if name in coords.representation.__all__:\n        tag = '!astropy.coordinates.' + name\n        AstropyDumper.add_multi_representer(cls, _quantity_representer(tag))\n        AstropyLoader.add_constructor(tag, _quantity_constructor(cls))"},{"col":0,"comment":"\n    Write a Table object to a Parquet file\n\n    This requires `pyarrow <https://arrow.apache.org/docs/python/>`_\n    to be installed.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        Data table that is to be written to file.\n    output : str or path-like\n        The filename to write the table to.\n    overwrite : bool, optional\n        Whether to overwrite any existing file without warning. Default `False`.\n    ","endLoc":316,"header":"def write_table_parquet(table, output, overwrite=False)","id":3095,"name":"write_table_parquet","nodeType":"Function","startLoc":247,"text":"def write_table_parquet(table, output, overwrite=False):\n    \"\"\"\n    Write a Table object to a Parquet file\n\n    This requires `pyarrow <https://arrow.apache.org/docs/python/>`_\n    to be installed.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        Data table that is to be written to file.\n    output : str or path-like\n        The filename to write the table to.\n    overwrite : bool, optional\n        Whether to overwrite any existing file without warning. Default `False`.\n    \"\"\"\n\n    from astropy.table import meta, serialize\n    from astropy.utils.data_info import serialize_context_as\n\n    pa, parquet, writer_version = get_pyarrow()\n\n    if not isinstance(output, (str, os.PathLike)):\n        raise TypeError(f'`output` should be a string or path-like, not {output}')\n\n    # Convert all compound columns into serialized column names, where\n    # e.g. 'time' becomes ['time.jd1', 'time.jd2'].\n    with serialize_context_as('parquet'):\n        encode_table = serialize.represent_mixins_as_columns(table)\n    # We store the encoded serialization metadata as a yaml string.\n    meta_yaml = meta.get_yaml_from_table(encode_table)\n    meta_yaml_str = '\\n'.join(meta_yaml)\n\n    metadata = {}\n    for name, col in encode_table.columns.items():\n        # Parquet will retain the datatypes of columns, but string and\n        # byte column length is lost.  Therefore, we special-case these\n        # types to record the length for precise round-tripping.\n        if col.dtype.type is np.str_:\n            metadata[f'table::len::{name}'] = str(col.dtype.itemsize//4)\n        elif col.dtype.type is np.bytes_:\n            metadata[f'table::len::{name}'] = str(col.dtype.itemsize)\n\n        metadata['table_meta_yaml'] = meta_yaml_str\n\n    # Pyarrow stores all metadata as byte strings, so we explicitly encode\n    # our unicode strings in metadata as UTF-8 byte strings here.\n    metadata_encode = {k.encode('UTF-8'): v.encode('UTF-8') for k, v in metadata.items()}\n\n    # Build the pyarrow schema by converting from the numpy dtype of each\n    # column to an equivalent pyarrow type with from_numpy_dtype()\n    type_list = [(name, pa.from_numpy_dtype(encode_table.dtype[name].type))\n                 for name in encode_table.dtype.names]\n    schema = pa.schema(type_list, metadata=metadata_encode)\n\n    if os.path.exists(output):\n        if overwrite:\n            # We must remove the file prior to writing below.\n            os.remove(output)\n        else:\n            raise OSError(NOT_OVERWRITING_MSG.format(output))\n\n    # We use version='2.0' for full support of datatypes including uint32.\n    with parquet.ParquetWriter(output, schema, version=writer_version) as writer:\n        # Convert each Table column to a pyarrow array\n        arrays = [pa.array(col) for col in encode_table.itercols()]\n        # Create a pyarrow table from the list of arrays and the schema\n        pa_table = pa.Table.from_arrays(arrays, schema=schema)\n        # Write the pyarrow table to a file\n        writer.write_table(pa_table)"},{"col":0,"comment":"\n    Check if a column without corresponding time column keywords in the\n    FITS header represents time or not. If yes, return the time column\n    information needed for its conversion to Time.\n    This is only applicable to the special-case where a column has the\n    name 'TIME' and a time unit.\n    ","endLoc":306,"header":"def _get_info_if_time_column(col, global_info)","id":3096,"name":"_get_info_if_time_column","nodeType":"Function","startLoc":279,"text":"def _get_info_if_time_column(col, global_info):\n    \"\"\"\n    Check if a column without corresponding time column keywords in the\n    FITS header represents time or not. If yes, return the time column\n    information needed for its conversion to Time.\n    This is only applicable to the special-case where a column has the\n    name 'TIME' and a time unit.\n    \"\"\"\n\n    # Column with TTYPEn = 'TIME' and lacking any TC*n or time\n    # specific keywords will be controlled by the global keywords.\n    if col.info.name.upper() == 'TIME' and col.info.unit in FITS_TIME_UNIT:\n        column_info = {'scale': global_info['scale'],\n                       'format': global_info['format'],\n                       'ref_time': global_info['ref_time'],\n                       'location': None}\n\n        if global_info['TREFPOS'] == 'TOPOCENTER':\n            column_info['location'] = global_info['location']\n            if column_info['location'] is None:\n                warnings.warn(\n                    'Time column \"{}\" reference position will be ignored '\n                    'due to unspecified observatory position.'.format(col.info.name),\n                    AstropyUserWarning)\n\n        return column_info\n\n    return None"},{"col":0,"comment":"Set context for serialization.\n\n    This will allow downstream code to understand the context in which a column\n    is being serialized.  Objects like Time or SkyCoord will have different\n    default serialization representations depending on context.\n\n    Parameters\n    ----------\n    context : str\n        Context name, e.g. 'fits', 'hdf5', 'parquet', 'ecsv', 'yaml'\n    ","endLoc":61,"header":"@contextmanager\ndef serialize_context_as(context)","id":3097,"name":"serialize_context_as","nodeType":"Function","startLoc":43,"text":"@contextmanager\ndef serialize_context_as(context):\n    \"\"\"Set context for serialization.\n\n    This will allow downstream code to understand the context in which a column\n    is being serialized.  Objects like Time or SkyCoord will have different\n    default serialization representations depending on context.\n\n    Parameters\n    ----------\n    context : str\n        Context name, e.g. 'fits', 'hdf5', 'parquet', 'ecsv', 'yaml'\n    \"\"\"\n    old_context = BaseColumnInfo._serialize_context\n    BaseColumnInfo._serialize_context = context\n    try:\n        yield\n    finally:\n        BaseColumnInfo._serialize_context = old_context"},{"col":0,"comment":"\n    Return lines with a YAML representation of header content from the ``table``.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table` object\n        Table for which header content is output\n\n    Returns\n    -------\n    lines : list\n        List of text lines with YAML header content\n    ","endLoc":298,"header":"def get_yaml_from_table(table)","id":3098,"name":"get_yaml_from_table","nodeType":"Function","startLoc":279,"text":"def get_yaml_from_table(table):\n    \"\"\"\n    Return lines with a YAML representation of header content from the ``table``.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table` object\n        Table for which header content is output\n\n    Returns\n    -------\n    lines : list\n        List of text lines with YAML header content\n    \"\"\"\n\n    header = {'cols': list(table.columns.values())}\n    if table.meta:\n        header['meta'] = table.meta\n\n    return get_yaml_from_header(header)"},{"col":0,"comment":"\n    Given two slices that can be applied to a 1-d array, find the resulting\n    slice that corresponds to the combination of both slices. We assume that\n    slice2 can be an integer, but slice1 cannot.\n    ","endLoc":102,"header":"def combine_slices(slice1, slice2)","id":3099,"name":"combine_slices","nodeType":"Function","startLoc":61,"text":"def combine_slices(slice1, slice2):\n    \"\"\"\n    Given two slices that can be applied to a 1-d array, find the resulting\n    slice that corresponds to the combination of both slices. We assume that\n    slice2 can be an integer, but slice1 cannot.\n    \"\"\"\n\n    if isinstance(slice1, slice) and slice1.step is not None:\n        raise ValueError('Only slices with steps of 1 are supported')\n\n    if isinstance(slice2, slice) and slice2.step is not None:\n        raise ValueError('Only slices with steps of 1 are supported')\n\n    if isinstance(slice2, numbers.Integral):\n        if slice1.start is None:\n            return slice2\n        else:\n            return slice2 + slice1.start\n\n    if slice1.start is None:\n        if slice1.stop is None:\n            return slice2\n        else:\n            if slice2.stop is None:\n                return slice(slice2.start, slice1.stop)\n            else:\n                return slice(slice2.start, min(slice1.stop, slice2.stop))\n    else:\n        if slice2.start is None:\n            start = slice1.start\n        else:\n            start = slice1.start + slice2.start\n        if slice2.stop is None:\n            stop = slice1.stop\n        else:\n            if slice1.start is None:\n                stop = slice2.stop\n            else:\n                stop = slice2.stop + slice1.start\n            if slice1.stop is not None:\n                stop = min(slice1.stop, stop)\n    return slice(start, stop)"},{"col":0,"comment":"\n    Return lines with a YAML representation of header content from a Table.\n\n    The ``header`` dict must contain these keys:\n\n    - 'cols' : list of table column objects (required)\n    - 'meta' : table 'meta' attribute (optional)\n\n    Other keys included in ``header`` will be serialized in the output YAML\n    representation.\n\n    Parameters\n    ----------\n    header : dict\n        Table header content\n\n    Returns\n    -------\n    lines : list\n        List of text lines with YAML header content\n    ","endLoc":378,"header":"def get_yaml_from_header(header)","id":3100,"name":"get_yaml_from_header","nodeType":"Function","startLoc":301,"text":"def get_yaml_from_header(header):\n    \"\"\"\n    Return lines with a YAML representation of header content from a Table.\n\n    The ``header`` dict must contain these keys:\n\n    - 'cols' : list of table column objects (required)\n    - 'meta' : table 'meta' attribute (optional)\n\n    Other keys included in ``header`` will be serialized in the output YAML\n    representation.\n\n    Parameters\n    ----------\n    header : dict\n        Table header content\n\n    Returns\n    -------\n    lines : list\n        List of text lines with YAML header content\n    \"\"\"\n    from astropy.io.misc.yaml import AstropyDumper\n\n    class TableDumper(AstropyDumper):\n        \"\"\"\n        Custom Dumper that represents OrderedDict as an !!omap object.\n        \"\"\"\n\n        def represent_mapping(self, tag, mapping, flow_style=None):\n            \"\"\"\n            This is a combination of the Python 2 and 3 versions of this method\n            in the PyYAML library to allow the required key ordering via the\n            ColumnOrderList object.  The Python 3 version insists on turning the\n            items() mapping into a list object and sorting, which results in\n            alphabetical order for the column keys.\n            \"\"\"\n            value = []\n            node = yaml.MappingNode(tag, value, flow_style=flow_style)\n            if self.alias_key is not None:\n                self.represented_objects[self.alias_key] = node\n            best_style = True\n            if hasattr(mapping, 'items'):\n                mapping = mapping.items()\n                if hasattr(mapping, 'sort'):\n                    mapping.sort()\n                else:\n                    mapping = list(mapping)\n                    try:\n                        mapping = sorted(mapping)\n                    except TypeError:\n                        pass\n\n            for item_key, item_value in mapping:\n                node_key = self.represent_data(item_key)\n                node_value = self.represent_data(item_value)\n                if not (isinstance(node_key, yaml.ScalarNode) and not node_key.style):\n                    best_style = False\n                if not (isinstance(node_value, yaml.ScalarNode) and not node_value.style):\n                    best_style = False\n                value.append((node_key, node_value))\n            if flow_style is None:\n                if self.default_flow_style is not None:\n                    node.flow_style = self.default_flow_style\n                else:\n                    node.flow_style = best_style\n            return node\n\n    TableDumper.add_representer(OrderedDict, _repr_odict)\n    TableDumper.add_representer(ColumnDict, _repr_column_dict)\n\n    header = copy.copy(header)  # Don't overwrite original\n    header['datatype'] = [_get_col_attributes(col) for col in header['cols']]\n    del header['cols']\n\n    lines = yaml.dump(header, default_flow_style=None,\n                      Dumper=TableDumper, width=130).splitlines()\n    return lines"},{"col":0,"comment":"\n    Convert the table metadata for time informational keywords\n    to astropy Time.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        The table whose time metadata is to be converted.\n    global_info : dict\n        Global time reference frame information.\n    ","endLoc":328,"header":"def _convert_global_time(table, global_info)","id":3101,"name":"_convert_global_time","nodeType":"Function","startLoc":309,"text":"def _convert_global_time(table, global_info):\n    \"\"\"\n    Convert the table metadata for time informational keywords\n    to astropy Time.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        The table whose time metadata is to be converted.\n    global_info : dict\n        Global time reference frame information.\n    \"\"\"\n    # Read in Global Informational keywords as Time\n    for key, value in global_info.items():\n        # FITS uses a subset of ISO-8601 for DATE-xxx\n        if key not in table.meta:\n            try:\n                table.meta[key] = _convert_time_key(global_info, key)\n            except ValueError:\n                pass"},{"col":0,"comment":"\n    Convert a time metadata key to a Time object.\n\n    Parameters\n    ----------\n    global_info : dict\n        Global time reference frame information.\n    key : str\n        Time key.\n\n    Returns\n    -------\n    astropy.time.Time\n\n    Raises\n    ------\n    ValueError\n        If key is not a valid global time keyword.\n    ","endLoc":362,"header":"def _convert_time_key(global_info, key)","id":3102,"name":"_convert_time_key","nodeType":"Function","startLoc":331,"text":"def _convert_time_key(global_info, key):\n    \"\"\"\n    Convert a time metadata key to a Time object.\n\n    Parameters\n    ----------\n    global_info : dict\n        Global time reference frame information.\n    key : str\n        Time key.\n\n    Returns\n    -------\n    astropy.time.Time\n\n    Raises\n    ------\n    ValueError\n        If key is not a valid global time keyword.\n    \"\"\"\n    value = global_info[key]\n    if key.startswith('DATE'):\n        scale = 'utc' if key == 'DATE' else global_info['scale']\n        precision = len(value.split('.')[-1]) if '.' in value else 0\n        return Time(value, format='fits', scale=scale,\n                    precision=precision)\n    # MJD-xxx in MJD according to TIMESYS\n    elif key.startswith('MJD-'):\n        return Time(value, format='mjd',\n                    scale=global_info['scale'])\n    else:\n        raise ValueError('Key is not a valid global time keyword')"},{"col":4,"comment":"null","endLoc":3167,"header":"def __getitem__(self, item)","id":3103,"name":"__getitem__","nodeType":"Function","startLoc":3162,"text":"def __getitem__(self, item):\n        # \"getitem\" is a shortcut for self.slice; it is very limited\n        # there is no obvious and unambiguous interpretation of wcs[1,2,3]\n        # We COULD allow wcs[1] to link to wcs.sub([2])\n        # (wcs[i] -> wcs.sub([i+1])\n        return self.slice(item)"},{"col":4,"comment":"null","endLoc":3173,"header":"def __iter__(self)","id":3104,"name":"__iter__","nodeType":"Function","startLoc":3169,"text":"def __iter__(self):\n        # Having __getitem__ makes Python think WCS is iterable. However,\n        # Python first checks whether __iter__ is present, so we can raise an\n        # exception here.\n        raise TypeError(f\"'{self.__class__.__name__}' object is not iterable\")"},{"col":4,"comment":"\n        World names for each coordinate axis\n\n        Returns\n        -------\n        list of str\n            A list of names along each axis.\n        ","endLoc":3191,"header":"@property\n    def axis_type_names(self)","id":3105,"name":"axis_type_names","nodeType":"Function","startLoc":3175,"text":"@property\n    def axis_type_names(self):\n        \"\"\"\n        World names for each coordinate axis\n\n        Returns\n        -------\n        list of str\n            A list of names along each axis.\n        \"\"\"\n        names = list(self.wcs.cname)\n        types = self.wcs.ctype\n        for i in range(len(names)):\n            if len(names[i]) > 0:\n                continue\n            names[i] = types[i].split('-')[0]\n        return names"},{"col":0,"comment":"\n    Extract information from a column (apart from the values) that is required\n    to fully serialize the column.\n\n    Parameters\n    ----------\n    col : column-like\n        Input Table column\n\n    Returns\n    -------\n    attrs : dict\n        Dict of ECSV attributes for ``col``\n    ","endLoc":276,"header":"def _get_col_attributes(col)","id":3106,"name":"_get_col_attributes","nodeType":"Function","startLoc":221,"text":"def _get_col_attributes(col):\n    \"\"\"\n    Extract information from a column (apart from the values) that is required\n    to fully serialize the column.\n\n    Parameters\n    ----------\n    col : column-like\n        Input Table column\n\n    Returns\n    -------\n    attrs : dict\n        Dict of ECSV attributes for ``col``\n    \"\"\"\n    dtype = col.info.dtype  # Type of column values that get written\n    subtype = None  # Type of data for object columns serialized with JSON\n    shape = col.shape[1:]  # Shape of multidim / variable length columns\n\n    if dtype.name == 'object':\n        if shape == ():\n            # 1-d object type column might be a variable length array\n            dtype = np.dtype(str)\n            shape, subtype = _get_variable_length_array_shape(col)\n        else:\n            # N-d object column is subtype object but serialized as JSON string\n            dtype = np.dtype(str)\n            subtype = np.dtype(object)\n    elif shape:\n        # N-d column which is not object is serialized as JSON string\n        dtype = np.dtype(str)\n        subtype = col.info.dtype\n\n    datatype = _get_datatype_from_dtype(dtype)\n\n    # Set the output attributes\n    attrs = ColumnDict()\n    attrs['name'] = col.info.name\n    attrs['datatype'] = datatype\n    for attr, nontrivial, xform in (('unit', lambda x: x is not None, str),\n                                    ('format', lambda x: x is not None, None),\n                                    ('description', lambda x: x is not None, None),\n                                    ('meta', lambda x: x, None)):\n        col_attr = getattr(col.info, attr)\n        if nontrivial(col_attr):\n            attrs[attr] = xform(col_attr) if xform else col_attr\n\n    if subtype:\n        attrs['subtype'] = _get_datatype_from_dtype(subtype)\n        # Numpy 'object' maps to 'subtype' of 'json' in ECSV\n        if attrs['subtype'] == 'object':\n            attrs['subtype'] = 'json'\n    if shape:\n        attrs['subtype'] += json.dumps(list(shape), separators=(',', ':'))\n\n    return attrs"},{"fileName":"connect.py","filePath":"astropy/io/misc","id":3107,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# This file connects any readers/writers defined in io.misc to the\n# astropy.table.Table class\n\nfrom . import hdf5\nfrom . import parquet\n\nhdf5.register_hdf5()\nparquet.register_parquet()\n"},{"col":0,"comment":"Check if object-type ``col`` is really a variable length list.\n\n    That is true if the object consists purely of list of nested lists, where\n    the shape of every item can be represented as (m, n, ..., *) where the (m,\n    n, ...) are constant and only the lists in the last axis have variable\n    shape. If so the returned value of shape will be a tuple in the form (m, n,\n    ..., None).\n\n    If ``col`` is a variable length array then the return ``dtype`` corresponds\n    to the type found by numpy for all the individual values. Otherwise it will\n    be ``np.dtype(object)``.\n\n    Parameters\n    ==========\n    col : column-like\n        Input table column, assumed to be object-type\n\n    Returns\n    =======\n    shape : tuple\n        Inferred variable length shape or None\n    dtype : np.dtype\n        Numpy dtype that applies to col\n    ","endLoc":208,"header":"def _get_variable_length_array_shape(col)","id":3108,"name":"_get_variable_length_array_shape","nodeType":"Function","startLoc":159,"text":"def _get_variable_length_array_shape(col):\n    \"\"\"Check if object-type ``col`` is really a variable length list.\n\n    That is true if the object consists purely of list of nested lists, where\n    the shape of every item can be represented as (m, n, ..., *) where the (m,\n    n, ...) are constant and only the lists in the last axis have variable\n    shape. If so the returned value of shape will be a tuple in the form (m, n,\n    ..., None).\n\n    If ``col`` is a variable length array then the return ``dtype`` corresponds\n    to the type found by numpy for all the individual values. Otherwise it will\n    be ``np.dtype(object)``.\n\n    Parameters\n    ==========\n    col : column-like\n        Input table column, assumed to be object-type\n\n    Returns\n    =======\n    shape : tuple\n        Inferred variable length shape or None\n    dtype : np.dtype\n        Numpy dtype that applies to col\n    \"\"\"\n    class ConvertError(ValueError):\n        \"\"\"Local conversion error used below\"\"\"\n\n    # Numpy types supported as variable-length arrays\n    np_classes = (np.floating, np.integer, np.bool_, np.unicode_)\n\n    try:\n        if len(col) == 0 or not all(isinstance(val, np.ndarray) for val in col):\n            raise ConvertError\n        dtype = col[0].dtype\n        shape = col[0].shape[:-1]\n        for val in col:\n            if not issubclass(val.dtype.type, np_classes) or val.shape[:-1] != shape:\n                raise ConvertError\n            dtype = np.promote_types(dtype, val.dtype)\n        shape = shape + (None,)\n\n    except ConvertError:\n        # `col` is not a variable length array, return shape and dtype to\n        #  the original. Note that this function is only called if\n        #  col.shape[1:] was () and col.info.dtype is object.\n        dtype = col.info.dtype\n        shape = ()\n\n    return shape, dtype"},{"col":4,"comment":"\n        A copy of the current WCS with only the celestial axes included\n        ","endLoc":3198,"header":"@property\n    def celestial(self)","id":3109,"name":"celestial","nodeType":"Function","startLoc":3193,"text":"@property\n    def celestial(self):\n        \"\"\"\n        A copy of the current WCS with only the celestial axes included\n        \"\"\"\n        return self.sub([WCSSUB_CELESTIAL])  # Defined by C-ext  # noqa: F821"},{"col":0,"comment":"","endLoc":5,"header":"connect.py#<anonymous>","id":3110,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"hdf5.register_hdf5()\n\nparquet.register_parquet()"},{"col":0,"comment":"\n    Register HDF5 with Unified I/O.\n    ","endLoc":378,"header":"def register_hdf5()","id":3111,"name":"register_hdf5","nodeType":"Function","startLoc":369,"text":"def register_hdf5():\n    \"\"\"\n    Register HDF5 with Unified I/O.\n    \"\"\"\n    from astropy.io import registry as io_registry\n    from astropy.table import Table\n\n    io_registry.register_reader('hdf5', Table, read_table_hdf5)\n    io_registry.register_writer('hdf5', Table, write_table_hdf5)\n    io_registry.register_identifier('hdf5', Table, is_hdf5)"},{"col":0,"comment":"\n    Convert time columns to astropy Time columns.\n\n    Parameters\n    ----------\n    col : `~astropy.table.Column`\n        The time coordinate column to be converted to Time.\n    column_info : dict\n        Column-specific time reference frame override information.\n    ","endLoc":423,"header":"def _convert_time_column(col, column_info)","id":3112,"name":"_convert_time_column","nodeType":"Function","startLoc":365,"text":"def _convert_time_column(col, column_info):\n    \"\"\"\n    Convert time columns to astropy Time columns.\n\n    Parameters\n    ----------\n    col : `~astropy.table.Column`\n        The time coordinate column to be converted to Time.\n    column_info : dict\n        Column-specific time reference frame override information.\n    \"\"\"\n\n    # The code might fail while attempting to read FITS files not written by astropy.\n    try:\n        # ISO-8601 is the only string representation of time in FITS\n        if col.info.dtype.kind in ['S', 'U']:\n            # [+/-C]CCYY-MM-DD[Thh:mm:ss[.s...]] where the number of characters\n            # from index 20 to the end of string represents the precision\n            precision = max(int(col.info.dtype.str[2:]) - 20, 0)\n            return Time(col, format='fits', scale=column_info['scale'],\n                        precision=precision,\n                        location=column_info['location'])\n\n        if column_info['format'] == 'gps':\n            return Time(col, format='gps', location=column_info['location'])\n\n        # If reference value is 0 for JD or MJD, the column values can be\n        # directly converted to Time, as they are absolute (relative\n        # to a globally accepted zero point).\n        if (column_info['ref_time']['val'] == 0 and\n                column_info['ref_time']['format'] in ['jd', 'mjd']):\n            # (jd1, jd2) where jd = jd1 + jd2\n            if col.shape[-1] == 2 and col.ndim > 1:\n                return Time(col[..., 0], col[..., 1], scale=column_info['scale'],\n                            format=column_info['ref_time']['format'],\n                            location=column_info['location'])\n            else:\n                return Time(col, scale=column_info['scale'],\n                            format=column_info['ref_time']['format'],\n                            location=column_info['location'])\n\n        # Reference time\n        ref_time = Time(column_info['ref_time']['val'], scale=column_info['scale'],\n                        format=column_info['ref_time']['format'],\n                        location=column_info['location'])\n\n        # Elapsed time since reference time\n        if col.shape[-1] == 2 and col.ndim > 1:\n            delta_time = TimeDelta(col[..., 0], col[..., 1])\n        else:\n            delta_time = TimeDelta(col)\n\n        return ref_time + delta_time\n    except Exception as err:\n        warnings.warn(\n            'The exception \"{}\" was encountered while trying to convert the time '\n            'column \"{}\" to Astropy Time.'.format(err, col.info.name),\n            AstropyUserWarning)\n        return col"},{"col":4,"comment":"null","endLoc":3202,"header":"@property\n    def is_celestial(self)","id":3113,"name":"is_celestial","nodeType":"Function","startLoc":3200,"text":"@property\n    def is_celestial(self):\n        return self.has_celestial and self.naxis == 2"},{"col":4,"comment":"null","endLoc":3209,"header":"@property\n    def has_celestial(self)","id":3114,"name":"has_celestial","nodeType":"Function","startLoc":3204,"text":"@property\n    def has_celestial(self):\n        try:\n            return self.wcs.lng >= 0 and self.wcs.lat >= 0\n        except InconsistentAxisTypesError:\n            return False"},{"col":4,"comment":"\n        A copy of the current WCS with only the spectral axes included\n        ","endLoc":3216,"header":"@property\n    def spectral(self)","id":3115,"name":"spectral","nodeType":"Function","startLoc":3211,"text":"@property\n    def spectral(self):\n        \"\"\"\n        A copy of the current WCS with only the spectral axes included\n        \"\"\"\n        return self.sub([WCSSUB_SPECTRAL])  # Defined by C-ext  # noqa: F821"},{"col":0,"comment":"Return string version of ``dtype`` for writing to ECSV ``datatype``","endLoc":218,"header":"def _get_datatype_from_dtype(dtype)","id":3116,"name":"_get_datatype_from_dtype","nodeType":"Function","startLoc":211,"text":"def _get_datatype_from_dtype(dtype):\n    \"\"\"Return string version of ``dtype`` for writing to ECSV ``datatype``\"\"\"\n    datatype = dtype.name\n    if datatype.startswith(('bytes', 'str')):\n        datatype = 'string'\n    if datatype.endswith('_'):\n        datatype = datatype[:-1]  # string_ and bool_ lose the final _ for ECSV\n    return datatype"},{"col":4,"comment":"null","endLoc":3220,"header":"@property\n    def is_spectral(self)","id":3117,"name":"is_spectral","nodeType":"Function","startLoc":3218,"text":"@property\n    def is_spectral(self):\n        return self.has_spectral and self.naxis == 1"},{"col":4,"comment":"null","endLoc":3227,"header":"@property\n    def has_spectral(self)","id":3118,"name":"has_spectral","nodeType":"Function","startLoc":3222,"text":"@property\n    def has_spectral(self):\n        try:\n            return self.wcs.spec >= 0\n        except InconsistentAxisTypesError:\n            return False"},{"col":4,"comment":"\n        Returns `True` if any distortion terms are present.\n        ","endLoc":3236,"header":"@property\n    def has_distortion(self)","id":3119,"name":"has_distortion","nodeType":"Function","startLoc":3229,"text":"@property\n    def has_distortion(self):\n        \"\"\"\n        Returns `True` if any distortion terms are present.\n        \"\"\"\n        return (self.sip is not None or\n                self.cpdis1 is not None or self.cpdis2 is not None or\n                self.det2im1 is not None and self.det2im2 is not None)"},{"col":4,"comment":"null","endLoc":3261,"header":"@property\n    def pixel_scale_matrix(self)","id":3120,"name":"pixel_scale_matrix","nodeType":"Function","startLoc":3238,"text":"@property\n    def pixel_scale_matrix(self):\n\n        try:\n            cdelt = np.diag(self.wcs.get_cdelt())\n            pc = self.wcs.get_pc()\n        except InconsistentAxisTypesError:\n            try:\n                # for non-celestial axes, get_cdelt doesn't work\n                with warnings.catch_warnings():\n                    warnings.filterwarnings(\n                        'ignore', 'cdelt will be ignored since cd is present', RuntimeWarning)\n                    cdelt = np.dot(self.wcs.cd, np.diag(self.wcs.cdelt))\n            except AttributeError:\n                cdelt = np.diag(self.wcs.cdelt)\n\n            try:\n                pc = self.wcs.pc\n            except AttributeError:\n                pc = 1\n\n        pccd = np.dot(cdelt, pc)\n\n        return pccd"},{"col":45,"endLoc":260,"id":3121,"nodeType":"Lambda","startLoc":260,"text":"lambda x: x is not None"},{"col":47,"endLoc":261,"id":3122,"nodeType":"Lambda","startLoc":261,"text":"lambda x: x is not None"},{"col":52,"endLoc":262,"id":3123,"nodeType":"Lambda","startLoc":262,"text":"lambda x: x is not None"},{"col":45,"endLoc":263,"id":3124,"nodeType":"Lambda","startLoc":263,"text":"lambda x: x"},{"col":4,"comment":"\n        Determines if a given SkyCoord is contained in the wcs footprint.\n\n        Parameters\n        ----------\n        coord : `~astropy.coordinates.SkyCoord`\n            The coordinate to check if it is within the wcs coordinate.\n        **kwargs :\n           Additional arguments to pass to `~astropy.coordinates.SkyCoord.to_pixel`\n\n        Returns\n        -------\n        response : bool\n           True means the WCS footprint contains the coordinate, False means it does not.\n        ","endLoc":3280,"header":"def footprint_contains(self, coord, **kwargs)","id":3125,"name":"footprint_contains","nodeType":"Function","startLoc":3263,"text":"def footprint_contains(self, coord, **kwargs):\n        \"\"\"\n        Determines if a given SkyCoord is contained in the wcs footprint.\n\n        Parameters\n        ----------\n        coord : `~astropy.coordinates.SkyCoord`\n            The coordinate to check if it is within the wcs coordinate.\n        **kwargs :\n           Additional arguments to pass to `~astropy.coordinates.SkyCoord.to_pixel`\n\n        Returns\n        -------\n        response : bool\n           True means the WCS footprint contains the coordinate, False means it does not.\n        \"\"\"\n\n        return coord.contained_by(self, **kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1359,"id":3126,"name":"__doc__","nodeType":"Attribute","startLoc":1359,"text":"all_pix2world.__doc__"},{"col":0,"comment":"\n    Register Parquet with Unified I/O.\n    ","endLoc":350,"header":"def register_parquet()","id":3127,"name":"register_parquet","nodeType":"Function","startLoc":341,"text":"def register_parquet():\n    \"\"\"\n    Register Parquet with Unified I/O.\n    \"\"\"\n    from astropy.io import registry as io_registry\n    from astropy.table import Table\n\n    io_registry.register_reader('parquet', Table, read_table_parquet)\n    io_registry.register_writer('parquet', Table, write_table_parquet)\n    io_registry.register_identifier('parquet', Table, parquet_identify)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1433,"id":3128,"name":"__doc__","nodeType":"Attribute","startLoc":1433,"text":"wcs_pix2world.__doc__"},{"fileName":"pickle_helpers.py","filePath":"astropy/io/misc","id":3129,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module contains simple input/output related functionality that is not\npart of a larger framework or standard.\n\"\"\"\n\nimport pickle\n\n__all__ = ['fnpickle', 'fnunpickle']\n\n\ndef fnunpickle(fileorname, number=0):\n    \"\"\" Unpickle pickled objects from a specified file and return the contents.\n\n    Parameters\n    ----------\n    fileorname : str or file-like\n        The file name or file from which to unpickle objects. If a file object,\n        it should have been opened in binary mode.\n    number : int\n        If 0, a single object will be returned (the first in the file). If >0,\n        this specifies the number of objects to be unpickled, and a list will\n        be returned with exactly that many objects. If <0, all objects in the\n        file will be unpickled and returned as a list.\n\n    Raises\n    ------\n    EOFError\n        If ``number`` is >0 and there are fewer than ``number`` objects in the\n        pickled file.\n\n    Returns\n    -------\n    contents : object or list\n        If ``number`` is 0, this is a individual object - the first one\n        unpickled from the file. Otherwise, it is a list of objects unpickled\n        from the file.\n\n    \"\"\"\n\n    if isinstance(fileorname, str):\n        f = open(fileorname, 'rb')\n        close = True\n    else:\n        f = fileorname\n        close = False\n\n    try:\n        if number > 0:  # get that number\n            res = []\n            for i in range(number):\n                res.append(pickle.load(f))\n        elif number < 0:  # get all objects\n            res = []\n            eof = False\n            while not eof:\n                try:\n                    res.append(pickle.load(f))\n                except EOFError:\n                    eof = True\n        else:  # number==0\n            res = pickle.load(f)\n    finally:\n        if close:\n            f.close()\n\n    return res\n\n\ndef fnpickle(object, fileorname, protocol=None, append=False):\n    \"\"\"Pickle an object to a specified file.\n\n    Parameters\n    ----------\n    object\n        The python object to pickle.\n    fileorname : str or file-like\n        The filename or file into which the `object` should be pickled. If a\n        file object, it should have been opened in binary mode.\n    protocol : int or None\n        Pickle protocol to use - see the :mod:`pickle` module for details on\n        these options. If None, the most recent protocol will be used.\n    append : bool\n        If True, the object is appended to the end of the file, otherwise the\n        file will be overwritten (if a file object is given instead of a\n        file name, this has no effect).\n\n    \"\"\"\n    if protocol is None:\n        protocol = pickle.HIGHEST_PROTOCOL\n\n    if isinstance(fileorname, str):\n        f = open(fileorname, 'ab' if append else 'wb')\n        close = True\n    else:\n        f = fileorname\n        close = False\n\n    try:\n        pickle.dump(object, f, protocol=protocol)\n    finally:\n        if close:\n            f.close()\n"},{"col":0,"comment":" Unpickle pickled objects from a specified file and return the contents.\n\n    Parameters\n    ----------\n    fileorname : str or file-like\n        The file name or file from which to unpickle objects. If a file object,\n        it should have been opened in binary mode.\n    number : int\n        If 0, a single object will be returned (the first in the file). If >0,\n        this specifies the number of objects to be unpickled, and a list will\n        be returned with exactly that many objects. If <0, all objects in the\n        file will be unpickled and returned as a list.\n\n    Raises\n    ------\n    EOFError\n        If ``number`` is >0 and there are fewer than ``number`` objects in the\n        pickled file.\n\n    Returns\n    -------\n    contents : object or list\n        If ``number`` is 0, this is a individual object - the first one\n        unpickled from the file. Otherwise, it is a list of objects unpickled\n        from the file.\n\n    ","endLoc":67,"header":"def fnunpickle(fileorname, number=0)","id":3130,"name":"fnunpickle","nodeType":"Function","startLoc":12,"text":"def fnunpickle(fileorname, number=0):\n    \"\"\" Unpickle pickled objects from a specified file and return the contents.\n\n    Parameters\n    ----------\n    fileorname : str or file-like\n        The file name or file from which to unpickle objects. If a file object,\n        it should have been opened in binary mode.\n    number : int\n        If 0, a single object will be returned (the first in the file). If >0,\n        this specifies the number of objects to be unpickled, and a list will\n        be returned with exactly that many objects. If <0, all objects in the\n        file will be unpickled and returned as a list.\n\n    Raises\n    ------\n    EOFError\n        If ``number`` is >0 and there are fewer than ``number`` objects in the\n        pickled file.\n\n    Returns\n    -------\n    contents : object or list\n        If ``number`` is 0, this is a individual object - the first one\n        unpickled from the file. Otherwise, it is a list of objects unpickled\n        from the file.\n\n    \"\"\"\n\n    if isinstance(fileorname, str):\n        f = open(fileorname, 'rb')\n        close = True\n    else:\n        f = fileorname\n        close = False\n\n    try:\n        if number > 0:  # get that number\n            res = []\n            for i in range(number):\n                res.append(pickle.load(f))\n        elif number < 0:  # get all objects\n            res = []\n            eof = False\n            while not eof:\n                try:\n                    res.append(pickle.load(f))\n                except EOFError:\n                    eof = True\n        else:  # number==0\n            res = pickle.load(f)\n    finally:\n        if close:\n            f.close()\n\n    return res"},{"col":4,"comment":"Calculate local Earth rotation angle.\n\n        Parameters\n        ----------\n        longitude : `~astropy.units.Quantity`, `~astropy.coordinates.EarthLocation`, str, or None; optional\n            The longitude on the Earth at which to compute the Earth rotation\n            angle (taken from a location as needed).  If `None` (default), taken\n            from the ``location`` attribute of the Time instance. If the special\n            string 'tio', the result will be relative to the Terrestrial\n            Intermediate Origin (TIO) (i.e., the output of `~erfa.era00`).\n\n        Returns\n        -------\n        `~astropy.coordinates.Longitude`\n            Local Earth rotation angle with units of hourangle.\n\n        See Also\n        --------\n        astropy.time.Time.sidereal_time\n\n        References\n        ----------\n        IAU 2006 NFA Glossary\n        (currently located at: https://syrte.obspm.fr/iauWGnfa/NFA_Glossary.html)\n\n        Notes\n        -----\n        The difference between apparent sidereal time and Earth rotation angle\n        is the equation of the origins, which is the angle between the Celestial\n        Intermediate Origin (CIO) and the equinox. Applying apparent sidereal\n        time to the hour angle yields the true apparent Right Ascension with\n        respect to the equinox, while applying the Earth rotation angle yields\n        the intermediate (CIRS) Right Ascension with respect to the CIO.\n\n        The result includes the TIO locator (s'), which positions the Terrestrial\n        Intermediate Origin on the equator of the Celestial Intermediate Pole (CIP)\n        and is rigorously corrected for polar motion.\n        (except when ``longitude='tio'``).\n\n        ","endLoc":1827,"header":"def earth_rotation_angle(self, longitude=None)","id":3131,"name":"earth_rotation_angle","nodeType":"Function","startLoc":1778,"text":"def earth_rotation_angle(self, longitude=None):\n        \"\"\"Calculate local Earth rotation angle.\n\n        Parameters\n        ----------\n        longitude : `~astropy.units.Quantity`, `~astropy.coordinates.EarthLocation`, str, or None; optional\n            The longitude on the Earth at which to compute the Earth rotation\n            angle (taken from a location as needed).  If `None` (default), taken\n            from the ``location`` attribute of the Time instance. If the special\n            string 'tio', the result will be relative to the Terrestrial\n            Intermediate Origin (TIO) (i.e., the output of `~erfa.era00`).\n\n        Returns\n        -------\n        `~astropy.coordinates.Longitude`\n            Local Earth rotation angle with units of hourangle.\n\n        See Also\n        --------\n        astropy.time.Time.sidereal_time\n\n        References\n        ----------\n        IAU 2006 NFA Glossary\n        (currently located at: https://syrte.obspm.fr/iauWGnfa/NFA_Glossary.html)\n\n        Notes\n        -----\n        The difference between apparent sidereal time and Earth rotation angle\n        is the equation of the origins, which is the angle between the Celestial\n        Intermediate Origin (CIO) and the equinox. Applying apparent sidereal\n        time to the hour angle yields the true apparent Right Ascension with\n        respect to the equinox, while applying the Earth rotation angle yields\n        the intermediate (CIRS) Right Ascension with respect to the CIO.\n\n        The result includes the TIO locator (s'), which positions the Terrestrial\n        Intermediate Origin on the equator of the Celestial Intermediate Pole (CIP)\n        and is rigorously corrected for polar motion.\n        (except when ``longitude='tio'``).\n\n        \"\"\"\n        if isinstance(longitude, str) and longitude == 'tio':\n            longitude = 0\n            include_tio = False\n        else:\n            include_tio = True\n\n        return self._sid_time_or_earth_rot_ang(longitude=longitude,\n                                               function=erfa.era00, scales=('ut1',),\n                                               include_tio=include_tio)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1907,"id":3132,"name":"__doc__","nodeType":"Attribute","startLoc":1907,"text":"all_world2pix.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":2239,"id":3133,"name":"__doc__","nodeType":"Attribute","startLoc":2239,"text":"wcs_world2pix.__doc__"},{"col":4,"comment":"Calculate a local sidereal time or Earth rotation angle.\n\n        Parameters\n        ----------\n        longitude : `~astropy.units.Quantity`, `~astropy.coordinates.EarthLocation`, str, or None; optional\n            The longitude on the Earth at which to compute the Earth rotation\n            angle (taken from a location as needed).  If `None` (default), taken\n            from the ``location`` attribute of the Time instance.\n        function : callable\n            The ERFA function to use.\n        scales : tuple of str\n            The time scales that the function requires on input.\n        include_tio : bool, optional\n            Whether to includes the TIO locator corrected for polar motion.\n            Should be `False` for pre-2000 IAU models.  Default: `True`.\n\n        Returns\n        -------\n        `~astropy.coordinates.Longitude`\n            Local sidereal time or Earth rotation angle, with units of hourangle.\n\n        ","endLoc":1966,"header":"def _sid_time_or_earth_rot_ang(self, longitude, function, scales, include_tio=True)","id":3134,"name":"_sid_time_or_earth_rot_ang","nodeType":"Function","startLoc":1910,"text":"def _sid_time_or_earth_rot_ang(self, longitude, function, scales, include_tio=True):\n        \"\"\"Calculate a local sidereal time or Earth rotation angle.\n\n        Parameters\n        ----------\n        longitude : `~astropy.units.Quantity`, `~astropy.coordinates.EarthLocation`, str, or None; optional\n            The longitude on the Earth at which to compute the Earth rotation\n            angle (taken from a location as needed).  If `None` (default), taken\n            from the ``location`` attribute of the Time instance.\n        function : callable\n            The ERFA function to use.\n        scales : tuple of str\n            The time scales that the function requires on input.\n        include_tio : bool, optional\n            Whether to includes the TIO locator corrected for polar motion.\n            Should be `False` for pre-2000 IAU models.  Default: `True`.\n\n        Returns\n        -------\n        `~astropy.coordinates.Longitude`\n            Local sidereal time or Earth rotation angle, with units of hourangle.\n\n        \"\"\"\n        from astropy.coordinates import Longitude, EarthLocation\n        from astropy.coordinates.builtin_frames.utils import get_polar_motion\n        from astropy.coordinates.matrix_utilities import rotation_matrix\n\n        if longitude is None:\n            if self.location is None:\n                raise ValueError('No longitude is given but the location for '\n                                 'the Time object is not set.')\n            longitude = self.location.lon\n        elif isinstance(longitude, EarthLocation):\n            longitude = longitude.lon\n        else:\n            # Sanity check on input; default unit is degree.\n            longitude = Longitude(longitude, u.degree, copy=False)\n\n        theta = self._call_erfa(function, scales)\n\n        if include_tio:\n            # TODO: this duplicates part of coordinates.erfa_astrom.ErfaAstrom.apio;\n            # maybe posisble to factor out to one or the other.\n            sp = self._call_erfa(erfa.sp00, ('tt',))\n            xp, yp = get_polar_motion(self)\n            # Form the rotation matrix, CIRS to apparent [HA,Dec].\n            r = (rotation_matrix(longitude, 'z')\n                 @ rotation_matrix(-yp, 'x', unit=u.radian)\n                 @ rotation_matrix(-xp, 'y', unit=u.radian)\n                 @ rotation_matrix(theta+sp, 'z', unit=u.radian))\n            # Solve for angle.\n            angle = np.arctan2(r[..., 0, 1], r[..., 0, 0]) << u.radian\n\n        else:\n            angle = longitude + (theta << u.radian)\n\n        return Longitude(angle, u.hourangle)"},{"col":0,"comment":"Pickle an object to a specified file.\n\n    Parameters\n    ----------\n    object\n        The python object to pickle.\n    fileorname : str or file-like\n        The filename or file into which the `object` should be pickled. If a\n        file object, it should have been opened in binary mode.\n    protocol : int or None\n        Pickle protocol to use - see the :mod:`pickle` module for details on\n        these options. If None, the most recent protocol will be used.\n    append : bool\n        If True, the object is appended to the end of the file, otherwise the\n        file will be overwritten (if a file object is given instead of a\n        file name, this has no effect).\n\n    ","endLoc":103,"header":"def fnpickle(object, fileorname, protocol=None, append=False)","id":3135,"name":"fnpickle","nodeType":"Function","startLoc":70,"text":"def fnpickle(object, fileorname, protocol=None, append=False):\n    \"\"\"Pickle an object to a specified file.\n\n    Parameters\n    ----------\n    object\n        The python object to pickle.\n    fileorname : str or file-like\n        The filename or file into which the `object` should be pickled. If a\n        file object, it should have been opened in binary mode.\n    protocol : int or None\n        Pickle protocol to use - see the :mod:`pickle` module for details on\n        these options. If None, the most recent protocol will be used.\n    append : bool\n        If True, the object is appended to the end of the file, otherwise the\n        file will be overwritten (if a file object is given instead of a\n        file name, this has no effect).\n\n    \"\"\"\n    if protocol is None:\n        protocol = pickle.HIGHEST_PROTOCOL\n\n    if isinstance(fileorname, str):\n        f = open(fileorname, 'ab' if append else 'wb')\n        close = True\n    else:\n        f = fileorname\n        close = False\n\n    try:\n        pickle.dump(object, f, protocol=protocol)\n    finally:\n        if close:\n            f.close()"},{"attributeType":"null","col":4,"comment":"null","endLoc":2298,"id":3136,"name":"__doc__","nodeType":"Attribute","startLoc":2298,"text":"pix2foc.__doc__"},{"col":0,"comment":"This is the main function called by the `fitsheader` script.","endLoc":465,"header":"def main(args=None)","id":3137,"name":"main","nodeType":"Function","startLoc":408,"text":"def main(args=None):\n    \"\"\"This is the main function called by the `fitsheader` script.\"\"\"\n\n    parser = argparse.ArgumentParser(\n        description=DESCRIPTION,\n        formatter_class=argparse.RawDescriptionHelpFormatter)\n\n    parser.add_argument(\n        '--version', action='version',\n        version=f'%(prog)s {__version__}')\n\n    parser.add_argument('-e', '--extension', metavar='HDU',\n                        action='append', dest='extensions',\n                        help='specify the extension by name or number; '\n                             'this argument can be repeated '\n                             'to select multiple extensions')\n    parser.add_argument('-k', '--keyword', metavar='KEYWORD',\n                        action=KeywordAppendAction, dest='keywords',\n                        help='specify a keyword; this argument can be '\n                             'repeated to select multiple keywords; '\n                             'also supports wildcards')\n    parser.add_argument('-t', '--table',\n                        nargs='?', default=False, metavar='FORMAT',\n                        help='print the header(s) in machine-readable table '\n                             'format; the default format is '\n                             '\"ascii.fixed_width\" (can be \"ascii.csv\", '\n                             '\"ascii.html\", \"ascii.latex\", \"fits\", etc)')\n    parser.add_argument('-f', '--fitsort', action='store_true',\n                        help='print the headers as a table with each unique '\n                             'keyword in a given column (fitsort format); '\n                             'if a SORT_KEYWORD is specified, the result will be '\n                             'sorted along that keyword')\n    parser.add_argument('-c', '--compressed', action='store_true',\n                        help='for compressed image data, '\n                             'show the true header which describes '\n                             'the compression rather than the data')\n    parser.add_argument('filename', nargs='+',\n                        help='path to one or more files; '\n                             'wildcards are supported')\n    args = parser.parse_args(args)\n\n    # If `--table` was used but no format specified,\n    # then use ascii.fixed_width by default\n    if args.table is None:\n        args.table = 'ascii.fixed_width'\n\n    # Now print the desired headers\n    try:\n        if args.table:\n            print_headers_as_table(args)\n        elif args.fitsort:\n            print_headers_as_comparison(args)\n        else:\n            print_headers_traditional(args)\n    except OSError:\n        # A 'Broken pipe' OSError may occur when stdout is closed prematurely,\n        # eg. when calling `fitsheader file.fits | head`. We let this pass.\n        pass"},{"attributeType":"null","col":4,"comment":"null","endLoc":2328,"id":3138,"name":"__doc__","nodeType":"Attribute","startLoc":2328,"text":"p4_pix2foc.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":2357,"id":3139,"name":"__doc__","nodeType":"Attribute","startLoc":2357,"text":"det2im.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":2393,"id":3140,"name":"__doc__","nodeType":"Attribute","startLoc":2393,"text":"sip_pix2foc.__doc__"},{"attributeType":"null","col":16,"comment":"null","endLoc":12,"id":3141,"name":"np","nodeType":"Attribute","startLoc":12,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":3142,"name":"PARQUET_SIGNATURE","nodeType":"Attribute","startLoc":22,"text":"PARQUET_SIGNATURE"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":3143,"name":"__all__","nodeType":"Attribute","startLoc":24,"text":"__all__"},{"col":0,"comment":"","endLoc":7,"header":"parquet.py#<anonymous>","id":3144,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis package contains functions for reading and writing Parquet\ntables that are not meant to be used directly, but instead are\navailable as readers/writers in `astropy.table`.  See\n:ref:`astropy:table_io` for more details.\n\"\"\"\n\nPARQUET_SIGNATURE = b'PAR1'\n\n__all__ = []  # nothing is publicly scoped"},{"attributeType":"null","col":4,"comment":"null","endLoc":2434,"id":3145,"name":"__doc__","nodeType":"Attribute","startLoc":2434,"text":"sip_foc2pix.__doc__"},{"attributeType":"null","col":12,"comment":"null","endLoc":509,"id":3146,"name":"naxis","nodeType":"Attribute","startLoc":509,"text":"self.naxis"},{"fileName":"hdf5.py","filePath":"astropy/io/misc","id":3147,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis package contains functions for reading and writing HDF5 tables that are\nnot meant to be used directly, but instead are available as readers/writers in\n`astropy.table`. See :ref:`astropy:table_io` for more details.\n\"\"\"\n\nimport os\nimport warnings\n\nimport numpy as np\n\n# NOTE: Do not import anything from astropy.table here.\n# https://github.com/astropy/astropy/issues/6604\nfrom astropy.utils.exceptions import AstropyUserWarning\nfrom astropy.utils.misc import NOT_OVERWRITING_MSG\n\nHDF5_SIGNATURE = b'\\x89HDF\\r\\n\\x1a\\n'\nMETA_KEY = '__table_column_meta__'\n\n__all__ = ['read_table_hdf5', 'write_table_hdf5']\n\n\ndef meta_path(path):\n    return path + '.' + META_KEY\n\n\ndef _find_all_structured_arrays(handle):\n    \"\"\"\n    Find all structured arrays in an HDF5 file\n    \"\"\"\n    import h5py\n    structured_arrays = []\n\n    def append_structured_arrays(name, obj):\n        if isinstance(obj, h5py.Dataset) and obj.dtype.kind == 'V':\n            structured_arrays.append(name)\n    handle.visititems(append_structured_arrays)\n    return structured_arrays\n\n\ndef is_hdf5(origin, filepath, fileobj, *args, **kwargs):\n\n    if fileobj is not None:\n        loc = fileobj.tell()\n        try:\n            signature = fileobj.read(8)\n        finally:\n            fileobj.seek(loc)\n        return signature == HDF5_SIGNATURE\n    elif filepath is not None:\n        return filepath.endswith(('.hdf5', '.h5'))\n\n    try:\n        import h5py\n    except ImportError:\n        return False\n    else:\n        return isinstance(args[0], (h5py.File, h5py.Group, h5py.Dataset))\n\n\ndef read_table_hdf5(input, path=None, character_as_bytes=True):\n    \"\"\"\n    Read a Table object from an HDF5 file\n\n    This requires `h5py <http://www.h5py.org/>`_ to be installed. If more than one\n    table is present in the HDF5 file or group, the first table is read in and\n    a warning is displayed.\n\n    Parameters\n    ----------\n    input : str or :class:`h5py.File` or :class:`h5py.Group` or\n        :class:`h5py.Dataset` If a string, the filename to read the table from.\n        If an h5py object, either the file or the group object to read the\n        table from.\n    path : str\n        The path from which to read the table inside the HDF5 file.\n        This should be relative to the input file or group.\n    character_as_bytes : bool\n        If `True` then Table columns are left as bytes.\n        If `False` then Table columns are converted to unicode.\n    \"\"\"\n\n    try:\n        import h5py\n    except ImportError:\n        raise Exception(\"h5py is required to read and write HDF5 files\")\n\n    # This function is iterative, and only gets to writing the file when\n    # the input is an hdf5 Group. Moreover, the input variable is changed in\n    # place.\n    # Here, we save its value to be used at the end when the conditions are\n    # right.\n    input_save = input\n    if isinstance(input, (h5py.File, h5py.Group)):\n\n        # If a path was specified, follow the path\n\n        if path is not None:\n            try:\n                input = input[path]\n            except (KeyError, ValueError):\n                raise OSError(f\"Path {path} does not exist\")\n\n        # `input` is now either a group or a dataset. If it is a group, we\n        # will search for all structured arrays inside the group, and if there\n        # is one we can proceed otherwise an error is raised. If it is a\n        # dataset, we just proceed with the reading.\n\n        if isinstance(input, h5py.Group):\n\n            # Find all structured arrays in group\n            arrays = _find_all_structured_arrays(input)\n\n            if len(arrays) == 0:\n                raise ValueError(f\"no table found in HDF5 group {path}\")\n            elif len(arrays) > 0:\n                path = arrays[0] if path is None else path + '/' + arrays[0]\n                if len(arrays) > 1:\n                    warnings.warn(\"path= was not specified but multiple tables\"\n                                  \" are present, reading in first available\"\n                                  \" table (path={})\".format(path),\n                                  AstropyUserWarning)\n                return read_table_hdf5(input, path=path)\n\n    elif not isinstance(input, h5py.Dataset):\n\n        # If a file object was passed, then we need to extract the filename\n        # because h5py cannot properly read in file objects.\n\n        if hasattr(input, 'read'):\n            try:\n                input = input.name\n            except AttributeError:\n                raise TypeError(\"h5py can only open regular files\")\n\n        # Open the file for reading, and recursively call read_table_hdf5 with\n        # the file object and the path.\n\n        f = h5py.File(input, 'r')\n\n        try:\n            return read_table_hdf5(f, path=path, character_as_bytes=character_as_bytes)\n        finally:\n            f.close()\n\n    # If we are here, `input` should be a Dataset object, which we can now\n    # convert to a Table.\n\n    # Create a Table object\n    from astropy.table import Table, meta, serialize\n\n    table = Table(np.array(input))\n\n    # Read the meta-data from the file. For back-compatibility, we can read\n    # the old file format where the serialized metadata were saved in the\n    # attributes of the HDF5 dataset.\n    # In the new format, instead, metadata are stored in a new dataset in the\n    # same file. This is introduced in Astropy 3.0\n    old_version_meta = META_KEY in input.attrs\n    new_version_meta = path is not None and meta_path(path) in input_save\n    if old_version_meta or new_version_meta:\n        if new_version_meta:\n            header = meta.get_header_from_yaml(\n                h.decode('utf-8') for h in input_save[meta_path(path)])\n        else:\n            # Must be old_version_meta is True. if (A or B) and not A then B is True\n            header = meta.get_header_from_yaml(\n                h.decode('utf-8') for h in input.attrs[META_KEY])\n        if 'meta' in list(header.keys()):\n            table.meta = header['meta']\n\n        header_cols = dict((x['name'], x) for x in header['datatype'])\n        for col in table.columns.values():\n            for attr in ('description', 'format', 'unit', 'meta'):\n                if attr in header_cols[col.name]:\n                    setattr(col, attr, header_cols[col.name][attr])\n\n        # Construct new table with mixins, using tbl.meta['__serialized_columns__']\n        # as guidance.\n        table = serialize._construct_mixins_from_columns(table)\n\n    else:\n        # Read the meta-data from the file\n        table.meta.update(input.attrs)\n\n    if not character_as_bytes:\n        table.convert_bytestring_to_unicode()\n\n    return table\n\n\ndef _encode_mixins(tbl):\n    \"\"\"Encode a Table ``tbl`` that may have mixin columns to a Table with only\n    astropy Columns + appropriate meta-data to allow subsequent decoding.\n    \"\"\"\n    from astropy.table import serialize\n    from astropy import units as u\n    from astropy.utils.data_info import serialize_context_as\n\n    # Convert the table to one with no mixins, only Column objects.  This adds\n    # meta data which is extracted with meta.get_yaml_from_table.\n    with serialize_context_as('hdf5'):\n        encode_tbl = serialize.represent_mixins_as_columns(tbl)\n\n    return encode_tbl\n\n\ndef write_table_hdf5(table, output, path=None, compression=False,\n                     append=False, overwrite=False, serialize_meta=False,\n                     **create_dataset_kwargs):\n    \"\"\"\n    Write a Table object to an HDF5 file\n\n    This requires `h5py <http://www.h5py.org/>`_ to be installed.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        Data table that is to be written to file.\n    output : str or :class:`h5py.File` or :class:`h5py.Group`\n        If a string, the filename to write the table to. If an h5py object,\n        either the file or the group object to write the table to.\n    path : str\n        The path to which to write the table inside the HDF5 file.\n        This should be relative to the input file or group.\n        If not specified, defaults to ``__astropy_table__``.\n    compression : bool or str or int\n        Whether to compress the table inside the HDF5 file. If set to `True`,\n        ``'gzip'`` compression is used. If a string is specified, it should be\n        one of ``'gzip'``, ``'szip'``, or ``'lzf'``. If an integer is\n        specified (in the range 0-9), ``'gzip'`` compression is used, and the\n        integer denotes the compression level.\n    append : bool\n        Whether to append the table to an existing HDF5 file.\n    overwrite : bool\n        Whether to overwrite any existing file without warning.\n        If ``append=True`` and ``overwrite=True`` then only the dataset will be\n        replaced; the file/group will not be overwritten.\n    **create_dataset_kwargs\n        Additional keyword arguments are passed to\n        ``h5py.File.create_dataset()`` or ``h5py.Group.create_dataset()``.\n    \"\"\"\n\n    from astropy.table import meta\n    try:\n        import h5py\n    except ImportError:\n        raise Exception(\"h5py is required to read and write HDF5 files\")\n\n    if path is None:\n        # table is just an arbitrary, hardcoded string here.\n        path = '__astropy_table__'\n    elif path.endswith('/'):\n        raise ValueError(\"table path should end with table name, not /\")\n\n    if '/' in path:\n        group, name = path.rsplit('/', 1)\n    else:\n        group, name = None, path\n\n    if isinstance(output, (h5py.File, h5py.Group)):\n        if len(list(output.keys())) > 0 and name == '__astropy_table__':\n            raise ValueError(\"table path should always be set via the \"\n                             \"path= argument when writing to existing \"\n                             \"files\")\n        elif name == '__astropy_table__':\n            warnings.warn(\"table path was not set via the path= argument; \"\n                          \"using default path {}\".format(path))\n\n        if group:\n            try:\n                output_group = output[group]\n            except (KeyError, ValueError):\n                output_group = output.create_group(group)\n        else:\n            output_group = output\n\n    elif isinstance(output, str):\n\n        if os.path.exists(output) and not append:\n            if overwrite and not append:\n                os.remove(output)\n            else:\n                raise OSError(NOT_OVERWRITING_MSG.format(output))\n\n        # Open the file for appending or writing\n        f = h5py.File(output, 'a' if append else 'w')\n\n        # Recursively call the write function\n        try:\n            return write_table_hdf5(table, f, path=path,\n                                    compression=compression, append=append,\n                                    overwrite=overwrite,\n                                    serialize_meta=serialize_meta)\n        finally:\n            f.close()\n\n    else:\n\n        raise TypeError('output should be a string or an h5py File or '\n                        'Group object')\n\n    # Check whether table already exists\n    if name in output_group:\n        if append and overwrite:\n            # Delete only the dataset itself\n            del output_group[name]\n            if serialize_meta and name + '.__table_column_meta__' in output_group:\n                del output_group[name + '.__table_column_meta__']\n        else:\n            raise OSError(f\"Table {path} already exists\")\n\n    # Encode any mixin columns as plain columns + appropriate metadata\n    table = _encode_mixins(table)\n\n    # Table with numpy unicode strings can't be written in HDF5 so\n    # to write such a table a copy of table is made containing columns as\n    # bytestrings.  Now this copy of the table can be written in HDF5.\n    if any(col.info.dtype.kind == 'U' for col in table.itercols()):\n        table = table.copy(copy_data=False)\n        table.convert_unicode_to_bytestring()\n\n    # Warn if information will be lost when serialize_meta=False.  This is\n    # hardcoded to the set difference between column info attributes and what\n    # HDF5 can store natively (name, dtype) with no meta.\n    if serialize_meta is False:\n        for col in table.itercols():\n            for attr in ('unit', 'format', 'description', 'meta'):\n                if getattr(col.info, attr, None) not in (None, {}):\n                    warnings.warn(\"table contains column(s) with defined 'unit', 'format',\"\n                                  \" 'description', or 'meta' info attributes. These will\"\n                                  \" be dropped since serialize_meta=False.\",\n                                  AstropyUserWarning)\n\n    # Write the table to the file\n    if compression:\n        if compression is True:\n            compression = 'gzip'\n        dset = output_group.create_dataset(name, data=table.as_array(),\n                                           compression=compression,\n                                           **create_dataset_kwargs)\n    else:\n        dset = output_group.create_dataset(name, data=table.as_array(),\n                                           **create_dataset_kwargs)\n\n    if serialize_meta:\n        header_yaml = meta.get_yaml_from_table(table)\n        header_encoded = np.array([h.encode('utf-8') for h in header_yaml])\n        output_group.create_dataset(meta_path(name),\n                                    data=header_encoded)\n\n    else:\n        # Write the Table meta dict key:value pairs to the file as HDF5\n        # attributes.  This works only for a limited set of scalar data types\n        # like numbers, strings, etc., but not any complex types.  This path\n        # also ignores column meta like unit or format.\n        for key in table.meta:\n            val = table.meta[key]\n            try:\n                dset.attrs[key] = val\n            except TypeError:\n                warnings.warn(\"Attribute `{}` of type {} cannot be written to \"\n                              \"HDF5 files - skipping. (Consider specifying \"\n                              \"serialize_meta=True to write all meta data)\".format(key, type(val)),\n                              AstropyUserWarning)\n\n\ndef register_hdf5():\n    \"\"\"\n    Register HDF5 with Unified I/O.\n    \"\"\"\n    from astropy.io import registry as io_registry\n    from astropy.table import Table\n\n    io_registry.register_reader('hdf5', Table, read_table_hdf5)\n    io_registry.register_writer('hdf5', Table, write_table_hdf5)\n    io_registry.register_identifier('hdf5', Table, is_hdf5)\n"},{"col":0,"comment":"null","endLoc":25,"header":"def meta_path(path)","id":3148,"name":"meta_path","nodeType":"Function","startLoc":24,"text":"def meta_path(path):\n    return path + '.' + META_KEY"},{"col":0,"comment":"\n    Find all structured arrays in an HDF5 file\n    ","endLoc":39,"header":"def _find_all_structured_arrays(handle)","id":3149,"name":"_find_all_structured_arrays","nodeType":"Function","startLoc":28,"text":"def _find_all_structured_arrays(handle):\n    \"\"\"\n    Find all structured arrays in an HDF5 file\n    \"\"\"\n    import h5py\n    structured_arrays = []\n\n    def append_structured_arrays(name, obj):\n        if isinstance(obj, h5py.Dataset) and obj.dtype.kind == 'V':\n            structured_arrays.append(name)\n    handle.visititems(append_structured_arrays)\n    return structured_arrays"},{"attributeType":"null","col":16,"comment":"null","endLoc":63,"id":3150,"name":"np","nodeType":"Attribute","startLoc":63,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":69,"id":3151,"name":"DESCRIPTION","nodeType":"Attribute","startLoc":69,"text":"DESCRIPTION"},{"col":0,"comment":"","endLoc":58,"header":"fitsheader.py#<anonymous>","id":3152,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n``fitsheader`` is a command line script based on astropy.io.fits for printing\nthe header(s) of one or more FITS file(s) to the standard output in a human-\nreadable format.\n\nExample uses of fitsheader:\n\n1. Print the header of all the HDUs of a .fits file::\n\n    $ fitsheader filename.fits\n\n2. Print the header of the third and fifth HDU extension::\n\n    $ fitsheader --extension 3 --extension 5 filename.fits\n\n3. Print the header of a named extension, e.g. select the HDU containing\n   keywords EXTNAME='SCI' and EXTVER='2'::\n\n    $ fitsheader --extension \"SCI,2\" filename.fits\n\n4. Print only specific keywords::\n\n    $ fitsheader --keyword BITPIX --keyword NAXIS filename.fits\n\n5. Print keywords NAXIS, NAXIS1, NAXIS2, etc using a wildcard::\n\n    $ fitsheader --keyword NAXIS* filename.fits\n\n6. Dump the header keywords of all the files in the current directory into a\n   machine-readable csv file::\n\n    $ fitsheader --table ascii.csv *.fits > keywords.csv\n\n7. Specify hierarchical keywords with the dotted or spaced notation::\n\n    $ fitsheader --keyword ESO.INS.ID filename.fits\n    $ fitsheader --keyword \"ESO INS ID\" filename.fits\n\n8. Compare the headers of different fites files, following ESO's ``fitsort``\n   format::\n\n    $ fitsheader --fitsort --extension 0 --keyword ESO.INS.ID *.fits\n\n9. Same as above, sorting the output along a specified keyword::\n\n    $ fitsheader -f DATE-OBS -e 0 -k DATE-OBS -k ESO.INS.ID *.fits\n\nNote that compressed images (HDUs of type\n:class:`~astropy.io.fits.CompImageHDU`) really have two headers: a real\nBINTABLE header to describe the compressed data, and a fake IMAGE header\nrepresenting the image that was compressed. Astropy returns the latter by\ndefault. You must supply the ``--compressed`` option if you require the real\nheader that describes the compression.\n\nWith Astropy installed, please run ``fitsheader --help`` to see the full usage\ndocumentation.\n\"\"\"\n\nDESCRIPTION = \"\"\"\nPrint the header(s) of a FITS file. Optional arguments allow the desired\nextension(s), keyword(s), and output format to be specified.\nNote that in the case of a compressed image, the decompressed header is\nshown by default.\n\nThis script is part of the Astropy package. See\nhttps://docs.astropy.org/en/latest/io/fits/usage/scripts.html#module-astropy.io.fits.scripts.fitsheader\nfor further documentation.\n\"\"\".strip()"},{"attributeType":"null","col":8,"comment":"null","endLoc":546,"id":3153,"name":"_pixel_bounds","nodeType":"Attribute","startLoc":546,"text":"self._pixel_bounds"},{"col":0,"comment":"null","endLoc":59,"header":"def is_hdf5(origin, filepath, fileobj, *args, **kwargs)","id":3154,"name":"is_hdf5","nodeType":"Function","startLoc":42,"text":"def is_hdf5(origin, filepath, fileobj, *args, **kwargs):\n\n    if fileobj is not None:\n        loc = fileobj.tell()\n        try:\n            signature = fileobj.read(8)\n        finally:\n            fileobj.seek(loc)\n        return signature == HDF5_SIGNATURE\n    elif filepath is not None:\n        return filepath.endswith(('.hdf5', '.h5'))\n\n    try:\n        import h5py\n    except ImportError:\n        return False\n    else:\n        return isinstance(args[0], (h5py.File, h5py.Group, h5py.Dataset))"},{"col":4,"comment":"null","endLoc":1979,"header":"def _call_erfa(self, function, scales)","id":3155,"name":"_call_erfa","nodeType":"Function","startLoc":1968,"text":"def _call_erfa(self, function, scales):\n        # TODO: allow erfa functions to be used on Time with __array_ufunc__.\n        erfa_parameters = [getattr(getattr(self, scale)._time, jd_part)\n                           for scale in scales\n                           for jd_part in ('jd1', 'jd2_filled')]\n\n        result = function(*erfa_parameters)\n\n        if self.masked:\n            result[self.mask] = np.nan\n\n        return result"},{"attributeType":"null","col":8,"comment":"null","endLoc":2856,"id":3156,"name":"_naxis","nodeType":"Attribute","startLoc":2856,"text":"self._naxis"},{"id":3157,"name":"astropy/io/misc/asdf","nodeType":"Package"},{"fileName":"types.py","filePath":"astropy/io/misc/asdf","id":3158,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nfrom asdf.types import CustomType, ExtensionTypeMeta\n\n__all__ = ['AstropyType', 'AstropyAsdfType']\n\n# Names of AstropyType or AstropyAsdfType subclasses that are base classes\n# and aren't used directly for serialization.\n_TYPE_BASE_CLASS_NAMES = {'PolynomialTypeBase'}\n\n_astropy_types = set()\n_astropy_asdf_types = set()\n\n\nclass AstropyTypeMeta(ExtensionTypeMeta):\n    \"\"\"\n    Keeps track of `AstropyType` subclasses that are created so that they can\n    be stored automatically by astropy extensions for ASDF.\n    \"\"\"\n    def __new__(mcls, name, bases, attrs):\n        cls = super().__new__(mcls, name, bases, attrs)\n        # Classes using this metaclass are automatically added to the list of\n        # astropy extensions\n        if cls.__name__ not in _TYPE_BASE_CLASS_NAMES:\n            if cls.organization == 'astropy.org' and cls.standard == 'astropy':\n                _astropy_types.add(cls)\n            elif cls.organization == 'stsci.edu' and cls.standard == 'asdf':\n                _astropy_asdf_types.add(cls)\n\n        return cls\n\n\nclass AstropyType(CustomType, metaclass=AstropyTypeMeta):\n    \"\"\"\n    This class represents types that have schemas and tags that are defined by\n    Astropy.\n\n    IMPORTANT: This parent class should **not** be used for types that have\n    schemas that are defined by the ASDF standard.\n    \"\"\"\n    organization = 'astropy.org'\n    standard = 'astropy'\n\n\nclass AstropyAsdfType(CustomType, metaclass=AstropyTypeMeta):\n    \"\"\"\n    This class represents types that have schemas that are defined in the ASDF\n    standard, but have tags that are implemented within astropy.\n\n    IMPORTANT: This parent class should **not** be used for types that also\n    have schemas that are defined by astropy.\n    \"\"\"\n    organization = 'stsci.edu'\n    standard = 'asdf'\n"},{"col":0,"comment":"\n    Read FITS binary table time columns as `~astropy.time.Time`.\n\n    This method reads the metadata associated with time coordinates, as\n    stored in a FITS binary table header, converts time columns into\n    `~astropy.time.Time` columns and reads global reference times as\n    `~astropy.time.Time` instances.\n\n    Parameters\n    ----------\n    hdr : `~astropy.io.fits.header.Header`\n        FITS Header\n    table : `~astropy.table.Table`\n        The table whose time columns are to be read as Time\n\n    Returns\n    -------\n    hdr : `~astropy.io.fits.header.Header`\n        Modified FITS Header (time metadata removed)\n    ","endLoc":498,"header":"def fits_to_time(hdr, table)","id":3159,"name":"fits_to_time","nodeType":"Function","startLoc":426,"text":"def fits_to_time(hdr, table):\n    \"\"\"\n    Read FITS binary table time columns as `~astropy.time.Time`.\n\n    This method reads the metadata associated with time coordinates, as\n    stored in a FITS binary table header, converts time columns into\n    `~astropy.time.Time` columns and reads global reference times as\n    `~astropy.time.Time` instances.\n\n    Parameters\n    ----------\n    hdr : `~astropy.io.fits.header.Header`\n        FITS Header\n    table : `~astropy.table.Table`\n        The table whose time columns are to be read as Time\n\n    Returns\n    -------\n    hdr : `~astropy.io.fits.header.Header`\n        Modified FITS Header (time metadata removed)\n    \"\"\"\n\n    # Set defaults for global time scale, reference, etc.\n    global_info = {'TIMESYS': 'UTC',\n                   'TREFPOS': 'TOPOCENTER'}\n\n    # Set default dictionary for time columns\n    time_columns = defaultdict(OrderedDict)\n\n    # Make a \"copy\" (not just a view) of the input header, since it\n    # may get modified.  the data is still a \"view\" (for now)\n    hcopy = hdr.copy(strip=True)\n\n    # Scan the header for global and column-specific time keywords\n    for key, value, comment in hdr.cards:\n        if key in TIME_KEYWORDS:\n\n            global_info[key] = value\n            hcopy.remove(key)\n\n        elif is_time_column_keyword(key):\n\n            base, idx = re.match(r'([A-Z]+)([0-9]+)', key).groups()\n            time_columns[int(idx)][base] = value\n            hcopy.remove(key)\n\n        elif (value in ('OBSGEO-X', 'OBSGEO-Y', 'OBSGEO-Z') and\n              re.match('TTYPE[0-9]+', key)):\n\n            global_info[value] = table[value]\n\n    # Verify and get the global time reference frame information\n    _verify_global_info(global_info)\n    _convert_global_time(table, global_info)\n\n    # Columns with column-specific time (coordinate) keywords\n    if time_columns:\n        for idx, column_info in time_columns.items():\n            # Check if the column is time coordinate (not spatial)\n            if _verify_column_info(column_info, global_info):\n                colname = table.colnames[idx - 1]\n                # Convert to Time\n                table[colname] = _convert_time_column(table[colname],\n                                                      column_info)\n\n    # Check for special-cases of time coordinate columns\n    for idx, colname in enumerate(table.colnames):\n        if (idx + 1) not in time_columns:\n            column_info = _get_info_if_time_column(table[colname], global_info)\n            if column_info:\n                table[colname] = _convert_time_column(table[colname], column_info)\n\n    return hcopy"},{"col":0,"comment":"\n    Read a Table object from an HDF5 file\n\n    This requires `h5py <http://www.h5py.org/>`_ to be installed. If more than one\n    table is present in the HDF5 file or group, the first table is read in and\n    a warning is displayed.\n\n    Parameters\n    ----------\n    input : str or :class:`h5py.File` or :class:`h5py.Group` or\n        :class:`h5py.Dataset` If a string, the filename to read the table from.\n        If an h5py object, either the file or the group object to read the\n        table from.\n    path : str\n        The path from which to read the table inside the HDF5 file.\n        This should be relative to the input file or group.\n    character_as_bytes : bool\n        If `True` then Table columns are left as bytes.\n        If `False` then Table columns are converted to unicode.\n    ","endLoc":190,"header":"def read_table_hdf5(input, path=None, character_as_bytes=True)","id":3160,"name":"read_table_hdf5","nodeType":"Function","startLoc":62,"text":"def read_table_hdf5(input, path=None, character_as_bytes=True):\n    \"\"\"\n    Read a Table object from an HDF5 file\n\n    This requires `h5py <http://www.h5py.org/>`_ to be installed. If more than one\n    table is present in the HDF5 file or group, the first table is read in and\n    a warning is displayed.\n\n    Parameters\n    ----------\n    input : str or :class:`h5py.File` or :class:`h5py.Group` or\n        :class:`h5py.Dataset` If a string, the filename to read the table from.\n        If an h5py object, either the file or the group object to read the\n        table from.\n    path : str\n        The path from which to read the table inside the HDF5 file.\n        This should be relative to the input file or group.\n    character_as_bytes : bool\n        If `True` then Table columns are left as bytes.\n        If `False` then Table columns are converted to unicode.\n    \"\"\"\n\n    try:\n        import h5py\n    except ImportError:\n        raise Exception(\"h5py is required to read and write HDF5 files\")\n\n    # This function is iterative, and only gets to writing the file when\n    # the input is an hdf5 Group. Moreover, the input variable is changed in\n    # place.\n    # Here, we save its value to be used at the end when the conditions are\n    # right.\n    input_save = input\n    if isinstance(input, (h5py.File, h5py.Group)):\n\n        # If a path was specified, follow the path\n\n        if path is not None:\n            try:\n                input = input[path]\n            except (KeyError, ValueError):\n                raise OSError(f\"Path {path} does not exist\")\n\n        # `input` is now either a group or a dataset. If it is a group, we\n        # will search for all structured arrays inside the group, and if there\n        # is one we can proceed otherwise an error is raised. If it is a\n        # dataset, we just proceed with the reading.\n\n        if isinstance(input, h5py.Group):\n\n            # Find all structured arrays in group\n            arrays = _find_all_structured_arrays(input)\n\n            if len(arrays) == 0:\n                raise ValueError(f\"no table found in HDF5 group {path}\")\n            elif len(arrays) > 0:\n                path = arrays[0] if path is None else path + '/' + arrays[0]\n                if len(arrays) > 1:\n                    warnings.warn(\"path= was not specified but multiple tables\"\n                                  \" are present, reading in first available\"\n                                  \" table (path={})\".format(path),\n                                  AstropyUserWarning)\n                return read_table_hdf5(input, path=path)\n\n    elif not isinstance(input, h5py.Dataset):\n\n        # If a file object was passed, then we need to extract the filename\n        # because h5py cannot properly read in file objects.\n\n        if hasattr(input, 'read'):\n            try:\n                input = input.name\n            except AttributeError:\n                raise TypeError(\"h5py can only open regular files\")\n\n        # Open the file for reading, and recursively call read_table_hdf5 with\n        # the file object and the path.\n\n        f = h5py.File(input, 'r')\n\n        try:\n            return read_table_hdf5(f, path=path, character_as_bytes=character_as_bytes)\n        finally:\n            f.close()\n\n    # If we are here, `input` should be a Dataset object, which we can now\n    # convert to a Table.\n\n    # Create a Table object\n    from astropy.table import Table, meta, serialize\n\n    table = Table(np.array(input))\n\n    # Read the meta-data from the file. For back-compatibility, we can read\n    # the old file format where the serialized metadata were saved in the\n    # attributes of the HDF5 dataset.\n    # In the new format, instead, metadata are stored in a new dataset in the\n    # same file. This is introduced in Astropy 3.0\n    old_version_meta = META_KEY in input.attrs\n    new_version_meta = path is not None and meta_path(path) in input_save\n    if old_version_meta or new_version_meta:\n        if new_version_meta:\n            header = meta.get_header_from_yaml(\n                h.decode('utf-8') for h in input_save[meta_path(path)])\n        else:\n            # Must be old_version_meta is True. if (A or B) and not A then B is True\n            header = meta.get_header_from_yaml(\n                h.decode('utf-8') for h in input.attrs[META_KEY])\n        if 'meta' in list(header.keys()):\n            table.meta = header['meta']\n\n        header_cols = dict((x['name'], x) for x in header['datatype'])\n        for col in table.columns.values():\n            for attr in ('description', 'format', 'unit', 'meta'):\n                if attr in header_cols[col.name]:\n                    setattr(col, attr, header_cols[col.name][attr])\n\n        # Construct new table with mixins, using tbl.meta['__serialized_columns__']\n        # as guidance.\n        table = serialize._construct_mixins_from_columns(table)\n\n    else:\n        # Read the meta-data from the file\n        table.meta.update(input.attrs)\n\n    if not character_as_bytes:\n        table.convert_bytestring_to_unicode()\n\n    return table"},{"attributeType":"null","col":8,"comment":"null","endLoc":386,"id":3161,"name":"_init_kwargs","nodeType":"Attribute","startLoc":386,"text":"self._init_kwargs"},{"col":0,"comment":"\n    Generate matrices for rotation by some angle around some axis.\n\n    Parameters\n    ----------\n    angle : angle-like\n        The amount of rotation the matrices should represent.  Can be an array.\n    axis : str or array-like\n        Either ``'x'``, ``'y'``, ``'z'``, or a (x,y,z) specifying the axis to\n        rotate about. If ``'x'``, ``'y'``, or ``'z'``, the rotation sense is\n        counterclockwise looking down the + axis (e.g. positive rotations obey\n        left-hand-rule).  If given as an array, the last dimension should be 3;\n        it will be broadcast against ``angle``.\n    unit : unit-like, optional\n        If ``angle`` does not have associated units, they are in this\n        unit.  If neither are provided, it is assumed to be degrees.\n\n    Returns\n    -------\n    rmat : `numpy.matrix`\n        A unitary rotation matrix.\n    ","endLoc":101,"header":"def rotation_matrix(angle, axis='z', unit=None)","id":3162,"name":"rotation_matrix","nodeType":"Function","startLoc":41,"text":"def rotation_matrix(angle, axis='z', unit=None):\n    \"\"\"\n    Generate matrices for rotation by some angle around some axis.\n\n    Parameters\n    ----------\n    angle : angle-like\n        The amount of rotation the matrices should represent.  Can be an array.\n    axis : str or array-like\n        Either ``'x'``, ``'y'``, ``'z'``, or a (x,y,z) specifying the axis to\n        rotate about. If ``'x'``, ``'y'``, or ``'z'``, the rotation sense is\n        counterclockwise looking down the + axis (e.g. positive rotations obey\n        left-hand-rule).  If given as an array, the last dimension should be 3;\n        it will be broadcast against ``angle``.\n    unit : unit-like, optional\n        If ``angle`` does not have associated units, they are in this\n        unit.  If neither are provided, it is assumed to be degrees.\n\n    Returns\n    -------\n    rmat : `numpy.matrix`\n        A unitary rotation matrix.\n    \"\"\"\n    if isinstance(angle, u.Quantity):\n        angle = angle.to_value(u.radian)\n    else:\n        if unit is None:\n            angle = np.deg2rad(angle)\n        else:\n            angle = u.Unit(unit).to(u.rad, angle)\n\n    s = np.sin(angle)\n    c = np.cos(angle)\n\n    # use optimized implementations for x/y/z\n    try:\n        i = 'xyz'.index(axis)\n    except TypeError:\n        axis = np.asarray(axis)\n        axis = axis / np.sqrt((axis * axis).sum(axis=-1, keepdims=True))\n        R = (axis[..., np.newaxis] * axis[..., np.newaxis, :] *\n             (1. - c)[..., np.newaxis, np.newaxis])\n\n        for i in range(0, 3):\n            R[..., i, i] += c\n            a1 = (i + 1) % 3\n            a2 = (i + 2) % 3\n            R[..., a1, a2] += axis[..., i] * s\n            R[..., a2, a1] -= axis[..., i] * s\n\n    else:\n        a1 = (i + 1) % 3\n        a2 = (i + 2) % 3\n        R = np.zeros(getattr(angle, 'shape', ()) + (3, 3))\n        R[..., i, i] = 1.\n        R[..., a1, a1] = c\n        R[..., a1, a2] = s\n        R[..., a2, a1] = -s\n        R[..., a2, a2] = c\n\n    return R"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":3163,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"pickle_helpers.py#<anonymous>","id":3164,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module contains simple input/output related functionality that is not\npart of a larger framework or standard.\n\"\"\"\n\n__all__ = ['fnpickle', 'fnunpickle']"},{"className":"AstropyTypeMeta","col":0,"comment":"\n    Keeps track of `AstropyType` subclasses that are created so that they can\n    be stored automatically by astropy extensions for ASDF.\n    ","endLoc":31,"id":3165,"nodeType":"Class","startLoc":16,"text":"class AstropyTypeMeta(ExtensionTypeMeta):\n    \"\"\"\n    Keeps track of `AstropyType` subclasses that are created so that they can\n    be stored automatically by astropy extensions for ASDF.\n    \"\"\"\n    def __new__(mcls, name, bases, attrs):\n        cls = super().__new__(mcls, name, bases, attrs)\n        # Classes using this metaclass are automatically added to the list of\n        # astropy extensions\n        if cls.__name__ not in _TYPE_BASE_CLASS_NAMES:\n            if cls.organization == 'astropy.org' and cls.standard == 'astropy':\n                _astropy_types.add(cls)\n            elif cls.organization == 'stsci.edu' and cls.standard == 'asdf':\n                _astropy_asdf_types.add(cls)\n\n        return cls"},{"col":0,"comment":"null","endLoc":28,"header":"def download_image_save_cutout(url, position, size)","id":3166,"name":"download_image_save_cutout","nodeType":"Function","startLoc":9,"text":"def download_image_save_cutout(url, position, size):\n    # Download the image\n    filename = download_file(url)\n\n    # Load the image and the WCS\n    hdu = fits.open(filename)[0]\n    wcs = WCS(hdu.header)\n\n    # Make the cutout, including the WCS\n    cutout = Cutout2D(hdu.data, position=position, size=size, wcs=wcs)\n\n    # Put the cutout image in the FITS HDU\n    hdu.data = cutout.data\n\n    # Update the FITS header with the cutout WCS\n    hdu.header.update(cutout.wcs.to_header())\n\n    # Write the cutout to a new FITS file\n    cutout_filename = 'example_cutout.fits'\n    hdu.writeto(cutout_filename, overwrite=True)"},{"col":4,"comment":"null","endLoc":31,"header":"def __new__(mcls, name, bases, attrs)","id":3167,"name":"__new__","nodeType":"Function","startLoc":21,"text":"def __new__(mcls, name, bases, attrs):\n        cls = super().__new__(mcls, name, bases, attrs)\n        # Classes using this metaclass are automatically added to the list of\n        # astropy extensions\n        if cls.__name__ not in _TYPE_BASE_CLASS_NAMES:\n            if cls.organization == 'astropy.org' and cls.standard == 'astropy':\n                _astropy_types.add(cls)\n            elif cls.organization == 'stsci.edu' and cls.standard == 'asdf':\n                _astropy_asdf_types.add(cls)\n\n        return cls"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf","id":3168,"nodeType":"File","text":""},{"attributeType":"null","col":8,"comment":"null","endLoc":22,"id":3169,"name":"cls","nodeType":"Attribute","startLoc":22,"text":"cls"},{"className":"AstropyType","col":0,"comment":"\n    This class represents types that have schemas and tags that are defined by\n    Astropy.\n\n    IMPORTANT: This parent class should **not** be used for types that have\n    schemas that are defined by the ASDF standard.\n    ","endLoc":43,"id":3170,"nodeType":"Class","startLoc":34,"text":"class AstropyType(CustomType, metaclass=AstropyTypeMeta):\n    \"\"\"\n    This class represents types that have schemas and tags that are defined by\n    Astropy.\n\n    IMPORTANT: This parent class should **not** be used for types that have\n    schemas that are defined by the ASDF standard.\n    \"\"\"\n    organization = 'astropy.org'\n    standard = 'astropy'"},{"attributeType":"null","col":4,"comment":"null","endLoc":42,"id":3171,"name":"organization","nodeType":"Attribute","startLoc":42,"text":"organization"},{"col":4,"comment":"Calculate sidereal time.\n\n        Parameters\n        ----------\n        kind : str\n            ``'mean'`` or ``'apparent'``, i.e., accounting for precession\n            only, or also for nutation.\n        longitude : `~astropy.units.Quantity`, `~astropy.coordinates.EarthLocation`, str, or None; optional\n            The longitude on the Earth at which to compute the Earth rotation\n            angle (taken from a location as needed).  If `None` (default), taken\n            from the ``location`` attribute of the Time instance. If the special\n            string  'greenwich' or 'tio', the result will be relative to longitude\n            0 for models before 2000, and relative to the Terrestrial Intermediate\n            Origin (TIO) for later ones (i.e., the output of the relevant ERFA\n            function that calculates greenwich sidereal time).\n        model : str or None; optional\n            Precession (and nutation) model to use.  The available ones are:\n            - {0}: {1}\n            - {2}: {3}\n            If `None` (default), the last (most recent) one from the appropriate\n            list above is used.\n\n        Returns\n        -------\n        `~astropy.coordinates.Longitude`\n            Local sidereal time, with units of hourangle.\n\n        See Also\n        --------\n        astropy.time.Time.earth_rotation_angle\n\n        References\n        ----------\n        IAU 2006 NFA Glossary\n        (currently located at: https://syrte.obspm.fr/iauWGnfa/NFA_Glossary.html)\n\n        Notes\n        -----\n        The difference between apparent sidereal time and Earth rotation angle\n        is the equation of the origins, which is the angle between the Celestial\n        Intermediate Origin (CIO) and the equinox. Applying apparent sidereal\n        time to the hour angle yields the true apparent Right Ascension with\n        respect to the equinox, while applying the Earth rotation angle yields\n        the intermediate (CIRS) Right Ascension with respect to the CIO.\n\n        For the IAU precession models from 2000 onwards, the result includes the\n        TIO locator (s'), which positions the Terrestrial Intermediate Origin on\n        the equator of the Celestial Intermediate Pole (CIP) and is rigorously\n        corrected for polar motion (except when ``longitude='tio'`` or ``'greenwich'``).\n\n        ","endLoc":1903,"header":"def sidereal_time(self, kind, longitude=None, model=None)","id":3172,"name":"sidereal_time","nodeType":"Function","startLoc":1829,"text":"def sidereal_time(self, kind, longitude=None, model=None):\n        \"\"\"Calculate sidereal time.\n\n        Parameters\n        ----------\n        kind : str\n            ``'mean'`` or ``'apparent'``, i.e., accounting for precession\n            only, or also for nutation.\n        longitude : `~astropy.units.Quantity`, `~astropy.coordinates.EarthLocation`, str, or None; optional\n            The longitude on the Earth at which to compute the Earth rotation\n            angle (taken from a location as needed).  If `None` (default), taken\n            from the ``location`` attribute of the Time instance. If the special\n            string  'greenwich' or 'tio', the result will be relative to longitude\n            0 for models before 2000, and relative to the Terrestrial Intermediate\n            Origin (TIO) for later ones (i.e., the output of the relevant ERFA\n            function that calculates greenwich sidereal time).\n        model : str or None; optional\n            Precession (and nutation) model to use.  The available ones are:\n            - {0}: {1}\n            - {2}: {3}\n            If `None` (default), the last (most recent) one from the appropriate\n            list above is used.\n\n        Returns\n        -------\n        `~astropy.coordinates.Longitude`\n            Local sidereal time, with units of hourangle.\n\n        See Also\n        --------\n        astropy.time.Time.earth_rotation_angle\n\n        References\n        ----------\n        IAU 2006 NFA Glossary\n        (currently located at: https://syrte.obspm.fr/iauWGnfa/NFA_Glossary.html)\n\n        Notes\n        -----\n        The difference between apparent sidereal time and Earth rotation angle\n        is the equation of the origins, which is the angle between the Celestial\n        Intermediate Origin (CIO) and the equinox. Applying apparent sidereal\n        time to the hour angle yields the true apparent Right Ascension with\n        respect to the equinox, while applying the Earth rotation angle yields\n        the intermediate (CIRS) Right Ascension with respect to the CIO.\n\n        For the IAU precession models from 2000 onwards, the result includes the\n        TIO locator (s'), which positions the Terrestrial Intermediate Origin on\n        the equator of the Celestial Intermediate Pole (CIP) and is rigorously\n        corrected for polar motion (except when ``longitude='tio'`` or ``'greenwich'``).\n\n        \"\"\"  # docstring is formatted below\n\n        if kind.lower() not in SIDEREAL_TIME_MODELS.keys():\n            raise ValueError('The kind of sidereal time has to be {}'.format(\n                ' or '.join(sorted(SIDEREAL_TIME_MODELS.keys()))))\n\n        available_models = SIDEREAL_TIME_MODELS[kind.lower()]\n\n        if model is None:\n            model = sorted(available_models.keys())[-1]\n        elif model.upper() not in available_models:\n            raise ValueError(\n                'Model {} not implemented for {} sidereal time; '\n                'available models are {}'\n                .format(model, kind, sorted(available_models.keys())))\n\n        model_kwargs = available_models[model.upper()]\n\n        if isinstance(longitude, str) and longitude in ('tio', 'greenwich'):\n            longitude = 0\n            model_kwargs = model_kwargs.copy()\n            model_kwargs['include_tio'] = False\n\n        return self._sid_time_or_earth_rot_ang(longitude=longitude, **model_kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":43,"id":3173,"name":"standard","nodeType":"Attribute","startLoc":43,"text":"standard"},{"className":"AstropyAsdfType","col":0,"comment":"\n    This class represents types that have schemas that are defined in the ASDF\n    standard, but have tags that are implemented within astropy.\n\n    IMPORTANT: This parent class should **not** be used for types that also\n    have schemas that are defined by astropy.\n    ","endLoc":55,"id":3174,"nodeType":"Class","startLoc":46,"text":"class AstropyAsdfType(CustomType, metaclass=AstropyTypeMeta):\n    \"\"\"\n    This class represents types that have schemas that are defined in the ASDF\n    standard, but have tags that are implemented within astropy.\n\n    IMPORTANT: This parent class should **not** be used for types that also\n    have schemas that are defined by astropy.\n    \"\"\"\n    organization = 'stsci.edu'\n    standard = 'asdf'"},{"attributeType":"null","col":4,"comment":"null","endLoc":54,"id":3175,"name":"organization","nodeType":"Attribute","startLoc":54,"text":"organization"},{"attributeType":"null","col":4,"comment":"null","endLoc":55,"id":3176,"name":"standard","nodeType":"Attribute","startLoc":55,"text":"standard"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":3177,"name":"__all__","nodeType":"Attribute","startLoc":6,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":3178,"name":"_TYPE_BASE_CLASS_NAMES","nodeType":"Attribute","startLoc":10,"text":"_TYPE_BASE_CLASS_NAMES"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":3179,"name":"_astropy_types","nodeType":"Attribute","startLoc":12,"text":"_astropy_types"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":3180,"name":"_astropy_asdf_types","nodeType":"Attribute","startLoc":13,"text":"_astropy_asdf_types"},{"col":0,"comment":"","endLoc":4,"header":"types.py#<anonymous>","id":3181,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['AstropyType', 'AstropyAsdfType']\n\n_TYPE_BASE_CLASS_NAMES = {'PolynomialTypeBase'}\n\n_astropy_types = set()\n\n_astropy_asdf_types = set()"},{"fileName":"extension.py","filePath":"astropy/io/misc/asdf","id":3182,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nimport os\n\nfrom asdf.extension import AsdfExtension, BuiltinExtension\nfrom asdf.util import filepath_to_url\n\n# Make sure that all tag implementations are imported by the time we create\n# the extension class so that _astropy_asdf_types is populated correctly. We\n# could do this using __init__ files, except it causes pytest import errors in\n# the case that asdf is not installed.\nfrom .tags.coordinates.angle import *  # noqa\nfrom .tags.coordinates.frames import *  # noqa\nfrom .tags.coordinates.earthlocation import *  # noqa\nfrom .tags.coordinates.skycoord import *  # noqa\nfrom .tags.coordinates.representation import *  # noqa\nfrom .tags.coordinates.spectralcoord import *  # noqa\nfrom .tags.fits.fits import *  # noqa\nfrom .tags.table.table import *  # noqa\nfrom .tags.time.time import *  # noqa\nfrom .tags.time.timedelta import *  # noqa\nfrom .tags.transform.basic import *  # noqa\nfrom .tags.transform.compound import *  # noqa\nfrom .tags.transform.functional_models import *  # noqa\nfrom .tags.transform.physical_models import *  # noqa\nfrom .tags.transform.math import *  # noqa\nfrom .tags.transform.polynomial import *  # noqa\nfrom .tags.transform.powerlaws import *  # noqa\nfrom .tags.transform.projections import *  # noqa\nfrom .tags.transform.spline import *  # noqa\nfrom .tags.transform.tabular import *  # noqa\nfrom .tags.unit.quantity import *  # noqa\nfrom .tags.unit.unit import *  # noqa\nfrom .tags.unit.equivalency import *  # noqa\nfrom .types import _astropy_types, _astropy_asdf_types\n\n\n__all__ = ['AstropyExtension', 'AstropyAsdfExtension']\n\n\nASTROPY_SCHEMA_URI_BASE = 'http://astropy.org/schemas/'\nSCHEMA_PATH = os.path.abspath(\n    os.path.join(os.path.dirname(__file__), 'data', 'schemas'))\nASTROPY_URL_MAPPING = [\n    (ASTROPY_SCHEMA_URI_BASE,\n     filepath_to_url(\n         os.path.join(SCHEMA_PATH, 'astropy.org')) +\n         '/{url_suffix}.yaml')]\n\n\n# This extension is used to register custom types that have both tags and\n# schemas defined by Astropy.\nclass AstropyExtension(AsdfExtension):\n    @property\n    def types(self):\n        return _astropy_types\n\n    @property\n    def tag_mapping(self):\n        return [('tag:astropy.org:astropy',\n                 ASTROPY_SCHEMA_URI_BASE + 'astropy{tag_suffix}')]\n\n    @property\n    def url_mapping(self):\n        return ASTROPY_URL_MAPPING\n\n\n# This extension is used to register custom tag types that have schemas defined\n# by ASDF, but have tag implementations defined in astropy.\nclass AstropyAsdfExtension(BuiltinExtension):\n    @property\n    def types(self):\n        return _astropy_asdf_types\n"},{"attributeType":"null","col":16,"comment":"null","endLoc":7,"id":3183,"name":"np","nodeType":"Attribute","startLoc":7,"text":"np"},{"attributeType":"null","col":29,"comment":"null","endLoc":11,"id":3184,"name":"u","nodeType":"Attribute","startLoc":11,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":3185,"name":"TCTYP_RE_TYPE","nodeType":"Attribute","startLoc":26,"text":"TCTYP_RE_TYPE"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":3186,"name":"TCTYP_RE_ALGO","nodeType":"Attribute","startLoc":27,"text":"TCTYP_RE_ALGO"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":3187,"name":"FITS_TIME_UNIT","nodeType":"Attribute","startLoc":31,"text":"FITS_TIME_UNIT"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":3188,"name":"TIME_KEYWORDS","nodeType":"Attribute","startLoc":35,"text":"TIME_KEYWORDS"},{"className":"AstropyExtension","col":0,"comment":"null","endLoc":66,"id":3189,"nodeType":"Class","startLoc":54,"text":"class AstropyExtension(AsdfExtension):\n    @property\n    def types(self):\n        return _astropy_types\n\n    @property\n    def tag_mapping(self):\n        return [('tag:astropy.org:astropy',\n                 ASTROPY_SCHEMA_URI_BASE + 'astropy{tag_suffix}')]\n\n    @property\n    def url_mapping(self):\n        return ASTROPY_URL_MAPPING"},{"attributeType":"null","col":0,"comment":"null","endLoc":44,"id":3190,"name":"COLUMN_TIME_KEYWORDS","nodeType":"Attribute","startLoc":44,"text":"COLUMN_TIME_KEYWORDS"},{"attributeType":"null","col":0,"comment":"null","endLoc":48,"id":3191,"name":"COLUMN_TIME_KEYWORD_REGEXP","nodeType":"Attribute","startLoc":48,"text":"COLUMN_TIME_KEYWORD_REGEXP"},{"attributeType":"null","col":0,"comment":"null","endLoc":64,"id":3192,"name":"GLOBAL_TIME_INFO","nodeType":"Attribute","startLoc":64,"text":"GLOBAL_TIME_INFO"},{"col":0,"comment":"","endLoc":3,"header":"fitstime.py#<anonymous>","id":3193,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"TCTYP_RE_TYPE = re.compile(r'(?P<type>[A-Z]+)[-]+')\n\nTCTYP_RE_ALGO = re.compile(r'(?P<algo>[A-Z]+)\\s*')\n\nFITS_TIME_UNIT = ['s', 'd', 'a', 'cy', 'min', 'h', 'yr', 'ta', 'Ba']\n\nTIME_KEYWORDS = ('TIMESYS', 'MJDREF', 'JDREF', 'DATEREF',\n                 'TREFPOS', 'TREFDIR', 'TIMEUNIT', 'TIMEOFFS',\n                 'OBSGEO-X', 'OBSGEO-Y', 'OBSGEO-Z',\n                 'OBSGEO-L', 'OBSGEO-B', 'OBSGEO-H', 'DATE',\n                 'DATE-OBS', 'DATE-AVG', 'DATE-BEG', 'DATE-END',\n                 'MJD-OBS', 'MJD-AVG', 'MJD-BEG', 'MJD-END')\n\nCOLUMN_TIME_KEYWORDS = ('TCTYP', 'TCUNI', 'TRPOS')\n\nCOLUMN_TIME_KEYWORD_REGEXP = f\"({'|'.join(COLUMN_TIME_KEYWORDS)})[0-9]+\"\n\nGLOBAL_TIME_INFO = {'TIMESYS': ('UTC', 'Default time scale'),\n                    'JDREF': (0.0, 'Time columns are jd = jd1 + jd2'),\n                    'TREFPOS': ('TOPOCENTER', 'Time reference position')}"},{"fileName":"connect.py","filePath":"astropy/io/misc/asdf","id":3194,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n# This file connects ASDF to the astropy.table.Table class\n\nimport functools\n\nfrom astropy.io import registry as io_registry\nfrom astropy.table import Table\n\n\ndef read_table(filename, data_key=None, find_table=None, **kwargs):\n    \"\"\"\n    Read a `~astropy.table.Table` object from an ASDF file\n\n    This requires `asdf <https://pypi.org/project/asdf/>`_ to be installed.\n    By default, this function will look for a Table object with the key of\n    ``data`` in the top-level ASDF tree. The parameters ``data_key`` and\n    ``find_key`` can be used to override the default behavior.\n\n    This function is registered as the Table reader for ASDF files with the\n    unified I/O interface.\n\n    Parameters\n    ----------\n    filename : str or :class:`py.lath:local`\n        Name of the file to be read\n    data_key : str\n        Optional top-level key to use for finding the Table in the tree. If not\n        provided, uses ``data`` by default. Use of this parameter is not\n        compatible with ``find_table``.\n    find_table : function\n        Optional function to be used for locating the Table in the tree. The\n        function takes a single parameter, which is a dictionary representing\n        the top of the ASDF tree. The function must return a\n        `~astropy.table.Table` instance.\n\n    Returns\n    -------\n    table : `~astropy.table.Table`\n        `~astropy.table.Table` instance\n    \"\"\"\n    try:\n        import asdf\n    except ImportError:\n        raise Exception(\n            \"The asdf module is required to read and write ASDF files\")\n\n    if data_key and find_table:\n        raise ValueError(\"Options 'data_key' and 'find_table' are not compatible\")\n\n    with asdf.open(filename, **kwargs) as af:\n        if find_table:\n            return find_table(af.tree)\n        else:\n            return af[data_key or 'data']\n\n\ndef write_table(table, filename, data_key=None, make_tree=None, **kwargs):\n    \"\"\"\n    Write a `~astropy.table.Table` object to an ASDF file.\n\n    This requires `asdf <https://pypi.org/project/asdf/>`_ to be installed.\n    By default, this function will write a Table object in the top-level ASDF\n    tree using the key of ``data``. The parameters ``data_key`` and\n    ``make_tree`` can be used to override the default behavior.\n\n    This function is registered as the Table writer for ASDF files with the\n    unified I/O interface.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        `~astropy.table.Table` instance to be written\n    filename : str or :class:`py.path:local`\n        Name of the new ASDF file to be created\n    data_key : str\n        Optional top-level key in the ASDF tree to use when writing the Table.\n        If not provided, uses ``data`` by default. Use of this parameter is not\n        compatible with ``make_tree``.\n    make_tree : function\n        Optional function to be used for creating the ASDF tree. The function\n        takes a single parameter, which is the `~astropy.table.Table` instance\n        to be written. The function must return a `dict` representing the ASDF\n        tree to be created.\n    \"\"\"\n    try:\n        import asdf\n    except ImportError:\n        raise Exception(\n            \"The asdf module is required to read and write ASDF files\")\n\n    if data_key and make_tree:\n        raise ValueError(\"Options 'data_key' and 'make_tree' are not compatible\")\n\n    if make_tree:\n        tree = make_tree(table)\n    else:\n        tree = {data_key or 'data' : table}\n\n    with asdf.AsdfFile(tree) as af:\n        af.write_to(filename, **kwargs)\n\n\ndef asdf_identify(origin, filepath, fileobj, *args, **kwargs):\n    try:\n        import asdf\n    except ImportError:\n        return False\n\n    return filepath is not None and filepath.endswith('.asdf')\n\n\nio_registry.register_reader('asdf', Table, read_table)\nio_registry.register_writer('asdf', Table, write_table)\nio_registry.register_identifier('asdf', Table, asdf_identify)\n"},{"col":4,"comment":"Find UT1 - UTC differences by interpolating in IERS Table.\n\n        Parameters\n        ----------\n        iers_table : `~astropy.utils.iers.IERS`, optional\n            Table containing UT1-UTC differences from IERS Bulletins A\n            and/or B.  Default: `~astropy.utils.iers.earth_orientation_table`\n            (which in turn defaults to the combined version provided by\n            `~astropy.utils.iers.IERS_Auto`).\n        return_status : bool\n            Whether to return status values.  If `False` (default), iers\n            raises `IndexError` if any time is out of the range\n            covered by the IERS table.\n\n        Returns\n        -------\n        ut1_utc : float or float array\n            UT1-UTC, interpolated in IERS Table\n        status : int or int array\n            Status values (if ``return_status=`True```)::\n            ``astropy.utils.iers.FROM_IERS_B``\n            ``astropy.utils.iers.FROM_IERS_A``\n            ``astropy.utils.iers.FROM_IERS_A_PREDICTION``\n            ``astropy.utils.iers.TIME_BEFORE_IERS_RANGE``\n            ``astropy.utils.iers.TIME_BEYOND_IERS_RANGE``\n\n        Notes\n        -----\n        In normal usage, UT1-UTC differences are calculated automatically\n        on the first instance ut1 is needed.\n\n        Examples\n        --------\n        To check in code whether any times are before the IERS table range::\n\n            >>> from astropy.utils.iers import TIME_BEFORE_IERS_RANGE\n            >>> t = Time(['1961-01-01', '2000-01-01'], scale='utc')\n            >>> delta, status = t.get_delta_ut1_utc(return_status=True)  # doctest: +REMOTE_DATA\n            >>> status == TIME_BEFORE_IERS_RANGE  # doctest: +REMOTE_DATA\n            array([ True, False]...)\n        ","endLoc":2027,"header":"def get_delta_ut1_utc(self, iers_table=None, return_status=False)","id":3195,"name":"get_delta_ut1_utc","nodeType":"Function","startLoc":1981,"text":"def get_delta_ut1_utc(self, iers_table=None, return_status=False):\n        \"\"\"Find UT1 - UTC differences by interpolating in IERS Table.\n\n        Parameters\n        ----------\n        iers_table : `~astropy.utils.iers.IERS`, optional\n            Table containing UT1-UTC differences from IERS Bulletins A\n            and/or B.  Default: `~astropy.utils.iers.earth_orientation_table`\n            (which in turn defaults to the combined version provided by\n            `~astropy.utils.iers.IERS_Auto`).\n        return_status : bool\n            Whether to return status values.  If `False` (default), iers\n            raises `IndexError` if any time is out of the range\n            covered by the IERS table.\n\n        Returns\n        -------\n        ut1_utc : float or float array\n            UT1-UTC, interpolated in IERS Table\n        status : int or int array\n            Status values (if ``return_status=`True```)::\n            ``astropy.utils.iers.FROM_IERS_B``\n            ``astropy.utils.iers.FROM_IERS_A``\n            ``astropy.utils.iers.FROM_IERS_A_PREDICTION``\n            ``astropy.utils.iers.TIME_BEFORE_IERS_RANGE``\n            ``astropy.utils.iers.TIME_BEYOND_IERS_RANGE``\n\n        Notes\n        -----\n        In normal usage, UT1-UTC differences are calculated automatically\n        on the first instance ut1 is needed.\n\n        Examples\n        --------\n        To check in code whether any times are before the IERS table range::\n\n            >>> from astropy.utils.iers import TIME_BEFORE_IERS_RANGE\n            >>> t = Time(['1961-01-01', '2000-01-01'], scale='utc')\n            >>> delta, status = t.get_delta_ut1_utc(return_status=True)  # doctest: +REMOTE_DATA\n            >>> status == TIME_BEFORE_IERS_RANGE  # doctest: +REMOTE_DATA\n            array([ True, False]...)\n        \"\"\"\n        if iers_table is None:\n            from astropy.utils.iers import earth_orientation_table\n            iers_table = earth_orientation_table.get()\n\n        return iers_table.ut1_utc(self.utc, return_status=return_status)"},{"col":4,"comment":"null","endLoc":57,"header":"@property\n    def types(self)","id":3196,"name":"types","nodeType":"Function","startLoc":55,"text":"@property\n    def types(self):\n        return _astropy_types"},{"col":4,"comment":"null","endLoc":62,"header":"@property\n    def tag_mapping(self)","id":3197,"name":"tag_mapping","nodeType":"Function","startLoc":59,"text":"@property\n    def tag_mapping(self):\n        return [('tag:astropy.org:astropy',\n                 ASTROPY_SCHEMA_URI_BASE + 'astropy{tag_suffix}')]"},{"col":4,"comment":"null","endLoc":66,"header":"@property\n    def url_mapping(self)","id":3198,"name":"url_mapping","nodeType":"Function","startLoc":64,"text":"@property\n    def url_mapping(self):\n        return ASTROPY_URL_MAPPING"},{"className":"AstropyAsdfExtension","col":0,"comment":"null","endLoc":74,"id":3199,"nodeType":"Class","startLoc":71,"text":"class AstropyAsdfExtension(BuiltinExtension):\n    @property\n    def types(self):\n        return _astropy_asdf_types"},{"col":4,"comment":"null","endLoc":74,"header":"@property\n    def types(self)","id":3200,"name":"types","nodeType":"Function","startLoc":72,"text":"@property\n    def types(self):\n        return _astropy_asdf_types"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":3201,"name":"__all__","nodeType":"Attribute","startLoc":39,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":42,"id":3202,"name":"ASTROPY_SCHEMA_URI_BASE","nodeType":"Attribute","startLoc":42,"text":"ASTROPY_SCHEMA_URI_BASE"},{"attributeType":"null","col":0,"comment":"null","endLoc":43,"id":3203,"name":"SCHEMA_PATH","nodeType":"Attribute","startLoc":43,"text":"SCHEMA_PATH"},{"attributeType":"null","col":0,"comment":"null","endLoc":45,"id":3204,"name":"ASTROPY_URL_MAPPING","nodeType":"Attribute","startLoc":45,"text":"ASTROPY_URL_MAPPING"},{"col":0,"comment":"","endLoc":4,"header":"extension.py#<anonymous>","id":3205,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['AstropyExtension', 'AstropyAsdfExtension']\n\nASTROPY_SCHEMA_URI_BASE = 'http://astropy.org/schemas/'\n\nSCHEMA_PATH = os.path.abspath(\n    os.path.join(os.path.dirname(__file__), 'data', 'schemas'))\n\nASTROPY_URL_MAPPING = [\n    (ASTROPY_SCHEMA_URI_BASE,\n     filepath_to_url(\n         os.path.join(SCHEMA_PATH, 'astropy.org')) +\n         '/{url_suffix}.yaml')]"},{"col":0,"comment":"\n    Read a `~astropy.table.Table` object from an ASDF file\n\n    This requires `asdf <https://pypi.org/project/asdf/>`_ to be installed.\n    By default, this function will look for a Table object with the key of\n    ``data`` in the top-level ASDF tree. The parameters ``data_key`` and\n    ``find_key`` can be used to override the default behavior.\n\n    This function is registered as the Table reader for ASDF files with the\n    unified I/O interface.\n\n    Parameters\n    ----------\n    filename : str or :class:`py.lath:local`\n        Name of the file to be read\n    data_key : str\n        Optional top-level key to use for finding the Table in the tree. If not\n        provided, uses ``data`` by default. Use of this parameter is not\n        compatible with ``find_table``.\n    find_table : function\n        Optional function to be used for locating the Table in the tree. The\n        function takes a single parameter, which is a dictionary representing\n        the top of the ASDF tree. The function must return a\n        `~astropy.table.Table` instance.\n\n    Returns\n    -------\n    table : `~astropy.table.Table`\n        `~astropy.table.Table` instance\n    ","endLoc":55,"header":"def read_table(filename, data_key=None, find_table=None, **kwargs)","id":3206,"name":"read_table","nodeType":"Function","startLoc":11,"text":"def read_table(filename, data_key=None, find_table=None, **kwargs):\n    \"\"\"\n    Read a `~astropy.table.Table` object from an ASDF file\n\n    This requires `asdf <https://pypi.org/project/asdf/>`_ to be installed.\n    By default, this function will look for a Table object with the key of\n    ``data`` in the top-level ASDF tree. The parameters ``data_key`` and\n    ``find_key`` can be used to override the default behavior.\n\n    This function is registered as the Table reader for ASDF files with the\n    unified I/O interface.\n\n    Parameters\n    ----------\n    filename : str or :class:`py.lath:local`\n        Name of the file to be read\n    data_key : str\n        Optional top-level key to use for finding the Table in the tree. If not\n        provided, uses ``data`` by default. Use of this parameter is not\n        compatible with ``find_table``.\n    find_table : function\n        Optional function to be used for locating the Table in the tree. The\n        function takes a single parameter, which is a dictionary representing\n        the top of the ASDF tree. The function must return a\n        `~astropy.table.Table` instance.\n\n    Returns\n    -------\n    table : `~astropy.table.Table`\n        `~astropy.table.Table` instance\n    \"\"\"\n    try:\n        import asdf\n    except ImportError:\n        raise Exception(\n            \"The asdf module is required to read and write ASDF files\")\n\n    if data_key and find_table:\n        raise ValueError(\"Options 'data_key' and 'find_table' are not compatible\")\n\n    with asdf.open(filename, **kwargs) as af:\n        if find_table:\n            return find_table(af.tree)\n        else:\n            return af[data_key or 'data']"},{"col":4,"comment":"\n        Get ERFA DUT arg = UT1 - UTC.  This getter takes optional jd1 and\n        jd2 args because it gets called that way when converting time scales.\n        If delta_ut1_utc is not yet set, this will interpolate them from the\n        the IERS table.\n        ","endLoc":2063,"header":"def _get_delta_ut1_utc(self, jd1=None, jd2=None)","id":3207,"name":"_get_delta_ut1_utc","nodeType":"Function","startLoc":2030,"text":"def _get_delta_ut1_utc(self, jd1=None, jd2=None):\n        \"\"\"\n        Get ERFA DUT arg = UT1 - UTC.  This getter takes optional jd1 and\n        jd2 args because it gets called that way when converting time scales.\n        If delta_ut1_utc is not yet set, this will interpolate them from the\n        the IERS table.\n        \"\"\"\n        # Sec. 4.3.1: the arg DUT is the quantity delta_UT1 = UT1 - UTC in\n        # seconds. It is obtained from tables published by the IERS.\n        if not hasattr(self, '_delta_ut1_utc'):\n            from astropy.utils.iers import earth_orientation_table\n            iers_table = earth_orientation_table.get()\n            # jd1, jd2 are normally set (see above), except if delta_ut1_utc\n            # is access directly; ensure we behave as expected for that case\n            if jd1 is None:\n                self_utc = self.utc\n                jd1, jd2 = self_utc._time.jd1, self_utc._time.jd2_filled\n                scale = 'utc'\n            else:\n                scale = self.scale\n            # interpolate UT1-UTC in IERS table\n            delta = iers_table.ut1_utc(jd1, jd2)\n            # if we interpolated using UT1 jds, we may be off by one\n            # second near leap seconds (and very slightly off elsewhere)\n            if scale == 'ut1':\n                # calculate UTC using the offset we got; the ERFA routine\n                # is tolerant of leap seconds, so will do this right\n                jd1_utc, jd2_utc = erfa.ut1utc(jd1, jd2, delta.to_value(u.s))\n                # calculate a better estimate using the nearly correct UTC\n                delta = iers_table.ut1_utc(jd1_utc, jd2_utc)\n\n            self._set_delta_ut1_utc(delta)\n\n        return self._delta_ut1_utc"},{"col":0,"comment":"\n    Write a `~astropy.table.Table` object to an ASDF file.\n\n    This requires `asdf <https://pypi.org/project/asdf/>`_ to be installed.\n    By default, this function will write a Table object in the top-level ASDF\n    tree using the key of ``data``. The parameters ``data_key`` and\n    ``make_tree`` can be used to override the default behavior.\n\n    This function is registered as the Table writer for ASDF files with the\n    unified I/O interface.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        `~astropy.table.Table` instance to be written\n    filename : str or :class:`py.path:local`\n        Name of the new ASDF file to be created\n    data_key : str\n        Optional top-level key in the ASDF tree to use when writing the Table.\n        If not provided, uses ``data`` by default. Use of this parameter is not\n        compatible with ``make_tree``.\n    make_tree : function\n        Optional function to be used for creating the ASDF tree. The function\n        takes a single parameter, which is the `~astropy.table.Table` instance\n        to be written. The function must return a `dict` representing the ASDF\n        tree to be created.\n    ","endLoc":101,"header":"def write_table(table, filename, data_key=None, make_tree=None, **kwargs)","id":3208,"name":"write_table","nodeType":"Function","startLoc":58,"text":"def write_table(table, filename, data_key=None, make_tree=None, **kwargs):\n    \"\"\"\n    Write a `~astropy.table.Table` object to an ASDF file.\n\n    This requires `asdf <https://pypi.org/project/asdf/>`_ to be installed.\n    By default, this function will write a Table object in the top-level ASDF\n    tree using the key of ``data``. The parameters ``data_key`` and\n    ``make_tree`` can be used to override the default behavior.\n\n    This function is registered as the Table writer for ASDF files with the\n    unified I/O interface.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        `~astropy.table.Table` instance to be written\n    filename : str or :class:`py.path:local`\n        Name of the new ASDF file to be created\n    data_key : str\n        Optional top-level key in the ASDF tree to use when writing the Table.\n        If not provided, uses ``data`` by default. Use of this parameter is not\n        compatible with ``make_tree``.\n    make_tree : function\n        Optional function to be used for creating the ASDF tree. The function\n        takes a single parameter, which is the `~astropy.table.Table` instance\n        to be written. The function must return a `dict` representing the ASDF\n        tree to be created.\n    \"\"\"\n    try:\n        import asdf\n    except ImportError:\n        raise Exception(\n            \"The asdf module is required to read and write ASDF files\")\n\n    if data_key and make_tree:\n        raise ValueError(\"Options 'data_key' and 'make_tree' are not compatible\")\n\n    if make_tree:\n        tree = make_tree(table)\n    else:\n        tree = {data_key or 'data' : table}\n\n    with asdf.AsdfFile(tree) as af:\n        af.write_to(filename, **kwargs)"},{"col":4,"comment":"null","endLoc":2070,"header":"def _set_delta_ut1_utc(self, val)","id":3209,"name":"_set_delta_ut1_utc","nodeType":"Function","startLoc":2065,"text":"def _set_delta_ut1_utc(self, val):\n        del self.cache\n        if hasattr(val, 'to'):  # Matches Quantity but also TimeDelta.\n            val = val.to(u.second).value\n        val = self._match_shape(val)\n        self._delta_ut1_utc = val"},{"id":3210,"name":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/fits","nodeType":"Package"},{"id":3211,"name":"fits-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/fits","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/fits/fits-1.0.0\"\ntitle: >\n  A FITS file inside of an ASDF file.\ndescription: |\n  This schema is useful for distributing ASDF files that can\n  automatically be converted to FITS files by specifying the exact\n  content of the resulting FITS file.\n\n  Not all kinds of data in FITS are directly representable in ASDF.\n  For example, applying an offset and scale to the data using the\n  `BZERO` and `BSCALE` keywords.  In these cases, it will not be\n  possible to store the data in the native format from FITS and also\n  be accessible in its proper form in the ASDF file.\n\n  Only image and binary table extensions are supported.\n\nexamples:\n  -\n    - A simple FITS file with a primary header and two extensions\n    - |\n        !<tag:astropy.org:astropy/fits/fits-1.0.0>\n            - header:\n              - [SIMPLE, true, conforms to FITS standard]\n              - [BITPIX, 8, array data type]\n              - [NAXIS, 0, number of array dimensions]\n              - [EXTEND, true]\n              - []\n              - ['', Top Level MIRI Metadata]\n              - []\n              - [DATE, '2013-08-30T10:49:55.070373', The date this file was created (UTC)]\n              - [FILENAME, MiriDarkReferenceModel_test.fits, The name of the file]\n              - [TELESCOP, JWST, The telescope used to acquire the data]\n              - []\n              - ['', Information about the observation]\n              - []\n              - [DATE-OBS, '2013-08-30T10:49:55.000000', The date the observation was made (UTC)]\n            - data: !core/ndarray-1.0.0\n                datatype: float32\n                shape: [2, 3, 3, 4]\n                source: 0\n                byteorder: big\n              header:\n              - [XTENSION, IMAGE, Image extension]\n              - [BITPIX, -32, array data type]\n              - [NAXIS, 4, number of array dimensions]\n              - [NAXIS1, 4]\n              - [NAXIS2, 3]\n              - [NAXIS3, 3]\n              - [NAXIS4, 2]\n              - [PCOUNT, 0, number of parameters]\n              - [GCOUNT, 1, number of groups]\n              - [EXTNAME, SCI, extension name]\n              - [BUNIT, DN, Units of the data array]\n            - data: !core/ndarray-1.0.0\n                datatype: float32\n                shape: [2, 3, 3, 4]\n                source: 1\n                byteorder: big\n              header:\n              - [XTENSION, IMAGE, Image extension]\n              - [BITPIX, -32, array data type]\n              - [NAXIS, 4, number of array dimensions]\n              - [NAXIS1, 4]\n              - [NAXIS2, 3]\n              - [NAXIS3, 3]\n              - [NAXIS4, 2]\n              - [PCOUNT, 0, number of parameters]\n              - [GCOUNT, 1, number of groups]\n              - [EXTNAME, ERR, extension name]\n              - [BUNIT, DN, Units of the error array]\n\nallOf:\n  - tag: \"tag:astropy.org:astropy/fits/fits-1.0.0\"\n  - type: array\n    items:\n      type: object\n      properties:\n        data:\n          description: \"The data part of the HDU.\"\n          anyOf:\n            - $ref: \"tag:stsci.edu:asdf/core/ndarray-1.0.0\"\n            - $ref: \"../table/table-1.0.0\"\n            # Retain backwards compatibility with table defined by ASDF Standard\n            - $ref: \"tag:stsci.edu:asdf/core/table-1.0.0\"\n            - type: \"null\"\n          default: null\n"},{"id":3212,"name":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/time","nodeType":"Package"},{"id":3213,"name":"timedelta-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/time","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/asdf/asdf-schema-1.0.0\"\nid: \"http://astropy.org/schemas/astropy/time/time-1.1.0\"\ntitle: Represents an instance of TimeDelta from astropy\ndescription: |\n  Represents the time difference between two times.\n\ntype: object\nproperties:\n    jd1:\n      anyOf:\n        - type: number\n        - $ref: \"tag:stsci.edu:asdf/core/ndarray-1.0.0\"\n      description: |\n        Value representing first 64 bits of precision\n    jd2:\n      anyOf:\n        - type: number\n        - $ref: \"tag:stsci.edu:asdf/core/ndarray-1.0.0\"\n      description: |\n        Value representing second 64 bits of precision\n    format:\n      type: string\n      description: |\n        Format of time value representation.\n    scale:\n      type: string\n      description: |\n        Time scale of input value(s).\n      enum: [tdb, tt, ut1, tcg, tcb, tai, local]\nrequired: [jd1, jd2, format]\nadditionalProperties: False\n...\n"},{"id":3214,"name":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/table","nodeType":"Package"},{"id":3215,"name":"table-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/table","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/table/table-1.0.0\"\ntag: \"tag:astropy.org:astropy/table/table-1.0.0\"\n\ntitle: >\n  A table.\n\ndescription: |\n  A table is represented as a list of columns, where each entry is a\n  [column](ref:http://stsci.edu/schemas/asdf/core/column-1.0.0)\n  object, containing the data and some additional information.\n\n  The data itself may be stored inline as text, or in binary in either\n  row- or column-major order by use of the `strides` property on the\n  individual column arrays.\n\n  Each column in the table must have the same first (slowest moving)\n  dimension.\n\nexamples:\n  -\n    - A table stored in column-major order, with each column in a separate block\n    - |\n        !<tag:astropy.org:astropy/table/table-1.0.0>\n          columns:\n          - !core/column-1.0.0\n            data: !core/ndarray-1.0.0\n              source: 0\n              datatype: float64\n              byteorder: little\n              shape: [3]\n            description: RA\n            meta: {foo: bar}\n            name: a\n            unit: !unit/unit-1.0.0 deg\n          - !core/column-1.0.0\n            data: !core/ndarray-1.0.0\n              source: 1\n              datatype: float64\n              byteorder: little\n              shape: [3]\n            description: DEC\n            name: b\n          - !core/column-1.0.0\n            data: !core/ndarray-1.0.0\n              source: 2\n              datatype: [ascii, 1]\n              byteorder: big\n              shape: [3]\n            description: The target name\n            name: c\n          colnames: [a, b, c]\n\n  -\n    - A table stored in row-major order, all stored in the same block\n    - |\n        !<tag:astropy.org:astropy/table/table-1.0.0>\n          columns:\n          - !core/column-1.0.0\n            data: !core/ndarray-1.0.0\n              source: 0\n              datatype: float64\n              byteorder: little\n              shape: [3]\n              strides: [13]\n            description: RA\n            meta: {foo: bar}\n            name: a\n            unit: !unit/unit-1.0.0 deg\n          - !core/column-1.0.0\n            data: !core/ndarray-1.0.0\n              source: 0\n              datatype: float64\n              byteorder: little\n              shape: [3]\n              offset: 4\n              strides: [13]\n            description: DEC\n            name: b\n          - !core/column-1.0.0\n            data: !core/ndarray-1.0.0\n              source: 0\n              datatype: [ascii, 1]\n              byteorder: big\n              shape: [3]\n              offset: 12\n              strides: [13]\n            description: The target name\n            name: c\n          colnames: [a, b, c]\n\ntype: object\nproperties:\n  columns:\n    description: |\n      A list of columns in the table.\n    type: array\n    items:\n      anyOf:\n        - $ref: \"tag:stsci.edu:asdf/core/column-1.0.0\"\n        - $ref: \"tag:stsci.edu:asdf/core/ndarray-1.0.0\"\n        - $ref: \"tag:stsci.edu:asdf/time/time-1.1.0\"\n        - $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n        - $ref: \"../coordinates/skycoord-1.0.0\"\n        - $ref: \"../coordinates/earthlocation-1.0.0\"\n        - $ref: \"../time/timedelta-1.0.0\"\n\n  colnames:\n    description: |\n      A list containing the names of the columns in the table (in order).\n    type: array\n    items:\n      - type: string\n\n  qtable:\n    description: |\n      A flag indicating whether or not the serialized type was a QTable\n    type: boolean\n    default: False\n\n  meta:\n    description: |\n      Additional free-form metadata about the table.\n    type: object\n    default: {}\n\nadditionalProperties: false\nrequired: [columns, colnames]\n"},{"col":4,"comment":"null","endLoc":2114,"header":"def _get_delta_tdb_tt(self, jd1=None, jd2=None)","id":3216,"name":"_get_delta_tdb_tt","nodeType":"Function","startLoc":2078,"text":"def _get_delta_tdb_tt(self, jd1=None, jd2=None):\n        if not hasattr(self, '_delta_tdb_tt'):\n            # If jd1 and jd2 are not provided (which is the case for property\n            # attribute access) then require that the time scale is TT or TDB.\n            # Otherwise the computations here are not correct.\n            if jd1 is None or jd2 is None:\n                if self.scale not in ('tt', 'tdb'):\n                    raise ValueError('Accessing the delta_tdb_tt attribute '\n                                     'is only possible for TT or TDB time '\n                                     'scales')\n                else:\n                    jd1 = self._time.jd1\n                    jd2 = self._time.jd2_filled\n\n            # First go from the current input time (which is either\n            # TDB or TT) to an approximate UT1.  Since TT and TDB are\n            # pretty close (few msec?), assume TT.  Similarly, since the\n            # UT1 terms are very small, use UTC instead of UT1.\n            njd1, njd2 = erfa.tttai(jd1, jd2)\n            njd1, njd2 = erfa.taiutc(njd1, njd2)\n            # subtract 0.5, so UT is fraction of the day from midnight\n            ut = day_frac(njd1 - 0.5, njd2)[1]\n\n            if self.location is None:\n                # Assume geocentric.\n                self._delta_tdb_tt = erfa.dtdb(jd1, jd2, ut, 0., 0., 0.)\n            else:\n                location = self.location\n                # Geodetic params needed for d_tdb_tt()\n                lon = location.lon\n                rxy = np.hypot(location.x, location.y)\n                z = location.z\n                self._delta_tdb_tt = erfa.dtdb(\n                    jd1, jd2, ut, lon.to_value(u.radian),\n                    rxy.to_value(u.km), z.to_value(u.km))\n\n        return self._delta_tdb_tt"},{"id":3217,"name":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/transform","nodeType":"Package"},{"id":3218,"name":"units_mapping-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/transform","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/transform/units_mapping-1.0.0\"\ntag: \"tag:astropy.org:astropy/transform/units_mapping-1.0.0\"\n\ntitle: |\n  Mapper that operates on the units of the input.\n\ndescription: |\n  This transform operates on the units of the input, first converting to\n  the expected input units, then assigning replacement output units without\n  further conversion.\n\nexamples:\n  -\n    - Assign units of seconds to dimensionless input.\n    - |\n      !<tag:astropy.org:astropy/transform/units_mapping-1.0.0>\n        unit_inputs:\n          - name: x\n            unit: !unit/unit-1.0.0\n        unit_outputs:\n          - name: x\n            unit: !unit/unit-1.0.0 s\n  -\n    - Convert input to meters, then assign dimensionless units.\n    - |\n      !<tag:astropy.org:astropy/transform/units_mapping-1.0.0>\n        unit_inputs:\n          - name: x\n            unit: !unit/unit-1.0.0 m\n        unit_outputs:\n          - name: x\n            unit: !unit/unit-1.0.0\n\n  -\n    - Convert input to meters, then drop units entirely.\n    - |\n      !<tag:astropy.org:astropy/transform/units_mapping-1.0.0>\n        unit_inputs:\n          - name: x\n            unit: !unit/unit-1.0.0 m\n        unit_outputs:\n          - name: x\n\n  -\n    - Accept any units, then replace with meters.\n    - |\n      !<tag:astropy.org:astropy/transform/units_mapping-1.0.0>\n        unit_inputs:\n          - name: x\n        unit_outputs:\n          - name: x\n            unit: !unit/unit-1.0.0 m\n\nallOf:\n  - $ref: \"http://stsci.edu/schemas/asdf/transform/transform-1.2.0\"\n  - type: object\n    properties:\n      unit_inputs:\n        description: |\n          Array of input configurations.\n        type: array\n        items:\n          $ref: \"#/definitions/value_configuration\"\n      unit_outputs:\n        description: |\n          Array of output configurations.\n        type: array\n        items:\n          $ref: \"#/definitions/value_configuration\"\n    required: [unit_inputs, unit_outputs]\n\ndefinitions:\n  value_configuration:\n    description: |\n      Configuration of a single model value (input or output).\n    type: object\n    properties:\n      name:\n        description: |\n          Value name.\n        type: string\n      unit:\n        description: |\n          Expected unit.\n        $ref: \"http://stsci.edu/schemas/asdf/unit/unit-1.0.0\"\n      equivalencies:\n        description: |\n          Equivalencies to apply when converting value to expected unit.\n        $ref: \"http://astropy.org/schemas/astropy/units/equivalency-1.0.0\"\n      allow_dimensionless:\n        description: |\n          Allow this value to receive dimensionless data.\n        type: boolean\n        default: false\n    required: [name]\n...\n"},{"id":3219,"name":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/units","nodeType":"Package"},{"id":3220,"name":"equivalency-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/units","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/units/equivalency-1.0.0\"\ntag: \"tag:astropy.org:astropy/units/equivalency-1.0.0\"\n\ntitle: |\n  Represents unit equivalency.\n\ndescription: |\n  Supports serialization of equivalencies between units\n  in certain contexts\n\ndefinitions:\n  equivalency:\n    type: object\n    properties:\n      name:\n        type: string\n      kwargs_names:\n        type: array\n        items:\n          type: string\n      kwargs_values:\n        type: array\n        items:\n          anyOf:\n            - $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n            - type: number\n            - type: \"null\"\n\ntype: array\nitems:\n  $ref: \"#/definitions/equivalency\"\n...\n"},{"id":3221,"name":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates","nodeType":"Package"},{"id":3222,"name":"angle-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/angle-1.0.0\"\ntag: \"tag:astropy.org:astropy/coordinates/angle-1.0.0\"\n\ntitle: |\n  Represents an Angle.\n\ndescription:\n  This object represents a subtype of Quantity which has units equivalent to\n  radians or degrees.\n\nexamples:\n  -\n    - An Angle object in Degrees\n    - |\n        !<tag:astropy.org:astropy/coordinates/angle-1.0.0>\n          unit: !unit/unit-1.0.0 deg\n          value: 10.0\n\ntype: object\nproperties:\n  value:\n    description: |\n      A vector of one or more values\n    anyOf:\n      - type: number\n      - $ref: \"tag:stsci.edu:asdf/core/ndarray-1.0.0\"\n  unit:\n    description: |\n      The unit corresponding to the values\n    $ref: \"tag:stsci.edu:asdf/unit/unit-1.0.0\"\nrequired: [value, unit]\n...\n"},{"id":3223,"name":"longitude-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/longitude-1.0.0\"\ntag: \"tag:astropy.org:astropy/coordinates/longitude-1.0.0\"\n\ntitle: |\n  Represents longitude-like angles.\n\ndescription: |\n    Longitude-like angle(s) which are wrapped within a contiguous 360 degree range.\n\nexamples:\n  -\n    - A Longitude object in Degrees\n    - |\n        !<tag:astropy.org:astropy/coordinates/longitude-1.0.0>\n          unit: !unit/unit-1.0.0 deg\n          value: 10.0\n          wrap_angle: !<tag:astropy.org:astropy/coordinates/angle-1.0.0>\n            unit: !unit/unit-1.0.0 deg\n            value: 180.0\n\ntype: object\nproperties:\n  value:\n    description: |\n      A vector of one or more values\n    anyOf:\n      - type: number\n      - $ref: \"tag:stsci.edu:asdf/core/ndarray-1.0.0\"\n  unit:\n    description: |\n      The unit corresponding to the values\n    $ref: \"tag:stsci.edu:asdf/unit/unit-1.0.0\"\n  wrap_angle:\n    description: |\n      Angle at which to wrap back to ``wrap_angle - 360 deg``.\n    $ref: \"angle-1.0.0\"\n\nrequired: [value, unit, wrap_angle]\n...\n"},{"id":3224,"name":"earthlocation-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/earthlocation-1.0.0\"\ntag: \"tag:astropy.org:astropy/coordinates/earthlocation-1.0.0\"\n\ntitle: |\n  Represents EarthLocation objects from astropy.\n\ndescription: |\n  Location on the Earth.\n\ntype: object\nproperties:\n  x:\n    description: |\n      X component of location in geocentric representation\n    $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n  y:\n    description: |\n      Y component of location in geocentric representation\n    $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n  z:\n    description: |\n      Z component of location in geocentric representation\n    $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n  ellipsoid:\n    description: |\n      Reference ellipsoid that is used when representing geodetic coordinates.\n    type: string\n    enum: [WGS84, GRS80, WGS72]\n\nrequired: [x, y, z]\nadditionalProperties: False\n...\n"},{"id":3225,"name":"skycoord-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/skycoord-1.0.0\"\ntag: \"tag:astropy.org:astropy/coordinates/skycoord-1.0.0\"\n\ntitle: |\n  Represents a SkyCoord object from astropy\n\nallOf:\n  - type: object\n    properties:\n      frame:\n        description: |\n          A string describing the kind of frame that is represented by this\n          SkyCoord object. This value is used when reconstructing SkyCoord.\n        type: string\nrequired: [frame]\nadditionalProperties: true\n...\n"},{"id":3226,"name":"latitude-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/latitude-1.0.0\"\ntag: \"tag:astropy.org:astropy/coordinates/latitude-1.0.0\"\n\ntitle: |\n  Represents latitude-like angles.\n\ndescription: |\n  Represents latitude-like angle(s) which must be in the range -90 to +90 deg.\n\nexamples:\n  -\n    - A Latitude object in Degrees\n    - |\n        !<tag:astropy.org:astropy/coordinates/latitude-1.0.0>\n          unit: !unit/unit-1.0.0 deg\n          value: 10.0\n\ntype: object\nproperties:\n  value:\n    description: |\n      A vector of one or more values\n    anyOf:\n      - type: number\n      - $ref: \"tag:stsci.edu:asdf/core/ndarray-1.0.0\"\n  unit:\n    description: |\n      The unit corresponding to the values\n    $ref: \"tag:stsci.edu:asdf/unit/unit-1.0.0\"\nrequired: [value, unit]\n...\n"},{"col":0,"comment":"null","endLoc":110,"header":"def asdf_identify(origin, filepath, fileobj, *args, **kwargs)","id":3227,"name":"asdf_identify","nodeType":"Function","startLoc":104,"text":"def asdf_identify(origin, filepath, fileobj, *args, **kwargs):\n    try:\n        import asdf\n    except ImportError:\n        return False\n\n    return filepath is not None and filepath.endswith('.asdf')"},{"col":4,"comment":"null","endLoc":2121,"header":"def _set_delta_tdb_tt(self, val)","id":3228,"name":"_set_delta_tdb_tt","nodeType":"Function","startLoc":2116,"text":"def _set_delta_tdb_tt(self, val):\n        del self.cache\n        if hasattr(val, 'to'):  # Matches Quantity but also TimeDelta.\n            val = val.to(u.second).value\n        val = self._match_shape(val)\n        self._delta_tdb_tt = val"},{"id":3229,"name":"representation-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/representation-1.0.0\"\ntag: \"tag:astropy.org:astropy/coordinates/representation-1.0.0\"\n\ntitle: |\n  Representation of points or differentials in two or three dimensional space.\n\ndescription: |\n  Representation of points or differentials in two or three dimensional space.\n\nexamples:\n  -\n    - A SphericalRepresentation\n    - |\n        !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n          components:\n            distance: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 AU, value: 1.0}\n            lat: !<tag:astropy.org:astropy/coordinates/latitude-1.0.0> {unit: !unit/unit-1.0.0 deg,\n              value: 10.0}\n            lon: !<tag:astropy.org:astropy/coordinates/longitude-1.0.0>\n              unit: !unit/unit-1.0.0 deg\n              value: 10.0\n              wrap_angle: !<tag:astropy.org:astropy/coordinates/angle-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                value: 360.0}\n          type: SphericalRepresentation\n  -\n    - A CartesianDifferential\n    - |\n        !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n          components:\n            d_x: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 km s-1, value: 100.0}\n            d_y: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 km s-1, value: 200.0}\n            d_z: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 km s-1, value: 3141.0}\n          type: CartesianDifferential\n\ntype: object\nproperties:\n  type:\n    type: string\n    enum:\n      - CartesianRepresentation\n      - SphericalRepresentation\n      - UnitSphericalRepresentation\n      - RadialRepresentation\n      - PhysicsSphericalRepresentation\n      - CylindricalRepresentation\n      - CartesianDifferential\n      - SphericalDifferential\n      - UnitSphericalCosLatDifferential\n      - UnitSphericalDifferential\n      - SphericalCosLatDifferential\n      - RadialDifferential\n      - PhysicsSphericalDifferential\n      - CylindricalDifferential\n\n  components:\n    anyOf:\n      # CartesianRepresentation\n      - type: object\n        properties:\n          x:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          y:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          z:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n\n      # SphericalRepresentation\n      - type: object\n        properties:\n          lat:\n            $ref: \"latitude-1.0.0\"\n          lon:\n            $ref: \"longitude-1.0.0\"\n          distance:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n\n      # UnitSphericalRepresentation\n      - type: object\n        properties:\n          lat:\n            $ref: \"latitude-1.0.0\"\n          lon:\n            $ref: \"longitude-1.0.0\"\n\n      # RadialRepresentation\n      - type: object\n        properties:\n          distance:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n\n      # PhysicsSphericalRepresentation\n      - type: object\n        properties:\n          phi:\n            $ref: \"angle-1.0.0\"\n          theta:\n            $ref: \"angle-1.0.0\"\n          r:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n\n      # CylindricalRepresentation\n      - type: object\n        properties:\n          rho:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          phi:\n            $ref: \"angle-1.0.0\"\n          z:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n\n      # CartesianDifferential\n      - type: object\n        properties:\n          d_x:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          d_y:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          d_z:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n\n      # SphericalDifferential\n      - type: object\n        properties:\n          d_lon:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          d_lat:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          d_distance:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n\n      # UnitSphericalCosLatDifferential\n      - type: object\n        properties:\n          d_lon_coslat:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          d_lat:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n\n      # UnitSphericalDifferential\n      - type: object\n        properties:\n          d_lon:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          d_lat:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n\n      # SphericalCosLatDifferential\n      - type: object\n        properties:\n          d_lon_coslat:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          d_lat:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          d_distance:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n\n      # SphericalDifferential\n      - type: object\n        properties:\n          d_lon:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          d_lat:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          d_distance:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n\n      # RadialDifferential\n      - type: object\n        properties:\n          d_phi:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          d_theta:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          d_r:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n\n      # PhysicsSphericalDifferential\n      - type: object\n        properties:\n          d_phi:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          d_theta:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          d_r:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n\n      # RadialDifferential\n      - type: object\n        properties:\n          d_distance:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n\n      # CylindricalDifferential\n      - type: object\n        properties:\n          d_rho:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          d_phi:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          d_z:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n\nrequired: [type, components]\n...\n"},{"attributeType":"null","col":35,"comment":"null","endLoc":7,"id":3230,"name":"io_registry","nodeType":"Attribute","startLoc":7,"text":"io_registry"},{"col":0,"comment":"","endLoc":5,"header":"connect.py#<anonymous>","id":3231,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"io_registry.register_reader('asdf', Table, read_table)\n\nio_registry.register_writer('asdf', Table, write_table)\n\nio_registry.register_identifier('asdf', Table, asdf_identify)"},{"col":4,"comment":"null","endLoc":2184,"header":"def __sub__(self, other)","id":3232,"name":"__sub__","nodeType":"Function","startLoc":2128,"text":"def __sub__(self, other):\n        # T      - Tdelta = T\n        # T      - T      = Tdelta\n        other_is_delta = not isinstance(other, Time)\n        if other_is_delta:  # T - Tdelta\n            # Check other is really a TimeDelta or something that can initialize.\n            if not isinstance(other, TimeDelta):\n                try:\n                    other = TimeDelta(other)\n                except Exception:\n                    return NotImplemented\n\n            # we need a constant scale to calculate, which is guaranteed for\n            # TimeDelta, but not for Time (which can be UTC)\n            out = self.replicate()\n            if self.scale in other.SCALES:\n                if other.scale not in (out.scale, None):\n                    other = getattr(other, out.scale)\n            else:\n                if other.scale is None:\n                    out._set_scale('tai')\n                else:\n                    if self.scale not in TIME_TYPES[other.scale]:\n                        raise TypeError(\"Cannot subtract Time and TimeDelta instances \"\n                                        \"with scales '{}' and '{}'\"\n                                        .format(self.scale, other.scale))\n                    out._set_scale(other.scale)\n            # remove attributes that are invalidated by changing time\n            for attr in ('_delta_ut1_utc', '_delta_tdb_tt'):\n                if hasattr(out, attr):\n                    delattr(out, attr)\n\n        else:  # T - T\n            # the scales should be compatible (e.g., cannot convert TDB to LOCAL)\n            if other.scale not in self.SCALES:\n                raise TypeError(\"Cannot subtract Time instances \"\n                                \"with scales '{}' and '{}'\"\n                                .format(self.scale, other.scale))\n            self_time = (self._time if self.scale in TIME_DELTA_SCALES\n                         else self.tai._time)\n            # set up TimeDelta, subtraction to be done shortly\n            out = TimeDelta(self_time.jd1, self_time.jd2, format='jd',\n                            scale=self_time.scale)\n\n            if other.scale != out.scale:\n                other = getattr(other, out.scale)\n\n        jd1 = out._time.jd1 - other._time.jd1\n        jd2 = out._time.jd2 - other._time.jd2\n\n        out._time.jd1, out._time.jd2 = day_frac(jd1, jd2)\n\n        if other_is_delta:\n            # Go back to left-side scale if needed\n            out._set_scale(self.scale)\n\n        return out"},{"id":3233,"name":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/frames","nodeType":"Package"},{"id":3234,"name":"fk4noeterms-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/frames","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/frames/fk4noeterms-1.0.0\"\ntag: \"tag:astropy.org:astropy/coordinates/frames/fk4noeterms-1.0.0\"\n\ntitle: |\n  Represents a FK4NoETerms coordinate object from astropy\n\nexamples:\n  -\n    - A FK4NoETerms frame without data\n    - |\n        !<tag:astropy.org:astropy/coordinates/frames/fk4noeterms-1.0.0>\n          frame_attributes:\n            equinox: !time/time-1.1.0 {scale: tai, value: B1950.000}\n            obstime: !time/time-1.1.0 {scale: tai, value: B1950.000}\n  -\n    - A FK4NoETerms frame with data\n    - |\n        !<tag:astropy.org:astropy/coordinates/frames/fk4noeterms-1.0.0>\n          data: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n            components:\n              lat: !<tag:astropy.org:astropy/coordinates/latitude-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                value: 10.0}\n              lon: !<tag:astropy.org:astropy/coordinates/longitude-1.0.0>\n                unit: !unit/unit-1.0.0 deg\n                value: 120.0\n                wrap_angle: !<tag:astropy.org:astropy/coordinates/angle-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                  value: 360.0}\n            type: UnitSphericalRepresentation\n          frame_attributes:\n            equinox: !time/time-1.1.0 {scale: tai, value: B1950.000}\n            obstime: !time/time-1.1.0 {scale: tai, value: B1950.000}\n\nallOf:\n  - $ref: baseframe-1.0.0\n  - properties:\n      frame_attributes:\n        type: object\n        properties:\n          equinox:\n            $ref: \"tag:stsci.edu:asdf/time/time-1.1.0\"\n          obstime:\n            $ref: \"tag:stsci.edu:asdf/time/time-1.1.0\"\n        required: [equinox]\n...\n"},{"id":3235,"name":"fk4-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/frames","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/frames/fk4-1.0.0\"\ntag: \"tag:astropy.org:astropy/coordinates/frames/fk4-1.0.0\"\n\ntitle: |\n  Represents a FK4 coordinate object from astropy\n\nexamples:\n  -\n    - A FK4 frame without data\n    - |\n        !<tag:astropy.org:astropy/coordinates/frames/fk4-1.0.0>\n          frame_attributes:\n            equinox: !time/time-1.1.0 {scale: tai, value: B1950.000}\n            obstime: !time/time-1.1.0 {scale: tai, value: B1950.000}\n  -\n    - A FK4 frame with data\n    - |\n        !<tag:astropy.org:astropy/coordinates/frames/fk4-1.0.0>\n          data: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n            components:\n              lat: !<tag:astropy.org:astropy/coordinates/latitude-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                value: 10.0}\n              lon: !<tag:astropy.org:astropy/coordinates/longitude-1.0.0>\n                unit: !unit/unit-1.0.0 deg\n                value: 120.0\n                wrap_angle: !<tag:astropy.org:astropy/coordinates/angle-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                  value: 360.0}\n            type: UnitSphericalRepresentation\n          frame_attributes:\n            equinox: !time/time-1.1.0 {scale: tai, value: B1950.000}\n            obstime: !time/time-1.1.0 {scale: tai, value: B1950.000}\n\nallOf:\n  - $ref: baseframe-1.0.0\n  - properties:\n      frame_attributes:\n        type: object\n        properties:\n          equinox:\n            $ref: \"tag:stsci.edu:asdf/time/time-1.1.0\"\n          obstime:\n            $ref: \"tag:stsci.edu:asdf/time/time-1.1.0\"\n        required: [equinox]\n...\n"},{"id":3236,"name":"baseframe-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/frames","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/frames/baseframe-1.0.0\"\n\ntitle: |\n  Represents a coordinate frame object from astropy\n\ndescription: |\n  This schema is designed to be extended by other schemas to restrict the\n  allowable frame_attributes.\n\ntype: object\nproperties:\n  data:\n    description: |\n      The representation object holding any data associated with the frame.\n    $ref: \"../representation-1.0.0\"\n  frame_attributes:\n    description: |\n      Attributes on the coordinate frame.\n    type: object\n\n\nadditionalProperties: false\nrequired: [frame_attributes]\n...\n"},{"id":3237,"name":"spectralcoord-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/spectralcoord-1.0.0\"\ntag: \"tag:astropy.org:astropy/coordinates/spectralcoord-1.0.0\"\n\ntitle: >\n  Represents a SpectralCoord object from astropy\n\ntype: object\nproperties:\n  value:\n    description: |\n      A vector of one or more values\n    anyOf:\n      - type: number\n      - $ref: \"http://stsci.edu/schemas/asdf/core/ndarray-1.0.0\"\n  unit:\n    description: |\n      The unit corresponding to the values\n    $ref: \"http://stsci.edu/schemas/asdf/unit/unit-1.0.0\"\n  observer:\n    description: |\n      The observer frame for this coordinate\n    $ref: \"http://astropy.org/schemas/astropy/coordinates/frames/baseframe-1.0.0\"\n  target:\n    description: |\n      The target frame for this coordinate\n    $ref: \"http://astropy.org/schemas/astropy/coordinates/frames/baseframe-1.0.0\"\nrequired: [value, unit]\n...\n"},{"id":3238,"name":"galactocentric-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/frames","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/frames/galactocentric-1.0.0\"\ntag: \"tag:astropy.org:astropy/coordinates/frames/galactocentric-1.0.0\"\n\ntitle: |\n  Represents an galactocentric coordinate object from astropy\n\nexamples:\n  -\n    - A Galactocentric frame without data\n    - |\n        !<tag:astropy.org:astropy/coordinates/frames/galactocentric-1.0.0>\n          frame_attributes:\n            galcen_coord: !<tag:astropy.org:astropy/coordinates/frames/icrs-1.1.0>\n              data: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n                components:\n                  lat: !<tag:astropy.org:astropy/coordinates/latitude-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                    value: -28.936175}\n                  lon: !<tag:astropy.org:astropy/coordinates/longitude-1.0.0>\n                    unit: !unit/unit-1.0.0 deg\n                    value: 266.4051\n                    wrap_angle: !<tag:astropy.org:astropy/coordinates/angle-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                      value: 360.0}\n                type: UnitSphericalRepresentation\n              frame_attributes: {}\n            galcen_distance: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 kpc, value: 8.3}\n            galcen_v_sun: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n              components:\n                d_x: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 km s-1, value: 11.1}\n                d_y: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 km s-1, value: 232.24}\n                d_z: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 km s-1, value: 7.25}\n              type: CartesianDifferential\n            roll: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 deg, value: 0.0}\n            z_sun: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 pc, value: 27.0}\n\nallOf:\n  - $ref: baseframe-1.0.0\n  - properties:\n      frame_attributes:\n        type: object\n        properties:\n          galacen_coord:\n            $ref: \"icrs-1.1.0\"\n          galcen_distance:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          galcen_v_sun:\n            $ref: \"../representation-1.0.0\"\n          z_sun:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n          roll:\n            $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n\n        required: [galcen_coord, galcen_distance, galcen_v_sun, z_sun, roll]\n...\n"},{"id":3239,"name":"itrs-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/frames","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/frames/itrs-1.0.0\"\ntag: \"tag:astropy.org:astropy/coordinates/frames/itrs-1.0.0\"\n\ntitle: |\n  Represents a ITRS coordinate object from astropy\n\nexamples:\n  -\n    - A ITRS frame without data\n    - |\n        !<tag:astropy.org:astropy/coordinates/frames/itrs-1.0.0>\n          frame_attributes:\n            obstime: !time/time-1.1.0 {scale: tai, value: B1950.000}\n  -\n    - A ITRS frame with data\n    - |\n        !<tag:astropy.org:astropy/coordinates/frames/itrs-1.0.0>\n          data: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n            components:\n              lat: !<tag:astropy.org:astropy/coordinates/latitude-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                value: 10.0}\n              lon: !<tag:astropy.org:astropy/coordinates/longitude-1.0.0>\n                unit: !unit/unit-1.0.0 deg\n                value: 120.0\n                wrap_angle: !<tag:astropy.org:astropy/coordinates/angle-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                  value: 360.0}\n            type: UnitSphericalRepresentation\n          frame_attributes:\n            obstime: !time/time-1.1.0 {scale: tai, value: B1950.000}\n\nallOf:\n  - $ref: baseframe-1.0.0\n  - properties:\n      frame_attributes:\n        type: object\n        properties:\n          obstime:\n            $ref: \"tag:stsci.edu:asdf/time/time-1.1.0\"\n        required: [obstime]\n...\n"},{"id":3240,"name":"gcrs-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/frames","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/frames/gcrs-1.0.0\"\ntag: \"tag:astropy.org:astropy/coordinates/frames/gcrs-1.0.0\"\n\ntitle: |\n  Represents a GCRS coordinate object from astropy\n\nexamples:\n  -\n    - A GCRS frame without data\n    - |\n        !<tag:astropy.org:astropy/coordinates/frames/gcrs-1.0.0>\n            frame_attributes:\n              obsgeoloc: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n                components:\n                  x: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m, value: 0.0}\n                  y: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m, value: 0.0}\n                  z: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m, value: 0.0}\n                type: CartesianRepresentation\n              obsgeovel: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n                components:\n                  x: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m s-1, value: 0.0}\n                  y: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m s-1, value: 0.0}\n                  z: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m s-1, value: 0.0}\n                type: CartesianRepresentation\n              obstime: !time/time-1.1.0 J2000.000\n  -\n    - A GCRS frame with data\n    - |\n        !<tag:astropy.org:astropy/coordinates/frames/gcrs-1.0.0>\n          data: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n            components:\n              lat: !<tag:astropy.org:astropy/coordinates/latitude-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                value: 2.0}\n              lon: !<tag:astropy.org:astropy/coordinates/longitude-1.0.0>\n                unit: !unit/unit-1.0.0 deg\n                value: 1.0\n                wrap_angle: !<tag:astropy.org:astropy/coordinates/angle-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                  value: 360.0}\n            type: UnitSphericalRepresentation\n          frame_attributes:\n            obsgeoloc: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n              components:\n                x: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m, value: 0.0}\n                y: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m, value: 0.0}\n                z: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m, value: 0.0}\n              type: CartesianRepresentation\n            obsgeovel: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n              components:\n                x: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m s-1, value: 0.0}\n                y: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m s-1, value: 0.0}\n                z: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m s-1, value: 0.0}\n              type: CartesianRepresentation\n            obstime: !time/time-1.1.0 J2000.000\n\nallOf:\n  - $ref: baseframe-1.0.0\n  - properties:\n      frame_attributes:\n        type: object\n        properties:\n          obstime:\n            $ref: \"tag:stsci.edu:asdf/time/time-1.1.0\"\n          obsgeoloc:\n            $ref: \"../representation-1.0.0\"\n          obsgeovel:\n            $ref: \"../representation-1.0.0\"\n...\n"},{"id":3241,"name":"icrs-1.1.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/frames","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/frames/icrs-1.1.0\"\ntag: \"tag:astropy.org:astropy/coordinates/frames/icrs-1.1.0\"\n\ntitle: |\n  Represents an ICRS coordinate object from astropy.\n\nexamples:\n  -\n    - An ICRS frame without data\n    - |\n        !<tag:astropy.org:astropy/coordinates/frames/icrs-1.1.0>\n          frame_attributes: {}\n  -\n    - An ICRS frame with data\n    - |\n        !<tag:astropy.org:astropy/coordinates/frames/icrs-1.1.0>\n          data: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n            components:\n              lat: !<tag:astropy.org:astropy/coordinates/latitude-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                value: 10.0}\n              lon: !<tag:astropy.org:astropy/coordinates/longitude-1.0.0>\n                unit: !unit/unit-1.0.0 deg\n                value: 120.0\n                wrap_angle: !<tag:astropy.org:astropy/coordinates/angle-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                  value: 360.0}\n            type: UnitSphericalRepresentation\n          frame_attributes: {}\n\n\n\nallOf:\n  - $ref: baseframe-1.0.0\n...\n"},{"id":3242,"name":"precessedgeocentric-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/frames","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/frames/precessedgeocentric-1.0.0\"\ntag: \"tag:astropy.org:astropy/coordinates/frames/precessedgeocentric-1.0.0\"\n\ntitle: |\n  Represents a PrecessedGeocentric coordinate object from astropy\n\nexamples:\n  -\n    - A PrecessedGeocentric frame without data\n    - |\n        !<tag:astropy.org:astropy/coordinates/frames/precessedgeocentric-1.0.0>\n          frame_attributes:\n            equinox: !time/time-1.1.0 J2000.000\n            obsgeoloc: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n              components:\n                x: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m, value: 0.0}\n                y: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m, value: 0.0}\n                z: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m, value: 0.0}\n              type: CartesianRepresentation\n            obsgeovel: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n              components:\n                x: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m s-1, value: 0.0}\n                y: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m s-1, value: 0.0}\n                z: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m s-1, value: 0.0}\n              type: CartesianRepresentation\n            obstime: !time/time-1.1.0 J2000.000\n  -\n    - A PrecessedGeocentric frame with data\n    - |\n        !<tag:astropy.org:astropy/coordinates/frames/precessedgeocentric-1.0.0>\n            data: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n              components:\n                lat: !<tag:astropy.org:astropy/coordinates/latitude-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                  value: 1.0}\n                lon: !<tag:astropy.org:astropy/coordinates/longitude-1.0.0>\n                  unit: !unit/unit-1.0.0 deg\n                  value: 1.0\n                  wrap_angle: !<tag:astropy.org:astropy/coordinates/angle-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                    value: 360.0}\n              type: UnitSphericalRepresentation\n            frame_attributes:\n              equinox: !time/time-1.1.0 J2000.000\n              obsgeoloc: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n                components:\n                  x: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m, value: 0.0}\n                  y: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m, value: 0.0}\n                  z: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m, value: 0.0}\n                type: CartesianRepresentation\n              obsgeovel: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n                components:\n                  x: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m s-1, value: 0.0}\n                  y: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m s-1, value: 0.0}\n                  z: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 m s-1, value: 0.0}\n                type: CartesianRepresentation\n              obstime: !time/time-1.1.0 J2000.000\n\nallOf:\n  - $ref: baseframe-1.0.0\n  - properties:\n      frame_attributes:\n        type: object\n        properties:\n          equinox:\n            $ref: \"tag:stsci.edu:asdf/time/time-1.1.0\"\n          obstime:\n            $ref: \"tag:stsci.edu:asdf/time/time-1.1.0\"\n          obsgeoloc:\n            $ref: \"../representation-1.0.0\"\n          obsgeovel:\n            $ref: \"../representation-1.0.0\"\n...\n"},{"id":3243,"name":"icrs-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/frames","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/frames/icrs-1.0.0\"\ntag: \"tag:astropy.org:astropy/coordinates/frames/icrs-1.0.0\"\n\ntitle: |\n  Represents an ICRS coordinate object from astropy\n\ndescription: |\n  This object represents the right ascension (RA) and declination of an ICRS\n  coordinate or frame. The ICRS class contains additional fields that may be\n  useful to add here in the future.\n\ntype: object\nproperties:\n  ra:\n    type: object\n    description: |\n      A longitude representing the right ascension of the ICRS coordinate\n    properties:\n      value:\n        type: number\n      unit:\n        $ref: \"tag:stsci.edu:asdf/unit/unit-1.0.0\"\n        default: deg\n      wrap_angle:\n        $ref: \"tag:stsci.edu:asdf/unit/quantity-1.1.0\"\n        default: \"360 deg\"\n  dec:\n    type: object\n    description: |\n      A latitude representing the declination of the ICRS coordinate\n    properties:\n      value:\n        type: number\n      unit:\n        $ref: \"tag:stsci.edu:asdf/unit/unit-1.0.0\"\n        default: deg\n\nrequired: [ra, dec]\n...\n"},{"id":3244,"name":"galactic-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/frames","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/frames/galactic-1.0.0\"\ntag: \"tag:astropy.org:astropy/coordinates/frames/galactic-1.0.0\"\n\ntitle: |\n  Represents an Galactic coordinate object from astropy.\n\nexamples:\n  -\n    - An Galactic frame without data\n    - |\n         !<tag:astropy.org:astropy/coordinates/frames/galactic-1.0.0>\n           frame_attributes: {}\n  -\n    - An Galactic frame with data\n    - |\n         !<tag:astropy.org:astropy/coordinates/frames/galactic-1.0.0>\n           data: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n             components:\n               lat: !<tag:astropy.org:astropy/coordinates/latitude-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                 value: 2.0}\n               lon: !<tag:astropy.org:astropy/coordinates/longitude-1.0.0>\n                 unit: !unit/unit-1.0.0 deg\n                 value: 1.0\n                 wrap_angle: !<tag:astropy.org:astropy/coordinates/angle-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                   value: 360.0}\n             type: UnitSphericalRepresentation\n           frame_attributes: {}\n\n\n\n\nallOf:\n  - $ref: baseframe-1.0.0\n...\n"},{"id":3245,"name":"cirs-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/frames","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/frames/cirs-1.0.0\"\ntag: \"tag:astropy.org:astropy/coordinates/frames/cirs-1.0.0\"\n\ntitle: |\n  Represents a CIRS coordinate object from astropy\n\nexamples:\n  -\n    - A CIRS frame without data\n    - |\n        !<tag:astropy.org:astropy/coordinates/frames/cirs-1.0.0>\n          frame_attributes:\n            obstime: !time/time-1.1.0 {scale: tai, value: B1950.000}\n  -\n    - A CIRS frame with data\n    - |\n        !<tag:astropy.org:astropy/coordinates/frames/cirs-1.0.0>\n          data: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n            components:\n              lat: !<tag:astropy.org:astropy/coordinates/latitude-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                value: 10.0}\n              lon: !<tag:astropy.org:astropy/coordinates/longitude-1.0.0>\n                unit: !unit/unit-1.0.0 deg\n                value: 120.0\n                wrap_angle: !<tag:astropy.org:astropy/coordinates/angle-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                  value: 360.0}\n            type: UnitSphericalRepresentation\n          frame_attributes:\n            obstime: !time/time-1.1.0 {scale: tai, value: B1950.000}\n\nallOf:\n  - $ref: baseframe-1.0.0\n  - properties:\n      frame_attributes:\n        type: object\n        properties:\n          obstime:\n            $ref: \"tag:stsci.edu:asdf/time/time-1.1.0\"\n        required: [obstime]\n...\n"},{"id":3246,"name":"fk5-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/data/schemas/astropy.org/astropy/coordinates/frames","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coordinates/frames/fk5-1.0.0\"\ntag: \"tag:astropy.org:astropy/coordinates/frames/fk5-1.0.0\"\n\ntitle: |\n  Represents a FK5 coordinate object from astropy\n\nexamples:\n  -\n    - A FK5 frame without data with a custom equinox\n    - |\n        !<tag:astropy.org:astropy/coordinates/frames/fk5-1.0.0>\n          frame_attributes: {equinox: !time/time-1.1.0 '2011-01-02 00:00:00.000'}\n  -\n    - A FK5 frame with data\n    - |\n        !<tag:astropy.org:astropy/coordinates/frames/fk5-1.0.0>\n          data: !<tag:astropy.org:astropy/coordinates/representation-1.0.0>\n            components:\n              lat: !<tag:astropy.org:astropy/coordinates/latitude-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                value: 10.0}\n              lon: !<tag:astropy.org:astropy/coordinates/longitude-1.0.0>\n                unit: !unit/unit-1.0.0 deg\n                value: 120.0\n                wrap_angle: !<tag:astropy.org:astropy/coordinates/angle-1.0.0> {unit: !unit/unit-1.0.0 deg,\n                  value: 360.0}\n            type: UnitSphericalRepresentation\n          frame_attributes: {equinox: !time/time-1.1.0 J2000.000}\n\nallOf:\n  - $ref: baseframe-1.0.0\n  - properties:\n      frame_attributes:\n        type: object\n        properties:\n          equinox:\n            $ref: \"tag:stsci.edu:asdf/time/time-1.1.0\"\n        required: [equinox]\n...\n"},{"id":3247,"name":"astropy/io/misc/asdf/tags","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags","id":3248,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n"},{"col":4,"comment":"null","endLoc":2228,"header":"def __add__(self, other)","id":3249,"name":"__add__","nodeType":"Function","startLoc":2186,"text":"def __add__(self, other):\n        # T      + Tdelta = T\n        # T      + T      = error\n        if isinstance(other, Time):\n            raise OperandTypeError(self, other, '+')\n\n        # Check other is really a TimeDelta or something that can initialize.\n        if not isinstance(other, TimeDelta):\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                return NotImplemented\n\n        # ideally, we calculate in the scale of the Time item, since that is\n        # what we want the output in, but this may not be possible, since\n        # TimeDelta cannot be converted arbitrarily\n        out = self.replicate()\n        if self.scale in other.SCALES:\n            if other.scale not in (out.scale, None):\n                other = getattr(other, out.scale)\n        else:\n            if other.scale is None:\n                out._set_scale('tai')\n            else:\n                if self.scale not in TIME_TYPES[other.scale]:\n                    raise TypeError(\"Cannot add Time and TimeDelta instances \"\n                                    \"with scales '{}' and '{}'\"\n                                    .format(self.scale, other.scale))\n                out._set_scale(other.scale)\n        # remove attributes that are invalidated by changing time\n        for attr in ('_delta_ut1_utc', '_delta_tdb_tt'):\n            if hasattr(out, attr):\n                delattr(out, attr)\n\n        jd1 = out._time.jd1 + other._time.jd1\n        jd2 = out._time.jd2 + other._time.jd2\n\n        out._time.jd1, out._time.jd2 = day_frac(jd1, jd2)\n\n        # Go back to left-side scale if needed\n        out._set_scale(self.scale)\n\n        return out"},{"fileName":"helpers.py","filePath":"astropy/io/misc/asdf/tags","id":3250,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nimport numpy as np\n\n\n__all__ = []\n\n\ndef skycoord_equal(sc1, sc2):\n    \"\"\"SkyCoord equality useful for testing and ASDF serialization\n    \"\"\"\n    if not sc1.is_equivalent_frame(sc2):\n        return False\n    if sc1.representation_type is not sc2.representation_type:\n        return False\n    if sc1.shape != sc2.shape:\n        return False  # Maybe raise ValueError corresponding to future numpy behavior\n    eq = np.ones(shape=sc1.shape, dtype=bool)\n    for comp in sc1.data.components:\n        eq &= getattr(sc1.data, comp) == getattr(sc2.data, comp)\n    return np.all(eq)\n"},{"col":0,"comment":"SkyCoord equality useful for testing and ASDF serialization\n    ","endLoc":22,"header":"def skycoord_equal(sc1, sc2)","id":3251,"name":"skycoord_equal","nodeType":"Function","startLoc":10,"text":"def skycoord_equal(sc1, sc2):\n    \"\"\"SkyCoord equality useful for testing and ASDF serialization\n    \"\"\"\n    if not sc1.is_equivalent_frame(sc2):\n        return False\n    if sc1.representation_type is not sc2.representation_type:\n        return False\n    if sc1.shape != sc2.shape:\n        return False  # Maybe raise ValueError corresponding to future numpy behavior\n    eq = np.ones(shape=sc1.shape, dtype=bool)\n    for comp in sc1.data.components:\n        eq &= getattr(sc1.data, comp) == getattr(sc2.data, comp)\n    return np.all(eq)"},{"id":3252,"name":"astropy/io/misc/asdf/tags/fits","nodeType":"Package"},{"fileName":"fits.py","filePath":"astropy/io/misc/asdf/tags/fits","id":3253,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nimport numpy as np\nfrom numpy.testing import assert_array_equal\n\nfrom astropy import table\nfrom astropy.io import fits\nfrom astropy.io.misc.asdf.types import AstropyType, AstropyAsdfType\n\n\nclass FitsType:\n    name = 'fits/fits'\n    types = ['astropy.io.fits.HDUList']\n    requires = ['astropy']\n\n    @classmethod\n    def from_tree(cls, data, ctx):\n        hdus = []\n        first = True\n        for hdu_entry in data:\n            header = fits.Header([fits.Card(*x) for x in hdu_entry['header']])\n            data = hdu_entry.get('data')\n            if data is not None:\n                try:\n                    data = data.__array__()\n                except ValueError:\n                    data = None\n            if first:\n                hdu = fits.PrimaryHDU(data=data, header=header)\n                first = False\n            elif data.dtype.names is not None:\n                hdu = fits.BinTableHDU(data=data, header=header)\n            else:\n                hdu = fits.ImageHDU(data=data, header=header)\n            hdus.append(hdu)\n        hdulist = fits.HDUList(hdus)\n        return hdulist\n\n    @classmethod\n    def to_tree(cls, hdulist, ctx):\n        units = []\n        for hdu in hdulist:\n            header_list = []\n            for card in hdu.header.cards:\n                if card.comment:\n                    new_card = [card.keyword, card.value, card.comment]\n                else:\n                    if card.value:\n                        new_card = [card.keyword, card.value]\n                    else:\n                        if card.keyword:\n                            new_card = [card.keyword]\n                        else:\n                            new_card = []\n                header_list.append(new_card)\n\n            hdu_dict = {}\n            hdu_dict['header'] = header_list\n            if hdu.data is not None:\n                if hdu.data.dtype.names is not None:\n                    data = table.Table(hdu.data)\n                else:\n                    data = hdu.data\n                hdu_dict['data'] = data\n\n            units.append(hdu_dict)\n\n        return units\n\n    @classmethod\n    def reserve_blocks(cls, data, ctx):\n        for hdu in data:\n            if hdu.data is not None:\n                yield ctx.blocks.find_or_create_block_for_array(hdu.data, ctx)\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        for hdua, hdub in zip(old, new):\n            assert_array_equal(hdua.data, hdub.data)\n            for carda, cardb in zip(hdua.header.cards, hdub.header.cards):\n                assert tuple(carda) == tuple(cardb)\n\n\nclass AstropyFitsType(FitsType, AstropyType):\n    \"\"\"\n    This class implements ASDF serialization/deserialization that corresponds\n    to the FITS schema defined by Astropy. It will be used by default when\n    writing new HDUs to ASDF files.\n    \"\"\"\n\n\nclass AsdfFitsType(FitsType, AstropyAsdfType):\n    \"\"\"\n    This class implements ASDF serialization/deserialization that corresponds\n    to the FITS schema defined by the ASDF Standard. It will not be used by\n    default, except when reading files that use the ASDF Standard definition\n    rather than the one defined in Astropy. It will primarily be used for\n    backwards compatibility for reading older files. In the unlikely case that\n    another ASDF implementation uses the FITS schema from the ASDF Standard,\n    this tag could also be used to read a file it generated.\n    \"\"\"\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":32,"id":3254,"name":"url","nodeType":"Attribute","startLoc":32,"text":"url"},{"attributeType":"null","col":4,"comment":"null","endLoc":34,"id":3255,"name":"position","nodeType":"Attribute","startLoc":34,"text":"position"},{"attributeType":"null","col":4,"comment":"null","endLoc":35,"id":3256,"name":"size","nodeType":"Attribute","startLoc":35,"text":"size"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/fits","id":3257,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n"},{"col":0,"comment":"","endLoc":3,"header":"cutout2d_tofits.py#<anonymous>","id":3258,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"if __name__ == '__main__':\n    url = 'https://astropy.stsci.edu/data/photometry/spitzer_example_image.fits'\n\n    position = (500, 300)\n    size = (400, 400)\n    download_image_save_cutout(url, position, size)"},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":3259,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":3260,"name":"__all__","nodeType":"Attribute","startLoc":7,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"helpers.py#<anonymous>","id":3261,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = []"},{"id":3262,"name":"astropy/io/misc/asdf/tags/fits/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/fits/tests","id":3263,"nodeType":"File","text":"import pytest\nfrom astropy.io.misc.asdf.tests import ASDF_ENTRY_INSTALLED\n\nif not ASDF_ENTRY_INSTALLED:\n    pytest.skip('The astropy asdf entry points are not installed',\n                allow_module_level=True)\n"},{"id":3264,"name":"astropy/io/misc/asdf/tags/time","nodeType":"Package"},{"fileName":"timedelta.py","filePath":"astropy/io/misc/asdf/tags/time","id":3265,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\nimport functools\n\nimport numpy as np\n\nfrom astropy.time import TimeDelta\n\nfrom ...types import AstropyType\n\n__all__ = ['TimeDeltaType']\n\nallclose_jd = functools.partial(np.allclose, rtol=2. ** -52, atol=0)\nallclose_jd2 = functools.partial(np.allclose, rtol=2. ** -52,\n                                 atol=2. ** -52)  # 20 ps atol\nallclose_sec = functools.partial(np.allclose, rtol=2. ** -52,\n                                 atol=2. ** -52 * 24 * 3600)  # 20 ps atol\n\n\nclass TimeDeltaType(AstropyType):\n    name = 'time/timedelta'\n    types = [TimeDelta]\n    version = '1.0.0'\n\n    @classmethod\n    def to_tree(cls, obj, ctx):\n        return obj.info._represent_as_dict()\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        return TimeDelta.info._construct_from_dict(node)\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        assert allclose_jd(old.jd, new.jd)\n        assert allclose_jd2(old.jd2, new.jd2)\n        assert allclose_sec(old.sec, new.sec)\n"},{"className":"TimeDeltaType","col":0,"comment":"null","endLoc":37,"id":3266,"nodeType":"Class","startLoc":20,"text":"class TimeDeltaType(AstropyType):\n    name = 'time/timedelta'\n    types = [TimeDelta]\n    version = '1.0.0'\n\n    @classmethod\n    def to_tree(cls, obj, ctx):\n        return obj.info._represent_as_dict()\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        return TimeDelta.info._construct_from_dict(node)\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        assert allclose_jd(old.jd, new.jd)\n        assert allclose_jd2(old.jd2, new.jd2)\n        assert allclose_sec(old.sec, new.sec)"},{"col":4,"comment":"null","endLoc":27,"header":"@classmethod\n    def to_tree(cls, obj, ctx)","id":3267,"name":"to_tree","nodeType":"Function","startLoc":25,"text":"@classmethod\n    def to_tree(cls, obj, ctx):\n        return obj.info._represent_as_dict()"},{"className":"FitsType","col":0,"comment":"null","endLoc":82,"id":3268,"nodeType":"Class","startLoc":12,"text":"class FitsType:\n    name = 'fits/fits'\n    types = ['astropy.io.fits.HDUList']\n    requires = ['astropy']\n\n    @classmethod\n    def from_tree(cls, data, ctx):\n        hdus = []\n        first = True\n        for hdu_entry in data:\n            header = fits.Header([fits.Card(*x) for x in hdu_entry['header']])\n            data = hdu_entry.get('data')\n            if data is not None:\n                try:\n                    data = data.__array__()\n                except ValueError:\n                    data = None\n            if first:\n                hdu = fits.PrimaryHDU(data=data, header=header)\n                first = False\n            elif data.dtype.names is not None:\n                hdu = fits.BinTableHDU(data=data, header=header)\n            else:\n                hdu = fits.ImageHDU(data=data, header=header)\n            hdus.append(hdu)\n        hdulist = fits.HDUList(hdus)\n        return hdulist\n\n    @classmethod\n    def to_tree(cls, hdulist, ctx):\n        units = []\n        for hdu in hdulist:\n            header_list = []\n            for card in hdu.header.cards:\n                if card.comment:\n                    new_card = [card.keyword, card.value, card.comment]\n                else:\n                    if card.value:\n                        new_card = [card.keyword, card.value]\n                    else:\n                        if card.keyword:\n                            new_card = [card.keyword]\n                        else:\n                            new_card = []\n                header_list.append(new_card)\n\n            hdu_dict = {}\n            hdu_dict['header'] = header_list\n            if hdu.data is not None:\n                if hdu.data.dtype.names is not None:\n                    data = table.Table(hdu.data)\n                else:\n                    data = hdu.data\n                hdu_dict['data'] = data\n\n            units.append(hdu_dict)\n\n        return units\n\n    @classmethod\n    def reserve_blocks(cls, data, ctx):\n        for hdu in data:\n            if hdu.data is not None:\n                yield ctx.blocks.find_or_create_block_for_array(hdu.data, ctx)\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        for hdua, hdub in zip(old, new):\n            assert_array_equal(hdua.data, hdub.data)\n            for carda, cardb in zip(hdua.header.cards, hdub.header.cards):\n                assert tuple(carda) == tuple(cardb)"},{"col":4,"comment":"null","endLoc":38,"header":"@classmethod\n    def from_tree(cls, data, ctx)","id":3269,"name":"from_tree","nodeType":"Function","startLoc":17,"text":"@classmethod\n    def from_tree(cls, data, ctx):\n        hdus = []\n        first = True\n        for hdu_entry in data:\n            header = fits.Header([fits.Card(*x) for x in hdu_entry['header']])\n            data = hdu_entry.get('data')\n            if data is not None:\n                try:\n                    data = data.__array__()\n                except ValueError:\n                    data = None\n            if first:\n                hdu = fits.PrimaryHDU(data=data, header=header)\n                first = False\n            elif data.dtype.names is not None:\n                hdu = fits.BinTableHDU(data=data, header=header)\n            else:\n                hdu = fits.ImageHDU(data=data, header=header)\n            hdus.append(hdu)\n        hdulist = fits.HDUList(hdus)\n        return hdulist"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":3270,"name":"ASDF_ENTRY_INSTALLED","nodeType":"Attribute","startLoc":17,"text":"ASDF_ENTRY_INSTALLED"},{"col":0,"comment":"","endLoc":1,"header":"__init__.py#<anonymous>","id":3271,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"if not ASDF_ENTRY_INSTALLED:\n    pytest.skip('The astropy asdf entry points are not installed',\n                allow_module_level=True)"},{"col":4,"comment":"null","endLoc":31,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":3272,"name":"from_tree","nodeType":"Function","startLoc":29,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        return TimeDelta.info._construct_from_dict(node)"},{"col":4,"comment":"null","endLoc":37,"header":"@classmethod\n    def assert_equal(cls, old, new)","id":3273,"name":"assert_equal","nodeType":"Function","startLoc":33,"text":"@classmethod\n    def assert_equal(cls, old, new):\n        assert allclose_jd(old.jd, new.jd)\n        assert allclose_jd2(old.jd2, new.jd2)\n        assert allclose_sec(old.sec, new.sec)"},{"col":4,"comment":"null","endLoc":2233,"header":"def __radd__(self, other)","id":3274,"name":"__radd__","nodeType":"Function","startLoc":2232,"text":"def __radd__(self, other):\n        return self.__add__(other)"},{"attributeType":"null","col":4,"comment":"null","endLoc":21,"id":3275,"name":"name","nodeType":"Attribute","startLoc":21,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":22,"id":3276,"name":"types","nodeType":"Attribute","startLoc":22,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":23,"id":3277,"name":"version","nodeType":"Attribute","startLoc":23,"text":"version"},{"col":4,"comment":"null","endLoc":2239,"header":"def to_datetime(self, timezone=None)","id":3278,"name":"to_datetime","nodeType":"Function","startLoc":2235,"text":"def to_datetime(self, timezone=None):\n        # TODO: this could likely go through to_value, as long as that\n        # had an **kwargs part that was just passed on to _time.\n        tm = self.replicate(format='datetime')\n        return tm._shaped_like_input(tm._time.to_value(timezone))"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":3279,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":3280,"name":"allclose_jd","nodeType":"Attribute","startLoc":13,"text":"allclose_jd"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":3281,"name":"allclose_jd2","nodeType":"Attribute","startLoc":14,"text":"allclose_jd2"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":3282,"name":"allclose_sec","nodeType":"Attribute","startLoc":16,"text":"allclose_sec"},{"col":0,"comment":"","endLoc":3,"header":"timedelta.py#<anonymous>","id":3283,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['TimeDeltaType']\n\nallclose_jd = functools.partial(np.allclose, rtol=2. ** -52, atol=0)\n\nallclose_jd2 = functools.partial(np.allclose, rtol=2. ** -52,\n                                 atol=2. ** -52)  # 20 ps atol\n\nallclose_sec = functools.partial(np.allclose, rtol=2. ** -52,\n                                 atol=2. ** -52 * 24 * 3600)  # 20 ps atol"},{"id":3284,"name":"astropy/io/misc/asdf/tags/time/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/time/tests","id":3285,"nodeType":"File","text":"import pytest\nfrom astropy.io.misc.asdf.tests import ASDF_ENTRY_INSTALLED\n\nif not ASDF_ENTRY_INSTALLED:\n    pytest.skip('The astropy asdf entry points are not installed',\n                allow_module_level=True)\n"},{"attributeType":"null","col":4,"comment":"List of time scales","endLoc":1486,"id":3286,"name":"SCALES","nodeType":"Attribute","startLoc":1486,"text":"SCALES"},{"col":0,"comment":"","endLoc":1,"header":"__init__.py#<anonymous>","id":3287,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"if not ASDF_ENTRY_INSTALLED:\n    pytest.skip('The astropy asdf entry points are not installed',\n                allow_module_level=True)"},{"attributeType":"null","col":4,"comment":"Dict of time formats","endLoc":1489,"id":3288,"name":"FORMATS","nodeType":"Attribute","startLoc":1489,"text":"FORMATS"},{"attributeType":"null","col":4,"comment":"null","endLoc":1607,"id":3289,"name":"info","nodeType":"Attribute","startLoc":1607,"text":"info"},{"fileName":"time.py","filePath":"astropy/io/misc/asdf/tags/time","id":3290,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nimport numpy as np\nfrom numpy.testing import assert_array_equal\n\nfrom asdf.versioning import AsdfSpec\n\nfrom astropy import time\nfrom astropy import units as u\nfrom astropy.units import Quantity\nfrom astropy.coordinates import EarthLocation\nfrom astropy.io.misc.asdf.types import AstropyAsdfType\n\n__all__ = ['TimeType']\n\n_guessable_formats = set(['iso', 'byear', 'jyear', 'yday'])\n\n_astropy_format_to_asdf_format = {\n    'isot': 'iso',\n    'byear_str': 'byear',\n    'jyear_str': 'jyear'\n}\n\n\ndef _assert_earthlocation_equal(a, b):\n    assert_array_equal(a.x, b.x)\n    assert_array_equal(a.y, b.y)\n    assert_array_equal(a.z, b.z)\n    assert_array_equal(a.lat, b.lat)\n    assert_array_equal(a.lon, b.lon)\n\n\nclass TimeType(AstropyAsdfType):\n    name = 'time/time'\n    version = '1.1.0'\n    supported_versions = ['1.0.0', AsdfSpec('>=1.1.0')]\n    types = ['astropy.time.core.Time']\n    requires = ['astropy']\n\n    @classmethod\n    def to_tree(cls, node, ctx):\n        fmt = node.format\n\n        if fmt == 'byear':\n            node = time.Time(node, format='byear_str')\n\n        elif fmt == 'jyear':\n            node = time.Time(node, format='jyear_str')\n\n        elif fmt in ('fits', 'datetime', 'plot_date'):\n            node = time.Time(node, format='isot')\n\n        fmt = node.format\n\n        fmt = _astropy_format_to_asdf_format.get(fmt, fmt)\n\n        guessable_format = fmt in _guessable_formats\n\n        if node.scale == 'utc' and guessable_format and node.isscalar:\n            return node.value\n\n        d = {'value': node.value}\n\n        if not guessable_format:\n            d['format'] = fmt\n\n        if node.scale != 'utc':\n            d['scale'] = node.scale\n\n        if node.location is not None:\n            x, y, z = node.location.x, node.location.y, node.location.z\n            # Preserve backwards compatibility for writing the old schema\n            # This allows WCS to test backwards compatibility with old frames\n            # This code does get tested in CI, but we don't run a coverage test\n            if cls.version == '1.0.0': # pragma: no cover\n                unit = node.location.unit\n                d['location'] = {\n                    'x': x.value,\n                    'y': y.value,\n                    'z': z.value,\n                    'unit': unit\n                }\n            else:\n                d['location'] = {\n                    # It seems like EarthLocations can be represented either in\n                    # terms of Cartesian coordinates or latitude and longitude, so\n                    # we rather arbitrarily choose the former for our representation\n                    'x': x,\n                    'y': y,\n                    'z': z\n                }\n\n        return d\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        if isinstance(node, (str, list, np.ndarray)):\n            t = time.Time(node)\n            fmt = _astropy_format_to_asdf_format.get(t.format, t.format)\n            if fmt not in _guessable_formats:\n                raise ValueError(f\"Invalid time '{node}'\")\n            return t\n\n        value = node['value']\n        fmt = node.get('format')\n        scale = node.get('scale')\n        location = node.get('location')\n        if location is not None:\n            unit = location.get('unit', u.m)\n            # This ensures that we can read the v.1.0.0 schema and convert it\n            # to the new EarthLocation object, which expects Quantity components\n            for comp in ['x', 'y', 'z']:\n                if not isinstance(location[comp], Quantity):\n                    location[comp] = Quantity(location[comp], unit=unit)\n            location = EarthLocation.from_geocentric(\n                location['x'], location['y'], location['z'])\n\n        return time.Time(value, format=fmt, scale=scale, location=location)\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        assert old.format == new.format\n        assert old.scale == new.scale\n        if isinstance(old.location, EarthLocation):\n            assert isinstance(new.location, EarthLocation)\n            _assert_earthlocation_equal(old.location, new.location)\n        else:\n            assert old.location == new.location\n\n        assert_array_equal(old, new)\n"},{"id":3291,"name":"astropy/io/misc/asdf/tags/unit","nodeType":"Package"},{"fileName":"equivalency.py","filePath":"astropy/io/misc/asdf/tags/unit","id":3292,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nfrom astropy.units.equivalencies import Equivalency\nfrom astropy.units import equivalencies\nfrom astropy.units.quantity import Quantity\n\nfrom astropy.io.misc.asdf.types import AstropyType\n\n\nclass EquivalencyType(AstropyType):\n    name = \"units/equivalency\"\n    types = [Equivalency]\n    version = '1.0.0'\n\n    @classmethod\n    def to_tree(cls, equiv, ctx):\n        node = {}\n        if not isinstance(equiv, Equivalency):\n            raise TypeError(f\"'{equiv}' is not a valid Equivalency\")\n\n        eqs = []\n        for e, kwargs in zip(equiv.name, equiv.kwargs):\n            kwarg_names = list(kwargs.keys())\n            kwarg_values = list(kwargs.values())\n            eq = {'name': e, 'kwargs_names': kwarg_names, 'kwargs_values': kwarg_values}\n            eqs.append(eq)\n        return eqs\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        eqs = []\n        for eq in node:\n            equiv = getattr(equivalencies, eq['name'])\n            kwargs = dict(zip(eq['kwargs_names'], eq['kwargs_values']))\n            eqs.append(equiv(**kwargs))\n        return sum(eqs[1:], eqs[0])\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        assert a == b\n"},{"attributeType":"null","col":4,"comment":"UT1 - UTC time scale offset","endLoc":2074,"id":3293,"name":"delta_ut1_utc","nodeType":"Attribute","startLoc":2074,"text":"delta_ut1_utc"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/time","id":3294,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n"},{"className":"Equivalency","col":0,"comment":"\n    A container for a units equivalency.\n\n    Attributes\n    ----------\n    name: `str`\n        The name of the equivalency.\n    kwargs: `dict`\n        Any positional or keyword arguments used to make the equivalency.\n    ","endLoc":60,"id":3295,"nodeType":"Class","startLoc":31,"text":"class Equivalency(UserList):\n    \"\"\"\n    A container for a units equivalency.\n\n    Attributes\n    ----------\n    name: `str`\n        The name of the equivalency.\n    kwargs: `dict`\n        Any positional or keyword arguments used to make the equivalency.\n    \"\"\"\n\n    def __init__(self, equiv_list, name='', kwargs=None):\n        self.data = equiv_list\n        self.name = [name]\n        self.kwargs = [kwargs] if kwargs is not None else [dict()]\n\n    def __add__(self, other):\n        if isinstance(other, Equivalency):\n            new = super().__add__(other)\n            new.name = self.name[:] + other.name\n            new.kwargs = self.kwargs[:] + other.kwargs\n            return new\n        else:\n            return self.data.__add__(other)\n\n    def __eq__(self, other):\n        return (isinstance(other, self.__class__) and\n                self.name == other.name and\n                self.kwargs == other.kwargs)"},{"attributeType":"null","col":4,"comment":"TDB - TT time scale offset","endLoc":2125,"id":3296,"name":"delta_tdb_tt","nodeType":"Attribute","startLoc":2125,"text":"delta_tdb_tt"},{"col":4,"comment":"null","endLoc":55,"header":"def __add__(self, other)","id":3297,"name":"__add__","nodeType":"Function","startLoc":48,"text":"def __add__(self, other):\n        if isinstance(other, Equivalency):\n            new = super().__add__(other)\n            new.name = self.name[:] + other.name\n            new.kwargs = self.kwargs[:] + other.kwargs\n            return new\n        else:\n            return self.data.__add__(other)"},{"fileName":"unit.py","filePath":"astropy/io/misc/asdf/tags/unit","id":3298,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nfrom astropy.units import Unit, UnitBase\nfrom astropy.io.misc.asdf.types import AstropyAsdfType\n\n\nclass UnitType(AstropyAsdfType):\n    name = 'unit/unit'\n    types = ['astropy.units.UnitBase']\n    requires = ['astropy']\n\n    @classmethod\n    def to_tree(cls, node, ctx):\n        if isinstance(node, str):\n            node = Unit(node, format='vounit', parse_strict='warn')\n        if isinstance(node, UnitBase):\n            return node.to_string(format='vounit')\n        raise TypeError(f\"'{node}' is not a valid unit\")\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        return Unit(node, format='vounit', parse_strict='silent')\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":2241,"id":3299,"name":"__doc__","nodeType":"Attribute","startLoc":2241,"text":"to_datetime.__doc__"},{"attributeType":"null","col":12,"comment":"null","endLoc":1533,"id":3300,"name":"SCALES","nodeType":"Attribute","startLoc":1533,"text":"self.SCALES"},{"attributeType":"null","col":12,"comment":"null","endLoc":1499,"id":3301,"name":"self","nodeType":"Attribute","startLoc":1499,"text":"self"},{"col":4,"comment":"null","endLoc":60,"header":"def __eq__(self, other)","id":3302,"name":"__eq__","nodeType":"Function","startLoc":57,"text":"def __eq__(self, other):\n        return (isinstance(other, self.__class__) and\n                self.name == other.name and\n                self.kwargs == other.kwargs)"},{"className":"Unit","col":0,"comment":"\n    The main unit class.\n\n    There are a number of different ways to construct a Unit, but\n    always returns a `UnitBase` instance.  If the arguments refer to\n    an already-existing unit, that existing unit instance is returned,\n    rather than a new one.\n\n    - From a string::\n\n        Unit(s, format=None, parse_strict='silent')\n\n      Construct from a string representing a (possibly compound) unit.\n\n      The optional `format` keyword argument specifies the format the\n      string is in, by default ``\"generic\"``.  For a description of\n      the available formats, see `astropy.units.format`.\n\n      The optional ``parse_strict`` keyword controls what happens when an\n      unrecognized unit string is passed in.  It may be one of the following:\n\n         - ``'raise'``: (default) raise a ValueError exception.\n\n         - ``'warn'``: emit a Warning, and return an\n           `UnrecognizedUnit` instance.\n\n         - ``'silent'``: return an `UnrecognizedUnit` instance.\n\n    - From a number::\n\n        Unit(number)\n\n      Creates a dimensionless unit.\n\n    - From a `UnitBase` instance::\n\n        Unit(unit)\n\n      Returns the given unit unchanged.\n\n    - From no arguments::\n\n        Unit()\n\n      Returns the dimensionless unit.\n\n    - The last form, which creates a new `Unit` is described in detail\n      below.\n\n    See also: https://docs.astropy.org/en/stable/units/\n\n    Parameters\n    ----------\n    st : str or list of str\n        The name of the unit.  If a list, the first element is the\n        canonical (short) name, and the rest of the elements are\n        aliases.\n\n    represents : UnitBase instance\n        The unit that this named unit represents.\n\n    doc : str, optional\n        A docstring describing the unit.\n\n    format : dict, optional\n        A mapping to format-specific representations of this unit.\n        For example, for the ``Ohm`` unit, it might be nice to have it\n        displayed as ``\\Omega`` by the ``latex`` formatter.  In that\n        case, `format` argument should be set to::\n\n            {'latex': r'\\Omega'}\n\n    namespace : dict, optional\n        When provided, inject the unit (and all of its aliases) into\n        the given namespace.\n\n    Raises\n    ------\n    ValueError\n        If any of the given unit names are already in the registry.\n\n    ValueError\n        If any of the given unit names are not valid Python tokens.\n    ","endLoc":2186,"id":3303,"nodeType":"Class","startLoc":2063,"text":"class Unit(NamedUnit, metaclass=_UnitMetaClass):\n    \"\"\"\n    The main unit class.\n\n    There are a number of different ways to construct a Unit, but\n    always returns a `UnitBase` instance.  If the arguments refer to\n    an already-existing unit, that existing unit instance is returned,\n    rather than a new one.\n\n    - From a string::\n\n        Unit(s, format=None, parse_strict='silent')\n\n      Construct from a string representing a (possibly compound) unit.\n\n      The optional `format` keyword argument specifies the format the\n      string is in, by default ``\"generic\"``.  For a description of\n      the available formats, see `astropy.units.format`.\n\n      The optional ``parse_strict`` keyword controls what happens when an\n      unrecognized unit string is passed in.  It may be one of the following:\n\n         - ``'raise'``: (default) raise a ValueError exception.\n\n         - ``'warn'``: emit a Warning, and return an\n           `UnrecognizedUnit` instance.\n\n         - ``'silent'``: return an `UnrecognizedUnit` instance.\n\n    - From a number::\n\n        Unit(number)\n\n      Creates a dimensionless unit.\n\n    - From a `UnitBase` instance::\n\n        Unit(unit)\n\n      Returns the given unit unchanged.\n\n    - From no arguments::\n\n        Unit()\n\n      Returns the dimensionless unit.\n\n    - The last form, which creates a new `Unit` is described in detail\n      below.\n\n    See also: https://docs.astropy.org/en/stable/units/\n\n    Parameters\n    ----------\n    st : str or list of str\n        The name of the unit.  If a list, the first element is the\n        canonical (short) name, and the rest of the elements are\n        aliases.\n\n    represents : UnitBase instance\n        The unit that this named unit represents.\n\n    doc : str, optional\n        A docstring describing the unit.\n\n    format : dict, optional\n        A mapping to format-specific representations of this unit.\n        For example, for the ``Ohm`` unit, it might be nice to have it\n        displayed as ``\\\\Omega`` by the ``latex`` formatter.  In that\n        case, `format` argument should be set to::\n\n            {'latex': r'\\\\Omega'}\n\n    namespace : dict, optional\n        When provided, inject the unit (and all of its aliases) into\n        the given namespace.\n\n    Raises\n    ------\n    ValueError\n        If any of the given unit names are already in the registry.\n\n    ValueError\n        If any of the given unit names are not valid Python tokens.\n    \"\"\"\n\n    def __init__(self, st, represents=None, doc=None,\n                 format=None, namespace=None):\n\n        represents = Unit(represents)\n        self._represents = represents\n\n        NamedUnit.__init__(self, st, namespace=namespace, doc=doc,\n                           format=format)\n\n    @property\n    def represents(self):\n        \"\"\"The unit that this named unit represents.\"\"\"\n        return self._represents\n\n    def decompose(self, bases=set()):\n        return self._represents.decompose(bases=bases)\n\n    def is_unity(self):\n        return self._represents.is_unity()\n\n    def __hash__(self):\n        if self._hash is None:\n            self._hash = hash((self.name, self._represents))\n        return self._hash\n\n    @classmethod\n    def _from_physical_type_id(cls, physical_type_id):\n        # get string bases and powers from the ID tuple\n        bases = [cls(base) for base, _ in physical_type_id]\n        powers = [power for _, power in physical_type_id]\n\n        if len(physical_type_id) == 1 and powers[0] == 1:\n            unit = bases[0]\n        else:\n            unit = CompositeUnit(1, bases, powers,\n                                 _error_check=False)\n\n        return unit"},{"attributeType":"null","col":16,"comment":"null","endLoc":1539,"id":3304,"name":"location","nodeType":"Attribute","startLoc":1539,"text":"self.location"},{"attributeType":"null","col":8,"comment":"null","endLoc":2070,"id":3305,"name":"_delta_ut1_utc","nodeType":"Attribute","startLoc":2070,"text":"self._delta_ut1_utc"},{"attributeType":"null","col":8,"comment":"null","endLoc":44,"id":3306,"name":"data","nodeType":"Attribute","startLoc":44,"text":"self.data"},{"attributeType":"null","col":8,"comment":"null","endLoc":45,"id":3307,"name":"name","nodeType":"Attribute","startLoc":45,"text":"self.name"},{"attributeType":"null","col":8,"comment":"null","endLoc":46,"id":3308,"name":"kwargs","nodeType":"Attribute","startLoc":46,"text":"self.kwargs"},{"className":"TimeType","col":0,"comment":"null","endLoc":131,"id":3309,"nodeType":"Class","startLoc":34,"text":"class TimeType(AstropyAsdfType):\n    name = 'time/time'\n    version = '1.1.0'\n    supported_versions = ['1.0.0', AsdfSpec('>=1.1.0')]\n    types = ['astropy.time.core.Time']\n    requires = ['astropy']\n\n    @classmethod\n    def to_tree(cls, node, ctx):\n        fmt = node.format\n\n        if fmt == 'byear':\n            node = time.Time(node, format='byear_str')\n\n        elif fmt == 'jyear':\n            node = time.Time(node, format='jyear_str')\n\n        elif fmt in ('fits', 'datetime', 'plot_date'):\n            node = time.Time(node, format='isot')\n\n        fmt = node.format\n\n        fmt = _astropy_format_to_asdf_format.get(fmt, fmt)\n\n        guessable_format = fmt in _guessable_formats\n\n        if node.scale == 'utc' and guessable_format and node.isscalar:\n            return node.value\n\n        d = {'value': node.value}\n\n        if not guessable_format:\n            d['format'] = fmt\n\n        if node.scale != 'utc':\n            d['scale'] = node.scale\n\n        if node.location is not None:\n            x, y, z = node.location.x, node.location.y, node.location.z\n            # Preserve backwards compatibility for writing the old schema\n            # This allows WCS to test backwards compatibility with old frames\n            # This code does get tested in CI, but we don't run a coverage test\n            if cls.version == '1.0.0': # pragma: no cover\n                unit = node.location.unit\n                d['location'] = {\n                    'x': x.value,\n                    'y': y.value,\n                    'z': z.value,\n                    'unit': unit\n                }\n            else:\n                d['location'] = {\n                    # It seems like EarthLocations can be represented either in\n                    # terms of Cartesian coordinates or latitude and longitude, so\n                    # we rather arbitrarily choose the former for our representation\n                    'x': x,\n                    'y': y,\n                    'z': z\n                }\n\n        return d\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        if isinstance(node, (str, list, np.ndarray)):\n            t = time.Time(node)\n            fmt = _astropy_format_to_asdf_format.get(t.format, t.format)\n            if fmt not in _guessable_formats:\n                raise ValueError(f\"Invalid time '{node}'\")\n            return t\n\n        value = node['value']\n        fmt = node.get('format')\n        scale = node.get('scale')\n        location = node.get('location')\n        if location is not None:\n            unit = location.get('unit', u.m)\n            # This ensures that we can read the v.1.0.0 schema and convert it\n            # to the new EarthLocation object, which expects Quantity components\n            for comp in ['x', 'y', 'z']:\n                if not isinstance(location[comp], Quantity):\n                    location[comp] = Quantity(location[comp], unit=unit)\n            location = EarthLocation.from_geocentric(\n                location['x'], location['y'], location['z'])\n\n        return time.Time(value, format=fmt, scale=scale, location=location)\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        assert old.format == new.format\n        assert old.scale == new.scale\n        if isinstance(old.location, EarthLocation):\n            assert isinstance(new.location, EarthLocation)\n            _assert_earthlocation_equal(old.location, new.location)\n        else:\n            assert old.location == new.location\n\n        assert_array_equal(old, new)"},{"className":"EquivalencyType","col":0,"comment":"null","endLoc":41,"id":3310,"nodeType":"Class","startLoc":11,"text":"class EquivalencyType(AstropyType):\n    name = \"units/equivalency\"\n    types = [Equivalency]\n    version = '1.0.0'\n\n    @classmethod\n    def to_tree(cls, equiv, ctx):\n        node = {}\n        if not isinstance(equiv, Equivalency):\n            raise TypeError(f\"'{equiv}' is not a valid Equivalency\")\n\n        eqs = []\n        for e, kwargs in zip(equiv.name, equiv.kwargs):\n            kwarg_names = list(kwargs.keys())\n            kwarg_values = list(kwargs.values())\n            eq = {'name': e, 'kwargs_names': kwarg_names, 'kwargs_values': kwarg_values}\n            eqs.append(eq)\n        return eqs\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        eqs = []\n        for eq in node:\n            equiv = getattr(equivalencies, eq['name'])\n            kwargs = dict(zip(eq['kwargs_names'], eq['kwargs_values']))\n            eqs.append(equiv(**kwargs))\n        return sum(eqs[1:], eqs[0])\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        assert a == b"},{"attributeType":"null","col":16,"comment":"null","endLoc":2103,"id":3311,"name":"_delta_tdb_tt","nodeType":"Attribute","startLoc":2103,"text":"self._delta_tdb_tt"},{"col":4,"comment":"null","endLoc":28,"header":"@classmethod\n    def to_tree(cls, equiv, ctx)","id":3312,"name":"to_tree","nodeType":"Function","startLoc":16,"text":"@classmethod\n    def to_tree(cls, equiv, ctx):\n        node = {}\n        if not isinstance(equiv, Equivalency):\n            raise TypeError(f\"'{equiv}' is not a valid Equivalency\")\n\n        eqs = []\n        for e, kwargs in zip(equiv.name, equiv.kwargs):\n            kwarg_names = list(kwargs.keys())\n            kwarg_values = list(kwargs.values())\n            eq = {'name': e, 'kwargs_names': kwarg_names, 'kwargs_values': kwarg_values}\n            eqs.append(eq)\n        return eqs"},{"col":4,"comment":"null","endLoc":94,"header":"@classmethod\n    def to_tree(cls, node, ctx)","id":3313,"name":"to_tree","nodeType":"Function","startLoc":41,"text":"@classmethod\n    def to_tree(cls, node, ctx):\n        fmt = node.format\n\n        if fmt == 'byear':\n            node = time.Time(node, format='byear_str')\n\n        elif fmt == 'jyear':\n            node = time.Time(node, format='jyear_str')\n\n        elif fmt in ('fits', 'datetime', 'plot_date'):\n            node = time.Time(node, format='isot')\n\n        fmt = node.format\n\n        fmt = _astropy_format_to_asdf_format.get(fmt, fmt)\n\n        guessable_format = fmt in _guessable_formats\n\n        if node.scale == 'utc' and guessable_format and node.isscalar:\n            return node.value\n\n        d = {'value': node.value}\n\n        if not guessable_format:\n            d['format'] = fmt\n\n        if node.scale != 'utc':\n            d['scale'] = node.scale\n\n        if node.location is not None:\n            x, y, z = node.location.x, node.location.y, node.location.z\n            # Preserve backwards compatibility for writing the old schema\n            # This allows WCS to test backwards compatibility with old frames\n            # This code does get tested in CI, but we don't run a coverage test\n            if cls.version == '1.0.0': # pragma: no cover\n                unit = node.location.unit\n                d['location'] = {\n                    'x': x.value,\n                    'y': y.value,\n                    'z': z.value,\n                    'unit': unit\n                }\n            else:\n                d['location'] = {\n                    # It seems like EarthLocations can be represented either in\n                    # terms of Cartesian coordinates or latitude and longitude, so\n                    # we rather arbitrarily choose the former for our representation\n                    'x': x,\n                    'y': y,\n                    'z': z\n                }\n\n        return d"},{"className":"NamedUnit","col":0,"comment":"\n    The base class of units that have a name.\n\n    Parameters\n    ----------\n    st : str, list of str, 2-tuple\n        The name of the unit.  If a list of strings, the first element\n        is the canonical (short) name, and the rest of the elements\n        are aliases.  If a tuple of lists, the first element is a list\n        of short names, and the second element is a list of long\n        names; all but the first short name are considered \"aliases\".\n        Each name *should* be a valid Python identifier to make it\n        easy to access, but this is not required.\n\n    namespace : dict, optional\n        When provided, inject the unit, and all of its aliases, in the\n        given namespace dictionary.  If a unit by the same name is\n        already in the namespace, a ValueError is raised.\n\n    doc : str, optional\n        A docstring describing the unit.\n\n    format : dict, optional\n        A mapping to format-specific representations of this unit.\n        For example, for the ``Ohm`` unit, it might be nice to have it\n        displayed as ``\\Omega`` by the ``latex`` formatter.  In that\n        case, `format` argument should be set to::\n\n            {'latex': r'\\Omega'}\n\n    Raises\n    ------\n    ValueError\n        If any of the given unit names are already in the registry.\n\n    ValueError\n        If any of the given unit names are not valid Python tokens.\n    ","endLoc":1822,"id":3314,"nodeType":"Class","startLoc":1659,"text":"class NamedUnit(UnitBase):\n    \"\"\"\n    The base class of units that have a name.\n\n    Parameters\n    ----------\n    st : str, list of str, 2-tuple\n        The name of the unit.  If a list of strings, the first element\n        is the canonical (short) name, and the rest of the elements\n        are aliases.  If a tuple of lists, the first element is a list\n        of short names, and the second element is a list of long\n        names; all but the first short name are considered \"aliases\".\n        Each name *should* be a valid Python identifier to make it\n        easy to access, but this is not required.\n\n    namespace : dict, optional\n        When provided, inject the unit, and all of its aliases, in the\n        given namespace dictionary.  If a unit by the same name is\n        already in the namespace, a ValueError is raised.\n\n    doc : str, optional\n        A docstring describing the unit.\n\n    format : dict, optional\n        A mapping to format-specific representations of this unit.\n        For example, for the ``Ohm`` unit, it might be nice to have it\n        displayed as ``\\\\Omega`` by the ``latex`` formatter.  In that\n        case, `format` argument should be set to::\n\n            {'latex': r'\\\\Omega'}\n\n    Raises\n    ------\n    ValueError\n        If any of the given unit names are already in the registry.\n\n    ValueError\n        If any of the given unit names are not valid Python tokens.\n    \"\"\"\n\n    def __init__(self, st, doc=None, format=None, namespace=None):\n\n        UnitBase.__init__(self)\n\n        if isinstance(st, (bytes, str)):\n            self._names = [st]\n            self._short_names = [st]\n            self._long_names = []\n        elif isinstance(st, tuple):\n            if not len(st) == 2:\n                raise ValueError(\"st must be string, list or 2-tuple\")\n            self._names = st[0] + [n for n in st[1] if n not in st[0]]\n            if not len(self._names):\n                raise ValueError(\"must provide at least one name\")\n            self._short_names = st[0][:]\n            self._long_names = st[1][:]\n        else:\n            if len(st) == 0:\n                raise ValueError(\n                    \"st list must have at least one entry\")\n            self._names = st[:]\n            self._short_names = [st[0]]\n            self._long_names = st[1:]\n\n        if format is None:\n            format = {}\n        self._format = format\n\n        if doc is None:\n            doc = self._generate_doc()\n        else:\n            doc = textwrap.dedent(doc)\n            doc = textwrap.fill(doc)\n\n        self.__doc__ = doc\n\n        self._inject(namespace)\n\n    def _generate_doc(self):\n        \"\"\"\n        Generate a docstring for the unit if the user didn't supply\n        one.  This is only used from the constructor and may be\n        overridden in subclasses.\n        \"\"\"\n        names = self.names\n        if len(self.names) > 1:\n            return \"{1} ({0})\".format(*names[:2])\n        else:\n            return names[0]\n\n    def get_format_name(self, format):\n        \"\"\"\n        Get a name for this unit that is specific to a particular\n        format.\n\n        Uses the dictionary passed into the `format` kwarg in the\n        constructor.\n\n        Parameters\n        ----------\n        format : str\n            The name of the format\n\n        Returns\n        -------\n        name : str\n            The name of the unit for the given format.\n        \"\"\"\n        return self._format.get(format, self.name)\n\n    @property\n    def names(self):\n        \"\"\"\n        Returns all of the names associated with this unit.\n        \"\"\"\n        return self._names\n\n    @property\n    def name(self):\n        \"\"\"\n        Returns the canonical (short) name associated with this unit.\n        \"\"\"\n        return self._names[0]\n\n    @property\n    def aliases(self):\n        \"\"\"\n        Returns the alias (long) names for this unit.\n        \"\"\"\n        return self._names[1:]\n\n    @property\n    def short_names(self):\n        \"\"\"\n        Returns all of the short names associated with this unit.\n        \"\"\"\n        return self._short_names\n\n    @property\n    def long_names(self):\n        \"\"\"\n        Returns all of the long names associated with this unit.\n        \"\"\"\n        return self._long_names\n\n    def _inject(self, namespace=None):\n        \"\"\"\n        Injects the unit, and all of its aliases, in the given\n        namespace dictionary.\n        \"\"\"\n        if namespace is None:\n            return\n\n        # Loop through all of the names first, to ensure all of them\n        # are new, then add them all as a single \"transaction\" below.\n        for name in self._names:\n            if name in namespace and self != namespace[name]:\n                raise ValueError(\n                    \"Object with name {!r} already exists in \"\n                    \"given namespace ({!r}).\".format(\n                        name, namespace[name]))\n\n        for name in self._names:\n            namespace[name] = self"},{"className":"UnitBase","col":0,"comment":"\n    Abstract base class for units.\n\n    Most of the arithmetic operations on units are defined in this\n    base class.\n\n    Should not be instantiated by users directly.\n    ","endLoc":1656,"id":3315,"nodeType":"Class","startLoc":621,"text":"class UnitBase:\n    \"\"\"\n    Abstract base class for units.\n\n    Most of the arithmetic operations on units are defined in this\n    base class.\n\n    Should not be instantiated by users directly.\n    \"\"\"\n    # Make sure that __rmul__ of units gets called over the __mul__ of Numpy\n    # arrays to avoid element-wise multiplication.\n    __array_priority__ = 1000\n\n    _hash = None\n\n    def __deepcopy__(self, memo):\n        # This may look odd, but the units conversion will be very\n        # broken after deep-copying if we don't guarantee that a given\n        # physical unit corresponds to only one instance\n        return self\n\n    def _repr_latex_(self):\n        \"\"\"\n        Generate latex representation of unit name.  This is used by\n        the IPython notebook to print a unit with a nice layout.\n\n        Returns\n        -------\n        Latex string\n        \"\"\"\n        return unit_format.Latex.to_string(self)\n\n    def __bytes__(self):\n        \"\"\"Return string representation for unit\"\"\"\n        return unit_format.Generic.to_string(self).encode('unicode_escape')\n\n    def __str__(self):\n        \"\"\"Return string representation for unit\"\"\"\n        return unit_format.Generic.to_string(self)\n\n    def __repr__(self):\n        string = unit_format.Generic.to_string(self)\n\n        return f'Unit(\"{string}\")'\n\n    def _get_physical_type_id(self):\n        \"\"\"\n        Returns an identifier that uniquely identifies the physical\n        type of this unit.  It is comprised of the bases and powers of\n        this unit, without the scale.  Since it is hashable, it is\n        useful as a dictionary key.\n        \"\"\"\n        unit = self.decompose()\n        r = zip([x.name for x in unit.bases], unit.powers)\n        # bases and powers are already sorted in a unique way\n        # r.sort()\n        r = tuple(r)\n        return r\n\n    @property\n    def names(self):\n        \"\"\"\n        Returns all of the names associated with this unit.\n        \"\"\"\n        raise AttributeError(\n            \"Can not get names from unnamed units. \"\n            \"Perhaps you meant to_string()?\")\n\n    @property\n    def name(self):\n        \"\"\"\n        Returns the canonical (short) name associated with this unit.\n        \"\"\"\n        raise AttributeError(\n            \"Can not get names from unnamed units. \"\n            \"Perhaps you meant to_string()?\")\n\n    @property\n    def aliases(self):\n        \"\"\"\n        Returns the alias (long) names for this unit.\n        \"\"\"\n        raise AttributeError(\n            \"Can not get aliases from unnamed units. \"\n            \"Perhaps you meant to_string()?\")\n\n    @property\n    def scale(self):\n        \"\"\"\n        Return the scale of the unit.\n        \"\"\"\n        return 1.0\n\n    @property\n    def bases(self):\n        \"\"\"\n        Return the bases of the unit.\n        \"\"\"\n        return [self]\n\n    @property\n    def powers(self):\n        \"\"\"\n        Return the powers of the unit.\n        \"\"\"\n        return [1]\n\n    def to_string(self, format=unit_format.Generic):\n        \"\"\"\n        Output the unit in the given format as a string.\n\n        Parameters\n        ----------\n        format : `astropy.units.format.Base` instance or str\n            The name of a format or a formatter object.  If not\n            provided, defaults to the generic format.\n        \"\"\"\n\n        f = unit_format.get_format(format)\n        return f.to_string(self)\n\n    def __format__(self, format_spec):\n        \"\"\"Try to format units using a formatter.\"\"\"\n        try:\n            return self.to_string(format=format_spec)\n        except ValueError:\n            return format(str(self), format_spec)\n\n    @staticmethod\n    def _normalize_equivalencies(equivalencies):\n        \"\"\"\n        Normalizes equivalencies, ensuring each is a 4-tuple of the form::\n\n        (from_unit, to_unit, forward_func, backward_func)\n\n        Parameters\n        ----------\n        equivalencies : list of equivalency pairs, or None\n\n        Returns\n        -------\n        A normalized list, including possible global defaults set by, e.g.,\n        `set_enabled_equivalencies`, except when `equivalencies`=`None`,\n        in which case the returned list is always empty.\n\n        Raises\n        ------\n        ValueError if an equivalency cannot be interpreted\n        \"\"\"\n        normalized = _normalize_equivalencies(equivalencies)\n        if equivalencies is not None:\n            normalized += get_current_unit_registry().equivalencies\n\n        return normalized\n\n    def __pow__(self, p):\n        p = validate_power(p)\n        return CompositeUnit(1, [self], [p], _error_check=False)\n\n    def __truediv__(self, m):\n        if isinstance(m, (bytes, str)):\n            m = Unit(m)\n\n        if isinstance(m, UnitBase):\n            if m.is_unity():\n                return self\n            return CompositeUnit(1, [self, m], [1, -1], _error_check=False)\n\n        try:\n            # Cannot handle this as Unit, re-try as Quantity\n            from .quantity import Quantity\n            return Quantity(1, self) / m\n        except TypeError:\n            return NotImplemented\n\n    def __rtruediv__(self, m):\n        if isinstance(m, (bytes, str)):\n            return Unit(m) / self\n\n        try:\n            # Cannot handle this as Unit.  Here, m cannot be a Quantity,\n            # so we make it into one, fasttracking when it does not have a\n            # unit, for the common case of <array> / <unit>.\n            from .quantity import Quantity\n            if hasattr(m, 'unit'):\n                result = Quantity(m)\n                result /= self\n                return result\n            else:\n                return Quantity(m, self**(-1))\n        except TypeError:\n            return NotImplemented\n\n    def __mul__(self, m):\n        if isinstance(m, (bytes, str)):\n            m = Unit(m)\n\n        if isinstance(m, UnitBase):\n            if m.is_unity():\n                return self\n            elif self.is_unity():\n                return m\n            return CompositeUnit(1, [self, m], [1, 1], _error_check=False)\n\n        # Cannot handle this as Unit, re-try as Quantity.\n        try:\n            from .quantity import Quantity\n            return Quantity(1, self) * m\n        except TypeError:\n            return NotImplemented\n\n    def __rmul__(self, m):\n        if isinstance(m, (bytes, str)):\n            return Unit(m) * self\n\n        # Cannot handle this as Unit.  Here, m cannot be a Quantity,\n        # so we make it into one, fasttracking when it does not have a unit\n        # for the common case of <array> * <unit>.\n        try:\n            from .quantity import Quantity\n            if hasattr(m, 'unit'):\n                result = Quantity(m)\n                result *= self\n                return result\n            else:\n                return Quantity(m, self)\n        except TypeError:\n            return NotImplemented\n\n    def __rlshift__(self, m):\n        try:\n            from .quantity import Quantity\n            return Quantity(m, self, copy=False, subok=True)\n        except Exception:\n            return NotImplemented\n\n    def __rrshift__(self, m):\n        warnings.warn(\">> is not implemented. Did you mean to convert \"\n                      \"to a Quantity with unit {} using '<<'?\".format(self),\n                      AstropyWarning)\n        return NotImplemented\n\n    def __hash__(self):\n        if self._hash is None:\n            parts = ([str(self.scale)] +\n                     [x.name for x in self.bases] +\n                     [str(x) for x in self.powers])\n            self._hash = hash(tuple(parts))\n        return self._hash\n\n    def __getstate__(self):\n        # If we get pickled, we should *not* store the memoized hash since\n        # hashes of strings vary between sessions.\n        state = self.__dict__.copy()\n        state.pop('_hash', None)\n        return state\n\n    def __eq__(self, other):\n        if self is other:\n            return True\n\n        try:\n            other = Unit(other, parse_strict='silent')\n        except (ValueError, UnitsError, TypeError):\n            return NotImplemented\n\n        # Other is unit-like, but the test below requires it is a UnitBase\n        # instance; if it is not, give up (so that other can try).\n        if not isinstance(other, UnitBase):\n            return NotImplemented\n\n        try:\n            return is_effectively_unity(self._to(other))\n        except UnitsError:\n            return False\n\n    def __ne__(self, other):\n        return not (self == other)\n\n    def __le__(self, other):\n        scale = self._to(Unit(other))\n        return scale <= 1. or is_effectively_unity(scale)\n\n    def __ge__(self, other):\n        scale = self._to(Unit(other))\n        return scale >= 1. or is_effectively_unity(scale)\n\n    def __lt__(self, other):\n        return not (self >= other)\n\n    def __gt__(self, other):\n        return not (self <= other)\n\n    def __neg__(self):\n        return self * -1.\n\n    def is_equivalent(self, other, equivalencies=[]):\n        \"\"\"\n        Returns `True` if this unit is equivalent to ``other``.\n\n        Parameters\n        ----------\n        other : `~astropy.units.Unit`, str, or tuple\n            The unit to convert to. If a tuple of units is specified, this\n            method returns true if the unit matches any of those in the tuple.\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            This list is in addition to possible global defaults set by, e.g.,\n            `set_enabled_equivalencies`.\n            Use `None` to turn off all equivalencies.\n\n        Returns\n        -------\n        bool\n        \"\"\"\n        equivalencies = self._normalize_equivalencies(equivalencies)\n\n        if isinstance(other, tuple):\n            return any(self.is_equivalent(u, equivalencies=equivalencies)\n                       for u in other)\n\n        other = Unit(other, parse_strict='silent')\n\n        return self._is_equivalent(other, equivalencies)\n\n    def _is_equivalent(self, other, equivalencies=[]):\n        \"\"\"Returns `True` if this unit is equivalent to `other`.\n        See `is_equivalent`, except that a proper Unit object should be\n        given (i.e., no string) and that the equivalency list should be\n        normalized using `_normalize_equivalencies`.\n        \"\"\"\n        if isinstance(other, UnrecognizedUnit):\n            return False\n\n        if (self._get_physical_type_id() ==\n                other._get_physical_type_id()):\n            return True\n        elif len(equivalencies):\n            unit = self.decompose()\n            other = other.decompose()\n            for a, b, forward, backward in equivalencies:\n                if b is None:\n                    # after canceling, is what's left convertible\n                    # to dimensionless (according to the equivalency)?\n                    try:\n                        (other/unit).decompose([a])\n                        return True\n                    except Exception:\n                        pass\n                else:\n                    if(a._is_equivalent(unit) and b._is_equivalent(other) or\n                       b._is_equivalent(unit) and a._is_equivalent(other)):\n                        return True\n\n        return False\n\n    def _apply_equivalencies(self, unit, other, equivalencies):\n        \"\"\"\n        Internal function (used from `_get_converter`) to apply\n        equivalence pairs.\n        \"\"\"\n        def make_converter(scale1, func, scale2):\n            def convert(v):\n                return func(_condition_arg(v) / scale1) * scale2\n            return convert\n\n        for funit, tunit, a, b in equivalencies:\n            if tunit is None:\n                try:\n                    ratio_in_funit = (other.decompose() /\n                                      unit.decompose()).decompose([funit])\n                    return make_converter(ratio_in_funit.scale, a, 1.)\n                except UnitsError:\n                    pass\n            else:\n                try:\n                    scale1 = funit._to(unit)\n                    scale2 = tunit._to(other)\n                    return make_converter(scale1, a, scale2)\n                except UnitsError:\n                    pass\n                try:\n                    scale1 = tunit._to(unit)\n                    scale2 = funit._to(other)\n                    return make_converter(scale1, b, scale2)\n                except UnitsError:\n                    pass\n\n        def get_err_str(unit):\n            unit_str = unit.to_string('unscaled')\n            physical_type = unit.physical_type\n            if physical_type != 'unknown':\n                unit_str = f\"'{unit_str}' ({physical_type})\"\n            else:\n                unit_str = f\"'{unit_str}'\"\n            return unit_str\n\n        unit_str = get_err_str(unit)\n        other_str = get_err_str(other)\n\n        raise UnitConversionError(\n            f\"{unit_str} and {other_str} are not convertible\")\n\n    def _get_converter(self, other, equivalencies=[]):\n        \"\"\"Get a converter for values in ``self`` to ``other``.\n\n        If no conversion is necessary, returns ``unit_scale_converter``\n        (which is used as a check in quantity helpers).\n\n        \"\"\"\n\n        # First see if it is just a scaling.\n        try:\n            scale = self._to(other)\n        except UnitsError:\n            pass\n        else:\n            if scale == 1.:\n                return unit_scale_converter\n            else:\n                return lambda val: scale * _condition_arg(val)\n\n        # if that doesn't work, maybe we can do it with equivalencies?\n        try:\n            return self._apply_equivalencies(\n                self, other, self._normalize_equivalencies(equivalencies))\n        except UnitsError as exc:\n            # Last hope: maybe other knows how to do it?\n            # We assume the equivalencies have the unit itself as first item.\n            # TODO: maybe better for other to have a `_back_converter` method?\n            if hasattr(other, 'equivalencies'):\n                for funit, tunit, a, b in other.equivalencies:\n                    if other is funit:\n                        try:\n                            return lambda v: b(self._get_converter(\n                                tunit, equivalencies=equivalencies)(v))\n                        except Exception:\n                            pass\n\n            raise exc\n\n    def _to(self, other):\n        \"\"\"\n        Returns the scale to the specified unit.\n\n        See `to`, except that a Unit object should be given (i.e., no\n        string), and that all defaults are used, i.e., no\n        equivalencies and value=1.\n        \"\"\"\n        # There are many cases where we just want to ensure a Quantity is\n        # of a particular unit, without checking whether it's already in\n        # a particular unit.  If we're being asked to convert from a unit\n        # to itself, we can short-circuit all of this.\n        if self is other:\n            return 1.0\n\n        # Don't presume decomposition is possible; e.g.,\n        # conversion to function units is through equivalencies.\n        if isinstance(other, UnitBase):\n            self_decomposed = self.decompose()\n            other_decomposed = other.decompose()\n\n            # Check quickly whether equivalent.  This is faster than\n            # `is_equivalent`, because it doesn't generate the entire\n            # physical type list of both units.  In other words it \"fails\n            # fast\".\n            if(self_decomposed.powers == other_decomposed.powers and\n               all(self_base is other_base for (self_base, other_base)\n                   in zip(self_decomposed.bases, other_decomposed.bases))):\n                return self_decomposed.scale / other_decomposed.scale\n\n        raise UnitConversionError(\n            f\"'{self!r}' is not a scaled version of '{other!r}'\")\n\n    def to(self, other, value=UNITY, equivalencies=[]):\n        \"\"\"\n        Return the converted values in the specified unit.\n\n        Parameters\n        ----------\n        other : unit-like\n            The unit to convert to.\n\n        value : int, float, or scalar array-like, optional\n            Value(s) in the current unit to be converted to the\n            specified unit.  If not provided, defaults to 1.0\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            This list is in addition to possible global defaults set by, e.g.,\n            `set_enabled_equivalencies`.\n            Use `None` to turn off all equivalencies.\n\n        Returns\n        -------\n        values : scalar or array\n            Converted value(s). Input value sequences are returned as\n            numpy arrays.\n\n        Raises\n        ------\n        UnitsError\n            If units are inconsistent\n        \"\"\"\n        if other is self and value is UNITY:\n            return UNITY\n        else:\n            return self._get_converter(Unit(other),\n                                       equivalencies=equivalencies)(value)\n\n    def in_units(self, other, value=1.0, equivalencies=[]):\n        \"\"\"\n        Alias for `to` for backward compatibility with pynbody.\n        \"\"\"\n        return self.to(\n            other, value=value, equivalencies=equivalencies)\n\n    def decompose(self, bases=set()):\n        \"\"\"\n        Return a unit object composed of only irreducible units.\n\n        Parameters\n        ----------\n        bases : sequence of UnitBase, optional\n            The bases to decompose into.  When not provided,\n            decomposes down to any irreducible units.  When provided,\n            the decomposed result will only contain the given units.\n            This will raises a `UnitsError` if it's not possible\n            to do so.\n\n        Returns\n        -------\n        unit : `~astropy.units.CompositeUnit`\n            New object containing only irreducible unit objects.\n        \"\"\"\n        raise NotImplementedError()\n\n    def _compose(self, equivalencies=[], namespace=[], max_depth=2, depth=0,\n                 cached_results=None):\n        def is_final_result(unit):\n            # Returns True if this result contains only the expected\n            # units\n            for base in unit.bases:\n                if base not in namespace:\n                    return False\n            return True\n\n        unit = self.decompose()\n        key = hash(unit)\n\n        cached = cached_results.get(key)\n        if cached is not None:\n            if isinstance(cached, Exception):\n                raise cached\n            return cached\n\n        # Prevent too many levels of recursion\n        # And special case for dimensionless unit\n        if depth >= max_depth:\n            cached_results[key] = [unit]\n            return [unit]\n\n        # Make a list including all of the equivalent units\n        units = [unit]\n        for funit, tunit, a, b in equivalencies:\n            if tunit is not None:\n                if self._is_equivalent(funit):\n                    scale = funit.decompose().scale / unit.scale\n                    units.append(Unit(a(1.0 / scale) * tunit).decompose())\n                elif self._is_equivalent(tunit):\n                    scale = tunit.decompose().scale / unit.scale\n                    units.append(Unit(b(1.0 / scale) * funit).decompose())\n            else:\n                if self._is_equivalent(funit):\n                    units.append(Unit(unit.scale))\n\n        # Store partial results\n        partial_results = []\n        # Store final results that reduce to a single unit or pair of\n        # units\n        if len(unit.bases) == 0:\n            final_results = [set([unit]), set()]\n        else:\n            final_results = [set(), set()]\n\n        for tunit in namespace:\n            tunit_decomposed = tunit.decompose()\n            for u in units:\n                # If the unit is a base unit, look for an exact match\n                # to one of the bases of the target unit.  If found,\n                # factor by the same power as the target unit's base.\n                # This allows us to factor out fractional powers\n                # without needing to do an exhaustive search.\n                if len(tunit_decomposed.bases) == 1:\n                    for base, power in zip(u.bases, u.powers):\n                        if tunit_decomposed._is_equivalent(base):\n                            tunit = tunit ** power\n                            tunit_decomposed = tunit_decomposed ** power\n                            break\n\n                composed = (u / tunit_decomposed).decompose()\n                factored = composed * tunit\n                len_bases = len(composed.bases)\n                if is_final_result(factored) and len_bases <= 1:\n                    final_results[len_bases].add(factored)\n                else:\n                    partial_results.append(\n                        (len_bases, composed, tunit))\n\n        # Do we have any minimal results?\n        for final_result in final_results:\n            if len(final_result):\n                results = final_results[0].union(final_results[1])\n                cached_results[key] = results\n                return results\n\n        partial_results.sort(key=operator.itemgetter(0))\n\n        # ...we have to recurse and try to further compose\n        results = []\n        for len_bases, composed, tunit in partial_results:\n            try:\n                composed_list = composed._compose(\n                    equivalencies=equivalencies,\n                    namespace=namespace,\n                    max_depth=max_depth, depth=depth + 1,\n                    cached_results=cached_results)\n            except UnitsError:\n                composed_list = []\n            for subcomposed in composed_list:\n                results.append(\n                    (len(subcomposed.bases), subcomposed, tunit))\n\n        if len(results):\n            results.sort(key=operator.itemgetter(0))\n\n            min_length = results[0][0]\n            subresults = set()\n            for len_bases, composed, tunit in results:\n                if len_bases > min_length:\n                    break\n                else:\n                    factored = composed * tunit\n                    if is_final_result(factored):\n                        subresults.add(factored)\n\n            if len(subresults):\n                cached_results[key] = subresults\n                return subresults\n\n        if not is_final_result(self):\n            result = UnitsError(\n                f\"Cannot represent unit {self} in terms of the given units\")\n            cached_results[key] = result\n            raise result\n\n        cached_results[key] = [self]\n        return [self]\n\n    def compose(self, equivalencies=[], units=None, max_depth=2,\n                include_prefix_units=None):\n        \"\"\"\n        Return the simplest possible composite unit(s) that represent\n        the given unit.  Since there may be multiple equally simple\n        compositions of the unit, a list of units is always returned.\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            A list of equivalence pairs to also list.  See\n            :ref:`astropy:unit_equivalencies`.\n            This list is in addition to possible global defaults set by, e.g.,\n            `set_enabled_equivalencies`.\n            Use `None` to turn off all equivalencies.\n\n        units : set of `~astropy.units.Unit`, optional\n            If not provided, any known units may be used to compose\n            into.  Otherwise, ``units`` is a dict, module or sequence\n            containing the units to compose into.\n\n        max_depth : int, optional\n            The maximum recursion depth to use when composing into\n            composite units.\n\n        include_prefix_units : bool, optional\n            When `True`, include prefixed units in the result.\n            Default is `True` if a sequence is passed in to ``units``,\n            `False` otherwise.\n\n        Returns\n        -------\n        units : list of `CompositeUnit`\n            A list of candidate compositions.  These will all be\n            equally simple, but it may not be possible to\n            automatically determine which of the candidates are\n            better.\n        \"\"\"\n        # if units parameter is specified and is a sequence (list|tuple),\n        # include_prefix_units is turned on by default.  Ex: units=[u.kpc]\n        if include_prefix_units is None:\n            include_prefix_units = isinstance(units, (list, tuple))\n\n        # Pre-normalize the equivalencies list\n        equivalencies = self._normalize_equivalencies(equivalencies)\n\n        # The namespace of units to compose into should be filtered to\n        # only include units with bases in common with self, otherwise\n        # they can't possibly provide useful results.  Having too many\n        # destination units greatly increases the search space.\n\n        def has_bases_in_common(a, b):\n            if len(a.bases) == 0 and len(b.bases) == 0:\n                return True\n            for ab in a.bases:\n                for bb in b.bases:\n                    if ab == bb:\n                        return True\n            return False\n\n        def has_bases_in_common_with_equiv(unit, other):\n            if has_bases_in_common(unit, other):\n                return True\n            for funit, tunit, a, b in equivalencies:\n                if tunit is not None:\n                    if unit._is_equivalent(funit):\n                        if has_bases_in_common(tunit.decompose(), other):\n                            return True\n                    elif unit._is_equivalent(tunit):\n                        if has_bases_in_common(funit.decompose(), other):\n                            return True\n                else:\n                    if unit._is_equivalent(funit):\n                        if has_bases_in_common(dimensionless_unscaled, other):\n                            return True\n            return False\n\n        def filter_units(units):\n            filtered_namespace = set()\n            for tunit in units:\n                if (isinstance(tunit, UnitBase) and\n                    (include_prefix_units or\n                     not isinstance(tunit, PrefixUnit)) and\n                    has_bases_in_common_with_equiv(\n                        decomposed, tunit.decompose())):\n                    filtered_namespace.add(tunit)\n            return filtered_namespace\n\n        decomposed = self.decompose()\n\n        if units is None:\n            units = filter_units(self._get_units_with_same_physical_type(\n                equivalencies=equivalencies))\n            if len(units) == 0:\n                units = get_current_unit_registry().non_prefix_units\n        elif isinstance(units, dict):\n            units = set(filter_units(units.values()))\n        elif inspect.ismodule(units):\n            units = filter_units(vars(units).values())\n        else:\n            units = filter_units(_flatten_units_collection(units))\n\n        def sort_results(results):\n            if not len(results):\n                return []\n\n            # Sort the results so the simplest ones appear first.\n            # Simplest is defined as \"the minimum sum of absolute\n            # powers\" (i.e. the fewest bases), and preference should\n            # be given to results where the sum of powers is positive\n            # and the scale is exactly equal to 1.0\n            results = list(results)\n            results.sort(key=lambda x: np.abs(x.scale))\n            results.sort(key=lambda x: np.sum(np.abs(x.powers)))\n            results.sort(key=lambda x: np.sum(x.powers) < 0.0)\n            results.sort(key=lambda x: not is_effectively_unity(x.scale))\n\n            last_result = results[0]\n            filtered = [last_result]\n            for result in results[1:]:\n                if str(result) != str(last_result):\n                    filtered.append(result)\n                last_result = result\n\n            return filtered\n\n        return sort_results(self._compose(\n            equivalencies=equivalencies, namespace=units,\n            max_depth=max_depth, depth=0, cached_results={}))\n\n    def to_system(self, system):\n        \"\"\"\n        Converts this unit into ones belonging to the given system.\n        Since more than one result may be possible, a list is always\n        returned.\n\n        Parameters\n        ----------\n        system : module\n            The module that defines the unit system.  Commonly used\n            ones include `astropy.units.si` and `astropy.units.cgs`.\n\n            To use your own module it must contain unit objects and a\n            sequence member named ``bases`` containing the base units of\n            the system.\n\n        Returns\n        -------\n        units : list of `CompositeUnit`\n            The list is ranked so that units containing only the base\n            units of that system will appear first.\n        \"\"\"\n        bases = set(system.bases)\n\n        def score(compose):\n            # In case that compose._bases has no elements we return\n            # 'np.inf' as 'score value'.  It does not really matter which\n            # number we would return. This case occurs for instance for\n            # dimensionless quantities:\n            compose_bases = compose.bases\n            if len(compose_bases) == 0:\n                return np.inf\n            else:\n                sum = 0\n                for base in compose_bases:\n                    if base in bases:\n                        sum += 1\n\n                return sum / float(len(compose_bases))\n\n        x = self.decompose(bases=bases)\n        composed = x.compose(units=system)\n        composed = sorted(composed, key=score, reverse=True)\n        return composed\n\n    @lazyproperty\n    def si(self):\n        \"\"\"\n        Returns a copy of the current `Unit` instance in SI units.\n        \"\"\"\n\n        from . import si\n        return self.to_system(si)[0]\n\n    @lazyproperty\n    def cgs(self):\n        \"\"\"\n        Returns a copy of the current `Unit` instance with CGS units.\n        \"\"\"\n        from . import cgs\n        return self.to_system(cgs)[0]\n\n    @property\n    def physical_type(self):\n        \"\"\"\n        Physical type(s) dimensionally compatible with the unit.\n\n        Returns\n        -------\n        `~astropy.units.physical.PhysicalType`\n            A representation of the physical type(s) of a unit.\n\n        Examples\n        --------\n        >>> from astropy import units as u\n        >>> u.m.physical_type\n        PhysicalType('length')\n        >>> (u.m ** 2 / u.s).physical_type\n        PhysicalType({'diffusivity', 'kinematic viscosity'})\n\n        Physical types can be compared to other physical types\n        (recommended in packages) or to strings.\n\n        >>> area = (u.m ** 2).physical_type\n        >>> area == u.m.physical_type ** 2\n        True\n        >>> area == \"area\"\n        True\n\n        `~astropy.units.physical.PhysicalType` objects can be used for\n        dimensional analysis.\n\n        >>> number_density = u.m.physical_type ** -3\n        >>> velocity = (u.m / u.s).physical_type\n        >>> number_density * velocity\n        PhysicalType('particle flux')\n        \"\"\"\n        from . import physical\n        return physical.get_physical_type(self)\n\n    def _get_units_with_same_physical_type(self, equivalencies=[]):\n        \"\"\"\n        Return a list of registered units with the same physical type\n        as this unit.\n\n        This function is used by Quantity to add its built-in\n        conversions to equivalent units.\n\n        This is a private method, since end users should be encouraged\n        to use the more powerful `compose` and `find_equivalent_units`\n        methods (which use this under the hood).\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            A list of equivalence pairs to also pull options from.\n            See :ref:`astropy:unit_equivalencies`.  It must already be\n            normalized using `_normalize_equivalencies`.\n        \"\"\"\n        unit_registry = get_current_unit_registry()\n        units = set(unit_registry.get_units_with_physical_type(self))\n        for funit, tunit, a, b in equivalencies:\n            if tunit is not None:\n                if self.is_equivalent(funit) and tunit not in units:\n                    units.update(\n                        unit_registry.get_units_with_physical_type(tunit))\n                if self._is_equivalent(tunit) and funit not in units:\n                    units.update(\n                        unit_registry.get_units_with_physical_type(funit))\n            else:\n                if self.is_equivalent(funit):\n                    units.add(dimensionless_unscaled)\n        return units\n\n    class EquivalentUnitsList(list):\n        \"\"\"\n        A class to handle pretty-printing the result of\n        `find_equivalent_units`.\n        \"\"\"\n\n        HEADING_NAMES = ('Primary name', 'Unit definition', 'Aliases')\n        ROW_LEN = 3  # len(HEADING_NAMES), but hard-code since it is constant\n        NO_EQUIV_UNITS_MSG = 'There are no equivalent units'\n\n        def __repr__(self):\n            if len(self) == 0:\n                return self.NO_EQUIV_UNITS_MSG\n            else:\n                lines = self._process_equivalent_units(self)\n                lines.insert(0, self.HEADING_NAMES)\n                widths = [0] * self.ROW_LEN\n                for line in lines:\n                    for i, col in enumerate(line):\n                        widths[i] = max(widths[i], len(col))\n\n                f = \"  {{0:<{0}s}} | {{1:<{1}s}} | {{2:<{2}s}}\".format(*widths)\n                lines = [f.format(*line) for line in lines]\n                lines = (lines[0:1] +\n                         ['['] +\n                         [f'{x} ,' for x in lines[1:]] +\n                         [']'])\n                return '\\n'.join(lines)\n\n        def _repr_html_(self):\n            \"\"\"\n            Outputs a HTML table representation within Jupyter notebooks.\n            \"\"\"\n            if len(self) == 0:\n                return f\"<p>{self.NO_EQUIV_UNITS_MSG}</p>\"\n            else:\n                # HTML tags to use to compose the table in HTML\n                blank_table = '<table style=\"width:50%\">{}</table>'\n                blank_row_container = \"<tr>{}</tr>\"\n                heading_row_content = \"<th>{}</th>\" * self.ROW_LEN\n                data_row_content = \"<td>{}</td>\" * self.ROW_LEN\n\n                # The HTML will be rendered & the table is simple, so don't\n                # bother to include newlines & indentation for the HTML code.\n                heading_row = blank_row_container.format(\n                    heading_row_content.format(*self.HEADING_NAMES))\n                data_rows = self._process_equivalent_units(self)\n                all_rows = heading_row\n                for row in data_rows:\n                    html_row = blank_row_container.format(\n                        data_row_content.format(*row))\n                    all_rows += html_row\n                return blank_table.format(all_rows)\n\n        @staticmethod\n        def _process_equivalent_units(equiv_units_data):\n            \"\"\"\n            Extract attributes, and sort, the equivalent units pre-formatting.\n            \"\"\"\n            processed_equiv_units = []\n            for u in equiv_units_data:\n                irred = u.decompose().to_string()\n                if irred == u.name:\n                    irred = 'irreducible'\n                processed_equiv_units.append(\n                    (u.name, irred, ', '.join(u.aliases)))\n            processed_equiv_units.sort()\n            return processed_equiv_units\n\n    def find_equivalent_units(self, equivalencies=[], units=None,\n                              include_prefix_units=False):\n        \"\"\"\n        Return a list of all the units that are the same type as ``self``.\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            A list of equivalence pairs to also list.  See\n            :ref:`astropy:unit_equivalencies`.\n            Any list given, including an empty one, supersedes global defaults\n            that may be in effect (as set by `set_enabled_equivalencies`)\n\n        units : set of `~astropy.units.Unit`, optional\n            If not provided, all defined units will be searched for\n            equivalencies.  Otherwise, may be a dict, module or\n            sequence containing the units to search for equivalencies.\n\n        include_prefix_units : bool, optional\n            When `True`, include prefixed units in the result.\n            Default is `False`.\n\n        Returns\n        -------\n        units : list of `UnitBase`\n            A list of unit objects that match ``u``.  A subclass of\n            `list` (``EquivalentUnitsList``) is returned that\n            pretty-prints the list of units when output.\n        \"\"\"\n        results = self.compose(\n            equivalencies=equivalencies, units=units, max_depth=1,\n            include_prefix_units=include_prefix_units)\n        results = set(\n            x.bases[0] for x in results if len(x.bases) == 1)\n        return self.EquivalentUnitsList(results)\n\n    def is_unity(self):\n        \"\"\"\n        Returns `True` if the unit is unscaled and dimensionless.\n        \"\"\"\n        return False"},{"col":4,"comment":"null","endLoc":37,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":3316,"name":"from_tree","nodeType":"Function","startLoc":30,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        eqs = []\n        for eq in node:\n            equiv = getattr(equivalencies, eq['name'])\n            kwargs = dict(zip(eq['kwargs_names'], eq['kwargs_values']))\n            eqs.append(equiv(**kwargs))\n        return sum(eqs[1:], eqs[0])"},{"col":4,"comment":"null","endLoc":640,"header":"def __deepcopy__(self, memo)","id":3317,"name":"__deepcopy__","nodeType":"Function","startLoc":636,"text":"def __deepcopy__(self, memo):\n        # This may look odd, but the units conversion will be very\n        # broken after deep-copying if we don't guarantee that a given\n        # physical unit corresponds to only one instance\n        return self"},{"col":4,"comment":"\n        Generate latex representation of unit name.  This is used by\n        the IPython notebook to print a unit with a nice layout.\n\n        Returns\n        -------\n        Latex string\n        ","endLoc":651,"header":"def _repr_latex_(self)","id":3318,"name":"_repr_latex_","nodeType":"Function","startLoc":642,"text":"def _repr_latex_(self):\n        \"\"\"\n        Generate latex representation of unit name.  This is used by\n        the IPython notebook to print a unit with a nice layout.\n\n        Returns\n        -------\n        Latex string\n        \"\"\"\n        return unit_format.Latex.to_string(self)"},{"col":4,"comment":"null","endLoc":91,"header":"@classmethod\n    def to_string(cls, unit)","id":3319,"name":"to_string","nodeType":"Function","startLoc":71,"text":"@classmethod\n    def to_string(cls, unit):\n        latex_name = None\n        if hasattr(unit, '_format'):\n            latex_name = unit._format.get('latex')\n\n        if latex_name is not None:\n            s = latex_name\n        elif isinstance(unit, core.CompositeUnit):\n            if unit.scale == 1:\n                s = ''\n            else:\n                s = cls.format_exponential_notation(unit.scale) + r'\\,'\n\n            if len(unit.bases):\n                s += cls._format_bases(unit)\n\n        elif isinstance(unit, core.NamedUnit):\n            s = cls._latex_escape(unit.name)\n\n        return fr'$\\mathrm{{{s}}}$'"},{"col":4,"comment":"null","endLoc":41,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3320,"name":"assert_equal","nodeType":"Function","startLoc":39,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        assert a == b"},{"attributeType":"null","col":4,"comment":"null","endLoc":12,"id":3321,"name":"name","nodeType":"Attribute","startLoc":12,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":13,"id":3322,"name":"types","nodeType":"Attribute","startLoc":13,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":14,"id":3323,"name":"version","nodeType":"Attribute","startLoc":14,"text":"version"},{"col":0,"comment":"Encode a Table ``tbl`` that may have mixin columns to a Table with only\n    astropy Columns + appropriate meta-data to allow subsequent decoding.\n    ","endLoc":206,"header":"def _encode_mixins(tbl)","id":3324,"name":"_encode_mixins","nodeType":"Function","startLoc":193,"text":"def _encode_mixins(tbl):\n    \"\"\"Encode a Table ``tbl`` that may have mixin columns to a Table with only\n    astropy Columns + appropriate meta-data to allow subsequent decoding.\n    \"\"\"\n    from astropy.table import serialize\n    from astropy import units as u\n    from astropy.utils.data_info import serialize_context_as\n\n    # Convert the table to one with no mixins, only Column objects.  This adds\n    # meta data which is extracted with meta.get_yaml_from_table.\n    with serialize_context_as('hdf5'):\n        encode_tbl = serialize.represent_mixins_as_columns(tbl)\n\n    return encode_tbl"},{"col":4,"comment":"null","endLoc":69,"header":"@classmethod\n    def _format_bases(cls, unit)","id":3325,"name":"_format_bases","nodeType":"Function","startLoc":53,"text":"@classmethod\n    def _format_bases(cls, unit):\n        positives, negatives = utils.get_grouped_by_powers(\n                unit.bases, unit.powers)\n\n        if len(negatives):\n            if len(positives):\n                positives = cls._format_unit_list(positives)\n            else:\n                positives = '1'\n            negatives = cls._format_unit_list(negatives)\n            s = fr'\\frac{{{positives}}}{{{negatives}}}'\n        else:\n            positives = cls._format_unit_list(positives)\n            s = positives\n\n        return s"},{"col":0,"comment":"\n    Determine whether `origin` is a FITS file.\n\n    Parameters\n    ----------\n    origin : str or readable file-like\n        Path or file object containing a potential FITS file.\n\n    Returns\n    -------\n    is_fits : bool\n        Returns `True` if the given file is a FITS file.\n    ","endLoc":64,"header":"def is_fits(origin, filepath, fileobj, *args, **kwargs)","id":3326,"name":"is_fits","nodeType":"Function","startLoc":38,"text":"def is_fits(origin, filepath, fileobj, *args, **kwargs):\n    \"\"\"\n    Determine whether `origin` is a FITS file.\n\n    Parameters\n    ----------\n    origin : str or readable file-like\n        Path or file object containing a potential FITS file.\n\n    Returns\n    -------\n    is_fits : bool\n        Returns `True` if the given file is a FITS file.\n    \"\"\"\n    if fileobj is not None:\n        pos = fileobj.tell()\n        sig = fileobj.read(30)\n        fileobj.seek(pos)\n        return sig == FITS_SIGNATURE\n    elif filepath is not None:\n        if filepath.lower().endswith(('.fits', '.fits.gz', '.fit', '.fit.gz',\n                                      '.fts', '.fts.gz')):\n            return True\n    elif isinstance(args[0], (HDUList, TableHDU, BinTableHDU, GroupsHDU)):\n        return True\n    else:\n        return False"},{"col":0,"comment":"\n    Groups the powers and bases in the given\n    `~astropy.units.CompositeUnit` into positive powers and\n    negative powers for easy display on either side of a solidus.\n\n    Parameters\n    ----------\n    bases : list of `astropy.units.UnitBase` instances\n\n    powers : list of int\n\n    Returns\n    -------\n    positives, negatives : tuple of lists\n       Each element in each list is tuple of the form (*base*,\n       *power*).  The negatives have the sign of their power reversed\n       (i.e. the powers are all positive).\n    ","endLoc":43,"header":"def get_grouped_by_powers(bases, powers)","id":3327,"name":"get_grouped_by_powers","nodeType":"Function","startLoc":15,"text":"def get_grouped_by_powers(bases, powers):\n    \"\"\"\n    Groups the powers and bases in the given\n    `~astropy.units.CompositeUnit` into positive powers and\n    negative powers for easy display on either side of a solidus.\n\n    Parameters\n    ----------\n    bases : list of `astropy.units.UnitBase` instances\n\n    powers : list of int\n\n    Returns\n    -------\n    positives, negatives : tuple of lists\n       Each element in each list is tuple of the form (*base*,\n       *power*).  The negatives have the sign of their power reversed\n       (i.e. the powers are all positive).\n    \"\"\"\n    positive = []\n    negative = []\n    for base, power in zip(bases, powers):\n        if power < 0:\n            negative.append((base, -power))\n        elif power > 0:\n            positive.append((base, power))\n        else:\n            raise ValueError(\"Unit with 0 power\")\n    return positive, negative"},{"col":0,"comment":"\n    Write a Table object to an HDF5 file\n\n    This requires `h5py <http://www.h5py.org/>`_ to be installed.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        Data table that is to be written to file.\n    output : str or :class:`h5py.File` or :class:`h5py.Group`\n        If a string, the filename to write the table to. If an h5py object,\n        either the file or the group object to write the table to.\n    path : str\n        The path to which to write the table inside the HDF5 file.\n        This should be relative to the input file or group.\n        If not specified, defaults to ``__astropy_table__``.\n    compression : bool or str or int\n        Whether to compress the table inside the HDF5 file. If set to `True`,\n        ``'gzip'`` compression is used. If a string is specified, it should be\n        one of ``'gzip'``, ``'szip'``, or ``'lzf'``. If an integer is\n        specified (in the range 0-9), ``'gzip'`` compression is used, and the\n        integer denotes the compression level.\n    append : bool\n        Whether to append the table to an existing HDF5 file.\n    overwrite : bool\n        Whether to overwrite any existing file without warning.\n        If ``append=True`` and ``overwrite=True`` then only the dataset will be\n        replaced; the file/group will not be overwritten.\n    **create_dataset_kwargs\n        Additional keyword arguments are passed to\n        ``h5py.File.create_dataset()`` or ``h5py.Group.create_dataset()``.\n    ","endLoc":366,"header":"def write_table_hdf5(table, output, path=None, compression=False,\n                     append=False, overwrite=False, serialize_meta=False,\n                     **create_dataset_kwargs)","id":3328,"name":"write_table_hdf5","nodeType":"Function","startLoc":209,"text":"def write_table_hdf5(table, output, path=None, compression=False,\n                     append=False, overwrite=False, serialize_meta=False,\n                     **create_dataset_kwargs):\n    \"\"\"\n    Write a Table object to an HDF5 file\n\n    This requires `h5py <http://www.h5py.org/>`_ to be installed.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        Data table that is to be written to file.\n    output : str or :class:`h5py.File` or :class:`h5py.Group`\n        If a string, the filename to write the table to. If an h5py object,\n        either the file or the group object to write the table to.\n    path : str\n        The path to which to write the table inside the HDF5 file.\n        This should be relative to the input file or group.\n        If not specified, defaults to ``__astropy_table__``.\n    compression : bool or str or int\n        Whether to compress the table inside the HDF5 file. If set to `True`,\n        ``'gzip'`` compression is used. If a string is specified, it should be\n        one of ``'gzip'``, ``'szip'``, or ``'lzf'``. If an integer is\n        specified (in the range 0-9), ``'gzip'`` compression is used, and the\n        integer denotes the compression level.\n    append : bool\n        Whether to append the table to an existing HDF5 file.\n    overwrite : bool\n        Whether to overwrite any existing file without warning.\n        If ``append=True`` and ``overwrite=True`` then only the dataset will be\n        replaced; the file/group will not be overwritten.\n    **create_dataset_kwargs\n        Additional keyword arguments are passed to\n        ``h5py.File.create_dataset()`` or ``h5py.Group.create_dataset()``.\n    \"\"\"\n\n    from astropy.table import meta\n    try:\n        import h5py\n    except ImportError:\n        raise Exception(\"h5py is required to read and write HDF5 files\")\n\n    if path is None:\n        # table is just an arbitrary, hardcoded string here.\n        path = '__astropy_table__'\n    elif path.endswith('/'):\n        raise ValueError(\"table path should end with table name, not /\")\n\n    if '/' in path:\n        group, name = path.rsplit('/', 1)\n    else:\n        group, name = None, path\n\n    if isinstance(output, (h5py.File, h5py.Group)):\n        if len(list(output.keys())) > 0 and name == '__astropy_table__':\n            raise ValueError(\"table path should always be set via the \"\n                             \"path= argument when writing to existing \"\n                             \"files\")\n        elif name == '__astropy_table__':\n            warnings.warn(\"table path was not set via the path= argument; \"\n                          \"using default path {}\".format(path))\n\n        if group:\n            try:\n                output_group = output[group]\n            except (KeyError, ValueError):\n                output_group = output.create_group(group)\n        else:\n            output_group = output\n\n    elif isinstance(output, str):\n\n        if os.path.exists(output) and not append:\n            if overwrite and not append:\n                os.remove(output)\n            else:\n                raise OSError(NOT_OVERWRITING_MSG.format(output))\n\n        # Open the file for appending or writing\n        f = h5py.File(output, 'a' if append else 'w')\n\n        # Recursively call the write function\n        try:\n            return write_table_hdf5(table, f, path=path,\n                                    compression=compression, append=append,\n                                    overwrite=overwrite,\n                                    serialize_meta=serialize_meta)\n        finally:\n            f.close()\n\n    else:\n\n        raise TypeError('output should be a string or an h5py File or '\n                        'Group object')\n\n    # Check whether table already exists\n    if name in output_group:\n        if append and overwrite:\n            # Delete only the dataset itself\n            del output_group[name]\n            if serialize_meta and name + '.__table_column_meta__' in output_group:\n                del output_group[name + '.__table_column_meta__']\n        else:\n            raise OSError(f\"Table {path} already exists\")\n\n    # Encode any mixin columns as plain columns + appropriate metadata\n    table = _encode_mixins(table)\n\n    # Table with numpy unicode strings can't be written in HDF5 so\n    # to write such a table a copy of table is made containing columns as\n    # bytestrings.  Now this copy of the table can be written in HDF5.\n    if any(col.info.dtype.kind == 'U' for col in table.itercols()):\n        table = table.copy(copy_data=False)\n        table.convert_unicode_to_bytestring()\n\n    # Warn if information will be lost when serialize_meta=False.  This is\n    # hardcoded to the set difference between column info attributes and what\n    # HDF5 can store natively (name, dtype) with no meta.\n    if serialize_meta is False:\n        for col in table.itercols():\n            for attr in ('unit', 'format', 'description', 'meta'):\n                if getattr(col.info, attr, None) not in (None, {}):\n                    warnings.warn(\"table contains column(s) with defined 'unit', 'format',\"\n                                  \" 'description', or 'meta' info attributes. These will\"\n                                  \" be dropped since serialize_meta=False.\",\n                                  AstropyUserWarning)\n\n    # Write the table to the file\n    if compression:\n        if compression is True:\n            compression = 'gzip'\n        dset = output_group.create_dataset(name, data=table.as_array(),\n                                           compression=compression,\n                                           **create_dataset_kwargs)\n    else:\n        dset = output_group.create_dataset(name, data=table.as_array(),\n                                           **create_dataset_kwargs)\n\n    if serialize_meta:\n        header_yaml = meta.get_yaml_from_table(table)\n        header_encoded = np.array([h.encode('utf-8') for h in header_yaml])\n        output_group.create_dataset(meta_path(name),\n                                    data=header_encoded)\n\n    else:\n        # Write the Table meta dict key:value pairs to the file as HDF5\n        # attributes.  This works only for a limited set of scalar data types\n        # like numbers, strings, etc., but not any complex types.  This path\n        # also ignores column meta like unit or format.\n        for key in table.meta:\n            val = table.meta[key]\n            try:\n                dset.attrs[key] = val\n            except TypeError:\n                warnings.warn(\"Attribute `{}` of type {} cannot be written to \"\n                              \"HDF5 files - skipping. (Consider specifying \"\n                              \"serialize_meta=True to write all meta data)\".format(key, type(val)),\n                              AstropyUserWarning)"},{"col":4,"comment":"null","endLoc":51,"header":"@classmethod\n    def _format_unit_list(cls, units)","id":3329,"name":"_format_unit_list","nodeType":"Function","startLoc":36,"text":"@classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        for base, power in units:\n            base_latex = cls._get_unit_name(base)\n            if power == 1:\n                out.append(base_latex)\n            else:\n                # If the LaTeX representation of the base unit already ends with\n                # a superscript, we need to spell out the unit to avoid double\n                # superscripts. For example, the logic below ensures that\n                # `u.deg**2` returns `deg^{2}` instead of `{}^{\\circ}^{2}`.\n                if re.match(r\".*\\^{[^}]*}$\", base_latex): # ends w/ superscript?\n                    base_latex = base.short_names[0]\n                out.append(f'{base_latex}^{{{utils.format_power(power)}}}')\n        return r'\\,'.join(out)"},{"fileName":"quantity.py","filePath":"astropy/io/misc/asdf/tags/unit","id":3330,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nfrom astropy.units import Quantity\n\nfrom asdf.tags.core import NDArrayType\n\nfrom astropy.io.misc.asdf.types import AstropyAsdfType\n\n\nclass QuantityType(AstropyAsdfType):\n    name = 'unit/quantity'\n    types = ['astropy.units.Quantity']\n    requires = ['astropy']\n    version = '1.1.0'\n\n    @classmethod\n    def to_tree(cls, quantity, ctx):\n        node = {}\n        if isinstance(quantity, Quantity):\n            node['value'] = quantity.value\n            node['unit'] = quantity.unit\n            return node\n        raise TypeError(f\"'{quantity}' is not a valid Quantity\")\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        if isinstance(node, Quantity):\n            return node\n\n        unit = node['unit']\n        value = node['value']\n        if isinstance(value, NDArrayType):\n            value = value._make_array()\n        return Quantity(value, unit=unit)\n"},{"col":4,"comment":"null","endLoc":34,"header":"@classmethod\n    def _get_unit_name(cls, unit)","id":3331,"name":"_get_unit_name","nodeType":"Function","startLoc":29,"text":"@classmethod\n    def _get_unit_name(cls, unit):\n        name = unit.get_format_name('latex')\n        if name == unit.name:\n            return cls._latex_escape(name)\n        return name"},{"col":4,"comment":"null","endLoc":27,"header":"@classmethod\n    def _latex_escape(cls, name)","id":3332,"name":"_latex_escape","nodeType":"Function","startLoc":22,"text":"@classmethod\n    def _latex_escape(cls, name):\n        # This doesn't escape arbitrary LaTeX strings, but it should\n        # be good enough for unit names which are required to be alpha\n        # + \"_\" anyway.\n        return name.replace('_', r'\\_')"},{"className":"QuantityType","col":0,"comment":"null","endLoc":35,"id":3333,"nodeType":"Class","startLoc":11,"text":"class QuantityType(AstropyAsdfType):\n    name = 'unit/quantity'\n    types = ['astropy.units.Quantity']\n    requires = ['astropy']\n    version = '1.1.0'\n\n    @classmethod\n    def to_tree(cls, quantity, ctx):\n        node = {}\n        if isinstance(quantity, Quantity):\n            node['value'] = quantity.value\n            node['unit'] = quantity.unit\n            return node\n        raise TypeError(f\"'{quantity}' is not a valid Quantity\")\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        if isinstance(node, Quantity):\n            return node\n\n        unit = node['unit']\n        value = node['value']\n        if isinstance(value, NDArrayType):\n            value = value._make_array()\n        return Quantity(value, unit=unit)"},{"col":4,"comment":"null","endLoc":24,"header":"@classmethod\n    def to_tree(cls, quantity, ctx)","id":3334,"name":"to_tree","nodeType":"Function","startLoc":17,"text":"@classmethod\n    def to_tree(cls, quantity, ctx):\n        node = {}\n        if isinstance(quantity, Quantity):\n            node['value'] = quantity.value\n            node['unit'] = quantity.unit\n            return node\n        raise TypeError(f\"'{quantity}' is not a valid Quantity\")"},{"col":4,"comment":"null","endLoc":35,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":3335,"name":"from_tree","nodeType":"Function","startLoc":26,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        if isinstance(node, Quantity):\n            return node\n\n        unit = node['unit']\n        value = node['value']\n        if isinstance(value, NDArrayType):\n            value = value._make_array()\n        return Quantity(value, unit=unit)"},{"col":0,"comment":"\n    Converts a value for a power (which may be floating point or a\n    `fractions.Fraction` object), into a string looking like either\n    an integer or a fraction, if the power is close to that.\n    ","endLoc":128,"header":"def format_power(power)","id":3336,"name":"format_power","nodeType":"Function","startLoc":117,"text":"def format_power(power):\n    \"\"\"\n    Converts a value for a power (which may be floating point or a\n    `fractions.Fraction` object), into a string looking like either\n    an integer or a fraction, if the power is close to that.\n    \"\"\"\n    if not hasattr(power, 'denominator'):\n        power = maybe_simple_fraction(power)\n        if getattr(power, 'denonimator', None) == 1:\n            power = power.nominator\n\n    return str(power)"},{"col":4,"comment":"null","endLoc":69,"header":"@classmethod\n    def to_tree(cls, hdulist, ctx)","id":3337,"name":"to_tree","nodeType":"Function","startLoc":40,"text":"@classmethod\n    def to_tree(cls, hdulist, ctx):\n        units = []\n        for hdu in hdulist:\n            header_list = []\n            for card in hdu.header.cards:\n                if card.comment:\n                    new_card = [card.keyword, card.value, card.comment]\n                else:\n                    if card.value:\n                        new_card = [card.keyword, card.value]\n                    else:\n                        if card.keyword:\n                            new_card = [card.keyword]\n                        else:\n                            new_card = []\n                header_list.append(new_card)\n\n            hdu_dict = {}\n            hdu_dict['header'] = header_list\n            if hdu.data is not None:\n                if hdu.data.dtype.names is not None:\n                    data = table.Table(hdu.data)\n                else:\n                    data = hdu.data\n                hdu_dict['data'] = data\n\n            units.append(hdu_dict)\n\n        return units"},{"col":0,"comment":"Decode a Table ``tbl`` that has astropy Columns + appropriate meta-data into\n    the corresponding table with mixin columns (as appropriate).\n    ","endLoc":111,"header":"def _decode_mixins(tbl)","id":3338,"name":"_decode_mixins","nodeType":"Function","startLoc":67,"text":"def _decode_mixins(tbl):\n    \"\"\"Decode a Table ``tbl`` that has astropy Columns + appropriate meta-data into\n    the corresponding table with mixin columns (as appropriate).\n    \"\"\"\n    # If available read in __serialized_columns__ meta info which is stored\n    # in FITS COMMENTS between two sentinels.\n    try:\n        i0 = tbl.meta['comments'].index('--BEGIN-ASTROPY-SERIALIZED-COLUMNS--')\n        i1 = tbl.meta['comments'].index('--END-ASTROPY-SERIALIZED-COLUMNS--')\n    except (ValueError, KeyError):\n        return tbl\n\n    # The YAML data are split into COMMENT cards, with lines longer than 70\n    # characters being split with a continuation character \\ (backslash).\n    # Strip the backslashes and join together.\n    continuation_line = False\n    lines = []\n    for line in tbl.meta['comments'][i0 + 1:i1]:\n        if continuation_line:\n            lines[-1] = lines[-1] + line[:70]\n        else:\n            lines.append(line[:70])\n        continuation_line = len(line) == 71\n\n    del tbl.meta['comments'][i0:i1 + 1]\n    if not tbl.meta['comments']:\n        del tbl.meta['comments']\n\n    info = meta.get_header_from_yaml(lines)\n\n    # Add serialized column information to table meta for use in constructing mixins\n    tbl.meta['__serialized_columns__'] = info['meta']['__serialized_columns__']\n\n    # Use the `datatype` attribute info to update column attributes that are\n    # NOT already handled via standard FITS column keys (name, dtype, unit).\n    for col in info['datatype']:\n        for attr in ['description', 'meta']:\n            if attr in col:\n                setattr(tbl[col['name']].info, attr, col[attr])\n\n    # Construct new table with mixins, using tbl.meta['__serialized_columns__']\n    # as guidance.\n    tbl = serialize._construct_mixins_from_columns(tbl)\n\n    return tbl"},{"col":4,"comment":"Return string representation for unit","endLoc":655,"header":"def __bytes__(self)","id":3339,"name":"__bytes__","nodeType":"Function","startLoc":653,"text":"def __bytes__(self):\n        \"\"\"Return string representation for unit\"\"\"\n        return unit_format.Generic.to_string(self).encode('unicode_escape')"},{"col":4,"comment":"null","endLoc":119,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":3340,"name":"from_tree","nodeType":"Function","startLoc":96,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        if isinstance(node, (str, list, np.ndarray)):\n            t = time.Time(node)\n            fmt = _astropy_format_to_asdf_format.get(t.format, t.format)\n            if fmt not in _guessable_formats:\n                raise ValueError(f\"Invalid time '{node}'\")\n            return t\n\n        value = node['value']\n        fmt = node.get('format')\n        scale = node.get('scale')\n        location = node.get('location')\n        if location is not None:\n            unit = location.get('unit', u.m)\n            # This ensures that we can read the v.1.0.0 schema and convert it\n            # to the new EarthLocation object, which expects Quantity components\n            for comp in ['x', 'y', 'z']:\n                if not isinstance(location[comp], Quantity):\n                    location[comp] = Quantity(location[comp], unit=unit)\n            location = EarthLocation.from_geocentric(\n                location['x'], location['y'], location['z'])\n\n        return time.Time(value, format=fmt, scale=scale, location=location)"},{"col":0,"comment":"\n    Read a Table object from an FITS file\n\n    If the ``astropy_native`` argument is ``True``, then input FITS columns\n    which are representations of an astropy core object will be converted to\n    that class and stored in the ``Table`` as \"mixin columns\".  Currently this\n    is limited to FITS columns which adhere to the FITS Time standard, in which\n    case they will be converted to a `~astropy.time.Time` column in the output\n    table.\n\n    Parameters\n    ----------\n    input : str or file-like or compatible `astropy.io.fits` HDU object\n        If a string, the filename to read the table from. If a file object, or\n        a compatible HDU object, the object to extract the table from. The\n        following `astropy.io.fits` HDU objects can be used as input:\n        - :class:`~astropy.io.fits.hdu.table.TableHDU`\n        - :class:`~astropy.io.fits.hdu.table.BinTableHDU`\n        - :class:`~astropy.io.fits.hdu.table.GroupsHDU`\n        - :class:`~astropy.io.fits.hdu.hdulist.HDUList`\n    hdu : int or str, optional\n        The HDU to read the table from.\n    astropy_native : bool, optional\n        Read in FITS columns as native astropy objects where possible instead\n        of standard Table Column objects. Default is False.\n    memmap : bool, optional\n        Whether to use memory mapping, which accesses data on disk as needed. If\n        you are only accessing part of the data, this is often more efficient.\n        If you want to access all the values in the table, and you are able to\n        fit the table in memory, you may be better off leaving memory mapping\n        off. However, if your table would not fit in memory, you should set this\n        to `True`.\n    character_as_bytes : bool, optional\n        If `True`, string columns are stored as Numpy byte arrays (dtype ``S``)\n        and are converted on-the-fly to unicode strings when accessing\n        individual elements. If you need to use Numpy unicode arrays (dtype\n        ``U``) internally, you should set this to `False`, but note that this\n        will use more memory. If set to `False`, string columns will not be\n        memory-mapped even if ``memmap`` is `True`.\n    unit_parse_strict : str, optional\n        Behaviour when encountering invalid column units in the FITS header.\n        Default is \"warn\", which will emit a ``UnitsWarning`` and create a\n        :class:`~astropy.units.core.UnrecognizedUnit`.\n        Values are the ones allowed by the ``parse_strict`` argument of\n        :class:`~astropy.units.core.Unit`: ``raise``, ``warn`` and ``silent``.\n\n    ","endLoc":313,"header":"def read_table_fits(input, hdu=None, astropy_native=False, memmap=False,\n                    character_as_bytes=True, unit_parse_strict='warn')","id":3341,"name":"read_table_fits","nodeType":"Function","startLoc":114,"text":"def read_table_fits(input, hdu=None, astropy_native=False, memmap=False,\n                    character_as_bytes=True, unit_parse_strict='warn'):\n    \"\"\"\n    Read a Table object from an FITS file\n\n    If the ``astropy_native`` argument is ``True``, then input FITS columns\n    which are representations of an astropy core object will be converted to\n    that class and stored in the ``Table`` as \"mixin columns\".  Currently this\n    is limited to FITS columns which adhere to the FITS Time standard, in which\n    case they will be converted to a `~astropy.time.Time` column in the output\n    table.\n\n    Parameters\n    ----------\n    input : str or file-like or compatible `astropy.io.fits` HDU object\n        If a string, the filename to read the table from. If a file object, or\n        a compatible HDU object, the object to extract the table from. The\n        following `astropy.io.fits` HDU objects can be used as input:\n        - :class:`~astropy.io.fits.hdu.table.TableHDU`\n        - :class:`~astropy.io.fits.hdu.table.BinTableHDU`\n        - :class:`~astropy.io.fits.hdu.table.GroupsHDU`\n        - :class:`~astropy.io.fits.hdu.hdulist.HDUList`\n    hdu : int or str, optional\n        The HDU to read the table from.\n    astropy_native : bool, optional\n        Read in FITS columns as native astropy objects where possible instead\n        of standard Table Column objects. Default is False.\n    memmap : bool, optional\n        Whether to use memory mapping, which accesses data on disk as needed. If\n        you are only accessing part of the data, this is often more efficient.\n        If you want to access all the values in the table, and you are able to\n        fit the table in memory, you may be better off leaving memory mapping\n        off. However, if your table would not fit in memory, you should set this\n        to `True`.\n    character_as_bytes : bool, optional\n        If `True`, string columns are stored as Numpy byte arrays (dtype ``S``)\n        and are converted on-the-fly to unicode strings when accessing\n        individual elements. If you need to use Numpy unicode arrays (dtype\n        ``U``) internally, you should set this to `False`, but note that this\n        will use more memory. If set to `False`, string columns will not be\n        memory-mapped even if ``memmap`` is `True`.\n    unit_parse_strict : str, optional\n        Behaviour when encountering invalid column units in the FITS header.\n        Default is \"warn\", which will emit a ``UnitsWarning`` and create a\n        :class:`~astropy.units.core.UnrecognizedUnit`.\n        Values are the ones allowed by the ``parse_strict`` argument of\n        :class:`~astropy.units.core.Unit`: ``raise``, ``warn`` and ``silent``.\n\n    \"\"\"\n\n    if isinstance(input, HDUList):\n\n        # Parse all table objects\n        tables = dict()\n        for ihdu, hdu_item in enumerate(input):\n            if isinstance(hdu_item, (TableHDU, BinTableHDU, GroupsHDU)):\n                tables[ihdu] = hdu_item\n\n        if len(tables) > 1:\n            if hdu is None:\n                warnings.warn(\"hdu= was not specified but multiple tables\"\n                              \" are present, reading in first available\"\n                              f\" table (hdu={first(tables)})\",\n                              AstropyUserWarning)\n                hdu = first(tables)\n\n            # hdu might not be an integer, so we first need to convert it\n            # to the correct HDU index\n            hdu = input.index_of(hdu)\n\n            if hdu in tables:\n                table = tables[hdu]\n            else:\n                raise ValueError(f\"No table found in hdu={hdu}\")\n\n        elif len(tables) == 1:\n            if hdu is not None:\n                msg = None\n                try:\n                    hdi = input.index_of(hdu)\n                except KeyError:\n                    msg = f\"Specified hdu={hdu} not found\"\n                else:\n                    if hdi >= len(input):\n                        msg = f\"Specified hdu={hdu} not found\"\n                    elif hdi not in tables:\n                        msg = f\"No table found in specified hdu={hdu}\"\n                if msg is not None:\n                    warnings.warn(f\"{msg}, reading in first available table \"\n                                  f\"(hdu={first(tables)}) instead. This will\"\n                                  \" result in an error in future versions!\",\n                                  AstropyDeprecationWarning)\n            table = tables[first(tables)]\n\n        else:\n            raise ValueError(\"No table found\")\n\n    elif isinstance(input, (TableHDU, BinTableHDU, GroupsHDU)):\n\n        table = input\n\n    else:\n\n        hdulist = fits_open(input, character_as_bytes=character_as_bytes,\n                            memmap=memmap)\n\n        try:\n            return read_table_fits(\n                hdulist, hdu=hdu,\n                astropy_native=astropy_native,\n                unit_parse_strict=unit_parse_strict,\n            )\n        finally:\n            hdulist.close()\n\n    # In the loop below we access the data using data[col.name] rather than\n    # col.array to make sure that the data is scaled correctly if needed.\n    data = table.data\n\n    columns = []\n    for col in data.columns:\n        # Check if column is masked. Here, we make a guess based on the\n        # presence of FITS mask values. For integer columns, this is simply\n        # the null header, for float and complex, the presence of NaN, and for\n        # string, empty strings.\n        # Since Multi-element columns with dtypes such as '2f8' have a subdtype,\n        # we should look up the type of column on that.\n        masked = mask = False\n        coltype = (col.dtype.subdtype[0].type if col.dtype.subdtype\n                   else col.dtype.type)\n        if col.null is not None:\n            mask = data[col.name] == col.null\n            # Return a MaskedColumn even if no elements are masked so\n            # we roundtrip better.\n            masked = True\n        elif issubclass(coltype, np.inexact):\n            mask = np.isnan(data[col.name])\n        elif issubclass(coltype, np.character):\n            mask = col.array == b''\n\n        if masked or np.any(mask):\n            column = MaskedColumn(data=data[col.name], name=col.name,\n                                  mask=mask, copy=False)\n        else:\n            column = Column(data=data[col.name], name=col.name, copy=False)\n\n        # Copy over units\n        if col.unit is not None:\n            column.unit = u.Unit(col.unit, format='fits', parse_strict=unit_parse_strict)\n\n        # Copy over display format\n        if col.disp is not None:\n            column.format = _fortran_to_python_format(col.disp)\n\n        columns.append(column)\n\n    # Create Table object\n    t = Table(columns, copy=False)\n\n    # TODO: deal properly with unsigned integers\n\n    hdr = table.header\n    if astropy_native:\n        # Avoid circular imports, and also only import if necessary.\n        from .fitstime import fits_to_time\n        hdr = fits_to_time(hdr, t)\n\n    for key, value, comment in hdr.cards:\n\n        if key in ['COMMENT', 'HISTORY']:\n            # Convert to io.ascii format\n            if key == 'COMMENT':\n                key = 'comments'\n\n            if key in t.meta:\n                t.meta[key].append(value)\n            else:\n                t.meta[key] = [value]\n\n        elif key in t.meta:  # key is duplicate\n\n            if isinstance(t.meta[key], list):\n                t.meta[key].append(value)\n            else:\n                t.meta[key] = [t.meta[key], value]\n\n        elif is_column_keyword(key) or key in REMOVE_KEYWORDS:\n\n            pass\n\n        else:\n\n            t.meta[key] = value\n\n    # TODO: implement masking\n\n    # Decode any mixin columns that have been stored as standard Columns.\n    t = _decode_mixins(t)\n\n    return t"},{"col":4,"comment":"null","endLoc":75,"header":"@classmethod\n    def reserve_blocks(cls, data, ctx)","id":3342,"name":"reserve_blocks","nodeType":"Function","startLoc":71,"text":"@classmethod\n    def reserve_blocks(cls, data, ctx):\n        for hdu in data:\n            if hdu.data is not None:\n                yield ctx.blocks.find_or_create_block_for_array(hdu.data, ctx)"},{"attributeType":"null","col":4,"comment":"null","endLoc":12,"id":3343,"name":"name","nodeType":"Attribute","startLoc":12,"text":"name"},{"col":4,"comment":"null","endLoc":82,"header":"@classmethod\n    def assert_equal(cls, old, new)","id":3344,"name":"assert_equal","nodeType":"Function","startLoc":77,"text":"@classmethod\n    def assert_equal(cls, old, new):\n        for hdua, hdub in zip(old, new):\n            assert_array_equal(hdua.data, hdub.data)\n            for carda, cardb in zip(hdua.header.cards, hdub.header.cards):\n                assert tuple(carda) == tuple(cardb)"},{"attributeType":"null","col":4,"comment":"null","endLoc":13,"id":3345,"name":"types","nodeType":"Attribute","startLoc":13,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":14,"id":3346,"name":"requires","nodeType":"Attribute","startLoc":14,"text":"requires"},{"attributeType":"null","col":4,"comment":"null","endLoc":13,"id":3347,"name":"name","nodeType":"Attribute","startLoc":13,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":14,"id":3348,"name":"types","nodeType":"Attribute","startLoc":14,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":15,"id":3349,"name":"version","nodeType":"Attribute","startLoc":15,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":15,"id":3350,"name":"requires","nodeType":"Attribute","startLoc":15,"text":"requires"},{"className":"AstropyFitsType","col":0,"comment":"\n    This class implements ASDF serialization/deserialization that corresponds\n    to the FITS schema defined by Astropy. It will be used by default when\n    writing new HDUs to ASDF files.\n    ","endLoc":90,"id":3351,"nodeType":"Class","startLoc":85,"text":"class AstropyFitsType(FitsType, AstropyType):\n    \"\"\"\n    This class implements ASDF serialization/deserialization that corresponds\n    to the FITS schema defined by Astropy. It will be used by default when\n    writing new HDUs to ASDF files.\n    \"\"\""},{"className":"AsdfFitsType","col":0,"comment":"\n    This class implements ASDF serialization/deserialization that corresponds\n    to the FITS schema defined by the ASDF Standard. It will not be used by\n    default, except when reading files that use the ASDF Standard definition\n    rather than the one defined in Astropy. It will primarily be used for\n    backwards compatibility for reading older files. In the unlikely case that\n    another ASDF implementation uses the FITS schema from the ASDF Standard,\n    this tag could also be used to read a file it generated.\n    ","endLoc":102,"id":3352,"nodeType":"Class","startLoc":93,"text":"class AsdfFitsType(FitsType, AstropyAsdfType):\n    \"\"\"\n    This class implements ASDF serialization/deserialization that corresponds\n    to the FITS schema defined by the ASDF Standard. It will not be used by\n    default, except when reading files that use the ASDF Standard definition\n    rather than the one defined in Astropy. It will primarily be used for\n    backwards compatibility for reading older files. In the unlikely case that\n    another ASDF implementation uses the FITS schema from the ASDF Standard,\n    this tag could also be used to read a file it generated.\n    \"\"\""},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/unit","id":3353,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n"},{"col":4,"comment":"null","endLoc":644,"header":"@classmethod\n    def to_string(cls, unit)","id":3354,"name":"to_string","nodeType":"Function","startLoc":642,"text":"@classmethod\n    def to_string(cls, unit):\n        return _to_string(cls, unit)"},{"id":3355,"name":"astropy/io/misc/asdf/tags/unit/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/unit/tests","id":3356,"nodeType":"File","text":"import pytest\nfrom astropy.io.misc.asdf.tests import ASDF_ENTRY_INSTALLED\n\nif not ASDF_ENTRY_INSTALLED:\n    pytest.skip('The astropy asdf entry points are not installed',\n                allow_module_level=True)\n"},{"col":0,"comment":"","endLoc":1,"header":"__init__.py#<anonymous>","id":3357,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"if not ASDF_ENTRY_INSTALLED:\n    pytest.skip('The astropy asdf entry points are not installed',\n                allow_module_level=True)"},{"id":3358,"name":"astropy/io/misc/asdf/tags/table","nodeType":"Package"},{"fileName":"table.py","filePath":"astropy/io/misc/asdf/tags/table","id":3359,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\nimport numpy as np\n\nfrom asdf.tags.core.ndarray import NDArrayType\n\nfrom astropy import table\nfrom astropy.io.misc.asdf.types import AstropyType, AstropyAsdfType\n\n\nclass TableType:\n    \"\"\"\n    This class defines to_tree and from_tree methods that are used by both the\n    AstropyTableType and the AsdfTableType defined below. The behavior is\n    differentiated by the ``_compat`` class attribute. When ``_compat==True``,\n    the behavior will conform to the table schema defined by the ASDF Standard.\n    Otherwise, the behavior will conform to the custom table schema defined by\n    Astropy.\n    \"\"\"\n    _compat = False\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n\n        # This is getting meta, guys\n        meta = node.get('meta', {})\n\n        # This enables us to support files that use the table definition from\n        # the ASDF Standard, rather than the custom one that Astropy defines.\n        if cls._compat:\n            return table.Table(node['columns'], meta=meta)\n\n        if node.get('qtable', False):\n            t = table.QTable(meta=node.get('meta', {}))\n        else:\n            t = table.Table(meta=node.get('meta', {}))\n\n        for name, col in zip(node['colnames'], node['columns']):\n            t[name] = col\n\n        return t\n\n    @classmethod\n    def to_tree(cls, data, ctx):\n        columns = [data[name] for name in data.colnames]\n\n        node = dict(columns=columns)\n        # Files that use the table definition from the ASDF Standard (instead\n        # of the one defined by Astropy) will not contain these fields\n        if not cls._compat:\n            node['colnames'] = data.colnames\n            node['qtable'] = isinstance(data, table.QTable)\n        if data.meta:\n            node['meta'] = data.meta\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        assert old.meta == new.meta\n        try:\n            NDArrayType.assert_equal(np.array(old), np.array(new))\n        except (AttributeError, TypeError, ValueError):\n            for col0, col1 in zip(old, new):\n                try:\n                    NDArrayType.assert_equal(np.array(col0), np.array(col1))\n                except (AttributeError, TypeError, ValueError):\n                    assert col0 == col1\n\n\nclass AstropyTableType(TableType, AstropyType):\n    \"\"\"\n    This tag class reads and writes tables that conform to the custom schema\n    that is defined by Astropy (in contrast to the one that is defined by the\n    ASDF Standard). The primary reason for differentiating is to enable the\n    support of Astropy mixin columns, which are not supported by the ASDF\n    Standard.\n    \"\"\"\n    name = 'table/table'\n    types = ['astropy.table.Table']\n    requires = ['astropy']\n\n\nclass AsdfTableType(TableType, AstropyAsdfType):\n    \"\"\"\n    This tag class allows Astropy to read (and write) ASDF files that use the\n    table definition that is provided by the ASDF Standard (instead of the\n    custom one defined by Astropy). This is important to maintain for\n    cross-compatibility.\n    \"\"\"\n    name = 'core/table'\n    types = ['astropy.table.Table']\n    requires = ['astropy']\n    _compat = True\n\n\nclass ColumnType(AstropyAsdfType):\n    name = 'core/column'\n    types = ['astropy.table.Column', 'astropy.table.MaskedColumn']\n    requires = ['astropy']\n    handle_dynamic_subclasses = True\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        data = node['data']\n        name = node['name']\n        description = node.get('description')\n        unit = node.get('unit')\n        meta = node.get('meta', None)\n\n        return table.Column(\n            data=data._make_array(), name=name, description=description,\n            unit=unit, meta=meta)\n\n    @classmethod\n    def to_tree(cls, data, ctx):\n        node = {\n            'data': data.data,\n            'name': data.name\n        }\n        if data.description:\n            node['description'] = data.description\n        if data.unit:\n            node['unit'] = data.unit\n        if data.meta:\n            node['meta'] = data.meta\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        assert old.meta == new.meta\n        assert old.description == new.description\n        assert old.unit == new.unit\n\n        NDArrayType.assert_equal(np.array(old), np.array(new))\n"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/table","id":3360,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n"},{"id":3361,"name":"astropy/io/misc/asdf/tags/table/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/table/tests","id":3362,"nodeType":"File","text":"import pytest\nfrom astropy.io.misc.asdf.tests import ASDF_ENTRY_INSTALLED\n\nif not ASDF_ENTRY_INSTALLED:\n    pytest.skip('The astropy asdf entry points are not installed',\n                allow_module_level=True)\n"},{"col":0,"comment":"","endLoc":1,"header":"__init__.py#<anonymous>","id":3363,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"if not ASDF_ENTRY_INSTALLED:\n    pytest.skip('The astropy asdf entry points are not installed',\n                allow_module_level=True)"},{"className":"TableType","col":0,"comment":"\n    This class defines to_tree and from_tree methods that are used by both the\n    AstropyTableType and the AsdfTableType defined below. The behavior is\n    differentiated by the ``_compat`` class attribute. When ``_compat==True``,\n    the behavior will conform to the table schema defined by the ASDF Standard.\n    Otherwise, the behavior will conform to the custom table schema defined by\n    Astropy.\n    ","endLoc":68,"id":3364,"nodeType":"Class","startLoc":11,"text":"class TableType:\n    \"\"\"\n    This class defines to_tree and from_tree methods that are used by both the\n    AstropyTableType and the AsdfTableType defined below. The behavior is\n    differentiated by the ``_compat`` class attribute. When ``_compat==True``,\n    the behavior will conform to the table schema defined by the ASDF Standard.\n    Otherwise, the behavior will conform to the custom table schema defined by\n    Astropy.\n    \"\"\"\n    _compat = False\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n\n        # This is getting meta, guys\n        meta = node.get('meta', {})\n\n        # This enables us to support files that use the table definition from\n        # the ASDF Standard, rather than the custom one that Astropy defines.\n        if cls._compat:\n            return table.Table(node['columns'], meta=meta)\n\n        if node.get('qtable', False):\n            t = table.QTable(meta=node.get('meta', {}))\n        else:\n            t = table.Table(meta=node.get('meta', {}))\n\n        for name, col in zip(node['colnames'], node['columns']):\n            t[name] = col\n\n        return t\n\n    @classmethod\n    def to_tree(cls, data, ctx):\n        columns = [data[name] for name in data.colnames]\n\n        node = dict(columns=columns)\n        # Files that use the table definition from the ASDF Standard (instead\n        # of the one defined by Astropy) will not contain these fields\n        if not cls._compat:\n            node['colnames'] = data.colnames\n            node['qtable'] = isinstance(data, table.QTable)\n        if data.meta:\n            node['meta'] = data.meta\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        assert old.meta == new.meta\n        try:\n            NDArrayType.assert_equal(np.array(old), np.array(new))\n        except (AttributeError, TypeError, ValueError):\n            for col0, col1 in zip(old, new):\n                try:\n                    NDArrayType.assert_equal(np.array(col0), np.array(col1))\n                except (AttributeError, TypeError, ValueError):\n                    assert col0 == col1"},{"col":4,"comment":"null","endLoc":41,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":3365,"name":"from_tree","nodeType":"Function","startLoc":22,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n\n        # This is getting meta, guys\n        meta = node.get('meta', {})\n\n        # This enables us to support files that use the table definition from\n        # the ASDF Standard, rather than the custom one that Astropy defines.\n        if cls._compat:\n            return table.Table(node['columns'], meta=meta)\n\n        if node.get('qtable', False):\n            t = table.QTable(meta=node.get('meta', {}))\n        else:\n            t = table.Table(meta=node.get('meta', {}))\n\n        for name, col in zip(node['colnames'], node['columns']):\n            t[name] = col\n\n        return t"},{"id":3366,"name":"astropy/io/misc/asdf/tags/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/tests","id":3367,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n"},{"fileName":"helpers.py","filePath":"astropy/io/misc/asdf/tags/tests","id":3368,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\nimport numpy as np\n\n\ndef run_schema_example_test(organization, standard, name, version, check_func=None):\n\n    import asdf\n    from asdf.tests import helpers\n    from asdf.types import format_tag\n    from asdf.schema import load_schema\n\n    tag = format_tag(organization, standard, version, name)\n    uri = asdf.extension.default_extensions.extension_list.tag_mapping(tag)\n    r = asdf.extension.get_default_resolver()\n\n    examples = []\n    schema = load_schema(uri, resolver=r)\n    for node in asdf.treeutil.iter_tree(schema):\n        if (isinstance(node, dict) and\n            'examples' in node and\n            isinstance(node['examples'], list)):\n            for desc, example in node['examples']:\n                examples.append(example)\n\n    for example in examples:\n        buff = helpers.yaml_to_asdf('example: ' + example.strip())\n        ff = asdf.AsdfFile(uri=uri)\n        # Add some dummy blocks so that the ndarray examples work\n        for i in range(3):\n            b = asdf.block.Block(np.zeros((1024*1024*8), dtype=np.uint8))\n            b._used = True\n            ff.blocks.add(b)\n        ff._open_impl(ff, buff, mode='r')\n        if check_func:\n            check_func(ff)\n"},{"col":0,"comment":"null","endLoc":36,"header":"def run_schema_example_test(organization, standard, name, version, check_func=None)","id":3369,"name":"run_schema_example_test","nodeType":"Function","startLoc":6,"text":"def run_schema_example_test(organization, standard, name, version, check_func=None):\n\n    import asdf\n    from asdf.tests import helpers\n    from asdf.types import format_tag\n    from asdf.schema import load_schema\n\n    tag = format_tag(organization, standard, version, name)\n    uri = asdf.extension.default_extensions.extension_list.tag_mapping(tag)\n    r = asdf.extension.get_default_resolver()\n\n    examples = []\n    schema = load_schema(uri, resolver=r)\n    for node in asdf.treeutil.iter_tree(schema):\n        if (isinstance(node, dict) and\n            'examples' in node and\n            isinstance(node['examples'], list)):\n            for desc, example in node['examples']:\n                examples.append(example)\n\n    for example in examples:\n        buff = helpers.yaml_to_asdf('example: ' + example.strip())\n        ff = asdf.AsdfFile(uri=uri)\n        # Add some dummy blocks so that the ndarray examples work\n        for i in range(3):\n            b = asdf.block.Block(np.zeros((1024*1024*8), dtype=np.uint8))\n            b._used = True\n            ff.blocks.add(b)\n        ff._open_impl(ff, buff, mode='r')\n        if check_func:\n            check_func(ff)"},{"col":0,"comment":"null","endLoc":53,"header":"def _to_string(cls, unit)","id":3370,"name":"_to_string","nodeType":"Function","startLoc":28,"text":"def _to_string(cls, unit):\n    if isinstance(unit, core.CompositeUnit):\n        parts = []\n\n        if cls._show_scale and unit.scale != 1:\n            parts.append(f'{unit.scale:g}')\n\n        if len(unit.bases):\n            positives, negatives = utils.get_grouped_by_powers(\n                unit.bases, unit.powers)\n            if len(positives):\n                parts.append(cls._format_unit_list(positives))\n            elif len(parts) == 0:\n                parts.append('1')\n\n            if len(negatives):\n                parts.append('/')\n                unit_list = cls._format_unit_list(negatives)\n                if len(negatives) == 1:\n                    parts.append(f'{unit_list}')\n                else:\n                    parts.append(f'({unit_list})')\n\n        return ' '.join(parts)\n    elif isinstance(unit, core.NamedUnit):\n        return cls._get_unit_name(unit)"},{"col":4,"comment":"null","endLoc":131,"header":"@classmethod\n    def assert_equal(cls, old, new)","id":3371,"name":"assert_equal","nodeType":"Function","startLoc":121,"text":"@classmethod\n    def assert_equal(cls, old, new):\n        assert old.format == new.format\n        assert old.scale == new.scale\n        if isinstance(old.location, EarthLocation):\n            assert isinstance(new.location, EarthLocation)\n            _assert_earthlocation_equal(old.location, new.location)\n        else:\n            assert old.location == new.location\n\n        assert_array_equal(old, new)"},{"col":0,"comment":"null","endLoc":31,"header":"def _assert_earthlocation_equal(a, b)","id":3372,"name":"_assert_earthlocation_equal","nodeType":"Function","startLoc":26,"text":"def _assert_earthlocation_equal(a, b):\n    assert_array_equal(a.x, b.x)\n    assert_array_equal(a.y, b.y)\n    assert_array_equal(a.z, b.z)\n    assert_array_equal(a.lat, b.lat)\n    assert_array_equal(a.lon, b.lon)"},{"attributeType":"null","col":4,"comment":"null","endLoc":35,"id":3373,"name":"name","nodeType":"Attribute","startLoc":35,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":36,"id":3374,"name":"version","nodeType":"Attribute","startLoc":36,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":37,"id":3375,"name":"supported_versions","nodeType":"Attribute","startLoc":37,"text":"supported_versions"},{"attributeType":"null","col":4,"comment":"null","endLoc":38,"id":3376,"name":"types","nodeType":"Attribute","startLoc":38,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":39,"id":3377,"name":"requires","nodeType":"Attribute","startLoc":39,"text":"requires"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":3378,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":3379,"name":"_guessable_formats","nodeType":"Attribute","startLoc":17,"text":"_guessable_formats"},{"attributeType":"null","col":16,"comment":"null","endLoc":3,"id":3380,"name":"np","nodeType":"Attribute","startLoc":3,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":3381,"name":"_astropy_format_to_asdf_format","nodeType":"Attribute","startLoc":19,"text":"_astropy_format_to_asdf_format"},{"col":0,"comment":"","endLoc":4,"header":"time.py#<anonymous>","id":3382,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['TimeType']\n\n_guessable_formats = set(['iso', 'byear', 'jyear', 'yday'])\n\n_astropy_format_to_asdf_format = {\n    'isot': 'iso',\n    'byear_str': 'byear',\n    'jyear_str': 'jyear'\n}"},{"id":3383,"name":"astropy/io/misc/asdf/tags/transform","nodeType":"Package"},{"fileName":"math.py","filePath":"astropy/io/misc/asdf/tags/transform","id":3384,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nfrom numpy.testing import assert_array_equal\n\nfrom astropy import modeling\nfrom astropy.modeling.math_functions import __all__ as math_classes\nfrom astropy.modeling.math_functions import *\nfrom astropy.modeling import math_functions\nfrom .basic import TransformType\n\n\n__all__ = ['NpUfuncType']\n\n\nclass NpUfuncType(TransformType):\n    name = \"transform/math_functions\"\n    version = '1.0.0'\n    types = ['astropy.modeling.math_functions.'+ kl for kl in math_classes]\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        klass_name = math_functions._make_class_name(node['func_name'])\n        klass = getattr(math_functions, klass_name)\n        return klass()\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        return {'func_name': model.func.__name__}\n"},{"fileName":"physical_models.py","filePath":"astropy/io/misc/asdf/tags/transform","id":3385,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nfrom numpy.testing import assert_array_equal\n\n\nfrom astropy.modeling import functional_models, physical_models\nfrom .basic import TransformType\nfrom . import _parameter_to_value\n\n\n__all__ = ['BlackBody', 'Drude1DType', 'Plummer1DType']\n\n\nclass BlackBody(TransformType):\n    name = 'transform/blackbody'\n    version = '1.0.0'\n    types = ['astropy.modeling.physical_models.BlackBody']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return physical_models.BlackBody(scale=node['scale'],\n                                         temperature=node['temperature'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'scale': _parameter_to_value(model.scale),\n                'temperature': _parameter_to_value(model.temperature)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, physical_models.BlackBody) and\n                isinstance(b, physical_models.BlackBody))\n        assert_array_equal(a.scale, b.scale)\n        assert_array_equal(a.temperature, b.temperature)\n\n\nclass Drude1DType(TransformType):\n    name = 'transform/drude1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.physical_models.Drude1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return physical_models.Drude1D(amplitude=node['amplitude'],\n                                       x_0=node['x_0'],\n                                       fwhm=node['fwhm'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'fwhm': _parameter_to_value(model.fwhm)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, physical_models.Drude1D) and\n                isinstance(b, physical_models.Drude1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.fwhm, b.fwhm)\n\n\nclass Plummer1DType(TransformType):\n    name = 'transform/plummer1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.physical_models.Plummer1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return physical_models.Plummer1D(mass=node['mass'],\n                                         r_plum=node['r_plum'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'mass': _parameter_to_value(model.mass),\n                'r_plum': _parameter_to_value(model.r_plum)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, physical_models.Plummer1D) and\n                isinstance(b, physical_models.Plummer1D))\n        assert_array_equal(a.mass, b.mass)\n        assert_array_equal(a.r_plum, b.r_plum)\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":74,"id":3386,"name":"__all__","nodeType":"Attribute","startLoc":74,"text":"__all__"},{"col":4,"comment":"null","endLoc":56,"header":"@classmethod\n    def to_tree(cls, data, ctx)","id":3387,"name":"to_tree","nodeType":"Function","startLoc":43,"text":"@classmethod\n    def to_tree(cls, data, ctx):\n        columns = [data[name] for name in data.colnames]\n\n        node = dict(columns=columns)\n        # Files that use the table definition from the ASDF Standard (instead\n        # of the one defined by Astropy) will not contain these fields\n        if not cls._compat:\n            node['colnames'] = data.colnames\n            node['qtable'] = isinstance(data, table.QTable)\n        if data.meta:\n            node['meta'] = data.meta\n\n        return node"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":3388,"name":"HDF5_SIGNATURE","nodeType":"Attribute","startLoc":18,"text":"HDF5_SIGNATURE"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":3389,"name":"META_KEY","nodeType":"Attribute","startLoc":19,"text":"META_KEY"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":3390,"name":"__all__","nodeType":"Attribute","startLoc":21,"text":"__all__"},{"col":0,"comment":"","endLoc":6,"header":"hdf5.py#<anonymous>","id":3391,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis package contains functions for reading and writing HDF5 tables that are\nnot meant to be used directly, but instead are available as readers/writers in\n`astropy.table`. See :ref:`astropy:table_io` for more details.\n\"\"\"\n\nHDF5_SIGNATURE = b'\\x89HDF\\r\\n\\x1a\\n'\n\nMETA_KEY = '__table_column_meta__'\n\n__all__ = ['read_table_hdf5', 'write_table_hdf5']"},{"className":"TransformType","col":0,"comment":"null","endLoc":139,"id":3392,"nodeType":"Class","startLoc":18,"text":"class TransformType(AstropyAsdfType):\n    version = '1.2.0'\n    requires = ['astropy']\n\n    @classmethod\n    def _from_tree_base_transform_members(cls, model, node, ctx):\n        if 'name' in node:\n            model.name = node['name']\n\n        if \"inputs\" in node:\n            model.inputs = tuple(node[\"inputs\"])\n\n        if \"outputs\" in node:\n            model.outputs = tuple(node[\"outputs\"])\n\n        if 'bounding_box' in node:\n            model.bounding_box = node['bounding_box']\n\n        elif 'selector_args' in node:\n            cbbox_keys = [tuple(key) for key in node['cbbox_keys']]\n            bbox_dict = dict(zip(cbbox_keys, node['cbbox_values']))\n\n            selector_args = node['selector_args']\n            model.bounding_box = CompoundBoundingBox.validate(model, bbox_dict, selector_args)\n\n        param_and_model_constraints = {}\n        for constraint in ['fixed', 'bounds']:\n            if constraint in node:\n                param_and_model_constraints[constraint] = node[constraint]\n        model._initialize_constraints(param_and_model_constraints)\n\n        if \"input_units_equivalencies\" in node:\n            # this still writes eqs. for compound, but operates on each sub model\n            if not isinstance(model, CompoundModel):\n                model.input_units_equivalencies = node['input_units_equivalencies']\n\n        yield model\n\n        if 'inverse' in node:\n            model.inverse = node['inverse']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        raise NotImplementedError(\n            \"Must be implemented in TransformType subclasses\")\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        model = cls.from_tree_transform(node, ctx)\n        return cls._from_tree_base_transform_members(model, node, ctx)\n\n    @classmethod\n    def _to_tree_base_transform_members(cls, model, node, ctx):\n        if getattr(model, '_user_inverse', None) is not None:\n            node['inverse'] = model._user_inverse\n\n        if model.name is not None:\n            node['name'] = model.name\n\n        node['inputs'] = list(model.inputs)\n        node['outputs'] = list(model.outputs)\n\n        try:\n            bb = model.bounding_box\n        except NotImplementedError:\n            bb = None\n\n        if isinstance(bb, ModelBoundingBox):\n            bb = bb.bounding_box(order='C')\n\n            if model.n_inputs == 1:\n                bb = list(bb)\n            else:\n                bb = [list(item) for item in bb]\n            node['bounding_box'] = bb\n\n        elif isinstance(bb, CompoundBoundingBox):\n            selector_args = [[sa.index, sa.ignore] for sa in bb.selector_args]\n            node['selector_args'] = selector_args\n            node['cbbox_keys'] = list(bb.bounding_boxes.keys())\n\n            bounding_boxes = list(bb.bounding_boxes.values())\n            if len(model.inputs) - len(selector_args) == 1:\n                node['cbbox_values'] = [list(sbbox.bounding_box()) for sbbox in bounding_boxes]\n            else:\n                node['cbbox_values'] = [[list(item) for item in sbbox.bounding_box()\n                                         if np.isfinite(item[0])] for sbbox in bounding_boxes]\n\n        # model / parameter constraints\n        if not isinstance(model, CompoundModel):\n            fixed_nondefaults = {k: f for k, f in model.fixed.items() if f}\n            if fixed_nondefaults:\n                node['fixed'] = fixed_nondefaults\n            bounds_nondefaults = {k: b for k, b in model.bounds.items() if any(b)}\n            if bounds_nondefaults:\n                node['bounds'] = bounds_nondefaults\n\n        if not isinstance(model, CompoundModel):\n            if model.input_units_equivalencies:\n                node['input_units_equivalencies'] = model.input_units_equivalencies\n\n        return node\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        raise NotImplementedError(\"Must be implemented in TransformType subclasses\")\n\n    @classmethod\n    def to_tree(cls, model, ctx):\n        node = cls.to_tree_transform(model, ctx)\n        return cls._to_tree_base_transform_members(model, node, ctx)\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        assert a.name == b.name\n        # TODO: Assert inverses are the same\n        # assert the bounding_boxes are the same\n        assert a.get_bounding_box() == b.get_bounding_box()\n        assert a.inputs == b.inputs\n        assert a.outputs == b.outputs\n        assert a.input_units_equivalencies == b.input_units_equivalencies"},{"col":4,"comment":"null","endLoc":68,"header":"@classmethod\n    def assert_equal(cls, old, new)","id":3393,"name":"assert_equal","nodeType":"Function","startLoc":58,"text":"@classmethod\n    def assert_equal(cls, old, new):\n        assert old.meta == new.meta\n        try:\n            NDArrayType.assert_equal(np.array(old), np.array(new))\n        except (AttributeError, TypeError, ValueError):\n            for col0, col1 in zip(old, new):\n                try:\n                    NDArrayType.assert_equal(np.array(col0), np.array(col1))\n                except (AttributeError, TypeError, ValueError):\n                    assert col0 == col1"},{"fileName":"powerlaws.py","filePath":"astropy/io/misc/asdf/tags/transform","id":3395,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nfrom numpy.testing import assert_array_equal\n\nfrom astropy.modeling import powerlaws\nfrom .basic import TransformType\nfrom . import _parameter_to_value\n\n\n__all__ = ['PowerLaw1DType', 'BrokenPowerLaw1DType',\n           'SmoothlyBrokenPowerLaw1DType', 'ExponentialCutoffPowerLaw1DType',\n           'LogParabola1DType']\n\n\nclass PowerLaw1DType(TransformType):\n    name = 'transform/power_law1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.powerlaws.PowerLaw1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return powerlaws.PowerLaw1D(amplitude=node['amplitude'],\n                                    x_0=node['x_0'],\n                                    alpha=node['alpha'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'alpha': _parameter_to_value(model.alpha)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, powerlaws.PowerLaw1D) and\n                isinstance(b, powerlaws.PowerLaw1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.alpha, b.alpha)\n\n\nclass BrokenPowerLaw1DType(TransformType):\n    name = 'transform/broken_power_law1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.powerlaws.BrokenPowerLaw1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return powerlaws.BrokenPowerLaw1D(amplitude=node['amplitude'],\n                                          x_break=node['x_break'],\n                                          alpha_1=node['alpha_1'],\n                                          alpha_2=node['alpha_2'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_break': _parameter_to_value(model.x_break),\n                'alpha_1': _parameter_to_value(model.alpha_1),\n                'alpha_2': _parameter_to_value(model.alpha_2)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, powerlaws.BrokenPowerLaw1D) and\n                isinstance(b, powerlaws.BrokenPowerLaw1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_break, b.x_break)\n        assert_array_equal(a.alpha_1, b.alpha_1)\n        assert_array_equal(a.alpha_2, b.alpha_2)\n\n\nclass SmoothlyBrokenPowerLaw1DType(TransformType):\n    name = 'transform/smoothly_broken_power_law1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.powerlaws.SmoothlyBrokenPowerLaw1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return powerlaws.SmoothlyBrokenPowerLaw1D(amplitude=node['amplitude'],\n                                                  x_break=node['x_break'],\n                                                  alpha_1=node['alpha_1'],\n                                                  alpha_2=node['alpha_2'],\n                                                  delta=node['delta'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_break': _parameter_to_value(model.x_break),\n                'alpha_1': _parameter_to_value(model.alpha_1),\n                'alpha_2': _parameter_to_value(model.alpha_2),\n                'delta': _parameter_to_value(model.delta)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, powerlaws.SmoothlyBrokenPowerLaw1D) and\n                isinstance(b, powerlaws.SmoothlyBrokenPowerLaw1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_break, b.x_break)\n        assert_array_equal(a.alpha_1, b.alpha_1)\n        assert_array_equal(a.alpha_2, b.alpha_2)\n        assert_array_equal(a.delta, b.delta)\n\n\nclass ExponentialCutoffPowerLaw1DType(TransformType):\n    name = 'transform/exponential_cutoff_power_law1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.powerlaws.ExponentialCutoffPowerLaw1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return powerlaws.ExponentialCutoffPowerLaw1D(amplitude=node['amplitude'],\n                                                     x_0=node['x_0'],\n                                                     alpha=node['alpha'],\n                                                     x_cutoff=node['x_cutoff'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'alpha': _parameter_to_value(model.alpha),\n                'x_cutoff': _parameter_to_value(model.x_cutoff)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, powerlaws.ExponentialCutoffPowerLaw1D) and\n                isinstance(b, powerlaws.ExponentialCutoffPowerLaw1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.alpha, b.alpha)\n        assert_array_equal(a.x_cutoff, b.x_cutoff)\n\n\nclass LogParabola1DType(TransformType):\n    name = 'transform/log_parabola1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.powerlaws.LogParabola1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return powerlaws.LogParabola1D(amplitude=node['amplitude'],\n                                       x_0=node['x_0'],\n                                       alpha=node['alpha'],\n                                       beta=node['beta'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'alpha': _parameter_to_value(model.alpha),\n                'beta': _parameter_to_value(model.beta)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, powerlaws.LogParabola1D) and\n                isinstance(b, powerlaws.LogParabola1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.alpha, b.alpha)\n        assert_array_equal(a.beta, b.beta)\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":20,"id":3396,"name":"_compat","nodeType":"Attribute","startLoc":20,"text":"_compat"},{"className":"AstropyTableType","col":0,"comment":"\n    This tag class reads and writes tables that conform to the custom schema\n    that is defined by Astropy (in contrast to the one that is defined by the\n    ASDF Standard). The primary reason for differentiating is to enable the\n    support of Astropy mixin columns, which are not supported by the ASDF\n    Standard.\n    ","endLoc":81,"id":3397,"nodeType":"Class","startLoc":71,"text":"class AstropyTableType(TableType, AstropyType):\n    \"\"\"\n    This tag class reads and writes tables that conform to the custom schema\n    that is defined by Astropy (in contrast to the one that is defined by the\n    ASDF Standard). The primary reason for differentiating is to enable the\n    support of Astropy mixin columns, which are not supported by the ASDF\n    Standard.\n    \"\"\"\n    name = 'table/table'\n    types = ['astropy.table.Table']\n    requires = ['astropy']"},{"attributeType":"null","col":4,"comment":"null","endLoc":79,"id":3398,"name":"name","nodeType":"Attribute","startLoc":79,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":80,"id":3399,"name":"types","nodeType":"Attribute","startLoc":80,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":81,"id":3400,"name":"requires","nodeType":"Attribute","startLoc":81,"text":"requires"},{"className":"AsdfTableType","col":0,"comment":"\n    This tag class allows Astropy to read (and write) ASDF files that use the\n    table definition that is provided by the ASDF Standard (instead of the\n    custom one defined by Astropy). This is important to maintain for\n    cross-compatibility.\n    ","endLoc":94,"id":3401,"nodeType":"Class","startLoc":84,"text":"class AsdfTableType(TableType, AstropyAsdfType):\n    \"\"\"\n    This tag class allows Astropy to read (and write) ASDF files that use the\n    table definition that is provided by the ASDF Standard (instead of the\n    custom one defined by Astropy). This is important to maintain for\n    cross-compatibility.\n    \"\"\"\n    name = 'core/table'\n    types = ['astropy.table.Table']\n    requires = ['astropy']\n    _compat = True"},{"attributeType":"null","col":4,"comment":"null","endLoc":91,"id":3402,"name":"name","nodeType":"Attribute","startLoc":91,"text":"name"},{"col":0,"comment":"null","endLoc":11,"header":"def _parameter_to_value(param)","id":3403,"name":"_parameter_to_value","nodeType":"Function","startLoc":7,"text":"def _parameter_to_value(param):\n    if param.unit is not None:\n        return u.Quantity(param)\n    else:\n        return param.value"},{"attributeType":"null","col":4,"comment":"null","endLoc":92,"id":3404,"name":"types","nodeType":"Attribute","startLoc":92,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":93,"id":3405,"name":"requires","nodeType":"Attribute","startLoc":93,"text":"requires"},{"attributeType":"null","col":4,"comment":"null","endLoc":94,"id":3406,"name":"_compat","nodeType":"Attribute","startLoc":94,"text":"_compat"},{"className":"ColumnType","col":0,"comment":"null","endLoc":136,"id":3407,"nodeType":"Class","startLoc":97,"text":"class ColumnType(AstropyAsdfType):\n    name = 'core/column'\n    types = ['astropy.table.Column', 'astropy.table.MaskedColumn']\n    requires = ['astropy']\n    handle_dynamic_subclasses = True\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        data = node['data']\n        name = node['name']\n        description = node.get('description')\n        unit = node.get('unit')\n        meta = node.get('meta', None)\n\n        return table.Column(\n            data=data._make_array(), name=name, description=description,\n            unit=unit, meta=meta)\n\n    @classmethod\n    def to_tree(cls, data, ctx):\n        node = {\n            'data': data.data,\n            'name': data.name\n        }\n        if data.description:\n            node['description'] = data.description\n        if data.unit:\n            node['unit'] = data.unit\n        if data.meta:\n            node['meta'] = data.meta\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        assert old.meta == new.meta\n        assert old.description == new.description\n        assert old.unit == new.unit\n\n        NDArrayType.assert_equal(np.array(old), np.array(new))"},{"col":4,"comment":"null","endLoc":113,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":3408,"name":"from_tree","nodeType":"Function","startLoc":103,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        data = node['data']\n        name = node['name']\n        description = node.get('description')\n        unit = node.get('unit')\n        meta = node.get('meta', None)\n\n        return table.Column(\n            data=data._make_array(), name=name, description=description,\n            unit=unit, meta=meta)"},{"col":4,"comment":"Return string representation for unit","endLoc":659,"header":"def __str__(self)","id":3409,"name":"__str__","nodeType":"Function","startLoc":657,"text":"def __str__(self):\n        \"\"\"Return string representation for unit\"\"\"\n        return unit_format.Generic.to_string(self)"},{"col":4,"comment":"null","endLoc":57,"header":"@classmethod\n    def _from_tree_base_transform_members(cls, model, node, ctx)","id":3410,"name":"_from_tree_base_transform_members","nodeType":"Function","startLoc":22,"text":"@classmethod\n    def _from_tree_base_transform_members(cls, model, node, ctx):\n        if 'name' in node:\n            model.name = node['name']\n\n        if \"inputs\" in node:\n            model.inputs = tuple(node[\"inputs\"])\n\n        if \"outputs\" in node:\n            model.outputs = tuple(node[\"outputs\"])\n\n        if 'bounding_box' in node:\n            model.bounding_box = node['bounding_box']\n\n        elif 'selector_args' in node:\n            cbbox_keys = [tuple(key) for key in node['cbbox_keys']]\n            bbox_dict = dict(zip(cbbox_keys, node['cbbox_values']))\n\n            selector_args = node['selector_args']\n            model.bounding_box = CompoundBoundingBox.validate(model, bbox_dict, selector_args)\n\n        param_and_model_constraints = {}\n        for constraint in ['fixed', 'bounds']:\n            if constraint in node:\n                param_and_model_constraints[constraint] = node[constraint]\n        model._initialize_constraints(param_and_model_constraints)\n\n        if \"input_units_equivalencies\" in node:\n            # this still writes eqs. for compound, but operates on each sub model\n            if not isinstance(model, CompoundModel):\n                model.input_units_equivalencies = node['input_units_equivalencies']\n\n        yield model\n\n        if 'inverse' in node:\n            model.inverse = node['inverse']"},{"col":4,"comment":"null","endLoc":664,"header":"def __repr__(self)","id":3412,"name":"__repr__","nodeType":"Function","startLoc":661,"text":"def __repr__(self):\n        string = unit_format.Generic.to_string(self)\n\n        return f'Unit(\"{string}\")'"},{"col":4,"comment":"\n        Returns an identifier that uniquely identifies the physical\n        type of this unit.  It is comprised of the bases and powers of\n        this unit, without the scale.  Since it is hashable, it is\n        useful as a dictionary key.\n        ","endLoc":678,"header":"def _get_physical_type_id(self)","id":3413,"name":"_get_physical_type_id","nodeType":"Function","startLoc":666,"text":"def _get_physical_type_id(self):\n        \"\"\"\n        Returns an identifier that uniquely identifies the physical\n        type of this unit.  It is comprised of the bases and powers of\n        this unit, without the scale.  Since it is hashable, it is\n        useful as a dictionary key.\n        \"\"\"\n        unit = self.decompose()\n        r = zip([x.name for x in unit.bases], unit.powers)\n        # bases and powers are already sorted in a unique way\n        # r.sort()\n        r = tuple(r)\n        return r"},{"col":4,"comment":"\n        Return a unit object composed of only irreducible units.\n\n        Parameters\n        ----------\n        bases : sequence of UnitBase, optional\n            The bases to decompose into.  When not provided,\n            decomposes down to any irreducible units.  When provided,\n            the decomposed result will only contain the given units.\n            This will raises a `UnitsError` if it's not possible\n            to do so.\n\n        Returns\n        -------\n        unit : `~astropy.units.CompositeUnit`\n            New object containing only irreducible unit objects.\n        ","endLoc":1159,"header":"def decompose(self, bases=set())","id":3414,"name":"decompose","nodeType":"Function","startLoc":1141,"text":"def decompose(self, bases=set()):\n        \"\"\"\n        Return a unit object composed of only irreducible units.\n\n        Parameters\n        ----------\n        bases : sequence of UnitBase, optional\n            The bases to decompose into.  When not provided,\n            decomposes down to any irreducible units.  When provided,\n            the decomposed result will only contain the given units.\n            This will raises a `UnitsError` if it's not possible\n            to do so.\n\n        Returns\n        -------\n        unit : `~astropy.units.CompositeUnit`\n            New object containing only irreducible unit objects.\n        \"\"\"\n        raise NotImplementedError()"},{"col":4,"comment":"\n        Returns all of the names associated with this unit.\n        ","endLoc":687,"header":"@property\n    def names(self)","id":3415,"name":"names","nodeType":"Function","startLoc":680,"text":"@property\n    def names(self):\n        \"\"\"\n        Returns all of the names associated with this unit.\n        \"\"\"\n        raise AttributeError(\n            \"Can not get names from unnamed units. \"\n            \"Perhaps you meant to_string()?\")"},{"col":4,"comment":"\n        Returns the canonical (short) name associated with this unit.\n        ","endLoc":696,"header":"@property\n    def name(self)","id":3417,"name":"name","nodeType":"Function","startLoc":689,"text":"@property\n    def name(self):\n        \"\"\"\n        Returns the canonical (short) name associated with this unit.\n        \"\"\"\n        raise AttributeError(\n            \"Can not get names from unnamed units. \"\n            \"Perhaps you meant to_string()?\")"},{"col":4,"comment":"\n        Returns the alias (long) names for this unit.\n        ","endLoc":705,"header":"@property\n    def aliases(self)","id":3418,"name":"aliases","nodeType":"Function","startLoc":698,"text":"@property\n    def aliases(self):\n        \"\"\"\n        Returns the alias (long) names for this unit.\n        \"\"\"\n        raise AttributeError(\n            \"Can not get aliases from unnamed units. \"\n            \"Perhaps you meant to_string()?\")"},{"col":4,"comment":"\n        Return the scale of the unit.\n        ","endLoc":712,"header":"@property\n    def scale(self)","id":3419,"name":"scale","nodeType":"Function","startLoc":707,"text":"@property\n    def scale(self):\n        \"\"\"\n        Return the scale of the unit.\n        \"\"\"\n        return 1.0"},{"col":4,"comment":"\n        Return the bases of the unit.\n        ","endLoc":719,"header":"@property\n    def bases(self)","id":3420,"name":"bases","nodeType":"Function","startLoc":714,"text":"@property\n    def bases(self):\n        \"\"\"\n        Return the bases of the unit.\n        \"\"\"\n        return [self]"},{"col":4,"comment":"\n        Return the powers of the unit.\n        ","endLoc":726,"header":"@property\n    def powers(self)","id":3421,"name":"powers","nodeType":"Function","startLoc":721,"text":"@property\n    def powers(self):\n        \"\"\"\n        Return the powers of the unit.\n        \"\"\"\n        return [1]"},{"col":4,"comment":"\n        Output the unit in the given format as a string.\n\n        Parameters\n        ----------\n        format : `astropy.units.format.Base` instance or str\n            The name of a format or a formatter object.  If not\n            provided, defaults to the generic format.\n        ","endLoc":740,"header":"def to_string(self, format=unit_format.Generic)","id":3422,"name":"to_string","nodeType":"Function","startLoc":728,"text":"def to_string(self, format=unit_format.Generic):\n        \"\"\"\n        Output the unit in the given format as a string.\n\n        Parameters\n        ----------\n        format : `astropy.units.format.Base` instance or str\n            The name of a format or a formatter object.  If not\n            provided, defaults to the generic format.\n        \"\"\"\n\n        f = unit_format.get_format(format)\n        return f.to_string(self)"},{"col":4,"comment":"Try to format units using a formatter.","endLoc":747,"header":"def __format__(self, format_spec)","id":3423,"name":"__format__","nodeType":"Function","startLoc":742,"text":"def __format__(self, format_spec):\n        \"\"\"Try to format units using a formatter.\"\"\"\n        try:\n            return self.to_string(format=format_spec)\n        except ValueError:\n            return format(str(self), format_spec)"},{"col":4,"comment":"\n        Construct a valid compound bounding box for a model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The model for which this will be a bounding_box\n        bounding_box : dict\n            Dictionary of possible bounding_box respresentations\n        selector_args : optional\n            Description of the selector arguments\n        create_selector : optional, callable\n            Method for generating new selectors\n        order : optional, str\n            The order that a tuple representation will be assumed to be\n                Default: 'C'\n        ","endLoc":1420,"header":"@classmethod\n    def validate(cls, model, bounding_box: dict, selector_args=None, create_selector=None,\n                 ignored: list = None, order: str = 'C', _preserve_ignore: bool = False, **kwarg)","id":3424,"name":"validate","nodeType":"Function","startLoc":1386,"text":"@classmethod\n    def validate(cls, model, bounding_box: dict, selector_args=None, create_selector=None,\n                 ignored: list = None, order: str = 'C', _preserve_ignore: bool = False, **kwarg):\n        \"\"\"\n        Construct a valid compound bounding box for a model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The model for which this will be a bounding_box\n        bounding_box : dict\n            Dictionary of possible bounding_box respresentations\n        selector_args : optional\n            Description of the selector arguments\n        create_selector : optional, callable\n            Method for generating new selectors\n        order : optional, str\n            The order that a tuple representation will be assumed to be\n                Default: 'C'\n        \"\"\"\n        if isinstance(bounding_box, CompoundBoundingBox):\n            if selector_args is None:\n                selector_args = bounding_box.selector_args\n            if create_selector is None:\n                create_selector = bounding_box.create_selector\n            order = bounding_box.order\n            if _preserve_ignore:\n                ignored = bounding_box.ignored\n            bounding_box = bounding_box.bounding_boxes\n\n        if selector_args is None:\n            raise ValueError(\"Selector arguments must be provided (can be passed as part of bounding_box argument)!\")\n\n        return cls(bounding_box, model, selector_args,\n                   create_selector=create_selector, ignored=ignored, order=order)"},{"col":4,"comment":"null","endLoc":778,"header":"def __pow__(self, p)","id":3425,"name":"__pow__","nodeType":"Function","startLoc":776,"text":"def __pow__(self, p):\n        p = validate_power(p)\n        return CompositeUnit(1, [self], [p], _error_check=False)"},{"className":"PowerLaw1DType","col":0,"comment":"null","endLoc":42,"id":3426,"nodeType":"Class","startLoc":16,"text":"class PowerLaw1DType(TransformType):\n    name = 'transform/power_law1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.powerlaws.PowerLaw1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return powerlaws.PowerLaw1D(amplitude=node['amplitude'],\n                                    x_0=node['x_0'],\n                                    alpha=node['alpha'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'alpha': _parameter_to_value(model.alpha)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, powerlaws.PowerLaw1D) and\n                isinstance(b, powerlaws.PowerLaw1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.alpha, b.alpha)"},{"col":4,"comment":"null","endLoc":25,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3427,"name":"from_tree_transform","nodeType":"Function","startLoc":21,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return powerlaws.PowerLaw1D(amplitude=node['amplitude'],\n                                    x_0=node['x_0'],\n                                    alpha=node['alpha'])"},{"col":4,"comment":"null","endLoc":128,"header":"@classmethod\n    def to_tree(cls, data, ctx)","id":3428,"name":"to_tree","nodeType":"Function","startLoc":115,"text":"@classmethod\n    def to_tree(cls, data, ctx):\n        node = {\n            'data': data.data,\n            'name': data.name\n        }\n        if data.description:\n            node['description'] = data.description\n        if data.unit:\n            node['unit'] = data.unit\n        if data.meta:\n            node['meta'] = data.meta\n\n        return node"},{"col":4,"comment":"null","endLoc":136,"header":"@classmethod\n    def assert_equal(cls, old, new)","id":3429,"name":"assert_equal","nodeType":"Function","startLoc":130,"text":"@classmethod\n    def assert_equal(cls, old, new):\n        assert old.meta == new.meta\n        assert old.description == new.description\n        assert old.unit == new.unit\n\n        NDArrayType.assert_equal(np.array(old), np.array(new))"},{"col":4,"comment":"null","endLoc":794,"header":"def __truediv__(self, m)","id":3430,"name":"__truediv__","nodeType":"Function","startLoc":780,"text":"def __truediv__(self, m):\n        if isinstance(m, (bytes, str)):\n            m = Unit(m)\n\n        if isinstance(m, UnitBase):\n            if m.is_unity():\n                return self\n            return CompositeUnit(1, [self, m], [1, -1], _error_check=False)\n\n        try:\n            # Cannot handle this as Unit, re-try as Quantity\n            from .quantity import Quantity\n            return Quantity(1, self) / m\n        except TypeError:\n            return NotImplemented"},{"attributeType":"null","col":4,"comment":"null","endLoc":98,"id":3431,"name":"name","nodeType":"Attribute","startLoc":98,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":99,"id":3432,"name":"types","nodeType":"Attribute","startLoc":99,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":100,"id":3433,"name":"requires","nodeType":"Attribute","startLoc":100,"text":"requires"},{"attributeType":"null","col":4,"comment":"null","endLoc":101,"id":3434,"name":"handle_dynamic_subclasses","nodeType":"Attribute","startLoc":101,"text":"handle_dynamic_subclasses"},{"fileName":"compound.py","filePath":"astropy/io/misc/asdf/tags/transform","id":3435,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\nfrom asdf import tagged\nfrom asdf.tests.helpers import assert_tree_match\nfrom .basic import TransformType\nfrom astropy.modeling.core import Model, CompoundModel\nfrom astropy.modeling.models import Identity, Mapping, Const1D\n\n\n__all__ = ['CompoundType', 'RemapAxesType']\n\n\n_operator_to_tag_mapping = {\n    '+':  'add',\n    '-':  'subtract',\n    '*':  'multiply',\n    '/':  'divide',\n    '**': 'power',\n    '|':  'compose',\n    '&':  'concatenate',\n    'fix_inputs': 'fix_inputs'\n}\n\n\n_tag_to_method_mapping = {\n    'add':         '__add__',\n    'subtract':    '__sub__',\n    'multiply':    '__mul__',\n    'divide':      '__truediv__',\n    'power':       '__pow__',\n    'compose':     '__or__',\n    'concatenate': '__and__',\n    'fix_inputs':  'fix_inputs'\n}\n\n\nclass CompoundType(TransformType):\n    name = ['transform/' + x for x in _tag_to_method_mapping.keys()]\n    types = [CompoundModel]\n    version = '1.2.0'\n    handle_dynamic_subclasses = True\n\n    @classmethod\n    def from_tree_tagged(cls, node, ctx):\n        tag = node._tag[node._tag.rfind('/')+1:]\n        tag = tag[:tag.rfind('-')]\n        oper = _tag_to_method_mapping[tag]\n        left = node['forward'][0]\n        if not isinstance(left, Model):\n            raise TypeError(f\"Unknown model type '{node['forward'][0]._tag}'\")\n        right = node['forward'][1]\n        if (not isinstance(right, Model) and\n                not (oper == 'fix_inputs' and isinstance(right, dict))):\n            raise TypeError(f\"Unknown model type '{node['forward'][1]._tag}'\")\n        if oper == 'fix_inputs':\n            right = dict(zip(right['keys'], right['values']))\n            model = CompoundModel('fix_inputs', left, right)\n        else:\n            model = getattr(left, oper)(right)\n\n        return cls._from_tree_base_transform_members(model, node, ctx)\n\n    @classmethod\n    def to_tree_tagged(cls, model, ctx):\n        left = model.left\n\n        if isinstance(model.right, dict):\n            right = {\n                'keys': list(model.right.keys()),\n                'values': list(model.right.values())\n            }\n        else:\n            right = model.right\n\n        node = {\n            'forward': [left, right]\n        }\n\n        try:\n            tag_name = 'transform/' + _operator_to_tag_mapping[model.op]\n        except KeyError:\n            raise ValueError(f\"Unknown operator '{model.op}'\")\n\n        node = tagged.tag_object(cls.make_yaml_tag(tag_name), node, ctx=ctx)\n\n        return cls._to_tree_base_transform_members(model, node, ctx)\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert_tree_match(a.left, b.left)\n        assert_tree_match(a.right, b.right)\n\n\nclass RemapAxesType(TransformType):\n    name = 'transform/remap_axes'\n    types = [Mapping]\n    version = '1.3.0'\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        mapping = node['mapping']\n        n_inputs = node.get('n_inputs')\n        if all([isinstance(x, int) for x in mapping]):\n            return Mapping(tuple(mapping), n_inputs)\n\n        if n_inputs is None:\n            n_inputs = max([x for x in mapping\n                            if isinstance(x, int)]) + 1\n\n        transform = Identity(n_inputs)\n        new_mapping = []\n        i = n_inputs\n        for entry in mapping:\n            if isinstance(entry, int):\n                new_mapping.append(entry)\n            else:\n                new_mapping.append(i)\n                transform = transform & Const1D(entry.value)\n                i += 1\n        return transform | Mapping(new_mapping)\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'mapping': list(model.mapping)}\n        if model.n_inputs > max(model.mapping) + 1:\n            node['n_inputs'] = model.n_inputs\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        TransformType.assert_equal(a, b)\n        assert a.mapping == b.mapping\n        assert(a.n_inputs == b.n_inputs)\n"},{"className":"Model","col":0,"comment":"\n    Base class for all models.\n\n    This is an abstract class and should not be instantiated directly.\n\n    The following initialization arguments apply to the majority of Model\n    subclasses by default (exceptions include specialized utility models\n    like `~astropy.modeling.mappings.Mapping`).  Parametric models take all\n    their parameters as arguments, followed by any of the following optional\n    keyword arguments:\n\n    Parameters\n    ----------\n    name : str, optional\n        A human-friendly name associated with this model instance\n        (particularly useful for identifying the individual components of a\n        compound model).\n\n    meta : dict, optional\n        An optional dict of user-defined metadata to attach to this model.\n        How this is used and interpreted is up to the user or individual use\n        case.\n\n    n_models : int, optional\n        If given an integer greater than 1, a *model set* is instantiated\n        instead of a single model.  This affects how the parameter arguments\n        are interpreted.  In this case each parameter must be given as a list\n        or array--elements of this array are taken along the first axis (or\n        ``model_set_axis`` if specified), such that the Nth element is the\n        value of that parameter for the Nth model in the set.\n\n        See the section on model sets in the documentation for more details.\n\n    model_set_axis : int, optional\n        This argument only applies when creating a model set (i.e. ``n_models >\n        1``).  It changes how parameter values are interpreted.  Normally the\n        first axis of each input parameter array (properly the 0th axis) is\n        taken as the axis corresponding to the model sets.  However, any axis\n        of an input array may be taken as this \"model set axis\".  This accepts\n        negative integers as well--for example use ``model_set_axis=-1`` if the\n        last (most rapidly changing) axis should be associated with the model\n        sets. Also, ``model_set_axis=False`` can be used to tell that a given\n        input should be used to evaluate all the models in the model set.\n\n    fixed : dict, optional\n        Dictionary ``{parameter_name: bool}`` setting the fixed constraint\n        for one or more parameters.  `True` means the parameter is held fixed\n        during fitting and is prevented from updates once an instance of the\n        model has been created.\n\n        Alternatively the `~astropy.modeling.Parameter.fixed` property of a\n        parameter may be used to lock or unlock individual parameters.\n\n    tied : dict, optional\n        Dictionary ``{parameter_name: callable}`` of parameters which are\n        linked to some other parameter. The dictionary values are callables\n        providing the linking relationship.\n\n        Alternatively the `~astropy.modeling.Parameter.tied` property of a\n        parameter may be used to set the ``tied`` constraint on individual\n        parameters.\n\n    bounds : dict, optional\n        A dictionary ``{parameter_name: value}`` of lower and upper bounds of\n        parameters. Keys are parameter names. Values are a list or a tuple\n        of length 2 giving the desired range for the parameter.\n\n        Alternatively the `~astropy.modeling.Parameter.min` and\n        `~astropy.modeling.Parameter.max` or\n        ~astropy.modeling.Parameter.bounds` properties of a parameter may be\n        used to set bounds on individual parameters.\n\n    eqcons : list, optional\n        List of functions of length n such that ``eqcons[j](x0, *args) == 0.0``\n        in a successfully optimized problem.\n\n    ineqcons : list, optional\n        List of functions of length n such that ``ieqcons[j](x0, *args) >=\n        0.0`` is a successfully optimized problem.\n\n    Examples\n    --------\n    >>> from astropy.modeling import models\n    >>> def tie_center(model):\n    ...         mean = 50 * model.stddev\n    ...         return mean\n    >>> tied_parameters = {'mean': tie_center}\n\n    Specify that ``'mean'`` is a tied parameter in one of two ways:\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3,\n    ...                        tied=tied_parameters)\n\n    or\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3)\n    >>> g1.mean.tied\n    False\n    >>> g1.mean.tied = tie_center\n    >>> g1.mean.tied\n    <function tie_center at 0x...>\n\n    Fixed parameters:\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3,\n    ...                        fixed={'stddev': True})\n    >>> g1.stddev.fixed\n    True\n\n    or\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3)\n    >>> g1.stddev.fixed\n    False\n    >>> g1.stddev.fixed = True\n    >>> g1.stddev.fixed\n    True\n    ","endLoc":2793,"id":3436,"nodeType":"Class","startLoc":501,"text":"class Model(metaclass=_ModelMeta):\n    \"\"\"\n    Base class for all models.\n\n    This is an abstract class and should not be instantiated directly.\n\n    The following initialization arguments apply to the majority of Model\n    subclasses by default (exceptions include specialized utility models\n    like `~astropy.modeling.mappings.Mapping`).  Parametric models take all\n    their parameters as arguments, followed by any of the following optional\n    keyword arguments:\n\n    Parameters\n    ----------\n    name : str, optional\n        A human-friendly name associated with this model instance\n        (particularly useful for identifying the individual components of a\n        compound model).\n\n    meta : dict, optional\n        An optional dict of user-defined metadata to attach to this model.\n        How this is used and interpreted is up to the user or individual use\n        case.\n\n    n_models : int, optional\n        If given an integer greater than 1, a *model set* is instantiated\n        instead of a single model.  This affects how the parameter arguments\n        are interpreted.  In this case each parameter must be given as a list\n        or array--elements of this array are taken along the first axis (or\n        ``model_set_axis`` if specified), such that the Nth element is the\n        value of that parameter for the Nth model in the set.\n\n        See the section on model sets in the documentation for more details.\n\n    model_set_axis : int, optional\n        This argument only applies when creating a model set (i.e. ``n_models >\n        1``).  It changes how parameter values are interpreted.  Normally the\n        first axis of each input parameter array (properly the 0th axis) is\n        taken as the axis corresponding to the model sets.  However, any axis\n        of an input array may be taken as this \"model set axis\".  This accepts\n        negative integers as well--for example use ``model_set_axis=-1`` if the\n        last (most rapidly changing) axis should be associated with the model\n        sets. Also, ``model_set_axis=False`` can be used to tell that a given\n        input should be used to evaluate all the models in the model set.\n\n    fixed : dict, optional\n        Dictionary ``{parameter_name: bool}`` setting the fixed constraint\n        for one or more parameters.  `True` means the parameter is held fixed\n        during fitting and is prevented from updates once an instance of the\n        model has been created.\n\n        Alternatively the `~astropy.modeling.Parameter.fixed` property of a\n        parameter may be used to lock or unlock individual parameters.\n\n    tied : dict, optional\n        Dictionary ``{parameter_name: callable}`` of parameters which are\n        linked to some other parameter. The dictionary values are callables\n        providing the linking relationship.\n\n        Alternatively the `~astropy.modeling.Parameter.tied` property of a\n        parameter may be used to set the ``tied`` constraint on individual\n        parameters.\n\n    bounds : dict, optional\n        A dictionary ``{parameter_name: value}`` of lower and upper bounds of\n        parameters. Keys are parameter names. Values are a list or a tuple\n        of length 2 giving the desired range for the parameter.\n\n        Alternatively the `~astropy.modeling.Parameter.min` and\n        `~astropy.modeling.Parameter.max` or\n        ~astropy.modeling.Parameter.bounds` properties of a parameter may be\n        used to set bounds on individual parameters.\n\n    eqcons : list, optional\n        List of functions of length n such that ``eqcons[j](x0, *args) == 0.0``\n        in a successfully optimized problem.\n\n    ineqcons : list, optional\n        List of functions of length n such that ``ieqcons[j](x0, *args) >=\n        0.0`` is a successfully optimized problem.\n\n    Examples\n    --------\n    >>> from astropy.modeling import models\n    >>> def tie_center(model):\n    ...         mean = 50 * model.stddev\n    ...         return mean\n    >>> tied_parameters = {'mean': tie_center}\n\n    Specify that ``'mean'`` is a tied parameter in one of two ways:\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3,\n    ...                        tied=tied_parameters)\n\n    or\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3)\n    >>> g1.mean.tied\n    False\n    >>> g1.mean.tied = tie_center\n    >>> g1.mean.tied\n    <function tie_center at 0x...>\n\n    Fixed parameters:\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3,\n    ...                        fixed={'stddev': True})\n    >>> g1.stddev.fixed\n    True\n\n    or\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3)\n    >>> g1.stddev.fixed\n    False\n    >>> g1.stddev.fixed = True\n    >>> g1.stddev.fixed\n    True\n    \"\"\"\n\n    parameter_constraints = Parameter.constraints\n    \"\"\"\n    Primarily for informational purposes, these are the types of constraints\n    that can be set on a model's parameters.\n    \"\"\"\n\n    model_constraints = ('eqcons', 'ineqcons')\n    \"\"\"\n    Primarily for informational purposes, these are the types of constraints\n    that constrain model evaluation.\n    \"\"\"\n\n    param_names = ()\n    \"\"\"\n    Names of the parameters that describe models of this type.\n\n    The parameters in this tuple are in the same order they should be passed in\n    when initializing a model of a specific type.  Some types of models, such\n    as polynomial models, have a different number of parameters depending on\n    some other property of the model, such as the degree.\n\n    When defining a custom model class the value of this attribute is\n    automatically set by the `~astropy.modeling.Parameter` attributes defined\n    in the class body.\n    \"\"\"\n\n    n_inputs = 0\n    \"\"\"The number of inputs.\"\"\"\n    n_outputs = 0\n    \"\"\" The number of outputs.\"\"\"\n\n    standard_broadcasting = True\n    fittable = False\n    linear = True\n    _separable = None\n    \"\"\" A boolean flag to indicate whether a model is separable.\"\"\"\n    meta = metadata.MetaData()\n    \"\"\"A dict-like object to store optional information.\"\"\"\n\n    # By default models either use their own inverse property or have no\n    # inverse at all, but users may also assign a custom inverse to a model,\n    # optionally; in that case it is of course up to the user to determine\n    # whether their inverse is *actually* an inverse to the model they assign\n    # it to.\n    _inverse = None\n    _user_inverse = None\n\n    _bounding_box = None\n    _user_bounding_box = None\n\n    _has_inverse_bounding_box = False\n\n    # Default n_models attribute, so that __len__ is still defined even when a\n    # model hasn't completed initialization yet\n    _n_models = 1\n\n    # New classes can set this as a boolean value.\n    # It is converted to a dictionary mapping input name to a boolean value.\n    _input_units_strict = False\n\n    # Allow dimensionless input (and corresponding output). If this is True,\n    # input values to evaluate will gain the units specified in input_units. If\n    # this is a dictionary then it should map input name to a bool to allow\n    # dimensionless numbers for that input.\n    # Only has an effect if input_units is defined.\n    _input_units_allow_dimensionless = False\n\n    # Default equivalencies to apply to input values. If set, this should be a\n    # dictionary where each key is a string that corresponds to one of the\n    # model inputs. Only has an effect if input_units is defined.\n    input_units_equivalencies = None\n\n    # Covariance matrix can be set by fitter if available.\n    # If cov_matrix is available, then std will set as well\n    _cov_matrix = None\n    _stds = None\n\n    def __init_subclass__(cls, **kwargs):\n        super().__init_subclass__()\n\n    def __init__(self, *args, meta=None, name=None, **kwargs):\n        super().__init__()\n        self._default_inputs_outputs()\n        if meta is not None:\n            self.meta = meta\n        self._name = name\n        # add parameters to instance level by walking MRO list\n        mro = self.__class__.__mro__\n        for cls in mro:\n            if issubclass(cls, Model):\n                for parname, val in cls._parameters_.items():\n                    newpar = copy.deepcopy(val)\n                    newpar.model = self\n                    if parname not in self.__dict__:\n                        self.__dict__[parname] = newpar\n\n        self._initialize_constraints(kwargs)\n        kwargs = self._initialize_setters(kwargs)\n        # Remaining keyword args are either parameter values or invalid\n        # Parameter values must be passed in as keyword arguments in order to\n        # distinguish them\n        self._initialize_parameters(args, kwargs)\n        self._initialize_slices()\n        self._initialize_unit_support()\n\n    def _default_inputs_outputs(self):\n        if self.n_inputs == 1 and self.n_outputs == 1:\n            self._inputs = (\"x\",)\n            self._outputs = (\"y\",)\n        elif self.n_inputs == 2 and self.n_outputs == 1:\n            self._inputs = (\"x\", \"y\")\n            self._outputs = (\"z\",)\n        else:\n            try:\n                self._inputs = tuple(\"x\" + str(idx) for idx in range(self.n_inputs))\n                self._outputs = tuple(\"x\" + str(idx) for idx in range(self.n_outputs))\n            except TypeError:\n                # self.n_inputs and self.n_outputs are properties\n                # This is the case when subclasses of Model do not define\n                # ``n_inputs``, ``n_outputs``, ``inputs`` or ``outputs``.\n                self._inputs = ()\n                self._outputs = ()\n\n    def _initialize_setters(self, kwargs):\n        \"\"\"\n        This exists to inject defaults for settable properties for models\n        originating from `custom_model`.\n        \"\"\"\n        if hasattr(self, '_settable_properties'):\n            setters = {name: kwargs.pop(name, default)\n                       for name, default in self._settable_properties.items()}\n            for name, value in setters.items():\n                setattr(self, name, value)\n\n        return kwargs\n\n    @property\n    def inputs(self):\n        return self._inputs\n\n    @inputs.setter\n    def inputs(self, val):\n        if len(val) != self.n_inputs:\n            raise ValueError(f\"Expected {self.n_inputs} number of inputs, got {len(val)}.\")\n        self._inputs = val\n        self._initialize_unit_support()\n\n    @property\n    def outputs(self):\n        return self._outputs\n\n    @outputs.setter\n    def outputs(self, val):\n        if len(val) != self.n_outputs:\n            raise ValueError(f\"Expected {self.n_outputs} number of outputs, got {len(val)}.\")\n        self._outputs = val\n\n    @property\n    def n_inputs(self):\n        # TODO: remove the code in the ``if`` block when support\n        # for models with ``inputs`` as class variables is removed.\n        if hasattr(self.__class__, 'n_inputs') and isinstance(self.__class__.n_inputs, property):\n            try:\n                return len(self.__class__.inputs)\n            except TypeError:\n                try:\n                    return len(self.inputs)\n                except AttributeError:\n                    return 0\n\n        return self.__class__.n_inputs\n\n    @property\n    def n_outputs(self):\n        # TODO: remove the code in the ``if`` block when support\n        # for models with ``outputs`` as class variables is removed.\n        if hasattr(self.__class__, 'n_outputs') and isinstance(self.__class__.n_outputs, property):\n            try:\n                return len(self.__class__.outputs)\n            except TypeError:\n                try:\n                    return len(self.outputs)\n                except AttributeError:\n                    return 0\n\n        return self.__class__.n_outputs\n\n    def _calculate_separability_matrix(self):\n        \"\"\"\n        This is a hook which customises the behavior of modeling.separable.\n\n        This allows complex subclasses to customise the separability matrix.\n        If it returns `NotImplemented` the default behavior is used.\n        \"\"\"\n        return NotImplemented\n\n    def _initialize_unit_support(self):\n        \"\"\"\n        Convert self._input_units_strict and\n        self.input_units_allow_dimensionless to dictionaries\n        mapping input name to a boolean value.\n        \"\"\"\n        if isinstance(self._input_units_strict, bool):\n            self._input_units_strict = {key: self._input_units_strict for\n                                        key in self.inputs}\n\n        if isinstance(self._input_units_allow_dimensionless, bool):\n            self._input_units_allow_dimensionless = {key: self._input_units_allow_dimensionless\n                                                     for key in self.inputs}\n\n    @property\n    def input_units_strict(self):\n        \"\"\"\n        Enforce strict units on inputs to evaluate. If this is set to True,\n        input values to evaluate will be in the exact units specified by\n        input_units. If the input quantities are convertible to input_units,\n        they are converted. If this is a dictionary then it should map input\n        name to a bool to set strict input units for that parameter.\n        \"\"\"\n        val = self._input_units_strict\n        if isinstance(val, bool):\n            return {key: val for key in self.inputs}\n        return dict(zip(self.inputs, val.values()))\n\n    @property\n    def input_units_allow_dimensionless(self):\n        \"\"\"\n        Allow dimensionless input (and corresponding output). If this is True,\n        input values to evaluate will gain the units specified in input_units. If\n        this is a dictionary then it should map input name to a bool to allow\n        dimensionless numbers for that input.\n        Only has an effect if input_units is defined.\n        \"\"\"\n\n        val = self._input_units_allow_dimensionless\n        if isinstance(val, bool):\n            return {key: val for key in self.inputs}\n        return dict(zip(self.inputs, val.values()))\n\n    @property\n    def uses_quantity(self):\n        \"\"\"\n        True if this model has been created with `~astropy.units.Quantity`\n        objects or if there are no parameters.\n\n        This can be used to determine if this model should be evaluated with\n        `~astropy.units.Quantity` or regular floats.\n        \"\"\"\n        pisq = [isinstance(p, Quantity) for p in self._param_sets(units=True)]\n        return (len(pisq) == 0) or any(pisq)\n\n    def __repr__(self):\n        return self._format_repr()\n\n    def __str__(self):\n        return self._format_str()\n\n    def __len__(self):\n        return self._n_models\n\n    @staticmethod\n    def _strip_ones(intup):\n        return tuple(item for item in intup if item != 1)\n\n    def __setattr__(self, attr, value):\n        if isinstance(self, CompoundModel):\n            param_names = self._param_names\n        param_names = self.param_names\n\n        if param_names is not None and attr in self.param_names:\n            param = self.__dict__[attr]\n            value = _tofloat(value)\n            if param._validator is not None:\n                param._validator(self, value)\n            # check consistency with previous shape and size\n            eshape = self._param_metrics[attr]['shape']\n            if eshape == ():\n                eshape = (1,)\n            vshape = np.array(value).shape\n            if vshape == ():\n                vshape = (1,)\n            esize = self._param_metrics[attr]['size']\n            if (np.size(value) != esize or\n                    self._strip_ones(vshape) != self._strip_ones(eshape)):\n                raise InputParameterError(\n                    \"Value for parameter {0} does not match shape or size\\n\"\n                    \"expected by model ({1}, {2}) vs ({3}, {4})\".format(\n                        attr, vshape, np.size(value), eshape, esize))\n            if param.unit is None:\n                if isinstance(value, Quantity):\n                    param._unit = value.unit\n                    param.value = value.value\n                else:\n                    param.value = value\n            else:\n                if not isinstance(value, Quantity):\n                    raise UnitsError(f\"The '{param.name}' parameter should be given as a\"\n                                     \" Quantity because it was originally \"\n                                     \"initialized as a Quantity\")\n                param._unit = value.unit\n                param.value = value.value\n        else:\n            if attr in ['fittable', 'linear']:\n                self.__dict__[attr] = value\n            else:\n                super().__setattr__(attr, value)\n\n    def _pre_evaluate(self, *args, **kwargs):\n        \"\"\"\n        Model specific input setup that needs to occur prior to model evaluation\n        \"\"\"\n\n        # Broadcast inputs into common size\n        inputs, broadcasted_shapes = self.prepare_inputs(*args, **kwargs)\n\n        # Setup actual model evaluation method\n        parameters = self._param_sets(raw=True, units=True)\n\n        def evaluate(_inputs):\n            return self.evaluate(*chain(_inputs, parameters))\n\n        return evaluate, inputs, broadcasted_shapes, kwargs\n\n    def get_bounding_box(self, with_bbox=True):\n        \"\"\"\n        Return the ``bounding_box`` of a model if it exists or ``None``\n        otherwise.\n\n        Parameters\n        ----------\n        with_bbox :\n            The value of the ``with_bounding_box`` keyword argument\n            when calling the model. Default is `True` for usage when\n            looking up the model's ``bounding_box`` without risk of error.\n        \"\"\"\n        bbox = None\n\n        if not isinstance(with_bbox, bool) or with_bbox:\n            try:\n                bbox = self.bounding_box\n            except NotImplementedError:\n                pass\n\n            if isinstance(bbox, CompoundBoundingBox) and not isinstance(with_bbox, bool):\n                bbox = bbox[with_bbox]\n\n        return bbox\n\n    @property\n    def _argnames(self):\n        \"\"\"The inputs used to determine input_shape for bounding_box evaluation\"\"\"\n        return self.inputs\n\n    def _validate_input_shape(self, _input, idx, argnames, model_set_axis, check_model_set_axis):\n        \"\"\"\n        Perform basic validation of a single model input's shape\n            -- it has the minimum dimensions for the given model_set_axis\n\n        Returns the shape of the input if validation succeeds.\n        \"\"\"\n        input_shape = np.shape(_input)\n        # Ensure that the input's model_set_axis matches the model's\n        # n_models\n        if input_shape and check_model_set_axis:\n            # Note: Scalar inputs *only* get a pass on this\n            if len(input_shape) < model_set_axis + 1:\n                raise ValueError(\n                    f\"For model_set_axis={model_set_axis}, all inputs must be at \"\n                    f\"least {model_set_axis + 1}-dimensional.\")\n            if input_shape[model_set_axis] != self._n_models:\n                try:\n                    argname = argnames[idx]\n                except IndexError:\n                    # the case of model.inputs = ()\n                    argname = str(idx)\n\n                raise ValueError(\n                    f\"Input argument '{argname}' does not have the correct \"\n                    f\"dimensions in model_set_axis={model_set_axis} for a model set with \"\n                    f\"n_models={self._n_models}.\")\n\n        return input_shape\n\n    def _validate_input_shapes(self, inputs, argnames, model_set_axis):\n        \"\"\"\n        Perform basic validation of model inputs\n            --that they are mutually broadcastable and that they have\n            the minimum dimensions for the given model_set_axis.\n\n        If validation succeeds, returns the total shape that will result from\n        broadcasting the input arrays with each other.\n        \"\"\"\n\n        check_model_set_axis = self._n_models > 1 and model_set_axis is not False\n\n        all_shapes = []\n        for idx, _input in enumerate(inputs):\n            all_shapes.append(self._validate_input_shape(_input, idx, argnames,\n                                                         model_set_axis, check_model_set_axis))\n\n        input_shape = check_broadcast(*all_shapes)\n        if input_shape is None:\n            raise ValueError(\n                \"All inputs must have identical shapes or must be scalars.\")\n\n        return input_shape\n\n    def input_shape(self, inputs):\n        \"\"\"Get input shape for bounding_box evaluation\"\"\"\n        return self._validate_input_shapes(inputs, self._argnames, self.model_set_axis)\n\n    def _generic_evaluate(self, evaluate, _inputs, fill_value, with_bbox):\n        \"\"\"\n        Generic model evaluation routine\n            Selects and evaluates model with or without bounding_box enforcement\n        \"\"\"\n\n        # Evaluate the model using the prepared evaluation method either\n        #   enforcing the bounding_box or not.\n        bbox = self.get_bounding_box(with_bbox)\n        if (not isinstance(with_bbox, bool) or with_bbox) and bbox is not None:\n            outputs = bbox.evaluate(evaluate, _inputs, fill_value)\n        else:\n            outputs = evaluate(_inputs)\n        return outputs\n\n    def _post_evaluate(self, inputs, outputs, broadcasted_shapes, with_bbox, **kwargs):\n        \"\"\"\n        Model specific post evaluation processing of outputs\n        \"\"\"\n        if self.get_bounding_box(with_bbox) is None and self.n_outputs == 1:\n            outputs = (outputs,)\n\n        outputs = self.prepare_outputs(broadcasted_shapes, *outputs, **kwargs)\n        outputs = self._process_output_units(inputs, outputs)\n\n        if self.n_outputs == 1:\n            return outputs[0]\n        return outputs\n\n    @property\n    def bbox_with_units(self):\n        return (not isinstance(self, CompoundModel))\n\n    def __call__(self, *args, **kwargs):\n        \"\"\"\n        Evaluate this model using the given input(s) and the parameter values\n        that were specified when the model was instantiated.\n        \"\"\"\n        # Turn any keyword arguments into positional arguments.\n        args, kwargs = self._get_renamed_inputs_as_positional(*args, **kwargs)\n\n        # Read model evaluation related parameters\n        with_bbox = kwargs.pop('with_bounding_box', False)\n        fill_value = kwargs.pop('fill_value', np.nan)\n\n        # prepare for model evaluation (overridden in CompoundModel)\n        evaluate, inputs, broadcasted_shapes, kwargs = self._pre_evaluate(*args, **kwargs)\n\n        outputs = self._generic_evaluate(evaluate, inputs,\n                                         fill_value, with_bbox)\n\n        # post-process evaluation results (overridden in CompoundModel)\n        return self._post_evaluate(inputs, outputs, broadcasted_shapes, with_bbox, **kwargs)\n\n    def _get_renamed_inputs_as_positional(self, *args, **kwargs):\n        def _keyword2positional(kwargs):\n            # Inputs were passed as keyword (not positional) arguments.\n            # Because the signature of the ``__call__`` is defined at\n            # the class level, the name of the inputs cannot be changed at\n            # the instance level and the old names are always present in the\n            # signature of the method. In order to use the new names of the\n            # inputs, the old names are taken out of ``kwargs``, the input\n            # values are sorted in the order of self.inputs and passed as\n            # positional arguments to ``__call__``.\n\n            # These are the keys that are always present as keyword arguments.\n            keys = ['model_set_axis', 'with_bounding_box', 'fill_value',\n                    'equivalencies', 'inputs_map']\n\n            new_inputs = {}\n            # kwargs contain the names of the new inputs + ``keys``\n            allkeys = list(kwargs.keys())\n            # Remove the names of the new inputs from kwargs and save them\n            # to a dict ``new_inputs``.\n            for key in allkeys:\n                if key not in keys:\n                    new_inputs[key] = kwargs[key]\n                    del kwargs[key]\n            return new_inputs, kwargs\n        n_args = len(args)\n\n        new_inputs, kwargs = _keyword2positional(kwargs)\n        n_all_args = n_args + len(new_inputs)\n\n        if n_all_args < self.n_inputs:\n            raise ValueError(f\"Missing input arguments - expected {self.n_inputs}, got {n_all_args}\")\n        elif n_all_args > self.n_inputs:\n            raise ValueError(f\"Too many input arguments - expected {self.n_inputs}, got {n_all_args}\")\n        if n_args == 0:\n            # Create positional arguments from the keyword arguments in ``new_inputs``.\n            new_args = []\n            for k in self.inputs:\n                new_args.append(new_inputs[k])\n        elif n_args != self.n_inputs:\n            # Some inputs are passed as positional, others as keyword arguments.\n            args = list(args)\n\n            # Create positional arguments from the keyword arguments in ``new_inputs``.\n            new_args = []\n            for k in self.inputs:\n                if k in new_inputs:\n                    new_args.append(new_inputs[k])\n                else:\n                    new_args.append(args[0])\n                    del args[0]\n        else:\n            new_args = args\n        return new_args, kwargs\n\n    # *** Properties ***\n    @property\n    def name(self):\n        \"\"\"User-provided name for this model instance.\"\"\"\n\n        return self._name\n\n    @name.setter\n    def name(self, val):\n        \"\"\"Assign a (new) name to this model.\"\"\"\n\n        self._name = val\n\n    @property\n    def model_set_axis(self):\n        \"\"\"\n        The index of the model set axis--that is the axis of a parameter array\n        that pertains to which model a parameter value pertains to--as\n        specified when the model was initialized.\n\n        See the documentation on :ref:`astropy:modeling-model-sets`\n        for more details.\n        \"\"\"\n\n        return self._model_set_axis\n\n    @property\n    def param_sets(self):\n        \"\"\"\n        Return parameters as a pset.\n\n        This is a list with one item per parameter set, which is an array of\n        that parameter's values across all parameter sets, with the last axis\n        associated with the parameter set.\n        \"\"\"\n\n        return self._param_sets()\n\n    @property\n    def parameters(self):\n        \"\"\"\n        A flattened array of all parameter values in all parameter sets.\n\n        Fittable parameters maintain this list and fitters modify it.\n        \"\"\"\n\n        # Currently the sequence of a model's parameters must be contiguous\n        # within the _parameters array (which may be a view of a larger array,\n        # for example when taking a sub-expression of a compound model), so\n        # the assumption here is reliable:\n        if not self.param_names:\n            # Trivial, but not unheard of\n            return self._parameters\n\n        self._parameters_to_array()\n        start = self._param_metrics[self.param_names[0]]['slice'].start\n        stop = self._param_metrics[self.param_names[-1]]['slice'].stop\n\n        return self._parameters[start:stop]\n\n    @parameters.setter\n    def parameters(self, value):\n        \"\"\"\n        Assigning to this attribute updates the parameters array rather than\n        replacing it.\n        \"\"\"\n\n        if not self.param_names:\n            return\n\n        start = self._param_metrics[self.param_names[0]]['slice'].start\n        stop = self._param_metrics[self.param_names[-1]]['slice'].stop\n\n        try:\n            value = np.array(value).flatten()\n            self._parameters[start:stop] = value\n        except ValueError as e:\n            raise InputParameterError(\n                \"Input parameter values not compatible with the model \"\n                \"parameters array: {0}\".format(e))\n        self._array_to_parameters()\n\n    @property\n    def sync_constraints(self):\n        '''\n        This is a boolean property that indicates whether or not accessing constraints\n        automatically check the constituent models current values. It defaults to True\n        on creation of a model, but for fitting purposes it should be set to False\n        for performance reasons.\n        '''\n        if not hasattr(self, '_sync_constraints'):\n            self._sync_constraints = True\n        return self._sync_constraints\n\n    @sync_constraints.setter\n    def sync_constraints(self, value):\n        if not isinstance(value, bool):\n            raise ValueError('sync_constraints only accepts True or False as values')\n        self._sync_constraints = value\n\n    @property\n    def fixed(self):\n        \"\"\"\n        A ``dict`` mapping parameter names to their fixed constraint.\n        \"\"\"\n        if not hasattr(self, '_fixed') or self.sync_constraints:\n            self._fixed = _ConstraintsDict(self, 'fixed')\n        return self._fixed\n\n    @property\n    def bounds(self):\n        \"\"\"\n        A ``dict`` mapping parameter names to their upper and lower bounds as\n        ``(min, max)`` tuples or ``[min, max]`` lists.\n        \"\"\"\n        if not hasattr(self, '_bounds') or self.sync_constraints:\n            self._bounds = _ConstraintsDict(self, 'bounds')\n        return self._bounds\n\n    @property\n    def tied(self):\n        \"\"\"\n        A ``dict`` mapping parameter names to their tied constraint.\n        \"\"\"\n        if not hasattr(self, '_tied') or self.sync_constraints:\n            self._tied = _ConstraintsDict(self, 'tied')\n        return self._tied\n\n    @property\n    def eqcons(self):\n        \"\"\"List of parameter equality constraints.\"\"\"\n\n        return self._mconstraints['eqcons']\n\n    @property\n    def ineqcons(self):\n        \"\"\"List of parameter inequality constraints.\"\"\"\n\n        return self._mconstraints['ineqcons']\n\n    def has_inverse(self):\n        \"\"\"\n        Returns True if the model has an analytic or user\n        inverse defined.\n        \"\"\"\n        try:\n            self.inverse\n        except NotImplementedError:\n            return False\n\n        return True\n\n    @property\n    def inverse(self):\n        \"\"\"\n        Returns a new `~astropy.modeling.Model` instance which performs the\n        inverse transform, if an analytic inverse is defined for this model.\n\n        Even on models that don't have an inverse defined, this property can be\n        set with a manually-defined inverse, such a pre-computed or\n        experimentally determined inverse (often given as a\n        `~astropy.modeling.polynomial.PolynomialModel`, but not by\n        requirement).\n\n        A custom inverse can be deleted with ``del model.inverse``.  In this\n        case the model's inverse is reset to its default, if a default exists\n        (otherwise the default is to raise `NotImplementedError`).\n\n        Note to authors of `~astropy.modeling.Model` subclasses:  To define an\n        inverse for a model simply override this property to return the\n        appropriate model representing the inverse.  The machinery that will\n        make the inverse manually-overridable is added automatically by the\n        base class.\n        \"\"\"\n        if self._user_inverse is not None:\n            return self._user_inverse\n        elif self._inverse is not None:\n            result = self._inverse()\n            if result is not NotImplemented:\n                if not self._has_inverse_bounding_box:\n                    result.bounding_box = None\n                return result\n\n        raise NotImplementedError(\"No analytical or user-supplied inverse transform \"\n                                  \"has been implemented for this model.\")\n\n    @inverse.setter\n    def inverse(self, value):\n        if not isinstance(value, (Model, type(None))):\n            raise ValueError(\n                \"The ``inverse`` attribute may be assigned a `Model` \"\n                \"instance or `None` (where `None` explicitly forces the \"\n                \"model to have no inverse.\")\n\n        self._user_inverse = value\n\n    @inverse.deleter\n    def inverse(self):\n        \"\"\"\n        Resets the model's inverse to its default (if one exists, otherwise\n        the model will have no inverse).\n        \"\"\"\n\n        try:\n            del self._user_inverse\n        except AttributeError:\n            pass\n\n    @property\n    def has_user_inverse(self):\n        \"\"\"\n        A flag indicating whether or not a custom inverse model has been\n        assigned to this model by a user, via assignment to ``model.inverse``.\n        \"\"\"\n        return self._user_inverse is not None\n\n    @property\n    def bounding_box(self):\n        r\"\"\"\n        A `tuple` of length `n_inputs` defining the bounding box limits, or\n        raise `NotImplementedError` for no bounding_box.\n\n        The default limits are given by a ``bounding_box`` property or method\n        defined in the class body of a specific model.  If not defined then\n        this property just raises `NotImplementedError` by default (but may be\n        assigned a custom value by a user).  ``bounding_box`` can be set\n        manually to an array-like object of shape ``(model.n_inputs, 2)``. For\n        further usage, see :ref:`astropy:bounding-boxes`\n\n        The limits are ordered according to the `numpy` ``'C'`` indexing\n        convention, and are the reverse of the model input order,\n        e.g. for inputs ``('x', 'y', 'z')``, ``bounding_box`` is defined:\n\n        * for 1D: ``(x_low, x_high)``\n        * for 2D: ``((y_low, y_high), (x_low, x_high))``\n        * for 3D: ``((z_low, z_high), (y_low, y_high), (x_low, x_high))``\n\n        Examples\n        --------\n\n        Setting the ``bounding_box`` limits for a 1D and 2D model:\n\n        >>> from astropy.modeling.models import Gaussian1D, Gaussian2D\n        >>> model_1d = Gaussian1D()\n        >>> model_2d = Gaussian2D(x_stddev=1, y_stddev=1)\n        >>> model_1d.bounding_box = (-5, 5)\n        >>> model_2d.bounding_box = ((-6, 6), (-5, 5))\n\n        Setting the bounding_box limits for a user-defined 3D `custom_model`:\n\n        >>> from astropy.modeling.models import custom_model\n        >>> def const3d(x, y, z, amp=1):\n        ...    return amp\n        ...\n        >>> Const3D = custom_model(const3d)\n        >>> model_3d = Const3D()\n        >>> model_3d.bounding_box = ((-6, 6), (-5, 5), (-4, 4))\n\n        To reset ``bounding_box`` to its default limits just delete the\n        user-defined value--this will reset it back to the default defined\n        on the class:\n\n        >>> del model_1d.bounding_box\n\n        To disable the bounding box entirely (including the default),\n        set ``bounding_box`` to `None`:\n\n        >>> model_1d.bounding_box = None\n        >>> model_1d.bounding_box  # doctest: +IGNORE_EXCEPTION_DETAIL\n        Traceback (most recent call last):\n        NotImplementedError: No bounding box is defined for this model\n        (note: the bounding box was explicitly disabled for this model;\n        use `del model.bounding_box` to restore the default bounding box,\n        if one is defined for this model).\n        \"\"\"\n\n        if self._user_bounding_box is not None:\n            if self._user_bounding_box is NotImplemented:\n                raise NotImplementedError(\n                    \"No bounding box is defined for this model (note: the \"\n                    \"bounding box was explicitly disabled for this model; \"\n                    \"use `del model.bounding_box` to restore the default \"\n                    \"bounding box, if one is defined for this model).\")\n            return self._user_bounding_box\n        elif self._bounding_box is None:\n            raise NotImplementedError(\n                \"No bounding box is defined for this model.\")\n        elif isinstance(self._bounding_box, ModelBoundingBox):\n            # This typically implies a hard-coded bounding box.  This will\n            # probably be rare, but it is an option\n            return self._bounding_box\n        elif isinstance(self._bounding_box, types.MethodType):\n            return ModelBoundingBox.validate(self, self._bounding_box())\n        else:\n            # The only other allowed possibility is that it's a ModelBoundingBox\n            # subclass, so we call it with its default arguments and return an\n            # instance of it (that can be called to recompute the bounding box\n            # with any optional parameters)\n            # (In other words, in this case self._bounding_box is a *class*)\n            bounding_box = self._bounding_box((), model=self)()\n            return self._bounding_box(bounding_box, model=self)\n\n    @bounding_box.setter\n    def bounding_box(self, bounding_box):\n        \"\"\"\n        Assigns the bounding box limits.\n        \"\"\"\n\n        if bounding_box is None:\n            cls = None\n            # We use this to explicitly set an unimplemented bounding box (as\n            # opposed to no user bounding box defined)\n            bounding_box = NotImplemented\n        elif (isinstance(bounding_box, CompoundBoundingBox) or\n              isinstance(bounding_box, dict)):\n            cls = CompoundBoundingBox\n        elif (isinstance(self._bounding_box, type) and\n              issubclass(self._bounding_box, ModelBoundingBox)):\n            cls = self._bounding_box\n        else:\n            cls = ModelBoundingBox\n\n        if cls is not None:\n            try:\n                bounding_box = cls.validate(self, bounding_box, _preserve_ignore=True)\n            except ValueError as exc:\n                raise ValueError(exc.args[0])\n\n        self._user_bounding_box = bounding_box\n\n    def set_slice_args(self, *args):\n        if isinstance(self._user_bounding_box, CompoundBoundingBox):\n            self._user_bounding_box.slice_args = args\n        else:\n            raise RuntimeError('The bounding_box for this model is not compound')\n\n    @bounding_box.deleter\n    def bounding_box(self):\n        self._user_bounding_box = None\n\n    @property\n    def has_user_bounding_box(self):\n        \"\"\"\n        A flag indicating whether or not a custom bounding_box has been\n        assigned to this model by a user, via assignment to\n        ``model.bounding_box``.\n        \"\"\"\n\n        return self._user_bounding_box is not None\n\n    @property\n    def cov_matrix(self):\n        \"\"\"\n        Fitter should set covariance matrix, if available.\n        \"\"\"\n        return self._cov_matrix\n\n    @cov_matrix.setter\n    def cov_matrix(self, cov):\n\n        self._cov_matrix = cov\n\n        unfix_untied_params = [p for p in self.param_names if (self.fixed[p] is False)\n                               and (self.tied[p] is False)]\n        if type(cov) == list:  # model set\n            param_stds = []\n            for c in cov:\n                param_stds.append([np.sqrt(x) if x > 0 else None for x in np.diag(c.cov_matrix)])\n            for p, param_name in enumerate(unfix_untied_params):\n                par = getattr(self, param_name)\n                par.std = [item[p] for item in param_stds]\n                setattr(self, param_name, par)\n        else:\n            param_stds = [np.sqrt(x) if x > 0 else None for x in np.diag(cov.cov_matrix)]\n            for param_name in unfix_untied_params:\n                par = getattr(self, param_name)\n                par.std = param_stds.pop(0)\n                setattr(self, param_name, par)\n\n    @property\n    def stds(self):\n        \"\"\"\n        Standard deviation of parameters, if covariance matrix is available.\n        \"\"\"\n        return self._stds\n\n    @stds.setter\n    def stds(self, stds):\n        self._stds = stds\n\n    @property\n    def separable(self):\n        \"\"\" A flag indicating whether a model is separable.\"\"\"\n\n        if self._separable is not None:\n            return self._separable\n        raise NotImplementedError(\n            'The \"separable\" property is not defined for '\n            'model {}'.format(self.__class__.__name__))\n\n    # *** Public methods ***\n\n    def without_units_for_data(self, **kwargs):\n        \"\"\"\n        Return an instance of the model for which the parameter values have\n        been converted to the right units for the data, then the units have\n        been stripped away.\n\n        The input and output Quantity objects should be given as keyword\n        arguments.\n\n        Notes\n        -----\n\n        This method is needed in order to be able to fit models with units in\n        the parameters, since we need to temporarily strip away the units from\n        the model during the fitting (which might be done by e.g. scipy\n        functions).\n\n        The units that the parameters should be converted to are not\n        necessarily the units of the input data, but are derived from them.\n        Model subclasses that want fitting to work in the presence of\n        quantities need to define a ``_parameter_units_for_data_units`` method\n        that takes the input and output units (as two dictionaries) and\n        returns a dictionary giving the target units for each parameter.\n\n        \"\"\"\n        model = self.copy()\n\n        inputs_unit = {inp: getattr(kwargs[inp], 'unit', dimensionless_unscaled)\n                       for inp in self.inputs if kwargs[inp] is not None}\n\n        outputs_unit = {out: getattr(kwargs[out], 'unit', dimensionless_unscaled)\n                        for out in self.outputs if kwargs[out] is not None}\n        parameter_units = self._parameter_units_for_data_units(inputs_unit,\n                                                               outputs_unit)\n        for name, unit in parameter_units.items():\n            parameter = getattr(model, name)\n            if parameter.unit is not None:\n                parameter.value = parameter.quantity.to(unit).value\n                parameter._set_unit(None, force=True)\n\n        if isinstance(model, CompoundModel):\n            model.strip_units_from_tree()\n\n        return model\n\n    def output_units(self, **kwargs):\n        \"\"\"\n        Return a dictionary of output units for this model given a dictionary\n        of fitting inputs and outputs\n\n        The input and output Quantity objects should be given as keyword\n        arguments.\n\n        Notes\n        -----\n\n        This method is needed in order to be able to fit models with units in\n        the parameters, since we need to temporarily strip away the units from\n        the model during the fitting (which might be done by e.g. scipy\n        functions).\n\n        This method will force extra model evaluations, which maybe computationally\n        expensive. To avoid this, one can add a return_units property to the model,\n        see :ref:`astropy:models_return_units`.\n        \"\"\"\n        units = self.return_units\n\n        if units is None or units == {}:\n            inputs = {inp: kwargs[inp] for inp in self.inputs}\n\n            values = self(**inputs)\n            if self.n_outputs == 1:\n                values = (values,)\n\n            units = {out: getattr(values[index], 'unit', dimensionless_unscaled)\n                     for index, out in enumerate(self.outputs)}\n\n        return units\n\n    def strip_units_from_tree(self):\n        for item in self._leaflist:\n            for parname in item.param_names:\n                par = getattr(item, parname)\n                par._set_unit(None, force=True)\n\n    def with_units_from_data(self, **kwargs):\n        \"\"\"\n        Return an instance of the model which has units for which the parameter\n        values are compatible with the data units specified.\n\n        The input and output Quantity objects should be given as keyword\n        arguments.\n\n        Notes\n        -----\n\n        This method is needed in order to be able to fit models with units in\n        the parameters, since we need to temporarily strip away the units from\n        the model during the fitting (which might be done by e.g. scipy\n        functions).\n\n        The units that the parameters will gain are not necessarily the units\n        of the input data, but are derived from them. Model subclasses that\n        want fitting to work in the presence of quantities need to define a\n        ``_parameter_units_for_data_units`` method that takes the input and output\n        units (as two dictionaries) and returns a dictionary giving the target\n        units for each parameter.\n        \"\"\"\n        model = self.copy()\n        inputs_unit = {inp: getattr(kwargs[inp], 'unit', dimensionless_unscaled)\n                       for inp in self.inputs if kwargs[inp] is not None}\n\n        outputs_unit = {out: getattr(kwargs[out], 'unit', dimensionless_unscaled)\n                        for out in self.outputs if kwargs[out] is not None}\n\n        parameter_units = self._parameter_units_for_data_units(inputs_unit,\n                                                               outputs_unit)\n\n        # We are adding units to parameters that already have a value, but we\n        # don't want to convert the parameter, just add the unit directly,\n        # hence the call to ``_set_unit``.\n        for name, unit in parameter_units.items():\n            parameter = getattr(model, name)\n            parameter._set_unit(unit, force=True)\n\n        return model\n\n    @property\n    def _has_units(self):\n        # Returns True if any of the parameters have units\n        for param in self.param_names:\n            if getattr(self, param).unit is not None:\n                return True\n        else:\n            return False\n\n    @property\n    def _supports_unit_fitting(self):\n        # If the model has a ``_parameter_units_for_data_units`` method, this\n        # indicates that we have enough information to strip the units away\n        # and add them back after fitting, when fitting quantities\n        return hasattr(self, '_parameter_units_for_data_units')\n\n    @abc.abstractmethod\n    def evaluate(self, *args, **kwargs):\n        \"\"\"Evaluate the model on some input variables.\"\"\"\n\n    def sum_of_implicit_terms(self, *args, **kwargs):\n        \"\"\"\n        Evaluate the sum of any implicit model terms on some input variables.\n        This includes any fixed terms used in evaluating a linear model that\n        do not have corresponding parameters exposed to the user. The\n        prototypical case is `astropy.modeling.functional_models.Shift`, which\n        corresponds to a function y = a + bx, where b=1 is intrinsically fixed\n        by the type of model, such that sum_of_implicit_terms(x) == x. This\n        method is needed by linear fitters to correct the dependent variable\n        for the implicit term(s) when solving for the remaining terms\n        (ie. a = y - bx).\n        \"\"\"\n\n    def render(self, out=None, coords=None):\n        \"\"\"\n        Evaluate a model at fixed positions, respecting the ``bounding_box``.\n\n        The key difference relative to evaluating the model directly is that\n        this method is limited to a bounding box if the `Model.bounding_box`\n        attribute is set.\n\n        Parameters\n        ----------\n        out : `numpy.ndarray`, optional\n            An array that the evaluated model will be added to.  If this is not\n            given (or given as ``None``), a new array will be created.\n        coords : array-like, optional\n            An array to be used to translate from the model's input coordinates\n            to the ``out`` array. It should have the property that\n            ``self(coords)`` yields the same shape as ``out``.  If ``out`` is\n            not specified, ``coords`` will be used to determine the shape of\n            the returned array. If this is not provided (or None), the model\n            will be evaluated on a grid determined by `Model.bounding_box`.\n\n        Returns\n        -------\n        out : `numpy.ndarray`\n            The model added to ``out`` if  ``out`` is not ``None``, or else a\n            new array from evaluating the model over ``coords``.\n            If ``out`` and ``coords`` are both `None`, the returned array is\n            limited to the `Model.bounding_box` limits. If\n            `Model.bounding_box` is `None`, ``arr`` or ``coords`` must be\n            passed.\n\n        Raises\n        ------\n        ValueError\n            If ``coords`` are not given and the the `Model.bounding_box` of\n            this model is not set.\n\n        Examples\n        --------\n        :ref:`astropy:bounding-boxes`\n        \"\"\"\n\n        try:\n            bbox = self.bounding_box\n        except NotImplementedError:\n            bbox = None\n\n        if isinstance(bbox, ModelBoundingBox):\n            bbox = bbox.bounding_box()\n\n        ndim = self.n_inputs\n\n        if (coords is None) and (out is None) and (bbox is None):\n            raise ValueError('If no bounding_box is set, '\n                             'coords or out must be input.')\n\n        # for consistent indexing\n        if ndim == 1:\n            if coords is not None:\n                coords = [coords]\n            if bbox is not None:\n                bbox = [bbox]\n\n        if coords is not None:\n            coords = np.asanyarray(coords, dtype=float)\n            # Check dimensions match out and model\n            assert len(coords) == ndim\n            if out is not None:\n                if coords[0].shape != out.shape:\n                    raise ValueError('inconsistent shape of the output.')\n            else:\n                out = np.zeros(coords[0].shape)\n\n        if out is not None:\n            out = np.asanyarray(out)\n            if out.ndim != ndim:\n                raise ValueError('the array and model must have the same '\n                                 'number of dimensions.')\n\n        if bbox is not None:\n            # Assures position is at center pixel,\n            # important when using add_array.\n            pd = np.array([(np.mean(bb), np.ceil((bb[1] - bb[0]) / 2))\n                           for bb in bbox]).astype(int).T\n            pos, delta = pd\n\n            if coords is not None:\n                sub_shape = tuple(delta * 2 + 1)\n                sub_coords = np.array([extract_array(c, sub_shape, pos)\n                                       for c in coords])\n            else:\n                limits = [slice(p - d, p + d + 1, 1) for p, d in pd.T]\n                sub_coords = np.mgrid[limits]\n\n            sub_coords = sub_coords[::-1]\n\n            if out is None:\n                out = self(*sub_coords)\n            else:\n                try:\n                    out = add_array(out, self(*sub_coords), pos)\n                except ValueError:\n                    raise ValueError(\n                        'The `bounding_box` is larger than the input out in '\n                        'one or more dimensions. Set '\n                        '`model.bounding_box = None`.')\n        else:\n            if coords is None:\n                im_shape = out.shape\n                limits = [slice(i) for i in im_shape]\n                coords = np.mgrid[limits]\n\n            coords = coords[::-1]\n\n            out += self(*coords)\n\n        return out\n\n    @property\n    def input_units(self):\n        \"\"\"\n        This property is used to indicate what units or sets of units the\n        evaluate method expects, and returns a dictionary mapping inputs to\n        units (or `None` if any units are accepted).\n\n        Model sub-classes can also use function annotations in evaluate to\n        indicate valid input units, in which case this property should\n        not be overridden since it will return the input units based on the\n        annotations.\n        \"\"\"\n        if hasattr(self, '_input_units'):\n            return self._input_units\n        elif hasattr(self.evaluate, '__annotations__'):\n            annotations = self.evaluate.__annotations__.copy()\n            annotations.pop('return', None)\n            if annotations:\n                # If there are not annotations for all inputs this will error.\n                return dict((name, annotations[name]) for name in self.inputs)\n        else:\n            # None means any unit is accepted\n            return None\n\n    @property\n    def return_units(self):\n        \"\"\"\n        This property is used to indicate what units or sets of units the\n        output of evaluate should be in, and returns a dictionary mapping\n        outputs to units (or `None` if any units are accepted).\n\n        Model sub-classes can also use function annotations in evaluate to\n        indicate valid output units, in which case this property should not be\n        overridden since it will return the return units based on the\n        annotations.\n        \"\"\"\n        if hasattr(self, '_return_units'):\n            return self._return_units\n        elif hasattr(self.evaluate, '__annotations__'):\n            return self.evaluate.__annotations__.get('return', None)\n        else:\n            # None means any unit is accepted\n            return None\n\n    def _prepare_inputs_single_model(self, params, inputs, **kwargs):\n        broadcasts = []\n        for idx, _input in enumerate(inputs):\n            input_shape = _input.shape\n\n            # Ensure that array scalars are always upgrade to 1-D arrays for the\n            # sake of consistency with how parameters work.  They will be cast back\n            # to scalars at the end\n            if not input_shape:\n                inputs[idx] = _input.reshape((1,))\n\n            if not params:\n                max_broadcast = input_shape\n            else:\n                max_broadcast = ()\n\n            for param in params:\n                try:\n                    if self.standard_broadcasting:\n                        broadcast = check_broadcast(input_shape, param.shape)\n                    else:\n                        broadcast = input_shape\n                except IncompatibleShapeError:\n                    raise ValueError(\n                        \"self input argument {0!r} of shape {1!r} cannot be \"\n                        \"broadcast with parameter {2!r} of shape \"\n                        \"{3!r}.\".format(self.inputs[idx], input_shape,\n                                        param.name, param.shape))\n\n                if len(broadcast) > len(max_broadcast):\n                    max_broadcast = broadcast\n                elif len(broadcast) == len(max_broadcast):\n                    max_broadcast = max(max_broadcast, broadcast)\n\n            broadcasts.append(max_broadcast)\n\n        if self.n_outputs > self.n_inputs:\n            extra_outputs = self.n_outputs - self.n_inputs\n            if not broadcasts:\n                # If there were no inputs then the broadcasts list is empty\n                # just add a None since there is no broadcasting of outputs and\n                # inputs necessary (see _prepare_outputs_single_self)\n                broadcasts.append(None)\n            broadcasts.extend([broadcasts[0]] * extra_outputs)\n\n        return inputs, (broadcasts,)\n\n    @staticmethod\n    def _remove_axes_from_shape(shape, axis):\n        \"\"\"\n        Given a shape tuple as the first input, construct a new one by  removing\n        that particular axis from the shape and all preceeding axes. Negative axis\n        numbers are permittted, where the axis is relative to the last axis.\n        \"\"\"\n        if len(shape) == 0:\n            return shape\n        if axis < 0:\n            axis = len(shape) + axis\n            return shape[:axis] + shape[axis+1:]\n        if axis >= len(shape):\n            axis = len(shape)-1\n        shape = shape[axis+1:]\n        return shape\n\n    def _prepare_inputs_model_set(self, params, inputs, model_set_axis_input,\n                                  **kwargs):\n        reshaped = []\n        pivots = []\n\n        model_set_axis_param = self.model_set_axis  # needed to reshape param\n        for idx, _input in enumerate(inputs):\n            max_param_shape = ()\n            if self._n_models > 1 and model_set_axis_input is not False:\n                # Use the shape of the input *excluding* the model axis\n                input_shape = (_input.shape[:model_set_axis_input] +\n                               _input.shape[model_set_axis_input + 1:])\n            else:\n                input_shape = _input.shape\n\n            for param in params:\n                try:\n                    check_broadcast(input_shape,\n                                    self._remove_axes_from_shape(param.shape,\n                                                                 model_set_axis_param))\n                except IncompatibleShapeError:\n                    raise ValueError(\n                        \"Model input argument {0!r} of shape {1!r} cannot be \"\n                        \"broadcast with parameter {2!r} of shape \"\n                        \"{3!r}.\".format(self.inputs[idx], input_shape,\n                                        param.name,\n                                        self._remove_axes_from_shape(param.shape,\n                                                                     model_set_axis_param)))\n\n                if len(param.shape) - 1 > len(max_param_shape):\n                    max_param_shape = self._remove_axes_from_shape(param.shape,\n                                                                   model_set_axis_param)\n\n            # We've now determined that, excluding the model_set_axis, the\n            # input can broadcast with all the parameters\n            input_ndim = len(input_shape)\n            if model_set_axis_input is False:\n                if len(max_param_shape) > input_ndim:\n                    # Just needs to prepend new axes to the input\n                    n_new_axes = 1 + len(max_param_shape) - input_ndim\n                    new_axes = (1,) * n_new_axes\n                    new_shape = new_axes + _input.shape\n                    pivot = model_set_axis_param\n                else:\n                    pivot = input_ndim - len(max_param_shape)\n                    new_shape = (_input.shape[:pivot] + (1,) +\n                                 _input.shape[pivot:])\n                new_input = _input.reshape(new_shape)\n            else:\n                if len(max_param_shape) >= input_ndim:\n                    n_new_axes = len(max_param_shape) - input_ndim\n                    pivot = self.model_set_axis\n                    new_axes = (1,) * n_new_axes\n                    new_shape = (_input.shape[:pivot + 1] + new_axes +\n                                 _input.shape[pivot + 1:])\n                    new_input = _input.reshape(new_shape)\n                else:\n                    pivot = _input.ndim - len(max_param_shape) - 1\n                    new_input = np.rollaxis(_input, model_set_axis_input,\n                                            pivot + 1)\n            pivots.append(pivot)\n            reshaped.append(new_input)\n\n        if self.n_inputs < self.n_outputs:\n            pivots.extend([model_set_axis_input] * (self.n_outputs - self.n_inputs))\n\n        return reshaped, (pivots,)\n\n    def prepare_inputs(self, *inputs, model_set_axis=None, equivalencies=None,\n                       **kwargs):\n        \"\"\"\n        This method is used in `~astropy.modeling.Model.__call__` to ensure\n        that all the inputs to the model can be broadcast into compatible\n        shapes (if one or both of them are input as arrays), particularly if\n        there are more than one parameter sets. This also makes sure that (if\n        applicable) the units of the input will be compatible with the evaluate\n        method.\n        \"\"\"\n        # When we instantiate the model class, we make sure that __call__ can\n        # take the following two keyword arguments: model_set_axis and\n        # equivalencies.\n        if model_set_axis is None:\n            # By default the model_set_axis for the input is assumed to be the\n            # same as that for the parameters the model was defined with\n            # TODO: Ensure that negative model_set_axis arguments are respected\n            model_set_axis = self.model_set_axis\n\n        params = [getattr(self, name) for name in self.param_names]\n        inputs = [np.asanyarray(_input, dtype=float) for _input in inputs]\n\n        self._validate_input_shapes(inputs, self.inputs, model_set_axis)\n\n        inputs_map = kwargs.get('inputs_map', None)\n\n        inputs = self._validate_input_units(inputs, equivalencies, inputs_map)\n\n        # The input formatting required for single models versus a multiple\n        # model set are different enough that they've been split into separate\n        # subroutines\n        if self._n_models == 1:\n            return self._prepare_inputs_single_model(params, inputs, **kwargs)\n        else:\n            return self._prepare_inputs_model_set(params, inputs,\n                                                  model_set_axis, **kwargs)\n\n    def _validate_input_units(self, inputs, equivalencies=None, inputs_map=None):\n        inputs = list(inputs)\n        name = self.name or self.__class__.__name__\n        # Check that the units are correct, if applicable\n\n        if self.input_units is not None:\n            # If a leaflist is provided that means this is in the context of\n            # a compound model and it is necessary to create the appropriate\n            # alias for the input coordinate name for the equivalencies dict\n            if inputs_map:\n                edict = {}\n                for mod, mapping in inputs_map:\n                    if self is mod:\n                        edict[mapping[0]] = equivalencies[mapping[1]]\n            else:\n                edict = equivalencies\n            # We combine any instance-level input equivalencies with user\n            # specified ones at call-time.\n            input_units_equivalencies = _combine_equivalency_dict(self.inputs,\n                                                                  edict,\n                                                                  self.input_units_equivalencies)\n\n            # We now iterate over the different inputs and make sure that their\n            # units are consistent with those specified in input_units.\n            for i in range(len(inputs)):\n\n                input_name = self.inputs[i]\n                input_unit = self.input_units.get(input_name, None)\n\n                if input_unit is None:\n                    continue\n\n                if isinstance(inputs[i], Quantity):\n\n                    # We check for consistency of the units with input_units,\n                    # taking into account any equivalencies\n\n                    if inputs[i].unit.is_equivalent(\n                            input_unit,\n                            equivalencies=input_units_equivalencies[input_name]):\n\n                        # If equivalencies have been specified, we need to\n                        # convert the input to the input units - this is\n                        # because some equivalencies are non-linear, and\n                        # we need to be sure that we evaluate the model in\n                        # its own frame of reference. If input_units_strict\n                        # is set, we also need to convert to the input units.\n                        if len(input_units_equivalencies) > 0 or self.input_units_strict[input_name]:\n                            inputs[i] = inputs[i].to(input_unit,\n                                                     equivalencies=input_units_equivalencies[input_name])\n\n                    else:\n\n                        # We consider the following two cases separately so as\n                        # to be able to raise more appropriate/nicer exceptions\n\n                        if input_unit is dimensionless_unscaled:\n                            raise UnitsError(\"{0}: Units of input '{1}', {2} ({3}),\"\n                                             \"could not be converted to \"\n                                             \"required dimensionless \"\n                                             \"input\".format(name,\n                                                            self.inputs[i],\n                                                            inputs[i].unit,\n                                                            inputs[i].unit.physical_type))\n                        else:\n                            raise UnitsError(\"{0}: Units of input '{1}', {2} ({3}),\"\n                                             \" could not be \"\n                                             \"converted to required input\"\n                                             \" units of {4} ({5})\".format(\n                                                 name,\n                                                 self.inputs[i],\n                                                 inputs[i].unit,\n                                                 inputs[i].unit.physical_type,\n                                                 input_unit,\n                                                 input_unit.physical_type))\n                else:\n\n                    # If we allow dimensionless input, we add the units to the\n                    # input values without conversion, otherwise we raise an\n                    # exception.\n\n                    if (not self.input_units_allow_dimensionless[input_name] and\n                        input_unit is not dimensionless_unscaled and\n                        input_unit is not None):\n                        if np.any(inputs[i] != 0):\n                            raise UnitsError(\"{0}: Units of input '{1}', (dimensionless), could not be \"\n                                             \"converted to required input units of \"\n                                             \"{2} ({3})\".format(name, self.inputs[i], input_unit,\n                                                                input_unit.physical_type))\n        return inputs\n\n    def _process_output_units(self, inputs, outputs):\n        inputs_are_quantity = any([isinstance(i, Quantity) for i in inputs])\n        if self.return_units and inputs_are_quantity:\n            # We allow a non-iterable unit only if there is one output\n            if self.n_outputs == 1 and not isiterable(self.return_units):\n                return_units = {self.outputs[0]: self.return_units}\n            else:\n                return_units = self.return_units\n\n            outputs = tuple([Quantity(out, return_units.get(out_name, None), subok=True)\n                             for out, out_name in zip(outputs, self.outputs)])\n        return outputs\n\n    @staticmethod\n    def _prepare_output_single_model(output, broadcast_shape):\n        if broadcast_shape is not None:\n            if not broadcast_shape:\n                return output.item()\n            else:\n                try:\n                    return output.reshape(broadcast_shape)\n                except ValueError:\n                    try:\n                        return output.item()\n                    except ValueError:\n                        return output\n\n        return output\n\n    def _prepare_outputs_single_model(self, outputs, broadcasted_shapes):\n        outputs = list(outputs)\n        for idx, output in enumerate(outputs):\n            try:\n                broadcast_shape = check_broadcast(*broadcasted_shapes[0])\n            except (IndexError, TypeError):\n                broadcast_shape = broadcasted_shapes[0][idx]\n\n            outputs[idx] = self._prepare_output_single_model(output, broadcast_shape)\n\n        return tuple(outputs)\n\n    def _prepare_outputs_model_set(self, outputs, broadcasted_shapes, model_set_axis):\n        pivots = broadcasted_shapes[0]\n        # If model_set_axis = False was passed then use\n        # self._model_set_axis to format the output.\n        if model_set_axis is None or model_set_axis is False:\n            model_set_axis = self.model_set_axis\n        outputs = list(outputs)\n        for idx, output in enumerate(outputs):\n            pivot = pivots[idx]\n            if pivot < output.ndim and pivot != model_set_axis:\n                outputs[idx] = np.rollaxis(output, pivot,\n                                           model_set_axis)\n        return tuple(outputs)\n\n    def prepare_outputs(self, broadcasted_shapes, *outputs, **kwargs):\n        model_set_axis = kwargs.get('model_set_axis', None)\n\n        if len(self) == 1:\n            return self._prepare_outputs_single_model(outputs, broadcasted_shapes)\n        else:\n            return self._prepare_outputs_model_set(outputs, broadcasted_shapes, model_set_axis)\n\n    def copy(self):\n        \"\"\"\n        Return a copy of this model.\n\n        Uses a deep copy so that all model attributes, including parameter\n        values, are copied as well.\n        \"\"\"\n\n        return copy.deepcopy(self)\n\n    def deepcopy(self):\n        \"\"\"\n        Return a deep copy of this model.\n\n        \"\"\"\n\n        return self.copy()\n\n    @sharedmethod\n    def rename(self, name):\n        \"\"\"\n        Return a copy of this model with a new name.\n        \"\"\"\n        new_model = self.copy()\n        new_model._name = name\n        return new_model\n\n    def coerce_units(\n        self,\n        input_units=None,\n        return_units=None,\n        input_units_equivalencies=None,\n        input_units_allow_dimensionless=False\n    ):\n        \"\"\"\n        Attach units to this (unitless) model.\n\n        Parameters\n        ----------\n        input_units : dict or tuple, optional\n            Input units to attach.  If dict, each key is the name of a model input,\n            and the value is the unit to attach.  If tuple, the elements are units\n            to attach in order corresponding to `Model.inputs`.\n        return_units : dict or tuple, optional\n            Output units to attach.  If dict, each key is the name of a model output,\n            and the value is the unit to attach.  If tuple, the elements are units\n            to attach in order corresponding to `Model.outputs`.\n        input_units_equivalencies : dict, optional\n            Default equivalencies to apply to input values.  If set, this should be a\n            dictionary where each key is a string that corresponds to one of the\n            model inputs.\n        input_units_allow_dimensionless : bool or dict, optional\n            Allow dimensionless input. If this is True, input values to evaluate will\n            gain the units specified in input_units. If this is a dictionary then it\n            should map input name to a bool to allow dimensionless numbers for that\n            input.\n\n        Returns\n        -------\n        `CompoundModel`\n            A `CompoundModel` composed of the current model plus\n            `~astropy.modeling.mappings.UnitsMapping` model(s) that attach the units.\n\n        Raises\n        ------\n        ValueError\n            If the current model already has units.\n\n        Examples\n        --------\n\n        Wrapping a unitless model to require and convert units:\n\n        >>> from astropy.modeling.models import Polynomial1D\n        >>> from astropy import units as u\n        >>> poly = Polynomial1D(1, c0=1, c1=2)\n        >>> model = poly.coerce_units((u.m,), (u.s,))\n        >>> model(u.Quantity(10, u.m))  # doctest: +FLOAT_CMP\n        <Quantity 21. s>\n        >>> model(u.Quantity(1000, u.cm))  # doctest: +FLOAT_CMP\n        <Quantity 21. s>\n        >>> model(u.Quantity(10, u.cm))  # doctest: +FLOAT_CMP\n        <Quantity 1.2 s>\n\n        Wrapping a unitless model but still permitting unitless input:\n\n        >>> from astropy.modeling.models import Polynomial1D\n        >>> from astropy import units as u\n        >>> poly = Polynomial1D(1, c0=1, c1=2)\n        >>> model = poly.coerce_units((u.m,), (u.s,), input_units_allow_dimensionless=True)\n        >>> model(u.Quantity(10, u.m))  # doctest: +FLOAT_CMP\n        <Quantity 21. s>\n        >>> model(10)  # doctest: +FLOAT_CMP\n        <Quantity 21. s>\n        \"\"\"\n        from .mappings import UnitsMapping\n\n        result = self\n\n        if input_units is not None:\n            if self.input_units is not None:\n                model_units = self.input_units\n            else:\n                model_units = {}\n\n            for unit in [model_units.get(i) for i in self.inputs]:\n                if unit is not None and unit != dimensionless_unscaled:\n                    raise ValueError(\"Cannot specify input_units for model with existing input units\")\n\n            if isinstance(input_units, dict):\n                if input_units.keys() != set(self.inputs):\n                    message = (\n                        f\"\"\"input_units keys ({\", \".join(input_units.keys())}) \"\"\"\n                        f\"\"\"do not match model inputs ({\", \".join(self.inputs)})\"\"\"\n                    )\n                    raise ValueError(message)\n                input_units = [input_units[i] for i in self.inputs]\n\n            if len(input_units) != self.n_inputs:\n                message = (\n                    \"input_units length does not match n_inputs: \"\n                    f\"expected {self.n_inputs}, received {len(input_units)}\"\n                )\n                raise ValueError(message)\n\n            mapping = tuple((unit, model_units.get(i)) for i, unit in zip(self.inputs, input_units))\n            input_mapping = UnitsMapping(\n                mapping,\n                input_units_equivalencies=input_units_equivalencies,\n                input_units_allow_dimensionless=input_units_allow_dimensionless\n            )\n            input_mapping.inputs = self.inputs\n            input_mapping.outputs = self.inputs\n            result = input_mapping | result\n\n        if return_units is not None:\n            if self.return_units is not None:\n                model_units = self.return_units\n            else:\n                model_units = {}\n\n            for unit in [model_units.get(i) for i in self.outputs]:\n                if unit is not None and unit != dimensionless_unscaled:\n                    raise ValueError(\"Cannot specify return_units for model with existing output units\")\n\n            if isinstance(return_units, dict):\n                if return_units.keys() != set(self.outputs):\n                    message = (\n                        f\"\"\"return_units keys ({\", \".join(return_units.keys())}) \"\"\"\n                        f\"\"\"do not match model outputs ({\", \".join(self.outputs)})\"\"\"\n                    )\n                    raise ValueError(message)\n                return_units = [return_units[i] for i in self.outputs]\n\n            if len(return_units) != self.n_outputs:\n                message = (\n                    \"return_units length does not match n_outputs: \"\n                    f\"expected {self.n_outputs}, received {len(return_units)}\"\n                )\n                raise ValueError(message)\n\n            mapping = tuple((model_units.get(i), unit) for i, unit in zip(self.outputs, return_units))\n            return_mapping = UnitsMapping(mapping)\n            return_mapping.inputs = self.outputs\n            return_mapping.outputs = self.outputs\n            result = result | return_mapping\n\n        return result\n\n    @property\n    def n_submodels(self):\n        \"\"\"\n        Return the number of components in a single model, which is\n        obviously 1.\n        \"\"\"\n        return 1\n\n    def _initialize_constraints(self, kwargs):\n        \"\"\"\n        Pop parameter constraint values off the keyword arguments passed to\n        `Model.__init__` and store them in private instance attributes.\n        \"\"\"\n\n        # Pop any constraints off the keyword arguments\n        for constraint in self.parameter_constraints:\n            values = kwargs.pop(constraint, {})\n            for ckey, cvalue in values.items():\n                param = getattr(self, ckey)\n                setattr(param, constraint, cvalue)\n        self._mconstraints = {}\n        for constraint in self.model_constraints:\n            values = kwargs.pop(constraint, [])\n            self._mconstraints[constraint] = values\n\n    def _initialize_parameters(self, args, kwargs):\n        \"\"\"\n        Initialize the _parameters array that stores raw parameter values for\n        all parameter sets for use with vectorized fitting algorithms; on\n        FittableModels the _param_name attributes actually just reference\n        slices of this array.\n        \"\"\"\n        n_models = kwargs.pop('n_models', None)\n\n        if not (n_models is None or\n                (isinstance(n_models, (int, np.integer)) and n_models >= 1)):\n            raise ValueError(\n                \"n_models must be either None (in which case it is \"\n                \"determined from the model_set_axis of the parameter initial \"\n                \"values) or it must be a positive integer \"\n                \"(got {0!r})\".format(n_models))\n\n        model_set_axis = kwargs.pop('model_set_axis', None)\n        if model_set_axis is None:\n            if n_models is not None and n_models > 1:\n                # Default to zero\n                model_set_axis = 0\n            else:\n                # Otherwise disable\n                model_set_axis = False\n        else:\n            if not (model_set_axis is False or\n                    np.issubdtype(type(model_set_axis), np.integer)):\n                raise ValueError(\n                    \"model_set_axis must be either False or an integer \"\n                    \"specifying the parameter array axis to map to each \"\n                    \"model in a set of models (got {0!r}).\".format(\n                        model_set_axis))\n\n        # Process positional arguments by matching them up with the\n        # corresponding parameters in self.param_names--if any also appear as\n        # keyword arguments this presents a conflict\n        params = set()\n        if len(args) > len(self.param_names):\n            raise TypeError(\n                \"{0}.__init__() takes at most {1} positional arguments ({2} \"\n                \"given)\".format(self.__class__.__name__, len(self.param_names),\n                                len(args)))\n\n        self._model_set_axis = model_set_axis\n        self._param_metrics = defaultdict(dict)\n\n        for idx, arg in enumerate(args):\n            if arg is None:\n                # A value of None implies using the default value, if exists\n                continue\n            # We use quantity_asanyarray here instead of np.asanyarray because\n            # if any of the arguments are quantities, we need to return a\n            # Quantity object not a plain Numpy array.\n            param_name = self.param_names[idx]\n            params.add(param_name)\n            if not isinstance(arg, Parameter):\n                value = quantity_asanyarray(arg, dtype=float)\n            else:\n                value = arg\n            self._initialize_parameter_value(param_name, value)\n\n        # At this point the only remaining keyword arguments should be\n        # parameter names; any others are in error.\n        for param_name in self.param_names:\n            if param_name in kwargs:\n                if param_name in params:\n                    raise TypeError(\n                        \"{0}.__init__() got multiple values for parameter \"\n                        \"{1!r}\".format(self.__class__.__name__, param_name))\n                value = kwargs.pop(param_name)\n                if value is None:\n                    continue\n                # We use quantity_asanyarray here instead of np.asanyarray\n                # because if any of the arguments are quantities, we need\n                # to return a Quantity object not a plain Numpy array.\n                value = quantity_asanyarray(value, dtype=float)\n                params.add(param_name)\n                self._initialize_parameter_value(param_name, value)\n        # Now deal with case where param_name is not supplied by args or kwargs\n        for param_name in self.param_names:\n            if param_name not in params:\n                self._initialize_parameter_value(param_name, None)\n\n        if kwargs:\n            # If any keyword arguments were left over at this point they are\n            # invalid--the base class should only be passed the parameter\n            # values, constraints, and param_dim\n            for kwarg in kwargs:\n                # Just raise an error on the first unrecognized argument\n                raise TypeError(\n                    '{0}.__init__() got an unrecognized parameter '\n                    '{1!r}'.format(self.__class__.__name__, kwarg))\n\n        # Determine the number of model sets: If the model_set_axis is\n        # None then there is just one parameter set; otherwise it is determined\n        # by the size of that axis on the first parameter--if the other\n        # parameters don't have the right number of axes or the sizes of their\n        # model_set_axis don't match an error is raised\n        if model_set_axis is not False and n_models != 1 and params:\n            max_ndim = 0\n            if model_set_axis < 0:\n                min_ndim = abs(model_set_axis)\n            else:\n                min_ndim = model_set_axis + 1\n\n            for name in self.param_names:\n                value = getattr(self, name)\n                param_ndim = np.ndim(value)\n                if param_ndim < min_ndim:\n                    raise InputParameterError(\n                        \"All parameter values must be arrays of dimension \"\n                        \"at least {0} for model_set_axis={1} (the value \"\n                        \"given for {2!r} is only {3}-dimensional)\".format(\n                            min_ndim, model_set_axis, name, param_ndim))\n\n                max_ndim = max(max_ndim, param_ndim)\n\n                if n_models is None:\n                    # Use the dimensions of the first parameter to determine\n                    # the number of model sets\n                    n_models = value.shape[model_set_axis]\n                elif value.shape[model_set_axis] != n_models:\n                    raise InputParameterError(\n                        \"Inconsistent dimensions for parameter {0!r} for \"\n                        \"{1} model sets.  The length of axis {2} must be the \"\n                        \"same for all input parameter values\".format(\n                            name, n_models, model_set_axis))\n\n            self._check_param_broadcast(max_ndim)\n        else:\n            if n_models is None:\n                n_models = 1\n\n            self._check_param_broadcast(None)\n\n        self._n_models = n_models\n        # now validate parameters\n        for name in params:\n            param = getattr(self, name)\n            if param._validator is not None:\n                param._validator(self, param.value)\n\n    def _initialize_parameter_value(self, param_name, value):\n        \"\"\"Mostly deals with consistency checks and determining unit issues.\"\"\"\n        if isinstance(value, Parameter):\n            self.__dict__[param_name] = value\n            return\n        param = getattr(self, param_name)\n        # Use default if value is not provided\n        if value is None:\n            default = param.default\n            if default is None:\n                # No value was supplied for the parameter and the\n                # parameter does not have a default, therefore the model\n                # is underspecified\n                raise TypeError(\"{0}.__init__() requires a value for parameter \"\n                                \"{1!r}\".format(self.__class__.__name__, param_name))\n            value = default\n            unit = param.unit\n        else:\n            if isinstance(value, Quantity):\n                unit = value.unit\n                value = value.value\n            else:\n                unit = None\n        if unit is None and param.unit is not None:\n            raise InputParameterError(\n                \"{0}.__init__() requires a Quantity for parameter \"\n                \"{1!r}\".format(self.__class__.__name__, param_name))\n        param._unit = unit\n        param.internal_unit = None\n        if param._setter is not None:\n            if unit is not None:\n                _val = param._setter(value * unit)\n            else:\n                _val = param._setter(value)\n            if isinstance(_val, Quantity):\n                param.internal_unit = _val.unit\n                param._internal_value = np.array(_val.value)\n            else:\n                param.internal_unit = None\n                param._internal_value = np.array(_val)\n        else:\n            param._value = np.array(value)\n\n    def _initialize_slices(self):\n\n        param_metrics = self._param_metrics\n        total_size = 0\n\n        for name in self.param_names:\n            param = getattr(self, name)\n            value = param.value\n            param_size = np.size(value)\n            param_shape = np.shape(value)\n            param_slice = slice(total_size, total_size + param_size)\n            param_metrics[name]['slice'] = param_slice\n            param_metrics[name]['shape'] = param_shape\n            param_metrics[name]['size'] = param_size\n            total_size += param_size\n        self._parameters = np.empty(total_size, dtype=np.float64)\n\n    def _parameters_to_array(self):\n        # Now set the parameter values (this will also fill\n        # self._parameters)\n        param_metrics = self._param_metrics\n        for name in self.param_names:\n            param = getattr(self, name)\n            value = param.value\n            if not isinstance(value, np.ndarray):\n                value = np.array([value])\n            self._parameters[param_metrics[name]['slice']] = value.ravel()\n\n        # Finally validate all the parameters; we do this last so that\n        # validators that depend on one of the other parameters' values will\n        # work\n\n    def _array_to_parameters(self):\n        param_metrics = self._param_metrics\n        for name in self.param_names:\n            param = getattr(self, name)\n            value = self._parameters[param_metrics[name]['slice']]\n            value.shape = param_metrics[name]['shape']\n            param.value = value\n\n    def _check_param_broadcast(self, max_ndim):\n        \"\"\"\n        This subroutine checks that all parameter arrays can be broadcast\n        against each other, and determines the shapes parameters must have in\n        order to broadcast correctly.\n\n        If model_set_axis is None this merely checks that the parameters\n        broadcast and returns an empty dict if so.  This mode is only used for\n        single model sets.\n        \"\"\"\n        all_shapes = []\n        model_set_axis = self._model_set_axis\n\n        for name in self.param_names:\n            param = getattr(self, name)\n            value = param.value\n            param_shape = np.shape(value)\n            param_ndim = len(param_shape)\n            if max_ndim is not None and param_ndim < max_ndim:\n                # All arrays have the same number of dimensions up to the\n                # model_set_axis dimension, but after that they may have a\n                # different number of trailing axes.  The number of trailing\n                # axes must be extended for mutual compatibility.  For example\n                # if max_ndim = 3 and model_set_axis = 0, an array with the\n                # shape (2, 2) must be extended to (2, 1, 2).  However, an\n                # array with shape (2,) is extended to (2, 1).\n                new_axes = (1,) * (max_ndim - param_ndim)\n\n                if model_set_axis < 0:\n                    # Just need to prepend axes to make up the difference\n                    broadcast_shape = new_axes + param_shape\n                else:\n                    broadcast_shape = (param_shape[:model_set_axis + 1] +\n                                       new_axes +\n                                       param_shape[model_set_axis + 1:])\n                self._param_metrics[name]['broadcast_shape'] = broadcast_shape\n                all_shapes.append(broadcast_shape)\n            else:\n                all_shapes.append(param_shape)\n\n        # Now check mutual broadcastability of all shapes\n        try:\n            check_broadcast(*all_shapes)\n        except IncompatibleShapeError as exc:\n            shape_a, shape_a_idx, shape_b, shape_b_idx = exc.args\n            param_a = self.param_names[shape_a_idx]\n            param_b = self.param_names[shape_b_idx]\n\n            raise InputParameterError(\n                \"Parameter {0!r} of shape {1!r} cannot be broadcast with \"\n                \"parameter {2!r} of shape {3!r}.  All parameter arrays \"\n                \"must have shapes that are mutually compatible according \"\n                \"to the broadcasting rules.\".format(param_a, shape_a,\n                                                    param_b, shape_b))\n\n    def _param_sets(self, raw=False, units=False):\n        \"\"\"\n        Implementation of the Model.param_sets property.\n\n        This internal implementation has a ``raw`` argument which controls\n        whether or not to return the raw parameter values (i.e. the values that\n        are actually stored in the ._parameters array, as opposed to the values\n        displayed to users.  In most cases these are one in the same but there\n        are currently a few exceptions.\n\n        Note: This is notably an overcomplicated device and may be removed\n        entirely in the near future.\n        \"\"\"\n\n        values = []\n        shapes = []\n        for name in self.param_names:\n            param = getattr(self, name)\n\n            if raw and param._setter:\n                value = param._internal_value\n            else:\n                value = param.value\n\n            broadcast_shape = self._param_metrics[name].get('broadcast_shape')\n            if broadcast_shape is not None:\n                value = value.reshape(broadcast_shape)\n\n            shapes.append(np.shape(value))\n\n            if len(self) == 1:\n                # Add a single param set axis to the parameter's value (thus\n                # converting scalars to shape (1,) array values) for\n                # consistency\n                value = np.array([value])\n\n            if units:\n                if raw and param.internal_unit is not None:\n                    unit = param.internal_unit\n                else:\n                    unit = param.unit\n                if unit is not None:\n                    value = Quantity(value, unit)\n\n            values.append(value)\n\n        if len(set(shapes)) != 1 or units:\n            # If the parameters are not all the same shape, converting to an\n            # array is going to produce an object array\n            # However the way Numpy creates object arrays is tricky in that it\n            # will recurse into array objects in the list and break them up\n            # into separate objects.  Doing things this way ensures a 1-D\n            # object array the elements of which are the individual parameter\n            # arrays.  There's not much reason to do this over returning a list\n            # except for consistency\n            psets = np.empty(len(values), dtype=object)\n            psets[:] = values\n            return psets\n\n        return np.array(values)\n\n    def _format_repr(self, args=[], kwargs={}, defaults={}):\n        \"\"\"\n        Internal implementation of ``__repr__``.\n\n        This is separated out for ease of use by subclasses that wish to\n        override the default ``__repr__`` while keeping the same basic\n        formatting.\n        \"\"\"\n\n        parts = [repr(a) for a in args]\n\n        parts.extend(\n            f\"{name}={param_repr_oneline(getattr(self, name))}\"\n            for name in self.param_names)\n\n        if self.name is not None:\n            parts.append(f'name={self.name!r}')\n\n        for kwarg, value in kwargs.items():\n            if kwarg in defaults and defaults[kwarg] == value:\n                continue\n            parts.append(f'{kwarg}={value!r}')\n\n        if len(self) > 1:\n            parts.append(f\"n_models={len(self)}\")\n\n        return f\"<{self.__class__.__name__}({', '.join(parts)})>\"\n\n    def _format_str(self, keywords=[], defaults={}):\n        \"\"\"\n        Internal implementation of ``__str__``.\n\n        This is separated out for ease of use by subclasses that wish to\n        override the default ``__str__`` while keeping the same basic\n        formatting.\n        \"\"\"\n\n        default_keywords = [\n            ('Model', self.__class__.__name__),\n            ('Name', self.name),\n            ('Inputs', self.inputs),\n            ('Outputs', self.outputs),\n            ('Model set size', len(self))\n        ]\n\n        parts = [f'{keyword}: {value}'\n                 for keyword, value in default_keywords\n                 if value is not None]\n\n        for keyword, value in keywords:\n            if keyword.lower() in defaults and defaults[keyword.lower()] == value:\n                continue\n            parts.append(f'{keyword}: {value}')\n        parts.append('Parameters:')\n\n        if len(self) == 1:\n            columns = [[getattr(self, name).value]\n                       for name in self.param_names]\n        else:\n            columns = [getattr(self, name).value\n                       for name in self.param_names]\n\n        if columns:\n            param_table = Table(columns, names=self.param_names)\n            # Set units on the columns\n            for name in self.param_names:\n                param_table[name].unit = getattr(self, name).unit\n            parts.append(indent(str(param_table), width=4))\n\n        return '\\n'.join(parts)"},{"col":4,"comment":"null","endLoc":812,"header":"def __rtruediv__(self, m)","id":3437,"name":"__rtruediv__","nodeType":"Function","startLoc":796,"text":"def __rtruediv__(self, m):\n        if isinstance(m, (bytes, str)):\n            return Unit(m) / self\n\n        try:\n            # Cannot handle this as Unit.  Here, m cannot be a Quantity,\n            # so we make it into one, fasttracking when it does not have a\n            # unit, for the common case of <array> / <unit>.\n            from .quantity import Quantity\n            if hasattr(m, 'unit'):\n                result = Quantity(m)\n                result /= self\n                return result\n            else:\n                return Quantity(m, self**(-1))\n        except TypeError:\n            return NotImplemented"},{"col":4,"comment":"null","endLoc":724,"header":"def __init__(self, *args, meta=None, name=None, **kwargs)","id":3438,"name":"__init__","nodeType":"Function","startLoc":701,"text":"def __init__(self, *args, meta=None, name=None, **kwargs):\n        super().__init__()\n        self._default_inputs_outputs()\n        if meta is not None:\n            self.meta = meta\n        self._name = name\n        # add parameters to instance level by walking MRO list\n        mro = self.__class__.__mro__\n        for cls in mro:\n            if issubclass(cls, Model):\n                for parname, val in cls._parameters_.items():\n                    newpar = copy.deepcopy(val)\n                    newpar.model = self\n                    if parname not in self.__dict__:\n                        self.__dict__[parname] = newpar\n\n        self._initialize_constraints(kwargs)\n        kwargs = self._initialize_setters(kwargs)\n        # Remaining keyword args are either parameter values or invalid\n        # Parameter values must be passed in as keyword arguments in order to\n        # distinguish them\n        self._initialize_parameters(args, kwargs)\n        self._initialize_slices()\n        self._initialize_unit_support()"},{"col":4,"comment":"null","endLoc":830,"header":"def __mul__(self, m)","id":3439,"name":"__mul__","nodeType":"Function","startLoc":814,"text":"def __mul__(self, m):\n        if isinstance(m, (bytes, str)):\n            m = Unit(m)\n\n        if isinstance(m, UnitBase):\n            if m.is_unity():\n                return self\n            elif self.is_unity():\n                return m\n            return CompositeUnit(1, [self, m], [1, 1], _error_check=False)\n\n        # Cannot handle this as Unit, re-try as Quantity.\n        try:\n            from .quantity import Quantity\n            return Quantity(1, self) * m\n        except TypeError:\n            return NotImplemented"},{"col":4,"comment":"\n        Returns `True` if the unit is unscaled and dimensionless.\n        ","endLoc":1656,"header":"def is_unity(self)","id":3440,"name":"is_unity","nodeType":"Function","startLoc":1652,"text":"def is_unity(self):\n        \"\"\"\n        Returns `True` if the unit is unscaled and dimensionless.\n        \"\"\"\n        return False"},{"col":4,"comment":"null","endLoc":848,"header":"def __rmul__(self, m)","id":3441,"name":"__rmul__","nodeType":"Function","startLoc":832,"text":"def __rmul__(self, m):\n        if isinstance(m, (bytes, str)):\n            return Unit(m) * self\n\n        # Cannot handle this as Unit.  Here, m cannot be a Quantity,\n        # so we make it into one, fasttracking when it does not have a unit\n        # for the common case of <array> * <unit>.\n        try:\n            from .quantity import Quantity\n            if hasattr(m, 'unit'):\n                result = Quantity(m)\n                result *= self\n                return result\n            else:\n                return Quantity(m, self)\n        except TypeError:\n            return NotImplemented"},{"col":4,"comment":"null","endLoc":1303,"header":"def __init__(self, bounding_boxes: Dict[Any, ModelBoundingBox], model,\n                 selector_args: _SelectorArguments, create_selector: Callable = None,\n                 ignored: List[int] = None, order: str = 'C')","id":3442,"name":"__init__","nodeType":"Function","startLoc":1294,"text":"def __init__(self, bounding_boxes: Dict[Any, ModelBoundingBox], model,\n                 selector_args: _SelectorArguments, create_selector: Callable = None,\n                 ignored: List[int] = None, order: str = 'C'):\n        super().__init__(model, ignored, order)\n\n        self._create_selector = create_selector\n        self._selector_args = _SelectorArguments.validate(model, selector_args)\n\n        self._bounding_boxes = {}\n        self._validate(bounding_boxes)"},{"col":4,"comment":"null","endLoc":194,"header":"def __init__(self, model, ignored: List[int] = None, order: str = 'C')","id":3443,"name":"__init__","nodeType":"Function","startLoc":191,"text":"def __init__(self, model, ignored: List[int] = None, order: str = 'C'):\n        self._model = model\n        self._ignored = self._validate_ignored(ignored)\n        self._order = self._get_order(order)"},{"col":4,"comment":"null","endLoc":855,"header":"def __rlshift__(self, m)","id":3444,"name":"__rlshift__","nodeType":"Function","startLoc":850,"text":"def __rlshift__(self, m):\n        try:\n            from .quantity import Quantity\n            return Quantity(m, self, copy=False, subok=True)\n        except Exception:\n            return NotImplemented"},{"col":4,"comment":"null","endLoc":244,"header":"def _validate_ignored(self, ignored: list) -> List[int]","id":3445,"name":"_validate_ignored","nodeType":"Function","startLoc":240,"text":"def _validate_ignored(self, ignored: list) -> List[int]:\n        if ignored is None:\n            return []\n        else:\n            return [self._get_index(key) for key in ignored]"},{"col":4,"comment":"\n        Get the input index corresponding to the given key.\n            Can pass in either:\n                the string name of the input or\n                the input index itself.\n        ","endLoc":230,"header":"def _get_index(self, key) -> int","id":3446,"name":"_get_index","nodeType":"Function","startLoc":222,"text":"def _get_index(self, key) -> int:\n        \"\"\"\n        Get the input index corresponding to the given key.\n            Can pass in either:\n                the string name of the input or\n                the input index itself.\n        \"\"\"\n\n        return get_index(self._model, key)"},{"col":0,"comment":"\n    Get the input index corresponding to the given key.\n        Can pass in either:\n            the string name of the input or\n            the input index itself.\n    ","endLoc":156,"header":"def get_index(model, key) -> int","id":3447,"name":"get_index","nodeType":"Function","startLoc":136,"text":"def get_index(model, key) -> int:\n    \"\"\"\n    Get the input index corresponding to the given key.\n        Can pass in either:\n            the string name of the input or\n            the input index itself.\n    \"\"\"\n    if isinstance(key, str):\n        if key in model.inputs:\n            index = model.inputs.index(key)\n        else:\n            raise ValueError(f\"'{key}' is not one of the inputs: {model.inputs}.\")\n    elif np.issubdtype(type(key), np.integer):\n        if 0 <= key < len(model.inputs):\n            index = key\n        else:\n            raise IndexError(f\"Integer key: {key} must be non-negative and < {len(model.inputs)}.\")\n    else:\n        raise ValueError(f\"Key value: {key} must be string or integer.\")\n\n    return index"},{"col":4,"comment":"null","endLoc":62,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3448,"name":"from_tree_transform","nodeType":"Function","startLoc":59,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        raise NotImplementedError(\n            \"Must be implemented in TransformType subclasses\")"},{"col":4,"comment":"null","endLoc":67,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":3449,"name":"from_tree","nodeType":"Function","startLoc":64,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        model = cls.from_tree_transform(node, ctx)\n        return cls._from_tree_base_transform_members(model, node, ctx)"},{"col":4,"comment":"\n        Get if bounding_box is C/python ordered or Fortran/mathematically\n        ordered\n        ","endLoc":220,"header":"def _get_order(self, order: str = None) -> str","id":3450,"name":"_get_order","nodeType":"Function","startLoc":208,"text":"def _get_order(self, order: str = None) -> str:\n        \"\"\"\n        Get if bounding_box is C/python ordered or Fortran/mathematically\n        ordered\n        \"\"\"\n        if order is None:\n            order = self._order\n\n        if order not in ('C', 'F'):\n            raise ValueError(\"order must be either 'C' (C/python order) or \"\n                             f\"'F' (Fortran/mathematical order), got: {order}.\")\n\n        return order"},{"col":4,"comment":"\n        Construct a valid Selector description for a CompoundBoundingBox.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        arguments :\n            The individual argument informations\n\n        kept_ignore :\n            Arguments to persist as ignored\n        ","endLoc":1140,"header":"@classmethod\n    def validate(cls, model, arguments, kept_ignore: List=None)","id":3451,"name":"validate","nodeType":"Function","startLoc":1108,"text":"@classmethod\n    def validate(cls, model, arguments, kept_ignore: List=None):\n        \"\"\"\n        Construct a valid Selector description for a CompoundBoundingBox.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        arguments :\n            The individual argument informations\n\n        kept_ignore :\n            Arguments to persist as ignored\n        \"\"\"\n        inputs = []\n        for argument in arguments:\n            _input = _SelectorArgument.validate(model, *argument)\n            if _input.index in [this.index for this in inputs]:\n                raise ValueError(f\"Input: '{get_name(model, _input.index)}' has been repeated.\")\n            inputs.append(_input)\n\n        if len(inputs) == 0:\n            raise ValueError(\"There must be at least one selector argument.\")\n\n        if isinstance(arguments, _SelectorArguments):\n            if kept_ignore is None:\n                kept_ignore = []\n\n            kept_ignore.extend(arguments.kept_ignore)\n\n        return cls(tuple(inputs), kept_ignore)"},{"col":4,"comment":"null","endLoc":861,"header":"def __rrshift__(self, m)","id":3452,"name":"__rrshift__","nodeType":"Function","startLoc":857,"text":"def __rrshift__(self, m):\n        warnings.warn(\">> is not implemented. Did you mean to convert \"\n                      \"to a Quantity with unit {} using '<<'?\".format(self),\n                      AstropyWarning)\n        return NotImplemented"},{"col":4,"comment":"null","endLoc":869,"header":"def __hash__(self)","id":3453,"name":"__hash__","nodeType":"Function","startLoc":863,"text":"def __hash__(self):\n        if self._hash is None:\n            parts = ([str(self.scale)] +\n                     [x.name for x in self.bases] +\n                     [str(x) for x in self.powers])\n            self._hash = hash(tuple(parts))\n        return self._hash"},{"col":4,"comment":"\n        Construct a valid selector argument for a CompoundBoundingBox.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The model for which this will be an argument for.\n        argument : int or str\n            A representation of which evaluation input to use\n        ignored : optional, bool\n            Whether or not to ignore this argument in the ModelBoundingBox.\n\n        Returns\n        -------\n        Validated selector_argument\n        ","endLoc":952,"header":"@classmethod\n    def validate(cls, model, argument, ignored: bool = True)","id":3454,"name":"validate","nodeType":"Function","startLoc":934,"text":"@classmethod\n    def validate(cls, model, argument, ignored: bool = True):\n        \"\"\"\n        Construct a valid selector argument for a CompoundBoundingBox.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The model for which this will be an argument for.\n        argument : int or str\n            A representation of which evaluation input to use\n        ignored : optional, bool\n            Whether or not to ignore this argument in the ModelBoundingBox.\n\n        Returns\n        -------\n        Validated selector_argument\n        \"\"\"\n        return cls(get_index(model, argument), ignored)"},{"col":4,"comment":"null","endLoc":119,"header":"@classmethod\n    def _to_tree_base_transform_members(cls, model, node, ctx)","id":3455,"name":"_to_tree_base_transform_members","nodeType":"Function","startLoc":69,"text":"@classmethod\n    def _to_tree_base_transform_members(cls, model, node, ctx):\n        if getattr(model, '_user_inverse', None) is not None:\n            node['inverse'] = model._user_inverse\n\n        if model.name is not None:\n            node['name'] = model.name\n\n        node['inputs'] = list(model.inputs)\n        node['outputs'] = list(model.outputs)\n\n        try:\n            bb = model.bounding_box\n        except NotImplementedError:\n            bb = None\n\n        if isinstance(bb, ModelBoundingBox):\n            bb = bb.bounding_box(order='C')\n\n            if model.n_inputs == 1:\n                bb = list(bb)\n            else:\n                bb = [list(item) for item in bb]\n            node['bounding_box'] = bb\n\n        elif isinstance(bb, CompoundBoundingBox):\n            selector_args = [[sa.index, sa.ignore] for sa in bb.selector_args]\n            node['selector_args'] = selector_args\n            node['cbbox_keys'] = list(bb.bounding_boxes.keys())\n\n            bounding_boxes = list(bb.bounding_boxes.values())\n            if len(model.inputs) - len(selector_args) == 1:\n                node['cbbox_values'] = [list(sbbox.bounding_box()) for sbbox in bounding_boxes]\n            else:\n                node['cbbox_values'] = [[list(item) for item in sbbox.bounding_box()\n                                         if np.isfinite(item[0])] for sbbox in bounding_boxes]\n\n        # model / parameter constraints\n        if not isinstance(model, CompoundModel):\n            fixed_nondefaults = {k: f for k, f in model.fixed.items() if f}\n            if fixed_nondefaults:\n                node['fixed'] = fixed_nondefaults\n            bounds_nondefaults = {k: b for k, b in model.bounds.items() if any(b)}\n            if bounds_nondefaults:\n                node['bounds'] = bounds_nondefaults\n\n        if not isinstance(model, CompoundModel):\n            if model.input_units_equivalencies:\n                node['input_units_equivalencies'] = model.input_units_equivalencies\n\n        return node"},{"col":0,"comment":"Encode a Table ``tbl`` that may have mixin columns to a Table with only\n    astropy Columns + appropriate meta-data to allow subsequent decoding.\n    ","endLoc":385,"header":"def _encode_mixins(tbl)","id":3456,"name":"_encode_mixins","nodeType":"Function","startLoc":316,"text":"def _encode_mixins(tbl):\n    \"\"\"Encode a Table ``tbl`` that may have mixin columns to a Table with only\n    astropy Columns + appropriate meta-data to allow subsequent decoding.\n    \"\"\"\n    # Determine if information will be lost without serializing meta.  This is hardcoded\n    # to the set difference between column info attributes and what FITS can store\n    # natively (name, dtype, unit).  See _get_col_attributes() in table/meta.py for where\n    # this comes from.\n    info_lost = any(any(getattr(col.info, attr, None) not in (None, {})\n                        for attr in ('description', 'meta'))\n                    for col in tbl.itercols())\n\n    # Convert the table to one with no mixins, only Column objects.  This adds\n    # meta data which is extracted with meta.get_yaml_from_table.  This ignores\n    # Time-subclass columns and leave them in the table so that the downstream\n    # FITS Time handling does the right thing.\n\n    with serialize_context_as('fits'):\n        encode_tbl = serialize.represent_mixins_as_columns(\n            tbl, exclude_classes=(Time,))\n\n    # If the encoded table is unchanged then there were no mixins.  But if there\n    # is column metadata (format, description, meta) that would be lost, then\n    # still go through the serialized columns machinery.\n    if encode_tbl is tbl and not info_lost:\n        return tbl\n\n    # Copy the meta dict if it was not copied by represent_mixins_as_columns.\n    # We will modify .meta['comments'] below and we do not want to see these\n    # comments in the input table.\n    if encode_tbl is tbl:\n        meta_copy = deepcopy(tbl.meta)\n        encode_tbl = Table(tbl.columns, meta=meta_copy, copy=False)\n\n    # Get the YAML serialization of information describing the table columns.\n    # This is re-using ECSV code that combined existing table.meta with with\n    # the extra __serialized_columns__ key.  For FITS the table.meta is handled\n    # by the native FITS connect code, so don't include that in the YAML\n    # output.\n    ser_col = '__serialized_columns__'\n\n    # encode_tbl might not have a __serialized_columns__ key if there were no mixins,\n    # but machinery below expects it to be available, so just make an empty dict.\n    encode_tbl.meta.setdefault(ser_col, {})\n\n    tbl_meta_copy = encode_tbl.meta.copy()\n    try:\n        encode_tbl.meta = {ser_col: encode_tbl.meta[ser_col]}\n        meta_yaml_lines = meta.get_yaml_from_table(encode_tbl)\n    finally:\n        encode_tbl.meta = tbl_meta_copy\n    del encode_tbl.meta[ser_col]\n\n    if 'comments' not in encode_tbl.meta:\n        encode_tbl.meta['comments'] = []\n    encode_tbl.meta['comments'].append('--BEGIN-ASTROPY-SERIALIZED-COLUMNS--')\n\n    for line in meta_yaml_lines:\n        if len(line) == 0:\n            lines = ['']\n        else:\n            # Split line into 70 character chunks for COMMENT cards\n            idxs = list(range(0, len(line) + 70, 70))\n            lines = [line[i0:i1] + '\\\\' for i0, i1 in zip(idxs[:-1], idxs[1:])]\n            lines[-1] = lines[-1][:-1]\n        encode_tbl.meta['comments'].extend(lines)\n\n    encode_tbl.meta['comments'].append('--END-ASTROPY-SERIALIZED-COLUMNS--')\n\n    return encode_tbl"},{"col":4,"comment":"null","endLoc":876,"header":"def __getstate__(self)","id":3457,"name":"__getstate__","nodeType":"Function","startLoc":871,"text":"def __getstate__(self):\n        # If we get pickled, we should *not* store the memoized hash since\n        # hashes of strings vary between sessions.\n        state = self.__dict__.copy()\n        state.pop('_hash', None)\n        return state"},{"col":4,"comment":"null","endLoc":932,"header":"def __new__(cls, index, ignore)","id":3458,"name":"__new__","nodeType":"Function","startLoc":929,"text":"def __new__(cls, index, ignore):\n        self = super().__new__(cls, index, ignore)\n\n        return self"},{"col":0,"comment":"Get the input name corresponding to the input index","endLoc":161,"header":"def get_name(model, index: int)","id":3459,"name":"get_name","nodeType":"Function","startLoc":159,"text":"def get_name(model, index: int):\n    \"\"\"Get the input name corresponding to the input index\"\"\"\n    return model.inputs[index]"},{"col":4,"comment":"null","endLoc":895,"header":"def __eq__(self, other)","id":3460,"name":"__eq__","nodeType":"Function","startLoc":878,"text":"def __eq__(self, other):\n        if self is other:\n            return True\n\n        try:\n            other = Unit(other, parse_strict='silent')\n        except (ValueError, UnitsError, TypeError):\n            return NotImplemented\n\n        # Other is unit-like, but the test below requires it is a UnitBase\n        # instance; if it is not, give up (so that other can try).\n        if not isinstance(other, UnitBase):\n            return NotImplemented\n\n        try:\n            return is_effectively_unity(self._to(other))\n        except UnitsError:\n            return False"},{"col":4,"comment":"\n        Returns the scale to the specified unit.\n\n        See `to`, except that a Unit object should be given (i.e., no\n        string), and that all defaults are used, i.e., no\n        equivalencies and value=1.\n        ","endLoc":1095,"header":"def _to(self, other)","id":3461,"name":"_to","nodeType":"Function","startLoc":1064,"text":"def _to(self, other):\n        \"\"\"\n        Returns the scale to the specified unit.\n\n        See `to`, except that a Unit object should be given (i.e., no\n        string), and that all defaults are used, i.e., no\n        equivalencies and value=1.\n        \"\"\"\n        # There are many cases where we just want to ensure a Quantity is\n        # of a particular unit, without checking whether it's already in\n        # a particular unit.  If we're being asked to convert from a unit\n        # to itself, we can short-circuit all of this.\n        if self is other:\n            return 1.0\n\n        # Don't presume decomposition is possible; e.g.,\n        # conversion to function units is through equivalencies.\n        if isinstance(other, UnitBase):\n            self_decomposed = self.decompose()\n            other_decomposed = other.decompose()\n\n            # Check quickly whether equivalent.  This is faster than\n            # `is_equivalent`, because it doesn't generate the entire\n            # physical type list of both units.  In other words it \"fails\n            # fast\".\n            if(self_decomposed.powers == other_decomposed.powers and\n               all(self_base is other_base for (self_base, other_base)\n                   in zip(self_decomposed.bases, other_decomposed.bases))):\n                return self_decomposed.scale / other_decomposed.scale\n\n        raise UnitConversionError(\n            f\"'{self!r}' is not a scaled version of '{other!r}'\")"},{"col":4,"comment":"null","endLoc":123,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3462,"name":"to_tree_transform","nodeType":"Function","startLoc":121,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        raise NotImplementedError(\"Must be implemented in TransformType subclasses\")"},{"col":4,"comment":"null","endLoc":1075,"header":"def __new__(cls, input_: Tuple[_SelectorArgument], kept_ignore: List = None)","id":3463,"name":"__new__","nodeType":"Function","startLoc":1067,"text":"def __new__(cls, input_: Tuple[_SelectorArgument], kept_ignore: List = None):\n        self = super().__new__(cls, input_)\n\n        if kept_ignore is None:\n            self._kept_ignore = []\n        else:\n            self._kept_ignore = kept_ignore\n\n        return self"},{"col":4,"comment":"null","endLoc":128,"header":"@classmethod\n    def to_tree(cls, model, ctx)","id":3464,"name":"to_tree","nodeType":"Function","startLoc":125,"text":"@classmethod\n    def to_tree(cls, model, ctx):\n        node = cls.to_tree_transform(model, ctx)\n        return cls._to_tree_base_transform_members(model, node, ctx)"},{"col":4,"comment":"null","endLoc":1376,"header":"def _validate(self, bounding_boxes: dict)","id":3465,"name":"_validate","nodeType":"Function","startLoc":1374,"text":"def _validate(self, bounding_boxes: dict):\n        for _selector, bounding_box in bounding_boxes.items():\n            self[_selector] = bounding_box"},{"col":4,"comment":"null","endLoc":898,"header":"def __ne__(self, other)","id":3466,"name":"__ne__","nodeType":"Function","startLoc":897,"text":"def __ne__(self, other):\n        return not (self == other)"},{"col":4,"comment":"null","endLoc":902,"header":"def __le__(self, other)","id":3467,"name":"__le__","nodeType":"Function","startLoc":900,"text":"def __le__(self, other):\n        scale = self._to(Unit(other))\n        return scale <= 1. or is_effectively_unity(scale)"},{"col":4,"comment":"null","endLoc":139,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3468,"name":"assert_equal","nodeType":"Function","startLoc":130,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        assert a.name == b.name\n        # TODO: Assert inverses are the same\n        # assert the bounding_boxes are the same\n        assert a.get_bounding_box() == b.get_bounding_box()\n        assert a.inputs == b.inputs\n        assert a.outputs == b.outputs\n        assert a.input_units_equivalencies == b.input_units_equivalencies"},{"col":4,"comment":"null","endLoc":906,"header":"def __ge__(self, other)","id":3469,"name":"__ge__","nodeType":"Function","startLoc":904,"text":"def __ge__(self, other):\n        scale = self._to(Unit(other))\n        return scale >= 1. or is_effectively_unity(scale)"},{"attributeType":"null","col":4,"comment":"null","endLoc":19,"id":3470,"name":"version","nodeType":"Attribute","startLoc":19,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":20,"id":3471,"name":"requires","nodeType":"Attribute","startLoc":20,"text":"requires"},{"className":"NpUfuncType","col":0,"comment":"null","endLoc":29,"id":3472,"nodeType":"Class","startLoc":16,"text":"class NpUfuncType(TransformType):\n    name = \"transform/math_functions\"\n    version = '1.0.0'\n    types = ['astropy.modeling.math_functions.'+ kl for kl in math_classes]\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        klass_name = math_functions._make_class_name(node['func_name'])\n        klass = getattr(math_functions, klass_name)\n        return klass()\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        return {'func_name': model.func.__name__}"},{"col":4,"comment":"null","endLoc":25,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3473,"name":"from_tree_transform","nodeType":"Function","startLoc":21,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        klass_name = math_functions._make_class_name(node['func_name'])\n        klass = getattr(math_functions, klass_name)\n        return klass()"},{"col":4,"comment":"null","endLoc":909,"header":"def __lt__(self, other)","id":3474,"name":"__lt__","nodeType":"Function","startLoc":908,"text":"def __lt__(self, other):\n        return not (self >= other)"},{"col":4,"comment":"null","endLoc":912,"header":"def __gt__(self, other)","id":3475,"name":"__gt__","nodeType":"Function","startLoc":911,"text":"def __gt__(self, other):\n        return not (self <= other)"},{"col":4,"comment":"null","endLoc":915,"header":"def __neg__(self)","id":3476,"name":"__neg__","nodeType":"Function","startLoc":914,"text":"def __neg__(self):\n        return self * -1."},{"col":4,"comment":"\n        Returns `True` if this unit is equivalent to ``other``.\n\n        Parameters\n        ----------\n        other : `~astropy.units.Unit`, str, or tuple\n            The unit to convert to. If a tuple of units is specified, this\n            method returns true if the unit matches any of those in the tuple.\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            This list is in addition to possible global defaults set by, e.g.,\n            `set_enabled_equivalencies`.\n            Use `None` to turn off all equivalencies.\n\n        Returns\n        -------\n        bool\n        ","endLoc":946,"header":"def is_equivalent(self, other, equivalencies=[])","id":3477,"name":"is_equivalent","nodeType":"Function","startLoc":917,"text":"def is_equivalent(self, other, equivalencies=[]):\n        \"\"\"\n        Returns `True` if this unit is equivalent to ``other``.\n\n        Parameters\n        ----------\n        other : `~astropy.units.Unit`, str, or tuple\n            The unit to convert to. If a tuple of units is specified, this\n            method returns true if the unit matches any of those in the tuple.\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            This list is in addition to possible global defaults set by, e.g.,\n            `set_enabled_equivalencies`.\n            Use `None` to turn off all equivalencies.\n\n        Returns\n        -------\n        bool\n        \"\"\"\n        equivalencies = self._normalize_equivalencies(equivalencies)\n\n        if isinstance(other, tuple):\n            return any(self.is_equivalent(u, equivalencies=equivalencies)\n                       for u in other)\n\n        other = Unit(other, parse_strict='silent')\n\n        return self._is_equivalent(other, equivalencies)"},{"col":0,"comment":" Make a ufunc model class name from the name of the ufunc. ","endLoc":44,"header":"def _make_class_name(name)","id":3478,"name":"_make_class_name","nodeType":"Function","startLoc":42,"text":"def _make_class_name(name):\n    \"\"\" Make a ufunc model class name from the name of the ufunc. \"\"\"\n    return name[0].upper() + name[1:] + 'Ufunc'"},{"className":"BlackBody","col":0,"comment":"null","endLoc":38,"id":3479,"nodeType":"Class","startLoc":15,"text":"class BlackBody(TransformType):\n    name = 'transform/blackbody'\n    version = '1.0.0'\n    types = ['astropy.modeling.physical_models.BlackBody']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return physical_models.BlackBody(scale=node['scale'],\n                                         temperature=node['temperature'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'scale': _parameter_to_value(model.scale),\n                'temperature': _parameter_to_value(model.temperature)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, physical_models.BlackBody) and\n                isinstance(b, physical_models.BlackBody))\n        assert_array_equal(a.scale, b.scale)\n        assert_array_equal(a.temperature, b.temperature)"},{"col":4,"comment":"null","endLoc":23,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3480,"name":"from_tree_transform","nodeType":"Function","startLoc":20,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return physical_models.BlackBody(scale=node['scale'],\n                                         temperature=node['temperature'])"},{"col":4,"comment":"null","endLoc":29,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3481,"name":"to_tree_transform","nodeType":"Function","startLoc":27,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        return {'func_name': model.func.__name__}"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":3482,"name":"name","nodeType":"Attribute","startLoc":17,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":3483,"name":"version","nodeType":"Attribute","startLoc":18,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":19,"id":3484,"name":"types","nodeType":"Attribute","startLoc":19,"text":"types"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":3485,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"math.py#<anonymous>","id":3486,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['NpUfuncType']"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/transform","id":3487,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nimport astropy.units as u\n\n\ndef _parameter_to_value(param):\n    if param.unit is not None:\n        return u.Quantity(param)\n    else:\n        return param.value\n"},{"fileName":"functional_models.py","filePath":"astropy/io/misc/asdf/tags/transform","id":3488,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nfrom numpy.testing import assert_array_equal\n\nfrom astropy.modeling import functional_models\nfrom .basic import TransformType\nfrom . import _parameter_to_value\n\n\n__all__ = ['AiryDisk2DType', 'Box1DType', 'Box2DType',\n           'Disk2DType', 'Ellipse2DType', 'Exponential1DType',\n           'Gaussian1DType', 'Gaussian2DType', 'KingProjectedAnalytic1DType',\n           'Logarithmic1DType', 'Lorentz1DType', 'Moffat1DType',\n           'Moffat2DType', 'Planar2D', 'RedshiftScaleFactorType',\n           'RickerWavelet1DType', 'RickerWavelet2DType', 'Ring2DType',\n           'Sersic1DType', 'Sersic2DType',\n           'Sine1DType', 'Cosine1DType', 'Tangent1DType',\n           'ArcSine1DType', 'ArcCosine1DType', 'ArcTangent1DType',\n           'Trapezoid1DType', 'TrapezoidDisk2DType', 'Voigt1DType']\n\n\nclass AiryDisk2DType(TransformType):\n    name = 'transform/airy_disk2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.AiryDisk2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.AiryDisk2D(amplitude=node['amplitude'],\n                                            x_0=node['x_0'],\n                                            y_0=node['y_0'],\n                                            radius=node['radius'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'radius': _parameter_to_value(model.radius)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.AiryDisk2D) and\n                isinstance(b, functional_models.AiryDisk2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.radius, b.radius)\n\n\nclass Box1DType(TransformType):\n    name = 'transform/box1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Box1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Box1D(amplitude=node['amplitude'],\n                                       x_0=node['x_0'],\n                                       width=node['width'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'width': _parameter_to_value(model.width)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Box1D) and\n                isinstance(b, functional_models.Box1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.width, b.width)\n\n\nclass Box2DType(TransformType):\n    name = 'transform/box2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Box2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Box2D(amplitude=node['amplitude'],\n                                       x_0=node['x_0'],\n                                       x_width=node['x_width'],\n                                       y_0=node['y_0'],\n                                       y_width=node['y_width'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'x_width': _parameter_to_value(model.x_width),\n                'y_0': _parameter_to_value(model.y_0),\n                'y_width': _parameter_to_value(model.y_width)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Box2D) and\n                isinstance(b, functional_models.Box2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.x_width, b.x_width)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.y_width, b.y_width)\n\n\nclass Disk2DType(TransformType):\n    name = 'transform/disk2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Disk2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Disk2D(amplitude=node['amplitude'],\n                                        x_0=node['x_0'],\n                                        y_0=node['y_0'],\n                                        R_0=node['R_0'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'R_0': _parameter_to_value(model.R_0)}\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Disk2D) and\n                isinstance(b, functional_models.Disk2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.R_0, b.R_0)\n\n\nclass Ellipse2DType(TransformType):\n    name = 'transform/ellipse2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Ellipse2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Ellipse2D(amplitude=node['amplitude'],\n                                           x_0=node['x_0'],\n                                           y_0=node['y_0'],\n                                           a=node['a'],\n                                           b=node['b'],\n                                           theta=node['theta'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'a': _parameter_to_value(model.a),\n                'b': _parameter_to_value(model.b),\n                'theta': _parameter_to_value(model.theta)}\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Ellipse2D) and\n                isinstance(b, functional_models.Ellipse2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.a, b.a)\n        assert_array_equal(a.b, b.b)\n        assert_array_equal(a.theta, b.theta)\n\n\nclass Exponential1DType(TransformType):\n    name = 'transform/exponential1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Exponential1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Exponential1D(amplitude=node['amplitude'],\n                                               tau=node['tau'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'tau': _parameter_to_value(model.tau)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Exponential1D) and\n                isinstance(b, functional_models.Exponential1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.tau, b.tau)\n\n\nclass Gaussian1DType(TransformType):\n    name = 'transform/gaussian1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Gaussian1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Gaussian1D(amplitude=node['amplitude'],\n                                            mean=node['mean'],\n                                            stddev=node['stddev'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'mean': _parameter_to_value(model.mean),\n                'stddev': _parameter_to_value(model.stddev)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Gaussian1D) and\n                isinstance(b, functional_models.Gaussian1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.mean, b.mean)\n        assert_array_equal(a.stddev, b.stddev)\n\n\nclass Gaussian2DType(TransformType):\n    name = 'transform/gaussian2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Gaussian2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Gaussian2D(amplitude=node['amplitude'],\n                                            x_mean=node['x_mean'],\n                                            y_mean=node['y_mean'],\n                                            x_stddev=node['x_stddev'],\n                                            y_stddev=node['y_stddev'],\n                                            theta=node['theta'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_mean': _parameter_to_value(model.x_mean),\n                'y_mean': _parameter_to_value(model.y_mean),\n                'x_stddev': _parameter_to_value(model.x_stddev),\n                'y_stddev': _parameter_to_value(model.y_stddev),\n                'theta': _parameter_to_value(model.theta)}\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Gaussian2D) and\n                isinstance(b, functional_models.Gaussian2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_mean, b.x_mean)\n        assert_array_equal(a.y_mean, b.y_mean)\n        assert_array_equal(a.x_stddev, b.x_stddev)\n        assert_array_equal(a.y_stddev, b.y_stddev)\n        assert_array_equal(a.theta, b.theta)\n\n\nclass KingProjectedAnalytic1DType(TransformType):\n    name = 'transform/king_projected_analytic1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.KingProjectedAnalytic1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.KingProjectedAnalytic1D(\n                                            amplitude=node['amplitude'],\n                                            r_core=node['r_core'],\n                                            r_tide=node['r_tide'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'r_core': _parameter_to_value(model.r_core),\n                'r_tide': _parameter_to_value(model.r_tide)}\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.KingProjectedAnalytic1D) and\n                isinstance(b, functional_models.KingProjectedAnalytic1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.r_core, b.r_core)\n        assert_array_equal(a.r_tide, b.r_tide)\n\n\nclass Logarithmic1DType(TransformType):\n    name = 'transform/logarithmic1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Logarithmic1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Logarithmic1D(amplitude=node['amplitude'],\n                                               tau=node['tau'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'tau': _parameter_to_value(model.tau)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Logarithmic1D) and\n                isinstance(b, functional_models.Logarithmic1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.tau, b.tau)\n\n\nclass Lorentz1DType(TransformType):\n    name = 'transform/lorentz1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Lorentz1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Lorentz1D(amplitude=node['amplitude'],\n                                           x_0=node['x_0'],\n                                           fwhm=node['fwhm'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'fwhm': _parameter_to_value(model.fwhm)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Lorentz1D) and\n                isinstance(b, functional_models.Lorentz1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.fwhm, b.fwhm)\n\n\nclass Moffat1DType(TransformType):\n    name = 'transform/moffat1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Moffat1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Moffat1D(amplitude=node['amplitude'],\n                                          x_0=node['x_0'],\n                                          gamma=node['gamma'],\n                                          alpha=node['alpha'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'gamma': _parameter_to_value(model.gamma),\n                'alpha': _parameter_to_value(model.alpha)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Moffat1D) and\n                isinstance(b, functional_models.Moffat1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.gamma, b.gamma)\n        assert_array_equal(a.alpha, b.alpha)\n\n\nclass Moffat2DType(TransformType):\n    name = 'transform/moffat2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Moffat2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Moffat2D(amplitude=node['amplitude'],\n                                          x_0=node['x_0'],\n                                          y_0=node['y_0'],\n                                          gamma=node['gamma'],\n                                          alpha=node['alpha'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'gamma': _parameter_to_value(model.gamma),\n                'alpha': _parameter_to_value(model.alpha)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Moffat2D) and\n                isinstance(b, functional_models.Moffat2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.gamma, b.gamma)\n        assert_array_equal(a.alpha, b.alpha)\n\n\nclass Planar2D(TransformType):\n    name = 'transform/planar2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Planar2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Planar2D(slope_x=node['slope_x'],\n                                          slope_y=node['slope_y'],\n                                          intercept=node['intercept'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'slope_x': _parameter_to_value(model.slope_x),\n                'slope_y': _parameter_to_value(model.slope_y),\n                'intercept': _parameter_to_value(model.intercept)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Planar2D) and\n                isinstance(b, functional_models.Planar2D))\n        assert_array_equal(a.slope_x, b.slope_x)\n        assert_array_equal(a.slope_y, b.slope_y)\n        assert_array_equal(a.intercept, b.intercept)\n\n\nclass RedshiftScaleFactorType(TransformType):\n    name = 'transform/redshift_scale_factor'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.RedshiftScaleFactor']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.RedshiftScaleFactor(z=node['z'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'z': _parameter_to_value(model.z)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.RedshiftScaleFactor) and\n                isinstance(b, functional_models.RedshiftScaleFactor))\n        assert_array_equal(a.z, b.z)\n\n\nclass RickerWavelet1DType(TransformType):\n    name = 'transform/ricker_wavelet1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.RickerWavelet1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.RickerWavelet1D(amplitude=node['amplitude'],\n                                                 x_0=node['x_0'],\n                                                 sigma=node['sigma'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'sigma': _parameter_to_value(model.sigma)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.RickerWavelet1D) and\n                isinstance(b, functional_models.RickerWavelet1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.sigma, b.sigma)\n\n\nclass RickerWavelet2DType(TransformType):\n    name = 'transform/ricker_wavelet2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.RickerWavelet2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.RickerWavelet2D(amplitude=node['amplitude'],\n                                                 x_0=node['x_0'],\n                                                 y_0=node['y_0'],\n                                                 sigma=node['sigma'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'sigma': _parameter_to_value(model.sigma)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.RickerWavelet2D) and\n                isinstance(b, functional_models.RickerWavelet2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.sigma, b.sigma)\n\n\nclass Ring2DType(TransformType):\n    name = 'transform/ring2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Ring2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Ring2D(amplitude=node['amplitude'],\n                                        x_0=node['x_0'],\n                                        y_0=node['y_0'],\n                                        r_in=node['r_in'],\n                                        width=node['width'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'r_in': _parameter_to_value(model.r_in),\n                'width': _parameter_to_value(model.width)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Ring2D) and\n                isinstance(b, functional_models.Ring2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.r_in, b.r_in)\n        assert_array_equal(a.width, b.width)\n\n\nclass Sersic1DType(TransformType):\n    name = 'transform/sersic1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Sersic1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Sersic1D(amplitude=node['amplitude'],\n                                          r_eff=node['r_eff'],\n                                          n=node['n'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'r_eff': _parameter_to_value(model.r_eff),\n                'n': _parameter_to_value(model.n)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Sersic1D) and\n                isinstance(b, functional_models.Sersic1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.r_eff, b.r_eff)\n        assert_array_equal(a.n, b.n)\n\n\nclass Sersic2DType(TransformType):\n    name = 'transform/sersic2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Sersic2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Sersic2D(amplitude=node['amplitude'],\n                                          r_eff=node['r_eff'],\n                                          n=node['n'],\n                                          x_0=node['x_0'],\n                                          y_0=node['y_0'],\n                                          ellip=node['ellip'],\n                                          theta=node['theta'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'r_eff': _parameter_to_value(model.r_eff),\n                'n': _parameter_to_value(model.n),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'ellip': _parameter_to_value(model.ellip),\n                'theta': _parameter_to_value(model.theta)\n\n                }\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Sersic2D) and\n                isinstance(b, functional_models.Sersic2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.r_eff, b.r_eff)\n        assert_array_equal(a.n, b.n)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.ellip, b.ellip)\n        assert_array_equal(a.theta, b.theta)\n\n\nclass Trigonometric1DType(TransformType):\n    _model = None\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return cls._model(amplitude=node['amplitude'],\n                          frequency=node['frequency'],\n                          phase=node['phase'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'frequency': _parameter_to_value(model.frequency),\n                'phase': _parameter_to_value(model.phase)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, cls._model) and\n                isinstance(b, cls._model))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.frequency, b.frequency)\n        assert_array_equal(a.phase, b.phase)\n\n\nclass Sine1DType(Trigonometric1DType):\n    name = 'transform/sine1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Sine1D']\n\n    _model = functional_models.Sine1D\n\n\nclass Cosine1DType(Trigonometric1DType):\n    name = 'transform/cosine1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Cosine1D']\n\n    _model = functional_models.Cosine1D\n\n\nclass Tangent1DType(Trigonometric1DType):\n    name = 'transform/tangent1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Tangent1D']\n\n    _model = functional_models.Tangent1D\n\n\nclass ArcSine1DType(Trigonometric1DType):\n    name = 'transform/arcsine1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.ArcSine1D']\n\n    _model = functional_models.ArcSine1D\n\n\nclass ArcCosine1DType(Trigonometric1DType):\n    name = 'transform/arccosine1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.ArcCosine1D']\n\n    _model = functional_models.ArcCosine1D\n\n\nclass ArcTangent1DType(Trigonometric1DType):\n    name = 'transform/arctangent1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.ArcTangent1D']\n\n    _model = functional_models.ArcTangent1D\n\n\nclass Trapezoid1DType(TransformType):\n    name = 'transform/trapezoid1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Trapezoid1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Trapezoid1D(amplitude=node['amplitude'],\n                                             x_0=node['x_0'],\n                                             width=node['width'],\n                                             slope=node['slope'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'width': _parameter_to_value(model.width),\n                'slope': _parameter_to_value(model.slope)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Trapezoid1D) and\n                isinstance(b, functional_models.Trapezoid1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.width, b.width)\n        assert_array_equal(a.slope, b.slope)\n\n\nclass TrapezoidDisk2DType(TransformType):\n    name = 'transform/trapezoid_disk2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.TrapezoidDisk2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.TrapezoidDisk2D(amplitude=node['amplitude'],\n                                                 x_0=node['x_0'],\n                                                 y_0=node['y_0'],\n                                                 R_0=node['R_0'],\n                                                 slope=node['slope'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'R_0': _parameter_to_value(model.R_0),\n                'slope': _parameter_to_value(model.slope)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.TrapezoidDisk2D) and\n                isinstance(b, functional_models.TrapezoidDisk2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.R_0, b.R_0)\n        assert_array_equal(a.slope, b.slope)\n\n\nclass Voigt1DType(TransformType):\n    name = 'transform/voigt1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Voigt1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Voigt1D(x_0=node['x_0'],\n                                         amplitude_L=node['amplitude_L'],\n                                         fwhm_L=node['fwhm_L'],\n                                         fwhm_G=node['fwhm_G'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'x_0': _parameter_to_value(model.x_0),\n                'amplitude_L': _parameter_to_value(model.amplitude_L),\n                'fwhm_L': _parameter_to_value(model.fwhm_L),\n                'fwhm_G': _parameter_to_value(model.fwhm_G)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Voigt1D) and\n                isinstance(b, functional_models.Voigt1D))\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.amplitude_L, b.amplitude_L)\n        assert_array_equal(a.fwhm_L, b.fwhm_L)\n        assert_array_equal(a.fwhm_G, b.fwhm_G)\n"},{"col":0,"comment":"\n    Write a Table object to a FITS file\n\n    Parameters\n    ----------\n    input : Table\n        The table to write out.\n    output : str\n        The filename to write the table to.\n    overwrite : bool\n        Whether to overwrite any existing file without warning.\n    append : bool\n        Whether to append the table to an existing file\n    ","endLoc":420,"header":"def write_table_fits(input, output, overwrite=False, append=False)","id":3489,"name":"write_table_fits","nodeType":"Function","startLoc":388,"text":"def write_table_fits(input, output, overwrite=False, append=False):\n    \"\"\"\n    Write a Table object to a FITS file\n\n    Parameters\n    ----------\n    input : Table\n        The table to write out.\n    output : str\n        The filename to write the table to.\n    overwrite : bool\n        Whether to overwrite any existing file without warning.\n    append : bool\n        Whether to append the table to an existing file\n    \"\"\"\n\n    # Encode any mixin columns into standard Columns.\n    input = _encode_mixins(input)\n\n    table_hdu = table_to_hdu(input, character_as_bytes=True)\n\n    # Check if output file already exists\n    if isinstance(output, str) and os.path.exists(output):\n        if overwrite:\n            os.remove(output)\n        elif not append:\n            raise OSError(NOT_OVERWRITING_MSG.format(output))\n\n    if append:\n        # verify=False stops it reading and checking the existing file.\n        fits_append(output, table_hdu.data, table_hdu.header, verify=False)\n    else:\n        table_hdu.writeto(output)"},{"col":4,"comment":"Returns `True` if this unit is equivalent to `other`.\n        See `is_equivalent`, except that a proper Unit object should be\n        given (i.e., no string) and that the equivalency list should be\n        normalized using `_normalize_equivalencies`.\n        ","endLoc":977,"header":"def _is_equivalent(self, other, equivalencies=[])","id":3491,"name":"_is_equivalent","nodeType":"Function","startLoc":948,"text":"def _is_equivalent(self, other, equivalencies=[]):\n        \"\"\"Returns `True` if this unit is equivalent to `other`.\n        See `is_equivalent`, except that a proper Unit object should be\n        given (i.e., no string) and that the equivalency list should be\n        normalized using `_normalize_equivalencies`.\n        \"\"\"\n        if isinstance(other, UnrecognizedUnit):\n            return False\n\n        if (self._get_physical_type_id() ==\n                other._get_physical_type_id()):\n            return True\n        elif len(equivalencies):\n            unit = self.decompose()\n            other = other.decompose()\n            for a, b, forward, backward in equivalencies:\n                if b is None:\n                    # after canceling, is what's left convertible\n                    # to dimensionless (according to the equivalency)?\n                    try:\n                        (other/unit).decompose([a])\n                        return True\n                    except Exception:\n                        pass\n                else:\n                    if(a._is_equivalent(unit) and b._is_equivalent(other) or\n                       b._is_equivalent(unit) and a._is_equivalent(other)):\n                        return True\n\n        return False"},{"col":4,"comment":"\n        Internal function (used from `_get_converter`) to apply\n        equivalence pairs.\n        ","endLoc":1024,"header":"def _apply_equivalencies(self, unit, other, equivalencies)","id":3492,"name":"_apply_equivalencies","nodeType":"Function","startLoc":979,"text":"def _apply_equivalencies(self, unit, other, equivalencies):\n        \"\"\"\n        Internal function (used from `_get_converter`) to apply\n        equivalence pairs.\n        \"\"\"\n        def make_converter(scale1, func, scale2):\n            def convert(v):\n                return func(_condition_arg(v) / scale1) * scale2\n            return convert\n\n        for funit, tunit, a, b in equivalencies:\n            if tunit is None:\n                try:\n                    ratio_in_funit = (other.decompose() /\n                                      unit.decompose()).decompose([funit])\n                    return make_converter(ratio_in_funit.scale, a, 1.)\n                except UnitsError:\n                    pass\n            else:\n                try:\n                    scale1 = funit._to(unit)\n                    scale2 = tunit._to(other)\n                    return make_converter(scale1, a, scale2)\n                except UnitsError:\n                    pass\n                try:\n                    scale1 = tunit._to(unit)\n                    scale2 = funit._to(other)\n                    return make_converter(scale1, b, scale2)\n                except UnitsError:\n                    pass\n\n        def get_err_str(unit):\n            unit_str = unit.to_string('unscaled')\n            physical_type = unit.physical_type\n            if physical_type != 'unknown':\n                unit_str = f\"'{unit_str}' ({physical_type})\"\n            else:\n                unit_str = f\"'{unit_str}'\"\n            return unit_str\n\n        unit_str = get_err_str(unit)\n        other_str = get_err_str(other)\n\n        raise UnitConversionError(\n            f\"{unit_str} and {other_str} are not convertible\")"},{"col":0,"comment":"\n    Validate value is acceptable for conversion purposes.\n\n    Will convert into an array if not a scalar, and can be converted\n    into an array\n\n    Parameters\n    ----------\n    value : int or float value, or sequence of such values\n\n    Returns\n    -------\n    Scalar value or numpy array\n\n    Raises\n    ------\n    ValueError\n        If value is not as expected\n    ","endLoc":2557,"header":"def _condition_arg(value)","id":3493,"name":"_condition_arg","nodeType":"Function","startLoc":2530,"text":"def _condition_arg(value):\n    \"\"\"\n    Validate value is acceptable for conversion purposes.\n\n    Will convert into an array if not a scalar, and can be converted\n    into an array\n\n    Parameters\n    ----------\n    value : int or float value, or sequence of such values\n\n    Returns\n    -------\n    Scalar value or numpy array\n\n    Raises\n    ------\n    ValueError\n        If value is not as expected\n    \"\"\"\n    if isinstance(value, (np.ndarray, float, int, complex, np.void)):\n        return value\n\n    avalue = np.array(value)\n    if avalue.dtype.kind not in ['i', 'f', 'c']:\n        raise ValueError(\"Value not scalar compatible or convertible to \"\n                         \"an int, float, or complex array\")\n    return avalue"},{"className":"AiryDisk2DType","col":0,"comment":"null","endLoc":52,"id":3494,"nodeType":"Class","startLoc":23,"text":"class AiryDisk2DType(TransformType):\n    name = 'transform/airy_disk2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.AiryDisk2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.AiryDisk2D(amplitude=node['amplitude'],\n                                            x_0=node['x_0'],\n                                            y_0=node['y_0'],\n                                            radius=node['radius'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'radius': _parameter_to_value(model.radius)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.AiryDisk2D) and\n                isinstance(b, functional_models.AiryDisk2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.radius, b.radius)"},{"attributeType":"null","col":16,"comment":"null","endLoc":9,"id":3495,"name":"np","nodeType":"Attribute","startLoc":9,"text":"np"},{"attributeType":"null","col":35,"comment":"null","endLoc":11,"id":3496,"name":"io_registry","nodeType":"Attribute","startLoc":11,"text":"io_registry"},{"attributeType":"null","col":29,"comment":"null","endLoc":12,"id":3497,"name":"u","nodeType":"Attribute","startLoc":12,"text":"u"},{"attributeType":"null","col":67,"comment":"null","endLoc":19,"id":3498,"name":"fits_append","nodeType":"Attribute","startLoc":19,"text":"fits_append"},{"attributeType":"null","col":37,"comment":"null","endLoc":22,"id":3499,"name":"fits_open","nodeType":"Attribute","startLoc":22,"text":"fits_open"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":3500,"name":"REMOVE_KEYWORDS","nodeType":"Attribute","startLoc":27,"text":"REMOVE_KEYWORDS"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":3501,"name":"COLUMN_KEYWORD_REGEXP","nodeType":"Attribute","startLoc":31,"text":"COLUMN_KEYWORD_REGEXP"},{"col":0,"comment":"","endLoc":4,"header":"connect.py#<anonymous>","id":3502,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"REMOVE_KEYWORDS = ['XTENSION', 'BITPIX', 'NAXIS', 'NAXIS1', 'NAXIS2',\n                   'PCOUNT', 'GCOUNT', 'TFIELDS', 'THEAP']\n\nCOLUMN_KEYWORD_REGEXP = '(' + '|'.join(KEYWORD_NAMES) + ')[0-9]+'\n\nio_registry.register_reader('fits', Table, read_table_fits)\n\nio_registry.register_writer('fits', Table, write_table_fits)\n\nio_registry.register_identifier('fits', Table, is_fits)"},{"col":4,"comment":"null","endLoc":33,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3504,"name":"from_tree_transform","nodeType":"Function","startLoc":28,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.AiryDisk2D(amplitude=node['amplitude'],\n                                            x_0=node['x_0'],\n                                            y_0=node['y_0'],\n                                            radius=node['radius'])"},{"col":4,"comment":"null","endLoc":791,"header":"@property\n    def n_inputs(self)","id":3506,"name":"n_inputs","nodeType":"Function","startLoc":778,"text":"@property\n    def n_inputs(self):\n        # TODO: remove the code in the ``if`` block when support\n        # for models with ``inputs`` as class variables is removed.\n        if hasattr(self.__class__, 'n_inputs') and isinstance(self.__class__.n_inputs, property):\n            try:\n                return len(self.__class__.inputs)\n            except TypeError:\n                try:\n                    return len(self.inputs)\n                except AttributeError:\n                    return 0\n\n        return self.__class__.n_inputs"},{"col":4,"comment":"Get a converter for values in ``self`` to ``other``.\n\n        If no conversion is necessary, returns ``unit_scale_converter``\n        (which is used as a check in quantity helpers).\n\n        ","endLoc":1062,"header":"def _get_converter(self, other, equivalencies=[])","id":3507,"name":"_get_converter","nodeType":"Function","startLoc":1026,"text":"def _get_converter(self, other, equivalencies=[]):\n        \"\"\"Get a converter for values in ``self`` to ``other``.\n\n        If no conversion is necessary, returns ``unit_scale_converter``\n        (which is used as a check in quantity helpers).\n\n        \"\"\"\n\n        # First see if it is just a scaling.\n        try:\n            scale = self._to(other)\n        except UnitsError:\n            pass\n        else:\n            if scale == 1.:\n                return unit_scale_converter\n            else:\n                return lambda val: scale * _condition_arg(val)\n\n        # if that doesn't work, maybe we can do it with equivalencies?\n        try:\n            return self._apply_equivalencies(\n                self, other, self._normalize_equivalencies(equivalencies))\n        except UnitsError as exc:\n            # Last hope: maybe other knows how to do it?\n            # We assume the equivalencies have the unit itself as first item.\n            # TODO: maybe better for other to have a `_back_converter` method?\n            if hasattr(other, 'equivalencies'):\n                for funit, tunit, a, b in other.equivalencies:\n                    if other is funit:\n                        try:\n                            return lambda v: b(self._get_converter(\n                                tunit, equivalencies=equivalencies)(v))\n                        except Exception:\n                            pass\n\n            raise exc"},{"fileName":"spline.py","filePath":"astropy/io/misc/asdf/tags/transform","id":3508,"nodeType":"File","text":"from .basic import TransformType\nfrom astropy.modeling.models import Spline1D\n\n\n__all__ = ['SplineType']\n\n\nclass SplineType(TransformType):\n    name = 'transform/spline1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.spline.Spline1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return Spline1D(knots=node['knots'],\n                        coeffs=node['coefficients'],\n                        degree=node['degree'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        return {\n            \"knots\": model.t,\n            \"coefficients\": model.c,\n            \"degree\": model.degree\n        }\n"},{"col":23,"endLoc":1043,"id":3509,"nodeType":"Lambda","startLoc":1043,"text":"lambda val: scale * _condition_arg(val)"},{"className":"Spline1D","col":0,"comment":"\n    One dimensional Spline Model\n\n    Parameters\n    ----------\n    knots :  optional\n        Define the knots for the spline. Can be 1) the number of interior\n        knots for the spline, 2) the array of all knots for the spline, or\n        3) If both bounds are defined, the interior knots for the spline\n    coeffs : optional\n        The array of knot coefficients for the spline\n    degree : optional\n        The degree of the spline. It must be 1 <= degree <= 5, default is 3.\n    bounds : optional\n        The upper and lower bounds of the spline.\n\n    Notes\n    -----\n    Much of the functionality of this model is provided by\n    `scipy.interpolate.BSpline` which can be directly accessed via the\n    bspline property.\n\n    Fitting for this model is provided by wrappers for:\n    `scipy.interpolate.UnivariateSpline`,\n    `scipy.interpolate.InterpolatedUnivariateSpline`,\n    and `scipy.interpolate.LSQUnivariateSpline`.\n\n    If one fails to define any knots/coefficients, no parameters will\n    be added to this model until a fitter is called. This is because\n    some of the fitters for splines vary the number of parameters and so\n    we cannot define the parameter set until after fitting in these cases.\n\n    Since parameters are not necessarily known at model initialization,\n    setting model parameters directly via the model interface has been\n    disabled.\n\n    Direct constructors are provided for this model which incorporate the\n    fitting to data directly into model construction.\n\n    Knot parameters are declared as \"fixed\" parameters by default to\n    enable the use of other `astropy.modeling` fitters to be used to\n    fit this model.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.modeling.models import Spline1D\n    >>> from astropy.modeling import fitting\n    >>> np.random.seed(42)\n    >>> x = np.linspace(-3, 3, 50)\n    >>> y = np.exp(-x**2) + 0.1 * np.random.randn(50)\n    >>> xs = np.linspace(-3, 3, 1000)\n\n    A 1D interpolating spline can be fit to data:\n\n    >>> fitter = fitting.SplineInterpolateFitter()\n    >>> spl = fitter(Spline1D(), x, y)\n\n    Similarly, a smoothing spline can be fit to data:\n\n    >>> fitter = fitting.SplineSmoothingFitter()\n    >>> spl = fitter(Spline1D(), x, y, s=0.5)\n\n    Similarly, a spline can be fit to data using an exact set of interior knots:\n\n    >>> t = [-1, 0, 1]\n    >>> fitter = fitting.SplineExactKnotsFitter()\n    >>> spl = fitter(Spline1D(), x, y, t=t)\n    ","endLoc":538,"id":3510,"nodeType":"Class","startLoc":203,"text":"class Spline1D(_Spline):\n    \"\"\"\n    One dimensional Spline Model\n\n    Parameters\n    ----------\n    knots :  optional\n        Define the knots for the spline. Can be 1) the number of interior\n        knots for the spline, 2) the array of all knots for the spline, or\n        3) If both bounds are defined, the interior knots for the spline\n    coeffs : optional\n        The array of knot coefficients for the spline\n    degree : optional\n        The degree of the spline. It must be 1 <= degree <= 5, default is 3.\n    bounds : optional\n        The upper and lower bounds of the spline.\n\n    Notes\n    -----\n    Much of the functionality of this model is provided by\n    `scipy.interpolate.BSpline` which can be directly accessed via the\n    bspline property.\n\n    Fitting for this model is provided by wrappers for:\n    `scipy.interpolate.UnivariateSpline`,\n    `scipy.interpolate.InterpolatedUnivariateSpline`,\n    and `scipy.interpolate.LSQUnivariateSpline`.\n\n    If one fails to define any knots/coefficients, no parameters will\n    be added to this model until a fitter is called. This is because\n    some of the fitters for splines vary the number of parameters and so\n    we cannot define the parameter set until after fitting in these cases.\n\n    Since parameters are not necessarily known at model initialization,\n    setting model parameters directly via the model interface has been\n    disabled.\n\n    Direct constructors are provided for this model which incorporate the\n    fitting to data directly into model construction.\n\n    Knot parameters are declared as \"fixed\" parameters by default to\n    enable the use of other `astropy.modeling` fitters to be used to\n    fit this model.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.modeling.models import Spline1D\n    >>> from astropy.modeling import fitting\n    >>> np.random.seed(42)\n    >>> x = np.linspace(-3, 3, 50)\n    >>> y = np.exp(-x**2) + 0.1 * np.random.randn(50)\n    >>> xs = np.linspace(-3, 3, 1000)\n\n    A 1D interpolating spline can be fit to data:\n\n    >>> fitter = fitting.SplineInterpolateFitter()\n    >>> spl = fitter(Spline1D(), x, y)\n\n    Similarly, a smoothing spline can be fit to data:\n\n    >>> fitter = fitting.SplineSmoothingFitter()\n    >>> spl = fitter(Spline1D(), x, y, s=0.5)\n\n    Similarly, a spline can be fit to data using an exact set of interior knots:\n\n    >>> t = [-1, 0, 1]\n    >>> fitter = fitting.SplineExactKnotsFitter()\n    >>> spl = fitter(Spline1D(), x, y, t=t)\n    \"\"\"\n\n    n_inputs = 1\n    n_outputs = 1\n    _separable = True\n\n    optional_inputs = {'nu': 0}\n\n    def __init__(self, knots=None, coeffs=None, degree=3, bounds=None,\n                 n_models=None, model_set_axis=None, name=None, meta=None):\n\n        super().__init__(\n            knots=knots, coeffs=coeffs, degree=degree, bounds=bounds,\n            n_models=n_models, model_set_axis=model_set_axis, name=name, meta=meta\n        )\n\n    @property\n    def t(self):\n        \"\"\"\n        The knots vector\n        \"\"\"\n\n        if self._t is None:\n            return np.concatenate((np.zeros(self._degree + 1), np.ones(self._degree + 1)))\n        else:\n            return self._t\n\n    @t.setter\n    def t(self, value):\n        if self._t is None:\n            raise ValueError(\"The model parameters must be initialized before setting knots.\")\n        elif len(value) == len(self._t):\n            self._t = value\n        else:\n            raise ValueError(\"There must be exactly as many knots as previously defined.\")\n\n    @property\n    def t_interior(self):\n        \"\"\"\n        The interior knots\n        \"\"\"\n\n        return self.t[self.degree + 1: -(self.degree + 1)]\n\n    @property\n    def c(self):\n        \"\"\"\n        The coefficients vector\n        \"\"\"\n\n        if self._c is None:\n            return np.zeros(len(self.t))\n        else:\n            return self._c\n\n    @c.setter\n    def c(self, value):\n        if self._c is None:\n            raise ValueError(\"The model parameters must be initialized before setting coeffs.\")\n        elif len(value) == len(self._c):\n            self._c = value\n        else:\n            raise ValueError(\"There must be exactly as many coeffs as previously defined.\")\n\n    @property\n    def degree(self):\n        \"\"\"\n        The degree of the spline polynomials\n        \"\"\"\n\n        return self._degree\n\n    @property\n    def _initialized(self):\n        return self._t is not None and self._c is not None\n\n    @property\n    def tck(self):\n        \"\"\"\n        Scipy 'tck' tuple representation\n        \"\"\"\n\n        return (self.t, self.c, self.degree)\n\n    @tck.setter\n    def tck(self, value):\n        if self._initialized:\n            if value[2] != self.degree:\n                raise ValueError(\"tck has incompatible degree!\")\n\n            self.t = value[0]\n            self.c = value[1]\n        else:\n            self._init_spline(value[0], value[1])\n\n        # Calling this will properly fill the _parameter vector, which is\n        #   used directly sometimes without being properly filled.\n        _ = self.parameters\n\n    @property\n    def bspline(self):\n        \"\"\"\n        Scipy bspline object representation\n        \"\"\"\n\n        from scipy.interpolate import BSpline\n\n        return BSpline(*self.tck)\n\n    @bspline.setter\n    def bspline(self, value):\n        from scipy.interpolate import BSpline\n\n        if isinstance(value, BSpline):\n            self.tck = value.tck\n        else:\n            self.tck = value\n\n    @property\n    def knots(self):\n        \"\"\"\n        Dictionary of knot parameters\n        \"\"\"\n\n        return [getattr(self, knot) for knot in self._knot_names]\n\n    @property\n    def user_knots(self):\n        \"\"\"If the knots have been supplied by the user\"\"\"\n        return self._user_knots\n\n    @user_knots.setter\n    def user_knots(self, value):\n        self._user_knots = value\n\n    @property\n    def coeffs(self):\n        \"\"\"\n        Dictionary of coefficient parameters\n        \"\"\"\n\n        return [getattr(self, coeff) for coeff in self._coeff_names]\n\n    def _init_parameters(self):\n        self._knot_names = self._create_parameters(\"knot\", \"t\", fixed=True)\n        self._coeff_names = self._create_parameters(\"coeff\", \"c\")\n\n    def _init_bounds(self, bounds=None):\n        if bounds is None:\n            bounds = [None, None]\n\n        if bounds[0] is None:\n            lower = np.zeros(self._degree + 1)\n        else:\n            lower = np.array([bounds[0]] * (self._degree + 1))\n\n        if bounds[1] is None:\n            upper = np.ones(self._degree + 1)\n        else:\n            upper = np.array([bounds[1]] * (self._degree + 1))\n\n        if bounds[0] is not None and bounds[1] is not None:\n            self.bounding_box = bounds\n            has_bounds = True\n        else:\n            has_bounds = False\n\n        return has_bounds, lower, upper\n\n    def _init_knots(self, knots, has_bounds, lower, upper):\n        if np.issubdtype(type(knots), np.integer):\n            self._t = np.concatenate(\n                (lower, np.zeros(knots), upper)\n            )\n        elif isiterable(knots):\n            self._user_knots = True\n            if has_bounds:\n                self._t = np.concatenate(\n                    (lower, np.array(knots), upper)\n                )\n            else:\n                if len(knots) < 2*(self._degree + 1):\n                    raise ValueError(f\"Must have at least {2*(self._degree + 1)} knots.\")\n                self._t = np.array(knots)\n        else:\n            raise ValueError(f\"Knots: {knots} must be iterable or value\")\n\n        # check that knots form a viable spline\n        self.bspline\n\n    def _init_coeffs(self, coeffs=None):\n        if coeffs is None:\n            self._c = np.zeros(len(self._t))\n        else:\n            self._c = np.array(coeffs)\n\n        # check that coeffs form a viable spline\n        self.bspline\n\n    def _init_data(self, knots, coeffs, bounds=None):\n        self._init_knots(knots, *self._init_bounds(bounds))\n        self._init_coeffs(coeffs)\n\n    def evaluate(self, *args, **kwargs):\n        \"\"\"\n        Evaluate the spline.\n\n        Parameters\n        ----------\n        x :\n            (positional) The points where the model is evaluating the spline at\n        nu : optional\n            (kwarg) The derivative of the spline for evaluation, 0 <= nu <= degree + 1.\n            Default: 0.\n        \"\"\"\n        kwargs = super().evaluate(*args, **kwargs)\n        x = args[0]\n\n        if 'nu' in kwargs:\n            if kwargs['nu'] > self.degree + 1:\n                raise RuntimeError(\"Cannot evaluate a derivative of \"\n                                   f\"order higher than {self.degree + 1}\")\n\n        return self.bspline(x, **kwargs)\n\n    def derivative(self, nu=1):\n        \"\"\"\n        Create a spline that is the derivative of this one\n\n        Parameters\n        ----------\n        nu : int, optional\n            Derivative order, default is 1.\n        \"\"\"\n        if nu <= self.degree:\n            bspline = self.bspline.derivative(nu=nu)\n\n            derivative = Spline1D(degree=bspline.k)\n            derivative.bspline = bspline\n\n            return derivative\n        else:\n            raise ValueError(f'Must have nu <= {self.degree}')\n\n    def antiderivative(self, nu=1):\n        \"\"\"\n        Create a spline that is an antiderivative of this one\n\n        Parameters\n        ----------\n        nu : int, optional\n            Antiderivative order, default is 1.\n\n        Notes\n        -----\n        Assumes constant of integration is 0\n        \"\"\"\n        if (nu + self.degree) <= 5:\n            bspline = self.bspline.antiderivative(nu=nu)\n\n            antiderivative = Spline1D(degree=bspline.k)\n            antiderivative.bspline = bspline\n\n            return antiderivative\n        else:\n            raise ValueError(\"Supported splines can have max degree 5, \"\n                             f\"antiderivative degree will be {nu + self.degree}\")"},{"col":4,"comment":"null","endLoc":41,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3511,"name":"to_tree_transform","nodeType":"Function","startLoc":35,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'radius': _parameter_to_value(model.radius)}\n        return node"},{"col":4,"comment":"null","endLoc":52,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3512,"name":"assert_equal","nodeType":"Function","startLoc":43,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.AiryDisk2D) and\n                isinstance(b, functional_models.AiryDisk2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.radius, b.radius)"},{"attributeType":"null","col":4,"comment":"null","endLoc":24,"id":3513,"name":"name","nodeType":"Attribute","startLoc":24,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":25,"id":3514,"name":"version","nodeType":"Attribute","startLoc":25,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":26,"id":3515,"name":"types","nodeType":"Attribute","startLoc":26,"text":"types"},{"className":"Box1DType","col":0,"comment":"null","endLoc":81,"id":3516,"nodeType":"Class","startLoc":55,"text":"class Box1DType(TransformType):\n    name = 'transform/box1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Box1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Box1D(amplitude=node['amplitude'],\n                                       x_0=node['x_0'],\n                                       width=node['width'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'width': _parameter_to_value(model.width)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Box1D) and\n                isinstance(b, functional_models.Box1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.width, b.width)"},{"col":35,"endLoc":1058,"id":3517,"nodeType":"Lambda","startLoc":1057,"text":"lambda v: b(self._get_converter(\n                                tunit, equivalencies=equivalencies)(v))"},{"col":4,"comment":"\n        Return the converted values in the specified unit.\n\n        Parameters\n        ----------\n        other : unit-like\n            The unit to convert to.\n\n        value : int, float, or scalar array-like, optional\n            Value(s) in the current unit to be converted to the\n            specified unit.  If not provided, defaults to 1.0\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            This list is in addition to possible global defaults set by, e.g.,\n            `set_enabled_equivalencies`.\n            Use `None` to turn off all equivalencies.\n\n        Returns\n        -------\n        values : scalar or array\n            Converted value(s). Input value sequences are returned as\n            numpy arrays.\n\n        Raises\n        ------\n        UnitsError\n            If units are inconsistent\n        ","endLoc":1132,"header":"def to(self, other, value=UNITY, equivalencies=[])","id":3518,"name":"to","nodeType":"Function","startLoc":1097,"text":"def to(self, other, value=UNITY, equivalencies=[]):\n        \"\"\"\n        Return the converted values in the specified unit.\n\n        Parameters\n        ----------\n        other : unit-like\n            The unit to convert to.\n\n        value : int, float, or scalar array-like, optional\n            Value(s) in the current unit to be converted to the\n            specified unit.  If not provided, defaults to 1.0\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            This list is in addition to possible global defaults set by, e.g.,\n            `set_enabled_equivalencies`.\n            Use `None` to turn off all equivalencies.\n\n        Returns\n        -------\n        values : scalar or array\n            Converted value(s). Input value sequences are returned as\n            numpy arrays.\n\n        Raises\n        ------\n        UnitsError\n            If units are inconsistent\n        \"\"\"\n        if other is self and value is UNITY:\n            return UNITY\n        else:\n            return self._get_converter(Unit(other),\n                                       equivalencies=equivalencies)(value)"},{"col":4,"comment":"null","endLoc":64,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3519,"name":"from_tree_transform","nodeType":"Function","startLoc":60,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Box1D(amplitude=node['amplitude'],\n                                       x_0=node['x_0'],\n                                       width=node['width'])"},{"col":4,"comment":"\n        Alias for `to` for backward compatibility with pynbody.\n        ","endLoc":1139,"header":"def in_units(self, other, value=1.0, equivalencies=[])","id":3520,"name":"in_units","nodeType":"Function","startLoc":1134,"text":"def in_units(self, other, value=1.0, equivalencies=[]):\n        \"\"\"\n        Alias for `to` for backward compatibility with pynbody.\n        \"\"\"\n        return self.to(\n            other, value=value, equivalencies=equivalencies)"},{"col":4,"comment":"null","endLoc":1281,"header":"def _compose(self, equivalencies=[], namespace=[], max_depth=2, depth=0,\n                 cached_results=None)","id":3521,"name":"_compose","nodeType":"Function","startLoc":1161,"text":"def _compose(self, equivalencies=[], namespace=[], max_depth=2, depth=0,\n                 cached_results=None):\n        def is_final_result(unit):\n            # Returns True if this result contains only the expected\n            # units\n            for base in unit.bases:\n                if base not in namespace:\n                    return False\n            return True\n\n        unit = self.decompose()\n        key = hash(unit)\n\n        cached = cached_results.get(key)\n        if cached is not None:\n            if isinstance(cached, Exception):\n                raise cached\n            return cached\n\n        # Prevent too many levels of recursion\n        # And special case for dimensionless unit\n        if depth >= max_depth:\n            cached_results[key] = [unit]\n            return [unit]\n\n        # Make a list including all of the equivalent units\n        units = [unit]\n        for funit, tunit, a, b in equivalencies:\n            if tunit is not None:\n                if self._is_equivalent(funit):\n                    scale = funit.decompose().scale / unit.scale\n                    units.append(Unit(a(1.0 / scale) * tunit).decompose())\n                elif self._is_equivalent(tunit):\n                    scale = tunit.decompose().scale / unit.scale\n                    units.append(Unit(b(1.0 / scale) * funit).decompose())\n            else:\n                if self._is_equivalent(funit):\n                    units.append(Unit(unit.scale))\n\n        # Store partial results\n        partial_results = []\n        # Store final results that reduce to a single unit or pair of\n        # units\n        if len(unit.bases) == 0:\n            final_results = [set([unit]), set()]\n        else:\n            final_results = [set(), set()]\n\n        for tunit in namespace:\n            tunit_decomposed = tunit.decompose()\n            for u in units:\n                # If the unit is a base unit, look for an exact match\n                # to one of the bases of the target unit.  If found,\n                # factor by the same power as the target unit's base.\n                # This allows us to factor out fractional powers\n                # without needing to do an exhaustive search.\n                if len(tunit_decomposed.bases) == 1:\n                    for base, power in zip(u.bases, u.powers):\n                        if tunit_decomposed._is_equivalent(base):\n                            tunit = tunit ** power\n                            tunit_decomposed = tunit_decomposed ** power\n                            break\n\n                composed = (u / tunit_decomposed).decompose()\n                factored = composed * tunit\n                len_bases = len(composed.bases)\n                if is_final_result(factored) and len_bases <= 1:\n                    final_results[len_bases].add(factored)\n                else:\n                    partial_results.append(\n                        (len_bases, composed, tunit))\n\n        # Do we have any minimal results?\n        for final_result in final_results:\n            if len(final_result):\n                results = final_results[0].union(final_results[1])\n                cached_results[key] = results\n                return results\n\n        partial_results.sort(key=operator.itemgetter(0))\n\n        # ...we have to recurse and try to further compose\n        results = []\n        for len_bases, composed, tunit in partial_results:\n            try:\n                composed_list = composed._compose(\n                    equivalencies=equivalencies,\n                    namespace=namespace,\n                    max_depth=max_depth, depth=depth + 1,\n                    cached_results=cached_results)\n            except UnitsError:\n                composed_list = []\n            for subcomposed in composed_list:\n                results.append(\n                    (len(subcomposed.bases), subcomposed, tunit))\n\n        if len(results):\n            results.sort(key=operator.itemgetter(0))\n\n            min_length = results[0][0]\n            subresults = set()\n            for len_bases, composed, tunit in results:\n                if len_bases > min_length:\n                    break\n                else:\n                    factored = composed * tunit\n                    if is_final_result(factored):\n                        subresults.add(factored)\n\n            if len(subresults):\n                cached_results[key] = subresults\n                return subresults\n\n        if not is_final_result(self):\n            result = UnitsError(\n                f\"Cannot represent unit {self} in terms of the given units\")\n            cached_results[key] = result\n            raise result\n\n        cached_results[key] = [self]\n        return [self]"},{"className":"_Spline","col":0,"comment":"Base class for spline models","endLoc":200,"id":3522,"nodeType":"Class","startLoc":24,"text":"class _Spline(FittableModel):\n    \"\"\"Base class for spline models\"\"\"\n    _knot_names = ()\n    _coeff_names = ()\n\n    optional_inputs = {}\n\n    def __init__(self, knots=None, coeffs=None, degree=None, bounds=None,\n                 n_models=None, model_set_axis=None, name=None, meta=None):\n\n        super().__init__(\n            n_models=n_models, model_set_axis=model_set_axis, name=name,\n            meta=meta)\n\n        self._user_knots = False\n        self._init_tck(degree)\n\n        # Hack to allow an optional model argument\n        self._create_optional_inputs()\n\n        if knots is not None:\n            self._init_spline(knots, coeffs, bounds)\n        elif coeffs is not None:\n            raise ValueError(\"If one passes a coeffs vector one needs to also pass knots!\")\n\n    @property\n    def param_names(self):\n        \"\"\"\n        Coefficient names generated based on the spline's degree and\n        number of knots.\n        \"\"\"\n\n        return tuple(list(self._knot_names) + list(self._coeff_names))\n\n    @staticmethod\n    def _optional_arg(arg):\n        return f'_{arg}'\n\n    def _create_optional_inputs(self):\n        for arg in self.optional_inputs:\n            attribute = self._optional_arg(arg)\n            if hasattr(self, attribute):\n                raise ValueError(f'Optional argument {arg} already exists in this class!')\n            else:\n                setattr(self, attribute, None)\n\n    def _intercept_optional_inputs(self, **kwargs):\n        new_kwargs = kwargs\n        for arg in self.optional_inputs:\n            if (arg in kwargs):\n                attribute = self._optional_arg(arg)\n                if getattr(self, attribute) is None:\n                    setattr(self, attribute, kwargs[arg])\n                    del new_kwargs[arg]\n                else:\n                    raise RuntimeError(f'{arg} has already been set, something has gone wrong!')\n\n        return new_kwargs\n\n    def evaluate(self, *args, **kwargs):\n        \"\"\" Extract the optional kwargs passed to call \"\"\"\n\n        optional_inputs = kwargs\n        for arg in self.optional_inputs:\n            attribute = self._optional_arg(arg)\n\n            if arg in kwargs:\n                # Options passed in\n                optional_inputs[arg] = kwargs[arg]\n            elif getattr(self, attribute) is not None:\n                # No options passed in and Options set\n                optional_inputs[arg] = getattr(self, attribute)\n                setattr(self, attribute, None)\n            else:\n                # No options passed in and No options set\n                optional_inputs[arg] = self.optional_inputs[arg]\n\n        return optional_inputs\n\n    def __call__(self, *args, **kwargs):\n        \"\"\"\n        Make model callable to model evaluation\n        \"\"\"\n\n        # Hack to allow an optional model argument\n        kwargs = self._intercept_optional_inputs(**kwargs)\n\n        return super().__call__(*args, **kwargs)\n\n    def _create_parameter(self, name: str, index: int, attr: str, fixed=False):\n        \"\"\"\n        Create a spline parameter linked to an attribute array.\n\n        Parameters\n        ----------\n        name : str\n            Name for the parameter\n        index : int\n            The index of the parameter in the array\n        attr : str\n            The name for the attribute array\n        fixed : optional, bool\n            If the parameter should be fixed or not\n        \"\"\"\n\n        # Hack to allow parameters and attribute array to freely exchange values\n        #   _getter forces reading value from attribute array\n        #   _setter forces setting value to attribute array\n\n        def _getter(value, model: \"_Spline\", index: int, attr: str):\n            return getattr(model, attr)[index]\n\n        def _setter(value, model: \"_Spline\", index: int, attr: str):\n            getattr(model, attr)[index] = value\n            return value\n\n        getter = functools.partial(_getter, index=index, attr=attr)\n        setter = functools.partial(_setter, index=index, attr=attr)\n\n        default = getattr(self, attr)\n        param = Parameter(name=name, default=default[index], fixed=fixed,\n                          getter=getter, setter=setter)\n        # setter/getter wrapper for parameters in this case require the\n        # parameter to have a reference back to its parent model\n        param.model = self\n        param.value = default[index]\n\n        # Add parameter to model\n        self.__dict__[name] = param\n\n    def _create_parameters(self, base_name: str, attr: str, fixed=False):\n        \"\"\"\n        Create a spline parameters linked to an attribute array for all\n        elements in that array\n\n        Parameters\n        ----------\n        base_name : str\n            Base name for the parameters\n        attr : str\n            The name for the attribute array\n        fixed : optional, bool\n            If the parameters should be fixed or not\n        \"\"\"\n        names = []\n        for index in range(len(getattr(self, attr))):\n            name = f\"{base_name}{index}\"\n            names.append(name)\n\n            self._create_parameter(name, index, attr, fixed)\n\n        return tuple(names)\n\n    @abc.abstractmethod\n    def _init_parameters(self):\n        raise NotImplementedError(\"This needs to be implemented\")\n\n    @abc.abstractmethod\n    def _init_data(self, knots, coeffs, bounds=None):\n        raise NotImplementedError(\"This needs to be implemented\")\n\n    def _init_spline(self, knots, coeffs, bounds=None):\n        self._init_data(knots, coeffs, bounds)\n        self._init_parameters()\n\n        # fill _parameters and related attributes\n        self._initialize_parameters((), {})\n        self._initialize_slices()\n\n        # Calling this will properly fill the _parameter vector, which is\n        #   used directly sometimes without being properly filled.\n        _ = self.parameters\n\n    def _init_tck(self, degree):\n        self._c = None\n        self._t = None\n        self._degree = degree"},{"className":"FittableModel","col":0,"comment":"\n    Base class for models that can be fitted using the built-in fitting\n    algorithms.\n    ","endLoc":2814,"id":3523,"nodeType":"Class","startLoc":2796,"text":"class FittableModel(Model):\n    \"\"\"\n    Base class for models that can be fitted using the built-in fitting\n    algorithms.\n    \"\"\"\n\n    linear = False\n    # derivative with respect to parameters\n    fit_deriv = None\n    \"\"\"\n    Function (similar to the model's `~Model.evaluate`) to compute the\n    derivatives of the model with respect to its parameters, for use by fitting\n    algorithms.  In other words, this computes the Jacobian matrix with respect\n    to the model's parameters.\n    \"\"\"\n    # Flag that indicates if the model derivatives with respect to parameters\n    # are given in columns or rows\n    col_fit_deriv = True\n    fittable = True"},{"col":4,"comment":"null","endLoc":71,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3524,"name":"to_tree_transform","nodeType":"Function","startLoc":66,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'width': _parameter_to_value(model.width)}\n        return node"},{"col":4,"comment":"null","endLoc":81,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3525,"name":"assert_equal","nodeType":"Function","startLoc":73,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Box1D) and\n                isinstance(b, functional_models.Box1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.width, b.width)"},{"attributeType":"null","col":4,"comment":"null","endLoc":2802,"id":3526,"name":"linear","nodeType":"Attribute","startLoc":2802,"text":"linear"},{"col":4,"comment":"null","endLoc":806,"header":"@property\n    def n_outputs(self)","id":3527,"name":"n_outputs","nodeType":"Function","startLoc":793,"text":"@property\n    def n_outputs(self):\n        # TODO: remove the code in the ``if`` block when support\n        # for models with ``outputs`` as class variables is removed.\n        if hasattr(self.__class__, 'n_outputs') and isinstance(self.__class__.n_outputs, property):\n            try:\n                return len(self.__class__.outputs)\n            except TypeError:\n                try:\n                    return len(self.outputs)\n                except AttributeError:\n                    return 0\n\n        return self.__class__.n_outputs"},{"attributeType":"null","col":4,"comment":"\n    Function (similar to the model's `~Model.evaluate`) to compute the\n    derivatives of the model with respect to its parameters, for use by fitting\n    algorithms.  In other words, this computes the Jacobian matrix with respect\n    to the model's parameters.\n    ","endLoc":2804,"id":3528,"name":"fit_deriv","nodeType":"Attribute","startLoc":2804,"text":"fit_deriv"},{"col":4,"comment":"null","endLoc":699,"header":"def __init_subclass__(cls, **kwargs)","id":3529,"name":"__init_subclass__","nodeType":"Function","startLoc":698,"text":"def __init_subclass__(cls, **kwargs):\n        super().__init_subclass__()"},{"attributeType":"null","col":4,"comment":"null","endLoc":56,"id":3530,"name":"name","nodeType":"Attribute","startLoc":56,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":2813,"id":3531,"name":"col_fit_deriv","nodeType":"Attribute","startLoc":2813,"text":"col_fit_deriv"},{"attributeType":"null","col":4,"comment":"null","endLoc":2814,"id":3532,"name":"fittable","nodeType":"Attribute","startLoc":2814,"text":"fittable"},{"attributeType":"null","col":4,"comment":"null","endLoc":57,"id":3533,"name":"version","nodeType":"Attribute","startLoc":57,"text":"version"},{"col":4,"comment":"null","endLoc":47,"header":"def __init__(self, knots=None, coeffs=None, degree=None, bounds=None,\n                 n_models=None, model_set_axis=None, name=None, meta=None)","id":3534,"name":"__init__","nodeType":"Function","startLoc":31,"text":"def __init__(self, knots=None, coeffs=None, degree=None, bounds=None,\n                 n_models=None, model_set_axis=None, name=None, meta=None):\n\n        super().__init__(\n            n_models=n_models, model_set_axis=model_set_axis, name=name,\n            meta=meta)\n\n        self._user_knots = False\n        self._init_tck(degree)\n\n        # Hack to allow an optional model argument\n        self._create_optional_inputs()\n\n        if knots is not None:\n            self._init_spline(knots, coeffs, bounds)\n        elif coeffs is not None:\n            raise ValueError(\"If one passes a coeffs vector one needs to also pass knots!\")"},{"col":4,"comment":"null","endLoc":742,"header":"def _default_inputs_outputs(self)","id":3535,"name":"_default_inputs_outputs","nodeType":"Function","startLoc":726,"text":"def _default_inputs_outputs(self):\n        if self.n_inputs == 1 and self.n_outputs == 1:\n            self._inputs = (\"x\",)\n            self._outputs = (\"y\",)\n        elif self.n_inputs == 2 and self.n_outputs == 1:\n            self._inputs = (\"x\", \"y\")\n            self._outputs = (\"z\",)\n        else:\n            try:\n                self._inputs = tuple(\"x\" + str(idx) for idx in range(self.n_inputs))\n                self._outputs = tuple(\"x\" + str(idx) for idx in range(self.n_outputs))\n            except TypeError:\n                # self.n_inputs and self.n_outputs are properties\n                # This is the case when subclasses of Model do not define\n                # ``n_inputs``, ``n_outputs``, ``inputs`` or ``outputs``.\n                self._inputs = ()\n                self._outputs = ()"},{"attributeType":"null","col":4,"comment":"null","endLoc":58,"id":3536,"name":"types","nodeType":"Attribute","startLoc":58,"text":"types"},{"className":"Box2DType","col":0,"comment":"null","endLoc":116,"id":3537,"nodeType":"Class","startLoc":84,"text":"class Box2DType(TransformType):\n    name = 'transform/box2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Box2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Box2D(amplitude=node['amplitude'],\n                                       x_0=node['x_0'],\n                                       x_width=node['x_width'],\n                                       y_0=node['y_0'],\n                                       y_width=node['y_width'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'x_width': _parameter_to_value(model.x_width),\n                'y_0': _parameter_to_value(model.y_0),\n                'y_width': _parameter_to_value(model.y_width)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Box2D) and\n                isinstance(b, functional_models.Box2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.x_width, b.x_width)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.y_width, b.y_width)"},{"col":4,"comment":"null","endLoc":95,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3538,"name":"from_tree_transform","nodeType":"Function","startLoc":89,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Box2D(amplitude=node['amplitude'],\n                                       x_0=node['x_0'],\n                                       x_width=node['x_width'],\n                                       y_0=node['y_0'],\n                                       y_width=node['y_width'])"},{"col":4,"comment":"\n        This exists to inject defaults for settable properties for models\n        originating from `custom_model`.\n        ","endLoc":755,"header":"def _initialize_setters(self, kwargs)","id":3539,"name":"_initialize_setters","nodeType":"Function","startLoc":744,"text":"def _initialize_setters(self, kwargs):\n        \"\"\"\n        This exists to inject defaults for settable properties for models\n        originating from `custom_model`.\n        \"\"\"\n        if hasattr(self, '_settable_properties'):\n            setters = {name: kwargs.pop(name, default)\n                       for name, default in self._settable_properties.items()}\n            for name, value in setters.items():\n                setattr(self, name, value)\n\n        return kwargs"},{"col":4,"comment":"null","endLoc":104,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3540,"name":"to_tree_transform","nodeType":"Function","startLoc":97,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'x_width': _parameter_to_value(model.x_width),\n                'y_0': _parameter_to_value(model.y_0),\n                'y_width': _parameter_to_value(model.y_width)}\n        return node"},{"col":4,"comment":"null","endLoc":116,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3541,"name":"assert_equal","nodeType":"Function","startLoc":106,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Box2D) and\n                isinstance(b, functional_models.Box2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.x_width, b.x_width)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.y_width, b.y_width)"},{"attributeType":"null","col":4,"comment":"null","endLoc":85,"id":3542,"name":"name","nodeType":"Attribute","startLoc":85,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":86,"id":3543,"name":"version","nodeType":"Attribute","startLoc":86,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":87,"id":3544,"name":"types","nodeType":"Attribute","startLoc":87,"text":"types"},{"className":"Disk2DType","col":0,"comment":"null","endLoc":149,"id":3545,"nodeType":"Class","startLoc":119,"text":"class Disk2DType(TransformType):\n    name = 'transform/disk2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Disk2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Disk2D(amplitude=node['amplitude'],\n                                        x_0=node['x_0'],\n                                        y_0=node['y_0'],\n                                        R_0=node['R_0'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'R_0': _parameter_to_value(model.R_0)}\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Disk2D) and\n                isinstance(b, functional_models.Disk2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.R_0, b.R_0)"},{"col":4,"comment":"null","endLoc":129,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3546,"name":"from_tree_transform","nodeType":"Function","startLoc":124,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Disk2D(amplitude=node['amplitude'],\n                                        x_0=node['x_0'],\n                                        y_0=node['y_0'],\n                                        R_0=node['R_0'])"},{"col":4,"comment":"null","endLoc":759,"header":"@property\n    def inputs(self)","id":3547,"name":"inputs","nodeType":"Function","startLoc":757,"text":"@property\n    def inputs(self):\n        return self._inputs"},{"col":4,"comment":"null","endLoc":766,"header":"@inputs.setter\n    def inputs(self, val)","id":3548,"name":"inputs","nodeType":"Function","startLoc":761,"text":"@inputs.setter\n    def inputs(self, val):\n        if len(val) != self.n_inputs:\n            raise ValueError(f\"Expected {self.n_inputs} number of inputs, got {len(val)}.\")\n        self._inputs = val\n        self._initialize_unit_support()"},{"col":4,"comment":"null","endLoc":138,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3549,"name":"to_tree_transform","nodeType":"Function","startLoc":131,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'R_0': _parameter_to_value(model.R_0)}\n\n        return node"},{"col":4,"comment":"\n        Convert self._input_units_strict and\n        self.input_units_allow_dimensionless to dictionaries\n        mapping input name to a boolean value.\n        ","endLoc":829,"header":"def _initialize_unit_support(self)","id":3550,"name":"_initialize_unit_support","nodeType":"Function","startLoc":817,"text":"def _initialize_unit_support(self):\n        \"\"\"\n        Convert self._input_units_strict and\n        self.input_units_allow_dimensionless to dictionaries\n        mapping input name to a boolean value.\n        \"\"\"\n        if isinstance(self._input_units_strict, bool):\n            self._input_units_strict = {key: self._input_units_strict for\n                                        key in self.inputs}\n\n        if isinstance(self._input_units_allow_dimensionless, bool):\n            self._input_units_allow_dimensionless = {key: self._input_units_allow_dimensionless\n                                                     for key in self.inputs}"},{"col":4,"comment":"null","endLoc":770,"header":"@property\n    def outputs(self)","id":3551,"name":"outputs","nodeType":"Function","startLoc":768,"text":"@property\n    def outputs(self):\n        return self._outputs"},{"col":4,"comment":"null","endLoc":776,"header":"@outputs.setter\n    def outputs(self, val)","id":3552,"name":"outputs","nodeType":"Function","startLoc":772,"text":"@outputs.setter\n    def outputs(self, val):\n        if len(val) != self.n_outputs:\n            raise ValueError(f\"Expected {self.n_outputs} number of outputs, got {len(val)}.\")\n        self._outputs = val"},{"col":4,"comment":"null","endLoc":149,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3553,"name":"assert_equal","nodeType":"Function","startLoc":140,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Disk2D) and\n                isinstance(b, functional_models.Disk2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.R_0, b.R_0)"},{"col":4,"comment":"\n        This is a hook which customises the behavior of modeling.separable.\n\n        This allows complex subclasses to customise the separability matrix.\n        If it returns `NotImplemented` the default behavior is used.\n        ","endLoc":815,"header":"def _calculate_separability_matrix(self)","id":3554,"name":"_calculate_separability_matrix","nodeType":"Function","startLoc":808,"text":"def _calculate_separability_matrix(self):\n        \"\"\"\n        This is a hook which customises the behavior of modeling.separable.\n\n        This allows complex subclasses to customise the separability matrix.\n        If it returns `NotImplemented` the default behavior is used.\n        \"\"\"\n        return NotImplemented"},{"col":4,"comment":"\n        Enforce strict units on inputs to evaluate. If this is set to True,\n        input values to evaluate will be in the exact units specified by\n        input_units. If the input quantities are convertible to input_units,\n        they are converted. If this is a dictionary then it should map input\n        name to a bool to set strict input units for that parameter.\n        ","endLoc":843,"header":"@property\n    def input_units_strict(self)","id":3555,"name":"input_units_strict","nodeType":"Function","startLoc":831,"text":"@property\n    def input_units_strict(self):\n        \"\"\"\n        Enforce strict units on inputs to evaluate. If this is set to True,\n        input values to evaluate will be in the exact units specified by\n        input_units. If the input quantities are convertible to input_units,\n        they are converted. If this is a dictionary then it should map input\n        name to a bool to set strict input units for that parameter.\n        \"\"\"\n        val = self._input_units_strict\n        if isinstance(val, bool):\n            return {key: val for key in self.inputs}\n        return dict(zip(self.inputs, val.values()))"},{"col":4,"comment":"\n        Pop parameter constraint values off the keyword arguments passed to\n        `Model.__init__` and store them in private instance attributes.\n        ","endLoc":2380,"header":"def _initialize_constraints(self, kwargs)","id":3556,"name":"_initialize_constraints","nodeType":"Function","startLoc":2365,"text":"def _initialize_constraints(self, kwargs):\n        \"\"\"\n        Pop parameter constraint values off the keyword arguments passed to\n        `Model.__init__` and store them in private instance attributes.\n        \"\"\"\n\n        # Pop any constraints off the keyword arguments\n        for constraint in self.parameter_constraints:\n            values = kwargs.pop(constraint, {})\n            for ckey, cvalue in values.items():\n                param = getattr(self, ckey)\n                setattr(param, constraint, cvalue)\n        self._mconstraints = {}\n        for constraint in self.model_constraints:\n            values = kwargs.pop(constraint, [])\n            self._mconstraints[constraint] = values"},{"attributeType":"null","col":4,"comment":"null","endLoc":120,"id":3558,"name":"name","nodeType":"Attribute","startLoc":120,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":121,"id":3559,"name":"version","nodeType":"Attribute","startLoc":121,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":122,"id":3560,"name":"types","nodeType":"Attribute","startLoc":122,"text":"types"},{"col":4,"comment":"\n        Allow dimensionless input (and corresponding output). If this is True,\n        input values to evaluate will gain the units specified in input_units. If\n        this is a dictionary then it should map input name to a bool to allow\n        dimensionless numbers for that input.\n        Only has an effect if input_units is defined.\n        ","endLoc":858,"header":"@property\n    def input_units_allow_dimensionless(self)","id":3561,"name":"input_units_allow_dimensionless","nodeType":"Function","startLoc":845,"text":"@property\n    def input_units_allow_dimensionless(self):\n        \"\"\"\n        Allow dimensionless input (and corresponding output). If this is True,\n        input values to evaluate will gain the units specified in input_units. If\n        this is a dictionary then it should map input name to a bool to allow\n        dimensionless numbers for that input.\n        Only has an effect if input_units is defined.\n        \"\"\"\n\n        val = self._input_units_allow_dimensionless\n        if isinstance(val, bool):\n            return {key: val for key in self.inputs}\n        return dict(zip(self.inputs, val.values()))"},{"className":"Ellipse2DType","col":0,"comment":"null","endLoc":188,"id":3562,"nodeType":"Class","startLoc":152,"text":"class Ellipse2DType(TransformType):\n    name = 'transform/ellipse2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Ellipse2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Ellipse2D(amplitude=node['amplitude'],\n                                           x_0=node['x_0'],\n                                           y_0=node['y_0'],\n                                           a=node['a'],\n                                           b=node['b'],\n                                           theta=node['theta'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'a': _parameter_to_value(model.a),\n                'b': _parameter_to_value(model.b),\n                'theta': _parameter_to_value(model.theta)}\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Ellipse2D) and\n                isinstance(b, functional_models.Ellipse2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.a, b.a)\n        assert_array_equal(a.b, b.b)\n        assert_array_equal(a.theta, b.theta)"},{"col":4,"comment":"\n        Initialize the _parameters array that stores raw parameter values for\n        all parameter sets for use with vectorized fitting algorithms; on\n        FittableModels the _param_name attributes actually just reference\n        slices of this array.\n        ","endLoc":2523,"header":"def _initialize_parameters(self, args, kwargs)","id":3563,"name":"_initialize_parameters","nodeType":"Function","startLoc":2382,"text":"def _initialize_parameters(self, args, kwargs):\n        \"\"\"\n        Initialize the _parameters array that stores raw parameter values for\n        all parameter sets for use with vectorized fitting algorithms; on\n        FittableModels the _param_name attributes actually just reference\n        slices of this array.\n        \"\"\"\n        n_models = kwargs.pop('n_models', None)\n\n        if not (n_models is None or\n                (isinstance(n_models, (int, np.integer)) and n_models >= 1)):\n            raise ValueError(\n                \"n_models must be either None (in which case it is \"\n                \"determined from the model_set_axis of the parameter initial \"\n                \"values) or it must be a positive integer \"\n                \"(got {0!r})\".format(n_models))\n\n        model_set_axis = kwargs.pop('model_set_axis', None)\n        if model_set_axis is None:\n            if n_models is not None and n_models > 1:\n                # Default to zero\n                model_set_axis = 0\n            else:\n                # Otherwise disable\n                model_set_axis = False\n        else:\n            if not (model_set_axis is False or\n                    np.issubdtype(type(model_set_axis), np.integer)):\n                raise ValueError(\n                    \"model_set_axis must be either False or an integer \"\n                    \"specifying the parameter array axis to map to each \"\n                    \"model in a set of models (got {0!r}).\".format(\n                        model_set_axis))\n\n        # Process positional arguments by matching them up with the\n        # corresponding parameters in self.param_names--if any also appear as\n        # keyword arguments this presents a conflict\n        params = set()\n        if len(args) > len(self.param_names):\n            raise TypeError(\n                \"{0}.__init__() takes at most {1} positional arguments ({2} \"\n                \"given)\".format(self.__class__.__name__, len(self.param_names),\n                                len(args)))\n\n        self._model_set_axis = model_set_axis\n        self._param_metrics = defaultdict(dict)\n\n        for idx, arg in enumerate(args):\n            if arg is None:\n                # A value of None implies using the default value, if exists\n                continue\n            # We use quantity_asanyarray here instead of np.asanyarray because\n            # if any of the arguments are quantities, we need to return a\n            # Quantity object not a plain Numpy array.\n            param_name = self.param_names[idx]\n            params.add(param_name)\n            if not isinstance(arg, Parameter):\n                value = quantity_asanyarray(arg, dtype=float)\n            else:\n                value = arg\n            self._initialize_parameter_value(param_name, value)\n\n        # At this point the only remaining keyword arguments should be\n        # parameter names; any others are in error.\n        for param_name in self.param_names:\n            if param_name in kwargs:\n                if param_name in params:\n                    raise TypeError(\n                        \"{0}.__init__() got multiple values for parameter \"\n                        \"{1!r}\".format(self.__class__.__name__, param_name))\n                value = kwargs.pop(param_name)\n                if value is None:\n                    continue\n                # We use quantity_asanyarray here instead of np.asanyarray\n                # because if any of the arguments are quantities, we need\n                # to return a Quantity object not a plain Numpy array.\n                value = quantity_asanyarray(value, dtype=float)\n                params.add(param_name)\n                self._initialize_parameter_value(param_name, value)\n        # Now deal with case where param_name is not supplied by args or kwargs\n        for param_name in self.param_names:\n            if param_name not in params:\n                self._initialize_parameter_value(param_name, None)\n\n        if kwargs:\n            # If any keyword arguments were left over at this point they are\n            # invalid--the base class should only be passed the parameter\n            # values, constraints, and param_dim\n            for kwarg in kwargs:\n                # Just raise an error on the first unrecognized argument\n                raise TypeError(\n                    '{0}.__init__() got an unrecognized parameter '\n                    '{1!r}'.format(self.__class__.__name__, kwarg))\n\n        # Determine the number of model sets: If the model_set_axis is\n        # None then there is just one parameter set; otherwise it is determined\n        # by the size of that axis on the first parameter--if the other\n        # parameters don't have the right number of axes or the sizes of their\n        # model_set_axis don't match an error is raised\n        if model_set_axis is not False and n_models != 1 and params:\n            max_ndim = 0\n            if model_set_axis < 0:\n                min_ndim = abs(model_set_axis)\n            else:\n                min_ndim = model_set_axis + 1\n\n            for name in self.param_names:\n                value = getattr(self, name)\n                param_ndim = np.ndim(value)\n                if param_ndim < min_ndim:\n                    raise InputParameterError(\n                        \"All parameter values must be arrays of dimension \"\n                        \"at least {0} for model_set_axis={1} (the value \"\n                        \"given for {2!r} is only {3}-dimensional)\".format(\n                            min_ndim, model_set_axis, name, param_ndim))\n\n                max_ndim = max(max_ndim, param_ndim)\n\n                if n_models is None:\n                    # Use the dimensions of the first parameter to determine\n                    # the number of model sets\n                    n_models = value.shape[model_set_axis]\n                elif value.shape[model_set_axis] != n_models:\n                    raise InputParameterError(\n                        \"Inconsistent dimensions for parameter {0!r} for \"\n                        \"{1} model sets.  The length of axis {2} must be the \"\n                        \"same for all input parameter values\".format(\n                            name, n_models, model_set_axis))\n\n            self._check_param_broadcast(max_ndim)\n        else:\n            if n_models is None:\n                n_models = 1\n\n            self._check_param_broadcast(None)\n\n        self._n_models = n_models\n        # now validate parameters\n        for name in params:\n            param = getattr(self, name)\n            if param._validator is not None:\n                param._validator(self, param.value)"},{"col":4,"comment":"\n        True if this model has been created with `~astropy.units.Quantity`\n        objects or if there are no parameters.\n\n        This can be used to determine if this model should be evaluated with\n        `~astropy.units.Quantity` or regular floats.\n        ","endLoc":870,"header":"@property\n    def uses_quantity(self)","id":3564,"name":"uses_quantity","nodeType":"Function","startLoc":860,"text":"@property\n    def uses_quantity(self):\n        \"\"\"\n        True if this model has been created with `~astropy.units.Quantity`\n        objects or if there are no parameters.\n\n        This can be used to determine if this model should be evaluated with\n        `~astropy.units.Quantity` or regular floats.\n        \"\"\"\n        pisq = [isinstance(p, Quantity) for p in self._param_sets(units=True)]\n        return (len(pisq) == 0) or any(pisq)"},{"col":4,"comment":"\n        Return the simplest possible composite unit(s) that represent\n        the given unit.  Since there may be multiple equally simple\n        compositions of the unit, a list of units is always returned.\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            A list of equivalence pairs to also list.  See\n            :ref:`astropy:unit_equivalencies`.\n            This list is in addition to possible global defaults set by, e.g.,\n            `set_enabled_equivalencies`.\n            Use `None` to turn off all equivalencies.\n\n        units : set of `~astropy.units.Unit`, optional\n            If not provided, any known units may be used to compose\n            into.  Otherwise, ``units`` is a dict, module or sequence\n            containing the units to compose into.\n\n        max_depth : int, optional\n            The maximum recursion depth to use when composing into\n            composite units.\n\n        include_prefix_units : bool, optional\n            When `True`, include prefixed units in the result.\n            Default is `True` if a sequence is passed in to ``units``,\n            `False` otherwise.\n\n        Returns\n        -------\n        units : list of `CompositeUnit`\n            A list of candidate compositions.  These will all be\n            equally simple, but it may not be possible to\n            automatically determine which of the candidates are\n            better.\n        ","endLoc":1411,"header":"def compose(self, equivalencies=[], units=None, max_depth=2,\n                include_prefix_units=None)","id":3565,"name":"compose","nodeType":"Function","startLoc":1283,"text":"def compose(self, equivalencies=[], units=None, max_depth=2,\n                include_prefix_units=None):\n        \"\"\"\n        Return the simplest possible composite unit(s) that represent\n        the given unit.  Since there may be multiple equally simple\n        compositions of the unit, a list of units is always returned.\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            A list of equivalence pairs to also list.  See\n            :ref:`astropy:unit_equivalencies`.\n            This list is in addition to possible global defaults set by, e.g.,\n            `set_enabled_equivalencies`.\n            Use `None` to turn off all equivalencies.\n\n        units : set of `~astropy.units.Unit`, optional\n            If not provided, any known units may be used to compose\n            into.  Otherwise, ``units`` is a dict, module or sequence\n            containing the units to compose into.\n\n        max_depth : int, optional\n            The maximum recursion depth to use when composing into\n            composite units.\n\n        include_prefix_units : bool, optional\n            When `True`, include prefixed units in the result.\n            Default is `True` if a sequence is passed in to ``units``,\n            `False` otherwise.\n\n        Returns\n        -------\n        units : list of `CompositeUnit`\n            A list of candidate compositions.  These will all be\n            equally simple, but it may not be possible to\n            automatically determine which of the candidates are\n            better.\n        \"\"\"\n        # if units parameter is specified and is a sequence (list|tuple),\n        # include_prefix_units is turned on by default.  Ex: units=[u.kpc]\n        if include_prefix_units is None:\n            include_prefix_units = isinstance(units, (list, tuple))\n\n        # Pre-normalize the equivalencies list\n        equivalencies = self._normalize_equivalencies(equivalencies)\n\n        # The namespace of units to compose into should be filtered to\n        # only include units with bases in common with self, otherwise\n        # they can't possibly provide useful results.  Having too many\n        # destination units greatly increases the search space.\n\n        def has_bases_in_common(a, b):\n            if len(a.bases) == 0 and len(b.bases) == 0:\n                return True\n            for ab in a.bases:\n                for bb in b.bases:\n                    if ab == bb:\n                        return True\n            return False\n\n        def has_bases_in_common_with_equiv(unit, other):\n            if has_bases_in_common(unit, other):\n                return True\n            for funit, tunit, a, b in equivalencies:\n                if tunit is not None:\n                    if unit._is_equivalent(funit):\n                        if has_bases_in_common(tunit.decompose(), other):\n                            return True\n                    elif unit._is_equivalent(tunit):\n                        if has_bases_in_common(funit.decompose(), other):\n                            return True\n                else:\n                    if unit._is_equivalent(funit):\n                        if has_bases_in_common(dimensionless_unscaled, other):\n                            return True\n            return False\n\n        def filter_units(units):\n            filtered_namespace = set()\n            for tunit in units:\n                if (isinstance(tunit, UnitBase) and\n                    (include_prefix_units or\n                     not isinstance(tunit, PrefixUnit)) and\n                    has_bases_in_common_with_equiv(\n                        decomposed, tunit.decompose())):\n                    filtered_namespace.add(tunit)\n            return filtered_namespace\n\n        decomposed = self.decompose()\n\n        if units is None:\n            units = filter_units(self._get_units_with_same_physical_type(\n                equivalencies=equivalencies))\n            if len(units) == 0:\n                units = get_current_unit_registry().non_prefix_units\n        elif isinstance(units, dict):\n            units = set(filter_units(units.values()))\n        elif inspect.ismodule(units):\n            units = filter_units(vars(units).values())\n        else:\n            units = filter_units(_flatten_units_collection(units))\n\n        def sort_results(results):\n            if not len(results):\n                return []\n\n            # Sort the results so the simplest ones appear first.\n            # Simplest is defined as \"the minimum sum of absolute\n            # powers\" (i.e. the fewest bases), and preference should\n            # be given to results where the sum of powers is positive\n            # and the scale is exactly equal to 1.0\n            results = list(results)\n            results.sort(key=lambda x: np.abs(x.scale))\n            results.sort(key=lambda x: np.sum(np.abs(x.powers)))\n            results.sort(key=lambda x: np.sum(x.powers) < 0.0)\n            results.sort(key=lambda x: not is_effectively_unity(x.scale))\n\n            last_result = results[0]\n            filtered = [last_result]\n            for result in results[1:]:\n                if str(result) != str(last_result):\n                    filtered.append(result)\n                last_result = result\n\n            return filtered\n\n        return sort_results(self._compose(\n            equivalencies=equivalencies, namespace=units,\n            max_depth=max_depth, depth=0, cached_results={}))"},{"col":4,"comment":"null","endLoc":164,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3566,"name":"from_tree_transform","nodeType":"Function","startLoc":157,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Ellipse2D(amplitude=node['amplitude'],\n                                           x_0=node['x_0'],\n                                           y_0=node['y_0'],\n                                           a=node['a'],\n                                           b=node['b'],\n                                           theta=node['theta'])"},{"col":4,"comment":"\n        Implementation of the Model.param_sets property.\n\n        This internal implementation has a ``raw`` argument which controls\n        whether or not to return the raw parameter values (i.e. the values that\n        are actually stored in the ._parameters array, as opposed to the values\n        displayed to users.  In most cases these are one in the same but there\n        are currently a few exceptions.\n\n        Note: This is notably an overcomplicated device and may be removed\n        entirely in the near future.\n        ","endLoc":2722,"header":"def _param_sets(self, raw=False, units=False)","id":3567,"name":"_param_sets","nodeType":"Function","startLoc":2663,"text":"def _param_sets(self, raw=False, units=False):\n        \"\"\"\n        Implementation of the Model.param_sets property.\n\n        This internal implementation has a ``raw`` argument which controls\n        whether or not to return the raw parameter values (i.e. the values that\n        are actually stored in the ._parameters array, as opposed to the values\n        displayed to users.  In most cases these are one in the same but there\n        are currently a few exceptions.\n\n        Note: This is notably an overcomplicated device and may be removed\n        entirely in the near future.\n        \"\"\"\n\n        values = []\n        shapes = []\n        for name in self.param_names:\n            param = getattr(self, name)\n\n            if raw and param._setter:\n                value = param._internal_value\n            else:\n                value = param.value\n\n            broadcast_shape = self._param_metrics[name].get('broadcast_shape')\n            if broadcast_shape is not None:\n                value = value.reshape(broadcast_shape)\n\n            shapes.append(np.shape(value))\n\n            if len(self) == 1:\n                # Add a single param set axis to the parameter's value (thus\n                # converting scalars to shape (1,) array values) for\n                # consistency\n                value = np.array([value])\n\n            if units:\n                if raw and param.internal_unit is not None:\n                    unit = param.internal_unit\n                else:\n                    unit = param.unit\n                if unit is not None:\n                    value = Quantity(value, unit)\n\n            values.append(value)\n\n        if len(set(shapes)) != 1 or units:\n            # If the parameters are not all the same shape, converting to an\n            # array is going to produce an object array\n            # However the way Numpy creates object arrays is tricky in that it\n            # will recurse into array objects in the list and break them up\n            # into separate objects.  Doing things this way ensures a 1-D\n            # object array the elements of which are the individual parameter\n            # arrays.  There's not much reason to do this over returning a list\n            # except for consistency\n            psets = np.empty(len(values), dtype=object)\n            psets[:] = values\n            return psets\n\n        return np.array(values)"},{"col":4,"comment":"null","endLoc":200,"header":"def _init_tck(self, degree)","id":3569,"name":"_init_tck","nodeType":"Function","startLoc":197,"text":"def _init_tck(self, degree):\n        self._c = None\n        self._t = None\n        self._degree = degree"},{"col":4,"comment":"null","endLoc":68,"header":"def _create_optional_inputs(self)","id":3570,"name":"_create_optional_inputs","nodeType":"Function","startLoc":62,"text":"def _create_optional_inputs(self):\n        for arg in self.optional_inputs:\n            attribute = self._optional_arg(arg)\n            if hasattr(self, attribute):\n                raise ValueError(f'Optional argument {arg} already exists in this class!')\n            else:\n                setattr(self, attribute, None)"},{"col":4,"comment":"null","endLoc":2583,"header":"def _initialize_slices(self)","id":3571,"name":"_initialize_slices","nodeType":"Function","startLoc":2568,"text":"def _initialize_slices(self):\n\n        param_metrics = self._param_metrics\n        total_size = 0\n\n        for name in self.param_names:\n            param = getattr(self, name)\n            value = param.value\n            param_size = np.size(value)\n            param_shape = np.shape(value)\n            param_slice = slice(total_size, total_size + param_size)\n            param_metrics[name]['slice'] = param_slice\n            param_metrics[name]['shape'] = param_shape\n            param_metrics[name]['size'] = param_size\n            total_size += param_size\n        self._parameters = np.empty(total_size, dtype=np.float64)"},{"col":4,"comment":"null","endLoc":60,"header":"@staticmethod\n    def _optional_arg(arg)","id":3572,"name":"_optional_arg","nodeType":"Function","startLoc":58,"text":"@staticmethod\n    def _optional_arg(arg):\n        return f'_{arg}'"},{"col":4,"comment":"null","endLoc":195,"header":"def _init_spline(self, knots, coeffs, bounds=None)","id":3573,"name":"_init_spline","nodeType":"Function","startLoc":185,"text":"def _init_spline(self, knots, coeffs, bounds=None):\n        self._init_data(knots, coeffs, bounds)\n        self._init_parameters()\n\n        # fill _parameters and related attributes\n        self._initialize_parameters((), {})\n        self._initialize_slices()\n\n        # Calling this will properly fill the _parameter vector, which is\n        #   used directly sometimes without being properly filled.\n        _ = self.parameters"},{"col":4,"comment":"null","endLoc":183,"header":"@abc.abstractmethod\n    def _init_data(self, knots, coeffs, bounds=None)","id":3574,"name":"_init_data","nodeType":"Function","startLoc":181,"text":"@abc.abstractmethod\n    def _init_data(self, knots, coeffs, bounds=None):\n        raise NotImplementedError(\"This needs to be implemented\")"},{"col":0,"comment":"null","endLoc":295,"header":"def quantity_asanyarray(a, dtype=None)","id":3575,"name":"quantity_asanyarray","nodeType":"Function","startLoc":290,"text":"def quantity_asanyarray(a, dtype=None):\n    from .quantity import Quantity\n    if not isinstance(a, np.ndarray) and not np.isscalar(a) and any(isinstance(x, Quantity) for x in a):\n        return Quantity(a, dtype=dtype)\n    else:\n        return np.asanyarray(a, dtype=dtype)"},{"col":4,"comment":"null","endLoc":179,"header":"@abc.abstractmethod\n    def _init_parameters(self)","id":3576,"name":"_init_parameters","nodeType":"Function","startLoc":177,"text":"@abc.abstractmethod\n    def _init_parameters(self):\n        raise NotImplementedError(\"This needs to be implemented\")"},{"col":4,"comment":"\n        Coefficient names generated based on the spline's degree and\n        number of knots.\n        ","endLoc":56,"header":"@property\n    def param_names(self)","id":3578,"name":"param_names","nodeType":"Function","startLoc":49,"text":"@property\n    def param_names(self):\n        \"\"\"\n        Coefficient names generated based on the spline's degree and\n        number of knots.\n        \"\"\"\n\n        return tuple(list(self._knot_names) + list(self._coeff_names))"},{"col":4,"comment":"\n        Return a list of registered units with the same physical type\n        as this unit.\n\n        This function is used by Quantity to add its built-in\n        conversions to equivalent units.\n\n        This is a private method, since end users should be encouraged\n        to use the more powerful `compose` and `find_equivalent_units`\n        methods (which use this under the hood).\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            A list of equivalence pairs to also pull options from.\n            See :ref:`astropy:unit_equivalencies`.  It must already be\n            normalized using `_normalize_equivalencies`.\n        ","endLoc":1545,"header":"def _get_units_with_same_physical_type(self, equivalencies=[])","id":3579,"name":"_get_units_with_same_physical_type","nodeType":"Function","startLoc":1513,"text":"def _get_units_with_same_physical_type(self, equivalencies=[]):\n        \"\"\"\n        Return a list of registered units with the same physical type\n        as this unit.\n\n        This function is used by Quantity to add its built-in\n        conversions to equivalent units.\n\n        This is a private method, since end users should be encouraged\n        to use the more powerful `compose` and `find_equivalent_units`\n        methods (which use this under the hood).\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            A list of equivalence pairs to also pull options from.\n            See :ref:`astropy:unit_equivalencies`.  It must already be\n            normalized using `_normalize_equivalencies`.\n        \"\"\"\n        unit_registry = get_current_unit_registry()\n        units = set(unit_registry.get_units_with_physical_type(self))\n        for funit, tunit, a, b in equivalencies:\n            if tunit is not None:\n                if self.is_equivalent(funit) and tunit not in units:\n                    units.update(\n                        unit_registry.get_units_with_physical_type(tunit))\n                if self._is_equivalent(tunit) and funit not in units:\n                    units.update(\n                        unit_registry.get_units_with_physical_type(funit))\n            else:\n                if self.is_equivalent(funit):\n                    units.add(dimensionless_unscaled)\n        return units"},{"col":4,"comment":"null","endLoc":175,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3580,"name":"to_tree_transform","nodeType":"Function","startLoc":166,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'a': _parameter_to_value(model.a),\n                'b': _parameter_to_value(model.b),\n                'theta': _parameter_to_value(model.theta)}\n\n        return node"},{"col":4,"comment":"null","endLoc":81,"header":"def _intercept_optional_inputs(self, **kwargs)","id":3581,"name":"_intercept_optional_inputs","nodeType":"Function","startLoc":70,"text":"def _intercept_optional_inputs(self, **kwargs):\n        new_kwargs = kwargs\n        for arg in self.optional_inputs:\n            if (arg in kwargs):\n                attribute = self._optional_arg(arg)\n                if getattr(self, attribute) is None:\n                    setattr(self, attribute, kwargs[arg])\n                    del new_kwargs[arg]\n                else:\n                    raise RuntimeError(f'{arg} has already been set, something has gone wrong!')\n\n        return new_kwargs"},{"col":4,"comment":"Mostly deals with consistency checks and determining unit issues.","endLoc":2566,"header":"def _initialize_parameter_value(self, param_name, value)","id":3582,"name":"_initialize_parameter_value","nodeType":"Function","startLoc":2525,"text":"def _initialize_parameter_value(self, param_name, value):\n        \"\"\"Mostly deals with consistency checks and determining unit issues.\"\"\"\n        if isinstance(value, Parameter):\n            self.__dict__[param_name] = value\n            return\n        param = getattr(self, param_name)\n        # Use default if value is not provided\n        if value is None:\n            default = param.default\n            if default is None:\n                # No value was supplied for the parameter and the\n                # parameter does not have a default, therefore the model\n                # is underspecified\n                raise TypeError(\"{0}.__init__() requires a value for parameter \"\n                                \"{1!r}\".format(self.__class__.__name__, param_name))\n            value = default\n            unit = param.unit\n        else:\n            if isinstance(value, Quantity):\n                unit = value.unit\n                value = value.value\n            else:\n                unit = None\n        if unit is None and param.unit is not None:\n            raise InputParameterError(\n                \"{0}.__init__() requires a Quantity for parameter \"\n                \"{1!r}\".format(self.__class__.__name__, param_name))\n        param._unit = unit\n        param.internal_unit = None\n        if param._setter is not None:\n            if unit is not None:\n                _val = param._setter(value * unit)\n            else:\n                _val = param._setter(value)\n            if isinstance(_val, Quantity):\n                param.internal_unit = _val.unit\n                param._internal_value = np.array(_val.value)\n            else:\n                param.internal_unit = None\n                param._internal_value = np.array(_val)\n        else:\n            param._value = np.array(value)"},{"col":4,"comment":"null","endLoc":188,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3583,"name":"assert_equal","nodeType":"Function","startLoc":177,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Ellipse2D) and\n                isinstance(b, functional_models.Ellipse2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.a, b.a)\n        assert_array_equal(a.b, b.b)\n        assert_array_equal(a.theta, b.theta)"},{"attributeType":"null","col":4,"comment":"null","endLoc":153,"id":3584,"name":"name","nodeType":"Attribute","startLoc":153,"text":"name"},{"col":4,"comment":"null","endLoc":29,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3585,"name":"to_tree_transform","nodeType":"Function","startLoc":25,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'scale': _parameter_to_value(model.scale),\n                'temperature': _parameter_to_value(model.temperature)}\n        return node"},{"attributeType":"null","col":4,"comment":"null","endLoc":154,"id":3586,"name":"version","nodeType":"Attribute","startLoc":154,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":155,"id":3587,"name":"types","nodeType":"Attribute","startLoc":155,"text":"types"},{"className":"Exponential1DType","col":0,"comment":"null","endLoc":214,"id":3588,"nodeType":"Class","startLoc":191,"text":"class Exponential1DType(TransformType):\n    name = 'transform/exponential1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Exponential1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Exponential1D(amplitude=node['amplitude'],\n                                               tau=node['tau'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'tau': _parameter_to_value(model.tau)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Exponential1D) and\n                isinstance(b, functional_models.Exponential1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.tau, b.tau)"},{"col":4,"comment":"null","endLoc":199,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3589,"name":"from_tree_transform","nodeType":"Function","startLoc":196,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Exponential1D(amplitude=node['amplitude'],\n                                               tau=node['tau'])"},{"col":4,"comment":"null","endLoc":38,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3590,"name":"assert_equal","nodeType":"Function","startLoc":31,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, physical_models.BlackBody) and\n                isinstance(b, physical_models.BlackBody))\n        assert_array_equal(a.scale, b.scale)\n        assert_array_equal(a.temperature, b.temperature)"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":3591,"name":"name","nodeType":"Attribute","startLoc":16,"text":"name"},{"col":4,"comment":" Extract the optional kwargs passed to call ","endLoc":101,"header":"def evaluate(self, *args, **kwargs)","id":3592,"name":"evaluate","nodeType":"Function","startLoc":83,"text":"def evaluate(self, *args, **kwargs):\n        \"\"\" Extract the optional kwargs passed to call \"\"\"\n\n        optional_inputs = kwargs\n        for arg in self.optional_inputs:\n            attribute = self._optional_arg(arg)\n\n            if arg in kwargs:\n                # Options passed in\n                optional_inputs[arg] = kwargs[arg]\n            elif getattr(self, attribute) is not None:\n                # No options passed in and Options set\n                optional_inputs[arg] = getattr(self, attribute)\n                setattr(self, attribute, None)\n            else:\n                # No options passed in and No options set\n                optional_inputs[arg] = self.optional_inputs[arg]\n\n        return optional_inputs"},{"col":4,"comment":"null","endLoc":205,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3593,"name":"to_tree_transform","nodeType":"Function","startLoc":201,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'tau': _parameter_to_value(model.tau)}\n        return node"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":3594,"name":"version","nodeType":"Attribute","startLoc":17,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":3595,"name":"types","nodeType":"Attribute","startLoc":18,"text":"types"},{"className":"Drude1DType","col":0,"comment":"null","endLoc":67,"id":3596,"nodeType":"Class","startLoc":41,"text":"class Drude1DType(TransformType):\n    name = 'transform/drude1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.physical_models.Drude1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return physical_models.Drude1D(amplitude=node['amplitude'],\n                                       x_0=node['x_0'],\n                                       fwhm=node['fwhm'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'fwhm': _parameter_to_value(model.fwhm)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, physical_models.Drude1D) and\n                isinstance(b, physical_models.Drude1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.fwhm, b.fwhm)"},{"col":4,"comment":"null","endLoc":214,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3597,"name":"assert_equal","nodeType":"Function","startLoc":207,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Exponential1D) and\n                isinstance(b, functional_models.Exponential1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.tau, b.tau)"},{"col":4,"comment":"null","endLoc":50,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3598,"name":"from_tree_transform","nodeType":"Function","startLoc":46,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return physical_models.Drude1D(amplitude=node['amplitude'],\n                                       x_0=node['x_0'],\n                                       fwhm=node['fwhm'])"},{"col":4,"comment":"null","endLoc":873,"header":"def __repr__(self)","id":3599,"name":"__repr__","nodeType":"Function","startLoc":872,"text":"def __repr__(self):\n        return self._format_repr()"},{"col":4,"comment":"\n        Internal implementation of ``__repr__``.\n\n        This is separated out for ease of use by subclasses that wish to\n        override the default ``__repr__`` while keeping the same basic\n        formatting.\n        ","endLoc":2750,"header":"def _format_repr(self, args=[], kwargs={}, defaults={})","id":3600,"name":"_format_repr","nodeType":"Function","startLoc":2724,"text":"def _format_repr(self, args=[], kwargs={}, defaults={}):\n        \"\"\"\n        Internal implementation of ``__repr__``.\n\n        This is separated out for ease of use by subclasses that wish to\n        override the default ``__repr__`` while keeping the same basic\n        formatting.\n        \"\"\"\n\n        parts = [repr(a) for a in args]\n\n        parts.extend(\n            f\"{name}={param_repr_oneline(getattr(self, name))}\"\n            for name in self.param_names)\n\n        if self.name is not None:\n            parts.append(f'name={self.name!r}')\n\n        for kwarg, value in kwargs.items():\n            if kwarg in defaults and defaults[kwarg] == value:\n                continue\n            parts.append(f'{kwarg}={value!r}')\n\n        if len(self) > 1:\n            parts.append(f\"n_models={len(self)}\")\n\n        return f\"<{self.__class__.__name__}({', '.join(parts)})>\""},{"col":4,"comment":"\n        Make model callable to model evaluation\n        ","endLoc":111,"header":"def __call__(self, *args, **kwargs)","id":3601,"name":"__call__","nodeType":"Function","startLoc":103,"text":"def __call__(self, *args, **kwargs):\n        \"\"\"\n        Make model callable to model evaluation\n        \"\"\"\n\n        # Hack to allow an optional model argument\n        kwargs = self._intercept_optional_inputs(**kwargs)\n\n        return super().__call__(*args, **kwargs)"},{"col":4,"comment":"null","endLoc":57,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3602,"name":"to_tree_transform","nodeType":"Function","startLoc":52,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'fwhm': _parameter_to_value(model.fwhm)}\n        return node"},{"col":0,"comment":"\n    Like array_repr_oneline but works on `Parameter` objects and supports\n    rendering parameters with units like quantities.\n    ","endLoc":711,"header":"def param_repr_oneline(param)","id":3603,"name":"param_repr_oneline","nodeType":"Function","startLoc":702,"text":"def param_repr_oneline(param):\n    \"\"\"\n    Like array_repr_oneline but works on `Parameter` objects and supports\n    rendering parameters with units like quantities.\n    \"\"\"\n\n    out = array_repr_oneline(param.value)\n    if param.unit is not None:\n        out = f'{out} {param.unit!s}'\n    return out"},{"col":4,"comment":"null","endLoc":67,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3605,"name":"assert_equal","nodeType":"Function","startLoc":59,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, physical_models.Drude1D) and\n                isinstance(b, physical_models.Drude1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.fwhm, b.fwhm)"},{"col":4,"comment":"\n        Evaluate this model using the given input(s) and the parameter values\n        that were specified when the model was instantiated.\n        ","endLoc":1084,"header":"def __call__(self, *args, **kwargs)","id":3606,"name":"__call__","nodeType":"Function","startLoc":1065,"text":"def __call__(self, *args, **kwargs):\n        \"\"\"\n        Evaluate this model using the given input(s) and the parameter values\n        that were specified when the model was instantiated.\n        \"\"\"\n        # Turn any keyword arguments into positional arguments.\n        args, kwargs = self._get_renamed_inputs_as_positional(*args, **kwargs)\n\n        # Read model evaluation related parameters\n        with_bbox = kwargs.pop('with_bounding_box', False)\n        fill_value = kwargs.pop('fill_value', np.nan)\n\n        # prepare for model evaluation (overridden in CompoundModel)\n        evaluate, inputs, broadcasted_shapes, kwargs = self._pre_evaluate(*args, **kwargs)\n\n        outputs = self._generic_evaluate(evaluate, inputs,\n                                         fill_value, with_bbox)\n\n        # post-process evaluation results (overridden in CompoundModel)\n        return self._post_evaluate(inputs, outputs, broadcasted_shapes, with_bbox, **kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":192,"id":3607,"name":"name","nodeType":"Attribute","startLoc":192,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":42,"id":3608,"name":"name","nodeType":"Attribute","startLoc":42,"text":"name"},{"col":4,"comment":"null","endLoc":1139,"header":"def _get_renamed_inputs_as_positional(self, *args, **kwargs)","id":3609,"name":"_get_renamed_inputs_as_positional","nodeType":"Function","startLoc":1086,"text":"def _get_renamed_inputs_as_positional(self, *args, **kwargs):\n        def _keyword2positional(kwargs):\n            # Inputs were passed as keyword (not positional) arguments.\n            # Because the signature of the ``__call__`` is defined at\n            # the class level, the name of the inputs cannot be changed at\n            # the instance level and the old names are always present in the\n            # signature of the method. In order to use the new names of the\n            # inputs, the old names are taken out of ``kwargs``, the input\n            # values are sorted in the order of self.inputs and passed as\n            # positional arguments to ``__call__``.\n\n            # These are the keys that are always present as keyword arguments.\n            keys = ['model_set_axis', 'with_bounding_box', 'fill_value',\n                    'equivalencies', 'inputs_map']\n\n            new_inputs = {}\n            # kwargs contain the names of the new inputs + ``keys``\n            allkeys = list(kwargs.keys())\n            # Remove the names of the new inputs from kwargs and save them\n            # to a dict ``new_inputs``.\n            for key in allkeys:\n                if key not in keys:\n                    new_inputs[key] = kwargs[key]\n                    del kwargs[key]\n            return new_inputs, kwargs\n        n_args = len(args)\n\n        new_inputs, kwargs = _keyword2positional(kwargs)\n        n_all_args = n_args + len(new_inputs)\n\n        if n_all_args < self.n_inputs:\n            raise ValueError(f\"Missing input arguments - expected {self.n_inputs}, got {n_all_args}\")\n        elif n_all_args > self.n_inputs:\n            raise ValueError(f\"Too many input arguments - expected {self.n_inputs}, got {n_all_args}\")\n        if n_args == 0:\n            # Create positional arguments from the keyword arguments in ``new_inputs``.\n            new_args = []\n            for k in self.inputs:\n                new_args.append(new_inputs[k])\n        elif n_args != self.n_inputs:\n            # Some inputs are passed as positional, others as keyword arguments.\n            args = list(args)\n\n            # Create positional arguments from the keyword arguments in ``new_inputs``.\n            new_args = []\n            for k in self.inputs:\n                if k in new_inputs:\n                    new_args.append(new_inputs[k])\n                else:\n                    new_args.append(args[0])\n                    del args[0]\n        else:\n            new_args = args\n        return new_args, kwargs"},{"attributeType":"null","col":4,"comment":"null","endLoc":43,"id":3610,"name":"version","nodeType":"Attribute","startLoc":43,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":193,"id":3611,"name":"version","nodeType":"Attribute","startLoc":193,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":44,"id":3612,"name":"types","nodeType":"Attribute","startLoc":44,"text":"types"},{"className":"Plummer1DType","col":0,"comment":"null","endLoc":93,"id":3613,"nodeType":"Class","startLoc":70,"text":"class Plummer1DType(TransformType):\n    name = 'transform/plummer1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.physical_models.Plummer1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return physical_models.Plummer1D(mass=node['mass'],\n                                         r_plum=node['r_plum'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'mass': _parameter_to_value(model.mass),\n                'r_plum': _parameter_to_value(model.r_plum)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, physical_models.Plummer1D) and\n                isinstance(b, physical_models.Plummer1D))\n        assert_array_equal(a.mass, b.mass)\n        assert_array_equal(a.r_plum, b.r_plum)"},{"attributeType":"null","col":4,"comment":"null","endLoc":194,"id":3614,"name":"types","nodeType":"Attribute","startLoc":194,"text":"types"},{"col":4,"comment":"null","endLoc":78,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3615,"name":"from_tree_transform","nodeType":"Function","startLoc":75,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return physical_models.Plummer1D(mass=node['mass'],\n                                         r_plum=node['r_plum'])"},{"className":"Gaussian1DType","col":0,"comment":"null","endLoc":243,"id":3616,"nodeType":"Class","startLoc":217,"text":"class Gaussian1DType(TransformType):\n    name = 'transform/gaussian1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Gaussian1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Gaussian1D(amplitude=node['amplitude'],\n                                            mean=node['mean'],\n                                            stddev=node['stddev'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'mean': _parameter_to_value(model.mean),\n                'stddev': _parameter_to_value(model.stddev)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Gaussian1D) and\n                isinstance(b, functional_models.Gaussian1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.mean, b.mean)\n        assert_array_equal(a.stddev, b.stddev)"},{"col":4,"comment":"null","endLoc":226,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3617,"name":"from_tree_transform","nodeType":"Function","startLoc":222,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Gaussian1D(amplitude=node['amplitude'],\n                                            mean=node['mean'],\n                                            stddev=node['stddev'])"},{"col":4,"comment":"null","endLoc":84,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3619,"name":"to_tree_transform","nodeType":"Function","startLoc":80,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'mass': _parameter_to_value(model.mass),\n                'r_plum': _parameter_to_value(model.r_plum)}\n        return node"},{"col":4,"comment":"null","endLoc":93,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3620,"name":"assert_equal","nodeType":"Function","startLoc":86,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, physical_models.Plummer1D) and\n                isinstance(b, physical_models.Plummer1D))\n        assert_array_equal(a.mass, b.mass)\n        assert_array_equal(a.r_plum, b.r_plum)"},{"attributeType":"null","col":4,"comment":"null","endLoc":71,"id":3621,"name":"name","nodeType":"Attribute","startLoc":71,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":72,"id":3622,"name":"version","nodeType":"Attribute","startLoc":72,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":73,"id":3623,"name":"types","nodeType":"Attribute","startLoc":73,"text":"types"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":3624,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"physical_models.py#<anonymous>","id":3625,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['BlackBody', 'Drude1DType', 'Plummer1DType']"},{"col":4,"comment":"\n        Model specific input setup that needs to occur prior to model evaluation\n        ","endLoc":942,"header":"def _pre_evaluate(self, *args, **kwargs)","id":3626,"name":"_pre_evaluate","nodeType":"Function","startLoc":928,"text":"def _pre_evaluate(self, *args, **kwargs):\n        \"\"\"\n        Model specific input setup that needs to occur prior to model evaluation\n        \"\"\"\n\n        # Broadcast inputs into common size\n        inputs, broadcasted_shapes = self.prepare_inputs(*args, **kwargs)\n\n        # Setup actual model evaluation method\n        parameters = self._param_sets(raw=True, units=True)\n\n        def evaluate(_inputs):\n            return self.evaluate(*chain(_inputs, parameters))\n\n        return evaluate, inputs, broadcasted_shapes, kwargs"},{"col":4,"comment":"\n        This method is used in `~astropy.modeling.Model.__call__` to ensure\n        that all the inputs to the model can be broadcast into compatible\n        shapes (if one or both of them are input as arrays), particularly if\n        there are more than one parameter sets. This also makes sure that (if\n        applicable) the units of the input will be compatible with the evaluate\n        method.\n        ","endLoc":2032,"header":"def prepare_inputs(self, *inputs, model_set_axis=None, equivalencies=None,\n                       **kwargs)","id":3627,"name":"prepare_inputs","nodeType":"Function","startLoc":1997,"text":"def prepare_inputs(self, *inputs, model_set_axis=None, equivalencies=None,\n                       **kwargs):\n        \"\"\"\n        This method is used in `~astropy.modeling.Model.__call__` to ensure\n        that all the inputs to the model can be broadcast into compatible\n        shapes (if one or both of them are input as arrays), particularly if\n        there are more than one parameter sets. This also makes sure that (if\n        applicable) the units of the input will be compatible with the evaluate\n        method.\n        \"\"\"\n        # When we instantiate the model class, we make sure that __call__ can\n        # take the following two keyword arguments: model_set_axis and\n        # equivalencies.\n        if model_set_axis is None:\n            # By default the model_set_axis for the input is assumed to be the\n            # same as that for the parameters the model was defined with\n            # TODO: Ensure that negative model_set_axis arguments are respected\n            model_set_axis = self.model_set_axis\n\n        params = [getattr(self, name) for name in self.param_names]\n        inputs = [np.asanyarray(_input, dtype=float) for _input in inputs]\n\n        self._validate_input_shapes(inputs, self.inputs, model_set_axis)\n\n        inputs_map = kwargs.get('inputs_map', None)\n\n        inputs = self._validate_input_units(inputs, equivalencies, inputs_map)\n\n        # The input formatting required for single models versus a multiple\n        # model set are different enough that they've been split into separate\n        # subroutines\n        if self._n_models == 1:\n            return self._prepare_inputs_single_model(params, inputs, **kwargs)\n        else:\n            return self._prepare_inputs_model_set(params, inputs,\n                                                  model_set_axis, **kwargs)"},{"fileName":"projections.py","filePath":"astropy/io/misc/asdf/tags/transform","id":3628,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nfrom numpy.testing import assert_array_equal\n\nfrom astropy import modeling\nfrom .basic import TransformType\nfrom . import _parameter_to_value\n\n\n__all__ = ['AffineType', 'Rotate2DType', 'Rotate3DType',\n           'RotationSequenceType']\n\n\nclass AffineType(TransformType):\n    name = \"transform/affine\"\n    version = '1.3.0'\n    types = ['astropy.modeling.projections.AffineTransformation2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        matrix = node['matrix']\n        translation = node['translation']\n        if matrix.shape != (2, 2):\n            raise NotImplementedError(\n                \"asdf currently only supports 2x2 (2D) rotation transformation \"\n                \"matrices\")\n        if translation.shape != (2,):\n            raise NotImplementedError(\n                \"asdf currently only supports 2D translation transformations.\")\n\n        return modeling.projections.AffineTransformation2D(\n            matrix=matrix, translation=translation)\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        return {'matrix': _parameter_to_value(model.matrix),\n                'translation': _parameter_to_value(model.translation)}\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (a.__class__ == b.__class__)\n        assert_array_equal(a.matrix, b.matrix)\n        assert_array_equal(a.translation, b.translation)\n\n\nclass Rotate2DType(TransformType):\n    name = \"transform/rotate2d\"\n    version = '1.3.0'\n    types = ['astropy.modeling.rotations.Rotation2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return modeling.rotations.Rotation2D(node['angle'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        return {'angle': _parameter_to_value(model.angle)}\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, modeling.rotations.Rotation2D) and\n                isinstance(b, modeling.rotations.Rotation2D))\n        assert_array_equal(a.angle, b.angle)\n\n\nclass Rotate3DType(TransformType):\n    name = \"transform/rotate3d\"\n    version = '1.3.0'\n    types = ['astropy.modeling.rotations.RotateNative2Celestial',\n             'astropy.modeling.rotations.RotateCelestial2Native',\n             'astropy.modeling.rotations.EulerAngleRotation']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        if node['direction'] == 'native2celestial':\n            return modeling.rotations.RotateNative2Celestial(node[\"phi\"],\n                                                             node[\"theta\"],\n                                                             node[\"psi\"])\n        elif node['direction'] == 'celestial2native':\n            return modeling.rotations.RotateCelestial2Native(node[\"phi\"],\n                                                             node[\"theta\"],\n                                                             node[\"psi\"])\n        else:\n            return modeling.rotations.EulerAngleRotation(node[\"phi\"],\n                                                         node[\"theta\"],\n                                                         node[\"psi\"],\n                                                         axes_order=node[\"direction\"])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        if isinstance(model, modeling.rotations.RotateNative2Celestial):\n            try:\n                node = {\"phi\": _parameter_to_value(model.lon),\n                        \"theta\": _parameter_to_value(model.lat),\n                        \"psi\": _parameter_to_value(model.lon_pole),\n                        \"direction\": \"native2celestial\"\n                        }\n            except AttributeError:\n                node = {\"phi\": model.lon,\n                        \"theta\": model.lat,\n                        \"psi\": model.lon_pole,\n                        \"direction\": \"native2celestial\"\n                        }\n        elif isinstance(model, modeling.rotations.RotateCelestial2Native):\n            try:\n                node = {\"phi\": _parameter_to_value(model.lon),\n                        \"theta\": _parameter_to_value(model.lat),\n                        \"psi\": _parameter_to_value(model.lon_pole),\n                        \"direction\": \"celestial2native\"\n                        }\n            except AttributeError:\n                node = {\"phi\": model.lon,\n                        \"theta\": model.lat,\n                        \"psi\": model.lon_pole,\n                        \"direction\": \"celestial2native\"\n                        }\n        else:\n            node = {\"phi\": _parameter_to_value(model.phi),\n                    \"theta\": _parameter_to_value(model.theta),\n                    \"psi\": _parameter_to_value(model.psi),\n                    \"direction\": model.axes_order\n                    }\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert a.__class__ == b.__class__\n        if a.__class__.__name__ == \"EulerAngleRotation\":\n            assert_array_equal(a.phi, b.phi)\n            assert_array_equal(a.psi, b.psi)\n            assert_array_equal(a.theta, b.theta)\n        else:\n            assert_array_equal(a.lon, b.lon)\n            assert_array_equal(a.lat, b.lat)\n            assert_array_equal(a.lon_pole, b.lon_pole)\n\n\nclass RotationSequenceType(TransformType):\n    name = \"transform/rotate_sequence_3d\"\n    types = ['astropy.modeling.rotations.RotationSequence3D',\n             'astropy.modeling.rotations.SphericalRotationSequence']\n    version = \"1.0.0\"\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        angles = node['angles']\n        axes_order = node['axes_order']\n        rotation_type = node['rotation_type']\n        if rotation_type == 'cartesian':\n            return modeling.rotations.RotationSequence3D(angles, axes_order=axes_order)\n        elif rotation_type == 'spherical':\n            return modeling.rotations.SphericalRotationSequence(angles, axes_order=axes_order)\n        else:\n            raise ValueError(f\"Unrecognized rotation_type: {rotation_type}\")\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'angles': list(model.angles.value)}\n        node['axes_order'] = model.axes_order\n        if isinstance(model, modeling.rotations.SphericalRotationSequence):\n            node['rotation_type'] = \"spherical\"\n        elif isinstance(model, modeling.rotations.RotationSequence3D):\n            node['rotation_type'] = \"cartesian\"\n        else:\n            raise ValueError(f\"Cannot serialize model of type {type(model)}\")\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        TransformType.assert_equal(a, b)\n        assert a.__class__.__name__ == b.__class__.__name__\n        assert_array_equal(a.angles, b.angles)\n        assert a.axes_order == b.axes_order\n\n\nclass GenericProjectionType(TransformType):\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        args = []\n        for param_name, default in cls.params:\n            args.append(node.get(param_name, default))\n\n        if node['direction'] == 'pix2sky':\n            return cls.types[0](*args)\n        else:\n            return cls.types[1](*args)\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {}\n        if isinstance(model, cls.types[0]):\n            node['direction'] = 'pix2sky'\n        else:\n            node['direction'] = 'sky2pix'\n        for param_name, default in cls.params:\n            val = getattr(model, param_name).value\n            if val != default:\n                node[param_name] = val\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert a.__class__ == b.__class__\n\n\n_generic_projections = {\n    'zenithal_perspective': ('ZenithalPerspective', (('mu', 0.0), ('gamma', 0.0)), '1.3.0'),\n    'gnomonic': ('Gnomonic', (), None),\n    'stereographic': ('Stereographic', (), None),\n    'slant_orthographic': ('SlantOrthographic', (('xi', 0.0), ('eta', 0.0)), None),\n    'zenithal_equidistant': ('ZenithalEquidistant', (), None),\n    'zenithal_equal_area': ('ZenithalEqualArea', (), None),\n    'airy': ('Airy', (('theta_b', 90.0),), '1.2.0'),\n    'cylindrical_perspective': ('CylindricalPerspective', (('mu', 0.0), ('lam', 0.0)), '1.3.0'),\n    'cylindrical_equal_area': ('CylindricalEqualArea', (('lam', 0.0),), '1.3.0'),\n    'plate_carree': ('PlateCarree', (), None),\n    'mercator': ('Mercator', (), None),\n    'sanson_flamsteed': ('SansonFlamsteed', (), None),\n    'parabolic': ('Parabolic', (), None),\n    'molleweide': ('Molleweide', (), None),\n    'hammer_aitoff': ('HammerAitoff', (), None),\n    'conic_perspective': ('ConicPerspective', (('sigma', 0.0), ('delta', 0.0)), '1.3.0'),\n    'conic_equal_area': ('ConicEqualArea', (('sigma', 0.0), ('delta', 0.0)), '1.3.0'),\n    'conic_equidistant': ('ConicEquidistant', (('sigma', 0.0), ('delta', 0.0)), '1.3.0'),\n    'conic_orthomorphic': ('ConicOrthomorphic', (('sigma', 0.0), ('delta', 0.0)), '1.3.0'),\n    'bonne_equal_area': ('BonneEqualArea', (('theta1', 0.0),), '1.3.0'),\n    'polyconic': ('Polyconic', (), None),\n    'tangential_spherical_cube': ('TangentialSphericalCube', (), None),\n    'cobe_quad_spherical_cube': ('COBEQuadSphericalCube', (), None),\n    'quad_spherical_cube': ('QuadSphericalCube', (), None),\n    'healpix': ('HEALPix', (('H', 4.0), ('X', 3.0)), None),\n    'healpix_polar': ('HEALPixPolar', (), None)\n}\n\n\ndef make_projection_types():\n    for tag_name, (name, params, version) in _generic_projections.items():\n        class_name = f'{name}Type'\n        types = [f'astropy.modeling.projections.Pix2Sky_{name}',\n                 f'astropy.modeling.projections.Sky2Pix_{name}']\n\n        members = {'name': f'transform/{tag_name}',\n                   'types': types,\n                   'params': params}\n        if version:\n            members['version'] = version\n\n        globals()[class_name] = type(\n            str(class_name),\n            (GenericProjectionType,),\n            members)\n\n        __all__.append(class_name)\n\n\nmake_projection_types()\n"},{"col":4,"comment":"null","endLoc":233,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3629,"name":"to_tree_transform","nodeType":"Function","startLoc":228,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'mean': _parameter_to_value(model.mean),\n                'stddev': _parameter_to_value(model.stddev)}\n        return node"},{"col":4,"comment":"\n        Perform basic validation of model inputs\n            --that they are mutually broadcastable and that they have\n            the minimum dimensions for the given model_set_axis.\n\n        If validation succeeds, returns the total shape that will result from\n        broadcasting the input arrays with each other.\n        ","endLoc":1026,"header":"def _validate_input_shapes(self, inputs, argnames, model_set_axis)","id":3630,"name":"_validate_input_shapes","nodeType":"Function","startLoc":1004,"text":"def _validate_input_shapes(self, inputs, argnames, model_set_axis):\n        \"\"\"\n        Perform basic validation of model inputs\n            --that they are mutually broadcastable and that they have\n            the minimum dimensions for the given model_set_axis.\n\n        If validation succeeds, returns the total shape that will result from\n        broadcasting the input arrays with each other.\n        \"\"\"\n\n        check_model_set_axis = self._n_models > 1 and model_set_axis is not False\n\n        all_shapes = []\n        for idx, _input in enumerate(inputs):\n            all_shapes.append(self._validate_input_shape(_input, idx, argnames,\n                                                         model_set_axis, check_model_set_axis))\n\n        input_shape = check_broadcast(*all_shapes)\n        if input_shape is None:\n            raise ValueError(\n                \"All inputs must have identical shapes or must be scalars.\")\n\n        return input_shape"},{"col":4,"comment":"null","endLoc":243,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3631,"name":"assert_equal","nodeType":"Function","startLoc":235,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Gaussian1D) and\n                isinstance(b, functional_models.Gaussian1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.mean, b.mean)\n        assert_array_equal(a.stddev, b.stddev)"},{"col":4,"comment":"\n        This subroutine checks that all parameter arrays can be broadcast\n        against each other, and determines the shapes parameters must have in\n        order to broadcast correctly.\n\n        If model_set_axis is None this merely checks that the parameters\n        broadcast and returns an empty dict if so.  This mode is only used for\n        single model sets.\n        ","endLoc":2661,"header":"def _check_param_broadcast(self, max_ndim)","id":3632,"name":"_check_param_broadcast","nodeType":"Function","startLoc":2608,"text":"def _check_param_broadcast(self, max_ndim):\n        \"\"\"\n        This subroutine checks that all parameter arrays can be broadcast\n        against each other, and determines the shapes parameters must have in\n        order to broadcast correctly.\n\n        If model_set_axis is None this merely checks that the parameters\n        broadcast and returns an empty dict if so.  This mode is only used for\n        single model sets.\n        \"\"\"\n        all_shapes = []\n        model_set_axis = self._model_set_axis\n\n        for name in self.param_names:\n            param = getattr(self, name)\n            value = param.value\n            param_shape = np.shape(value)\n            param_ndim = len(param_shape)\n            if max_ndim is not None and param_ndim < max_ndim:\n                # All arrays have the same number of dimensions up to the\n                # model_set_axis dimension, but after that they may have a\n                # different number of trailing axes.  The number of trailing\n                # axes must be extended for mutual compatibility.  For example\n                # if max_ndim = 3 and model_set_axis = 0, an array with the\n                # shape (2, 2) must be extended to (2, 1, 2).  However, an\n                # array with shape (2,) is extended to (2, 1).\n                new_axes = (1,) * (max_ndim - param_ndim)\n\n                if model_set_axis < 0:\n                    # Just need to prepend axes to make up the difference\n                    broadcast_shape = new_axes + param_shape\n                else:\n                    broadcast_shape = (param_shape[:model_set_axis + 1] +\n                                       new_axes +\n                                       param_shape[model_set_axis + 1:])\n                self._param_metrics[name]['broadcast_shape'] = broadcast_shape\n                all_shapes.append(broadcast_shape)\n            else:\n                all_shapes.append(param_shape)\n\n        # Now check mutual broadcastability of all shapes\n        try:\n            check_broadcast(*all_shapes)\n        except IncompatibleShapeError as exc:\n            shape_a, shape_a_idx, shape_b, shape_b_idx = exc.args\n            param_a = self.param_names[shape_a_idx]\n            param_b = self.param_names[shape_b_idx]\n\n            raise InputParameterError(\n                \"Parameter {0!r} of shape {1!r} cannot be broadcast with \"\n                \"parameter {2!r} of shape {3!r}.  All parameter arrays \"\n                \"must have shapes that are mutually compatible according \"\n                \"to the broadcasting rules.\".format(param_a, shape_a,\n                                                    param_b, shape_b))"},{"col":0,"comment":"\n    Given a list of sequences, modules or dictionaries of units, or\n    single units, return a flat set of all the units found.\n    ","endLoc":62,"header":"def _flatten_units_collection(items)","id":3633,"name":"_flatten_units_collection","nodeType":"Function","startLoc":36,"text":"def _flatten_units_collection(items):\n    \"\"\"\n    Given a list of sequences, modules or dictionaries of units, or\n    single units, return a flat set of all the units found.\n    \"\"\"\n    if not isinstance(items, list):\n        items = [items]\n\n    result = set()\n    for item in items:\n        if isinstance(item, UnitBase):\n            result.add(item)\n        else:\n            if isinstance(item, dict):\n                units = item.values()\n            elif inspect.ismodule(item):\n                units = vars(item).values()\n            elif isiterable(item):\n                units = item\n            else:\n                continue\n\n            for unit in units:\n                if isinstance(unit, UnitBase):\n                    result.add(unit)\n\n    return result"},{"col":4,"comment":"\n        Perform basic validation of a single model input's shape\n            -- it has the minimum dimensions for the given model_set_axis\n\n        Returns the shape of the input if validation succeeds.\n        ","endLoc":1002,"header":"def _validate_input_shape(self, _input, idx, argnames, model_set_axis, check_model_set_axis)","id":3634,"name":"_validate_input_shape","nodeType":"Function","startLoc":974,"text":"def _validate_input_shape(self, _input, idx, argnames, model_set_axis, check_model_set_axis):\n        \"\"\"\n        Perform basic validation of a single model input's shape\n            -- it has the minimum dimensions for the given model_set_axis\n\n        Returns the shape of the input if validation succeeds.\n        \"\"\"\n        input_shape = np.shape(_input)\n        # Ensure that the input's model_set_axis matches the model's\n        # n_models\n        if input_shape and check_model_set_axis:\n            # Note: Scalar inputs *only* get a pass on this\n            if len(input_shape) < model_set_axis + 1:\n                raise ValueError(\n                    f\"For model_set_axis={model_set_axis}, all inputs must be at \"\n                    f\"least {model_set_axis + 1}-dimensional.\")\n            if input_shape[model_set_axis] != self._n_models:\n                try:\n                    argname = argnames[idx]\n                except IndexError:\n                    # the case of model.inputs = ()\n                    argname = str(idx)\n\n                raise ValueError(\n                    f\"Input argument '{argname}' does not have the correct \"\n                    f\"dimensions in model_set_axis={model_set_axis} for a model set with \"\n                    f\"n_models={self._n_models}.\")\n\n        return input_shape"},{"attributeType":"null","col":4,"comment":"null","endLoc":218,"id":3635,"name":"name","nodeType":"Attribute","startLoc":218,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":219,"id":3636,"name":"version","nodeType":"Attribute","startLoc":219,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":220,"id":3637,"name":"types","nodeType":"Attribute","startLoc":220,"text":"types"},{"className":"Gaussian2DType","col":0,"comment":"null","endLoc":282,"id":3638,"nodeType":"Class","startLoc":246,"text":"class Gaussian2DType(TransformType):\n    name = 'transform/gaussian2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Gaussian2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Gaussian2D(amplitude=node['amplitude'],\n                                            x_mean=node['x_mean'],\n                                            y_mean=node['y_mean'],\n                                            x_stddev=node['x_stddev'],\n                                            y_stddev=node['y_stddev'],\n                                            theta=node['theta'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_mean': _parameter_to_value(model.x_mean),\n                'y_mean': _parameter_to_value(model.y_mean),\n                'x_stddev': _parameter_to_value(model.x_stddev),\n                'y_stddev': _parameter_to_value(model.y_stddev),\n                'theta': _parameter_to_value(model.theta)}\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Gaussian2D) and\n                isinstance(b, functional_models.Gaussian2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_mean, b.x_mean)\n        assert_array_equal(a.y_mean, b.y_mean)\n        assert_array_equal(a.x_stddev, b.x_stddev)\n        assert_array_equal(a.y_stddev, b.y_stddev)\n        assert_array_equal(a.theta, b.theta)"},{"col":4,"comment":"null","endLoc":258,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3639,"name":"from_tree_transform","nodeType":"Function","startLoc":251,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Gaussian2D(amplitude=node['amplitude'],\n                                            x_mean=node['x_mean'],\n                                            y_mean=node['y_mean'],\n                                            x_stddev=node['x_stddev'],\n                                            y_stddev=node['y_stddev'],\n                                            theta=node['theta'])"},{"col":4,"comment":"null","endLoc":2123,"header":"def _validate_input_units(self, inputs, equivalencies=None, inputs_map=None)","id":3640,"name":"_validate_input_units","nodeType":"Function","startLoc":2034,"text":"def _validate_input_units(self, inputs, equivalencies=None, inputs_map=None):\n        inputs = list(inputs)\n        name = self.name or self.__class__.__name__\n        # Check that the units are correct, if applicable\n\n        if self.input_units is not None:\n            # If a leaflist is provided that means this is in the context of\n            # a compound model and it is necessary to create the appropriate\n            # alias for the input coordinate name for the equivalencies dict\n            if inputs_map:\n                edict = {}\n                for mod, mapping in inputs_map:\n                    if self is mod:\n                        edict[mapping[0]] = equivalencies[mapping[1]]\n            else:\n                edict = equivalencies\n            # We combine any instance-level input equivalencies with user\n            # specified ones at call-time.\n            input_units_equivalencies = _combine_equivalency_dict(self.inputs,\n                                                                  edict,\n                                                                  self.input_units_equivalencies)\n\n            # We now iterate over the different inputs and make sure that their\n            # units are consistent with those specified in input_units.\n            for i in range(len(inputs)):\n\n                input_name = self.inputs[i]\n                input_unit = self.input_units.get(input_name, None)\n\n                if input_unit is None:\n                    continue\n\n                if isinstance(inputs[i], Quantity):\n\n                    # We check for consistency of the units with input_units,\n                    # taking into account any equivalencies\n\n                    if inputs[i].unit.is_equivalent(\n                            input_unit,\n                            equivalencies=input_units_equivalencies[input_name]):\n\n                        # If equivalencies have been specified, we need to\n                        # convert the input to the input units - this is\n                        # because some equivalencies are non-linear, and\n                        # we need to be sure that we evaluate the model in\n                        # its own frame of reference. If input_units_strict\n                        # is set, we also need to convert to the input units.\n                        if len(input_units_equivalencies) > 0 or self.input_units_strict[input_name]:\n                            inputs[i] = inputs[i].to(input_unit,\n                                                     equivalencies=input_units_equivalencies[input_name])\n\n                    else:\n\n                        # We consider the following two cases separately so as\n                        # to be able to raise more appropriate/nicer exceptions\n\n                        if input_unit is dimensionless_unscaled:\n                            raise UnitsError(\"{0}: Units of input '{1}', {2} ({3}),\"\n                                             \"could not be converted to \"\n                                             \"required dimensionless \"\n                                             \"input\".format(name,\n                                                            self.inputs[i],\n                                                            inputs[i].unit,\n                                                            inputs[i].unit.physical_type))\n                        else:\n                            raise UnitsError(\"{0}: Units of input '{1}', {2} ({3}),\"\n                                             \" could not be \"\n                                             \"converted to required input\"\n                                             \" units of {4} ({5})\".format(\n                                                 name,\n                                                 self.inputs[i],\n                                                 inputs[i].unit,\n                                                 inputs[i].unit.physical_type,\n                                                 input_unit,\n                                                 input_unit.physical_type))\n                else:\n\n                    # If we allow dimensionless input, we add the units to the\n                    # input values without conversion, otherwise we raise an\n                    # exception.\n\n                    if (not self.input_units_allow_dimensionless[input_name] and\n                        input_unit is not dimensionless_unscaled and\n                        input_unit is not None):\n                        if np.any(inputs[i] != 0):\n                            raise UnitsError(\"{0}: Units of input '{1}', (dimensionless), could not be \"\n                                             \"converted to required input units of \"\n                                             \"{2} ({3})\".format(name, self.inputs[i], input_unit,\n                                                                input_unit.physical_type))\n        return inputs"},{"col":4,"comment":"null","endLoc":32,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3641,"name":"to_tree_transform","nodeType":"Function","startLoc":27,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'alpha': _parameter_to_value(model.alpha)}\n        return node"},{"className":"AffineType","col":0,"comment":"null","endLoc":46,"id":3642,"nodeType":"Class","startLoc":15,"text":"class AffineType(TransformType):\n    name = \"transform/affine\"\n    version = '1.3.0'\n    types = ['astropy.modeling.projections.AffineTransformation2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        matrix = node['matrix']\n        translation = node['translation']\n        if matrix.shape != (2, 2):\n            raise NotImplementedError(\n                \"asdf currently only supports 2x2 (2D) rotation transformation \"\n                \"matrices\")\n        if translation.shape != (2,):\n            raise NotImplementedError(\n                \"asdf currently only supports 2D translation transformations.\")\n\n        return modeling.projections.AffineTransformation2D(\n            matrix=matrix, translation=translation)\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        return {'matrix': _parameter_to_value(model.matrix),\n                'translation': _parameter_to_value(model.translation)}\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (a.__class__ == b.__class__)\n        assert_array_equal(a.matrix, b.matrix)\n        assert_array_equal(a.translation, b.translation)"},{"col":4,"comment":"null","endLoc":42,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3643,"name":"assert_equal","nodeType":"Function","startLoc":34,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, powerlaws.PowerLaw1D) and\n                isinstance(b, powerlaws.PowerLaw1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.alpha, b.alpha)"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":3644,"name":"name","nodeType":"Attribute","startLoc":17,"text":"name"},{"col":4,"comment":"null","endLoc":33,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3645,"name":"from_tree_transform","nodeType":"Function","startLoc":20,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        matrix = node['matrix']\n        translation = node['translation']\n        if matrix.shape != (2, 2):\n            raise NotImplementedError(\n                \"asdf currently only supports 2x2 (2D) rotation transformation \"\n                \"matrices\")\n        if translation.shape != (2,):\n            raise NotImplementedError(\n                \"asdf currently only supports 2D translation transformations.\")\n\n        return modeling.projections.AffineTransformation2D(\n            matrix=matrix, translation=translation)"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":3646,"name":"version","nodeType":"Attribute","startLoc":18,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":19,"id":3647,"name":"types","nodeType":"Attribute","startLoc":19,"text":"types"},{"className":"BrokenPowerLaw1DType","col":0,"comment":"null","endLoc":74,"id":3648,"nodeType":"Class","startLoc":45,"text":"class BrokenPowerLaw1DType(TransformType):\n    name = 'transform/broken_power_law1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.powerlaws.BrokenPowerLaw1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return powerlaws.BrokenPowerLaw1D(amplitude=node['amplitude'],\n                                          x_break=node['x_break'],\n                                          alpha_1=node['alpha_1'],\n                                          alpha_2=node['alpha_2'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_break': _parameter_to_value(model.x_break),\n                'alpha_1': _parameter_to_value(model.alpha_1),\n                'alpha_2': _parameter_to_value(model.alpha_2)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, powerlaws.BrokenPowerLaw1D) and\n                isinstance(b, powerlaws.BrokenPowerLaw1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_break, b.x_break)\n        assert_array_equal(a.alpha_1, b.alpha_1)\n        assert_array_equal(a.alpha_2, b.alpha_2)"},{"col":0,"comment":"\n    Represents a multi-dimensional Numpy array flattened onto a single line.\n    ","endLoc":242,"header":"def array_repr_oneline(array)","id":3649,"name":"array_repr_oneline","nodeType":"Function","startLoc":237,"text":"def array_repr_oneline(array):\n    \"\"\"\n    Represents a multi-dimensional Numpy array flattened onto a single line.\n    \"\"\"\n    r = np.array2string(array, separator=', ', suppress_small=True)\n    return ' '.join(l.strip() for l in r.splitlines())"},{"col":4,"comment":"null","endLoc":55,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3650,"name":"from_tree_transform","nodeType":"Function","startLoc":50,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return powerlaws.BrokenPowerLaw1D(amplitude=node['amplitude'],\n                                          x_break=node['x_break'],\n                                          alpha_1=node['alpha_1'],\n                                          alpha_2=node['alpha_2'])"},{"col":0,"comment":"null","endLoc":365,"header":"def _combine_equivalency_dict(keys, eq1=None, eq2=None)","id":3651,"name":"_combine_equivalency_dict","nodeType":"Function","startLoc":354,"text":"def _combine_equivalency_dict(keys, eq1=None, eq2=None):\n    # Given two dictionaries that give equivalencies for a set of keys, for\n    # example input value names, return a dictionary that includes all the\n    # equivalencies\n    eq = {}\n    for key in keys:\n        eq[key] = []\n        if eq1 is not None and key in eq1:\n            eq[key].extend(eq1[key])\n        if eq2 is not None and key in eq2:\n            eq[key].extend(eq2[key])\n    return eq"},{"col":4,"comment":"null","endLoc":317,"header":"def __init__(self, amplitude=amplitude.default, x_mean=x_mean.default,\n                 y_mean=y_mean.default, x_stddev=None, y_stddev=None,\n                 theta=None, cov_matrix=None, **kwargs)","id":3652,"name":"__init__","nodeType":"Function","startLoc":282,"text":"def __init__(self, amplitude=amplitude.default, x_mean=x_mean.default,\n                 y_mean=y_mean.default, x_stddev=None, y_stddev=None,\n                 theta=None, cov_matrix=None, **kwargs):\n        if cov_matrix is None:\n            if x_stddev is None:\n                x_stddev = self.__class__.x_stddev.default\n            if y_stddev is None:\n                y_stddev = self.__class__.y_stddev.default\n            if theta is None:\n                theta = self.__class__.theta.default\n        else:\n            if x_stddev is not None or y_stddev is not None or theta is not None:\n                raise InputParameterError(\"Cannot specify both cov_matrix and \"\n                                          \"x/y_stddev/theta\")\n            # Compute principle coordinate system transformation\n            cov_matrix = np.array(cov_matrix)\n\n            if cov_matrix.shape != (2, 2):\n                raise ValueError(\"Covariance matrix must be 2x2\")\n\n            eig_vals, eig_vecs = np.linalg.eig(cov_matrix)\n            x_stddev, y_stddev = np.sqrt(eig_vals)\n            y_vec = eig_vecs[:, 0]\n            theta = np.arctan2(y_vec[1], y_vec[0])\n\n        # Ensure stddev makes sense if its bounds are not explicitly set.\n        # stddev must be non-zero and positive.\n        # TODO: Investigate why setting this in Parameter above causes\n        #       convolution tests to hang.\n        kwargs.setdefault('bounds', {})\n        kwargs['bounds'].setdefault('x_stddev', (FLOAT_EPSILON, None))\n        kwargs['bounds'].setdefault('y_stddev', (FLOAT_EPSILON, None))\n\n        super().__init__(\n            amplitude=amplitude, x_mean=x_mean, y_mean=y_mean,\n            x_stddev=x_stddev, y_stddev=y_stddev, theta=theta, **kwargs)"},{"col":4,"comment":"null","endLoc":38,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3653,"name":"to_tree_transform","nodeType":"Function","startLoc":35,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        return {'matrix': _parameter_to_value(model.matrix),\n                'translation': _parameter_to_value(model.translation)}"},{"col":4,"comment":"null","endLoc":46,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3654,"name":"assert_equal","nodeType":"Function","startLoc":40,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (a.__class__ == b.__class__)\n        assert_array_equal(a.matrix, b.matrix)\n        assert_array_equal(a.translation, b.translation)"},{"col":29,"endLoc":1395,"id":3655,"nodeType":"Lambda","startLoc":1395,"text":"lambda x: np.abs(x.scale)"},{"col":4,"comment":"null","endLoc":63,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3656,"name":"to_tree_transform","nodeType":"Function","startLoc":57,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_break': _parameter_to_value(model.x_break),\n                'alpha_1': _parameter_to_value(model.alpha_1),\n                'alpha_2': _parameter_to_value(model.alpha_2)}\n        return node"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":3657,"name":"name","nodeType":"Attribute","startLoc":16,"text":"name"},{"col":4,"comment":"null","endLoc":74,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3658,"name":"assert_equal","nodeType":"Function","startLoc":65,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, powerlaws.BrokenPowerLaw1D) and\n                isinstance(b, powerlaws.BrokenPowerLaw1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_break, b.x_break)\n        assert_array_equal(a.alpha_1, b.alpha_1)\n        assert_array_equal(a.alpha_2, b.alpha_2)"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":3659,"name":"version","nodeType":"Attribute","startLoc":17,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":3660,"name":"types","nodeType":"Attribute","startLoc":18,"text":"types"},{"col":29,"endLoc":1396,"id":3661,"nodeType":"Lambda","startLoc":1396,"text":"lambda x: np.sum(np.abs(x.powers))"},{"className":"Rotate2DType","col":0,"comment":"null","endLoc":68,"id":3662,"nodeType":"Class","startLoc":49,"text":"class Rotate2DType(TransformType):\n    name = \"transform/rotate2d\"\n    version = '1.3.0'\n    types = ['astropy.modeling.rotations.Rotation2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return modeling.rotations.Rotation2D(node['angle'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        return {'angle': _parameter_to_value(model.angle)}\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, modeling.rotations.Rotation2D) and\n                isinstance(b, modeling.rotations.Rotation2D))\n        assert_array_equal(a.angle, b.angle)"},{"col":4,"comment":"null","endLoc":56,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3663,"name":"from_tree_transform","nodeType":"Function","startLoc":54,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return modeling.rotations.Rotation2D(node['angle'])"},{"attributeType":"null","col":4,"comment":"null","endLoc":46,"id":3664,"name":"name","nodeType":"Attribute","startLoc":46,"text":"name"},{"col":4,"comment":"null","endLoc":60,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3665,"name":"to_tree_transform","nodeType":"Function","startLoc":58,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        return {'angle': _parameter_to_value(model.angle)}"},{"attributeType":"null","col":4,"comment":"null","endLoc":47,"id":3666,"name":"version","nodeType":"Attribute","startLoc":47,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":48,"id":3667,"name":"types","nodeType":"Attribute","startLoc":48,"text":"types"},{"col":29,"endLoc":1397,"id":3668,"nodeType":"Lambda","startLoc":1397,"text":"lambda x: np.sum(x.powers) < 0.0"},{"col":4,"comment":"null","endLoc":68,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3669,"name":"assert_equal","nodeType":"Function","startLoc":62,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, modeling.rotations.Rotation2D) and\n                isinstance(b, modeling.rotations.Rotation2D))\n        assert_array_equal(a.angle, b.angle)"},{"className":"SmoothlyBrokenPowerLaw1DType","col":0,"comment":"null","endLoc":109,"id":3670,"nodeType":"Class","startLoc":77,"text":"class SmoothlyBrokenPowerLaw1DType(TransformType):\n    name = 'transform/smoothly_broken_power_law1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.powerlaws.SmoothlyBrokenPowerLaw1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return powerlaws.SmoothlyBrokenPowerLaw1D(amplitude=node['amplitude'],\n                                                  x_break=node['x_break'],\n                                                  alpha_1=node['alpha_1'],\n                                                  alpha_2=node['alpha_2'],\n                                                  delta=node['delta'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_break': _parameter_to_value(model.x_break),\n                'alpha_1': _parameter_to_value(model.alpha_1),\n                'alpha_2': _parameter_to_value(model.alpha_2),\n                'delta': _parameter_to_value(model.delta)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, powerlaws.SmoothlyBrokenPowerLaw1D) and\n                isinstance(b, powerlaws.SmoothlyBrokenPowerLaw1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_break, b.x_break)\n        assert_array_equal(a.alpha_1, b.alpha_1)\n        assert_array_equal(a.alpha_2, b.alpha_2)\n        assert_array_equal(a.delta, b.delta)"},{"col":4,"comment":"null","endLoc":88,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3671,"name":"from_tree_transform","nodeType":"Function","startLoc":82,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return powerlaws.SmoothlyBrokenPowerLaw1D(amplitude=node['amplitude'],\n                                                  x_break=node['x_break'],\n                                                  alpha_1=node['alpha_1'],\n                                                  alpha_2=node['alpha_2'],\n                                                  delta=node['delta'])"},{"attributeType":"null","col":4,"comment":"null","endLoc":50,"id":3672,"name":"name","nodeType":"Attribute","startLoc":50,"text":"name"},{"col":29,"endLoc":1398,"id":3673,"nodeType":"Lambda","startLoc":1398,"text":"lambda x: not is_effectively_unity(x.scale)"},{"attributeType":"null","col":4,"comment":"null","endLoc":51,"id":3674,"name":"version","nodeType":"Attribute","startLoc":51,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":52,"id":3675,"name":"types","nodeType":"Attribute","startLoc":52,"text":"types"},{"className":"Rotate3DType","col":0,"comment":"null","endLoc":143,"id":3676,"nodeType":"Class","startLoc":71,"text":"class Rotate3DType(TransformType):\n    name = \"transform/rotate3d\"\n    version = '1.3.0'\n    types = ['astropy.modeling.rotations.RotateNative2Celestial',\n             'astropy.modeling.rotations.RotateCelestial2Native',\n             'astropy.modeling.rotations.EulerAngleRotation']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        if node['direction'] == 'native2celestial':\n            return modeling.rotations.RotateNative2Celestial(node[\"phi\"],\n                                                             node[\"theta\"],\n                                                             node[\"psi\"])\n        elif node['direction'] == 'celestial2native':\n            return modeling.rotations.RotateCelestial2Native(node[\"phi\"],\n                                                             node[\"theta\"],\n                                                             node[\"psi\"])\n        else:\n            return modeling.rotations.EulerAngleRotation(node[\"phi\"],\n                                                         node[\"theta\"],\n                                                         node[\"psi\"],\n                                                         axes_order=node[\"direction\"])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        if isinstance(model, modeling.rotations.RotateNative2Celestial):\n            try:\n                node = {\"phi\": _parameter_to_value(model.lon),\n                        \"theta\": _parameter_to_value(model.lat),\n                        \"psi\": _parameter_to_value(model.lon_pole),\n                        \"direction\": \"native2celestial\"\n                        }\n            except AttributeError:\n                node = {\"phi\": model.lon,\n                        \"theta\": model.lat,\n                        \"psi\": model.lon_pole,\n                        \"direction\": \"native2celestial\"\n                        }\n        elif isinstance(model, modeling.rotations.RotateCelestial2Native):\n            try:\n                node = {\"phi\": _parameter_to_value(model.lon),\n                        \"theta\": _parameter_to_value(model.lat),\n                        \"psi\": _parameter_to_value(model.lon_pole),\n                        \"direction\": \"celestial2native\"\n                        }\n            except AttributeError:\n                node = {\"phi\": model.lon,\n                        \"theta\": model.lat,\n                        \"psi\": model.lon_pole,\n                        \"direction\": \"celestial2native\"\n                        }\n        else:\n            node = {\"phi\": _parameter_to_value(model.phi),\n                    \"theta\": _parameter_to_value(model.theta),\n                    \"psi\": _parameter_to_value(model.psi),\n                    \"direction\": model.axes_order\n                    }\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert a.__class__ == b.__class__\n        if a.__class__.__name__ == \"EulerAngleRotation\":\n            assert_array_equal(a.phi, b.phi)\n            assert_array_equal(a.psi, b.psi)\n            assert_array_equal(a.theta, b.theta)\n        else:\n            assert_array_equal(a.lon, b.lon)\n            assert_array_equal(a.lat, b.lat)\n            assert_array_equal(a.lon_pole, b.lon_pole)"},{"col":4,"comment":"null","endLoc":92,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3677,"name":"from_tree_transform","nodeType":"Function","startLoc":78,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        if node['direction'] == 'native2celestial':\n            return modeling.rotations.RotateNative2Celestial(node[\"phi\"],\n                                                             node[\"theta\"],\n                                                             node[\"psi\"])\n        elif node['direction'] == 'celestial2native':\n            return modeling.rotations.RotateCelestial2Native(node[\"phi\"],\n                                                             node[\"theta\"],\n                                                             node[\"psi\"])\n        else:\n            return modeling.rotations.EulerAngleRotation(node[\"phi\"],\n                                                         node[\"theta\"],\n                                                         node[\"psi\"],\n                                                         axes_order=node[\"direction\"])"},{"col":4,"comment":"null","endLoc":97,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3678,"name":"to_tree_transform","nodeType":"Function","startLoc":90,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_break': _parameter_to_value(model.x_break),\n                'alpha_1': _parameter_to_value(model.alpha_1),\n                'alpha_2': _parameter_to_value(model.alpha_2),\n                'delta': _parameter_to_value(model.delta)}\n        return node"},{"col":4,"comment":"null","endLoc":109,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3679,"name":"assert_equal","nodeType":"Function","startLoc":99,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, powerlaws.SmoothlyBrokenPowerLaw1D) and\n                isinstance(b, powerlaws.SmoothlyBrokenPowerLaw1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_break, b.x_break)\n        assert_array_equal(a.alpha_1, b.alpha_1)\n        assert_array_equal(a.alpha_2, b.alpha_2)\n        assert_array_equal(a.delta, b.delta)"},{"col":4,"comment":"null","endLoc":1910,"header":"def _prepare_inputs_single_model(self, params, inputs, **kwargs)","id":3680,"name":"_prepare_inputs_single_model","nodeType":"Function","startLoc":1865,"text":"def _prepare_inputs_single_model(self, params, inputs, **kwargs):\n        broadcasts = []\n        for idx, _input in enumerate(inputs):\n            input_shape = _input.shape\n\n            # Ensure that array scalars are always upgrade to 1-D arrays for the\n            # sake of consistency with how parameters work.  They will be cast back\n            # to scalars at the end\n            if not input_shape:\n                inputs[idx] = _input.reshape((1,))\n\n            if not params:\n                max_broadcast = input_shape\n            else:\n                max_broadcast = ()\n\n            for param in params:\n                try:\n                    if self.standard_broadcasting:\n                        broadcast = check_broadcast(input_shape, param.shape)\n                    else:\n                        broadcast = input_shape\n                except IncompatibleShapeError:\n                    raise ValueError(\n                        \"self input argument {0!r} of shape {1!r} cannot be \"\n                        \"broadcast with parameter {2!r} of shape \"\n                        \"{3!r}.\".format(self.inputs[idx], input_shape,\n                                        param.name, param.shape))\n\n                if len(broadcast) > len(max_broadcast):\n                    max_broadcast = broadcast\n                elif len(broadcast) == len(max_broadcast):\n                    max_broadcast = max(max_broadcast, broadcast)\n\n            broadcasts.append(max_broadcast)\n\n        if self.n_outputs > self.n_inputs:\n            extra_outputs = self.n_outputs - self.n_inputs\n            if not broadcasts:\n                # If there were no inputs then the broadcasts list is empty\n                # just add a None since there is no broadcasting of outputs and\n                # inputs necessary (see _prepare_outputs_single_self)\n                broadcasts.append(None)\n            broadcasts.extend([broadcasts[0]] * extra_outputs)\n\n        return inputs, (broadcasts,)"},{"col":4,"comment":"null","endLoc":129,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3681,"name":"to_tree_transform","nodeType":"Function","startLoc":94,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        if isinstance(model, modeling.rotations.RotateNative2Celestial):\n            try:\n                node = {\"phi\": _parameter_to_value(model.lon),\n                        \"theta\": _parameter_to_value(model.lat),\n                        \"psi\": _parameter_to_value(model.lon_pole),\n                        \"direction\": \"native2celestial\"\n                        }\n            except AttributeError:\n                node = {\"phi\": model.lon,\n                        \"theta\": model.lat,\n                        \"psi\": model.lon_pole,\n                        \"direction\": \"native2celestial\"\n                        }\n        elif isinstance(model, modeling.rotations.RotateCelestial2Native):\n            try:\n                node = {\"phi\": _parameter_to_value(model.lon),\n                        \"theta\": _parameter_to_value(model.lat),\n                        \"psi\": _parameter_to_value(model.lon_pole),\n                        \"direction\": \"celestial2native\"\n                        }\n            except AttributeError:\n                node = {\"phi\": model.lon,\n                        \"theta\": model.lat,\n                        \"psi\": model.lon_pole,\n                        \"direction\": \"celestial2native\"\n                        }\n        else:\n            node = {\"phi\": _parameter_to_value(model.phi),\n                    \"theta\": _parameter_to_value(model.theta),\n                    \"psi\": _parameter_to_value(model.psi),\n                    \"direction\": model.axes_order\n                    }\n\n        return node"},{"attributeType":"null","col":4,"comment":"null","endLoc":78,"id":3682,"name":"name","nodeType":"Attribute","startLoc":78,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":79,"id":3683,"name":"version","nodeType":"Attribute","startLoc":79,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":80,"id":3684,"name":"types","nodeType":"Attribute","startLoc":80,"text":"types"},{"className":"ExponentialCutoffPowerLaw1DType","col":0,"comment":"null","endLoc":141,"id":3685,"nodeType":"Class","startLoc":112,"text":"class ExponentialCutoffPowerLaw1DType(TransformType):\n    name = 'transform/exponential_cutoff_power_law1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.powerlaws.ExponentialCutoffPowerLaw1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return powerlaws.ExponentialCutoffPowerLaw1D(amplitude=node['amplitude'],\n                                                     x_0=node['x_0'],\n                                                     alpha=node['alpha'],\n                                                     x_cutoff=node['x_cutoff'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'alpha': _parameter_to_value(model.alpha),\n                'x_cutoff': _parameter_to_value(model.x_cutoff)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, powerlaws.ExponentialCutoffPowerLaw1D) and\n                isinstance(b, powerlaws.ExponentialCutoffPowerLaw1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.alpha, b.alpha)\n        assert_array_equal(a.x_cutoff, b.x_cutoff)"},{"col":4,"comment":"null","endLoc":122,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3686,"name":"from_tree_transform","nodeType":"Function","startLoc":117,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return powerlaws.ExponentialCutoffPowerLaw1D(amplitude=node['amplitude'],\n                                                     x_0=node['x_0'],\n                                                     alpha=node['alpha'],\n                                                     x_cutoff=node['x_cutoff'])"},{"col":4,"comment":"null","endLoc":143,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3687,"name":"assert_equal","nodeType":"Function","startLoc":131,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert a.__class__ == b.__class__\n        if a.__class__.__name__ == \"EulerAngleRotation\":\n            assert_array_equal(a.phi, b.phi)\n            assert_array_equal(a.psi, b.psi)\n            assert_array_equal(a.theta, b.theta)\n        else:\n            assert_array_equal(a.lon, b.lon)\n            assert_array_equal(a.lat, b.lat)\n            assert_array_equal(a.lon_pole, b.lon_pole)"},{"col":4,"comment":"null","endLoc":876,"header":"def __str__(self)","id":3688,"name":"__str__","nodeType":"Function","startLoc":875,"text":"def __str__(self):\n        return self._format_str()"},{"col":4,"comment":"null","endLoc":130,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3689,"name":"to_tree_transform","nodeType":"Function","startLoc":124,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'alpha': _parameter_to_value(model.alpha),\n                'x_cutoff': _parameter_to_value(model.x_cutoff)}\n        return node"},{"col":4,"comment":"null","endLoc":1995,"header":"def _prepare_inputs_model_set(self, params, inputs, model_set_axis_input,\n                                  **kwargs)","id":3690,"name":"_prepare_inputs_model_set","nodeType":"Function","startLoc":1929,"text":"def _prepare_inputs_model_set(self, params, inputs, model_set_axis_input,\n                                  **kwargs):\n        reshaped = []\n        pivots = []\n\n        model_set_axis_param = self.model_set_axis  # needed to reshape param\n        for idx, _input in enumerate(inputs):\n            max_param_shape = ()\n            if self._n_models > 1 and model_set_axis_input is not False:\n                # Use the shape of the input *excluding* the model axis\n                input_shape = (_input.shape[:model_set_axis_input] +\n                               _input.shape[model_set_axis_input + 1:])\n            else:\n                input_shape = _input.shape\n\n            for param in params:\n                try:\n                    check_broadcast(input_shape,\n                                    self._remove_axes_from_shape(param.shape,\n                                                                 model_set_axis_param))\n                except IncompatibleShapeError:\n                    raise ValueError(\n                        \"Model input argument {0!r} of shape {1!r} cannot be \"\n                        \"broadcast with parameter {2!r} of shape \"\n                        \"{3!r}.\".format(self.inputs[idx], input_shape,\n                                        param.name,\n                                        self._remove_axes_from_shape(param.shape,\n                                                                     model_set_axis_param)))\n\n                if len(param.shape) - 1 > len(max_param_shape):\n                    max_param_shape = self._remove_axes_from_shape(param.shape,\n                                                                   model_set_axis_param)\n\n            # We've now determined that, excluding the model_set_axis, the\n            # input can broadcast with all the parameters\n            input_ndim = len(input_shape)\n            if model_set_axis_input is False:\n                if len(max_param_shape) > input_ndim:\n                    # Just needs to prepend new axes to the input\n                    n_new_axes = 1 + len(max_param_shape) - input_ndim\n                    new_axes = (1,) * n_new_axes\n                    new_shape = new_axes + _input.shape\n                    pivot = model_set_axis_param\n                else:\n                    pivot = input_ndim - len(max_param_shape)\n                    new_shape = (_input.shape[:pivot] + (1,) +\n                                 _input.shape[pivot:])\n                new_input = _input.reshape(new_shape)\n            else:\n                if len(max_param_shape) >= input_ndim:\n                    n_new_axes = len(max_param_shape) - input_ndim\n                    pivot = self.model_set_axis\n                    new_axes = (1,) * n_new_axes\n                    new_shape = (_input.shape[:pivot + 1] + new_axes +\n                                 _input.shape[pivot + 1:])\n                    new_input = _input.reshape(new_shape)\n                else:\n                    pivot = _input.ndim - len(max_param_shape) - 1\n                    new_input = np.rollaxis(_input, model_set_axis_input,\n                                            pivot + 1)\n            pivots.append(pivot)\n            reshaped.append(new_input)\n\n        if self.n_inputs < self.n_outputs:\n            pivots.extend([model_set_axis_input] * (self.n_outputs - self.n_inputs))\n\n        return reshaped, (pivots,)"},{"attributeType":"null","col":4,"comment":"null","endLoc":72,"id":3691,"name":"name","nodeType":"Attribute","startLoc":72,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":73,"id":3692,"name":"version","nodeType":"Attribute","startLoc":73,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":74,"id":3693,"name":"types","nodeType":"Attribute","startLoc":74,"text":"types"},{"className":"RotationSequenceType","col":0,"comment":"null","endLoc":181,"id":3694,"nodeType":"Class","startLoc":146,"text":"class RotationSequenceType(TransformType):\n    name = \"transform/rotate_sequence_3d\"\n    types = ['astropy.modeling.rotations.RotationSequence3D',\n             'astropy.modeling.rotations.SphericalRotationSequence']\n    version = \"1.0.0\"\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        angles = node['angles']\n        axes_order = node['axes_order']\n        rotation_type = node['rotation_type']\n        if rotation_type == 'cartesian':\n            return modeling.rotations.RotationSequence3D(angles, axes_order=axes_order)\n        elif rotation_type == 'spherical':\n            return modeling.rotations.SphericalRotationSequence(angles, axes_order=axes_order)\n        else:\n            raise ValueError(f\"Unrecognized rotation_type: {rotation_type}\")\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'angles': list(model.angles.value)}\n        node['axes_order'] = model.axes_order\n        if isinstance(model, modeling.rotations.SphericalRotationSequence):\n            node['rotation_type'] = \"spherical\"\n        elif isinstance(model, modeling.rotations.RotationSequence3D):\n            node['rotation_type'] = \"cartesian\"\n        else:\n            raise ValueError(f\"Cannot serialize model of type {type(model)}\")\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        TransformType.assert_equal(a, b)\n        assert a.__class__.__name__ == b.__class__.__name__\n        assert_array_equal(a.angles, b.angles)\n        assert a.axes_order == b.axes_order"},{"col":4,"comment":"null","endLoc":162,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3695,"name":"from_tree_transform","nodeType":"Function","startLoc":152,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        angles = node['angles']\n        axes_order = node['axes_order']\n        rotation_type = node['rotation_type']\n        if rotation_type == 'cartesian':\n            return modeling.rotations.RotationSequence3D(angles, axes_order=axes_order)\n        elif rotation_type == 'spherical':\n            return modeling.rotations.SphericalRotationSequence(angles, axes_order=axes_order)\n        else:\n            raise ValueError(f\"Unrecognized rotation_type: {rotation_type}\")"},{"col":4,"comment":"\n        Converts this unit into ones belonging to the given system.\n        Since more than one result may be possible, a list is always\n        returned.\n\n        Parameters\n        ----------\n        system : module\n            The module that defines the unit system.  Commonly used\n            ones include `astropy.units.si` and `astropy.units.cgs`.\n\n            To use your own module it must contain unit objects and a\n            sequence member named ``bases`` containing the base units of\n            the system.\n\n        Returns\n        -------\n        units : list of `CompositeUnit`\n            The list is ranked so that units containing only the base\n            units of that system will appear first.\n        ","endLoc":1456,"header":"def to_system(self, system)","id":3697,"name":"to_system","nodeType":"Function","startLoc":1413,"text":"def to_system(self, system):\n        \"\"\"\n        Converts this unit into ones belonging to the given system.\n        Since more than one result may be possible, a list is always\n        returned.\n\n        Parameters\n        ----------\n        system : module\n            The module that defines the unit system.  Commonly used\n            ones include `astropy.units.si` and `astropy.units.cgs`.\n\n            To use your own module it must contain unit objects and a\n            sequence member named ``bases`` containing the base units of\n            the system.\n\n        Returns\n        -------\n        units : list of `CompositeUnit`\n            The list is ranked so that units containing only the base\n            units of that system will appear first.\n        \"\"\"\n        bases = set(system.bases)\n\n        def score(compose):\n            # In case that compose._bases has no elements we return\n            # 'np.inf' as 'score value'.  It does not really matter which\n            # number we would return. This case occurs for instance for\n            # dimensionless quantities:\n            compose_bases = compose.bases\n            if len(compose_bases) == 0:\n                return np.inf\n            else:\n                sum = 0\n                for base in compose_bases:\n                    if base in bases:\n                        sum += 1\n\n                return sum / float(len(compose_bases))\n\n        x = self.decompose(bases=bases)\n        composed = x.compose(units=system)\n        composed = sorted(composed, key=score, reverse=True)\n        return composed"},{"col":4,"comment":"\n        Internal implementation of ``__str__``.\n\n        This is separated out for ease of use by subclasses that wish to\n        override the default ``__str__`` while keeping the same basic\n        formatting.\n        ","endLoc":2793,"header":"def _format_str(self, keywords=[], defaults={})","id":3698,"name":"_format_str","nodeType":"Function","startLoc":2752,"text":"def _format_str(self, keywords=[], defaults={}):\n        \"\"\"\n        Internal implementation of ``__str__``.\n\n        This is separated out for ease of use by subclasses that wish to\n        override the default ``__str__`` while keeping the same basic\n        formatting.\n        \"\"\"\n\n        default_keywords = [\n            ('Model', self.__class__.__name__),\n            ('Name', self.name),\n            ('Inputs', self.inputs),\n            ('Outputs', self.outputs),\n            ('Model set size', len(self))\n        ]\n\n        parts = [f'{keyword}: {value}'\n                 for keyword, value in default_keywords\n                 if value is not None]\n\n        for keyword, value in keywords:\n            if keyword.lower() in defaults and defaults[keyword.lower()] == value:\n                continue\n            parts.append(f'{keyword}: {value}')\n        parts.append('Parameters:')\n\n        if len(self) == 1:\n            columns = [[getattr(self, name).value]\n                       for name in self.param_names]\n        else:\n            columns = [getattr(self, name).value\n                       for name in self.param_names]\n\n        if columns:\n            param_table = Table(columns, names=self.param_names)\n            # Set units on the columns\n            for name in self.param_names:\n                param_table[name].unit = getattr(self, name).unit\n            parts.append(indent(str(param_table), width=4))\n\n        return '\\n'.join(parts)"},{"col":4,"comment":"\n        Given a shape tuple as the first input, construct a new one by  removing\n        that particular axis from the shape and all preceeding axes. Negative axis\n        numbers are permittted, where the axis is relative to the last axis.\n        ","endLoc":1927,"header":"@staticmethod\n    def _remove_axes_from_shape(shape, axis)","id":3699,"name":"_remove_axes_from_shape","nodeType":"Function","startLoc":1912,"text":"@staticmethod\n    def _remove_axes_from_shape(shape, axis):\n        \"\"\"\n        Given a shape tuple as the first input, construct a new one by  removing\n        that particular axis from the shape and all preceeding axes. Negative axis\n        numbers are permittted, where the axis is relative to the last axis.\n        \"\"\"\n        if len(shape) == 0:\n            return shape\n        if axis < 0:\n            axis = len(shape) + axis\n            return shape[:axis] + shape[axis+1:]\n        if axis >= len(shape):\n            axis = len(shape)-1\n        shape = shape[axis+1:]\n        return shape"},{"col":4,"comment":"\n        Returns a copy of the current `Unit` instance in SI units.\n        ","endLoc":1465,"header":"@lazyproperty\n    def si(self)","id":3700,"name":"si","nodeType":"Function","startLoc":1458,"text":"@lazyproperty\n    def si(self):\n        \"\"\"\n        Returns a copy of the current `Unit` instance in SI units.\n        \"\"\"\n\n        from . import si\n        return self.to_system(si)[0]"},{"col":4,"comment":"\n        Returns a copy of the current `Unit` instance with CGS units.\n        ","endLoc":1473,"header":"@lazyproperty\n    def cgs(self)","id":3701,"name":"cgs","nodeType":"Function","startLoc":1467,"text":"@lazyproperty\n    def cgs(self):\n        \"\"\"\n        Returns a copy of the current `Unit` instance with CGS units.\n        \"\"\"\n        from . import cgs\n        return self.to_system(cgs)[0]"},{"col":4,"comment":"\n        Physical type(s) dimensionally compatible with the unit.\n\n        Returns\n        -------\n        `~astropy.units.physical.PhysicalType`\n            A representation of the physical type(s) of a unit.\n\n        Examples\n        --------\n        >>> from astropy import units as u\n        >>> u.m.physical_type\n        PhysicalType('length')\n        >>> (u.m ** 2 / u.s).physical_type\n        PhysicalType({'diffusivity', 'kinematic viscosity'})\n\n        Physical types can be compared to other physical types\n        (recommended in packages) or to strings.\n\n        >>> area = (u.m ** 2).physical_type\n        >>> area == u.m.physical_type ** 2\n        True\n        >>> area == \"area\"\n        True\n\n        `~astropy.units.physical.PhysicalType` objects can be used for\n        dimensional analysis.\n\n        >>> number_density = u.m.physical_type ** -3\n        >>> velocity = (u.m / u.s).physical_type\n        >>> number_density * velocity\n        PhysicalType('particle flux')\n        ","endLoc":1511,"header":"@property\n    def physical_type(self)","id":3702,"name":"physical_type","nodeType":"Function","startLoc":1475,"text":"@property\n    def physical_type(self):\n        \"\"\"\n        Physical type(s) dimensionally compatible with the unit.\n\n        Returns\n        -------\n        `~astropy.units.physical.PhysicalType`\n            A representation of the physical type(s) of a unit.\n\n        Examples\n        --------\n        >>> from astropy import units as u\n        >>> u.m.physical_type\n        PhysicalType('length')\n        >>> (u.m ** 2 / u.s).physical_type\n        PhysicalType({'diffusivity', 'kinematic viscosity'})\n\n        Physical types can be compared to other physical types\n        (recommended in packages) or to strings.\n\n        >>> area = (u.m ** 2).physical_type\n        >>> area == u.m.physical_type ** 2\n        True\n        >>> area == \"area\"\n        True\n\n        `~astropy.units.physical.PhysicalType` objects can be used for\n        dimensional analysis.\n\n        >>> number_density = u.m.physical_type ** -3\n        >>> velocity = (u.m / u.s).physical_type\n        >>> number_density * velocity\n        PhysicalType('particle flux')\n        \"\"\"\n        from . import physical\n        return physical.get_physical_type(self)"},{"col":4,"comment":"null","endLoc":174,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3703,"name":"to_tree_transform","nodeType":"Function","startLoc":164,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'angles': list(model.angles.value)}\n        node['axes_order'] = model.axes_order\n        if isinstance(model, modeling.rotations.SphericalRotationSequence):\n            node['rotation_type'] = \"spherical\"\n        elif isinstance(model, modeling.rotations.RotationSequence3D):\n            node['rotation_type'] = \"cartesian\"\n        else:\n            raise ValueError(f\"Cannot serialize model of type {type(model)}\")\n        return node"},{"col":4,"comment":"null","endLoc":181,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3704,"name":"assert_equal","nodeType":"Function","startLoc":176,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        TransformType.assert_equal(a, b)\n        assert a.__class__.__name__ == b.__class__.__name__\n        assert_array_equal(a.angles, b.angles)\n        assert a.axes_order == b.axes_order"},{"col":4,"comment":"\n        Return a list of all the units that are the same type as ``self``.\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            A list of equivalence pairs to also list.  See\n            :ref:`astropy:unit_equivalencies`.\n            Any list given, including an empty one, supersedes global defaults\n            that may be in effect (as set by `set_enabled_equivalencies`)\n\n        units : set of `~astropy.units.Unit`, optional\n            If not provided, all defined units will be searched for\n            equivalencies.  Otherwise, may be a dict, module or\n            sequence containing the units to search for equivalencies.\n\n        include_prefix_units : bool, optional\n            When `True`, include prefixed units in the result.\n            Default is `False`.\n\n        Returns\n        -------\n        units : list of `UnitBase`\n            A list of unit objects that match ``u``.  A subclass of\n            `list` (``EquivalentUnitsList``) is returned that\n            pretty-prints the list of units when output.\n        ","endLoc":1650,"header":"def find_equivalent_units(self, equivalencies=[], units=None,\n                              include_prefix_units=False)","id":3705,"name":"find_equivalent_units","nodeType":"Function","startLoc":1616,"text":"def find_equivalent_units(self, equivalencies=[], units=None,\n                              include_prefix_units=False):\n        \"\"\"\n        Return a list of all the units that are the same type as ``self``.\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            A list of equivalence pairs to also list.  See\n            :ref:`astropy:unit_equivalencies`.\n            Any list given, including an empty one, supersedes global defaults\n            that may be in effect (as set by `set_enabled_equivalencies`)\n\n        units : set of `~astropy.units.Unit`, optional\n            If not provided, all defined units will be searched for\n            equivalencies.  Otherwise, may be a dict, module or\n            sequence containing the units to search for equivalencies.\n\n        include_prefix_units : bool, optional\n            When `True`, include prefixed units in the result.\n            Default is `False`.\n\n        Returns\n        -------\n        units : list of `UnitBase`\n            A list of unit objects that match ``u``.  A subclass of\n            `list` (``EquivalentUnitsList``) is returned that\n            pretty-prints the list of units when output.\n        \"\"\"\n        results = self.compose(\n            equivalencies=equivalencies, units=units, max_depth=1,\n            include_prefix_units=include_prefix_units)\n        results = set(\n            x.bases[0] for x in results if len(x.bases) == 1)\n        return self.EquivalentUnitsList(results)"},{"attributeType":"null","col":4,"comment":"null","endLoc":147,"id":3706,"name":"name","nodeType":"Attribute","startLoc":147,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":148,"id":3707,"name":"types","nodeType":"Attribute","startLoc":148,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":150,"id":3708,"name":"version","nodeType":"Attribute","startLoc":150,"text":"version"},{"className":"GenericProjectionType","col":0,"comment":"null","endLoc":213,"id":3709,"nodeType":"Class","startLoc":184,"text":"class GenericProjectionType(TransformType):\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        args = []\n        for param_name, default in cls.params:\n            args.append(node.get(param_name, default))\n\n        if node['direction'] == 'pix2sky':\n            return cls.types[0](*args)\n        else:\n            return cls.types[1](*args)\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {}\n        if isinstance(model, cls.types[0]):\n            node['direction'] = 'pix2sky'\n        else:\n            node['direction'] = 'sky2pix'\n        for param_name, default in cls.params:\n            val = getattr(model, param_name).value\n            if val != default:\n                node[param_name] = val\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert a.__class__ == b.__class__"},{"col":4,"comment":"null","endLoc":194,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3710,"name":"from_tree_transform","nodeType":"Function","startLoc":185,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        args = []\n        for param_name, default in cls.params:\n            args.append(node.get(param_name, default))\n\n        if node['direction'] == 'pix2sky':\n            return cls.types[0](*args)\n        else:\n            return cls.types[1](*args)"},{"attributeType":"null","col":4,"comment":"null","endLoc":632,"id":3711,"name":"__array_priority__","nodeType":"Attribute","startLoc":632,"text":"__array_priority__"},{"attributeType":"null","col":4,"comment":"null","endLoc":634,"id":3712,"name":"_hash","nodeType":"Attribute","startLoc":634,"text":"_hash"},{"attributeType":"null","col":12,"comment":"null","endLoc":868,"id":3713,"name":"_hash","nodeType":"Attribute","startLoc":868,"text":"self._hash"},{"col":4,"comment":"\n        Get a name for this unit that is specific to a particular\n        format.\n\n        Uses the dictionary passed into the `format` kwarg in the\n        constructor.\n\n        Parameters\n        ----------\n        format : str\n            The name of the format\n\n        Returns\n        -------\n        name : str\n            The name of the unit for the given format.\n        ","endLoc":1767,"header":"def get_format_name(self, format)","id":3714,"name":"get_format_name","nodeType":"Function","startLoc":1749,"text":"def get_format_name(self, format):\n        \"\"\"\n        Get a name for this unit that is specific to a particular\n        format.\n\n        Uses the dictionary passed into the `format` kwarg in the\n        constructor.\n\n        Parameters\n        ----------\n        format : str\n            The name of the format\n\n        Returns\n        -------\n        name : str\n            The name of the unit for the given format.\n        \"\"\"\n        return self._format.get(format, self.name)"},{"col":4,"comment":"Evaluate the model on some input variables.","endLoc":1688,"header":"@abc.abstractmethod\n    def evaluate(self, *args, **kwargs)","id":3715,"name":"evaluate","nodeType":"Function","startLoc":1686,"text":"@abc.abstractmethod\n    def evaluate(self, *args, **kwargs):\n        \"\"\"Evaluate the model on some input variables.\"\"\""},{"col":4,"comment":"\n        Generic model evaluation routine\n            Selects and evaluates model with or without bounding_box enforcement\n        ","endLoc":1045,"header":"def _generic_evaluate(self, evaluate, _inputs, fill_value, with_bbox)","id":3716,"name":"_generic_evaluate","nodeType":"Function","startLoc":1032,"text":"def _generic_evaluate(self, evaluate, _inputs, fill_value, with_bbox):\n        \"\"\"\n        Generic model evaluation routine\n            Selects and evaluates model with or without bounding_box enforcement\n        \"\"\"\n\n        # Evaluate the model using the prepared evaluation method either\n        #   enforcing the bounding_box or not.\n        bbox = self.get_bounding_box(with_bbox)\n        if (not isinstance(with_bbox, bool) or with_bbox) and bbox is not None:\n            outputs = bbox.evaluate(evaluate, _inputs, fill_value)\n        else:\n            outputs = evaluate(_inputs)\n        return outputs"},{"col":4,"comment":"null","endLoc":207,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3717,"name":"to_tree_transform","nodeType":"Function","startLoc":196,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {}\n        if isinstance(model, cls.types[0]):\n            node['direction'] = 'pix2sky'\n        else:\n            node['direction'] = 'sky2pix'\n        for param_name, default in cls.params:\n            val = getattr(model, param_name).value\n            if val != default:\n                node[param_name] = val\n        return node"},{"col":4,"comment":"\n        Returns all of the names associated with this unit.\n        ","endLoc":1774,"header":"@property\n    def names(self)","id":3718,"name":"names","nodeType":"Function","startLoc":1769,"text":"@property\n    def names(self):\n        \"\"\"\n        Returns all of the names associated with this unit.\n        \"\"\"\n        return self._names"},{"col":4,"comment":"\n        Returns the canonical (short) name associated with this unit.\n        ","endLoc":1781,"header":"@property\n    def name(self)","id":3719,"name":"name","nodeType":"Function","startLoc":1776,"text":"@property\n    def name(self):\n        \"\"\"\n        Returns the canonical (short) name associated with this unit.\n        \"\"\"\n        return self._names[0]"},{"col":4,"comment":"\n        Returns the alias (long) names for this unit.\n        ","endLoc":1788,"header":"@property\n    def aliases(self)","id":3720,"name":"aliases","nodeType":"Function","startLoc":1783,"text":"@property\n    def aliases(self):\n        \"\"\"\n        Returns the alias (long) names for this unit.\n        \"\"\"\n        return self._names[1:]"},{"col":4,"comment":"\n        Returns all of the short names associated with this unit.\n        ","endLoc":1795,"header":"@property\n    def short_names(self)","id":3721,"name":"short_names","nodeType":"Function","startLoc":1790,"text":"@property\n    def short_names(self):\n        \"\"\"\n        Returns all of the short names associated with this unit.\n        \"\"\"\n        return self._short_names"},{"col":4,"comment":"\n        Returns all of the long names associated with this unit.\n        ","endLoc":1802,"header":"@property\n    def long_names(self)","id":3722,"name":"long_names","nodeType":"Function","startLoc":1797,"text":"@property\n    def long_names(self):\n        \"\"\"\n        Returns all of the long names associated with this unit.\n        \"\"\"\n        return self._long_names"},{"attributeType":"null","col":12,"comment":"null","endLoc":1719,"id":3723,"name":"_names","nodeType":"Attribute","startLoc":1719,"text":"self._names"},{"col":4,"comment":"null","endLoc":213,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3724,"name":"assert_equal","nodeType":"Function","startLoc":209,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert a.__class__ == b.__class__"},{"attributeType":"null","col":12,"comment":"null","endLoc":1721,"id":3725,"name":"_long_names","nodeType":"Attribute","startLoc":1721,"text":"self._long_names"},{"col":4,"comment":"\n        Return the ``bounding_box`` of a model if it exists or ``None``\n        otherwise.\n\n        Parameters\n        ----------\n        with_bbox :\n            The value of the ``with_bounding_box`` keyword argument\n            when calling the model. Default is `True` for usage when\n            looking up the model's ``bounding_box`` without risk of error.\n        ","endLoc":967,"header":"def get_bounding_box(self, with_bbox=True)","id":3726,"name":"get_bounding_box","nodeType":"Function","startLoc":944,"text":"def get_bounding_box(self, with_bbox=True):\n        \"\"\"\n        Return the ``bounding_box`` of a model if it exists or ``None``\n        otherwise.\n\n        Parameters\n        ----------\n        with_bbox :\n            The value of the ``with_bounding_box`` keyword argument\n            when calling the model. Default is `True` for usage when\n            looking up the model's ``bounding_box`` without risk of error.\n        \"\"\"\n        bbox = None\n\n        if not isinstance(with_bbox, bool) or with_bbox:\n            try:\n                bbox = self.bounding_box\n            except NotImplementedError:\n                pass\n\n            if isinstance(bbox, CompoundBoundingBox) and not isinstance(with_bbox, bool):\n                bbox = bbox[with_bbox]\n\n        return bbox"},{"col":4,"comment":"null","endLoc":141,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3727,"name":"assert_equal","nodeType":"Function","startLoc":132,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, powerlaws.ExponentialCutoffPowerLaw1D) and\n                isinstance(b, powerlaws.ExponentialCutoffPowerLaw1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.alpha, b.alpha)\n        assert_array_equal(a.x_cutoff, b.x_cutoff)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1725,"id":3728,"name":"_format","nodeType":"Attribute","startLoc":1725,"text":"self._format"},{"attributeType":"null","col":8,"comment":"null","endLoc":1733,"id":3729,"name":"__doc__","nodeType":"Attribute","startLoc":1733,"text":"self.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":113,"id":3730,"name":"name","nodeType":"Attribute","startLoc":113,"text":"name"},{"col":0,"comment":"null","endLoc":263,"header":"def make_projection_types()","id":3731,"name":"make_projection_types","nodeType":"Function","startLoc":246,"text":"def make_projection_types():\n    for tag_name, (name, params, version) in _generic_projections.items():\n        class_name = f'{name}Type'\n        types = [f'astropy.modeling.projections.Pix2Sky_{name}',\n                 f'astropy.modeling.projections.Sky2Pix_{name}']\n\n        members = {'name': f'transform/{tag_name}',\n                   'types': types,\n                   'params': params}\n        if version:\n            members['version'] = version\n\n        globals()[class_name] = type(\n            str(class_name),\n            (GenericProjectionType,),\n            members)\n\n        __all__.append(class_name)"},{"attributeType":"null","col":4,"comment":"null","endLoc":114,"id":3732,"name":"version","nodeType":"Attribute","startLoc":114,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":115,"id":3733,"name":"types","nodeType":"Attribute","startLoc":115,"text":"types"},{"attributeType":"null","col":12,"comment":"null","endLoc":1720,"id":3734,"name":"_short_names","nodeType":"Attribute","startLoc":1720,"text":"self._short_names"},{"className":"LogParabola1DType","col":0,"comment":"null","endLoc":173,"id":3735,"nodeType":"Class","startLoc":144,"text":"class LogParabola1DType(TransformType):\n    name = 'transform/log_parabola1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.powerlaws.LogParabola1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return powerlaws.LogParabola1D(amplitude=node['amplitude'],\n                                       x_0=node['x_0'],\n                                       alpha=node['alpha'],\n                                       beta=node['beta'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'alpha': _parameter_to_value(model.alpha),\n                'beta': _parameter_to_value(model.beta)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, powerlaws.LogParabola1D) and\n                isinstance(b, powerlaws.LogParabola1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.alpha, b.alpha)\n        assert_array_equal(a.beta, b.beta)"},{"col":4,"comment":"null","endLoc":154,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3736,"name":"from_tree_transform","nodeType":"Function","startLoc":149,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return powerlaws.LogParabola1D(amplitude=node['amplitude'],\n                                       x_0=node['x_0'],\n                                       alpha=node['alpha'],\n                                       beta=node['beta'])"},{"col":4,"comment":"\n        Model specific post evaluation processing of outputs\n        ","endLoc":1059,"header":"def _post_evaluate(self, inputs, outputs, broadcasted_shapes, with_bbox, **kwargs)","id":3737,"name":"_post_evaluate","nodeType":"Function","startLoc":1047,"text":"def _post_evaluate(self, inputs, outputs, broadcasted_shapes, with_bbox, **kwargs):\n        \"\"\"\n        Model specific post evaluation processing of outputs\n        \"\"\"\n        if self.get_bounding_box(with_bbox) is None and self.n_outputs == 1:\n            outputs = (outputs,)\n\n        outputs = self.prepare_outputs(broadcasted_shapes, *outputs, **kwargs)\n        outputs = self._process_output_units(inputs, outputs)\n\n        if self.n_outputs == 1:\n            return outputs[0]\n        return outputs"},{"col":4,"comment":"null","endLoc":2156,"header":"def __init__(self, st, represents=None, doc=None,\n                 format=None, namespace=None)","id":3738,"name":"__init__","nodeType":"Function","startLoc":2149,"text":"def __init__(self, st, represents=None, doc=None,\n                 format=None, namespace=None):\n\n        represents = Unit(represents)\n        self._represents = represents\n\n        NamedUnit.__init__(self, st, namespace=namespace, doc=doc,\n                           format=format)"},{"col":4,"comment":"null","endLoc":2186,"header":"def prepare_outputs(self, broadcasted_shapes, *outputs, **kwargs)","id":3739,"name":"prepare_outputs","nodeType":"Function","startLoc":2180,"text":"def prepare_outputs(self, broadcasted_shapes, *outputs, **kwargs):\n        model_set_axis = kwargs.get('model_set_axis', None)\n\n        if len(self) == 1:\n            return self._prepare_outputs_single_model(outputs, broadcasted_shapes)\n        else:\n            return self._prepare_outputs_model_set(outputs, broadcasted_shapes, model_set_axis)"},{"col":4,"comment":"null","endLoc":162,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3740,"name":"to_tree_transform","nodeType":"Function","startLoc":156,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'alpha': _parameter_to_value(model.alpha),\n                'beta': _parameter_to_value(model.beta)}\n        return node"},{"col":4,"comment":"null","endLoc":2164,"header":"def _prepare_outputs_single_model(self, outputs, broadcasted_shapes)","id":3741,"name":"_prepare_outputs_single_model","nodeType":"Function","startLoc":2154,"text":"def _prepare_outputs_single_model(self, outputs, broadcasted_shapes):\n        outputs = list(outputs)\n        for idx, output in enumerate(outputs):\n            try:\n                broadcast_shape = check_broadcast(*broadcasted_shapes[0])\n            except (IndexError, TypeError):\n                broadcast_shape = broadcasted_shapes[0][idx]\n\n            outputs[idx] = self._prepare_output_single_model(output, broadcast_shape)\n\n        return tuple(outputs)"},{"col":4,"comment":"The unit that this named unit represents.","endLoc":2161,"header":"@property\n    def represents(self)","id":3742,"name":"represents","nodeType":"Function","startLoc":2158,"text":"@property\n    def represents(self):\n        \"\"\"The unit that this named unit represents.\"\"\"\n        return self._represents"},{"col":4,"comment":"null","endLoc":2164,"header":"def decompose(self, bases=set())","id":3743,"name":"decompose","nodeType":"Function","startLoc":2163,"text":"def decompose(self, bases=set()):\n        return self._represents.decompose(bases=bases)"},{"col":4,"comment":"null","endLoc":173,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3744,"name":"assert_equal","nodeType":"Function","startLoc":164,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, powerlaws.LogParabola1D) and\n                isinstance(b, powerlaws.LogParabola1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.alpha, b.alpha)\n        assert_array_equal(a.beta, b.beta)"},{"col":4,"comment":"null","endLoc":2152,"header":"@staticmethod\n    def _prepare_output_single_model(output, broadcast_shape)","id":3745,"name":"_prepare_output_single_model","nodeType":"Function","startLoc":2138,"text":"@staticmethod\n    def _prepare_output_single_model(output, broadcast_shape):\n        if broadcast_shape is not None:\n            if not broadcast_shape:\n                return output.item()\n            else:\n                try:\n                    return output.reshape(broadcast_shape)\n                except ValueError:\n                    try:\n                        return output.item()\n                    except ValueError:\n                        return output\n\n        return output"},{"attributeType":"null","col":4,"comment":"null","endLoc":145,"id":3746,"name":"name","nodeType":"Attribute","startLoc":145,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":146,"id":3747,"name":"version","nodeType":"Attribute","startLoc":146,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":147,"id":3748,"name":"types","nodeType":"Attribute","startLoc":147,"text":"types"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":3749,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"powerlaws.py#<anonymous>","id":3750,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['PowerLaw1DType', 'BrokenPowerLaw1DType',\n           'SmoothlyBrokenPowerLaw1DType', 'ExponentialCutoffPowerLaw1DType',\n           'LogParabola1DType']"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":3751,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":216,"id":3752,"name":"_generic_projections","nodeType":"Attribute","startLoc":216,"text":"_generic_projections"},{"col":0,"comment":"","endLoc":4,"header":"projections.py#<anonymous>","id":3753,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['AffineType', 'Rotate2DType', 'Rotate3DType',\n           'RotationSequenceType']\n\n_generic_projections = {\n    'zenithal_perspective': ('ZenithalPerspective', (('mu', 0.0), ('gamma', 0.0)), '1.3.0'),\n    'gnomonic': ('Gnomonic', (), None),\n    'stereographic': ('Stereographic', (), None),\n    'slant_orthographic': ('SlantOrthographic', (('xi', 0.0), ('eta', 0.0)), None),\n    'zenithal_equidistant': ('ZenithalEquidistant', (), None),\n    'zenithal_equal_area': ('ZenithalEqualArea', (), None),\n    'airy': ('Airy', (('theta_b', 90.0),), '1.2.0'),\n    'cylindrical_perspective': ('CylindricalPerspective', (('mu', 0.0), ('lam', 0.0)), '1.3.0'),\n    'cylindrical_equal_area': ('CylindricalEqualArea', (('lam', 0.0),), '1.3.0'),\n    'plate_carree': ('PlateCarree', (), None),\n    'mercator': ('Mercator', (), None),\n    'sanson_flamsteed': ('SansonFlamsteed', (), None),\n    'parabolic': ('Parabolic', (), None),\n    'molleweide': ('Molleweide', (), None),\n    'hammer_aitoff': ('HammerAitoff', (), None),\n    'conic_perspective': ('ConicPerspective', (('sigma', 0.0), ('delta', 0.0)), '1.3.0'),\n    'conic_equal_area': ('ConicEqualArea', (('sigma', 0.0), ('delta', 0.0)), '1.3.0'),\n    'conic_equidistant': ('ConicEquidistant', (('sigma', 0.0), ('delta', 0.0)), '1.3.0'),\n    'conic_orthomorphic': ('ConicOrthomorphic', (('sigma', 0.0), ('delta', 0.0)), '1.3.0'),\n    'bonne_equal_area': ('BonneEqualArea', (('theta1', 0.0),), '1.3.0'),\n    'polyconic': ('Polyconic', (), None),\n    'tangential_spherical_cube': ('TangentialSphericalCube', (), None),\n    'cobe_quad_spherical_cube': ('COBEQuadSphericalCube', (), None),\n    'quad_spherical_cube': ('QuadSphericalCube', (), None),\n    'healpix': ('HEALPix', (('H', 4.0), ('X', 3.0)), None),\n    'healpix_polar': ('HEALPixPolar', (), None)\n}\n\nmake_projection_types()"},{"col":4,"comment":"null","endLoc":2167,"header":"def is_unity(self)","id":3754,"name":"is_unity","nodeType":"Function","startLoc":2166,"text":"def is_unity(self):\n        return self._represents.is_unity()"},{"col":4,"comment":"null","endLoc":2172,"header":"def __hash__(self)","id":3755,"name":"__hash__","nodeType":"Function","startLoc":2169,"text":"def __hash__(self):\n        if self._hash is None:\n            self._hash = hash((self.name, self._represents))\n        return self._hash"},{"attributeType":"null","col":8,"comment":"null","endLoc":2153,"id":3756,"name":"_represents","nodeType":"Attribute","startLoc":2153,"text":"self._represents"},{"attributeType":"null","col":12,"comment":"null","endLoc":2171,"id":3757,"name":"_hash","nodeType":"Attribute","startLoc":2171,"text":"self._hash"},{"fileName":"tabular.py","filePath":"astropy/io/misc/asdf/tags/transform","id":3758,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nimport numpy as np\nfrom numpy.testing import assert_array_equal\n\nfrom astropy import modeling\nfrom astropy import units as u\nfrom .basic import TransformType\nfrom astropy.modeling.bounding_box import ModelBoundingBox\n\n__all__ = ['TabularType']\n\n\nclass TabularType(TransformType):\n    name = \"transform/tabular\"\n    version = '1.2.0'\n    types = [\n        modeling.models.Tabular2D, modeling.models.Tabular1D\n    ]\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        lookup_table = node.pop(\"lookup_table\")\n        dim = lookup_table.ndim\n        fill_value = node.pop(\"fill_value\", None)\n        if dim == 1:\n            # The copy is necessary because the array is memory mapped.\n            points = (node['points'][0][:],)\n            model = modeling.models.Tabular1D(points=points, lookup_table=lookup_table,\n                                              method=node['method'], bounds_error=node['bounds_error'],\n                                              fill_value=fill_value)\n        elif dim == 2:\n            points = tuple([p[:] for p in node['points']])\n            model = modeling.models.Tabular2D(points=points, lookup_table=lookup_table,\n                                              method=node['method'], bounds_error=node['bounds_error'],\n                                              fill_value=fill_value)\n\n        else:\n            tabular_class = modeling.models.tabular_model(dim, name)\n            points = tuple([p[:] for p in node['points']])\n            model = tabular_class(points=points, lookup_table=lookup_table,\n                                  method=node['method'], bounds_error=node['bounds_error'],\n                                  fill_value=fill_value)\n\n        return model\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {}\n        if model.fill_value is not None:\n            node[\"fill_value\"] = model.fill_value\n        node[\"lookup_table\"] = model.lookup_table\n        node[\"points\"] = [p for p in model.points]\n        node[\"method\"] = str(model.method)\n        node[\"bounds_error\"] = model.bounds_error\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        if isinstance(a.lookup_table, u.Quantity):\n            assert u.allclose(a.lookup_table, b.lookup_table)\n            assert u.allclose(a.points, b.points)\n            a_box = a.bounding_box\n            if isinstance(a_box, ModelBoundingBox):\n                a_box = a_box.bounding_box()\n            b_box = b.bounding_box\n            if isinstance(b_box, ModelBoundingBox):\n                b_box = b_box.bounding_box()\n            for i in range(len(a_box)):\n                assert u.allclose(a_box[i], b_box[i])\n        else:\n            assert_array_equal(a.lookup_table, b.lookup_table)\n            assert_array_equal(a.points, b.points)\n            a_box = a.bounding_box\n            if isinstance(a_box, ModelBoundingBox):\n                a_box = a_box.bounding_box()\n            b_box = b.bounding_box\n            if isinstance(b_box, ModelBoundingBox):\n                b_box = b_box.bounding_box()\n            assert_array_equal(a_box, b_box)\n        assert (a.method == b.method)\n        if a.fill_value is None:\n            assert b.fill_value is None\n        elif np.isnan(a.fill_value):\n            assert np.isnan(b.fill_value)\n        else:\n            assert(a.fill_value == b.fill_value)\n        assert(a.bounds_error == b.bounds_error)\n"},{"col":4,"comment":"null","endLoc":2178,"header":"def _prepare_outputs_model_set(self, outputs, broadcasted_shapes, model_set_axis)","id":3759,"name":"_prepare_outputs_model_set","nodeType":"Function","startLoc":2166,"text":"def _prepare_outputs_model_set(self, outputs, broadcasted_shapes, model_set_axis):\n        pivots = broadcasted_shapes[0]\n        # If model_set_axis = False was passed then use\n        # self._model_set_axis to format the output.\n        if model_set_axis is None or model_set_axis is False:\n            model_set_axis = self.model_set_axis\n        outputs = list(outputs)\n        for idx, output in enumerate(outputs):\n            pivot = pivots[idx]\n            if pivot < output.ndim and pivot != model_set_axis:\n                outputs[idx] = np.rollaxis(output, pivot,\n                                           model_set_axis)\n        return tuple(outputs)"},{"className":"UnitType","col":0,"comment":"null","endLoc":23,"id":3760,"nodeType":"Class","startLoc":8,"text":"class UnitType(AstropyAsdfType):\n    name = 'unit/unit'\n    types = ['astropy.units.UnitBase']\n    requires = ['astropy']\n\n    @classmethod\n    def to_tree(cls, node, ctx):\n        if isinstance(node, str):\n            node = Unit(node, format='vounit', parse_strict='warn')\n        if isinstance(node, UnitBase):\n            return node.to_string(format='vounit')\n        raise TypeError(f\"'{node}' is not a valid unit\")\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        return Unit(node, format='vounit', parse_strict='silent')"},{"fileName":"polynomial.py","filePath":"astropy/io/misc/asdf/tags/transform","id":3761,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nimport numpy as np\nfrom numpy.testing import assert_array_equal\n\nfrom asdf.versioning import AsdfVersion\n\nimport astropy.units as u\nfrom astropy import modeling\nfrom .basic import TransformType\nfrom . import _parameter_to_value\n\n__all__ = ['ShiftType', 'ScaleType', 'Linear1DType']\n\n\nclass ShiftType(TransformType):\n    name = \"transform/shift\"\n    version = '1.2.0'\n    types = ['astropy.modeling.models.Shift']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        offset = node['offset']\n        if not isinstance(offset, u.Quantity) and not np.isscalar(offset):\n            raise NotImplementedError(\n                \"Asdf currently only supports scalar inputs to Shift transform.\")\n\n        return modeling.models.Shift(offset)\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        offset = model.offset\n        return {'offset': _parameter_to_value(offset)}\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, modeling.models.Shift) and\n                isinstance(b, modeling.models.Shift))\n        assert_array_equal(a.offset.value, b.offset.value)\n\n\nclass ScaleType(TransformType):\n    name = \"transform/scale\"\n    version = '1.2.0'\n    types = ['astropy.modeling.models.Scale']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        factor = node['factor']\n        if not isinstance(factor, u.Quantity) and not np.isscalar(factor):\n            raise NotImplementedError(\n                \"Asdf currently only supports scalar inputs to Scale transform.\")\n\n        return modeling.models.Scale(factor)\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        factor = model.factor\n        return {'factor': _parameter_to_value(factor)}\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, modeling.models.Scale) and\n                isinstance(b, modeling.models.Scale))\n        assert_array_equal(a.factor, b.factor)\n\n\nclass MultiplyType(TransformType):\n    name = \"transform/multiplyscale\"\n    version = '1.0.0'\n    types = ['astropy.modeling.models.Multiply']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        factor = node['factor']\n        return modeling.models.Multiply(factor)\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        factor = model.factor\n        return {'factor': _parameter_to_value(factor)}\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, modeling.models.Multiply) and\n                isinstance(b, modeling.models.Multiply))\n        assert_array_equal(a.factor, b.factor)\n\n\nclass PolynomialTypeBase(TransformType):\n    DOMAIN_WINDOW_MIN_VERSION = AsdfVersion(\"1.2.0\")\n\n    name = \"transform/polynomial\"\n    types = ['astropy.modeling.models.Polynomial1D',\n             'astropy.modeling.models.Polynomial2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        coefficients = np.asarray(node['coefficients'])\n        n_dim = coefficients.ndim\n\n        if n_dim == 1:\n            domain = node.get('domain', None)\n            window = node.get('window', None)\n\n            model = modeling.models.Polynomial1D(coefficients.size - 1,\n                                                 domain=domain, window=window)\n            model.parameters = coefficients\n        elif n_dim == 2:\n            x_domain, y_domain = tuple(node.get('domain', (None, None)))\n            x_window, y_window = tuple(node.get('window', (None, None)))\n            shape = coefficients.shape\n            degree = shape[0] - 1\n            if shape[0] != shape[1]:\n                raise TypeError(\"Coefficients must be an (n+1, n+1) matrix\")\n\n            coeffs = {}\n            for i in range(shape[0]):\n                for j in range(shape[0]):\n                    if i + j < degree + 1:\n                        name = 'c' + str(i) + '_' + str(j)\n                        coeffs[name] = coefficients[i, j]\n            model = modeling.models.Polynomial2D(degree,\n                                                 x_domain=x_domain,\n                                                 y_domain=y_domain,\n                                                 x_window=x_window,\n                                                 y_window=y_window,\n                                                 **coeffs)\n        else:\n            raise NotImplementedError(\n                \"Asdf currently only supports 1D or 2D polynomial transform.\")\n        return model\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        if isinstance(model, modeling.models.Polynomial1D):\n            coefficients = np.array(model.parameters)\n        elif isinstance(model, modeling.models.Polynomial2D):\n            degree = model.degree\n            coefficients = np.zeros((degree + 1, degree + 1))\n            for i in range(degree + 1):\n                for j in range(degree + 1):\n                    if i + j < degree + 1:\n                        name = 'c' + str(i) + '_' + str(j)\n                        coefficients[i, j] = getattr(model, name).value\n        node = {'coefficients': coefficients}\n        typeindex = cls.types.index(model.__class__)\n        ndim = (typeindex % 2) + 1\n\n        if cls.version >= PolynomialTypeBase.DOMAIN_WINDOW_MIN_VERSION:\n            # Schema versions prior to 1.2 included an unrelated \"domain\"\n            # property.  We can't serialize the new domain values with those\n            # versions because they don't validate.\n            if ndim == 1:\n                if model.domain is not None:\n                    node['domain'] = model.domain\n                if model.window is not None:\n                    node['window'] = model.window\n            else:\n                if model.x_domain or model.y_domain is not None:\n                    node['domain'] = (model.x_domain, model.y_domain)\n                if model.x_window or model.y_window is not None:\n                    node['window'] = (model.x_window, model.y_window)\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, (modeling.models.Polynomial1D, modeling.models.Polynomial2D)) and\n                isinstance(b, (modeling.models.Polynomial1D, modeling.models.Polynomial2D)))\n        assert_array_equal(a.parameters, b.parameters)\n\n        if cls.version > PolynomialTypeBase.DOMAIN_WINDOW_MIN_VERSION:\n            # Schema versions prior to 1.2 are known not to serialize\n            # domain or window.\n            if isinstance(a, modeling.models.Polynomial1D):\n                assert a.domain == b.domain\n                assert a.window == b.window\n            else:\n                assert a.x_domain == b.x_domain\n                assert a.x_window == b.x_window\n                assert a.y_domain == b.y_domain\n                assert a.y_window == b.y_window\n\n\nclass PolynomialType1_0(PolynomialTypeBase):\n    version = \"1.0.0\"\n\n\nclass PolynomialType1_1(PolynomialTypeBase):\n    version = \"1.1.0\"\n\n\nclass PolynomialType1_2(PolynomialTypeBase):\n    version = \"1.2.0\"\n\n\nclass OrthoPolynomialType(TransformType):\n    name = \"transform/ortho_polynomial\"\n    types = ['astropy.modeling.models.Legendre1D',\n             'astropy.modeling.models.Legendre2D',\n             'astropy.modeling.models.Chebyshev1D',\n             'astropy.modeling.models.Chebyshev2D',\n             'astropy.modeling.models.Hermite1D',\n             'astropy.modeling.models.Hermite2D']\n    typemap = {\n        'legendre': 0,\n        'chebyshev': 2,\n        'hermite': 4,\n    }\n\n    invtypemap = dict([[v, k] for k, v in typemap.items()])\n\n    version = \"1.0.0\"\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        coefficients = np.asarray(node['coefficients'])\n        n_dim = coefficients.ndim\n        poly_type = node['polynomial_type']\n        if n_dim == 1:\n            domain = node.get('domain', None)\n            window = node.get('window', None)\n            model = cls.types[cls.typemap[poly_type]](coefficients.size - 1,\n                                                      domain=domain, window=window)\n            model.parameters = coefficients\n        elif n_dim == 2:\n            x_domain, y_domain = tuple(node.get('domain', (None, None)))\n            x_window, y_window = tuple(node.get('window', (None, None)))\n            coeffs = {}\n            shape = coefficients.shape\n            x_degree = shape[0] - 1\n            y_degree = shape[1] - 1\n            for i in range(x_degree + 1):\n                for j in range(y_degree + 1):\n                    name = f'c{i}_{j}'\n                    coeffs[name] = coefficients[i, j]\n            model = cls.types[cls.typemap[poly_type]+1](x_degree, y_degree,\n                                                        x_domain=x_domain,\n                                                        y_domain=y_domain,\n                                                        x_window=x_window,\n                                                        y_window=y_window,\n                                                        **coeffs)\n        else:\n            raise NotImplementedError(\n                \"Asdf currently only supports 1D or 2D polynomial transforms.\")\n        return model\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        typeindex = cls.types.index(model.__class__)\n        poly_type = cls.invtypemap[int(typeindex/2)*2]\n        ndim = (typeindex % 2) + 1\n        if ndim == 1:\n            coefficients = np.array(model.parameters)\n        else:\n            coefficients = np.zeros((model.x_degree + 1, model.y_degree + 1))\n            for i in range(model.x_degree + 1):\n                for j in range(model.y_degree + 1):\n                    name = f'c{i}_{j}'\n                    coefficients[i, j] = getattr(model, name).value\n        node = {'polynomial_type': poly_type, 'coefficients': coefficients}\n        if ndim == 1:\n            if model.domain is not None:\n                node['domain'] = model.domain\n            if model.window is not None:\n                node['window'] = model.window\n        else:\n            if model.x_domain or model.y_domain is not None:\n                node['domain'] = (model.x_domain, model.y_domain)\n            if model.x_window or model.y_window is not None:\n                node['window'] = (model.x_window, model.y_window)\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        # There should be a more elegant way of doing this\n        TransformType.assert_equal(a, b)\n        assert ((isinstance(a, (modeling.models.Legendre1D,   modeling.models.Legendre2D)) and\n                 isinstance(b, (modeling.models.Legendre1D,   modeling.models.Legendre2D))) or\n                (isinstance(a, (modeling.models.Chebyshev1D,  modeling.models.Chebyshev2D)) and\n                 isinstance(b, (modeling.models.Chebyshev1D,  modeling.models.Chebyshev2D))) or\n                (isinstance(a, (modeling.models.Hermite1D,    modeling.models.Hermite2D)) and\n                 isinstance(b, (modeling.models.Hermite1D,    modeling.models.Hermite2D))))\n        assert_array_equal(a.parameters, b.parameters)\n\n\nclass Linear1DType(TransformType):\n    name = \"transform/linear1d\"\n    version = '1.0.0'\n    types = ['astropy.modeling.models.Linear1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        slope = node.get('slope', None)\n        intercept = node.get('intercept', None)\n\n        return modeling.models.Linear1D(slope=slope, intercept=intercept)\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        return {\n            'slope': _parameter_to_value(model.slope),\n            'intercept': _parameter_to_value(model.intercept),\n        }\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, modeling.models.Linear1D) and\n                isinstance(b, modeling.models.Linear1D))\n        assert_array_equal(a.slope, b.slope)\n        assert_array_equal(a.intercept, b.intercept)\n"},{"col":4,"comment":"null","endLoc":19,"header":"@classmethod\n    def to_tree(cls, node, ctx)","id":3762,"name":"to_tree","nodeType":"Function","startLoc":13,"text":"@classmethod\n    def to_tree(cls, node, ctx):\n        if isinstance(node, str):\n            node = Unit(node, format='vounit', parse_strict='warn')\n        if isinstance(node, UnitBase):\n            return node.to_string(format='vounit')\n        raise TypeError(f\"'{node}' is not a valid unit\")"},{"col":4,"comment":"null","endLoc":2136,"header":"def _process_output_units(self, inputs, outputs)","id":3763,"name":"_process_output_units","nodeType":"Function","startLoc":2125,"text":"def _process_output_units(self, inputs, outputs):\n        inputs_are_quantity = any([isinstance(i, Quantity) for i in inputs])\n        if self.return_units and inputs_are_quantity:\n            # We allow a non-iterable unit only if there is one output\n            if self.n_outputs == 1 and not isiterable(self.return_units):\n                return_units = {self.outputs[0]: self.return_units}\n            else:\n                return_units = self.return_units\n\n            outputs = tuple([Quantity(out, return_units.get(out_name, None), subok=True)\n                             for out, out_name in zip(outputs, self.outputs)])\n        return outputs"},{"col":4,"comment":"null","endLoc":879,"header":"def __len__(self)","id":3764,"name":"__len__","nodeType":"Function","startLoc":878,"text":"def __len__(self):\n        return self._n_models"},{"col":4,"comment":"null","endLoc":883,"header":"@staticmethod\n    def _strip_ones(intup)","id":3765,"name":"_strip_ones","nodeType":"Function","startLoc":881,"text":"@staticmethod\n    def _strip_ones(intup):\n        return tuple(item for item in intup if item != 1)"},{"col":4,"comment":"null","endLoc":926,"header":"def __setattr__(self, attr, value)","id":3766,"name":"__setattr__","nodeType":"Function","startLoc":885,"text":"def __setattr__(self, attr, value):\n        if isinstance(self, CompoundModel):\n            param_names = self._param_names\n        param_names = self.param_names\n\n        if param_names is not None and attr in self.param_names:\n            param = self.__dict__[attr]\n            value = _tofloat(value)\n            if param._validator is not None:\n                param._validator(self, value)\n            # check consistency with previous shape and size\n            eshape = self._param_metrics[attr]['shape']\n            if eshape == ():\n                eshape = (1,)\n            vshape = np.array(value).shape\n            if vshape == ():\n                vshape = (1,)\n            esize = self._param_metrics[attr]['size']\n            if (np.size(value) != esize or\n                    self._strip_ones(vshape) != self._strip_ones(eshape)):\n                raise InputParameterError(\n                    \"Value for parameter {0} does not match shape or size\\n\"\n                    \"expected by model ({1}, {2}) vs ({3}, {4})\".format(\n                        attr, vshape, np.size(value), eshape, esize))\n            if param.unit is None:\n                if isinstance(value, Quantity):\n                    param._unit = value.unit\n                    param.value = value.value\n                else:\n                    param.value = value\n            else:\n                if not isinstance(value, Quantity):\n                    raise UnitsError(f\"The '{param.name}' parameter should be given as a\"\n                                     \" Quantity because it was originally \"\n                                     \"initialized as a Quantity\")\n                param._unit = value.unit\n                param.value = value.value\n        else:\n            if attr in ['fittable', 'linear']:\n                self.__dict__[attr] = value\n            else:\n                super().__setattr__(attr, value)"},{"col":0,"comment":"Convert a parameter to float or float array","endLoc":64,"header":"def _tofloat(value)","id":3767,"name":"_tofloat","nodeType":"Function","startLoc":39,"text":"def _tofloat(value):\n    \"\"\"Convert a parameter to float or float array\"\"\"\n\n    if isiterable(value):\n        try:\n            value = np.asanyarray(value, dtype=float)\n        except (TypeError, ValueError):\n            # catch arrays with strings or user errors like different\n            # types of parameters in a parameter set\n            raise InputParameterError(\n                f\"Parameter of {type(value)} could not be converted to float\")\n    elif isinstance(value, Quantity):\n        # Quantities are fine as is\n        pass\n    elif isinstance(value, np.ndarray):\n        # A scalar/dimensionless array\n        value = float(value.item())\n    elif isinstance(value, (numbers.Number, np.number)) and not isinstance(value, bool):\n        value = float(value)\n    elif isinstance(value, bool):\n        raise InputParameterError(\n            \"Expected parameter to be of numerical type, not boolean\")\n    else:\n        raise InputParameterError(\n            f\"Don't know how to convert parameter of {type(value)} to float\")\n    return value"},{"className":"ModelBoundingBox","col":0,"comment":"\n    A model's bounding box\n\n    Parameters\n    ----------\n    intervals : dict\n        A dictionary containing all the intervals for each model input\n            keys   -> input index\n            values -> interval for that index\n\n    model : `~astropy.modeling.Model`\n        The Model this bounding_box is for.\n\n    ignored : list\n        A list containing all the inputs (index) which will not be\n        checked for whether or not their elements are in/out of an interval.\n\n    order : optional, str\n        The ordering that is assumed for the tuple representation of this\n        bounding_box. Options: 'C': C/Python order, e.g. z, y, x.\n        (default), 'F': Fortran/mathematical notation order, e.g. x, y, z.\n    ","endLoc":898,"id":3768,"nodeType":"Class","startLoc":557,"text":"class ModelBoundingBox(_BoundingDomain):\n    \"\"\"\n    A model's bounding box\n\n    Parameters\n    ----------\n    intervals : dict\n        A dictionary containing all the intervals for each model input\n            keys   -> input index\n            values -> interval for that index\n\n    model : `~astropy.modeling.Model`\n        The Model this bounding_box is for.\n\n    ignored : list\n        A list containing all the inputs (index) which will not be\n        checked for whether or not their elements are in/out of an interval.\n\n    order : optional, str\n        The ordering that is assumed for the tuple representation of this\n        bounding_box. Options: 'C': C/Python order, e.g. z, y, x.\n        (default), 'F': Fortran/mathematical notation order, e.g. x, y, z.\n    \"\"\"\n\n    def __init__(self, intervals: Dict[int, _Interval], model,\n                 ignored: List[int] = None, order: str = 'C'):\n        super().__init__(model, ignored, order)\n\n        self._intervals = {}\n        if intervals != () and intervals != {}:\n            self._validate(intervals, order=order)\n\n    def copy(self, ignored=None):\n        intervals = {index: interval.copy()\n                     for index, interval in self._intervals.items()}\n\n        if ignored is None:\n            ignored = self._ignored.copy()\n\n        return ModelBoundingBox(intervals, self._model,\n                                ignored=ignored,\n                                order=self._order)\n\n    @property\n    def intervals(self) -> Dict[int, _Interval]:\n        \"\"\"Return bounding_box labeled using input positions\"\"\"\n        return self._intervals\n\n    @property\n    def named_intervals(self) -> Dict[str, _Interval]:\n        \"\"\"Return bounding_box labeled using input names\"\"\"\n        return {self._get_name(index): bbox for index, bbox in self._intervals.items()}\n\n    def __repr__(self):\n        parts = [\n            'ModelBoundingBox(',\n            '    intervals={'\n        ]\n\n        for name, interval in self.named_intervals.items():\n            parts.append(f\"        {name}: {interval}\")\n\n        parts.append('    }')\n        if len(self._ignored) > 0:\n            parts.append(f\"    ignored={self.ignored_inputs}\")\n\n        parts.append(f'    model={self._model.__class__.__name__}(inputs={self._model.inputs})')\n        parts.append(f\"    order='{self._order}'\")\n        parts.append(')')\n\n        return '\\n'.join(parts)\n\n    def __len__(self):\n        return len(self._intervals)\n\n    def __contains__(self, key):\n        try:\n            return self._get_index(key) in self._intervals or self._ignored\n        except (IndexError, ValueError):\n            return False\n\n    def has_interval(self, key):\n        return self._get_index(key) in self._intervals\n\n    def __getitem__(self, key):\n        \"\"\"Get bounding_box entries by either input name or input index\"\"\"\n        index = self._get_index(key)\n        if index in self._ignored:\n            return _ignored_interval\n        else:\n            return self._intervals[self._get_index(key)]\n\n    def bounding_box(self, order: str = None):\n        \"\"\"\n        Return the old tuple of tuples representation of the bounding_box\n            order='C' corresponds to the old bounding_box ordering\n            order='F' corresponds to the gwcs bounding_box ordering.\n        \"\"\"\n        if len(self._intervals) == 1:\n            return tuple(list(self._intervals.values())[0])\n        else:\n            order = self._get_order(order)\n            inputs = self._model.inputs\n            if order == 'C':\n                inputs = inputs[::-1]\n\n            bbox = tuple([tuple(self[input_name]) for input_name in inputs])\n            if len(bbox) == 1:\n                bbox = bbox[0]\n\n            return bbox\n\n    def __eq__(self, value):\n        \"\"\"Note equality can be either with old representation or new one.\"\"\"\n        if isinstance(value, tuple):\n            return self.bounding_box() == value\n        elif isinstance(value, ModelBoundingBox):\n            return (self.intervals == value.intervals) and (self.ignored == value.ignored)\n        else:\n            return False\n\n    def __setitem__(self, key, value):\n        \"\"\"Validate and store interval under key (input index or input name).\"\"\"\n        index = self._get_index(key)\n        if index in self._ignored:\n            self._ignored.remove(index)\n\n        self._intervals[index] = _Interval.validate(value)\n\n    def __delitem__(self, key):\n        \"\"\"Delete stored interval\"\"\"\n        index = self._get_index(key)\n        if index in self._ignored:\n            raise RuntimeError(f\"Cannot delete ignored input: {key}!\")\n        del self._intervals[index]\n        self._ignored.append(index)\n\n    def _validate_dict(self, bounding_box: dict):\n        \"\"\"Validate passing dictionary of intervals and setting them.\"\"\"\n        for key, value in bounding_box.items():\n            self[key] = value\n\n    def _validate_sequence(self, bounding_box, order: str = None):\n        \"\"\"Validate passing tuple of tuples representation (or related) and setting them.\"\"\"\n        order = self._get_order(order)\n        if order == 'C':\n            # If bounding_box is C/python ordered, it needs to be reversed\n            # to be in Fortran/mathematical/input order.\n            bounding_box = bounding_box[::-1]\n\n        for index, value in enumerate(bounding_box):\n            self[index] = value\n\n    @property\n    def _n_inputs(self) -> int:\n        n_inputs = self._model.n_inputs - len(self._ignored)\n        if n_inputs > 0:\n            return n_inputs\n        else:\n            return 0\n\n    def _validate_iterable(self, bounding_box, order: str = None):\n        \"\"\"Validate and set any iterable representation\"\"\"\n        if len(bounding_box) != self._n_inputs:\n            raise ValueError(f\"Found {len(bounding_box)} intervals, \"\n                             f\"but must have exactly {self._n_inputs}.\")\n\n        if isinstance(bounding_box, dict):\n            self._validate_dict(bounding_box)\n        else:\n            self._validate_sequence(bounding_box, order)\n\n    def _validate(self, bounding_box, order: str = None):\n        \"\"\"Validate and set any representation\"\"\"\n        if self._n_inputs == 1 and not isinstance(bounding_box, dict):\n            self[0] = bounding_box\n        else:\n            self._validate_iterable(bounding_box, order)\n\n    @classmethod\n    def validate(cls, model, bounding_box,\n                 ignored: list = None, order: str = 'C', _preserve_ignore: bool = False, **kwargs):\n        \"\"\"\n        Construct a valid bounding box for a model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The model for which this will be a bounding_box\n        bounding_box : dict, tuple\n            A possible representation of the bounding box\n        order : optional, str\n            The order that a tuple representation will be assumed to be\n                Default: 'C'\n        \"\"\"\n        if isinstance(bounding_box, ModelBoundingBox):\n            order = bounding_box.order\n            if _preserve_ignore:\n                ignored = bounding_box.ignored\n            bounding_box = bounding_box.intervals\n\n        new = cls({}, model, ignored=ignored, order=order)\n        new._validate(bounding_box)\n\n        return new\n\n    def fix_inputs(self, model, fixed_inputs: dict, _keep_ignored=False):\n        \"\"\"\n        Fix the bounding_box for a `fix_inputs` compound model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The new model for which this will be a bounding_box\n        fixed_inputs : dict\n            Dictionary of inputs which have been fixed by this bounding box.\n        keep_ignored : bool\n            Keep the ignored inputs of the bounding box (internal argument only)\n        \"\"\"\n\n        new = self.copy()\n\n        for _input in fixed_inputs.keys():\n            del new[_input]\n\n        if _keep_ignored:\n            ignored = new.ignored\n        else:\n            ignored = None\n\n        return ModelBoundingBox.validate(model, new.named_intervals,\n                                    ignored=ignored, order=new._order)\n\n    @property\n    def dimension(self):\n        return len(self)\n\n    def domain(self, resolution, order: str = None):\n        inputs = self._model.inputs\n        order = self._get_order(order)\n        if order == 'C':\n            inputs = inputs[::-1]\n\n        return [self[input_name].domain(resolution) for input_name in inputs]\n\n    def _outside(self,  input_shape, inputs):\n        \"\"\"\n        Get all the input positions which are outside the bounding_box,\n        so that the corresponding outputs can be filled with the fill\n        value (default NaN).\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        outside_index : bool-numpy array\n            True  -> position outside bounding_box\n            False -> position inside  bounding_box\n        all_out : bool\n            if all of the inputs are outside the bounding_box\n        \"\"\"\n        all_out = False\n\n        outside_index = np.zeros(input_shape, dtype=bool)\n        for index, _input in enumerate(inputs):\n            _input = np.asanyarray(_input)\n\n            outside = np.broadcast_to(self[index].outside(_input), input_shape)\n            outside_index[outside] = True\n\n            if outside_index.all():\n                all_out = True\n                break\n\n        return outside_index, all_out\n\n    def _valid_index(self, input_shape, inputs):\n        \"\"\"\n        Get the indices of all the inputs inside the bounding_box.\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        valid_index : numpy array\n            array of all indices inside the bounding box\n        all_out : bool\n            if all of the inputs are outside the bounding_box\n        \"\"\"\n        outside_index, all_out = self._outside(input_shape, inputs)\n\n        valid_index = np.atleast_1d(np.logical_not(outside_index)).nonzero()\n        if len(valid_index[0]) == 0:\n            all_out = True\n\n        return valid_index, all_out\n\n    def prepare_inputs(self, input_shape, inputs) -> Tuple[Any, Any, Any]:\n        \"\"\"\n        Get prepare the inputs with respect to the bounding box.\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        valid_inputs : list\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : array_like\n            array of all indices inside the bounding box\n        all_out: bool\n            if all of the inputs are outside the bounding_box\n        \"\"\"\n        valid_index, all_out = self._valid_index(input_shape, inputs)\n\n        valid_inputs = []\n        if not all_out:\n            for _input in inputs:\n                if input_shape:\n                    valid_input = np.broadcast_to(np.atleast_1d(_input), input_shape)[valid_index]\n                    if np.isscalar(_input):\n                        valid_input = valid_input.item(0)\n                    valid_inputs.append(valid_input)\n                else:\n                    valid_inputs.append(_input)\n\n        return tuple(valid_inputs), valid_index, all_out"},{"className":"_BoundingDomain","col":0,"comment":"\n    Base class for ModelBoundingBox and CompoundBoundingBox.\n        This is where all the `~astropy.modeling.core.Model` evaluation\n        code for evaluating with a bounding box is because it is common\n        to both types of bounding box.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.Model`\n        The Model this bounding domain is for.\n\n    prepare_inputs :\n        Generates the necessary input information so that model can\n        be evaluated only for input points entirely inside bounding_box.\n        This needs to be implemented by a subclass. Note that most of\n        the implementation is in ModelBoundingBox.\n\n    prepare_outputs :\n        Fills the output values in for any input points outside the\n        bounding_box.\n\n    evaluate :\n        Performs a complete model evaluation while enforcing the bounds\n        on the inputs and returns a complete output.\n    ","endLoc":554,"id":3769,"nodeType":"Class","startLoc":164,"text":"class _BoundingDomain(abc.ABC):\n    \"\"\"\n    Base class for ModelBoundingBox and CompoundBoundingBox.\n        This is where all the `~astropy.modeling.core.Model` evaluation\n        code for evaluating with a bounding box is because it is common\n        to both types of bounding box.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.Model`\n        The Model this bounding domain is for.\n\n    prepare_inputs :\n        Generates the necessary input information so that model can\n        be evaluated only for input points entirely inside bounding_box.\n        This needs to be implemented by a subclass. Note that most of\n        the implementation is in ModelBoundingBox.\n\n    prepare_outputs :\n        Fills the output values in for any input points outside the\n        bounding_box.\n\n    evaluate :\n        Performs a complete model evaluation while enforcing the bounds\n        on the inputs and returns a complete output.\n    \"\"\"\n\n    def __init__(self, model, ignored: List[int] = None, order: str = 'C'):\n        self._model = model\n        self._ignored = self._validate_ignored(ignored)\n        self._order = self._get_order(order)\n\n    @property\n    def model(self):\n        return self._model\n\n    @property\n    def order(self) -> str:\n        return self._order\n\n    @property\n    def ignored(self) -> List[int]:\n        return self._ignored\n\n    def _get_order(self, order: str = None) -> str:\n        \"\"\"\n        Get if bounding_box is C/python ordered or Fortran/mathematically\n        ordered\n        \"\"\"\n        if order is None:\n            order = self._order\n\n        if order not in ('C', 'F'):\n            raise ValueError(\"order must be either 'C' (C/python order) or \"\n                             f\"'F' (Fortran/mathematical order), got: {order}.\")\n\n        return order\n\n    def _get_index(self, key) -> int:\n        \"\"\"\n        Get the input index corresponding to the given key.\n            Can pass in either:\n                the string name of the input or\n                the input index itself.\n        \"\"\"\n\n        return get_index(self._model, key)\n\n    def _get_name(self, index: int):\n        \"\"\"Get the input name corresponding to the input index\"\"\"\n        return get_name(self._model, index)\n\n    @property\n    def ignored_inputs(self) -> List[str]:\n        return [self._get_name(index) for index in self._ignored]\n\n    def _validate_ignored(self, ignored: list) -> List[int]:\n        if ignored is None:\n            return []\n        else:\n            return [self._get_index(key) for key in ignored]\n\n    def __call__(self, *args, **kwargs):\n        raise NotImplementedError(\n            \"This bounding box is fixed by the model and does not have \"\n            \"adjustable parameters.\")\n\n    @abc.abstractmethod\n    def fix_inputs(self, model, fixed_inputs: dict):\n        \"\"\"\n        Fix the bounding_box for a `fix_inputs` compound model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The new model for which this will be a bounding_box\n        fixed_inputs : dict\n            Dictionary of inputs which have been fixed by this bounding box.\n        \"\"\"\n\n        raise NotImplementedError(\"This should be implemented by a child class.\")\n\n    @abc.abstractmethod\n    def prepare_inputs(self, input_shape, inputs) -> Tuple[Any, Any, Any]:\n        \"\"\"\n        Get prepare the inputs with respect to the bounding box.\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        valid_inputs : list\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : array_like\n            array of all indices inside the bounding box\n        all_out: bool\n            if all of the inputs are outside the bounding_box\n        \"\"\"\n        raise NotImplementedError(\"This has not been implemented for BoundingDomain.\")\n\n    @staticmethod\n    def _base_output(input_shape, fill_value):\n        \"\"\"\n        Create a baseline output, assuming that the entire input is outside\n        the bounding box\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n\n        Returns\n        -------\n        An array of the correct shape containing all fill_value\n        \"\"\"\n        return np.zeros(input_shape) + fill_value\n\n    def _all_out_output(self, input_shape, fill_value):\n        \"\"\"\n        Create output if all inputs are outside the domain\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n\n        Returns\n        -------\n        A full set of outputs for case that all inputs are outside domain.\n        \"\"\"\n\n        return [self._base_output(input_shape, fill_value)\n                for _ in range(self._model.n_outputs)], None\n\n    def _modify_output(self, valid_output, valid_index, input_shape, fill_value):\n        \"\"\"\n        For a single output fill in all the parts corresponding to inputs\n        outside the bounding box.\n\n        Parameters\n        ----------\n        valid_output : numpy array\n            The output from the model corresponding to inputs inside the\n            bounding box\n        valid_index : numpy array\n            array of all indices of inputs inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n\n        Returns\n        -------\n        An output array with all the indices corresponding to inputs\n        outside the bounding box filled in by fill_value\n        \"\"\"\n        output = self._base_output(input_shape, fill_value)\n        if not output.shape:\n            output = np.array(valid_output)\n        else:\n            output[valid_index] = valid_output\n\n        if np.isscalar(valid_output):\n            output = output.item(0)\n\n        return output\n\n    def _prepare_outputs(self, valid_outputs, valid_index, input_shape, fill_value):\n        \"\"\"\n        Fill in all the outputs of the model corresponding to inputs\n        outside the bounding_box.\n\n        Parameters\n        ----------\n        valid_outputs : list of numpy array\n            The list of outputs from the model corresponding to inputs\n            inside the bounding box\n        valid_index : numpy array\n            array of all indices of inputs inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n\n        Returns\n        -------\n        List of filled in output arrays.\n        \"\"\"\n        outputs = []\n        for valid_output in valid_outputs:\n            outputs.append(self._modify_output(valid_output, valid_index, input_shape, fill_value))\n\n        return outputs\n\n    def prepare_outputs(self, valid_outputs, valid_index, input_shape, fill_value):\n        \"\"\"\n        Fill in all the outputs of the model corresponding to inputs\n        outside the bounding_box, adjusting any single output model so that\n        its output becomes a list of containing that output.\n\n        Parameters\n        ----------\n        valid_outputs : list\n            The list of outputs from the model corresponding to inputs\n            inside the bounding box\n        valid_index : array_like\n            array of all indices of inputs inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n        \"\"\"\n        if self._model.n_outputs == 1:\n            valid_outputs = [valid_outputs]\n\n        return self._prepare_outputs(valid_outputs, valid_index, input_shape, fill_value)\n\n    @staticmethod\n    def _get_valid_outputs_unit(valid_outputs, with_units: bool):\n        \"\"\"\n        Get the unit for outputs if one is required.\n\n        Parameters\n        ----------\n        valid_outputs : list of numpy array\n            The list of outputs from the model corresponding to inputs\n            inside the bounding box\n        with_units : bool\n            whether or not a unit is required\n        \"\"\"\n\n        if with_units:\n            return getattr(valid_outputs, 'unit', None)\n\n    def _evaluate_model(self, evaluate: Callable, valid_inputs, valid_index,\n                        input_shape, fill_value, with_units: bool):\n        \"\"\"\n        Evaluate the model using the given evaluate routine\n\n        Parameters\n        ----------\n        evaluate : Callable\n            callable which takes in the valid inputs to evaluate model\n        valid_inputs : list of numpy arrays\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : numpy array\n            array of all indices inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n        with_units : bool\n            whether or not a unit is required\n\n        Returns\n        -------\n        outputs :\n            list containing filled in output values\n        valid_outputs_unit :\n            the unit that will be attached to the outputs\n        \"\"\"\n        valid_outputs = evaluate(valid_inputs)\n        valid_outputs_unit = self._get_valid_outputs_unit(valid_outputs, with_units)\n\n        return self.prepare_outputs(valid_outputs, valid_index,\n                                    input_shape, fill_value), valid_outputs_unit\n\n    def _evaluate(self, evaluate: Callable, inputs, input_shape,\n                  fill_value, with_units: bool):\n        \"\"\"\n        Perform model evaluation steps:\n            prepare_inputs -> evaluate -> prepare_outputs\n\n        Parameters\n        ----------\n        evaluate : Callable\n            callable which takes in the valid inputs to evaluate model\n        valid_inputs : list of numpy arrays\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : numpy array\n            array of all indices inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n        with_units : bool\n            whether or not a unit is required\n\n        Returns\n        -------\n        outputs :\n            list containing filled in output values\n        valid_outputs_unit :\n            the unit that will be attached to the outputs\n        \"\"\"\n        valid_inputs, valid_index, all_out = self.prepare_inputs(input_shape, inputs)\n\n        if all_out:\n            return self._all_out_output(input_shape, fill_value)\n        else:\n            return self._evaluate_model(evaluate, valid_inputs, valid_index,\n                                        input_shape, fill_value, with_units)\n\n    @staticmethod\n    def _set_outputs_unit(outputs, valid_outputs_unit):\n        \"\"\"\n        Set the units on the outputs\n            prepare_inputs -> evaluate -> prepare_outputs -> set output units\n\n        Parameters\n        ----------\n        outputs :\n            list containing filled in output values\n        valid_outputs_unit :\n            the unit that will be attached to the outputs\n\n        Returns\n        -------\n        List containing filled in output values and units\n        \"\"\"\n\n        if valid_outputs_unit is not None:\n            return Quantity(outputs, valid_outputs_unit, copy=False)\n\n        return outputs\n\n    def evaluate(self, evaluate: Callable, inputs, fill_value):\n        \"\"\"\n        Perform full model evaluation steps:\n            prepare_inputs -> evaluate -> prepare_outputs -> set output units\n\n        Parameters\n        ----------\n        evaluate : callable\n            callable which takes in the valid inputs to evaluate model\n        valid_inputs : list\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : array_like\n            array of all indices inside the bounding box\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n        \"\"\"\n        input_shape = self._model.input_shape(inputs)\n\n        # NOTE: CompoundModel does not currently support units during\n        #   evaluation for bounding_box so this feature is turned off\n        #   for CompoundModel(s).\n        outputs, valid_outputs_unit = self._evaluate(evaluate, inputs, input_shape,\n                                                     fill_value, self._model.bbox_with_units)\n        return tuple(self._set_outputs_unit(outputs, valid_outputs_unit))"},{"col":4,"comment":"null","endLoc":198,"header":"@property\n    def model(self)","id":3770,"name":"model","nodeType":"Function","startLoc":196,"text":"@property\n    def model(self):\n        return self._model"},{"col":4,"comment":"null","endLoc":202,"header":"@property\n    def order(self) -> str","id":3771,"name":"order","nodeType":"Function","startLoc":200,"text":"@property\n    def order(self) -> str:\n        return self._order"},{"col":4,"comment":"null","endLoc":206,"header":"@property\n    def ignored(self) -> List[int]","id":3772,"name":"ignored","nodeType":"Function","startLoc":204,"text":"@property\n    def ignored(self) -> List[int]:\n        return self._ignored"},{"col":4,"comment":"Get the input name corresponding to the input index","endLoc":234,"header":"def _get_name(self, index: int)","id":3773,"name":"_get_name","nodeType":"Function","startLoc":232,"text":"def _get_name(self, index: int):\n        \"\"\"Get the input name corresponding to the input index\"\"\"\n        return get_name(self._model, index)"},{"col":4,"comment":"null","endLoc":238,"header":"@property\n    def ignored_inputs(self) -> List[str]","id":3774,"name":"ignored_inputs","nodeType":"Function","startLoc":236,"text":"@property\n    def ignored_inputs(self) -> List[str]:\n        return [self._get_name(index) for index in self._ignored]"},{"col":4,"comment":"null","endLoc":249,"header":"def __call__(self, *args, **kwargs)","id":3775,"name":"__call__","nodeType":"Function","startLoc":246,"text":"def __call__(self, *args, **kwargs):\n        raise NotImplementedError(\n            \"This bounding box is fixed by the model and does not have \"\n            \"adjustable parameters.\")"},{"col":4,"comment":"\n        Fix the bounding_box for a `fix_inputs` compound model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The new model for which this will be a bounding_box\n        fixed_inputs : dict\n            Dictionary of inputs which have been fixed by this bounding box.\n        ","endLoc":264,"header":"@abc.abstractmethod\n    def fix_inputs(self, model, fixed_inputs: dict)","id":3776,"name":"fix_inputs","nodeType":"Function","startLoc":251,"text":"@abc.abstractmethod\n    def fix_inputs(self, model, fixed_inputs: dict):\n        \"\"\"\n        Fix the bounding_box for a `fix_inputs` compound model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The new model for which this will be a bounding_box\n        fixed_inputs : dict\n            Dictionary of inputs which have been fixed by this bounding box.\n        \"\"\"\n\n        raise NotImplementedError(\"This should be implemented by a child class.\")"},{"col":4,"comment":"\n        Get prepare the inputs with respect to the bounding box.\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        valid_inputs : list\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : array_like\n            array of all indices inside the bounding box\n        all_out: bool\n            if all of the inputs are outside the bounding_box\n        ","endLoc":288,"header":"@abc.abstractmethod\n    def prepare_inputs(self, input_shape, inputs) -> Tuple[Any, Any, Any]","id":3777,"name":"prepare_inputs","nodeType":"Function","startLoc":266,"text":"@abc.abstractmethod\n    def prepare_inputs(self, input_shape, inputs) -> Tuple[Any, Any, Any]:\n        \"\"\"\n        Get prepare the inputs with respect to the bounding box.\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        valid_inputs : list\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : array_like\n            array of all indices inside the bounding box\n        all_out: bool\n            if all of the inputs are outside the bounding_box\n        \"\"\"\n        raise NotImplementedError(\"This has not been implemented for BoundingDomain.\")"},{"col":4,"comment":"\n        Create a baseline output, assuming that the entire input is outside\n        the bounding box\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n\n        Returns\n        -------\n        An array of the correct shape containing all fill_value\n        ","endLoc":308,"header":"@staticmethod\n    def _base_output(input_shape, fill_value)","id":3778,"name":"_base_output","nodeType":"Function","startLoc":290,"text":"@staticmethod\n    def _base_output(input_shape, fill_value):\n        \"\"\"\n        Create a baseline output, assuming that the entire input is outside\n        the bounding box\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n\n        Returns\n        -------\n        An array of the correct shape containing all fill_value\n        \"\"\"\n        return np.zeros(input_shape) + fill_value"},{"col":4,"comment":"\n        Create output if all inputs are outside the domain\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n\n        Returns\n        -------\n        A full set of outputs for case that all inputs are outside domain.\n        ","endLoc":328,"header":"def _all_out_output(self, input_shape, fill_value)","id":3779,"name":"_all_out_output","nodeType":"Function","startLoc":310,"text":"def _all_out_output(self, input_shape, fill_value):\n        \"\"\"\n        Create output if all inputs are outside the domain\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n\n        Returns\n        -------\n        A full set of outputs for case that all inputs are outside domain.\n        \"\"\"\n\n        return [self._base_output(input_shape, fill_value)\n                for _ in range(self._model.n_outputs)], None"},{"col":4,"comment":"null","endLoc":23,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":3780,"name":"from_tree","nodeType":"Function","startLoc":21,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        return Unit(node, format='vounit', parse_strict='silent')"},{"attributeType":"null","col":4,"comment":"null","endLoc":9,"id":3781,"name":"name","nodeType":"Attribute","startLoc":9,"text":"name"},{"col":4,"comment":"\n        For a single output fill in all the parts corresponding to inputs\n        outside the bounding box.\n\n        Parameters\n        ----------\n        valid_output : numpy array\n            The output from the model corresponding to inputs inside the\n            bounding box\n        valid_index : numpy array\n            array of all indices of inputs inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n\n        Returns\n        -------\n        An output array with all the indices corresponding to inputs\n        outside the bounding box filled in by fill_value\n        ","endLoc":362,"header":"def _modify_output(self, valid_output, valid_index, input_shape, fill_value)","id":3782,"name":"_modify_output","nodeType":"Function","startLoc":330,"text":"def _modify_output(self, valid_output, valid_index, input_shape, fill_value):\n        \"\"\"\n        For a single output fill in all the parts corresponding to inputs\n        outside the bounding box.\n\n        Parameters\n        ----------\n        valid_output : numpy array\n            The output from the model corresponding to inputs inside the\n            bounding box\n        valid_index : numpy array\n            array of all indices of inputs inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n\n        Returns\n        -------\n        An output array with all the indices corresponding to inputs\n        outside the bounding box filled in by fill_value\n        \"\"\"\n        output = self._base_output(input_shape, fill_value)\n        if not output.shape:\n            output = np.array(valid_output)\n        else:\n            output[valid_index] = valid_output\n\n        if np.isscalar(valid_output):\n            output = output.item(0)\n\n        return output"},{"attributeType":"null","col":4,"comment":"null","endLoc":10,"id":3783,"name":"types","nodeType":"Attribute","startLoc":10,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":11,"id":3784,"name":"requires","nodeType":"Attribute","startLoc":11,"text":"requires"},{"className":"ShiftType","col":0,"comment":"null","endLoc":42,"id":3785,"nodeType":"Class","startLoc":17,"text":"class ShiftType(TransformType):\n    name = \"transform/shift\"\n    version = '1.2.0'\n    types = ['astropy.modeling.models.Shift']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        offset = node['offset']\n        if not isinstance(offset, u.Quantity) and not np.isscalar(offset):\n            raise NotImplementedError(\n                \"Asdf currently only supports scalar inputs to Shift transform.\")\n\n        return modeling.models.Shift(offset)\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        offset = model.offset\n        return {'offset': _parameter_to_value(offset)}\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, modeling.models.Shift) and\n                isinstance(b, modeling.models.Shift))\n        assert_array_equal(a.offset.value, b.offset.value)"},{"fileName":"basic.py","filePath":"astropy/io/misc/asdf/tags/transform","id":3786,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\nimport numpy as np\n\nfrom asdf.versioning import AsdfVersion\n\nfrom astropy.modeling.bounding_box import ModelBoundingBox, CompoundBoundingBox\nfrom astropy.modeling import mappings\nfrom astropy.modeling import functional_models\nfrom astropy.modeling.core import CompoundModel\nfrom astropy.io.misc.asdf.types import AstropyAsdfType, AstropyType\nfrom . import _parameter_to_value\n\n\n__all__ = ['TransformType', 'IdentityType', 'ConstantType']\n\n\nclass TransformType(AstropyAsdfType):\n    version = '1.2.0'\n    requires = ['astropy']\n\n    @classmethod\n    def _from_tree_base_transform_members(cls, model, node, ctx):\n        if 'name' in node:\n            model.name = node['name']\n\n        if \"inputs\" in node:\n            model.inputs = tuple(node[\"inputs\"])\n\n        if \"outputs\" in node:\n            model.outputs = tuple(node[\"outputs\"])\n\n        if 'bounding_box' in node:\n            model.bounding_box = node['bounding_box']\n\n        elif 'selector_args' in node:\n            cbbox_keys = [tuple(key) for key in node['cbbox_keys']]\n            bbox_dict = dict(zip(cbbox_keys, node['cbbox_values']))\n\n            selector_args = node['selector_args']\n            model.bounding_box = CompoundBoundingBox.validate(model, bbox_dict, selector_args)\n\n        param_and_model_constraints = {}\n        for constraint in ['fixed', 'bounds']:\n            if constraint in node:\n                param_and_model_constraints[constraint] = node[constraint]\n        model._initialize_constraints(param_and_model_constraints)\n\n        if \"input_units_equivalencies\" in node:\n            # this still writes eqs. for compound, but operates on each sub model\n            if not isinstance(model, CompoundModel):\n                model.input_units_equivalencies = node['input_units_equivalencies']\n\n        yield model\n\n        if 'inverse' in node:\n            model.inverse = node['inverse']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        raise NotImplementedError(\n            \"Must be implemented in TransformType subclasses\")\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        model = cls.from_tree_transform(node, ctx)\n        return cls._from_tree_base_transform_members(model, node, ctx)\n\n    @classmethod\n    def _to_tree_base_transform_members(cls, model, node, ctx):\n        if getattr(model, '_user_inverse', None) is not None:\n            node['inverse'] = model._user_inverse\n\n        if model.name is not None:\n            node['name'] = model.name\n\n        node['inputs'] = list(model.inputs)\n        node['outputs'] = list(model.outputs)\n\n        try:\n            bb = model.bounding_box\n        except NotImplementedError:\n            bb = None\n\n        if isinstance(bb, ModelBoundingBox):\n            bb = bb.bounding_box(order='C')\n\n            if model.n_inputs == 1:\n                bb = list(bb)\n            else:\n                bb = [list(item) for item in bb]\n            node['bounding_box'] = bb\n\n        elif isinstance(bb, CompoundBoundingBox):\n            selector_args = [[sa.index, sa.ignore] for sa in bb.selector_args]\n            node['selector_args'] = selector_args\n            node['cbbox_keys'] = list(bb.bounding_boxes.keys())\n\n            bounding_boxes = list(bb.bounding_boxes.values())\n            if len(model.inputs) - len(selector_args) == 1:\n                node['cbbox_values'] = [list(sbbox.bounding_box()) for sbbox in bounding_boxes]\n            else:\n                node['cbbox_values'] = [[list(item) for item in sbbox.bounding_box()\n                                         if np.isfinite(item[0])] for sbbox in bounding_boxes]\n\n        # model / parameter constraints\n        if not isinstance(model, CompoundModel):\n            fixed_nondefaults = {k: f for k, f in model.fixed.items() if f}\n            if fixed_nondefaults:\n                node['fixed'] = fixed_nondefaults\n            bounds_nondefaults = {k: b for k, b in model.bounds.items() if any(b)}\n            if bounds_nondefaults:\n                node['bounds'] = bounds_nondefaults\n\n        if not isinstance(model, CompoundModel):\n            if model.input_units_equivalencies:\n                node['input_units_equivalencies'] = model.input_units_equivalencies\n\n        return node\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        raise NotImplementedError(\"Must be implemented in TransformType subclasses\")\n\n    @classmethod\n    def to_tree(cls, model, ctx):\n        node = cls.to_tree_transform(model, ctx)\n        return cls._to_tree_base_transform_members(model, node, ctx)\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        assert a.name == b.name\n        # TODO: Assert inverses are the same\n        # assert the bounding_boxes are the same\n        assert a.get_bounding_box() == b.get_bounding_box()\n        assert a.inputs == b.inputs\n        assert a.outputs == b.outputs\n        assert a.input_units_equivalencies == b.input_units_equivalencies\n\n\nclass IdentityType(TransformType):\n    name = \"transform/identity\"\n    types = ['astropy.modeling.mappings.Identity']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return mappings.Identity(node.get('n_dims', 1))\n\n    @classmethod\n    def to_tree_transform(cls, data, ctx):\n        node = {}\n        if data.n_inputs != 1:\n            node['n_dims'] = data.n_inputs\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, mappings.Identity) and\n                isinstance(b, mappings.Identity) and\n                a.n_inputs == b.n_inputs)\n\n\nclass ConstantType(TransformType):\n    name = \"transform/constant\"\n    version = '1.4.0'\n    supported_versions = ['1.0.0', '1.1.0', '1.2.0', '1.3.0', '1.4.0']\n    types = ['astropy.modeling.functional_models.Const1D',\n             'astropy.modeling.functional_models.Const2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        if cls.version < AsdfVersion('1.4.0'):\n            # The 'dimensions' property was added in 1.4.0,\n            # previously all values were 1D.\n            return functional_models.Const1D(node['value'])\n        elif node['dimensions'] == 1:\n            return functional_models.Const1D(node['value'])\n        elif node['dimensions'] == 2:\n            return functional_models.Const2D(node['value'])\n        else:\n            raise TypeError('Only 1D and 2D constant models are supported.')\n\n    @classmethod\n    def to_tree_transform(cls, data, ctx):\n        if cls.version < AsdfVersion('1.4.0'):\n            if not isinstance(data, functional_models.Const1D):\n                raise ValueError(\n                    f'constant-{cls.version} does not support models with > 1 dimension')\n            return {\n                'value': _parameter_to_value(data.amplitude)\n            }\n        else:\n            if isinstance(data, functional_models.Const1D):\n                dimension = 1\n            elif isinstance(data, functional_models.Const2D):\n                dimension = 2\n            return {\n                'value': _parameter_to_value(data.amplitude),\n                'dimensions': dimension\n            }\n\n\nclass GenericModel(mappings.Mapping):\n\n    def __init__(self, n_inputs, n_outputs):\n        mapping = tuple(range(n_inputs))\n        super().__init__(mapping)\n        self._n_outputs = n_outputs\n        self._outputs = tuple('x' + str(idx) for idx in range(n_outputs))\n\n    @property\n    def inverse(self):\n        raise NotImplementedError()\n\n\nclass GenericType(TransformType):\n    name = \"transform/generic\"\n    types = [GenericModel]\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return GenericModel(\n            node['n_inputs'], node['n_outputs'])\n\n    @classmethod\n    def to_tree_transform(cls, data, ctx):\n        return {\n            'n_inputs': data.n_inputs,\n            'n_outputs': data.n_outputs\n        }\n\n\nclass UnitsMappingType(AstropyType):\n    name = \"transform/units_mapping\"\n    version = \"1.0.0\"\n    types = [mappings.UnitsMapping]\n\n    @classmethod\n    def to_tree(cls, node, ctx):\n        tree = {}\n\n        if node.name is not None:\n            tree[\"name\"] = node.name\n\n        inputs = []\n        outputs = []\n        for i, o, m in zip(node.inputs, node.outputs, node.mapping):\n            input = {\n                \"name\": i,\n                \"allow_dimensionless\": node.input_units_allow_dimensionless[i],\n            }\n            if m[0] is not None:\n                input[\"unit\"] = m[0]\n            if node.input_units_equivalencies is not None and i in node.input_units_equivalencies:\n                input[\"equivalencies\"] = node.input_units_equivalencies[i]\n            inputs.append(input)\n\n            output = {\n                \"name\": o,\n            }\n            if m[-1] is not None:\n                output[\"unit\"] = m[-1]\n            outputs.append(output)\n\n        tree[\"unit_inputs\"] = inputs\n        tree[\"unit_outputs\"] = outputs\n\n        return tree\n\n    @classmethod\n    def from_tree(cls, tree, ctx):\n        mapping = tuple((i.get(\"unit\"), o.get(\"unit\"))\n                        for i, o in zip(tree[\"unit_inputs\"], tree[\"unit_outputs\"]))\n\n        equivalencies = None\n        for i in tree[\"unit_inputs\"]:\n            if \"equivalencies\" in i:\n                if equivalencies is None:\n                    equivalencies = {}\n                equivalencies[i[\"name\"]] = i[\"equivalencies\"]\n\n        kwargs = {\n            \"input_units_equivalencies\": equivalencies,\n            \"input_units_allow_dimensionless\": {\n                i[\"name\"]: i.get(\"allow_dimensionless\", False) for i in tree[\"unit_inputs\"]},\n        }\n\n        if \"name\" in tree:\n            kwargs[\"name\"] = tree[\"name\"]\n\n        return mappings.UnitsMapping(mapping, **kwargs)\n"},{"col":4,"comment":"\n        Create a spline parameter linked to an attribute array.\n\n        Parameters\n        ----------\n        name : str\n            Name for the parameter\n        index : int\n            The index of the parameter in the array\n        attr : str\n            The name for the attribute array\n        fixed : optional, bool\n            If the parameter should be fixed or not\n        ","endLoc":152,"header":"def _create_parameter(self, name: str, index: int, attr: str, fixed=False)","id":3787,"name":"_create_parameter","nodeType":"Function","startLoc":113,"text":"def _create_parameter(self, name: str, index: int, attr: str, fixed=False):\n        \"\"\"\n        Create a spline parameter linked to an attribute array.\n\n        Parameters\n        ----------\n        name : str\n            Name for the parameter\n        index : int\n            The index of the parameter in the array\n        attr : str\n            The name for the attribute array\n        fixed : optional, bool\n            If the parameter should be fixed or not\n        \"\"\"\n\n        # Hack to allow parameters and attribute array to freely exchange values\n        #   _getter forces reading value from attribute array\n        #   _setter forces setting value to attribute array\n\n        def _getter(value, model: \"_Spline\", index: int, attr: str):\n            return getattr(model, attr)[index]\n\n        def _setter(value, model: \"_Spline\", index: int, attr: str):\n            getattr(model, attr)[index] = value\n            return value\n\n        getter = functools.partial(_getter, index=index, attr=attr)\n        setter = functools.partial(_setter, index=index, attr=attr)\n\n        default = getattr(self, attr)\n        param = Parameter(name=name, default=default[index], fixed=fixed,\n                          getter=getter, setter=setter)\n        # setter/getter wrapper for parameters in this case require the\n        # parameter to have a reference back to its parent model\n        param.model = self\n        param.value = default[index]\n\n        # Add parameter to model\n        self.__dict__[name] = param"},{"className":"CompoundBoundingBox","col":0,"comment":"\n    A model's compound bounding box\n\n    Parameters\n    ----------\n    bounding_boxes : dict\n        A dictionary containing all the ModelBoundingBoxes that are possible\n            keys   -> _selector (extracted from model inputs)\n            values -> ModelBoundingBox\n\n    model : `~astropy.modeling.Model`\n        The Model this compound bounding_box is for.\n\n    selector_args : _SelectorArguments\n        A description of how to extract the selectors from model inputs.\n\n    create_selector : optional\n        A method which takes in the selector and the model to return a\n        valid bounding corresponding to that selector. This can be used\n        to construct new bounding_boxes for previously undefined selectors.\n        These new boxes are then stored for future lookups.\n\n    order : optional, str\n        The ordering that is assumed for the tuple representation of the\n        bounding_boxes.\n    ","endLoc":1543,"id":3788,"nodeType":"Class","startLoc":1267,"text":"class CompoundBoundingBox(_BoundingDomain):\n    \"\"\"\n    A model's compound bounding box\n\n    Parameters\n    ----------\n    bounding_boxes : dict\n        A dictionary containing all the ModelBoundingBoxes that are possible\n            keys   -> _selector (extracted from model inputs)\n            values -> ModelBoundingBox\n\n    model : `~astropy.modeling.Model`\n        The Model this compound bounding_box is for.\n\n    selector_args : _SelectorArguments\n        A description of how to extract the selectors from model inputs.\n\n    create_selector : optional\n        A method which takes in the selector and the model to return a\n        valid bounding corresponding to that selector. This can be used\n        to construct new bounding_boxes for previously undefined selectors.\n        These new boxes are then stored for future lookups.\n\n    order : optional, str\n        The ordering that is assumed for the tuple representation of the\n        bounding_boxes.\n    \"\"\"\n    def __init__(self, bounding_boxes: Dict[Any, ModelBoundingBox], model,\n                 selector_args: _SelectorArguments, create_selector: Callable = None,\n                 ignored: List[int] = None, order: str = 'C'):\n        super().__init__(model, ignored, order)\n\n        self._create_selector = create_selector\n        self._selector_args = _SelectorArguments.validate(model, selector_args)\n\n        self._bounding_boxes = {}\n        self._validate(bounding_boxes)\n\n    def copy(self):\n        bounding_boxes = {selector: bbox.copy(self.selector_args.ignore)\n                          for selector, bbox in self._bounding_boxes.items()}\n\n        return CompoundBoundingBox(bounding_boxes, self._model,\n                                   selector_args=self._selector_args,\n                                   create_selector=copy.deepcopy(self._create_selector),\n                                   order=self._order)\n\n    def __repr__(self):\n        parts = ['CompoundBoundingBox(',\n                 '    bounding_boxes={']\n        # bounding_boxes\n        for _selector, bbox in self._bounding_boxes.items():\n            bbox_repr = bbox.__repr__().split('\\n')\n            parts.append(f\"        {_selector} = {bbox_repr.pop(0)}\")\n            for part in bbox_repr:\n                parts.append(f\"            {part}\")\n        parts.append('    }')\n\n        # selector_args\n        selector_args_repr = self.selector_args.pretty_repr(self._model).split('\\n')\n        parts.append(f\"    selector_args = {selector_args_repr.pop(0)}\")\n        for part in selector_args_repr:\n            parts.append(f\"        {part}\")\n        parts.append(')')\n\n        return '\\n'.join(parts)\n\n    @property\n    def bounding_boxes(self) -> Dict[Any, ModelBoundingBox]:\n        return self._bounding_boxes\n\n    @property\n    def selector_args(self) -> _SelectorArguments:\n        return self._selector_args\n\n    @selector_args.setter\n    def selector_args(self, value):\n        self._selector_args = _SelectorArguments.validate(self._model, value)\n\n        warnings.warn(\"Overriding selector_args may cause problems you should re-validate \"\n                      \"the compound bounding box before use!\", RuntimeWarning)\n\n    @property\n    def named_selector_tuple(self) -> tuple:\n        return self._selector_args.named_tuple(self._model)\n\n    @property\n    def create_selector(self):\n        return self._create_selector\n\n    @staticmethod\n    def _get_selector_key(key):\n        if isiterable(key):\n            return tuple(key)\n        else:\n            return (key,)\n\n    def __setitem__(self, key, value):\n        _selector = self._get_selector_key(key)\n        if not self.selector_args.is_selector(_selector):\n            raise ValueError(f\"{_selector} is not a selector!\")\n\n        ignored = self.selector_args.ignore + self.ignored\n        self._bounding_boxes[_selector] = ModelBoundingBox.validate(self._model, value,\n                                                                    ignored,\n                                                                    order=self._order)\n\n    def _validate(self, bounding_boxes: dict):\n        for _selector, bounding_box in bounding_boxes.items():\n            self[_selector] = bounding_box\n\n    def __eq__(self, value):\n        if isinstance(value, CompoundBoundingBox):\n            return (self.bounding_boxes == value.bounding_boxes) and \\\n                (self.selector_args == value.selector_args) and \\\n                (self.create_selector == value.create_selector)\n        else:\n            return False\n\n    @classmethod\n    def validate(cls, model, bounding_box: dict, selector_args=None, create_selector=None,\n                 ignored: list = None, order: str = 'C', _preserve_ignore: bool = False, **kwarg):\n        \"\"\"\n        Construct a valid compound bounding box for a model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The model for which this will be a bounding_box\n        bounding_box : dict\n            Dictionary of possible bounding_box respresentations\n        selector_args : optional\n            Description of the selector arguments\n        create_selector : optional, callable\n            Method for generating new selectors\n        order : optional, str\n            The order that a tuple representation will be assumed to be\n                Default: 'C'\n        \"\"\"\n        if isinstance(bounding_box, CompoundBoundingBox):\n            if selector_args is None:\n                selector_args = bounding_box.selector_args\n            if create_selector is None:\n                create_selector = bounding_box.create_selector\n            order = bounding_box.order\n            if _preserve_ignore:\n                ignored = bounding_box.ignored\n            bounding_box = bounding_box.bounding_boxes\n\n        if selector_args is None:\n            raise ValueError(\"Selector arguments must be provided (can be passed as part of bounding_box argument)!\")\n\n        return cls(bounding_box, model, selector_args,\n                   create_selector=create_selector, ignored=ignored, order=order)\n\n    def __contains__(self, key):\n        return key in self._bounding_boxes\n\n    def _create_bounding_box(self, _selector):\n        self[_selector] = self._create_selector(_selector, model=self._model)\n\n        return self[_selector]\n\n    def __getitem__(self, key):\n        _selector = self._get_selector_key(key)\n        if _selector in self:\n            return self._bounding_boxes[_selector]\n        elif self._create_selector is not None:\n            return self._create_bounding_box(_selector)\n        else:\n            raise RuntimeError(f\"No bounding box is defined for selector: {_selector}.\")\n\n    def _select_bounding_box(self, inputs) -> ModelBoundingBox:\n        _selector = self.selector_args.get_selector(*inputs)\n\n        return self[_selector]\n\n    def prepare_inputs(self, input_shape, inputs) -> Tuple[Any, Any, Any]:\n        \"\"\"\n        Get prepare the inputs with respect to the bounding box.\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        valid_inputs : list\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : array_like\n            array of all indices inside the bounding box\n        all_out: bool\n            if all of the inputs are outside the bounding_box\n        \"\"\"\n        bounding_box = self._select_bounding_box(inputs)\n        return bounding_box.prepare_inputs(input_shape, inputs)\n\n    def _matching_bounding_boxes(self, argument, value) -> Dict[Any, ModelBoundingBox]:\n        selector_index = self.selector_args.selector_index(self._model, argument)\n        matching = {}\n        for selector_key, bbox in self._bounding_boxes.items():\n            if selector_key[selector_index] == value:\n                new_selector_key = list(selector_key)\n                new_selector_key.pop(selector_index)\n\n                if bbox.has_interval(argument):\n                    new_bbox = bbox.fix_inputs(self._model, {argument: value},\n                                               _keep_ignored=True)\n                else:\n                    new_bbox = bbox.copy()\n\n                matching[tuple(new_selector_key)] = new_bbox\n\n        if len(matching) == 0:\n            raise ValueError(f\"Attempting to fix input {argument}, but there are no \"\n                             f\"bounding boxes for argument value {value}.\")\n\n        return matching\n\n    def _fix_input_selector_arg(self, argument, value):\n        matching_bounding_boxes = self._matching_bounding_boxes(argument, value)\n\n        if len(self.selector_args) == 1:\n            return matching_bounding_boxes[()]\n        else:\n            return CompoundBoundingBox(matching_bounding_boxes, self._model,\n                                       self.selector_args.reduce(self._model, argument))\n\n    def _fix_input_bbox_arg(self, argument, value):\n        bounding_boxes = {}\n        for selector_key, bbox in self._bounding_boxes.items():\n            bounding_boxes[selector_key] = bbox.fix_inputs(self._model, {argument: value},\n                                                        _keep_ignored=True)\n\n        return CompoundBoundingBox(bounding_boxes, self._model,\n                                   self.selector_args.add_ignore(self._model, argument))\n\n    def fix_inputs(self, model, fixed_inputs: dict):\n        \"\"\"\n        Fix the bounding_box for a `fix_inputs` compound model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The new model for which this will be a bounding_box\n        fixed_inputs : dict\n            Dictionary of inputs which have been fixed by this bounding box.\n        \"\"\"\n\n        fixed_input_keys = list(fixed_inputs.keys())\n        argument = fixed_input_keys.pop()\n        value = fixed_inputs[argument]\n\n        if self.selector_args.is_argument(self._model, argument):\n            bbox = self._fix_input_selector_arg(argument, value)\n        else:\n            bbox = self._fix_input_bbox_arg(argument, value)\n\n        if len(fixed_input_keys) > 0:\n            new_fixed_inputs = fixed_inputs.copy()\n            del new_fixed_inputs[argument]\n\n            bbox = bbox.fix_inputs(model, new_fixed_inputs)\n\n        if isinstance(bbox, CompoundBoundingBox):\n            selector_args = bbox.named_selector_tuple\n            bbox_dict = bbox\n        elif isinstance(bbox, ModelBoundingBox):\n            selector_args = None\n            bbox_dict = bbox.named_intervals\n\n        return bbox.__class__.validate(model, bbox_dict,\n                                       order=bbox.order, selector_args=selector_args)"},{"col":4,"comment":"null","endLoc":1312,"header":"def copy(self)","id":3789,"name":"copy","nodeType":"Function","startLoc":1305,"text":"def copy(self):\n        bounding_boxes = {selector: bbox.copy(self.selector_args.ignore)\n                          for selector, bbox in self._bounding_boxes.items()}\n\n        return CompoundBoundingBox(bounding_boxes, self._model,\n                                   selector_args=self._selector_args,\n                                   create_selector=copy.deepcopy(self._create_selector),\n                                   order=self._order)"},{"col":4,"comment":"null","endLoc":29,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3790,"name":"from_tree_transform","nodeType":"Function","startLoc":22,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        offset = node['offset']\n        if not isinstance(offset, u.Quantity) and not np.isscalar(offset):\n            raise NotImplementedError(\n                \"Asdf currently only supports scalar inputs to Shift transform.\")\n\n        return modeling.models.Shift(offset)"},{"col":4,"comment":"\n        Fill in all the outputs of the model corresponding to inputs\n        outside the bounding_box.\n\n        Parameters\n        ----------\n        valid_outputs : list of numpy array\n            The list of outputs from the model corresponding to inputs\n            inside the bounding box\n        valid_index : numpy array\n            array of all indices of inputs inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n\n        Returns\n        -------\n        List of filled in output arrays.\n        ","endLoc":390,"header":"def _prepare_outputs(self, valid_outputs, valid_index, input_shape, fill_value)","id":3791,"name":"_prepare_outputs","nodeType":"Function","startLoc":364,"text":"def _prepare_outputs(self, valid_outputs, valid_index, input_shape, fill_value):\n        \"\"\"\n        Fill in all the outputs of the model corresponding to inputs\n        outside the bounding_box.\n\n        Parameters\n        ----------\n        valid_outputs : list of numpy array\n            The list of outputs from the model corresponding to inputs\n            inside the bounding box\n        valid_index : numpy array\n            array of all indices of inputs inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n\n        Returns\n        -------\n        List of filled in output arrays.\n        \"\"\"\n        outputs = []\n        for valid_output in valid_outputs:\n            outputs.append(self._modify_output(valid_output, valid_index, input_shape, fill_value))\n\n        return outputs"},{"col":4,"comment":"\n        Fill in all the outputs of the model corresponding to inputs\n        outside the bounding_box, adjusting any single output model so that\n        its output becomes a list of containing that output.\n\n        Parameters\n        ----------\n        valid_outputs : list\n            The list of outputs from the model corresponding to inputs\n            inside the bounding box\n        valid_index : array_like\n            array of all indices of inputs inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n        ","endLoc":414,"header":"def prepare_outputs(self, valid_outputs, valid_index, input_shape, fill_value)","id":3792,"name":"prepare_outputs","nodeType":"Function","startLoc":392,"text":"def prepare_outputs(self, valid_outputs, valid_index, input_shape, fill_value):\n        \"\"\"\n        Fill in all the outputs of the model corresponding to inputs\n        outside the bounding_box, adjusting any single output model so that\n        its output becomes a list of containing that output.\n\n        Parameters\n        ----------\n        valid_outputs : list\n            The list of outputs from the model corresponding to inputs\n            inside the bounding box\n        valid_index : array_like\n            array of all indices of inputs inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n        \"\"\"\n        if self._model.n_outputs == 1:\n            valid_outputs = [valid_outputs]\n\n        return self._prepare_outputs(valid_outputs, valid_index, input_shape, fill_value)"},{"col":4,"comment":"\n        Get the unit for outputs if one is required.\n\n        Parameters\n        ----------\n        valid_outputs : list of numpy array\n            The list of outputs from the model corresponding to inputs\n            inside the bounding box\n        with_units : bool\n            whether or not a unit is required\n        ","endLoc":431,"header":"@staticmethod\n    def _get_valid_outputs_unit(valid_outputs, with_units: bool)","id":3793,"name":"_get_valid_outputs_unit","nodeType":"Function","startLoc":416,"text":"@staticmethod\n    def _get_valid_outputs_unit(valid_outputs, with_units: bool):\n        \"\"\"\n        Get the unit for outputs if one is required.\n\n        Parameters\n        ----------\n        valid_outputs : list of numpy array\n            The list of outputs from the model corresponding to inputs\n            inside the bounding box\n        with_units : bool\n            whether or not a unit is required\n        \"\"\"\n\n        if with_units:\n            return getattr(valid_outputs, 'unit', None)"},{"col":4,"comment":"\n        Evaluate the model using the given evaluate routine\n\n        Parameters\n        ----------\n        evaluate : Callable\n            callable which takes in the valid inputs to evaluate model\n        valid_inputs : list of numpy arrays\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : numpy array\n            array of all indices inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n        with_units : bool\n            whether or not a unit is required\n\n        Returns\n        -------\n        outputs :\n            list containing filled in output values\n        valid_outputs_unit :\n            the unit that will be attached to the outputs\n        ","endLoc":466,"header":"def _evaluate_model(self, evaluate: Callable, valid_inputs, valid_index,\n                        input_shape, fill_value, with_units: bool)","id":3794,"name":"_evaluate_model","nodeType":"Function","startLoc":433,"text":"def _evaluate_model(self, evaluate: Callable, valid_inputs, valid_index,\n                        input_shape, fill_value, with_units: bool):\n        \"\"\"\n        Evaluate the model using the given evaluate routine\n\n        Parameters\n        ----------\n        evaluate : Callable\n            callable which takes in the valid inputs to evaluate model\n        valid_inputs : list of numpy arrays\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : numpy array\n            array of all indices inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n        with_units : bool\n            whether or not a unit is required\n\n        Returns\n        -------\n        outputs :\n            list containing filled in output values\n        valid_outputs_unit :\n            the unit that will be attached to the outputs\n        \"\"\"\n        valid_outputs = evaluate(valid_inputs)\n        valid_outputs_unit = self._get_valid_outputs_unit(valid_outputs, with_units)\n\n        return self.prepare_outputs(valid_outputs, valid_index,\n                                    input_shape, fill_value), valid_outputs_unit"},{"col":4,"comment":"null","endLoc":1332,"header":"def __repr__(self)","id":3795,"name":"__repr__","nodeType":"Function","startLoc":1314,"text":"def __repr__(self):\n        parts = ['CompoundBoundingBox(',\n                 '    bounding_boxes={']\n        # bounding_boxes\n        for _selector, bbox in self._bounding_boxes.items():\n            bbox_repr = bbox.__repr__().split('\\n')\n            parts.append(f\"        {_selector} = {bbox_repr.pop(0)}\")\n            for part in bbox_repr:\n                parts.append(f\"            {part}\")\n        parts.append('    }')\n\n        # selector_args\n        selector_args_repr = self.selector_args.pretty_repr(self._model).split('\\n')\n        parts.append(f\"    selector_args = {selector_args_repr.pop(0)}\")\n        for part in selector_args_repr:\n            parts.append(f\"        {part}\")\n        parts.append(')')\n\n        return '\\n'.join(parts)"},{"col":4,"comment":"null","endLoc":1336,"header":"@property\n    def bounding_boxes(self) -> Dict[Any, ModelBoundingBox]","id":3796,"name":"bounding_boxes","nodeType":"Function","startLoc":1334,"text":"@property\n    def bounding_boxes(self) -> Dict[Any, ModelBoundingBox]:\n        return self._bounding_boxes"},{"col":4,"comment":"null","endLoc":1340,"header":"@property\n    def selector_args(self) -> _SelectorArguments","id":3797,"name":"selector_args","nodeType":"Function","startLoc":1338,"text":"@property\n    def selector_args(self) -> _SelectorArguments:\n        return self._selector_args"},{"col":4,"comment":"null","endLoc":1347,"header":"@selector_args.setter\n    def selector_args(self, value)","id":3798,"name":"selector_args","nodeType":"Function","startLoc":1342,"text":"@selector_args.setter\n    def selector_args(self, value):\n        self._selector_args = _SelectorArguments.validate(self._model, value)\n\n        warnings.warn(\"Overriding selector_args may cause problems you should re-validate \"\n                      \"the compound bounding box before use!\", RuntimeWarning)"},{"col":4,"comment":"null","endLoc":1351,"header":"@property\n    def named_selector_tuple(self) -> tuple","id":3799,"name":"named_selector_tuple","nodeType":"Function","startLoc":1349,"text":"@property\n    def named_selector_tuple(self) -> tuple:\n        return self._selector_args.named_tuple(self._model)"},{"col":4,"comment":"null","endLoc":1355,"header":"@property\n    def create_selector(self)","id":3800,"name":"create_selector","nodeType":"Function","startLoc":1353,"text":"@property\n    def create_selector(self):\n        return self._create_selector"},{"col":4,"comment":"null","endLoc":1362,"header":"@staticmethod\n    def _get_selector_key(key)","id":3801,"name":"_get_selector_key","nodeType":"Function","startLoc":1357,"text":"@staticmethod\n    def _get_selector_key(key):\n        if isiterable(key):\n            return tuple(key)\n        else:\n            return (key,)"},{"col":4,"comment":"null","endLoc":34,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3802,"name":"to_tree_transform","nodeType":"Function","startLoc":31,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        offset = model.offset\n        return {'offset': _parameter_to_value(offset)}"},{"col":4,"comment":"null","endLoc":42,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3803,"name":"assert_equal","nodeType":"Function","startLoc":36,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, modeling.models.Shift) and\n                isinstance(b, modeling.models.Shift))\n        assert_array_equal(a.offset.value, b.offset.value)"},{"col":4,"comment":"null","endLoc":1372,"header":"def __setitem__(self, key, value)","id":3804,"name":"__setitem__","nodeType":"Function","startLoc":1364,"text":"def __setitem__(self, key, value):\n        _selector = self._get_selector_key(key)\n        if not self.selector_args.is_selector(_selector):\n            raise ValueError(f\"{_selector} is not a selector!\")\n\n        ignored = self.selector_args.ignore + self.ignored\n        self._bounding_boxes[_selector] = ModelBoundingBox.validate(self._model, value,\n                                                                    ignored,\n                                                                    order=self._order)"},{"col":4,"comment":"The inputs used to determine input_shape for bounding_box evaluation","endLoc":972,"header":"@property\n    def _argnames(self)","id":3805,"name":"_argnames","nodeType":"Function","startLoc":969,"text":"@property\n    def _argnames(self):\n        \"\"\"The inputs used to determine input_shape for bounding_box evaluation\"\"\"\n        return self.inputs"},{"col":4,"comment":"Get input shape for bounding_box evaluation","endLoc":1030,"header":"def input_shape(self, inputs)","id":3806,"name":"input_shape","nodeType":"Function","startLoc":1028,"text":"def input_shape(self, inputs):\n        \"\"\"Get input shape for bounding_box evaluation\"\"\"\n        return self._validate_input_shapes(inputs, self._argnames, self.model_set_axis)"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":3807,"name":"name","nodeType":"Attribute","startLoc":18,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":19,"id":3808,"name":"version","nodeType":"Attribute","startLoc":19,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":20,"id":3809,"name":"types","nodeType":"Attribute","startLoc":20,"text":"types"},{"className":"ScaleType","col":0,"comment":"null","endLoc":70,"id":3810,"nodeType":"Class","startLoc":45,"text":"class ScaleType(TransformType):\n    name = \"transform/scale\"\n    version = '1.2.0'\n    types = ['astropy.modeling.models.Scale']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        factor = node['factor']\n        if not isinstance(factor, u.Quantity) and not np.isscalar(factor):\n            raise NotImplementedError(\n                \"Asdf currently only supports scalar inputs to Scale transform.\")\n\n        return modeling.models.Scale(factor)\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        factor = model.factor\n        return {'factor': _parameter_to_value(factor)}\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, modeling.models.Scale) and\n                isinstance(b, modeling.models.Scale))\n        assert_array_equal(a.factor, b.factor)"},{"col":4,"comment":"null","endLoc":57,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3811,"name":"from_tree_transform","nodeType":"Function","startLoc":50,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        factor = node['factor']\n        if not isinstance(factor, u.Quantity) and not np.isscalar(factor):\n            raise NotImplementedError(\n                \"Asdf currently only supports scalar inputs to Scale transform.\")\n\n        return modeling.models.Scale(factor)"},{"col":4,"comment":"null","endLoc":1063,"header":"@property\n    def bbox_with_units(self)","id":3812,"name":"bbox_with_units","nodeType":"Function","startLoc":1061,"text":"@property\n    def bbox_with_units(self):\n        return (not isinstance(self, CompoundModel))"},{"col":4,"comment":"User-provided name for this model instance.","endLoc":1146,"header":"@property\n    def name(self)","id":3813,"name":"name","nodeType":"Function","startLoc":1142,"text":"@property\n    def name(self):\n        \"\"\"User-provided name for this model instance.\"\"\"\n\n        return self._name"},{"col":4,"comment":"Assign a (new) name to this model.","endLoc":1152,"header":"@name.setter\n    def name(self, val)","id":3814,"name":"name","nodeType":"Function","startLoc":1148,"text":"@name.setter\n    def name(self, val):\n        \"\"\"Assign a (new) name to this model.\"\"\"\n\n        self._name = val"},{"col":4,"comment":"\n        The index of the model set axis--that is the axis of a parameter array\n        that pertains to which model a parameter value pertains to--as\n        specified when the model was initialized.\n\n        See the documentation on :ref:`astropy:modeling-model-sets`\n        for more details.\n        ","endLoc":1165,"header":"@property\n    def model_set_axis(self)","id":3815,"name":"model_set_axis","nodeType":"Function","startLoc":1154,"text":"@property\n    def model_set_axis(self):\n        \"\"\"\n        The index of the model set axis--that is the axis of a parameter array\n        that pertains to which model a parameter value pertains to--as\n        specified when the model was initialized.\n\n        See the documentation on :ref:`astropy:modeling-model-sets`\n        for more details.\n        \"\"\"\n\n        return self._model_set_axis"},{"col":4,"comment":"\n        Return parameters as a pset.\n\n        This is a list with one item per parameter set, which is an array of\n        that parameter's values across all parameter sets, with the last axis\n        associated with the parameter set.\n        ","endLoc":1177,"header":"@property\n    def param_sets(self)","id":3816,"name":"param_sets","nodeType":"Function","startLoc":1167,"text":"@property\n    def param_sets(self):\n        \"\"\"\n        Return parameters as a pset.\n\n        This is a list with one item per parameter set, which is an array of\n        that parameter's values across all parameter sets, with the last axis\n        associated with the parameter set.\n        \"\"\"\n\n        return self._param_sets()"},{"col":4,"comment":"\n        Construct a valid bounding box for a model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The model for which this will be a bounding_box\n        bounding_box : dict, tuple\n            A possible representation of the bounding box\n        order : optional, str\n            The order that a tuple representation will be assumed to be\n                Default: 'C'\n        ","endLoc":761,"header":"@classmethod\n    def validate(cls, model, bounding_box,\n                 ignored: list = None, order: str = 'C', _preserve_ignore: bool = False, **kwargs)","id":3817,"name":"validate","nodeType":"Function","startLoc":736,"text":"@classmethod\n    def validate(cls, model, bounding_box,\n                 ignored: list = None, order: str = 'C', _preserve_ignore: bool = False, **kwargs):\n        \"\"\"\n        Construct a valid bounding box for a model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The model for which this will be a bounding_box\n        bounding_box : dict, tuple\n            A possible representation of the bounding box\n        order : optional, str\n            The order that a tuple representation will be assumed to be\n                Default: 'C'\n        \"\"\"\n        if isinstance(bounding_box, ModelBoundingBox):\n            order = bounding_box.order\n            if _preserve_ignore:\n                ignored = bounding_box.ignored\n            bounding_box = bounding_box.intervals\n\n        new = cls({}, model, ignored=ignored, order=order)\n        new._validate(bounding_box)\n\n        return new"},{"col":4,"comment":"\n        A flattened array of all parameter values in all parameter sets.\n\n        Fittable parameters maintain this list and fitters modify it.\n        ","endLoc":1199,"header":"@property\n    def parameters(self)","id":3818,"name":"parameters","nodeType":"Function","startLoc":1179,"text":"@property\n    def parameters(self):\n        \"\"\"\n        A flattened array of all parameter values in all parameter sets.\n\n        Fittable parameters maintain this list and fitters modify it.\n        \"\"\"\n\n        # Currently the sequence of a model's parameters must be contiguous\n        # within the _parameters array (which may be a view of a larger array,\n        # for example when taking a sub-expression of a compound model), so\n        # the assumption here is reliable:\n        if not self.param_names:\n            # Trivial, but not unheard of\n            return self._parameters\n\n        self._parameters_to_array()\n        start = self._param_metrics[self.param_names[0]]['slice'].start\n        stop = self._param_metrics[self.param_names[-1]]['slice'].stop\n\n        return self._parameters[start:stop]"},{"col":4,"comment":"null","endLoc":269,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3819,"name":"to_tree_transform","nodeType":"Function","startLoc":260,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_mean': _parameter_to_value(model.x_mean),\n                'y_mean': _parameter_to_value(model.y_mean),\n                'x_stddev': _parameter_to_value(model.x_stddev),\n                'y_stddev': _parameter_to_value(model.y_stddev),\n                'theta': _parameter_to_value(model.theta)}\n\n        return node"},{"col":4,"comment":"null","endLoc":282,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3820,"name":"assert_equal","nodeType":"Function","startLoc":271,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Gaussian2D) and\n                isinstance(b, functional_models.Gaussian2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_mean, b.x_mean)\n        assert_array_equal(a.y_mean, b.y_mean)\n        assert_array_equal(a.x_stddev, b.x_stddev)\n        assert_array_equal(a.y_stddev, b.y_stddev)\n        assert_array_equal(a.theta, b.theta)"},{"col":4,"comment":"null","endLoc":587,"header":"def __init__(self, intervals: Dict[int, _Interval], model,\n                 ignored: List[int] = None, order: str = 'C')","id":3821,"name":"__init__","nodeType":"Function","startLoc":581,"text":"def __init__(self, intervals: Dict[int, _Interval], model,\n                 ignored: List[int] = None, order: str = 'C'):\n        super().__init__(model, ignored, order)\n\n        self._intervals = {}\n        if intervals != () and intervals != {}:\n            self._validate(intervals, order=order)"},{"attributeType":"null","col":4,"comment":"null","endLoc":247,"id":3822,"name":"name","nodeType":"Attribute","startLoc":247,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":248,"id":3823,"name":"version","nodeType":"Attribute","startLoc":248,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":249,"id":3824,"name":"types","nodeType":"Attribute","startLoc":249,"text":"types"},{"col":4,"comment":"null","endLoc":62,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3825,"name":"to_tree_transform","nodeType":"Function","startLoc":59,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        factor = model.factor\n        return {'factor': _parameter_to_value(factor)}"},{"col":4,"comment":"null","endLoc":70,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3826,"name":"assert_equal","nodeType":"Function","startLoc":64,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, modeling.models.Scale) and\n                isinstance(b, modeling.models.Scale))\n        assert_array_equal(a.factor, b.factor)"},{"attributeType":"null","col":4,"comment":"null","endLoc":46,"id":3827,"name":"name","nodeType":"Attribute","startLoc":46,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":47,"id":3828,"name":"version","nodeType":"Attribute","startLoc":47,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":48,"id":3829,"name":"types","nodeType":"Attribute","startLoc":48,"text":"types"},{"className":"MultiplyType","col":0,"comment":"null","endLoc":94,"id":3830,"nodeType":"Class","startLoc":73,"text":"class MultiplyType(TransformType):\n    name = \"transform/multiplyscale\"\n    version = '1.0.0'\n    types = ['astropy.modeling.models.Multiply']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        factor = node['factor']\n        return modeling.models.Multiply(factor)\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        factor = model.factor\n        return {'factor': _parameter_to_value(factor)}\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, modeling.models.Multiply) and\n                isinstance(b, modeling.models.Multiply))\n        assert_array_equal(a.factor, b.factor)"},{"col":4,"comment":"null","endLoc":81,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3831,"name":"from_tree_transform","nodeType":"Function","startLoc":78,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        factor = node['factor']\n        return modeling.models.Multiply(factor)"},{"col":4,"comment":"Validate and set any representation","endLoc":734,"header":"def _validate(self, bounding_box, order: str = None)","id":3832,"name":"_validate","nodeType":"Function","startLoc":729,"text":"def _validate(self, bounding_box, order: str = None):\n        \"\"\"Validate and set any representation\"\"\"\n        if self._n_inputs == 1 and not isinstance(bounding_box, dict):\n            self[0] = bounding_box\n        else:\n            self._validate_iterable(bounding_box, order)"},{"col":4,"comment":"null","endLoc":86,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3833,"name":"to_tree_transform","nodeType":"Function","startLoc":83,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        factor = model.factor\n        return {'factor': _parameter_to_value(factor)}"},{"col":4,"comment":"Validate and set any iterable representation","endLoc":727,"header":"def _validate_iterable(self, bounding_box, order: str = None)","id":3834,"name":"_validate_iterable","nodeType":"Function","startLoc":718,"text":"def _validate_iterable(self, bounding_box, order: str = None):\n        \"\"\"Validate and set any iterable representation\"\"\"\n        if len(bounding_box) != self._n_inputs:\n            raise ValueError(f\"Found {len(bounding_box)} intervals, \"\n                             f\"but must have exactly {self._n_inputs}.\")\n\n        if isinstance(bounding_box, dict):\n            self._validate_dict(bounding_box)\n        else:\n            self._validate_sequence(bounding_box, order)"},{"col":4,"comment":"null","endLoc":94,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3835,"name":"assert_equal","nodeType":"Function","startLoc":88,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, modeling.models.Multiply) and\n                isinstance(b, modeling.models.Multiply))\n        assert_array_equal(a.factor, b.factor)"},{"col":4,"comment":"Validate passing dictionary of intervals and setting them.","endLoc":697,"header":"def _validate_dict(self, bounding_box: dict)","id":3836,"name":"_validate_dict","nodeType":"Function","startLoc":694,"text":"def _validate_dict(self, bounding_box: dict):\n        \"\"\"Validate passing dictionary of intervals and setting them.\"\"\"\n        for key, value in bounding_box.items():\n            self[key] = value"},{"attributeType":"null","col":4,"comment":"null","endLoc":74,"id":3837,"name":"name","nodeType":"Attribute","startLoc":74,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":75,"id":3838,"name":"version","nodeType":"Attribute","startLoc":75,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":76,"id":3839,"name":"types","nodeType":"Attribute","startLoc":76,"text":"types"},{"col":4,"comment":"Validate passing tuple of tuples representation (or related) and setting them.","endLoc":708,"header":"def _validate_sequence(self, bounding_box, order: str = None)","id":3840,"name":"_validate_sequence","nodeType":"Function","startLoc":699,"text":"def _validate_sequence(self, bounding_box, order: str = None):\n        \"\"\"Validate passing tuple of tuples representation (or related) and setting them.\"\"\"\n        order = self._get_order(order)\n        if order == 'C':\n            # If bounding_box is C/python ordered, it needs to be reversed\n            # to be in Fortran/mathematical/input order.\n            bounding_box = bounding_box[::-1]\n\n        for index, value in enumerate(bounding_box):\n            self[index] = value"},{"className":"PolynomialTypeBase","col":0,"comment":"null","endLoc":192,"id":3841,"nodeType":"Class","startLoc":97,"text":"class PolynomialTypeBase(TransformType):\n    DOMAIN_WINDOW_MIN_VERSION = AsdfVersion(\"1.2.0\")\n\n    name = \"transform/polynomial\"\n    types = ['astropy.modeling.models.Polynomial1D',\n             'astropy.modeling.models.Polynomial2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        coefficients = np.asarray(node['coefficients'])\n        n_dim = coefficients.ndim\n\n        if n_dim == 1:\n            domain = node.get('domain', None)\n            window = node.get('window', None)\n\n            model = modeling.models.Polynomial1D(coefficients.size - 1,\n                                                 domain=domain, window=window)\n            model.parameters = coefficients\n        elif n_dim == 2:\n            x_domain, y_domain = tuple(node.get('domain', (None, None)))\n            x_window, y_window = tuple(node.get('window', (None, None)))\n            shape = coefficients.shape\n            degree = shape[0] - 1\n            if shape[0] != shape[1]:\n                raise TypeError(\"Coefficients must be an (n+1, n+1) matrix\")\n\n            coeffs = {}\n            for i in range(shape[0]):\n                for j in range(shape[0]):\n                    if i + j < degree + 1:\n                        name = 'c' + str(i) + '_' + str(j)\n                        coeffs[name] = coefficients[i, j]\n            model = modeling.models.Polynomial2D(degree,\n                                                 x_domain=x_domain,\n                                                 y_domain=y_domain,\n                                                 x_window=x_window,\n                                                 y_window=y_window,\n                                                 **coeffs)\n        else:\n            raise NotImplementedError(\n                \"Asdf currently only supports 1D or 2D polynomial transform.\")\n        return model\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        if isinstance(model, modeling.models.Polynomial1D):\n            coefficients = np.array(model.parameters)\n        elif isinstance(model, modeling.models.Polynomial2D):\n            degree = model.degree\n            coefficients = np.zeros((degree + 1, degree + 1))\n            for i in range(degree + 1):\n                for j in range(degree + 1):\n                    if i + j < degree + 1:\n                        name = 'c' + str(i) + '_' + str(j)\n                        coefficients[i, j] = getattr(model, name).value\n        node = {'coefficients': coefficients}\n        typeindex = cls.types.index(model.__class__)\n        ndim = (typeindex % 2) + 1\n\n        if cls.version >= PolynomialTypeBase.DOMAIN_WINDOW_MIN_VERSION:\n            # Schema versions prior to 1.2 included an unrelated \"domain\"\n            # property.  We can't serialize the new domain values with those\n            # versions because they don't validate.\n            if ndim == 1:\n                if model.domain is not None:\n                    node['domain'] = model.domain\n                if model.window is not None:\n                    node['window'] = model.window\n            else:\n                if model.x_domain or model.y_domain is not None:\n                    node['domain'] = (model.x_domain, model.y_domain)\n                if model.x_window or model.y_window is not None:\n                    node['window'] = (model.x_window, model.y_window)\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, (modeling.models.Polynomial1D, modeling.models.Polynomial2D)) and\n                isinstance(b, (modeling.models.Polynomial1D, modeling.models.Polynomial2D)))\n        assert_array_equal(a.parameters, b.parameters)\n\n        if cls.version > PolynomialTypeBase.DOMAIN_WINDOW_MIN_VERSION:\n            # Schema versions prior to 1.2 are known not to serialize\n            # domain or window.\n            if isinstance(a, modeling.models.Polynomial1D):\n                assert a.domain == b.domain\n                assert a.window == b.window\n            else:\n                assert a.x_domain == b.x_domain\n                assert a.x_window == b.x_window\n                assert a.y_domain == b.y_domain\n                assert a.y_window == b.y_window"},{"col":4,"comment":"null","endLoc":139,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3842,"name":"from_tree_transform","nodeType":"Function","startLoc":104,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        coefficients = np.asarray(node['coefficients'])\n        n_dim = coefficients.ndim\n\n        if n_dim == 1:\n            domain = node.get('domain', None)\n            window = node.get('window', None)\n\n            model = modeling.models.Polynomial1D(coefficients.size - 1,\n                                                 domain=domain, window=window)\n            model.parameters = coefficients\n        elif n_dim == 2:\n            x_domain, y_domain = tuple(node.get('domain', (None, None)))\n            x_window, y_window = tuple(node.get('window', (None, None)))\n            shape = coefficients.shape\n            degree = shape[0] - 1\n            if shape[0] != shape[1]:\n                raise TypeError(\"Coefficients must be an (n+1, n+1) matrix\")\n\n            coeffs = {}\n            for i in range(shape[0]):\n                for j in range(shape[0]):\n                    if i + j < degree + 1:\n                        name = 'c' + str(i) + '_' + str(j)\n                        coeffs[name] = coefficients[i, j]\n            model = modeling.models.Polynomial2D(degree,\n                                                 x_domain=x_domain,\n                                                 y_domain=y_domain,\n                                                 x_window=x_window,\n                                                 y_window=y_window,\n                                                 **coeffs)\n        else:\n            raise NotImplementedError(\n                \"Asdf currently only supports 1D or 2D polynomial transform.\")\n        return model"},{"col":4,"comment":"null","endLoc":1384,"header":"def __eq__(self, value)","id":3843,"name":"__eq__","nodeType":"Function","startLoc":1378,"text":"def __eq__(self, value):\n        if isinstance(value, CompoundBoundingBox):\n            return (self.bounding_boxes == value.bounding_boxes) and \\\n                (self.selector_args == value.selector_args) and \\\n                (self.create_selector == value.create_selector)\n        else:\n            return False"},{"col":4,"comment":"null","endLoc":1423,"header":"def __contains__(self, key)","id":3844,"name":"__contains__","nodeType":"Function","startLoc":1422,"text":"def __contains__(self, key):\n        return key in self._bounding_boxes"},{"col":4,"comment":"null","endLoc":1428,"header":"def _create_bounding_box(self, _selector)","id":3845,"name":"_create_bounding_box","nodeType":"Function","startLoc":1425,"text":"def _create_bounding_box(self, _selector):\n        self[_selector] = self._create_selector(_selector, model=self._model)\n\n        return self[_selector]"},{"col":4,"comment":"null","endLoc":1437,"header":"def __getitem__(self, key)","id":3846,"name":"__getitem__","nodeType":"Function","startLoc":1430,"text":"def __getitem__(self, key):\n        _selector = self._get_selector_key(key)\n        if _selector in self:\n            return self._bounding_boxes[_selector]\n        elif self._create_selector is not None:\n            return self._create_bounding_box(_selector)\n        else:\n            raise RuntimeError(f\"No bounding box is defined for selector: {_selector}.\")"},{"col":4,"comment":"null","endLoc":247,"header":"def __init__(self, name='', description='', default=None, unit=None,\n                 getter=None, setter=None, fixed=False, tied=False, min=None,\n                 max=None, bounds=None, prior=None, posterior=None)","id":3847,"name":"__init__","nodeType":"Function","startLoc":193,"text":"def __init__(self, name='', description='', default=None, unit=None,\n                 getter=None, setter=None, fixed=False, tied=False, min=None,\n                 max=None, bounds=None, prior=None, posterior=None):\n        super().__init__()\n\n        self._model = None\n        self._model_required = False\n        self._setter = self._create_value_wrapper(setter, None)\n        self._getter = self._create_value_wrapper(getter, None)\n        self._name = name\n        self.__doc__ = self._description = description.strip()\n\n        # We only need to perform this check on unbound parameters\n        if isinstance(default, Quantity):\n            if unit is not None and not unit.is_equivalent(default.unit):\n                raise ParameterDefinitionError(\n                    \"parameter default {0} does not have units equivalent to \"\n                    \"the required unit {1}\".format(default, unit))\n            unit = default.unit\n            default = default.value\n\n        self._default = default\n        self._unit = unit\n        # Internal units correspond to raw_units held by the model in the\n        # previous implementation. The private _getter and _setter methods\n        # use this to convert to and from the public unit defined for the\n        # parameter.\n        self._internal_unit = None\n        if not self._model_required:\n            if self._default is not None:\n                self.value = self._default\n            else:\n                self._value = None\n\n        # NOTE: These are *default* constraints--on model instances constraints\n        # are taken from the model if set, otherwise the defaults set here are\n        # used\n        if bounds is not None:\n            if min is not None or max is not None:\n                raise ValueError(\n                    'bounds may not be specified simultaneously with min or '\n                    'max when instantiating Parameter {}'.format(name))\n        else:\n            bounds = (min, max)\n\n        self._fixed = fixed\n        self._tied = tied\n        self._bounds = bounds\n        self._order = None\n\n        self._validator = None\n        self._prior = prior\n        self._posterior = posterior\n\n        self._std = None"},{"col":4,"comment":"null","endLoc":1442,"header":"def _select_bounding_box(self, inputs) -> ModelBoundingBox","id":3848,"name":"_select_bounding_box","nodeType":"Function","startLoc":1439,"text":"def _select_bounding_box(self, inputs) -> ModelBoundingBox:\n        _selector = self.selector_args.get_selector(*inputs)\n\n        return self[_selector]"},{"col":4,"comment":"null","endLoc":2598,"header":"def _parameters_to_array(self)","id":3849,"name":"_parameters_to_array","nodeType":"Function","startLoc":2585,"text":"def _parameters_to_array(self):\n        # Now set the parameter values (this will also fill\n        # self._parameters)\n        param_metrics = self._param_metrics\n        for name in self.param_names:\n            param = getattr(self, name)\n            value = param.value\n            if not isinstance(value, np.ndarray):\n                value = np.array([value])\n            self._parameters[param_metrics[name]['slice']] = value.ravel()\n\n        # Finally validate all the parameters; we do this last so that\n        # validators that depend on one of the other parameters' values will\n        # work"},{"col":4,"comment":"\n        Get prepare the inputs with respect to the bounding box.\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        valid_inputs : list\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : array_like\n            array of all indices inside the bounding box\n        all_out: bool\n            if all of the inputs are outside the bounding_box\n        ","endLoc":1466,"header":"def prepare_inputs(self, input_shape, inputs) -> Tuple[Any, Any, Any]","id":3850,"name":"prepare_inputs","nodeType":"Function","startLoc":1444,"text":"def prepare_inputs(self, input_shape, inputs) -> Tuple[Any, Any, Any]:\n        \"\"\"\n        Get prepare the inputs with respect to the bounding box.\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        valid_inputs : list\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : array_like\n            array of all indices inside the bounding box\n        all_out: bool\n            if all of the inputs are outside the bounding_box\n        \"\"\"\n        bounding_box = self._select_bounding_box(inputs)\n        return bounding_box.prepare_inputs(input_shape, inputs)"},{"col":4,"comment":"null","endLoc":1488,"header":"def _matching_bounding_boxes(self, argument, value) -> Dict[Any, ModelBoundingBox]","id":3851,"name":"_matching_bounding_boxes","nodeType":"Function","startLoc":1468,"text":"def _matching_bounding_boxes(self, argument, value) -> Dict[Any, ModelBoundingBox]:\n        selector_index = self.selector_args.selector_index(self._model, argument)\n        matching = {}\n        for selector_key, bbox in self._bounding_boxes.items():\n            if selector_key[selector_index] == value:\n                new_selector_key = list(selector_key)\n                new_selector_key.pop(selector_index)\n\n                if bbox.has_interval(argument):\n                    new_bbox = bbox.fix_inputs(self._model, {argument: value},\n                                               _keep_ignored=True)\n                else:\n                    new_bbox = bbox.copy()\n\n                matching[tuple(new_selector_key)] = new_bbox\n\n        if len(matching) == 0:\n            raise ValueError(f\"Attempting to fix input {argument}, but there are no \"\n                             f\"bounding boxes for argument value {value}.\")\n\n        return matching"},{"col":4,"comment":"\n        Assigning to this attribute updates the parameters array rather than\n        replacing it.\n        ","endLoc":1221,"header":"@parameters.setter\n    def parameters(self, value)","id":3852,"name":"parameters","nodeType":"Function","startLoc":1201,"text":"@parameters.setter\n    def parameters(self, value):\n        \"\"\"\n        Assigning to this attribute updates the parameters array rather than\n        replacing it.\n        \"\"\"\n\n        if not self.param_names:\n            return\n\n        start = self._param_metrics[self.param_names[0]]['slice'].start\n        stop = self._param_metrics[self.param_names[-1]]['slice'].stop\n\n        try:\n            value = np.array(value).flatten()\n            self._parameters[start:stop] = value\n        except ValueError as e:\n            raise InputParameterError(\n                \"Input parameter values not compatible with the model \"\n                \"parameters array: {0}\".format(e))\n        self._array_to_parameters()"},{"className":"KingProjectedAnalytic1DType","col":0,"comment":"null","endLoc":313,"id":3853,"nodeType":"Class","startLoc":285,"text":"class KingProjectedAnalytic1DType(TransformType):\n    name = 'transform/king_projected_analytic1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.KingProjectedAnalytic1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.KingProjectedAnalytic1D(\n                                            amplitude=node['amplitude'],\n                                            r_core=node['r_core'],\n                                            r_tide=node['r_tide'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'r_core': _parameter_to_value(model.r_core),\n                'r_tide': _parameter_to_value(model.r_tide)}\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.KingProjectedAnalytic1D) and\n                isinstance(b, functional_models.KingProjectedAnalytic1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.r_core, b.r_core)\n        assert_array_equal(a.r_tide, b.r_tide)"},{"col":4,"comment":"Wraps a getter/setter function to support optionally passing in\n        a reference to the model object as the second argument.\n        If a model is tied to this parameter and its getter/setter supports\n        a second argument then this creates a partial function using the model\n        instance as the second argument.\n        ","endLoc":667,"header":"def _create_value_wrapper(self, wrapper, model)","id":3854,"name":"_create_value_wrapper","nodeType":"Function","startLoc":634,"text":"def _create_value_wrapper(self, wrapper, model):\n        \"\"\"Wraps a getter/setter function to support optionally passing in\n        a reference to the model object as the second argument.\n        If a model is tied to this parameter and its getter/setter supports\n        a second argument then this creates a partial function using the model\n        instance as the second argument.\n        \"\"\"\n\n        if isinstance(wrapper, np.ufunc):\n            if wrapper.nin != 1:\n                raise TypeError(\"A numpy.ufunc used for Parameter \"\n                                \"getter/setter may only take one input \"\n                                \"argument\")\n        elif wrapper is None:\n            # Just allow non-wrappers to fall through silently, for convenience\n            return None\n        else:\n            inputs, _ = get_inputs_and_params(wrapper)\n            nargs = len(inputs)\n\n            if nargs == 1:\n                pass\n            elif nargs == 2:\n                self._model_required = True\n                if model is not None:\n                    # Don't make a partial function unless we're tied to a\n                    # specific model instance\n                    model_arg = inputs[1].name\n                    wrapper = functools.partial(wrapper, **{model_arg: model})\n            else:\n                raise TypeError(\"Parameter getter/setter must be a function \"\n                                \"of either one or two arguments\")\n\n        return wrapper"},{"col":0,"comment":"\n    Given a callable, determine the input variables and the\n    parameters.\n\n    Parameters\n    ----------\n    func : callable\n\n    Returns\n    -------\n    inputs, params : tuple\n        Each entry is a list of inspect.Parameter objects\n    ","endLoc":351,"header":"def get_inputs_and_params(func)","id":3855,"name":"get_inputs_and_params","nodeType":"Function","startLoc":325,"text":"def get_inputs_and_params(func):\n    \"\"\"\n    Given a callable, determine the input variables and the\n    parameters.\n\n    Parameters\n    ----------\n    func : callable\n\n    Returns\n    -------\n    inputs, params : tuple\n        Each entry is a list of inspect.Parameter objects\n    \"\"\"\n    sig = signature(func)\n\n    inputs = []\n    params = []\n    for param in sig.parameters.values():\n        if param.kind in (param.VAR_POSITIONAL, param.VAR_KEYWORD):\n            raise ValueError(\"Signature must not have *args or **kwargs\")\n        if param.default == param.empty:\n            inputs.append(param)\n        else:\n            params.append(param)\n\n    return inputs, params"},{"col":4,"comment":"null","endLoc":1497,"header":"def _fix_input_selector_arg(self, argument, value)","id":3856,"name":"_fix_input_selector_arg","nodeType":"Function","startLoc":1490,"text":"def _fix_input_selector_arg(self, argument, value):\n        matching_bounding_boxes = self._matching_bounding_boxes(argument, value)\n\n        if len(self.selector_args) == 1:\n            return matching_bounding_boxes[()]\n        else:\n            return CompoundBoundingBox(matching_bounding_boxes, self._model,\n                                       self.selector_args.reduce(self._model, argument))"},{"col":4,"comment":"null","endLoc":295,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3857,"name":"from_tree_transform","nodeType":"Function","startLoc":290,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.KingProjectedAnalytic1D(\n                                            amplitude=node['amplitude'],\n                                            r_core=node['r_core'],\n                                            r_tide=node['r_tide'])"},{"col":4,"comment":"null","endLoc":2606,"header":"def _array_to_parameters(self)","id":3858,"name":"_array_to_parameters","nodeType":"Function","startLoc":2600,"text":"def _array_to_parameters(self):\n        param_metrics = self._param_metrics\n        for name in self.param_names:\n            param = getattr(self, name)\n            value = self._parameters[param_metrics[name]['slice']]\n            value.shape = param_metrics[name]['shape']\n            param.value = value"},{"col":4,"comment":"\n        Perform model evaluation steps:\n            prepare_inputs -> evaluate -> prepare_outputs\n\n        Parameters\n        ----------\n        evaluate : Callable\n            callable which takes in the valid inputs to evaluate model\n        valid_inputs : list of numpy arrays\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : numpy array\n            array of all indices inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n        with_units : bool\n            whether or not a unit is required\n\n        Returns\n        -------\n        outputs :\n            list containing filled in output values\n        valid_outputs_unit :\n            the unit that will be attached to the outputs\n        ","endLoc":504,"header":"def _evaluate(self, evaluate: Callable, inputs, input_shape,\n                  fill_value, with_units: bool)","id":3859,"name":"_evaluate","nodeType":"Function","startLoc":468,"text":"def _evaluate(self, evaluate: Callable, inputs, input_shape,\n                  fill_value, with_units: bool):\n        \"\"\"\n        Perform model evaluation steps:\n            prepare_inputs -> evaluate -> prepare_outputs\n\n        Parameters\n        ----------\n        evaluate : Callable\n            callable which takes in the valid inputs to evaluate model\n        valid_inputs : list of numpy arrays\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : numpy array\n            array of all indices inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n        with_units : bool\n            whether or not a unit is required\n\n        Returns\n        -------\n        outputs :\n            list containing filled in output values\n        valid_outputs_unit :\n            the unit that will be attached to the outputs\n        \"\"\"\n        valid_inputs, valid_index, all_out = self.prepare_inputs(input_shape, inputs)\n\n        if all_out:\n            return self._all_out_output(input_shape, fill_value)\n        else:\n            return self._evaluate_model(evaluate, valid_inputs, valid_index,\n                                        input_shape, fill_value, with_units)"},{"col":4,"comment":"\n        This is a boolean property that indicates whether or not accessing constraints\n        automatically check the constituent models current values. It defaults to True\n        on creation of a model, but for fitting purposes it should be set to False\n        for performance reasons.\n        ","endLoc":1233,"header":"@property\n    def sync_constraints(self)","id":3860,"name":"sync_constraints","nodeType":"Function","startLoc":1223,"text":"@property\n    def sync_constraints(self):\n        '''\n        This is a boolean property that indicates whether or not accessing constraints\n        automatically check the constituent models current values. It defaults to True\n        on creation of a model, but for fitting purposes it should be set to False\n        for performance reasons.\n        '''\n        if not hasattr(self, '_sync_constraints'):\n            self._sync_constraints = True\n        return self._sync_constraints"},{"col":4,"comment":"\n        Create a spline parameters linked to an attribute array for all\n        elements in that array\n\n        Parameters\n        ----------\n        base_name : str\n            Base name for the parameters\n        attr : str\n            The name for the attribute array\n        fixed : optional, bool\n            If the parameters should be fixed or not\n        ","endLoc":175,"header":"def _create_parameters(self, base_name: str, attr: str, fixed=False)","id":3861,"name":"_create_parameters","nodeType":"Function","startLoc":154,"text":"def _create_parameters(self, base_name: str, attr: str, fixed=False):\n        \"\"\"\n        Create a spline parameters linked to an attribute array for all\n        elements in that array\n\n        Parameters\n        ----------\n        base_name : str\n            Base name for the parameters\n        attr : str\n            The name for the attribute array\n        fixed : optional, bool\n            If the parameters should be fixed or not\n        \"\"\"\n        names = []\n        for index in range(len(getattr(self, attr))):\n            name = f\"{base_name}{index}\"\n            names.append(name)\n\n            self._create_parameter(name, index, attr, fixed)\n\n        return tuple(names)"},{"col":4,"comment":"null","endLoc":303,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3862,"name":"to_tree_transform","nodeType":"Function","startLoc":297,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'r_core': _parameter_to_value(model.r_core),\n                'r_tide': _parameter_to_value(model.r_tide)}\n\n        return node"},{"col":4,"comment":"null","endLoc":1239,"header":"@sync_constraints.setter\n    def sync_constraints(self, value)","id":3863,"name":"sync_constraints","nodeType":"Function","startLoc":1235,"text":"@sync_constraints.setter\n    def sync_constraints(self, value):\n        if not isinstance(value, bool):\n            raise ValueError('sync_constraints only accepts True or False as values')\n        self._sync_constraints = value"},{"attributeType":"null","col":4,"comment":"null","endLoc":26,"id":3864,"name":"_knot_names","nodeType":"Attribute","startLoc":26,"text":"_knot_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":27,"id":3865,"name":"_coeff_names","nodeType":"Attribute","startLoc":27,"text":"_coeff_names"},{"col":4,"comment":"null","endLoc":313,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3866,"name":"assert_equal","nodeType":"Function","startLoc":305,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.KingProjectedAnalytic1D) and\n                isinstance(b, functional_models.KingProjectedAnalytic1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.r_core, b.r_core)\n        assert_array_equal(a.r_tide, b.r_tide)"},{"attributeType":"null","col":4,"comment":"null","endLoc":29,"id":3867,"name":"optional_inputs","nodeType":"Attribute","startLoc":29,"text":"optional_inputs"},{"col":4,"comment":"\n        Set the units on the outputs\n            prepare_inputs -> evaluate -> prepare_outputs -> set output units\n\n        Parameters\n        ----------\n        outputs :\n            list containing filled in output values\n        valid_outputs_unit :\n            the unit that will be attached to the outputs\n\n        Returns\n        -------\n        List containing filled in output values and units\n        ","endLoc":527,"header":"@staticmethod\n    def _set_outputs_unit(outputs, valid_outputs_unit)","id":3868,"name":"_set_outputs_unit","nodeType":"Function","startLoc":506,"text":"@staticmethod\n    def _set_outputs_unit(outputs, valid_outputs_unit):\n        \"\"\"\n        Set the units on the outputs\n            prepare_inputs -> evaluate -> prepare_outputs -> set output units\n\n        Parameters\n        ----------\n        outputs :\n            list containing filled in output values\n        valid_outputs_unit :\n            the unit that will be attached to the outputs\n\n        Returns\n        -------\n        List containing filled in output values and units\n        \"\"\"\n\n        if valid_outputs_unit is not None:\n            return Quantity(outputs, valid_outputs_unit, copy=False)\n\n        return outputs"},{"attributeType":"null","col":8,"comment":"null","endLoc":198,"id":3869,"name":"_c","nodeType":"Attribute","startLoc":198,"text":"self._c"},{"col":4,"comment":"\n        A ``dict`` mapping parameter names to their fixed constraint.\n        ","endLoc":1248,"header":"@property\n    def fixed(self)","id":3870,"name":"fixed","nodeType":"Function","startLoc":1241,"text":"@property\n    def fixed(self):\n        \"\"\"\n        A ``dict`` mapping parameter names to their fixed constraint.\n        \"\"\"\n        if not hasattr(self, '_fixed') or self.sync_constraints:\n            self._fixed = _ConstraintsDict(self, 'fixed')\n        return self._fixed"},{"attributeType":"null","col":8,"comment":"null","endLoc":199,"id":3871,"name":"_t","nodeType":"Attribute","startLoc":199,"text":"self._t"},{"attributeType":"null","col":4,"comment":"null","endLoc":286,"id":3872,"name":"name","nodeType":"Attribute","startLoc":286,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":287,"id":3873,"name":"version","nodeType":"Attribute","startLoc":287,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":288,"id":3874,"name":"types","nodeType":"Attribute","startLoc":288,"text":"types"},{"className":"Logarithmic1DType","col":0,"comment":"null","endLoc":339,"id":3875,"nodeType":"Class","startLoc":316,"text":"class Logarithmic1DType(TransformType):\n    name = 'transform/logarithmic1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Logarithmic1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Logarithmic1D(amplitude=node['amplitude'],\n                                               tau=node['tau'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'tau': _parameter_to_value(model.tau)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Logarithmic1D) and\n                isinstance(b, functional_models.Logarithmic1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.tau, b.tau)"},{"attributeType":"null","col":8,"comment":"null","endLoc":38,"id":3876,"name":"_user_knots","nodeType":"Attribute","startLoc":38,"text":"self._user_knots"},{"col":4,"comment":"null","endLoc":324,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3877,"name":"from_tree_transform","nodeType":"Function","startLoc":321,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Logarithmic1D(amplitude=node['amplitude'],\n                                               tau=node['tau'])"},{"attributeType":"null","col":8,"comment":"null","endLoc":200,"id":3878,"name":"_degree","nodeType":"Attribute","startLoc":200,"text":"self._degree"},{"col":4,"comment":"null","endLoc":394,"header":"def __init__(self, model, constraint_type)","id":3879,"name":"__init__","nodeType":"Function","startLoc":387,"text":"def __init__(self, model, constraint_type):\n        self._model = model\n        self.constraint_type = constraint_type\n        c = {}\n        for name in model.param_names:\n            param = getattr(model, name)\n            c[name] = getattr(param, constraint_type)\n        super().__init__(c)"},{"col":4,"comment":"null","endLoc":286,"header":"def __init__(self, knots=None, coeffs=None, degree=3, bounds=None,\n                 n_models=None, model_set_axis=None, name=None, meta=None)","id":3880,"name":"__init__","nodeType":"Function","startLoc":280,"text":"def __init__(self, knots=None, coeffs=None, degree=3, bounds=None,\n                 n_models=None, model_set_axis=None, name=None, meta=None):\n\n        super().__init__(\n            knots=knots, coeffs=coeffs, degree=degree, bounds=bounds,\n            n_models=n_models, model_set_axis=model_set_axis, name=name, meta=meta\n        )"},{"col":4,"comment":"\n        A ``dict`` mapping parameter names to their upper and lower bounds as\n        ``(min, max)`` tuples or ``[min, max]`` lists.\n        ","endLoc":1258,"header":"@property\n    def bounds(self)","id":3881,"name":"bounds","nodeType":"Function","startLoc":1250,"text":"@property\n    def bounds(self):\n        \"\"\"\n        A ``dict`` mapping parameter names to their upper and lower bounds as\n        ``(min, max)`` tuples or ``[min, max]`` lists.\n        \"\"\"\n        if not hasattr(self, '_bounds') or self.sync_constraints:\n            self._bounds = _ConstraintsDict(self, 'bounds')\n        return self._bounds"},{"col":4,"comment":"\n        A ``dict`` mapping parameter names to their tied constraint.\n        ","endLoc":1267,"header":"@property\n    def tied(self)","id":3882,"name":"tied","nodeType":"Function","startLoc":1260,"text":"@property\n    def tied(self):\n        \"\"\"\n        A ``dict`` mapping parameter names to their tied constraint.\n        \"\"\"\n        if not hasattr(self, '_tied') or self.sync_constraints:\n            self._tied = _ConstraintsDict(self, 'tied')\n        return self._tied"},{"col":4,"comment":"List of parameter equality constraints.","endLoc":1273,"header":"@property\n    def eqcons(self)","id":3883,"name":"eqcons","nodeType":"Function","startLoc":1269,"text":"@property\n    def eqcons(self):\n        \"\"\"List of parameter equality constraints.\"\"\"\n\n        return self._mconstraints['eqcons']"},{"col":4,"comment":"List of parameter inequality constraints.","endLoc":1279,"header":"@property\n    def ineqcons(self)","id":3884,"name":"ineqcons","nodeType":"Function","startLoc":1275,"text":"@property\n    def ineqcons(self):\n        \"\"\"List of parameter inequality constraints.\"\"\"\n\n        return self._mconstraints['ineqcons']"},{"col":4,"comment":"\n        Returns True if the model has an analytic or user\n        inverse defined.\n        ","endLoc":1291,"header":"def has_inverse(self)","id":3885,"name":"has_inverse","nodeType":"Function","startLoc":1281,"text":"def has_inverse(self):\n        \"\"\"\n        Returns True if the model has an analytic or user\n        inverse defined.\n        \"\"\"\n        try:\n            self.inverse\n        except NotImplementedError:\n            return False\n\n        return True"},{"col":4,"comment":"\n        Returns a new `~astropy.modeling.Model` instance which performs the\n        inverse transform, if an analytic inverse is defined for this model.\n\n        Even on models that don't have an inverse defined, this property can be\n        set with a manually-defined inverse, such a pre-computed or\n        experimentally determined inverse (often given as a\n        `~astropy.modeling.polynomial.PolynomialModel`, but not by\n        requirement).\n\n        A custom inverse can be deleted with ``del model.inverse``.  In this\n        case the model's inverse is reset to its default, if a default exists\n        (otherwise the default is to raise `NotImplementedError`).\n\n        Note to authors of `~astropy.modeling.Model` subclasses:  To define an\n        inverse for a model simply override this property to return the\n        appropriate model representing the inverse.  The machinery that will\n        make the inverse manually-overridable is added automatically by the\n        base class.\n        ","endLoc":1325,"header":"@property\n    def inverse(self)","id":3886,"name":"inverse","nodeType":"Function","startLoc":1293,"text":"@property\n    def inverse(self):\n        \"\"\"\n        Returns a new `~astropy.modeling.Model` instance which performs the\n        inverse transform, if an analytic inverse is defined for this model.\n\n        Even on models that don't have an inverse defined, this property can be\n        set with a manually-defined inverse, such a pre-computed or\n        experimentally determined inverse (often given as a\n        `~astropy.modeling.polynomial.PolynomialModel`, but not by\n        requirement).\n\n        A custom inverse can be deleted with ``del model.inverse``.  In this\n        case the model's inverse is reset to its default, if a default exists\n        (otherwise the default is to raise `NotImplementedError`).\n\n        Note to authors of `~astropy.modeling.Model` subclasses:  To define an\n        inverse for a model simply override this property to return the\n        appropriate model representing the inverse.  The machinery that will\n        make the inverse manually-overridable is added automatically by the\n        base class.\n        \"\"\"\n        if self._user_inverse is not None:\n            return self._user_inverse\n        elif self._inverse is not None:\n            result = self._inverse()\n            if result is not NotImplemented:\n                if not self._has_inverse_bounding_box:\n                    result.bounding_box = None\n                return result\n\n        raise NotImplementedError(\"No analytical or user-supplied inverse transform \"\n                                  \"has been implemented for this model.\")"},{"col":4,"comment":"\n        The knots vector\n        ","endLoc":297,"header":"@property\n    def t(self)","id":3887,"name":"t","nodeType":"Function","startLoc":288,"text":"@property\n    def t(self):\n        \"\"\"\n        The knots vector\n        \"\"\"\n\n        if self._t is None:\n            return np.concatenate((np.zeros(self._degree + 1), np.ones(self._degree + 1)))\n        else:\n            return self._t"},{"col":4,"comment":"null","endLoc":306,"header":"@t.setter\n    def t(self, value)","id":3888,"name":"t","nodeType":"Function","startLoc":299,"text":"@t.setter\n    def t(self, value):\n        if self._t is None:\n            raise ValueError(\"The model parameters must be initialized before setting knots.\")\n        elif len(value) == len(self._t):\n            self._t = value\n        else:\n            raise ValueError(\"There must be exactly as many knots as previously defined.\")"},{"col":4,"comment":"null","endLoc":1335,"header":"@inverse.setter\n    def inverse(self, value)","id":3889,"name":"inverse","nodeType":"Function","startLoc":1327,"text":"@inverse.setter\n    def inverse(self, value):\n        if not isinstance(value, (Model, type(None))):\n            raise ValueError(\n                \"The ``inverse`` attribute may be assigned a `Model` \"\n                \"instance or `None` (where `None` explicitly forces the \"\n                \"model to have no inverse.\")\n\n        self._user_inverse = value"},{"col":4,"comment":"\n        The interior knots\n        ","endLoc":314,"header":"@property\n    def t_interior(self)","id":3890,"name":"t_interior","nodeType":"Function","startLoc":308,"text":"@property\n    def t_interior(self):\n        \"\"\"\n        The interior knots\n        \"\"\"\n\n        return self.t[self.degree + 1: -(self.degree + 1)]"},{"col":4,"comment":"\n        The coefficients vector\n        ","endLoc":325,"header":"@property\n    def c(self)","id":3891,"name":"c","nodeType":"Function","startLoc":316,"text":"@property\n    def c(self):\n        \"\"\"\n        The coefficients vector\n        \"\"\"\n\n        if self._c is None:\n            return np.zeros(len(self.t))\n        else:\n            return self._c"},{"col":4,"comment":"null","endLoc":334,"header":"@c.setter\n    def c(self, value)","id":3892,"name":"c","nodeType":"Function","startLoc":327,"text":"@c.setter\n    def c(self, value):\n        if self._c is None:\n            raise ValueError(\"The model parameters must be initialized before setting coeffs.\")\n        elif len(value) == len(self._c):\n            self._c = value\n        else:\n            raise ValueError(\"There must be exactly as many coeffs as previously defined.\")"},{"col":4,"comment":"\n        Resets the model's inverse to its default (if one exists, otherwise\n        the model will have no inverse).\n        ","endLoc":1347,"header":"@inverse.deleter\n    def inverse(self)","id":3893,"name":"inverse","nodeType":"Function","startLoc":1337,"text":"@inverse.deleter\n    def inverse(self):\n        \"\"\"\n        Resets the model's inverse to its default (if one exists, otherwise\n        the model will have no inverse).\n        \"\"\"\n\n        try:\n            del self._user_inverse\n        except AttributeError:\n            pass"},{"col":4,"comment":"\n        A flag indicating whether or not a custom inverse model has been\n        assigned to this model by a user, via assignment to ``model.inverse``.\n        ","endLoc":1355,"header":"@property\n    def has_user_inverse(self)","id":3894,"name":"has_user_inverse","nodeType":"Function","startLoc":1349,"text":"@property\n    def has_user_inverse(self):\n        \"\"\"\n        A flag indicating whether or not a custom inverse model has been\n        assigned to this model by a user, via assignment to ``model.inverse``.\n        \"\"\"\n        return self._user_inverse is not None"},{"col":4,"comment":"\n        A `tuple` of length `n_inputs` defining the bounding box limits, or\n        raise `NotImplementedError` for no bounding_box.\n\n        The default limits are given by a ``bounding_box`` property or method\n        defined in the class body of a specific model.  If not defined then\n        this property just raises `NotImplementedError` by default (but may be\n        assigned a custom value by a user).  ``bounding_box`` can be set\n        manually to an array-like object of shape ``(model.n_inputs, 2)``. For\n        further usage, see :ref:`astropy:bounding-boxes`\n\n        The limits are ordered according to the `numpy` ``'C'`` indexing\n        convention, and are the reverse of the model input order,\n        e.g. for inputs ``('x', 'y', 'z')``, ``bounding_box`` is defined:\n\n        * for 1D: ``(x_low, x_high)``\n        * for 2D: ``((y_low, y_high), (x_low, x_high))``\n        * for 3D: ``((z_low, z_high), (y_low, y_high), (x_low, x_high))``\n\n        Examples\n        --------\n\n        Setting the ``bounding_box`` limits for a 1D and 2D model:\n\n        >>> from astropy.modeling.models import Gaussian1D, Gaussian2D\n        >>> model_1d = Gaussian1D()\n        >>> model_2d = Gaussian2D(x_stddev=1, y_stddev=1)\n        >>> model_1d.bounding_box = (-5, 5)\n        >>> model_2d.bounding_box = ((-6, 6), (-5, 5))\n\n        Setting the bounding_box limits for a user-defined 3D `custom_model`:\n\n        >>> from astropy.modeling.models import custom_model\n        >>> def const3d(x, y, z, amp=1):\n        ...    return amp\n        ...\n        >>> Const3D = custom_model(const3d)\n        >>> model_3d = Const3D()\n        >>> model_3d.bounding_box = ((-6, 6), (-5, 5), (-4, 4))\n\n        To reset ``bounding_box`` to its default limits just delete the\n        user-defined value--this will reset it back to the default defined\n        on the class:\n\n        >>> del model_1d.bounding_box\n\n        To disable the bounding box entirely (including the default),\n        set ``bounding_box`` to `None`:\n\n        >>> model_1d.bounding_box = None\n        >>> model_1d.bounding_box  # doctest: +IGNORE_EXCEPTION_DETAIL\n        Traceback (most recent call last):\n        NotImplementedError: No bounding box is defined for this model\n        (note: the bounding box was explicitly disabled for this model;\n        use `del model.bounding_box` to restore the default bounding box,\n        if one is defined for this model).\n        ","endLoc":1441,"header":"@property\n    def bounding_box(self)","id":3895,"name":"bounding_box","nodeType":"Function","startLoc":1357,"text":"@property\n    def bounding_box(self):\n        r\"\"\"\n        A `tuple` of length `n_inputs` defining the bounding box limits, or\n        raise `NotImplementedError` for no bounding_box.\n\n        The default limits are given by a ``bounding_box`` property or method\n        defined in the class body of a specific model.  If not defined then\n        this property just raises `NotImplementedError` by default (but may be\n        assigned a custom value by a user).  ``bounding_box`` can be set\n        manually to an array-like object of shape ``(model.n_inputs, 2)``. For\n        further usage, see :ref:`astropy:bounding-boxes`\n\n        The limits are ordered according to the `numpy` ``'C'`` indexing\n        convention, and are the reverse of the model input order,\n        e.g. for inputs ``('x', 'y', 'z')``, ``bounding_box`` is defined:\n\n        * for 1D: ``(x_low, x_high)``\n        * for 2D: ``((y_low, y_high), (x_low, x_high))``\n        * for 3D: ``((z_low, z_high), (y_low, y_high), (x_low, x_high))``\n\n        Examples\n        --------\n\n        Setting the ``bounding_box`` limits for a 1D and 2D model:\n\n        >>> from astropy.modeling.models import Gaussian1D, Gaussian2D\n        >>> model_1d = Gaussian1D()\n        >>> model_2d = Gaussian2D(x_stddev=1, y_stddev=1)\n        >>> model_1d.bounding_box = (-5, 5)\n        >>> model_2d.bounding_box = ((-6, 6), (-5, 5))\n\n        Setting the bounding_box limits for a user-defined 3D `custom_model`:\n\n        >>> from astropy.modeling.models import custom_model\n        >>> def const3d(x, y, z, amp=1):\n        ...    return amp\n        ...\n        >>> Const3D = custom_model(const3d)\n        >>> model_3d = Const3D()\n        >>> model_3d.bounding_box = ((-6, 6), (-5, 5), (-4, 4))\n\n        To reset ``bounding_box`` to its default limits just delete the\n        user-defined value--this will reset it back to the default defined\n        on the class:\n\n        >>> del model_1d.bounding_box\n\n        To disable the bounding box entirely (including the default),\n        set ``bounding_box`` to `None`:\n\n        >>> model_1d.bounding_box = None\n        >>> model_1d.bounding_box  # doctest: +IGNORE_EXCEPTION_DETAIL\n        Traceback (most recent call last):\n        NotImplementedError: No bounding box is defined for this model\n        (note: the bounding box was explicitly disabled for this model;\n        use `del model.bounding_box` to restore the default bounding box,\n        if one is defined for this model).\n        \"\"\"\n\n        if self._user_bounding_box is not None:\n            if self._user_bounding_box is NotImplemented:\n                raise NotImplementedError(\n                    \"No bounding box is defined for this model (note: the \"\n                    \"bounding box was explicitly disabled for this model; \"\n                    \"use `del model.bounding_box` to restore the default \"\n                    \"bounding box, if one is defined for this model).\")\n            return self._user_bounding_box\n        elif self._bounding_box is None:\n            raise NotImplementedError(\n                \"No bounding box is defined for this model.\")\n        elif isinstance(self._bounding_box, ModelBoundingBox):\n            # This typically implies a hard-coded bounding box.  This will\n            # probably be rare, but it is an option\n            return self._bounding_box\n        elif isinstance(self._bounding_box, types.MethodType):\n            return ModelBoundingBox.validate(self, self._bounding_box())\n        else:\n            # The only other allowed possibility is that it's a ModelBoundingBox\n            # subclass, so we call it with its default arguments and return an\n            # instance of it (that can be called to recompute the bounding box\n            # with any optional parameters)\n            # (In other words, in this case self._bounding_box is a *class*)\n            bounding_box = self._bounding_box((), model=self)()\n            return self._bounding_box(bounding_box, model=self)"},{"col":4,"comment":"\n        The degree of the spline polynomials\n        ","endLoc":342,"header":"@property\n    def degree(self)","id":3896,"name":"degree","nodeType":"Function","startLoc":336,"text":"@property\n    def degree(self):\n        \"\"\"\n        The degree of the spline polynomials\n        \"\"\"\n\n        return self._degree"},{"col":4,"comment":"null","endLoc":346,"header":"@property\n    def _initialized(self)","id":3897,"name":"_initialized","nodeType":"Function","startLoc":344,"text":"@property\n    def _initialized(self):\n        return self._t is not None and self._c is not None"},{"col":4,"comment":"\n        Scipy 'tck' tuple representation\n        ","endLoc":354,"header":"@property\n    def tck(self)","id":3898,"name":"tck","nodeType":"Function","startLoc":348,"text":"@property\n    def tck(self):\n        \"\"\"\n        Scipy 'tck' tuple representation\n        \"\"\"\n\n        return (self.t, self.c, self.degree)"},{"col":4,"comment":"null","endLoc":369,"header":"@tck.setter\n    def tck(self, value)","id":3899,"name":"tck","nodeType":"Function","startLoc":356,"text":"@tck.setter\n    def tck(self, value):\n        if self._initialized:\n            if value[2] != self.degree:\n                raise ValueError(\"tck has incompatible degree!\")\n\n            self.t = value[0]\n            self.c = value[1]\n        else:\n            self._init_spline(value[0], value[1])\n\n        # Calling this will properly fill the _parameter vector, which is\n        #   used directly sometimes without being properly filled.\n        _ = self.parameters"},{"col":4,"comment":"\n        Scipy bspline object representation\n        ","endLoc":379,"header":"@property\n    def bspline(self)","id":3900,"name":"bspline","nodeType":"Function","startLoc":371,"text":"@property\n    def bspline(self):\n        \"\"\"\n        Scipy bspline object representation\n        \"\"\"\n\n        from scipy.interpolate import BSpline\n\n        return BSpline(*self.tck)"},{"col":4,"comment":"null","endLoc":388,"header":"@bspline.setter\n    def bspline(self, value)","id":3901,"name":"bspline","nodeType":"Function","startLoc":381,"text":"@bspline.setter\n    def bspline(self, value):\n        from scipy.interpolate import BSpline\n\n        if isinstance(value, BSpline):\n            self.tck = value.tck\n        else:\n            self.tck = value"},{"col":4,"comment":"\n        Dictionary of knot parameters\n        ","endLoc":396,"header":"@property\n    def knots(self)","id":3902,"name":"knots","nodeType":"Function","startLoc":390,"text":"@property\n    def knots(self):\n        \"\"\"\n        Dictionary of knot parameters\n        \"\"\"\n\n        return [getattr(self, knot) for knot in self._knot_names]"},{"col":4,"comment":"If the knots have been supplied by the user","endLoc":401,"header":"@property\n    def user_knots(self)","id":3903,"name":"user_knots","nodeType":"Function","startLoc":398,"text":"@property\n    def user_knots(self):\n        \"\"\"If the knots have been supplied by the user\"\"\"\n        return self._user_knots"},{"col":4,"comment":"null","endLoc":405,"header":"@user_knots.setter\n    def user_knots(self, value)","id":3904,"name":"user_knots","nodeType":"Function","startLoc":403,"text":"@user_knots.setter\n    def user_knots(self, value):\n        self._user_knots = value"},{"col":4,"comment":"\n        Dictionary of coefficient parameters\n        ","endLoc":413,"header":"@property\n    def coeffs(self)","id":3905,"name":"coeffs","nodeType":"Function","startLoc":407,"text":"@property\n    def coeffs(self):\n        \"\"\"\n        Dictionary of coefficient parameters\n        \"\"\"\n\n        return [getattr(self, coeff) for coeff in self._coeff_names]"},{"col":4,"comment":"null","endLoc":417,"header":"def _init_parameters(self)","id":3906,"name":"_init_parameters","nodeType":"Function","startLoc":415,"text":"def _init_parameters(self):\n        self._knot_names = self._create_parameters(\"knot\", \"t\", fixed=True)\n        self._coeff_names = self._create_parameters(\"coeff\", \"c\")"},{"col":4,"comment":"null","endLoc":330,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3907,"name":"to_tree_transform","nodeType":"Function","startLoc":326,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'tau': _parameter_to_value(model.tau)}\n        return node"},{"col":4,"comment":"null","endLoc":439,"header":"def _init_bounds(self, bounds=None)","id":3908,"name":"_init_bounds","nodeType":"Function","startLoc":419,"text":"def _init_bounds(self, bounds=None):\n        if bounds is None:\n            bounds = [None, None]\n\n        if bounds[0] is None:\n            lower = np.zeros(self._degree + 1)\n        else:\n            lower = np.array([bounds[0]] * (self._degree + 1))\n\n        if bounds[1] is None:\n            upper = np.ones(self._degree + 1)\n        else:\n            upper = np.array([bounds[1]] * (self._degree + 1))\n\n        if bounds[0] is not None and bounds[1] is not None:\n            self.bounding_box = bounds\n            has_bounds = True\n        else:\n            has_bounds = False\n\n        return has_bounds, lower, upper"},{"col":4,"comment":"null","endLoc":339,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3909,"name":"assert_equal","nodeType":"Function","startLoc":332,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Logarithmic1D) and\n                isinstance(b, functional_models.Logarithmic1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.tau, b.tau)"},{"col":4,"comment":"\n        Assigns the bounding box limits.\n        ","endLoc":1469,"header":"@bounding_box.setter\n    def bounding_box(self, bounding_box)","id":3910,"name":"bounding_box","nodeType":"Function","startLoc":1443,"text":"@bounding_box.setter\n    def bounding_box(self, bounding_box):\n        \"\"\"\n        Assigns the bounding box limits.\n        \"\"\"\n\n        if bounding_box is None:\n            cls = None\n            # We use this to explicitly set an unimplemented bounding box (as\n            # opposed to no user bounding box defined)\n            bounding_box = NotImplemented\n        elif (isinstance(bounding_box, CompoundBoundingBox) or\n              isinstance(bounding_box, dict)):\n            cls = CompoundBoundingBox\n        elif (isinstance(self._bounding_box, type) and\n              issubclass(self._bounding_box, ModelBoundingBox)):\n            cls = self._bounding_box\n        else:\n            cls = ModelBoundingBox\n\n        if cls is not None:\n            try:\n                bounding_box = cls.validate(self, bounding_box, _preserve_ignore=True)\n            except ValueError as exc:\n                raise ValueError(exc.args[0])\n\n        self._user_bounding_box = bounding_box"},{"col":4,"comment":"null","endLoc":460,"header":"def _init_knots(self, knots, has_bounds, lower, upper)","id":3911,"name":"_init_knots","nodeType":"Function","startLoc":441,"text":"def _init_knots(self, knots, has_bounds, lower, upper):\n        if np.issubdtype(type(knots), np.integer):\n            self._t = np.concatenate(\n                (lower, np.zeros(knots), upper)\n            )\n        elif isiterable(knots):\n            self._user_knots = True\n            if has_bounds:\n                self._t = np.concatenate(\n                    (lower, np.array(knots), upper)\n                )\n            else:\n                if len(knots) < 2*(self._degree + 1):\n                    raise ValueError(f\"Must have at least {2*(self._degree + 1)} knots.\")\n                self._t = np.array(knots)\n        else:\n            raise ValueError(f\"Knots: {knots} must be iterable or value\")\n\n        # check that knots form a viable spline\n        self.bspline"},{"col":4,"comment":"null","endLoc":469,"header":"def _init_coeffs(self, coeffs=None)","id":3912,"name":"_init_coeffs","nodeType":"Function","startLoc":462,"text":"def _init_coeffs(self, coeffs=None):\n        if coeffs is None:\n            self._c = np.zeros(len(self._t))\n        else:\n            self._c = np.array(coeffs)\n\n        # check that coeffs form a viable spline\n        self.bspline"},{"attributeType":"null","col":4,"comment":"null","endLoc":317,"id":3913,"name":"name","nodeType":"Attribute","startLoc":317,"text":"name"},{"col":4,"comment":"null","endLoc":473,"header":"def _init_data(self, knots, coeffs, bounds=None)","id":3914,"name":"_init_data","nodeType":"Function","startLoc":471,"text":"def _init_data(self, knots, coeffs, bounds=None):\n        self._init_knots(knots, *self._init_bounds(bounds))\n        self._init_coeffs(coeffs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":318,"id":3915,"name":"version","nodeType":"Attribute","startLoc":318,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":319,"id":3916,"name":"types","nodeType":"Attribute","startLoc":319,"text":"types"},{"className":"Lorentz1DType","col":0,"comment":"null","endLoc":368,"id":3917,"nodeType":"Class","startLoc":342,"text":"class Lorentz1DType(TransformType):\n    name = 'transform/lorentz1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Lorentz1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Lorentz1D(amplitude=node['amplitude'],\n                                           x_0=node['x_0'],\n                                           fwhm=node['fwhm'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'fwhm': _parameter_to_value(model.fwhm)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Lorentz1D) and\n                isinstance(b, functional_models.Lorentz1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.fwhm, b.fwhm)"},{"col":4,"comment":"null","endLoc":351,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3918,"name":"from_tree_transform","nodeType":"Function","startLoc":347,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Lorentz1D(amplitude=node['amplitude'],\n                                           x_0=node['x_0'],\n                                           fwhm=node['fwhm'])"},{"col":4,"comment":"\n        Evaluate the spline.\n\n        Parameters\n        ----------\n        x :\n            (positional) The points where the model is evaluating the spline at\n        nu : optional\n            (kwarg) The derivative of the spline for evaluation, 0 <= nu <= degree + 1.\n            Default: 0.\n        ","endLoc":495,"header":"def evaluate(self, *args, **kwargs)","id":3919,"name":"evaluate","nodeType":"Function","startLoc":475,"text":"def evaluate(self, *args, **kwargs):\n        \"\"\"\n        Evaluate the spline.\n\n        Parameters\n        ----------\n        x :\n            (positional) The points where the model is evaluating the spline at\n        nu : optional\n            (kwarg) The derivative of the spline for evaluation, 0 <= nu <= degree + 1.\n            Default: 0.\n        \"\"\"\n        kwargs = super().evaluate(*args, **kwargs)\n        x = args[0]\n\n        if 'nu' in kwargs:\n            if kwargs['nu'] > self.degree + 1:\n                raise RuntimeError(\"Cannot evaluate a derivative of \"\n                                   f\"order higher than {self.degree + 1}\")\n\n        return self.bspline(x, **kwargs)"},{"col":4,"comment":"null","endLoc":1479,"header":"@bounding_box.deleter\n    def bounding_box(self)","id":3920,"name":"bounding_box","nodeType":"Function","startLoc":1477,"text":"@bounding_box.deleter\n    def bounding_box(self):\n        self._user_bounding_box = None"},{"col":4,"comment":"null","endLoc":1475,"header":"def set_slice_args(self, *args)","id":3921,"name":"set_slice_args","nodeType":"Function","startLoc":1471,"text":"def set_slice_args(self, *args):\n        if isinstance(self._user_bounding_box, CompoundBoundingBox):\n            self._user_bounding_box.slice_args = args\n        else:\n            raise RuntimeError('The bounding_box for this model is not compound')"},{"col":4,"comment":"\n        A flag indicating whether or not a custom bounding_box has been\n        assigned to this model by a user, via assignment to\n        ``model.bounding_box``.\n        ","endLoc":1489,"header":"@property\n    def has_user_bounding_box(self)","id":3922,"name":"has_user_bounding_box","nodeType":"Function","startLoc":1481,"text":"@property\n    def has_user_bounding_box(self):\n        \"\"\"\n        A flag indicating whether or not a custom bounding_box has been\n        assigned to this model by a user, via assignment to\n        ``model.bounding_box``.\n        \"\"\"\n\n        return self._user_bounding_box is not None"},{"col":4,"comment":"\n        Fitter should set covariance matrix, if available.\n        ","endLoc":1496,"header":"@property\n    def cov_matrix(self)","id":3923,"name":"cov_matrix","nodeType":"Function","startLoc":1491,"text":"@property\n    def cov_matrix(self):\n        \"\"\"\n        Fitter should set covariance matrix, if available.\n        \"\"\"\n        return self._cov_matrix"},{"col":4,"comment":"null","endLoc":1518,"header":"@cov_matrix.setter\n    def cov_matrix(self, cov)","id":3924,"name":"cov_matrix","nodeType":"Function","startLoc":1498,"text":"@cov_matrix.setter\n    def cov_matrix(self, cov):\n\n        self._cov_matrix = cov\n\n        unfix_untied_params = [p for p in self.param_names if (self.fixed[p] is False)\n                               and (self.tied[p] is False)]\n        if type(cov) == list:  # model set\n            param_stds = []\n            for c in cov:\n                param_stds.append([np.sqrt(x) if x > 0 else None for x in np.diag(c.cov_matrix)])\n            for p, param_name in enumerate(unfix_untied_params):\n                par = getattr(self, param_name)\n                par.std = [item[p] for item in param_stds]\n                setattr(self, param_name, par)\n        else:\n            param_stds = [np.sqrt(x) if x > 0 else None for x in np.diag(cov.cov_matrix)]\n            for param_name in unfix_untied_params:\n                par = getattr(self, param_name)\n                par.std = param_stds.pop(0)\n                setattr(self, param_name, par)"},{"col":4,"comment":"\n        Create a spline that is the derivative of this one\n\n        Parameters\n        ----------\n        nu : int, optional\n            Derivative order, default is 1.\n        ","endLoc":514,"header":"def derivative(self, nu=1)","id":3925,"name":"derivative","nodeType":"Function","startLoc":497,"text":"def derivative(self, nu=1):\n        \"\"\"\n        Create a spline that is the derivative of this one\n\n        Parameters\n        ----------\n        nu : int, optional\n            Derivative order, default is 1.\n        \"\"\"\n        if nu <= self.degree:\n            bspline = self.bspline.derivative(nu=nu)\n\n            derivative = Spline1D(degree=bspline.k)\n            derivative.bspline = bspline\n\n            return derivative\n        else:\n            raise ValueError(f'Must have nu <= {self.degree}')"},{"col":4,"comment":"\n        Perform full model evaluation steps:\n            prepare_inputs -> evaluate -> prepare_outputs -> set output units\n\n        Parameters\n        ----------\n        evaluate : callable\n            callable which takes in the valid inputs to evaluate model\n        valid_inputs : list\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : array_like\n            array of all indices inside the bounding box\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n        ","endLoc":554,"header":"def evaluate(self, evaluate: Callable, inputs, fill_value)","id":3926,"name":"evaluate","nodeType":"Function","startLoc":529,"text":"def evaluate(self, evaluate: Callable, inputs, fill_value):\n        \"\"\"\n        Perform full model evaluation steps:\n            prepare_inputs -> evaluate -> prepare_outputs -> set output units\n\n        Parameters\n        ----------\n        evaluate : callable\n            callable which takes in the valid inputs to evaluate model\n        valid_inputs : list\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : array_like\n            array of all indices inside the bounding box\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n        \"\"\"\n        input_shape = self._model.input_shape(inputs)\n\n        # NOTE: CompoundModel does not currently support units during\n        #   evaluation for bounding_box so this feature is turned off\n        #   for CompoundModel(s).\n        outputs, valid_outputs_unit = self._evaluate(evaluate, inputs, input_shape,\n                                                     fill_value, self._model.bbox_with_units)\n        return tuple(self._set_outputs_unit(outputs, valid_outputs_unit))"},{"col":4,"comment":"\n        Standard deviation of parameters, if covariance matrix is available.\n        ","endLoc":1525,"header":"@property\n    def stds(self)","id":3927,"name":"stds","nodeType":"Function","startLoc":1520,"text":"@property\n    def stds(self):\n        \"\"\"\n        Standard deviation of parameters, if covariance matrix is available.\n        \"\"\"\n        return self._stds"},{"col":4,"comment":"null","endLoc":1529,"header":"@stds.setter\n    def stds(self, stds)","id":3928,"name":"stds","nodeType":"Function","startLoc":1527,"text":"@stds.setter\n    def stds(self, stds):\n        self._stds = stds"},{"col":4,"comment":" A flag indicating whether a model is separable.","endLoc":1539,"header":"@property\n    def separable(self)","id":3929,"name":"separable","nodeType":"Function","startLoc":1531,"text":"@property\n    def separable(self):\n        \"\"\" A flag indicating whether a model is separable.\"\"\"\n\n        if self._separable is not None:\n            return self._separable\n        raise NotImplementedError(\n            'The \"separable\" property is not defined for '\n            'model {}'.format(self.__class__.__name__))"},{"col":4,"comment":"\n        Return an instance of the model for which the parameter values have\n        been converted to the right units for the data, then the units have\n        been stripped away.\n\n        The input and output Quantity objects should be given as keyword\n        arguments.\n\n        Notes\n        -----\n\n        This method is needed in order to be able to fit models with units in\n        the parameters, since we need to temporarily strip away the units from\n        the model during the fitting (which might be done by e.g. scipy\n        functions).\n\n        The units that the parameters should be converted to are not\n        necessarily the units of the input data, but are derived from them.\n        Model subclasses that want fitting to work in the presence of\n        quantities need to define a ``_parameter_units_for_data_units`` method\n        that takes the input and output units (as two dictionaries) and\n        returns a dictionary giving the target units for each parameter.\n\n        ","endLoc":1586,"header":"def without_units_for_data(self, **kwargs)","id":3930,"name":"without_units_for_data","nodeType":"Function","startLoc":1543,"text":"def without_units_for_data(self, **kwargs):\n        \"\"\"\n        Return an instance of the model for which the parameter values have\n        been converted to the right units for the data, then the units have\n        been stripped away.\n\n        The input and output Quantity objects should be given as keyword\n        arguments.\n\n        Notes\n        -----\n\n        This method is needed in order to be able to fit models with units in\n        the parameters, since we need to temporarily strip away the units from\n        the model during the fitting (which might be done by e.g. scipy\n        functions).\n\n        The units that the parameters should be converted to are not\n        necessarily the units of the input data, but are derived from them.\n        Model subclasses that want fitting to work in the presence of\n        quantities need to define a ``_parameter_units_for_data_units`` method\n        that takes the input and output units (as two dictionaries) and\n        returns a dictionary giving the target units for each parameter.\n\n        \"\"\"\n        model = self.copy()\n\n        inputs_unit = {inp: getattr(kwargs[inp], 'unit', dimensionless_unscaled)\n                       for inp in self.inputs if kwargs[inp] is not None}\n\n        outputs_unit = {out: getattr(kwargs[out], 'unit', dimensionless_unscaled)\n                        for out in self.outputs if kwargs[out] is not None}\n        parameter_units = self._parameter_units_for_data_units(inputs_unit,\n                                                               outputs_unit)\n        for name, unit in parameter_units.items():\n            parameter = getattr(model, name)\n            if parameter.unit is not None:\n                parameter.value = parameter.quantity.to(unit).value\n                parameter._set_unit(None, force=True)\n\n        if isinstance(model, CompoundModel):\n            model.strip_units_from_tree()\n\n        return model"},{"col":4,"comment":"\n        Return a copy of this model.\n\n        Uses a deep copy so that all model attributes, including parameter\n        values, are copied as well.\n        ","endLoc":2196,"header":"def copy(self)","id":3931,"name":"copy","nodeType":"Function","startLoc":2188,"text":"def copy(self):\n        \"\"\"\n        Return a copy of this model.\n\n        Uses a deep copy so that all model attributes, including parameter\n        values, are copied as well.\n        \"\"\"\n\n        return copy.deepcopy(self)"},{"attributeType":"null","col":8,"comment":"null","endLoc":193,"id":3932,"name":"_ignored","nodeType":"Attribute","startLoc":193,"text":"self._ignored"},{"col":4,"comment":"\n        Create a spline that is an antiderivative of this one\n\n        Parameters\n        ----------\n        nu : int, optional\n            Antiderivative order, default is 1.\n\n        Notes\n        -----\n        Assumes constant of integration is 0\n        ","endLoc":538,"header":"def antiderivative(self, nu=1)","id":3933,"name":"antiderivative","nodeType":"Function","startLoc":516,"text":"def antiderivative(self, nu=1):\n        \"\"\"\n        Create a spline that is an antiderivative of this one\n\n        Parameters\n        ----------\n        nu : int, optional\n            Antiderivative order, default is 1.\n\n        Notes\n        -----\n        Assumes constant of integration is 0\n        \"\"\"\n        if (nu + self.degree) <= 5:\n            bspline = self.bspline.antiderivative(nu=nu)\n\n            antiderivative = Spline1D(degree=bspline.k)\n            antiderivative.bspline = bspline\n\n            return antiderivative\n        else:\n            raise ValueError(\"Supported splines can have max degree 5, \"\n                             f\"antiderivative degree will be {nu + self.degree}\")"},{"col":4,"comment":"\n        Return a dictionary of output units for this model given a dictionary\n        of fitting inputs and outputs\n\n        The input and output Quantity objects should be given as keyword\n        arguments.\n\n        Notes\n        -----\n\n        This method is needed in order to be able to fit models with units in\n        the parameters, since we need to temporarily strip away the units from\n        the model during the fitting (which might be done by e.g. scipy\n        functions).\n\n        This method will force extra model evaluations, which maybe computationally\n        expensive. To avoid this, one can add a return_units property to the model,\n        see :ref:`astropy:models_return_units`.\n        ","endLoc":1620,"header":"def output_units(self, **kwargs)","id":3934,"name":"output_units","nodeType":"Function","startLoc":1588,"text":"def output_units(self, **kwargs):\n        \"\"\"\n        Return a dictionary of output units for this model given a dictionary\n        of fitting inputs and outputs\n\n        The input and output Quantity objects should be given as keyword\n        arguments.\n\n        Notes\n        -----\n\n        This method is needed in order to be able to fit models with units in\n        the parameters, since we need to temporarily strip away the units from\n        the model during the fitting (which might be done by e.g. scipy\n        functions).\n\n        This method will force extra model evaluations, which maybe computationally\n        expensive. To avoid this, one can add a return_units property to the model,\n        see :ref:`astropy:models_return_units`.\n        \"\"\"\n        units = self.return_units\n\n        if units is None or units == {}:\n            inputs = {inp: kwargs[inp] for inp in self.inputs}\n\n            values = self(**inputs)\n            if self.n_outputs == 1:\n                values = (values,)\n\n            units = {out: getattr(values[index], 'unit', dimensionless_unscaled)\n                     for index, out in enumerate(self.outputs)}\n\n        return units"},{"attributeType":"null","col":8,"comment":"null","endLoc":194,"id":3935,"name":"_order","nodeType":"Attribute","startLoc":194,"text":"self._order"},{"col":4,"comment":"null","endLoc":358,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3936,"name":"to_tree_transform","nodeType":"Function","startLoc":353,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'fwhm': _parameter_to_value(model.fwhm)}\n        return node"},{"col":4,"comment":"null","endLoc":1506,"header":"def _fix_input_bbox_arg(self, argument, value)","id":3937,"name":"_fix_input_bbox_arg","nodeType":"Function","startLoc":1499,"text":"def _fix_input_bbox_arg(self, argument, value):\n        bounding_boxes = {}\n        for selector_key, bbox in self._bounding_boxes.items():\n            bounding_boxes[selector_key] = bbox.fix_inputs(self._model, {argument: value},\n                                                        _keep_ignored=True)\n\n        return CompoundBoundingBox(bounding_boxes, self._model,\n                                   self.selector_args.add_ignore(self._model, argument))"},{"attributeType":"null","col":4,"comment":"null","endLoc":274,"id":3938,"name":"n_inputs","nodeType":"Attribute","startLoc":274,"text":"n_inputs"},{"col":4,"comment":"null","endLoc":368,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3939,"name":"assert_equal","nodeType":"Function","startLoc":360,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Lorentz1D) and\n                isinstance(b, functional_models.Lorentz1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.fwhm, b.fwhm)"},{"attributeType":"null","col":8,"comment":"null","endLoc":192,"id":3940,"name":"_model","nodeType":"Attribute","startLoc":192,"text":"self._model"},{"col":4,"comment":"null","endLoc":598,"header":"def copy(self, ignored=None)","id":3941,"name":"copy","nodeType":"Function","startLoc":589,"text":"def copy(self, ignored=None):\n        intervals = {index: interval.copy()\n                     for index, interval in self._intervals.items()}\n\n        if ignored is None:\n            ignored = self._ignored.copy()\n\n        return ModelBoundingBox(intervals, self._model,\n                                ignored=ignored,\n                                order=self._order)"},{"attributeType":"null","col":4,"comment":"null","endLoc":275,"id":3942,"name":"n_outputs","nodeType":"Attribute","startLoc":275,"text":"n_outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":276,"id":3943,"name":"_separable","nodeType":"Attribute","startLoc":276,"text":"_separable"},{"attributeType":"null","col":4,"comment":"null","endLoc":278,"id":3944,"name":"optional_inputs","nodeType":"Attribute","startLoc":278,"text":"optional_inputs"},{"col":4,"comment":"null","endLoc":1626,"header":"def strip_units_from_tree(self)","id":3945,"name":"strip_units_from_tree","nodeType":"Function","startLoc":1622,"text":"def strip_units_from_tree(self):\n        for item in self._leaflist:\n            for parname in item.param_names:\n                par = getattr(item, parname)\n                par._set_unit(None, force=True)"},{"attributeType":"null","col":8,"comment":"null","endLoc":417,"id":3946,"name":"_coeff_names","nodeType":"Attribute","startLoc":417,"text":"self._coeff_names"},{"attributeType":"null","col":12,"comment":"null","endLoc":363,"id":3947,"name":"c","nodeType":"Attribute","startLoc":363,"text":"self.c"},{"attributeType":"null","col":12,"comment":"null","endLoc":332,"id":3948,"name":"_c","nodeType":"Attribute","startLoc":332,"text":"self._c"},{"attributeType":"null","col":4,"comment":"null","endLoc":343,"id":3949,"name":"name","nodeType":"Attribute","startLoc":343,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":344,"id":3950,"name":"version","nodeType":"Attribute","startLoc":344,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":345,"id":3951,"name":"types","nodeType":"Attribute","startLoc":345,"text":"types"},{"className":"Moffat1DType","col":0,"comment":"null","endLoc":400,"id":3952,"nodeType":"Class","startLoc":371,"text":"class Moffat1DType(TransformType):\n    name = 'transform/moffat1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Moffat1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Moffat1D(amplitude=node['amplitude'],\n                                          x_0=node['x_0'],\n                                          gamma=node['gamma'],\n                                          alpha=node['alpha'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'gamma': _parameter_to_value(model.gamma),\n                'alpha': _parameter_to_value(model.alpha)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Moffat1D) and\n                isinstance(b, functional_models.Moffat1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.gamma, b.gamma)\n        assert_array_equal(a.alpha, b.alpha)"},{"col":4,"comment":"null","endLoc":381,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3953,"name":"from_tree_transform","nodeType":"Function","startLoc":376,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Moffat1D(amplitude=node['amplitude'],\n                                          x_0=node['x_0'],\n                                          gamma=node['gamma'],\n                                          alpha=node['alpha'])"},{"col":4,"comment":"\n        Return an instance of the model which has units for which the parameter\n        values are compatible with the data units specified.\n\n        The input and output Quantity objects should be given as keyword\n        arguments.\n\n        Notes\n        -----\n\n        This method is needed in order to be able to fit models with units in\n        the parameters, since we need to temporarily strip away the units from\n        the model during the fitting (which might be done by e.g. scipy\n        functions).\n\n        The units that the parameters will gain are not necessarily the units\n        of the input data, but are derived from them. Model subclasses that\n        want fitting to work in the presence of quantities need to define a\n        ``_parameter_units_for_data_units`` method that takes the input and output\n        units (as two dictionaries) and returns a dictionary giving the target\n        units for each parameter.\n        ","endLoc":1668,"header":"def with_units_from_data(self, **kwargs)","id":3954,"name":"with_units_from_data","nodeType":"Function","startLoc":1628,"text":"def with_units_from_data(self, **kwargs):\n        \"\"\"\n        Return an instance of the model which has units for which the parameter\n        values are compatible with the data units specified.\n\n        The input and output Quantity objects should be given as keyword\n        arguments.\n\n        Notes\n        -----\n\n        This method is needed in order to be able to fit models with units in\n        the parameters, since we need to temporarily strip away the units from\n        the model during the fitting (which might be done by e.g. scipy\n        functions).\n\n        The units that the parameters will gain are not necessarily the units\n        of the input data, but are derived from them. Model subclasses that\n        want fitting to work in the presence of quantities need to define a\n        ``_parameter_units_for_data_units`` method that takes the input and output\n        units (as two dictionaries) and returns a dictionary giving the target\n        units for each parameter.\n        \"\"\"\n        model = self.copy()\n        inputs_unit = {inp: getattr(kwargs[inp], 'unit', dimensionless_unscaled)\n                       for inp in self.inputs if kwargs[inp] is not None}\n\n        outputs_unit = {out: getattr(kwargs[out], 'unit', dimensionless_unscaled)\n                        for out in self.outputs if kwargs[out] is not None}\n\n        parameter_units = self._parameter_units_for_data_units(inputs_unit,\n                                                               outputs_unit)\n\n        # We are adding units to parameters that already have a value, but we\n        # don't want to convert the parameter, just add the unit directly,\n        # hence the call to ``_set_unit``.\n        for name, unit in parameter_units.items():\n            parameter = getattr(model, name)\n            parameter._set_unit(unit, force=True)\n\n        return model"},{"attributeType":"null","col":12,"comment":"null","endLoc":362,"id":3955,"name":"t","nodeType":"Attribute","startLoc":362,"text":"self.t"},{"attributeType":"null","col":12,"comment":"null","endLoc":434,"id":3956,"name":"bounding_box","nodeType":"Attribute","startLoc":434,"text":"self.bounding_box"},{"attributeType":"null","col":12,"comment":"null","endLoc":304,"id":3957,"name":"_t","nodeType":"Attribute","startLoc":304,"text":"self._t"},{"col":4,"comment":"\n        Fix the bounding_box for a `fix_inputs` compound model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The new model for which this will be a bounding_box\n        fixed_inputs : dict\n            Dictionary of inputs which have been fixed by this bounding box.\n        ","endLoc":1543,"header":"def fix_inputs(self, model, fixed_inputs: dict)","id":3958,"name":"fix_inputs","nodeType":"Function","startLoc":1508,"text":"def fix_inputs(self, model, fixed_inputs: dict):\n        \"\"\"\n        Fix the bounding_box for a `fix_inputs` compound model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The new model for which this will be a bounding_box\n        fixed_inputs : dict\n            Dictionary of inputs which have been fixed by this bounding box.\n        \"\"\"\n\n        fixed_input_keys = list(fixed_inputs.keys())\n        argument = fixed_input_keys.pop()\n        value = fixed_inputs[argument]\n\n        if self.selector_args.is_argument(self._model, argument):\n            bbox = self._fix_input_selector_arg(argument, value)\n        else:\n            bbox = self._fix_input_bbox_arg(argument, value)\n\n        if len(fixed_input_keys) > 0:\n            new_fixed_inputs = fixed_inputs.copy()\n            del new_fixed_inputs[argument]\n\n            bbox = bbox.fix_inputs(model, new_fixed_inputs)\n\n        if isinstance(bbox, CompoundBoundingBox):\n            selector_args = bbox.named_selector_tuple\n            bbox_dict = bbox\n        elif isinstance(bbox, ModelBoundingBox):\n            selector_args = None\n            bbox_dict = bbox.named_intervals\n\n        return bbox.__class__.validate(model, bbox_dict,\n                                       order=bbox.order, selector_args=selector_args)"},{"col":4,"comment":"null","endLoc":1677,"header":"@property\n    def _has_units(self)","id":3959,"name":"_has_units","nodeType":"Function","startLoc":1670,"text":"@property\n    def _has_units(self):\n        # Returns True if any of the parameters have units\n        for param in self.param_names:\n            if getattr(self, param).unit is not None:\n                return True\n        else:\n            return False"},{"col":4,"comment":"null","endLoc":1684,"header":"@property\n    def _supports_unit_fitting(self)","id":3960,"name":"_supports_unit_fitting","nodeType":"Function","startLoc":1679,"text":"@property\n    def _supports_unit_fitting(self):\n        # If the model has a ``_parameter_units_for_data_units`` method, this\n        # indicates that we have enough information to strip the units away\n        # and add them back after fitting, when fitting quantities\n        return hasattr(self, '_parameter_units_for_data_units')"},{"col":4,"comment":"\n        Evaluate the sum of any implicit model terms on some input variables.\n        This includes any fixed terms used in evaluating a linear model that\n        do not have corresponding parameters exposed to the user. The\n        prototypical case is `astropy.modeling.functional_models.Shift`, which\n        corresponds to a function y = a + bx, where b=1 is intrinsically fixed\n        by the type of model, such that sum_of_implicit_terms(x) == x. This\n        method is needed by linear fitters to correct the dependent variable\n        for the implicit term(s) when solving for the remaining terms\n        (ie. a = y - bx).\n        ","endLoc":1701,"header":"def sum_of_implicit_terms(self, *args, **kwargs)","id":3961,"name":"sum_of_implicit_terms","nodeType":"Function","startLoc":1690,"text":"def sum_of_implicit_terms(self, *args, **kwargs):\n        \"\"\"\n        Evaluate the sum of any implicit model terms on some input variables.\n        This includes any fixed terms used in evaluating a linear model that\n        do not have corresponding parameters exposed to the user. The\n        prototypical case is `astropy.modeling.functional_models.Shift`, which\n        corresponds to a function y = a + bx, where b=1 is intrinsically fixed\n        by the type of model, such that sum_of_implicit_terms(x) == x. This\n        method is needed by linear fitters to correct the dependent variable\n        for the implicit term(s) when solving for the remaining terms\n        (ie. a = y - bx).\n        \"\"\""},{"col":4,"comment":"\n        Evaluate a model at fixed positions, respecting the ``bounding_box``.\n\n        The key difference relative to evaluating the model directly is that\n        this method is limited to a bounding box if the `Model.bounding_box`\n        attribute is set.\n\n        Parameters\n        ----------\n        out : `numpy.ndarray`, optional\n            An array that the evaluated model will be added to.  If this is not\n            given (or given as ``None``), a new array will be created.\n        coords : array-like, optional\n            An array to be used to translate from the model's input coordinates\n            to the ``out`` array. It should have the property that\n            ``self(coords)`` yields the same shape as ``out``.  If ``out`` is\n            not specified, ``coords`` will be used to determine the shape of\n            the returned array. If this is not provided (or None), the model\n            will be evaluated on a grid determined by `Model.bounding_box`.\n\n        Returns\n        -------\n        out : `numpy.ndarray`\n            The model added to ``out`` if  ``out`` is not ``None``, or else a\n            new array from evaluating the model over ``coords``.\n            If ``out`` and ``coords`` are both `None`, the returned array is\n            limited to the `Model.bounding_box` limits. If\n            `Model.bounding_box` is `None`, ``arr`` or ``coords`` must be\n            passed.\n\n        Raises\n        ------\n        ValueError\n            If ``coords`` are not given and the the `Model.bounding_box` of\n            this model is not set.\n\n        Examples\n        --------\n        :ref:`astropy:bounding-boxes`\n        ","endLoc":1819,"header":"def render(self, out=None, coords=None)","id":3962,"name":"render","nodeType":"Function","startLoc":1703,"text":"def render(self, out=None, coords=None):\n        \"\"\"\n        Evaluate a model at fixed positions, respecting the ``bounding_box``.\n\n        The key difference relative to evaluating the model directly is that\n        this method is limited to a bounding box if the `Model.bounding_box`\n        attribute is set.\n\n        Parameters\n        ----------\n        out : `numpy.ndarray`, optional\n            An array that the evaluated model will be added to.  If this is not\n            given (or given as ``None``), a new array will be created.\n        coords : array-like, optional\n            An array to be used to translate from the model's input coordinates\n            to the ``out`` array. It should have the property that\n            ``self(coords)`` yields the same shape as ``out``.  If ``out`` is\n            not specified, ``coords`` will be used to determine the shape of\n            the returned array. If this is not provided (or None), the model\n            will be evaluated on a grid determined by `Model.bounding_box`.\n\n        Returns\n        -------\n        out : `numpy.ndarray`\n            The model added to ``out`` if  ``out`` is not ``None``, or else a\n            new array from evaluating the model over ``coords``.\n            If ``out`` and ``coords`` are both `None`, the returned array is\n            limited to the `Model.bounding_box` limits. If\n            `Model.bounding_box` is `None`, ``arr`` or ``coords`` must be\n            passed.\n\n        Raises\n        ------\n        ValueError\n            If ``coords`` are not given and the the `Model.bounding_box` of\n            this model is not set.\n\n        Examples\n        --------\n        :ref:`astropy:bounding-boxes`\n        \"\"\"\n\n        try:\n            bbox = self.bounding_box\n        except NotImplementedError:\n            bbox = None\n\n        if isinstance(bbox, ModelBoundingBox):\n            bbox = bbox.bounding_box()\n\n        ndim = self.n_inputs\n\n        if (coords is None) and (out is None) and (bbox is None):\n            raise ValueError('If no bounding_box is set, '\n                             'coords or out must be input.')\n\n        # for consistent indexing\n        if ndim == 1:\n            if coords is not None:\n                coords = [coords]\n            if bbox is not None:\n                bbox = [bbox]\n\n        if coords is not None:\n            coords = np.asanyarray(coords, dtype=float)\n            # Check dimensions match out and model\n            assert len(coords) == ndim\n            if out is not None:\n                if coords[0].shape != out.shape:\n                    raise ValueError('inconsistent shape of the output.')\n            else:\n                out = np.zeros(coords[0].shape)\n\n        if out is not None:\n            out = np.asanyarray(out)\n            if out.ndim != ndim:\n                raise ValueError('the array and model must have the same '\n                                 'number of dimensions.')\n\n        if bbox is not None:\n            # Assures position is at center pixel,\n            # important when using add_array.\n            pd = np.array([(np.mean(bb), np.ceil((bb[1] - bb[0]) / 2))\n                           for bb in bbox]).astype(int).T\n            pos, delta = pd\n\n            if coords is not None:\n                sub_shape = tuple(delta * 2 + 1)\n                sub_coords = np.array([extract_array(c, sub_shape, pos)\n                                       for c in coords])\n            else:\n                limits = [slice(p - d, p + d + 1, 1) for p, d in pd.T]\n                sub_coords = np.mgrid[limits]\n\n            sub_coords = sub_coords[::-1]\n\n            if out is None:\n                out = self(*sub_coords)\n            else:\n                try:\n                    out = add_array(out, self(*sub_coords), pos)\n                except ValueError:\n                    raise ValueError(\n                        'The `bounding_box` is larger than the input out in '\n                        'one or more dimensions. Set '\n                        '`model.bounding_box = None`.')\n        else:\n            if coords is None:\n                im_shape = out.shape\n                limits = [slice(i) for i in im_shape]\n                coords = np.mgrid[limits]\n\n            coords = coords[::-1]\n\n            out += self(*coords)\n\n        return out"},{"attributeType":"null","col":8,"comment":"null","endLoc":416,"id":3963,"name":"_knot_names","nodeType":"Attribute","startLoc":416,"text":"self._knot_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":405,"id":3964,"name":"_user_knots","nodeType":"Attribute","startLoc":405,"text":"self._user_knots"},{"col":4,"comment":"Return bounding_box labeled using input positions","endLoc":603,"header":"@property\n    def intervals(self) -> Dict[int, _Interval]","id":3965,"name":"intervals","nodeType":"Function","startLoc":600,"text":"@property\n    def intervals(self) -> Dict[int, _Interval]:\n        \"\"\"Return bounding_box labeled using input positions\"\"\"\n        return self._intervals"},{"col":4,"comment":"Return bounding_box labeled using input names","endLoc":608,"header":"@property\n    def named_intervals(self) -> Dict[str, _Interval]","id":3966,"name":"named_intervals","nodeType":"Function","startLoc":605,"text":"@property\n    def named_intervals(self) -> Dict[str, _Interval]:\n        \"\"\"Return bounding_box labeled using input names\"\"\"\n        return {self._get_name(index): bbox for index, bbox in self._intervals.items()}"},{"col":4,"comment":"null","endLoc":627,"header":"def __repr__(self)","id":3967,"name":"__repr__","nodeType":"Function","startLoc":610,"text":"def __repr__(self):\n        parts = [\n            'ModelBoundingBox(',\n            '    intervals={'\n        ]\n\n        for name, interval in self.named_intervals.items():\n            parts.append(f\"        {name}: {interval}\")\n\n        parts.append('    }')\n        if len(self._ignored) > 0:\n            parts.append(f\"    ignored={self.ignored_inputs}\")\n\n        parts.append(f'    model={self._model.__class__.__name__}(inputs={self._model.inputs})')\n        parts.append(f\"    order='{self._order}'\")\n        parts.append(')')\n\n        return '\\n'.join(parts)"},{"attributeType":"None","col":8,"comment":"null","endLoc":1299,"id":3968,"name":"_create_selector","nodeType":"Attribute","startLoc":1299,"text":"self._create_selector"},{"attributeType":"null","col":8,"comment":"null","endLoc":1300,"id":3969,"name":"_selector_args","nodeType":"Attribute","startLoc":1300,"text":"self._selector_args"},{"attributeType":"null","col":8,"comment":"null","endLoc":1302,"id":3970,"name":"_bounding_boxes","nodeType":"Attribute","startLoc":1302,"text":"self._bounding_boxes"},{"className":"CompoundModel","col":0,"comment":"\n    Base class for compound models.\n\n    While it can be used directly, the recommended way\n    to combine models is through the model operators.\n    ","endLoc":4001,"id":3971,"nodeType":"Class","startLoc":2894,"text":"class CompoundModel(Model):\n    '''\n    Base class for compound models.\n\n    While it can be used directly, the recommended way\n    to combine models is through the model operators.\n    '''\n\n    def __init__(self, op, left, right, name=None):\n        self.__dict__['_param_names'] = None\n        self._n_submodels = None\n        self.op = op\n        self.left = left\n        self.right = right\n        self._bounding_box = None\n        self._user_bounding_box = None\n        self._leaflist = None\n        self._tdict = None\n        self._parameters = None\n        self._parameters_ = None\n        self._param_metrics = None\n\n        if op != 'fix_inputs' and len(left) != len(right):\n            raise ValueError(\n                'Both operands must have equal values for n_models')\n        self._n_models = len(left)\n\n        if op != 'fix_inputs' and ((left.model_set_axis != right.model_set_axis)\n                                   or left.model_set_axis):  # not False and not 0\n            raise ValueError(\"model_set_axis must be False or 0 and consistent for operands\")\n        self._model_set_axis = left.model_set_axis\n\n        if op in ['+', '-', '*', '/', '**'] or op in SPECIAL_OPERATORS:\n            if (left.n_inputs != right.n_inputs) or \\\n               (left.n_outputs != right.n_outputs):\n                raise ModelDefinitionError(\n                    'Both operands must match numbers of inputs and outputs')\n            self.n_inputs = left.n_inputs\n            self.n_outputs = left.n_outputs\n            self.inputs = left.inputs\n            self.outputs = left.outputs\n        elif op == '&':\n            self.n_inputs = left.n_inputs + right.n_inputs\n            self.n_outputs = left.n_outputs + right.n_outputs\n            self.inputs = combine_labels(left.inputs, right.inputs)\n            self.outputs = combine_labels(left.outputs, right.outputs)\n        elif op == '|':\n            if left.n_outputs != right.n_inputs:\n                raise ModelDefinitionError(\n                    \"Unsupported operands for |: {0} (n_inputs={1}, \"\n                    \"n_outputs={2}) and {3} (n_inputs={4}, n_outputs={5}); \"\n                    \"n_outputs for the left-hand model must match n_inputs \"\n                    \"for the right-hand model.\".format(\n                        left.name, left.n_inputs, left.n_outputs, right.name,\n                        right.n_inputs, right.n_outputs))\n\n            self.n_inputs = left.n_inputs\n            self.n_outputs = right.n_outputs\n            self.inputs = left.inputs\n            self.outputs = right.outputs\n        elif op == 'fix_inputs':\n            if not isinstance(left, Model):\n                raise ValueError('First argument to \"fix_inputs\" must be an instance of an astropy Model.')\n            if not isinstance(right, dict):\n                raise ValueError('Expected a dictionary for second argument of \"fix_inputs\".')\n\n            # Dict keys must match either possible indices\n            # for model on left side, or names for inputs.\n            self.n_inputs = left.n_inputs - len(right)\n            # Assign directly to the private attribute (instead of using the setter)\n            # to avoid asserting the new number of outputs matches the old one.\n            self._outputs = left.outputs\n            self.n_outputs = left.n_outputs\n            newinputs = list(left.inputs)\n            keys = right.keys()\n            input_ind = []\n            for key in keys:\n                if np.issubdtype(type(key), np.integer):\n                    if key >= left.n_inputs or key < 0:\n                        raise ValueError(\n                            'Substitution key integer value '\n                            'not among possible input choices.')\n                    if key in input_ind:\n                        raise ValueError(\"Duplicate specification of \"\n                                         \"same input (index/name).\")\n                    input_ind.append(key)\n                elif isinstance(key, str):\n                    if key not in left.inputs:\n                        raise ValueError(\n                            'Substitution key string not among possible '\n                            'input choices.')\n                    # Check to see it doesn't match positional\n                    # specification.\n                    ind = left.inputs.index(key)\n                    if ind in input_ind:\n                        raise ValueError(\"Duplicate specification of \"\n                                         \"same input (index/name).\")\n                    input_ind.append(ind)\n            # Remove substituted inputs\n            input_ind.sort()\n            input_ind.reverse()\n            for ind in input_ind:\n                del newinputs[ind]\n            self.inputs = tuple(newinputs)\n            # Now check to see if the input model has bounding_box defined.\n            # If so, remove the appropriate dimensions and set it for this\n            # instance.\n            try:\n                self.bounding_box = \\\n                    self.left.bounding_box.fix_inputs(self, right)\n            except NotImplementedError:\n                pass\n\n        else:\n            raise ModelDefinitionError('Illegal operator: ', self.op)\n        self.name = name\n        self._fittable = None\n        self.fit_deriv = None\n        self.col_fit_deriv = None\n        if op in ('|', '+', '-'):\n            self.linear = left.linear and right.linear\n        else:\n            self.linear = False\n        self.eqcons = []\n        self.ineqcons = []\n        self.n_left_params = len(self.left.parameters)\n        self._map_parameters()\n\n    def _get_left_inputs_from_args(self, args):\n        return args[:self.left.n_inputs]\n\n    def _get_right_inputs_from_args(self, args):\n        op = self.op\n        if op == '&':\n            # Args expected to look like (*left inputs, *right inputs, *left params, *right params)\n            return args[self.left.n_inputs: self.left.n_inputs + self.right.n_inputs]\n        elif op == '|' or  op == 'fix_inputs':\n            return None\n        else:\n            return args[:self.left.n_inputs]\n\n    def _get_left_params_from_args(self, args):\n        op = self.op\n        if op == '&':\n            # Args expected to look like (*left inputs, *right inputs, *left params, *right params)\n            n_inputs = self.left.n_inputs + self.right.n_inputs\n            return args[n_inputs: n_inputs + self.n_left_params]\n        else:\n            return args[self.left.n_inputs: self.left.n_inputs + self.n_left_params]\n\n    def _get_right_params_from_args(self, args):\n        op = self.op\n        if op == 'fix_inputs':\n            return None\n        if op == '&':\n            # Args expected to look like (*left inputs, *right inputs, *left params, *right params)\n            return args[self.left.n_inputs + self.right.n_inputs + self.n_left_params:]\n        else:\n            return args[self.left.n_inputs + self.n_left_params:]\n\n    def _get_kwarg_model_parameters_as_positional(self, args, kwargs):\n        # could do it with inserts but rebuilding seems like simpilist way\n\n        #TODO: Check if any param names are in kwargs maybe as an intersection of sets?\n        if self.op == \"&\":\n            new_args = list(args[:self.left.n_inputs + self.right.n_inputs])\n            args_pos = self.left.n_inputs + self.right.n_inputs\n        else:\n            new_args = list(args[:self.left.n_inputs])\n            args_pos = self.left.n_inputs\n\n        for param_name in self.param_names:\n            kw_value = kwargs.pop(param_name, None)\n            if kw_value is not None:\n                value = kw_value\n            else:\n                try:\n                    value = args[args_pos]\n                except IndexError:\n                    raise IndexError(\"Missing parameter or input\")\n\n                args_pos += 1\n            new_args.append(value)\n\n        return new_args, kwargs\n\n    def _apply_operators_to_value_lists(self, leftval, rightval, **kw):\n        op = self.op\n        if op == '+':\n            return binary_operation(operator.add, leftval, rightval)\n        elif op == '-':\n            return binary_operation(operator.sub, leftval, rightval)\n        elif op == '*':\n            return binary_operation(operator.mul, leftval, rightval)\n        elif op == '/':\n            return binary_operation(operator.truediv, leftval, rightval)\n        elif op == '**':\n            return binary_operation(operator.pow, leftval, rightval)\n        elif op == '&':\n            if not isinstance(leftval, tuple):\n                leftval = (leftval,)\n            if not isinstance(rightval, tuple):\n                rightval = (rightval,)\n            return leftval + rightval\n        elif op in SPECIAL_OPERATORS:\n            return binary_operation(SPECIAL_OPERATORS[op], leftval, rightval)\n        else:\n            raise ModelDefinitionError('Unrecognized operator {op}')\n\n    def evaluate(self, *args, **kw):\n        op = self.op\n        args, kw = self._get_kwarg_model_parameters_as_positional(args, kw)\n        left_inputs = self._get_left_inputs_from_args(args)\n        left_params = self._get_left_params_from_args(args)\n\n        if op == 'fix_inputs':\n            pos_index = dict(zip(self.left.inputs, range(self.left.n_inputs)))\n            fixed_inputs = {\n                key if np.issubdtype(type(key), np.integer) else pos_index[key]: value\n                for key, value in self.right.items()\n            }\n            left_inputs = [\n                fixed_inputs[ind] if ind in fixed_inputs.keys() else inp\n                for ind, inp in enumerate(left_inputs)\n            ]\n\n        leftval = self.left.evaluate(*itertools.chain(left_inputs, left_params))\n\n        if op == 'fix_inputs':\n            return leftval\n\n        right_inputs = self._get_right_inputs_from_args(args)\n        right_params = self._get_right_params_from_args(args)\n\n        if op == \"|\":\n            if isinstance(leftval, tuple):\n                return self.right.evaluate(*itertools.chain(leftval, right_params))\n            else:\n                return self.right.evaluate(leftval, *right_params)\n        else:\n            rightval = self.right.evaluate(*itertools.chain(right_inputs, right_params))\n\n        return self._apply_operators_to_value_lists(leftval, rightval, **kw)\n\n    @property\n    def n_submodels(self):\n        if self._leaflist is None:\n            self._make_leaflist()\n        return len(self._leaflist)\n\n    @property\n    def submodel_names(self):\n        \"\"\" Return the names of submodels in a ``CompoundModel``.\"\"\"\n        if self._leaflist is None:\n            self._make_leaflist()\n        names = [item.name for item in self._leaflist]\n        nonecount = 0\n        newnames = []\n        for item in names:\n            if item is None:\n                newnames.append(f'None_{nonecount}')\n                nonecount += 1\n            else:\n                newnames.append(item)\n        return tuple(newnames)\n\n    def both_inverses_exist(self):\n        '''\n        if both members of this compound model have inverses return True\n        '''\n        warnings.warn(\n            \"CompoundModel.both_inverses_exist is deprecated. \"\n            \"Use has_inverse instead.\",\n            AstropyDeprecationWarning\n        )\n\n        try:\n            linv = self.left.inverse\n            rinv = self.right.inverse\n        except NotImplementedError:\n            return False\n\n        return True\n\n    def _pre_evaluate(self, *args, **kwargs):\n        \"\"\"\n        CompoundModel specific input setup that needs to occur prior to\n            model evaluation.\n\n        Note\n        ----\n            All of the _pre_evaluate for each component model will be\n            performed at the time that the individual model is evaluated.\n        \"\"\"\n\n        # If equivalencies are provided, necessary to map parameters and pass\n        # the leaflist as a keyword input for use by model evaluation so that\n        # the compound model input names can be matched to the model input\n        # names.\n        if 'equivalencies' in kwargs:\n            # Restructure to be useful for the individual model lookup\n            kwargs['inputs_map'] = [(value[0], (value[1], key)) for\n                                    key, value in self.inputs_map().items()]\n\n        # Setup actual model evaluation method\n        def evaluate(_inputs):\n            return self._evaluate(*_inputs, **kwargs)\n\n        return evaluate, args, None, kwargs\n\n    @property\n    def _argnames(self):\n        \"\"\"No inputs should be used to determine input_shape when handling compound models\"\"\"\n        return ()\n\n    def _post_evaluate(self, inputs, outputs, broadcasted_shapes, with_bbox, **kwargs):\n        \"\"\"\n        CompoundModel specific post evaluation processing of outputs\n\n        Note\n        ----\n            All of the _post_evaluate for each component model will be\n            performed at the time that the individual model is evaluated.\n        \"\"\"\n        if self.get_bounding_box(with_bbox) is not None and self.n_outputs == 1:\n            return outputs[0]\n        return outputs\n\n    def _evaluate(self, *args, **kw):\n        op = self.op\n        if op != 'fix_inputs':\n            if op != '&':\n                leftval = self.left(*args, **kw)\n                if op != '|':\n                    rightval = self.right(*args, **kw)\n                else:\n                    rightval = None\n\n            else:\n                leftval = self.left(*(args[:self.left.n_inputs]), **kw)\n                rightval = self.right(*(args[self.left.n_inputs:]), **kw)\n\n            if op != \"|\":\n                return self._apply_operators_to_value_lists(leftval, rightval, **kw)\n\n            elif op == '|':\n                if isinstance(leftval, tuple):\n                    return self.right(*leftval, **kw)\n                else:\n                    return self.right(leftval, **kw)\n\n        else:\n            subs = self.right\n            newargs = list(args)\n            subinds = []\n            subvals = []\n            for key in subs.keys():\n                if np.issubdtype(type(key), np.integer):\n                    subinds.append(key)\n                elif isinstance(key, str):\n                    ind = self.left.inputs.index(key)\n                    subinds.append(ind)\n                subvals.append(subs[key])\n            # Turn inputs specified in kw into positional indices.\n            # Names for compound inputs do not propagate to sub models.\n            kwind = []\n            kwval = []\n            for kwkey in list(kw.keys()):\n                if kwkey in self.inputs:\n                    ind = self.inputs.index(kwkey)\n                    if ind < len(args):\n                        raise ValueError(\"Keyword argument duplicates \"\n                                         \"positional value supplied.\")\n                    kwind.append(ind)\n                    kwval.append(kw[kwkey])\n                    del kw[kwkey]\n            # Build new argument list\n            # Append keyword specified args first\n            if kwind:\n                kwargs = list(zip(kwind, kwval))\n                kwargs.sort()\n                kwindsorted, kwvalsorted = list(zip(*kwargs))\n                newargs = newargs + list(kwvalsorted)\n            if subinds:\n                subargs = list(zip(subinds, subvals))\n                subargs.sort()\n                # subindsorted, subvalsorted = list(zip(*subargs))\n                # The substitutions must be inserted in order\n                for ind, val in subargs:\n                    newargs.insert(ind, val)\n            return self.left(*newargs, **kw)\n\n    @property\n    def param_names(self):\n        \"\"\" An ordered list of parameter names.\"\"\"\n        return self._param_names\n\n    def _make_leaflist(self):\n        tdict = {}\n        leaflist = []\n        make_subtree_dict(self, '', tdict, leaflist)\n        self._leaflist = leaflist\n        self._tdict = tdict\n\n    def __getattr__(self, name):\n        \"\"\"\n        If someone accesses an attribute not already defined, map the\n        parameters, and then see if the requested attribute is one of\n        the parameters\n        \"\"\"\n        # The following test is needed to avoid infinite recursion\n        # caused by deepcopy. There may be other such cases discovered.\n        if name == '__setstate__':\n            raise AttributeError\n        if name in self._param_names:\n            return self.__dict__[name]\n        else:\n            raise AttributeError(f'Attribute \"{name}\" not found')\n\n    def __getitem__(self, index):\n        if self._leaflist is None:\n            self._make_leaflist()\n        leaflist = self._leaflist\n        tdict = self._tdict\n        if isinstance(index, slice):\n            if index.step:\n                raise ValueError('Steps in slices not supported '\n                                 'for compound models')\n            if index.start is not None:\n                if isinstance(index.start, str):\n                    start = self._str_index_to_int(index.start)\n                else:\n                    start = index.start\n            else:\n                start = 0\n            if index.stop is not None:\n                if isinstance(index.stop, str):\n                    stop = self._str_index_to_int(index.stop)\n                else:\n                    stop = index.stop - 1\n            else:\n                stop = len(leaflist) - 1\n            if index.stop == 0:\n                raise ValueError(\"Slice endpoint cannot be 0\")\n            if start < 0:\n                start = len(leaflist) + start\n            if stop < 0:\n                stop = len(leaflist) + stop\n            # now search for matching node:\n            if stop == start:  # only single value, get leaf instead in code below\n                index = start\n            else:\n                for key in tdict:\n                    node, leftind, rightind = tdict[key]\n                    if leftind == start and rightind == stop:\n                        return node\n                raise IndexError(\"No appropriate subtree matches slice\")\n        if isinstance(index, type(0)):\n            return leaflist[index]\n        elif isinstance(index, type('')):\n            return leaflist[self._str_index_to_int(index)]\n        else:\n            raise TypeError('index must be integer, slice, or model name string')\n\n    def _str_index_to_int(self, str_index):\n        # Search through leaflist for item with that name\n        found = []\n        for nleaf, leaf in enumerate(self._leaflist):\n            if getattr(leaf, 'name', None) == str_index:\n                found.append(nleaf)\n        if len(found) == 0:\n            raise IndexError(f\"No component with name '{str_index}' found\")\n        if len(found) > 1:\n            raise IndexError(\"Multiple components found using '{}' as name\\n\"\n                             \"at indices {}\".format(str_index, found))\n        return found[0]\n\n    @property\n    def n_inputs(self):\n        \"\"\" The number of inputs of a model.\"\"\"\n        return self._n_inputs\n\n    @n_inputs.setter\n    def n_inputs(self, value):\n        self._n_inputs = value\n\n    @property\n    def n_outputs(self):\n        \"\"\" The number of outputs of a model.\"\"\"\n        return self._n_outputs\n\n    @n_outputs.setter\n    def n_outputs(self, value):\n        self._n_outputs = value\n\n    @property\n    def eqcons(self):\n        return self._eqcons\n\n    @eqcons.setter\n    def eqcons(self, value):\n        self._eqcons = value\n\n    @property\n    def ineqcons(self):\n        return self._eqcons\n\n    @ineqcons.setter\n    def ineqcons(self, value):\n        self._eqcons = value\n\n    def traverse_postorder(self, include_operator=False):\n        \"\"\" Postorder traversal of the CompoundModel tree.\"\"\"\n        res = []\n        if isinstance(self.left, CompoundModel):\n            res = res + self.left.traverse_postorder(include_operator)\n        else:\n            res = res + [self.left]\n        if isinstance(self.right, CompoundModel):\n            res = res + self.right.traverse_postorder(include_operator)\n        else:\n            res = res + [self.right]\n        if include_operator:\n            res.append(self.op)\n        else:\n            res.append(self)\n        return res\n\n    def _format_expression(self, format_leaf=None):\n        leaf_idx = 0\n        operands = deque()\n\n        if format_leaf is None:\n            format_leaf = lambda i, l: f'[{i}]'\n\n        for node in self.traverse_postorder():\n            if not isinstance(node, CompoundModel):\n                operands.append(format_leaf(leaf_idx, node))\n                leaf_idx += 1\n                continue\n\n            right = operands.pop()\n            left = operands.pop()\n            if node.op in OPERATOR_PRECEDENCE:\n                oper_order = OPERATOR_PRECEDENCE[node.op]\n\n                if isinstance(node, CompoundModel):\n                    if (isinstance(node.left, CompoundModel) and\n                            OPERATOR_PRECEDENCE[node.left.op] < oper_order):\n                        left = f'({left})'\n                    if (isinstance(node.right, CompoundModel) and\n                            OPERATOR_PRECEDENCE[node.right.op] < oper_order):\n                        right = f'({right})'\n\n                operands.append(' '.join((left, node.op, right)))\n            else:\n                left = f'(({left}),'\n                right = f'({right}))'\n                operands.append(' '.join((node.op[0], left, right)))\n\n        return ''.join(operands)\n\n    def _format_components(self):\n        if self._parameters_ is None:\n            self._map_parameters()\n        return '\\n\\n'.join('[{0}]: {1!r}'.format(idx, m)\n                           for idx, m in enumerate(self._leaflist))\n\n    def __str__(self):\n        expression = self._format_expression()\n        components = self._format_components()\n        keywords = [\n            ('Expression', expression),\n            ('Components', '\\n' + indent(components))\n        ]\n        return super()._format_str(keywords=keywords)\n\n    def rename(self, name):\n        self.name = name\n        return self\n\n    @property\n    def isleaf(self):\n        return False\n\n    @property\n    def inverse(self):\n        if self.op == '|':\n            return self.right.inverse | self.left.inverse\n        elif self.op == '&':\n            return self.left.inverse & self.right.inverse\n        else:\n            return NotImplemented\n\n    @property\n    def fittable(self):\n        \"\"\" Set the fittable attribute on a compound model.\"\"\"\n        if self._fittable is None:\n            if self._leaflist is None:\n                self._map_parameters()\n            self._fittable = all(m.fittable for m in self._leaflist)\n        return self._fittable\n\n    __add__ = _model_oper('+')\n    __sub__ = _model_oper('-')\n    __mul__ = _model_oper('*')\n    __truediv__ = _model_oper('/')\n    __pow__ = _model_oper('**')\n    __or__ = _model_oper('|')\n    __and__ = _model_oper('&')\n\n    def _map_parameters(self):\n        \"\"\"\n        Map all the constituent model parameters to the compound object,\n        renaming as necessary by appending a suffix number.\n\n        This can be an expensive operation, particularly for a complex\n        expression tree.\n\n        All the corresponding parameter attributes are created that one\n        expects for the Model class.\n\n        The parameter objects that the attributes point to are the same\n        objects as in the constiutent models. Changes made to parameter\n        values to either are seen by both.\n\n        Prior to calling this, none of the associated attributes will\n        exist. This method must be called to make the model usable by\n        fitting engines.\n\n        If oldnames=True, then parameters are named as in the original\n        implementation of compound models.\n        \"\"\"\n        if self._parameters is not None:\n            # do nothing\n            return\n        if self._leaflist is None:\n            self._make_leaflist()\n        self._parameters_ = {}\n        param_map = {}\n        self._param_names = []\n        for lindex, leaf in enumerate(self._leaflist):\n            if not isinstance(leaf, dict):\n                for param_name in leaf.param_names:\n                    param = getattr(leaf, param_name)\n                    new_param_name = f\"{param_name}_{lindex}\"\n                    self.__dict__[new_param_name] = param\n                    self._parameters_[new_param_name] = param\n                    self._param_names.append(new_param_name)\n                    param_map[new_param_name] = (lindex, param_name)\n        self._param_metrics = {}\n        self._param_map = param_map\n        self._param_map_inverse = dict((v, k) for k, v in param_map.items())\n        self._initialize_slices()\n        self._param_names = tuple(self._param_names)\n\n    def _initialize_slices(self):\n        param_metrics = self._param_metrics\n        total_size = 0\n\n        for name in self.param_names:\n            param = getattr(self, name)\n            value = param.value\n            param_size = np.size(value)\n            param_shape = np.shape(value)\n            param_slice = slice(total_size, total_size + param_size)\n            param_metrics[name] = {}\n            param_metrics[name]['slice'] = param_slice\n            param_metrics[name]['shape'] = param_shape\n            param_metrics[name]['size'] = param_size\n            total_size += param_size\n        self._parameters = np.empty(total_size, dtype=np.float64)\n\n    @staticmethod\n    def _recursive_lookup(branch, adict, key):\n        if isinstance(branch, CompoundModel):\n            return adict[key]\n        return branch, key\n\n    def inputs_map(self):\n        \"\"\"\n        Map the names of the inputs to this ExpressionTree to the inputs to the leaf models.\n        \"\"\"\n        inputs_map = {}\n        if not isinstance(self.op, str):  # If we don't have an operator the mapping is trivial\n            return {inp: (self, inp) for inp in self.inputs}\n\n        elif self.op == '|':\n            if isinstance(self.left, CompoundModel):\n                l_inputs_map = self.left.inputs_map()\n            for inp in self.inputs:\n                if isinstance(self.left, CompoundModel):\n                    inputs_map[inp] = l_inputs_map[inp]\n                else:\n                    inputs_map[inp] = self.left, inp\n        elif self.op == '&':\n            if isinstance(self.left, CompoundModel):\n                l_inputs_map = self.left.inputs_map()\n            if isinstance(self.right, CompoundModel):\n                r_inputs_map = self.right.inputs_map()\n            for i, inp in enumerate(self.inputs):\n                if i < len(self.left.inputs):  # Get from left\n                    if isinstance(self.left, CompoundModel):\n                        inputs_map[inp] = l_inputs_map[self.left.inputs[i]]\n                    else:\n                        inputs_map[inp] = self.left, self.left.inputs[i]\n                else:  # Get from right\n                    if isinstance(self.right, CompoundModel):\n                        inputs_map[inp] = r_inputs_map[self.right.inputs[i - len(self.left.inputs)]]\n                    else:\n                        inputs_map[inp] = self.right, self.right.inputs[i - len(self.left.inputs)]\n        elif self.op == 'fix_inputs':\n            fixed_ind = list(self.right.keys())\n            ind = [list(self.left.inputs).index(i) if isinstance(i, str) else i for i in fixed_ind]\n            inp_ind = list(range(self.left.n_inputs))\n            for i in ind:\n                inp_ind.remove(i)\n            for i in inp_ind:\n                inputs_map[self.left.inputs[i]] = self.left, self.left.inputs[i]\n        else:\n            if isinstance(self.left, CompoundModel):\n                l_inputs_map = self.left.inputs_map()\n            for inp in self.left.inputs:\n                if isinstance(self.left, CompoundModel):\n                    inputs_map[inp] = l_inputs_map[inp]\n                else:\n                    inputs_map[inp] = self.left, inp\n        return inputs_map\n\n    def _parameter_units_for_data_units(self, input_units, output_units):\n        if self._leaflist is None:\n            self._map_parameters()\n        units_for_data = {}\n        for imodel, model in enumerate(self._leaflist):\n            units_for_data_leaf = model._parameter_units_for_data_units(input_units, output_units)\n            for param_leaf in units_for_data_leaf:\n                param = self._param_map_inverse[(imodel, param_leaf)]\n                units_for_data[param] = units_for_data_leaf[param_leaf]\n        return units_for_data\n\n    @property\n    def input_units(self):\n        inputs_map = self.inputs_map()\n        input_units_dict = {key: inputs_map[key][0].input_units[orig_key]\n                            for key, (mod, orig_key) in inputs_map.items()\n                            if inputs_map[key][0].input_units is not None}\n        if input_units_dict:\n            return input_units_dict\n        return None\n\n    @property\n    def input_units_equivalencies(self):\n        inputs_map = self.inputs_map()\n        input_units_equivalencies_dict = {\n            key: inputs_map[key][0].input_units_equivalencies[orig_key]\n            for key, (mod, orig_key) in inputs_map.items()\n            if inputs_map[key][0].input_units_equivalencies is not None\n        }\n        if not input_units_equivalencies_dict:\n            return None\n\n        return input_units_equivalencies_dict\n\n    @property\n    def input_units_allow_dimensionless(self):\n        inputs_map = self.inputs_map()\n        return {key: inputs_map[key][0].input_units_allow_dimensionless[orig_key]\n                for key, (mod, orig_key) in inputs_map.items()}\n\n    @property\n    def input_units_strict(self):\n        inputs_map = self.inputs_map()\n        return {key: inputs_map[key][0].input_units_strict[orig_key]\n                for key, (mod, orig_key) in inputs_map.items()}\n\n    @property\n    def return_units(self):\n        outputs_map = self.outputs_map()\n        return {key: outputs_map[key][0].return_units[orig_key]\n                for key, (mod, orig_key) in outputs_map.items()\n                if outputs_map[key][0].return_units is not None}\n\n    def outputs_map(self):\n        \"\"\"\n        Map the names of the outputs to this ExpressionTree to the outputs to the leaf models.\n        \"\"\"\n        outputs_map = {}\n        if not isinstance(self.op, str):  # If we don't have an operator the mapping is trivial\n            return {out: (self, out) for out in self.outputs}\n\n        elif self.op == '|':\n            if isinstance(self.right, CompoundModel):\n                r_outputs_map = self.right.outputs_map()\n            for out in self.outputs:\n                if isinstance(self.right, CompoundModel):\n                    outputs_map[out] = r_outputs_map[out]\n                else:\n                    outputs_map[out] = self.right, out\n\n        elif self.op == '&':\n            if isinstance(self.left, CompoundModel):\n                l_outputs_map = self.left.outputs_map()\n            if isinstance(self.right, CompoundModel):\n                r_outputs_map = self.right.outputs_map()\n            for i, out in enumerate(self.outputs):\n                if i < len(self.left.outputs):  # Get from left\n                    if isinstance(self.left, CompoundModel):\n                        outputs_map[out] = l_outputs_map[self.left.outputs[i]]\n                    else:\n                        outputs_map[out] = self.left, self.left.outputs[i]\n                else:  # Get from right\n                    if isinstance(self.right, CompoundModel):\n                        outputs_map[out] = r_outputs_map[self.right.outputs[i - len(self.left.outputs)]]\n                    else:\n                        outputs_map[out] = self.right, self.right.outputs[i - len(self.left.outputs)]\n        elif self.op == 'fix_inputs':\n            return self.left.outputs_map()\n        else:\n            if isinstance(self.left, CompoundModel):\n                l_outputs_map = self.left.outputs_map()\n            for out in self.left.outputs:\n                if isinstance(self.left, CompoundModel):\n                    outputs_map[out] = l_outputs_map()[out]\n                else:\n                    outputs_map[out] = self.left, out\n        return outputs_map\n\n    @property\n    def has_user_bounding_box(self):\n        \"\"\"\n        A flag indicating whether or not a custom bounding_box has been\n        assigned to this model by a user, via assignment to\n        ``model.bounding_box``.\n        \"\"\"\n\n        return self._user_bounding_box is not None\n\n    def render(self, out=None, coords=None):\n        \"\"\"\n        Evaluate a model at fixed positions, respecting the ``bounding_box``.\n\n        The key difference relative to evaluating the model directly is that\n        this method is limited to a bounding box if the `Model.bounding_box`\n        attribute is set.\n\n        Parameters\n        ----------\n        out : `numpy.ndarray`, optional\n            An array that the evaluated model will be added to.  If this is not\n            given (or given as ``None``), a new array will be created.\n        coords : array-like, optional\n            An array to be used to translate from the model's input coordinates\n            to the ``out`` array. It should have the property that\n            ``self(coords)`` yields the same shape as ``out``.  If ``out`` is\n            not specified, ``coords`` will be used to determine the shape of\n            the returned array. If this is not provided (or None), the model\n            will be evaluated on a grid determined by `Model.bounding_box`.\n\n        Returns\n        -------\n        out : `numpy.ndarray`\n            The model added to ``out`` if  ``out`` is not ``None``, or else a\n            new array from evaluating the model over ``coords``.\n            If ``out`` and ``coords`` are both `None`, the returned array is\n            limited to the `Model.bounding_box` limits. If\n            `Model.bounding_box` is `None`, ``arr`` or ``coords`` must be\n            passed.\n\n        Raises\n        ------\n        ValueError\n            If ``coords`` are not given and the the `Model.bounding_box` of\n            this model is not set.\n\n        Examples\n        --------\n        :ref:`astropy:bounding-boxes`\n        \"\"\"\n\n        bbox = self.get_bounding_box()\n\n        ndim = self.n_inputs\n\n        if (coords is None) and (out is None) and (bbox is None):\n            raise ValueError('If no bounding_box is set, '\n                             'coords or out must be input.')\n\n        # for consistent indexing\n        if ndim == 1:\n            if coords is not None:\n                coords = [coords]\n            if bbox is not None:\n                bbox = [bbox]\n\n        if coords is not None:\n            coords = np.asanyarray(coords, dtype=float)\n            # Check dimensions match out and model\n            assert len(coords) == ndim\n            if out is not None:\n                if coords[0].shape != out.shape:\n                    raise ValueError('inconsistent shape of the output.')\n            else:\n                out = np.zeros(coords[0].shape)\n\n        if out is not None:\n            out = np.asanyarray(out)\n            if out.ndim != ndim:\n                raise ValueError('the array and model must have the same '\n                                 'number of dimensions.')\n\n        if bbox is not None:\n            # Assures position is at center pixel, important when using\n            # add_array.\n            pd = np.array([(np.mean(bb), np.ceil((bb[1] - bb[0]) / 2))\n                           for bb in bbox]).astype(int).T\n            pos, delta = pd\n\n            if coords is not None:\n                sub_shape = tuple(delta * 2 + 1)\n                sub_coords = np.array([extract_array(c, sub_shape, pos)\n                                       for c in coords])\n            else:\n                limits = [slice(p - d, p + d + 1, 1) for p, d in pd.T]\n                sub_coords = np.mgrid[limits]\n\n            sub_coords = sub_coords[::-1]\n\n            if out is None:\n                out = self(*sub_coords)\n            else:\n                try:\n                    out = add_array(out, self(*sub_coords), pos)\n                except ValueError:\n                    raise ValueError(\n                        'The `bounding_box` is larger than the input out in '\n                        'one or more dimensions. Set '\n                        '`model.bounding_box = None`.')\n        else:\n            if coords is None:\n                im_shape = out.shape\n                limits = [slice(i) for i in im_shape]\n                coords = np.mgrid[limits]\n\n            coords = coords[::-1]\n\n            out += self(*coords)\n\n        return out\n\n    def replace_submodel(self, name, model):\n        \"\"\"\n        Construct a new `~astropy.modeling.CompoundModel` instance from an\n        existing CompoundModel, replacing the named submodel with a new model.\n\n        In order to ensure that inverses and names are kept/reconstructed, it's\n        necessary to rebuild the CompoundModel from the replaced node all the\n        way back to the base. The original CompoundModel is left untouched.\n\n        Parameters\n        ----------\n        name : str\n            name of submodel to be replaced\n        model : `~astropy.modeling.Model`\n            replacement model\n        \"\"\"\n        submodels = [m for m in self.traverse_postorder()\n                     if getattr(m, 'name', None) == name]\n        if submodels:\n            if len(submodels) > 1:\n                raise ValueError(f\"More than one submodel named {name}\")\n\n            old_model = submodels.pop()\n            if len(old_model) != len(model):\n                raise ValueError(\"New and old models must have equal values \"\n                                 \"for n_models\")\n\n            # Do this check first in order to raise a more helpful Exception,\n            # although it would fail trying to construct the new CompoundModel\n            if (old_model.n_inputs != model.n_inputs or\n                        old_model.n_outputs != model.n_outputs):\n                raise ValueError(\"New model must match numbers of inputs and \"\n                                 \"outputs of existing model\")\n\n            tree = _get_submodel_path(self, name)\n            while tree:\n                branch = self.copy()\n                for node in tree[:-1]:\n                    branch = getattr(branch, node)\n                setattr(branch, tree[-1], model)\n                model = CompoundModel(branch.op, branch.left, branch.right,\n                                      name=branch.name)\n                tree = tree[:-1]\n            return model\n\n        else:\n            raise ValueError(f\"No submodels found named {name}\")\n\n    def _set_sub_models_and_parameter_units(self, left, right):\n        \"\"\"\n        Provides a work-around to properly set the sub models and respective\n        parameters's units/values when using ``without_units_for_data``\n        or ``without_units_for_data`` methods.\n        \"\"\"\n        model = CompoundModel(self.op, left, right)\n\n        self.left = left\n        self.right = right\n\n        for name in model.param_names:\n            model_parameter = getattr(model, name)\n            parameter = getattr(self, name)\n\n            parameter.value = model_parameter.value\n            parameter._set_unit(model_parameter.unit, force=True)\n\n    def without_units_for_data(self, **kwargs):\n        \"\"\"\n        See `~astropy.modeling.Model.without_units_for_data` for overview\n        of this method.\n\n        Notes\n        -----\n        This modifies the behavior of the base method to account for the\n        case where the sub-models of a compound model have different output\n        units. This is only valid for compound * and / compound models as\n        in that case it is reasonable to mix the output units. It does this\n        by modifying the output units of each sub model by using the output\n        units of the other sub model so that we can apply the original function\n        and get the desired result.\n\n        Additional data has to be output in the mixed output unit case\n        so that the units can be properly rebuilt by\n        `~astropy.modeling.CompoundModel.with_units_from_data`.\n\n        Outside the mixed output units, this method is identical to the\n        base method.\n        \"\"\"\n        if self.op in ['*', '/']:\n            model = self.copy()\n            inputs = {inp: kwargs[inp] for inp in self.inputs}\n\n            left_units = self.left.output_units(**kwargs)\n            right_units = self.right.output_units(**kwargs)\n\n            if self.op == '*':\n                left_kwargs = {out: kwargs[out] / right_units[out]\n                               for out in self.left.outputs if kwargs[out] is not None}\n                right_kwargs = {out: kwargs[out] / left_units[out]\n                                for out in self.right.outputs if kwargs[out] is not None}\n            else:\n                left_kwargs = {out: kwargs[out] * right_units[out]\n                               for out in self.left.outputs if kwargs[out] is not None}\n                right_kwargs = {out: 1 / kwargs[out] * left_units[out]\n                                for out in self.right.outputs if kwargs[out] is not None}\n\n            left_kwargs.update(inputs.copy())\n            right_kwargs.update(inputs.copy())\n\n            left = self.left.without_units_for_data(**left_kwargs)\n            if isinstance(left, tuple):\n                left_kwargs['_left_kwargs'] = left[1]\n                left_kwargs['_right_kwargs'] = left[2]\n                left = left[0]\n\n            right = self.right.without_units_for_data(**right_kwargs)\n            if isinstance(right, tuple):\n                right_kwargs['_left_kwargs'] = right[1]\n                right_kwargs['_right_kwargs'] = right[2]\n                right = right[0]\n\n            model._set_sub_models_and_parameter_units(left, right)\n\n            return model, left_kwargs, right_kwargs\n        else:\n            return super().without_units_for_data(**kwargs)\n\n    def with_units_from_data(self, **kwargs):\n        \"\"\"\n        See `~astropy.modeling.Model.with_units_from_data` for overview\n        of this method.\n\n        Notes\n        -----\n        This modifies the behavior of the base method to account for the\n        case where the sub-models of a compound model have different output\n        units. This is only valid for compound * and / compound models as\n        in that case it is reasonable to mix the output units. In order to\n        do this it requires some additional information output by\n        `~astropy.modeling.CompoundModel.without_units_for_data` passed as\n        keyword arguments under the keywords ``_left_kwargs`` and ``_right_kwargs``.\n\n        Outside the mixed output units, this method is identical to the\n        base method.\n        \"\"\"\n\n        if self.op in ['*', '/']:\n            left_kwargs = kwargs.pop('_left_kwargs')\n            right_kwargs = kwargs.pop('_right_kwargs')\n\n            left = self.left.with_units_from_data(**left_kwargs)\n            right = self.right.with_units_from_data(**right_kwargs)\n\n            model = self.copy()\n            model._set_sub_models_and_parameter_units(left, right)\n\n            return model\n        else:\n            return super().with_units_from_data(**kwargs)"},{"col":4,"comment":"null","endLoc":911,"header":"def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":3972,"name":"__init__","nodeType":"Function","startLoc":899,"text":"def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            degree, domain, window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)\n\n        # Set domain separately because it's different from\n        # the orthogonal polynomials.\n        self._default_domain_window = {'domain': (-1, 1),\n                                       'window': (-1, 1),\n                                       }\n        self.domain = domain or self._default_domain_window['domain']\n        self.window = window or self._default_domain_window['window']"},{"col":4,"comment":"null","endLoc":630,"header":"def __len__(self)","id":3973,"name":"__len__","nodeType":"Function","startLoc":629,"text":"def __len__(self):\n        return len(self._intervals)"},{"col":4,"comment":"null","endLoc":636,"header":"def __contains__(self, key)","id":3974,"name":"__contains__","nodeType":"Function","startLoc":632,"text":"def __contains__(self, key):\n        try:\n            return self._get_index(key) in self._intervals or self._ignored\n        except (IndexError, ValueError):\n            return False"},{"col":4,"comment":"null","endLoc":639,"header":"def has_interval(self, key)","id":3975,"name":"has_interval","nodeType":"Function","startLoc":638,"text":"def has_interval(self, key):\n        return self._get_index(key) in self._intervals"},{"col":4,"comment":"Get bounding_box entries by either input name or input index","endLoc":647,"header":"def __getitem__(self, key)","id":3976,"name":"__getitem__","nodeType":"Function","startLoc":641,"text":"def __getitem__(self, key):\n        \"\"\"Get bounding_box entries by either input name or input index\"\"\"\n        index = self._get_index(key)\n        if index in self._ignored:\n            return _ignored_interval\n        else:\n            return self._intervals[self._get_index(key)]"},{"col":4,"comment":"null","endLoc":389,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3977,"name":"to_tree_transform","nodeType":"Function","startLoc":383,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'gamma': _parameter_to_value(model.gamma),\n                'alpha': _parameter_to_value(model.alpha)}\n        return node"},{"col":4,"comment":"\n        Return the old tuple of tuples representation of the bounding_box\n            order='C' corresponds to the old bounding_box ordering\n            order='F' corresponds to the gwcs bounding_box ordering.\n        ","endLoc":667,"header":"def bounding_box(self, order: str = None)","id":3978,"name":"bounding_box","nodeType":"Function","startLoc":649,"text":"def bounding_box(self, order: str = None):\n        \"\"\"\n        Return the old tuple of tuples representation of the bounding_box\n            order='C' corresponds to the old bounding_box ordering\n            order='F' corresponds to the gwcs bounding_box ordering.\n        \"\"\"\n        if len(self._intervals) == 1:\n            return tuple(list(self._intervals.values())[0])\n        else:\n            order = self._get_order(order)\n            inputs = self._model.inputs\n            if order == 'C':\n                inputs = inputs[::-1]\n\n            bbox = tuple([tuple(self[input_name]) for input_name in inputs])\n            if len(bbox) == 1:\n                bbox = bbox[0]\n\n            return bbox"},{"attributeType":"null","col":12,"comment":"null","endLoc":386,"id":3979,"name":"tck","nodeType":"Attribute","startLoc":386,"text":"self.tck"},{"col":4,"comment":"null","endLoc":3020,"header":"def __init__(self, op, left, right, name=None)","id":3980,"name":"__init__","nodeType":"Function","startLoc":2902,"text":"def __init__(self, op, left, right, name=None):\n        self.__dict__['_param_names'] = None\n        self._n_submodels = None\n        self.op = op\n        self.left = left\n        self.right = right\n        self._bounding_box = None\n        self._user_bounding_box = None\n        self._leaflist = None\n        self._tdict = None\n        self._parameters = None\n        self._parameters_ = None\n        self._param_metrics = None\n\n        if op != 'fix_inputs' and len(left) != len(right):\n            raise ValueError(\n                'Both operands must have equal values for n_models')\n        self._n_models = len(left)\n\n        if op != 'fix_inputs' and ((left.model_set_axis != right.model_set_axis)\n                                   or left.model_set_axis):  # not False and not 0\n            raise ValueError(\"model_set_axis must be False or 0 and consistent for operands\")\n        self._model_set_axis = left.model_set_axis\n\n        if op in ['+', '-', '*', '/', '**'] or op in SPECIAL_OPERATORS:\n            if (left.n_inputs != right.n_inputs) or \\\n               (left.n_outputs != right.n_outputs):\n                raise ModelDefinitionError(\n                    'Both operands must match numbers of inputs and outputs')\n            self.n_inputs = left.n_inputs\n            self.n_outputs = left.n_outputs\n            self.inputs = left.inputs\n            self.outputs = left.outputs\n        elif op == '&':\n            self.n_inputs = left.n_inputs + right.n_inputs\n            self.n_outputs = left.n_outputs + right.n_outputs\n            self.inputs = combine_labels(left.inputs, right.inputs)\n            self.outputs = combine_labels(left.outputs, right.outputs)\n        elif op == '|':\n            if left.n_outputs != right.n_inputs:\n                raise ModelDefinitionError(\n                    \"Unsupported operands for |: {0} (n_inputs={1}, \"\n                    \"n_outputs={2}) and {3} (n_inputs={4}, n_outputs={5}); \"\n                    \"n_outputs for the left-hand model must match n_inputs \"\n                    \"for the right-hand model.\".format(\n                        left.name, left.n_inputs, left.n_outputs, right.name,\n                        right.n_inputs, right.n_outputs))\n\n            self.n_inputs = left.n_inputs\n            self.n_outputs = right.n_outputs\n            self.inputs = left.inputs\n            self.outputs = right.outputs\n        elif op == 'fix_inputs':\n            if not isinstance(left, Model):\n                raise ValueError('First argument to \"fix_inputs\" must be an instance of an astropy Model.')\n            if not isinstance(right, dict):\n                raise ValueError('Expected a dictionary for second argument of \"fix_inputs\".')\n\n            # Dict keys must match either possible indices\n            # for model on left side, or names for inputs.\n            self.n_inputs = left.n_inputs - len(right)\n            # Assign directly to the private attribute (instead of using the setter)\n            # to avoid asserting the new number of outputs matches the old one.\n            self._outputs = left.outputs\n            self.n_outputs = left.n_outputs\n            newinputs = list(left.inputs)\n            keys = right.keys()\n            input_ind = []\n            for key in keys:\n                if np.issubdtype(type(key), np.integer):\n                    if key >= left.n_inputs or key < 0:\n                        raise ValueError(\n                            'Substitution key integer value '\n                            'not among possible input choices.')\n                    if key in input_ind:\n                        raise ValueError(\"Duplicate specification of \"\n                                         \"same input (index/name).\")\n                    input_ind.append(key)\n                elif isinstance(key, str):\n                    if key not in left.inputs:\n                        raise ValueError(\n                            'Substitution key string not among possible '\n                            'input choices.')\n                    # Check to see it doesn't match positional\n                    # specification.\n                    ind = left.inputs.index(key)\n                    if ind in input_ind:\n                        raise ValueError(\"Duplicate specification of \"\n                                         \"same input (index/name).\")\n                    input_ind.append(ind)\n            # Remove substituted inputs\n            input_ind.sort()\n            input_ind.reverse()\n            for ind in input_ind:\n                del newinputs[ind]\n            self.inputs = tuple(newinputs)\n            # Now check to see if the input model has bounding_box defined.\n            # If so, remove the appropriate dimensions and set it for this\n            # instance.\n            try:\n                self.bounding_box = \\\n                    self.left.bounding_box.fix_inputs(self, right)\n            except NotImplementedError:\n                pass\n\n        else:\n            raise ModelDefinitionError('Illegal operator: ', self.op)\n        self.name = name\n        self._fittable = None\n        self.fit_deriv = None\n        self.col_fit_deriv = None\n        if op in ('|', '+', '-'):\n            self.linear = left.linear and right.linear\n        else:\n            self.linear = False\n        self.eqcons = []\n        self.ineqcons = []\n        self.n_left_params = len(self.left.parameters)\n        self._map_parameters()"},{"col":4,"comment":"null","endLoc":400,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3981,"name":"assert_equal","nodeType":"Function","startLoc":391,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Moffat1D) and\n                isinstance(b, functional_models.Moffat1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.gamma, b.gamma)\n        assert_array_equal(a.alpha, b.alpha)"},{"col":4,"comment":"Note equality can be either with old representation or new one.","endLoc":676,"header":"def __eq__(self, value)","id":3982,"name":"__eq__","nodeType":"Function","startLoc":669,"text":"def __eq__(self, value):\n        \"\"\"Note equality can be either with old representation or new one.\"\"\"\n        if isinstance(value, tuple):\n            return self.bounding_box() == value\n        elif isinstance(value, ModelBoundingBox):\n            return (self.intervals == value.intervals) and (self.ignored == value.ignored)\n        else:\n            return False"},{"attributeType":"null","col":4,"comment":"null","endLoc":372,"id":3983,"name":"name","nodeType":"Attribute","startLoc":372,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":373,"id":3984,"name":"version","nodeType":"Attribute","startLoc":373,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":374,"id":3985,"name":"types","nodeType":"Attribute","startLoc":374,"text":"types"},{"className":"Moffat2DType","col":0,"comment":"null","endLoc":435,"id":3986,"nodeType":"Class","startLoc":403,"text":"class Moffat2DType(TransformType):\n    name = 'transform/moffat2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Moffat2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Moffat2D(amplitude=node['amplitude'],\n                                          x_0=node['x_0'],\n                                          y_0=node['y_0'],\n                                          gamma=node['gamma'],\n                                          alpha=node['alpha'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'gamma': _parameter_to_value(model.gamma),\n                'alpha': _parameter_to_value(model.alpha)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Moffat2D) and\n                isinstance(b, functional_models.Moffat2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.gamma, b.gamma)\n        assert_array_equal(a.alpha, b.alpha)"},{"col":0,"comment":"\n    For use with the join operator &: Combine left input/output labels with\n    right input/output labels.\n\n    If none of the labels conflict then this just returns a sum of tuples.\n    However if *any* of the labels conflict, this appends '0' to the left-hand\n    labels and '1' to the right-hand labels so there is no ambiguity).\n    ","endLoc":259,"header":"def combine_labels(left, right)","id":3987,"name":"combine_labels","nodeType":"Function","startLoc":245,"text":"def combine_labels(left, right):\n    \"\"\"\n    For use with the join operator &: Combine left input/output labels with\n    right input/output labels.\n\n    If none of the labels conflict then this just returns a sum of tuples.\n    However if *any* of the labels conflict, this appends '0' to the left-hand\n    labels and '1' to the right-hand labels so there is no ambiguity).\n    \"\"\"\n\n    if set(left).intersection(right):\n        left = tuple(l + '0' for l in left)\n        right = tuple(r + '1' for r in right)\n\n    return left + right"},{"col":4,"comment":"null","endLoc":414,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3988,"name":"from_tree_transform","nodeType":"Function","startLoc":408,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Moffat2D(amplitude=node['amplitude'],\n                                          x_0=node['x_0'],\n                                          y_0=node['y_0'],\n                                          gamma=node['gamma'],\n                                          alpha=node['alpha'])"},{"className":"SplineType","col":0,"comment":"null","endLoc":25,"id":3989,"nodeType":"Class","startLoc":8,"text":"class SplineType(TransformType):\n    name = 'transform/spline1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.spline.Spline1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return Spline1D(knots=node['knots'],\n                        coeffs=node['coefficients'],\n                        degree=node['degree'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        return {\n            \"knots\": model.t,\n            \"coefficients\": model.c,\n            \"degree\": model.degree\n        }"},{"col":4,"comment":"Validate and store interval under key (input index or input name).","endLoc":684,"header":"def __setitem__(self, key, value)","id":3990,"name":"__setitem__","nodeType":"Function","startLoc":678,"text":"def __setitem__(self, key, value):\n        \"\"\"Validate and store interval under key (input index or input name).\"\"\"\n        index = self._get_index(key)\n        if index in self._ignored:\n            self._ignored.remove(index)\n\n        self._intervals[index] = _Interval.validate(value)"},{"col":4,"comment":"null","endLoc":17,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3991,"name":"from_tree_transform","nodeType":"Function","startLoc":13,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return Spline1D(knots=node['knots'],\n                        coeffs=node['coefficients'],\n                        degree=node['degree'])"},{"col":4,"comment":"\n        Construct and validate an interval\n\n        Parameters\n        ----------\n        interval : iterable\n            A representation of the interval.\n\n        Returns\n        -------\n        A validated interval.\n        ","endLoc":111,"header":"@classmethod\n    def validate(cls, interval)","id":3992,"name":"validate","nodeType":"Function","startLoc":90,"text":"@classmethod\n    def validate(cls, interval):\n        \"\"\"\n        Construct and validate an interval\n\n        Parameters\n        ----------\n        interval : iterable\n            A representation of the interval.\n\n        Returns\n        -------\n        A validated interval.\n        \"\"\"\n        cls._validate_shape(interval)\n\n        if len(interval) == 1:\n            interval = tuple(interval[0])\n        else:\n            interval = tuple(interval)\n\n        return cls._validate_bounds(interval[0], interval[1])"},{"col":4,"comment":"Validate the shape of an interval representation","endLoc":79,"header":"@staticmethod\n    def _validate_shape(interval)","id":3993,"name":"_validate_shape","nodeType":"Function","startLoc":57,"text":"@staticmethod\n    def _validate_shape(interval):\n        \"\"\"Validate the shape of an interval representation\"\"\"\n        MESSAGE = \"\"\"An interval must be some sort of sequence of length 2\"\"\"\n\n        try:\n            shape = np.shape(interval)\n        except TypeError:\n            try:\n                # np.shape does not work with lists of Quantities\n                if len(interval) == 1:\n                    interval = interval[0]\n                shape = np.shape([b.to_value() for b in interval])\n            except (ValueError, TypeError, AttributeError):\n                raise ValueError(MESSAGE)\n\n        valid_shape = shape in ((2,), (1, 2), (2, 0))\n        if not valid_shape:\n            valid_shape = (len(shape) > 0) and (shape[0] == 2) and \\\n                all(isinstance(b, np.ndarray) for b in interval)\n\n        if not isiterable(interval) or not valid_shape:\n            raise ValueError(MESSAGE)"},{"col":4,"comment":"null","endLoc":423,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3994,"name":"to_tree_transform","nodeType":"Function","startLoc":416,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'gamma': _parameter_to_value(model.gamma),\n                'alpha': _parameter_to_value(model.alpha)}\n        return node"},{"col":4,"comment":"null","endLoc":435,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3995,"name":"assert_equal","nodeType":"Function","startLoc":425,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Moffat2D) and\n                isinstance(b, functional_models.Moffat2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.gamma, b.gamma)\n        assert_array_equal(a.alpha, b.alpha)"},{"attributeType":"null","col":4,"comment":"null","endLoc":404,"id":3996,"name":"name","nodeType":"Attribute","startLoc":404,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":405,"id":3997,"name":"version","nodeType":"Attribute","startLoc":405,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":406,"id":3998,"name":"types","nodeType":"Attribute","startLoc":406,"text":"types"},{"className":"Planar2D","col":0,"comment":"null","endLoc":464,"id":3999,"nodeType":"Class","startLoc":438,"text":"class Planar2D(TransformType):\n    name = 'transform/planar2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Planar2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Planar2D(slope_x=node['slope_x'],\n                                          slope_y=node['slope_y'],\n                                          intercept=node['intercept'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'slope_x': _parameter_to_value(model.slope_x),\n                'slope_y': _parameter_to_value(model.slope_y),\n                'intercept': _parameter_to_value(model.intercept)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Planar2D) and\n                isinstance(b, functional_models.Planar2D))\n        assert_array_equal(a.slope_x, b.slope_x)\n        assert_array_equal(a.slope_y, b.slope_y)\n        assert_array_equal(a.intercept, b.intercept)"},{"col":4,"comment":"null","endLoc":447,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4000,"name":"from_tree_transform","nodeType":"Function","startLoc":443,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Planar2D(slope_x=node['slope_x'],\n                                          slope_y=node['slope_y'],\n                                          intercept=node['intercept'])"},{"col":4,"comment":"null","endLoc":454,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":4001,"name":"to_tree_transform","nodeType":"Function","startLoc":449,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'slope_x': _parameter_to_value(model.slope_x),\n                'slope_y': _parameter_to_value(model.slope_y),\n                'intercept': _parameter_to_value(model.intercept)}\n        return node"},{"col":4,"comment":"null","endLoc":464,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4002,"name":"assert_equal","nodeType":"Function","startLoc":456,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Planar2D) and\n                isinstance(b, functional_models.Planar2D))\n        assert_array_equal(a.slope_x, b.slope_x)\n        assert_array_equal(a.slope_y, b.slope_y)\n        assert_array_equal(a.intercept, b.intercept)"},{"attributeType":"null","col":4,"comment":"null","endLoc":439,"id":4003,"name":"name","nodeType":"Attribute","startLoc":439,"text":"name"},{"col":4,"comment":"Validate the bounds are reasonable and construct an interval from them.","endLoc":88,"header":"@classmethod\n    def _validate_bounds(cls, lower, upper)","id":4004,"name":"_validate_bounds","nodeType":"Function","startLoc":81,"text":"@classmethod\n    def _validate_bounds(cls, lower, upper):\n        \"\"\"Validate the bounds are reasonable and construct an interval from them.\"\"\"\n        if (np.asanyarray(lower) > np.asanyarray(upper)).all():\n            warnings.warn(f\"Invalid interval: upper bound {upper} \"\n                          f\"is strictly less than lower bound {lower}.\", RuntimeWarning)\n\n        return cls(lower, upper)"},{"col":4,"comment":"Delete stored interval","endLoc":692,"header":"def __delitem__(self, key)","id":4005,"name":"__delitem__","nodeType":"Function","startLoc":686,"text":"def __delitem__(self, key):\n        \"\"\"Delete stored interval\"\"\"\n        index = self._get_index(key)\n        if index in self._ignored:\n            raise RuntimeError(f\"Cannot delete ignored input: {key}!\")\n        del self._intervals[index]\n        self._ignored.append(index)"},{"col":4,"comment":"null","endLoc":716,"header":"@property\n    def _n_inputs(self) -> int","id":4006,"name":"_n_inputs","nodeType":"Function","startLoc":710,"text":"@property\n    def _n_inputs(self) -> int:\n        n_inputs = self._model.n_inputs - len(self._ignored)\n        if n_inputs > 0:\n            return n_inputs\n        else:\n            return 0"},{"col":4,"comment":"\n        Fix the bounding_box for a `fix_inputs` compound model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The new model for which this will be a bounding_box\n        fixed_inputs : dict\n            Dictionary of inputs which have been fixed by this bounding box.\n        keep_ignored : bool\n            Keep the ignored inputs of the bounding box (internal argument only)\n        ","endLoc":788,"header":"def fix_inputs(self, model, fixed_inputs: dict, _keep_ignored=False)","id":4007,"name":"fix_inputs","nodeType":"Function","startLoc":763,"text":"def fix_inputs(self, model, fixed_inputs: dict, _keep_ignored=False):\n        \"\"\"\n        Fix the bounding_box for a `fix_inputs` compound model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The new model for which this will be a bounding_box\n        fixed_inputs : dict\n            Dictionary of inputs which have been fixed by this bounding box.\n        keep_ignored : bool\n            Keep the ignored inputs of the bounding box (internal argument only)\n        \"\"\"\n\n        new = self.copy()\n\n        for _input in fixed_inputs.keys():\n            del new[_input]\n\n        if _keep_ignored:\n            ignored = new.ignored\n        else:\n            ignored = None\n\n        return ModelBoundingBox.validate(model, new.named_intervals,\n                                    ignored=ignored, order=new._order)"},{"attributeType":"null","col":4,"comment":"null","endLoc":440,"id":4008,"name":"version","nodeType":"Attribute","startLoc":440,"text":"version"},{"col":4,"comment":"null","endLoc":792,"header":"@property\n    def dimension(self)","id":4009,"name":"dimension","nodeType":"Function","startLoc":790,"text":"@property\n    def dimension(self):\n        return len(self)"},{"col":4,"comment":"null","endLoc":800,"header":"def domain(self, resolution, order: str = None)","id":4010,"name":"domain","nodeType":"Function","startLoc":794,"text":"def domain(self, resolution, order: str = None):\n        inputs = self._model.inputs\n        order = self._get_order(order)\n        if order == 'C':\n            inputs = inputs[::-1]\n\n        return [self[input_name].domain(resolution) for input_name in inputs]"},{"col":0,"comment":"\n    Add a smaller array at a given position in a larger array.\n\n    Parameters\n    ----------\n    array_large : ndarray\n        Large array.\n    array_small : ndarray\n        Small array to add. Can be equal to ``array_large`` in size in a given\n        dimension, but not larger.\n    position : tuple\n        Position of the small array's center, with respect to the large array.\n        Coordinates should be in the same order as the array shape.\n\n    Returns\n    -------\n    new_array : ndarray\n        The new array formed from the sum of ``array_large`` and\n        ``array_small``.\n\n    Notes\n    -----\n    The addition is done in-place.\n\n    Examples\n    --------\n    We consider a large array of zeros with the shape 5x5 and a small\n    array of ones with a shape of 3x3:\n\n    >>> import numpy as np\n    >>> from astropy.nddata.utils import add_array\n    >>> large_array = np.zeros((5, 5))\n    >>> small_array = np.ones((3, 3))\n    >>> add_array(large_array, small_array, (1, 2))  # doctest: +FLOAT_CMP\n    array([[0., 1., 1., 1., 0.],\n           [0., 1., 1., 1., 0.],\n           [0., 1., 1., 1., 0.],\n           [0., 0., 0., 0., 0.],\n           [0., 0., 0., 0., 0.]])\n    ","endLoc":295,"header":"def add_array(array_large, array_small, position)","id":4011,"name":"add_array","nodeType":"Function","startLoc":245,"text":"def add_array(array_large, array_small, position):\n    \"\"\"\n    Add a smaller array at a given position in a larger array.\n\n    Parameters\n    ----------\n    array_large : ndarray\n        Large array.\n    array_small : ndarray\n        Small array to add. Can be equal to ``array_large`` in size in a given\n        dimension, but not larger.\n    position : tuple\n        Position of the small array's center, with respect to the large array.\n        Coordinates should be in the same order as the array shape.\n\n    Returns\n    -------\n    new_array : ndarray\n        The new array formed from the sum of ``array_large`` and\n        ``array_small``.\n\n    Notes\n    -----\n    The addition is done in-place.\n\n    Examples\n    --------\n    We consider a large array of zeros with the shape 5x5 and a small\n    array of ones with a shape of 3x3:\n\n    >>> import numpy as np\n    >>> from astropy.nddata.utils import add_array\n    >>> large_array = np.zeros((5, 5))\n    >>> small_array = np.ones((3, 3))\n    >>> add_array(large_array, small_array, (1, 2))  # doctest: +FLOAT_CMP\n    array([[0., 1., 1., 1., 0.],\n           [0., 1., 1., 1., 0.],\n           [0., 1., 1., 1., 0.],\n           [0., 0., 0., 0., 0.],\n           [0., 0., 0., 0., 0.]])\n    \"\"\"\n    # Check if large array is not smaller\n    if all(large_shape >= small_shape for (large_shape, small_shape)\n           in zip(array_large.shape, array_small.shape)):\n        large_slices, small_slices = overlap_slices(array_large.shape,\n                                                    array_small.shape,\n                                                    position)\n        array_large[large_slices] += array_small[small_slices]\n        return array_large\n    else:\n        raise ValueError(\"Can't add array. Small array too large.\")"},{"attributeType":"null","col":4,"comment":"null","endLoc":441,"id":4012,"name":"types","nodeType":"Attribute","startLoc":441,"text":"types"},{"className":"RedshiftScaleFactorType","col":0,"comment":"null","endLoc":487,"id":4013,"nodeType":"Class","startLoc":467,"text":"class RedshiftScaleFactorType(TransformType):\n    name = 'transform/redshift_scale_factor'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.RedshiftScaleFactor']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.RedshiftScaleFactor(z=node['z'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'z': _parameter_to_value(model.z)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.RedshiftScaleFactor) and\n                isinstance(b, functional_models.RedshiftScaleFactor))\n        assert_array_equal(a.z, b.z)"},{"col":4,"comment":"\n        Get all the input positions which are outside the bounding_box,\n        so that the corresponding outputs can be filled with the fill\n        value (default NaN).\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        outside_index : bool-numpy array\n            True  -> position outside bounding_box\n            False -> position inside  bounding_box\n        all_out : bool\n            if all of the inputs are outside the bounding_box\n        ","endLoc":836,"header":"def _outside(self,  input_shape, inputs)","id":4014,"name":"_outside","nodeType":"Function","startLoc":802,"text":"def _outside(self,  input_shape, inputs):\n        \"\"\"\n        Get all the input positions which are outside the bounding_box,\n        so that the corresponding outputs can be filled with the fill\n        value (default NaN).\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        outside_index : bool-numpy array\n            True  -> position outside bounding_box\n            False -> position inside  bounding_box\n        all_out : bool\n            if all of the inputs are outside the bounding_box\n        \"\"\"\n        all_out = False\n\n        outside_index = np.zeros(input_shape, dtype=bool)\n        for index, _input in enumerate(inputs):\n            _input = np.asanyarray(_input)\n\n            outside = np.broadcast_to(self[index].outside(_input), input_shape)\n            outside_index[outside] = True\n\n            if outside_index.all():\n                all_out = True\n                break\n\n        return outside_index, all_out"},{"col":4,"comment":"null","endLoc":474,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4015,"name":"from_tree_transform","nodeType":"Function","startLoc":472,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.RedshiftScaleFactor(z=node['z'])"},{"col":4,"comment":"\n        This property is used to indicate what units or sets of units the\n        evaluate method expects, and returns a dictionary mapping inputs to\n        units (or `None` if any units are accepted).\n\n        Model sub-classes can also use function annotations in evaluate to\n        indicate valid input units, in which case this property should\n        not be overridden since it will return the input units based on the\n        annotations.\n        ","endLoc":1843,"header":"@property\n    def input_units(self)","id":4016,"name":"input_units","nodeType":"Function","startLoc":1821,"text":"@property\n    def input_units(self):\n        \"\"\"\n        This property is used to indicate what units or sets of units the\n        evaluate method expects, and returns a dictionary mapping inputs to\n        units (or `None` if any units are accepted).\n\n        Model sub-classes can also use function annotations in evaluate to\n        indicate valid input units, in which case this property should\n        not be overridden since it will return the input units based on the\n        annotations.\n        \"\"\"\n        if hasattr(self, '_input_units'):\n            return self._input_units\n        elif hasattr(self.evaluate, '__annotations__'):\n            annotations = self.evaluate.__annotations__.copy()\n            annotations.pop('return', None)\n            if annotations:\n                # If there are not annotations for all inputs this will error.\n                return dict((name, annotations[name]) for name in self.inputs)\n        else:\n            # None means any unit is accepted\n            return None"},{"col":4,"comment":"null","endLoc":25,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":4017,"name":"to_tree_transform","nodeType":"Function","startLoc":19,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        return {\n            \"knots\": model.t,\n            \"coefficients\": model.c,\n            \"degree\": model.degree\n        }"},{"attributeType":"null","col":4,"comment":"null","endLoc":9,"id":4018,"name":"name","nodeType":"Attribute","startLoc":9,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":10,"id":4019,"name":"version","nodeType":"Attribute","startLoc":10,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":11,"id":4020,"name":"types","nodeType":"Attribute","startLoc":11,"text":"types"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":4021,"name":"__all__","nodeType":"Attribute","startLoc":5,"text":"__all__"},{"col":0,"comment":"","endLoc":1,"header":"spline.py#<anonymous>","id":4022,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"__all__ = ['SplineType']"},{"id":4023,"name":"astropy/io/misc/asdf/tags/transform/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/transform/tests","id":4024,"nodeType":"File","text":"import pytest\nfrom astropy.io.misc.asdf.tests import ASDF_ENTRY_INSTALLED\n\nif not ASDF_ENTRY_INSTALLED:\n    pytest.skip('The astropy asdf entry points are not installed',\n                allow_module_level=True)\n"},{"col":0,"comment":"","endLoc":1,"header":"__init__.py#<anonymous>","id":4025,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"if not ASDF_ENTRY_INSTALLED:\n    pytest.skip('The astropy asdf entry points are not installed',\n                allow_module_level=True)"},{"col":4,"comment":"\n        Map all the constituent model parameters to the compound object,\n        renaming as necessary by appending a suffix number.\n\n        This can be an expensive operation, particularly for a complex\n        expression tree.\n\n        All the corresponding parameter attributes are created that one\n        expects for the Model class.\n\n        The parameter objects that the attributes point to are the same\n        objects as in the constiutent models. Changes made to parameter\n        values to either are seen by both.\n\n        Prior to calling this, none of the associated attributes will\n        exist. This method must be called to make the model usable by\n        fitting engines.\n\n        If oldnames=True, then parameters are named as in the original\n        implementation of compound models.\n        ","endLoc":3548,"header":"def _map_parameters(self)","id":4026,"name":"_map_parameters","nodeType":"Function","startLoc":3505,"text":"def _map_parameters(self):\n        \"\"\"\n        Map all the constituent model parameters to the compound object,\n        renaming as necessary by appending a suffix number.\n\n        This can be an expensive operation, particularly for a complex\n        expression tree.\n\n        All the corresponding parameter attributes are created that one\n        expects for the Model class.\n\n        The parameter objects that the attributes point to are the same\n        objects as in the constiutent models. Changes made to parameter\n        values to either are seen by both.\n\n        Prior to calling this, none of the associated attributes will\n        exist. This method must be called to make the model usable by\n        fitting engines.\n\n        If oldnames=True, then parameters are named as in the original\n        implementation of compound models.\n        \"\"\"\n        if self._parameters is not None:\n            # do nothing\n            return\n        if self._leaflist is None:\n            self._make_leaflist()\n        self._parameters_ = {}\n        param_map = {}\n        self._param_names = []\n        for lindex, leaf in enumerate(self._leaflist):\n            if not isinstance(leaf, dict):\n                for param_name in leaf.param_names:\n                    param = getattr(leaf, param_name)\n                    new_param_name = f\"{param_name}_{lindex}\"\n                    self.__dict__[new_param_name] = param\n                    self._parameters_[new_param_name] = param\n                    self._param_names.append(new_param_name)\n                    param_map[new_param_name] = (lindex, param_name)\n        self._param_metrics = {}\n        self._param_map = param_map\n        self._param_map_inverse = dict((v, k) for k, v in param_map.items())\n        self._initialize_slices()\n        self._param_names = tuple(self._param_names)"},{"col":4,"comment":"null","endLoc":3296,"header":"def _make_leaflist(self)","id":4027,"name":"_make_leaflist","nodeType":"Function","startLoc":3291,"text":"def _make_leaflist(self):\n        tdict = {}\n        leaflist = []\n        make_subtree_dict(self, '', tdict, leaflist)\n        self._leaflist = leaflist\n        self._tdict = tdict"},{"col":0,"comment":"\n    Traverse a tree noting each node by a key that indicates all the\n    left/right choices necessary to reach that node. Each key will\n    reference a tuple that contains:\n\n    - reference to the compound model for that node.\n    - left most index contained within that subtree\n       (relative to all indices for the whole tree)\n    - right most index contained within that subtree\n    ","endLoc":4060,"header":"def make_subtree_dict(tree, nodepath, tdict, leaflist)","id":4028,"name":"make_subtree_dict","nodeType":"Function","startLoc":4041,"text":"def make_subtree_dict(tree, nodepath, tdict, leaflist):\n    '''\n    Traverse a tree noting each node by a key that indicates all the\n    left/right choices necessary to reach that node. Each key will\n    reference a tuple that contains:\n\n    - reference to the compound model for that node.\n    - left most index contained within that subtree\n       (relative to all indices for the whole tree)\n    - right most index contained within that subtree\n    '''\n    # if this is a leaf, just append it to the leaflist\n    if not hasattr(tree, 'isleaf'):\n        leaflist.append(tree)\n    else:\n        leftmostind = len(leaflist)\n        make_subtree_dict(tree.left, nodepath+'l', tdict, leaflist)\n        make_subtree_dict(tree.right, nodepath+'r', tdict, leaflist)\n        rightmostind = len(leaflist)-1\n        tdict[nodepath] = (tree, leftmostind, rightmostind)"},{"col":4,"comment":"null","endLoc":479,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":4029,"name":"to_tree_transform","nodeType":"Function","startLoc":476,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'z': _parameter_to_value(model.z)}\n        return node"},{"col":4,"comment":"\n        This property is used to indicate what units or sets of units the\n        output of evaluate should be in, and returns a dictionary mapping\n        outputs to units (or `None` if any units are accepted).\n\n        Model sub-classes can also use function annotations in evaluate to\n        indicate valid output units, in which case this property should not be\n        overridden since it will return the return units based on the\n        annotations.\n        ","endLoc":1863,"header":"@property\n    def return_units(self)","id":4030,"name":"return_units","nodeType":"Function","startLoc":1845,"text":"@property\n    def return_units(self):\n        \"\"\"\n        This property is used to indicate what units or sets of units the\n        output of evaluate should be in, and returns a dictionary mapping\n        outputs to units (or `None` if any units are accepted).\n\n        Model sub-classes can also use function annotations in evaluate to\n        indicate valid output units, in which case this property should not be\n        overridden since it will return the return units based on the\n        annotations.\n        \"\"\"\n        if hasattr(self, '_return_units'):\n            return self._return_units\n        elif hasattr(self.evaluate, '__annotations__'):\n            return self.evaluate.__annotations__.get('return', None)\n        else:\n            # None means any unit is accepted\n            return None"},{"col":4,"comment":"null","endLoc":487,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4031,"name":"assert_equal","nodeType":"Function","startLoc":481,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.RedshiftScaleFactor) and\n                isinstance(b, functional_models.RedshiftScaleFactor))\n        assert_array_equal(a.z, b.z)"},{"col":4,"comment":"null","endLoc":142,"header":"def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":4032,"name":"__init__","nodeType":"Function","startLoc":137,"text":"def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            degree, n_models, model_set_axis, name=name, meta=meta, **params)\n\n        self._set_default_domain_window(domain, window)"},{"col":4,"comment":"\n        Return a deep copy of this model.\n\n        ","endLoc":2204,"header":"def deepcopy(self)","id":4033,"name":"deepcopy","nodeType":"Function","startLoc":2198,"text":"def deepcopy(self):\n        \"\"\"\n        Return a deep copy of this model.\n\n        \"\"\"\n\n        return self.copy()"},{"col":4,"comment":"\n        Get the indices of all the inputs inside the bounding_box.\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        valid_index : numpy array\n            array of all indices inside the bounding box\n        all_out : bool\n            if all of the inputs are outside the bounding_box\n        ","endLoc":862,"header":"def _valid_index(self, input_shape, inputs)","id":4034,"name":"_valid_index","nodeType":"Function","startLoc":838,"text":"def _valid_index(self, input_shape, inputs):\n        \"\"\"\n        Get the indices of all the inputs inside the bounding_box.\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        valid_index : numpy array\n            array of all indices inside the bounding box\n        all_out : bool\n            if all of the inputs are outside the bounding_box\n        \"\"\"\n        outside_index, all_out = self._outside(input_shape, inputs)\n\n        valid_index = np.atleast_1d(np.logical_not(outside_index)).nonzero()\n        if len(valid_index[0]) == 0:\n            all_out = True\n\n        return valid_index, all_out"},{"attributeType":"null","col":4,"comment":"null","endLoc":468,"id":4035,"name":"name","nodeType":"Attribute","startLoc":468,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":469,"id":4036,"name":"version","nodeType":"Attribute","startLoc":469,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":470,"id":4037,"name":"types","nodeType":"Attribute","startLoc":470,"text":"types"},{"className":"RickerWavelet1DType","col":0,"comment":"null","endLoc":516,"id":4038,"nodeType":"Class","startLoc":490,"text":"class RickerWavelet1DType(TransformType):\n    name = 'transform/ricker_wavelet1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.RickerWavelet1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.RickerWavelet1D(amplitude=node['amplitude'],\n                                                 x_0=node['x_0'],\n                                                 sigma=node['sigma'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'sigma': _parameter_to_value(model.sigma)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.RickerWavelet1D) and\n                isinstance(b, functional_models.RickerWavelet1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.sigma, b.sigma)"},{"col":4,"comment":"null","endLoc":499,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4039,"name":"from_tree_transform","nodeType":"Function","startLoc":495,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.RickerWavelet1D(amplitude=node['amplitude'],\n                                                 x_0=node['x_0'],\n                                                 sigma=node['sigma'])"},{"col":4,"comment":"null","endLoc":83,"header":"def __init__(self, degree, n_models=None, model_set_axis=None,\n                 name=None, meta=None, **params)","id":4040,"name":"__init__","nodeType":"Function","startLoc":66,"text":"def __init__(self, degree, n_models=None, model_set_axis=None,\n                 name=None, meta=None, **params):\n        self._degree = degree\n        self._order = self.get_num_coeff(self.n_inputs)\n        self._param_names = self._generate_coeff_names(self.n_inputs)\n        if n_models:\n            if model_set_axis is None:\n                model_set_axis = 0\n            minshape = (1,) * model_set_axis + (n_models,)\n        else:\n            minshape = ()\n        for param_name in self._param_names:\n            self._parameters_[param_name] = \\\n                Parameter(param_name, default=np.zeros(minshape))\n\n        super().__init__(\n            n_models=n_models, model_set_axis=model_set_axis, name=name,\n            meta=meta, **params)"},{"col":4,"comment":"\n        Get prepare the inputs with respect to the bounding box.\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        valid_inputs : list\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : array_like\n            array of all indices inside the bounding box\n        all_out: bool\n            if all of the inputs are outside the bounding_box\n        ","endLoc":898,"header":"def prepare_inputs(self, input_shape, inputs) -> Tuple[Any, Any, Any]","id":4041,"name":"prepare_inputs","nodeType":"Function","startLoc":864,"text":"def prepare_inputs(self, input_shape, inputs) -> Tuple[Any, Any, Any]:\n        \"\"\"\n        Get prepare the inputs with respect to the bounding box.\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        valid_inputs : list\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : array_like\n            array of all indices inside the bounding box\n        all_out: bool\n            if all of the inputs are outside the bounding_box\n        \"\"\"\n        valid_index, all_out = self._valid_index(input_shape, inputs)\n\n        valid_inputs = []\n        if not all_out:\n            for _input in inputs:\n                if input_shape:\n                    valid_input = np.broadcast_to(np.atleast_1d(_input), input_shape)[valid_index]\n                    if np.isscalar(_input):\n                        valid_input = valid_input.item(0)\n                    valid_inputs.append(valid_input)\n                else:\n                    valid_inputs.append(_input)\n\n        return tuple(valid_inputs), valid_index, all_out"},{"col":4,"comment":"\n        Return the number of coefficients in one parameter set\n        ","endLoc":105,"header":"def get_num_coeff(self, ndim)","id":4042,"name":"get_num_coeff","nodeType":"Function","startLoc":91,"text":"def get_num_coeff(self, ndim):\n        \"\"\"\n        Return the number of coefficients in one parameter set\n        \"\"\"\n\n        if self.degree < 0:\n            raise ValueError(\"Degree of polynomial must be positive or null\")\n        # deg+1 is used to account for the difference between iraf using\n        # degree and numpy using exact degree\n        if ndim != 1:\n            nmixed = comb(self.degree, ndim)\n        else:\n            nmixed = 0\n        numc = self.degree * ndim + nmixed + 1\n        return numc"},{"col":4,"comment":"\n        Return a copy of this model with a new name.\n        ","endLoc":2213,"header":"@sharedmethod\n    def rename(self, name)","id":4043,"name":"rename","nodeType":"Function","startLoc":2206,"text":"@sharedmethod\n    def rename(self, name):\n        \"\"\"\n        Return a copy of this model with a new name.\n        \"\"\"\n        new_model = self.copy()\n        new_model._name = name\n        return new_model"},{"col":0,"comment":"\n    The number of combinations of N things taken k at a time.\n\n    Parameters\n    ----------\n    N : int, array\n        Number of things.\n    k : int, array\n        Number of elements taken.\n\n    ","endLoc":234,"header":"def comb(N, k)","id":4044,"name":"comb","nodeType":"Function","startLoc":217,"text":"def comb(N, k):\n    \"\"\"\n    The number of combinations of N things taken k at a time.\n\n    Parameters\n    ----------\n    N : int, array\n        Number of things.\n    k : int, array\n        Number of elements taken.\n\n    \"\"\"\n    if (k > N) or (N < 0) or (k < 0):\n        return 0\n    val = 1\n    for j in range(min(k, N - k)):\n        val = (val * (N - j)) / (j + 1)\n    return val"},{"col":4,"comment":"\n        Attach units to this (unitless) model.\n\n        Parameters\n        ----------\n        input_units : dict or tuple, optional\n            Input units to attach.  If dict, each key is the name of a model input,\n            and the value is the unit to attach.  If tuple, the elements are units\n            to attach in order corresponding to `Model.inputs`.\n        return_units : dict or tuple, optional\n            Output units to attach.  If dict, each key is the name of a model output,\n            and the value is the unit to attach.  If tuple, the elements are units\n            to attach in order corresponding to `Model.outputs`.\n        input_units_equivalencies : dict, optional\n            Default equivalencies to apply to input values.  If set, this should be a\n            dictionary where each key is a string that corresponds to one of the\n            model inputs.\n        input_units_allow_dimensionless : bool or dict, optional\n            Allow dimensionless input. If this is True, input values to evaluate will\n            gain the units specified in input_units. If this is a dictionary then it\n            should map input name to a bool to allow dimensionless numbers for that\n            input.\n\n        Returns\n        -------\n        `CompoundModel`\n            A `CompoundModel` composed of the current model plus\n            `~astropy.modeling.mappings.UnitsMapping` model(s) that attach the units.\n\n        Raises\n        ------\n        ValueError\n            If the current model already has units.\n\n        Examples\n        --------\n\n        Wrapping a unitless model to require and convert units:\n\n        >>> from astropy.modeling.models import Polynomial1D\n        >>> from astropy import units as u\n        >>> poly = Polynomial1D(1, c0=1, c1=2)\n        >>> model = poly.coerce_units((u.m,), (u.s,))\n        >>> model(u.Quantity(10, u.m))  # doctest: +FLOAT_CMP\n        <Quantity 21. s>\n        >>> model(u.Quantity(1000, u.cm))  # doctest: +FLOAT_CMP\n        <Quantity 21. s>\n        >>> model(u.Quantity(10, u.cm))  # doctest: +FLOAT_CMP\n        <Quantity 1.2 s>\n\n        Wrapping a unitless model but still permitting unitless input:\n\n        >>> from astropy.modeling.models import Polynomial1D\n        >>> from astropy import units as u\n        >>> poly = Polynomial1D(1, c0=1, c1=2)\n        >>> model = poly.coerce_units((u.m,), (u.s,), input_units_allow_dimensionless=True)\n        >>> model(u.Quantity(10, u.m))  # doctest: +FLOAT_CMP\n        <Quantity 21. s>\n        >>> model(10)  # doctest: +FLOAT_CMP\n        <Quantity 21. s>\n        ","endLoc":2355,"header":"def coerce_units(\n        self,\n        input_units=None,\n        return_units=None,\n        input_units_equivalencies=None,\n        input_units_allow_dimensionless=False\n    )","id":4045,"name":"coerce_units","nodeType":"Function","startLoc":2215,"text":"def coerce_units(\n        self,\n        input_units=None,\n        return_units=None,\n        input_units_equivalencies=None,\n        input_units_allow_dimensionless=False\n    ):\n        \"\"\"\n        Attach units to this (unitless) model.\n\n        Parameters\n        ----------\n        input_units : dict or tuple, optional\n            Input units to attach.  If dict, each key is the name of a model input,\n            and the value is the unit to attach.  If tuple, the elements are units\n            to attach in order corresponding to `Model.inputs`.\n        return_units : dict or tuple, optional\n            Output units to attach.  If dict, each key is the name of a model output,\n            and the value is the unit to attach.  If tuple, the elements are units\n            to attach in order corresponding to `Model.outputs`.\n        input_units_equivalencies : dict, optional\n            Default equivalencies to apply to input values.  If set, this should be a\n            dictionary where each key is a string that corresponds to one of the\n            model inputs.\n        input_units_allow_dimensionless : bool or dict, optional\n            Allow dimensionless input. If this is True, input values to evaluate will\n            gain the units specified in input_units. If this is a dictionary then it\n            should map input name to a bool to allow dimensionless numbers for that\n            input.\n\n        Returns\n        -------\n        `CompoundModel`\n            A `CompoundModel` composed of the current model plus\n            `~astropy.modeling.mappings.UnitsMapping` model(s) that attach the units.\n\n        Raises\n        ------\n        ValueError\n            If the current model already has units.\n\n        Examples\n        --------\n\n        Wrapping a unitless model to require and convert units:\n\n        >>> from astropy.modeling.models import Polynomial1D\n        >>> from astropy import units as u\n        >>> poly = Polynomial1D(1, c0=1, c1=2)\n        >>> model = poly.coerce_units((u.m,), (u.s,))\n        >>> model(u.Quantity(10, u.m))  # doctest: +FLOAT_CMP\n        <Quantity 21. s>\n        >>> model(u.Quantity(1000, u.cm))  # doctest: +FLOAT_CMP\n        <Quantity 21. s>\n        >>> model(u.Quantity(10, u.cm))  # doctest: +FLOAT_CMP\n        <Quantity 1.2 s>\n\n        Wrapping a unitless model but still permitting unitless input:\n\n        >>> from astropy.modeling.models import Polynomial1D\n        >>> from astropy import units as u\n        >>> poly = Polynomial1D(1, c0=1, c1=2)\n        >>> model = poly.coerce_units((u.m,), (u.s,), input_units_allow_dimensionless=True)\n        >>> model(u.Quantity(10, u.m))  # doctest: +FLOAT_CMP\n        <Quantity 21. s>\n        >>> model(10)  # doctest: +FLOAT_CMP\n        <Quantity 21. s>\n        \"\"\"\n        from .mappings import UnitsMapping\n\n        result = self\n\n        if input_units is not None:\n            if self.input_units is not None:\n                model_units = self.input_units\n            else:\n                model_units = {}\n\n            for unit in [model_units.get(i) for i in self.inputs]:\n                if unit is not None and unit != dimensionless_unscaled:\n                    raise ValueError(\"Cannot specify input_units for model with existing input units\")\n\n            if isinstance(input_units, dict):\n                if input_units.keys() != set(self.inputs):\n                    message = (\n                        f\"\"\"input_units keys ({\", \".join(input_units.keys())}) \"\"\"\n                        f\"\"\"do not match model inputs ({\", \".join(self.inputs)})\"\"\"\n                    )\n                    raise ValueError(message)\n                input_units = [input_units[i] for i in self.inputs]\n\n            if len(input_units) != self.n_inputs:\n                message = (\n                    \"input_units length does not match n_inputs: \"\n                    f\"expected {self.n_inputs}, received {len(input_units)}\"\n                )\n                raise ValueError(message)\n\n            mapping = tuple((unit, model_units.get(i)) for i, unit in zip(self.inputs, input_units))\n            input_mapping = UnitsMapping(\n                mapping,\n                input_units_equivalencies=input_units_equivalencies,\n                input_units_allow_dimensionless=input_units_allow_dimensionless\n            )\n            input_mapping.inputs = self.inputs\n            input_mapping.outputs = self.inputs\n            result = input_mapping | result\n\n        if return_units is not None:\n            if self.return_units is not None:\n                model_units = self.return_units\n            else:\n                model_units = {}\n\n            for unit in [model_units.get(i) for i in self.outputs]:\n                if unit is not None and unit != dimensionless_unscaled:\n                    raise ValueError(\"Cannot specify return_units for model with existing output units\")\n\n            if isinstance(return_units, dict):\n                if return_units.keys() != set(self.outputs):\n                    message = (\n                        f\"\"\"return_units keys ({\", \".join(return_units.keys())}) \"\"\"\n                        f\"\"\"do not match model outputs ({\", \".join(self.outputs)})\"\"\"\n                    )\n                    raise ValueError(message)\n                return_units = [return_units[i] for i in self.outputs]\n\n            if len(return_units) != self.n_outputs:\n                message = (\n                    \"return_units length does not match n_outputs: \"\n                    f\"expected {self.n_outputs}, received {len(return_units)}\"\n                )\n                raise ValueError(message)\n\n            mapping = tuple((model_units.get(i), unit) for i, unit in zip(self.outputs, return_units))\n            return_mapping = UnitsMapping(mapping)\n            return_mapping.inputs = self.outputs\n            return_mapping.outputs = self.outputs\n            result = result | return_mapping\n\n        return result"},{"col":4,"comment":"null","endLoc":130,"header":"def _generate_coeff_names(self, ndim)","id":4046,"name":"_generate_coeff_names","nodeType":"Function","startLoc":116,"text":"def _generate_coeff_names(self, ndim):\n        names = []\n        if ndim == 1:\n            for n in range(self._order):\n                names.append(f'c{n}')\n        else:\n            for i in range(self.degree + 1):\n                names.append(f'c{i}_{0}')\n            for i in range(1, self.degree + 1):\n                names.append(f'c{0}_{i}')\n            for i in range(1, self.degree):\n                for j in range(1, self.degree):\n                    if i + j < self.degree + 1:\n                        names.append(f'c{i}_{j}')\n        return tuple(names)"},{"col":4,"comment":"null","endLoc":3565,"header":"def _initialize_slices(self)","id":4047,"name":"_initialize_slices","nodeType":"Function","startLoc":3550,"text":"def _initialize_slices(self):\n        param_metrics = self._param_metrics\n        total_size = 0\n\n        for name in self.param_names:\n            param = getattr(self, name)\n            value = param.value\n            param_size = np.size(value)\n            param_shape = np.shape(value)\n            param_slice = slice(total_size, total_size + param_size)\n            param_metrics[name] = {}\n            param_metrics[name]['slice'] = param_slice\n            param_metrics[name]['shape'] = param_shape\n            param_metrics[name]['size'] = param_size\n            total_size += param_size\n        self._parameters = np.empty(total_size, dtype=np.float64)"},{"col":4,"comment":"null","endLoc":506,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":4048,"name":"to_tree_transform","nodeType":"Function","startLoc":501,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'sigma': _parameter_to_value(model.sigma)}\n        return node"},{"col":4,"comment":"null","endLoc":3023,"header":"def _get_left_inputs_from_args(self, args)","id":4049,"name":"_get_left_inputs_from_args","nodeType":"Function","startLoc":3022,"text":"def _get_left_inputs_from_args(self, args):\n        return args[:self.left.n_inputs]"},{"col":4,"comment":"null","endLoc":3033,"header":"def _get_right_inputs_from_args(self, args)","id":4050,"name":"_get_right_inputs_from_args","nodeType":"Function","startLoc":3025,"text":"def _get_right_inputs_from_args(self, args):\n        op = self.op\n        if op == '&':\n            # Args expected to look like (*left inputs, *right inputs, *left params, *right params)\n            return args[self.left.n_inputs: self.left.n_inputs + self.right.n_inputs]\n        elif op == '|' or  op == 'fix_inputs':\n            return None\n        else:\n            return args[:self.left.n_inputs]"},{"col":4,"comment":"null","endLoc":3042,"header":"def _get_left_params_from_args(self, args)","id":4051,"name":"_get_left_params_from_args","nodeType":"Function","startLoc":3035,"text":"def _get_left_params_from_args(self, args):\n        op = self.op\n        if op == '&':\n            # Args expected to look like (*left inputs, *right inputs, *left params, *right params)\n            n_inputs = self.left.n_inputs + self.right.n_inputs\n            return args[n_inputs: n_inputs + self.n_left_params]\n        else:\n            return args[self.left.n_inputs: self.left.n_inputs + self.n_left_params]"},{"col":4,"comment":"null","endLoc":3052,"header":"def _get_right_params_from_args(self, args)","id":4052,"name":"_get_right_params_from_args","nodeType":"Function","startLoc":3044,"text":"def _get_right_params_from_args(self, args):\n        op = self.op\n        if op == 'fix_inputs':\n            return None\n        if op == '&':\n            # Args expected to look like (*left inputs, *right inputs, *left params, *right params)\n            return args[self.left.n_inputs + self.right.n_inputs + self.n_left_params:]\n        else:\n            return args[self.left.n_inputs + self.n_left_params:]"},{"col":4,"comment":"null","endLoc":3078,"header":"def _get_kwarg_model_parameters_as_positional(self, args, kwargs)","id":4053,"name":"_get_kwarg_model_parameters_as_positional","nodeType":"Function","startLoc":3054,"text":"def _get_kwarg_model_parameters_as_positional(self, args, kwargs):\n        # could do it with inserts but rebuilding seems like simpilist way\n\n        #TODO: Check if any param names are in kwargs maybe as an intersection of sets?\n        if self.op == \"&\":\n            new_args = list(args[:self.left.n_inputs + self.right.n_inputs])\n            args_pos = self.left.n_inputs + self.right.n_inputs\n        else:\n            new_args = list(args[:self.left.n_inputs])\n            args_pos = self.left.n_inputs\n\n        for param_name in self.param_names:\n            kw_value = kwargs.pop(param_name, None)\n            if kw_value is not None:\n                value = kw_value\n            else:\n                try:\n                    value = args[args_pos]\n                except IndexError:\n                    raise IndexError(\"Missing parameter or input\")\n\n                args_pos += 1\n            new_args.append(value)\n\n        return new_args, kwargs"},{"col":4,"comment":"null","endLoc":516,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4054,"name":"assert_equal","nodeType":"Function","startLoc":508,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.RickerWavelet1D) and\n                isinstance(b, functional_models.RickerWavelet1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.sigma, b.sigma)"},{"attributeType":"null","col":4,"comment":"null","endLoc":491,"id":4055,"name":"name","nodeType":"Attribute","startLoc":491,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":492,"id":4056,"name":"version","nodeType":"Attribute","startLoc":492,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":493,"id":4057,"name":"types","nodeType":"Attribute","startLoc":493,"text":"types"},{"className":"RickerWavelet2DType","col":0,"comment":"null","endLoc":548,"id":4058,"nodeType":"Class","startLoc":519,"text":"class RickerWavelet2DType(TransformType):\n    name = 'transform/ricker_wavelet2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.RickerWavelet2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.RickerWavelet2D(amplitude=node['amplitude'],\n                                                 x_0=node['x_0'],\n                                                 y_0=node['y_0'],\n                                                 sigma=node['sigma'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'sigma': _parameter_to_value(model.sigma)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.RickerWavelet2D) and\n                isinstance(b, functional_models.RickerWavelet2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.sigma, b.sigma)"},{"col":4,"comment":"null","endLoc":529,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4059,"name":"from_tree_transform","nodeType":"Function","startLoc":524,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.RickerWavelet2D(amplitude=node['amplitude'],\n                                                 x_0=node['x_0'],\n                                                 y_0=node['y_0'],\n                                                 sigma=node['sigma'])"},{"attributeType":"null","col":8,"comment":"null","endLoc":585,"id":4060,"name":"_intervals","nodeType":"Attribute","startLoc":585,"text":"self._intervals"},{"className":"TabularType","col":0,"comment":"null","endLoc":89,"id":4061,"nodeType":"Class","startLoc":15,"text":"class TabularType(TransformType):\n    name = \"transform/tabular\"\n    version = '1.2.0'\n    types = [\n        modeling.models.Tabular2D, modeling.models.Tabular1D\n    ]\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        lookup_table = node.pop(\"lookup_table\")\n        dim = lookup_table.ndim\n        fill_value = node.pop(\"fill_value\", None)\n        if dim == 1:\n            # The copy is necessary because the array is memory mapped.\n            points = (node['points'][0][:],)\n            model = modeling.models.Tabular1D(points=points, lookup_table=lookup_table,\n                                              method=node['method'], bounds_error=node['bounds_error'],\n                                              fill_value=fill_value)\n        elif dim == 2:\n            points = tuple([p[:] for p in node['points']])\n            model = modeling.models.Tabular2D(points=points, lookup_table=lookup_table,\n                                              method=node['method'], bounds_error=node['bounds_error'],\n                                              fill_value=fill_value)\n\n        else:\n            tabular_class = modeling.models.tabular_model(dim, name)\n            points = tuple([p[:] for p in node['points']])\n            model = tabular_class(points=points, lookup_table=lookup_table,\n                                  method=node['method'], bounds_error=node['bounds_error'],\n                                  fill_value=fill_value)\n\n        return model\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {}\n        if model.fill_value is not None:\n            node[\"fill_value\"] = model.fill_value\n        node[\"lookup_table\"] = model.lookup_table\n        node[\"points\"] = [p for p in model.points]\n        node[\"method\"] = str(model.method)\n        node[\"bounds_error\"] = model.bounds_error\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        if isinstance(a.lookup_table, u.Quantity):\n            assert u.allclose(a.lookup_table, b.lookup_table)\n            assert u.allclose(a.points, b.points)\n            a_box = a.bounding_box\n            if isinstance(a_box, ModelBoundingBox):\n                a_box = a_box.bounding_box()\n            b_box = b.bounding_box\n            if isinstance(b_box, ModelBoundingBox):\n                b_box = b_box.bounding_box()\n            for i in range(len(a_box)):\n                assert u.allclose(a_box[i], b_box[i])\n        else:\n            assert_array_equal(a.lookup_table, b.lookup_table)\n            assert_array_equal(a.points, b.points)\n            a_box = a.bounding_box\n            if isinstance(a_box, ModelBoundingBox):\n                a_box = a_box.bounding_box()\n            b_box = b.bounding_box\n            if isinstance(b_box, ModelBoundingBox):\n                b_box = b_box.bounding_box()\n            assert_array_equal(a_box, b_box)\n        assert (a.method == b.method)\n        if a.fill_value is None:\n            assert b.fill_value is None\n        elif np.isnan(a.fill_value):\n            assert np.isnan(b.fill_value)\n        else:\n            assert(a.fill_value == b.fill_value)\n        assert(a.bounds_error == b.bounds_error)"},{"col":4,"comment":"null","endLoc":537,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":4062,"name":"to_tree_transform","nodeType":"Function","startLoc":531,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'sigma': _parameter_to_value(model.sigma)}\n        return node"},{"col":4,"comment":"null","endLoc":548,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4063,"name":"assert_equal","nodeType":"Function","startLoc":539,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.RickerWavelet2D) and\n                isinstance(b, functional_models.RickerWavelet2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.sigma, b.sigma)"},{"col":4,"comment":"null","endLoc":46,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4064,"name":"from_tree_transform","nodeType":"Function","startLoc":22,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        lookup_table = node.pop(\"lookup_table\")\n        dim = lookup_table.ndim\n        fill_value = node.pop(\"fill_value\", None)\n        if dim == 1:\n            # The copy is necessary because the array is memory mapped.\n            points = (node['points'][0][:],)\n            model = modeling.models.Tabular1D(points=points, lookup_table=lookup_table,\n                                              method=node['method'], bounds_error=node['bounds_error'],\n                                              fill_value=fill_value)\n        elif dim == 2:\n            points = tuple([p[:] for p in node['points']])\n            model = modeling.models.Tabular2D(points=points, lookup_table=lookup_table,\n                                              method=node['method'], bounds_error=node['bounds_error'],\n                                              fill_value=fill_value)\n\n        else:\n            tabular_class = modeling.models.tabular_model(dim, name)\n            points = tuple([p[:] for p in node['points']])\n            model = tabular_class(points=points, lookup_table=lookup_table,\n                                  method=node['method'], bounds_error=node['bounds_error'],\n                                  fill_value=fill_value)\n\n        return model"},{"attributeType":"null","col":4,"comment":"null","endLoc":520,"id":4065,"name":"name","nodeType":"Attribute","startLoc":520,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":521,"id":4066,"name":"version","nodeType":"Attribute","startLoc":521,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":522,"id":4067,"name":"types","nodeType":"Attribute","startLoc":522,"text":"types"},{"className":"Ring2DType","col":0,"comment":"null","endLoc":583,"id":4068,"nodeType":"Class","startLoc":551,"text":"class Ring2DType(TransformType):\n    name = 'transform/ring2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Ring2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Ring2D(amplitude=node['amplitude'],\n                                        x_0=node['x_0'],\n                                        y_0=node['y_0'],\n                                        r_in=node['r_in'],\n                                        width=node['width'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'r_in': _parameter_to_value(model.r_in),\n                'width': _parameter_to_value(model.width)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Ring2D) and\n                isinstance(b, functional_models.Ring2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.r_in, b.r_in)\n        assert_array_equal(a.width, b.width)"},{"col":4,"comment":"null","endLoc":562,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4069,"name":"from_tree_transform","nodeType":"Function","startLoc":556,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Ring2D(amplitude=node['amplitude'],\n                                        x_0=node['x_0'],\n                                        y_0=node['y_0'],\n                                        r_in=node['r_in'],\n                                        width=node['width'])"},{"id":4070,"name":"astropy/io/misc/asdf/tags/coordinates","nodeType":"Package"},{"fileName":"skycoord.py","filePath":"astropy/io/misc/asdf/tags/coordinates","id":4071,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\nfrom astropy.coordinates import SkyCoord\nfrom astropy.io.misc.asdf.tags.helpers import skycoord_equal\n\nfrom ...types import AstropyType\n\n\nclass SkyCoordType(AstropyType):\n    name = 'coordinates/skycoord'\n    types = [SkyCoord]\n    version = \"1.0.0\"\n\n    @classmethod\n    def to_tree(cls, obj, ctx):\n        return obj.info._represent_as_dict()\n\n    @classmethod\n    def from_tree(cls, tree, ctx):\n        return SkyCoord.info._construct_from_dict(tree)\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        assert skycoord_equal(old, new)\n"},{"className":"SkyCoord","col":0,"comment":"High-level object providing a flexible interface for celestial coordinate\n    representation, manipulation, and transformation between systems.\n\n    The `SkyCoord` class accepts a wide variety of inputs for initialization. At\n    a minimum these must provide one or more celestial coordinate values with\n    unambiguous units.  Inputs may be scalars or lists/tuples/arrays, yielding\n    scalar or array coordinates (can be checked via ``SkyCoord.isscalar``).\n    Typically one also specifies the coordinate frame, though this is not\n    required. The general pattern for spherical representations is::\n\n      SkyCoord(COORD, [FRAME], keyword_args ...)\n      SkyCoord(LON, LAT, [FRAME], keyword_args ...)\n      SkyCoord(LON, LAT, [DISTANCE], frame=FRAME, unit=UNIT, keyword_args ...)\n      SkyCoord([FRAME], <lon_attr>=LON, <lat_attr>=LAT, keyword_args ...)\n\n    It is also possible to input coordinate values in other representations\n    such as cartesian or cylindrical.  In this case one includes the keyword\n    argument ``representation_type='cartesian'`` (for example) along with data\n    in ``x``, ``y``, and ``z``.\n\n    See also: https://docs.astropy.org/en/stable/coordinates/\n\n    Examples\n    --------\n    The examples below illustrate common ways of initializing a `SkyCoord`\n    object.  For a complete description of the allowed syntax see the\n    full coordinates documentation.  First some imports::\n\n      >>> from astropy.coordinates import SkyCoord  # High-level coordinates\n      >>> from astropy.coordinates import ICRS, Galactic, FK4, FK5  # Low-level frames\n      >>> from astropy.coordinates import Angle, Latitude, Longitude  # Angles\n      >>> import astropy.units as u\n\n    The coordinate values and frame specification can now be provided using\n    positional and keyword arguments::\n\n      >>> c = SkyCoord(10, 20, unit=\"deg\")  # defaults to ICRS frame\n      >>> c = SkyCoord([1, 2, 3], [-30, 45, 8], frame=\"icrs\", unit=\"deg\")  # 3 coords\n\n      >>> coords = [\"1:12:43.2 +31:12:43\", \"1 12 43.2 +31 12 43\"]\n      >>> c = SkyCoord(coords, frame=FK4, unit=(u.hourangle, u.deg), obstime=\"J1992.21\")\n\n      >>> c = SkyCoord(\"1h12m43.2s +1d12m43s\", frame=Galactic)  # Units from string\n      >>> c = SkyCoord(frame=\"galactic\", l=\"1h12m43.2s\", b=\"+1d12m43s\")\n\n      >>> ra = Longitude([1, 2, 3], unit=u.deg)  # Could also use Angle\n      >>> dec = np.array([4.5, 5.2, 6.3]) * u.deg  # Astropy Quantity\n      >>> c = SkyCoord(ra, dec, frame='icrs')\n      >>> c = SkyCoord(frame=ICRS, ra=ra, dec=dec, obstime='2001-01-02T12:34:56')\n\n      >>> c = FK4(1 * u.deg, 2 * u.deg)  # Uses defaults for obstime, equinox\n      >>> c = SkyCoord(c, obstime='J2010.11', equinox='B1965')  # Override defaults\n\n      >>> c = SkyCoord(w=0, u=1, v=2, unit='kpc', frame='galactic',\n      ...              representation_type='cartesian')\n\n      >>> c = SkyCoord([ICRS(ra=1*u.deg, dec=2*u.deg), ICRS(ra=3*u.deg, dec=4*u.deg)])\n\n    Velocity components (proper motions or radial velocities) can also be\n    provided in a similar manner::\n\n      >>> c = SkyCoord(ra=1*u.deg, dec=2*u.deg, radial_velocity=10*u.km/u.s)\n\n      >>> c = SkyCoord(ra=1*u.deg, dec=2*u.deg, pm_ra_cosdec=2*u.mas/u.yr, pm_dec=1*u.mas/u.yr)\n\n    As shown, the frame can be a `~astropy.coordinates.BaseCoordinateFrame`\n    class or the corresponding string alias.  The frame classes that are built in\n    to astropy are `ICRS`, `FK5`, `FK4`, `FK4NoETerms`, and `Galactic`.\n    The string aliases are simply lower-case versions of the class name, and\n    allow for creating a `SkyCoord` object and transforming frames without\n    explicitly importing the frame classes.\n\n    Parameters\n    ----------\n    frame : `~astropy.coordinates.BaseCoordinateFrame` class or string, optional\n        Type of coordinate frame this `SkyCoord` should represent. Defaults to\n        to ICRS if not given or given as None.\n    unit : `~astropy.units.Unit`, string, or tuple of :class:`~astropy.units.Unit` or str, optional\n        Units for supplied coordinate values.\n        If only one unit is supplied then it applies to all values.\n        Note that passing only one unit might lead to unit conversion errors\n        if the coordinate values are expected to have mixed physical meanings\n        (e.g., angles and distances).\n    obstime : time-like, optional\n        Time(s) of observation.\n    equinox : time-like, optional\n        Coordinate frame equinox time.\n    representation_type : str or Representation class\n        Specifies the representation, e.g. 'spherical', 'cartesian', or\n        'cylindrical'.  This affects the positional args and other keyword args\n        which must correspond to the given representation.\n    copy : bool, optional\n        If `True` (default), a copy of any coordinate data is made.  This\n        argument can only be passed in as a keyword argument.\n    **keyword_args\n        Other keyword arguments as applicable for user-defined coordinate frames.\n        Common options include:\n\n        ra, dec : angle-like, optional\n            RA and Dec for frames where ``ra`` and ``dec`` are keys in the\n            frame's ``representation_component_names``, including `ICRS`,\n            `FK5`, `FK4`, and `FK4NoETerms`.\n        pm_ra_cosdec, pm_dec  : `~astropy.units.Quantity` ['angular speed'], optional\n            Proper motion components, in angle per time units.\n        l, b : angle-like, optional\n            Galactic ``l`` and ``b`` for for frames where ``l`` and ``b`` are\n            keys in the frame's ``representation_component_names``, including\n            the `Galactic` frame.\n        pm_l_cosb, pm_b : `~astropy.units.Quantity` ['angular speed'], optional\n            Proper motion components in the `Galactic` frame, in angle per time\n            units.\n        x, y, z : float or `~astropy.units.Quantity` ['length'], optional\n            Cartesian coordinates values\n        u, v, w : float or `~astropy.units.Quantity` ['length'], optional\n            Cartesian coordinates values for the Galactic frame.\n        radial_velocity : `~astropy.units.Quantity` ['speed'], optional\n            The component of the velocity along the line-of-sight (i.e., the\n            radial direction), in velocity units.\n    ","endLoc":2131,"id":4072,"nodeType":"Class","startLoc":161,"text":"class SkyCoord(ShapedLikeNDArray):\n    \"\"\"High-level object providing a flexible interface for celestial coordinate\n    representation, manipulation, and transformation between systems.\n\n    The `SkyCoord` class accepts a wide variety of inputs for initialization. At\n    a minimum these must provide one or more celestial coordinate values with\n    unambiguous units.  Inputs may be scalars or lists/tuples/arrays, yielding\n    scalar or array coordinates (can be checked via ``SkyCoord.isscalar``).\n    Typically one also specifies the coordinate frame, though this is not\n    required. The general pattern for spherical representations is::\n\n      SkyCoord(COORD, [FRAME], keyword_args ...)\n      SkyCoord(LON, LAT, [FRAME], keyword_args ...)\n      SkyCoord(LON, LAT, [DISTANCE], frame=FRAME, unit=UNIT, keyword_args ...)\n      SkyCoord([FRAME], <lon_attr>=LON, <lat_attr>=LAT, keyword_args ...)\n\n    It is also possible to input coordinate values in other representations\n    such as cartesian or cylindrical.  In this case one includes the keyword\n    argument ``representation_type='cartesian'`` (for example) along with data\n    in ``x``, ``y``, and ``z``.\n\n    See also: https://docs.astropy.org/en/stable/coordinates/\n\n    Examples\n    --------\n    The examples below illustrate common ways of initializing a `SkyCoord`\n    object.  For a complete description of the allowed syntax see the\n    full coordinates documentation.  First some imports::\n\n      >>> from astropy.coordinates import SkyCoord  # High-level coordinates\n      >>> from astropy.coordinates import ICRS, Galactic, FK4, FK5  # Low-level frames\n      >>> from astropy.coordinates import Angle, Latitude, Longitude  # Angles\n      >>> import astropy.units as u\n\n    The coordinate values and frame specification can now be provided using\n    positional and keyword arguments::\n\n      >>> c = SkyCoord(10, 20, unit=\"deg\")  # defaults to ICRS frame\n      >>> c = SkyCoord([1, 2, 3], [-30, 45, 8], frame=\"icrs\", unit=\"deg\")  # 3 coords\n\n      >>> coords = [\"1:12:43.2 +31:12:43\", \"1 12 43.2 +31 12 43\"]\n      >>> c = SkyCoord(coords, frame=FK4, unit=(u.hourangle, u.deg), obstime=\"J1992.21\")\n\n      >>> c = SkyCoord(\"1h12m43.2s +1d12m43s\", frame=Galactic)  # Units from string\n      >>> c = SkyCoord(frame=\"galactic\", l=\"1h12m43.2s\", b=\"+1d12m43s\")\n\n      >>> ra = Longitude([1, 2, 3], unit=u.deg)  # Could also use Angle\n      >>> dec = np.array([4.5, 5.2, 6.3]) * u.deg  # Astropy Quantity\n      >>> c = SkyCoord(ra, dec, frame='icrs')\n      >>> c = SkyCoord(frame=ICRS, ra=ra, dec=dec, obstime='2001-01-02T12:34:56')\n\n      >>> c = FK4(1 * u.deg, 2 * u.deg)  # Uses defaults for obstime, equinox\n      >>> c = SkyCoord(c, obstime='J2010.11', equinox='B1965')  # Override defaults\n\n      >>> c = SkyCoord(w=0, u=1, v=2, unit='kpc', frame='galactic',\n      ...              representation_type='cartesian')\n\n      >>> c = SkyCoord([ICRS(ra=1*u.deg, dec=2*u.deg), ICRS(ra=3*u.deg, dec=4*u.deg)])\n\n    Velocity components (proper motions or radial velocities) can also be\n    provided in a similar manner::\n\n      >>> c = SkyCoord(ra=1*u.deg, dec=2*u.deg, radial_velocity=10*u.km/u.s)\n\n      >>> c = SkyCoord(ra=1*u.deg, dec=2*u.deg, pm_ra_cosdec=2*u.mas/u.yr, pm_dec=1*u.mas/u.yr)\n\n    As shown, the frame can be a `~astropy.coordinates.BaseCoordinateFrame`\n    class or the corresponding string alias.  The frame classes that are built in\n    to astropy are `ICRS`, `FK5`, `FK4`, `FK4NoETerms`, and `Galactic`.\n    The string aliases are simply lower-case versions of the class name, and\n    allow for creating a `SkyCoord` object and transforming frames without\n    explicitly importing the frame classes.\n\n    Parameters\n    ----------\n    frame : `~astropy.coordinates.BaseCoordinateFrame` class or string, optional\n        Type of coordinate frame this `SkyCoord` should represent. Defaults to\n        to ICRS if not given or given as None.\n    unit : `~astropy.units.Unit`, string, or tuple of :class:`~astropy.units.Unit` or str, optional\n        Units for supplied coordinate values.\n        If only one unit is supplied then it applies to all values.\n        Note that passing only one unit might lead to unit conversion errors\n        if the coordinate values are expected to have mixed physical meanings\n        (e.g., angles and distances).\n    obstime : time-like, optional\n        Time(s) of observation.\n    equinox : time-like, optional\n        Coordinate frame equinox time.\n    representation_type : str or Representation class\n        Specifies the representation, e.g. 'spherical', 'cartesian', or\n        'cylindrical'.  This affects the positional args and other keyword args\n        which must correspond to the given representation.\n    copy : bool, optional\n        If `True` (default), a copy of any coordinate data is made.  This\n        argument can only be passed in as a keyword argument.\n    **keyword_args\n        Other keyword arguments as applicable for user-defined coordinate frames.\n        Common options include:\n\n        ra, dec : angle-like, optional\n            RA and Dec for frames where ``ra`` and ``dec`` are keys in the\n            frame's ``representation_component_names``, including `ICRS`,\n            `FK5`, `FK4`, and `FK4NoETerms`.\n        pm_ra_cosdec, pm_dec  : `~astropy.units.Quantity` ['angular speed'], optional\n            Proper motion components, in angle per time units.\n        l, b : angle-like, optional\n            Galactic ``l`` and ``b`` for for frames where ``l`` and ``b`` are\n            keys in the frame's ``representation_component_names``, including\n            the `Galactic` frame.\n        pm_l_cosb, pm_b : `~astropy.units.Quantity` ['angular speed'], optional\n            Proper motion components in the `Galactic` frame, in angle per time\n            units.\n        x, y, z : float or `~astropy.units.Quantity` ['length'], optional\n            Cartesian coordinates values\n        u, v, w : float or `~astropy.units.Quantity` ['length'], optional\n            Cartesian coordinates values for the Galactic frame.\n        radial_velocity : `~astropy.units.Quantity` ['speed'], optional\n            The component of the velocity along the line-of-sight (i.e., the\n            radial direction), in velocity units.\n    \"\"\"\n\n    # Declare that SkyCoord can be used as a Table column by defining the\n    # info property.\n    info = SkyCoordInfo()\n\n    def __init__(self, *args, copy=True, **kwargs):\n\n        # these are frame attributes set on this SkyCoord but *not* a part of\n        # the frame object this SkyCoord contains\n        self._extra_frameattr_names = set()\n\n        # If all that is passed in is a frame instance that already has data,\n        # we should bypass all of the parsing and logic below. This is here\n        # to make this the fastest way to create a SkyCoord instance. Many of\n        # the classmethods implemented for performance enhancements will use\n        # this as the initialization path\n        if (len(args) == 1 and len(kwargs) == 0\n                and isinstance(args[0], (BaseCoordinateFrame, SkyCoord))):\n\n            coords = args[0]\n            if isinstance(coords, SkyCoord):\n                self._extra_frameattr_names = coords._extra_frameattr_names\n                self.info = coords.info\n\n                # Copy over any extra frame attributes\n                for attr_name in self._extra_frameattr_names:\n                    # Setting it will also validate it.\n                    setattr(self, attr_name, getattr(coords, attr_name))\n\n                coords = coords.frame\n\n            if not coords.has_data:\n                raise ValueError('Cannot initialize from a coordinate frame '\n                                 'instance without coordinate data')\n\n            if copy:\n                self._sky_coord_frame = coords.copy()\n            else:\n                self._sky_coord_frame = coords\n\n        else:\n            # Get the frame instance without coordinate data but with all frame\n            # attributes set - these could either have been passed in with the\n            # frame as an instance, or passed in as kwargs here\n            frame_cls, frame_kwargs = _get_frame_without_data(args, kwargs)\n\n            # Parse the args and kwargs to assemble a sanitized and validated\n            # kwargs dict for initializing attributes for this object and for\n            # creating the internal self._sky_coord_frame object\n            args = list(args)  # Make it mutable\n            skycoord_kwargs, components, info = _parse_coordinate_data(\n                frame_cls(**frame_kwargs), args, kwargs)\n\n            # In the above two parsing functions, these kwargs were identified\n            # as valid frame attributes for *some* frame, but not the frame that\n            # this SkyCoord will have. We keep these attributes as special\n            # skycoord frame attributes:\n            for attr in skycoord_kwargs:\n                # Setting it will also validate it.\n                setattr(self, attr, skycoord_kwargs[attr])\n\n            if info is not None:\n                self.info = info\n\n            # Finally make the internal coordinate object.\n            frame_kwargs.update(components)\n            self._sky_coord_frame = frame_cls(copy=copy, **frame_kwargs)\n\n            if not self._sky_coord_frame.has_data:\n                raise ValueError('Cannot create a SkyCoord without data')\n\n    @property\n    def frame(self):\n        return self._sky_coord_frame\n\n    @property\n    def representation_type(self):\n        return self.frame.representation_type\n\n    @representation_type.setter\n    def representation_type(self, value):\n        self.frame.representation_type = value\n\n    # TODO: remove these in future\n    @property\n    def representation(self):\n        return self.frame.representation\n\n    @representation.setter\n    def representation(self, value):\n        self.frame.representation = value\n\n    @property\n    def shape(self):\n        return self.frame.shape\n\n    def __eq__(self, value):\n        \"\"\"Equality operator for SkyCoord\n\n        This implements strict equality and requires that the frames are\n        equivalent, extra frame attributes are equivalent, and that the\n        representation data are exactly equal.\n        \"\"\"\n        if not isinstance(value, SkyCoord):\n            return NotImplemented\n        # Make sure that any extra frame attribute names are equivalent.\n        for attr in self._extra_frameattr_names | value._extra_frameattr_names:\n            if not self.frame._frameattr_equiv(getattr(self, attr),\n                                               getattr(value, attr)):\n                raise ValueError(f\"cannot compare: extra frame attribute \"\n                                 f\"'{attr}' is not equivalent \"\n                                 f\"(perhaps compare the frames directly to avoid \"\n                                 f\"this exception)\")\n\n        return self._sky_coord_frame == value._sky_coord_frame\n\n    def __ne__(self, value):\n        return np.logical_not(self == value)\n\n    def _apply(self, method, *args, **kwargs):\n        \"\"\"Create a new instance, applying a method to the underlying data.\n\n        In typical usage, the method is any of the shape-changing methods for\n        `~numpy.ndarray` (``reshape``, ``swapaxes``, etc.), as well as those\n        picking particular elements (``__getitem__``, ``take``, etc.), which\n        are all defined in `~astropy.utils.shapes.ShapedLikeNDArray`. It will be\n        applied to the underlying arrays in the representation (e.g., ``x``,\n        ``y``, and ``z`` for `~astropy.coordinates.CartesianRepresentation`),\n        as well as to any frame attributes that have a shape, with the results\n        used to create a new instance.\n\n        Internally, it is also used to apply functions to the above parts\n        (in particular, `~numpy.broadcast_to`).\n\n        Parameters\n        ----------\n        method : str or callable\n            If str, it is the name of a method that is applied to the internal\n            ``components``. If callable, the function is applied.\n        args : tuple\n            Any positional arguments for ``method``.\n        kwargs : dict\n            Any keyword arguments for ``method``.\n        \"\"\"\n        def apply_method(value):\n            if isinstance(value, ShapedLikeNDArray):\n                return value._apply(method, *args, **kwargs)\n            else:\n                if callable(method):\n                    return method(value, *args, **kwargs)\n                else:\n                    return getattr(value, method)(*args, **kwargs)\n\n        # create a new but empty instance, and copy over stuff\n        new = super().__new__(self.__class__)\n        new._sky_coord_frame = self._sky_coord_frame._apply(method,\n                                                            *args, **kwargs)\n        new._extra_frameattr_names = self._extra_frameattr_names.copy()\n        for attr in self._extra_frameattr_names:\n            value = getattr(self, attr)\n            if getattr(value, 'shape', ()):\n                value = apply_method(value)\n            elif method == 'copy' or method == 'flatten':\n                # flatten should copy also for a single element array, but\n                # we cannot use it directly for array scalars, since it\n                # always returns a one-dimensional array. So, just copy.\n                value = copy.copy(value)\n            setattr(new, '_' + attr, value)\n\n        # Copy other 'info' attr only if it has actually been defined.\n        # See PR #3898 for further explanation and justification, along\n        # with Quantity.__array_finalize__\n        if 'info' in self.__dict__:\n            new.info = self.info\n\n        return new\n\n    def __setitem__(self, item, value):\n        \"\"\"Implement self[item] = value for SkyCoord\n\n        The right hand ``value`` must be strictly consistent with self:\n        - Identical class\n        - Equivalent frames\n        - Identical representation_types\n        - Identical representation differentials keys\n        - Identical frame attributes\n        - Identical \"extra\" frame attributes (e.g. obstime for an ICRS coord)\n\n        With these caveats the setitem ends up as effectively a setitem on\n        the representation data.\n\n          self.frame.data[item] = value.frame.data\n        \"\"\"\n        if self.__class__ is not value.__class__:\n            raise TypeError(f'can only set from object of same class: '\n                            f'{self.__class__.__name__} vs. '\n                            f'{value.__class__.__name__}')\n\n        # Make sure that any extra frame attribute names are equivalent.\n        for attr in self._extra_frameattr_names | value._extra_frameattr_names:\n            if not self.frame._frameattr_equiv(getattr(self, attr),\n                                               getattr(value, attr)):\n                raise ValueError(f'attribute {attr} is not equivalent')\n\n        # Set the frame values.  This checks frame equivalence and also clears\n        # the cache to ensure that the object is not in an inconsistent state.\n        self._sky_coord_frame[item] = value._sky_coord_frame\n\n    def insert(self, obj, values, axis=0):\n        \"\"\"\n        Insert coordinate values before the given indices in the object and\n        return a new Frame object.\n\n        The values to be inserted must conform to the rules for in-place setting\n        of ``SkyCoord`` objects.\n\n        The API signature matches the ``np.insert`` API, but is more limited.\n        The specification of insert index ``obj`` must be a single integer,\n        and the ``axis`` must be ``0`` for simple insertion before the index.\n\n        Parameters\n        ----------\n        obj : int\n            Integer index before which ``values`` is inserted.\n        values : array-like\n            Value(s) to insert.  If the type of ``values`` is different\n            from that of quantity, ``values`` is converted to the matching type.\n        axis : int, optional\n            Axis along which to insert ``values``.  Default is 0, which is the\n            only allowed value and will insert a row.\n\n        Returns\n        -------\n        out : `~astropy.coordinates.SkyCoord` instance\n            New coordinate object with inserted value(s)\n\n        \"\"\"\n        # Validate inputs: obj arg is integer, axis=0, self is not a scalar, and\n        # input index is in bounds.\n        try:\n            idx0 = operator.index(obj)\n        except TypeError:\n            raise TypeError('obj arg must be an integer')\n\n        if axis != 0:\n            raise ValueError('axis must be 0')\n\n        if not self.shape:\n            raise TypeError('cannot insert into scalar {} object'\n                            .format(self.__class__.__name__))\n\n        if abs(idx0) > len(self):\n            raise IndexError('index {} is out of bounds for axis 0 with size {}'\n                             .format(idx0, len(self)))\n\n        # Turn negative index into positive\n        if idx0 < 0:\n            idx0 = len(self) + idx0\n\n        n_values = len(values) if values.shape else 1\n\n        # Finally make the new object with the correct length and set values for the\n        # three sections, before insert, the insert, and after the insert.\n        out = self.__class__.info.new_like([self], len(self) + n_values, name=self.info.name)\n\n        # Set the output values. This is where validation of `values` takes place to ensure\n        # that it can indeed be inserted.\n        out[:idx0] = self[:idx0]\n        out[idx0:idx0 + n_values] = values\n        out[idx0 + n_values:] = self[idx0:]\n\n        return out\n\n    def is_transformable_to(self, new_frame):\n        \"\"\"\n        Determines if this coordinate frame can be transformed to another\n        given frame.\n\n        Parameters\n        ----------\n        new_frame : frame class, frame object, or str\n            The proposed frame to transform into.\n\n        Returns\n        -------\n        transformable : bool or str\n            `True` if this can be transformed to ``new_frame``, `False` if\n            not, or the string 'same' if ``new_frame`` is the same system as\n            this object but no transformation is defined.\n\n        Notes\n        -----\n        A return value of 'same' means the transformation will work, but it will\n        just give back a copy of this object.  The intended usage is::\n\n            if coord.is_transformable_to(some_unknown_frame):\n                coord2 = coord.transform_to(some_unknown_frame)\n\n        This will work even if ``some_unknown_frame``  turns out to be the same\n        frame class as ``coord``.  This is intended for cases where the frame\n        is the same regardless of the frame attributes (e.g. ICRS), but be\n        aware that it *might* also indicate that someone forgot to define the\n        transformation between two objects of the same frame class but with\n        different attributes.\n        \"\"\"\n        # TODO! like matplotlib, do string overrides for modified methods\n        new_frame = (_get_frame_class(new_frame) if isinstance(new_frame, str)\n                     else new_frame)\n        return self.frame.is_transformable_to(new_frame)\n\n    def transform_to(self, frame, merge_attributes=True):\n        \"\"\"Transform this coordinate to a new frame.\n\n        The precise frame transformed to depends on ``merge_attributes``.\n        If `False`, the destination frame is used exactly as passed in.\n        But this is often not quite what one wants.  E.g., suppose one wants to\n        transform an ICRS coordinate that has an obstime attribute to FK4; in\n        this case, one likely would want to use this information. Thus, the\n        default for ``merge_attributes`` is `True`, in which the precedence is\n        as follows: (1) explicitly set (i.e., non-default) values in the\n        destination frame; (2) explicitly set values in the source; (3) default\n        value in the destination frame.\n\n        Note that in either case, any explicitly set attributes on the source\n        `SkyCoord` that are not part of the destination frame's definition are\n        kept (stored on the resulting `SkyCoord`), and thus one can round-trip\n        (e.g., from FK4 to ICRS to FK4 without losing obstime).\n\n        Parameters\n        ----------\n        frame : str, `BaseCoordinateFrame` class or instance, or `SkyCoord` instance\n            The frame to transform this coordinate into.  If a `SkyCoord`, the\n            underlying frame is extracted, and all other information ignored.\n        merge_attributes : bool, optional\n            Whether the default attributes in the destination frame are allowed\n            to be overridden by explicitly set attributes in the source\n            (see note above; default: `True`).\n\n        Returns\n        -------\n        coord : `SkyCoord`\n            A new object with this coordinate represented in the `frame` frame.\n\n        Raises\n        ------\n        ValueError\n            If there is no possible transformation route.\n\n        \"\"\"\n        from astropy.coordinates.errors import ConvertError\n\n        frame_kwargs = {}\n\n        # Frame name (string) or frame class?  Coerce into an instance.\n        try:\n            frame = _get_frame_class(frame)()\n        except Exception:\n            pass\n\n        if isinstance(frame, SkyCoord):\n            frame = frame.frame  # Change to underlying coord frame instance\n\n        if isinstance(frame, BaseCoordinateFrame):\n            new_frame_cls = frame.__class__\n            # Get frame attributes, allowing defaults to be overridden by\n            # explicitly set attributes of the source if ``merge_attributes``.\n            for attr in frame_transform_graph.frame_attributes:\n                self_val = getattr(self, attr, None)\n                frame_val = getattr(frame, attr, None)\n                if (frame_val is not None\n                    and not (merge_attributes\n                             and frame.is_frame_attr_default(attr))):\n                    frame_kwargs[attr] = frame_val\n                elif (self_val is not None\n                      and not self.is_frame_attr_default(attr)):\n                    frame_kwargs[attr] = self_val\n                elif frame_val is not None:\n                    frame_kwargs[attr] = frame_val\n        else:\n            raise ValueError('Transform `frame` must be a frame name, class, or instance')\n\n        # Get the composite transform to the new frame\n        trans = frame_transform_graph.get_transform(self.frame.__class__, new_frame_cls)\n        if trans is None:\n            raise ConvertError('Cannot transform from {} to {}'\n                               .format(self.frame.__class__, new_frame_cls))\n\n        # Make a generic frame which will accept all the frame kwargs that\n        # are provided and allow for transforming through intermediate frames\n        # which may require one or more of those kwargs.\n        generic_frame = GenericFrame(frame_kwargs)\n\n        # Do the transformation, returning a coordinate frame of the desired\n        # final type (not generic).\n        new_coord = trans(self.frame, generic_frame)\n\n        # Finally make the new SkyCoord object from the `new_coord` and\n        # remaining frame_kwargs that are not frame_attributes in `new_coord`.\n        for attr in (set(new_coord.get_frame_attr_names()) &\n                     set(frame_kwargs.keys())):\n            frame_kwargs.pop(attr)\n\n        # Always remove the origin frame attribute, as that attribute only makes\n        # sense with a SkyOffsetFrame (in which case it will be stored on the frame).\n        # See gh-11277.\n        # TODO: Should it be a property of the frame attribute that it can\n        # or cannot be stored on a SkyCoord?\n        frame_kwargs.pop('origin', None)\n\n        return self.__class__(new_coord, **frame_kwargs)\n\n    def apply_space_motion(self, new_obstime=None, dt=None):\n        \"\"\"\n        Compute the position of the source represented by this coordinate object\n        to a new time using the velocities stored in this object and assuming\n        linear space motion (including relativistic corrections). This is\n        sometimes referred to as an \"epoch transformation.\"\n\n        The initial time before the evolution is taken from the ``obstime``\n        attribute of this coordinate.  Note that this method currently does not\n        support evolving coordinates where the *frame* has an ``obstime`` frame\n        attribute, so the ``obstime`` is only used for storing the before and\n        after times, not actually as an attribute of the frame. Alternatively,\n        if ``dt`` is given, an ``obstime`` need not be provided at all.\n\n        Parameters\n        ----------\n        new_obstime : `~astropy.time.Time`, optional\n            The time at which to evolve the position to. Requires that the\n            ``obstime`` attribute be present on this frame.\n        dt : `~astropy.units.Quantity`, `~astropy.time.TimeDelta`, optional\n            An amount of time to evolve the position of the source. Cannot be\n            given at the same time as ``new_obstime``.\n\n        Returns\n        -------\n        new_coord : `SkyCoord`\n            A new coordinate object with the evolved location of this coordinate\n            at the new time.  ``obstime`` will be set on this object to the new\n            time only if ``self`` also has ``obstime``.\n        \"\"\"\n\n        if (new_obstime is None and dt is None or\n                new_obstime is not None and dt is not None):\n            raise ValueError(\"You must specify one of `new_obstime` or `dt`, \"\n                             \"but not both.\")\n\n        # Validate that we have velocity info\n        if 's' not in self.frame.data.differentials:\n            raise ValueError('SkyCoord requires velocity data to evolve the '\n                             'position.')\n\n        if 'obstime' in self.frame.frame_attributes:\n            raise NotImplementedError(\"Updating the coordinates in a frame \"\n                                      \"with explicit time dependence is \"\n                                      \"currently not supported. If you would \"\n                                      \"like this functionality, please open an \"\n                                      \"issue on github:\\n\"\n                                      \"https://github.com/astropy/astropy\")\n\n        if new_obstime is not None and self.obstime is None:\n            # If no obstime is already on this object, raise an error if a new\n            # obstime is passed: we need to know the time / epoch at which the\n            # the position / velocity were measured initially\n            raise ValueError('This object has no associated `obstime`. '\n                             'apply_space_motion() must receive a time '\n                             'difference, `dt`, and not a new obstime.')\n\n        # Compute t1 and t2, the times used in the starpm call, which *only*\n        # uses them to compute a delta-time\n        t1 = self.obstime\n        if dt is None:\n            # self.obstime is not None and new_obstime is not None b/c of above\n            # checks\n            t2 = new_obstime\n        else:\n            # new_obstime is definitely None b/c of the above checks\n            if t1 is None:\n                # MAGIC NUMBER: if the current SkyCoord object has no obstime,\n                # assume J2000 to do the dt offset. This is not actually used\n                # for anything except a delta-t in starpm, so it's OK that it's\n                # not necessarily the \"real\" obstime\n                t1 = Time('J2000')\n                new_obstime = None  # we don't actually know the initial obstime\n                t2 = t1 + dt\n            else:\n                t2 = t1 + dt\n                new_obstime = t2\n        # starpm wants tdb time\n        t1 = t1.tdb\n        t2 = t2.tdb\n\n        # proper motion in RA should not include the cos(dec) term, see the\n        # erfa function eraStarpv, comment (4).  So we convert to the regular\n        # spherical differentials.\n        icrsrep = self.icrs.represent_as(SphericalRepresentation, SphericalDifferential)\n        icrsvel = icrsrep.differentials['s']\n\n        parallax_zero = False\n        try:\n            plx = icrsrep.distance.to_value(u.arcsecond, u.parallax())\n        except u.UnitConversionError:  # No distance: set to 0 by convention\n            plx = 0.\n            parallax_zero = True\n\n        try:\n            rv = icrsvel.d_distance.to_value(u.km/u.s)\n        except u.UnitConversionError:  # No RV\n            rv = 0.\n\n        starpm = erfa.pmsafe(icrsrep.lon.radian, icrsrep.lat.radian,\n                             icrsvel.d_lon.to_value(u.radian/u.yr),\n                             icrsvel.d_lat.to_value(u.radian/u.yr),\n                             plx, rv, t1.jd1, t1.jd2, t2.jd1, t2.jd2)\n\n        if parallax_zero:\n            new_distance = None\n        else:\n            new_distance = Distance(parallax=starpm[4] << u.arcsec)\n\n        icrs2 = ICRS(ra=u.Quantity(starpm[0], u.radian, copy=False),\n                     dec=u.Quantity(starpm[1], u.radian, copy=False),\n                     pm_ra=u.Quantity(starpm[2], u.radian/u.yr, copy=False),\n                     pm_dec=u.Quantity(starpm[3], u.radian/u.yr, copy=False),\n                     distance=new_distance,\n                     radial_velocity=u.Quantity(starpm[5], u.km/u.s, copy=False),\n                     differential_type=SphericalDifferential)\n\n        # Update the obstime of the returned SkyCoord, and need to carry along\n        # the frame attributes\n        frattrs = {attrnm: getattr(self, attrnm)\n                   for attrnm in self._extra_frameattr_names}\n        frattrs['obstime'] = new_obstime\n        result = self.__class__(icrs2, **frattrs).transform_to(self.frame)\n\n        # Without this the output might not have the right differential type.\n        # Not sure if this fixes the problem or just hides it.  See #11932\n        result.differential_type = self.differential_type\n\n        return result\n\n    def _is_name(self, string):\n        \"\"\"\n        Returns whether a string is one of the aliases for the frame.\n        \"\"\"\n        return (self.frame.name == string or\n                (isinstance(self.frame.name, list) and string in self.frame.name))\n\n    def __getattr__(self, attr):\n        \"\"\"\n        Overrides getattr to return coordinates that this can be transformed\n        to, based on the alias attr in the primary transform graph.\n        \"\"\"\n        if '_sky_coord_frame' in self.__dict__:\n            if self._is_name(attr):\n                return self  # Should this be a deepcopy of self?\n\n            # Anything in the set of all possible frame_attr_names is handled\n            # here. If the attr is relevant for the current frame then delegate\n            # to self.frame otherwise get it from self._<attr>.\n            if attr in frame_transform_graph.frame_attributes:\n                if attr in self.frame.get_frame_attr_names():\n                    return getattr(self.frame, attr)\n                else:\n                    return getattr(self, '_' + attr, None)\n\n            # Some attributes might not fall in the above category but still\n            # are available through self._sky_coord_frame.\n            if not attr.startswith('_') and hasattr(self._sky_coord_frame, attr):\n                return getattr(self._sky_coord_frame, attr)\n\n            # Try to interpret as a new frame for transforming.\n            frame_cls = frame_transform_graph.lookup_name(attr)\n            if frame_cls is not None and self.frame.is_transformable_to(frame_cls):\n                return self.transform_to(attr)\n\n        # Fail\n        raise AttributeError(\"'{}' object has no attribute '{}'\"\n                             .format(self.__class__.__name__, attr))\n\n    def __setattr__(self, attr, val):\n        # This is to make anything available through __getattr__ immutable\n        if '_sky_coord_frame' in self.__dict__:\n            if self._is_name(attr):\n                raise AttributeError(f\"'{attr}' is immutable\")\n\n            if not attr.startswith('_') and hasattr(self._sky_coord_frame, attr):\n                setattr(self._sky_coord_frame, attr, val)\n                return\n\n            frame_cls = frame_transform_graph.lookup_name(attr)\n            if frame_cls is not None and self.frame.is_transformable_to(frame_cls):\n                raise AttributeError(f\"'{attr}' is immutable\")\n\n        if attr in frame_transform_graph.frame_attributes:\n            # All possible frame attributes can be set, but only via a private\n            # variable.  See __getattr__ above.\n            super().__setattr__('_' + attr, val)\n            # Validate it\n            frame_transform_graph.frame_attributes[attr].__get__(self)\n            # And add to set of extra attributes\n            self._extra_frameattr_names |= {attr}\n\n        else:\n            # Otherwise, do the standard Python attribute setting\n            super().__setattr__(attr, val)\n\n    def __delattr__(self, attr):\n        # mirror __setattr__ above\n        if '_sky_coord_frame' in self.__dict__:\n            if self._is_name(attr):\n                raise AttributeError(f\"'{attr}' is immutable\")\n\n            if not attr.startswith('_') and hasattr(self._sky_coord_frame,\n                                                    attr):\n                delattr(self._sky_coord_frame, attr)\n                return\n\n            frame_cls = frame_transform_graph.lookup_name(attr)\n            if frame_cls is not None and self.frame.is_transformable_to(frame_cls):\n                raise AttributeError(f\"'{attr}' is immutable\")\n\n        if attr in frame_transform_graph.frame_attributes:\n            # All possible frame attributes can be deleted, but need to remove\n            # the corresponding private variable.  See __getattr__ above.\n            super().__delattr__('_' + attr)\n            # Also remove it from the set of extra attributes\n            self._extra_frameattr_names -= {attr}\n\n        else:\n            # Otherwise, do the standard Python attribute setting\n            super().__delattr__(attr)\n\n    @override__dir__\n    def __dir__(self):\n        \"\"\"\n        Override the builtin `dir` behavior to include:\n        - Transforms available by aliases\n        - Attribute / methods of the underlying self.frame object\n        \"\"\"\n\n        # determine the aliases that this can be transformed to.\n        dir_values = set()\n        for name in frame_transform_graph.get_names():\n            frame_cls = frame_transform_graph.lookup_name(name)\n            if self.frame.is_transformable_to(frame_cls):\n                dir_values.add(name)\n\n        # Add public attributes of self.frame\n        dir_values.update(set(attr for attr in dir(self.frame) if not attr.startswith('_')))\n\n        # Add all possible frame attributes\n        dir_values.update(frame_transform_graph.frame_attributes.keys())\n\n        return dir_values\n\n    def __repr__(self):\n        clsnm = self.__class__.__name__\n        coonm = self.frame.__class__.__name__\n        frameattrs = self.frame._frame_attrs_repr()\n        if frameattrs:\n            frameattrs = ': ' + frameattrs\n\n        data = self.frame._data_repr()\n        if data:\n            data = ': ' + data\n\n        return '<{clsnm} ({coonm}{frameattrs}){data}>'.format(**locals())\n\n    def to_string(self, style='decimal', **kwargs):\n        \"\"\"\n        A string representation of the coordinates.\n\n        The default styles definitions are::\n\n          'decimal': 'lat': {'decimal': True, 'unit': \"deg\"}\n                     'lon': {'decimal': True, 'unit': \"deg\"}\n          'dms': 'lat': {'unit': \"deg\"}\n                 'lon': {'unit': \"deg\"}\n          'hmsdms': 'lat': {'alwayssign': True, 'pad': True, 'unit': \"deg\"}\n                    'lon': {'pad': True, 'unit': \"hour\"}\n\n        See :meth:`~astropy.coordinates.Angle.to_string` for details and\n        keyword arguments (the two angles forming the coordinates are are\n        both :class:`~astropy.coordinates.Angle` instances). Keyword\n        arguments have precedence over the style defaults and are passed\n        to :meth:`~astropy.coordinates.Angle.to_string`.\n\n        Parameters\n        ----------\n        style : {'hmsdms', 'dms', 'decimal'}\n            The formatting specification to use. These encode the three most\n            common ways to represent coordinates. The default is `decimal`.\n        kwargs\n            Keyword args passed to :meth:`~astropy.coordinates.Angle.to_string`.\n        \"\"\"\n\n        sph_coord = self.frame.represent_as(SphericalRepresentation)\n\n        styles = {'hmsdms': {'lonargs': {'unit': u.hour, 'pad': True},\n                             'latargs': {'unit': u.degree, 'pad': True, 'alwayssign': True}},\n                  'dms': {'lonargs': {'unit': u.degree},\n                          'latargs': {'unit': u.degree}},\n                  'decimal': {'lonargs': {'unit': u.degree, 'decimal': True},\n                              'latargs': {'unit': u.degree, 'decimal': True}}\n                  }\n\n        lonargs = {}\n        latargs = {}\n\n        if style in styles:\n            lonargs.update(styles[style]['lonargs'])\n            latargs.update(styles[style]['latargs'])\n        else:\n            raise ValueError(f\"Invalid style.  Valid options are: {','.join(styles)}\")\n\n        lonargs.update(kwargs)\n        latargs.update(kwargs)\n\n        if np.isscalar(sph_coord.lon.value):\n            coord_string = (sph_coord.lon.to_string(**lonargs) +\n                            \" \" + sph_coord.lat.to_string(**latargs))\n        else:\n            coord_string = []\n            for lonangle, latangle in zip(sph_coord.lon.ravel(), sph_coord.lat.ravel()):\n                coord_string += [(lonangle.to_string(**lonargs) +\n                                 \" \" + latangle.to_string(**latargs))]\n            if len(sph_coord.shape) > 1:\n                coord_string = np.array(coord_string).reshape(sph_coord.shape)\n\n        return coord_string\n\n    def to_table(self):\n        \"\"\"\n        Convert this |SkyCoord| to a |QTable|.\n\n        Any attributes that have the same length as the |SkyCoord| will be\n        converted to columns of the |QTable|. All other attributes will be\n        recorded as metadata.\n\n        Returns\n        -------\n        `~astropy.table.QTable`\n            A |QTable| containing the data of this |SkyCoord|.\n\n        Examples\n        --------\n        >>> sc = SkyCoord(ra=[40, 70]*u.deg, dec=[0, -20]*u.deg,\n        ...               obstime=Time([2000, 2010], format='jyear'))\n        >>> t =  sc.to_table()\n        >>> t\n        <QTable length=2>\n           ra     dec   obstime\n          deg     deg\n        float64 float64   Time\n        ------- ------- -------\n           40.0     0.0  2000.0\n           70.0   -20.0  2010.0\n        >>> t.meta\n        {'representation_type': 'spherical', 'frame': 'icrs'}\n        \"\"\"\n        self_as_dict = self.info._represent_as_dict()\n        tabledata = {}\n        metadata = {}\n        # Record attributes that have the same length as self as columns in the\n        # table, and the other attributes as table metadata.  This matches\n        # table.serialize._represent_mixin_as_column().\n        for key, value in self_as_dict.items():\n            if getattr(value, 'shape', ())[:1] == (len(self),):\n                tabledata[key] = value\n            else:\n                metadata[key] = value\n        return QTable(tabledata, meta=metadata)\n\n    def is_equivalent_frame(self, other):\n        \"\"\"\n        Checks if this object's frame as the same as that of the ``other``\n        object.\n\n        To be the same frame, two objects must be the same frame class and have\n        the same frame attributes. For two `SkyCoord` objects, *all* of the\n        frame attributes have to match, not just those relevant for the object's\n        frame.\n\n        Parameters\n        ----------\n        other : SkyCoord or BaseCoordinateFrame\n            The other object to check.\n\n        Returns\n        -------\n        isequiv : bool\n            True if the frames are the same, False if not.\n\n        Raises\n        ------\n        TypeError\n            If ``other`` isn't a `SkyCoord` or a `BaseCoordinateFrame` or subclass.\n        \"\"\"\n        if isinstance(other, BaseCoordinateFrame):\n            return self.frame.is_equivalent_frame(other)\n        elif isinstance(other, SkyCoord):\n            if other.frame.name != self.frame.name:\n                return False\n\n            for fattrnm in frame_transform_graph.frame_attributes:\n                if not BaseCoordinateFrame._frameattr_equiv(getattr(self, fattrnm),\n                                                            getattr(other, fattrnm)):\n                    return False\n            return True\n        else:\n            # not a BaseCoordinateFrame nor a SkyCoord object\n            raise TypeError(\"Tried to do is_equivalent_frame on something that \"\n                            \"isn't frame-like\")\n\n    # High-level convenience methods\n    def separation(self, other):\n        \"\"\"\n        Computes on-sky separation between this coordinate and another.\n\n        .. note::\n\n            If the ``other`` coordinate object is in a different frame, it is\n            first transformed to the frame of this object. This can lead to\n            unintuitive behavior if not accounted for. Particularly of note is\n            that ``self.separation(other)`` and ``other.separation(self)`` may\n            not give the same answer in this case.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate to get the separation to.\n\n        Returns\n        -------\n        sep : `~astropy.coordinates.Angle`\n            The on-sky separation between this and the ``other`` coordinate.\n\n        Notes\n        -----\n        The separation is calculated using the Vincenty formula, which\n        is stable at all locations, including poles and antipodes [1]_.\n\n        .. [1] https://en.wikipedia.org/wiki/Great-circle_distance\n\n        \"\"\"\n        from . import Angle\n        from .angle_utilities import angular_separation\n\n        if not self.is_equivalent_frame(other):\n            try:\n                kwargs = {'merge_attributes': False} if isinstance(other, SkyCoord) else {}\n                other = other.transform_to(self, **kwargs)\n            except TypeError:\n                raise TypeError('Can only get separation to another SkyCoord '\n                                'or a coordinate frame with data')\n\n        lon1 = self.spherical.lon\n        lat1 = self.spherical.lat\n        lon2 = other.spherical.lon\n        lat2 = other.spherical.lat\n\n        # Get the separation as a Quantity, convert to Angle in degrees\n        sep = angular_separation(lon1, lat1, lon2, lat2)\n        return Angle(sep, unit=u.degree)\n\n    def separation_3d(self, other):\n        \"\"\"\n        Computes three dimensional separation between this coordinate\n        and another.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate to get the separation to.\n\n        Returns\n        -------\n        sep : `~astropy.coordinates.Distance`\n            The real-space distance between these two coordinates.\n\n        Raises\n        ------\n        ValueError\n            If this or the other coordinate do not have distances.\n        \"\"\"\n        if not self.is_equivalent_frame(other):\n            try:\n                kwargs = {'merge_attributes': False} if isinstance(other, SkyCoord) else {}\n                other = other.transform_to(self, **kwargs)\n            except TypeError:\n                raise TypeError('Can only get separation to another SkyCoord '\n                                'or a coordinate frame with data')\n\n        if issubclass(self.data.__class__, UnitSphericalRepresentation):\n            raise ValueError('This object does not have a distance; cannot '\n                             'compute 3d separation.')\n        if issubclass(other.data.__class__, UnitSphericalRepresentation):\n            raise ValueError('The other object does not have a distance; '\n                             'cannot compute 3d separation.')\n\n        c1 = self.cartesian.without_differentials()\n        c2 = other.cartesian.without_differentials()\n        return Distance((c1 - c2).norm())\n\n    def spherical_offsets_to(self, tocoord):\n        r\"\"\"\n        Computes angular offsets to go *from* this coordinate *to* another.\n\n        Parameters\n        ----------\n        tocoord : `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate to find the offset to.\n\n        Returns\n        -------\n        lon_offset : `~astropy.coordinates.Angle`\n            The angular offset in the longitude direction. The definition of\n            \"longitude\" depends on this coordinate's frame (e.g., RA for\n            equatorial coordinates).\n        lat_offset : `~astropy.coordinates.Angle`\n            The angular offset in the latitude direction. The definition of\n            \"latitude\" depends on this coordinate's frame (e.g., Dec for\n            equatorial coordinates).\n\n        Raises\n        ------\n        ValueError\n            If the ``tocoord`` is not in the same frame as this one. This is\n            different from the behavior of the `separation`/`separation_3d`\n            methods because the offset components depend critically on the\n            specific choice of frame.\n\n        Notes\n        -----\n        This uses the sky offset frame machinery, and hence will produce a new\n        sky offset frame if one does not already exist for this object's frame\n        class.\n\n        See Also\n        --------\n        separation : for the *total* angular offset (not broken out into components).\n        position_angle : for the direction of the offset.\n\n        \"\"\"\n        if not self.is_equivalent_frame(tocoord):\n            raise ValueError('Tried to use spherical_offsets_to with two non-matching frames!')\n\n        aframe = self.skyoffset_frame()\n        acoord = tocoord.transform_to(aframe)\n\n        dlon = acoord.spherical.lon.view(Angle)\n        dlat = acoord.spherical.lat.view(Angle)\n        return dlon, dlat\n\n    def spherical_offsets_by(self, d_lon, d_lat):\n        \"\"\"\n        Computes the coordinate that is a specified pair of angular offsets away\n        from this coordinate.\n\n        Parameters\n        ----------\n        d_lon : angle-like\n            The angular offset in the longitude direction. The definition of\n            \"longitude\" depends on this coordinate's frame (e.g., RA for\n            equatorial coordinates).\n        d_lat : angle-like\n            The angular offset in the latitude direction. The definition of\n            \"latitude\" depends on this coordinate's frame (e.g., Dec for\n            equatorial coordinates).\n\n        Returns\n        -------\n        newcoord : `~astropy.coordinates.SkyCoord`\n            The coordinates for the location that corresponds to offsetting by\n            ``d_lat`` in the latitude direction and ``d_lon`` in the longitude\n            direction.\n\n        Notes\n        -----\n        This internally uses `~astropy.coordinates.SkyOffsetFrame` to do the\n        transformation. For a more complete set of transform offsets, use\n        `~astropy.coordinates.SkyOffsetFrame` or `~astropy.wcs.WCS` manually.\n        This specific method can be reproduced by doing\n        ``SkyCoord(SkyOffsetFrame(d_lon, d_lat, origin=self.frame).transform_to(self))``.\n\n        See Also\n        --------\n        spherical_offsets_to : compute the angular offsets to another coordinate\n        directional_offset_by : offset a coordinate by an angle in a direction\n        \"\"\"\n        return self.__class__(\n            SkyOffsetFrame(d_lon, d_lat, origin=self.frame).transform_to(self))\n\n    def directional_offset_by(self, position_angle, separation):\n        \"\"\"\n        Computes coordinates at the given offset from this coordinate.\n\n        Parameters\n        ----------\n        position_angle : `~astropy.coordinates.Angle`\n            position_angle of offset\n        separation : `~astropy.coordinates.Angle`\n            offset angular separation\n\n        Returns\n        -------\n        newpoints : `~astropy.coordinates.SkyCoord`\n            The coordinates for the location that corresponds to offsetting by\n            the given `position_angle` and `separation`.\n\n        Notes\n        -----\n        Returned SkyCoord frame retains only the frame attributes that are for\n        the resulting frame type.  (e.g. if the input frame is\n        `~astropy.coordinates.ICRS`, an ``equinox`` value will be retained, but\n        an ``obstime`` will not.)\n\n        For a more complete set of transform offsets, use `~astropy.wcs.WCS`.\n        `~astropy.coordinates.SkyCoord.skyoffset_frame()` can also be used to\n        create a spherical frame with (lat=0, lon=0) at a reference point,\n        approximating an xy cartesian system for small offsets. This method\n        is distinct in that it is accurate on the sphere.\n\n        See Also\n        --------\n        position_angle : inverse operation for the ``position_angle`` component\n        separation : inverse operation for the ``separation`` component\n\n        \"\"\"\n        from . import angle_utilities\n\n        slat = self.represent_as(UnitSphericalRepresentation).lat\n        slon = self.represent_as(UnitSphericalRepresentation).lon\n\n        newlon, newlat = angle_utilities.offset_by(\n            lon=slon, lat=slat,\n            posang=position_angle, distance=separation)\n\n        return SkyCoord(newlon, newlat, frame=self.frame)\n\n    def match_to_catalog_sky(self, catalogcoord, nthneighbor=1):\n        \"\"\"\n        Finds the nearest on-sky matches of this coordinate in a set of\n        catalog coordinates.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        catalogcoord : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The base catalog in which to search for matches. Typically this\n            will be a coordinate object that is an array (i.e.,\n            ``catalogcoord.isscalar == False``)\n        nthneighbor : int, optional\n            Which closest neighbor to search for.  Typically ``1`` is\n            desired here, as that is correct for matching one set of\n            coordinates to another. The next likely use case is ``2``,\n            for matching a coordinate catalog against *itself* (``1``\n            is inappropriate because each point will find itself as the\n            closest match).\n\n        Returns\n        -------\n        idx : int array\n            Indices into ``catalogcoord`` to get the matched points for\n            each of this object's coordinates. Shape matches this\n            object.\n        sep2d : `~astropy.coordinates.Angle`\n            The on-sky separation between the closest match for each\n            element in this object in ``catalogcoord``. Shape matches\n            this object.\n        dist3d : `~astropy.units.Quantity` ['length']\n            The 3D distance between the closest match for each element\n            in this object in ``catalogcoord``. Shape matches this\n            object. Unless both this and ``catalogcoord`` have associated\n            distances, this quantity assumes that all sources are at a\n            distance of 1 (dimensionless).\n\n        Notes\n        -----\n        This method requires `SciPy <https://www.scipy.org/>`_ to be\n        installed or it will fail.\n\n        See Also\n        --------\n        astropy.coordinates.match_coordinates_sky\n        SkyCoord.match_to_catalog_3d\n        \"\"\"\n        from .matching import match_coordinates_sky\n\n        if not (isinstance(catalogcoord, (SkyCoord, BaseCoordinateFrame))\n                and catalogcoord.has_data):\n            raise TypeError('Can only get separation to another SkyCoord or a '\n                            'coordinate frame with data')\n\n        res = match_coordinates_sky(self, catalogcoord,\n                                    nthneighbor=nthneighbor,\n                                    storekdtree='_kdtree_sky')\n        return res\n\n    def match_to_catalog_3d(self, catalogcoord, nthneighbor=1):\n        \"\"\"\n        Finds the nearest 3-dimensional matches of this coordinate to a set\n        of catalog coordinates.\n\n        This finds the 3-dimensional closest neighbor, which is only different\n        from the on-sky distance if ``distance`` is set in this object or the\n        ``catalogcoord`` object.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        catalogcoord : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The base catalog in which to search for matches. Typically this\n            will be a coordinate object that is an array (i.e.,\n            ``catalogcoord.isscalar == False``)\n        nthneighbor : int, optional\n            Which closest neighbor to search for.  Typically ``1`` is\n            desired here, as that is correct for matching one set of\n            coordinates to another.  The next likely use case is\n            ``2``, for matching a coordinate catalog against *itself*\n            (``1`` is inappropriate because each point will find\n            itself as the closest match).\n\n        Returns\n        -------\n        idx : int array\n            Indices into ``catalogcoord`` to get the matched points for\n            each of this object's coordinates. Shape matches this\n            object.\n        sep2d : `~astropy.coordinates.Angle`\n            The on-sky separation between the closest match for each\n            element in this object in ``catalogcoord``. Shape matches\n            this object.\n        dist3d : `~astropy.units.Quantity` ['length']\n            The 3D distance between the closest match for each element\n            in this object in ``catalogcoord``. Shape matches this\n            object.\n\n        Notes\n        -----\n        This method requires `SciPy <https://www.scipy.org/>`_ to be\n        installed or it will fail.\n\n        See Also\n        --------\n        astropy.coordinates.match_coordinates_3d\n        SkyCoord.match_to_catalog_sky\n        \"\"\"\n        from .matching import match_coordinates_3d\n\n        if not (isinstance(catalogcoord, (SkyCoord, BaseCoordinateFrame))\n                and catalogcoord.has_data):\n            raise TypeError('Can only get separation to another SkyCoord or a '\n                            'coordinate frame with data')\n\n        res = match_coordinates_3d(self, catalogcoord,\n                                   nthneighbor=nthneighbor,\n                                   storekdtree='_kdtree_3d')\n\n        return res\n\n    def search_around_sky(self, searcharoundcoords, seplimit):\n        \"\"\"\n        Searches for all coordinates in this object around a supplied set of\n        points within a given on-sky separation.\n\n        This is intended for use on `~astropy.coordinates.SkyCoord` objects\n        with coordinate arrays, rather than a scalar coordinate.  For a scalar\n        coordinate, it is better to use\n        `~astropy.coordinates.SkyCoord.separation`.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        searcharoundcoords : coordinate-like\n            The coordinates to search around to try to find matching points in\n            this `SkyCoord`. This should be an object with array coordinates,\n            not a scalar coordinate object.\n        seplimit : `~astropy.units.Quantity` ['angle']\n            The on-sky separation to search within.\n\n        Returns\n        -------\n        idxsearcharound : int array\n            Indices into ``searcharoundcoords`` that match the\n            corresponding elements of ``idxself``. Shape matches\n            ``idxself``.\n        idxself : int array\n            Indices into ``self`` that match the\n            corresponding elements of ``idxsearcharound``. Shape matches\n            ``idxsearcharound``.\n        sep2d : `~astropy.coordinates.Angle`\n            The on-sky separation between the coordinates. Shape matches\n            ``idxsearcharound`` and ``idxself``.\n        dist3d : `~astropy.units.Quantity` ['length']\n            The 3D distance between the coordinates. Shape matches\n            ``idxsearcharound`` and ``idxself``.\n\n        Notes\n        -----\n        This method requires `SciPy <https://www.scipy.org/>`_ to be\n        installed or it will fail.\n\n        In the current implementation, the return values are always sorted in\n        the same order as the ``searcharoundcoords`` (so ``idxsearcharound`` is\n        in ascending order).  This is considered an implementation detail,\n        though, so it could change in a future release.\n\n        See Also\n        --------\n        astropy.coordinates.search_around_sky\n        SkyCoord.search_around_3d\n        \"\"\"\n        from .matching import search_around_sky\n\n        return search_around_sky(searcharoundcoords, self, seplimit,\n                                 storekdtree='_kdtree_sky')\n\n    def search_around_3d(self, searcharoundcoords, distlimit):\n        \"\"\"\n        Searches for all coordinates in this object around a supplied set of\n        points within a given 3D radius.\n\n        This is intended for use on `~astropy.coordinates.SkyCoord` objects\n        with coordinate arrays, rather than a scalar coordinate.  For a scalar\n        coordinate, it is better to use\n        `~astropy.coordinates.SkyCoord.separation_3d`.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        searcharoundcoords : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinates to search around to try to find matching points in\n            this `SkyCoord`. This should be an object with array coordinates,\n            not a scalar coordinate object.\n        distlimit : `~astropy.units.Quantity` ['length']\n            The physical radius to search within.\n\n        Returns\n        -------\n        idxsearcharound : int array\n            Indices into ``searcharoundcoords`` that match the\n            corresponding elements of ``idxself``. Shape matches\n            ``idxself``.\n        idxself : int array\n            Indices into ``self`` that match the\n            corresponding elements of ``idxsearcharound``. Shape matches\n            ``idxsearcharound``.\n        sep2d : `~astropy.coordinates.Angle`\n            The on-sky separation between the coordinates. Shape matches\n            ``idxsearcharound`` and ``idxself``.\n        dist3d : `~astropy.units.Quantity` ['length']\n            The 3D distance between the coordinates. Shape matches\n            ``idxsearcharound`` and ``idxself``.\n\n        Notes\n        -----\n        This method requires `SciPy <https://www.scipy.org/>`_ to be\n        installed or it will fail.\n\n        In the current implementation, the return values are always sorted in\n        the same order as the ``searcharoundcoords`` (so ``idxsearcharound`` is\n        in ascending order).  This is considered an implementation detail,\n        though, so it could change in a future release.\n\n        See Also\n        --------\n        astropy.coordinates.search_around_3d\n        SkyCoord.search_around_sky\n        \"\"\"\n        from .matching import search_around_3d\n\n        return search_around_3d(searcharoundcoords, self, distlimit,\n                                storekdtree='_kdtree_3d')\n\n    def position_angle(self, other):\n        \"\"\"\n        Computes the on-sky position angle (East of North) between this\n        `SkyCoord` and another.\n\n        Parameters\n        ----------\n        other : `SkyCoord`\n            The other coordinate to compute the position angle to.  It is\n            treated as the \"head\" of the vector of the position angle.\n\n        Returns\n        -------\n        pa : `~astropy.coordinates.Angle`\n            The (positive) position angle of the vector pointing from ``self``\n            to ``other``.  If either ``self`` or ``other`` contain arrays, this\n            will be an array following the appropriate `numpy` broadcasting\n            rules.\n\n        Examples\n        --------\n\n        >>> c1 = SkyCoord(0*u.deg, 0*u.deg)\n        >>> c2 = SkyCoord(1*u.deg, 0*u.deg)\n        >>> c1.position_angle(c2).degree\n        90.0\n        >>> c3 = SkyCoord(1*u.deg, 1*u.deg)\n        >>> c1.position_angle(c3).degree  # doctest: +FLOAT_CMP\n        44.995636455344844\n        \"\"\"\n        from . import angle_utilities\n\n        if not self.is_equivalent_frame(other):\n            try:\n                other = other.transform_to(self, merge_attributes=False)\n            except TypeError:\n                raise TypeError('Can only get position_angle to another '\n                                'SkyCoord or a coordinate frame with data')\n\n        slat = self.represent_as(UnitSphericalRepresentation).lat\n        slon = self.represent_as(UnitSphericalRepresentation).lon\n        olat = other.represent_as(UnitSphericalRepresentation).lat\n        olon = other.represent_as(UnitSphericalRepresentation).lon\n\n        return angle_utilities.position_angle(slon, slat, olon, olat)\n\n    def skyoffset_frame(self, rotation=None):\n        \"\"\"\n        Returns the sky offset frame with this `SkyCoord` at the origin.\n\n        Returns\n        -------\n        astrframe : `~astropy.coordinates.SkyOffsetFrame`\n            A sky offset frame of the same type as this `SkyCoord` (e.g., if\n            this object has an ICRS coordinate, the resulting frame is\n            SkyOffsetICRS, with the origin set to this object)\n        rotation : angle-like\n            The final rotation of the frame about the ``origin``. The sign of\n            the rotation is the left-hand rule. That is, an object at a\n            particular position angle in the un-rotated system will be sent to\n            the positive latitude (z) direction in the final frame.\n        \"\"\"\n        return SkyOffsetFrame(origin=self, rotation=rotation)\n\n    def get_constellation(self, short_name=False, constellation_list='iau'):\n        \"\"\"\n        Determines the constellation(s) of the coordinates this `SkyCoord`\n        contains.\n\n        Parameters\n        ----------\n        short_name : bool\n            If True, the returned names are the IAU-sanctioned abbreviated\n            names.  Otherwise, full names for the constellations are used.\n        constellation_list : str\n            The set of constellations to use.  Currently only ``'iau'`` is\n            supported, meaning the 88 \"modern\" constellations endorsed by the IAU.\n\n        Returns\n        -------\n        constellation : str or string array\n            If this is a scalar coordinate, returns the name of the\n            constellation.  If it is an array `SkyCoord`, it returns an array of\n            names.\n\n        Notes\n        -----\n        To determine which constellation a point on the sky is in, this first\n        precesses to B1875, and then uses the Delporte boundaries of the 88\n        modern constellations, as tabulated by\n        `Roman 1987 <http://cdsarc.u-strasbg.fr/viz-bin/Cat?VI/42>`_.\n\n        See Also\n        --------\n        astropy.coordinates.get_constellation\n        \"\"\"\n        from .funcs import get_constellation\n\n        # because of issue #7028, the conversion to a PrecessedGeocentric\n        # system fails in some cases.  Work around is to  drop the velocities.\n        # they are not needed here since only position information is used\n        extra_frameattrs = {nm: getattr(self, nm)\n                            for nm in self._extra_frameattr_names}\n        novel = SkyCoord(self.realize_frame(self.data.without_differentials()),\n                         **extra_frameattrs)\n        return get_constellation(novel, short_name, constellation_list)\n\n        # the simpler version below can be used when gh-issue #7028 is resolved\n        # return get_constellation(self, short_name, constellation_list)\n\n    # WCS pixel to/from sky conversions\n    def to_pixel(self, wcs, origin=0, mode='all'):\n        \"\"\"\n        Convert this coordinate to pixel coordinates using a `~astropy.wcs.WCS`\n        object.\n\n        Parameters\n        ----------\n        wcs : `~astropy.wcs.WCS`\n            The WCS to use for convert\n        origin : int\n            Whether to return 0 or 1-based pixel coordinates.\n        mode : 'all' or 'wcs'\n            Whether to do the transformation including distortions (``'all'``) or\n            only including only the core WCS transformation (``'wcs'``).\n\n        Returns\n        -------\n        xp, yp : `numpy.ndarray`\n            The pixel coordinates\n\n        See Also\n        --------\n        astropy.wcs.utils.skycoord_to_pixel : the implementation of this method\n        \"\"\"\n        from astropy.wcs.utils import skycoord_to_pixel\n        return skycoord_to_pixel(self, wcs=wcs, origin=origin, mode=mode)\n\n    @classmethod\n    def from_pixel(cls, xp, yp, wcs, origin=0, mode='all'):\n        \"\"\"\n        Create a new `SkyCoord` from pixel coordinates using an\n        `~astropy.wcs.WCS` object.\n\n        Parameters\n        ----------\n        xp, yp : float or ndarray\n            The coordinates to convert.\n        wcs : `~astropy.wcs.WCS`\n            The WCS to use for convert\n        origin : int\n            Whether to return 0 or 1-based pixel coordinates.\n        mode : 'all' or 'wcs'\n            Whether to do the transformation including distortions (``'all'``) or\n            only including only the core WCS transformation (``'wcs'``).\n\n        Returns\n        -------\n        coord : `~astropy.coordinates.SkyCoord`\n            A new object with sky coordinates corresponding to the input ``xp``\n            and ``yp``.\n\n        See Also\n        --------\n        to_pixel : to do the inverse operation\n        astropy.wcs.utils.pixel_to_skycoord : the implementation of this method\n        \"\"\"\n        from astropy.wcs.utils import pixel_to_skycoord\n        return pixel_to_skycoord(xp, yp, wcs=wcs, origin=origin, mode=mode, cls=cls)\n\n    def contained_by(self, wcs, image=None, **kwargs):\n        \"\"\"\n        Determines if the SkyCoord is contained in the given wcs footprint.\n\n        Parameters\n        ----------\n        wcs : `~astropy.wcs.WCS`\n            The coordinate to check if it is within the wcs coordinate.\n        image : array\n            Optional.  The image associated with the wcs object that the cooordinate\n            is being checked against. If not given the naxis keywords will be used\n            to determine if the coordinate falls within the wcs footprint.\n        **kwargs :\n           Additional arguments to pass to `~astropy.coordinates.SkyCoord.to_pixel`\n\n        Returns\n        -------\n        response : bool\n           True means the WCS footprint contains the coordinate, False means it does not.\n        \"\"\"\n\n        if image is not None:\n            ymax, xmax = image.shape\n        else:\n            xmax, ymax = wcs._naxis\n\n        import warnings\n        with warnings.catch_warnings():\n            #  Suppress warnings since they just mean we didn't find the coordinate\n            warnings.simplefilter(\"ignore\")\n            try:\n                x, y = self.to_pixel(wcs, **kwargs)\n            except Exception:\n                return False\n\n        return (x < xmax) & (x > 0) & (y < ymax) & (y > 0)\n\n    def radial_velocity_correction(self, kind='barycentric', obstime=None,\n                                   location=None):\n        \"\"\"\n        Compute the correction required to convert a radial velocity at a given\n        time and place on the Earth's Surface to a barycentric or heliocentric\n        velocity.\n\n        Parameters\n        ----------\n        kind : str\n            The kind of velocity correction.  Must be 'barycentric' or\n            'heliocentric'.\n        obstime : `~astropy.time.Time` or None, optional\n            The time at which to compute the correction.  If `None`, the\n            ``obstime`` frame attribute on the `SkyCoord` will be used.\n        location : `~astropy.coordinates.EarthLocation` or None, optional\n            The observer location at which to compute the correction.  If\n            `None`, the  ``location`` frame attribute on the passed-in\n            ``obstime`` will be used, and if that is None, the ``location``\n            frame attribute on the `SkyCoord` will be used.\n\n        Raises\n        ------\n        ValueError\n            If either ``obstime`` or ``location`` are passed in (not ``None``)\n            when the frame attribute is already set on this `SkyCoord`.\n        TypeError\n            If ``obstime`` or ``location`` aren't provided, either as arguments\n            or as frame attributes.\n\n        Returns\n        -------\n        vcorr : `~astropy.units.Quantity` ['speed']\n            The  correction with a positive sign.  I.e., *add* this\n            to an observed radial velocity to get the barycentric (or\n            heliocentric) velocity. If m/s precision or better is needed,\n            see the notes below.\n\n        Notes\n        -----\n        The barycentric correction is calculated to higher precision than the\n        heliocentric correction and includes additional physics (e.g time dilation).\n        Use barycentric corrections if m/s precision is required.\n\n        The algorithm here is sufficient to perform corrections at the mm/s level, but\n        care is needed in application. The barycentric correction returned uses the optical\n        approximation v = z * c. Strictly speaking, the barycentric correction is\n        multiplicative and should be applied as::\n\n          >>> from astropy.time import Time\n          >>> from astropy.coordinates import SkyCoord, EarthLocation\n          >>> from astropy.constants import c\n          >>> t = Time(56370.5, format='mjd', scale='utc')\n          >>> loc = EarthLocation('149d33m00.5s','-30d18m46.385s',236.87*u.m)\n          >>> sc = SkyCoord(1*u.deg, 2*u.deg)\n          >>> vcorr = sc.radial_velocity_correction(kind='barycentric', obstime=t, location=loc)  # doctest: +REMOTE_DATA\n          >>> rv = rv + vcorr + rv * vcorr / c  # doctest: +SKIP\n\n        Also note that this method returns the correction velocity in the so-called\n        *optical convention*::\n\n          >>> vcorr = zb * c  # doctest: +SKIP\n\n        where ``zb`` is the barycentric correction redshift as defined in section 3\n        of Wright & Eastman (2014). The application formula given above follows from their\n        equation (11) under assumption that the radial velocity ``rv`` has also been defined\n        using the same optical convention. Note, this can be regarded as a matter of\n        velocity definition and does not by itself imply any loss of accuracy, provided\n        sufficient care has been taken during interpretation of the results. If you need\n        the barycentric correction expressed as the full relativistic velocity (e.g., to provide\n        it as the input to another software which performs the application), the\n        following recipe can be used::\n\n          >>> zb = vcorr / c  # doctest: +REMOTE_DATA\n          >>> zb_plus_one_squared = (zb + 1) ** 2  # doctest: +REMOTE_DATA\n          >>> vcorr_rel = c * (zb_plus_one_squared - 1) / (zb_plus_one_squared + 1)  # doctest: +REMOTE_DATA\n\n        or alternatively using just equivalencies::\n\n          >>> vcorr_rel = vcorr.to(u.Hz, u.doppler_optical(1*u.Hz)).to(vcorr.unit, u.doppler_relativistic(1*u.Hz))  # doctest: +REMOTE_DATA\n\n        See also `~astropy.units.equivalencies.doppler_optical`,\n        `~astropy.units.equivalencies.doppler_radio`, and\n        `~astropy.units.equivalencies.doppler_relativistic` for more information on\n        the velocity conventions.\n\n        The default is for this method to use the builtin ephemeris for\n        computing the sun and earth location.  Other ephemerides can be chosen\n        by setting the `~astropy.coordinates.solar_system_ephemeris` variable,\n        either directly or via ``with`` statement.  For example, to use the JPL\n        ephemeris, do::\n\n          >>> from astropy.coordinates import solar_system_ephemeris\n          >>> sc = SkyCoord(1*u.deg, 2*u.deg)\n          >>> with solar_system_ephemeris.set('jpl'):  # doctest: +REMOTE_DATA\n          ...     rv += sc.radial_velocity_correction(obstime=t, location=loc)  # doctest: +SKIP\n\n        \"\"\"\n        # has to be here to prevent circular imports\n        from .solar_system import get_body_barycentric_posvel\n\n        # location validation\n        timeloc = getattr(obstime, 'location', None)\n        if location is None:\n            if self.location is not None:\n                location = self.location\n                if timeloc is not None:\n                    raise ValueError('`location` cannot be in both the '\n                                     'passed-in `obstime` and this `SkyCoord` '\n                                     'because it is ambiguous which is meant '\n                                     'for the radial_velocity_correction.')\n            elif timeloc is not None:\n                location = timeloc\n            else:\n                raise TypeError('Must provide a `location` to '\n                                'radial_velocity_correction, either as a '\n                                'SkyCoord frame attribute, as an attribute on '\n                                'the passed in `obstime`, or in the method '\n                                'call.')\n\n        elif self.location is not None or timeloc is not None:\n            raise ValueError('Cannot compute radial velocity correction if '\n                             '`location` argument is passed in and there is '\n                             'also a  `location` attribute on this SkyCoord or '\n                             'the passed-in `obstime`.')\n\n        # obstime validation\n        coo_at_rv_obstime = self  # assume we need no space motion for now\n        if obstime is None:\n            obstime = self.obstime\n            if obstime is None:\n                raise TypeError('Must provide an `obstime` to '\n                                'radial_velocity_correction, either as a '\n                                'SkyCoord frame attribute or in the method '\n                                'call.')\n        elif self.obstime is not None and self.frame.data.differentials:\n            # we do need space motion after all\n            coo_at_rv_obstime = self.apply_space_motion(obstime)\n        elif self.obstime is None:\n            # warn the user if the object has differentials set\n            if 's' in self.data.differentials:\n                warnings.warn(\n                    \"SkyCoord has space motion, and therefore the specified \"\n                    \"position of the SkyCoord may not be the same as \"\n                    \"the `obstime` for the radial velocity measurement. \"\n                    \"This may affect the rv correction at the order of km/s\"\n                    \"for very high proper motions sources. If you wish to \"\n                    \"apply space motion of the SkyCoord to correct for this\"\n                    \"the `obstime` attribute of the SkyCoord must be set\",\n                    AstropyUserWarning\n                )\n\n        pos_earth, v_earth = get_body_barycentric_posvel('earth', obstime)\n        if kind == 'barycentric':\n            v_origin_to_earth = v_earth\n        elif kind == 'heliocentric':\n            v_sun = get_body_barycentric_posvel('sun', obstime)[1]\n            v_origin_to_earth = v_earth - v_sun\n        else:\n            raise ValueError(\"`kind` argument to radial_velocity_correction must \"\n                             \"be 'barycentric' or 'heliocentric', but got \"\n                             \"'{}'\".format(kind))\n\n        gcrs_p, gcrs_v = location.get_gcrs_posvel(obstime)\n        # transforming to GCRS is not the correct thing to do here, since we don't want to\n        # include aberration (or light deflection)? Instead, only apply parallax if necessary\n        icrs_cart = coo_at_rv_obstime.icrs.cartesian\n        icrs_cart_novel = icrs_cart.without_differentials()\n        if self.data.__class__ is UnitSphericalRepresentation:\n            targcart = icrs_cart_novel\n        else:\n            # skycoord has distances so apply parallax\n            obs_icrs_cart = pos_earth + gcrs_p\n            targcart = icrs_cart_novel - obs_icrs_cart\n            targcart /= targcart.norm()\n\n        if kind == 'barycentric':\n            beta_obs = (v_origin_to_earth + gcrs_v) / speed_of_light\n            gamma_obs = 1 / np.sqrt(1 - beta_obs.norm()**2)\n            gr = location.gravitational_redshift(obstime)\n            # barycentric redshift according to eq 28 in Wright & Eastmann (2014),\n            # neglecting Shapiro delay and effects of the star's own motion\n            zb = gamma_obs * (1 + beta_obs.dot(targcart)) / (1 + gr/speed_of_light)\n            # try and get terms corresponding to stellar motion.\n            if icrs_cart.differentials:\n                try:\n                    ro = self.icrs.cartesian\n                    beta_star = ro.differentials['s'].to_cartesian() / speed_of_light\n                    # ICRS unit vector at coordinate epoch\n                    ro = ro.without_differentials()\n                    ro /= ro.norm()\n                    zb *= (1 + beta_star.dot(ro)) / (1 + beta_star.dot(targcart))\n                except u.UnitConversionError:\n                    warnings.warn(\"SkyCoord contains some velocity information, but not enough to \"\n                                  \"calculate the full space motion of the source, and so this has \"\n                                  \"been ignored for the purposes of calculating the radial velocity \"\n                                  \"correction. This can lead to errors on the order of metres/second.\",\n                                  AstropyUserWarning)\n\n            zb = zb - 1\n            return zb * speed_of_light\n        else:\n            # do a simpler correction ignoring time dilation and gravitational redshift\n            # this is adequate since Heliocentric corrections shouldn't be used if\n            # cm/s precision is required.\n            return targcart.dot(v_origin_to_earth + gcrs_v)\n\n    # Table interactions\n    @classmethod\n    def guess_from_table(cls, table, **coord_kwargs):\n        r\"\"\"\n        A convenience method to create and return a new `SkyCoord` from the data\n        in an astropy Table.\n\n        This method matches table columns that start with the case-insensitive\n        names of the the components of the requested frames (including\n        differentials), if they are also followed by a non-alphanumeric\n        character. It will also match columns that *end* with the component name\n        if a non-alphanumeric character is *before* it.\n\n        For example, the first rule means columns with names like\n        ``'RA[J2000]'`` or ``'ra'`` will be interpreted as ``ra`` attributes for\n        `~astropy.coordinates.ICRS` frames, but ``'RAJ2000'`` or ``'radius'``\n        are *not*. Similarly, the second rule applied to the\n        `~astropy.coordinates.Galactic` frame means that a column named\n        ``'gal_l'`` will be used as the the ``l`` component, but ``gall`` or\n        ``'fill'`` will not.\n\n        The definition of alphanumeric here is based on Unicode's definition\n        of alphanumeric, except without ``_`` (which is normally considered\n        alphanumeric).  So for ASCII, this means the non-alphanumeric characters\n        are ``<space>_!\"#$%&'()*+,-./\\:;<=>?@[]^`{|}~``).\n\n        Parameters\n        ----------\n        table : `~astropy.table.Table` or subclass\n            The table to load data from.\n        **coord_kwargs\n            Any additional keyword arguments are passed directly to this class's\n            constructor.\n\n        Returns\n        -------\n        newsc : `~astropy.coordinates.SkyCoord` or subclass\n            The new `SkyCoord` (or subclass) object.\n\n        Raises\n        ------\n        ValueError\n            If more than one match is found in the table for a component,\n            unless the additional matches are also valid frame component names.\n            If a \"coord_kwargs\" is provided for a value also found in the table.\n\n        \"\"\"\n        _frame_cls, _frame_kwargs = _get_frame_without_data([], coord_kwargs)\n        frame = _frame_cls(**_frame_kwargs)\n        coord_kwargs['frame'] = coord_kwargs.get('frame', frame)\n\n        representation_component_names = (\n            set(frame.get_representation_component_names())\n            .union(set(frame.get_representation_component_names(\"s\")))\n        )\n\n        comp_kwargs = {}\n        for comp_name in representation_component_names:\n            # this matches things like 'ra[...]'' but *not* 'rad'.\n            # note that the \"_\" must be in there explicitly, because\n            # \"alphanumeric\" usually includes underscores.\n            starts_with_comp = comp_name + r'(\\W|\\b|_)'\n            # this part matches stuff like 'center_ra', but *not*\n            # 'aura'\n            ends_with_comp = r'.*(\\W|\\b|_)' + comp_name + r'\\b'\n            # the final regex ORs together the two patterns\n            rex = re.compile(rf\"({starts_with_comp})|({ends_with_comp})\",\n                             re.IGNORECASE | re.UNICODE)\n\n            # find all matches\n            matches = {col_name for col_name in table.colnames\n                       if rex.match(col_name)}\n\n            # now need to select among matches, also making sure we don't have\n            # an exact match with another component\n            if len(matches) == 0:  # no matches\n                continue\n            elif len(matches) == 1:  # only one match\n                col_name = matches.pop()\n            else:  # more than 1 match\n                # try to sieve out other components\n                matches -= representation_component_names - {comp_name}\n                # if there's only one remaining match, it worked.\n                if len(matches) == 1:\n                    col_name = matches.pop()\n                else:\n                    raise ValueError(\n                        'Found at least two matches for component '\n                        f'\"{comp_name}\": \"{matches}\". Cannot guess coordinates '\n                        'from a table with this ambiguity.')\n\n            comp_kwargs[comp_name] = table[col_name]\n\n        for k, v in comp_kwargs.items():\n            if k in coord_kwargs:\n                raise ValueError('Found column \"{}\" in table, but it was '\n                                 'already provided as \"{}\" keyword to '\n                                 'guess_from_table function.'.format(v.name, k))\n            else:\n                coord_kwargs[k] = v\n\n        return cls(**coord_kwargs)\n\n    # Name resolve\n    @classmethod\n    def from_name(cls, name, frame='icrs', parse=False, cache=True):\n        \"\"\"\n        Given a name, query the CDS name resolver to attempt to retrieve\n        coordinate information for that object. The search database, sesame\n        url, and  query timeout can be set through configuration items in\n        ``astropy.coordinates.name_resolve`` -- see docstring for\n        `~astropy.coordinates.get_icrs_coordinates` for more\n        information.\n\n        Parameters\n        ----------\n        name : str\n            The name of the object to get coordinates for, e.g. ``'M42'``.\n        frame : str or `BaseCoordinateFrame` class or instance\n            The frame to transform the object to.\n        parse: bool\n            Whether to attempt extracting the coordinates from the name by\n            parsing with a regex. For objects catalog names that have\n            J-coordinates embedded in their names, e.g.,\n            'CRTS SSS100805 J194428-420209', this may be much faster than a\n            Sesame query for the same object name. The coordinates extracted\n            in this way may differ from the database coordinates by a few\n            deci-arcseconds, so only use this option if you do not need\n            sub-arcsecond accuracy for coordinates.\n        cache : bool, optional\n            Determines whether to cache the results or not. To update or\n            overwrite an existing value, pass ``cache='update'``.\n\n        Returns\n        -------\n        coord : SkyCoord\n            Instance of the SkyCoord class.\n        \"\"\"\n\n        from .name_resolve import get_icrs_coordinates\n\n        icrs_coord = get_icrs_coordinates(name, parse, cache=cache)\n        icrs_sky_coord = cls(icrs_coord)\n        if frame in ('icrs', icrs_coord.__class__):\n            return icrs_sky_coord\n        else:\n            return icrs_sky_coord.transform_to(frame)"},{"col":4,"comment":"null","endLoc":354,"header":"@property\n    def frame(self)","id":4073,"name":"frame","nodeType":"Function","startLoc":352,"text":"@property\n    def frame(self):\n        return self._sky_coord_frame"},{"col":4,"comment":"null","endLoc":358,"header":"@property\n    def representation_type(self)","id":4074,"name":"representation_type","nodeType":"Function","startLoc":356,"text":"@property\n    def representation_type(self):\n        return self.frame.representation_type"},{"col":4,"comment":"null","endLoc":362,"header":"@representation_type.setter\n    def representation_type(self, value)","id":4075,"name":"representation_type","nodeType":"Function","startLoc":360,"text":"@representation_type.setter\n    def representation_type(self, value):\n        self.frame.representation_type = value"},{"col":4,"comment":"null","endLoc":367,"header":"@property\n    def representation(self)","id":4076,"name":"representation","nodeType":"Function","startLoc":365,"text":"@property\n    def representation(self):\n        return self.frame.representation"},{"col":4,"comment":"null","endLoc":371,"header":"@representation.setter\n    def representation(self, value)","id":4077,"name":"representation","nodeType":"Function","startLoc":369,"text":"@representation.setter\n    def representation(self, value):\n        self.frame.representation = value"},{"col":4,"comment":"null","endLoc":375,"header":"@property\n    def shape(self)","id":4078,"name":"shape","nodeType":"Function","startLoc":373,"text":"@property\n    def shape(self):\n        return self.frame.shape"},{"col":4,"comment":"Equality operator for SkyCoord\n\n        This implements strict equality and requires that the frames are\n        equivalent, extra frame attributes are equivalent, and that the\n        representation data are exactly equal.\n        ","endLoc":395,"header":"def __eq__(self, value)","id":4079,"name":"__eq__","nodeType":"Function","startLoc":377,"text":"def __eq__(self, value):\n        \"\"\"Equality operator for SkyCoord\n\n        This implements strict equality and requires that the frames are\n        equivalent, extra frame attributes are equivalent, and that the\n        representation data are exactly equal.\n        \"\"\"\n        if not isinstance(value, SkyCoord):\n            return NotImplemented\n        # Make sure that any extra frame attribute names are equivalent.\n        for attr in self._extra_frameattr_names | value._extra_frameattr_names:\n            if not self.frame._frameattr_equiv(getattr(self, attr),\n                                               getattr(value, attr)):\n                raise ValueError(f\"cannot compare: extra frame attribute \"\n                                 f\"'{attr}' is not equivalent \"\n                                 f\"(perhaps compare the frames directly to avoid \"\n                                 f\"this exception)\")\n\n        return self._sky_coord_frame == value._sky_coord_frame"},{"col":4,"comment":"null","endLoc":398,"header":"def __ne__(self, value)","id":4080,"name":"__ne__","nodeType":"Function","startLoc":397,"text":"def __ne__(self, value):\n        return np.logical_not(self == value)"},{"col":4,"comment":"Create a new instance, applying a method to the underlying data.\n\n        In typical usage, the method is any of the shape-changing methods for\n        `~numpy.ndarray` (``reshape``, ``swapaxes``, etc.), as well as those\n        picking particular elements (``__getitem__``, ``take``, etc.), which\n        are all defined in `~astropy.utils.shapes.ShapedLikeNDArray`. It will be\n        applied to the underlying arrays in the representation (e.g., ``x``,\n        ``y``, and ``z`` for `~astropy.coordinates.CartesianRepresentation`),\n        as well as to any frame attributes that have a shape, with the results\n        used to create a new instance.\n\n        Internally, it is also used to apply functions to the above parts\n        (in particular, `~numpy.broadcast_to`).\n\n        Parameters\n        ----------\n        method : str or callable\n            If str, it is the name of a method that is applied to the internal\n            ``components``. If callable, the function is applied.\n        args : tuple\n            Any positional arguments for ``method``.\n        kwargs : dict\n            Any keyword arguments for ``method``.\n        ","endLoc":456,"header":"def _apply(self, method, *args, **kwargs)","id":4081,"name":"_apply","nodeType":"Function","startLoc":400,"text":"def _apply(self, method, *args, **kwargs):\n        \"\"\"Create a new instance, applying a method to the underlying data.\n\n        In typical usage, the method is any of the shape-changing methods for\n        `~numpy.ndarray` (``reshape``, ``swapaxes``, etc.), as well as those\n        picking particular elements (``__getitem__``, ``take``, etc.), which\n        are all defined in `~astropy.utils.shapes.ShapedLikeNDArray`. It will be\n        applied to the underlying arrays in the representation (e.g., ``x``,\n        ``y``, and ``z`` for `~astropy.coordinates.CartesianRepresentation`),\n        as well as to any frame attributes that have a shape, with the results\n        used to create a new instance.\n\n        Internally, it is also used to apply functions to the above parts\n        (in particular, `~numpy.broadcast_to`).\n\n        Parameters\n        ----------\n        method : str or callable\n            If str, it is the name of a method that is applied to the internal\n            ``components``. If callable, the function is applied.\n        args : tuple\n            Any positional arguments for ``method``.\n        kwargs : dict\n            Any keyword arguments for ``method``.\n        \"\"\"\n        def apply_method(value):\n            if isinstance(value, ShapedLikeNDArray):\n                return value._apply(method, *args, **kwargs)\n            else:\n                if callable(method):\n                    return method(value, *args, **kwargs)\n                else:\n                    return getattr(value, method)(*args, **kwargs)\n\n        # create a new but empty instance, and copy over stuff\n        new = super().__new__(self.__class__)\n        new._sky_coord_frame = self._sky_coord_frame._apply(method,\n                                                            *args, **kwargs)\n        new._extra_frameattr_names = self._extra_frameattr_names.copy()\n        for attr in self._extra_frameattr_names:\n            value = getattr(self, attr)\n            if getattr(value, 'shape', ()):\n                value = apply_method(value)\n            elif method == 'copy' or method == 'flatten':\n                # flatten should copy also for a single element array, but\n                # we cannot use it directly for array scalars, since it\n                # always returns a one-dimensional array. So, just copy.\n                value = copy.copy(value)\n            setattr(new, '_' + attr, value)\n\n        # Copy other 'info' attr only if it has actually been defined.\n        # See PR #3898 for further explanation and justification, along\n        # with Quantity.__array_finalize__\n        if 'info' in self.__dict__:\n            new.info = self.info\n\n        return new"},{"col":4,"comment":"null","endLoc":2124,"header":"def __init__(self, amplitude=amplitude.default, x_0=x_0.default,\n                 y_0=y_0.default, r_in=None, width=None,\n                 r_out=None, **kwargs)","id":4082,"name":"__init__","nodeType":"Function","startLoc":2098,"text":"def __init__(self, amplitude=amplitude.default, x_0=x_0.default,\n                 y_0=y_0.default, r_in=None, width=None,\n                 r_out=None, **kwargs):\n        if (r_in is None) and (r_out is None) and (width is None):\n            r_in = self.r_in.default\n            width = self.width.default\n        elif (r_in is not None) and (r_out is None) and (width is None):\n            width = self.width.default\n        elif (r_in is None) and (r_out is not None) and (width is None):\n            r_in = self.r_in.default\n            width = r_out - r_in\n        elif (r_in is None) and (r_out is None) and (width is not None):\n            r_in = self.r_in.default\n        elif (r_in is not None) and (r_out is not None) and (width is None):\n            width = r_out - r_in\n        elif (r_in is None) and (r_out is not None) and (width is not None):\n            r_in = r_out - width\n        elif (r_in is not None) and (r_out is not None) and (width is not None):\n            if np.any(width != (r_out - r_in)):\n                raise InputParameterError(\"Width must be r_out - r_in\")\n\n        if np.any(r_in < 0) or np.any(width < 0):\n            raise InputParameterError(f\"{r_in=} and {width=} must both be >=0\")\n\n        super().__init__(\n            amplitude=amplitude, x_0=x_0, y_0=y_0, r_in=r_in, width=width,\n            **kwargs)"},{"col":4,"comment":"null","endLoc":266,"header":"def __init__(\n        self,\n        mapping,\n        input_units_equivalencies=None,\n        input_units_allow_dimensionless=False,\n        name=None,\n        meta=None\n    )","id":4083,"name":"__init__","nodeType":"Function","startLoc":243,"text":"def __init__(\n        self,\n        mapping,\n        input_units_equivalencies=None,\n        input_units_allow_dimensionless=False,\n        name=None,\n        meta=None\n    ):\n        self._mapping = mapping\n\n        none_mapping_count = len([m for m in mapping if m[-1] is None])\n        if none_mapping_count > 0 and none_mapping_count != len(mapping):\n            raise ValueError(\"If one return unit is None, then all must be None\")\n\n        # These attributes are read and handled by Model\n        self._input_units_strict = True\n        self.input_units_equivalencies = input_units_equivalencies\n        self._input_units_allow_dimensionless = input_units_allow_dimensionless\n\n        super().__init__(name=name, meta=meta)\n\n        # Can't invoke this until after super().__init__, since\n        # we need self.inputs and self.outputs to be populated.\n        self._rebuild_units()"},{"col":4,"comment":"null","endLoc":571,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":4084,"name":"to_tree_transform","nodeType":"Function","startLoc":564,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'r_in': _parameter_to_value(model.r_in),\n                'width': _parameter_to_value(model.width)}\n        return node"},{"col":4,"comment":"null","endLoc":583,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4085,"name":"assert_equal","nodeType":"Function","startLoc":573,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Ring2D) and\n                isinstance(b, functional_models.Ring2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.r_in, b.r_in)\n        assert_array_equal(a.width, b.width)"},{"col":4,"comment":"\n        This method sets the ``domain`` and ``window`` attributes on 1D subclasses.\n\n        ","endLoc":170,"header":"def _set_default_domain_window(self, domain, window)","id":4086,"name":"_set_default_domain_window","nodeType":"Function","startLoc":160,"text":"def _set_default_domain_window(self, domain, window):\n        \"\"\"\n        This method sets the ``domain`` and ``window`` attributes on 1D subclasses.\n\n        \"\"\"\n\n        self._default_domain_window = {'domain': None,\n                                       'window': (-1, 1)\n                                       }\n        self.window = window or (-1, 1)\n        self.domain = domain"},{"attributeType":"null","col":4,"comment":"null","endLoc":552,"id":4087,"name":"name","nodeType":"Attribute","startLoc":552,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":553,"id":4088,"name":"version","nodeType":"Attribute","startLoc":553,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":554,"id":4089,"name":"types","nodeType":"Attribute","startLoc":554,"text":"types"},{"className":"Sersic1DType","col":0,"comment":"null","endLoc":612,"id":4090,"nodeType":"Class","startLoc":586,"text":"class Sersic1DType(TransformType):\n    name = 'transform/sersic1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Sersic1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Sersic1D(amplitude=node['amplitude'],\n                                          r_eff=node['r_eff'],\n                                          n=node['n'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'r_eff': _parameter_to_value(model.r_eff),\n                'n': _parameter_to_value(model.n)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Sersic1D) and\n                isinstance(b, functional_models.Sersic1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.r_eff, b.r_eff)\n        assert_array_equal(a.n, b.n)"},{"col":4,"comment":"null","endLoc":595,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4091,"name":"from_tree_transform","nodeType":"Function","startLoc":591,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Sersic1D(amplitude=node['amplitude'],\n                                          r_eff=node['r_eff'],\n                                          n=node['n'])"},{"col":0,"comment":"\n    Make a ``Tabular`` model where ``n_inputs`` is\n    based on the dimension of the lookup_table.\n\n    This model has to be further initialized and when evaluated\n    returns the interpolated values.\n\n    Parameters\n    ----------\n    dim : int\n        Dimensions of the lookup table.\n    name : str\n        Name for the class.\n\n    Examples\n    --------\n    >>> table = np.array([[3., 0., 0.],\n    ...                   [0., 2., 0.],\n    ...                   [0., 0., 0.]])\n\n    >>> tab = tabular_model(2, name='Tabular2D')\n    >>> print(tab)\n    <class 'astropy.modeling.tabular.Tabular2D'>\n    Name: Tabular2D\n    N_inputs: 2\n    N_outputs: 1\n\n    >>> points = ([1, 2, 3], [1, 2, 3])\n\n    Setting fill_value to None, allows extrapolation.\n    >>> m = tab(points, lookup_table=table, name='my_table',\n    ...         bounds_error=False, fill_value=None, method='nearest')\n\n    >>> xinterp = [0, 1, 1.5, 2.72, 3.14]\n    >>> m(xinterp, xinterp)  # doctest: +FLOAT_CMP\n    array([3., 3., 3., 0., 0.])\n\n    ","endLoc":320,"header":"def tabular_model(dim, name=None)","id":4092,"name":"tabular_model","nodeType":"Function","startLoc":263,"text":"def tabular_model(dim, name=None):\n    \"\"\"\n    Make a ``Tabular`` model where ``n_inputs`` is\n    based on the dimension of the lookup_table.\n\n    This model has to be further initialized and when evaluated\n    returns the interpolated values.\n\n    Parameters\n    ----------\n    dim : int\n        Dimensions of the lookup table.\n    name : str\n        Name for the class.\n\n    Examples\n    --------\n    >>> table = np.array([[3., 0., 0.],\n    ...                   [0., 2., 0.],\n    ...                   [0., 0., 0.]])\n\n    >>> tab = tabular_model(2, name='Tabular2D')\n    >>> print(tab)\n    <class 'astropy.modeling.tabular.Tabular2D'>\n    Name: Tabular2D\n    N_inputs: 2\n    N_outputs: 1\n\n    >>> points = ([1, 2, 3], [1, 2, 3])\n\n    Setting fill_value to None, allows extrapolation.\n    >>> m = tab(points, lookup_table=table, name='my_table',\n    ...         bounds_error=False, fill_value=None, method='nearest')\n\n    >>> xinterp = [0, 1, 1.5, 2.72, 3.14]\n    >>> m(xinterp, xinterp)  # doctest: +FLOAT_CMP\n    array([3., 3., 3., 0., 0.])\n\n    \"\"\"\n    if dim < 1:\n        raise ValueError('Lookup table must have at least one dimension.')\n\n    table = np.zeros([2] * dim)\n    members = {'lookup_table': table, 'n_inputs': dim, 'n_outputs': 1}\n\n    if dim == 1:\n        members['_separable'] = True\n    else:\n        members['_separable'] = False\n\n    if name is None:\n        model_id = _Tabular._id\n        _Tabular._id += 1\n        name = f'Tabular{model_id}'\n\n    model_class = type(str(name), (_Tabular,), members)\n    model_class.__module__ = 'astropy.modeling.tabular'\n    return model_class"},{"col":4,"comment":"null","endLoc":602,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":4093,"name":"to_tree_transform","nodeType":"Function","startLoc":597,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'r_eff': _parameter_to_value(model.r_eff),\n                'n': _parameter_to_value(model.n)}\n        return node"},{"col":4,"comment":"null","endLoc":612,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4094,"name":"assert_equal","nodeType":"Function","startLoc":604,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Sersic1D) and\n                isinstance(b, functional_models.Sersic1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.r_eff, b.r_eff)\n        assert_array_equal(a.n, b.n)"},{"col":4,"comment":"null","endLoc":1035,"header":"def __init__(self, degree, x_domain=None, y_domain=None,\n                 x_window=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":4095,"name":"__init__","nodeType":"Function","startLoc":1018,"text":"def __init__(self, degree, x_domain=None, y_domain=None,\n                 x_window=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            degree, n_models=n_models, model_set_axis=model_set_axis,\n            name=name, meta=meta, **params)\n\n        self._default_domain_window = {\n            'x_domain': (-1, 1),\n            'y_domain': (-1, 1),\n            'x_window': (-1, 1),\n            'y_window': (-1, 1)\n            }\n\n        self.x_domain = x_domain or self._default_domain_window['x_domain']\n        self.y_domain = y_domain or self._default_domain_window['y_domain']\n        self.x_window = x_window or self._default_domain_window['x_window']\n        self.y_window = y_window or self._default_domain_window['y_window']"},{"col":4,"comment":"null","endLoc":3101,"header":"def _apply_operators_to_value_lists(self, leftval, rightval, **kw)","id":4096,"name":"_apply_operators_to_value_lists","nodeType":"Function","startLoc":3080,"text":"def _apply_operators_to_value_lists(self, leftval, rightval, **kw):\n        op = self.op\n        if op == '+':\n            return binary_operation(operator.add, leftval, rightval)\n        elif op == '-':\n            return binary_operation(operator.sub, leftval, rightval)\n        elif op == '*':\n            return binary_operation(operator.mul, leftval, rightval)\n        elif op == '/':\n            return binary_operation(operator.truediv, leftval, rightval)\n        elif op == '**':\n            return binary_operation(operator.pow, leftval, rightval)\n        elif op == '&':\n            if not isinstance(leftval, tuple):\n                leftval = (leftval,)\n            if not isinstance(rightval, tuple):\n                rightval = (rightval,)\n            return leftval + rightval\n        elif op in SPECIAL_OPERATORS:\n            return binary_operation(SPECIAL_OPERATORS[op], leftval, rightval)\n        else:\n            raise ModelDefinitionError('Unrecognized operator {op}')"},{"attributeType":"null","col":4,"comment":"null","endLoc":587,"id":4097,"name":"name","nodeType":"Attribute","startLoc":587,"text":"name"},{"col":4,"comment":"null","endLoc":172,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":4098,"name":"to_tree_transform","nodeType":"Function","startLoc":141,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        if isinstance(model, modeling.models.Polynomial1D):\n            coefficients = np.array(model.parameters)\n        elif isinstance(model, modeling.models.Polynomial2D):\n            degree = model.degree\n            coefficients = np.zeros((degree + 1, degree + 1))\n            for i in range(degree + 1):\n                for j in range(degree + 1):\n                    if i + j < degree + 1:\n                        name = 'c' + str(i) + '_' + str(j)\n                        coefficients[i, j] = getattr(model, name).value\n        node = {'coefficients': coefficients}\n        typeindex = cls.types.index(model.__class__)\n        ndim = (typeindex % 2) + 1\n\n        if cls.version >= PolynomialTypeBase.DOMAIN_WINDOW_MIN_VERSION:\n            # Schema versions prior to 1.2 included an unrelated \"domain\"\n            # property.  We can't serialize the new domain values with those\n            # versions because they don't validate.\n            if ndim == 1:\n                if model.domain is not None:\n                    node['domain'] = model.domain\n                if model.window is not None:\n                    node['window'] = model.window\n            else:\n                if model.x_domain or model.y_domain is not None:\n                    node['domain'] = (model.x_domain, model.y_domain)\n                if model.x_window or model.y_window is not None:\n                    node['window'] = (model.x_window, model.y_window)\n\n        return node"},{"attributeType":"null","col":4,"comment":"null","endLoc":588,"id":4099,"name":"version","nodeType":"Attribute","startLoc":588,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":589,"id":4100,"name":"types","nodeType":"Attribute","startLoc":589,"text":"types"},{"className":"Sersic2DType","col":0,"comment":"null","endLoc":655,"id":4101,"nodeType":"Class","startLoc":615,"text":"class Sersic2DType(TransformType):\n    name = 'transform/sersic2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Sersic2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Sersic2D(amplitude=node['amplitude'],\n                                          r_eff=node['r_eff'],\n                                          n=node['n'],\n                                          x_0=node['x_0'],\n                                          y_0=node['y_0'],\n                                          ellip=node['ellip'],\n                                          theta=node['theta'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'r_eff': _parameter_to_value(model.r_eff),\n                'n': _parameter_to_value(model.n),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'ellip': _parameter_to_value(model.ellip),\n                'theta': _parameter_to_value(model.theta)\n\n                }\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Sersic2D) and\n                isinstance(b, functional_models.Sersic2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.r_eff, b.r_eff)\n        assert_array_equal(a.n, b.n)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.ellip, b.ellip)\n        assert_array_equal(a.theta, b.theta)"},{"col":4,"comment":"null","endLoc":628,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4102,"name":"from_tree_transform","nodeType":"Function","startLoc":620,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Sersic2D(amplitude=node['amplitude'],\n                                          r_eff=node['r_eff'],\n                                          n=node['n'],\n                                          x_0=node['x_0'],\n                                          y_0=node['y_0'],\n                                          ellip=node['ellip'],\n                                          theta=node['theta'])"},{"col":4,"comment":"null","endLoc":269,"header":"def _rebuild_units(self)","id":4103,"name":"_rebuild_units","nodeType":"Function","startLoc":268,"text":"def _rebuild_units(self):\n        self._input_units = {input_name: input_unit for input_name, (input_unit, _) in zip(self.inputs, self.mapping)}"},{"col":0,"comment":"\n    Perform binary operation. Operands may be matching tuples of operands.\n    ","endLoc":4026,"header":"def binary_operation(binoperator, left, right)","id":4104,"name":"binary_operation","nodeType":"Function","startLoc":4019,"text":"def binary_operation(binoperator, left, right):\n    '''\n    Perform binary operation. Operands may be matching tuples of operands.\n    '''\n    if isinstance(left, tuple) and isinstance(right, tuple):\n        return tuple([binoperator(item[0], item[1])\n                      for item in zip(left, right)])\n    return binoperator(left, right)"},{"col":4,"comment":"null","endLoc":641,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":4105,"name":"to_tree_transform","nodeType":"Function","startLoc":630,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'r_eff': _parameter_to_value(model.r_eff),\n                'n': _parameter_to_value(model.n),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'ellip': _parameter_to_value(model.ellip),\n                'theta': _parameter_to_value(model.theta)\n\n                }\n        return node"},{"col":4,"comment":"null","endLoc":57,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":4106,"name":"to_tree_transform","nodeType":"Function","startLoc":48,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {}\n        if model.fill_value is not None:\n            node[\"fill_value\"] = model.fill_value\n        node[\"lookup_table\"] = model.lookup_table\n        node[\"points\"] = [p for p in model.points]\n        node[\"method\"] = str(model.method)\n        node[\"bounds_error\"] = model.bounds_error\n        return node"},{"col":4,"comment":"null","endLoc":89,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4107,"name":"assert_equal","nodeType":"Function","startLoc":59,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        if isinstance(a.lookup_table, u.Quantity):\n            assert u.allclose(a.lookup_table, b.lookup_table)\n            assert u.allclose(a.points, b.points)\n            a_box = a.bounding_box\n            if isinstance(a_box, ModelBoundingBox):\n                a_box = a_box.bounding_box()\n            b_box = b.bounding_box\n            if isinstance(b_box, ModelBoundingBox):\n                b_box = b_box.bounding_box()\n            for i in range(len(a_box)):\n                assert u.allclose(a_box[i], b_box[i])\n        else:\n            assert_array_equal(a.lookup_table, b.lookup_table)\n            assert_array_equal(a.points, b.points)\n            a_box = a.bounding_box\n            if isinstance(a_box, ModelBoundingBox):\n                a_box = a_box.bounding_box()\n            b_box = b.bounding_box\n            if isinstance(b_box, ModelBoundingBox):\n                b_box = b_box.bounding_box()\n            assert_array_equal(a_box, b_box)\n        assert (a.method == b.method)\n        if a.fill_value is None:\n            assert b.fill_value is None\n        elif np.isnan(a.fill_value):\n            assert np.isnan(b.fill_value)\n        else:\n            assert(a.fill_value == b.fill_value)\n        assert(a.bounds_error == b.bounds_error)"},{"col":0,"comment":"\n    Whether two arrays are element-wise equal within a tolerance.\n\n    Parameters\n    ----------\n    a, b : array-like or `~astropy.units.Quantity`\n        Input values or arrays to compare\n    rtol : array-like or `~astropy.units.Quantity`\n        The relative tolerance for the comparison, which defaults to\n        ``1e-5``.  If ``rtol`` is a :class:`~astropy.units.Quantity`,\n        then it must be dimensionless.\n    atol : number or `~astropy.units.Quantity`\n        The absolute tolerance for the comparison.  The units (or lack\n        thereof) of ``a``, ``b``, and ``atol`` must be consistent with\n        each other.  If `None`, ``atol`` defaults to zero in the\n        appropriate units.\n    equal_nan : `bool`\n        Whether to compare NaN’s as equal. If `True`, NaNs in ``a`` will\n        be considered equal to NaN’s in ``b``.\n\n    Notes\n    -----\n    This is a :class:`~astropy.units.Quantity`-aware version of\n    :func:`numpy.allclose`. However, this differs from the `numpy` function in\n    that the default for the absolute tolerance here is zero instead of\n    ``atol=1e-8`` in `numpy`, as there is no natural way to set a default\n    *absolute* tolerance given two inputs that may have differently scaled\n    units.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If the dimensions of ``a``, ``b``, or ``atol`` are incompatible,\n        or if ``rtol`` is not dimensionless.\n\n    See also\n    --------\n    isclose\n    ","endLoc":2005,"header":"def allclose(a, b, rtol=1.e-5, atol=None, equal_nan=False, **kwargs) -> bool","id":4108,"name":"allclose","nodeType":"Function","startLoc":1964,"text":"def allclose(a, b, rtol=1.e-5, atol=None, equal_nan=False, **kwargs) -> bool:\n    \"\"\"\n    Whether two arrays are element-wise equal within a tolerance.\n\n    Parameters\n    ----------\n    a, b : array-like or `~astropy.units.Quantity`\n        Input values or arrays to compare\n    rtol : array-like or `~astropy.units.Quantity`\n        The relative tolerance for the comparison, which defaults to\n        ``1e-5``.  If ``rtol`` is a :class:`~astropy.units.Quantity`,\n        then it must be dimensionless.\n    atol : number or `~astropy.units.Quantity`\n        The absolute tolerance for the comparison.  The units (or lack\n        thereof) of ``a``, ``b``, and ``atol`` must be consistent with\n        each other.  If `None`, ``atol`` defaults to zero in the\n        appropriate units.\n    equal_nan : `bool`\n        Whether to compare NaN’s as equal. If `True`, NaNs in ``a`` will\n        be considered equal to NaN’s in ``b``.\n\n    Notes\n    -----\n    This is a :class:`~astropy.units.Quantity`-aware version of\n    :func:`numpy.allclose`. However, this differs from the `numpy` function in\n    that the default for the absolute tolerance here is zero instead of\n    ``atol=1e-8`` in `numpy`, as there is no natural way to set a default\n    *absolute* tolerance given two inputs that may have differently scaled\n    units.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If the dimensions of ``a``, ``b``, or ``atol`` are incompatible,\n        or if ``rtol`` is not dimensionless.\n\n    See also\n    --------\n    isclose\n    \"\"\"\n    unquantified_args = _unquantify_allclose_arguments(a, b, rtol, atol)\n    return np.allclose(*unquantified_args, equal_nan=equal_nan, **kwargs)"},{"col":0,"comment":"null","endLoc":2042,"header":"def _unquantify_allclose_arguments(actual, desired, rtol, atol)","id":4109,"name":"_unquantify_allclose_arguments","nodeType":"Function","startLoc":2008,"text":"def _unquantify_allclose_arguments(actual, desired, rtol, atol):\n    actual = Quantity(actual, subok=True, copy=False)\n\n    desired = Quantity(desired, subok=True, copy=False)\n    try:\n        desired = desired.to(actual.unit)\n    except UnitsError:\n        raise UnitsError(\n            f\"Units for 'desired' ({desired.unit}) and 'actual' \"\n            f\"({actual.unit}) are not convertible\"\n        )\n\n    if atol is None:\n        # By default, we assume an absolute tolerance of zero in the\n        # appropriate units.  The default value of None for atol is\n        # needed because the units of atol must be consistent with the\n        # units for a and b.\n        atol = Quantity(0)\n    else:\n        atol = Quantity(atol, subok=True, copy=False)\n        try:\n            atol = atol.to(actual.unit)\n        except UnitsError:\n            raise UnitsError(\n                f\"Units for 'atol' ({atol.unit}) and 'actual' \"\n                f\"({actual.unit}) are not convertible\"\n            )\n\n    rtol = Quantity(rtol, subok=True, copy=False)\n    try:\n        rtol = rtol.to(dimensionless_unscaled)\n    except Exception:\n        raise UnitsError(\"'rtol' should be dimensionless\")\n\n    return actual.value, desired.value, rtol.value, atol.value"},{"col":4,"comment":"null","endLoc":192,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4110,"name":"assert_equal","nodeType":"Function","startLoc":174,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, (modeling.models.Polynomial1D, modeling.models.Polynomial2D)) and\n                isinstance(b, (modeling.models.Polynomial1D, modeling.models.Polynomial2D)))\n        assert_array_equal(a.parameters, b.parameters)\n\n        if cls.version > PolynomialTypeBase.DOMAIN_WINDOW_MIN_VERSION:\n            # Schema versions prior to 1.2 are known not to serialize\n            # domain or window.\n            if isinstance(a, modeling.models.Polynomial1D):\n                assert a.domain == b.domain\n                assert a.window == b.window\n            else:\n                assert a.x_domain == b.x_domain\n                assert a.x_window == b.x_window\n                assert a.y_domain == b.y_domain\n                assert a.y_window == b.y_window"},{"attributeType":"null","col":4,"comment":"null","endLoc":98,"id":4111,"name":"DOMAIN_WINDOW_MIN_VERSION","nodeType":"Attribute","startLoc":98,"text":"DOMAIN_WINDOW_MIN_VERSION"},{"attributeType":"null","col":4,"comment":"null","endLoc":100,"id":4112,"name":"name","nodeType":"Attribute","startLoc":100,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":101,"id":4113,"name":"types","nodeType":"Attribute","startLoc":101,"text":"types"},{"className":"PolynomialType1_0","col":0,"comment":"null","endLoc":196,"id":4114,"nodeType":"Class","startLoc":195,"text":"class PolynomialType1_0(PolynomialTypeBase):\n    version = \"1.0.0\""},{"attributeType":"null","col":4,"comment":"null","endLoc":196,"id":4115,"name":"version","nodeType":"Attribute","startLoc":196,"text":"version"},{"className":"PolynomialType1_1","col":0,"comment":"null","endLoc":200,"id":4116,"nodeType":"Class","startLoc":199,"text":"class PolynomialType1_1(PolynomialTypeBase):\n    version = \"1.1.0\""},{"attributeType":"null","col":4,"comment":"null","endLoc":200,"id":4117,"name":"version","nodeType":"Attribute","startLoc":200,"text":"version"},{"className":"PolynomialType1_2","col":0,"comment":"null","endLoc":204,"id":4118,"nodeType":"Class","startLoc":203,"text":"class PolynomialType1_2(PolynomialTypeBase):\n    version = \"1.2.0\""},{"attributeType":"null","col":4,"comment":"null","endLoc":204,"id":4119,"name":"version","nodeType":"Attribute","startLoc":204,"text":"version"},{"className":"OrthoPolynomialType","col":0,"comment":"null","endLoc":295,"id":4120,"nodeType":"Class","startLoc":207,"text":"class OrthoPolynomialType(TransformType):\n    name = \"transform/ortho_polynomial\"\n    types = ['astropy.modeling.models.Legendre1D',\n             'astropy.modeling.models.Legendre2D',\n             'astropy.modeling.models.Chebyshev1D',\n             'astropy.modeling.models.Chebyshev2D',\n             'astropy.modeling.models.Hermite1D',\n             'astropy.modeling.models.Hermite2D']\n    typemap = {\n        'legendre': 0,\n        'chebyshev': 2,\n        'hermite': 4,\n    }\n\n    invtypemap = dict([[v, k] for k, v in typemap.items()])\n\n    version = \"1.0.0\"\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        coefficients = np.asarray(node['coefficients'])\n        n_dim = coefficients.ndim\n        poly_type = node['polynomial_type']\n        if n_dim == 1:\n            domain = node.get('domain', None)\n            window = node.get('window', None)\n            model = cls.types[cls.typemap[poly_type]](coefficients.size - 1,\n                                                      domain=domain, window=window)\n            model.parameters = coefficients\n        elif n_dim == 2:\n            x_domain, y_domain = tuple(node.get('domain', (None, None)))\n            x_window, y_window = tuple(node.get('window', (None, None)))\n            coeffs = {}\n            shape = coefficients.shape\n            x_degree = shape[0] - 1\n            y_degree = shape[1] - 1\n            for i in range(x_degree + 1):\n                for j in range(y_degree + 1):\n                    name = f'c{i}_{j}'\n                    coeffs[name] = coefficients[i, j]\n            model = cls.types[cls.typemap[poly_type]+1](x_degree, y_degree,\n                                                        x_domain=x_domain,\n                                                        y_domain=y_domain,\n                                                        x_window=x_window,\n                                                        y_window=y_window,\n                                                        **coeffs)\n        else:\n            raise NotImplementedError(\n                \"Asdf currently only supports 1D or 2D polynomial transforms.\")\n        return model\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        typeindex = cls.types.index(model.__class__)\n        poly_type = cls.invtypemap[int(typeindex/2)*2]\n        ndim = (typeindex % 2) + 1\n        if ndim == 1:\n            coefficients = np.array(model.parameters)\n        else:\n            coefficients = np.zeros((model.x_degree + 1, model.y_degree + 1))\n            for i in range(model.x_degree + 1):\n                for j in range(model.y_degree + 1):\n                    name = f'c{i}_{j}'\n                    coefficients[i, j] = getattr(model, name).value\n        node = {'polynomial_type': poly_type, 'coefficients': coefficients}\n        if ndim == 1:\n            if model.domain is not None:\n                node['domain'] = model.domain\n            if model.window is not None:\n                node['window'] = model.window\n        else:\n            if model.x_domain or model.y_domain is not None:\n                node['domain'] = (model.x_domain, model.y_domain)\n            if model.x_window or model.y_window is not None:\n                node['window'] = (model.x_window, model.y_window)\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        # There should be a more elegant way of doing this\n        TransformType.assert_equal(a, b)\n        assert ((isinstance(a, (modeling.models.Legendre1D,   modeling.models.Legendre2D)) and\n                 isinstance(b, (modeling.models.Legendre1D,   modeling.models.Legendre2D))) or\n                (isinstance(a, (modeling.models.Chebyshev1D,  modeling.models.Chebyshev2D)) and\n                 isinstance(b, (modeling.models.Chebyshev1D,  modeling.models.Chebyshev2D))) or\n                (isinstance(a, (modeling.models.Hermite1D,    modeling.models.Hermite2D)) and\n                 isinstance(b, (modeling.models.Hermite1D,    modeling.models.Hermite2D))))\n        assert_array_equal(a.parameters, b.parameters)"},{"col":4,"comment":"null","endLoc":256,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4121,"name":"from_tree_transform","nodeType":"Function","startLoc":225,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        coefficients = np.asarray(node['coefficients'])\n        n_dim = coefficients.ndim\n        poly_type = node['polynomial_type']\n        if n_dim == 1:\n            domain = node.get('domain', None)\n            window = node.get('window', None)\n            model = cls.types[cls.typemap[poly_type]](coefficients.size - 1,\n                                                      domain=domain, window=window)\n            model.parameters = coefficients\n        elif n_dim == 2:\n            x_domain, y_domain = tuple(node.get('domain', (None, None)))\n            x_window, y_window = tuple(node.get('window', (None, None)))\n            coeffs = {}\n            shape = coefficients.shape\n            x_degree = shape[0] - 1\n            y_degree = shape[1] - 1\n            for i in range(x_degree + 1):\n                for j in range(y_degree + 1):\n                    name = f'c{i}_{j}'\n                    coeffs[name] = coefficients[i, j]\n            model = cls.types[cls.typemap[poly_type]+1](x_degree, y_degree,\n                                                        x_domain=x_domain,\n                                                        y_domain=y_domain,\n                                                        x_window=x_window,\n                                                        y_window=y_window,\n                                                        **coeffs)\n        else:\n            raise NotImplementedError(\n                \"Asdf currently only supports 1D or 2D polynomial transforms.\")\n        return model"},{"col":4,"comment":"\n        Return the number of components in a single model, which is\n        obviously 1.\n        ","endLoc":2363,"header":"@property\n    def n_submodels(self)","id":4122,"name":"n_submodels","nodeType":"Function","startLoc":2357,"text":"@property\n    def n_submodels(self):\n        \"\"\"\n        Return the number of components in a single model, which is\n        obviously 1.\n        \"\"\"\n        return 1"},{"col":4,"comment":"null","endLoc":282,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":4123,"name":"to_tree_transform","nodeType":"Function","startLoc":258,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        typeindex = cls.types.index(model.__class__)\n        poly_type = cls.invtypemap[int(typeindex/2)*2]\n        ndim = (typeindex % 2) + 1\n        if ndim == 1:\n            coefficients = np.array(model.parameters)\n        else:\n            coefficients = np.zeros((model.x_degree + 1, model.y_degree + 1))\n            for i in range(model.x_degree + 1):\n                for j in range(model.y_degree + 1):\n                    name = f'c{i}_{j}'\n                    coefficients[i, j] = getattr(model, name).value\n        node = {'polynomial_type': poly_type, 'coefficients': coefficients}\n        if ndim == 1:\n            if model.domain is not None:\n                node['domain'] = model.domain\n            if model.window is not None:\n                node['window'] = model.window\n        else:\n            if model.x_domain or model.y_domain is not None:\n                node['domain'] = (model.x_domain, model.y_domain)\n            if model.x_window or model.y_window is not None:\n                node['window'] = (model.x_window, model.y_window)\n        return node"},{"attributeType":"null","col":4,"comment":"\n    Primarily for informational purposes, these are the types of constraints\n    that can be set on a model's parameters.\n    ","endLoc":621,"id":4124,"name":"parameter_constraints","nodeType":"Attribute","startLoc":621,"text":"parameter_constraints"},{"col":4,"comment":"null","endLoc":3136,"header":"def evaluate(self, *args, **kw)","id":4125,"name":"evaluate","nodeType":"Function","startLoc":3103,"text":"def evaluate(self, *args, **kw):\n        op = self.op\n        args, kw = self._get_kwarg_model_parameters_as_positional(args, kw)\n        left_inputs = self._get_left_inputs_from_args(args)\n        left_params = self._get_left_params_from_args(args)\n\n        if op == 'fix_inputs':\n            pos_index = dict(zip(self.left.inputs, range(self.left.n_inputs)))\n            fixed_inputs = {\n                key if np.issubdtype(type(key), np.integer) else pos_index[key]: value\n                for key, value in self.right.items()\n            }\n            left_inputs = [\n                fixed_inputs[ind] if ind in fixed_inputs.keys() else inp\n                for ind, inp in enumerate(left_inputs)\n            ]\n\n        leftval = self.left.evaluate(*itertools.chain(left_inputs, left_params))\n\n        if op == 'fix_inputs':\n            return leftval\n\n        right_inputs = self._get_right_inputs_from_args(args)\n        right_params = self._get_right_params_from_args(args)\n\n        if op == \"|\":\n            if isinstance(leftval, tuple):\n                return self.right.evaluate(*itertools.chain(leftval, right_params))\n            else:\n                return self.right.evaluate(leftval, *right_params)\n        else:\n            rightval = self.right.evaluate(*itertools.chain(right_inputs, right_params))\n\n        return self._apply_operators_to_value_lists(leftval, rightval, **kw)"},{"attributeType":"null","col":4,"comment":"\n    Primarily for informational purposes, these are the types of constraints\n    that constrain model evaluation.\n    ","endLoc":627,"id":4126,"name":"model_constraints","nodeType":"Attribute","startLoc":627,"text":"model_constraints"},{"col":4,"comment":"null","endLoc":295,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4127,"name":"assert_equal","nodeType":"Function","startLoc":284,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        # There should be a more elegant way of doing this\n        TransformType.assert_equal(a, b)\n        assert ((isinstance(a, (modeling.models.Legendre1D,   modeling.models.Legendre2D)) and\n                 isinstance(b, (modeling.models.Legendre1D,   modeling.models.Legendre2D))) or\n                (isinstance(a, (modeling.models.Chebyshev1D,  modeling.models.Chebyshev2D)) and\n                 isinstance(b, (modeling.models.Chebyshev1D,  modeling.models.Chebyshev2D))) or\n                (isinstance(a, (modeling.models.Hermite1D,    modeling.models.Hermite2D)) and\n                 isinstance(b, (modeling.models.Hermite1D,    modeling.models.Hermite2D))))\n        assert_array_equal(a.parameters, b.parameters)"},{"attributeType":"null","col":4,"comment":"\n    Names of the parameters that describe models of this type.\n\n    The parameters in this tuple are in the same order they should be passed in\n    when initializing a model of a specific type.  Some types of models, such\n    as polynomial models, have a different number of parameters depending on\n    some other property of the model, such as the degree.\n\n    When defining a custom model class the value of this attribute is\n    automatically set by the `~astropy.modeling.Parameter` attributes defined\n    in the class body.\n    ","endLoc":633,"id":4128,"name":"param_names","nodeType":"Attribute","startLoc":633,"text":"param_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":208,"id":4129,"name":"name","nodeType":"Attribute","startLoc":208,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":209,"id":4130,"name":"types","nodeType":"Attribute","startLoc":209,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":215,"id":4131,"name":"typemap","nodeType":"Attribute","startLoc":215,"text":"typemap"},{"attributeType":"null","col":4,"comment":"null","endLoc":221,"id":4132,"name":"invtypemap","nodeType":"Attribute","startLoc":221,"text":"invtypemap"},{"col":4,"comment":"null","endLoc":655,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4133,"name":"assert_equal","nodeType":"Function","startLoc":643,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Sersic2D) and\n                isinstance(b, functional_models.Sersic2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.r_eff, b.r_eff)\n        assert_array_equal(a.n, b.n)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.ellip, b.ellip)\n        assert_array_equal(a.theta, b.theta)"},{"attributeType":"null","col":4,"comment":"null","endLoc":223,"id":4134,"name":"version","nodeType":"Attribute","startLoc":223,"text":"version"},{"className":"Linear1DType","col":0,"comment":"null","endLoc":324,"id":4135,"nodeType":"Class","startLoc":298,"text":"class Linear1DType(TransformType):\n    name = \"transform/linear1d\"\n    version = '1.0.0'\n    types = ['astropy.modeling.models.Linear1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        slope = node.get('slope', None)\n        intercept = node.get('intercept', None)\n\n        return modeling.models.Linear1D(slope=slope, intercept=intercept)\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        return {\n            'slope': _parameter_to_value(model.slope),\n            'intercept': _parameter_to_value(model.intercept),\n        }\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, modeling.models.Linear1D) and\n                isinstance(b, modeling.models.Linear1D))\n        assert_array_equal(a.slope, b.slope)\n        assert_array_equal(a.intercept, b.intercept)"},{"col":4,"comment":"null","endLoc":308,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4136,"name":"from_tree_transform","nodeType":"Function","startLoc":303,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        slope = node.get('slope', None)\n        intercept = node.get('intercept', None)\n\n        return modeling.models.Linear1D(slope=slope, intercept=intercept)"},{"attributeType":"null","col":4,"comment":"The number of inputs.","endLoc":647,"id":4137,"name":"n_inputs","nodeType":"Attribute","startLoc":647,"text":"n_inputs"},{"attributeType":"null","col":4,"comment":" The number of outputs.","endLoc":649,"id":4138,"name":"n_outputs","nodeType":"Attribute","startLoc":649,"text":"n_outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":652,"id":4139,"name":"standard_broadcasting","nodeType":"Attribute","startLoc":652,"text":"standard_broadcasting"},{"attributeType":"null","col":4,"comment":"null","endLoc":616,"id":4140,"name":"name","nodeType":"Attribute","startLoc":616,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":617,"id":4141,"name":"version","nodeType":"Attribute","startLoc":617,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":618,"id":4142,"name":"types","nodeType":"Attribute","startLoc":618,"text":"types"},{"className":"Trigonometric1DType","col":0,"comment":"null","endLoc":682,"id":4143,"nodeType":"Class","startLoc":658,"text":"class Trigonometric1DType(TransformType):\n    _model = None\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return cls._model(amplitude=node['amplitude'],\n                          frequency=node['frequency'],\n                          phase=node['phase'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'frequency': _parameter_to_value(model.frequency),\n                'phase': _parameter_to_value(model.phase)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, cls._model) and\n                isinstance(b, cls._model))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.frequency, b.frequency)\n        assert_array_equal(a.phase, b.phase)"},{"attributeType":"null","col":4,"comment":"null","endLoc":653,"id":4144,"name":"fittable","nodeType":"Attribute","startLoc":653,"text":"fittable"},{"col":4,"comment":"null","endLoc":665,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4145,"name":"from_tree_transform","nodeType":"Function","startLoc":661,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return cls._model(amplitude=node['amplitude'],\n                          frequency=node['frequency'],\n                          phase=node['phase'])"},{"attributeType":"null","col":4,"comment":"null","endLoc":654,"id":4146,"name":"linear","nodeType":"Attribute","startLoc":654,"text":"linear"},{"col":4,"comment":"null","endLoc":672,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":4147,"name":"to_tree_transform","nodeType":"Function","startLoc":667,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'frequency': _parameter_to_value(model.frequency),\n                'phase': _parameter_to_value(model.phase)}\n        return node"},{"col":4,"comment":"null","endLoc":315,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":4148,"name":"to_tree_transform","nodeType":"Function","startLoc":310,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        return {\n            'slope': _parameter_to_value(model.slope),\n            'intercept': _parameter_to_value(model.intercept),\n        }"},{"attributeType":"null","col":4,"comment":" A boolean flag to indicate whether a model is separable.","endLoc":655,"id":4149,"name":"_separable","nodeType":"Attribute","startLoc":655,"text":"_separable"},{"col":4,"comment":"null","endLoc":324,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4150,"name":"assert_equal","nodeType":"Function","startLoc":317,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, modeling.models.Linear1D) and\n                isinstance(b, modeling.models.Linear1D))\n        assert_array_equal(a.slope, b.slope)\n        assert_array_equal(a.intercept, b.intercept)"},{"col":4,"comment":"null","endLoc":682,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4151,"name":"assert_equal","nodeType":"Function","startLoc":674,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, cls._model) and\n                isinstance(b, cls._model))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.frequency, b.frequency)\n        assert_array_equal(a.phase, b.phase)"},{"attributeType":"null","col":4,"comment":"A dict-like object to store optional information.","endLoc":657,"id":4152,"name":"meta","nodeType":"Attribute","startLoc":657,"text":"meta"},{"attributeType":"null","col":4,"comment":"null","endLoc":299,"id":4153,"name":"name","nodeType":"Attribute","startLoc":299,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":300,"id":4154,"name":"version","nodeType":"Attribute","startLoc":300,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":301,"id":4155,"name":"types","nodeType":"Attribute","startLoc":301,"text":"types"},{"attributeType":"None","col":4,"comment":"null","endLoc":659,"id":4156,"name":"_model","nodeType":"Attribute","startLoc":659,"text":"_model"},{"className":"Sine1DType","col":0,"comment":"null","endLoc":690,"id":4157,"nodeType":"Class","startLoc":685,"text":"class Sine1DType(Trigonometric1DType):\n    name = 'transform/sine1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Sine1D']\n\n    _model = functional_models.Sine1D"},{"attributeType":"null","col":4,"comment":"null","endLoc":686,"id":4158,"name":"name","nodeType":"Attribute","startLoc":686,"text":"name"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":4159,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"polynomial.py#<anonymous>","id":4160,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['ShiftType', 'ScaleType', 'Linear1DType']"},{"attributeType":"null","col":4,"comment":"null","endLoc":665,"id":4161,"name":"_inverse","nodeType":"Attribute","startLoc":665,"text":"_inverse"},{"attributeType":"null","col":4,"comment":"null","endLoc":666,"id":4162,"name":"_user_inverse","nodeType":"Attribute","startLoc":666,"text":"_user_inverse"},{"attributeType":"null","col":4,"comment":"null","endLoc":687,"id":4163,"name":"version","nodeType":"Attribute","startLoc":687,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":688,"id":4164,"name":"types","nodeType":"Attribute","startLoc":688,"text":"types"},{"attributeType":"Sine1D","col":4,"comment":"null","endLoc":690,"id":4165,"name":"_model","nodeType":"Attribute","startLoc":690,"text":"_model"},{"attributeType":"null","col":4,"comment":"null","endLoc":668,"id":4166,"name":"_bounding_box","nodeType":"Attribute","startLoc":668,"text":"_bounding_box"},{"attributeType":"null","col":4,"comment":"null","endLoc":669,"id":4167,"name":"_user_bounding_box","nodeType":"Attribute","startLoc":669,"text":"_user_bounding_box"},{"className":"Cosine1DType","col":0,"comment":"null","endLoc":698,"id":4168,"nodeType":"Class","startLoc":693,"text":"class Cosine1DType(Trigonometric1DType):\n    name = 'transform/cosine1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Cosine1D']\n\n    _model = functional_models.Cosine1D"},{"attributeType":"null","col":4,"comment":"null","endLoc":694,"id":4169,"name":"name","nodeType":"Attribute","startLoc":694,"text":"name"},{"fileName":"earthlocation.py","filePath":"astropy/io/misc/asdf/tags/coordinates","id":4170,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\nfrom astropy.coordinates import EarthLocation\n\nfrom ...types import AstropyType\n\n\nclass EarthLocationType(AstropyType):\n    name = 'coordinates/earthlocation'\n    types = [EarthLocation]\n    version = '1.0.0'\n\n    @classmethod\n    def to_tree(cls, obj, ctx):\n        return obj.info._represent_as_dict()\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        return EarthLocation.info._construct_from_dict(node)\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        return (old == new).all()\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":695,"id":4171,"name":"version","nodeType":"Attribute","startLoc":695,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":696,"id":4172,"name":"types","nodeType":"Attribute","startLoc":696,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":671,"id":4173,"name":"_has_inverse_bounding_box","nodeType":"Attribute","startLoc":671,"text":"_has_inverse_bounding_box"},{"attributeType":"Cosine1D","col":4,"comment":"null","endLoc":698,"id":4174,"name":"_model","nodeType":"Attribute","startLoc":698,"text":"_model"},{"className":"EarthLocationType","col":0,"comment":"null","endLoc":23,"id":4175,"nodeType":"Class","startLoc":8,"text":"class EarthLocationType(AstropyType):\n    name = 'coordinates/earthlocation'\n    types = [EarthLocation]\n    version = '1.0.0'\n\n    @classmethod\n    def to_tree(cls, obj, ctx):\n        return obj.info._represent_as_dict()\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        return EarthLocation.info._construct_from_dict(node)\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        return (old == new).all()"},{"className":"Tangent1DType","col":0,"comment":"null","endLoc":706,"id":4176,"nodeType":"Class","startLoc":701,"text":"class Tangent1DType(Trigonometric1DType):\n    name = 'transform/tangent1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Tangent1D']\n\n    _model = functional_models.Tangent1D"},{"attributeType":"null","col":4,"comment":"null","endLoc":702,"id":4177,"name":"name","nodeType":"Attribute","startLoc":702,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":675,"id":4178,"name":"_n_models","nodeType":"Attribute","startLoc":675,"text":"_n_models"},{"col":4,"comment":"null","endLoc":15,"header":"@classmethod\n    def to_tree(cls, obj, ctx)","id":4179,"name":"to_tree","nodeType":"Function","startLoc":13,"text":"@classmethod\n    def to_tree(cls, obj, ctx):\n        return obj.info._represent_as_dict()"},{"attributeType":"null","col":4,"comment":"null","endLoc":703,"id":4180,"name":"version","nodeType":"Attribute","startLoc":703,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":704,"id":4181,"name":"types","nodeType":"Attribute","startLoc":704,"text":"types"},{"attributeType":"Tangent1D","col":4,"comment":"null","endLoc":706,"id":4182,"name":"_model","nodeType":"Attribute","startLoc":706,"text":"_model"},{"attributeType":"null","col":4,"comment":"null","endLoc":679,"id":4183,"name":"_input_units_strict","nodeType":"Attribute","startLoc":679,"text":"_input_units_strict"},{"className":"ArcSine1DType","col":0,"comment":"null","endLoc":714,"id":4184,"nodeType":"Class","startLoc":709,"text":"class ArcSine1DType(Trigonometric1DType):\n    name = 'transform/arcsine1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.ArcSine1D']\n\n    _model = functional_models.ArcSine1D"},{"attributeType":"null","col":4,"comment":"null","endLoc":710,"id":4185,"name":"name","nodeType":"Attribute","startLoc":710,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":711,"id":4186,"name":"version","nodeType":"Attribute","startLoc":711,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":712,"id":4187,"name":"types","nodeType":"Attribute","startLoc":712,"text":"types"},{"attributeType":"ArcSine1D","col":4,"comment":"null","endLoc":714,"id":4188,"name":"_model","nodeType":"Attribute","startLoc":714,"text":"_model"},{"attributeType":"null","col":4,"comment":"null","endLoc":686,"id":4189,"name":"_input_units_allow_dimensionless","nodeType":"Attribute","startLoc":686,"text":"_input_units_allow_dimensionless"},{"col":4,"comment":"null","endLoc":19,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":4190,"name":"from_tree","nodeType":"Function","startLoc":17,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        return EarthLocation.info._construct_from_dict(node)"},{"className":"ArcCosine1DType","col":0,"comment":"null","endLoc":722,"id":4191,"nodeType":"Class","startLoc":717,"text":"class ArcCosine1DType(Trigonometric1DType):\n    name = 'transform/arccosine1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.ArcCosine1D']\n\n    _model = functional_models.ArcCosine1D"},{"attributeType":"null","col":4,"comment":"null","endLoc":718,"id":4192,"name":"name","nodeType":"Attribute","startLoc":718,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":719,"id":4193,"name":"version","nodeType":"Attribute","startLoc":719,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":720,"id":4194,"name":"types","nodeType":"Attribute","startLoc":720,"text":"types"},{"attributeType":"ArcCosine1D","col":4,"comment":"null","endLoc":722,"id":4195,"name":"_model","nodeType":"Attribute","startLoc":722,"text":"_model"},{"attributeType":"null","col":4,"comment":"null","endLoc":691,"id":4196,"name":"input_units_equivalencies","nodeType":"Attribute","startLoc":691,"text":"input_units_equivalencies"},{"className":"ArcTangent1DType","col":0,"comment":"null","endLoc":730,"id":4197,"nodeType":"Class","startLoc":725,"text":"class ArcTangent1DType(Trigonometric1DType):\n    name = 'transform/arctangent1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.ArcTangent1D']\n\n    _model = functional_models.ArcTangent1D"},{"attributeType":"null","col":4,"comment":"null","endLoc":726,"id":4198,"name":"name","nodeType":"Attribute","startLoc":726,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":727,"id":4199,"name":"version","nodeType":"Attribute","startLoc":727,"text":"version"},{"col":4,"comment":"Implement self[item] = value for SkyCoord\n\n        The right hand ``value`` must be strictly consistent with self:\n        - Identical class\n        - Equivalent frames\n        - Identical representation_types\n        - Identical representation differentials keys\n        - Identical frame attributes\n        - Identical \"extra\" frame attributes (e.g. obstime for an ICRS coord)\n\n        With these caveats the setitem ends up as effectively a setitem on\n        the representation data.\n\n          self.frame.data[item] = value.frame.data\n        ","endLoc":487,"header":"def __setitem__(self, item, value)","id":4201,"name":"__setitem__","nodeType":"Function","startLoc":458,"text":"def __setitem__(self, item, value):\n        \"\"\"Implement self[item] = value for SkyCoord\n\n        The right hand ``value`` must be strictly consistent with self:\n        - Identical class\n        - Equivalent frames\n        - Identical representation_types\n        - Identical representation differentials keys\n        - Identical frame attributes\n        - Identical \"extra\" frame attributes (e.g. obstime for an ICRS coord)\n\n        With these caveats the setitem ends up as effectively a setitem on\n        the representation data.\n\n          self.frame.data[item] = value.frame.data\n        \"\"\"\n        if self.__class__ is not value.__class__:\n            raise TypeError(f'can only set from object of same class: '\n                            f'{self.__class__.__name__} vs. '\n                            f'{value.__class__.__name__}')\n\n        # Make sure that any extra frame attribute names are equivalent.\n        for attr in self._extra_frameattr_names | value._extra_frameattr_names:\n            if not self.frame._frameattr_equiv(getattr(self, attr),\n                                               getattr(value, attr)):\n                raise ValueError(f'attribute {attr} is not equivalent')\n\n        # Set the frame values.  This checks frame equivalence and also clears\n        # the cache to ensure that the object is not in an inconsistent state.\n        self._sky_coord_frame[item] = value._sky_coord_frame"},{"col":4,"comment":"null","endLoc":23,"header":"@classmethod\n    def assert_equal(cls, old, new)","id":4202,"name":"assert_equal","nodeType":"Function","startLoc":21,"text":"@classmethod\n    def assert_equal(cls, old, new):\n        return (old == new).all()"},{"attributeType":"null","col":4,"comment":"null","endLoc":695,"id":4203,"name":"_cov_matrix","nodeType":"Attribute","startLoc":695,"text":"_cov_matrix"},{"attributeType":"null","col":4,"comment":"null","endLoc":728,"id":4204,"name":"types","nodeType":"Attribute","startLoc":728,"text":"types"},{"attributeType":"ArcTangent1D","col":4,"comment":"null","endLoc":730,"id":4205,"name":"_model","nodeType":"Attribute","startLoc":730,"text":"_model"},{"attributeType":"null","col":4,"comment":"null","endLoc":696,"id":4206,"name":"_stds","nodeType":"Attribute","startLoc":696,"text":"_stds"},{"col":4,"comment":"null","endLoc":3142,"header":"@property\n    def n_submodels(self)","id":4207,"name":"n_submodels","nodeType":"Function","startLoc":3138,"text":"@property\n    def n_submodels(self):\n        if self._leaflist is None:\n            self._make_leaflist()\n        return len(self._leaflist)"},{"attributeType":"null","col":12,"comment":"null","endLoc":1266,"id":4208,"name":"_tied","nodeType":"Attribute","startLoc":1266,"text":"self._tied"},{"col":4,"comment":" Return the names of submodels in a ``CompoundModel``.","endLoc":3158,"header":"@property\n    def submodel_names(self)","id":4209,"name":"submodel_names","nodeType":"Function","startLoc":3144,"text":"@property\n    def submodel_names(self):\n        \"\"\" Return the names of submodels in a ``CompoundModel``.\"\"\"\n        if self._leaflist is None:\n            self._make_leaflist()\n        names = [item.name for item in self._leaflist]\n        nonecount = 0\n        newnames = []\n        for item in names:\n            if item is None:\n                newnames.append(f'None_{nonecount}')\n                nonecount += 1\n            else:\n                newnames.append(item)\n        return tuple(newnames)"},{"className":"Trapezoid1DType","col":0,"comment":"null","endLoc":762,"id":4210,"nodeType":"Class","startLoc":733,"text":"class Trapezoid1DType(TransformType):\n    name = 'transform/trapezoid1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Trapezoid1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Trapezoid1D(amplitude=node['amplitude'],\n                                             x_0=node['x_0'],\n                                             width=node['width'],\n                                             slope=node['slope'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'width': _parameter_to_value(model.width),\n                'slope': _parameter_to_value(model.slope)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Trapezoid1D) and\n                isinstance(b, functional_models.Trapezoid1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.width, b.width)\n        assert_array_equal(a.slope, b.slope)"},{"attributeType":"null","col":8,"comment":"null","endLoc":706,"id":4211,"name":"_name","nodeType":"Attribute","startLoc":706,"text":"self._name"},{"col":4,"comment":"null","endLoc":743,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4212,"name":"from_tree_transform","nodeType":"Function","startLoc":738,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Trapezoid1D(amplitude=node['amplitude'],\n                                             x_0=node['x_0'],\n                                             width=node['width'],\n                                             slope=node['slope'])"},{"attributeType":"null","col":4,"comment":"null","endLoc":9,"id":4213,"name":"name","nodeType":"Attribute","startLoc":9,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":10,"id":4214,"name":"types","nodeType":"Attribute","startLoc":10,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":11,"id":4215,"name":"version","nodeType":"Attribute","startLoc":11,"text":"version"},{"attributeType":"null","col":12,"comment":"null","endLoc":828,"id":4216,"name":"_input_units_allow_dimensionless","nodeType":"Attribute","startLoc":828,"text":"self._input_units_allow_dimensionless"},{"attributeType":"null","col":12,"comment":"null","endLoc":824,"id":4217,"name":"_input_units_strict","nodeType":"Attribute","startLoc":824,"text":"self._input_units_strict"},{"attributeType":"null","col":12,"comment":"null","endLoc":1257,"id":4218,"name":"_bounds","nodeType":"Attribute","startLoc":1257,"text":"self._bounds"},{"col":4,"comment":"\n        if both members of this compound model have inverses return True\n        ","endLoc":3176,"header":"def both_inverses_exist(self)","id":4219,"name":"both_inverses_exist","nodeType":"Function","startLoc":3160,"text":"def both_inverses_exist(self):\n        '''\n        if both members of this compound model have inverses return True\n        '''\n        warnings.warn(\n            \"CompoundModel.both_inverses_exist is deprecated. \"\n            \"Use has_inverse instead.\",\n            AstropyDeprecationWarning\n        )\n\n        try:\n            linv = self.left.inverse\n            rinv = self.right.inverse\n        except NotImplementedError:\n            return False\n\n        return True"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":4220,"name":"name","nodeType":"Attribute","startLoc":16,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":4221,"name":"version","nodeType":"Attribute","startLoc":17,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":4222,"name":"types","nodeType":"Attribute","startLoc":18,"text":"types"},{"col":4,"comment":"\n        CompoundModel specific input setup that needs to occur prior to\n            model evaluation.\n\n        Note\n        ----\n            All of the _pre_evaluate for each component model will be\n            performed at the time that the individual model is evaluated.\n        ","endLoc":3202,"header":"def _pre_evaluate(self, *args, **kwargs)","id":4223,"name":"_pre_evaluate","nodeType":"Function","startLoc":3178,"text":"def _pre_evaluate(self, *args, **kwargs):\n        \"\"\"\n        CompoundModel specific input setup that needs to occur prior to\n            model evaluation.\n\n        Note\n        ----\n            All of the _pre_evaluate for each component model will be\n            performed at the time that the individual model is evaluated.\n        \"\"\"\n\n        # If equivalencies are provided, necessary to map parameters and pass\n        # the leaflist as a keyword input for use by model evaluation so that\n        # the compound model input names can be matched to the model input\n        # names.\n        if 'equivalencies' in kwargs:\n            # Restructure to be useful for the individual model lookup\n            kwargs['inputs_map'] = [(value[0], (value[1], key)) for\n                                    key, value in self.inputs_map().items()]\n\n        # Setup actual model evaluation method\n        def evaluate(_inputs):\n            return self._evaluate(*_inputs, **kwargs)\n\n        return evaluate, args, None, kwargs"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":4224,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"tabular.py#<anonymous>","id":4225,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['TabularType']"},{"attributeType":"null","col":8,"comment":"null","endLoc":1501,"id":4226,"name":"_cov_matrix","nodeType":"Attribute","startLoc":1501,"text":"self._cov_matrix"},{"col":4,"comment":"\n        Map the names of the inputs to this ExpressionTree to the inputs to the leaf models.\n        ","endLoc":3621,"header":"def inputs_map(self)","id":4227,"name":"inputs_map","nodeType":"Function","startLoc":3573,"text":"def inputs_map(self):\n        \"\"\"\n        Map the names of the inputs to this ExpressionTree to the inputs to the leaf models.\n        \"\"\"\n        inputs_map = {}\n        if not isinstance(self.op, str):  # If we don't have an operator the mapping is trivial\n            return {inp: (self, inp) for inp in self.inputs}\n\n        elif self.op == '|':\n            if isinstance(self.left, CompoundModel):\n                l_inputs_map = self.left.inputs_map()\n            for inp in self.inputs:\n                if isinstance(self.left, CompoundModel):\n                    inputs_map[inp] = l_inputs_map[inp]\n                else:\n                    inputs_map[inp] = self.left, inp\n        elif self.op == '&':\n            if isinstance(self.left, CompoundModel):\n                l_inputs_map = self.left.inputs_map()\n            if isinstance(self.right, CompoundModel):\n                r_inputs_map = self.right.inputs_map()\n            for i, inp in enumerate(self.inputs):\n                if i < len(self.left.inputs):  # Get from left\n                    if isinstance(self.left, CompoundModel):\n                        inputs_map[inp] = l_inputs_map[self.left.inputs[i]]\n                    else:\n                        inputs_map[inp] = self.left, self.left.inputs[i]\n                else:  # Get from right\n                    if isinstance(self.right, CompoundModel):\n                        inputs_map[inp] = r_inputs_map[self.right.inputs[i - len(self.left.inputs)]]\n                    else:\n                        inputs_map[inp] = self.right, self.right.inputs[i - len(self.left.inputs)]\n        elif self.op == 'fix_inputs':\n            fixed_ind = list(self.right.keys())\n            ind = [list(self.left.inputs).index(i) if isinstance(i, str) else i for i in fixed_ind]\n            inp_ind = list(range(self.left.n_inputs))\n            for i in ind:\n                inp_ind.remove(i)\n            for i in inp_ind:\n                inputs_map[self.left.inputs[i]] = self.left, self.left.inputs[i]\n        else:\n            if isinstance(self.left, CompoundModel):\n                l_inputs_map = self.left.inputs_map()\n            for inp in self.left.inputs:\n                if isinstance(self.left, CompoundModel):\n                    inputs_map[inp] = l_inputs_map[inp]\n                else:\n                    inputs_map[inp] = self.left, inp\n        return inputs_map"},{"fileName":"spectralcoord.py","filePath":"astropy/io/misc/asdf/tags/coordinates","id":4228,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nfrom asdf.tags.core import NDArrayType\n\nfrom astropy.coordinates.spectral_coordinate import SpectralCoord\nfrom astropy.io.misc.asdf.types import AstropyType\nfrom astropy.io.misc.asdf.tags.unit.unit import UnitType\n\n\n__all__ = ['SpectralCoordType']\n\n\nclass SpectralCoordType(AstropyType):\n    \"\"\"\n    ASDF tag implementation used to serialize/derialize SpectralCoord objects\n    \"\"\"\n    name = 'coordinates/spectralcoord'\n    types = [SpectralCoord]\n    version = '1.0.0'\n\n    @classmethod\n    def to_tree(cls, spec_coord, ctx):\n        node = {}\n        if isinstance(spec_coord, SpectralCoord):\n            node['value'] = spec_coord.value\n            node['unit'] = spec_coord.unit\n            if spec_coord.observer is not None:\n                node['observer'] = spec_coord.observer\n            if spec_coord.target is not None:\n                node['target'] = spec_coord.target\n            return node\n        raise TypeError(f\"'{spec_coord}' is not a valid SpectralCoord\")\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        if isinstance(node, SpectralCoord):\n            return node\n\n        unit = UnitType.from_tree(node['unit'], ctx)\n        value = node['value']\n        observer = node['observer'] if 'observer' in node else None\n        target = node['target'] if 'observer' in node else None\n        if isinstance(value, NDArrayType):\n            value = value._make_array()\n        return SpectralCoord(value, unit=unit, observer=observer, target=target)\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":1469,"id":4229,"name":"_user_bounding_box","nodeType":"Attribute","startLoc":1469,"text":"self._user_bounding_box"},{"className":"SpectralCoord","col":0,"comment":"\n    A spectral coordinate with its corresponding unit.\n\n    .. note:: The |SpectralCoord| class is new in Astropy v4.1 and should be\n              considered experimental at this time. Note that we do not fully\n              support cases where the observer and target are moving\n              relativistically relative to each other, so care should be taken\n              in those cases. It is possible that there will be API changes in\n              future versions of Astropy based on user feedback. If you have\n              specific ideas for how it might be improved, please  let us know\n              on the `astropy-dev mailing list`_ or at\n              http://feedback.astropy.org.\n\n    Parameters\n    ----------\n    value : ndarray or `~astropy.units.Quantity` or `SpectralCoord`\n        Spectral values, which should be either wavelength, frequency,\n        energy, wavenumber, or velocity values.\n    unit : unit-like\n        Unit for the given spectral values.\n    observer : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`, optional\n        The coordinate (position and velocity) of observer. If no velocities\n        are present on this object, the observer is assumed to be stationary\n        relative to the frame origin.\n    target : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`, optional\n        The coordinate (position and velocity) of target. If no velocities\n        are present on this object, the target is assumed to be stationary\n        relative to the frame origin.\n    radial_velocity : `~astropy.units.Quantity` ['speed'], optional\n        The radial velocity of the target with respect to the observer. This\n        can only be specified if ``redshift`` is not specified.\n    redshift : float, optional\n        The relativistic redshift of the target with respect to the observer.\n        This can only be specified if ``radial_velocity`` cannot be specified.\n    doppler_rest : `~astropy.units.Quantity`, optional\n        The rest value to use when expressing the spectral value as a velocity.\n    doppler_convention : str, optional\n        The Doppler convention to use when expressing the spectral value as a velocity.\n    ","endLoc":754,"id":4230,"nodeType":"Class","startLoc":129,"text":"class SpectralCoord(SpectralQuantity):\n    \"\"\"\n    A spectral coordinate with its corresponding unit.\n\n    .. note:: The |SpectralCoord| class is new in Astropy v4.1 and should be\n              considered experimental at this time. Note that we do not fully\n              support cases where the observer and target are moving\n              relativistically relative to each other, so care should be taken\n              in those cases. It is possible that there will be API changes in\n              future versions of Astropy based on user feedback. If you have\n              specific ideas for how it might be improved, please  let us know\n              on the `astropy-dev mailing list`_ or at\n              http://feedback.astropy.org.\n\n    Parameters\n    ----------\n    value : ndarray or `~astropy.units.Quantity` or `SpectralCoord`\n        Spectral values, which should be either wavelength, frequency,\n        energy, wavenumber, or velocity values.\n    unit : unit-like\n        Unit for the given spectral values.\n    observer : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`, optional\n        The coordinate (position and velocity) of observer. If no velocities\n        are present on this object, the observer is assumed to be stationary\n        relative to the frame origin.\n    target : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`, optional\n        The coordinate (position and velocity) of target. If no velocities\n        are present on this object, the target is assumed to be stationary\n        relative to the frame origin.\n    radial_velocity : `~astropy.units.Quantity` ['speed'], optional\n        The radial velocity of the target with respect to the observer. This\n        can only be specified if ``redshift`` is not specified.\n    redshift : float, optional\n        The relativistic redshift of the target with respect to the observer.\n        This can only be specified if ``radial_velocity`` cannot be specified.\n    doppler_rest : `~astropy.units.Quantity`, optional\n        The rest value to use when expressing the spectral value as a velocity.\n    doppler_convention : str, optional\n        The Doppler convention to use when expressing the spectral value as a velocity.\n    \"\"\"\n\n    @u.quantity_input(radial_velocity=u.km/u.s)\n    def __new__(cls, value, unit=None,\n                observer=None, target=None,\n                radial_velocity=None, redshift=None,\n                **kwargs):\n\n        obj = super().__new__(cls, value, unit=unit, **kwargs)\n\n        # There are two main modes of operation in this class. Either the\n        # observer and target are both defined, in which case the radial\n        # velocity and redshift are automatically computed from these, or\n        # only one of the observer and target are specified, along with a\n        # manually specified radial velocity or redshift. So if a target and\n        # observer are both specified, we can't also accept a radial velocity\n        # or redshift.\n        if target is not None and observer is not None:\n            if radial_velocity is not None or redshift is not None:\n                raise ValueError(\"Cannot specify radial velocity or redshift if both \"\n                                 \"target and observer are specified\")\n\n        # We only deal with redshifts here and in the redshift property.\n        # Otherwise internally we always deal with velocities.\n        if redshift is not None:\n            if radial_velocity is not None:\n                raise ValueError(\"Cannot set both a radial velocity and redshift\")\n            redshift = u.Quantity(redshift)\n            # For now, we can't specify redshift=u.one in quantity_input above\n            # and have it work with plain floats, but if that is fixed, for\n            # example as in https://github.com/astropy/astropy/pull/10232, we\n            # can remove the check here and add redshift=u.one to the decorator\n            if not redshift.unit.is_equivalent(u.one):\n                raise u.UnitsError('redshift should be dimensionless')\n            radial_velocity = redshift.to(u.km / u.s, u.doppler_redshift())\n\n        # If we're initializing from an existing SpectralCoord, keep any\n        # parameters that aren't being overridden\n        if observer is None:\n            observer = getattr(value, 'observer', None)\n        if target is None:\n            target = getattr(value, 'target', None)\n\n        # As mentioned above, we should only specify the radial velocity\n        # manually if either or both the observer and target are not\n        # specified.\n        if observer is None or target is None:\n            if radial_velocity is None:\n                radial_velocity = getattr(value, 'radial_velocity', None)\n\n        obj._radial_velocity = radial_velocity\n        obj._observer = cls._validate_coordinate(observer, label='observer')\n        obj._target = cls._validate_coordinate(target, label='target')\n\n        return obj\n\n    def __array_finalize__(self, obj):\n        super().__array_finalize__(obj)\n        self._radial_velocity = getattr(obj, '_radial_velocity', None)\n        self._observer = getattr(obj, '_observer', None)\n        self._target = getattr(obj, '_target', None)\n\n    @staticmethod\n    def _validate_coordinate(coord, label=''):\n        \"\"\"\n        Checks the type of the frame and whether a velocity differential and a\n        distance has been defined on the frame object.\n\n        If no distance is defined, the target is assumed to be \"really far\n        away\", and the observer is assumed to be \"in the solar system\".\n\n        Parameters\n        ----------\n        coord : `~astropy.coordinates.BaseCoordinateFrame`\n            The new frame to be used for target or observer.\n        label : str, optional\n            The name of the object being validated (e.g. 'target' or 'observer'),\n            which is then used in error messages.\n        \"\"\"\n\n        if coord is None:\n            return\n\n        if not issubclass(coord.__class__, BaseCoordinateFrame):\n            if isinstance(coord, SkyCoord):\n                coord = coord.frame\n            else:\n                raise TypeError(f\"{label} must be a SkyCoord or coordinate frame instance\")\n\n        # If the distance is not well-defined, ensure that it works properly\n        # for generating differentials\n        # TODO: change this to not set the distance and yield a warning once\n        # there's a good way to address this in astropy.coordinates\n        # https://github.com/astropy/astropy/issues/10247\n        with np.errstate(all='ignore'):\n            distance = getattr(coord, 'distance', None)\n        if distance is not None and distance.unit.physical_type == 'dimensionless':\n            coord = SkyCoord(coord, distance=DEFAULT_DISTANCE)\n            warnings.warn(\n                \"Distance on coordinate object is dimensionless, an \"\n                f\"arbitrary distance value of {DEFAULT_DISTANCE} will be set instead.\",\n                NoDistanceWarning)\n\n        # If the observer frame does not contain information about the\n        # velocity of the system, assume that the velocity is zero in the\n        # system.\n        if 's' not in coord.data.differentials:\n            warnings.warn(\n                f\"No velocity defined on frame, assuming {ZERO_VELOCITIES}.\",\n                NoVelocityWarning)\n\n            coord = attach_zero_velocities(coord)\n\n        return coord\n\n    def replicate(self, value=None, unit=None,\n                  observer=None, target=None,\n                  radial_velocity=None, redshift=None,\n                  doppler_convention=None, doppler_rest=None,\n                  copy=False):\n        \"\"\"\n        Return a replica of the `SpectralCoord`, optionally changing the\n        values or attributes.\n\n        Note that no conversion is carried out by this method - this keeps\n        all the values and attributes the same, except for the ones explicitly\n        passed to this method which are changed.\n\n        If ``copy`` is set to `True` then a full copy of the internal arrays\n        will be made.  By default the replica will use a reference to the\n        original arrays when possible to save memory.\n\n        Parameters\n        ----------\n        value : ndarray or `~astropy.units.Quantity` or `SpectralCoord`, optional\n            Spectral values, which should be either wavelength, frequency,\n            energy, wavenumber, or velocity values.\n        unit : unit-like\n            Unit for the given spectral values.\n        observer : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`, optional\n            The coordinate (position and velocity) of observer.\n        target : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`, optional\n            The coordinate (position and velocity) of target.\n        radial_velocity : `~astropy.units.Quantity` ['speed'], optional\n            The radial velocity of the target with respect to the observer.\n        redshift : float, optional\n            The relativistic redshift of the target with respect to the observer.\n        doppler_rest : `~astropy.units.Quantity`, optional\n            The rest value to use when expressing the spectral value as a velocity.\n        doppler_convention : str, optional\n            The Doppler convention to use when expressing the spectral value as a velocity.\n        copy : bool, optional\n            If `True`, and ``value`` is not specified, the values are copied to\n            the new `SkyCoord` - otherwise a reference to the same values is used.\n\n        Returns\n        -------\n        sc : `SpectralCoord` object\n            Replica of this object\n        \"\"\"\n\n        if isinstance(value, u.Quantity):\n            if unit is not None:\n                raise ValueError(\"Cannot specify value as a Quantity and also specify unit\")\n            else:\n                value, unit = value.value, value.unit\n\n        value = value if value is not None else self.value\n        unit = unit or self.unit\n        observer = self._validate_coordinate(observer) or self.observer\n        target = self._validate_coordinate(target) or self.target\n        doppler_convention = doppler_convention or self.doppler_convention\n        doppler_rest = doppler_rest or self.doppler_rest\n\n        # If value is being taken from self and copy is Tru\n        if copy:\n            value = value.copy()\n\n        # Only include radial_velocity if it is not auto-computed from the\n        # observer and target.\n        if (self.observer is None or self.target is None) and radial_velocity is None and redshift is None:\n            radial_velocity = self.radial_velocity\n\n        with warnings.catch_warnings():\n            warnings.simplefilter('ignore', NoVelocityWarning)\n            return self.__class__(value=value, unit=unit,\n                                  observer=observer, target=target,\n                                  radial_velocity=radial_velocity, redshift=redshift,\n                                  doppler_convention=doppler_convention, doppler_rest=doppler_rest, copy=False)\n\n    @property\n    def quantity(self):\n        \"\"\"\n        Convert the ``SpectralCoord`` to a `~astropy.units.Quantity`.\n        Equivalent to ``self.view(u.Quantity)``.\n\n        Returns\n        -------\n        `~astropy.units.Quantity`\n            This object viewed as a `~astropy.units.Quantity`.\n\n        \"\"\"\n        return self.view(u.Quantity)\n\n    @property\n    def observer(self):\n        \"\"\"\n        The coordinates of the observer.\n\n        If set, and a target is set as well, this will override any explicit\n        radial velocity passed in.\n\n        Returns\n        -------\n        `~astropy.coordinates.BaseCoordinateFrame`\n            The astropy coordinate frame representing the observation.\n        \"\"\"\n        return self._observer\n\n    @observer.setter\n    def observer(self, value):\n\n        if self.observer is not None:\n            raise ValueError(\"observer has already been set\")\n\n        self._observer = self._validate_coordinate(value, label='observer')\n\n        # Switch to auto-computing radial velocity\n        if self._target is not None:\n            self._radial_velocity = None\n\n    @property\n    def target(self):\n        \"\"\"\n        The coordinates of the target being observed.\n\n        If set, and an observer is set as well, this will override any explicit\n        radial velocity passed in.\n\n        Returns\n        -------\n        `~astropy.coordinates.BaseCoordinateFrame`\n            The astropy coordinate frame representing the target.\n        \"\"\"\n        return self._target\n\n    @target.setter\n    def target(self, value):\n\n        if self.target is not None:\n            raise ValueError(\"target has already been set\")\n\n        self._target = self._validate_coordinate(value, label='target')\n\n        # Switch to auto-computing radial velocity\n        if self._observer is not None:\n            self._radial_velocity = None\n\n    @property\n    def radial_velocity(self):\n        \"\"\"\n        Radial velocity of target relative to the observer.\n\n        Returns\n        -------\n        `~astropy.units.Quantity` ['speed']\n            Radial velocity of target.\n\n        Notes\n        -----\n        This is different from the ``.radial_velocity`` property of a\n        coordinate frame in that this calculates the radial velocity with\n        respect to the *observer*, not the origin of the frame.\n        \"\"\"\n        if self._observer is None or self._target is None:\n            if self._radial_velocity is None:\n                return 0 * KMS\n            else:\n                return self._radial_velocity\n        else:\n            return self._calculate_radial_velocity(self._observer, self._target,\n                                                   as_scalar=True)\n\n    @property\n    def redshift(self):\n        \"\"\"\n        Redshift of target relative to observer. Calculated from the radial\n        velocity.\n\n        Returns\n        -------\n        `astropy.units.Quantity`\n            Redshift of target.\n        \"\"\"\n        return self.radial_velocity.to(u.dimensionless_unscaled, u.doppler_redshift())\n\n    @staticmethod\n    def _calculate_radial_velocity(observer, target, as_scalar=False):\n        \"\"\"\n        Compute the line-of-sight velocity from the observer to the target.\n\n        Parameters\n        ----------\n        observer : `~astropy.coordinates.BaseCoordinateFrame`\n            The frame of the observer.\n        target : `~astropy.coordinates.BaseCoordinateFrame`\n            The frame of the target.\n        as_scalar : bool\n            If `True`, the magnitude of the velocity vector will be returned,\n            otherwise the full vector will be returned.\n\n        Returns\n        -------\n        `~astropy.units.Quantity` ['speed']\n            The radial velocity of the target with respect to the observer.\n        \"\"\"\n\n        # Convert observer and target to ICRS to avoid finite differencing\n        # calculations that lack numerical precision.\n        observer_icrs = observer.transform_to(ICRS())\n        target_icrs = target.transform_to(ICRS())\n\n        pos_hat = SpectralCoord._normalized_position_vector(observer_icrs, target_icrs)\n\n        d_vel = target_icrs.velocity - observer_icrs.velocity\n\n        vel_mag = pos_hat.dot(d_vel)\n\n        if as_scalar:\n            return vel_mag\n        else:\n            return vel_mag * pos_hat\n\n    @staticmethod\n    def _normalized_position_vector(observer, target):\n        \"\"\"\n        Calculate the normalized position vector between two frames.\n\n        Parameters\n        ----------\n        observer : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n            The observation frame or coordinate.\n        target : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n            The target frame or coordinate.\n\n        Returns\n        -------\n        pos_hat : `BaseRepresentation`\n            Position representation.\n        \"\"\"\n        d_pos = (target.cartesian.without_differentials() -\n                 observer.cartesian.without_differentials())\n\n        dp_norm = d_pos.norm()\n\n        # Reset any that are 0 to 1 to avoid nans from 0/0\n        dp_norm[dp_norm == 0] = 1 * dp_norm.unit\n\n        pos_hat = d_pos / dp_norm\n\n        return pos_hat\n\n    @u.quantity_input(velocity=u.km/u.s)\n    def with_observer_stationary_relative_to(self, frame, velocity=None, preserve_observer_frame=False):\n        \"\"\"\n        A new  `SpectralCoord` with the velocity of the observer altered,\n        but not the position.\n\n        If a coordinate frame is specified, the observer velocities will be\n        modified to be stationary in the specified frame. If a coordinate\n        instance is specified, optionally with non-zero velocities, the\n        observer velocities will be updated so that the observer is co-moving\n        with the specified coordinates.\n\n        Parameters\n        ----------\n        frame : str, `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n            The observation frame in which the observer will be stationary. This\n            can be the name of a frame (e.g. 'icrs'), a frame class, frame instance\n            with no data, or instance with data. This can optionally include\n            velocities.\n        velocity : `~astropy.units.Quantity` or `~astropy.coordinates.CartesianDifferential`, optional\n            If ``frame`` does not contain velocities, these can be specified as\n            a 3-element `~astropy.units.Quantity`. In the case where this is\n            also not specified, the velocities default to zero.\n        preserve_observer_frame : bool\n            If `True`, the final observer frame class will be the same as the\n            original one, and if `False` it will be the frame of the velocity\n            reference class.\n\n        Returns\n        -------\n        new_coord : `SpectralCoord`\n            The new coordinate object representing the spectral data\n            transformed based on the observer's new velocity frame.\n        \"\"\"\n\n        if self.observer is None or self.target is None:\n            raise ValueError(\"This method can only be used if both observer \"\n                             \"and target are defined on the SpectralCoord.\")\n\n        # Start off by extracting frame if a SkyCoord was passed in\n        if isinstance(frame, SkyCoord):\n            frame = frame.frame\n\n        if isinstance(frame, BaseCoordinateFrame):\n\n            if not frame.has_data:\n                frame = frame.realize_frame(CartesianRepresentation(0 * u.km, 0 * u.km, 0 * u.km))\n\n            if frame.data.differentials:\n                if velocity is not None:\n                    raise ValueError('frame already has differentials, cannot also specify velocity')\n                # otherwise frame is ready to go\n            else:\n                if velocity is None:\n                    differentials = ZERO_VELOCITIES\n                else:\n                    differentials = CartesianDifferential(velocity)\n                frame = frame.realize_frame(frame.data.with_differentials(differentials))\n\n        if isinstance(frame, (type, str)):\n            if isinstance(frame, type):\n                frame_cls = frame\n            elif isinstance(frame, str):\n                frame_cls = frame_transform_graph.lookup_name(frame)\n            if velocity is None:\n                velocity = 0 * u.m / u.s, 0 * u.m / u.s, 0 * u.m / u.s\n            elif velocity.shape != (3,):\n                raise ValueError('velocity should be a Quantity vector with 3 elements')\n            frame = frame_cls(0 * u.m, 0 * u.m, 0 * u.m,\n                              *velocity,\n                              representation_type='cartesian',\n                              differential_type='cartesian')\n\n        observer = update_differentials_to_match(self.observer, frame,\n                                                 preserve_observer_frame=preserve_observer_frame)\n\n        # Calculate the initial and final los velocity\n        init_obs_vel = self._calculate_radial_velocity(self.observer, self.target, as_scalar=True)\n        fin_obs_vel = self._calculate_radial_velocity(observer, self.target, as_scalar=True)\n\n        # Apply transformation to data\n        new_data = _apply_relativistic_doppler_shift(self, fin_obs_vel - init_obs_vel)\n\n        new_coord = self.replicate(value=new_data, observer=observer)\n\n        return new_coord\n\n    def with_radial_velocity_shift(self, target_shift=None, observer_shift=None):\n        \"\"\"\n        Apply a velocity shift to this spectral coordinate.\n\n        The shift can be provided as a redshift (float value) or radial\n        velocity (`~astropy.units.Quantity` with physical type of 'speed').\n\n        Parameters\n        ----------\n        target_shift : float or `~astropy.units.Quantity` ['speed']\n            Shift value to apply to current target.\n        observer_shift : float or `~astropy.units.Quantity` ['speed']\n            Shift value to apply to current observer.\n\n        Returns\n        -------\n        `SpectralCoord`\n            New spectral coordinate with the target/observer velocity changed\n            to incorporate the shift. This is always a new object even if\n            ``target_shift`` and ``observer_shift`` are both `None`.\n        \"\"\"\n\n        if observer_shift is not None and (self.target is None or\n                                           self.observer is None):\n            raise ValueError(\"Both an observer and target must be defined \"\n                             \"before applying a velocity shift.\")\n\n        for arg in [x for x in [target_shift, observer_shift] if x is not None]:\n            if isinstance(arg, u.Quantity) and not arg.unit.is_equivalent((u.one, KMS)):\n                raise u.UnitsError(\"Argument must have unit physical type \"\n                                   \"'speed' for radial velocty or \"\n                                   \"'dimensionless' for redshift.\")\n\n        # The target or observer value is defined but is not a quantity object,\n        #  assume it's a redshift float value and convert to velocity\n\n        if target_shift is None:\n            if self._observer is None or self._target is None:\n                return self.replicate()\n            target_shift = 0 * KMS\n        else:\n            target_shift = u.Quantity(target_shift)\n            if target_shift.unit.physical_type == 'dimensionless':\n                target_shift = target_shift.to(u.km / u.s, u.doppler_redshift())\n            if self._observer is None or self._target is None:\n                return self.replicate(value=_apply_relativistic_doppler_shift(self, target_shift),\n                                      radial_velocity=self.radial_velocity + target_shift)\n\n        if observer_shift is None:\n            observer_shift = 0 * KMS\n        else:\n            observer_shift = u.Quantity(observer_shift)\n            if observer_shift.unit.physical_type == 'dimensionless':\n                observer_shift = observer_shift.to(u.km / u.s, u.doppler_redshift())\n\n        target_icrs = self._target.transform_to(ICRS())\n        observer_icrs = self._observer.transform_to(ICRS())\n\n        pos_hat = SpectralCoord._normalized_position_vector(observer_icrs, target_icrs)\n\n        target_velocity = _get_velocities(target_icrs) + target_shift * pos_hat\n        observer_velocity = _get_velocities(observer_icrs) + observer_shift * pos_hat\n\n        target_velocity = CartesianDifferential(target_velocity.xyz)\n        observer_velocity = CartesianDifferential(observer_velocity.xyz)\n\n        new_target = (target_icrs\n                      .realize_frame(target_icrs.cartesian.with_differentials(target_velocity))\n                      .transform_to(self._target))\n\n        new_observer = (observer_icrs\n                        .realize_frame(observer_icrs.cartesian.with_differentials(observer_velocity))\n                        .transform_to(self._observer))\n\n        init_obs_vel = self._calculate_radial_velocity(observer_icrs, target_icrs, as_scalar=True)\n        fin_obs_vel = self._calculate_radial_velocity(new_observer, new_target, as_scalar=True)\n\n        new_data = _apply_relativistic_doppler_shift(self, fin_obs_vel - init_obs_vel)\n\n        return self.replicate(value=new_data,\n                              observer=new_observer,\n                              target=new_target)\n\n    def to_rest(self):\n        \"\"\"\n        Transforms the spectral axis to the rest frame.\n        \"\"\"\n\n        if self.observer is not None and self.target is not None:\n            return self.with_observer_stationary_relative_to(self.target)\n\n        result = _apply_relativistic_doppler_shift(self, -self.radial_velocity)\n\n        return self.replicate(value=result, radial_velocity=0. * KMS, redshift=None)\n\n    def __repr__(self):\n\n        prefixstr = '<' + self.__class__.__name__ + ' '\n\n        try:\n            radial_velocity = self.radial_velocity\n            redshift = self.redshift\n        except ValueError:\n            radial_velocity = redshift = 'Undefined'\n\n        repr_items = [f'{prefixstr}']\n\n        if self.observer is not None:\n            observer_repr = indent(repr(self.observer), 14 * ' ').lstrip()\n            repr_items.append(f'    observer: {observer_repr}')\n\n        if self.target is not None:\n            target_repr = indent(repr(self.target), 12 * ' ').lstrip()\n            repr_items.append(f'    target: {target_repr}')\n\n        if (self._observer is not None and self._target is not None) or self._radial_velocity is not None:\n            if self.observer is not None and self.target is not None:\n                repr_items.append('    observer to target (computed from above):')\n            else:\n                repr_items.append('    observer to target:')\n            repr_items.append(f'      radial_velocity={radial_velocity}')\n            repr_items.append(f'      redshift={redshift}')\n\n        if self.doppler_rest is not None or self.doppler_convention is not None:\n            repr_items.append(f'    doppler_rest={self.doppler_rest}')\n            repr_items.append(f'    doppler_convention={self.doppler_convention}')\n\n        arrstr = np.array2string(self.view(np.ndarray), separator=', ',\n                                 prefix='  ')\n\n        if len(repr_items) == 1:\n            repr_items[0] += f'{arrstr}{self._unitstr:s}'\n        else:\n            repr_items[1] = '   (' + repr_items[1].lstrip()\n            repr_items[-1] += ')'\n            repr_items.append(f'  {arrstr}{self._unitstr:s}')\n\n        return '\\n'.join(repr_items) + '>'"},{"attributeType":"null","col":8,"comment":"null","endLoc":2426,"id":4231,"name":"_model_set_axis","nodeType":"Attribute","startLoc":2426,"text":"self._model_set_axis"},{"col":4,"comment":"\n        Insert coordinate values before the given indices in the object and\n        return a new Frame object.\n\n        The values to be inserted must conform to the rules for in-place setting\n        of ``SkyCoord`` objects.\n\n        The API signature matches the ``np.insert`` API, but is more limited.\n        The specification of insert index ``obj`` must be a single integer,\n        and the ``axis`` must be ``0`` for simple insertion before the index.\n\n        Parameters\n        ----------\n        obj : int\n            Integer index before which ``values`` is inserted.\n        values : array-like\n            Value(s) to insert.  If the type of ``values`` is different\n            from that of quantity, ``values`` is converted to the matching type.\n        axis : int, optional\n            Axis along which to insert ``values``.  Default is 0, which is the\n            only allowed value and will insert a row.\n\n        Returns\n        -------\n        out : `~astropy.coordinates.SkyCoord` instance\n            New coordinate object with inserted value(s)\n\n        ","endLoc":552,"header":"def insert(self, obj, values, axis=0)","id":4232,"name":"insert","nodeType":"Function","startLoc":489,"text":"def insert(self, obj, values, axis=0):\n        \"\"\"\n        Insert coordinate values before the given indices in the object and\n        return a new Frame object.\n\n        The values to be inserted must conform to the rules for in-place setting\n        of ``SkyCoord`` objects.\n\n        The API signature matches the ``np.insert`` API, but is more limited.\n        The specification of insert index ``obj`` must be a single integer,\n        and the ``axis`` must be ``0`` for simple insertion before the index.\n\n        Parameters\n        ----------\n        obj : int\n            Integer index before which ``values`` is inserted.\n        values : array-like\n            Value(s) to insert.  If the type of ``values`` is different\n            from that of quantity, ``values`` is converted to the matching type.\n        axis : int, optional\n            Axis along which to insert ``values``.  Default is 0, which is the\n            only allowed value and will insert a row.\n\n        Returns\n        -------\n        out : `~astropy.coordinates.SkyCoord` instance\n            New coordinate object with inserted value(s)\n\n        \"\"\"\n        # Validate inputs: obj arg is integer, axis=0, self is not a scalar, and\n        # input index is in bounds.\n        try:\n            idx0 = operator.index(obj)\n        except TypeError:\n            raise TypeError('obj arg must be an integer')\n\n        if axis != 0:\n            raise ValueError('axis must be 0')\n\n        if not self.shape:\n            raise TypeError('cannot insert into scalar {} object'\n                            .format(self.__class__.__name__))\n\n        if abs(idx0) > len(self):\n            raise IndexError('index {} is out of bounds for axis 0 with size {}'\n                             .format(idx0, len(self)))\n\n        # Turn negative index into positive\n        if idx0 < 0:\n            idx0 = len(self) + idx0\n\n        n_values = len(values) if values.shape else 1\n\n        # Finally make the new object with the correct length and set values for the\n        # three sections, before insert, the insert, and after the insert.\n        out = self.__class__.info.new_like([self], len(self) + n_values, name=self.info.name)\n\n        # Set the output values. This is where validation of `values` takes place to ensure\n        # that it can indeed be inserted.\n        out[:idx0] = self[:idx0]\n        out[idx0:idx0 + n_values] = values\n        out[idx0 + n_values:] = self[idx0:]\n\n        return out"},{"className":"SpectralQuantity","col":0,"comment":"\n    One or more value(s) with spectral units.\n\n    The spectral units should be those for frequencies, wavelengths, energies,\n    wavenumbers, or velocities (interpreted as Doppler velocities relative to a\n    rest spectral value). The advantage of using this class over the regular\n    `~astropy.units.Quantity` class is that in `SpectralQuantity`, the\n    ``u.spectral`` equivalency is enabled by default (allowing automatic\n    conversion between spectral units), and a preferred Doppler rest value and\n    convention can be stored for easy conversion to/from velocities.\n\n    Parameters\n    ----------\n    value : ndarray or `~astropy.units.Quantity` or `SpectralQuantity`\n        Spectral axis data values.\n    unit : unit-like\n        Unit for the given data.\n    doppler_rest : `~astropy.units.Quantity` ['speed'], optional\n        The rest value to use for conversions from/to velocities\n    doppler_convention : str, optional\n        The convention to use when converting the spectral data to/from\n        velocities.\n    ","endLoc":304,"id":4233,"nodeType":"Class","startLoc":24,"text":"class SpectralQuantity(SpecificTypeQuantity):\n    \"\"\"\n    One or more value(s) with spectral units.\n\n    The spectral units should be those for frequencies, wavelengths, energies,\n    wavenumbers, or velocities (interpreted as Doppler velocities relative to a\n    rest spectral value). The advantage of using this class over the regular\n    `~astropy.units.Quantity` class is that in `SpectralQuantity`, the\n    ``u.spectral`` equivalency is enabled by default (allowing automatic\n    conversion between spectral units), and a preferred Doppler rest value and\n    convention can be stored for easy conversion to/from velocities.\n\n    Parameters\n    ----------\n    value : ndarray or `~astropy.units.Quantity` or `SpectralQuantity`\n        Spectral axis data values.\n    unit : unit-like\n        Unit for the given data.\n    doppler_rest : `~astropy.units.Quantity` ['speed'], optional\n        The rest value to use for conversions from/to velocities\n    doppler_convention : str, optional\n        The convention to use when converting the spectral data to/from\n        velocities.\n    \"\"\"\n\n    _equivalent_unit = SPECTRAL_UNITS\n\n    _include_easy_conversion_members = True\n\n    def __new__(cls, value, unit=None,\n                doppler_rest=None, doppler_convention=None,\n                **kwargs):\n\n        obj = super().__new__(cls, value, unit=unit, **kwargs)\n\n        # If we're initializing from an existing SpectralQuantity, keep any\n        # parameters that aren't being overridden\n        if doppler_rest is None:\n            doppler_rest = getattr(value, 'doppler_rest', None)\n        if doppler_convention is None:\n            doppler_convention = getattr(value, 'doppler_convention', None)\n\n        obj._doppler_rest = doppler_rest\n        obj._doppler_convention = doppler_convention\n\n        return obj\n\n    def __array_finalize__(self, obj):\n        super().__array_finalize__(obj)\n        self._doppler_rest = getattr(obj, '_doppler_rest', None)\n        self._doppler_convention = getattr(obj, '_doppler_convention', None)\n\n    def __quantity_subclass__(self, unit):\n        # Always default to just returning a Quantity, unless we explicitly\n        # choose to return a SpectralQuantity - even if the units match, we\n        # want to avoid doing things like adding two SpectralQuantity instances\n        # together and getting a SpectralQuantity back\n        if unit is self.unit:\n            return SpectralQuantity, True\n        else:\n            return Quantity, False\n\n    def __array_ufunc__(self, function, method, *inputs, **kwargs):\n        # We always return Quantity except in a few specific cases\n        result = super().__array_ufunc__(function, method, *inputs, **kwargs)\n        if ((function is np.multiply\n            or function is np.true_divide and inputs[0] is self)\n            and result.unit == self.unit\n            or (function in (np.minimum, np.maximum, np.fmax, np.fmin)\n                and method in ('reduce', 'reduceat'))):\n            result = result.view(self.__class__)\n            result.__array_finalize__(self)\n        else:\n            if result is self:\n                raise TypeError(f\"Cannot store the result of this operation in {self.__class__.__name__}\")\n            if result.dtype.kind == 'b':\n                result = result.view(np.ndarray)\n            else:\n                result = result.view(Quantity)\n        return result\n\n    @property\n    def doppler_rest(self):\n        \"\"\"\n        The rest value of the spectrum used for transformations to/from\n        velocity space.\n\n        Returns\n        -------\n        `~astropy.units.Quantity` ['speed']\n            Rest value as an astropy `~astropy.units.Quantity` object.\n        \"\"\"\n        return self._doppler_rest\n\n    @doppler_rest.setter\n    @quantity_input(value=SPECTRAL_UNITS)\n    def doppler_rest(self, value):\n        \"\"\"\n        New rest value needed for velocity-space conversions.\n\n        Parameters\n        ----------\n        value : `~astropy.units.Quantity` ['speed']\n            Rest value.\n        \"\"\"\n        if self._doppler_rest is not None:\n            raise AttributeError(\"doppler_rest has already been set, and cannot \"\n                                 \"be changed. Use the ``to`` method to convert \"\n                                 \"the spectral values(s) to use a different \"\n                                 \"rest value\")\n        self._doppler_rest = value\n\n    @property\n    def doppler_convention(self):\n        \"\"\"\n        The defined convention for conversions to/from velocity space.\n\n        Returns\n        -------\n        str\n            One of 'optical', 'radio', or 'relativistic' representing the\n            equivalency used in the unit conversions.\n        \"\"\"\n        return self._doppler_convention\n\n    @doppler_convention.setter\n    def doppler_convention(self, value):\n        \"\"\"\n        New velocity convention used for velocity space conversions.\n\n        Parameters\n        ----------\n        value\n\n        Notes\n        -----\n        More information on the equations dictating the transformations can be\n        found in the astropy documentation [1]_.\n\n        References\n        ----------\n        .. [1] Astropy documentation: https://docs.astropy.org/en/stable/units/equivalencies.html#spectral-doppler-equivalencies\n\n        \"\"\"\n\n        if self._doppler_convention is not None:\n            raise AttributeError(\"doppler_convention has already been set, and cannot \"\n                                 \"be changed. Use the ``to`` method to convert \"\n                                 \"the spectral values(s) to use a different \"\n                                 \"convention\")\n\n        if value is not None and value not in DOPPLER_CONVENTIONS:\n            raise ValueError(f\"doppler_convention should be one of {'/'.join(sorted(DOPPLER_CONVENTIONS))}\")\n\n        self._doppler_convention = value\n\n    @quantity_input(doppler_rest=SPECTRAL_UNITS)\n    def to(self, unit,\n           equivalencies=[],\n           doppler_rest=None,\n           doppler_convention=None):\n        \"\"\"\n        Return a new `~astropy.coordinates.SpectralQuantity` object with the specified unit.\n\n        By default, the ``spectral`` equivalency will be enabled, as well as\n        one of the Doppler equivalencies if converting to/from velocities.\n\n        Parameters\n        ----------\n        unit : unit-like\n            An object that represents the unit to convert to. Must be\n            an `~astropy.units.UnitBase` object or a string parseable\n            by the `~astropy.units` package, and should be a spectral unit.\n        equivalencies : list of `~astropy.units.equivalencies.Equivalency`, optional\n            A list of equivalence pairs to try if the units are not\n            directly convertible (along with spectral).\n            See :ref:`astropy:unit_equivalencies`.\n            If not provided or ``[]``, spectral equivalencies will be used.\n            If `None`, no equivalencies will be applied at all, not even any\n            set globally or within a context.\n        doppler_rest : `~astropy.units.Quantity` ['speed'], optional\n            The rest value used when converting to/from velocities. This will\n            also be set at an attribute on the output\n            `~astropy.coordinates.SpectralQuantity`.\n        doppler_convention : {'relativistic', 'optical', 'radio'}, optional\n            The Doppler convention used when converting to/from velocities.\n            This will also be set at an attribute on the output\n            `~astropy.coordinates.SpectralQuantity`.\n\n        Returns\n        -------\n        `SpectralQuantity`\n            New spectral coordinate object with data converted to the new unit.\n        \"\"\"\n\n        # Make sure units can be passed as strings\n        unit = Unit(unit)\n\n        # If equivalencies is explicitly set to None, we should just use the\n        # default Quantity.to with equivalencies also set to None\n        if equivalencies is None:\n            result = super().to(unit, equivalencies=None)\n            result = result.view(self.__class__)\n            result.__array_finalize__(self)\n            return result\n\n        # FIXME: need to consider case where doppler equivalency is passed in\n        # equivalencies list, or is u.spectral equivalency is already passed\n\n        if doppler_rest is None:\n            doppler_rest = self._doppler_rest\n\n        if doppler_convention is None:\n            doppler_convention = self._doppler_convention\n        elif doppler_convention not in DOPPLER_CONVENTIONS:\n            raise ValueError(f\"doppler_convention should be one of {'/'.join(sorted(DOPPLER_CONVENTIONS))}\")\n\n        if self.unit.is_equivalent(KMS) and unit.is_equivalent(KMS):\n\n            # Special case: if the current and final units are both velocity,\n            # and either the rest value or the convention are different, we\n            # need to convert back to frequency temporarily.\n\n            if doppler_convention is not None and self._doppler_convention is None:\n                raise ValueError(\"Original doppler_convention not set\")\n\n            if doppler_rest is not None and self._doppler_rest is None:\n                raise ValueError(\"Original doppler_rest not set\")\n\n            if doppler_rest is None and doppler_convention is None:\n                result = super().to(unit, equivalencies=equivalencies)\n                result = result.view(self.__class__)\n                result.__array_finalize__(self)\n                return result\n\n            elif (doppler_rest is None) is not (doppler_convention is None):\n                raise ValueError(\"Either both or neither doppler_rest and \"\n                                 \"doppler_convention should be defined for \"\n                                 \"velocity conversions\")\n\n            vel_equiv1 = DOPPLER_CONVENTIONS[self._doppler_convention](self._doppler_rest)\n\n            freq = super().to(si.Hz, equivalencies=equivalencies + vel_equiv1)\n\n            vel_equiv2 = DOPPLER_CONVENTIONS[doppler_convention](doppler_rest)\n\n            result = freq.to(unit, equivalencies=equivalencies + vel_equiv2)\n\n        else:\n\n            additional_equivalencies = eq.spectral()\n\n            if self.unit.is_equivalent(KMS) or unit.is_equivalent(KMS):\n\n                if doppler_convention is None:\n                    raise ValueError(\"doppler_convention not set, cannot convert to/from velocities\")\n\n                if doppler_rest is None:\n                    raise ValueError(\"doppler_rest not set, cannot convert to/from velocities\")\n\n                additional_equivalencies = additional_equivalencies + DOPPLER_CONVENTIONS[doppler_convention](doppler_rest)\n\n            result = super().to(unit, equivalencies=equivalencies + additional_equivalencies)\n\n        # Since we have to explicitly specify when we want to keep this as a\n        # SpectralQuantity, we need to convert it back from a Quantity to\n        # a SpectralQuantity here. Note that we don't use __array_finalize__\n        # here since we might need to set the output doppler convention and\n        # rest based on the parameters passed to 'to'\n        result = result.view(self.__class__)\n        result.__array_finalize__(self)\n        result._doppler_convention = doppler_convention\n        result._doppler_rest = doppler_rest\n\n        return result\n\n    def to_value(self, unit=None, *args, **kwargs):\n        if unit is None:\n            return self.view(np.ndarray)\n\n        return self.to(unit, *args, **kwargs).value"},{"attributeType":"null","col":12,"comment":"null","endLoc":729,"id":4234,"name":"_outputs","nodeType":"Attribute","startLoc":729,"text":"self._outputs"},{"className":"SpecificTypeQuantity","col":0,"comment":"Superclass for Quantities of specific physical type.\n\n    Subclasses of these work just like :class:`~astropy.units.Quantity`, except\n    that they are for specific physical types (and may have methods that are\n    only appropriate for that type).  Astropy examples are\n    :class:`~astropy.coordinates.Angle` and\n    :class:`~astropy.coordinates.Distance`\n\n    At a minimum, subclasses should set ``_equivalent_unit`` to the unit\n    associated with the physical type.\n    ","endLoc":1916,"id":4235,"nodeType":"Class","startLoc":1876,"text":"class SpecificTypeQuantity(Quantity):\n    \"\"\"Superclass for Quantities of specific physical type.\n\n    Subclasses of these work just like :class:`~astropy.units.Quantity`, except\n    that they are for specific physical types (and may have methods that are\n    only appropriate for that type).  Astropy examples are\n    :class:`~astropy.coordinates.Angle` and\n    :class:`~astropy.coordinates.Distance`\n\n    At a minimum, subclasses should set ``_equivalent_unit`` to the unit\n    associated with the physical type.\n    \"\"\"\n    # The unit for the specific physical type.  Instances can only be created\n    # with units that are equivalent to this.\n    _equivalent_unit = None\n\n    # The default unit used for views.  Even with `None`, views of arrays\n    # without units are possible, but will have an uninitialized unit.\n    _unit = None\n\n    # Default unit for initialization through the constructor.\n    _default_unit = None\n\n    # ensure that we get precedence over our superclass.\n    __array_priority__ = Quantity.__array_priority__ + 10\n\n    def __quantity_subclass__(self, unit):\n        if unit.is_equivalent(self._equivalent_unit):\n            return type(self), True\n        else:\n            return super().__quantity_subclass__(unit)[0], False\n\n    def _set_unit(self, unit):\n        if unit is None or not unit.is_equivalent(self._equivalent_unit):\n            raise UnitTypeError(\n                \"{} instances require units equivalent to '{}'\"\n                .format(type(self).__name__, self._equivalent_unit) +\n                (\", but no unit was given.\" if unit is None else\n                 f\", so cannot set it to '{unit}'.\"))\n\n        super()._set_unit(unit)"},{"col":4,"comment":"null","endLoc":1906,"header":"def __quantity_subclass__(self, unit)","id":4236,"name":"__quantity_subclass__","nodeType":"Function","startLoc":1902,"text":"def __quantity_subclass__(self, unit):\n        if unit.is_equivalent(self._equivalent_unit):\n            return type(self), True\n        else:\n            return super().__quantity_subclass__(unit)[0], False"},{"attributeType":"null","col":12,"comment":"null","endLoc":1232,"id":4237,"name":"_sync_constraints","nodeType":"Attribute","startLoc":1232,"text":"self._sync_constraints"},{"col":4,"comment":"null","endLoc":751,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":4238,"name":"to_tree_transform","nodeType":"Function","startLoc":745,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'width': _parameter_to_value(model.width),\n                'slope': _parameter_to_value(model.slope)}\n        return node"},{"attributeType":"null","col":8,"comment":"null","endLoc":2427,"id":4239,"name":"_param_metrics","nodeType":"Attribute","startLoc":2427,"text":"self._param_metrics"},{"attributeType":"null","col":12,"comment":"null","endLoc":705,"id":4240,"name":"meta","nodeType":"Attribute","startLoc":705,"text":"self.meta"},{"col":4,"comment":"null","endLoc":1916,"header":"def _set_unit(self, unit)","id":4241,"name":"_set_unit","nodeType":"Function","startLoc":1908,"text":"def _set_unit(self, unit):\n        if unit is None or not unit.is_equivalent(self._equivalent_unit):\n            raise UnitTypeError(\n                \"{} instances require units equivalent to '{}'\"\n                .format(type(self).__name__, self._equivalent_unit) +\n                (\", but no unit was given.\" if unit is None else\n                 f\", so cannot set it to '{unit}'.\"))\n\n        super()._set_unit(unit)"},{"fileName":"angle.py","filePath":"astropy/io/misc/asdf/tags/coordinates","id":4242,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nfrom astropy.coordinates import Angle, Latitude, Longitude\n\nfrom astropy.io.misc.asdf.tags.unit.quantity import QuantityType\n\n\n__all__ = ['AngleType', 'LatitudeType', 'LongitudeType']\n\n\nclass AngleType(QuantityType):\n    name = \"coordinates/angle\"\n    types = [Angle]\n    requires = ['astropy']\n    version = \"1.0.0\"\n    organization = 'astropy.org'\n    standard = 'astropy'\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        return Angle(super().from_tree(node, ctx))\n\n\nclass LatitudeType(AngleType):\n    name = \"coordinates/latitude\"\n    types = [Latitude]\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        return Latitude(super().from_tree(node, ctx))\n\n\nclass LongitudeType(AngleType):\n    name = \"coordinates/longitude\"\n    types = [Longitude]\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        wrap_angle = node['wrap_angle']\n        return Longitude(super().from_tree(node, ctx), wrap_angle=wrap_angle)\n\n    @classmethod\n    def to_tree(cls, longitude, ctx):\n        tree = super().to_tree(longitude, ctx)\n        tree['wrap_angle'] = longitude.wrap_angle\n\n        return tree\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":2377,"id":4243,"name":"_mconstraints","nodeType":"Attribute","startLoc":2377,"text":"self._mconstraints"},{"className":"Angle","col":0,"comment":"\n    One or more angular value(s) with units equivalent to radians or degrees.\n\n    An angle can be specified either as an array, scalar, tuple (see\n    below), string, `~astropy.units.Quantity` or another\n    :class:`~astropy.coordinates.Angle`.\n\n    The input parser is flexible and supports a variety of formats.\n    The examples below illustrate common ways of initializing an `Angle`\n    object. First some imports::\n\n      >>> from astropy.coordinates import Angle\n      >>> from astropy import units as u\n\n    The angle values can now be provided::\n\n      >>> Angle('10.2345d')\n      <Angle 10.2345 deg>\n      >>> Angle(['10.2345d', '-20d'])\n      <Angle [ 10.2345, -20.    ] deg>\n      >>> Angle('1:2:30.43 degrees')\n      <Angle 1.04178611 deg>\n      >>> Angle('1 2 0 hours')\n      <Angle 1.03333333 hourangle>\n      >>> Angle(np.arange(1, 8), unit=u.deg)\n      <Angle [1., 2., 3., 4., 5., 6., 7.] deg>\n      >>> Angle('1°2′3″')\n      <Angle 1.03416667 deg>\n      >>> Angle('1°2′3″N')\n      <Angle 1.03416667 deg>\n      >>> Angle('1d2m3.4s')\n      <Angle 1.03427778 deg>\n      >>> Angle('1d2m3.4sS')\n      <Angle -1.03427778 deg>\n      >>> Angle('-1h2m3s')\n      <Angle -1.03416667 hourangle>\n      >>> Angle('-1h2m3sE')\n      <Angle -1.03416667 hourangle>\n      >>> Angle('-1h2.5m')\n      <Angle -1.04166667 hourangle>\n      >>> Angle('-1h2.5mW')\n      <Angle 1.04166667 hourangle>\n      >>> Angle('-1:2.5', unit=u.deg)\n      <Angle -1.04166667 deg>\n      >>> Angle((10, 11, 12), unit='hourangle')  # (h, m, s)\n      <Angle 10.18666667 hourangle>\n      >>> Angle((-1, 2, 3), unit=u.deg)  # (d, m, s)\n      <Angle -1.03416667 deg>\n      >>> Angle(10.2345 * u.deg)\n      <Angle 10.2345 deg>\n      >>> Angle(Angle(10.2345 * u.deg))\n      <Angle 10.2345 deg>\n\n    Parameters\n    ----------\n    angle : `~numpy.array`, scalar, `~astropy.units.Quantity`, :class:`~astropy.coordinates.Angle`\n        The angle value. If a tuple, will be interpreted as ``(h, m,\n        s)`` or ``(d, m, s)`` depending on ``unit``. If a string, it\n        will be interpreted following the rules described above.\n\n        If ``angle`` is a sequence or array of strings, the resulting\n        values will be in the given ``unit``, or if `None` is provided,\n        the unit will be taken from the first given value.\n\n    unit : unit-like, optional\n        The unit of the value specified for the angle.  This may be\n        any string that `~astropy.units.Unit` understands, but it is\n        better to give an actual unit object.  Must be an angular\n        unit.\n\n    dtype : `~numpy.dtype`, optional\n        See `~astropy.units.Quantity`.\n\n    copy : bool, optional\n        See `~astropy.units.Quantity`.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If a unit is not provided or it is not an angular unit.\n    ","endLoc":498,"id":4244,"nodeType":"Class","startLoc":27,"text":"class Angle(u.SpecificTypeQuantity):\n    \"\"\"\n    One or more angular value(s) with units equivalent to radians or degrees.\n\n    An angle can be specified either as an array, scalar, tuple (see\n    below), string, `~astropy.units.Quantity` or another\n    :class:`~astropy.coordinates.Angle`.\n\n    The input parser is flexible and supports a variety of formats.\n    The examples below illustrate common ways of initializing an `Angle`\n    object. First some imports::\n\n      >>> from astropy.coordinates import Angle\n      >>> from astropy import units as u\n\n    The angle values can now be provided::\n\n      >>> Angle('10.2345d')\n      <Angle 10.2345 deg>\n      >>> Angle(['10.2345d', '-20d'])\n      <Angle [ 10.2345, -20.    ] deg>\n      >>> Angle('1:2:30.43 degrees')\n      <Angle 1.04178611 deg>\n      >>> Angle('1 2 0 hours')\n      <Angle 1.03333333 hourangle>\n      >>> Angle(np.arange(1, 8), unit=u.deg)\n      <Angle [1., 2., 3., 4., 5., 6., 7.] deg>\n      >>> Angle('1°2′3″')\n      <Angle 1.03416667 deg>\n      >>> Angle('1°2′3″N')\n      <Angle 1.03416667 deg>\n      >>> Angle('1d2m3.4s')\n      <Angle 1.03427778 deg>\n      >>> Angle('1d2m3.4sS')\n      <Angle -1.03427778 deg>\n      >>> Angle('-1h2m3s')\n      <Angle -1.03416667 hourangle>\n      >>> Angle('-1h2m3sE')\n      <Angle -1.03416667 hourangle>\n      >>> Angle('-1h2.5m')\n      <Angle -1.04166667 hourangle>\n      >>> Angle('-1h2.5mW')\n      <Angle 1.04166667 hourangle>\n      >>> Angle('-1:2.5', unit=u.deg)\n      <Angle -1.04166667 deg>\n      >>> Angle((10, 11, 12), unit='hourangle')  # (h, m, s)\n      <Angle 10.18666667 hourangle>\n      >>> Angle((-1, 2, 3), unit=u.deg)  # (d, m, s)\n      <Angle -1.03416667 deg>\n      >>> Angle(10.2345 * u.deg)\n      <Angle 10.2345 deg>\n      >>> Angle(Angle(10.2345 * u.deg))\n      <Angle 10.2345 deg>\n\n    Parameters\n    ----------\n    angle : `~numpy.array`, scalar, `~astropy.units.Quantity`, :class:`~astropy.coordinates.Angle`\n        The angle value. If a tuple, will be interpreted as ``(h, m,\n        s)`` or ``(d, m, s)`` depending on ``unit``. If a string, it\n        will be interpreted following the rules described above.\n\n        If ``angle`` is a sequence or array of strings, the resulting\n        values will be in the given ``unit``, or if `None` is provided,\n        the unit will be taken from the first given value.\n\n    unit : unit-like, optional\n        The unit of the value specified for the angle.  This may be\n        any string that `~astropy.units.Unit` understands, but it is\n        better to give an actual unit object.  Must be an angular\n        unit.\n\n    dtype : `~numpy.dtype`, optional\n        See `~astropy.units.Quantity`.\n\n    copy : bool, optional\n        See `~astropy.units.Quantity`.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If a unit is not provided or it is not an angular unit.\n    \"\"\"\n    _equivalent_unit = u.radian\n    _include_easy_conversion_members = True\n\n    def __new__(cls, angle, unit=None, dtype=None, copy=True, **kwargs):\n\n        if not isinstance(angle, u.Quantity):\n            if unit is not None:\n                unit = cls._convert_unit_to_angle_unit(u.Unit(unit))\n\n            if isinstance(angle, tuple):\n                angle = cls._tuple_to_float(angle, unit)\n\n            elif isinstance(angle, str):\n                angle, angle_unit = form.parse_angle(angle, unit)\n                if angle_unit is None:\n                    angle_unit = unit\n\n                if isinstance(angle, tuple):\n                    angle = cls._tuple_to_float(angle, angle_unit)\n\n                if angle_unit is not unit:\n                    # Possible conversion to `unit` will be done below.\n                    angle = u.Quantity(angle, angle_unit, copy=False)\n\n            elif (isiterable(angle) and\n                  not (isinstance(angle, np.ndarray) and\n                       angle.dtype.kind not in 'SUVO')):\n                angle = [Angle(x, unit, copy=False) for x in angle]\n\n        return super().__new__(cls, angle, unit, dtype=dtype, copy=copy,\n                               **kwargs)\n\n    @staticmethod\n    def _tuple_to_float(angle, unit):\n        \"\"\"\n        Converts an angle represented as a 3-tuple or 2-tuple into a floating\n        point number in the given unit.\n        \"\"\"\n        # TODO: Numpy array of tuples?\n        if unit == u.hourangle:\n            return form.hms_to_hours(*angle)\n        elif unit == u.degree:\n            return form.dms_to_degrees(*angle)\n        else:\n            raise u.UnitsError(f\"Can not parse '{angle}' as unit '{unit}'\")\n\n    @staticmethod\n    def _convert_unit_to_angle_unit(unit):\n        return u.hourangle if unit is u.hour else unit\n\n    def _set_unit(self, unit):\n        super()._set_unit(self._convert_unit_to_angle_unit(unit))\n\n    @property\n    def hour(self):\n        \"\"\"\n        The angle's value in hours (read-only property).\n        \"\"\"\n        return self.hourangle\n\n    @property\n    def hms(self):\n        \"\"\"\n        The angle's value in hours, as a named tuple with ``(h, m, s)``\n        members.  (This is a read-only property.)\n        \"\"\"\n        return hms_tuple(*form.hours_to_hms(self.hourangle))\n\n    @property\n    def dms(self):\n        \"\"\"\n        The angle's value in degrees, as a named tuple with ``(d, m, s)``\n        members.  (This is a read-only property.)\n        \"\"\"\n        return dms_tuple(*form.degrees_to_dms(self.degree))\n\n    @property\n    def signed_dms(self):\n        \"\"\"\n        The angle's value in degrees, as a named tuple with ``(sign, d, m, s)``\n        members.  The ``d``, ``m``, ``s`` are thus always positive, and the sign of\n        the angle is given by ``sign``. (This is a read-only property.)\n\n        This is primarily intended for use with `dms` to generate string\n        representations of coordinates that are correct for negative angles.\n        \"\"\"\n        return signed_dms_tuple(np.sign(self.degree),\n                                *form.degrees_to_dms(np.abs(self.degree)))\n\n    def to_string(self, unit=None, decimal=False, sep='fromunit',\n                  precision=None, alwayssign=False, pad=False,\n                  fields=3, format=None):\n        \"\"\" A string representation of the angle.\n\n        Parameters\n        ----------\n        unit : `~astropy.units.UnitBase`, optional\n            Specifies the unit.  Must be an angular unit.  If not\n            provided, the unit used to initialize the angle will be\n            used.\n\n        decimal : bool, optional\n            If `True`, a decimal representation will be used, otherwise\n            the returned string will be in sexagesimal form.\n\n        sep : str, optional\n            The separator between numbers in a sexagesimal\n            representation.  E.g., if it is ':', the result is\n            ``'12:41:11.1241'``. Also accepts 2 or 3 separators. E.g.,\n            ``sep='hms'`` would give the result ``'12h41m11.1241s'``, or\n            sep='-:' would yield ``'11-21:17.124'``.  Alternatively, the\n            special string 'fromunit' means 'dms' if the unit is\n            degrees, or 'hms' if the unit is hours.\n\n        precision : int, optional\n            The level of decimal precision.  If ``decimal`` is `True`,\n            this is the raw precision, otherwise it gives the\n            precision of the last place of the sexagesimal\n            representation (seconds).  If `None`, or not provided, the\n            number of decimal places is determined by the value, and\n            will be between 0-8 decimal places as required.\n\n        alwayssign : bool, optional\n            If `True`, include the sign no matter what.  If `False`,\n            only include the sign if it is negative.\n\n        pad : bool, optional\n            If `True`, include leading zeros when needed to ensure a\n            fixed number of characters for sexagesimal representation.\n\n        fields : int, optional\n            Specifies the number of fields to display when outputting\n            sexagesimal notation.  For example:\n\n                - fields == 1: ``'5d'``\n                - fields == 2: ``'5d45m'``\n                - fields == 3: ``'5d45m32.5s'``\n\n            By default, all fields are displayed.\n\n        format : str, optional\n            The format of the result.  If not provided, an unadorned\n            string is returned.  Supported values are:\n\n            - 'latex': Return a LaTeX-formatted string\n\n            - 'unicode': Return a string containing non-ASCII unicode\n              characters, such as the degree symbol\n\n        Returns\n        -------\n        strrepr : str or array\n            A string representation of the angle. If the angle is an array, this\n            will be an array with a unicode dtype.\n\n\n        \"\"\"\n        if unit is None:\n            unit = self.unit\n        else:\n            unit = self._convert_unit_to_angle_unit(u.Unit(unit))\n\n        separators = {\n            None: {\n                u.degree: 'dms',\n                u.hourangle: 'hms'},\n            'latex': {\n                u.degree: [r'^\\circ', r'{}^\\prime', r'{}^{\\prime\\prime}'],\n                u.hourangle: [r'^{\\mathrm{h}}', r'^{\\mathrm{m}}', r'^{\\mathrm{s}}']},\n            'unicode': {\n                u.degree: '°′″',\n                u.hourangle: 'ʰᵐˢ'}\n        }\n\n        if sep == 'fromunit':\n            if format not in separators:\n                raise ValueError(f\"Unknown format '{format}'\")\n            seps = separators[format]\n            if unit in seps:\n                sep = seps[unit]\n\n        # Create an iterator so we can format each element of what\n        # might be an array.\n        if unit is u.degree:\n            if decimal:\n                values = self.degree\n                if precision is not None:\n                    func = (\"{0:0.\" + str(precision) + \"f}\").format\n                else:\n                    func = '{:g}'.format\n            else:\n                if sep == 'fromunit':\n                    sep = 'dms'\n                values = self.degree\n                func = lambda x: form.degrees_to_string(\n                    x, precision=precision, sep=sep, pad=pad,\n                    fields=fields)\n\n        elif unit is u.hourangle:\n            if decimal:\n                values = self.hour\n                if precision is not None:\n                    func = (\"{0:0.\" + str(precision) + \"f}\").format\n                else:\n                    func = '{:g}'.format\n            else:\n                if sep == 'fromunit':\n                    sep = 'hms'\n                values = self.hour\n                func = lambda x: form.hours_to_string(\n                    x, precision=precision, sep=sep, pad=pad,\n                    fields=fields)\n\n        elif unit.is_equivalent(u.radian):\n            if decimal:\n                values = self.to_value(unit)\n                if precision is not None:\n                    func = (\"{0:1.\" + str(precision) + \"f}\").format\n                else:\n                    func = \"{:g}\".format\n            elif sep == 'fromunit':\n                values = self.to_value(unit)\n                unit_string = unit.to_string(format=format)\n                if format == 'latex':\n                    unit_string = unit_string[1:-1]\n\n                if precision is not None:\n                    def plain_unit_format(val):\n                        return (\"{0:0.\" + str(precision) + \"f}{1}\").format(\n                            val, unit_string)\n                    func = plain_unit_format\n                else:\n                    def plain_unit_format(val):\n                        return f\"{val:g}{unit_string}\"\n                    func = plain_unit_format\n            else:\n                raise ValueError(\n                    f\"'{unit.name}' can not be represented in sexagesimal notation\")\n\n        else:\n            raise u.UnitsError(\n                \"The unit value provided is not an angular unit.\")\n\n        def do_format(val):\n            # Check if value is not nan to avoid ValueErrors when turning it into\n            # a hexagesimal string.\n            if not np.isnan(val):\n                s = func(float(val))\n                if alwayssign and not s.startswith('-'):\n                    s = '+' + s\n                if format == 'latex':\n                    s = f'${s}$'\n                return s\n            s = f\"{val}\"\n            return s\n\n        format_ufunc = np.vectorize(do_format, otypes=['U'])\n        result = format_ufunc(values)\n\n        if result.ndim == 0:\n            result = result[()]\n        return result\n\n    def _wrap_at(self, wrap_angle):\n        \"\"\"\n        Implementation that assumes ``angle`` is already validated\n        and that wrapping is inplace.\n        \"\"\"\n        # Convert the wrap angle and 360 degrees to the native unit of\n        # this Angle, then do all the math on raw Numpy arrays rather\n        # than Quantity objects for speed.\n        a360 = u.degree.to(self.unit, 360.0)\n        wrap_angle = wrap_angle.to_value(self.unit)\n        wrap_angle_floor = wrap_angle - a360\n        self_angle = self.view(np.ndarray)\n        # Do the wrapping, but only if any angles need to be wrapped\n        #\n        # This invalid catch block is needed both for the floor division\n        # and for the comparisons later on (latter not really needed\n        # any more for >= 1.19 (NUMPY_LT_1_19), but former is).\n        with np.errstate(invalid='ignore'):\n            wraps = (self_angle - wrap_angle_floor) // a360\n            np.nan_to_num(wraps, copy=False)\n            if np.any(wraps != 0):\n                self_angle -= wraps*a360\n                # Rounding errors can cause problems.\n                self_angle[self_angle >= wrap_angle] -= a360\n                self_angle[self_angle < wrap_angle_floor] += a360\n\n    def wrap_at(self, wrap_angle, inplace=False):\n        \"\"\"\n        Wrap the `~astropy.coordinates.Angle` object at the given ``wrap_angle``.\n\n        This method forces all the angle values to be within a contiguous\n        360 degree range so that ``wrap_angle - 360d <= angle <\n        wrap_angle``. By default a new Angle object is returned, but if the\n        ``inplace`` argument is `True` then the `~astropy.coordinates.Angle`\n        object is wrapped in place and nothing is returned.\n\n        For instance::\n\n          >>> from astropy.coordinates import Angle\n          >>> import astropy.units as u\n          >>> a = Angle([-20.0, 150.0, 350.0] * u.deg)\n\n          >>> a.wrap_at(360 * u.deg).degree  # Wrap into range 0 to 360 degrees  # doctest: +FLOAT_CMP\n          array([340., 150., 350.])\n\n          >>> a.wrap_at('180d', inplace=True)  # Wrap into range -180 to 180 degrees  # doctest: +FLOAT_CMP\n          >>> a.degree  # doctest: +FLOAT_CMP\n          array([-20., 150., -10.])\n\n        Parameters\n        ----------\n        wrap_angle : angle-like\n            Specifies a single value for the wrap angle.  This can be any\n            object that can initialize an `~astropy.coordinates.Angle` object,\n            e.g. ``'180d'``, ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.\n\n        inplace : bool\n            If `True` then wrap the object in place instead of returning\n            a new `~astropy.coordinates.Angle`\n\n        Returns\n        -------\n        out : Angle or None\n            If ``inplace is False`` (default), return new\n            `~astropy.coordinates.Angle` object with angles wrapped accordingly.\n            Otherwise wrap in place and return `None`.\n        \"\"\"\n        wrap_angle = Angle(wrap_angle, copy=False)  # Convert to an Angle\n        if not inplace:\n            self = self.copy()\n        self._wrap_at(wrap_angle)\n        return None if inplace else self\n\n    def is_within_bounds(self, lower=None, upper=None):\n        \"\"\"\n        Check if all angle(s) satisfy ``lower <= angle < upper``\n\n        If ``lower`` is not specified (or `None`) then no lower bounds check is\n        performed.  Likewise ``upper`` can be left unspecified.  For example::\n\n          >>> from astropy.coordinates import Angle\n          >>> import astropy.units as u\n          >>> a = Angle([-20, 150, 350] * u.deg)\n          >>> a.is_within_bounds('0d', '360d')\n          False\n          >>> a.is_within_bounds(None, '360d')\n          True\n          >>> a.is_within_bounds(-30 * u.deg, None)\n          True\n\n        Parameters\n        ----------\n        lower : angle-like or None\n            Specifies lower bound for checking.  This can be any object\n            that can initialize an `~astropy.coordinates.Angle` object, e.g. ``'180d'``,\n            ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.\n        upper : angle-like or None\n            Specifies upper bound for checking.  This can be any object\n            that can initialize an `~astropy.coordinates.Angle` object, e.g. ``'180d'``,\n            ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.\n\n        Returns\n        -------\n        is_within_bounds : bool\n            `True` if all angles satisfy ``lower <= angle < upper``\n        \"\"\"\n        ok = True\n        if lower is not None:\n            ok &= np.all(Angle(lower) <= self)\n        if ok and upper is not None:\n            ok &= np.all(self < Angle(upper))\n        return bool(ok)\n\n    def _str_helper(self, format=None):\n        if self.isscalar:\n            return self.to_string(format=format)\n\n        def formatter(x):\n            return x.to_string(format=format)\n\n        return np.array2string(self, formatter={'all': formatter})\n\n    def __str__(self):\n        return self._str_helper()\n\n    def _repr_latex_(self):\n        return self._str_helper(format='latex')"},{"attributeType":"null","col":12,"comment":"null","endLoc":728,"id":4245,"name":"_inputs","nodeType":"Attribute","startLoc":728,"text":"self._inputs"},{"col":4,"comment":"null","endLoc":762,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4246,"name":"assert_equal","nodeType":"Function","startLoc":753,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Trapezoid1D) and\n                isinstance(b, functional_models.Trapezoid1D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.width, b.width)\n        assert_array_equal(a.slope, b.slope)"},{"col":4,"comment":"null","endLoc":160,"header":"def _set_unit(self, unit)","id":4247,"name":"_set_unit","nodeType":"Function","startLoc":159,"text":"def _set_unit(self, unit):\n        super()._set_unit(self._convert_unit_to_angle_unit(unit))"},{"attributeType":"null","col":8,"comment":"null","endLoc":1335,"id":4248,"name":"_user_inverse","nodeType":"Attribute","startLoc":1335,"text":"self._user_inverse"},{"attributeType":"null","col":4,"comment":"null","endLoc":1890,"id":4249,"name":"_equivalent_unit","nodeType":"Attribute","startLoc":1890,"text":"_equivalent_unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":1894,"id":4250,"name":"_unit","nodeType":"Attribute","startLoc":1894,"text":"_unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":1897,"id":4251,"name":"_default_unit","nodeType":"Attribute","startLoc":1897,"text":"_default_unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":1900,"id":4252,"name":"__array_priority__","nodeType":"Attribute","startLoc":1900,"text":"__array_priority__"},{"attributeType":"null","col":8,"comment":"null","endLoc":2518,"id":4253,"name":"_n_models","nodeType":"Attribute","startLoc":2518,"text":"self._n_models"},{"col":4,"comment":"null","endLoc":74,"header":"def __array_finalize__(self, obj)","id":4254,"name":"__array_finalize__","nodeType":"Function","startLoc":71,"text":"def __array_finalize__(self, obj):\n        super().__array_finalize__(obj)\n        self._doppler_rest = getattr(obj, '_doppler_rest', None)\n        self._doppler_convention = getattr(obj, '_doppler_convention', None)"},{"col":4,"comment":"\n        The angle's value in hours (read-only property).\n        ","endLoc":167,"header":"@property\n    def hour(self)","id":4255,"name":"hour","nodeType":"Function","startLoc":162,"text":"@property\n    def hour(self):\n        \"\"\"\n        The angle's value in hours (read-only property).\n        \"\"\"\n        return self.hourangle"},{"col":4,"comment":"\n        The angle's value in hours, as a named tuple with ``(h, m, s)``\n        members.  (This is a read-only property.)\n        ","endLoc":175,"header":"@property\n    def hms(self)","id":4256,"name":"hms","nodeType":"Function","startLoc":169,"text":"@property\n    def hms(self):\n        \"\"\"\n        The angle's value in hours, as a named tuple with ``(h, m, s)``\n        members.  (This is a read-only property.)\n        \"\"\"\n        return hms_tuple(*form.hours_to_hms(self.hourangle))"},{"col":0,"comment":"\n    Convert an floating-point hour value into an ``(hour, minute,\n    second)`` tuple.\n    ","endLoc":518,"header":"def hours_to_hms(h)","id":4257,"name":"hours_to_hms","nodeType":"Function","startLoc":506,"text":"def hours_to_hms(h):\n    \"\"\"\n    Convert an floating-point hour value into an ``(hour, minute,\n    second)`` tuple.\n    \"\"\"\n\n    sign = np.copysign(1.0, h)\n\n    (hf, h) = np.modf(np.abs(h))  # (degree fraction, degree)\n    (mf, m) = np.modf(hf * 60.0)  # (minute fraction, minute)\n    s = mf * 60.0\n\n    return (np.floor(sign * h), sign * np.floor(m), sign * s)"},{"attributeType":"null","col":12,"comment":"null","endLoc":1247,"id":4258,"name":"_fixed","nodeType":"Attribute","startLoc":1247,"text":"self._fixed"},{"col":4,"comment":"null","endLoc":84,"header":"def __quantity_subclass__(self, unit)","id":4259,"name":"__quantity_subclass__","nodeType":"Function","startLoc":76,"text":"def __quantity_subclass__(self, unit):\n        # Always default to just returning a Quantity, unless we explicitly\n        # choose to return a SpectralQuantity - even if the units match, we\n        # want to avoid doing things like adding two SpectralQuantity instances\n        # together and getting a SpectralQuantity back\n        if unit is self.unit:\n            return SpectralQuantity, True\n        else:\n            return Quantity, False"},{"col":4,"comment":"null","endLoc":103,"header":"def __array_ufunc__(self, function, method, *inputs, **kwargs)","id":4260,"name":"__array_ufunc__","nodeType":"Function","startLoc":86,"text":"def __array_ufunc__(self, function, method, *inputs, **kwargs):\n        # We always return Quantity except in a few specific cases\n        result = super().__array_ufunc__(function, method, *inputs, **kwargs)\n        if ((function is np.multiply\n            or function is np.true_divide and inputs[0] is self)\n            and result.unit == self.unit\n            or (function in (np.minimum, np.maximum, np.fmax, np.fmin)\n                and method in ('reduce', 'reduceat'))):\n            result = result.view(self.__class__)\n            result.__array_finalize__(self)\n        else:\n            if result is self:\n                raise TypeError(f\"Cannot store the result of this operation in {self.__class__.__name__}\")\n            if result.dtype.kind == 'b':\n                result = result.view(np.ndarray)\n            else:\n                result = result.view(Quantity)\n        return result"},{"col":4,"comment":"\n        Determines if this coordinate frame can be transformed to another\n        given frame.\n\n        Parameters\n        ----------\n        new_frame : frame class, frame object, or str\n            The proposed frame to transform into.\n\n        Returns\n        -------\n        transformable : bool or str\n            `True` if this can be transformed to ``new_frame``, `False` if\n            not, or the string 'same' if ``new_frame`` is the same system as\n            this object but no transformation is defined.\n\n        Notes\n        -----\n        A return value of 'same' means the transformation will work, but it will\n        just give back a copy of this object.  The intended usage is::\n\n            if coord.is_transformable_to(some_unknown_frame):\n                coord2 = coord.transform_to(some_unknown_frame)\n\n        This will work even if ``some_unknown_frame``  turns out to be the same\n        frame class as ``coord``.  This is intended for cases where the frame\n        is the same regardless of the frame attributes (e.g. ICRS), but be\n        aware that it *might* also indicate that someone forgot to define the\n        transformation between two objects of the same frame class but with\n        different attributes.\n        ","endLoc":589,"header":"def is_transformable_to(self, new_frame)","id":4261,"name":"is_transformable_to","nodeType":"Function","startLoc":554,"text":"def is_transformable_to(self, new_frame):\n        \"\"\"\n        Determines if this coordinate frame can be transformed to another\n        given frame.\n\n        Parameters\n        ----------\n        new_frame : frame class, frame object, or str\n            The proposed frame to transform into.\n\n        Returns\n        -------\n        transformable : bool or str\n            `True` if this can be transformed to ``new_frame``, `False` if\n            not, or the string 'same' if ``new_frame`` is the same system as\n            this object but no transformation is defined.\n\n        Notes\n        -----\n        A return value of 'same' means the transformation will work, but it will\n        just give back a copy of this object.  The intended usage is::\n\n            if coord.is_transformable_to(some_unknown_frame):\n                coord2 = coord.transform_to(some_unknown_frame)\n\n        This will work even if ``some_unknown_frame``  turns out to be the same\n        frame class as ``coord``.  This is intended for cases where the frame\n        is the same regardless of the frame attributes (e.g. ICRS), but be\n        aware that it *might* also indicate that someone forgot to define the\n        transformation between two objects of the same frame class but with\n        different attributes.\n        \"\"\"\n        # TODO! like matplotlib, do string overrides for modified methods\n        new_frame = (_get_frame_class(new_frame) if isinstance(new_frame, str)\n                     else new_frame)\n        return self.frame.is_transformable_to(new_frame)"},{"col":4,"comment":"\n        The angle's value in degrees, as a named tuple with ``(d, m, s)``\n        members.  (This is a read-only property.)\n        ","endLoc":183,"header":"@property\n    def dms(self)","id":4262,"name":"dms","nodeType":"Function","startLoc":177,"text":"@property\n    def dms(self):\n        \"\"\"\n        The angle's value in degrees, as a named tuple with ``(d, m, s)``\n        members.  (This is a read-only property.)\n        \"\"\"\n        return dms_tuple(*form.degrees_to_dms(self.degree))"},{"attributeType":"null","col":8,"comment":"null","endLoc":1529,"id":4263,"name":"_stds","nodeType":"Attribute","startLoc":1529,"text":"self._stds"},{"col":0,"comment":"\n    Convert a floating-point degree value into a ``(degree, arcminute,\n    arcsecond)`` tuple.\n    ","endLoc":409,"header":"def degrees_to_dms(d)","id":4264,"name":"degrees_to_dms","nodeType":"Function","startLoc":398,"text":"def degrees_to_dms(d):\n    \"\"\"\n    Convert a floating-point degree value into a ``(degree, arcminute,\n    arcsecond)`` tuple.\n    \"\"\"\n    sign = np.copysign(1.0, d)\n\n    (df, d) = np.modf(np.abs(d))  # (degree fraction, degree)\n    (mf, m) = np.modf(df * 60.)  # (minute fraction, minute)\n    s = mf * 60.\n\n    return np.floor(sign * d), sign * np.floor(m), sign * s"},{"attributeType":"null","col":8,"comment":"null","endLoc":2583,"id":4265,"name":"_parameters","nodeType":"Attribute","startLoc":2583,"text":"self._parameters"},{"col":4,"comment":"\n        The angle's value in degrees, as a named tuple with ``(sign, d, m, s)``\n        members.  The ``d``, ``m``, ``s`` are thus always positive, and the sign of\n        the angle is given by ``sign``. (This is a read-only property.)\n\n        This is primarily intended for use with `dms` to generate string\n        representations of coordinates that are correct for negative angles.\n        ","endLoc":196,"header":"@property\n    def signed_dms(self)","id":4266,"name":"signed_dms","nodeType":"Function","startLoc":185,"text":"@property\n    def signed_dms(self):\n        \"\"\"\n        The angle's value in degrees, as a named tuple with ``(sign, d, m, s)``\n        members.  The ``d``, ``m``, ``s`` are thus always positive, and the sign of\n        the angle is given by ``sign``. (This is a read-only property.)\n\n        This is primarily intended for use with `dms` to generate string\n        representations of coordinates that are correct for negative angles.\n        \"\"\"\n        return signed_dms_tuple(np.sign(self.degree),\n                                *form.degrees_to_dms(np.abs(self.degree)))"},{"col":4,"comment":"\n        The rest value of the spectrum used for transformations to/from\n        velocity space.\n\n        Returns\n        -------\n        `~astropy.units.Quantity` ['speed']\n            Rest value as an astropy `~astropy.units.Quantity` object.\n        ","endLoc":116,"header":"@property\n    def doppler_rest(self)","id":4267,"name":"doppler_rest","nodeType":"Function","startLoc":105,"text":"@property\n    def doppler_rest(self):\n        \"\"\"\n        The rest value of the spectrum used for transformations to/from\n        velocity space.\n\n        Returns\n        -------\n        `~astropy.units.Quantity` ['speed']\n            Rest value as an astropy `~astropy.units.Quantity` object.\n        \"\"\"\n        return self._doppler_rest"},{"col":4,"comment":"\n        New rest value needed for velocity-space conversions.\n\n        Parameters\n        ----------\n        value : `~astropy.units.Quantity` ['speed']\n            Rest value.\n        ","endLoc":134,"header":"@doppler_rest.setter\n    @quantity_input(value=SPECTRAL_UNITS)\n    def doppler_rest(self, value)","id":4268,"name":"doppler_rest","nodeType":"Function","startLoc":118,"text":"@doppler_rest.setter\n    @quantity_input(value=SPECTRAL_UNITS)\n    def doppler_rest(self, value):\n        \"\"\"\n        New rest value needed for velocity-space conversions.\n\n        Parameters\n        ----------\n        value : `~astropy.units.Quantity` ['speed']\n            Rest value.\n        \"\"\"\n        if self._doppler_rest is not None:\n            raise AttributeError(\"doppler_rest has already been set, and cannot \"\n                                 \"be changed. Use the ``to`` method to convert \"\n                                 \"the spectral values(s) to use a different \"\n                                 \"rest value\")\n        self._doppler_rest = value"},{"col":4,"comment":"Transform this coordinate to a new frame.\n\n        The precise frame transformed to depends on ``merge_attributes``.\n        If `False`, the destination frame is used exactly as passed in.\n        But this is often not quite what one wants.  E.g., suppose one wants to\n        transform an ICRS coordinate that has an obstime attribute to FK4; in\n        this case, one likely would want to use this information. Thus, the\n        default for ``merge_attributes`` is `True`, in which the precedence is\n        as follows: (1) explicitly set (i.e., non-default) values in the\n        destination frame; (2) explicitly set values in the source; (3) default\n        value in the destination frame.\n\n        Note that in either case, any explicitly set attributes on the source\n        `SkyCoord` that are not part of the destination frame's definition are\n        kept (stored on the resulting `SkyCoord`), and thus one can round-trip\n        (e.g., from FK4 to ICRS to FK4 without losing obstime).\n\n        Parameters\n        ----------\n        frame : str, `BaseCoordinateFrame` class or instance, or `SkyCoord` instance\n            The frame to transform this coordinate into.  If a `SkyCoord`, the\n            underlying frame is extracted, and all other information ignored.\n        merge_attributes : bool, optional\n            Whether the default attributes in the destination frame are allowed\n            to be overridden by explicitly set attributes in the source\n            (see note above; default: `True`).\n\n        Returns\n        -------\n        coord : `SkyCoord`\n            A new object with this coordinate represented in the `frame` frame.\n\n        Raises\n        ------\n        ValueError\n            If there is no possible transformation route.\n\n        ","endLoc":690,"header":"def transform_to(self, frame, merge_attributes=True)","id":4269,"name":"transform_to","nodeType":"Function","startLoc":591,"text":"def transform_to(self, frame, merge_attributes=True):\n        \"\"\"Transform this coordinate to a new frame.\n\n        The precise frame transformed to depends on ``merge_attributes``.\n        If `False`, the destination frame is used exactly as passed in.\n        But this is often not quite what one wants.  E.g., suppose one wants to\n        transform an ICRS coordinate that has an obstime attribute to FK4; in\n        this case, one likely would want to use this information. Thus, the\n        default for ``merge_attributes`` is `True`, in which the precedence is\n        as follows: (1) explicitly set (i.e., non-default) values in the\n        destination frame; (2) explicitly set values in the source; (3) default\n        value in the destination frame.\n\n        Note that in either case, any explicitly set attributes on the source\n        `SkyCoord` that are not part of the destination frame's definition are\n        kept (stored on the resulting `SkyCoord`), and thus one can round-trip\n        (e.g., from FK4 to ICRS to FK4 without losing obstime).\n\n        Parameters\n        ----------\n        frame : str, `BaseCoordinateFrame` class or instance, or `SkyCoord` instance\n            The frame to transform this coordinate into.  If a `SkyCoord`, the\n            underlying frame is extracted, and all other information ignored.\n        merge_attributes : bool, optional\n            Whether the default attributes in the destination frame are allowed\n            to be overridden by explicitly set attributes in the source\n            (see note above; default: `True`).\n\n        Returns\n        -------\n        coord : `SkyCoord`\n            A new object with this coordinate represented in the `frame` frame.\n\n        Raises\n        ------\n        ValueError\n            If there is no possible transformation route.\n\n        \"\"\"\n        from astropy.coordinates.errors import ConvertError\n\n        frame_kwargs = {}\n\n        # Frame name (string) or frame class?  Coerce into an instance.\n        try:\n            frame = _get_frame_class(frame)()\n        except Exception:\n            pass\n\n        if isinstance(frame, SkyCoord):\n            frame = frame.frame  # Change to underlying coord frame instance\n\n        if isinstance(frame, BaseCoordinateFrame):\n            new_frame_cls = frame.__class__\n            # Get frame attributes, allowing defaults to be overridden by\n            # explicitly set attributes of the source if ``merge_attributes``.\n            for attr in frame_transform_graph.frame_attributes:\n                self_val = getattr(self, attr, None)\n                frame_val = getattr(frame, attr, None)\n                if (frame_val is not None\n                    and not (merge_attributes\n                             and frame.is_frame_attr_default(attr))):\n                    frame_kwargs[attr] = frame_val\n                elif (self_val is not None\n                      and not self.is_frame_attr_default(attr)):\n                    frame_kwargs[attr] = self_val\n                elif frame_val is not None:\n                    frame_kwargs[attr] = frame_val\n        else:\n            raise ValueError('Transform `frame` must be a frame name, class, or instance')\n\n        # Get the composite transform to the new frame\n        trans = frame_transform_graph.get_transform(self.frame.__class__, new_frame_cls)\n        if trans is None:\n            raise ConvertError('Cannot transform from {} to {}'\n                               .format(self.frame.__class__, new_frame_cls))\n\n        # Make a generic frame which will accept all the frame kwargs that\n        # are provided and allow for transforming through intermediate frames\n        # which may require one or more of those kwargs.\n        generic_frame = GenericFrame(frame_kwargs)\n\n        # Do the transformation, returning a coordinate frame of the desired\n        # final type (not generic).\n        new_coord = trans(self.frame, generic_frame)\n\n        # Finally make the new SkyCoord object from the `new_coord` and\n        # remaining frame_kwargs that are not frame_attributes in `new_coord`.\n        for attr in (set(new_coord.get_frame_attr_names()) &\n                     set(frame_kwargs.keys())):\n            frame_kwargs.pop(attr)\n\n        # Always remove the origin frame attribute, as that attribute only makes\n        # sense with a SkyOffsetFrame (in which case it will be stored on the frame).\n        # See gh-11277.\n        # TODO: Should it be a property of the frame attribute that it can\n        # or cannot be stored on a SkyCoord?\n        frame_kwargs.pop('origin', None)\n\n        return self.__class__(new_coord, **frame_kwargs)"},{"col":4,"comment":"\n        The defined convention for conversions to/from velocity space.\n\n        Returns\n        -------\n        str\n            One of 'optical', 'radio', or 'relativistic' representing the\n            equivalency used in the unit conversions.\n        ","endLoc":147,"header":"@property\n    def doppler_convention(self)","id":4270,"name":"doppler_convention","nodeType":"Function","startLoc":136,"text":"@property\n    def doppler_convention(self):\n        \"\"\"\n        The defined convention for conversions to/from velocity space.\n\n        Returns\n        -------\n        str\n            One of 'optical', 'radio', or 'relativistic' representing the\n            equivalency used in the unit conversions.\n        \"\"\"\n        return self._doppler_convention"},{"col":4,"comment":" A string representation of the angle.\n\n        Parameters\n        ----------\n        unit : `~astropy.units.UnitBase`, optional\n            Specifies the unit.  Must be an angular unit.  If not\n            provided, the unit used to initialize the angle will be\n            used.\n\n        decimal : bool, optional\n            If `True`, a decimal representation will be used, otherwise\n            the returned string will be in sexagesimal form.\n\n        sep : str, optional\n            The separator between numbers in a sexagesimal\n            representation.  E.g., if it is ':', the result is\n            ``'12:41:11.1241'``. Also accepts 2 or 3 separators. E.g.,\n            ``sep='hms'`` would give the result ``'12h41m11.1241s'``, or\n            sep='-:' would yield ``'11-21:17.124'``.  Alternatively, the\n            special string 'fromunit' means 'dms' if the unit is\n            degrees, or 'hms' if the unit is hours.\n\n        precision : int, optional\n            The level of decimal precision.  If ``decimal`` is `True`,\n            this is the raw precision, otherwise it gives the\n            precision of the last place of the sexagesimal\n            representation (seconds).  If `None`, or not provided, the\n            number of decimal places is determined by the value, and\n            will be between 0-8 decimal places as required.\n\n        alwayssign : bool, optional\n            If `True`, include the sign no matter what.  If `False`,\n            only include the sign if it is negative.\n\n        pad : bool, optional\n            If `True`, include leading zeros when needed to ensure a\n            fixed number of characters for sexagesimal representation.\n\n        fields : int, optional\n            Specifies the number of fields to display when outputting\n            sexagesimal notation.  For example:\n\n                - fields == 1: ``'5d'``\n                - fields == 2: ``'5d45m'``\n                - fields == 3: ``'5d45m32.5s'``\n\n            By default, all fields are displayed.\n\n        format : str, optional\n            The format of the result.  If not provided, an unadorned\n            string is returned.  Supported values are:\n\n            - 'latex': Return a LaTeX-formatted string\n\n            - 'unicode': Return a string containing non-ASCII unicode\n              characters, such as the degree symbol\n\n        Returns\n        -------\n        strrepr : str or array\n            A string representation of the angle. If the angle is an array, this\n            will be an array with a unicode dtype.\n\n\n        ","endLoc":370,"header":"def to_string(self, unit=None, decimal=False, sep='fromunit',\n                  precision=None, alwayssign=False, pad=False,\n                  fields=3, format=None)","id":4271,"name":"to_string","nodeType":"Function","startLoc":198,"text":"def to_string(self, unit=None, decimal=False, sep='fromunit',\n                  precision=None, alwayssign=False, pad=False,\n                  fields=3, format=None):\n        \"\"\" A string representation of the angle.\n\n        Parameters\n        ----------\n        unit : `~astropy.units.UnitBase`, optional\n            Specifies the unit.  Must be an angular unit.  If not\n            provided, the unit used to initialize the angle will be\n            used.\n\n        decimal : bool, optional\n            If `True`, a decimal representation will be used, otherwise\n            the returned string will be in sexagesimal form.\n\n        sep : str, optional\n            The separator between numbers in a sexagesimal\n            representation.  E.g., if it is ':', the result is\n            ``'12:41:11.1241'``. Also accepts 2 or 3 separators. E.g.,\n            ``sep='hms'`` would give the result ``'12h41m11.1241s'``, or\n            sep='-:' would yield ``'11-21:17.124'``.  Alternatively, the\n            special string 'fromunit' means 'dms' if the unit is\n            degrees, or 'hms' if the unit is hours.\n\n        precision : int, optional\n            The level of decimal precision.  If ``decimal`` is `True`,\n            this is the raw precision, otherwise it gives the\n            precision of the last place of the sexagesimal\n            representation (seconds).  If `None`, or not provided, the\n            number of decimal places is determined by the value, and\n            will be between 0-8 decimal places as required.\n\n        alwayssign : bool, optional\n            If `True`, include the sign no matter what.  If `False`,\n            only include the sign if it is negative.\n\n        pad : bool, optional\n            If `True`, include leading zeros when needed to ensure a\n            fixed number of characters for sexagesimal representation.\n\n        fields : int, optional\n            Specifies the number of fields to display when outputting\n            sexagesimal notation.  For example:\n\n                - fields == 1: ``'5d'``\n                - fields == 2: ``'5d45m'``\n                - fields == 3: ``'5d45m32.5s'``\n\n            By default, all fields are displayed.\n\n        format : str, optional\n            The format of the result.  If not provided, an unadorned\n            string is returned.  Supported values are:\n\n            - 'latex': Return a LaTeX-formatted string\n\n            - 'unicode': Return a string containing non-ASCII unicode\n              characters, such as the degree symbol\n\n        Returns\n        -------\n        strrepr : str or array\n            A string representation of the angle. If the angle is an array, this\n            will be an array with a unicode dtype.\n\n\n        \"\"\"\n        if unit is None:\n            unit = self.unit\n        else:\n            unit = self._convert_unit_to_angle_unit(u.Unit(unit))\n\n        separators = {\n            None: {\n                u.degree: 'dms',\n                u.hourangle: 'hms'},\n            'latex': {\n                u.degree: [r'^\\circ', r'{}^\\prime', r'{}^{\\prime\\prime}'],\n                u.hourangle: [r'^{\\mathrm{h}}', r'^{\\mathrm{m}}', r'^{\\mathrm{s}}']},\n            'unicode': {\n                u.degree: '°′″',\n                u.hourangle: 'ʰᵐˢ'}\n        }\n\n        if sep == 'fromunit':\n            if format not in separators:\n                raise ValueError(f\"Unknown format '{format}'\")\n            seps = separators[format]\n            if unit in seps:\n                sep = seps[unit]\n\n        # Create an iterator so we can format each element of what\n        # might be an array.\n        if unit is u.degree:\n            if decimal:\n                values = self.degree\n                if precision is not None:\n                    func = (\"{0:0.\" + str(precision) + \"f}\").format\n                else:\n                    func = '{:g}'.format\n            else:\n                if sep == 'fromunit':\n                    sep = 'dms'\n                values = self.degree\n                func = lambda x: form.degrees_to_string(\n                    x, precision=precision, sep=sep, pad=pad,\n                    fields=fields)\n\n        elif unit is u.hourangle:\n            if decimal:\n                values = self.hour\n                if precision is not None:\n                    func = (\"{0:0.\" + str(precision) + \"f}\").format\n                else:\n                    func = '{:g}'.format\n            else:\n                if sep == 'fromunit':\n                    sep = 'hms'\n                values = self.hour\n                func = lambda x: form.hours_to_string(\n                    x, precision=precision, sep=sep, pad=pad,\n                    fields=fields)\n\n        elif unit.is_equivalent(u.radian):\n            if decimal:\n                values = self.to_value(unit)\n                if precision is not None:\n                    func = (\"{0:1.\" + str(precision) + \"f}\").format\n                else:\n                    func = \"{:g}\".format\n            elif sep == 'fromunit':\n                values = self.to_value(unit)\n                unit_string = unit.to_string(format=format)\n                if format == 'latex':\n                    unit_string = unit_string[1:-1]\n\n                if precision is not None:\n                    def plain_unit_format(val):\n                        return (\"{0:0.\" + str(precision) + \"f}{1}\").format(\n                            val, unit_string)\n                    func = plain_unit_format\n                else:\n                    def plain_unit_format(val):\n                        return f\"{val:g}{unit_string}\"\n                    func = plain_unit_format\n            else:\n                raise ValueError(\n                    f\"'{unit.name}' can not be represented in sexagesimal notation\")\n\n        else:\n            raise u.UnitsError(\n                \"The unit value provided is not an angular unit.\")\n\n        def do_format(val):\n            # Check if value is not nan to avoid ValueErrors when turning it into\n            # a hexagesimal string.\n            if not np.isnan(val):\n                s = func(float(val))\n                if alwayssign and not s.startswith('-'):\n                    s = '+' + s\n                if format == 'latex':\n                    s = f'${s}$'\n                return s\n            s = f\"{val}\"\n            return s\n\n        format_ufunc = np.vectorize(do_format, otypes=['U'])\n        result = format_ufunc(values)\n\n        if result.ndim == 0:\n            result = result[()]\n        return result"},{"className":"Identity","col":0,"comment":"\n    Returns inputs unchanged.\n\n    This class is useful in compound models when some of the inputs must be\n    passed unchanged to the next model.\n\n    Parameters\n    ----------\n    n_inputs : int\n        Specifies the number of inputs this identity model accepts.\n    name : str, optional\n        A human-friendly name associated with this model instance\n        (particularly useful for identifying the individual components of a\n        compound model).\n    meta : dict-like\n        Free-form metadata to associate with this model.\n\n    Examples\n    --------\n\n    Transform ``(x, y)`` by a shift in x, followed by scaling the two inputs::\n\n        >>> from astropy.modeling.models import (Polynomial1D, Shift, Scale,\n        ...                                      Identity)\n        >>> model = (Shift(1) & Identity(1)) | Scale(1.2) & Scale(2)\n        >>> model(1,1)  # doctest: +FLOAT_CMP\n        (2.4, 2.0)\n        >>> model.inverse(2.4, 2) # doctest: +FLOAT_CMP\n        (1.0, 1.0)\n    ","endLoc":178,"id":4272,"nodeType":"Class","startLoc":128,"text":"class Identity(Mapping):\n    \"\"\"\n    Returns inputs unchanged.\n\n    This class is useful in compound models when some of the inputs must be\n    passed unchanged to the next model.\n\n    Parameters\n    ----------\n    n_inputs : int\n        Specifies the number of inputs this identity model accepts.\n    name : str, optional\n        A human-friendly name associated with this model instance\n        (particularly useful for identifying the individual components of a\n        compound model).\n    meta : dict-like\n        Free-form metadata to associate with this model.\n\n    Examples\n    --------\n\n    Transform ``(x, y)`` by a shift in x, followed by scaling the two inputs::\n\n        >>> from astropy.modeling.models import (Polynomial1D, Shift, Scale,\n        ...                                      Identity)\n        >>> model = (Shift(1) & Identity(1)) | Scale(1.2) & Scale(2)\n        >>> model(1,1)  # doctest: +FLOAT_CMP\n        (2.4, 2.0)\n        >>> model.inverse(2.4, 2) # doctest: +FLOAT_CMP\n        (1.0, 1.0)\n    \"\"\"\n    linear = True  # FittableModel is non-linear by default\n\n    def __init__(self, n_inputs, name=None, meta=None):\n        mapping = tuple(range(n_inputs))\n        super().__init__(mapping, name=name, meta=meta)\n\n    def __repr__(self):\n        if self.name is None:\n            return f'<Identity({self.n_inputs})>'\n        return f'<Identity({self.n_inputs}, name={self.name!r})>'\n\n    @property\n    def inverse(self):\n        \"\"\"\n        The inverse transformation.\n\n        In this case of `Identity`, ``self.inverse is self``.\n        \"\"\"\n\n        return self"},{"className":"Mapping","col":0,"comment":"\n    Allows inputs to be reordered, duplicated or dropped.\n\n    Parameters\n    ----------\n    mapping : tuple\n        A tuple of integers representing indices of the inputs to this model\n        to return and in what order to return them.  See\n        :ref:`astropy:compound-model-mappings` for more details.\n    n_inputs : int\n        Number of inputs; if `None` (default) then ``max(mapping) + 1`` is\n        used (i.e. the highest input index used in the mapping).\n    name : str, optional\n        A human-friendly name associated with this model instance\n        (particularly useful for identifying the individual components of a\n        compound model).\n    meta : dict-like\n        Free-form metadata to associate with this model.\n\n    Raises\n    ------\n    TypeError\n        Raised when number of inputs is less that ``max(mapping)``.\n\n    Examples\n    --------\n\n    >>> from astropy.modeling.models import Polynomial2D, Shift, Mapping\n    >>> poly1 = Polynomial2D(1, c0_0=1, c1_0=2, c0_1=3)\n    >>> poly2 = Polynomial2D(1, c0_0=1, c1_0=2.4, c0_1=2.1)\n    >>> model = (Shift(1) & Shift(2)) | Mapping((0, 1, 0, 1)) | (poly1 & poly2)\n    >>> model(1, 2)  # doctest: +FLOAT_CMP\n    (17.0, 14.2)\n    ","endLoc":125,"id":4273,"nodeType":"Class","startLoc":14,"text":"class Mapping(FittableModel):\n    \"\"\"\n    Allows inputs to be reordered, duplicated or dropped.\n\n    Parameters\n    ----------\n    mapping : tuple\n        A tuple of integers representing indices of the inputs to this model\n        to return and in what order to return them.  See\n        :ref:`astropy:compound-model-mappings` for more details.\n    n_inputs : int\n        Number of inputs; if `None` (default) then ``max(mapping) + 1`` is\n        used (i.e. the highest input index used in the mapping).\n    name : str, optional\n        A human-friendly name associated with this model instance\n        (particularly useful for identifying the individual components of a\n        compound model).\n    meta : dict-like\n        Free-form metadata to associate with this model.\n\n    Raises\n    ------\n    TypeError\n        Raised when number of inputs is less that ``max(mapping)``.\n\n    Examples\n    --------\n\n    >>> from astropy.modeling.models import Polynomial2D, Shift, Mapping\n    >>> poly1 = Polynomial2D(1, c0_0=1, c1_0=2, c0_1=3)\n    >>> poly2 = Polynomial2D(1, c0_0=1, c1_0=2.4, c0_1=2.1)\n    >>> model = (Shift(1) & Shift(2)) | Mapping((0, 1, 0, 1)) | (poly1 & poly2)\n    >>> model(1, 2)  # doctest: +FLOAT_CMP\n    (17.0, 14.2)\n    \"\"\"\n    linear = True  # FittableModel is non-linear by default\n\n    def __init__(self, mapping, n_inputs=None, name=None, meta=None):\n        self._inputs = ()\n        self._outputs = ()\n        if n_inputs is None:\n            self._n_inputs = max(mapping) + 1\n        else:\n            self._n_inputs = n_inputs\n\n        self._n_outputs = len(mapping)\n        super().__init__(name=name, meta=meta)\n\n        self.inputs = tuple('x' + str(idx) for idx in range(self._n_inputs))\n        self.outputs = tuple('x' + str(idx) for idx in range(self._n_outputs))\n\n        self._mapping = mapping\n        self._input_units_strict = {key: False for key in self._inputs}\n        self._input_units_allow_dimensionless = {key: False for key in self._inputs}\n\n    @property\n    def n_inputs(self):\n        return self._n_inputs\n\n    @property\n    def n_outputs(self):\n        return self._n_outputs\n\n    @property\n    def mapping(self):\n        \"\"\"Integers representing indices of the inputs.\"\"\"\n        return self._mapping\n\n    def __repr__(self):\n        if self.name is None:\n            return f'<Mapping({self.mapping})>'\n        return f'<Mapping({self.mapping}, name={self.name!r})>'\n\n    def evaluate(self, *args):\n        if len(args) != self.n_inputs:\n            name = self.name if self.name is not None else \"Mapping\"\n\n            raise TypeError(f'{name} expects {self.n_inputs} inputs; got {len(args)}')\n\n        result = tuple(args[idx] for idx in self._mapping)\n\n        if self.n_outputs == 1:\n            return result[0]\n\n        return result\n\n    @property\n    def inverse(self):\n        \"\"\"\n        A `Mapping` representing the inverse of the current mapping.\n\n        Raises\n        ------\n        `NotImplementedError`\n            An inverse does no exist on mappings that drop some of its inputs\n            (there is then no way to reconstruct the inputs that were dropped).\n        \"\"\"\n\n        try:\n            mapping = tuple(self.mapping.index(idx)\n                            for idx in range(self.n_inputs))\n        except ValueError:\n            raise NotImplementedError(\n                \"Mappings such as {} that drop one or more of their inputs \"\n                \"are not invertible at this time.\".format(self.mapping))\n\n        inv = self.__class__(mapping)\n        inv._inputs = self._outputs\n        inv._outputs = self._inputs\n        inv._n_inputs = len(inv._inputs)\n        inv._n_outputs = len(inv._outputs)\n        return inv"},{"col":4,"comment":"\n        New velocity convention used for velocity space conversions.\n\n        Parameters\n        ----------\n        value\n\n        Notes\n        -----\n        More information on the equations dictating the transformations can be\n        found in the astropy documentation [1]_.\n\n        References\n        ----------\n        .. [1] Astropy documentation: https://docs.astropy.org/en/stable/units/equivalencies.html#spectral-doppler-equivalencies\n\n        ","endLoc":178,"header":"@doppler_convention.setter\n    def doppler_convention(self, value)","id":4274,"name":"doppler_convention","nodeType":"Function","startLoc":149,"text":"@doppler_convention.setter\n    def doppler_convention(self, value):\n        \"\"\"\n        New velocity convention used for velocity space conversions.\n\n        Parameters\n        ----------\n        value\n\n        Notes\n        -----\n        More information on the equations dictating the transformations can be\n        found in the astropy documentation [1]_.\n\n        References\n        ----------\n        .. [1] Astropy documentation: https://docs.astropy.org/en/stable/units/equivalencies.html#spectral-doppler-equivalencies\n\n        \"\"\"\n\n        if self._doppler_convention is not None:\n            raise AttributeError(\"doppler_convention has already been set, and cannot \"\n                                 \"be changed. Use the ``to`` method to convert \"\n                                 \"the spectral values(s) to use a different \"\n                                 \"convention\")\n\n        if value is not None and value not in DOPPLER_CONVENTIONS:\n            raise ValueError(f\"doppler_convention should be one of {'/'.join(sorted(DOPPLER_CONVENTIONS))}\")\n\n        self._doppler_convention = value"},{"col":4,"comment":"null","endLoc":67,"header":"def __init__(self, mapping, n_inputs=None, name=None, meta=None)","id":4275,"name":"__init__","nodeType":"Function","startLoc":51,"text":"def __init__(self, mapping, n_inputs=None, name=None, meta=None):\n        self._inputs = ()\n        self._outputs = ()\n        if n_inputs is None:\n            self._n_inputs = max(mapping) + 1\n        else:\n            self._n_inputs = n_inputs\n\n        self._n_outputs = len(mapping)\n        super().__init__(name=name, meta=meta)\n\n        self.inputs = tuple('x' + str(idx) for idx in range(self._n_inputs))\n        self.outputs = tuple('x' + str(idx) for idx in range(self._n_outputs))\n\n        self._mapping = mapping\n        self._input_units_strict = {key: False for key in self._inputs}\n        self._input_units_allow_dimensionless = {key: False for key in self._inputs}"},{"attributeType":"null","col":4,"comment":"null","endLoc":734,"id":4276,"name":"name","nodeType":"Attribute","startLoc":734,"text":"name"},{"col":4,"comment":"null","endLoc":3284,"header":"def _evaluate(self, *args, **kw)","id":4277,"name":"_evaluate","nodeType":"Function","startLoc":3222,"text":"def _evaluate(self, *args, **kw):\n        op = self.op\n        if op != 'fix_inputs':\n            if op != '&':\n                leftval = self.left(*args, **kw)\n                if op != '|':\n                    rightval = self.right(*args, **kw)\n                else:\n                    rightval = None\n\n            else:\n                leftval = self.left(*(args[:self.left.n_inputs]), **kw)\n                rightval = self.right(*(args[self.left.n_inputs:]), **kw)\n\n            if op != \"|\":\n                return self._apply_operators_to_value_lists(leftval, rightval, **kw)\n\n            elif op == '|':\n                if isinstance(leftval, tuple):\n                    return self.right(*leftval, **kw)\n                else:\n                    return self.right(leftval, **kw)\n\n        else:\n            subs = self.right\n            newargs = list(args)\n            subinds = []\n            subvals = []\n            for key in subs.keys():\n                if np.issubdtype(type(key), np.integer):\n                    subinds.append(key)\n                elif isinstance(key, str):\n                    ind = self.left.inputs.index(key)\n                    subinds.append(ind)\n                subvals.append(subs[key])\n            # Turn inputs specified in kw into positional indices.\n            # Names for compound inputs do not propagate to sub models.\n            kwind = []\n            kwval = []\n            for kwkey in list(kw.keys()):\n                if kwkey in self.inputs:\n                    ind = self.inputs.index(kwkey)\n                    if ind < len(args):\n                        raise ValueError(\"Keyword argument duplicates \"\n                                         \"positional value supplied.\")\n                    kwind.append(ind)\n                    kwval.append(kw[kwkey])\n                    del kw[kwkey]\n            # Build new argument list\n            # Append keyword specified args first\n            if kwind:\n                kwargs = list(zip(kwind, kwval))\n                kwargs.sort()\n                kwindsorted, kwvalsorted = list(zip(*kwargs))\n                newargs = newargs + list(kwvalsorted)\n            if subinds:\n                subargs = list(zip(subinds, subvals))\n                subargs.sort()\n                # subindsorted, subvalsorted = list(zip(*subargs))\n                # The substitutions must be inserted in order\n                for ind, val in subargs:\n                    newargs.insert(ind, val)\n            return self.left(*newargs, **kw)"},{"attributeType":"null","col":4,"comment":"null","endLoc":735,"id":4278,"name":"version","nodeType":"Attribute","startLoc":735,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":736,"id":4279,"name":"types","nodeType":"Attribute","startLoc":736,"text":"types"},{"className":"TrapezoidDisk2DType","col":0,"comment":"null","endLoc":797,"id":4280,"nodeType":"Class","startLoc":765,"text":"class TrapezoidDisk2DType(TransformType):\n    name = 'transform/trapezoid_disk2d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.TrapezoidDisk2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.TrapezoidDisk2D(amplitude=node['amplitude'],\n                                                 x_0=node['x_0'],\n                                                 y_0=node['y_0'],\n                                                 R_0=node['R_0'],\n                                                 slope=node['slope'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'R_0': _parameter_to_value(model.R_0),\n                'slope': _parameter_to_value(model.slope)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.TrapezoidDisk2D) and\n                isinstance(b, functional_models.TrapezoidDisk2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.R_0, b.R_0)\n        assert_array_equal(a.slope, b.slope)"},{"col":4,"comment":"null","endLoc":776,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4281,"name":"from_tree_transform","nodeType":"Function","startLoc":770,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.TrapezoidDisk2D(amplitude=node['amplitude'],\n                                                 x_0=node['x_0'],\n                                                 y_0=node['y_0'],\n                                                 R_0=node['R_0'],\n                                                 slope=node['slope'])"},{"col":4,"comment":"\n        Return a new `~astropy.coordinates.SpectralQuantity` object with the specified unit.\n\n        By default, the ``spectral`` equivalency will be enabled, as well as\n        one of the Doppler equivalencies if converting to/from velocities.\n\n        Parameters\n        ----------\n        unit : unit-like\n            An object that represents the unit to convert to. Must be\n            an `~astropy.units.UnitBase` object or a string parseable\n            by the `~astropy.units` package, and should be a spectral unit.\n        equivalencies : list of `~astropy.units.equivalencies.Equivalency`, optional\n            A list of equivalence pairs to try if the units are not\n            directly convertible (along with spectral).\n            See :ref:`astropy:unit_equivalencies`.\n            If not provided or ``[]``, spectral equivalencies will be used.\n            If `None`, no equivalencies will be applied at all, not even any\n            set globally or within a context.\n        doppler_rest : `~astropy.units.Quantity` ['speed'], optional\n            The rest value used when converting to/from velocities. This will\n            also be set at an attribute on the output\n            `~astropy.coordinates.SpectralQuantity`.\n        doppler_convention : {'relativistic', 'optical', 'radio'}, optional\n            The Doppler convention used when converting to/from velocities.\n            This will also be set at an attribute on the output\n            `~astropy.coordinates.SpectralQuantity`.\n\n        Returns\n        -------\n        `SpectralQuantity`\n            New spectral coordinate object with data converted to the new unit.\n        ","endLoc":298,"header":"@quantity_input(doppler_rest=SPECTRAL_UNITS)\n    def to(self, unit,\n           equivalencies=[],\n           doppler_rest=None,\n           doppler_convention=None)","id":4282,"name":"to","nodeType":"Function","startLoc":180,"text":"@quantity_input(doppler_rest=SPECTRAL_UNITS)\n    def to(self, unit,\n           equivalencies=[],\n           doppler_rest=None,\n           doppler_convention=None):\n        \"\"\"\n        Return a new `~astropy.coordinates.SpectralQuantity` object with the specified unit.\n\n        By default, the ``spectral`` equivalency will be enabled, as well as\n        one of the Doppler equivalencies if converting to/from velocities.\n\n        Parameters\n        ----------\n        unit : unit-like\n            An object that represents the unit to convert to. Must be\n            an `~astropy.units.UnitBase` object or a string parseable\n            by the `~astropy.units` package, and should be a spectral unit.\n        equivalencies : list of `~astropy.units.equivalencies.Equivalency`, optional\n            A list of equivalence pairs to try if the units are not\n            directly convertible (along with spectral).\n            See :ref:`astropy:unit_equivalencies`.\n            If not provided or ``[]``, spectral equivalencies will be used.\n            If `None`, no equivalencies will be applied at all, not even any\n            set globally or within a context.\n        doppler_rest : `~astropy.units.Quantity` ['speed'], optional\n            The rest value used when converting to/from velocities. This will\n            also be set at an attribute on the output\n            `~astropy.coordinates.SpectralQuantity`.\n        doppler_convention : {'relativistic', 'optical', 'radio'}, optional\n            The Doppler convention used when converting to/from velocities.\n            This will also be set at an attribute on the output\n            `~astropy.coordinates.SpectralQuantity`.\n\n        Returns\n        -------\n        `SpectralQuantity`\n            New spectral coordinate object with data converted to the new unit.\n        \"\"\"\n\n        # Make sure units can be passed as strings\n        unit = Unit(unit)\n\n        # If equivalencies is explicitly set to None, we should just use the\n        # default Quantity.to with equivalencies also set to None\n        if equivalencies is None:\n            result = super().to(unit, equivalencies=None)\n            result = result.view(self.__class__)\n            result.__array_finalize__(self)\n            return result\n\n        # FIXME: need to consider case where doppler equivalency is passed in\n        # equivalencies list, or is u.spectral equivalency is already passed\n\n        if doppler_rest is None:\n            doppler_rest = self._doppler_rest\n\n        if doppler_convention is None:\n            doppler_convention = self._doppler_convention\n        elif doppler_convention not in DOPPLER_CONVENTIONS:\n            raise ValueError(f\"doppler_convention should be one of {'/'.join(sorted(DOPPLER_CONVENTIONS))}\")\n\n        if self.unit.is_equivalent(KMS) and unit.is_equivalent(KMS):\n\n            # Special case: if the current and final units are both velocity,\n            # and either the rest value or the convention are different, we\n            # need to convert back to frequency temporarily.\n\n            if doppler_convention is not None and self._doppler_convention is None:\n                raise ValueError(\"Original doppler_convention not set\")\n\n            if doppler_rest is not None and self._doppler_rest is None:\n                raise ValueError(\"Original doppler_rest not set\")\n\n            if doppler_rest is None and doppler_convention is None:\n                result = super().to(unit, equivalencies=equivalencies)\n                result = result.view(self.__class__)\n                result.__array_finalize__(self)\n                return result\n\n            elif (doppler_rest is None) is not (doppler_convention is None):\n                raise ValueError(\"Either both or neither doppler_rest and \"\n                                 \"doppler_convention should be defined for \"\n                                 \"velocity conversions\")\n\n            vel_equiv1 = DOPPLER_CONVENTIONS[self._doppler_convention](self._doppler_rest)\n\n            freq = super().to(si.Hz, equivalencies=equivalencies + vel_equiv1)\n\n            vel_equiv2 = DOPPLER_CONVENTIONS[doppler_convention](doppler_rest)\n\n            result = freq.to(unit, equivalencies=equivalencies + vel_equiv2)\n\n        else:\n\n            additional_equivalencies = eq.spectral()\n\n            if self.unit.is_equivalent(KMS) or unit.is_equivalent(KMS):\n\n                if doppler_convention is None:\n                    raise ValueError(\"doppler_convention not set, cannot convert to/from velocities\")\n\n                if doppler_rest is None:\n                    raise ValueError(\"doppler_rest not set, cannot convert to/from velocities\")\n\n                additional_equivalencies = additional_equivalencies + DOPPLER_CONVENTIONS[doppler_convention](doppler_rest)\n\n            result = super().to(unit, equivalencies=equivalencies + additional_equivalencies)\n\n        # Since we have to explicitly specify when we want to keep this as a\n        # SpectralQuantity, we need to convert it back from a Quantity to\n        # a SpectralQuantity here. Note that we don't use __array_finalize__\n        # here since we might need to set the output doppler convention and\n        # rest based on the parameters passed to 'to'\n        result = result.view(self.__class__)\n        result.__array_finalize__(self)\n        result._doppler_convention = doppler_convention\n        result._doppler_rest = doppler_rest\n\n        return result"},{"col":4,"comment":"null","endLoc":71,"header":"@property\n    def n_inputs(self)","id":4283,"name":"n_inputs","nodeType":"Function","startLoc":69,"text":"@property\n    def n_inputs(self):\n        return self._n_inputs"},{"col":4,"comment":"null","endLoc":75,"header":"@property\n    def n_outputs(self)","id":4284,"name":"n_outputs","nodeType":"Function","startLoc":73,"text":"@property\n    def n_outputs(self):\n        return self._n_outputs"},{"col":4,"comment":"Integers representing indices of the inputs.","endLoc":80,"header":"@property\n    def mapping(self)","id":4285,"name":"mapping","nodeType":"Function","startLoc":77,"text":"@property\n    def mapping(self):\n        \"\"\"Integers representing indices of the inputs.\"\"\"\n        return self._mapping"},{"col":4,"comment":"null","endLoc":85,"header":"def __repr__(self)","id":4286,"name":"__repr__","nodeType":"Function","startLoc":82,"text":"def __repr__(self):\n        if self.name is None:\n            return f'<Mapping({self.mapping})>'\n        return f'<Mapping({self.mapping}, name={self.name!r})>'"},{"col":4,"comment":"null","endLoc":98,"header":"def evaluate(self, *args)","id":4287,"name":"evaluate","nodeType":"Function","startLoc":87,"text":"def evaluate(self, *args):\n        if len(args) != self.n_inputs:\n            name = self.name if self.name is not None else \"Mapping\"\n\n            raise TypeError(f'{name} expects {self.n_inputs} inputs; got {len(args)}')\n\n        result = tuple(args[idx] for idx in self._mapping)\n\n        if self.n_outputs == 1:\n            return result[0]\n\n        return result"},{"col":4,"comment":"\n        A `Mapping` representing the inverse of the current mapping.\n\n        Raises\n        ------\n        `NotImplementedError`\n            An inverse does no exist on mappings that drop some of its inputs\n            (there is then no way to reconstruct the inputs that were dropped).\n        ","endLoc":125,"header":"@property\n    def inverse(self)","id":4288,"name":"inverse","nodeType":"Function","startLoc":100,"text":"@property\n    def inverse(self):\n        \"\"\"\n        A `Mapping` representing the inverse of the current mapping.\n\n        Raises\n        ------\n        `NotImplementedError`\n            An inverse does no exist on mappings that drop some of its inputs\n            (there is then no way to reconstruct the inputs that were dropped).\n        \"\"\"\n\n        try:\n            mapping = tuple(self.mapping.index(idx)\n                            for idx in range(self.n_inputs))\n        except ValueError:\n            raise NotImplementedError(\n                \"Mappings such as {} that drop one or more of their inputs \"\n                \"are not invertible at this time.\".format(self.mapping))\n\n        inv = self.__class__(mapping)\n        inv._inputs = self._outputs\n        inv._outputs = self._inputs\n        inv._n_inputs = len(inv._inputs)\n        inv._n_outputs = len(inv._outputs)\n        return inv"},{"col":4,"comment":"null","endLoc":785,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":4289,"name":"to_tree_transform","nodeType":"Function","startLoc":778,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'amplitude': _parameter_to_value(model.amplitude),\n                'x_0': _parameter_to_value(model.x_0),\n                'y_0': _parameter_to_value(model.y_0),\n                'R_0': _parameter_to_value(model.R_0),\n                'slope': _parameter_to_value(model.slope)}\n        return node"},{"col":4,"comment":"null","endLoc":797,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4290,"name":"assert_equal","nodeType":"Function","startLoc":787,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.TrapezoidDisk2D) and\n                isinstance(b, functional_models.TrapezoidDisk2D))\n        assert_array_equal(a.amplitude, b.amplitude)\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.y_0, b.y_0)\n        assert_array_equal(a.R_0, b.R_0)\n        assert_array_equal(a.slope, b.slope)"},{"attributeType":"null","col":4,"comment":"null","endLoc":766,"id":4291,"name":"name","nodeType":"Attribute","startLoc":766,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":49,"id":4292,"name":"linear","nodeType":"Attribute","startLoc":49,"text":"linear"},{"attributeType":"null","col":4,"comment":"null","endLoc":767,"id":4293,"name":"version","nodeType":"Attribute","startLoc":767,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":768,"id":4294,"name":"types","nodeType":"Attribute","startLoc":768,"text":"types"},{"attributeType":"null","col":8,"comment":"null","endLoc":63,"id":4295,"name":"outputs","nodeType":"Attribute","startLoc":63,"text":"self.outputs"},{"className":"Voigt1DType","col":0,"comment":"null","endLoc":829,"id":4296,"nodeType":"Class","startLoc":800,"text":"class Voigt1DType(TransformType):\n    name = 'transform/voigt1d'\n    version = '1.0.0'\n    types = ['astropy.modeling.functional_models.Voigt1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Voigt1D(x_0=node['x_0'],\n                                         amplitude_L=node['amplitude_L'],\n                                         fwhm_L=node['fwhm_L'],\n                                         fwhm_G=node['fwhm_G'])\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'x_0': _parameter_to_value(model.x_0),\n                'amplitude_L': _parameter_to_value(model.amplitude_L),\n                'fwhm_L': _parameter_to_value(model.fwhm_L),\n                'fwhm_G': _parameter_to_value(model.fwhm_G)}\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Voigt1D) and\n                isinstance(b, functional_models.Voigt1D))\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.amplitude_L, b.amplitude_L)\n        assert_array_equal(a.fwhm_L, b.fwhm_L)\n        assert_array_equal(a.fwhm_G, b.fwhm_G)"},{"col":4,"comment":"null","endLoc":810,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4297,"name":"from_tree_transform","nodeType":"Function","startLoc":805,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Voigt1D(x_0=node['x_0'],\n                                         amplitude_L=node['amplitude_L'],\n                                         fwhm_L=node['fwhm_L'],\n                                         fwhm_G=node['fwhm_G'])"},{"attributeType":"null","col":8,"comment":"null","endLoc":53,"id":4298,"name":"_outputs","nodeType":"Attribute","startLoc":53,"text":"self._outputs"},{"col":0,"comment":"\n    Takes a decimal hour value and returns a string formatted as dms with\n    separator specified by the 'sep' parameter.\n\n    ``d`` must be a scalar.\n    ","endLoc":666,"header":"def degrees_to_string(d, precision=5, pad=False, sep=':', fields=3)","id":4299,"name":"degrees_to_string","nodeType":"Function","startLoc":657,"text":"def degrees_to_string(d, precision=5, pad=False, sep=':', fields=3):\n    \"\"\"\n    Takes a decimal hour value and returns a string formatted as dms with\n    separator specified by the 'sep' parameter.\n\n    ``d`` must be a scalar.\n    \"\"\"\n    d, m, s = degrees_to_dms(d)\n    return sexagesimal_to_string((d, m, s), precision=precision, pad=pad,\n                                 sep=sep, fields=fields)"},{"attributeType":"null","col":8,"comment":"null","endLoc":65,"id":4300,"name":"_mapping","nodeType":"Attribute","startLoc":65,"text":"self._mapping"},{"col":0,"comment":"\n    Given an already separated tuple of sexagesimal values, returns\n    a string.\n\n    See `hours_to_string` and `degrees_to_string` for a higher-level\n    interface to this functionality.\n    ","endLoc":641,"header":"def sexagesimal_to_string(values, precision=None, pad=False, sep=(':',),\n                          fields=3)","id":4301,"name":"sexagesimal_to_string","nodeType":"Function","startLoc":554,"text":"def sexagesimal_to_string(values, precision=None, pad=False, sep=(':',),\n                          fields=3):\n    \"\"\"\n    Given an already separated tuple of sexagesimal values, returns\n    a string.\n\n    See `hours_to_string` and `degrees_to_string` for a higher-level\n    interface to this functionality.\n    \"\"\"\n\n    # Check to see if values[0] is negative, using np.copysign to handle -0\n    sign = np.copysign(1.0, values[0])\n    # If the coordinates are negative, we need to take the absolute values.\n    # We use np.abs because abs(-0) is -0\n    # TODO: Is this true? (MHvK, 2018-02-01: not on my system)\n    values = [np.abs(value) for value in values]\n\n    if pad:\n        if sign == -1:\n            pad = 3\n        else:\n            pad = 2\n    else:\n        pad = 0\n\n    if not isinstance(sep, tuple):\n        sep = tuple(sep)\n\n    if fields < 1 or fields > 3:\n        raise ValueError(\n            \"fields must be 1, 2, or 3\")\n\n    if not sep:  # empty string, False, or None, etc.\n        sep = ('', '', '')\n    elif len(sep) == 1:\n        if fields == 3:\n            sep = sep + (sep[0], '')\n        elif fields == 2:\n            sep = sep + ('', '')\n        else:\n            sep = ('', '', '')\n    elif len(sep) == 2:\n        sep = sep + ('',)\n    elif len(sep) != 3:\n        raise ValueError(\n            \"Invalid separator specification for converting angle to string.\")\n\n    # Simplify the expression based on the requested precision.  For\n    # example, if the seconds will round up to 60, we should convert\n    # it to 0 and carry upwards.  If the field is hidden (by the\n    # fields kwarg) we round up around the middle, 30.0.\n    if precision is None:\n        rounding_thresh = 60.0 - (10.0 ** -8)\n    else:\n        rounding_thresh = 60.0 - (10.0 ** -precision)\n\n    if fields == 3 and values[2] >= rounding_thresh:\n        values[2] = 0.0\n        values[1] += 1.0\n    elif fields < 3 and values[2] >= 30.0:\n        values[1] += 1.0\n\n    if fields >= 2 and values[1] >= 60.0:\n        values[1] = 0.0\n        values[0] += 1.0\n    elif fields < 2 and values[1] >= 30.0:\n        values[0] += 1.0\n\n    literal = []\n    last_value = ''\n    literal.append('{0:0{pad}.0f}{sep[0]}')\n    if fields >= 2:\n        literal.append('{1:02d}{sep[1]}')\n    if fields == 3:\n        if precision is None:\n            last_value = f'{abs(values[2]):.8f}'\n            last_value = last_value.rstrip('0').rstrip('.')\n        else:\n            last_value = '{0:.{precision}f}'.format(\n                abs(values[2]), precision=precision)\n        if len(last_value) == 1 or last_value[1] == '.':\n            last_value = '0' + last_value\n        literal.append('{last_value}{sep[2]}')\n    literal = ''.join(literal)\n    return literal.format(np.copysign(values[0], sign),\n                          int(values[1]), values[2],\n                          sep=sep, pad=pad,\n                          last_value=last_value)"},{"col":4,"comment":"null","endLoc":1615,"header":"def __init__(self, x_0=x_0.default, amplitude_L=amplitude_L.default,            # noqa: N803\n                 fwhm_L=fwhm_L.default, fwhm_G=fwhm_G.default, method='humlicek2',  # noqa: N803\n                 **kwargs)","id":4302,"name":"__init__","nodeType":"Function","startLoc":1603,"text":"def __init__(self, x_0=x_0.default, amplitude_L=amplitude_L.default,            # noqa: N803\n                 fwhm_L=fwhm_L.default, fwhm_G=fwhm_G.default, method='humlicek2',  # noqa: N803\n                 **kwargs):\n        if str(method).lower() in ('wofz', 'scipy'):\n            from scipy.special import wofz\n            self._faddeeva = wofz\n        elif str(method).lower() == 'humlicek2':\n            self._faddeeva = self._hum2zpf16c\n        else:\n            raise ValueError(f'Not a valid method for Voigt1D Faddeeva function: {method}.')\n        self.method = self._faddeeva.__name__\n\n        super().__init__(x_0=x_0, amplitude_L=amplitude_L, fwhm_L=fwhm_L, fwhm_G=fwhm_G, **kwargs)"},{"col":4,"comment":"null","endLoc":818,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":4303,"name":"to_tree_transform","nodeType":"Function","startLoc":812,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'x_0': _parameter_to_value(model.x_0),\n                'amplitude_L': _parameter_to_value(model.amplitude_L),\n                'fwhm_L': _parameter_to_value(model.fwhm_L),\n                'fwhm_G': _parameter_to_value(model.fwhm_G)}\n        return node"},{"attributeType":"null","col":8,"comment":"null","endLoc":67,"id":4304,"name":"_input_units_allow_dimensionless","nodeType":"Attribute","startLoc":67,"text":"self._input_units_allow_dimensionless"},{"attributeType":"null","col":8,"comment":"null","endLoc":66,"id":4305,"name":"_input_units_strict","nodeType":"Attribute","startLoc":66,"text":"self._input_units_strict"},{"attributeType":"null","col":8,"comment":"null","endLoc":62,"id":4306,"name":"inputs","nodeType":"Attribute","startLoc":62,"text":"self.inputs"},{"attributeType":"null","col":8,"comment":"null","endLoc":52,"id":4307,"name":"_inputs","nodeType":"Attribute","startLoc":52,"text":"self._inputs"},{"attributeType":"null","col":8,"comment":"null","endLoc":59,"id":4308,"name":"_n_outputs","nodeType":"Attribute","startLoc":59,"text":"self._n_outputs"},{"attributeType":"null","col":12,"comment":"null","endLoc":57,"id":4309,"name":"_n_inputs","nodeType":"Attribute","startLoc":57,"text":"self._n_inputs"},{"col":4,"comment":"null","endLoc":304,"header":"def to_value(self, unit=None, *args, **kwargs)","id":4310,"name":"to_value","nodeType":"Function","startLoc":300,"text":"def to_value(self, unit=None, *args, **kwargs):\n        if unit is None:\n            return self.view(np.ndarray)\n\n        return self.to(unit, *args, **kwargs).value"},{"col":4,"comment":"null","endLoc":163,"header":"def __init__(self, n_inputs, name=None, meta=None)","id":4311,"name":"__init__","nodeType":"Function","startLoc":161,"text":"def __init__(self, n_inputs, name=None, meta=None):\n        mapping = tuple(range(n_inputs))\n        super().__init__(mapping, name=name, meta=meta)"},{"attributeType":"null","col":4,"comment":"null","endLoc":49,"id":4312,"name":"_equivalent_unit","nodeType":"Attribute","startLoc":49,"text":"_equivalent_unit"},{"col":4,"comment":"null","endLoc":829,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4313,"name":"assert_equal","nodeType":"Function","startLoc":820,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, functional_models.Voigt1D) and\n                isinstance(b, functional_models.Voigt1D))\n        assert_array_equal(a.x_0, b.x_0)\n        assert_array_equal(a.amplitude_L, b.amplitude_L)\n        assert_array_equal(a.fwhm_L, b.fwhm_L)\n        assert_array_equal(a.fwhm_G, b.fwhm_G)"},{"attributeType":"null","col":4,"comment":"null","endLoc":801,"id":4314,"name":"name","nodeType":"Attribute","startLoc":801,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":802,"id":4315,"name":"version","nodeType":"Attribute","startLoc":802,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":803,"id":4316,"name":"types","nodeType":"Attribute","startLoc":803,"text":"types"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":4317,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"functional_models.py#<anonymous>","id":4318,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['AiryDisk2DType', 'Box1DType', 'Box2DType',\n           'Disk2DType', 'Ellipse2DType', 'Exponential1DType',\n           'Gaussian1DType', 'Gaussian2DType', 'KingProjectedAnalytic1DType',\n           'Logarithmic1DType', 'Lorentz1DType', 'Moffat1DType',\n           'Moffat2DType', 'Planar2D', 'RedshiftScaleFactorType',\n           'RickerWavelet1DType', 'RickerWavelet2DType', 'Ring2DType',\n           'Sersic1DType', 'Sersic2DType',\n           'Sine1DType', 'Cosine1DType', 'Tangent1DType',\n           'ArcSine1DType', 'ArcCosine1DType', 'ArcTangent1DType',\n           'Trapezoid1DType', 'TrapezoidDisk2DType', 'Voigt1DType']"},{"col":23,"endLoc":305,"id":4319,"nodeType":"Lambda","startLoc":303,"text":"lambda x: form.degrees_to_string(\n                    x, precision=precision, sep=sep, pad=pad,\n                    fields=fields)"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/coordinates","id":4320,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n"},{"col":0,"comment":"\n    Takes a decimal hour value and returns a string formatted as hms with\n    separator specified by the 'sep' parameter.\n\n    ``h`` must be a scalar.\n    ","endLoc":654,"header":"def hours_to_string(h, precision=5, pad=False, sep=('h', 'm', 's'),\n                    fields=3)","id":4321,"name":"hours_to_string","nodeType":"Function","startLoc":644,"text":"def hours_to_string(h, precision=5, pad=False, sep=('h', 'm', 's'),\n                    fields=3):\n    \"\"\"\n    Takes a decimal hour value and returns a string formatted as hms with\n    separator specified by the 'sep' parameter.\n\n    ``h`` must be a scalar.\n    \"\"\"\n    h, m, s = hours_to_hms(h)\n    return sexagesimal_to_string((h, m, s), precision=precision, pad=pad,\n                                 sep=sep, fields=fields)"},{"col":23,"endLoc":320,"id":4322,"nodeType":"Lambda","startLoc":318,"text":"lambda x: form.hours_to_string(\n                    x, precision=precision, sep=sep, pad=pad,\n                    fields=fields)"},{"fileName":"frames.py","filePath":"astropy/io/misc/asdf/tags/coordinates","id":4323,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\nimport os\nimport glob\n\nfrom asdf import tagged\n\nimport astropy.units as u\nimport astropy.coordinates\nfrom astropy.coordinates.baseframe import frame_transform_graph\nfrom astropy.units import Quantity\nfrom astropy.coordinates import ICRS, Longitude, Latitude, Angle\n\nfrom astropy.io.misc.asdf.types import AstropyType\n\n\n__all__ = ['CoordType']\n\nSCHEMA_PATH = os.path.abspath(\n    os.path.join(os.path.dirname(__file__), '..', '..', 'data', 'schemas', 'astropy.org', 'astropy'))\n\n\ndef _get_frames():\n    \"\"\"\n    By reading the schema files, get the list of all the frames we can\n    save/load.\n    \"\"\"\n    search = os.path.join(SCHEMA_PATH, 'coordinates', 'frames', '*.yaml')\n    files = glob.glob(search)\n\n    names = []\n    for fpath in files:\n        path, fname = os.path.split(fpath)\n        frame, _ = fname.split('-')\n        # Skip baseframe because we cannot directly save / load it.\n        # Skip icrs because we have an explicit tag for it because there are\n        # two versions.\n        if frame not in ['baseframe', 'icrs']:\n            names.append(frame)\n\n    return names\n\n\nclass BaseCoordType:\n    \"\"\"\n    This defines the base methods for coordinates, without defining anything\n    related to asdf types. This allows subclasses with different types and\n    schemas to use this without confusing the metaclass machinery.\n    \"\"\"\n    @staticmethod\n    def _tag_to_frame(tag):\n        \"\"\"\n        Extract the frame name from the tag.\n        \"\"\"\n        tag = tag[tag.rfind('/')+1:]\n        tag = tag[:tag.rfind('-')]\n        return frame_transform_graph.lookup_name(tag)\n\n    @classmethod\n    def _frame_name_to_tag(cls, frame_name):\n        return cls.make_yaml_tag(cls._tag_prefix + frame_name)\n\n    @classmethod\n    def from_tree_tagged(cls, node, ctx):\n\n        frame = cls._tag_to_frame(node._tag)\n\n        data = node.get('data', None)\n        if data is not None:\n            return frame(node['data'], **node['frame_attributes'])\n\n        return frame(**node['frame_attributes'])\n\n    @classmethod\n    def to_tree_tagged(cls, frame, ctx):\n        if type(frame) not in frame_transform_graph.frame_set:\n            raise ValueError(\"Can only save frames that are registered with the \"\n                             \"transformation graph.\")\n\n        node = {}\n        if frame.has_data:\n            node['data'] = frame.data\n        frame_attributes = {}\n        for attr in frame.frame_attributes.keys():\n            value = getattr(frame, attr, None)\n            if value is not None:\n                frame_attributes[attr] = value\n        node['frame_attributes'] = frame_attributes\n\n        return tagged.tag_object(cls._frame_name_to_tag(frame.name), node, ctx=ctx)\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        assert isinstance(new, type(old))\n        if new.has_data:\n            assert u.allclose(new.data.lon, old.data.lon)\n            assert u.allclose(new.data.lat, old.data.lat)\n\n\nclass CoordType(BaseCoordType, AstropyType):\n    _tag_prefix = \"coordinates/frames/\"\n    name = [\"coordinates/frames/\" + f for f in _get_frames()]\n    types = [astropy.coordinates.BaseCoordinateFrame]\n    handle_dynamic_subclasses = True\n    requires = ['astropy']\n    version = \"1.0.0\"\n\n\nclass ICRSType(CoordType):\n    \"\"\"\n    Define a special tag for ICRS so we can make it version 1.1.0.\n    \"\"\"\n    name = \"coordinates/frames/icrs\"\n    types = ['astropy.coordinates.ICRS']\n    version = \"1.1.0\"\n\n\nclass ICRSType10(AstropyType):\n    name = \"coordinates/frames/icrs\"\n    types = [astropy.coordinates.ICRS]\n    requires = ['astropy']\n    version = \"1.0.0\"\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        wrap_angle = Angle(node['ra']['wrap_angle'])\n        ra = Longitude(\n            node['ra']['value'],\n            unit=node['ra']['unit'],\n            wrap_angle=wrap_angle)\n        dec = Latitude(node['dec']['value'], unit=node['dec']['unit'])\n\n        return ICRS(ra=ra, dec=dec)\n\n    @classmethod\n    def to_tree(cls, frame, ctx):\n        node = {}\n\n        wrap_angle = Quantity(frame.ra.wrap_angle)\n        node['ra'] = {\n            'value': frame.ra.value,\n            'unit': frame.ra.unit.to_string(),\n            'wrap_angle': wrap_angle\n        }\n        node['dec'] = {\n            'value': frame.dec.value,\n            'unit': frame.dec.unit.to_string()\n        }\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        assert isinstance(old, ICRS)\n        assert isinstance(new, ICRS)\n        assert u.allclose(new.ra, old.ra)\n        assert u.allclose(new.dec, old.dec)\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":51,"id":4324,"name":"_include_easy_conversion_members","nodeType":"Attribute","startLoc":51,"text":"_include_easy_conversion_members"},{"attributeType":"null","col":8,"comment":"null","endLoc":66,"id":4325,"name":"_doppler_rest","nodeType":"Attribute","startLoc":66,"text":"obj._doppler_rest"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":4326,"name":"frame_transform_graph","nodeType":"Attribute","startLoc":35,"text":"frame_transform_graph"},{"className":"ICRS","col":0,"comment":"\n    A coordinate or frame in the ICRS system.\n\n    If you're looking for \"J2000\" coordinates, and aren't sure if you want to\n    use this or `~astropy.coordinates.FK5`, you probably want to use ICRS. It's\n    more well-defined as a catalog coordinate and is an inertial system, and is\n    very close (within tens of milliarcseconds) to J2000 equatorial.\n\n    For more background on the ICRS and related coordinate transformations, see\n    the references provided in the  :ref:`astropy:astropy-coordinates-seealso`\n    section of the documentation.\n    ","endLoc":24,"id":4327,"nodeType":"Class","startLoc":11,"text":"@format_doc(base_doc, components=doc_components, footer=\"\")\nclass ICRS(BaseRADecFrame):\n    \"\"\"\n    A coordinate or frame in the ICRS system.\n\n    If you're looking for \"J2000\" coordinates, and aren't sure if you want to\n    use this or `~astropy.coordinates.FK5`, you probably want to use ICRS. It's\n    more well-defined as a catalog coordinate and is an inertial system, and is\n    very close (within tens of milliarcseconds) to J2000 equatorial.\n\n    For more background on the ICRS and related coordinate transformations, see\n    the references provided in the  :ref:`astropy:astropy-coordinates-seealso`\n    section of the documentation.\n    \"\"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":67,"id":4328,"name":"_doppler_convention","nodeType":"Attribute","startLoc":67,"text":"obj._doppler_convention"},{"col":4,"comment":"null","endLoc":228,"header":"def __array_finalize__(self, obj)","id":4329,"name":"__array_finalize__","nodeType":"Function","startLoc":224,"text":"def __array_finalize__(self, obj):\n        super().__array_finalize__(obj)\n        self._radial_velocity = getattr(obj, '_radial_velocity', None)\n        self._observer = getattr(obj, '_observer', None)\n        self._target = getattr(obj, '_target', None)"},{"className":"BaseRADecFrame","col":0,"comment":"\n    A base class that defines default representation info for frames that\n    represent longitude and latitude as Right Ascension and Declination\n    following typical \"equatorial\" conventions.\n    ","endLoc":48,"id":4330,"nodeType":"Class","startLoc":33,"text":"@format_doc(base_doc, components=doc_components, footer=\"\")\nclass BaseRADecFrame(BaseCoordinateFrame):\n    \"\"\"\n    A base class that defines default representation info for frames that\n    represent longitude and latitude as Right Ascension and Declination\n    following typical \"equatorial\" conventions.\n    \"\"\"\n    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'ra'),\n            RepresentationMapping('lat', 'dec')\n        ]\n    }\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential"},{"col":4,"comment":"\n        Return a replica of the `SpectralCoord`, optionally changing the\n        values or attributes.\n\n        Note that no conversion is carried out by this method - this keeps\n        all the values and attributes the same, except for the ones explicitly\n        passed to this method which are changed.\n\n        If ``copy`` is set to `True` then a full copy of the internal arrays\n        will be made.  By default the replica will use a reference to the\n        original arrays when possible to save memory.\n\n        Parameters\n        ----------\n        value : ndarray or `~astropy.units.Quantity` or `SpectralCoord`, optional\n            Spectral values, which should be either wavelength, frequency,\n            energy, wavenumber, or velocity values.\n        unit : unit-like\n            Unit for the given spectral values.\n        observer : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`, optional\n            The coordinate (position and velocity) of observer.\n        target : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`, optional\n            The coordinate (position and velocity) of target.\n        radial_velocity : `~astropy.units.Quantity` ['speed'], optional\n            The radial velocity of the target with respect to the observer.\n        redshift : float, optional\n            The relativistic redshift of the target with respect to the observer.\n        doppler_rest : `~astropy.units.Quantity`, optional\n            The rest value to use when expressing the spectral value as a velocity.\n        doppler_convention : str, optional\n            The Doppler convention to use when expressing the spectral value as a velocity.\n        copy : bool, optional\n            If `True`, and ``value`` is not specified, the values are copied to\n            the new `SkyCoord` - otherwise a reference to the same values is used.\n\n        Returns\n        -------\n        sc : `SpectralCoord` object\n            Replica of this object\n        ","endLoc":356,"header":"def replicate(self, value=None, unit=None,\n                  observer=None, target=None,\n                  radial_velocity=None, redshift=None,\n                  doppler_convention=None, doppler_rest=None,\n                  copy=False)","id":4331,"name":"replicate","nodeType":"Function","startLoc":283,"text":"def replicate(self, value=None, unit=None,\n                  observer=None, target=None,\n                  radial_velocity=None, redshift=None,\n                  doppler_convention=None, doppler_rest=None,\n                  copy=False):\n        \"\"\"\n        Return a replica of the `SpectralCoord`, optionally changing the\n        values or attributes.\n\n        Note that no conversion is carried out by this method - this keeps\n        all the values and attributes the same, except for the ones explicitly\n        passed to this method which are changed.\n\n        If ``copy`` is set to `True` then a full copy of the internal arrays\n        will be made.  By default the replica will use a reference to the\n        original arrays when possible to save memory.\n\n        Parameters\n        ----------\n        value : ndarray or `~astropy.units.Quantity` or `SpectralCoord`, optional\n            Spectral values, which should be either wavelength, frequency,\n            energy, wavenumber, or velocity values.\n        unit : unit-like\n            Unit for the given spectral values.\n        observer : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`, optional\n            The coordinate (position and velocity) of observer.\n        target : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`, optional\n            The coordinate (position and velocity) of target.\n        radial_velocity : `~astropy.units.Quantity` ['speed'], optional\n            The radial velocity of the target with respect to the observer.\n        redshift : float, optional\n            The relativistic redshift of the target with respect to the observer.\n        doppler_rest : `~astropy.units.Quantity`, optional\n            The rest value to use when expressing the spectral value as a velocity.\n        doppler_convention : str, optional\n            The Doppler convention to use when expressing the spectral value as a velocity.\n        copy : bool, optional\n            If `True`, and ``value`` is not specified, the values are copied to\n            the new `SkyCoord` - otherwise a reference to the same values is used.\n\n        Returns\n        -------\n        sc : `SpectralCoord` object\n            Replica of this object\n        \"\"\"\n\n        if isinstance(value, u.Quantity):\n            if unit is not None:\n                raise ValueError(\"Cannot specify value as a Quantity and also specify unit\")\n            else:\n                value, unit = value.value, value.unit\n\n        value = value if value is not None else self.value\n        unit = unit or self.unit\n        observer = self._validate_coordinate(observer) or self.observer\n        target = self._validate_coordinate(target) or self.target\n        doppler_convention = doppler_convention or self.doppler_convention\n        doppler_rest = doppler_rest or self.doppler_rest\n\n        # If value is being taken from self and copy is Tru\n        if copy:\n            value = value.copy()\n\n        # Only include radial_velocity if it is not auto-computed from the\n        # observer and target.\n        if (self.observer is None or self.target is None) and radial_velocity is None and redshift is None:\n            radial_velocity = self.radial_velocity\n\n        with warnings.catch_warnings():\n            warnings.simplefilter('ignore', NoVelocityWarning)\n            return self.__class__(value=value, unit=unit,\n                                  observer=observer, target=target,\n                                  radial_velocity=radial_velocity, redshift=redshift,\n                                  doppler_convention=doppler_convention, doppler_rest=doppler_rest, copy=False)"},{"col":4,"comment":"No inputs should be used to determine input_shape when handling compound models","endLoc":3207,"header":"@property\n    def _argnames(self)","id":4332,"name":"_argnames","nodeType":"Function","startLoc":3204,"text":"@property\n    def _argnames(self):\n        \"\"\"No inputs should be used to determine input_shape when handling compound models\"\"\"\n        return ()"},{"col":4,"comment":"\n        CompoundModel specific post evaluation processing of outputs\n\n        Note\n        ----\n            All of the _post_evaluate for each component model will be\n            performed at the time that the individual model is evaluated.\n        ","endLoc":3220,"header":"def _post_evaluate(self, inputs, outputs, broadcasted_shapes, with_bbox, **kwargs)","id":4333,"name":"_post_evaluate","nodeType":"Function","startLoc":3209,"text":"def _post_evaluate(self, inputs, outputs, broadcasted_shapes, with_bbox, **kwargs):\n        \"\"\"\n        CompoundModel specific post evaluation processing of outputs\n\n        Note\n        ----\n            All of the _post_evaluate for each component model will be\n            performed at the time that the individual model is evaluated.\n        \"\"\"\n        if self.get_bounding_box(with_bbox) is not None and self.n_outputs == 1:\n            return outputs[0]\n        return outputs"},{"col":4,"comment":"null","endLoc":1878,"header":"def __init__(self, frame_attrs)","id":4334,"name":"__init__","nodeType":"Function","startLoc":1872,"text":"def __init__(self, frame_attrs):\n        self.frame_attributes = {}\n        for name, default in frame_attrs.items():\n            self.frame_attributes[name] = Attribute(default)\n            setattr(self, '_' + name, default)\n\n        super().__init__(None)"},{"col":4,"comment":"null","endLoc":168,"header":"def __repr__(self)","id":4335,"name":"__repr__","nodeType":"Function","startLoc":165,"text":"def __repr__(self):\n        if self.name is None:\n            return f'<Identity({self.n_inputs})>'\n        return f'<Identity({self.n_inputs}, name={self.name!r})>'"},{"col":4,"comment":"\n        The inverse transformation.\n\n        In this case of `Identity`, ``self.inverse is self``.\n        ","endLoc":178,"header":"@property\n    def inverse(self)","id":4336,"name":"inverse","nodeType":"Function","startLoc":170,"text":"@property\n    def inverse(self):\n        \"\"\"\n        The inverse transformation.\n\n        In this case of `Identity`, ``self.inverse is self``.\n        \"\"\"\n\n        return self"},{"attributeType":"null","col":4,"comment":"null","endLoc":159,"id":4337,"name":"linear","nodeType":"Attribute","startLoc":159,"text":"linear"},{"className":"Const1D","col":0,"comment":"\n    One dimensional Constant model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Value of the constant function\n\n    See Also\n    --------\n    Const2D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = A\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Const1D\n\n        plt.figure()\n        s1 = Const1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n    ","endLoc":1792,"id":4338,"nodeType":"Class","startLoc":1719,"text":"class Const1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Constant model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Value of the constant function\n\n    See Also\n    --------\n    Const2D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = A\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Const1D\n\n        plt.figure()\n        s1 = Const1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Value of the constant function\")\n    linear = True\n\n    @staticmethod\n    def evaluate(x, amplitude):\n        \"\"\"One dimensional Constant model function\"\"\"\n\n        if amplitude.size == 1:\n            # This is slightly faster than using ones_like and multiplying\n            x = np.empty_like(x, subok=False)\n            x.fill(amplitude.item())\n        else:\n            # This case is less likely but could occur if the amplitude\n            # parameter is given an array-like value\n            x = amplitude * np.ones_like(x, subok=False)\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(x, unit=amplitude.unit, copy=False)\n        return x\n\n    @staticmethod\n    def fit_deriv(x, amplitude):\n        \"\"\"One dimensional Constant model derivative with respect to parameters\"\"\"\n\n        d_amplitude = np.ones_like(x)\n        return [d_amplitude]\n\n    @property\n    def input_units(self):\n        return None\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'amplitude': outputs_unit[self.outputs[0]]}"},{"className":"Fittable1DModel","col":0,"comment":"\n    Base class for one-dimensional fittable models.\n\n    This class provides an easier interface to defining new models.\n    Examples can be found in `astropy.modeling.functional_models`.\n    ","endLoc":2826,"id":4339,"nodeType":"Class","startLoc":2817,"text":"class Fittable1DModel(FittableModel):\n    \"\"\"\n    Base class for one-dimensional fittable models.\n\n    This class provides an easier interface to defining new models.\n    Examples can be found in `astropy.modeling.functional_models`.\n    \"\"\"\n    n_inputs = 1\n    n_outputs = 1\n    _separable = True"},{"attributeType":"null","col":4,"comment":"null","endLoc":2824,"id":4340,"name":"n_inputs","nodeType":"Attribute","startLoc":2824,"text":"n_inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":2825,"id":4341,"name":"n_outputs","nodeType":"Attribute","startLoc":2825,"text":"n_outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":2826,"id":4342,"name":"_separable","nodeType":"Attribute","startLoc":2826,"text":"_separable"},{"col":4,"comment":"One dimensional Constant model function","endLoc":1778,"header":"@staticmethod\n    def evaluate(x, amplitude)","id":4343,"name":"evaluate","nodeType":"Function","startLoc":1763,"text":"@staticmethod\n    def evaluate(x, amplitude):\n        \"\"\"One dimensional Constant model function\"\"\"\n\n        if amplitude.size == 1:\n            # This is slightly faster than using ones_like and multiplying\n            x = np.empty_like(x, subok=False)\n            x.fill(amplitude.item())\n        else:\n            # This case is less likely but could occur if the amplitude\n            # parameter is given an array-like value\n            x = amplitude * np.ones_like(x, subok=False)\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(x, unit=amplitude.unit, copy=False)\n        return x"},{"col":4,"comment":"null","endLoc":57,"header":"def __init__(self, default=None, secondary_attribute='')","id":4344,"name":"__init__","nodeType":"Function","startLoc":54,"text":"def __init__(self, default=None, secondary_attribute=''):\n        self.default = default\n        self.secondary_attribute = secondary_attribute\n        super().__init__()"},{"col":4,"comment":"\n        Check if all angle(s) satisfy ``lower <= angle < upper``\n\n        If ``lower`` is not specified (or `None`) then no lower bounds check is\n        performed.  Likewise ``upper`` can be left unspecified.  For example::\n\n          >>> from astropy.coordinates import Angle\n          >>> import astropy.units as u\n          >>> a = Angle([-20, 150, 350] * u.deg)\n          >>> a.is_within_bounds('0d', '360d')\n          False\n          >>> a.is_within_bounds(None, '360d')\n          True\n          >>> a.is_within_bounds(-30 * u.deg, None)\n          True\n\n        Parameters\n        ----------\n        lower : angle-like or None\n            Specifies lower bound for checking.  This can be any object\n            that can initialize an `~astropy.coordinates.Angle` object, e.g. ``'180d'``,\n            ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.\n        upper : angle-like or None\n            Specifies upper bound for checking.  This can be any object\n            that can initialize an `~astropy.coordinates.Angle` object, e.g. ``'180d'``,\n            ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.\n\n        Returns\n        -------\n        is_within_bounds : bool\n            `True` if all angles satisfy ``lower <= angle < upper``\n        ","endLoc":483,"header":"def is_within_bounds(self, lower=None, upper=None)","id":4345,"name":"is_within_bounds","nodeType":"Function","startLoc":445,"text":"def is_within_bounds(self, lower=None, upper=None):\n        \"\"\"\n        Check if all angle(s) satisfy ``lower <= angle < upper``\n\n        If ``lower`` is not specified (or `None`) then no lower bounds check is\n        performed.  Likewise ``upper`` can be left unspecified.  For example::\n\n          >>> from astropy.coordinates import Angle\n          >>> import astropy.units as u\n          >>> a = Angle([-20, 150, 350] * u.deg)\n          >>> a.is_within_bounds('0d', '360d')\n          False\n          >>> a.is_within_bounds(None, '360d')\n          True\n          >>> a.is_within_bounds(-30 * u.deg, None)\n          True\n\n        Parameters\n        ----------\n        lower : angle-like or None\n            Specifies lower bound for checking.  This can be any object\n            that can initialize an `~astropy.coordinates.Angle` object, e.g. ``'180d'``,\n            ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.\n        upper : angle-like or None\n            Specifies upper bound for checking.  This can be any object\n            that can initialize an `~astropy.coordinates.Angle` object, e.g. ``'180d'``,\n            ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.\n\n        Returns\n        -------\n        is_within_bounds : bool\n            `True` if all angles satisfy ``lower <= angle < upper``\n        \"\"\"\n        ok = True\n        if lower is not None:\n            ok &= np.all(Angle(lower) <= self)\n        if ok and upper is not None:\n            ok &= np.all(self < Angle(upper))\n        return bool(ok)"},{"col":4,"comment":" An ordered list of parameter names.","endLoc":3289,"header":"@property\n    def param_names(self)","id":4346,"name":"param_names","nodeType":"Function","startLoc":3286,"text":"@property\n    def param_names(self):\n        \"\"\" An ordered list of parameter names.\"\"\"\n        return self._param_names"},{"col":4,"comment":"\n        If someone accesses an attribute not already defined, map the\n        parameters, and then see if the requested attribute is one of\n        the parameters\n        ","endLoc":3311,"header":"def __getattr__(self, name)","id":4347,"name":"__getattr__","nodeType":"Function","startLoc":3298,"text":"def __getattr__(self, name):\n        \"\"\"\n        If someone accesses an attribute not already defined, map the\n        parameters, and then see if the requested attribute is one of\n        the parameters\n        \"\"\"\n        # The following test is needed to avoid infinite recursion\n        # caused by deepcopy. There may be other such cases discovered.\n        if name == '__setstate__':\n            raise AttributeError\n        if name in self._param_names:\n            return self.__dict__[name]\n        else:\n            raise AttributeError(f'Attribute \"{name}\" not found')"},{"col":4,"comment":"null","endLoc":3356,"header":"def __getitem__(self, index)","id":4348,"name":"__getitem__","nodeType":"Function","startLoc":3313,"text":"def __getitem__(self, index):\n        if self._leaflist is None:\n            self._make_leaflist()\n        leaflist = self._leaflist\n        tdict = self._tdict\n        if isinstance(index, slice):\n            if index.step:\n                raise ValueError('Steps in slices not supported '\n                                 'for compound models')\n            if index.start is not None:\n                if isinstance(index.start, str):\n                    start = self._str_index_to_int(index.start)\n                else:\n                    start = index.start\n            else:\n                start = 0\n            if index.stop is not None:\n                if isinstance(index.stop, str):\n                    stop = self._str_index_to_int(index.stop)\n                else:\n                    stop = index.stop - 1\n            else:\n                stop = len(leaflist) - 1\n            if index.stop == 0:\n                raise ValueError(\"Slice endpoint cannot be 0\")\n            if start < 0:\n                start = len(leaflist) + start\n            if stop < 0:\n                stop = len(leaflist) + stop\n            # now search for matching node:\n            if stop == start:  # only single value, get leaf instead in code below\n                index = start\n            else:\n                for key in tdict:\n                    node, leftind, rightind = tdict[key]\n                    if leftind == start and rightind == stop:\n                        return node\n                raise IndexError(\"No appropriate subtree matches slice\")\n        if isinstance(index, type(0)):\n            return leaflist[index]\n        elif isinstance(index, type('')):\n            return leaflist[self._str_index_to_int(index)]\n        else:\n            raise TypeError('index must be integer, slice, or model name string')"},{"col":4,"comment":"\n        Convert the ``SpectralCoord`` to a `~astropy.units.Quantity`.\n        Equivalent to ``self.view(u.Quantity)``.\n\n        Returns\n        -------\n        `~astropy.units.Quantity`\n            This object viewed as a `~astropy.units.Quantity`.\n\n        ","endLoc":370,"header":"@property\n    def quantity(self)","id":4349,"name":"quantity","nodeType":"Function","startLoc":358,"text":"@property\n    def quantity(self):\n        \"\"\"\n        Convert the ``SpectralCoord`` to a `~astropy.units.Quantity`.\n        Equivalent to ``self.view(u.Quantity)``.\n\n        Returns\n        -------\n        `~astropy.units.Quantity`\n            This object viewed as a `~astropy.units.Quantity`.\n\n        \"\"\"\n        return self.view(u.Quantity)"},{"col":4,"comment":"\n        The coordinates of the observer.\n\n        If set, and a target is set as well, this will override any explicit\n        radial velocity passed in.\n\n        Returns\n        -------\n        `~astropy.coordinates.BaseCoordinateFrame`\n            The astropy coordinate frame representing the observation.\n        ","endLoc":385,"header":"@property\n    def observer(self)","id":4350,"name":"observer","nodeType":"Function","startLoc":372,"text":"@property\n    def observer(self):\n        \"\"\"\n        The coordinates of the observer.\n\n        If set, and a target is set as well, this will override any explicit\n        radial velocity passed in.\n\n        Returns\n        -------\n        `~astropy.coordinates.BaseCoordinateFrame`\n            The astropy coordinate frame representing the observation.\n        \"\"\"\n        return self._observer"},{"col":4,"comment":"null","endLoc":397,"header":"@observer.setter\n    def observer(self, value)","id":4351,"name":"observer","nodeType":"Function","startLoc":387,"text":"@observer.setter\n    def observer(self, value):\n\n        if self.observer is not None:\n            raise ValueError(\"observer has already been set\")\n\n        self._observer = self._validate_coordinate(value, label='observer')\n\n        # Switch to auto-computing radial velocity\n        if self._target is not None:\n            self._radial_velocity = None"},{"className":"BaseCoordinateFrame","col":0,"comment":"\n    The base class for coordinate frames.\n\n    This class is intended to be subclassed to create instances of specific\n    systems.  Subclasses can implement the following attributes:\n\n    * `default_representation`\n        A subclass of `~astropy.coordinates.BaseRepresentation` that will be\n        treated as the default representation of this frame.  This is the\n        representation assumed by default when the frame is created.\n\n    * `default_differential`\n        A subclass of `~astropy.coordinates.BaseDifferential` that will be\n        treated as the default differential class of this frame.  This is the\n        differential class assumed by default when the frame is created.\n\n    * `~astropy.coordinates.Attribute` class attributes\n       Frame attributes such as ``FK4.equinox`` or ``FK4.obstime`` are defined\n       using a descriptor class.  See the narrative documentation or\n       built-in classes code for details.\n\n    * `frame_specific_representation_info`\n        A dictionary mapping the name or class of a representation to a list of\n        `~astropy.coordinates.RepresentationMapping` objects that tell what\n        names and default units should be used on this frame for the components\n        of that representation.\n\n    Unless overridden via `frame_specific_representation_info`, velocity name\n    defaults are:\n\n      * ``pm_{lon}_cos{lat}``, ``pm_{lat}`` for `SphericalCosLatDifferential`\n        proper motion components\n      * ``pm_{lon}``, ``pm_{lat}`` for `SphericalDifferential` proper motion\n        components\n      * ``radial_velocity`` for any ``d_distance`` component\n      * ``v_{x,y,z}`` for `CartesianDifferential` velocity components\n\n    where ``{lon}`` and ``{lat}`` are the frame names of the angular components.\n    ","endLoc":1854,"id":4352,"nodeType":"Class","startLoc":171,"text":"@format_doc(base_doc, components=_components, footer=\"\")\nclass BaseCoordinateFrame(ShapedLikeNDArray):\n    \"\"\"\n    The base class for coordinate frames.\n\n    This class is intended to be subclassed to create instances of specific\n    systems.  Subclasses can implement the following attributes:\n\n    * `default_representation`\n        A subclass of `~astropy.coordinates.BaseRepresentation` that will be\n        treated as the default representation of this frame.  This is the\n        representation assumed by default when the frame is created.\n\n    * `default_differential`\n        A subclass of `~astropy.coordinates.BaseDifferential` that will be\n        treated as the default differential class of this frame.  This is the\n        differential class assumed by default when the frame is created.\n\n    * `~astropy.coordinates.Attribute` class attributes\n       Frame attributes such as ``FK4.equinox`` or ``FK4.obstime`` are defined\n       using a descriptor class.  See the narrative documentation or\n       built-in classes code for details.\n\n    * `frame_specific_representation_info`\n        A dictionary mapping the name or class of a representation to a list of\n        `~astropy.coordinates.RepresentationMapping` objects that tell what\n        names and default units should be used on this frame for the components\n        of that representation.\n\n    Unless overridden via `frame_specific_representation_info`, velocity name\n    defaults are:\n\n      * ``pm_{lon}_cos{lat}``, ``pm_{lat}`` for `SphericalCosLatDifferential`\n        proper motion components\n      * ``pm_{lon}``, ``pm_{lat}`` for `SphericalDifferential` proper motion\n        components\n      * ``radial_velocity`` for any ``d_distance`` component\n      * ``v_{x,y,z}`` for `CartesianDifferential` velocity components\n\n    where ``{lon}`` and ``{lat}`` are the frame names of the angular components.\n    \"\"\"\n\n    default_representation = None\n    default_differential = None\n\n    # Specifies special names and units for representation and differential\n    # attributes.\n    frame_specific_representation_info = {}\n\n    frame_attributes = {}\n    # Default empty frame_attributes dict\n\n    def __init_subclass__(cls, **kwargs):\n\n        # We first check for explicitly set values for these:\n        default_repr = getattr(cls, 'default_representation', None)\n        default_diff = getattr(cls, 'default_differential', None)\n        repr_info = getattr(cls, 'frame_specific_representation_info', None)\n        # Then, to make sure this works for subclasses-of-subclasses, we also\n        # have to check for cases where the attribute names have already been\n        # replaced by underscore-prefaced equivalents by the logic below:\n        if default_repr is None or isinstance(default_repr, property):\n            default_repr = getattr(cls, '_default_representation', None)\n\n        if default_diff is None or isinstance(default_diff, property):\n            default_diff = getattr(cls, '_default_differential', None)\n\n        if repr_info is None or isinstance(repr_info, property):\n            repr_info = getattr(cls, '_frame_specific_representation_info', None)\n\n        repr_info = cls._infer_repr_info(repr_info)\n\n        # Make read-only properties for the frame class attributes that should\n        # be read-only to make them immutable after creation.\n        # We copy attributes instead of linking to make sure there's no\n        # accidental cross-talk between classes\n        cls._create_readonly_property('default_representation', default_repr,\n                                      'Default representation for position data')\n        cls._create_readonly_property('default_differential', default_diff,\n                                      'Default representation for differential data '\n                                      '(e.g., velocity)')\n        cls._create_readonly_property('frame_specific_representation_info',\n                                      copy.deepcopy(repr_info),\n                                      'Mapping for frame-specific component names')\n\n        # Set the frame attributes. We first construct the attributes from\n        # superclasses, going in reverse order to keep insertion order,\n        # and then add any attributes from the frame now being defined\n        # (if any old definitions are overridden, this keeps the order).\n        # Note that we cannot simply start with the inherited frame_attributes\n        # since we could be a mixin between multiple coordinate frames.\n        # TODO: Should this be made to use readonly_prop_factory as well or\n        # would it be inconvenient for getting the frame_attributes from\n        # classes?\n        frame_attrs = {}\n        for basecls in reversed(cls.__bases__):\n            if issubclass(basecls, BaseCoordinateFrame):\n                frame_attrs.update(basecls.frame_attributes)\n\n        for k, v in cls.__dict__.items():\n            if isinstance(v, Attribute):\n                frame_attrs[k] = v\n\n        cls.frame_attributes = frame_attrs\n\n        # Deal with setting the name of the frame:\n        if not hasattr(cls, 'name'):\n            cls.name = cls.__name__.lower()\n        elif (BaseCoordinateFrame not in cls.__bases__ and\n                cls.name in [getattr(base, 'name', None)\n                             for base in cls.__bases__]):\n            # This may be a subclass of a subclass of BaseCoordinateFrame,\n            # like ICRS(BaseRADecFrame). In this case, cls.name will have been\n            # set by init_subclass\n            cls.name = cls.__name__.lower()\n\n        # A cache that *must be unique to each frame class* - it is\n        # insufficient to share them with superclasses, hence the need to put\n        # them in the meta\n        cls._frame_class_cache = {}\n\n        super().__init_subclass__(**kwargs)\n\n    def __init__(self, *args, copy=True, representation_type=None,\n                 differential_type=None, **kwargs):\n        self._attr_names_with_defaults = []\n\n        self._representation = self._infer_representation(representation_type, differential_type)\n        self._data = self._infer_data(args, copy, kwargs)  # possibly None.\n\n        # Set frame attributes, if any\n\n        values = {}\n        for fnm, fdefault in self.get_frame_attr_names().items():\n            # Read-only frame attributes are defined as FrameAttribute\n            # descriptors which are not settable, so set 'real' attributes as\n            # the name prefaced with an underscore.\n\n            if fnm in kwargs:\n                value = kwargs.pop(fnm)\n                setattr(self, '_' + fnm, value)\n                # Validate attribute by getting it. If the instance has data,\n                # this also checks its shape is OK. If not, we do it below.\n                values[fnm] = getattr(self, fnm)\n            else:\n                setattr(self, '_' + fnm, fdefault)\n                self._attr_names_with_defaults.append(fnm)\n\n        if kwargs:\n            raise TypeError(\n                f'Coordinate frame {self.__class__.__name__} got unexpected '\n                f'keywords: {list(kwargs)}')\n\n        # We do ``is None`` because self._data might evaluate to false for\n        # empty arrays or data == 0\n        if self._data is None:\n            # No data: we still need to check that any non-scalar attributes\n            # have consistent shapes. Collect them for all attributes with\n            # size > 1 (which should be array-like and thus have a shape).\n            shapes = {fnm: value.shape for fnm, value in values.items()\n                      if getattr(value, 'shape', ())}\n            if shapes:\n                if len(shapes) > 1:\n                    try:\n                        self._no_data_shape = check_broadcast(*shapes.values())\n                    except ValueError as err:\n                        raise ValueError(\n                            f\"non-scalar attributes with inconsistent shapes: {shapes}\") from err\n\n                    # Above, we checked that it is possible to broadcast all\n                    # shapes.  By getting and thus validating the attributes,\n                    # we verify that the attributes can in fact be broadcast.\n                    for fnm in shapes:\n                        getattr(self, fnm)\n                else:\n                    self._no_data_shape = shapes.popitem()[1]\n\n            else:\n                self._no_data_shape = ()\n\n        # The logic of this block is not related to the previous one\n        if self._data is not None:\n            # This makes the cache keys backwards-compatible, but also adds\n            # support for having differentials attached to the frame data\n            # representation object.\n            if 's' in self._data.differentials:\n                # TODO: assumes a velocity unit differential\n                key = (self._data.__class__.__name__,\n                       self._data.differentials['s'].__class__.__name__,\n                       False)\n            else:\n                key = (self._data.__class__.__name__, False)\n\n            # Set up representation cache.\n            self.cache['representation'][key] = self._data\n\n    def _infer_representation(self, representation_type, differential_type):\n        if representation_type is None and differential_type is None:\n            return {'base': self.default_representation, 's': self.default_differential}\n\n        if representation_type is None:\n            representation_type = self.default_representation\n\n        if (inspect.isclass(differential_type)\n                and issubclass(differential_type, r.BaseDifferential)):\n            # TODO: assumes the differential class is for the velocity\n            # differential\n            differential_type = {'s': differential_type}\n\n        elif isinstance(differential_type, str):\n            # TODO: assumes the differential class is for the velocity\n            # differential\n            diff_cls = r.DIFFERENTIAL_CLASSES[differential_type]\n            differential_type = {'s': diff_cls}\n\n        elif differential_type is None:\n            if representation_type == self.default_representation:\n                differential_type = {'s': self.default_differential}\n            else:\n                differential_type = {'s': 'base'}  # see set_representation_cls()\n\n        return _get_repr_classes(representation_type, **differential_type)\n\n    def _infer_data(self, args, copy, kwargs):\n        # if not set below, this is a frame with no data\n        representation_data = None\n        differential_data = None\n\n        args = list(args)  # need to be able to pop them\n        if (len(args) > 0) and (isinstance(args[0], r.BaseRepresentation) or\n                                args[0] is None):\n            representation_data = args.pop(0)  # This can still be None\n            if len(args) > 0:\n                raise TypeError(\n                    'Cannot create a frame with both a representation object '\n                    'and other positional arguments')\n\n            if representation_data is not None:\n                diffs = representation_data.differentials\n                differential_data = diffs.get('s', None)\n                if ((differential_data is None and len(diffs) > 0) or\n                        (differential_data is not None and len(diffs) > 1)):\n                    raise ValueError('Multiple differentials are associated '\n                                     'with the representation object passed in '\n                                     'to the frame initializer. Only a single '\n                                     'velocity differential is supported. Got: '\n                                     '{}'.format(diffs))\n\n        else:\n            representation_cls = self.get_representation_cls()\n            # Get any representation data passed in to the frame initializer\n            # using keyword or positional arguments for the component names\n            repr_kwargs = {}\n            for nmkw, nmrep in self.representation_component_names.items():\n                if len(args) > 0:\n                    # first gather up positional args\n                    repr_kwargs[nmrep] = args.pop(0)\n                elif nmkw in kwargs:\n                    repr_kwargs[nmrep] = kwargs.pop(nmkw)\n\n            # special-case the Spherical->UnitSpherical if no `distance`\n\n            if repr_kwargs:\n                # TODO: determine how to get rid of the part before the \"try\" -\n                # currently removing it has a performance regression for\n                # unitspherical because of the try-related overhead.\n                # Also frames have no way to indicate what the \"distance\" is\n                if repr_kwargs.get('distance', True) is None:\n                    del repr_kwargs['distance']\n\n                if (issubclass(representation_cls,\n                               r.SphericalRepresentation)\n                        and 'distance' not in repr_kwargs):\n                    representation_cls = representation_cls._unit_representation\n\n                try:\n                    representation_data = representation_cls(copy=copy,\n                                                             **repr_kwargs)\n                except TypeError as e:\n                    # this except clause is here to make the names of the\n                    # attributes more human-readable.  Without this the names\n                    # come from the representation instead of the frame's\n                    # attribute names.\n                    try:\n                        representation_data = (\n                            representation_cls._unit_representation(\n                                copy=copy, **repr_kwargs))\n                    except Exception:\n                        msg = str(e)\n                        names = self.get_representation_component_names()\n                        for frame_name, repr_name in names.items():\n                            msg = msg.replace(repr_name, frame_name)\n                        msg = msg.replace('__init__()',\n                                          f'{self.__class__.__name__}()')\n                        e.args = (msg,)\n                        raise e\n\n            # Now we handle the Differential data:\n            # Get any differential data passed in to the frame initializer\n            # using keyword or positional arguments for the component names\n            differential_cls = self.get_representation_cls('s')\n            diff_component_names = self.get_representation_component_names('s')\n            diff_kwargs = {}\n            for nmkw, nmrep in diff_component_names.items():\n                if len(args) > 0:\n                    # first gather up positional args\n                    diff_kwargs[nmrep] = args.pop(0)\n                elif nmkw in kwargs:\n                    diff_kwargs[nmrep] = kwargs.pop(nmkw)\n\n            if diff_kwargs:\n                if (hasattr(differential_cls, '_unit_differential')\n                        and 'd_distance' not in diff_kwargs):\n                    differential_cls = differential_cls._unit_differential\n\n                elif len(diff_kwargs) == 1 and 'd_distance' in diff_kwargs:\n                    differential_cls = r.RadialDifferential\n\n                try:\n                    differential_data = differential_cls(copy=copy,\n                                                         **diff_kwargs)\n                except TypeError as e:\n                    # this except clause is here to make the names of the\n                    # attributes more human-readable.  Without this the names\n                    # come from the representation instead of the frame's\n                    # attribute names.\n                    msg = str(e)\n                    names = self.get_representation_component_names('s')\n                    for frame_name, repr_name in names.items():\n                        msg = msg.replace(repr_name, frame_name)\n                    msg = msg.replace('__init__()',\n                                      f'{self.__class__.__name__}()')\n                    e.args = (msg,)\n                    raise\n\n        if len(args) > 0:\n            raise TypeError(\n                '{}.__init__ had {} remaining unhandled arguments'.format(\n                    self.__class__.__name__, len(args)))\n\n        if representation_data is None and differential_data is not None:\n            raise ValueError(\"Cannot pass in differential component data \"\n                             \"without positional (representation) data.\")\n\n        if differential_data:\n            # Check that differential data provided has units compatible\n            # with time-derivative of representation data.\n            # NOTE: there is no dimensionless time while lengths can be\n            # dimensionless (u.dimensionless_unscaled).\n            for comp in representation_data.components:\n                if (diff_comp := f'd_{comp}') in differential_data.components:\n                    current_repr_unit = representation_data._units[comp]\n                    current_diff_unit = differential_data._units[diff_comp]\n                    expected_unit = current_repr_unit / u.s\n                    if not current_diff_unit.is_equivalent(expected_unit):\n                        for key, val in self.get_representation_component_names().items():\n                            if val == comp:\n                                current_repr_name = key\n                                break\n                        for key, val in self.get_representation_component_names('s').items():\n                            if val == diff_comp:\n                                current_diff_name = key\n                                break\n                        raise ValueError(\n                            f'{current_repr_name} has unit \"{current_repr_unit}\" with physical '\n                            f'type \"{current_repr_unit.physical_type}\", but {current_diff_name} '\n                            f'has incompatible unit \"{current_diff_unit}\" with physical type '\n                            f'\"{current_diff_unit.physical_type}\" instead of the expected '\n                            f'\"{(expected_unit).physical_type}\".')\n\n            representation_data = representation_data.with_differentials({'s': differential_data})\n\n        return representation_data\n\n    @classmethod\n    def _infer_repr_info(cls, repr_info):\n        # Unless overridden via `frame_specific_representation_info`, velocity\n        # name defaults are (see also docstring for BaseCoordinateFrame):\n        #   * ``pm_{lon}_cos{lat}``, ``pm_{lat}`` for\n        #     `SphericalCosLatDifferential` proper motion components\n        #   * ``pm_{lon}``, ``pm_{lat}`` for `SphericalDifferential` proper\n        #     motion components\n        #   * ``radial_velocity`` for any `d_distance` component\n        #   * ``v_{x,y,z}`` for `CartesianDifferential` velocity components\n        # where `{lon}` and `{lat}` are the frame names of the angular\n        # components.\n        if repr_info is None:\n            repr_info = {}\n\n        # the tuple() call below is necessary because if it is not there,\n        # the iteration proceeds in a difficult-to-predict manner in the\n        # case that one of the class objects hash is such that it gets\n        # revisited by the iteration.  The tuple() call prevents this by\n        # making the items iterated over fixed regardless of how the dict\n        # changes\n        for cls_or_name in tuple(repr_info.keys()):\n            if isinstance(cls_or_name, str):\n                # TODO: this provides a layer of backwards compatibility in\n                # case the key is a string, but now we want explicit classes.\n                _cls = _get_repr_cls(cls_or_name)\n                repr_info[_cls] = repr_info.pop(cls_or_name)\n\n        # The default spherical names are 'lon' and 'lat'\n        repr_info.setdefault(r.SphericalRepresentation,\n                             [RepresentationMapping('lon', 'lon'),\n                              RepresentationMapping('lat', 'lat')])\n\n        sph_component_map = {m.reprname: m.framename\n                             for m in repr_info[r.SphericalRepresentation]}\n\n        repr_info.setdefault(r.SphericalCosLatDifferential, [\n            RepresentationMapping(\n                'd_lon_coslat',\n                'pm_{lon}_cos{lat}'.format(**sph_component_map),\n                u.mas/u.yr),\n            RepresentationMapping('d_lat',\n                                  'pm_{lat}'.format(**sph_component_map),\n                                  u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity',\n                                  u.km/u.s)\n        ])\n\n        repr_info.setdefault(r.SphericalDifferential, [\n            RepresentationMapping('d_lon',\n                                  'pm_{lon}'.format(**sph_component_map),\n                                  u.mas/u.yr),\n            RepresentationMapping('d_lat',\n                                  'pm_{lat}'.format(**sph_component_map),\n                                  u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity',\n                                  u.km/u.s)\n        ])\n\n        repr_info.setdefault(r.CartesianDifferential, [\n            RepresentationMapping('d_x', 'v_x', u.km/u.s),\n            RepresentationMapping('d_y', 'v_y', u.km/u.s),\n            RepresentationMapping('d_z', 'v_z', u.km/u.s)])\n\n        # Unit* classes should follow the same naming conventions\n        # TODO: this adds some unnecessary mappings for the Unit classes, so\n        # this could be cleaned up, but in practice doesn't seem to have any\n        # negative side effects\n        repr_info.setdefault(r.UnitSphericalRepresentation,\n                             repr_info[r.SphericalRepresentation])\n\n        repr_info.setdefault(r.UnitSphericalCosLatDifferential,\n                             repr_info[r.SphericalCosLatDifferential])\n\n        repr_info.setdefault(r.UnitSphericalDifferential,\n                             repr_info[r.SphericalDifferential])\n\n        return repr_info\n\n    @classmethod\n    def _create_readonly_property(cls, attr_name, value, doc=None):\n        private_attr = '_' + attr_name\n\n        def getter(self):\n            return getattr(self, private_attr)\n\n        setattr(cls, private_attr, value)\n        setattr(cls, attr_name, property(getter, doc=doc))\n\n    @lazyproperty\n    def cache(self):\n        \"\"\"\n        Cache for this frame, a dict.  It stores anything that should be\n        computed from the coordinate data (*not* from the frame attributes).\n        This can be used in functions to store anything that might be\n        expensive to compute but might be re-used by some other function.\n        E.g.::\n\n            if 'user_data' in myframe.cache:\n                data = myframe.cache['user_data']\n            else:\n                myframe.cache['user_data'] = data = expensive_func(myframe.lat)\n\n        If in-place modifications are made to the frame data, the cache should\n        be cleared::\n\n            myframe.cache.clear()\n\n        \"\"\"\n        return defaultdict(dict)\n\n    @property\n    def data(self):\n        \"\"\"\n        The coordinate data for this object.  If this frame has no data, an\n        `ValueError` will be raised.  Use `has_data` to\n        check if data is present on this frame object.\n        \"\"\"\n        if self._data is None:\n            raise ValueError('The frame object \"{!r}\" does not have '\n                             'associated data'.format(self))\n        return self._data\n\n    @property\n    def has_data(self):\n        \"\"\"\n        True if this frame has `data`, False otherwise.\n        \"\"\"\n        return self._data is not None\n\n    @property\n    def shape(self):\n        return self.data.shape if self.has_data else self._no_data_shape\n\n    # We have to override the ShapedLikeNDArray definitions, since our shape\n    # does not have to be that of the data.\n    def __len__(self):\n        return len(self.data)\n\n    def __bool__(self):\n        return self.has_data and self.size > 0\n\n    @property\n    def size(self):\n        return self.data.size\n\n    @property\n    def isscalar(self):\n        return self.has_data and self.data.isscalar\n\n    @classmethod\n    def get_frame_attr_names(cls):\n        return {name: getattr(cls, name)\n                for name in cls.frame_attributes}\n\n    def get_representation_cls(self, which='base'):\n        \"\"\"The class used for part of this frame's data.\n\n        Parameters\n        ----------\n        which : ('base', 's', `None`)\n            The class of which part to return.  'base' means the class used to\n            represent the coordinates; 's' the first derivative to time, i.e.,\n            the class representing the proper motion and/or radial velocity.\n            If `None`, return a dict with both.\n\n        Returns\n        -------\n        representation : `~astropy.coordinates.BaseRepresentation` or `~astropy.coordinates.BaseDifferential`.\n        \"\"\"\n        if which is not None:\n            return self._representation[which]\n        else:\n            return self._representation\n\n    def set_representation_cls(self, base=None, s='base'):\n        \"\"\"Set representation and/or differential class for this frame's data.\n\n        Parameters\n        ----------\n        base : str, `~astropy.coordinates.BaseRepresentation` subclass, optional\n            The name or subclass to use to represent the coordinate data.\n        s : `~astropy.coordinates.BaseDifferential` subclass, optional\n            The differential subclass to use to represent any velocities,\n            such as proper motion and radial velocity.  If equal to 'base',\n            which is the default, it will be inferred from the representation.\n            If `None`, the representation will drop any differentials.\n        \"\"\"\n        if base is None:\n            base = self._representation['base']\n        self._representation = _get_repr_classes(base=base, s=s)\n\n    representation_type = property(\n        fget=get_representation_cls, fset=set_representation_cls,\n        doc=\"\"\"The representation class used for this frame's data.\n\n        This will be a subclass from `~astropy.coordinates.BaseRepresentation`.\n        Can also be *set* using the string name of the representation. If you\n        wish to set an explicit differential class (rather than have it be\n        inferred), use the ``set_representation_cls`` method.\n        \"\"\")\n\n    @property\n    def differential_type(self):\n        \"\"\"\n        The differential used for this frame's data.\n\n        This will be a subclass from `~astropy.coordinates.BaseDifferential`.\n        For simultaneous setting of representation and differentials, see the\n        ``set_representation_cls`` method.\n        \"\"\"\n        return self.get_representation_cls('s')\n\n    @differential_type.setter\n    def differential_type(self, value):\n        self.set_representation_cls(s=value)\n\n    @classmethod\n    def _get_representation_info(cls):\n        # This exists as a class method only to support handling frame inputs\n        # without units, which are deprecated and will be removed.  This can be\n        # moved into the representation_info property at that time.\n        # note that if so moved, the cache should be acceessed as\n        # self.__class__._frame_class_cache\n\n        if cls._frame_class_cache.get('last_reprdiff_hash', None) != r.get_reprdiff_cls_hash():\n            repr_attrs = {}\n            for repr_diff_cls in (list(r.REPRESENTATION_CLASSES.values()) +\n                                  list(r.DIFFERENTIAL_CLASSES.values())):\n                repr_attrs[repr_diff_cls] = {'names': [], 'units': []}\n                for c, c_cls in repr_diff_cls.attr_classes.items():\n                    repr_attrs[repr_diff_cls]['names'].append(c)\n                    rec_unit = u.deg if issubclass(c_cls, Angle) else None\n                    repr_attrs[repr_diff_cls]['units'].append(rec_unit)\n\n            for repr_diff_cls, mappings in cls._frame_specific_representation_info.items():\n\n                # take the 'names' and 'units' tuples from repr_attrs,\n                # and then use the RepresentationMapping objects\n                # to update as needed for this frame.\n                nms = repr_attrs[repr_diff_cls]['names']\n                uns = repr_attrs[repr_diff_cls]['units']\n                comptomap = dict([(m.reprname, m) for m in mappings])\n                for i, c in enumerate(repr_diff_cls.attr_classes.keys()):\n                    if c in comptomap:\n                        mapp = comptomap[c]\n                        nms[i] = mapp.framename\n\n                        # need the isinstance because otherwise if it's a unit it\n                        # will try to compare to the unit string representation\n                        if not (isinstance(mapp.defaultunit, str)\n                                and mapp.defaultunit == 'recommended'):\n                            uns[i] = mapp.defaultunit\n                            # else we just leave it as recommended_units says above\n\n                # Convert to tuples so that this can't mess with frame internals\n                repr_attrs[repr_diff_cls]['names'] = tuple(nms)\n                repr_attrs[repr_diff_cls]['units'] = tuple(uns)\n\n            cls._frame_class_cache['representation_info'] = repr_attrs\n            cls._frame_class_cache['last_reprdiff_hash'] = r.get_reprdiff_cls_hash()\n        return cls._frame_class_cache['representation_info']\n\n    @lazyproperty\n    def representation_info(self):\n        \"\"\"\n        A dictionary with the information of what attribute names for this frame\n        apply to particular representations.\n        \"\"\"\n        return self._get_representation_info()\n\n    def get_representation_component_names(self, which='base'):\n        out = {}\n        repr_or_diff_cls = self.get_representation_cls(which)\n        if repr_or_diff_cls is None:\n            return out\n        data_names = repr_or_diff_cls.attr_classes.keys()\n        repr_names = self.representation_info[repr_or_diff_cls]['names']\n        for repr_name, data_name in zip(repr_names, data_names):\n            out[repr_name] = data_name\n        return out\n\n    def get_representation_component_units(self, which='base'):\n        out = {}\n        repr_or_diff_cls = self.get_representation_cls(which)\n        if repr_or_diff_cls is None:\n            return out\n        repr_attrs = self.representation_info[repr_or_diff_cls]\n        repr_names = repr_attrs['names']\n        repr_units = repr_attrs['units']\n        for repr_name, repr_unit in zip(repr_names, repr_units):\n            if repr_unit:\n                out[repr_name] = repr_unit\n        return out\n\n    representation_component_names = property(get_representation_component_names)\n\n    representation_component_units = property(get_representation_component_units)\n\n    def _replicate(self, data, copy=False, **kwargs):\n        \"\"\"Base for replicating a frame, with possibly different attributes.\n\n        Produces a new instance of the frame using the attributes of the old\n        frame (unless overridden) and with the data given.\n\n        Parameters\n        ----------\n        data : `~astropy.coordinates.BaseRepresentation` or None\n            Data to use in the new frame instance.  If `None`, it will be\n            a data-less frame.\n        copy : bool, optional\n            Whether data and the attributes on the old frame should be copied\n            (default), or passed on by reference.\n        **kwargs\n            Any attributes that should be overridden.\n        \"\"\"\n        # This is to provide a slightly nicer error message if the user tries\n        # to use frame_obj.representation instead of frame_obj.data to get the\n        # underlying representation object [e.g., #2890]\n        if inspect.isclass(data):\n            raise TypeError('Class passed as data instead of a representation '\n                            'instance. If you called frame.representation, this'\n                            ' returns the representation class. frame.data '\n                            'returns the instantiated object - you may want to '\n                            ' use this instead.')\n        if copy and data is not None:\n            data = data.copy()\n\n        for attr in self.get_frame_attr_names():\n            if (attr not in self._attr_names_with_defaults\n                    and attr not in kwargs):\n                value = getattr(self, attr)\n                if copy:\n                    value = value.copy()\n\n                kwargs[attr] = value\n\n        return self.__class__(data, copy=False, **kwargs)\n\n    def replicate(self, copy=False, **kwargs):\n        \"\"\"\n        Return a replica of the frame, optionally with new frame attributes.\n\n        The replica is a new frame object that has the same data as this frame\n        object and with frame attributes overridden if they are provided as extra\n        keyword arguments to this method. If ``copy`` is set to `True` then a\n        copy of the internal arrays will be made.  Otherwise the replica will\n        use a reference to the original arrays when possible to save memory. The\n        internal arrays are normally not changeable by the user so in most cases\n        it should not be necessary to set ``copy`` to `True`.\n\n        Parameters\n        ----------\n        copy : bool, optional\n            If True, the resulting object is a copy of the data.  When False,\n            references are used where  possible. This rule also applies to the\n            frame attributes.\n\n        Any additional keywords are treated as frame attributes to be set on the\n        new frame object.\n\n        Returns\n        -------\n        frameobj : `BaseCoordinateFrame` subclass instance\n            Replica of this object, but possibly with new frame attributes.\n        \"\"\"\n        return self._replicate(self.data, copy=copy, **kwargs)\n\n    def replicate_without_data(self, copy=False, **kwargs):\n        \"\"\"\n        Return a replica without data, optionally with new frame attributes.\n\n        The replica is a new frame object without data but with the same frame\n        attributes as this object, except where overridden by extra keyword\n        arguments to this method.  The ``copy`` keyword determines if the frame\n        attributes are truly copied vs being references (which saves memory for\n        cases where frame attributes are large).\n\n        This method is essentially the converse of `realize_frame`.\n\n        Parameters\n        ----------\n        copy : bool, optional\n            If True, the resulting object has copies of the frame attributes.\n            When False, references are used where  possible.\n\n        Any additional keywords are treated as frame attributes to be set on the\n        new frame object.\n\n        Returns\n        -------\n        frameobj : `BaseCoordinateFrame` subclass instance\n            Replica of this object, but without data and possibly with new frame\n            attributes.\n        \"\"\"\n        return self._replicate(None, copy=copy, **kwargs)\n\n    def realize_frame(self, data, **kwargs):\n        \"\"\"\n        Generates a new frame with new data from another frame (which may or\n        may not have data). Roughly speaking, the converse of\n        `replicate_without_data`.\n\n        Parameters\n        ----------\n        data : `~astropy.coordinates.BaseRepresentation`\n            The representation to use as the data for the new frame.\n\n        Any additional keywords are treated as frame attributes to be set on the\n        new frame object. In particular, `representation_type` can be specified.\n\n        Returns\n        -------\n        frameobj : `BaseCoordinateFrame` subclass instance\n            A new object in *this* frame, with the same frame attributes as\n            this one, but with the ``data`` as the coordinate data.\n\n        \"\"\"\n        return self._replicate(data, **kwargs)\n\n    def represent_as(self, base, s='base', in_frame_units=False):\n        \"\"\"\n        Generate and return a new representation of this frame's `data`\n        as a Representation object.\n\n        Note: In order to make an in-place change of the representation\n        of a Frame or SkyCoord object, set the ``representation``\n        attribute of that object to the desired new representation, or\n        use the ``set_representation_cls`` method to also set the differential.\n\n        Parameters\n        ----------\n        base : subclass of BaseRepresentation or string\n            The type of representation to generate.  Must be a *class*\n            (not an instance), or the string name of the representation\n            class.\n        s : subclass of `~astropy.coordinates.BaseDifferential`, str, optional\n            Class in which any velocities should be represented. Must be\n            a *class* (not an instance), or the string name of the\n            differential class.  If equal to 'base' (default), inferred from\n            the base class.  If `None`, all velocity information is dropped.\n        in_frame_units : bool, keyword-only\n            Force the representation units to match the specified units\n            particular to this frame\n\n        Returns\n        -------\n        newrep : BaseRepresentation-derived object\n            A new representation object of this frame's `data`.\n\n        Raises\n        ------\n        AttributeError\n            If this object had no `data`\n\n        Examples\n        --------\n        >>> from astropy import units as u\n        >>> from astropy.coordinates import SkyCoord, CartesianRepresentation\n        >>> coord = SkyCoord(0*u.deg, 0*u.deg)\n        >>> coord.represent_as(CartesianRepresentation)  # doctest: +FLOAT_CMP\n        <CartesianRepresentation (x, y, z) [dimensionless]\n                (1., 0., 0.)>\n\n        >>> coord.representation_type = CartesianRepresentation\n        >>> coord  # doctest: +FLOAT_CMP\n        <SkyCoord (ICRS): (x, y, z) [dimensionless]\n            (1., 0., 0.)>\n        \"\"\"\n\n        # For backwards compatibility (because in_frame_units used to be the\n        # 2nd argument), we check to see if `new_differential` is a boolean. If\n        # it is, we ignore the value of `new_differential` and warn about the\n        # position change\n        if isinstance(s, bool):\n            warnings.warn(\"The argument position for `in_frame_units` in \"\n                          \"`represent_as` has changed. Use as a keyword \"\n                          \"argument if needed.\", AstropyWarning)\n            in_frame_units = s\n            s = 'base'\n\n        # In the future, we may want to support more differentials, in which\n        # case one probably needs to define **kwargs above and use it here.\n        # But for now, we only care about the velocity.\n        repr_classes = _get_repr_classes(base=base, s=s)\n        representation_cls = repr_classes['base']\n        # We only keep velocity information\n        if 's' in self.data.differentials:\n            # For the default 'base' option in which _get_repr_classes has\n            # given us a best guess based on the representation class, we only\n            # use it if the class we had already is incompatible.\n            if (s == 'base'\n                and (self.data.differentials['s'].__class__\n                     in representation_cls._compatible_differentials)):\n                differential_cls = self.data.differentials['s'].__class__\n            else:\n                differential_cls = repr_classes['s']\n        elif s is None or s == 'base':\n            differential_cls = None\n        else:\n            raise TypeError('Frame data has no associated differentials '\n                            '(i.e. the frame has no velocity data) - '\n                            'represent_as() only accepts a new '\n                            'representation.')\n\n        if differential_cls:\n            cache_key = (representation_cls.__name__,\n                         differential_cls.__name__, in_frame_units)\n        else:\n            cache_key = (representation_cls.__name__, in_frame_units)\n\n        cached_repr = self.cache['representation'].get(cache_key)\n        if not cached_repr:\n            if differential_cls:\n                # Sanity check to ensure we do not just drop radial\n                # velocity.  TODO: should Representation.represent_as\n                # allow this transformation in the first place?\n                if (isinstance(self.data, r.UnitSphericalRepresentation)\n                    and issubclass(representation_cls, r.CartesianRepresentation)\n                    and not isinstance(self.data.differentials['s'],\n                                       (r.UnitSphericalDifferential,\n                                        r.UnitSphericalCosLatDifferential,\n                                        r.RadialDifferential))):\n                    raise u.UnitConversionError(\n                        'need a distance to retrieve a cartesian representation '\n                        'when both radial velocity and proper motion are present, '\n                        'since otherwise the units cannot match.')\n\n                # TODO NOTE: only supports a single differential\n                data = self.data.represent_as(representation_cls,\n                                              differential_cls)\n                diff = data.differentials['s']  # TODO: assumes velocity\n            else:\n                data = self.data.represent_as(representation_cls)\n\n            # If the new representation is known to this frame and has a defined\n            # set of names and units, then use that.\n            new_attrs = self.representation_info.get(representation_cls)\n            if new_attrs and in_frame_units:\n                datakwargs = dict((comp, getattr(data, comp))\n                                  for comp in data.components)\n                for comp, new_attr_unit in zip(data.components, new_attrs['units']):\n                    if new_attr_unit:\n                        datakwargs[comp] = datakwargs[comp].to(new_attr_unit)\n                data = data.__class__(copy=False, **datakwargs)\n\n            if differential_cls:\n                # the original differential\n                data_diff = self.data.differentials['s']\n\n                # If the new differential is known to this frame and has a\n                # defined set of names and units, then use that.\n                new_attrs = self.representation_info.get(differential_cls)\n                if new_attrs and in_frame_units:\n                    diffkwargs = dict((comp, getattr(diff, comp))\n                                      for comp in diff.components)\n                    for comp, new_attr_unit in zip(diff.components,\n                                                   new_attrs['units']):\n                        # Some special-casing to treat a situation where the\n                        # input data has a UnitSphericalDifferential or a\n                        # RadialDifferential. It is re-represented to the\n                        # frame's differential class (which might be, e.g., a\n                        # dimensional Differential), so we don't want to try to\n                        # convert the empty component units\n                        if (isinstance(data_diff,\n                                       (r.UnitSphericalDifferential,\n                                        r.UnitSphericalCosLatDifferential))\n                                and comp not in data_diff.__class__.attr_classes):\n                            continue\n\n                        elif (isinstance(data_diff, r.RadialDifferential)\n                              and comp not in data_diff.__class__.attr_classes):\n                            continue\n\n                        # Try to convert to requested units. Since that might\n                        # not be possible (e.g., for a coordinate with proper\n                        # motion but without distance, one cannot convert to a\n                        # cartesian differential in km/s), we allow the unit\n                        # conversion to fail.  See gh-7028 for discussion.\n                        if new_attr_unit and hasattr(diff, comp):\n                            try:\n                                diffkwargs[comp] = diffkwargs[comp].to(new_attr_unit)\n                            except Exception:\n                                pass\n\n                    diff = diff.__class__(copy=False, **diffkwargs)\n\n                    # Here we have to bypass using with_differentials() because\n                    # it has a validation check. But because\n                    # .representation_type and .differential_type don't point to\n                    # the original classes, if the input differential is a\n                    # RadialDifferential, it usually gets turned into a\n                    # SphericalCosLatDifferential (or whatever the default is)\n                    # with strange units for the d_lon and d_lat attributes.\n                    # This then causes the dictionary key check to fail (i.e.\n                    # comparison against `diff._get_deriv_key()`)\n                    data._differentials.update({'s': diff})\n\n            self.cache['representation'][cache_key] = data\n\n        return self.cache['representation'][cache_key]\n\n    def transform_to(self, new_frame):\n        \"\"\"\n        Transform this object's coordinate data to a new frame.\n\n        Parameters\n        ----------\n        new_frame : coordinate-like or `BaseCoordinateFrame` subclass instance\n            The frame to transform this coordinate frame into.\n            The frame class option is deprecated.\n\n        Returns\n        -------\n        transframe : coordinate-like\n            A new object with the coordinate data represented in the\n            ``newframe`` system.\n\n        Raises\n        ------\n        ValueError\n            If there is no possible transformation route.\n        \"\"\"\n        from .errors import ConvertError\n\n        if self._data is None:\n            raise ValueError('Cannot transform a frame with no data')\n\n        if (getattr(self.data, 'differentials', None)\n                and hasattr(self, 'obstime') and hasattr(new_frame, 'obstime')\n                and np.any(self.obstime != new_frame.obstime)):\n            raise NotImplementedError('You cannot transform a frame that has '\n                                      'velocities to another frame at a '\n                                      'different obstime. If you think this '\n                                      'should (or should not) be possible, '\n                                      'please comment at https://github.com/astropy/astropy/issues/6280')\n\n        if inspect.isclass(new_frame):\n            warnings.warn(\"Transforming a frame instance to a frame class (as opposed to another \"\n                          \"frame instance) will not be supported in the future.  Either \"\n                          \"explicitly instantiate the target frame, or first convert the source \"\n                          \"frame instance to a `astropy.coordinates.SkyCoord` and use its \"\n                          \"`transform_to()` method.\",\n                          AstropyDeprecationWarning)\n            # Use the default frame attributes for this class\n            new_frame = new_frame()\n\n        if hasattr(new_frame, '_sky_coord_frame'):\n            # Input new_frame is not a frame instance or class and is most\n            # likely a SkyCoord object.\n            new_frame = new_frame._sky_coord_frame\n\n        trans = frame_transform_graph.get_transform(self.__class__,\n                                                    new_frame.__class__)\n        if trans is None:\n            if new_frame is self.__class__:\n                # no special transform needed, but should update frame info\n                return new_frame.realize_frame(self.data)\n            msg = 'Cannot transform from {0} to {1}'\n            raise ConvertError(msg.format(self.__class__, new_frame.__class__))\n        return trans(self, new_frame)\n\n    def is_transformable_to(self, new_frame):\n        \"\"\"\n        Determines if this coordinate frame can be transformed to another\n        given frame.\n\n        Parameters\n        ----------\n        new_frame : `BaseCoordinateFrame` subclass or instance\n            The proposed frame to transform into.\n\n        Returns\n        -------\n        transformable : bool or str\n            `True` if this can be transformed to ``new_frame``, `False` if\n            not, or the string 'same' if ``new_frame`` is the same system as\n            this object but no transformation is defined.\n\n        Notes\n        -----\n        A return value of 'same' means the transformation will work, but it will\n        just give back a copy of this object.  The intended usage is::\n\n            if coord.is_transformable_to(some_unknown_frame):\n                coord2 = coord.transform_to(some_unknown_frame)\n\n        This will work even if ``some_unknown_frame``  turns out to be the same\n        frame class as ``coord``.  This is intended for cases where the frame\n        is the same regardless of the frame attributes (e.g. ICRS), but be\n        aware that it *might* also indicate that someone forgot to define the\n        transformation between two objects of the same frame class but with\n        different attributes.\n        \"\"\"\n        new_frame_cls = new_frame if inspect.isclass(new_frame) else new_frame.__class__\n        trans = frame_transform_graph.get_transform(self.__class__, new_frame_cls)\n\n        if trans is None:\n            if new_frame_cls is self.__class__:\n                return 'same'\n            else:\n                return False\n        else:\n            return True\n\n    def is_frame_attr_default(self, attrnm):\n        \"\"\"\n        Determine whether or not a frame attribute has its value because it's\n        the default value, or because this frame was created with that value\n        explicitly requested.\n\n        Parameters\n        ----------\n        attrnm : str\n            The name of the attribute to check.\n\n        Returns\n        -------\n        isdefault : bool\n            True if the attribute ``attrnm`` has its value by default, False if\n            it was specified at creation of this frame.\n        \"\"\"\n        return attrnm in self._attr_names_with_defaults\n\n    @staticmethod\n    def _frameattr_equiv(left_fattr, right_fattr):\n        \"\"\"\n        Determine if two frame attributes are equivalent.  Implemented as a\n        staticmethod mainly as a convenient location, although conceivable it\n        might be desirable for subclasses to override this behavior.\n\n        Primary purpose is to check for equality of representations.  This\n        aspect can actually be simplified/removed now that representations have\n        equality defined.\n\n        Secondary purpose is to check for equality of coordinate attributes,\n        which first checks whether they themselves are in equivalent frames\n        before checking for equality in the normal fashion.  This is because\n        checking for equality with non-equivalent frames raises an error.\n        \"\"\"\n        if left_fattr is right_fattr:\n            # shortcut if it's exactly the same object\n            return True\n        elif left_fattr is None or right_fattr is None:\n            # shortcut if one attribute is unspecified and the other isn't\n            return False\n\n        left_is_repr = isinstance(left_fattr, r.BaseRepresentationOrDifferential)\n        right_is_repr = isinstance(right_fattr, r.BaseRepresentationOrDifferential)\n        if left_is_repr and right_is_repr:\n            # both are representations.\n            if (getattr(left_fattr, 'differentials', False) or\n                    getattr(right_fattr, 'differentials', False)):\n                warnings.warn('Two representation frame attributes were '\n                              'checked for equivalence when at least one of'\n                              ' them has differentials.  This yields False '\n                              'even if the underlying representations are '\n                              'equivalent (although this may change in '\n                              'future versions of Astropy)', AstropyWarning)\n                return False\n            if isinstance(right_fattr, left_fattr.__class__):\n                # if same representation type, compare components.\n                return np.all([(getattr(left_fattr, comp) ==\n                                getattr(right_fattr, comp))\n                               for comp in left_fattr.components])\n            else:\n                # convert to cartesian and see if they match\n                return np.all(left_fattr.to_cartesian().xyz ==\n                              right_fattr.to_cartesian().xyz)\n        elif left_is_repr or right_is_repr:\n            return False\n\n        left_is_coord = isinstance(left_fattr, BaseCoordinateFrame)\n        right_is_coord = isinstance(right_fattr, BaseCoordinateFrame)\n        if left_is_coord and right_is_coord:\n            # both are coordinates\n            if left_fattr.is_equivalent_frame(right_fattr):\n                return np.all(left_fattr == right_fattr)\n            else:\n                return False\n        elif left_is_coord or right_is_coord:\n            return False\n\n        return np.all(left_fattr == right_fattr)\n\n    def is_equivalent_frame(self, other):\n        \"\"\"\n        Checks if this object is the same frame as the ``other`` object.\n\n        To be the same frame, two objects must be the same frame class and have\n        the same frame attributes.  Note that it does *not* matter what, if any,\n        data either object has.\n\n        Parameters\n        ----------\n        other : :class:`~astropy.coordinates.BaseCoordinateFrame`\n            the other frame to check\n\n        Returns\n        -------\n        isequiv : bool\n            True if the frames are the same, False if not.\n\n        Raises\n        ------\n        TypeError\n            If ``other`` isn't a `BaseCoordinateFrame` or subclass.\n        \"\"\"\n        if self.__class__ == other.__class__:\n            for frame_attr_name in self.get_frame_attr_names():\n                if not self._frameattr_equiv(getattr(self, frame_attr_name),\n                                             getattr(other, frame_attr_name)):\n                    return False\n            return True\n        elif not isinstance(other, BaseCoordinateFrame):\n            raise TypeError(\"Tried to do is_equivalent_frame on something that \"\n                            \"isn't a frame\")\n        else:\n            return False\n\n    def __repr__(self):\n        frameattrs = self._frame_attrs_repr()\n        data_repr = self._data_repr()\n\n        if frameattrs:\n            frameattrs = f' ({frameattrs})'\n\n        if data_repr:\n            return f'<{self.__class__.__name__} Coordinate{frameattrs}: {data_repr}>'\n        else:\n            return f'<{self.__class__.__name__} Frame{frameattrs}>'\n\n    def _data_repr(self):\n        \"\"\"Returns a string representation of the coordinate data.\"\"\"\n\n        if not self.has_data:\n            return ''\n\n        if self.representation_type:\n            if (hasattr(self.representation_type, '_unit_representation')\n                    and isinstance(self.data,\n                                   self.representation_type._unit_representation)):\n                rep_cls = self.data.__class__\n            else:\n                rep_cls = self.representation_type\n\n            if 's' in self.data.differentials:\n                dif_cls = self.get_representation_cls('s')\n                dif_data = self.data.differentials['s']\n                if isinstance(dif_data, (r.UnitSphericalDifferential,\n                                         r.UnitSphericalCosLatDifferential,\n                                         r.RadialDifferential)):\n                    dif_cls = dif_data.__class__\n\n            else:\n                dif_cls = None\n\n            data = self.represent_as(rep_cls, dif_cls, in_frame_units=True)\n\n            data_repr = repr(data)\n            # Generate the list of component names out of the repr string\n            part1, _, remainder = data_repr.partition('(')\n            if remainder != '':\n                comp_str, _, part2 = remainder.partition(')')\n                comp_names = comp_str.split(', ')\n                # Swap in frame-specific component names\n                invnames = dict([(nmrepr, nmpref) for nmpref, nmrepr\n                                 in self.representation_component_names.items()])\n                for i, name in enumerate(comp_names):\n                    comp_names[i] = invnames.get(name, name)\n                # Reassemble the repr string\n                data_repr = part1 + '(' + ', '.join(comp_names) + ')' + part2\n\n        else:\n            data = self.data\n            data_repr = repr(self.data)\n\n        if data_repr.startswith('<' + data.__class__.__name__):\n            # remove both the leading \"<\" and the space after the name, as well\n            # as the trailing \">\"\n            data_repr = data_repr[(len(data.__class__.__name__) + 2):-1]\n        else:\n            data_repr = 'Data:\\n' + data_repr\n\n        if 's' in self.data.differentials:\n            data_repr_spl = data_repr.split('\\n')\n            if 'has differentials' in data_repr_spl[-1]:\n                diffrepr = repr(data.differentials['s']).split('\\n')\n                if diffrepr[0].startswith('<'):\n                    diffrepr[0] = ' ' + ' '.join(diffrepr[0].split(' ')[1:])\n                for frm_nm, rep_nm in self.get_representation_component_names('s').items():\n                    diffrepr[0] = diffrepr[0].replace(rep_nm, frm_nm)\n                if diffrepr[-1].endswith('>'):\n                    diffrepr[-1] = diffrepr[-1][:-1]\n                data_repr_spl[-1] = '\\n'.join(diffrepr)\n\n            data_repr = '\\n'.join(data_repr_spl)\n\n        return data_repr\n\n    def _frame_attrs_repr(self):\n        \"\"\"\n        Returns a string representation of the frame's attributes, if any.\n        \"\"\"\n        attr_strs = []\n        for attribute_name in self.get_frame_attr_names():\n            attr = getattr(self, attribute_name)\n            # Check to see if this object has a way of representing itself\n            # specific to being an attribute of a frame. (Note, this is not the\n            # Attribute class, it's the actual object).\n            if hasattr(attr, \"_astropy_repr_in_frame\"):\n                attrstr = attr._astropy_repr_in_frame()\n            else:\n                attrstr = str(attr)\n            attr_strs.append(f\"{attribute_name}={attrstr}\")\n\n        return ', '.join(attr_strs)\n\n    def _apply(self, method, *args, **kwargs):\n        \"\"\"Create a new instance, applying a method to the underlying data.\n\n        In typical usage, the method is any of the shape-changing methods for\n        `~numpy.ndarray` (``reshape``, ``swapaxes``, etc.), as well as those\n        picking particular elements (``__getitem__``, ``take``, etc.), which\n        are all defined in `~astropy.utils.shapes.ShapedLikeNDArray`. It will be\n        applied to the underlying arrays in the representation (e.g., ``x``,\n        ``y``, and ``z`` for `~astropy.coordinates.CartesianRepresentation`),\n        as well as to any frame attributes that have a shape, with the results\n        used to create a new instance.\n\n        Internally, it is also used to apply functions to the above parts\n        (in particular, `~numpy.broadcast_to`).\n\n        Parameters\n        ----------\n        method : str or callable\n            If str, it is the name of a method that is applied to the internal\n            ``components``. If callable, the function is applied.\n        *args : tuple\n            Any positional arguments for ``method``.\n        **kwargs : dict\n            Any keyword arguments for ``method``.\n        \"\"\"\n        def apply_method(value):\n            if isinstance(value, ShapedLikeNDArray):\n                return value._apply(method, *args, **kwargs)\n            else:\n                if callable(method):\n                    return method(value, *args, **kwargs)\n                else:\n                    return getattr(value, method)(*args, **kwargs)\n\n        new = super().__new__(self.__class__)\n        if hasattr(self, '_representation'):\n            new._representation = self._representation.copy()\n        new._attr_names_with_defaults = self._attr_names_with_defaults.copy()\n\n        for attr in self.frame_attributes:\n            _attr = '_' + attr\n            if attr in self._attr_names_with_defaults:\n                setattr(new, _attr, getattr(self, _attr))\n            else:\n                value = getattr(self, _attr)\n                if getattr(value, 'shape', ()):\n                    value = apply_method(value)\n                elif method == 'copy' or method == 'flatten':\n                    # flatten should copy also for a single element array, but\n                    # we cannot use it directly for array scalars, since it\n                    # always returns a one-dimensional array. So, just copy.\n                    value = copy.copy(value)\n\n                setattr(new, _attr, value)\n\n        if self.has_data:\n            new._data = apply_method(self.data)\n        else:\n            new._data = None\n            shapes = [getattr(new, '_' + attr).shape\n                      for attr in new.frame_attributes\n                      if (attr not in new._attr_names_with_defaults\n                          and getattr(getattr(new, '_' + attr), 'shape', ()))]\n            if shapes:\n                new._no_data_shape = (check_broadcast(*shapes)\n                                      if len(shapes) > 1 else shapes[0])\n            else:\n                new._no_data_shape = ()\n\n        return new\n\n    def __setitem__(self, item, value):\n        if self.__class__ is not value.__class__:\n            raise TypeError(f'can only set from object of same class: '\n                            f'{self.__class__.__name__} vs. '\n                            f'{value.__class__.__name__}')\n\n        if not self.is_equivalent_frame(value):\n            raise ValueError('can only set frame item from an equivalent frame')\n\n        if value._data is None:\n            raise ValueError('can only set frame with value that has data')\n\n        if self._data is None:\n            raise ValueError('cannot set frame which has no data')\n\n        if self.shape == ():\n            raise TypeError(f\"scalar '{self.__class__.__name__}' frame object \"\n                            f\"does not support item assignment\")\n\n        if self._data is None:\n            raise ValueError('can only set frame if it has data')\n\n        if self._data.__class__ is not value._data.__class__:\n            raise TypeError(f'can only set from object of same class: '\n                            f'{self._data.__class__.__name__} vs. '\n                            f'{value._data.__class__.__name__}')\n\n        if self._data._differentials:\n            # Can this ever occur? (Same class but different differential keys).\n            # This exception is not tested since it is not clear how to generate it.\n            if self._data._differentials.keys() != value._data._differentials.keys():\n                raise ValueError(f'setitem value must have same differentials')\n\n            for key, self_diff in self._data._differentials.items():\n                if self_diff.__class__ is not value._data._differentials[key].__class__:\n                    raise TypeError(f'can only set from object of same class: '\n                                    f'{self_diff.__class__.__name__} vs. '\n                                    f'{value._data._differentials[key].__class__.__name__}')\n\n        # Set representation data\n        self._data[item] = value._data\n\n        # Frame attributes required to be identical by is_equivalent_frame,\n        # no need to set them here.\n\n        self.cache.clear()\n\n    @override__dir__\n    def __dir__(self):\n        \"\"\"\n        Override the builtin `dir` behavior to include representation\n        names.\n\n        TODO: dynamic representation transforms (i.e. include cylindrical et al.).\n        \"\"\"\n        dir_values = set(self.representation_component_names)\n        dir_values |= set(self.get_representation_component_names('s'))\n\n        return dir_values\n\n    def __getattr__(self, attr):\n        \"\"\"\n        Allow access to attributes on the representation and differential as\n        found via ``self.get_representation_component_names``.\n\n        TODO: We should handle dynamic representation transforms here (e.g.,\n        `.cylindrical`) instead of defining properties as below.\n        \"\"\"\n\n        # attr == '_representation' is likely from the hasattr() test in the\n        # representation property which is used for\n        # self.representation_component_names.\n        #\n        # Prevent infinite recursion here.\n        if attr.startswith('_'):\n            return self.__getattribute__(attr)  # Raise AttributeError.\n\n        repr_names = self.representation_component_names\n        if attr in repr_names:\n            if self._data is None:\n                self.data  # this raises the \"no data\" error by design - doing it\n                # this way means we don't have to replicate the error message here\n\n            rep = self.represent_as(self.representation_type,\n                                    in_frame_units=True)\n            val = getattr(rep, repr_names[attr])\n            return val\n\n        diff_names = self.get_representation_component_names('s')\n        if attr in diff_names:\n            if self._data is None:\n                self.data  # see above.\n            # TODO: this doesn't work for the case when there is only\n            # unitspherical information. The differential_type gets set to the\n            # default_differential, which expects full information, so the\n            # units don't work out\n            rep = self.represent_as(in_frame_units=True,\n                                    **self.get_representation_cls(None))\n            val = getattr(rep.differentials['s'], diff_names[attr])\n            return val\n\n        return self.__getattribute__(attr)  # Raise AttributeError.\n\n    def __setattr__(self, attr, value):\n        # Don't slow down access of private attributes!\n        if not attr.startswith('_'):\n            if hasattr(self, 'representation_info'):\n                repr_attr_names = set()\n                for representation_attr in self.representation_info.values():\n                    repr_attr_names.update(representation_attr['names'])\n\n                if attr in repr_attr_names:\n                    raise AttributeError(\n                        f'Cannot set any frame attribute {attr}')\n\n        super().__setattr__(attr, value)\n\n    def __eq__(self, value):\n        \"\"\"Equality operator for frame.\n\n        This implements strict equality and requires that the frames are\n        equivalent and that the representation data are exactly equal.\n        \"\"\"\n        is_equiv = self.is_equivalent_frame(value)\n\n        if self._data is None and value._data is None:\n            # For Frame with no data, == compare is same as is_equivalent_frame()\n            return is_equiv\n\n        if not is_equiv:\n            raise TypeError(f'cannot compare: objects must have equivalent frames: '\n                            f'{self.replicate_without_data()} vs. '\n                            f'{value.replicate_without_data()}')\n\n        if ((value._data is None and self._data is not None)\n                or (self._data is None and value._data is not None)):\n            raise ValueError('cannot compare: one frame has data and the other '\n                             'does not')\n\n        return self._data == value._data\n\n    def __ne__(self, value):\n        return np.logical_not(self == value)\n\n    def separation(self, other):\n        \"\"\"\n        Computes on-sky separation between this coordinate and another.\n\n        .. note::\n\n            If the ``other`` coordinate object is in a different frame, it is\n            first transformed to the frame of this object. This can lead to\n            unintuitive behavior if not accounted for. Particularly of note is\n            that ``self.separation(other)`` and ``other.separation(self)`` may\n            not give the same answer in this case.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate to get the separation to.\n\n        Returns\n        -------\n        sep : `~astropy.coordinates.Angle`\n            The on-sky separation between this and the ``other`` coordinate.\n\n        Notes\n        -----\n        The separation is calculated using the Vincenty formula, which\n        is stable at all locations, including poles and antipodes [1]_.\n\n        .. [1] https://en.wikipedia.org/wiki/Great-circle_distance\n\n        \"\"\"\n        from .angle_utilities import angular_separation\n        from .angles import Angle\n\n        self_unit_sph = self.represent_as(r.UnitSphericalRepresentation)\n        other_transformed = other.transform_to(self)\n        other_unit_sph = other_transformed.represent_as(r.UnitSphericalRepresentation)\n\n        # Get the separation as a Quantity, convert to Angle in degrees\n        sep = angular_separation(self_unit_sph.lon, self_unit_sph.lat,\n                                 other_unit_sph.lon, other_unit_sph.lat)\n        return Angle(sep, unit=u.degree)\n\n    def separation_3d(self, other):\n        \"\"\"\n        Computes three dimensional separation between this coordinate\n        and another.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate system to get the distance to.\n\n        Returns\n        -------\n        sep : `~astropy.coordinates.Distance`\n            The real-space distance between these two coordinates.\n\n        Raises\n        ------\n        ValueError\n            If this or the other coordinate do not have distances.\n        \"\"\"\n\n        from .distances import Distance\n\n        if issubclass(self.data.__class__, r.UnitSphericalRepresentation):\n            raise ValueError('This object does not have a distance; cannot '\n                             'compute 3d separation.')\n\n        # do this first just in case the conversion somehow creates a distance\n        other_in_self_system = other.transform_to(self)\n\n        if issubclass(other_in_self_system.__class__, r.UnitSphericalRepresentation):\n            raise ValueError('The other object does not have a distance; '\n                             'cannot compute 3d separation.')\n\n        # drop the differentials to ensure they don't do anything odd in the\n        # subtraction\n        self_car = self.data.without_differentials().represent_as(r.CartesianRepresentation)\n        other_car = other_in_self_system.data.without_differentials().represent_as(r.CartesianRepresentation)\n        dist = (self_car - other_car).norm()\n        if dist.unit == u.one:\n            return dist\n        else:\n            return Distance(dist)\n\n    @property\n    def cartesian(self):\n        \"\"\"\n        Shorthand for a cartesian representation of the coordinates in this\n        object.\n        \"\"\"\n\n        # TODO: if representations are updated to use a full transform graph,\n        #       the representation aliases should not be hard-coded like this\n        return self.represent_as('cartesian', in_frame_units=True)\n\n    @property\n    def cylindrical(self):\n        \"\"\"\n        Shorthand for a cylindrical representation of the coordinates in this\n        object.\n        \"\"\"\n\n        # TODO: if representations are updated to use a full transform graph,\n        #       the representation aliases should not be hard-coded like this\n        return self.represent_as('cylindrical', in_frame_units=True)\n\n    @property\n    def spherical(self):\n        \"\"\"\n        Shorthand for a spherical representation of the coordinates in this\n        object.\n        \"\"\"\n\n        # TODO: if representations are updated to use a full transform graph,\n        #       the representation aliases should not be hard-coded like this\n        return self.represent_as('spherical', in_frame_units=True)\n\n    @property\n    def sphericalcoslat(self):\n        \"\"\"\n        Shorthand for a spherical representation of the positional data and a\n        `SphericalCosLatDifferential` for the velocity data in this object.\n        \"\"\"\n\n        # TODO: if representations are updated to use a full transform graph,\n        #       the representation aliases should not be hard-coded like this\n        return self.represent_as('spherical', 'sphericalcoslat',\n                                 in_frame_units=True)\n\n    @property\n    def velocity(self):\n        \"\"\"\n        Shorthand for retrieving the Cartesian space-motion as a\n        `CartesianDifferential` object. This is equivalent to calling\n        ``self.cartesian.differentials['s']``.\n        \"\"\"\n        if 's' not in self.data.differentials:\n            raise ValueError('Frame has no associated velocity (Differential) '\n                             'data information.')\n\n        return self.cartesian.differentials['s']\n\n    @property\n    def proper_motion(self):\n        \"\"\"\n        Shorthand for the two-dimensional proper motion as a\n        `~astropy.units.Quantity` object with angular velocity units. In the\n        returned `~astropy.units.Quantity`, ``axis=0`` is the longitude/latitude\n        dimension so that ``.proper_motion[0]`` is the longitudinal proper\n        motion and ``.proper_motion[1]`` is latitudinal. The longitudinal proper\n        motion already includes the cos(latitude) term.\n        \"\"\"\n        if 's' not in self.data.differentials:\n            raise ValueError('Frame has no associated velocity (Differential) '\n                             'data information.')\n\n        sph = self.represent_as('spherical', 'sphericalcoslat',\n                                in_frame_units=True)\n        pm_lon = sph.differentials['s'].d_lon_coslat\n        pm_lat = sph.differentials['s'].d_lat\n        return np.stack((pm_lon.value,\n                         pm_lat.to(pm_lon.unit).value), axis=0) * pm_lon.unit\n\n    @property\n    def radial_velocity(self):\n        \"\"\"\n        Shorthand for the radial or line-of-sight velocity as a\n        `~astropy.units.Quantity` object.\n        \"\"\"\n        if 's' not in self.data.differentials:\n            raise ValueError('Frame has no associated velocity (Differential) '\n                             'data information.')\n\n        sph = self.represent_as('spherical', in_frame_units=True)\n        return sph.differentials['s'].d_distance"},{"col":4,"comment":"null","endLoc":3369,"header":"def _str_index_to_int(self, str_index)","id":4353,"name":"_str_index_to_int","nodeType":"Function","startLoc":3358,"text":"def _str_index_to_int(self, str_index):\n        # Search through leaflist for item with that name\n        found = []\n        for nleaf, leaf in enumerate(self._leaflist):\n            if getattr(leaf, 'name', None) == str_index:\n                found.append(nleaf)\n        if len(found) == 0:\n            raise IndexError(f\"No component with name '{str_index}' found\")\n        if len(found) > 1:\n            raise IndexError(\"Multiple components found using '{}' as name\\n\"\n                             \"at indices {}\".format(str_index, found))\n        return found[0]"},{"col":4,"comment":"null","endLoc":492,"header":"def _str_helper(self, format=None)","id":4354,"name":"_str_helper","nodeType":"Function","startLoc":485,"text":"def _str_helper(self, format=None):\n        if self.isscalar:\n            return self.to_string(format=format)\n\n        def formatter(x):\n            return x.to_string(format=format)\n\n        return np.array2string(self, formatter={'all': formatter})"},{"col":4,"comment":"\n        The coordinates of the target being observed.\n\n        If set, and an observer is set as well, this will override any explicit\n        radial velocity passed in.\n\n        Returns\n        -------\n        `~astropy.coordinates.BaseCoordinateFrame`\n            The astropy coordinate frame representing the target.\n        ","endLoc":412,"header":"@property\n    def target(self)","id":4355,"name":"target","nodeType":"Function","startLoc":399,"text":"@property\n    def target(self):\n        \"\"\"\n        The coordinates of the target being observed.\n\n        If set, and an observer is set as well, this will override any explicit\n        radial velocity passed in.\n\n        Returns\n        -------\n        `~astropy.coordinates.BaseCoordinateFrame`\n            The astropy coordinate frame representing the target.\n        \"\"\"\n        return self._target"},{"col":4,"comment":"null","endLoc":495,"header":"def __str__(self)","id":4356,"name":"__str__","nodeType":"Function","startLoc":494,"text":"def __str__(self):\n        return self._str_helper()"},{"col":4,"comment":"null","endLoc":424,"header":"@target.setter\n    def target(self, value)","id":4357,"name":"target","nodeType":"Function","startLoc":414,"text":"@target.setter\n    def target(self, value):\n\n        if self.target is not None:\n            raise ValueError(\"target has already been set\")\n\n        self._target = self._validate_coordinate(value, label='target')\n\n        # Switch to auto-computing radial velocity\n        if self._observer is not None:\n            self._radial_velocity = None"},{"col":4,"comment":"null","endLoc":498,"header":"def _repr_latex_(self)","id":4358,"name":"_repr_latex_","nodeType":"Function","startLoc":497,"text":"def _repr_latex_(self):\n        return self._str_helper(format='latex')"},{"attributeType":"null","col":4,"comment":"null","endLoc":109,"id":4359,"name":"_equivalent_unit","nodeType":"Attribute","startLoc":109,"text":"_equivalent_unit"},{"col":4,"comment":"null","endLoc":292,"header":"def __init_subclass__(cls, **kwargs)","id":4360,"name":"__init_subclass__","nodeType":"Function","startLoc":223,"text":"def __init_subclass__(cls, **kwargs):\n\n        # We first check for explicitly set values for these:\n        default_repr = getattr(cls, 'default_representation', None)\n        default_diff = getattr(cls, 'default_differential', None)\n        repr_info = getattr(cls, 'frame_specific_representation_info', None)\n        # Then, to make sure this works for subclasses-of-subclasses, we also\n        # have to check for cases where the attribute names have already been\n        # replaced by underscore-prefaced equivalents by the logic below:\n        if default_repr is None or isinstance(default_repr, property):\n            default_repr = getattr(cls, '_default_representation', None)\n\n        if default_diff is None or isinstance(default_diff, property):\n            default_diff = getattr(cls, '_default_differential', None)\n\n        if repr_info is None or isinstance(repr_info, property):\n            repr_info = getattr(cls, '_frame_specific_representation_info', None)\n\n        repr_info = cls._infer_repr_info(repr_info)\n\n        # Make read-only properties for the frame class attributes that should\n        # be read-only to make them immutable after creation.\n        # We copy attributes instead of linking to make sure there's no\n        # accidental cross-talk between classes\n        cls._create_readonly_property('default_representation', default_repr,\n                                      'Default representation for position data')\n        cls._create_readonly_property('default_differential', default_diff,\n                                      'Default representation for differential data '\n                                      '(e.g., velocity)')\n        cls._create_readonly_property('frame_specific_representation_info',\n                                      copy.deepcopy(repr_info),\n                                      'Mapping for frame-specific component names')\n\n        # Set the frame attributes. We first construct the attributes from\n        # superclasses, going in reverse order to keep insertion order,\n        # and then add any attributes from the frame now being defined\n        # (if any old definitions are overridden, this keeps the order).\n        # Note that we cannot simply start with the inherited frame_attributes\n        # since we could be a mixin between multiple coordinate frames.\n        # TODO: Should this be made to use readonly_prop_factory as well or\n        # would it be inconvenient for getting the frame_attributes from\n        # classes?\n        frame_attrs = {}\n        for basecls in reversed(cls.__bases__):\n            if issubclass(basecls, BaseCoordinateFrame):\n                frame_attrs.update(basecls.frame_attributes)\n\n        for k, v in cls.__dict__.items():\n            if isinstance(v, Attribute):\n                frame_attrs[k] = v\n\n        cls.frame_attributes = frame_attrs\n\n        # Deal with setting the name of the frame:\n        if not hasattr(cls, 'name'):\n            cls.name = cls.__name__.lower()\n        elif (BaseCoordinateFrame not in cls.__bases__ and\n                cls.name in [getattr(base, 'name', None)\n                             for base in cls.__bases__]):\n            # This may be a subclass of a subclass of BaseCoordinateFrame,\n            # like ICRS(BaseRADecFrame). In this case, cls.name will have been\n            # set by init_subclass\n            cls.name = cls.__name__.lower()\n\n        # A cache that *must be unique to each frame class* - it is\n        # insufficient to share them with superclasses, hence the need to put\n        # them in the meta\n        cls._frame_class_cache = {}\n\n        super().__init_subclass__(**kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":110,"id":4361,"name":"_include_easy_conversion_members","nodeType":"Attribute","startLoc":110,"text":"_include_easy_conversion_members"},{"col":4,"comment":" The number of inputs of a model.","endLoc":3374,"header":"@property\n    def n_inputs(self)","id":4362,"name":"n_inputs","nodeType":"Function","startLoc":3371,"text":"@property\n    def n_inputs(self):\n        \"\"\" The number of inputs of a model.\"\"\"\n        return self._n_inputs"},{"attributeType":"null","col":20,"comment":"null","endLoc":124,"id":4363,"name":"angle_unit","nodeType":"Attribute","startLoc":124,"text":"angle_unit"},{"col":4,"comment":"null","endLoc":3378,"header":"@n_inputs.setter\n    def n_inputs(self, value)","id":4364,"name":"n_inputs","nodeType":"Function","startLoc":3376,"text":"@n_inputs.setter\n    def n_inputs(self, value):\n        self._n_inputs = value"},{"col":4,"comment":" The number of outputs of a model.","endLoc":3383,"header":"@property\n    def n_outputs(self)","id":4365,"name":"n_outputs","nodeType":"Function","startLoc":3380,"text":"@property\n    def n_outputs(self):\n        \"\"\" The number of outputs of a model.\"\"\"\n        return self._n_outputs"},{"col":4,"comment":"null","endLoc":3387,"header":"@n_outputs.setter\n    def n_outputs(self, value)","id":4366,"name":"n_outputs","nodeType":"Function","startLoc":3385,"text":"@n_outputs.setter\n    def n_outputs(self, value):\n        self._n_outputs = value"},{"col":4,"comment":"null","endLoc":3391,"header":"@property\n    def eqcons(self)","id":4367,"name":"eqcons","nodeType":"Function","startLoc":3389,"text":"@property\n    def eqcons(self):\n        return self._eqcons"},{"col":4,"comment":"null","endLoc":3395,"header":"@eqcons.setter\n    def eqcons(self, value)","id":4368,"name":"eqcons","nodeType":"Function","startLoc":3393,"text":"@eqcons.setter\n    def eqcons(self, value):\n        self._eqcons = value"},{"col":4,"comment":"null","endLoc":3399,"header":"@property\n    def ineqcons(self)","id":4369,"name":"ineqcons","nodeType":"Function","startLoc":3397,"text":"@property\n    def ineqcons(self):\n        return self._eqcons"},{"col":4,"comment":"null","endLoc":3403,"header":"@ineqcons.setter\n    def ineqcons(self, value)","id":4370,"name":"ineqcons","nodeType":"Function","startLoc":3401,"text":"@ineqcons.setter\n    def ineqcons(self, value):\n        self._eqcons = value"},{"col":4,"comment":" Postorder traversal of the CompoundModel tree.","endLoc":3420,"header":"def traverse_postorder(self, include_operator=False)","id":4371,"name":"traverse_postorder","nodeType":"Function","startLoc":3405,"text":"def traverse_postorder(self, include_operator=False):\n        \"\"\" Postorder traversal of the CompoundModel tree.\"\"\"\n        res = []\n        if isinstance(self.left, CompoundModel):\n            res = res + self.left.traverse_postorder(include_operator)\n        else:\n            res = res + [self.left]\n        if isinstance(self.right, CompoundModel):\n            res = res + self.right.traverse_postorder(include_operator)\n        else:\n            res = res + [self.right]\n        if include_operator:\n            res.append(self.op)\n        else:\n            res.append(self)\n        return res"},{"attributeType":"null","col":16,"comment":"null","endLoc":116,"id":4372,"name":"unit","nodeType":"Attribute","startLoc":116,"text":"unit"},{"attributeType":"null","col":16,"comment":"null","endLoc":136,"id":4373,"name":"angle","nodeType":"Attribute","startLoc":136,"text":"angle"},{"col":4,"comment":"\n        Radial velocity of target relative to the observer.\n\n        Returns\n        -------\n        `~astropy.units.Quantity` ['speed']\n            Radial velocity of target.\n\n        Notes\n        -----\n        This is different from the ``.radial_velocity`` property of a\n        coordinate frame in that this calculates the radial velocity with\n        respect to the *observer*, not the origin of the frame.\n        ","endLoc":449,"header":"@property\n    def radial_velocity(self)","id":4374,"name":"radial_velocity","nodeType":"Function","startLoc":426,"text":"@property\n    def radial_velocity(self):\n        \"\"\"\n        Radial velocity of target relative to the observer.\n\n        Returns\n        -------\n        `~astropy.units.Quantity` ['speed']\n            Radial velocity of target.\n\n        Notes\n        -----\n        This is different from the ``.radial_velocity`` property of a\n        coordinate frame in that this calculates the radial velocity with\n        respect to the *observer*, not the origin of the frame.\n        \"\"\"\n        if self._observer is None or self._target is None:\n            if self._radial_velocity is None:\n                return 0 * KMS\n            else:\n                return self._radial_velocity\n        else:\n            return self._calculate_radial_velocity(self._observer, self._target,\n                                                   as_scalar=True)"},{"className":"Latitude","col":0,"comment":"\n    Latitude-like angle(s) which must be in the range -90 to +90 deg.\n\n    A Latitude object is distinguished from a pure\n    :class:`~astropy.coordinates.Angle` by virtue of being constrained\n    so that::\n\n      -90.0 * u.deg <= angle(s) <= +90.0 * u.deg\n\n    Any attempt to set a value outside that range will result in a\n    `ValueError`.\n\n    The input angle(s) can be specified either as an array, list,\n    scalar, tuple (see below), string,\n    :class:`~astropy.units.Quantity` or another\n    :class:`~astropy.coordinates.Angle`.\n\n    The input parser is flexible and supports all of the input formats\n    supported by :class:`~astropy.coordinates.Angle`.\n\n    Parameters\n    ----------\n    angle : array, list, scalar, `~astropy.units.Quantity`, `~astropy.coordinates.Angle`\n        The angle value(s). If a tuple, will be interpreted as ``(h, m, s)``\n        or ``(d, m, s)`` depending on ``unit``. If a string, it will be\n        interpreted following the rules described for\n        :class:`~astropy.coordinates.Angle`.\n\n        If ``angle`` is a sequence or array of strings, the resulting\n        values will be in the given ``unit``, or if `None` is provided,\n        the unit will be taken from the first given value.\n\n    unit : unit-like, optional\n        The unit of the value specified for the angle.  This may be\n        any string that `~astropy.units.Unit` understands, but it is\n        better to give an actual unit object.  Must be an angular\n        unit.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If a unit is not provided or it is not an angular unit.\n    `TypeError`\n        If the angle parameter is an instance of :class:`~astropy.coordinates.Longitude`.\n    ","endLoc":600,"id":4375,"nodeType":"Class","startLoc":513,"text":"class Latitude(Angle):\n    \"\"\"\n    Latitude-like angle(s) which must be in the range -90 to +90 deg.\n\n    A Latitude object is distinguished from a pure\n    :class:`~astropy.coordinates.Angle` by virtue of being constrained\n    so that::\n\n      -90.0 * u.deg <= angle(s) <= +90.0 * u.deg\n\n    Any attempt to set a value outside that range will result in a\n    `ValueError`.\n\n    The input angle(s) can be specified either as an array, list,\n    scalar, tuple (see below), string,\n    :class:`~astropy.units.Quantity` or another\n    :class:`~astropy.coordinates.Angle`.\n\n    The input parser is flexible and supports all of the input formats\n    supported by :class:`~astropy.coordinates.Angle`.\n\n    Parameters\n    ----------\n    angle : array, list, scalar, `~astropy.units.Quantity`, `~astropy.coordinates.Angle`\n        The angle value(s). If a tuple, will be interpreted as ``(h, m, s)``\n        or ``(d, m, s)`` depending on ``unit``. If a string, it will be\n        interpreted following the rules described for\n        :class:`~astropy.coordinates.Angle`.\n\n        If ``angle`` is a sequence or array of strings, the resulting\n        values will be in the given ``unit``, or if `None` is provided,\n        the unit will be taken from the first given value.\n\n    unit : unit-like, optional\n        The unit of the value specified for the angle.  This may be\n        any string that `~astropy.units.Unit` understands, but it is\n        better to give an actual unit object.  Must be an angular\n        unit.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If a unit is not provided or it is not an angular unit.\n    `TypeError`\n        If the angle parameter is an instance of :class:`~astropy.coordinates.Longitude`.\n    \"\"\"\n    def __new__(cls, angle, unit=None, **kwargs):\n        # Forbid creating a Lat from a Long.\n        if isinstance(angle, Longitude):\n            raise TypeError(\"A Latitude angle cannot be created from a Longitude angle\")\n        self = super().__new__(cls, angle, unit=unit, **kwargs)\n        self._validate_angles()\n        return self\n\n    def _validate_angles(self, angles=None):\n        \"\"\"Check that angles are between -90 and 90 degrees.\n        If not given, the check is done on the object itself\"\"\"\n        # Convert the lower and upper bounds to the \"native\" unit of\n        # this angle.  This limits multiplication to two values,\n        # rather than the N values in `self.value`.  Also, the\n        # comparison is performed on raw arrays, rather than Quantity\n        # objects, for speed.\n        if angles is None:\n            angles = self\n        lower = u.degree.to(angles.unit, -90.0)\n        upper = u.degree.to(angles.unit, 90.0)\n        # This invalid catch block can be removed when the minimum numpy\n        # version is >= 1.19 (NUMPY_LT_1_19)\n        with np.errstate(invalid='ignore'):\n            invalid_angles = (np.any(angles.value < lower) or\n                              np.any(angles.value > upper))\n        if invalid_angles:\n            raise ValueError('Latitude angle(s) must be within -90 deg <= angle <= 90 deg, '\n                             'got {}'.format(angles.to(u.degree)))\n\n    def __setitem__(self, item, value):\n        # Forbid assigning a Long to a Lat.\n        if isinstance(value, Longitude):\n            raise TypeError(\"A Longitude angle cannot be assigned to a Latitude angle\")\n        # first check bounds\n        if value is not np.ma.masked:\n            self._validate_angles(value)\n        super().__setitem__(item, value)\n\n    # Any calculation should drop to Angle\n    def __array_ufunc__(self, *args, **kwargs):\n        results = super().__array_ufunc__(*args, **kwargs)\n        return _no_angle_subclass(results)"},{"col":4,"comment":"Check that angles are between -90 and 90 degrees.\n        If not given, the check is done on the object itself","endLoc":586,"header":"def _validate_angles(self, angles=None)","id":4376,"name":"_validate_angles","nodeType":"Function","startLoc":567,"text":"def _validate_angles(self, angles=None):\n        \"\"\"Check that angles are between -90 and 90 degrees.\n        If not given, the check is done on the object itself\"\"\"\n        # Convert the lower and upper bounds to the \"native\" unit of\n        # this angle.  This limits multiplication to two values,\n        # rather than the N values in `self.value`.  Also, the\n        # comparison is performed on raw arrays, rather than Quantity\n        # objects, for speed.\n        if angles is None:\n            angles = self\n        lower = u.degree.to(angles.unit, -90.0)\n        upper = u.degree.to(angles.unit, 90.0)\n        # This invalid catch block can be removed when the minimum numpy\n        # version is >= 1.19 (NUMPY_LT_1_19)\n        with np.errstate(invalid='ignore'):\n            invalid_angles = (np.any(angles.value < lower) or\n                              np.any(angles.value > upper))\n        if invalid_angles:\n            raise ValueError('Latitude angle(s) must be within -90 deg <= angle <= 90 deg, '\n                             'got {}'.format(angles.to(u.degree)))"},{"col":4,"comment":"One dimensional Constant model derivative with respect to parameters","endLoc":1785,"header":"@staticmethod\n    def fit_deriv(x, amplitude)","id":4377,"name":"fit_deriv","nodeType":"Function","startLoc":1780,"text":"@staticmethod\n    def fit_deriv(x, amplitude):\n        \"\"\"One dimensional Constant model derivative with respect to parameters\"\"\"\n\n        d_amplitude = np.ones_like(x)\n        return [d_amplitude]"},{"col":4,"comment":"null","endLoc":1789,"header":"@property\n    def input_units(self)","id":4378,"name":"input_units","nodeType":"Function","startLoc":1787,"text":"@property\n    def input_units(self):\n        return None"},{"col":4,"comment":"null","endLoc":1792,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":4379,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1791,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":1760,"id":4380,"name":"amplitude","nodeType":"Attribute","startLoc":1760,"text":"amplitude"},{"col":4,"comment":"null","endLoc":3454,"header":"def _format_expression(self, format_leaf=None)","id":4381,"name":"_format_expression","nodeType":"Function","startLoc":3422,"text":"def _format_expression(self, format_leaf=None):\n        leaf_idx = 0\n        operands = deque()\n\n        if format_leaf is None:\n            format_leaf = lambda i, l: f'[{i}]'\n\n        for node in self.traverse_postorder():\n            if not isinstance(node, CompoundModel):\n                operands.append(format_leaf(leaf_idx, node))\n                leaf_idx += 1\n                continue\n\n            right = operands.pop()\n            left = operands.pop()\n            if node.op in OPERATOR_PRECEDENCE:\n                oper_order = OPERATOR_PRECEDENCE[node.op]\n\n                if isinstance(node, CompoundModel):\n                    if (isinstance(node.left, CompoundModel) and\n                            OPERATOR_PRECEDENCE[node.left.op] < oper_order):\n                        left = f'({left})'\n                    if (isinstance(node.right, CompoundModel) and\n                            OPERATOR_PRECEDENCE[node.right.op] < oper_order):\n                        right = f'({right})'\n\n                operands.append(' '.join((left, node.op, right)))\n            else:\n                left = f'(({left}),'\n                right = f'({right}))'\n                operands.append(' '.join((node.op[0], left, right)))\n\n        return ''.join(operands)"},{"col":26,"endLoc":3427,"id":4382,"nodeType":"Lambda","startLoc":3427,"text":"lambda i, l: f'[{i}]'"},{"col":4,"comment":"\n        Compute the line-of-sight velocity from the observer to the target.\n\n        Parameters\n        ----------\n        observer : `~astropy.coordinates.BaseCoordinateFrame`\n            The frame of the observer.\n        target : `~astropy.coordinates.BaseCoordinateFrame`\n            The frame of the target.\n        as_scalar : bool\n            If `True`, the magnitude of the velocity vector will be returned,\n            otherwise the full vector will be returned.\n\n        Returns\n        -------\n        `~astropy.units.Quantity` ['speed']\n            The radial velocity of the target with respect to the observer.\n        ","endLoc":499,"header":"@staticmethod\n    def _calculate_radial_velocity(observer, target, as_scalar=False)","id":4383,"name":"_calculate_radial_velocity","nodeType":"Function","startLoc":464,"text":"@staticmethod\n    def _calculate_radial_velocity(observer, target, as_scalar=False):\n        \"\"\"\n        Compute the line-of-sight velocity from the observer to the target.\n\n        Parameters\n        ----------\n        observer : `~astropy.coordinates.BaseCoordinateFrame`\n            The frame of the observer.\n        target : `~astropy.coordinates.BaseCoordinateFrame`\n            The frame of the target.\n        as_scalar : bool\n            If `True`, the magnitude of the velocity vector will be returned,\n            otherwise the full vector will be returned.\n\n        Returns\n        -------\n        `~astropy.units.Quantity` ['speed']\n            The radial velocity of the target with respect to the observer.\n        \"\"\"\n\n        # Convert observer and target to ICRS to avoid finite differencing\n        # calculations that lack numerical precision.\n        observer_icrs = observer.transform_to(ICRS())\n        target_icrs = target.transform_to(ICRS())\n\n        pos_hat = SpectralCoord._normalized_position_vector(observer_icrs, target_icrs)\n\n        d_vel = target_icrs.velocity - observer_icrs.velocity\n\n        vel_mag = pos_hat.dot(d_vel)\n\n        if as_scalar:\n            return vel_mag\n        else:\n            return vel_mag * pos_hat"},{"attributeType":"null","col":4,"comment":"null","endLoc":1761,"id":4384,"name":"linear","nodeType":"Attribute","startLoc":1761,"text":"linear"},{"className":"CompoundType","col":0,"comment":"null","endLoc":93,"id":4385,"nodeType":"Class","startLoc":37,"text":"class CompoundType(TransformType):\n    name = ['transform/' + x for x in _tag_to_method_mapping.keys()]\n    types = [CompoundModel]\n    version = '1.2.0'\n    handle_dynamic_subclasses = True\n\n    @classmethod\n    def from_tree_tagged(cls, node, ctx):\n        tag = node._tag[node._tag.rfind('/')+1:]\n        tag = tag[:tag.rfind('-')]\n        oper = _tag_to_method_mapping[tag]\n        left = node['forward'][0]\n        if not isinstance(left, Model):\n            raise TypeError(f\"Unknown model type '{node['forward'][0]._tag}'\")\n        right = node['forward'][1]\n        if (not isinstance(right, Model) and\n                not (oper == 'fix_inputs' and isinstance(right, dict))):\n            raise TypeError(f\"Unknown model type '{node['forward'][1]._tag}'\")\n        if oper == 'fix_inputs':\n            right = dict(zip(right['keys'], right['values']))\n            model = CompoundModel('fix_inputs', left, right)\n        else:\n            model = getattr(left, oper)(right)\n\n        return cls._from_tree_base_transform_members(model, node, ctx)\n\n    @classmethod\n    def to_tree_tagged(cls, model, ctx):\n        left = model.left\n\n        if isinstance(model.right, dict):\n            right = {\n                'keys': list(model.right.keys()),\n                'values': list(model.right.values())\n            }\n        else:\n            right = model.right\n\n        node = {\n            'forward': [left, right]\n        }\n\n        try:\n            tag_name = 'transform/' + _operator_to_tag_mapping[model.op]\n        except KeyError:\n            raise ValueError(f\"Unknown operator '{model.op}'\")\n\n        node = tagged.tag_object(cls.make_yaml_tag(tag_name), node, ctx=ctx)\n\n        return cls._to_tree_base_transform_members(model, node, ctx)\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert_tree_match(a.left, b.left)\n        assert_tree_match(a.right, b.right)"},{"col":4,"comment":"null","endLoc":595,"header":"def __setitem__(self, item, value)","id":4386,"name":"__setitem__","nodeType":"Function","startLoc":588,"text":"def __setitem__(self, item, value):\n        # Forbid assigning a Long to a Lat.\n        if isinstance(value, Longitude):\n            raise TypeError(\"A Longitude angle cannot be assigned to a Latitude angle\")\n        # first check bounds\n        if value is not np.ma.masked:\n            self._validate_angles(value)\n        super().__setitem__(item, value)"},{"col":4,"comment":"null","endLoc":622,"header":"@classmethod\n    def _infer_repr_info(cls, repr_info)","id":4387,"name":"_infer_repr_info","nodeType":"Function","startLoc":545,"text":"@classmethod\n    def _infer_repr_info(cls, repr_info):\n        # Unless overridden via `frame_specific_representation_info`, velocity\n        # name defaults are (see also docstring for BaseCoordinateFrame):\n        #   * ``pm_{lon}_cos{lat}``, ``pm_{lat}`` for\n        #     `SphericalCosLatDifferential` proper motion components\n        #   * ``pm_{lon}``, ``pm_{lat}`` for `SphericalDifferential` proper\n        #     motion components\n        #   * ``radial_velocity`` for any `d_distance` component\n        #   * ``v_{x,y,z}`` for `CartesianDifferential` velocity components\n        # where `{lon}` and `{lat}` are the frame names of the angular\n        # components.\n        if repr_info is None:\n            repr_info = {}\n\n        # the tuple() call below is necessary because if it is not there,\n        # the iteration proceeds in a difficult-to-predict manner in the\n        # case that one of the class objects hash is such that it gets\n        # revisited by the iteration.  The tuple() call prevents this by\n        # making the items iterated over fixed regardless of how the dict\n        # changes\n        for cls_or_name in tuple(repr_info.keys()):\n            if isinstance(cls_or_name, str):\n                # TODO: this provides a layer of backwards compatibility in\n                # case the key is a string, but now we want explicit classes.\n                _cls = _get_repr_cls(cls_or_name)\n                repr_info[_cls] = repr_info.pop(cls_or_name)\n\n        # The default spherical names are 'lon' and 'lat'\n        repr_info.setdefault(r.SphericalRepresentation,\n                             [RepresentationMapping('lon', 'lon'),\n                              RepresentationMapping('lat', 'lat')])\n\n        sph_component_map = {m.reprname: m.framename\n                             for m in repr_info[r.SphericalRepresentation]}\n\n        repr_info.setdefault(r.SphericalCosLatDifferential, [\n            RepresentationMapping(\n                'd_lon_coslat',\n                'pm_{lon}_cos{lat}'.format(**sph_component_map),\n                u.mas/u.yr),\n            RepresentationMapping('d_lat',\n                                  'pm_{lat}'.format(**sph_component_map),\n                                  u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity',\n                                  u.km/u.s)\n        ])\n\n        repr_info.setdefault(r.SphericalDifferential, [\n            RepresentationMapping('d_lon',\n                                  'pm_{lon}'.format(**sph_component_map),\n                                  u.mas/u.yr),\n            RepresentationMapping('d_lat',\n                                  'pm_{lat}'.format(**sph_component_map),\n                                  u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity',\n                                  u.km/u.s)\n        ])\n\n        repr_info.setdefault(r.CartesianDifferential, [\n            RepresentationMapping('d_x', 'v_x', u.km/u.s),\n            RepresentationMapping('d_y', 'v_y', u.km/u.s),\n            RepresentationMapping('d_z', 'v_z', u.km/u.s)])\n\n        # Unit* classes should follow the same naming conventions\n        # TODO: this adds some unnecessary mappings for the Unit classes, so\n        # this could be cleaned up, but in practice doesn't seem to have any\n        # negative side effects\n        repr_info.setdefault(r.UnitSphericalRepresentation,\n                             repr_info[r.SphericalRepresentation])\n\n        repr_info.setdefault(r.UnitSphericalCosLatDifferential,\n                             repr_info[r.SphericalCosLatDifferential])\n\n        repr_info.setdefault(r.UnitSphericalDifferential,\n                             repr_info[r.SphericalDifferential])\n\n        return repr_info"},{"col":4,"comment":"null","endLoc":600,"header":"def __array_ufunc__(self, *args, **kwargs)","id":4388,"name":"__array_ufunc__","nodeType":"Function","startLoc":598,"text":"def __array_ufunc__(self, *args, **kwargs):\n        results = super().__array_ufunc__(*args, **kwargs)\n        return _no_angle_subclass(results)"},{"col":4,"comment":"\n        Compute the position of the source represented by this coordinate object\n        to a new time using the velocities stored in this object and assuming\n        linear space motion (including relativistic corrections). This is\n        sometimes referred to as an \"epoch transformation.\"\n\n        The initial time before the evolution is taken from the ``obstime``\n        attribute of this coordinate.  Note that this method currently does not\n        support evolving coordinates where the *frame* has an ``obstime`` frame\n        attribute, so the ``obstime`` is only used for storing the before and\n        after times, not actually as an attribute of the frame. Alternatively,\n        if ``dt`` is given, an ``obstime`` need not be provided at all.\n\n        Parameters\n        ----------\n        new_obstime : `~astropy.time.Time`, optional\n            The time at which to evolve the position to. Requires that the\n            ``obstime`` attribute be present on this frame.\n        dt : `~astropy.units.Quantity`, `~astropy.time.TimeDelta`, optional\n            An amount of time to evolve the position of the source. Cannot be\n            given at the same time as ``new_obstime``.\n\n        Returns\n        -------\n        new_coord : `SkyCoord`\n            A new coordinate object with the evolved location of this coordinate\n            at the new time.  ``obstime`` will be set on this object to the new\n            time only if ``self`` also has ``obstime``.\n        ","endLoc":820,"header":"def apply_space_motion(self, new_obstime=None, dt=None)","id":4389,"name":"apply_space_motion","nodeType":"Function","startLoc":692,"text":"def apply_space_motion(self, new_obstime=None, dt=None):\n        \"\"\"\n        Compute the position of the source represented by this coordinate object\n        to a new time using the velocities stored in this object and assuming\n        linear space motion (including relativistic corrections). This is\n        sometimes referred to as an \"epoch transformation.\"\n\n        The initial time before the evolution is taken from the ``obstime``\n        attribute of this coordinate.  Note that this method currently does not\n        support evolving coordinates where the *frame* has an ``obstime`` frame\n        attribute, so the ``obstime`` is only used for storing the before and\n        after times, not actually as an attribute of the frame. Alternatively,\n        if ``dt`` is given, an ``obstime`` need not be provided at all.\n\n        Parameters\n        ----------\n        new_obstime : `~astropy.time.Time`, optional\n            The time at which to evolve the position to. Requires that the\n            ``obstime`` attribute be present on this frame.\n        dt : `~astropy.units.Quantity`, `~astropy.time.TimeDelta`, optional\n            An amount of time to evolve the position of the source. Cannot be\n            given at the same time as ``new_obstime``.\n\n        Returns\n        -------\n        new_coord : `SkyCoord`\n            A new coordinate object with the evolved location of this coordinate\n            at the new time.  ``obstime`` will be set on this object to the new\n            time only if ``self`` also has ``obstime``.\n        \"\"\"\n\n        if (new_obstime is None and dt is None or\n                new_obstime is not None and dt is not None):\n            raise ValueError(\"You must specify one of `new_obstime` or `dt`, \"\n                             \"but not both.\")\n\n        # Validate that we have velocity info\n        if 's' not in self.frame.data.differentials:\n            raise ValueError('SkyCoord requires velocity data to evolve the '\n                             'position.')\n\n        if 'obstime' in self.frame.frame_attributes:\n            raise NotImplementedError(\"Updating the coordinates in a frame \"\n                                      \"with explicit time dependence is \"\n                                      \"currently not supported. If you would \"\n                                      \"like this functionality, please open an \"\n                                      \"issue on github:\\n\"\n                                      \"https://github.com/astropy/astropy\")\n\n        if new_obstime is not None and self.obstime is None:\n            # If no obstime is already on this object, raise an error if a new\n            # obstime is passed: we need to know the time / epoch at which the\n            # the position / velocity were measured initially\n            raise ValueError('This object has no associated `obstime`. '\n                             'apply_space_motion() must receive a time '\n                             'difference, `dt`, and not a new obstime.')\n\n        # Compute t1 and t2, the times used in the starpm call, which *only*\n        # uses them to compute a delta-time\n        t1 = self.obstime\n        if dt is None:\n            # self.obstime is not None and new_obstime is not None b/c of above\n            # checks\n            t2 = new_obstime\n        else:\n            # new_obstime is definitely None b/c of the above checks\n            if t1 is None:\n                # MAGIC NUMBER: if the current SkyCoord object has no obstime,\n                # assume J2000 to do the dt offset. This is not actually used\n                # for anything except a delta-t in starpm, so it's OK that it's\n                # not necessarily the \"real\" obstime\n                t1 = Time('J2000')\n                new_obstime = None  # we don't actually know the initial obstime\n                t2 = t1 + dt\n            else:\n                t2 = t1 + dt\n                new_obstime = t2\n        # starpm wants tdb time\n        t1 = t1.tdb\n        t2 = t2.tdb\n\n        # proper motion in RA should not include the cos(dec) term, see the\n        # erfa function eraStarpv, comment (4).  So we convert to the regular\n        # spherical differentials.\n        icrsrep = self.icrs.represent_as(SphericalRepresentation, SphericalDifferential)\n        icrsvel = icrsrep.differentials['s']\n\n        parallax_zero = False\n        try:\n            plx = icrsrep.distance.to_value(u.arcsecond, u.parallax())\n        except u.UnitConversionError:  # No distance: set to 0 by convention\n            plx = 0.\n            parallax_zero = True\n\n        try:\n            rv = icrsvel.d_distance.to_value(u.km/u.s)\n        except u.UnitConversionError:  # No RV\n            rv = 0.\n\n        starpm = erfa.pmsafe(icrsrep.lon.radian, icrsrep.lat.radian,\n                             icrsvel.d_lon.to_value(u.radian/u.yr),\n                             icrsvel.d_lat.to_value(u.radian/u.yr),\n                             plx, rv, t1.jd1, t1.jd2, t2.jd1, t2.jd2)\n\n        if parallax_zero:\n            new_distance = None\n        else:\n            new_distance = Distance(parallax=starpm[4] << u.arcsec)\n\n        icrs2 = ICRS(ra=u.Quantity(starpm[0], u.radian, copy=False),\n                     dec=u.Quantity(starpm[1], u.radian, copy=False),\n                     pm_ra=u.Quantity(starpm[2], u.radian/u.yr, copy=False),\n                     pm_dec=u.Quantity(starpm[3], u.radian/u.yr, copy=False),\n                     distance=new_distance,\n                     radial_velocity=u.Quantity(starpm[5], u.km/u.s, copy=False),\n                     differential_type=SphericalDifferential)\n\n        # Update the obstime of the returned SkyCoord, and need to carry along\n        # the frame attributes\n        frattrs = {attrnm: getattr(self, attrnm)\n                   for attrnm in self._extra_frameattr_names}\n        frattrs['obstime'] = new_obstime\n        result = self.__class__(icrs2, **frattrs).transform_to(self.frame)\n\n        # Without this the output might not have the right differential type.\n        # Not sure if this fixes the problem or just hides it.  See #11932\n        result.differential_type = self.differential_type\n\n        return result"},{"col":0,"comment":"Return any Angle subclass objects as an Angle objects.\n\n    This is used to ensure that Latitude and Longitude change to Angle\n    objects when they are used in calculations (such as lon/2.)\n    ","endLoc":510,"header":"def _no_angle_subclass(obj)","id":4390,"name":"_no_angle_subclass","nodeType":"Function","startLoc":501,"text":"def _no_angle_subclass(obj):\n    \"\"\"Return any Angle subclass objects as an Angle objects.\n\n    This is used to ensure that Latitude and Longitude change to Angle\n    objects when they are used in calculations (such as lon/2.)\n    \"\"\"\n    if isinstance(obj, tuple):\n        return tuple(_no_angle_subclass(_obj) for _obj in obj)\n\n    return obj.view(Angle) if isinstance(obj, (Latitude, Longitude)) else obj"},{"attributeType":"null","col":8,"comment":"null","endLoc":563,"id":4391,"name":"self","nodeType":"Attribute","startLoc":563,"text":"self"},{"className":"Longitude","col":0,"comment":"\n    Longitude-like angle(s) which are wrapped within a contiguous 360 degree range.\n\n    A ``Longitude`` object is distinguished from a pure\n    :class:`~astropy.coordinates.Angle` by virtue of a ``wrap_angle``\n    property.  The ``wrap_angle`` specifies that all angle values\n    represented by the object will be in the range::\n\n      wrap_angle - 360 * u.deg <= angle(s) < wrap_angle\n\n    The default ``wrap_angle`` is 360 deg.  Setting ``wrap_angle=180 *\n    u.deg`` would instead result in values between -180 and +180 deg.\n    Setting the ``wrap_angle`` attribute of an existing ``Longitude``\n    object will result in re-wrapping the angle values in-place.\n\n    The input angle(s) can be specified either as an array, list,\n    scalar, tuple, string, :class:`~astropy.units.Quantity`\n    or another :class:`~astropy.coordinates.Angle`.\n\n    The input parser is flexible and supports all of the input formats\n    supported by :class:`~astropy.coordinates.Angle`.\n\n    Parameters\n    ----------\n    angle : tuple or angle-like\n        The angle value(s). If a tuple, will be interpreted as ``(h, m s)`` or\n        ``(d, m, s)`` depending on ``unit``. If a string, it will be interpreted\n        following the rules described for :class:`~astropy.coordinates.Angle`.\n\n        If ``angle`` is a sequence or array of strings, the resulting\n        values will be in the given ``unit``, or if `None` is provided,\n        the unit will be taken from the first given value.\n\n    unit : unit-like ['angle'], optional\n        The unit of the value specified for the angle.  This may be\n        any string that `~astropy.units.Unit` understands, but it is\n        better to give an actual unit object.  Must be an angular\n        unit.\n\n    wrap_angle : angle-like or None, optional\n        Angle at which to wrap back to ``wrap_angle - 360 deg``.\n        If ``None`` (default), it will be taken to be 360 deg unless ``angle``\n        has a ``wrap_angle`` attribute already (i.e., is a ``Longitude``),\n        in which case it will be taken from there.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If a unit is not provided or it is not an angular unit.\n    `TypeError`\n        If the angle parameter is an instance of :class:`~astropy.coordinates.Latitude`.\n    ","endLoc":700,"id":4392,"nodeType":"Class","startLoc":607,"text":"class Longitude(Angle):\n    \"\"\"\n    Longitude-like angle(s) which are wrapped within a contiguous 360 degree range.\n\n    A ``Longitude`` object is distinguished from a pure\n    :class:`~astropy.coordinates.Angle` by virtue of a ``wrap_angle``\n    property.  The ``wrap_angle`` specifies that all angle values\n    represented by the object will be in the range::\n\n      wrap_angle - 360 * u.deg <= angle(s) < wrap_angle\n\n    The default ``wrap_angle`` is 360 deg.  Setting ``wrap_angle=180 *\n    u.deg`` would instead result in values between -180 and +180 deg.\n    Setting the ``wrap_angle`` attribute of an existing ``Longitude``\n    object will result in re-wrapping the angle values in-place.\n\n    The input angle(s) can be specified either as an array, list,\n    scalar, tuple, string, :class:`~astropy.units.Quantity`\n    or another :class:`~astropy.coordinates.Angle`.\n\n    The input parser is flexible and supports all of the input formats\n    supported by :class:`~astropy.coordinates.Angle`.\n\n    Parameters\n    ----------\n    angle : tuple or angle-like\n        The angle value(s). If a tuple, will be interpreted as ``(h, m s)`` or\n        ``(d, m, s)`` depending on ``unit``. If a string, it will be interpreted\n        following the rules described for :class:`~astropy.coordinates.Angle`.\n\n        If ``angle`` is a sequence or array of strings, the resulting\n        values will be in the given ``unit``, or if `None` is provided,\n        the unit will be taken from the first given value.\n\n    unit : unit-like ['angle'], optional\n        The unit of the value specified for the angle.  This may be\n        any string that `~astropy.units.Unit` understands, but it is\n        better to give an actual unit object.  Must be an angular\n        unit.\n\n    wrap_angle : angle-like or None, optional\n        Angle at which to wrap back to ``wrap_angle - 360 deg``.\n        If ``None`` (default), it will be taken to be 360 deg unless ``angle``\n        has a ``wrap_angle`` attribute already (i.e., is a ``Longitude``),\n        in which case it will be taken from there.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If a unit is not provided or it is not an angular unit.\n    `TypeError`\n        If the angle parameter is an instance of :class:`~astropy.coordinates.Latitude`.\n    \"\"\"\n\n    _wrap_angle = None\n    _default_wrap_angle = Angle(360 * u.deg)\n    info = LongitudeInfo()\n\n    def __new__(cls, angle, unit=None, wrap_angle=None, **kwargs):\n        # Forbid creating a Long from a Lat.\n        if isinstance(angle, Latitude):\n            raise TypeError(\"A Longitude angle cannot be created from \"\n                            \"a Latitude angle.\")\n        self = super().__new__(cls, angle, unit=unit, **kwargs)\n        if wrap_angle is None:\n            wrap_angle = getattr(angle, 'wrap_angle', self._default_wrap_angle)\n        self.wrap_angle = wrap_angle  # angle-like b/c property setter\n        return self\n\n    def __setitem__(self, item, value):\n        # Forbid assigning a Lat to a Long.\n        if isinstance(value, Latitude):\n            raise TypeError(\"A Latitude angle cannot be assigned to a Longitude angle\")\n        super().__setitem__(item, value)\n        self._wrap_at(self.wrap_angle)\n\n    @property\n    def wrap_angle(self):\n        return self._wrap_angle\n\n    @wrap_angle.setter\n    def wrap_angle(self, value):\n        self._wrap_angle = Angle(value, copy=False)\n        self._wrap_at(self.wrap_angle)\n\n    def __array_finalize__(self, obj):\n        super().__array_finalize__(obj)\n        self._wrap_angle = getattr(obj, '_wrap_angle',\n                                   self._default_wrap_angle)\n\n    # Any calculation should drop to Angle\n    def __array_ufunc__(self, *args, **kwargs):\n        results = super().__array_ufunc__(*args, **kwargs)\n        return _no_angle_subclass(results)"},{"col":4,"comment":"null","endLoc":681,"header":"def __setitem__(self, item, value)","id":4393,"name":"__setitem__","nodeType":"Function","startLoc":676,"text":"def __setitem__(self, item, value):\n        # Forbid assigning a Lat to a Long.\n        if isinstance(value, Latitude):\n            raise TypeError(\"A Latitude angle cannot be assigned to a Longitude angle\")\n        super().__setitem__(item, value)\n        self._wrap_at(self.wrap_angle)"},{"col":4,"comment":"null","endLoc":132,"header":"def __new__(cls, reprname, framename, defaultunit='recommended')","id":4394,"name":"__new__","nodeType":"Function","startLoc":130,"text":"def __new__(cls, reprname, framename, defaultunit='recommended'):\n        # this trick just provides some defaults\n        return super().__new__(cls, reprname, framename, defaultunit)"},{"col":4,"comment":"null","endLoc":685,"header":"@property\n    def wrap_angle(self)","id":4395,"name":"wrap_angle","nodeType":"Function","startLoc":683,"text":"@property\n    def wrap_angle(self):\n        return self._wrap_angle"},{"col":4,"comment":"null","endLoc":690,"header":"@wrap_angle.setter\n    def wrap_angle(self, value)","id":4396,"name":"wrap_angle","nodeType":"Function","startLoc":687,"text":"@wrap_angle.setter\n    def wrap_angle(self, value):\n        self._wrap_angle = Angle(value, copy=False)\n        self._wrap_at(self.wrap_angle)"},{"col":4,"comment":"null","endLoc":695,"header":"def __array_finalize__(self, obj)","id":4397,"name":"__array_finalize__","nodeType":"Function","startLoc":692,"text":"def __array_finalize__(self, obj):\n        super().__array_finalize__(obj)\n        self._wrap_angle = getattr(obj, '_wrap_angle',\n                                   self._default_wrap_angle)"},{"col":4,"comment":"null","endLoc":700,"header":"def __array_ufunc__(self, *args, **kwargs)","id":4398,"name":"__array_ufunc__","nodeType":"Function","startLoc":698,"text":"def __array_ufunc__(self, *args, **kwargs):\n        results = super().__array_ufunc__(*args, **kwargs)\n        return _no_angle_subclass(results)"},{"col":4,"comment":"null","endLoc":61,"header":"@classmethod\n    def from_tree_tagged(cls, node, ctx)","id":4399,"name":"from_tree_tagged","nodeType":"Function","startLoc":43,"text":"@classmethod\n    def from_tree_tagged(cls, node, ctx):\n        tag = node._tag[node._tag.rfind('/')+1:]\n        tag = tag[:tag.rfind('-')]\n        oper = _tag_to_method_mapping[tag]\n        left = node['forward'][0]\n        if not isinstance(left, Model):\n            raise TypeError(f\"Unknown model type '{node['forward'][0]._tag}'\")\n        right = node['forward'][1]\n        if (not isinstance(right, Model) and\n                not (oper == 'fix_inputs' and isinstance(right, dict))):\n            raise TypeError(f\"Unknown model type '{node['forward'][1]._tag}'\")\n        if oper == 'fix_inputs':\n            right = dict(zip(right['keys'], right['values']))\n            model = CompoundModel('fix_inputs', left, right)\n        else:\n            model = getattr(left, oper)(right)\n\n        return cls._from_tree_base_transform_members(model, node, ctx)"},{"attributeType":"null","col":4,"comment":"null","endLoc":661,"id":4400,"name":"_wrap_angle","nodeType":"Attribute","startLoc":661,"text":"_wrap_angle"},{"col":4,"comment":"null","endLoc":3460,"header":"def _format_components(self)","id":4401,"name":"_format_components","nodeType":"Function","startLoc":3456,"text":"def _format_components(self):\n        if self._parameters_ is None:\n            self._map_parameters()\n        return '\\n\\n'.join('[{0}]: {1!r}'.format(idx, m)\n                           for idx, m in enumerate(self._leaflist))"},{"col":4,"comment":"null","endLoc":3469,"header":"def __str__(self)","id":4402,"name":"__str__","nodeType":"Function","startLoc":3462,"text":"def __str__(self):\n        expression = self._format_expression()\n        components = self._format_components()\n        keywords = [\n            ('Expression', expression),\n            ('Components', '\\n' + indent(components))\n        ]\n        return super()._format_str(keywords=keywords)"},{"attributeType":"null","col":4,"comment":"null","endLoc":662,"id":4403,"name":"_default_wrap_angle","nodeType":"Attribute","startLoc":662,"text":"_default_wrap_angle"},{"col":4,"comment":"\n        Calculate the normalized position vector between two frames.\n\n        Parameters\n        ----------\n        observer : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n            The observation frame or coordinate.\n        target : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n            The target frame or coordinate.\n\n        Returns\n        -------\n        pos_hat : `BaseRepresentation`\n            Position representation.\n        ","endLoc":528,"header":"@staticmethod\n    def _normalized_position_vector(observer, target)","id":4404,"name":"_normalized_position_vector","nodeType":"Function","startLoc":501,"text":"@staticmethod\n    def _normalized_position_vector(observer, target):\n        \"\"\"\n        Calculate the normalized position vector between two frames.\n\n        Parameters\n        ----------\n        observer : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n            The observation frame or coordinate.\n        target : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n            The target frame or coordinate.\n\n        Returns\n        -------\n        pos_hat : `BaseRepresentation`\n            Position representation.\n        \"\"\"\n        d_pos = (target.cartesian.without_differentials() -\n                 observer.cartesian.without_differentials())\n\n        dp_norm = d_pos.norm()\n\n        # Reset any that are 0 to 1 to avoid nans from 0/0\n        dp_norm[dp_norm == 0] = 1 * dp_norm.unit\n\n        pos_hat = d_pos / dp_norm\n\n        return pos_hat"},{"attributeType":"null","col":4,"comment":"null","endLoc":663,"id":4405,"name":"info","nodeType":"Attribute","startLoc":663,"text":"info"},{"col":4,"comment":"null","endLoc":632,"header":"@classmethod\n    def _create_readonly_property(cls, attr_name, value, doc=None)","id":4406,"name":"_create_readonly_property","nodeType":"Function","startLoc":624,"text":"@classmethod\n    def _create_readonly_property(cls, attr_name, value, doc=None):\n        private_attr = '_' + attr_name\n\n        def getter(self):\n            return getattr(self, private_attr)\n\n        setattr(cls, private_attr, value)\n        setattr(cls, attr_name, property(getter, doc=doc))"},{"col":4,"comment":"null","endLoc":3473,"header":"def rename(self, name)","id":4407,"name":"rename","nodeType":"Function","startLoc":3471,"text":"def rename(self, name):\n        self.name = name\n        return self"},{"col":4,"comment":"null","endLoc":3477,"header":"@property\n    def isleaf(self)","id":4408,"name":"isleaf","nodeType":"Function","startLoc":3475,"text":"@property\n    def isleaf(self):\n        return False"},{"col":4,"comment":"null","endLoc":3486,"header":"@property\n    def inverse(self)","id":4409,"name":"inverse","nodeType":"Function","startLoc":3479,"text":"@property\n    def inverse(self):\n        if self.op == '|':\n            return self.right.inverse | self.left.inverse\n        elif self.op == '&':\n            return self.left.inverse & self.right.inverse\n        else:\n            return NotImplemented"},{"col":4,"comment":" Set the fittable attribute on a compound model.","endLoc":3495,"header":"@property\n    def fittable(self)","id":4410,"name":"fittable","nodeType":"Function","startLoc":3488,"text":"@property\n    def fittable(self):\n        \"\"\" Set the fittable attribute on a compound model.\"\"\"\n        if self._fittable is None:\n            if self._leaflist is None:\n                self._map_parameters()\n            self._fittable = all(m.fittable for m in self._leaflist)\n        return self._fittable"},{"attributeType":"null","col":8,"comment":"null","endLoc":673,"id":4411,"name":"wrap_angle","nodeType":"Attribute","startLoc":673,"text":"self.wrap_angle"},{"col":4,"comment":"\n        Redshift of target relative to observer. Calculated from the radial\n        velocity.\n\n        Returns\n        -------\n        `astropy.units.Quantity`\n            Redshift of target.\n        ","endLoc":462,"header":"@property\n    def redshift(self)","id":4412,"name":"redshift","nodeType":"Function","startLoc":451,"text":"@property\n    def redshift(self):\n        \"\"\"\n        Redshift of target relative to observer. Calculated from the radial\n        velocity.\n\n        Returns\n        -------\n        `astropy.units.Quantity`\n            Redshift of target.\n        \"\"\"\n        return self.radial_velocity.to(u.dimensionless_unscaled, u.doppler_redshift())"},{"col":0,"comment":"\n    Returns a list of equivalence pairs that handle the conversion\n    between parallax angle and distance.\n    ","endLoc":103,"header":"def parallax()","id":4413,"name":"parallax","nodeType":"Function","startLoc":81,"text":"def parallax():\n    \"\"\"\n    Returns a list of equivalence pairs that handle the conversion\n    between parallax angle and distance.\n    \"\"\"\n\n    def parallax_converter(x):\n        x = np.asanyarray(x)\n        d = 1 / x\n\n        if isiterable(d):\n            d[d < 0] = np.nan\n            return d\n\n        else:\n            if d < 0:\n                return np.array(np.nan)\n            else:\n                return d\n\n    return Equivalency([\n        (si.arcsecond, astrophys.parsec, parallax_converter)\n    ], \"parallax\")"},{"col":4,"comment":"null","endLoc":3571,"header":"@staticmethod\n    def _recursive_lookup(branch, adict, key)","id":4414,"name":"_recursive_lookup","nodeType":"Function","startLoc":3567,"text":"@staticmethod\n    def _recursive_lookup(branch, adict, key):\n        if isinstance(branch, CompoundModel):\n            return adict[key]\n        return branch, key"},{"col":4,"comment":"null","endLoc":3632,"header":"def _parameter_units_for_data_units(self, input_units, output_units)","id":4415,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":3623,"text":"def _parameter_units_for_data_units(self, input_units, output_units):\n        if self._leaflist is None:\n            self._map_parameters()\n        units_for_data = {}\n        for imodel, model in enumerate(self._leaflist):\n            units_for_data_leaf = model._parameter_units_for_data_units(input_units, output_units)\n            for param_leaf in units_for_data_leaf:\n                param = self._param_map_inverse[(imodel, param_leaf)]\n                units_for_data[param] = units_for_data_leaf[param_leaf]\n        return units_for_data"},{"col":4,"comment":"\n        A new  `SpectralCoord` with the velocity of the observer altered,\n        but not the position.\n\n        If a coordinate frame is specified, the observer velocities will be\n        modified to be stationary in the specified frame. If a coordinate\n        instance is specified, optionally with non-zero velocities, the\n        observer velocities will be updated so that the observer is co-moving\n        with the specified coordinates.\n\n        Parameters\n        ----------\n        frame : str, `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n            The observation frame in which the observer will be stationary. This\n            can be the name of a frame (e.g. 'icrs'), a frame class, frame instance\n            with no data, or instance with data. This can optionally include\n            velocities.\n        velocity : `~astropy.units.Quantity` or `~astropy.coordinates.CartesianDifferential`, optional\n            If ``frame`` does not contain velocities, these can be specified as\n            a 3-element `~astropy.units.Quantity`. In the case where this is\n            also not specified, the velocities default to zero.\n        preserve_observer_frame : bool\n            If `True`, the final observer frame class will be the same as the\n            original one, and if `False` it will be the frame of the velocity\n            reference class.\n\n        Returns\n        -------\n        new_coord : `SpectralCoord`\n            The new coordinate object representing the spectral data\n            transformed based on the observer's new velocity frame.\n        ","endLoc":615,"header":"@u.quantity_input(velocity=u.km/u.s)\n    def with_observer_stationary_relative_to(self, frame, velocity=None, preserve_observer_frame=False)","id":4416,"name":"with_observer_stationary_relative_to","nodeType":"Function","startLoc":530,"text":"@u.quantity_input(velocity=u.km/u.s)\n    def with_observer_stationary_relative_to(self, frame, velocity=None, preserve_observer_frame=False):\n        \"\"\"\n        A new  `SpectralCoord` with the velocity of the observer altered,\n        but not the position.\n\n        If a coordinate frame is specified, the observer velocities will be\n        modified to be stationary in the specified frame. If a coordinate\n        instance is specified, optionally with non-zero velocities, the\n        observer velocities will be updated so that the observer is co-moving\n        with the specified coordinates.\n\n        Parameters\n        ----------\n        frame : str, `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n            The observation frame in which the observer will be stationary. This\n            can be the name of a frame (e.g. 'icrs'), a frame class, frame instance\n            with no data, or instance with data. This can optionally include\n            velocities.\n        velocity : `~astropy.units.Quantity` or `~astropy.coordinates.CartesianDifferential`, optional\n            If ``frame`` does not contain velocities, these can be specified as\n            a 3-element `~astropy.units.Quantity`. In the case where this is\n            also not specified, the velocities default to zero.\n        preserve_observer_frame : bool\n            If `True`, the final observer frame class will be the same as the\n            original one, and if `False` it will be the frame of the velocity\n            reference class.\n\n        Returns\n        -------\n        new_coord : `SpectralCoord`\n            The new coordinate object representing the spectral data\n            transformed based on the observer's new velocity frame.\n        \"\"\"\n\n        if self.observer is None or self.target is None:\n            raise ValueError(\"This method can only be used if both observer \"\n                             \"and target are defined on the SpectralCoord.\")\n\n        # Start off by extracting frame if a SkyCoord was passed in\n        if isinstance(frame, SkyCoord):\n            frame = frame.frame\n\n        if isinstance(frame, BaseCoordinateFrame):\n\n            if not frame.has_data:\n                frame = frame.realize_frame(CartesianRepresentation(0 * u.km, 0 * u.km, 0 * u.km))\n\n            if frame.data.differentials:\n                if velocity is not None:\n                    raise ValueError('frame already has differentials, cannot also specify velocity')\n                # otherwise frame is ready to go\n            else:\n                if velocity is None:\n                    differentials = ZERO_VELOCITIES\n                else:\n                    differentials = CartesianDifferential(velocity)\n                frame = frame.realize_frame(frame.data.with_differentials(differentials))\n\n        if isinstance(frame, (type, str)):\n            if isinstance(frame, type):\n                frame_cls = frame\n            elif isinstance(frame, str):\n                frame_cls = frame_transform_graph.lookup_name(frame)\n            if velocity is None:\n                velocity = 0 * u.m / u.s, 0 * u.m / u.s, 0 * u.m / u.s\n            elif velocity.shape != (3,):\n                raise ValueError('velocity should be a Quantity vector with 3 elements')\n            frame = frame_cls(0 * u.m, 0 * u.m, 0 * u.m,\n                              *velocity,\n                              representation_type='cartesian',\n                              differential_type='cartesian')\n\n        observer = update_differentials_to_match(self.observer, frame,\n                                                 preserve_observer_frame=preserve_observer_frame)\n\n        # Calculate the initial and final los velocity\n        init_obs_vel = self._calculate_radial_velocity(self.observer, self.target, as_scalar=True)\n        fin_obs_vel = self._calculate_radial_velocity(observer, self.target, as_scalar=True)\n\n        # Apply transformation to data\n        new_data = _apply_relativistic_doppler_shift(self, fin_obs_vel - init_obs_vel)\n\n        new_coord = self.replicate(value=new_data, observer=observer)\n\n        return new_coord"},{"attributeType":"null","col":8,"comment":"null","endLoc":689,"id":4417,"name":"_wrap_angle","nodeType":"Attribute","startLoc":689,"text":"self._wrap_angle"},{"attributeType":"null","col":8,"comment":"null","endLoc":670,"id":4418,"name":"self","nodeType":"Attribute","startLoc":670,"text":"self"},{"className":"AngleType","col":0,"comment":"null","endLoc":22,"id":4419,"nodeType":"Class","startLoc":12,"text":"class AngleType(QuantityType):\n    name = \"coordinates/angle\"\n    types = [Angle]\n    requires = ['astropy']\n    version = \"1.0.0\"\n    organization = 'astropy.org'\n    standard = 'astropy'\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        return Angle(super().from_tree(node, ctx))"},{"col":4,"comment":"null","endLoc":22,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":4420,"name":"from_tree","nodeType":"Function","startLoc":20,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        return Angle(super().from_tree(node, ctx))"},{"attributeType":"null","col":4,"comment":"null","endLoc":13,"id":4421,"name":"name","nodeType":"Attribute","startLoc":13,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":14,"id":4422,"name":"types","nodeType":"Attribute","startLoc":14,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":15,"id":4423,"name":"requires","nodeType":"Attribute","startLoc":15,"text":"requires"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":4424,"name":"version","nodeType":"Attribute","startLoc":16,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":4425,"name":"organization","nodeType":"Attribute","startLoc":17,"text":"organization"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":4426,"name":"standard","nodeType":"Attribute","startLoc":18,"text":"standard"},{"className":"LatitudeType","col":0,"comment":"null","endLoc":31,"id":4427,"nodeType":"Class","startLoc":25,"text":"class LatitudeType(AngleType):\n    name = \"coordinates/latitude\"\n    types = [Latitude]\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        return Latitude(super().from_tree(node, ctx))"},{"col":4,"comment":"null","endLoc":31,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":4428,"name":"from_tree","nodeType":"Function","startLoc":29,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        return Latitude(super().from_tree(node, ctx))"},{"col":4,"comment":"null","endLoc":3642,"header":"@property\n    def input_units(self)","id":4429,"name":"input_units","nodeType":"Function","startLoc":3634,"text":"@property\n    def input_units(self):\n        inputs_map = self.inputs_map()\n        input_units_dict = {key: inputs_map[key][0].input_units[orig_key]\n                            for key, (mod, orig_key) in inputs_map.items()\n                            if inputs_map[key][0].input_units is not None}\n        if input_units_dict:\n            return input_units_dict\n        return None"},{"col":4,"comment":"null","endLoc":3655,"header":"@property\n    def input_units_equivalencies(self)","id":4430,"name":"input_units_equivalencies","nodeType":"Function","startLoc":3644,"text":"@property\n    def input_units_equivalencies(self):\n        inputs_map = self.inputs_map()\n        input_units_equivalencies_dict = {\n            key: inputs_map[key][0].input_units_equivalencies[orig_key]\n            for key, (mod, orig_key) in inputs_map.items()\n            if inputs_map[key][0].input_units_equivalencies is not None\n        }\n        if not input_units_equivalencies_dict:\n            return None\n\n        return input_units_equivalencies_dict"},{"col":4,"comment":"null","endLoc":180,"header":"def __new__(cls, value=None, unit=None, z=None, cosmology=None,\n                distmod=None, parallax=None, dtype=None, copy=True, order=None,\n                subok=False, ndmin=0, allow_negative=False)","id":4431,"name":"__new__","nodeType":"Function","startLoc":102,"text":"def __new__(cls, value=None, unit=None, z=None, cosmology=None,\n                distmod=None, parallax=None, dtype=None, copy=True, order=None,\n                subok=False, ndmin=0, allow_negative=False):\n\n        n_not_none = sum(x is not None for x in [value, z, distmod, parallax])\n        if n_not_none == 0:\n            raise ValueError('none of `value`, `z`, `distmod`, or `parallax` '\n                             'were given to Distance constructor')\n        elif n_not_none > 1:\n            raise ValueError('more than one of `value`, `z`, `distmod`, or '\n                             '`parallax` were given to Distance constructor')\n\n        if value is None:\n            # If something else but `value` was provided then a new array will\n            # be created anyways and there is no need to copy that.\n            copy = False\n\n        if z is not None:\n            if cosmology is None:\n                from astropy.cosmology import default_cosmology\n                cosmology = default_cosmology.get()\n\n            value = cosmology.luminosity_distance(z)\n\n        elif cosmology is not None:\n            raise ValueError('a `cosmology` was given but `z` was not '\n                             'provided in Distance constructor')\n\n        elif distmod is not None:\n            value = cls._distmod_to_pc(distmod)\n            if unit is None:\n                # if the unit is not specified, guess based on the mean of\n                # the log of the distance\n                meanlogval = np.log10(value.value).mean()\n                if meanlogval > 6:\n                    unit = u.Mpc\n                elif meanlogval > 3:\n                    unit = u.kpc\n                elif meanlogval < -3:  # ~200 AU\n                    unit = u.AU\n                else:\n                    unit = u.pc\n\n        elif parallax is not None:\n            if unit is None:\n                unit = u.pc\n            value = parallax.to_value(unit, equivalencies=u.parallax())\n\n            if np.any(parallax < 0):\n                if allow_negative:\n                    warnings.warn(\n                        \"negative parallaxes are converted to NaN \"\n                        \"distances even when `allow_negative=True`, \"\n                        \"because negative parallaxes cannot be transformed \"\n                        \"into distances. See the discussion in this paper: \"\n                        \"https://arxiv.org/abs/1507.02105\", AstropyWarning)\n                else:\n                    raise ValueError(\n                        \"some parallaxes are negative, which are not \"\n                        \"interpretable as distances. See the discussion in \"\n                        \"this paper: https://arxiv.org/abs/1507.02105 . You \"\n                        \"can convert negative parallaxes to NaN distances by \"\n                        \"providing the `allow_negative=True` argument.\")\n\n        # now we have arguments like for a Quantity, so let it do the work\n        distance = super().__new__(\n            cls, value, unit, dtype=dtype, copy=copy, order=order,\n            subok=subok, ndmin=ndmin)\n\n        # This invalid catch block can be removed when the minimum numpy\n        # version is >= 1.19 (NUMPY_LT_1_19)\n        with np.errstate(invalid='ignore'):\n            any_negative = np.any(distance.value < 0)\n\n        if not allow_negative and any_negative:\n            raise ValueError(\"distance must be >= 0. Use the argument \"\n                             \"`allow_negative=True` to allow negative values.\")\n\n        return distance"},{"attributeType":"null","col":4,"comment":"null","endLoc":26,"id":4432,"name":"name","nodeType":"Attribute","startLoc":26,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":27,"id":4433,"name":"types","nodeType":"Attribute","startLoc":27,"text":"types"},{"className":"LongitudeType","col":0,"comment":"null","endLoc":48,"id":4434,"nodeType":"Class","startLoc":34,"text":"class LongitudeType(AngleType):\n    name = \"coordinates/longitude\"\n    types = [Longitude]\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        wrap_angle = node['wrap_angle']\n        return Longitude(super().from_tree(node, ctx), wrap_angle=wrap_angle)\n\n    @classmethod\n    def to_tree(cls, longitude, ctx):\n        tree = super().to_tree(longitude, ctx)\n        tree['wrap_angle'] = longitude.wrap_angle\n\n        return tree"},{"col":4,"comment":"null","endLoc":41,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":4435,"name":"from_tree","nodeType":"Function","startLoc":38,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        wrap_angle = node['wrap_angle']\n        return Longitude(super().from_tree(node, ctx), wrap_angle=wrap_angle)"},{"col":4,"comment":"null","endLoc":3661,"header":"@property\n    def input_units_allow_dimensionless(self)","id":4436,"name":"input_units_allow_dimensionless","nodeType":"Function","startLoc":3657,"text":"@property\n    def input_units_allow_dimensionless(self):\n        inputs_map = self.inputs_map()\n        return {key: inputs_map[key][0].input_units_allow_dimensionless[orig_key]\n                for key, (mod, orig_key) in inputs_map.items()}"},{"col":4,"comment":"null","endLoc":3667,"header":"@property\n    def input_units_strict(self)","id":4437,"name":"input_units_strict","nodeType":"Function","startLoc":3663,"text":"@property\n    def input_units_strict(self):\n        inputs_map = self.inputs_map()\n        return {key: inputs_map[key][0].input_units_strict[orig_key]\n                for key, (mod, orig_key) in inputs_map.items()}"},{"col":4,"comment":"null","endLoc":3674,"header":"@property\n    def return_units(self)","id":4438,"name":"return_units","nodeType":"Function","startLoc":3669,"text":"@property\n    def return_units(self):\n        outputs_map = self.outputs_map()\n        return {key: outputs_map[key][0].return_units[orig_key]\n                for key, (mod, orig_key) in outputs_map.items()\n                if outputs_map[key][0].return_units is not None}"},{"col":4,"comment":"\n        Map the names of the outputs to this ExpressionTree to the outputs to the leaf models.\n        ","endLoc":3719,"header":"def outputs_map(self)","id":4439,"name":"outputs_map","nodeType":"Function","startLoc":3676,"text":"def outputs_map(self):\n        \"\"\"\n        Map the names of the outputs to this ExpressionTree to the outputs to the leaf models.\n        \"\"\"\n        outputs_map = {}\n        if not isinstance(self.op, str):  # If we don't have an operator the mapping is trivial\n            return {out: (self, out) for out in self.outputs}\n\n        elif self.op == '|':\n            if isinstance(self.right, CompoundModel):\n                r_outputs_map = self.right.outputs_map()\n            for out in self.outputs:\n                if isinstance(self.right, CompoundModel):\n                    outputs_map[out] = r_outputs_map[out]\n                else:\n                    outputs_map[out] = self.right, out\n\n        elif self.op == '&':\n            if isinstance(self.left, CompoundModel):\n                l_outputs_map = self.left.outputs_map()\n            if isinstance(self.right, CompoundModel):\n                r_outputs_map = self.right.outputs_map()\n            for i, out in enumerate(self.outputs):\n                if i < len(self.left.outputs):  # Get from left\n                    if isinstance(self.left, CompoundModel):\n                        outputs_map[out] = l_outputs_map[self.left.outputs[i]]\n                    else:\n                        outputs_map[out] = self.left, self.left.outputs[i]\n                else:  # Get from right\n                    if isinstance(self.right, CompoundModel):\n                        outputs_map[out] = r_outputs_map[self.right.outputs[i - len(self.left.outputs)]]\n                    else:\n                        outputs_map[out] = self.right, self.right.outputs[i - len(self.left.outputs)]\n        elif self.op == 'fix_inputs':\n            return self.left.outputs_map()\n        else:\n            if isinstance(self.left, CompoundModel):\n                l_outputs_map = self.left.outputs_map()\n            for out in self.left.outputs:\n                if isinstance(self.left, CompoundModel):\n                    outputs_map[out] = l_outputs_map()[out]\n                else:\n                    outputs_map[out] = self.left, out\n        return outputs_map"},{"col":4,"comment":"null","endLoc":48,"header":"@classmethod\n    def to_tree(cls, longitude, ctx)","id":4440,"name":"to_tree","nodeType":"Function","startLoc":43,"text":"@classmethod\n    def to_tree(cls, longitude, ctx):\n        tree = super().to_tree(longitude, ctx)\n        tree['wrap_angle'] = longitude.wrap_angle\n\n        return tree"},{"attributeType":"null","col":4,"comment":"null","endLoc":35,"id":4441,"name":"name","nodeType":"Attribute","startLoc":35,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":36,"id":4442,"name":"types","nodeType":"Attribute","startLoc":36,"text":"types"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":4443,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"angle.py#<anonymous>","id":4444,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['AngleType', 'LatitudeType', 'LongitudeType']"},{"col":4,"comment":"\n        Cache for this frame, a dict.  It stores anything that should be\n        computed from the coordinate data (*not* from the frame attributes).\n        This can be used in functions to store anything that might be\n        expensive to compute but might be re-used by some other function.\n        E.g.::\n\n            if 'user_data' in myframe.cache:\n                data = myframe.cache['user_data']\n            else:\n                myframe.cache['user_data'] = data = expensive_func(myframe.lat)\n\n        If in-place modifications are made to the frame data, the cache should\n        be cleared::\n\n            myframe.cache.clear()\n\n        ","endLoc":654,"header":"@lazyproperty\n    def cache(self)","id":4445,"name":"cache","nodeType":"Function","startLoc":634,"text":"@lazyproperty\n    def cache(self):\n        \"\"\"\n        Cache for this frame, a dict.  It stores anything that should be\n        computed from the coordinate data (*not* from the frame attributes).\n        This can be used in functions to store anything that might be\n        expensive to compute but might be re-used by some other function.\n        E.g.::\n\n            if 'user_data' in myframe.cache:\n                data = myframe.cache['user_data']\n            else:\n                myframe.cache['user_data'] = data = expensive_func(myframe.lat)\n\n        If in-place modifications are made to the frame data, the cache should\n        be cleared::\n\n            myframe.cache.clear()\n\n        \"\"\"\n        return defaultdict(dict)"},{"col":4,"comment":"\n        The coordinate data for this object.  If this frame has no data, an\n        `ValueError` will be raised.  Use `has_data` to\n        check if data is present on this frame object.\n        ","endLoc":666,"header":"@property\n    def data(self)","id":4446,"name":"data","nodeType":"Function","startLoc":656,"text":"@property\n    def data(self):\n        \"\"\"\n        The coordinate data for this object.  If this frame has no data, an\n        `ValueError` will be raised.  Use `has_data` to\n        check if data is present on this frame object.\n        \"\"\"\n        if self._data is None:\n            raise ValueError('The frame object \"{!r}\" does not have '\n                             'associated data'.format(self))\n        return self._data"},{"col":4,"comment":"null","endLoc":86,"header":"@classmethod\n    def to_tree_tagged(cls, model, ctx)","id":4447,"name":"to_tree_tagged","nodeType":"Function","startLoc":63,"text":"@classmethod\n    def to_tree_tagged(cls, model, ctx):\n        left = model.left\n\n        if isinstance(model.right, dict):\n            right = {\n                'keys': list(model.right.keys()),\n                'values': list(model.right.values())\n            }\n        else:\n            right = model.right\n\n        node = {\n            'forward': [left, right]\n        }\n\n        try:\n            tag_name = 'transform/' + _operator_to_tag_mapping[model.op]\n        except KeyError:\n            raise ValueError(f\"Unknown operator '{model.op}'\")\n\n        node = tagged.tag_object(cls.make_yaml_tag(tag_name), node, ctx=ctx)\n\n        return cls._to_tree_base_transform_members(model, node, ctx)"},{"col":4,"comment":"\n        True if this frame has `data`, False otherwise.\n        ","endLoc":673,"header":"@property\n    def has_data(self)","id":4448,"name":"has_data","nodeType":"Function","startLoc":668,"text":"@property\n    def has_data(self):\n        \"\"\"\n        True if this frame has `data`, False otherwise.\n        \"\"\"\n        return self._data is not None"},{"col":4,"comment":"null","endLoc":677,"header":"@property\n    def shape(self)","id":4449,"name":"shape","nodeType":"Function","startLoc":675,"text":"@property\n    def shape(self):\n        return self.data.shape if self.has_data else self._no_data_shape"},{"col":4,"comment":"null","endLoc":682,"header":"def __len__(self)","id":4450,"name":"__len__","nodeType":"Function","startLoc":681,"text":"def __len__(self):\n        return len(self.data)"},{"col":4,"comment":"null","endLoc":685,"header":"def __bool__(self)","id":4451,"name":"__bool__","nodeType":"Function","startLoc":684,"text":"def __bool__(self):\n        return self.has_data and self.size > 0"},{"col":4,"comment":"null","endLoc":689,"header":"@property\n    def size(self)","id":4452,"name":"size","nodeType":"Function","startLoc":687,"text":"@property\n    def size(self):\n        return self.data.size"},{"col":4,"comment":"null","endLoc":693,"header":"@property\n    def isscalar(self)","id":4453,"name":"isscalar","nodeType":"Function","startLoc":691,"text":"@property\n    def isscalar(self):\n        return self.has_data and self.data.isscalar"},{"col":4,"comment":"Set representation and/or differential class for this frame's data.\n\n        Parameters\n        ----------\n        base : str, `~astropy.coordinates.BaseRepresentation` subclass, optional\n            The name or subclass to use to represent the coordinate data.\n        s : `~astropy.coordinates.BaseDifferential` subclass, optional\n            The differential subclass to use to represent any velocities,\n            such as proper motion and radial velocity.  If equal to 'base',\n            which is the default, it will be inferred from the representation.\n            If `None`, the representation will drop any differentials.\n        ","endLoc":735,"header":"def set_representation_cls(self, base=None, s='base')","id":4454,"name":"set_representation_cls","nodeType":"Function","startLoc":720,"text":"def set_representation_cls(self, base=None, s='base'):\n        \"\"\"Set representation and/or differential class for this frame's data.\n\n        Parameters\n        ----------\n        base : str, `~astropy.coordinates.BaseRepresentation` subclass, optional\n            The name or subclass to use to represent the coordinate data.\n        s : `~astropy.coordinates.BaseDifferential` subclass, optional\n            The differential subclass to use to represent any velocities,\n            such as proper motion and radial velocity.  If equal to 'base',\n            which is the default, it will be inferred from the representation.\n            If `None`, the representation will drop any differentials.\n        \"\"\"\n        if base is None:\n            base = self._representation['base']\n        self._representation = _get_repr_classes(base=base, s=s)"},{"col":4,"comment":"\n        The differential used for this frame's data.\n\n        This will be a subclass from `~astropy.coordinates.BaseDifferential`.\n        For simultaneous setting of representation and differentials, see the\n        ``set_representation_cls`` method.\n        ","endLoc":756,"header":"@property\n    def differential_type(self)","id":4455,"name":"differential_type","nodeType":"Function","startLoc":747,"text":"@property\n    def differential_type(self):\n        \"\"\"\n        The differential used for this frame's data.\n\n        This will be a subclass from `~astropy.coordinates.BaseDifferential`.\n        For simultaneous setting of representation and differentials, see the\n        ``set_representation_cls`` method.\n        \"\"\"\n        return self.get_representation_cls('s')"},{"fileName":"representation.py","filePath":"astropy/io/misc/asdf/tags/coordinates","id":4456,"nodeType":"File","text":"import astropy.units as u\nimport astropy.coordinates.representation\nfrom astropy.coordinates.representation import BaseRepresentationOrDifferential\n\nfrom astropy.io.misc.asdf.types import AstropyType\n\n\nclass RepresentationType(AstropyType):\n    name = \"coordinates/representation\"\n    types = [BaseRepresentationOrDifferential]\n    version = \"1.0.0\"\n\n    _representation_module = astropy.coordinates.representation\n\n    @classmethod\n    def to_tree(cls, representation, ctx):\n        comps = representation.components\n        components = {}\n        for c in comps:\n            value = getattr(representation, '_' + c, None)\n            if value is not None:\n                components[c] = value\n\n        t = type(representation)\n\n        node = {}\n        node['type'] = t.__name__\n        node['components'] = components\n\n        return node\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        rep_type = getattr(cls._representation_module, node['type'])\n        return rep_type(**node['components'])\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        assert isinstance(new, type(old))\n        assert new.components == old.components\n        for comp in new.components:\n            nc = getattr(new, comp)\n            oc = getattr(old, comp)\n            assert u.allclose(nc, oc)\n"},{"col":4,"comment":"null","endLoc":760,"header":"@differential_type.setter\n    def differential_type(self, value)","id":4457,"name":"differential_type","nodeType":"Function","startLoc":758,"text":"@differential_type.setter\n    def differential_type(self, value):\n        self.set_representation_cls(s=value)"},{"className":"BaseRepresentationOrDifferential","col":0,"comment":"3D coordinate representations and differentials.\n\n    Parameters\n    ----------\n    comp1, comp2, comp3 : `~astropy.units.Quantity` or subclass\n        The components of the 3D point or differential.  The names are the\n        keys and the subclasses the values of the ``attr_classes`` attribute.\n    copy : bool, optional\n        If `True` (default), arrays will be copied; if `False`, they will be\n        broadcast together but not use new memory.\n    ","endLoc":533,"id":4458,"nodeType":"Class","startLoc":163,"text":"class BaseRepresentationOrDifferential(ShapedLikeNDArray):\n    \"\"\"3D coordinate representations and differentials.\n\n    Parameters\n    ----------\n    comp1, comp2, comp3 : `~astropy.units.Quantity` or subclass\n        The components of the 3D point or differential.  The names are the\n        keys and the subclasses the values of the ``attr_classes`` attribute.\n    copy : bool, optional\n        If `True` (default), arrays will be copied; if `False`, they will be\n        broadcast together but not use new memory.\n    \"\"\"\n\n    # Ensure multiplication/division with ndarray or Quantity doesn't lead to\n    # object arrays.\n    __array_priority__ = 50000\n\n    info = BaseRepresentationOrDifferentialInfo()\n\n    def __init__(self, *args, **kwargs):\n        # make argument a list, so we can pop them off.\n        args = list(args)\n        components = self.components\n        if (args and isinstance(args[0], self.__class__)\n                and all(arg is None for arg in args[1:])):\n            rep_or_diff = args[0]\n            copy = kwargs.pop('copy', True)\n            attrs = [getattr(rep_or_diff, component)\n                     for component in components]\n            if 'info' in rep_or_diff.__dict__:\n                self.info = rep_or_diff.info\n\n            if kwargs:\n                raise TypeError(f'unexpected keyword arguments for case '\n                                f'where class instance is passed in: {kwargs}')\n\n        else:\n            attrs = []\n            for component in components:\n                try:\n                    attr = args.pop(0) if args else kwargs.pop(component)\n                except KeyError:\n                    raise TypeError(f'__init__() missing 1 required positional '\n                                    f'argument: {component!r}') from None\n\n                if attr is None:\n                    raise TypeError(f'__init__() missing 1 required positional '\n                                    f'argument: {component!r} (or first '\n                                    f'argument should be an instance of '\n                                    f'{self.__class__.__name__}).')\n\n                attrs.append(attr)\n\n            copy = args.pop(0) if args else kwargs.pop('copy', True)\n\n            if args:\n                raise TypeError(f'unexpected arguments: {args}')\n\n            if kwargs:\n                for component in components:\n                    if component in kwargs:\n                        raise TypeError(f\"__init__() got multiple values for \"\n                                        f\"argument {component!r}\")\n\n                raise TypeError(f'unexpected keyword arguments: {kwargs}')\n\n        # Pass attributes through the required initializing classes.\n        attrs = [self.attr_classes[component](attr, copy=copy, subok=True)\n                 for component, attr in zip(components, attrs)]\n        try:\n            bc_attrs = np.broadcast_arrays(*attrs, subok=True)\n        except ValueError  as err:\n            if len(components) <= 2:\n                c_str = ' and '.join(components)\n            else:\n                c_str = ', '.join(components[:2]) + ', and ' + components[2]\n            raise ValueError(f\"Input parameters {c_str} cannot be broadcast\") from err\n\n        # The output of np.broadcast_arrays() has limitations on writeability, so we perform\n        # additional handling to enable writeability in most situations.  This is primarily\n        # relevant for allowing the changing of the wrap angle of longitude components.\n        #\n        # If the shape has changed for a given component, broadcasting is needed:\n        #     If copy=True, we make a copy of the broadcasted array to ensure writeability.\n        #         Note that array had already been copied prior to the broadcasting.\n        #         TODO: Find a way to avoid the double copy.\n        #     If copy=False, we use the broadcasted array, and writeability may still be\n        #         limited.\n        # If the shape has not changed for a given component, we can proceed with using the\n        #     non-broadcasted array, which avoids writeability issues from np.broadcast_arrays().\n        attrs = [(bc_attr.copy() if copy else bc_attr) if bc_attr.shape != attr.shape else attr\n                 for attr, bc_attr in zip(attrs, bc_attrs)]\n\n        # Set private attributes for the attributes. (If not defined explicitly\n        # on the class, the metaclass will define properties to access these.)\n        for component, attr in zip(components, attrs):\n            setattr(self, '_' + component, attr)\n\n    @classmethod\n    def get_name(cls):\n        \"\"\"Name of the representation or differential.\n\n        In lower case, with any trailing 'representation' or 'differential'\n        removed. (E.g., 'spherical' for\n        `~astropy.coordinates.SphericalRepresentation` or\n        `~astropy.coordinates.SphericalDifferential`.)\n        \"\"\"\n        name = cls.__name__.lower()\n\n        if name.endswith('representation'):\n            name = name[:-14]\n        elif name.endswith('differential'):\n            name = name[:-12]\n\n        return name\n\n    # The two methods that any subclass has to define.\n    @classmethod\n    @abc.abstractmethod\n    def from_cartesian(cls, other):\n        \"\"\"Create a representation of this class from a supplied Cartesian one.\n\n        Parameters\n        ----------\n        other : `CartesianRepresentation`\n            The representation to turn into this class\n\n        Returns\n        -------\n        representation : `BaseRepresentation` subclass instance\n            A new representation of this class's type.\n        \"\"\"\n        # Note: the above docstring gets overridden for differentials.\n        raise NotImplementedError()\n\n    @abc.abstractmethod\n    def to_cartesian(self):\n        \"\"\"Convert the representation to its Cartesian form.\n\n        Note that any differentials get dropped.\n        Also note that orientation information at the origin is *not* preserved by\n        conversions through Cartesian coordinates. For example, transforming\n        an angular position defined at distance=0 through cartesian coordinates\n        and back will lose the original angular coordinates::\n\n            >>> import astropy.units as u\n            >>> import astropy.coordinates as coord\n            >>> rep = coord.SphericalRepresentation(\n            ...     lon=15*u.deg,\n            ...     lat=-11*u.deg,\n            ...     distance=0*u.pc)\n            >>> rep.to_cartesian().represent_as(coord.SphericalRepresentation)\n            <SphericalRepresentation (lon, lat, distance) in (rad, rad, pc)\n                (0., 0., 0.)>\n\n        Returns\n        -------\n        cartrepr : `CartesianRepresentation`\n            The representation in Cartesian form.\n        \"\"\"\n        # Note: the above docstring gets overridden for differentials.\n        raise NotImplementedError()\n\n    @property\n    def components(self):\n        \"\"\"A tuple with the in-order names of the coordinate components.\"\"\"\n        return tuple(self.attr_classes)\n\n    def __eq__(self, value):\n        \"\"\"Equality operator\n\n        This implements strict equality and requires that the representation\n        classes are identical and that the representation data are exactly equal.\n        \"\"\"\n        if self.__class__ is not value.__class__:\n            raise TypeError(f'cannot compare: objects must have same class: '\n                            f'{self.__class__.__name__} vs. '\n                            f'{value.__class__.__name__}')\n\n        try:\n            np.broadcast(self, value)\n        except ValueError as exc:\n            raise ValueError(f'cannot compare: {exc}') from exc\n\n        out = True\n        for comp in self.components:\n            out &= (getattr(self, '_' + comp) == getattr(value, '_' + comp))\n\n        return out\n\n    def __ne__(self, value):\n        return np.logical_not(self == value)\n\n    def _apply(self, method, *args, **kwargs):\n        \"\"\"Create a new representation or differential with ``method`` applied\n        to the component data.\n\n        In typical usage, the method is any of the shape-changing methods for\n        `~numpy.ndarray` (``reshape``, ``swapaxes``, etc.), as well as those\n        picking particular elements (``__getitem__``, ``take``, etc.), which\n        are all defined in `~astropy.utils.shapes.ShapedLikeNDArray`. It will be\n        applied to the underlying arrays (e.g., ``x``, ``y``, and ``z`` for\n        `~astropy.coordinates.CartesianRepresentation`), with the results used\n        to create a new instance.\n\n        Internally, it is also used to apply functions to the components\n        (in particular, `~numpy.broadcast_to`).\n\n        Parameters\n        ----------\n        method : str or callable\n            If str, it is the name of a method that is applied to the internal\n            ``components``. If callable, the function is applied.\n        *args : tuple\n            Any positional arguments for ``method``.\n        **kwargs : dict\n            Any keyword arguments for ``method``.\n        \"\"\"\n        if callable(method):\n            apply_method = lambda array: method(array, *args, **kwargs)\n        else:\n            apply_method = operator.methodcaller(method, *args, **kwargs)\n\n        new = super().__new__(self.__class__)\n        for component in self.components:\n            setattr(new, '_' + component,\n                    apply_method(getattr(self, component)))\n\n        # Copy other 'info' attr only if it has actually been defined.\n        # See PR #3898 for further explanation and justification, along\n        # with Quantity.__array_finalize__\n        if 'info' in self.__dict__:\n            new.info = self.info\n\n        return new\n\n    def __setitem__(self, item, value):\n        if value.__class__ is not self.__class__:\n            raise TypeError(f'can only set from object of same class: '\n                            f'{self.__class__.__name__} vs. '\n                            f'{value.__class__.__name__}')\n\n        for component in self.components:\n            getattr(self, '_' + component)[item] = getattr(value, '_' + component)\n\n    @property\n    def shape(self):\n        \"\"\"The shape of the instance and underlying arrays.\n\n        Like `~numpy.ndarray.shape`, can be set to a new shape by assigning a\n        tuple.  Note that if different instances share some but not all\n        underlying data, setting the shape of one instance can make the other\n        instance unusable.  Hence, it is strongly recommended to get new,\n        reshaped instances with the ``reshape`` method.\n\n        Raises\n        ------\n        ValueError\n            If the new shape has the wrong total number of elements.\n        AttributeError\n            If the shape of any of the components cannot be changed without the\n            arrays being copied.  For these cases, use the ``reshape`` method\n            (which copies any arrays that cannot be reshaped in-place).\n        \"\"\"\n        return getattr(self, self.components[0]).shape\n\n    @shape.setter\n    def shape(self, shape):\n        # We keep track of arrays that were already reshaped since we may have\n        # to return those to their original shape if a later shape-setting\n        # fails. (This can happen since coordinates are broadcast together.)\n        reshaped = []\n        oldshape = self.shape\n        for component in self.components:\n            val = getattr(self, component)\n            if val.size > 1:\n                try:\n                    val.shape = shape\n                except Exception:\n                    for val2 in reshaped:\n                        val2.shape = oldshape\n                    raise\n                else:\n                    reshaped.append(val)\n\n    # Required to support multiplication and division, and defined by the base\n    # representation and differential classes.\n    @abc.abstractmethod\n    def _scale_operation(self, op, *args):\n        raise NotImplementedError()\n\n    def __mul__(self, other):\n        return self._scale_operation(operator.mul, other)\n\n    def __rmul__(self, other):\n        return self.__mul__(other)\n\n    def __truediv__(self, other):\n        return self._scale_operation(operator.truediv, other)\n\n    def __neg__(self):\n        return self._scale_operation(operator.neg)\n\n    # Follow numpy convention and make an independent copy.\n    def __pos__(self):\n        return self.copy()\n\n    # Required to support addition and subtraction, and defined by the base\n    # representation and differential classes.\n    @abc.abstractmethod\n    def _combine_operation(self, op, other, reverse=False):\n        raise NotImplementedError()\n\n    def __add__(self, other):\n        return self._combine_operation(operator.add, other)\n\n    def __radd__(self, other):\n        return self._combine_operation(operator.add, other, reverse=True)\n\n    def __sub__(self, other):\n        return self._combine_operation(operator.sub, other)\n\n    def __rsub__(self, other):\n        return self._combine_operation(operator.sub, other, reverse=True)\n\n    # The following are used for repr and str\n    @property\n    def _values(self):\n        \"\"\"Turn the coordinates into a record array with the coordinate values.\n\n        The record array fields will have the component names.\n        \"\"\"\n        coo_items = [(c, getattr(self, c)) for c in self.components]\n        result = np.empty(self.shape, [(c, coo.dtype) for c, coo in coo_items])\n        for c, coo in coo_items:\n            result[c] = coo.value\n        return result\n\n    @property\n    def _units(self):\n        \"\"\"Return a dictionary with the units of the coordinate components.\"\"\"\n        return dict([(component, getattr(self, component).unit)\n                     for component in self.components])\n\n    @property\n    def _unitstr(self):\n        units_set = set(self._units.values())\n        if len(units_set) == 1:\n            unitstr = units_set.pop().to_string()\n        else:\n            unitstr = '({})'.format(\n                ', '.join([self._units[component].to_string()\n                           for component in self.components]))\n        return unitstr\n\n    def __str__(self):\n        return f'{_array2string(self._values)} {self._unitstr:s}'\n\n    def __repr__(self):\n        prefixstr = '    '\n        arrstr = _array2string(self._values, prefix=prefixstr)\n\n        diffstr = ''\n        if getattr(self, 'differentials', None):\n            diffstr = '\\n (has differentials w.r.t.: {})'.format(\n                ', '.join([repr(key) for key in self.differentials.keys()]))\n\n        unitstr = ('in ' + self._unitstr) if self._unitstr else '[dimensionless]'\n        return '<{} ({}) {:s}\\n{}{}{}>'.format(\n            self.__class__.__name__, ', '.join(self.components),\n            unitstr, prefixstr, arrstr, diffstr)"},{"col":4,"comment":"Name of the representation or differential.\n\n        In lower case, with any trailing 'representation' or 'differential'\n        removed. (E.g., 'spherical' for\n        `~astropy.coordinates.SphericalRepresentation` or\n        `~astropy.coordinates.SphericalDifferential`.)\n        ","endLoc":277,"header":"@classmethod\n    def get_name(cls)","id":4459,"name":"get_name","nodeType":"Function","startLoc":261,"text":"@classmethod\n    def get_name(cls):\n        \"\"\"Name of the representation or differential.\n\n        In lower case, with any trailing 'representation' or 'differential'\n        removed. (E.g., 'spherical' for\n        `~astropy.coordinates.SphericalRepresentation` or\n        `~astropy.coordinates.SphericalDifferential`.)\n        \"\"\"\n        name = cls.__name__.lower()\n\n        if name.endswith('representation'):\n            name = name[:-14]\n        elif name.endswith('differential'):\n            name = name[:-12]\n\n        return name"},{"col":4,"comment":"null","endLoc":806,"header":"@classmethod\n    def _get_representation_info(cls)","id":4460,"name":"_get_representation_info","nodeType":"Function","startLoc":762,"text":"@classmethod\n    def _get_representation_info(cls):\n        # This exists as a class method only to support handling frame inputs\n        # without units, which are deprecated and will be removed.  This can be\n        # moved into the representation_info property at that time.\n        # note that if so moved, the cache should be acceessed as\n        # self.__class__._frame_class_cache\n\n        if cls._frame_class_cache.get('last_reprdiff_hash', None) != r.get_reprdiff_cls_hash():\n            repr_attrs = {}\n            for repr_diff_cls in (list(r.REPRESENTATION_CLASSES.values()) +\n                                  list(r.DIFFERENTIAL_CLASSES.values())):\n                repr_attrs[repr_diff_cls] = {'names': [], 'units': []}\n                for c, c_cls in repr_diff_cls.attr_classes.items():\n                    repr_attrs[repr_diff_cls]['names'].append(c)\n                    rec_unit = u.deg if issubclass(c_cls, Angle) else None\n                    repr_attrs[repr_diff_cls]['units'].append(rec_unit)\n\n            for repr_diff_cls, mappings in cls._frame_specific_representation_info.items():\n\n                # take the 'names' and 'units' tuples from repr_attrs,\n                # and then use the RepresentationMapping objects\n                # to update as needed for this frame.\n                nms = repr_attrs[repr_diff_cls]['names']\n                uns = repr_attrs[repr_diff_cls]['units']\n                comptomap = dict([(m.reprname, m) for m in mappings])\n                for i, c in enumerate(repr_diff_cls.attr_classes.keys()):\n                    if c in comptomap:\n                        mapp = comptomap[c]\n                        nms[i] = mapp.framename\n\n                        # need the isinstance because otherwise if it's a unit it\n                        # will try to compare to the unit string representation\n                        if not (isinstance(mapp.defaultunit, str)\n                                and mapp.defaultunit == 'recommended'):\n                            uns[i] = mapp.defaultunit\n                            # else we just leave it as recommended_units says above\n\n                # Convert to tuples so that this can't mess with frame internals\n                repr_attrs[repr_diff_cls]['names'] = tuple(nms)\n                repr_attrs[repr_diff_cls]['units'] = tuple(uns)\n\n            cls._frame_class_cache['representation_info'] = repr_attrs\n            cls._frame_class_cache['last_reprdiff_hash'] = r.get_reprdiff_cls_hash()\n        return cls._frame_class_cache['representation_info']"},{"col":4,"comment":"Create a representation of this class from a supplied Cartesian one.\n\n        Parameters\n        ----------\n        other : `CartesianRepresentation`\n            The representation to turn into this class\n\n        Returns\n        -------\n        representation : `BaseRepresentation` subclass instance\n            A new representation of this class's type.\n        ","endLoc":296,"header":"@classmethod\n    @abc.abstractmethod\n    def from_cartesian(cls, other)","id":4461,"name":"from_cartesian","nodeType":"Function","startLoc":280,"text":"@classmethod\n    @abc.abstractmethod\n    def from_cartesian(cls, other):\n        \"\"\"Create a representation of this class from a supplied Cartesian one.\n\n        Parameters\n        ----------\n        other : `CartesianRepresentation`\n            The representation to turn into this class\n\n        Returns\n        -------\n        representation : `BaseRepresentation` subclass instance\n            A new representation of this class's type.\n        \"\"\"\n        # Note: the above docstring gets overridden for differentials.\n        raise NotImplementedError()"},{"col":4,"comment":"A tuple with the in-order names of the coordinate components.","endLoc":329,"header":"@property\n    def components(self)","id":4462,"name":"components","nodeType":"Function","startLoc":326,"text":"@property\n    def components(self):\n        \"\"\"A tuple with the in-order names of the coordinate components.\"\"\"\n        return tuple(self.attr_classes)"},{"col":4,"comment":"Get the science state value of ``key``.\n\n        Parameters\n        ----------\n        key : str or None\n            The built-in |Cosmology| realization to retrieve.\n            If None (default) get the current value.\n\n        Returns\n        -------\n        `astropy.cosmology.Cosmology` or None\n            `None` only if ``key`` is \"no_default\"\n\n        Raises\n        ------\n        TypeError\n            If ``key`` is not a str, |Cosmology|, or None.\n        ValueError\n            If ``key`` is a str, but not for a built-in Cosmology\n\n        Examples\n        --------\n        To get the default cosmology:\n\n        >>> default_cosmology.get()\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966, ...\n\n        To get a specific cosmology:\n\n        >>> default_cosmology.get(\"Planck13\")\n        FlatLambdaCDM(name=\"Planck13\", H0=67.77 km / (Mpc s), Om0=0.30712, ...\n        ","endLoc":140,"header":"@classmethod\n    def get(cls, key=None)","id":4463,"name":"get","nodeType":"Function","startLoc":86,"text":"@classmethod\n    def get(cls, key=None):\n        \"\"\"Get the science state value of ``key``.\n\n        Parameters\n        ----------\n        key : str or None\n            The built-in |Cosmology| realization to retrieve.\n            If None (default) get the current value.\n\n        Returns\n        -------\n        `astropy.cosmology.Cosmology` or None\n            `None` only if ``key`` is \"no_default\"\n\n        Raises\n        ------\n        TypeError\n            If ``key`` is not a str, |Cosmology|, or None.\n        ValueError\n            If ``key`` is a str, but not for a built-in Cosmology\n\n        Examples\n        --------\n        To get the default cosmology:\n\n        >>> default_cosmology.get()\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966, ...\n\n        To get a specific cosmology:\n\n        >>> default_cosmology.get(\"Planck13\")\n        FlatLambdaCDM(name=\"Planck13\", H0=67.77 km / (Mpc s), Om0=0.30712, ...\n        \"\"\"\n        if key is None:\n            key = cls._value\n\n        if isinstance(key, str):\n            # special-case one string\n            if key == \"no_default\":\n                return None\n            # all other options should be built-in realizations\n            try:\n                value = getattr(sys.modules[__name__], key)\n            except AttributeError:\n                raise ValueError(f\"Unknown cosmology {key!r}. \"\n                                 f\"Valid cosmologies:\\n{available}\")\n        elif isinstance(key, Cosmology):\n            value = key\n        else:\n            raise TypeError(\"'key' must be must be None, a string, \"\n                            f\"or Cosmology instance, not {type(key)}.\")\n\n        # validate value to `Cosmology`, if not already\n        return cls.validate(value)"},{"col":4,"comment":"Equality operator\n\n        This implements strict equality and requires that the representation\n        classes are identical and that the representation data are exactly equal.\n        ","endLoc":351,"header":"def __eq__(self, value)","id":4464,"name":"__eq__","nodeType":"Function","startLoc":331,"text":"def __eq__(self, value):\n        \"\"\"Equality operator\n\n        This implements strict equality and requires that the representation\n        classes are identical and that the representation data are exactly equal.\n        \"\"\"\n        if self.__class__ is not value.__class__:\n            raise TypeError(f'cannot compare: objects must have same class: '\n                            f'{self.__class__.__name__} vs. '\n                            f'{value.__class__.__name__}')\n\n        try:\n            np.broadcast(self, value)\n        except ValueError as exc:\n            raise ValueError(f'cannot compare: {exc}') from exc\n\n        out = True\n        for comp in self.components:\n            out &= (getattr(self, '_' + comp) == getattr(value, '_' + comp))\n\n        return out"},{"col":4,"comment":"null","endLoc":354,"header":"def __ne__(self, value)","id":4465,"name":"__ne__","nodeType":"Function","startLoc":353,"text":"def __ne__(self, value):\n        return np.logical_not(self == value)"},{"col":4,"comment":"Create a new representation or differential with ``method`` applied\n        to the component data.\n\n        In typical usage, the method is any of the shape-changing methods for\n        `~numpy.ndarray` (``reshape``, ``swapaxes``, etc.), as well as those\n        picking particular elements (``__getitem__``, ``take``, etc.), which\n        are all defined in `~astropy.utils.shapes.ShapedLikeNDArray`. It will be\n        applied to the underlying arrays (e.g., ``x``, ``y``, and ``z`` for\n        `~astropy.coordinates.CartesianRepresentation`), with the results used\n        to create a new instance.\n\n        Internally, it is also used to apply functions to the components\n        (in particular, `~numpy.broadcast_to`).\n\n        Parameters\n        ----------\n        method : str or callable\n            If str, it is the name of a method that is applied to the internal\n            ``components``. If callable, the function is applied.\n        *args : tuple\n            Any positional arguments for ``method``.\n        **kwargs : dict\n            Any keyword arguments for ``method``.\n        ","endLoc":397,"header":"def _apply(self, method, *args, **kwargs)","id":4466,"name":"_apply","nodeType":"Function","startLoc":356,"text":"def _apply(self, method, *args, **kwargs):\n        \"\"\"Create a new representation or differential with ``method`` applied\n        to the component data.\n\n        In typical usage, the method is any of the shape-changing methods for\n        `~numpy.ndarray` (``reshape``, ``swapaxes``, etc.), as well as those\n        picking particular elements (``__getitem__``, ``take``, etc.), which\n        are all defined in `~astropy.utils.shapes.ShapedLikeNDArray`. It will be\n        applied to the underlying arrays (e.g., ``x``, ``y``, and ``z`` for\n        `~astropy.coordinates.CartesianRepresentation`), with the results used\n        to create a new instance.\n\n        Internally, it is also used to apply functions to the components\n        (in particular, `~numpy.broadcast_to`).\n\n        Parameters\n        ----------\n        method : str or callable\n            If str, it is the name of a method that is applied to the internal\n            ``components``. If callable, the function is applied.\n        *args : tuple\n            Any positional arguments for ``method``.\n        **kwargs : dict\n            Any keyword arguments for ``method``.\n        \"\"\"\n        if callable(method):\n            apply_method = lambda array: method(array, *args, **kwargs)\n        else:\n            apply_method = operator.methodcaller(method, *args, **kwargs)\n\n        new = super().__new__(self.__class__)\n        for component in self.components:\n            setattr(new, '_' + component,\n                    apply_method(getattr(self, component)))\n\n        # Copy other 'info' attr only if it has actually been defined.\n        # See PR #3898 for further explanation and justification, along\n        # with Quantity.__array_finalize__\n        if 'info' in self.__dict__:\n            new.info = self.info\n\n        return new"},{"col":4,"comment":"\n        A flag indicating whether or not a custom bounding_box has been\n        assigned to this model by a user, via assignment to\n        ``model.bounding_box``.\n        ","endLoc":3729,"header":"@property\n    def has_user_bounding_box(self)","id":4467,"name":"has_user_bounding_box","nodeType":"Function","startLoc":3721,"text":"@property\n    def has_user_bounding_box(self):\n        \"\"\"\n        A flag indicating whether or not a custom bounding_box has been\n        assigned to this model by a user, via assignment to\n        ``model.bounding_box``.\n        \"\"\"\n\n        return self._user_bounding_box is not None"},{"col":4,"comment":"\n        Evaluate a model at fixed positions, respecting the ``bounding_box``.\n\n        The key difference relative to evaluating the model directly is that\n        this method is limited to a bounding box if the `Model.bounding_box`\n        attribute is set.\n\n        Parameters\n        ----------\n        out : `numpy.ndarray`, optional\n            An array that the evaluated model will be added to.  If this is not\n            given (or given as ``None``), a new array will be created.\n        coords : array-like, optional\n            An array to be used to translate from the model's input coordinates\n            to the ``out`` array. It should have the property that\n            ``self(coords)`` yields the same shape as ``out``.  If ``out`` is\n            not specified, ``coords`` will be used to determine the shape of\n            the returned array. If this is not provided (or None), the model\n            will be evaluated on a grid determined by `Model.bounding_box`.\n\n        Returns\n        -------\n        out : `numpy.ndarray`\n            The model added to ``out`` if  ``out`` is not ``None``, or else a\n            new array from evaluating the model over ``coords``.\n            If ``out`` and ``coords`` are both `None`, the returned array is\n            limited to the `Model.bounding_box` limits. If\n            `Model.bounding_box` is `None`, ``arr`` or ``coords`` must be\n            passed.\n\n        Raises\n        ------\n        ValueError\n            If ``coords`` are not given and the the `Model.bounding_box` of\n            this model is not set.\n\n        Examples\n        --------\n        :ref:`astropy:bounding-boxes`\n        ","endLoc":3841,"header":"def render(self, out=None, coords=None)","id":4468,"name":"render","nodeType":"Function","startLoc":3731,"text":"def render(self, out=None, coords=None):\n        \"\"\"\n        Evaluate a model at fixed positions, respecting the ``bounding_box``.\n\n        The key difference relative to evaluating the model directly is that\n        this method is limited to a bounding box if the `Model.bounding_box`\n        attribute is set.\n\n        Parameters\n        ----------\n        out : `numpy.ndarray`, optional\n            An array that the evaluated model will be added to.  If this is not\n            given (or given as ``None``), a new array will be created.\n        coords : array-like, optional\n            An array to be used to translate from the model's input coordinates\n            to the ``out`` array. It should have the property that\n            ``self(coords)`` yields the same shape as ``out``.  If ``out`` is\n            not specified, ``coords`` will be used to determine the shape of\n            the returned array. If this is not provided (or None), the model\n            will be evaluated on a grid determined by `Model.bounding_box`.\n\n        Returns\n        -------\n        out : `numpy.ndarray`\n            The model added to ``out`` if  ``out`` is not ``None``, or else a\n            new array from evaluating the model over ``coords``.\n            If ``out`` and ``coords`` are both `None`, the returned array is\n            limited to the `Model.bounding_box` limits. If\n            `Model.bounding_box` is `None`, ``arr`` or ``coords`` must be\n            passed.\n\n        Raises\n        ------\n        ValueError\n            If ``coords`` are not given and the the `Model.bounding_box` of\n            this model is not set.\n\n        Examples\n        --------\n        :ref:`astropy:bounding-boxes`\n        \"\"\"\n\n        bbox = self.get_bounding_box()\n\n        ndim = self.n_inputs\n\n        if (coords is None) and (out is None) and (bbox is None):\n            raise ValueError('If no bounding_box is set, '\n                             'coords or out must be input.')\n\n        # for consistent indexing\n        if ndim == 1:\n            if coords is not None:\n                coords = [coords]\n            if bbox is not None:\n                bbox = [bbox]\n\n        if coords is not None:\n            coords = np.asanyarray(coords, dtype=float)\n            # Check dimensions match out and model\n            assert len(coords) == ndim\n            if out is not None:\n                if coords[0].shape != out.shape:\n                    raise ValueError('inconsistent shape of the output.')\n            else:\n                out = np.zeros(coords[0].shape)\n\n        if out is not None:\n            out = np.asanyarray(out)\n            if out.ndim != ndim:\n                raise ValueError('the array and model must have the same '\n                                 'number of dimensions.')\n\n        if bbox is not None:\n            # Assures position is at center pixel, important when using\n            # add_array.\n            pd = np.array([(np.mean(bb), np.ceil((bb[1] - bb[0]) / 2))\n                           for bb in bbox]).astype(int).T\n            pos, delta = pd\n\n            if coords is not None:\n                sub_shape = tuple(delta * 2 + 1)\n                sub_coords = np.array([extract_array(c, sub_shape, pos)\n                                       for c in coords])\n            else:\n                limits = [slice(p - d, p + d + 1, 1) for p, d in pd.T]\n                sub_coords = np.mgrid[limits]\n\n            sub_coords = sub_coords[::-1]\n\n            if out is None:\n                out = self(*sub_coords)\n            else:\n                try:\n                    out = add_array(out, self(*sub_coords), pos)\n                except ValueError:\n                    raise ValueError(\n                        'The `bounding_box` is larger than the input out in '\n                        'one or more dimensions. Set '\n                        '`model.bounding_box = None`.')\n        else:\n            if coords is None:\n                im_shape = out.shape\n                limits = [slice(i) for i in im_shape]\n                coords = np.mgrid[limits]\n\n            coords = coords[::-1]\n\n            out += self(*coords)\n\n        return out"},{"col":27,"endLoc":382,"id":4469,"nodeType":"Lambda","startLoc":382,"text":"lambda array: method(array, *args, **kwargs)"},{"col":4,"comment":"null","endLoc":406,"header":"def __setitem__(self, item, value)","id":4470,"name":"__setitem__","nodeType":"Function","startLoc":399,"text":"def __setitem__(self, item, value):\n        if value.__class__ is not self.__class__:\n            raise TypeError(f'can only set from object of same class: '\n                            f'{self.__class__.__name__} vs. '\n                            f'{value.__class__.__name__}')\n\n        for component in self.components:\n            getattr(self, '_' + component)[item] = getattr(value, '_' + component)"},{"col":4,"comment":"Return a Cosmology given a value.\n\n        Parameters\n        ----------\n        value : None, str, or `~astropy.cosmology.Cosmology`\n\n        Returns\n        -------\n        `~astropy.cosmology.Cosmology` instance\n\n        Raises\n        ------\n        TypeError\n            If ``value`` is not a string or |Cosmology|.\n        ","endLoc":176,"header":"@classmethod\n    def validate(cls, value)","id":4471,"name":"validate","nodeType":"Function","startLoc":148,"text":"@classmethod\n    def validate(cls, value):\n        \"\"\"Return a Cosmology given a value.\n\n        Parameters\n        ----------\n        value : None, str, or `~astropy.cosmology.Cosmology`\n\n        Returns\n        -------\n        `~astropy.cosmology.Cosmology` instance\n\n        Raises\n        ------\n        TypeError\n            If ``value`` is not a string or |Cosmology|.\n        \"\"\"\n        # None -> default\n        if value is None:\n            value = cls._default_value\n\n        # Parse to Cosmology. Error if cannot.\n        if isinstance(value, str):\n            value = cls.get(value)\n        elif not isinstance(value, Cosmology):\n            raise TypeError(\"default_cosmology must be a string or Cosmology instance, \"\n                            f\"not {value}.\")\n\n        return value"},{"col":4,"comment":"The shape of the instance and underlying arrays.\n\n        Like `~numpy.ndarray.shape`, can be set to a new shape by assigning a\n        tuple.  Note that if different instances share some but not all\n        underlying data, setting the shape of one instance can make the other\n        instance unusable.  Hence, it is strongly recommended to get new,\n        reshaped instances with the ``reshape`` method.\n\n        Raises\n        ------\n        ValueError\n            If the new shape has the wrong total number of elements.\n        AttributeError\n            If the shape of any of the components cannot be changed without the\n            arrays being copied.  For these cases, use the ``reshape`` method\n            (which copies any arrays that cannot be reshaped in-place).\n        ","endLoc":427,"header":"@property\n    def shape(self)","id":4472,"name":"shape","nodeType":"Function","startLoc":408,"text":"@property\n    def shape(self):\n        \"\"\"The shape of the instance and underlying arrays.\n\n        Like `~numpy.ndarray.shape`, can be set to a new shape by assigning a\n        tuple.  Note that if different instances share some but not all\n        underlying data, setting the shape of one instance can make the other\n        instance unusable.  Hence, it is strongly recommended to get new,\n        reshaped instances with the ``reshape`` method.\n\n        Raises\n        ------\n        ValueError\n            If the new shape has the wrong total number of elements.\n        AttributeError\n            If the shape of any of the components cannot be changed without the\n            arrays being copied.  For these cases, use the ``reshape`` method\n            (which copies any arrays that cannot be reshaped in-place).\n        \"\"\"\n        return getattr(self, self.components[0]).shape"},{"col":4,"comment":"null","endLoc":446,"header":"@shape.setter\n    def shape(self, shape)","id":4473,"name":"shape","nodeType":"Function","startLoc":429,"text":"@shape.setter\n    def shape(self, shape):\n        # We keep track of arrays that were already reshaped since we may have\n        # to return those to their original shape if a later shape-setting\n        # fails. (This can happen since coordinates are broadcast together.)\n        reshaped = []\n        oldshape = self.shape\n        for component in self.components:\n            val = getattr(self, component)\n            if val.size > 1:\n                try:\n                    val.shape = shape\n                except Exception:\n                    for val2 in reshaped:\n                        val2.shape = oldshape\n                    raise\n                else:\n                    reshaped.append(val)"},{"col":4,"comment":"null","endLoc":452,"header":"@abc.abstractmethod\n    def _scale_operation(self, op, *args)","id":4474,"name":"_scale_operation","nodeType":"Function","startLoc":450,"text":"@abc.abstractmethod\n    def _scale_operation(self, op, *args):\n        raise NotImplementedError()"},{"col":4,"comment":"null","endLoc":455,"header":"def __mul__(self, other)","id":4475,"name":"__mul__","nodeType":"Function","startLoc":454,"text":"def __mul__(self, other):\n        return self._scale_operation(operator.mul, other)"},{"col":4,"comment":"null","endLoc":458,"header":"def __rmul__(self, other)","id":4476,"name":"__rmul__","nodeType":"Function","startLoc":457,"text":"def __rmul__(self, other):\n        return self.__mul__(other)"},{"col":0,"comment":"\n    Given a `SpectralQuantity` and a velocity, return a new `SpectralQuantity`\n    that is Doppler shifted by this amount.\n\n    Note that the Doppler shift applied is the full relativistic one, so\n    `SpectralQuantity` currently expressed in velocity and not using the\n    relativistic convention will temporarily be converted to use the\n    relativistic convention while the shift is applied.\n\n    Positive velocities are assumed to redshift the spectral quantity,\n    while negative velocities blueshift the spectral quantity.\n    ","endLoc":68,"header":"def _apply_relativistic_doppler_shift(scoord, velocity)","id":4477,"name":"_apply_relativistic_doppler_shift","nodeType":"Function","startLoc":36,"text":"def _apply_relativistic_doppler_shift(scoord, velocity):\n    \"\"\"\n    Given a `SpectralQuantity` and a velocity, return a new `SpectralQuantity`\n    that is Doppler shifted by this amount.\n\n    Note that the Doppler shift applied is the full relativistic one, so\n    `SpectralQuantity` currently expressed in velocity and not using the\n    relativistic convention will temporarily be converted to use the\n    relativistic convention while the shift is applied.\n\n    Positive velocities are assumed to redshift the spectral quantity,\n    while negative velocities blueshift the spectral quantity.\n    \"\"\"\n\n    # NOTE: we deliberately don't keep sub-classes of SpectralQuantity intact\n    # since we can't guarantee that their metadata would be correct/consistent.\n    squantity = scoord.view(SpectralQuantity)\n\n    beta = velocity / c\n    doppler_factor = np.sqrt((1 + beta) / (1 - beta))\n\n    if squantity.unit.is_equivalent(u.m):  # wavelength\n        return squantity * doppler_factor\n    elif (squantity.unit.is_equivalent(u.Hz) or\n          squantity.unit.is_equivalent(u.eV) or\n          squantity.unit.is_equivalent(1 / u.m)):\n        return squantity / doppler_factor\n    elif squantity.unit.is_equivalent(KMS):  # velocity\n        return (squantity.to(u.Hz) / doppler_factor).to(squantity.unit)\n    else:  # pragma: no cover\n        raise RuntimeError(f\"Unexpected units in velocity shift: {squantity.unit}. \"\n                           \"This should not happen, so please report this in the \"\n                           \"astropy issue tracker!\")"},{"col":4,"comment":"null","endLoc":461,"header":"def __truediv__(self, other)","id":4478,"name":"__truediv__","nodeType":"Function","startLoc":460,"text":"def __truediv__(self, other):\n        return self._scale_operation(operator.truediv, other)"},{"col":4,"comment":"null","endLoc":464,"header":"def __neg__(self)","id":4479,"name":"__neg__","nodeType":"Function","startLoc":463,"text":"def __neg__(self):\n        return self._scale_operation(operator.neg)"},{"col":4,"comment":"null","endLoc":238,"header":"@classmethod\n    def _distmod_to_pc(cls, dm)","id":4480,"name":"_distmod_to_pc","nodeType":"Function","startLoc":235,"text":"@classmethod\n    def _distmod_to_pc(cls, dm):\n        dm = u.Quantity(dm, u.mag)\n        return cls(10 ** ((dm.value + 5) / 5.), u.pc, copy=False)"},{"col":4,"comment":"null","endLoc":468,"header":"def __pos__(self)","id":4481,"name":"__pos__","nodeType":"Function","startLoc":467,"text":"def __pos__(self):\n        return self.copy()"},{"col":4,"comment":"null","endLoc":474,"header":"@abc.abstractmethod\n    def _combine_operation(self, op, other, reverse=False)","id":4482,"name":"_combine_operation","nodeType":"Function","startLoc":472,"text":"@abc.abstractmethod\n    def _combine_operation(self, op, other, reverse=False):\n        raise NotImplementedError()"},{"col":4,"comment":"null","endLoc":477,"header":"def __add__(self, other)","id":4483,"name":"__add__","nodeType":"Function","startLoc":476,"text":"def __add__(self, other):\n        return self._combine_operation(operator.add, other)"},{"col":4,"comment":"null","endLoc":480,"header":"def __radd__(self, other)","id":4484,"name":"__radd__","nodeType":"Function","startLoc":479,"text":"def __radd__(self, other):\n        return self._combine_operation(operator.add, other, reverse=True)"},{"col":4,"comment":"\n        Apply a velocity shift to this spectral coordinate.\n\n        The shift can be provided as a redshift (float value) or radial\n        velocity (`~astropy.units.Quantity` with physical type of 'speed').\n\n        Parameters\n        ----------\n        target_shift : float or `~astropy.units.Quantity` ['speed']\n            Shift value to apply to current target.\n        observer_shift : float or `~astropy.units.Quantity` ['speed']\n            Shift value to apply to current observer.\n\n        Returns\n        -------\n        `SpectralCoord`\n            New spectral coordinate with the target/observer velocity changed\n            to incorporate the shift. This is always a new object even if\n            ``target_shift`` and ``observer_shift`` are both `None`.\n        ","endLoc":698,"header":"def with_radial_velocity_shift(self, target_shift=None, observer_shift=None)","id":4485,"name":"with_radial_velocity_shift","nodeType":"Function","startLoc":617,"text":"def with_radial_velocity_shift(self, target_shift=None, observer_shift=None):\n        \"\"\"\n        Apply a velocity shift to this spectral coordinate.\n\n        The shift can be provided as a redshift (float value) or radial\n        velocity (`~astropy.units.Quantity` with physical type of 'speed').\n\n        Parameters\n        ----------\n        target_shift : float or `~astropy.units.Quantity` ['speed']\n            Shift value to apply to current target.\n        observer_shift : float or `~astropy.units.Quantity` ['speed']\n            Shift value to apply to current observer.\n\n        Returns\n        -------\n        `SpectralCoord`\n            New spectral coordinate with the target/observer velocity changed\n            to incorporate the shift. This is always a new object even if\n            ``target_shift`` and ``observer_shift`` are both `None`.\n        \"\"\"\n\n        if observer_shift is not None and (self.target is None or\n                                           self.observer is None):\n            raise ValueError(\"Both an observer and target must be defined \"\n                             \"before applying a velocity shift.\")\n\n        for arg in [x for x in [target_shift, observer_shift] if x is not None]:\n            if isinstance(arg, u.Quantity) and not arg.unit.is_equivalent((u.one, KMS)):\n                raise u.UnitsError(\"Argument must have unit physical type \"\n                                   \"'speed' for radial velocty or \"\n                                   \"'dimensionless' for redshift.\")\n\n        # The target or observer value is defined but is not a quantity object,\n        #  assume it's a redshift float value and convert to velocity\n\n        if target_shift is None:\n            if self._observer is None or self._target is None:\n                return self.replicate()\n            target_shift = 0 * KMS\n        else:\n            target_shift = u.Quantity(target_shift)\n            if target_shift.unit.physical_type == 'dimensionless':\n                target_shift = target_shift.to(u.km / u.s, u.doppler_redshift())\n            if self._observer is None or self._target is None:\n                return self.replicate(value=_apply_relativistic_doppler_shift(self, target_shift),\n                                      radial_velocity=self.radial_velocity + target_shift)\n\n        if observer_shift is None:\n            observer_shift = 0 * KMS\n        else:\n            observer_shift = u.Quantity(observer_shift)\n            if observer_shift.unit.physical_type == 'dimensionless':\n                observer_shift = observer_shift.to(u.km / u.s, u.doppler_redshift())\n\n        target_icrs = self._target.transform_to(ICRS())\n        observer_icrs = self._observer.transform_to(ICRS())\n\n        pos_hat = SpectralCoord._normalized_position_vector(observer_icrs, target_icrs)\n\n        target_velocity = _get_velocities(target_icrs) + target_shift * pos_hat\n        observer_velocity = _get_velocities(observer_icrs) + observer_shift * pos_hat\n\n        target_velocity = CartesianDifferential(target_velocity.xyz)\n        observer_velocity = CartesianDifferential(observer_velocity.xyz)\n\n        new_target = (target_icrs\n                      .realize_frame(target_icrs.cartesian.with_differentials(target_velocity))\n                      .transform_to(self._target))\n\n        new_observer = (observer_icrs\n                        .realize_frame(observer_icrs.cartesian.with_differentials(observer_velocity))\n                        .transform_to(self._observer))\n\n        init_obs_vel = self._calculate_radial_velocity(observer_icrs, target_icrs, as_scalar=True)\n        fin_obs_vel = self._calculate_radial_velocity(new_observer, new_target, as_scalar=True)\n\n        new_data = _apply_relativistic_doppler_shift(self, fin_obs_vel - init_obs_vel)\n\n        return self.replicate(value=new_data,\n                              observer=new_observer,\n                              target=new_target)"},{"col":4,"comment":"null","endLoc":483,"header":"def __sub__(self, other)","id":4486,"name":"__sub__","nodeType":"Function","startLoc":482,"text":"def __sub__(self, other):\n        return self._combine_operation(operator.sub, other)"},{"col":4,"comment":"null","endLoc":486,"header":"def __rsub__(self, other)","id":4487,"name":"__rsub__","nodeType":"Function","startLoc":485,"text":"def __rsub__(self, other):\n        return self._combine_operation(operator.sub, other, reverse=True)"},{"col":4,"comment":"Turn the coordinates into a record array with the coordinate values.\n\n        The record array fields will have the component names.\n        ","endLoc":499,"header":"@property\n    def _values(self)","id":4488,"name":"_values","nodeType":"Function","startLoc":489,"text":"@property\n    def _values(self):\n        \"\"\"Turn the coordinates into a record array with the coordinate values.\n\n        The record array fields will have the component names.\n        \"\"\"\n        coo_items = [(c, getattr(self, c)) for c in self.components]\n        result = np.empty(self.shape, [(c, coo.dtype) for c, coo in coo_items])\n        for c, coo in coo_items:\n            result[c] = coo.value\n        return result"},{"col":4,"comment":"Return a dictionary with the units of the coordinate components.","endLoc":505,"header":"@property\n    def _units(self)","id":4489,"name":"_units","nodeType":"Function","startLoc":501,"text":"@property\n    def _units(self):\n        \"\"\"Return a dictionary with the units of the coordinate components.\"\"\"\n        return dict([(component, getattr(self, component).unit)\n                     for component in self.components])"},{"col":4,"comment":"null","endLoc":93,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4490,"name":"assert_equal","nodeType":"Function","startLoc":88,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert_tree_match(a.left, b.left)\n        assert_tree_match(a.right, b.right)"},{"col":4,"comment":"null","endLoc":516,"header":"@property\n    def _unitstr(self)","id":4491,"name":"_unitstr","nodeType":"Function","startLoc":507,"text":"@property\n    def _unitstr(self):\n        units_set = set(self._units.values())\n        if len(units_set) == 1:\n            unitstr = units_set.pop().to_string()\n        else:\n            unitstr = '({})'.format(\n                ', '.join([self._units[component].to_string()\n                           for component in self.components]))\n        return unitstr"},{"col":0,"comment":"\n    Returns a hash value that should be invariable if the\n    `REPRESENTATION_CLASSES` and `DIFFERENTIAL_CLASSES` dictionaries have not\n    changed.\n    ","endLoc":63,"header":"def get_reprdiff_cls_hash()","id":4492,"name":"get_reprdiff_cls_hash","nodeType":"Function","startLoc":53,"text":"def get_reprdiff_cls_hash():\n    \"\"\"\n    Returns a hash value that should be invariable if the\n    `REPRESENTATION_CLASSES` and `DIFFERENTIAL_CLASSES` dictionaries have not\n    changed.\n    \"\"\"\n    global _REPRDIFF_HASH\n    if _REPRDIFF_HASH is None:\n        _REPRDIFF_HASH = (hash(tuple(REPRESENTATION_CLASSES.items())) +\n                          hash(tuple(DIFFERENTIAL_CLASSES.items())))\n    return _REPRDIFF_HASH"},{"attributeType":"null","col":4,"comment":"null","endLoc":38,"id":4493,"name":"name","nodeType":"Attribute","startLoc":38,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":39,"id":4494,"name":"types","nodeType":"Attribute","startLoc":39,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":40,"id":4495,"name":"version","nodeType":"Attribute","startLoc":40,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":41,"id":4496,"name":"handle_dynamic_subclasses","nodeType":"Attribute","startLoc":41,"text":"handle_dynamic_subclasses"},{"className":"RemapAxesType","col":0,"comment":"null","endLoc":135,"id":4497,"nodeType":"Class","startLoc":96,"text":"class RemapAxesType(TransformType):\n    name = 'transform/remap_axes'\n    types = [Mapping]\n    version = '1.3.0'\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        mapping = node['mapping']\n        n_inputs = node.get('n_inputs')\n        if all([isinstance(x, int) for x in mapping]):\n            return Mapping(tuple(mapping), n_inputs)\n\n        if n_inputs is None:\n            n_inputs = max([x for x in mapping\n                            if isinstance(x, int)]) + 1\n\n        transform = Identity(n_inputs)\n        new_mapping = []\n        i = n_inputs\n        for entry in mapping:\n            if isinstance(entry, int):\n                new_mapping.append(entry)\n            else:\n                new_mapping.append(i)\n                transform = transform & Const1D(entry.value)\n                i += 1\n        return transform | Mapping(new_mapping)\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'mapping': list(model.mapping)}\n        if model.n_inputs > max(model.mapping) + 1:\n            node['n_inputs'] = model.n_inputs\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        TransformType.assert_equal(a, b)\n        assert a.mapping == b.mapping\n        assert(a.n_inputs == b.n_inputs)"},{"col":4,"comment":"null","endLoc":122,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4498,"name":"from_tree_transform","nodeType":"Function","startLoc":101,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        mapping = node['mapping']\n        n_inputs = node.get('n_inputs')\n        if all([isinstance(x, int) for x in mapping]):\n            return Mapping(tuple(mapping), n_inputs)\n\n        if n_inputs is None:\n            n_inputs = max([x for x in mapping\n                            if isinstance(x, int)]) + 1\n\n        transform = Identity(n_inputs)\n        new_mapping = []\n        i = n_inputs\n        for entry in mapping:\n            if isinstance(entry, int):\n                new_mapping.append(entry)\n            else:\n                new_mapping.append(i)\n                transform = transform & Const1D(entry.value)\n                i += 1\n        return transform | Mapping(new_mapping)"},{"col":4,"comment":"null","endLoc":519,"header":"def __str__(self)","id":4499,"name":"__str__","nodeType":"Function","startLoc":518,"text":"def __str__(self):\n        return f'{_array2string(self._values)} {self._unitstr:s}'"},{"col":0,"comment":"null","endLoc":76,"header":"def _array2string(values, prefix='')","id":4500,"name":"_array2string","nodeType":"Function","startLoc":71,"text":"def _array2string(values, prefix=''):\n    # Work around version differences for array2string.\n    kwargs = {'separator': ', ', 'prefix': prefix}\n    kwargs['formatter'] = {}\n\n    return np.array2string(values, **kwargs)"},{"col":4,"comment":"null","endLoc":533,"header":"def __repr__(self)","id":4501,"name":"__repr__","nodeType":"Function","startLoc":521,"text":"def __repr__(self):\n        prefixstr = '    '\n        arrstr = _array2string(self._values, prefix=prefixstr)\n\n        diffstr = ''\n        if getattr(self, 'differentials', None):\n            diffstr = '\\n (has differentials w.r.t.: {})'.format(\n                ', '.join([repr(key) for key in self.differentials.keys()]))\n\n        unitstr = ('in ' + self._unitstr) if self._unitstr else '[dimensionless]'\n        return '<{} ({}) {:s}\\n{}{}{}>'.format(\n            self.__class__.__name__, ', '.join(self.components),\n            unitstr, prefixstr, arrstr, diffstr)"},{"attributeType":"null","col":4,"comment":"null","endLoc":178,"id":4502,"name":"__array_priority__","nodeType":"Attribute","startLoc":178,"text":"__array_priority__"},{"attributeType":"null","col":4,"comment":"null","endLoc":180,"id":4503,"name":"info","nodeType":"Attribute","startLoc":180,"text":"info"},{"attributeType":"null","col":16,"comment":"null","endLoc":193,"id":4504,"name":"info","nodeType":"Attribute","startLoc":193,"text":"self.info"},{"className":"RepresentationType","col":0,"comment":"null","endLoc":44,"id":4505,"nodeType":"Class","startLoc":8,"text":"class RepresentationType(AstropyType):\n    name = \"coordinates/representation\"\n    types = [BaseRepresentationOrDifferential]\n    version = \"1.0.0\"\n\n    _representation_module = astropy.coordinates.representation\n\n    @classmethod\n    def to_tree(cls, representation, ctx):\n        comps = representation.components\n        components = {}\n        for c in comps:\n            value = getattr(representation, '_' + c, None)\n            if value is not None:\n                components[c] = value\n\n        t = type(representation)\n\n        node = {}\n        node['type'] = t.__name__\n        node['components'] = components\n\n        return node\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        rep_type = getattr(cls._representation_module, node['type'])\n        return rep_type(**node['components'])\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        assert isinstance(new, type(old))\n        assert new.components == old.components\n        for comp in new.components:\n            nc = getattr(new, comp)\n            oc = getattr(old, comp)\n            assert u.allclose(nc, oc)"},{"col":4,"comment":"\n        A dictionary with the information of what attribute names for this frame\n        apply to particular representations.\n        ","endLoc":814,"header":"@lazyproperty\n    def representation_info(self)","id":4506,"name":"representation_info","nodeType":"Function","startLoc":808,"text":"@lazyproperty\n    def representation_info(self):\n        \"\"\"\n        A dictionary with the information of what attribute names for this frame\n        apply to particular representations.\n        \"\"\"\n        return self._get_representation_info()"},{"col":4,"comment":"null","endLoc":30,"header":"@classmethod\n    def to_tree(cls, representation, ctx)","id":4507,"name":"to_tree","nodeType":"Function","startLoc":15,"text":"@classmethod\n    def to_tree(cls, representation, ctx):\n        comps = representation.components\n        components = {}\n        for c in comps:\n            value = getattr(representation, '_' + c, None)\n            if value is not None:\n                components[c] = value\n\n        t = type(representation)\n\n        node = {}\n        node['type'] = t.__name__\n        node['components'] = components\n\n        return node"},{"col":4,"comment":"null","endLoc":35,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":4508,"name":"from_tree","nodeType":"Function","startLoc":32,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        rep_type = getattr(cls._representation_module, node['type'])\n        return rep_type(**node['components'])"},{"col":4,"comment":"null","endLoc":838,"header":"def get_representation_component_units(self, which='base')","id":4509,"name":"get_representation_component_units","nodeType":"Function","startLoc":827,"text":"def get_representation_component_units(self, which='base'):\n        out = {}\n        repr_or_diff_cls = self.get_representation_cls(which)\n        if repr_or_diff_cls is None:\n            return out\n        repr_attrs = self.representation_info[repr_or_diff_cls]\n        repr_names = repr_attrs['names']\n        repr_units = repr_attrs['units']\n        for repr_name, repr_unit in zip(repr_names, repr_units):\n            if repr_unit:\n                out[repr_name] = repr_unit\n        return out"},{"col":4,"comment":"null","endLoc":44,"header":"@classmethod\n    def assert_equal(cls, old, new)","id":4510,"name":"assert_equal","nodeType":"Function","startLoc":37,"text":"@classmethod\n    def assert_equal(cls, old, new):\n        assert isinstance(new, type(old))\n        assert new.components == old.components\n        for comp in new.components:\n            nc = getattr(new, comp)\n            oc = getattr(old, comp)\n            assert u.allclose(nc, oc)"},{"col":4,"comment":"Base for replicating a frame, with possibly different attributes.\n\n        Produces a new instance of the frame using the attributes of the old\n        frame (unless overridden) and with the data given.\n\n        Parameters\n        ----------\n        data : `~astropy.coordinates.BaseRepresentation` or None\n            Data to use in the new frame instance.  If `None`, it will be\n            a data-less frame.\n        copy : bool, optional\n            Whether data and the attributes on the old frame should be copied\n            (default), or passed on by reference.\n        **kwargs\n            Any attributes that should be overridden.\n        ","endLoc":882,"header":"def _replicate(self, data, copy=False, **kwargs)","id":4511,"name":"_replicate","nodeType":"Function","startLoc":844,"text":"def _replicate(self, data, copy=False, **kwargs):\n        \"\"\"Base for replicating a frame, with possibly different attributes.\n\n        Produces a new instance of the frame using the attributes of the old\n        frame (unless overridden) and with the data given.\n\n        Parameters\n        ----------\n        data : `~astropy.coordinates.BaseRepresentation` or None\n            Data to use in the new frame instance.  If `None`, it will be\n            a data-less frame.\n        copy : bool, optional\n            Whether data and the attributes on the old frame should be copied\n            (default), or passed on by reference.\n        **kwargs\n            Any attributes that should be overridden.\n        \"\"\"\n        # This is to provide a slightly nicer error message if the user tries\n        # to use frame_obj.representation instead of frame_obj.data to get the\n        # underlying representation object [e.g., #2890]\n        if inspect.isclass(data):\n            raise TypeError('Class passed as data instead of a representation '\n                            'instance. If you called frame.representation, this'\n                            ' returns the representation class. frame.data '\n                            'returns the instantiated object - you may want to '\n                            ' use this instead.')\n        if copy and data is not None:\n            data = data.copy()\n\n        for attr in self.get_frame_attr_names():\n            if (attr not in self._attr_names_with_defaults\n                    and attr not in kwargs):\n                value = getattr(self, attr)\n                if copy:\n                    value = value.copy()\n\n                kwargs[attr] = value\n\n        return self.__class__(data, copy=False, **kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":9,"id":4512,"name":"name","nodeType":"Attribute","startLoc":9,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":10,"id":4513,"name":"types","nodeType":"Attribute","startLoc":10,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":11,"id":4514,"name":"version","nodeType":"Attribute","startLoc":11,"text":"version"},{"attributeType":"representation.py","col":4,"comment":"null","endLoc":13,"id":4515,"name":"_representation_module","nodeType":"Attribute","startLoc":13,"text":"_representation_module"},{"col":4,"comment":"\n        Return a replica of the frame, optionally with new frame attributes.\n\n        The replica is a new frame object that has the same data as this frame\n        object and with frame attributes overridden if they are provided as extra\n        keyword arguments to this method. If ``copy`` is set to `True` then a\n        copy of the internal arrays will be made.  Otherwise the replica will\n        use a reference to the original arrays when possible to save memory. The\n        internal arrays are normally not changeable by the user so in most cases\n        it should not be necessary to set ``copy`` to `True`.\n\n        Parameters\n        ----------\n        copy : bool, optional\n            If True, the resulting object is a copy of the data.  When False,\n            references are used where  possible. This rule also applies to the\n            frame attributes.\n\n        Any additional keywords are treated as frame attributes to be set on the\n        new frame object.\n\n        Returns\n        -------\n        frameobj : `BaseCoordinateFrame` subclass instance\n            Replica of this object, but possibly with new frame attributes.\n        ","endLoc":911,"header":"def replicate(self, copy=False, **kwargs)","id":4516,"name":"replicate","nodeType":"Function","startLoc":884,"text":"def replicate(self, copy=False, **kwargs):\n        \"\"\"\n        Return a replica of the frame, optionally with new frame attributes.\n\n        The replica is a new frame object that has the same data as this frame\n        object and with frame attributes overridden if they are provided as extra\n        keyword arguments to this method. If ``copy`` is set to `True` then a\n        copy of the internal arrays will be made.  Otherwise the replica will\n        use a reference to the original arrays when possible to save memory. The\n        internal arrays are normally not changeable by the user so in most cases\n        it should not be necessary to set ``copy`` to `True`.\n\n        Parameters\n        ----------\n        copy : bool, optional\n            If True, the resulting object is a copy of the data.  When False,\n            references are used where  possible. This rule also applies to the\n            frame attributes.\n\n        Any additional keywords are treated as frame attributes to be set on the\n        new frame object.\n\n        Returns\n        -------\n        frameobj : `BaseCoordinateFrame` subclass instance\n            Replica of this object, but possibly with new frame attributes.\n        \"\"\"\n        return self._replicate(self.data, copy=copy, **kwargs)"},{"id":4517,"name":"astropy/io/misc/asdf/tags/coordinates/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/coordinates/tests","id":4518,"nodeType":"File","text":"import pytest\nfrom astropy.io.misc.asdf.tests import ASDF_ENTRY_INSTALLED\n\nif not ASDF_ENTRY_INSTALLED:\n    pytest.skip('The astropy asdf entry points are not installed',\n                allow_module_level=True)\n"},{"col":4,"comment":"null","endLoc":129,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":4519,"name":"to_tree_transform","nodeType":"Function","startLoc":124,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'mapping': list(model.mapping)}\n        if model.n_inputs > max(model.mapping) + 1:\n            node['n_inputs'] = model.n_inputs\n        return node"},{"col":4,"comment":"null","endLoc":135,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4520,"name":"assert_equal","nodeType":"Function","startLoc":131,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        TransformType.assert_equal(a, b)\n        assert a.mapping == b.mapping\n        assert(a.n_inputs == b.n_inputs)"},{"col":4,"comment":"\n        Return a replica without data, optionally with new frame attributes.\n\n        The replica is a new frame object without data but with the same frame\n        attributes as this object, except where overridden by extra keyword\n        arguments to this method.  The ``copy`` keyword determines if the frame\n        attributes are truly copied vs being references (which saves memory for\n        cases where frame attributes are large).\n\n        This method is essentially the converse of `realize_frame`.\n\n        Parameters\n        ----------\n        copy : bool, optional\n            If True, the resulting object has copies of the frame attributes.\n            When False, references are used where  possible.\n\n        Any additional keywords are treated as frame attributes to be set on the\n        new frame object.\n\n        Returns\n        -------\n        frameobj : `BaseCoordinateFrame` subclass instance\n            Replica of this object, but without data and possibly with new frame\n            attributes.\n        ","endLoc":940,"header":"def replicate_without_data(self, copy=False, **kwargs)","id":4521,"name":"replicate_without_data","nodeType":"Function","startLoc":913,"text":"def replicate_without_data(self, copy=False, **kwargs):\n        \"\"\"\n        Return a replica without data, optionally with new frame attributes.\n\n        The replica is a new frame object without data but with the same frame\n        attributes as this object, except where overridden by extra keyword\n        arguments to this method.  The ``copy`` keyword determines if the frame\n        attributes are truly copied vs being references (which saves memory for\n        cases where frame attributes are large).\n\n        This method is essentially the converse of `realize_frame`.\n\n        Parameters\n        ----------\n        copy : bool, optional\n            If True, the resulting object has copies of the frame attributes.\n            When False, references are used where  possible.\n\n        Any additional keywords are treated as frame attributes to be set on the\n        new frame object.\n\n        Returns\n        -------\n        frameobj : `BaseCoordinateFrame` subclass instance\n            Replica of this object, but without data and possibly with new frame\n            attributes.\n        \"\"\"\n        return self._replicate(None, copy=copy, **kwargs)"},{"col":0,"comment":"","endLoc":1,"header":"__init__.py#<anonymous>","id":4522,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"if not ASDF_ENTRY_INSTALLED:\n    pytest.skip('The astropy asdf entry points are not installed',\n                allow_module_level=True)"},{"col":4,"comment":"\n        Construct a new `~astropy.modeling.CompoundModel` instance from an\n        existing CompoundModel, replacing the named submodel with a new model.\n\n        In order to ensure that inverses and names are kept/reconstructed, it's\n        necessary to rebuild the CompoundModel from the replaced node all the\n        way back to the base. The original CompoundModel is left untouched.\n\n        Parameters\n        ----------\n        name : str\n            name of submodel to be replaced\n        model : `~astropy.modeling.Model`\n            replacement model\n        ","endLoc":3889,"header":"def replace_submodel(self, name, model)","id":4523,"name":"replace_submodel","nodeType":"Function","startLoc":3843,"text":"def replace_submodel(self, name, model):\n        \"\"\"\n        Construct a new `~astropy.modeling.CompoundModel` instance from an\n        existing CompoundModel, replacing the named submodel with a new model.\n\n        In order to ensure that inverses and names are kept/reconstructed, it's\n        necessary to rebuild the CompoundModel from the replaced node all the\n        way back to the base. The original CompoundModel is left untouched.\n\n        Parameters\n        ----------\n        name : str\n            name of submodel to be replaced\n        model : `~astropy.modeling.Model`\n            replacement model\n        \"\"\"\n        submodels = [m for m in self.traverse_postorder()\n                     if getattr(m, 'name', None) == name]\n        if submodels:\n            if len(submodels) > 1:\n                raise ValueError(f\"More than one submodel named {name}\")\n\n            old_model = submodels.pop()\n            if len(old_model) != len(model):\n                raise ValueError(\"New and old models must have equal values \"\n                                 \"for n_models\")\n\n            # Do this check first in order to raise a more helpful Exception,\n            # although it would fail trying to construct the new CompoundModel\n            if (old_model.n_inputs != model.n_inputs or\n                        old_model.n_outputs != model.n_outputs):\n                raise ValueError(\"New model must match numbers of inputs and \"\n                                 \"outputs of existing model\")\n\n            tree = _get_submodel_path(self, name)\n            while tree:\n                branch = self.copy()\n                for node in tree[:-1]:\n                    branch = getattr(branch, node)\n                setattr(branch, tree[-1], model)\n                model = CompoundModel(branch.op, branch.left, branch.right,\n                                      name=branch.name)\n                tree = tree[:-1]\n            return model\n\n        else:\n            raise ValueError(f\"No submodels found named {name}\")"},{"col":4,"comment":"\n        Returns whether a string is one of the aliases for the frame.\n        ","endLoc":827,"header":"def _is_name(self, string)","id":4524,"name":"_is_name","nodeType":"Function","startLoc":822,"text":"def _is_name(self, string):\n        \"\"\"\n        Returns whether a string is one of the aliases for the frame.\n        \"\"\"\n        return (self.frame.name == string or\n                (isinstance(self.frame.name, list) and string in self.frame.name))"},{"col":4,"comment":"\n        Overrides getattr to return coordinates that this can be transformed\n        to, based on the alias attr in the primary transform graph.\n        ","endLoc":859,"header":"def __getattr__(self, attr)","id":4525,"name":"__getattr__","nodeType":"Function","startLoc":829,"text":"def __getattr__(self, attr):\n        \"\"\"\n        Overrides getattr to return coordinates that this can be transformed\n        to, based on the alias attr in the primary transform graph.\n        \"\"\"\n        if '_sky_coord_frame' in self.__dict__:\n            if self._is_name(attr):\n                return self  # Should this be a deepcopy of self?\n\n            # Anything in the set of all possible frame_attr_names is handled\n            # here. If the attr is relevant for the current frame then delegate\n            # to self.frame otherwise get it from self._<attr>.\n            if attr in frame_transform_graph.frame_attributes:\n                if attr in self.frame.get_frame_attr_names():\n                    return getattr(self.frame, attr)\n                else:\n                    return getattr(self, '_' + attr, None)\n\n            # Some attributes might not fall in the above category but still\n            # are available through self._sky_coord_frame.\n            if not attr.startswith('_') and hasattr(self._sky_coord_frame, attr):\n                return getattr(self._sky_coord_frame, attr)\n\n            # Try to interpret as a new frame for transforming.\n            frame_cls = frame_transform_graph.lookup_name(attr)\n            if frame_cls is not None and self.frame.is_transformable_to(frame_cls):\n                return self.transform_to(attr)\n\n        # Fail\n        raise AttributeError(\"'{}' object has no attribute '{}'\"\n                             .format(self.__class__.__name__, attr))"},{"col":4,"comment":"\n        Generates a new frame with new data from another frame (which may or\n        may not have data). Roughly speaking, the converse of\n        `replicate_without_data`.\n\n        Parameters\n        ----------\n        data : `~astropy.coordinates.BaseRepresentation`\n            The representation to use as the data for the new frame.\n\n        Any additional keywords are treated as frame attributes to be set on the\n        new frame object. In particular, `representation_type` can be specified.\n\n        Returns\n        -------\n        frameobj : `BaseCoordinateFrame` subclass instance\n            A new object in *this* frame, with the same frame attributes as\n            this one, but with the ``data`` as the coordinate data.\n\n        ","endLoc":963,"header":"def realize_frame(self, data, **kwargs)","id":4526,"name":"realize_frame","nodeType":"Function","startLoc":942,"text":"def realize_frame(self, data, **kwargs):\n        \"\"\"\n        Generates a new frame with new data from another frame (which may or\n        may not have data). Roughly speaking, the converse of\n        `replicate_without_data`.\n\n        Parameters\n        ----------\n        data : `~astropy.coordinates.BaseRepresentation`\n            The representation to use as the data for the new frame.\n\n        Any additional keywords are treated as frame attributes to be set on the\n        new frame object. In particular, `representation_type` can be specified.\n\n        Returns\n        -------\n        frameobj : `BaseCoordinateFrame` subclass instance\n            A new object in *this* frame, with the same frame attributes as\n            this one, but with the ``data`` as the coordinate data.\n\n        \"\"\"\n        return self._replicate(data, **kwargs)"},{"id":4527,"name":"astropy/io/misc/asdf/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tests","id":4528,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\n# Define a constant to know if the entry points are installed, since this impacts\n# whether we can run the tests.\n\nfrom importlib.metadata import entry_points\n\nimport pytest\n\n# TODO: Exclusively use select when Python minversion is 3.10\neps = entry_points()\nif hasattr(eps, 'select'):\n    ep = [entry.name for entry in eps.select(group='asdf_extensions')]\nelse:\n    ep = [entry.name for entry in eps.get('asdf_extensions', [])]\nASDF_ENTRY_INSTALLED = 'astropy' in ep and 'astropy-asdf' in ep\n\ndel entry_points, eps, ep\n\nif not ASDF_ENTRY_INSTALLED:\n    pytest.skip('The astropy asdf entry points are not installed',\n                allow_module_level=True)\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":4529,"name":"eps","nodeType":"Attribute","startLoc":12,"text":"eps"},{"col":4,"comment":"\n        Generate and return a new representation of this frame's `data`\n        as a Representation object.\n\n        Note: In order to make an in-place change of the representation\n        of a Frame or SkyCoord object, set the ``representation``\n        attribute of that object to the desired new representation, or\n        use the ``set_representation_cls`` method to also set the differential.\n\n        Parameters\n        ----------\n        base : subclass of BaseRepresentation or string\n            The type of representation to generate.  Must be a *class*\n            (not an instance), or the string name of the representation\n            class.\n        s : subclass of `~astropy.coordinates.BaseDifferential`, str, optional\n            Class in which any velocities should be represented. Must be\n            a *class* (not an instance), or the string name of the\n            differential class.  If equal to 'base' (default), inferred from\n            the base class.  If `None`, all velocity information is dropped.\n        in_frame_units : bool, keyword-only\n            Force the representation units to match the specified units\n            particular to this frame\n\n        Returns\n        -------\n        newrep : BaseRepresentation-derived object\n            A new representation object of this frame's `data`.\n\n        Raises\n        ------\n        AttributeError\n            If this object had no `data`\n\n        Examples\n        --------\n        >>> from astropy import units as u\n        >>> from astropy.coordinates import SkyCoord, CartesianRepresentation\n        >>> coord = SkyCoord(0*u.deg, 0*u.deg)\n        >>> coord.represent_as(CartesianRepresentation)  # doctest: +FLOAT_CMP\n        <CartesianRepresentation (x, y, z) [dimensionless]\n                (1., 0., 0.)>\n\n        >>> coord.representation_type = CartesianRepresentation\n        >>> coord  # doctest: +FLOAT_CMP\n        <SkyCoord (ICRS): (x, y, z) [dimensionless]\n            (1., 0., 0.)>\n        ","endLoc":1145,"header":"def represent_as(self, base, s='base', in_frame_units=False)","id":4530,"name":"represent_as","nodeType":"Function","startLoc":965,"text":"def represent_as(self, base, s='base', in_frame_units=False):\n        \"\"\"\n        Generate and return a new representation of this frame's `data`\n        as a Representation object.\n\n        Note: In order to make an in-place change of the representation\n        of a Frame or SkyCoord object, set the ``representation``\n        attribute of that object to the desired new representation, or\n        use the ``set_representation_cls`` method to also set the differential.\n\n        Parameters\n        ----------\n        base : subclass of BaseRepresentation or string\n            The type of representation to generate.  Must be a *class*\n            (not an instance), or the string name of the representation\n            class.\n        s : subclass of `~astropy.coordinates.BaseDifferential`, str, optional\n            Class in which any velocities should be represented. Must be\n            a *class* (not an instance), or the string name of the\n            differential class.  If equal to 'base' (default), inferred from\n            the base class.  If `None`, all velocity information is dropped.\n        in_frame_units : bool, keyword-only\n            Force the representation units to match the specified units\n            particular to this frame\n\n        Returns\n        -------\n        newrep : BaseRepresentation-derived object\n            A new representation object of this frame's `data`.\n\n        Raises\n        ------\n        AttributeError\n            If this object had no `data`\n\n        Examples\n        --------\n        >>> from astropy import units as u\n        >>> from astropy.coordinates import SkyCoord, CartesianRepresentation\n        >>> coord = SkyCoord(0*u.deg, 0*u.deg)\n        >>> coord.represent_as(CartesianRepresentation)  # doctest: +FLOAT_CMP\n        <CartesianRepresentation (x, y, z) [dimensionless]\n                (1., 0., 0.)>\n\n        >>> coord.representation_type = CartesianRepresentation\n        >>> coord  # doctest: +FLOAT_CMP\n        <SkyCoord (ICRS): (x, y, z) [dimensionless]\n            (1., 0., 0.)>\n        \"\"\"\n\n        # For backwards compatibility (because in_frame_units used to be the\n        # 2nd argument), we check to see if `new_differential` is a boolean. If\n        # it is, we ignore the value of `new_differential` and warn about the\n        # position change\n        if isinstance(s, bool):\n            warnings.warn(\"The argument position for `in_frame_units` in \"\n                          \"`represent_as` has changed. Use as a keyword \"\n                          \"argument if needed.\", AstropyWarning)\n            in_frame_units = s\n            s = 'base'\n\n        # In the future, we may want to support more differentials, in which\n        # case one probably needs to define **kwargs above and use it here.\n        # But for now, we only care about the velocity.\n        repr_classes = _get_repr_classes(base=base, s=s)\n        representation_cls = repr_classes['base']\n        # We only keep velocity information\n        if 's' in self.data.differentials:\n            # For the default 'base' option in which _get_repr_classes has\n            # given us a best guess based on the representation class, we only\n            # use it if the class we had already is incompatible.\n            if (s == 'base'\n                and (self.data.differentials['s'].__class__\n                     in representation_cls._compatible_differentials)):\n                differential_cls = self.data.differentials['s'].__class__\n            else:\n                differential_cls = repr_classes['s']\n        elif s is None or s == 'base':\n            differential_cls = None\n        else:\n            raise TypeError('Frame data has no associated differentials '\n                            '(i.e. the frame has no velocity data) - '\n                            'represent_as() only accepts a new '\n                            'representation.')\n\n        if differential_cls:\n            cache_key = (representation_cls.__name__,\n                         differential_cls.__name__, in_frame_units)\n        else:\n            cache_key = (representation_cls.__name__, in_frame_units)\n\n        cached_repr = self.cache['representation'].get(cache_key)\n        if not cached_repr:\n            if differential_cls:\n                # Sanity check to ensure we do not just drop radial\n                # velocity.  TODO: should Representation.represent_as\n                # allow this transformation in the first place?\n                if (isinstance(self.data, r.UnitSphericalRepresentation)\n                    and issubclass(representation_cls, r.CartesianRepresentation)\n                    and not isinstance(self.data.differentials['s'],\n                                       (r.UnitSphericalDifferential,\n                                        r.UnitSphericalCosLatDifferential,\n                                        r.RadialDifferential))):\n                    raise u.UnitConversionError(\n                        'need a distance to retrieve a cartesian representation '\n                        'when both radial velocity and proper motion are present, '\n                        'since otherwise the units cannot match.')\n\n                # TODO NOTE: only supports a single differential\n                data = self.data.represent_as(representation_cls,\n                                              differential_cls)\n                diff = data.differentials['s']  # TODO: assumes velocity\n            else:\n                data = self.data.represent_as(representation_cls)\n\n            # If the new representation is known to this frame and has a defined\n            # set of names and units, then use that.\n            new_attrs = self.representation_info.get(representation_cls)\n            if new_attrs and in_frame_units:\n                datakwargs = dict((comp, getattr(data, comp))\n                                  for comp in data.components)\n                for comp, new_attr_unit in zip(data.components, new_attrs['units']):\n                    if new_attr_unit:\n                        datakwargs[comp] = datakwargs[comp].to(new_attr_unit)\n                data = data.__class__(copy=False, **datakwargs)\n\n            if differential_cls:\n                # the original differential\n                data_diff = self.data.differentials['s']\n\n                # If the new differential is known to this frame and has a\n                # defined set of names and units, then use that.\n                new_attrs = self.representation_info.get(differential_cls)\n                if new_attrs and in_frame_units:\n                    diffkwargs = dict((comp, getattr(diff, comp))\n                                      for comp in diff.components)\n                    for comp, new_attr_unit in zip(diff.components,\n                                                   new_attrs['units']):\n                        # Some special-casing to treat a situation where the\n                        # input data has a UnitSphericalDifferential or a\n                        # RadialDifferential. It is re-represented to the\n                        # frame's differential class (which might be, e.g., a\n                        # dimensional Differential), so we don't want to try to\n                        # convert the empty component units\n                        if (isinstance(data_diff,\n                                       (r.UnitSphericalDifferential,\n                                        r.UnitSphericalCosLatDifferential))\n                                and comp not in data_diff.__class__.attr_classes):\n                            continue\n\n                        elif (isinstance(data_diff, r.RadialDifferential)\n                              and comp not in data_diff.__class__.attr_classes):\n                            continue\n\n                        # Try to convert to requested units. Since that might\n                        # not be possible (e.g., for a coordinate with proper\n                        # motion but without distance, one cannot convert to a\n                        # cartesian differential in km/s), we allow the unit\n                        # conversion to fail.  See gh-7028 for discussion.\n                        if new_attr_unit and hasattr(diff, comp):\n                            try:\n                                diffkwargs[comp] = diffkwargs[comp].to(new_attr_unit)\n                            except Exception:\n                                pass\n\n                    diff = diff.__class__(copy=False, **diffkwargs)\n\n                    # Here we have to bypass using with_differentials() because\n                    # it has a validation check. But because\n                    # .representation_type and .differential_type don't point to\n                    # the original classes, if the input differential is a\n                    # RadialDifferential, it usually gets turned into a\n                    # SphericalCosLatDifferential (or whatever the default is)\n                    # with strange units for the d_lon and d_lat attributes.\n                    # This then causes the dictionary key check to fail (i.e.\n                    # comparison against `diff._get_deriv_key()`)\n                    data._differentials.update({'s': diff})\n\n            self.cache['representation'][cache_key] = data\n\n        return self.cache['representation'][cache_key]"},{"attributeType":"null","col":4,"comment":"null","endLoc":97,"id":4531,"name":"name","nodeType":"Attribute","startLoc":97,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":14,"id":4532,"name":"ep","nodeType":"Attribute","startLoc":14,"text":"ep"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":4533,"name":"ep","nodeType":"Attribute","startLoc":16,"text":"ep"},{"col":0,"comment":"","endLoc":7,"header":"__init__.py#<anonymous>","id":4534,"name":"<anonymous>","nodeType":"Function","startLoc":7,"text":"eps = entry_points()\n\nif hasattr(eps, 'select'):\n    ep = [entry.name for entry in eps.select(group='asdf_extensions')]\nelse:\n    ep = [entry.name for entry in eps.get('asdf_extensions', [])]\n\nASDF_ENTRY_INSTALLED = 'astropy' in ep and 'astropy-asdf' in ep\n\ndel entry_points, eps, ep\n\nif not ASDF_ENTRY_INSTALLED:\n    pytest.skip('The astropy asdf entry points are not installed',\n                allow_module_level=True)"},{"attributeType":"null","col":4,"comment":"null","endLoc":98,"id":4535,"name":"types","nodeType":"Attribute","startLoc":98,"text":"types"},{"col":4,"comment":"null","endLoc":886,"header":"def __setattr__(self, attr, val)","id":4536,"name":"__setattr__","nodeType":"Function","startLoc":861,"text":"def __setattr__(self, attr, val):\n        # This is to make anything available through __getattr__ immutable\n        if '_sky_coord_frame' in self.__dict__:\n            if self._is_name(attr):\n                raise AttributeError(f\"'{attr}' is immutable\")\n\n            if not attr.startswith('_') and hasattr(self._sky_coord_frame, attr):\n                setattr(self._sky_coord_frame, attr, val)\n                return\n\n            frame_cls = frame_transform_graph.lookup_name(attr)\n            if frame_cls is not None and self.frame.is_transformable_to(frame_cls):\n                raise AttributeError(f\"'{attr}' is immutable\")\n\n        if attr in frame_transform_graph.frame_attributes:\n            # All possible frame attributes can be set, but only via a private\n            # variable.  See __getattr__ above.\n            super().__setattr__('_' + attr, val)\n            # Validate it\n            frame_transform_graph.frame_attributes[attr].__get__(self)\n            # And add to set of extra attributes\n            self._extra_frameattr_names |= {attr}\n\n        else:\n            # Otherwise, do the standard Python attribute setting\n            super().__setattr__(attr, val)"},{"id":4537,"name":"astropy/io/misc/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/tests","id":4538,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":99,"id":4539,"name":"version","nodeType":"Attribute","startLoc":99,"text":"version"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":4540,"name":"__all__","nodeType":"Attribute","startLoc":10,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":4541,"name":"_operator_to_tag_mapping","nodeType":"Attribute","startLoc":13,"text":"_operator_to_tag_mapping"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":4542,"name":"_tag_to_method_mapping","nodeType":"Attribute","startLoc":25,"text":"_tag_to_method_mapping"},{"col":0,"comment":"","endLoc":3,"header":"compound.py#<anonymous>","id":4543,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['CompoundType', 'RemapAxesType']\n\n_operator_to_tag_mapping = {\n    '+':  'add',\n    '-':  'subtract',\n    '*':  'multiply',\n    '/':  'divide',\n    '**': 'power',\n    '|':  'compose',\n    '&':  'concatenate',\n    'fix_inputs': 'fix_inputs'\n}\n\n_tag_to_method_mapping = {\n    'add':         '__add__',\n    'subtract':    '__sub__',\n    'multiply':    '__mul__',\n    'divide':      '__truediv__',\n    'power':       '__pow__',\n    'compose':     '__or__',\n    'concatenate': '__and__',\n    'fix_inputs':  'fix_inputs'\n}"},{"id":4544,"name":"astropy/io/misc/pandas","nodeType":"Package"},{"fileName":"connect.py","filePath":"astropy/io/misc/pandas","id":4545,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# This file connects the readers/writers to the astropy.table.Table class\n\nimport functools\nimport os.path\n\nfrom astropy.utils.misc import NOT_OVERWRITING_MSG\nfrom astropy.table import Table\nimport astropy.io.registry as io_registry\n\n__all__ = ['PANDAS_FMTS']\n\n# Astropy users normally expect to not have an index, so default to turn\n# off writing the index.  This structure allows for astropy-specific\n# customization of all options.\nPANDAS_FMTS = {'csv': {'read': {},\n                       'write': {'index': False}},\n               'fwf': {'read': {}},  # No writer\n               'html': {'read': {},\n                        'write': {'index': False}},\n               'json': {'read': {},\n                        'write': {}}}\n\nPANDAS_PREFIX = 'pandas.'\n\n# Imports for reading HTML\n_IMPORTS = False\n_HAS_BS4 = False\n_HAS_LXML = False\n_HAS_HTML5LIB = False\n\n\ndef import_html_libs():\n    \"\"\"Try importing dependencies for reading HTML.\n\n    This is copied from pandas.io.html\n    \"\"\"\n    # import things we need\n    # but make this done on a first use basis\n\n    global _IMPORTS\n    if _IMPORTS:\n        return\n\n    global _HAS_BS4, _HAS_LXML, _HAS_HTML5LIB\n\n    from astropy.utils.compat.optional_deps import (\n        HAS_BS4 as _HAS_BS4,\n        HAS_LXML as _HAS_LXML,\n        HAS_HTML5LIB as _HAS_HTML5LIB\n    )\n    _IMPORTS = True\n\n\ndef _pandas_read(fmt, filespec, **kwargs):\n    \"\"\"Provide io Table connector to read table using pandas.\n\n    \"\"\"\n    try:\n        import pandas\n    except ImportError:\n        raise ImportError('pandas must be installed to use pandas table reader')\n\n    pandas_fmt = fmt[len(PANDAS_PREFIX):]  # chop the 'pandas.' in front\n    read_func = getattr(pandas, 'read_' + pandas_fmt)\n\n    # Get defaults and then override with user-supplied values\n    read_kwargs = PANDAS_FMTS[pandas_fmt]['read'].copy()\n    read_kwargs.update(kwargs)\n\n    # Special case: pandas defaults to HTML lxml for reading, but does not attempt\n    # to fall back to bs4 + html5lib.  So do that now for convenience if user has\n    # not specifically selected a flavor.  If things go wrong the pandas exception\n    # with instruction to install a library will come up.\n    if pandas_fmt == 'html' and 'flavor' not in kwargs:\n        import_html_libs()\n        if (not _HAS_LXML and _HAS_HTML5LIB and _HAS_BS4):\n            read_kwargs['flavor'] = 'bs4'\n\n    df = read_func(filespec, **read_kwargs)\n\n    # Special case for HTML\n    if pandas_fmt == 'html':\n        df = df[0]\n\n    return Table.from_pandas(df)\n\n\ndef _pandas_write(fmt, tbl, filespec, overwrite=False, **kwargs):\n    \"\"\"Provide io Table connector to write table using pandas.\n\n    \"\"\"\n    pandas_fmt = fmt[len(PANDAS_PREFIX):]  # chop the 'pandas.' in front\n\n    # Get defaults and then override with user-supplied values\n    write_kwargs = PANDAS_FMTS[pandas_fmt]['write'].copy()\n    write_kwargs.update(kwargs)\n\n    df = tbl.to_pandas()\n    write_method = getattr(df, 'to_' + pandas_fmt)\n\n    if not overwrite:\n        try:  # filespec is not always a path-like\n            exists = os.path.exists(filespec)\n        except TypeError:  # skip invalid arguments\n            pass\n        else:\n            if exists:  # only error if file already exists\n                raise OSError(NOT_OVERWRITING_MSG.format(filespec))\n\n    return write_method(filespec, **write_kwargs)\n\n\nfor pandas_fmt, defaults in PANDAS_FMTS.items():\n    fmt = PANDAS_PREFIX + pandas_fmt  # Full format specifier\n\n    if 'read' in defaults:\n        func = functools.partial(_pandas_read, fmt)\n        io_registry.register_reader(fmt, Table, func)\n\n    if 'write' in defaults:\n        func = functools.partial(_pandas_write, fmt)\n        io_registry.register_writer(fmt, Table, func)\n"},{"fileName":"__init__.py","filePath":"astropy/io/misc/pandas","id":4546,"nodeType":"File","text":""},{"id":4547,"name":"astropy/io/ascii","nodeType":"Package"},{"id":4548,"name":"cparser.pyx","nodeType":"TextFile","path":"astropy/io/ascii","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n#cython: language_level=3\n\nimport csv\nimport os\nimport math\nimport multiprocessing\nimport mmap\nimport queue as Queue\nimport warnings\n\nimport numpy as np\ncimport numpy as np\nfrom numpy import ma\nfrom libc cimport stdio\nfrom cpython.buffer cimport PyBUF_SIMPLE\nfrom cpython.buffer cimport Py_buffer\nfrom cpython.buffer cimport PyObject_GetBuffer, PyBuffer_Release\n\nfrom ...utils.data import get_readable_fileobj\nfrom ...utils.exceptions import AstropyWarning\nfrom . import core\n\n\ncdef extern from \"src/tokenizer.h\":\n    ctypedef enum tokenizer_state:\n        START_LINE\n        START_FIELD\n        START_QUOTED_FIELD\n        FIELD\n        QUOTED_FIELD\n        QUOTED_FIELD_NEWLINE\n        COMMENT\n        CARRIAGE_RETURN\n\n    ctypedef enum err_code:\n        NO_ERROR\n        INVALID_LINE\n        TOO_MANY_COLS\n        NOT_ENOUGH_COLS\n        CONVERSION_ERROR\n        OVERFLOW_ERROR\n\n    ctypedef struct tokenizer_t:\n        char *source           # single string containing all of the input\n        size_t source_len       # length of the input\n        size_t source_pos       # current index in source for tokenization\n        char delimiter         # delimiter character\n        char comment           # comment character\n        char quotechar         # quote character\n        char expchar           # exponential character in scientific notation\n        char newline           # EOL character\n        char **output_cols     # array of output strings for each column\n        char **col_ptrs        # array of pointers to current output position for each col\n        int *output_len        # length of each output column string\n        int num_cols           # number of table columns\n        int num_rows           # number of table rows\n        int fill_extra_cols    # represents whether or not to fill rows with too few values\n        tokenizer_state state  # current state of the tokenizer\n        err_code code          # represents the latest error that has occurred\n        int iter_col           # index of the column being iterated over\n        char *curr_pos         # current iteration position\n        char *buf              # buffer for empty data\n        int strip_whitespace_lines  # whether to strip whitespace at the beginning and end of lines\n        int strip_whitespace_fields # whether to strip whitespace at the beginning and end of fields\n        int use_fast_converter      # whether to use the fast converter for floats\n        char *comment_lines    # single null-delimited string containing comment lines\n        int comment_lines_len  # length of comment_lines in memory\n        int comment_pos        # current index in comment_lines\n        # Example input/output\n        # --------------------\n        # source: \"A,B,C\\n10,5.,6\\n1,2,3\"\n        # output_cols: [\"A\\x0010\\x001\", \"B\\x005.\\x002\", \"C\\x006\\x003\"]\n\n    ctypedef struct memory_map:\n        char *ptr\n        int len\n        void *file_ptr\n        void *handle\n\n    tokenizer_t *create_tokenizer(char delimiter, char comment, char quotechar, char expchar,\n                                  int fill_extra_cols, int strip_whitespace_lines,\n                                  int strip_whitespace_fields, int use_fast_converter)\n    void delete_tokenizer(tokenizer_t *tokenizer)\n    int skip_lines(tokenizer_t *self, int offset, int header)\n    int tokenize(tokenizer_t *self, int end, int header, int num_cols)\n    long str_to_long(tokenizer_t *self, char *str)\n    double fast_str_to_double(tokenizer_t *self, char *str)\n    double str_to_double(tokenizer_t *self, char *str)\n    void start_iteration(tokenizer_t *self, int col)\n    char *next_field(tokenizer_t *self, int *size)\n    char *get_line(char *ptr, size_t *len, size_t map_len)\n    void reset_comments(tokenizer_t *self)\n\ncdef extern from \"Python.h\":\n    int PyObject_AsReadBuffer(object obj, const void **buffer, Py_ssize_t *buffer_len)\n\nclass CParserError(Exception):\n    \"\"\"\n    An instance of this class is thrown when an error occurs\n    during C parsing.\n    \"\"\"\n\nERR_CODES = dict(enumerate([\n    \"no error\",\n    \"invalid line supplied\",\n    lambda line: \"too many columns found in line {0} of data\".format(line),\n    lambda line: \"not enough columns found in line {0} of data\".format(line),\n    \"type conversion error\",\n    \"overflow error\"\n    ]))\n\ncdef class FileString:\n    \"\"\"\n    A wrapper class for a memory-mapped file pointer.\n    \"\"\"\n    cdef:\n        object fhandle\n        object mmap\n        const void *mmap_ptr\n        Py_buffer buf\n\n    def __cinit__(self, fname):\n        self.fhandle = open(fname, 'r')\n        if not self.fhandle:\n            raise OSError('File \"{0}\" could not be opened'.format(fname))\n        self.mmap = mmap.mmap(self.fhandle.fileno(), 0, access=mmap.ACCESS_READ)\n        cdef Py_ssize_t buf_len = len(self.mmap)\n        PyObject_GetBuffer(self.mmap, &self.buf, PyBUF_SIMPLE)\n        self.mmap_ptr = self.buf.buf\n\n    def __dealloc__(self):\n        if self.mmap:\n            PyBuffer_Release(&self.buf)\n            self.mmap.close()\n            self.fhandle.close()\n\n    def __len__(self):\n        return len(self.mmap)\n\n    def __getitem__(self, i):\n        return self.mmap[i]\n\n    def splitlines(self):\n        \"\"\"\n        Return a generator yielding lines from the memory map.\n        \"\"\"\n        cdef char *ptr = <char *>self.mmap_ptr\n        cdef char *tmp\n        cdef size_t line_len\n        cdef size_t map_len = len(self.mmap)\n\n        while ptr:\n            tmp = get_line(ptr, &line_len, map_len)\n            yield ptr[:line_len].decode('ascii')\n            ptr = tmp\n\ncdef class CParser:\n    \"\"\"\n    A fast Cython parser class which uses underlying C code\n    for tokenization.\n    \"\"\"\n\n    cdef:\n        tokenizer_t *tokenizer\n        object names\n        object header_names\n        int data_start\n        object data_end\n        object include_names\n        object exclude_names\n        object fill_values\n        object fill_empty\n        object fill_include_names\n        object fill_exclude_names\n        object fill_names\n        int fill_extra_cols\n        bytes source_bytes\n        char *source_ptr\n        object parallel\n        set use_cols\n\n    cdef public:\n        int width\n        object source\n        object header_start\n        object header_chars\n\n    def __cinit__(self, source, strip_line_whitespace, strip_line_fields,\n                  delimiter=',',\n                  comment=None,\n                  quotechar='\"',\n                  header_start=0,\n                  data_start=1,\n                  data_end=None,\n                  names=None,\n                  include_names=None,\n                  exclude_names=None,\n                  fill_values=('', '0'),\n                  fill_include_names=None,\n                  fill_exclude_names=None,\n                  fill_extra_cols=0,\n                  fast_reader=None):\n\n        if fast_reader is None:\n          fast_reader = {}\n\n        # Handle fast_reader parameter\n        expchar = fast_reader.pop('exponent_style', 'E').upper()\n        # parallel and use_fast_reader are False by default, but only the latter\n        # supports Fortran double precision notation\n        if expchar == 'E':\n            use_fast_converter = fast_reader.pop('use_fast_converter', False)\n        else:\n            use_fast_converter = fast_reader.pop('use_fast_converter', True)\n            if not use_fast_converter:\n                raise core.FastOptionsError(\"fast_reader: exponent_style requires use_fast_converter\")\n            if expchar.startswith('FORT'):\n                expchar = 'A'\n        parallel = fast_reader.pop('parallel', False)\n\n        # FIXME: for now the parallel mode does not work correctly and is worse\n        # than non-parallel mode so we disable parallel mode if set and emit a\n        # warning. We keep the parallel code below so that it can be fixed in\n        # future, but if it cannot be fixed we should remove the parallel code\n        # and deprecate the option itself. For now the warning is not a\n        # deprecation warning since we may still fix it in future. See\n        # https://github.com/astropy/astropy/issues/8858 for more details.\n        if parallel:\n            warnings.warn('parallel reading does not currently work, '\n                          'so falling back to serial reading (see '\n                          'https://github.com/astropy/astropy/issues/8858 for more details)', AstropyWarning)\n            parallel = False\n\n        if fast_reader:\n            raise core.FastOptionsError(\"Invalid parameter in fast_reader dict\")\n\n        if comment is None:\n            comment = '\\x00' # tokenizer ignores all comments if comment='\\x00'\n        self.tokenizer = create_tokenizer(ord(delimiter), ord(comment),\n                                          ord(quotechar), ord(expchar),\n                                          fill_extra_cols,\n                                          strip_line_whitespace,\n                                          strip_line_fields,\n                                          use_fast_converter)\n        self.source = None\n        if source is not None:\n            self.setup_tokenizer(source)\n        self.header_start = header_start\n        self.data_start = data_start\n        self.data_end = data_end\n        self.names = names\n        self.include_names = include_names\n        self.exclude_names = exclude_names\n        self.fill_values = fill_values\n        self.fill_include_names = fill_include_names\n        self.fill_exclude_names = fill_exclude_names\n        self.fill_names = None\n        self.fill_extra_cols = fill_extra_cols\n\n        if self.names is not None:\n            if None in self.names:\n                raise TypeError('Cannot have None for column name')\n            if len(set(self.names)) != len(self.names):\n                raise ValueError('Duplicate column names')\n\n        # parallel=True indicates that we should use the CPU count\n        if parallel is True:\n            parallel = multiprocessing.cpu_count()\n        # If parallel = 1 or 0, don't use multiprocessing\n        elif parallel is not False and parallel < 2:\n            parallel = False\n        self.parallel = parallel\n\n    def __dealloc__(self):\n        if self.tokenizer:\n            delete_tokenizer(self.tokenizer)  # perform C memory cleanup\n\n    cdef get_error(self, code, num_rows, msg):\n        err_msg = ERR_CODES.get(code, \"unknown error\")\n\n        # error code is lambda function taking current line as input\n        if callable(err_msg):\n            err_msg = err_msg(num_rows + 1)\n\n        return CParserError(\"{0}: {1}\".format(msg, err_msg))\n\n    cdef raise_error(self, msg):\n        raise self.get_error(self.tokenizer.code, self.tokenizer.num_rows, msg)\n\n    cpdef setup_tokenizer(self, source):\n        cdef FileString fstring\n\n        if isinstance(source, str):  # filename or data\n            if '\\n' not in source and '\\r' not in source: # filename\n                fstring = FileString(source)\n                self.tokenizer.source = <char *>fstring.mmap_ptr\n                self.source_ptr = <char *>fstring.mmap_ptr\n                self.source = fstring\n                self.tokenizer.source_len = <size_t>len(fstring)\n                return\n            # Otherwise, source is the actual data so we leave it be\n        elif hasattr(source, 'read'):  # file-like object\n            with get_readable_fileobj(source) as file_obj:\n                source = file_obj.read()\n        elif isinstance(source, FileString):\n            self.tokenizer.source = <char *>((<FileString>source).mmap_ptr)\n            self.source = source\n            self.tokenizer.source_len = <size_t>len(source)\n            return\n        else:\n            # Iterable sequence of lines, merge with newline character\n            try:\n                if self.tokenizer.delimiter == ord('\\n'):\n                    newline = '\\r'\n                else:\n                    newline = '\\n'\n                source = newline.join(source)\n            except TypeError:\n                raise TypeError('Input \"table\" must be a file-like object, a '\n                                'string (filename or data), or an iterable')\n        # Create a reference to the Python object so its char * pointer remains valid\n        self.source = source\n\n        # encode in ASCII for char * handling\n        self.source_bytes = self.source.encode('ascii')\n        self.tokenizer.source = self.source_bytes\n        self.tokenizer.source_len = <size_t>len(self.source_bytes)\n\n    def read_header(self, deduplicate=True, filter_names=True):\n        self.tokenizer.source_pos = 0\n\n        # header_start is a valid line number\n        if self.header_start is not None and self.header_start >= 0:\n            if skip_lines(self.tokenizer, self.header_start, 1) != 0:\n                self.raise_error(\"an error occurred while advancing to the \"\n                                 \"first header line\")\n            if tokenize(self.tokenizer, -1, 1, 0) != 0:\n                self.raise_error(\"an error occurred while tokenizing the header line\")\n            self.header_names = []\n            name = ''\n\n            for i in range(self.tokenizer.output_len[0]):  # header is in first col string\n                c = self.tokenizer.output_cols[0][i]       # next char in header string\n                if not c:  # zero byte -- field terminator\n                    if name:\n                        # replace empty placeholder with ''\n                        self.header_names.append(name.replace('\\x01', ''))\n                        name = ''\n                    else:\n                        break # end of string\n                else:\n                    name += chr(c)\n            self.width = <int>len(self.header_names)\n            if deduplicate and not self.names:  # skip if custom names were provided\n                self._deduplicate_names()\n\n        else:\n            # Get number of columns from first data row\n            if tokenize(self.tokenizer, -1, 1, 0) != 0:\n                self.raise_error(\"an error occurred while tokenizing the first line of data\")\n            self.width = 0\n            for i in range(self.tokenizer.output_len[0]):  # header is in first col string\n                # zero byte -- field terminator\n                if not self.tokenizer.output_cols[0][i]:\n                    # ends valid field\n                    if i > 0 and self.tokenizer.output_cols[0][i - 1]:\n                        self.width += 1\n                    else:  # end of line\n                        break\n            if self.width == 0:  # no data\n                raise core.InconsistentTableError('No data lines found, C reader '\n                                                  'cannot autogenerate column names')\n            # auto-generate names\n            self.header_names = ['col{0}'.format(i + 1) for i in range(self.width)]\n\n        if self.names:\n            self.width = <int>len(self.names)\n        else:\n            self.names = self.header_names\n\n        # self.use_cols should only contain columns included in output\n        self.use_cols = set(self.names)\n        if filter_names and self.include_names is not None:\n            self.use_cols.intersection_update(self.include_names)\n        if filter_names and self.exclude_names is not None:\n            self.use_cols.difference_update(self.exclude_names)\n\n        self.width = <int>len(self.names)\n\n    def read(self, try_int, try_float, try_string):\n        if self.parallel:\n            return self._read_parallel(try_int, try_float, try_string)\n\n        # Read in a single process\n        self.tokenizer.source_pos = 0\n        if skip_lines(self.tokenizer, self.data_start, 0) != 0:\n            self.raise_error(\"an error occurred while advancing to the first \"\n                             \"line of data\")\n\n        self.header_chars = self.source[:self.tokenizer.source_pos]\n\n        cdef int data_end = -1 # keep reading data until the end\n        if self.data_end is not None and self.data_end >= 0:\n            data_end = max(self.data_end - self.data_start, 0) # read nothing if data_end < 0\n\n        if tokenize(self.tokenizer, data_end, 0, <int>len(self.names)) != 0:\n            if self.tokenizer.code in (NOT_ENOUGH_COLS, TOO_MANY_COLS):\n                raise core.InconsistentTableError(\"Number of header columns \" +\n                      \"({0}) inconsistent with data columns in data line {1}\"\n                      .format(self.tokenizer.num_cols, self.tokenizer.num_rows))\n            else:\n                self.raise_error(\"an error occurred while parsing table data\")\n        elif self.tokenizer.num_rows == 0: # no data\n            return ([np.array([], dtype=np.int_)] * self.width,\n                    self._get_comments(self.tokenizer))\n        self._set_fill_values()\n        cdef int num_rows = self.tokenizer.num_rows\n        if self.data_end is not None and self.data_end < 0: # negative indexing\n            num_rows += self.data_end\n        return self._convert_data(self.tokenizer, try_int, try_float,\n                                  try_string, num_rows)\n\n    def _read_parallel(self, try_int, try_float, try_string):\n        cdef size_t source_len = <size_t>len(self.source)\n        self.tokenizer.source_pos = 0\n\n        if skip_lines(self.tokenizer, self.data_start, 0) != 0:\n            self.raise_error(\"an error occurred while advancing to the first \"\n                             \"line of data\")\n\n        cdef list line_comments = self._get_comments(self.tokenizer)\n        cdef int N = self.parallel\n        try:\n            queue = multiprocessing.Queue()\n        except (ImportError, NotImplementedError, AttributeError, OSError):\n            self.raise_error(\"shared semaphore implementation required \"\n                             \"but not available\")\n        cdef size_t offset = self.tokenizer.source_pos\n\n        if offset == source_len: # no data\n            return (dict((name, np.array([], dtype=np.int_)) for name in\n                         self.names),\n                    self._get_comments(self.tokenizer))\n\n        cdef long chunksize = math.ceil((source_len - offset) / float(N))\n        cdef list chunkindices = [offset]\n\n        # This queue is used to signal processes to reconvert if necessary\n        reconvert_queue = multiprocessing.Queue()\n\n        cdef int i\n        cdef size_t index\n\n        # Build up chunkindices which has the indices for all N chunks\n        # in an length N+1 array.\n        for i in range(1, N):\n            index = max(offset + chunksize * i, chunkindices[i - 1])\n            while index < source_len and self.source[index] != '\\n':\n                index += 1\n            if index < source_len:\n                chunkindices.append(index + 1)\n            else:\n                N = i\n                break\n\n        self._set_fill_values()\n        chunkindices.append(source_len)\n        cdef list processes = []\n\n        # Create and start N parallel processes to read the N chunks\n        for i in range(N):\n            process = multiprocessing.Process(target=_read_chunk, args=(self,\n                chunkindices[i], chunkindices[i + 1],\n                try_int, try_float, try_string, queue, reconvert_queue, i))\n            processes.append(process)\n            process.start()\n\n        # Define outputs in advance\n        cdef list chunks = [None] * N\n        cdef list comments_chunks = [None] * N\n        cdef dict failed_procs = {}\n\n        # Asynchronously get the read results for the N chunks.  These\n        # come back in a non-deterministic order using the ``queue``\n        # to return results and the chunk index as ``proc``.  ``queue.get()``\n        # is blocking and waiting for a result.\n        for i in range(N):\n            queue_ret, err, proc = queue.get()\n            if isinstance(err, Exception):\n                for process in processes:\n                    process.terminate()\n                raise err\n            elif err is not None: # err is (error code, error line)\n                failed_procs[proc] = err\n\n            comments, data = queue_ret\n            comments_chunks[proc] = comments\n            chunks[proc] = data\n\n        # Accumulate all the comments through file into a single list of comments\n        for chunk in comments_chunks:\n            line_comments.extend(chunk)\n\n        if failed_procs:\n            # find the line number of the error\n            line_no = 0\n            for i in range(N):\n                # ignore errors after data_end\n                if i in failed_procs and self.data_end is None or line_no < self.data_end:\n                    for process in processes:\n                        process.terminate()\n                    raise self.get_error(failed_procs[i][0], failed_procs[i][1] + line_no,\n                                         \"an error occurred while parsing table data\")\n                line_no += len(chunks[i][self.names[0]])\n\n        seen_str = {}\n        seen_numeric = {}\n        for name in self.names:\n            seen_str[name] = False\n            seen_numeric[name] = False\n\n        # Go through each chunk and each column name and see if it was parsed\n        # as both a string in at least one chunk and/or numeric in at least\n        # one chunk.\n        for chunk in chunks:\n            for name in chunk:\n                if chunk[name].dtype.kind in ('S', 'U'):\n                    # string values in column\n                    seen_str[name] = True\n                elif len(chunk[name]) > 0: # ignore empty chunk columns\n                    seen_numeric[name] = True\n\n        # Go through each column name and see if it was parsed as both\n        # string and float in different chunks.  If so reconvert back\n        # to string.\n        reconvert_cols = []\n        for i, name in enumerate(self.names):\n            if seen_str[name] and seen_numeric[name]:\n                # Reconvert to str to avoid conversion issues, e.g.\n                # 5 (int) -> 5.0 (float) -> 5.0 (string)\n                reconvert_cols.append(i)\n\n        # Slightly confusing: put the list of col numbers to reconvert\n        # onto the queue.  All of the reading processes are blocked and\n        # waiting for a value on the reconvert_queue.  One-by-one each\n        # process will manage to be first in line and get the value,\n        # handle, and the put reconvert_cols back on the queue for\n        # another waiting process.\n        # CONSIDER just putting reconvert_cols on the queue N times\n        # in a row here and don't have _read_chunk do that chaining.\n        reconvert_queue.put(reconvert_cols)\n        for process in processes:\n            process.join() # wait for each process to finish\n        try:\n            while True:\n                # Each column that was reconverted gets passed back in the queue\n                # and is then substituted over the original (incorrect) type.\n                reconverted, proc, col = queue.get(False)\n                chunks[proc][self.names[col]] = reconverted\n        except Queue.Empty:\n            pass\n\n        if self.data_end is not None:\n            if self.data_end < 0:\n                # e.g. if data_end = -1, cut the last row\n                num_rows = 0\n                for chunk in chunks:\n                    num_rows += len(chunk[self.names[0]])\n                self.data_end += num_rows\n            else:\n                self.data_end -= self.data_start # ignore header\n\n            if self.data_end < 0: # no data\n                chunks = [dict((name, []) for name in self.names)]\n            else:\n                line_no = 0\n                for i, chunk in enumerate(chunks):\n                    num_rows = len(chunk[self.names[0]])\n                    if line_no + num_rows > self.data_end:\n                        for name in self.names:\n                            # truncate columns\n                            chunk[name] = chunk[name][:self.data_end - line_no]\n                        del chunks[i + 1:]\n                        break\n                    line_no += num_rows\n\n        # Concatenate the chunk data, one column at a time.\n        ret = {}\n        for name in self.get_names():\n            col_chunks = [chunk.pop(name) for chunk in chunks]\n            if any(isinstance(col_chunk, ma.masked_array) for col_chunk in col_chunks):\n                ret[name] = ma.concatenate(col_chunks)\n            else:\n                ret[name] = np.concatenate(col_chunks)\n\n        # Clean up processes\n        for process in processes:\n            process.terminate()\n\n        return ret, line_comments\n\n    cdef _set_fill_values(self):\n        if self.fill_names is None:\n            self.fill_names = set(self.names)\n            if self.fill_include_names is not None:\n                self.fill_names.intersection_update(self.fill_include_names)\n            if self.fill_exclude_names is not None:\n                self.fill_names.difference_update(self.fill_exclude_names)\n        self.fill_values, self.fill_empty = get_fill_values(self.fill_values)\n\n    cdef _get_comments(self, tokenizer_t *t):\n        line_comments = []\n        comment = ''\n        for i in range(t.comment_pos):\n            c = t.comment_lines[i] # next char in comment string\n            if not c: # zero byte -- line terminator\n                # replace empty placeholder with ''\n                line_comments.append(comment.replace('\\x01', '').strip())\n                comment = ''\n            else:\n                comment += chr(c)\n        return line_comments\n\n    cdef _convert_data(self, tokenizer_t *t, try_int, try_float, try_string, num_rows):\n        cols = {}\n\n        for i, name in enumerate(self.names):\n            if name not in self.use_cols:\n                continue\n            # Try int first, then float, then string\n            try:\n                if try_int and not try_int[name]:\n                    raise ValueError()\n                cols[name] = self._convert_int(t, i, num_rows)\n            except ValueError:\n                try:\n                    if t.code == OVERFLOW_ERROR:\n                        # Overflow during int conversion (extending range)\n                        warnings.warn(\"OverflowError converting to {0} in column {1}, reverting to String.\"\n                                  .format('IntType', name), AstropyWarning)\n                        if try_string and not try_string[name]:\n                            raise ValueError('Column {0} failed to convert'.format(name))\n                        t.code = NO_ERROR\n                        cols[name] = self._convert_str(t, i, num_rows)\n                    else:\n                        if try_float and not try_float[name]:\n                            raise ValueError()\n                        t.code = NO_ERROR\n                        cols[name] = self._convert_float(t, i, num_rows)\n                        if t.code == OVERFLOW_ERROR:\n                            # Overflow during float conversion (extending range)\n                            warnings.warn(\"OverflowError converting to {0} in column {1}, possibly resulting in degraded precision.\"\n                                          .format('FloatType', name), AstropyWarning)\n                            t.code = NO_ERROR\n                except ValueError:\n                    if try_string and not try_string[name]:\n                        raise ValueError('Column {0} failed to convert'.format(name))\n                    cols[name] = self._convert_str(t, i, num_rows)\n\n        return cols, self._get_comments(t)\n\n    cdef np.ndarray _convert_int(self, tokenizer_t *t, int i, int nrows):\n        cdef int num_rows = t.num_rows\n        if nrows != -1:\n            num_rows = nrows\n        # initialize ndarray\n        cdef np.ndarray col = np.empty(num_rows, dtype=np.int_)\n        cdef long converted\n        cdef int row = 0\n        cdef long *data = <long *> col.data # pointer to raw data\n        cdef char *field\n        cdef char *empty_field = t.buf # memory address of designated empty buffer\n        cdef bytes new_value\n        mask = set() # set of indices for masked values\n        start_iteration(t, i) # begin the iteration process in C\n\n        for row in range(num_rows):\n            # retrieve the next field as a C pointer\n            field = next_field(t, <int *>0)\n            replace_info = None\n\n            if field == empty_field and self.fill_empty:\n                replace_info = self.fill_empty\n            # hopefully this implicit char * -> byte conversion for fill values\n            # checking can be avoided in most cases, since self.fill_values will\n            # be empty in the default case (self.fill_empty will do the work\n            # instead)\n            elif field != empty_field and self.fill_values and field in self.fill_values:\n                replace_info = self.fill_values[field]\n\n            if replace_info is not None:\n                # Either this column applies to the field as specified in the\n                # fill_values parameter, or no specific columns are specified\n                # and this column should apply fill_values.\n                if (len(replace_info) > 1 and self.names[i] in replace_info[1:]) \\\n                   or (len(replace_info) == 1 and self.names[i] in self.fill_names):\n                    mask.add(row)\n                    new_value = str(replace_info[0]).encode('ascii')\n                    # try converting the new value\n                    converted = str_to_long(t, new_value)\n                else:\n                    converted = str_to_long(t, field)\n            else:\n                # convert the field to long (widest integer type)\n                converted = str_to_long(t, field)\n\n            if t.code in (CONVERSION_ERROR, OVERFLOW_ERROR):\n                # no dice\n                if t.code == CONVERSION_ERROR:\n                    t.code = NO_ERROR\n                raise ValueError()\n\n            data[row] = converted\n            row += 1\n\n        if mask:\n            # convert to masked_array\n            return ma.masked_array(col, mask=[1 if i in mask else 0 for i in\n                                              range(row)])\n        else:\n            return col\n\n    cdef np.ndarray _convert_float(self, tokenizer_t *t, int i, int nrows):\n        # very similar to _convert_int()\n        cdef int num_rows = t.num_rows\n        if nrows != -1:\n            num_rows = nrows\n\n        cdef np.ndarray col = np.empty(num_rows, dtype=np.float_)\n        cdef double converted\n        cdef int row = 0\n        cdef double *data = <double *> col.data\n        cdef char *field\n        cdef char *empty_field = t.buf\n        cdef bytes new_value\n        cdef int replacing\n        cdef err_code overflown = NO_ERROR # store any OVERFLOW to raise warning\n        mask = set()\n\n        start_iteration(t, i)\n        for row in range(num_rows):\n            field = next_field(t, <int *>0)\n            replace_info = None\n            replacing = False\n\n            if field == empty_field and self.fill_empty:\n                replace_info = self.fill_empty\n\n            elif field != empty_field and self.fill_values and field in self.fill_values:\n                replace_info = self.fill_values[field]\n\n            if replace_info is not None:\n                if (len(replace_info) > 1 and self.names[i] in replace_info[1:]) \\\n                   or (len(replace_info) == 1 and self.names[i] in self.fill_names):\n                    mask.add(row)\n                    new_value = str(replace_info[0]).encode('ascii')\n                    replacing = True\n                    converted = str_to_double(t, new_value)\n                else:\n                    converted = str_to_double(t, field)\n            else:\n                converted = str_to_double(t, field)\n\n            if t.code == CONVERSION_ERROR:\n                t.code = NO_ERROR\n                raise ValueError()\n            else:\n                data[row] = converted\n            if t.code == OVERFLOW_ERROR:\n                t.code = NO_ERROR\n                overflown = OVERFLOW_ERROR\n            row += 1\n        t.code = overflown\n\n        if mask:\n            return ma.masked_array(col, mask=[1 if i in mask else 0 for i in\n                                              range(row)])\n        else:\n            return col\n\n    cdef _convert_str(self, tokenizer_t *t, int i, int nrows):\n        # similar to _convert_int, but no actual conversion\n        cdef int num_rows = t.num_rows\n        if nrows != -1:\n            num_rows = nrows\n\n        cdef int row = 0\n        cdef bytes field\n        cdef int field_len\n        cdef int max_len = 0\n        cdef list fields_list = []\n        mask = set()\n\n        start_iteration(t, i)\n        for row in range(num_rows):\n            field = next_field(t, &field_len)\n            replace_info = None\n\n            if field_len == 0 and self.fill_empty:\n                replace_info = self.fill_empty\n\n            elif field_len > 0 and self.fill_values and field in self.fill_values:\n                replace_info = self.fill_values[field]\n\n            if replace_info is not None:\n                el = replace_info[0].encode('ascii')\n                if (len(replace_info) > 1 and self.names[i] in replace_info[1:]) \\\n                   or (len(replace_info) == 1 and self.names[i] in self.fill_names):\n                    mask.add(row)\n                    field = el\n\n            fields_list.append(field)\n            if field_len > max_len:\n                max_len = field_len\n            row += 1\n\n        cdef np.ndarray col = np.array(fields_list, dtype=(str, max_len))\n\n        if mask:\n            return ma.masked_array(col, mask=[1 if i in mask else 0 for i in\n                                              range(row)])\n        else:\n            return col\n\n    def get_names(self):\n        # ignore excluded columns\n        return [name for name in self.names if name in self.use_cols]\n\n    def set_names(self, names):\n        self.names = names\n\n    def get_header_names(self):\n        return self.header_names\n\n    def _deduplicate_names(self):\n        \"\"\"Ensure there are no duplicates in ``self.header_names``\n        Cythonic version of  core._deduplicate_names.\n        \"\"\"\n        cdef int i\n        new_names = []\n        existing_names = set()\n\n        for name in self.header_names:\n            base_name = name + '_'\n            i = 1\n            while name in existing_names:\n                # Iterate until a unique name is found\n                name = base_name + str(i)\n                i += 1\n            new_names.append(name)\n            existing_names.add(name)\n\n        self.header_names = new_names\n\n    def __reduce__(self):\n        cdef bytes source = self.source_ptr if self.source_ptr else self.source_bytes\n        fast_reader = dict(exponent_style=chr(self.tokenizer.expchar),\n                           use_fast_converter=self.tokenizer.use_fast_converter,\n                           parallel=False)\n        return (_copy_cparser, (source, self.use_cols, self.fill_names,\n                                self.fill_values, self.fill_empty, self.tokenizer.strip_whitespace_lines,\n                                self.tokenizer.strip_whitespace_fields,\n                                dict(delimiter=chr(self.tokenizer.delimiter),\n                                comment=chr(self.tokenizer.comment),\n                                quotechar=chr(self.tokenizer.quotechar),\n                                header_start=self.header_start,\n                                data_start=self.data_start,\n                                data_end=self.data_end,\n                                names=self.names,\n                                include_names=self.include_names,\n                                exclude_names=self.exclude_names,\n                                fill_values=None,\n                                fill_include_names=self.fill_include_names,\n                                fill_exclude_names=self.fill_exclude_names,\n                                fill_extra_cols=self.tokenizer.fill_extra_cols,\n                                fast_reader=fast_reader)))\n\ndef _copy_cparser(bytes source, use_cols, fill_names, fill_values,\n                  fill_empty, strip_whitespace_lines, strip_whitespace_fields, kwargs):\n\n    parser = CParser(None, strip_whitespace_lines, strip_whitespace_fields, **kwargs)\n\n    parser.use_cols = use_cols\n    parser.fill_names = fill_names\n    parser.fill_values = fill_values\n    parser.fill_empty = fill_empty\n\n    parser.tokenizer.source = source\n    parser.tokenizer.source_len = <size_t>len(source)\n    parser.source_bytes = source\n\n    return parser\n\n\ndef _read_chunk(CParser self, start, end, try_int,\n                try_float, try_string, queue, reconvert_queue, i):\n    cdef tokenizer_t *chunk_tokenizer = self.tokenizer\n    chunk_tokenizer.source_len = end\n    chunk_tokenizer.source_pos = start\n    reset_comments(chunk_tokenizer)\n\n    data = None\n    err = None\n\n    if tokenize(chunk_tokenizer, -1, 0, <int>len(self.names)) != 0:\n        err = (chunk_tokenizer.code, chunk_tokenizer.num_rows)\n    if chunk_tokenizer.num_rows == 0: # no data\n        data = dict((name, np.array([], np.int_)) for name in self.get_names())\n        line_comments = self._get_comments(chunk_tokenizer)\n    else:\n        try:\n            data, line_comments = self._convert_data(chunk_tokenizer,\n                                      try_int, try_float, try_string, -1)\n        except Exception as e:\n            delete_tokenizer(chunk_tokenizer)\n            self.tokenizer = NULL  # prevent another de-allocation in __dalloc__\n            queue.put((None, e, i))\n            return\n\n    try:\n        queue.put(((line_comments, data), err, i))\n    except Queue.Full as e:\n        # hopefully this shouldn't happen\n        delete_tokenizer(chunk_tokenizer)\n        self.tokenizer = NULL  # prevent another de-allocation in __dalloc__\n        queue.pop()\n        queue.put((None, e, i))\n        return\n\n    reconvert_cols = reconvert_queue.get()\n    for col in reconvert_cols:\n        queue.put((self._convert_str(chunk_tokenizer, col, -1), i, col))\n    delete_tokenizer(chunk_tokenizer)\n    self.tokenizer = NULL  # prevent another de-allocation in __dalloc__\n    reconvert_queue.put(reconvert_cols) # return to the queue for other processes\n\n\ncdef class FastWriter:\n    \"\"\"\n    A fast Cython writing class for writing tables\n    as ASCII data.\n    \"\"\"\n\n    cdef:\n        object table\n        list use_names\n        dict fill_values\n        set fill_cols\n        list col_iters\n        list formats\n        list format_funcs\n        list types\n        list line_comments\n        str quotechar\n        str expchar\n        str delimiter\n        int strip_whitespace\n        object comment\n\n    def __cinit__(self, table,\n                  delimiter=',',\n                  comment='# ',\n                  quotechar='\"',\n                  expchar='e',\n                  formats=None,\n                  strip_whitespace=True,\n                  names=None, # ignore, already used in _get_writer\n                  include_names=None,\n                  exclude_names=None,\n                  fill_values=[],\n                  fill_include_names=None,\n                  fill_exclude_names=None,\n                  fast_writer=True):\n\n        from ...table import pprint  # Here to avoid circular import\n\n        if fast_writer is True:\n            fast_writer = {}\n        # fast_writer might contain custom writing options\n\n        self.table = table\n        self.comment = comment\n        self.strip_whitespace = strip_whitespace\n        use_names = set(table.colnames)\n\n        # Apply include_names before exclude_names\n        if include_names is not None:\n            use_names.intersection_update(include_names)\n        if exclude_names is not None:\n            use_names.difference_update(exclude_names)\n        # preserve column ordering via list\n        self.use_names = [x for x in table.colnames if x in use_names]\n\n        fill_values = get_fill_values(fill_values, False)\n        self.fill_values = fill_values.copy()\n\n        # Add int/float versions of each fill value (if applicable)\n        # to the fill_values dict. This prevents the writer from having\n        # to call unicode() on every value, which is a major\n        # performance hit.\n        for key, val in fill_values.items():\n            try:\n                self.fill_values[int(key)] = val\n                self.fill_values[float(key)] = val\n            except (ValueError, np.ma.MaskError):\n                pass\n\n        fill_names = set(self.use_names)\n        # Apply fill_include_names before fill_exclude_names\n        if fill_include_names is not None:\n            fill_names.intersection_update(fill_include_names)\n        if fill_exclude_names is not None:\n            fill_names.difference_update(fill_exclude_names)\n        # Preserve column ordering\n        self.fill_cols = set([i for i, name in enumerate(self.use_names) if\n                              name in fill_names])\n\n        # formats in user-specified dict should override\n        # existing column formats\n        if formats is not None:\n            for name in self.use_names:\n                if name in formats:\n                    self.table[name].format = formats[name]\n\n        self.col_iters = []\n        self.formats = []\n        self.format_funcs = []\n        self.line_comments = table.meta.get('comments', [])\n\n        for col in table.columns.values():\n            if col.name in self.use_names: # iterate over included columns\n                # If col.format is None then don't use any formatter to improve\n                # speed.  However, if the column is a byte string and this\n                # is Py3, then use the default formatter (which in this case\n                # does val.decode('utf-8')) in order to avoid a leading 'b'.\n                if col.format is None and not col.dtype.kind == 'S':\n                    self.format_funcs.append(None)\n                else:\n                    self.format_funcs.append(col.info._format_funcs.get(\n                        col.format, pprint.get_auto_format_func(col)))\n                # col is a numpy.ndarray, so we convert it to\n                # an ordinary list because csv.writer will call\n                # np.array_str() on each numpy value, which is\n                # very inefficient\n                self.col_iters.append(iter(col.tolist()))\n                self.formats.append(col.format)\n\n        self.quotechar = None if quotechar is None else str(quotechar)\n        self.delimiter = ' ' if delimiter is None else str(delimiter)\n        # 'S' for string types, 'N' for numeric types\n        self.types = ['S' if self.table[name].dtype.kind in ('S', 'U') else 'N'\n                      for name in self.use_names]\n\n    cdef _write_comments(self, output):\n        if self.comment not in (False, None):\n            for comment_line in self.line_comments:\n                output.write(self.comment + comment_line + '\\n')\n\n    def _write_header(self, output, writer, header_output, output_types):\n        if header_output is not None and header_output == 'comment':\n            output.write(self.comment)\n            writer.writerow([x.strip() for x in self.use_names] if\n                            self.strip_whitespace else self.use_names)\n            self._write_comments(output)\n        else:\n            self._write_comments(output)\n            if header_output is not None:\n                writer.writerow([x.strip() for x in self.use_names] if\n                            self.strip_whitespace else self.use_names)\n        if output_types:\n            writer.writerow(self.types)\n\n    def write(self, output, header_output, output_types):\n        opened_file = False\n\n        if not hasattr(output, 'write'): # output is a filename\n            # NOTE: we need to specify newline='', otherwise the default\n            # behavior is for Python to translate \\r\\n (which we write because\n            # of os.linesep) into \\r\\r\\n. Specifying newline='' disables any\n            output = open(output, 'w', newline='')\n            opened_file = True # remember to close file afterwards\n        writer = core.CsvWriter(output,\n                                delimiter=self.delimiter,\n                                doublequote=True,\n                                escapechar=None,\n                                quotechar=self.quotechar,\n                                quoting=csv.QUOTE_MINIMAL,\n                                lineterminator=os.linesep)\n        self._write_header(output, writer, header_output, output_types)\n\n        # Split rows into N-sized chunks, since we don't want to\n        # store all the rows in memory at one time (inefficient)\n        # or fail to take advantage of the speed boost of writerows()\n        # over writerow().\n        cdef int i = -1\n        cdef int N = 100\n        cdef int num_cols = <int>len(self.use_names)\n        cdef int num_rows = <int>len(self.table)\n        # cache string columns beforehand\n        cdef set string_rows = set([i for i, type in enumerate(self.types) if\n                                    type == 'S'])\n        cdef list rows = [[None] * num_cols for i in range(N)]\n\n        for i in range(num_rows):\n            for j in range(num_cols):\n                orig_field = next(self.col_iters[j]) # get field\n                # str_val monitors whether we should check if the field\n                # should be stripped\n                str_val = True\n\n                if orig_field is None: # tolist() converts ma.masked to None\n                    field = core.masked\n                    rows[i % N][j] = ''\n\n                elif self.format_funcs[j] is not None:\n                    field = self.format_funcs[j](self.formats[j], orig_field)\n                    rows[i % N][j] = field\n\n                else:\n                    field = orig_field\n                    rows[i % N][j] = field\n                    str_val = j in string_rows\n\n                if field in self.fill_values:\n                    new_val = self.fill_values[field][0]\n                    # Either this column applies to the field as specified in\n                    # the fill_values parameter, or no specific columns are\n                    # specified and this column should apply fill_values.\n                    if (len(self.fill_values[field]) > 1 and self.use_names[j] in self.fill_values[field][1:]) \\\n                       or (len(self.fill_values[field]) == 1 and j in self.fill_cols):\n                        str_val = True\n                        rows[i % N][j] = new_val\n                        if self.strip_whitespace: # new_val should be a string\n                            rows[i % N][j] = rows[i % N][j].strip()\n\n                if str_val and self.strip_whitespace:\n                    rows[i % N][j] = rows[i % N][j].strip(' \\t')\n\n            if i >= N - 1 and i % N == N - 1: # rows is now full\n                writer.writerows(rows)\n\n        # Write leftover rows not included in previous chunks\n        if i >= 0 and i % N != N - 1:\n            writer.writerows(rows[:i % N + 1])\n\n        if opened_file:\n            output.close()\n\ndef get_fill_values(fill_values, read=True):\n    if len(fill_values) > 0 and isinstance(fill_values[0], str):\n        # e.g. fill_values=('999', '0')\n        fill_values = [fill_values]\n    else:\n        fill_values = fill_values\n\n    # look for an empty replacement to cache for speedy conversion\n    fill_empty = None\n    for el in fill_values:\n        if el[0] == '':\n            fill_empty = el[1:]\n            break\n\n    try:\n        # Create a dict with the values to be replaced as keys\n        if read:\n            fill_values = dict([(l[0].encode('ascii'), l[1:]) for\n                                l in fill_values if l[0] != ''])\n        else:\n            # don't worry about encoding for writing\n            fill_values = dict([(l[0], l[1:]) for l in fill_values])\n\n    except IndexError:\n        raise ValueError(\"Format of fill_values must be \"\n                         \"(<bad>, <fill>, <optional col1>, ...)\")\n    if read:\n        return (fill_values, fill_empty)\n    else:\n        return fill_values # cache for empty values doesn't matter for writing\n"},{"fileName":"html.py","filePath":"astropy/io/ascii","id":4549,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"An extensible HTML table reader and writer.\n\nhtml.py:\n  Classes to read and write HTML tables\n\n`BeautifulSoup <http://www.crummy.com/software/BeautifulSoup/>`_\nmust be installed to read HTML tables.\n\"\"\"\n\nimport warnings\n\nfrom . import core\nfrom astropy.table import Column\nfrom astropy.utils.xml import writer\n\nfrom copy import deepcopy\n\n\nclass SoupString(str):\n    \"\"\"\n    Allows for strings to hold BeautifulSoup data.\n    \"\"\"\n\n    def __new__(cls, *args, **kwargs):\n        return str.__new__(cls, *args, **kwargs)\n\n    def __init__(self, val):\n        self.soup = val\n\n\nclass ListWriter:\n    \"\"\"\n    Allows for XMLWriter to write to a list instead of a file.\n    \"\"\"\n\n    def __init__(self, out):\n        self.out = out\n\n    def write(self, data):\n        self.out.append(data)\n\n\ndef identify_table(soup, htmldict, numtable):\n    \"\"\"\n    Checks whether the given BeautifulSoup tag is the table\n    the user intends to process.\n    \"\"\"\n\n    if soup is None or soup.name != 'table':\n        return False  # Tag is not a <table>\n\n    elif 'table_id' not in htmldict:\n        return numtable == 1\n    table_id = htmldict['table_id']\n\n    if isinstance(table_id, str):\n        return 'id' in soup.attrs and soup['id'] == table_id\n    elif isinstance(table_id, int):\n        return table_id == numtable\n\n    # Return False if an invalid parameter is given\n    return False\n\n\nclass HTMLInputter(core.BaseInputter):\n    \"\"\"\n    Input lines of HTML in a valid form.\n\n    This requires `BeautifulSoup\n    <http://www.crummy.com/software/BeautifulSoup/>`_ to be installed.\n    \"\"\"\n\n    def process_lines(self, lines):\n        \"\"\"\n        Convert the given input into a list of SoupString rows\n        for further processing.\n        \"\"\"\n\n        try:\n            from bs4 import BeautifulSoup\n        except ImportError:\n            raise core.OptionalTableImportError('BeautifulSoup must be '\n                                                'installed to read HTML tables')\n\n        if 'parser' not in self.html:\n            with warnings.catch_warnings():\n                # Ignore bs4 parser warning #4550.\n                warnings.filterwarnings('ignore', '.*no parser was explicitly specified.*')\n                soup = BeautifulSoup('\\n'.join(lines))\n        else:  # use a custom backend parser\n            soup = BeautifulSoup('\\n'.join(lines), self.html['parser'])\n        tables = soup.find_all('table')\n        for i, possible_table in enumerate(tables):\n            if identify_table(possible_table, self.html, i + 1):\n                table = possible_table  # Find the correct table\n                break\n        else:\n            if isinstance(self.html['table_id'], int):\n                err_descr = f\"number {self.html['table_id']}\"\n            else:\n                err_descr = f\"id '{self.html['table_id']}'\"\n            raise core.InconsistentTableError(\n                f'ERROR: HTML table {err_descr} not found')\n\n        # Get all table rows\n        soup_list = [SoupString(x) for x in table.find_all('tr')]\n\n        return soup_list\n\n\nclass HTMLSplitter(core.BaseSplitter):\n    \"\"\"\n    Split HTML table data.\n    \"\"\"\n\n    def __call__(self, lines):\n        \"\"\"\n        Return HTML data from lines as a generator.\n        \"\"\"\n        for line in lines:\n            if not isinstance(line, SoupString):\n                raise TypeError('HTML lines should be of type SoupString')\n            soup = line.soup\n            header_elements = soup.find_all('th')\n            if header_elements:\n                # Return multicolumns as tuples for HTMLHeader handling\n                yield [(el.text.strip(), el['colspan']) if el.has_attr('colspan')\n                       else el.text.strip() for el in header_elements]\n            data_elements = soup.find_all('td')\n            if data_elements:\n                yield [el.text.strip() for el in data_elements]\n        if len(lines) == 0:\n            raise core.InconsistentTableError('HTML tables must contain data '\n                                              'in a <table> tag')\n\n\nclass HTMLOutputter(core.TableOutputter):\n    \"\"\"\n    Output the HTML data as an ``astropy.table.Table`` object.\n\n    This subclass allows for the final table to contain\n    multidimensional columns (defined using the colspan attribute\n    of <th>).\n    \"\"\"\n\n    default_converters = [core.convert_numpy(int),\n                          core.convert_numpy(float),\n                          core.convert_numpy(str)]\n\n    def __call__(self, cols, meta):\n        \"\"\"\n        Process the data in multidimensional columns.\n        \"\"\"\n        new_cols = []\n        col_num = 0\n\n        while col_num < len(cols):\n            col = cols[col_num]\n            if hasattr(col, 'colspan'):\n                # Join elements of spanned columns together into list of tuples\n                span_cols = cols[col_num:col_num + col.colspan]\n                new_col = core.Column(col.name)\n                new_col.str_vals = list(zip(*[x.str_vals for x in span_cols]))\n                new_cols.append(new_col)\n                col_num += col.colspan\n            else:\n                new_cols.append(col)\n                col_num += 1\n\n        return super().__call__(new_cols, meta)\n\n\nclass HTMLHeader(core.BaseHeader):\n    splitter_class = HTMLSplitter\n\n    def start_line(self, lines):\n        \"\"\"\n        Return the line number at which header data begins.\n        \"\"\"\n\n        for i, line in enumerate(lines):\n            if not isinstance(line, SoupString):\n                raise TypeError('HTML lines should be of type SoupString')\n            soup = line.soup\n            if soup.th is not None:\n                return i\n\n        return None\n\n    def _set_cols_from_names(self):\n        \"\"\"\n        Set columns from header names, handling multicolumns appropriately.\n        \"\"\"\n        self.cols = []\n        new_names = []\n\n        for name in self.names:\n            if isinstance(name, tuple):\n                col = core.Column(name=name[0])\n                col.colspan = int(name[1])\n                self.cols.append(col)\n                new_names.append(name[0])\n                for i in range(1, int(name[1])):\n                    # Add dummy columns\n                    self.cols.append(core.Column(''))\n                    new_names.append('')\n            else:\n                self.cols.append(core.Column(name=name))\n                new_names.append(name)\n\n        self.names = new_names\n\n\nclass HTMLData(core.BaseData):\n    splitter_class = HTMLSplitter\n\n    def start_line(self, lines):\n        \"\"\"\n        Return the line number at which table data begins.\n        \"\"\"\n\n        for i, line in enumerate(lines):\n            if not isinstance(line, SoupString):\n                raise TypeError('HTML lines should be of type SoupString')\n            soup = line.soup\n\n            if soup.td is not None:\n                if soup.th is not None:\n                    raise core.InconsistentTableError('HTML tables cannot '\n                                                      'have headings and data in the same row')\n                return i\n\n        raise core.InconsistentTableError('No start line found for HTML data')\n\n    def end_line(self, lines):\n        \"\"\"\n        Return the line number at which table data ends.\n        \"\"\"\n        last_index = -1\n\n        for i, line in enumerate(lines):\n            if not isinstance(line, SoupString):\n                raise TypeError('HTML lines should be of type SoupString')\n            soup = line.soup\n            if soup.td is not None:\n                last_index = i\n\n        if last_index == -1:\n            return None\n        return last_index + 1\n\n\nclass HTML(core.BaseReader):\n    \"\"\"HTML format table.\n\n    In order to customize input and output, a dict of parameters may\n    be passed to this class holding specific customizations.\n\n    **htmldict** : Dictionary of parameters for HTML input/output.\n\n        * css : Customized styling\n            If present, this parameter will be included in a <style>\n            tag and will define stylistic attributes of the output.\n\n        * table_id : ID for the input table\n            If a string, this defines the HTML id of the table to be processed.\n            If an integer, this specifies the index of the input table in the\n            available tables. Unless this parameter is given, the reader will\n            use the first table found in the input file.\n\n        * multicol : Use multi-dimensional columns for output\n            The writer will output tuples as elements of multi-dimensional\n            columns if this parameter is true, and if not then it will\n            use the syntax 1.36583e-13 .. 1.36583e-13 for output. If not\n            present, this parameter will be true by default.\n\n        * raw_html_cols : column name or list of names with raw HTML content\n            This allows one to include raw HTML content in the column output,\n            for instance to include link references in a table.  This option\n            requires that the bleach package be installed.  Only whitelisted\n            tags are allowed through for security reasons (see the\n            raw_html_clean_kwargs arg).\n\n        * raw_html_clean_kwargs : dict of keyword args controlling HTML cleaning\n            Raw HTML will be cleaned to prevent unsafe HTML from ending up in\n            the table output.  This is done by calling ``bleach.clean(data,\n            **raw_html_clean_kwargs)``.  For details on the available options\n            (e.g. tag whitelist) see:\n            https://bleach.readthedocs.io/en/latest/clean.html\n\n        * parser : Specific HTML parsing library to use\n            If specified, this specifies which HTML parsing library\n            BeautifulSoup should use as a backend. The options to choose\n            from are 'html.parser' (the standard library parser), 'lxml'\n            (the recommended parser), 'xml' (lxml's XML parser), and\n            'html5lib'. html5lib is a highly lenient parser and therefore\n            might work correctly for unusual input if a different parser\n            fails.\n\n        * jsfiles : list of js files to include when writing table.\n\n        * cssfiles : list of css files to include when writing table.\n\n        * js : js script to include in the body when writing table.\n\n        * table_class : css class for the table\n\n    \"\"\"\n\n    _format_name = 'html'\n    _io_registry_format_aliases = ['html']\n    _io_registry_suffix = '.html'\n    _description = 'HTML table'\n\n    header_class = HTMLHeader\n    data_class = HTMLData\n    inputter_class = HTMLInputter\n\n    max_ndim = 2  # HTML supports writing 2-d columns with shape (n, m)\n\n    def __init__(self, htmldict={}):\n        \"\"\"\n        Initialize classes for HTML reading and writing.\n        \"\"\"\n        super().__init__()\n        self.html = deepcopy(htmldict)\n        if 'multicol' not in htmldict:\n            self.html['multicol'] = True\n        if 'table_id' not in htmldict:\n            self.html['table_id'] = 1\n        self.inputter.html = self.html\n\n    def read(self, table):\n        \"\"\"\n        Read the ``table`` in HTML format and return a resulting ``Table``.\n        \"\"\"\n\n        self.outputter = HTMLOutputter()\n        return super().read(table)\n\n    def write(self, table):\n        \"\"\"\n        Return data in ``table`` converted to HTML as a list of strings.\n        \"\"\"\n        # Check that table has only 1-d or 2-d columns. Above that fails.\n        self._check_multidim_table(table)\n\n        cols = list(table.columns.values())\n\n        self.data.header.cols = cols\n\n        if isinstance(self.data.fill_values, tuple):\n            self.data.fill_values = [self.data.fill_values]\n\n        self.data._set_fill_values(cols)\n\n        lines = []\n\n        # Set HTML escaping to False for any column in the raw_html_cols input\n        raw_html_cols = self.html.get('raw_html_cols', [])\n        if isinstance(raw_html_cols, str):\n            raw_html_cols = [raw_html_cols]  # Allow for a single string as input\n        cols_escaped = [col.info.name not in raw_html_cols for col in cols]\n\n        # Kwargs that get passed on to bleach.clean() if that is available.\n        raw_html_clean_kwargs = self.html.get('raw_html_clean_kwargs', {})\n\n        # Use XMLWriter to output HTML to lines\n        w = writer.XMLWriter(ListWriter(lines))\n\n        with w.tag('html'):\n            with w.tag('head'):\n                # Declare encoding and set CSS style for table\n                with w.tag('meta', attrib={'charset': 'utf-8'}):\n                    pass\n                with w.tag('meta', attrib={'http-equiv': 'Content-type',\n                                           'content': 'text/html;charset=UTF-8'}):\n                    pass\n                if 'css' in self.html:\n                    with w.tag('style'):\n                        w.data(self.html['css'])\n                if 'cssfiles' in self.html:\n                    for filename in self.html['cssfiles']:\n                        with w.tag('link', rel=\"stylesheet\", href=filename, type='text/css'):\n                            pass\n                if 'jsfiles' in self.html:\n                    for filename in self.html['jsfiles']:\n                        with w.tag('script', src=filename):\n                            w.data('')  # need this instead of pass to get <script></script>\n            with w.tag('body'):\n                if 'js' in self.html:\n                    with w.xml_cleaning_method('none'):\n                        with w.tag('script'):\n                            w.data(self.html['js'])\n                if isinstance(self.html['table_id'], str):\n                    html_table_id = self.html['table_id']\n                else:\n                    html_table_id = None\n                if 'table_class' in self.html:\n                    html_table_class = self.html['table_class']\n                    attrib = {\"class\": html_table_class}\n                else:\n                    attrib = {}\n                with w.tag('table', id=html_table_id, attrib=attrib):\n                    with w.tag('thead'):\n                        with w.tag('tr'):\n                            for col in cols:\n                                if len(col.shape) > 1 and self.html['multicol']:\n                                    # Set colspan attribute for multicolumns\n                                    w.start('th', colspan=col.shape[1])\n                                else:\n                                    w.start('th')\n                                w.data(col.info.name.strip())\n                                w.end(indent=False)\n                        col_str_iters = []\n                        new_cols_escaped = []\n\n                        # Make a container to hold any new_col objects created\n                        # below for multicolumn elements.  This is purely to\n                        # maintain a reference for these objects during\n                        # subsequent iteration to format column values.  This\n                        # requires that the weakref info._parent be maintained.\n                        new_cols = []\n\n                        for col, col_escaped in zip(cols, cols_escaped):\n                            if len(col.shape) > 1 and self.html['multicol']:\n                                span = col.shape[1]\n                                for i in range(span):\n                                    # Split up multicolumns into separate columns\n                                    new_col = Column([el[i] for el in col])\n\n                                    new_col_iter_str_vals = self.fill_values(\n                                        col, new_col.info.iter_str_vals())\n                                    col_str_iters.append(new_col_iter_str_vals)\n                                    new_cols_escaped.append(col_escaped)\n                                    new_cols.append(new_col)\n                            else:\n\n                                col_iter_str_vals = self.fill_values(col, col.info.iter_str_vals())\n                                col_str_iters.append(col_iter_str_vals)\n\n                                new_cols_escaped.append(col_escaped)\n\n                    for row in zip(*col_str_iters):\n                        with w.tag('tr'):\n                            for el, col_escaped in zip(row, new_cols_escaped):\n                                # Potentially disable HTML escaping for column\n                                method = ('escape_xml' if col_escaped else 'bleach_clean')\n                                with w.xml_cleaning_method(method, **raw_html_clean_kwargs):\n                                    w.start('td')\n                                    w.data(el.strip())\n                                    w.end(indent=False)\n\n        # Fixes XMLWriter's insertion of unwanted line breaks\n        return [''.join(lines)]\n\n    def fill_values(self, col, col_str_iters):\n        \"\"\"\n        Return an iterator of the values with replacements based on fill_values\n        \"\"\"\n        # check if the col is a masked column and has fill values\n        is_masked_column = hasattr(col, 'mask')\n        has_fill_values = hasattr(col, 'fill_values')\n\n        for idx, col_str in enumerate(col_str_iters):\n            if is_masked_column and has_fill_values:\n                if col.mask[idx]:\n                    yield col.fill_values[core.masked]\n                    continue\n\n            if has_fill_values:\n                if col_str in col.fill_values:\n                    yield col.fill_values[col_str]\n                    continue\n\n            yield col_str\n"},{"col":4,"comment":"null","endLoc":912,"header":"def __delattr__(self, attr)","id":4550,"name":"__delattr__","nodeType":"Function","startLoc":888,"text":"def __delattr__(self, attr):\n        # mirror __setattr__ above\n        if '_sky_coord_frame' in self.__dict__:\n            if self._is_name(attr):\n                raise AttributeError(f\"'{attr}' is immutable\")\n\n            if not attr.startswith('_') and hasattr(self._sky_coord_frame,\n                                                    attr):\n                delattr(self._sky_coord_frame, attr)\n                return\n\n            frame_cls = frame_transform_graph.lookup_name(attr)\n            if frame_cls is not None and self.frame.is_transformable_to(frame_cls):\n                raise AttributeError(f\"'{attr}' is immutable\")\n\n        if attr in frame_transform_graph.frame_attributes:\n            # All possible frame attributes can be deleted, but need to remove\n            # the corresponding private variable.  See __getattr__ above.\n            super().__delattr__('_' + attr)\n            # Also remove it from the set of extra attributes\n            self._extra_frameattr_names -= {attr}\n\n        else:\n            # Otherwise, do the standard Python attribute setting\n            super().__delattr__(attr)"},{"col":0,"comment":"null","endLoc":126,"header":"def _get_velocities(coord)","id":4551,"name":"_get_velocities","nodeType":"Function","startLoc":122,"text":"def _get_velocities(coord):\n    if 's' in coord.data.differentials:\n        return coord.velocity\n    else:\n        return ZERO_VELOCITIES"},{"col":0,"comment":"Try importing dependencies for reading HTML.\n\n    This is copied from pandas.io.html\n    ","endLoc":52,"header":"def import_html_libs()","id":4552,"name":"import_html_libs","nodeType":"Function","startLoc":33,"text":"def import_html_libs():\n    \"\"\"Try importing dependencies for reading HTML.\n\n    This is copied from pandas.io.html\n    \"\"\"\n    # import things we need\n    # but make this done on a first use basis\n\n    global _IMPORTS\n    if _IMPORTS:\n        return\n\n    global _HAS_BS4, _HAS_LXML, _HAS_HTML5LIB\n\n    from astropy.utils.compat.optional_deps import (\n        HAS_BS4 as _HAS_BS4,\n        HAS_LXML as _HAS_LXML,\n        HAS_HTML5LIB as _HAS_HTML5LIB\n    )\n    _IMPORTS = True"},{"col":0,"comment":"Provide io Table connector to read table using pandas.\n\n    ","endLoc":86,"header":"def _pandas_read(fmt, filespec, **kwargs)","id":4553,"name":"_pandas_read","nodeType":"Function","startLoc":55,"text":"def _pandas_read(fmt, filespec, **kwargs):\n    \"\"\"Provide io Table connector to read table using pandas.\n\n    \"\"\"\n    try:\n        import pandas\n    except ImportError:\n        raise ImportError('pandas must be installed to use pandas table reader')\n\n    pandas_fmt = fmt[len(PANDAS_PREFIX):]  # chop the 'pandas.' in front\n    read_func = getattr(pandas, 'read_' + pandas_fmt)\n\n    # Get defaults and then override with user-supplied values\n    read_kwargs = PANDAS_FMTS[pandas_fmt]['read'].copy()\n    read_kwargs.update(kwargs)\n\n    # Special case: pandas defaults to HTML lxml for reading, but does not attempt\n    # to fall back to bs4 + html5lib.  So do that now for convenience if user has\n    # not specifically selected a flavor.  If things go wrong the pandas exception\n    # with instruction to install a library will come up.\n    if pandas_fmt == 'html' and 'flavor' not in kwargs:\n        import_html_libs()\n        if (not _HAS_LXML and _HAS_HTML5LIB and _HAS_BS4):\n            read_kwargs['flavor'] = 'bs4'\n\n    df = read_func(filespec, **read_kwargs)\n\n    # Special case for HTML\n    if pandas_fmt == 'html':\n        df = df[0]\n\n    return Table.from_pandas(df)"},{"col":4,"comment":"\n        Override the builtin `dir` behavior to include:\n        - Transforms available by aliases\n        - Attribute / methods of the underlying self.frame object\n        ","endLoc":935,"header":"@override__dir__\n    def __dir__(self)","id":4554,"name":"__dir__","nodeType":"Function","startLoc":914,"text":"@override__dir__\n    def __dir__(self):\n        \"\"\"\n        Override the builtin `dir` behavior to include:\n        - Transforms available by aliases\n        - Attribute / methods of the underlying self.frame object\n        \"\"\"\n\n        # determine the aliases that this can be transformed to.\n        dir_values = set()\n        for name in frame_transform_graph.get_names():\n            frame_cls = frame_transform_graph.lookup_name(name)\n            if self.frame.is_transformable_to(frame_cls):\n                dir_values.add(name)\n\n        # Add public attributes of self.frame\n        dir_values.update(set(attr for attr in dir(self.frame) if not attr.startswith('_')))\n\n        # Add all possible frame attributes\n        dir_values.update(frame_transform_graph.frame_attributes.keys())\n\n        return dir_values"},{"className":"SoupString","col":0,"comment":"\n    Allows for strings to hold BeautifulSoup data.\n    ","endLoc":29,"id":4555,"nodeType":"Class","startLoc":20,"text":"class SoupString(str):\n    \"\"\"\n    Allows for strings to hold BeautifulSoup data.\n    \"\"\"\n\n    def __new__(cls, *args, **kwargs):\n        return str.__new__(cls, *args, **kwargs)\n\n    def __init__(self, val):\n        self.soup = val"},{"col":0,"comment":"Find the route down a CompoundModel's tree to the model with the\n    specified name (whether it's a leaf or not)","endLoc":4016,"header":"def _get_submodel_path(model, name)","id":4556,"name":"_get_submodel_path","nodeType":"Function","startLoc":4004,"text":"def _get_submodel_path(model, name):\n    \"\"\"Find the route down a CompoundModel's tree to the model with the\n    specified name (whether it's a leaf or not)\"\"\"\n    if getattr(model, 'name', None) == name:\n        return []\n    try:\n        return ['left'] + _get_submodel_path(model.left, name)\n    except (AttributeError, TypeError):\n        pass\n    try:\n        return ['right'] + _get_submodel_path(model.right, name)\n    except (AttributeError, TypeError):\n        pass"},{"col":4,"comment":"\n        Transforms the spectral axis to the rest frame.\n        ","endLoc":710,"header":"def to_rest(self)","id":4557,"name":"to_rest","nodeType":"Function","startLoc":700,"text":"def to_rest(self):\n        \"\"\"\n        Transforms the spectral axis to the rest frame.\n        \"\"\"\n\n        if self.observer is not None and self.target is not None:\n            return self.with_observer_stationary_relative_to(self.target)\n\n        result = _apply_relativistic_doppler_shift(self, -self.radial_velocity)\n\n        return self.replicate(value=result, radial_velocity=0. * KMS, redshift=None)"},{"col":4,"comment":"null","endLoc":948,"header":"def __repr__(self)","id":4558,"name":"__repr__","nodeType":"Function","startLoc":937,"text":"def __repr__(self):\n        clsnm = self.__class__.__name__\n        coonm = self.frame.__class__.__name__\n        frameattrs = self.frame._frame_attrs_repr()\n        if frameattrs:\n            frameattrs = ': ' + frameattrs\n\n        data = self.frame._data_repr()\n        if data:\n            data = ': ' + data\n\n        return '<{clsnm} ({coonm}{frameattrs}){data}>'.format(**locals())"},{"col":4,"comment":"null","endLoc":754,"header":"def __repr__(self)","id":4559,"name":"__repr__","nodeType":"Function","startLoc":712,"text":"def __repr__(self):\n\n        prefixstr = '<' + self.__class__.__name__ + ' '\n\n        try:\n            radial_velocity = self.radial_velocity\n            redshift = self.redshift\n        except ValueError:\n            radial_velocity = redshift = 'Undefined'\n\n        repr_items = [f'{prefixstr}']\n\n        if self.observer is not None:\n            observer_repr = indent(repr(self.observer), 14 * ' ').lstrip()\n            repr_items.append(f'    observer: {observer_repr}')\n\n        if self.target is not None:\n            target_repr = indent(repr(self.target), 12 * ' ').lstrip()\n            repr_items.append(f'    target: {target_repr}')\n\n        if (self._observer is not None and self._target is not None) or self._radial_velocity is not None:\n            if self.observer is not None and self.target is not None:\n                repr_items.append('    observer to target (computed from above):')\n            else:\n                repr_items.append('    observer to target:')\n            repr_items.append(f'      radial_velocity={radial_velocity}')\n            repr_items.append(f'      redshift={redshift}')\n\n        if self.doppler_rest is not None or self.doppler_convention is not None:\n            repr_items.append(f'    doppler_rest={self.doppler_rest}')\n            repr_items.append(f'    doppler_convention={self.doppler_convention}')\n\n        arrstr = np.array2string(self.view(np.ndarray), separator=', ',\n                                 prefix='  ')\n\n        if len(repr_items) == 1:\n            repr_items[0] += f'{arrstr}{self._unitstr:s}'\n        else:\n            repr_items[1] = '   (' + repr_items[1].lstrip()\n            repr_items[-1] += ')'\n            repr_items.append(f'  {arrstr}{self._unitstr:s}')\n\n        return '\\n'.join(repr_items) + '>'"},{"col":4,"comment":"null","endLoc":26,"header":"def __new__(cls, *args, **kwargs)","id":4560,"name":"__new__","nodeType":"Function","startLoc":25,"text":"def __new__(cls, *args, **kwargs):\n        return str.__new__(cls, *args, **kwargs)"},{"col":4,"comment":"null","endLoc":29,"header":"def __init__(self, val)","id":4561,"name":"__init__","nodeType":"Function","startLoc":28,"text":"def __init__(self, val):\n        self.soup = val"},{"attributeType":"null","col":8,"comment":"null","endLoc":29,"id":4562,"name":"soup","nodeType":"Attribute","startLoc":29,"text":"self.soup"},{"col":4,"comment":"\n        A string representation of the coordinates.\n\n        The default styles definitions are::\n\n          'decimal': 'lat': {'decimal': True, 'unit': \"deg\"}\n                     'lon': {'decimal': True, 'unit': \"deg\"}\n          'dms': 'lat': {'unit': \"deg\"}\n                 'lon': {'unit': \"deg\"}\n          'hmsdms': 'lat': {'alwayssign': True, 'pad': True, 'unit': \"deg\"}\n                    'lon': {'pad': True, 'unit': \"hour\"}\n\n        See :meth:`~astropy.coordinates.Angle.to_string` for details and\n        keyword arguments (the two angles forming the coordinates are are\n        both :class:`~astropy.coordinates.Angle` instances). Keyword\n        arguments have precedence over the style defaults and are passed\n        to :meth:`~astropy.coordinates.Angle.to_string`.\n\n        Parameters\n        ----------\n        style : {'hmsdms', 'dms', 'decimal'}\n            The formatting specification to use. These encode the three most\n            common ways to represent coordinates. The default is `decimal`.\n        kwargs\n            Keyword args passed to :meth:`~astropy.coordinates.Angle.to_string`.\n        ","endLoc":1011,"header":"def to_string(self, style='decimal', **kwargs)","id":4563,"name":"to_string","nodeType":"Function","startLoc":950,"text":"def to_string(self, style='decimal', **kwargs):\n        \"\"\"\n        A string representation of the coordinates.\n\n        The default styles definitions are::\n\n          'decimal': 'lat': {'decimal': True, 'unit': \"deg\"}\n                     'lon': {'decimal': True, 'unit': \"deg\"}\n          'dms': 'lat': {'unit': \"deg\"}\n                 'lon': {'unit': \"deg\"}\n          'hmsdms': 'lat': {'alwayssign': True, 'pad': True, 'unit': \"deg\"}\n                    'lon': {'pad': True, 'unit': \"hour\"}\n\n        See :meth:`~astropy.coordinates.Angle.to_string` for details and\n        keyword arguments (the two angles forming the coordinates are are\n        both :class:`~astropy.coordinates.Angle` instances). Keyword\n        arguments have precedence over the style defaults and are passed\n        to :meth:`~astropy.coordinates.Angle.to_string`.\n\n        Parameters\n        ----------\n        style : {'hmsdms', 'dms', 'decimal'}\n            The formatting specification to use. These encode the three most\n            common ways to represent coordinates. The default is `decimal`.\n        kwargs\n            Keyword args passed to :meth:`~astropy.coordinates.Angle.to_string`.\n        \"\"\"\n\n        sph_coord = self.frame.represent_as(SphericalRepresentation)\n\n        styles = {'hmsdms': {'lonargs': {'unit': u.hour, 'pad': True},\n                             'latargs': {'unit': u.degree, 'pad': True, 'alwayssign': True}},\n                  'dms': {'lonargs': {'unit': u.degree},\n                          'latargs': {'unit': u.degree}},\n                  'decimal': {'lonargs': {'unit': u.degree, 'decimal': True},\n                              'latargs': {'unit': u.degree, 'decimal': True}}\n                  }\n\n        lonargs = {}\n        latargs = {}\n\n        if style in styles:\n            lonargs.update(styles[style]['lonargs'])\n            latargs.update(styles[style]['latargs'])\n        else:\n            raise ValueError(f\"Invalid style.  Valid options are: {','.join(styles)}\")\n\n        lonargs.update(kwargs)\n        latargs.update(kwargs)\n\n        if np.isscalar(sph_coord.lon.value):\n            coord_string = (sph_coord.lon.to_string(**lonargs) +\n                            \" \" + sph_coord.lat.to_string(**latargs))\n        else:\n            coord_string = []\n            for lonangle, latangle in zip(sph_coord.lon.ravel(), sph_coord.lat.ravel()):\n                coord_string += [(lonangle.to_string(**lonargs) +\n                                 \" \" + latangle.to_string(**latargs))]\n            if len(sph_coord.shape) > 1:\n                coord_string = np.array(coord_string).reshape(sph_coord.shape)\n\n        return coord_string"},{"className":"ListWriter","col":0,"comment":"\n    Allows for XMLWriter to write to a list instead of a file.\n    ","endLoc":41,"id":4564,"nodeType":"Class","startLoc":32,"text":"class ListWriter:\n    \"\"\"\n    Allows for XMLWriter to write to a list instead of a file.\n    \"\"\"\n\n    def __init__(self, out):\n        self.out = out\n\n    def write(self, data):\n        self.out.append(data)"},{"col":4,"comment":"null","endLoc":38,"header":"def __init__(self, out)","id":4565,"name":"__init__","nodeType":"Function","startLoc":37,"text":"def __init__(self, out):\n        self.out = out"},{"col":4,"comment":"null","endLoc":41,"header":"def write(self, data)","id":4566,"name":"write","nodeType":"Function","startLoc":40,"text":"def write(self, data):\n        self.out.append(data)"},{"attributeType":"null","col":8,"comment":"null","endLoc":38,"id":4567,"name":"out","nodeType":"Attribute","startLoc":38,"text":"self.out"},{"className":"HTMLInputter","col":0,"comment":"\n    Input lines of HTML in a valid form.\n\n    This requires `BeautifulSoup\n    <http://www.crummy.com/software/BeautifulSoup/>`_ to be installed.\n    ","endLoc":109,"id":4568,"nodeType":"Class","startLoc":66,"text":"class HTMLInputter(core.BaseInputter):\n    \"\"\"\n    Input lines of HTML in a valid form.\n\n    This requires `BeautifulSoup\n    <http://www.crummy.com/software/BeautifulSoup/>`_ to be installed.\n    \"\"\"\n\n    def process_lines(self, lines):\n        \"\"\"\n        Convert the given input into a list of SoupString rows\n        for further processing.\n        \"\"\"\n\n        try:\n            from bs4 import BeautifulSoup\n        except ImportError:\n            raise core.OptionalTableImportError('BeautifulSoup must be '\n                                                'installed to read HTML tables')\n\n        if 'parser' not in self.html:\n            with warnings.catch_warnings():\n                # Ignore bs4 parser warning #4550.\n                warnings.filterwarnings('ignore', '.*no parser was explicitly specified.*')\n                soup = BeautifulSoup('\\n'.join(lines))\n        else:  # use a custom backend parser\n            soup = BeautifulSoup('\\n'.join(lines), self.html['parser'])\n        tables = soup.find_all('table')\n        for i, possible_table in enumerate(tables):\n            if identify_table(possible_table, self.html, i + 1):\n                table = possible_table  # Find the correct table\n                break\n        else:\n            if isinstance(self.html['table_id'], int):\n                err_descr = f\"number {self.html['table_id']}\"\n            else:\n                err_descr = f\"id '{self.html['table_id']}'\"\n            raise core.InconsistentTableError(\n                f'ERROR: HTML table {err_descr} not found')\n\n        # Get all table rows\n        soup_list = [SoupString(x) for x in table.find_all('tr')]\n\n        return soup_list"},{"className":"BaseInputter","col":0,"comment":"\n    Get the lines from the table input and return a list of lines.\n\n    ","endLoc":368,"id":4569,"nodeType":"Class","startLoc":295,"text":"class BaseInputter:\n    \"\"\"\n    Get the lines from the table input and return a list of lines.\n\n    \"\"\"\n\n    encoding = None\n    \"\"\"Encoding used to read the file\"\"\"\n\n    def get_lines(self, table, newline=None):\n        \"\"\"\n        Get the lines from the ``table`` input. The input table can be one of:\n\n        * File name\n        * String (newline separated) with all header and data lines (must have at least 2 lines)\n        * File-like object with read() method\n        * List of strings\n\n        Parameters\n        ----------\n        table : str, file-like, list\n            Can be either a file name, string (newline separated) with all header and data\n            lines (must have at least 2 lines), a file-like object with a\n            ``read()`` method, or a list of strings.\n        newline :\n            Line separator. If `None` use OS default from ``splitlines()``.\n\n        Returns\n        -------\n        lines : list\n            List of lines\n        \"\"\"\n        try:\n            if (hasattr(table, 'read')\n                    or ('\\n' not in table + '' and '\\r' not in table + '')):\n                with get_readable_fileobj(table,\n                                          encoding=self.encoding) as fileobj:\n                    table = fileobj.read()\n            if newline is None:\n                lines = table.splitlines()\n            else:\n                lines = table.split(newline)\n        except TypeError:\n            try:\n                # See if table supports indexing, slicing, and iteration\n                table[0]\n                table[0:1]\n                iter(table)\n                if len(table) > 1:\n                    lines = table\n                else:\n                    # treat single entry as if string had been passed directly\n                    if newline is None:\n                        lines = table[0].splitlines()\n                    else:\n                        lines = table[0].split(newline)\n\n            except TypeError:\n                raise TypeError(\n                    'Input \"table\" must be a string (filename or data) or an iterable')\n\n        return self.process_lines(lines)\n\n    def process_lines(self, lines):\n        \"\"\"Process lines for subsequent use.  In the default case do nothing.\n        This routine is not generally intended for removing comment lines or\n        stripping whitespace.  These are done (if needed) in the header and\n        data line processing.\n\n        Override this method if something more has to be done to convert raw\n        input lines to the table rows.  For example the\n        ContinuationLinesInputter derived class accounts for continuation\n        characters if a row is split into lines.\"\"\"\n        return lines"},{"col":4,"comment":"\n        Get the lines from the ``table`` input. The input table can be one of:\n\n        * File name\n        * String (newline separated) with all header and data lines (must have at least 2 lines)\n        * File-like object with read() method\n        * List of strings\n\n        Parameters\n        ----------\n        table : str, file-like, list\n            Can be either a file name, string (newline separated) with all header and data\n            lines (must have at least 2 lines), a file-like object with a\n            ``read()`` method, or a list of strings.\n        newline :\n            Line separator. If `None` use OS default from ``splitlines()``.\n\n        Returns\n        -------\n        lines : list\n            List of lines\n        ","endLoc":356,"header":"def get_lines(self, table, newline=None)","id":4570,"name":"get_lines","nodeType":"Function","startLoc":304,"text":"def get_lines(self, table, newline=None):\n        \"\"\"\n        Get the lines from the ``table`` input. The input table can be one of:\n\n        * File name\n        * String (newline separated) with all header and data lines (must have at least 2 lines)\n        * File-like object with read() method\n        * List of strings\n\n        Parameters\n        ----------\n        table : str, file-like, list\n            Can be either a file name, string (newline separated) with all header and data\n            lines (must have at least 2 lines), a file-like object with a\n            ``read()`` method, or a list of strings.\n        newline :\n            Line separator. If `None` use OS default from ``splitlines()``.\n\n        Returns\n        -------\n        lines : list\n            List of lines\n        \"\"\"\n        try:\n            if (hasattr(table, 'read')\n                    or ('\\n' not in table + '' and '\\r' not in table + '')):\n                with get_readable_fileobj(table,\n                                          encoding=self.encoding) as fileobj:\n                    table = fileobj.read()\n            if newline is None:\n                lines = table.splitlines()\n            else:\n                lines = table.split(newline)\n        except TypeError:\n            try:\n                # See if table supports indexing, slicing, and iteration\n                table[0]\n                table[0:1]\n                iter(table)\n                if len(table) > 1:\n                    lines = table\n                else:\n                    # treat single entry as if string had been passed directly\n                    if newline is None:\n                        lines = table[0].splitlines()\n                    else:\n                        lines = table[0].split(newline)\n\n            except TypeError:\n                raise TypeError(\n                    'Input \"table\" must be a string (filename or data) or an iterable')\n\n        return self.process_lines(lines)"},{"attributeType":"null","col":12,"comment":"null","endLoc":207,"id":4571,"name":"observer","nodeType":"Attribute","startLoc":207,"text":"observer"},{"col":4,"comment":"\n        Transform this object's coordinate data to a new frame.\n\n        Parameters\n        ----------\n        new_frame : coordinate-like or `BaseCoordinateFrame` subclass instance\n            The frame to transform this coordinate frame into.\n            The frame class option is deprecated.\n\n        Returns\n        -------\n        transframe : coordinate-like\n            A new object with the coordinate data represented in the\n            ``newframe`` system.\n\n        Raises\n        ------\n        ValueError\n            If there is no possible transformation route.\n        ","endLoc":1205,"header":"def transform_to(self, new_frame)","id":4572,"name":"transform_to","nodeType":"Function","startLoc":1147,"text":"def transform_to(self, new_frame):\n        \"\"\"\n        Transform this object's coordinate data to a new frame.\n\n        Parameters\n        ----------\n        new_frame : coordinate-like or `BaseCoordinateFrame` subclass instance\n            The frame to transform this coordinate frame into.\n            The frame class option is deprecated.\n\n        Returns\n        -------\n        transframe : coordinate-like\n            A new object with the coordinate data represented in the\n            ``newframe`` system.\n\n        Raises\n        ------\n        ValueError\n            If there is no possible transformation route.\n        \"\"\"\n        from .errors import ConvertError\n\n        if self._data is None:\n            raise ValueError('Cannot transform a frame with no data')\n\n        if (getattr(self.data, 'differentials', None)\n                and hasattr(self, 'obstime') and hasattr(new_frame, 'obstime')\n                and np.any(self.obstime != new_frame.obstime)):\n            raise NotImplementedError('You cannot transform a frame that has '\n                                      'velocities to another frame at a '\n                                      'different obstime. If you think this '\n                                      'should (or should not) be possible, '\n                                      'please comment at https://github.com/astropy/astropy/issues/6280')\n\n        if inspect.isclass(new_frame):\n            warnings.warn(\"Transforming a frame instance to a frame class (as opposed to another \"\n                          \"frame instance) will not be supported in the future.  Either \"\n                          \"explicitly instantiate the target frame, or first convert the source \"\n                          \"frame instance to a `astropy.coordinates.SkyCoord` and use its \"\n                          \"`transform_to()` method.\",\n                          AstropyDeprecationWarning)\n            # Use the default frame attributes for this class\n            new_frame = new_frame()\n\n        if hasattr(new_frame, '_sky_coord_frame'):\n            # Input new_frame is not a frame instance or class and is most\n            # likely a SkyCoord object.\n            new_frame = new_frame._sky_coord_frame\n\n        trans = frame_transform_graph.get_transform(self.__class__,\n                                                    new_frame.__class__)\n        if trans is None:\n            if new_frame is self.__class__:\n                # no special transform needed, but should update frame info\n                return new_frame.realize_frame(self.data)\n            msg = 'Cannot transform from {0} to {1}'\n            raise ConvertError(msg.format(self.__class__, new_frame.__class__))\n        return trans(self, new_frame)"},{"attributeType":"null","col":12,"comment":"null","endLoc":195,"id":4573,"name":"redshift","nodeType":"Attribute","startLoc":195,"text":"redshift"},{"col":4,"comment":"\n        Convert this |SkyCoord| to a |QTable|.\n\n        Any attributes that have the same length as the |SkyCoord| will be\n        converted to columns of the |QTable|. All other attributes will be\n        recorded as metadata.\n\n        Returns\n        -------\n        `~astropy.table.QTable`\n            A |QTable| containing the data of this |SkyCoord|.\n\n        Examples\n        --------\n        >>> sc = SkyCoord(ra=[40, 70]*u.deg, dec=[0, -20]*u.deg,\n        ...               obstime=Time([2000, 2010], format='jyear'))\n        >>> t =  sc.to_table()\n        >>> t\n        <QTable length=2>\n           ra     dec   obstime\n          deg     deg\n        float64 float64   Time\n        ------- ------- -------\n           40.0     0.0  2000.0\n           70.0   -20.0  2010.0\n        >>> t.meta\n        {'representation_type': 'spherical', 'frame': 'icrs'}\n        ","endLoc":1053,"header":"def to_table(self)","id":4574,"name":"to_table","nodeType":"Function","startLoc":1013,"text":"def to_table(self):\n        \"\"\"\n        Convert this |SkyCoord| to a |QTable|.\n\n        Any attributes that have the same length as the |SkyCoord| will be\n        converted to columns of the |QTable|. All other attributes will be\n        recorded as metadata.\n\n        Returns\n        -------\n        `~astropy.table.QTable`\n            A |QTable| containing the data of this |SkyCoord|.\n\n        Examples\n        --------\n        >>> sc = SkyCoord(ra=[40, 70]*u.deg, dec=[0, -20]*u.deg,\n        ...               obstime=Time([2000, 2010], format='jyear'))\n        >>> t =  sc.to_table()\n        >>> t\n        <QTable length=2>\n           ra     dec   obstime\n          deg     deg\n        float64 float64   Time\n        ------- ------- -------\n           40.0     0.0  2000.0\n           70.0   -20.0  2010.0\n        >>> t.meta\n        {'representation_type': 'spherical', 'frame': 'icrs'}\n        \"\"\"\n        self_as_dict = self.info._represent_as_dict()\n        tabledata = {}\n        metadata = {}\n        # Record attributes that have the same length as self as columns in the\n        # table, and the other attributes as table metadata.  This matches\n        # table.serialize._represent_mixin_as_column().\n        for key, value in self_as_dict.items():\n            if getattr(value, 'shape', ())[:1] == (len(self),):\n                tabledata[key] = value\n            else:\n                metadata[key] = value\n        return QTable(tabledata, meta=metadata)"},{"col":4,"comment":"\n        Provides a work-around to properly set the sub models and respective\n        parameters's units/values when using ``without_units_for_data``\n        or ``without_units_for_data`` methods.\n        ","endLoc":3907,"header":"def _set_sub_models_and_parameter_units(self, left, right)","id":4575,"name":"_set_sub_models_and_parameter_units","nodeType":"Function","startLoc":3891,"text":"def _set_sub_models_and_parameter_units(self, left, right):\n        \"\"\"\n        Provides a work-around to properly set the sub models and respective\n        parameters's units/values when using ``without_units_for_data``\n        or ``without_units_for_data`` methods.\n        \"\"\"\n        model = CompoundModel(self.op, left, right)\n\n        self.left = left\n        self.right = right\n\n        for name in model.param_names:\n            model_parameter = getattr(model, name)\n            parameter = getattr(self, name)\n\n            parameter.value = model_parameter.value\n            parameter._set_unit(model_parameter.unit, force=True)"},{"attributeType":"null","col":8,"comment":"null","endLoc":218,"id":4576,"name":"_radial_velocity","nodeType":"Attribute","startLoc":218,"text":"obj._radial_velocity"},{"attributeType":"null","col":16,"comment":"null","endLoc":216,"id":4577,"name":"radial_velocity","nodeType":"Attribute","startLoc":216,"text":"radial_velocity"},{"col":4,"comment":"\n        See `~astropy.modeling.Model.without_units_for_data` for overview\n        of this method.\n\n        Notes\n        -----\n        This modifies the behavior of the base method to account for the\n        case where the sub-models of a compound model have different output\n        units. This is only valid for compound * and / compound models as\n        in that case it is reasonable to mix the output units. It does this\n        by modifying the output units of each sub model by using the output\n        units of the other sub model so that we can apply the original function\n        and get the desired result.\n\n        Additional data has to be output in the mixed output unit case\n        so that the units can be properly rebuilt by\n        `~astropy.modeling.CompoundModel.with_units_from_data`.\n\n        Outside the mixed output units, this method is identical to the\n        base method.\n        ","endLoc":3968,"header":"def without_units_for_data(self, **kwargs)","id":4578,"name":"without_units_for_data","nodeType":"Function","startLoc":3909,"text":"def without_units_for_data(self, **kwargs):\n        \"\"\"\n        See `~astropy.modeling.Model.without_units_for_data` for overview\n        of this method.\n\n        Notes\n        -----\n        This modifies the behavior of the base method to account for the\n        case where the sub-models of a compound model have different output\n        units. This is only valid for compound * and / compound models as\n        in that case it is reasonable to mix the output units. It does this\n        by modifying the output units of each sub model by using the output\n        units of the other sub model so that we can apply the original function\n        and get the desired result.\n\n        Additional data has to be output in the mixed output unit case\n        so that the units can be properly rebuilt by\n        `~astropy.modeling.CompoundModel.with_units_from_data`.\n\n        Outside the mixed output units, this method is identical to the\n        base method.\n        \"\"\"\n        if self.op in ['*', '/']:\n            model = self.copy()\n            inputs = {inp: kwargs[inp] for inp in self.inputs}\n\n            left_units = self.left.output_units(**kwargs)\n            right_units = self.right.output_units(**kwargs)\n\n            if self.op == '*':\n                left_kwargs = {out: kwargs[out] / right_units[out]\n                               for out in self.left.outputs if kwargs[out] is not None}\n                right_kwargs = {out: kwargs[out] / left_units[out]\n                                for out in self.right.outputs if kwargs[out] is not None}\n            else:\n                left_kwargs = {out: kwargs[out] * right_units[out]\n                               for out in self.left.outputs if kwargs[out] is not None}\n                right_kwargs = {out: 1 / kwargs[out] * left_units[out]\n                                for out in self.right.outputs if kwargs[out] is not None}\n\n            left_kwargs.update(inputs.copy())\n            right_kwargs.update(inputs.copy())\n\n            left = self.left.without_units_for_data(**left_kwargs)\n            if isinstance(left, tuple):\n                left_kwargs['_left_kwargs'] = left[1]\n                left_kwargs['_right_kwargs'] = left[2]\n                left = left[0]\n\n            right = self.right.without_units_for_data(**right_kwargs)\n            if isinstance(right, tuple):\n                right_kwargs['_left_kwargs'] = right[1]\n                right_kwargs['_right_kwargs'] = right[2]\n                right = right[0]\n\n            model._set_sub_models_and_parameter_units(left, right)\n\n            return model, left_kwargs, right_kwargs\n        else:\n            return super().without_units_for_data(**kwargs)"},{"attributeType":"null","col":8,"comment":"null","endLoc":176,"id":4579,"name":"obj","nodeType":"Attribute","startLoc":176,"text":"obj"},{"attributeType":"null","col":8,"comment":"null","endLoc":219,"id":4580,"name":"_observer","nodeType":"Attribute","startLoc":219,"text":"obj._observer"},{"attributeType":"null","col":8,"comment":"null","endLoc":220,"id":4581,"name":"_target","nodeType":"Attribute","startLoc":220,"text":"obj._target"},{"attributeType":"null","col":12,"comment":"null","endLoc":209,"id":4582,"name":"target","nodeType":"Attribute","startLoc":209,"text":"target"},{"className":"SpectralCoordType","col":0,"comment":"\n    ASDF tag implementation used to serialize/derialize SpectralCoord objects\n    ","endLoc":46,"id":4583,"nodeType":"Class","startLoc":14,"text":"class SpectralCoordType(AstropyType):\n    \"\"\"\n    ASDF tag implementation used to serialize/derialize SpectralCoord objects\n    \"\"\"\n    name = 'coordinates/spectralcoord'\n    types = [SpectralCoord]\n    version = '1.0.0'\n\n    @classmethod\n    def to_tree(cls, spec_coord, ctx):\n        node = {}\n        if isinstance(spec_coord, SpectralCoord):\n            node['value'] = spec_coord.value\n            node['unit'] = spec_coord.unit\n            if spec_coord.observer is not None:\n                node['observer'] = spec_coord.observer\n            if spec_coord.target is not None:\n                node['target'] = spec_coord.target\n            return node\n        raise TypeError(f\"'{spec_coord}' is not a valid SpectralCoord\")\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        if isinstance(node, SpectralCoord):\n            return node\n\n        unit = UnitType.from_tree(node['unit'], ctx)\n        value = node['value']\n        observer = node['observer'] if 'observer' in node else None\n        target = node['target'] if 'observer' in node else None\n        if isinstance(value, NDArrayType):\n            value = value._make_array()\n        return SpectralCoord(value, unit=unit, observer=observer, target=target)"},{"col":4,"comment":"Process lines for subsequent use.  In the default case do nothing.\n        This routine is not generally intended for removing comment lines or\n        stripping whitespace.  These are done (if needed) in the header and\n        data line processing.\n\n        Override this method if something more has to be done to convert raw\n        input lines to the table rows.  For example the\n        ContinuationLinesInputter derived class accounts for continuation\n        characters if a row is split into lines.","endLoc":368,"header":"def process_lines(self, lines)","id":4584,"name":"process_lines","nodeType":"Function","startLoc":358,"text":"def process_lines(self, lines):\n        \"\"\"Process lines for subsequent use.  In the default case do nothing.\n        This routine is not generally intended for removing comment lines or\n        stripping whitespace.  These are done (if needed) in the header and\n        data line processing.\n\n        Override this method if something more has to be done to convert raw\n        input lines to the table rows.  For example the\n        ContinuationLinesInputter derived class accounts for continuation\n        characters if a row is split into lines.\"\"\"\n        return lines"},{"attributeType":"null","col":4,"comment":"Encoding used to read the file","endLoc":301,"id":4585,"name":"encoding","nodeType":"Attribute","startLoc":301,"text":"encoding"},{"col":4,"comment":"null","endLoc":33,"header":"@classmethod\n    def to_tree(cls, spec_coord, ctx)","id":4586,"name":"to_tree","nodeType":"Function","startLoc":22,"text":"@classmethod\n    def to_tree(cls, spec_coord, ctx):\n        node = {}\n        if isinstance(spec_coord, SpectralCoord):\n            node['value'] = spec_coord.value\n            node['unit'] = spec_coord.unit\n            if spec_coord.observer is not None:\n                node['observer'] = spec_coord.observer\n            if spec_coord.target is not None:\n                node['target'] = spec_coord.target\n            return node\n        raise TypeError(f\"'{spec_coord}' is not a valid SpectralCoord\")"},{"col":4,"comment":"\n        Convert the given input into a list of SoupString rows\n        for further processing.\n        ","endLoc":109,"header":"def process_lines(self, lines)","id":4587,"name":"process_lines","nodeType":"Function","startLoc":74,"text":"def process_lines(self, lines):\n        \"\"\"\n        Convert the given input into a list of SoupString rows\n        for further processing.\n        \"\"\"\n\n        try:\n            from bs4 import BeautifulSoup\n        except ImportError:\n            raise core.OptionalTableImportError('BeautifulSoup must be '\n                                                'installed to read HTML tables')\n\n        if 'parser' not in self.html:\n            with warnings.catch_warnings():\n                # Ignore bs4 parser warning #4550.\n                warnings.filterwarnings('ignore', '.*no parser was explicitly specified.*')\n                soup = BeautifulSoup('\\n'.join(lines))\n        else:  # use a custom backend parser\n            soup = BeautifulSoup('\\n'.join(lines), self.html['parser'])\n        tables = soup.find_all('table')\n        for i, possible_table in enumerate(tables):\n            if identify_table(possible_table, self.html, i + 1):\n                table = possible_table  # Find the correct table\n                break\n        else:\n            if isinstance(self.html['table_id'], int):\n                err_descr = f\"number {self.html['table_id']}\"\n            else:\n                err_descr = f\"id '{self.html['table_id']}'\"\n            raise core.InconsistentTableError(\n                f'ERROR: HTML table {err_descr} not found')\n\n        # Get all table rows\n        soup_list = [SoupString(x) for x in table.find_all('tr')]\n\n        return soup_list"},{"col":4,"comment":"null","endLoc":46,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":4588,"name":"from_tree","nodeType":"Function","startLoc":35,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        if isinstance(node, SpectralCoord):\n            return node\n\n        unit = UnitType.from_tree(node['unit'], ctx)\n        value = node['value']\n        observer = node['observer'] if 'observer' in node else None\n        target = node['target'] if 'observer' in node else None\n        if isinstance(value, NDArrayType):\n            value = value._make_array()\n        return SpectralCoord(value, unit=unit, observer=observer, target=target)"},{"col":0,"comment":"Provide io Table connector to write table using pandas.\n\n    ","endLoc":111,"header":"def _pandas_write(fmt, tbl, filespec, overwrite=False, **kwargs)","id":4589,"name":"_pandas_write","nodeType":"Function","startLoc":89,"text":"def _pandas_write(fmt, tbl, filespec, overwrite=False, **kwargs):\n    \"\"\"Provide io Table connector to write table using pandas.\n\n    \"\"\"\n    pandas_fmt = fmt[len(PANDAS_PREFIX):]  # chop the 'pandas.' in front\n\n    # Get defaults and then override with user-supplied values\n    write_kwargs = PANDAS_FMTS[pandas_fmt]['write'].copy()\n    write_kwargs.update(kwargs)\n\n    df = tbl.to_pandas()\n    write_method = getattr(df, 'to_' + pandas_fmt)\n\n    if not overwrite:\n        try:  # filespec is not always a path-like\n            exists = os.path.exists(filespec)\n        except TypeError:  # skip invalid arguments\n            pass\n        else:\n            if exists:  # only error if file already exists\n                raise OSError(NOT_OVERWRITING_MSG.format(filespec))\n\n    return write_method(filespec, **write_kwargs)"},{"col":4,"comment":"\n        See `~astropy.modeling.Model.with_units_from_data` for overview\n        of this method.\n\n        Notes\n        -----\n        This modifies the behavior of the base method to account for the\n        case where the sub-models of a compound model have different output\n        units. This is only valid for compound * and / compound models as\n        in that case it is reasonable to mix the output units. In order to\n        do this it requires some additional information output by\n        `~astropy.modeling.CompoundModel.without_units_for_data` passed as\n        keyword arguments under the keywords ``_left_kwargs`` and ``_right_kwargs``.\n\n        Outside the mixed output units, this method is identical to the\n        base method.\n        ","endLoc":4001,"header":"def with_units_from_data(self, **kwargs)","id":4590,"name":"with_units_from_data","nodeType":"Function","startLoc":3970,"text":"def with_units_from_data(self, **kwargs):\n        \"\"\"\n        See `~astropy.modeling.Model.with_units_from_data` for overview\n        of this method.\n\n        Notes\n        -----\n        This modifies the behavior of the base method to account for the\n        case where the sub-models of a compound model have different output\n        units. This is only valid for compound * and / compound models as\n        in that case it is reasonable to mix the output units. In order to\n        do this it requires some additional information output by\n        `~astropy.modeling.CompoundModel.without_units_for_data` passed as\n        keyword arguments under the keywords ``_left_kwargs`` and ``_right_kwargs``.\n\n        Outside the mixed output units, this method is identical to the\n        base method.\n        \"\"\"\n\n        if self.op in ['*', '/']:\n            left_kwargs = kwargs.pop('_left_kwargs')\n            right_kwargs = kwargs.pop('_right_kwargs')\n\n            left = self.left.with_units_from_data(**left_kwargs)\n            right = self.right.with_units_from_data(**right_kwargs)\n\n            model = self.copy()\n            model._set_sub_models_and_parameter_units(left, right)\n\n            return model\n        else:\n            return super().with_units_from_data(**kwargs)"},{"col":0,"comment":"\n    Checks whether the given BeautifulSoup tag is the table\n    the user intends to process.\n    ","endLoc":63,"header":"def identify_table(soup, htmldict, numtable)","id":4591,"name":"identify_table","nodeType":"Function","startLoc":44,"text":"def identify_table(soup, htmldict, numtable):\n    \"\"\"\n    Checks whether the given BeautifulSoup tag is the table\n    the user intends to process.\n    \"\"\"\n\n    if soup is None or soup.name != 'table':\n        return False  # Tag is not a <table>\n\n    elif 'table_id' not in htmldict:\n        return numtable == 1\n    table_id = htmldict['table_id']\n\n    if isinstance(table_id, str):\n        return 'id' in soup.attrs and soup['id'] == table_id\n    elif isinstance(table_id, int):\n        return table_id == numtable\n\n    # Return False if an invalid parameter is given\n    return False"},{"attributeType":"null","col":30,"comment":"null","endLoc":9,"id":4592,"name":"io_registry","nodeType":"Attribute","startLoc":9,"text":"io_registry"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":4593,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":4594,"name":"PANDAS_FMTS","nodeType":"Attribute","startLoc":16,"text":"PANDAS_FMTS"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":4595,"name":"PANDAS_PREFIX","nodeType":"Attribute","startLoc":24,"text":"PANDAS_PREFIX"},{"col":4,"comment":"\n        Checks if this object's frame as the same as that of the ``other``\n        object.\n\n        To be the same frame, two objects must be the same frame class and have\n        the same frame attributes. For two `SkyCoord` objects, *all* of the\n        frame attributes have to match, not just those relevant for the object's\n        frame.\n\n        Parameters\n        ----------\n        other : SkyCoord or BaseCoordinateFrame\n            The other object to check.\n\n        Returns\n        -------\n        isequiv : bool\n            True if the frames are the same, False if not.\n\n        Raises\n        ------\n        TypeError\n            If ``other`` isn't a `SkyCoord` or a `BaseCoordinateFrame` or subclass.\n        ","endLoc":1094,"header":"def is_equivalent_frame(self, other)","id":4596,"name":"is_equivalent_frame","nodeType":"Function","startLoc":1055,"text":"def is_equivalent_frame(self, other):\n        \"\"\"\n        Checks if this object's frame as the same as that of the ``other``\n        object.\n\n        To be the same frame, two objects must be the same frame class and have\n        the same frame attributes. For two `SkyCoord` objects, *all* of the\n        frame attributes have to match, not just those relevant for the object's\n        frame.\n\n        Parameters\n        ----------\n        other : SkyCoord or BaseCoordinateFrame\n            The other object to check.\n\n        Returns\n        -------\n        isequiv : bool\n            True if the frames are the same, False if not.\n\n        Raises\n        ------\n        TypeError\n            If ``other`` isn't a `SkyCoord` or a `BaseCoordinateFrame` or subclass.\n        \"\"\"\n        if isinstance(other, BaseCoordinateFrame):\n            return self.frame.is_equivalent_frame(other)\n        elif isinstance(other, SkyCoord):\n            if other.frame.name != self.frame.name:\n                return False\n\n            for fattrnm in frame_transform_graph.frame_attributes:\n                if not BaseCoordinateFrame._frameattr_equiv(getattr(self, fattrnm),\n                                                            getattr(other, fattrnm)):\n                    return False\n            return True\n        else:\n            # not a BaseCoordinateFrame nor a SkyCoord object\n            raise TypeError(\"Tried to do is_equivalent_frame on something that \"\n                            \"isn't frame-like\")"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":4597,"name":"_IMPORTS","nodeType":"Attribute","startLoc":27,"text":"_IMPORTS"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":4598,"name":"_HAS_BS4","nodeType":"Attribute","startLoc":28,"text":"_HAS_BS4"},{"attributeType":"null","col":0,"comment":"null","endLoc":29,"id":4599,"name":"_HAS_LXML","nodeType":"Attribute","startLoc":29,"text":"_HAS_LXML"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":4600,"name":"_HAS_HTML5LIB","nodeType":"Attribute","startLoc":30,"text":"_HAS_HTML5LIB"},{"attributeType":"null","col":4,"comment":"null","endLoc":114,"id":4601,"name":"pandas_fmt","nodeType":"Attribute","startLoc":114,"text":"pandas_fmt"},{"attributeType":"null","col":16,"comment":"null","endLoc":114,"id":4602,"name":"defaults","nodeType":"Attribute","startLoc":114,"text":"defaults"},{"attributeType":"null","col":4,"comment":"null","endLoc":115,"id":4603,"name":"fmt","nodeType":"Attribute","startLoc":115,"text":"fmt"},{"attributeType":"null","col":8,"comment":"null","endLoc":118,"id":4604,"name":"func","nodeType":"Attribute","startLoc":118,"text":"func"},{"attributeType":"null","col":8,"comment":"null","endLoc":122,"id":4605,"name":"func","nodeType":"Attribute","startLoc":122,"text":"func"},{"col":4,"comment":"\n        Determines if this coordinate frame can be transformed to another\n        given frame.\n\n        Parameters\n        ----------\n        new_frame : `BaseCoordinateFrame` subclass or instance\n            The proposed frame to transform into.\n\n        Returns\n        -------\n        transformable : bool or str\n            `True` if this can be transformed to ``new_frame``, `False` if\n            not, or the string 'same' if ``new_frame`` is the same system as\n            this object but no transformation is defined.\n\n        Notes\n        -----\n        A return value of 'same' means the transformation will work, but it will\n        just give back a copy of this object.  The intended usage is::\n\n            if coord.is_transformable_to(some_unknown_frame):\n                coord2 = coord.transform_to(some_unknown_frame)\n\n        This will work even if ``some_unknown_frame``  turns out to be the same\n        frame class as ``coord``.  This is intended for cases where the frame\n        is the same regardless of the frame attributes (e.g. ICRS), but be\n        aware that it *might* also indicate that someone forgot to define the\n        transformation between two objects of the same frame class but with\n        different attributes.\n        ","endLoc":1248,"header":"def is_transformable_to(self, new_frame)","id":4606,"name":"is_transformable_to","nodeType":"Function","startLoc":1207,"text":"def is_transformable_to(self, new_frame):\n        \"\"\"\n        Determines if this coordinate frame can be transformed to another\n        given frame.\n\n        Parameters\n        ----------\n        new_frame : `BaseCoordinateFrame` subclass or instance\n            The proposed frame to transform into.\n\n        Returns\n        -------\n        transformable : bool or str\n            `True` if this can be transformed to ``new_frame``, `False` if\n            not, or the string 'same' if ``new_frame`` is the same system as\n            this object but no transformation is defined.\n\n        Notes\n        -----\n        A return value of 'same' means the transformation will work, but it will\n        just give back a copy of this object.  The intended usage is::\n\n            if coord.is_transformable_to(some_unknown_frame):\n                coord2 = coord.transform_to(some_unknown_frame)\n\n        This will work even if ``some_unknown_frame``  turns out to be the same\n        frame class as ``coord``.  This is intended for cases where the frame\n        is the same regardless of the frame attributes (e.g. ICRS), but be\n        aware that it *might* also indicate that someone forgot to define the\n        transformation between two objects of the same frame class but with\n        different attributes.\n        \"\"\"\n        new_frame_cls = new_frame if inspect.isclass(new_frame) else new_frame.__class__\n        trans = frame_transform_graph.get_transform(self.__class__, new_frame_cls)\n\n        if trans is None:\n            if new_frame_cls is self.__class__:\n                return 'same'\n            else:\n                return False\n        else:\n            return True"},{"attributeType":"null","col":4,"comment":"null","endLoc":3497,"id":4607,"name":"__add__","nodeType":"Attribute","startLoc":3497,"text":"__add__"},{"col":4,"comment":"\n        Determine whether or not a frame attribute has its value because it's\n        the default value, or because this frame was created with that value\n        explicitly requested.\n\n        Parameters\n        ----------\n        attrnm : str\n            The name of the attribute to check.\n\n        Returns\n        -------\n        isdefault : bool\n            True if the attribute ``attrnm`` has its value by default, False if\n            it was specified at creation of this frame.\n        ","endLoc":1267,"header":"def is_frame_attr_default(self, attrnm)","id":4608,"name":"is_frame_attr_default","nodeType":"Function","startLoc":1250,"text":"def is_frame_attr_default(self, attrnm):\n        \"\"\"\n        Determine whether or not a frame attribute has its value because it's\n        the default value, or because this frame was created with that value\n        explicitly requested.\n\n        Parameters\n        ----------\n        attrnm : str\n            The name of the attribute to check.\n\n        Returns\n        -------\n        isdefault : bool\n            True if the attribute ``attrnm`` has its value by default, False if\n            it was specified at creation of this frame.\n        \"\"\"\n        return attrnm in self._attr_names_with_defaults"},{"col":0,"comment":"","endLoc":4,"header":"connect.py#<anonymous>","id":4609,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['PANDAS_FMTS']\n\nPANDAS_FMTS = {'csv': {'read': {},\n                       'write': {'index': False}},\n               'fwf': {'read': {}},  # No writer\n               'html': {'read': {},\n                        'write': {'index': False}},\n               'json': {'read': {},\n                        'write': {}}}\n\nPANDAS_PREFIX = 'pandas.'\n\n_IMPORTS = False\n\n_HAS_BS4 = False\n\n_HAS_LXML = False\n\n_HAS_HTML5LIB = False\n\nfor pandas_fmt, defaults in PANDAS_FMTS.items():\n    fmt = PANDAS_PREFIX + pandas_fmt  # Full format specifier\n\n    if 'read' in defaults:\n        func = functools.partial(_pandas_read, fmt)\n        io_registry.register_reader(fmt, Table, func)\n\n    if 'write' in defaults:\n        func = functools.partial(_pandas_write, fmt)\n        io_registry.register_writer(fmt, Table, func)"},{"col":4,"comment":"\n        Determine if two frame attributes are equivalent.  Implemented as a\n        staticmethod mainly as a convenient location, although conceivable it\n        might be desirable for subclasses to override this behavior.\n\n        Primary purpose is to check for equality of representations.  This\n        aspect can actually be simplified/removed now that representations have\n        equality defined.\n\n        Secondary purpose is to check for equality of coordinate attributes,\n        which first checks whether they themselves are in equivalent frames\n        before checking for equality in the normal fashion.  This is because\n        checking for equality with non-equivalent frames raises an error.\n        ","endLoc":1328,"header":"@staticmethod\n    def _frameattr_equiv(left_fattr, right_fattr)","id":4610,"name":"_frameattr_equiv","nodeType":"Function","startLoc":1269,"text":"@staticmethod\n    def _frameattr_equiv(left_fattr, right_fattr):\n        \"\"\"\n        Determine if two frame attributes are equivalent.  Implemented as a\n        staticmethod mainly as a convenient location, although conceivable it\n        might be desirable for subclasses to override this behavior.\n\n        Primary purpose is to check for equality of representations.  This\n        aspect can actually be simplified/removed now that representations have\n        equality defined.\n\n        Secondary purpose is to check for equality of coordinate attributes,\n        which first checks whether they themselves are in equivalent frames\n        before checking for equality in the normal fashion.  This is because\n        checking for equality with non-equivalent frames raises an error.\n        \"\"\"\n        if left_fattr is right_fattr:\n            # shortcut if it's exactly the same object\n            return True\n        elif left_fattr is None or right_fattr is None:\n            # shortcut if one attribute is unspecified and the other isn't\n            return False\n\n        left_is_repr = isinstance(left_fattr, r.BaseRepresentationOrDifferential)\n        right_is_repr = isinstance(right_fattr, r.BaseRepresentationOrDifferential)\n        if left_is_repr and right_is_repr:\n            # both are representations.\n            if (getattr(left_fattr, 'differentials', False) or\n                    getattr(right_fattr, 'differentials', False)):\n                warnings.warn('Two representation frame attributes were '\n                              'checked for equivalence when at least one of'\n                              ' them has differentials.  This yields False '\n                              'even if the underlying representations are '\n                              'equivalent (although this may change in '\n                              'future versions of Astropy)', AstropyWarning)\n                return False\n            if isinstance(right_fattr, left_fattr.__class__):\n                # if same representation type, compare components.\n                return np.all([(getattr(left_fattr, comp) ==\n                                getattr(right_fattr, comp))\n                               for comp in left_fattr.components])\n            else:\n                # convert to cartesian and see if they match\n                return np.all(left_fattr.to_cartesian().xyz ==\n                              right_fattr.to_cartesian().xyz)\n        elif left_is_repr or right_is_repr:\n            return False\n\n        left_is_coord = isinstance(left_fattr, BaseCoordinateFrame)\n        right_is_coord = isinstance(right_fattr, BaseCoordinateFrame)\n        if left_is_coord and right_is_coord:\n            # both are coordinates\n            if left_fattr.is_equivalent_frame(right_fattr):\n                return np.all(left_fattr == right_fattr)\n            else:\n                return False\n        elif left_is_coord or right_is_coord:\n            return False\n\n        return np.all(left_fattr == right_fattr)"},{"col":4,"comment":"\n        Computes on-sky separation between this coordinate and another.\n\n        .. note::\n\n            If the ``other`` coordinate object is in a different frame, it is\n            first transformed to the frame of this object. This can lead to\n            unintuitive behavior if not accounted for. Particularly of note is\n            that ``self.separation(other)`` and ``other.separation(self)`` may\n            not give the same answer in this case.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate to get the separation to.\n\n        Returns\n        -------\n        sep : `~astropy.coordinates.Angle`\n            The on-sky separation between this and the ``other`` coordinate.\n\n        Notes\n        -----\n        The separation is calculated using the Vincenty formula, which\n        is stable at all locations, including poles and antipodes [1]_.\n\n        .. [1] https://en.wikipedia.org/wiki/Great-circle_distance\n\n        ","endLoc":1148,"header":"def separation(self, other)","id":4611,"name":"separation","nodeType":"Function","startLoc":1097,"text":"def separation(self, other):\n        \"\"\"\n        Computes on-sky separation between this coordinate and another.\n\n        .. note::\n\n            If the ``other`` coordinate object is in a different frame, it is\n            first transformed to the frame of this object. This can lead to\n            unintuitive behavior if not accounted for. Particularly of note is\n            that ``self.separation(other)`` and ``other.separation(self)`` may\n            not give the same answer in this case.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate to get the separation to.\n\n        Returns\n        -------\n        sep : `~astropy.coordinates.Angle`\n            The on-sky separation between this and the ``other`` coordinate.\n\n        Notes\n        -----\n        The separation is calculated using the Vincenty formula, which\n        is stable at all locations, including poles and antipodes [1]_.\n\n        .. [1] https://en.wikipedia.org/wiki/Great-circle_distance\n\n        \"\"\"\n        from . import Angle\n        from .angle_utilities import angular_separation\n\n        if not self.is_equivalent_frame(other):\n            try:\n                kwargs = {'merge_attributes': False} if isinstance(other, SkyCoord) else {}\n                other = other.transform_to(self, **kwargs)\n            except TypeError:\n                raise TypeError('Can only get separation to another SkyCoord '\n                                'or a coordinate frame with data')\n\n        lon1 = self.spherical.lon\n        lat1 = self.spherical.lat\n        lon2 = other.spherical.lon\n        lat2 = other.spherical.lat\n\n        # Get the separation as a Quantity, convert to Angle in degrees\n        sep = angular_separation(lon1, lat1, lon2, lat2)\n        return Angle(sep, unit=u.degree)"},{"fileName":"ecsv.py","filePath":"astropy/io/ascii","id":4612,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nDefine the Enhanced Character-Separated-Values (ECSV) which allows for reading and\nwriting all the meta data associated with an astropy Table object.\n\"\"\"\n\nimport re\nfrom collections import OrderedDict\nimport warnings\nimport json\n\nimport numpy as np\n\nfrom . import core, basic\nfrom astropy.table import meta, serialize\nfrom astropy.utils.data_info import serialize_context_as\nfrom astropy.utils.exceptions import AstropyUserWarning\nfrom astropy.io.ascii.core import convert_numpy\n\nECSV_VERSION = '1.0'\nDELIMITERS = (' ', ',')\nECSV_DATATYPES = (\n    'bool', 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16',\n    'uint32', 'uint64', 'float16', 'float32', 'float64',\n    'float128', 'string')\n\n\nclass EcsvHeader(basic.BasicHeader):\n    \"\"\"Header class for which the column definition line starts with the\n    comment character.  See the :class:`CommentedHeader` class  for an example.\n    \"\"\"\n\n    def process_lines(self, lines):\n        \"\"\"Return only non-blank lines that start with the comment regexp.  For these\n        lines strip out the matching characters and leading/trailing whitespace.\"\"\"\n        re_comment = re.compile(self.comment)\n        for line in lines:\n            line = line.strip()\n            if not line:\n                continue\n            match = re_comment.match(line)\n            if match:\n                out = line[match.end():]\n                if out:\n                    yield out\n            else:\n                # Stop iterating on first failed match for a non-blank line\n                return\n\n    def write(self, lines):\n        \"\"\"\n        Write header information in the ECSV ASCII format.\n\n        This function is called at the point when preprocessing has been done to\n        convert the input table columns to `self.cols` which is a list of\n        `astropy.io.ascii.core.Column` objects. In particular `col.str_vals`\n        is available for each column with the string representation of each\n        column item for output.\n\n        This format starts with a delimiter separated list of the column names\n        in order to make this format readable by humans and simple csv-type\n        readers. It then encodes the full table meta and column attributes and\n        meta as YAML and pretty-prints this in the header.  Finally the\n        delimited column names are repeated again, for humans and readers that\n        look for the *last* comment line as defining the column names.\n        \"\"\"\n        if self.splitter.delimiter not in DELIMITERS:\n            raise ValueError('only space and comma are allowed for delimiter in ECSV format')\n\n        # Now assemble the header dict that will be serialized by the YAML dumper\n        header = {'cols': self.cols, 'schema': 'astropy-2.0'}\n\n        if self.table_meta:\n            header['meta'] = self.table_meta\n\n        # Set the delimiter only for the non-default option(s)\n        if self.splitter.delimiter != ' ':\n            header['delimiter'] = self.splitter.delimiter\n\n        header_yaml_lines = ([f'%ECSV {ECSV_VERSION}',\n                              '---']\n                             + meta.get_yaml_from_header(header))\n\n        lines.extend([self.write_comment + line for line in header_yaml_lines])\n        lines.append(self.splitter.join([x.info.name for x in self.cols]))\n\n    def write_comments(self, lines, meta):\n        \"\"\"\n        WRITE: Override the default write_comments to do nothing since this is handled\n        in the custom write method.\n        \"\"\"\n        pass\n\n    def update_meta(self, lines, meta):\n        \"\"\"\n        READ: Override the default update_meta to do nothing.  This process is done\n        in get_cols() for this reader.\n        \"\"\"\n        pass\n\n    def get_cols(self, lines):\n        \"\"\"\n        READ: Initialize the header Column objects from the table ``lines``.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n        # Cache a copy of the original input lines before processing below\n        raw_lines = lines\n\n        # Extract non-blank comment (header) lines with comment character stripped\n        lines = list(self.process_lines(lines))\n\n        # Validate that this is a ECSV file\n        ecsv_header_re = r\"\"\"%ECSV [ ]\n                             (?P<major> \\d+)\n                             \\. (?P<minor> \\d+)\n                             \\.? (?P<bugfix> \\d+)? $\"\"\"\n\n        no_header_msg = ('ECSV header line like \"# %ECSV <version>\" not found as first line.'\n                         '  This is required for a ECSV file.')\n\n        if not lines:\n            raise core.InconsistentTableError(no_header_msg)\n\n        match = re.match(ecsv_header_re, lines[0].strip(), re.VERBOSE)\n        if not match:\n            raise core.InconsistentTableError(no_header_msg)\n\n        # Construct ecsv_version for backwards compatibility workarounds.\n        self.ecsv_version = tuple(int(v or 0) for v in match.groups())\n\n        try:\n            header = meta.get_header_from_yaml(lines)\n        except meta.YamlParseError:\n            raise core.InconsistentTableError('unable to parse yaml in meta header')\n\n        if 'meta' in header:\n            self.table_meta = header['meta']\n\n        if 'delimiter' in header:\n            delimiter = header['delimiter']\n            if delimiter not in DELIMITERS:\n                raise ValueError('only space and comma are allowed for delimiter in ECSV format')\n            self.splitter.delimiter = delimiter\n            self.data.splitter.delimiter = delimiter\n\n        # Create the list of io.ascii column objects from `header`\n        header_cols = OrderedDict((x['name'], x) for x in header['datatype'])\n        self.names = [x['name'] for x in header['datatype']]\n\n        # Read the first non-commented line of table and split to get the CSV\n        # header column names.  This is essentially what the Basic reader does.\n        header_line = next(super().process_lines(raw_lines))\n        header_names = next(self.splitter([header_line]))\n\n        # Check for consistency of the ECSV vs. CSV header column names\n        if header_names != self.names:\n            raise core.InconsistentTableError('column names from ECSV header {} do not '\n                                              'match names from header line of CSV data {}'\n                                              .format(self.names, header_names))\n\n        # BaseHeader method to create self.cols, which is a list of\n        # io.ascii.core.Column objects (*not* Table Column objects).\n        self._set_cols_from_names()\n\n        # Transfer attributes from the column descriptor stored in the input\n        # header YAML metadata to the new columns to create this table.\n        for col in self.cols:\n            for attr in ('description', 'format', 'unit', 'meta', 'subtype'):\n                if attr in header_cols[col.name]:\n                    setattr(col, attr, header_cols[col.name][attr])\n\n            col.dtype = header_cols[col.name]['datatype']\n            # Require col dtype to be a valid ECSV datatype. However, older versions\n            # of astropy writing ECSV version 0.9 and earlier had inadvertently allowed\n            # numpy datatypes like datetime64 or object or python str, which are not in the ECSV standard.\n            # For back-compatibility with those existing older files, allow reading with no error.\n            if col.dtype not in ECSV_DATATYPES and self.ecsv_version > (0, 9, 0):\n                raise ValueError(f'datatype {col.dtype!r} of column {col.name!r} '\n                                 f'is not in allowed values {ECSV_DATATYPES}')\n\n            # Subtype is written like \"int64[2,null]\" and we want to split this\n            # out to \"int64\" and [2, None].\n            subtype = col.subtype\n            if subtype and '[' in subtype:\n                idx = subtype.index('[')\n                col.subtype = subtype[:idx]\n                col.shape = json.loads(subtype[idx:])\n\n            # Convert ECSV \"string\" to numpy \"str\"\n            for attr in ('dtype', 'subtype'):\n                if getattr(col, attr) == 'string':\n                    setattr(col, attr, 'str')\n\n            # ECSV subtype of 'json' maps to numpy 'object' dtype\n            if col.subtype == 'json':\n                col.subtype = 'object'\n\n\ndef _check_dtype_is_str(col):\n    if col.dtype != 'str':\n        raise ValueError(f'datatype of column {col.name!r} must be \"string\"')\n\n\nclass EcsvOutputter(core.TableOutputter):\n    \"\"\"\n    After reading the input lines and processing, convert the Reader columns\n    and metadata to an astropy.table.Table object.  This overrides the default\n    converters to be an empty list because there is no \"guessing\" of the\n    conversion function.\n    \"\"\"\n    default_converters = []\n\n    def __call__(self, cols, meta):\n        # Convert to a Table with all plain Column subclass columns\n        out = super().__call__(cols, meta)\n\n        # If mixin columns exist (based on the special '__mixin_columns__'\n        # key in the table ``meta``), then use that information to construct\n        # appropriate mixin columns and remove the original data columns.\n        # If no __mixin_columns__ exists then this function just passes back\n        # the input table.\n        out = serialize._construct_mixins_from_columns(out)\n\n        return out\n\n    def _convert_vals(self, cols):\n        \"\"\"READ: Convert str_vals in `cols` to final arrays with correct dtypes.\n\n        This is adapted from ``BaseOutputter._convert_vals``. In the case of ECSV\n        there is no guessing and all types are known in advance. A big change\n        is handling the possibility of JSON-encoded values, both unstructured\n        object data and structured values that may contain masked data.\n        \"\"\"\n        for col in cols:\n            try:\n                # 1-d or N-d object columns are serialized as JSON.\n                if col.subtype == 'object':\n                    _check_dtype_is_str(col)\n                    col_vals = [json.loads(val) for val in col.str_vals]\n                    col.data = np.empty([len(col_vals)] + col.shape, dtype=object)\n                    col.data[...] = col_vals\n\n                # Variable length arrays with shape (n, m, ..., *) for fixed\n                # n, m, .. and variable in last axis. Masked values here are\n                # not currently supported.\n                elif col.shape and col.shape[-1] is None:\n                    _check_dtype_is_str(col)\n\n                    # Empty (blank) values in original ECSV are changed to \"0\"\n                    # in str_vals with corresponding col.mask being created and\n                    # set accordingly. Instead use an empty list here.\n                    if hasattr(col, 'mask'):\n                        for idx in np.nonzero(col.mask)[0]:\n                            col.str_vals[idx] = '[]'\n\n                    # Remake as a 1-d object column of numpy ndarrays or\n                    # MaskedArray using the datatype specified in the ECSV file.\n                    col_vals = []\n                    for str_val in col.str_vals:\n                        obj_val = json.loads(str_val)  # list or nested lists\n                        try:\n                            arr_val = np.array(obj_val, dtype=col.subtype)\n                        except TypeError:\n                            # obj_val has entries that are inconsistent with\n                            # dtype. For a valid ECSV file the only possibility\n                            # is None values (indicating missing values).\n                            data = np.array(obj_val, dtype=object)\n                            # Replace all the None with an appropriate fill value\n                            mask = (data == None)  # noqa: E711\n                            kind = np.dtype(col.subtype).kind\n                            data[mask] = {'U': '', 'S': b''}.get(kind, 0)\n                            arr_val = np.ma.array(data.astype(col.subtype), mask=mask)\n\n                        col_vals.append(arr_val)\n\n                    col.shape = ()\n                    col.dtype = np.dtype(object)\n                    # np.array(col_vals_arr, dtype=object) fails ?? so this workaround:\n                    col.data = np.empty(len(col_vals), dtype=object)\n                    col.data[:] = col_vals\n\n                # Multidim columns with consistent shape (n, m, ...). These\n                # might be masked.\n                elif col.shape:\n                    _check_dtype_is_str(col)\n\n                    # Change empty (blank) values in original ECSV to something\n                    # like \"[[null, null],[null,null]]\" so subsequent JSON\n                    # decoding works. Delete `col.mask` so that later code in\n                    # core TableOutputter.__call__() that deals with col.mask\n                    # does not run (since handling is done here already).\n                    if hasattr(col, 'mask'):\n                        all_none_arr = np.full(shape=col.shape, fill_value=None, dtype=object)\n                        all_none_json = json.dumps(all_none_arr.tolist())\n                        for idx in np.nonzero(col.mask)[0]:\n                            col.str_vals[idx] = all_none_json\n                        del col.mask\n\n                    col_vals = [json.loads(val) for val in col.str_vals]\n                    # Make a numpy object array of col_vals to look for None\n                    # (masked values)\n                    data = np.array(col_vals, dtype=object)\n                    mask = (data == None)  # noqa: E711\n                    if not np.any(mask):\n                        # No None's, just convert to required dtype\n                        col.data = data.astype(col.subtype)\n                    else:\n                        # Replace all the None with an appropriate fill value\n                        kind = np.dtype(col.subtype).kind\n                        data[mask] = {'U': '', 'S': b''}.get(kind, 0)\n                        # Finally make a MaskedArray with the filled data + mask\n                        col.data = np.ma.array(data.astype(col.subtype), mask=mask)\n\n                # Regular scalar value column\n                else:\n                    if col.subtype:\n                        warnings.warn(f'unexpected subtype {col.subtype!r} set for column '\n                                      f'{col.name!r}, using dtype={col.dtype!r} instead.',\n                                      category=AstropyUserWarning)\n                    converter_func, _ = convert_numpy(col.dtype)\n                    col.data = converter_func(col.str_vals)\n\n                if col.data.shape[1:] != tuple(col.shape):\n                    raise ValueError('shape mismatch between value and column specifier')\n\n            except json.JSONDecodeError:\n                raise ValueError(f'column {col.name!r} failed to convert: '\n                                 'column value is not valid JSON')\n            except Exception as exc:\n                raise ValueError(f'column {col.name!r} failed to convert: {exc}')\n\n\nclass EcsvData(basic.BasicData):\n    def _set_fill_values(self, cols):\n        \"\"\"READ: Set the fill values of the individual cols based on fill_values of BaseData\n\n        For ECSV handle the corner case of data that has been serialized using\n        the serialize_method='data_mask' option, which writes the full data and\n        mask directly, AND where that table includes a string column with zero-length\n        string entries (\"\") which are valid data.\n\n        Normally the super() method will set col.fill_value=('', '0') to replace\n        blanks with a '0'.  But for that corner case subset, instead do not do\n        any filling.\n        \"\"\"\n        super()._set_fill_values(cols)\n\n        # Get the serialized columns spec.  It might not exist and there might\n        # not even be any table meta, so punt in those cases.\n        try:\n            scs = self.header.table_meta['__serialized_columns__']\n        except (AttributeError, KeyError):\n            return\n\n        # Got some serialized columns, so check for string type and serialized\n        # as a MaskedColumn.  Without 'data_mask', MaskedColumn objects are\n        # stored to ECSV as normal columns.\n        for col in cols:\n            if (col.dtype == 'str' and col.name in scs\n                    and scs[col.name]['__class__'] == 'astropy.table.column.MaskedColumn'):\n                col.fill_values = {}  # No data value replacement\n\n    def str_vals(self):\n        \"\"\"WRITE: convert all values in table to a list of lists of strings\n\n        This version considerably simplifies the base method:\n        - No need to set fill values and column formats\n        - No per-item formatting, just use repr()\n        - Use JSON for object-type or multidim values\n        - Only Column or MaskedColumn can end up as cols here.\n        - Only replace masked values with \"\", not the generalized filling\n        \"\"\"\n        for col in self.cols:\n            if len(col.shape) > 1 or col.info.dtype.kind == 'O':\n                def format_col_item(idx):\n                    obj = col[idx]\n                    try:\n                        obj = obj.tolist()\n                    except AttributeError:\n                        pass\n                    return json.dumps(obj, separators=(',', ':'))\n            else:\n                def format_col_item(idx):\n                    return str(col[idx])\n\n            try:\n                col.str_vals = [format_col_item(idx) for idx in range(len(col))]\n            except TypeError as exc:\n                raise TypeError(f'could not convert column {col.info.name!r}'\n                                f' to string: {exc}') from exc\n\n            # Replace every masked value in a 1-d column with an empty string.\n            # For multi-dim columns this gets done by JSON via \"null\".\n            if hasattr(col, 'mask') and col.ndim == 1:\n                for idx in col.mask.nonzero()[0]:\n                    col.str_vals[idx] = \"\"\n\n        out = [col.str_vals for col in self.cols]\n        return out\n\n\nclass Ecsv(basic.Basic):\n    \"\"\"ECSV (Enhanced Character Separated Values) format table.\n\n    Th ECSV format allows for specification of key table and column meta-data, in\n    particular the data type and unit.\n\n    See: https://github.com/astropy/astropy-APEs/blob/main/APE6.rst\n\n    Examples\n    --------\n\n    >>> from astropy.table import Table\n    >>> ecsv_content = '''# %ECSV 0.9\n    ... # ---\n    ... # datatype:\n    ... # - {name: a, unit: m / s, datatype: int64, format: '%03d'}\n    ... # - {name: b, unit: km, datatype: int64, description: This is column b}\n    ... a b\n    ... 001 2\n    ... 004 3\n    ... '''\n\n    >>> Table.read(ecsv_content, format='ascii.ecsv')\n    <Table length=2>\n      a     b\n    m / s   km\n    int64 int64\n    ----- -----\n      001     2\n      004     3\n\n    \"\"\"\n    _format_name = 'ecsv'\n    _description = 'Enhanced CSV'\n    _io_registry_suffix = '.ecsv'\n\n    header_class = EcsvHeader\n    data_class = EcsvData\n    outputter_class = EcsvOutputter\n\n    max_ndim = None  # No limit on column dimensionality\n\n    def update_table_data(self, table):\n        \"\"\"\n        Update table columns in place if mixin columns are present.\n\n        This is a hook to allow updating the table columns after name\n        filtering but before setting up to write the data.  This is currently\n        only used by ECSV and is otherwise just a pass-through.\n\n        Parameters\n        ----------\n        table : `astropy.table.Table`\n            Input table for writing\n\n        Returns\n        -------\n        table : `astropy.table.Table`\n            Output table for writing\n        \"\"\"\n        with serialize_context_as('ecsv'):\n            out = serialize.represent_mixins_as_columns(table)\n        return out\n"},{"col":0,"comment":"\n    Angular separation between two points on a sphere.\n\n    Parameters\n    ----------\n    lon1, lat1, lon2, lat2 : `~astropy.coordinates.Angle`, `~astropy.units.Quantity` or float\n        Longitude and latitude of the two points. Quantities should be in\n        angular units; floats in radians.\n\n    Returns\n    -------\n    angular separation : `~astropy.units.Quantity` ['angle'] or float\n        Type depends on input; ``Quantity`` in angular units, or float in\n        radians.\n\n    Notes\n    -----\n    The angular separation is calculated using the Vincenty formula [1]_,\n    which is slightly more complex and computationally expensive than\n    some alternatives, but is stable at at all distances, including the\n    poles and antipodes.\n\n    .. [1] https://en.wikipedia.org/wiki/Great-circle_distance\n    ","endLoc":59,"header":"def angular_separation(lon1, lat1, lon2, lat2)","id":4613,"name":"angular_separation","nodeType":"Function","startLoc":22,"text":"def angular_separation(lon1, lat1, lon2, lat2):\n    \"\"\"\n    Angular separation between two points on a sphere.\n\n    Parameters\n    ----------\n    lon1, lat1, lon2, lat2 : `~astropy.coordinates.Angle`, `~astropy.units.Quantity` or float\n        Longitude and latitude of the two points. Quantities should be in\n        angular units; floats in radians.\n\n    Returns\n    -------\n    angular separation : `~astropy.units.Quantity` ['angle'] or float\n        Type depends on input; ``Quantity`` in angular units, or float in\n        radians.\n\n    Notes\n    -----\n    The angular separation is calculated using the Vincenty formula [1]_,\n    which is slightly more complex and computationally expensive than\n    some alternatives, but is stable at at all distances, including the\n    poles and antipodes.\n\n    .. [1] https://en.wikipedia.org/wiki/Great-circle_distance\n    \"\"\"\n\n    sdlon = np.sin(lon2 - lon1)\n    cdlon = np.cos(lon2 - lon1)\n    slat1 = np.sin(lat1)\n    slat2 = np.sin(lat2)\n    clat1 = np.cos(lat1)\n    clat2 = np.cos(lat2)\n\n    num1 = clat2 * sdlon\n    num2 = clat1 * slat2 - slat1 * clat2 * cdlon\n    denominator = slat1 * slat2 + clat1 * clat2 * cdlon\n\n    return np.arctan2(np.hypot(num1, num2), denominator)"},{"col":4,"comment":"\n        Checks if this object is the same frame as the ``other`` object.\n\n        To be the same frame, two objects must be the same frame class and have\n        the same frame attributes.  Note that it does *not* matter what, if any,\n        data either object has.\n\n        Parameters\n        ----------\n        other : :class:`~astropy.coordinates.BaseCoordinateFrame`\n            the other frame to check\n\n        Returns\n        -------\n        isequiv : bool\n            True if the frames are the same, False if not.\n\n        Raises\n        ------\n        TypeError\n            If ``other`` isn't a `BaseCoordinateFrame` or subclass.\n        ","endLoc":1363,"header":"def is_equivalent_frame(self, other)","id":4614,"name":"is_equivalent_frame","nodeType":"Function","startLoc":1330,"text":"def is_equivalent_frame(self, other):\n        \"\"\"\n        Checks if this object is the same frame as the ``other`` object.\n\n        To be the same frame, two objects must be the same frame class and have\n        the same frame attributes.  Note that it does *not* matter what, if any,\n        data either object has.\n\n        Parameters\n        ----------\n        other : :class:`~astropy.coordinates.BaseCoordinateFrame`\n            the other frame to check\n\n        Returns\n        -------\n        isequiv : bool\n            True if the frames are the same, False if not.\n\n        Raises\n        ------\n        TypeError\n            If ``other`` isn't a `BaseCoordinateFrame` or subclass.\n        \"\"\"\n        if self.__class__ == other.__class__:\n            for frame_attr_name in self.get_frame_attr_names():\n                if not self._frameattr_equiv(getattr(self, frame_attr_name),\n                                             getattr(other, frame_attr_name)):\n                    return False\n            return True\n        elif not isinstance(other, BaseCoordinateFrame):\n            raise TypeError(\"Tried to do is_equivalent_frame on something that \"\n                            \"isn't a frame\")\n        else:\n            return False"},{"attributeType":"null","col":4,"comment":"null","endLoc":3498,"id":4615,"name":"__sub__","nodeType":"Attribute","startLoc":3498,"text":"__sub__"},{"col":4,"comment":"null","endLoc":1375,"header":"def __repr__(self)","id":4616,"name":"__repr__","nodeType":"Function","startLoc":1365,"text":"def __repr__(self):\n        frameattrs = self._frame_attrs_repr()\n        data_repr = self._data_repr()\n\n        if frameattrs:\n            frameattrs = f' ({frameattrs})'\n\n        if data_repr:\n            return f'<{self.__class__.__name__} Coordinate{frameattrs}: {data_repr}>'\n        else:\n            return f'<{self.__class__.__name__} Frame{frameattrs}>'"},{"attributeType":"null","col":4,"comment":"null","endLoc":3499,"id":4617,"name":"__mul__","nodeType":"Attribute","startLoc":3499,"text":"__mul__"},{"className":"HTMLSplitter","col":0,"comment":"\n    Split HTML table data.\n    ","endLoc":135,"id":4618,"nodeType":"Class","startLoc":112,"text":"class HTMLSplitter(core.BaseSplitter):\n    \"\"\"\n    Split HTML table data.\n    \"\"\"\n\n    def __call__(self, lines):\n        \"\"\"\n        Return HTML data from lines as a generator.\n        \"\"\"\n        for line in lines:\n            if not isinstance(line, SoupString):\n                raise TypeError('HTML lines should be of type SoupString')\n            soup = line.soup\n            header_elements = soup.find_all('th')\n            if header_elements:\n                # Return multicolumns as tuples for HTMLHeader handling\n                yield [(el.text.strip(), el['colspan']) if el.has_attr('colspan')\n                       else el.text.strip() for el in header_elements]\n            data_elements = soup.find_all('td')\n            if data_elements:\n                yield [el.text.strip() for el in data_elements]\n        if len(lines) == 0:\n            raise core.InconsistentTableError('HTML tables must contain data '\n                                              'in a <table> tag')"},{"attributeType":"null","col":4,"comment":"null","endLoc":3500,"id":4619,"name":"__truediv__","nodeType":"Attribute","startLoc":3500,"text":"__truediv__"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":4620,"name":"name","nodeType":"Attribute","startLoc":18,"text":"name"},{"col":4,"comment":"\n        Returns a string representation of the frame's attributes, if any.\n        ","endLoc":1461,"header":"def _frame_attrs_repr(self)","id":4621,"name":"_frame_attrs_repr","nodeType":"Function","startLoc":1445,"text":"def _frame_attrs_repr(self):\n        \"\"\"\n        Returns a string representation of the frame's attributes, if any.\n        \"\"\"\n        attr_strs = []\n        for attribute_name in self.get_frame_attr_names():\n            attr = getattr(self, attribute_name)\n            # Check to see if this object has a way of representing itself\n            # specific to being an attribute of a frame. (Note, this is not the\n            # Attribute class, it's the actual object).\n            if hasattr(attr, \"_astropy_repr_in_frame\"):\n                attrstr = attr._astropy_repr_in_frame()\n            else:\n                attrstr = str(attr)\n            attr_strs.append(f\"{attribute_name}={attrstr}\")\n\n        return ', '.join(attr_strs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":3501,"id":4622,"name":"__pow__","nodeType":"Attribute","startLoc":3501,"text":"__pow__"},{"attributeType":"null","col":4,"comment":"null","endLoc":19,"id":4623,"name":"types","nodeType":"Attribute","startLoc":19,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":20,"id":4624,"name":"version","nodeType":"Attribute","startLoc":20,"text":"version"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":4625,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"spectralcoord.py#<anonymous>","id":4626,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['SpectralCoordType']"},{"attributeType":"null","col":4,"comment":"null","endLoc":3502,"id":4627,"name":"__or__","nodeType":"Attribute","startLoc":3502,"text":"__or__"},{"attributeType":"null","col":4,"comment":"null","endLoc":3503,"id":4628,"name":"__and__","nodeType":"Attribute","startLoc":3503,"text":"__and__"},{"attributeType":"null","col":12,"comment":"null","endLoc":2953,"id":4629,"name":"outputs","nodeType":"Attribute","startLoc":2953,"text":"self.outputs"},{"fileName":"rst.py","filePath":"astropy/io/ascii","id":4630,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license\n\"\"\"\n:Author: Simon Gibbons (simongibbons@gmail.com)\n\"\"\"\n\n\nfrom .core import DefaultSplitter\nfrom .fixedwidth import (FixedWidth,\n                         FixedWidthData,\n                         FixedWidthHeader,\n                         FixedWidthTwoLineDataSplitter)\n\n\nclass SimpleRSTHeader(FixedWidthHeader):\n    position_line = 0\n    start_line = 1\n    splitter_class = DefaultSplitter\n    position_char = '='\n\n    def get_fixedwidth_params(self, line):\n        vals, starts, ends = super().get_fixedwidth_params(line)\n        # The right hand column can be unbounded\n        ends[-1] = None\n        return vals, starts, ends\n\n\nclass SimpleRSTData(FixedWidthData):\n    start_line = 3\n    end_line = -1\n    splitter_class = FixedWidthTwoLineDataSplitter\n\n\nclass RST(FixedWidth):\n    \"\"\"reStructuredText simple format table.\n\n    See: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#simple-tables\n\n    Example::\n\n        ==== ===== ======\n        Col1  Col2  Col3\n        ==== ===== ======\n          1    2.3  Hello\n          2    4.5  Worlds\n        ==== ===== ======\n\n    Currently there is no support for reading tables which utilize continuation lines,\n    or for ones which define column spans through the use of an additional\n    line of dashes in the header.\n\n    \"\"\"\n    _format_name = 'rst'\n    _description = 'reStructuredText simple table'\n    data_class = SimpleRSTData\n    header_class = SimpleRSTHeader\n\n    def __init__(self):\n        super().__init__(delimiter_pad=None, bookend=False)\n\n    def write(self, lines):\n        lines = super().write(lines)\n        lines = [lines[1]] + lines + [lines[1]]\n        return lines\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":2911,"id":4631,"name":"_tdict","nodeType":"Attribute","startLoc":2911,"text":"self._tdict"},{"className":"DefaultSplitter","col":0,"comment":"Default class to split strings into columns using python csv.  The class\n    attributes are taken from the csv Dialect class.\n\n    Typical usage::\n\n      # lines = ..\n      splitter = ascii.DefaultSplitter()\n      for col_vals in splitter(lines):\n          for col_val in col_vals:\n               ...\n\n    ","endLoc":509,"id":4632,"nodeType":"Class","startLoc":421,"text":"class DefaultSplitter(BaseSplitter):\n    \"\"\"Default class to split strings into columns using python csv.  The class\n    attributes are taken from the csv Dialect class.\n\n    Typical usage::\n\n      # lines = ..\n      splitter = ascii.DefaultSplitter()\n      for col_vals in splitter(lines):\n          for col_val in col_vals:\n               ...\n\n    \"\"\"\n    delimiter = ' '\n    \"\"\" one-character string used to separate fields. \"\"\"\n    quotechar = '\"'\n    \"\"\" control how instances of *quotechar* in a field are quoted \"\"\"\n    doublequote = True\n    \"\"\" character to remove special meaning from following character \"\"\"\n    escapechar = None\n    \"\"\" one-character stringto quote fields containing special characters \"\"\"\n    quoting = csv.QUOTE_MINIMAL\n    \"\"\" control when quotes are recognized by the reader \"\"\"\n    skipinitialspace = True\n    \"\"\" ignore whitespace immediately following the delimiter \"\"\"\n    csv_writer = None\n    csv_writer_out = StringIO()\n\n    def process_line(self, line):\n        \"\"\"Remove whitespace at the beginning or end of line.  This is especially useful for\n        whitespace-delimited files to prevent spurious columns at the beginning or end.\n        If splitting on whitespace then replace unquoted tabs with space first\"\"\"\n        if self.delimiter == r'\\s':\n            line = _replace_tab_with_space(line, self.escapechar, self.quotechar)\n        return line.strip() + '\\n'\n\n    def process_val(self, val):\n        \"\"\"Remove whitespace at the beginning or end of value.\"\"\"\n        return val.strip(' \\t')\n\n    def __call__(self, lines):\n        \"\"\"Return an iterator over the table ``lines``, where each iterator output\n        is a list of the split line values.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        Yields\n        ------\n        line : list of str\n            Each line's split values.\n\n        \"\"\"\n        if self.process_line:\n            lines = [self.process_line(x) for x in lines]\n\n        delimiter = ' ' if self.delimiter == r'\\s' else self.delimiter\n\n        csv_reader = csv.reader(lines,\n                                delimiter=delimiter,\n                                doublequote=self.doublequote,\n                                escapechar=self.escapechar,\n                                quotechar=self.quotechar,\n                                quoting=self.quoting,\n                                skipinitialspace=self.skipinitialspace\n                                )\n        for vals in csv_reader:\n            if self.process_val:\n                yield [self.process_val(x) for x in vals]\n            else:\n                yield vals\n\n    def join(self, vals):\n\n        delimiter = ' ' if self.delimiter is None else str(self.delimiter)\n\n        if self.csv_writer is None:\n            self.csv_writer = CsvWriter(delimiter=delimiter,\n                                        doublequote=self.doublequote,\n                                        escapechar=self.escapechar,\n                                        quotechar=self.quotechar,\n                                        quoting=self.quoting)\n        if self.process_val:\n            vals = [self.process_val(x) for x in vals]\n        out = self.csv_writer.writerow(vals).rstrip('\\r\\n')\n\n        return out"},{"className":"BaseSplitter","col":0,"comment":"\n    Base splitter that uses python's split method to do the work.\n\n    This does not handle quoted values.  A key feature is the formulation of\n    __call__ as a generator that returns a list of the split line values at\n    each iteration.\n\n    There are two methods that are intended to be overridden, first\n    ``process_line()`` to do pre-processing on each input line before splitting\n    and ``process_val()`` to do post-processing on each split string value.  By\n    default these apply the string ``strip()`` function.  These can be set to\n    another function via the instance attribute or be disabled entirely, for\n    example::\n\n      reader.header.splitter.process_val = lambda x: x.lstrip()\n      reader.data.splitter.process_val = None\n\n    ","endLoc":418,"id":4633,"nodeType":"Class","startLoc":371,"text":"class BaseSplitter:\n    \"\"\"\n    Base splitter that uses python's split method to do the work.\n\n    This does not handle quoted values.  A key feature is the formulation of\n    __call__ as a generator that returns a list of the split line values at\n    each iteration.\n\n    There are two methods that are intended to be overridden, first\n    ``process_line()`` to do pre-processing on each input line before splitting\n    and ``process_val()`` to do post-processing on each split string value.  By\n    default these apply the string ``strip()`` function.  These can be set to\n    another function via the instance attribute or be disabled entirely, for\n    example::\n\n      reader.header.splitter.process_val = lambda x: x.lstrip()\n      reader.data.splitter.process_val = None\n\n    \"\"\"\n\n    delimiter = None\n    \"\"\" one-character string used to separate fields \"\"\"\n\n    def process_line(self, line):\n        \"\"\"Remove whitespace at the beginning or end of line.  This is especially useful for\n        whitespace-delimited files to prevent spurious columns at the beginning or end.\"\"\"\n        return line.strip()\n\n    def process_val(self, val):\n        \"\"\"Remove whitespace at the beginning or end of value.\"\"\"\n        return val.strip()\n\n    def __call__(self, lines):\n        if self.process_line:\n            lines = (self.process_line(x) for x in lines)\n        for line in lines:\n            vals = line.split(self.delimiter)\n            if self.process_val:\n                yield [self.process_val(x) for x in vals]\n            else:\n                yield vals\n\n    def join(self, vals):\n        if self.delimiter is None:\n            delimiter = ' '\n        else:\n            delimiter = self.delimiter\n        return delimiter.join(str(x) for x in vals)"},{"attributeType":"null","col":12,"comment":"null","endLoc":2997,"id":4634,"name":"inputs","nodeType":"Attribute","startLoc":2997,"text":"self.inputs"},{"attributeType":"null","col":12,"comment":"null","endLoc":2966,"id":4635,"name":"n_outputs","nodeType":"Attribute","startLoc":2966,"text":"self.n_outputs"},{"col":4,"comment":"Remove whitespace at the beginning or end of line.  This is especially useful for\n        whitespace-delimited files to prevent spurious columns at the beginning or end.","endLoc":397,"header":"def process_line(self, line)","id":4636,"name":"process_line","nodeType":"Function","startLoc":394,"text":"def process_line(self, line):\n        \"\"\"Remove whitespace at the beginning or end of line.  This is especially useful for\n        whitespace-delimited files to prevent spurious columns at the beginning or end.\"\"\"\n        return line.strip()"},{"col":4,"comment":"Remove whitespace at the beginning or end of line.  This is especially useful for\n        whitespace-delimited files to prevent spurious columns at the beginning or end.\n        If splitting on whitespace then replace unquoted tabs with space first","endLoc":455,"header":"def process_line(self, line)","id":4637,"name":"process_line","nodeType":"Function","startLoc":449,"text":"def process_line(self, line):\n        \"\"\"Remove whitespace at the beginning or end of line.  This is especially useful for\n        whitespace-delimited files to prevent spurious columns at the beginning or end.\n        If splitting on whitespace then replace unquoted tabs with space first\"\"\"\n        if self.delimiter == r'\\s':\n            line = _replace_tab_with_space(line, self.escapechar, self.quotechar)\n        return line.strip() + '\\n'"},{"attributeType":"null","col":8,"comment":"null","endLoc":3387,"id":4638,"name":"_n_outputs","nodeType":"Attribute","startLoc":3387,"text":"self._n_outputs"},{"col":4,"comment":"\n        Computes three dimensional separation between this coordinate\n        and another.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate to get the separation to.\n\n        Returns\n        -------\n        sep : `~astropy.coordinates.Distance`\n            The real-space distance between these two coordinates.\n\n        Raises\n        ------\n        ValueError\n            If this or the other coordinate do not have distances.\n        ","endLoc":1190,"header":"def separation_3d(self, other)","id":4639,"name":"separation_3d","nodeType":"Function","startLoc":1150,"text":"def separation_3d(self, other):\n        \"\"\"\n        Computes three dimensional separation between this coordinate\n        and another.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate to get the separation to.\n\n        Returns\n        -------\n        sep : `~astropy.coordinates.Distance`\n            The real-space distance between these two coordinates.\n\n        Raises\n        ------\n        ValueError\n            If this or the other coordinate do not have distances.\n        \"\"\"\n        if not self.is_equivalent_frame(other):\n            try:\n                kwargs = {'merge_attributes': False} if isinstance(other, SkyCoord) else {}\n                other = other.transform_to(self, **kwargs)\n            except TypeError:\n                raise TypeError('Can only get separation to another SkyCoord '\n                                'or a coordinate frame with data')\n\n        if issubclass(self.data.__class__, UnitSphericalRepresentation):\n            raise ValueError('This object does not have a distance; cannot '\n                             'compute 3d separation.')\n        if issubclass(other.data.__class__, UnitSphericalRepresentation):\n            raise ValueError('The other object does not have a distance; '\n                             'cannot compute 3d separation.')\n\n        c1 = self.cartesian.without_differentials()\n        c2 = other.cartesian.without_differentials()\n        return Distance((c1 - c2).norm())"},{"className":"EcsvHeader","col":0,"comment":"Header class for which the column definition line starts with the\n    comment character.  See the :class:`CommentedHeader` class  for an example.\n    ","endLoc":201,"id":4640,"nodeType":"Class","startLoc":28,"text":"class EcsvHeader(basic.BasicHeader):\n    \"\"\"Header class for which the column definition line starts with the\n    comment character.  See the :class:`CommentedHeader` class  for an example.\n    \"\"\"\n\n    def process_lines(self, lines):\n        \"\"\"Return only non-blank lines that start with the comment regexp.  For these\n        lines strip out the matching characters and leading/trailing whitespace.\"\"\"\n        re_comment = re.compile(self.comment)\n        for line in lines:\n            line = line.strip()\n            if not line:\n                continue\n            match = re_comment.match(line)\n            if match:\n                out = line[match.end():]\n                if out:\n                    yield out\n            else:\n                # Stop iterating on first failed match for a non-blank line\n                return\n\n    def write(self, lines):\n        \"\"\"\n        Write header information in the ECSV ASCII format.\n\n        This function is called at the point when preprocessing has been done to\n        convert the input table columns to `self.cols` which is a list of\n        `astropy.io.ascii.core.Column` objects. In particular `col.str_vals`\n        is available for each column with the string representation of each\n        column item for output.\n\n        This format starts with a delimiter separated list of the column names\n        in order to make this format readable by humans and simple csv-type\n        readers. It then encodes the full table meta and column attributes and\n        meta as YAML and pretty-prints this in the header.  Finally the\n        delimited column names are repeated again, for humans and readers that\n        look for the *last* comment line as defining the column names.\n        \"\"\"\n        if self.splitter.delimiter not in DELIMITERS:\n            raise ValueError('only space and comma are allowed for delimiter in ECSV format')\n\n        # Now assemble the header dict that will be serialized by the YAML dumper\n        header = {'cols': self.cols, 'schema': 'astropy-2.0'}\n\n        if self.table_meta:\n            header['meta'] = self.table_meta\n\n        # Set the delimiter only for the non-default option(s)\n        if self.splitter.delimiter != ' ':\n            header['delimiter'] = self.splitter.delimiter\n\n        header_yaml_lines = ([f'%ECSV {ECSV_VERSION}',\n                              '---']\n                             + meta.get_yaml_from_header(header))\n\n        lines.extend([self.write_comment + line for line in header_yaml_lines])\n        lines.append(self.splitter.join([x.info.name for x in self.cols]))\n\n    def write_comments(self, lines, meta):\n        \"\"\"\n        WRITE: Override the default write_comments to do nothing since this is handled\n        in the custom write method.\n        \"\"\"\n        pass\n\n    def update_meta(self, lines, meta):\n        \"\"\"\n        READ: Override the default update_meta to do nothing.  This process is done\n        in get_cols() for this reader.\n        \"\"\"\n        pass\n\n    def get_cols(self, lines):\n        \"\"\"\n        READ: Initialize the header Column objects from the table ``lines``.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n        # Cache a copy of the original input lines before processing below\n        raw_lines = lines\n\n        # Extract non-blank comment (header) lines with comment character stripped\n        lines = list(self.process_lines(lines))\n\n        # Validate that this is a ECSV file\n        ecsv_header_re = r\"\"\"%ECSV [ ]\n                             (?P<major> \\d+)\n                             \\. (?P<minor> \\d+)\n                             \\.? (?P<bugfix> \\d+)? $\"\"\"\n\n        no_header_msg = ('ECSV header line like \"# %ECSV <version>\" not found as first line.'\n                         '  This is required for a ECSV file.')\n\n        if not lines:\n            raise core.InconsistentTableError(no_header_msg)\n\n        match = re.match(ecsv_header_re, lines[0].strip(), re.VERBOSE)\n        if not match:\n            raise core.InconsistentTableError(no_header_msg)\n\n        # Construct ecsv_version for backwards compatibility workarounds.\n        self.ecsv_version = tuple(int(v or 0) for v in match.groups())\n\n        try:\n            header = meta.get_header_from_yaml(lines)\n        except meta.YamlParseError:\n            raise core.InconsistentTableError('unable to parse yaml in meta header')\n\n        if 'meta' in header:\n            self.table_meta = header['meta']\n\n        if 'delimiter' in header:\n            delimiter = header['delimiter']\n            if delimiter not in DELIMITERS:\n                raise ValueError('only space and comma are allowed for delimiter in ECSV format')\n            self.splitter.delimiter = delimiter\n            self.data.splitter.delimiter = delimiter\n\n        # Create the list of io.ascii column objects from `header`\n        header_cols = OrderedDict((x['name'], x) for x in header['datatype'])\n        self.names = [x['name'] for x in header['datatype']]\n\n        # Read the first non-commented line of table and split to get the CSV\n        # header column names.  This is essentially what the Basic reader does.\n        header_line = next(super().process_lines(raw_lines))\n        header_names = next(self.splitter([header_line]))\n\n        # Check for consistency of the ECSV vs. CSV header column names\n        if header_names != self.names:\n            raise core.InconsistentTableError('column names from ECSV header {} do not '\n                                              'match names from header line of CSV data {}'\n                                              .format(self.names, header_names))\n\n        # BaseHeader method to create self.cols, which is a list of\n        # io.ascii.core.Column objects (*not* Table Column objects).\n        self._set_cols_from_names()\n\n        # Transfer attributes from the column descriptor stored in the input\n        # header YAML metadata to the new columns to create this table.\n        for col in self.cols:\n            for attr in ('description', 'format', 'unit', 'meta', 'subtype'):\n                if attr in header_cols[col.name]:\n                    setattr(col, attr, header_cols[col.name][attr])\n\n            col.dtype = header_cols[col.name]['datatype']\n            # Require col dtype to be a valid ECSV datatype. However, older versions\n            # of astropy writing ECSV version 0.9 and earlier had inadvertently allowed\n            # numpy datatypes like datetime64 or object or python str, which are not in the ECSV standard.\n            # For back-compatibility with those existing older files, allow reading with no error.\n            if col.dtype not in ECSV_DATATYPES and self.ecsv_version > (0, 9, 0):\n                raise ValueError(f'datatype {col.dtype!r} of column {col.name!r} '\n                                 f'is not in allowed values {ECSV_DATATYPES}')\n\n            # Subtype is written like \"int64[2,null]\" and we want to split this\n            # out to \"int64\" and [2, None].\n            subtype = col.subtype\n            if subtype and '[' in subtype:\n                idx = subtype.index('[')\n                col.subtype = subtype[:idx]\n                col.shape = json.loads(subtype[idx:])\n\n            # Convert ECSV \"string\" to numpy \"str\"\n            for attr in ('dtype', 'subtype'):\n                if getattr(col, attr) == 'string':\n                    setattr(col, attr, 'str')\n\n            # ECSV subtype of 'json' maps to numpy 'object' dtype\n            if col.subtype == 'json':\n                col.subtype = 'object'"},{"col":4,"comment":"Remove whitespace at the beginning or end of value.","endLoc":401,"header":"def process_val(self, val)","id":4641,"name":"process_val","nodeType":"Function","startLoc":399,"text":"def process_val(self, val):\n        \"\"\"Remove whitespace at the beginning or end of value.\"\"\"\n        return val.strip()"},{"col":4,"comment":"null","endLoc":411,"header":"def __call__(self, lines)","id":4642,"name":"__call__","nodeType":"Function","startLoc":403,"text":"def __call__(self, lines):\n        if self.process_line:\n            lines = (self.process_line(x) for x in lines)\n        for line in lines:\n            vals = line.split(self.delimiter)\n            if self.process_val:\n                yield [self.process_val(x) for x in vals]\n            else:\n                yield vals"},{"col":0,"comment":"Replace tabs with spaces in given string, preserving quoted substrings\n\n    Parameters\n    ----------\n    line : str\n        String containing tabs to be replaced with spaces.\n    escapechar : str\n        Character in ``line`` used to escape special characters.\n    quotechar : str\n        Character in ``line`` indicating the start/end of a substring.\n\n    Returns\n    -------\n    line : str\n        A copy of ``line`` with tabs replaced by spaces, preserving quoted substrings.\n    ","endLoc":539,"header":"def _replace_tab_with_space(line, escapechar, quotechar)","id":4643,"name":"_replace_tab_with_space","nodeType":"Function","startLoc":512,"text":"def _replace_tab_with_space(line, escapechar, quotechar):\n    \"\"\"Replace tabs with spaces in given string, preserving quoted substrings\n\n    Parameters\n    ----------\n    line : str\n        String containing tabs to be replaced with spaces.\n    escapechar : str\n        Character in ``line`` used to escape special characters.\n    quotechar : str\n        Character in ``line`` indicating the start/end of a substring.\n\n    Returns\n    -------\n    line : str\n        A copy of ``line`` with tabs replaced by spaces, preserving quoted substrings.\n    \"\"\"\n    newline = []\n    in_quote = False\n    lastchar = 'NONE'\n    for char in line:\n        if char == quotechar and lastchar != escapechar:\n            in_quote = not in_quote\n        if char == '\\t' and not in_quote:\n            char = ' '\n        lastchar = char\n        newline.append(char)\n    return ''.join(newline)"},{"attributeType":"null","col":8,"comment":"null","endLoc":3018,"id":4644,"name":"ineqcons","nodeType":"Attribute","startLoc":3018,"text":"self.ineqcons"},{"attributeType":"null","col":8,"comment":"null","endLoc":3395,"id":4645,"name":"_eqcons","nodeType":"Attribute","startLoc":3395,"text":"self._eqcons"},{"col":4,"comment":"Returns a string representation of the coordinate data.","endLoc":1443,"header":"def _data_repr(self)","id":4646,"name":"_data_repr","nodeType":"Function","startLoc":1377,"text":"def _data_repr(self):\n        \"\"\"Returns a string representation of the coordinate data.\"\"\"\n\n        if not self.has_data:\n            return ''\n\n        if self.representation_type:\n            if (hasattr(self.representation_type, '_unit_representation')\n                    and isinstance(self.data,\n                                   self.representation_type._unit_representation)):\n                rep_cls = self.data.__class__\n            else:\n                rep_cls = self.representation_type\n\n            if 's' in self.data.differentials:\n                dif_cls = self.get_representation_cls('s')\n                dif_data = self.data.differentials['s']\n                if isinstance(dif_data, (r.UnitSphericalDifferential,\n                                         r.UnitSphericalCosLatDifferential,\n                                         r.RadialDifferential)):\n                    dif_cls = dif_data.__class__\n\n            else:\n                dif_cls = None\n\n            data = self.represent_as(rep_cls, dif_cls, in_frame_units=True)\n\n            data_repr = repr(data)\n            # Generate the list of component names out of the repr string\n            part1, _, remainder = data_repr.partition('(')\n            if remainder != '':\n                comp_str, _, part2 = remainder.partition(')')\n                comp_names = comp_str.split(', ')\n                # Swap in frame-specific component names\n                invnames = dict([(nmrepr, nmpref) for nmpref, nmrepr\n                                 in self.representation_component_names.items()])\n                for i, name in enumerate(comp_names):\n                    comp_names[i] = invnames.get(name, name)\n                # Reassemble the repr string\n                data_repr = part1 + '(' + ', '.join(comp_names) + ')' + part2\n\n        else:\n            data = self.data\n            data_repr = repr(self.data)\n\n        if data_repr.startswith('<' + data.__class__.__name__):\n            # remove both the leading \"<\" and the space after the name, as well\n            # as the trailing \">\"\n            data_repr = data_repr[(len(data.__class__.__name__) + 2):-1]\n        else:\n            data_repr = 'Data:\\n' + data_repr\n\n        if 's' in self.data.differentials:\n            data_repr_spl = data_repr.split('\\n')\n            if 'has differentials' in data_repr_spl[-1]:\n                diffrepr = repr(data.differentials['s']).split('\\n')\n                if diffrepr[0].startswith('<'):\n                    diffrepr[0] = ' ' + ' '.join(diffrepr[0].split(' ')[1:])\n                for frm_nm, rep_nm in self.get_representation_component_names('s').items():\n                    diffrepr[0] = diffrepr[0].replace(rep_nm, frm_nm)\n                if diffrepr[-1].endswith('>'):\n                    diffrepr[-1] = diffrepr[-1][:-1]\n                data_repr_spl[-1] = '\\n'.join(diffrepr)\n\n            data_repr = '\\n'.join(data_repr_spl)\n\n        return data_repr"},{"col":4,"comment":"Remove whitespace at the beginning or end of value.","endLoc":459,"header":"def process_val(self, val)","id":4647,"name":"process_val","nodeType":"Function","startLoc":457,"text":"def process_val(self, val):\n        \"\"\"Remove whitespace at the beginning or end of value.\"\"\"\n        return val.strip(' \\t')"},{"col":4,"comment":"Return an iterator over the table ``lines``, where each iterator output\n        is a list of the split line values.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        Yields\n        ------\n        line : list of str\n            Each line's split values.\n\n        ","endLoc":493,"header":"def __call__(self, lines)","id":4648,"name":"__call__","nodeType":"Function","startLoc":461,"text":"def __call__(self, lines):\n        \"\"\"Return an iterator over the table ``lines``, where each iterator output\n        is a list of the split line values.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        Yields\n        ------\n        line : list of str\n            Each line's split values.\n\n        \"\"\"\n        if self.process_line:\n            lines = [self.process_line(x) for x in lines]\n\n        delimiter = ' ' if self.delimiter == r'\\s' else self.delimiter\n\n        csv_reader = csv.reader(lines,\n                                delimiter=delimiter,\n                                doublequote=self.doublequote,\n                                escapechar=self.escapechar,\n                                quotechar=self.quotechar,\n                                quoting=self.quoting,\n                                skipinitialspace=self.skipinitialspace\n                                )\n        for vals in csv_reader:\n            if self.process_val:\n                yield [self.process_val(x) for x in vals]\n            else:\n                yield vals"},{"col":4,"comment":"\n        Computes angular offsets to go *from* this coordinate *to* another.\n\n        Parameters\n        ----------\n        tocoord : `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate to find the offset to.\n\n        Returns\n        -------\n        lon_offset : `~astropy.coordinates.Angle`\n            The angular offset in the longitude direction. The definition of\n            \"longitude\" depends on this coordinate's frame (e.g., RA for\n            equatorial coordinates).\n        lat_offset : `~astropy.coordinates.Angle`\n            The angular offset in the latitude direction. The definition of\n            \"latitude\" depends on this coordinate's frame (e.g., Dec for\n            equatorial coordinates).\n\n        Raises\n        ------\n        ValueError\n            If the ``tocoord`` is not in the same frame as this one. This is\n            different from the behavior of the `separation`/`separation_3d`\n            methods because the offset components depend critically on the\n            specific choice of frame.\n\n        Notes\n        -----\n        This uses the sky offset frame machinery, and hence will produce a new\n        sky offset frame if one does not already exist for this object's frame\n        class.\n\n        See Also\n        --------\n        separation : for the *total* angular offset (not broken out into components).\n        position_angle : for the direction of the offset.\n\n        ","endLoc":1240,"header":"def spherical_offsets_to(self, tocoord)","id":4649,"name":"spherical_offsets_to","nodeType":"Function","startLoc":1192,"text":"def spherical_offsets_to(self, tocoord):\n        r\"\"\"\n        Computes angular offsets to go *from* this coordinate *to* another.\n\n        Parameters\n        ----------\n        tocoord : `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate to find the offset to.\n\n        Returns\n        -------\n        lon_offset : `~astropy.coordinates.Angle`\n            The angular offset in the longitude direction. The definition of\n            \"longitude\" depends on this coordinate's frame (e.g., RA for\n            equatorial coordinates).\n        lat_offset : `~astropy.coordinates.Angle`\n            The angular offset in the latitude direction. The definition of\n            \"latitude\" depends on this coordinate's frame (e.g., Dec for\n            equatorial coordinates).\n\n        Raises\n        ------\n        ValueError\n            If the ``tocoord`` is not in the same frame as this one. This is\n            different from the behavior of the `separation`/`separation_3d`\n            methods because the offset components depend critically on the\n            specific choice of frame.\n\n        Notes\n        -----\n        This uses the sky offset frame machinery, and hence will produce a new\n        sky offset frame if one does not already exist for this object's frame\n        class.\n\n        See Also\n        --------\n        separation : for the *total* angular offset (not broken out into components).\n        position_angle : for the direction of the offset.\n\n        \"\"\"\n        if not self.is_equivalent_frame(tocoord):\n            raise ValueError('Tried to use spherical_offsets_to with two non-matching frames!')\n\n        aframe = self.skyoffset_frame()\n        acoord = tocoord.transform_to(aframe)\n\n        dlon = acoord.spherical.lon.view(Angle)\n        dlat = acoord.spherical.lat.view(Angle)\n        return dlon, dlat"},{"col":4,"comment":"null","endLoc":418,"header":"def join(self, vals)","id":4650,"name":"join","nodeType":"Function","startLoc":413,"text":"def join(self, vals):\n        if self.delimiter is None:\n            delimiter = ' '\n        else:\n            delimiter = self.delimiter\n        return delimiter.join(str(x) for x in vals)"},{"col":4,"comment":"\n        Returns the sky offset frame with this `SkyCoord` at the origin.\n\n        Returns\n        -------\n        astrframe : `~astropy.coordinates.SkyOffsetFrame`\n            A sky offset frame of the same type as this `SkyCoord` (e.g., if\n            this object has an ICRS coordinate, the resulting frame is\n            SkyOffsetICRS, with the origin set to this object)\n        rotation : angle-like\n            The final rotation of the frame about the ``origin``. The sign of\n            the rotation is the left-hand rule. That is, an object at a\n            particular position angle in the un-rotated system will be sent to\n            the positive latitude (z) direction in the final frame.\n        ","endLoc":1633,"header":"def skyoffset_frame(self, rotation=None)","id":4651,"name":"skyoffset_frame","nodeType":"Function","startLoc":1617,"text":"def skyoffset_frame(self, rotation=None):\n        \"\"\"\n        Returns the sky offset frame with this `SkyCoord` at the origin.\n\n        Returns\n        -------\n        astrframe : `~astropy.coordinates.SkyOffsetFrame`\n            A sky offset frame of the same type as this `SkyCoord` (e.g., if\n            this object has an ICRS coordinate, the resulting frame is\n            SkyOffsetICRS, with the origin set to this object)\n        rotation : angle-like\n            The final rotation of the frame about the ``origin``. The sign of\n            the rotation is the left-hand rule. That is, an object at a\n            particular position angle in the un-rotated system will be sent to\n            the positive latitude (z) direction in the final frame.\n        \"\"\"\n        return SkyOffsetFrame(origin=self, rotation=rotation)"},{"className":"BasicHeader","col":0,"comment":"\n    Basic table Header Reader\n\n    Set a few defaults for common ascii table formats\n    (start at line 0, comments begin with ``#`` and possibly white space)\n    ","endLoc":27,"id":4652,"nodeType":"Class","startLoc":18,"text":"class BasicHeader(core.BaseHeader):\n    \"\"\"\n    Basic table Header Reader\n\n    Set a few defaults for common ascii table formats\n    (start at line 0, comments begin with ``#`` and possibly white space)\n    \"\"\"\n    start_line = 0\n    comment = r'\\s*#'\n    write_comment = '# '"},{"attributeType":"null","col":8,"comment":"null","endLoc":2924,"id":4653,"name":"_model_set_axis","nodeType":"Attribute","startLoc":2924,"text":"self._model_set_axis"},{"attributeType":"null","col":4,"comment":" one-character string used to separate fields ","endLoc":391,"id":4654,"name":"delimiter","nodeType":"Attribute","startLoc":391,"text":"delimiter"},{"col":4,"comment":"\n        Return HTML data from lines as a generator.\n        ","endLoc":135,"header":"def __call__(self, lines)","id":4655,"name":"__call__","nodeType":"Function","startLoc":117,"text":"def __call__(self, lines):\n        \"\"\"\n        Return HTML data from lines as a generator.\n        \"\"\"\n        for line in lines:\n            if not isinstance(line, SoupString):\n                raise TypeError('HTML lines should be of type SoupString')\n            soup = line.soup\n            header_elements = soup.find_all('th')\n            if header_elements:\n                # Return multicolumns as tuples for HTMLHeader handling\n                yield [(el.text.strip(), el['colspan']) if el.has_attr('colspan')\n                       else el.text.strip() for el in header_elements]\n            data_elements = soup.find_all('td')\n            if data_elements:\n                yield [el.text.strip() for el in data_elements]\n        if len(lines) == 0:\n            raise core.InconsistentTableError('HTML tables must contain data '\n                                              'in a <table> tag')"},{"attributeType":"null","col":8,"comment":"null","endLoc":2910,"id":4656,"name":"_leaflist","nodeType":"Attribute","startLoc":2910,"text":"self._leaflist"},{"col":4,"comment":"null","endLoc":509,"header":"def join(self, vals)","id":4657,"name":"join","nodeType":"Function","startLoc":495,"text":"def join(self, vals):\n\n        delimiter = ' ' if self.delimiter is None else str(self.delimiter)\n\n        if self.csv_writer is None:\n            self.csv_writer = CsvWriter(delimiter=delimiter,\n                                        doublequote=self.doublequote,\n                                        escapechar=self.escapechar,\n                                        quotechar=self.quotechar,\n                                        quoting=self.quoting)\n        if self.process_val:\n            vals = [self.process_val(x) for x in vals]\n        out = self.csv_writer.writerow(vals).rstrip('\\r\\n')\n\n        return out"},{"attributeType":"null","col":8,"comment":"null","endLoc":2914,"id":4658,"name":"_param_metrics","nodeType":"Attribute","startLoc":2914,"text":"self._param_metrics"},{"attributeType":"null","col":8,"comment":"null","endLoc":3545,"id":4659,"name":"_param_map","nodeType":"Attribute","startLoc":3545,"text":"self._param_map"},{"col":4,"comment":"null","endLoc":95,"header":"def __init__(self, csvfile=None, **kwargs)","id":4660,"name":"__init__","nodeType":"Function","startLoc":86,"text":"def __init__(self, csvfile=None, **kwargs):\n        self.csvfile = csvfile\n\n        # Temporary StringIO for catching the real csv.writer() object output\n        self.temp_out = StringIO()\n        self.writer = csv.writer(self.temp_out, **kwargs)\n\n        dialect = self.writer.dialect\n        self.quotechar2 = dialect.quotechar * 2\n        self.quote_empty = (dialect.quoting == csv.QUOTE_MINIMAL) and (dialect.delimiter == ' ')"},{"col":4,"comment":"null","endLoc":164,"header":"def __init__(self, *args, **kwargs)","id":4661,"name":"__init__","nodeType":"Function","startLoc":158,"text":"def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        if self.origin is not None and not self.origin.has_data:\n            raise ValueError('The origin supplied to SkyOffsetFrame has no '\n                             'data.')\n        if self.has_data:\n            self._set_skyoffset_data_lon_wrap_angle(self.data)"},{"className":"BaseHeader","col":0,"comment":"\n    Base table header reader\n    ","endLoc":749,"id":4662,"nodeType":"Class","startLoc":559,"text":"class BaseHeader:\n    \"\"\"\n    Base table header reader\n    \"\"\"\n    auto_format = 'col{}'\n    \"\"\" format string for auto-generating column names \"\"\"\n    start_line = None\n    \"\"\" None, int, or a function of ``lines`` that returns None or int \"\"\"\n    comment = None\n    \"\"\" regular expression for comment lines \"\"\"\n    splitter_class = DefaultSplitter\n    \"\"\" Splitter class for splitting data lines into columns \"\"\"\n    names = None\n    \"\"\" list of names corresponding to each data column \"\"\"\n    write_comment = False\n    write_spacer_lines = ['ASCII_TABLE_WRITE_SPACER_LINE']\n\n    def __init__(self):\n        self.splitter = self.splitter_class()\n\n    def _set_cols_from_names(self):\n        self.cols = [Column(name=x) for x in self.names]\n\n    def update_meta(self, lines, meta):\n        \"\"\"\n        Extract any table-level metadata, e.g. keywords, comments, column metadata, from\n        the table ``lines`` and update the OrderedDict ``meta`` in place.  This base\n        method extracts comment lines and stores them in ``meta`` for output.\n        \"\"\"\n        if self.comment:\n            re_comment = re.compile(self.comment)\n            comment_lines = [x for x in lines if re_comment.match(x)]\n        else:\n            comment_lines = []\n        comment_lines = [re.sub('^' + self.comment, '', x).strip()\n                         for x in comment_lines]\n        if comment_lines:\n            meta.setdefault('table', {})['comments'] = comment_lines\n\n    def get_cols(self, lines):\n        \"\"\"Initialize the header Column objects from the table ``lines``.\n\n        Based on the previously set Header attributes find or create the column names.\n        Sets ``self.cols`` with the list of Columns.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n\n        start_line = _get_line_index(self.start_line, self.process_lines(lines))\n        if start_line is None:\n            # No header line so auto-generate names from n_data_cols\n            # Get the data values from the first line of table data to determine n_data_cols\n            try:\n                first_data_vals = next(self.data.get_str_vals())\n            except StopIteration:\n                raise InconsistentTableError('No data lines found so cannot autogenerate '\n                                             'column names')\n            n_data_cols = len(first_data_vals)\n            self.names = [self.auto_format.format(i)\n                          for i in range(1, n_data_cols + 1)]\n\n        else:\n            for i, line in enumerate(self.process_lines(lines)):\n                if i == start_line:\n                    break\n            else:  # No header line matching\n                raise ValueError('No header line found in table')\n\n            self.names = next(self.splitter([line]))\n\n        self._set_cols_from_names()\n\n    def process_lines(self, lines):\n        \"\"\"Generator to yield non-blank and non-comment lines\"\"\"\n        re_comment = re.compile(self.comment) if self.comment else None\n        # Yield non-comment lines\n        for line in lines:\n            if line.strip() and (not self.comment or not re_comment.match(line)):\n                yield line\n\n    def write_comments(self, lines, meta):\n        if self.write_comment not in (False, None):\n            for comment in meta.get('comments', []):\n                lines.append(self.write_comment + comment)\n\n    def write(self, lines):\n        if self.start_line is not None:\n            for i, spacer_line in zip(range(self.start_line),\n                                      itertools.cycle(self.write_spacer_lines)):\n                lines.append(spacer_line)\n            lines.append(self.splitter.join([x.info.name for x in self.cols]))\n\n    @property\n    def colnames(self):\n        \"\"\"Return the column names of the table\"\"\"\n        return tuple(col.name if isinstance(col, Column) else col.info.name\n                     for col in self.cols)\n\n    def remove_columns(self, names):\n        \"\"\"\n        Remove several columns from the table.\n\n        Parameters\n        ----------\n        names : list\n            A list containing the names of the columns to remove\n        \"\"\"\n        colnames = self.colnames\n        for name in names:\n            if name not in colnames:\n                raise KeyError(f\"Column {name} does not exist\")\n\n        self.cols = [col for col in self.cols if col.name not in names]\n\n    def rename_column(self, name, new_name):\n        \"\"\"\n        Rename a column.\n\n        Parameters\n        ----------\n        name : str\n            The current name of the column.\n        new_name : str\n            The new name for the column\n        \"\"\"\n        try:\n            idx = self.colnames.index(name)\n        except ValueError:\n            raise KeyError(f\"Column {name} does not exist\")\n\n        col = self.cols[idx]\n\n        # For writing self.cols can contain cols that are not Column.  Raise\n        # exception in that case.\n        if isinstance(col, Column):\n            col.name = new_name\n        else:\n            raise TypeError(f'got column type {type(col)} instead of required '\n                            f'{Column}')\n\n    def get_type_map_key(self, col):\n        return col.raw_type\n\n    def get_col_type(self, col):\n        try:\n            type_map_key = self.get_type_map_key(col)\n            return self.col_type_map[type_map_key.lower()]\n        except KeyError:\n            raise ValueError('Unknown data type \"\"{}\"\" for column \"{}\"'.format(\n                col.raw_type, col.name))\n\n    def check_column_names(self, names, strict_names, guessing):\n        \"\"\"\n        Check column names.\n\n        This must be done before applying the names transformation\n        so that guessing will fail appropriately if ``names`` is supplied.\n        For instance if the basic reader is given a table with no column header\n        row.\n\n        Parameters\n        ----------\n        names : list\n            User-supplied list of column names\n        strict_names : bool\n            Whether to impose extra requirements on names\n        guessing : bool\n            True if this method is being called while guessing the table format\n        \"\"\"\n        if strict_names:\n            # Impose strict requirements on column names (normally used in guessing)\n            bads = [\" \", \",\", \"|\", \"\\t\", \"'\", '\"']\n            for name in self.colnames:\n                if (_is_number(name) or len(name) == 0\n                        or name[0] in bads or name[-1] in bads):\n                    raise InconsistentTableError(\n                        f'Column name {name!r} does not meet strict name requirements')\n        # When guessing require at least two columns, except for ECSV which can\n        # reliably be guessed from the header requirements.\n        if guessing and len(self.colnames) <= 1 and self.__class__.__name__ != 'EcsvHeader':\n            raise ValueError('Table format guessing requires at least two columns, got {}'\n                             .format(list(self.colnames)))\n\n        if names is not None and len(names) != len(self.colnames):\n            raise InconsistentTableError(\n                'Length of names argument ({}) does not match number'\n                ' of table columns ({})'.format(len(names), len(self.colnames)))"},{"col":4,"comment":"null","endLoc":577,"header":"def __init__(self)","id":4663,"name":"__init__","nodeType":"Function","startLoc":576,"text":"def __init__(self):\n        self.splitter = self.splitter_class()"},{"attributeType":"null","col":4,"comment":" one-character string used to separate fields. ","endLoc":434,"id":4664,"name":"delimiter","nodeType":"Attribute","startLoc":434,"text":"delimiter"},{"attributeType":"null","col":4,"comment":" control how instances of *quotechar* in a field are quoted ","endLoc":436,"id":4665,"name":"quotechar","nodeType":"Attribute","startLoc":436,"text":"quotechar"},{"col":4,"comment":"null","endLoc":580,"header":"def _set_cols_from_names(self)","id":4666,"name":"_set_cols_from_names","nodeType":"Function","startLoc":579,"text":"def _set_cols_from_names(self):\n        self.cols = [Column(name=x) for x in self.names]"},{"attributeType":"null","col":4,"comment":" character to remove special meaning from following character ","endLoc":438,"id":4667,"name":"doublequote","nodeType":"Attribute","startLoc":438,"text":"doublequote"},{"attributeType":"null","col":4,"comment":" one-character stringto quote fields containing special characters ","endLoc":440,"id":4668,"name":"escapechar","nodeType":"Attribute","startLoc":440,"text":"escapechar"},{"attributeType":"null","col":8,"comment":"null","endLoc":2919,"id":4669,"name":"_n_models","nodeType":"Attribute","startLoc":2919,"text":"self._n_models"},{"attributeType":"null","col":4,"comment":" control when quotes are recognized by the reader ","endLoc":442,"id":4670,"name":"quoting","nodeType":"Attribute","startLoc":442,"text":"quoting"},{"attributeType":"null","col":4,"comment":" ignore whitespace immediately following the delimiter ","endLoc":444,"id":4671,"name":"skipinitialspace","nodeType":"Attribute","startLoc":444,"text":"skipinitialspace"},{"attributeType":"null","col":4,"comment":"null","endLoc":446,"id":4672,"name":"csv_writer","nodeType":"Attribute","startLoc":446,"text":"csv_writer"},{"col":4,"comment":"null","endLoc":292,"header":"def __init__(self, name)","id":4673,"name":"__init__","nodeType":"Function","startLoc":285,"text":"def __init__(self, name):\n        self.name = name\n        self.type = NoType  # Generic type (Int, Float, Str etc)\n        self.dtype = None  # Numpy dtype if available\n        self.str_vals = []\n        self.fill_values = {}\n        self.shape = []\n        self.subtype = None"},{"col":4,"comment":"\n        Extract any table-level metadata, e.g. keywords, comments, column metadata, from\n        the table ``lines`` and update the OrderedDict ``meta`` in place.  This base\n        method extracts comment lines and stores them in ``meta`` for output.\n        ","endLoc":596,"header":"def update_meta(self, lines, meta)","id":4674,"name":"update_meta","nodeType":"Function","startLoc":582,"text":"def update_meta(self, lines, meta):\n        \"\"\"\n        Extract any table-level metadata, e.g. keywords, comments, column metadata, from\n        the table ``lines`` and update the OrderedDict ``meta`` in place.  This base\n        method extracts comment lines and stores them in ``meta`` for output.\n        \"\"\"\n        if self.comment:\n            re_comment = re.compile(self.comment)\n            comment_lines = [x for x in lines if re_comment.match(x)]\n        else:\n            comment_lines = []\n        comment_lines = [re.sub('^' + self.comment, '', x).strip()\n                         for x in comment_lines]\n        if comment_lines:\n            meta.setdefault('table', {})['comments'] = comment_lines"},{"attributeType":"null","col":4,"comment":"null","endLoc":447,"id":4675,"name":"csv_writer_out","nodeType":"Attribute","startLoc":447,"text":"csv_writer_out"},{"attributeType":"null","col":12,"comment":"null","endLoc":500,"id":4676,"name":"csv_writer","nodeType":"Attribute","startLoc":500,"text":"self.csv_writer"},{"col":4,"comment":"null","endLoc":170,"header":"@staticmethod\n    def _set_skyoffset_data_lon_wrap_angle(data)","id":4677,"name":"_set_skyoffset_data_lon_wrap_angle","nodeType":"Function","startLoc":166,"text":"@staticmethod\n    def _set_skyoffset_data_lon_wrap_angle(data):\n        if hasattr(data, 'lon'):\n            data.lon.wrap_angle = 180. * u.deg\n        return data"},{"col":4,"comment":"Create a new instance, applying a method to the underlying data.\n\n        In typical usage, the method is any of the shape-changing methods for\n        `~numpy.ndarray` (``reshape``, ``swapaxes``, etc.), as well as those\n        picking particular elements (``__getitem__``, ``take``, etc.), which\n        are all defined in `~astropy.utils.shapes.ShapedLikeNDArray`. It will be\n        applied to the underlying arrays in the representation (e.g., ``x``,\n        ``y``, and ``z`` for `~astropy.coordinates.CartesianRepresentation`),\n        as well as to any frame attributes that have a shape, with the results\n        used to create a new instance.\n\n        Internally, it is also used to apply functions to the above parts\n        (in particular, `~numpy.broadcast_to`).\n\n        Parameters\n        ----------\n        method : str or callable\n            If str, it is the name of a method that is applied to the internal\n            ``components``. If callable, the function is applied.\n        *args : tuple\n            Any positional arguments for ``method``.\n        **kwargs : dict\n            Any keyword arguments for ``method``.\n        ","endLoc":1532,"header":"def _apply(self, method, *args, **kwargs)","id":4678,"name":"_apply","nodeType":"Function","startLoc":1463,"text":"def _apply(self, method, *args, **kwargs):\n        \"\"\"Create a new instance, applying a method to the underlying data.\n\n        In typical usage, the method is any of the shape-changing methods for\n        `~numpy.ndarray` (``reshape``, ``swapaxes``, etc.), as well as those\n        picking particular elements (``__getitem__``, ``take``, etc.), which\n        are all defined in `~astropy.utils.shapes.ShapedLikeNDArray`. It will be\n        applied to the underlying arrays in the representation (e.g., ``x``,\n        ``y``, and ``z`` for `~astropy.coordinates.CartesianRepresentation`),\n        as well as to any frame attributes that have a shape, with the results\n        used to create a new instance.\n\n        Internally, it is also used to apply functions to the above parts\n        (in particular, `~numpy.broadcast_to`).\n\n        Parameters\n        ----------\n        method : str or callable\n            If str, it is the name of a method that is applied to the internal\n            ``components``. If callable, the function is applied.\n        *args : tuple\n            Any positional arguments for ``method``.\n        **kwargs : dict\n            Any keyword arguments for ``method``.\n        \"\"\"\n        def apply_method(value):\n            if isinstance(value, ShapedLikeNDArray):\n                return value._apply(method, *args, **kwargs)\n            else:\n                if callable(method):\n                    return method(value, *args, **kwargs)\n                else:\n                    return getattr(value, method)(*args, **kwargs)\n\n        new = super().__new__(self.__class__)\n        if hasattr(self, '_representation'):\n            new._representation = self._representation.copy()\n        new._attr_names_with_defaults = self._attr_names_with_defaults.copy()\n\n        for attr in self.frame_attributes:\n            _attr = '_' + attr\n            if attr in self._attr_names_with_defaults:\n                setattr(new, _attr, getattr(self, _attr))\n            else:\n                value = getattr(self, _attr)\n                if getattr(value, 'shape', ()):\n                    value = apply_method(value)\n                elif method == 'copy' or method == 'flatten':\n                    # flatten should copy also for a single element array, but\n                    # we cannot use it directly for array scalars, since it\n                    # always returns a one-dimensional array. So, just copy.\n                    value = copy.copy(value)\n\n                setattr(new, _attr, value)\n\n        if self.has_data:\n            new._data = apply_method(self.data)\n        else:\n            new._data = None\n            shapes = [getattr(new, '_' + attr).shape\n                      for attr in new.frame_attributes\n                      if (attr not in new._attr_names_with_defaults\n                          and getattr(getattr(new, '_' + attr), 'shape', ()))]\n            if shapes:\n                new._no_data_shape = (check_broadcast(*shapes)\n                                      if len(shapes) > 1 else shapes[0])\n            else:\n                new._no_data_shape = ()\n\n        return new"},{"className":"FixedWidth","col":0,"comment":"Fixed width table with single header line defining column names and positions.\n\n    Examples::\n\n      # Bar delimiter in header and data\n\n      |  Col1 |   Col2      |  Col3 |\n      |  1.2  | hello there |     3 |\n      |  2.4  | many words  |     7 |\n\n      # Bar delimiter in header only\n\n      Col1 |   Col2      | Col3\n      1.2    hello there    3\n      2.4    many words     7\n\n      # No delimiter with column positions specified as input\n\n      Col1       Col2Col3\n       1.2hello there   3\n       2.4many words    7\n\n    See the :ref:`astropy:fixed_width_gallery` for specific usage examples.\n\n    ","endLoc":308,"id":4679,"nodeType":"Class","startLoc":271,"text":"class FixedWidth(basic.Basic):\n    \"\"\"Fixed width table with single header line defining column names and positions.\n\n    Examples::\n\n      # Bar delimiter in header and data\n\n      |  Col1 |   Col2      |  Col3 |\n      |  1.2  | hello there |     3 |\n      |  2.4  | many words  |     7 |\n\n      # Bar delimiter in header only\n\n      Col1 |   Col2      | Col3\n      1.2    hello there    3\n      2.4    many words     7\n\n      # No delimiter with column positions specified as input\n\n      Col1       Col2Col3\n       1.2hello there   3\n       2.4many words    7\n\n    See the :ref:`astropy:fixed_width_gallery` for specific usage examples.\n\n    \"\"\"\n    _format_name = 'fixed_width'\n    _description = 'Fixed width'\n\n    header_class = FixedWidthHeader\n    data_class = FixedWidthData\n\n    def __init__(self, col_starts=None, col_ends=None, delimiter_pad=' ', bookend=True):\n        super().__init__()\n        self.data.splitter.delimiter_pad = delimiter_pad\n        self.data.splitter.bookend = bookend\n        self.header.col_starts = col_starts\n        self.header.col_ends = col_ends"},{"col":4,"comment":"Initialize the header Column objects from the table ``lines``.\n\n        Based on the previously set Header attributes find or create the column names.\n        Sets ``self.cols`` with the list of Columns.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        ","endLoc":633,"header":"def get_cols(self, lines)","id":4680,"name":"get_cols","nodeType":"Function","startLoc":598,"text":"def get_cols(self, lines):\n        \"\"\"Initialize the header Column objects from the table ``lines``.\n\n        Based on the previously set Header attributes find or create the column names.\n        Sets ``self.cols`` with the list of Columns.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n\n        start_line = _get_line_index(self.start_line, self.process_lines(lines))\n        if start_line is None:\n            # No header line so auto-generate names from n_data_cols\n            # Get the data values from the first line of table data to determine n_data_cols\n            try:\n                first_data_vals = next(self.data.get_str_vals())\n            except StopIteration:\n                raise InconsistentTableError('No data lines found so cannot autogenerate '\n                                             'column names')\n            n_data_cols = len(first_data_vals)\n            self.names = [self.auto_format.format(i)\n                          for i in range(1, n_data_cols + 1)]\n\n        else:\n            for i, line in enumerate(self.process_lines(lines)):\n                if i == start_line:\n                    break\n            else:  # No header line matching\n                raise ValueError('No header line found in table')\n\n            self.names = next(self.splitter([line]))\n\n        self._set_cols_from_names()"},{"col":4,"comment":"\n        Computes the coordinate that is a specified pair of angular offsets away\n        from this coordinate.\n\n        Parameters\n        ----------\n        d_lon : angle-like\n            The angular offset in the longitude direction. The definition of\n            \"longitude\" depends on this coordinate's frame (e.g., RA for\n            equatorial coordinates).\n        d_lat : angle-like\n            The angular offset in the latitude direction. The definition of\n            \"latitude\" depends on this coordinate's frame (e.g., Dec for\n            equatorial coordinates).\n\n        Returns\n        -------\n        newcoord : `~astropy.coordinates.SkyCoord`\n            The coordinates for the location that corresponds to offsetting by\n            ``d_lat`` in the latitude direction and ``d_lon`` in the longitude\n            direction.\n\n        Notes\n        -----\n        This internally uses `~astropy.coordinates.SkyOffsetFrame` to do the\n        transformation. For a more complete set of transform offsets, use\n        `~astropy.coordinates.SkyOffsetFrame` or `~astropy.wcs.WCS` manually.\n        This specific method can be reproduced by doing\n        ``SkyCoord(SkyOffsetFrame(d_lon, d_lat, origin=self.frame).transform_to(self))``.\n\n        See Also\n        --------\n        spherical_offsets_to : compute the angular offsets to another coordinate\n        directional_offset_by : offset a coordinate by an angle in a direction\n        ","endLoc":1279,"header":"def spherical_offsets_by(self, d_lon, d_lat)","id":4681,"name":"spherical_offsets_by","nodeType":"Function","startLoc":1242,"text":"def spherical_offsets_by(self, d_lon, d_lat):\n        \"\"\"\n        Computes the coordinate that is a specified pair of angular offsets away\n        from this coordinate.\n\n        Parameters\n        ----------\n        d_lon : angle-like\n            The angular offset in the longitude direction. The definition of\n            \"longitude\" depends on this coordinate's frame (e.g., RA for\n            equatorial coordinates).\n        d_lat : angle-like\n            The angular offset in the latitude direction. The definition of\n            \"latitude\" depends on this coordinate's frame (e.g., Dec for\n            equatorial coordinates).\n\n        Returns\n        -------\n        newcoord : `~astropy.coordinates.SkyCoord`\n            The coordinates for the location that corresponds to offsetting by\n            ``d_lat`` in the latitude direction and ``d_lon`` in the longitude\n            direction.\n\n        Notes\n        -----\n        This internally uses `~astropy.coordinates.SkyOffsetFrame` to do the\n        transformation. For a more complete set of transform offsets, use\n        `~astropy.coordinates.SkyOffsetFrame` or `~astropy.wcs.WCS` manually.\n        This specific method can be reproduced by doing\n        ``SkyCoord(SkyOffsetFrame(d_lon, d_lat, origin=self.frame).transform_to(self))``.\n\n        See Also\n        --------\n        spherical_offsets_to : compute the angular offsets to another coordinate\n        directional_offset_by : offset a coordinate by an angle in a direction\n        \"\"\"\n        return self.__class__(\n            SkyOffsetFrame(d_lon, d_lat, origin=self.frame).transform_to(self))"},{"col":4,"comment":"Generator to yield non-blank and non-comment lines","endLoc":641,"header":"def process_lines(self, lines)","id":4682,"name":"process_lines","nodeType":"Function","startLoc":635,"text":"def process_lines(self, lines):\n        \"\"\"Generator to yield non-blank and non-comment lines\"\"\"\n        re_comment = re.compile(self.comment) if self.comment else None\n        # Yield non-comment lines\n        for line in lines:\n            if line.strip() and (not self.comment or not re_comment.match(line)):\n                yield line"},{"attributeType":"null","col":8,"comment":"null","endLoc":2904,"id":4683,"name":"_n_submodels","nodeType":"Attribute","startLoc":2904,"text":"self._n_submodels"},{"col":0,"comment":"Return the appropriate line index, depending on ``line_or_func`` which\n    can be either a function, a positive or negative int, or None.\n    ","endLoc":556,"header":"def _get_line_index(line_or_func, lines)","id":4684,"name":"_get_line_index","nodeType":"Function","startLoc":542,"text":"def _get_line_index(line_or_func, lines):\n    \"\"\"Return the appropriate line index, depending on ``line_or_func`` which\n    can be either a function, a positive or negative int, or None.\n    \"\"\"\n\n    if hasattr(line_or_func, '__call__'):\n        return line_or_func(lines)\n    elif line_or_func:\n        if line_or_func >= 0:\n            return line_or_func\n        else:\n            n_lines = sum(1 for line in lines)\n            return n_lines + line_or_func\n    else:\n        return line_or_func"},{"attributeType":"null","col":8,"comment":"null","endLoc":3017,"id":4685,"name":"eqcons","nodeType":"Attribute","startLoc":3017,"text":"self.eqcons"},{"attributeType":"null","col":8,"comment":"null","endLoc":2905,"id":4686,"name":"op","nodeType":"Attribute","startLoc":2905,"text":"self.op"},{"className":"HTMLOutputter","col":0,"comment":"\n    Output the HTML data as an ``astropy.table.Table`` object.\n\n    This subclass allows for the final table to contain\n    multidimensional columns (defined using the colspan attribute\n    of <th>).\n    ","endLoc":171,"id":4687,"nodeType":"Class","startLoc":138,"text":"class HTMLOutputter(core.TableOutputter):\n    \"\"\"\n    Output the HTML data as an ``astropy.table.Table`` object.\n\n    This subclass allows for the final table to contain\n    multidimensional columns (defined using the colspan attribute\n    of <th>).\n    \"\"\"\n\n    default_converters = [core.convert_numpy(int),\n                          core.convert_numpy(float),\n                          core.convert_numpy(str)]\n\n    def __call__(self, cols, meta):\n        \"\"\"\n        Process the data in multidimensional columns.\n        \"\"\"\n        new_cols = []\n        col_num = 0\n\n        while col_num < len(cols):\n            col = cols[col_num]\n            if hasattr(col, 'colspan'):\n                # Join elements of spanned columns together into list of tuples\n                span_cols = cols[col_num:col_num + col.colspan]\n                new_col = core.Column(col.name)\n                new_col.str_vals = list(zip(*[x.str_vals for x in span_cols]))\n                new_cols.append(new_col)\n                col_num += col.colspan\n            else:\n                new_cols.append(col)\n                col_num += 1\n\n        return super().__call__(new_cols, meta)"},{"attributeType":"null","col":12,"comment":"null","endLoc":3016,"id":4688,"name":"linear","nodeType":"Attribute","startLoc":3016,"text":"self.linear"},{"attributeType":"null","col":16,"comment":"null","endLoc":3002,"id":4689,"name":"bounding_box","nodeType":"Attribute","startLoc":3002,"text":"self.bounding_box"},{"attributeType":"null","col":8,"comment":"null","endLoc":3546,"id":4690,"name":"_param_map_inverse","nodeType":"Attribute","startLoc":3546,"text":"self._param_map_inverse"},{"className":"Basic","col":0,"comment":"Character-delimited table with a single header line at the top.\n\n    Lines beginning with a comment character (default='#') as the first\n    non-whitespace character are comments.\n\n    Example table::\n\n      # Column definition is the first uncommented line\n      # Default delimiter is the space character.\n      apples oranges pears\n\n      # Data starts after the header column definition, blank lines ignored\n      1 2 3\n      4 5 6\n    ","endLoc":63,"id":4691,"nodeType":"Class","startLoc":42,"text":"class Basic(core.BaseReader):\n    r\"\"\"Character-delimited table with a single header line at the top.\n\n    Lines beginning with a comment character (default='#') as the first\n    non-whitespace character are comments.\n\n    Example table::\n\n      # Column definition is the first uncommented line\n      # Default delimiter is the space character.\n      apples oranges pears\n\n      # Data starts after the header column definition, blank lines ignored\n      1 2 3\n      4 5 6\n    \"\"\"\n    _format_name = 'basic'\n    _description = 'Basic table with custom delimiters'\n    _io_registry_format_aliases = ['ascii']\n\n    header_class = BasicHeader\n    data_class = BasicData"},{"className":"TableOutputter","col":0,"comment":"\n    Output the table as an astropy.table.Table object.\n    ","endLoc":1135,"id":4692,"nodeType":"Class","startLoc":1109,"text":"class TableOutputter(BaseOutputter):\n    \"\"\"\n    Output the table as an astropy.table.Table object.\n    \"\"\"\n\n    default_converters = [convert_numpy(int),\n                          convert_numpy(float),\n                          convert_numpy(str)]\n\n    def __call__(self, cols, meta):\n        # Sets col.data to numpy array and col.type to io.ascii Type class (e.g.\n        # FloatType) for each col.\n        self._convert_vals(cols)\n\n        t_cols = [numpy.ma.MaskedArray(x.data, mask=x.mask)\n                  if hasattr(x, 'mask') and numpy.any(x.mask)\n                  else x.data for x in cols]\n        out = Table(t_cols, names=[x.name for x in cols], meta=meta['table'])\n\n        for col, out_col in zip(cols, out.columns.values()):\n            for attr in ('format', 'unit', 'description'):\n                if hasattr(col, attr):\n                    setattr(out_col, attr, getattr(col, attr))\n            if hasattr(col, 'meta'):\n                out_col.meta.update(col.meta)\n\n        return out"},{"attributeType":"null","col":8,"comment":"null","endLoc":2907,"id":4693,"name":"right","nodeType":"Attribute","startLoc":2907,"text":"self.right"},{"attributeType":"null","col":8,"comment":"null","endLoc":3534,"id":4694,"name":"_param_names","nodeType":"Attribute","startLoc":3534,"text":"self._param_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":3011,"id":4695,"name":"fit_deriv","nodeType":"Attribute","startLoc":3011,"text":"self.fit_deriv"},{"className":"BaseOutputter","col":0,"comment":"Output table as a dict of column objects keyed on column name.  The\n    table data are stored as plain python lists within the column objects.\n    ","endLoc":1084,"id":4696,"nodeType":"Class","startLoc":1015,"text":"class BaseOutputter:\n    \"\"\"Output table as a dict of column objects keyed on column name.  The\n    table data are stored as plain python lists within the column objects.\n    \"\"\"\n    converters = {}\n    # Derived classes must define default_converters and __call__\n\n    @staticmethod\n    def _validate_and_copy(col, converters):\n        \"\"\"Validate the format for the type converters and then copy those\n        which are valid converters for this column (i.e. converter type is\n        a subclass of col.type)\"\"\"\n        converters_out = []\n        try:\n            for converter in converters:\n                converter_func, converter_type = converter\n                if not issubclass(converter_type, NoType):\n                    raise ValueError()\n                if issubclass(converter_type, col.type):\n                    converters_out.append((converter_func, converter_type))\n\n        except (ValueError, TypeError):\n            raise ValueError('Error: invalid format for converters, see '\n                             'documentation\\n{}'.format(converters))\n        return converters_out\n\n    def _convert_vals(self, cols):\n        for col in cols:\n            for key, converters in self.converters.items():\n                if fnmatch.fnmatch(col.name, key):\n                    break\n            else:\n                if col.dtype is not None:\n                    converters = [convert_numpy(col.dtype)]\n                else:\n                    converters = self.default_converters\n\n            col.converters = self._validate_and_copy(col, converters)\n\n            # Catch the last error in order to provide additional information\n            # in case all attempts at column conversion fail.  The initial\n            # value of of last_error will apply if no converters are defined\n            # and the first col.converters[0] access raises IndexError.\n            last_err = 'no converters defined'\n\n            while not hasattr(col, 'data'):\n                # Try converters, popping the unsuccessful ones from the list.\n                # If there are no converters left here then fail.\n                if not col.converters:\n                    raise ValueError(f'Column {col.name} failed to convert: {last_err}')\n\n                converter_func, converter_type = col.converters[0]\n                if not issubclass(converter_type, col.type):\n                    raise TypeError('converter type does not match column type')\n\n                try:\n                    col.data = converter_func(col.str_vals)\n                    col.type = converter_type\n                except (TypeError, ValueError) as err:\n                    col.converters.pop(0)\n                    last_err = err\n                except OverflowError as err:\n                    # Overflow during conversion (most likely an int that\n                    # doesn't fit in native C long). Put string at the top of\n                    # the converters list for the next while iteration.\n                    warnings.warn(\n                        \"OverflowError converting to {} in column {}, reverting to String.\"\n                        .format(converter_type.__name__, col.name), AstropyWarning)\n                    col.converters.insert(0, convert_numpy(numpy.str))\n                    last_err = err"},{"col":4,"comment":"Validate the format for the type converters and then copy those\n        which are valid converters for this column (i.e. converter type is\n        a subclass of col.type)","endLoc":1039,"header":"@staticmethod\n    def _validate_and_copy(col, converters)","id":4697,"name":"_validate_and_copy","nodeType":"Function","startLoc":1022,"text":"@staticmethod\n    def _validate_and_copy(col, converters):\n        \"\"\"Validate the format for the type converters and then copy those\n        which are valid converters for this column (i.e. converter type is\n        a subclass of col.type)\"\"\"\n        converters_out = []\n        try:\n            for converter in converters:\n                converter_func, converter_type = converter\n                if not issubclass(converter_type, NoType):\n                    raise ValueError()\n                if issubclass(converter_type, col.type):\n                    converters_out.append((converter_func, converter_type))\n\n        except (ValueError, TypeError):\n            raise ValueError('Error: invalid format for converters, see '\n                             'documentation\\n{}'.format(converters))\n        return converters_out"},{"attributeType":"null","col":8,"comment":"null","endLoc":2909,"id":4698,"name":"_user_bounding_box","nodeType":"Attribute","startLoc":2909,"text":"self._user_bounding_box"},{"attributeType":"null","col":8,"comment":"null","endLoc":3010,"id":4699,"name":"_fittable","nodeType":"Attribute","startLoc":3010,"text":"self._fittable"},{"col":4,"comment":"null","endLoc":1084,"header":"def _convert_vals(self, cols)","id":4700,"name":"_convert_vals","nodeType":"Function","startLoc":1041,"text":"def _convert_vals(self, cols):\n        for col in cols:\n            for key, converters in self.converters.items():\n                if fnmatch.fnmatch(col.name, key):\n                    break\n            else:\n                if col.dtype is not None:\n                    converters = [convert_numpy(col.dtype)]\n                else:\n                    converters = self.default_converters\n\n            col.converters = self._validate_and_copy(col, converters)\n\n            # Catch the last error in order to provide additional information\n            # in case all attempts at column conversion fail.  The initial\n            # value of of last_error will apply if no converters are defined\n            # and the first col.converters[0] access raises IndexError.\n            last_err = 'no converters defined'\n\n            while not hasattr(col, 'data'):\n                # Try converters, popping the unsuccessful ones from the list.\n                # If there are no converters left here then fail.\n                if not col.converters:\n                    raise ValueError(f'Column {col.name} failed to convert: {last_err}')\n\n                converter_func, converter_type = col.converters[0]\n                if not issubclass(converter_type, col.type):\n                    raise TypeError('converter type does not match column type')\n\n                try:\n                    col.data = converter_func(col.str_vals)\n                    col.type = converter_type\n                except (TypeError, ValueError) as err:\n                    col.converters.pop(0)\n                    last_err = err\n                except OverflowError as err:\n                    # Overflow during conversion (most likely an int that\n                    # doesn't fit in native C long). Put string at the top of\n                    # the converters list for the next while iteration.\n                    warnings.warn(\n                        \"OverflowError converting to {} in column {}, reverting to String.\"\n                        .format(converter_type.__name__, col.name), AstropyWarning)\n                    col.converters.insert(0, convert_numpy(numpy.str))\n                    last_err = err"},{"attributeType":"null","col":12,"comment":"null","endLoc":2965,"id":4701,"name":"_outputs","nodeType":"Attribute","startLoc":2965,"text":"self._outputs"},{"attributeType":"null","col":8,"comment":"null","endLoc":2906,"id":4702,"name":"left","nodeType":"Attribute","startLoc":2906,"text":"self.left"},{"attributeType":"null","col":8,"comment":"null","endLoc":3009,"id":4703,"name":"name","nodeType":"Attribute","startLoc":3009,"text":"self.name"},{"attributeType":"null","col":8,"comment":"null","endLoc":3019,"id":4704,"name":"n_left_params","nodeType":"Attribute","startLoc":3019,"text":"self.n_left_params"},{"attributeType":"null","col":8,"comment":"null","endLoc":2913,"id":4705,"name":"_parameters_","nodeType":"Attribute","startLoc":2913,"text":"self._parameters_"},{"attributeType":"null","col":12,"comment":"null","endLoc":2962,"id":4706,"name":"n_inputs","nodeType":"Attribute","startLoc":2962,"text":"self.n_inputs"},{"attributeType":"null","col":8,"comment":"null","endLoc":2908,"id":4707,"name":"_bounding_box","nodeType":"Attribute","startLoc":2908,"text":"self._bounding_box"},{"attributeType":"null","col":8,"comment":"null","endLoc":2912,"id":4709,"name":"_parameters","nodeType":"Attribute","startLoc":2912,"text":"self._parameters"},{"attributeType":"null","col":8,"comment":"null","endLoc":3012,"id":4710,"name":"col_fit_deriv","nodeType":"Attribute","startLoc":3012,"text":"self.col_fit_deriv"},{"col":4,"comment":"\n        Computes coordinates at the given offset from this coordinate.\n\n        Parameters\n        ----------\n        position_angle : `~astropy.coordinates.Angle`\n            position_angle of offset\n        separation : `~astropy.coordinates.Angle`\n            offset angular separation\n\n        Returns\n        -------\n        newpoints : `~astropy.coordinates.SkyCoord`\n            The coordinates for the location that corresponds to offsetting by\n            the given `position_angle` and `separation`.\n\n        Notes\n        -----\n        Returned SkyCoord frame retains only the frame attributes that are for\n        the resulting frame type.  (e.g. if the input frame is\n        `~astropy.coordinates.ICRS`, an ``equinox`` value will be retained, but\n        an ``obstime`` will not.)\n\n        For a more complete set of transform offsets, use `~astropy.wcs.WCS`.\n        `~astropy.coordinates.SkyCoord.skyoffset_frame()` can also be used to\n        create a spherical frame with (lat=0, lon=0) at a reference point,\n        approximating an xy cartesian system for small offsets. This method\n        is distinct in that it is accurate on the sphere.\n\n        See Also\n        --------\n        position_angle : inverse operation for the ``position_angle`` component\n        separation : inverse operation for the ``separation`` component\n\n        ","endLoc":1326,"header":"def directional_offset_by(self, position_angle, separation)","id":4711,"name":"directional_offset_by","nodeType":"Function","startLoc":1281,"text":"def directional_offset_by(self, position_angle, separation):\n        \"\"\"\n        Computes coordinates at the given offset from this coordinate.\n\n        Parameters\n        ----------\n        position_angle : `~astropy.coordinates.Angle`\n            position_angle of offset\n        separation : `~astropy.coordinates.Angle`\n            offset angular separation\n\n        Returns\n        -------\n        newpoints : `~astropy.coordinates.SkyCoord`\n            The coordinates for the location that corresponds to offsetting by\n            the given `position_angle` and `separation`.\n\n        Notes\n        -----\n        Returned SkyCoord frame retains only the frame attributes that are for\n        the resulting frame type.  (e.g. if the input frame is\n        `~astropy.coordinates.ICRS`, an ``equinox`` value will be retained, but\n        an ``obstime`` will not.)\n\n        For a more complete set of transform offsets, use `~astropy.wcs.WCS`.\n        `~astropy.coordinates.SkyCoord.skyoffset_frame()` can also be used to\n        create a spherical frame with (lat=0, lon=0) at a reference point,\n        approximating an xy cartesian system for small offsets. This method\n        is distinct in that it is accurate on the sphere.\n\n        See Also\n        --------\n        position_angle : inverse operation for the ``position_angle`` component\n        separation : inverse operation for the ``separation`` component\n\n        \"\"\"\n        from . import angle_utilities\n\n        slat = self.represent_as(UnitSphericalRepresentation).lat\n        slon = self.represent_as(UnitSphericalRepresentation).lon\n\n        newlon, newlat = angle_utilities.offset_by(\n            lon=slon, lat=slat,\n            posang=position_angle, distance=separation)\n\n        return SkyCoord(newlon, newlat, frame=self.frame)"},{"col":4,"comment":"null","endLoc":1579,"header":"def __setitem__(self, item, value)","id":4712,"name":"__setitem__","nodeType":"Function","startLoc":1534,"text":"def __setitem__(self, item, value):\n        if self.__class__ is not value.__class__:\n            raise TypeError(f'can only set from object of same class: '\n                            f'{self.__class__.__name__} vs. '\n                            f'{value.__class__.__name__}')\n\n        if not self.is_equivalent_frame(value):\n            raise ValueError('can only set frame item from an equivalent frame')\n\n        if value._data is None:\n            raise ValueError('can only set frame with value that has data')\n\n        if self._data is None:\n            raise ValueError('cannot set frame which has no data')\n\n        if self.shape == ():\n            raise TypeError(f\"scalar '{self.__class__.__name__}' frame object \"\n                            f\"does not support item assignment\")\n\n        if self._data is None:\n            raise ValueError('can only set frame if it has data')\n\n        if self._data.__class__ is not value._data.__class__:\n            raise TypeError(f'can only set from object of same class: '\n                            f'{self._data.__class__.__name__} vs. '\n                            f'{value._data.__class__.__name__}')\n\n        if self._data._differentials:\n            # Can this ever occur? (Same class but different differential keys).\n            # This exception is not tested since it is not clear how to generate it.\n            if self._data._differentials.keys() != value._data._differentials.keys():\n                raise ValueError(f'setitem value must have same differentials')\n\n            for key, self_diff in self._data._differentials.items():\n                if self_diff.__class__ is not value._data._differentials[key].__class__:\n                    raise TypeError(f'can only set from object of same class: '\n                                    f'{self_diff.__class__.__name__} vs. '\n                                    f'{value._data._differentials[key].__class__.__name__}')\n\n        # Set representation data\n        self._data[item] = value._data\n\n        # Frame attributes required to be identical by is_equivalent_frame,\n        # no need to set them here.\n\n        self.cache.clear()"},{"attributeType":"null","col":4,"comment":"null","endLoc":1019,"id":4713,"name":"converters","nodeType":"Attribute","startLoc":1019,"text":"converters"},{"col":4,"comment":"null","endLoc":1135,"header":"def __call__(self, cols, meta)","id":4714,"name":"__call__","nodeType":"Function","startLoc":1118,"text":"def __call__(self, cols, meta):\n        # Sets col.data to numpy array and col.type to io.ascii Type class (e.g.\n        # FloatType) for each col.\n        self._convert_vals(cols)\n\n        t_cols = [numpy.ma.MaskedArray(x.data, mask=x.mask)\n                  if hasattr(x, 'mask') and numpy.any(x.mask)\n                  else x.data for x in cols]\n        out = Table(t_cols, names=[x.name for x in cols], meta=meta['table'])\n\n        for col, out_col in zip(cols, out.columns.values()):\n            for attr in ('format', 'unit', 'description'):\n                if hasattr(col, attr):\n                    setattr(out_col, attr, getattr(col, attr))\n            if hasattr(col, 'meta'):\n                out_col.meta.update(col.meta)\n\n        return out"},{"attributeType":"null","col":8,"comment":"null","endLoc":3378,"id":4715,"name":"_n_inputs","nodeType":"Attribute","startLoc":3378,"text":"self._n_inputs"},{"className":"IdentityType","col":0,"comment":"null","endLoc":163,"id":4716,"nodeType":"Class","startLoc":142,"text":"class IdentityType(TransformType):\n    name = \"transform/identity\"\n    types = ['astropy.modeling.mappings.Identity']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return mappings.Identity(node.get('n_dims', 1))\n\n    @classmethod\n    def to_tree_transform(cls, data, ctx):\n        node = {}\n        if data.n_inputs != 1:\n            node['n_dims'] = data.n_inputs\n        return node\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, mappings.Identity) and\n                isinstance(b, mappings.Identity) and\n                a.n_inputs == b.n_inputs)"},{"col":4,"comment":"null","endLoc":148,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4717,"name":"from_tree_transform","nodeType":"Function","startLoc":146,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return mappings.Identity(node.get('n_dims', 1))"},{"className":"BaseReader","col":0,"comment":"Class providing methods to read and write an ASCII table using the specified\n    header, data, inputter, and outputter instances.\n\n    Typical usage is to instantiate a Reader() object and customize the\n    ``header``, ``data``, ``inputter``, and ``outputter`` attributes.  Each\n    of these is an object of the corresponding class.\n\n    There is one method ``inconsistent_handler`` that can be used to customize the\n    behavior of ``read()`` in the event that a data row doesn't match the header.\n    The default behavior is to raise an InconsistentTableError.\n\n    ","endLoc":1500,"id":4718,"nodeType":"Class","startLoc":1230,"text":"class BaseReader(metaclass=MetaBaseReader):\n    \"\"\"Class providing methods to read and write an ASCII table using the specified\n    header, data, inputter, and outputter instances.\n\n    Typical usage is to instantiate a Reader() object and customize the\n    ``header``, ``data``, ``inputter``, and ``outputter`` attributes.  Each\n    of these is an object of the corresponding class.\n\n    There is one method ``inconsistent_handler`` that can be used to customize the\n    behavior of ``read()`` in the event that a data row doesn't match the header.\n    The default behavior is to raise an InconsistentTableError.\n\n    \"\"\"\n\n    names = None\n    include_names = None\n    exclude_names = None\n    strict_names = False\n    guessing = False\n    encoding = None\n\n    header_class = BaseHeader\n    data_class = BaseData\n    inputter_class = BaseInputter\n    outputter_class = TableOutputter\n\n    # Max column dimension that writer supports for this format. Exceptions\n    # include ECSV (no limit) and HTML (max_ndim=2).\n    max_ndim = 1\n\n    def __init__(self):\n        self.header = self.header_class()\n        self.data = self.data_class()\n        self.inputter = self.inputter_class()\n        self.outputter = self.outputter_class()\n        # Data and Header instances benefit from a little cross-coupling.  Header may need to\n        # know about number of data columns for auto-column name generation and Data may\n        # need to know about header (e.g. for fixed-width tables where widths are spec'd in header.\n        self.data.header = self.header\n        self.header.data = self.data\n\n        # Metadata, consisting of table-level meta and column-level meta.  The latter\n        # could include information about column type, description, formatting, etc,\n        # depending on the table meta format.\n        self.meta = OrderedDict(table=OrderedDict(),\n                                cols=OrderedDict())\n\n    def _check_multidim_table(self, table):\n        \"\"\"Check that the dimensions of columns in ``table`` are acceptable.\n\n        The reader class attribute ``max_ndim`` defines the maximum dimension of\n        columns that can be written using this format. The base value is ``1``,\n        corresponding to normal scalar columns with just a length.\n\n        Parameters\n        ----------\n        table : `~astropy.table.Table`\n            Input table.\n\n        Raises\n        ------\n        ValueError\n            If any column exceeds the number of allowed dimensions\n        \"\"\"\n        _check_multidim_table(table, self.max_ndim)\n\n    def read(self, table):\n        \"\"\"Read the ``table`` and return the results in a format determined by\n        the ``outputter`` attribute.\n\n        The ``table`` parameter is any string or object that can be processed\n        by the instance ``inputter``.  For the base Inputter class ``table`` can be\n        one of:\n\n        * File name\n        * File-like object\n        * String (newline separated) with all header and data lines (must have at least 2 lines)\n        * List of strings\n\n        Parameters\n        ----------\n        table : str, file-like, list\n            Input table.\n\n        Returns\n        -------\n        table : `~astropy.table.Table`\n            Output table\n\n        \"\"\"\n        # If ``table`` is a file then store the name in the ``data``\n        # attribute. The ``table`` is a \"file\" if it is a string\n        # without the new line specific to the OS.\n        with suppress(TypeError):\n            # Strings only\n            if os.linesep not in table + '':\n                self.data.table_name = os.path.basename(table)\n\n        # If one of the newline chars is set as field delimiter, only\n        # accept the other one as line splitter\n        if self.header.splitter.delimiter == '\\n':\n            newline = '\\r'\n        elif self.header.splitter.delimiter == '\\r':\n            newline = '\\n'\n        else:\n            newline = None\n\n        # Get a list of the lines (rows) in the table\n        self.lines = self.inputter.get_lines(table, newline=newline)\n\n        # Set self.data.data_lines to a slice of lines contain the data rows\n        self.data.get_data_lines(self.lines)\n\n        # Extract table meta values (e.g. keywords, comments, etc).  Updates self.meta.\n        self.header.update_meta(self.lines, self.meta)\n\n        # Get the table column definitions\n        self.header.get_cols(self.lines)\n\n        # Make sure columns are valid\n        self.header.check_column_names(self.names, self.strict_names, self.guessing)\n\n        self.cols = cols = self.header.cols\n        self.data.splitter.cols = cols\n        n_cols = len(cols)\n\n        for i, str_vals in enumerate(self.data.get_str_vals()):\n            if len(str_vals) != n_cols:\n                str_vals = self.inconsistent_handler(str_vals, n_cols)\n\n                # if str_vals is None, we skip this row\n                if str_vals is None:\n                    continue\n\n                # otherwise, we raise an error only if it is still inconsistent\n                if len(str_vals) != n_cols:\n                    errmsg = ('Number of header columns ({}) inconsistent with'\n                              ' data columns ({}) at data line {}\\n'\n                              'Header values: {}\\n'\n                              'Data values: {}'.format(\n                                  n_cols, len(str_vals), i,\n                                  [x.name for x in cols], str_vals))\n\n                    raise InconsistentTableError(errmsg)\n\n            for j, col in enumerate(cols):\n                col.str_vals.append(str_vals[j])\n\n        self.data.masks(cols)\n        if hasattr(self.header, 'table_meta'):\n            self.meta['table'].update(self.header.table_meta)\n\n        _apply_include_exclude_names(self.header, self.names,\n                                     self.include_names, self.exclude_names)\n\n        table = self.outputter(self.header.cols, self.meta)\n        self.cols = self.header.cols\n\n        return table\n\n    def inconsistent_handler(self, str_vals, ncols):\n        \"\"\"\n        Adjust or skip data entries if a row is inconsistent with the header.\n\n        The default implementation does no adjustment, and hence will always trigger\n        an exception in read() any time the number of data entries does not match\n        the header.\n\n        Note that this will *not* be called if the row already matches the header.\n\n        Parameters\n        ----------\n        str_vals : list\n            A list of value strings from the current row of the table.\n        ncols : int\n            The expected number of entries from the table header.\n\n        Returns\n        -------\n        str_vals : list\n            List of strings to be parsed into data entries in the output table. If\n            the length of this list does not match ``ncols``, an exception will be\n            raised in read().  Can also be None, in which case the row will be\n            skipped.\n        \"\"\"\n        # an empty list will always trigger an InconsistentTableError in read()\n        return str_vals\n\n    @property\n    def comment_lines(self):\n        \"\"\"Return lines in the table that match header.comment regexp\"\"\"\n        if not hasattr(self, 'lines'):\n            raise ValueError('Table must be read prior to accessing the header comment lines')\n        if self.header.comment:\n            re_comment = re.compile(self.header.comment)\n            comment_lines = [x for x in self.lines if re_comment.match(x)]\n        else:\n            comment_lines = []\n        return comment_lines\n\n    def update_table_data(self, table):\n        \"\"\"\n        Update table columns in place if needed.\n\n        This is a hook to allow updating the table columns after name\n        filtering but before setting up to write the data.  This is currently\n        only used by ECSV and is otherwise just a pass-through.\n\n        Parameters\n        ----------\n        table : `astropy.table.Table`\n            Input table for writing\n\n        Returns\n        -------\n        table : `astropy.table.Table`\n            Output table for writing\n        \"\"\"\n        return table\n\n    def write_header(self, lines, meta):\n        self.header.write_comments(lines, meta)\n        self.header.write(lines)\n\n    def write(self, table):\n        \"\"\"\n        Write ``table`` as list of strings.\n\n        Parameters\n        ----------\n        table : `~astropy.table.Table`\n            Input table data.\n\n        Returns\n        -------\n        lines : list\n            List of strings corresponding to ASCII table\n\n        \"\"\"\n\n        # Check column names before altering\n        self.header.cols = list(table.columns.values())\n        self.header.check_column_names(self.names, self.strict_names, False)\n\n        # In-place update of columns in input ``table`` to reflect column\n        # filtering.  Note that ``table`` is guaranteed to be a copy of the\n        # original user-supplied table.\n        _apply_include_exclude_names(table, self.names, self.include_names, self.exclude_names)\n\n        # This is a hook to allow updating the table columns after name\n        # filtering but before setting up to write the data.  This is currently\n        # only used by ECSV and is otherwise just a pass-through.\n        table = self.update_table_data(table)\n\n        # Check that table column dimensions are supported by this format class.\n        # Most formats support only 1-d columns, but some like ECSV support N-d.\n        self._check_multidim_table(table)\n\n        # Now use altered columns\n        new_cols = list(table.columns.values())\n        # link information about the columns to the writer object (i.e. self)\n        self.header.cols = new_cols\n        self.data.cols = new_cols\n        self.header.table_meta = table.meta\n\n        # Write header and data to lines list\n        lines = []\n        self.write_header(lines, table.meta)\n        self.data.write(lines)\n\n        return lines"},{"col":4,"comment":"null","endLoc":1275,"header":"def __init__(self)","id":4719,"name":"__init__","nodeType":"Function","startLoc":1260,"text":"def __init__(self):\n        self.header = self.header_class()\n        self.data = self.data_class()\n        self.inputter = self.inputter_class()\n        self.outputter = self.outputter_class()\n        # Data and Header instances benefit from a little cross-coupling.  Header may need to\n        # know about number of data columns for auto-column name generation and Data may\n        # need to know about header (e.g. for fixed-width tables where widths are spec'd in header.\n        self.data.header = self.header\n        self.header.data = self.data\n\n        # Metadata, consisting of table-level meta and column-level meta.  The latter\n        # could include information about column type, description, formatting, etc,\n        # depending on the table meta format.\n        self.meta = OrderedDict(table=OrderedDict(),\n                                cols=OrderedDict())"},{"col":4,"comment":"null","endLoc":155,"header":"@classmethod\n    def to_tree_transform(cls, data, ctx)","id":4720,"name":"to_tree_transform","nodeType":"Function","startLoc":150,"text":"@classmethod\n    def to_tree_transform(cls, data, ctx):\n        node = {}\n        if data.n_inputs != 1:\n            node['n_dims'] = data.n_inputs\n        return node"},{"col":4,"comment":"null","endLoc":163,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":4721,"name":"assert_equal","nodeType":"Function","startLoc":157,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        # TODO: If models become comparable themselves, remove this.\n        TransformType.assert_equal(a, b)\n        assert (isinstance(a, mappings.Identity) and\n                isinstance(b, mappings.Identity) and\n                a.n_inputs == b.n_inputs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":143,"id":4722,"name":"name","nodeType":"Attribute","startLoc":143,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":144,"id":4723,"name":"types","nodeType":"Attribute","startLoc":144,"text":"types"},{"className":"ConstantType","col":0,"comment":"null","endLoc":203,"id":4724,"nodeType":"Class","startLoc":166,"text":"class ConstantType(TransformType):\n    name = \"transform/constant\"\n    version = '1.4.0'\n    supported_versions = ['1.0.0', '1.1.0', '1.2.0', '1.3.0', '1.4.0']\n    types = ['astropy.modeling.functional_models.Const1D',\n             'astropy.modeling.functional_models.Const2D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        if cls.version < AsdfVersion('1.4.0'):\n            # The 'dimensions' property was added in 1.4.0,\n            # previously all values were 1D.\n            return functional_models.Const1D(node['value'])\n        elif node['dimensions'] == 1:\n            return functional_models.Const1D(node['value'])\n        elif node['dimensions'] == 2:\n            return functional_models.Const2D(node['value'])\n        else:\n            raise TypeError('Only 1D and 2D constant models are supported.')\n\n    @classmethod\n    def to_tree_transform(cls, data, ctx):\n        if cls.version < AsdfVersion('1.4.0'):\n            if not isinstance(data, functional_models.Const1D):\n                raise ValueError(\n                    f'constant-{cls.version} does not support models with > 1 dimension')\n            return {\n                'value': _parameter_to_value(data.amplitude)\n            }\n        else:\n            if isinstance(data, functional_models.Const1D):\n                dimension = 1\n            elif isinstance(data, functional_models.Const2D):\n                dimension = 2\n            return {\n                'value': _parameter_to_value(data.amplitude),\n                'dimensions': dimension\n            }"},{"col":4,"comment":"null","endLoc":184,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4725,"name":"from_tree_transform","nodeType":"Function","startLoc":173,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        if cls.version < AsdfVersion('1.4.0'):\n            # The 'dimensions' property was added in 1.4.0,\n            # previously all values were 1D.\n            return functional_models.Const1D(node['value'])\n        elif node['dimensions'] == 1:\n            return functional_models.Const1D(node['value'])\n        elif node['dimensions'] == 2:\n            return functional_models.Const2D(node['value'])\n        else:\n            raise TypeError('Only 1D and 2D constant models are supported.')"},{"col":4,"comment":"null","endLoc":646,"header":"def write_comments(self, lines, meta)","id":4726,"name":"write_comments","nodeType":"Function","startLoc":643,"text":"def write_comments(self, lines, meta):\n        if self.write_comment not in (False, None):\n            for comment in meta.get('comments', []):\n                lines.append(self.write_comment + comment)"},{"col":4,"comment":"\n        Override the builtin `dir` behavior to include representation\n        names.\n\n        TODO: dynamic representation transforms (i.e. include cylindrical et al.).\n        ","endLoc":1592,"header":"@override__dir__\n    def __dir__(self)","id":4727,"name":"__dir__","nodeType":"Function","startLoc":1581,"text":"@override__dir__\n    def __dir__(self):\n        \"\"\"\n        Override the builtin `dir` behavior to include representation\n        names.\n\n        TODO: dynamic representation transforms (i.e. include cylindrical et al.).\n        \"\"\"\n        dir_values = set(self.representation_component_names)\n        dir_values |= set(self.get_representation_component_names('s'))\n\n        return dir_values"},{"col":4,"comment":"null","endLoc":653,"header":"def write(self, lines)","id":4728,"name":"write","nodeType":"Function","startLoc":648,"text":"def write(self, lines):\n        if self.start_line is not None:\n            for i, spacer_line in zip(range(self.start_line),\n                                      itertools.cycle(self.write_spacer_lines)):\n                lines.append(spacer_line)\n            lines.append(self.splitter.join([x.info.name for x in self.cols]))"},{"col":4,"comment":"\n        Allow access to attributes on the representation and differential as\n        found via ``self.get_representation_component_names``.\n\n        TODO: We should handle dynamic representation transforms here (e.g.,\n        `.cylindrical`) instead of defining properties as below.\n        ","endLoc":1635,"header":"def __getattr__(self, attr)","id":4729,"name":"__getattr__","nodeType":"Function","startLoc":1594,"text":"def __getattr__(self, attr):\n        \"\"\"\n        Allow access to attributes on the representation and differential as\n        found via ``self.get_representation_component_names``.\n\n        TODO: We should handle dynamic representation transforms here (e.g.,\n        `.cylindrical`) instead of defining properties as below.\n        \"\"\"\n\n        # attr == '_representation' is likely from the hasattr() test in the\n        # representation property which is used for\n        # self.representation_component_names.\n        #\n        # Prevent infinite recursion here.\n        if attr.startswith('_'):\n            return self.__getattribute__(attr)  # Raise AttributeError.\n\n        repr_names = self.representation_component_names\n        if attr in repr_names:\n            if self._data is None:\n                self.data  # this raises the \"no data\" error by design - doing it\n                # this way means we don't have to replicate the error message here\n\n            rep = self.represent_as(self.representation_type,\n                                    in_frame_units=True)\n            val = getattr(rep, repr_names[attr])\n            return val\n\n        diff_names = self.get_representation_component_names('s')\n        if attr in diff_names:\n            if self._data is None:\n                self.data  # see above.\n            # TODO: this doesn't work for the case when there is only\n            # unitspherical information. The differential_type gets set to the\n            # default_differential, which expects full information, so the\n            # units don't work out\n            rep = self.represent_as(in_frame_units=True,\n                                    **self.get_representation_cls(None))\n            val = getattr(rep.differentials['s'], diff_names[attr])\n            return val\n\n        return self.__getattribute__(attr)  # Raise AttributeError."},{"col":0,"comment":"\n    Point with the given offset from the given point.\n\n    Parameters\n    ----------\n    lon, lat, posang, distance : `~astropy.coordinates.Angle`, `~astropy.units.Quantity` or float\n        Longitude and latitude of the starting point,\n        position angle and distance to the final point.\n        Quantities should be in angular units; floats in radians.\n        Polar points at lat= +/-90 are treated as limit of +/-(90-epsilon) and same lon.\n\n    Returns\n    -------\n    lon, lat : `~astropy.coordinates.Angle`\n        The position of the final point.  If any of the angles are arrays,\n        these will contain arrays following the appropriate `numpy` broadcasting rules.\n        0 <= lon < 2pi.\n\n    Notes\n    -----\n    ","endLoc":157,"header":"def offset_by(lon, lat, posang, distance)","id":4730,"name":"offset_by","nodeType":"Function","startLoc":91,"text":"def offset_by(lon, lat, posang, distance):\n    \"\"\"\n    Point with the given offset from the given point.\n\n    Parameters\n    ----------\n    lon, lat, posang, distance : `~astropy.coordinates.Angle`, `~astropy.units.Quantity` or float\n        Longitude and latitude of the starting point,\n        position angle and distance to the final point.\n        Quantities should be in angular units; floats in radians.\n        Polar points at lat= +/-90 are treated as limit of +/-(90-epsilon) and same lon.\n\n    Returns\n    -------\n    lon, lat : `~astropy.coordinates.Angle`\n        The position of the final point.  If any of the angles are arrays,\n        these will contain arrays following the appropriate `numpy` broadcasting rules.\n        0 <= lon < 2pi.\n\n    Notes\n    -----\n    \"\"\"\n    from .angles import Angle\n\n    # Calculations are done using the spherical trigonometry sine and cosine rules\n    # of the triangle A at North Pole,   B at starting point,   C at final point\n    # with angles     A (change in lon), B (posang),            C (not used, but negative reciprocal posang)\n    # with sides      a (distance),      b (final co-latitude), c (starting colatitude)\n    # B, a, c are knowns; A and b are unknowns\n    # https://en.wikipedia.org/wiki/Spherical_trigonometry\n\n    cos_a = np.cos(distance)\n    sin_a = np.sin(distance)\n    cos_c = np.sin(lat)\n    sin_c = np.cos(lat)\n    cos_B = np.cos(posang)\n    sin_B = np.sin(posang)\n\n    # cosine rule: Know two sides: a,c and included angle: B; get unknown side b\n    cos_b = cos_c * cos_a + sin_c * sin_a * cos_B\n    # sin_b = np.sqrt(1 - cos_b**2)\n    # sine rule and cosine rule for A (using both lets arctan2 pick quadrant).\n    # multiplying both sin_A and cos_A by x=sin_b * sin_c prevents /0 errors\n    # at poles.  Correct for the x=0 multiplication a few lines down.\n    # sin_A/sin_a == sin_B/sin_b    # Sine rule\n    xsin_A = sin_a * sin_B * sin_c\n    # cos_a == cos_b * cos_c + sin_b * sin_c * cos_A  # cosine rule\n    xcos_A = cos_a - cos_b * cos_c\n\n    A = Angle(np.arctan2(xsin_A, xcos_A), u.radian)\n    # Treat the poles as if they are infinitesimally far from pole but at given lon\n    small_sin_c = sin_c < 1e-12\n    if small_sin_c.any():\n        # For south pole (cos_c = -1), A = posang; for North pole, A=180 deg - posang\n        A_pole = (90*u.deg + cos_c*(90*u.deg-Angle(posang, u.radian))).to(u.rad)\n        if A.shape:\n            # broadcast to ensure the shape is like that of A, which is also\n            # affected by the (possible) shapes of lat, posang, and distance.\n            small_sin_c = np.broadcast_to(small_sin_c, A.shape)\n            A[small_sin_c] = A_pole[small_sin_c]\n        else:\n            A = A_pole\n\n    outlon = (Angle(lon, u.radian) + A).wrap_at(360.0*u.deg).to(u.deg)\n    outlat = Angle(np.arcsin(cos_b), u.radian).to(u.deg)\n\n    return outlon, outlat"},{"attributeType":"null","col":4,"comment":"null","endLoc":1114,"id":4731,"name":"default_converters","nodeType":"Attribute","startLoc":1114,"text":"default_converters"},{"col":4,"comment":"\n        Process the data in multidimensional columns.\n        ","endLoc":171,"header":"def __call__(self, cols, meta)","id":4732,"name":"__call__","nodeType":"Function","startLoc":151,"text":"def __call__(self, cols, meta):\n        \"\"\"\n        Process the data in multidimensional columns.\n        \"\"\"\n        new_cols = []\n        col_num = 0\n\n        while col_num < len(cols):\n            col = cols[col_num]\n            if hasattr(col, 'colspan'):\n                # Join elements of spanned columns together into list of tuples\n                span_cols = cols[col_num:col_num + col.colspan]\n                new_col = core.Column(col.name)\n                new_col.str_vals = list(zip(*[x.str_vals for x in span_cols]))\n                new_cols.append(new_col)\n                col_num += col.colspan\n            else:\n                new_cols.append(col)\n                col_num += 1\n\n        return super().__call__(new_cols, meta)"},{"col":4,"comment":"Return the column names of the table","endLoc":659,"header":"@property\n    def colnames(self)","id":4733,"name":"colnames","nodeType":"Function","startLoc":655,"text":"@property\n    def colnames(self):\n        \"\"\"Return the column names of the table\"\"\"\n        return tuple(col.name if isinstance(col, Column) else col.info.name\n                     for col in self.cols)"},{"col":4,"comment":"null","endLoc":1649,"header":"def __setattr__(self, attr, value)","id":4734,"name":"__setattr__","nodeType":"Function","startLoc":1637,"text":"def __setattr__(self, attr, value):\n        # Don't slow down access of private attributes!\n        if not attr.startswith('_'):\n            if hasattr(self, 'representation_info'):\n                repr_attr_names = set()\n                for representation_attr in self.representation_info.values():\n                    repr_attr_names.update(representation_attr['names'])\n\n                if attr in repr_attr_names:\n                    raise AttributeError(\n                        f'Cannot set any frame attribute {attr}')\n\n        super().__setattr__(attr, value)"},{"col":4,"comment":"Check that the dimensions of columns in ``table`` are acceptable.\n\n        The reader class attribute ``max_ndim`` defines the maximum dimension of\n        columns that can be written using this format. The base value is ``1``,\n        corresponding to normal scalar columns with just a length.\n\n        Parameters\n        ----------\n        table : `~astropy.table.Table`\n            Input table.\n\n        Raises\n        ------\n        ValueError\n            If any column exceeds the number of allowed dimensions\n        ","endLoc":1294,"header":"def _check_multidim_table(self, table)","id":4735,"name":"_check_multidim_table","nodeType":"Function","startLoc":1277,"text":"def _check_multidim_table(self, table):\n        \"\"\"Check that the dimensions of columns in ``table`` are acceptable.\n\n        The reader class attribute ``max_ndim`` defines the maximum dimension of\n        columns that can be written using this format. The base value is ``1``,\n        corresponding to normal scalar columns with just a length.\n\n        Parameters\n        ----------\n        table : `~astropy.table.Table`\n            Input table.\n\n        Raises\n        ------\n        ValueError\n            If any column exceeds the number of allowed dimensions\n        \"\"\"\n        _check_multidim_table(table, self.max_ndim)"},{"attributeType":"null","col":4,"comment":"null","endLoc":147,"id":4736,"name":"default_converters","nodeType":"Attribute","startLoc":147,"text":"default_converters"},{"col":0,"comment":"Check that ``table`` has only columns with ndim <= ``max_ndim``\n\n    Currently ECSV is the only built-in format that supports output of arbitrary\n    N-d columns, but HTML supports 2-d.\n    ","endLoc":58,"header":"def _check_multidim_table(table, max_ndim)","id":4737,"name":"_check_multidim_table","nodeType":"Function","startLoc":43,"text":"def _check_multidim_table(table, max_ndim):\n    \"\"\"Check that ``table`` has only columns with ndim <= ``max_ndim``\n\n    Currently ECSV is the only built-in format that supports output of arbitrary\n    N-d columns, but HTML supports 2-d.\n    \"\"\"\n    # No limit?\n    if max_ndim is None:\n        return\n\n    # Check for N-d columns\n    nd_names = [col.info.name for col in table.itercols() if len(col.shape) > max_ndim]\n    if nd_names:\n        raise ValueError(f'column(s) with dimension > {max_ndim} '\n                         \"cannot be be written with this format, try using 'ecsv' \"\n                         \"(Enhanced CSV) format\")"},{"className":"HTMLHeader","col":0,"comment":"null","endLoc":212,"id":4738,"nodeType":"Class","startLoc":174,"text":"class HTMLHeader(core.BaseHeader):\n    splitter_class = HTMLSplitter\n\n    def start_line(self, lines):\n        \"\"\"\n        Return the line number at which header data begins.\n        \"\"\"\n\n        for i, line in enumerate(lines):\n            if not isinstance(line, SoupString):\n                raise TypeError('HTML lines should be of type SoupString')\n            soup = line.soup\n            if soup.th is not None:\n                return i\n\n        return None\n\n    def _set_cols_from_names(self):\n        \"\"\"\n        Set columns from header names, handling multicolumns appropriately.\n        \"\"\"\n        self.cols = []\n        new_names = []\n\n        for name in self.names:\n            if isinstance(name, tuple):\n                col = core.Column(name=name[0])\n                col.colspan = int(name[1])\n                self.cols.append(col)\n                new_names.append(name[0])\n                for i in range(1, int(name[1])):\n                    # Add dummy columns\n                    self.cols.append(core.Column(''))\n                    new_names.append('')\n            else:\n                self.cols.append(core.Column(name=name))\n                new_names.append(name)\n\n        self.names = new_names"},{"col":4,"comment":"\n        Return the line number at which header data begins.\n        ","endLoc":189,"header":"def start_line(self, lines)","id":4739,"name":"start_line","nodeType":"Function","startLoc":177,"text":"def start_line(self, lines):\n        \"\"\"\n        Return the line number at which header data begins.\n        \"\"\"\n\n        for i, line in enumerate(lines):\n            if not isinstance(line, SoupString):\n                raise TypeError('HTML lines should be of type SoupString')\n            soup = line.soup\n            if soup.th is not None:\n                return i\n\n        return None"},{"col":4,"comment":"Read the ``table`` and return the results in a format determined by\n        the ``outputter`` attribute.\n\n        The ``table`` parameter is any string or object that can be processed\n        by the instance ``inputter``.  For the base Inputter class ``table`` can be\n        one of:\n\n        * File name\n        * File-like object\n        * String (newline separated) with all header and data lines (must have at least 2 lines)\n        * List of strings\n\n        Parameters\n        ----------\n        table : str, file-like, list\n            Input table.\n\n        Returns\n        -------\n        table : `~astropy.table.Table`\n            Output table\n\n        ","endLoc":1388,"header":"def read(self, table)","id":4740,"name":"read","nodeType":"Function","startLoc":1296,"text":"def read(self, table):\n        \"\"\"Read the ``table`` and return the results in a format determined by\n        the ``outputter`` attribute.\n\n        The ``table`` parameter is any string or object that can be processed\n        by the instance ``inputter``.  For the base Inputter class ``table`` can be\n        one of:\n\n        * File name\n        * File-like object\n        * String (newline separated) with all header and data lines (must have at least 2 lines)\n        * List of strings\n\n        Parameters\n        ----------\n        table : str, file-like, list\n            Input table.\n\n        Returns\n        -------\n        table : `~astropy.table.Table`\n            Output table\n\n        \"\"\"\n        # If ``table`` is a file then store the name in the ``data``\n        # attribute. The ``table`` is a \"file\" if it is a string\n        # without the new line specific to the OS.\n        with suppress(TypeError):\n            # Strings only\n            if os.linesep not in table + '':\n                self.data.table_name = os.path.basename(table)\n\n        # If one of the newline chars is set as field delimiter, only\n        # accept the other one as line splitter\n        if self.header.splitter.delimiter == '\\n':\n            newline = '\\r'\n        elif self.header.splitter.delimiter == '\\r':\n            newline = '\\n'\n        else:\n            newline = None\n\n        # Get a list of the lines (rows) in the table\n        self.lines = self.inputter.get_lines(table, newline=newline)\n\n        # Set self.data.data_lines to a slice of lines contain the data rows\n        self.data.get_data_lines(self.lines)\n\n        # Extract table meta values (e.g. keywords, comments, etc).  Updates self.meta.\n        self.header.update_meta(self.lines, self.meta)\n\n        # Get the table column definitions\n        self.header.get_cols(self.lines)\n\n        # Make sure columns are valid\n        self.header.check_column_names(self.names, self.strict_names, self.guessing)\n\n        self.cols = cols = self.header.cols\n        self.data.splitter.cols = cols\n        n_cols = len(cols)\n\n        for i, str_vals in enumerate(self.data.get_str_vals()):\n            if len(str_vals) != n_cols:\n                str_vals = self.inconsistent_handler(str_vals, n_cols)\n\n                # if str_vals is None, we skip this row\n                if str_vals is None:\n                    continue\n\n                # otherwise, we raise an error only if it is still inconsistent\n                if len(str_vals) != n_cols:\n                    errmsg = ('Number of header columns ({}) inconsistent with'\n                              ' data columns ({}) at data line {}\\n'\n                              'Header values: {}\\n'\n                              'Data values: {}'.format(\n                                  n_cols, len(str_vals), i,\n                                  [x.name for x in cols], str_vals))\n\n                    raise InconsistentTableError(errmsg)\n\n            for j, col in enumerate(cols):\n                col.str_vals.append(str_vals[j])\n\n        self.data.masks(cols)\n        if hasattr(self.header, 'table_meta'):\n            self.meta['table'].update(self.header.table_meta)\n\n        _apply_include_exclude_names(self.header, self.names,\n                                     self.include_names, self.exclude_names)\n\n        table = self.outputter(self.header.cols, self.meta)\n        self.cols = self.header.cols\n\n        return table"},{"col":4,"comment":"\n        Set columns from header names, handling multicolumns appropriately.\n        ","endLoc":212,"header":"def _set_cols_from_names(self)","id":4741,"name":"_set_cols_from_names","nodeType":"Function","startLoc":191,"text":"def _set_cols_from_names(self):\n        \"\"\"\n        Set columns from header names, handling multicolumns appropriately.\n        \"\"\"\n        self.cols = []\n        new_names = []\n\n        for name in self.names:\n            if isinstance(name, tuple):\n                col = core.Column(name=name[0])\n                col.colspan = int(name[1])\n                self.cols.append(col)\n                new_names.append(name[0])\n                for i in range(1, int(name[1])):\n                    # Add dummy columns\n                    self.cols.append(core.Column(''))\n                    new_names.append('')\n            else:\n                self.cols.append(core.Column(name=name))\n                new_names.append(name)\n\n        self.names = new_names"},{"col":4,"comment":"null","endLoc":203,"header":"@classmethod\n    def to_tree_transform(cls, data, ctx)","id":4742,"name":"to_tree_transform","nodeType":"Function","startLoc":186,"text":"@classmethod\n    def to_tree_transform(cls, data, ctx):\n        if cls.version < AsdfVersion('1.4.0'):\n            if not isinstance(data, functional_models.Const1D):\n                raise ValueError(\n                    f'constant-{cls.version} does not support models with > 1 dimension')\n            return {\n                'value': _parameter_to_value(data.amplitude)\n            }\n        else:\n            if isinstance(data, functional_models.Const1D):\n                dimension = 1\n            elif isinstance(data, functional_models.Const2D):\n                dimension = 2\n            return {\n                'value': _parameter_to_value(data.amplitude),\n                'dimensions': dimension\n            }"},{"col":4,"comment":"Equality operator for frame.\n\n        This implements strict equality and requires that the frames are\n        equivalent and that the representation data are exactly equal.\n        ","endLoc":1673,"header":"def __eq__(self, value)","id":4743,"name":"__eq__","nodeType":"Function","startLoc":1651,"text":"def __eq__(self, value):\n        \"\"\"Equality operator for frame.\n\n        This implements strict equality and requires that the frames are\n        equivalent and that the representation data are exactly equal.\n        \"\"\"\n        is_equiv = self.is_equivalent_frame(value)\n\n        if self._data is None and value._data is None:\n            # For Frame with no data, == compare is same as is_equivalent_frame()\n            return is_equiv\n\n        if not is_equiv:\n            raise TypeError(f'cannot compare: objects must have equivalent frames: '\n                            f'{self.replicate_without_data()} vs. '\n                            f'{value.replicate_without_data()}')\n\n        if ((value._data is None and self._data is not None)\n                or (self._data is None and value._data is not None)):\n            raise ValueError('cannot compare: one frame has data and the other '\n                             'does not')\n\n        return self._data == value._data"},{"attributeType":"null","col":4,"comment":"null","endLoc":167,"id":4744,"name":"name","nodeType":"Attribute","startLoc":167,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":168,"id":4745,"name":"version","nodeType":"Attribute","startLoc":168,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":169,"id":4746,"name":"supported_versions","nodeType":"Attribute","startLoc":169,"text":"supported_versions"},{"attributeType":"null","col":4,"comment":"null","endLoc":170,"id":4747,"name":"types","nodeType":"Attribute","startLoc":170,"text":"types"},{"className":"GenericModel","col":0,"comment":"null","endLoc":216,"id":4748,"nodeType":"Class","startLoc":206,"text":"class GenericModel(mappings.Mapping):\n\n    def __init__(self, n_inputs, n_outputs):\n        mapping = tuple(range(n_inputs))\n        super().__init__(mapping)\n        self._n_outputs = n_outputs\n        self._outputs = tuple('x' + str(idx) for idx in range(n_outputs))\n\n    @property\n    def inverse(self):\n        raise NotImplementedError()"},{"col":4,"comment":"null","endLoc":212,"header":"def __init__(self, n_inputs, n_outputs)","id":4749,"name":"__init__","nodeType":"Function","startLoc":208,"text":"def __init__(self, n_inputs, n_outputs):\n        mapping = tuple(range(n_inputs))\n        super().__init__(mapping)\n        self._n_outputs = n_outputs\n        self._outputs = tuple('x' + str(idx) for idx in range(n_outputs))"},{"col":4,"comment":"\n        Remove several columns from the table.\n\n        Parameters\n        ----------\n        names : list\n            A list containing the names of the columns to remove\n        ","endLoc":675,"header":"def remove_columns(self, names)","id":4750,"name":"remove_columns","nodeType":"Function","startLoc":661,"text":"def remove_columns(self, names):\n        \"\"\"\n        Remove several columns from the table.\n\n        Parameters\n        ----------\n        names : list\n            A list containing the names of the columns to remove\n        \"\"\"\n        colnames = self.colnames\n        for name in names:\n            if name not in colnames:\n                raise KeyError(f\"Column {name} does not exist\")\n\n        self.cols = [col for col in self.cols if col.name not in names]"},{"col":4,"comment":"null","endLoc":1676,"header":"def __ne__(self, value)","id":4751,"name":"__ne__","nodeType":"Function","startLoc":1675,"text":"def __ne__(self, value):\n        return np.logical_not(self == value)"},{"col":4,"comment":"\n        Rename a column.\n\n        Parameters\n        ----------\n        name : str\n            The current name of the column.\n        new_name : str\n            The new name for the column\n        ","endLoc":701,"header":"def rename_column(self, name, new_name)","id":4752,"name":"rename_column","nodeType":"Function","startLoc":677,"text":"def rename_column(self, name, new_name):\n        \"\"\"\n        Rename a column.\n\n        Parameters\n        ----------\n        name : str\n            The current name of the column.\n        new_name : str\n            The new name for the column\n        \"\"\"\n        try:\n            idx = self.colnames.index(name)\n        except ValueError:\n            raise KeyError(f\"Column {name} does not exist\")\n\n        col = self.cols[idx]\n\n        # For writing self.cols can contain cols that are not Column.  Raise\n        # exception in that case.\n        if isinstance(col, Column):\n            col.name = new_name\n        else:\n            raise TypeError(f'got column type {type(col)} instead of required '\n                            f'{Column}')"},{"col":4,"comment":"\n        Computes on-sky separation between this coordinate and another.\n\n        .. note::\n\n            If the ``other`` coordinate object is in a different frame, it is\n            first transformed to the frame of this object. This can lead to\n            unintuitive behavior if not accounted for. Particularly of note is\n            that ``self.separation(other)`` and ``other.separation(self)`` may\n            not give the same answer in this case.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate to get the separation to.\n\n        Returns\n        -------\n        sep : `~astropy.coordinates.Angle`\n            The on-sky separation between this and the ``other`` coordinate.\n\n        Notes\n        -----\n        The separation is calculated using the Vincenty formula, which\n        is stable at all locations, including poles and antipodes [1]_.\n\n        .. [1] https://en.wikipedia.org/wiki/Great-circle_distance\n\n        ","endLoc":1718,"header":"def separation(self, other)","id":4753,"name":"separation","nodeType":"Function","startLoc":1678,"text":"def separation(self, other):\n        \"\"\"\n        Computes on-sky separation between this coordinate and another.\n\n        .. note::\n\n            If the ``other`` coordinate object is in a different frame, it is\n            first transformed to the frame of this object. This can lead to\n            unintuitive behavior if not accounted for. Particularly of note is\n            that ``self.separation(other)`` and ``other.separation(self)`` may\n            not give the same answer in this case.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate to get the separation to.\n\n        Returns\n        -------\n        sep : `~astropy.coordinates.Angle`\n            The on-sky separation between this and the ``other`` coordinate.\n\n        Notes\n        -----\n        The separation is calculated using the Vincenty formula, which\n        is stable at all locations, including poles and antipodes [1]_.\n\n        .. [1] https://en.wikipedia.org/wiki/Great-circle_distance\n\n        \"\"\"\n        from .angle_utilities import angular_separation\n        from .angles import Angle\n\n        self_unit_sph = self.represent_as(r.UnitSphericalRepresentation)\n        other_transformed = other.transform_to(self)\n        other_unit_sph = other_transformed.represent_as(r.UnitSphericalRepresentation)\n\n        # Get the separation as a Quantity, convert to Angle in degrees\n        sep = angular_separation(self_unit_sph.lon, self_unit_sph.lat,\n                                 other_unit_sph.lon, other_unit_sph.lat)\n        return Angle(sep, unit=u.degree)"},{"col":4,"comment":"null","endLoc":216,"header":"@property\n    def inverse(self)","id":4754,"name":"inverse","nodeType":"Function","startLoc":214,"text":"@property\n    def inverse(self):\n        raise NotImplementedError()"},{"attributeType":"null","col":8,"comment":"null","endLoc":212,"id":4755,"name":"_outputs","nodeType":"Attribute","startLoc":212,"text":"self._outputs"},{"attributeType":"null","col":8,"comment":"null","endLoc":211,"id":4756,"name":"_n_outputs","nodeType":"Attribute","startLoc":211,"text":"self._n_outputs"},{"col":4,"comment":"null","endLoc":704,"header":"def get_type_map_key(self, col)","id":4757,"name":"get_type_map_key","nodeType":"Function","startLoc":703,"text":"def get_type_map_key(self, col):\n        return col.raw_type"},{"col":4,"comment":"null","endLoc":712,"header":"def get_col_type(self, col)","id":4758,"name":"get_col_type","nodeType":"Function","startLoc":706,"text":"def get_col_type(self, col):\n        try:\n            type_map_key = self.get_type_map_key(col)\n            return self.col_type_map[type_map_key.lower()]\n        except KeyError:\n            raise ValueError('Unknown data type \"\"{}\"\" for column \"{}\"'.format(\n                col.raw_type, col.name))"},{"col":4,"comment":"\n        Adjust or skip data entries if a row is inconsistent with the header.\n\n        The default implementation does no adjustment, and hence will always trigger\n        an exception in read() any time the number of data entries does not match\n        the header.\n\n        Note that this will *not* be called if the row already matches the header.\n\n        Parameters\n        ----------\n        str_vals : list\n            A list of value strings from the current row of the table.\n        ncols : int\n            The expected number of entries from the table header.\n\n        Returns\n        -------\n        str_vals : list\n            List of strings to be parsed into data entries in the output table. If\n            the length of this list does not match ``ncols``, an exception will be\n            raised in read().  Can also be None, in which case the row will be\n            skipped.\n        ","endLoc":1416,"header":"def inconsistent_handler(self, str_vals, ncols)","id":4759,"name":"inconsistent_handler","nodeType":"Function","startLoc":1390,"text":"def inconsistent_handler(self, str_vals, ncols):\n        \"\"\"\n        Adjust or skip data entries if a row is inconsistent with the header.\n\n        The default implementation does no adjustment, and hence will always trigger\n        an exception in read() any time the number of data entries does not match\n        the header.\n\n        Note that this will *not* be called if the row already matches the header.\n\n        Parameters\n        ----------\n        str_vals : list\n            A list of value strings from the current row of the table.\n        ncols : int\n            The expected number of entries from the table header.\n\n        Returns\n        -------\n        str_vals : list\n            List of strings to be parsed into data entries in the output table. If\n            the length of this list does not match ``ncols``, an exception will be\n            raised in read().  Can also be None, in which case the row will be\n            skipped.\n        \"\"\"\n        # an empty list will always trigger an InconsistentTableError in read()\n        return str_vals"},{"col":4,"comment":"\n        Check column names.\n\n        This must be done before applying the names transformation\n        so that guessing will fail appropriately if ``names`` is supplied.\n        For instance if the basic reader is given a table with no column header\n        row.\n\n        Parameters\n        ----------\n        names : list\n            User-supplied list of column names\n        strict_names : bool\n            Whether to impose extra requirements on names\n        guessing : bool\n            True if this method is being called while guessing the table format\n        ","endLoc":749,"header":"def check_column_names(self, names, strict_names, guessing)","id":4760,"name":"check_column_names","nodeType":"Function","startLoc":714,"text":"def check_column_names(self, names, strict_names, guessing):\n        \"\"\"\n        Check column names.\n\n        This must be done before applying the names transformation\n        so that guessing will fail appropriately if ``names`` is supplied.\n        For instance if the basic reader is given a table with no column header\n        row.\n\n        Parameters\n        ----------\n        names : list\n            User-supplied list of column names\n        strict_names : bool\n            Whether to impose extra requirements on names\n        guessing : bool\n            True if this method is being called while guessing the table format\n        \"\"\"\n        if strict_names:\n            # Impose strict requirements on column names (normally used in guessing)\n            bads = [\" \", \",\", \"|\", \"\\t\", \"'\", '\"']\n            for name in self.colnames:\n                if (_is_number(name) or len(name) == 0\n                        or name[0] in bads or name[-1] in bads):\n                    raise InconsistentTableError(\n                        f'Column name {name!r} does not meet strict name requirements')\n        # When guessing require at least two columns, except for ECSV which can\n        # reliably be guessed from the header requirements.\n        if guessing and len(self.colnames) <= 1 and self.__class__.__name__ != 'EcsvHeader':\n            raise ValueError('Table format guessing requires at least two columns, got {}'\n                             .format(list(self.colnames)))\n\n        if names is not None and len(names) != len(self.colnames):\n            raise InconsistentTableError(\n                'Length of names argument ({}) does not match number'\n                ' of table columns ({})'.format(len(names), len(self.colnames)))"},{"col":0,"comment":"null","endLoc":1179,"header":"def _is_number(x)","id":4761,"name":"_is_number","nodeType":"Function","startLoc":1175,"text":"def _is_number(x):\n    with suppress(ValueError):\n        x = float(x)\n        return True\n    return False"},{"col":4,"comment":"\n        Computes three dimensional separation between this coordinate\n        and another.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate system to get the distance to.\n\n        Returns\n        -------\n        sep : `~astropy.coordinates.Distance`\n            The real-space distance between these two coordinates.\n\n        Raises\n        ------\n        ValueError\n            If this or the other coordinate do not have distances.\n        ","endLoc":1762,"header":"def separation_3d(self, other)","id":4762,"name":"separation_3d","nodeType":"Function","startLoc":1720,"text":"def separation_3d(self, other):\n        \"\"\"\n        Computes three dimensional separation between this coordinate\n        and another.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate system to get the distance to.\n\n        Returns\n        -------\n        sep : `~astropy.coordinates.Distance`\n            The real-space distance between these two coordinates.\n\n        Raises\n        ------\n        ValueError\n            If this or the other coordinate do not have distances.\n        \"\"\"\n\n        from .distances import Distance\n\n        if issubclass(self.data.__class__, r.UnitSphericalRepresentation):\n            raise ValueError('This object does not have a distance; cannot '\n                             'compute 3d separation.')\n\n        # do this first just in case the conversion somehow creates a distance\n        other_in_self_system = other.transform_to(self)\n\n        if issubclass(other_in_self_system.__class__, r.UnitSphericalRepresentation):\n            raise ValueError('The other object does not have a distance; '\n                             'cannot compute 3d separation.')\n\n        # drop the differentials to ensure they don't do anything odd in the\n        # subtraction\n        self_car = self.data.without_differentials().represent_as(r.CartesianRepresentation)\n        other_car = other_in_self_system.data.without_differentials().represent_as(r.CartesianRepresentation)\n        dist = (self_car - other_car).norm()\n        if dist.unit == u.one:\n            return dist\n        else:\n            return Distance(dist)"},{"className":"GenericType","col":0,"comment":"null","endLoc":233,"id":4763,"nodeType":"Class","startLoc":219,"text":"class GenericType(TransformType):\n    name = \"transform/generic\"\n    types = [GenericModel]\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return GenericModel(\n            node['n_inputs'], node['n_outputs'])\n\n    @classmethod\n    def to_tree_transform(cls, data, ctx):\n        return {\n            'n_inputs': data.n_inputs,\n            'n_outputs': data.n_outputs\n        }"},{"col":4,"comment":"null","endLoc":226,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":4764,"name":"from_tree_transform","nodeType":"Function","startLoc":223,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return GenericModel(\n            node['n_inputs'], node['n_outputs'])"},{"col":0,"comment":"\n    Apply names, include_names and exclude_names to a table or BaseHeader.\n\n    For the latter this relies on BaseHeader implementing ``colnames``,\n    ``rename_column``, and ``remove_columns``.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`, `~astropy.io.ascii.BaseHeader`\n        Input table or BaseHeader subclass instance\n    names : list\n        List of names to override those in table (set to None to use existing names)\n    include_names : list\n        List of names to include in output\n    exclude_names : list\n        List of names to exclude from output (applied after ``include_names``)\n\n    ","endLoc":1227,"header":"def _apply_include_exclude_names(table, names, include_names, exclude_names)","id":4765,"name":"_apply_include_exclude_names","nodeType":"Function","startLoc":1182,"text":"def _apply_include_exclude_names(table, names, include_names, exclude_names):\n    \"\"\"\n    Apply names, include_names and exclude_names to a table or BaseHeader.\n\n    For the latter this relies on BaseHeader implementing ``colnames``,\n    ``rename_column``, and ``remove_columns``.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`, `~astropy.io.ascii.BaseHeader`\n        Input table or BaseHeader subclass instance\n    names : list\n        List of names to override those in table (set to None to use existing names)\n    include_names : list\n        List of names to include in output\n    exclude_names : list\n        List of names to exclude from output (applied after ``include_names``)\n\n    \"\"\"\n    def rename_columns(table, names):\n        # Rename table column names to those passed by user\n        # Temporarily rename with names that are not in `names` or `table.colnames`.\n        # This ensures that rename succeeds regardless of existing names.\n        xxxs = 'x' * max(len(name) for name in list(names) + list(table.colnames))\n        for ii, colname in enumerate(table.colnames):\n            table.rename_column(colname, xxxs + str(ii))\n\n        for ii, name in enumerate(names):\n            table.rename_column(xxxs + str(ii), name)\n\n    if names is not None:\n        rename_columns(table, names)\n    else:\n        colnames_uniq = _deduplicate_names(table.colnames)\n        if colnames_uniq != list(table.colnames):\n            rename_columns(table, colnames_uniq)\n\n    names_set = set(table.colnames)\n\n    if include_names is not None:\n        names_set.intersection_update(include_names)\n    if exclude_names is not None:\n        names_set.difference_update(exclude_names)\n    if names_set != set(table.colnames):\n        remove_names = set(table.colnames) - names_set\n        table.remove_columns(remove_names)"},{"attributeType":"null","col":4,"comment":" format string for auto-generating column names ","endLoc":563,"id":4766,"name":"auto_format","nodeType":"Attribute","startLoc":563,"text":"auto_format"},{"attributeType":"null","col":4,"comment":" None, int, or a function of ``lines`` that returns None or int ","endLoc":565,"id":4767,"name":"start_line","nodeType":"Attribute","startLoc":565,"text":"start_line"},{"attributeType":"null","col":4,"comment":" regular expression for comment lines ","endLoc":567,"id":4768,"name":"comment","nodeType":"Attribute","startLoc":567,"text":"comment"},{"attributeType":"null","col":4,"comment":" Splitter class for splitting data lines into columns ","endLoc":569,"id":4769,"name":"splitter_class","nodeType":"Attribute","startLoc":569,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":" list of names corresponding to each data column ","endLoc":571,"id":4770,"name":"names","nodeType":"Attribute","startLoc":571,"text":"names"},{"attributeType":"null","col":4,"comment":"null","endLoc":573,"id":4771,"name":"write_comment","nodeType":"Attribute","startLoc":573,"text":"write_comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":574,"id":4772,"name":"write_spacer_lines","nodeType":"Attribute","startLoc":574,"text":"write_spacer_lines"},{"attributeType":"null","col":12,"comment":"null","endLoc":621,"id":4773,"name":"names","nodeType":"Attribute","startLoc":621,"text":"self.names"},{"attributeType":"null","col":8,"comment":"null","endLoc":577,"id":4774,"name":"splitter","nodeType":"Attribute","startLoc":577,"text":"self.splitter"},{"attributeType":"null","col":8,"comment":"null","endLoc":580,"id":4775,"name":"cols","nodeType":"Attribute","startLoc":580,"text":"self.cols"},{"attributeType":"null","col":4,"comment":"null","endLoc":25,"id":4776,"name":"start_line","nodeType":"Attribute","startLoc":25,"text":"start_line"},{"col":4,"comment":"null","endLoc":233,"header":"@classmethod\n    def to_tree_transform(cls, data, ctx)","id":4777,"name":"to_tree_transform","nodeType":"Function","startLoc":228,"text":"@classmethod\n    def to_tree_transform(cls, data, ctx):\n        return {\n            'n_inputs': data.n_inputs,\n            'n_outputs': data.n_outputs\n        }"},{"attributeType":"null","col":4,"comment":"null","endLoc":220,"id":4778,"name":"name","nodeType":"Attribute","startLoc":220,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":221,"id":4779,"name":"types","nodeType":"Attribute","startLoc":221,"text":"types"},{"className":"UnitsMappingType","col":0,"comment":"null","endLoc":294,"id":4780,"nodeType":"Class","startLoc":236,"text":"class UnitsMappingType(AstropyType):\n    name = \"transform/units_mapping\"\n    version = \"1.0.0\"\n    types = [mappings.UnitsMapping]\n\n    @classmethod\n    def to_tree(cls, node, ctx):\n        tree = {}\n\n        if node.name is not None:\n            tree[\"name\"] = node.name\n\n        inputs = []\n        outputs = []\n        for i, o, m in zip(node.inputs, node.outputs, node.mapping):\n            input = {\n                \"name\": i,\n                \"allow_dimensionless\": node.input_units_allow_dimensionless[i],\n            }\n            if m[0] is not None:\n                input[\"unit\"] = m[0]\n            if node.input_units_equivalencies is not None and i in node.input_units_equivalencies:\n                input[\"equivalencies\"] = node.input_units_equivalencies[i]\n            inputs.append(input)\n\n            output = {\n                \"name\": o,\n            }\n            if m[-1] is not None:\n                output[\"unit\"] = m[-1]\n            outputs.append(output)\n\n        tree[\"unit_inputs\"] = inputs\n        tree[\"unit_outputs\"] = outputs\n\n        return tree\n\n    @classmethod\n    def from_tree(cls, tree, ctx):\n        mapping = tuple((i.get(\"unit\"), o.get(\"unit\"))\n                        for i, o in zip(tree[\"unit_inputs\"], tree[\"unit_outputs\"]))\n\n        equivalencies = None\n        for i in tree[\"unit_inputs\"]:\n            if \"equivalencies\" in i:\n                if equivalencies is None:\n                    equivalencies = {}\n                equivalencies[i[\"name\"]] = i[\"equivalencies\"]\n\n        kwargs = {\n            \"input_units_equivalencies\": equivalencies,\n            \"input_units_allow_dimensionless\": {\n                i[\"name\"]: i.get(\"allow_dimensionless\", False) for i in tree[\"unit_inputs\"]},\n        }\n\n        if \"name\" in tree:\n            kwargs[\"name\"] = tree[\"name\"]\n\n        return mappings.UnitsMapping(mapping, **kwargs)"},{"col":4,"comment":"null","endLoc":271,"header":"@classmethod\n    def to_tree(cls, node, ctx)","id":4781,"name":"to_tree","nodeType":"Function","startLoc":241,"text":"@classmethod\n    def to_tree(cls, node, ctx):\n        tree = {}\n\n        if node.name is not None:\n            tree[\"name\"] = node.name\n\n        inputs = []\n        outputs = []\n        for i, o, m in zip(node.inputs, node.outputs, node.mapping):\n            input = {\n                \"name\": i,\n                \"allow_dimensionless\": node.input_units_allow_dimensionless[i],\n            }\n            if m[0] is not None:\n                input[\"unit\"] = m[0]\n            if node.input_units_equivalencies is not None and i in node.input_units_equivalencies:\n                input[\"equivalencies\"] = node.input_units_equivalencies[i]\n            inputs.append(input)\n\n            output = {\n                \"name\": o,\n            }\n            if m[-1] is not None:\n                output[\"unit\"] = m[-1]\n            outputs.append(output)\n\n        tree[\"unit_inputs\"] = inputs\n        tree[\"unit_outputs\"] = outputs\n\n        return tree"},{"col":4,"comment":"null","endLoc":294,"header":"@classmethod\n    def from_tree(cls, tree, ctx)","id":4782,"name":"from_tree","nodeType":"Function","startLoc":273,"text":"@classmethod\n    def from_tree(cls, tree, ctx):\n        mapping = tuple((i.get(\"unit\"), o.get(\"unit\"))\n                        for i, o in zip(tree[\"unit_inputs\"], tree[\"unit_outputs\"]))\n\n        equivalencies = None\n        for i in tree[\"unit_inputs\"]:\n            if \"equivalencies\" in i:\n                if equivalencies is None:\n                    equivalencies = {}\n                equivalencies[i[\"name\"]] = i[\"equivalencies\"]\n\n        kwargs = {\n            \"input_units_equivalencies\": equivalencies,\n            \"input_units_allow_dimensionless\": {\n                i[\"name\"]: i.get(\"allow_dimensionless\", False) for i in tree[\"unit_inputs\"]},\n        }\n\n        if \"name\" in tree:\n            kwargs[\"name\"] = tree[\"name\"]\n\n        return mappings.UnitsMapping(mapping, **kwargs)"},{"col":0,"comment":"Ensure there are no duplicates in ``names``\n\n    This is done by iteratively adding ``_<N>`` to the name for increasing N\n    until the name is unique.\n    ","endLoc":1106,"header":"def _deduplicate_names(names)","id":4784,"name":"_deduplicate_names","nodeType":"Function","startLoc":1087,"text":"def _deduplicate_names(names):\n    \"\"\"Ensure there are no duplicates in ``names``\n\n    This is done by iteratively adding ``_<N>`` to the name for increasing N\n    until the name is unique.\n    \"\"\"\n    new_names = []\n    existing_names = set()\n\n    for name in names:\n        base_name = name + '_'\n        i = 1\n        while name in existing_names:\n            # Iterate until a unique name is found\n            name = base_name + str(i)\n            i += 1\n        new_names.append(name)\n        existing_names.add(name)\n\n    return new_names"},{"col":4,"comment":"Return lines in the table that match header.comment regexp","endLoc":1428,"header":"@property\n    def comment_lines(self)","id":4785,"name":"comment_lines","nodeType":"Function","startLoc":1418,"text":"@property\n    def comment_lines(self):\n        \"\"\"Return lines in the table that match header.comment regexp\"\"\"\n        if not hasattr(self, 'lines'):\n            raise ValueError('Table must be read prior to accessing the header comment lines')\n        if self.header.comment:\n            re_comment = re.compile(self.header.comment)\n            comment_lines = [x for x in self.lines if re_comment.match(x)]\n        else:\n            comment_lines = []\n        return comment_lines"},{"attributeType":"null","col":4,"comment":"null","endLoc":26,"id":4786,"name":"comment","nodeType":"Attribute","startLoc":26,"text":"comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":237,"id":4787,"name":"name","nodeType":"Attribute","startLoc":237,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":238,"id":4788,"name":"version","nodeType":"Attribute","startLoc":238,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":239,"id":4789,"name":"types","nodeType":"Attribute","startLoc":239,"text":"types"},{"col":4,"comment":"\n        Update table columns in place if needed.\n\n        This is a hook to allow updating the table columns after name\n        filtering but before setting up to write the data.  This is currently\n        only used by ECSV and is otherwise just a pass-through.\n\n        Parameters\n        ----------\n        table : `astropy.table.Table`\n            Input table for writing\n\n        Returns\n        -------\n        table : `astropy.table.Table`\n            Output table for writing\n        ","endLoc":1448,"header":"def update_table_data(self, table)","id":4790,"name":"update_table_data","nodeType":"Function","startLoc":1430,"text":"def update_table_data(self, table):\n        \"\"\"\n        Update table columns in place if needed.\n\n        This is a hook to allow updating the table columns after name\n        filtering but before setting up to write the data.  This is currently\n        only used by ECSV and is otherwise just a pass-through.\n\n        Parameters\n        ----------\n        table : `astropy.table.Table`\n            Input table for writing\n\n        Returns\n        -------\n        table : `astropy.table.Table`\n            Output table for writing\n        \"\"\"\n        return table"},{"col":4,"comment":"null","endLoc":1452,"header":"def write_header(self, lines, meta)","id":4791,"name":"write_header","nodeType":"Function","startLoc":1450,"text":"def write_header(self, lines, meta):\n        self.header.write_comments(lines, meta)\n        self.header.write(lines)"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":4792,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"basic.py#<anonymous>","id":4793,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['TransformType', 'IdentityType', 'ConstantType']"},{"col":4,"comment":"\n        Write ``table`` as list of strings.\n\n        Parameters\n        ----------\n        table : `~astropy.table.Table`\n            Input table data.\n\n        Returns\n        -------\n        lines : list\n            List of strings corresponding to ASCII table\n\n        ","endLoc":1500,"header":"def write(self, table)","id":4794,"name":"write","nodeType":"Function","startLoc":1454,"text":"def write(self, table):\n        \"\"\"\n        Write ``table`` as list of strings.\n\n        Parameters\n        ----------\n        table : `~astropy.table.Table`\n            Input table data.\n\n        Returns\n        -------\n        lines : list\n            List of strings corresponding to ASCII table\n\n        \"\"\"\n\n        # Check column names before altering\n        self.header.cols = list(table.columns.values())\n        self.header.check_column_names(self.names, self.strict_names, False)\n\n        # In-place update of columns in input ``table`` to reflect column\n        # filtering.  Note that ``table`` is guaranteed to be a copy of the\n        # original user-supplied table.\n        _apply_include_exclude_names(table, self.names, self.include_names, self.exclude_names)\n\n        # This is a hook to allow updating the table columns after name\n        # filtering but before setting up to write the data.  This is currently\n        # only used by ECSV and is otherwise just a pass-through.\n        table = self.update_table_data(table)\n\n        # Check that table column dimensions are supported by this format class.\n        # Most formats support only 1-d columns, but some like ECSV support N-d.\n        self._check_multidim_table(table)\n\n        # Now use altered columns\n        new_cols = list(table.columns.values())\n        # link information about the columns to the writer object (i.e. self)\n        self.header.cols = new_cols\n        self.data.cols = new_cols\n        self.header.table_meta = table.meta\n\n        # Write header and data to lines list\n        lines = []\n        self.write_header(lines, table.meta)\n        self.data.write(lines)\n\n        return lines"},{"fileName":"sextractor.py","filePath":"astropy/io/ascii","id":4795,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\" sextractor.py:\n  Classes to read SExtractor table format\n\nBuilt on daophot.py:\n:Copyright: Smithsonian Astrophysical Observatory (2011)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\"\n\n\nimport re\n\nfrom . import core\n\n\nclass SExtractorHeader(core.BaseHeader):\n    \"\"\"Read the header from a file produced by SExtractor.\"\"\"\n    comment = r'^\\s*#\\s*\\S\\D.*'  # Find lines that don't have \"# digit\"\n\n    def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines`` for a SExtractor\n        header.  The SExtractor header is specialized so that we just copy the entire BaseHeader\n        get_cols routine and modify as needed.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n\n        # This assumes that the columns are listed in order, one per line with a\n        # header comment string of the format: \"# 1 ID short description [unit]\"\n        # However, some may be missing and must be inferred from skipped column numbers\n        columns = {}\n        # E.g. '# 1 ID identification number' (no units) or '# 2 MAGERR magnitude of error [mag]'\n        # Updated along with issue #4603, for more robust parsing of unit\n        re_name_def = re.compile(r\"\"\"^\\s* \\# \\s*             # possible whitespace around #\n                                 (?P<colnumber> [0-9]+)\\s+   # number of the column in table\n                                 (?P<colname> [-\\w]+)        # name of the column\n                                 # column description, match any character until...\n                                 (?:\\s+(?P<coldescr> \\w .+)\n                                 # ...until [non-space][space][unit] or [not-right-bracket][end]\n                                 (?:(?<!(\\]))$|(?=(?:(?<=\\S)\\s+\\[.+\\]))))?\n                                 (?:\\s*\\[(?P<colunit>.+)\\])?.* # match units in brackets\n                                 \"\"\", re.VERBOSE)\n        dataline = None\n        for line in lines:\n            if not line.startswith('#'):\n                dataline = line  # save for later to infer the actual number of columns\n                break                   # End of header lines\n            else:\n                match = re_name_def.search(line)\n                if match:\n                    colnumber = int(match.group('colnumber'))\n                    colname = match.group('colname')\n                    coldescr = match.group('coldescr')\n                    colunit = match.group('colunit')  # If no units are given, colunit = None\n                    columns[colnumber] = (colname, coldescr, colunit)\n        # Handle skipped column numbers\n        colnumbers = sorted(columns)\n        # Handle the case where the last column is array-like by append a pseudo column\n        # If there are more data columns than the largest column number\n        # then add a pseudo-column that will be dropped later.  This allows\n        # the array column logic below to work in all cases.\n        if dataline is not None:\n            n_data_cols = len(dataline.split())\n        else:\n            # handles no data, where we have to rely on the last column number\n            n_data_cols = colnumbers[-1]\n        # sextractor column number start at 1.\n        columns[n_data_cols + 1] = (None, None, None)\n        colnumbers.append(n_data_cols + 1)\n        if len(columns) > 1:  # only fill in skipped columns when there is genuine column initially\n            previous_column = 0\n            for n in colnumbers:\n                if n != previous_column + 1:\n                    for c in range(previous_column + 1, n):\n                        column_name = (columns[previous_column][0]\n                                       + f\"_{c - previous_column}\")\n                        column_descr = columns[previous_column][1]\n                        column_unit = columns[previous_column][2]\n                        columns[c] = (column_name, column_descr, column_unit)\n                previous_column = n\n        # Add the columns in order to self.names\n        colnumbers = sorted(columns)[:-1]  # drop the pseudo column\n        self.names = []\n        for n in colnumbers:\n            self.names.append(columns[n][0])\n\n        if not self.names:\n            raise core.InconsistentTableError('No column names found in SExtractor header')\n\n        self.cols = []\n        for n in colnumbers:\n            col = core.Column(name=columns[n][0])\n            col.description = columns[n][1]\n            col.unit = columns[n][2]\n            self.cols.append(col)\n\n\nclass SExtractorData(core.BaseData):\n    start_line = 0\n    delimiter = ' '\n    comment = r'\\s*#'\n\n\nclass SExtractor(core.BaseReader):\n    \"\"\"SExtractor format table.\n\n    SExtractor is a package for faint-galaxy photometry (Bertin & Arnouts\n    1996, A&A Supp. 317, 393.)\n\n    See: https://sextractor.readthedocs.io/en/latest/\n\n    Example::\n\n      # 1 NUMBER\n      # 2 ALPHA_J2000\n      # 3 DELTA_J2000\n      # 4 FLUX_RADIUS\n      # 7 MAG_AUTO [mag]\n      # 8 X2_IMAGE Variance along x [pixel**2]\n      # 9 X_MAMA Barycenter position along MAMA x axis [m**(-6)]\n      # 10 MU_MAX Peak surface brightness above background [mag * arcsec**(-2)]\n      1 32.23222 10.1211 0.8 1.2 1.4 18.1 1000.0 0.00304 -3.498\n      2 38.12321 -88.1321 2.2 2.4 3.1 17.0 1500.0 0.00908 1.401\n\n    Note the skipped numbers since flux_radius has 3 columns.  The three\n    FLUX_RADIUS columns will be named FLUX_RADIUS, FLUX_RADIUS_1, FLUX_RADIUS_2\n    Also note that a post-ID description (e.g. \"Variance along x\") is optional\n    and that units may be specified at the end of a line in brackets.\n\n    \"\"\"\n    _format_name = 'sextractor'\n    _io_registry_can_write = False\n    _description = 'SExtractor format table'\n\n    header_class = SExtractorHeader\n    data_class = SExtractorData\n    inputter_class = core.ContinuationLinesInputter\n\n    def read(self, table):\n        \"\"\"\n        Read input data (file-like object, filename, list of strings, or\n        single string) into a Table and return the result.\n        \"\"\"\n        out = super().read(table)\n        # remove the comments\n        if 'comments' in out.meta:\n            del out.meta['comments']\n        return out\n\n    def write(self, table):\n        raise NotImplementedError\n"},{"className":"SExtractorHeader","col":0,"comment":"Read the header from a file produced by SExtractor.","endLoc":100,"id":4796,"nodeType":"Class","startLoc":16,"text":"class SExtractorHeader(core.BaseHeader):\n    \"\"\"Read the header from a file produced by SExtractor.\"\"\"\n    comment = r'^\\s*#\\s*\\S\\D.*'  # Find lines that don't have \"# digit\"\n\n    def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines`` for a SExtractor\n        header.  The SExtractor header is specialized so that we just copy the entire BaseHeader\n        get_cols routine and modify as needed.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n\n        # This assumes that the columns are listed in order, one per line with a\n        # header comment string of the format: \"# 1 ID short description [unit]\"\n        # However, some may be missing and must be inferred from skipped column numbers\n        columns = {}\n        # E.g. '# 1 ID identification number' (no units) or '# 2 MAGERR magnitude of error [mag]'\n        # Updated along with issue #4603, for more robust parsing of unit\n        re_name_def = re.compile(r\"\"\"^\\s* \\# \\s*             # possible whitespace around #\n                                 (?P<colnumber> [0-9]+)\\s+   # number of the column in table\n                                 (?P<colname> [-\\w]+)        # name of the column\n                                 # column description, match any character until...\n                                 (?:\\s+(?P<coldescr> \\w .+)\n                                 # ...until [non-space][space][unit] or [not-right-bracket][end]\n                                 (?:(?<!(\\]))$|(?=(?:(?<=\\S)\\s+\\[.+\\]))))?\n                                 (?:\\s*\\[(?P<colunit>.+)\\])?.* # match units in brackets\n                                 \"\"\", re.VERBOSE)\n        dataline = None\n        for line in lines:\n            if not line.startswith('#'):\n                dataline = line  # save for later to infer the actual number of columns\n                break                   # End of header lines\n            else:\n                match = re_name_def.search(line)\n                if match:\n                    colnumber = int(match.group('colnumber'))\n                    colname = match.group('colname')\n                    coldescr = match.group('coldescr')\n                    colunit = match.group('colunit')  # If no units are given, colunit = None\n                    columns[colnumber] = (colname, coldescr, colunit)\n        # Handle skipped column numbers\n        colnumbers = sorted(columns)\n        # Handle the case where the last column is array-like by append a pseudo column\n        # If there are more data columns than the largest column number\n        # then add a pseudo-column that will be dropped later.  This allows\n        # the array column logic below to work in all cases.\n        if dataline is not None:\n            n_data_cols = len(dataline.split())\n        else:\n            # handles no data, where we have to rely on the last column number\n            n_data_cols = colnumbers[-1]\n        # sextractor column number start at 1.\n        columns[n_data_cols + 1] = (None, None, None)\n        colnumbers.append(n_data_cols + 1)\n        if len(columns) > 1:  # only fill in skipped columns when there is genuine column initially\n            previous_column = 0\n            for n in colnumbers:\n                if n != previous_column + 1:\n                    for c in range(previous_column + 1, n):\n                        column_name = (columns[previous_column][0]\n                                       + f\"_{c - previous_column}\")\n                        column_descr = columns[previous_column][1]\n                        column_unit = columns[previous_column][2]\n                        columns[c] = (column_name, column_descr, column_unit)\n                previous_column = n\n        # Add the columns in order to self.names\n        colnumbers = sorted(columns)[:-1]  # drop the pseudo column\n        self.names = []\n        for n in colnumbers:\n            self.names.append(columns[n][0])\n\n        if not self.names:\n            raise core.InconsistentTableError('No column names found in SExtractor header')\n\n        self.cols = []\n        for n in colnumbers:\n            col = core.Column(name=columns[n][0])\n            col.description = columns[n][1]\n            col.unit = columns[n][2]\n            self.cols.append(col)"},{"attributeType":"null","col":4,"comment":"null","endLoc":27,"id":4797,"name":"write_comment","nodeType":"Attribute","startLoc":27,"text":"write_comment"},{"col":4,"comment":"\n        Initialize the header Column objects from the table ``lines`` for a SExtractor\n        header.  The SExtractor header is specialized so that we just copy the entire BaseHeader\n        get_cols routine and modify as needed.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        ","endLoc":100,"header":"def get_cols(self, lines)","id":4798,"name":"get_cols","nodeType":"Function","startLoc":20,"text":"def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines`` for a SExtractor\n        header.  The SExtractor header is specialized so that we just copy the entire BaseHeader\n        get_cols routine and modify as needed.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n\n        # This assumes that the columns are listed in order, one per line with a\n        # header comment string of the format: \"# 1 ID short description [unit]\"\n        # However, some may be missing and must be inferred from skipped column numbers\n        columns = {}\n        # E.g. '# 1 ID identification number' (no units) or '# 2 MAGERR magnitude of error [mag]'\n        # Updated along with issue #4603, for more robust parsing of unit\n        re_name_def = re.compile(r\"\"\"^\\s* \\# \\s*             # possible whitespace around #\n                                 (?P<colnumber> [0-9]+)\\s+   # number of the column in table\n                                 (?P<colname> [-\\w]+)        # name of the column\n                                 # column description, match any character until...\n                                 (?:\\s+(?P<coldescr> \\w .+)\n                                 # ...until [non-space][space][unit] or [not-right-bracket][end]\n                                 (?:(?<!(\\]))$|(?=(?:(?<=\\S)\\s+\\[.+\\]))))?\n                                 (?:\\s*\\[(?P<colunit>.+)\\])?.* # match units in brackets\n                                 \"\"\", re.VERBOSE)\n        dataline = None\n        for line in lines:\n            if not line.startswith('#'):\n                dataline = line  # save for later to infer the actual number of columns\n                break                   # End of header lines\n            else:\n                match = re_name_def.search(line)\n                if match:\n                    colnumber = int(match.group('colnumber'))\n                    colname = match.group('colname')\n                    coldescr = match.group('coldescr')\n                    colunit = match.group('colunit')  # If no units are given, colunit = None\n                    columns[colnumber] = (colname, coldescr, colunit)\n        # Handle skipped column numbers\n        colnumbers = sorted(columns)\n        # Handle the case where the last column is array-like by append a pseudo column\n        # If there are more data columns than the largest column number\n        # then add a pseudo-column that will be dropped later.  This allows\n        # the array column logic below to work in all cases.\n        if dataline is not None:\n            n_data_cols = len(dataline.split())\n        else:\n            # handles no data, where we have to rely on the last column number\n            n_data_cols = colnumbers[-1]\n        # sextractor column number start at 1.\n        columns[n_data_cols + 1] = (None, None, None)\n        colnumbers.append(n_data_cols + 1)\n        if len(columns) > 1:  # only fill in skipped columns when there is genuine column initially\n            previous_column = 0\n            for n in colnumbers:\n                if n != previous_column + 1:\n                    for c in range(previous_column + 1, n):\n                        column_name = (columns[previous_column][0]\n                                       + f\"_{c - previous_column}\")\n                        column_descr = columns[previous_column][1]\n                        column_unit = columns[previous_column][2]\n                        columns[c] = (column_name, column_descr, column_unit)\n                previous_column = n\n        # Add the columns in order to self.names\n        colnumbers = sorted(columns)[:-1]  # drop the pseudo column\n        self.names = []\n        for n in colnumbers:\n            self.names.append(columns[n][0])\n\n        if not self.names:\n            raise core.InconsistentTableError('No column names found in SExtractor header')\n\n        self.cols = []\n        for n in colnumbers:\n            col = core.Column(name=columns[n][0])\n            col.description = columns[n][1]\n            col.unit = columns[n][2]\n            self.cols.append(col)"},{"col":4,"comment":"Return only non-blank lines that start with the comment regexp.  For these\n        lines strip out the matching characters and leading/trailing whitespace.","endLoc":48,"header":"def process_lines(self, lines)","id":4799,"name":"process_lines","nodeType":"Function","startLoc":33,"text":"def process_lines(self, lines):\n        \"\"\"Return only non-blank lines that start with the comment regexp.  For these\n        lines strip out the matching characters and leading/trailing whitespace.\"\"\"\n        re_comment = re.compile(self.comment)\n        for line in lines:\n            line = line.strip()\n            if not line:\n                continue\n            match = re_comment.match(line)\n            if match:\n                out = line[match.end():]\n                if out:\n                    yield out\n            else:\n                # Stop iterating on first failed match for a non-blank line\n                return"},{"col":4,"comment":"\n        Finds the nearest on-sky matches of this coordinate in a set of\n        catalog coordinates.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        catalogcoord : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The base catalog in which to search for matches. Typically this\n            will be a coordinate object that is an array (i.e.,\n            ``catalogcoord.isscalar == False``)\n        nthneighbor : int, optional\n            Which closest neighbor to search for.  Typically ``1`` is\n            desired here, as that is correct for matching one set of\n            coordinates to another. The next likely use case is ``2``,\n            for matching a coordinate catalog against *itself* (``1``\n            is inappropriate because each point will find itself as the\n            closest match).\n\n        Returns\n        -------\n        idx : int array\n            Indices into ``catalogcoord`` to get the matched points for\n            each of this object's coordinates. Shape matches this\n            object.\n        sep2d : `~astropy.coordinates.Angle`\n            The on-sky separation between the closest match for each\n            element in this object in ``catalogcoord``. Shape matches\n            this object.\n        dist3d : `~astropy.units.Quantity` ['length']\n            The 3D distance between the closest match for each element\n            in this object in ``catalogcoord``. Shape matches this\n            object. Unless both this and ``catalogcoord`` have associated\n            distances, this quantity assumes that all sources are at a\n            distance of 1 (dimensionless).\n\n        Notes\n        -----\n        This method requires `SciPy <https://www.scipy.org/>`_ to be\n        installed or it will fail.\n\n        See Also\n        --------\n        astropy.coordinates.match_coordinates_sky\n        SkyCoord.match_to_catalog_3d\n        ","endLoc":1387,"header":"def match_to_catalog_sky(self, catalogcoord, nthneighbor=1)","id":4800,"name":"match_to_catalog_sky","nodeType":"Function","startLoc":1328,"text":"def match_to_catalog_sky(self, catalogcoord, nthneighbor=1):\n        \"\"\"\n        Finds the nearest on-sky matches of this coordinate in a set of\n        catalog coordinates.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        catalogcoord : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The base catalog in which to search for matches. Typically this\n            will be a coordinate object that is an array (i.e.,\n            ``catalogcoord.isscalar == False``)\n        nthneighbor : int, optional\n            Which closest neighbor to search for.  Typically ``1`` is\n            desired here, as that is correct for matching one set of\n            coordinates to another. The next likely use case is ``2``,\n            for matching a coordinate catalog against *itself* (``1``\n            is inappropriate because each point will find itself as the\n            closest match).\n\n        Returns\n        -------\n        idx : int array\n            Indices into ``catalogcoord`` to get the matched points for\n            each of this object's coordinates. Shape matches this\n            object.\n        sep2d : `~astropy.coordinates.Angle`\n            The on-sky separation between the closest match for each\n            element in this object in ``catalogcoord``. Shape matches\n            this object.\n        dist3d : `~astropy.units.Quantity` ['length']\n            The 3D distance between the closest match for each element\n            in this object in ``catalogcoord``. Shape matches this\n            object. Unless both this and ``catalogcoord`` have associated\n            distances, this quantity assumes that all sources are at a\n            distance of 1 (dimensionless).\n\n        Notes\n        -----\n        This method requires `SciPy <https://www.scipy.org/>`_ to be\n        installed or it will fail.\n\n        See Also\n        --------\n        astropy.coordinates.match_coordinates_sky\n        SkyCoord.match_to_catalog_3d\n        \"\"\"\n        from .matching import match_coordinates_sky\n\n        if not (isinstance(catalogcoord, (SkyCoord, BaseCoordinateFrame))\n                and catalogcoord.has_data):\n            raise TypeError('Can only get separation to another SkyCoord or a '\n                            'coordinate frame with data')\n\n        res = match_coordinates_sky(self, catalogcoord,\n                                    nthneighbor=nthneighbor,\n                                    storekdtree='_kdtree_sky')\n        return res"},{"col":0,"comment":"\n    Finds the nearest on-sky matches of a coordinate or coordinates in\n    a set of catalog coordinates.\n\n    This finds the on-sky closest neighbor, which is only different from the\n    3-dimensional match if ``distance`` is set in either ``matchcoord``\n    or ``catalogcoord``.\n\n    Parameters\n    ----------\n    matchcoord : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The coordinate(s) to match to the catalog.\n    catalogcoord : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The base catalog in which to search for matches. Typically this will\n        be a coordinate object that is an array (i.e.,\n        ``catalogcoord.isscalar == False``)\n    nthneighbor : int, optional\n        Which closest neighbor to search for.  Typically ``1`` is desired here,\n        as that is correct for matching one set of coordinates to another.\n        The next likely use case is ``2``, for matching a coordinate catalog\n        against *itself* (``1`` is inappropriate because each point will find\n        itself as the closest match).\n    storekdtree : bool or str, optional\n        If a string, will store the KD-Tree used for the computation\n        in the ``catalogcoord`` in ``catalogcoord.cache`` with the\n        provided name.  This dramatically speeds up subsequent calls with the\n        same catalog. If False, the KD-Tree is discarded after use.\n\n    Returns\n    -------\n    idx : int array\n        Indices into ``catalogcoord`` to get the matched points for each\n        ``matchcoord``. Shape matches ``matchcoord``.\n    sep2d : `~astropy.coordinates.Angle`\n        The on-sky separation between the closest match for each\n        ``matchcoord`` and the ``matchcoord``. Shape matches ``matchcoord``.\n    dist3d : `~astropy.units.Quantity` ['length']\n        The 3D distance between the closest match for each ``matchcoord`` and\n        the ``matchcoord``. Shape matches ``matchcoord``.  If either\n        ``matchcoord`` or ``catalogcoord`` don't have a distance, this is the 3D\n        distance on the unit sphere, rather than a true distance.\n\n    Notes\n    -----\n    This function requires `SciPy <https://www.scipy.org/>`_ to be installed\n    or it will fail.\n    ","endLoc":178,"header":"def match_coordinates_sky(matchcoord, catalogcoord, nthneighbor=1, storekdtree='kdtree_sky')","id":4801,"name":"match_coordinates_sky","nodeType":"Function","startLoc":94,"text":"def match_coordinates_sky(matchcoord, catalogcoord, nthneighbor=1, storekdtree='kdtree_sky'):\n    \"\"\"\n    Finds the nearest on-sky matches of a coordinate or coordinates in\n    a set of catalog coordinates.\n\n    This finds the on-sky closest neighbor, which is only different from the\n    3-dimensional match if ``distance`` is set in either ``matchcoord``\n    or ``catalogcoord``.\n\n    Parameters\n    ----------\n    matchcoord : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The coordinate(s) to match to the catalog.\n    catalogcoord : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The base catalog in which to search for matches. Typically this will\n        be a coordinate object that is an array (i.e.,\n        ``catalogcoord.isscalar == False``)\n    nthneighbor : int, optional\n        Which closest neighbor to search for.  Typically ``1`` is desired here,\n        as that is correct for matching one set of coordinates to another.\n        The next likely use case is ``2``, for matching a coordinate catalog\n        against *itself* (``1`` is inappropriate because each point will find\n        itself as the closest match).\n    storekdtree : bool or str, optional\n        If a string, will store the KD-Tree used for the computation\n        in the ``catalogcoord`` in ``catalogcoord.cache`` with the\n        provided name.  This dramatically speeds up subsequent calls with the\n        same catalog. If False, the KD-Tree is discarded after use.\n\n    Returns\n    -------\n    idx : int array\n        Indices into ``catalogcoord`` to get the matched points for each\n        ``matchcoord``. Shape matches ``matchcoord``.\n    sep2d : `~astropy.coordinates.Angle`\n        The on-sky separation between the closest match for each\n        ``matchcoord`` and the ``matchcoord``. Shape matches ``matchcoord``.\n    dist3d : `~astropy.units.Quantity` ['length']\n        The 3D distance between the closest match for each ``matchcoord`` and\n        the ``matchcoord``. Shape matches ``matchcoord``.  If either\n        ``matchcoord`` or ``catalogcoord`` don't have a distance, this is the 3D\n        distance on the unit sphere, rather than a true distance.\n\n    Notes\n    -----\n    This function requires `SciPy <https://www.scipy.org/>`_ to be installed\n    or it will fail.\n    \"\"\"\n    if catalogcoord.isscalar or len(catalogcoord) < 1:\n        raise ValueError('The catalog for coordinate matching cannot be a '\n                         'scalar or length-0.')\n\n    # send to catalog frame\n    if isinstance(matchcoord, SkyCoord):\n        newmatch = matchcoord.transform_to(catalogcoord, merge_attributes=False)\n    else:\n        newmatch = matchcoord.transform_to(catalogcoord)\n\n    # strip out distance info\n    match_urepr = newmatch.data.represent_as(UnitSphericalRepresentation)\n    newmatch_u = newmatch.realize_frame(match_urepr)\n\n    cat_urepr = catalogcoord.data.represent_as(UnitSphericalRepresentation)\n    newcat_u = catalogcoord.realize_frame(cat_urepr)\n\n    # Check for a stored KD-tree on the passed-in coordinate. Normally it will\n    # have a distinct name from the \"3D\" one, so it's safe to use even though\n    # it's based on UnitSphericalRepresentation.\n    storekdtree = catalogcoord.cache.get(storekdtree, storekdtree)\n\n    idx, sep2d, sep3d = match_coordinates_3d(newmatch_u, newcat_u, nthneighbor, storekdtree)\n    # sep3d is *wrong* above, because the distance information was removed,\n    # unless one of the catalogs doesn't have a real distance\n    if not (isinstance(catalogcoord.data, UnitSphericalRepresentation) or\n            isinstance(newmatch.data, UnitSphericalRepresentation)):\n        sep3d = catalogcoord[idx].separation_3d(newmatch)\n\n    # update the kdtree on the actual passed-in coordinate\n    if isinstance(storekdtree, str):\n        catalogcoord.cache[storekdtree] = newcat_u.cache[storekdtree]\n    elif storekdtree is True:\n        # the old backwards-compatible name\n        catalogcoord.cache['kdtree'] = newcat_u.cache['kdtree']\n\n    return idx, sep2d, sep3d"},{"attributeType":"HTMLSplitter","col":4,"comment":"null","endLoc":175,"id":4802,"name":"splitter_class","nodeType":"Attribute","startLoc":175,"text":"splitter_class"},{"attributeType":"null","col":8,"comment":"null","endLoc":212,"id":4803,"name":"names","nodeType":"Attribute","startLoc":212,"text":"self.names"},{"attributeType":"null","col":8,"comment":"null","endLoc":195,"id":4804,"name":"cols","nodeType":"Attribute","startLoc":195,"text":"self.cols"},{"className":"HTMLData","col":0,"comment":"null","endLoc":251,"id":4805,"nodeType":"Class","startLoc":215,"text":"class HTMLData(core.BaseData):\n    splitter_class = HTMLSplitter\n\n    def start_line(self, lines):\n        \"\"\"\n        Return the line number at which table data begins.\n        \"\"\"\n\n        for i, line in enumerate(lines):\n            if not isinstance(line, SoupString):\n                raise TypeError('HTML lines should be of type SoupString')\n            soup = line.soup\n\n            if soup.td is not None:\n                if soup.th is not None:\n                    raise core.InconsistentTableError('HTML tables cannot '\n                                                      'have headings and data in the same row')\n                return i\n\n        raise core.InconsistentTableError('No start line found for HTML data')\n\n    def end_line(self, lines):\n        \"\"\"\n        Return the line number at which table data ends.\n        \"\"\"\n        last_index = -1\n\n        for i, line in enumerate(lines):\n            if not isinstance(line, SoupString):\n                raise TypeError('HTML lines should be of type SoupString')\n            soup = line.soup\n            if soup.td is not None:\n                last_index = i\n\n        if last_index == -1:\n            return None\n        return last_index + 1"},{"attributeType":"null","col":4,"comment":"null","endLoc":1244,"id":4806,"name":"names","nodeType":"Attribute","startLoc":1244,"text":"names"},{"attributeType":"null","col":4,"comment":"null","endLoc":1245,"id":4807,"name":"include_names","nodeType":"Attribute","startLoc":1245,"text":"include_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":1246,"id":4808,"name":"exclude_names","nodeType":"Attribute","startLoc":1246,"text":"exclude_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":1247,"id":4809,"name":"strict_names","nodeType":"Attribute","startLoc":1247,"text":"strict_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":1248,"id":4810,"name":"guessing","nodeType":"Attribute","startLoc":1248,"text":"guessing"},{"attributeType":"null","col":4,"comment":"null","endLoc":1249,"id":4811,"name":"encoding","nodeType":"Attribute","startLoc":1249,"text":"encoding"},{"attributeType":"null","col":4,"comment":"null","endLoc":1251,"id":4812,"name":"header_class","nodeType":"Attribute","startLoc":1251,"text":"header_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":1252,"id":4813,"name":"data_class","nodeType":"Attribute","startLoc":1252,"text":"data_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":1253,"id":4814,"name":"inputter_class","nodeType":"Attribute","startLoc":1253,"text":"inputter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":1254,"id":4815,"name":"outputter_class","nodeType":"Attribute","startLoc":1254,"text":"outputter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":1258,"id":4816,"name":"max_ndim","nodeType":"Attribute","startLoc":1258,"text":"max_ndim"},{"attributeType":"null","col":8,"comment":"null","endLoc":1262,"id":4817,"name":"data","nodeType":"Attribute","startLoc":1262,"text":"self.data"},{"attributeType":"null","col":8,"comment":"null","endLoc":1274,"id":4818,"name":"meta","nodeType":"Attribute","startLoc":1274,"text":"self.meta"},{"attributeType":"null","col":8,"comment":"null","endLoc":1261,"id":4819,"name":"header","nodeType":"Attribute","startLoc":1261,"text":"self.header"},{"attributeType":"null","col":8,"comment":"null","endLoc":1263,"id":4820,"name":"inputter","nodeType":"Attribute","startLoc":1263,"text":"self.inputter"},{"attributeType":"null","col":8,"comment":"null","endLoc":1338,"id":4821,"name":"lines","nodeType":"Attribute","startLoc":1338,"text":"self.lines"},{"attributeType":"null","col":8,"comment":"null","endLoc":1352,"id":4822,"name":"cols","nodeType":"Attribute","startLoc":1352,"text":"self.cols"},{"attributeType":"null","col":8,"comment":"null","endLoc":1264,"id":4823,"name":"outputter","nodeType":"Attribute","startLoc":1264,"text":"self.outputter"},{"attributeType":"null","col":4,"comment":"null","endLoc":58,"id":4824,"name":"_format_name","nodeType":"Attribute","startLoc":58,"text":"_format_name"},{"className":"BaseData","col":0,"comment":"\n    Base table data reader.\n    ","endLoc":938,"id":4825,"nodeType":"Class","startLoc":752,"text":"class BaseData:\n    \"\"\"\n    Base table data reader.\n    \"\"\"\n    start_line = None\n    \"\"\" None, int, or a function of ``lines`` that returns None or int \"\"\"\n    end_line = None\n    \"\"\" None, int, or a function of ``lines`` that returns None or int \"\"\"\n    comment = None\n    \"\"\" Regular expression for comment lines \"\"\"\n    splitter_class = DefaultSplitter\n    \"\"\" Splitter class for splitting data lines into columns \"\"\"\n    write_spacer_lines = ['ASCII_TABLE_WRITE_SPACER_LINE']\n    fill_include_names = None\n    fill_exclude_names = None\n    fill_values = [(masked, '')]\n    formats = {}\n\n    def __init__(self):\n        # Need to make sure fill_values list is instance attribute, not class attribute.\n        # On read, this will be overwritten by the default in the ui.read (thus, in\n        # the current implementation there can be no different default for different\n        # Readers). On write, ui.py does not specify a default, so this line here matters.\n        self.fill_values = copy.copy(self.fill_values)\n        self.formats = copy.copy(self.formats)\n        self.splitter = self.splitter_class()\n\n    def process_lines(self, lines):\n        \"\"\"\n        READ: Strip out comment lines and blank lines from list of ``lines``\n\n        Parameters\n        ----------\n        lines : list\n            All lines in table\n\n        Returns\n        -------\n        lines : list\n            List of lines\n\n        \"\"\"\n        nonblank_lines = (x for x in lines if x.strip())\n        if self.comment:\n            re_comment = re.compile(self.comment)\n            return [x for x in nonblank_lines if not re_comment.match(x)]\n        else:\n            return [x for x in nonblank_lines]\n\n    def get_data_lines(self, lines):\n        \"\"\"READ: Set ``data_lines`` attribute to lines slice comprising table data values.\n        \"\"\"\n        data_lines = self.process_lines(lines)\n        start_line = _get_line_index(self.start_line, data_lines)\n        end_line = _get_line_index(self.end_line, data_lines)\n\n        if start_line is not None or end_line is not None:\n            self.data_lines = data_lines[slice(start_line, end_line)]\n        else:  # Don't copy entire data lines unless necessary\n            self.data_lines = data_lines\n\n    def get_str_vals(self):\n        \"\"\"Return a generator that returns a list of column values (as strings)\n        for each data line.\"\"\"\n        return self.splitter(self.data_lines)\n\n    def masks(self, cols):\n        \"\"\"READ: Set fill value for each column and then apply that fill value\n\n        In the first step it is evaluated with value from ``fill_values`` applies to\n        which column using ``fill_include_names`` and ``fill_exclude_names``.\n        In the second step all replacements are done for the appropriate columns.\n        \"\"\"\n        if self.fill_values:\n            self._set_fill_values(cols)\n            self._set_masks(cols)\n\n    def _set_fill_values(self, cols):\n        \"\"\"READ, WRITE: Set fill values of individual cols based on fill_values of BaseData\n\n        fill values has the following form:\n        <fill_spec> = (<bad_value>, <fill_value>, <optional col_name>...)\n        fill_values = <fill_spec> or list of <fill_spec>'s\n\n        \"\"\"\n        if self.fill_values:\n            # when we write tables the columns may be astropy.table.Columns\n            # which don't carry a fill_values by default\n            for col in cols:\n                if not hasattr(col, 'fill_values'):\n                    col.fill_values = {}\n\n            # if input is only one <fill_spec>, then make it a list\n            with suppress(TypeError):\n                self.fill_values[0] + ''\n                self.fill_values = [self.fill_values]\n\n            # Step 1: Set the default list of columns which are affected by\n            # fill_values\n            colnames = set(self.header.colnames)\n            if self.fill_include_names is not None:\n                colnames.intersection_update(self.fill_include_names)\n            if self.fill_exclude_names is not None:\n                colnames.difference_update(self.fill_exclude_names)\n\n            # Step 2a: Find out which columns are affected by this tuple\n            # iterate over reversed order, so last condition is set first and\n            # overwritten by earlier conditions\n            for replacement in reversed(self.fill_values):\n                if len(replacement) < 2:\n                    raise ValueError(\"Format of fill_values must be \"\n                                     \"(<bad>, <fill>, <optional col1>, ...)\")\n                elif len(replacement) == 2:\n                    affect_cols = colnames\n                else:\n                    affect_cols = replacement[2:]\n\n                for i, key in ((i, x) for i, x in enumerate(self.header.colnames)\n                               if x in affect_cols):\n                    cols[i].fill_values[replacement[0]] = str(replacement[1])\n\n    def _set_masks(self, cols):\n        \"\"\"READ: Replace string values in col.str_vals and set masks\"\"\"\n        if self.fill_values:\n            for col in (col for col in cols if col.fill_values):\n                col.mask = numpy.zeros(len(col.str_vals), dtype=bool)\n                for i, str_val in ((i, x) for i, x in enumerate(col.str_vals)\n                                   if x in col.fill_values):\n                    col.str_vals[i] = col.fill_values[str_val]\n                    col.mask[i] = True\n\n    def _replace_vals(self, cols):\n        \"\"\"WRITE: replace string values in col.str_vals\"\"\"\n        if self.fill_values:\n            for col in (col for col in cols if col.fill_values):\n                for i, str_val in ((i, x) for i, x in enumerate(col.str_vals)\n                                   if x in col.fill_values):\n                    col.str_vals[i] = col.fill_values[str_val]\n                if masked in col.fill_values and hasattr(col, 'mask'):\n                    mask_val = col.fill_values[masked]\n                    for i in col.mask.nonzero()[0]:\n                        col.str_vals[i] = mask_val\n\n    def str_vals(self):\n        \"\"\"WRITE: convert all values in table to a list of lists of strings\n\n        This sets the fill values and possibly column formats from the input\n        formats={} keyword, then ends up calling table.pprint._pformat_col_iter()\n        by a circuitous path. That function does the real work of formatting.\n        Finally replace anything matching the fill_values.\n\n        Returns\n        -------\n        values : list of list of str\n        \"\"\"\n        self._set_fill_values(self.cols)\n        self._set_col_formats()\n        for col in self.cols:\n            col.str_vals = list(col.info.iter_str_vals())\n        self._replace_vals(self.cols)\n        return [col.str_vals for col in self.cols]\n\n    def write(self, lines):\n        \"\"\"Write ``self.cols`` in place to ``lines``.\n\n        Parameters\n        ----------\n        lines : list\n            List for collecting output of writing self.cols.\n        \"\"\"\n        if hasattr(self.start_line, '__call__'):\n            raise TypeError('Start_line attribute cannot be callable for write()')\n        else:\n            data_start_line = self.start_line or 0\n\n        while len(lines) < data_start_line:\n            lines.append(itertools.cycle(self.write_spacer_lines))\n\n        col_str_iters = self.str_vals()\n        for vals in zip(*col_str_iters):\n            lines.append(self.splitter.join(vals))\n\n    def _set_col_formats(self):\n        \"\"\"WRITE: set column formats.\"\"\"\n        for col in self.cols:\n            if col.info.name in self.formats:\n                col.info.format = self.formats[col.info.name]"},{"attributeType":"null","col":4,"comment":"null","endLoc":59,"id":4826,"name":"_description","nodeType":"Attribute","startLoc":59,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":60,"id":4827,"name":"_io_registry_format_aliases","nodeType":"Attribute","startLoc":60,"text":"_io_registry_format_aliases"},{"attributeType":"null","col":4,"comment":"null","endLoc":62,"id":4828,"name":"header_class","nodeType":"Attribute","startLoc":62,"text":"header_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":63,"id":4829,"name":"data_class","nodeType":"Attribute","startLoc":63,"text":"data_class"},{"col":4,"comment":"\n        Shorthand for a cartesian representation of the coordinates in this\n        object.\n        ","endLoc":1773,"header":"@property\n    def cartesian(self)","id":4830,"name":"cartesian","nodeType":"Function","startLoc":1764,"text":"@property\n    def cartesian(self):\n        \"\"\"\n        Shorthand for a cartesian representation of the coordinates in this\n        object.\n        \"\"\"\n\n        # TODO: if representations are updated to use a full transform graph,\n        #       the representation aliases should not be hard-coded like this\n        return self.represent_as('cartesian', in_frame_units=True)"},{"col":4,"comment":"null","endLoc":308,"header":"def __init__(self, col_starts=None, col_ends=None, delimiter_pad=' ', bookend=True)","id":4831,"name":"__init__","nodeType":"Function","startLoc":303,"text":"def __init__(self, col_starts=None, col_ends=None, delimiter_pad=' ', bookend=True):\n        super().__init__()\n        self.data.splitter.delimiter_pad = delimiter_pad\n        self.data.splitter.bookend = bookend\n        self.header.col_starts = col_starts\n        self.header.col_ends = col_ends"},{"col":4,"comment":"\n        Shorthand for a cylindrical representation of the coordinates in this\n        object.\n        ","endLoc":1784,"header":"@property\n    def cylindrical(self)","id":4832,"name":"cylindrical","nodeType":"Function","startLoc":1775,"text":"@property\n    def cylindrical(self):\n        \"\"\"\n        Shorthand for a cylindrical representation of the coordinates in this\n        object.\n        \"\"\"\n\n        # TODO: if representations are updated to use a full transform graph,\n        #       the representation aliases should not be hard-coded like this\n        return self.represent_as('cylindrical', in_frame_units=True)"},{"col":4,"comment":"\n        Shorthand for a spherical representation of the coordinates in this\n        object.\n        ","endLoc":1795,"header":"@property\n    def spherical(self)","id":4833,"name":"spherical","nodeType":"Function","startLoc":1786,"text":"@property\n    def spherical(self):\n        \"\"\"\n        Shorthand for a spherical representation of the coordinates in this\n        object.\n        \"\"\"\n\n        # TODO: if representations are updated to use a full transform graph,\n        #       the representation aliases should not be hard-coded like this\n        return self.represent_as('spherical', in_frame_units=True)"},{"attributeType":"null","col":4,"comment":"null","endLoc":297,"id":4834,"name":"_format_name","nodeType":"Attribute","startLoc":297,"text":"_format_name"},{"col":4,"comment":"\n        Shorthand for a spherical representation of the positional data and a\n        `SphericalCosLatDifferential` for the velocity data in this object.\n        ","endLoc":1807,"header":"@property\n    def sphericalcoslat(self)","id":4835,"name":"sphericalcoslat","nodeType":"Function","startLoc":1797,"text":"@property\n    def sphericalcoslat(self):\n        \"\"\"\n        Shorthand for a spherical representation of the positional data and a\n        `SphericalCosLatDifferential` for the velocity data in this object.\n        \"\"\"\n\n        # TODO: if representations are updated to use a full transform graph,\n        #       the representation aliases should not be hard-coded like this\n        return self.represent_as('spherical', 'sphericalcoslat',\n                                 in_frame_units=True)"},{"attributeType":"null","col":4,"comment":"null","endLoc":298,"id":4836,"name":"_description","nodeType":"Attribute","startLoc":298,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":300,"id":4837,"name":"header_class","nodeType":"Attribute","startLoc":300,"text":"header_class"},{"col":4,"comment":"\n        Shorthand for retrieving the Cartesian space-motion as a\n        `CartesianDifferential` object. This is equivalent to calling\n        ``self.cartesian.differentials['s']``.\n        ","endLoc":1820,"header":"@property\n    def velocity(self)","id":4838,"name":"velocity","nodeType":"Function","startLoc":1809,"text":"@property\n    def velocity(self):\n        \"\"\"\n        Shorthand for retrieving the Cartesian space-motion as a\n        `CartesianDifferential` object. This is equivalent to calling\n        ``self.cartesian.differentials['s']``.\n        \"\"\"\n        if 's' not in self.data.differentials:\n            raise ValueError('Frame has no associated velocity (Differential) '\n                             'data information.')\n\n        return self.cartesian.differentials['s']"},{"col":4,"comment":"\n        Shorthand for the two-dimensional proper motion as a\n        `~astropy.units.Quantity` object with angular velocity units. In the\n        returned `~astropy.units.Quantity`, ``axis=0`` is the longitude/latitude\n        dimension so that ``.proper_motion[0]`` is the longitudinal proper\n        motion and ``.proper_motion[1]`` is latitudinal. The longitudinal proper\n        motion already includes the cos(latitude) term.\n        ","endLoc":1841,"header":"@property\n    def proper_motion(self)","id":4839,"name":"proper_motion","nodeType":"Function","startLoc":1822,"text":"@property\n    def proper_motion(self):\n        \"\"\"\n        Shorthand for the two-dimensional proper motion as a\n        `~astropy.units.Quantity` object with angular velocity units. In the\n        returned `~astropy.units.Quantity`, ``axis=0`` is the longitude/latitude\n        dimension so that ``.proper_motion[0]`` is the longitudinal proper\n        motion and ``.proper_motion[1]`` is latitudinal. The longitudinal proper\n        motion already includes the cos(latitude) term.\n        \"\"\"\n        if 's' not in self.data.differentials:\n            raise ValueError('Frame has no associated velocity (Differential) '\n                             'data information.')\n\n        sph = self.represent_as('spherical', 'sphericalcoslat',\n                                in_frame_units=True)\n        pm_lon = sph.differentials['s'].d_lon_coslat\n        pm_lat = sph.differentials['s'].d_lat\n        return np.stack((pm_lon.value,\n                         pm_lat.to(pm_lon.unit).value), axis=0) * pm_lon.unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":301,"id":4840,"name":"data_class","nodeType":"Attribute","startLoc":301,"text":"data_class"},{"className":"FixedWidthData","col":0,"comment":"\n    Base table data reader.\n    ","endLoc":268,"id":4841,"nodeType":"Class","startLoc":234,"text":"class FixedWidthData(basic.BasicData):\n    \"\"\"\n    Base table data reader.\n    \"\"\"\n    splitter_class = FixedWidthSplitter\n    \"\"\" Splitter class for splitting data lines into columns \"\"\"\n\n    def write(self, lines):\n        vals_list = []\n        col_str_iters = self.str_vals()\n        for vals in zip(*col_str_iters):\n            vals_list.append(vals)\n\n        for i, col in enumerate(self.cols):\n            col.width = max([len(vals[i]) for vals in vals_list])\n            if self.header.start_line is not None:\n                col.width = max(col.width, len(col.info.name))\n\n        widths = [col.width for col in self.cols]\n\n        if self.header.start_line is not None:\n            lines.append(self.splitter.join([col.info.name for col in self.cols],\n                                            widths))\n\n        if self.header.position_line is not None:\n            char = self.header.position_char\n            if len(char) != 1:\n                raise ValueError(f'Position_char=\"{char}\" must be a single character')\n            vals = [char * col.width for col in self.cols]\n            lines.append(self.splitter.join(vals, widths))\n\n        for vals in vals_list:\n            lines.append(self.splitter.join(vals, widths))\n\n        return lines"},{"col":4,"comment":"\n        Shorthand for the radial or line-of-sight velocity as a\n        `~astropy.units.Quantity` object.\n        ","endLoc":1854,"header":"@property\n    def radial_velocity(self)","id":4842,"name":"radial_velocity","nodeType":"Function","startLoc":1843,"text":"@property\n    def radial_velocity(self):\n        \"\"\"\n        Shorthand for the radial or line-of-sight velocity as a\n        `~astropy.units.Quantity` object.\n        \"\"\"\n        if 's' not in self.data.differentials:\n            raise ValueError('Frame has no associated velocity (Differential) '\n                             'data information.')\n\n        sph = self.represent_as('spherical', in_frame_units=True)\n        return sph.differentials['s'].d_distance"},{"className":"BasicData","col":0,"comment":"\n    Basic table Data Reader\n\n    Set a few defaults for common ascii table formats\n    (start at line 1, comments begin with ``#`` and possibly white space)\n    ","endLoc":39,"id":4843,"nodeType":"Class","startLoc":30,"text":"class BasicData(core.BaseData):\n    \"\"\"\n    Basic table Data Reader\n\n    Set a few defaults for common ascii table formats\n    (start at line 1, comments begin with ``#`` and possibly white space)\n    \"\"\"\n    start_line = 1\n    comment = r'\\s*#'\n    write_comment = '# '"},{"col":4,"comment":"null","endLoc":777,"header":"def __init__(self)","id":4844,"name":"__init__","nodeType":"Function","startLoc":770,"text":"def __init__(self):\n        # Need to make sure fill_values list is instance attribute, not class attribute.\n        # On read, this will be overwritten by the default in the ui.read (thus, in\n        # the current implementation there can be no different default for different\n        # Readers). On write, ui.py does not specify a default, so this line here matters.\n        self.fill_values = copy.copy(self.fill_values)\n        self.formats = copy.copy(self.formats)\n        self.splitter = self.splitter_class()"},{"attributeType":"null","col":4,"comment":"null","endLoc":37,"id":4845,"name":"start_line","nodeType":"Attribute","startLoc":37,"text":"start_line"},{"attributeType":"null","col":4,"comment":"null","endLoc":213,"id":4846,"name":"default_representation","nodeType":"Attribute","startLoc":213,"text":"default_representation"},{"attributeType":"null","col":4,"comment":"null","endLoc":38,"id":4847,"name":"comment","nodeType":"Attribute","startLoc":38,"text":"comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":39,"id":4848,"name":"write_comment","nodeType":"Attribute","startLoc":39,"text":"write_comment"},{"col":4,"comment":"null","endLoc":268,"header":"def write(self, lines)","id":4849,"name":"write","nodeType":"Function","startLoc":241,"text":"def write(self, lines):\n        vals_list = []\n        col_str_iters = self.str_vals()\n        for vals in zip(*col_str_iters):\n            vals_list.append(vals)\n\n        for i, col in enumerate(self.cols):\n            col.width = max([len(vals[i]) for vals in vals_list])\n            if self.header.start_line is not None:\n                col.width = max(col.width, len(col.info.name))\n\n        widths = [col.width for col in self.cols]\n\n        if self.header.start_line is not None:\n            lines.append(self.splitter.join([col.info.name for col in self.cols],\n                                            widths))\n\n        if self.header.position_line is not None:\n            char = self.header.position_char\n            if len(char) != 1:\n                raise ValueError(f'Position_char=\"{char}\" must be a single character')\n            vals = [char * col.width for col in self.cols]\n            lines.append(self.splitter.join(vals, widths))\n\n        for vals in vals_list:\n            lines.append(self.splitter.join(vals, widths))\n\n        return lines"},{"attributeType":"null","col":4,"comment":"null","endLoc":214,"id":4850,"name":"default_differential","nodeType":"Attribute","startLoc":214,"text":"default_differential"},{"attributeType":"null","col":4,"comment":"null","endLoc":218,"id":4851,"name":"frame_specific_representation_info","nodeType":"Attribute","startLoc":218,"text":"frame_specific_representation_info"},{"col":0,"comment":"\n    Finds the nearest 3-dimensional matches of a coordinate or coordinates in\n    a set of catalog coordinates.\n\n    This finds the 3-dimensional closest neighbor, which is only different\n    from the on-sky distance if ``distance`` is set in either ``matchcoord``\n    or ``catalogcoord``.\n\n    Parameters\n    ----------\n    matchcoord : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The coordinate(s) to match to the catalog.\n    catalogcoord : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The base catalog in which to search for matches. Typically this will\n        be a coordinate object that is an array (i.e.,\n        ``catalogcoord.isscalar == False``)\n    nthneighbor : int, optional\n        Which closest neighbor to search for.  Typically ``1`` is desired here,\n        as that is correct for matching one set of coordinates to another.\n        The next likely use case is ``2``, for matching a coordinate catalog\n        against *itself* (``1`` is inappropriate because each point will find\n        itself as the closest match).\n    storekdtree : bool or str, optional\n        If a string, will store the KD-Tree used for the computation\n        in the ``catalogcoord``, as in ``catalogcoord.cache`` with the\n        provided name.  This dramatically speeds up subsequent calls with the\n        same catalog. If False, the KD-Tree is discarded after use.\n\n    Returns\n    -------\n    idx : int array\n        Indices into ``catalogcoord`` to get the matched points for each\n        ``matchcoord``. Shape matches ``matchcoord``.\n    sep2d : `~astropy.coordinates.Angle`\n        The on-sky separation between the closest match for each ``matchcoord``\n        and the ``matchcoord``. Shape matches ``matchcoord``.\n    dist3d : `~astropy.units.Quantity` ['length']\n        The 3D distance between the closest match for each ``matchcoord`` and\n        the ``matchcoord``. Shape matches ``matchcoord``.\n\n    Notes\n    -----\n    This function requires `SciPy <https://www.scipy.org/>`_ to be installed\n    or it will fail.\n    ","endLoc":91,"header":"def match_coordinates_3d(matchcoord, catalogcoord, nthneighbor=1, storekdtree='kdtree_3d')","id":4852,"name":"match_coordinates_3d","nodeType":"Function","startLoc":18,"text":"def match_coordinates_3d(matchcoord, catalogcoord, nthneighbor=1, storekdtree='kdtree_3d'):\n    \"\"\"\n    Finds the nearest 3-dimensional matches of a coordinate or coordinates in\n    a set of catalog coordinates.\n\n    This finds the 3-dimensional closest neighbor, which is only different\n    from the on-sky distance if ``distance`` is set in either ``matchcoord``\n    or ``catalogcoord``.\n\n    Parameters\n    ----------\n    matchcoord : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The coordinate(s) to match to the catalog.\n    catalogcoord : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The base catalog in which to search for matches. Typically this will\n        be a coordinate object that is an array (i.e.,\n        ``catalogcoord.isscalar == False``)\n    nthneighbor : int, optional\n        Which closest neighbor to search for.  Typically ``1`` is desired here,\n        as that is correct for matching one set of coordinates to another.\n        The next likely use case is ``2``, for matching a coordinate catalog\n        against *itself* (``1`` is inappropriate because each point will find\n        itself as the closest match).\n    storekdtree : bool or str, optional\n        If a string, will store the KD-Tree used for the computation\n        in the ``catalogcoord``, as in ``catalogcoord.cache`` with the\n        provided name.  This dramatically speeds up subsequent calls with the\n        same catalog. If False, the KD-Tree is discarded after use.\n\n    Returns\n    -------\n    idx : int array\n        Indices into ``catalogcoord`` to get the matched points for each\n        ``matchcoord``. Shape matches ``matchcoord``.\n    sep2d : `~astropy.coordinates.Angle`\n        The on-sky separation between the closest match for each ``matchcoord``\n        and the ``matchcoord``. Shape matches ``matchcoord``.\n    dist3d : `~astropy.units.Quantity` ['length']\n        The 3D distance between the closest match for each ``matchcoord`` and\n        the ``matchcoord``. Shape matches ``matchcoord``.\n\n    Notes\n    -----\n    This function requires `SciPy <https://www.scipy.org/>`_ to be installed\n    or it will fail.\n    \"\"\"\n    if catalogcoord.isscalar or len(catalogcoord) < 1:\n        raise ValueError('The catalog for coordinate matching cannot be a '\n                         'scalar or length-0.')\n\n    kdt = _get_cartesian_kdtree(catalogcoord, storekdtree)\n\n    # make sure coordinate systems match\n    if isinstance(matchcoord, SkyCoord):\n        matchcoord = matchcoord.transform_to(catalogcoord, merge_attributes=False)\n    else:\n        matchcoord = matchcoord.transform_to(catalogcoord)\n\n    # make sure units match\n    catunit = catalogcoord.cartesian.x.unit\n    matchxyz = matchcoord.cartesian.xyz.to(catunit)\n\n    matchflatxyz = matchxyz.reshape((3, np.prod(matchxyz.shape) // 3))\n    # Querying NaN returns garbage\n    if np.isnan(matchflatxyz.value).any():\n        raise ValueError(\"Matching coordinates cannot contain NaN entries.\")\n    dist, idx = kdt.query(matchflatxyz.T, nthneighbor)\n\n    if nthneighbor > 1:  # query gives 1D arrays if k=1, 2D arrays otherwise\n        dist = dist[:, -1]\n        idx = idx[:, -1]\n\n    sep2d = catalogcoord[idx].separation(matchcoord)\n    return idx.reshape(matchxyz.shape[1:]), sep2d, dist.reshape(matchxyz.shape[1:]) * catunit"},{"attributeType":"null","col":4,"comment":"null","endLoc":220,"id":4853,"name":"frame_attributes","nodeType":"Attribute","startLoc":220,"text":"frame_attributes"},{"attributeType":"null","col":4,"comment":"null","endLoc":737,"id":4854,"name":"representation_type","nodeType":"Attribute","startLoc":737,"text":"representation_type"},{"col":4,"comment":"\n        Write header information in the ECSV ASCII format.\n\n        This function is called at the point when preprocessing has been done to\n        convert the input table columns to `self.cols` which is a list of\n        `astropy.io.ascii.core.Column` objects. In particular `col.str_vals`\n        is available for each column with the string representation of each\n        column item for output.\n\n        This format starts with a delimiter separated list of the column names\n        in order to make this format readable by humans and simple csv-type\n        readers. It then encodes the full table meta and column attributes and\n        meta as YAML and pretty-prints this in the header.  Finally the\n        delimited column names are repeated again, for humans and readers that\n        look for the *last* comment line as defining the column names.\n        ","endLoc":85,"header":"def write(self, lines)","id":4855,"name":"write","nodeType":"Function","startLoc":50,"text":"def write(self, lines):\n        \"\"\"\n        Write header information in the ECSV ASCII format.\n\n        This function is called at the point when preprocessing has been done to\n        convert the input table columns to `self.cols` which is a list of\n        `astropy.io.ascii.core.Column` objects. In particular `col.str_vals`\n        is available for each column with the string representation of each\n        column item for output.\n\n        This format starts with a delimiter separated list of the column names\n        in order to make this format readable by humans and simple csv-type\n        readers. It then encodes the full table meta and column attributes and\n        meta as YAML and pretty-prints this in the header.  Finally the\n        delimited column names are repeated again, for humans and readers that\n        look for the *last* comment line as defining the column names.\n        \"\"\"\n        if self.splitter.delimiter not in DELIMITERS:\n            raise ValueError('only space and comma are allowed for delimiter in ECSV format')\n\n        # Now assemble the header dict that will be serialized by the YAML dumper\n        header = {'cols': self.cols, 'schema': 'astropy-2.0'}\n\n        if self.table_meta:\n            header['meta'] = self.table_meta\n\n        # Set the delimiter only for the non-default option(s)\n        if self.splitter.delimiter != ' ':\n            header['delimiter'] = self.splitter.delimiter\n\n        header_yaml_lines = ([f'%ECSV {ECSV_VERSION}',\n                              '---']\n                             + meta.get_yaml_from_header(header))\n\n        lines.extend([self.write_comment + line for line in header_yaml_lines])\n        lines.append(self.splitter.join([x.info.name for x in self.cols]))"},{"attributeType":"null","col":4,"comment":"null","endLoc":840,"id":4856,"name":"representation_component_names","nodeType":"Attribute","startLoc":840,"text":"representation_component_names"},{"col":0,"comment":"\n    This is a utility function to retrieve (and build/cache, if necessary)\n    a 3D cartesian KD-Tree from various sorts of astropy coordinate objects.\n\n    Parameters\n    ----------\n    coord : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The coordinates to build the KD-Tree for.\n    attrname_or_kdt : bool or str or KDTree\n        If a string, will store the KD-Tree used for the computation in the\n        ``coord``, in ``coord.cache`` with the provided name. If given as a\n        KD-Tree, it will just be used directly.\n    forceunit : unit or None\n        If a unit, the cartesian coordinates will convert to that unit before\n        being put in the KD-Tree.  If None, whatever unit it's already in\n        will be used\n\n    Returns\n    -------\n    kdt : `~scipy.spatial.cKDTree` or `~scipy.spatial.KDTree`\n        The KD-Tree representing the 3D cartesian representation of the input\n        coordinates.\n    ","endLoc":487,"header":"def _get_cartesian_kdtree(coord, attrname_or_kdt='kdtree', forceunit=None)","id":4857,"name":"_get_cartesian_kdtree","nodeType":"Function","startLoc":411,"text":"def _get_cartesian_kdtree(coord, attrname_or_kdt='kdtree', forceunit=None):\n    \"\"\"\n    This is a utility function to retrieve (and build/cache, if necessary)\n    a 3D cartesian KD-Tree from various sorts of astropy coordinate objects.\n\n    Parameters\n    ----------\n    coord : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The coordinates to build the KD-Tree for.\n    attrname_or_kdt : bool or str or KDTree\n        If a string, will store the KD-Tree used for the computation in the\n        ``coord``, in ``coord.cache`` with the provided name. If given as a\n        KD-Tree, it will just be used directly.\n    forceunit : unit or None\n        If a unit, the cartesian coordinates will convert to that unit before\n        being put in the KD-Tree.  If None, whatever unit it's already in\n        will be used\n\n    Returns\n    -------\n    kdt : `~scipy.spatial.cKDTree` or `~scipy.spatial.KDTree`\n        The KD-Tree representing the 3D cartesian representation of the input\n        coordinates.\n    \"\"\"\n    from warnings import warn\n\n    # without scipy this will immediately fail\n    from scipy import spatial\n    try:\n        KDTree = spatial.cKDTree\n    except Exception:\n        warn('C-based KD tree not found, falling back on (much slower) '\n             'python implementation')\n        KDTree = spatial.KDTree\n\n    if attrname_or_kdt is True:  # backwards compatibility for pre v0.4\n        attrname_or_kdt = 'kdtree'\n\n    # figure out where any cached KDTree might be\n    if isinstance(attrname_or_kdt, str):\n        kdt = coord.cache.get(attrname_or_kdt, None)\n        if kdt is not None and not isinstance(kdt, KDTree):\n            raise TypeError(f'The `attrname_or_kdt` \"{attrname_or_kdt}\" is not a scipy KD tree!')\n    elif isinstance(attrname_or_kdt, KDTree):\n        kdt = attrname_or_kdt\n        attrname_or_kdt = None\n    elif not attrname_or_kdt:\n        kdt = None\n    else:\n        raise TypeError('Invalid `attrname_or_kdt` argument for KD-Tree:' +\n                        str(attrname_or_kdt))\n\n    if kdt is None:\n        # need to build the cartesian KD-tree for the catalog\n        if forceunit is None:\n            cartxyz = coord.cartesian.xyz\n        else:\n            cartxyz = coord.cartesian.xyz.to(forceunit)\n        flatxyz = cartxyz.reshape((3, np.prod(cartxyz.shape) // 3))\n        # There should be no NaNs in the kdtree data.\n        if np.isnan(flatxyz.value).any():\n            raise ValueError(\"Catalog coordinates cannot contain NaN entries.\")\n        try:\n            # Set compact_nodes=False, balanced_tree=False to use\n            # \"sliding midpoint\" rule, which is much faster than standard for\n            # many common use cases\n            kdt = KDTree(flatxyz.value.T, compact_nodes=False, balanced_tree=False)\n        except TypeError:\n            # Python implementation does not take compact_nodes and balanced_tree\n            # as arguments.  However, it uses sliding midpoint rule by default\n            kdt = KDTree(flatxyz.value.T)\n\n    if attrname_or_kdt:\n        # cache the kdtree in `coord`\n        coord.cache[attrname_or_kdt] = kdt\n\n    return kdt"},{"attributeType":"null","col":4,"comment":"null","endLoc":842,"id":4858,"name":"representation_component_units","nodeType":"Attribute","startLoc":842,"text":"representation_component_units"},{"col":4,"comment":"WRITE: convert all values in table to a list of lists of strings\n\n        This sets the fill values and possibly column formats from the input\n        formats={} keyword, then ends up calling table.pprint._pformat_col_iter()\n        by a circuitous path. That function does the real work of formatting.\n        Finally replace anything matching the fill_values.\n\n        Returns\n        -------\n        values : list of list of str\n        ","endLoc":912,"header":"def str_vals(self)","id":4859,"name":"str_vals","nodeType":"Function","startLoc":895,"text":"def str_vals(self):\n        \"\"\"WRITE: convert all values in table to a list of lists of strings\n\n        This sets the fill values and possibly column formats from the input\n        formats={} keyword, then ends up calling table.pprint._pformat_col_iter()\n        by a circuitous path. That function does the real work of formatting.\n        Finally replace anything matching the fill_values.\n\n        Returns\n        -------\n        values : list of list of str\n        \"\"\"\n        self._set_fill_values(self.cols)\n        self._set_col_formats()\n        for col in self.cols:\n            col.str_vals = list(col.info.iter_str_vals())\n        self._replace_vals(self.cols)\n        return [col.str_vals for col in self.cols]"},{"col":4,"comment":"\n        READ: Strip out comment lines and blank lines from list of ``lines``\n\n        Parameters\n        ----------\n        lines : list\n            All lines in table\n\n        Returns\n        -------\n        lines : list\n            List of lines\n\n        ","endLoc":799,"header":"def process_lines(self, lines)","id":4860,"name":"process_lines","nodeType":"Function","startLoc":779,"text":"def process_lines(self, lines):\n        \"\"\"\n        READ: Strip out comment lines and blank lines from list of ``lines``\n\n        Parameters\n        ----------\n        lines : list\n            All lines in table\n\n        Returns\n        -------\n        lines : list\n            List of lines\n\n        \"\"\"\n        nonblank_lines = (x for x in lines if x.strip())\n        if self.comment:\n            re_comment = re.compile(self.comment)\n            return [x for x in nonblank_lines if not re_comment.match(x)]\n        else:\n            return [x for x in nonblank_lines]"},{"attributeType":"null","col":8,"comment":"null","endLoc":298,"id":4861,"name":"_representation","nodeType":"Attribute","startLoc":298,"text":"self._representation"},{"attributeType":"null","col":8,"comment":"null","endLoc":299,"id":4862,"name":"_data","nodeType":"Attribute","startLoc":299,"text":"self._data"},{"attributeType":"null","col":8,"comment":"null","endLoc":274,"id":4863,"name":"frame_attributes","nodeType":"Attribute","startLoc":274,"text":"cls.frame_attributes"},{"col":4,"comment":"READ, WRITE: Set fill values of individual cols based on fill_values of BaseData\n\n        fill values has the following form:\n        <fill_spec> = (<bad_value>, <fill_value>, <optional col_name>...)\n        fill_values = <fill_spec> or list of <fill_spec>'s\n\n        ","endLoc":871,"header":"def _set_fill_values(self, cols)","id":4864,"name":"_set_fill_values","nodeType":"Function","startLoc":829,"text":"def _set_fill_values(self, cols):\n        \"\"\"READ, WRITE: Set fill values of individual cols based on fill_values of BaseData\n\n        fill values has the following form:\n        <fill_spec> = (<bad_value>, <fill_value>, <optional col_name>...)\n        fill_values = <fill_spec> or list of <fill_spec>'s\n\n        \"\"\"\n        if self.fill_values:\n            # when we write tables the columns may be astropy.table.Columns\n            # which don't carry a fill_values by default\n            for col in cols:\n                if not hasattr(col, 'fill_values'):\n                    col.fill_values = {}\n\n            # if input is only one <fill_spec>, then make it a list\n            with suppress(TypeError):\n                self.fill_values[0] + ''\n                self.fill_values = [self.fill_values]\n\n            # Step 1: Set the default list of columns which are affected by\n            # fill_values\n            colnames = set(self.header.colnames)\n            if self.fill_include_names is not None:\n                colnames.intersection_update(self.fill_include_names)\n            if self.fill_exclude_names is not None:\n                colnames.difference_update(self.fill_exclude_names)\n\n            # Step 2a: Find out which columns are affected by this tuple\n            # iterate over reversed order, so last condition is set first and\n            # overwritten by earlier conditions\n            for replacement in reversed(self.fill_values):\n                if len(replacement) < 2:\n                    raise ValueError(\"Format of fill_values must be \"\n                                     \"(<bad>, <fill>, <optional col1>, ...)\")\n                elif len(replacement) == 2:\n                    affect_cols = colnames\n                else:\n                    affect_cols = replacement[2:]\n\n                for i, key in ((i, x) for i, x in enumerate(self.header.colnames)\n                               if x in affect_cols):\n                    cols[i].fill_values[replacement[0]] = str(replacement[1])"},{"attributeType":"null","col":8,"comment":"null","endLoc":296,"id":4865,"name":"_attr_names_with_defaults","nodeType":"Attribute","startLoc":296,"text":"self._attr_names_with_defaults"},{"attributeType":"null","col":12,"comment":"null","endLoc":278,"id":4866,"name":"name","nodeType":"Attribute","startLoc":278,"text":"cls.name"},{"attributeType":"null","col":8,"comment":"null","endLoc":290,"id":4867,"name":"_frame_class_cache","nodeType":"Attribute","startLoc":290,"text":"cls._frame_class_cache"},{"attributeType":"null","col":16,"comment":"null","endLoc":349,"id":4868,"name":"_no_data_shape","nodeType":"Attribute","startLoc":349,"text":"self._no_data_shape"},{"attributeType":"null","col":4,"comment":"null","endLoc":40,"id":4869,"name":"frame_specific_representation_info","nodeType":"Attribute","startLoc":40,"text":"frame_specific_representation_info"},{"col":4,"comment":"WRITE: set column formats.","endLoc":938,"header":"def _set_col_formats(self)","id":4870,"name":"_set_col_formats","nodeType":"Function","startLoc":934,"text":"def _set_col_formats(self):\n        \"\"\"WRITE: set column formats.\"\"\"\n        for col in self.cols:\n            if col.info.name in self.formats:\n                col.info.format = self.formats[col.info.name]"},{"attributeType":"null","col":4,"comment":"null","endLoc":47,"id":4871,"name":"default_representation","nodeType":"Attribute","startLoc":47,"text":"default_representation"},{"col":4,"comment":"WRITE: replace string values in col.str_vals","endLoc":893,"header":"def _replace_vals(self, cols)","id":4872,"name":"_replace_vals","nodeType":"Function","startLoc":883,"text":"def _replace_vals(self, cols):\n        \"\"\"WRITE: replace string values in col.str_vals\"\"\"\n        if self.fill_values:\n            for col in (col for col in cols if col.fill_values):\n                for i, str_val in ((i, x) for i, x in enumerate(col.str_vals)\n                                   if x in col.fill_values):\n                    col.str_vals[i] = col.fill_values[str_val]\n                if masked in col.fill_values and hasattr(col, 'mask'):\n                    mask_val = col.fill_values[masked]\n                    for i in col.mask.nonzero()[0]:\n                        col.str_vals[i] = mask_val"},{"attributeType":"null","col":4,"comment":"null","endLoc":48,"id":4873,"name":"default_differential","nodeType":"Attribute","startLoc":48,"text":"default_differential"},{"className":"BaseCoordType","col":0,"comment":"\n    This defines the base methods for coordinates, without defining anything\n    related to asdf types. This allows subclasses with different types and\n    schemas to use this without confusing the metaclass machinery.\n    ","endLoc":97,"id":4874,"nodeType":"Class","startLoc":44,"text":"class BaseCoordType:\n    \"\"\"\n    This defines the base methods for coordinates, without defining anything\n    related to asdf types. This allows subclasses with different types and\n    schemas to use this without confusing the metaclass machinery.\n    \"\"\"\n    @staticmethod\n    def _tag_to_frame(tag):\n        \"\"\"\n        Extract the frame name from the tag.\n        \"\"\"\n        tag = tag[tag.rfind('/')+1:]\n        tag = tag[:tag.rfind('-')]\n        return frame_transform_graph.lookup_name(tag)\n\n    @classmethod\n    def _frame_name_to_tag(cls, frame_name):\n        return cls.make_yaml_tag(cls._tag_prefix + frame_name)\n\n    @classmethod\n    def from_tree_tagged(cls, node, ctx):\n\n        frame = cls._tag_to_frame(node._tag)\n\n        data = node.get('data', None)\n        if data is not None:\n            return frame(node['data'], **node['frame_attributes'])\n\n        return frame(**node['frame_attributes'])\n\n    @classmethod\n    def to_tree_tagged(cls, frame, ctx):\n        if type(frame) not in frame_transform_graph.frame_set:\n            raise ValueError(\"Can only save frames that are registered with the \"\n                             \"transformation graph.\")\n\n        node = {}\n        if frame.has_data:\n            node['data'] = frame.data\n        frame_attributes = {}\n        for attr in frame.frame_attributes.keys():\n            value = getattr(frame, attr, None)\n            if value is not None:\n                frame_attributes[attr] = value\n        node['frame_attributes'] = frame_attributes\n\n        return tagged.tag_object(cls._frame_name_to_tag(frame.name), node, ctx=ctx)\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        assert isinstance(new, type(old))\n        if new.has_data:\n            assert u.allclose(new.data.lon, old.data.lon)\n            assert u.allclose(new.data.lat, old.data.lat)"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":4875,"name":"comment","nodeType":"Attribute","startLoc":18,"text":"comment"},{"attributeType":"null","col":8,"comment":"null","endLoc":88,"id":4876,"name":"names","nodeType":"Attribute","startLoc":88,"text":"self.names"},{"attributeType":"null","col":8,"comment":"null","endLoc":95,"id":4877,"name":"cols","nodeType":"Attribute","startLoc":95,"text":"self.cols"},{"className":"SExtractorData","col":0,"comment":"null","endLoc":106,"id":4878,"nodeType":"Class","startLoc":103,"text":"class SExtractorData(core.BaseData):\n    start_line = 0\n    delimiter = ' '\n    comment = r'\\s*#'"},{"col":4,"comment":"\n        Extract the frame name from the tag.\n        ","endLoc":57,"header":"@staticmethod\n    def _tag_to_frame(tag)","id":4879,"name":"_tag_to_frame","nodeType":"Function","startLoc":50,"text":"@staticmethod\n    def _tag_to_frame(tag):\n        \"\"\"\n        Extract the frame name from the tag.\n        \"\"\"\n        tag = tag[tag.rfind('/')+1:]\n        tag = tag[:tag.rfind('-')]\n        return frame_transform_graph.lookup_name(tag)"},{"attributeType":"null","col":4,"comment":"null","endLoc":104,"id":4880,"name":"start_line","nodeType":"Attribute","startLoc":104,"text":"start_line"},{"attributeType":"null","col":4,"comment":"null","endLoc":105,"id":4881,"name":"delimiter","nodeType":"Attribute","startLoc":105,"text":"delimiter"},{"attributeType":"null","col":4,"comment":"null","endLoc":106,"id":4882,"name":"comment","nodeType":"Attribute","startLoc":106,"text":"comment"},{"className":"SExtractor","col":0,"comment":"SExtractor format table.\n\n    SExtractor is a package for faint-galaxy photometry (Bertin & Arnouts\n    1996, A&A Supp. 317, 393.)\n\n    See: https://sextractor.readthedocs.io/en/latest/\n\n    Example::\n\n      # 1 NUMBER\n      # 2 ALPHA_J2000\n      # 3 DELTA_J2000\n      # 4 FLUX_RADIUS\n      # 7 MAG_AUTO [mag]\n      # 8 X2_IMAGE Variance along x [pixel**2]\n      # 9 X_MAMA Barycenter position along MAMA x axis [m**(-6)]\n      # 10 MU_MAX Peak surface brightness above background [mag * arcsec**(-2)]\n      1 32.23222 10.1211 0.8 1.2 1.4 18.1 1000.0 0.00304 -3.498\n      2 38.12321 -88.1321 2.2 2.4 3.1 17.0 1500.0 0.00908 1.401\n\n    Note the skipped numbers since flux_radius has 3 columns.  The three\n    FLUX_RADIUS columns will be named FLUX_RADIUS, FLUX_RADIUS_1, FLUX_RADIUS_2\n    Also note that a post-ID description (e.g. \"Variance along x\") is optional\n    and that units may be specified at the end of a line in brackets.\n\n    ","endLoc":156,"id":4883,"nodeType":"Class","startLoc":109,"text":"class SExtractor(core.BaseReader):\n    \"\"\"SExtractor format table.\n\n    SExtractor is a package for faint-galaxy photometry (Bertin & Arnouts\n    1996, A&A Supp. 317, 393.)\n\n    See: https://sextractor.readthedocs.io/en/latest/\n\n    Example::\n\n      # 1 NUMBER\n      # 2 ALPHA_J2000\n      # 3 DELTA_J2000\n      # 4 FLUX_RADIUS\n      # 7 MAG_AUTO [mag]\n      # 8 X2_IMAGE Variance along x [pixel**2]\n      # 9 X_MAMA Barycenter position along MAMA x axis [m**(-6)]\n      # 10 MU_MAX Peak surface brightness above background [mag * arcsec**(-2)]\n      1 32.23222 10.1211 0.8 1.2 1.4 18.1 1000.0 0.00304 -3.498\n      2 38.12321 -88.1321 2.2 2.4 3.1 17.0 1500.0 0.00908 1.401\n\n    Note the skipped numbers since flux_radius has 3 columns.  The three\n    FLUX_RADIUS columns will be named FLUX_RADIUS, FLUX_RADIUS_1, FLUX_RADIUS_2\n    Also note that a post-ID description (e.g. \"Variance along x\") is optional\n    and that units may be specified at the end of a line in brackets.\n\n    \"\"\"\n    _format_name = 'sextractor'\n    _io_registry_can_write = False\n    _description = 'SExtractor format table'\n\n    header_class = SExtractorHeader\n    data_class = SExtractorData\n    inputter_class = core.ContinuationLinesInputter\n\n    def read(self, table):\n        \"\"\"\n        Read input data (file-like object, filename, list of strings, or\n        single string) into a Table and return the result.\n        \"\"\"\n        out = super().read(table)\n        # remove the comments\n        if 'comments' in out.meta:\n            del out.meta['comments']\n        return out\n\n    def write(self, table):\n        raise NotImplementedError"},{"col":4,"comment":"\n        Read input data (file-like object, filename, list of strings, or\n        single string) into a Table and return the result.\n        ","endLoc":153,"header":"def read(self, table)","id":4884,"name":"read","nodeType":"Function","startLoc":144,"text":"def read(self, table):\n        \"\"\"\n        Read input data (file-like object, filename, list of strings, or\n        single string) into a Table and return the result.\n        \"\"\"\n        out = super().read(table)\n        # remove the comments\n        if 'comments' in out.meta:\n            del out.meta['comments']\n        return out"},{"col":4,"comment":"null","endLoc":61,"header":"@classmethod\n    def _frame_name_to_tag(cls, frame_name)","id":4885,"name":"_frame_name_to_tag","nodeType":"Function","startLoc":59,"text":"@classmethod\n    def _frame_name_to_tag(cls, frame_name):\n        return cls.make_yaml_tag(cls._tag_prefix + frame_name)"},{"col":4,"comment":"READ: Set ``data_lines`` attribute to lines slice comprising table data values.\n        ","endLoc":811,"header":"def get_data_lines(self, lines)","id":4886,"name":"get_data_lines","nodeType":"Function","startLoc":801,"text":"def get_data_lines(self, lines):\n        \"\"\"READ: Set ``data_lines`` attribute to lines slice comprising table data values.\n        \"\"\"\n        data_lines = self.process_lines(lines)\n        start_line = _get_line_index(self.start_line, data_lines)\n        end_line = _get_line_index(self.end_line, data_lines)\n\n        if start_line is not None or end_line is not None:\n            self.data_lines = data_lines[slice(start_line, end_line)]\n        else:  # Don't copy entire data lines unless necessary\n            self.data_lines = data_lines"},{"col":4,"comment":"null","endLoc":72,"header":"@classmethod\n    def from_tree_tagged(cls, node, ctx)","id":4887,"name":"from_tree_tagged","nodeType":"Function","startLoc":63,"text":"@classmethod\n    def from_tree_tagged(cls, node, ctx):\n\n        frame = cls._tag_to_frame(node._tag)\n\n        data = node.get('data', None)\n        if data is not None:\n            return frame(node['data'], **node['frame_attributes'])\n\n        return frame(**node['frame_attributes'])"},{"col":4,"comment":"Return a generator that returns a list of column values (as strings)\n        for each data line.","endLoc":816,"header":"def get_str_vals(self)","id":4888,"name":"get_str_vals","nodeType":"Function","startLoc":813,"text":"def get_str_vals(self):\n        \"\"\"Return a generator that returns a list of column values (as strings)\n        for each data line.\"\"\"\n        return self.splitter(self.data_lines)"},{"col":4,"comment":"READ: Set fill value for each column and then apply that fill value\n\n        In the first step it is evaluated with value from ``fill_values`` applies to\n        which column using ``fill_include_names`` and ``fill_exclude_names``.\n        In the second step all replacements are done for the appropriate columns.\n        ","endLoc":827,"header":"def masks(self, cols)","id":4889,"name":"masks","nodeType":"Function","startLoc":818,"text":"def masks(self, cols):\n        \"\"\"READ: Set fill value for each column and then apply that fill value\n\n        In the first step it is evaluated with value from ``fill_values`` applies to\n        which column using ``fill_include_names`` and ``fill_exclude_names``.\n        In the second step all replacements are done for the appropriate columns.\n        \"\"\"\n        if self.fill_values:\n            self._set_fill_values(cols)\n            self._set_masks(cols)"},{"col":4,"comment":"null","endLoc":90,"header":"@classmethod\n    def to_tree_tagged(cls, frame, ctx)","id":4890,"name":"to_tree_tagged","nodeType":"Function","startLoc":74,"text":"@classmethod\n    def to_tree_tagged(cls, frame, ctx):\n        if type(frame) not in frame_transform_graph.frame_set:\n            raise ValueError(\"Can only save frames that are registered with the \"\n                             \"transformation graph.\")\n\n        node = {}\n        if frame.has_data:\n            node['data'] = frame.data\n        frame_attributes = {}\n        for attr in frame.frame_attributes.keys():\n            value = getattr(frame, attr, None)\n            if value is not None:\n                frame_attributes[attr] = value\n        node['frame_attributes'] = frame_attributes\n\n        return tagged.tag_object(cls._frame_name_to_tag(frame.name), node, ctx=ctx)"},{"col":4,"comment":"null","endLoc":156,"header":"def write(self, table)","id":4891,"name":"write","nodeType":"Function","startLoc":155,"text":"def write(self, table):\n        raise NotImplementedError"},{"attributeType":"null","col":4,"comment":"null","endLoc":136,"id":4892,"name":"_format_name","nodeType":"Attribute","startLoc":136,"text":"_format_name"},{"col":4,"comment":"READ: Replace string values in col.str_vals and set masks","endLoc":881,"header":"def _set_masks(self, cols)","id":4893,"name":"_set_masks","nodeType":"Function","startLoc":873,"text":"def _set_masks(self, cols):\n        \"\"\"READ: Replace string values in col.str_vals and set masks\"\"\"\n        if self.fill_values:\n            for col in (col for col in cols if col.fill_values):\n                col.mask = numpy.zeros(len(col.str_vals), dtype=bool)\n                for i, str_val in ((i, x) for i, x in enumerate(col.str_vals)\n                                   if x in col.fill_values):\n                    col.str_vals[i] = col.fill_values[str_val]\n                    col.mask[i] = True"},{"attributeType":"null","col":4,"comment":"null","endLoc":137,"id":4894,"name":"_io_registry_can_write","nodeType":"Attribute","startLoc":137,"text":"_io_registry_can_write"},{"attributeType":"null","col":4,"comment":"null","endLoc":138,"id":4895,"name":"_description","nodeType":"Attribute","startLoc":138,"text":"_description"},{"col":4,"comment":"Write ``self.cols`` in place to ``lines``.\n\n        Parameters\n        ----------\n        lines : list\n            List for collecting output of writing self.cols.\n        ","endLoc":932,"header":"def write(self, lines)","id":4896,"name":"write","nodeType":"Function","startLoc":914,"text":"def write(self, lines):\n        \"\"\"Write ``self.cols`` in place to ``lines``.\n\n        Parameters\n        ----------\n        lines : list\n            List for collecting output of writing self.cols.\n        \"\"\"\n        if hasattr(self.start_line, '__call__'):\n            raise TypeError('Start_line attribute cannot be callable for write()')\n        else:\n            data_start_line = self.start_line or 0\n\n        while len(lines) < data_start_line:\n            lines.append(itertools.cycle(self.write_spacer_lines))\n\n        col_str_iters = self.str_vals()\n        for vals in zip(*col_str_iters):\n            lines.append(self.splitter.join(vals))"},{"attributeType":"SExtractorHeader","col":4,"comment":"null","endLoc":140,"id":4897,"name":"header_class","nodeType":"Attribute","startLoc":140,"text":"header_class"},{"attributeType":"SExtractorData","col":4,"comment":"null","endLoc":141,"id":4898,"name":"data_class","nodeType":"Attribute","startLoc":141,"text":"data_class"},{"col":4,"comment":"\n        Finds the nearest 3-dimensional matches of this coordinate to a set\n        of catalog coordinates.\n\n        This finds the 3-dimensional closest neighbor, which is only different\n        from the on-sky distance if ``distance`` is set in this object or the\n        ``catalogcoord`` object.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        catalogcoord : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The base catalog in which to search for matches. Typically this\n            will be a coordinate object that is an array (i.e.,\n            ``catalogcoord.isscalar == False``)\n        nthneighbor : int, optional\n            Which closest neighbor to search for.  Typically ``1`` is\n            desired here, as that is correct for matching one set of\n            coordinates to another.  The next likely use case is\n            ``2``, for matching a coordinate catalog against *itself*\n            (``1`` is inappropriate because each point will find\n            itself as the closest match).\n\n        Returns\n        -------\n        idx : int array\n            Indices into ``catalogcoord`` to get the matched points for\n            each of this object's coordinates. Shape matches this\n            object.\n        sep2d : `~astropy.coordinates.Angle`\n            The on-sky separation between the closest match for each\n            element in this object in ``catalogcoord``. Shape matches\n            this object.\n        dist3d : `~astropy.units.Quantity` ['length']\n            The 3D distance between the closest match for each element\n            in this object in ``catalogcoord``. Shape matches this\n            object.\n\n        Notes\n        -----\n        This method requires `SciPy <https://www.scipy.org/>`_ to be\n        installed or it will fail.\n\n        See Also\n        --------\n        astropy.coordinates.match_coordinates_3d\n        SkyCoord.match_to_catalog_sky\n        ","endLoc":1451,"header":"def match_to_catalog_3d(self, catalogcoord, nthneighbor=1)","id":4899,"name":"match_to_catalog_3d","nodeType":"Function","startLoc":1389,"text":"def match_to_catalog_3d(self, catalogcoord, nthneighbor=1):\n        \"\"\"\n        Finds the nearest 3-dimensional matches of this coordinate to a set\n        of catalog coordinates.\n\n        This finds the 3-dimensional closest neighbor, which is only different\n        from the on-sky distance if ``distance`` is set in this object or the\n        ``catalogcoord`` object.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        catalogcoord : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The base catalog in which to search for matches. Typically this\n            will be a coordinate object that is an array (i.e.,\n            ``catalogcoord.isscalar == False``)\n        nthneighbor : int, optional\n            Which closest neighbor to search for.  Typically ``1`` is\n            desired here, as that is correct for matching one set of\n            coordinates to another.  The next likely use case is\n            ``2``, for matching a coordinate catalog against *itself*\n            (``1`` is inappropriate because each point will find\n            itself as the closest match).\n\n        Returns\n        -------\n        idx : int array\n            Indices into ``catalogcoord`` to get the matched points for\n            each of this object's coordinates. Shape matches this\n            object.\n        sep2d : `~astropy.coordinates.Angle`\n            The on-sky separation between the closest match for each\n            element in this object in ``catalogcoord``. Shape matches\n            this object.\n        dist3d : `~astropy.units.Quantity` ['length']\n            The 3D distance between the closest match for each element\n            in this object in ``catalogcoord``. Shape matches this\n            object.\n\n        Notes\n        -----\n        This method requires `SciPy <https://www.scipy.org/>`_ to be\n        installed or it will fail.\n\n        See Also\n        --------\n        astropy.coordinates.match_coordinates_3d\n        SkyCoord.match_to_catalog_sky\n        \"\"\"\n        from .matching import match_coordinates_3d\n\n        if not (isinstance(catalogcoord, (SkyCoord, BaseCoordinateFrame))\n                and catalogcoord.has_data):\n            raise TypeError('Can only get separation to another SkyCoord or a '\n                            'coordinate frame with data')\n\n        res = match_coordinates_3d(self, catalogcoord,\n                                   nthneighbor=nthneighbor,\n                                   storekdtree='_kdtree_3d')\n\n        return res"},{"col":4,"comment":"null","endLoc":97,"header":"@classmethod\n    def assert_equal(cls, old, new)","id":4900,"name":"assert_equal","nodeType":"Function","startLoc":92,"text":"@classmethod\n    def assert_equal(cls, old, new):\n        assert isinstance(new, type(old))\n        if new.has_data:\n            assert u.allclose(new.data.lon, old.data.lon)\n            assert u.allclose(new.data.lat, old.data.lat)"},{"col":4,"comment":"\n        Searches for all coordinates in this object around a supplied set of\n        points within a given on-sky separation.\n\n        This is intended for use on `~astropy.coordinates.SkyCoord` objects\n        with coordinate arrays, rather than a scalar coordinate.  For a scalar\n        coordinate, it is better to use\n        `~astropy.coordinates.SkyCoord.separation`.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        searcharoundcoords : coordinate-like\n            The coordinates to search around to try to find matching points in\n            this `SkyCoord`. This should be an object with array coordinates,\n            not a scalar coordinate object.\n        seplimit : `~astropy.units.Quantity` ['angle']\n            The on-sky separation to search within.\n\n        Returns\n        -------\n        idxsearcharound : int array\n            Indices into ``searcharoundcoords`` that match the\n            corresponding elements of ``idxself``. Shape matches\n            ``idxself``.\n        idxself : int array\n            Indices into ``self`` that match the\n            corresponding elements of ``idxsearcharound``. Shape matches\n            ``idxsearcharound``.\n        sep2d : `~astropy.coordinates.Angle`\n            The on-sky separation between the coordinates. Shape matches\n            ``idxsearcharound`` and ``idxself``.\n        dist3d : `~astropy.units.Quantity` ['length']\n            The 3D distance between the coordinates. Shape matches\n            ``idxsearcharound`` and ``idxself``.\n\n        Notes\n        -----\n        This method requires `SciPy <https://www.scipy.org/>`_ to be\n        installed or it will fail.\n\n        In the current implementation, the return values are always sorted in\n        the same order as the ``searcharoundcoords`` (so ``idxsearcharound`` is\n        in ascending order).  This is considered an implementation detail,\n        though, so it could change in a future release.\n\n        See Also\n        --------\n        astropy.coordinates.search_around_sky\n        SkyCoord.search_around_3d\n        ","endLoc":1510,"header":"def search_around_sky(self, searcharoundcoords, seplimit)","id":4901,"name":"search_around_sky","nodeType":"Function","startLoc":1453,"text":"def search_around_sky(self, searcharoundcoords, seplimit):\n        \"\"\"\n        Searches for all coordinates in this object around a supplied set of\n        points within a given on-sky separation.\n\n        This is intended for use on `~astropy.coordinates.SkyCoord` objects\n        with coordinate arrays, rather than a scalar coordinate.  For a scalar\n        coordinate, it is better to use\n        `~astropy.coordinates.SkyCoord.separation`.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        searcharoundcoords : coordinate-like\n            The coordinates to search around to try to find matching points in\n            this `SkyCoord`. This should be an object with array coordinates,\n            not a scalar coordinate object.\n        seplimit : `~astropy.units.Quantity` ['angle']\n            The on-sky separation to search within.\n\n        Returns\n        -------\n        idxsearcharound : int array\n            Indices into ``searcharoundcoords`` that match the\n            corresponding elements of ``idxself``. Shape matches\n            ``idxself``.\n        idxself : int array\n            Indices into ``self`` that match the\n            corresponding elements of ``idxsearcharound``. Shape matches\n            ``idxsearcharound``.\n        sep2d : `~astropy.coordinates.Angle`\n            The on-sky separation between the coordinates. Shape matches\n            ``idxsearcharound`` and ``idxself``.\n        dist3d : `~astropy.units.Quantity` ['length']\n            The 3D distance between the coordinates. Shape matches\n            ``idxsearcharound`` and ``idxself``.\n\n        Notes\n        -----\n        This method requires `SciPy <https://www.scipy.org/>`_ to be\n        installed or it will fail.\n\n        In the current implementation, the return values are always sorted in\n        the same order as the ``searcharoundcoords`` (so ``idxsearcharound`` is\n        in ascending order).  This is considered an implementation detail,\n        though, so it could change in a future release.\n\n        See Also\n        --------\n        astropy.coordinates.search_around_sky\n        SkyCoord.search_around_3d\n        \"\"\"\n        from .matching import search_around_sky\n\n        return search_around_sky(searcharoundcoords, self, seplimit,\n                                 storekdtree='_kdtree_sky')"},{"attributeType":"null","col":4,"comment":" None, int, or a function of ``lines`` that returns None or int ","endLoc":756,"id":4902,"name":"start_line","nodeType":"Attribute","startLoc":756,"text":"start_line"},{"attributeType":"null","col":4,"comment":" None, int, or a function of ``lines`` that returns None or int ","endLoc":758,"id":4903,"name":"end_line","nodeType":"Attribute","startLoc":758,"text":"end_line"},{"attributeType":"null","col":4,"comment":" Regular expression for comment lines ","endLoc":760,"id":4904,"name":"comment","nodeType":"Attribute","startLoc":760,"text":"comment"},{"attributeType":"null","col":4,"comment":" Splitter class for splitting data lines into columns ","endLoc":762,"id":4905,"name":"splitter_class","nodeType":"Attribute","startLoc":762,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":764,"id":4906,"name":"write_spacer_lines","nodeType":"Attribute","startLoc":764,"text":"write_spacer_lines"},{"col":0,"comment":"\n    Searches for pairs of points that have an angular separation at least as\n    close as a specified angle.\n\n    This is intended for use on coordinate objects with arrays of coordinates,\n    not scalars.  For scalar coordinates, it is better to use the ``separation``\n    methods.\n\n    Parameters\n    ----------\n    coords1 : coordinate-like\n        The first set of coordinates, which will be searched for matches from\n        ``coords2`` within ``seplimit``. Cannot be a scalar coordinate.\n    coords2 : coordinate-like\n        The second set of coordinates, which will be searched for matches from\n        ``coords1`` within ``seplimit``. Cannot be a scalar coordinate.\n    seplimit : `~astropy.units.Quantity` ['angle']\n        The on-sky separation to search within.\n    storekdtree : bool or str, optional\n        If a string, will store the KD-Tree used in the search with the name\n        ``storekdtree`` in ``coords2.cache``. This speeds up subsequent calls\n        to this function. If False, the KD-Trees are not saved.\n\n    Returns\n    -------\n    idx1 : int array\n        Indices into ``coords1`` that matches to the corresponding element of\n        ``idx2``. Shape matches ``idx2``.\n    idx2 : int array\n        Indices into ``coords2`` that matches to the corresponding element of\n        ``idx1``. Shape matches ``idx1``.\n    sep2d : `~astropy.coordinates.Angle`\n        The on-sky separation between the coordinates. Shape matches ``idx1``\n        and ``idx2``.\n    dist3d : `~astropy.units.Quantity` ['length']\n        The 3D distance between the coordinates. Shape matches ``idx1``\n        and ``idx2``; the unit is that of ``coords1``.\n        If either ``coords1`` or ``coords2`` don't have a distance,\n        this is the 3D distance on the unit sphere, rather than a\n        physical distance.\n\n    Notes\n    -----\n    This function requires `SciPy <https://www.scipy.org/>`_\n    to be installed or it will fail.\n\n    In the current implementation, the return values are always sorted in the\n    same order as the ``coords1`` (so ``idx1`` is in ascending order).  This is\n    considered an implementation detail, though, so it could change in a future\n    release.\n    ","endLoc":408,"header":"def search_around_sky(coords1, coords2, seplimit, storekdtree='kdtree_sky')","id":4907,"name":"search_around_sky","nodeType":"Function","startLoc":284,"text":"def search_around_sky(coords1, coords2, seplimit, storekdtree='kdtree_sky'):\n    \"\"\"\n    Searches for pairs of points that have an angular separation at least as\n    close as a specified angle.\n\n    This is intended for use on coordinate objects with arrays of coordinates,\n    not scalars.  For scalar coordinates, it is better to use the ``separation``\n    methods.\n\n    Parameters\n    ----------\n    coords1 : coordinate-like\n        The first set of coordinates, which will be searched for matches from\n        ``coords2`` within ``seplimit``. Cannot be a scalar coordinate.\n    coords2 : coordinate-like\n        The second set of coordinates, which will be searched for matches from\n        ``coords1`` within ``seplimit``. Cannot be a scalar coordinate.\n    seplimit : `~astropy.units.Quantity` ['angle']\n        The on-sky separation to search within.\n    storekdtree : bool or str, optional\n        If a string, will store the KD-Tree used in the search with the name\n        ``storekdtree`` in ``coords2.cache``. This speeds up subsequent calls\n        to this function. If False, the KD-Trees are not saved.\n\n    Returns\n    -------\n    idx1 : int array\n        Indices into ``coords1`` that matches to the corresponding element of\n        ``idx2``. Shape matches ``idx2``.\n    idx2 : int array\n        Indices into ``coords2`` that matches to the corresponding element of\n        ``idx1``. Shape matches ``idx1``.\n    sep2d : `~astropy.coordinates.Angle`\n        The on-sky separation between the coordinates. Shape matches ``idx1``\n        and ``idx2``.\n    dist3d : `~astropy.units.Quantity` ['length']\n        The 3D distance between the coordinates. Shape matches ``idx1``\n        and ``idx2``; the unit is that of ``coords1``.\n        If either ``coords1`` or ``coords2`` don't have a distance,\n        this is the 3D distance on the unit sphere, rather than a\n        physical distance.\n\n    Notes\n    -----\n    This function requires `SciPy <https://www.scipy.org/>`_\n    to be installed or it will fail.\n\n    In the current implementation, the return values are always sorted in the\n    same order as the ``coords1`` (so ``idx1`` is in ascending order).  This is\n    considered an implementation detail, though, so it could change in a future\n    release.\n    \"\"\"\n    if not seplimit.isscalar:\n        raise ValueError('seplimit must be a scalar in search_around_sky')\n\n    if coords1.isscalar or coords2.isscalar:\n        raise ValueError('One of the inputs to search_around_sky is a scalar. '\n                         'search_around_sky is intended for use with array '\n                         'coordinates, not scalars.  Instead, use '\n                         '``coord1.separation(coord2) < seplimit`` to find the '\n                         'coordinates near a scalar coordinate.')\n\n    if len(coords1) == 0 or len(coords2) == 0:\n        # Empty array input: return empty match\n        if coords2.distance.unit == u.dimensionless_unscaled:\n            distunit = u.dimensionless_unscaled\n        else:\n            distunit = coords1.distance.unit\n        return (np.array([], dtype=int), np.array([], dtype=int),\n                Angle([], u.deg),\n                u.Quantity([], distunit))\n\n    # we convert coord1 to match coord2's frame.  We do it this way\n    # so that if the conversion does happen, the KD tree of coord2 at least gets\n    # saved. (by convention, coord2 is the \"catalog\" if that makes sense)\n    coords1 = coords1.transform_to(coords2)\n\n    # strip out distance info\n    urepr1 = coords1.data.represent_as(UnitSphericalRepresentation)\n    ucoords1 = coords1.realize_frame(urepr1)\n\n    kdt1 = _get_cartesian_kdtree(ucoords1, storekdtree)\n\n    if storekdtree and coords2.cache.get(storekdtree):\n        # just use the stored KD-Tree\n        kdt2 = coords2.cache[storekdtree]\n    else:\n        # strip out distance info\n        urepr2 = coords2.data.represent_as(UnitSphericalRepresentation)\n        ucoords2 = coords2.realize_frame(urepr2)\n\n        kdt2 = _get_cartesian_kdtree(ucoords2, storekdtree)\n        if storekdtree:\n            # save the KD-Tree in coords2, *not* ucoords2\n            coords2.cache['kdtree' if storekdtree is True else storekdtree] = kdt2\n\n    # this is the *cartesian* 3D distance that corresponds to the given angle\n    r = (2 * np.sin(Angle(seplimit) / 2.0)).value\n\n    idxs1 = []\n    idxs2 = []\n    for i, matches in enumerate(kdt1.query_ball_tree(kdt2, r)):\n        for match in matches:\n            idxs1.append(i)\n            idxs2.append(match)\n    idxs1 = np.array(idxs1, dtype=int)\n    idxs2 = np.array(idxs2, dtype=int)\n\n    if idxs1.size == 0:\n        if coords2.distance.unit == u.dimensionless_unscaled:\n            distunit = u.dimensionless_unscaled\n        else:\n            distunit = coords1.distance.unit\n        d2ds = Angle([], u.deg)\n        d3ds = u.Quantity([], distunit)\n    else:\n        d2ds = coords1[idxs1].separation(coords2[idxs2])\n        try:\n            d3ds = coords1[idxs1].separation_3d(coords2[idxs2])\n        except ValueError:\n            # they don't have distances, so we just fall back on the cartesian\n            # distance, computed from d2ds\n            d3ds = 2 * np.sin(d2ds / 2.0)\n\n    return idxs1, idxs2, d2ds, d3ds"},{"attributeType":"null","col":4,"comment":"null","endLoc":765,"id":4908,"name":"fill_include_names","nodeType":"Attribute","startLoc":765,"text":"fill_include_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":766,"id":4909,"name":"fill_exclude_names","nodeType":"Attribute","startLoc":766,"text":"fill_exclude_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":767,"id":4910,"name":"fill_values","nodeType":"Attribute","startLoc":767,"text":"fill_values"},{"attributeType":"null","col":4,"comment":"null","endLoc":768,"id":4911,"name":"formats","nodeType":"Attribute","startLoc":768,"text":"formats"},{"attributeType":"null","col":8,"comment":"null","endLoc":776,"id":4912,"name":"formats","nodeType":"Attribute","startLoc":776,"text":"self.formats"},{"attributeType":"null","col":12,"comment":"null","endLoc":809,"id":4913,"name":"data_lines","nodeType":"Attribute","startLoc":809,"text":"self.data_lines"},{"attributeType":"null","col":8,"comment":"null","endLoc":777,"id":4914,"name":"splitter","nodeType":"Attribute","startLoc":777,"text":"self.splitter"},{"attributeType":"null","col":8,"comment":"null","endLoc":775,"id":4915,"name":"fill_values","nodeType":"Attribute","startLoc":775,"text":"self.fill_values"},{"className":"CoordType","col":0,"comment":"null","endLoc":106,"id":4916,"nodeType":"Class","startLoc":100,"text":"class CoordType(BaseCoordType, AstropyType):\n    _tag_prefix = \"coordinates/frames/\"\n    name = [\"coordinates/frames/\" + f for f in _get_frames()]\n    types = [astropy.coordinates.BaseCoordinateFrame]\n    handle_dynamic_subclasses = True\n    requires = ['astropy']\n    version = \"1.0.0\""},{"attributeType":"null","col":4,"comment":"null","endLoc":101,"id":4917,"name":"_tag_prefix","nodeType":"Attribute","startLoc":101,"text":"_tag_prefix"},{"col":4,"comment":"\n        Return the line number at which table data begins.\n        ","endLoc":234,"header":"def start_line(self, lines)","id":4918,"name":"start_line","nodeType":"Function","startLoc":218,"text":"def start_line(self, lines):\n        \"\"\"\n        Return the line number at which table data begins.\n        \"\"\"\n\n        for i, line in enumerate(lines):\n            if not isinstance(line, SoupString):\n                raise TypeError('HTML lines should be of type SoupString')\n            soup = line.soup\n\n            if soup.td is not None:\n                if soup.th is not None:\n                    raise core.InconsistentTableError('HTML tables cannot '\n                                                      'have headings and data in the same row')\n                return i\n\n        raise core.InconsistentTableError('No start line found for HTML data')"},{"attributeType":"null","col":4,"comment":"null","endLoc":102,"id":4919,"name":"name","nodeType":"Attribute","startLoc":102,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":103,"id":4920,"name":"types","nodeType":"Attribute","startLoc":103,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":104,"id":4921,"name":"handle_dynamic_subclasses","nodeType":"Attribute","startLoc":104,"text":"handle_dynamic_subclasses"},{"attributeType":"null","col":4,"comment":"null","endLoc":105,"id":4922,"name":"requires","nodeType":"Attribute","startLoc":105,"text":"requires"},{"attributeType":"null","col":4,"comment":"null","endLoc":106,"id":4923,"name":"version","nodeType":"Attribute","startLoc":106,"text":"version"},{"className":"ICRSType","col":0,"comment":"\n    Define a special tag for ICRS so we can make it version 1.1.0.\n    ","endLoc":115,"id":4924,"nodeType":"Class","startLoc":109,"text":"class ICRSType(CoordType):\n    \"\"\"\n    Define a special tag for ICRS so we can make it version 1.1.0.\n    \"\"\"\n    name = \"coordinates/frames/icrs\"\n    types = ['astropy.coordinates.ICRS']\n    version = \"1.1.0\""},{"attributeType":"null","col":4,"comment":"null","endLoc":113,"id":4925,"name":"name","nodeType":"Attribute","startLoc":113,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":114,"id":4926,"name":"types","nodeType":"Attribute","startLoc":114,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":115,"id":4927,"name":"version","nodeType":"Attribute","startLoc":115,"text":"version"},{"className":"ICRSType10","col":0,"comment":"null","endLoc":157,"id":4928,"nodeType":"Class","startLoc":118,"text":"class ICRSType10(AstropyType):\n    name = \"coordinates/frames/icrs\"\n    types = [astropy.coordinates.ICRS]\n    requires = ['astropy']\n    version = \"1.0.0\"\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        wrap_angle = Angle(node['ra']['wrap_angle'])\n        ra = Longitude(\n            node['ra']['value'],\n            unit=node['ra']['unit'],\n            wrap_angle=wrap_angle)\n        dec = Latitude(node['dec']['value'], unit=node['dec']['unit'])\n\n        return ICRS(ra=ra, dec=dec)\n\n    @classmethod\n    def to_tree(cls, frame, ctx):\n        node = {}\n\n        wrap_angle = Quantity(frame.ra.wrap_angle)\n        node['ra'] = {\n            'value': frame.ra.value,\n            'unit': frame.ra.unit.to_string(),\n            'wrap_angle': wrap_angle\n        }\n        node['dec'] = {\n            'value': frame.dec.value,\n            'unit': frame.dec.unit.to_string()\n        }\n\n        return node\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        assert isinstance(old, ICRS)\n        assert isinstance(new, ICRS)\n        assert u.allclose(new.ra, old.ra)\n        assert u.allclose(new.dec, old.dec)"},{"col":4,"comment":"null","endLoc":133,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":4929,"name":"from_tree","nodeType":"Function","startLoc":124,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        wrap_angle = Angle(node['ra']['wrap_angle'])\n        ra = Longitude(\n            node['ra']['value'],\n            unit=node['ra']['unit'],\n            wrap_angle=wrap_angle)\n        dec = Latitude(node['dec']['value'], unit=node['dec']['unit'])\n\n        return ICRS(ra=ra, dec=dec)"},{"attributeType":"null","col":4,"comment":" Splitter class for splitting data lines into columns ","endLoc":238,"id":4930,"name":"splitter_class","nodeType":"Attribute","startLoc":238,"text":"splitter_class"},{"className":"FixedWidthHeader","col":0,"comment":"\n    Fixed width table header reader.\n    ","endLoc":231,"id":4931,"nodeType":"Class","startLoc":64,"text":"class FixedWidthHeader(basic.BasicHeader):\n    \"\"\"\n    Fixed width table header reader.\n    \"\"\"\n    splitter_class = FixedWidthHeaderSplitter\n    \"\"\" Splitter class for splitting data lines into columns \"\"\"\n    position_line = None   # secondary header line position\n    \"\"\" row index of line that specifies position (default = 1) \"\"\"\n    set_of_position_line_characters = set(r'`~!#$%^&*-_+=\\|\":' + \"'\")\n\n    def get_line(self, lines, index):\n        for i, line in enumerate(self.process_lines(lines)):\n            if i == index:\n                break\n        else:  # No header line matching\n            raise InconsistentTableError('No header line found in table')\n        return line\n\n    def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines``.\n\n        Based on the previously set Header attributes find or create the column names.\n        Sets ``self.cols`` with the list of Columns.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n\n        # See \"else\" clause below for explanation of start_line and position_line\n        start_line = core._get_line_index(self.start_line, self.process_lines(lines))\n        position_line = core._get_line_index(self.position_line, self.process_lines(lines))\n\n        # If start_line is none then there is no header line.  Column positions are\n        # determined from first data line and column names are either supplied by user\n        # or auto-generated.\n        if start_line is None:\n            if position_line is not None:\n                raise ValueError(\"Cannot set position_line without also setting header_start\")\n\n            # data.data_lines attribute already set via self.data.get_data_lines(lines)\n            # in BaseReader.read().  This includes slicing for data_start / data_end.\n            data_lines = self.data.data_lines\n\n            if not data_lines:\n                raise InconsistentTableError(\n                    'No data lines found so cannot autogenerate column names')\n            vals, starts, ends = self.get_fixedwidth_params(data_lines[0])\n\n            self.names = [self.auto_format.format(i)\n                          for i in range(1, len(vals) + 1)]\n\n        else:\n            # This bit of code handles two cases:\n            # start_line = <index> and position_line = None\n            #    Single header line where that line is used to determine both the\n            #    column positions and names.\n            # start_line = <index> and position_line = <index2>\n            #    Two header lines where the first line defines the column names and\n            #    the second line defines the column positions\n\n            if position_line is not None:\n                # Define self.col_starts and self.col_ends so that the call to\n                # get_fixedwidth_params below will use those to find the header\n                # column names.  Note that get_fixedwidth_params returns Python\n                # slice col_ends but expects inclusive col_ends on input (for\n                # more intuitive user interface).\n                line = self.get_line(lines, position_line)\n                if len(set(line) - set([self.splitter.delimiter, ' '])) != 1:\n                    raise InconsistentTableError(\n                        'Position line should only contain delimiters and '\n                        'one other character, e.g. \"--- ------- ---\".')\n                    # The line above lies. It accepts white space as well.\n                    # We don't want to encourage using three different\n                    # characters, because that can cause ambiguities, but white\n                    # spaces are so common everywhere that practicality beats\n                    # purity here.\n                charset = self.set_of_position_line_characters.union(\n                    set([self.splitter.delimiter, ' ']))\n                if not set(line).issubset(charset):\n                    raise InconsistentTableError(\n                        f'Characters in position line must be part of {charset}')\n                vals, self.col_starts, col_ends = self.get_fixedwidth_params(line)\n                self.col_ends = [x - 1 if x is not None else None for x in col_ends]\n\n            # Get the header column names and column positions\n            line = self.get_line(lines, start_line)\n            vals, starts, ends = self.get_fixedwidth_params(line)\n\n            self.names = vals\n\n        self._set_cols_from_names()\n\n        # Set column start and end positions.\n        for i, col in enumerate(self.cols):\n            col.start = starts[i]\n            col.end = ends[i]\n\n    def get_fixedwidth_params(self, line):\n        \"\"\"\n        Split ``line`` on the delimiter and determine column values and\n        column start and end positions.  This might include null columns with\n        zero length (e.g. for ``header row = \"| col1 || col2 | col3 |\"`` or\n        ``header2_row = \"----- ------- -----\"``).  The null columns are\n        stripped out.  Returns the values between delimiters and the\n        corresponding start and end positions.\n\n        Parameters\n        ----------\n        line : str\n            Input line\n\n        Returns\n        -------\n        vals : list\n            List of values.\n        starts : list\n            List of starting indices.\n        ends : list\n            List of ending indices.\n\n        \"\"\"\n\n        # If column positions are already specified then just use those.\n        # If neither column starts or ends are given, figure out positions\n        # between delimiters. Otherwise, either the starts or the ends have\n        # been given, so figure out whichever wasn't given.\n        if self.col_starts is not None and self.col_ends is not None:\n            starts = list(self.col_starts)  # could be any iterable, e.g. np.array\n            # user supplies inclusive endpoint\n            ends = [x + 1 if x is not None else None for x in self.col_ends]\n            if len(starts) != len(ends):\n                raise ValueError('Fixed width col_starts and col_ends must have the same length')\n            vals = [line[start:end].strip() for start, end in zip(starts, ends)]\n        elif self.col_starts is None and self.col_ends is None:\n            # There might be a cleaner way to do this but it works...\n            vals = line.split(self.splitter.delimiter)\n            starts = [0]\n            ends = []\n            for val in vals:\n                if val:\n                    ends.append(starts[-1] + len(val))\n                    starts.append(ends[-1] + 1)\n                else:\n                    starts[-1] += 1\n            starts = starts[:-1]\n            vals = [x.strip() for x in vals if x]\n            if len(vals) != len(starts) or len(vals) != len(ends):\n                raise InconsistentTableError('Error parsing fixed width header')\n        else:\n            # exactly one of col_starts or col_ends is given...\n            if self.col_starts is not None:\n                starts = list(self.col_starts)\n                ends = starts[1:] + [None]  # Assume each col ends where the next starts\n            else:  # self.col_ends is not None\n                ends = [x + 1 for x in self.col_ends]\n                starts = [0] + ends[:-1]  # Assume each col starts where the last ended\n            vals = [line[start:end].strip() for start, end in zip(starts, ends)]\n\n        return vals, starts, ends\n\n    def write(self, lines):\n        # Header line not written until data are formatted.  Until then it is\n        # not known how wide each column will be for fixed width.\n        pass"},{"col":4,"comment":"\n        WRITE: Override the default write_comments to do nothing since this is handled\n        in the custom write method.\n        ","endLoc":92,"header":"def write_comments(self, lines, meta)","id":4932,"name":"write_comments","nodeType":"Function","startLoc":87,"text":"def write_comments(self, lines, meta):\n        \"\"\"\n        WRITE: Override the default write_comments to do nothing since this is handled\n        in the custom write method.\n        \"\"\"\n        pass"},{"col":4,"comment":"\n        READ: Override the default update_meta to do nothing.  This process is done\n        in get_cols() for this reader.\n        ","endLoc":99,"header":"def update_meta(self, lines, meta)","id":4933,"name":"update_meta","nodeType":"Function","startLoc":94,"text":"def update_meta(self, lines, meta):\n        \"\"\"\n        READ: Override the default update_meta to do nothing.  This process is done\n        in get_cols() for this reader.\n        \"\"\"\n        pass"},{"col":4,"comment":"\n        READ: Initialize the header Column objects from the table ``lines``.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        ","endLoc":201,"header":"def get_cols(self, lines)","id":4934,"name":"get_cols","nodeType":"Function","startLoc":101,"text":"def get_cols(self, lines):\n        \"\"\"\n        READ: Initialize the header Column objects from the table ``lines``.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n        # Cache a copy of the original input lines before processing below\n        raw_lines = lines\n\n        # Extract non-blank comment (header) lines with comment character stripped\n        lines = list(self.process_lines(lines))\n\n        # Validate that this is a ECSV file\n        ecsv_header_re = r\"\"\"%ECSV [ ]\n                             (?P<major> \\d+)\n                             \\. (?P<minor> \\d+)\n                             \\.? (?P<bugfix> \\d+)? $\"\"\"\n\n        no_header_msg = ('ECSV header line like \"# %ECSV <version>\" not found as first line.'\n                         '  This is required for a ECSV file.')\n\n        if not lines:\n            raise core.InconsistentTableError(no_header_msg)\n\n        match = re.match(ecsv_header_re, lines[0].strip(), re.VERBOSE)\n        if not match:\n            raise core.InconsistentTableError(no_header_msg)\n\n        # Construct ecsv_version for backwards compatibility workarounds.\n        self.ecsv_version = tuple(int(v or 0) for v in match.groups())\n\n        try:\n            header = meta.get_header_from_yaml(lines)\n        except meta.YamlParseError:\n            raise core.InconsistentTableError('unable to parse yaml in meta header')\n\n        if 'meta' in header:\n            self.table_meta = header['meta']\n\n        if 'delimiter' in header:\n            delimiter = header['delimiter']\n            if delimiter not in DELIMITERS:\n                raise ValueError('only space and comma are allowed for delimiter in ECSV format')\n            self.splitter.delimiter = delimiter\n            self.data.splitter.delimiter = delimiter\n\n        # Create the list of io.ascii column objects from `header`\n        header_cols = OrderedDict((x['name'], x) for x in header['datatype'])\n        self.names = [x['name'] for x in header['datatype']]\n\n        # Read the first non-commented line of table and split to get the CSV\n        # header column names.  This is essentially what the Basic reader does.\n        header_line = next(super().process_lines(raw_lines))\n        header_names = next(self.splitter([header_line]))\n\n        # Check for consistency of the ECSV vs. CSV header column names\n        if header_names != self.names:\n            raise core.InconsistentTableError('column names from ECSV header {} do not '\n                                              'match names from header line of CSV data {}'\n                                              .format(self.names, header_names))\n\n        # BaseHeader method to create self.cols, which is a list of\n        # io.ascii.core.Column objects (*not* Table Column objects).\n        self._set_cols_from_names()\n\n        # Transfer attributes from the column descriptor stored in the input\n        # header YAML metadata to the new columns to create this table.\n        for col in self.cols:\n            for attr in ('description', 'format', 'unit', 'meta', 'subtype'):\n                if attr in header_cols[col.name]:\n                    setattr(col, attr, header_cols[col.name][attr])\n\n            col.dtype = header_cols[col.name]['datatype']\n            # Require col dtype to be a valid ECSV datatype. However, older versions\n            # of astropy writing ECSV version 0.9 and earlier had inadvertently allowed\n            # numpy datatypes like datetime64 or object or python str, which are not in the ECSV standard.\n            # For back-compatibility with those existing older files, allow reading with no error.\n            if col.dtype not in ECSV_DATATYPES and self.ecsv_version > (0, 9, 0):\n                raise ValueError(f'datatype {col.dtype!r} of column {col.name!r} '\n                                 f'is not in allowed values {ECSV_DATATYPES}')\n\n            # Subtype is written like \"int64[2,null]\" and we want to split this\n            # out to \"int64\" and [2, None].\n            subtype = col.subtype\n            if subtype and '[' in subtype:\n                idx = subtype.index('[')\n                col.subtype = subtype[:idx]\n                col.shape = json.loads(subtype[idx:])\n\n            # Convert ECSV \"string\" to numpy \"str\"\n            for attr in ('dtype', 'subtype'):\n                if getattr(col, attr) == 'string':\n                    setattr(col, attr, 'str')\n\n            # ECSV subtype of 'json' maps to numpy 'object' dtype\n            if col.subtype == 'json':\n                col.subtype = 'object'"},{"col":4,"comment":"null","endLoc":80,"header":"def get_line(self, lines, index)","id":4935,"name":"get_line","nodeType":"Function","startLoc":74,"text":"def get_line(self, lines, index):\n        for i, line in enumerate(self.process_lines(lines)):\n            if i == index:\n                break\n        else:  # No header line matching\n            raise InconsistentTableError('No header line found in table')\n        return line"},{"col":4,"comment":"\n        Return the line number at which table data ends.\n        ","endLoc":251,"header":"def end_line(self, lines)","id":4936,"name":"end_line","nodeType":"Function","startLoc":236,"text":"def end_line(self, lines):\n        \"\"\"\n        Return the line number at which table data ends.\n        \"\"\"\n        last_index = -1\n\n        for i, line in enumerate(lines):\n            if not isinstance(line, SoupString):\n                raise TypeError('HTML lines should be of type SoupString')\n            soup = line.soup\n            if soup.td is not None:\n                last_index = i\n\n        if last_index == -1:\n            return None\n        return last_index + 1"},{"attributeType":"HTMLSplitter","col":4,"comment":"null","endLoc":216,"id":4937,"name":"splitter_class","nodeType":"Attribute","startLoc":216,"text":"splitter_class"},{"col":4,"comment":"\n        Initialize the header Column objects from the table ``lines``.\n\n        Based on the previously set Header attributes find or create the column names.\n        Sets ``self.cols`` with the list of Columns.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        ","endLoc":163,"header":"def get_cols(self, lines)","id":4938,"name":"get_cols","nodeType":"Function","startLoc":82,"text":"def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines``.\n\n        Based on the previously set Header attributes find or create the column names.\n        Sets ``self.cols`` with the list of Columns.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n\n        # See \"else\" clause below for explanation of start_line and position_line\n        start_line = core._get_line_index(self.start_line, self.process_lines(lines))\n        position_line = core._get_line_index(self.position_line, self.process_lines(lines))\n\n        # If start_line is none then there is no header line.  Column positions are\n        # determined from first data line and column names are either supplied by user\n        # or auto-generated.\n        if start_line is None:\n            if position_line is not None:\n                raise ValueError(\"Cannot set position_line without also setting header_start\")\n\n            # data.data_lines attribute already set via self.data.get_data_lines(lines)\n            # in BaseReader.read().  This includes slicing for data_start / data_end.\n            data_lines = self.data.data_lines\n\n            if not data_lines:\n                raise InconsistentTableError(\n                    'No data lines found so cannot autogenerate column names')\n            vals, starts, ends = self.get_fixedwidth_params(data_lines[0])\n\n            self.names = [self.auto_format.format(i)\n                          for i in range(1, len(vals) + 1)]\n\n        else:\n            # This bit of code handles two cases:\n            # start_line = <index> and position_line = None\n            #    Single header line where that line is used to determine both the\n            #    column positions and names.\n            # start_line = <index> and position_line = <index2>\n            #    Two header lines where the first line defines the column names and\n            #    the second line defines the column positions\n\n            if position_line is not None:\n                # Define self.col_starts and self.col_ends so that the call to\n                # get_fixedwidth_params below will use those to find the header\n                # column names.  Note that get_fixedwidth_params returns Python\n                # slice col_ends but expects inclusive col_ends on input (for\n                # more intuitive user interface).\n                line = self.get_line(lines, position_line)\n                if len(set(line) - set([self.splitter.delimiter, ' '])) != 1:\n                    raise InconsistentTableError(\n                        'Position line should only contain delimiters and '\n                        'one other character, e.g. \"--- ------- ---\".')\n                    # The line above lies. It accepts white space as well.\n                    # We don't want to encourage using three different\n                    # characters, because that can cause ambiguities, but white\n                    # spaces are so common everywhere that practicality beats\n                    # purity here.\n                charset = self.set_of_position_line_characters.union(\n                    set([self.splitter.delimiter, ' ']))\n                if not set(line).issubset(charset):\n                    raise InconsistentTableError(\n                        f'Characters in position line must be part of {charset}')\n                vals, self.col_starts, col_ends = self.get_fixedwidth_params(line)\n                self.col_ends = [x - 1 if x is not None else None for x in col_ends]\n\n            # Get the header column names and column positions\n            line = self.get_line(lines, start_line)\n            vals, starts, ends = self.get_fixedwidth_params(line)\n\n            self.names = vals\n\n        self._set_cols_from_names()\n\n        # Set column start and end positions.\n        for i, col in enumerate(self.cols):\n            col.start = starts[i]\n            col.end = ends[i]"},{"className":"HTML","col":0,"comment":"HTML format table.\n\n    In order to customize input and output, a dict of parameters may\n    be passed to this class holding specific customizations.\n\n    **htmldict** : Dictionary of parameters for HTML input/output.\n\n        * css : Customized styling\n            If present, this parameter will be included in a <style>\n            tag and will define stylistic attributes of the output.\n\n        * table_id : ID for the input table\n            If a string, this defines the HTML id of the table to be processed.\n            If an integer, this specifies the index of the input table in the\n            available tables. Unless this parameter is given, the reader will\n            use the first table found in the input file.\n\n        * multicol : Use multi-dimensional columns for output\n            The writer will output tuples as elements of multi-dimensional\n            columns if this parameter is true, and if not then it will\n            use the syntax 1.36583e-13 .. 1.36583e-13 for output. If not\n            present, this parameter will be true by default.\n\n        * raw_html_cols : column name or list of names with raw HTML content\n            This allows one to include raw HTML content in the column output,\n            for instance to include link references in a table.  This option\n            requires that the bleach package be installed.  Only whitelisted\n            tags are allowed through for security reasons (see the\n            raw_html_clean_kwargs arg).\n\n        * raw_html_clean_kwargs : dict of keyword args controlling HTML cleaning\n            Raw HTML will be cleaned to prevent unsafe HTML from ending up in\n            the table output.  This is done by calling ``bleach.clean(data,\n            **raw_html_clean_kwargs)``.  For details on the available options\n            (e.g. tag whitelist) see:\n            https://bleach.readthedocs.io/en/latest/clean.html\n\n        * parser : Specific HTML parsing library to use\n            If specified, this specifies which HTML parsing library\n            BeautifulSoup should use as a backend. The options to choose\n            from are 'html.parser' (the standard library parser), 'lxml'\n            (the recommended parser), 'xml' (lxml's XML parser), and\n            'html5lib'. html5lib is a highly lenient parser and therefore\n            might work correctly for unusual input if a different parser\n            fails.\n\n        * jsfiles : list of js files to include when writing table.\n\n        * cssfiles : list of css files to include when writing table.\n\n        * js : js script to include in the body when writing table.\n\n        * table_class : css class for the table\n\n    ","endLoc":477,"id":4939,"nodeType":"Class","startLoc":254,"text":"class HTML(core.BaseReader):\n    \"\"\"HTML format table.\n\n    In order to customize input and output, a dict of parameters may\n    be passed to this class holding specific customizations.\n\n    **htmldict** : Dictionary of parameters for HTML input/output.\n\n        * css : Customized styling\n            If present, this parameter will be included in a <style>\n            tag and will define stylistic attributes of the output.\n\n        * table_id : ID for the input table\n            If a string, this defines the HTML id of the table to be processed.\n            If an integer, this specifies the index of the input table in the\n            available tables. Unless this parameter is given, the reader will\n            use the first table found in the input file.\n\n        * multicol : Use multi-dimensional columns for output\n            The writer will output tuples as elements of multi-dimensional\n            columns if this parameter is true, and if not then it will\n            use the syntax 1.36583e-13 .. 1.36583e-13 for output. If not\n            present, this parameter will be true by default.\n\n        * raw_html_cols : column name or list of names with raw HTML content\n            This allows one to include raw HTML content in the column output,\n            for instance to include link references in a table.  This option\n            requires that the bleach package be installed.  Only whitelisted\n            tags are allowed through for security reasons (see the\n            raw_html_clean_kwargs arg).\n\n        * raw_html_clean_kwargs : dict of keyword args controlling HTML cleaning\n            Raw HTML will be cleaned to prevent unsafe HTML from ending up in\n            the table output.  This is done by calling ``bleach.clean(data,\n            **raw_html_clean_kwargs)``.  For details on the available options\n            (e.g. tag whitelist) see:\n            https://bleach.readthedocs.io/en/latest/clean.html\n\n        * parser : Specific HTML parsing library to use\n            If specified, this specifies which HTML parsing library\n            BeautifulSoup should use as a backend. The options to choose\n            from are 'html.parser' (the standard library parser), 'lxml'\n            (the recommended parser), 'xml' (lxml's XML parser), and\n            'html5lib'. html5lib is a highly lenient parser and therefore\n            might work correctly for unusual input if a different parser\n            fails.\n\n        * jsfiles : list of js files to include when writing table.\n\n        * cssfiles : list of css files to include when writing table.\n\n        * js : js script to include in the body when writing table.\n\n        * table_class : css class for the table\n\n    \"\"\"\n\n    _format_name = 'html'\n    _io_registry_format_aliases = ['html']\n    _io_registry_suffix = '.html'\n    _description = 'HTML table'\n\n    header_class = HTMLHeader\n    data_class = HTMLData\n    inputter_class = HTMLInputter\n\n    max_ndim = 2  # HTML supports writing 2-d columns with shape (n, m)\n\n    def __init__(self, htmldict={}):\n        \"\"\"\n        Initialize classes for HTML reading and writing.\n        \"\"\"\n        super().__init__()\n        self.html = deepcopy(htmldict)\n        if 'multicol' not in htmldict:\n            self.html['multicol'] = True\n        if 'table_id' not in htmldict:\n            self.html['table_id'] = 1\n        self.inputter.html = self.html\n\n    def read(self, table):\n        \"\"\"\n        Read the ``table`` in HTML format and return a resulting ``Table``.\n        \"\"\"\n\n        self.outputter = HTMLOutputter()\n        return super().read(table)\n\n    def write(self, table):\n        \"\"\"\n        Return data in ``table`` converted to HTML as a list of strings.\n        \"\"\"\n        # Check that table has only 1-d or 2-d columns. Above that fails.\n        self._check_multidim_table(table)\n\n        cols = list(table.columns.values())\n\n        self.data.header.cols = cols\n\n        if isinstance(self.data.fill_values, tuple):\n            self.data.fill_values = [self.data.fill_values]\n\n        self.data._set_fill_values(cols)\n\n        lines = []\n\n        # Set HTML escaping to False for any column in the raw_html_cols input\n        raw_html_cols = self.html.get('raw_html_cols', [])\n        if isinstance(raw_html_cols, str):\n            raw_html_cols = [raw_html_cols]  # Allow for a single string as input\n        cols_escaped = [col.info.name not in raw_html_cols for col in cols]\n\n        # Kwargs that get passed on to bleach.clean() if that is available.\n        raw_html_clean_kwargs = self.html.get('raw_html_clean_kwargs', {})\n\n        # Use XMLWriter to output HTML to lines\n        w = writer.XMLWriter(ListWriter(lines))\n\n        with w.tag('html'):\n            with w.tag('head'):\n                # Declare encoding and set CSS style for table\n                with w.tag('meta', attrib={'charset': 'utf-8'}):\n                    pass\n                with w.tag('meta', attrib={'http-equiv': 'Content-type',\n                                           'content': 'text/html;charset=UTF-8'}):\n                    pass\n                if 'css' in self.html:\n                    with w.tag('style'):\n                        w.data(self.html['css'])\n                if 'cssfiles' in self.html:\n                    for filename in self.html['cssfiles']:\n                        with w.tag('link', rel=\"stylesheet\", href=filename, type='text/css'):\n                            pass\n                if 'jsfiles' in self.html:\n                    for filename in self.html['jsfiles']:\n                        with w.tag('script', src=filename):\n                            w.data('')  # need this instead of pass to get <script></script>\n            with w.tag('body'):\n                if 'js' in self.html:\n                    with w.xml_cleaning_method('none'):\n                        with w.tag('script'):\n                            w.data(self.html['js'])\n                if isinstance(self.html['table_id'], str):\n                    html_table_id = self.html['table_id']\n                else:\n                    html_table_id = None\n                if 'table_class' in self.html:\n                    html_table_class = self.html['table_class']\n                    attrib = {\"class\": html_table_class}\n                else:\n                    attrib = {}\n                with w.tag('table', id=html_table_id, attrib=attrib):\n                    with w.tag('thead'):\n                        with w.tag('tr'):\n                            for col in cols:\n                                if len(col.shape) > 1 and self.html['multicol']:\n                                    # Set colspan attribute for multicolumns\n                                    w.start('th', colspan=col.shape[1])\n                                else:\n                                    w.start('th')\n                                w.data(col.info.name.strip())\n                                w.end(indent=False)\n                        col_str_iters = []\n                        new_cols_escaped = []\n\n                        # Make a container to hold any new_col objects created\n                        # below for multicolumn elements.  This is purely to\n                        # maintain a reference for these objects during\n                        # subsequent iteration to format column values.  This\n                        # requires that the weakref info._parent be maintained.\n                        new_cols = []\n\n                        for col, col_escaped in zip(cols, cols_escaped):\n                            if len(col.shape) > 1 and self.html['multicol']:\n                                span = col.shape[1]\n                                for i in range(span):\n                                    # Split up multicolumns into separate columns\n                                    new_col = Column([el[i] for el in col])\n\n                                    new_col_iter_str_vals = self.fill_values(\n                                        col, new_col.info.iter_str_vals())\n                                    col_str_iters.append(new_col_iter_str_vals)\n                                    new_cols_escaped.append(col_escaped)\n                                    new_cols.append(new_col)\n                            else:\n\n                                col_iter_str_vals = self.fill_values(col, col.info.iter_str_vals())\n                                col_str_iters.append(col_iter_str_vals)\n\n                                new_cols_escaped.append(col_escaped)\n\n                    for row in zip(*col_str_iters):\n                        with w.tag('tr'):\n                            for el, col_escaped in zip(row, new_cols_escaped):\n                                # Potentially disable HTML escaping for column\n                                method = ('escape_xml' if col_escaped else 'bleach_clean')\n                                with w.xml_cleaning_method(method, **raw_html_clean_kwargs):\n                                    w.start('td')\n                                    w.data(el.strip())\n                                    w.end(indent=False)\n\n        # Fixes XMLWriter's insertion of unwanted line breaks\n        return [''.join(lines)]\n\n    def fill_values(self, col, col_str_iters):\n        \"\"\"\n        Return an iterator of the values with replacements based on fill_values\n        \"\"\"\n        # check if the col is a masked column and has fill values\n        is_masked_column = hasattr(col, 'mask')\n        has_fill_values = hasattr(col, 'fill_values')\n\n        for idx, col_str in enumerate(col_str_iters):\n            if is_masked_column and has_fill_values:\n                if col.mask[idx]:\n                    yield col.fill_values[core.masked]\n                    continue\n\n            if has_fill_values:\n                if col_str in col.fill_values:\n                    yield col.fill_values[col_str]\n                    continue\n\n            yield col_str"},{"col":4,"comment":"\n        Initialize classes for HTML reading and writing.\n        ","endLoc":332,"header":"def __init__(self, htmldict={})","id":4940,"name":"__init__","nodeType":"Function","startLoc":322,"text":"def __init__(self, htmldict={}):\n        \"\"\"\n        Initialize classes for HTML reading and writing.\n        \"\"\"\n        super().__init__()\n        self.html = deepcopy(htmldict)\n        if 'multicol' not in htmldict:\n            self.html['multicol'] = True\n        if 'table_id' not in htmldict:\n            self.html['table_id'] = 1\n        self.inputter.html = self.html"},{"col":4,"comment":"\n        Split ``line`` on the delimiter and determine column values and\n        column start and end positions.  This might include null columns with\n        zero length (e.g. for ``header row = \"| col1 || col2 | col3 |\"`` or\n        ``header2_row = \"----- ------- -----\"``).  The null columns are\n        stripped out.  Returns the values between delimiters and the\n        corresponding start and end positions.\n\n        Parameters\n        ----------\n        line : str\n            Input line\n\n        Returns\n        -------\n        vals : list\n            List of values.\n        starts : list\n            List of starting indices.\n        ends : list\n            List of ending indices.\n\n        ","endLoc":226,"header":"def get_fixedwidth_params(self, line)","id":4941,"name":"get_fixedwidth_params","nodeType":"Function","startLoc":165,"text":"def get_fixedwidth_params(self, line):\n        \"\"\"\n        Split ``line`` on the delimiter and determine column values and\n        column start and end positions.  This might include null columns with\n        zero length (e.g. for ``header row = \"| col1 || col2 | col3 |\"`` or\n        ``header2_row = \"----- ------- -----\"``).  The null columns are\n        stripped out.  Returns the values between delimiters and the\n        corresponding start and end positions.\n\n        Parameters\n        ----------\n        line : str\n            Input line\n\n        Returns\n        -------\n        vals : list\n            List of values.\n        starts : list\n            List of starting indices.\n        ends : list\n            List of ending indices.\n\n        \"\"\"\n\n        # If column positions are already specified then just use those.\n        # If neither column starts or ends are given, figure out positions\n        # between delimiters. Otherwise, either the starts or the ends have\n        # been given, so figure out whichever wasn't given.\n        if self.col_starts is not None and self.col_ends is not None:\n            starts = list(self.col_starts)  # could be any iterable, e.g. np.array\n            # user supplies inclusive endpoint\n            ends = [x + 1 if x is not None else None for x in self.col_ends]\n            if len(starts) != len(ends):\n                raise ValueError('Fixed width col_starts and col_ends must have the same length')\n            vals = [line[start:end].strip() for start, end in zip(starts, ends)]\n        elif self.col_starts is None and self.col_ends is None:\n            # There might be a cleaner way to do this but it works...\n            vals = line.split(self.splitter.delimiter)\n            starts = [0]\n            ends = []\n            for val in vals:\n                if val:\n                    ends.append(starts[-1] + len(val))\n                    starts.append(ends[-1] + 1)\n                else:\n                    starts[-1] += 1\n            starts = starts[:-1]\n            vals = [x.strip() for x in vals if x]\n            if len(vals) != len(starts) or len(vals) != len(ends):\n                raise InconsistentTableError('Error parsing fixed width header')\n        else:\n            # exactly one of col_starts or col_ends is given...\n            if self.col_starts is not None:\n                starts = list(self.col_starts)\n                ends = starts[1:] + [None]  # Assume each col ends where the next starts\n            else:  # self.col_ends is not None\n                ends = [x + 1 for x in self.col_ends]\n                starts = [0] + ends[:-1]  # Assume each col starts where the last ended\n            vals = [line[start:end].strip() for start, end in zip(starts, ends)]\n\n        return vals, starts, ends"},{"col":4,"comment":"\n        Read the ``table`` in HTML format and return a resulting ``Table``.\n        ","endLoc":340,"header":"def read(self, table)","id":4942,"name":"read","nodeType":"Function","startLoc":334,"text":"def read(self, table):\n        \"\"\"\n        Read the ``table`` in HTML format and return a resulting ``Table``.\n        \"\"\"\n\n        self.outputter = HTMLOutputter()\n        return super().read(table)"},{"col":4,"comment":"\n        Return data in ``table`` converted to HTML as a list of strings.\n        ","endLoc":456,"header":"def write(self, table)","id":4943,"name":"write","nodeType":"Function","startLoc":342,"text":"def write(self, table):\n        \"\"\"\n        Return data in ``table`` converted to HTML as a list of strings.\n        \"\"\"\n        # Check that table has only 1-d or 2-d columns. Above that fails.\n        self._check_multidim_table(table)\n\n        cols = list(table.columns.values())\n\n        self.data.header.cols = cols\n\n        if isinstance(self.data.fill_values, tuple):\n            self.data.fill_values = [self.data.fill_values]\n\n        self.data._set_fill_values(cols)\n\n        lines = []\n\n        # Set HTML escaping to False for any column in the raw_html_cols input\n        raw_html_cols = self.html.get('raw_html_cols', [])\n        if isinstance(raw_html_cols, str):\n            raw_html_cols = [raw_html_cols]  # Allow for a single string as input\n        cols_escaped = [col.info.name not in raw_html_cols for col in cols]\n\n        # Kwargs that get passed on to bleach.clean() if that is available.\n        raw_html_clean_kwargs = self.html.get('raw_html_clean_kwargs', {})\n\n        # Use XMLWriter to output HTML to lines\n        w = writer.XMLWriter(ListWriter(lines))\n\n        with w.tag('html'):\n            with w.tag('head'):\n                # Declare encoding and set CSS style for table\n                with w.tag('meta', attrib={'charset': 'utf-8'}):\n                    pass\n                with w.tag('meta', attrib={'http-equiv': 'Content-type',\n                                           'content': 'text/html;charset=UTF-8'}):\n                    pass\n                if 'css' in self.html:\n                    with w.tag('style'):\n                        w.data(self.html['css'])\n                if 'cssfiles' in self.html:\n                    for filename in self.html['cssfiles']:\n                        with w.tag('link', rel=\"stylesheet\", href=filename, type='text/css'):\n                            pass\n                if 'jsfiles' in self.html:\n                    for filename in self.html['jsfiles']:\n                        with w.tag('script', src=filename):\n                            w.data('')  # need this instead of pass to get <script></script>\n            with w.tag('body'):\n                if 'js' in self.html:\n                    with w.xml_cleaning_method('none'):\n                        with w.tag('script'):\n                            w.data(self.html['js'])\n                if isinstance(self.html['table_id'], str):\n                    html_table_id = self.html['table_id']\n                else:\n                    html_table_id = None\n                if 'table_class' in self.html:\n                    html_table_class = self.html['table_class']\n                    attrib = {\"class\": html_table_class}\n                else:\n                    attrib = {}\n                with w.tag('table', id=html_table_id, attrib=attrib):\n                    with w.tag('thead'):\n                        with w.tag('tr'):\n                            for col in cols:\n                                if len(col.shape) > 1 and self.html['multicol']:\n                                    # Set colspan attribute for multicolumns\n                                    w.start('th', colspan=col.shape[1])\n                                else:\n                                    w.start('th')\n                                w.data(col.info.name.strip())\n                                w.end(indent=False)\n                        col_str_iters = []\n                        new_cols_escaped = []\n\n                        # Make a container to hold any new_col objects created\n                        # below for multicolumn elements.  This is purely to\n                        # maintain a reference for these objects during\n                        # subsequent iteration to format column values.  This\n                        # requires that the weakref info._parent be maintained.\n                        new_cols = []\n\n                        for col, col_escaped in zip(cols, cols_escaped):\n                            if len(col.shape) > 1 and self.html['multicol']:\n                                span = col.shape[1]\n                                for i in range(span):\n                                    # Split up multicolumns into separate columns\n                                    new_col = Column([el[i] for el in col])\n\n                                    new_col_iter_str_vals = self.fill_values(\n                                        col, new_col.info.iter_str_vals())\n                                    col_str_iters.append(new_col_iter_str_vals)\n                                    new_cols_escaped.append(col_escaped)\n                                    new_cols.append(new_col)\n                            else:\n\n                                col_iter_str_vals = self.fill_values(col, col.info.iter_str_vals())\n                                col_str_iters.append(col_iter_str_vals)\n\n                                new_cols_escaped.append(col_escaped)\n\n                    for row in zip(*col_str_iters):\n                        with w.tag('tr'):\n                            for el, col_escaped in zip(row, new_cols_escaped):\n                                # Potentially disable HTML escaping for column\n                                method = ('escape_xml' if col_escaped else 'bleach_clean')\n                                with w.xml_cleaning_method(method, **raw_html_clean_kwargs):\n                                    w.start('td')\n                                    w.data(el.strip())\n                                    w.end(indent=False)\n\n        # Fixes XMLWriter's insertion of unwanted line breaks\n        return [''.join(lines)]"},{"col":4,"comment":"\n        Searches for all coordinates in this object around a supplied set of\n        points within a given 3D radius.\n\n        This is intended for use on `~astropy.coordinates.SkyCoord` objects\n        with coordinate arrays, rather than a scalar coordinate.  For a scalar\n        coordinate, it is better to use\n        `~astropy.coordinates.SkyCoord.separation_3d`.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        searcharoundcoords : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinates to search around to try to find matching points in\n            this `SkyCoord`. This should be an object with array coordinates,\n            not a scalar coordinate object.\n        distlimit : `~astropy.units.Quantity` ['length']\n            The physical radius to search within.\n\n        Returns\n        -------\n        idxsearcharound : int array\n            Indices into ``searcharoundcoords`` that match the\n            corresponding elements of ``idxself``. Shape matches\n            ``idxself``.\n        idxself : int array\n            Indices into ``self`` that match the\n            corresponding elements of ``idxsearcharound``. Shape matches\n            ``idxsearcharound``.\n        sep2d : `~astropy.coordinates.Angle`\n            The on-sky separation between the coordinates. Shape matches\n            ``idxsearcharound`` and ``idxself``.\n        dist3d : `~astropy.units.Quantity` ['length']\n            The 3D distance between the coordinates. Shape matches\n            ``idxsearcharound`` and ``idxself``.\n\n        Notes\n        -----\n        This method requires `SciPy <https://www.scipy.org/>`_ to be\n        installed or it will fail.\n\n        In the current implementation, the return values are always sorted in\n        the same order as the ``searcharoundcoords`` (so ``idxsearcharound`` is\n        in ascending order).  This is considered an implementation detail,\n        though, so it could change in a future release.\n\n        See Also\n        --------\n        astropy.coordinates.search_around_3d\n        SkyCoord.search_around_sky\n        ","endLoc":1569,"header":"def search_around_3d(self, searcharoundcoords, distlimit)","id":4944,"name":"search_around_3d","nodeType":"Function","startLoc":1512,"text":"def search_around_3d(self, searcharoundcoords, distlimit):\n        \"\"\"\n        Searches for all coordinates in this object around a supplied set of\n        points within a given 3D radius.\n\n        This is intended for use on `~astropy.coordinates.SkyCoord` objects\n        with coordinate arrays, rather than a scalar coordinate.  For a scalar\n        coordinate, it is better to use\n        `~astropy.coordinates.SkyCoord.separation_3d`.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        searcharoundcoords : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinates to search around to try to find matching points in\n            this `SkyCoord`. This should be an object with array coordinates,\n            not a scalar coordinate object.\n        distlimit : `~astropy.units.Quantity` ['length']\n            The physical radius to search within.\n\n        Returns\n        -------\n        idxsearcharound : int array\n            Indices into ``searcharoundcoords`` that match the\n            corresponding elements of ``idxself``. Shape matches\n            ``idxself``.\n        idxself : int array\n            Indices into ``self`` that match the\n            corresponding elements of ``idxsearcharound``. Shape matches\n            ``idxsearcharound``.\n        sep2d : `~astropy.coordinates.Angle`\n            The on-sky separation between the coordinates. Shape matches\n            ``idxsearcharound`` and ``idxself``.\n        dist3d : `~astropy.units.Quantity` ['length']\n            The 3D distance between the coordinates. Shape matches\n            ``idxsearcharound`` and ``idxself``.\n\n        Notes\n        -----\n        This method requires `SciPy <https://www.scipy.org/>`_ to be\n        installed or it will fail.\n\n        In the current implementation, the return values are always sorted in\n        the same order as the ``searcharoundcoords`` (so ``idxsearcharound`` is\n        in ascending order).  This is considered an implementation detail,\n        though, so it could change in a future release.\n\n        See Also\n        --------\n        astropy.coordinates.search_around_3d\n        SkyCoord.search_around_sky\n        \"\"\"\n        from .matching import search_around_3d\n\n        return search_around_3d(searcharoundcoords, self, distlimit,\n                                storekdtree='_kdtree_3d')"},{"col":0,"comment":"\n    Searches for pairs of points that are at least as close as a specified\n    distance in 3D space.\n\n    This is intended for use on coordinate objects with arrays of coordinates,\n    not scalars.  For scalar coordinates, it is better to use the\n    ``separation_3d`` methods.\n\n    Parameters\n    ----------\n    coords1 : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The first set of coordinates, which will be searched for matches from\n        ``coords2`` within ``seplimit``.  Cannot be a scalar coordinate.\n    coords2 : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The second set of coordinates, which will be searched for matches from\n        ``coords1`` within ``seplimit``.  Cannot be a scalar coordinate.\n    distlimit : `~astropy.units.Quantity` ['length']\n        The physical radius to search within.\n    storekdtree : bool or str, optional\n        If a string, will store the KD-Tree used in the search with the name\n        ``storekdtree`` in ``coords2.cache``. This speeds up subsequent calls\n        to this function. If False, the KD-Trees are not saved.\n\n    Returns\n    -------\n    idx1 : int array\n        Indices into ``coords1`` that matches to the corresponding element of\n        ``idx2``. Shape matches ``idx2``.\n    idx2 : int array\n        Indices into ``coords2`` that matches to the corresponding element of\n        ``idx1``. Shape matches ``idx1``.\n    sep2d : `~astropy.coordinates.Angle`\n        The on-sky separation between the coordinates. Shape matches ``idx1``\n        and ``idx2``.\n    dist3d : `~astropy.units.Quantity` ['length']\n        The 3D distance between the coordinates. Shape matches ``idx1`` and\n        ``idx2``. The unit is that of ``coords1``.\n\n    Notes\n    -----\n    This function requires `SciPy <https://www.scipy.org/>`_\n    to be installed or it will fail.\n\n    If you are using this function to search in a catalog for matches around\n    specific points, the convention is for ``coords2`` to be the catalog, and\n    ``coords1`` are the points to search around.  While these operations are\n    mathematically the same if ``coords1`` and ``coords2`` are flipped, some of\n    the optimizations may work better if this convention is obeyed.\n\n    In the current implementation, the return values are always sorted in the\n    same order as the ``coords1`` (so ``idx1`` is in ascending order).  This is\n    considered an implementation detail, though, so it could change in a future\n    release.\n    ","endLoc":281,"header":"def search_around_3d(coords1, coords2, distlimit, storekdtree='kdtree_3d')","id":4945,"name":"search_around_3d","nodeType":"Function","startLoc":181,"text":"def search_around_3d(coords1, coords2, distlimit, storekdtree='kdtree_3d'):\n    \"\"\"\n    Searches for pairs of points that are at least as close as a specified\n    distance in 3D space.\n\n    This is intended for use on coordinate objects with arrays of coordinates,\n    not scalars.  For scalar coordinates, it is better to use the\n    ``separation_3d`` methods.\n\n    Parameters\n    ----------\n    coords1 : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The first set of coordinates, which will be searched for matches from\n        ``coords2`` within ``seplimit``.  Cannot be a scalar coordinate.\n    coords2 : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The second set of coordinates, which will be searched for matches from\n        ``coords1`` within ``seplimit``.  Cannot be a scalar coordinate.\n    distlimit : `~astropy.units.Quantity` ['length']\n        The physical radius to search within.\n    storekdtree : bool or str, optional\n        If a string, will store the KD-Tree used in the search with the name\n        ``storekdtree`` in ``coords2.cache``. This speeds up subsequent calls\n        to this function. If False, the KD-Trees are not saved.\n\n    Returns\n    -------\n    idx1 : int array\n        Indices into ``coords1`` that matches to the corresponding element of\n        ``idx2``. Shape matches ``idx2``.\n    idx2 : int array\n        Indices into ``coords2`` that matches to the corresponding element of\n        ``idx1``. Shape matches ``idx1``.\n    sep2d : `~astropy.coordinates.Angle`\n        The on-sky separation between the coordinates. Shape matches ``idx1``\n        and ``idx2``.\n    dist3d : `~astropy.units.Quantity` ['length']\n        The 3D distance between the coordinates. Shape matches ``idx1`` and\n        ``idx2``. The unit is that of ``coords1``.\n\n    Notes\n    -----\n    This function requires `SciPy <https://www.scipy.org/>`_\n    to be installed or it will fail.\n\n    If you are using this function to search in a catalog for matches around\n    specific points, the convention is for ``coords2`` to be the catalog, and\n    ``coords1`` are the points to search around.  While these operations are\n    mathematically the same if ``coords1`` and ``coords2`` are flipped, some of\n    the optimizations may work better if this convention is obeyed.\n\n    In the current implementation, the return values are always sorted in the\n    same order as the ``coords1`` (so ``idx1`` is in ascending order).  This is\n    considered an implementation detail, though, so it could change in a future\n    release.\n    \"\"\"\n    if not distlimit.isscalar:\n        raise ValueError('distlimit must be a scalar in search_around_3d')\n\n    if coords1.isscalar or coords2.isscalar:\n        raise ValueError('One of the inputs to search_around_3d is a scalar. '\n                         'search_around_3d is intended for use with array '\n                         'coordinates, not scalars.  Instead, use '\n                         '``coord1.separation_3d(coord2) < distlimit`` to find '\n                         'the coordinates near a scalar coordinate.')\n\n    if len(coords1) == 0 or len(coords2) == 0:\n        # Empty array input: return empty match\n        return (np.array([], dtype=int), np.array([], dtype=int),\n                Angle([], u.deg),\n                u.Quantity([], coords1.distance.unit))\n\n    kdt2 = _get_cartesian_kdtree(coords2, storekdtree)\n    cunit = coords2.cartesian.x.unit\n\n    # we convert coord1 to match coord2's frame.  We do it this way\n    # so that if the conversion does happen, the KD tree of coord2 at least gets\n    # saved. (by convention, coord2 is the \"catalog\" if that makes sense)\n    coords1 = coords1.transform_to(coords2)\n\n    kdt1 = _get_cartesian_kdtree(coords1, storekdtree, forceunit=cunit)\n\n    # this is the *cartesian* 3D distance that corresponds to the given angle\n    d = distlimit.to_value(cunit)\n\n    idxs1 = []\n    idxs2 = []\n    for i, matches in enumerate(kdt1.query_ball_tree(kdt2, d)):\n        for match in matches:\n            idxs1.append(i)\n            idxs2.append(match)\n    idxs1 = np.array(idxs1, dtype=int)\n    idxs2 = np.array(idxs2, dtype=int)\n\n    if idxs1.size == 0:\n        d2ds = Angle([], u.deg)\n        d3ds = u.Quantity([], coords1.distance.unit)\n    else:\n        d2ds = coords1[idxs1].separation(coords2[idxs2])\n        d3ds = coords1[idxs1].separation_3d(coords2[idxs2])\n\n    return idxs1, idxs2, d2ds, d3ds"},{"col":4,"comment":"null","endLoc":150,"header":"@classmethod\n    def to_tree(cls, frame, ctx)","id":4946,"name":"to_tree","nodeType":"Function","startLoc":135,"text":"@classmethod\n    def to_tree(cls, frame, ctx):\n        node = {}\n\n        wrap_angle = Quantity(frame.ra.wrap_angle)\n        node['ra'] = {\n            'value': frame.ra.value,\n            'unit': frame.ra.unit.to_string(),\n            'wrap_angle': wrap_angle\n        }\n        node['dec'] = {\n            'value': frame.dec.value,\n            'unit': frame.dec.unit.to_string()\n        }\n\n        return node"},{"col":4,"comment":"\n        Computes the on-sky position angle (East of North) between this\n        `SkyCoord` and another.\n\n        Parameters\n        ----------\n        other : `SkyCoord`\n            The other coordinate to compute the position angle to.  It is\n            treated as the \"head\" of the vector of the position angle.\n\n        Returns\n        -------\n        pa : `~astropy.coordinates.Angle`\n            The (positive) position angle of the vector pointing from ``self``\n            to ``other``.  If either ``self`` or ``other`` contain arrays, this\n            will be an array following the appropriate `numpy` broadcasting\n            rules.\n\n        Examples\n        --------\n\n        >>> c1 = SkyCoord(0*u.deg, 0*u.deg)\n        >>> c2 = SkyCoord(1*u.deg, 0*u.deg)\n        >>> c1.position_angle(c2).degree\n        90.0\n        >>> c3 = SkyCoord(1*u.deg, 1*u.deg)\n        >>> c1.position_angle(c3).degree  # doctest: +FLOAT_CMP\n        44.995636455344844\n        ","endLoc":1615,"header":"def position_angle(self, other)","id":4947,"name":"position_angle","nodeType":"Function","startLoc":1571,"text":"def position_angle(self, other):\n        \"\"\"\n        Computes the on-sky position angle (East of North) between this\n        `SkyCoord` and another.\n\n        Parameters\n        ----------\n        other : `SkyCoord`\n            The other coordinate to compute the position angle to.  It is\n            treated as the \"head\" of the vector of the position angle.\n\n        Returns\n        -------\n        pa : `~astropy.coordinates.Angle`\n            The (positive) position angle of the vector pointing from ``self``\n            to ``other``.  If either ``self`` or ``other`` contain arrays, this\n            will be an array following the appropriate `numpy` broadcasting\n            rules.\n\n        Examples\n        --------\n\n        >>> c1 = SkyCoord(0*u.deg, 0*u.deg)\n        >>> c2 = SkyCoord(1*u.deg, 0*u.deg)\n        >>> c1.position_angle(c2).degree\n        90.0\n        >>> c3 = SkyCoord(1*u.deg, 1*u.deg)\n        >>> c1.position_angle(c3).degree  # doctest: +FLOAT_CMP\n        44.995636455344844\n        \"\"\"\n        from . import angle_utilities\n\n        if not self.is_equivalent_frame(other):\n            try:\n                other = other.transform_to(self, merge_attributes=False)\n            except TypeError:\n                raise TypeError('Can only get position_angle to another '\n                                'SkyCoord or a coordinate frame with data')\n\n        slat = self.represent_as(UnitSphericalRepresentation).lat\n        slon = self.represent_as(UnitSphericalRepresentation).lon\n        olat = other.represent_as(UnitSphericalRepresentation).lat\n        olon = other.represent_as(UnitSphericalRepresentation).lon\n\n        return angle_utilities.position_angle(slon, slat, olon, olat)"},{"col":4,"comment":"null","endLoc":157,"header":"@classmethod\n    def assert_equal(cls, old, new)","id":4948,"name":"assert_equal","nodeType":"Function","startLoc":152,"text":"@classmethod\n    def assert_equal(cls, old, new):\n        assert isinstance(old, ICRS)\n        assert isinstance(new, ICRS)\n        assert u.allclose(new.ra, old.ra)\n        assert u.allclose(new.dec, old.dec)"},{"attributeType":"null","col":4,"comment":"null","endLoc":119,"id":4949,"name":"name","nodeType":"Attribute","startLoc":119,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":120,"id":4950,"name":"types","nodeType":"Attribute","startLoc":120,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":121,"id":4951,"name":"requires","nodeType":"Attribute","startLoc":121,"text":"requires"},{"attributeType":"null","col":4,"comment":"null","endLoc":122,"id":4952,"name":"version","nodeType":"Attribute","startLoc":122,"text":"version"},{"col":0,"comment":"\n    By reading the schema files, get the list of all the frames we can\n    save/load.\n    ","endLoc":41,"header":"def _get_frames()","id":4953,"name":"_get_frames","nodeType":"Function","startLoc":23,"text":"def _get_frames():\n    \"\"\"\n    By reading the schema files, get the list of all the frames we can\n    save/load.\n    \"\"\"\n    search = os.path.join(SCHEMA_PATH, 'coordinates', 'frames', '*.yaml')\n    files = glob.glob(search)\n\n    names = []\n    for fpath in files:\n        path, fname = os.path.split(fpath)\n        frame, _ = fname.split('-')\n        # Skip baseframe because we cannot directly save / load it.\n        # Skip icrs because we have an explicit tag for it because there are\n        # two versions.\n        if frame not in ['baseframe', 'icrs']:\n            names.append(frame)\n\n    return names"},{"col":0,"comment":"\n    Position Angle (East of North) between two points on a sphere.\n\n    Parameters\n    ----------\n    lon1, lat1, lon2, lat2 : `~astropy.coordinates.Angle`, `~astropy.units.Quantity` or float\n        Longitude and latitude of the two points. Quantities should be in\n        angular units; floats in radians.\n\n    Returns\n    -------\n    pa : `~astropy.coordinates.Angle`\n        The (positive) position angle of the vector pointing from position 1 to\n        position 2.  If any of the angles are arrays, this will contain an array\n        following the appropriate `numpy` broadcasting rules.\n\n    ","endLoc":88,"header":"def position_angle(lon1, lat1, lon2, lat2)","id":4954,"name":"position_angle","nodeType":"Function","startLoc":62,"text":"def position_angle(lon1, lat1, lon2, lat2):\n    \"\"\"\n    Position Angle (East of North) between two points on a sphere.\n\n    Parameters\n    ----------\n    lon1, lat1, lon2, lat2 : `~astropy.coordinates.Angle`, `~astropy.units.Quantity` or float\n        Longitude and latitude of the two points. Quantities should be in\n        angular units; floats in radians.\n\n    Returns\n    -------\n    pa : `~astropy.coordinates.Angle`\n        The (positive) position angle of the vector pointing from position 1 to\n        position 2.  If any of the angles are arrays, this will contain an array\n        following the appropriate `numpy` broadcasting rules.\n\n    \"\"\"\n    from .angles import Angle\n\n    deltalon = lon2 - lon1\n    colat = np.cos(lat2)\n\n    x = np.sin(lat2) * np.cos(lat1) - colat * np.sin(lat1) * np.cos(deltalon)\n    y = np.sin(deltalon) * colat\n\n    return Angle(np.arctan2(y, x), u.radian).wrap_at(360*u.deg)"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":4955,"name":"__all__","nodeType":"Attribute","startLoc":17,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":4956,"name":"SCHEMA_PATH","nodeType":"Attribute","startLoc":19,"text":"SCHEMA_PATH"},{"col":0,"comment":"","endLoc":3,"header":"frames.py#<anonymous>","id":4957,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['CoordType']\n\nSCHEMA_PATH = os.path.abspath(\n    os.path.join(os.path.dirname(__file__), '..', '..', 'data', 'schemas', 'astropy.org', 'astropy'))"},{"col":4,"comment":"\n        Determines the constellation(s) of the coordinates this `SkyCoord`\n        contains.\n\n        Parameters\n        ----------\n        short_name : bool\n            If True, the returned names are the IAU-sanctioned abbreviated\n            names.  Otherwise, full names for the constellations are used.\n        constellation_list : str\n            The set of constellations to use.  Currently only ``'iau'`` is\n            supported, meaning the 88 \"modern\" constellations endorsed by the IAU.\n\n        Returns\n        -------\n        constellation : str or string array\n            If this is a scalar coordinate, returns the name of the\n            constellation.  If it is an array `SkyCoord`, it returns an array of\n            names.\n\n        Notes\n        -----\n        To determine which constellation a point on the sky is in, this first\n        precesses to B1875, and then uses the Delporte boundaries of the 88\n        modern constellations, as tabulated by\n        `Roman 1987 <http://cdsarc.u-strasbg.fr/viz-bin/Cat?VI/42>`_.\n\n        See Also\n        --------\n        astropy.coordinates.get_constellation\n        ","endLoc":1679,"header":"def get_constellation(self, short_name=False, constellation_list='iau')","id":4958,"name":"get_constellation","nodeType":"Function","startLoc":1635,"text":"def get_constellation(self, short_name=False, constellation_list='iau'):\n        \"\"\"\n        Determines the constellation(s) of the coordinates this `SkyCoord`\n        contains.\n\n        Parameters\n        ----------\n        short_name : bool\n            If True, the returned names are the IAU-sanctioned abbreviated\n            names.  Otherwise, full names for the constellations are used.\n        constellation_list : str\n            The set of constellations to use.  Currently only ``'iau'`` is\n            supported, meaning the 88 \"modern\" constellations endorsed by the IAU.\n\n        Returns\n        -------\n        constellation : str or string array\n            If this is a scalar coordinate, returns the name of the\n            constellation.  If it is an array `SkyCoord`, it returns an array of\n            names.\n\n        Notes\n        -----\n        To determine which constellation a point on the sky is in, this first\n        precesses to B1875, and then uses the Delporte boundaries of the 88\n        modern constellations, as tabulated by\n        `Roman 1987 <http://cdsarc.u-strasbg.fr/viz-bin/Cat?VI/42>`_.\n\n        See Also\n        --------\n        astropy.coordinates.get_constellation\n        \"\"\"\n        from .funcs import get_constellation\n\n        # because of issue #7028, the conversion to a PrecessedGeocentric\n        # system fails in some cases.  Work around is to  drop the velocities.\n        # they are not needed here since only position information is used\n        extra_frameattrs = {nm: getattr(self, nm)\n                            for nm in self._extra_frameattr_names}\n        novel = SkyCoord(self.realize_frame(self.data.without_differentials()),\n                         **extra_frameattrs)\n        return get_constellation(novel, short_name, constellation_list)\n\n        # the simpler version below can be used when gh-issue #7028 is resolved\n        # return get_constellation(self, short_name, constellation_list)"},{"fileName":"latex.py","filePath":"astropy/io/ascii","id":4959,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"An extensible ASCII table reader and writer.\n\nlatex.py:\n  Classes to read and write LaTeX tables\n\n:Copyright: Smithsonian Astrophysical Observatory (2011)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\"\n\n\nimport re\n\nfrom . import core\n\nlatexdicts = {'AA': {'tabletype': 'table',\n                     'header_start': r'\\hline \\hline', 'header_end': r'\\hline',\n                     'data_end': r'\\hline'},\n              'doublelines': {'tabletype': 'table',\n                              'header_start': r'\\hline \\hline', 'header_end': r'\\hline\\hline',\n                              'data_end': r'\\hline\\hline'},\n              'template': {'tabletype': 'tabletype', 'caption': 'caption',\n                           'tablealign': 'tablealign',\n                           'col_align': 'col_align', 'preamble': 'preamble',\n                           'header_start': 'header_start',\n                           'header_end': 'header_end', 'data_start': 'data_start',\n                           'data_end': 'data_end', 'tablefoot': 'tablefoot',\n                           'units': {'col1': 'unit of col1', 'col2': 'unit of col2'}}\n              }\n\n\nRE_COMMENT = re.compile(r'(?<!\\\\)%')  # % character but not \\%\n\n\ndef add_dictval_to_list(adict, key, alist):\n    '''\n    Add a value from a dictionary to a list\n\n    Parameters\n    ----------\n    adict : dictionary\n    key : hashable\n    alist : list\n        List where value should be added\n    '''\n    if key in adict:\n        if isinstance(adict[key], str):\n            alist.append(adict[key])\n        else:\n            alist.extend(adict[key])\n\n\ndef find_latex_line(lines, latex):\n    '''\n    Find the first line which matches a patters\n\n    Parameters\n    ----------\n    lines : list\n        List of strings\n    latex : str\n        Search pattern\n\n    Returns\n    -------\n    line_num : int, None\n        Line number. Returns None, if no match was found\n\n    '''\n    re_string = re.compile(latex.replace('\\\\', '\\\\\\\\'))\n    for i, line in enumerate(lines):\n        if re_string.match(line):\n            return i\n    else:\n        return None\n\n\nclass LatexInputter(core.BaseInputter):\n\n    def process_lines(self, lines):\n        return [lin.strip() for lin in lines]\n\n\nclass LatexSplitter(core.BaseSplitter):\n    '''Split LaTeX table date. Default delimiter is `&`.\n    '''\n    delimiter = '&'\n\n    def __call__(self, lines):\n        last_line = RE_COMMENT.split(lines[-1])[0].strip()\n        if not last_line.endswith(r'\\\\'):\n            lines[-1] = last_line + r'\\\\'\n\n        return super().__call__(lines)\n\n    def process_line(self, line):\n        \"\"\"Remove whitespace at the beginning or end of line. Also remove\n        \\\\ at end of line\"\"\"\n        line = RE_COMMENT.split(line)[0]\n        line = line.strip()\n        if line.endswith(r'\\\\'):\n            line = line.rstrip(r'\\\\')\n        else:\n            raise core.InconsistentTableError(r'Lines in LaTeX table have to end with \\\\')\n        return line\n\n    def process_val(self, val):\n        \"\"\"Remove whitespace and {} at the beginning or end of value.\"\"\"\n        val = val.strip()\n        if val and (val[0] == '{') and (val[-1] == '}'):\n            val = val[1:-1]\n        return val\n\n    def join(self, vals):\n        '''Join values together and add a few extra spaces for readability'''\n        delimiter = ' ' + self.delimiter + ' '\n        return delimiter.join(x.strip() for x in vals) + r' \\\\'\n\n\nclass LatexHeader(core.BaseHeader):\n    '''Class to read the header of Latex Tables'''\n    header_start = r'\\begin{tabular}'\n    splitter_class = LatexSplitter\n\n    def start_line(self, lines):\n        line = find_latex_line(lines, self.header_start)\n        if line is not None:\n            return line + 1\n        else:\n            return None\n\n    def _get_units(self):\n        units = {}\n        col_units = [col.info.unit for col in self.cols]\n        for name, unit in zip(self.colnames, col_units):\n            if unit:\n                try:\n                    units[name] = unit.to_string(format='latex_inline')\n                except AttributeError:\n                    units[name] = unit\n        return units\n\n    def write(self, lines):\n        if 'col_align' not in self.latex:\n            self.latex['col_align'] = len(self.cols) * 'c'\n        if 'tablealign' in self.latex:\n            align = '[' + self.latex['tablealign'] + ']'\n        else:\n            align = ''\n        if self.latex['tabletype'] is not None:\n            lines.append(r'\\begin{' + self.latex['tabletype'] + r'}' + align)\n        add_dictval_to_list(self.latex, 'preamble', lines)\n        if 'caption' in self.latex:\n            lines.append(r'\\caption{' + self.latex['caption'] + '}')\n        lines.append(self.header_start + r'{' + self.latex['col_align'] + r'}')\n        add_dictval_to_list(self.latex, 'header_start', lines)\n        lines.append(self.splitter.join(self.colnames))\n        units = self._get_units()\n        if 'units' in self.latex:\n            units.update(self.latex['units'])\n        if units:\n            lines.append(self.splitter.join([units.get(name, ' ') for name in self.colnames]))\n        add_dictval_to_list(self.latex, 'header_end', lines)\n\n\nclass LatexData(core.BaseData):\n    '''Class to read the data in LaTeX tables'''\n    data_start = None\n    data_end = r'\\end{tabular}'\n    splitter_class = LatexSplitter\n\n    def start_line(self, lines):\n        if self.data_start:\n            return find_latex_line(lines, self.data_start)\n        else:\n            start = self.header.start_line(lines)\n            if start is None:\n                raise core.InconsistentTableError(r'Could not find table start')\n            return start + 1\n\n    def end_line(self, lines):\n        if self.data_end:\n            return find_latex_line(lines, self.data_end)\n        else:\n            return None\n\n    def write(self, lines):\n        add_dictval_to_list(self.latex, 'data_start', lines)\n        core.BaseData.write(self, lines)\n        add_dictval_to_list(self.latex, 'data_end', lines)\n        lines.append(self.data_end)\n        add_dictval_to_list(self.latex, 'tablefoot', lines)\n        if self.latex['tabletype'] is not None:\n            lines.append(r'\\end{' + self.latex['tabletype'] + '}')\n\n\nclass Latex(core.BaseReader):\n    r'''LaTeX format table.\n\n    This class implements some LaTeX specific commands.  Its main\n    purpose is to write out a table in a form that LaTeX can compile. It\n    is beyond the scope of this class to implement every possible LaTeX\n    command, instead the focus is to generate a syntactically valid\n    LaTeX tables.\n\n    This class can also read simple LaTeX tables (one line per table\n    row, no ``\\multicolumn`` or similar constructs), specifically, it\n    can read the tables that it writes.\n\n    Reading a LaTeX table, the following keywords are accepted:\n\n    **ignore_latex_commands** :\n        Lines starting with these LaTeX commands will be treated as comments (i.e. ignored).\n\n    When writing a LaTeX table, the some keywords can customize the\n    format.  Care has to be taken here, because python interprets ``\\\\``\n    in a string as an escape character.  In order to pass this to the\n    output either format your strings as raw strings with the ``r``\n    specifier or use a double ``\\\\\\\\``.\n\n    Examples::\n\n        caption = r'My table \\label{mytable}'\n        caption = 'My table \\\\\\\\label{mytable}'\n\n    **latexdict** : Dictionary of extra parameters for the LaTeX output\n\n        * tabletype : used for first and last line of table.\n            The default is ``\\\\begin{table}``.  The following would generate a table,\n            which spans the whole page in a two-column document::\n\n                ascii.write(data, sys.stdout, Writer = ascii.Latex,\n                            latexdict = {'tabletype': 'table*'})\n\n            If ``None``, the table environment will be dropped, keeping only\n            the ``tabular`` environment.\n\n        * tablealign : positioning of table in text.\n            The default is not to specify a position preference in the text.\n            If, e.g. the alignment is ``ht``, then the LaTeX will be ``\\\\begin{table}[ht]``.\n\n        * col_align : Alignment of columns\n            If not present all columns will be centered.\n\n        * caption : Table caption (string or list of strings)\n            This will appear above the table as it is the standard in\n            many scientific publications.  If you prefer a caption below\n            the table, just write the full LaTeX command as\n            ``latexdict['tablefoot'] = r'\\caption{My table}'``\n\n        * preamble, header_start, header_end, data_start, data_end, tablefoot: Pure LaTeX\n            Each one can be a string or a list of strings. These strings\n            will be inserted into the table without any further\n            processing. See the examples below.\n\n        * units : dictionary of strings\n            Keys in this dictionary should be names of columns. If\n            present, a line in the LaTeX table directly below the column\n            names is added, which contains the values of the\n            dictionary. Example::\n\n              from astropy.io import ascii\n              data = {'name': ['bike', 'car'], 'mass': [75,1200], 'speed': [10, 130]}\n              ascii.write(data, Writer=ascii.Latex,\n                               latexdict = {'units': {'mass': 'kg', 'speed': 'km/h'}})\n\n            If the column has no entry in the ``units`` dictionary, it defaults\n            to the **unit** attribute of the column. If this attribute is not\n            specified (i.e. it is None), the unit will be written as ``' '``.\n\n        Run the following code to see where each element of the\n        dictionary is inserted in the LaTeX table::\n\n            from astropy.io import ascii\n            data = {'cola': [1,2], 'colb': [3,4]}\n            ascii.write(data, Writer=ascii.Latex, latexdict=ascii.latex.latexdicts['template'])\n\n        Some table styles are predefined in the dictionary\n        ``ascii.latex.latexdicts``. The following generates in table in\n        style preferred by A&A and some other journals::\n\n            ascii.write(data, Writer=ascii.Latex, latexdict=ascii.latex.latexdicts['AA'])\n\n        As an example, this generates a table, which spans all columns\n        and is centered on the page::\n\n            ascii.write(data, Writer=ascii.Latex, col_align='|lr|',\n                        latexdict={'preamble': r'\\begin{center}',\n                                   'tablefoot': r'\\end{center}',\n                                   'tabletype': 'table*'})\n\n    **caption** : Set table caption\n        Shorthand for::\n\n            latexdict['caption'] = caption\n\n    **col_align** : Set the column alignment.\n        If not present this will be auto-generated for centered\n        columns. Shorthand for::\n\n            latexdict['col_align'] = col_align\n\n    '''\n    _format_name = 'latex'\n    _io_registry_format_aliases = ['latex']\n    _io_registry_suffix = '.tex'\n    _description = 'LaTeX table'\n\n    header_class = LatexHeader\n    data_class = LatexData\n    inputter_class = LatexInputter\n\n    # Strictly speaking latex only supports 1-d columns so this should inherit\n    # the base max_ndim = 1. But as reported in #11695 this causes a strange\n    # problem with Jupyter notebook, which displays a table by first calling\n    # _repr_latex_. For a multidimensional table this issues a stack traceback\n    # before moving on to _repr_html_. Here we prioritize fixing the issue with\n    # Jupyter displaying a Table with multidimensional columns.\n    max_ndim = None\n\n    def __init__(self,\n                 ignore_latex_commands=['hline', 'vspace', 'tableline',\n                                        'toprule', 'midrule', 'bottomrule'],\n                 latexdict={}, caption='', col_align=None):\n\n        super().__init__()\n\n        self.latex = {}\n        # The latex dict drives the format of the table and needs to be shared\n        # with data and header\n        self.header.latex = self.latex\n        self.data.latex = self.latex\n        self.latex['tabletype'] = 'table'\n        self.latex.update(latexdict)\n        if caption:\n            self.latex['caption'] = caption\n        if col_align:\n            self.latex['col_align'] = col_align\n\n        self.ignore_latex_commands = ignore_latex_commands\n        self.header.comment = '%|' + '|'.join(\n            [r'\\\\' + command for command in self.ignore_latex_commands])\n        self.data.comment = self.header.comment\n\n    def write(self, table=None):\n        self.header.start_line = None\n        self.data.start_line = None\n        return core.BaseReader.write(self, table=table)\n\n\nclass AASTexHeaderSplitter(LatexSplitter):\n    r'''Extract column names from a `deluxetable`_.\n\n    This splitter expects the following LaTeX code **in a single line**:\n\n        \\tablehead{\\colhead{col1} & ... & \\colhead{coln}}\n    '''\n\n    def __call__(self, lines):\n        return super(LatexSplitter, self).__call__(lines)\n\n    def process_line(self, line):\n        \"\"\"extract column names from tablehead\n        \"\"\"\n        line = line.split('%')[0]\n        line = line.replace(r'\\tablehead', '')\n        line = line.strip()\n        if (line[0] == '{') and (line[-1] == '}'):\n            line = line[1:-1]\n        else:\n            raise core.InconsistentTableError(r'\\tablehead is missing {}')\n        return line.replace(r'\\colhead', '')\n\n    def join(self, vals):\n        return ' & '.join([r'\\colhead{' + str(x) + '}' for x in vals])\n\n\nclass AASTexHeader(LatexHeader):\n    r'''In a `deluxetable\n    <http://fits.gsfc.nasa.gov/standard30/deluxetable.sty>`_ some header\n    keywords differ from standard LaTeX.\n\n    This header is modified to take that into account.\n    '''\n    header_start = r'\\tablehead'\n    splitter_class = AASTexHeaderSplitter\n\n    def start_line(self, lines):\n        return find_latex_line(lines, r'\\tablehead')\n\n    def write(self, lines):\n        if 'col_align' not in self.latex:\n            self.latex['col_align'] = len(self.cols) * 'c'\n        if 'tablealign' in self.latex:\n            align = '[' + self.latex['tablealign'] + ']'\n        else:\n            align = ''\n        lines.append(r'\\begin{' + self.latex['tabletype'] + r'}{' + self.latex['col_align'] + r'}'\n                     + align)\n        add_dictval_to_list(self.latex, 'preamble', lines)\n        if 'caption' in self.latex:\n            lines.append(r'\\tablecaption{' + self.latex['caption'] + '}')\n        tablehead = ' & '.join([r'\\colhead{' + name + '}' for name in self.colnames])\n        units = self._get_units()\n        if 'units' in self.latex:\n            units.update(self.latex['units'])\n        if units:\n            tablehead += r'\\\\ ' + self.splitter.join([units.get(name, ' ')\n                                                      for name in self.colnames])\n        lines.append(r'\\tablehead{' + tablehead + '}')\n\n\nclass AASTexData(LatexData):\n    r'''In a `deluxetable`_ the data is enclosed in `\\startdata` and `\\enddata`\n    '''\n    data_start = r'\\startdata'\n    data_end = r'\\enddata'\n\n    def start_line(self, lines):\n        return find_latex_line(lines, self.data_start) + 1\n\n    def write(self, lines):\n        lines.append(self.data_start)\n        lines_length_initial = len(lines)\n        core.BaseData.write(self, lines)\n        # To remove extra space(s) and // appended which creates an extra new line\n        # in the end.\n        if len(lines) > lines_length_initial:\n            lines[-1] = re.sub(r'\\s* \\\\ \\\\ \\s* $', '', lines[-1],\n                               flags=re.VERBOSE)\n        lines.append(self.data_end)\n        add_dictval_to_list(self.latex, 'tablefoot', lines)\n        lines.append(r'\\end{' + self.latex['tabletype'] + r'}')\n\n\nclass AASTex(Latex):\n    '''AASTeX format table.\n\n    This class implements some AASTeX specific commands.\n    AASTeX is used for the AAS (American Astronomical Society)\n    publications like ApJ, ApJL and AJ.\n\n    It derives from the ``Latex`` reader and accepts the same\n    keywords.  However, the keywords ``header_start``, ``header_end``,\n    ``data_start`` and ``data_end`` in ``latexdict`` have no effect.\n    '''\n\n    _format_name = 'aastex'\n    _io_registry_format_aliases = ['aastex']\n    _io_registry_suffix = ''  # AASTex inherits from Latex, so override this class attr\n    _description = 'AASTeX deluxetable used for AAS journals'\n\n    header_class = AASTexHeader\n    data_class = AASTexData\n\n    def __init__(self, **kwargs):\n        super().__init__(**kwargs)\n        # check if tabletype was explicitly set by the user\n        if not (('latexdict' in kwargs) and ('tabletype' in kwargs['latexdict'])):\n            self.latex['tabletype'] = 'deluxetable'\n"},{"col":4,"comment":"null","endLoc":231,"header":"def write(self, lines)","id":4960,"name":"write","nodeType":"Function","startLoc":228,"text":"def write(self, lines):\n        # Header line not written until data are formatted.  Until then it is\n        # not known how wide each column will be for fixed width.\n        pass"},{"attributeType":"null","col":4,"comment":" Splitter class for splitting data lines into columns ","endLoc":68,"id":4961,"name":"splitter_class","nodeType":"Attribute","startLoc":68,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":" row index of line that specifies position (default = 1) ","endLoc":70,"id":4962,"name":"position_line","nodeType":"Attribute","startLoc":70,"text":"position_line"},{"attributeType":"ContinuationLinesInputter","col":4,"comment":"null","endLoc":142,"id":4963,"name":"inputter_class","nodeType":"Attribute","startLoc":142,"text":"inputter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":72,"id":4964,"name":"set_of_position_line_characters","nodeType":"Attribute","startLoc":72,"text":"set_of_position_line_characters"},{"attributeType":"null","col":12,"comment":"null","endLoc":116,"id":4965,"name":"names","nodeType":"Attribute","startLoc":116,"text":"self.names"},{"col":0,"comment":"\n    Determines the constellation(s) a given coordinate object contains.\n\n    Parameters\n    ----------\n    coord : coordinate-like\n        The object to determine the constellation of.\n    short_name : bool\n        If True, the returned names are the IAU-sanctioned abbreviated\n        names.  Otherwise, full names for the constellations are used.\n    constellation_list : str\n        The set of constellations to use.  Currently only ``'iau'`` is\n        supported, meaning the 88 \"modern\" constellations endorsed by the IAU.\n\n    Returns\n    -------\n    constellation : str or string array\n        If ``coords`` contains a scalar coordinate, returns the name of the\n        constellation.  If it is an array coordinate object, it returns an array\n        of names.\n\n    Notes\n    -----\n    To determine which constellation a point on the sky is in, this precesses\n    to B1875, and then uses the Delporte boundaries of the 88 modern\n    constellations, as tabulated by\n    `Roman 1987 <http://cdsarc.u-strasbg.fr/viz-bin/Cat?VI/42>`_.\n    ","endLoc":263,"header":"def get_constellation(coord, short_name=False, constellation_list='iau')","id":4966,"name":"get_constellation","nodeType":"Function","startLoc":177,"text":"def get_constellation(coord, short_name=False, constellation_list='iau'):\n    \"\"\"\n    Determines the constellation(s) a given coordinate object contains.\n\n    Parameters\n    ----------\n    coord : coordinate-like\n        The object to determine the constellation of.\n    short_name : bool\n        If True, the returned names are the IAU-sanctioned abbreviated\n        names.  Otherwise, full names for the constellations are used.\n    constellation_list : str\n        The set of constellations to use.  Currently only ``'iau'`` is\n        supported, meaning the 88 \"modern\" constellations endorsed by the IAU.\n\n    Returns\n    -------\n    constellation : str or string array\n        If ``coords`` contains a scalar coordinate, returns the name of the\n        constellation.  If it is an array coordinate object, it returns an array\n        of names.\n\n    Notes\n    -----\n    To determine which constellation a point on the sky is in, this precesses\n    to B1875, and then uses the Delporte boundaries of the 88 modern\n    constellations, as tabulated by\n    `Roman 1987 <http://cdsarc.u-strasbg.fr/viz-bin/Cat?VI/42>`_.\n    \"\"\"\n    if constellation_list != 'iau':\n        raise ValueError(\"only 'iau' us currently supported for constellation_list\")\n\n    # read the data files and cache them if they haven't been already\n    if not _constellation_data:\n        cdata = data.get_pkg_data_contents('data/constellation_data_roman87.dat')\n        ctable = ascii.read(cdata, names=['ral', 'rau', 'decl', 'name'])\n        cnames = data.get_pkg_data_contents('data/constellation_names.dat', encoding='UTF8')\n        cnames_short_to_long = dict([(l[:3], l[4:])\n                                     for l in cnames.split('\\n')\n                                     if not l.startswith('#')])\n        cnames_long = np.array([cnames_short_to_long[nm] for nm in ctable['name']])\n\n        _constellation_data['ctable'] = ctable\n        _constellation_data['cnames_long'] = cnames_long\n    else:\n        ctable = _constellation_data['ctable']\n        cnames_long = _constellation_data['cnames_long']\n\n    isscalar = coord.isscalar\n\n    # if it is geocentric, we reproduce the frame but with the 1875 equinox,\n    # which is where the constellations are defined\n    # this yields a \"dubious year\" warning because ERFA considers the year 1875\n    # \"dubious\", probably because UTC isn't well-defined then and precession\n    # models aren't precisely calibrated back to then.  But it's plenty\n    # sufficient for constellations\n    with warnings.catch_warnings():\n        warnings.simplefilter('ignore', erfa.ErfaWarning)\n        constel_coord = coord.transform_to(PrecessedGeocentric(equinox='B1875'))\n    if isscalar:\n        rah = constel_coord.ra.ravel().hour\n        decd = constel_coord.dec.ravel().deg\n    else:\n        rah = constel_coord.ra.hour\n        decd = constel_coord.dec.deg\n\n    constellidx = -np.ones(len(rah), dtype=int)\n\n    notided = constellidx == -1  # should be all\n    for i, row in enumerate(ctable):\n        msk = (row['ral'] < rah) & (rah < row['rau']) & (decd > row['decl'])\n        constellidx[notided & msk] = i\n        notided = constellidx == -1\n        if np.sum(notided) == 0:\n            break\n    else:\n        raise ValueError(f'Could not find constellation for coordinates {constel_coord[notided]}')\n\n    if short_name:\n        names = ctable['name'][constellidx]\n    else:\n        names = cnames_long[constellidx]\n\n    if isscalar:\n        return names[0]\n    else:\n        return names"},{"attributeType":"null","col":16,"comment":"null","endLoc":150,"id":4967,"name":"col_ends","nodeType":"Attribute","startLoc":150,"text":"self.col_ends"},{"attributeType":"null","col":22,"comment":"null","endLoc":149,"id":4968,"name":"col_starts","nodeType":"Attribute","startLoc":149,"text":"self.col_starts"},{"className":"FixedWidthTwoLineDataSplitter","col":0,"comment":"Splitter for fixed width tables splitting on ``' '``.","endLoc":370,"id":4969,"nodeType":"Class","startLoc":368,"text":"class FixedWidthTwoLineDataSplitter(FixedWidthSplitter):\n    '''Splitter for fixed width tables splitting on ``' '``.'''\n    delimiter = ' '"},{"className":"FixedWidthSplitter","col":0,"comment":"\n    Split line based on fixed start and end positions for each ``col`` in\n    ``self.cols``.\n\n    This class requires that the Header class will have defined ``col.start``\n    and ``col.end`` for each column.  The reference to the ``header.cols`` gets\n    put in the splitter object by the base Reader.read() function just in time\n    for splitting data lines by a ``data`` object.\n\n    Note that the ``start`` and ``end`` positions are defined in the pythonic\n    style so line[start:end] is the desired substring for a column.  This splitter\n    class does not have a hook for ``process_lines`` since that is generally not\n    useful for fixed-width input.\n\n    ","endLoc":56,"id":4970,"nodeType":"Class","startLoc":17,"text":"class FixedWidthSplitter(core.BaseSplitter):\n    \"\"\"\n    Split line based on fixed start and end positions for each ``col`` in\n    ``self.cols``.\n\n    This class requires that the Header class will have defined ``col.start``\n    and ``col.end`` for each column.  The reference to the ``header.cols`` gets\n    put in the splitter object by the base Reader.read() function just in time\n    for splitting data lines by a ``data`` object.\n\n    Note that the ``start`` and ``end`` positions are defined in the pythonic\n    style so line[start:end] is the desired substring for a column.  This splitter\n    class does not have a hook for ``process_lines`` since that is generally not\n    useful for fixed-width input.\n\n    \"\"\"\n    delimiter_pad = ''\n    bookend = False\n    delimiter = '|'\n\n    def __call__(self, lines):\n        for line in lines:\n            vals = [line[x.start:x.end] for x in self.cols]\n            if self.process_val:\n                yield [self.process_val(x) for x in vals]\n            else:\n                yield vals\n\n    def join(self, vals, widths):\n        pad = self.delimiter_pad or ''\n        delimiter = self.delimiter or ''\n        padded_delim = pad + delimiter + pad\n        if self.bookend:\n            bookend_left = delimiter + pad\n            bookend_right = pad + delimiter\n        else:\n            bookend_left = ''\n            bookend_right = ''\n        vals = [' ' * (width - len(val)) + val for val, width in zip(vals, widths)]\n        return bookend_left + padded_delim.join(vals) + bookend_right"},{"col":0,"comment":"","endLoc":8,"header":"sextractor.py#<anonymous>","id":4971,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\" sextractor.py:\n  Classes to read SExtractor table format\n\nBuilt on daophot.py:\n:Copyright: Smithsonian Astrophysical Observatory (2011)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\""},{"col":4,"comment":"null","endLoc":43,"header":"def __call__(self, lines)","id":4972,"name":"__call__","nodeType":"Function","startLoc":37,"text":"def __call__(self, lines):\n        for line in lines:\n            vals = [line[x.start:x.end] for x in self.cols]\n            if self.process_val:\n                yield [self.process_val(x) for x in vals]\n            else:\n                yield vals"},{"className":"LatexInputter","col":0,"comment":"null","endLoc":81,"id":4973,"nodeType":"Class","startLoc":78,"text":"class LatexInputter(core.BaseInputter):\n\n    def process_lines(self, lines):\n        return [lin.strip() for lin in lines]"},{"col":4,"comment":"\n        Parameters\n        ----------\n        file : writable file-like\n        ","endLoc":73,"header":"def __init__(self, file)","id":4974,"name":"__init__","nodeType":"Function","startLoc":58,"text":"def __init__(self, file):\n        \"\"\"\n        Parameters\n        ----------\n        file : writable file-like\n        \"\"\"\n        self.write = file.write\n        if hasattr(file, \"flush\"):\n            self.flush = file.flush\n        self._open = 0  # true if start tag is open\n        self._tags = []\n        self._data = []\n        self._indentation = \" \" * 64\n\n        self.xml_escape_cdata = xml_escape_cdata\n        self.xml_escape = xml_escape"},{"fileName":"cds.py","filePath":"astropy/io/ascii","id":4975,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"An extensible ASCII table reader and writer.\n\ncds.py:\n  Classes to read CDS / Vizier table format\n\n:Copyright: Smithsonian Astrophysical Observatory (2011)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\"\n\n\nimport fnmatch\nimport itertools\nimport re\nimport os\nfrom contextlib import suppress\n\nfrom . import core\nfrom . import fixedwidth\n\nfrom astropy.units import Unit\n\n\n__doctest_skip__ = ['*']\n\n\nclass CdsHeader(core.BaseHeader):\n    _subfmt = 'CDS'\n\n    col_type_map = {'e': core.FloatType,\n                    'f': core.FloatType,\n                    'i': core.IntType,\n                    'a': core.StrType}\n\n    'The ReadMe file to construct header from.'\n    readme = None\n\n    def get_type_map_key(self, col):\n        match = re.match(r'\\d*(\\S)', col.raw_type.lower())\n        if not match:\n            raise ValueError('Unrecognized {} format \"{}\" for column \"{}\"'.format(\n                self._subfmt, col.raw_type, col.name))\n        return match.group(1)\n\n    def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines`` for a CDS/MRT\n        header.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n\n        # Read header block for the table ``self.data.table_name`` from the read\n        # me file ``self.readme``.\n        if self.readme and self.data.table_name:\n            in_header = False\n            readme_inputter = core.BaseInputter()\n            f = readme_inputter.get_lines(self.readme)\n            # Header info is not in data lines but in a separate file.\n            lines = []\n            comment_lines = 0\n            for line in f:\n                line = line.strip()\n                if in_header:\n                    lines.append(line)\n                    if line.startswith(('------', '=======')):\n                        comment_lines += 1\n                        if comment_lines == 3:\n                            break\n                else:\n                    match = re.match(r'Byte-by-byte Description of file: (?P<name>.+)$',\n                                     line, re.IGNORECASE)\n                    if match:\n                        # Split 'name' in case in contains multiple files\n                        names = [s for s in re.split('[, ]+', match.group('name'))\n                                 if s]\n                        # Iterate on names to find if one matches the tablename\n                        # including wildcards.\n                        for pattern in names:\n                            if fnmatch.fnmatch(self.data.table_name, pattern):\n                                in_header = True\n                                lines.append(line)\n                                break\n\n            else:\n                raise core.InconsistentTableError(\"Can't find table {} in {}\".format(\n                    self.data.table_name, self.readme))\n\n        found_line = False\n\n        for i_col_def, line in enumerate(lines):\n            if re.match(r'Byte-by-byte Description', line, re.IGNORECASE):\n                found_line = True\n            elif found_line:  # First line after list of file descriptions\n                i_col_def -= 1  # Set i_col_def to last description line\n                break\n        else:\n            raise ValueError('no line with \"Byte-by-byte Description\" found')\n\n        re_col_def = re.compile(r\"\"\"\\s*\n                                    (?P<start> \\d+ \\s* -)? \\s*\n                                    (?P<end>   \\d+)        \\s+\n                                    (?P<format> [\\w.]+)     \\s+\n                                    (?P<units> \\S+)        \\s+\n                                    (?P<name>  \\S+)\n                                    (\\s+ (?P<descr> \\S.*))?\"\"\",\n                                re.VERBOSE)\n\n        cols = []\n        for line in itertools.islice(lines, i_col_def + 4, None):\n            if line.startswith(('------', '=======')):\n                break\n            match = re_col_def.match(line)\n            if match:\n                col = core.Column(name=match.group('name'))\n                col.start = int(re.sub(r'[-\\s]', '',\n                                       match.group('start') or match.group('end'))) - 1\n                col.end = int(match.group('end'))\n                unit = match.group('units')\n                if unit == '---':\n                    col.unit = None  # \"---\" is the marker for no unit in CDS/MRT table\n                else:\n                    col.unit = Unit(unit, format='cds', parse_strict='warn')\n                col.description = (match.group('descr') or '').strip()\n                col.raw_type = match.group('format')\n                col.type = self.get_col_type(col)\n\n                match = re.match(\n                    r'(?P<limits>[\\[\\]] \\S* [\\[\\]])?'  # Matches limits specifier (eg [])\n                                                       # that may or may not be present\n                    r'\\?'  # Matches '?' directly\n                    r'((?P<equal>=)(?P<nullval> \\S*))?'  # Matches to nullval if and only\n                                                         # if '=' is present\n                    r'(?P<order>[-+]?[=]?)'  # Matches to order specifier:\n                                             # ('+', '-', '+=', '-=')\n                    r'(\\s* (?P<descriptiontext> \\S.*))?',  # Matches description text even\n                                                           # even if no whitespace is\n                                                           # present after '?'\n                    col.description, re.VERBOSE)\n                if match:\n                    col.description = (match.group('descriptiontext') or '').strip()\n                    if issubclass(col.type, core.FloatType):\n                        fillval = 'nan'\n                    else:\n                        fillval = '0'\n\n                    if match.group('nullval') == '-':\n                        col.null = '---'\n                        # CDS/MRT tables can use -, --, ---, or ---- to mark missing values\n                        # see https://github.com/astropy/astropy/issues/1335\n                        for i in [1, 2, 3, 4]:\n                            self.data.fill_values.append(('-' * i, fillval, col.name))\n                    else:\n                        col.null = match.group('nullval')\n                        if (col.null is None):\n                            col.null = ''\n                        self.data.fill_values.append((col.null, fillval, col.name))\n\n                cols.append(col)\n            else:  # could be a continuation of the previous col's description\n                if cols:\n                    cols[-1].description += line.strip()\n                else:\n                    raise ValueError(f'Line \"{line}\" not parsable as CDS header')\n\n        self.names = [x.name for x in cols]\n\n        self.cols = cols\n\n\nclass CdsData(core.BaseData):\n    \"\"\"CDS table data reader\n    \"\"\"\n    _subfmt = 'CDS'\n    splitter_class = fixedwidth.FixedWidthSplitter\n\n    def process_lines(self, lines):\n        \"\"\"Skip over CDS/MRT header by finding the last section delimiter\"\"\"\n        # If the header has a ReadMe and data has a filename\n        # then no need to skip, as the data lines do not have header\n        # info. The ``read`` method adds the table_name to the ``data``\n        # attribute.\n        if self.header.readme and self.table_name:\n            return lines\n        i_sections = [i for i, x in enumerate(lines)\n                      if x.startswith(('------', '======='))]\n        if not i_sections:\n            raise core.InconsistentTableError(f'No {self._subfmt} section delimiter found')\n        return lines[i_sections[-1]+1:]  # noqa\n\n\nclass Cds(core.BaseReader):\n    \"\"\"CDS format table.\n\n    See: http://vizier.u-strasbg.fr/doc/catstd.htx\n\n    Example::\n\n      Table: Table name here\n      = ==============================================================================\n      Catalog reference paper\n          Bibliography info here\n      ================================================================================\n      ADC_Keywords: Keyword ; Another keyword ; etc\n\n      Description:\n          Catalog description here.\n      ================================================================================\n      Byte-by-byte Description of file: datafile3.txt\n      --------------------------------------------------------------------------------\n         Bytes Format Units  Label  Explanations\n      --------------------------------------------------------------------------------\n         1-  3 I3     ---    Index  Running identification number\n         5-  6 I2     h      RAh    Hour of Right Ascension (J2000)\n         8-  9 I2     min    RAm    Minute of Right Ascension (J2000)\n        11- 15 F5.2   s      RAs    Second of Right Ascension (J2000)\n      --------------------------------------------------------------------------------\n      Note (1): A CDS file can contain sections with various metadata.\n                Notes can be multiple lines.\n      Note (2): Another note.\n      --------------------------------------------------------------------------------\n        1 03 28 39.09\n        2 04 18 24.11\n\n    **About parsing the CDS format**\n\n    The CDS format consists of a table description and the table data.  These\n    can be in separate files as a ``ReadMe`` file plus data file(s), or\n    combined in a single file.  Different subsections within the description\n    are separated by lines of dashes or equal signs (\"------\" or \"======\").\n    The table which specifies the column information must be preceded by a line\n    starting with \"Byte-by-byte Description of file:\".\n\n    In the case where the table description is combined with the data values,\n    the data must be in the last section and must be preceded by a section\n    delimiter line (dashes or equal signs only).\n\n    **Basic usage**\n\n    Use the ``ascii.read()`` function as normal, with an optional ``readme``\n    parameter indicating the CDS ReadMe file.  If not supplied it is assumed that\n    the header information is at the top of the given table.  Examples::\n\n      >>> from astropy.io import ascii\n      >>> table = ascii.read(\"data/cds.dat\")\n      >>> table = ascii.read(\"data/vizier/table1.dat\", readme=\"data/vizier/ReadMe\")\n      >>> table = ascii.read(\"data/cds/multi/lhs2065.dat\", readme=\"data/cds/multi/ReadMe\")\n      >>> table = ascii.read(\"data/cds/glob/lmxbrefs.dat\", readme=\"data/cds/glob/ReadMe\")\n\n    The table name and the CDS ReadMe file can be entered as URLs.  This can be used\n    to directly load tables from the Internet.  For example, Vizier tables from the\n    CDS::\n\n      >>> table = ascii.read(\"ftp://cdsarc.u-strasbg.fr/pub/cats/VII/253/snrs.dat\",\n      ...             readme=\"ftp://cdsarc.u-strasbg.fr/pub/cats/VII/253/ReadMe\")\n\n    If the header (ReadMe) and data are stored in a single file and there\n    is content between the header and the data (for instance Notes), then the\n    parsing process may fail.  In this case you can instruct the reader to\n    guess the actual start of the data by supplying ``data_start='guess'`` in the\n    call to the ``ascii.read()`` function.  You should verify that the output\n    data table matches expectation based on the input CDS file.\n\n    **Using a reader object**\n\n    When ``Cds`` reader object is created with a ``readme`` parameter\n    passed to it at initialization, then when the ``read`` method is\n    executed with a table filename, the header information for the\n    specified table is taken from the ``readme`` file.  An\n    ``InconsistentTableError`` is raised if the ``readme`` file does not\n    have header information for the given table.\n\n      >>> readme = \"data/vizier/ReadMe\"\n      >>> r = ascii.get_reader(ascii.Cds, readme=readme)\n      >>> table = r.read(\"data/vizier/table1.dat\")\n      >>> # table5.dat has the same ReadMe file\n      >>> table = r.read(\"data/vizier/table5.dat\")\n\n    If no ``readme`` parameter is specified, then the header\n    information is assumed to be at the top of the given table.\n\n      >>> r = ascii.get_reader(ascii.Cds)\n      >>> table = r.read(\"data/cds.dat\")\n      >>> #The following gives InconsistentTableError, since no\n      >>> #readme file was given and table1.dat does not have a header.\n      >>> table = r.read(\"data/vizier/table1.dat\")\n      Traceback (most recent call last):\n        ...\n      InconsistentTableError: No CDS section delimiter found\n\n    Caveats:\n\n    * The Units and Explanations are available in the column ``unit`` and\n      ``description`` attributes, respectively.\n    * The other metadata defined by this format is not available in the output table.\n    \"\"\"\n    _format_name = 'cds'\n    _io_registry_format_aliases = ['cds']\n    _io_registry_can_write = False\n    _description = 'CDS format table'\n\n    data_class = CdsData\n    header_class = CdsHeader\n\n    def __init__(self, readme=None):\n        super().__init__()\n        self.header.readme = readme\n\n    def write(self, table=None):\n        \"\"\"Not available for the CDS class (raises NotImplementedError)\"\"\"\n        raise NotImplementedError\n\n    def read(self, table):\n        # If the read kwarg `data_start` is 'guess' then the table may have extraneous\n        # lines between the end of the header and the beginning of data.\n        if self.data.start_line == 'guess':\n            # Replicate the first part of BaseReader.read up to the point where\n            # the table lines are initially read in.\n            with suppress(TypeError):\n                # For strings only\n                if os.linesep not in table + '':\n                    self.data.table_name = os.path.basename(table)\n\n            self.data.header = self.header\n            self.header.data = self.data\n\n            # Get a list of the lines (rows) in the table\n            lines = self.inputter.get_lines(table)\n\n            # Now try increasing data.start_line by one until the table reads successfully.\n            # For efficiency use the in-memory list of lines instead of `table`, which\n            # could be a file.\n            for data_start in range(len(lines)):\n                self.data.start_line = data_start\n                with suppress(Exception):\n                    table = super().read(lines)\n                    return table\n        else:\n            return super().read(table)\n"},{"col":4,"comment":"null","endLoc":56,"header":"def join(self, vals, widths)","id":4976,"name":"join","nodeType":"Function","startLoc":45,"text":"def join(self, vals, widths):\n        pad = self.delimiter_pad or ''\n        delimiter = self.delimiter or ''\n        padded_delim = pad + delimiter + pad\n        if self.bookend:\n            bookend_left = delimiter + pad\n            bookend_right = pad + delimiter\n        else:\n            bookend_left = ''\n            bookend_right = ''\n        vals = [' ' * (width - len(val)) + val for val, width in zip(vals, widths)]\n        return bookend_left + padded_delim.join(vals) + bookend_right"},{"attributeType":"null","col":4,"comment":"null","endLoc":33,"id":4977,"name":"delimiter_pad","nodeType":"Attribute","startLoc":33,"text":"delimiter_pad"},{"attributeType":"null","col":4,"comment":"null","endLoc":34,"id":4978,"name":"bookend","nodeType":"Attribute","startLoc":34,"text":"bookend"},{"attributeType":"null","col":4,"comment":"null","endLoc":35,"id":4979,"name":"delimiter","nodeType":"Attribute","startLoc":35,"text":"delimiter"},{"attributeType":"null","col":4,"comment":"null","endLoc":370,"id":4980,"name":"delimiter","nodeType":"Attribute","startLoc":370,"text":"delimiter"},{"className":"SimpleRSTHeader","col":0,"comment":"null","endLoc":24,"id":4981,"nodeType":"Class","startLoc":14,"text":"class SimpleRSTHeader(FixedWidthHeader):\n    position_line = 0\n    start_line = 1\n    splitter_class = DefaultSplitter\n    position_char = '='\n\n    def get_fixedwidth_params(self, line):\n        vals, starts, ends = super().get_fixedwidth_params(line)\n        # The right hand column can be unbounded\n        ends[-1] = None\n        return vals, starts, ends"},{"col":4,"comment":"null","endLoc":24,"header":"def get_fixedwidth_params(self, line)","id":4982,"name":"get_fixedwidth_params","nodeType":"Function","startLoc":20,"text":"def get_fixedwidth_params(self, line):\n        vals, starts, ends = super().get_fixedwidth_params(line)\n        # The right hand column can be unbounded\n        ends[-1] = None\n        return vals, starts, ends"},{"col":4,"comment":"null","endLoc":81,"header":"def process_lines(self, lines)","id":4983,"name":"process_lines","nodeType":"Function","startLoc":80,"text":"def process_lines(self, lines):\n        return [lin.strip() for lin in lines]"},{"className":"CdsHeader","col":0,"comment":"null","endLoc":172,"id":4984,"nodeType":"Class","startLoc":27,"text":"class CdsHeader(core.BaseHeader):\n    _subfmt = 'CDS'\n\n    col_type_map = {'e': core.FloatType,\n                    'f': core.FloatType,\n                    'i': core.IntType,\n                    'a': core.StrType}\n\n    'The ReadMe file to construct header from.'\n    readme = None\n\n    def get_type_map_key(self, col):\n        match = re.match(r'\\d*(\\S)', col.raw_type.lower())\n        if not match:\n            raise ValueError('Unrecognized {} format \"{}\" for column \"{}\"'.format(\n                self._subfmt, col.raw_type, col.name))\n        return match.group(1)\n\n    def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines`` for a CDS/MRT\n        header.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n\n        # Read header block for the table ``self.data.table_name`` from the read\n        # me file ``self.readme``.\n        if self.readme and self.data.table_name:\n            in_header = False\n            readme_inputter = core.BaseInputter()\n            f = readme_inputter.get_lines(self.readme)\n            # Header info is not in data lines but in a separate file.\n            lines = []\n            comment_lines = 0\n            for line in f:\n                line = line.strip()\n                if in_header:\n                    lines.append(line)\n                    if line.startswith(('------', '=======')):\n                        comment_lines += 1\n                        if comment_lines == 3:\n                            break\n                else:\n                    match = re.match(r'Byte-by-byte Description of file: (?P<name>.+)$',\n                                     line, re.IGNORECASE)\n                    if match:\n                        # Split 'name' in case in contains multiple files\n                        names = [s for s in re.split('[, ]+', match.group('name'))\n                                 if s]\n                        # Iterate on names to find if one matches the tablename\n                        # including wildcards.\n                        for pattern in names:\n                            if fnmatch.fnmatch(self.data.table_name, pattern):\n                                in_header = True\n                                lines.append(line)\n                                break\n\n            else:\n                raise core.InconsistentTableError(\"Can't find table {} in {}\".format(\n                    self.data.table_name, self.readme))\n\n        found_line = False\n\n        for i_col_def, line in enumerate(lines):\n            if re.match(r'Byte-by-byte Description', line, re.IGNORECASE):\n                found_line = True\n            elif found_line:  # First line after list of file descriptions\n                i_col_def -= 1  # Set i_col_def to last description line\n                break\n        else:\n            raise ValueError('no line with \"Byte-by-byte Description\" found')\n\n        re_col_def = re.compile(r\"\"\"\\s*\n                                    (?P<start> \\d+ \\s* -)? \\s*\n                                    (?P<end>   \\d+)        \\s+\n                                    (?P<format> [\\w.]+)     \\s+\n                                    (?P<units> \\S+)        \\s+\n                                    (?P<name>  \\S+)\n                                    (\\s+ (?P<descr> \\S.*))?\"\"\",\n                                re.VERBOSE)\n\n        cols = []\n        for line in itertools.islice(lines, i_col_def + 4, None):\n            if line.startswith(('------', '=======')):\n                break\n            match = re_col_def.match(line)\n            if match:\n                col = core.Column(name=match.group('name'))\n                col.start = int(re.sub(r'[-\\s]', '',\n                                       match.group('start') or match.group('end'))) - 1\n                col.end = int(match.group('end'))\n                unit = match.group('units')\n                if unit == '---':\n                    col.unit = None  # \"---\" is the marker for no unit in CDS/MRT table\n                else:\n                    col.unit = Unit(unit, format='cds', parse_strict='warn')\n                col.description = (match.group('descr') or '').strip()\n                col.raw_type = match.group('format')\n                col.type = self.get_col_type(col)\n\n                match = re.match(\n                    r'(?P<limits>[\\[\\]] \\S* [\\[\\]])?'  # Matches limits specifier (eg [])\n                                                       # that may or may not be present\n                    r'\\?'  # Matches '?' directly\n                    r'((?P<equal>=)(?P<nullval> \\S*))?'  # Matches to nullval if and only\n                                                         # if '=' is present\n                    r'(?P<order>[-+]?[=]?)'  # Matches to order specifier:\n                                             # ('+', '-', '+=', '-=')\n                    r'(\\s* (?P<descriptiontext> \\S.*))?',  # Matches description text even\n                                                           # even if no whitespace is\n                                                           # present after '?'\n                    col.description, re.VERBOSE)\n                if match:\n                    col.description = (match.group('descriptiontext') or '').strip()\n                    if issubclass(col.type, core.FloatType):\n                        fillval = 'nan'\n                    else:\n                        fillval = '0'\n\n                    if match.group('nullval') == '-':\n                        col.null = '---'\n                        # CDS/MRT tables can use -, --, ---, or ---- to mark missing values\n                        # see https://github.com/astropy/astropy/issues/1335\n                        for i in [1, 2, 3, 4]:\n                            self.data.fill_values.append(('-' * i, fillval, col.name))\n                    else:\n                        col.null = match.group('nullval')\n                        if (col.null is None):\n                            col.null = ''\n                        self.data.fill_values.append((col.null, fillval, col.name))\n\n                cols.append(col)\n            else:  # could be a continuation of the previous col's description\n                if cols:\n                    cols[-1].description += line.strip()\n                else:\n                    raise ValueError(f'Line \"{line}\" not parsable as CDS header')\n\n        self.names = [x.name for x in cols]\n\n        self.cols = cols"},{"attributeType":"null","col":4,"comment":"null","endLoc":15,"id":4985,"name":"position_line","nodeType":"Attribute","startLoc":15,"text":"position_line"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":4986,"name":"start_line","nodeType":"Attribute","startLoc":16,"text":"start_line"},{"attributeType":"DefaultSplitter","col":4,"comment":"null","endLoc":17,"id":4987,"name":"splitter_class","nodeType":"Attribute","startLoc":17,"text":"splitter_class"},{"attributeType":"null","col":8,"comment":"null","endLoc":153,"id":4988,"name":"names","nodeType":"Attribute","startLoc":153,"text":"self.names"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":4989,"name":"position_char","nodeType":"Attribute","startLoc":18,"text":"position_char"},{"className":"SimpleRSTData","col":0,"comment":"null","endLoc":30,"id":4990,"nodeType":"Class","startLoc":27,"text":"class SimpleRSTData(FixedWidthData):\n    start_line = 3\n    end_line = -1\n    splitter_class = FixedWidthTwoLineDataSplitter"},{"attributeType":"null","col":12,"comment":"null","endLoc":142,"id":4991,"name":"table_meta","nodeType":"Attribute","startLoc":142,"text":"self.table_meta"},{"attributeType":"null","col":8,"comment":"null","endLoc":134,"id":4992,"name":"ecsv_version","nodeType":"Attribute","startLoc":134,"text":"self.ecsv_version"},{"attributeType":"null","col":4,"comment":"null","endLoc":28,"id":4993,"name":"start_line","nodeType":"Attribute","startLoc":28,"text":"start_line"},{"col":4,"comment":"null","endLoc":43,"header":"def get_type_map_key(self, col)","id":4994,"name":"get_type_map_key","nodeType":"Function","startLoc":38,"text":"def get_type_map_key(self, col):\n        match = re.match(r'\\d*(\\S)', col.raw_type.lower())\n        if not match:\n            raise ValueError('Unrecognized {} format \"{}\" for column \"{}\"'.format(\n                self._subfmt, col.raw_type, col.name))\n        return match.group(1)"},{"attributeType":"null","col":4,"comment":"null","endLoc":29,"id":4995,"name":"end_line","nodeType":"Attribute","startLoc":29,"text":"end_line"},{"attributeType":"FixedWidthTwoLineDataSplitter","col":4,"comment":"null","endLoc":30,"id":4996,"name":"splitter_class","nodeType":"Attribute","startLoc":30,"text":"splitter_class"},{"className":"EcsvOutputter","col":0,"comment":"\n    After reading the input lines and processing, convert the Reader columns\n    and metadata to an astropy.table.Table object.  This overrides the default\n    converters to be an empty list because there is no \"guessing\" of the\n    conversion function.\n    ","endLoc":335,"id":4997,"nodeType":"Class","startLoc":209,"text":"class EcsvOutputter(core.TableOutputter):\n    \"\"\"\n    After reading the input lines and processing, convert the Reader columns\n    and metadata to an astropy.table.Table object.  This overrides the default\n    converters to be an empty list because there is no \"guessing\" of the\n    conversion function.\n    \"\"\"\n    default_converters = []\n\n    def __call__(self, cols, meta):\n        # Convert to a Table with all plain Column subclass columns\n        out = super().__call__(cols, meta)\n\n        # If mixin columns exist (based on the special '__mixin_columns__'\n        # key in the table ``meta``), then use that information to construct\n        # appropriate mixin columns and remove the original data columns.\n        # If no __mixin_columns__ exists then this function just passes back\n        # the input table.\n        out = serialize._construct_mixins_from_columns(out)\n\n        return out\n\n    def _convert_vals(self, cols):\n        \"\"\"READ: Convert str_vals in `cols` to final arrays with correct dtypes.\n\n        This is adapted from ``BaseOutputter._convert_vals``. In the case of ECSV\n        there is no guessing and all types are known in advance. A big change\n        is handling the possibility of JSON-encoded values, both unstructured\n        object data and structured values that may contain masked data.\n        \"\"\"\n        for col in cols:\n            try:\n                # 1-d or N-d object columns are serialized as JSON.\n                if col.subtype == 'object':\n                    _check_dtype_is_str(col)\n                    col_vals = [json.loads(val) for val in col.str_vals]\n                    col.data = np.empty([len(col_vals)] + col.shape, dtype=object)\n                    col.data[...] = col_vals\n\n                # Variable length arrays with shape (n, m, ..., *) for fixed\n                # n, m, .. and variable in last axis. Masked values here are\n                # not currently supported.\n                elif col.shape and col.shape[-1] is None:\n                    _check_dtype_is_str(col)\n\n                    # Empty (blank) values in original ECSV are changed to \"0\"\n                    # in str_vals with corresponding col.mask being created and\n                    # set accordingly. Instead use an empty list here.\n                    if hasattr(col, 'mask'):\n                        for idx in np.nonzero(col.mask)[0]:\n                            col.str_vals[idx] = '[]'\n\n                    # Remake as a 1-d object column of numpy ndarrays or\n                    # MaskedArray using the datatype specified in the ECSV file.\n                    col_vals = []\n                    for str_val in col.str_vals:\n                        obj_val = json.loads(str_val)  # list or nested lists\n                        try:\n                            arr_val = np.array(obj_val, dtype=col.subtype)\n                        except TypeError:\n                            # obj_val has entries that are inconsistent with\n                            # dtype. For a valid ECSV file the only possibility\n                            # is None values (indicating missing values).\n                            data = np.array(obj_val, dtype=object)\n                            # Replace all the None with an appropriate fill value\n                            mask = (data == None)  # noqa: E711\n                            kind = np.dtype(col.subtype).kind\n                            data[mask] = {'U': '', 'S': b''}.get(kind, 0)\n                            arr_val = np.ma.array(data.astype(col.subtype), mask=mask)\n\n                        col_vals.append(arr_val)\n\n                    col.shape = ()\n                    col.dtype = np.dtype(object)\n                    # np.array(col_vals_arr, dtype=object) fails ?? so this workaround:\n                    col.data = np.empty(len(col_vals), dtype=object)\n                    col.data[:] = col_vals\n\n                # Multidim columns with consistent shape (n, m, ...). These\n                # might be masked.\n                elif col.shape:\n                    _check_dtype_is_str(col)\n\n                    # Change empty (blank) values in original ECSV to something\n                    # like \"[[null, null],[null,null]]\" so subsequent JSON\n                    # decoding works. Delete `col.mask` so that later code in\n                    # core TableOutputter.__call__() that deals with col.mask\n                    # does not run (since handling is done here already).\n                    if hasattr(col, 'mask'):\n                        all_none_arr = np.full(shape=col.shape, fill_value=None, dtype=object)\n                        all_none_json = json.dumps(all_none_arr.tolist())\n                        for idx in np.nonzero(col.mask)[0]:\n                            col.str_vals[idx] = all_none_json\n                        del col.mask\n\n                    col_vals = [json.loads(val) for val in col.str_vals]\n                    # Make a numpy object array of col_vals to look for None\n                    # (masked values)\n                    data = np.array(col_vals, dtype=object)\n                    mask = (data == None)  # noqa: E711\n                    if not np.any(mask):\n                        # No None's, just convert to required dtype\n                        col.data = data.astype(col.subtype)\n                    else:\n                        # Replace all the None with an appropriate fill value\n                        kind = np.dtype(col.subtype).kind\n                        data[mask] = {'U': '', 'S': b''}.get(kind, 0)\n                        # Finally make a MaskedArray with the filled data + mask\n                        col.data = np.ma.array(data.astype(col.subtype), mask=mask)\n\n                # Regular scalar value column\n                else:\n                    if col.subtype:\n                        warnings.warn(f'unexpected subtype {col.subtype!r} set for column '\n                                      f'{col.name!r}, using dtype={col.dtype!r} instead.',\n                                      category=AstropyUserWarning)\n                    converter_func, _ = convert_numpy(col.dtype)\n                    col.data = converter_func(col.str_vals)\n\n                if col.data.shape[1:] != tuple(col.shape):\n                    raise ValueError('shape mismatch between value and column specifier')\n\n            except json.JSONDecodeError:\n                raise ValueError(f'column {col.name!r} failed to convert: '\n                                 'column value is not valid JSON')\n            except Exception as exc:\n                raise ValueError(f'column {col.name!r} failed to convert: {exc}')"},{"col":0,"comment":"null","endLoc":388,"header":"def read(table, guess=None, **kwargs)","id":4998,"name":"read","nodeType":"Function","startLoc":252,"text":"def read(table, guess=None, **kwargs):\n    # This the final output from reading. Static analysis indicates the reading\n    # logic (which is indeed complex) might not define `dat`, thus do so here.\n    dat = None\n\n    # Docstring defined below\n    del _read_trace[:]\n\n    # Downstream readers might munge kwargs\n    kwargs = copy.deepcopy(kwargs)\n\n    _validate_read_write_kwargs('read', **kwargs)\n\n    # Convert 'fast_reader' key in kwargs into a dict if not already and make sure\n    # 'enable' key is available.\n    fast_reader = _get_fast_reader_dict(kwargs)\n    kwargs['fast_reader'] = fast_reader\n\n    if fast_reader['enable'] and fast_reader.get('chunk_size'):\n        return _read_in_chunks(table, **kwargs)\n\n    if 'fill_values' not in kwargs:\n        kwargs['fill_values'] = [('', '0')]\n\n    # If an Outputter is supplied in kwargs that will take precedence.\n    if 'Outputter' in kwargs:  # user specified Outputter, not supported for fast reading\n        fast_reader['enable'] = False\n\n    format = kwargs.get('format')\n    # Dictionary arguments are passed by reference per default and thus need\n    # special protection:\n    new_kwargs = copy.deepcopy(kwargs)\n    kwargs['fast_reader'] = copy.deepcopy(fast_reader)\n\n    # Get the Reader class based on possible format and Reader kwarg inputs.\n    Reader = _get_format_class(format, kwargs.get('Reader'), 'Reader')\n    if Reader is not None:\n        new_kwargs['Reader'] = Reader\n        format = Reader._format_name\n\n    # Remove format keyword if there, this is only allowed in read() not get_reader()\n    if 'format' in new_kwargs:\n        del new_kwargs['format']\n\n    if guess is None:\n        guess = _GUESS\n\n    if guess:\n        # If ``table`` is probably an HTML file then tell guess function to add\n        # the HTML reader at the top of the guess list.  This is in response to\n        # issue #3691 (and others) where libxml can segfault on a long non-HTML\n        # file, thus prompting removal of the HTML reader from the default\n        # guess list.\n        new_kwargs['guess_html'] = _probably_html(table)\n\n        # If `table` is a filename or readable file object then read in the\n        # file now.  This prevents problems in Python 3 with the file object\n        # getting closed or left at the file end.  See #3132, #3013, #3109,\n        # #2001.  If a `readme` arg was passed that implies CDS format, in\n        # which case the original `table` as the data filename must be left\n        # intact.\n        if 'readme' not in new_kwargs:\n            encoding = kwargs.get('encoding')\n            try:\n                with get_readable_fileobj(table, encoding=encoding) as fileobj:\n                    table = fileobj.read()\n            except ValueError:  # unreadable or invalid binary file\n                raise\n            except Exception:\n                pass\n            else:\n                # Ensure that `table` has at least one \\r or \\n in it\n                # so that the core.BaseInputter test of\n                # ('\\n' not in table and '\\r' not in table)\n                # will fail and so `table` cannot be interpreted there\n                # as a filename.  See #4160.\n                if not re.search(r'[\\r\\n]', table):\n                    table = table + os.linesep\n\n                # If the table got successfully read then look at the content\n                # to see if is probably HTML, but only if it wasn't already\n                # identified as HTML based on the filename.\n                if not new_kwargs['guess_html']:\n                    new_kwargs['guess_html'] = _probably_html(table)\n\n        # Get the table from guess in ``dat``.  If ``dat`` comes back as None\n        # then there was just one set of kwargs in the guess list so fall\n        # through below to the non-guess way so that any problems result in a\n        # more useful traceback.\n        dat = _guess(table, new_kwargs, format, fast_reader)\n        if dat is None:\n            guess = False\n\n    if not guess:\n        if format is None:\n            reader = get_reader(**new_kwargs)\n            format = reader._format_name\n\n        # Try the fast reader version of `format` first if applicable.  Note that\n        # if user specified a fast format (e.g. format='fast_basic') this test\n        # will fail and the else-clause below will be used.\n        if fast_reader['enable'] and f'fast_{format}' in core.FAST_CLASSES:\n            fast_kwargs = copy.deepcopy(new_kwargs)\n            fast_kwargs['Reader'] = core.FAST_CLASSES[f'fast_{format}']\n            fast_reader_rdr = get_reader(**fast_kwargs)\n            try:\n                dat = fast_reader_rdr.read(table)\n                _read_trace.append({'kwargs': copy.deepcopy(fast_kwargs),\n                                    'Reader': fast_reader_rdr.__class__,\n                                    'status': 'Success with fast reader (no guessing)'})\n            except (core.ParameterError, cparser.CParserError, UnicodeEncodeError) as err:\n                # special testing value to avoid falling back on the slow reader\n                if fast_reader['enable'] == 'force':\n                    raise core.InconsistentTableError(\n                        f'fast reader {fast_reader_rdr.__class__} exception: {err}')\n                # If the fast reader doesn't work, try the slow version\n                reader = get_reader(**new_kwargs)\n                dat = reader.read(table)\n                _read_trace.append({'kwargs': copy.deepcopy(new_kwargs),\n                                    'Reader': reader.__class__,\n                                    'status': 'Success with slow reader after failing'\n                                    ' with fast (no guessing)'})\n        else:\n            reader = get_reader(**new_kwargs)\n            dat = reader.read(table)\n            _read_trace.append({'kwargs': copy.deepcopy(new_kwargs),\n                                'Reader': reader.__class__,\n                                'status': 'Success with specified Reader class '\n                                          '(no guessing)'})\n\n    # Static analysis (pyright) indicates `dat` might be left undefined, so just\n    # to be sure define it at the beginning and check here.\n    if dat is None:\n        raise RuntimeError('read() function failed due to code logic error, '\n                           'please report this bug on github')\n\n    return dat"},{"className":"RST","col":0,"comment":"reStructuredText simple format table.\n\n    See: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#simple-tables\n\n    Example::\n\n        ==== ===== ======\n        Col1  Col2  Col3\n        ==== ===== ======\n          1    2.3  Hello\n          2    4.5  Worlds\n        ==== ===== ======\n\n    Currently there is no support for reading tables which utilize continuation lines,\n    or for ones which define column spans through the use of an additional\n    line of dashes in the header.\n\n    ","endLoc":63,"id":4999,"nodeType":"Class","startLoc":33,"text":"class RST(FixedWidth):\n    \"\"\"reStructuredText simple format table.\n\n    See: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#simple-tables\n\n    Example::\n\n        ==== ===== ======\n        Col1  Col2  Col3\n        ==== ===== ======\n          1    2.3  Hello\n          2    4.5  Worlds\n        ==== ===== ======\n\n    Currently there is no support for reading tables which utilize continuation lines,\n    or for ones which define column spans through the use of an additional\n    line of dashes in the header.\n\n    \"\"\"\n    _format_name = 'rst'\n    _description = 'reStructuredText simple table'\n    data_class = SimpleRSTData\n    header_class = SimpleRSTHeader\n\n    def __init__(self):\n        super().__init__(delimiter_pad=None, bookend=False)\n\n    def write(self, lines):\n        lines = super().write(lines)\n        lines = [lines[1]] + lines + [lines[1]]\n        return lines"},{"col":4,"comment":"null","endLoc":58,"header":"def __init__(self)","id":5000,"name":"__init__","nodeType":"Function","startLoc":57,"text":"def __init__(self):\n        super().__init__(delimiter_pad=None, bookend=False)"},{"col":4,"comment":"null","endLoc":229,"header":"def __call__(self, cols, meta)","id":5001,"name":"__call__","nodeType":"Function","startLoc":218,"text":"def __call__(self, cols, meta):\n        # Convert to a Table with all plain Column subclass columns\n        out = super().__call__(cols, meta)\n\n        # If mixin columns exist (based on the special '__mixin_columns__'\n        # key in the table ``meta``), then use that information to construct\n        # appropriate mixin columns and remove the original data columns.\n        # If no __mixin_columns__ exists then this function just passes back\n        # the input table.\n        out = serialize._construct_mixins_from_columns(out)\n\n        return out"},{"className":"LatexSplitter","col":0,"comment":"Split LaTeX table date. Default delimiter is `&`.\n    ","endLoc":117,"id":5002,"nodeType":"Class","startLoc":84,"text":"class LatexSplitter(core.BaseSplitter):\n    '''Split LaTeX table date. Default delimiter is `&`.\n    '''\n    delimiter = '&'\n\n    def __call__(self, lines):\n        last_line = RE_COMMENT.split(lines[-1])[0].strip()\n        if not last_line.endswith(r'\\\\'):\n            lines[-1] = last_line + r'\\\\'\n\n        return super().__call__(lines)\n\n    def process_line(self, line):\n        \"\"\"Remove whitespace at the beginning or end of line. Also remove\n        \\\\ at end of line\"\"\"\n        line = RE_COMMENT.split(line)[0]\n        line = line.strip()\n        if line.endswith(r'\\\\'):\n            line = line.rstrip(r'\\\\')\n        else:\n            raise core.InconsistentTableError(r'Lines in LaTeX table have to end with \\\\')\n        return line\n\n    def process_val(self, val):\n        \"\"\"Remove whitespace and {} at the beginning or end of value.\"\"\"\n        val = val.strip()\n        if val and (val[0] == '{') and (val[-1] == '}'):\n            val = val[1:-1]\n        return val\n\n    def join(self, vals):\n        '''Join values together and add a few extra spaces for readability'''\n        delimiter = ' ' + self.delimiter + ' '\n        return delimiter.join(x.strip() for x in vals) + r' \\\\'"},{"col":4,"comment":"READ: Convert str_vals in `cols` to final arrays with correct dtypes.\n\n        This is adapted from ``BaseOutputter._convert_vals``. In the case of ECSV\n        there is no guessing and all types are known in advance. A big change\n        is handling the possibility of JSON-encoded values, both unstructured\n        object data and structured values that may contain masked data.\n        ","endLoc":335,"header":"def _convert_vals(self, cols)","id":5003,"name":"_convert_vals","nodeType":"Function","startLoc":231,"text":"def _convert_vals(self, cols):\n        \"\"\"READ: Convert str_vals in `cols` to final arrays with correct dtypes.\n\n        This is adapted from ``BaseOutputter._convert_vals``. In the case of ECSV\n        there is no guessing and all types are known in advance. A big change\n        is handling the possibility of JSON-encoded values, both unstructured\n        object data and structured values that may contain masked data.\n        \"\"\"\n        for col in cols:\n            try:\n                # 1-d or N-d object columns are serialized as JSON.\n                if col.subtype == 'object':\n                    _check_dtype_is_str(col)\n                    col_vals = [json.loads(val) for val in col.str_vals]\n                    col.data = np.empty([len(col_vals)] + col.shape, dtype=object)\n                    col.data[...] = col_vals\n\n                # Variable length arrays with shape (n, m, ..., *) for fixed\n                # n, m, .. and variable in last axis. Masked values here are\n                # not currently supported.\n                elif col.shape and col.shape[-1] is None:\n                    _check_dtype_is_str(col)\n\n                    # Empty (blank) values in original ECSV are changed to \"0\"\n                    # in str_vals with corresponding col.mask being created and\n                    # set accordingly. Instead use an empty list here.\n                    if hasattr(col, 'mask'):\n                        for idx in np.nonzero(col.mask)[0]:\n                            col.str_vals[idx] = '[]'\n\n                    # Remake as a 1-d object column of numpy ndarrays or\n                    # MaskedArray using the datatype specified in the ECSV file.\n                    col_vals = []\n                    for str_val in col.str_vals:\n                        obj_val = json.loads(str_val)  # list or nested lists\n                        try:\n                            arr_val = np.array(obj_val, dtype=col.subtype)\n                        except TypeError:\n                            # obj_val has entries that are inconsistent with\n                            # dtype. For a valid ECSV file the only possibility\n                            # is None values (indicating missing values).\n                            data = np.array(obj_val, dtype=object)\n                            # Replace all the None with an appropriate fill value\n                            mask = (data == None)  # noqa: E711\n                            kind = np.dtype(col.subtype).kind\n                            data[mask] = {'U': '', 'S': b''}.get(kind, 0)\n                            arr_val = np.ma.array(data.astype(col.subtype), mask=mask)\n\n                        col_vals.append(arr_val)\n\n                    col.shape = ()\n                    col.dtype = np.dtype(object)\n                    # np.array(col_vals_arr, dtype=object) fails ?? so this workaround:\n                    col.data = np.empty(len(col_vals), dtype=object)\n                    col.data[:] = col_vals\n\n                # Multidim columns with consistent shape (n, m, ...). These\n                # might be masked.\n                elif col.shape:\n                    _check_dtype_is_str(col)\n\n                    # Change empty (blank) values in original ECSV to something\n                    # like \"[[null, null],[null,null]]\" so subsequent JSON\n                    # decoding works. Delete `col.mask` so that later code in\n                    # core TableOutputter.__call__() that deals with col.mask\n                    # does not run (since handling is done here already).\n                    if hasattr(col, 'mask'):\n                        all_none_arr = np.full(shape=col.shape, fill_value=None, dtype=object)\n                        all_none_json = json.dumps(all_none_arr.tolist())\n                        for idx in np.nonzero(col.mask)[0]:\n                            col.str_vals[idx] = all_none_json\n                        del col.mask\n\n                    col_vals = [json.loads(val) for val in col.str_vals]\n                    # Make a numpy object array of col_vals to look for None\n                    # (masked values)\n                    data = np.array(col_vals, dtype=object)\n                    mask = (data == None)  # noqa: E711\n                    if not np.any(mask):\n                        # No None's, just convert to required dtype\n                        col.data = data.astype(col.subtype)\n                    else:\n                        # Replace all the None with an appropriate fill value\n                        kind = np.dtype(col.subtype).kind\n                        data[mask] = {'U': '', 'S': b''}.get(kind, 0)\n                        # Finally make a MaskedArray with the filled data + mask\n                        col.data = np.ma.array(data.astype(col.subtype), mask=mask)\n\n                # Regular scalar value column\n                else:\n                    if col.subtype:\n                        warnings.warn(f'unexpected subtype {col.subtype!r} set for column '\n                                      f'{col.name!r}, using dtype={col.dtype!r} instead.',\n                                      category=AstropyUserWarning)\n                    converter_func, _ = convert_numpy(col.dtype)\n                    col.data = converter_func(col.str_vals)\n\n                if col.data.shape[1:] != tuple(col.shape):\n                    raise ValueError('shape mismatch between value and column specifier')\n\n            except json.JSONDecodeError:\n                raise ValueError(f'column {col.name!r} failed to convert: '\n                                 'column value is not valid JSON')\n            except Exception as exc:\n                raise ValueError(f'column {col.name!r} failed to convert: {exc}')"},{"col":4,"comment":"\n        Initialize the header Column objects from the table ``lines`` for a CDS/MRT\n        header.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        ","endLoc":172,"header":"def get_cols(self, lines)","id":5004,"name":"get_cols","nodeType":"Function","startLoc":45,"text":"def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines`` for a CDS/MRT\n        header.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n\n        # Read header block for the table ``self.data.table_name`` from the read\n        # me file ``self.readme``.\n        if self.readme and self.data.table_name:\n            in_header = False\n            readme_inputter = core.BaseInputter()\n            f = readme_inputter.get_lines(self.readme)\n            # Header info is not in data lines but in a separate file.\n            lines = []\n            comment_lines = 0\n            for line in f:\n                line = line.strip()\n                if in_header:\n                    lines.append(line)\n                    if line.startswith(('------', '=======')):\n                        comment_lines += 1\n                        if comment_lines == 3:\n                            break\n                else:\n                    match = re.match(r'Byte-by-byte Description of file: (?P<name>.+)$',\n                                     line, re.IGNORECASE)\n                    if match:\n                        # Split 'name' in case in contains multiple files\n                        names = [s for s in re.split('[, ]+', match.group('name'))\n                                 if s]\n                        # Iterate on names to find if one matches the tablename\n                        # including wildcards.\n                        for pattern in names:\n                            if fnmatch.fnmatch(self.data.table_name, pattern):\n                                in_header = True\n                                lines.append(line)\n                                break\n\n            else:\n                raise core.InconsistentTableError(\"Can't find table {} in {}\".format(\n                    self.data.table_name, self.readme))\n\n        found_line = False\n\n        for i_col_def, line in enumerate(lines):\n            if re.match(r'Byte-by-byte Description', line, re.IGNORECASE):\n                found_line = True\n            elif found_line:  # First line after list of file descriptions\n                i_col_def -= 1  # Set i_col_def to last description line\n                break\n        else:\n            raise ValueError('no line with \"Byte-by-byte Description\" found')\n\n        re_col_def = re.compile(r\"\"\"\\s*\n                                    (?P<start> \\d+ \\s* -)? \\s*\n                                    (?P<end>   \\d+)        \\s+\n                                    (?P<format> [\\w.]+)     \\s+\n                                    (?P<units> \\S+)        \\s+\n                                    (?P<name>  \\S+)\n                                    (\\s+ (?P<descr> \\S.*))?\"\"\",\n                                re.VERBOSE)\n\n        cols = []\n        for line in itertools.islice(lines, i_col_def + 4, None):\n            if line.startswith(('------', '=======')):\n                break\n            match = re_col_def.match(line)\n            if match:\n                col = core.Column(name=match.group('name'))\n                col.start = int(re.sub(r'[-\\s]', '',\n                                       match.group('start') or match.group('end'))) - 1\n                col.end = int(match.group('end'))\n                unit = match.group('units')\n                if unit == '---':\n                    col.unit = None  # \"---\" is the marker for no unit in CDS/MRT table\n                else:\n                    col.unit = Unit(unit, format='cds', parse_strict='warn')\n                col.description = (match.group('descr') or '').strip()\n                col.raw_type = match.group('format')\n                col.type = self.get_col_type(col)\n\n                match = re.match(\n                    r'(?P<limits>[\\[\\]] \\S* [\\[\\]])?'  # Matches limits specifier (eg [])\n                                                       # that may or may not be present\n                    r'\\?'  # Matches '?' directly\n                    r'((?P<equal>=)(?P<nullval> \\S*))?'  # Matches to nullval if and only\n                                                         # if '=' is present\n                    r'(?P<order>[-+]?[=]?)'  # Matches to order specifier:\n                                             # ('+', '-', '+=', '-=')\n                    r'(\\s* (?P<descriptiontext> \\S.*))?',  # Matches description text even\n                                                           # even if no whitespace is\n                                                           # present after '?'\n                    col.description, re.VERBOSE)\n                if match:\n                    col.description = (match.group('descriptiontext') or '').strip()\n                    if issubclass(col.type, core.FloatType):\n                        fillval = 'nan'\n                    else:\n                        fillval = '0'\n\n                    if match.group('nullval') == '-':\n                        col.null = '---'\n                        # CDS/MRT tables can use -, --, ---, or ---- to mark missing values\n                        # see https://github.com/astropy/astropy/issues/1335\n                        for i in [1, 2, 3, 4]:\n                            self.data.fill_values.append(('-' * i, fillval, col.name))\n                    else:\n                        col.null = match.group('nullval')\n                        if (col.null is None):\n                            col.null = ''\n                        self.data.fill_values.append((col.null, fillval, col.name))\n\n                cols.append(col)\n            else:  # could be a continuation of the previous col's description\n                if cols:\n                    cols[-1].description += line.strip()\n                else:\n                    raise ValueError(f'Line \"{line}\" not parsable as CDS header')\n\n        self.names = [x.name for x in cols]\n\n        self.cols = cols"},{"col":4,"comment":"null","endLoc":94,"header":"def __call__(self, lines)","id":5005,"name":"__call__","nodeType":"Function","startLoc":89,"text":"def __call__(self, lines):\n        last_line = RE_COMMENT.split(lines[-1])[0].strip()\n        if not last_line.endswith(r'\\\\'):\n            lines[-1] = last_line + r'\\\\'\n\n        return super().__call__(lines)"},{"col":4,"comment":"null","endLoc":63,"header":"def write(self, lines)","id":5006,"name":"write","nodeType":"Function","startLoc":60,"text":"def write(self, lines):\n        lines = super().write(lines)\n        lines = [lines[1]] + lines + [lines[1]]\n        return lines"},{"attributeType":"null","col":4,"comment":"null","endLoc":52,"id":5007,"name":"_format_name","nodeType":"Attribute","startLoc":52,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":53,"id":5008,"name":"_description","nodeType":"Attribute","startLoc":53,"text":"_description"},{"col":4,"comment":"Remove whitespace at the beginning or end of line. Also remove\n        \\ at end of line","endLoc":105,"header":"def process_line(self, line)","id":5009,"name":"process_line","nodeType":"Function","startLoc":96,"text":"def process_line(self, line):\n        \"\"\"Remove whitespace at the beginning or end of line. Also remove\n        \\\\ at end of line\"\"\"\n        line = RE_COMMENT.split(line)[0]\n        line = line.strip()\n        if line.endswith(r'\\\\'):\n            line = line.rstrip(r'\\\\')\n        else:\n            raise core.InconsistentTableError(r'Lines in LaTeX table have to end with \\\\')\n        return line"},{"attributeType":"SimpleRSTData","col":4,"comment":"null","endLoc":54,"id":5010,"name":"data_class","nodeType":"Attribute","startLoc":54,"text":"data_class"},{"attributeType":"SimpleRSTHeader","col":4,"comment":"null","endLoc":55,"id":5011,"name":"header_class","nodeType":"Attribute","startLoc":55,"text":"header_class"},{"col":0,"comment":"","endLoc":4,"header":"rst.py#<anonymous>","id":5012,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n:Author: Simon Gibbons (simongibbons@gmail.com)\n\"\"\""},{"col":0,"comment":"null","endLoc":206,"header":"def _check_dtype_is_str(col)","id":5013,"name":"_check_dtype_is_str","nodeType":"Function","startLoc":204,"text":"def _check_dtype_is_str(col):\n    if col.dtype != 'str':\n        raise ValueError(f'datatype of column {col.name!r} must be \"string\"')"},{"col":4,"comment":"\n        A convenience method for creating wrapper elements using the\n        ``with`` statement.\n\n        Examples\n        --------\n\n        >>> with writer.tag('foo'):  # doctest: +SKIP\n        ...     writer.element('bar')\n        ... # </foo> is implicitly closed here\n        ...\n\n        Parameters are the same as to `start`.\n        ","endLoc":223,"header":"@contextlib.contextmanager\n    def tag(self, tag, attrib={}, **extra)","id":5014,"name":"tag","nodeType":"Function","startLoc":205,"text":"@contextlib.contextmanager\n    def tag(self, tag, attrib={}, **extra):\n        \"\"\"\n        A convenience method for creating wrapper elements using the\n        ``with`` statement.\n\n        Examples\n        --------\n\n        >>> with writer.tag('foo'):  # doctest: +SKIP\n        ...     writer.element('bar')\n        ... # </foo> is implicitly closed here\n        ...\n\n        Parameters are the same as to `start`.\n        \"\"\"\n        self.start(tag, attrib, **extra)\n        yield\n        self.end(tag)"},{"col":4,"comment":"\n        Opens a new element.  Attributes can be given as keyword\n        arguments, or as a string/string dictionary.  The method\n        returns an opaque identifier that can be passed to the\n        :meth:`close` method, to close all open elements up to and\n        including this one.\n\n        Parameters\n        ----------\n        tag : str\n            The element name\n\n        attrib : dict of str -> str\n            Attribute dictionary.  Alternatively, attributes can\n            be given as keyword arguments.\n\n        Returns\n        -------\n        id : int\n            Returns an element identifier.\n        ","endLoc":143,"header":"def start(self, tag, attrib={}, **extra)","id":5015,"name":"start","nodeType":"Function","startLoc":101,"text":"def start(self, tag, attrib={}, **extra):\n        \"\"\"\n        Opens a new element.  Attributes can be given as keyword\n        arguments, or as a string/string dictionary.  The method\n        returns an opaque identifier that can be passed to the\n        :meth:`close` method, to close all open elements up to and\n        including this one.\n\n        Parameters\n        ----------\n        tag : str\n            The element name\n\n        attrib : dict of str -> str\n            Attribute dictionary.  Alternatively, attributes can\n            be given as keyword arguments.\n\n        Returns\n        -------\n        id : int\n            Returns an element identifier.\n        \"\"\"\n        self._flush()\n        # This is just busy work -- we know our tag names are clean\n        # tag = xml_escape_cdata(tag)\n        self._data = []\n        self._tags.append(tag)\n        self.write(self.get_indentation_spaces(-1))\n        self.write(f\"<{tag}\")\n        if attrib or extra:\n            attrib = attrib.copy()\n            attrib.update(extra)\n            attrib = list(attrib.items())\n            attrib.sort()\n            for k, v in attrib:\n                if v is not None:\n                    # This is just busy work -- we know our keys are clean\n                    # k = xml_escape_cdata(k)\n                    v = self.xml_escape(v)\n                    self.write(f\" {k}=\\\"{v}\\\"\")\n        self._open = 1\n\n        return len(self._tags)"},{"col":4,"comment":"\n        Flush internal buffers.\n        ","endLoc":99,"header":"def _flush(self, indent=True, wrap=False)","id":5016,"name":"_flush","nodeType":"Function","startLoc":75,"text":"def _flush(self, indent=True, wrap=False):\n        \"\"\"\n        Flush internal buffers.\n        \"\"\"\n        if self._open:\n            if indent:\n                self.write(\">\\n\")\n            else:\n                self.write(\">\")\n            self._open = 0\n        if self._data:\n            data = ''.join(self._data)\n            if wrap:\n                indent = self.get_indentation_spaces(1)\n                data = textwrap.fill(\n                    data,\n                    initial_indent=indent,\n                    subsequent_indent=indent)\n                self.write('\\n')\n                self.write(self.xml_escape_cdata(data))\n                self.write('\\n')\n                self.write(self.get_indentation_spaces())\n            else:\n                self.write(self.xml_escape_cdata(data))\n            self._data = []"},{"col":4,"comment":"Remove whitespace and {} at the beginning or end of value.","endLoc":112,"header":"def process_val(self, val)","id":5017,"name":"process_val","nodeType":"Function","startLoc":107,"text":"def process_val(self, val):\n        \"\"\"Remove whitespace and {} at the beginning or end of value.\"\"\"\n        val = val.strip()\n        if val and (val[0] == '{') and (val[-1] == '}'):\n            val = val[1:-1]\n        return val"},{"col":4,"comment":"\n        Returns a string of spaces that matches the current\n        indentation level.\n        ","endLoc":318,"header":"def get_indentation_spaces(self, offset=0)","id":5018,"name":"get_indentation_spaces","nodeType":"Function","startLoc":313,"text":"def get_indentation_spaces(self, offset=0):\n        \"\"\"\n        Returns a string of spaces that matches the current\n        indentation level.\n        \"\"\"\n        return self._indentation[:len(self._tags) + offset]"},{"fileName":"basic.py","filePath":"astropy/io/ascii","id":5019,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"An extensible ASCII table reader and writer.\n\nbasic.py:\n  Basic table read / write functionality for simple character\n  delimited files with various options for column header definition.\n\n:Copyright: Smithsonian Astrophysical Observatory (2011)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\"\n\n\nimport re\n\nfrom . import core\n\n\nclass BasicHeader(core.BaseHeader):\n    \"\"\"\n    Basic table Header Reader\n\n    Set a few defaults for common ascii table formats\n    (start at line 0, comments begin with ``#`` and possibly white space)\n    \"\"\"\n    start_line = 0\n    comment = r'\\s*#'\n    write_comment = '# '\n\n\nclass BasicData(core.BaseData):\n    \"\"\"\n    Basic table Data Reader\n\n    Set a few defaults for common ascii table formats\n    (start at line 1, comments begin with ``#`` and possibly white space)\n    \"\"\"\n    start_line = 1\n    comment = r'\\s*#'\n    write_comment = '# '\n\n\nclass Basic(core.BaseReader):\n    r\"\"\"Character-delimited table with a single header line at the top.\n\n    Lines beginning with a comment character (default='#') as the first\n    non-whitespace character are comments.\n\n    Example table::\n\n      # Column definition is the first uncommented line\n      # Default delimiter is the space character.\n      apples oranges pears\n\n      # Data starts after the header column definition, blank lines ignored\n      1 2 3\n      4 5 6\n    \"\"\"\n    _format_name = 'basic'\n    _description = 'Basic table with custom delimiters'\n    _io_registry_format_aliases = ['ascii']\n\n    header_class = BasicHeader\n    data_class = BasicData\n\n\nclass NoHeaderHeader(BasicHeader):\n    \"\"\"\n    Reader for table header without a header\n\n    Set the start of header line number to `None`, which tells the basic\n    reader there is no header line.\n    \"\"\"\n    start_line = None\n\n\nclass NoHeaderData(BasicData):\n    \"\"\"\n    Reader for table data without a header\n\n    Data starts at first uncommented line since there is no header line.\n    \"\"\"\n    start_line = 0\n\n\nclass NoHeader(Basic):\n    \"\"\"Character-delimited table with no header line.\n\n    When reading, columns are autonamed using header.auto_format which defaults\n    to \"col%d\".  Otherwise this reader the same as the :class:`Basic` class\n    from which it is derived.  Example::\n\n      # Table data\n      1 2 \"hello there\"\n      3 4 world\n\n    \"\"\"\n    _format_name = 'no_header'\n    _description = 'Basic table with no headers'\n    header_class = NoHeaderHeader\n    data_class = NoHeaderData\n\n\nclass CommentedHeaderHeader(BasicHeader):\n    \"\"\"\n    Header class for which the column definition line starts with the\n    comment character.  See the :class:`CommentedHeader` class  for an example.\n    \"\"\"\n\n    def process_lines(self, lines):\n        \"\"\"\n        Return only lines that start with the comment regexp.  For these\n        lines strip out the matching characters.\n        \"\"\"\n        re_comment = re.compile(self.comment)\n        for line in lines:\n            match = re_comment.match(line)\n            if match:\n                yield line[match.end():]\n\n    def write(self, lines):\n        lines.append(self.write_comment + self.splitter.join(self.colnames))\n\n\nclass CommentedHeader(Basic):\n    \"\"\"Character-delimited table with column names in a comment line.\n\n    When reading, ``header_start`` can be used to specify the\n    line index of column names, and it can be a negative index (for example -1\n    for the last commented line).  The default delimiter is the <space>\n    character.\n\n    This matches the format produced by ``np.savetxt()``, with ``delimiter=','``,\n    and ``header='<comma-delimited-column-names-list>'``.\n\n    Example::\n\n      # col1 col2 col3\n      # Comment line\n      1 2 3\n      4 5 6\n\n    \"\"\"\n    _format_name = 'commented_header'\n    _description = 'Column names in a commented line'\n\n    header_class = CommentedHeaderHeader\n    data_class = NoHeaderData\n\n    def read(self, table):\n        \"\"\"\n        Read input data (file-like object, filename, list of strings, or\n        single string) into a Table and return the result.\n        \"\"\"\n        out = super().read(table)\n\n        # Strip off the comment line set as the header line for\n        # commented_header format (first by default).\n        if 'comments' in out.meta:\n            idx = self.header.start_line\n            if idx < 0:\n                idx = len(out.meta['comments']) + idx\n            out.meta['comments'] = out.meta['comments'][:idx] + out.meta['comments'][idx + 1:]\n            if not out.meta['comments']:\n                del out.meta['comments']\n\n        return out\n\n    def write_header(self, lines, meta):\n        \"\"\"\n        Write comment lines after, rather than before, the header.\n        \"\"\"\n        self.header.write(lines)\n        self.header.write_comments(lines, meta)\n\n\nclass TabHeaderSplitter(core.DefaultSplitter):\n    \"\"\"Split lines on tab and do not remove whitespace\"\"\"\n    delimiter = '\\t'\n\n    def process_line(self, line):\n        return line + '\\n'\n\n\nclass TabDataSplitter(TabHeaderSplitter):\n    \"\"\"\n    Don't strip data value whitespace since that is significant in TSV tables\n    \"\"\"\n    process_val = None\n    skipinitialspace = False\n\n\nclass TabHeader(BasicHeader):\n    \"\"\"\n    Reader for header of tables with tab separated header\n    \"\"\"\n    splitter_class = TabHeaderSplitter\n\n\nclass TabData(BasicData):\n    \"\"\"\n    Reader for data of tables with tab separated data\n    \"\"\"\n    splitter_class = TabDataSplitter\n\n\nclass Tab(Basic):\n    \"\"\"Tab-separated table.\n\n    Unlike the :class:`Basic` reader, whitespace is not stripped from the\n    beginning and end of either lines or individual column values.\n\n    Example::\n\n      col1 <tab> col2 <tab> col3\n      # Comment line\n      1 <tab> 2 <tab> 5\n\n    \"\"\"\n    _format_name = 'tab'\n    _description = 'Basic table with tab-separated values'\n    header_class = TabHeader\n    data_class = TabData\n\n\nclass CsvSplitter(core.DefaultSplitter):\n    \"\"\"\n    Split on comma for CSV (comma-separated-value) tables\n    \"\"\"\n    delimiter = ','\n\n\nclass CsvHeader(BasicHeader):\n    \"\"\"\n    Header that uses the :class:`astropy.io.ascii.basic.CsvSplitter`\n    \"\"\"\n    splitter_class = CsvSplitter\n    comment = None\n    write_comment = None\n\n\nclass CsvData(BasicData):\n    \"\"\"\n    Data that uses the :class:`astropy.io.ascii.basic.CsvSplitter`\n    \"\"\"\n    splitter_class = CsvSplitter\n    fill_values = [(core.masked, '')]\n    comment = None\n    write_comment = None\n\n\nclass Csv(Basic):\n    \"\"\"CSV (comma-separated-values) table.\n\n    This file format may contain rows with fewer entries than the number of\n    columns, a situation that occurs in output from some spreadsheet editors.\n    The missing entries are marked as masked in the output table.\n\n    Masked values (indicated by an empty '' field value when reading) are\n    written out in the same way with an empty ('') field.  This is different\n    from the typical default for `astropy.io.ascii` in which missing values are\n    indicated by ``--``.\n\n    Since the `CSV format <https://tools.ietf.org/html/rfc4180>`_ does not\n    formally support comments, any comments defined for the table via\n    ``tbl.meta['comments']`` are ignored by default. If you would still like to\n    write those comments then include a keyword ``comment='#'`` to the\n    ``write()`` call.\n\n    Example::\n\n      num,ra,dec,radius,mag\n      1,32.23222,10.1211\n      2,38.12321,-88.1321,2.2,17.0\n\n    \"\"\"\n    _format_name = 'csv'\n    _io_registry_format_aliases = ['csv']\n    _io_registry_can_write = True\n    _io_registry_suffix = '.csv'\n    _description = 'Comma-separated-values'\n\n    header_class = CsvHeader\n    data_class = CsvData\n\n    def inconsistent_handler(self, str_vals, ncols):\n        \"\"\"\n        Adjust row if it is too short.\n\n        If a data row is shorter than the header, add empty values to make it the\n        right length.\n        Note that this will *not* be called if the row already matches the header.\n\n        Parameters\n        ----------\n        str_vals : list\n            A list of value strings from the current row of the table.\n        ncols : int\n            The expected number of entries from the table header.\n\n        Returns\n        -------\n        str_vals : list\n            List of strings to be parsed into data entries in the output table.\n        \"\"\"\n        if len(str_vals) < ncols:\n            str_vals.extend((ncols - len(str_vals)) * [''])\n\n        return str_vals\n\n\nclass RdbHeader(TabHeader):\n    \"\"\"\n    Header for RDB tables\n    \"\"\"\n    col_type_map = {'n': core.NumType,\n                    's': core.StrType}\n\n    def get_type_map_key(self, col):\n        return col.raw_type[-1]\n\n    def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines``.\n\n        This is a specialized get_cols for the RDB type:\n        Line 0: RDB col names\n        Line 1: RDB col definitions\n        Line 2+: RDB data rows\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        Returns\n        -------\n        None\n\n        \"\"\"\n        header_lines = self.process_lines(lines)   # this is a generator\n        header_vals_list = [hl for _, hl in zip(range(2), self.splitter(header_lines))]\n        if len(header_vals_list) != 2:\n            raise ValueError('RDB header requires 2 lines')\n        self.names, raw_types = header_vals_list\n\n        if len(self.names) != len(raw_types):\n            raise core.InconsistentTableError(\n                'RDB header mismatch between number of column names and column types.')\n\n        if any(not re.match(r'\\d*(N|S)$', x, re.IGNORECASE) for x in raw_types):\n            raise core.InconsistentTableError(\n                f'RDB types definitions do not all match [num](N|S): {raw_types}')\n\n        self._set_cols_from_names()\n        for col, raw_type in zip(self.cols, raw_types):\n            col.raw_type = raw_type\n            col.type = self.get_col_type(col)\n\n    def write(self, lines):\n        lines.append(self.splitter.join(self.colnames))\n        rdb_types = []\n        for col in self.cols:\n            # Check if dtype.kind is string or unicode.  See help(np.core.numerictypes)\n            rdb_type = 'S' if col.info.dtype.kind in ('S', 'U') else 'N'\n            rdb_types.append(rdb_type)\n\n        lines.append(self.splitter.join(rdb_types))\n\n\nclass RdbData(TabData):\n    \"\"\"\n    Data reader for RDB data. Starts reading at line 2.\n    \"\"\"\n    start_line = 2\n\n\nclass Rdb(Tab):\n    \"\"\"Tab-separated file with an extra line after the column definition line that\n    specifies either numeric (N) or string (S) data.\n\n    See: https://www.drdobbs.com/rdb-a-unix-command-line-database/199101326\n\n    Example::\n\n      col1 <tab> col2 <tab> col3\n      N <tab> S <tab> N\n      1 <tab> 2 <tab> 5\n\n    \"\"\"\n    _format_name = 'rdb'\n    _io_registry_format_aliases = ['rdb']\n    _io_registry_suffix = '.rdb'\n    _description = 'Tab-separated with a type definition header line'\n\n    header_class = RdbHeader\n    data_class = RdbData\n"},{"col":4,"comment":"Join values together and add a few extra spaces for readability","endLoc":117,"header":"def join(self, vals)","id":5020,"name":"join","nodeType":"Function","startLoc":114,"text":"def join(self, vals):\n        '''Join values together and add a few extra spaces for readability'''\n        delimiter = ' ' + self.delimiter + ' '\n        return delimiter.join(x.strip() for x in vals) + r' \\\\'"},{"className":"NoHeaderHeader","col":0,"comment":"\n    Reader for table header without a header\n\n    Set the start of header line number to `None`, which tells the basic\n    reader there is no header line.\n    ","endLoc":73,"id":5021,"nodeType":"Class","startLoc":66,"text":"class NoHeaderHeader(BasicHeader):\n    \"\"\"\n    Reader for table header without a header\n\n    Set the start of header line number to `None`, which tells the basic\n    reader there is no header line.\n    \"\"\"\n    start_line = None"},{"attributeType":"None","col":4,"comment":"null","endLoc":73,"id":5022,"name":"start_line","nodeType":"Attribute","startLoc":73,"text":"start_line"},{"className":"NoHeaderData","col":0,"comment":"\n    Reader for table data without a header\n\n    Data starts at first uncommented line since there is no header line.\n    ","endLoc":82,"id":5023,"nodeType":"Class","startLoc":76,"text":"class NoHeaderData(BasicData):\n    \"\"\"\n    Reader for table data without a header\n\n    Data starts at first uncommented line since there is no header line.\n    \"\"\"\n    start_line = 0"},{"attributeType":"null","col":4,"comment":"null","endLoc":82,"id":5024,"name":"start_line","nodeType":"Attribute","startLoc":82,"text":"start_line"},{"className":"NoHeader","col":0,"comment":"Character-delimited table with no header line.\n\n    When reading, columns are autonamed using header.auto_format which defaults\n    to \"col%d\".  Otherwise this reader the same as the :class:`Basic` class\n    from which it is derived.  Example::\n\n      # Table data\n      1 2 \"hello there\"\n      3 4 world\n\n    ","endLoc":100,"id":5025,"nodeType":"Class","startLoc":85,"text":"class NoHeader(Basic):\n    \"\"\"Character-delimited table with no header line.\n\n    When reading, columns are autonamed using header.auto_format which defaults\n    to \"col%d\".  Otherwise this reader the same as the :class:`Basic` class\n    from which it is derived.  Example::\n\n      # Table data\n      1 2 \"hello there\"\n      3 4 world\n\n    \"\"\"\n    _format_name = 'no_header'\n    _description = 'Basic table with no headers'\n    header_class = NoHeaderHeader\n    data_class = NoHeaderData"},{"attributeType":"null","col":4,"comment":"null","endLoc":97,"id":5026,"name":"_format_name","nodeType":"Attribute","startLoc":97,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":98,"id":5027,"name":"_description","nodeType":"Attribute","startLoc":98,"text":"_description"},{"attributeType":"NoHeaderHeader","col":4,"comment":"null","endLoc":99,"id":5028,"name":"header_class","nodeType":"Attribute","startLoc":99,"text":"header_class"},{"attributeType":"NoHeaderData","col":4,"comment":"null","endLoc":100,"id":5029,"name":"data_class","nodeType":"Attribute","startLoc":100,"text":"data_class"},{"className":"CommentedHeaderHeader","col":0,"comment":"\n    Header class for which the column definition line starts with the\n    comment character.  See the :class:`CommentedHeader` class  for an example.\n    ","endLoc":121,"id":5030,"nodeType":"Class","startLoc":103,"text":"class CommentedHeaderHeader(BasicHeader):\n    \"\"\"\n    Header class for which the column definition line starts with the\n    comment character.  See the :class:`CommentedHeader` class  for an example.\n    \"\"\"\n\n    def process_lines(self, lines):\n        \"\"\"\n        Return only lines that start with the comment regexp.  For these\n        lines strip out the matching characters.\n        \"\"\"\n        re_comment = re.compile(self.comment)\n        for line in lines:\n            match = re_comment.match(line)\n            if match:\n                yield line[match.end():]\n\n    def write(self, lines):\n        lines.append(self.write_comment + self.splitter.join(self.colnames))"},{"col":4,"comment":"\n        Return only lines that start with the comment regexp.  For these\n        lines strip out the matching characters.\n        ","endLoc":118,"header":"def process_lines(self, lines)","id":5031,"name":"process_lines","nodeType":"Function","startLoc":109,"text":"def process_lines(self, lines):\n        \"\"\"\n        Return only lines that start with the comment regexp.  For these\n        lines strip out the matching characters.\n        \"\"\"\n        re_comment = re.compile(self.comment)\n        for line in lines:\n            match = re_comment.match(line)\n            if match:\n                yield line[match.end():]"},{"col":4,"comment":"null","endLoc":121,"header":"def write(self, lines)","id":5032,"name":"write","nodeType":"Function","startLoc":120,"text":"def write(self, lines):\n        lines.append(self.write_comment + self.splitter.join(self.colnames))"},{"attributeType":"null","col":4,"comment":"null","endLoc":87,"id":5033,"name":"delimiter","nodeType":"Attribute","startLoc":87,"text":"delimiter"},{"className":"LatexHeader","col":0,"comment":"Class to read the header of Latex Tables","endLoc":163,"id":5034,"nodeType":"Class","startLoc":120,"text":"class LatexHeader(core.BaseHeader):\n    '''Class to read the header of Latex Tables'''\n    header_start = r'\\begin{tabular}'\n    splitter_class = LatexSplitter\n\n    def start_line(self, lines):\n        line = find_latex_line(lines, self.header_start)\n        if line is not None:\n            return line + 1\n        else:\n            return None\n\n    def _get_units(self):\n        units = {}\n        col_units = [col.info.unit for col in self.cols]\n        for name, unit in zip(self.colnames, col_units):\n            if unit:\n                try:\n                    units[name] = unit.to_string(format='latex_inline')\n                except AttributeError:\n                    units[name] = unit\n        return units\n\n    def write(self, lines):\n        if 'col_align' not in self.latex:\n            self.latex['col_align'] = len(self.cols) * 'c'\n        if 'tablealign' in self.latex:\n            align = '[' + self.latex['tablealign'] + ']'\n        else:\n            align = ''\n        if self.latex['tabletype'] is not None:\n            lines.append(r'\\begin{' + self.latex['tabletype'] + r'}' + align)\n        add_dictval_to_list(self.latex, 'preamble', lines)\n        if 'caption' in self.latex:\n            lines.append(r'\\caption{' + self.latex['caption'] + '}')\n        lines.append(self.header_start + r'{' + self.latex['col_align'] + r'}')\n        add_dictval_to_list(self.latex, 'header_start', lines)\n        lines.append(self.splitter.join(self.colnames))\n        units = self._get_units()\n        if 'units' in self.latex:\n            units.update(self.latex['units'])\n        if units:\n            lines.append(self.splitter.join([units.get(name, ' ') for name in self.colnames]))\n        add_dictval_to_list(self.latex, 'header_end', lines)"},{"col":4,"comment":"\n        Closes the current element (opened by the most recent call to\n        `start`).\n\n        Parameters\n        ----------\n        tag : str\n            Element name.  If given, the tag must match the start tag.\n            If omitted, the current element is closed.\n        ","endLoc":277,"header":"def end(self, tag=None, indent=True, wrap=False)","id":5035,"name":"end","nodeType":"Function","startLoc":249,"text":"def end(self, tag=None, indent=True, wrap=False):\n        \"\"\"\n        Closes the current element (opened by the most recent call to\n        `start`).\n\n        Parameters\n        ----------\n        tag : str\n            Element name.  If given, the tag must match the start tag.\n            If omitted, the current element is closed.\n        \"\"\"\n        if tag:\n            if not self._tags:\n                raise ValueError(f\"unbalanced end({tag})\")\n            if tag != self._tags[-1]:\n                raise ValueError(f\"expected end({self._tags[-1]}), got {tag}\")\n        else:\n            if not self._tags:\n                raise ValueError(\"unbalanced end()\")\n        tag = self._tags.pop()\n        if self._data:\n            self._flush(indent, wrap)\n        elif self._open:\n            self._open = 0\n            self.write(\"/>\\n\")\n            return\n        if indent:\n            self.write(self.get_indentation_spaces())\n        self.write(f\"</{tag}>\\n\")"},{"col":4,"comment":"null","endLoc":130,"header":"def start_line(self, lines)","id":5036,"name":"start_line","nodeType":"Function","startLoc":125,"text":"def start_line(self, lines):\n        line = find_latex_line(lines, self.header_start)\n        if line is not None:\n            return line + 1\n        else:\n            return None"},{"className":"CommentedHeader","col":0,"comment":"Character-delimited table with column names in a comment line.\n\n    When reading, ``header_start`` can be used to specify the\n    line index of column names, and it can be a negative index (for example -1\n    for the last commented line).  The default delimiter is the <space>\n    character.\n\n    This matches the format produced by ``np.savetxt()``, with ``delimiter=','``,\n    and ``header='<comma-delimited-column-names-list>'``.\n\n    Example::\n\n      # col1 col2 col3\n      # Comment line\n      1 2 3\n      4 5 6\n\n    ","endLoc":173,"id":5037,"nodeType":"Class","startLoc":124,"text":"class CommentedHeader(Basic):\n    \"\"\"Character-delimited table with column names in a comment line.\n\n    When reading, ``header_start`` can be used to specify the\n    line index of column names, and it can be a negative index (for example -1\n    for the last commented line).  The default delimiter is the <space>\n    character.\n\n    This matches the format produced by ``np.savetxt()``, with ``delimiter=','``,\n    and ``header='<comma-delimited-column-names-list>'``.\n\n    Example::\n\n      # col1 col2 col3\n      # Comment line\n      1 2 3\n      4 5 6\n\n    \"\"\"\n    _format_name = 'commented_header'\n    _description = 'Column names in a commented line'\n\n    header_class = CommentedHeaderHeader\n    data_class = NoHeaderData\n\n    def read(self, table):\n        \"\"\"\n        Read input data (file-like object, filename, list of strings, or\n        single string) into a Table and return the result.\n        \"\"\"\n        out = super().read(table)\n\n        # Strip off the comment line set as the header line for\n        # commented_header format (first by default).\n        if 'comments' in out.meta:\n            idx = self.header.start_line\n            if idx < 0:\n                idx = len(out.meta['comments']) + idx\n            out.meta['comments'] = out.meta['comments'][:idx] + out.meta['comments'][idx + 1:]\n            if not out.meta['comments']:\n                del out.meta['comments']\n\n        return out\n\n    def write_header(self, lines, meta):\n        \"\"\"\n        Write comment lines after, rather than before, the header.\n        \"\"\"\n        self.header.write(lines)\n        self.header.write_comments(lines, meta)"},{"col":0,"comment":"\n    Find the first line which matches a patters\n\n    Parameters\n    ----------\n    lines : list\n        List of strings\n    latex : str\n        Search pattern\n\n    Returns\n    -------\n    line_num : int, None\n        Line number. Returns None, if no match was found\n\n    ","endLoc":75,"header":"def find_latex_line(lines, latex)","id":5038,"name":"find_latex_line","nodeType":"Function","startLoc":53,"text":"def find_latex_line(lines, latex):\n    '''\n    Find the first line which matches a patters\n\n    Parameters\n    ----------\n    lines : list\n        List of strings\n    latex : str\n        Search pattern\n\n    Returns\n    -------\n    line_num : int, None\n        Line number. Returns None, if no match was found\n\n    '''\n    re_string = re.compile(latex.replace('\\\\', '\\\\\\\\'))\n    for i, line in enumerate(lines):\n        if re_string.match(line):\n            return i\n    else:\n        return None"},{"col":4,"comment":"\n        Read input data (file-like object, filename, list of strings, or\n        single string) into a Table and return the result.\n        ","endLoc":166,"header":"def read(self, table)","id":5039,"name":"read","nodeType":"Function","startLoc":149,"text":"def read(self, table):\n        \"\"\"\n        Read input data (file-like object, filename, list of strings, or\n        single string) into a Table and return the result.\n        \"\"\"\n        out = super().read(table)\n\n        # Strip off the comment line set as the header line for\n        # commented_header format (first by default).\n        if 'comments' in out.meta:\n            idx = self.header.start_line\n            if idx < 0:\n                idx = len(out.meta['comments']) + idx\n            out.meta['comments'] = out.meta['comments'][:idx] + out.meta['comments'][idx + 1:]\n            if not out.meta['comments']:\n                del out.meta['comments']\n\n        return out"},{"col":4,"comment":"null","endLoc":141,"header":"def _get_units(self)","id":5040,"name":"_get_units","nodeType":"Function","startLoc":132,"text":"def _get_units(self):\n        units = {}\n        col_units = [col.info.unit for col in self.cols]\n        for name, unit in zip(self.colnames, col_units):\n            if unit:\n                try:\n                    units[name] = unit.to_string(format='latex_inline')\n                except AttributeError:\n                    units[name] = unit\n        return units"},{"col":4,"comment":"\n        Write comment lines after, rather than before, the header.\n        ","endLoc":173,"header":"def write_header(self, lines, meta)","id":5041,"name":"write_header","nodeType":"Function","startLoc":168,"text":"def write_header(self, lines, meta):\n        \"\"\"\n        Write comment lines after, rather than before, the header.\n        \"\"\"\n        self.header.write(lines)\n        self.header.write_comments(lines, meta)"},{"col":4,"comment":"null","endLoc":163,"header":"def write(self, lines)","id":5042,"name":"write","nodeType":"Function","startLoc":143,"text":"def write(self, lines):\n        if 'col_align' not in self.latex:\n            self.latex['col_align'] = len(self.cols) * 'c'\n        if 'tablealign' in self.latex:\n            align = '[' + self.latex['tablealign'] + ']'\n        else:\n            align = ''\n        if self.latex['tabletype'] is not None:\n            lines.append(r'\\begin{' + self.latex['tabletype'] + r'}' + align)\n        add_dictval_to_list(self.latex, 'preamble', lines)\n        if 'caption' in self.latex:\n            lines.append(r'\\caption{' + self.latex['caption'] + '}')\n        lines.append(self.header_start + r'{' + self.latex['col_align'] + r'}')\n        add_dictval_to_list(self.latex, 'header_start', lines)\n        lines.append(self.splitter.join(self.colnames))\n        units = self._get_units()\n        if 'units' in self.latex:\n            units.update(self.latex['units'])\n        if units:\n            lines.append(self.splitter.join([units.get(name, ' ') for name in self.colnames]))\n        add_dictval_to_list(self.latex, 'header_end', lines)"},{"attributeType":"null","col":4,"comment":"null","endLoc":143,"id":5043,"name":"_format_name","nodeType":"Attribute","startLoc":143,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":144,"id":5044,"name":"_description","nodeType":"Attribute","startLoc":144,"text":"_description"},{"attributeType":"CommentedHeaderHeader","col":4,"comment":"null","endLoc":146,"id":5045,"name":"header_class","nodeType":"Attribute","startLoc":146,"text":"header_class"},{"attributeType":"NoHeaderData","col":4,"comment":"null","endLoc":147,"id":5046,"name":"data_class","nodeType":"Attribute","startLoc":147,"text":"data_class"},{"className":"TabHeaderSplitter","col":0,"comment":"Split lines on tab and do not remove whitespace","endLoc":181,"id":5047,"nodeType":"Class","startLoc":176,"text":"class TabHeaderSplitter(core.DefaultSplitter):\n    \"\"\"Split lines on tab and do not remove whitespace\"\"\"\n    delimiter = '\\t'\n\n    def process_line(self, line):\n        return line + '\\n'"},{"col":4,"comment":"\n        Adds character data to the output stream.\n\n        Parameters\n        ----------\n        text : str\n            Character data, as a Unicode string.\n        ","endLoc":247,"header":"def data(self, text)","id":5048,"name":"data","nodeType":"Function","startLoc":238,"text":"def data(self, text):\n        \"\"\"\n        Adds character data to the output stream.\n\n        Parameters\n        ----------\n        text : str\n            Character data, as a Unicode string.\n        \"\"\"\n        self._data.append(text)"},{"col":0,"comment":"Validate types of keyword arg inputs to read() or write().","endLoc":249,"header":"def _validate_read_write_kwargs(read_write, **kwargs)","id":5049,"name":"_validate_read_write_kwargs","nodeType":"Function","startLoc":203,"text":"def _validate_read_write_kwargs(read_write, **kwargs):\n    \"\"\"Validate types of keyword arg inputs to read() or write().\"\"\"\n\n    def is_ducktype(val, cls):\n        \"\"\"Check if ``val`` is an instance of ``cls`` or \"seems\" like one:\n        ``cls(val) == val`` does not raise and exception and is `True`. In\n        this way you can pass in ``np.int16(2)`` and have that count as `int`.\n\n        This has a special-case of ``cls`` being 'list-like', meaning it is\n        an iterable but not a string.\n        \"\"\"\n        if cls == 'list-like':\n            ok = (not isinstance(val, str)\n                  and isinstance(val, collections.abc.Iterable))\n        else:\n            ok = isinstance(val, cls)\n            if not ok:\n                # See if ``val`` walks and quacks like a ``cls```.\n                try:\n                    new_val = cls(val)\n                    assert new_val == val\n                except Exception:\n                    ok = False\n                else:\n                    ok = True\n        return ok\n\n    kwarg_types = READ_KWARG_TYPES if read_write == 'read' else WRITE_KWARG_TYPES\n\n    for arg, val in kwargs.items():\n        # Kwarg type checking is opt-in, so kwargs not in the list are considered OK.\n        # This reflects that some readers allow additional arguments that may not\n        # be well-specified, e.g. ```__init__(self, **kwargs)`` is an option.\n        if arg not in kwarg_types or val is None:\n            continue\n\n        # Single type or tuple of types for this arg (like isinstance())\n        types = kwarg_types[arg]\n        err_msg = (f\"{read_write}() argument '{arg}' must be a \"\n                   f\"{types} object, got {type(val)} instead\")\n\n        # Force `types` to be a tuple for the any() check below\n        if not isinstance(types, tuple):\n            types = (types,)\n\n        if not any(is_ducktype(val, cls) for cls in types):\n            raise TypeError(err_msg)"},{"col":0,"comment":"\n    Add a value from a dictionary to a list\n\n    Parameters\n    ----------\n    adict : dictionary\n    key : hashable\n    alist : list\n        List where value should be added\n    ","endLoc":50,"header":"def add_dictval_to_list(adict, key, alist)","id":5050,"name":"add_dictval_to_list","nodeType":"Function","startLoc":35,"text":"def add_dictval_to_list(adict, key, alist):\n    '''\n    Add a value from a dictionary to a list\n\n    Parameters\n    ----------\n    adict : dictionary\n    key : hashable\n    alist : list\n        List where value should be added\n    '''\n    if key in adict:\n        if isinstance(adict[key], str):\n            alist.append(adict[key])\n        else:\n            alist.extend(adict[key])"},{"col":4,"comment":"null","endLoc":181,"header":"def process_line(self, line)","id":5051,"name":"process_line","nodeType":"Function","startLoc":180,"text":"def process_line(self, line):\n        return line + '\\n'"},{"attributeType":"null","col":4,"comment":"null","endLoc":178,"id":5052,"name":"delimiter","nodeType":"Attribute","startLoc":178,"text":"delimiter"},{"className":"TabDataSplitter","col":0,"comment":"\n    Don't strip data value whitespace since that is significant in TSV tables\n    ","endLoc":189,"id":5054,"nodeType":"Class","startLoc":184,"text":"class TabDataSplitter(TabHeaderSplitter):\n    \"\"\"\n    Don't strip data value whitespace since that is significant in TSV tables\n    \"\"\"\n    process_val = None\n    skipinitialspace = False"},{"col":0,"comment":"Convert 'fast_reader' key in kwargs into a dict if not already and make sure\n    'enable' key is available.\n    ","endLoc":200,"header":"def _get_fast_reader_dict(kwargs)","id":5055,"name":"_get_fast_reader_dict","nodeType":"Function","startLoc":191,"text":"def _get_fast_reader_dict(kwargs):\n    \"\"\"Convert 'fast_reader' key in kwargs into a dict if not already and make sure\n    'enable' key is available.\n    \"\"\"\n    fast_reader = copy.deepcopy(kwargs.get('fast_reader', True))\n    if isinstance(fast_reader, dict):\n        fast_reader.setdefault('enable', 'force')\n    else:\n        fast_reader = {'enable': fast_reader}\n    return fast_reader"},{"attributeType":"None","col":4,"comment":"null","endLoc":188,"id":5056,"name":"process_val","nodeType":"Attribute","startLoc":188,"text":"process_val"},{"attributeType":"null","col":4,"comment":"null","endLoc":189,"id":5057,"name":"skipinitialspace","nodeType":"Attribute","startLoc":189,"text":"skipinitialspace"},{"className":"TabHeader","col":0,"comment":"\n    Reader for header of tables with tab separated header\n    ","endLoc":196,"id":5058,"nodeType":"Class","startLoc":192,"text":"class TabHeader(BasicHeader):\n    \"\"\"\n    Reader for header of tables with tab separated header\n    \"\"\"\n    splitter_class = TabHeaderSplitter"},{"attributeType":"TabHeaderSplitter","col":4,"comment":"null","endLoc":196,"id":5059,"name":"splitter_class","nodeType":"Attribute","startLoc":196,"text":"splitter_class"},{"className":"TabData","col":0,"comment":"\n    Reader for data of tables with tab separated data\n    ","endLoc":203,"id":5060,"nodeType":"Class","startLoc":199,"text":"class TabData(BasicData):\n    \"\"\"\n    Reader for data of tables with tab separated data\n    \"\"\"\n    splitter_class = TabDataSplitter"},{"attributeType":"TabDataSplitter","col":4,"comment":"null","endLoc":203,"id":5061,"name":"splitter_class","nodeType":"Attribute","startLoc":203,"text":"splitter_class"},{"className":"Tab","col":0,"comment":"Tab-separated table.\n\n    Unlike the :class:`Basic` reader, whitespace is not stripped from the\n    beginning and end of either lines or individual column values.\n\n    Example::\n\n      col1 <tab> col2 <tab> col3\n      # Comment line\n      1 <tab> 2 <tab> 5\n\n    ","endLoc":222,"id":5062,"nodeType":"Class","startLoc":206,"text":"class Tab(Basic):\n    \"\"\"Tab-separated table.\n\n    Unlike the :class:`Basic` reader, whitespace is not stripped from the\n    beginning and end of either lines or individual column values.\n\n    Example::\n\n      col1 <tab> col2 <tab> col3\n      # Comment line\n      1 <tab> 2 <tab> 5\n\n    \"\"\"\n    _format_name = 'tab'\n    _description = 'Basic table with tab-separated values'\n    header_class = TabHeader\n    data_class = TabData"},{"attributeType":"null","col":4,"comment":"null","endLoc":219,"id":5063,"name":"_format_name","nodeType":"Attribute","startLoc":219,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":220,"id":5064,"name":"_description","nodeType":"Attribute","startLoc":220,"text":"_description"},{"attributeType":"TabHeader","col":4,"comment":"null","endLoc":221,"id":5065,"name":"header_class","nodeType":"Attribute","startLoc":221,"text":"header_class"},{"attributeType":"TabData","col":4,"comment":"null","endLoc":222,"id":5066,"name":"data_class","nodeType":"Attribute","startLoc":222,"text":"data_class"},{"className":"CsvSplitter","col":0,"comment":"\n    Split on comma for CSV (comma-separated-value) tables\n    ","endLoc":229,"id":5067,"nodeType":"Class","startLoc":225,"text":"class CsvSplitter(core.DefaultSplitter):\n    \"\"\"\n    Split on comma for CSV (comma-separated-value) tables\n    \"\"\"\n    delimiter = ','"},{"col":4,"comment":"Context manager to control how XML data tags are cleaned (escaped) to\n        remove potentially unsafe characters or constructs.\n\n        The default (``method='escape_xml'``) applies brute-force escaping of\n        certain key XML characters like ``<``, ``>``, and ``&`` to ensure that\n        the output is not valid XML.\n\n        In order to explicitly allow certain XML tags (e.g. link reference or\n        emphasis tags), use ``method='bleach_clean'``.  This sanitizes the data\n        string using the ``clean`` function of the\n        `bleach <https://bleach.readthedocs.io/en/latest/clean.html>`_ package.\n        Any additional keyword arguments will be passed directly to the\n        ``clean`` function.\n\n        Finally, use ``method='none'`` to disable any sanitization. This should\n        be used sparingly.\n\n        Example::\n\n          w = writer.XMLWriter(ListWriter(lines))\n          with w.xml_cleaning_method('bleach_clean'):\n              w.start('td')\n              w.data('<a href=\"https://google.com\">google.com</a>')\n              w.end()\n\n        Parameters\n        ----------\n        method : str\n            Cleaning method.  Allowed values are \"escape_xml\",\n            \"bleach_clean\", and \"none\".\n\n        **clean_kwargs : keyword args\n            Additional keyword args that are passed to the\n            bleach.clean() function.\n        ","endLoc":203,"header":"@contextlib.contextmanager\n    def xml_cleaning_method(self, method='escape_xml', **clean_kwargs)","id":5068,"name":"xml_cleaning_method","nodeType":"Function","startLoc":145,"text":"@contextlib.contextmanager\n    def xml_cleaning_method(self, method='escape_xml', **clean_kwargs):\n        \"\"\"Context manager to control how XML data tags are cleaned (escaped) to\n        remove potentially unsafe characters or constructs.\n\n        The default (``method='escape_xml'``) applies brute-force escaping of\n        certain key XML characters like ``<``, ``>``, and ``&`` to ensure that\n        the output is not valid XML.\n\n        In order to explicitly allow certain XML tags (e.g. link reference or\n        emphasis tags), use ``method='bleach_clean'``.  This sanitizes the data\n        string using the ``clean`` function of the\n        `bleach <https://bleach.readthedocs.io/en/latest/clean.html>`_ package.\n        Any additional keyword arguments will be passed directly to the\n        ``clean`` function.\n\n        Finally, use ``method='none'`` to disable any sanitization. This should\n        be used sparingly.\n\n        Example::\n\n          w = writer.XMLWriter(ListWriter(lines))\n          with w.xml_cleaning_method('bleach_clean'):\n              w.start('td')\n              w.data('<a href=\"https://google.com\">google.com</a>')\n              w.end()\n\n        Parameters\n        ----------\n        method : str\n            Cleaning method.  Allowed values are \"escape_xml\",\n            \"bleach_clean\", and \"none\".\n\n        **clean_kwargs : keyword args\n            Additional keyword args that are passed to the\n            bleach.clean() function.\n        \"\"\"\n        current_xml_escape_cdata = self.xml_escape_cdata\n\n        if method == 'bleach_clean':\n            # NOTE: bleach is imported locally to avoid importing it when\n            # it is not nocessary\n            try:\n                import bleach\n            except ImportError:\n                raise ValueError('bleach package is required when HTML escaping is disabled.\\n'\n                                 'Use \"pip install bleach\".')\n\n            if clean_kwargs is None:\n                clean_kwargs = {}\n            self.xml_escape_cdata = lambda x: bleach.clean(x, **clean_kwargs)\n        elif method == \"none\":\n            self.xml_escape_cdata = lambda x: x\n        elif method != 'escape_xml':\n            raise ValueError('allowed values of method are \"escape_xml\", \"bleach_clean\", and \"none\"')\n\n        yield\n\n        self.xml_escape_cdata = current_xml_escape_cdata"},{"attributeType":"null","col":4,"comment":"null","endLoc":229,"id":5069,"name":"delimiter","nodeType":"Attribute","startLoc":229,"text":"delimiter"},{"className":"CsvHeader","col":0,"comment":"\n    Header that uses the :class:`astropy.io.ascii.basic.CsvSplitter`\n    ","endLoc":238,"id":5070,"nodeType":"Class","startLoc":232,"text":"class CsvHeader(BasicHeader):\n    \"\"\"\n    Header that uses the :class:`astropy.io.ascii.basic.CsvSplitter`\n    \"\"\"\n    splitter_class = CsvSplitter\n    comment = None\n    write_comment = None"},{"attributeType":"CsvSplitter","col":4,"comment":"null","endLoc":236,"id":5071,"name":"splitter_class","nodeType":"Attribute","startLoc":236,"text":"splitter_class"},{"attributeType":"None","col":4,"comment":"null","endLoc":237,"id":5072,"name":"comment","nodeType":"Attribute","startLoc":237,"text":"comment"},{"attributeType":"None","col":4,"comment":"null","endLoc":238,"id":5073,"name":"write_comment","nodeType":"Attribute","startLoc":238,"text":"write_comment"},{"className":"CsvData","col":0,"comment":"\n    Data that uses the :class:`astropy.io.ascii.basic.CsvSplitter`\n    ","endLoc":248,"id":5074,"nodeType":"Class","startLoc":241,"text":"class CsvData(BasicData):\n    \"\"\"\n    Data that uses the :class:`astropy.io.ascii.basic.CsvSplitter`\n    \"\"\"\n    splitter_class = CsvSplitter\n    fill_values = [(core.masked, '')]\n    comment = None\n    write_comment = None"},{"attributeType":"CsvSplitter","col":4,"comment":"null","endLoc":245,"id":5075,"name":"splitter_class","nodeType":"Attribute","startLoc":245,"text":"splitter_class"},{"col":36,"endLoc":195,"id":5076,"nodeType":"Lambda","startLoc":195,"text":"lambda x: bleach.clean(x, **clean_kwargs)"},{"col":36,"endLoc":197,"id":5077,"nodeType":"Lambda","startLoc":197,"text":"lambda x: x"},{"attributeType":"null","col":4,"comment":"null","endLoc":246,"id":5078,"name":"fill_values","nodeType":"Attribute","startLoc":246,"text":"fill_values"},{"col":0,"comment":"\n    For fast_reader read the ``table`` in chunks and vstack to create\n    a single table, OR return a generator of chunk tables.\n    ","endLoc":665,"header":"def _read_in_chunks(table, **kwargs)","id":5079,"name":"_read_in_chunks","nodeType":"Function","startLoc":618,"text":"def _read_in_chunks(table, **kwargs):\n    \"\"\"\n    For fast_reader read the ``table`` in chunks and vstack to create\n    a single table, OR return a generator of chunk tables.\n    \"\"\"\n    fast_reader = kwargs['fast_reader']\n    chunk_size = fast_reader.pop('chunk_size')\n    chunk_generator = fast_reader.pop('chunk_generator', False)\n    fast_reader['parallel'] = False  # No parallel with chunks\n\n    tbl_chunks = _read_in_chunks_generator(table, chunk_size, **kwargs)\n    if chunk_generator:\n        return tbl_chunks\n\n    tbl0 = next(tbl_chunks)\n    masked = tbl0.masked\n\n    # Numpy won't allow resizing the original so make a copy here.\n    out_cols = {col.name: col.data.copy() for col in tbl0.itercols()}\n\n    str_kinds = ('S', 'U')\n    for tbl in tbl_chunks:\n        masked |= tbl.masked\n        for name, col in tbl.columns.items():\n            # Concatenate current column data and new column data\n\n            # If one of the inputs is string-like and the other is not, then\n            # convert the non-string to a string.  In a perfect world this would\n            # be handled by numpy, but as of numpy 1.13 this results in a string\n            # dtype that is too long (https://github.com/numpy/numpy/issues/10062).\n\n            col1, col2 = out_cols[name], col.data\n            if col1.dtype.kind in str_kinds and col2.dtype.kind not in str_kinds:\n                col2 = np.array(col2.tolist(), dtype=col1.dtype.kind)\n            elif col2.dtype.kind in str_kinds and col1.dtype.kind not in str_kinds:\n                col1 = np.array(col1.tolist(), dtype=col2.dtype.kind)\n\n            # Choose either masked or normal concatenation\n            concatenate = np.ma.concatenate if masked else np.concatenate\n\n            out_cols[name] = concatenate([col1, col2])\n\n    # Make final table from numpy arrays, converting dict to list\n    out_cols = [out_cols[name] for name in tbl0.colnames]\n    out = tbl0.__class__(out_cols, names=tbl0.colnames, meta=tbl0.meta,\n                         copy=False)\n\n    return out"},{"attributeType":"None","col":4,"comment":"null","endLoc":247,"id":5080,"name":"comment","nodeType":"Attribute","startLoc":247,"text":"comment"},{"attributeType":"None","col":4,"comment":"null","endLoc":248,"id":5081,"name":"write_comment","nodeType":"Attribute","startLoc":248,"text":"write_comment"},{"className":"Csv","col":0,"comment":"CSV (comma-separated-values) table.\n\n    This file format may contain rows with fewer entries than the number of\n    columns, a situation that occurs in output from some spreadsheet editors.\n    The missing entries are marked as masked in the output table.\n\n    Masked values (indicated by an empty '' field value when reading) are\n    written out in the same way with an empty ('') field.  This is different\n    from the typical default for `astropy.io.ascii` in which missing values are\n    indicated by ``--``.\n\n    Since the `CSV format <https://tools.ietf.org/html/rfc4180>`_ does not\n    formally support comments, any comments defined for the table via\n    ``tbl.meta['comments']`` are ignored by default. If you would still like to\n    write those comments then include a keyword ``comment='#'`` to the\n    ``write()`` call.\n\n    Example::\n\n      num,ra,dec,radius,mag\n      1,32.23222,10.1211\n      2,38.12321,-88.1321,2.2,17.0\n\n    ","endLoc":308,"id":5082,"nodeType":"Class","startLoc":251,"text":"class Csv(Basic):\n    \"\"\"CSV (comma-separated-values) table.\n\n    This file format may contain rows with fewer entries than the number of\n    columns, a situation that occurs in output from some spreadsheet editors.\n    The missing entries are marked as masked in the output table.\n\n    Masked values (indicated by an empty '' field value when reading) are\n    written out in the same way with an empty ('') field.  This is different\n    from the typical default for `astropy.io.ascii` in which missing values are\n    indicated by ``--``.\n\n    Since the `CSV format <https://tools.ietf.org/html/rfc4180>`_ does not\n    formally support comments, any comments defined for the table via\n    ``tbl.meta['comments']`` are ignored by default. If you would still like to\n    write those comments then include a keyword ``comment='#'`` to the\n    ``write()`` call.\n\n    Example::\n\n      num,ra,dec,radius,mag\n      1,32.23222,10.1211\n      2,38.12321,-88.1321,2.2,17.0\n\n    \"\"\"\n    _format_name = 'csv'\n    _io_registry_format_aliases = ['csv']\n    _io_registry_can_write = True\n    _io_registry_suffix = '.csv'\n    _description = 'Comma-separated-values'\n\n    header_class = CsvHeader\n    data_class = CsvData\n\n    def inconsistent_handler(self, str_vals, ncols):\n        \"\"\"\n        Adjust row if it is too short.\n\n        If a data row is shorter than the header, add empty values to make it the\n        right length.\n        Note that this will *not* be called if the row already matches the header.\n\n        Parameters\n        ----------\n        str_vals : list\n            A list of value strings from the current row of the table.\n        ncols : int\n            The expected number of entries from the table header.\n\n        Returns\n        -------\n        str_vals : list\n            List of strings to be parsed into data entries in the output table.\n        \"\"\"\n        if len(str_vals) < ncols:\n            str_vals.extend((ncols - len(str_vals)) * [''])\n\n        return str_vals"},{"col":4,"comment":"\n        Adjust row if it is too short.\n\n        If a data row is shorter than the header, add empty values to make it the\n        right length.\n        Note that this will *not* be called if the row already matches the header.\n\n        Parameters\n        ----------\n        str_vals : list\n            A list of value strings from the current row of the table.\n        ncols : int\n            The expected number of entries from the table header.\n\n        Returns\n        -------\n        str_vals : list\n            List of strings to be parsed into data entries in the output table.\n        ","endLoc":308,"header":"def inconsistent_handler(self, str_vals, ncols)","id":5083,"name":"inconsistent_handler","nodeType":"Function","startLoc":285,"text":"def inconsistent_handler(self, str_vals, ncols):\n        \"\"\"\n        Adjust row if it is too short.\n\n        If a data row is shorter than the header, add empty values to make it the\n        right length.\n        Note that this will *not* be called if the row already matches the header.\n\n        Parameters\n        ----------\n        str_vals : list\n            A list of value strings from the current row of the table.\n        ncols : int\n            The expected number of entries from the table header.\n\n        Returns\n        -------\n        str_vals : list\n            List of strings to be parsed into data entries in the output table.\n        \"\"\"\n        if len(str_vals) < ncols:\n            str_vals.extend((ncols - len(str_vals)) * [''])\n\n        return str_vals"},{"attributeType":"null","col":4,"comment":"null","endLoc":276,"id":5084,"name":"_format_name","nodeType":"Attribute","startLoc":276,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":277,"id":5085,"name":"_io_registry_format_aliases","nodeType":"Attribute","startLoc":277,"text":"_io_registry_format_aliases"},{"attributeType":"null","col":4,"comment":"null","endLoc":278,"id":5086,"name":"_io_registry_can_write","nodeType":"Attribute","startLoc":278,"text":"_io_registry_can_write"},{"attributeType":"null","col":4,"comment":"null","endLoc":279,"id":5087,"name":"_io_registry_suffix","nodeType":"Attribute","startLoc":279,"text":"_io_registry_suffix"},{"attributeType":"null","col":4,"comment":"null","endLoc":280,"id":5088,"name":"_description","nodeType":"Attribute","startLoc":280,"text":"_description"},{"attributeType":"CsvHeader","col":4,"comment":"null","endLoc":282,"id":5089,"name":"header_class","nodeType":"Attribute","startLoc":282,"text":"header_class"},{"col":0,"comment":"\n    For fast_reader read the ``table`` in chunks and return a generator\n    of tables for each chunk.\n    ","endLoc":736,"header":"def _read_in_chunks_generator(table, chunk_size, **kwargs)","id":5090,"name":"_read_in_chunks_generator","nodeType":"Function","startLoc":668,"text":"def _read_in_chunks_generator(table, chunk_size, **kwargs):\n    \"\"\"\n    For fast_reader read the ``table`` in chunks and return a generator\n    of tables for each chunk.\n    \"\"\"\n\n    @contextlib.contextmanager\n    def passthrough_fileobj(fileobj, encoding=None):\n        \"\"\"Stub for get_readable_fileobj, which does not seem to work in Py3\n        for input file-like object, see #6460\"\"\"\n        yield fileobj\n\n    # Set up to coerce `table` input into a readable file object by selecting\n    # an appropriate function.\n\n    # Convert table-as-string to a File object.  Finding a newline implies\n    # that the string is not a filename.\n    if (isinstance(table, str) and ('\\n' in table or '\\r' in table)):\n        table = StringIO(table)\n        fileobj_context = passthrough_fileobj\n    elif hasattr(table, 'read') and hasattr(table, 'seek'):\n        fileobj_context = passthrough_fileobj\n    else:\n        # string filename or pathlib\n        fileobj_context = get_readable_fileobj\n\n    # Set up for iterating over chunks\n    kwargs['fast_reader']['return_header_chars'] = True\n    header = ''  # Table header (up to start of data)\n    prev_chunk_chars = ''  # Chars from previous chunk after last newline\n    first_chunk = True  # True for the first chunk, False afterward\n\n    with fileobj_context(table, encoding=kwargs.get('encoding')) as fh:\n\n        while True:\n            chunk = fh.read(chunk_size)\n            # Got fewer chars than requested, must be end of file\n            final_chunk = len(chunk) < chunk_size\n\n            # If this is the last chunk and there is only whitespace then break\n            if final_chunk and not re.search(r'\\S', chunk):\n                break\n\n            # Step backwards from last character in chunk and find first newline\n            for idx in range(len(chunk) - 1, -1, -1):\n                if final_chunk or chunk[idx] == '\\n':\n                    break\n            else:\n                raise ValueError('no newline found in chunk (chunk_size too small?)')\n\n            # Stick on the header to the chunk part up to (and including) the\n            # last newline.  Make sure the small strings are concatenated first.\n            complete_chunk = (header + prev_chunk_chars) + chunk[:idx + 1]\n            prev_chunk_chars = chunk[idx + 1:]\n\n            # Now read the chunk as a complete table\n            tbl = read(complete_chunk, guess=False, **kwargs)\n\n            # For the first chunk pop the meta key which contains the header\n            # characters (everything up to the start of data) then fix kwargs\n            # so it doesn't return that in meta any more.\n            if first_chunk:\n                header = tbl.meta.pop('__ascii_fast_reader_header_chars__')\n                first_chunk = False\n\n            yield tbl\n\n            if final_chunk:\n                break"},{"attributeType":"CsvData","col":4,"comment":"null","endLoc":283,"id":5091,"name":"data_class","nodeType":"Attribute","startLoc":283,"text":"data_class"},{"className":"RdbHeader","col":0,"comment":"\n    Header for RDB tables\n    ","endLoc":367,"id":5092,"nodeType":"Class","startLoc":311,"text":"class RdbHeader(TabHeader):\n    \"\"\"\n    Header for RDB tables\n    \"\"\"\n    col_type_map = {'n': core.NumType,\n                    's': core.StrType}\n\n    def get_type_map_key(self, col):\n        return col.raw_type[-1]\n\n    def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines``.\n\n        This is a specialized get_cols for the RDB type:\n        Line 0: RDB col names\n        Line 1: RDB col definitions\n        Line 2+: RDB data rows\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        Returns\n        -------\n        None\n\n        \"\"\"\n        header_lines = self.process_lines(lines)   # this is a generator\n        header_vals_list = [hl for _, hl in zip(range(2), self.splitter(header_lines))]\n        if len(header_vals_list) != 2:\n            raise ValueError('RDB header requires 2 lines')\n        self.names, raw_types = header_vals_list\n\n        if len(self.names) != len(raw_types):\n            raise core.InconsistentTableError(\n                'RDB header mismatch between number of column names and column types.')\n\n        if any(not re.match(r'\\d*(N|S)$', x, re.IGNORECASE) for x in raw_types):\n            raise core.InconsistentTableError(\n                f'RDB types definitions do not all match [num](N|S): {raw_types}')\n\n        self._set_cols_from_names()\n        for col, raw_type in zip(self.cols, raw_types):\n            col.raw_type = raw_type\n            col.type = self.get_col_type(col)\n\n    def write(self, lines):\n        lines.append(self.splitter.join(self.colnames))\n        rdb_types = []\n        for col in self.cols:\n            # Check if dtype.kind is string or unicode.  See help(np.core.numerictypes)\n            rdb_type = 'S' if col.info.dtype.kind in ('S', 'U') else 'N'\n            rdb_types.append(rdb_type)\n\n        lines.append(self.splitter.join(rdb_types))"},{"col":4,"comment":"null","endLoc":319,"header":"def get_type_map_key(self, col)","id":5093,"name":"get_type_map_key","nodeType":"Function","startLoc":318,"text":"def get_type_map_key(self, col):\n        return col.raw_type[-1]"},{"col":4,"comment":"\n        Initialize the header Column objects from the table ``lines``.\n\n        This is a specialized get_cols for the RDB type:\n        Line 0: RDB col names\n        Line 1: RDB col definitions\n        Line 2+: RDB data rows\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        Returns\n        -------\n        None\n\n        ","endLoc":357,"header":"def get_cols(self, lines)","id":5094,"name":"get_cols","nodeType":"Function","startLoc":321,"text":"def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines``.\n\n        This is a specialized get_cols for the RDB type:\n        Line 0: RDB col names\n        Line 1: RDB col definitions\n        Line 2+: RDB data rows\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        Returns\n        -------\n        None\n\n        \"\"\"\n        header_lines = self.process_lines(lines)   # this is a generator\n        header_vals_list = [hl for _, hl in zip(range(2), self.splitter(header_lines))]\n        if len(header_vals_list) != 2:\n            raise ValueError('RDB header requires 2 lines')\n        self.names, raw_types = header_vals_list\n\n        if len(self.names) != len(raw_types):\n            raise core.InconsistentTableError(\n                'RDB header mismatch between number of column names and column types.')\n\n        if any(not re.match(r'\\d*(N|S)$', x, re.IGNORECASE) for x in raw_types):\n            raise core.InconsistentTableError(\n                f'RDB types definitions do not all match [num](N|S): {raw_types}')\n\n        self._set_cols_from_names()\n        for col, raw_type in zip(self.cols, raw_types):\n            col.raw_type = raw_type\n            col.type = self.get_col_type(col)"},{"attributeType":"null","col":4,"comment":"null","endLoc":122,"id":5095,"name":"header_start","nodeType":"Attribute","startLoc":122,"text":"header_start"},{"attributeType":"LatexSplitter","col":4,"comment":"null","endLoc":123,"id":5096,"name":"splitter_class","nodeType":"Attribute","startLoc":123,"text":"splitter_class"},{"className":"LatexData","col":0,"comment":"Class to read the data in LaTeX tables","endLoc":194,"id":5097,"nodeType":"Class","startLoc":166,"text":"class LatexData(core.BaseData):\n    '''Class to read the data in LaTeX tables'''\n    data_start = None\n    data_end = r'\\end{tabular}'\n    splitter_class = LatexSplitter\n\n    def start_line(self, lines):\n        if self.data_start:\n            return find_latex_line(lines, self.data_start)\n        else:\n            start = self.header.start_line(lines)\n            if start is None:\n                raise core.InconsistentTableError(r'Could not find table start')\n            return start + 1\n\n    def end_line(self, lines):\n        if self.data_end:\n            return find_latex_line(lines, self.data_end)\n        else:\n            return None\n\n    def write(self, lines):\n        add_dictval_to_list(self.latex, 'data_start', lines)\n        core.BaseData.write(self, lines)\n        add_dictval_to_list(self.latex, 'data_end', lines)\n        lines.append(self.data_end)\n        add_dictval_to_list(self.latex, 'tablefoot', lines)\n        if self.latex['tabletype'] is not None:\n            lines.append(r'\\end{' + self.latex['tabletype'] + '}')"},{"col":4,"comment":"null","endLoc":179,"header":"def start_line(self, lines)","id":5098,"name":"start_line","nodeType":"Function","startLoc":172,"text":"def start_line(self, lines):\n        if self.data_start:\n            return find_latex_line(lines, self.data_start)\n        else:\n            start = self.header.start_line(lines)\n            if start is None:\n                raise core.InconsistentTableError(r'Could not find table start')\n            return start + 1"},{"attributeType":"null","col":4,"comment":"null","endLoc":216,"id":5099,"name":"default_converters","nodeType":"Attribute","startLoc":216,"text":"default_converters"},{"col":4,"comment":"null","endLoc":185,"header":"def end_line(self, lines)","id":5100,"name":"end_line","nodeType":"Function","startLoc":181,"text":"def end_line(self, lines):\n        if self.data_end:\n            return find_latex_line(lines, self.data_end)\n        else:\n            return None"},{"col":4,"comment":"null","endLoc":194,"header":"def write(self, lines)","id":5101,"name":"write","nodeType":"Function","startLoc":187,"text":"def write(self, lines):\n        add_dictval_to_list(self.latex, 'data_start', lines)\n        core.BaseData.write(self, lines)\n        add_dictval_to_list(self.latex, 'data_end', lines)\n        lines.append(self.data_end)\n        add_dictval_to_list(self.latex, 'tablefoot', lines)\n        if self.latex['tabletype'] is not None:\n            lines.append(r'\\end{' + self.latex['tabletype'] + '}')"},{"className":"EcsvData","col":0,"comment":"null","endLoc":404,"id":5102,"nodeType":"Class","startLoc":338,"text":"class EcsvData(basic.BasicData):\n    def _set_fill_values(self, cols):\n        \"\"\"READ: Set the fill values of the individual cols based on fill_values of BaseData\n\n        For ECSV handle the corner case of data that has been serialized using\n        the serialize_method='data_mask' option, which writes the full data and\n        mask directly, AND where that table includes a string column with zero-length\n        string entries (\"\") which are valid data.\n\n        Normally the super() method will set col.fill_value=('', '0') to replace\n        blanks with a '0'.  But for that corner case subset, instead do not do\n        any filling.\n        \"\"\"\n        super()._set_fill_values(cols)\n\n        # Get the serialized columns spec.  It might not exist and there might\n        # not even be any table meta, so punt in those cases.\n        try:\n            scs = self.header.table_meta['__serialized_columns__']\n        except (AttributeError, KeyError):\n            return\n\n        # Got some serialized columns, so check for string type and serialized\n        # as a MaskedColumn.  Without 'data_mask', MaskedColumn objects are\n        # stored to ECSV as normal columns.\n        for col in cols:\n            if (col.dtype == 'str' and col.name in scs\n                    and scs[col.name]['__class__'] == 'astropy.table.column.MaskedColumn'):\n                col.fill_values = {}  # No data value replacement\n\n    def str_vals(self):\n        \"\"\"WRITE: convert all values in table to a list of lists of strings\n\n        This version considerably simplifies the base method:\n        - No need to set fill values and column formats\n        - No per-item formatting, just use repr()\n        - Use JSON for object-type or multidim values\n        - Only Column or MaskedColumn can end up as cols here.\n        - Only replace masked values with \"\", not the generalized filling\n        \"\"\"\n        for col in self.cols:\n            if len(col.shape) > 1 or col.info.dtype.kind == 'O':\n                def format_col_item(idx):\n                    obj = col[idx]\n                    try:\n                        obj = obj.tolist()\n                    except AttributeError:\n                        pass\n                    return json.dumps(obj, separators=(',', ':'))\n            else:\n                def format_col_item(idx):\n                    return str(col[idx])\n\n            try:\n                col.str_vals = [format_col_item(idx) for idx in range(len(col))]\n            except TypeError as exc:\n                raise TypeError(f'could not convert column {col.info.name!r}'\n                                f' to string: {exc}') from exc\n\n            # Replace every masked value in a 1-d column with an empty string.\n            # For multi-dim columns this gets done by JSON via \"null\".\n            if hasattr(col, 'mask') and col.ndim == 1:\n                for idx in col.mask.nonzero()[0]:\n                    col.str_vals[idx] = \"\"\n\n        out = [col.str_vals for col in self.cols]\n        return out"},{"col":4,"comment":"READ: Set the fill values of the individual cols based on fill_values of BaseData\n\n        For ECSV handle the corner case of data that has been serialized using\n        the serialize_method='data_mask' option, which writes the full data and\n        mask directly, AND where that table includes a string column with zero-length\n        string entries (\"\") which are valid data.\n\n        Normally the super() method will set col.fill_value=('', '0') to replace\n        blanks with a '0'.  But for that corner case subset, instead do not do\n        any filling.\n        ","endLoc":366,"header":"def _set_fill_values(self, cols)","id":5103,"name":"_set_fill_values","nodeType":"Function","startLoc":339,"text":"def _set_fill_values(self, cols):\n        \"\"\"READ: Set the fill values of the individual cols based on fill_values of BaseData\n\n        For ECSV handle the corner case of data that has been serialized using\n        the serialize_method='data_mask' option, which writes the full data and\n        mask directly, AND where that table includes a string column with zero-length\n        string entries (\"\") which are valid data.\n\n        Normally the super() method will set col.fill_value=('', '0') to replace\n        blanks with a '0'.  But for that corner case subset, instead do not do\n        any filling.\n        \"\"\"\n        super()._set_fill_values(cols)\n\n        # Get the serialized columns spec.  It might not exist and there might\n        # not even be any table meta, so punt in those cases.\n        try:\n            scs = self.header.table_meta['__serialized_columns__']\n        except (AttributeError, KeyError):\n            return\n\n        # Got some serialized columns, so check for string type and serialized\n        # as a MaskedColumn.  Without 'data_mask', MaskedColumn objects are\n        # stored to ECSV as normal columns.\n        for col in cols:\n            if (col.dtype == 'str' and col.name in scs\n                    and scs[col.name]['__class__'] == 'astropy.table.column.MaskedColumn'):\n                col.fill_values = {}  # No data value replacement"},{"col":4,"comment":"WRITE: convert all values in table to a list of lists of strings\n\n        This version considerably simplifies the base method:\n        - No need to set fill values and column formats\n        - No per-item formatting, just use repr()\n        - Use JSON for object-type or multidim values\n        - Only Column or MaskedColumn can end up as cols here.\n        - Only replace masked values with \"\", not the generalized filling\n        ","endLoc":404,"header":"def str_vals(self)","id":5104,"name":"str_vals","nodeType":"Function","startLoc":368,"text":"def str_vals(self):\n        \"\"\"WRITE: convert all values in table to a list of lists of strings\n\n        This version considerably simplifies the base method:\n        - No need to set fill values and column formats\n        - No per-item formatting, just use repr()\n        - Use JSON for object-type or multidim values\n        - Only Column or MaskedColumn can end up as cols here.\n        - Only replace masked values with \"\", not the generalized filling\n        \"\"\"\n        for col in self.cols:\n            if len(col.shape) > 1 or col.info.dtype.kind == 'O':\n                def format_col_item(idx):\n                    obj = col[idx]\n                    try:\n                        obj = obj.tolist()\n                    except AttributeError:\n                        pass\n                    return json.dumps(obj, separators=(',', ':'))\n            else:\n                def format_col_item(idx):\n                    return str(col[idx])\n\n            try:\n                col.str_vals = [format_col_item(idx) for idx in range(len(col))]\n            except TypeError as exc:\n                raise TypeError(f'could not convert column {col.info.name!r}'\n                                f' to string: {exc}') from exc\n\n            # Replace every masked value in a 1-d column with an empty string.\n            # For multi-dim columns this gets done by JSON via \"null\".\n            if hasattr(col, 'mask') and col.ndim == 1:\n                for idx in col.mask.nonzero()[0]:\n                    col.str_vals[idx] = \"\"\n\n        out = [col.str_vals for col in self.cols]\n        return out"},{"attributeType":"None","col":4,"comment":"null","endLoc":168,"id":5105,"name":"data_start","nodeType":"Attribute","startLoc":168,"text":"data_start"},{"attributeType":"null","col":4,"comment":"null","endLoc":169,"id":5106,"name":"data_end","nodeType":"Attribute","startLoc":169,"text":"data_end"},{"attributeType":"LatexSplitter","col":4,"comment":"null","endLoc":170,"id":5107,"name":"splitter_class","nodeType":"Attribute","startLoc":170,"text":"splitter_class"},{"className":"Latex","col":0,"comment":"LaTeX format table.\n\n    This class implements some LaTeX specific commands.  Its main\n    purpose is to write out a table in a form that LaTeX can compile. It\n    is beyond the scope of this class to implement every possible LaTeX\n    command, instead the focus is to generate a syntactically valid\n    LaTeX tables.\n\n    This class can also read simple LaTeX tables (one line per table\n    row, no ``\\multicolumn`` or similar constructs), specifically, it\n    can read the tables that it writes.\n\n    Reading a LaTeX table, the following keywords are accepted:\n\n    **ignore_latex_commands** :\n        Lines starting with these LaTeX commands will be treated as comments (i.e. ignored).\n\n    When writing a LaTeX table, the some keywords can customize the\n    format.  Care has to be taken here, because python interprets ``\\\\``\n    in a string as an escape character.  In order to pass this to the\n    output either format your strings as raw strings with the ``r``\n    specifier or use a double ``\\\\\\\\``.\n\n    Examples::\n\n        caption = r'My table \\label{mytable}'\n        caption = 'My table \\\\\\\\label{mytable}'\n\n    **latexdict** : Dictionary of extra parameters for the LaTeX output\n\n        * tabletype : used for first and last line of table.\n            The default is ``\\\\begin{table}``.  The following would generate a table,\n            which spans the whole page in a two-column document::\n\n                ascii.write(data, sys.stdout, Writer = ascii.Latex,\n                            latexdict = {'tabletype': 'table*'})\n\n            If ``None``, the table environment will be dropped, keeping only\n            the ``tabular`` environment.\n\n        * tablealign : positioning of table in text.\n            The default is not to specify a position preference in the text.\n            If, e.g. the alignment is ``ht``, then the LaTeX will be ``\\\\begin{table}[ht]``.\n\n        * col_align : Alignment of columns\n            If not present all columns will be centered.\n\n        * caption : Table caption (string or list of strings)\n            This will appear above the table as it is the standard in\n            many scientific publications.  If you prefer a caption below\n            the table, just write the full LaTeX command as\n            ``latexdict['tablefoot'] = r'\\caption{My table}'``\n\n        * preamble, header_start, header_end, data_start, data_end, tablefoot: Pure LaTeX\n            Each one can be a string or a list of strings. These strings\n            will be inserted into the table without any further\n            processing. See the examples below.\n\n        * units : dictionary of strings\n            Keys in this dictionary should be names of columns. If\n            present, a line in the LaTeX table directly below the column\n            names is added, which contains the values of the\n            dictionary. Example::\n\n              from astropy.io import ascii\n              data = {'name': ['bike', 'car'], 'mass': [75,1200], 'speed': [10, 130]}\n              ascii.write(data, Writer=ascii.Latex,\n                               latexdict = {'units': {'mass': 'kg', 'speed': 'km/h'}})\n\n            If the column has no entry in the ``units`` dictionary, it defaults\n            to the **unit** attribute of the column. If this attribute is not\n            specified (i.e. it is None), the unit will be written as ``' '``.\n\n        Run the following code to see where each element of the\n        dictionary is inserted in the LaTeX table::\n\n            from astropy.io import ascii\n            data = {'cola': [1,2], 'colb': [3,4]}\n            ascii.write(data, Writer=ascii.Latex, latexdict=ascii.latex.latexdicts['template'])\n\n        Some table styles are predefined in the dictionary\n        ``ascii.latex.latexdicts``. The following generates in table in\n        style preferred by A&A and some other journals::\n\n            ascii.write(data, Writer=ascii.Latex, latexdict=ascii.latex.latexdicts['AA'])\n\n        As an example, this generates a table, which spans all columns\n        and is centered on the page::\n\n            ascii.write(data, Writer=ascii.Latex, col_align='|lr|',\n                        latexdict={'preamble': r'\\begin{center}',\n                                   'tablefoot': r'\\end{center}',\n                                   'tabletype': 'table*'})\n\n    **caption** : Set table caption\n        Shorthand for::\n\n            latexdict['caption'] = caption\n\n    **col_align** : Set the column alignment.\n        If not present this will be auto-generated for centered\n        columns. Shorthand for::\n\n            latexdict['col_align'] = col_align\n\n    ","endLoc":348,"id":5108,"nodeType":"Class","startLoc":197,"text":"class Latex(core.BaseReader):\n    r'''LaTeX format table.\n\n    This class implements some LaTeX specific commands.  Its main\n    purpose is to write out a table in a form that LaTeX can compile. It\n    is beyond the scope of this class to implement every possible LaTeX\n    command, instead the focus is to generate a syntactically valid\n    LaTeX tables.\n\n    This class can also read simple LaTeX tables (one line per table\n    row, no ``\\multicolumn`` or similar constructs), specifically, it\n    can read the tables that it writes.\n\n    Reading a LaTeX table, the following keywords are accepted:\n\n    **ignore_latex_commands** :\n        Lines starting with these LaTeX commands will be treated as comments (i.e. ignored).\n\n    When writing a LaTeX table, the some keywords can customize the\n    format.  Care has to be taken here, because python interprets ``\\\\``\n    in a string as an escape character.  In order to pass this to the\n    output either format your strings as raw strings with the ``r``\n    specifier or use a double ``\\\\\\\\``.\n\n    Examples::\n\n        caption = r'My table \\label{mytable}'\n        caption = 'My table \\\\\\\\label{mytable}'\n\n    **latexdict** : Dictionary of extra parameters for the LaTeX output\n\n        * tabletype : used for first and last line of table.\n            The default is ``\\\\begin{table}``.  The following would generate a table,\n            which spans the whole page in a two-column document::\n\n                ascii.write(data, sys.stdout, Writer = ascii.Latex,\n                            latexdict = {'tabletype': 'table*'})\n\n            If ``None``, the table environment will be dropped, keeping only\n            the ``tabular`` environment.\n\n        * tablealign : positioning of table in text.\n            The default is not to specify a position preference in the text.\n            If, e.g. the alignment is ``ht``, then the LaTeX will be ``\\\\begin{table}[ht]``.\n\n        * col_align : Alignment of columns\n            If not present all columns will be centered.\n\n        * caption : Table caption (string or list of strings)\n            This will appear above the table as it is the standard in\n            many scientific publications.  If you prefer a caption below\n            the table, just write the full LaTeX command as\n            ``latexdict['tablefoot'] = r'\\caption{My table}'``\n\n        * preamble, header_start, header_end, data_start, data_end, tablefoot: Pure LaTeX\n            Each one can be a string or a list of strings. These strings\n            will be inserted into the table without any further\n            processing. See the examples below.\n\n        * units : dictionary of strings\n            Keys in this dictionary should be names of columns. If\n            present, a line in the LaTeX table directly below the column\n            names is added, which contains the values of the\n            dictionary. Example::\n\n              from astropy.io import ascii\n              data = {'name': ['bike', 'car'], 'mass': [75,1200], 'speed': [10, 130]}\n              ascii.write(data, Writer=ascii.Latex,\n                               latexdict = {'units': {'mass': 'kg', 'speed': 'km/h'}})\n\n            If the column has no entry in the ``units`` dictionary, it defaults\n            to the **unit** attribute of the column. If this attribute is not\n            specified (i.e. it is None), the unit will be written as ``' '``.\n\n        Run the following code to see where each element of the\n        dictionary is inserted in the LaTeX table::\n\n            from astropy.io import ascii\n            data = {'cola': [1,2], 'colb': [3,4]}\n            ascii.write(data, Writer=ascii.Latex, latexdict=ascii.latex.latexdicts['template'])\n\n        Some table styles are predefined in the dictionary\n        ``ascii.latex.latexdicts``. The following generates in table in\n        style preferred by A&A and some other journals::\n\n            ascii.write(data, Writer=ascii.Latex, latexdict=ascii.latex.latexdicts['AA'])\n\n        As an example, this generates a table, which spans all columns\n        and is centered on the page::\n\n            ascii.write(data, Writer=ascii.Latex, col_align='|lr|',\n                        latexdict={'preamble': r'\\begin{center}',\n                                   'tablefoot': r'\\end{center}',\n                                   'tabletype': 'table*'})\n\n    **caption** : Set table caption\n        Shorthand for::\n\n            latexdict['caption'] = caption\n\n    **col_align** : Set the column alignment.\n        If not present this will be auto-generated for centered\n        columns. Shorthand for::\n\n            latexdict['col_align'] = col_align\n\n    '''\n    _format_name = 'latex'\n    _io_registry_format_aliases = ['latex']\n    _io_registry_suffix = '.tex'\n    _description = 'LaTeX table'\n\n    header_class = LatexHeader\n    data_class = LatexData\n    inputter_class = LatexInputter\n\n    # Strictly speaking latex only supports 1-d columns so this should inherit\n    # the base max_ndim = 1. But as reported in #11695 this causes a strange\n    # problem with Jupyter notebook, which displays a table by first calling\n    # _repr_latex_. For a multidimensional table this issues a stack traceback\n    # before moving on to _repr_html_. Here we prioritize fixing the issue with\n    # Jupyter displaying a Table with multidimensional columns.\n    max_ndim = None\n\n    def __init__(self,\n                 ignore_latex_commands=['hline', 'vspace', 'tableline',\n                                        'toprule', 'midrule', 'bottomrule'],\n                 latexdict={}, caption='', col_align=None):\n\n        super().__init__()\n\n        self.latex = {}\n        # The latex dict drives the format of the table and needs to be shared\n        # with data and header\n        self.header.latex = self.latex\n        self.data.latex = self.latex\n        self.latex['tabletype'] = 'table'\n        self.latex.update(latexdict)\n        if caption:\n            self.latex['caption'] = caption\n        if col_align:\n            self.latex['col_align'] = col_align\n\n        self.ignore_latex_commands = ignore_latex_commands\n        self.header.comment = '%|' + '|'.join(\n            [r'\\\\' + command for command in self.ignore_latex_commands])\n        self.data.comment = self.header.comment\n\n    def write(self, table=None):\n        self.header.start_line = None\n        self.data.start_line = None\n        return core.BaseReader.write(self, table=table)"},{"col":4,"comment":"null","endLoc":343,"header":"def __init__(self,\n                 ignore_latex_commands=['hline', 'vspace', 'tableline',\n                                        'toprule', 'midrule', 'bottomrule'],\n                 latexdict={}, caption='', col_align=None)","id":5109,"name":"__init__","nodeType":"Function","startLoc":321,"text":"def __init__(self,\n                 ignore_latex_commands=['hline', 'vspace', 'tableline',\n                                        'toprule', 'midrule', 'bottomrule'],\n                 latexdict={}, caption='', col_align=None):\n\n        super().__init__()\n\n        self.latex = {}\n        # The latex dict drives the format of the table and needs to be shared\n        # with data and header\n        self.header.latex = self.latex\n        self.data.latex = self.latex\n        self.latex['tabletype'] = 'table'\n        self.latex.update(latexdict)\n        if caption:\n            self.latex['caption'] = caption\n        if col_align:\n            self.latex['col_align'] = col_align\n\n        self.ignore_latex_commands = ignore_latex_commands\n        self.header.comment = '%|' + '|'.join(\n            [r'\\\\' + command for command in self.ignore_latex_commands])\n        self.data.comment = self.header.comment"},{"className":"Ecsv","col":0,"comment":"ECSV (Enhanced Character Separated Values) format table.\n\n    Th ECSV format allows for specification of key table and column meta-data, in\n    particular the data type and unit.\n\n    See: https://github.com/astropy/astropy-APEs/blob/main/APE6.rst\n\n    Examples\n    --------\n\n    >>> from astropy.table import Table\n    >>> ecsv_content = '''# %ECSV 0.9\n    ... # ---\n    ... # datatype:\n    ... # - {name: a, unit: m / s, datatype: int64, format: '%03d'}\n    ... # - {name: b, unit: km, datatype: int64, description: This is column b}\n    ... a b\n    ... 001 2\n    ... 004 3\n    ... '''\n\n    >>> Table.read(ecsv_content, format='ascii.ecsv')\n    <Table length=2>\n      a     b\n    m / s   km\n    int64 int64\n    ----- -----\n      001     2\n      004     3\n\n    ","endLoc":469,"id":5112,"nodeType":"Class","startLoc":407,"text":"class Ecsv(basic.Basic):\n    \"\"\"ECSV (Enhanced Character Separated Values) format table.\n\n    Th ECSV format allows for specification of key table and column meta-data, in\n    particular the data type and unit.\n\n    See: https://github.com/astropy/astropy-APEs/blob/main/APE6.rst\n\n    Examples\n    --------\n\n    >>> from astropy.table import Table\n    >>> ecsv_content = '''# %ECSV 0.9\n    ... # ---\n    ... # datatype:\n    ... # - {name: a, unit: m / s, datatype: int64, format: '%03d'}\n    ... # - {name: b, unit: km, datatype: int64, description: This is column b}\n    ... a b\n    ... 001 2\n    ... 004 3\n    ... '''\n\n    >>> Table.read(ecsv_content, format='ascii.ecsv')\n    <Table length=2>\n      a     b\n    m / s   km\n    int64 int64\n    ----- -----\n      001     2\n      004     3\n\n    \"\"\"\n    _format_name = 'ecsv'\n    _description = 'Enhanced CSV'\n    _io_registry_suffix = '.ecsv'\n\n    header_class = EcsvHeader\n    data_class = EcsvData\n    outputter_class = EcsvOutputter\n\n    max_ndim = None  # No limit on column dimensionality\n\n    def update_table_data(self, table):\n        \"\"\"\n        Update table columns in place if mixin columns are present.\n\n        This is a hook to allow updating the table columns after name\n        filtering but before setting up to write the data.  This is currently\n        only used by ECSV and is otherwise just a pass-through.\n\n        Parameters\n        ----------\n        table : `astropy.table.Table`\n            Input table for writing\n\n        Returns\n        -------\n        table : `astropy.table.Table`\n            Output table for writing\n        \"\"\"\n        with serialize_context_as('ecsv'):\n            out = serialize.represent_mixins_as_columns(table)\n        return out"},{"col":4,"comment":"\n        Update table columns in place if mixin columns are present.\n\n        This is a hook to allow updating the table columns after name\n        filtering but before setting up to write the data.  This is currently\n        only used by ECSV and is otherwise just a pass-through.\n\n        Parameters\n        ----------\n        table : `astropy.table.Table`\n            Input table for writing\n\n        Returns\n        -------\n        table : `astropy.table.Table`\n            Output table for writing\n        ","endLoc":469,"header":"def update_table_data(self, table)","id":5113,"name":"update_table_data","nodeType":"Function","startLoc":449,"text":"def update_table_data(self, table):\n        \"\"\"\n        Update table columns in place if mixin columns are present.\n\n        This is a hook to allow updating the table columns after name\n        filtering but before setting up to write the data.  This is currently\n        only used by ECSV and is otherwise just a pass-through.\n\n        Parameters\n        ----------\n        table : `astropy.table.Table`\n            Input table for writing\n\n        Returns\n        -------\n        table : `astropy.table.Table`\n            Output table for writing\n        \"\"\"\n        with serialize_context_as('ecsv'):\n            out = serialize.represent_mixins_as_columns(table)\n        return out"},{"attributeType":"null","col":4,"comment":"null","endLoc":439,"id":5114,"name":"_format_name","nodeType":"Attribute","startLoc":439,"text":"_format_name"},{"col":4,"comment":"null","endLoc":348,"header":"def write(self, table=None)","id":5115,"name":"write","nodeType":"Function","startLoc":345,"text":"def write(self, table=None):\n        self.header.start_line = None\n        self.data.start_line = None\n        return core.BaseReader.write(self, table=table)"},{"col":4,"comment":"null","endLoc":367,"header":"def write(self, lines)","id":5116,"name":"write","nodeType":"Function","startLoc":359,"text":"def write(self, lines):\n        lines.append(self.splitter.join(self.colnames))\n        rdb_types = []\n        for col in self.cols:\n            # Check if dtype.kind is string or unicode.  See help(np.core.numerictypes)\n            rdb_type = 'S' if col.info.dtype.kind in ('S', 'U') else 'N'\n            rdb_types.append(rdb_type)\n\n        lines.append(self.splitter.join(rdb_types))"},{"attributeType":"null","col":4,"comment":"null","endLoc":440,"id":5117,"name":"_description","nodeType":"Attribute","startLoc":440,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":304,"id":5118,"name":"_format_name","nodeType":"Attribute","startLoc":304,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":305,"id":5119,"name":"_io_registry_format_aliases","nodeType":"Attribute","startLoc":305,"text":"_io_registry_format_aliases"},{"attributeType":"null","col":4,"comment":"null","endLoc":306,"id":5120,"name":"_io_registry_suffix","nodeType":"Attribute","startLoc":306,"text":"_io_registry_suffix"},{"attributeType":"null","col":4,"comment":"null","endLoc":315,"id":5121,"name":"col_type_map","nodeType":"Attribute","startLoc":315,"text":"col_type_map"},{"attributeType":"null","col":8,"comment":"null","endLoc":344,"id":5122,"name":"names","nodeType":"Attribute","startLoc":344,"text":"self.names"},{"attributeType":"null","col":4,"comment":"null","endLoc":307,"id":5123,"name":"_description","nodeType":"Attribute","startLoc":307,"text":"_description"},{"attributeType":"LatexHeader","col":4,"comment":"null","endLoc":309,"id":5124,"name":"header_class","nodeType":"Attribute","startLoc":309,"text":"header_class"},{"attributeType":"LatexData","col":4,"comment":"null","endLoc":310,"id":5125,"name":"data_class","nodeType":"Attribute","startLoc":310,"text":"data_class"},{"className":"RdbData","col":0,"comment":"\n    Data reader for RDB data. Starts reading at line 2.\n    ","endLoc":374,"id":5126,"nodeType":"Class","startLoc":370,"text":"class RdbData(TabData):\n    \"\"\"\n    Data reader for RDB data. Starts reading at line 2.\n    \"\"\"\n    start_line = 2"},{"attributeType":"null","col":4,"comment":"null","endLoc":374,"id":5127,"name":"start_line","nodeType":"Attribute","startLoc":374,"text":"start_line"},{"attributeType":"LatexInputter","col":4,"comment":"null","endLoc":311,"id":5128,"name":"inputter_class","nodeType":"Attribute","startLoc":311,"text":"inputter_class"},{"attributeType":"None","col":4,"comment":"null","endLoc":319,"id":5129,"name":"max_ndim","nodeType":"Attribute","startLoc":319,"text":"max_ndim"},{"className":"Rdb","col":0,"comment":"Tab-separated file with an extra line after the column definition line that\n    specifies either numeric (N) or string (S) data.\n\n    See: https://www.drdobbs.com/rdb-a-unix-command-line-database/199101326\n\n    Example::\n\n      col1 <tab> col2 <tab> col3\n      N <tab> S <tab> N\n      1 <tab> 2 <tab> 5\n\n    ","endLoc":396,"id":5130,"nodeType":"Class","startLoc":377,"text":"class Rdb(Tab):\n    \"\"\"Tab-separated file with an extra line after the column definition line that\n    specifies either numeric (N) or string (S) data.\n\n    See: https://www.drdobbs.com/rdb-a-unix-command-line-database/199101326\n\n    Example::\n\n      col1 <tab> col2 <tab> col3\n      N <tab> S <tab> N\n      1 <tab> 2 <tab> 5\n\n    \"\"\"\n    _format_name = 'rdb'\n    _io_registry_format_aliases = ['rdb']\n    _io_registry_suffix = '.rdb'\n    _description = 'Tab-separated with a type definition header line'\n\n    header_class = RdbHeader\n    data_class = RdbData"},{"attributeType":"null","col":4,"comment":"null","endLoc":390,"id":5131,"name":"_format_name","nodeType":"Attribute","startLoc":390,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":391,"id":5132,"name":"_io_registry_format_aliases","nodeType":"Attribute","startLoc":391,"text":"_io_registry_format_aliases"},{"attributeType":"null","col":4,"comment":"null","endLoc":392,"id":5133,"name":"_io_registry_suffix","nodeType":"Attribute","startLoc":392,"text":"_io_registry_suffix"},{"attributeType":"null","col":4,"comment":"null","endLoc":393,"id":5134,"name":"_description","nodeType":"Attribute","startLoc":393,"text":"_description"},{"attributeType":"RdbHeader","col":4,"comment":"null","endLoc":395,"id":5135,"name":"header_class","nodeType":"Attribute","startLoc":395,"text":"header_class"},{"attributeType":"null","col":8,"comment":"null","endLoc":340,"id":5136,"name":"ignore_latex_commands","nodeType":"Attribute","startLoc":340,"text":"self.ignore_latex_commands"},{"attributeType":"RdbData","col":4,"comment":"null","endLoc":396,"id":5137,"name":"data_class","nodeType":"Attribute","startLoc":396,"text":"data_class"},{"col":0,"comment":"","endLoc":10,"header":"basic.py#<anonymous>","id":5138,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"An extensible ASCII table reader and writer.\n\nbasic.py:\n  Basic table read / write functionality for simple character\n  delimited files with various options for column header definition.\n\n:Copyright: Smithsonian Astrophysical Observatory (2011)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\""},{"col":0,"comment":"null","endLoc":188,"header":"def _get_format_class(format, ReaderWriter, label)","id":5139,"name":"_get_format_class","nodeType":"Function","startLoc":178,"text":"def _get_format_class(format, ReaderWriter, label):\n    if format is not None and ReaderWriter is not None:\n        raise ValueError(f'Cannot supply both format and {label} keywords')\n\n    if format is not None:\n        if format in core.FORMAT_CLASSES:\n            ReaderWriter = core.FORMAT_CLASSES[format]\n        else:\n            raise ValueError('ASCII format {!r} not in allowed list {}'\n                             .format(format, sorted(core.FORMAT_CLASSES)))\n    return ReaderWriter"},{"col":0,"comment":"\n    Determine if ``table`` probably contains HTML content.  See PR #3693 and issue\n    #3691 for context.\n    ","endLoc":95,"header":"def _probably_html(table, maxchars=100000)","id":5140,"name":"_probably_html","nodeType":"Function","startLoc":51,"text":"def _probably_html(table, maxchars=100000):\n    \"\"\"\n    Determine if ``table`` probably contains HTML content.  See PR #3693 and issue\n    #3691 for context.\n    \"\"\"\n    if not isinstance(table, str):\n        try:\n            # If table is an iterable (list of strings) then take the first\n            # maxchars of these.  Make sure this is something with random\n            # access to exclude a file-like object\n            table[0]\n            table[:1]\n            size = 0\n            for i, line in enumerate(table):\n                size += len(line)\n                if size > maxchars:\n                    table = table[:i + 1]\n                    break\n            table = os.linesep.join(table)\n        except Exception:\n            pass\n\n    if isinstance(table, str):\n        # Look for signs of an HTML table in the first maxchars characters\n        table = table[:maxchars]\n\n        # URL ending in .htm or .html\n        if re.match(r'( http[s]? | ftp | file ) :// .+ \\.htm[l]?$', table,\n                    re.IGNORECASE | re.VERBOSE):\n            return True\n\n        # Filename ending in .htm or .html which exists\n        if re.search(r'\\.htm[l]?$', table[-5:], re.IGNORECASE) and os.path.exists(table):\n            return True\n\n        # Table starts with HTML document type declaration\n        if re.match(r'\\s* <! \\s* DOCTYPE \\s* HTML', table, re.IGNORECASE | re.VERBOSE):\n            return True\n\n        # Look for <TABLE .. >, <TR .. >, <TD .. > tag openers.\n        if all(re.search(fr'< \\s* {element} [^>]* >', table, re.IGNORECASE | re.VERBOSE)\n               for element in ('table', 'tr', 'td')):\n            return True\n\n    return False"},{"attributeType":"null","col":4,"comment":"null","endLoc":441,"id":5141,"name":"_io_registry_suffix","nodeType":"Attribute","startLoc":441,"text":"_io_registry_suffix"},{"attributeType":"EcsvHeader","col":4,"comment":"null","endLoc":443,"id":5142,"name":"header_class","nodeType":"Attribute","startLoc":443,"text":"header_class"},{"attributeType":"EcsvData","col":4,"comment":"null","endLoc":444,"id":5143,"name":"data_class","nodeType":"Attribute","startLoc":444,"text":"data_class"},{"fileName":"mrt.py","filePath":"astropy/io/ascii","id":5144,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"Classes to read AAS MRT table format\n\nRef: https://journals.aas.org/mrt-standards\n\n:Copyright: Smithsonian Astrophysical Observatory (2021)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu), \\\n         Suyog Garg (suyog7130@gmail.com)\n\"\"\"\n\nimport re\nimport math\nimport warnings\nimport numpy as np\nfrom io import StringIO\n\nfrom . import core\nfrom . import fixedwidth, cds\n\nfrom astropy import units as u\n\nfrom astropy.table import Table\nfrom astropy.table import Column, MaskedColumn\nfrom string import Template\nfrom textwrap import wrap\n\nMAX_SIZE_README_LINE = 80\nMAX_COL_INTLIMIT = 100000\n\n\n__doctest_skip__ = ['*']\n\n\nBYTE_BY_BYTE_TEMPLATE = [\n    \"Byte-by-byte Description of file: $file\",\n    \"--------------------------------------------------------------------------------\",\n    \" Bytes Format Units  Label     Explanations\",\n    \"--------------------------------------------------------------------------------\",\n    \"$bytebybyte\",\n    \"--------------------------------------------------------------------------------\"]\n\nMRT_TEMPLATE = [\n    \"Title:\",\n    \"Authors:\",\n    \"Table:\",\n    \"================================================================================\",\n    \"$bytebybyte\",\n    \"Notes:\",\n    \"--------------------------------------------------------------------------------\"]\n\n\nclass MrtSplitter(fixedwidth.FixedWidthSplitter):\n    \"\"\"\n    Contains the join function to left align the MRT columns\n    when writing to a file.\n    \"\"\"\n    def join(self, vals, widths):\n        vals = [val + ' ' * (width - len(val)) for val, width in zip(vals, widths)]\n        return self.delimiter.join(vals)\n\n\nclass MrtHeader(cds.CdsHeader):\n    _subfmt = 'MRT'\n\n    def _split_float_format(self, value):\n        \"\"\"\n        Splits a Float string into different parts to find number\n        of digits after decimal and check if the value is in Scientific\n        notation.\n\n        Parameters\n        ----------\n        value : str\n            String containing the float value to split.\n\n        Returns\n        -------\n        fmt: (int, int, int, bool, bool)\n            List of values describing the Float sting.\n            (size, dec, ent, sign, exp)\n            size, length of the given string.\n            ent, number of digits before decimal point.\n            dec, number of digits after decimal point.\n            sign, whether or not given value signed.\n            exp, is value in Scientific notation?\n        \"\"\"\n        regfloat = re.compile(r\"\"\"(?P<sign> [+-]*)\n                                  (?P<ent> [^eE.]+)\n                                  (?P<deciPt> [.]*)\n                                  (?P<decimals> [0-9]*)\n                                  (?P<exp> [eE]*-*)[0-9]*\"\"\",\n                              re.VERBOSE)\n        mo = regfloat.match(value)\n\n        if mo is None:\n            raise Exception(f'{value} is not a float number')\n        return (len(value),\n                len(mo.group('ent')),\n                len(mo.group('decimals')),\n                mo.group('sign') != \"\",\n                mo.group('exp') != \"\")\n\n    def _set_column_val_limits(self, col):\n        \"\"\"\n        Sets the ``col.min`` and ``col.max`` column attributes,\n        taking into account columns with Null values.\n        \"\"\"\n        col.max = max(col)\n        col.min = min(col)\n        if col.max is np.ma.core.MaskedConstant:\n            col.max = None\n        if col.min is np.ma.core.MaskedConstant:\n            col.min = None\n\n    def column_float_formatter(self, col):\n        \"\"\"\n        String formatter function for a column containing Float values.\n        Checks if the values in the given column are in Scientific notation,\n        by spliting the value string. It is assumed that the column either has\n        float values or Scientific notation.\n\n        A ``col.formatted_width`` attribute is added to the column. It is not added\n        if such an attribute is already present, say when the ``formats`` argument\n        is passed to the writer. A properly formatted format string is also added as\n        the ``col.format`` attribute.\n\n        Parameters\n        ----------\n        col : A ``Table.Column`` object.\n        \"\"\"\n        # maxsize: maximum length of string containing the float value.\n        # maxent: maximum number of digits places before decimal point.\n        # maxdec: maximum number of digits places after decimal point.\n        # maxprec: maximum precision of the column values, sum of maxent and maxdec.\n        maxsize, maxprec, maxent, maxdec = 1, 0, 1, 0\n        sign = False\n        fformat = 'F'\n\n        # Find maximum sized value in the col\n        for val in col.str_vals:\n            # Skip null values\n            if val is None or val == '':\n                continue\n\n            # Find format of the Float string\n            fmt = self._split_float_format(val)\n            # If value is in Scientific notation\n            if fmt[4] is True:\n                # if the previous column value was in normal Float format\n                # set maxsize, maxprec and maxdec to default.\n                if fformat == 'F':\n                    maxsize, maxprec, maxdec = 1, 0, 0\n                # Designate the column to be in Scientific notation.\n                fformat = 'E'\n            else:\n                # Move to next column value if\n                # current value is not in Scientific notation\n                # but the column is designated as such because\n                # one of the previous values was.\n                if fformat == 'E':\n                    continue\n\n            if maxsize < fmt[0]:\n                maxsize = fmt[0]\n            if maxent < fmt[1]:\n                maxent = fmt[1]\n            if maxdec < fmt[2]:\n                maxdec = fmt[2]\n            if fmt[3]:\n                sign = True\n\n            if maxprec < fmt[1] + fmt[2]:\n                maxprec = fmt[1] + fmt[2]\n\n        if fformat == 'E':\n            if getattr(col, 'formatted_width', None) is None:  # If ``formats`` not passed.\n                col.formatted_width = maxsize\n                if sign:\n                    col.formatted_width += 1\n            # Number of digits after decimal is replaced by the precision\n            # for values in Scientific notation, when writing that Format.\n            col.fortran_format = fformat + str(col.formatted_width) + \".\" + str(maxprec)\n            col.format = str(col.formatted_width) + \".\" + str(maxdec) + \"e\"\n        else:\n            lead = ''\n            if getattr(col, 'formatted_width', None) is None:  # If ``formats`` not passed.\n                col.formatted_width = maxent + maxdec + 1\n                if sign:\n                    col.formatted_width += 1\n            elif col.format.startswith('0'):\n                # Keep leading zero, if already set in format - primarily for `seconds` columns\n                # in coordinates; may need extra case if this is to be also supported with `sign`.\n                lead = '0'\n            col.fortran_format = fformat + str(col.formatted_width) + \".\" + str(maxdec)\n            col.format = lead + col.fortran_format[1:] + \"f\"\n\n    def write_byte_by_byte(self):\n        \"\"\"\n        Writes the Byte-By-Byte description of the table.\n\n        Columns that are `astropy.coordinates.SkyCoord` or `astropy.time.TimeSeries`\n        objects or columns with values that are such objects are recognized as such,\n        and some predefined labels and description is used for them.\n        See the Vizier MRT Standard documentation in the link below for more details\n        on these. An example Byte-By-Byte table is shown here.\n\n        See: http://vizier.u-strasbg.fr/doc/catstd-3.1.htx\n\n        Example::\n\n        --------------------------------------------------------------------------------\n        Byte-by-byte Description of file: table.dat\n        --------------------------------------------------------------------------------\n        Bytes Format Units  Label     Explanations\n        --------------------------------------------------------------------------------\n         1- 8  A8     ---    names   Description of names\n        10-14  E5.1   ---    e       [-3160000.0/0.01] Description of e\n        16-23  F8.5   ---    d       [22.25/27.25] Description of d\n        25-31  E7.1   ---    s       [-9e+34/2.0] Description of s\n        33-35  I3     ---    i       [-30/67] Description of i\n        37-39  F3.1   ---    sameF   [5.0/5.0] Description of sameF\n        41-42  I2     ---    sameI   [20] Description of sameI\n        44-45  I2     h      RAh     Right Ascension (hour)\n        47-48  I2     min    RAm     Right Ascension (minute)\n        50-67  F18.15 s      RAs     Right Ascension (second)\n           69  A1     ---    DE-     Sign of Declination\n        70-71  I2     deg    DEd     Declination (degree)\n        73-74  I2     arcmin DEm     Declination (arcmin)\n        76-91  F16.13 arcsec DEs     Declination (arcsec)\n\n        --------------------------------------------------------------------------------\n        \"\"\"\n        # Get column widths\n        vals_list = []\n        col_str_iters = self.data.str_vals()\n        for vals in zip(*col_str_iters):\n            vals_list.append(vals)\n\n        for i, col in enumerate(self.cols):\n            col.width = max([len(vals[i]) for vals in vals_list])\n            if self.start_line is not None:\n                col.width = max(col.width, len(col.info.name))\n        widths = [col.width for col in self.cols]\n\n        startb = 1  # Byte count starts at 1.\n\n        # Set default width of the Bytes count column of the Byte-By-Byte table.\n        # This ``byte_count_width`` value helps align byte counts with respect\n        # to the hyphen using a format string.\n        byte_count_width = len(str(sum(widths) + len(self.cols) - 1))\n\n        # Format string for Start Byte and End Byte\n        singlebfmt = \"{:\" + str(byte_count_width) + \"d}\"\n        fmtb = singlebfmt + \"-\" + singlebfmt\n        # Add trailing single whitespaces to Bytes column for better visibility.\n        singlebfmt += \" \"\n        fmtb += \" \"\n\n        # Set default width of Label and Description Byte-By-Byte columns.\n        max_label_width, max_descrip_size = 7, 16\n\n        bbb = Table(names=['Bytes', 'Format', 'Units', 'Label', 'Explanations'],\n                    dtype=[str] * 5)\n\n        # Iterate over the columns to write Byte-By-Byte rows.\n        for i, col in enumerate(self.cols):\n            # Check if column is MaskedColumn\n            col.has_null = isinstance(col, MaskedColumn)\n\n            if col.format is not None:\n                col.formatted_width = max([len(sval) for sval in col.str_vals])\n\n            # Set MRTColumn type, size and format.\n            if np.issubdtype(col.dtype, np.integer):\n                # Integer formatter\n                self._set_column_val_limits(col)\n                if getattr(col, 'formatted_width', None) is None:  # If ``formats`` not passed.\n                    col.formatted_width = max(len(str(col.max)), len(str(col.min)))\n                col.fortran_format = \"I\" + str(col.formatted_width)\n                if col.format is None:\n                    col.format = \">\" + col.fortran_format[1:]\n\n            elif np.issubdtype(col.dtype, np.dtype(float).type):\n                # Float formatter\n                self._set_column_val_limits(col)\n                self.column_float_formatter(col)\n\n            else:\n                # String formatter, ``np.issubdtype(col.dtype, str)`` is ``True``.\n                dtype = col.dtype.str\n                if col.has_null:\n                    mcol = col\n                    mcol.fill_value = \"\"\n                    coltmp = Column(mcol.filled(), dtype=str)\n                    dtype = coltmp.dtype.str\n                if getattr(col, 'formatted_width', None) is None:  # If ``formats`` not passed.\n                    col.formatted_width = int(re.search(r'(\\d+)$', dtype).group(1))\n                col.fortran_format = \"A\" + str(col.formatted_width)\n                col.format = str(col.formatted_width) + \"s\"\n\n            endb = col.formatted_width + startb - 1\n\n            # ``mixin`` columns converted to string valued columns will not have a name\n            # attribute. In those cases, a ``Unknown`` column label is put, indicating that\n            # such columns can be better formatted with some manipulation before calling\n            # the MRT writer.\n            if col.name is None:\n                col.name = \"Unknown\"\n\n            # Set column description.\n            if col.description is not None:\n                description = col.description\n            else:\n                description = \"Description of \" + col.name\n\n            # Set null flag in column description\n            nullflag = \"\"\n            if col.has_null:\n                nullflag = \"?\"\n\n            # Set column unit\n            if col.unit is not None:\n                col_unit = col.unit.to_string(\"cds\")\n            elif col.name.lower().find(\"magnitude\") > -1:\n                # ``col.unit`` can still be ``None``, if the unit of column values\n                # is ``Magnitude``, because ``astropy.units.Magnitude`` is actually a class.\n                # Unlike other units which are instances of ``astropy.units.Unit``,\n                # application of the ``Magnitude`` unit calculates the logarithm\n                # of the values. Thus, the only way to check for if the column values\n                # have ``Magnitude`` unit is to check the column name.\n                col_unit = \"mag\"\n            else:\n                col_unit = \"---\"\n\n            # Add col limit values to col description\n            lim_vals = \"\"\n            if (col.min and col.max and\n                    not any(x in col.name for x in ['RA', 'DE', 'LON', 'LAT', 'PLN', 'PLT'])):\n                # No col limit values for coordinate columns.\n                if col.fortran_format[0] == 'I':\n                    if abs(col.min) < MAX_COL_INTLIMIT and abs(col.max) < MAX_COL_INTLIMIT:\n                        if col.min == col.max:\n                            lim_vals = \"[{0}]\".format(col.min)\n                        else:\n                            lim_vals = \"[{0}/{1}]\".format(col.min, col.max)\n                elif col.fortran_format[0] in ('E', 'F'):\n                    lim_vals = \"[{0}/{1}]\".format(math.floor(col.min * 100) / 100.,\n                                                  math.ceil(col.max * 100) / 100.)\n\n            if lim_vals != '' or nullflag != '':\n                description = \"{0}{1} {2}\".format(lim_vals, nullflag, description)\n\n            # Find the maximum label and description column widths.\n            if len(col.name) > max_label_width:\n                max_label_width = len(col.name)\n            if len(description) > max_descrip_size:\n                max_descrip_size = len(description)\n\n            # Add a row for the Sign of Declination in the bbb table\n            if col.name == 'DEd':\n                bbb.add_row([singlebfmt.format(startb),\n                             \"A1\", \"---\", \"DE-\",\n                             \"Sign of Declination\"])\n                col.fortran_format = 'I2'\n                startb += 1\n\n            # Add Byte-By-Byte row to bbb table\n            bbb.add_row([singlebfmt.format(startb) if startb == endb\n                         else fmtb.format(startb, endb),\n                         \"\" if col.fortran_format is None else col.fortran_format,\n                         col_unit,\n                         \"\" if col.name is None else col.name,\n                         description])\n            startb = endb + 2\n\n        # Properly format bbb columns\n        bbblines = StringIO()\n        bbb.write(bbblines, format='ascii.fixed_width_no_header',\n                  delimiter=' ', bookend=False, delimiter_pad=None,\n                  formats={'Format': '<6s',\n                           'Units': '<6s',\n                           'Label': '<' + str(max_label_width) + 's',\n                           'Explanations': '' + str(max_descrip_size) + 's'})\n\n        # Get formatted bbb lines\n        bbblines = bbblines.getvalue().splitlines()\n\n        # ``nsplit`` is the number of whitespaces to prefix to long description\n        # lines in order to wrap them. It is the sum of the widths of the\n        # previous 4 columns plus the number of single spacing between them.\n        # The hyphen in the Bytes column is also counted.\n        nsplit = byte_count_width * 2 + 1 + 12 + max_label_width + 4\n\n        # Wrap line if it is too long\n        buff = \"\"\n        for newline in bbblines:\n            if len(newline) > MAX_SIZE_README_LINE:\n                buff += (\"\\n\").join(wrap(newline,\n                                         subsequent_indent=\" \" * nsplit,\n                                         width=MAX_SIZE_README_LINE))\n                buff += \"\\n\"\n            else:\n                buff += newline + \"\\n\"\n\n        # Last value of ``endb`` is the sum of column widths after formatting.\n        self.linewidth = endb\n\n        # Remove the last extra newline character from Byte-By-Byte.\n        buff = buff[:-1]\n        return buff\n\n    def write(self, lines):\n        \"\"\"\n        Writes the Header of the MRT table, aka ReadMe, which\n        also contains the Byte-By-Byte description of the table.\n        \"\"\"\n        from astropy.coordinates import SkyCoord\n\n        # Recognised ``SkyCoord.name`` forms with their default column names (helio* require SunPy).\n        coord_systems = {'galactic': ('GLAT', 'GLON', 'b', 'l'),\n                         'ecliptic': ('ELAT', 'ELON', 'lat', 'lon'),      # 'geocentric*ecliptic'\n                         'heliographic': ('HLAT', 'HLON', 'lat', 'lon'),  # '_carrington|stonyhurst'\n                         'helioprojective': ('HPLT', 'HPLN', 'Ty', 'Tx')}\n        eqtnames = ['RAh', 'RAm', 'RAs', 'DEd', 'DEm', 'DEs']\n\n        # list to store indices of columns that are modified.\n        to_pop = []\n\n        # For columns that are instances of ``SkyCoord`` and other ``mixin`` columns\n        # or whose values are objects of these classes.\n        for i, col in enumerate(self.cols):\n            # If col is a ``Column`` object but its values are ``SkyCoord`` objects,\n            # convert the whole column to ``SkyCoord`` object, which helps in applying\n            # SkyCoord methods directly.\n            if not isinstance(col, SkyCoord) and isinstance(col[0], SkyCoord):\n                try:\n                    col = SkyCoord(col)\n                except (ValueError, TypeError):\n                    # If only the first value of the column is a ``SkyCoord`` object,\n                    # the column cannot be converted to a ``SkyCoord`` object.\n                    # These columns are converted to ``Column`` object and then converted\n                    # to string valued column.\n                    if not isinstance(col, Column):\n                        col = Column(col)\n                    col = Column([str(val) for val in col])\n                    self.cols[i] = col\n                    continue\n\n            # Replace single ``SkyCoord`` column by its coordinate components if no coordinate\n            # columns of the correspoding type exist yet.\n            if isinstance(col, SkyCoord):\n                # If coordinates are given in RA/DEC, divide each them into hour/deg,\n                # minute/arcminute, second/arcsecond columns.\n                if ('ra' in col.representation_component_names.keys() and\n                        len(set(eqtnames) - set(self.colnames)) == 6):\n                    ra_c, dec_c = col.ra.hms, col.dec.dms\n                    coords = [ra_c.h.round().astype('i1'), ra_c.m.round().astype('i1'), ra_c.s,\n                              dec_c.d.round().astype('i1'), dec_c.m.round().astype('i1'), dec_c.s]\n                    coord_units = [u.h, u.min, u.second,\n                                   u.deg, u.arcmin, u.arcsec]\n                    coord_descrip = ['Right Ascension (hour)', 'Right Ascension (minute)',\n                                     'Right Ascension (second)', 'Declination (degree)',\n                                     'Declination (arcmin)', 'Declination (arcsec)']\n                    for coord, name, coord_unit, descrip in zip(\n                            coords, eqtnames, coord_units, coord_descrip):\n                        # Have Sign of Declination only in the DEd column.\n                        if name in ['DEm', 'DEs']:\n                            coord_col = Column(list(np.abs(coord)), name=name,\n                                               unit=coord_unit, description=descrip)\n                        else:\n                            coord_col = Column(list(coord), name=name, unit=coord_unit,\n                                               description=descrip)\n                        # Set default number of digits after decimal point for the\n                        # second values, and deg-min to (signed) 2-digit zero-padded integer.\n                        if name == 'RAs':\n                            coord_col.format = '013.10f'\n                        elif name == 'DEs':\n                            coord_col.format = '012.9f'\n                        elif name == 'RAh':\n                            coord_col.format = '2d'\n                        elif name == 'DEd':\n                            coord_col.format = '+03d'\n                        elif name.startswith(('RA', 'DE')):\n                            coord_col.format = '02d'\n                        self.cols.append(coord_col)\n                    to_pop.append(i)   # Delete original ``SkyCoord`` column.\n\n                # For all other coordinate types, simply divide into two columns\n                # for latitude and longitude resp. with the unit used been as it is.\n\n                else:\n                    frminfo = ''\n                    for frame, latlon in coord_systems.items():\n                        if frame in col.name and len(set(latlon[:2]) - set(self.colnames)) == 2:\n                            if frame != col.name:\n                                frminfo = f' ({col.name})'\n                            lon_col = Column(getattr(col, latlon[3]), name=latlon[1],\n                                             description=f'{frame.capitalize()} Longitude{frminfo}',\n                                             unit=col.representation_component_units[latlon[3]],\n                                             format='.12f')\n                            lat_col = Column(getattr(col, latlon[2]), name=latlon[0],\n                                             description=f'{frame.capitalize()} Latitude{frminfo}',\n                                             unit=col.representation_component_units[latlon[2]],\n                                             format='+.12f')\n                            self.cols.append(lon_col)\n                            self.cols.append(lat_col)\n                            to_pop.append(i)   # Delete original ``SkyCoord`` column.\n\n                # Convert all other ``SkyCoord`` columns that are not in the above three\n                # representations to string valued columns. Those could either be types not\n                # supported yet (e.g. 'helioprojective'), or already present and converted.\n                # If there were any extra ``SkyCoord`` columns of one kind after the first one,\n                # then their decomposition into their component columns has been skipped.\n                # This is done in order to not create duplicate component columns.\n                # Explicit renaming of the extra coordinate component columns by appending some\n                # suffix to their name, so as to distinguish them, is not yet implemented.\n                if i not in to_pop:\n                    warnings.warn(f\"Coordinate system of type '{col.name}' already stored in table \"\n                                  f\"as CDS/MRT-syle columns or of unrecognized type. So column {i} \"\n                                  f\"is being skipped with designation of a string valued column \"\n                                  f\"`{self.colnames[i]}`.\", UserWarning)\n                    self.cols.append(Column(col.to_string(), name=self.colnames[i]))\n                    to_pop.append(i)   # Delete original ``SkyCoord`` column.\n\n            # Convert all other ``mixin`` columns to ``Column`` objects.\n            # Parsing these may still lead to errors!\n            elif not isinstance(col, Column):\n                col = Column(col)\n                # If column values are ``object`` types, convert them to string.\n                if np.issubdtype(col.dtype, np.dtype(object).type):\n                    col = Column([str(val) for val in col])\n                self.cols[i] = col\n\n        # Delete original ``SkyCoord`` columns, if there were any.\n        for i in to_pop[::-1]:\n            self.cols.pop(i)\n\n        # Check for any left over extra coordinate columns.\n        if any(x in self.colnames for x in ['RAh', 'DEd', 'ELON', 'GLAT']):\n            # At this point any extra ``SkyCoord`` columns should have been converted to string\n            # valued columns, together with issuance of a warning, by the coordinate parser above.\n            # This test is just left here as a safeguard.\n            for i, col in enumerate(self.cols):\n                if isinstance(col, SkyCoord):\n                    self.cols[i] = Column(col.to_string(), name=self.colnames[i])\n                    message = ('Table already has coordinate system in CDS/MRT-syle columns. '\n                               f'So column {i} should have been replaced already with '\n                               f'a string valued column `{self.colnames[i]}`.')\n                    raise core.InconsistentTableError(message)\n\n        # Get Byte-By-Byte description and fill the template\n        bbb_template = Template('\\n'.join(BYTE_BY_BYTE_TEMPLATE))\n        byte_by_byte = bbb_template.substitute({'file': 'table.dat',\n                                                'bytebybyte': self.write_byte_by_byte()})\n\n        # Fill up the full ReadMe\n        rm_template = Template('\\n'.join(MRT_TEMPLATE))\n        readme_filled = rm_template.substitute({'bytebybyte': byte_by_byte})\n        lines.append(readme_filled)\n\n\nclass MrtData(cds.CdsData):\n    \"\"\"MRT table data reader\n    \"\"\"\n    _subfmt = 'MRT'\n    splitter_class = MrtSplitter\n\n    def write(self, lines):\n        self.splitter.delimiter = ' '\n        fixedwidth.FixedWidthData.write(self, lines)\n\n\nclass Mrt(core.BaseReader):\n    \"\"\"AAS MRT (Machine-Readable Table) format table.\n\n    **Reading**\n    ::\n\n      >>> from astropy.io import ascii\n      >>> table = ascii.read('data.mrt', format='mrt')\n\n    **Writing**\n\n    Use ``ascii.write(table, 'data.mrt', format='mrt')`` to  write tables to\n    Machine Readable Table (MRT) format.\n\n    Note that the metadata of the table, apart from units, column names and\n    description, will not be written. These have to be filled in by hand later.\n\n    See also: :ref:`cds_mrt_format`.\n\n    Caveats:\n\n    * The Units and Explanations are available in the column ``unit`` and\n      ``description`` attributes, respectively.\n    * The other metadata defined by this format is not available in the output table.\n    \"\"\"\n    _format_name = 'mrt'\n    _io_registry_format_aliases = ['mrt']\n    _io_registry_can_write = True\n    _description = 'MRT format table'\n\n    data_class = MrtData\n    header_class = MrtHeader\n\n    def write(self, table=None):\n        # Construct for writing empty table is not yet done.\n        if len(table) == 0:\n            raise NotImplementedError\n\n        self.data.header = self.header\n        self.header.position_line = None\n        self.header.start_line = None\n\n        # Create a copy of the ``table``, so that it the copy gets modified and\n        # written to the file, while the original table remains as it is.\n        table = table.copy()\n        return super().write(table)\n"},{"attributeType":"EcsvOutputter","col":4,"comment":"null","endLoc":445,"id":5145,"name":"outputter_class","nodeType":"Attribute","startLoc":445,"text":"outputter_class"},{"attributeType":"None","col":4,"comment":"null","endLoc":447,"id":5146,"name":"max_ndim","nodeType":"Attribute","startLoc":447,"text":"max_ndim"},{"col":4,"comment":"\n        Return an iterator of the values with replacements based on fill_values\n        ","endLoc":477,"header":"def fill_values(self, col, col_str_iters)","id":5147,"name":"fill_values","nodeType":"Function","startLoc":458,"text":"def fill_values(self, col, col_str_iters):\n        \"\"\"\n        Return an iterator of the values with replacements based on fill_values\n        \"\"\"\n        # check if the col is a masked column and has fill values\n        is_masked_column = hasattr(col, 'mask')\n        has_fill_values = hasattr(col, 'fill_values')\n\n        for idx, col_str in enumerate(col_str_iters):\n            if is_masked_column and has_fill_values:\n                if col.mask[idx]:\n                    yield col.fill_values[core.masked]\n                    continue\n\n            if has_fill_values:\n                if col_str in col.fill_values:\n                    yield col.fill_values[col_str]\n                    continue\n\n            yield col_str"},{"attributeType":"null","col":16,"comment":"null","endLoc":12,"id":5148,"name":"np","nodeType":"Attribute","startLoc":12,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":5149,"name":"ECSV_VERSION","nodeType":"Attribute","startLoc":20,"text":"ECSV_VERSION"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":5150,"name":"DELIMITERS","nodeType":"Attribute","startLoc":21,"text":"DELIMITERS"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":5151,"name":"ECSV_DATATYPES","nodeType":"Attribute","startLoc":22,"text":"ECSV_DATATYPES"},{"col":0,"comment":"","endLoc":5,"header":"ecsv.py#<anonymous>","id":5152,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nDefine the Enhanced Character-Separated-Values (ECSV) which allows for reading and\nwriting all the meta data associated with an astropy Table object.\n\"\"\"\n\nECSV_VERSION = '1.0'\n\nDELIMITERS = (' ', ',')\n\nECSV_DATATYPES = (\n    'bool', 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16',\n    'uint32', 'uint64', 'float16', 'float32', 'float64',\n    'float128', 'string')"},{"fileName":"setup_package.py","filePath":"astropy/io/ascii","id":5153,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license\n\nimport os\nfrom setuptools import Extension\n\nimport numpy\n\nROOT = os.path.relpath(os.path.dirname(__file__))\n\n\ndef get_extensions():\n    sources = [os.path.join(ROOT, 'cparser.pyx'),\n               os.path.join(ROOT, 'src', 'tokenizer.c')]\n    ascii_ext = Extension(\n        name=\"astropy.io.ascii.cparser\",\n        include_dirs=[numpy.get_include()],\n        sources=sources)\n    return [ascii_ext]\n"},{"col":0,"comment":"null","endLoc":18,"header":"def get_extensions()","id":5154,"name":"get_extensions","nodeType":"Function","startLoc":11,"text":"def get_extensions():\n    sources = [os.path.join(ROOT, 'cparser.pyx'),\n               os.path.join(ROOT, 'src', 'tokenizer.c')]\n    ascii_ext = Extension(\n        name=\"astropy.io.ascii.cparser\",\n        include_dirs=[numpy.get_include()],\n        sources=sources)\n    return [ascii_ext]"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":5155,"name":"ROOT","nodeType":"Attribute","startLoc":8,"text":"ROOT"},{"col":0,"comment":"\n    Try to read the table using various sets of keyword args.  Start with the\n    standard guess list and filter to make it unique and consistent with\n    user-supplied read keyword args.  Finally, if none of those work then\n    try the original user-supplied keyword args.\n\n    Parameters\n    ----------\n    table : str, file-like, list\n        Input table as a file name, file-like object, list of strings, or\n        single newline-separated string.\n    read_kwargs : dict\n        Keyword arguments from user to be supplied to reader\n    format : str\n        Table format\n    fast_reader : dict\n        Options for the C engine fast reader.  See read() function for details.\n\n    Returns\n    -------\n    dat : `~astropy.table.Table` or None\n        Output table or None if only one guess format was available\n    ","endLoc":553,"header":"def _guess(table, read_kwargs, format, fast_reader)","id":5156,"name":"_guess","nodeType":"Function","startLoc":394,"text":"def _guess(table, read_kwargs, format, fast_reader):\n    \"\"\"\n    Try to read the table using various sets of keyword args.  Start with the\n    standard guess list and filter to make it unique and consistent with\n    user-supplied read keyword args.  Finally, if none of those work then\n    try the original user-supplied keyword args.\n\n    Parameters\n    ----------\n    table : str, file-like, list\n        Input table as a file name, file-like object, list of strings, or\n        single newline-separated string.\n    read_kwargs : dict\n        Keyword arguments from user to be supplied to reader\n    format : str\n        Table format\n    fast_reader : dict\n        Options for the C engine fast reader.  See read() function for details.\n\n    Returns\n    -------\n    dat : `~astropy.table.Table` or None\n        Output table or None if only one guess format was available\n    \"\"\"\n\n    # Keep a trace of all failed guesses kwarg\n    failed_kwargs = []\n\n    # Get an ordered list of read() keyword arg dicts that will be cycled\n    # through in order to guess the format.\n    full_list_guess = _get_guess_kwargs_list(read_kwargs)\n\n    # If a fast version of the reader is available, try that before the slow version\n    if (fast_reader['enable'] and format is not None and f'fast_{format}' in\n            core.FAST_CLASSES):\n        fast_kwargs = copy.deepcopy(read_kwargs)\n        fast_kwargs['Reader'] = core.FAST_CLASSES[f'fast_{format}']\n        full_list_guess = [fast_kwargs] + full_list_guess\n    else:\n        fast_kwargs = None\n\n    # Filter the full guess list so that each entry is consistent with user kwarg inputs.\n    # This also removes any duplicates from the list.\n    filtered_guess_kwargs = []\n    fast_reader = read_kwargs.get('fast_reader')\n\n    for guess_kwargs in full_list_guess:\n        # If user specified slow reader then skip all fast readers\n        if (fast_reader['enable'] is False\n                and guess_kwargs['Reader'] in core.FAST_CLASSES.values()):\n            _read_trace.append({'kwargs': copy.deepcopy(guess_kwargs),\n                                'Reader': guess_kwargs['Reader'].__class__,\n                                'status': 'Disabled: reader only available in fast version',\n                                'dt': f'{0.0:.3f} ms'})\n            continue\n\n        # If user required a fast reader then skip all non-fast readers\n        if (fast_reader['enable'] == 'force'\n                and guess_kwargs['Reader'] not in core.FAST_CLASSES.values()):\n            _read_trace.append({'kwargs': copy.deepcopy(guess_kwargs),\n                                'Reader': guess_kwargs['Reader'].__class__,\n                                'status': 'Disabled: no fast version of reader available',\n                                'dt': f'{0.0:.3f} ms'})\n            continue\n\n        guess_kwargs_ok = True  # guess_kwargs are consistent with user_kwargs?\n        for key, val in read_kwargs.items():\n            # Do guess_kwargs.update(read_kwargs) except that if guess_args has\n            # a conflicting key/val pair then skip this guess entirely.\n            if key not in guess_kwargs:\n                guess_kwargs[key] = copy.deepcopy(val)\n            elif val != guess_kwargs[key] and guess_kwargs != fast_kwargs:\n                guess_kwargs_ok = False\n                break\n\n        if not guess_kwargs_ok:\n            # User-supplied kwarg is inconsistent with the guess-supplied kwarg, e.g.\n            # user supplies delimiter=\"|\" but the guess wants to try delimiter=\" \",\n            # so skip the guess entirely.\n            continue\n\n        # Add the guess_kwargs to filtered list only if it is not already there.\n        if guess_kwargs not in filtered_guess_kwargs:\n            filtered_guess_kwargs.append(guess_kwargs)\n\n    # If there are not at least two formats to guess then return no table\n    # (None) to indicate that guessing did not occur.  In that case the\n    # non-guess read() will occur and any problems will result in a more useful\n    # traceback.\n    if len(filtered_guess_kwargs) <= 1:\n        return None\n\n    # Define whitelist of exceptions that are expected from readers when\n    # processing invalid inputs.  Note that OSError must fall through here\n    # so one cannot simply catch any exception.\n    guess_exception_classes = (core.InconsistentTableError, ValueError, TypeError,\n                               AttributeError, core.OptionalTableImportError,\n                               core.ParameterError, cparser.CParserError)\n\n    # Now cycle through each possible reader and associated keyword arguments.\n    # Try to read the table using those args, and if an exception occurs then\n    # keep track of the failed guess and move on.\n    for guess_kwargs in filtered_guess_kwargs:\n        t0 = time.time()\n        try:\n            # If guessing will try all Readers then use strict req'ts on column names\n            if 'Reader' not in read_kwargs:\n                guess_kwargs['strict_names'] = True\n\n            reader = get_reader(**guess_kwargs)\n\n            reader.guessing = True\n            dat = reader.read(table)\n            _read_trace.append({'kwargs': copy.deepcopy(guess_kwargs),\n                                'Reader': reader.__class__,\n                                'status': 'Success (guessing)',\n                                'dt': f'{(time.time() - t0) * 1000:.3f} ms'})\n            return dat\n\n        except guess_exception_classes as err:\n            _read_trace.append({'kwargs': copy.deepcopy(guess_kwargs),\n                                'status': f'{err.__class__.__name__}: {str(err)}',\n                                'dt': f'{(time.time() - t0) * 1000:.3f} ms'})\n            failed_kwargs.append(guess_kwargs)\n    else:\n        # Failed all guesses, try the original read_kwargs without column requirements\n        try:\n            reader = get_reader(**read_kwargs)\n            dat = reader.read(table)\n            _read_trace.append({'kwargs': copy.deepcopy(read_kwargs),\n                                'Reader': reader.__class__,\n                                'status': 'Success with original kwargs without strict_names '\n                                          '(guessing)'})\n            return dat\n\n        except guess_exception_classes as err:\n            _read_trace.append({'kwargs': copy.deepcopy(read_kwargs),\n                                'status': f'{err.__class__.__name__}: {str(err)}'})\n            failed_kwargs.append(read_kwargs)\n            lines = ['\\nERROR: Unable to guess table format with the guesses listed below:']\n            for kwargs in failed_kwargs:\n                sorted_keys = sorted([x for x in sorted(kwargs)\n                                      if x not in ('Reader', 'Outputter')])\n                reader_repr = repr(kwargs.get('Reader', basic.Basic))\n                keys_vals = ['Reader:' + re.search(r\"\\.(\\w+)'>\", reader_repr).group(1)]\n                kwargs_sorted = ((key, kwargs[key]) for key in sorted_keys)\n                keys_vals.extend([f'{key}: {val!r}' for key, val in kwargs_sorted])\n                lines.append(' '.join(keys_vals))\n\n            msg = ['',\n                   '************************************************************************',\n                   '** ERROR: Unable to guess table format with the guesses listed above. **',\n                   '**                                                                    **',\n                   '** To figure out why the table did not read, use guess=False and      **',\n                   '** fast_reader=False, along with any appropriate arguments to read(). **',\n                   '** In particular specify the format and any known attributes like the **',\n                   '** delimiter.                                                         **',\n                   '************************************************************************']\n            lines.extend(msg)\n            raise core.InconsistentTableError('\\n'.join(lines))"},{"col":0,"comment":"\n    Get the full list of reader keyword argument dicts that are the basis\n    for the format guessing process.  The returned full list will then be:\n\n    - Filtered to be consistent with user-supplied kwargs\n    - Cleaned to have only unique entries\n    - Used one by one to try reading the input table\n\n    Note that the order of the guess list has been tuned over years of usage.\n    Maintainers need to be very careful about any adjustments as the\n    reasoning may not be immediately evident in all cases.\n\n    This list can (and usually does) include duplicates.  This is a result\n    of the order tuning, but these duplicates get removed later.\n\n    Parameters\n    ----------\n    read_kwargs : dict\n        User-supplied read keyword args\n\n    Returns\n    -------\n    guess_kwargs_list : list\n        List of read format keyword arg dicts\n    ","endLoc":615,"header":"def _get_guess_kwargs_list(read_kwargs)","id":5157,"name":"_get_guess_kwargs_list","nodeType":"Function","startLoc":556,"text":"def _get_guess_kwargs_list(read_kwargs):\n    \"\"\"\n    Get the full list of reader keyword argument dicts that are the basis\n    for the format guessing process.  The returned full list will then be:\n\n    - Filtered to be consistent with user-supplied kwargs\n    - Cleaned to have only unique entries\n    - Used one by one to try reading the input table\n\n    Note that the order of the guess list has been tuned over years of usage.\n    Maintainers need to be very careful about any adjustments as the\n    reasoning may not be immediately evident in all cases.\n\n    This list can (and usually does) include duplicates.  This is a result\n    of the order tuning, but these duplicates get removed later.\n\n    Parameters\n    ----------\n    read_kwargs : dict\n        User-supplied read keyword args\n\n    Returns\n    -------\n    guess_kwargs_list : list\n        List of read format keyword arg dicts\n    \"\"\"\n    guess_kwargs_list = []\n\n    # If the table is probably HTML based on some heuristics then start with the\n    # HTML reader.\n    if read_kwargs.pop('guess_html', None):\n        guess_kwargs_list.append(dict(Reader=html.HTML))\n\n    # Start with ECSV because an ECSV file will be read by Basic.  This format\n    # has very specific header requirements and fails out quickly.\n    guess_kwargs_list.append(dict(Reader=ecsv.Ecsv))\n\n    # Now try readers that accept the user-supplied keyword arguments\n    # (actually include all here - check for compatibility of arguments later).\n    # FixedWidthTwoLine would also be read by Basic, so it needs to come first;\n    # same for RST.\n    for reader in (fixedwidth.FixedWidthTwoLine, rst.RST,\n                   fastbasic.FastBasic, basic.Basic,\n                   fastbasic.FastRdb, basic.Rdb,\n                   fastbasic.FastTab, basic.Tab,\n                   cds.Cds, mrt.Mrt, daophot.Daophot, sextractor.SExtractor,\n                   ipac.Ipac, latex.Latex, latex.AASTex):\n        guess_kwargs_list.append(dict(Reader=reader))\n\n    # Cycle through the basic-style readers using all combinations of delimiter\n    # and quotechar.\n    for Reader in (fastbasic.FastCommentedHeader, basic.CommentedHeader,\n                   fastbasic.FastBasic, basic.Basic,\n                   fastbasic.FastNoHeader, basic.NoHeader):\n        for delimiter in (\"|\", \",\", \" \", r\"\\s\"):\n            for quotechar in ('\"', \"'\"):\n                guess_kwargs_list.append(dict(\n                    Reader=Reader, delimiter=delimiter, quotechar=quotechar))\n\n    return guess_kwargs_list"},{"attributeType":"null","col":8,"comment":"null","endLoc":328,"id":5158,"name":"latex","nodeType":"Attribute","startLoc":328,"text":"self.latex"},{"className":"AASTexHeaderSplitter","col":0,"comment":"Extract column names from a `deluxetable`_.\n\n    This splitter expects the following LaTeX code **in a single line**:\n\n        \\tablehead{\\colhead{col1} & ... & \\colhead{coln}}\n    ","endLoc":375,"id":5159,"nodeType":"Class","startLoc":351,"text":"class AASTexHeaderSplitter(LatexSplitter):\n    r'''Extract column names from a `deluxetable`_.\n\n    This splitter expects the following LaTeX code **in a single line**:\n\n        \\tablehead{\\colhead{col1} & ... & \\colhead{coln}}\n    '''\n\n    def __call__(self, lines):\n        return super(LatexSplitter, self).__call__(lines)\n\n    def process_line(self, line):\n        \"\"\"extract column names from tablehead\n        \"\"\"\n        line = line.split('%')[0]\n        line = line.replace(r'\\tablehead', '')\n        line = line.strip()\n        if (line[0] == '{') and (line[-1] == '}'):\n            line = line[1:-1]\n        else:\n            raise core.InconsistentTableError(r'\\tablehead is missing {}')\n        return line.replace(r'\\colhead', '')\n\n    def join(self, vals):\n        return ' & '.join([r'\\colhead{' + str(x) + '}' for x in vals])"},{"col":0,"comment":"","endLoc":3,"header":"setup_package.py#<anonymous>","id":5160,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"ROOT = os.path.relpath(os.path.dirname(__file__))"},{"col":4,"comment":"null","endLoc":360,"header":"def __call__(self, lines)","id":5161,"name":"__call__","nodeType":"Function","startLoc":359,"text":"def __call__(self, lines):\n        return super(LatexSplitter, self).__call__(lines)"},{"fileName":"qdp.py","filePath":"astropy/io/ascii","id":5162,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis package contains functions for reading and writing QDP tables that are\nnot meant to be used directly, but instead are available as readers/writers in\n`astropy.table`. See :ref:`astropy:table_io` for more details.\n\"\"\"\nimport re\nimport copy\nfrom collections.abc import Iterable\nimport numpy as np\nimport warnings\nfrom astropy.utils.exceptions import AstropyUserWarning\nfrom astropy.table import Table\n\nfrom . import core, basic\n\n\ndef _line_type(line, delimiter=None):\n    \"\"\"Interpret a QDP file line\n\n    Parameters\n    ----------\n    line : str\n        a single line of the file\n\n    Returns\n    -------\n    type : str\n        Line type: \"comment\", \"command\", or \"data\"\n\n    Examples\n    --------\n    >>> _line_type(\"READ SERR 3\")\n    'command'\n    >>> _line_type(\" \\\\n    !some gibberish\")\n    'comment'\n    >>> _line_type(\"   \")\n    'comment'\n    >>> _line_type(\" 21345.45\")\n    'data,1'\n    >>> _line_type(\" 21345.45 1.53e-3 1e-3 .04 NO nan\")\n    'data,6'\n    >>> _line_type(\" 21345.45,1.53e-3,1e-3,.04,NO,nan\", delimiter=',')\n    'data,6'\n    >>> _line_type(\" 21345.45 ! a comment to disturb\")\n    'data,1'\n    >>> _line_type(\"NO NO NO NO NO\")\n    'new'\n    >>> _line_type(\"NO,NO,NO,NO,NO\", delimiter=',')\n    'new'\n    >>> _line_type(\"N O N NOON OON O\")\n    Traceback (most recent call last):\n        ...\n    ValueError: Unrecognized QDP line...\n    >>> _line_type(\" some non-comment gibberish\")\n    Traceback (most recent call last):\n        ...\n    ValueError: Unrecognized QDP line...\n    \"\"\"\n    _decimal_re = r'[+-]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][+-]?\\d+)?'\n    _command_re = r'READ [TS]ERR(\\s+[0-9]+)+'\n\n    sep = delimiter\n    if delimiter is None:\n        sep = r'\\s+'\n    _new_re = rf'NO({sep}NO)+'\n    _data_re = rf'({_decimal_re}|NO|[-+]?nan)({sep}({_decimal_re}|NO|[-+]?nan))*)'\n    _type_re = rf'^\\s*((?P<command>{_command_re})|(?P<new>{_new_re})|(?P<data>{_data_re})?\\s*(\\!(?P<comment>.*))?\\s*$'\n    _line_type_re = re.compile(_type_re)\n    line = line.strip()\n    if not line:\n        return 'comment'\n    match = _line_type_re.match(line)\n\n    if match is None:\n        raise ValueError(f'Unrecognized QDP line: {line}')\n    for type_, val in match.groupdict().items():\n        if val is None:\n            continue\n        if type_ == 'data':\n            return f'data,{len(val.split(sep=delimiter))}'\n        else:\n            return type_\n\n\ndef _get_type_from_list_of_lines(lines, delimiter=None):\n    \"\"\"Read through the list of QDP file lines and label each line by type\n\n    Parameters\n    ----------\n    lines : list\n        List containing one file line in each entry\n\n    Returns\n    -------\n    contents : list\n        List containing the type for each line (see `line_type_and_data`)\n    ncol : int\n        The number of columns in the data lines. Must be the same throughout\n        the file\n\n    Examples\n    --------\n    >>> line0 = \"! A comment\"\n    >>> line1 = \"543 12 456.0\"\n    >>> lines = [line0, line1]\n    >>> types, ncol = _get_type_from_list_of_lines(lines)\n    >>> types[0]\n    'comment'\n    >>> types[1]\n    'data,3'\n    >>> ncol\n    3\n    >>> lines.append(\"23\")\n    >>> _get_type_from_list_of_lines(lines)\n    Traceback (most recent call last):\n        ...\n    ValueError: Inconsistent number of columns\n    \"\"\"\n\n    types = [_line_type(line, delimiter=delimiter) for line in lines]\n    current_ncol = None\n    for type_ in types:\n        if type_.startswith('data', ):\n            ncol = int(type_[5:])\n            if current_ncol is None:\n                current_ncol = ncol\n            elif ncol != current_ncol:\n                raise ValueError('Inconsistent number of columns')\n\n    return types, current_ncol\n\n\ndef _get_lines_from_file(qdp_file):\n    if \"\\n\" in qdp_file:\n        lines = qdp_file.split(\"\\n\")\n    elif isinstance(qdp_file, str):\n        with open(qdp_file) as fobj:\n            lines = [line.strip() for line in fobj.readlines()]\n    elif isinstance(qdp_file, Iterable):\n        lines = qdp_file\n    else:\n        raise ValueError('invalid value of qdb_file')\n\n    return lines\n\n\ndef _interpret_err_lines(err_specs, ncols, names=None):\n    \"\"\"Give list of column names from the READ SERR and TERR commands\n\n    Parameters\n    ----------\n    err_specs : dict\n        ``{'serr': [n0, n1, ...], 'terr': [n2, n3, ...]}``\n        Error specifications for symmetric and two-sided errors\n    ncols : int\n        Number of data columns\n\n    Other Parameters\n    ----------------\n    names : list of str\n        Name of data columns (defaults to ['col1', 'col2', ...]), _not_\n        including error columns.\n\n    Returns\n    -------\n    colnames : list\n        List containing the column names. Error columns will have the name\n        of the main column plus ``_err`` for symmetric errors, and ``_perr``\n        and ``_nerr`` for positive and negative errors respectively\n\n    Examples\n    --------\n    >>> col_in = ['MJD', 'Rate']\n    >>> cols = _interpret_err_lines(None, 2, names=col_in)\n    >>> cols[0]\n    'MJD'\n    >>> err_specs = {'terr': [1], 'serr': [2]}\n    >>> ncols = 5\n    >>> cols = _interpret_err_lines(err_specs, ncols, names=col_in)\n    >>> cols[0]\n    'MJD'\n    >>> cols[2]\n    'MJD_nerr'\n    >>> cols[4]\n    'Rate_err'\n    >>> _interpret_err_lines(err_specs, 6, names=col_in)\n    Traceback (most recent call last):\n        ...\n    ValueError: Inconsistent number of input colnames\n    \"\"\"\n\n    colnames = [\"\" for i in range(ncols)]\n    if err_specs is None:\n        serr_cols = terr_cols = []\n\n    else:\n        # I don't want to empty the original one when using `pop` below\n        err_specs = copy.deepcopy(err_specs)\n\n        serr_cols = err_specs.pop(\"serr\", [])\n        terr_cols = err_specs.pop(\"terr\", [])\n\n    if names is not None:\n        all_error_cols = len(serr_cols) + len(terr_cols) * 2\n        if all_error_cols + len(names) != ncols:\n            raise ValueError(\"Inconsistent number of input colnames\")\n\n    shift = 0\n    for i in range(ncols):\n        col_num = i + 1 - shift\n        if colnames[i] != \"\":\n            continue\n\n        colname_root = f\"col{col_num}\"\n\n        if names is not None:\n            colname_root = names[col_num - 1]\n\n        colnames[i] = f\"{colname_root}\"\n        if col_num in serr_cols:\n            colnames[i + 1] = f\"{colname_root}_err\"\n            shift += 1\n            continue\n\n        if col_num in terr_cols:\n            colnames[i + 1] = f\"{colname_root}_perr\"\n            colnames[i + 2] = f\"{colname_root}_nerr\"\n            shift += 2\n            continue\n\n    assert not np.any([c == \"\" for c in colnames])\n\n    return colnames\n\n\ndef _get_tables_from_qdp_file(qdp_file, input_colnames=None, delimiter=None):\n    \"\"\"Get all tables from a QDP file\n\n    Parameters\n    ----------\n    qdp_file : str\n        Input QDP file name\n\n    Other Parameters\n    ----------------\n    input_colnames : list of str\n        Name of data columns (defaults to ['col1', 'col2', ...]), _not_\n        including error columns.\n    delimiter : str\n        Delimiter for the values in the table.\n\n    Returns\n    -------\n    list of `~astropy.table.Table`\n        List containing all the tables present inside the QDP file\n    \"\"\"\n\n    lines = _get_lines_from_file(qdp_file)\n    contents, ncol = _get_type_from_list_of_lines(lines, delimiter=delimiter)\n\n    table_list = []\n    err_specs = {}\n    colnames = None\n\n    comment_text = \"\"\n    initial_comments = \"\"\n    command_lines = \"\"\n    current_rows = None\n\n    for line, datatype in zip(lines, contents):\n        line = line.strip().lstrip('!')\n        # Is this a comment?\n        if datatype == \"comment\":\n            comment_text += line + '\\n'\n            continue\n\n        if datatype == \"command\":\n            # The first time I find commands, I save whatever comments into\n            # The initial comments.\n            if command_lines == \"\":\n                initial_comments = comment_text\n                comment_text = \"\"\n\n            if err_specs != {}:\n                warnings.warn(\n                    \"This file contains multiple command blocks. Please verify\",\n                    AstropyUserWarning\n                )\n            command_lines += line + '\\n'\n            continue\n\n        if datatype.startswith(\"data\"):\n            # The first time I find data, I define err_specs\n            if err_specs == {} and command_lines != \"\":\n                for cline in command_lines.strip().split('\\n'):\n                    command = cline.strip().split()\n                    # This should never happen, but just in case.\n                    if len(command) < 3:\n                        continue\n                    err_specs[command[1].lower()] = [int(c) for c in\n                                                     command[2:]]\n            if colnames is None:\n                colnames = _interpret_err_lines(\n                    err_specs, ncol, names=input_colnames\n                )\n\n            if current_rows is None:\n                current_rows = []\n\n            values = []\n            for v in line.split(delimiter):\n                if v == \"NO\":\n                    values.append(np.ma.masked)\n                else:\n                    # Understand if number is int or float\n                    try:\n                        values.append(int(v))\n                    except ValueError:\n                        values.append(float(v))\n            current_rows.append(values)\n            continue\n\n        if datatype == \"new\":\n            # Save table to table_list and reset\n            if current_rows is not None:\n                new_table = Table(names=colnames, rows=current_rows)\n                new_table.meta[\"initial_comments\"] = initial_comments.strip().split(\"\\n\")\n                new_table.meta[\"comments\"] = comment_text.strip().split(\"\\n\")\n                # Reset comments\n                comment_text = \"\"\n                table_list.append(new_table)\n                current_rows = None\n            continue\n\n    # At the very end, if there is still a table being written, let's save\n    # it to the table_list\n    if current_rows is not None:\n        new_table = Table(names=colnames, rows=current_rows)\n        new_table.meta[\"initial_comments\"] = initial_comments.strip().split(\"\\n\")\n        new_table.meta[\"comments\"] = comment_text.strip().split(\"\\n\")\n        table_list.append(new_table)\n\n    return table_list\n\n\ndef _understand_err_col(colnames):\n    \"\"\"Get which column names are error columns\n\n    Examples\n    --------\n    >>> colnames = ['a', 'a_err', 'b', 'b_perr', 'b_nerr']\n    >>> serr, terr = _understand_err_col(colnames)\n    >>> np.allclose(serr, [1])\n    True\n    >>> np.allclose(terr, [2])\n    True\n    >>> serr, terr = _understand_err_col(['a', 'a_nerr'])\n    Traceback (most recent call last):\n    ...\n    ValueError: Missing positive error...\n    >>> serr, terr = _understand_err_col(['a', 'a_perr'])\n    Traceback (most recent call last):\n    ...\n    ValueError: Missing negative error...\n    \"\"\"\n    shift = 0\n    serr = []\n    terr = []\n\n    for i, col in enumerate(colnames):\n        if col.endswith(\"_err\"):\n            # The previous column, but they're numbered from 1!\n            # Plus, take shift into account\n            serr.append(i - shift)\n            shift += 1\n        elif col.endswith(\"_perr\"):\n            terr.append(i - shift)\n            if len(colnames) == i + 1 or not colnames[i + 1].endswith('_nerr'):\n                raise ValueError(\"Missing negative error\")\n            shift += 2\n        elif col.endswith(\"_nerr\") and not colnames[i - 1].endswith('_perr'):\n            raise ValueError(\"Missing positive error\")\n    return serr, terr\n\n\ndef _read_table_qdp(qdp_file, names=None, table_id=None, delimiter=None):\n    \"\"\"Read a table from a QDP file\n\n    Parameters\n    ----------\n    qdp_file : str\n        Input QDP file name\n\n    Other Parameters\n    ----------------\n    names : list of str\n        Name of data columns (defaults to ['col1', 'col2', ...]), _not_\n        including error columns.\n\n    table_id : int, default 0\n        Number of the table to be read from the QDP file. This is useful\n        when multiple tables present in the file. By default, the first is read.\n\n    delimiter : str\n        Any delimiter accepted by the `sep` argument of str.split()\n\n    Returns\n    -------\n    tables : list of `~astropy.table.Table`\n        List containing all the tables present inside the QDP file\n    \"\"\"\n    if table_id is None:\n        warnings.warn(\"table_id not specified. Reading the first available \"\n                      \"table\", AstropyUserWarning)\n        table_id = 0\n\n    tables = _get_tables_from_qdp_file(qdp_file, input_colnames=names, delimiter=delimiter)\n\n    return tables[table_id]\n\n\ndef _write_table_qdp(table, filename=None, err_specs=None):\n    \"\"\"Write a table to a QDP file\n\n    Parameters\n    ----------\n    table : :class:`~astropy.table.Table`\n        Input table to be written\n    filename : str\n        Output QDP file name\n\n    Other Parameters\n    ----------------\n    err_specs : dict\n        Dictionary of the format {'serr': [1], 'terr': [2, 3]}, specifying\n        which columns have symmetric and two-sided errors (see QDP format\n        specification)\n    \"\"\"\n    import io\n    fobj = io.StringIO()\n\n    if 'initial_comments' in table.meta and table.meta['initial_comments'] != []:\n        for line in table.meta['initial_comments']:\n            line = line.strip()\n            if not line.startswith(\"!\"):\n                line = \"!\" + line\n            print(line, file=fobj)\n\n    if err_specs is None:\n        serr_cols, terr_cols = _understand_err_col(table.colnames)\n    else:\n        serr_cols = err_specs.pop(\"serr\", [])\n        terr_cols = err_specs.pop(\"terr\", [])\n    if serr_cols != []:\n        col_string = \" \".join([str(val) for val in serr_cols])\n        print(f\"READ SERR {col_string}\", file=fobj)\n    if terr_cols != []:\n        col_string = \" \".join([str(val) for val in terr_cols])\n        print(f\"READ TERR {col_string}\", file=fobj)\n\n    if 'comments' in table.meta and table.meta['comments'] != []:\n        for line in table.meta['comments']:\n            line = line.strip()\n            if not line.startswith(\"!\"):\n                line = \"!\" + line\n            print(line, file=fobj)\n\n    colnames = table.colnames\n    print(\"!\" + \" \".join(colnames), file=fobj)\n    for row in table:\n        values = []\n        for val in row:\n            if not np.ma.is_masked(val):\n                rep = str(val)\n            else:\n                rep = \"NO\"\n            values.append(rep)\n        print(\" \".join(values), file=fobj)\n\n    full_string = fobj.getvalue()\n    fobj.close()\n\n    if filename is not None:\n        with open(filename, 'w') as fobj:\n            print(full_string, file=fobj)\n\n    return full_string.split(\"\\n\")\n\n\nclass QDPSplitter(core.DefaultSplitter):\n    \"\"\"\n    Split on space for QDP tables\n    \"\"\"\n    delimiter = ' '\n\n\nclass QDPHeader(basic.CommentedHeaderHeader):\n    \"\"\"\n    Header that uses the :class:`astropy.io.ascii.basic.QDPSplitter`\n    \"\"\"\n    splitter_class = QDPSplitter\n    comment = \"!\"\n    write_comment = \"!\"\n\n\nclass QDPData(basic.BasicData):\n    \"\"\"\n    Data that uses the :class:`astropy.io.ascii.basic.CsvSplitter`\n    \"\"\"\n    splitter_class = QDPSplitter\n    fill_values = [(core.masked, 'NO')]\n    comment = \"!\"\n    write_comment = None\n\n\nclass QDP(basic.Basic):\n    \"\"\"Quick and Dandy Plot table.\n\n    Example::\n\n        ! Initial comment line 1\n        ! Initial comment line 2\n        READ TERR 1\n        READ SERR 3\n        ! Table 0 comment\n        !a a(pos) a(neg) b be c d\n        53000.5   0.25  -0.5   1  1.5  3.5 2\n        54000.5   1.25  -1.5   2  2.5  4.5 3\n        NO NO NO NO NO\n        ! Table 1 comment\n        !a a(pos) a(neg) b be c d\n        54000.5   2.25  -2.5   NO  3.5  5.5 5\n        55000.5   3.25  -3.5   4  4.5  6.5 nan\n\n    The input table above contains some initial comments, the error commands,\n    then two tables.\n    This file format can contain multiple tables, separated by a line full\n    of ``NO``s. Comments are exclamation marks, and missing values are single\n    ``NO`` entries. The delimiter is usually whitespace, more rarely a comma.\n    The QDP format differentiates between data and error columns. The table\n    above has commands::\n\n        READ TERR 1\n        READ SERR 3\n\n    which mean that after data column 1 there will be two error columns\n    containing its positive and engative error bars, then data column 2 without\n    error bars, then column 3, then a column with the symmetric error of column\n    3, then the remaining data columns.\n\n    As explained below, table headers are highly inconsistent. Possible\n    comments containing column names will be ignored and columns will be called\n    ``col1``, ``col2``, etc. unless the user specifies their names with the\n    ``names=`` keyword argument,\n    When passing column names, pass **only the names of the data columns, not\n    the error columns.**\n    Error information will be encoded in the names of the table columns.\n    (e.g. ``a_perr`` and ``a_nerr`` for the positive and negative error of\n    column ``a``, ``b_err`` the symmetric error of column ``b``.)\n\n    When writing tables to this format, users can pass an ``err_specs`` keyword\n    passing a dictionary ``{'serr': [3], 'terr': [1, 2]}``, meaning that data\n    columns 1 and two will have two additional columns each with their positive\n    and negative errors, and data column 3 will have an additional column with\n    a symmetric error (just like the ``READ SERR`` and ``READ TERR`` commands\n    above)\n\n    Headers are just comments, and tables distributed by various missions\n    can differ greatly in their use of conventions. For example, light curves\n    distributed by the Swift-Gehrels mission have an extra space in one header\n    entry that makes the number of labels inconsistent with the number of cols.\n    For this reason, we ignore the comments that might encode the column names\n    and leave the name specification to the user.\n\n    Example::\n\n        >               Extra space\n        >                   |\n        >                   v\n        >!     MJD       Err (pos)       Err(neg)        Rate            Error\n        >53000.123456   2.378e-05     -2.378472e-05     NO             0.212439\n\n    These readers and writer classes will strive to understand which of the\n    comments belong to all the tables, and which ones to each single table.\n    General comments will be stored in the ``initial_comments`` meta of each\n    table. The comments of each table will be stored in the ``comments`` meta.\n\n    Example::\n\n        t = Table.read(example_qdp, format='ascii.qdp', table_id=1, names=['a', 'b', 'c', 'd'])\n\n    reads the second table (``table_id=1``) in file ``example.qdp`` containing\n    the table above. There are four column names but seven data columns, why?\n    Because the ``READ SERR`` and ``READ TERR`` commands say that there are\n    three error columns.\n    ``t.meta['initial_comments']`` will contain the initial two comment lines\n    in the file, while ``t.meta['comments']`` will contain ``Table 1 comment``\n\n    The table can be written to another file, preserving the same information,\n    as::\n\n        t.write(test_file, err_specs={'terr': [1], 'serr': [3]})\n\n    Note how the ``terr`` and ``serr`` commands are passed to the writer.\n\n    \"\"\"\n    _format_name = 'qdp'\n    _io_registry_can_write = True\n    _io_registry_suffix = '.qdp'\n    _description = 'Quick and Dandy Plotter'\n\n    header_class = QDPHeader\n    data_class = QDPData\n\n    def __init__(self, table_id=None, names=None, err_specs=None, sep=None):\n        super().__init__()\n        self.table_id = table_id\n        self.names = names\n        self.err_specs = err_specs\n        self.delimiter = sep\n\n    def read(self, table):\n        self.lines = self.inputter.get_lines(table, newline=\"\\n\")\n        return _read_table_qdp(self.lines, table_id=self.table_id,\n                               names=self.names, delimiter=self.delimiter)\n\n    def write(self, table):\n        self._check_multidim_table(table)\n        lines = _write_table_qdp(table, err_specs=self.err_specs)\n        return lines\n"},{"className":"MrtSplitter","col":0,"comment":"\n    Contains the join function to left align the MRT columns\n    when writing to a file.\n    ","endLoc":59,"id":5163,"nodeType":"Class","startLoc":52,"text":"class MrtSplitter(fixedwidth.FixedWidthSplitter):\n    \"\"\"\n    Contains the join function to left align the MRT columns\n    when writing to a file.\n    \"\"\"\n    def join(self, vals, widths):\n        vals = [val + ' ' * (width - len(val)) for val, width in zip(vals, widths)]\n        return self.delimiter.join(vals)"},{"col":4,"comment":"extract column names from tablehead\n        ","endLoc":372,"header":"def process_line(self, line)","id":5164,"name":"process_line","nodeType":"Function","startLoc":362,"text":"def process_line(self, line):\n        \"\"\"extract column names from tablehead\n        \"\"\"\n        line = line.split('%')[0]\n        line = line.replace(r'\\tablehead', '')\n        line = line.strip()\n        if (line[0] == '{') and (line[-1] == '}'):\n            line = line[1:-1]\n        else:\n            raise core.InconsistentTableError(r'\\tablehead is missing {}')\n        return line.replace(r'\\colhead', '')"},{"col":4,"comment":"null","endLoc":59,"header":"def join(self, vals, widths)","id":5165,"name":"join","nodeType":"Function","startLoc":57,"text":"def join(self, vals, widths):\n        vals = [val + ' ' * (width - len(val)) for val, width in zip(vals, widths)]\n        return self.delimiter.join(vals)"},{"className":"QDPSplitter","col":0,"comment":"\n    Split on space for QDP tables\n    ","endLoc":495,"id":5166,"nodeType":"Class","startLoc":491,"text":"class QDPSplitter(core.DefaultSplitter):\n    \"\"\"\n    Split on space for QDP tables\n    \"\"\"\n    delimiter = ' '"},{"col":4,"comment":"null","endLoc":375,"header":"def join(self, vals)","id":5167,"name":"join","nodeType":"Function","startLoc":374,"text":"def join(self, vals):\n        return ' & '.join([r'\\colhead{' + str(x) + '}' for x in vals])"},{"className":"AASTexHeader","col":0,"comment":"In a `deluxetable\n    <http://fits.gsfc.nasa.gov/standard30/deluxetable.sty>`_ some header\n    keywords differ from standard LaTeX.\n\n    This header is modified to take that into account.\n    ","endLoc":410,"id":5168,"nodeType":"Class","startLoc":378,"text":"class AASTexHeader(LatexHeader):\n    r'''In a `deluxetable\n    <http://fits.gsfc.nasa.gov/standard30/deluxetable.sty>`_ some header\n    keywords differ from standard LaTeX.\n\n    This header is modified to take that into account.\n    '''\n    header_start = r'\\tablehead'\n    splitter_class = AASTexHeaderSplitter\n\n    def start_line(self, lines):\n        return find_latex_line(lines, r'\\tablehead')\n\n    def write(self, lines):\n        if 'col_align' not in self.latex:\n            self.latex['col_align'] = len(self.cols) * 'c'\n        if 'tablealign' in self.latex:\n            align = '[' + self.latex['tablealign'] + ']'\n        else:\n            align = ''\n        lines.append(r'\\begin{' + self.latex['tabletype'] + r'}{' + self.latex['col_align'] + r'}'\n                     + align)\n        add_dictval_to_list(self.latex, 'preamble', lines)\n        if 'caption' in self.latex:\n            lines.append(r'\\tablecaption{' + self.latex['caption'] + '}')\n        tablehead = ' & '.join([r'\\colhead{' + name + '}' for name in self.colnames])\n        units = self._get_units()\n        if 'units' in self.latex:\n            units.update(self.latex['units'])\n        if units:\n            tablehead += r'\\\\ ' + self.splitter.join([units.get(name, ' ')\n                                                      for name in self.colnames])\n        lines.append(r'\\tablehead{' + tablehead + '}')"},{"col":4,"comment":"null","endLoc":389,"header":"def start_line(self, lines)","id":5169,"name":"start_line","nodeType":"Function","startLoc":388,"text":"def start_line(self, lines):\n        return find_latex_line(lines, r'\\tablehead')"},{"className":"MrtHeader","col":0,"comment":"null","endLoc":559,"id":5170,"nodeType":"Class","startLoc":62,"text":"class MrtHeader(cds.CdsHeader):\n    _subfmt = 'MRT'\n\n    def _split_float_format(self, value):\n        \"\"\"\n        Splits a Float string into different parts to find number\n        of digits after decimal and check if the value is in Scientific\n        notation.\n\n        Parameters\n        ----------\n        value : str\n            String containing the float value to split.\n\n        Returns\n        -------\n        fmt: (int, int, int, bool, bool)\n            List of values describing the Float sting.\n            (size, dec, ent, sign, exp)\n            size, length of the given string.\n            ent, number of digits before decimal point.\n            dec, number of digits after decimal point.\n            sign, whether or not given value signed.\n            exp, is value in Scientific notation?\n        \"\"\"\n        regfloat = re.compile(r\"\"\"(?P<sign> [+-]*)\n                                  (?P<ent> [^eE.]+)\n                                  (?P<deciPt> [.]*)\n                                  (?P<decimals> [0-9]*)\n                                  (?P<exp> [eE]*-*)[0-9]*\"\"\",\n                              re.VERBOSE)\n        mo = regfloat.match(value)\n\n        if mo is None:\n            raise Exception(f'{value} is not a float number')\n        return (len(value),\n                len(mo.group('ent')),\n                len(mo.group('decimals')),\n                mo.group('sign') != \"\",\n                mo.group('exp') != \"\")\n\n    def _set_column_val_limits(self, col):\n        \"\"\"\n        Sets the ``col.min`` and ``col.max`` column attributes,\n        taking into account columns with Null values.\n        \"\"\"\n        col.max = max(col)\n        col.min = min(col)\n        if col.max is np.ma.core.MaskedConstant:\n            col.max = None\n        if col.min is np.ma.core.MaskedConstant:\n            col.min = None\n\n    def column_float_formatter(self, col):\n        \"\"\"\n        String formatter function for a column containing Float values.\n        Checks if the values in the given column are in Scientific notation,\n        by spliting the value string. It is assumed that the column either has\n        float values or Scientific notation.\n\n        A ``col.formatted_width`` attribute is added to the column. It is not added\n        if such an attribute is already present, say when the ``formats`` argument\n        is passed to the writer. A properly formatted format string is also added as\n        the ``col.format`` attribute.\n\n        Parameters\n        ----------\n        col : A ``Table.Column`` object.\n        \"\"\"\n        # maxsize: maximum length of string containing the float value.\n        # maxent: maximum number of digits places before decimal point.\n        # maxdec: maximum number of digits places after decimal point.\n        # maxprec: maximum precision of the column values, sum of maxent and maxdec.\n        maxsize, maxprec, maxent, maxdec = 1, 0, 1, 0\n        sign = False\n        fformat = 'F'\n\n        # Find maximum sized value in the col\n        for val in col.str_vals:\n            # Skip null values\n            if val is None or val == '':\n                continue\n\n            # Find format of the Float string\n            fmt = self._split_float_format(val)\n            # If value is in Scientific notation\n            if fmt[4] is True:\n                # if the previous column value was in normal Float format\n                # set maxsize, maxprec and maxdec to default.\n                if fformat == 'F':\n                    maxsize, maxprec, maxdec = 1, 0, 0\n                # Designate the column to be in Scientific notation.\n                fformat = 'E'\n            else:\n                # Move to next column value if\n                # current value is not in Scientific notation\n                # but the column is designated as such because\n                # one of the previous values was.\n                if fformat == 'E':\n                    continue\n\n            if maxsize < fmt[0]:\n                maxsize = fmt[0]\n            if maxent < fmt[1]:\n                maxent = fmt[1]\n            if maxdec < fmt[2]:\n                maxdec = fmt[2]\n            if fmt[3]:\n                sign = True\n\n            if maxprec < fmt[1] + fmt[2]:\n                maxprec = fmt[1] + fmt[2]\n\n        if fformat == 'E':\n            if getattr(col, 'formatted_width', None) is None:  # If ``formats`` not passed.\n                col.formatted_width = maxsize\n                if sign:\n                    col.formatted_width += 1\n            # Number of digits after decimal is replaced by the precision\n            # for values in Scientific notation, when writing that Format.\n            col.fortran_format = fformat + str(col.formatted_width) + \".\" + str(maxprec)\n            col.format = str(col.formatted_width) + \".\" + str(maxdec) + \"e\"\n        else:\n            lead = ''\n            if getattr(col, 'formatted_width', None) is None:  # If ``formats`` not passed.\n                col.formatted_width = maxent + maxdec + 1\n                if sign:\n                    col.formatted_width += 1\n            elif col.format.startswith('0'):\n                # Keep leading zero, if already set in format - primarily for `seconds` columns\n                # in coordinates; may need extra case if this is to be also supported with `sign`.\n                lead = '0'\n            col.fortran_format = fformat + str(col.formatted_width) + \".\" + str(maxdec)\n            col.format = lead + col.fortran_format[1:] + \"f\"\n\n    def write_byte_by_byte(self):\n        \"\"\"\n        Writes the Byte-By-Byte description of the table.\n\n        Columns that are `astropy.coordinates.SkyCoord` or `astropy.time.TimeSeries`\n        objects or columns with values that are such objects are recognized as such,\n        and some predefined labels and description is used for them.\n        See the Vizier MRT Standard documentation in the link below for more details\n        on these. An example Byte-By-Byte table is shown here.\n\n        See: http://vizier.u-strasbg.fr/doc/catstd-3.1.htx\n\n        Example::\n\n        --------------------------------------------------------------------------------\n        Byte-by-byte Description of file: table.dat\n        --------------------------------------------------------------------------------\n        Bytes Format Units  Label     Explanations\n        --------------------------------------------------------------------------------\n         1- 8  A8     ---    names   Description of names\n        10-14  E5.1   ---    e       [-3160000.0/0.01] Description of e\n        16-23  F8.5   ---    d       [22.25/27.25] Description of d\n        25-31  E7.1   ---    s       [-9e+34/2.0] Description of s\n        33-35  I3     ---    i       [-30/67] Description of i\n        37-39  F3.1   ---    sameF   [5.0/5.0] Description of sameF\n        41-42  I2     ---    sameI   [20] Description of sameI\n        44-45  I2     h      RAh     Right Ascension (hour)\n        47-48  I2     min    RAm     Right Ascension (minute)\n        50-67  F18.15 s      RAs     Right Ascension (second)\n           69  A1     ---    DE-     Sign of Declination\n        70-71  I2     deg    DEd     Declination (degree)\n        73-74  I2     arcmin DEm     Declination (arcmin)\n        76-91  F16.13 arcsec DEs     Declination (arcsec)\n\n        --------------------------------------------------------------------------------\n        \"\"\"\n        # Get column widths\n        vals_list = []\n        col_str_iters = self.data.str_vals()\n        for vals in zip(*col_str_iters):\n            vals_list.append(vals)\n\n        for i, col in enumerate(self.cols):\n            col.width = max([len(vals[i]) for vals in vals_list])\n            if self.start_line is not None:\n                col.width = max(col.width, len(col.info.name))\n        widths = [col.width for col in self.cols]\n\n        startb = 1  # Byte count starts at 1.\n\n        # Set default width of the Bytes count column of the Byte-By-Byte table.\n        # This ``byte_count_width`` value helps align byte counts with respect\n        # to the hyphen using a format string.\n        byte_count_width = len(str(sum(widths) + len(self.cols) - 1))\n\n        # Format string for Start Byte and End Byte\n        singlebfmt = \"{:\" + str(byte_count_width) + \"d}\"\n        fmtb = singlebfmt + \"-\" + singlebfmt\n        # Add trailing single whitespaces to Bytes column for better visibility.\n        singlebfmt += \" \"\n        fmtb += \" \"\n\n        # Set default width of Label and Description Byte-By-Byte columns.\n        max_label_width, max_descrip_size = 7, 16\n\n        bbb = Table(names=['Bytes', 'Format', 'Units', 'Label', 'Explanations'],\n                    dtype=[str] * 5)\n\n        # Iterate over the columns to write Byte-By-Byte rows.\n        for i, col in enumerate(self.cols):\n            # Check if column is MaskedColumn\n            col.has_null = isinstance(col, MaskedColumn)\n\n            if col.format is not None:\n                col.formatted_width = max([len(sval) for sval in col.str_vals])\n\n            # Set MRTColumn type, size and format.\n            if np.issubdtype(col.dtype, np.integer):\n                # Integer formatter\n                self._set_column_val_limits(col)\n                if getattr(col, 'formatted_width', None) is None:  # If ``formats`` not passed.\n                    col.formatted_width = max(len(str(col.max)), len(str(col.min)))\n                col.fortran_format = \"I\" + str(col.formatted_width)\n                if col.format is None:\n                    col.format = \">\" + col.fortran_format[1:]\n\n            elif np.issubdtype(col.dtype, np.dtype(float).type):\n                # Float formatter\n                self._set_column_val_limits(col)\n                self.column_float_formatter(col)\n\n            else:\n                # String formatter, ``np.issubdtype(col.dtype, str)`` is ``True``.\n                dtype = col.dtype.str\n                if col.has_null:\n                    mcol = col\n                    mcol.fill_value = \"\"\n                    coltmp = Column(mcol.filled(), dtype=str)\n                    dtype = coltmp.dtype.str\n                if getattr(col, 'formatted_width', None) is None:  # If ``formats`` not passed.\n                    col.formatted_width = int(re.search(r'(\\d+)$', dtype).group(1))\n                col.fortran_format = \"A\" + str(col.formatted_width)\n                col.format = str(col.formatted_width) + \"s\"\n\n            endb = col.formatted_width + startb - 1\n\n            # ``mixin`` columns converted to string valued columns will not have a name\n            # attribute. In those cases, a ``Unknown`` column label is put, indicating that\n            # such columns can be better formatted with some manipulation before calling\n            # the MRT writer.\n            if col.name is None:\n                col.name = \"Unknown\"\n\n            # Set column description.\n            if col.description is not None:\n                description = col.description\n            else:\n                description = \"Description of \" + col.name\n\n            # Set null flag in column description\n            nullflag = \"\"\n            if col.has_null:\n                nullflag = \"?\"\n\n            # Set column unit\n            if col.unit is not None:\n                col_unit = col.unit.to_string(\"cds\")\n            elif col.name.lower().find(\"magnitude\") > -1:\n                # ``col.unit`` can still be ``None``, if the unit of column values\n                # is ``Magnitude``, because ``astropy.units.Magnitude`` is actually a class.\n                # Unlike other units which are instances of ``astropy.units.Unit``,\n                # application of the ``Magnitude`` unit calculates the logarithm\n                # of the values. Thus, the only way to check for if the column values\n                # have ``Magnitude`` unit is to check the column name.\n                col_unit = \"mag\"\n            else:\n                col_unit = \"---\"\n\n            # Add col limit values to col description\n            lim_vals = \"\"\n            if (col.min and col.max and\n                    not any(x in col.name for x in ['RA', 'DE', 'LON', 'LAT', 'PLN', 'PLT'])):\n                # No col limit values for coordinate columns.\n                if col.fortran_format[0] == 'I':\n                    if abs(col.min) < MAX_COL_INTLIMIT and abs(col.max) < MAX_COL_INTLIMIT:\n                        if col.min == col.max:\n                            lim_vals = \"[{0}]\".format(col.min)\n                        else:\n                            lim_vals = \"[{0}/{1}]\".format(col.min, col.max)\n                elif col.fortran_format[0] in ('E', 'F'):\n                    lim_vals = \"[{0}/{1}]\".format(math.floor(col.min * 100) / 100.,\n                                                  math.ceil(col.max * 100) / 100.)\n\n            if lim_vals != '' or nullflag != '':\n                description = \"{0}{1} {2}\".format(lim_vals, nullflag, description)\n\n            # Find the maximum label and description column widths.\n            if len(col.name) > max_label_width:\n                max_label_width = len(col.name)\n            if len(description) > max_descrip_size:\n                max_descrip_size = len(description)\n\n            # Add a row for the Sign of Declination in the bbb table\n            if col.name == 'DEd':\n                bbb.add_row([singlebfmt.format(startb),\n                             \"A1\", \"---\", \"DE-\",\n                             \"Sign of Declination\"])\n                col.fortran_format = 'I2'\n                startb += 1\n\n            # Add Byte-By-Byte row to bbb table\n            bbb.add_row([singlebfmt.format(startb) if startb == endb\n                         else fmtb.format(startb, endb),\n                         \"\" if col.fortran_format is None else col.fortran_format,\n                         col_unit,\n                         \"\" if col.name is None else col.name,\n                         description])\n            startb = endb + 2\n\n        # Properly format bbb columns\n        bbblines = StringIO()\n        bbb.write(bbblines, format='ascii.fixed_width_no_header',\n                  delimiter=' ', bookend=False, delimiter_pad=None,\n                  formats={'Format': '<6s',\n                           'Units': '<6s',\n                           'Label': '<' + str(max_label_width) + 's',\n                           'Explanations': '' + str(max_descrip_size) + 's'})\n\n        # Get formatted bbb lines\n        bbblines = bbblines.getvalue().splitlines()\n\n        # ``nsplit`` is the number of whitespaces to prefix to long description\n        # lines in order to wrap them. It is the sum of the widths of the\n        # previous 4 columns plus the number of single spacing between them.\n        # The hyphen in the Bytes column is also counted.\n        nsplit = byte_count_width * 2 + 1 + 12 + max_label_width + 4\n\n        # Wrap line if it is too long\n        buff = \"\"\n        for newline in bbblines:\n            if len(newline) > MAX_SIZE_README_LINE:\n                buff += (\"\\n\").join(wrap(newline,\n                                         subsequent_indent=\" \" * nsplit,\n                                         width=MAX_SIZE_README_LINE))\n                buff += \"\\n\"\n            else:\n                buff += newline + \"\\n\"\n\n        # Last value of ``endb`` is the sum of column widths after formatting.\n        self.linewidth = endb\n\n        # Remove the last extra newline character from Byte-By-Byte.\n        buff = buff[:-1]\n        return buff\n\n    def write(self, lines):\n        \"\"\"\n        Writes the Header of the MRT table, aka ReadMe, which\n        also contains the Byte-By-Byte description of the table.\n        \"\"\"\n        from astropy.coordinates import SkyCoord\n\n        # Recognised ``SkyCoord.name`` forms with their default column names (helio* require SunPy).\n        coord_systems = {'galactic': ('GLAT', 'GLON', 'b', 'l'),\n                         'ecliptic': ('ELAT', 'ELON', 'lat', 'lon'),      # 'geocentric*ecliptic'\n                         'heliographic': ('HLAT', 'HLON', 'lat', 'lon'),  # '_carrington|stonyhurst'\n                         'helioprojective': ('HPLT', 'HPLN', 'Ty', 'Tx')}\n        eqtnames = ['RAh', 'RAm', 'RAs', 'DEd', 'DEm', 'DEs']\n\n        # list to store indices of columns that are modified.\n        to_pop = []\n\n        # For columns that are instances of ``SkyCoord`` and other ``mixin`` columns\n        # or whose values are objects of these classes.\n        for i, col in enumerate(self.cols):\n            # If col is a ``Column`` object but its values are ``SkyCoord`` objects,\n            # convert the whole column to ``SkyCoord`` object, which helps in applying\n            # SkyCoord methods directly.\n            if not isinstance(col, SkyCoord) and isinstance(col[0], SkyCoord):\n                try:\n                    col = SkyCoord(col)\n                except (ValueError, TypeError):\n                    # If only the first value of the column is a ``SkyCoord`` object,\n                    # the column cannot be converted to a ``SkyCoord`` object.\n                    # These columns are converted to ``Column`` object and then converted\n                    # to string valued column.\n                    if not isinstance(col, Column):\n                        col = Column(col)\n                    col = Column([str(val) for val in col])\n                    self.cols[i] = col\n                    continue\n\n            # Replace single ``SkyCoord`` column by its coordinate components if no coordinate\n            # columns of the correspoding type exist yet.\n            if isinstance(col, SkyCoord):\n                # If coordinates are given in RA/DEC, divide each them into hour/deg,\n                # minute/arcminute, second/arcsecond columns.\n                if ('ra' in col.representation_component_names.keys() and\n                        len(set(eqtnames) - set(self.colnames)) == 6):\n                    ra_c, dec_c = col.ra.hms, col.dec.dms\n                    coords = [ra_c.h.round().astype('i1'), ra_c.m.round().astype('i1'), ra_c.s,\n                              dec_c.d.round().astype('i1'), dec_c.m.round().astype('i1'), dec_c.s]\n                    coord_units = [u.h, u.min, u.second,\n                                   u.deg, u.arcmin, u.arcsec]\n                    coord_descrip = ['Right Ascension (hour)', 'Right Ascension (minute)',\n                                     'Right Ascension (second)', 'Declination (degree)',\n                                     'Declination (arcmin)', 'Declination (arcsec)']\n                    for coord, name, coord_unit, descrip in zip(\n                            coords, eqtnames, coord_units, coord_descrip):\n                        # Have Sign of Declination only in the DEd column.\n                        if name in ['DEm', 'DEs']:\n                            coord_col = Column(list(np.abs(coord)), name=name,\n                                               unit=coord_unit, description=descrip)\n                        else:\n                            coord_col = Column(list(coord), name=name, unit=coord_unit,\n                                               description=descrip)\n                        # Set default number of digits after decimal point for the\n                        # second values, and deg-min to (signed) 2-digit zero-padded integer.\n                        if name == 'RAs':\n                            coord_col.format = '013.10f'\n                        elif name == 'DEs':\n                            coord_col.format = '012.9f'\n                        elif name == 'RAh':\n                            coord_col.format = '2d'\n                        elif name == 'DEd':\n                            coord_col.format = '+03d'\n                        elif name.startswith(('RA', 'DE')):\n                            coord_col.format = '02d'\n                        self.cols.append(coord_col)\n                    to_pop.append(i)   # Delete original ``SkyCoord`` column.\n\n                # For all other coordinate types, simply divide into two columns\n                # for latitude and longitude resp. with the unit used been as it is.\n\n                else:\n                    frminfo = ''\n                    for frame, latlon in coord_systems.items():\n                        if frame in col.name and len(set(latlon[:2]) - set(self.colnames)) == 2:\n                            if frame != col.name:\n                                frminfo = f' ({col.name})'\n                            lon_col = Column(getattr(col, latlon[3]), name=latlon[1],\n                                             description=f'{frame.capitalize()} Longitude{frminfo}',\n                                             unit=col.representation_component_units[latlon[3]],\n                                             format='.12f')\n                            lat_col = Column(getattr(col, latlon[2]), name=latlon[0],\n                                             description=f'{frame.capitalize()} Latitude{frminfo}',\n                                             unit=col.representation_component_units[latlon[2]],\n                                             format='+.12f')\n                            self.cols.append(lon_col)\n                            self.cols.append(lat_col)\n                            to_pop.append(i)   # Delete original ``SkyCoord`` column.\n\n                # Convert all other ``SkyCoord`` columns that are not in the above three\n                # representations to string valued columns. Those could either be types not\n                # supported yet (e.g. 'helioprojective'), or already present and converted.\n                # If there were any extra ``SkyCoord`` columns of one kind after the first one,\n                # then their decomposition into their component columns has been skipped.\n                # This is done in order to not create duplicate component columns.\n                # Explicit renaming of the extra coordinate component columns by appending some\n                # suffix to their name, so as to distinguish them, is not yet implemented.\n                if i not in to_pop:\n                    warnings.warn(f\"Coordinate system of type '{col.name}' already stored in table \"\n                                  f\"as CDS/MRT-syle columns or of unrecognized type. So column {i} \"\n                                  f\"is being skipped with designation of a string valued column \"\n                                  f\"`{self.colnames[i]}`.\", UserWarning)\n                    self.cols.append(Column(col.to_string(), name=self.colnames[i]))\n                    to_pop.append(i)   # Delete original ``SkyCoord`` column.\n\n            # Convert all other ``mixin`` columns to ``Column`` objects.\n            # Parsing these may still lead to errors!\n            elif not isinstance(col, Column):\n                col = Column(col)\n                # If column values are ``object`` types, convert them to string.\n                if np.issubdtype(col.dtype, np.dtype(object).type):\n                    col = Column([str(val) for val in col])\n                self.cols[i] = col\n\n        # Delete original ``SkyCoord`` columns, if there were any.\n        for i in to_pop[::-1]:\n            self.cols.pop(i)\n\n        # Check for any left over extra coordinate columns.\n        if any(x in self.colnames for x in ['RAh', 'DEd', 'ELON', 'GLAT']):\n            # At this point any extra ``SkyCoord`` columns should have been converted to string\n            # valued columns, together with issuance of a warning, by the coordinate parser above.\n            # This test is just left here as a safeguard.\n            for i, col in enumerate(self.cols):\n                if isinstance(col, SkyCoord):\n                    self.cols[i] = Column(col.to_string(), name=self.colnames[i])\n                    message = ('Table already has coordinate system in CDS/MRT-syle columns. '\n                               f'So column {i} should have been replaced already with '\n                               f'a string valued column `{self.colnames[i]}`.')\n                    raise core.InconsistentTableError(message)\n\n        # Get Byte-By-Byte description and fill the template\n        bbb_template = Template('\\n'.join(BYTE_BY_BYTE_TEMPLATE))\n        byte_by_byte = bbb_template.substitute({'file': 'table.dat',\n                                                'bytebybyte': self.write_byte_by_byte()})\n\n        # Fill up the full ReadMe\n        rm_template = Template('\\n'.join(MRT_TEMPLATE))\n        readme_filled = rm_template.substitute({'bytebybyte': byte_by_byte})\n        lines.append(readme_filled)"},{"col":4,"comment":"null","endLoc":410,"header":"def write(self, lines)","id":5171,"name":"write","nodeType":"Function","startLoc":391,"text":"def write(self, lines):\n        if 'col_align' not in self.latex:\n            self.latex['col_align'] = len(self.cols) * 'c'\n        if 'tablealign' in self.latex:\n            align = '[' + self.latex['tablealign'] + ']'\n        else:\n            align = ''\n        lines.append(r'\\begin{' + self.latex['tabletype'] + r'}{' + self.latex['col_align'] + r'}'\n                     + align)\n        add_dictval_to_list(self.latex, 'preamble', lines)\n        if 'caption' in self.latex:\n            lines.append(r'\\tablecaption{' + self.latex['caption'] + '}')\n        tablehead = ' & '.join([r'\\colhead{' + name + '}' for name in self.colnames])\n        units = self._get_units()\n        if 'units' in self.latex:\n            units.update(self.latex['units'])\n        if units:\n            tablehead += r'\\\\ ' + self.splitter.join([units.get(name, ' ')\n                                                      for name in self.colnames])\n        lines.append(r'\\tablehead{' + tablehead + '}')"},{"attributeType":"null","col":4,"comment":"null","endLoc":495,"id":5172,"name":"delimiter","nodeType":"Attribute","startLoc":495,"text":"delimiter"},{"col":4,"comment":"\n        Splits a Float string into different parts to find number\n        of digits after decimal and check if the value is in Scientific\n        notation.\n\n        Parameters\n        ----------\n        value : str\n            String containing the float value to split.\n\n        Returns\n        -------\n        fmt: (int, int, int, bool, bool)\n            List of values describing the Float sting.\n            (size, dec, ent, sign, exp)\n            size, length of the given string.\n            ent, number of digits before decimal point.\n            dec, number of digits after decimal point.\n            sign, whether or not given value signed.\n            exp, is value in Scientific notation?\n        ","endLoc":101,"header":"def _split_float_format(self, value)","id":5173,"name":"_split_float_format","nodeType":"Function","startLoc":65,"text":"def _split_float_format(self, value):\n        \"\"\"\n        Splits a Float string into different parts to find number\n        of digits after decimal and check if the value is in Scientific\n        notation.\n\n        Parameters\n        ----------\n        value : str\n            String containing the float value to split.\n\n        Returns\n        -------\n        fmt: (int, int, int, bool, bool)\n            List of values describing the Float sting.\n            (size, dec, ent, sign, exp)\n            size, length of the given string.\n            ent, number of digits before decimal point.\n            dec, number of digits after decimal point.\n            sign, whether or not given value signed.\n            exp, is value in Scientific notation?\n        \"\"\"\n        regfloat = re.compile(r\"\"\"(?P<sign> [+-]*)\n                                  (?P<ent> [^eE.]+)\n                                  (?P<deciPt> [.]*)\n                                  (?P<decimals> [0-9]*)\n                                  (?P<exp> [eE]*-*)[0-9]*\"\"\",\n                              re.VERBOSE)\n        mo = regfloat.match(value)\n\n        if mo is None:\n            raise Exception(f'{value} is not a float number')\n        return (len(value),\n                len(mo.group('ent')),\n                len(mo.group('decimals')),\n                mo.group('sign') != \"\",\n                mo.group('exp') != \"\")"},{"className":"QDPHeader","col":0,"comment":"\n    Header that uses the :class:`astropy.io.ascii.basic.QDPSplitter`\n    ","endLoc":504,"id":5174,"nodeType":"Class","startLoc":498,"text":"class QDPHeader(basic.CommentedHeaderHeader):\n    \"\"\"\n    Header that uses the :class:`astropy.io.ascii.basic.QDPSplitter`\n    \"\"\"\n    splitter_class = QDPSplitter\n    comment = \"!\"\n    write_comment = \"!\""},{"attributeType":"QDPSplitter","col":4,"comment":"null","endLoc":502,"id":5175,"name":"splitter_class","nodeType":"Attribute","startLoc":502,"text":"splitter_class"},{"col":4,"comment":"\n        Sets the ``col.min`` and ``col.max`` column attributes,\n        taking into account columns with Null values.\n        ","endLoc":113,"header":"def _set_column_val_limits(self, col)","id":5176,"name":"_set_column_val_limits","nodeType":"Function","startLoc":103,"text":"def _set_column_val_limits(self, col):\n        \"\"\"\n        Sets the ``col.min`` and ``col.max`` column attributes,\n        taking into account columns with Null values.\n        \"\"\"\n        col.max = max(col)\n        col.min = min(col)\n        if col.max is np.ma.core.MaskedConstant:\n            col.max = None\n        if col.min is np.ma.core.MaskedConstant:\n            col.min = None"},{"col":4,"comment":"\n        String formatter function for a column containing Float values.\n        Checks if the values in the given column are in Scientific notation,\n        by spliting the value string. It is assumed that the column either has\n        float values or Scientific notation.\n\n        A ``col.formatted_width`` attribute is added to the column. It is not added\n        if such an attribute is already present, say when the ``formats`` argument\n        is passed to the writer. A properly formatted format string is also added as\n        the ``col.format`` attribute.\n\n        Parameters\n        ----------\n        col : A ``Table.Column`` object.\n        ","endLoc":195,"header":"def column_float_formatter(self, col)","id":5177,"name":"column_float_formatter","nodeType":"Function","startLoc":115,"text":"def column_float_formatter(self, col):\n        \"\"\"\n        String formatter function for a column containing Float values.\n        Checks if the values in the given column are in Scientific notation,\n        by spliting the value string. It is assumed that the column either has\n        float values or Scientific notation.\n\n        A ``col.formatted_width`` attribute is added to the column. It is not added\n        if such an attribute is already present, say when the ``formats`` argument\n        is passed to the writer. A properly formatted format string is also added as\n        the ``col.format`` attribute.\n\n        Parameters\n        ----------\n        col : A ``Table.Column`` object.\n        \"\"\"\n        # maxsize: maximum length of string containing the float value.\n        # maxent: maximum number of digits places before decimal point.\n        # maxdec: maximum number of digits places after decimal point.\n        # maxprec: maximum precision of the column values, sum of maxent and maxdec.\n        maxsize, maxprec, maxent, maxdec = 1, 0, 1, 0\n        sign = False\n        fformat = 'F'\n\n        # Find maximum sized value in the col\n        for val in col.str_vals:\n            # Skip null values\n            if val is None or val == '':\n                continue\n\n            # Find format of the Float string\n            fmt = self._split_float_format(val)\n            # If value is in Scientific notation\n            if fmt[4] is True:\n                # if the previous column value was in normal Float format\n                # set maxsize, maxprec and maxdec to default.\n                if fformat == 'F':\n                    maxsize, maxprec, maxdec = 1, 0, 0\n                # Designate the column to be in Scientific notation.\n                fformat = 'E'\n            else:\n                # Move to next column value if\n                # current value is not in Scientific notation\n                # but the column is designated as such because\n                # one of the previous values was.\n                if fformat == 'E':\n                    continue\n\n            if maxsize < fmt[0]:\n                maxsize = fmt[0]\n            if maxent < fmt[1]:\n                maxent = fmt[1]\n            if maxdec < fmt[2]:\n                maxdec = fmt[2]\n            if fmt[3]:\n                sign = True\n\n            if maxprec < fmt[1] + fmt[2]:\n                maxprec = fmt[1] + fmt[2]\n\n        if fformat == 'E':\n            if getattr(col, 'formatted_width', None) is None:  # If ``formats`` not passed.\n                col.formatted_width = maxsize\n                if sign:\n                    col.formatted_width += 1\n            # Number of digits after decimal is replaced by the precision\n            # for values in Scientific notation, when writing that Format.\n            col.fortran_format = fformat + str(col.formatted_width) + \".\" + str(maxprec)\n            col.format = str(col.formatted_width) + \".\" + str(maxdec) + \"e\"\n        else:\n            lead = ''\n            if getattr(col, 'formatted_width', None) is None:  # If ``formats`` not passed.\n                col.formatted_width = maxent + maxdec + 1\n                if sign:\n                    col.formatted_width += 1\n            elif col.format.startswith('0'):\n                # Keep leading zero, if already set in format - primarily for `seconds` columns\n                # in coordinates; may need extra case if this is to be also supported with `sign`.\n                lead = '0'\n            col.fortran_format = fformat + str(col.formatted_width) + \".\" + str(maxdec)\n            col.format = lead + col.fortran_format[1:] + \"f\""},{"attributeType":"null","col":4,"comment":"null","endLoc":311,"id":5178,"name":"_format_name","nodeType":"Attribute","startLoc":311,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":312,"id":5179,"name":"_io_registry_format_aliases","nodeType":"Attribute","startLoc":312,"text":"_io_registry_format_aliases"},{"attributeType":"null","col":4,"comment":"null","endLoc":385,"id":5180,"name":"header_start","nodeType":"Attribute","startLoc":385,"text":"header_start"},{"attributeType":"null","col":4,"comment":"null","endLoc":313,"id":5181,"name":"_io_registry_suffix","nodeType":"Attribute","startLoc":313,"text":"_io_registry_suffix"},{"attributeType":"AASTexHeaderSplitter","col":4,"comment":"null","endLoc":386,"id":5182,"name":"splitter_class","nodeType":"Attribute","startLoc":386,"text":"splitter_class"},{"className":"AASTexData","col":0,"comment":"In a `deluxetable`_ the data is enclosed in `\\startdata` and `\\enddata`\n    ","endLoc":433,"id":5183,"nodeType":"Class","startLoc":413,"text":"class AASTexData(LatexData):\n    r'''In a `deluxetable`_ the data is enclosed in `\\startdata` and `\\enddata`\n    '''\n    data_start = r'\\startdata'\n    data_end = r'\\enddata'\n\n    def start_line(self, lines):\n        return find_latex_line(lines, self.data_start) + 1\n\n    def write(self, lines):\n        lines.append(self.data_start)\n        lines_length_initial = len(lines)\n        core.BaseData.write(self, lines)\n        # To remove extra space(s) and // appended which creates an extra new line\n        # in the end.\n        if len(lines) > lines_length_initial:\n            lines[-1] = re.sub(r'\\s* \\\\ \\\\ \\s* $', '', lines[-1],\n                               flags=re.VERBOSE)\n        lines.append(self.data_end)\n        add_dictval_to_list(self.latex, 'tablefoot', lines)\n        lines.append(r'\\end{' + self.latex['tabletype'] + r'}')"},{"col":4,"comment":"null","endLoc":420,"header":"def start_line(self, lines)","id":5184,"name":"start_line","nodeType":"Function","startLoc":419,"text":"def start_line(self, lines):\n        return find_latex_line(lines, self.data_start) + 1"},{"attributeType":"null","col":4,"comment":"null","endLoc":314,"id":5185,"name":"_description","nodeType":"Attribute","startLoc":314,"text":"_description"},{"col":4,"comment":"null","endLoc":433,"header":"def write(self, lines)","id":5186,"name":"write","nodeType":"Function","startLoc":422,"text":"def write(self, lines):\n        lines.append(self.data_start)\n        lines_length_initial = len(lines)\n        core.BaseData.write(self, lines)\n        # To remove extra space(s) and // appended which creates an extra new line\n        # in the end.\n        if len(lines) > lines_length_initial:\n            lines[-1] = re.sub(r'\\s* \\\\ \\\\ \\s* $', '', lines[-1],\n                               flags=re.VERBOSE)\n        lines.append(self.data_end)\n        add_dictval_to_list(self.latex, 'tablefoot', lines)\n        lines.append(r'\\end{' + self.latex['tabletype'] + r'}')"},{"attributeType":"null","col":4,"comment":"null","endLoc":503,"id":5187,"name":"comment","nodeType":"Attribute","startLoc":503,"text":"comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":504,"id":5188,"name":"write_comment","nodeType":"Attribute","startLoc":504,"text":"write_comment"},{"className":"QDPData","col":0,"comment":"\n    Data that uses the :class:`astropy.io.ascii.basic.CsvSplitter`\n    ","endLoc":514,"id":5189,"nodeType":"Class","startLoc":507,"text":"class QDPData(basic.BasicData):\n    \"\"\"\n    Data that uses the :class:`astropy.io.ascii.basic.CsvSplitter`\n    \"\"\"\n    splitter_class = QDPSplitter\n    fill_values = [(core.masked, 'NO')]\n    comment = \"!\"\n    write_comment = None"},{"attributeType":"QDPSplitter","col":4,"comment":"null","endLoc":511,"id":5190,"name":"splitter_class","nodeType":"Attribute","startLoc":511,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":28,"id":5191,"name":"_subfmt","nodeType":"Attribute","startLoc":28,"text":"_subfmt"},{"attributeType":"null","col":4,"comment":"The ReadMe file to construct header from.","endLoc":30,"id":5192,"name":"col_type_map","nodeType":"Attribute","startLoc":30,"text":"col_type_map"},{"attributeType":"None","col":4,"comment":"null","endLoc":36,"id":5193,"name":"readme","nodeType":"Attribute","startLoc":36,"text":"readme"},{"attributeType":"null","col":8,"comment":"null","endLoc":170,"id":5194,"name":"names","nodeType":"Attribute","startLoc":170,"text":"self.names"},{"attributeType":"null","col":4,"comment":"null","endLoc":512,"id":5195,"name":"fill_values","nodeType":"Attribute","startLoc":512,"text":"fill_values"},{"attributeType":"null","col":8,"comment":"null","endLoc":172,"id":5196,"name":"cols","nodeType":"Attribute","startLoc":172,"text":"self.cols"},{"attributeType":"null","col":4,"comment":"null","endLoc":513,"id":5197,"name":"comment","nodeType":"Attribute","startLoc":513,"text":"comment"},{"attributeType":"None","col":4,"comment":"null","endLoc":514,"id":5198,"name":"write_comment","nodeType":"Attribute","startLoc":514,"text":"write_comment"},{"className":"QDP","col":0,"comment":"Quick and Dandy Plot table.\n\n    Example::\n\n        ! Initial comment line 1\n        ! Initial comment line 2\n        READ TERR 1\n        READ SERR 3\n        ! Table 0 comment\n        !a a(pos) a(neg) b be c d\n        53000.5   0.25  -0.5   1  1.5  3.5 2\n        54000.5   1.25  -1.5   2  2.5  4.5 3\n        NO NO NO NO NO\n        ! Table 1 comment\n        !a a(pos) a(neg) b be c d\n        54000.5   2.25  -2.5   NO  3.5  5.5 5\n        55000.5   3.25  -3.5   4  4.5  6.5 nan\n\n    The input table above contains some initial comments, the error commands,\n    then two tables.\n    This file format can contain multiple tables, separated by a line full\n    of ``NO``s. Comments are exclamation marks, and missing values are single\n    ``NO`` entries. The delimiter is usually whitespace, more rarely a comma.\n    The QDP format differentiates between data and error columns. The table\n    above has commands::\n\n        READ TERR 1\n        READ SERR 3\n\n    which mean that after data column 1 there will be two error columns\n    containing its positive and engative error bars, then data column 2 without\n    error bars, then column 3, then a column with the symmetric error of column\n    3, then the remaining data columns.\n\n    As explained below, table headers are highly inconsistent. Possible\n    comments containing column names will be ignored and columns will be called\n    ``col1``, ``col2``, etc. unless the user specifies their names with the\n    ``names=`` keyword argument,\n    When passing column names, pass **only the names of the data columns, not\n    the error columns.**\n    Error information will be encoded in the names of the table columns.\n    (e.g. ``a_perr`` and ``a_nerr`` for the positive and negative error of\n    column ``a``, ``b_err`` the symmetric error of column ``b``.)\n\n    When writing tables to this format, users can pass an ``err_specs`` keyword\n    passing a dictionary ``{'serr': [3], 'terr': [1, 2]}``, meaning that data\n    columns 1 and two will have two additional columns each with their positive\n    and negative errors, and data column 3 will have an additional column with\n    a symmetric error (just like the ``READ SERR`` and ``READ TERR`` commands\n    above)\n\n    Headers are just comments, and tables distributed by various missions\n    can differ greatly in their use of conventions. For example, light curves\n    distributed by the Swift-Gehrels mission have an extra space in one header\n    entry that makes the number of labels inconsistent with the number of cols.\n    For this reason, we ignore the comments that might encode the column names\n    and leave the name specification to the user.\n\n    Example::\n\n        >               Extra space\n        >                   |\n        >                   v\n        >!     MJD       Err (pos)       Err(neg)        Rate            Error\n        >53000.123456   2.378e-05     -2.378472e-05     NO             0.212439\n\n    These readers and writer classes will strive to understand which of the\n    comments belong to all the tables, and which ones to each single table.\n    General comments will be stored in the ``initial_comments`` meta of each\n    table. The comments of each table will be stored in the ``comments`` meta.\n\n    Example::\n\n        t = Table.read(example_qdp, format='ascii.qdp', table_id=1, names=['a', 'b', 'c', 'd'])\n\n    reads the second table (``table_id=1``) in file ``example.qdp`` containing\n    the table above. There are four column names but seven data columns, why?\n    Because the ``READ SERR`` and ``READ TERR`` commands say that there are\n    three error columns.\n    ``t.meta['initial_comments']`` will contain the initial two comment lines\n    in the file, while ``t.meta['comments']`` will contain ``Table 1 comment``\n\n    The table can be written to another file, preserving the same information,\n    as::\n\n        t.write(test_file, err_specs={'terr': [1], 'serr': [3]})\n\n    Note how the ``terr`` and ``serr`` commands are passed to the writer.\n\n    ","endLoc":631,"id":5199,"nodeType":"Class","startLoc":517,"text":"class QDP(basic.Basic):\n    \"\"\"Quick and Dandy Plot table.\n\n    Example::\n\n        ! Initial comment line 1\n        ! Initial comment line 2\n        READ TERR 1\n        READ SERR 3\n        ! Table 0 comment\n        !a a(pos) a(neg) b be c d\n        53000.5   0.25  -0.5   1  1.5  3.5 2\n        54000.5   1.25  -1.5   2  2.5  4.5 3\n        NO NO NO NO NO\n        ! Table 1 comment\n        !a a(pos) a(neg) b be c d\n        54000.5   2.25  -2.5   NO  3.5  5.5 5\n        55000.5   3.25  -3.5   4  4.5  6.5 nan\n\n    The input table above contains some initial comments, the error commands,\n    then two tables.\n    This file format can contain multiple tables, separated by a line full\n    of ``NO``s. Comments are exclamation marks, and missing values are single\n    ``NO`` entries. The delimiter is usually whitespace, more rarely a comma.\n    The QDP format differentiates between data and error columns. The table\n    above has commands::\n\n        READ TERR 1\n        READ SERR 3\n\n    which mean that after data column 1 there will be two error columns\n    containing its positive and engative error bars, then data column 2 without\n    error bars, then column 3, then a column with the symmetric error of column\n    3, then the remaining data columns.\n\n    As explained below, table headers are highly inconsistent. Possible\n    comments containing column names will be ignored and columns will be called\n    ``col1``, ``col2``, etc. unless the user specifies their names with the\n    ``names=`` keyword argument,\n    When passing column names, pass **only the names of the data columns, not\n    the error columns.**\n    Error information will be encoded in the names of the table columns.\n    (e.g. ``a_perr`` and ``a_nerr`` for the positive and negative error of\n    column ``a``, ``b_err`` the symmetric error of column ``b``.)\n\n    When writing tables to this format, users can pass an ``err_specs`` keyword\n    passing a dictionary ``{'serr': [3], 'terr': [1, 2]}``, meaning that data\n    columns 1 and two will have two additional columns each with their positive\n    and negative errors, and data column 3 will have an additional column with\n    a symmetric error (just like the ``READ SERR`` and ``READ TERR`` commands\n    above)\n\n    Headers are just comments, and tables distributed by various missions\n    can differ greatly in their use of conventions. For example, light curves\n    distributed by the Swift-Gehrels mission have an extra space in one header\n    entry that makes the number of labels inconsistent with the number of cols.\n    For this reason, we ignore the comments that might encode the column names\n    and leave the name specification to the user.\n\n    Example::\n\n        >               Extra space\n        >                   |\n        >                   v\n        >!     MJD       Err (pos)       Err(neg)        Rate            Error\n        >53000.123456   2.378e-05     -2.378472e-05     NO             0.212439\n\n    These readers and writer classes will strive to understand which of the\n    comments belong to all the tables, and which ones to each single table.\n    General comments will be stored in the ``initial_comments`` meta of each\n    table. The comments of each table will be stored in the ``comments`` meta.\n\n    Example::\n\n        t = Table.read(example_qdp, format='ascii.qdp', table_id=1, names=['a', 'b', 'c', 'd'])\n\n    reads the second table (``table_id=1``) in file ``example.qdp`` containing\n    the table above. There are four column names but seven data columns, why?\n    Because the ``READ SERR`` and ``READ TERR`` commands say that there are\n    three error columns.\n    ``t.meta['initial_comments']`` will contain the initial two comment lines\n    in the file, while ``t.meta['comments']`` will contain ``Table 1 comment``\n\n    The table can be written to another file, preserving the same information,\n    as::\n\n        t.write(test_file, err_specs={'terr': [1], 'serr': [3]})\n\n    Note how the ``terr`` and ``serr`` commands are passed to the writer.\n\n    \"\"\"\n    _format_name = 'qdp'\n    _io_registry_can_write = True\n    _io_registry_suffix = '.qdp'\n    _description = 'Quick and Dandy Plotter'\n\n    header_class = QDPHeader\n    data_class = QDPData\n\n    def __init__(self, table_id=None, names=None, err_specs=None, sep=None):\n        super().__init__()\n        self.table_id = table_id\n        self.names = names\n        self.err_specs = err_specs\n        self.delimiter = sep\n\n    def read(self, table):\n        self.lines = self.inputter.get_lines(table, newline=\"\\n\")\n        return _read_table_qdp(self.lines, table_id=self.table_id,\n                               names=self.names, delimiter=self.delimiter)\n\n    def write(self, table):\n        self._check_multidim_table(table)\n        lines = _write_table_qdp(table, err_specs=self.err_specs)\n        return lines"},{"className":"CdsData","col":0,"comment":"CDS table data reader\n    ","endLoc":193,"id":5200,"nodeType":"Class","startLoc":175,"text":"class CdsData(core.BaseData):\n    \"\"\"CDS table data reader\n    \"\"\"\n    _subfmt = 'CDS'\n    splitter_class = fixedwidth.FixedWidthSplitter\n\n    def process_lines(self, lines):\n        \"\"\"Skip over CDS/MRT header by finding the last section delimiter\"\"\"\n        # If the header has a ReadMe and data has a filename\n        # then no need to skip, as the data lines do not have header\n        # info. The ``read`` method adds the table_name to the ``data``\n        # attribute.\n        if self.header.readme and self.table_name:\n            return lines\n        i_sections = [i for i, x in enumerate(lines)\n                      if x.startswith(('------', '======='))]\n        if not i_sections:\n            raise core.InconsistentTableError(f'No {self._subfmt} section delimiter found')\n        return lines[i_sections[-1]+1:]  # noqa"},{"attributeType":"HTMLHeader","col":4,"comment":"null","endLoc":316,"id":5201,"name":"header_class","nodeType":"Attribute","startLoc":316,"text":"header_class"},{"col":4,"comment":"Skip over CDS/MRT header by finding the last section delimiter","endLoc":193,"header":"def process_lines(self, lines)","id":5202,"name":"process_lines","nodeType":"Function","startLoc":181,"text":"def process_lines(self, lines):\n        \"\"\"Skip over CDS/MRT header by finding the last section delimiter\"\"\"\n        # If the header has a ReadMe and data has a filename\n        # then no need to skip, as the data lines do not have header\n        # info. The ``read`` method adds the table_name to the ``data``\n        # attribute.\n        if self.header.readme and self.table_name:\n            return lines\n        i_sections = [i for i, x in enumerate(lines)\n                      if x.startswith(('------', '======='))]\n        if not i_sections:\n            raise core.InconsistentTableError(f'No {self._subfmt} section delimiter found')\n        return lines[i_sections[-1]+1:]  # noqa"},{"attributeType":"null","col":4,"comment":"null","endLoc":416,"id":5203,"name":"data_start","nodeType":"Attribute","startLoc":416,"text":"data_start"},{"attributeType":"null","col":4,"comment":"null","endLoc":417,"id":5204,"name":"data_end","nodeType":"Attribute","startLoc":417,"text":"data_end"},{"attributeType":"HTMLData","col":4,"comment":"null","endLoc":317,"id":5205,"name":"data_class","nodeType":"Attribute","startLoc":317,"text":"data_class"},{"className":"AASTex","col":0,"comment":"AASTeX format table.\n\n    This class implements some AASTeX specific commands.\n    AASTeX is used for the AAS (American Astronomical Society)\n    publications like ApJ, ApJL and AJ.\n\n    It derives from the ``Latex`` reader and accepts the same\n    keywords.  However, the keywords ``header_start``, ``header_end``,\n    ``data_start`` and ``data_end`` in ``latexdict`` have no effect.\n    ","endLoc":460,"id":5206,"nodeType":"Class","startLoc":436,"text":"class AASTex(Latex):\n    '''AASTeX format table.\n\n    This class implements some AASTeX specific commands.\n    AASTeX is used for the AAS (American Astronomical Society)\n    publications like ApJ, ApJL and AJ.\n\n    It derives from the ``Latex`` reader and accepts the same\n    keywords.  However, the keywords ``header_start``, ``header_end``,\n    ``data_start`` and ``data_end`` in ``latexdict`` have no effect.\n    '''\n\n    _format_name = 'aastex'\n    _io_registry_format_aliases = ['aastex']\n    _io_registry_suffix = ''  # AASTex inherits from Latex, so override this class attr\n    _description = 'AASTeX deluxetable used for AAS journals'\n\n    header_class = AASTexHeader\n    data_class = AASTexData\n\n    def __init__(self, **kwargs):\n        super().__init__(**kwargs)\n        # check if tabletype was explicitly set by the user\n        if not (('latexdict' in kwargs) and ('tabletype' in kwargs['latexdict'])):\n            self.latex['tabletype'] = 'deluxetable'"},{"col":4,"comment":"null","endLoc":460,"header":"def __init__(self, **kwargs)","id":5207,"name":"__init__","nodeType":"Function","startLoc":456,"text":"def __init__(self, **kwargs):\n        super().__init__(**kwargs)\n        # check if tabletype was explicitly set by the user\n        if not (('latexdict' in kwargs) and ('tabletype' in kwargs['latexdict'])):\n            self.latex['tabletype'] = 'deluxetable'"},{"col":4,"comment":"null","endLoc":621,"header":"def __init__(self, table_id=None, names=None, err_specs=None, sep=None)","id":5208,"name":"__init__","nodeType":"Function","startLoc":616,"text":"def __init__(self, table_id=None, names=None, err_specs=None, sep=None):\n        super().__init__()\n        self.table_id = table_id\n        self.names = names\n        self.err_specs = err_specs\n        self.delimiter = sep"},{"attributeType":"HTMLInputter","col":4,"comment":"null","endLoc":318,"id":5209,"name":"inputter_class","nodeType":"Attribute","startLoc":318,"text":"inputter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":320,"id":5210,"name":"max_ndim","nodeType":"Attribute","startLoc":320,"text":"max_ndim"},{"attributeType":"null","col":4,"comment":"null","endLoc":178,"id":5211,"name":"_subfmt","nodeType":"Attribute","startLoc":178,"text":"_subfmt"},{"attributeType":"FixedWidthSplitter","col":4,"comment":"null","endLoc":179,"id":5212,"name":"splitter_class","nodeType":"Attribute","startLoc":179,"text":"splitter_class"},{"attributeType":"null","col":8,"comment":"null","endLoc":327,"id":5213,"name":"html","nodeType":"Attribute","startLoc":327,"text":"self.html"},{"attributeType":"HTMLOutputter","col":8,"comment":"null","endLoc":339,"id":5214,"name":"outputter","nodeType":"Attribute","startLoc":339,"text":"self.outputter"},{"attributeType":"null","col":4,"comment":"null","endLoc":448,"id":5215,"name":"_format_name","nodeType":"Attribute","startLoc":448,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":449,"id":5216,"name":"_io_registry_format_aliases","nodeType":"Attribute","startLoc":449,"text":"_io_registry_format_aliases"},{"attributeType":"null","col":4,"comment":"null","endLoc":450,"id":5217,"name":"_io_registry_suffix","nodeType":"Attribute","startLoc":450,"text":"_io_registry_suffix"},{"attributeType":"null","col":4,"comment":"null","endLoc":451,"id":5218,"name":"_description","nodeType":"Attribute","startLoc":451,"text":"_description"},{"className":"Cds","col":0,"comment":"CDS format table.\n\n    See: http://vizier.u-strasbg.fr/doc/catstd.htx\n\n    Example::\n\n      Table: Table name here\n      = ==============================================================================\n      Catalog reference paper\n          Bibliography info here\n      ================================================================================\n      ADC_Keywords: Keyword ; Another keyword ; etc\n\n      Description:\n          Catalog description here.\n      ================================================================================\n      Byte-by-byte Description of file: datafile3.txt\n      --------------------------------------------------------------------------------\n         Bytes Format Units  Label  Explanations\n      --------------------------------------------------------------------------------\n         1-  3 I3     ---    Index  Running identification number\n         5-  6 I2     h      RAh    Hour of Right Ascension (J2000)\n         8-  9 I2     min    RAm    Minute of Right Ascension (J2000)\n        11- 15 F5.2   s      RAs    Second of Right Ascension (J2000)\n      --------------------------------------------------------------------------------\n      Note (1): A CDS file can contain sections with various metadata.\n                Notes can be multiple lines.\n      Note (2): Another note.\n      --------------------------------------------------------------------------------\n        1 03 28 39.09\n        2 04 18 24.11\n\n    **About parsing the CDS format**\n\n    The CDS format consists of a table description and the table data.  These\n    can be in separate files as a ``ReadMe`` file plus data file(s), or\n    combined in a single file.  Different subsections within the description\n    are separated by lines of dashes or equal signs (\"------\" or \"======\").\n    The table which specifies the column information must be preceded by a line\n    starting with \"Byte-by-byte Description of file:\".\n\n    In the case where the table description is combined with the data values,\n    the data must be in the last section and must be preceded by a section\n    delimiter line (dashes or equal signs only).\n\n    **Basic usage**\n\n    Use the ``ascii.read()`` function as normal, with an optional ``readme``\n    parameter indicating the CDS ReadMe file.  If not supplied it is assumed that\n    the header information is at the top of the given table.  Examples::\n\n      >>> from astropy.io import ascii\n      >>> table = ascii.read(\"data/cds.dat\")\n      >>> table = ascii.read(\"data/vizier/table1.dat\", readme=\"data/vizier/ReadMe\")\n      >>> table = ascii.read(\"data/cds/multi/lhs2065.dat\", readme=\"data/cds/multi/ReadMe\")\n      >>> table = ascii.read(\"data/cds/glob/lmxbrefs.dat\", readme=\"data/cds/glob/ReadMe\")\n\n    The table name and the CDS ReadMe file can be entered as URLs.  This can be used\n    to directly load tables from the Internet.  For example, Vizier tables from the\n    CDS::\n\n      >>> table = ascii.read(\"ftp://cdsarc.u-strasbg.fr/pub/cats/VII/253/snrs.dat\",\n      ...             readme=\"ftp://cdsarc.u-strasbg.fr/pub/cats/VII/253/ReadMe\")\n\n    If the header (ReadMe) and data are stored in a single file and there\n    is content between the header and the data (for instance Notes), then the\n    parsing process may fail.  In this case you can instruct the reader to\n    guess the actual start of the data by supplying ``data_start='guess'`` in the\n    call to the ``ascii.read()`` function.  You should verify that the output\n    data table matches expectation based on the input CDS file.\n\n    **Using a reader object**\n\n    When ``Cds`` reader object is created with a ``readme`` parameter\n    passed to it at initialization, then when the ``read`` method is\n    executed with a table filename, the header information for the\n    specified table is taken from the ``readme`` file.  An\n    ``InconsistentTableError`` is raised if the ``readme`` file does not\n    have header information for the given table.\n\n      >>> readme = \"data/vizier/ReadMe\"\n      >>> r = ascii.get_reader(ascii.Cds, readme=readme)\n      >>> table = r.read(\"data/vizier/table1.dat\")\n      >>> # table5.dat has the same ReadMe file\n      >>> table = r.read(\"data/vizier/table5.dat\")\n\n    If no ``readme`` parameter is specified, then the header\n    information is assumed to be at the top of the given table.\n\n      >>> r = ascii.get_reader(ascii.Cds)\n      >>> table = r.read(\"data/cds.dat\")\n      >>> #The following gives InconsistentTableError, since no\n      >>> #readme file was given and table1.dat does not have a header.\n      >>> table = r.read(\"data/vizier/table1.dat\")\n      Traceback (most recent call last):\n        ...\n      InconsistentTableError: No CDS section delimiter found\n\n    Caveats:\n\n    * The Units and Explanations are available in the column ``unit`` and\n      ``description`` attributes, respectively.\n    * The other metadata defined by this format is not available in the output table.\n    ","endLoc":343,"id":5219,"nodeType":"Class","startLoc":196,"text":"class Cds(core.BaseReader):\n    \"\"\"CDS format table.\n\n    See: http://vizier.u-strasbg.fr/doc/catstd.htx\n\n    Example::\n\n      Table: Table name here\n      = ==============================================================================\n      Catalog reference paper\n          Bibliography info here\n      ================================================================================\n      ADC_Keywords: Keyword ; Another keyword ; etc\n\n      Description:\n          Catalog description here.\n      ================================================================================\n      Byte-by-byte Description of file: datafile3.txt\n      --------------------------------------------------------------------------------\n         Bytes Format Units  Label  Explanations\n      --------------------------------------------------------------------------------\n         1-  3 I3     ---    Index  Running identification number\n         5-  6 I2     h      RAh    Hour of Right Ascension (J2000)\n         8-  9 I2     min    RAm    Minute of Right Ascension (J2000)\n        11- 15 F5.2   s      RAs    Second of Right Ascension (J2000)\n      --------------------------------------------------------------------------------\n      Note (1): A CDS file can contain sections with various metadata.\n                Notes can be multiple lines.\n      Note (2): Another note.\n      --------------------------------------------------------------------------------\n        1 03 28 39.09\n        2 04 18 24.11\n\n    **About parsing the CDS format**\n\n    The CDS format consists of a table description and the table data.  These\n    can be in separate files as a ``ReadMe`` file plus data file(s), or\n    combined in a single file.  Different subsections within the description\n    are separated by lines of dashes or equal signs (\"------\" or \"======\").\n    The table which specifies the column information must be preceded by a line\n    starting with \"Byte-by-byte Description of file:\".\n\n    In the case where the table description is combined with the data values,\n    the data must be in the last section and must be preceded by a section\n    delimiter line (dashes or equal signs only).\n\n    **Basic usage**\n\n    Use the ``ascii.read()`` function as normal, with an optional ``readme``\n    parameter indicating the CDS ReadMe file.  If not supplied it is assumed that\n    the header information is at the top of the given table.  Examples::\n\n      >>> from astropy.io import ascii\n      >>> table = ascii.read(\"data/cds.dat\")\n      >>> table = ascii.read(\"data/vizier/table1.dat\", readme=\"data/vizier/ReadMe\")\n      >>> table = ascii.read(\"data/cds/multi/lhs2065.dat\", readme=\"data/cds/multi/ReadMe\")\n      >>> table = ascii.read(\"data/cds/glob/lmxbrefs.dat\", readme=\"data/cds/glob/ReadMe\")\n\n    The table name and the CDS ReadMe file can be entered as URLs.  This can be used\n    to directly load tables from the Internet.  For example, Vizier tables from the\n    CDS::\n\n      >>> table = ascii.read(\"ftp://cdsarc.u-strasbg.fr/pub/cats/VII/253/snrs.dat\",\n      ...             readme=\"ftp://cdsarc.u-strasbg.fr/pub/cats/VII/253/ReadMe\")\n\n    If the header (ReadMe) and data are stored in a single file and there\n    is content between the header and the data (for instance Notes), then the\n    parsing process may fail.  In this case you can instruct the reader to\n    guess the actual start of the data by supplying ``data_start='guess'`` in the\n    call to the ``ascii.read()`` function.  You should verify that the output\n    data table matches expectation based on the input CDS file.\n\n    **Using a reader object**\n\n    When ``Cds`` reader object is created with a ``readme`` parameter\n    passed to it at initialization, then when the ``read`` method is\n    executed with a table filename, the header information for the\n    specified table is taken from the ``readme`` file.  An\n    ``InconsistentTableError`` is raised if the ``readme`` file does not\n    have header information for the given table.\n\n      >>> readme = \"data/vizier/ReadMe\"\n      >>> r = ascii.get_reader(ascii.Cds, readme=readme)\n      >>> table = r.read(\"data/vizier/table1.dat\")\n      >>> # table5.dat has the same ReadMe file\n      >>> table = r.read(\"data/vizier/table5.dat\")\n\n    If no ``readme`` parameter is specified, then the header\n    information is assumed to be at the top of the given table.\n\n      >>> r = ascii.get_reader(ascii.Cds)\n      >>> table = r.read(\"data/cds.dat\")\n      >>> #The following gives InconsistentTableError, since no\n      >>> #readme file was given and table1.dat does not have a header.\n      >>> table = r.read(\"data/vizier/table1.dat\")\n      Traceback (most recent call last):\n        ...\n      InconsistentTableError: No CDS section delimiter found\n\n    Caveats:\n\n    * The Units and Explanations are available in the column ``unit`` and\n      ``description`` attributes, respectively.\n    * The other metadata defined by this format is not available in the output table.\n    \"\"\"\n    _format_name = 'cds'\n    _io_registry_format_aliases = ['cds']\n    _io_registry_can_write = False\n    _description = 'CDS format table'\n\n    data_class = CdsData\n    header_class = CdsHeader\n\n    def __init__(self, readme=None):\n        super().__init__()\n        self.header.readme = readme\n\n    def write(self, table=None):\n        \"\"\"Not available for the CDS class (raises NotImplementedError)\"\"\"\n        raise NotImplementedError\n\n    def read(self, table):\n        # If the read kwarg `data_start` is 'guess' then the table may have extraneous\n        # lines between the end of the header and the beginning of data.\n        if self.data.start_line == 'guess':\n            # Replicate the first part of BaseReader.read up to the point where\n            # the table lines are initially read in.\n            with suppress(TypeError):\n                # For strings only\n                if os.linesep not in table + '':\n                    self.data.table_name = os.path.basename(table)\n\n            self.data.header = self.header\n            self.header.data = self.data\n\n            # Get a list of the lines (rows) in the table\n            lines = self.inputter.get_lines(table)\n\n            # Now try increasing data.start_line by one until the table reads successfully.\n            # For efficiency use the in-memory list of lines instead of `table`, which\n            # could be a file.\n            for data_start in range(len(lines)):\n                self.data.start_line = data_start\n                with suppress(Exception):\n                    table = super().read(lines)\n                    return table\n        else:\n            return super().read(table)"},{"attributeType":"AASTexHeader","col":4,"comment":"null","endLoc":453,"id":5220,"name":"header_class","nodeType":"Attribute","startLoc":453,"text":"header_class"},{"col":0,"comment":"","endLoc":9,"header":"html.py#<anonymous>","id":5221,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"An extensible HTML table reader and writer.\n\nhtml.py:\n  Classes to read and write HTML tables\n\n`BeautifulSoup <http://www.crummy.com/software/BeautifulSoup/>`_\nmust be installed to read HTML tables.\n\"\"\""},{"attributeType":"AASTexData","col":4,"comment":"null","endLoc":454,"id":5222,"name":"data_class","nodeType":"Attribute","startLoc":454,"text":"data_class"},{"col":4,"comment":"null","endLoc":311,"header":"def __init__(self, readme=None)","id":5223,"name":"__init__","nodeType":"Function","startLoc":309,"text":"def __init__(self, readme=None):\n        super().__init__()\n        self.header.readme = readme"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":5224,"name":"latexdicts","nodeType":"Attribute","startLoc":16,"text":"latexdicts"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":5225,"name":"RE_COMMENT","nodeType":"Attribute","startLoc":32,"text":"RE_COMMENT"},{"col":0,"comment":"","endLoc":9,"header":"latex.py#<anonymous>","id":5226,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"An extensible ASCII table reader and writer.\n\nlatex.py:\n  Classes to read and write LaTeX tables\n\n:Copyright: Smithsonian Astrophysical Observatory (2011)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\"\n\nlatexdicts = {'AA': {'tabletype': 'table',\n                     'header_start': r'\\hline \\hline', 'header_end': r'\\hline',\n                     'data_end': r'\\hline'},\n              'doublelines': {'tabletype': 'table',\n                              'header_start': r'\\hline \\hline', 'header_end': r'\\hline\\hline',\n                              'data_end': r'\\hline\\hline'},\n              'template': {'tabletype': 'tabletype', 'caption': 'caption',\n                           'tablealign': 'tablealign',\n                           'col_align': 'col_align', 'preamble': 'preamble',\n                           'header_start': 'header_start',\n                           'header_end': 'header_end', 'data_start': 'data_start',\n                           'data_end': 'data_end', 'tablefoot': 'tablefoot',\n                           'units': {'col1': 'unit of col1', 'col2': 'unit of col2'}}\n              }\n\nRE_COMMENT = re.compile(r'(?<!\\\\)%')  # % character but not \\%"},{"fileName":"core.py","filePath":"astropy/io/ascii","id":5227,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\" An extensible ASCII table reader and writer.\n\ncore.py:\n  Core base classes and functions for reading and writing tables.\n\n:Copyright: Smithsonian Astrophysical Observatory (2010)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\"\n\n\nimport copy\nimport csv\nimport functools\nimport itertools\nimport operator\nimport os\nimport re\nimport warnings\nimport inspect\nimport fnmatch\n\nfrom collections import OrderedDict\nfrom contextlib import suppress\nfrom io import StringIO\n\nimport numpy\n\nfrom astropy.utils.exceptions import AstropyWarning\n\nfrom astropy.table import Table\nfrom astropy.utils.data import get_readable_fileobj\nfrom . import connect\nfrom .docs import READ_DOCSTRING, WRITE_DOCSTRING\n\n# Global dictionary mapping format arg to the corresponding Reader class\nFORMAT_CLASSES = {}\n\n# Similar dictionary for fast readers\nFAST_CLASSES = {}\n\n\ndef _check_multidim_table(table, max_ndim):\n    \"\"\"Check that ``table`` has only columns with ndim <= ``max_ndim``\n\n    Currently ECSV is the only built-in format that supports output of arbitrary\n    N-d columns, but HTML supports 2-d.\n    \"\"\"\n    # No limit?\n    if max_ndim is None:\n        return\n\n    # Check for N-d columns\n    nd_names = [col.info.name for col in table.itercols() if len(col.shape) > max_ndim]\n    if nd_names:\n        raise ValueError(f'column(s) with dimension > {max_ndim} '\n                         \"cannot be be written with this format, try using 'ecsv' \"\n                         \"(Enhanced CSV) format\")\n\n\nclass CsvWriter:\n    \"\"\"\n    Internal class to replace the csv writer ``writerow`` and ``writerows``\n    functions so that in the case of ``delimiter=' '`` and\n    ``quoting=csv.QUOTE_MINIMAL``, the output field value is quoted for empty\n    fields (when value == '').\n\n    This changes the API slightly in that the writerow() and writerows()\n    methods return the output written string instead of the length of\n    that string.\n\n    Examples\n    --------\n\n    >>> from astropy.io.ascii.core import CsvWriter\n    >>> writer = CsvWriter(delimiter=' ')\n    >>> print(writer.writerow(['hello', '', 'world']))\n    hello \"\" world\n    \"\"\"\n    # Random 16-character string that gets injected instead of any\n    # empty fields and is then replaced post-write with doubled-quotechar.\n    # Created with:\n    # ''.join(random.choice(string.printable[:90]) for _ in range(16))\n    replace_sentinel = '2b=48Av%0-V3p>bX'\n\n    def __init__(self, csvfile=None, **kwargs):\n        self.csvfile = csvfile\n\n        # Temporary StringIO for catching the real csv.writer() object output\n        self.temp_out = StringIO()\n        self.writer = csv.writer(self.temp_out, **kwargs)\n\n        dialect = self.writer.dialect\n        self.quotechar2 = dialect.quotechar * 2\n        self.quote_empty = (dialect.quoting == csv.QUOTE_MINIMAL) and (dialect.delimiter == ' ')\n\n    def writerow(self, values):\n        \"\"\"\n        Similar to csv.writer.writerow but with the custom quoting behavior.\n        Returns the written string instead of the length of that string.\n        \"\"\"\n        has_empty = False\n\n        # If QUOTE_MINIMAL and space-delimited then replace empty fields with\n        # the sentinel value.\n        if self.quote_empty:\n            for i, value in enumerate(values):\n                if value == '':\n                    has_empty = True\n                    values[i] = self.replace_sentinel\n\n        return self._writerow(self.writer.writerow, values, has_empty)\n\n    def writerows(self, values_list):\n        \"\"\"\n        Similar to csv.writer.writerows but with the custom quoting behavior.\n        Returns the written string instead of the length of that string.\n        \"\"\"\n        has_empty = False\n\n        # If QUOTE_MINIMAL and space-delimited then replace empty fields with\n        # the sentinel value.\n        if self.quote_empty:\n            for values in values_list:\n                for i, value in enumerate(values):\n                    if value == '':\n                        has_empty = True\n                        values[i] = self.replace_sentinel\n\n        return self._writerow(self.writer.writerows, values_list, has_empty)\n\n    def _writerow(self, writerow_func, values, has_empty):\n        \"\"\"\n        Call ``writerow_func`` (either writerow or writerows) with ``values``.\n        If it has empty fields that have been replaced then change those\n        sentinel strings back to quoted empty strings, e.g. ``\"\"``.\n        \"\"\"\n        # Clear the temporary StringIO buffer that self.writer writes into and\n        # then call the real csv.writer().writerow or writerows with values.\n        self.temp_out.seek(0)\n        self.temp_out.truncate()\n        writerow_func(values)\n\n        row_string = self.temp_out.getvalue()\n\n        if self.quote_empty and has_empty:\n            row_string = re.sub(self.replace_sentinel, self.quotechar2, row_string)\n\n        # self.csvfile is defined then write the output.  In practice the pure\n        # Python writer calls with csvfile=None, while the fast writer calls with\n        # a file-like object.\n        if self.csvfile:\n            self.csvfile.write(row_string)\n\n        return row_string\n\n\nclass MaskedConstant(numpy.ma.core.MaskedConstant):\n    \"\"\"A trivial extension of numpy.ma.masked\n\n    We want to be able to put the generic term ``masked`` into a dictionary.\n    The constant ``numpy.ma.masked`` is not hashable (see\n    https://github.com/numpy/numpy/issues/4660), so we need to extend it\n    here with a hash value.\n\n    See https://github.com/numpy/numpy/issues/11021 for rationale for\n    __copy__ and __deepcopy__ methods.\n    \"\"\"\n\n    def __hash__(self):\n        '''All instances of this class shall have the same hash.'''\n        # Any large number will do.\n        return 1234567890\n\n    def __copy__(self):\n        \"\"\"This is a singleton so just return self.\"\"\"\n        return self\n\n    def __deepcopy__(self, memo):\n        return self\n\n\nmasked = MaskedConstant()\n\n\nclass InconsistentTableError(ValueError):\n    \"\"\"\n    Indicates that an input table is inconsistent in some way.\n\n    The default behavior of ``BaseReader`` is to throw an instance of\n    this class if a data row doesn't match the header.\n    \"\"\"\n\n\nclass OptionalTableImportError(ImportError):\n    \"\"\"\n    Indicates that a dependency for table reading is not present.\n\n    An instance of this class is raised whenever an optional reader\n    with certain required dependencies cannot operate because of\n    an ImportError.\n    \"\"\"\n\n\nclass ParameterError(NotImplementedError):\n    \"\"\"\n    Indicates that a reader cannot handle a passed parameter.\n\n    The C-based fast readers in ``io.ascii`` raise an instance of\n    this error class upon encountering a parameter that the\n    C engine cannot handle.\n    \"\"\"\n\n\nclass FastOptionsError(NotImplementedError):\n    \"\"\"\n    Indicates that one of the specified options for fast\n    reading is invalid.\n    \"\"\"\n\n\nclass NoType:\n    \"\"\"\n    Superclass for ``StrType`` and ``NumType`` classes.\n\n    This class is the default type of ``Column`` and provides a base\n    class for other data types.\n    \"\"\"\n\n\nclass StrType(NoType):\n    \"\"\"\n    Indicates that a column consists of text data.\n    \"\"\"\n\n\nclass NumType(NoType):\n    \"\"\"\n    Indicates that a column consists of numerical data.\n    \"\"\"\n\n\nclass FloatType(NumType):\n    \"\"\"\n    Describes floating-point data.\n    \"\"\"\n\n\nclass BoolType(NoType):\n    \"\"\"\n    Describes boolean data.\n    \"\"\"\n\n\nclass IntType(NumType):\n    \"\"\"\n    Describes integer data.\n    \"\"\"\n\n\nclass AllType(StrType, FloatType, IntType):\n    \"\"\"\n    Subclass of all other data types.\n\n    This type is returned by ``convert_numpy`` if the given numpy\n    type does not match ``StrType``, ``FloatType``, or ``IntType``.\n    \"\"\"\n\n\nclass Column:\n    \"\"\"Table column.\n\n    The key attributes of a Column object are:\n\n    * **name** : column name\n    * **type** : column type (NoType, StrType, NumType, FloatType, IntType)\n    * **dtype** : numpy dtype (optional, overrides **type** if set)\n    * **str_vals** : list of column values as strings\n    * **fill_values** : dict of fill values\n    * **shape** : list of element shape (default [] => scalar)\n    * **data** : list of converted column values\n    * **subtype** : actual datatype for columns serialized with JSON\n    \"\"\"\n\n    def __init__(self, name):\n        self.name = name\n        self.type = NoType  # Generic type (Int, Float, Str etc)\n        self.dtype = None  # Numpy dtype if available\n        self.str_vals = []\n        self.fill_values = {}\n        self.shape = []\n        self.subtype = None\n\n\nclass BaseInputter:\n    \"\"\"\n    Get the lines from the table input and return a list of lines.\n\n    \"\"\"\n\n    encoding = None\n    \"\"\"Encoding used to read the file\"\"\"\n\n    def get_lines(self, table, newline=None):\n        \"\"\"\n        Get the lines from the ``table`` input. The input table can be one of:\n\n        * File name\n        * String (newline separated) with all header and data lines (must have at least 2 lines)\n        * File-like object with read() method\n        * List of strings\n\n        Parameters\n        ----------\n        table : str, file-like, list\n            Can be either a file name, string (newline separated) with all header and data\n            lines (must have at least 2 lines), a file-like object with a\n            ``read()`` method, or a list of strings.\n        newline :\n            Line separator. If `None` use OS default from ``splitlines()``.\n\n        Returns\n        -------\n        lines : list\n            List of lines\n        \"\"\"\n        try:\n            if (hasattr(table, 'read')\n                    or ('\\n' not in table + '' and '\\r' not in table + '')):\n                with get_readable_fileobj(table,\n                                          encoding=self.encoding) as fileobj:\n                    table = fileobj.read()\n            if newline is None:\n                lines = table.splitlines()\n            else:\n                lines = table.split(newline)\n        except TypeError:\n            try:\n                # See if table supports indexing, slicing, and iteration\n                table[0]\n                table[0:1]\n                iter(table)\n                if len(table) > 1:\n                    lines = table\n                else:\n                    # treat single entry as if string had been passed directly\n                    if newline is None:\n                        lines = table[0].splitlines()\n                    else:\n                        lines = table[0].split(newline)\n\n            except TypeError:\n                raise TypeError(\n                    'Input \"table\" must be a string (filename or data) or an iterable')\n\n        return self.process_lines(lines)\n\n    def process_lines(self, lines):\n        \"\"\"Process lines for subsequent use.  In the default case do nothing.\n        This routine is not generally intended for removing comment lines or\n        stripping whitespace.  These are done (if needed) in the header and\n        data line processing.\n\n        Override this method if something more has to be done to convert raw\n        input lines to the table rows.  For example the\n        ContinuationLinesInputter derived class accounts for continuation\n        characters if a row is split into lines.\"\"\"\n        return lines\n\n\nclass BaseSplitter:\n    \"\"\"\n    Base splitter that uses python's split method to do the work.\n\n    This does not handle quoted values.  A key feature is the formulation of\n    __call__ as a generator that returns a list of the split line values at\n    each iteration.\n\n    There are two methods that are intended to be overridden, first\n    ``process_line()`` to do pre-processing on each input line before splitting\n    and ``process_val()`` to do post-processing on each split string value.  By\n    default these apply the string ``strip()`` function.  These can be set to\n    another function via the instance attribute or be disabled entirely, for\n    example::\n\n      reader.header.splitter.process_val = lambda x: x.lstrip()\n      reader.data.splitter.process_val = None\n\n    \"\"\"\n\n    delimiter = None\n    \"\"\" one-character string used to separate fields \"\"\"\n\n    def process_line(self, line):\n        \"\"\"Remove whitespace at the beginning or end of line.  This is especially useful for\n        whitespace-delimited files to prevent spurious columns at the beginning or end.\"\"\"\n        return line.strip()\n\n    def process_val(self, val):\n        \"\"\"Remove whitespace at the beginning or end of value.\"\"\"\n        return val.strip()\n\n    def __call__(self, lines):\n        if self.process_line:\n            lines = (self.process_line(x) for x in lines)\n        for line in lines:\n            vals = line.split(self.delimiter)\n            if self.process_val:\n                yield [self.process_val(x) for x in vals]\n            else:\n                yield vals\n\n    def join(self, vals):\n        if self.delimiter is None:\n            delimiter = ' '\n        else:\n            delimiter = self.delimiter\n        return delimiter.join(str(x) for x in vals)\n\n\nclass DefaultSplitter(BaseSplitter):\n    \"\"\"Default class to split strings into columns using python csv.  The class\n    attributes are taken from the csv Dialect class.\n\n    Typical usage::\n\n      # lines = ..\n      splitter = ascii.DefaultSplitter()\n      for col_vals in splitter(lines):\n          for col_val in col_vals:\n               ...\n\n    \"\"\"\n    delimiter = ' '\n    \"\"\" one-character string used to separate fields. \"\"\"\n    quotechar = '\"'\n    \"\"\" control how instances of *quotechar* in a field are quoted \"\"\"\n    doublequote = True\n    \"\"\" character to remove special meaning from following character \"\"\"\n    escapechar = None\n    \"\"\" one-character stringto quote fields containing special characters \"\"\"\n    quoting = csv.QUOTE_MINIMAL\n    \"\"\" control when quotes are recognized by the reader \"\"\"\n    skipinitialspace = True\n    \"\"\" ignore whitespace immediately following the delimiter \"\"\"\n    csv_writer = None\n    csv_writer_out = StringIO()\n\n    def process_line(self, line):\n        \"\"\"Remove whitespace at the beginning or end of line.  This is especially useful for\n        whitespace-delimited files to prevent spurious columns at the beginning or end.\n        If splitting on whitespace then replace unquoted tabs with space first\"\"\"\n        if self.delimiter == r'\\s':\n            line = _replace_tab_with_space(line, self.escapechar, self.quotechar)\n        return line.strip() + '\\n'\n\n    def process_val(self, val):\n        \"\"\"Remove whitespace at the beginning or end of value.\"\"\"\n        return val.strip(' \\t')\n\n    def __call__(self, lines):\n        \"\"\"Return an iterator over the table ``lines``, where each iterator output\n        is a list of the split line values.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        Yields\n        ------\n        line : list of str\n            Each line's split values.\n\n        \"\"\"\n        if self.process_line:\n            lines = [self.process_line(x) for x in lines]\n\n        delimiter = ' ' if self.delimiter == r'\\s' else self.delimiter\n\n        csv_reader = csv.reader(lines,\n                                delimiter=delimiter,\n                                doublequote=self.doublequote,\n                                escapechar=self.escapechar,\n                                quotechar=self.quotechar,\n                                quoting=self.quoting,\n                                skipinitialspace=self.skipinitialspace\n                                )\n        for vals in csv_reader:\n            if self.process_val:\n                yield [self.process_val(x) for x in vals]\n            else:\n                yield vals\n\n    def join(self, vals):\n\n        delimiter = ' ' if self.delimiter is None else str(self.delimiter)\n\n        if self.csv_writer is None:\n            self.csv_writer = CsvWriter(delimiter=delimiter,\n                                        doublequote=self.doublequote,\n                                        escapechar=self.escapechar,\n                                        quotechar=self.quotechar,\n                                        quoting=self.quoting)\n        if self.process_val:\n            vals = [self.process_val(x) for x in vals]\n        out = self.csv_writer.writerow(vals).rstrip('\\r\\n')\n\n        return out\n\n\ndef _replace_tab_with_space(line, escapechar, quotechar):\n    \"\"\"Replace tabs with spaces in given string, preserving quoted substrings\n\n    Parameters\n    ----------\n    line : str\n        String containing tabs to be replaced with spaces.\n    escapechar : str\n        Character in ``line`` used to escape special characters.\n    quotechar : str\n        Character in ``line`` indicating the start/end of a substring.\n\n    Returns\n    -------\n    line : str\n        A copy of ``line`` with tabs replaced by spaces, preserving quoted substrings.\n    \"\"\"\n    newline = []\n    in_quote = False\n    lastchar = 'NONE'\n    for char in line:\n        if char == quotechar and lastchar != escapechar:\n            in_quote = not in_quote\n        if char == '\\t' and not in_quote:\n            char = ' '\n        lastchar = char\n        newline.append(char)\n    return ''.join(newline)\n\n\ndef _get_line_index(line_or_func, lines):\n    \"\"\"Return the appropriate line index, depending on ``line_or_func`` which\n    can be either a function, a positive or negative int, or None.\n    \"\"\"\n\n    if hasattr(line_or_func, '__call__'):\n        return line_or_func(lines)\n    elif line_or_func:\n        if line_or_func >= 0:\n            return line_or_func\n        else:\n            n_lines = sum(1 for line in lines)\n            return n_lines + line_or_func\n    else:\n        return line_or_func\n\n\nclass BaseHeader:\n    \"\"\"\n    Base table header reader\n    \"\"\"\n    auto_format = 'col{}'\n    \"\"\" format string for auto-generating column names \"\"\"\n    start_line = None\n    \"\"\" None, int, or a function of ``lines`` that returns None or int \"\"\"\n    comment = None\n    \"\"\" regular expression for comment lines \"\"\"\n    splitter_class = DefaultSplitter\n    \"\"\" Splitter class for splitting data lines into columns \"\"\"\n    names = None\n    \"\"\" list of names corresponding to each data column \"\"\"\n    write_comment = False\n    write_spacer_lines = ['ASCII_TABLE_WRITE_SPACER_LINE']\n\n    def __init__(self):\n        self.splitter = self.splitter_class()\n\n    def _set_cols_from_names(self):\n        self.cols = [Column(name=x) for x in self.names]\n\n    def update_meta(self, lines, meta):\n        \"\"\"\n        Extract any table-level metadata, e.g. keywords, comments, column metadata, from\n        the table ``lines`` and update the OrderedDict ``meta`` in place.  This base\n        method extracts comment lines and stores them in ``meta`` for output.\n        \"\"\"\n        if self.comment:\n            re_comment = re.compile(self.comment)\n            comment_lines = [x for x in lines if re_comment.match(x)]\n        else:\n            comment_lines = []\n        comment_lines = [re.sub('^' + self.comment, '', x).strip()\n                         for x in comment_lines]\n        if comment_lines:\n            meta.setdefault('table', {})['comments'] = comment_lines\n\n    def get_cols(self, lines):\n        \"\"\"Initialize the header Column objects from the table ``lines``.\n\n        Based on the previously set Header attributes find or create the column names.\n        Sets ``self.cols`` with the list of Columns.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n\n        start_line = _get_line_index(self.start_line, self.process_lines(lines))\n        if start_line is None:\n            # No header line so auto-generate names from n_data_cols\n            # Get the data values from the first line of table data to determine n_data_cols\n            try:\n                first_data_vals = next(self.data.get_str_vals())\n            except StopIteration:\n                raise InconsistentTableError('No data lines found so cannot autogenerate '\n                                             'column names')\n            n_data_cols = len(first_data_vals)\n            self.names = [self.auto_format.format(i)\n                          for i in range(1, n_data_cols + 1)]\n\n        else:\n            for i, line in enumerate(self.process_lines(lines)):\n                if i == start_line:\n                    break\n            else:  # No header line matching\n                raise ValueError('No header line found in table')\n\n            self.names = next(self.splitter([line]))\n\n        self._set_cols_from_names()\n\n    def process_lines(self, lines):\n        \"\"\"Generator to yield non-blank and non-comment lines\"\"\"\n        re_comment = re.compile(self.comment) if self.comment else None\n        # Yield non-comment lines\n        for line in lines:\n            if line.strip() and (not self.comment or not re_comment.match(line)):\n                yield line\n\n    def write_comments(self, lines, meta):\n        if self.write_comment not in (False, None):\n            for comment in meta.get('comments', []):\n                lines.append(self.write_comment + comment)\n\n    def write(self, lines):\n        if self.start_line is not None:\n            for i, spacer_line in zip(range(self.start_line),\n                                      itertools.cycle(self.write_spacer_lines)):\n                lines.append(spacer_line)\n            lines.append(self.splitter.join([x.info.name for x in self.cols]))\n\n    @property\n    def colnames(self):\n        \"\"\"Return the column names of the table\"\"\"\n        return tuple(col.name if isinstance(col, Column) else col.info.name\n                     for col in self.cols)\n\n    def remove_columns(self, names):\n        \"\"\"\n        Remove several columns from the table.\n\n        Parameters\n        ----------\n        names : list\n            A list containing the names of the columns to remove\n        \"\"\"\n        colnames = self.colnames\n        for name in names:\n            if name not in colnames:\n                raise KeyError(f\"Column {name} does not exist\")\n\n        self.cols = [col for col in self.cols if col.name not in names]\n\n    def rename_column(self, name, new_name):\n        \"\"\"\n        Rename a column.\n\n        Parameters\n        ----------\n        name : str\n            The current name of the column.\n        new_name : str\n            The new name for the column\n        \"\"\"\n        try:\n            idx = self.colnames.index(name)\n        except ValueError:\n            raise KeyError(f\"Column {name} does not exist\")\n\n        col = self.cols[idx]\n\n        # For writing self.cols can contain cols that are not Column.  Raise\n        # exception in that case.\n        if isinstance(col, Column):\n            col.name = new_name\n        else:\n            raise TypeError(f'got column type {type(col)} instead of required '\n                            f'{Column}')\n\n    def get_type_map_key(self, col):\n        return col.raw_type\n\n    def get_col_type(self, col):\n        try:\n            type_map_key = self.get_type_map_key(col)\n            return self.col_type_map[type_map_key.lower()]\n        except KeyError:\n            raise ValueError('Unknown data type \"\"{}\"\" for column \"{}\"'.format(\n                col.raw_type, col.name))\n\n    def check_column_names(self, names, strict_names, guessing):\n        \"\"\"\n        Check column names.\n\n        This must be done before applying the names transformation\n        so that guessing will fail appropriately if ``names`` is supplied.\n        For instance if the basic reader is given a table with no column header\n        row.\n\n        Parameters\n        ----------\n        names : list\n            User-supplied list of column names\n        strict_names : bool\n            Whether to impose extra requirements on names\n        guessing : bool\n            True if this method is being called while guessing the table format\n        \"\"\"\n        if strict_names:\n            # Impose strict requirements on column names (normally used in guessing)\n            bads = [\" \", \",\", \"|\", \"\\t\", \"'\", '\"']\n            for name in self.colnames:\n                if (_is_number(name) or len(name) == 0\n                        or name[0] in bads or name[-1] in bads):\n                    raise InconsistentTableError(\n                        f'Column name {name!r} does not meet strict name requirements')\n        # When guessing require at least two columns, except for ECSV which can\n        # reliably be guessed from the header requirements.\n        if guessing and len(self.colnames) <= 1 and self.__class__.__name__ != 'EcsvHeader':\n            raise ValueError('Table format guessing requires at least two columns, got {}'\n                             .format(list(self.colnames)))\n\n        if names is not None and len(names) != len(self.colnames):\n            raise InconsistentTableError(\n                'Length of names argument ({}) does not match number'\n                ' of table columns ({})'.format(len(names), len(self.colnames)))\n\n\nclass BaseData:\n    \"\"\"\n    Base table data reader.\n    \"\"\"\n    start_line = None\n    \"\"\" None, int, or a function of ``lines`` that returns None or int \"\"\"\n    end_line = None\n    \"\"\" None, int, or a function of ``lines`` that returns None or int \"\"\"\n    comment = None\n    \"\"\" Regular expression for comment lines \"\"\"\n    splitter_class = DefaultSplitter\n    \"\"\" Splitter class for splitting data lines into columns \"\"\"\n    write_spacer_lines = ['ASCII_TABLE_WRITE_SPACER_LINE']\n    fill_include_names = None\n    fill_exclude_names = None\n    fill_values = [(masked, '')]\n    formats = {}\n\n    def __init__(self):\n        # Need to make sure fill_values list is instance attribute, not class attribute.\n        # On read, this will be overwritten by the default in the ui.read (thus, in\n        # the current implementation there can be no different default for different\n        # Readers). On write, ui.py does not specify a default, so this line here matters.\n        self.fill_values = copy.copy(self.fill_values)\n        self.formats = copy.copy(self.formats)\n        self.splitter = self.splitter_class()\n\n    def process_lines(self, lines):\n        \"\"\"\n        READ: Strip out comment lines and blank lines from list of ``lines``\n\n        Parameters\n        ----------\n        lines : list\n            All lines in table\n\n        Returns\n        -------\n        lines : list\n            List of lines\n\n        \"\"\"\n        nonblank_lines = (x for x in lines if x.strip())\n        if self.comment:\n            re_comment = re.compile(self.comment)\n            return [x for x in nonblank_lines if not re_comment.match(x)]\n        else:\n            return [x for x in nonblank_lines]\n\n    def get_data_lines(self, lines):\n        \"\"\"READ: Set ``data_lines`` attribute to lines slice comprising table data values.\n        \"\"\"\n        data_lines = self.process_lines(lines)\n        start_line = _get_line_index(self.start_line, data_lines)\n        end_line = _get_line_index(self.end_line, data_lines)\n\n        if start_line is not None or end_line is not None:\n            self.data_lines = data_lines[slice(start_line, end_line)]\n        else:  # Don't copy entire data lines unless necessary\n            self.data_lines = data_lines\n\n    def get_str_vals(self):\n        \"\"\"Return a generator that returns a list of column values (as strings)\n        for each data line.\"\"\"\n        return self.splitter(self.data_lines)\n\n    def masks(self, cols):\n        \"\"\"READ: Set fill value for each column and then apply that fill value\n\n        In the first step it is evaluated with value from ``fill_values`` applies to\n        which column using ``fill_include_names`` and ``fill_exclude_names``.\n        In the second step all replacements are done for the appropriate columns.\n        \"\"\"\n        if self.fill_values:\n            self._set_fill_values(cols)\n            self._set_masks(cols)\n\n    def _set_fill_values(self, cols):\n        \"\"\"READ, WRITE: Set fill values of individual cols based on fill_values of BaseData\n\n        fill values has the following form:\n        <fill_spec> = (<bad_value>, <fill_value>, <optional col_name>...)\n        fill_values = <fill_spec> or list of <fill_spec>'s\n\n        \"\"\"\n        if self.fill_values:\n            # when we write tables the columns may be astropy.table.Columns\n            # which don't carry a fill_values by default\n            for col in cols:\n                if not hasattr(col, 'fill_values'):\n                    col.fill_values = {}\n\n            # if input is only one <fill_spec>, then make it a list\n            with suppress(TypeError):\n                self.fill_values[0] + ''\n                self.fill_values = [self.fill_values]\n\n            # Step 1: Set the default list of columns which are affected by\n            # fill_values\n            colnames = set(self.header.colnames)\n            if self.fill_include_names is not None:\n                colnames.intersection_update(self.fill_include_names)\n            if self.fill_exclude_names is not None:\n                colnames.difference_update(self.fill_exclude_names)\n\n            # Step 2a: Find out which columns are affected by this tuple\n            # iterate over reversed order, so last condition is set first and\n            # overwritten by earlier conditions\n            for replacement in reversed(self.fill_values):\n                if len(replacement) < 2:\n                    raise ValueError(\"Format of fill_values must be \"\n                                     \"(<bad>, <fill>, <optional col1>, ...)\")\n                elif len(replacement) == 2:\n                    affect_cols = colnames\n                else:\n                    affect_cols = replacement[2:]\n\n                for i, key in ((i, x) for i, x in enumerate(self.header.colnames)\n                               if x in affect_cols):\n                    cols[i].fill_values[replacement[0]] = str(replacement[1])\n\n    def _set_masks(self, cols):\n        \"\"\"READ: Replace string values in col.str_vals and set masks\"\"\"\n        if self.fill_values:\n            for col in (col for col in cols if col.fill_values):\n                col.mask = numpy.zeros(len(col.str_vals), dtype=bool)\n                for i, str_val in ((i, x) for i, x in enumerate(col.str_vals)\n                                   if x in col.fill_values):\n                    col.str_vals[i] = col.fill_values[str_val]\n                    col.mask[i] = True\n\n    def _replace_vals(self, cols):\n        \"\"\"WRITE: replace string values in col.str_vals\"\"\"\n        if self.fill_values:\n            for col in (col for col in cols if col.fill_values):\n                for i, str_val in ((i, x) for i, x in enumerate(col.str_vals)\n                                   if x in col.fill_values):\n                    col.str_vals[i] = col.fill_values[str_val]\n                if masked in col.fill_values and hasattr(col, 'mask'):\n                    mask_val = col.fill_values[masked]\n                    for i in col.mask.nonzero()[0]:\n                        col.str_vals[i] = mask_val\n\n    def str_vals(self):\n        \"\"\"WRITE: convert all values in table to a list of lists of strings\n\n        This sets the fill values and possibly column formats from the input\n        formats={} keyword, then ends up calling table.pprint._pformat_col_iter()\n        by a circuitous path. That function does the real work of formatting.\n        Finally replace anything matching the fill_values.\n\n        Returns\n        -------\n        values : list of list of str\n        \"\"\"\n        self._set_fill_values(self.cols)\n        self._set_col_formats()\n        for col in self.cols:\n            col.str_vals = list(col.info.iter_str_vals())\n        self._replace_vals(self.cols)\n        return [col.str_vals for col in self.cols]\n\n    def write(self, lines):\n        \"\"\"Write ``self.cols`` in place to ``lines``.\n\n        Parameters\n        ----------\n        lines : list\n            List for collecting output of writing self.cols.\n        \"\"\"\n        if hasattr(self.start_line, '__call__'):\n            raise TypeError('Start_line attribute cannot be callable for write()')\n        else:\n            data_start_line = self.start_line or 0\n\n        while len(lines) < data_start_line:\n            lines.append(itertools.cycle(self.write_spacer_lines))\n\n        col_str_iters = self.str_vals()\n        for vals in zip(*col_str_iters):\n            lines.append(self.splitter.join(vals))\n\n    def _set_col_formats(self):\n        \"\"\"WRITE: set column formats.\"\"\"\n        for col in self.cols:\n            if col.info.name in self.formats:\n                col.info.format = self.formats[col.info.name]\n\n\ndef convert_numpy(numpy_type):\n    \"\"\"Return a tuple containing a function which converts a list into a numpy\n    array and the type produced by the converter function.\n\n    Parameters\n    ----------\n    numpy_type : numpy data-type\n        The numpy type required of an array returned by ``converter``. Must be a\n        valid `numpy type <https://numpy.org/doc/stable/user/basics.types.html>`_\n        (e.g., numpy.uint, numpy.int8, numpy.int64, numpy.float64) or a python\n        type covered by a numpy type (e.g., int, float, str, bool).\n\n    Returns\n    -------\n    converter : callable\n        ``converter`` is a function which accepts a list and converts it to a\n        numpy array of type ``numpy_type``.\n    converter_type : type\n        ``converter_type`` tracks the generic data type produced by the\n        converter function.\n\n    Raises\n    ------\n    ValueError\n        Raised by ``converter`` if the list elements could not be converted to\n        the required type.\n    \"\"\"\n\n    # Infer converter type from an instance of numpy_type.\n    type_name = numpy.array([], dtype=numpy_type).dtype.name\n    if 'int' in type_name:\n        converter_type = IntType\n    elif 'float' in type_name:\n        converter_type = FloatType\n    elif 'bool' in type_name:\n        converter_type = BoolType\n    elif 'str' in type_name:\n        converter_type = StrType\n    else:\n        converter_type = AllType\n\n    def bool_converter(vals):\n        \"\"\"\n        Convert values \"False\" and \"True\" to bools.  Raise an exception\n        for any other string values.\n        \"\"\"\n        if len(vals) == 0:\n            return numpy.array([], dtype=bool)\n\n        # Try a smaller subset first for a long array\n        if len(vals) > 10000:\n            svals = numpy.asarray(vals[:1000])\n            if not numpy.all((svals == 'False')\n                             | (svals == 'True')\n                             | (svals == '0')\n                             | (svals == '1')):\n                raise ValueError('bool input strings must be False, True, 0, 1, or \"\"')\n        vals = numpy.asarray(vals)\n\n        trues = (vals == 'True') | (vals == '1')\n        falses = (vals == 'False') | (vals == '0')\n        if not numpy.all(trues | falses):\n            raise ValueError('bool input strings must be only False, True, 0, 1, or \"\"')\n\n        return trues\n\n    def generic_converter(vals):\n        return numpy.array(vals, numpy_type)\n\n    converter = bool_converter if converter_type is BoolType else generic_converter\n\n    return converter, converter_type\n\n\nclass BaseOutputter:\n    \"\"\"Output table as a dict of column objects keyed on column name.  The\n    table data are stored as plain python lists within the column objects.\n    \"\"\"\n    converters = {}\n    # Derived classes must define default_converters and __call__\n\n    @staticmethod\n    def _validate_and_copy(col, converters):\n        \"\"\"Validate the format for the type converters and then copy those\n        which are valid converters for this column (i.e. converter type is\n        a subclass of col.type)\"\"\"\n        converters_out = []\n        try:\n            for converter in converters:\n                converter_func, converter_type = converter\n                if not issubclass(converter_type, NoType):\n                    raise ValueError()\n                if issubclass(converter_type, col.type):\n                    converters_out.append((converter_func, converter_type))\n\n        except (ValueError, TypeError):\n            raise ValueError('Error: invalid format for converters, see '\n                             'documentation\\n{}'.format(converters))\n        return converters_out\n\n    def _convert_vals(self, cols):\n        for col in cols:\n            for key, converters in self.converters.items():\n                if fnmatch.fnmatch(col.name, key):\n                    break\n            else:\n                if col.dtype is not None:\n                    converters = [convert_numpy(col.dtype)]\n                else:\n                    converters = self.default_converters\n\n            col.converters = self._validate_and_copy(col, converters)\n\n            # Catch the last error in order to provide additional information\n            # in case all attempts at column conversion fail.  The initial\n            # value of of last_error will apply if no converters are defined\n            # and the first col.converters[0] access raises IndexError.\n            last_err = 'no converters defined'\n\n            while not hasattr(col, 'data'):\n                # Try converters, popping the unsuccessful ones from the list.\n                # If there are no converters left here then fail.\n                if not col.converters:\n                    raise ValueError(f'Column {col.name} failed to convert: {last_err}')\n\n                converter_func, converter_type = col.converters[0]\n                if not issubclass(converter_type, col.type):\n                    raise TypeError('converter type does not match column type')\n\n                try:\n                    col.data = converter_func(col.str_vals)\n                    col.type = converter_type\n                except (TypeError, ValueError) as err:\n                    col.converters.pop(0)\n                    last_err = err\n                except OverflowError as err:\n                    # Overflow during conversion (most likely an int that\n                    # doesn't fit in native C long). Put string at the top of\n                    # the converters list for the next while iteration.\n                    warnings.warn(\n                        \"OverflowError converting to {} in column {}, reverting to String.\"\n                        .format(converter_type.__name__, col.name), AstropyWarning)\n                    col.converters.insert(0, convert_numpy(numpy.str))\n                    last_err = err\n\n\ndef _deduplicate_names(names):\n    \"\"\"Ensure there are no duplicates in ``names``\n\n    This is done by iteratively adding ``_<N>`` to the name for increasing N\n    until the name is unique.\n    \"\"\"\n    new_names = []\n    existing_names = set()\n\n    for name in names:\n        base_name = name + '_'\n        i = 1\n        while name in existing_names:\n            # Iterate until a unique name is found\n            name = base_name + str(i)\n            i += 1\n        new_names.append(name)\n        existing_names.add(name)\n\n    return new_names\n\n\nclass TableOutputter(BaseOutputter):\n    \"\"\"\n    Output the table as an astropy.table.Table object.\n    \"\"\"\n\n    default_converters = [convert_numpy(int),\n                          convert_numpy(float),\n                          convert_numpy(str)]\n\n    def __call__(self, cols, meta):\n        # Sets col.data to numpy array and col.type to io.ascii Type class (e.g.\n        # FloatType) for each col.\n        self._convert_vals(cols)\n\n        t_cols = [numpy.ma.MaskedArray(x.data, mask=x.mask)\n                  if hasattr(x, 'mask') and numpy.any(x.mask)\n                  else x.data for x in cols]\n        out = Table(t_cols, names=[x.name for x in cols], meta=meta['table'])\n\n        for col, out_col in zip(cols, out.columns.values()):\n            for attr in ('format', 'unit', 'description'):\n                if hasattr(col, attr):\n                    setattr(out_col, attr, getattr(col, attr))\n            if hasattr(col, 'meta'):\n                out_col.meta.update(col.meta)\n\n        return out\n\n\nclass MetaBaseReader(type):\n    def __init__(cls, name, bases, dct):\n        super().__init__(name, bases, dct)\n\n        format = dct.get('_format_name')\n        if format is None:\n            return\n\n        fast = dct.get('_fast')\n        if fast is not None:\n            FAST_CLASSES[format] = cls\n\n        FORMAT_CLASSES[format] = cls\n\n        io_formats = ['ascii.' + format] + dct.get('_io_registry_format_aliases', [])\n\n        if dct.get('_io_registry_suffix'):\n            func = functools.partial(connect.io_identify, dct['_io_registry_suffix'])\n            connect.io_registry.register_identifier(io_formats[0], Table, func)\n\n        for io_format in io_formats:\n            func = functools.partial(connect.io_read, io_format)\n            header = f\"ASCII reader '{io_format}' details\\n\"\n            func.__doc__ = (inspect.cleandoc(READ_DOCSTRING).strip() + '\\n\\n'\n                            + header + re.sub('.', '=', header) + '\\n')\n            func.__doc__ += inspect.cleandoc(cls.__doc__).strip()\n            connect.io_registry.register_reader(io_format, Table, func)\n\n            if dct.get('_io_registry_can_write', True):\n                func = functools.partial(connect.io_write, io_format)\n                header = f\"ASCII writer '{io_format}' details\\n\"\n                func.__doc__ = (inspect.cleandoc(WRITE_DOCSTRING).strip() + '\\n\\n'\n                                + header + re.sub('.', '=', header) + '\\n')\n                func.__doc__ += inspect.cleandoc(cls.__doc__).strip()\n                connect.io_registry.register_writer(io_format, Table, func)\n\n\ndef _is_number(x):\n    with suppress(ValueError):\n        x = float(x)\n        return True\n    return False\n\n\ndef _apply_include_exclude_names(table, names, include_names, exclude_names):\n    \"\"\"\n    Apply names, include_names and exclude_names to a table or BaseHeader.\n\n    For the latter this relies on BaseHeader implementing ``colnames``,\n    ``rename_column``, and ``remove_columns``.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`, `~astropy.io.ascii.BaseHeader`\n        Input table or BaseHeader subclass instance\n    names : list\n        List of names to override those in table (set to None to use existing names)\n    include_names : list\n        List of names to include in output\n    exclude_names : list\n        List of names to exclude from output (applied after ``include_names``)\n\n    \"\"\"\n    def rename_columns(table, names):\n        # Rename table column names to those passed by user\n        # Temporarily rename with names that are not in `names` or `table.colnames`.\n        # This ensures that rename succeeds regardless of existing names.\n        xxxs = 'x' * max(len(name) for name in list(names) + list(table.colnames))\n        for ii, colname in enumerate(table.colnames):\n            table.rename_column(colname, xxxs + str(ii))\n\n        for ii, name in enumerate(names):\n            table.rename_column(xxxs + str(ii), name)\n\n    if names is not None:\n        rename_columns(table, names)\n    else:\n        colnames_uniq = _deduplicate_names(table.colnames)\n        if colnames_uniq != list(table.colnames):\n            rename_columns(table, colnames_uniq)\n\n    names_set = set(table.colnames)\n\n    if include_names is not None:\n        names_set.intersection_update(include_names)\n    if exclude_names is not None:\n        names_set.difference_update(exclude_names)\n    if names_set != set(table.colnames):\n        remove_names = set(table.colnames) - names_set\n        table.remove_columns(remove_names)\n\n\nclass BaseReader(metaclass=MetaBaseReader):\n    \"\"\"Class providing methods to read and write an ASCII table using the specified\n    header, data, inputter, and outputter instances.\n\n    Typical usage is to instantiate a Reader() object and customize the\n    ``header``, ``data``, ``inputter``, and ``outputter`` attributes.  Each\n    of these is an object of the corresponding class.\n\n    There is one method ``inconsistent_handler`` that can be used to customize the\n    behavior of ``read()`` in the event that a data row doesn't match the header.\n    The default behavior is to raise an InconsistentTableError.\n\n    \"\"\"\n\n    names = None\n    include_names = None\n    exclude_names = None\n    strict_names = False\n    guessing = False\n    encoding = None\n\n    header_class = BaseHeader\n    data_class = BaseData\n    inputter_class = BaseInputter\n    outputter_class = TableOutputter\n\n    # Max column dimension that writer supports for this format. Exceptions\n    # include ECSV (no limit) and HTML (max_ndim=2).\n    max_ndim = 1\n\n    def __init__(self):\n        self.header = self.header_class()\n        self.data = self.data_class()\n        self.inputter = self.inputter_class()\n        self.outputter = self.outputter_class()\n        # Data and Header instances benefit from a little cross-coupling.  Header may need to\n        # know about number of data columns for auto-column name generation and Data may\n        # need to know about header (e.g. for fixed-width tables where widths are spec'd in header.\n        self.data.header = self.header\n        self.header.data = self.data\n\n        # Metadata, consisting of table-level meta and column-level meta.  The latter\n        # could include information about column type, description, formatting, etc,\n        # depending on the table meta format.\n        self.meta = OrderedDict(table=OrderedDict(),\n                                cols=OrderedDict())\n\n    def _check_multidim_table(self, table):\n        \"\"\"Check that the dimensions of columns in ``table`` are acceptable.\n\n        The reader class attribute ``max_ndim`` defines the maximum dimension of\n        columns that can be written using this format. The base value is ``1``,\n        corresponding to normal scalar columns with just a length.\n\n        Parameters\n        ----------\n        table : `~astropy.table.Table`\n            Input table.\n\n        Raises\n        ------\n        ValueError\n            If any column exceeds the number of allowed dimensions\n        \"\"\"\n        _check_multidim_table(table, self.max_ndim)\n\n    def read(self, table):\n        \"\"\"Read the ``table`` and return the results in a format determined by\n        the ``outputter`` attribute.\n\n        The ``table`` parameter is any string or object that can be processed\n        by the instance ``inputter``.  For the base Inputter class ``table`` can be\n        one of:\n\n        * File name\n        * File-like object\n        * String (newline separated) with all header and data lines (must have at least 2 lines)\n        * List of strings\n\n        Parameters\n        ----------\n        table : str, file-like, list\n            Input table.\n\n        Returns\n        -------\n        table : `~astropy.table.Table`\n            Output table\n\n        \"\"\"\n        # If ``table`` is a file then store the name in the ``data``\n        # attribute. The ``table`` is a \"file\" if it is a string\n        # without the new line specific to the OS.\n        with suppress(TypeError):\n            # Strings only\n            if os.linesep not in table + '':\n                self.data.table_name = os.path.basename(table)\n\n        # If one of the newline chars is set as field delimiter, only\n        # accept the other one as line splitter\n        if self.header.splitter.delimiter == '\\n':\n            newline = '\\r'\n        elif self.header.splitter.delimiter == '\\r':\n            newline = '\\n'\n        else:\n            newline = None\n\n        # Get a list of the lines (rows) in the table\n        self.lines = self.inputter.get_lines(table, newline=newline)\n\n        # Set self.data.data_lines to a slice of lines contain the data rows\n        self.data.get_data_lines(self.lines)\n\n        # Extract table meta values (e.g. keywords, comments, etc).  Updates self.meta.\n        self.header.update_meta(self.lines, self.meta)\n\n        # Get the table column definitions\n        self.header.get_cols(self.lines)\n\n        # Make sure columns are valid\n        self.header.check_column_names(self.names, self.strict_names, self.guessing)\n\n        self.cols = cols = self.header.cols\n        self.data.splitter.cols = cols\n        n_cols = len(cols)\n\n        for i, str_vals in enumerate(self.data.get_str_vals()):\n            if len(str_vals) != n_cols:\n                str_vals = self.inconsistent_handler(str_vals, n_cols)\n\n                # if str_vals is None, we skip this row\n                if str_vals is None:\n                    continue\n\n                # otherwise, we raise an error only if it is still inconsistent\n                if len(str_vals) != n_cols:\n                    errmsg = ('Number of header columns ({}) inconsistent with'\n                              ' data columns ({}) at data line {}\\n'\n                              'Header values: {}\\n'\n                              'Data values: {}'.format(\n                                  n_cols, len(str_vals), i,\n                                  [x.name for x in cols], str_vals))\n\n                    raise InconsistentTableError(errmsg)\n\n            for j, col in enumerate(cols):\n                col.str_vals.append(str_vals[j])\n\n        self.data.masks(cols)\n        if hasattr(self.header, 'table_meta'):\n            self.meta['table'].update(self.header.table_meta)\n\n        _apply_include_exclude_names(self.header, self.names,\n                                     self.include_names, self.exclude_names)\n\n        table = self.outputter(self.header.cols, self.meta)\n        self.cols = self.header.cols\n\n        return table\n\n    def inconsistent_handler(self, str_vals, ncols):\n        \"\"\"\n        Adjust or skip data entries if a row is inconsistent with the header.\n\n        The default implementation does no adjustment, and hence will always trigger\n        an exception in read() any time the number of data entries does not match\n        the header.\n\n        Note that this will *not* be called if the row already matches the header.\n\n        Parameters\n        ----------\n        str_vals : list\n            A list of value strings from the current row of the table.\n        ncols : int\n            The expected number of entries from the table header.\n\n        Returns\n        -------\n        str_vals : list\n            List of strings to be parsed into data entries in the output table. If\n            the length of this list does not match ``ncols``, an exception will be\n            raised in read().  Can also be None, in which case the row will be\n            skipped.\n        \"\"\"\n        # an empty list will always trigger an InconsistentTableError in read()\n        return str_vals\n\n    @property\n    def comment_lines(self):\n        \"\"\"Return lines in the table that match header.comment regexp\"\"\"\n        if not hasattr(self, 'lines'):\n            raise ValueError('Table must be read prior to accessing the header comment lines')\n        if self.header.comment:\n            re_comment = re.compile(self.header.comment)\n            comment_lines = [x for x in self.lines if re_comment.match(x)]\n        else:\n            comment_lines = []\n        return comment_lines\n\n    def update_table_data(self, table):\n        \"\"\"\n        Update table columns in place if needed.\n\n        This is a hook to allow updating the table columns after name\n        filtering but before setting up to write the data.  This is currently\n        only used by ECSV and is otherwise just a pass-through.\n\n        Parameters\n        ----------\n        table : `astropy.table.Table`\n            Input table for writing\n\n        Returns\n        -------\n        table : `astropy.table.Table`\n            Output table for writing\n        \"\"\"\n        return table\n\n    def write_header(self, lines, meta):\n        self.header.write_comments(lines, meta)\n        self.header.write(lines)\n\n    def write(self, table):\n        \"\"\"\n        Write ``table`` as list of strings.\n\n        Parameters\n        ----------\n        table : `~astropy.table.Table`\n            Input table data.\n\n        Returns\n        -------\n        lines : list\n            List of strings corresponding to ASCII table\n\n        \"\"\"\n\n        # Check column names before altering\n        self.header.cols = list(table.columns.values())\n        self.header.check_column_names(self.names, self.strict_names, False)\n\n        # In-place update of columns in input ``table`` to reflect column\n        # filtering.  Note that ``table`` is guaranteed to be a copy of the\n        # original user-supplied table.\n        _apply_include_exclude_names(table, self.names, self.include_names, self.exclude_names)\n\n        # This is a hook to allow updating the table columns after name\n        # filtering but before setting up to write the data.  This is currently\n        # only used by ECSV and is otherwise just a pass-through.\n        table = self.update_table_data(table)\n\n        # Check that table column dimensions are supported by this format class.\n        # Most formats support only 1-d columns, but some like ECSV support N-d.\n        self._check_multidim_table(table)\n\n        # Now use altered columns\n        new_cols = list(table.columns.values())\n        # link information about the columns to the writer object (i.e. self)\n        self.header.cols = new_cols\n        self.data.cols = new_cols\n        self.header.table_meta = table.meta\n\n        # Write header and data to lines list\n        lines = []\n        self.write_header(lines, table.meta)\n        self.data.write(lines)\n\n        return lines\n\n\nclass ContinuationLinesInputter(BaseInputter):\n    \"\"\"Inputter where lines ending in ``continuation_char`` are joined\n    with the subsequent line.  Example::\n\n      col1 col2 col3\n      1 \\\n      2 3\n      4 5 \\\n      6\n    \"\"\"\n\n    continuation_char = '\\\\'\n    replace_char = ' '\n    # If no_continue is not None then lines matching this regex are not subject\n    # to line continuation.  The initial use case here is Daophot.  In this\n    # case the continuation character is just replaced with replace_char.\n    no_continue = None\n\n    def process_lines(self, lines):\n        re_no_continue = re.compile(self.no_continue) if self.no_continue else None\n\n        parts = []\n        outlines = []\n        for line in lines:\n            if re_no_continue and re_no_continue.match(line):\n                line = line.replace(self.continuation_char, self.replace_char)\n            if line.endswith(self.continuation_char):\n                parts.append(line.replace(self.continuation_char, self.replace_char))\n            else:\n                parts.append(line)\n                outlines.append(''.join(parts))\n                parts = []\n\n        return outlines\n\n\nclass WhitespaceSplitter(DefaultSplitter):\n    def process_line(self, line):\n        \"\"\"Replace tab with space within ``line`` while respecting quoted substrings\"\"\"\n        newline = []\n        in_quote = False\n        lastchar = None\n        for char in line:\n            if char == self.quotechar and (self.escapechar is None\n                                           or lastchar != self.escapechar):\n                in_quote = not in_quote\n            if char == '\\t' and not in_quote:\n                char = ' '\n            lastchar = char\n            newline.append(char)\n\n        return ''.join(newline)\n\n\nextra_reader_pars = ('Reader', 'Inputter', 'Outputter',\n                     'delimiter', 'comment', 'quotechar', 'header_start',\n                     'data_start', 'data_end', 'converters', 'encoding',\n                     'data_Splitter', 'header_Splitter',\n                     'names', 'include_names', 'exclude_names', 'strict_names',\n                     'fill_values', 'fill_include_names', 'fill_exclude_names')\n\n\ndef _get_reader(Reader, Inputter=None, Outputter=None, **kwargs):\n    \"\"\"Initialize a table reader allowing for common customizations.  See ui.get_reader()\n    for param docs.  This routine is for internal (package) use only and is useful\n    because it depends only on the \"core\" module.\n    \"\"\"\n\n    from .fastbasic import FastBasic\n    if issubclass(Reader, FastBasic):  # Fast readers handle args separately\n        if Inputter is not None:\n            kwargs['Inputter'] = Inputter\n        return Reader(**kwargs)\n\n    # If user explicitly passed a fast reader with enable='force'\n    # (e.g. by passing non-default options), raise an error for slow readers\n    if 'fast_reader' in kwargs:\n        if kwargs['fast_reader']['enable'] == 'force':\n            raise ParameterError('fast_reader required with '\n                                 '{}, but this is not a fast C reader: {}'\n                                 .format(kwargs['fast_reader'], Reader))\n        else:\n            del kwargs['fast_reader']  # Otherwise ignore fast_reader parameter\n\n    reader_kwargs = dict([k, v] for k, v in kwargs.items() if k not in extra_reader_pars)\n    reader = Reader(**reader_kwargs)\n\n    if Inputter is not None:\n        reader.inputter = Inputter()\n\n    if Outputter is not None:\n        reader.outputter = Outputter()\n\n    # Issue #855 suggested to set data_start to header_start + default_header_length\n    # Thus, we need to retrieve this from the class definition before resetting these numbers.\n    try:\n        default_header_length = reader.data.start_line - reader.header.start_line\n    except TypeError:  # Start line could be None or an instancemethod\n        default_header_length = None\n\n    # csv.reader is hard-coded to recognise either '\\r' or '\\n' as end-of-line,\n    # therefore DefaultSplitter cannot handle these as delimiters.\n    if 'delimiter' in kwargs:\n        if kwargs['delimiter'] in ('\\n', '\\r', '\\r\\n'):\n            reader.header.splitter = BaseSplitter()\n            reader.data.splitter = BaseSplitter()\n        reader.header.splitter.delimiter = kwargs['delimiter']\n        reader.data.splitter.delimiter = kwargs['delimiter']\n    if 'comment' in kwargs:\n        reader.header.comment = kwargs['comment']\n        reader.data.comment = kwargs['comment']\n    if 'quotechar' in kwargs:\n        reader.header.splitter.quotechar = kwargs['quotechar']\n        reader.data.splitter.quotechar = kwargs['quotechar']\n    if 'data_start' in kwargs:\n        reader.data.start_line = kwargs['data_start']\n    if 'data_end' in kwargs:\n        reader.data.end_line = kwargs['data_end']\n    if 'header_start' in kwargs:\n        if (reader.header.start_line is not None):\n            reader.header.start_line = kwargs['header_start']\n            # For FixedWidthTwoLine the data_start is calculated relative to the position line.\n            # However, position_line is given as absolute number and not relative to header_start.\n            # So, ignore this Reader here.\n            if (('data_start' not in kwargs) and (default_header_length is not None)\n                    and reader._format_name not in ['fixed_width_two_line', 'commented_header']):\n                reader.data.start_line = reader.header.start_line + default_header_length\n        elif kwargs['header_start'] is not None:\n            # User trying to set a None header start to some value other than None\n            raise ValueError('header_start cannot be modified for this Reader')\n    if 'converters' in kwargs:\n        reader.outputter.converters = kwargs['converters']\n    if 'data_Splitter' in kwargs:\n        reader.data.splitter = kwargs['data_Splitter']()\n    if 'header_Splitter' in kwargs:\n        reader.header.splitter = kwargs['header_Splitter']()\n    if 'names' in kwargs:\n        reader.names = kwargs['names']\n        if None in reader.names:\n            raise TypeError('Cannot have None for column name')\n        if len(set(reader.names)) != len(reader.names):\n            raise ValueError('Duplicate column names')\n    if 'include_names' in kwargs:\n        reader.include_names = kwargs['include_names']\n    if 'exclude_names' in kwargs:\n        reader.exclude_names = kwargs['exclude_names']\n    # Strict names is normally set only within the guessing process to\n    # indicate that column names cannot be numeric or have certain\n    # characters at the beginning or end.  It gets used in\n    # BaseHeader.check_column_names().\n    if 'strict_names' in kwargs:\n        reader.strict_names = kwargs['strict_names']\n    if 'fill_values' in kwargs:\n        reader.data.fill_values = kwargs['fill_values']\n    if 'fill_include_names' in kwargs:\n        reader.data.fill_include_names = kwargs['fill_include_names']\n    if 'fill_exclude_names' in kwargs:\n        reader.data.fill_exclude_names = kwargs['fill_exclude_names']\n    if 'encoding' in kwargs:\n        reader.encoding = kwargs['encoding']\n        reader.inputter.encoding = kwargs['encoding']\n\n    return reader\n\n\nextra_writer_pars = ('delimiter', 'comment', 'quotechar', 'formats',\n                     'strip_whitespace',\n                     'names', 'include_names', 'exclude_names',\n                     'fill_values', 'fill_include_names',\n                     'fill_exclude_names')\n\n\ndef _get_writer(Writer, fast_writer, **kwargs):\n    \"\"\"Initialize a table writer allowing for common customizations. This\n    routine is for internal (package) use only and is useful because it depends\n    only on the \"core\" module.\"\"\"\n\n    from .fastbasic import FastBasic\n\n    # A value of None for fill_values imply getting the default string\n    # representation of masked values (depending on the writer class), but the\n    # machinery expects a list.  The easiest here is to just pop the value off,\n    # i.e. fill_values=None is the same as not providing it at all.\n    if 'fill_values' in kwargs and kwargs['fill_values'] is None:\n        del kwargs['fill_values']\n\n    if issubclass(Writer, FastBasic):  # Fast writers handle args separately\n        return Writer(**kwargs)\n    elif fast_writer and f'fast_{Writer._format_name}' in FAST_CLASSES:\n        # Switch to fast writer\n        kwargs['fast_writer'] = fast_writer\n        return FAST_CLASSES[f'fast_{Writer._format_name}'](**kwargs)\n\n    writer_kwargs = dict([k, v] for k, v in kwargs.items() if k not in extra_writer_pars)\n    writer = Writer(**writer_kwargs)\n\n    if 'delimiter' in kwargs:\n        writer.header.splitter.delimiter = kwargs['delimiter']\n        writer.data.splitter.delimiter = kwargs['delimiter']\n    if 'comment' in kwargs:\n        writer.header.write_comment = kwargs['comment']\n        writer.data.write_comment = kwargs['comment']\n    if 'quotechar' in kwargs:\n        writer.header.splitter.quotechar = kwargs['quotechar']\n        writer.data.splitter.quotechar = kwargs['quotechar']\n    if 'formats' in kwargs:\n        writer.data.formats = kwargs['formats']\n    if 'strip_whitespace' in kwargs:\n        if kwargs['strip_whitespace']:\n            # Restore the default SplitterClass process_val method which strips\n            # whitespace.  This may have been changed in the Writer\n            # initialization (e.g. Rdb and Tab)\n            writer.data.splitter.process_val = operator.methodcaller('strip', ' \\t')\n        else:\n            writer.data.splitter.process_val = None\n    if 'names' in kwargs:\n        writer.header.names = kwargs['names']\n    if 'include_names' in kwargs:\n        writer.include_names = kwargs['include_names']\n    if 'exclude_names' in kwargs:\n        writer.exclude_names = kwargs['exclude_names']\n    if 'fill_values' in kwargs:\n        # Prepend user-specified values to the class default.\n        with suppress(TypeError, IndexError):\n            # Test if it looks like (match, replace_string, optional_colname),\n            # in which case make it a list\n            kwargs['fill_values'][1] + ''\n            kwargs['fill_values'] = [kwargs['fill_values']]\n        writer.data.fill_values = kwargs['fill_values'] + writer.data.fill_values\n    if 'fill_include_names' in kwargs:\n        writer.data.fill_include_names = kwargs['fill_include_names']\n    if 'fill_exclude_names' in kwargs:\n        writer.data.fill_exclude_names = kwargs['fill_exclude_names']\n    return writer\n"},{"fileName":"misc.py","filePath":"astropy/io/ascii","id":5228,"nodeType":"File","text":"\"\"\"A Collection of useful miscellaneous functions.\n\nmisc.py:\n  Collection of useful miscellaneous functions.\n\n:Author: Hannes Breytenbach (hannes@saao.ac.za)\n\"\"\"\n\n\nimport collections.abc\nimport itertools\nimport operator\n\n\ndef first_true_index(iterable, pred=None, default=None):\n    \"\"\"find the first index position for the which the callable pred returns True\"\"\"\n    if pred is None:\n        func = operator.itemgetter(1)\n    else:\n        func = lambda x: pred(x[1])\n    ii = next(filter(func, enumerate(iterable)), default)  # either index-item pair or default\n    return ii[0] if ii else default\n\n\ndef first_false_index(iterable, pred=None, default=None):\n    \"\"\"find the first index position for the which the callable pred returns False\"\"\"\n    if pred is None:\n        func = operator.not_\n    else:\n        func = lambda x: not pred(x)\n    return first_true_index(iterable, func, default)\n\n\ndef sortmore(*args, **kw):\n    \"\"\"\n    Sorts any number of lists according to:\n    optionally given item sorting key function(s) and/or a global sorting key function.\n\n    Parameters\n    ----------\n    One or more lists\n\n    Keywords\n    --------\n    globalkey : None\n        revert to sorting by key function\n    globalkey : callable\n        Sort by evaluated value for all items in the lists\n        (call signature of this function needs to be such that it accepts an\n        argument tuple of items from each list.\n        eg.: ``globalkey = lambda *l: sum(l)`` will order all the lists by the\n        sum of the items from each list\n\n    if key: None\n        sorting done by value of first input list\n        (in this case the objects in the first iterable need the comparison\n        methods __lt__ etc...)\n    if key: callable\n        sorting done by value of key(item) for items in first iterable\n    if key: tuple\n        sorting done by value of (key(item_0), ..., key(item_n)) for items in\n        the first n iterables (where n is the length of the key tuple)\n        i.e. the first callable is the primary sorting criterion, and the\n        rest act as tie-breakers.\n\n    Returns\n    -------\n    Sorted lists\n\n    Examples\n    --------\n    Capture sorting indices::\n\n        l = list('CharacterS')\n        In [1]: sortmore( l, range(len(l)) )\n        Out[1]: (['C', 'S', 'a', 'a', 'c', 'e', 'h', 'r', 'r', 't'],\n                 [0, 9, 2, 4, 5, 7, 1, 3, 8, 6])\n        In [2]: sortmore( l, range(len(l)), key=str.lower )\n        Out[2]: (['a', 'a', 'C', 'c', 'e', 'h', 'r', 'r', 'S', 't'],\n                 [2, 4, 0, 5, 7, 1, 3, 8, 9, 6])\n    \"\"\"\n\n    first = list(args[0])\n    if not len(first):\n        return args\n\n    globalkey = kw.get('globalkey')\n    key = kw.get('key')\n    if key is None:\n        if globalkey:\n            # if global sort function given and no local (secondary) key given, ==> no tiebreakers\n            key = lambda x: 0\n        else:\n            key = lambda x: x  # if no global sort and no local sort keys given, sort by item values\n    if globalkey is None:\n        globalkey = lambda *x: 0\n\n    if not isinstance(globalkey, collections.abc.Callable):\n        raise ValueError('globalkey needs to be callable')\n\n    if isinstance(key, collections.abc.Callable):\n        k = lambda x: (globalkey(*x), key(x[0]))\n    elif isinstance(key, tuple):\n        key = (k if k else lambda x: 0 for k in key)\n        k = lambda x: (globalkey(*x),) + tuple(f(z) for (f, z) in zip(key, x))\n    else:\n        raise KeyError(\n            \"kw arg 'key' should be None, callable, or a sequence of callables, not {}\"\n            .format(type(key)))\n\n    res = sorted(list(zip(*args)), key=k)\n    if 'order' in kw:\n        if kw['order'].startswith(('descend', 'reverse')):\n            res = reversed(res)\n\n    return tuple(map(list, zip(*res)))\n\n\ndef groupmore(func=None, *its):\n    \"\"\"Extends the itertools.groupby functionality to arbitrary number of iterators.\"\"\"\n    if not func:\n        func = lambda x: x\n    its = sortmore(*its, key=func)\n    nfunc = lambda x: func(x[0])\n    zipper = itertools.groupby(zip(*its), nfunc)\n    unzipper = ((key, zip(*groups)) for key, groups in zipper)\n    return unzipper\n"},{"col":4,"comment":"Not available for the CDS class (raises NotImplementedError)","endLoc":315,"header":"def write(self, table=None)","id":5229,"name":"write","nodeType":"Function","startLoc":313,"text":"def write(self, table=None):\n        \"\"\"Not available for the CDS class (raises NotImplementedError)\"\"\"\n        raise NotImplementedError"},{"col":4,"comment":"null","endLoc":343,"header":"def read(self, table)","id":5230,"name":"read","nodeType":"Function","startLoc":317,"text":"def read(self, table):\n        # If the read kwarg `data_start` is 'guess' then the table may have extraneous\n        # lines between the end of the header and the beginning of data.\n        if self.data.start_line == 'guess':\n            # Replicate the first part of BaseReader.read up to the point where\n            # the table lines are initially read in.\n            with suppress(TypeError):\n                # For strings only\n                if os.linesep not in table + '':\n                    self.data.table_name = os.path.basename(table)\n\n            self.data.header = self.header\n            self.header.data = self.data\n\n            # Get a list of the lines (rows) in the table\n            lines = self.inputter.get_lines(table)\n\n            # Now try increasing data.start_line by one until the table reads successfully.\n            # For efficiency use the in-memory list of lines instead of `table`, which\n            # could be a file.\n            for data_start in range(len(lines)):\n                self.data.start_line = data_start\n                with suppress(Exception):\n                    table = super().read(lines)\n                    return table\n        else:\n            return super().read(table)"},{"attributeType":"null","col":0,"comment":"null","endLoc":1,"id":5231,"name":"READ_DOCSTRING","nodeType":"Attribute","startLoc":1,"text":"READ_DOCSTRING"},{"col":0,"comment":"find the first index position for the which the callable pred returns True","endLoc":22,"header":"def first_true_index(iterable, pred=None, default=None)","id":5232,"name":"first_true_index","nodeType":"Function","startLoc":15,"text":"def first_true_index(iterable, pred=None, default=None):\n    \"\"\"find the first index position for the which the callable pred returns True\"\"\"\n    if pred is None:\n        func = operator.itemgetter(1)\n    else:\n        func = lambda x: pred(x[1])\n    ii = next(filter(func, enumerate(iterable)), default)  # either index-item pair or default\n    return ii[0] if ii else default"},{"col":15,"endLoc":20,"id":5233,"nodeType":"Lambda","startLoc":20,"text":"lambda x: pred(x[1])"},{"col":0,"comment":"find the first index position for the which the callable pred returns False","endLoc":31,"header":"def first_false_index(iterable, pred=None, default=None)","id":5234,"name":"first_false_index","nodeType":"Function","startLoc":25,"text":"def first_false_index(iterable, pred=None, default=None):\n    \"\"\"find the first index position for the which the callable pred returns False\"\"\"\n    if pred is None:\n        func = operator.not_\n    else:\n        func = lambda x: not pred(x)\n    return first_true_index(iterable, func, default)"},{"col":15,"endLoc":30,"id":5235,"nodeType":"Lambda","startLoc":30,"text":"lambda x: not pred(x)"},{"col":0,"comment":"\n    Sorts any number of lists according to:\n    optionally given item sorting key function(s) and/or a global sorting key function.\n\n    Parameters\n    ----------\n    One or more lists\n\n    Keywords\n    --------\n    globalkey : None\n        revert to sorting by key function\n    globalkey : callable\n        Sort by evaluated value for all items in the lists\n        (call signature of this function needs to be such that it accepts an\n        argument tuple of items from each list.\n        eg.: ``globalkey = lambda *l: sum(l)`` will order all the lists by the\n        sum of the items from each list\n\n    if key: None\n        sorting done by value of first input list\n        (in this case the objects in the first iterable need the comparison\n        methods __lt__ etc...)\n    if key: callable\n        sorting done by value of key(item) for items in first iterable\n    if key: tuple\n        sorting done by value of (key(item_0), ..., key(item_n)) for items in\n        the first n iterables (where n is the length of the key tuple)\n        i.e. the first callable is the primary sorting criterion, and the\n        rest act as tie-breakers.\n\n    Returns\n    -------\n    Sorted lists\n\n    Examples\n    --------\n    Capture sorting indices::\n\n        l = list('CharacterS')\n        In [1]: sortmore( l, range(len(l)) )\n        Out[1]: (['C', 'S', 'a', 'a', 'c', 'e', 'h', 'r', 'r', 't'],\n                 [0, 9, 2, 4, 5, 7, 1, 3, 8, 6])\n        In [2]: sortmore( l, range(len(l)), key=str.lower )\n        Out[2]: (['a', 'a', 'C', 'c', 'e', 'h', 'r', 'r', 'S', 't'],\n                 [2, 4, 0, 5, 7, 1, 3, 8, 9, 6])\n    ","endLoc":116,"header":"def sortmore(*args, **kw)","id":5236,"name":"sortmore","nodeType":"Function","startLoc":34,"text":"def sortmore(*args, **kw):\n    \"\"\"\n    Sorts any number of lists according to:\n    optionally given item sorting key function(s) and/or a global sorting key function.\n\n    Parameters\n    ----------\n    One or more lists\n\n    Keywords\n    --------\n    globalkey : None\n        revert to sorting by key function\n    globalkey : callable\n        Sort by evaluated value for all items in the lists\n        (call signature of this function needs to be such that it accepts an\n        argument tuple of items from each list.\n        eg.: ``globalkey = lambda *l: sum(l)`` will order all the lists by the\n        sum of the items from each list\n\n    if key: None\n        sorting done by value of first input list\n        (in this case the objects in the first iterable need the comparison\n        methods __lt__ etc...)\n    if key: callable\n        sorting done by value of key(item) for items in first iterable\n    if key: tuple\n        sorting done by value of (key(item_0), ..., key(item_n)) for items in\n        the first n iterables (where n is the length of the key tuple)\n        i.e. the first callable is the primary sorting criterion, and the\n        rest act as tie-breakers.\n\n    Returns\n    -------\n    Sorted lists\n\n    Examples\n    --------\n    Capture sorting indices::\n\n        l = list('CharacterS')\n        In [1]: sortmore( l, range(len(l)) )\n        Out[1]: (['C', 'S', 'a', 'a', 'c', 'e', 'h', 'r', 'r', 't'],\n                 [0, 9, 2, 4, 5, 7, 1, 3, 8, 6])\n        In [2]: sortmore( l, range(len(l)), key=str.lower )\n        Out[2]: (['a', 'a', 'C', 'c', 'e', 'h', 'r', 'r', 'S', 't'],\n                 [2, 4, 0, 5, 7, 1, 3, 8, 9, 6])\n    \"\"\"\n\n    first = list(args[0])\n    if not len(first):\n        return args\n\n    globalkey = kw.get('globalkey')\n    key = kw.get('key')\n    if key is None:\n        if globalkey:\n            # if global sort function given and no local (secondary) key given, ==> no tiebreakers\n            key = lambda x: 0\n        else:\n            key = lambda x: x  # if no global sort and no local sort keys given, sort by item values\n    if globalkey is None:\n        globalkey = lambda *x: 0\n\n    if not isinstance(globalkey, collections.abc.Callable):\n        raise ValueError('globalkey needs to be callable')\n\n    if isinstance(key, collections.abc.Callable):\n        k = lambda x: (globalkey(*x), key(x[0]))\n    elif isinstance(key, tuple):\n        key = (k if k else lambda x: 0 for k in key)\n        k = lambda x: (globalkey(*x),) + tuple(f(z) for (f, z) in zip(key, x))\n    else:\n        raise KeyError(\n            \"kw arg 'key' should be None, callable, or a sequence of callables, not {}\"\n            .format(type(key)))\n\n    res = sorted(list(zip(*args)), key=k)\n    if 'order' in kw:\n        if kw['order'].startswith(('descend', 'reverse')):\n            res = reversed(res)\n\n    return tuple(map(list, zip(*res)))"},{"col":0,"comment":"\n    Initialize a table reader allowing for common customizations.  Most of the\n    default behavior for various parameters is determined by the Reader class.\n\n    Parameters\n    ----------\n    Reader : `~astropy.io.ascii.BaseReader`\n        Reader class (DEPRECATED). Default is :class:`Basic`.\n    Inputter : `~astropy.io.ascii.BaseInputter`\n        Inputter class\n    Outputter : `~astropy.io.ascii.BaseOutputter`\n        Outputter class\n    delimiter : str\n        Column delimiter string\n    comment : str\n        Regular expression defining a comment line in table\n    quotechar : str\n        One-character string to quote fields containing special characters\n    header_start : int\n        Line index for the header line not counting comment or blank lines.\n        A line with only whitespace is considered blank.\n    data_start : int\n        Line index for the start of data not counting comment or blank lines.\n        A line with only whitespace is considered blank.\n    data_end : int\n        Line index for the end of data not counting comment or blank lines.\n        This value can be negative to count from the end.\n    converters : dict\n        Dict of converters.\n    data_Splitter : `~astropy.io.ascii.BaseSplitter`\n        Splitter class to split data columns.\n    header_Splitter : `~astropy.io.ascii.BaseSplitter`\n        Splitter class to split header columns.\n    names : list\n        List of names corresponding to each data column.\n    include_names : list, optional\n        List of names to include in output.\n    exclude_names : list\n        List of names to exclude from output (applied after ``include_names``).\n    fill_values : tuple, list of tuple\n        Specification of fill values for bad or missing table values.\n    fill_include_names : list\n        List of names to include in fill_values.\n    fill_exclude_names : list\n        List of names to exclude from fill_values (applied after ``fill_include_names``).\n\n    Returns\n    -------\n    reader : `~astropy.io.ascii.BaseReader` subclass\n        ASCII format reader instance\n    ","endLoc":175,"header":"def get_reader(Reader=None, Inputter=None, Outputter=None, **kwargs)","id":5237,"name":"get_reader","nodeType":"Function","startLoc":112,"text":"def get_reader(Reader=None, Inputter=None, Outputter=None, **kwargs):\n    \"\"\"\n    Initialize a table reader allowing for common customizations.  Most of the\n    default behavior for various parameters is determined by the Reader class.\n\n    Parameters\n    ----------\n    Reader : `~astropy.io.ascii.BaseReader`\n        Reader class (DEPRECATED). Default is :class:`Basic`.\n    Inputter : `~astropy.io.ascii.BaseInputter`\n        Inputter class\n    Outputter : `~astropy.io.ascii.BaseOutputter`\n        Outputter class\n    delimiter : str\n        Column delimiter string\n    comment : str\n        Regular expression defining a comment line in table\n    quotechar : str\n        One-character string to quote fields containing special characters\n    header_start : int\n        Line index for the header line not counting comment or blank lines.\n        A line with only whitespace is considered blank.\n    data_start : int\n        Line index for the start of data not counting comment or blank lines.\n        A line with only whitespace is considered blank.\n    data_end : int\n        Line index for the end of data not counting comment or blank lines.\n        This value can be negative to count from the end.\n    converters : dict\n        Dict of converters.\n    data_Splitter : `~astropy.io.ascii.BaseSplitter`\n        Splitter class to split data columns.\n    header_Splitter : `~astropy.io.ascii.BaseSplitter`\n        Splitter class to split header columns.\n    names : list\n        List of names corresponding to each data column.\n    include_names : list, optional\n        List of names to include in output.\n    exclude_names : list\n        List of names to exclude from output (applied after ``include_names``).\n    fill_values : tuple, list of tuple\n        Specification of fill values for bad or missing table values.\n    fill_include_names : list\n        List of names to include in fill_values.\n    fill_exclude_names : list\n        List of names to exclude from fill_values (applied after ``fill_include_names``).\n\n    Returns\n    -------\n    reader : `~astropy.io.ascii.BaseReader` subclass\n        ASCII format reader instance\n    \"\"\"\n    # This function is a light wrapper around core._get_reader to provide a\n    # public interface with a default Reader.\n    if Reader is None:\n        # Default reader is Basic unless fast reader is forced\n        fast_reader = _get_fast_reader_dict(kwargs)\n        if fast_reader['enable'] == 'force':\n            Reader = fastbasic.FastBasic\n        else:\n            Reader = basic.Basic\n\n    reader = core._get_reader(Reader, Inputter=Inputter, Outputter=Outputter, **kwargs)\n    return reader"},{"col":0,"comment":"Initialize a table reader allowing for common customizations.  See ui.get_reader()\n    for param docs.  This routine is for internal (package) use only and is useful\n    because it depends only on the \"core\" module.\n    ","endLoc":1665,"header":"def _get_reader(Reader, Inputter=None, Outputter=None, **kwargs)","id":5238,"name":"_get_reader","nodeType":"Function","startLoc":1565,"text":"def _get_reader(Reader, Inputter=None, Outputter=None, **kwargs):\n    \"\"\"Initialize a table reader allowing for common customizations.  See ui.get_reader()\n    for param docs.  This routine is for internal (package) use only and is useful\n    because it depends only on the \"core\" module.\n    \"\"\"\n\n    from .fastbasic import FastBasic\n    if issubclass(Reader, FastBasic):  # Fast readers handle args separately\n        if Inputter is not None:\n            kwargs['Inputter'] = Inputter\n        return Reader(**kwargs)\n\n    # If user explicitly passed a fast reader with enable='force'\n    # (e.g. by passing non-default options), raise an error for slow readers\n    if 'fast_reader' in kwargs:\n        if kwargs['fast_reader']['enable'] == 'force':\n            raise ParameterError('fast_reader required with '\n                                 '{}, but this is not a fast C reader: {}'\n                                 .format(kwargs['fast_reader'], Reader))\n        else:\n            del kwargs['fast_reader']  # Otherwise ignore fast_reader parameter\n\n    reader_kwargs = dict([k, v] for k, v in kwargs.items() if k not in extra_reader_pars)\n    reader = Reader(**reader_kwargs)\n\n    if Inputter is not None:\n        reader.inputter = Inputter()\n\n    if Outputter is not None:\n        reader.outputter = Outputter()\n\n    # Issue #855 suggested to set data_start to header_start + default_header_length\n    # Thus, we need to retrieve this from the class definition before resetting these numbers.\n    try:\n        default_header_length = reader.data.start_line - reader.header.start_line\n    except TypeError:  # Start line could be None or an instancemethod\n        default_header_length = None\n\n    # csv.reader is hard-coded to recognise either '\\r' or '\\n' as end-of-line,\n    # therefore DefaultSplitter cannot handle these as delimiters.\n    if 'delimiter' in kwargs:\n        if kwargs['delimiter'] in ('\\n', '\\r', '\\r\\n'):\n            reader.header.splitter = BaseSplitter()\n            reader.data.splitter = BaseSplitter()\n        reader.header.splitter.delimiter = kwargs['delimiter']\n        reader.data.splitter.delimiter = kwargs['delimiter']\n    if 'comment' in kwargs:\n        reader.header.comment = kwargs['comment']\n        reader.data.comment = kwargs['comment']\n    if 'quotechar' in kwargs:\n        reader.header.splitter.quotechar = kwargs['quotechar']\n        reader.data.splitter.quotechar = kwargs['quotechar']\n    if 'data_start' in kwargs:\n        reader.data.start_line = kwargs['data_start']\n    if 'data_end' in kwargs:\n        reader.data.end_line = kwargs['data_end']\n    if 'header_start' in kwargs:\n        if (reader.header.start_line is not None):\n            reader.header.start_line = kwargs['header_start']\n            # For FixedWidthTwoLine the data_start is calculated relative to the position line.\n            # However, position_line is given as absolute number and not relative to header_start.\n            # So, ignore this Reader here.\n            if (('data_start' not in kwargs) and (default_header_length is not None)\n                    and reader._format_name not in ['fixed_width_two_line', 'commented_header']):\n                reader.data.start_line = reader.header.start_line + default_header_length\n        elif kwargs['header_start'] is not None:\n            # User trying to set a None header start to some value other than None\n            raise ValueError('header_start cannot be modified for this Reader')\n    if 'converters' in kwargs:\n        reader.outputter.converters = kwargs['converters']\n    if 'data_Splitter' in kwargs:\n        reader.data.splitter = kwargs['data_Splitter']()\n    if 'header_Splitter' in kwargs:\n        reader.header.splitter = kwargs['header_Splitter']()\n    if 'names' in kwargs:\n        reader.names = kwargs['names']\n        if None in reader.names:\n            raise TypeError('Cannot have None for column name')\n        if len(set(reader.names)) != len(reader.names):\n            raise ValueError('Duplicate column names')\n    if 'include_names' in kwargs:\n        reader.include_names = kwargs['include_names']\n    if 'exclude_names' in kwargs:\n        reader.exclude_names = kwargs['exclude_names']\n    # Strict names is normally set only within the guessing process to\n    # indicate that column names cannot be numeric or have certain\n    # characters at the beginning or end.  It gets used in\n    # BaseHeader.check_column_names().\n    if 'strict_names' in kwargs:\n        reader.strict_names = kwargs['strict_names']\n    if 'fill_values' in kwargs:\n        reader.data.fill_values = kwargs['fill_values']\n    if 'fill_include_names' in kwargs:\n        reader.data.fill_include_names = kwargs['fill_include_names']\n    if 'fill_exclude_names' in kwargs:\n        reader.data.fill_exclude_names = kwargs['fill_exclude_names']\n    if 'encoding' in kwargs:\n        reader.encoding = kwargs['encoding']\n        reader.inputter.encoding = kwargs['encoding']\n\n    return reader"},{"col":4,"comment":"null","endLoc":626,"header":"def read(self, table)","id":5239,"name":"read","nodeType":"Function","startLoc":623,"text":"def read(self, table):\n        self.lines = self.inputter.get_lines(table, newline=\"\\n\")\n        return _read_table_qdp(self.lines, table_id=self.table_id,\n                               names=self.names, delimiter=self.delimiter)"},{"col":18,"endLoc":92,"id":5240,"nodeType":"Lambda","startLoc":92,"text":"lambda x: 0"},{"col":18,"endLoc":94,"id":5241,"nodeType":"Lambda","startLoc":94,"text":"lambda x: x"},{"col":20,"endLoc":96,"id":5242,"nodeType":"Lambda","startLoc":96,"text":"lambda *x: 0"},{"col":0,"comment":"Read a table from a QDP file\n\n    Parameters\n    ----------\n    qdp_file : str\n        Input QDP file name\n\n    Other Parameters\n    ----------------\n    names : list of str\n        Name of data columns (defaults to ['col1', 'col2', ...]), _not_\n        including error columns.\n\n    table_id : int, default 0\n        Number of the table to be read from the QDP file. This is useful\n        when multiple tables present in the file. By default, the first is read.\n\n    delimiter : str\n        Any delimiter accepted by the `sep` argument of str.split()\n\n    Returns\n    -------\n    tables : list of `~astropy.table.Table`\n        List containing all the tables present inside the QDP file\n    ","endLoc":420,"header":"def _read_table_qdp(qdp_file, names=None, table_id=None, delimiter=None)","id":5243,"name":"_read_table_qdp","nodeType":"Function","startLoc":387,"text":"def _read_table_qdp(qdp_file, names=None, table_id=None, delimiter=None):\n    \"\"\"Read a table from a QDP file\n\n    Parameters\n    ----------\n    qdp_file : str\n        Input QDP file name\n\n    Other Parameters\n    ----------------\n    names : list of str\n        Name of data columns (defaults to ['col1', 'col2', ...]), _not_\n        including error columns.\n\n    table_id : int, default 0\n        Number of the table to be read from the QDP file. This is useful\n        when multiple tables present in the file. By default, the first is read.\n\n    delimiter : str\n        Any delimiter accepted by the `sep` argument of str.split()\n\n    Returns\n    -------\n    tables : list of `~astropy.table.Table`\n        List containing all the tables present inside the QDP file\n    \"\"\"\n    if table_id is None:\n        warnings.warn(\"table_id not specified. Reading the first available \"\n                      \"table\", AstropyUserWarning)\n        table_id = 0\n\n    tables = _get_tables_from_qdp_file(qdp_file, input_colnames=names, delimiter=delimiter)\n\n    return tables[table_id]"},{"col":0,"comment":"Get all tables from a QDP file\n\n    Parameters\n    ----------\n    qdp_file : str\n        Input QDP file name\n\n    Other Parameters\n    ----------------\n    input_colnames : list of str\n        Name of data columns (defaults to ['col1', 'col2', ...]), _not_\n        including error columns.\n    delimiter : str\n        Delimiter for the values in the table.\n\n    Returns\n    -------\n    list of `~astropy.table.Table`\n        List containing all the tables present inside the QDP file\n    ","endLoc":344,"header":"def _get_tables_from_qdp_file(qdp_file, input_colnames=None, delimiter=None)","id":5244,"name":"_get_tables_from_qdp_file","nodeType":"Function","startLoc":237,"text":"def _get_tables_from_qdp_file(qdp_file, input_colnames=None, delimiter=None):\n    \"\"\"Get all tables from a QDP file\n\n    Parameters\n    ----------\n    qdp_file : str\n        Input QDP file name\n\n    Other Parameters\n    ----------------\n    input_colnames : list of str\n        Name of data columns (defaults to ['col1', 'col2', ...]), _not_\n        including error columns.\n    delimiter : str\n        Delimiter for the values in the table.\n\n    Returns\n    -------\n    list of `~astropy.table.Table`\n        List containing all the tables present inside the QDP file\n    \"\"\"\n\n    lines = _get_lines_from_file(qdp_file)\n    contents, ncol = _get_type_from_list_of_lines(lines, delimiter=delimiter)\n\n    table_list = []\n    err_specs = {}\n    colnames = None\n\n    comment_text = \"\"\n    initial_comments = \"\"\n    command_lines = \"\"\n    current_rows = None\n\n    for line, datatype in zip(lines, contents):\n        line = line.strip().lstrip('!')\n        # Is this a comment?\n        if datatype == \"comment\":\n            comment_text += line + '\\n'\n            continue\n\n        if datatype == \"command\":\n            # The first time I find commands, I save whatever comments into\n            # The initial comments.\n            if command_lines == \"\":\n                initial_comments = comment_text\n                comment_text = \"\"\n\n            if err_specs != {}:\n                warnings.warn(\n                    \"This file contains multiple command blocks. Please verify\",\n                    AstropyUserWarning\n                )\n            command_lines += line + '\\n'\n            continue\n\n        if datatype.startswith(\"data\"):\n            # The first time I find data, I define err_specs\n            if err_specs == {} and command_lines != \"\":\n                for cline in command_lines.strip().split('\\n'):\n                    command = cline.strip().split()\n                    # This should never happen, but just in case.\n                    if len(command) < 3:\n                        continue\n                    err_specs[command[1].lower()] = [int(c) for c in\n                                                     command[2:]]\n            if colnames is None:\n                colnames = _interpret_err_lines(\n                    err_specs, ncol, names=input_colnames\n                )\n\n            if current_rows is None:\n                current_rows = []\n\n            values = []\n            for v in line.split(delimiter):\n                if v == \"NO\":\n                    values.append(np.ma.masked)\n                else:\n                    # Understand if number is int or float\n                    try:\n                        values.append(int(v))\n                    except ValueError:\n                        values.append(float(v))\n            current_rows.append(values)\n            continue\n\n        if datatype == \"new\":\n            # Save table to table_list and reset\n            if current_rows is not None:\n                new_table = Table(names=colnames, rows=current_rows)\n                new_table.meta[\"initial_comments\"] = initial_comments.strip().split(\"\\n\")\n                new_table.meta[\"comments\"] = comment_text.strip().split(\"\\n\")\n                # Reset comments\n                comment_text = \"\"\n                table_list.append(new_table)\n                current_rows = None\n            continue\n\n    # At the very end, if there is still a table being written, let's save\n    # it to the table_list\n    if current_rows is not None:\n        new_table = Table(names=colnames, rows=current_rows)\n        new_table.meta[\"initial_comments\"] = initial_comments.strip().split(\"\\n\")\n        new_table.meta[\"comments\"] = comment_text.strip().split(\"\\n\")\n        table_list.append(new_table)\n\n    return table_list"},{"attributeType":"null","col":4,"comment":"null","endLoc":301,"id":5245,"name":"_format_name","nodeType":"Attribute","startLoc":301,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":302,"id":5246,"name":"_io_registry_format_aliases","nodeType":"Attribute","startLoc":302,"text":"_io_registry_format_aliases"},{"attributeType":"null","col":4,"comment":"null","endLoc":303,"id":5247,"name":"_io_registry_can_write","nodeType":"Attribute","startLoc":303,"text":"_io_registry_can_write"},{"attributeType":"null","col":4,"comment":"null","endLoc":304,"id":5248,"name":"_description","nodeType":"Attribute","startLoc":304,"text":"_description"},{"col":0,"comment":"null","endLoc":145,"header":"def _get_lines_from_file(qdp_file)","id":5249,"name":"_get_lines_from_file","nodeType":"Function","startLoc":134,"text":"def _get_lines_from_file(qdp_file):\n    if \"\\n\" in qdp_file:\n        lines = qdp_file.split(\"\\n\")\n    elif isinstance(qdp_file, str):\n        with open(qdp_file) as fobj:\n            lines = [line.strip() for line in fobj.readlines()]\n    elif isinstance(qdp_file, Iterable):\n        lines = qdp_file\n    else:\n        raise ValueError('invalid value of qdb_file')\n\n    return lines"},{"attributeType":"CdsData","col":4,"comment":"null","endLoc":306,"id":5250,"name":"data_class","nodeType":"Attribute","startLoc":306,"text":"data_class"},{"col":0,"comment":"Read through the list of QDP file lines and label each line by type\n\n    Parameters\n    ----------\n    lines : list\n        List containing one file line in each entry\n\n    Returns\n    -------\n    contents : list\n        List containing the type for each line (see `line_type_and_data`)\n    ncol : int\n        The number of columns in the data lines. Must be the same throughout\n        the file\n\n    Examples\n    --------\n    >>> line0 = \"! A comment\"\n    >>> line1 = \"543 12 456.0\"\n    >>> lines = [line0, line1]\n    >>> types, ncol = _get_type_from_list_of_lines(lines)\n    >>> types[0]\n    'comment'\n    >>> types[1]\n    'data,3'\n    >>> ncol\n    3\n    >>> lines.append(\"23\")\n    >>> _get_type_from_list_of_lines(lines)\n    Traceback (most recent call last):\n        ...\n    ValueError: Inconsistent number of columns\n    ","endLoc":131,"header":"def _get_type_from_list_of_lines(lines, delimiter=None)","id":5251,"name":"_get_type_from_list_of_lines","nodeType":"Function","startLoc":86,"text":"def _get_type_from_list_of_lines(lines, delimiter=None):\n    \"\"\"Read through the list of QDP file lines and label each line by type\n\n    Parameters\n    ----------\n    lines : list\n        List containing one file line in each entry\n\n    Returns\n    -------\n    contents : list\n        List containing the type for each line (see `line_type_and_data`)\n    ncol : int\n        The number of columns in the data lines. Must be the same throughout\n        the file\n\n    Examples\n    --------\n    >>> line0 = \"! A comment\"\n    >>> line1 = \"543 12 456.0\"\n    >>> lines = [line0, line1]\n    >>> types, ncol = _get_type_from_list_of_lines(lines)\n    >>> types[0]\n    'comment'\n    >>> types[1]\n    'data,3'\n    >>> ncol\n    3\n    >>> lines.append(\"23\")\n    >>> _get_type_from_list_of_lines(lines)\n    Traceback (most recent call last):\n        ...\n    ValueError: Inconsistent number of columns\n    \"\"\"\n\n    types = [_line_type(line, delimiter=delimiter) for line in lines]\n    current_ncol = None\n    for type_ in types:\n        if type_.startswith('data', ):\n            ncol = int(type_[5:])\n            if current_ncol is None:\n                current_ncol = ncol\n            elif ncol != current_ncol:\n                raise ValueError('Inconsistent number of columns')\n\n    return types, current_ncol"},{"col":0,"comment":"Interpret a QDP file line\n\n    Parameters\n    ----------\n    line : str\n        a single line of the file\n\n    Returns\n    -------\n    type : str\n        Line type: \"comment\", \"command\", or \"data\"\n\n    Examples\n    --------\n    >>> _line_type(\"READ SERR 3\")\n    'command'\n    >>> _line_type(\" \\n    !some gibberish\")\n    'comment'\n    >>> _line_type(\"   \")\n    'comment'\n    >>> _line_type(\" 21345.45\")\n    'data,1'\n    >>> _line_type(\" 21345.45 1.53e-3 1e-3 .04 NO nan\")\n    'data,6'\n    >>> _line_type(\" 21345.45,1.53e-3,1e-3,.04,NO,nan\", delimiter=',')\n    'data,6'\n    >>> _line_type(\" 21345.45 ! a comment to disturb\")\n    'data,1'\n    >>> _line_type(\"NO NO NO NO NO\")\n    'new'\n    >>> _line_type(\"NO,NO,NO,NO,NO\", delimiter=',')\n    'new'\n    >>> _line_type(\"N O N NOON OON O\")\n    Traceback (most recent call last):\n        ...\n    ValueError: Unrecognized QDP line...\n    >>> _line_type(\" some non-comment gibberish\")\n    Traceback (most recent call last):\n        ...\n    ValueError: Unrecognized QDP line...\n    ","endLoc":83,"header":"def _line_type(line, delimiter=None)","id":5252,"name":"_line_type","nodeType":"Function","startLoc":18,"text":"def _line_type(line, delimiter=None):\n    \"\"\"Interpret a QDP file line\n\n    Parameters\n    ----------\n    line : str\n        a single line of the file\n\n    Returns\n    -------\n    type : str\n        Line type: \"comment\", \"command\", or \"data\"\n\n    Examples\n    --------\n    >>> _line_type(\"READ SERR 3\")\n    'command'\n    >>> _line_type(\" \\\\n    !some gibberish\")\n    'comment'\n    >>> _line_type(\"   \")\n    'comment'\n    >>> _line_type(\" 21345.45\")\n    'data,1'\n    >>> _line_type(\" 21345.45 1.53e-3 1e-3 .04 NO nan\")\n    'data,6'\n    >>> _line_type(\" 21345.45,1.53e-3,1e-3,.04,NO,nan\", delimiter=',')\n    'data,6'\n    >>> _line_type(\" 21345.45 ! a comment to disturb\")\n    'data,1'\n    >>> _line_type(\"NO NO NO NO NO\")\n    'new'\n    >>> _line_type(\"NO,NO,NO,NO,NO\", delimiter=',')\n    'new'\n    >>> _line_type(\"N O N NOON OON O\")\n    Traceback (most recent call last):\n        ...\n    ValueError: Unrecognized QDP line...\n    >>> _line_type(\" some non-comment gibberish\")\n    Traceback (most recent call last):\n        ...\n    ValueError: Unrecognized QDP line...\n    \"\"\"\n    _decimal_re = r'[+-]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][+-]?\\d+)?'\n    _command_re = r'READ [TS]ERR(\\s+[0-9]+)+'\n\n    sep = delimiter\n    if delimiter is None:\n        sep = r'\\s+'\n    _new_re = rf'NO({sep}NO)+'\n    _data_re = rf'({_decimal_re}|NO|[-+]?nan)({sep}({_decimal_re}|NO|[-+]?nan))*)'\n    _type_re = rf'^\\s*((?P<command>{_command_re})|(?P<new>{_new_re})|(?P<data>{_data_re})?\\s*(\\!(?P<comment>.*))?\\s*$'\n    _line_type_re = re.compile(_type_re)\n    line = line.strip()\n    if not line:\n        return 'comment'\n    match = _line_type_re.match(line)\n\n    if match is None:\n        raise ValueError(f'Unrecognized QDP line: {line}')\n    for type_, val in match.groupdict().items():\n        if val is None:\n            continue\n        if type_ == 'data':\n            return f'data,{len(val.split(sep=delimiter))}'\n        else:\n            return type_"},{"attributeType":"CdsHeader","col":4,"comment":"null","endLoc":307,"id":5253,"name":"header_class","nodeType":"Attribute","startLoc":307,"text":"header_class"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":5254,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":24,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":9,"header":"cds.py#<anonymous>","id":5255,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"An extensible ASCII table reader and writer.\n\ncds.py:\n  Classes to read CDS / Vizier table format\n\n:Copyright: Smithsonian Astrophysical Observatory (2011)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\"\n\n__doctest_skip__ = ['*']"},{"fileName":"__init__.py","filePath":"astropy/io/ascii","id":5256,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\" An extensible ASCII table reader and writer.\n\n\"\"\"\n# flake8: noqa\n\nfrom .core import (InconsistentTableError,\n                   ParameterError,\n                   NoType, StrType, NumType, FloatType, IntType, AllType,\n                   Column,\n                   BaseInputter, ContinuationLinesInputter,\n                   BaseHeader,\n                   BaseData,\n                   BaseOutputter, TableOutputter,\n                   BaseReader,\n                   BaseSplitter, DefaultSplitter, WhitespaceSplitter,\n                   convert_numpy,\n                   masked\n                   )\nfrom .basic import (Basic, BasicHeader, BasicData,\n                    Rdb,\n                    Csv,\n                    Tab,\n                    NoHeader,\n                    CommentedHeader)\nfrom .fastbasic import (FastBasic,\n                        FastCsv,\n                        FastTab,\n                        FastNoHeader,\n                        FastCommentedHeader,\n                        FastRdb)\nfrom .cds import Cds\nfrom .mrt import Mrt\nfrom .ecsv import Ecsv\nfrom .latex import Latex, AASTex, latexdicts\nfrom .html import HTML\nfrom .ipac import Ipac\nfrom .daophot import Daophot\nfrom .qdp import QDP\nfrom .sextractor import SExtractor\nfrom .fixedwidth import (FixedWidth, FixedWidthNoHeader,\n                         FixedWidthTwoLine, FixedWidthSplitter,\n                         FixedWidthHeader, FixedWidthData)\nfrom .rst import RST\nfrom .ui import (set_guess, get_reader, read, get_writer, write, get_read_trace)\n\nfrom . import connect\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":121,"id":5257,"name":"WRITE_DOCSTRING","nodeType":"Attribute","startLoc":121,"text":"WRITE_DOCSTRING"},{"className":"CsvWriter","col":0,"comment":"\n    Internal class to replace the csv writer ``writerow`` and ``writerows``\n    functions so that in the case of ``delimiter=' '`` and\n    ``quoting=csv.QUOTE_MINIMAL``, the output field value is quoted for empty\n    fields (when value == '').\n\n    This changes the API slightly in that the writerow() and writerows()\n    methods return the output written string instead of the length of\n    that string.\n\n    Examples\n    --------\n\n    >>> from astropy.io.ascii.core import CsvWriter\n    >>> writer = CsvWriter(delimiter=' ')\n    >>> print(writer.writerow(['hello', '', 'world']))\n    hello \"\" world\n    ","endLoc":155,"id":5258,"nodeType":"Class","startLoc":61,"text":"class CsvWriter:\n    \"\"\"\n    Internal class to replace the csv writer ``writerow`` and ``writerows``\n    functions so that in the case of ``delimiter=' '`` and\n    ``quoting=csv.QUOTE_MINIMAL``, the output field value is quoted for empty\n    fields (when value == '').\n\n    This changes the API slightly in that the writerow() and writerows()\n    methods return the output written string instead of the length of\n    that string.\n\n    Examples\n    --------\n\n    >>> from astropy.io.ascii.core import CsvWriter\n    >>> writer = CsvWriter(delimiter=' ')\n    >>> print(writer.writerow(['hello', '', 'world']))\n    hello \"\" world\n    \"\"\"\n    # Random 16-character string that gets injected instead of any\n    # empty fields and is then replaced post-write with doubled-quotechar.\n    # Created with:\n    # ''.join(random.choice(string.printable[:90]) for _ in range(16))\n    replace_sentinel = '2b=48Av%0-V3p>bX'\n\n    def __init__(self, csvfile=None, **kwargs):\n        self.csvfile = csvfile\n\n        # Temporary StringIO for catching the real csv.writer() object output\n        self.temp_out = StringIO()\n        self.writer = csv.writer(self.temp_out, **kwargs)\n\n        dialect = self.writer.dialect\n        self.quotechar2 = dialect.quotechar * 2\n        self.quote_empty = (dialect.quoting == csv.QUOTE_MINIMAL) and (dialect.delimiter == ' ')\n\n    def writerow(self, values):\n        \"\"\"\n        Similar to csv.writer.writerow but with the custom quoting behavior.\n        Returns the written string instead of the length of that string.\n        \"\"\"\n        has_empty = False\n\n        # If QUOTE_MINIMAL and space-delimited then replace empty fields with\n        # the sentinel value.\n        if self.quote_empty:\n            for i, value in enumerate(values):\n                if value == '':\n                    has_empty = True\n                    values[i] = self.replace_sentinel\n\n        return self._writerow(self.writer.writerow, values, has_empty)\n\n    def writerows(self, values_list):\n        \"\"\"\n        Similar to csv.writer.writerows but with the custom quoting behavior.\n        Returns the written string instead of the length of that string.\n        \"\"\"\n        has_empty = False\n\n        # If QUOTE_MINIMAL and space-delimited then replace empty fields with\n        # the sentinel value.\n        if self.quote_empty:\n            for values in values_list:\n                for i, value in enumerate(values):\n                    if value == '':\n                        has_empty = True\n                        values[i] = self.replace_sentinel\n\n        return self._writerow(self.writer.writerows, values_list, has_empty)\n\n    def _writerow(self, writerow_func, values, has_empty):\n        \"\"\"\n        Call ``writerow_func`` (either writerow or writerows) with ``values``.\n        If it has empty fields that have been replaced then change those\n        sentinel strings back to quoted empty strings, e.g. ``\"\"``.\n        \"\"\"\n        # Clear the temporary StringIO buffer that self.writer writes into and\n        # then call the real csv.writer().writerow or writerows with values.\n        self.temp_out.seek(0)\n        self.temp_out.truncate()\n        writerow_func(values)\n\n        row_string = self.temp_out.getvalue()\n\n        if self.quote_empty and has_empty:\n            row_string = re.sub(self.replace_sentinel, self.quotechar2, row_string)\n\n        # self.csvfile is defined then write the output.  In practice the pure\n        # Python writer calls with csvfile=None, while the fast writer calls with\n        # a file-like object.\n        if self.csvfile:\n            self.csvfile.write(row_string)\n\n        return row_string"},{"col":12,"endLoc":102,"id":5259,"nodeType":"Lambda","startLoc":102,"text":"lambda x: (globalkey(*x), key(x[0]))"},{"col":4,"comment":"\n        Similar to csv.writer.writerow but with the custom quoting behavior.\n        Returns the written string instead of the length of that string.\n        ","endLoc":112,"header":"def writerow(self, values)","id":5260,"name":"writerow","nodeType":"Function","startLoc":97,"text":"def writerow(self, values):\n        \"\"\"\n        Similar to csv.writer.writerow but with the custom quoting behavior.\n        Returns the written string instead of the length of that string.\n        \"\"\"\n        has_empty = False\n\n        # If QUOTE_MINIMAL and space-delimited then replace empty fields with\n        # the sentinel value.\n        if self.quote_empty:\n            for i, value in enumerate(values):\n                if value == '':\n                    has_empty = True\n                    values[i] = self.replace_sentinel\n\n        return self._writerow(self.writer.writerow, values, has_empty)"},{"col":27,"endLoc":104,"id":5261,"nodeType":"Lambda","startLoc":104,"text":"lambda x: 0"},{"className":"InconsistentTableError","col":0,"comment":"\n    Indicates that an input table is inconsistent in some way.\n\n    The default behavior of ``BaseReader`` is to throw an instance of\n    this class if a data row doesn't match the header.\n    ","endLoc":192,"id":5262,"nodeType":"Class","startLoc":186,"text":"class InconsistentTableError(ValueError):\n    \"\"\"\n    Indicates that an input table is inconsistent in some way.\n\n    The default behavior of ``BaseReader`` is to throw an instance of\n    this class if a data row doesn't match the header.\n    \"\"\""},{"className":"ParameterError","col":0,"comment":"\n    Indicates that a reader cannot handle a passed parameter.\n\n    The C-based fast readers in ``io.ascii`` raise an instance of\n    this error class upon encountering a parameter that the\n    C engine cannot handle.\n    ","endLoc":212,"id":5263,"nodeType":"Class","startLoc":205,"text":"class ParameterError(NotImplementedError):\n    \"\"\"\n    Indicates that a reader cannot handle a passed parameter.\n\n    The C-based fast readers in ``io.ascii`` raise an instance of\n    this error class upon encountering a parameter that the\n    C engine cannot handle.\n    \"\"\""},{"className":"NoType","col":0,"comment":"\n    Superclass for ``StrType`` and ``NumType`` classes.\n\n    This class is the default type of ``Column`` and provides a base\n    class for other data types.\n    ","endLoc":228,"id":5264,"nodeType":"Class","startLoc":222,"text":"class NoType:\n    \"\"\"\n    Superclass for ``StrType`` and ``NumType`` classes.\n\n    This class is the default type of ``Column`` and provides a base\n    class for other data types.\n    \"\"\""},{"className":"StrType","col":0,"comment":"\n    Indicates that a column consists of text data.\n    ","endLoc":234,"id":5265,"nodeType":"Class","startLoc":231,"text":"class StrType(NoType):\n    \"\"\"\n    Indicates that a column consists of text data.\n    \"\"\""},{"className":"NumType","col":0,"comment":"\n    Indicates that a column consists of numerical data.\n    ","endLoc":240,"id":5266,"nodeType":"Class","startLoc":237,"text":"class NumType(NoType):\n    \"\"\"\n    Indicates that a column consists of numerical data.\n    \"\"\""},{"className":"FloatType","col":0,"comment":"\n    Describes floating-point data.\n    ","endLoc":246,"id":5267,"nodeType":"Class","startLoc":243,"text":"class FloatType(NumType):\n    \"\"\"\n    Describes floating-point data.\n    \"\"\""},{"className":"IntType","col":0,"comment":"\n    Describes integer data.\n    ","endLoc":258,"id":5268,"nodeType":"Class","startLoc":255,"text":"class IntType(NumType):\n    \"\"\"\n    Describes integer data.\n    \"\"\""},{"className":"AllType","col":0,"comment":"\n    Subclass of all other data types.\n\n    This type is returned by ``convert_numpy`` if the given numpy\n    type does not match ``StrType``, ``FloatType``, or ``IntType``.\n    ","endLoc":267,"id":5269,"nodeType":"Class","startLoc":261,"text":"class AllType(StrType, FloatType, IntType):\n    \"\"\"\n    Subclass of all other data types.\n\n    This type is returned by ``convert_numpy`` if the given numpy\n    type does not match ``StrType``, ``FloatType``, or ``IntType``.\n    \"\"\""},{"className":"Column","col":0,"comment":"Table column.\n\n    The key attributes of a Column object are:\n\n    * **name** : column name\n    * **type** : column type (NoType, StrType, NumType, FloatType, IntType)\n    * **dtype** : numpy dtype (optional, overrides **type** if set)\n    * **str_vals** : list of column values as strings\n    * **fill_values** : dict of fill values\n    * **shape** : list of element shape (default [] => scalar)\n    * **data** : list of converted column values\n    * **subtype** : actual datatype for columns serialized with JSON\n    ","endLoc":292,"id":5270,"nodeType":"Class","startLoc":270,"text":"class Column:\n    \"\"\"Table column.\n\n    The key attributes of a Column object are:\n\n    * **name** : column name\n    * **type** : column type (NoType, StrType, NumType, FloatType, IntType)\n    * **dtype** : numpy dtype (optional, overrides **type** if set)\n    * **str_vals** : list of column values as strings\n    * **fill_values** : dict of fill values\n    * **shape** : list of element shape (default [] => scalar)\n    * **data** : list of converted column values\n    * **subtype** : actual datatype for columns serialized with JSON\n    \"\"\"\n\n    def __init__(self, name):\n        self.name = name\n        self.type = NoType  # Generic type (Int, Float, Str etc)\n        self.dtype = None  # Numpy dtype if available\n        self.str_vals = []\n        self.fill_values = {}\n        self.shape = []\n        self.subtype = None"},{"attributeType":"null","col":8,"comment":"null","endLoc":289,"id":5271,"name":"str_vals","nodeType":"Attribute","startLoc":289,"text":"self.str_vals"},{"col":12,"endLoc":105,"id":5272,"nodeType":"Lambda","startLoc":105,"text":"lambda x: (globalkey(*x),) + tuple(f(z) for (f, z) in zip(key, x))"},{"attributeType":"null","col":8,"comment":"null","endLoc":291,"id":5273,"name":"shape","nodeType":"Attribute","startLoc":291,"text":"self.shape"},{"attributeType":"null","col":8,"comment":"null","endLoc":292,"id":5274,"name":"subtype","nodeType":"Attribute","startLoc":292,"text":"self.subtype"},{"attributeType":"null","col":8,"comment":"null","endLoc":286,"id":5275,"name":"name","nodeType":"Attribute","startLoc":286,"text":"self.name"},{"attributeType":"null","col":8,"comment":"null","endLoc":288,"id":5276,"name":"dtype","nodeType":"Attribute","startLoc":288,"text":"self.dtype"},{"attributeType":"null","col":8,"comment":"null","endLoc":287,"id":5277,"name":"type","nodeType":"Attribute","startLoc":287,"text":"self.type"},{"attributeType":"null","col":8,"comment":"null","endLoc":290,"id":5278,"name":"fill_values","nodeType":"Attribute","startLoc":290,"text":"self.fill_values"},{"className":"ContinuationLinesInputter","col":0,"comment":"Inputter where lines ending in ``continuation_char`` are joined\n    with the subsequent line.  Example::\n\n      col1 col2 col3\n      1 \n      2 3\n      4 5 \n      6\n    ","endLoc":1536,"id":5279,"nodeType":"Class","startLoc":1503,"text":"class ContinuationLinesInputter(BaseInputter):\n    \"\"\"Inputter where lines ending in ``continuation_char`` are joined\n    with the subsequent line.  Example::\n\n      col1 col2 col3\n      1 \\\n      2 3\n      4 5 \\\n      6\n    \"\"\"\n\n    continuation_char = '\\\\'\n    replace_char = ' '\n    # If no_continue is not None then lines matching this regex are not subject\n    # to line continuation.  The initial use case here is Daophot.  In this\n    # case the continuation character is just replaced with replace_char.\n    no_continue = None\n\n    def process_lines(self, lines):\n        re_no_continue = re.compile(self.no_continue) if self.no_continue else None\n\n        parts = []\n        outlines = []\n        for line in lines:\n            if re_no_continue and re_no_continue.match(line):\n                line = line.replace(self.continuation_char, self.replace_char)\n            if line.endswith(self.continuation_char):\n                parts.append(line.replace(self.continuation_char, self.replace_char))\n            else:\n                parts.append(line)\n                outlines.append(''.join(parts))\n                parts = []\n\n        return outlines"},{"col":4,"comment":"null","endLoc":1536,"header":"def process_lines(self, lines)","id":5280,"name":"process_lines","nodeType":"Function","startLoc":1521,"text":"def process_lines(self, lines):\n        re_no_continue = re.compile(self.no_continue) if self.no_continue else None\n\n        parts = []\n        outlines = []\n        for line in lines:\n            if re_no_continue and re_no_continue.match(line):\n                line = line.replace(self.continuation_char, self.replace_char)\n            if line.endswith(self.continuation_char):\n                parts.append(line.replace(self.continuation_char, self.replace_char))\n            else:\n                parts.append(line)\n                outlines.append(''.join(parts))\n                parts = []\n\n        return outlines"},{"col":0,"comment":"Give list of column names from the READ SERR and TERR commands\n\n    Parameters\n    ----------\n    err_specs : dict\n        ``{'serr': [n0, n1, ...], 'terr': [n2, n3, ...]}``\n        Error specifications for symmetric and two-sided errors\n    ncols : int\n        Number of data columns\n\n    Other Parameters\n    ----------------\n    names : list of str\n        Name of data columns (defaults to ['col1', 'col2', ...]), _not_\n        including error columns.\n\n    Returns\n    -------\n    colnames : list\n        List containing the column names. Error columns will have the name\n        of the main column plus ``_err`` for symmetric errors, and ``_perr``\n        and ``_nerr`` for positive and negative errors respectively\n\n    Examples\n    --------\n    >>> col_in = ['MJD', 'Rate']\n    >>> cols = _interpret_err_lines(None, 2, names=col_in)\n    >>> cols[0]\n    'MJD'\n    >>> err_specs = {'terr': [1], 'serr': [2]}\n    >>> ncols = 5\n    >>> cols = _interpret_err_lines(err_specs, ncols, names=col_in)\n    >>> cols[0]\n    'MJD'\n    >>> cols[2]\n    'MJD_nerr'\n    >>> cols[4]\n    'Rate_err'\n    >>> _interpret_err_lines(err_specs, 6, names=col_in)\n    Traceback (most recent call last):\n        ...\n    ValueError: Inconsistent number of input colnames\n    ","endLoc":234,"header":"def _interpret_err_lines(err_specs, ncols, names=None)","id":5281,"name":"_interpret_err_lines","nodeType":"Function","startLoc":148,"text":"def _interpret_err_lines(err_specs, ncols, names=None):\n    \"\"\"Give list of column names from the READ SERR and TERR commands\n\n    Parameters\n    ----------\n    err_specs : dict\n        ``{'serr': [n0, n1, ...], 'terr': [n2, n3, ...]}``\n        Error specifications for symmetric and two-sided errors\n    ncols : int\n        Number of data columns\n\n    Other Parameters\n    ----------------\n    names : list of str\n        Name of data columns (defaults to ['col1', 'col2', ...]), _not_\n        including error columns.\n\n    Returns\n    -------\n    colnames : list\n        List containing the column names. Error columns will have the name\n        of the main column plus ``_err`` for symmetric errors, and ``_perr``\n        and ``_nerr`` for positive and negative errors respectively\n\n    Examples\n    --------\n    >>> col_in = ['MJD', 'Rate']\n    >>> cols = _interpret_err_lines(None, 2, names=col_in)\n    >>> cols[0]\n    'MJD'\n    >>> err_specs = {'terr': [1], 'serr': [2]}\n    >>> ncols = 5\n    >>> cols = _interpret_err_lines(err_specs, ncols, names=col_in)\n    >>> cols[0]\n    'MJD'\n    >>> cols[2]\n    'MJD_nerr'\n    >>> cols[4]\n    'Rate_err'\n    >>> _interpret_err_lines(err_specs, 6, names=col_in)\n    Traceback (most recent call last):\n        ...\n    ValueError: Inconsistent number of input colnames\n    \"\"\"\n\n    colnames = [\"\" for i in range(ncols)]\n    if err_specs is None:\n        serr_cols = terr_cols = []\n\n    else:\n        # I don't want to empty the original one when using `pop` below\n        err_specs = copy.deepcopy(err_specs)\n\n        serr_cols = err_specs.pop(\"serr\", [])\n        terr_cols = err_specs.pop(\"terr\", [])\n\n    if names is not None:\n        all_error_cols = len(serr_cols) + len(terr_cols) * 2\n        if all_error_cols + len(names) != ncols:\n            raise ValueError(\"Inconsistent number of input colnames\")\n\n    shift = 0\n    for i in range(ncols):\n        col_num = i + 1 - shift\n        if colnames[i] != \"\":\n            continue\n\n        colname_root = f\"col{col_num}\"\n\n        if names is not None:\n            colname_root = names[col_num - 1]\n\n        colnames[i] = f\"{colname_root}\"\n        if col_num in serr_cols:\n            colnames[i + 1] = f\"{colname_root}_err\"\n            shift += 1\n            continue\n\n        if col_num in terr_cols:\n            colnames[i + 1] = f\"{colname_root}_perr\"\n            colnames[i + 2] = f\"{colname_root}_nerr\"\n            shift += 2\n            continue\n\n    assert not np.any([c == \"\" for c in colnames])\n\n    return colnames"},{"attributeType":"null","col":4,"comment":"null","endLoc":1514,"id":5282,"name":"continuation_char","nodeType":"Attribute","startLoc":1514,"text":"continuation_char"},{"attributeType":"null","col":4,"comment":"null","endLoc":1515,"id":5283,"name":"replace_char","nodeType":"Attribute","startLoc":1515,"text":"replace_char"},{"attributeType":"null","col":4,"comment":"null","endLoc":1519,"id":5284,"name":"no_continue","nodeType":"Attribute","startLoc":1519,"text":"no_continue"},{"col":0,"comment":"Extends the itertools.groupby functionality to arbitrary number of iterators.","endLoc":127,"header":"def groupmore(func=None, *its)","id":5285,"name":"groupmore","nodeType":"Function","startLoc":119,"text":"def groupmore(func=None, *its):\n    \"\"\"Extends the itertools.groupby functionality to arbitrary number of iterators.\"\"\"\n    if not func:\n        func = lambda x: x\n    its = sortmore(*its, key=func)\n    nfunc = lambda x: func(x[0])\n    zipper = itertools.groupby(zip(*its), nfunc)\n    unzipper = ((key, zip(*groups)) for key, groups in zipper)\n    return unzipper"},{"col":15,"endLoc":122,"id":5286,"nodeType":"Lambda","startLoc":122,"text":"lambda x: x"},{"className":"WhitespaceSplitter","col":0,"comment":"null","endLoc":1554,"id":5287,"nodeType":"Class","startLoc":1539,"text":"class WhitespaceSplitter(DefaultSplitter):\n    def process_line(self, line):\n        \"\"\"Replace tab with space within ``line`` while respecting quoted substrings\"\"\"\n        newline = []\n        in_quote = False\n        lastchar = None\n        for char in line:\n            if char == self.quotechar and (self.escapechar is None\n                                           or lastchar != self.escapechar):\n                in_quote = not in_quote\n            if char == '\\t' and not in_quote:\n                char = ' '\n            lastchar = char\n            newline.append(char)\n\n        return ''.join(newline)"},{"col":4,"comment":"Replace tab with space within ``line`` while respecting quoted substrings","endLoc":1554,"header":"def process_line(self, line)","id":5288,"name":"process_line","nodeType":"Function","startLoc":1540,"text":"def process_line(self, line):\n        \"\"\"Replace tab with space within ``line`` while respecting quoted substrings\"\"\"\n        newline = []\n        in_quote = False\n        lastchar = None\n        for char in line:\n            if char == self.quotechar and (self.escapechar is None\n                                           or lastchar != self.escapechar):\n                in_quote = not in_quote\n            if char == '\\t' and not in_quote:\n                char = ' '\n            lastchar = char\n            newline.append(char)\n\n        return ''.join(newline)"},{"attributeType":"null","col":0,"comment":"null","endLoc":183,"id":5289,"name":"masked","nodeType":"Attribute","startLoc":183,"text":"masked"},{"className":"FastBasic","col":0,"comment":"\n    This class is intended to handle the same format addressed by the\n    ordinary :class:`Basic` writer, but it acts as a wrapper for underlying C\n    code and is therefore much faster. Unlike the other ASCII readers and\n    writers, this class is not very extensible and is restricted\n    by optimization requirements.\n    ","endLoc":184,"id":5290,"nodeType":"Class","startLoc":13,"text":"class FastBasic(metaclass=core.MetaBaseReader):\n    \"\"\"\n    This class is intended to handle the same format addressed by the\n    ordinary :class:`Basic` writer, but it acts as a wrapper for underlying C\n    code and is therefore much faster. Unlike the other ASCII readers and\n    writers, this class is not very extensible and is restricted\n    by optimization requirements.\n    \"\"\"\n    _format_name = 'fast_basic'\n    _description = 'Basic table with custom delimiter using the fast C engine'\n    _fast = True\n    fill_extra_cols = False\n    guessing = False\n    strict_names = False\n\n    def __init__(self, default_kwargs={}, **user_kwargs):\n        # Make sure user does not set header_start to None for a reader\n        # that expects a non-None value (i.e. a number >= 0).  This mimics\n        # what happens in the Basic reader.\n        if (default_kwargs.get('header_start', 0) is not None\n                and user_kwargs.get('header_start', 0) is None):\n            raise ValueError('header_start cannot be set to None for this Reader')\n\n        # Set up kwargs and copy any user kwargs.  Use deepcopy user kwargs\n        # since they may contain a dict item which would end up as a ref to the\n        # original and get munged later (e.g. in cparser.pyx validation of\n        # fast_reader dict).\n        kwargs = copy.deepcopy(default_kwargs)\n        kwargs.update(copy.deepcopy(user_kwargs))\n\n        delimiter = kwargs.pop('delimiter', ' ')\n        self.delimiter = str(delimiter) if delimiter is not None else None\n        self.write_comment = kwargs.get('comment', '# ')\n        self.comment = kwargs.pop('comment', '#')\n        if self.comment is not None:\n            self.comment = str(self.comment)\n        self.quotechar = str(kwargs.pop('quotechar', '\"'))\n        self.header_start = kwargs.pop('header_start', 0)\n        # If data_start is not specified, start reading\n        # data right after the header line\n        data_start_default = user_kwargs.get('data_start', self.header_start\n                                             + 1 if self.header_start is not None else 1)\n        self.data_start = kwargs.pop('data_start', data_start_default)\n        self.kwargs = kwargs\n        self.strip_whitespace_lines = True\n        self.strip_whitespace_fields = True\n\n    def _read_header(self):\n        # Use the tokenizer by default -- this method\n        # can be overridden for specialized headers\n        self.engine.read_header()\n\n    def read(self, table):\n        \"\"\"\n        Read input data (file-like object, filename, list of strings, or\n        single string) into a Table and return the result.\n        \"\"\"\n        if self.comment is not None and len(self.comment) != 1:\n            raise core.ParameterError(\"The C reader does not support a comment regex\")\n        elif self.data_start is None:\n            raise core.ParameterError(\"The C reader does not allow data_start to be None\")\n        elif self.header_start is not None and self.header_start < 0 and \\\n                not isinstance(self, FastCommentedHeader):\n            raise core.ParameterError(\"The C reader does not allow header_start to be \"\n                                      \"negative except for commented-header files\")\n        elif self.data_start < 0:\n            raise core.ParameterError(\"The C reader does not allow data_start to be negative\")\n        elif len(self.delimiter) != 1:\n            raise core.ParameterError(\"The C reader only supports 1-char delimiters\")\n        elif len(self.quotechar) != 1:\n            raise core.ParameterError(\"The C reader only supports a length-1 quote character\")\n        elif 'converters' in self.kwargs:\n            raise core.ParameterError(\"The C reader does not support passing \"\n                                      \"specialized converters\")\n        elif 'encoding' in self.kwargs:\n            raise core.ParameterError(\"The C reader does not use the encoding parameter\")\n        elif 'Outputter' in self.kwargs:\n            raise core.ParameterError(\"The C reader does not use the Outputter parameter\")\n        elif 'Inputter' in self.kwargs:\n            raise core.ParameterError(\"The C reader does not use the Inputter parameter\")\n        elif 'data_Splitter' in self.kwargs or 'header_Splitter' in self.kwargs:\n            raise core.ParameterError(\"The C reader does not use a Splitter class\")\n\n        self.strict_names = self.kwargs.pop('strict_names', False)\n\n        # Process fast_reader kwarg, which may or may not exist (though ui.py will always\n        # pass this as a dict with at least 'enable' set).\n        fast_reader = self.kwargs.get('fast_reader', True)\n        if not isinstance(fast_reader, dict):\n            fast_reader = {}\n\n        fast_reader.pop('enable', None)\n        self.return_header_chars = fast_reader.pop('return_header_chars', False)\n        # Put fast_reader dict back into kwargs.\n        self.kwargs['fast_reader'] = fast_reader\n\n        self.engine = cparser.CParser(table, self.strip_whitespace_lines,\n                                      self.strip_whitespace_fields,\n                                      delimiter=self.delimiter,\n                                      header_start=self.header_start,\n                                      comment=self.comment,\n                                      quotechar=self.quotechar,\n                                      data_start=self.data_start,\n                                      fill_extra_cols=self.fill_extra_cols,\n                                      **self.kwargs)\n        conversion_info = self._read_header()\n        self.check_header()\n        if conversion_info is not None:\n            try_int, try_float, try_string = conversion_info\n        else:\n            try_int = {}\n            try_float = {}\n            try_string = {}\n\n        with _set_locale('C'):\n            data, comments = self.engine.read(try_int, try_float, try_string)\n        out = self.make_table(data, comments)\n\n        if self.return_header_chars:\n            out.meta['__ascii_fast_reader_header_chars__'] = self.engine.header_chars\n\n        return out\n\n    def make_table(self, data, comments):\n        \"\"\"Actually make the output table give the data and comments.\"\"\"\n        meta = OrderedDict()\n        if comments:\n            meta['comments'] = comments\n\n        names = core._deduplicate_names(self.engine.get_names())\n        return Table(data, names=names, meta=meta)\n\n    def check_header(self):\n        names = self.engine.get_header_names() or self.engine.get_names()\n        if self.strict_names:\n            # Impose strict requirements on column names (normally used in guessing)\n            bads = [\" \", \",\", \"|\", \"\\t\", \"'\", '\"']\n            for name in names:\n                if (core._is_number(name)\n                    or len(name) == 0\n                    or name[0] in bads\n                        or name[-1] in bads):\n                    raise ValueError('Column name {!r} does not meet strict name requirements'\n                                     .format(name))\n        # When guessing require at least two columns\n        if self.guessing and len(names) <= 1:\n            raise ValueError('Table format guessing requires at least two columns, got {}'\n                             .format(names))\n\n    def write(self, table, output):\n        \"\"\"\n        Use a fast Cython method to write table data to output,\n        where output is a filename or file-like object.\n        \"\"\"\n        self._write(table, output, {})\n\n    def _write(self, table, output, default_kwargs,\n               header_output=True, output_types=False):\n\n        # Fast writer supports only 1-d columns\n        core._check_multidim_table(table, max_ndim=1)\n\n        write_kwargs = {'delimiter': self.delimiter,\n                        'quotechar': self.quotechar,\n                        'strip_whitespace': self.strip_whitespace_fields,\n                        'comment': self.write_comment\n                        }\n        write_kwargs.update(default_kwargs)\n        # user kwargs take precedence over default kwargs\n        write_kwargs.update(self.kwargs)\n        writer = cparser.FastWriter(table, **write_kwargs)\n        writer.write(output, header_output, output_types)"},{"col":12,"endLoc":124,"id":5291,"nodeType":"Lambda","startLoc":124,"text":"lambda x: func(x[0])"},{"col":0,"comment":"","endLoc":7,"header":"misc.py#<anonymous>","id":5292,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"A Collection of useful miscellaneous functions.\n\nmisc.py:\n  Collection of useful miscellaneous functions.\n\n:Author: Hannes Breytenbach (hannes@saao.ac.za)\n\"\"\""},{"fileName":"fastbasic.py","filePath":"astropy/io/ascii","id":5293,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport re\nimport copy\nfrom collections import OrderedDict\n\nfrom . import core\nfrom astropy.table import Table\nfrom . import cparser\nfrom astropy.utils.misc import _set_locale\n\n\nclass FastBasic(metaclass=core.MetaBaseReader):\n    \"\"\"\n    This class is intended to handle the same format addressed by the\n    ordinary :class:`Basic` writer, but it acts as a wrapper for underlying C\n    code and is therefore much faster. Unlike the other ASCII readers and\n    writers, this class is not very extensible and is restricted\n    by optimization requirements.\n    \"\"\"\n    _format_name = 'fast_basic'\n    _description = 'Basic table with custom delimiter using the fast C engine'\n    _fast = True\n    fill_extra_cols = False\n    guessing = False\n    strict_names = False\n\n    def __init__(self, default_kwargs={}, **user_kwargs):\n        # Make sure user does not set header_start to None for a reader\n        # that expects a non-None value (i.e. a number >= 0).  This mimics\n        # what happens in the Basic reader.\n        if (default_kwargs.get('header_start', 0) is not None\n                and user_kwargs.get('header_start', 0) is None):\n            raise ValueError('header_start cannot be set to None for this Reader')\n\n        # Set up kwargs and copy any user kwargs.  Use deepcopy user kwargs\n        # since they may contain a dict item which would end up as a ref to the\n        # original and get munged later (e.g. in cparser.pyx validation of\n        # fast_reader dict).\n        kwargs = copy.deepcopy(default_kwargs)\n        kwargs.update(copy.deepcopy(user_kwargs))\n\n        delimiter = kwargs.pop('delimiter', ' ')\n        self.delimiter = str(delimiter) if delimiter is not None else None\n        self.write_comment = kwargs.get('comment', '# ')\n        self.comment = kwargs.pop('comment', '#')\n        if self.comment is not None:\n            self.comment = str(self.comment)\n        self.quotechar = str(kwargs.pop('quotechar', '\"'))\n        self.header_start = kwargs.pop('header_start', 0)\n        # If data_start is not specified, start reading\n        # data right after the header line\n        data_start_default = user_kwargs.get('data_start', self.header_start\n                                             + 1 if self.header_start is not None else 1)\n        self.data_start = kwargs.pop('data_start', data_start_default)\n        self.kwargs = kwargs\n        self.strip_whitespace_lines = True\n        self.strip_whitespace_fields = True\n\n    def _read_header(self):\n        # Use the tokenizer by default -- this method\n        # can be overridden for specialized headers\n        self.engine.read_header()\n\n    def read(self, table):\n        \"\"\"\n        Read input data (file-like object, filename, list of strings, or\n        single string) into a Table and return the result.\n        \"\"\"\n        if self.comment is not None and len(self.comment) != 1:\n            raise core.ParameterError(\"The C reader does not support a comment regex\")\n        elif self.data_start is None:\n            raise core.ParameterError(\"The C reader does not allow data_start to be None\")\n        elif self.header_start is not None and self.header_start < 0 and \\\n                not isinstance(self, FastCommentedHeader):\n            raise core.ParameterError(\"The C reader does not allow header_start to be \"\n                                      \"negative except for commented-header files\")\n        elif self.data_start < 0:\n            raise core.ParameterError(\"The C reader does not allow data_start to be negative\")\n        elif len(self.delimiter) != 1:\n            raise core.ParameterError(\"The C reader only supports 1-char delimiters\")\n        elif len(self.quotechar) != 1:\n            raise core.ParameterError(\"The C reader only supports a length-1 quote character\")\n        elif 'converters' in self.kwargs:\n            raise core.ParameterError(\"The C reader does not support passing \"\n                                      \"specialized converters\")\n        elif 'encoding' in self.kwargs:\n            raise core.ParameterError(\"The C reader does not use the encoding parameter\")\n        elif 'Outputter' in self.kwargs:\n            raise core.ParameterError(\"The C reader does not use the Outputter parameter\")\n        elif 'Inputter' in self.kwargs:\n            raise core.ParameterError(\"The C reader does not use the Inputter parameter\")\n        elif 'data_Splitter' in self.kwargs or 'header_Splitter' in self.kwargs:\n            raise core.ParameterError(\"The C reader does not use a Splitter class\")\n\n        self.strict_names = self.kwargs.pop('strict_names', False)\n\n        # Process fast_reader kwarg, which may or may not exist (though ui.py will always\n        # pass this as a dict with at least 'enable' set).\n        fast_reader = self.kwargs.get('fast_reader', True)\n        if not isinstance(fast_reader, dict):\n            fast_reader = {}\n\n        fast_reader.pop('enable', None)\n        self.return_header_chars = fast_reader.pop('return_header_chars', False)\n        # Put fast_reader dict back into kwargs.\n        self.kwargs['fast_reader'] = fast_reader\n\n        self.engine = cparser.CParser(table, self.strip_whitespace_lines,\n                                      self.strip_whitespace_fields,\n                                      delimiter=self.delimiter,\n                                      header_start=self.header_start,\n                                      comment=self.comment,\n                                      quotechar=self.quotechar,\n                                      data_start=self.data_start,\n                                      fill_extra_cols=self.fill_extra_cols,\n                                      **self.kwargs)\n        conversion_info = self._read_header()\n        self.check_header()\n        if conversion_info is not None:\n            try_int, try_float, try_string = conversion_info\n        else:\n            try_int = {}\n            try_float = {}\n            try_string = {}\n\n        with _set_locale('C'):\n            data, comments = self.engine.read(try_int, try_float, try_string)\n        out = self.make_table(data, comments)\n\n        if self.return_header_chars:\n            out.meta['__ascii_fast_reader_header_chars__'] = self.engine.header_chars\n\n        return out\n\n    def make_table(self, data, comments):\n        \"\"\"Actually make the output table give the data and comments.\"\"\"\n        meta = OrderedDict()\n        if comments:\n            meta['comments'] = comments\n\n        names = core._deduplicate_names(self.engine.get_names())\n        return Table(data, names=names, meta=meta)\n\n    def check_header(self):\n        names = self.engine.get_header_names() or self.engine.get_names()\n        if self.strict_names:\n            # Impose strict requirements on column names (normally used in guessing)\n            bads = [\" \", \",\", \"|\", \"\\t\", \"'\", '\"']\n            for name in names:\n                if (core._is_number(name)\n                    or len(name) == 0\n                    or name[0] in bads\n                        or name[-1] in bads):\n                    raise ValueError('Column name {!r} does not meet strict name requirements'\n                                     .format(name))\n        # When guessing require at least two columns\n        if self.guessing and len(names) <= 1:\n            raise ValueError('Table format guessing requires at least two columns, got {}'\n                             .format(names))\n\n    def write(self, table, output):\n        \"\"\"\n        Use a fast Cython method to write table data to output,\n        where output is a filename or file-like object.\n        \"\"\"\n        self._write(table, output, {})\n\n    def _write(self, table, output, default_kwargs,\n               header_output=True, output_types=False):\n\n        # Fast writer supports only 1-d columns\n        core._check_multidim_table(table, max_ndim=1)\n\n        write_kwargs = {'delimiter': self.delimiter,\n                        'quotechar': self.quotechar,\n                        'strip_whitespace': self.strip_whitespace_fields,\n                        'comment': self.write_comment\n                        }\n        write_kwargs.update(default_kwargs)\n        # user kwargs take precedence over default kwargs\n        write_kwargs.update(self.kwargs)\n        writer = cparser.FastWriter(table, **write_kwargs)\n        writer.write(output, header_output, output_types)\n\n\nclass FastCsv(FastBasic):\n    \"\"\"\n    A faster version of the ordinary :class:`Csv` writer that uses the\n    optimized C parsing engine. Note that this reader will append empty\n    field values to the end of any row with not enough columns, while\n    :class:`FastBasic` simply raises an error.\n    \"\"\"\n    _format_name = 'fast_csv'\n    _description = 'Comma-separated values table using the fast C engine'\n    _fast = True\n    fill_extra_cols = True\n\n    def __init__(self, **kwargs):\n        super().__init__({'delimiter': ',', 'comment': None}, **kwargs)\n\n    def write(self, table, output):\n        \"\"\"\n        Override the default write method of `FastBasic` to\n        output masked values as empty fields.\n        \"\"\"\n        self._write(table, output, {'fill_values': [(core.masked, '')]})\n\n\nclass FastTab(FastBasic):\n    \"\"\"\n    A faster version of the ordinary :class:`Tab` reader that uses\n    the optimized C parsing engine.\n    \"\"\"\n    _format_name = 'fast_tab'\n    _description = 'Tab-separated values table using the fast C engine'\n    _fast = True\n\n    def __init__(self, **kwargs):\n        super().__init__({'delimiter': '\\t'}, **kwargs)\n        self.strip_whitespace_lines = False\n        self.strip_whitespace_fields = False\n\n\nclass FastNoHeader(FastBasic):\n    \"\"\"\n    This class uses the fast C engine to read tables with no header line. If\n    the names parameter is unspecified, the columns will be autonamed with\n    \"col{}\".\n    \"\"\"\n    _format_name = 'fast_no_header'\n    _description = 'Basic table with no headers using the fast C engine'\n    _fast = True\n\n    def __init__(self, **kwargs):\n        super().__init__({'header_start': None, 'data_start': 0}, **kwargs)\n\n    def write(self, table, output):\n        \"\"\"\n        Override the default writing behavior in `FastBasic` so\n        that columns names are not included in output.\n        \"\"\"\n        self._write(table, output, {}, header_output=None)\n\n\nclass FastCommentedHeader(FastBasic):\n    \"\"\"\n    A faster version of the :class:`CommentedHeader` reader, which looks for\n    column names in a commented line. ``header_start`` denotes the index of\n    the header line among all commented lines and is 0 by default.\n    \"\"\"\n    _format_name = 'fast_commented_header'\n    _description = 'Columns name in a commented line using the fast C engine'\n    _fast = True\n\n    def __init__(self, **kwargs):\n        super().__init__({}, **kwargs)\n        # Mimic CommentedHeader's behavior in which data_start\n        # is relative to header_start if unspecified; see #2692\n        if 'data_start' not in kwargs:\n            self.data_start = 0\n\n    def make_table(self, data, comments):\n        \"\"\"\n        Actually make the output table give the data and comments.  This is\n        slightly different from the base FastBasic method in the way comments\n        are handled.\n        \"\"\"\n        meta = OrderedDict()\n        if comments:\n            idx = self.header_start\n            if idx < 0:\n                idx = len(comments) + idx\n            meta['comments'] = comments[:idx] + comments[idx+1:]  # noqa\n            if not meta['comments']:\n                del meta['comments']\n\n        names = core._deduplicate_names(self.engine.get_names())\n        return Table(data, names=names, meta=meta)\n\n    def _read_header(self):\n        tmp = self.engine.source\n        commented_lines = []\n\n        for line in tmp.splitlines():\n            line = line.lstrip()\n            if line and line[0] == self.comment:  # line begins with a comment\n                commented_lines.append(line[1:])\n                if len(commented_lines) == self.header_start + 1:\n                    break\n\n        if len(commented_lines) <= self.header_start:\n            raise cparser.CParserError('not enough commented lines')\n\n        self.engine.setup_tokenizer([commented_lines[self.header_start]])\n        self.engine.header_start = 0\n        self.engine.read_header()\n        self.engine.setup_tokenizer(tmp)\n\n    def write(self, table, output):\n        \"\"\"\n        Override the default writing behavior in `FastBasic` so\n        that column names are commented.\n        \"\"\"\n        self._write(table, output, {}, header_output='comment')\n\n\nclass FastRdb(FastBasic):\n    \"\"\"\n    A faster version of the :class:`Rdb` reader. This format is similar to\n    tab-delimited, but it also contains a header line after the column\n    name line denoting the type of each column (N for numeric, S for string).\n    \"\"\"\n    _format_name = 'fast_rdb'\n    _description = 'Tab-separated with a type definition header line'\n    _fast = True\n\n    def __init__(self, **kwargs):\n        super().__init__({'delimiter': '\\t', 'data_start': 2}, **kwargs)\n        self.strip_whitespace_lines = False\n        self.strip_whitespace_fields = False\n\n    def _read_header(self):\n        tmp = self.engine.source\n        line1 = ''\n        line2 = ''\n        for line in tmp.splitlines():\n            # valid non-comment line\n            if not line1 and line.strip() and line.lstrip()[0] != self.comment:\n                line1 = line\n            elif not line2 and line.strip() and line.lstrip()[0] != self.comment:\n                line2 = line\n                break\n        else:  # less than 2 lines in table\n            raise ValueError('RDB header requires 2 lines')\n\n        # Tokenize the two header lines separately.\n        # Each call to self.engine.read_header by default\n        #  - calls _deduplicate_names to ensure unique header_names\n        #  - sets self.names from self.header_names if not provided as kwarg\n        #  - applies self.include_names/exclude_names to self.names.\n        # For parsing the types disable 1+3, but self.names needs to be set.\n        self.engine.setup_tokenizer([line2])\n        self.engine.header_start = 0\n        self.engine.read_header(deduplicate=False, filter_names=False)\n        types = self.engine.get_header_names()\n\n        # If no kwarg names have been passed, reset to have column names read from header line 1.\n        if types == self.engine.get_names():\n            self.engine.set_names([])\n        self.engine.setup_tokenizer([line1])\n        # Get full list of column names prior to applying include/exclude_names,\n        # which have to be applied to the unique name set after deduplicate.\n        self.engine.read_header(deduplicate=True, filter_names=False)\n        col_names = self.engine.get_names()\n        self.engine.read_header(deduplicate=False)\n        if len(col_names) != len(types):\n            raise core.InconsistentTableError('RDB header mismatch between number of '\n                                              'column names and column types')\n        # If columns have been removed via include/exclude_names, extract matching types.\n        if len(self.engine.get_names()) != len(types):\n            types = [types[col_names.index(n)] for n in self.engine.get_names()]\n\n        if any(not re.match(r'\\d*(N|S)$', x, re.IGNORECASE) for x in types):\n            raise core.InconsistentTableError('RDB type definitions do not all match '\n                                              '[num](N|S): {}'.format(types))\n\n        try_int = {}\n        try_float = {}\n        try_string = {}\n\n        for name, col_type in zip(self.engine.get_names(), types):\n            if col_type[-1].lower() == 's':\n                try_int[name] = 0\n                try_float[name] = 0\n                try_string[name] = 1\n            else:\n                try_int[name] = 1\n                try_float[name] = 1\n                try_string[name] = 0\n\n        self.engine.setup_tokenizer(tmp)\n        return (try_int, try_float, try_string)\n\n    def write(self, table, output):\n        \"\"\"\n        Override the default writing behavior in `FastBasic` to\n        output a line with column types after the column name line.\n        \"\"\"\n        self._write(table, output, {}, output_types=True)\n"},{"col":4,"comment":"null","endLoc":58,"header":"def __init__(self, default_kwargs={}, **user_kwargs)","id":5294,"name":"__init__","nodeType":"Function","startLoc":28,"text":"def __init__(self, default_kwargs={}, **user_kwargs):\n        # Make sure user does not set header_start to None for a reader\n        # that expects a non-None value (i.e. a number >= 0).  This mimics\n        # what happens in the Basic reader.\n        if (default_kwargs.get('header_start', 0) is not None\n                and user_kwargs.get('header_start', 0) is None):\n            raise ValueError('header_start cannot be set to None for this Reader')\n\n        # Set up kwargs and copy any user kwargs.  Use deepcopy user kwargs\n        # since they may contain a dict item which would end up as a ref to the\n        # original and get munged later (e.g. in cparser.pyx validation of\n        # fast_reader dict).\n        kwargs = copy.deepcopy(default_kwargs)\n        kwargs.update(copy.deepcopy(user_kwargs))\n\n        delimiter = kwargs.pop('delimiter', ' ')\n        self.delimiter = str(delimiter) if delimiter is not None else None\n        self.write_comment = kwargs.get('comment', '# ')\n        self.comment = kwargs.pop('comment', '#')\n        if self.comment is not None:\n            self.comment = str(self.comment)\n        self.quotechar = str(kwargs.pop('quotechar', '\"'))\n        self.header_start = kwargs.pop('header_start', 0)\n        # If data_start is not specified, start reading\n        # data right after the header line\n        data_start_default = user_kwargs.get('data_start', self.header_start\n                                             + 1 if self.header_start is not None else 1)\n        self.data_start = kwargs.pop('data_start', data_start_default)\n        self.kwargs = kwargs\n        self.strip_whitespace_lines = True\n        self.strip_whitespace_fields = True"},{"col":0,"comment":"\n    Context manager to temporarily set the locale to ``name``.\n\n    An example is setting locale to \"C\" so that the C strtod()\n    function will use \".\" as the decimal point to enable consistent\n    numerical string parsing.\n\n    Note that one cannot nest multiple _set_locale() context manager\n    statements as this causes a threading lock.\n\n    This code taken from https://stackoverflow.com/questions/18593661/how-do-i-strftime-a-date-object-in-a-different-locale.\n\n    Parameters\n    ==========\n    name : str\n        Locale name, e.g. \"C\" or \"fr_FR\".\n    ","endLoc":832,"header":"@contextmanager\ndef _set_locale(name)","id":5295,"name":"_set_locale","nodeType":"Function","startLoc":801,"text":"@contextmanager\ndef _set_locale(name):\n    \"\"\"\n    Context manager to temporarily set the locale to ``name``.\n\n    An example is setting locale to \"C\" so that the C strtod()\n    function will use \".\" as the decimal point to enable consistent\n    numerical string parsing.\n\n    Note that one cannot nest multiple _set_locale() context manager\n    statements as this causes a threading lock.\n\n    This code taken from https://stackoverflow.com/questions/18593661/how-do-i-strftime-a-date-object-in-a-different-locale.\n\n    Parameters\n    ==========\n    name : str\n        Locale name, e.g. \"C\" or \"fr_FR\".\n    \"\"\"\n    name = str(name)\n\n    with LOCALE_LOCK:\n        saved = locale.setlocale(locale.LC_ALL)\n        if saved == name:\n            # Don't do anything if locale is already the requested locale\n            yield\n        else:\n            try:\n                locale.setlocale(locale.LC_ALL, name)\n                yield\n            finally:\n                locale.setlocale(locale.LC_ALL, saved)"},{"col":4,"comment":"\n        Writes the Byte-By-Byte description of the table.\n\n        Columns that are `astropy.coordinates.SkyCoord` or `astropy.time.TimeSeries`\n        objects or columns with values that are such objects are recognized as such,\n        and some predefined labels and description is used for them.\n        See the Vizier MRT Standard documentation in the link below for more details\n        on these. An example Byte-By-Byte table is shown here.\n\n        See: http://vizier.u-strasbg.fr/doc/catstd-3.1.htx\n\n        Example::\n\n        --------------------------------------------------------------------------------\n        Byte-by-byte Description of file: table.dat\n        --------------------------------------------------------------------------------\n        Bytes Format Units  Label     Explanations\n        --------------------------------------------------------------------------------\n         1- 8  A8     ---    names   Description of names\n        10-14  E5.1   ---    e       [-3160000.0/0.01] Description of e\n        16-23  F8.5   ---    d       [22.25/27.25] Description of d\n        25-31  E7.1   ---    s       [-9e+34/2.0] Description of s\n        33-35  I3     ---    i       [-30/67] Description of i\n        37-39  F3.1   ---    sameF   [5.0/5.0] Description of sameF\n        41-42  I2     ---    sameI   [20] Description of sameI\n        44-45  I2     h      RAh     Right Ascension (hour)\n        47-48  I2     min    RAm     Right Ascension (minute)\n        50-67  F18.15 s      RAs     Right Ascension (second)\n           69  A1     ---    DE-     Sign of Declination\n        70-71  I2     deg    DEd     Declination (degree)\n        73-74  I2     arcmin DEm     Declination (arcmin)\n        76-91  F16.13 arcsec DEs     Declination (arcsec)\n\n        --------------------------------------------------------------------------------\n        ","endLoc":410,"header":"def write_byte_by_byte(self)","id":5296,"name":"write_byte_by_byte","nodeType":"Function","startLoc":197,"text":"def write_byte_by_byte(self):\n        \"\"\"\n        Writes the Byte-By-Byte description of the table.\n\n        Columns that are `astropy.coordinates.SkyCoord` or `astropy.time.TimeSeries`\n        objects or columns with values that are such objects are recognized as such,\n        and some predefined labels and description is used for them.\n        See the Vizier MRT Standard documentation in the link below for more details\n        on these. An example Byte-By-Byte table is shown here.\n\n        See: http://vizier.u-strasbg.fr/doc/catstd-3.1.htx\n\n        Example::\n\n        --------------------------------------------------------------------------------\n        Byte-by-byte Description of file: table.dat\n        --------------------------------------------------------------------------------\n        Bytes Format Units  Label     Explanations\n        --------------------------------------------------------------------------------\n         1- 8  A8     ---    names   Description of names\n        10-14  E5.1   ---    e       [-3160000.0/0.01] Description of e\n        16-23  F8.5   ---    d       [22.25/27.25] Description of d\n        25-31  E7.1   ---    s       [-9e+34/2.0] Description of s\n        33-35  I3     ---    i       [-30/67] Description of i\n        37-39  F3.1   ---    sameF   [5.0/5.0] Description of sameF\n        41-42  I2     ---    sameI   [20] Description of sameI\n        44-45  I2     h      RAh     Right Ascension (hour)\n        47-48  I2     min    RAm     Right Ascension (minute)\n        50-67  F18.15 s      RAs     Right Ascension (second)\n           69  A1     ---    DE-     Sign of Declination\n        70-71  I2     deg    DEd     Declination (degree)\n        73-74  I2     arcmin DEm     Declination (arcmin)\n        76-91  F16.13 arcsec DEs     Declination (arcsec)\n\n        --------------------------------------------------------------------------------\n        \"\"\"\n        # Get column widths\n        vals_list = []\n        col_str_iters = self.data.str_vals()\n        for vals in zip(*col_str_iters):\n            vals_list.append(vals)\n\n        for i, col in enumerate(self.cols):\n            col.width = max([len(vals[i]) for vals in vals_list])\n            if self.start_line is not None:\n                col.width = max(col.width, len(col.info.name))\n        widths = [col.width for col in self.cols]\n\n        startb = 1  # Byte count starts at 1.\n\n        # Set default width of the Bytes count column of the Byte-By-Byte table.\n        # This ``byte_count_width`` value helps align byte counts with respect\n        # to the hyphen using a format string.\n        byte_count_width = len(str(sum(widths) + len(self.cols) - 1))\n\n        # Format string for Start Byte and End Byte\n        singlebfmt = \"{:\" + str(byte_count_width) + \"d}\"\n        fmtb = singlebfmt + \"-\" + singlebfmt\n        # Add trailing single whitespaces to Bytes column for better visibility.\n        singlebfmt += \" \"\n        fmtb += \" \"\n\n        # Set default width of Label and Description Byte-By-Byte columns.\n        max_label_width, max_descrip_size = 7, 16\n\n        bbb = Table(names=['Bytes', 'Format', 'Units', 'Label', 'Explanations'],\n                    dtype=[str] * 5)\n\n        # Iterate over the columns to write Byte-By-Byte rows.\n        for i, col in enumerate(self.cols):\n            # Check if column is MaskedColumn\n            col.has_null = isinstance(col, MaskedColumn)\n\n            if col.format is not None:\n                col.formatted_width = max([len(sval) for sval in col.str_vals])\n\n            # Set MRTColumn type, size and format.\n            if np.issubdtype(col.dtype, np.integer):\n                # Integer formatter\n                self._set_column_val_limits(col)\n                if getattr(col, 'formatted_width', None) is None:  # If ``formats`` not passed.\n                    col.formatted_width = max(len(str(col.max)), len(str(col.min)))\n                col.fortran_format = \"I\" + str(col.formatted_width)\n                if col.format is None:\n                    col.format = \">\" + col.fortran_format[1:]\n\n            elif np.issubdtype(col.dtype, np.dtype(float).type):\n                # Float formatter\n                self._set_column_val_limits(col)\n                self.column_float_formatter(col)\n\n            else:\n                # String formatter, ``np.issubdtype(col.dtype, str)`` is ``True``.\n                dtype = col.dtype.str\n                if col.has_null:\n                    mcol = col\n                    mcol.fill_value = \"\"\n                    coltmp = Column(mcol.filled(), dtype=str)\n                    dtype = coltmp.dtype.str\n                if getattr(col, 'formatted_width', None) is None:  # If ``formats`` not passed.\n                    col.formatted_width = int(re.search(r'(\\d+)$', dtype).group(1))\n                col.fortran_format = \"A\" + str(col.formatted_width)\n                col.format = str(col.formatted_width) + \"s\"\n\n            endb = col.formatted_width + startb - 1\n\n            # ``mixin`` columns converted to string valued columns will not have a name\n            # attribute. In those cases, a ``Unknown`` column label is put, indicating that\n            # such columns can be better formatted with some manipulation before calling\n            # the MRT writer.\n            if col.name is None:\n                col.name = \"Unknown\"\n\n            # Set column description.\n            if col.description is not None:\n                description = col.description\n            else:\n                description = \"Description of \" + col.name\n\n            # Set null flag in column description\n            nullflag = \"\"\n            if col.has_null:\n                nullflag = \"?\"\n\n            # Set column unit\n            if col.unit is not None:\n                col_unit = col.unit.to_string(\"cds\")\n            elif col.name.lower().find(\"magnitude\") > -1:\n                # ``col.unit`` can still be ``None``, if the unit of column values\n                # is ``Magnitude``, because ``astropy.units.Magnitude`` is actually a class.\n                # Unlike other units which are instances of ``astropy.units.Unit``,\n                # application of the ``Magnitude`` unit calculates the logarithm\n                # of the values. Thus, the only way to check for if the column values\n                # have ``Magnitude`` unit is to check the column name.\n                col_unit = \"mag\"\n            else:\n                col_unit = \"---\"\n\n            # Add col limit values to col description\n            lim_vals = \"\"\n            if (col.min and col.max and\n                    not any(x in col.name for x in ['RA', 'DE', 'LON', 'LAT', 'PLN', 'PLT'])):\n                # No col limit values for coordinate columns.\n                if col.fortran_format[0] == 'I':\n                    if abs(col.min) < MAX_COL_INTLIMIT and abs(col.max) < MAX_COL_INTLIMIT:\n                        if col.min == col.max:\n                            lim_vals = \"[{0}]\".format(col.min)\n                        else:\n                            lim_vals = \"[{0}/{1}]\".format(col.min, col.max)\n                elif col.fortran_format[0] in ('E', 'F'):\n                    lim_vals = \"[{0}/{1}]\".format(math.floor(col.min * 100) / 100.,\n                                                  math.ceil(col.max * 100) / 100.)\n\n            if lim_vals != '' or nullflag != '':\n                description = \"{0}{1} {2}\".format(lim_vals, nullflag, description)\n\n            # Find the maximum label and description column widths.\n            if len(col.name) > max_label_width:\n                max_label_width = len(col.name)\n            if len(description) > max_descrip_size:\n                max_descrip_size = len(description)\n\n            # Add a row for the Sign of Declination in the bbb table\n            if col.name == 'DEd':\n                bbb.add_row([singlebfmt.format(startb),\n                             \"A1\", \"---\", \"DE-\",\n                             \"Sign of Declination\"])\n                col.fortran_format = 'I2'\n                startb += 1\n\n            # Add Byte-By-Byte row to bbb table\n            bbb.add_row([singlebfmt.format(startb) if startb == endb\n                         else fmtb.format(startb, endb),\n                         \"\" if col.fortran_format is None else col.fortran_format,\n                         col_unit,\n                         \"\" if col.name is None else col.name,\n                         description])\n            startb = endb + 2\n\n        # Properly format bbb columns\n        bbblines = StringIO()\n        bbb.write(bbblines, format='ascii.fixed_width_no_header',\n                  delimiter=' ', bookend=False, delimiter_pad=None,\n                  formats={'Format': '<6s',\n                           'Units': '<6s',\n                           'Label': '<' + str(max_label_width) + 's',\n                           'Explanations': '' + str(max_descrip_size) + 's'})\n\n        # Get formatted bbb lines\n        bbblines = bbblines.getvalue().splitlines()\n\n        # ``nsplit`` is the number of whitespaces to prefix to long description\n        # lines in order to wrap them. It is the sum of the widths of the\n        # previous 4 columns plus the number of single spacing between them.\n        # The hyphen in the Bytes column is also counted.\n        nsplit = byte_count_width * 2 + 1 + 12 + max_label_width + 4\n\n        # Wrap line if it is too long\n        buff = \"\"\n        for newline in bbblines:\n            if len(newline) > MAX_SIZE_README_LINE:\n                buff += (\"\\n\").join(wrap(newline,\n                                         subsequent_indent=\" \" * nsplit,\n                                         width=MAX_SIZE_README_LINE))\n                buff += \"\\n\"\n            else:\n                buff += newline + \"\\n\"\n\n        # Last value of ``endb`` is the sum of column widths after formatting.\n        self.linewidth = endb\n\n        # Remove the last extra newline character from Byte-By-Byte.\n        buff = buff[:-1]\n        return buff"},{"className":"FastCsv","col":0,"comment":"\n    A faster version of the ordinary :class:`Csv` writer that uses the\n    optimized C parsing engine. Note that this reader will append empty\n    field values to the end of any row with not enough columns, while\n    :class:`FastBasic` simply raises an error.\n    ","endLoc":207,"id":5297,"nodeType":"Class","startLoc":187,"text":"class FastCsv(FastBasic):\n    \"\"\"\n    A faster version of the ordinary :class:`Csv` writer that uses the\n    optimized C parsing engine. Note that this reader will append empty\n    field values to the end of any row with not enough columns, while\n    :class:`FastBasic` simply raises an error.\n    \"\"\"\n    _format_name = 'fast_csv'\n    _description = 'Comma-separated values table using the fast C engine'\n    _fast = True\n    fill_extra_cols = True\n\n    def __init__(self, **kwargs):\n        super().__init__({'delimiter': ',', 'comment': None}, **kwargs)\n\n    def write(self, table, output):\n        \"\"\"\n        Override the default write method of `FastBasic` to\n        output masked values as empty fields.\n        \"\"\"\n        self._write(table, output, {'fill_values': [(core.masked, '')]})"},{"col":4,"comment":"null","endLoc":200,"header":"def __init__(self, **kwargs)","id":5298,"name":"__init__","nodeType":"Function","startLoc":199,"text":"def __init__(self, **kwargs):\n        super().__init__({'delimiter': ',', 'comment': None}, **kwargs)"},{"col":4,"comment":"\n        Override the default write method of `FastBasic` to\n        output masked values as empty fields.\n        ","endLoc":207,"header":"def write(self, table, output)","id":5299,"name":"write","nodeType":"Function","startLoc":202,"text":"def write(self, table, output):\n        \"\"\"\n        Override the default write method of `FastBasic` to\n        output masked values as empty fields.\n        \"\"\"\n        self._write(table, output, {'fill_values': [(core.masked, '')]})"},{"col":4,"comment":"null","endLoc":631,"header":"def write(self, table)","id":5300,"name":"write","nodeType":"Function","startLoc":628,"text":"def write(self, table):\n        self._check_multidim_table(table)\n        lines = _write_table_qdp(table, err_specs=self.err_specs)\n        return lines"},{"col":0,"comment":"Write a table to a QDP file\n\n    Parameters\n    ----------\n    table : :class:`~astropy.table.Table`\n        Input table to be written\n    filename : str\n        Output QDP file name\n\n    Other Parameters\n    ----------------\n    err_specs : dict\n        Dictionary of the format {'serr': [1], 'terr': [2, 3]}, specifying\n        which columns have symmetric and two-sided errors (see QDP format\n        specification)\n    ","endLoc":488,"header":"def _write_table_qdp(table, filename=None, err_specs=None)","id":5301,"name":"_write_table_qdp","nodeType":"Function","startLoc":423,"text":"def _write_table_qdp(table, filename=None, err_specs=None):\n    \"\"\"Write a table to a QDP file\n\n    Parameters\n    ----------\n    table : :class:`~astropy.table.Table`\n        Input table to be written\n    filename : str\n        Output QDP file name\n\n    Other Parameters\n    ----------------\n    err_specs : dict\n        Dictionary of the format {'serr': [1], 'terr': [2, 3]}, specifying\n        which columns have symmetric and two-sided errors (see QDP format\n        specification)\n    \"\"\"\n    import io\n    fobj = io.StringIO()\n\n    if 'initial_comments' in table.meta and table.meta['initial_comments'] != []:\n        for line in table.meta['initial_comments']:\n            line = line.strip()\n            if not line.startswith(\"!\"):\n                line = \"!\" + line\n            print(line, file=fobj)\n\n    if err_specs is None:\n        serr_cols, terr_cols = _understand_err_col(table.colnames)\n    else:\n        serr_cols = err_specs.pop(\"serr\", [])\n        terr_cols = err_specs.pop(\"terr\", [])\n    if serr_cols != []:\n        col_string = \" \".join([str(val) for val in serr_cols])\n        print(f\"READ SERR {col_string}\", file=fobj)\n    if terr_cols != []:\n        col_string = \" \".join([str(val) for val in terr_cols])\n        print(f\"READ TERR {col_string}\", file=fobj)\n\n    if 'comments' in table.meta and table.meta['comments'] != []:\n        for line in table.meta['comments']:\n            line = line.strip()\n            if not line.startswith(\"!\"):\n                line = \"!\" + line\n            print(line, file=fobj)\n\n    colnames = table.colnames\n    print(\"!\" + \" \".join(colnames), file=fobj)\n    for row in table:\n        values = []\n        for val in row:\n            if not np.ma.is_masked(val):\n                rep = str(val)\n            else:\n                rep = \"NO\"\n            values.append(rep)\n        print(\" \".join(values), file=fobj)\n\n    full_string = fobj.getvalue()\n    fobj.close()\n\n    if filename is not None:\n        with open(filename, 'w') as fobj:\n            print(full_string, file=fobj)\n\n    return full_string.split(\"\\n\")"},{"col":4,"comment":"null","endLoc":184,"header":"def _write(self, table, output, default_kwargs,\n               header_output=True, output_types=False)","id":5302,"name":"_write","nodeType":"Function","startLoc":169,"text":"def _write(self, table, output, default_kwargs,\n               header_output=True, output_types=False):\n\n        # Fast writer supports only 1-d columns\n        core._check_multidim_table(table, max_ndim=1)\n\n        write_kwargs = {'delimiter': self.delimiter,\n                        'quotechar': self.quotechar,\n                        'strip_whitespace': self.strip_whitespace_fields,\n                        'comment': self.write_comment\n                        }\n        write_kwargs.update(default_kwargs)\n        # user kwargs take precedence over default kwargs\n        write_kwargs.update(self.kwargs)\n        writer = cparser.FastWriter(table, **write_kwargs)\n        writer.write(output, header_output, output_types)"},{"attributeType":"null","col":4,"comment":"null","endLoc":194,"id":5303,"name":"_format_name","nodeType":"Attribute","startLoc":194,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":195,"id":5304,"name":"_description","nodeType":"Attribute","startLoc":195,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":196,"id":5305,"name":"_fast","nodeType":"Attribute","startLoc":196,"text":"_fast"},{"attributeType":"null","col":4,"comment":"null","endLoc":197,"id":5306,"name":"fill_extra_cols","nodeType":"Attribute","startLoc":197,"text":"fill_extra_cols"},{"className":"FastTab","col":0,"comment":"\n    A faster version of the ordinary :class:`Tab` reader that uses\n    the optimized C parsing engine.\n    ","endLoc":222,"id":5307,"nodeType":"Class","startLoc":210,"text":"class FastTab(FastBasic):\n    \"\"\"\n    A faster version of the ordinary :class:`Tab` reader that uses\n    the optimized C parsing engine.\n    \"\"\"\n    _format_name = 'fast_tab'\n    _description = 'Tab-separated values table using the fast C engine'\n    _fast = True\n\n    def __init__(self, **kwargs):\n        super().__init__({'delimiter': '\\t'}, **kwargs)\n        self.strip_whitespace_lines = False\n        self.strip_whitespace_fields = False"},{"col":4,"comment":"null","endLoc":222,"header":"def __init__(self, **kwargs)","id":5308,"name":"__init__","nodeType":"Function","startLoc":219,"text":"def __init__(self, **kwargs):\n        super().__init__({'delimiter': '\\t'}, **kwargs)\n        self.strip_whitespace_lines = False\n        self.strip_whitespace_fields = False"},{"attributeType":"null","col":4,"comment":"null","endLoc":215,"id":5309,"name":"_format_name","nodeType":"Attribute","startLoc":215,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":216,"id":5310,"name":"_description","nodeType":"Attribute","startLoc":216,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":217,"id":5311,"name":"_fast","nodeType":"Attribute","startLoc":217,"text":"_fast"},{"attributeType":"null","col":8,"comment":"null","endLoc":221,"id":5312,"name":"strip_whitespace_lines","nodeType":"Attribute","startLoc":221,"text":"self.strip_whitespace_lines"},{"col":0,"comment":"Get which column names are error columns\n\n    Examples\n    --------\n    >>> colnames = ['a', 'a_err', 'b', 'b_perr', 'b_nerr']\n    >>> serr, terr = _understand_err_col(colnames)\n    >>> np.allclose(serr, [1])\n    True\n    >>> np.allclose(terr, [2])\n    True\n    >>> serr, terr = _understand_err_col(['a', 'a_nerr'])\n    Traceback (most recent call last):\n    ...\n    ValueError: Missing positive error...\n    >>> serr, terr = _understand_err_col(['a', 'a_perr'])\n    Traceback (most recent call last):\n    ...\n    ValueError: Missing negative error...\n    ","endLoc":384,"header":"def _understand_err_col(colnames)","id":5313,"name":"_understand_err_col","nodeType":"Function","startLoc":347,"text":"def _understand_err_col(colnames):\n    \"\"\"Get which column names are error columns\n\n    Examples\n    --------\n    >>> colnames = ['a', 'a_err', 'b', 'b_perr', 'b_nerr']\n    >>> serr, terr = _understand_err_col(colnames)\n    >>> np.allclose(serr, [1])\n    True\n    >>> np.allclose(terr, [2])\n    True\n    >>> serr, terr = _understand_err_col(['a', 'a_nerr'])\n    Traceback (most recent call last):\n    ...\n    ValueError: Missing positive error...\n    >>> serr, terr = _understand_err_col(['a', 'a_perr'])\n    Traceback (most recent call last):\n    ...\n    ValueError: Missing negative error...\n    \"\"\"\n    shift = 0\n    serr = []\n    terr = []\n\n    for i, col in enumerate(colnames):\n        if col.endswith(\"_err\"):\n            # The previous column, but they're numbered from 1!\n            # Plus, take shift into account\n            serr.append(i - shift)\n            shift += 1\n        elif col.endswith(\"_perr\"):\n            terr.append(i - shift)\n            if len(colnames) == i + 1 or not colnames[i + 1].endswith('_nerr'):\n                raise ValueError(\"Missing negative error\")\n            shift += 2\n        elif col.endswith(\"_nerr\") and not colnames[i - 1].endswith('_perr'):\n            raise ValueError(\"Missing positive error\")\n    return serr, terr"},{"attributeType":"null","col":8,"comment":"null","endLoc":222,"id":5314,"name":"strip_whitespace_fields","nodeType":"Attribute","startLoc":222,"text":"self.strip_whitespace_fields"},{"className":"FastNoHeader","col":0,"comment":"\n    This class uses the fast C engine to read tables with no header line. If\n    the names parameter is unspecified, the columns will be autonamed with\n    \"col{}\".\n    ","endLoc":243,"id":5315,"nodeType":"Class","startLoc":225,"text":"class FastNoHeader(FastBasic):\n    \"\"\"\n    This class uses the fast C engine to read tables with no header line. If\n    the names parameter is unspecified, the columns will be autonamed with\n    \"col{}\".\n    \"\"\"\n    _format_name = 'fast_no_header'\n    _description = 'Basic table with no headers using the fast C engine'\n    _fast = True\n\n    def __init__(self, **kwargs):\n        super().__init__({'header_start': None, 'data_start': 0}, **kwargs)\n\n    def write(self, table, output):\n        \"\"\"\n        Override the default writing behavior in `FastBasic` so\n        that columns names are not included in output.\n        \"\"\"\n        self._write(table, output, {}, header_output=None)"},{"col":4,"comment":"null","endLoc":236,"header":"def __init__(self, **kwargs)","id":5316,"name":"__init__","nodeType":"Function","startLoc":235,"text":"def __init__(self, **kwargs):\n        super().__init__({'header_start': None, 'data_start': 0}, **kwargs)"},{"col":4,"comment":"\n        Override the default writing behavior in `FastBasic` so\n        that columns names are not included in output.\n        ","endLoc":243,"header":"def write(self, table, output)","id":5317,"name":"write","nodeType":"Function","startLoc":238,"text":"def write(self, table, output):\n        \"\"\"\n        Override the default writing behavior in `FastBasic` so\n        that columns names are not included in output.\n        \"\"\"\n        self._write(table, output, {}, header_output=None)"},{"attributeType":"null","col":4,"comment":"null","endLoc":231,"id":5318,"name":"_format_name","nodeType":"Attribute","startLoc":231,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":232,"id":5319,"name":"_description","nodeType":"Attribute","startLoc":232,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":233,"id":5320,"name":"_fast","nodeType":"Attribute","startLoc":233,"text":"_fast"},{"className":"FastCommentedHeader","col":0,"comment":"\n    A faster version of the :class:`CommentedHeader` reader, which looks for\n    column names in a commented line. ``header_start`` denotes the index of\n    the header line among all commented lines and is 0 by default.\n    ","endLoc":305,"id":5321,"nodeType":"Class","startLoc":246,"text":"class FastCommentedHeader(FastBasic):\n    \"\"\"\n    A faster version of the :class:`CommentedHeader` reader, which looks for\n    column names in a commented line. ``header_start`` denotes the index of\n    the header line among all commented lines and is 0 by default.\n    \"\"\"\n    _format_name = 'fast_commented_header'\n    _description = 'Columns name in a commented line using the fast C engine'\n    _fast = True\n\n    def __init__(self, **kwargs):\n        super().__init__({}, **kwargs)\n        # Mimic CommentedHeader's behavior in which data_start\n        # is relative to header_start if unspecified; see #2692\n        if 'data_start' not in kwargs:\n            self.data_start = 0\n\n    def make_table(self, data, comments):\n        \"\"\"\n        Actually make the output table give the data and comments.  This is\n        slightly different from the base FastBasic method in the way comments\n        are handled.\n        \"\"\"\n        meta = OrderedDict()\n        if comments:\n            idx = self.header_start\n            if idx < 0:\n                idx = len(comments) + idx\n            meta['comments'] = comments[:idx] + comments[idx+1:]  # noqa\n            if not meta['comments']:\n                del meta['comments']\n\n        names = core._deduplicate_names(self.engine.get_names())\n        return Table(data, names=names, meta=meta)\n\n    def _read_header(self):\n        tmp = self.engine.source\n        commented_lines = []\n\n        for line in tmp.splitlines():\n            line = line.lstrip()\n            if line and line[0] == self.comment:  # line begins with a comment\n                commented_lines.append(line[1:])\n                if len(commented_lines) == self.header_start + 1:\n                    break\n\n        if len(commented_lines) <= self.header_start:\n            raise cparser.CParserError('not enough commented lines')\n\n        self.engine.setup_tokenizer([commented_lines[self.header_start]])\n        self.engine.header_start = 0\n        self.engine.read_header()\n        self.engine.setup_tokenizer(tmp)\n\n    def write(self, table, output):\n        \"\"\"\n        Override the default writing behavior in `FastBasic` so\n        that column names are commented.\n        \"\"\"\n        self._write(table, output, {}, header_output='comment')"},{"col":4,"comment":"null","endLoc":261,"header":"def __init__(self, **kwargs)","id":5322,"name":"__init__","nodeType":"Function","startLoc":256,"text":"def __init__(self, **kwargs):\n        super().__init__({}, **kwargs)\n        # Mimic CommentedHeader's behavior in which data_start\n        # is relative to header_start if unspecified; see #2692\n        if 'data_start' not in kwargs:\n            self.data_start = 0"},{"col":4,"comment":"\n        Actually make the output table give the data and comments.  This is\n        slightly different from the base FastBasic method in the way comments\n        are handled.\n        ","endLoc":279,"header":"def make_table(self, data, comments)","id":5323,"name":"make_table","nodeType":"Function","startLoc":263,"text":"def make_table(self, data, comments):\n        \"\"\"\n        Actually make the output table give the data and comments.  This is\n        slightly different from the base FastBasic method in the way comments\n        are handled.\n        \"\"\"\n        meta = OrderedDict()\n        if comments:\n            idx = self.header_start\n            if idx < 0:\n                idx = len(comments) + idx\n            meta['comments'] = comments[:idx] + comments[idx+1:]  # noqa\n            if not meta['comments']:\n                del meta['comments']\n\n        names = core._deduplicate_names(self.engine.get_names())\n        return Table(data, names=names, meta=meta)"},{"col":4,"comment":"null","endLoc":63,"header":"def _read_header(self)","id":5324,"name":"_read_header","nodeType":"Function","startLoc":60,"text":"def _read_header(self):\n        # Use the tokenizer by default -- this method\n        # can be overridden for specialized headers\n        self.engine.read_header()"},{"col":4,"comment":"\n        Read input data (file-like object, filename, list of strings, or\n        single string) into a Table and return the result.\n        ","endLoc":134,"header":"def read(self, table)","id":5325,"name":"read","nodeType":"Function","startLoc":65,"text":"def read(self, table):\n        \"\"\"\n        Read input data (file-like object, filename, list of strings, or\n        single string) into a Table and return the result.\n        \"\"\"\n        if self.comment is not None and len(self.comment) != 1:\n            raise core.ParameterError(\"The C reader does not support a comment regex\")\n        elif self.data_start is None:\n            raise core.ParameterError(\"The C reader does not allow data_start to be None\")\n        elif self.header_start is not None and self.header_start < 0 and \\\n                not isinstance(self, FastCommentedHeader):\n            raise core.ParameterError(\"The C reader does not allow header_start to be \"\n                                      \"negative except for commented-header files\")\n        elif self.data_start < 0:\n            raise core.ParameterError(\"The C reader does not allow data_start to be negative\")\n        elif len(self.delimiter) != 1:\n            raise core.ParameterError(\"The C reader only supports 1-char delimiters\")\n        elif len(self.quotechar) != 1:\n            raise core.ParameterError(\"The C reader only supports a length-1 quote character\")\n        elif 'converters' in self.kwargs:\n            raise core.ParameterError(\"The C reader does not support passing \"\n                                      \"specialized converters\")\n        elif 'encoding' in self.kwargs:\n            raise core.ParameterError(\"The C reader does not use the encoding parameter\")\n        elif 'Outputter' in self.kwargs:\n            raise core.ParameterError(\"The C reader does not use the Outputter parameter\")\n        elif 'Inputter' in self.kwargs:\n            raise core.ParameterError(\"The C reader does not use the Inputter parameter\")\n        elif 'data_Splitter' in self.kwargs or 'header_Splitter' in self.kwargs:\n            raise core.ParameterError(\"The C reader does not use a Splitter class\")\n\n        self.strict_names = self.kwargs.pop('strict_names', False)\n\n        # Process fast_reader kwarg, which may or may not exist (though ui.py will always\n        # pass this as a dict with at least 'enable' set).\n        fast_reader = self.kwargs.get('fast_reader', True)\n        if not isinstance(fast_reader, dict):\n            fast_reader = {}\n\n        fast_reader.pop('enable', None)\n        self.return_header_chars = fast_reader.pop('return_header_chars', False)\n        # Put fast_reader dict back into kwargs.\n        self.kwargs['fast_reader'] = fast_reader\n\n        self.engine = cparser.CParser(table, self.strip_whitespace_lines,\n                                      self.strip_whitespace_fields,\n                                      delimiter=self.delimiter,\n                                      header_start=self.header_start,\n                                      comment=self.comment,\n                                      quotechar=self.quotechar,\n                                      data_start=self.data_start,\n                                      fill_extra_cols=self.fill_extra_cols,\n                                      **self.kwargs)\n        conversion_info = self._read_header()\n        self.check_header()\n        if conversion_info is not None:\n            try_int, try_float, try_string = conversion_info\n        else:\n            try_int = {}\n            try_float = {}\n            try_string = {}\n\n        with _set_locale('C'):\n            data, comments = self.engine.read(try_int, try_float, try_string)\n        out = self.make_table(data, comments)\n\n        if self.return_header_chars:\n            out.meta['__ascii_fast_reader_header_chars__'] = self.engine.header_chars\n\n        return out"},{"col":4,"comment":"\n        Convert this coordinate to pixel coordinates using a `~astropy.wcs.WCS`\n        object.\n\n        Parameters\n        ----------\n        wcs : `~astropy.wcs.WCS`\n            The WCS to use for convert\n        origin : int\n            Whether to return 0 or 1-based pixel coordinates.\n        mode : 'all' or 'wcs'\n            Whether to do the transformation including distortions (``'all'``) or\n            only including only the core WCS transformation (``'wcs'``).\n\n        Returns\n        -------\n        xp, yp : `numpy.ndarray`\n            The pixel coordinates\n\n        See Also\n        --------\n        astropy.wcs.utils.skycoord_to_pixel : the implementation of this method\n        ","endLoc":1707,"header":"def to_pixel(self, wcs, origin=0, mode='all')","id":5326,"name":"to_pixel","nodeType":"Function","startLoc":1682,"text":"def to_pixel(self, wcs, origin=0, mode='all'):\n        \"\"\"\n        Convert this coordinate to pixel coordinates using a `~astropy.wcs.WCS`\n        object.\n\n        Parameters\n        ----------\n        wcs : `~astropy.wcs.WCS`\n            The WCS to use for convert\n        origin : int\n            Whether to return 0 or 1-based pixel coordinates.\n        mode : 'all' or 'wcs'\n            Whether to do the transformation including distortions (``'all'``) or\n            only including only the core WCS transformation (``'wcs'``).\n\n        Returns\n        -------\n        xp, yp : `numpy.ndarray`\n            The pixel coordinates\n\n        See Also\n        --------\n        astropy.wcs.utils.skycoord_to_pixel : the implementation of this method\n        \"\"\"\n        from astropy.wcs.utils import skycoord_to_pixel\n        return skycoord_to_pixel(self, wcs=wcs, origin=origin, mode=mode)"},{"col":4,"comment":"\n        Create a new `SkyCoord` from pixel coordinates using an\n        `~astropy.wcs.WCS` object.\n\n        Parameters\n        ----------\n        xp, yp : float or ndarray\n            The coordinates to convert.\n        wcs : `~astropy.wcs.WCS`\n            The WCS to use for convert\n        origin : int\n            Whether to return 0 or 1-based pixel coordinates.\n        mode : 'all' or 'wcs'\n            Whether to do the transformation including distortions (``'all'``) or\n            only including only the core WCS transformation (``'wcs'``).\n\n        Returns\n        -------\n        coord : `~astropy.coordinates.SkyCoord`\n            A new object with sky coordinates corresponding to the input ``xp``\n            and ``yp``.\n\n        See Also\n        --------\n        to_pixel : to do the inverse operation\n        astropy.wcs.utils.pixel_to_skycoord : the implementation of this method\n        ","endLoc":1739,"header":"@classmethod\n    def from_pixel(cls, xp, yp, wcs, origin=0, mode='all')","id":5327,"name":"from_pixel","nodeType":"Function","startLoc":1709,"text":"@classmethod\n    def from_pixel(cls, xp, yp, wcs, origin=0, mode='all'):\n        \"\"\"\n        Create a new `SkyCoord` from pixel coordinates using an\n        `~astropy.wcs.WCS` object.\n\n        Parameters\n        ----------\n        xp, yp : float or ndarray\n            The coordinates to convert.\n        wcs : `~astropy.wcs.WCS`\n            The WCS to use for convert\n        origin : int\n            Whether to return 0 or 1-based pixel coordinates.\n        mode : 'all' or 'wcs'\n            Whether to do the transformation including distortions (``'all'``) or\n            only including only the core WCS transformation (``'wcs'``).\n\n        Returns\n        -------\n        coord : `~astropy.coordinates.SkyCoord`\n            A new object with sky coordinates corresponding to the input ``xp``\n            and ``yp``.\n\n        See Also\n        --------\n        to_pixel : to do the inverse operation\n        astropy.wcs.utils.pixel_to_skycoord : the implementation of this method\n        \"\"\"\n        from astropy.wcs.utils import pixel_to_skycoord\n        return pixel_to_skycoord(xp, yp, wcs=wcs, origin=origin, mode=mode, cls=cls)"},{"col":0,"comment":"\n    Convert a set of pixel coordinates into a `~astropy.coordinates.SkyCoord`\n    coordinate.\n\n    Parameters\n    ----------\n    xp, yp : float or ndarray\n        The coordinates to convert.\n    wcs : `~astropy.wcs.WCS`\n        The WCS transformation to use.\n    origin : int\n        Whether to return 0 or 1-based pixel coordinates.\n    mode : 'all' or 'wcs'\n        Whether to do the transformation including distortions (``'all'``) or\n        only including only the core WCS transformation (``'wcs'``).\n    cls : class or None\n        The class of object to create.  Should be a\n        `~astropy.coordinates.SkyCoord` subclass.  If None, defaults to\n        `~astropy.coordinates.SkyCoord`.\n\n    Returns\n    -------\n    coords : `~astropy.coordinates.SkyCoord` subclass\n        The celestial coordinates. Whatever ``cls`` type is.\n\n    See Also\n    --------\n    astropy.coordinates.SkyCoord.from_pixel\n    ","endLoc":644,"header":"def pixel_to_skycoord(xp, yp, wcs, origin=0, mode='all', cls=None)","id":5328,"name":"pixel_to_skycoord","nodeType":"Function","startLoc":572,"text":"def pixel_to_skycoord(xp, yp, wcs, origin=0, mode='all', cls=None):\n    \"\"\"\n    Convert a set of pixel coordinates into a `~astropy.coordinates.SkyCoord`\n    coordinate.\n\n    Parameters\n    ----------\n    xp, yp : float or ndarray\n        The coordinates to convert.\n    wcs : `~astropy.wcs.WCS`\n        The WCS transformation to use.\n    origin : int\n        Whether to return 0 or 1-based pixel coordinates.\n    mode : 'all' or 'wcs'\n        Whether to do the transformation including distortions (``'all'``) or\n        only including only the core WCS transformation (``'wcs'``).\n    cls : class or None\n        The class of object to create.  Should be a\n        `~astropy.coordinates.SkyCoord` subclass.  If None, defaults to\n        `~astropy.coordinates.SkyCoord`.\n\n    Returns\n    -------\n    coords : `~astropy.coordinates.SkyCoord` subclass\n        The celestial coordinates. Whatever ``cls`` type is.\n\n    See Also\n    --------\n    astropy.coordinates.SkyCoord.from_pixel\n    \"\"\"\n\n    # Import astropy.coordinates here to avoid circular imports\n    from astropy.coordinates import SkyCoord, UnitSphericalRepresentation\n\n    # we have to do this instead of actually setting the default to SkyCoord\n    # because importing SkyCoord at the module-level leads to circular\n    # dependencies.\n    if cls is None:\n        cls = SkyCoord\n\n    if _has_distortion(wcs) and wcs.naxis != 2:\n        raise ValueError(\"Can only handle WCS with distortions for 2-dimensional WCS\")\n\n    # Keep only the celestial part of the axes, also re-orders lon/lat\n    wcs = wcs.sub([WCSSUB_LONGITUDE, WCSSUB_LATITUDE])\n\n    if wcs.naxis != 2:\n        raise ValueError(\"WCS should contain celestial component\")\n\n    # Check which frame the WCS uses\n    frame = wcs_to_celestial_frame(wcs)\n\n    # Check what unit the WCS gives\n    lon_unit = u.Unit(wcs.wcs.cunit[0])\n    lat_unit = u.Unit(wcs.wcs.cunit[1])\n\n    # Convert pixel coordinates to celestial coordinates\n    if mode == 'all':\n        lon, lat = wcs.all_pix2world(xp, yp, origin)\n    elif mode == 'wcs':\n        lon, lat = wcs.wcs_pix2world(xp, yp, origin)\n    else:\n        raise ValueError(\"mode should be either 'all' or 'wcs'\")\n\n    # Add units to longitude/latitude\n    lon = lon * lon_unit\n    lat = lat * lat_unit\n\n    # Create a SkyCoord-like object\n    data = UnitSphericalRepresentation(lon=lon, lat=lat)\n    coords = cls(frame.realize_frame(data))\n\n    return coords"},{"attributeType":"null","col":4,"comment":"null","endLoc":608,"id":5329,"name":"_format_name","nodeType":"Attribute","startLoc":608,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":609,"id":5330,"name":"_io_registry_can_write","nodeType":"Attribute","startLoc":609,"text":"_io_registry_can_write"},{"attributeType":"null","col":4,"comment":"null","endLoc":610,"id":5331,"name":"_io_registry_suffix","nodeType":"Attribute","startLoc":610,"text":"_io_registry_suffix"},{"attributeType":"null","col":4,"comment":"null","endLoc":611,"id":5332,"name":"_description","nodeType":"Attribute","startLoc":611,"text":"_description"},{"attributeType":"QDPHeader","col":4,"comment":"null","endLoc":613,"id":5333,"name":"header_class","nodeType":"Attribute","startLoc":613,"text":"header_class"},{"col":4,"comment":"null","endLoc":298,"header":"def _read_header(self)","id":5334,"name":"_read_header","nodeType":"Function","startLoc":281,"text":"def _read_header(self):\n        tmp = self.engine.source\n        commented_lines = []\n\n        for line in tmp.splitlines():\n            line = line.lstrip()\n            if line and line[0] == self.comment:  # line begins with a comment\n                commented_lines.append(line[1:])\n                if len(commented_lines) == self.header_start + 1:\n                    break\n\n        if len(commented_lines) <= self.header_start:\n            raise cparser.CParserError('not enough commented lines')\n\n        self.engine.setup_tokenizer([commented_lines[self.header_start]])\n        self.engine.header_start = 0\n        self.engine.read_header()\n        self.engine.setup_tokenizer(tmp)"},{"col":4,"comment":"\n        Override the default writing behavior in `FastBasic` so\n        that column names are commented.\n        ","endLoc":305,"header":"def write(self, table, output)","id":5335,"name":"write","nodeType":"Function","startLoc":300,"text":"def write(self, table, output):\n        \"\"\"\n        Override the default writing behavior in `FastBasic` so\n        that column names are commented.\n        \"\"\"\n        self._write(table, output, {}, header_output='comment')"},{"attributeType":"null","col":4,"comment":"null","endLoc":252,"id":5336,"name":"_format_name","nodeType":"Attribute","startLoc":252,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":253,"id":5337,"name":"_description","nodeType":"Attribute","startLoc":253,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":254,"id":5338,"name":"_fast","nodeType":"Attribute","startLoc":254,"text":"_fast"},{"col":4,"comment":"null","endLoc":160,"header":"def check_header(self)","id":5339,"name":"check_header","nodeType":"Function","startLoc":145,"text":"def check_header(self):\n        names = self.engine.get_header_names() or self.engine.get_names()\n        if self.strict_names:\n            # Impose strict requirements on column names (normally used in guessing)\n            bads = [\" \", \",\", \"|\", \"\\t\", \"'\", '\"']\n            for name in names:\n                if (core._is_number(name)\n                    or len(name) == 0\n                    or name[0] in bads\n                        or name[-1] in bads):\n                    raise ValueError('Column name {!r} does not meet strict name requirements'\n                                     .format(name))\n        # When guessing require at least two columns\n        if self.guessing and len(names) <= 1:\n            raise ValueError('Table format guessing requires at least two columns, got {}'\n                             .format(names))"},{"attributeType":"null","col":12,"comment":"null","endLoc":261,"id":5340,"name":"data_start","nodeType":"Attribute","startLoc":261,"text":"self.data_start"},{"className":"FastRdb","col":0,"comment":"\n    A faster version of the :class:`Rdb` reader. This format is similar to\n    tab-delimited, but it also contains a header line after the column\n    name line denoting the type of each column (N for numeric, S for string).\n    ","endLoc":390,"id":5341,"nodeType":"Class","startLoc":308,"text":"class FastRdb(FastBasic):\n    \"\"\"\n    A faster version of the :class:`Rdb` reader. This format is similar to\n    tab-delimited, but it also contains a header line after the column\n    name line denoting the type of each column (N for numeric, S for string).\n    \"\"\"\n    _format_name = 'fast_rdb'\n    _description = 'Tab-separated with a type definition header line'\n    _fast = True\n\n    def __init__(self, **kwargs):\n        super().__init__({'delimiter': '\\t', 'data_start': 2}, **kwargs)\n        self.strip_whitespace_lines = False\n        self.strip_whitespace_fields = False\n\n    def _read_header(self):\n        tmp = self.engine.source\n        line1 = ''\n        line2 = ''\n        for line in tmp.splitlines():\n            # valid non-comment line\n            if not line1 and line.strip() and line.lstrip()[0] != self.comment:\n                line1 = line\n            elif not line2 and line.strip() and line.lstrip()[0] != self.comment:\n                line2 = line\n                break\n        else:  # less than 2 lines in table\n            raise ValueError('RDB header requires 2 lines')\n\n        # Tokenize the two header lines separately.\n        # Each call to self.engine.read_header by default\n        #  - calls _deduplicate_names to ensure unique header_names\n        #  - sets self.names from self.header_names if not provided as kwarg\n        #  - applies self.include_names/exclude_names to self.names.\n        # For parsing the types disable 1+3, but self.names needs to be set.\n        self.engine.setup_tokenizer([line2])\n        self.engine.header_start = 0\n        self.engine.read_header(deduplicate=False, filter_names=False)\n        types = self.engine.get_header_names()\n\n        # If no kwarg names have been passed, reset to have column names read from header line 1.\n        if types == self.engine.get_names():\n            self.engine.set_names([])\n        self.engine.setup_tokenizer([line1])\n        # Get full list of column names prior to applying include/exclude_names,\n        # which have to be applied to the unique name set after deduplicate.\n        self.engine.read_header(deduplicate=True, filter_names=False)\n        col_names = self.engine.get_names()\n        self.engine.read_header(deduplicate=False)\n        if len(col_names) != len(types):\n            raise core.InconsistentTableError('RDB header mismatch between number of '\n                                              'column names and column types')\n        # If columns have been removed via include/exclude_names, extract matching types.\n        if len(self.engine.get_names()) != len(types):\n            types = [types[col_names.index(n)] for n in self.engine.get_names()]\n\n        if any(not re.match(r'\\d*(N|S)$', x, re.IGNORECASE) for x in types):\n            raise core.InconsistentTableError('RDB type definitions do not all match '\n                                              '[num](N|S): {}'.format(types))\n\n        try_int = {}\n        try_float = {}\n        try_string = {}\n\n        for name, col_type in zip(self.engine.get_names(), types):\n            if col_type[-1].lower() == 's':\n                try_int[name] = 0\n                try_float[name] = 0\n                try_string[name] = 1\n            else:\n                try_int[name] = 1\n                try_float[name] = 1\n                try_string[name] = 0\n\n        self.engine.setup_tokenizer(tmp)\n        return (try_int, try_float, try_string)\n\n    def write(self, table, output):\n        \"\"\"\n        Override the default writing behavior in `FastBasic` to\n        output a line with column types after the column name line.\n        \"\"\"\n        self._write(table, output, {}, output_types=True)"},{"col":4,"comment":"null","endLoc":321,"header":"def __init__(self, **kwargs)","id":5342,"name":"__init__","nodeType":"Function","startLoc":318,"text":"def __init__(self, **kwargs):\n        super().__init__({'delimiter': '\\t', 'data_start': 2}, **kwargs)\n        self.strip_whitespace_lines = False\n        self.strip_whitespace_fields = False"},{"col":4,"comment":"null","endLoc":383,"header":"def _read_header(self)","id":5343,"name":"_read_header","nodeType":"Function","startLoc":323,"text":"def _read_header(self):\n        tmp = self.engine.source\n        line1 = ''\n        line2 = ''\n        for line in tmp.splitlines():\n            # valid non-comment line\n            if not line1 and line.strip() and line.lstrip()[0] != self.comment:\n                line1 = line\n            elif not line2 and line.strip() and line.lstrip()[0] != self.comment:\n                line2 = line\n                break\n        else:  # less than 2 lines in table\n            raise ValueError('RDB header requires 2 lines')\n\n        # Tokenize the two header lines separately.\n        # Each call to self.engine.read_header by default\n        #  - calls _deduplicate_names to ensure unique header_names\n        #  - sets self.names from self.header_names if not provided as kwarg\n        #  - applies self.include_names/exclude_names to self.names.\n        # For parsing the types disable 1+3, but self.names needs to be set.\n        self.engine.setup_tokenizer([line2])\n        self.engine.header_start = 0\n        self.engine.read_header(deduplicate=False, filter_names=False)\n        types = self.engine.get_header_names()\n\n        # If no kwarg names have been passed, reset to have column names read from header line 1.\n        if types == self.engine.get_names():\n            self.engine.set_names([])\n        self.engine.setup_tokenizer([line1])\n        # Get full list of column names prior to applying include/exclude_names,\n        # which have to be applied to the unique name set after deduplicate.\n        self.engine.read_header(deduplicate=True, filter_names=False)\n        col_names = self.engine.get_names()\n        self.engine.read_header(deduplicate=False)\n        if len(col_names) != len(types):\n            raise core.InconsistentTableError('RDB header mismatch between number of '\n                                              'column names and column types')\n        # If columns have been removed via include/exclude_names, extract matching types.\n        if len(self.engine.get_names()) != len(types):\n            types = [types[col_names.index(n)] for n in self.engine.get_names()]\n\n        if any(not re.match(r'\\d*(N|S)$', x, re.IGNORECASE) for x in types):\n            raise core.InconsistentTableError('RDB type definitions do not all match '\n                                              '[num](N|S): {}'.format(types))\n\n        try_int = {}\n        try_float = {}\n        try_string = {}\n\n        for name, col_type in zip(self.engine.get_names(), types):\n            if col_type[-1].lower() == 's':\n                try_int[name] = 0\n                try_float[name] = 0\n                try_string[name] = 1\n            else:\n                try_int[name] = 1\n                try_float[name] = 1\n                try_string[name] = 0\n\n        self.engine.setup_tokenizer(tmp)\n        return (try_int, try_float, try_string)"},{"col":4,"comment":"Actually make the output table give the data and comments.","endLoc":143,"header":"def make_table(self, data, comments)","id":5344,"name":"make_table","nodeType":"Function","startLoc":136,"text":"def make_table(self, data, comments):\n        \"\"\"Actually make the output table give the data and comments.\"\"\"\n        meta = OrderedDict()\n        if comments:\n            meta['comments'] = comments\n\n        names = core._deduplicate_names(self.engine.get_names())\n        return Table(data, names=names, meta=meta)"},{"col":4,"comment":"\n        Call ``writerow_func`` (either writerow or writerows) with ``values``.\n        If it has empty fields that have been replaced then change those\n        sentinel strings back to quoted empty strings, e.g. ``\"\"``.\n        ","endLoc":155,"header":"def _writerow(self, writerow_func, values, has_empty)","id":5345,"name":"_writerow","nodeType":"Function","startLoc":132,"text":"def _writerow(self, writerow_func, values, has_empty):\n        \"\"\"\n        Call ``writerow_func`` (either writerow or writerows) with ``values``.\n        If it has empty fields that have been replaced then change those\n        sentinel strings back to quoted empty strings, e.g. ``\"\"``.\n        \"\"\"\n        # Clear the temporary StringIO buffer that self.writer writes into and\n        # then call the real csv.writer().writerow or writerows with values.\n        self.temp_out.seek(0)\n        self.temp_out.truncate()\n        writerow_func(values)\n\n        row_string = self.temp_out.getvalue()\n\n        if self.quote_empty and has_empty:\n            row_string = re.sub(self.replace_sentinel, self.quotechar2, row_string)\n\n        # self.csvfile is defined then write the output.  In practice the pure\n        # Python writer calls with csvfile=None, while the fast writer calls with\n        # a file-like object.\n        if self.csvfile:\n            self.csvfile.write(row_string)\n\n        return row_string"},{"col":4,"comment":"\n        Similar to csv.writer.writerows but with the custom quoting behavior.\n        Returns the written string instead of the length of that string.\n        ","endLoc":130,"header":"def writerows(self, values_list)","id":5346,"name":"writerows","nodeType":"Function","startLoc":114,"text":"def writerows(self, values_list):\n        \"\"\"\n        Similar to csv.writer.writerows but with the custom quoting behavior.\n        Returns the written string instead of the length of that string.\n        \"\"\"\n        has_empty = False\n\n        # If QUOTE_MINIMAL and space-delimited then replace empty fields with\n        # the sentinel value.\n        if self.quote_empty:\n            for values in values_list:\n                for i, value in enumerate(values):\n                    if value == '':\n                        has_empty = True\n                        values[i] = self.replace_sentinel\n\n        return self._writerow(self.writer.writerows, values_list, has_empty)"},{"col":4,"comment":"\n        Use a fast Cython method to write table data to output,\n        where output is a filename or file-like object.\n        ","endLoc":167,"header":"def write(self, table, output)","id":5347,"name":"write","nodeType":"Function","startLoc":162,"text":"def write(self, table, output):\n        \"\"\"\n        Use a fast Cython method to write table data to output,\n        where output is a filename or file-like object.\n        \"\"\"\n        self._write(table, output, {})"},{"attributeType":"null","col":4,"comment":"null","endLoc":21,"id":5348,"name":"_format_name","nodeType":"Attribute","startLoc":21,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":22,"id":5349,"name":"_description","nodeType":"Attribute","startLoc":22,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":23,"id":5350,"name":"_fast","nodeType":"Attribute","startLoc":23,"text":"_fast"},{"attributeType":"null","col":4,"comment":"null","endLoc":24,"id":5351,"name":"fill_extra_cols","nodeType":"Attribute","startLoc":24,"text":"fill_extra_cols"},{"attributeType":"null","col":4,"comment":"null","endLoc":25,"id":5352,"name":"guessing","nodeType":"Attribute","startLoc":25,"text":"guessing"},{"attributeType":"null","col":4,"comment":"null","endLoc":26,"id":5353,"name":"strict_names","nodeType":"Attribute","startLoc":26,"text":"strict_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":49,"id":5354,"name":"quotechar","nodeType":"Attribute","startLoc":49,"text":"self.quotechar"},{"attributeType":"null","col":4,"comment":"null","endLoc":84,"id":5355,"name":"replace_sentinel","nodeType":"Attribute","startLoc":84,"text":"replace_sentinel"},{"attributeType":"null","col":8,"comment":"null","endLoc":94,"id":5356,"name":"quotechar2","nodeType":"Attribute","startLoc":94,"text":"self.quotechar2"},{"attributeType":"null","col":8,"comment":"null","endLoc":57,"id":5357,"name":"strip_whitespace_lines","nodeType":"Attribute","startLoc":57,"text":"self.strip_whitespace_lines"},{"attributeType":"null","col":8,"comment":"null","endLoc":96,"id":5358,"name":"strict_names","nodeType":"Attribute","startLoc":96,"text":"self.strict_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":45,"id":5359,"name":"write_comment","nodeType":"Attribute","startLoc":45,"text":"self.write_comment"},{"attributeType":"null","col":8,"comment":"null","endLoc":90,"id":5360,"name":"temp_out","nodeType":"Attribute","startLoc":90,"text":"self.temp_out"},{"attributeType":"null","col":8,"comment":"null","endLoc":95,"id":5361,"name":"quote_empty","nodeType":"Attribute","startLoc":95,"text":"self.quote_empty"},{"attributeType":"null","col":8,"comment":"null","endLoc":87,"id":5362,"name":"csvfile","nodeType":"Attribute","startLoc":87,"text":"self.csvfile"},{"attributeType":"null","col":8,"comment":"null","endLoc":91,"id":5363,"name":"writer","nodeType":"Attribute","startLoc":91,"text":"self.writer"},{"className":"MaskedConstant","col":0,"comment":"A trivial extension of numpy.ma.masked\n\n    We want to be able to put the generic term ``masked`` into a dictionary.\n    The constant ``numpy.ma.masked`` is not hashable (see\n    https://github.com/numpy/numpy/issues/4660), so we need to extend it\n    here with a hash value.\n\n    See https://github.com/numpy/numpy/issues/11021 for rationale for\n    __copy__ and __deepcopy__ methods.\n    ","endLoc":180,"id":5364,"nodeType":"Class","startLoc":158,"text":"class MaskedConstant(numpy.ma.core.MaskedConstant):\n    \"\"\"A trivial extension of numpy.ma.masked\n\n    We want to be able to put the generic term ``masked`` into a dictionary.\n    The constant ``numpy.ma.masked`` is not hashable (see\n    https://github.com/numpy/numpy/issues/4660), so we need to extend it\n    here with a hash value.\n\n    See https://github.com/numpy/numpy/issues/11021 for rationale for\n    __copy__ and __deepcopy__ methods.\n    \"\"\"\n\n    def __hash__(self):\n        '''All instances of this class shall have the same hash.'''\n        # Any large number will do.\n        return 1234567890\n\n    def __copy__(self):\n        \"\"\"This is a singleton so just return self.\"\"\"\n        return self\n\n    def __deepcopy__(self, memo):\n        return self"},{"col":4,"comment":"All instances of this class shall have the same hash.","endLoc":173,"header":"def __hash__(self)","id":5365,"name":"__hash__","nodeType":"Function","startLoc":170,"text":"def __hash__(self):\n        '''All instances of this class shall have the same hash.'''\n        # Any large number will do.\n        return 1234567890"},{"col":4,"comment":"This is a singleton so just return self.","endLoc":177,"header":"def __copy__(self)","id":5366,"name":"__copy__","nodeType":"Function","startLoc":175,"text":"def __copy__(self):\n        \"\"\"This is a singleton so just return self.\"\"\"\n        return self"},{"col":4,"comment":"null","endLoc":180,"header":"def __deepcopy__(self, memo)","id":5367,"name":"__deepcopy__","nodeType":"Function","startLoc":179,"text":"def __deepcopy__(self, memo):\n        return self"},{"className":"OptionalTableImportError","col":0,"comment":"\n    Indicates that a dependency for table reading is not present.\n\n    An instance of this class is raised whenever an optional reader\n    with certain required dependencies cannot operate because of\n    an ImportError.\n    ","endLoc":202,"id":5368,"nodeType":"Class","startLoc":195,"text":"class OptionalTableImportError(ImportError):\n    \"\"\"\n    Indicates that a dependency for table reading is not present.\n\n    An instance of this class is raised whenever an optional reader\n    with certain required dependencies cannot operate because of\n    an ImportError.\n    \"\"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":58,"id":5369,"name":"strip_whitespace_fields","nodeType":"Attribute","startLoc":58,"text":"self.strip_whitespace_fields"},{"className":"FastOptionsError","col":0,"comment":"\n    Indicates that one of the specified options for fast\n    reading is invalid.\n    ","endLoc":219,"id":5370,"nodeType":"Class","startLoc":215,"text":"class FastOptionsError(NotImplementedError):\n    \"\"\"\n    Indicates that one of the specified options for fast\n    reading is invalid.\n    \"\"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":109,"id":5371,"name":"engine","nodeType":"Attribute","startLoc":109,"text":"self.engine"},{"attributeType":"null","col":8,"comment":"null","endLoc":44,"id":5372,"name":"delimiter","nodeType":"Attribute","startLoc":44,"text":"self.delimiter"},{"className":"BoolType","col":0,"comment":"\n    Describes boolean data.\n    ","endLoc":252,"id":5373,"nodeType":"Class","startLoc":249,"text":"class BoolType(NoType):\n    \"\"\"\n    Describes boolean data.\n    \"\"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":55,"id":5374,"name":"data_start","nodeType":"Attribute","startLoc":55,"text":"self.data_start"},{"className":"MetaBaseReader","col":0,"comment":"null","endLoc":1172,"id":5375,"nodeType":"Class","startLoc":1138,"text":"class MetaBaseReader(type):\n    def __init__(cls, name, bases, dct):\n        super().__init__(name, bases, dct)\n\n        format = dct.get('_format_name')\n        if format is None:\n            return\n\n        fast = dct.get('_fast')\n        if fast is not None:\n            FAST_CLASSES[format] = cls\n\n        FORMAT_CLASSES[format] = cls\n\n        io_formats = ['ascii.' + format] + dct.get('_io_registry_format_aliases', [])\n\n        if dct.get('_io_registry_suffix'):\n            func = functools.partial(connect.io_identify, dct['_io_registry_suffix'])\n            connect.io_registry.register_identifier(io_formats[0], Table, func)\n\n        for io_format in io_formats:\n            func = functools.partial(connect.io_read, io_format)\n            header = f\"ASCII reader '{io_format}' details\\n\"\n            func.__doc__ = (inspect.cleandoc(READ_DOCSTRING).strip() + '\\n\\n'\n                            + header + re.sub('.', '=', header) + '\\n')\n            func.__doc__ += inspect.cleandoc(cls.__doc__).strip()\n            connect.io_registry.register_reader(io_format, Table, func)\n\n            if dct.get('_io_registry_can_write', True):\n                func = functools.partial(connect.io_write, io_format)\n                header = f\"ASCII writer '{io_format}' details\\n\"\n                func.__doc__ = (inspect.cleandoc(WRITE_DOCSTRING).strip() + '\\n\\n'\n                                + header + re.sub('.', '=', header) + '\\n')\n                func.__doc__ += inspect.cleandoc(cls.__doc__).strip()\n                connect.io_registry.register_writer(io_format, Table, func)"},{"attributeType":"null","col":8,"comment":"null","endLoc":56,"id":5376,"name":"kwargs","nodeType":"Attribute","startLoc":56,"text":"self.kwargs"},{"attributeType":"null","col":8,"comment":"null","endLoc":50,"id":5377,"name":"header_start","nodeType":"Attribute","startLoc":50,"text":"self.header_start"},{"attributeType":"null","col":12,"comment":"null","endLoc":48,"id":5378,"name":"comment","nodeType":"Attribute","startLoc":48,"text":"self.comment"},{"attributeType":"null","col":8,"comment":"null","endLoc":105,"id":5379,"name":"return_header_chars","nodeType":"Attribute","startLoc":105,"text":"self.return_header_chars"},{"col":4,"comment":"null","endLoc":1172,"header":"def __init__(cls, name, bases, dct)","id":5380,"name":"__init__","nodeType":"Function","startLoc":1139,"text":"def __init__(cls, name, bases, dct):\n        super().__init__(name, bases, dct)\n\n        format = dct.get('_format_name')\n        if format is None:\n            return\n\n        fast = dct.get('_fast')\n        if fast is not None:\n            FAST_CLASSES[format] = cls\n\n        FORMAT_CLASSES[format] = cls\n\n        io_formats = ['ascii.' + format] + dct.get('_io_registry_format_aliases', [])\n\n        if dct.get('_io_registry_suffix'):\n            func = functools.partial(connect.io_identify, dct['_io_registry_suffix'])\n            connect.io_registry.register_identifier(io_formats[0], Table, func)\n\n        for io_format in io_formats:\n            func = functools.partial(connect.io_read, io_format)\n            header = f\"ASCII reader '{io_format}' details\\n\"\n            func.__doc__ = (inspect.cleandoc(READ_DOCSTRING).strip() + '\\n\\n'\n                            + header + re.sub('.', '=', header) + '\\n')\n            func.__doc__ += inspect.cleandoc(cls.__doc__).strip()\n            connect.io_registry.register_reader(io_format, Table, func)\n\n            if dct.get('_io_registry_can_write', True):\n                func = functools.partial(connect.io_write, io_format)\n                header = f\"ASCII writer '{io_format}' details\\n\"\n                func.__doc__ = (inspect.cleandoc(WRITE_DOCSTRING).strip() + '\\n\\n'\n                                + header + re.sub('.', '=', header) + '\\n')\n                func.__doc__ += inspect.cleandoc(cls.__doc__).strip()\n                connect.io_registry.register_writer(io_format, Table, func)"},{"className":"Mrt","col":0,"comment":"AAS MRT (Machine-Readable Table) format table.\n\n    **Reading**\n    ::\n\n      >>> from astropy.io import ascii\n      >>> table = ascii.read('data.mrt', format='mrt')\n\n    **Writing**\n\n    Use ``ascii.write(table, 'data.mrt', format='mrt')`` to  write tables to\n    Machine Readable Table (MRT) format.\n\n    Note that the metadata of the table, apart from units, column names and\n    description, will not be written. These have to be filled in by hand later.\n\n    See also: :ref:`cds_mrt_format`.\n\n    Caveats:\n\n    * The Units and Explanations are available in the column ``unit`` and\n      ``description`` attributes, respectively.\n    * The other metadata defined by this format is not available in the output table.\n    ","endLoc":618,"id":5381,"nodeType":"Class","startLoc":573,"text":"class Mrt(core.BaseReader):\n    \"\"\"AAS MRT (Machine-Readable Table) format table.\n\n    **Reading**\n    ::\n\n      >>> from astropy.io import ascii\n      >>> table = ascii.read('data.mrt', format='mrt')\n\n    **Writing**\n\n    Use ``ascii.write(table, 'data.mrt', format='mrt')`` to  write tables to\n    Machine Readable Table (MRT) format.\n\n    Note that the metadata of the table, apart from units, column names and\n    description, will not be written. These have to be filled in by hand later.\n\n    See also: :ref:`cds_mrt_format`.\n\n    Caveats:\n\n    * The Units and Explanations are available in the column ``unit`` and\n      ``description`` attributes, respectively.\n    * The other metadata defined by this format is not available in the output table.\n    \"\"\"\n    _format_name = 'mrt'\n    _io_registry_format_aliases = ['mrt']\n    _io_registry_can_write = True\n    _description = 'MRT format table'\n\n    data_class = MrtData\n    header_class = MrtHeader\n\n    def write(self, table=None):\n        # Construct for writing empty table is not yet done.\n        if len(table) == 0:\n            raise NotImplementedError\n\n        self.data.header = self.header\n        self.header.position_line = None\n        self.header.start_line = None\n\n        # Create a copy of the ``table``, so that it the copy gets modified and\n        # written to the file, while the original table remains as it is.\n        table = table.copy()\n        return super().write(table)"},{"col":4,"comment":"null","endLoc":618,"header":"def write(self, table=None)","id":5382,"name":"write","nodeType":"Function","startLoc":606,"text":"def write(self, table=None):\n        # Construct for writing empty table is not yet done.\n        if len(table) == 0:\n            raise NotImplementedError\n\n        self.data.header = self.header\n        self.header.position_line = None\n        self.header.start_line = None\n\n        # Create a copy of the ``table``, so that it the copy gets modified and\n        # written to the file, while the original table remains as it is.\n        table = table.copy()\n        return super().write(table)"},{"attributeType":"null","col":4,"comment":"null","endLoc":598,"id":5383,"name":"_format_name","nodeType":"Attribute","startLoc":598,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":599,"id":5384,"name":"_io_registry_format_aliases","nodeType":"Attribute","startLoc":599,"text":"_io_registry_format_aliases"},{"attributeType":"null","col":4,"comment":"null","endLoc":600,"id":5385,"name":"_io_registry_can_write","nodeType":"Attribute","startLoc":600,"text":"_io_registry_can_write"},{"attributeType":"null","col":4,"comment":"null","endLoc":601,"id":5386,"name":"_description","nodeType":"Attribute","startLoc":601,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":603,"id":5387,"name":"data_class","nodeType":"Attribute","startLoc":603,"text":"data_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":604,"id":5388,"name":"header_class","nodeType":"Attribute","startLoc":604,"text":"header_class"},{"className":"Ipac","col":0,"comment":"IPAC format table.\n\n    See: https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html\n\n    Example::\n\n      \\\\name=value\n      \\\\ Comment\n      |  column1 |   column2 | column3 | column4  |    column5    |\n      |  double  |   double  |   int   |   double |     char      |\n      |  unit    |   unit    |   unit  |    unit  |     unit      |\n      |  null    |   null    |   null  |    null  |     null      |\n       2.0978     29.09056    73765     2.06000    B8IVpMnHg\n\n    Or::\n\n      |-----ra---|----dec---|---sao---|------v---|----sptype--------|\n        2.09708   29.09056     73765   2.06000    B8IVpMnHg\n\n    The comments and keywords defined in the header are available via the output\n    table ``meta`` attribute::\n\n      >>> import os\n      >>> from astropy.io import ascii\n      >>> filename = os.path.join(ascii.__path__[0], 'tests/data/ipac.dat')\n      >>> data = ascii.read(filename)\n      >>> print(data.meta['comments'])\n      ['This is an example of a valid comment']\n      >>> for name, keyword in data.meta['keywords'].items():\n      ...     print(name, keyword['value'])\n      ...\n      intval 1\n      floatval 2300.0\n      date Wed Sp 20 09:48:36 1995\n      key_continue IPAC keywords can continue across lines\n\n    Note that there are different conventions for characters occurring below the\n    position of the ``|`` symbol in IPAC tables. By default, any character\n    below a ``|`` will be ignored (since this is the current standard),\n    but if you need to read files that assume characters below the ``|``\n    symbols belong to the column before or after the ``|``, you can specify\n    ``definition='left'`` or ``definition='right'`` respectively when reading\n    the table (the default is ``definition='ignore'``). The following examples\n    demonstrate the different conventions:\n\n    * ``definition='ignore'``::\n\n        |   ra  |  dec  |\n        | float | float |\n          1.2345  6.7890\n\n    * ``definition='left'``::\n\n        |   ra  |  dec  |\n        | float | float |\n           1.2345  6.7890\n\n    * ``definition='right'``::\n\n        |   ra  |  dec  |\n        | float | float |\n        1.2345  6.7890\n\n    IPAC tables can specify a null value in the header that is shown in place\n    of missing or bad data. On writing, this value defaults to ``null``.\n    To specify a different null value, use the ``fill_values`` option to\n    replace masked values with a string or number of your choice as\n    described in :ref:`astropy:io_ascii_write_parameters`::\n\n        >>> from astropy.io.ascii import masked\n        >>> fill = [(masked, 'N/A', 'ra'), (masked, -999, 'sptype')]\n        >>> ascii.write(data, format='ipac', fill_values=fill)\n        \\ This is an example of a valid comment\n        ...\n        |          ra|         dec|      sai|          v2|            sptype|\n        |      double|      double|     long|      double|              char|\n        |        unit|        unit|     unit|        unit|              ergs|\n        |         N/A|        null|     null|        null|              -999|\n                  N/A     29.09056      null         2.06               -999\n         2345678901.0 3456789012.0 456789012 4567890123.0 567890123456789012\n\n    When writing a table with a column of integers, the data type is output\n    as ``int`` when the column ``dtype.itemsize`` is less than or equal to 2;\n    otherwise the data type is ``long``. For a column of floating-point values,\n    the data type is ``float`` when ``dtype.itemsize`` is less than or equal\n    to 4; otherwise the data type is ``double``.\n\n    Parameters\n    ----------\n    definition : str, optional\n        Specify the convention for characters in the data table that occur\n        directly below the pipe (``|``) symbol in the header column definition:\n\n          * 'ignore' - Any character beneath a pipe symbol is ignored (default)\n          * 'right' - Character is associated with the column to the right\n          * 'left' - Character is associated with the column to the left\n\n    DBMS : bool, optional\n        If true, this verifies that written tables adhere (semantically)\n        to the `IPAC/DBMS\n        <https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/DBMSrestriction.html>`_\n        definition of IPAC tables. If 'False' it only checks for the (less strict)\n        `IPAC <https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html>`_\n        definition.\n    ","endLoc":541,"id":5389,"nodeType":"Class","startLoc":326,"text":"class Ipac(basic.Basic):\n    r\"\"\"IPAC format table.\n\n    See: https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html\n\n    Example::\n\n      \\\\name=value\n      \\\\ Comment\n      |  column1 |   column2 | column3 | column4  |    column5    |\n      |  double  |   double  |   int   |   double |     char      |\n      |  unit    |   unit    |   unit  |    unit  |     unit      |\n      |  null    |   null    |   null  |    null  |     null      |\n       2.0978     29.09056    73765     2.06000    B8IVpMnHg\n\n    Or::\n\n      |-----ra---|----dec---|---sao---|------v---|----sptype--------|\n        2.09708   29.09056     73765   2.06000    B8IVpMnHg\n\n    The comments and keywords defined in the header are available via the output\n    table ``meta`` attribute::\n\n      >>> import os\n      >>> from astropy.io import ascii\n      >>> filename = os.path.join(ascii.__path__[0], 'tests/data/ipac.dat')\n      >>> data = ascii.read(filename)\n      >>> print(data.meta['comments'])\n      ['This is an example of a valid comment']\n      >>> for name, keyword in data.meta['keywords'].items():\n      ...     print(name, keyword['value'])\n      ...\n      intval 1\n      floatval 2300.0\n      date Wed Sp 20 09:48:36 1995\n      key_continue IPAC keywords can continue across lines\n\n    Note that there are different conventions for characters occurring below the\n    position of the ``|`` symbol in IPAC tables. By default, any character\n    below a ``|`` will be ignored (since this is the current standard),\n    but if you need to read files that assume characters below the ``|``\n    symbols belong to the column before or after the ``|``, you can specify\n    ``definition='left'`` or ``definition='right'`` respectively when reading\n    the table (the default is ``definition='ignore'``). The following examples\n    demonstrate the different conventions:\n\n    * ``definition='ignore'``::\n\n        |   ra  |  dec  |\n        | float | float |\n          1.2345  6.7890\n\n    * ``definition='left'``::\n\n        |   ra  |  dec  |\n        | float | float |\n           1.2345  6.7890\n\n    * ``definition='right'``::\n\n        |   ra  |  dec  |\n        | float | float |\n        1.2345  6.7890\n\n    IPAC tables can specify a null value in the header that is shown in place\n    of missing or bad data. On writing, this value defaults to ``null``.\n    To specify a different null value, use the ``fill_values`` option to\n    replace masked values with a string or number of your choice as\n    described in :ref:`astropy:io_ascii_write_parameters`::\n\n        >>> from astropy.io.ascii import masked\n        >>> fill = [(masked, 'N/A', 'ra'), (masked, -999, 'sptype')]\n        >>> ascii.write(data, format='ipac', fill_values=fill)\n        \\ This is an example of a valid comment\n        ...\n        |          ra|         dec|      sai|          v2|            sptype|\n        |      double|      double|     long|      double|              char|\n        |        unit|        unit|     unit|        unit|              ergs|\n        |         N/A|        null|     null|        null|              -999|\n                  N/A     29.09056      null         2.06               -999\n         2345678901.0 3456789012.0 456789012 4567890123.0 567890123456789012\n\n    When writing a table with a column of integers, the data type is output\n    as ``int`` when the column ``dtype.itemsize`` is less than or equal to 2;\n    otherwise the data type is ``long``. For a column of floating-point values,\n    the data type is ``float`` when ``dtype.itemsize`` is less than or equal\n    to 4; otherwise the data type is ``double``.\n\n    Parameters\n    ----------\n    definition : str, optional\n        Specify the convention for characters in the data table that occur\n        directly below the pipe (``|``) symbol in the header column definition:\n\n          * 'ignore' - Any character beneath a pipe symbol is ignored (default)\n          * 'right' - Character is associated with the column to the right\n          * 'left' - Character is associated with the column to the left\n\n    DBMS : bool, optional\n        If true, this verifies that written tables adhere (semantically)\n        to the `IPAC/DBMS\n        <https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/DBMSrestriction.html>`_\n        definition of IPAC tables. If 'False' it only checks for the (less strict)\n        `IPAC <https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html>`_\n        definition.\n    \"\"\"\n    _format_name = 'ipac'\n    _io_registry_format_aliases = ['ipac']\n    _io_registry_can_write = True\n    _description = 'IPAC format table'\n\n    data_class = IpacData\n    header_class = IpacHeader\n\n    def __init__(self, definition='ignore', DBMS=False):\n        super().__init__()\n        # Usually the header is not defined in __init__, but here it need a keyword\n        if definition in ['ignore', 'left', 'right']:\n            self.header.ipac_definition = definition\n        else:\n            raise ValueError(\"definition should be one of ignore/left/right\")\n        self.header.DBMS = DBMS\n\n    def write(self, table):\n        \"\"\"\n        Write ``table`` as list of strings.\n\n        Parameters\n        ----------\n        table : `~astropy.table.Table`\n            Input table data\n\n        Returns\n        -------\n        lines : list\n            List of strings corresponding to ASCII table\n\n        \"\"\"\n        # Set a default null value for all columns by adding at the end, which\n        # is the position with the lowest priority.\n        # We have to do it this late, because the fill_value\n        # defined in the class can be overwritten by ui.write\n        self.data.fill_values.append((core.masked, 'null'))\n\n        # Check column names before altering\n        self.header.cols = list(table.columns.values())\n        self.header.check_column_names(self.names, self.strict_names, self.guessing)\n\n        core._apply_include_exclude_names(table, self.names, self.include_names, self.exclude_names)\n\n        # Check that table has only 1-d columns.\n        self._check_multidim_table(table)\n\n        # Now use altered columns\n        new_cols = list(table.columns.values())\n        # link information about the columns to the writer object (i.e. self)\n        self.header.cols = new_cols\n        self.data.cols = new_cols\n\n        # Write header and data to lines list\n        lines = []\n        # Write meta information\n        if 'comments' in table.meta:\n            for comment in table.meta['comments']:\n                if len(str(comment)) > 78:\n                    warn('Comment string > 78 characters was automatically wrapped.',\n                         AstropyUserWarning)\n                for line in wrap(str(comment), 80, initial_indent='\\\\ ', subsequent_indent='\\\\ '):\n                    lines.append(line)\n        if 'keywords' in table.meta:\n            keydict = table.meta['keywords']\n            for keyword in keydict:\n                try:\n                    val = keydict[keyword]['value']\n                    lines.append(f'\\\\{keyword.strip()}={val!r}')\n                    # meta is not standardized: Catch some common Errors.\n                except TypeError:\n                    warn(\"Table metadata keyword {0} has been skipped.  \"\n                         \"IPAC metadata must be in the form {{'keywords':\"\n                         \"{{'keyword': {{'value': value}} }}\".format(keyword),\n                         AstropyUserWarning)\n        ignored_keys = [key for key in table.meta if key not in ('keywords', 'comments')]\n        if any(ignored_keys):\n            warn(\"Table metadata keyword(s) {0} were not written.  \"\n                 \"IPAC metadata must be in the form {{'keywords':\"\n                 \"{{'keyword': {{'value': value}} }}\".format(ignored_keys),\n                 AstropyUserWarning\n                 )\n\n        # Usually, this is done in data.write, but since the header is written\n        # first, we need that here.\n        self.data._set_fill_values(self.data.cols)\n\n        # get header and data as strings to find width of each column\n        for i, col in enumerate(table.columns.values()):\n            col.headwidth = max([len(vals[i]) for vals in self.header.str_vals()])\n        # keep data_str_vals because they take some time to make\n        data_str_vals = []\n        col_str_iters = self.data.str_vals()\n        for vals in zip(*col_str_iters):\n            data_str_vals.append(vals)\n\n        for i, col in enumerate(table.columns.values()):\n            # FIXME: In Python 3.4, use max([], default=0).\n            # See: https://docs.python.org/3/library/functions.html#max\n            if data_str_vals:\n                col.width = max([len(vals[i]) for vals in data_str_vals])\n            else:\n                col.width = 0\n\n        widths = [max(col.width, col.headwidth) for col in table.columns.values()]\n        # then write table\n        self.header.write(lines, widths)\n        self.data.write(lines, widths, data_str_vals)\n\n        return lines"},{"attributeType":"QDPData","col":4,"comment":"null","endLoc":614,"id":5390,"name":"data_class","nodeType":"Attribute","startLoc":614,"text":"data_class"},{"col":4,"comment":"null","endLoc":447,"header":"def __init__(self, definition='ignore', DBMS=False)","id":5391,"name":"__init__","nodeType":"Function","startLoc":440,"text":"def __init__(self, definition='ignore', DBMS=False):\n        super().__init__()\n        # Usually the header is not defined in __init__, but here it need a keyword\n        if definition in ['ignore', 'left', 'right']:\n            self.header.ipac_definition = definition\n        else:\n            raise ValueError(\"definition should be one of ignore/left/right\")\n        self.header.DBMS = DBMS"},{"col":0,"comment":"Initialize a table writer allowing for common customizations. This\n    routine is for internal (package) use only and is useful because it depends\n    only on the \"core\" module.","endLoc":1736,"header":"def _get_writer(Writer, fast_writer, **kwargs)","id":5392,"name":"_get_writer","nodeType":"Function","startLoc":1675,"text":"def _get_writer(Writer, fast_writer, **kwargs):\n    \"\"\"Initialize a table writer allowing for common customizations. This\n    routine is for internal (package) use only and is useful because it depends\n    only on the \"core\" module.\"\"\"\n\n    from .fastbasic import FastBasic\n\n    # A value of None for fill_values imply getting the default string\n    # representation of masked values (depending on the writer class), but the\n    # machinery expects a list.  The easiest here is to just pop the value off,\n    # i.e. fill_values=None is the same as not providing it at all.\n    if 'fill_values' in kwargs and kwargs['fill_values'] is None:\n        del kwargs['fill_values']\n\n    if issubclass(Writer, FastBasic):  # Fast writers handle args separately\n        return Writer(**kwargs)\n    elif fast_writer and f'fast_{Writer._format_name}' in FAST_CLASSES:\n        # Switch to fast writer\n        kwargs['fast_writer'] = fast_writer\n        return FAST_CLASSES[f'fast_{Writer._format_name}'](**kwargs)\n\n    writer_kwargs = dict([k, v] for k, v in kwargs.items() if k not in extra_writer_pars)\n    writer = Writer(**writer_kwargs)\n\n    if 'delimiter' in kwargs:\n        writer.header.splitter.delimiter = kwargs['delimiter']\n        writer.data.splitter.delimiter = kwargs['delimiter']\n    if 'comment' in kwargs:\n        writer.header.write_comment = kwargs['comment']\n        writer.data.write_comment = kwargs['comment']\n    if 'quotechar' in kwargs:\n        writer.header.splitter.quotechar = kwargs['quotechar']\n        writer.data.splitter.quotechar = kwargs['quotechar']\n    if 'formats' in kwargs:\n        writer.data.formats = kwargs['formats']\n    if 'strip_whitespace' in kwargs:\n        if kwargs['strip_whitespace']:\n            # Restore the default SplitterClass process_val method which strips\n            # whitespace.  This may have been changed in the Writer\n            # initialization (e.g. Rdb and Tab)\n            writer.data.splitter.process_val = operator.methodcaller('strip', ' \\t')\n        else:\n            writer.data.splitter.process_val = None\n    if 'names' in kwargs:\n        writer.header.names = kwargs['names']\n    if 'include_names' in kwargs:\n        writer.include_names = kwargs['include_names']\n    if 'exclude_names' in kwargs:\n        writer.exclude_names = kwargs['exclude_names']\n    if 'fill_values' in kwargs:\n        # Prepend user-specified values to the class default.\n        with suppress(TypeError, IndexError):\n            # Test if it looks like (match, replace_string, optional_colname),\n            # in which case make it a list\n            kwargs['fill_values'][1] + ''\n            kwargs['fill_values'] = [kwargs['fill_values']]\n        writer.data.fill_values = kwargs['fill_values'] + writer.data.fill_values\n    if 'fill_include_names' in kwargs:\n        writer.data.fill_include_names = kwargs['fill_include_names']\n    if 'fill_exclude_names' in kwargs:\n        writer.data.fill_exclude_names = kwargs['fill_exclude_names']\n    return writer"},{"col":4,"comment":"\n        Write ``table`` as list of strings.\n\n        Parameters\n        ----------\n        table : `~astropy.table.Table`\n            Input table data\n\n        Returns\n        -------\n        lines : list\n            List of strings corresponding to ASCII table\n\n        ","endLoc":541,"header":"def write(self, table)","id":5393,"name":"write","nodeType":"Function","startLoc":449,"text":"def write(self, table):\n        \"\"\"\n        Write ``table`` as list of strings.\n\n        Parameters\n        ----------\n        table : `~astropy.table.Table`\n            Input table data\n\n        Returns\n        -------\n        lines : list\n            List of strings corresponding to ASCII table\n\n        \"\"\"\n        # Set a default null value for all columns by adding at the end, which\n        # is the position with the lowest priority.\n        # We have to do it this late, because the fill_value\n        # defined in the class can be overwritten by ui.write\n        self.data.fill_values.append((core.masked, 'null'))\n\n        # Check column names before altering\n        self.header.cols = list(table.columns.values())\n        self.header.check_column_names(self.names, self.strict_names, self.guessing)\n\n        core._apply_include_exclude_names(table, self.names, self.include_names, self.exclude_names)\n\n        # Check that table has only 1-d columns.\n        self._check_multidim_table(table)\n\n        # Now use altered columns\n        new_cols = list(table.columns.values())\n        # link information about the columns to the writer object (i.e. self)\n        self.header.cols = new_cols\n        self.data.cols = new_cols\n\n        # Write header and data to lines list\n        lines = []\n        # Write meta information\n        if 'comments' in table.meta:\n            for comment in table.meta['comments']:\n                if len(str(comment)) > 78:\n                    warn('Comment string > 78 characters was automatically wrapped.',\n                         AstropyUserWarning)\n                for line in wrap(str(comment), 80, initial_indent='\\\\ ', subsequent_indent='\\\\ '):\n                    lines.append(line)\n        if 'keywords' in table.meta:\n            keydict = table.meta['keywords']\n            for keyword in keydict:\n                try:\n                    val = keydict[keyword]['value']\n                    lines.append(f'\\\\{keyword.strip()}={val!r}')\n                    # meta is not standardized: Catch some common Errors.\n                except TypeError:\n                    warn(\"Table metadata keyword {0} has been skipped.  \"\n                         \"IPAC metadata must be in the form {{'keywords':\"\n                         \"{{'keyword': {{'value': value}} }}\".format(keyword),\n                         AstropyUserWarning)\n        ignored_keys = [key for key in table.meta if key not in ('keywords', 'comments')]\n        if any(ignored_keys):\n            warn(\"Table metadata keyword(s) {0} were not written.  \"\n                 \"IPAC metadata must be in the form {{'keywords':\"\n                 \"{{'keyword': {{'value': value}} }}\".format(ignored_keys),\n                 AstropyUserWarning\n                 )\n\n        # Usually, this is done in data.write, but since the header is written\n        # first, we need that here.\n        self.data._set_fill_values(self.data.cols)\n\n        # get header and data as strings to find width of each column\n        for i, col in enumerate(table.columns.values()):\n            col.headwidth = max([len(vals[i]) for vals in self.header.str_vals()])\n        # keep data_str_vals because they take some time to make\n        data_str_vals = []\n        col_str_iters = self.data.str_vals()\n        for vals in zip(*col_str_iters):\n            data_str_vals.append(vals)\n\n        for i, col in enumerate(table.columns.values()):\n            # FIXME: In Python 3.4, use max([], default=0).\n            # See: https://docs.python.org/3/library/functions.html#max\n            if data_str_vals:\n                col.width = max([len(vals[i]) for vals in data_str_vals])\n            else:\n                col.width = 0\n\n        widths = [max(col.width, col.headwidth) for col in table.columns.values()]\n        # then write table\n        self.header.write(lines, widths)\n        self.data.write(lines, widths, data_str_vals)\n\n        return lines"},{"col":4,"comment":"null","endLoc":1554,"header":"def __init__(self, lon, lat=None, differentials=None, copy=True)","id":5394,"name":"__init__","nodeType":"Function","startLoc":1553,"text":"def __init__(self, lon, lat=None, differentials=None, copy=True):\n        super().__init__(lon, lat, differentials=differentials, copy=copy)"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":5395,"name":"FORMAT_CLASSES","nodeType":"Attribute","startLoc":37,"text":"FORMAT_CLASSES"},{"attributeType":"null","col":0,"comment":"null","endLoc":40,"id":5396,"name":"FAST_CLASSES","nodeType":"Attribute","startLoc":40,"text":"FAST_CLASSES"},{"attributeType":"null","col":0,"comment":"null","endLoc":1557,"id":5397,"name":"extra_reader_pars","nodeType":"Attribute","startLoc":1557,"text":"extra_reader_pars"},{"attributeType":"null","col":0,"comment":"null","endLoc":1668,"id":5398,"name":"extra_writer_pars","nodeType":"Attribute","startLoc":1668,"text":"extra_writer_pars"},{"col":0,"comment":"","endLoc":9,"header":"core.py#<anonymous>","id":5399,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\" An extensible ASCII table reader and writer.\n\ncore.py:\n  Core base classes and functions for reading and writing tables.\n\n:Copyright: Smithsonian Astrophysical Observatory (2010)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\"\n\nFORMAT_CLASSES = {}\n\nFAST_CLASSES = {}\n\nmasked = MaskedConstant()\n\nextra_reader_pars = ('Reader', 'Inputter', 'Outputter',\n                     'delimiter', 'comment', 'quotechar', 'header_start',\n                     'data_start', 'data_end', 'converters', 'encoding',\n                     'data_Splitter', 'header_Splitter',\n                     'names', 'include_names', 'exclude_names', 'strict_names',\n                     'fill_values', 'fill_include_names', 'fill_exclude_names')\n\nextra_writer_pars = ('delimiter', 'comment', 'quotechar', 'formats',\n                     'strip_whitespace',\n                     'names', 'include_names', 'exclude_names',\n                     'fill_values', 'fill_include_names',\n                     'fill_exclude_names')"},{"col":4,"comment":"\n        Determines if the SkyCoord is contained in the given wcs footprint.\n\n        Parameters\n        ----------\n        wcs : `~astropy.wcs.WCS`\n            The coordinate to check if it is within the wcs coordinate.\n        image : array\n            Optional.  The image associated with the wcs object that the cooordinate\n            is being checked against. If not given the naxis keywords will be used\n            to determine if the coordinate falls within the wcs footprint.\n        **kwargs :\n           Additional arguments to pass to `~astropy.coordinates.SkyCoord.to_pixel`\n\n        Returns\n        -------\n        response : bool\n           True means the WCS footprint contains the coordinate, False means it does not.\n        ","endLoc":1776,"header":"def contained_by(self, wcs, image=None, **kwargs)","id":5400,"name":"contained_by","nodeType":"Function","startLoc":1741,"text":"def contained_by(self, wcs, image=None, **kwargs):\n        \"\"\"\n        Determines if the SkyCoord is contained in the given wcs footprint.\n\n        Parameters\n        ----------\n        wcs : `~astropy.wcs.WCS`\n            The coordinate to check if it is within the wcs coordinate.\n        image : array\n            Optional.  The image associated with the wcs object that the cooordinate\n            is being checked against. If not given the naxis keywords will be used\n            to determine if the coordinate falls within the wcs footprint.\n        **kwargs :\n           Additional arguments to pass to `~astropy.coordinates.SkyCoord.to_pixel`\n\n        Returns\n        -------\n        response : bool\n           True means the WCS footprint contains the coordinate, False means it does not.\n        \"\"\"\n\n        if image is not None:\n            ymax, xmax = image.shape\n        else:\n            xmax, ymax = wcs._naxis\n\n        import warnings\n        with warnings.catch_warnings():\n            #  Suppress warnings since they just mean we didn't find the coordinate\n            warnings.simplefilter(\"ignore\")\n            try:\n                x, y = self.to_pixel(wcs, **kwargs)\n            except Exception:\n                return False\n\n        return (x < xmax) & (x > 0) & (y < ymax) & (y > 0)"},{"attributeType":"null","col":8,"comment":"null","endLoc":619,"id":5401,"name":"names","nodeType":"Attribute","startLoc":619,"text":"self.names"},{"fileName":"ipac.py","filePath":"astropy/io/ascii","id":5402,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"An extensible ASCII table reader and writer.\n\nipac.py:\n  Classes to read IPAC table format\n\n:Copyright: Smithsonian Astrophysical Observatory (2011)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\"\n\n\nimport re\nfrom collections import defaultdict, OrderedDict\nfrom textwrap import wrap\nfrom warnings import warn\n\n\nfrom . import core\nfrom . import fixedwidth\nfrom . import basic\nfrom astropy.utils.exceptions import AstropyUserWarning\nfrom astropy.table.pprint import get_auto_format_func\n\n\nclass IpacFormatErrorDBMS(Exception):\n    def __str__(self):\n        return '{}\\nSee {}'.format(\n            super().__str__(),\n            'https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/DBMSrestriction.html')\n\n\nclass IpacFormatError(Exception):\n    def __str__(self):\n        return '{}\\nSee {}'.format(\n            super().__str__(),\n            'https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html')\n\n\nclass IpacHeaderSplitter(core.BaseSplitter):\n    '''Splitter for Ipac Headers.\n\n    This splitter is similar its parent when reading, but supports a\n    fixed width format (as required for Ipac table headers) for writing.\n    '''\n    process_line = None\n    process_val = None\n    delimiter = '|'\n    delimiter_pad = ''\n    skipinitialspace = False\n    comment = r'\\s*\\\\'\n    write_comment = r'\\\\'\n    col_starts = None\n    col_ends = None\n\n    def join(self, vals, widths):\n        pad = self.delimiter_pad or ''\n        delimiter = self.delimiter or ''\n        padded_delim = pad + delimiter + pad\n        bookend_left = delimiter + pad\n        bookend_right = pad + delimiter\n\n        vals = [' ' * (width - len(val)) + val for val, width in zip(vals, widths)]\n        return bookend_left + padded_delim.join(vals) + bookend_right\n\n\nclass IpacHeader(fixedwidth.FixedWidthHeader):\n    \"\"\"IPAC table header\"\"\"\n    splitter_class = IpacHeaderSplitter\n\n    # Defined ordered list of possible types.  Ordering is needed to\n    # distinguish between \"d\" (double) and \"da\" (date) as defined by\n    # the IPAC standard for abbreviations.  This gets used in get_col_type().\n    col_type_list = (('integer', core.IntType),\n                     ('long', core.IntType),\n                     ('double', core.FloatType),\n                     ('float', core.FloatType),\n                     ('real', core.FloatType),\n                     ('char', core.StrType),\n                     ('date', core.StrType))\n    definition = 'ignore'\n    start_line = None\n\n    def process_lines(self, lines):\n        \"\"\"Generator to yield IPAC header lines, i.e. those starting and ending with\n        delimiter character (with trailing whitespace stripped)\"\"\"\n        delim = self.splitter.delimiter\n        for line in lines:\n            line = line.rstrip()\n            if line.startswith(delim) and line.endswith(delim):\n                yield line.strip(delim)\n\n    def update_meta(self, lines, meta):\n        \"\"\"\n        Extract table-level comments and keywords for IPAC table.  See:\n        https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html#kw\n        \"\"\"\n        def process_keyword_value(val):\n            \"\"\"\n            Take a string value and convert to float, int or str, and strip quotes\n            as needed.\n            \"\"\"\n            val = val.strip()\n            try:\n                val = int(val)\n            except Exception:\n                try:\n                    val = float(val)\n                except Exception:\n                    # Strip leading/trailing quote.  The spec says that a matched pair\n                    # of quotes is required, but this code will allow a non-quoted value.\n                    for quote in ('\"', \"'\"):\n                        if val.startswith(quote) and val.endswith(quote):\n                            val = val[1:-1]\n                            break\n            return val\n\n        table_meta = meta['table']\n        table_meta['comments'] = []\n        table_meta['keywords'] = OrderedDict()\n        keywords = table_meta['keywords']\n\n        re_keyword = re.compile(r'\\\\'\n                                r'(?P<name> \\w+)'\n                                r'\\s* = (?P<value> .+) $',\n                                re.VERBOSE)\n        for line in lines:\n            # Keywords and comments start with \"\\\".  Once the first non-slash\n            # line is seen then bail out.\n            if not line.startswith('\\\\'):\n                break\n\n            m = re_keyword.match(line)\n            if m:\n                name = m.group('name')\n                val = process_keyword_value(m.group('value'))\n\n                # IPAC allows for continuation keywords, e.g.\n                # \\SQL     = 'WHERE '\n                # \\SQL     = 'SELECT (25 column names follow in next row.)'\n                if name in keywords and isinstance(val, str):\n                    prev_val = keywords[name]['value']\n                    if isinstance(prev_val, str):\n                        val = prev_val + val\n\n                keywords[name] = {'value': val}\n            else:\n                # Comment is required to start with \"\\ \"\n                if line.startswith('\\\\ '):\n                    val = line[2:].strip()\n                    if val:\n                        table_meta['comments'].append(val)\n\n    def get_col_type(self, col):\n        for (col_type_key, col_type) in self.col_type_list:\n            if col_type_key.startswith(col.raw_type.lower()):\n                return col_type\n        else:\n            raise ValueError('Unknown data type \"\"{}\"\" for column \"{}\"'.format(\n                col.raw_type, col.name))\n\n    def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines``.\n\n        Based on the previously set Header attributes find or create the column names.\n        Sets ``self.cols`` with the list of Columns.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n        header_lines = self.process_lines(lines)  # generator returning valid header lines\n        header_vals = [vals for vals in self.splitter(header_lines)]\n        if len(header_vals) == 0:\n            raise ValueError('At least one header line beginning and ending with '\n                             'delimiter required')\n        elif len(header_vals) > 4:\n            raise ValueError('More than four header lines were found')\n\n        # Generate column definitions\n        cols = []\n        start = 1\n        for i, name in enumerate(header_vals[0]):\n            col = core.Column(name=name.strip(' -'))\n            col.start = start\n            col.end = start + len(name)\n            if len(header_vals) > 1:\n                col.raw_type = header_vals[1][i].strip(' -')\n                col.type = self.get_col_type(col)\n            if len(header_vals) > 2:\n                col.unit = header_vals[2][i].strip() or None  # Can't strip dashes here\n            if len(header_vals) > 3:\n                # The IPAC null value corresponds to the io.ascii bad_value.\n                # In this case there isn't a fill_value defined, so just put\n                # in the minimal entry that is sure to convert properly to the\n                # required type.\n                #\n                # Strip spaces but not dashes (not allowed in NULL row per\n                # https://github.com/astropy/astropy/issues/361)\n                null = header_vals[3][i].strip()\n                fillval = '' if issubclass(col.type, core.StrType) else '0'\n                self.data.fill_values.append((null, fillval, col.name))\n            start = col.end + 1\n            cols.append(col)\n\n            # Correct column start/end based on definition\n            if self.ipac_definition == 'right':\n                col.start -= 1\n            elif self.ipac_definition == 'left':\n                col.end += 1\n\n        self.names = [x.name for x in cols]\n        self.cols = cols\n\n    def str_vals(self):\n\n        if self.DBMS:\n            IpacFormatE = IpacFormatErrorDBMS\n        else:\n            IpacFormatE = IpacFormatError\n\n        namelist = self.colnames\n        if self.DBMS:\n            countnamelist = defaultdict(int)\n            for name in self.colnames:\n                countnamelist[name.lower()] += 1\n            doublenames = [x for x in countnamelist if countnamelist[x] > 1]\n            if doublenames != []:\n                raise IpacFormatE('IPAC DBMS tables are not case sensitive. '\n                                  'This causes duplicate column names: {}'.format(doublenames))\n\n        for name in namelist:\n            m = re.match(r'\\w+', name)\n            if m.end() != len(name):\n                raise IpacFormatE('{} - Only alphanumeric characters and _ '\n                                  'are allowed in column names.'.format(name))\n            if self.DBMS and not(name[0].isalpha() or (name[0] == '_')):\n                raise IpacFormatE(f'Column name cannot start with numbers: {name}')\n            if self.DBMS:\n                if name in ['x', 'y', 'z', 'X', 'Y', 'Z']:\n                    raise IpacFormatE('{} - x, y, z, X, Y, Z are reserved names and '\n                                      'cannot be used as column names.'.format(name))\n                if len(name) > 16:\n                    raise IpacFormatE(\n                        f'{name} - Maximum length for column name is 16 characters')\n            else:\n                if len(name) > 40:\n                    raise IpacFormatE(\n                        f'{name} - Maximum length for column name is 40 characters.')\n\n        dtypelist = []\n        unitlist = []\n        nullist = []\n        for col in self.cols:\n            col_dtype = col.info.dtype\n            col_unit = col.info.unit\n            col_format = col.info.format\n\n            if col_dtype.kind in ['i', 'u']:\n                if col_dtype.itemsize <= 2:\n                    dtypelist.append('int')\n                else:\n                    dtypelist.append('long')\n            elif col_dtype.kind == 'f':\n                if col_dtype.itemsize <= 4:\n                    dtypelist.append('float')\n                else:\n                    dtypelist.append('double')\n            else:\n                dtypelist.append('char')\n\n            if col_unit is None:\n                unitlist.append('')\n            else:\n                unitlist.append(str(col.info.unit))\n            # This may be incompatible with mixin columns\n            null = col.fill_values[core.masked]\n            try:\n                auto_format_func = get_auto_format_func(col)\n                format_func = col.info._format_funcs.get(col_format, auto_format_func)\n                nullist.append((format_func(col_format, null)).strip())\n            except Exception:\n                # It is possible that null and the column values have different\n                # data types (e.g. number and null = 'null' (i.e. a string).\n                # This could cause all kinds of exceptions, so a catch all\n                # block is needed here\n                nullist.append(str(null).strip())\n\n        return [namelist, dtypelist, unitlist, nullist]\n\n    def write(self, lines, widths):\n        '''Write header.\n\n        The width of each column is determined in Ipac.write. Writing the header\n        must be delayed until that time.\n        This function is called from there, once the width information is\n        available.'''\n\n        for vals in self.str_vals():\n            lines.append(self.splitter.join(vals, widths))\n        return lines\n\n\nclass IpacDataSplitter(fixedwidth.FixedWidthSplitter):\n    delimiter = ' '\n    delimiter_pad = ''\n    bookend = True\n\n\nclass IpacData(fixedwidth.FixedWidthData):\n    \"\"\"IPAC table data reader\"\"\"\n    comment = r'[|\\\\]'\n    start_line = 0\n    splitter_class = IpacDataSplitter\n    fill_values = [(core.masked, 'null')]\n\n    def write(self, lines, widths, vals_list):\n        \"\"\" IPAC writer, modified from FixedWidth writer \"\"\"\n        for vals in vals_list:\n            lines.append(self.splitter.join(vals, widths))\n        return lines\n\n\nclass Ipac(basic.Basic):\n    r\"\"\"IPAC format table.\n\n    See: https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html\n\n    Example::\n\n      \\\\name=value\n      \\\\ Comment\n      |  column1 |   column2 | column3 | column4  |    column5    |\n      |  double  |   double  |   int   |   double |     char      |\n      |  unit    |   unit    |   unit  |    unit  |     unit      |\n      |  null    |   null    |   null  |    null  |     null      |\n       2.0978     29.09056    73765     2.06000    B8IVpMnHg\n\n    Or::\n\n      |-----ra---|----dec---|---sao---|------v---|----sptype--------|\n        2.09708   29.09056     73765   2.06000    B8IVpMnHg\n\n    The comments and keywords defined in the header are available via the output\n    table ``meta`` attribute::\n\n      >>> import os\n      >>> from astropy.io import ascii\n      >>> filename = os.path.join(ascii.__path__[0], 'tests/data/ipac.dat')\n      >>> data = ascii.read(filename)\n      >>> print(data.meta['comments'])\n      ['This is an example of a valid comment']\n      >>> for name, keyword in data.meta['keywords'].items():\n      ...     print(name, keyword['value'])\n      ...\n      intval 1\n      floatval 2300.0\n      date Wed Sp 20 09:48:36 1995\n      key_continue IPAC keywords can continue across lines\n\n    Note that there are different conventions for characters occurring below the\n    position of the ``|`` symbol in IPAC tables. By default, any character\n    below a ``|`` will be ignored (since this is the current standard),\n    but if you need to read files that assume characters below the ``|``\n    symbols belong to the column before or after the ``|``, you can specify\n    ``definition='left'`` or ``definition='right'`` respectively when reading\n    the table (the default is ``definition='ignore'``). The following examples\n    demonstrate the different conventions:\n\n    * ``definition='ignore'``::\n\n        |   ra  |  dec  |\n        | float | float |\n          1.2345  6.7890\n\n    * ``definition='left'``::\n\n        |   ra  |  dec  |\n        | float | float |\n           1.2345  6.7890\n\n    * ``definition='right'``::\n\n        |   ra  |  dec  |\n        | float | float |\n        1.2345  6.7890\n\n    IPAC tables can specify a null value in the header that is shown in place\n    of missing or bad data. On writing, this value defaults to ``null``.\n    To specify a different null value, use the ``fill_values`` option to\n    replace masked values with a string or number of your choice as\n    described in :ref:`astropy:io_ascii_write_parameters`::\n\n        >>> from astropy.io.ascii import masked\n        >>> fill = [(masked, 'N/A', 'ra'), (masked, -999, 'sptype')]\n        >>> ascii.write(data, format='ipac', fill_values=fill)\n        \\ This is an example of a valid comment\n        ...\n        |          ra|         dec|      sai|          v2|            sptype|\n        |      double|      double|     long|      double|              char|\n        |        unit|        unit|     unit|        unit|              ergs|\n        |         N/A|        null|     null|        null|              -999|\n                  N/A     29.09056      null         2.06               -999\n         2345678901.0 3456789012.0 456789012 4567890123.0 567890123456789012\n\n    When writing a table with a column of integers, the data type is output\n    as ``int`` when the column ``dtype.itemsize`` is less than or equal to 2;\n    otherwise the data type is ``long``. For a column of floating-point values,\n    the data type is ``float`` when ``dtype.itemsize`` is less than or equal\n    to 4; otherwise the data type is ``double``.\n\n    Parameters\n    ----------\n    definition : str, optional\n        Specify the convention for characters in the data table that occur\n        directly below the pipe (``|``) symbol in the header column definition:\n\n          * 'ignore' - Any character beneath a pipe symbol is ignored (default)\n          * 'right' - Character is associated with the column to the right\n          * 'left' - Character is associated with the column to the left\n\n    DBMS : bool, optional\n        If true, this verifies that written tables adhere (semantically)\n        to the `IPAC/DBMS\n        <https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/DBMSrestriction.html>`_\n        definition of IPAC tables. If 'False' it only checks for the (less strict)\n        `IPAC <https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html>`_\n        definition.\n    \"\"\"\n    _format_name = 'ipac'\n    _io_registry_format_aliases = ['ipac']\n    _io_registry_can_write = True\n    _description = 'IPAC format table'\n\n    data_class = IpacData\n    header_class = IpacHeader\n\n    def __init__(self, definition='ignore', DBMS=False):\n        super().__init__()\n        # Usually the header is not defined in __init__, but here it need a keyword\n        if definition in ['ignore', 'left', 'right']:\n            self.header.ipac_definition = definition\n        else:\n            raise ValueError(\"definition should be one of ignore/left/right\")\n        self.header.DBMS = DBMS\n\n    def write(self, table):\n        \"\"\"\n        Write ``table`` as list of strings.\n\n        Parameters\n        ----------\n        table : `~astropy.table.Table`\n            Input table data\n\n        Returns\n        -------\n        lines : list\n            List of strings corresponding to ASCII table\n\n        \"\"\"\n        # Set a default null value for all columns by adding at the end, which\n        # is the position with the lowest priority.\n        # We have to do it this late, because the fill_value\n        # defined in the class can be overwritten by ui.write\n        self.data.fill_values.append((core.masked, 'null'))\n\n        # Check column names before altering\n        self.header.cols = list(table.columns.values())\n        self.header.check_column_names(self.names, self.strict_names, self.guessing)\n\n        core._apply_include_exclude_names(table, self.names, self.include_names, self.exclude_names)\n\n        # Check that table has only 1-d columns.\n        self._check_multidim_table(table)\n\n        # Now use altered columns\n        new_cols = list(table.columns.values())\n        # link information about the columns to the writer object (i.e. self)\n        self.header.cols = new_cols\n        self.data.cols = new_cols\n\n        # Write header and data to lines list\n        lines = []\n        # Write meta information\n        if 'comments' in table.meta:\n            for comment in table.meta['comments']:\n                if len(str(comment)) > 78:\n                    warn('Comment string > 78 characters was automatically wrapped.',\n                         AstropyUserWarning)\n                for line in wrap(str(comment), 80, initial_indent='\\\\ ', subsequent_indent='\\\\ '):\n                    lines.append(line)\n        if 'keywords' in table.meta:\n            keydict = table.meta['keywords']\n            for keyword in keydict:\n                try:\n                    val = keydict[keyword]['value']\n                    lines.append(f'\\\\{keyword.strip()}={val!r}')\n                    # meta is not standardized: Catch some common Errors.\n                except TypeError:\n                    warn(\"Table metadata keyword {0} has been skipped.  \"\n                         \"IPAC metadata must be in the form {{'keywords':\"\n                         \"{{'keyword': {{'value': value}} }}\".format(keyword),\n                         AstropyUserWarning)\n        ignored_keys = [key for key in table.meta if key not in ('keywords', 'comments')]\n        if any(ignored_keys):\n            warn(\"Table metadata keyword(s) {0} were not written.  \"\n                 \"IPAC metadata must be in the form {{'keywords':\"\n                 \"{{'keyword': {{'value': value}} }}\".format(ignored_keys),\n                 AstropyUserWarning\n                 )\n\n        # Usually, this is done in data.write, but since the header is written\n        # first, we need that here.\n        self.data._set_fill_values(self.data.cols)\n\n        # get header and data as strings to find width of each column\n        for i, col in enumerate(table.columns.values()):\n            col.headwidth = max([len(vals[i]) for vals in self.header.str_vals()])\n        # keep data_str_vals because they take some time to make\n        data_str_vals = []\n        col_str_iters = self.data.str_vals()\n        for vals in zip(*col_str_iters):\n            data_str_vals.append(vals)\n\n        for i, col in enumerate(table.columns.values()):\n            # FIXME: In Python 3.4, use max([], default=0).\n            # See: https://docs.python.org/3/library/functions.html#max\n            if data_str_vals:\n                col.width = max([len(vals[i]) for vals in data_str_vals])\n            else:\n                col.width = 0\n\n        widths = [max(col.width, col.headwidth) for col in table.columns.values()]\n        # then write table\n        self.header.write(lines, widths)\n        self.data.write(lines, widths, data_str_vals)\n\n        return lines\n"},{"col":4,"comment":"\n        Compute the correction required to convert a radial velocity at a given\n        time and place on the Earth's Surface to a barycentric or heliocentric\n        velocity.\n\n        Parameters\n        ----------\n        kind : str\n            The kind of velocity correction.  Must be 'barycentric' or\n            'heliocentric'.\n        obstime : `~astropy.time.Time` or None, optional\n            The time at which to compute the correction.  If `None`, the\n            ``obstime`` frame attribute on the `SkyCoord` will be used.\n        location : `~astropy.coordinates.EarthLocation` or None, optional\n            The observer location at which to compute the correction.  If\n            `None`, the  ``location`` frame attribute on the passed-in\n            ``obstime`` will be used, and if that is None, the ``location``\n            frame attribute on the `SkyCoord` will be used.\n\n        Raises\n        ------\n        ValueError\n            If either ``obstime`` or ``location`` are passed in (not ``None``)\n            when the frame attribute is already set on this `SkyCoord`.\n        TypeError\n            If ``obstime`` or ``location`` aren't provided, either as arguments\n            or as frame attributes.\n\n        Returns\n        -------\n        vcorr : `~astropy.units.Quantity` ['speed']\n            The  correction with a positive sign.  I.e., *add* this\n            to an observed radial velocity to get the barycentric (or\n            heliocentric) velocity. If m/s precision or better is needed,\n            see the notes below.\n\n        Notes\n        -----\n        The barycentric correction is calculated to higher precision than the\n        heliocentric correction and includes additional physics (e.g time dilation).\n        Use barycentric corrections if m/s precision is required.\n\n        The algorithm here is sufficient to perform corrections at the mm/s level, but\n        care is needed in application. The barycentric correction returned uses the optical\n        approximation v = z * c. Strictly speaking, the barycentric correction is\n        multiplicative and should be applied as::\n\n          >>> from astropy.time import Time\n          >>> from astropy.coordinates import SkyCoord, EarthLocation\n          >>> from astropy.constants import c\n          >>> t = Time(56370.5, format='mjd', scale='utc')\n          >>> loc = EarthLocation('149d33m00.5s','-30d18m46.385s',236.87*u.m)\n          >>> sc = SkyCoord(1*u.deg, 2*u.deg)\n          >>> vcorr = sc.radial_velocity_correction(kind='barycentric', obstime=t, location=loc)  # doctest: +REMOTE_DATA\n          >>> rv = rv + vcorr + rv * vcorr / c  # doctest: +SKIP\n\n        Also note that this method returns the correction velocity in the so-called\n        *optical convention*::\n\n          >>> vcorr = zb * c  # doctest: +SKIP\n\n        where ``zb`` is the barycentric correction redshift as defined in section 3\n        of Wright & Eastman (2014). The application formula given above follows from their\n        equation (11) under assumption that the radial velocity ``rv`` has also been defined\n        using the same optical convention. Note, this can be regarded as a matter of\n        velocity definition and does not by itself imply any loss of accuracy, provided\n        sufficient care has been taken during interpretation of the results. If you need\n        the barycentric correction expressed as the full relativistic velocity (e.g., to provide\n        it as the input to another software which performs the application), the\n        following recipe can be used::\n\n          >>> zb = vcorr / c  # doctest: +REMOTE_DATA\n          >>> zb_plus_one_squared = (zb + 1) ** 2  # doctest: +REMOTE_DATA\n          >>> vcorr_rel = c * (zb_plus_one_squared - 1) / (zb_plus_one_squared + 1)  # doctest: +REMOTE_DATA\n\n        or alternatively using just equivalencies::\n\n          >>> vcorr_rel = vcorr.to(u.Hz, u.doppler_optical(1*u.Hz)).to(vcorr.unit, u.doppler_relativistic(1*u.Hz))  # doctest: +REMOTE_DATA\n\n        See also `~astropy.units.equivalencies.doppler_optical`,\n        `~astropy.units.equivalencies.doppler_radio`, and\n        `~astropy.units.equivalencies.doppler_relativistic` for more information on\n        the velocity conventions.\n\n        The default is for this method to use the builtin ephemeris for\n        computing the sun and earth location.  Other ephemerides can be chosen\n        by setting the `~astropy.coordinates.solar_system_ephemeris` variable,\n        either directly or via ``with`` statement.  For example, to use the JPL\n        ephemeris, do::\n\n          >>> from astropy.coordinates import solar_system_ephemeris\n          >>> sc = SkyCoord(1*u.deg, 2*u.deg)\n          >>> with solar_system_ephemeris.set('jpl'):  # doctest: +REMOTE_DATA\n          ...     rv += sc.radial_velocity_correction(obstime=t, location=loc)  # doctest: +SKIP\n\n        ","endLoc":1983,"header":"def radial_velocity_correction(self, kind='barycentric', obstime=None,\n                                   location=None)","id":5403,"name":"radial_velocity_correction","nodeType":"Function","startLoc":1778,"text":"def radial_velocity_correction(self, kind='barycentric', obstime=None,\n                                   location=None):\n        \"\"\"\n        Compute the correction required to convert a radial velocity at a given\n        time and place on the Earth's Surface to a barycentric or heliocentric\n        velocity.\n\n        Parameters\n        ----------\n        kind : str\n            The kind of velocity correction.  Must be 'barycentric' or\n            'heliocentric'.\n        obstime : `~astropy.time.Time` or None, optional\n            The time at which to compute the correction.  If `None`, the\n            ``obstime`` frame attribute on the `SkyCoord` will be used.\n        location : `~astropy.coordinates.EarthLocation` or None, optional\n            The observer location at which to compute the correction.  If\n            `None`, the  ``location`` frame attribute on the passed-in\n            ``obstime`` will be used, and if that is None, the ``location``\n            frame attribute on the `SkyCoord` will be used.\n\n        Raises\n        ------\n        ValueError\n            If either ``obstime`` or ``location`` are passed in (not ``None``)\n            when the frame attribute is already set on this `SkyCoord`.\n        TypeError\n            If ``obstime`` or ``location`` aren't provided, either as arguments\n            or as frame attributes.\n\n        Returns\n        -------\n        vcorr : `~astropy.units.Quantity` ['speed']\n            The  correction with a positive sign.  I.e., *add* this\n            to an observed radial velocity to get the barycentric (or\n            heliocentric) velocity. If m/s precision or better is needed,\n            see the notes below.\n\n        Notes\n        -----\n        The barycentric correction is calculated to higher precision than the\n        heliocentric correction and includes additional physics (e.g time dilation).\n        Use barycentric corrections if m/s precision is required.\n\n        The algorithm here is sufficient to perform corrections at the mm/s level, but\n        care is needed in application. The barycentric correction returned uses the optical\n        approximation v = z * c. Strictly speaking, the barycentric correction is\n        multiplicative and should be applied as::\n\n          >>> from astropy.time import Time\n          >>> from astropy.coordinates import SkyCoord, EarthLocation\n          >>> from astropy.constants import c\n          >>> t = Time(56370.5, format='mjd', scale='utc')\n          >>> loc = EarthLocation('149d33m00.5s','-30d18m46.385s',236.87*u.m)\n          >>> sc = SkyCoord(1*u.deg, 2*u.deg)\n          >>> vcorr = sc.radial_velocity_correction(kind='barycentric', obstime=t, location=loc)  # doctest: +REMOTE_DATA\n          >>> rv = rv + vcorr + rv * vcorr / c  # doctest: +SKIP\n\n        Also note that this method returns the correction velocity in the so-called\n        *optical convention*::\n\n          >>> vcorr = zb * c  # doctest: +SKIP\n\n        where ``zb`` is the barycentric correction redshift as defined in section 3\n        of Wright & Eastman (2014). The application formula given above follows from their\n        equation (11) under assumption that the radial velocity ``rv`` has also been defined\n        using the same optical convention. Note, this can be regarded as a matter of\n        velocity definition and does not by itself imply any loss of accuracy, provided\n        sufficient care has been taken during interpretation of the results. If you need\n        the barycentric correction expressed as the full relativistic velocity (e.g., to provide\n        it as the input to another software which performs the application), the\n        following recipe can be used::\n\n          >>> zb = vcorr / c  # doctest: +REMOTE_DATA\n          >>> zb_plus_one_squared = (zb + 1) ** 2  # doctest: +REMOTE_DATA\n          >>> vcorr_rel = c * (zb_plus_one_squared - 1) / (zb_plus_one_squared + 1)  # doctest: +REMOTE_DATA\n\n        or alternatively using just equivalencies::\n\n          >>> vcorr_rel = vcorr.to(u.Hz, u.doppler_optical(1*u.Hz)).to(vcorr.unit, u.doppler_relativistic(1*u.Hz))  # doctest: +REMOTE_DATA\n\n        See also `~astropy.units.equivalencies.doppler_optical`,\n        `~astropy.units.equivalencies.doppler_radio`, and\n        `~astropy.units.equivalencies.doppler_relativistic` for more information on\n        the velocity conventions.\n\n        The default is for this method to use the builtin ephemeris for\n        computing the sun and earth location.  Other ephemerides can be chosen\n        by setting the `~astropy.coordinates.solar_system_ephemeris` variable,\n        either directly or via ``with`` statement.  For example, to use the JPL\n        ephemeris, do::\n\n          >>> from astropy.coordinates import solar_system_ephemeris\n          >>> sc = SkyCoord(1*u.deg, 2*u.deg)\n          >>> with solar_system_ephemeris.set('jpl'):  # doctest: +REMOTE_DATA\n          ...     rv += sc.radial_velocity_correction(obstime=t, location=loc)  # doctest: +SKIP\n\n        \"\"\"\n        # has to be here to prevent circular imports\n        from .solar_system import get_body_barycentric_posvel\n\n        # location validation\n        timeloc = getattr(obstime, 'location', None)\n        if location is None:\n            if self.location is not None:\n                location = self.location\n                if timeloc is not None:\n                    raise ValueError('`location` cannot be in both the '\n                                     'passed-in `obstime` and this `SkyCoord` '\n                                     'because it is ambiguous which is meant '\n                                     'for the radial_velocity_correction.')\n            elif timeloc is not None:\n                location = timeloc\n            else:\n                raise TypeError('Must provide a `location` to '\n                                'radial_velocity_correction, either as a '\n                                'SkyCoord frame attribute, as an attribute on '\n                                'the passed in `obstime`, or in the method '\n                                'call.')\n\n        elif self.location is not None or timeloc is not None:\n            raise ValueError('Cannot compute radial velocity correction if '\n                             '`location` argument is passed in and there is '\n                             'also a  `location` attribute on this SkyCoord or '\n                             'the passed-in `obstime`.')\n\n        # obstime validation\n        coo_at_rv_obstime = self  # assume we need no space motion for now\n        if obstime is None:\n            obstime = self.obstime\n            if obstime is None:\n                raise TypeError('Must provide an `obstime` to '\n                                'radial_velocity_correction, either as a '\n                                'SkyCoord frame attribute or in the method '\n                                'call.')\n        elif self.obstime is not None and self.frame.data.differentials:\n            # we do need space motion after all\n            coo_at_rv_obstime = self.apply_space_motion(obstime)\n        elif self.obstime is None:\n            # warn the user if the object has differentials set\n            if 's' in self.data.differentials:\n                warnings.warn(\n                    \"SkyCoord has space motion, and therefore the specified \"\n                    \"position of the SkyCoord may not be the same as \"\n                    \"the `obstime` for the radial velocity measurement. \"\n                    \"This may affect the rv correction at the order of km/s\"\n                    \"for very high proper motions sources. If you wish to \"\n                    \"apply space motion of the SkyCoord to correct for this\"\n                    \"the `obstime` attribute of the SkyCoord must be set\",\n                    AstropyUserWarning\n                )\n\n        pos_earth, v_earth = get_body_barycentric_posvel('earth', obstime)\n        if kind == 'barycentric':\n            v_origin_to_earth = v_earth\n        elif kind == 'heliocentric':\n            v_sun = get_body_barycentric_posvel('sun', obstime)[1]\n            v_origin_to_earth = v_earth - v_sun\n        else:\n            raise ValueError(\"`kind` argument to radial_velocity_correction must \"\n                             \"be 'barycentric' or 'heliocentric', but got \"\n                             \"'{}'\".format(kind))\n\n        gcrs_p, gcrs_v = location.get_gcrs_posvel(obstime)\n        # transforming to GCRS is not the correct thing to do here, since we don't want to\n        # include aberration (or light deflection)? Instead, only apply parallax if necessary\n        icrs_cart = coo_at_rv_obstime.icrs.cartesian\n        icrs_cart_novel = icrs_cart.without_differentials()\n        if self.data.__class__ is UnitSphericalRepresentation:\n            targcart = icrs_cart_novel\n        else:\n            # skycoord has distances so apply parallax\n            obs_icrs_cart = pos_earth + gcrs_p\n            targcart = icrs_cart_novel - obs_icrs_cart\n            targcart /= targcart.norm()\n\n        if kind == 'barycentric':\n            beta_obs = (v_origin_to_earth + gcrs_v) / speed_of_light\n            gamma_obs = 1 / np.sqrt(1 - beta_obs.norm()**2)\n            gr = location.gravitational_redshift(obstime)\n            # barycentric redshift according to eq 28 in Wright & Eastmann (2014),\n            # neglecting Shapiro delay and effects of the star's own motion\n            zb = gamma_obs * (1 + beta_obs.dot(targcart)) / (1 + gr/speed_of_light)\n            # try and get terms corresponding to stellar motion.\n            if icrs_cart.differentials:\n                try:\n                    ro = self.icrs.cartesian\n                    beta_star = ro.differentials['s'].to_cartesian() / speed_of_light\n                    # ICRS unit vector at coordinate epoch\n                    ro = ro.without_differentials()\n                    ro /= ro.norm()\n                    zb *= (1 + beta_star.dot(ro)) / (1 + beta_star.dot(targcart))\n                except u.UnitConversionError:\n                    warnings.warn(\"SkyCoord contains some velocity information, but not enough to \"\n                                  \"calculate the full space motion of the source, and so this has \"\n                                  \"been ignored for the purposes of calculating the radial velocity \"\n                                  \"correction. This can lead to errors on the order of metres/second.\",\n                                  AstropyUserWarning)\n\n            zb = zb - 1\n            return zb * speed_of_light\n        else:\n            # do a simpler correction ignoring time dilation and gravitational redshift\n            # this is adequate since Heliocentric corrections shouldn't be used if\n            # cm/s precision is required.\n            return targcart.dot(v_origin_to_earth + gcrs_v)"},{"col":0,"comment":"\n    Return a wrapped ``auto_format_func`` function which is used in\n    formatting table columns.  This is primarily an internal function but\n    gets used directly in other parts of astropy, e.g. `astropy.io.ascii`.\n\n    Parameters\n    ----------\n    col_name : object, optional\n        Hashable object to identify column like id or name. Default is None.\n\n    possible_string_format_functions : func, optional\n        Function that yields possible string formatting functions\n        (defaults to internal function to do this).\n\n    Returns\n    -------\n    Wrapped ``auto_format_func`` function\n    ","endLoc":136,"header":"def get_auto_format_func(\n        col=None,\n        possible_string_format_functions=_possible_string_format_functions)","id":5404,"name":"get_auto_format_func","nodeType":"Function","startLoc":47,"text":"def get_auto_format_func(\n        col=None,\n        possible_string_format_functions=_possible_string_format_functions):\n    \"\"\"\n    Return a wrapped ``auto_format_func`` function which is used in\n    formatting table columns.  This is primarily an internal function but\n    gets used directly in other parts of astropy, e.g. `astropy.io.ascii`.\n\n    Parameters\n    ----------\n    col_name : object, optional\n        Hashable object to identify column like id or name. Default is None.\n\n    possible_string_format_functions : func, optional\n        Function that yields possible string formatting functions\n        (defaults to internal function to do this).\n\n    Returns\n    -------\n    Wrapped ``auto_format_func`` function\n    \"\"\"\n\n    def _auto_format_func(format_, val):\n        \"\"\"Format ``val`` according to ``format_`` for a plain format specifier,\n        old- or new-style format strings, or using a user supplied function.\n        More importantly, determine and cache (in _format_funcs) a function\n        that will do this subsequently.  In this way this complicated logic is\n        only done for the first value.\n\n        Returns the formatted value.\n        \"\"\"\n        if format_ is None:\n            return default_format_func(format_, val)\n\n        if format_ in col.info._format_funcs:\n            return col.info._format_funcs[format_](format_, val)\n\n        if callable(format_):\n            format_func = lambda format_, val: format_(val)  # noqa\n            try:\n                out = format_func(format_, val)\n                if not isinstance(out, str):\n                    raise ValueError('Format function for value {} returned {} '\n                                     'instead of string type'\n                                     .format(val, type(val)))\n            except Exception as err:\n                # For a masked element, the format function call likely failed\n                # to handle it.  Just return the string representation for now,\n                # and retry when a non-masked value comes along.\n                if val is np.ma.masked:\n                    return str(val)\n\n                raise ValueError(f'Format function for value {val} failed.') from err\n            # If the user-supplied function handles formatting masked elements, use\n            # it directly.  Otherwise, wrap it in a function that traps them.\n            try:\n                format_func(format_, np.ma.masked)\n            except Exception:\n                format_func = _use_str_for_masked_values(format_func)\n        else:\n            # For a masked element, we cannot set string-based format functions yet,\n            # as all tests below will fail.  Just return the string representation\n            # of masked for now, and retry when a non-masked value comes along.\n            if val is np.ma.masked:\n                return str(val)\n\n            for format_func in possible_string_format_functions(format_):\n                try:\n                    # Does this string format method work?\n                    out = format_func(format_, val)\n                    # Require that the format statement actually did something.\n                    if out == format_:\n                        raise ValueError('the format passed in did nothing.')\n                except Exception:\n                    continue\n                else:\n                    break\n            else:\n                # None of the possible string functions passed muster.\n                raise ValueError('unable to parse format string {} for its '\n                                 'column.'.format(format_))\n\n            # String-based format functions will fail on masked elements;\n            # wrap them in a function that traps them.\n            format_func = _use_str_for_masked_values(format_func)\n\n        col.info._format_funcs[format_] = format_func\n        return out\n\n    return _auto_format_func"},{"attributeType":"null","col":8,"comment":"null","endLoc":621,"id":5405,"name":"delimiter","nodeType":"Attribute","startLoc":621,"text":"self.delimiter"},{"col":0,"comment":"Calculate the barycentric position and velocity of a solar system body.\n\n    Parameters\n    ----------\n    body : str or list of tuple\n        The solar system body for which to calculate positions.  Can also be a\n        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL\n        kernel.\n    time : `~astropy.time.Time`\n        Time of observation.\n    ephemeris : str, optional\n        Ephemeris to use.  By default, use the one set with\n        ``astropy.coordinates.solar_system_ephemeris.set``\n\n    Returns\n    -------\n    position, velocity : tuple of `~astropy.coordinates.CartesianRepresentation`\n        Tuple of barycentric (ICRS) position and velocity.\n\n    See also\n    --------\n    get_body_barycentric : to calculate position only.\n        This is faster by about a factor two for JPL kernels, but has no\n        speed advantage for the built-in ephemeris.\n\n    Notes\n    -----\n    {_EPHEMERIS_NOTE}\n    ","endLoc":341,"header":"def get_body_barycentric_posvel(body, time, ephemeris=None)","id":5406,"name":"get_body_barycentric_posvel","nodeType":"Function","startLoc":311,"text":"def get_body_barycentric_posvel(body, time, ephemeris=None):\n    \"\"\"Calculate the barycentric position and velocity of a solar system body.\n\n    Parameters\n    ----------\n    body : str or list of tuple\n        The solar system body for which to calculate positions.  Can also be a\n        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL\n        kernel.\n    time : `~astropy.time.Time`\n        Time of observation.\n    ephemeris : str, optional\n        Ephemeris to use.  By default, use the one set with\n        ``astropy.coordinates.solar_system_ephemeris.set``\n\n    Returns\n    -------\n    position, velocity : tuple of `~astropy.coordinates.CartesianRepresentation`\n        Tuple of barycentric (ICRS) position and velocity.\n\n    See also\n    --------\n    get_body_barycentric : to calculate position only.\n        This is faster by about a factor two for JPL kernels, but has no\n        speed advantage for the built-in ephemeris.\n\n    Notes\n    -----\n    {_EPHEMERIS_NOTE}\n    \"\"\"\n    return _get_body_barycentric_posvel(body, time, ephemeris)"},{"attributeType":"null","col":8,"comment":"null","endLoc":618,"id":5407,"name":"table_id","nodeType":"Attribute","startLoc":618,"text":"self.table_id"},{"col":4,"comment":"\n        Override the default writing behavior in `FastBasic` to\n        output a line with column types after the column name line.\n        ","endLoc":390,"header":"def write(self, table, output)","id":5408,"name":"write","nodeType":"Function","startLoc":385,"text":"def write(self, table, output):\n        \"\"\"\n        Override the default writing behavior in `FastBasic` to\n        output a line with column types after the column name line.\n        \"\"\"\n        self._write(table, output, {}, output_types=True)"},{"attributeType":"null","col":8,"comment":"null","endLoc":624,"id":5409,"name":"lines","nodeType":"Attribute","startLoc":624,"text":"self.lines"},{"col":0,"comment":"null","endLoc":21,"header":"def default_format_func(format_, val)","id":5410,"name":"default_format_func","nodeType":"Function","startLoc":17,"text":"def default_format_func(format_, val):\n    if isinstance(val, bytes):\n        return val.decode('utf-8', errors='replace')\n    else:\n        return str(val)"},{"col":4,"comment":"\n        A convenience method to create and return a new `SkyCoord` from the data\n        in an astropy Table.\n\n        This method matches table columns that start with the case-insensitive\n        names of the the components of the requested frames (including\n        differentials), if they are also followed by a non-alphanumeric\n        character. It will also match columns that *end* with the component name\n        if a non-alphanumeric character is *before* it.\n\n        For example, the first rule means columns with names like\n        ``'RA[J2000]'`` or ``'ra'`` will be interpreted as ``ra`` attributes for\n        `~astropy.coordinates.ICRS` frames, but ``'RAJ2000'`` or ``'radius'``\n        are *not*. Similarly, the second rule applied to the\n        `~astropy.coordinates.Galactic` frame means that a column named\n        ``'gal_l'`` will be used as the the ``l`` component, but ``gall`` or\n        ``'fill'`` will not.\n\n        The definition of alphanumeric here is based on Unicode's definition\n        of alphanumeric, except without ``_`` (which is normally considered\n        alphanumeric).  So for ASCII, this means the non-alphanumeric characters\n        are ``<space>_!\"#$%&'()*+,-./\\:;<=>?@[]^`{|}~``).\n\n        Parameters\n        ----------\n        table : `~astropy.table.Table` or subclass\n            The table to load data from.\n        **coord_kwargs\n            Any additional keyword arguments are passed directly to this class's\n            constructor.\n\n        Returns\n        -------\n        newsc : `~astropy.coordinates.SkyCoord` or subclass\n            The new `SkyCoord` (or subclass) object.\n\n        Raises\n        ------\n        ValueError\n            If more than one match is found in the table for a component,\n            unless the additional matches are also valid frame component names.\n            If a \"coord_kwargs\" is provided for a value also found in the table.\n\n        ","endLoc":2086,"header":"@classmethod\n    def guess_from_table(cls, table, **coord_kwargs)","id":5411,"name":"guess_from_table","nodeType":"Function","startLoc":1986,"text":"@classmethod\n    def guess_from_table(cls, table, **coord_kwargs):\n        r\"\"\"\n        A convenience method to create and return a new `SkyCoord` from the data\n        in an astropy Table.\n\n        This method matches table columns that start with the case-insensitive\n        names of the the components of the requested frames (including\n        differentials), if they are also followed by a non-alphanumeric\n        character. It will also match columns that *end* with the component name\n        if a non-alphanumeric character is *before* it.\n\n        For example, the first rule means columns with names like\n        ``'RA[J2000]'`` or ``'ra'`` will be interpreted as ``ra`` attributes for\n        `~astropy.coordinates.ICRS` frames, but ``'RAJ2000'`` or ``'radius'``\n        are *not*. Similarly, the second rule applied to the\n        `~astropy.coordinates.Galactic` frame means that a column named\n        ``'gal_l'`` will be used as the the ``l`` component, but ``gall`` or\n        ``'fill'`` will not.\n\n        The definition of alphanumeric here is based on Unicode's definition\n        of alphanumeric, except without ``_`` (which is normally considered\n        alphanumeric).  So for ASCII, this means the non-alphanumeric characters\n        are ``<space>_!\"#$%&'()*+,-./\\:;<=>?@[]^`{|}~``).\n\n        Parameters\n        ----------\n        table : `~astropy.table.Table` or subclass\n            The table to load data from.\n        **coord_kwargs\n            Any additional keyword arguments are passed directly to this class's\n            constructor.\n\n        Returns\n        -------\n        newsc : `~astropy.coordinates.SkyCoord` or subclass\n            The new `SkyCoord` (or subclass) object.\n\n        Raises\n        ------\n        ValueError\n            If more than one match is found in the table for a component,\n            unless the additional matches are also valid frame component names.\n            If a \"coord_kwargs\" is provided for a value also found in the table.\n\n        \"\"\"\n        _frame_cls, _frame_kwargs = _get_frame_without_data([], coord_kwargs)\n        frame = _frame_cls(**_frame_kwargs)\n        coord_kwargs['frame'] = coord_kwargs.get('frame', frame)\n\n        representation_component_names = (\n            set(frame.get_representation_component_names())\n            .union(set(frame.get_representation_component_names(\"s\")))\n        )\n\n        comp_kwargs = {}\n        for comp_name in representation_component_names:\n            # this matches things like 'ra[...]'' but *not* 'rad'.\n            # note that the \"_\" must be in there explicitly, because\n            # \"alphanumeric\" usually includes underscores.\n            starts_with_comp = comp_name + r'(\\W|\\b|_)'\n            # this part matches stuff like 'center_ra', but *not*\n            # 'aura'\n            ends_with_comp = r'.*(\\W|\\b|_)' + comp_name + r'\\b'\n            # the final regex ORs together the two patterns\n            rex = re.compile(rf\"({starts_with_comp})|({ends_with_comp})\",\n                             re.IGNORECASE | re.UNICODE)\n\n            # find all matches\n            matches = {col_name for col_name in table.colnames\n                       if rex.match(col_name)}\n\n            # now need to select among matches, also making sure we don't have\n            # an exact match with another component\n            if len(matches) == 0:  # no matches\n                continue\n            elif len(matches) == 1:  # only one match\n                col_name = matches.pop()\n            else:  # more than 1 match\n                # try to sieve out other components\n                matches -= representation_component_names - {comp_name}\n                # if there's only one remaining match, it worked.\n                if len(matches) == 1:\n                    col_name = matches.pop()\n                else:\n                    raise ValueError(\n                        'Found at least two matches for component '\n                        f'\"{comp_name}\": \"{matches}\". Cannot guess coordinates '\n                        'from a table with this ambiguity.')\n\n            comp_kwargs[comp_name] = table[col_name]\n\n        for k, v in comp_kwargs.items():\n            if k in coord_kwargs:\n                raise ValueError('Found column \"{}\" in table, but it was '\n                                 'already provided as \"{}\" keyword to '\n                                 'guess_from_table function.'.format(v.name, k))\n            else:\n                coord_kwargs[k] = v\n\n        return cls(**coord_kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":432,"id":5412,"name":"_format_name","nodeType":"Attribute","startLoc":432,"text":"_format_name"},{"col":26,"endLoc":85,"id":5413,"nodeType":"Lambda","startLoc":85,"text":"lambda format_, val: format_(val)"},{"attributeType":"null","col":8,"comment":"null","endLoc":620,"id":5414,"name":"err_specs","nodeType":"Attribute","startLoc":620,"text":"self.err_specs"},{"col":0,"comment":"Wrap format function to trap masked values.\n\n    String format functions and most user functions will not be able to deal\n    with masked values, so we wrap them to ensure they are passed to str().\n    ","endLoc":33,"header":"def _use_str_for_masked_values(format_func)","id":5415,"name":"_use_str_for_masked_values","nodeType":"Function","startLoc":26,"text":"def _use_str_for_masked_values(format_func):\n    \"\"\"Wrap format function to trap masked values.\n\n    String format functions and most user functions will not be able to deal\n    with masked values, so we wrap them to ensure they are passed to str().\n    \"\"\"\n    return lambda format_, val: (str(val) if val is np.ma.masked\n                                 else format_func(format_, val))"},{"col":11,"endLoc":33,"id":5416,"nodeType":"Lambda","startLoc":32,"text":"lambda format_, val: (str(val) if val is np.ma.masked\n                                 else format_func(format_, val))"},{"className":"IpacFormatErrorDBMS","col":0,"comment":"null","endLoc":29,"id":5417,"nodeType":"Class","startLoc":25,"text":"class IpacFormatErrorDBMS(Exception):\n    def __str__(self):\n        return '{}\\nSee {}'.format(\n            super().__str__(),\n            'https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/DBMSrestriction.html')"},{"col":4,"comment":"null","endLoc":29,"header":"def __str__(self)","id":5418,"name":"__str__","nodeType":"Function","startLoc":26,"text":"def __str__(self):\n        return '{}\\nSee {}'.format(\n            super().__str__(),\n            'https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/DBMSrestriction.html')"},{"attributeType":"null","col":16,"comment":"null","endLoc":10,"id":5419,"name":"np","nodeType":"Attribute","startLoc":10,"text":"np"},{"col":4,"comment":"\n        Given a name, query the CDS name resolver to attempt to retrieve\n        coordinate information for that object. The search database, sesame\n        url, and  query timeout can be set through configuration items in\n        ``astropy.coordinates.name_resolve`` -- see docstring for\n        `~astropy.coordinates.get_icrs_coordinates` for more\n        information.\n\n        Parameters\n        ----------\n        name : str\n            The name of the object to get coordinates for, e.g. ``'M42'``.\n        frame : str or `BaseCoordinateFrame` class or instance\n            The frame to transform the object to.\n        parse: bool\n            Whether to attempt extracting the coordinates from the name by\n            parsing with a regex. For objects catalog names that have\n            J-coordinates embedded in their names, e.g.,\n            'CRTS SSS100805 J194428-420209', this may be much faster than a\n            Sesame query for the same object name. The coordinates extracted\n            in this way may differ from the database coordinates by a few\n            deci-arcseconds, so only use this option if you do not need\n            sub-arcsecond accuracy for coordinates.\n        cache : bool, optional\n            Determines whether to cache the results or not. To update or\n            overwrite an existing value, pass ``cache='update'``.\n\n        Returns\n        -------\n        coord : SkyCoord\n            Instance of the SkyCoord class.\n        ","endLoc":2131,"header":"@classmethod\n    def from_name(cls, name, frame='icrs', parse=False, cache=True)","id":5420,"name":"from_name","nodeType":"Function","startLoc":2089,"text":"@classmethod\n    def from_name(cls, name, frame='icrs', parse=False, cache=True):\n        \"\"\"\n        Given a name, query the CDS name resolver to attempt to retrieve\n        coordinate information for that object. The search database, sesame\n        url, and  query timeout can be set through configuration items in\n        ``astropy.coordinates.name_resolve`` -- see docstring for\n        `~astropy.coordinates.get_icrs_coordinates` for more\n        information.\n\n        Parameters\n        ----------\n        name : str\n            The name of the object to get coordinates for, e.g. ``'M42'``.\n        frame : str or `BaseCoordinateFrame` class or instance\n            The frame to transform the object to.\n        parse: bool\n            Whether to attempt extracting the coordinates from the name by\n            parsing with a regex. For objects catalog names that have\n            J-coordinates embedded in their names, e.g.,\n            'CRTS SSS100805 J194428-420209', this may be much faster than a\n            Sesame query for the same object name. The coordinates extracted\n            in this way may differ from the database coordinates by a few\n            deci-arcseconds, so only use this option if you do not need\n            sub-arcsecond accuracy for coordinates.\n        cache : bool, optional\n            Determines whether to cache the results or not. To update or\n            overwrite an existing value, pass ``cache='update'``.\n\n        Returns\n        -------\n        coord : SkyCoord\n            Instance of the SkyCoord class.\n        \"\"\"\n\n        from .name_resolve import get_icrs_coordinates\n\n        icrs_coord = get_icrs_coordinates(name, parse, cache=cache)\n        icrs_sky_coord = cls(icrs_coord)\n        if frame in ('icrs', icrs_coord.__class__):\n            return icrs_sky_coord\n        else:\n            return icrs_sky_coord.transform_to(frame)"},{"col":0,"comment":"","endLoc":6,"header":"qdp.py#<anonymous>","id":5421,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis package contains functions for reading and writing QDP tables that are\nnot meant to be used directly, but instead are available as readers/writers in\n`astropy.table`. See :ref:`astropy:table_io` for more details.\n\"\"\""},{"className":"IpacFormatError","col":0,"comment":"null","endLoc":36,"id":5422,"nodeType":"Class","startLoc":32,"text":"class IpacFormatError(Exception):\n    def __str__(self):\n        return '{}\\nSee {}'.format(\n            super().__str__(),\n            'https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html')"},{"col":4,"comment":"null","endLoc":36,"header":"def __str__(self)","id":5423,"name":"__str__","nodeType":"Function","startLoc":33,"text":"def __str__(self):\n        return '{}\\nSee {}'.format(\n            super().__str__(),\n            'https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html')"},{"col":0,"comment":"\n    Retrieve an ICRS object by using an online name resolving service to\n    retrieve coordinates for the specified name. By default, this will\n    search all available databases until a match is found. If you would like\n    to specify the database, use the science state\n    ``astropy.coordinates.name_resolve.sesame_database``. You can also\n    specify a list of servers to use for querying Sesame using the science\n    state ``astropy.coordinates.name_resolve.sesame_url``. This will try\n    each one in order until a valid response is returned. By default, this\n    list includes the main Sesame host and a mirror at vizier.  The\n    configuration item `astropy.utils.data.Conf.remote_timeout` controls the\n    number of seconds to wait for a response from the server before giving\n    up.\n\n    Parameters\n    ----------\n    name : str\n        The name of the object to get coordinates for, e.g. ``'M42'``.\n    parse : bool\n        Whether to attempt extracting the coordinates from the name by\n        parsing with a regex. For objects catalog names that have\n        J-coordinates embedded in their names eg:\n        'CRTS SSS100805 J194428-420209', this may be much faster than a\n        sesame query for the same object name. The coordinates extracted\n        in this way may differ from the database coordinates by a few\n        deci-arcseconds, so only use this option if you do not need\n        sub-arcsecond accuracy for coordinates.\n    cache : bool, str, optional\n        Determines whether to cache the results or not. Passed through to\n        `~astropy.utils.data.download_file`, so pass \"update\" to update the\n        cached value.\n\n    Returns\n    -------\n    coord : `astropy.coordinates.ICRS` object\n        The object's coordinates in the ICRS frame.\n\n    ","endLoc":198,"header":"def get_icrs_coordinates(name, parse=False, cache=False)","id":5424,"name":"get_icrs_coordinates","nodeType":"Function","startLoc":90,"text":"def get_icrs_coordinates(name, parse=False, cache=False):\n    \"\"\"\n    Retrieve an ICRS object by using an online name resolving service to\n    retrieve coordinates for the specified name. By default, this will\n    search all available databases until a match is found. If you would like\n    to specify the database, use the science state\n    ``astropy.coordinates.name_resolve.sesame_database``. You can also\n    specify a list of servers to use for querying Sesame using the science\n    state ``astropy.coordinates.name_resolve.sesame_url``. This will try\n    each one in order until a valid response is returned. By default, this\n    list includes the main Sesame host and a mirror at vizier.  The\n    configuration item `astropy.utils.data.Conf.remote_timeout` controls the\n    number of seconds to wait for a response from the server before giving\n    up.\n\n    Parameters\n    ----------\n    name : str\n        The name of the object to get coordinates for, e.g. ``'M42'``.\n    parse : bool\n        Whether to attempt extracting the coordinates from the name by\n        parsing with a regex. For objects catalog names that have\n        J-coordinates embedded in their names eg:\n        'CRTS SSS100805 J194428-420209', this may be much faster than a\n        sesame query for the same object name. The coordinates extracted\n        in this way may differ from the database coordinates by a few\n        deci-arcseconds, so only use this option if you do not need\n        sub-arcsecond accuracy for coordinates.\n    cache : bool, str, optional\n        Determines whether to cache the results or not. Passed through to\n        `~astropy.utils.data.download_file`, so pass \"update\" to update the\n        cached value.\n\n    Returns\n    -------\n    coord : `astropy.coordinates.ICRS` object\n        The object's coordinates in the ICRS frame.\n\n    \"\"\"\n\n    # if requested, first try extract coordinates embedded in the object name.\n    # Do this first since it may be much faster than doing the sesame query\n    if parse:\n        from . import jparser\n        if jparser.search(name):\n            return jparser.to_skycoord(name)\n        else:\n            # if the parser failed, fall back to sesame query.\n            pass\n            # maybe emit a warning instead of silently falling back to sesame?\n\n    database = sesame_database.get()\n    # The web API just takes the first letter of the database name\n    db = database.upper()[0]\n\n    # Make sure we don't have duplicates in the url list\n    urls = []\n    domains = []\n    for url in sesame_url.get():\n        domain = urllib.parse.urlparse(url).netloc\n\n        # Check for duplicates\n        if domain not in domains:\n            domains.append(domain)\n\n            # Add the query to the end of the url, add to url list\n            fmt_url = os.path.join(url, \"{db}?{name}\")\n            fmt_url = fmt_url.format(name=urllib.parse.quote(name), db=db)\n            urls.append(fmt_url)\n\n    exceptions = []\n    for url in urls:\n        try:\n            resp_data = get_file_contents(\n                download_file(url, cache=cache, show_progress=False))\n            break\n        except urllib.error.URLError as e:\n            exceptions.append(e)\n            continue\n        except socket.timeout as e:\n            # There are some cases where urllib2 does not catch socket.timeout\n            # especially while receiving response data on an already previously\n            # working request\n            e.reason = (\"Request took longer than the allowed \"\n                        f\"{data.conf.remote_timeout:.1f} seconds\")\n            exceptions.append(e)\n            continue\n\n    # All Sesame URL's failed...\n    else:\n        messages = [f\"{url}: {e.reason}\"\n                    for url, e in zip(urls, exceptions)]\n        raise NameResolveError(\"All Sesame queries failed. Unable to \"\n                               \"retrieve coordinates. See errors per URL \"\n                               f\"below: \\n {os.linesep.join(messages)}\")\n\n    ra, dec = _parse_response(resp_data)\n\n    if ra is None or dec is None:\n        if db == \"A\":\n            err = f\"Unable to find coordinates for name '{name}' using {url}\"\n        else:\n            err = f\"Unable to find coordinates for name '{name}' in database {database} using {url}\"\n\n        raise NameResolveError(err)\n\n    # Return SkyCoord object\n    sc = SkyCoord(ra=ra, dec=dec, unit=(u.degree, u.degree), frame='icrs')\n    return sc"},{"className":"IpacHeaderSplitter","col":0,"comment":"Splitter for Ipac Headers.\n\n    This splitter is similar its parent when reading, but supports a\n    fixed width format (as required for Ipac table headers) for writing.\n    ","endLoc":63,"id":5425,"nodeType":"Class","startLoc":39,"text":"class IpacHeaderSplitter(core.BaseSplitter):\n    '''Splitter for Ipac Headers.\n\n    This splitter is similar its parent when reading, but supports a\n    fixed width format (as required for Ipac table headers) for writing.\n    '''\n    process_line = None\n    process_val = None\n    delimiter = '|'\n    delimiter_pad = ''\n    skipinitialspace = False\n    comment = r'\\s*\\\\'\n    write_comment = r'\\\\'\n    col_starts = None\n    col_ends = None\n\n    def join(self, vals, widths):\n        pad = self.delimiter_pad or ''\n        delimiter = self.delimiter or ''\n        padded_delim = pad + delimiter + pad\n        bookend_left = delimiter + pad\n        bookend_right = pad + delimiter\n\n        vals = [' ' * (width - len(val)) + val for val, width in zip(vals, widths)]\n        return bookend_left + padded_delim.join(vals) + bookend_right"},{"attributeType":"null","col":4,"comment":"null","endLoc":314,"id":5426,"name":"_format_name","nodeType":"Attribute","startLoc":314,"text":"_format_name"},{"col":4,"comment":"null","endLoc":63,"header":"def join(self, vals, widths)","id":5427,"name":"join","nodeType":"Function","startLoc":55,"text":"def join(self, vals, widths):\n        pad = self.delimiter_pad or ''\n        delimiter = self.delimiter or ''\n        padded_delim = pad + delimiter + pad\n        bookend_left = delimiter + pad\n        bookend_right = pad + delimiter\n\n        vals = [' ' * (width - len(val)) + val for val, width in zip(vals, widths)]\n        return bookend_left + padded_delim.join(vals) + bookend_right"},{"attributeType":"null","col":4,"comment":"null","endLoc":433,"id":5428,"name":"_io_registry_format_aliases","nodeType":"Attribute","startLoc":433,"text":"_io_registry_format_aliases"},{"attributeType":"null","col":4,"comment":"null","endLoc":315,"id":5429,"name":"_description","nodeType":"Attribute","startLoc":315,"text":"_description"},{"fileName":"fixedwidth.py","filePath":"astropy/io/ascii","id":5430,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"An extensible ASCII table reader and writer.\n\nfixedwidth.py:\n  Read or write a table with fixed width columns.\n\n:Copyright: Smithsonian Astrophysical Observatory (2011)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\"\n\n\nfrom . import core\nfrom .core import InconsistentTableError, DefaultSplitter\nfrom . import basic\n\n\nclass FixedWidthSplitter(core.BaseSplitter):\n    \"\"\"\n    Split line based on fixed start and end positions for each ``col`` in\n    ``self.cols``.\n\n    This class requires that the Header class will have defined ``col.start``\n    and ``col.end`` for each column.  The reference to the ``header.cols`` gets\n    put in the splitter object by the base Reader.read() function just in time\n    for splitting data lines by a ``data`` object.\n\n    Note that the ``start`` and ``end`` positions are defined in the pythonic\n    style so line[start:end] is the desired substring for a column.  This splitter\n    class does not have a hook for ``process_lines`` since that is generally not\n    useful for fixed-width input.\n\n    \"\"\"\n    delimiter_pad = ''\n    bookend = False\n    delimiter = '|'\n\n    def __call__(self, lines):\n        for line in lines:\n            vals = [line[x.start:x.end] for x in self.cols]\n            if self.process_val:\n                yield [self.process_val(x) for x in vals]\n            else:\n                yield vals\n\n    def join(self, vals, widths):\n        pad = self.delimiter_pad or ''\n        delimiter = self.delimiter or ''\n        padded_delim = pad + delimiter + pad\n        if self.bookend:\n            bookend_left = delimiter + pad\n            bookend_right = pad + delimiter\n        else:\n            bookend_left = ''\n            bookend_right = ''\n        vals = [' ' * (width - len(val)) + val for val, width in zip(vals, widths)]\n        return bookend_left + padded_delim.join(vals) + bookend_right\n\n\nclass FixedWidthHeaderSplitter(DefaultSplitter):\n    '''Splitter class that splits on ``|``.'''\n    delimiter = '|'\n\n\nclass FixedWidthHeader(basic.BasicHeader):\n    \"\"\"\n    Fixed width table header reader.\n    \"\"\"\n    splitter_class = FixedWidthHeaderSplitter\n    \"\"\" Splitter class for splitting data lines into columns \"\"\"\n    position_line = None   # secondary header line position\n    \"\"\" row index of line that specifies position (default = 1) \"\"\"\n    set_of_position_line_characters = set(r'`~!#$%^&*-_+=\\|\":' + \"'\")\n\n    def get_line(self, lines, index):\n        for i, line in enumerate(self.process_lines(lines)):\n            if i == index:\n                break\n        else:  # No header line matching\n            raise InconsistentTableError('No header line found in table')\n        return line\n\n    def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines``.\n\n        Based on the previously set Header attributes find or create the column names.\n        Sets ``self.cols`` with the list of Columns.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n\n        # See \"else\" clause below for explanation of start_line and position_line\n        start_line = core._get_line_index(self.start_line, self.process_lines(lines))\n        position_line = core._get_line_index(self.position_line, self.process_lines(lines))\n\n        # If start_line is none then there is no header line.  Column positions are\n        # determined from first data line and column names are either supplied by user\n        # or auto-generated.\n        if start_line is None:\n            if position_line is not None:\n                raise ValueError(\"Cannot set position_line without also setting header_start\")\n\n            # data.data_lines attribute already set via self.data.get_data_lines(lines)\n            # in BaseReader.read().  This includes slicing for data_start / data_end.\n            data_lines = self.data.data_lines\n\n            if not data_lines:\n                raise InconsistentTableError(\n                    'No data lines found so cannot autogenerate column names')\n            vals, starts, ends = self.get_fixedwidth_params(data_lines[0])\n\n            self.names = [self.auto_format.format(i)\n                          for i in range(1, len(vals) + 1)]\n\n        else:\n            # This bit of code handles two cases:\n            # start_line = <index> and position_line = None\n            #    Single header line where that line is used to determine both the\n            #    column positions and names.\n            # start_line = <index> and position_line = <index2>\n            #    Two header lines where the first line defines the column names and\n            #    the second line defines the column positions\n\n            if position_line is not None:\n                # Define self.col_starts and self.col_ends so that the call to\n                # get_fixedwidth_params below will use those to find the header\n                # column names.  Note that get_fixedwidth_params returns Python\n                # slice col_ends but expects inclusive col_ends on input (for\n                # more intuitive user interface).\n                line = self.get_line(lines, position_line)\n                if len(set(line) - set([self.splitter.delimiter, ' '])) != 1:\n                    raise InconsistentTableError(\n                        'Position line should only contain delimiters and '\n                        'one other character, e.g. \"--- ------- ---\".')\n                    # The line above lies. It accepts white space as well.\n                    # We don't want to encourage using three different\n                    # characters, because that can cause ambiguities, but white\n                    # spaces are so common everywhere that practicality beats\n                    # purity here.\n                charset = self.set_of_position_line_characters.union(\n                    set([self.splitter.delimiter, ' ']))\n                if not set(line).issubset(charset):\n                    raise InconsistentTableError(\n                        f'Characters in position line must be part of {charset}')\n                vals, self.col_starts, col_ends = self.get_fixedwidth_params(line)\n                self.col_ends = [x - 1 if x is not None else None for x in col_ends]\n\n            # Get the header column names and column positions\n            line = self.get_line(lines, start_line)\n            vals, starts, ends = self.get_fixedwidth_params(line)\n\n            self.names = vals\n\n        self._set_cols_from_names()\n\n        # Set column start and end positions.\n        for i, col in enumerate(self.cols):\n            col.start = starts[i]\n            col.end = ends[i]\n\n    def get_fixedwidth_params(self, line):\n        \"\"\"\n        Split ``line`` on the delimiter and determine column values and\n        column start and end positions.  This might include null columns with\n        zero length (e.g. for ``header row = \"| col1 || col2 | col3 |\"`` or\n        ``header2_row = \"----- ------- -----\"``).  The null columns are\n        stripped out.  Returns the values between delimiters and the\n        corresponding start and end positions.\n\n        Parameters\n        ----------\n        line : str\n            Input line\n\n        Returns\n        -------\n        vals : list\n            List of values.\n        starts : list\n            List of starting indices.\n        ends : list\n            List of ending indices.\n\n        \"\"\"\n\n        # If column positions are already specified then just use those.\n        # If neither column starts or ends are given, figure out positions\n        # between delimiters. Otherwise, either the starts or the ends have\n        # been given, so figure out whichever wasn't given.\n        if self.col_starts is not None and self.col_ends is not None:\n            starts = list(self.col_starts)  # could be any iterable, e.g. np.array\n            # user supplies inclusive endpoint\n            ends = [x + 1 if x is not None else None for x in self.col_ends]\n            if len(starts) != len(ends):\n                raise ValueError('Fixed width col_starts and col_ends must have the same length')\n            vals = [line[start:end].strip() for start, end in zip(starts, ends)]\n        elif self.col_starts is None and self.col_ends is None:\n            # There might be a cleaner way to do this but it works...\n            vals = line.split(self.splitter.delimiter)\n            starts = [0]\n            ends = []\n            for val in vals:\n                if val:\n                    ends.append(starts[-1] + len(val))\n                    starts.append(ends[-1] + 1)\n                else:\n                    starts[-1] += 1\n            starts = starts[:-1]\n            vals = [x.strip() for x in vals if x]\n            if len(vals) != len(starts) or len(vals) != len(ends):\n                raise InconsistentTableError('Error parsing fixed width header')\n        else:\n            # exactly one of col_starts or col_ends is given...\n            if self.col_starts is not None:\n                starts = list(self.col_starts)\n                ends = starts[1:] + [None]  # Assume each col ends where the next starts\n            else:  # self.col_ends is not None\n                ends = [x + 1 for x in self.col_ends]\n                starts = [0] + ends[:-1]  # Assume each col starts where the last ended\n            vals = [line[start:end].strip() for start, end in zip(starts, ends)]\n\n        return vals, starts, ends\n\n    def write(self, lines):\n        # Header line not written until data are formatted.  Until then it is\n        # not known how wide each column will be for fixed width.\n        pass\n\n\nclass FixedWidthData(basic.BasicData):\n    \"\"\"\n    Base table data reader.\n    \"\"\"\n    splitter_class = FixedWidthSplitter\n    \"\"\" Splitter class for splitting data lines into columns \"\"\"\n\n    def write(self, lines):\n        vals_list = []\n        col_str_iters = self.str_vals()\n        for vals in zip(*col_str_iters):\n            vals_list.append(vals)\n\n        for i, col in enumerate(self.cols):\n            col.width = max([len(vals[i]) for vals in vals_list])\n            if self.header.start_line is not None:\n                col.width = max(col.width, len(col.info.name))\n\n        widths = [col.width for col in self.cols]\n\n        if self.header.start_line is not None:\n            lines.append(self.splitter.join([col.info.name for col in self.cols],\n                                            widths))\n\n        if self.header.position_line is not None:\n            char = self.header.position_char\n            if len(char) != 1:\n                raise ValueError(f'Position_char=\"{char}\" must be a single character')\n            vals = [char * col.width for col in self.cols]\n            lines.append(self.splitter.join(vals, widths))\n\n        for vals in vals_list:\n            lines.append(self.splitter.join(vals, widths))\n\n        return lines\n\n\nclass FixedWidth(basic.Basic):\n    \"\"\"Fixed width table with single header line defining column names and positions.\n\n    Examples::\n\n      # Bar delimiter in header and data\n\n      |  Col1 |   Col2      |  Col3 |\n      |  1.2  | hello there |     3 |\n      |  2.4  | many words  |     7 |\n\n      # Bar delimiter in header only\n\n      Col1 |   Col2      | Col3\n      1.2    hello there    3\n      2.4    many words     7\n\n      # No delimiter with column positions specified as input\n\n      Col1       Col2Col3\n       1.2hello there   3\n       2.4many words    7\n\n    See the :ref:`astropy:fixed_width_gallery` for specific usage examples.\n\n    \"\"\"\n    _format_name = 'fixed_width'\n    _description = 'Fixed width'\n\n    header_class = FixedWidthHeader\n    data_class = FixedWidthData\n\n    def __init__(self, col_starts=None, col_ends=None, delimiter_pad=' ', bookend=True):\n        super().__init__()\n        self.data.splitter.delimiter_pad = delimiter_pad\n        self.data.splitter.bookend = bookend\n        self.header.col_starts = col_starts\n        self.header.col_ends = col_ends\n\n\nclass FixedWidthNoHeaderHeader(FixedWidthHeader):\n    '''Header reader for fixed with tables with no header line'''\n    start_line = None\n\n\nclass FixedWidthNoHeaderData(FixedWidthData):\n    '''Data reader for fixed width tables with no header line'''\n    start_line = 0\n\n\nclass FixedWidthNoHeader(FixedWidth):\n    \"\"\"Fixed width table which has no header line.\n\n    When reading, column names are either input (``names`` keyword) or\n    auto-generated.  Column positions are determined either by input\n    (``col_starts`` and ``col_stops`` keywords) or by splitting the first data\n    line.  In the latter case a ``delimiter`` is required to split the data\n    line.\n\n    Examples::\n\n      # Bar delimiter in header and data\n\n      |  1.2  | hello there |     3 |\n      |  2.4  | many words  |     7 |\n\n      # Compact table having no delimiter and column positions specified as input\n\n      1.2hello there3\n      2.4many words 7\n\n    This class is just a convenience wrapper around the ``FixedWidth`` reader\n    but with ``header_start=None`` and ``data_start=0``.\n\n    See the :ref:`astropy:fixed_width_gallery` for specific usage examples.\n\n    \"\"\"\n    _format_name = 'fixed_width_no_header'\n    _description = 'Fixed width with no header'\n    header_class = FixedWidthNoHeaderHeader\n    data_class = FixedWidthNoHeaderData\n\n    def __init__(self, col_starts=None, col_ends=None, delimiter_pad=' ', bookend=True):\n        super().__init__(col_starts, col_ends, delimiter_pad=delimiter_pad,\n                         bookend=bookend)\n\n\nclass FixedWidthTwoLineHeader(FixedWidthHeader):\n    '''Header reader for fixed width tables splitting on whitespace.\n\n    For fixed width tables with several header lines, there is typically\n    a white-space delimited format line, so splitting on white space is\n    needed.\n    '''\n    splitter_class = DefaultSplitter\n\n\nclass FixedWidthTwoLineDataSplitter(FixedWidthSplitter):\n    '''Splitter for fixed width tables splitting on ``' '``.'''\n    delimiter = ' '\n\n\nclass FixedWidthTwoLineData(FixedWidthData):\n    '''Data reader for fixed with tables with two header lines.'''\n    splitter_class = FixedWidthTwoLineDataSplitter\n\n\nclass FixedWidthTwoLine(FixedWidth):\n    \"\"\"Fixed width table which has two header lines.\n\n    The first header line defines the column names and the second implicitly\n    defines the column positions.\n\n    Examples::\n\n      # Typical case with column extent defined by ---- under column names.\n\n       col1    col2         <== header_start = 0\n      -----  ------------   <== position_line = 1, position_char = \"-\"\n        1     bee flies     <== data_start = 2\n        2     fish swims\n\n      # Pretty-printed table\n\n      +------+------------+\n      | Col1 |   Col2     |\n      +------+------------+\n      |  1.2 | \"hello\"    |\n      |  2.4 | there world|\n      +------+------------+\n\n    See the :ref:`astropy:fixed_width_gallery` for specific usage examples.\n\n    \"\"\"\n    _format_name = 'fixed_width_two_line'\n    _description = 'Fixed width with second header line'\n    data_class = FixedWidthTwoLineData\n    header_class = FixedWidthTwoLineHeader\n\n    def __init__(self, position_line=1, position_char='-', delimiter_pad=None, bookend=False):\n        super().__init__(delimiter_pad=delimiter_pad, bookend=bookend)\n        self.header.position_line = position_line\n        self.header.position_char = position_char\n        self.data.start_line = position_line + 1\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":316,"id":5431,"name":"_fast","nodeType":"Attribute","startLoc":316,"text":"_fast"},{"attributeType":"null","col":8,"comment":"null","endLoc":320,"id":5432,"name":"strip_whitespace_lines","nodeType":"Attribute","startLoc":320,"text":"self.strip_whitespace_lines"},{"className":"FixedWidthHeaderSplitter","col":0,"comment":"Splitter class that splits on ``|``.","endLoc":61,"id":5433,"nodeType":"Class","startLoc":59,"text":"class FixedWidthHeaderSplitter(DefaultSplitter):\n    '''Splitter class that splits on ``|``.'''\n    delimiter = '|'"},{"attributeType":"null","col":4,"comment":"null","endLoc":61,"id":5434,"name":"delimiter","nodeType":"Attribute","startLoc":61,"text":"delimiter"},{"attributeType":"null","col":8,"comment":"null","endLoc":321,"id":5435,"name":"strip_whitespace_fields","nodeType":"Attribute","startLoc":321,"text":"self.strip_whitespace_fields"},{"className":"FixedWidthNoHeaderHeader","col":0,"comment":"Header reader for fixed with tables with no header line","endLoc":313,"id":5436,"nodeType":"Class","startLoc":311,"text":"class FixedWidthNoHeaderHeader(FixedWidthHeader):\n    '''Header reader for fixed with tables with no header line'''\n    start_line = None"},{"attributeType":"None","col":4,"comment":"null","endLoc":313,"id":5437,"name":"start_line","nodeType":"Attribute","startLoc":313,"text":"start_line"},{"col":0,"comment":"Regex match for coordinates in name","endLoc":33,"header":"def search(name, raise_=False)","id":5438,"name":"search","nodeType":"Function","startLoc":27,"text":"def search(name, raise_=False):\n    \"\"\"Regex match for coordinates in name\"\"\"\n    # extract the coordinate data from name\n    match = JPARSER.search(name)\n    if match is None and raise_:\n        raise ValueError('No coordinate match found!')\n    return match"},{"className":"FixedWidthNoHeaderData","col":0,"comment":"Data reader for fixed width tables with no header line","endLoc":318,"id":5439,"nodeType":"Class","startLoc":316,"text":"class FixedWidthNoHeaderData(FixedWidthData):\n    '''Data reader for fixed width tables with no header line'''\n    start_line = 0"},{"attributeType":"null","col":4,"comment":"null","endLoc":318,"id":5440,"name":"start_line","nodeType":"Attribute","startLoc":318,"text":"start_line"},{"col":0,"comment":"Convert to `name` to `SkyCoords` object","endLoc":47,"header":"def to_skycoord(name, frame='icrs')","id":5441,"name":"to_skycoord","nodeType":"Function","startLoc":45,"text":"def to_skycoord(name, frame='icrs'):\n    \"\"\"Convert to `name` to `SkyCoords` object\"\"\"\n    return SkyCoord(*to_ra_dec_angles(name), frame=frame)"},{"attributeType":"null","col":4,"comment":"null","endLoc":434,"id":5442,"name":"_io_registry_can_write","nodeType":"Attribute","startLoc":434,"text":"_io_registry_can_write"},{"className":"FixedWidthNoHeader","col":0,"comment":"Fixed width table which has no header line.\n\n    When reading, column names are either input (``names`` keyword) or\n    auto-generated.  Column positions are determined either by input\n    (``col_starts`` and ``col_stops`` keywords) or by splitting the first data\n    line.  In the latter case a ``delimiter`` is required to split the data\n    line.\n\n    Examples::\n\n      # Bar delimiter in header and data\n\n      |  1.2  | hello there |     3 |\n      |  2.4  | many words  |     7 |\n\n      # Compact table having no delimiter and column positions specified as input\n\n      1.2hello there3\n      2.4many words 7\n\n    This class is just a convenience wrapper around the ``FixedWidth`` reader\n    but with ``header_start=None`` and ``data_start=0``.\n\n    See the :ref:`astropy:fixed_width_gallery` for specific usage examples.\n\n    ","endLoc":355,"id":5443,"nodeType":"Class","startLoc":321,"text":"class FixedWidthNoHeader(FixedWidth):\n    \"\"\"Fixed width table which has no header line.\n\n    When reading, column names are either input (``names`` keyword) or\n    auto-generated.  Column positions are determined either by input\n    (``col_starts`` and ``col_stops`` keywords) or by splitting the first data\n    line.  In the latter case a ``delimiter`` is required to split the data\n    line.\n\n    Examples::\n\n      # Bar delimiter in header and data\n\n      |  1.2  | hello there |     3 |\n      |  2.4  | many words  |     7 |\n\n      # Compact table having no delimiter and column positions specified as input\n\n      1.2hello there3\n      2.4many words 7\n\n    This class is just a convenience wrapper around the ``FixedWidth`` reader\n    but with ``header_start=None`` and ``data_start=0``.\n\n    See the :ref:`astropy:fixed_width_gallery` for specific usage examples.\n\n    \"\"\"\n    _format_name = 'fixed_width_no_header'\n    _description = 'Fixed width with no header'\n    header_class = FixedWidthNoHeaderHeader\n    data_class = FixedWidthNoHeaderData\n\n    def __init__(self, col_starts=None, col_ends=None, delimiter_pad=' ', bookend=True):\n        super().__init__(col_starts, col_ends, delimiter_pad=delimiter_pad,\n                         bookend=bookend)"},{"col":0,"comment":"get RA in hourangle and DEC in degrees by parsing name ","endLoc":42,"header":"def to_ra_dec_angles(name)","id":5444,"name":"to_ra_dec_angles","nodeType":"Function","startLoc":36,"text":"def to_ra_dec_angles(name):\n    \"\"\"get RA in hourangle and DEC in degrees by parsing name \"\"\"\n    groups = search(name, True).groups()\n    prefix, hms, dms = np.split(groups, [1, 6])\n    ra = (_sexagesimal(hms) / (1, 60, 60 * 60) * u.hourangle).sum()\n    dec = (_sexagesimal(dms) * (u.deg, u.arcmin, u.arcsec)).sum()\n    return ra, dec"},{"col":4,"comment":"null","endLoc":355,"header":"def __init__(self, col_starts=None, col_ends=None, delimiter_pad=' ', bookend=True)","id":5445,"name":"__init__","nodeType":"Function","startLoc":353,"text":"def __init__(self, col_starts=None, col_ends=None, delimiter_pad=' ', bookend=True):\n        super().__init__(col_starts, col_ends, delimiter_pad=delimiter_pad,\n                         bookend=bookend)"},{"attributeType":"null","col":4,"comment":"null","endLoc":435,"id":5446,"name":"_description","nodeType":"Attribute","startLoc":435,"text":"_description"},{"col":0,"comment":"null","endLoc":24,"header":"def _sexagesimal(g)","id":5447,"name":"_sexagesimal","nodeType":"Function","startLoc":19,"text":"def _sexagesimal(g):\n    # convert matched regex groups to sexigesimal array\n    sign, h, m, s, frac = g\n    sign = -1 if (sign == '-') else 1\n    s = '.'.join((s, frac))\n    return sign * np.array([h, m, s], float)"},{"fileName":"docs.py","filePath":"astropy/io/ascii","id":5448,"nodeType":"File","text":"READ_DOCSTRING = \"\"\"\n    Read the input ``table`` and return the table.  Most of\n    the default behavior for various parameters is determined by the Reader\n    class.\n\n    See also:\n\n    - https://docs.astropy.org/en/stable/io/ascii/\n    - https://docs.astropy.org/en/stable/io/ascii/read.html\n\n    Parameters\n    ----------\n    table : str, file-like, list, `pathlib.Path` object\n        Input table as a file name, file-like object, list of string[s],\n        single newline-separated string or `pathlib.Path` object.\n    guess : bool\n        Try to guess the table format. Defaults to None.\n    format : str, `~astropy.io.ascii.BaseReader`\n        Input table format\n    Inputter : `~astropy.io.ascii.BaseInputter`\n        Inputter class\n    Outputter : `~astropy.io.ascii.BaseOutputter`\n        Outputter class\n    delimiter : str\n        Column delimiter string\n    comment : str\n        Regular expression defining a comment line in table\n    quotechar : str\n        One-character string to quote fields containing special characters\n    header_start : int\n        Line index for the header line not counting comment or blank lines.\n        A line with only whitespace is considered blank.\n    data_start : int\n        Line index for the start of data not counting comment or blank lines.\n        A line with only whitespace is considered blank.\n    data_end : int\n        Line index for the end of data not counting comment or blank lines.\n        This value can be negative to count from the end.\n    converters : dict\n        Dictionary of converters. Keys in the dictionary are columns names,\n        values are converter functions. In addition to single column names\n        you can use wildcards via `fnmatch` to select multiple columns.\n    data_Splitter : `~astropy.io.ascii.BaseSplitter`\n        Splitter class to split data columns\n    header_Splitter : `~astropy.io.ascii.BaseSplitter`\n        Splitter class to split header columns\n    names : list\n        List of names corresponding to each data column\n    include_names : list\n        List of names to include in output.\n    exclude_names : list\n        List of names to exclude from output (applied after ``include_names``)\n    fill_values : tuple, list of tuple\n        specification of fill values for bad or missing table values\n    fill_include_names : list\n        List of names to include in fill_values.\n    fill_exclude_names : list\n        List of names to exclude from fill_values (applied after ``fill_include_names``)\n    fast_reader : bool, str or dict\n        Whether to use the C engine, can also be a dict with options which\n        defaults to `False`; parameters for options dict:\n\n        use_fast_converter: bool\n            enable faster but slightly imprecise floating point conversion method\n        parallel: bool or int\n            multiprocessing conversion using ``cpu_count()`` or ``'number'`` processes\n        exponent_style: str\n            One-character string defining the exponent or ``'Fortran'`` to auto-detect\n            Fortran-style scientific notation like ``'3.14159D+00'`` (``'E'``, ``'D'``, ``'Q'``),\n            all case-insensitive; default ``'E'``, all other imply ``use_fast_converter``\n        chunk_size : int\n            If supplied with a value > 0 then read the table in chunks of\n            approximately ``chunk_size`` bytes. Default is reading table in one pass.\n        chunk_generator : bool\n            If True and ``chunk_size > 0`` then return an iterator that returns a\n            table for each chunk.  The default is to return a single stacked table\n            for all the chunks.\n\n    encoding : str\n        Allow to specify encoding to read the file (default= ``None``).\n\n    Returns\n    -------\n    dat : `~astropy.table.Table` or <generator>\n        Output table\n\n    \"\"\"\n\n# Specify allowed types for core write() keyword arguments.  Each entry\n# corresponds to the name of an argument and either a type (e.g. int) or a\n# list of types.  These get used in io.ascii.ui._validate_read_write_kwargs().\n# -  The commented-out kwargs are too flexible for a useful check\n# -  'list-list' is a special case for an iterable that is not a string.\nREAD_KWARG_TYPES = {\n    # 'table'\n    'guess': bool,\n    # 'format'\n    # 'Reader'\n    # 'Inputter'\n    # 'Outputter'\n    'delimiter': str,\n    'comment': str,\n    'quotechar': str,\n    'header_start': int,\n    'data_start': (int, str),  # CDS allows 'guess'\n    'data_end': int,\n    'converters': dict,\n    # 'data_Splitter'\n    # 'header_Splitter'\n    'names': 'list-like',\n    'include_names': 'list-like',\n    'exclude_names': 'list-like',\n    'fill_values': 'list-like',\n    'fill_include_names': 'list-like',\n    'fill_exclude_names': 'list-like',\n    'fast_reader': (bool, str, dict),\n    'encoding': str,\n}\n\n\nWRITE_DOCSTRING = \"\"\"\n    Write the input ``table`` to ``filename``.  Most of the default behavior\n    for various parameters is determined by the Writer class.\n\n    See also:\n\n    - https://docs.astropy.org/en/stable/io/ascii/\n    - https://docs.astropy.org/en/stable/io/ascii/write.html\n\n    Parameters\n    ----------\n    table : `~astropy.io.ascii.BaseReader`, array-like, str, file-like, list\n        Input table as a Reader object, Numpy struct array, file name,\n        file-like object, list of strings, or single newline-separated string.\n    output : str, file-like\n        Output [filename, file-like object]. Defaults to``sys.stdout``.\n    format : str\n        Output table format. Defaults to 'basic'.\n    delimiter : str\n        Column delimiter string\n    comment : str, bool\n        String defining a comment line in table.  If `False` then comments\n        are not written out.\n    quotechar : str\n        One-character string to quote fields containing special characters\n    formats : dict\n        Dictionary of format specifiers or formatting functions\n    strip_whitespace : bool\n        Strip surrounding whitespace from column values.\n    names : list\n        List of names corresponding to each data column\n    include_names : list\n        List of names to include in output.\n    exclude_names : list\n        List of names to exclude from output (applied after ``include_names``)\n    fast_writer : bool, str\n        Whether to use the fast Cython writer.  Can be `True` (use fast writer\n        if available), `False` (do not use fast writer), or ``'force'`` (use\n        fast writer and fail if not available, mostly for testing).\n    overwrite : bool\n        If ``overwrite=False`` (default) and the file exists, then an OSError\n        is raised. This parameter is ignored when the ``output`` arg is not a\n        string (e.g., a file object).\n\n    \"\"\"\n# Specify allowed types for core write() keyword arguments.  Each entry\n# corresponds to the name of an argument and either a type (e.g. int) or a\n# list of types.  These get used in io.ascii.ui._validate_read_write_kwargs().\n# -  The commented-out kwargs are too flexible for a useful check\n# -  'list-list' is a special case for an iterable that is not a string.\nWRITE_KWARG_TYPES = {\n    # 'table'\n    # 'output'\n    'format': str,\n    'delimiter': str,\n    'comment': (str, bool),\n    'quotechar': str,\n    'header_start': int,\n    'formats': dict,\n    'strip_whitespace': (bool),\n    'names': 'list-like',\n    'include_names': 'list-like',\n    'exclude_names': 'list-like',\n    'fast_writer': (bool, str),\n    'overwrite': (bool),\n}\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":94,"id":5449,"name":"READ_KWARG_TYPES","nodeType":"Attribute","startLoc":94,"text":"READ_KWARG_TYPES"},{"attributeType":"null","col":0,"comment":"null","endLoc":171,"id":5450,"name":"WRITE_KWARG_TYPES","nodeType":"Attribute","startLoc":171,"text":"WRITE_KWARG_TYPES"},{"col":0,"comment":"","endLoc":87,"header":"docs.py#<anonymous>","id":5451,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"READ_DOCSTRING = \"\"\"\n    Read the input ``table`` and return the table.  Most of\n    the default behavior for various parameters is determined by the Reader\n    class.\n\n    See also:\n\n    - https://docs.astropy.org/en/stable/io/ascii/\n    - https://docs.astropy.org/en/stable/io/ascii/read.html\n\n    Parameters\n    ----------\n    table : str, file-like, list, `pathlib.Path` object\n        Input table as a file name, file-like object, list of string[s],\n        single newline-separated string or `pathlib.Path` object.\n    guess : bool\n        Try to guess the table format. Defaults to None.\n    format : str, `~astropy.io.ascii.BaseReader`\n        Input table format\n    Inputter : `~astropy.io.ascii.BaseInputter`\n        Inputter class\n    Outputter : `~astropy.io.ascii.BaseOutputter`\n        Outputter class\n    delimiter : str\n        Column delimiter string\n    comment : str\n        Regular expression defining a comment line in table\n    quotechar : str\n        One-character string to quote fields containing special characters\n    header_start : int\n        Line index for the header line not counting comment or blank lines.\n        A line with only whitespace is considered blank.\n    data_start : int\n        Line index for the start of data not counting comment or blank lines.\n        A line with only whitespace is considered blank.\n    data_end : int\n        Line index for the end of data not counting comment or blank lines.\n        This value can be negative to count from the end.\n    converters : dict\n        Dictionary of converters. Keys in the dictionary are columns names,\n        values are converter functions. In addition to single column names\n        you can use wildcards via `fnmatch` to select multiple columns.\n    data_Splitter : `~astropy.io.ascii.BaseSplitter`\n        Splitter class to split data columns\n    header_Splitter : `~astropy.io.ascii.BaseSplitter`\n        Splitter class to split header columns\n    names : list\n        List of names corresponding to each data column\n    include_names : list\n        List of names to include in output.\n    exclude_names : list\n        List of names to exclude from output (applied after ``include_names``)\n    fill_values : tuple, list of tuple\n        specification of fill values for bad or missing table values\n    fill_include_names : list\n        List of names to include in fill_values.\n    fill_exclude_names : list\n        List of names to exclude from fill_values (applied after ``fill_include_names``)\n    fast_reader : bool, str or dict\n        Whether to use the C engine, can also be a dict with options which\n        defaults to `False`; parameters for options dict:\n\n        use_fast_converter: bool\n            enable faster but slightly imprecise floating point conversion method\n        parallel: bool or int\n            multiprocessing conversion using ``cpu_count()`` or ``'number'`` processes\n        exponent_style: str\n            One-character string defining the exponent or ``'Fortran'`` to auto-detect\n            Fortran-style scientific notation like ``'3.14159D+00'`` (``'E'``, ``'D'``, ``'Q'``),\n            all case-insensitive; default ``'E'``, all other imply ``use_fast_converter``\n        chunk_size : int\n            If supplied with a value > 0 then read the table in chunks of\n            approximately ``chunk_size`` bytes. Default is reading table in one pass.\n        chunk_generator : bool\n            If True and ``chunk_size > 0`` then return an iterator that returns a\n            table for each chunk.  The default is to return a single stacked table\n            for all the chunks.\n\n    encoding : str\n        Allow to specify encoding to read the file (default= ``None``).\n\n    Returns\n    -------\n    dat : `~astropy.table.Table` or <generator>\n        Output table\n\n    \"\"\"\n\nREAD_KWARG_TYPES = {\n    # 'table'\n    'guess': bool,\n    # 'format'\n    # 'Reader'\n    # 'Inputter'\n    # 'Outputter'\n    'delimiter': str,\n    'comment': str,\n    'quotechar': str,\n    'header_start': int,\n    'data_start': (int, str),  # CDS allows 'guess'\n    'data_end': int,\n    'converters': dict,\n    # 'data_Splitter'\n    # 'header_Splitter'\n    'names': 'list-like',\n    'include_names': 'list-like',\n    'exclude_names': 'list-like',\n    'fill_values': 'list-like',\n    'fill_include_names': 'list-like',\n    'fill_exclude_names': 'list-like',\n    'fast_reader': (bool, str, dict),\n    'encoding': str,\n}\n\nWRITE_DOCSTRING = \"\"\"\n    Write the input ``table`` to ``filename``.  Most of the default behavior\n    for various parameters is determined by the Writer class.\n\n    See also:\n\n    - https://docs.astropy.org/en/stable/io/ascii/\n    - https://docs.astropy.org/en/stable/io/ascii/write.html\n\n    Parameters\n    ----------\n    table : `~astropy.io.ascii.BaseReader`, array-like, str, file-like, list\n        Input table as a Reader object, Numpy struct array, file name,\n        file-like object, list of strings, or single newline-separated string.\n    output : str, file-like\n        Output [filename, file-like object]. Defaults to``sys.stdout``.\n    format : str\n        Output table format. Defaults to 'basic'.\n    delimiter : str\n        Column delimiter string\n    comment : str, bool\n        String defining a comment line in table.  If `False` then comments\n        are not written out.\n    quotechar : str\n        One-character string to quote fields containing special characters\n    formats : dict\n        Dictionary of format specifiers or formatting functions\n    strip_whitespace : bool\n        Strip surrounding whitespace from column values.\n    names : list\n        List of names corresponding to each data column\n    include_names : list\n        List of names to include in output.\n    exclude_names : list\n        List of names to exclude from output (applied after ``include_names``)\n    fast_writer : bool, str\n        Whether to use the fast Cython writer.  Can be `True` (use fast writer\n        if available), `False` (do not use fast writer), or ``'force'`` (use\n        fast writer and fail if not available, mostly for testing).\n    overwrite : bool\n        If ``overwrite=False`` (default) and the file exists, then an OSError\n        is raised. This parameter is ignored when the ``output`` arg is not a\n        string (e.g., a file object).\n\n    \"\"\"\n\nWRITE_KWARG_TYPES = {\n    # 'table'\n    # 'output'\n    'format': str,\n    'delimiter': str,\n    'comment': (str, bool),\n    'quotechar': str,\n    'header_start': int,\n    'formats': dict,\n    'strip_whitespace': (bool),\n    'names': 'list-like',\n    'include_names': 'list-like',\n    'exclude_names': 'list-like',\n    'fast_writer': (bool, str),\n    'overwrite': (bool),\n}"},{"fileName":"daophot.py","filePath":"astropy/io/ascii","id":5452,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nAn extensible ASCII table reader and writer.\n\nClasses to read DAOphot table format\n\n:Copyright: Smithsonian Astrophysical Observatory (2011)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\"\n\n\nimport re\nimport numpy as np\nimport itertools as itt\nfrom collections import defaultdict, OrderedDict\n\nfrom . import core\nfrom . import fixedwidth\nfrom .misc import first_true_index, first_false_index, groupmore\n\n\nclass DaophotHeader(core.BaseHeader):\n    \"\"\"\n    Read the header from a file produced by the IRAF DAOphot routine.\n    \"\"\"\n\n    comment = r'\\s*#K'\n\n    # Regex for extracting the format strings\n    re_format = re.compile(r'%-?(\\d+)\\.?\\d?[sdfg]')\n    re_header_keyword = re.compile(r'[#]K'\n                                   r'\\s+ (?P<name> \\w+)'\n                                   r'\\s* = (?P<stuff> .+) $',\n                                   re.VERBOSE)\n    aperture_values = ()\n\n    def __init__(self):\n        core.BaseHeader.__init__(self)\n\n    def parse_col_defs(self, grouped_lines_dict):\n        \"\"\"\n        Parse a series of column definition lines like below.  There may be several\n        such blocks in a single file (where continuation characters have already been\n        stripped).\n        #N ID    XCENTER   YCENTER   MAG         MERR          MSKY           NITER\n        #U ##    pixels    pixels    magnitudes  magnitudes    counts         ##\n        #F %-9d  %-10.3f   %-10.3f   %-12.3f     %-14.3f       %-15.7g        %-6d\n        \"\"\"\n        line_ids = ('#N', '#U', '#F')\n        coldef_dict = defaultdict(list)\n\n        # Function to strip identifier lines\n        stripper = lambda s: s[2:].strip(' \\\\')\n        for defblock in zip(*map(grouped_lines_dict.get, line_ids)):\n            for key, line in zip(line_ids, map(stripper, defblock)):\n                coldef_dict[key].append(line.split())\n\n        # Save the original columns so we can use it later to reconstruct the\n        # original header for writing\n        if self.data.is_multiline:\n            # Database contains multi-aperture data.\n            # Autogen column names, units, formats from last row of column headers\n            last_names, last_units, last_formats = list(zip(*map(coldef_dict.get, line_ids)))[-1]\n            N_multiline = len(self.data.first_block)\n            for i in np.arange(1, N_multiline + 1).astype('U2'):\n                # extra column names eg. RAPERT2, SUM2 etc...\n                extended_names = list(map(''.join, zip(last_names, itt.repeat(i))))\n                if i == '1':      # Enumerate the names starting at 1\n                    coldef_dict['#N'][-1] = extended_names\n                else:\n                    coldef_dict['#N'].append(extended_names)\n                    coldef_dict['#U'].append(last_units)\n                    coldef_dict['#F'].append(last_formats)\n\n        # Get column widths from column format specifiers\n        get_col_width = lambda s: int(self.re_format.search(s).groups()[0])\n        col_widths = [[get_col_width(f) for f in formats]\n                      for formats in coldef_dict['#F']]\n        # original data format might be shorter than 80 characters and filled with spaces\n        row_widths = np.fromiter(map(sum, col_widths), int)\n        row_short = Daophot.table_width - row_widths\n        # fix last column widths\n        for w, r in zip(col_widths, row_short):\n            w[-1] += r\n\n        self.col_widths = col_widths\n\n        # merge the multi-line header data into single line data\n        coldef_dict = dict((k, sum(v, [])) for (k, v) in coldef_dict.items())\n\n        return coldef_dict\n\n    def update_meta(self, lines, meta):\n        \"\"\"\n        Extract table-level keywords for DAOphot table.  These are indicated by\n        a leading '#K ' prefix.\n        \"\"\"\n        table_meta = meta['table']\n\n        # self.lines = self.get_header_lines(lines)\n        Nlines = len(self.lines)\n        if Nlines > 0:\n            # Group the header lines according to their line identifiers (#K,\n            # #N, #U, #F or just # (spacer line)) function that grabs the line\n            # identifier\n            get_line_id = lambda s: s.split(None, 1)[0]\n\n            # Group lines by the line identifier ('#N', '#U', '#F', '#K') and\n            # capture line index\n            gid, groups = zip(*groupmore(get_line_id, self.lines, range(Nlines)))\n\n            # Groups of lines and their indices\n            grouped_lines, gix = zip(*groups)\n\n            # Dict of line groups keyed by line identifiers\n            grouped_lines_dict = dict(zip(gid, grouped_lines))\n\n            # Update the table_meta keywords if necessary\n            if '#K' in grouped_lines_dict:\n                keywords = OrderedDict(map(self.extract_keyword_line, grouped_lines_dict['#K']))\n                table_meta['keywords'] = keywords\n\n            coldef_dict = self.parse_col_defs(grouped_lines_dict)\n\n            line_ids = ('#N', '#U', '#F')\n            for name, unit, fmt in zip(*map(coldef_dict.get, line_ids)):\n                meta['cols'][name] = {'unit': unit,\n                                      'format': fmt}\n\n            self.meta = meta\n            self.names = coldef_dict['#N']\n\n    def extract_keyword_line(self, line):\n        \"\"\"\n        Extract info from a header keyword line (#K)\n        \"\"\"\n        m = self.re_header_keyword.match(line)\n        if m:\n            vals = m.group('stuff').strip().rsplit(None, 2)\n            keyword_dict = {'units': vals[-2],\n                            'format': vals[-1],\n                            'value': (vals[0] if len(vals) > 2 else \"\")}\n            return m.group('name'), keyword_dict\n\n    def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines`` for a DAOphot\n        header.  The DAOphot header is specialized so that we just copy the entire BaseHeader\n        get_cols routine and modify as needed.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        Returns\n        -------\n        col : list\n            List of table Columns\n        \"\"\"\n\n        if not self.names:\n            raise core.InconsistentTableError('No column names found in DAOphot header')\n\n        # Create the list of io.ascii column objects\n        self._set_cols_from_names()\n\n        # Set unit and format as needed.\n        coldefs = self.meta['cols']\n        for col in self.cols:\n            unit, fmt = map(coldefs[col.name].get, ('unit', 'format'))\n            if unit != '##':\n                col.unit = unit\n            if fmt != '##':\n                col.format = fmt\n\n        # Set column start and end positions.\n        col_width = sum(self.col_widths, [])\n        ends = np.cumsum(col_width)\n        starts = ends - col_width\n        for i, col in enumerate(self.cols):\n            col.start, col.end = starts[i], ends[i]\n            col.span = col.end - col.start\n            if hasattr(col, 'format'):\n                if any(x in col.format for x in 'fg'):\n                    col.type = core.FloatType\n                elif 'd' in col.format:\n                    col.type = core.IntType\n                elif 's' in col.format:\n                    col.type = core.StrType\n\n        # INDEF is the missing value marker\n        self.data.fill_values.append(('INDEF', '0'))\n\n\nclass DaophotData(core.BaseData):\n    splitter_class = fixedwidth.FixedWidthSplitter\n    start_line = 0\n    comment = r'\\s*#'\n\n    def __init__(self):\n        core.BaseData.__init__(self)\n        self.is_multiline = False\n\n    def get_data_lines(self, lines):\n\n        # Special case for multiline daophot databases. Extract the aperture\n        # values from the first multiline data block\n        if self.is_multiline:\n            # Grab the first column of the special block (aperture values) and\n            # recreate the aperture description string\n            aplist = next(zip(*map(str.split, self.first_block)))\n            self.header.aperture_values = tuple(map(float, aplist))\n\n        # Set self.data.data_lines to a slice of lines contain the data rows\n        core.BaseData.get_data_lines(self, lines)\n\n\nclass DaophotInputter(core.ContinuationLinesInputter):\n\n    continuation_char = '\\\\'\n    multiline_char = '*'\n    replace_char = ' '\n    re_multiline = re.compile(r'(#?)[^\\\\*#]*(\\*?)(\\\\*) ?$')\n\n    def search_multiline(self, lines, depth=150):\n        \"\"\"\n        Search lines for special continuation character to determine number of\n        continued rows in a datablock.  For efficiency, depth gives the upper\n        limit of lines to search.\n        \"\"\"\n\n        # The list of apertures given in the #K APERTURES keyword may not be\n        # complete!!  This happens if the string description of the aperture\n        # list is longer than the field width of the #K APERTURES field.  In\n        # this case we have to figure out how many apertures there are based on\n        # the file structure.\n\n        comment, special, cont = zip(*(self.re_multiline.search(line).groups()\n                                       for line in lines[:depth]))\n\n        # Find first non-comment line\n        data_start = first_false_index(comment)\n\n        # No data in lines[:depth].  This may be because there is no data in\n        # the file, or because the header is really huge.  If the latter,\n        # increasing the search depth should help\n        if data_start is None:\n            return None, None, lines[:depth]\n\n        header_lines = lines[:data_start]\n\n        # Find first line ending on special row continuation character '*'\n        # indexed relative to data_start\n        first_special = first_true_index(special[data_start:depth])\n        if first_special is None:  # no special lines\n            return None, None, header_lines\n\n        # last line ending on special '*', but not on line continue '/'\n        last_special = first_false_index(special[data_start + first_special:depth])\n        # index relative to first_special\n\n        # if first_special is None: #no end of special lines within search\n        # depth!  increase search depth return self.search_multiline( lines,\n        # depth=2*depth )\n\n        # indexing now relative to line[0]\n        markers = np.cumsum([data_start, first_special, last_special])\n        # multiline portion of first data block\n        multiline_block = lines[markers[1]:markers[-1]]\n\n        return markers, multiline_block, header_lines\n\n    def process_lines(self, lines):\n\n        markers, block, header = self.search_multiline(lines)\n        self.data.is_multiline = markers is not None\n        self.data.markers = markers\n        self.data.first_block = block\n        # set the header lines returned by the search as a attribute of the header\n        self.data.header.lines = header\n\n        if markers is not None:\n            lines = lines[markers[0]:]\n\n        continuation_char = self.continuation_char\n        multiline_char = self.multiline_char\n        replace_char = self.replace_char\n\n        parts = []\n        outlines = []\n        for i, line in enumerate(lines):\n            mo = self.re_multiline.search(line)\n            if mo:\n                comment, special, cont = mo.groups()\n                if comment or cont:\n                    line = line.replace(continuation_char, replace_char)\n                if special:\n                    line = line.replace(multiline_char, replace_char)\n                if cont and not comment:\n                    parts.append(line)\n                if not cont:\n                    parts.append(line)\n                    outlines.append(''.join(parts))\n                    parts = []\n            else:\n                raise core.InconsistentTableError('multiline re could not match line '\n                                                  '{}: {}'.format(i, line))\n\n        return outlines\n\n\nclass Daophot(core.BaseReader):\n    \"\"\"\n    DAOphot format table.\n\n    Example::\n\n      #K MERGERAD   = INDEF                   scaleunit  %-23.7g\n      #K IRAF = NOAO/IRAFV2.10EXPORT version %-23s\n      #K USER = davis name %-23s\n      #K HOST = tucana computer %-23s\n      #\n      #N ID    XCENTER   YCENTER   MAG         MERR          MSKY           NITER    \\\\\n      #U ##    pixels    pixels    magnitudes  magnitudes    counts         ##       \\\\\n      #F %-9d  %-10.3f   %-10.3f   %-12.3f     %-14.3f       %-15.7g        %-6d\n      #\n      #N         SHARPNESS   CHI         PIER  PERROR                                \\\\\n      #U         ##          ##          ##    perrors                               \\\\\n      #F         %-23.3f     %-12.3f     %-6d  %-13s\n      #\n      14       138.538     INDEF   15.461      0.003         34.85955       4        \\\\\n                  -0.032      0.802       0     No_error\n\n    The keywords defined in the #K records are available via the output table\n    ``meta`` attribute::\n\n      >>> import os\n      >>> from astropy.io import ascii\n      >>> filename = os.path.join(ascii.__path__[0], 'tests/data/daophot.dat')\n      >>> data = ascii.read(filename)\n      >>> for name, keyword in data.meta['keywords'].items():\n      ...     print(name, keyword['value'], keyword['units'], keyword['format'])\n      ...\n      MERGERAD INDEF scaleunit %-23.7g\n      IRAF NOAO/IRAFV2.10EXPORT version %-23s\n      USER  name %-23s\n      ...\n\n    The unit and formats are available in the output table columns::\n\n      >>> for colname in data.colnames:\n      ...     col = data[colname]\n      ...     print(colname, col.unit, col.format)\n      ...\n      ID None %-9d\n      XCENTER pixels %-10.3f\n      YCENTER pixels %-10.3f\n      ...\n\n    Any column values of INDEF are interpreted as a missing value and will be\n    masked out in the resultant table.\n\n    In case of multi-aperture daophot files containing repeated entries for the last\n    row of fields, extra unique column names will be created by suffixing\n    corresponding field names with numbers starting from 2 to N (where N is the\n    total number of apertures).\n    For example,\n    first aperture radius will be RAPERT and corresponding magnitude will be MAG,\n    second aperture radius will be RAPERT2 and corresponding magnitude will be MAG2,\n    third aperture radius will be RAPERT3 and corresponding magnitude will be MAG3,\n    and so on.\n\n    \"\"\"\n    _format_name = 'daophot'\n    _io_registry_format_aliases = ['daophot']\n    _io_registry_can_write = False\n    _description = 'IRAF DAOphot format table'\n\n    header_class = DaophotHeader\n    data_class = DaophotData\n    inputter_class = DaophotInputter\n\n    table_width = 80\n\n    def __init__(self):\n        core.BaseReader.__init__(self)\n        # The inputter needs to know about the data (see DaophotInputter.process_lines)\n        self.inputter.data = self.data\n\n    def write(self, table=None):\n        raise NotImplementedError\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":437,"id":5453,"name":"data_class","nodeType":"Attribute","startLoc":437,"text":"data_class"},{"className":"DaophotHeader","col":0,"comment":"\n    Read the header from a file produced by the IRAF DAOphot routine.\n    ","endLoc":193,"id":5454,"nodeType":"Class","startLoc":22,"text":"class DaophotHeader(core.BaseHeader):\n    \"\"\"\n    Read the header from a file produced by the IRAF DAOphot routine.\n    \"\"\"\n\n    comment = r'\\s*#K'\n\n    # Regex for extracting the format strings\n    re_format = re.compile(r'%-?(\\d+)\\.?\\d?[sdfg]')\n    re_header_keyword = re.compile(r'[#]K'\n                                   r'\\s+ (?P<name> \\w+)'\n                                   r'\\s* = (?P<stuff> .+) $',\n                                   re.VERBOSE)\n    aperture_values = ()\n\n    def __init__(self):\n        core.BaseHeader.__init__(self)\n\n    def parse_col_defs(self, grouped_lines_dict):\n        \"\"\"\n        Parse a series of column definition lines like below.  There may be several\n        such blocks in a single file (where continuation characters have already been\n        stripped).\n        #N ID    XCENTER   YCENTER   MAG         MERR          MSKY           NITER\n        #U ##    pixels    pixels    magnitudes  magnitudes    counts         ##\n        #F %-9d  %-10.3f   %-10.3f   %-12.3f     %-14.3f       %-15.7g        %-6d\n        \"\"\"\n        line_ids = ('#N', '#U', '#F')\n        coldef_dict = defaultdict(list)\n\n        # Function to strip identifier lines\n        stripper = lambda s: s[2:].strip(' \\\\')\n        for defblock in zip(*map(grouped_lines_dict.get, line_ids)):\n            for key, line in zip(line_ids, map(stripper, defblock)):\n                coldef_dict[key].append(line.split())\n\n        # Save the original columns so we can use it later to reconstruct the\n        # original header for writing\n        if self.data.is_multiline:\n            # Database contains multi-aperture data.\n            # Autogen column names, units, formats from last row of column headers\n            last_names, last_units, last_formats = list(zip(*map(coldef_dict.get, line_ids)))[-1]\n            N_multiline = len(self.data.first_block)\n            for i in np.arange(1, N_multiline + 1).astype('U2'):\n                # extra column names eg. RAPERT2, SUM2 etc...\n                extended_names = list(map(''.join, zip(last_names, itt.repeat(i))))\n                if i == '1':      # Enumerate the names starting at 1\n                    coldef_dict['#N'][-1] = extended_names\n                else:\n                    coldef_dict['#N'].append(extended_names)\n                    coldef_dict['#U'].append(last_units)\n                    coldef_dict['#F'].append(last_formats)\n\n        # Get column widths from column format specifiers\n        get_col_width = lambda s: int(self.re_format.search(s).groups()[0])\n        col_widths = [[get_col_width(f) for f in formats]\n                      for formats in coldef_dict['#F']]\n        # original data format might be shorter than 80 characters and filled with spaces\n        row_widths = np.fromiter(map(sum, col_widths), int)\n        row_short = Daophot.table_width - row_widths\n        # fix last column widths\n        for w, r in zip(col_widths, row_short):\n            w[-1] += r\n\n        self.col_widths = col_widths\n\n        # merge the multi-line header data into single line data\n        coldef_dict = dict((k, sum(v, [])) for (k, v) in coldef_dict.items())\n\n        return coldef_dict\n\n    def update_meta(self, lines, meta):\n        \"\"\"\n        Extract table-level keywords for DAOphot table.  These are indicated by\n        a leading '#K ' prefix.\n        \"\"\"\n        table_meta = meta['table']\n\n        # self.lines = self.get_header_lines(lines)\n        Nlines = len(self.lines)\n        if Nlines > 0:\n            # Group the header lines according to their line identifiers (#K,\n            # #N, #U, #F or just # (spacer line)) function that grabs the line\n            # identifier\n            get_line_id = lambda s: s.split(None, 1)[0]\n\n            # Group lines by the line identifier ('#N', '#U', '#F', '#K') and\n            # capture line index\n            gid, groups = zip(*groupmore(get_line_id, self.lines, range(Nlines)))\n\n            # Groups of lines and their indices\n            grouped_lines, gix = zip(*groups)\n\n            # Dict of line groups keyed by line identifiers\n            grouped_lines_dict = dict(zip(gid, grouped_lines))\n\n            # Update the table_meta keywords if necessary\n            if '#K' in grouped_lines_dict:\n                keywords = OrderedDict(map(self.extract_keyword_line, grouped_lines_dict['#K']))\n                table_meta['keywords'] = keywords\n\n            coldef_dict = self.parse_col_defs(grouped_lines_dict)\n\n            line_ids = ('#N', '#U', '#F')\n            for name, unit, fmt in zip(*map(coldef_dict.get, line_ids)):\n                meta['cols'][name] = {'unit': unit,\n                                      'format': fmt}\n\n            self.meta = meta\n            self.names = coldef_dict['#N']\n\n    def extract_keyword_line(self, line):\n        \"\"\"\n        Extract info from a header keyword line (#K)\n        \"\"\"\n        m = self.re_header_keyword.match(line)\n        if m:\n            vals = m.group('stuff').strip().rsplit(None, 2)\n            keyword_dict = {'units': vals[-2],\n                            'format': vals[-1],\n                            'value': (vals[0] if len(vals) > 2 else \"\")}\n            return m.group('name'), keyword_dict\n\n    def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines`` for a DAOphot\n        header.  The DAOphot header is specialized so that we just copy the entire BaseHeader\n        get_cols routine and modify as needed.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        Returns\n        -------\n        col : list\n            List of table Columns\n        \"\"\"\n\n        if not self.names:\n            raise core.InconsistentTableError('No column names found in DAOphot header')\n\n        # Create the list of io.ascii column objects\n        self._set_cols_from_names()\n\n        # Set unit and format as needed.\n        coldefs = self.meta['cols']\n        for col in self.cols:\n            unit, fmt = map(coldefs[col.name].get, ('unit', 'format'))\n            if unit != '##':\n                col.unit = unit\n            if fmt != '##':\n                col.format = fmt\n\n        # Set column start and end positions.\n        col_width = sum(self.col_widths, [])\n        ends = np.cumsum(col_width)\n        starts = ends - col_width\n        for i, col in enumerate(self.cols):\n            col.start, col.end = starts[i], ends[i]\n            col.span = col.end - col.start\n            if hasattr(col, 'format'):\n                if any(x in col.format for x in 'fg'):\n                    col.type = core.FloatType\n                elif 'd' in col.format:\n                    col.type = core.IntType\n                elif 's' in col.format:\n                    col.type = core.StrType\n\n        # INDEF is the missing value marker\n        self.data.fill_values.append(('INDEF', '0'))"},{"attributeType":"null","col":4,"comment":"null","endLoc":438,"id":5455,"name":"header_class","nodeType":"Attribute","startLoc":438,"text":"header_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":348,"id":5456,"name":"_format_name","nodeType":"Attribute","startLoc":348,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":349,"id":5457,"name":"_description","nodeType":"Attribute","startLoc":349,"text":"_description"},{"col":4,"comment":"null","endLoc":38,"header":"def __init__(self)","id":5458,"name":"__init__","nodeType":"Function","startLoc":37,"text":"def __init__(self):\n        core.BaseHeader.__init__(self)"},{"attributeType":"FixedWidthNoHeaderHeader","col":4,"comment":"null","endLoc":350,"id":5459,"name":"header_class","nodeType":"Attribute","startLoc":350,"text":"header_class"},{"attributeType":"FixedWidthNoHeaderData","col":4,"comment":"null","endLoc":351,"id":5460,"name":"data_class","nodeType":"Attribute","startLoc":351,"text":"data_class"},{"col":4,"comment":"\n        Parse a series of column definition lines like below.  There may be several\n        such blocks in a single file (where continuation characters have already been\n        stripped).\n        #N ID    XCENTER   YCENTER   MAG         MERR          MSKY           NITER\n        #U ##    pixels    pixels    magnitudes  magnitudes    counts         ##\n        #F %-9d  %-10.3f   %-10.3f   %-12.3f     %-14.3f       %-15.7g        %-6d\n        ","endLoc":91,"header":"def parse_col_defs(self, grouped_lines_dict)","id":5461,"name":"parse_col_defs","nodeType":"Function","startLoc":40,"text":"def parse_col_defs(self, grouped_lines_dict):\n        \"\"\"\n        Parse a series of column definition lines like below.  There may be several\n        such blocks in a single file (where continuation characters have already been\n        stripped).\n        #N ID    XCENTER   YCENTER   MAG         MERR          MSKY           NITER\n        #U ##    pixels    pixels    magnitudes  magnitudes    counts         ##\n        #F %-9d  %-10.3f   %-10.3f   %-12.3f     %-14.3f       %-15.7g        %-6d\n        \"\"\"\n        line_ids = ('#N', '#U', '#F')\n        coldef_dict = defaultdict(list)\n\n        # Function to strip identifier lines\n        stripper = lambda s: s[2:].strip(' \\\\')\n        for defblock in zip(*map(grouped_lines_dict.get, line_ids)):\n            for key, line in zip(line_ids, map(stripper, defblock)):\n                coldef_dict[key].append(line.split())\n\n        # Save the original columns so we can use it later to reconstruct the\n        # original header for writing\n        if self.data.is_multiline:\n            # Database contains multi-aperture data.\n            # Autogen column names, units, formats from last row of column headers\n            last_names, last_units, last_formats = list(zip(*map(coldef_dict.get, line_ids)))[-1]\n            N_multiline = len(self.data.first_block)\n            for i in np.arange(1, N_multiline + 1).astype('U2'):\n                # extra column names eg. RAPERT2, SUM2 etc...\n                extended_names = list(map(''.join, zip(last_names, itt.repeat(i))))\n                if i == '1':      # Enumerate the names starting at 1\n                    coldef_dict['#N'][-1] = extended_names\n                else:\n                    coldef_dict['#N'].append(extended_names)\n                    coldef_dict['#U'].append(last_units)\n                    coldef_dict['#F'].append(last_formats)\n\n        # Get column widths from column format specifiers\n        get_col_width = lambda s: int(self.re_format.search(s).groups()[0])\n        col_widths = [[get_col_width(f) for f in formats]\n                      for formats in coldef_dict['#F']]\n        # original data format might be shorter than 80 characters and filled with spaces\n        row_widths = np.fromiter(map(sum, col_widths), int)\n        row_short = Daophot.table_width - row_widths\n        # fix last column widths\n        for w, r in zip(col_widths, row_short):\n            w[-1] += r\n\n        self.col_widths = col_widths\n\n        # merge the multi-line header data into single line data\n        coldef_dict = dict((k, sum(v, [])) for (k, v) in coldef_dict.items())\n\n        return coldef_dict"},{"className":"FixedWidthTwoLineHeader","col":0,"comment":"Header reader for fixed width tables splitting on whitespace.\n\n    For fixed width tables with several header lines, there is typically\n    a white-space delimited format line, so splitting on white space is\n    needed.\n    ","endLoc":365,"id":5462,"nodeType":"Class","startLoc":358,"text":"class FixedWidthTwoLineHeader(FixedWidthHeader):\n    '''Header reader for fixed width tables splitting on whitespace.\n\n    For fixed width tables with several header lines, there is typically\n    a white-space delimited format line, so splitting on white space is\n    needed.\n    '''\n    splitter_class = DefaultSplitter"},{"attributeType":"DefaultSplitter","col":4,"comment":"null","endLoc":365,"id":5463,"name":"splitter_class","nodeType":"Attribute","startLoc":365,"text":"splitter_class"},{"col":19,"endLoc":53,"id":5464,"nodeType":"Lambda","startLoc":53,"text":"lambda s: s[2:].strip(' \\\\')"},{"className":"FixedWidthTwoLineData","col":0,"comment":"Data reader for fixed with tables with two header lines.","endLoc":375,"id":5465,"nodeType":"Class","startLoc":373,"text":"class FixedWidthTwoLineData(FixedWidthData):\n    '''Data reader for fixed with tables with two header lines.'''\n    splitter_class = FixedWidthTwoLineDataSplitter"},{"attributeType":"FixedWidthTwoLineDataSplitter","col":4,"comment":"null","endLoc":375,"id":5466,"name":"splitter_class","nodeType":"Attribute","startLoc":375,"text":"splitter_class"},{"className":"Daophot","col":0,"comment":"\n    DAOphot format table.\n\n    Example::\n\n      #K MERGERAD   = INDEF                   scaleunit  %-23.7g\n      #K IRAF = NOAO/IRAFV2.10EXPORT version %-23s\n      #K USER = davis name %-23s\n      #K HOST = tucana computer %-23s\n      #\n      #N ID    XCENTER   YCENTER   MAG         MERR          MSKY           NITER    \\\n      #U ##    pixels    pixels    magnitudes  magnitudes    counts         ##       \\\n      #F %-9d  %-10.3f   %-10.3f   %-12.3f     %-14.3f       %-15.7g        %-6d\n      #\n      #N         SHARPNESS   CHI         PIER  PERROR                                \\\n      #U         ##          ##          ##    perrors                               \\\n      #F         %-23.3f     %-12.3f     %-6d  %-13s\n      #\n      14       138.538     INDEF   15.461      0.003         34.85955       4        \\\n                  -0.032      0.802       0     No_error\n\n    The keywords defined in the #K records are available via the output table\n    ``meta`` attribute::\n\n      >>> import os\n      >>> from astropy.io import ascii\n      >>> filename = os.path.join(ascii.__path__[0], 'tests/data/daophot.dat')\n      >>> data = ascii.read(filename)\n      >>> for name, keyword in data.meta['keywords'].items():\n      ...     print(name, keyword['value'], keyword['units'], keyword['format'])\n      ...\n      MERGERAD INDEF scaleunit %-23.7g\n      IRAF NOAO/IRAFV2.10EXPORT version %-23s\n      USER  name %-23s\n      ...\n\n    The unit and formats are available in the output table columns::\n\n      >>> for colname in data.colnames:\n      ...     col = data[colname]\n      ...     print(colname, col.unit, col.format)\n      ...\n      ID None %-9d\n      XCENTER pixels %-10.3f\n      YCENTER pixels %-10.3f\n      ...\n\n    Any column values of INDEF are interpreted as a missing value and will be\n    masked out in the resultant table.\n\n    In case of multi-aperture daophot files containing repeated entries for the last\n    row of fields, extra unique column names will be created by suffixing\n    corresponding field names with numbers starting from 2 to N (where N is the\n    total number of apertures).\n    For example,\n    first aperture radius will be RAPERT and corresponding magnitude will be MAG,\n    second aperture radius will be RAPERT2 and corresponding magnitude will be MAG2,\n    third aperture radius will be RAPERT3 and corresponding magnitude will be MAG3,\n    and so on.\n\n    ","endLoc":392,"id":5467,"nodeType":"Class","startLoc":313,"text":"class Daophot(core.BaseReader):\n    \"\"\"\n    DAOphot format table.\n\n    Example::\n\n      #K MERGERAD   = INDEF                   scaleunit  %-23.7g\n      #K IRAF = NOAO/IRAFV2.10EXPORT version %-23s\n      #K USER = davis name %-23s\n      #K HOST = tucana computer %-23s\n      #\n      #N ID    XCENTER   YCENTER   MAG         MERR          MSKY           NITER    \\\\\n      #U ##    pixels    pixels    magnitudes  magnitudes    counts         ##       \\\\\n      #F %-9d  %-10.3f   %-10.3f   %-12.3f     %-14.3f       %-15.7g        %-6d\n      #\n      #N         SHARPNESS   CHI         PIER  PERROR                                \\\\\n      #U         ##          ##          ##    perrors                               \\\\\n      #F         %-23.3f     %-12.3f     %-6d  %-13s\n      #\n      14       138.538     INDEF   15.461      0.003         34.85955       4        \\\\\n                  -0.032      0.802       0     No_error\n\n    The keywords defined in the #K records are available via the output table\n    ``meta`` attribute::\n\n      >>> import os\n      >>> from astropy.io import ascii\n      >>> filename = os.path.join(ascii.__path__[0], 'tests/data/daophot.dat')\n      >>> data = ascii.read(filename)\n      >>> for name, keyword in data.meta['keywords'].items():\n      ...     print(name, keyword['value'], keyword['units'], keyword['format'])\n      ...\n      MERGERAD INDEF scaleunit %-23.7g\n      IRAF NOAO/IRAFV2.10EXPORT version %-23s\n      USER  name %-23s\n      ...\n\n    The unit and formats are available in the output table columns::\n\n      >>> for colname in data.colnames:\n      ...     col = data[colname]\n      ...     print(colname, col.unit, col.format)\n      ...\n      ID None %-9d\n      XCENTER pixels %-10.3f\n      YCENTER pixels %-10.3f\n      ...\n\n    Any column values of INDEF are interpreted as a missing value and will be\n    masked out in the resultant table.\n\n    In case of multi-aperture daophot files containing repeated entries for the last\n    row of fields, extra unique column names will be created by suffixing\n    corresponding field names with numbers starting from 2 to N (where N is the\n    total number of apertures).\n    For example,\n    first aperture radius will be RAPERT and corresponding magnitude will be MAG,\n    second aperture radius will be RAPERT2 and corresponding magnitude will be MAG2,\n    third aperture radius will be RAPERT3 and corresponding magnitude will be MAG3,\n    and so on.\n\n    \"\"\"\n    _format_name = 'daophot'\n    _io_registry_format_aliases = ['daophot']\n    _io_registry_can_write = False\n    _description = 'IRAF DAOphot format table'\n\n    header_class = DaophotHeader\n    data_class = DaophotData\n    inputter_class = DaophotInputter\n\n    table_width = 80\n\n    def __init__(self):\n        core.BaseReader.__init__(self)\n        # The inputter needs to know about the data (see DaophotInputter.process_lines)\n        self.inputter.data = self.data\n\n    def write(self, table=None):\n        raise NotImplementedError"},{"col":4,"comment":"null","endLoc":389,"header":"def __init__(self)","id":5468,"name":"__init__","nodeType":"Function","startLoc":386,"text":"def __init__(self):\n        core.BaseReader.__init__(self)\n        # The inputter needs to know about the data (see DaophotInputter.process_lines)\n        self.inputter.data = self.data"},{"attributeType":"None","col":4,"comment":"null","endLoc":45,"id":5469,"name":"process_line","nodeType":"Attribute","startLoc":45,"text":"process_line"},{"className":"FixedWidthTwoLine","col":0,"comment":"Fixed width table which has two header lines.\n\n    The first header line defines the column names and the second implicitly\n    defines the column positions.\n\n    Examples::\n\n      # Typical case with column extent defined by ---- under column names.\n\n       col1    col2         <== header_start = 0\n      -----  ------------   <== position_line = 1, position_char = \"-\"\n        1     bee flies     <== data_start = 2\n        2     fish swims\n\n      # Pretty-printed table\n\n      +------+------------+\n      | Col1 |   Col2     |\n      +------+------------+\n      |  1.2 | \"hello\"    |\n      |  2.4 | there world|\n      +------+------------+\n\n    See the :ref:`astropy:fixed_width_gallery` for specific usage examples.\n\n    ","endLoc":414,"id":5470,"nodeType":"Class","startLoc":378,"text":"class FixedWidthTwoLine(FixedWidth):\n    \"\"\"Fixed width table which has two header lines.\n\n    The first header line defines the column names and the second implicitly\n    defines the column positions.\n\n    Examples::\n\n      # Typical case with column extent defined by ---- under column names.\n\n       col1    col2         <== header_start = 0\n      -----  ------------   <== position_line = 1, position_char = \"-\"\n        1     bee flies     <== data_start = 2\n        2     fish swims\n\n      # Pretty-printed table\n\n      +------+------------+\n      | Col1 |   Col2     |\n      +------+------------+\n      |  1.2 | \"hello\"    |\n      |  2.4 | there world|\n      +------+------------+\n\n    See the :ref:`astropy:fixed_width_gallery` for specific usage examples.\n\n    \"\"\"\n    _format_name = 'fixed_width_two_line'\n    _description = 'Fixed width with second header line'\n    data_class = FixedWidthTwoLineData\n    header_class = FixedWidthTwoLineHeader\n\n    def __init__(self, position_line=1, position_char='-', delimiter_pad=None, bookend=False):\n        super().__init__(delimiter_pad=delimiter_pad, bookend=bookend)\n        self.header.position_line = position_line\n        self.header.position_char = position_char\n        self.data.start_line = position_line + 1"},{"attributeType":"None","col":4,"comment":"null","endLoc":46,"id":5471,"name":"process_val","nodeType":"Attribute","startLoc":46,"text":"process_val"},{"attributeType":"null","col":4,"comment":"null","endLoc":47,"id":5472,"name":"delimiter","nodeType":"Attribute","startLoc":47,"text":"delimiter"},{"attributeType":"null","col":4,"comment":"null","endLoc":48,"id":5473,"name":"delimiter_pad","nodeType":"Attribute","startLoc":48,"text":"delimiter_pad"},{"attributeType":"null","col":4,"comment":"null","endLoc":49,"id":5474,"name":"skipinitialspace","nodeType":"Attribute","startLoc":49,"text":"skipinitialspace"},{"col":4,"comment":"null","endLoc":414,"header":"def __init__(self, position_line=1, position_char='-', delimiter_pad=None, bookend=False)","id":5475,"name":"__init__","nodeType":"Function","startLoc":410,"text":"def __init__(self, position_line=1, position_char='-', delimiter_pad=None, bookend=False):\n        super().__init__(delimiter_pad=delimiter_pad, bookend=bookend)\n        self.header.position_line = position_line\n        self.header.position_char = position_char\n        self.data.start_line = position_line + 1"},{"attributeType":"null","col":4,"comment":"null","endLoc":50,"id":5476,"name":"comment","nodeType":"Attribute","startLoc":50,"text":"comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":51,"id":5477,"name":"write_comment","nodeType":"Attribute","startLoc":51,"text":"write_comment"},{"attributeType":"None","col":4,"comment":"null","endLoc":52,"id":5478,"name":"col_starts","nodeType":"Attribute","startLoc":52,"text":"col_starts"},{"attributeType":"None","col":4,"comment":"null","endLoc":53,"id":5479,"name":"col_ends","nodeType":"Attribute","startLoc":53,"text":"col_ends"},{"className":"IpacHeader","col":0,"comment":"IPAC table header","endLoc":303,"id":5480,"nodeType":"Class","startLoc":66,"text":"class IpacHeader(fixedwidth.FixedWidthHeader):\n    \"\"\"IPAC table header\"\"\"\n    splitter_class = IpacHeaderSplitter\n\n    # Defined ordered list of possible types.  Ordering is needed to\n    # distinguish between \"d\" (double) and \"da\" (date) as defined by\n    # the IPAC standard for abbreviations.  This gets used in get_col_type().\n    col_type_list = (('integer', core.IntType),\n                     ('long', core.IntType),\n                     ('double', core.FloatType),\n                     ('float', core.FloatType),\n                     ('real', core.FloatType),\n                     ('char', core.StrType),\n                     ('date', core.StrType))\n    definition = 'ignore'\n    start_line = None\n\n    def process_lines(self, lines):\n        \"\"\"Generator to yield IPAC header lines, i.e. those starting and ending with\n        delimiter character (with trailing whitespace stripped)\"\"\"\n        delim = self.splitter.delimiter\n        for line in lines:\n            line = line.rstrip()\n            if line.startswith(delim) and line.endswith(delim):\n                yield line.strip(delim)\n\n    def update_meta(self, lines, meta):\n        \"\"\"\n        Extract table-level comments and keywords for IPAC table.  See:\n        https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html#kw\n        \"\"\"\n        def process_keyword_value(val):\n            \"\"\"\n            Take a string value and convert to float, int or str, and strip quotes\n            as needed.\n            \"\"\"\n            val = val.strip()\n            try:\n                val = int(val)\n            except Exception:\n                try:\n                    val = float(val)\n                except Exception:\n                    # Strip leading/trailing quote.  The spec says that a matched pair\n                    # of quotes is required, but this code will allow a non-quoted value.\n                    for quote in ('\"', \"'\"):\n                        if val.startswith(quote) and val.endswith(quote):\n                            val = val[1:-1]\n                            break\n            return val\n\n        table_meta = meta['table']\n        table_meta['comments'] = []\n        table_meta['keywords'] = OrderedDict()\n        keywords = table_meta['keywords']\n\n        re_keyword = re.compile(r'\\\\'\n                                r'(?P<name> \\w+)'\n                                r'\\s* = (?P<value> .+) $',\n                                re.VERBOSE)\n        for line in lines:\n            # Keywords and comments start with \"\\\".  Once the first non-slash\n            # line is seen then bail out.\n            if not line.startswith('\\\\'):\n                break\n\n            m = re_keyword.match(line)\n            if m:\n                name = m.group('name')\n                val = process_keyword_value(m.group('value'))\n\n                # IPAC allows for continuation keywords, e.g.\n                # \\SQL     = 'WHERE '\n                # \\SQL     = 'SELECT (25 column names follow in next row.)'\n                if name in keywords and isinstance(val, str):\n                    prev_val = keywords[name]['value']\n                    if isinstance(prev_val, str):\n                        val = prev_val + val\n\n                keywords[name] = {'value': val}\n            else:\n                # Comment is required to start with \"\\ \"\n                if line.startswith('\\\\ '):\n                    val = line[2:].strip()\n                    if val:\n                        table_meta['comments'].append(val)\n\n    def get_col_type(self, col):\n        for (col_type_key, col_type) in self.col_type_list:\n            if col_type_key.startswith(col.raw_type.lower()):\n                return col_type\n        else:\n            raise ValueError('Unknown data type \"\"{}\"\" for column \"{}\"'.format(\n                col.raw_type, col.name))\n\n    def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines``.\n\n        Based on the previously set Header attributes find or create the column names.\n        Sets ``self.cols`` with the list of Columns.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n        header_lines = self.process_lines(lines)  # generator returning valid header lines\n        header_vals = [vals for vals in self.splitter(header_lines)]\n        if len(header_vals) == 0:\n            raise ValueError('At least one header line beginning and ending with '\n                             'delimiter required')\n        elif len(header_vals) > 4:\n            raise ValueError('More than four header lines were found')\n\n        # Generate column definitions\n        cols = []\n        start = 1\n        for i, name in enumerate(header_vals[0]):\n            col = core.Column(name=name.strip(' -'))\n            col.start = start\n            col.end = start + len(name)\n            if len(header_vals) > 1:\n                col.raw_type = header_vals[1][i].strip(' -')\n                col.type = self.get_col_type(col)\n            if len(header_vals) > 2:\n                col.unit = header_vals[2][i].strip() or None  # Can't strip dashes here\n            if len(header_vals) > 3:\n                # The IPAC null value corresponds to the io.ascii bad_value.\n                # In this case there isn't a fill_value defined, so just put\n                # in the minimal entry that is sure to convert properly to the\n                # required type.\n                #\n                # Strip spaces but not dashes (not allowed in NULL row per\n                # https://github.com/astropy/astropy/issues/361)\n                null = header_vals[3][i].strip()\n                fillval = '' if issubclass(col.type, core.StrType) else '0'\n                self.data.fill_values.append((null, fillval, col.name))\n            start = col.end + 1\n            cols.append(col)\n\n            # Correct column start/end based on definition\n            if self.ipac_definition == 'right':\n                col.start -= 1\n            elif self.ipac_definition == 'left':\n                col.end += 1\n\n        self.names = [x.name for x in cols]\n        self.cols = cols\n\n    def str_vals(self):\n\n        if self.DBMS:\n            IpacFormatE = IpacFormatErrorDBMS\n        else:\n            IpacFormatE = IpacFormatError\n\n        namelist = self.colnames\n        if self.DBMS:\n            countnamelist = defaultdict(int)\n            for name in self.colnames:\n                countnamelist[name.lower()] += 1\n            doublenames = [x for x in countnamelist if countnamelist[x] > 1]\n            if doublenames != []:\n                raise IpacFormatE('IPAC DBMS tables are not case sensitive. '\n                                  'This causes duplicate column names: {}'.format(doublenames))\n\n        for name in namelist:\n            m = re.match(r'\\w+', name)\n            if m.end() != len(name):\n                raise IpacFormatE('{} - Only alphanumeric characters and _ '\n                                  'are allowed in column names.'.format(name))\n            if self.DBMS and not(name[0].isalpha() or (name[0] == '_')):\n                raise IpacFormatE(f'Column name cannot start with numbers: {name}')\n            if self.DBMS:\n                if name in ['x', 'y', 'z', 'X', 'Y', 'Z']:\n                    raise IpacFormatE('{} - x, y, z, X, Y, Z are reserved names and '\n                                      'cannot be used as column names.'.format(name))\n                if len(name) > 16:\n                    raise IpacFormatE(\n                        f'{name} - Maximum length for column name is 16 characters')\n            else:\n                if len(name) > 40:\n                    raise IpacFormatE(\n                        f'{name} - Maximum length for column name is 40 characters.')\n\n        dtypelist = []\n        unitlist = []\n        nullist = []\n        for col in self.cols:\n            col_dtype = col.info.dtype\n            col_unit = col.info.unit\n            col_format = col.info.format\n\n            if col_dtype.kind in ['i', 'u']:\n                if col_dtype.itemsize <= 2:\n                    dtypelist.append('int')\n                else:\n                    dtypelist.append('long')\n            elif col_dtype.kind == 'f':\n                if col_dtype.itemsize <= 4:\n                    dtypelist.append('float')\n                else:\n                    dtypelist.append('double')\n            else:\n                dtypelist.append('char')\n\n            if col_unit is None:\n                unitlist.append('')\n            else:\n                unitlist.append(str(col.info.unit))\n            # This may be incompatible with mixin columns\n            null = col.fill_values[core.masked]\n            try:\n                auto_format_func = get_auto_format_func(col)\n                format_func = col.info._format_funcs.get(col_format, auto_format_func)\n                nullist.append((format_func(col_format, null)).strip())\n            except Exception:\n                # It is possible that null and the column values have different\n                # data types (e.g. number and null = 'null' (i.e. a string).\n                # This could cause all kinds of exceptions, so a catch all\n                # block is needed here\n                nullist.append(str(null).strip())\n\n        return [namelist, dtypelist, unitlist, nullist]\n\n    def write(self, lines, widths):\n        '''Write header.\n\n        The width of each column is determined in Ipac.write. Writing the header\n        must be delayed until that time.\n        This function is called from there, once the width information is\n        available.'''\n\n        for vals in self.str_vals():\n            lines.append(self.splitter.join(vals, widths))\n        return lines"},{"col":4,"comment":"Generator to yield IPAC header lines, i.e. those starting and ending with\n        delimiter character (with trailing whitespace stripped)","endLoc":90,"header":"def process_lines(self, lines)","id":5481,"name":"process_lines","nodeType":"Function","startLoc":83,"text":"def process_lines(self, lines):\n        \"\"\"Generator to yield IPAC header lines, i.e. those starting and ending with\n        delimiter character (with trailing whitespace stripped)\"\"\"\n        delim = self.splitter.delimiter\n        for line in lines:\n            line = line.rstrip()\n            if line.startswith(delim) and line.endswith(delim):\n                yield line.strip(delim)"},{"attributeType":"null","col":4,"comment":"null","endLoc":405,"id":5482,"name":"_format_name","nodeType":"Attribute","startLoc":405,"text":"_format_name"},{"col":4,"comment":"null","endLoc":392,"header":"def write(self, table=None)","id":5483,"name":"write","nodeType":"Function","startLoc":391,"text":"def write(self, table=None):\n        raise NotImplementedError"},{"attributeType":"null","col":4,"comment":"null","endLoc":375,"id":5484,"name":"_format_name","nodeType":"Attribute","startLoc":375,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":406,"id":5485,"name":"_description","nodeType":"Attribute","startLoc":406,"text":"_description"},{"attributeType":"FixedWidthTwoLineData","col":4,"comment":"null","endLoc":407,"id":5486,"name":"data_class","nodeType":"Attribute","startLoc":407,"text":"data_class"},{"attributeType":"FixedWidthTwoLineHeader","col":4,"comment":"null","endLoc":408,"id":5487,"name":"header_class","nodeType":"Attribute","startLoc":408,"text":"header_class"},{"col":0,"comment":"","endLoc":9,"header":"fixedwidth.py#<anonymous>","id":5488,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"An extensible ASCII table reader and writer.\n\nfixedwidth.py:\n  Read or write a table with fixed width columns.\n\n:Copyright: Smithsonian Astrophysical Observatory (2011)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":376,"id":5489,"name":"_io_registry_format_aliases","nodeType":"Attribute","startLoc":376,"text":"_io_registry_format_aliases"},{"attributeType":"null","col":4,"comment":"null","endLoc":377,"id":5490,"name":"_io_registry_can_write","nodeType":"Attribute","startLoc":377,"text":"_io_registry_can_write"},{"col":4,"comment":"\n        Extract table-level comments and keywords for IPAC table.  See:\n        https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html#kw\n        ","endLoc":151,"header":"def update_meta(self, lines, meta)","id":5491,"name":"update_meta","nodeType":"Function","startLoc":92,"text":"def update_meta(self, lines, meta):\n        \"\"\"\n        Extract table-level comments and keywords for IPAC table.  See:\n        https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html#kw\n        \"\"\"\n        def process_keyword_value(val):\n            \"\"\"\n            Take a string value and convert to float, int or str, and strip quotes\n            as needed.\n            \"\"\"\n            val = val.strip()\n            try:\n                val = int(val)\n            except Exception:\n                try:\n                    val = float(val)\n                except Exception:\n                    # Strip leading/trailing quote.  The spec says that a matched pair\n                    # of quotes is required, but this code will allow a non-quoted value.\n                    for quote in ('\"', \"'\"):\n                        if val.startswith(quote) and val.endswith(quote):\n                            val = val[1:-1]\n                            break\n            return val\n\n        table_meta = meta['table']\n        table_meta['comments'] = []\n        table_meta['keywords'] = OrderedDict()\n        keywords = table_meta['keywords']\n\n        re_keyword = re.compile(r'\\\\'\n                                r'(?P<name> \\w+)'\n                                r'\\s* = (?P<value> .+) $',\n                                re.VERBOSE)\n        for line in lines:\n            # Keywords and comments start with \"\\\".  Once the first non-slash\n            # line is seen then bail out.\n            if not line.startswith('\\\\'):\n                break\n\n            m = re_keyword.match(line)\n            if m:\n                name = m.group('name')\n                val = process_keyword_value(m.group('value'))\n\n                # IPAC allows for continuation keywords, e.g.\n                # \\SQL     = 'WHERE '\n                # \\SQL     = 'SELECT (25 column names follow in next row.)'\n                if name in keywords and isinstance(val, str):\n                    prev_val = keywords[name]['value']\n                    if isinstance(prev_val, str):\n                        val = prev_val + val\n\n                keywords[name] = {'value': val}\n            else:\n                # Comment is required to start with \"\\ \"\n                if line.startswith('\\\\ '):\n                    val = line[2:].strip()\n                    if val:\n                        table_meta['comments'].append(val)"},{"attributeType":"null","col":4,"comment":"null","endLoc":378,"id":5492,"name":"_description","nodeType":"Attribute","startLoc":378,"text":"_description"},{"fileName":"connect.py","filePath":"astropy/io/ascii","id":5493,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# This file connects the readers/writers to the astropy.table.Table class\n\n\nimport re\n\nfrom astropy.io import registry as io_registry  # noqa\nfrom astropy.table import Table\n\n__all__ = []\n\n\ndef io_read(format, filename, **kwargs):\n    from .ui import read\n    if format != 'ascii':\n        format = re.sub(r'^ascii\\.', '', format)\n        kwargs['format'] = format\n    return read(filename, **kwargs)\n\n\ndef io_write(format, table, filename, **kwargs):\n    from .ui import write\n    if format != 'ascii':\n        format = re.sub(r'^ascii\\.', '', format)\n        kwargs['format'] = format\n    return write(table, filename, **kwargs)\n\n\ndef io_identify(suffix, origin, filepath, fileobj, *args, **kwargs):\n    return filepath is not None and filepath.endswith(suffix)\n\n\ndef _get_connectors_table():\n    from .core import FORMAT_CLASSES\n\n    rows = []\n    rows.append(('ascii', '', 'Yes', 'ASCII table in any supported format (uses guessing)'))\n    for format in sorted(FORMAT_CLASSES):\n        cls = FORMAT_CLASSES[format]\n\n        io_format = 'ascii.' + cls._format_name\n        description = getattr(cls, '_description', '')\n        class_link = f':class:`~{cls.__module__}.{cls.__name__}`'\n        suffix = getattr(cls, '_io_registry_suffix', '')\n        can_write = 'Yes' if getattr(cls, '_io_registry_can_write', True) else ''\n\n        rows.append((io_format, suffix, can_write,\n                     f'{class_link}: {description}'))\n    out = Table(list(zip(*rows)), names=('Format', 'Suffix', 'Write', 'Description'))\n    for colname in ('Format', 'Description'):\n        width = max(len(x) for x in out[colname])\n        out[colname].format = f'%-{width}s'\n\n    return out\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":380,"id":5494,"name":"header_class","nodeType":"Attribute","startLoc":380,"text":"header_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":381,"id":5495,"name":"data_class","nodeType":"Attribute","startLoc":381,"text":"data_class"},{"col":0,"comment":"null","endLoc":18,"header":"def io_read(format, filename, **kwargs)","id":5496,"name":"io_read","nodeType":"Function","startLoc":13,"text":"def io_read(format, filename, **kwargs):\n    from .ui import read\n    if format != 'ascii':\n        format = re.sub(r'^ascii\\.', '', format)\n        kwargs['format'] = format\n    return read(filename, **kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":382,"id":5497,"name":"inputter_class","nodeType":"Attribute","startLoc":382,"text":"inputter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":384,"id":5498,"name":"table_width","nodeType":"Attribute","startLoc":384,"text":"table_width"},{"col":0,"comment":"null","endLoc":26,"header":"def io_write(format, table, filename, **kwargs)","id":5499,"name":"io_write","nodeType":"Function","startLoc":21,"text":"def io_write(format, table, filename, **kwargs):\n    from .ui import write\n    if format != 'ascii':\n        format = re.sub(r'^ascii\\.', '', format)\n        kwargs['format'] = format\n    return write(table, filename, **kwargs)"},{"col":0,"comment":"\n    Set the default value of the ``guess`` parameter for read()\n\n    Parameters\n    ----------\n    guess : bool\n        New default ``guess`` value (e.g., True or False)\n\n    ","endLoc":109,"header":"def set_guess(guess)","id":5500,"name":"set_guess","nodeType":"Function","startLoc":98,"text":"def set_guess(guess):\n    \"\"\"\n    Set the default value of the ``guess`` parameter for read()\n\n    Parameters\n    ----------\n    guess : bool\n        New default ``guess`` value (e.g., True or False)\n\n    \"\"\"\n    global _GUESS\n    _GUESS = guess"},{"col":0,"comment":"\n    Initialize a table writer allowing for common customizations.  Most of the\n    default behavior for various parameters is determined by the Writer class.\n\n    Parameters\n    ----------\n    Writer : ``Writer``\n        Writer class (DEPRECATED). Defaults to :class:`Basic`.\n    delimiter : str\n        Column delimiter string\n    comment : str\n        String defining a comment line in table\n    quotechar : str\n        One-character string to quote fields containing special characters\n    formats : dict\n        Dictionary of format specifiers or formatting functions\n    strip_whitespace : bool\n        Strip surrounding whitespace from column values.\n    names : list\n        List of names corresponding to each data column\n    include_names : list\n        List of names to include in output.\n    exclude_names : list\n        List of names to exclude from output (applied after ``include_names``)\n    fast_writer : bool\n        Whether to use the fast Cython writer.\n\n    Returns\n    -------\n    writer : `~astropy.io.ascii.BaseReader` subclass\n        ASCII format writer instance\n    ","endLoc":794,"header":"def get_writer(Writer=None, fast_writer=True, **kwargs)","id":5501,"name":"get_writer","nodeType":"Function","startLoc":743,"text":"def get_writer(Writer=None, fast_writer=True, **kwargs):\n    \"\"\"\n    Initialize a table writer allowing for common customizations.  Most of the\n    default behavior for various parameters is determined by the Writer class.\n\n    Parameters\n    ----------\n    Writer : ``Writer``\n        Writer class (DEPRECATED). Defaults to :class:`Basic`.\n    delimiter : str\n        Column delimiter string\n    comment : str\n        String defining a comment line in table\n    quotechar : str\n        One-character string to quote fields containing special characters\n    formats : dict\n        Dictionary of format specifiers or formatting functions\n    strip_whitespace : bool\n        Strip surrounding whitespace from column values.\n    names : list\n        List of names corresponding to each data column\n    include_names : list\n        List of names to include in output.\n    exclude_names : list\n        List of names to exclude from output (applied after ``include_names``)\n    fast_writer : bool\n        Whether to use the fast Cython writer.\n\n    Returns\n    -------\n    writer : `~astropy.io.ascii.BaseReader` subclass\n        ASCII format writer instance\n    \"\"\"\n    if Writer is None:\n        Writer = basic.Basic\n    if 'strip_whitespace' not in kwargs:\n        kwargs['strip_whitespace'] = True\n    writer = core._get_writer(Writer, fast_writer, **kwargs)\n\n    # Handle the corner case of wanting to disable writing table comments for the\n    # commented_header format.  This format *requires* a string for `write_comment`\n    # because that is used for the header column row, so it is not possible to\n    # set the input `comment` to None.  Without adding a new keyword or assuming\n    # a default comment character, there is no other option but to tell user to\n    # simply remove the meta['comments'].\n    if (isinstance(writer, (basic.CommentedHeader, fastbasic.FastCommentedHeader))\n            and not isinstance(kwargs.get('comment', ''), str)):\n        raise ValueError(\"for the commented_header writer you must supply a string\\n\"\n                         \"value for the `comment` keyword.  In order to disable writing\\n\"\n                         \"table comments use `del t.meta['comments']` prior to writing.\")\n\n    return writer"},{"col":0,"comment":"null","endLoc":855,"header":"def write(table, output=None, format=None, Writer=None, fast_writer=True, *,\n          overwrite=False, **kwargs)","id":5502,"name":"write","nodeType":"Function","startLoc":797,"text":"def write(table, output=None, format=None, Writer=None, fast_writer=True, *,\n          overwrite=False, **kwargs):\n    # Docstring inserted below\n\n    _validate_read_write_kwargs('write', format=format, fast_writer=fast_writer,\n                                overwrite=overwrite, **kwargs)\n\n    if isinstance(output, str):\n        if not overwrite and os.path.lexists(output):\n            raise OSError(NOT_OVERWRITING_MSG.format(output))\n\n    if output is None:\n        output = sys.stdout\n\n    # Ensure that `table` is a Table subclass.\n    names = kwargs.get('names')\n    if isinstance(table, Table):\n        # While we are only going to read data from columns, we may need to\n        # to adjust info attributes such as format, so we make a shallow copy.\n        table = table.__class__(table, names=names, copy=False)\n    else:\n        # Otherwise, create a table from the input.\n        table = Table(table, names=names, copy=False)\n\n    table0 = table[:0].copy()\n    core._apply_include_exclude_names(table0, kwargs.get('names'),\n                                      kwargs.get('include_names'), kwargs.get('exclude_names'))\n    diff_format_with_names = set(kwargs.get('formats', [])) - set(table0.colnames)\n\n    if diff_format_with_names:\n        warnings.warn(\n            'The key(s) {} specified in the formats argument do not match a column name.'\n            .format(diff_format_with_names), AstropyWarning)\n\n    if table.has_mixin_columns:\n        fast_writer = False\n\n    Writer = _get_format_class(format, Writer, 'Writer')\n    writer = get_writer(Writer=Writer, fast_writer=fast_writer, **kwargs)\n    if writer._format_name in core.FAST_CLASSES:\n        writer.write(table, output)\n        return\n\n    lines = writer.write(table)\n\n    # Write the lines to output\n    outstr = os.linesep.join(lines)\n    if not hasattr(output, 'write'):\n        # NOTE: we need to specify newline='', otherwise the default\n        # behavior is for Python to translate \\r\\n (which we write because\n        # of os.linesep) into \\r\\r\\n. Specifying newline='' disables any\n        # auto-translation.\n        output = open(output, 'w', newline='')\n        output.write(outstr)\n        output.write(os.linesep)\n        output.close()\n    else:\n        output.write(outstr)\n        output.write(os.linesep)"},{"col":0,"comment":"\n    Return a traceback of the attempted read formats for the last call to\n    `~astropy.io.ascii.read` where guessing was enabled.  This is primarily for\n    debugging.\n\n    The return value is a list of dicts, where each dict includes the keyword\n    args ``kwargs`` used in the read call and the returned ``status``.\n\n    Returns\n    -------\n    trace : list of dict\n        Ordered list of format guesses and status\n    ","endLoc":876,"header":"def get_read_trace()","id":5503,"name":"get_read_trace","nodeType":"Function","startLoc":861,"text":"def get_read_trace():\n    \"\"\"\n    Return a traceback of the attempted read formats for the last call to\n    `~astropy.io.ascii.read` where guessing was enabled.  This is primarily for\n    debugging.\n\n    The return value is a list of dicts, where each dict includes the keyword\n    args ``kwargs`` used in the read call and the returned ``status``.\n\n    Returns\n    -------\n    trace : list of dict\n        Ordered list of format guesses and status\n    \"\"\"\n\n    return copy.deepcopy(_read_trace)"},{"col":0,"comment":"\n    Given a string response from SESAME, parse out the coordinates by looking\n    for a line starting with a J, meaning ICRS J2000 coordinates.\n\n    Parameters\n    ----------\n    resp_data : str\n        The string HTTP response from SESAME.\n\n    Returns\n    -------\n    ra : str\n        The string Right Ascension parsed from the HTTP response.\n    dec : str\n        The string Declination parsed from the HTTP response.\n    ","endLoc":87,"header":"def _parse_response(resp_data)","id":5504,"name":"_parse_response","nodeType":"Function","startLoc":62,"text":"def _parse_response(resp_data):\n    \"\"\"\n    Given a string response from SESAME, parse out the coordinates by looking\n    for a line starting with a J, meaning ICRS J2000 coordinates.\n\n    Parameters\n    ----------\n    resp_data : str\n        The string HTTP response from SESAME.\n\n    Returns\n    -------\n    ra : str\n        The string Right Ascension parsed from the HTTP response.\n    dec : str\n        The string Declination parsed from the HTTP response.\n    \"\"\"\n\n    pattr = re.compile(r\"%J\\s*([0-9\\.]+)\\s*([\\+\\-\\.0-9]+)\")\n    matched = pattr.search(resp_data)\n\n    if matched is None:\n        return None, None\n    else:\n        ra, dec = matched.groups()\n        return ra, dec"},{"col":0,"comment":"","endLoc":4,"header":"__init__.py#<anonymous>","id":5505,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\" An extensible ASCII table reader and writer.\n\n\"\"\""},{"col":24,"endLoc":76,"id":5507,"nodeType":"Lambda","startLoc":76,"text":"lambda s: int(self.re_format.search(s).groups()[0])"},{"col":4,"comment":"null","endLoc":159,"header":"def get_col_type(self, col)","id":5508,"name":"get_col_type","nodeType":"Function","startLoc":153,"text":"def get_col_type(self, col):\n        for (col_type_key, col_type) in self.col_type_list:\n            if col_type_key.startswith(col.raw_type.lower()):\n                return col_type\n        else:\n            raise ValueError('Unknown data type \"\"{}\"\" for column \"{}\"'.format(\n                col.raw_type, col.name))"},{"fileName":"ui.py","filePath":"astropy/io/ascii","id":5509,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"An extensible ASCII table reader and writer.\n\nui.py:\n  Provides the main user functions for reading and writing tables.\n\n:Copyright: Smithsonian Astrophysical Observatory (2010)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\"\n\n\nimport re\nimport os\nimport sys\nimport copy\nimport time\nimport warnings\nimport contextlib\nimport collections\nfrom io import StringIO\n\nimport numpy as np\n\nfrom . import core\nfrom . import basic\nfrom . import cds\nfrom . import mrt\nfrom . import daophot\nfrom . import ecsv\nfrom . import sextractor\nfrom . import ipac\nfrom . import latex\nfrom . import html\nfrom . import rst\nfrom . import fastbasic\nfrom . import cparser\nfrom . import fixedwidth\nfrom .docs import READ_KWARG_TYPES, WRITE_KWARG_TYPES\n\nfrom astropy.table import Table, MaskedColumn\nfrom astropy.utils.data import get_readable_fileobj\nfrom astropy.utils.exceptions import AstropyWarning\nfrom astropy.utils.misc import NOT_OVERWRITING_MSG\n\n_read_trace = []\n\n# Default setting for guess parameter in read()\n_GUESS = True\n\n\ndef _probably_html(table, maxchars=100000):\n    \"\"\"\n    Determine if ``table`` probably contains HTML content.  See PR #3693 and issue\n    #3691 for context.\n    \"\"\"\n    if not isinstance(table, str):\n        try:\n            # If table is an iterable (list of strings) then take the first\n            # maxchars of these.  Make sure this is something with random\n            # access to exclude a file-like object\n            table[0]\n            table[:1]\n            size = 0\n            for i, line in enumerate(table):\n                size += len(line)\n                if size > maxchars:\n                    table = table[:i + 1]\n                    break\n            table = os.linesep.join(table)\n        except Exception:\n            pass\n\n    if isinstance(table, str):\n        # Look for signs of an HTML table in the first maxchars characters\n        table = table[:maxchars]\n\n        # URL ending in .htm or .html\n        if re.match(r'( http[s]? | ftp | file ) :// .+ \\.htm[l]?$', table,\n                    re.IGNORECASE | re.VERBOSE):\n            return True\n\n        # Filename ending in .htm or .html which exists\n        if re.search(r'\\.htm[l]?$', table[-5:], re.IGNORECASE) and os.path.exists(table):\n            return True\n\n        # Table starts with HTML document type declaration\n        if re.match(r'\\s* <! \\s* DOCTYPE \\s* HTML', table, re.IGNORECASE | re.VERBOSE):\n            return True\n\n        # Look for <TABLE .. >, <TR .. >, <TD .. > tag openers.\n        if all(re.search(fr'< \\s* {element} [^>]* >', table, re.IGNORECASE | re.VERBOSE)\n               for element in ('table', 'tr', 'td')):\n            return True\n\n    return False\n\n\ndef set_guess(guess):\n    \"\"\"\n    Set the default value of the ``guess`` parameter for read()\n\n    Parameters\n    ----------\n    guess : bool\n        New default ``guess`` value (e.g., True or False)\n\n    \"\"\"\n    global _GUESS\n    _GUESS = guess\n\n\ndef get_reader(Reader=None, Inputter=None, Outputter=None, **kwargs):\n    \"\"\"\n    Initialize a table reader allowing for common customizations.  Most of the\n    default behavior for various parameters is determined by the Reader class.\n\n    Parameters\n    ----------\n    Reader : `~astropy.io.ascii.BaseReader`\n        Reader class (DEPRECATED). Default is :class:`Basic`.\n    Inputter : `~astropy.io.ascii.BaseInputter`\n        Inputter class\n    Outputter : `~astropy.io.ascii.BaseOutputter`\n        Outputter class\n    delimiter : str\n        Column delimiter string\n    comment : str\n        Regular expression defining a comment line in table\n    quotechar : str\n        One-character string to quote fields containing special characters\n    header_start : int\n        Line index for the header line not counting comment or blank lines.\n        A line with only whitespace is considered blank.\n    data_start : int\n        Line index for the start of data not counting comment or blank lines.\n        A line with only whitespace is considered blank.\n    data_end : int\n        Line index for the end of data not counting comment or blank lines.\n        This value can be negative to count from the end.\n    converters : dict\n        Dict of converters.\n    data_Splitter : `~astropy.io.ascii.BaseSplitter`\n        Splitter class to split data columns.\n    header_Splitter : `~astropy.io.ascii.BaseSplitter`\n        Splitter class to split header columns.\n    names : list\n        List of names corresponding to each data column.\n    include_names : list, optional\n        List of names to include in output.\n    exclude_names : list\n        List of names to exclude from output (applied after ``include_names``).\n    fill_values : tuple, list of tuple\n        Specification of fill values for bad or missing table values.\n    fill_include_names : list\n        List of names to include in fill_values.\n    fill_exclude_names : list\n        List of names to exclude from fill_values (applied after ``fill_include_names``).\n\n    Returns\n    -------\n    reader : `~astropy.io.ascii.BaseReader` subclass\n        ASCII format reader instance\n    \"\"\"\n    # This function is a light wrapper around core._get_reader to provide a\n    # public interface with a default Reader.\n    if Reader is None:\n        # Default reader is Basic unless fast reader is forced\n        fast_reader = _get_fast_reader_dict(kwargs)\n        if fast_reader['enable'] == 'force':\n            Reader = fastbasic.FastBasic\n        else:\n            Reader = basic.Basic\n\n    reader = core._get_reader(Reader, Inputter=Inputter, Outputter=Outputter, **kwargs)\n    return reader\n\n\ndef _get_format_class(format, ReaderWriter, label):\n    if format is not None and ReaderWriter is not None:\n        raise ValueError(f'Cannot supply both format and {label} keywords')\n\n    if format is not None:\n        if format in core.FORMAT_CLASSES:\n            ReaderWriter = core.FORMAT_CLASSES[format]\n        else:\n            raise ValueError('ASCII format {!r} not in allowed list {}'\n                             .format(format, sorted(core.FORMAT_CLASSES)))\n    return ReaderWriter\n\n\ndef _get_fast_reader_dict(kwargs):\n    \"\"\"Convert 'fast_reader' key in kwargs into a dict if not already and make sure\n    'enable' key is available.\n    \"\"\"\n    fast_reader = copy.deepcopy(kwargs.get('fast_reader', True))\n    if isinstance(fast_reader, dict):\n        fast_reader.setdefault('enable', 'force')\n    else:\n        fast_reader = {'enable': fast_reader}\n    return fast_reader\n\n\ndef _validate_read_write_kwargs(read_write, **kwargs):\n    \"\"\"Validate types of keyword arg inputs to read() or write().\"\"\"\n\n    def is_ducktype(val, cls):\n        \"\"\"Check if ``val`` is an instance of ``cls`` or \"seems\" like one:\n        ``cls(val) == val`` does not raise and exception and is `True`. In\n        this way you can pass in ``np.int16(2)`` and have that count as `int`.\n\n        This has a special-case of ``cls`` being 'list-like', meaning it is\n        an iterable but not a string.\n        \"\"\"\n        if cls == 'list-like':\n            ok = (not isinstance(val, str)\n                  and isinstance(val, collections.abc.Iterable))\n        else:\n            ok = isinstance(val, cls)\n            if not ok:\n                # See if ``val`` walks and quacks like a ``cls```.\n                try:\n                    new_val = cls(val)\n                    assert new_val == val\n                except Exception:\n                    ok = False\n                else:\n                    ok = True\n        return ok\n\n    kwarg_types = READ_KWARG_TYPES if read_write == 'read' else WRITE_KWARG_TYPES\n\n    for arg, val in kwargs.items():\n        # Kwarg type checking is opt-in, so kwargs not in the list are considered OK.\n        # This reflects that some readers allow additional arguments that may not\n        # be well-specified, e.g. ```__init__(self, **kwargs)`` is an option.\n        if arg not in kwarg_types or val is None:\n            continue\n\n        # Single type or tuple of types for this arg (like isinstance())\n        types = kwarg_types[arg]\n        err_msg = (f\"{read_write}() argument '{arg}' must be a \"\n                   f\"{types} object, got {type(val)} instead\")\n\n        # Force `types` to be a tuple for the any() check below\n        if not isinstance(types, tuple):\n            types = (types,)\n\n        if not any(is_ducktype(val, cls) for cls in types):\n            raise TypeError(err_msg)\n\n\ndef read(table, guess=None, **kwargs):\n    # This the final output from reading. Static analysis indicates the reading\n    # logic (which is indeed complex) might not define `dat`, thus do so here.\n    dat = None\n\n    # Docstring defined below\n    del _read_trace[:]\n\n    # Downstream readers might munge kwargs\n    kwargs = copy.deepcopy(kwargs)\n\n    _validate_read_write_kwargs('read', **kwargs)\n\n    # Convert 'fast_reader' key in kwargs into a dict if not already and make sure\n    # 'enable' key is available.\n    fast_reader = _get_fast_reader_dict(kwargs)\n    kwargs['fast_reader'] = fast_reader\n\n    if fast_reader['enable'] and fast_reader.get('chunk_size'):\n        return _read_in_chunks(table, **kwargs)\n\n    if 'fill_values' not in kwargs:\n        kwargs['fill_values'] = [('', '0')]\n\n    # If an Outputter is supplied in kwargs that will take precedence.\n    if 'Outputter' in kwargs:  # user specified Outputter, not supported for fast reading\n        fast_reader['enable'] = False\n\n    format = kwargs.get('format')\n    # Dictionary arguments are passed by reference per default and thus need\n    # special protection:\n    new_kwargs = copy.deepcopy(kwargs)\n    kwargs['fast_reader'] = copy.deepcopy(fast_reader)\n\n    # Get the Reader class based on possible format and Reader kwarg inputs.\n    Reader = _get_format_class(format, kwargs.get('Reader'), 'Reader')\n    if Reader is not None:\n        new_kwargs['Reader'] = Reader\n        format = Reader._format_name\n\n    # Remove format keyword if there, this is only allowed in read() not get_reader()\n    if 'format' in new_kwargs:\n        del new_kwargs['format']\n\n    if guess is None:\n        guess = _GUESS\n\n    if guess:\n        # If ``table`` is probably an HTML file then tell guess function to add\n        # the HTML reader at the top of the guess list.  This is in response to\n        # issue #3691 (and others) where libxml can segfault on a long non-HTML\n        # file, thus prompting removal of the HTML reader from the default\n        # guess list.\n        new_kwargs['guess_html'] = _probably_html(table)\n\n        # If `table` is a filename or readable file object then read in the\n        # file now.  This prevents problems in Python 3 with the file object\n        # getting closed or left at the file end.  See #3132, #3013, #3109,\n        # #2001.  If a `readme` arg was passed that implies CDS format, in\n        # which case the original `table` as the data filename must be left\n        # intact.\n        if 'readme' not in new_kwargs:\n            encoding = kwargs.get('encoding')\n            try:\n                with get_readable_fileobj(table, encoding=encoding) as fileobj:\n                    table = fileobj.read()\n            except ValueError:  # unreadable or invalid binary file\n                raise\n            except Exception:\n                pass\n            else:\n                # Ensure that `table` has at least one \\r or \\n in it\n                # so that the core.BaseInputter test of\n                # ('\\n' not in table and '\\r' not in table)\n                # will fail and so `table` cannot be interpreted there\n                # as a filename.  See #4160.\n                if not re.search(r'[\\r\\n]', table):\n                    table = table + os.linesep\n\n                # If the table got successfully read then look at the content\n                # to see if is probably HTML, but only if it wasn't already\n                # identified as HTML based on the filename.\n                if not new_kwargs['guess_html']:\n                    new_kwargs['guess_html'] = _probably_html(table)\n\n        # Get the table from guess in ``dat``.  If ``dat`` comes back as None\n        # then there was just one set of kwargs in the guess list so fall\n        # through below to the non-guess way so that any problems result in a\n        # more useful traceback.\n        dat = _guess(table, new_kwargs, format, fast_reader)\n        if dat is None:\n            guess = False\n\n    if not guess:\n        if format is None:\n            reader = get_reader(**new_kwargs)\n            format = reader._format_name\n\n        # Try the fast reader version of `format` first if applicable.  Note that\n        # if user specified a fast format (e.g. format='fast_basic') this test\n        # will fail and the else-clause below will be used.\n        if fast_reader['enable'] and f'fast_{format}' in core.FAST_CLASSES:\n            fast_kwargs = copy.deepcopy(new_kwargs)\n            fast_kwargs['Reader'] = core.FAST_CLASSES[f'fast_{format}']\n            fast_reader_rdr = get_reader(**fast_kwargs)\n            try:\n                dat = fast_reader_rdr.read(table)\n                _read_trace.append({'kwargs': copy.deepcopy(fast_kwargs),\n                                    'Reader': fast_reader_rdr.__class__,\n                                    'status': 'Success with fast reader (no guessing)'})\n            except (core.ParameterError, cparser.CParserError, UnicodeEncodeError) as err:\n                # special testing value to avoid falling back on the slow reader\n                if fast_reader['enable'] == 'force':\n                    raise core.InconsistentTableError(\n                        f'fast reader {fast_reader_rdr.__class__} exception: {err}')\n                # If the fast reader doesn't work, try the slow version\n                reader = get_reader(**new_kwargs)\n                dat = reader.read(table)\n                _read_trace.append({'kwargs': copy.deepcopy(new_kwargs),\n                                    'Reader': reader.__class__,\n                                    'status': 'Success with slow reader after failing'\n                                    ' with fast (no guessing)'})\n        else:\n            reader = get_reader(**new_kwargs)\n            dat = reader.read(table)\n            _read_trace.append({'kwargs': copy.deepcopy(new_kwargs),\n                                'Reader': reader.__class__,\n                                'status': 'Success with specified Reader class '\n                                          '(no guessing)'})\n\n    # Static analysis (pyright) indicates `dat` might be left undefined, so just\n    # to be sure define it at the beginning and check here.\n    if dat is None:\n        raise RuntimeError('read() function failed due to code logic error, '\n                           'please report this bug on github')\n\n    return dat\n\n\nread.__doc__ = core.READ_DOCSTRING\n\n\ndef _guess(table, read_kwargs, format, fast_reader):\n    \"\"\"\n    Try to read the table using various sets of keyword args.  Start with the\n    standard guess list and filter to make it unique and consistent with\n    user-supplied read keyword args.  Finally, if none of those work then\n    try the original user-supplied keyword args.\n\n    Parameters\n    ----------\n    table : str, file-like, list\n        Input table as a file name, file-like object, list of strings, or\n        single newline-separated string.\n    read_kwargs : dict\n        Keyword arguments from user to be supplied to reader\n    format : str\n        Table format\n    fast_reader : dict\n        Options for the C engine fast reader.  See read() function for details.\n\n    Returns\n    -------\n    dat : `~astropy.table.Table` or None\n        Output table or None if only one guess format was available\n    \"\"\"\n\n    # Keep a trace of all failed guesses kwarg\n    failed_kwargs = []\n\n    # Get an ordered list of read() keyword arg dicts that will be cycled\n    # through in order to guess the format.\n    full_list_guess = _get_guess_kwargs_list(read_kwargs)\n\n    # If a fast version of the reader is available, try that before the slow version\n    if (fast_reader['enable'] and format is not None and f'fast_{format}' in\n            core.FAST_CLASSES):\n        fast_kwargs = copy.deepcopy(read_kwargs)\n        fast_kwargs['Reader'] = core.FAST_CLASSES[f'fast_{format}']\n        full_list_guess = [fast_kwargs] + full_list_guess\n    else:\n        fast_kwargs = None\n\n    # Filter the full guess list so that each entry is consistent with user kwarg inputs.\n    # This also removes any duplicates from the list.\n    filtered_guess_kwargs = []\n    fast_reader = read_kwargs.get('fast_reader')\n\n    for guess_kwargs in full_list_guess:\n        # If user specified slow reader then skip all fast readers\n        if (fast_reader['enable'] is False\n                and guess_kwargs['Reader'] in core.FAST_CLASSES.values()):\n            _read_trace.append({'kwargs': copy.deepcopy(guess_kwargs),\n                                'Reader': guess_kwargs['Reader'].__class__,\n                                'status': 'Disabled: reader only available in fast version',\n                                'dt': f'{0.0:.3f} ms'})\n            continue\n\n        # If user required a fast reader then skip all non-fast readers\n        if (fast_reader['enable'] == 'force'\n                and guess_kwargs['Reader'] not in core.FAST_CLASSES.values()):\n            _read_trace.append({'kwargs': copy.deepcopy(guess_kwargs),\n                                'Reader': guess_kwargs['Reader'].__class__,\n                                'status': 'Disabled: no fast version of reader available',\n                                'dt': f'{0.0:.3f} ms'})\n            continue\n\n        guess_kwargs_ok = True  # guess_kwargs are consistent with user_kwargs?\n        for key, val in read_kwargs.items():\n            # Do guess_kwargs.update(read_kwargs) except that if guess_args has\n            # a conflicting key/val pair then skip this guess entirely.\n            if key not in guess_kwargs:\n                guess_kwargs[key] = copy.deepcopy(val)\n            elif val != guess_kwargs[key] and guess_kwargs != fast_kwargs:\n                guess_kwargs_ok = False\n                break\n\n        if not guess_kwargs_ok:\n            # User-supplied kwarg is inconsistent with the guess-supplied kwarg, e.g.\n            # user supplies delimiter=\"|\" but the guess wants to try delimiter=\" \",\n            # so skip the guess entirely.\n            continue\n\n        # Add the guess_kwargs to filtered list only if it is not already there.\n        if guess_kwargs not in filtered_guess_kwargs:\n            filtered_guess_kwargs.append(guess_kwargs)\n\n    # If there are not at least two formats to guess then return no table\n    # (None) to indicate that guessing did not occur.  In that case the\n    # non-guess read() will occur and any problems will result in a more useful\n    # traceback.\n    if len(filtered_guess_kwargs) <= 1:\n        return None\n\n    # Define whitelist of exceptions that are expected from readers when\n    # processing invalid inputs.  Note that OSError must fall through here\n    # so one cannot simply catch any exception.\n    guess_exception_classes = (core.InconsistentTableError, ValueError, TypeError,\n                               AttributeError, core.OptionalTableImportError,\n                               core.ParameterError, cparser.CParserError)\n\n    # Now cycle through each possible reader and associated keyword arguments.\n    # Try to read the table using those args, and if an exception occurs then\n    # keep track of the failed guess and move on.\n    for guess_kwargs in filtered_guess_kwargs:\n        t0 = time.time()\n        try:\n            # If guessing will try all Readers then use strict req'ts on column names\n            if 'Reader' not in read_kwargs:\n                guess_kwargs['strict_names'] = True\n\n            reader = get_reader(**guess_kwargs)\n\n            reader.guessing = True\n            dat = reader.read(table)\n            _read_trace.append({'kwargs': copy.deepcopy(guess_kwargs),\n                                'Reader': reader.__class__,\n                                'status': 'Success (guessing)',\n                                'dt': f'{(time.time() - t0) * 1000:.3f} ms'})\n            return dat\n\n        except guess_exception_classes as err:\n            _read_trace.append({'kwargs': copy.deepcopy(guess_kwargs),\n                                'status': f'{err.__class__.__name__}: {str(err)}',\n                                'dt': f'{(time.time() - t0) * 1000:.3f} ms'})\n            failed_kwargs.append(guess_kwargs)\n    else:\n        # Failed all guesses, try the original read_kwargs without column requirements\n        try:\n            reader = get_reader(**read_kwargs)\n            dat = reader.read(table)\n            _read_trace.append({'kwargs': copy.deepcopy(read_kwargs),\n                                'Reader': reader.__class__,\n                                'status': 'Success with original kwargs without strict_names '\n                                          '(guessing)'})\n            return dat\n\n        except guess_exception_classes as err:\n            _read_trace.append({'kwargs': copy.deepcopy(read_kwargs),\n                                'status': f'{err.__class__.__name__}: {str(err)}'})\n            failed_kwargs.append(read_kwargs)\n            lines = ['\\nERROR: Unable to guess table format with the guesses listed below:']\n            for kwargs in failed_kwargs:\n                sorted_keys = sorted([x for x in sorted(kwargs)\n                                      if x not in ('Reader', 'Outputter')])\n                reader_repr = repr(kwargs.get('Reader', basic.Basic))\n                keys_vals = ['Reader:' + re.search(r\"\\.(\\w+)'>\", reader_repr).group(1)]\n                kwargs_sorted = ((key, kwargs[key]) for key in sorted_keys)\n                keys_vals.extend([f'{key}: {val!r}' for key, val in kwargs_sorted])\n                lines.append(' '.join(keys_vals))\n\n            msg = ['',\n                   '************************************************************************',\n                   '** ERROR: Unable to guess table format with the guesses listed above. **',\n                   '**                                                                    **',\n                   '** To figure out why the table did not read, use guess=False and      **',\n                   '** fast_reader=False, along with any appropriate arguments to read(). **',\n                   '** In particular specify the format and any known attributes like the **',\n                   '** delimiter.                                                         **',\n                   '************************************************************************']\n            lines.extend(msg)\n            raise core.InconsistentTableError('\\n'.join(lines))\n\n\ndef _get_guess_kwargs_list(read_kwargs):\n    \"\"\"\n    Get the full list of reader keyword argument dicts that are the basis\n    for the format guessing process.  The returned full list will then be:\n\n    - Filtered to be consistent with user-supplied kwargs\n    - Cleaned to have only unique entries\n    - Used one by one to try reading the input table\n\n    Note that the order of the guess list has been tuned over years of usage.\n    Maintainers need to be very careful about any adjustments as the\n    reasoning may not be immediately evident in all cases.\n\n    This list can (and usually does) include duplicates.  This is a result\n    of the order tuning, but these duplicates get removed later.\n\n    Parameters\n    ----------\n    read_kwargs : dict\n        User-supplied read keyword args\n\n    Returns\n    -------\n    guess_kwargs_list : list\n        List of read format keyword arg dicts\n    \"\"\"\n    guess_kwargs_list = []\n\n    # If the table is probably HTML based on some heuristics then start with the\n    # HTML reader.\n    if read_kwargs.pop('guess_html', None):\n        guess_kwargs_list.append(dict(Reader=html.HTML))\n\n    # Start with ECSV because an ECSV file will be read by Basic.  This format\n    # has very specific header requirements and fails out quickly.\n    guess_kwargs_list.append(dict(Reader=ecsv.Ecsv))\n\n    # Now try readers that accept the user-supplied keyword arguments\n    # (actually include all here - check for compatibility of arguments later).\n    # FixedWidthTwoLine would also be read by Basic, so it needs to come first;\n    # same for RST.\n    for reader in (fixedwidth.FixedWidthTwoLine, rst.RST,\n                   fastbasic.FastBasic, basic.Basic,\n                   fastbasic.FastRdb, basic.Rdb,\n                   fastbasic.FastTab, basic.Tab,\n                   cds.Cds, mrt.Mrt, daophot.Daophot, sextractor.SExtractor,\n                   ipac.Ipac, latex.Latex, latex.AASTex):\n        guess_kwargs_list.append(dict(Reader=reader))\n\n    # Cycle through the basic-style readers using all combinations of delimiter\n    # and quotechar.\n    for Reader in (fastbasic.FastCommentedHeader, basic.CommentedHeader,\n                   fastbasic.FastBasic, basic.Basic,\n                   fastbasic.FastNoHeader, basic.NoHeader):\n        for delimiter in (\"|\", \",\", \" \", r\"\\s\"):\n            for quotechar in ('\"', \"'\"):\n                guess_kwargs_list.append(dict(\n                    Reader=Reader, delimiter=delimiter, quotechar=quotechar))\n\n    return guess_kwargs_list\n\n\ndef _read_in_chunks(table, **kwargs):\n    \"\"\"\n    For fast_reader read the ``table`` in chunks and vstack to create\n    a single table, OR return a generator of chunk tables.\n    \"\"\"\n    fast_reader = kwargs['fast_reader']\n    chunk_size = fast_reader.pop('chunk_size')\n    chunk_generator = fast_reader.pop('chunk_generator', False)\n    fast_reader['parallel'] = False  # No parallel with chunks\n\n    tbl_chunks = _read_in_chunks_generator(table, chunk_size, **kwargs)\n    if chunk_generator:\n        return tbl_chunks\n\n    tbl0 = next(tbl_chunks)\n    masked = tbl0.masked\n\n    # Numpy won't allow resizing the original so make a copy here.\n    out_cols = {col.name: col.data.copy() for col in tbl0.itercols()}\n\n    str_kinds = ('S', 'U')\n    for tbl in tbl_chunks:\n        masked |= tbl.masked\n        for name, col in tbl.columns.items():\n            # Concatenate current column data and new column data\n\n            # If one of the inputs is string-like and the other is not, then\n            # convert the non-string to a string.  In a perfect world this would\n            # be handled by numpy, but as of numpy 1.13 this results in a string\n            # dtype that is too long (https://github.com/numpy/numpy/issues/10062).\n\n            col1, col2 = out_cols[name], col.data\n            if col1.dtype.kind in str_kinds and col2.dtype.kind not in str_kinds:\n                col2 = np.array(col2.tolist(), dtype=col1.dtype.kind)\n            elif col2.dtype.kind in str_kinds and col1.dtype.kind not in str_kinds:\n                col1 = np.array(col1.tolist(), dtype=col2.dtype.kind)\n\n            # Choose either masked or normal concatenation\n            concatenate = np.ma.concatenate if masked else np.concatenate\n\n            out_cols[name] = concatenate([col1, col2])\n\n    # Make final table from numpy arrays, converting dict to list\n    out_cols = [out_cols[name] for name in tbl0.colnames]\n    out = tbl0.__class__(out_cols, names=tbl0.colnames, meta=tbl0.meta,\n                         copy=False)\n\n    return out\n\n\ndef _read_in_chunks_generator(table, chunk_size, **kwargs):\n    \"\"\"\n    For fast_reader read the ``table`` in chunks and return a generator\n    of tables for each chunk.\n    \"\"\"\n\n    @contextlib.contextmanager\n    def passthrough_fileobj(fileobj, encoding=None):\n        \"\"\"Stub for get_readable_fileobj, which does not seem to work in Py3\n        for input file-like object, see #6460\"\"\"\n        yield fileobj\n\n    # Set up to coerce `table` input into a readable file object by selecting\n    # an appropriate function.\n\n    # Convert table-as-string to a File object.  Finding a newline implies\n    # that the string is not a filename.\n    if (isinstance(table, str) and ('\\n' in table or '\\r' in table)):\n        table = StringIO(table)\n        fileobj_context = passthrough_fileobj\n    elif hasattr(table, 'read') and hasattr(table, 'seek'):\n        fileobj_context = passthrough_fileobj\n    else:\n        # string filename or pathlib\n        fileobj_context = get_readable_fileobj\n\n    # Set up for iterating over chunks\n    kwargs['fast_reader']['return_header_chars'] = True\n    header = ''  # Table header (up to start of data)\n    prev_chunk_chars = ''  # Chars from previous chunk after last newline\n    first_chunk = True  # True for the first chunk, False afterward\n\n    with fileobj_context(table, encoding=kwargs.get('encoding')) as fh:\n\n        while True:\n            chunk = fh.read(chunk_size)\n            # Got fewer chars than requested, must be end of file\n            final_chunk = len(chunk) < chunk_size\n\n            # If this is the last chunk and there is only whitespace then break\n            if final_chunk and not re.search(r'\\S', chunk):\n                break\n\n            # Step backwards from last character in chunk and find first newline\n            for idx in range(len(chunk) - 1, -1, -1):\n                if final_chunk or chunk[idx] == '\\n':\n                    break\n            else:\n                raise ValueError('no newline found in chunk (chunk_size too small?)')\n\n            # Stick on the header to the chunk part up to (and including) the\n            # last newline.  Make sure the small strings are concatenated first.\n            complete_chunk = (header + prev_chunk_chars) + chunk[:idx + 1]\n            prev_chunk_chars = chunk[idx + 1:]\n\n            # Now read the chunk as a complete table\n            tbl = read(complete_chunk, guess=False, **kwargs)\n\n            # For the first chunk pop the meta key which contains the header\n            # characters (everything up to the start of data) then fix kwargs\n            # so it doesn't return that in meta any more.\n            if first_chunk:\n                header = tbl.meta.pop('__ascii_fast_reader_header_chars__')\n                first_chunk = False\n\n            yield tbl\n\n            if final_chunk:\n                break\n\n\nextra_writer_pars = ('delimiter', 'comment', 'quotechar', 'formats',\n                     'names', 'include_names', 'exclude_names', 'strip_whitespace')\n\n\ndef get_writer(Writer=None, fast_writer=True, **kwargs):\n    \"\"\"\n    Initialize a table writer allowing for common customizations.  Most of the\n    default behavior for various parameters is determined by the Writer class.\n\n    Parameters\n    ----------\n    Writer : ``Writer``\n        Writer class (DEPRECATED). Defaults to :class:`Basic`.\n    delimiter : str\n        Column delimiter string\n    comment : str\n        String defining a comment line in table\n    quotechar : str\n        One-character string to quote fields containing special characters\n    formats : dict\n        Dictionary of format specifiers or formatting functions\n    strip_whitespace : bool\n        Strip surrounding whitespace from column values.\n    names : list\n        List of names corresponding to each data column\n    include_names : list\n        List of names to include in output.\n    exclude_names : list\n        List of names to exclude from output (applied after ``include_names``)\n    fast_writer : bool\n        Whether to use the fast Cython writer.\n\n    Returns\n    -------\n    writer : `~astropy.io.ascii.BaseReader` subclass\n        ASCII format writer instance\n    \"\"\"\n    if Writer is None:\n        Writer = basic.Basic\n    if 'strip_whitespace' not in kwargs:\n        kwargs['strip_whitespace'] = True\n    writer = core._get_writer(Writer, fast_writer, **kwargs)\n\n    # Handle the corner case of wanting to disable writing table comments for the\n    # commented_header format.  This format *requires* a string for `write_comment`\n    # because that is used for the header column row, so it is not possible to\n    # set the input `comment` to None.  Without adding a new keyword or assuming\n    # a default comment character, there is no other option but to tell user to\n    # simply remove the meta['comments'].\n    if (isinstance(writer, (basic.CommentedHeader, fastbasic.FastCommentedHeader))\n            and not isinstance(kwargs.get('comment', ''), str)):\n        raise ValueError(\"for the commented_header writer you must supply a string\\n\"\n                         \"value for the `comment` keyword.  In order to disable writing\\n\"\n                         \"table comments use `del t.meta['comments']` prior to writing.\")\n\n    return writer\n\n\ndef write(table, output=None, format=None, Writer=None, fast_writer=True, *,\n          overwrite=False, **kwargs):\n    # Docstring inserted below\n\n    _validate_read_write_kwargs('write', format=format, fast_writer=fast_writer,\n                                overwrite=overwrite, **kwargs)\n\n    if isinstance(output, str):\n        if not overwrite and os.path.lexists(output):\n            raise OSError(NOT_OVERWRITING_MSG.format(output))\n\n    if output is None:\n        output = sys.stdout\n\n    # Ensure that `table` is a Table subclass.\n    names = kwargs.get('names')\n    if isinstance(table, Table):\n        # While we are only going to read data from columns, we may need to\n        # to adjust info attributes such as format, so we make a shallow copy.\n        table = table.__class__(table, names=names, copy=False)\n    else:\n        # Otherwise, create a table from the input.\n        table = Table(table, names=names, copy=False)\n\n    table0 = table[:0].copy()\n    core._apply_include_exclude_names(table0, kwargs.get('names'),\n                                      kwargs.get('include_names'), kwargs.get('exclude_names'))\n    diff_format_with_names = set(kwargs.get('formats', [])) - set(table0.colnames)\n\n    if diff_format_with_names:\n        warnings.warn(\n            'The key(s) {} specified in the formats argument do not match a column name.'\n            .format(diff_format_with_names), AstropyWarning)\n\n    if table.has_mixin_columns:\n        fast_writer = False\n\n    Writer = _get_format_class(format, Writer, 'Writer')\n    writer = get_writer(Writer=Writer, fast_writer=fast_writer, **kwargs)\n    if writer._format_name in core.FAST_CLASSES:\n        writer.write(table, output)\n        return\n\n    lines = writer.write(table)\n\n    # Write the lines to output\n    outstr = os.linesep.join(lines)\n    if not hasattr(output, 'write'):\n        # NOTE: we need to specify newline='', otherwise the default\n        # behavior is for Python to translate \\r\\n (which we write because\n        # of os.linesep) into \\r\\r\\n. Specifying newline='' disables any\n        # auto-translation.\n        output = open(output, 'w', newline='')\n        output.write(outstr)\n        output.write(os.linesep)\n        output.close()\n    else:\n        output.write(outstr)\n        output.write(os.linesep)\n\n\nwrite.__doc__ = core.WRITE_DOCSTRING\n\n\ndef get_read_trace():\n    \"\"\"\n    Return a traceback of the attempted read formats for the last call to\n    `~astropy.io.ascii.read` where guessing was enabled.  This is primarily for\n    debugging.\n\n    The return value is a list of dicts, where each dict includes the keyword\n    args ``kwargs`` used in the read call and the returned ``status``.\n\n    Returns\n    -------\n    trace : list of dict\n        Ordered list of format guesses and status\n    \"\"\"\n\n    return copy.deepcopy(_read_trace)\n"},{"col":4,"comment":"\n        Extract table-level keywords for DAOphot table.  These are indicated by\n        a leading '#K ' prefix.\n        ","endLoc":131,"header":"def update_meta(self, lines, meta)","id":5510,"name":"update_meta","nodeType":"Function","startLoc":93,"text":"def update_meta(self, lines, meta):\n        \"\"\"\n        Extract table-level keywords for DAOphot table.  These are indicated by\n        a leading '#K ' prefix.\n        \"\"\"\n        table_meta = meta['table']\n\n        # self.lines = self.get_header_lines(lines)\n        Nlines = len(self.lines)\n        if Nlines > 0:\n            # Group the header lines according to their line identifiers (#K,\n            # #N, #U, #F or just # (spacer line)) function that grabs the line\n            # identifier\n            get_line_id = lambda s: s.split(None, 1)[0]\n\n            # Group lines by the line identifier ('#N', '#U', '#F', '#K') and\n            # capture line index\n            gid, groups = zip(*groupmore(get_line_id, self.lines, range(Nlines)))\n\n            # Groups of lines and their indices\n            grouped_lines, gix = zip(*groups)\n\n            # Dict of line groups keyed by line identifiers\n            grouped_lines_dict = dict(zip(gid, grouped_lines))\n\n            # Update the table_meta keywords if necessary\n            if '#K' in grouped_lines_dict:\n                keywords = OrderedDict(map(self.extract_keyword_line, grouped_lines_dict['#K']))\n                table_meta['keywords'] = keywords\n\n            coldef_dict = self.parse_col_defs(grouped_lines_dict)\n\n            line_ids = ('#N', '#U', '#F')\n            for name, unit, fmt in zip(*map(coldef_dict.get, line_ids)):\n                meta['cols'][name] = {'unit': unit,\n                                      'format': fmt}\n\n            self.meta = meta\n            self.names = coldef_dict['#N']"},{"col":26,"endLoc":106,"id":5511,"nodeType":"Lambda","startLoc":106,"text":"lambda s: s.split(None, 1)[0]"},{"attributeType":"null","col":4,"comment":"null","endLoc":284,"id":5512,"name":"info","nodeType":"Attribute","startLoc":284,"text":"info"},{"attributeType":"null","col":16,"comment":"null","endLoc":302,"id":5513,"name":"_extra_frameattr_names","nodeType":"Attribute","startLoc":302,"text":"self._extra_frameattr_names"},{"attributeType":"null","col":16,"comment":"null","endLoc":343,"id":5514,"name":"info","nodeType":"Attribute","startLoc":343,"text":"self.info"},{"attributeType":"null","col":12,"comment":"null","endLoc":347,"id":5515,"name":"_sky_coord_frame","nodeType":"Attribute","startLoc":347,"text":"self._sky_coord_frame"},{"className":"SkyCoordType","col":0,"comment":"null","endLoc":24,"id":5516,"nodeType":"Class","startLoc":9,"text":"class SkyCoordType(AstropyType):\n    name = 'coordinates/skycoord'\n    types = [SkyCoord]\n    version = \"1.0.0\"\n\n    @classmethod\n    def to_tree(cls, obj, ctx):\n        return obj.info._represent_as_dict()\n\n    @classmethod\n    def from_tree(cls, tree, ctx):\n        return SkyCoord.info._construct_from_dict(tree)\n\n    @classmethod\n    def assert_equal(cls, old, new):\n        assert skycoord_equal(old, new)"},{"col":4,"comment":"null","endLoc":16,"header":"@classmethod\n    def to_tree(cls, obj, ctx)","id":5517,"name":"to_tree","nodeType":"Function","startLoc":14,"text":"@classmethod\n    def to_tree(cls, obj, ctx):\n        return obj.info._represent_as_dict()"},{"col":4,"comment":"null","endLoc":20,"header":"@classmethod\n    def from_tree(cls, tree, ctx)","id":5518,"name":"from_tree","nodeType":"Function","startLoc":18,"text":"@classmethod\n    def from_tree(cls, tree, ctx):\n        return SkyCoord.info._construct_from_dict(tree)"},{"attributeType":"null","col":0,"comment":"null","endLoc":45,"id":5519,"name":"_read_trace","nodeType":"Attribute","startLoc":45,"text":"_read_trace"},{"col":4,"comment":"\n        Initialize the header Column objects from the table ``lines``.\n\n        Based on the previously set Header attributes find or create the column names.\n        Sets ``self.cols`` with the list of Columns.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        ","endLoc":215,"header":"def get_cols(self, lines)","id":5520,"name":"get_cols","nodeType":"Function","startLoc":161,"text":"def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines``.\n\n        Based on the previously set Header attributes find or create the column names.\n        Sets ``self.cols`` with the list of Columns.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        \"\"\"\n        header_lines = self.process_lines(lines)  # generator returning valid header lines\n        header_vals = [vals for vals in self.splitter(header_lines)]\n        if len(header_vals) == 0:\n            raise ValueError('At least one header line beginning and ending with '\n                             'delimiter required')\n        elif len(header_vals) > 4:\n            raise ValueError('More than four header lines were found')\n\n        # Generate column definitions\n        cols = []\n        start = 1\n        for i, name in enumerate(header_vals[0]):\n            col = core.Column(name=name.strip(' -'))\n            col.start = start\n            col.end = start + len(name)\n            if len(header_vals) > 1:\n                col.raw_type = header_vals[1][i].strip(' -')\n                col.type = self.get_col_type(col)\n            if len(header_vals) > 2:\n                col.unit = header_vals[2][i].strip() or None  # Can't strip dashes here\n            if len(header_vals) > 3:\n                # The IPAC null value corresponds to the io.ascii bad_value.\n                # In this case there isn't a fill_value defined, so just put\n                # in the minimal entry that is sure to convert properly to the\n                # required type.\n                #\n                # Strip spaces but not dashes (not allowed in NULL row per\n                # https://github.com/astropy/astropy/issues/361)\n                null = header_vals[3][i].strip()\n                fillval = '' if issubclass(col.type, core.StrType) else '0'\n                self.data.fill_values.append((null, fillval, col.name))\n            start = col.end + 1\n            cols.append(col)\n\n            # Correct column start/end based on definition\n            if self.ipac_definition == 'right':\n                col.start -= 1\n            elif self.ipac_definition == 'left':\n                col.end += 1\n\n        self.names = [x.name for x in cols]\n        self.cols = cols"},{"attributeType":"null","col":0,"comment":"null","endLoc":48,"id":5521,"name":"_GUESS","nodeType":"Attribute","startLoc":48,"text":"_GUESS"},{"col":4,"comment":"null","endLoc":24,"header":"@classmethod\n    def assert_equal(cls, old, new)","id":5522,"name":"assert_equal","nodeType":"Function","startLoc":22,"text":"@classmethod\n    def assert_equal(cls, old, new):\n        assert skycoord_equal(old, new)"},{"attributeType":"null","col":0,"comment":"null","endLoc":739,"id":5523,"name":"extra_writer_pars","nodeType":"Attribute","startLoc":739,"text":"extra_writer_pars"},{"attributeType":"null","col":4,"comment":"null","endLoc":10,"id":5524,"name":"name","nodeType":"Attribute","startLoc":10,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":11,"id":5525,"name":"types","nodeType":"Attribute","startLoc":11,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":12,"id":5526,"name":"version","nodeType":"Attribute","startLoc":12,"text":"version"},{"col":0,"comment":"","endLoc":9,"header":"ui.py#<anonymous>","id":5527,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"An extensible ASCII table reader and writer.\n\nui.py:\n  Provides the main user functions for reading and writing tables.\n\n:Copyright: Smithsonian Astrophysical Observatory (2010)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\"\n\n_read_trace = []\n\n_GUESS = True\n\nread.__doc__ = core.READ_DOCSTRING\n\nextra_writer_pars = ('delimiter', 'comment', 'quotechar', 'formats',\n                     'names', 'include_names', 'exclude_names', 'strip_whitespace')\n\nwrite.__doc__ = core.WRITE_DOCSTRING"},{"id":5528,"name":"astropy/io/ascii/src","nodeType":"Package"},{"id":5529,"name":"tokenizer.h","nodeType":"TextFile","path":"astropy/io/ascii/src","text":"// Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n#ifndef TOKENIZER_H\n#define TOKENIZER_H\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#include <errno.h>\n#include <math.h>\n#include <float.h>\n#include <ctype.h>\n#include <sys/types.h>\n\n#ifdef _MSC_VER\n    #define inline __inline\n    #ifndef NAN\n        static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};\n        #define NAN (*(const double *) __nan)\n    #endif\n    #ifndef INFINITY\n        static const unsigned long __infinity[2] = {0x00000000, 0x7ff00000};\n        #define INFINITY (*(const double *) __infinity)\n    #endif\n#else\n    #ifndef INFINITY\n        #define INFINITY (1.0/0.0)\n    #endif\n    #ifndef NAN\n        #define NAN (INFINITY-INFINITY)\n    #endif\n#endif\n\ntypedef enum\n{\n    START_LINE = 0,\n    START_FIELD,\n    START_QUOTED_FIELD,\n    FIELD,\n    QUOTED_FIELD,\n    QUOTED_FIELD_NEWLINE,\n    QUOTED_FIELD_DOUBLE_QUOTE,\n    COMMENT,\n} tokenizer_state;\n\ntypedef enum\n{\n    NO_ERROR,\n    INVALID_LINE,\n    TOO_MANY_COLS,\n    NOT_ENOUGH_COLS,\n    CONVERSION_ERROR,\n    OVERFLOW_ERROR\n} err_code;\n\ntypedef struct\n{\n    char *source;          // single string containing all of the input\n    size_t source_len;      // length of the input\n    size_t source_pos;      // current index in source for tokenization\n    char delimiter;        // delimiter character\n    char comment;          // comment character\n    char quotechar;        // quote character\n    char expchar;          // exponential character in scientific notation\n    char newline;          // EOL character\n    char **output_cols;    // array of output strings for each column\n    char **col_ptrs;       // array of pointers to current output position for each col\n    size_t *output_len;    // length of each output column string\n    int num_cols;          // number of table columns\n    int num_rows;          // number of table rows\n    int fill_extra_cols;   // represents whether or not to fill rows with too few values\n    tokenizer_state state; // current state of the tokenizer\n    err_code code;         // represents the latest error that has occurred\n    int iter_col;          // index of the column being iterated over\n    char *curr_pos;        // current iteration position\n    char *buf;             // buffer for empty data\n    int strip_whitespace_lines;  // whether to strip whitespace at the beginning and end of lines\n    int strip_whitespace_fields; // whether to strip whitespace at the beginning and end of fields\n    int use_fast_converter;      // whether to use the fast converter for floats\n    char *comment_lines;   // single null-delimited string containing comment lines\n    int comment_lines_len; // length of comment_lines in memory\n    int comment_pos;       // current index in comment_lines\n} tokenizer_t;\n\n/*\nExample input/output\n--------------------\n\nsource: \"A,B,C\\n10,5.,6\\n1,2,3\"\noutput_cols: [\"A\\x0010\\x001\", \"B\\x005.\\x002\", \"C\\x006\\x003\"]\n*/\n\n#define INITIAL_COL_SIZE 500\n#define INITIAL_COMMENT_LEN 50\n\ntokenizer_t *create_tokenizer(char delimiter, char comment, char quotechar, char expchar,\n                              int fill_extra_cols, int strip_whitespace_lines,\n                              int strip_whitespace_fields, int use_fast_converter);\nvoid delete_tokenizer(tokenizer_t *tokenizer);\nvoid delete_data(tokenizer_t *tokenizer);\nvoid resize_col(tokenizer_t *self, int index);\nvoid resize_comments(tokenizer_t *self);\nint skip_lines(tokenizer_t *self, int offset, int header);\nint tokenize(tokenizer_t *self, int end, int header, int num_cols);\nlong str_to_long(tokenizer_t *self, char *str);\ndouble str_to_double(tokenizer_t *self, char *str);\ndouble xstrtod(const char *str, char **endptr, char decimal,\n               char expchar, char tsep, int skip_trailing);\nvoid start_iteration(tokenizer_t *self, int col);\nchar *next_field(tokenizer_t *self, int *size);\nlong file_len(FILE *fhandle);\nchar *get_line(char *ptr, size_t *len, size_t map_len);\nvoid reset_comments(tokenizer_t *self);\n\n#endif\n"},{"id":5530,"name":"tokenizer.c","nodeType":"TextFile","path":"astropy/io/ascii/src","text":"// Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n#include \"tokenizer.h\"\n\ntokenizer_t *create_tokenizer(char delimiter, char comment, char quotechar, char expchar,\n                              int fill_extra_cols, int strip_whitespace_lines,\n                              int strip_whitespace_fields, int use_fast_converter)\n{\n    // Create the tokenizer in memory\n    tokenizer_t *tokenizer = (tokenizer_t *) malloc(sizeof(tokenizer_t));\n\n    // Initialize the tokenizer fields\n    tokenizer->source = NULL;\n    tokenizer->source_len = 0;\n    tokenizer->source_pos = 0;\n    tokenizer->delimiter = delimiter;\n    tokenizer->comment = comment;\n    tokenizer->quotechar = quotechar;\n    tokenizer->expchar = expchar;\n    tokenizer->newline = '\\n';\n    tokenizer->output_cols = NULL;\n    tokenizer->col_ptrs = NULL;\n    tokenizer->output_len = NULL;\n    tokenizer->num_cols = 0;\n    tokenizer->num_rows = 0;\n    tokenizer->fill_extra_cols = fill_extra_cols;\n    tokenizer->state = START_LINE;\n    tokenizer->code = NO_ERROR;\n    tokenizer->iter_col = 0;\n    tokenizer->curr_pos = NULL;\n    tokenizer->strip_whitespace_lines = strip_whitespace_lines;\n    tokenizer->strip_whitespace_fields = strip_whitespace_fields;\n    tokenizer->use_fast_converter = use_fast_converter;\n    tokenizer->comment_lines = (char *) malloc(INITIAL_COMMENT_LEN);\n    tokenizer->comment_pos = 0;\n    tokenizer->comment_lines_len = 0;\n\n    // This is a bit of a hack -- buf holds an empty string to represent\n    // empty field values\n    tokenizer->buf = calloc(2, sizeof(char));\n\n    // By default both \\n and \\r are accepted as newline, unless one of\n    // them has also been specified as field delimiter\n    if (tokenizer->delimiter == '\\n')\n        tokenizer->newline = '\\r';\n\n    return tokenizer;\n}\n\n\nvoid delete_data(tokenizer_t *tokenizer)\n{\n    // Don't free tokenizer->source because it points to part of\n    // an already freed Python object\n    int i;\n\n    if (tokenizer->output_cols)\n    {\n        for (i = 0; i < tokenizer->num_cols; ++i)\n        {\n            free(tokenizer->output_cols[i]);\n        }\n    }\n\n    free(tokenizer->output_cols);\n    free(tokenizer->col_ptrs);\n    free(tokenizer->output_len);\n\n    // Set pointers to 0 so we don't use freed memory when reading over again\n    tokenizer->output_cols = 0;\n    tokenizer->col_ptrs = 0;\n    tokenizer->output_len = 0;\n}\n\n\nvoid delete_tokenizer(tokenizer_t *tokenizer)\n{\n    delete_data(tokenizer);\n    free(tokenizer->comment_lines);\n    free(tokenizer->buf);\n    free(tokenizer);\n}\n\n\nvoid resize_col(tokenizer_t *self, int index)\n{\n    // Temporarily store the position in output_cols[index] to\n    // which col_ptrs[index] points\n    long diff = self->col_ptrs[index] - self->output_cols[index];\n\n    // Double the size of the column string\n    self->output_cols[index] = (char *) realloc(self->output_cols[index], 2 *\n                                                self->output_len[index] * sizeof(char));\n\n    // Set the second (newly allocated) half of the column string to all zeros\n    memset(self->output_cols[index] + self->output_len[index] * sizeof(char), 0,\n           self->output_len[index] * sizeof(char));\n\n    self->output_len[index] *= 2;\n    // realloc() might move the address in memory, so we have to move\n    // col_ptrs[index] to an offset of the new address\n    self->col_ptrs[index] = self->output_cols[index] + diff;\n}\n\n\nvoid resize_comments(tokenizer_t *self)\n{\n    // Double the size of the comments string\n    self->comment_lines = (char *) realloc(self->comment_lines,\n                                           self->comment_pos + 1);\n    // Set the second (newly allocated) half of the column string to all zeros\n    memset(self->comment_lines + self->comment_lines_len * sizeof(char), 0,\n           (self->comment_pos + 1 - self->comment_lines_len) * sizeof(char));\n\n    self->comment_lines_len = self->comment_pos + 1;\n}\n\n/*\n  Resize the column string if necessary and then append c to the\n  end of the column string, incrementing the column position pointer.\n*/\nstatic inline void push(tokenizer_t *self, char c, int col)\n{\n    if (self->col_ptrs[col] - self->output_cols[col] >=\n        self->output_len[col])\n    {\n        resize_col(self, col);\n    }\n\n    *self->col_ptrs[col]++ = c;\n}\n\n\n/*\n  Resize the comment string if necessary and then append c to the\n  end of the comment string.\n*/\nstatic inline void push_comment(tokenizer_t *self, char c)\n{\n    if (self->comment_pos >= self->comment_lines_len)\n    {\n        resize_comments(self);\n    }\n    self->comment_lines[self->comment_pos++] = c;\n}\n\n\nstatic inline void end_comment(tokenizer_t *self)\n{\n    // Signal empty comment by inserting \\x01\n    if (self->comment_pos == 0 || self->comment_lines[self->comment_pos - 1] == '\\x00')\n    {\n        push_comment(self, '\\x01');\n    }\n    push_comment(self, '\\x00');\n}\n\n\n#define PUSH(c) push(self, c, col)\n\n\n/* Set the state to START_FIELD and begin with the assumption that\n   the field is entirely whitespace in order to handle the possibility\n   that the comment character is found before any non-whitespace even\n   if whitespace stripping is disabled.\n*/\n#define BEGIN_FIELD()                           \\\n    self->state = START_FIELD;                  \\\n    whitespace = 1\n\n\n/*\n  First, backtrack to eliminate trailing whitespace if strip_whitespace_fields\n  is true. If the field is empty, push '\\x01' as a marker.\n  Append a null byte to the end of the column string as a field delimiting marker.\n  Increment the variable col if we are tokenizing data.\n*/\nstatic inline void end_field(tokenizer_t *self, int *col, int header)\n{\n    if (self->strip_whitespace_fields &&\n            self->col_ptrs[*col] != self->output_cols[*col])\n    {\n        --self->col_ptrs[*col];\n        while (*self->col_ptrs[*col] == ' ' || *self->col_ptrs[*col] == '\\t')\n        {\n            *self->col_ptrs[*col]-- = '\\x00';\n        }\n        ++self->col_ptrs[*col];\n    }\n    if (self->col_ptrs[*col] == self->output_cols[*col] ||\n            self->col_ptrs[*col][-1] == '\\x00')\n    {\n        push(self, '\\x01', *col);\n    }\n    push(self, '\\x00', *col);\n    if (!header) {\n        ++*col;\n    }\n}\n\n\n#define END_FIELD() end_field(self, &col, header)\n\n\n// Set the error code to c for later retrieval and return c\n#define RETURN(c)                                               \\\n    do {                                                        \\\n        self->code = c;                                         \\\n        return c;                                               \\\n    } while (0)\n\n\n/*\n  If we are tokenizing the header, end after the first line.\n  Handle the possibility of insufficient columns appropriately;\n  if fill_extra_cols=1, then append empty fields, but otherwise\n  return an error. Increment our row count and possibly end if\n  all the necessary rows have already been parsed.\n*/\nstatic inline int end_line(tokenizer_t *self, int col, int header, int end,\n                           tokenizer_state *old_state)\n{\n    if (header)\n    {\n        ++self->source_pos;\n        RETURN(NO_ERROR);\n    }\n    else if (self->fill_extra_cols)\n    {\n        while (col < self->num_cols)\n        {\n                PUSH('\\x01');\n            END_FIELD();\n        }\n    }\n    else if (col < self->num_cols)\n    {\n        RETURN(NOT_ENOUGH_COLS);\n    }\n\n    ++self->num_rows;\n    *old_state = START_LINE;\n\n    if (end != -1 && self->num_rows == end)\n    {\n        ++self->source_pos;\n        RETURN(NO_ERROR);\n    }\n    return -1;\n}\n\n\n#define END_LINE() if (end_line(self, col, header, end, &old_state) != -1) return self->code\n\n\nint skip_lines(tokenizer_t *self, int offset, int header)\n{\n    int signif_chars = 0;\n    int comment = 0;\n    int i = 0;\n    char c;\n\n    while (i < offset)\n    {\n        if (self->source_pos >= self->source_len)\n        {\n            if (header)\n                RETURN(INVALID_LINE); // header line is required\n            else\n                RETURN(NO_ERROR); // no data in input\n        }\n\n        c = self->source[self->source_pos];\n\n        if ((c == '\\r' || c == '\\n') && c != self->delimiter)\n        {\n            if (c == '\\r' && self->source_pos < self->source_len - 1 &&\n                self->source[self->source_pos + 1] == '\\n')\n            {\n                ++self->source_pos; // skip \\n in \\r\\n\n            }\n            if (!comment && signif_chars > 0)\n                ++i;\n            else if (comment && !header)\n                end_comment(self);\n            // Start by assuming a line is empty and non-commented\n            signif_chars = 0;\n            comment = 0;\n        }\n        else if ((c != ' ' && c != '\\t') || !self->strip_whitespace_lines)\n        {\n                // Comment line\n                if (!signif_chars && self->comment != 0 && c == self->comment)\n                    comment = 1;\n                else if (comment && !header)\n                    push_comment(self, c);\n\n                // Significant character encountered\n                ++signif_chars;\n        }\n        else if (comment && !header)\n        {\n            push_comment(self, c);\n        }\n\n            ++self->source_pos;\n    }\n\n    RETURN(NO_ERROR);\n}\n\n\nint tokenize(tokenizer_t *self, int end, int header, int num_cols)\n{\n    char c; // Input character\n    int col = 0; // Current column ignoring possibly excluded columns\n    tokenizer_state old_state = START_LINE; // Last state the tokenizer was in before CR mode\n    int i = 0;\n    int whitespace = 1;\n    delete_data(self); // Clear old reading data\n    self->num_rows = 0;\n    self->comment_lines_len = INITIAL_COMMENT_LEN;\n\n    if (header)\n        self->num_cols = 1; // Store header output in one column\n    else\n        self->num_cols = num_cols;\n\n    // Allocate memory for structures used during tokenization\n    self->output_cols = (char **) malloc(self->num_cols * sizeof(char *));\n    self->col_ptrs = (char **) malloc(self->num_cols * sizeof(char *));\n    self->output_len = (size_t *) malloc(self->num_cols * sizeof(size_t));\n\n    for (i = 0; i < self->num_cols; ++i)\n    {\n        self->output_cols[i] = (char *) calloc(1, INITIAL_COL_SIZE *\n                                               sizeof(char));\n        // Make each col_ptrs pointer point to the beginning of the\n        // column string\n        self->col_ptrs[i] = self->output_cols[i];\n        self->output_len[i] = INITIAL_COL_SIZE;\n    }\n\n    if (end == 0)\n        RETURN(NO_ERROR); // Don't read if end == 0\n\n    self->state = START_LINE;\n\n    // Loop until all of self->source has been read\n    while (self->source_pos < self->source_len + 1)\n    {\n        if (self->source_pos == self->source_len)\n            c = self->newline;\n        else\n            c = self->source[self->source_pos];\n\n        if (c == '\\r' && c != self->delimiter && c != self->newline)\n            c = '\\n';\n\n        switch (self->state)\n        {\n        case START_LINE:\n            if (c == self->newline)\n                break;\n            else if ((c == ' ' || c == '\\t') && self->strip_whitespace_lines)\n                break;\n            else if (self->comment != 0 && c == self->comment)\n            {\n                // Comment line; ignore\n                self->state = COMMENT;\n                break;\n            }\n            // Initialize variables for the beginning of line parsing\n            col = 0;\n            BEGIN_FIELD();\n            // Parse in mode START_FIELD\n\n        case START_FIELD:\n            // Strip whitespace before field begins\n            if ((c == ' ' || c == '\\t') && self->strip_whitespace_fields)\n                break;\n            else if (!self->strip_whitespace_lines && self->comment != 0 &&\n                     c == self->comment)\n            {\n                // Comment line, not caught earlier because of no stripping\n                self->state = COMMENT;\n                break;\n            }\n            // Handle newline characters first\n            else if (c == self->newline)\n            {\n                if (self->strip_whitespace_lines)\n                {\n                    // Move on if the delimiter is whitespace, e.g.\n                    // '1 2 3   '->['1','2','3']\n                    if (self->delimiter == ' ' || self->delimiter == '\\t')\n                        ;\n                    // Register an empty field if non-whitespace delimiter,\n                    // e.g. '1,2, '->['1','2','']\n                    else\n                    {\n                        if (col >= self->num_cols)\n                            RETURN(TOO_MANY_COLS);\n                        END_FIELD();\n                    }\n                }\n\n                else if (!self->strip_whitespace_lines)\n                {\n                    // In this case we don't want to left-strip the field,\n                    // so we backtrack\n                    size_t tmp = self->source_pos;\n                    --self->source_pos;\n\n                    while (self->source_pos >= 0 &&\n                           self->source[self->source_pos] != self->delimiter\n                           && self->source[self->source_pos] != '\\n'\n                           && self->source[self->source_pos] != '\\r')\n                    {\n                        --self->source_pos;\n                    }\n\n                    // Backtracked to line beginning\n                    if (self->source_pos == -1\n                        || self->source[self->source_pos] == '\\n'\n                        || self->source[self->source_pos] == '\\r')\n                    {\n                        self->source_pos = tmp;\n                    }\n                    else\n                    {\n                        ++self->source_pos;\n\n                        if (self->source_pos == tmp)\n                            // No whitespace, just an empty field\n                            ;\n                        else\n                            while (self->source_pos < tmp)\n                            {\n                                // Append whitespace characters\n                                PUSH(self->source[self->source_pos]);\n                                ++self->source_pos;\n                            }\n\n                        if (col >= self->num_cols)\n                            RETURN(TOO_MANY_COLS);\n                        END_FIELD(); // Whitespace counts as a field\n                    }\n                }\n\n                END_LINE();\n                self->state = START_LINE;\n                break;\n            }\n\n            // Before proceeding with a new field check column does not exceed\n            // number defined in header or from auto-detect to avoid segfaults\n            // such as https://github.com/astropy/astropy/issues/9922\n            else if (col >= self->num_cols)\n                RETURN(TOO_MANY_COLS);\n            else if (c == self->delimiter) // Field ends before it begins\n            {\n                END_FIELD();\n                BEGIN_FIELD();\n                break;\n            }\n            else if (c == self->quotechar) // Start parsing quoted field\n            {\n                self->state = START_QUOTED_FIELD;\n                break;\n            }\n            else // Valid field character, parse again in FIELD mode\n                self->state = FIELD;\n\n        case FIELD:\n            if (self->comment != 0 && c == self->comment && whitespace && col == 0)\n                // No whitespace stripping, but the comment char is found\n                // before any data, e.g. '  # a b c'\n                self->state = COMMENT;\n            else if (c == self->delimiter && self->source_pos < self->source_len)\n            {\n                // End of field, look for new field\n                END_FIELD();\n                BEGIN_FIELD();\n            }\n            else if (c == self->newline)\n            {\n                // Line ending, stop parsing both field and line\n                END_FIELD();\n                END_LINE();\n                self->state = START_LINE;\n            }\n            else\n            {\n                if (c != ' ' && c != '\\t')\n                    whitespace = 0; // Field is not all whitespace\n                PUSH(c);\n            }\n            break;\n\n        case START_QUOTED_FIELD:\n            if ((c == ' ' || c == '\\t') && self->strip_whitespace_fields)\n            {\n                // Ignore initial whitespace\n                break;\n            }\n            else if (c == self->quotechar)\n            {\n                // Lookahead check for double quote inside quoted field,\n                // e.g. \"\"\"cd\" => \"cd\n                if (self->source_pos < self->source_len - 1)\n                {\n                    if (self->source[self->source_pos + 1] == self->quotechar)\n                    {\n                        self->state = QUOTED_FIELD_DOUBLE_QUOTE;\n                        PUSH(c);\n                        break;\n                    }\n                }\n                // Parse rest of field normally, e.g. \"\"c\n                self->state = FIELD;\n            }\n            else\n            {\n                // Valid field character, parse again in QUOTED_FIELD mode\n                self->state = QUOTED_FIELD;\n            }\n\n        case QUOTED_FIELD:\n            if (c == self->quotechar)\n            {\n                // Lookahead check for double quote inside quoted field,\n                // e.g. \"ab\"\"cd\" => ab\"cd\n                if (self->source_pos < self->source_len - 1)\n                {\n                    if (self->source[self->source_pos + 1] == self->quotechar)\n                    {\n                        self->state = QUOTED_FIELD_DOUBLE_QUOTE;\n                        PUSH(c);\n                        break;\n                    }\n                }\n                // Parse rest of field normally, e.g. \"ab\"c\n                self->state = FIELD;\n            }\n            else\n            {\n                PUSH(c);\n            }\n            break;\n\n        case QUOTED_FIELD_DOUBLE_QUOTE:\n            // Ignore the second double quote from \"ab\"\"cd\" and parse rest of\n            // field normally as quoted field.\n            self->state = QUOTED_FIELD;\n            break;\n\n        case COMMENT:\n            if (c == self->newline)\n            {\n                self->state = START_LINE;\n                if (!header)\n                    end_comment(self);\n            }\n            else if (!header)\n                push_comment(self, c);\n            break; // Keep looping until we find a newline\n\n        }\n\n        ++self->source_pos;\n    }\n\n    RETURN(0);\n}\n\n\nstatic int ascii_strncasecmp(const char *str1, const char *str2, size_t n)\n{\n    int char1, char2;\n\n    do\n    {\n        char1 = tolower(*(str1++));\n        char2 = tolower(*(str2++));\n        n--;\n    } while (n && char1 != '\\0' && char1 == char2);\n\n    return (char1 - char2);\n}\n\n\nlong str_to_long(tokenizer_t *self, char *str)\n{\n    char *tmp;\n    long ret;\n    errno = 0;\n    ret = strtol(str, &tmp, 10);\n\n    if (tmp == str || *tmp != '\\0')\n        self->code = CONVERSION_ERROR;\n    else if (errno == ERANGE)\n        self->code = OVERFLOW_ERROR;\n\n    return ret;\n}\n\n\ndouble str_to_double(tokenizer_t *self, char *str)\n{\n    char *tmp;\n    double val;\n    errno = 0;\n\n    if (self->use_fast_converter)\n    {\n        val = xstrtod(str, &tmp, '.', self->expchar, ',', 1);\n\n        if (errno == EINVAL || tmp == str || *tmp != '\\0')\n        {\n            goto conversion_error;\n        }\n        else if (errno == ERANGE)\n        {\n            self->code = OVERFLOW_ERROR;\n        }\n        else if (errno == EDOM)        // xstrtod signalling invalid exponents\n        {\n            self->code = CONVERSION_ERROR;\n        }\n\n        return val;\n    }\n\n    else\n    {\n        val = strtod(str, &tmp);\n\n        if (errno == EINVAL || tmp == str || *tmp != '\\0')\n        {\n            goto conversion_error;\n        }\n        else if (errno == ERANGE)\n        {\n            self->code = OVERFLOW_ERROR;\n        }\n        else if (errno == EDOM)\n        {\n            self->code = CONVERSION_ERROR;\n        }\n\n        return val;\n    }\n\nconversion_error:\n    // Handle inf and nan values for xstrtod and platforms whose strtod\n    // doesn't support this\n    val = 1.0;\n    tmp = str;\n\n    if (*tmp == '+')\n    {\n        tmp++;\n    }\n    else if (*tmp == '-')\n    {\n        tmp++;\n        val = -1.0;\n    }\n\n    if (0 == ascii_strncasecmp(tmp, \"nan\", 3))\n    {\n        // Handle optional nan type specifier; this is ignored\n        tmp += 3;\n        val = NAN;\n    }\n    else if (0 == ascii_strncasecmp(tmp, \"inf\", 3))\n    {\n        tmp += 3;\n        if (0 == ascii_strncasecmp(tmp, \"inity\", 5))\n        {\n            tmp += 5;\n        }\n        val *= INFINITY;\n    }\n    else\n    {\n       // Original (tmp == str || *tmp != '\\0') case, no NaN or inf found\n        self->code = CONVERSION_ERROR;\n        val = 0;\n    }\n\n    return val;\n}\n\n// ---------------------------------------------------------------------------\n// Implementation of xstrtod\n\n//\n// strtod.c\n//\n// Convert string to double\n//\n// Copyright (C) 2002 Michael Ringgaard. All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions\n// are met:\n//\n// 1. Redistributions of source code must retain the above copyright\n//    notice, this list of conditions and the following disclaimer.\n// 2. Redistributions in binary form must reproduce the above copyright\n//    notice, this list of conditions and the following disclaimer in the\n//    documentation and/or other materials provided with the distribution.\n// 3. Neither the name of the project nor the names of its contributors\n//    may be used to endorse or promote products derived from this software\n//    without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n// ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\n// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n// SUCH DAMAGE.\n//\n// -----------------------------------------------------------------------\n// Modifications by Warren Weckesser, March 2011:\n// * Rename strtod() to xstrtod().\n// * Added decimal and sci arguments.\n// * Skip trailing spaces.\n// * Commented out the other functions.\n// Modifications by Richard T Guy, August 2013:\n// * Add tsep argument for thousands separator\n// Modifications by Michael Mueller, August 2014:\n// * Cache powers of 10 in memory to avoid rounding errors\n// * Stop parsing decimals after 17 significant figures\n// Modifications by Derek Homeier, August 2015:\n// * Recognise alternative exponent characters passed in 'sci'; try automatic\n//   detection of allowed Fortran formats with sci='A'\n// * Require exactly 3 digits in exponent for Fortran-type format '8.7654+321'\n// Modifications by Derek Homeier, September-December 2016:\n// * Fixed some corner cases of very large or small exponents; proper return\n// * do not increment num_digits until nonzero digit read in\n//\n\ndouble xstrtod(const char *str, char **endptr, char decimal,\n               char expchar, char tsep, int skip_trailing)\n{\n    double number;\n    int exponent;\n    int negative;\n    char *p = (char *) str;\n    char exp;\n    char sci;\n    int num_digits;\n    int num_decimals;\n    int max_digits = 17;\n    int num_exp = 3;\n    int non_zero;\n    int n;\n    // Cache powers of 10 in memory\n    static double e[] = {1., 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10,\n                         1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e20,\n                         1e21, 1e22, 1e23, 1e24, 1e25, 1e26, 1e27, 1e28, 1e29, 1e30,\n                         1e31, 1e32, 1e33, 1e34, 1e35, 1e36, 1e37, 1e38, 1e39, 1e40,\n                         1e41, 1e42, 1e43, 1e44, 1e45, 1e46, 1e47, 1e48, 1e49, 1e50,\n                         1e51, 1e52, 1e53, 1e54, 1e55, 1e56, 1e57, 1e58, 1e59, 1e60,\n                         1e61, 1e62, 1e63, 1e64, 1e65, 1e66, 1e67, 1e68, 1e69, 1e70,\n                         1e71, 1e72, 1e73, 1e74, 1e75, 1e76, 1e77, 1e78, 1e79, 1e80,\n                         1e81, 1e82, 1e83, 1e84, 1e85, 1e86, 1e87, 1e88, 1e89, 1e90,\n                         1e91, 1e92, 1e93, 1e94, 1e95, 1e96, 1e97, 1e98, 1e99, 1e100,\n                         1e101, 1e102, 1e103, 1e104, 1e105, 1e106, 1e107, 1e108, 1e109, 1e110,\n                         1e111, 1e112, 1e113, 1e114, 1e115, 1e116, 1e117, 1e118, 1e119, 1e120,\n                         1e121, 1e122, 1e123, 1e124, 1e125, 1e126, 1e127, 1e128, 1e129, 1e130,\n                         1e131, 1e132, 1e133, 1e134, 1e135, 1e136, 1e137, 1e138, 1e139, 1e140,\n                         1e141, 1e142, 1e143, 1e144, 1e145, 1e146, 1e147, 1e148, 1e149, 1e150,\n                         1e151, 1e152, 1e153, 1e154, 1e155, 1e156, 1e157, 1e158, 1e159, 1e160,\n                         1e161, 1e162, 1e163, 1e164, 1e165, 1e166, 1e167, 1e168, 1e169, 1e170,\n                         1e171, 1e172, 1e173, 1e174, 1e175, 1e176, 1e177, 1e178, 1e179, 1e180,\n                         1e181, 1e182, 1e183, 1e184, 1e185, 1e186, 1e187, 1e188, 1e189, 1e190,\n                         1e191, 1e192, 1e193, 1e194, 1e195, 1e196, 1e197, 1e198, 1e199, 1e200,\n                         1e201, 1e202, 1e203, 1e204, 1e205, 1e206, 1e207, 1e208, 1e209, 1e210,\n                         1e211, 1e212, 1e213, 1e214, 1e215, 1e216, 1e217, 1e218, 1e219, 1e220,\n                         1e221, 1e222, 1e223, 1e224, 1e225, 1e226, 1e227, 1e228, 1e229, 1e230,\n                         1e231, 1e232, 1e233, 1e234, 1e235, 1e236, 1e237, 1e238, 1e239, 1e240,\n                         1e241, 1e242, 1e243, 1e244, 1e245, 1e246, 1e247, 1e248, 1e249, 1e250,\n                         1e251, 1e252, 1e253, 1e254, 1e255, 1e256, 1e257, 1e258, 1e259, 1e260,\n                         1e261, 1e262, 1e263, 1e264, 1e265, 1e266, 1e267, 1e268, 1e269, 1e270,\n                         1e271, 1e272, 1e273, 1e274, 1e275, 1e276, 1e277, 1e278, 1e279, 1e280,\n                         1e281, 1e282, 1e283, 1e284, 1e285, 1e286, 1e287, 1e288, 1e289, 1e290,\n                         1e291, 1e292, 1e293, 1e294, 1e295, 1e296, 1e297, 1e298, 1e299, 1e300,\n                         1e301, 1e302, 1e303, 1e304, 1e305, 1e306, 1e307, 1e308};\n    // Cache additional negative powers of 10\n    /* static double m[] = {1e-309, 1e-310, 1e-311, 1e-312, 1e-313, 1e-314,\n                         1e-315, 1e-316, 1e-317, 1e-318, 1e-319, 1e-320,\n                         1e-321, 1e-322, 1e-323}; */\n    errno = 0;\n\n    // Skip leading whitespace\n    while (isspace(*p)) p++;\n\n    // Handle optional sign\n    negative = 0;\n    switch (*p)\n    {\n    case '-': negative = 1; // Fall through to increment position\n    case '+': p++;\n    }\n\n    // No numerical value following sign - make no conversion and return zero,\n    // resetting endptr to beginning of str (consistent with strtod behaviour)\n    // E.g. -1.e0 and -.0e1 are valid, -.e0 is not!\n    if (!(isdigit(*p) || (*p == decimal && isdigit(*(p + 1)))))\n    {\n        if (endptr) *endptr = (char *) str;\n        return 0e0;\n    }\n\n    number = 0.;\n    exponent = 0;\n    num_digits = 0;\n    num_decimals = 0;\n    non_zero = 0;\n\n    // Process string of digits\n    while (isdigit(*p))\n    {\n        if (num_digits < max_digits)\n        {\n            number = number * 10. + (*p - '0');\n            non_zero += (*p != '0');\n            if(non_zero) num_digits++;\n        }\n        else\n            ++exponent;\n\n        p++;\n        p += (tsep != '\\0' && *p == tsep);\n    }\n\n    // Process decimal part\n    if (*p == decimal)\n    {\n        p++;\n\n        while (num_digits < max_digits && isdigit(*p))\n        {\n            number = number * 10. + (*p - '0');\n            non_zero += (*p != '0');\n            if(non_zero) num_digits++;\n            num_decimals++;\n            p++;\n        }\n\n        if (num_digits >= max_digits) // consume extra decimal digits\n            while (isdigit(*p))\n                ++p;\n\n        exponent -= num_decimals;\n    }\n\n    // Exactly 0 - no precision loss/OverflowError\n    if (num_digits == 0) number = 0.0;\n\n    // Correct for sign\n    if (negative) number = -number;\n\n    // Process an exponent string\n    sci = toupper(expchar);\n    if (sci == 'A')\n    {\n        // check for possible Fortran exponential notations, including\n        // triple-digits with no character\n        exp = toupper(*p);\n        if (exp == 'E' || exp == 'D' || exp == 'Q' || *p == '+' || *p == '-')\n        {\n            // Handle optional sign\n            negative = 0;\n            switch (exp)\n            {\n            case '-':\n                negative = 1;   // Fall through to increment pos\n            case '+':\n                p++;\n                break;\n            case 'E':\n            case 'D':\n            case 'Q':\n                switch (*++p)\n                {\n                case '-':\n                    negative = 1;   // Fall through to increment pos\n                case '+':\n                    p++;\n                }\n            }\n\n            // Process string of digits\n            n = 0;\n            while (isdigit(*p))\n            {\n                n = n * 10 + (*p - '0');\n                num_exp--;\n                p++;\n            }\n            // Trigger error if not exactly three digits\n            if (num_exp != 0 && (exp == '+' || exp == '-'))\n            {\n               errno = EDOM;\n               number = 0.0;\n            }\n\n            if (negative)\n                exponent -= n;\n            else\n                exponent += n;\n        }\n    }\n    else if (toupper(*p) == sci)\n    {\n        // Handle optional sign\n        negative = 0;\n        switch (*++p)\n        {\n        case '-':\n            negative = 1;   // Fall through to increment pos\n        case '+':\n            p++;\n        }\n\n        // Process string of digits\n        n = 0;\n        while (isdigit(*p))\n        {\n            n = n * 10 + (*p - '0');\n            p++;\n        }\n\n        if (negative)\n            exponent -= n;\n        else\n            exponent += n;\n    }\n\n    // largest representable float64 is 1.7977e+308, closest to 0 ~4.94e-324,\n    // but multiplying exponents in in two steps gives slightly better precision\n    if (number != 0.0) {\n        if (exponent > 305)\n        {\n            if (exponent > 308)   // leading zeros already subtracted from exp\n                number *= HUGE_VAL;\n            else\n            {\n                number *= e[exponent-300];\n                number *= 1.e300;\n            }\n        }\n        else if (exponent < -308) // subnormal\n        {\n            if (exponent < -616) // prevent invalid array access\n                number = 0.;\n            else\n            {\n                number /= e[-308-exponent];\n                number *= 1.e-308;\n            }\n            // trigger warning if resolution is > ~1.e-15;\n            // strtod does so for |number| <~ 2.25e-308\n            // if (number > -4.94e-309 && number < 4.94e-309)\n            errno = ERANGE;\n        }\n        else if (exponent > 0)\n            number *= e[exponent];\n        else if (exponent < 0)\n            number /= e[-exponent];\n\n        if (number >= HUGE_VAL || number <= -HUGE_VAL)\n            errno = ERANGE;\n    }\n\n    if (skip_trailing) {\n        // Skip trailing whitespace\n        while (isspace(*p)) p++;\n    }\n\n    if (endptr) *endptr = p;\n    return number;\n}\n\n\nvoid start_iteration(tokenizer_t *self, int col)\n{\n    // Begin looping over the column string with index col\n    self->iter_col = col;\n    // Start at the initial pointer position\n    self->curr_pos = self->output_cols[col];\n}\n\n\nchar *next_field(tokenizer_t *self, int *size)\n{\n    char *tmp = self->curr_pos;\n\n    // pass through the entire field until reaching the delimiter\n    while (*self->curr_pos != '\\x00')\n    ++self->curr_pos;\n\n    ++self->curr_pos; // next field begins after the delimiter\n\n    if (*tmp == '\\x01') // empty field; this is a hack\n    {\n        if (size)\n            *size = 0;\n        return self->buf;\n    }\n\n    else\n    {\n        if (size)\n            *size = self->curr_pos - tmp - 1;\n        return tmp;\n    }\n}\n\n\nchar *get_line(char *ptr, size_t *len, size_t map_len)\n{\n    size_t pos = 0;\n\n    while (pos < map_len)\n    {\n        if (ptr[pos] == '\\r')\n        {\n            *len = pos;\n            // Windows line break (\\r\\n)\n            if (pos != map_len - 1 && ptr[pos + 1] == '\\n')\n                return ptr + pos + 2; // skip newline character\n            else // Carriage return line break\n                return ptr + pos + 1;\n        }\n\n        else if (ptr[pos] == '\\n')\n        {\n            *len = pos;\n            return ptr + pos + 1;\n        }\n\n        ++pos;\n    }\n\n    // done with input\n    return 0;\n}\n\n\nvoid reset_comments(tokenizer_t *self)\n{\n    free(self->comment_lines);\n    self->comment_pos = 0;\n    self->comment_lines_len = INITIAL_COMMENT_LEN;\n    self->comment_lines = (char *) malloc(INITIAL_COMMENT_LEN);\n}\n"},{"col":4,"comment":"\n        Extract info from a header keyword line (#K)\n        ","endLoc":143,"header":"def extract_keyword_line(self, line)","id":5531,"name":"extract_keyword_line","nodeType":"Function","startLoc":133,"text":"def extract_keyword_line(self, line):\n        \"\"\"\n        Extract info from a header keyword line (#K)\n        \"\"\"\n        m = self.re_header_keyword.match(line)\n        if m:\n            vals = m.group('stuff').strip().rsplit(None, 2)\n            keyword_dict = {'units': vals[-2],\n                            'format': vals[-1],\n                            'value': (vals[0] if len(vals) > 2 else \"\")}\n            return m.group('name'), keyword_dict"},{"id":5532,"name":"astropy/io/ascii/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/ascii/tests","id":5533,"nodeType":"File","text":""},{"fileName":"common.py","filePath":"astropy/io/ascii/tests","id":5534,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\n\nimport numpy as np\n\nfrom astropy.utils.decorators import deprecated\n\n__all__ = ['assert_equal', 'assert_almost_equal',\n           'assert_true', 'setup_function', 'teardown_function',\n           'has_isnan']\n\nCWD = os.getcwd()\nTEST_DIR = os.path.dirname(__file__)\n\nhas_isnan = True\ntry:\n    from math import isnan  # noqa\nexcept ImportError:\n    try:\n        from numpy import isnan  # noqa\n    except ImportError:\n        has_isnan = False\n        print('Tests requiring isnan will fail')\n\n\ndef setup_function(function):\n    os.chdir(TEST_DIR)\n\n\ndef teardown_function(function):\n    os.chdir(CWD)\n\n\n# Compatibility functions to convert from nose to pytest\ndef assert_equal(a, b):\n    assert a == b\n\n\ndef assert_almost_equal(a, b, **kwargs):\n    assert np.allclose(a, b, **kwargs)\n\n\ndef assert_true(a):\n    assert a\n\n\ndef make_decorator(func):\n    \"\"\"\n    Wraps a test decorator so as to properly replicate metadata\n    of the decorated function, including nose's additional stuff\n    (namely, setup and teardown).\n    \"\"\"\n    def decorate(newfunc):\n        if hasattr(func, 'compat_func_name'):\n            name = func.compat_func_name\n        else:\n            name = func.__name__\n        newfunc.__dict__ = func.__dict__\n        newfunc.__doc__ = func.__doc__\n        newfunc.__module__ = func.__module__\n        if not hasattr(newfunc, 'compat_co_firstlineno'):\n            try:\n                newfunc.compat_co_firstlineno = func.func_code.co_firstlineno\n            except AttributeError:\n                newfunc.compat_co_firstlineno = func.__code__.co_firstlineno\n        try:\n            newfunc.__name__ = name\n        except TypeError:\n            # can't set func name in 2.3\n            newfunc.compat_func_name = name\n        return newfunc\n    return decorate\n\n\n@deprecated('5.1', alternative='pytest.raises')\ndef raises(*exceptions):\n    \"\"\"Test must raise one of expected exceptions to pass.\n\n    Example use::\n\n      @raises(TypeError, ValueError)\n      def test_raises_type_error():\n          raise TypeError(\"This test passes\")\n\n      @raises(Exception)\n      def test_that_fails_by_passing():\n          pass\n\n    \"\"\"\n    valid = ' or '.join([e.__name__ for e in exceptions])\n\n    def decorate(func):\n        name = func.__name__\n\n        def newfunc(*arg, **kw):\n            try:\n                func(*arg, **kw)\n            except exceptions:\n                pass\n            else:\n                message = f\"{name}() did not raise {valid}\"\n                raise AssertionError(message)\n        newfunc = make_decorator(func)(newfunc)\n        return newfunc\n    return decorate\n"},{"col":0,"comment":"\n    Used to mark a function or class as deprecated.\n\n    To mark an attribute as deprecated, use `deprecated_attribute`.\n\n    Parameters\n    ----------\n    since : str\n        The release at which this API became deprecated.  This is\n        required.\n\n    message : str, optional\n        Override the default deprecation message.  The format\n        specifier ``func`` may be used for the name of the function,\n        and ``alternative`` may be used in the deprecation message\n        to insert the name of an alternative to the deprecated\n        function. ``obj_type`` may be used to insert a friendly name\n        for the type of object being deprecated.\n\n    name : str, optional\n        The name of the deprecated function or class; if not provided\n        the name is automatically determined from the passed in\n        function or class, though this is useful in the case of\n        renamed functions, where the new function is just assigned to\n        the name of the deprecated function.  For example::\n\n            def new_function():\n                ...\n            oldFunction = new_function\n\n    alternative : str, optional\n        An alternative function or class name that the user may use in\n        place of the deprecated object.  The deprecation warning will\n        tell the user about this alternative if provided.\n\n    pending : bool, optional\n        If True, uses a AstropyPendingDeprecationWarning instead of a\n        ``warning_type``.\n\n    obj_type : str, optional\n        The type of this object, if the automatically determined one\n        needs to be overridden.\n\n    warning_type : Warning\n        Warning to be issued.\n        Default is `~astropy.utils.exceptions.AstropyDeprecationWarning`.\n    ","endLoc":205,"header":"def deprecated(since, message='', name='', alternative='', pending=False,\n               obj_type=None, warning_type=AstropyDeprecationWarning)","id":5535,"name":"deprecated","nodeType":"Function","startLoc":25,"text":"def deprecated(since, message='', name='', alternative='', pending=False,\n               obj_type=None, warning_type=AstropyDeprecationWarning):\n    \"\"\"\n    Used to mark a function or class as deprecated.\n\n    To mark an attribute as deprecated, use `deprecated_attribute`.\n\n    Parameters\n    ----------\n    since : str\n        The release at which this API became deprecated.  This is\n        required.\n\n    message : str, optional\n        Override the default deprecation message.  The format\n        specifier ``func`` may be used for the name of the function,\n        and ``alternative`` may be used in the deprecation message\n        to insert the name of an alternative to the deprecated\n        function. ``obj_type`` may be used to insert a friendly name\n        for the type of object being deprecated.\n\n    name : str, optional\n        The name of the deprecated function or class; if not provided\n        the name is automatically determined from the passed in\n        function or class, though this is useful in the case of\n        renamed functions, where the new function is just assigned to\n        the name of the deprecated function.  For example::\n\n            def new_function():\n                ...\n            oldFunction = new_function\n\n    alternative : str, optional\n        An alternative function or class name that the user may use in\n        place of the deprecated object.  The deprecation warning will\n        tell the user about this alternative if provided.\n\n    pending : bool, optional\n        If True, uses a AstropyPendingDeprecationWarning instead of a\n        ``warning_type``.\n\n    obj_type : str, optional\n        The type of this object, if the automatically determined one\n        needs to be overridden.\n\n    warning_type : Warning\n        Warning to be issued.\n        Default is `~astropy.utils.exceptions.AstropyDeprecationWarning`.\n    \"\"\"\n\n    method_types = (classmethod, staticmethod, types.MethodType)\n\n    def deprecate_doc(old_doc, message):\n        \"\"\"\n        Returns a given docstring with a deprecation message prepended\n        to it.\n        \"\"\"\n        if not old_doc:\n            old_doc = ''\n        old_doc = textwrap.dedent(old_doc).strip('\\n')\n        new_doc = (('\\n.. deprecated:: {since}'\n                    '\\n    {message}\\n\\n'.format(\n                     **{'since': since, 'message': message.strip()})) + old_doc)\n        if not old_doc:\n            # This is to prevent a spurious 'unexpected unindent' warning from\n            # docutils when the original docstring was blank.\n            new_doc += r'\\ '\n        return new_doc\n\n    def get_function(func):\n        \"\"\"\n        Given a function or classmethod (or other function wrapper type), get\n        the function object.\n        \"\"\"\n        if isinstance(func, method_types):\n            func = func.__func__\n        return func\n\n    def deprecate_function(func, message, warning_type=warning_type):\n        \"\"\"\n        Returns a wrapped function that displays ``warning_type``\n        when it is called.\n        \"\"\"\n\n        if isinstance(func, method_types):\n            func_wrapper = type(func)\n        else:\n            func_wrapper = lambda f: f  # noqa: E731\n\n        func = get_function(func)\n\n        def deprecated_func(*args, **kwargs):\n            if pending:\n                category = AstropyPendingDeprecationWarning\n            else:\n                category = warning_type\n\n            warnings.warn(message, category, stacklevel=2)\n\n            return func(*args, **kwargs)\n\n        # If this is an extension function, we can't call\n        # functools.wraps on it, but we normally don't care.\n        # This crazy way to get the type of a wrapper descriptor is\n        # straight out of the Python 3.3 inspect module docs.\n        if type(func) is not type(str.__dict__['__add__']):  # noqa: E721\n            deprecated_func = functools.wraps(func)(deprecated_func)\n\n        deprecated_func.__doc__ = deprecate_doc(\n            deprecated_func.__doc__, message)\n\n        return func_wrapper(deprecated_func)\n\n    def deprecate_class(cls, message, warning_type=warning_type):\n        \"\"\"\n        Update the docstring and wrap the ``__init__`` in-place (or ``__new__``\n        if the class or any of the bases overrides ``__new__``) so it will give\n        a deprecation warning when an instance is created.\n\n        This won't work for extension classes because these can't be modified\n        in-place and the alternatives don't work in the general case:\n\n        - Using a new class that looks and behaves like the original doesn't\n          work because the __new__ method of extension types usually makes sure\n          that it's the same class or a subclass.\n        - Subclassing the class and return the subclass can lead to problems\n          with pickle and will look weird in the Sphinx docs.\n        \"\"\"\n        cls.__doc__ = deprecate_doc(cls.__doc__, message)\n        if cls.__new__ is object.__new__:\n            cls.__init__ = deprecate_function(get_function(cls.__init__),\n                                              message, warning_type)\n        else:\n            cls.__new__ = deprecate_function(get_function(cls.__new__),\n                                             message, warning_type)\n        return cls\n\n    def deprecate(obj, message=message, name=name, alternative=alternative,\n                  pending=pending, warning_type=warning_type):\n        if obj_type is None:\n            if isinstance(obj, type):\n                obj_type_name = 'class'\n            elif inspect.isfunction(obj):\n                obj_type_name = 'function'\n            elif inspect.ismethod(obj) or isinstance(obj, method_types):\n                obj_type_name = 'method'\n            else:\n                obj_type_name = 'object'\n        else:\n            obj_type_name = obj_type\n\n        if not name:\n            name = get_function(obj).__name__\n\n        altmessage = ''\n        if not message or type(message) is type(deprecate):\n            if pending:\n                message = ('The {func} {obj_type} will be deprecated in a '\n                           'future version.')\n            else:\n                message = ('The {func} {obj_type} is deprecated and may '\n                           'be removed in a future version.')\n            if alternative:\n                altmessage = f'\\n        Use {alternative} instead.'\n\n        message = ((message.format(**{\n            'func': name,\n            'name': name,\n            'alternative': alternative,\n            'obj_type': obj_type_name})) +\n            altmessage)\n\n        if isinstance(obj, type):\n            return deprecate_class(obj, message, warning_type)\n        else:\n            return deprecate_function(obj, message, warning_type)\n\n    if type(message) is type(deprecate):\n        return deprecate(message)\n\n    return deprecate"},{"col":27,"endLoc":112,"id":5536,"nodeType":"Lambda","startLoc":112,"text":"lambda f: f"},{"col":0,"comment":"null","endLoc":28,"header":"def setup_function(function)","id":5542,"name":"setup_function","nodeType":"Function","startLoc":27,"text":"def setup_function(function):\n    os.chdir(TEST_DIR)"},{"id":5543,"name":"astropy/io/ascii/tests/data","nodeType":"Package"},{"id":5544,"name":"vots_spec.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"####################################################################################\n##\n## VOTable-Simple Specification\n##\n## This is the specification of the VOTable-Simple (VOTS) format, given as an\n## example data table with comments and references.  This data table format is\n## intended to provide a way of specifying metadata and data for simple tabular\n## data sets.  This specification is intended as a subset of the VOTable data\n## model and allow easy generation of a VOTable-compliant data structure.  This\n## provides a uniform starting point for generating table documentation and\n## performing database table creation and ingest.\n##\n## A python application is available which uses the STILTS java package to\n## convert from a VOTS format to any of the (many) output formats supported by\n## STILTS.  This application can also generate a documentation file (in\n## reStructured Text format) or a Django model definition from a VOTS table.\n##\n## Key VOTable and STILTS references:\n##  Full spec: http://www.ivoa.net/Documents/latest/VOT.html\n##  Datatypes: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC11\n##  FIELD def: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC25 \n##  STILTS   : http://www.star.bris.ac.uk/~mbt/stilts/\n##\n## The VOTable-Simple format consists of header information followed by the tabular\n## data elements.  The VOTS header lines are all preceded by a single '#' character.\n## Comments are preceded by '##' at the beginning of a line.\n##\n## The VOTS header defines the metadata associated with the table. In the\n## VOTable-Simple format words in all CAPS (followed by ::) refer to the\n## corresponding metadata elements in the VOTable specification.  For instance\n## the DESCRIPTION:: keyword precedes the lines that are used in the VOTable\n## <DESCRIPTION /> element.  The COOSYS::, PARAM::, and FIELD:: keywords are\n## each followed by a whitespace-delimited table that defines the corresponding\n## VOTable elements and attributes.\n##\n## The actual table data must follow the header and consist of space or tab delimited \n## data fields.  The chosen delimiter must be used consistently throughout the table.\n##\n##----------------------------------------------------------------------------------\n## Table description, corresponding to the VOTable TABLE::DESCRIPTION element.\n##----------------------------------------------------------------------------------\n# DESCRIPTION::\n# This is a sample table that shows a proposed format for generation of tables\n# for the C-COSMOS collaboration.  This format is compatible with simple 'awk' or\n# S-mongo style processing but also allows full self-documentation and conversion\n# to more robust data formats (FITS, VOTable, postgres database ingest, etc).\n# \n##----------------------------------------------------------------------------------\n## Coordinate system specification COOSYS.  This is a \"future\" feature, as the\n## current conversion code does not use this field.\n##----------------------------------------------------------------------------------\n# COOSYS::\n# ID     equinox      epoch     system\n# J2000  J2000.        J2000.   eq_FK5\n# \n##----------------------------------------------------------------------------------\n## Set the TABLE::PARAM values, which are values that apply for the entire table.\n##----------------------------------------------------------------------------------\n# PARAM::\n# name     datatype     value        description\n# version  string       1.1         'Table version'\n# date     string       2007/12/01  'Table release date'\n# \n##----------------------------------------------------------------------------------\n## Define the column names via the FIELD element.  The attributes 'name',\n## 'datatype', 'unit', and 'description' are required.  Optional attributes are:\n## 'width', 'precision', 'ucd', 'utype', 'ref', and 'type'.\n## See http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC25 for\n## the VOTable definitions.\n## Allowed values of datatype are:\n##   boolean, unsignedByte, short, int, long, string, float, double\n## Units: (from http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#sec:unit)\n##  The quantities in a column of the table may be expressed in some physical\n##  unit, which is specified by the unit attribute of the FIELD. The syntax of\n##  the unit string is defined in reference [3]; it is basically written as a\n##  string without blanks or spaces, where the symbols . or * indicate a\n##  multiplication, / stands for the division, and no special symbol is\n##  required for a power. Examples are unit=\"m2\" for m2, unit=\"cm-2.s-1.keV-1\"\n##  for cm-2s-1keV-1, or unit=\"erg/s\" for erg s-1. The references [3] provide\n##  also the list of the valid symbols, which is essentially restricted to the\n##  Systeme International (SI) conventions, plus a few astronomical extensions\n##  concerning units used for time, angular, distance and energy measurements.\n##----------------------------------------------------------------------------------\n# FIELD::\n# name    datatype        unit        ucd    description\n# id      int             ''          'meta.id'   'C-COSMOS short identifier number'\n# name    string          ''          ''   'C-COSMOS long identifier name'\n# ra      double          deg         'meta.cryptic'    'Right Ascension'\n# dec     double          deg         ''    Declination\n# flux    float           erg/cm2/s   ''    Flux\n#\n##----------------------------------------------------------------------------------\n## Now the actual field data in the order specified by the FIELD:: list.\n## The data fields can be separated by tabs or spaces.  If using spaces,\n## any fields that contain a space must be enclosed in single quotes.\n##\n12     'CXOCS J193423+022312'  150.01212  2.52322  1.21e-13\n13     'CXOCS J193322+024444'  150.02323  2.54444  1.21e-14\n14     'CXOCS J195555+025555'  150.04444  2.55555  1.21e-15\n"},{"col":0,"comment":"null","endLoc":32,"header":"def teardown_function(function)","id":5545,"name":"teardown_function","nodeType":"Function","startLoc":31,"text":"def teardown_function(function):\n    os.chdir(CWD)"},{"col":0,"comment":"null","endLoc":37,"header":"def assert_equal(a, b)","id":5546,"name":"assert_equal","nodeType":"Function","startLoc":36,"text":"def assert_equal(a, b):\n    assert a == b"},{"col":0,"comment":"null","endLoc":41,"header":"def assert_almost_equal(a, b, **kwargs)","id":5547,"name":"assert_almost_equal","nodeType":"Function","startLoc":40,"text":"def assert_almost_equal(a, b, **kwargs):\n    assert np.allclose(a, b, **kwargs)"},{"col":0,"comment":"null","endLoc":45,"header":"def assert_true(a)","id":5548,"name":"assert_true","nodeType":"Function","startLoc":44,"text":"def assert_true(a):\n    assert a"},{"col":0,"comment":"\n    Wraps a test decorator so as to properly replicate metadata\n    of the decorated function, including nose's additional stuff\n    (namely, setup and teardown).\n    ","endLoc":73,"header":"def make_decorator(func)","id":5549,"name":"make_decorator","nodeType":"Function","startLoc":48,"text":"def make_decorator(func):\n    \"\"\"\n    Wraps a test decorator so as to properly replicate metadata\n    of the decorated function, including nose's additional stuff\n    (namely, setup and teardown).\n    \"\"\"\n    def decorate(newfunc):\n        if hasattr(func, 'compat_func_name'):\n            name = func.compat_func_name\n        else:\n            name = func.__name__\n        newfunc.__dict__ = func.__dict__\n        newfunc.__doc__ = func.__doc__\n        newfunc.__module__ = func.__module__\n        if not hasattr(newfunc, 'compat_co_firstlineno'):\n            try:\n                newfunc.compat_co_firstlineno = func.func_code.co_firstlineno\n            except AttributeError:\n                newfunc.compat_co_firstlineno = func.__code__.co_firstlineno\n        try:\n            newfunc.__name__ = name\n        except TypeError:\n            # can't set func name in 2.3\n            newfunc.compat_func_name = name\n        return newfunc\n    return decorate"},{"col":0,"comment":"Test must raise one of expected exceptions to pass.\n\n    Example use::\n\n      @raises(TypeError, ValueError)\n      def test_raises_type_error():\n          raise TypeError(\"This test passes\")\n\n      @raises(Exception)\n      def test_that_fails_by_passing():\n          pass\n\n    ","endLoc":106,"header":"@deprecated('5.1', alternative='pytest.raises')\ndef raises(*exceptions)","id":5550,"name":"raises","nodeType":"Function","startLoc":76,"text":"@deprecated('5.1', alternative='pytest.raises')\ndef raises(*exceptions):\n    \"\"\"Test must raise one of expected exceptions to pass.\n\n    Example use::\n\n      @raises(TypeError, ValueError)\n      def test_raises_type_error():\n          raise TypeError(\"This test passes\")\n\n      @raises(Exception)\n      def test_that_fails_by_passing():\n          pass\n\n    \"\"\"\n    valid = ' or '.join([e.__name__ for e in exceptions])\n\n    def decorate(func):\n        name = func.__name__\n\n        def newfunc(*arg, **kw):\n            try:\n                func(*arg, **kw)\n            except exceptions:\n                pass\n            else:\n                message = f\"{name}() did not raise {valid}\"\n                raise AssertionError(message)\n        newfunc = make_decorator(func)(newfunc)\n        return newfunc\n    return decorate"},{"col":4,"comment":"\n        Initialize the header Column objects from the table ``lines`` for a DAOphot\n        header.  The DAOphot header is specialized so that we just copy the entire BaseHeader\n        get_cols routine and modify as needed.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        Returns\n        -------\n        col : list\n            List of table Columns\n        ","endLoc":193,"header":"def get_cols(self, lines)","id":5551,"name":"get_cols","nodeType":"Function","startLoc":145,"text":"def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines`` for a DAOphot\n        header.  The DAOphot header is specialized so that we just copy the entire BaseHeader\n        get_cols routine and modify as needed.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        Returns\n        -------\n        col : list\n            List of table Columns\n        \"\"\"\n\n        if not self.names:\n            raise core.InconsistentTableError('No column names found in DAOphot header')\n\n        # Create the list of io.ascii column objects\n        self._set_cols_from_names()\n\n        # Set unit and format as needed.\n        coldefs = self.meta['cols']\n        for col in self.cols:\n            unit, fmt = map(coldefs[col.name].get, ('unit', 'format'))\n            if unit != '##':\n                col.unit = unit\n            if fmt != '##':\n                col.format = fmt\n\n        # Set column start and end positions.\n        col_width = sum(self.col_widths, [])\n        ends = np.cumsum(col_width)\n        starts = ends - col_width\n        for i, col in enumerate(self.cols):\n            col.start, col.end = starts[i], ends[i]\n            col.span = col.end - col.start\n            if hasattr(col, 'format'):\n                if any(x in col.format for x in 'fg'):\n                    col.type = core.FloatType\n                elif 'd' in col.format:\n                    col.type = core.IntType\n                elif 's' in col.format:\n                    col.type = core.StrType\n\n        # INDEF is the missing value marker\n        self.data.fill_values.append(('INDEF', '0'))"},{"id":5552,"name":"space_delim_no_header.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"1 3.4 hello\n2 6.4 world\n"},{"id":5553,"name":"latex2.tex","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"\\begin{deluxetable}{llrl}\n%\\tabletypesize{\\scriptsize}\n%\\rotate\n\\tablecaption{Log of observations\\label{tab:obslog}}\n\\tablewidth{0pt}\n\\tablehead{\\colhead{Facility} & \\colhead{Id} & \\colhead{exposure} & \\colhead{date}}\n\n\\startdata\n\\toprule\nChandra & \\dataset[ADS/Sa.CXO#obs/06438]{ObsId 6438} & 23 ks & 2006-12-10\\\\\n\\midrule\nSpitzer & AOR 3656448  & 41.6 s & 2004-06-09\\\\\n\\midrule\nFLWO    & filter: $B$ & 600 s & 2009-11-18\\\\\n\\bottomrule\n\\enddata\n\n\\end{deluxetable}\n"},{"id":5554,"name":"test5.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"# whitespace separated with lines to skip\n------------------------------------------\nzabs1.nh p1.gamma p1.ampl statname statval\n------------------------------------------\n0.095196313612 1.29238107724 0.000709438701165 chi2xspecvar 455.385700456\n0.0898827896112 1.27317260145 0.000703680688865 cstat 450.402806957\n0.0845373292976 1.26032264432 0.000697817633266 chi2constvar 427.888401816\n0.0813955290921 1.25278166998 0.000694773889339 chi2modvar 422.655226097\n0.0837813193374 1.26108631851 0.000697168659777 cash -582096.060739\n0.0877788113875 1.27498889089 0.000700963122261 chi2gehrels 336.255262001\n0.0886095763534 1.27831934755 0.000702152760295 chi2datavar 427.87097831\n0.0886062881606 1.27831561342 0.000702152575029 chi2xspecvar 427.870972282\n0.0837839157029 1.26109967845 0.000697177275745 cstat 423.869897301\n0.0848856095291 1.26216881055 0.000697245258092 chi2constvar 495.692552206\n0.0834040516574 1.25034791909 0.000694504650678 chi2modvar 448.488349352\n0.0863275923367 1.25920642303 0.000697302969088 cash -581109.867406\n0.0910593842926 1.27434931431 0.000701687557965 chi2gehrels 362.107884887\n0.0925984360666 1.27857224315 0.000703586368322 chi2datavar 467.653055046\n0.0926057133247 1.27858701992 0.000703594356786 chi2xspecvar 467.653060082\n0.0863257498551 1.259192667 0.000697300429366 cstat 451.536967896\n0.0880503692681 1.2588289844 0.000698437310968 chi2constvar 439.513117058\n0.0852962921333 1.25214407357 0.000696223065852 chi2modvar 443.456904712\n"},{"id":5555,"name":"ipac.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"\\intval = 1\n\\floatval=2.3e3\n\\date = \"Wed Sp 20 09:48:36 1995\"\n\\key_continue = 'IPAC keywords '\n\\key_continue = 'can continue across lines'\n\\ This is an example of a valid comment\n|     ra   |    dec   |   sai   |-----v2---|    sptype        | \n|    real  |   real   |   int   |    real  |     char         |\n|    unit  |   unit   |   unit  |    unit  |     ergs         |\n|    null  |   null   |   -999  |    null  |     -999         |\n   null      29.09056     -999    2.06000    -999\n12345678901234567890123456789012345678901234567890123456789012345\n"},{"id":5556,"name":"cdsFunctional2.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"J/A+A/642/A176    Chemical evolution of dSph galaxy Sextans      (Theler+, 2020)\n================================================================================\nThe chemical evolution of the dwarf spheroidal galaxy Sextans.\n    Theler R., Jablonka P., Lucchesi R., Lardo C., North P., Irwin M.,\n    Battaglia G., Hill V., Tolstoy E., Venn K., Helmi A., Kaufer A., Primas F.,\n    Shetrone M.\n    <Astron. Astrophys. 642, A176 (2020)>\n    =2020A&A...642A.176T        (SIMBAD/NED BibCode)\n================================================================================\nADC_Keywords: Galaxies, nearby ; Abundances ; Equivalent widths ;\n              Radial velocities ; Effective temperatures\nKeywords: stars: abundances - galaxies: dwarf - galaxies: evolution\n\nAbstract:\n    [--- snip ---]\n\nDescription:\n    [--- snip ---]\n\nFile Summary:\n--------------------------------------------------------------------------------\n FileName    Lrecl  Records   Explanations\n--------------------------------------------------------------------------------\nReadMe          80        .   This file\ntable6.dat      33       89   Four stellar parameters for the probables members\n--------------------------------------------------------------------------------\n\nSee also:\n   [--- snip ---]\n\nByte-by-byte Description of file: table6.dat\n--------------------------------------------------------------------------------\n   Bytes Format Units   Label     Explanations\n--------------------------------------------------------------------------------\n   1-  7  A7    ---     ID        Star ID\n   9- 12  I4    K       Teff      Effective temperature\n  14- 17  F4.2  [cm/s2] logg      Surface gravity\n  19- 22  F4.2  km/s    vturb     Micro-turbulence velocity\n  24- 28  F5.2  [-]     [Fe/H]    Metallicity\n  30- 33  F4.2  [-]   e_[Fe/H]    ? rms uncertainty on [Fe/H]\n--------------------------------------------------------------------------------\n\n================================================================================\n(End)                                        Patricia Vannier [CDS]  09-Jun-2020\n--------------------------------------------------------------------------------\nS05-5   4337 0.77 1.8  -2.07\nS08-229 4625 1.23 1.23 -1.50\nS05-10  4342 0.91 1.82 -2.11 0.14\nS05-47  4654 1.28 1.74 -1.64 0.16\n"},{"id":5557,"name":"simple3.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"obsid|redshift|X|Y|object|rad\n877|0.22|4378|3892|'Sou,rce82'|12.5\n3102|0.32|4167|4085|Q1250+568-A|9\n"},{"id":5558,"name":"bad.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"# Extra column in last line\n \"test 1a\" test2  test3 test4  \n    #  fun1    fun2\t    fun3 fun4\n    top1 top2 top3     top4 \nhat1  hat2 hat3 hat4    hat5\n\n"},{"id":5559,"name":"daophot2.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"#N IMAGE               XINIT     YINIT     ID    COORDS                 LID    \\\n#U imagename           pixels    pixels    ##    filename               ##     \\\n#F %-23s               %-10.3f   %-10.3f   %-6d  %-23s                  %-6.0f  \n#\n#N XCENTER    YCENTER    XSHIFT  YSHIFT  XERR    YERR            CIER CERROR   \\\n#U pixels     pixels     pixels  pixels  pixels  pixels          ##   cerrors  \\\n#F %-14.3f    %-11.3f    %-8.3f  %-8.3f  %-8.3f  %-15.3f         %-5d %-9s      \n#\n#N MSKY           STDEV          SSKEW          NSKY   NSREJ     SIER SERROR   \\\n#U counts         counts         counts         npix   npix      ##   serrors  \\\n#F %-18.7g        %-15.7g        %-15.7g        %-7d   %-9d      %-5d %-9s      \n#\n#N ITIME          XAIRMASS       IFILTER                OTIME                  \\\n#U timeunit       number         name                   timeunit               \\\n#F %-18.7g        %-15.7g        %-23s                  %-23s                   \n#\n#N RAPERT   SUM           AREA       FLUX          MAG    MERR   PIER PERROR   \\\n#U scale    counts        pixels     counts        mag    mag    ##   perrors  \\\n#F %-12.2f  %-14.7g       %-11.7g    %-14.7g       %-7.3f %-6.3f %-5s %-9s      \n#\nn8q624e8q12_cal.fits[1]76.102    2.280     1     test.stars             1      \\\n   76.150     2.182      0.048   -0.098  0.016   0.014          108  BadPixels \\\n   0.5378259      0.1369367      0.1002712      604    176      0    NoError   \\\n   1407.892       INDEF          F160W                  INDEF                  \\\n   4.00     0.            0.         0.            INDEF  INDEF 301  OffImage   \nn8q624e8q12_cal.fits[1]81.730    3.167     2     test.stars             2      \\\n   76.150     2.182      -5.580  -0.985  0.016   0.014          108  BadPixels \\\n   0.5378259      0.1369367      0.1002712      604    176      0    NoError   \\\n   1407.892       INDEF          F160W                  INDEF                  \\\n   4.00     0.            0.         0.            INDEF  INDEF 301  OffImage   \n\n"},{"id":5560,"name":"space_delim_no_names.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"1 2\n3 4\n"},{"id":5561,"name":"commented_header.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"# a b c\n# A comment line\n1 2 3\n4 5 6\n"},{"id":5562,"name":"subtypes.ecsv","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"# %ECSV 1.0\n# ---\n# delimiter: ','\n# datatype:\n# -\n#   name: i_index\n#   datatype: int32\n#   description: Row index\n# -\n#   name: s_byte\n#   datatype: int8\n# -\n#   name: s_short\n#   datatype: int16\n# -\n#   name: s_int\n#   datatype: int32\n# -\n#   name: s_long\n#   datatype: int64\n# -\n#   name: s_float\n#   datatype: float32\n# -\n#   name: s_double\n#   datatype: float64\n# -\n#   name: s_string\n#   datatype: string\n# -\n#   name: s_boolean\n#   datatype: bool\n# -\n#   name: f_byte\n#   datatype: string\n#   subtype: 'int8[3]'\n# -\n#   name: f_short\n#   datatype: string\n#   subtype: 'int16[3]'\n# -\n#   name: f_int\n#   datatype: string\n#   subtype: 'int32[3]'\n# -\n#   name: f_long\n#   datatype: string\n#   subtype: 'int64[3]'\n# -\n#   name: f_float\n#   datatype: string\n#   subtype: 'float32[3]'\n# -\n#   name: f_double\n#   datatype: string\n#   subtype: 'float64[3]'\n# -\n#   name: f_string\n#   datatype: string\n#   subtype: 'string[3]'\n# -\n#   name: f_boolean\n#   datatype: string\n#   subtype: 'bool[3]'\n# -\n#   name: v_byte\n#   datatype: string\n#   subtype: 'int8[null]'\n# -\n#   name: v_short\n#   datatype: string\n#   subtype: 'int16[null]'\n# -\n#   name: v_int\n#   datatype: string\n#   subtype: 'int32[null]'\n# -\n#   name: v_long\n#   datatype: string\n#   subtype: 'int64[null]'\n# -\n#   name: v_float\n#   datatype: string\n#   subtype: 'float32[null]'\n# -\n#   name: v_double\n#   datatype: string\n#   subtype: 'float64[null]'\n# -\n#   name: v_string\n#   datatype: string\n#   subtype: 'string[null]'\n# -\n#   name: v_boolean\n#   datatype: string\n#   subtype: 'bool[null]'\n# -\n#   name: m_int\n#   datatype: string\n#   subtype: 'int32[4,2]'\n# -\n#   name: m_double\n#   datatype: string\n#   subtype: 'float64[2,3]'\ni_index,s_byte,s_short,s_int,s_long,s_float,s_double,s_string,s_boolean,f_byte,f_short,f_int,f_long,f_float,f_double,f_string,f_boolean,v_byte,v_short,v_int,v_long,v_float,v_double,v_string,v_boolean,m_int,m_double\n0,0,0,0,0,0.0,0.0,zero,False,\"[0,1,2]\",\"[0,1,2]\",\"[0,1,2]\",\"[0,1,2]\",\"[0.0,null,2.5]\",\"[0.0,null,2.5]\",\"[\"\"foo\"\",null,\"\"zero\"\"]\",\"[false,false,false]\",\"[0,1,2]\",\"[0,1,2]\",\"[0,1,2]\",\"[0,1,2]\",\"[0.0,null,2.5]\",\"[0.0,null,2.5]\",\"[\"\"foo\"\",null,\"\"zero\"\"]\",\"[false,false,false]\",\"[[1000,1001],[2000,2001],[3000,3001],[4000,4001]]\",\"[[0.25,0.5,0.75],[-0.25,-0.5,-0.75]]\"\n1,,1,1,1,1.0,,one,True,,\"[1,2,3]\",\"[1,2,3]\",\"[1,2,3]\",\"[1.0,null,3.5]\",\"[1.0,null,3.5]\",\"[\"\"foo\"\",null,\"\"one\"\"]\",\"[true,false,false]\",,\"[1,2]\",\"[1,2]\",\"[1,2]\",\"[1.0,null]\",\"[1.0,null]\",\"[\"\"foo\"\",null]\",\"[true,false]\",,\"[[1.25,1.5,1.75],[-1.25,-1.5,-1.75]]\"\n2,2,,2,2,,2.0,two,False,\"[2,3,4]\",,\"[2,3,4]\",\"[2,3,4]\",\"[2.0,null,4.5]\",\"[2.0,null,4.5]\",\"[\"\"foo\"\",null,\"\"two\"\"]\",\"[false,true,false]\",[2],,[2],[2],[2.0],[2.0],\"[\"\"foo\"\"]\",[false],\"[[1002,1003],[2002,2003],[3002,3003],[4002,4003]]\",\n3,3,3,,3,3.0,3.0,three,True,\"[3,4,5]\",\"[3,4,5]\",,\"[3,4,5]\",\"[3.0,null,5.5]\",\"[3.0,null,5.5]\",\"[\"\"foo\"\",null,\"\"three\"\"]\",\"[true,true,false]\",[],[],,[],[],[],[],[],\"[[1003,1004],[2003,2004],[3003,3004],[4003,4004]]\",\"[[3.25,3.5,3.75],[-3.25,-3.5,-3.75]]\"\n4,4,4,4,,4.0,4.0,four,False,\"[4,5,6]\",\"[4,5,6]\",\"[4,5,6]\",,\"[4.0,null,6.5]\",\"[4.0,null,6.5]\",\"[\"\"foo\"\",null,\"\"four\"\"]\",\"[false,false,true]\",\"[4,5,6]\",\"[4,5,6]\",\"[4,5,6]\",,\"[4.0,null,6.5]\",\"[4.0,null,6.5]\",\"[\"\"foo\"\",null,\"\"four\"\"]\",\"[false,false,true]\",\"[[1004,1005],[2004,2005],[3004,3005],[4004,4005]]\",\"[[4.25,4.5,4.75],[-4.25,-4.5,-4.75]]\"\n5,5,5,5,5,nan,5.0,five,True,\"[5,6,7]\",\"[5,6,7]\",\"[5,6,7]\",\"[5,6,7]\",,\"[5.0,null,7.5]\",\"[\"\"foo\"\",null,\"\"five\"\"]\",\"[true,false,true]\",\"[5,6]\",\"[5,6]\",\"[5,6]\",\"[5,6]\",,\"[5.0,null]\",\"[\"\"foo\"\",null]\",\"[true,false]\",\"[[1005,1006],[2005,2006],[3005,3006],[4005,4006]]\",\"[[5.25,5.5,5.75],[-5.25,-5.5,-5.75]]\"\n6,6,6,6,6,6.0,nan,six,False,\"[6,7,8]\",\"[6,7,8]\",\"[6,7,8]\",\"[6,7,8]\",\"[6.0,null,8.5]\",,\"[\"\"foo\"\",null,\"\"six\"\"]\",\"[false,true,true]\",[6],[6],[6],[6],[6.0],,\"[\"\"foo\"\"]\",[false],\"[[1006,1007],[2006,2007],[3006,3007],[4006,4007]]\",\"[[6.25,6.5,6.75],[-6.25,-6.5,-6.75]]\"\n7,7,7,7,7,7.0,7.0,,True,\"[7,8,9]\",\"[7,8,9]\",\"[7,8,9]\",\"[7,8,9]\",\"[7.0,null,9.5]\",\"[7.0,null,9.5]\",,\"[true,true,true]\",[],[],[],[],[],[],,[],\"[[1007,1008],[2007,2008],[3007,3008],[4007,4008]]\",\"[[7.25,7.5,7.75],[-7.25,-7.5,-7.75]]\"\n8,8,8,8,8,8.0,8.0,\"' \"\"\\\"\"\"\"' ; '&<>\",,\"[8,9,10]\",\"[8,9,10]\",\"[8,9,10]\",\"[8,9,10]\",\"[8.0,null,10.5]\",\"[8.0,null,10.5]\",\"[\"\"foo\"\",null,\"\"' \\\"\"\\\\\\\"\"\\\"\"' ; '&<>\"\"]\",,\"[8,9,10]\",\"[8,9,10]\",\"[8,9,10]\",\"[8,9,10]\",\"[8.0,null,10.5]\",\"[8.0,null,10.5]\",\"[\"\"foo\"\",null,\"\"' \\\"\"\\\\\\\"\"\\\"\"' ; '&<>\"\"]\",,\"[[1008,1009],[2008,2009],[3008,3009],[4008,4009]]\",\"[[8.25,8.5,8.75],[-8.25,-8.5,-8.75]]\"\n9,9,9,9,9,nan,nan,,True,\"[9,10,11]\",\"[9,10,11]\",\"[9,10,11]\",\"[9,10,11]\",\"[9.0,null,11.5]\",\"[9.0,null,11.5]\",\"[\"\"foo\"\",null,\"\"\"\"]\",\"[true,false,false]\",\"[9,10]\",\"[9,10]\",\"[9,10]\",\"[9,10]\",\"[9.0,null]\",\"[9.0,null]\",\"[\"\"foo\"\",null]\",\"[true,false]\",\"[[1009,1010],[2009,2010],[3009,3010],[4009,4010]]\",\"[[9.25,9.5,9.75],[-9.25,-9.5,-9.75]]\"\n10,-10,-10,-10,-10,-10.0,-10.0,10,False,\"[10,11,12]\",\"[10,11,12]\",\"[10,11,12]\",\"[10,11,12]\",\"[10.0,null,12.5]\",\"[10.0,null,12.5]\",\"[\"\"foo\"\",null,\"\"10\"\"]\",\"[false,true,false]\",[10],[10],[10],[10],[10.0],[10.0],\"[\"\"foo\"\"]\",[false],\"[[1010,1011],[2010,2011],[3010,3011],[4010,4011]]\",\"[[10.25,10.5,10.75],[-10.25,-10.5,-10.75]]\"\n11,,-11,-11,-11,-11.0,-11.0,10 + one,True,,\"[11,12,13]\",\"[11,12,13]\",\"[11,12,13]\",\"[11.0,null,13.5]\",\"[11.0,null,13.5]\",\"[\"\"foo\"\",null,\"\"10 + one\"\"]\",\"[true,true,false]\",,[],[],[],[],[],[],[],,\"[[11.25,11.5,11.75],[-11.25,-11.5,-11.75]]\"\n12,-12,,-12,-12,-12.0,-12.0,10 + two,False,\"[12,13,14]\",,\"[12,13,14]\",\"[12,13,14]\",\"[12.0,null,14.5]\",\"[12.0,null,14.5]\",\"[\"\"foo\"\",null,\"\"10 + two\"\"]\",\"[false,false,true]\",\"[12,13,14]\",,\"[12,13,14]\",\"[12,13,14]\",\"[12.0,null,14.5]\",\"[12.0,null,14.5]\",\"[\"\"foo\"\",null,\"\"10 + two\"\"]\",\"[false,false,true]\",\"[[1012,1013],[2012,2013],[3012,3013],[4012,4013]]\",\n13,-13,-13,,-13,-13.0,-13.0,10 + three,True,\"[13,14,15]\",\"[13,14,15]\",,\"[13,14,15]\",\"[13.0,null,15.5]\",\"[13.0,null,15.5]\",\"[\"\"foo\"\",null,\"\"10 + three\"\"]\",\"[true,false,true]\",\"[13,14]\",\"[13,14]\",,\"[13,14]\",\"[13.0,null]\",\"[13.0,null]\",\"[\"\"foo\"\",null]\",\"[true,false]\",\"[[1013,1014],[2013,2014],[3013,3014],[4013,4014]]\",\"[[13.25,13.5,13.75],[-13.25,-13.5,-13.75]]\"\n14,-14,-14,-14,,-14.0,-14.0,10 + four,False,\"[14,15,16]\",\"[14,15,16]\",\"[14,15,16]\",,\"[14.0,null,16.5]\",\"[14.0,null,16.5]\",\"[\"\"foo\"\",null,\"\"10 + four\"\"]\",\"[false,true,true]\",[14],[14],[14],,[14.0],[14.0],\"[\"\"foo\"\"]\",[false],\"[[1014,1015],[2014,2015],[3014,3015],[4014,4015]]\",\"[[14.25,14.5,14.75],[-14.25,-14.5,-14.75]]\"\n15,-15,-15,-15,-15,nan,-15.0,10 + five,True,\"[15,16,17]\",\"[15,16,17]\",\"[15,16,17]\",\"[15,16,17]\",,\"[15.0,null,17.5]\",\"[\"\"foo\"\",null,\"\"10 + five\"\"]\",\"[true,true,true]\",[],[],[],[],,[],[],[],\"[[1015,1016],[2015,2016],[3015,3016],[4015,4016]]\",\"[[15.25,15.5,15.75],[-15.25,-15.5,-15.75]]\"\n"},{"attributeType":"null","col":16,"comment":"null","endLoc":5,"id":5564,"name":"np","nodeType":"Attribute","startLoc":5,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":5565,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":5566,"name":"CWD","nodeType":"Attribute","startLoc":13,"text":"CWD"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":5567,"name":"TEST_DIR","nodeType":"Attribute","startLoc":14,"text":"TEST_DIR"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":5568,"name":"has_isnan","nodeType":"Attribute","startLoc":16,"text":"has_isnan"},{"attributeType":"null","col":8,"comment":"null","endLoc":23,"id":5569,"name":"has_isnan","nodeType":"Attribute","startLoc":23,"text":"has_isnan"},{"col":0,"comment":"","endLoc":3,"header":"common.py#<anonymous>","id":5570,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['assert_equal', 'assert_almost_equal',\n           'assert_true', 'setup_function', 'teardown_function',\n           'has_isnan']\n\nCWD = os.getcwd()\n\nTEST_DIR = os.path.dirname(__file__)\n\nhas_isnan = True\n\ntry:\n    from math import isnan  # noqa\nexcept ImportError:\n    try:\n        from numpy import isnan  # noqa\n    except ImportError:\n        has_isnan = False\n        print('Tests requiring isnan will fail')"},{"col":4,"comment":"\n        Writes the Header of the MRT table, aka ReadMe, which\n        also contains the Byte-By-Byte description of the table.\n        ","endLoc":559,"header":"def write(self, lines)","id":5571,"name":"write","nodeType":"Function","startLoc":412,"text":"def write(self, lines):\n        \"\"\"\n        Writes the Header of the MRT table, aka ReadMe, which\n        also contains the Byte-By-Byte description of the table.\n        \"\"\"\n        from astropy.coordinates import SkyCoord\n\n        # Recognised ``SkyCoord.name`` forms with their default column names (helio* require SunPy).\n        coord_systems = {'galactic': ('GLAT', 'GLON', 'b', 'l'),\n                         'ecliptic': ('ELAT', 'ELON', 'lat', 'lon'),      # 'geocentric*ecliptic'\n                         'heliographic': ('HLAT', 'HLON', 'lat', 'lon'),  # '_carrington|stonyhurst'\n                         'helioprojective': ('HPLT', 'HPLN', 'Ty', 'Tx')}\n        eqtnames = ['RAh', 'RAm', 'RAs', 'DEd', 'DEm', 'DEs']\n\n        # list to store indices of columns that are modified.\n        to_pop = []\n\n        # For columns that are instances of ``SkyCoord`` and other ``mixin`` columns\n        # or whose values are objects of these classes.\n        for i, col in enumerate(self.cols):\n            # If col is a ``Column`` object but its values are ``SkyCoord`` objects,\n            # convert the whole column to ``SkyCoord`` object, which helps in applying\n            # SkyCoord methods directly.\n            if not isinstance(col, SkyCoord) and isinstance(col[0], SkyCoord):\n                try:\n                    col = SkyCoord(col)\n                except (ValueError, TypeError):\n                    # If only the first value of the column is a ``SkyCoord`` object,\n                    # the column cannot be converted to a ``SkyCoord`` object.\n                    # These columns are converted to ``Column`` object and then converted\n                    # to string valued column.\n                    if not isinstance(col, Column):\n                        col = Column(col)\n                    col = Column([str(val) for val in col])\n                    self.cols[i] = col\n                    continue\n\n            # Replace single ``SkyCoord`` column by its coordinate components if no coordinate\n            # columns of the correspoding type exist yet.\n            if isinstance(col, SkyCoord):\n                # If coordinates are given in RA/DEC, divide each them into hour/deg,\n                # minute/arcminute, second/arcsecond columns.\n                if ('ra' in col.representation_component_names.keys() and\n                        len(set(eqtnames) - set(self.colnames)) == 6):\n                    ra_c, dec_c = col.ra.hms, col.dec.dms\n                    coords = [ra_c.h.round().astype('i1'), ra_c.m.round().astype('i1'), ra_c.s,\n                              dec_c.d.round().astype('i1'), dec_c.m.round().astype('i1'), dec_c.s]\n                    coord_units = [u.h, u.min, u.second,\n                                   u.deg, u.arcmin, u.arcsec]\n                    coord_descrip = ['Right Ascension (hour)', 'Right Ascension (minute)',\n                                     'Right Ascension (second)', 'Declination (degree)',\n                                     'Declination (arcmin)', 'Declination (arcsec)']\n                    for coord, name, coord_unit, descrip in zip(\n                            coords, eqtnames, coord_units, coord_descrip):\n                        # Have Sign of Declination only in the DEd column.\n                        if name in ['DEm', 'DEs']:\n                            coord_col = Column(list(np.abs(coord)), name=name,\n                                               unit=coord_unit, description=descrip)\n                        else:\n                            coord_col = Column(list(coord), name=name, unit=coord_unit,\n                                               description=descrip)\n                        # Set default number of digits after decimal point for the\n                        # second values, and deg-min to (signed) 2-digit zero-padded integer.\n                        if name == 'RAs':\n                            coord_col.format = '013.10f'\n                        elif name == 'DEs':\n                            coord_col.format = '012.9f'\n                        elif name == 'RAh':\n                            coord_col.format = '2d'\n                        elif name == 'DEd':\n                            coord_col.format = '+03d'\n                        elif name.startswith(('RA', 'DE')):\n                            coord_col.format = '02d'\n                        self.cols.append(coord_col)\n                    to_pop.append(i)   # Delete original ``SkyCoord`` column.\n\n                # For all other coordinate types, simply divide into two columns\n                # for latitude and longitude resp. with the unit used been as it is.\n\n                else:\n                    frminfo = ''\n                    for frame, latlon in coord_systems.items():\n                        if frame in col.name and len(set(latlon[:2]) - set(self.colnames)) == 2:\n                            if frame != col.name:\n                                frminfo = f' ({col.name})'\n                            lon_col = Column(getattr(col, latlon[3]), name=latlon[1],\n                                             description=f'{frame.capitalize()} Longitude{frminfo}',\n                                             unit=col.representation_component_units[latlon[3]],\n                                             format='.12f')\n                            lat_col = Column(getattr(col, latlon[2]), name=latlon[0],\n                                             description=f'{frame.capitalize()} Latitude{frminfo}',\n                                             unit=col.representation_component_units[latlon[2]],\n                                             format='+.12f')\n                            self.cols.append(lon_col)\n                            self.cols.append(lat_col)\n                            to_pop.append(i)   # Delete original ``SkyCoord`` column.\n\n                # Convert all other ``SkyCoord`` columns that are not in the above three\n                # representations to string valued columns. Those could either be types not\n                # supported yet (e.g. 'helioprojective'), or already present and converted.\n                # If there were any extra ``SkyCoord`` columns of one kind after the first one,\n                # then their decomposition into their component columns has been skipped.\n                # This is done in order to not create duplicate component columns.\n                # Explicit renaming of the extra coordinate component columns by appending some\n                # suffix to their name, so as to distinguish them, is not yet implemented.\n                if i not in to_pop:\n                    warnings.warn(f\"Coordinate system of type '{col.name}' already stored in table \"\n                                  f\"as CDS/MRT-syle columns or of unrecognized type. So column {i} \"\n                                  f\"is being skipped with designation of a string valued column \"\n                                  f\"`{self.colnames[i]}`.\", UserWarning)\n                    self.cols.append(Column(col.to_string(), name=self.colnames[i]))\n                    to_pop.append(i)   # Delete original ``SkyCoord`` column.\n\n            # Convert all other ``mixin`` columns to ``Column`` objects.\n            # Parsing these may still lead to errors!\n            elif not isinstance(col, Column):\n                col = Column(col)\n                # If column values are ``object`` types, convert them to string.\n                if np.issubdtype(col.dtype, np.dtype(object).type):\n                    col = Column([str(val) for val in col])\n                self.cols[i] = col\n\n        # Delete original ``SkyCoord`` columns, if there were any.\n        for i in to_pop[::-1]:\n            self.cols.pop(i)\n\n        # Check for any left over extra coordinate columns.\n        if any(x in self.colnames for x in ['RAh', 'DEd', 'ELON', 'GLAT']):\n            # At this point any extra ``SkyCoord`` columns should have been converted to string\n            # valued columns, together with issuance of a warning, by the coordinate parser above.\n            # This test is just left here as a safeguard.\n            for i, col in enumerate(self.cols):\n                if isinstance(col, SkyCoord):\n                    self.cols[i] = Column(col.to_string(), name=self.colnames[i])\n                    message = ('Table already has coordinate system in CDS/MRT-syle columns. '\n                               f'So column {i} should have been replaced already with '\n                               f'a string valued column `{self.colnames[i]}`.')\n                    raise core.InconsistentTableError(message)\n\n        # Get Byte-By-Byte description and fill the template\n        bbb_template = Template('\\n'.join(BYTE_BY_BYTE_TEMPLATE))\n        byte_by_byte = bbb_template.substitute({'file': 'table.dat',\n                                                'bytebybyte': self.write_byte_by_byte()})\n\n        # Fill up the full ReadMe\n        rm_template = Template('\\n'.join(MRT_TEMPLATE))\n        readme_filled = rm_template.substitute({'bytebybyte': byte_by_byte})\n        lines.append(readme_filled)"},{"col":0,"comment":"null","endLoc":30,"header":"def io_identify(suffix, origin, filepath, fileobj, *args, **kwargs)","id":5572,"name":"io_identify","nodeType":"Function","startLoc":29,"text":"def io_identify(suffix, origin, filepath, fileobj, *args, **kwargs):\n    return filepath is not None and filepath.endswith(suffix)"},{"col":0,"comment":"null","endLoc":54,"header":"def _get_connectors_table()","id":5573,"name":"_get_connectors_table","nodeType":"Function","startLoc":33,"text":"def _get_connectors_table():\n    from .core import FORMAT_CLASSES\n\n    rows = []\n    rows.append(('ascii', '', 'Yes', 'ASCII table in any supported format (uses guessing)'))\n    for format in sorted(FORMAT_CLASSES):\n        cls = FORMAT_CLASSES[format]\n\n        io_format = 'ascii.' + cls._format_name\n        description = getattr(cls, '_description', '')\n        class_link = f':class:`~{cls.__module__}.{cls.__name__}`'\n        suffix = getattr(cls, '_io_registry_suffix', '')\n        can_write = 'Yes' if getattr(cls, '_io_registry_can_write', True) else ''\n\n        rows.append((io_format, suffix, can_write,\n                     f'{class_link}: {description}'))\n    out = Table(list(zip(*rows)), names=('Format', 'Suffix', 'Write', 'Description'))\n    for colname in ('Format', 'Description'):\n        width = max(len(x) for x in out[colname])\n        out[colname].format = f'%-{width}s'\n\n    return out"},{"id":5574,"name":"cds.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"                                                                     \n                                                                     \n                                                                     \n                                             \nTitle: Spitzer Observations of NGC 1333: A Study of Structure and Evolution \n       in a Nearby Embedded Cluster \nAuthors: Gutermuth R.A., Myers P.C., Megeath S.T., Allen L.E., Pipher J.L., \n         Muzerolle J., Porras A., Winston E., Fazio G. \nTable: Spitzer-identified YSOs: Addendum\n================================================================================\nByte-by-byte Description of file: datafile3.txt\n--------------------------------------------------------------------------------\n   Bytes Format Units  Label  Explanations\n--------------------------------------------------------------------------------\n   1-  3 I3     ---    Index  Running identification number\n   5-  6 I2     h      RAh    Hour of Right Ascension (J2000) \n   8-  9 I2     min    RAm    Minute of Right Ascension (J2000) \n  11- 15 F5.2   s      RAs    Second of Right Ascension (J2000) \n                              - continuation of description\n      17 A1     ---    DE-    Sign of the Declination (J2000)\n  18- 19 I2     deg    DEd    Degree of Declination (J2000) \n  21- 22 I2     arcmin DEm    Arcminute of Declination (J2000) \n  24- 27 F4.1   arcsec DEs    Arcsecond of Declination (J2000) \n  29- 68 A40    ---    Match  Literature match \n  70- 75 A6     ---    Class  Source classification (1)\n  77-80  F4.2   mag    AK     ? The K band extinction (2) \n  82-86  F5.2   GMsun  Fit    ? Fit of IRAC photometry with bogus unit (3)\n--------------------------------------------------------------------------------\nNote (1): Asterisks mark \"deeply embedded\" sources with questionable IRAC \n          colors or incomplete IRAC photometry and relatively bright \n          MIPS 24 micron photometry. \nNote (2): Only provided for sources with valid JHK_S_ photometry. \nNote (3): Defined as the slope of the linear least squares fit to the \n          3.6 - 8.0 micron SEDs in log{lambda} F_{lambda} vs log{lambda} space.\n          Extinction is not accounted for in these values.  High extinction can\n          bias Fit to higher values. \n--------------------------------------------------------------------------------\n  1 03 28 39.09 +31 06 01.9                                          I*           1.35 \n"},{"id":5575,"name":"bars_at_ends.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"|obsid |  redshift |     X    |   Y     |  object       | rad|\n|3102  |  0.32     |     4167 |  4085   |  Q1250+568-A  |  9|\n|3102  |  0.32     |     4706 |  3916   |  Q1250+568-B  | 14 |\n|877   |  0.22     |     4378 |  3892   |  'Source 82'  | 12.5 |\n"},{"id":5576,"name":"fill_values.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"a,b,c\n1,2,3\na,a,4\n"},{"id":5577,"name":"sextractor2.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"# 1 NUMBER Running object number\n# 2 XWIN_IMAGE Windowed position estimate along x [pixel]\n# 3 YWIN_IMAGE Windowed position estimate along y [pixel]\n# 4 MAG_AUTO Kron-like elliptical aperture magnitude [mag]\n# 5 MAGERR_AUTO RMS error for AUTO magnitude [mag]\n# 6 FLAGS Extraction flags\n# 7 X2_IMAGE      [pixel**2]\n# 8 X_MAMA         Barycenter position along MAMA x axis    [m**(-6)]\n# 9 MU_MAX   Peak surface brightness above background   [mag * arcsec**(-2)]\n1 100.523 11.911 -5.3246 0.0416 19 1000.0 0.00304 -3.498\n2 100.660 4.872 -6.4538 0.0214 27 1500.0 0.00908 1.401\n3 131.046 10.382 -4.6836 0.0524 17 500.0 0.01004 2.512\n4 338.959 4.966 -7.1747 0.0173 25 1200.0 0.00792 2.901\n5 166.280 3.956 -4.0865 0.0621 25 800.0 0.00699 -6.489\n"},{"id":5578,"name":"daophot4.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"#K IRAF       = NOAO/IRAFV2.14.1        version    %-23s     \n#K USER       = hannes                  name       %-23s     \n#K HOST       = prometheus              computer   %-23s     \n#K DATE       = 2015-03-11              yyyy-mm-dd %-23s     \n#K TIME       = 15:26:26                hh:mm:ss   %-23s     \n#K PACKAGE    = apphot                  name       %-23s     \n#K TASK       = phot                    name       %-23s     \n#\n#K SCALE      = 1.                      units      %-23.7g   \n#K FWHMPSF    = 4.119713                scaleunit  %-23.7g   \n#K EMISSION   = yes                     switch     %-23b     \n#K DATAMIN    = INDEF                   counts     %-23.7g   \n#K DATAMAX    = 65536.                  counts     %-23.7g   \n#K EXPOSURE   = exposure                keyword    %-23s     \n#K AIRMASS    = airmass                 keyword    %-23s     \n#K FILTER     = filter                  keyword    %-23s     \n#K OBSTIME    = utc-obs                 keyword    %-23s     \n#\n#K NOISE      = poisson                 model      %-23s     \n#K SIGMA      = 41.66582                counts     %-23.7g   \n#K GAIN       = \"\"                      keyword    %-23s     \n#K EPADU      = 1.                      e-/adu     %-23.7g   \n#K CCDREAD    = \"\"                      keyword    %-23s     \n#K READNOISE  = 7.49                    e-         %-23.7g   \n#\n#K CALGORITHM = centroid                algorithm  %-23s     \n#K CBOXWIDTH  = 12.                     scaleunit  %-23.7g   \n#K CTHRESHOLD = 3.                      sigma      %-23.7g   \n#K MINSNRATIO = 1.                      number     %-23.7g   \n#K CMAXITER   = 10                      number     %-23d     \n#K MAXSHIFT   = 5.                      scaleunit  %-23.7g   \n#K CLEAN      = no                      switch     %-23b     \n#K RCLEAN     = 1.                      scaleunit  %-23.7g   \n#K RCLIP      = 2.                      scaleunit  %-23.7g   \n#K KCLEAN     = 3.                      sigma      %-23.7g   \n#\n#K SALGORITHM = centroid                algorithm  %-23s     \n#K ANNULUS    = 7.17957                 scaleunit  %-23.7g   \n#K DANNULUS   = 7.82043                 scaleunit  %-23.7g   \n#K SKYVALUE   = 0.                      counts     %-23.7g   \n#K KHIST      = 3.                      sigma      %-23.7g   \n#K BINSIZE    = 0.1                     sigma      %-23.7g   \n#K SMOOTH     = no                      switch     %-23b     \n#K SMAXITER   = 10                      number     %-23d     \n#K SLOCLIP    = 3.                      percent    %-23.7g   \n#K SHICLIP    = 3.                      percent    %-23.7g   \n#K SNREJECT   = 50                      number     %-23d     \n#K SLOREJECT  = 3.                      sigma      %-23.7g   \n#K SHIREJECT  = 3.                      sigma      %-23.7g   \n#K RGROW      = 0.                      scaleunit  %-23.7g   \n#\n#K WEIGHTING  = constant                model      %-23s     \n#K APERTURES  = 1.0, 2.0, 3.0, 4.0, 5.0 scaleunit  %-23s     \n#K ZMAG       = 0.                      zeropoint  %-23.7g   \n#\n#N IMAGE               XINIT     YINIT     ID    COORDS                 LID    \\\n#U imagename           pixels    pixels    ##    filename               ##     \\\n#F %-23s               %-10.3f   %-10.3f   %-6d  %-23s                  %-6d    \n#\n#N XCENTER    YCENTER    XSHIFT  YSHIFT  XERR    YERR            CIER CERROR   \\\n#U pixels     pixels     pixels  pixels  pixels  pixels          ##   cerrors  \\\n#F %-14.3f    %-11.3f    %-8.3f  %-8.3f  %-8.3f  %-15.3f         %-5d %-9s      \n#\n#N MSKY           STDEV          SSKEW          NSKY   NSREJ     SIER SERROR   \\\n#U counts         counts         counts         npix   npix      ##   serrors  \\\n#F %-18.7g        %-15.7g        %-15.7g        %-7d   %-9d      %-5d %-9s      \n#\n#N ITIME          XAIRMASS       IFILTER                OTIME                  \\\n#U timeunit       number         name                   timeunit               \\\n#F %-18.7g        %-15.7g        %-23s                  %-23s                   \n#\n#N RAPERT   SUM           AREA       FLUX          MAG    MERR   PIER PERROR   \\\n#U scale    counts        pixels     counts        mag    mag    ##   perrors  \\\n#F %-12.2f  %-14.7g       %-11.7g    %-14.7g       %-7.3f %-6.3f %-5d %-9s      \n#\n20150224.010.bff.fits[*106.579   106.934   1     20150224.010.bff.coo   1      \\\n   106.559    108.018    -0.020  1.084   0.101   0.074          0    NoError   \\\n   2274.581       35.8673        11.2252        507    34       0    NoError   \\\n   15.            INDEF          WL                     18.25805367777778      \\\n   1.00     9109.85       3.522305   1098.081      -4.661 0.074 0    NoError  *\\\n   2.00     31801.22      12.6082    3122.852      -5.796 0.049 0    NoError  *\\\n   3.00     70478.22      28.76358   5053.117      -6.319 0.045 0    NoError  *\\\n   4.00     121419.       50.47698   6604.971      -6.609 0.046 0    NoError  *\\\n   5.00     186154.5      78.6758    7199.989      -6.703 0.053 0    NoError  *\\\n   6.00     266042.9      113.531    7807.418      -6.791 0.060 0    NoError  *\\\n   7.00     358247.2      153.8083   8397.668      -6.870 0.067 0    NoError  *\\\n   8.00     467542.2      201.7787   8580.032      -6.893 0.077 0    NoError  *\\\n   9.00     587422.       254.4993   8542.593      -6.889 0.090 0    NoError  *\\\n   10.00    724023.7      314.4823   8708.25       -6.910 0.102 0    NoError  *\\\n   11.00    874403.1      380.5716   8762.004      -6.916 0.115 0    NoError  *\\\n   12.00    1036954.      452.126    8556.425      -6.891 0.134 0    NoError  *\\\n   13.00    1217921.      531.7312   8455.69       -6.878 0.152 0    NoError  *\\\n   14.00    1408227.      615.5404   8130.7        -6.835 0.177 0    NoError  *\\\n   15.00    1617583.      707.5204   8270.082      -6.854 0.194 0    NoError  * \n20150224.010.bff.fits[*28.377    105.125   2     20150224.010.bff.coo   2      \\\n   28.334     106.194    -0.043  1.069   0.057   0.057          0    NoError   \\\n   2255.277       33.60751       14.9162        503    47       0    NoError   \\\n   15.            INDEF          WL                     18.25805367777778      \\\n   1.00     9725.537      3.433434   1982.191      -5.303 0.042 0    NoError  *\\\n   2.00     34708.58      12.786     5872.618      -6.482 0.027 0    NoError  *\\\n   3.00     73724.14      28.56388   9304.661      -6.982 0.024 0    NoError  *\\\n   4.00     125125.7      50.50517   11222.5       -7.185 0.026 0    NoError  *\\\n   5.00     189990.9      78.80913   12254.43      -7.281 0.030 0    NoError  *\\\n   6.00     268543.3      113.428    12731.67      -7.322 0.035 0    NoError  *\\\n   7.00     360879.8      154.1563   13214.47      -7.362 0.040 0    NoError  *\\\n   8.00     467521.8      201.3365   13452.14      -7.382 0.046 0    NoError  *\\\n   9.00     588086.8      254.6784   13716.38      -7.403 0.053 0    NoError  *\\\n   10.00    723155.3      314.422    14046.6       -7.429 0.059 0    NoError  *\\\n   11.00    872591.1      380.4647   14537.59      -7.466 0.066 0    NoError  *\\\n   12.00    1035008.      452.6064   14254.72      -7.445 0.076 0    NoError  *\\\n   13.00    1212656.      531.2477   14544.82      -7.467 0.083 0    NoError  *\\\n   14.00    1404271.      615.9114   15220.43      -7.516 0.089 0    NoError  *\\\n   15.00    1610992.      707.2085   16040.83      -7.573 0.094 0    NoError  * \n"},{"attributeType":"null","col":4,"comment":"null","endLoc":27,"id":5579,"name":"comment","nodeType":"Attribute","startLoc":27,"text":"comment"},{"id":5580,"name":"html.html","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"<html>\n<head>\n<meta charset=\"utf-8\"/>\n<meta http-equiv=\"Content-type\" content=\"text/html;charset=UTF-8\"/>\n<style>\nth,td{padding:5px;}\n</style>\n</head>\n<body>\n<table>\n<tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr>\n<tr><td>1</td><td>a</td><td>1.05</td></tr>\n<tr><td>2</td><td>b</td><td>2.75</td></tr>\n<tr><td>3</td><td>c</td><td>-1.25</td></tr>\n</table>\n<table id=\"second\">\n<tr><th>Column A</th><th>Column B</th><th>Column C</th></tr>\n<tr><td>4</td><td>d</td><td>10.5</td></tr>\n<tr><td>5</td><td>e</td><td>27.5</td></tr>\n<tr><td>6</td><td>f</td><td>-12.5</td></tr>\n</table>\n<table>\n<tr><th>C1</th><th>C2</th><th>C3</th></tr>\n<tr><td>7</td><td>g</td><td>105.0</td></tr>\n<tr><td>8</td><td>h</td><td>275.0</td></tr>\n<tr><td>9</td><td>i</td><td>-125.0</td></tr>\n</table>\n</body>\n</html>"},{"id":5581,"name":"simple5.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"# Purposely make an ill-formed data file (in last row)\n3102  |  0.32     |     4167 |  4085   |  Q1250+568-A  |  9\n3102  |  0.32     |     4706 |  3916   |  Q1250+568-B  | 14 \n877   |                 4378  |  3892  |  'Source 82'  | 12.5 \n"},{"id":5582,"name":"sextractor.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"# 1 NUMBER        Galaxy ID number\n# 2 FLUX_ISO   \n# 3 FLUXERR_ISO   \n# 4 VALU-ES       Note column 5 is missing\n# 6 FLAG\n1 0.02580616000000000 0.03974229000000000 1.6770000000000000 0.2710000000000000 0\n2 5.72769100000000009 0.20643300000000001 2.6250000000000000 2.5219999999999998 0\n3 88.31933999999999685 0.59369850000000002 5.9249999999999998 4.7140000000000004 0\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":30,"id":5583,"name":"re_format","nodeType":"Attribute","startLoc":30,"text":"re_format"},{"attributeType":"null","col":4,"comment":"null","endLoc":31,"id":5584,"name":"re_header_keyword","nodeType":"Attribute","startLoc":31,"text":"re_header_keyword"},{"attributeType":"null","col":4,"comment":"null","endLoc":35,"id":5585,"name":"aperture_values","nodeType":"Attribute","startLoc":35,"text":"aperture_values"},{"attributeType":"null","col":12,"comment":"null","endLoc":131,"id":5586,"name":"names","nodeType":"Attribute","startLoc":131,"text":"self.names"},{"attributeType":"null","col":8,"comment":"null","endLoc":86,"id":5587,"name":"col_widths","nodeType":"Attribute","startLoc":86,"text":"self.col_widths"},{"attributeType":"{__getitem__}","col":12,"comment":"null","endLoc":130,"id":5588,"name":"meta","nodeType":"Attribute","startLoc":130,"text":"self.meta"},{"id":5589,"name":"nls1_stackinfo.dbout","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"  |objID                  |osrcid           |xsrcid         |SpecObjID              |ra                  |dec                 |obsid      |ccdid      |z                   |modelMag_i          |modelMagErr_i       |modelMag_r          |modelMagErr_r       |expo                |theta               |rad_ecf_39          |detlim90            |fBlim90             \n|-----------------------|-----------------|---------------|-----------------------|--------------------|--------------------|-----------|-----------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------\n|     277955213|S000.7044P00.7513|XS04861B6_005  |     10943136|            0.704453|            0.751336|       4861|          6|            0.086550|           15.462060|            0.003840|           16.063650|            0.003888|         5104.621261|            0.105533|            3.022382|           15.117712|            0.311318\n|     889974380|S002.9051P14.7003|XS03957B7_004  |     21189832|            2.905195|           14.700391|       3957|          7|            0.131820|           16.466050|            0.004807|           16.992690|            0.004917|         1479.207035|            0.118550|            3.016342|           17.364280|            0.880407\n|     661258793|S005.7709M01.1287|XS04079B7_003  |     10999832|            5.770986|           -1.128731|       4079|          7|            0.166355|           17.232030|            0.008332|           17.549760|            0.007209|         1540.924685|            0.073783|            1.489627|           11.915912|            0.561011\n|     809266720|S006.9683P00.4376|XS04080B7_003  |     11027112|            6.968335|            0.437687|       4080|          7|            0.205337|           17.600880|            0.007790|           18.047560|            0.007439|         1373.690631|            0.073017|            1.489627|           15.480587|            0.807865\n|     275803698|S014.7729P00.1143|XS02179B6_001  |     11140928|           14.772956|            0.114358|       2179|          6|            0.718880|           17.487000|            0.006978|           17.441360|            0.005979|         2043.570572|            0.091283|            1.453126|           13.288200|            0.676781\n|     610324605|S029.2184M00.2061|XS04081B7_004  |     11365768|           29.218458|           -0.206140|       4081|          7|            0.163040|           17.522280|            0.006957|           17.821940|            0.006828|         1513.497218|            0.073333|            1.489627|           12.188137|            0.580337\n|     819359440|S029.9901P00.5529|XS05777B1_005  |     11365080|           29.990162|            0.552903|       5777|          1|            0.311778|           18.508300|            0.013120|           18.822060|            0.011235|        16875.600510|            0.173000|            5.127182|           29.849694|            0.201770\n|     359375943|S037.1728P00.8690|XS04083B7_002  |     11478640|           37.172803|            0.869065|       4083|          7|            0.186225|           17.741220|            0.008360|           18.157300|            0.007994|         1600.672011|            0.074100|            1.489627|           12.060426|            0.546492\n|     680002094|S048.6144M01.1978|XS04084B7_001  |     11619072|           48.614411|           -1.197867|       4084|          7|            0.387004|           18.084100|            0.008811|           18.047740|            0.007107|         1688.844386|            0.074850|            1.489627|           14.418508|            0.665490\n|     207476987|S122.0691P21.1492|XS03785B1_003  |     54178104|          122.069156|           21.149206|       3785|          1|            0.142121|           18.795740|            0.014157|           19.272550|            0.014808|        15935.690359|            0.148833|            5.116525|           25.744492|            0.182462\n|     314622107|S124.9642P36.8307|XS04119B3_002  |     25158064|          124.964241|           36.830793|       4119|          3|            0.736540|           19.246110|            0.015329|           19.180730|            0.011400|         6686.525810|            0.191800|            7.738524|           30.212630|            0.663496\n|     499048612|S128.7287P55.5725|XS04940B7_008  |     50209680|          128.728748|           55.572530|       4940|          7|            0.241157|           16.196610|            0.006701|           16.845690|            0.008232|        85385.450431|            0.021583|            0.327020|           25.359343|            0.022349\n|     509872023|S130.2167P13.2152|NULL           |     68308384|          130.216762|           13.215295|       2130|          7|            0.170352|           17.437750|            0.009265|           17.989470|            0.010459|        22105.895051|            0.010694|            0.232184|            8.703367|            0.030060\n  |   337394906|S134.7069P27.8194|NULL           |     54460872|          134.706929|           27.819409|       5821|          3|            0.090713|           15.495630|            0.004090|           15.933850|            0.004758|        20139.691101|            0.153217|            5.127182|           26.899264|            0.175787\n|     204612149|S140.7808P30.9906|XS04122B5_001  |     54657400|          140.780817|           30.990687|       4122|          5|            0.629145|           18.845160|            0.012765|           18.948480|            0.010724|         4173.745162|            0.192050|            7.739623|           37.336536|            0.819048\n|     731490396|S147.5151P17.1590|XS03274B2_001  |     66732256|          147.515194|           17.159084|       3274|          2|            0.195364|           17.472340|            0.006327|           17.783260|            0.006028|        14096.036370|            0.032833|            0.366684|            9.702502|            0.075172\n|     138368206|S147.6362P59.8164|NULL           |     12773752|          147.636280|           59.816408|       3036|          2|            0.652411|           19.914220|            0.029210|           20.094790|            0.024926|         4012.606072|            0.167283|            5.127182|           21.727958|            0.697762\n|     561051767|S151.8587P12.8156|XS05606B7_004  |     49112864|          151.858761|           12.815617|       5606|          7|            0.240653|           15.175160|            0.004690|           15.348870|            0.004204|        33943.906753|            0.008806|            0.243602|            8.594830|            0.019169\n|     827223175|S153.3119M00.8760|XS04085B7_001  |      7622024|          153.311933|           -0.876011|       4085|          7|            0.275749|           17.638600|            0.006945|           17.638410|            0.005750|         1769.308133|            0.074400|            1.489627|           12.371362|            0.512717\n|     125920375|S160.6255P01.0399|XS04086B7_004  |      7762256|          160.625571|            1.039913|       4086|          7|            0.115493|           16.476400|            0.006180|           16.952690|            0.005979|         1351.602676|            0.074017|            1.489627|           12.388117|            0.674828\n|     126051412|S160.8870P01.0191|XS04086B2_001  |      7762456|          160.887017|            1.019120|       4086|          2|            0.071893|           15.403520|            0.003958|           15.830900|            0.003798|         1470.312820|            0.188000|            7.763980|           24.843778|            2.297003\n|     199471676|S169.6261P40.4316|XS00868B3_001  |     40555520|          169.626193|           40.431669|        868|          3|            0.154596|           15.520440|            0.003612|           15.843520|            0.003574|        15875.864312|            0.039917|            0.409867|           10.331539|            0.069317\n|     911117410|S174.3501P30.0602|XS04161B7_011  |     62510944|          174.350159|           30.060294|       4161|          7|            0.695136|           19.910250|            0.032209|           20.022840|            0.021641|        14988.033880|            0.062233|            0.614561|           11.836136|            0.055041\n|     302536231|S179.8826P29.2455|XS00874B3_007  |     62651000|          179.882670|           29.245515|        874|          3|            0.724488|           17.965190|            0.007865|           18.090560|            0.007281|        94375.899791|            0.004833|            0.230755|            8.240796|            0.009124\n|     302601830|S179.9533P29.1580|XS00874B2_001  |     62623640|          179.953385|           29.158023|        874|          2|            0.083344|           15.802610|            0.004156|           16.238050|            0.004098|        84775.542942|            0.105917|            3.022382|           21.690631|            0.026736\n|     115261957|S180.7950P57.6803|XS05757B0_022  |     37008112|          180.795062|           57.680354|       5757|          0|            0.759025|           18.066390|            0.008409|           18.060240|            0.006947|        40390.627482|            0.178917|            5.125388|           34.575626|            0.096856\n|     607275593|S183.4289P02.8802|XS04934B3_004  |     14602336|          183.428996|            2.880256|       4934|          3|            0.641174|           19.083390|            0.016683|           19.264170|            0.014156|        17374.807609|            0.067033|            1.489627|           12.291123|            0.078403\n|     425979958|S183.5631P00.9198|XS04087B7_004  |      8100808|          183.563163|            0.919874|       4087|          7|            0.395653|           18.254720|            0.010882|           18.328170|            0.008583|         1743.376400|            0.075183|            1.489627|           12.265030|            0.491269\n|     189855768|S184.4790P58.6599|XS03558B3_002  |     37036288|          184.479077|           58.659912|       3558|          3|            0.023181|           14.626880|            0.002469|           14.904420|            0.002339|         6129.941952|            0.003750|            0.232403|            7.666659|            0.136118\n|     619169285|S187.0751P44.2172|NULL           |     38612200|          187.075137|           44.217228|        938|          0|            0.662250|           17.907240|            0.007109|           18.053730|            0.006975|         2298.154599|            0.172200|            5.125388|           20.352558|            0.848250\n|     325588542|S187.5646P03.0485|XS04040B7_001  |     14659784|          187.564673|            3.048508|       4040|          7|            0.137670|           16.402290|            0.004927|           17.103210|            0.005467|         3409.797684|            0.010833|            0.243602|            7.851051|            0.160035\n|     574503609|S187.6176P47.8825|NULL           |     40921304|          187.617696|           47.882592|       3071|          3|            0.259120|           18.357610|            0.011731|           18.646700|            0.010925|         6222.550176|            0.197167|            7.763595|           30.051725|            0.668981\n|     101878322|S188.4820P13.0754|XS02107B7_001  |     45509408|          188.482006|           13.075423|       2107|          7|            0.480211|           18.623910|            0.015033|           19.178470|            0.015434|         5550.153407|            0.015417|            0.276499|            8.218379|            0.089948\n|     834099774|S188.5555P47.8975|XS03055B7_001  |     40921752|          188.555591|           47.897583|       3055|          7|            0.372812|           16.768010|            0.004767|           16.822040|            0.004038|         4452.821575|            0.009889|            0.243602|            8.075360|            0.119255\n|     528223925|S191.3095P01.1419|NULL           |      8213952|          191.309592|            1.141912|       2974|          2|            0.091196|           16.407150|            0.006573|           16.882680|            0.006505|         5665.430694|            0.160700|            5.127182|           21.105785|            0.481827\n|     430960732|S194.9316P01.0486|XS04088B7_005  |      8269800|          194.931643|            1.048622|       4088|          7|            0.394569|           18.230550|            0.009419|           18.305880|            0.007674|         1532.367693|            0.075000|            1.489627|           11.697405|            0.529051\n|     040450702|S196.9301P46.7193|NULL           |     41090688|          196.930172|           46.719346|       3244|          6|            0.600141|           19.711200|            0.021784|           20.631250|            0.030904|         8481.301760|            0.184333|            5.111493|           28.487300|            0.409704\n|     895335014|S197.7853P00.5310|XS04089B7_006  |      8297720|          197.785328|            0.531036|       4089|          7|            0.429236|           17.838440|            0.007412|           17.883200|            0.006128|         1342.669846|            0.075917|            1.489627|           11.975790|            0.622564\n|     362199556|S206.2204P00.0889|NULL           |      8438656|          206.220450|            0.088956|       2251|          6|            0.087128|           15.878880|            0.003993|           16.339870|            0.003999|         7732.826167|            0.146900|            5.125388|           24.196409|            0.276815\n|     390308579|S213.1444M00.5833|XS04090B7_001  |      8550616|          213.144471|           -0.583347|       4090|          7|            0.126940|           16.924460|            0.008082|           17.337560|            0.007611|         1850.463370|            0.074433|            1.489627|           12.129062|            0.475026\n|     444464848|S213.7065P36.2111|XS04163B1_002  |     46269424|          213.706536|           36.211187|       4163|          1|            0.180925|           17.916410|            0.009867|           18.346860|            0.009661|        81178.124219|            0.092700|            1.460516|           17.286353|            0.023684\n|     222587913|S216.7550P44.2825|XS06112B2_004  |     36276768|          216.755074|           44.282505|       6112|          2|            0.735436|           19.039310|            0.015654|           19.133000|            0.012307|         7202.822662|            0.137533|            3.019678|           17.903948|            0.270855\n|     929145428|S217.6259M00.1875|XS04091B7_004  |      8607176|          217.625904|           -0.187530|       4091|          7|            0.103307|           17.334130|            0.007846|           17.791860|            0.007610|         1362.631234|            0.075700|            1.489627|           11.674970|            0.622522\n|     428847268|S217.6691P36.8177|XS04126B7_001  |     38894856|          217.669106|           36.817754|       4126|          7|            0.566053|           18.744800|            0.010372|           19.168410|            0.011316|         2834.413800|            0.009583|            0.243602|            7.405304|            0.178125\n|     440484921|S219.7460P03.5965|XS03290B1_006  |     16516928|          219.746065|            3.596520|       3290|          1|            0.733848|           18.461360|            0.009410|           18.429130|            0.008255|        48647.675049|            0.137250|            3.014202|           26.440169|            0.059182\n|     468047975|S222.3062P00.4019|XS04092B7_004  |      8691936|          222.306273|            0.401911|       4092|          7|            0.440801|           18.675470|            0.012882|           18.855400|            0.010686|         1574.467045|            0.052750|            0.607436|           10.031873|            0.470555\n|     468113483|S222.3862P00.3767|XS04092B7_001  |      8691984|          222.386270|            0.376752|       4092|          7|            0.080563|           16.388650|            0.004431|           16.884420|            0.004493|         1920.873200|            0.074717|            1.489627|           12.712145|            0.488745\n|     931439168|S222.8459M00.1071|XS04093B7_001  |      8691960|          222.845909|           -0.107191|       4093|          7|            0.138627|           17.058580|            0.006735|           17.488910|            0.006241|         1898.411113|            0.075567|            1.489627|           11.967944|            0.467229\n|     262643238|S235.8184P54.0905|XS00822B6_002  |     17361832|          235.818430|           54.090581|        822|          6|            0.245121|           17.540910|            0.006667|           17.778130|            0.006324|         3636.411721|            0.140183|            3.019678|           18.358903|            0.439665\n|     926158050|S240.8326P42.3631|NULL           |     37599160|          240.832606|           42.363127|       5609|          6|            0.245845|           18.507290|            0.014520|           18.790040|            0.011571|        11325.862421|            0.133133|            3.019841|           18.982950|            0.171760\n|     608676499|S245.9044P31.1722|XS05607B7_001  |     39992048|          245.904431|           31.172231|       5607|          7|            0.235655|           18.073020|            0.012637|           18.487890|            0.011318|        16902.229821|            0.033283|            0.375642|           10.006948|            0.042823\n|     960066205|S246.4348P15.8271|XS03229B1_001  |     62172624|          246.434806|           15.827186|       3229|          1|            0.798335|           18.653970|            0.012212|           18.576130|            0.008949|        42261.803686|            0.138833|            3.014202|           25.770130|            0.068354\n|     134019205|S256.4454P63.1831|XS04094B7_002  |      9845344|          256.445484|           63.183108|       4094|          7|            0.119156|           17.496630|            0.006940|           17.887740|            0.006407|         1714.376381|            0.075200|            1.489627|           11.843095|            0.497777\n|     134609053|S257.3217P61.8895|XS04864B6_004  |      9902624|          257.321721|           61.889546|       4864|          6|            0.292492|           18.075020|            0.010429|           18.285270|            0.008331|         3266.690360|            0.109617|            3.019678|           16.988875|            0.540981\n|     213815608|S260.0418P26.6255|XS04361B3_014  |     27578480|          260.041831|           26.625566|       4361|          3|            0.159240|           14.936350|            0.003416|           15.449310|            0.003666|        23666.399953|            0.037933|            0.399900|           23.603727|            0.111820\n|     849702763|S264.1609P53.9090|XS04863B6_002  |     10155040|          264.160900|           53.909041|       4863|          6|            0.407487|           18.748560|            0.014215|           19.233860|            0.015527|         4649.657613|            0.107100|            3.022382|           16.279548|            0.369717\n|     801664702|S349.5880P00.4935|NULL           |     10774344|          349.588069|            0.493526|       4938|          7|            0.376296|           18.852000|            0.018428|           19.022390|            0.013564|        28181.469589|            0.117017|            3.046228|           21.942945|            0.059519\n|     275333773|S354.7242P00.8034|XS04095B7_002  |     10859368|          354.724289|            0.803473|       4095|          7|            0.169759|           17.812580|            0.009228|           18.205800|            0.008355|         1513.825375|            0.075283|            1.489627|           12.057631|            0.593043\n"},{"id":5590,"name":"commented_header2.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"# A comment line\n# Another comment line\n# a b c\n1 2 3\n4 5 6\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":5591,"name":"__all__","nodeType":"Attribute","startLoc":10,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"connect.py#<anonymous>","id":5592,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"__all__ = []"},{"id":5593,"name":"latex1.tex","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"\\begin{table}\n\\caption{\\ion{Ne}{ix} Ly series and \\ion{Mg}{xi} triplet fluxes (errors are 5$1\\sigma$ confidence intervals) \\label{tab:nely}}\n  \\begin{tabular}{lrr}\\hline\n  cola & colb & colc\\\\\n  \\hline\n      a & 1 & 2\\\\\n      b & 3 & 4\\\\\n      \\hline\n  \\end{tabular}\n\\end{table}\n"},{"id":5594,"name":"simple2.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"obsid |  redshift |     X    |   Y     |  object       | rad\n3102  |  0.32     |     4167 |  4085   |  Q1250+568-A  |  9\n3102  |  0.32     |     4706 |  3916   |  Q1250+568-B  | 14 \n877   |  0.22     |     4378 |  3892   |  'Source 82'  | 12.5 \n"},{"id":5595,"name":"latex3.tex","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"\\begin{tabular}{lrr}\\hline\ncola & colb & colc\\\\\n\\hline\na & 1 & 2\\\\\n\\midrule\nb & 3 & 4\\\\\n\\hline\n\\end{tabular}\n"},{"id":5596,"name":"conf_py.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"import os\nimport sys\nsys.path.insert(0, os.path.abspath('..'))\n\nproject = 'manno'\n\nmaster_doc = 'index'\nextensions = [\n    'sphinx.ext.autodoc',\n    'sphinx.ext.doctest',\n    'sphinx.ext.coverage',\n    'sphinx.ext.mathjax',\n    'numpydoc',\n]\n\nintersphinx_mapping = {\n    \"python\": (\"https://docs.python.org/3/\", None),\n}\n"},{"id":5597,"name":"cds_malformed.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"                                                                     \n                                                                     \n                                                                     \n                                             \nTitle: Spitzer Observations of NGC 1333: A Study of Structure and Evolution \n       in a Nearby Embedded Cluster \nAuthors: Gutermuth R.A., Myers P.C., Megeath S.T., Allen L.E., Pipher J.L., \n         Muzerolle J., Porras A., Winston E., Fazio G. \nTable: Spitzer-identified YSOs: Addendum\n================================================================================\nByte-by-byte Description of file: datafile3.txt\n--------------------------------------------------------------------------------\n   Bytes Format Units  Label  Explanations\n--------------------------------------------------------------------------------\n   1-  3 I3     ---    Index  Running identification number\n   5-  6 I2     h      RAh    Hour of Right Ascension (J2000) \n   8-  9 I2     min    RAm    Minute of Right Ascension (J2000) \n  11- 15 F5.2   s      RAs    Second of Right Ascension (J2000) \n                              - continuation of description\n      17 A1     ---    DE-    Sign of the Declination (J2000)\n  18- 19 I2     deg    DEd    Degree of Declination (J2000) \n  21- 22 I2     arcmin DEm    Arcminute of Declination (J2000) \n  24- 27 F4.1   arcsec DEs    Arcsecond of Declination (J2000) \n  29- 68 A40    ---    Match  Literature match \n  70- 75 A6     ---    Class  Source classification (1)\n  77-80  F4.2   mag    AK     ? The K band extinction (2) \n  82-86  F5.2   ---    Fit    ? Fit of IRAC photometry (3)\n--------------------------------------------------------------------------------\nNote (1): Asterisks mark \"deeply embedded\" sources with questionable IRAC \n          colors or incomplete IRAC photometry and relatively bright \n          MIPS 24 micron photometry. \nNote (2): Only provided for sources with valid JHK_S_ photometry. \nNote (3): Defined as the slope of the linear least squares fit to the \n          3.6 - 8.0 micron SEDs in log{lambda} F_{lambda} vs log{lambda} space.\n          Extinction is not accounted for in these values.  High extinction can\n          bias Fit to higher values. \n  1 03 28 39.09 +31 06 01.9                                          I*           1.35 \n"},{"id":5598,"name":"short.tab","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"agasc_id\tn_noids\tn_obs\n115345072\t1\t1\n335416352\t3\t8\n266612160\t1\t1\n645803280\t1\t1\n117309912\t1\t1\n114950920\t1\t1\n335025040\t2\t24\n"},{"id":5599,"name":"no_data_cds.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"                                                                     \n                                                                     \n                                                                     \n                                             \nTitle: Spitzer Observations of NGC 1333: A Study of Structure and Evolution \n       in a Nearby Embedded Cluster \nAuthors: Gutermuth R.A., Myers P.C., Megeath S.T., Allen L.E., Pipher J.L., \n         Muzerolle J., Porras A., Winston E., Fazio G. \nTable: Spitzer-identified YSOs: Addendum\n================================================================================\nByte-by-byte Description of file: datafile3.txt\n--------------------------------------------------------------------------------\n   Bytes Format Units  Label  Explanations\n--------------------------------------------------------------------------------\n   1-  3 I3     ---    Index  Running identification number\n   5-  6 I2     h      RAh    Hour of Right Ascension (J2000) \n   8-  9 I2     min    RAm    Minute of Right Ascension (J2000) \n  11- 15 F5.2   s      RAs    Second of Right Ascension (J2000) \n                              - continuation of description\n      17 A1     ---    DE-    Sign of the Declination (J2000)\n  18- 19 I2     deg    DEd    Degree of Declination (J2000) \n  21- 22 I2     arcmin DEm    Arcminute of Declination (J2000) \n  24- 27 F4.1   arcsec DEs    Arcsecond of Declination (J2000) \n  29- 68 A40    ---    Match  Literature match \n  70- 75 A6     ---    Class  Source classification (1)\n  77-80  F4.2   mag    AK     ? The K band extinction (2) \n  82-86  F5.2   ---    Fit    ? Fit of IRAC photometry (3)\n--------------------------------------------------------------------------------\nNote (1): Asterisks mark \"deeply embedded\" sources with questionable IRAC \n          colors or incomplete IRAC photometry and relatively bright \n          MIPS 24 micron photometry. \nNote (2): Only provided for sources with valid JHK_S_ photometry. \nNote (3): Defined as the slope of the linear least squares fit to the \n          3.6 - 8.0 micron SEDs in log{lambda} F_{lambda} vs log{lambda} space.\n          Extinction is not accounted for in these values.  High extinction can\n          bias Fit to higher values. \n--------------------------------------------------------------------------------\n"},{"id":5600,"name":"simple.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":" 'test 1a' test2  test3 test4  \n    #  fun1    fun2\t    fun3 fun4 fun5\n    top1 top2 top3     top4 \nhat1  hat2 hat3 hat4    \n"},{"id":5601,"name":"no_data_sextractor.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"# 1 NUMBER        Galaxy ID number\n# 2 FLUX_ISO   \n# 3 FLUXERR_ISO   \n# 4 VALUES        Note column 5 is missing\n# 6 FLAG\n"},{"id":5602,"name":"test4.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"# whitespace separated \nzabs1.nh p1.gamma p1.ampl statname statval\n  0.0872113431031      1.26764500000 0.000699751823872 input 0.0\n0.0863775314648 1.26769713012 0.000698799851356 chi2constvar 494.396534577\n0.0839710433091 1.25997502704 0.000696444029148 chi2modvar 497.56468441     \n0.0867933991271 1.27045571779 0.000699526507899 cash -579508.340504    \n  #  comment here\n0.0913252611282 1.28738450369 0.000703999531569 chi2gehrels 416.904139981\n0.0943815607455 1.29839188657 0.000708725775733 chi2datavar 572.734008\n0.0943792771442 1.29837677223 0.00070871697621 chi2xspecvar 572.734013473\n0.0867953584196 1.27046735536 0.000699532088738 cstat 512.433488994\n0.0846479114132 1.26584338176 0.000697063608605 chi2constvar 440.651434041\n"},{"id":5603,"name":"space_delim_blank_lines.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"obsid    offset       x      y        name           oaa  \n   \n3102    0.32          4167   4085     Q1250+568-A    9\n3102    0.32          4706   3916     Q1250+568-B   14 \n877     0.22          4378   3892     \"Source 82\"   12.5 \n\n\n\n"},{"id":5604,"name":"simple4.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"3102  |  0.32     |     4167 |  4085   |  Q1250+568-A  |  9\n3102  |  0.32     |     4706 |  3916   |  Q1250+568-B  | 14 \n877   |  0.22     |     4378 |  3892   |  'Source 82'  | 12.5 \n"},{"id":5605,"name":"fixed_width_2_line.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"Col1      Col2 Col3 Col4\n---- --------- ---- ----\n 1.2   \"hello\"    1    a\n 2.4 's worlds    2    2\n"},{"id":5606,"name":"daophot3.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"#K IRAF       = NOAO/IRAFV2.16          version    %-23s     \n#K USER       = joe                     name       %-23s     \n#K HOST       = porteus-ATMA            computer   %-23s     \n#K DATE       = 2014-06-24              yyyy-mm-dd %-23s     \n#K TIME       = 00:20:18                hh:mm:ss   %-23s     \n#K PACKAGE    = apphot                  name       %-23s     \n#K TASK       = phot                    name       %-23s     \n#\n#K SCALE      = 1.                      units      %-23.7g   \n#K FWHMPSF    = 6.1                     scaleunit  %-23.7g   \n#K EMISSION   = yes                     switch     %-23b     \n#K DATAMIN    = 93.232                  counts     %-23.7g   \n#K DATAMAX    = 4000.                   counts     %-23.7g   \n#K EXPOSURE   = \"\"                      keyword    %-23s     \n#K AIRMASS    = \"\"                      keyword    %-23s     \n#K FILTER     = \"\"                      keyword    %-23s     \n#K OBSTIME    = \"\"                      keyword    %-23s     \n#\n#K NOISE      = poisson                 model      %-23s     \n#K SIGMA      = 0.132                   counts     %-23.7g   \n#K GAIN       = \"\"                      keyword    %-23s     \n#K EPADU      = 1152.                   e-/adu     %-23.7g   \n#K CCDREAD    = \"\"                      keyword    %-23s     \n#K READNOISE  = 0.05                    e-         %-23.7g   \n#\n#K CALGORITHM = centroid                algorithm  %-23s     \n#K CBOXWIDTH  = 5.                      scaleunit  %-23.7g   \n#K CTHRESHOLD = 0.                      sigma      %-23.7g   \n#K MINSNRATIO = 1.                      number     %-23.7g   \n#K CMAXITER   = 10                      number     %-23d     \n#K MAXSHIFT   = 1.                      scaleunit  %-23.7g   \n#K CLEAN      = no                      switch     %-23b     \n#K RCLEAN     = 1.                      scaleunit  %-23.7g   \n#K RCLIP      = 2.                      scaleunit  %-23.7g   \n#K KCLEAN     = 3.                      sigma      %-23.7g   \n#\n#K SALGORITHM = centroid                algorithm  %-23s     \n#K ANNULUS    = 24.4                    scaleunit  %-23.7g   \n#K DANNULUS   = 15.                     scaleunit  %-23.7g   \n#K SKYVALUE   = 0.                      counts     %-23.7g   \n#K KHIST      = 3.                      sigma      %-23.7g   \n#K BINSIZE    = 0.1                     sigma      %-23.7g   \n#K SMOOTH     = no                      switch     %-23b     \n#K SMAXITER   = 10                      number     %-23d     \n#K SLOCLIP    = 0.                      percent    %-23.7g   \n#K SHICLIP    = 0.                      percent    %-23.7g   \n#K SNREJECT   = 50                      number     %-23d     \n#K SLOREJECT  = 3.                      sigma      %-23.7g   \n#K SHIREJECT  = 3.                      sigma      %-23.7g   \n#K RGROW      = 0.                      scaleunit  %-23.7g   \n#\n#K WEIGHTING  = constant                model      %-23s     \n#K APERTURES  = 23.3,6:25:5             scaleunit  %-23s     \n#K ZMAG       = 25.                     zeropoint  %-23.7g   \n#\n#N IMAGE               XINIT     YINIT     ID    COORDS                 LID    \\\n#U imagename           pixels    pixels    ##    filename               ##     \\\n#F %-23s               %-10.3f   %-10.3f   %-6d  %-23s                  %-6d    \n#\n#N XCENTER    YCENTER    XSHIFT  YSHIFT  XERR    YERR            CIER CERROR   \\\n#U pixels     pixels     pixels  pixels  pixels  pixels          ##   cerrors  \\\n#F %-14.3f    %-11.3f    %-8.3f  %-8.3f  %-8.3f  %-15.3f         %-5d %-9s      \n#\n#N MSKY           STDEV          SSKEW          NSKY   NSREJ     SIER SERROR   \\\n#U counts         counts         counts         npix   npix      ##   serrors  \\\n#F %-18.7g        %-15.7g        %-15.7g        %-7d   %-9d      %-5d %-9s      \n#\n#N ITIME          XAIRMASS       IFILTER                OTIME                  \\\n#U timeunit       number         name                   timeunit               \\\n#F %-18.7g        %-15.7g        %-23s                  %-23s                   \n#\n#N RAPERT   SUM           AREA       FLUX          MAG    MERR   PIER PERROR   \\\n#U scale    counts        pixels     counts        mag    mag    ##   perrors  \\\n#F %-12.2f  %-14.7g       %-11.7g    %-14.7g       %-7.3f %-6.3f %-5d %-9s      \n#\nSlope-AS40-435_median_S299.929   49.652    366   Slope-AS40-435_median_S366    \\\n   300.120    49.969     0.191   0.317   0.011   0.012          0    NoError   \\\n   94.57384       0.1865725      0.09473237     2064   938      0    NoError   \\\n   1.             INDEF          INDEF                  INDEF                  \\\n   6.00     10709.69      113.2273   1.350839      24.673 1.639 0    NoError  *\\\n   11.00    35964.65      380.2424   3.670495      23.588 1.171 0    NoError  *\\\n   16.00    76082.82      804.4385   3.982883      23.500 1.701 0    NoError  *\\\n   21.00    131202.7      1385.878   134.9305      INDEF  INDEF 305  BadPixels*\\\n   23.30    162159.5      1706.24    793.8187      INDEF  INDEF 305  BadPixels* \nSlope-AS40-435_median_S85.452    55.434    367   Slope-AS40-435_median_S367    \\\n   85.458     55.484     0.006   0.050   0.008   0.006          0    NoError   \\\n   94.59016       0.2281704      0.1264289      1623   1378     0    NoError   \\\n   1.             INDEF          INDEF                  INDEF                  \\\n   6.00     10761.49      112.8701   85.08714      20.175 0.032 0    NoError  *\\\n   11.00    36058.47      380.1428   100.7009      19.992 0.053 0    NoError  *\\\n   16.00    76216.4       804.6936   100.2974      19.997 0.086 0    NoError  *\\\n   21.00    130393.5      1386.111   -719.0389     INDEF  INDEF 305  BadPixels*\\\n   23.30    158316.8      1706.482   -3099.61      INDEF  INDEF 305  BadPixels* \nSlope-AS40-435_median_S848.186   56.486    368   Slope-AS40-435_median_S368    \\\n   848.380    56.544     0.194   0.058   0.013   0.009          0    NoError   \\\n   94.59234       0.1647499      0.06409879     2098   903      0    NoError   \\\n   1.             INDEF          INDEF                  INDEF                  \\\n   6.00     10735.4       113.059    40.88579      20.971 0.048 0    NoError  *\\\n   11.00    36009.39      380.2245   43.06569      20.915 0.088 0    NoError  *\\\n   16.00    76169.49      804.6198   58.62642      20.580 0.102 0    NoError  *\\\n   21.00    131348.9      1386.085   235.8676      INDEF  INDEF 305  BadPixels*\\\n   23.30    161839.2      1706.263   439.7652      INDEF  INDEF 305  BadPixels* \nSlope-AS40-435_median_S464.199   59.384    369   Slope-AS40-435_median_S369    \\\n   464.273    59.617     0.074   0.233   0.010   0.011          0    NoError   \\\n   94.60605       0.1613172      0.04022013     2314   686      0    NoError   \\\n   1.             INDEF          INDEF                  INDEF                  \\\n   6.00     10732.46      113.3501   8.849111      22.633 0.216 0    NoError  *\\\n   11.00    35991.75      380.3943   4.148174      23.455 0.889 0    NoError  *\\\n   16.00    76101.38      804.4529   -4.720454     INDEF  INDEF 0    NoError  *\\\n   21.00    131053.2      1385.598   -32.75801     INDEF  INDEF 0    NoError  *\\\n   23.30    161354.6      1705.858   -29.88808     INDEF  INDEF 0    NoError  * \nSlope-AS40-435_median_S688.924   61.839    370   Slope-AS40-435_median_S370    \\\n   689.056    61.637     0.132   -0.202  0.009   0.017          0    NoError   \\\n   94.56474       0.1917982      -0.04442054    2363   646      0    NoError   \\\n   1.             INDEF          INDEF                  INDEF                  \\\n   6.00     10761.45      113.5188   26.56977      21.439 0.086 0    NoError  *\\\n   11.00    36012.39      380.5187   28.73899      21.354 0.152 0    NoError  *\\\n   16.00    76101.65      804.5662   18.05782      21.858 0.379 0    NoError  *\\\n   21.00    131029.3      1385.578   2.4874        24.011 3.925 0    NoError  *\\\n   23.30    161285.7      1705.41    14.05488      22.130 0.803 0    NoError  * \n"},{"col":4,"comment":"null","endLoc":291,"header":"def str_vals(self)","id":5607,"name":"str_vals","nodeType":"Function","startLoc":217,"text":"def str_vals(self):\n\n        if self.DBMS:\n            IpacFormatE = IpacFormatErrorDBMS\n        else:\n            IpacFormatE = IpacFormatError\n\n        namelist = self.colnames\n        if self.DBMS:\n            countnamelist = defaultdict(int)\n            for name in self.colnames:\n                countnamelist[name.lower()] += 1\n            doublenames = [x for x in countnamelist if countnamelist[x] > 1]\n            if doublenames != []:\n                raise IpacFormatE('IPAC DBMS tables are not case sensitive. '\n                                  'This causes duplicate column names: {}'.format(doublenames))\n\n        for name in namelist:\n            m = re.match(r'\\w+', name)\n            if m.end() != len(name):\n                raise IpacFormatE('{} - Only alphanumeric characters and _ '\n                                  'are allowed in column names.'.format(name))\n            if self.DBMS and not(name[0].isalpha() or (name[0] == '_')):\n                raise IpacFormatE(f'Column name cannot start with numbers: {name}')\n            if self.DBMS:\n                if name in ['x', 'y', 'z', 'X', 'Y', 'Z']:\n                    raise IpacFormatE('{} - x, y, z, X, Y, Z are reserved names and '\n                                      'cannot be used as column names.'.format(name))\n                if len(name) > 16:\n                    raise IpacFormatE(\n                        f'{name} - Maximum length for column name is 16 characters')\n            else:\n                if len(name) > 40:\n                    raise IpacFormatE(\n                        f'{name} - Maximum length for column name is 40 characters.')\n\n        dtypelist = []\n        unitlist = []\n        nullist = []\n        for col in self.cols:\n            col_dtype = col.info.dtype\n            col_unit = col.info.unit\n            col_format = col.info.format\n\n            if col_dtype.kind in ['i', 'u']:\n                if col_dtype.itemsize <= 2:\n                    dtypelist.append('int')\n                else:\n                    dtypelist.append('long')\n            elif col_dtype.kind == 'f':\n                if col_dtype.itemsize <= 4:\n                    dtypelist.append('float')\n                else:\n                    dtypelist.append('double')\n            else:\n                dtypelist.append('char')\n\n            if col_unit is None:\n                unitlist.append('')\n            else:\n                unitlist.append(str(col.info.unit))\n            # This may be incompatible with mixin columns\n            null = col.fill_values[core.masked]\n            try:\n                auto_format_func = get_auto_format_func(col)\n                format_func = col.info._format_funcs.get(col_format, auto_format_func)\n                nullist.append((format_func(col_format, null)).strip())\n            except Exception:\n                # It is possible that null and the column values have different\n                # data types (e.g. number and null = 'null' (i.e. a string).\n                # This could cause all kinds of exceptions, so a catch all\n                # block is needed here\n                nullist.append(str(null).strip())\n\n        return [namelist, dtypelist, unitlist, nullist]"},{"className":"DaophotData","col":0,"comment":"null","endLoc":216,"id":5608,"nodeType":"Class","startLoc":196,"text":"class DaophotData(core.BaseData):\n    splitter_class = fixedwidth.FixedWidthSplitter\n    start_line = 0\n    comment = r'\\s*#'\n\n    def __init__(self):\n        core.BaseData.__init__(self)\n        self.is_multiline = False\n\n    def get_data_lines(self, lines):\n\n        # Special case for multiline daophot databases. Extract the aperture\n        # values from the first multiline data block\n        if self.is_multiline:\n            # Grab the first column of the special block (aperture values) and\n            # recreate the aperture description string\n            aplist = next(zip(*map(str.split, self.first_block)))\n            self.header.aperture_values = tuple(map(float, aplist))\n\n        # Set self.data.data_lines to a slice of lines contain the data rows\n        core.BaseData.get_data_lines(self, lines)"},{"col":4,"comment":"null","endLoc":203,"header":"def __init__(self)","id":5609,"name":"__init__","nodeType":"Function","startLoc":201,"text":"def __init__(self):\n        core.BaseData.__init__(self)\n        self.is_multiline = False"},{"id":5610,"name":"whitespace.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":" \"quoted colname with tab\tinside\"  col2  \t\t col3\nval1   \"val2 with\ttab\"  \t2\n val3   val4                    3\n"},{"id":5611,"name":"cds2.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"Title: The Taurus Spitzer Survey: New Candidate Taurus Members Selected \n       Using Sensitive Mid-Infrared Photometry  \nAuthors: Rebull L.M., Padgett D.L., McCabe C.-E., Hillenbrand L.A., \n         Stapelfeldt K.R., Noriega-Crespo A., Carey S.J., Brooke T., Huard T., \n         Terebey S., Audard M., Monin J.-L., Fukagawa M., Gudel M., Knapp G.R.,\n         Menard F., Allen L.E., Angione J.R., Baldovin-Saavedra C., Bouvier J.,\n         Briggs K., Dougados C., Evans N.J., Flagey N., Guieu S., Grosso N., \n         Glauser A.M., Harvey P., Hines D., Latter W.B., Skinner S.L., \n         Strom S., Tromp J., Wolf S. \nTable: Spitzer measurements for sample of previously identified Taurus members\n================================================================================\nByte-by-byte Description of file: apjs326455t4_mrt.txt\n--------------------------------------------------------------------------------\n   Bytes Format Units   Label    Explanations\n--------------------------------------------------------------------------------\n   1- 15 A15    ---     SST      Spitzer Tau name   \n  17- 39 A23    ---     CName    Common name  \n      41 A1     ---   l_3.6mag   Limit flag on 3.6mag \n  42- 47 F6.2   mag     3.6mag   Spitzer/IRAC 3.6 micron band magnitude (1)\n  49- 52 F4.2   mag   e_3.6mag   ? Uncertainty in 3.6mag\n      54 A1     ---   l_4.5mag   Limit flag on 4.5mag\n  55- 60 F6.2   mag     4.5mag   ? Spitzer/IRAC 4.5 micron band magnitude (1)\n  62- 65 F4.2   mag   e_4.5mag   ? Uncertainty in 4.5mag\n      67 A1     ---   l_5.8mag   Limit flag on 5.8mag\n  68- 73 F6.2   mag     5.8mag   Spitzer/IRAC 5.8 micron band magnitude (1)\n  75- 78 F4.2   mag   e_5.8mag   ? Uncertainty in 5.8mag\n      80 A1     ---   l_8mag     Limit flag on 8.0mag\n  81- 86 F6.2   mag     8mag     ? Spitzer/IRAC 8.0 micron band magnitude (1)\n  88- 91 F4.2   mag   e_8mag     ? Uncertainty in 8mag\n      93 A1     ---   l_24mag    Limit flag on 24mag \n  94-100 F7.2   mag     24mag    ? Spitzer/MIPS 24 micron band magnitude (1)\n 102-105 F4.2   mag   e_24mag    ? Uncertainty in 24mag\n     107 A1     ---   l_70mag    Limit flag on 70mag\n 108-114 F7.2   mag     70mag    ? Spitzer/MIPS 70 micron band magnitude (1)\n 116-119 F4.2   mag   e_70mag    ? Uncertainty in 70mag\n     121 A1     ---   l_160mag   Limit flag on 160mag\n 122-128 F7.2   mag     160mag   ? Spitzer/MIPS 160 micron band magnitude (1)\n 130-133 F4.2   mag   e_160mag   ? Uncertainty in 160mag\n 135-137 A3     ---     ID24/70  Identification in 24/70 micron color-magnitude\n                                  diagram\n 139-147 A9     ---     IDKS/24  Identification in Ks/70 micron\n                                  color-magnitude diagram\n 149-157 A9     ---     ID8/24   Identification in 8/24 micron color-magnitude\n                                  diagram\n 159-167 A9     ---     ID4.5/8  Identification in 4.5/8 micron color-magnitude\n                                  diagram\n 169-171 A3     ---     IDIRAC   Identification in IRAC color-color diagram\n 173-175 A3     ---     Note     Additional note (2)\n--------------------------------------------------------------------------------\nNote (1): To convert between magnitudes and flux densities, we use \n          M= 2.5 log(F_zeropt_/F) where the zero-point flux densities for the \n          seven Spitzer bands are 280.9, 179.7, 115.0, and 64.13 Jy for IRAC \n          and 7.14, 0.775, and 0.159 Jy for MIPS.  IRAC effective wavelengths \n          are 3.6, 4.5, 5.8, and 8.0 microns; MIPS effective wavelengths are \n          24, 70, and 160 microns.\nNote (2):  \n    b = MIPS-160 flux density for this object is subject to confusion with a \n        nearby source or sources. \n    c = MIPS-160 flux density for this object is compromised by missing and/or \n        saturated data. \n    d = MIPS-160 flux density for this object is hard saturated. \n    e = IRAC flux densities for 043835.4+261041=HV Tau C do not appear in our \n        automatically-extracted catalog. Flux densities here are those from \n        Hartmann et al. (2005); since their observations have more redundancy \n        at IRAC bands, they are able to obtain reliable flux densities for \n        this object at IRAC bands.  MIPS flux densities are determined from \n        our data. \n    f = The image morphology around 041426.2+280603 is complex; careful PSF \n        subtraction and modeling will be required to apportion flux densities \n        among the three local maxima seen in close proximity in the IRAC \n        images, which may or may not be three physically distinct sources. \n--------------------------------------------------------------------------------\n041314.1+281910 LkCa 1                     8.54 0.05    8.50 0.05    8.41 0.05    8.43 0.05     8.28 0.08 >   1.30                        no        no        no        no      \n041327.2+281624 Anon 1                     7.23 0.05    7.24 0.05    7.17 0.05    7.08 0.05     6.95 0.05 >   1.27                        no        no        no        no      \n041353.2+281123 IRAS04108+2803 A           9.02 0.05    8.37 0.05    7.67 0.05    6.57 0.05     3.44 0.04 >   0.19      >  -2.05          yes       yes       yes       yes b   \n041354.7+281132 IRAS04108+2803 B           9.38 0.05    8.03 0.05    6.96 0.05    5.78 0.05     1.38 0.04    -1.84 0.22 >  -1.94      yes yes       yes       yes       yes b   \n041357.3+291819 IRAS04108+2910             7.48 0.05    6.84 0.05    6.26 0.05    5.54 0.05     3.13 0.04     1.15 0.22 >  -3.39      yes yes       yes       yes       yes     \n041411.8+281153 J04141188+2811535         10.93 0.06   10.40 0.05   10.12 0.07    8.99 0.06     5.76 0.01 >   1.03                        yes       yes       yes       yes     \n041412.2+280837 IRAS04111+2800G           13.19 0.06   11.90 0.06   11.19 0.06   10.39 0.06     3.47 0.04    -0.33 0.22               yes           yes-faint yes-faint yes     \n041412.9+281212 V773 Tau ABC            <  6.62      <  6.10         5.13 0.05    4.38 0.05     1.69 0.04     0.27 0.22               yes yes       yes                         \n041413.5+281249 FM Tau                     8.09 0.05    7.67 0.05    7.36 0.05    6.42 0.05     2.92 0.04     1.07 0.22               yes yes       yes       yes       yes     \n041414.5+282758 FN Tau                     7.59 0.05    7.17 0.05    6.71 0.05    5.75 0.05     2.03 0.04    -0.25 0.22               yes yes       yes       yes       yes     \n041417.0+281057 CW Tau                  <  6.62      <  6.10         5.08 0.05    4.51 0.05     1.75 0.04    -0.42 0.22               yes yes       yes                         \n041417.6+280609 CIDA-1                     8.67 0.05    8.13 0.05    7.59 0.05    6.71 0.05     3.53 0.04     1.28 0.22               yes yes       yes       yes       yes     \n041426.2+280603 IRAS04113+2758 A        <  6.62      <  6.10         4.63 0.05    3.79 0.05 <   0.45         -2.54 0.22    -4.35 0.34                                       f   \n041430.5+280514 MHO-3                      7.22 0.05    6.49 0.05    5.75 0.05    4.53 0.05 <   0.45         -1.06 0.22    -4.15 0.34                         yes       yes     \n041447.3+264626 FP Tau                     8.11 0.05    7.86 0.05    7.60 0.05    7.27 0.05     4.25 0.04     1.22 0.22               yes yes       yes       yes       yes     \n041447.8+264811 CX Tau                     8.48 0.05    8.13 0.05    7.68 0.05    6.63 0.05     3.35 0.04     1.23 0.22               yes yes       yes       yes       yes     \n041447.9+275234 LkCa 3 AB                  7.28 0.05    7.33 0.05    7.27 0.05    7.23 0.05     7.07 0.05 >   1.17                        no        no        no        no      \n041449.2+281230 FO Tau AB                  7.53 0.05    7.17 0.05    6.72 0.05    5.92 0.05     2.83 0.04     0.79 0.22               yes yes       yes       yes       yes     \n041505.1+280846 CIDA-2                     8.90 0.05    8.79 0.05    8.71 0.05    8.68 0.05     8.45 0.11 >   1.31                        no        no        no        no      \n041514.7+280009 KPNO-1                    13.23 0.13   12.72 0.22   12.94 0.09   12.81 0.10 >  10.61      >   0.90                                            no        no      \n041524.0+291043 J04152409+2910434         11.86 0.05   11.79 0.05   11.66 0.06   11.48 0.06 >  10.06      >   1.14                                            no        no      \n041612.1+275638 J04161210+2756385          9.38 0.05    9.04 0.05    8.71 0.05    8.30 0.05     5.37 0.04     1.55 0.22               yes yes       yes       yes       yes     \n041618.8+275215 J04161885+2752155         10.88 0.05   10.78 0.05   10.67 0.06   10.68 0.06 >   9.95      >   1.26                                            no        no      \n041628.1+280735 LkCa 4                     8.18 0.05    8.17 0.05    8.04 0.05    8.05 0.05     7.94 0.07 >   1.20                        no        no        no        no      \n041639.1+285849 J04163911+2858491         10.50 0.05   10.14 0.05    9.86 0.05    9.41 0.05     7.22 0.05 >   1.24                        yes       yes       yes       yes     \n041733.7+282046 CY Tau                     7.87 0.05    7.53 0.05    7.27 0.05    6.72 0.05     4.42 0.04     1.87 0.22 >  -1.41      yes yes       yes       yes       yes     \n041738.9+283300 LkCa 5                     8.93 0.05                 8.80 0.05                  8.66 0.09 >   1.61                        no                                    \n041749.5+281331 KPNO-10                   10.82 0.05   10.36 0.05    9.81 0.05    8.89 0.05     5.96 0.04     1.92 0.22               yes yes       yes       yes       yes     \n041749.6+282936 V410 X-ray 1               8.41 0.05    7.85 0.05    7.42 0.05    6.47 0.05     3.78 0.04     2.95 0.22               yes yes       yes       yes       yes     \n041807.9+282603 V410 X-ray 3              10.04 0.05    9.94 0.05    9.90 0.06    9.80 0.05     9.27 0.21 >   1.79                        yes       yes-faint no        no      \n041817.1+282841 V410 Anon 13              10.23 0.05    9.94 0.05    9.49 0.05    8.81 0.05     6.04 0.04               >  -0.57          yes       yes       yes       yes     \n041822.3+282437 V410 Anon 24               9.84 0.05    9.54 0.05    9.34 0.05    9.38 0.05     9.29 0.10 >   1.60      >   1.50          yes       no        no        no      \n041829.0+282619 V410 Anon 25               8.87 0.05    8.64 0.05    8.46 0.05    8.39 0.05     8.15 0.08 >   1.67      >   0.12          yes       no        no        no      \n041830.3+274320 KPNO-11                   10.71 0.05   10.59 0.05   10.60 0.06   10.50 0.06 >  10.01      >   1.46                                            no        no      \n041831.1+282716 V410 Tau ABC               7.36 0.05    7.34 0.05    7.34 0.05    7.25 0.05     7.14 0.06 >   1.65                        no        no        no        no      \n041831.1+281629 DD Tau AB               <  6.62      <  6.10         5.29 0.05    4.48 0.05     1.75 0.04    -0.04 0.22               yes yes       yes                         \n041831.5+281658 CZ Tau AB                  8.46 0.05    7.63 0.05    6.62 0.05    5.00 0.05     1.96 0.04     1.45 0.22               yes yes       yes       yes       yes     \n041832.0+283115 IRAS04154+2823             7.57 0.05    7.07 0.05    6.12 0.05    5.52 0.05     1.91 0.04    -0.38 0.22               yes yes       yes       yes       yes     \n041834.4+283030 V410 X-ray 2               8.35 0.05    8.09 0.05    7.80 0.05    7.55 0.05     3.41 0.04     0.31 0.22               yes yes       yes       yes       no      \n041840.2+282424 V410 X-ray 4               8.91 0.05    8.64 0.05    8.44 0.05    8.43 0.05     8.09 0.08 >   1.60      >  -2.59          yes       no        no        no      \n041840.6+281915 V892 Tau                <  6.62      <  6.10         3.61 0.05 <  3.52      <   0.45      <  -2.30      <  -4.90                                            c d \n041841.3+282725 LR1                        9.50 0.05    8.92 0.05    8.44 0.05    7.95 0.05     4.65 0.04     0.38 0.22 >  -0.29      yes yes       yes       yes       yes     \n041842.5+281849 V410 X-ray 7               8.73 0.05    8.61 0.05    8.35 0.05    8.09 0.07     5.15 0.01 >  -0.30      >  -2.88          yes       yes       yes       no      \n041845.0+282052 V410 Anon 20              11.01 0.05   10.74 0.05   10.55 0.06   10.57 0.06 >  10.20      >   0.49      >  -3.20                              no        no      \n041847.0+282007 Hubble 4                   7.09 0.05    7.04 0.05    6.95 0.05    6.96 0.05     6.78 0.01 >   0.18      >  -4.19          no        no        no        no      \n041851.1+281433 KPNO-2                    12.25 0.05   12.11 0.06   12.02 0.06   11.84 0.07 >   9.59      >   1.59                                            no        no      \n041851.4+282026 CoKu Tau/1                10.22 0.05    9.02 0.05    7.72 0.05    5.87 0.05     1.07 0.04    -0.98 0.22 <  -2.55      yes yes       yes       yes       yes c   \n041858.1+281223 IRAS04158+2805             9.23 0.05    8.54 0.05    7.85 0.06    6.84 0.05     2.73 0.04    -0.07 0.22    -2.51 0.22 yes yes       yes       yes       yes     \n041901.1+281942 V410 X-ray 6               8.76 0.05    8.67 0.05    8.54 0.05    8.26 0.05     3.82 0.04     0.69 0.22               yes yes       yes       yes       no      \n041901.2+280248 KPNO-12                   13.97 0.06   13.61 0.06   13.23 0.08   12.75 0.08 >  10.13      >   1.74      >  -0.54                              no        no      \n041901.9+282233 V410 Tau X-ray 5a          9.64 0.05    9.55 0.05    9.43 0.05    9.39 0.05     8.88 0.12 >   1.59      >  -1.28          yes       yes       no        no      \n041912.8+282933 FQ Tau AB                  8.78 0.05    8.42 0.05    8.12 0.05    7.41 0.05     4.85 0.04     2.16 0.22               yes yes       yes       yes       yes     \n041915.8+290626 BP Tau                     7.27 0.05    6.90 0.05    6.65 0.05    5.71 0.05     2.52 0.04     0.71 0.22               yes yes       yes       yes       yes     \n041926.2+282614 V819 Tau                   8.20 0.05    8.29 0.05    8.11 0.05    8.06 0.05     6.29 0.05                                 yes       yes       no        no      \n041935.4+282721 FR Tau                     9.42 0.05    8.93 0.05    8.25 0.05    7.27 0.05     4.84 0.04     3.14 0.22               yes yes       yes       yes       yes     \n041941.2+274948 LkCa 7 AB                  8.11 0.05    8.11 0.05    8.04 0.05    7.99 0.05     7.75 0.06 >   1.94                        no        no        no        no      \n041942.5+271336 IRAS04166+2706            12.84 0.06   11.32 0.05   10.49 0.06    9.75 0.06     2.93 0.04    -1.92 0.22    -4.53 0.34 yes           yes-faint yes-faint yes     \n041958.4+270957 IRAS04169+2702             8.41 0.05    7.15 0.05    6.29 0.05    5.33 0.05     0.66 0.04 <  -2.30         -5.40 0.34     yes       yes       yes       yes     \n042025.5+270035 J04202555+2700355         10.99 0.05   10.77 0.05   10.44 0.06    9.74 0.05     6.13 0.04     2.49 0.22               yes yes       yes-faint yes       yes     \n042039.1+271731 2MASS J04203918+2717317    9.42 0.05    9.39 0.05    9.35 0.05    9.29 0.05     8.83 0.10 >   1.50                        no        no        no        no      \n042107.9+270220 CFHT-19                    7.54 0.05    6.66 0.05    6.01 0.05    5.10 0.05     1.61 0.04    -1.18 0.22 <  -3.27      yes yes       yes       yes       yes c   \n042110.3+270137 IRAS04181+2654B            9.03 0.05    8.24 0.05    7.60 0.05    6.70 0.05     2.69 0.04    -0.47 0.22 <  -3.97      yes yes       yes       yes       yes b c \n042111.4+270109 IRAS04181+2654A            8.60 0.05    7.56 0.05    6.71 0.05    5.71 0.05     1.64 0.04    -1.04 0.22    -4.21 0.34 yes yes       yes       yes       yes b   \n042134.5+270138 J04213459+2701388          9.86 0.05    9.65 0.05    9.35 0.05    8.98 0.05     7.18 0.05 >   1.64                        yes       yes       yes       yes     \n042146.3+265929 CFHT-10                   11.54 0.05   11.32 0.05   11.05 0.06   10.45 0.06     7.26 0.05 >   1.45                        yes       no        yes-faint yes     \n042154.5+265231 J04215450+2652315         13.22 0.06   13.12 0.06   12.90 0.07   12.80 0.08    10.50 0.22 >   1.66                        yes-faint no        no        no      \n042155.6+275506 DE Tau                     7.07 0.05    6.73 0.05    6.40 0.05    5.78 0.05     2.58 0.04    -0.19 0.22               yes yes       yes       yes       yes     \n042157.4+282635 RY Tau                  <  6.62      <  6.10         3.60 0.05 <  3.52      <   0.45      <  -2.30         -4.24 0.34                                           \n042158.8+281806 HD283572                   6.86 0.05    6.86 0.05    6.81 0.05    6.78 0.05     6.76 0.05 >   1.24                        no        no        no        no      \n042200.6+265732 FS Tau B                   9.66 0.05    8.40 0.05    7.23 0.05    5.95 0.05     1.58 0.04    -0.68 0.22 <  -4.14      yes yes       yes       yes       yes b c \n042202.1+265730 FS Tau Aab                 6.75 0.05    6.30 0.05    5.81 0.05    4.99 0.05     1.33 0.04 >   0.05                        yes       yes       yes       yes     \n042203.1+282538 LkCa 21                    8.26 0.05    8.22 0.05    8.14 0.05    8.06 0.05     8.06 0.09 >   1.23                        no        no        no        no      \n042216.4+254911 CFHT-14                   11.48 0.05   11.34 0.05   11.28 0.06   11.23 0.06 >   9.51      >   1.16                                            no        no      \n042216.7+265457 CFHT-21                    7.77 0.05    7.26 0.05    6.85 0.05    6.30 0.05     3.29 0.04     1.18 0.22               yes yes       yes       yes       yes     \n042224.0+264625 2MASS J04222404+2646258    9.52 0.05    9.40 0.05    9.34 0.05    9.33 0.05     9.07 0.12 >   1.56                        no        no        no        no      \n042307.7+280557 IRAS04200+2759             8.43 0.05    7.81 0.05    7.28 0.05    6.44 0.05     3.23 0.04     0.76 0.22               yes yes       yes       yes       yes     \n042339.1+245614 FT Tau                     7.93 0.05    7.46 0.05    7.19 0.05    6.29 0.05     3.15 0.04     0.28 0.22               yes yes       yes       yes       yes     \n042426.4+264950 CFHT-9                    11.16 0.05   10.88 0.05   10.51 0.06    9.83 0.05     6.78 0.05 >   0.77                        yes       yes-faint yes       yes     \n042444.5+261014 IRAS04216+2603             8.08 0.05    7.57 0.05    7.14 0.05    6.32 0.05     3.53 0.04     0.16 0.22    -2.47 0.22 yes yes       yes       yes       yes     \n042445.0+270144 J1-4423                   10.21 0.05   10.15 0.05   10.06 0.06   10.11 0.06 >   9.49      >   1.05                                            no        no      \n042449.0+264310 RXJ0424.8                  7.73 0.05    7.70 0.05    7.69 0.05    7.65 0.05     7.40 0.06 >   1.02                        no        no        no        no      \n042457.0+271156 IP Tau                     7.77 0.05    7.45 0.05    7.24 0.05    6.60 0.05     3.48 0.04     0.74 0.22               yes yes       yes       yes       yes     \n042517.6+261750 J1-4872 AB                 8.21 0.05    8.20 0.05    8.08 0.05    8.06 0.05     7.77 0.07 >   1.10                        no        no        no        no      \n042629.3+262413 KPNO-3                    11.41 0.05   10.99 0.05   10.49 0.06    9.72 0.05     6.86 0.05 >   1.09                        yes       yes-faint yes       yes     \n042630.5+244355 J04263055+2443558         12.57 0.05   12.21 0.06   11.76 0.06   11.08 0.06     8.87 0.15 >   1.09                        yes       no        no        yes     \n042653.5+260654 FV Tau AB               <  6.62      <  6.10         5.23 0.05    4.56 0.05     1.54 0.04    -0.45 0.22               yes yes       yes                         \n042654.4+260651 FV Tau/c AB                8.01 0.05    7.58 0.05    7.05 0.05    6.29 0.05     3.88 0.04 >   0.72      >  -1.64          yes       yes       yes       yes     \n042656.2+244335 IRAS04239+2436             7.61 0.05    6.32 0.05    5.38 0.05    4.50 0.05 <   0.45         -2.25 0.22    -4.63 0.34                         yes       yes     \n042657.3+260628 KPNO-13                    8.75 0.05    8.33 0.05    7.99 0.06    7.35 0.05     5.32 0.04 >   0.93      >  -2.25          yes       yes       yes       yes     \n042702.6+260530 DG Tau B                   8.77 0.05                 5.88 0.05    5.24 0.05     0.78 0.04    -2.24 0.22    -5.12 0.34 yes yes       yes                     b   \n042702.8+254222 DF Tau AB               <  6.62      <  6.10         5.08 0.05    4.50 0.05     2.19 0.04     0.70 0.22               yes yes       yes                         \n042704.6+260616 DG Tau A                <  6.62      <  6.10         4.67 0.05    3.55 0.05 <   0.45      <  -2.30      <  -4.46                                            b c \n042727.9+261205 KPNO-4                    12.57 0.05   12.37 0.06   12.21 0.06   12.08 0.06    10.66 0.28 >   1.05                        yes       no        no        no      \n042745.3+235724 CFHT-15                   13.24 0.06   13.15 0.06   13.25 0.07   13.05 0.10 >  10.55      >   1.06                                            no        no      \n042757.3+261918 IRAS04248+2612 AB          9.83 0.06    9.10 0.05    8.28 0.05    7.10 0.05     2.27 0.04    -1.52 0.22    -4.39 0.34 yes yes       yes       yes       yes     \n042838.9+265135 LDN 1521F-IRS             15.33 0.08   14.25 0.07   13.45 0.10   12.04 0.07     6.16 0.04     0.57 0.22    -4.28 0.34 yes           yes-faint no        no      \n042842.6+271403 J04284263+2714039 AB       9.76 0.05    9.53 0.05    9.21 0.05    8.83 0.05     6.21 0.05 >   0.88                        yes       yes       yes       yes     \n042900.6+275503 J04290068+2755033         12.30 0.05   11.99 0.05   11.60 0.06   10.92 0.06     8.06 0.07 >   0.88                        yes       no        no        yes     \n042904.9+264907 IRAS04260+2642            10.08 0.05    9.40 0.05    8.83 0.05    8.07 0.05     3.60 0.04     0.06 0.22               yes yes       yes       yes       yes     \n042920.7+263340 J1-507                     8.56 0.05    8.55 0.05    8.47 0.05    8.46 0.05     8.29 0.10 >   1.04                        no        no        no        no      \n042921.6+270125 IRAS04263+2654             8.06 0.05    7.67 0.05    7.31 0.05    6.69 0.05     3.41 0.04     1.11 0.22               yes yes       yes       yes       yes     \n042923.7+243300 GV Tau AB               <  6.62      <  6.10      <  3.49      <  3.52      <   0.45      <  -2.30      <  -1.49                                            c d \n042929.7+261653 FW Tau ABC                 9.09 0.05    9.01 0.05    8.88 0.05    8.88 0.05     7.52 0.06 >   1.07                        yes       yes       no        no      \n042930.0+243955 IRAS04264+2433            10.21 0.05    9.43 0.05    8.60 0.05    6.72 0.05     1.12 0.04    -1.37 0.22 >  -1.94      yes yes       yes       yes       yes     \n042941.5+263258 DH Tau AB                  7.63 0.05    7.33 0.05    7.20 0.05    6.86 0.05     3.37 0.04     0.82 0.22               yes yes       yes       yes       yes     \n042942.4+263249 DI Tau AB                  8.21 0.05    8.22 0.05    8.14 0.05    8.11 0.05               >   0.72                                            no        no      \n042945.6+263046 KPNO-5                    11.05 0.05   11.02 0.05   10.94 0.06   10.83 0.06 >   9.71      >   0.90                                            no        no      \n042951.5+260644 IQ Tau                     6.81 0.05    6.37 0.05    6.07 0.05    5.53 0.05     2.82 0.04     0.32 0.22               yes yes       yes       yes       yes     \n042959.5+243307 CFHT-20                    9.02 0.05    8.55 0.05    8.32 0.05    7.84 0.05     4.91 0.04     2.06 0.22               yes yes       yes       yes       yes     \n043007.2+260820 KPNO-6                    13.12 0.06   12.77 0.06   12.42 0.06   11.58 0.06     9.20 0.19 >   1.01                        yes-faint no        no        yes     \n043023.6+235912 CFHT-16                   13.23 0.06   13.15 0.06   13.04 0.08   12.99 0.09 >  10.54      >   1.00                                            no        no      \n043029.6+242645 FX Tau AB                  7.22 0.05    6.96 0.05    6.69 0.05    5.97 0.05     3.03 0.04     1.09 0.22               yes yes       yes       yes       yes     \n043044.2+260124 DK Tau AB               <  6.62      <  6.10         5.52 0.05    4.78 0.05     1.85 0.04     0.08 0.22     0.57 0.22 yes yes       yes                         \n043050.2+230008 IRAS04278+2253          <  6.62      <  6.10      <  3.49      <  3.52      <   0.45         -1.87 0.22    -3.88 0.34                                           \n043051.3+244222 ZZ Tau AB                  8.08 0.05    7.90 0.05    7.61 0.05    6.94 0.05     4.53 0.04 >   0.72      >  -4.46          yes       yes       yes       yes b   \n043051.7+244147 ZZ Tau IRS                 8.11 0.05    7.38 0.05    6.73 0.05    5.78 0.05     2.01 0.04    -0.99 0.22    -3.61 0.22 yes yes       yes       yes       yes b   \n043057.1+255639 KPNO-7                    12.62 0.05   12.28 0.05   11.99 0.06   11.25 0.06     8.62 0.12 >   1.23                        yes       no        no        yes     \n043114.4+271017 JH56                       8.72 0.05    8.75 0.05    8.66 0.05    8.60 0.05     6.76 0.02 >   0.75                        yes       yes       no        no      \n043119.0+233504 J04311907+2335047         11.66 0.05   11.53 0.05   11.56 0.06   11.46 0.06 >  10.59      >   0.86                                            no        no      \n043123.8+241052 V927 Tau AB                8.52 0.05    8.47 0.05    8.38 0.05    8.38 0.05     8.19 0.09 >   0.91                        no        no        no        no      \n043126.6+270318 CFHT-13                   12.90 0.06   12.75 0.06   12.72 0.07   12.70 0.07    10.72 0.29 >   0.68                        yes       no        no        no      \n043150.5+242418 HK Tau AB                  7.71 0.05    7.35 0.05    7.10 0.05    6.58 0.05     2.31 0.04    -0.81 0.22    -3.02 0.22 yes yes       yes       yes       yes     \n043158.4+254329 J1-665                     9.35 0.05    9.29 0.05    9.24 0.05    9.22 0.05     9.04 0.17 >   1.08                        no        no        no        no      \n043203.2+252807 J04320329+2528078         10.30 0.05   10.20 0.05   10.13 0.06   10.09 0.06 >   9.67      >   1.03                                            no        no      \n043215.4+242859 Haro6-13                <  6.62      <  6.10         5.49 0.05    4.85 0.05     0.88 0.04    -1.43 0.22    -4.02 0.34 yes yes       yes                         \n043217.8+242214 CFHT-7 AB                  9.98 0.05    9.87 0.05    9.76 0.05    9.72 0.05     9.30 0.28 >   0.86                        yes       no        no        no      \n043218.8+242227 V928 Tau AB                7.86 0.05    7.82 0.05    7.72 0.05    7.64 0.05     7.54 0.06 >   0.84                        no        no        no        no      \n043223.2+240301 J04322329+2403013         10.89 0.05   10.83 0.05   10.79 0.06   10.67 0.06 >   9.82      >   0.91                                            no        no      \n043230.5+241957 FY Tau                     7.18 0.05    6.76 0.05    6.50 0.05    5.99 0.05     3.67 0.04                                 yes       yes       yes       yes     \n043231.7+242002 FZ Tau                  <  6.62      <  6.10         5.27 0.05    4.58 0.05     2.06 0.04     0.31 0.22               yes yes       yes                         \n043232.0+225726 IRAS04295+2251             8.63 0.05    7.72 0.05    6.83 0.05    5.32 0.05     1.40 0.04    -1.32 0.22    -3.93 0.34 yes yes       yes       yes       yes     \n043243.0+255231 UZ Tau Aab              <  6.62      <  6.10         5.63 0.05    4.79 0.05     1.54 0.04    -0.69 0.22    -2.15 0.22 yes yes       yes                     b   \n043249.1+225302 JH112                      7.41 0.05    7.12 0.05    6.83 0.05    5.89 0.05     2.53 0.04     0.72 0.22               yes yes       yes       yes       yes     \n043250.2+242211 CFHT-5                    10.46 0.05   10.27 0.05   10.09 0.06   10.07 0.06     9.56 0.29 >   1.16      >  -1.44          yes       no        no        no      \n043301.9+242100 MHO-8                      9.32 0.05    9.21 0.05    9.14 0.05    9.09 0.05     8.92 0.15 >   0.88                        no        no        no        no      \n043306.2+240933 GH Tau AB                  7.08 0.05    6.77 0.05    6.50 0.05    6.03 0.05     3.17 0.04     0.43 0.22               yes yes       yes       yes       yes     \n043306.6+240954 V807 Tau AB             <  6.62         6.21 0.05    5.96 0.05    5.57 0.05     2.96 0.04     0.36 0.22               yes yes       yes       yes               \n043307.8+261606 KPNO-14                    9.78 0.05    9.67 0.06    9.60 0.05    9.58 0.05     9.04 0.12 >   1.44      >  -1.91          yes       yes-faint no        no      \n043309.4+224648 CFHT-12                   10.86 0.05   10.63 0.05   10.34 0.06    9.95 0.06     8.25 0.07 >   1.16                        yes       yes-faint yes       yes     \n043310.0+243343 V830 Tau                   8.41 0.05    8.41 0.05    8.37 0.05    8.32 0.05     8.14 0.08 >   1.03                        no        no        no        no      \n043314.3+261423 IRAS04301+2608            12.05 0.05   11.72 0.05   11.29 0.06    9.54 0.05     3.28 0.04     1.12 0.22 >  -0.95      yes yes       yes-faint yes-faint yes     \n043316.5+225320 IRAS04302+2247            10.29 0.05    9.88 0.05    9.72 0.05    9.71 0.06     3.57 0.04    -1.88 0.22    -4.51 0.34 yes yes       yes-faint no        no      \n043319.0+224634 IRAS04303+2240          <  6.62      <  6.10         4.77 0.05    3.73 0.05     1.43 0.04    -0.11 0.22               yes yes       yes                         \n043334.0+242117 GI Tau                     6.87 0.05    6.31 0.05    5.79 0.05    5.12 0.05     2.15 0.04                                 yes       yes       yes       yes     \n043334.5+242105 GK Tau                  <  6.62      <  6.10         5.79 0.05    5.14 0.05     1.70 0.04    -0.23 0.22               yes yes       yes                         \n043336.7+260949 IS Tau AB                  7.85 0.05    7.46 0.05    6.94 0.05    6.03 0.05     3.65 0.04     2.08 0.22 >  -0.83      yes yes       yes       yes       yes     \n043339.0+252038 DL Tau                     6.95 0.05    6.37 0.05    5.92 0.05    5.13 0.05     2.19 0.04    -0.25 0.22    -2.44 0.22 yes yes       yes       yes       yes     \n043342.9+252647 J04334291+2526470         12.76 0.06   12.63 0.06   12.52 0.07   12.47 0.07 >  11.05      >   1.43                                            no        no      \n043352.0+225030 CI Tau                     6.99 0.05    6.53 0.05    6.17 0.05    5.33 0.05     2.37 0.04    -0.80 0.22               yes yes       yes       yes       yes     \n043352.5+225626 2MASS J04335252+2256269    8.79 0.05    8.71 0.05    8.63 0.05    8.60 0.05     8.32 0.09 >   1.41                        no        no        no        no      \n043354.7+261327 IT Tau AB                  7.35 0.05    6.98 0.05    6.63 0.05    6.05 0.05     3.53 0.04     0.83 0.22 >  -1.28      yes yes       yes       yes       yes     \n043410.9+225144 JH108                      9.30 0.05    9.27 0.05    9.19 0.05    9.17 0.05     8.88 0.12 >   1.15                        no        no        no        no      \n043415.2+225030 CFHT-1                    11.23 0.05   11.10 0.05   10.98 0.06   11.02 0.06 >   9.94      >   1.00                                            no        no      \n043439.2+250101 Wa Tau 1                   7.83 0.05    7.79 0.05    7.75 0.05    7.73 0.05     7.67 0.07 >   0.85                        no        no        no        no      \n043455.4+242853 AA Tau                     7.29 0.05    6.84 0.05    6.44 0.05    5.65 0.05     2.81 0.04    -0.14 0.22    -2.47 0.22 yes yes       yes       yes       yes     \n043508.5+231139 CFHT-11                   11.19 0.05   11.12 0.05   11.04 0.06   10.99 0.06    10.23 0.20 >   0.37                        yes       no        no        no      \n043520.2+223214 HO Tau                     8.90 0.05    8.52 0.05    8.38 0.05    7.73 0.05     4.85 0.04     2.43 0.22               yes yes       yes       yes       yes     \n043520.8+225424 FF Tau AB                  8.45 0.05    8.44 0.05    8.42 0.05    8.36 0.05     8.15 0.09 >   1.26                        no        no        no        no      \n043527.3+241458 DN Tau                     7.47 0.05    7.16 0.05    6.78 0.05    6.03 0.05     3.04 0.04     0.44 0.22 >   0.04      yes yes       yes       yes       yes     \n043535.3+240819 IRAS04325+2402 A           9.93 0.05    9.28 0.05    9.06 0.05    8.54 0.05     1.43 0.04    -2.26 0.22    -5.07 0.34 yes yes       yes       yes       yes     \n043540.9+241108 CoKu Tau/3 AB              7.43 0.05    6.95 0.05    6.48 0.05    5.64 0.05     3.31 0.04     1.33 0.22 >  -2.14      yes yes       yes       yes       yes     \n043541.8+223411 KPNO-8                    11.64 0.05   11.54 0.05   11.43 0.06   11.46 0.06 >  10.71      >   1.12                                            no        no      \n043545.2+273713 J04354526+2737130         13.18 0.06   13.11 0.06   12.93 0.07   13.07 0.11 >  10.62      >   1.47                                            no        no      \n043547.3+225021 HQ Tau                  <  6.62      <  6.10         5.61 0.05    4.47 0.05     1.65 0.04    -0.18 0.22               yes yes       yes                         \n043551.0+225240 KPNO-15                    9.79 0.05    9.72 0.05    9.66 0.05    9.65 0.05     9.71 0.11 >   0.72                        no        no        no        no      \n043551.4+224911 KPNO-9                    13.63 0.06   13.52 0.06   13.70 0.12   13.41 0.17 >  10.93      >   0.86                                            no        no      \n043552.0+225503 2MASS J04355209+2255039    9.56 0.05    9.52 0.05    9.39 0.05    9.35 0.06               >   0.50                                            no        no      \n043552.7+225423 HP Tau AB               <  6.62         6.20 0.05    5.65 0.05    4.88 0.05     1.49 0.04    -1.93 0.22    -4.48 0.34 yes yes       yes       yes               \n043552.8+225058 2MASS J04355286+2250585    9.46 0.05    9.36 0.05    9.28 0.05    9.29 0.05     9.10 0.13 >   0.93                        no        no        no        no      \n043553.4+225408 HP Tau/G3 AB               8.62 0.05    8.60 0.05    8.51 0.05    8.47 0.06               >  -0.03      >  -2.19                              no        no      \n043554.1+225413 HP Tau/G2                  7.19 0.05    7.17 0.05    7.11 0.05    7.02 0.05               >  -0.03      >  -2.35                              no        no      \n043556.8+225436 Haro 6-28 AB               8.61 0.05    8.18 0.05    7.85 0.05    7.14 0.05     4.39 0.04 >   0.70      >  -2.24          yes       yes       yes       yes     \n043558.9+223835 2MASS J04355892+2238353    8.15 0.05    8.19 0.05    8.10 0.05    8.06 0.05               >   1.12                                            no        no      \n043610.3+215936 J04361030+2159364         13.02 0.06   12.74 0.06   12.41 0.06   11.74 0.06     9.01 0.18 >   1.07                        yes-faint no        no        yes     \n043610.3+225956 CFHT-2                    11.63 0.05   11.43 0.05   11.34 0.06   11.32 0.06 >  10.61      >   1.48      >  -3.51                              no        no      \n043619.0+254258 LkCa 14                    8.52 0.05    8.54 0.05    8.51 0.05    8.45 0.05     8.24 0.10 >   0.99      >  -0.98          no        no        no        no      \n043638.9+225811 CFHT-3                    11.79 0.05   11.69 0.05   11.59 0.06   11.57 0.06 >   8.55      >   1.12                                            no        no      \n043649.1+241258 HD 283759                  8.32 0.05    8.25 0.05    8.30 0.05    8.20 0.05     6.64 0.05     1.10 0.22 >   0.51      yes yes       yes       no        no      \n043800.8+255857 ITG 2                      9.60 0.05    9.47 0.05    9.37 0.05    9.31 0.05     9.17 0.19 >   0.96      >  -2.05          no        no        no        no      \n043814.8+261139 J04381486+2611399         10.80 0.05   10.21 0.05    9.64 0.05    8.92 0.05     4.98 0.04 >   0.80      >  -1.11          yes       yes       yes       yes     \n043815.6+230227 RXJ0438.2+2302             9.69 0.05    9.69 0.05    9.64 0.05    9.60 0.05 >   9.35      >   1.08                                            no        no      \n043821.3+260913 GM Tau                     9.27 0.05    8.77 0.05    8.43 0.05    7.81 0.05     5.33 0.04 >   0.97      >  -1.31          yes       yes       yes       yes     \n043828.5+261049 DO Tau                  <  6.62      <  6.10         5.26 0.05    4.77 0.05     1.09 0.04    -1.37 0.22    -3.92 0.34 yes yes       yes                         \n043835.2+261038 HV Tau AB                  7.65 0.05    7.59 0.05    7.49 0.05    7.46 0.05               >   0.72      >  -3.65                              no        no      \n043835.4+261041 HV Tau C                  11.33 0.14   10.74 0.05   10.22 0.05    9.38 0.04     3.52 0.04    -0.09 0.22               yes no        yes       yes       yes e   \n043858.5+233635 J0438586+2336352          10.51 0.05                 9.84 0.05                  6.39 0.05 >   0.85                        yes                                   \n043901.6+233602 J0439016+2336030           9.76 0.05                 9.18 0.05                  6.28 0.05 >   2.30                        yes                                   \n043903.9+254426 CFHT-6                    10.75 0.05   10.45 0.05   10.02 0.06    9.14 0.05     6.51 0.05 >   0.47      >  -0.54          yes       yes       yes       yes c   \n043906.3+233417 J0439064+2334179          10.73 0.05                10.62 0.06              >   9.32                                                                            \n043913.8+255320 IRAS04361+2547 AB          8.00 0.05    7.08 0.05    6.46 0.05    4.82 0.05 <   0.45      <  -2.30      <  -4.73                              yes       yes     \n043917.7+222103 LkCa 15                    7.61 0.05    7.41 0.05    7.23 0.05    6.64 0.05     3.11 0.04    -0.40 0.22    -2.47 0.22 yes yes       yes       yes       yes     \n043920.9+254502 GN Tau B                   6.99 0.05    6.58 0.05    6.21 0.05    5.42 0.05     2.82 0.04     1.59 0.22 >  -2.43      yes yes       yes       yes       yes     \n043935.1+254144 IRAS04365+2535             7.22 0.05 <  6.10         4.87 0.05    4.16 0.05 <   0.45         -2.17 0.22 <  -3.82                                            c   \n043947.4+260140 CFHT-4                     9.54 0.05    9.07 0.05    8.60 0.05    7.78 0.05     4.95 0.04 >   0.91      >  -4.76          yes       yes       yes       yes     \n043953.9+260309 IRAS 04368+2557           13.39 0.11   11.15 0.08   10.09 0.07    9.73 0.08     2.69 0.04 <  -2.30      <  -4.40                    yes-faint yes-faint yes c d \n043955.7+254502 IC2087 IRS              <  6.62      <  6.10      <  3.49      <  3.52      <   0.45         -2.17 0.22 >  -5.41                                            c   \n044001.7+255629 CFHT-17 AB                10.15 0.05    9.96 0.05    9.87 0.05    9.82 0.06     9.10 0.18 >   0.74      >  -2.26          yes       yes-faint no        no      \n044008.0+260525 IRAS 04370+2559            7.96 0.05    7.38 0.05    6.93 0.05    5.93 0.05     2.43 0.04     0.75 0.22 >  -1.78      yes yes       yes       yes       yes     \n044039.7+251906 J04403979+2519061 AB       9.84 0.05    9.68 0.06    9.62 0.05    9.57 0.05     7.55 0.05 >   1.00      >  -2.43          yes       yes-faint no        no      \n044049.5+255119 JH223                      8.90 0.05    8.60 0.05    8.24 0.05    7.74 0.05     5.13 0.04     2.20 0.22 >   0.93      yes yes       yes       yes       yes     \n044104.2+255756 Haro 6-32                  9.66 0.05    9.56 0.06    9.49 0.05    9.46 0.06     9.59 0.33 >   0.70      >  -0.83          no        no        no        no      \n044104.7+245106 IW Tau AB                  8.13 0.05    8.15 0.05    8.08 0.05    8.03 0.05     7.97 0.07 >   1.08                        no        no        no        no      \n044108.2+255607 ITG 33 A                   9.68 0.05    9.05 0.05    8.49 0.05    7.73 0.05     4.60 0.04 >   0.67      >   0.73          yes       yes       yes       yes     \n044110.7+255511 ITG 34                    10.78 0.05   10.35 0.05    9.92 0.06    9.22 0.05     6.48 0.05 >   0.74      >  -1.25          yes       yes       yes       yes     \n044112.6+254635 IRAS04381+2540             9.15 0.05    7.76 0.05    6.72 0.05    5.75 0.05     1.43 0.04    -1.92 0.22    -4.33 0.34 yes yes       yes       yes       yes     \n044138.8+255626 IRAS04385+2550             8.24 0.05    7.74 0.05    7.13 0.05    6.05 0.05     1.86 0.04    -0.90 0.22    -2.73 0.22 yes yes       yes       yes       yes     \n044148.2+253430 J04414825+2534304         11.43 0.05   10.93 0.05   10.50 0.06    9.54 0.05     6.33 0.05 >   1.02      >  -4.57          yes       yes-faint yes       yes     \n044205.4+252256 LkHa332/G2 AB              7.99 0.05    7.87 0.05    7.74 0.05    7.70 0.05     7.18 0.05               >  -4.69          yes       yes       no        no  b   \n044207.3+252303 LkHa332/G1 AB              7.65 0.05    7.62 0.05    7.53 0.05    7.51 0.06               >   0.51      >  -2.34                              no        no  b   \n044207.7+252311 V955 Tau Ab                6.99 0.05    6.58 0.05    6.15 0.05    5.40 0.05     2.76 0.04    -0.56 0.22 >  -2.07      yes yes       yes       yes       yes b   \n044221.0+252034 CIDA-7                     9.51 0.05    9.11 0.05    8.65 0.05    7.79 0.05     4.20 0.04     1.13 0.22 >  -1.18      yes yes       yes       yes       yes     \n044237.6+251537 DP Tau                     7.57 0.05    6.90 0.05    6.34 0.05    5.37 0.05     1.90 0.04     0.54 0.22 >  -1.70      yes yes       yes       yes       yes     \n044303.0+252018 GO Tau                     8.90 0.05    8.64 0.05    8.21 0.05    7.42 0.05     4.30 0.04     1.03 0.22 >   0.53      yes yes       yes       yes       yes     \n044427.1+251216 IRAS04414+2506             9.56 0.05    9.00 0.05    8.36 0.05    7.43 0.05     4.25 0.04     1.76 0.22 >   0.05      yes yes       yes       yes       yes     \n044642.6+245903 RXJ04467+2459             10.05 0.05    9.97 0.05    9.87 0.06    9.90 0.05     9.53 0.26 >   0.96                        no        no        no        no      \n"},{"col":4,"comment":"null","endLoc":216,"header":"def get_data_lines(self, lines)","id":5612,"name":"get_data_lines","nodeType":"Function","startLoc":205,"text":"def get_data_lines(self, lines):\n\n        # Special case for multiline daophot databases. Extract the aperture\n        # values from the first multiline data block\n        if self.is_multiline:\n            # Grab the first column of the special block (aperture values) and\n            # recreate the aperture description string\n            aplist = next(zip(*map(str.split, self.first_block)))\n            self.header.aperture_values = tuple(map(float, aplist))\n\n        # Set self.data.data_lines to a slice of lines contain the data rows\n        core.BaseData.get_data_lines(self, lines)"},{"id":5613,"name":"cdsFunctional.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"J/A+A/557/A19   Mass and age of extreme low-mass white dwarfs   (Althaus+, 2013)\n================================================================================\nNew evolutionary sequences for extremely low-mass white dwarfs: Homogeneous mass\nand age determinations and asteroseismic prospects.\n    Althaus L.G., Miller Bertolami M.M., Corsico A.H.\n   <Astron. Astrophys. 557, A19 (2013)>\n   =2013A&A...557A..19A\n================================================================================\nADC_Keywords: Stars, white dwarf ; Models, evolutionary ; Stars, masses ;\n              Stars, ages ; Effective temperatures\nKeywords: white dwarfs - binaries: general - stars: evolution -\n          stars: oscillations - stars: interiors\n\nAbstract:\n    The number of detected extremely low mass (ELM) white dwarf stars has\n    increased drastically in recent year thanks to the results of many\n    surveys. In addition, some of these stars have been found to exhibit\n    pulsations, making them potential targets for asteroseismology.\n\n    We provide a fine and homogeneous grid of evolutionary sequences for\n    helium (He) core white dwarfs for the whole range of their expected\n    masses (0.15<~M_*_/M_{sun}_<~0.45), including the mass range for ELM\n    white dwarfs (M_*_/M_{sun}_<~0.20). The grid is appropriate for mass\n    and age determination of these stars, as well as to study their\n    adiatabic pulsational properties.\n\n    White dwarf sequences have been computed by performing full\n    evolutionary calculations that consider the main energy sources and\n    processes of chemical abundance changes during white dwarf evolution.\n\nDescription:\n    In file elm.dat are data presented in the middle and lower panels of\n    Fig. 5 and 6.\n\nFile Summary:\n--------------------------------------------------------------------------------\n FileName   Lrecl  Records   Explanations\n--------------------------------------------------------------------------------\nReadMe         80        .   This file\nelm.dat       133     4183   Interpolated M(logTeff, logg) relation\n--------------------------------------------------------------------------------\n\nSee also:\n      III/235   : Spectroscopically Identified White Dwarfs (McCook+, 2008)\n J/ApJ/730/67   : Radial velocities of low-mass white dwarfs (Brown+, 2011)\n J/ApJ/731/17   : Variability of low-mass stars in SDSS Stripe 82 (Becker+ 2011)\n J/ApJ/723/1072 : The ELM survey. I. Low-mass white dwarfs (Brown+, 2010)\n\nByte-by-byte Description of file: table2.dat\n--------------------------------------------------------------------------------\n   Bytes Format  Units    Label     Explanations\n--------------------------------------------------------------------------------\n   1- 18 F18.16  [K]      logTe     [3.85,4.79] Log of effective temperature\n  20- 37 F18.16  [cm/s2]  logg      [3,7.7] Surface gravity\n  39- 58 F20.17  Msun     Mass      [0.1/0.6]?=-1 Mass fit\n  60- 83 E24.18  Msun   e_Mass      ?=-1 Mass fit error\n  85-108 E24.18  Myr      Age       ?=-1 Age fit\n 110-133 E24.18  Myr    e_Age       ?=-1 Age fit error\n--------------------------------------------------------------------------------\n\nAcknowledgements:\n   Leandro G. Althaus, althaus( at )fcaglp.unlp.edu.ar,\n                               Universidad Nacional de La Plata\n\n================================================================================\n(End)                                     Emmanuelle Perret [CDS]    16-Jul-2013\n--------------------------------------------------------------------------------\n3.8500000000000001|3.0000000000000000| 0.24458909000000001|3.78770000000000018E-003|      34.946352740000002|      8.2766551100000001\n"},{"id":5614,"name":"simple_csv.csv","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"a,b,c\n1,2,3\n4,5,6"},{"id":5615,"name":"continuation.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"1 3 5 \\\nhello world\n4 6 8 next \\\nline\n"},{"id":5616,"name":"no_data_daophot.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"#K MERGERAD   = INDEF                   scaleunit  %-23.7g  \n#N ID    XCENTER   YCENTER   MAG         MERR          MSKY           NITER    \\\n#U ##    pixels    pixels    magnitudes  magnitudes    counts         ##       \\\n#F %-9d  %-10.3f   %-10.3f   %-12.3f     %-14.3f       %-15.7g        %-6d     \n#N         SHARPNESS   CHI         PIER  PERROR                                \\\n#U         ##          ##          ##    perrors                               \\\n#F         %-23.3f     %-12.3f     %-6d  %-13s                                 \n"},{"id":5617,"name":"simple_csv_missing.csv","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"a,b,c\n1\n4,5,6\n"},{"id":5618,"name":"daophot.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"#K MERGERAD   = INDEF                   scaleunit  %-23.7g  \n#K IRAF = NOAO/IRAFV2.10EXPORT version %-23s\n#K USER =   name %-23s\n#K HOST = tucana computer %-23s\n#K DATE = 05-28-93 mm-dd-yy %-23s\n#K TIME = 14:46:13 hh:mm:ss %-23s\n#K PACKAGE = daophot name %-23s\n#K TASK = nstar name %-23s\n#K IMAGE = test imagename %-23s\n#K GRPFILE = test.psg.1 filename %-23s\n#K PSFIMAGE = test.psf.1 imagename %-23s\n#K NSTARFILE = test.nst.1 filename %-23s\n#K REJFILE = \"hello world\" filename %-23s\n#K SCALE = 1. units/pix %-23.7g\n#K DATAMIN = 50. counts %-23.7g\n#K DATAMAX = 24500. counts %-23.7g\n#K GAIN = 1. number %-23.7g\n#K READNOISE = 0. electrons %-23.7g\n#K OTIME = 00:07:59.0 timeunit %-23s\n#K XAIRMASS = 1.238106 number %-23.7g\n#K IFILTER = V filter %-23s\n#K RECENTER = yes switch %-23b\n#K FITSKY = no switch %-23b\n#K PSFMAG = 16.594 magnitude %-23.7g\n#K PSFRAD = 5. scaleunit %-23.7g\n#K FITRAD = 3. scaleunit %-23.7g\n#K MAXITER = 50 number %-23d\n#K MAXGROUP = 60 number %-23d\n#K FLATERROR = 0.75 percentage %-23.7g\n#K PROFERROR = 5. percentage %-23.7g\n#K CLIPEXP = 6 number %-23d\n#K CLIPRANGE = 2.5 sigma %-23.7g\n#\n#N ID    XCENTER   YCENTER   MAG         MERR          MSKY           NITER    \\\n#U ##    pixels    pixels    magnitudes  magnitudes    counts         ##       \\\n#F %-9d  %-10.3f   %-10.3f   %-12.3f     %-14.3f       %-15.7g        %-6d      \n#\n#N         SHARPNESS   CHI         PIER  PERROR                                \\\n#U         ##          ##          ##    perrors                               \\\n#F         %-23.3f     %-12.3f     %-6d  %-13s                                  \n#\n14       138.538   256.405   15.461      0.003         34.85955       4        \\\n           -0.032      0.802       0     No_error                               \n18       18.114    280.170   22.329      0.206         30.12784       4        \\\n           -2.544      1.104       0     No_error                               \n"},{"id":5619,"name":"apostrophe.tab","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"agasc_id\tn_noids\tn_obs\njean's \t1\t1\n335416352\t3\t8\n"},{"attributeType":"FixedWidthSplitter","col":4,"comment":"null","endLoc":197,"id":5620,"name":"splitter_class","nodeType":"Attribute","startLoc":197,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":198,"id":5621,"name":"start_line","nodeType":"Attribute","startLoc":198,"text":"start_line"},{"attributeType":"null","col":4,"comment":"null","endLoc":199,"id":5622,"name":"comment","nodeType":"Attribute","startLoc":199,"text":"comment"},{"attributeType":"null","col":8,"comment":"null","endLoc":203,"id":5623,"name":"is_multiline","nodeType":"Attribute","startLoc":203,"text":"self.is_multiline"},{"className":"DaophotInputter","col":0,"comment":"null","endLoc":310,"id":5624,"nodeType":"Class","startLoc":219,"text":"class DaophotInputter(core.ContinuationLinesInputter):\n\n    continuation_char = '\\\\'\n    multiline_char = '*'\n    replace_char = ' '\n    re_multiline = re.compile(r'(#?)[^\\\\*#]*(\\*?)(\\\\*) ?$')\n\n    def search_multiline(self, lines, depth=150):\n        \"\"\"\n        Search lines for special continuation character to determine number of\n        continued rows in a datablock.  For efficiency, depth gives the upper\n        limit of lines to search.\n        \"\"\"\n\n        # The list of apertures given in the #K APERTURES keyword may not be\n        # complete!!  This happens if the string description of the aperture\n        # list is longer than the field width of the #K APERTURES field.  In\n        # this case we have to figure out how many apertures there are based on\n        # the file structure.\n\n        comment, special, cont = zip(*(self.re_multiline.search(line).groups()\n                                       for line in lines[:depth]))\n\n        # Find first non-comment line\n        data_start = first_false_index(comment)\n\n        # No data in lines[:depth].  This may be because there is no data in\n        # the file, or because the header is really huge.  If the latter,\n        # increasing the search depth should help\n        if data_start is None:\n            return None, None, lines[:depth]\n\n        header_lines = lines[:data_start]\n\n        # Find first line ending on special row continuation character '*'\n        # indexed relative to data_start\n        first_special = first_true_index(special[data_start:depth])\n        if first_special is None:  # no special lines\n            return None, None, header_lines\n\n        # last line ending on special '*', but not on line continue '/'\n        last_special = first_false_index(special[data_start + first_special:depth])\n        # index relative to first_special\n\n        # if first_special is None: #no end of special lines within search\n        # depth!  increase search depth return self.search_multiline( lines,\n        # depth=2*depth )\n\n        # indexing now relative to line[0]\n        markers = np.cumsum([data_start, first_special, last_special])\n        # multiline portion of first data block\n        multiline_block = lines[markers[1]:markers[-1]]\n\n        return markers, multiline_block, header_lines\n\n    def process_lines(self, lines):\n\n        markers, block, header = self.search_multiline(lines)\n        self.data.is_multiline = markers is not None\n        self.data.markers = markers\n        self.data.first_block = block\n        # set the header lines returned by the search as a attribute of the header\n        self.data.header.lines = header\n\n        if markers is not None:\n            lines = lines[markers[0]:]\n\n        continuation_char = self.continuation_char\n        multiline_char = self.multiline_char\n        replace_char = self.replace_char\n\n        parts = []\n        outlines = []\n        for i, line in enumerate(lines):\n            mo = self.re_multiline.search(line)\n            if mo:\n                comment, special, cont = mo.groups()\n                if comment or cont:\n                    line = line.replace(continuation_char, replace_char)\n                if special:\n                    line = line.replace(multiline_char, replace_char)\n                if cont and not comment:\n                    parts.append(line)\n                if not cont:\n                    parts.append(line)\n                    outlines.append(''.join(parts))\n                    parts = []\n            else:\n                raise core.InconsistentTableError('multiline re could not match line '\n                                                  '{}: {}'.format(i, line))\n\n        return outlines"},{"col":4,"comment":"\n        Search lines for special continuation character to determine number of\n        continued rows in a datablock.  For efficiency, depth gives the upper\n        limit of lines to search.\n        ","endLoc":272,"header":"def search_multiline(self, lines, depth=150)","id":5625,"name":"search_multiline","nodeType":"Function","startLoc":226,"text":"def search_multiline(self, lines, depth=150):\n        \"\"\"\n        Search lines for special continuation character to determine number of\n        continued rows in a datablock.  For efficiency, depth gives the upper\n        limit of lines to search.\n        \"\"\"\n\n        # The list of apertures given in the #K APERTURES keyword may not be\n        # complete!!  This happens if the string description of the aperture\n        # list is longer than the field width of the #K APERTURES field.  In\n        # this case we have to figure out how many apertures there are based on\n        # the file structure.\n\n        comment, special, cont = zip(*(self.re_multiline.search(line).groups()\n                                       for line in lines[:depth]))\n\n        # Find first non-comment line\n        data_start = first_false_index(comment)\n\n        # No data in lines[:depth].  This may be because there is no data in\n        # the file, or because the header is really huge.  If the latter,\n        # increasing the search depth should help\n        if data_start is None:\n            return None, None, lines[:depth]\n\n        header_lines = lines[:data_start]\n\n        # Find first line ending on special row continuation character '*'\n        # indexed relative to data_start\n        first_special = first_true_index(special[data_start:depth])\n        if first_special is None:  # no special lines\n            return None, None, header_lines\n\n        # last line ending on special '*', but not on line continue '/'\n        last_special = first_false_index(special[data_start + first_special:depth])\n        # index relative to first_special\n\n        # if first_special is None: #no end of special lines within search\n        # depth!  increase search depth return self.search_multiline( lines,\n        # depth=2*depth )\n\n        # indexing now relative to line[0]\n        markers = np.cumsum([data_start, first_special, last_special])\n        # multiline portion of first data block\n        multiline_block = lines[markers[1]:markers[-1]]\n\n        return markers, multiline_block, header_lines"},{"id":5626,"name":"short.rdb","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"\n# blank lines\n\nagasc_id\tn_noids\tn_obs\nN\tN\tN\n115345072\t1\t1\n # comment\n335416352\t3\t8\n266612160\t1\t1\n645803280\t1\t1\n117309912\t1\t1\n114950920\t1\t1\n335025040\t2\t24\n\n"},{"id":5627,"name":"html2.html","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"<html>\n<head>\n<meta charset=\"utf-8\"/>\n<meta http-equiv=\"Content-type\" content=\"text/html;charset=UTF-8\"/>\n</head>\n<body>\n<table>\n<tr>\nRow with no data elements\n</tr>\n<tr>\n <th colspan=\"2\">A</th>\n <th>B</th>\n</tr>\n<tr>\n <td>1</td>\n <td>2.5000000000000000001</td>\n <td>3</td>\n</tr>\n<tr>\n <td>1a</td>\n <td>1</td>\n <td>3.5</td>\n  <em> Some junk </em>\n</tr>\n</table>\n</body>\n</html>\n"},{"id":5628,"name":"sextractor3.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"#   1 X_IMAGE                Object position along x                                    [pixel]\n#   2 Y_IMAGE                                                 [pixel]\n#   3 ALPHA_J2000            Right ascension of barycenter (J2000)                      [deg]\n#   4 DELTA_J2000            Declination of barycenter (J2000)                          [deg]\n#   5 MAG_AUTO               Kron-like elliptical aperture magnitude                    [mag]\n#   6 MAGERR_AUTO            RMS error for AUTO magnitude                               [mag]\n#   7 MAG_APER               Fixed aperture magnitude vector                            [mag]\n#  14 MAGERR_APER            RMS error vector for fixed aperture mag.                   [mag]\n  1367.000    184.404 265.1445228 +68.7507679  22.9929   0.2218  24.1804  23.4541  22.9567  22.5162  22.1912  21.5363  21.0361   0.3262   0.2675   0.2203   0.1856   0.1683   0.1621   0.1673\n  1380.235    189.444 265.1384412 +68.7516124  20.9258   0.0569  22.2374  21.5987  21.2943  21.1244  20.9838  20.6672  20.0695   0.0645   0.0497   0.0495   0.0520   0.0533   0.0602   0.0515\n"},{"id":5629,"name":"no_data_without_header.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"# blank data table\n \n"},{"id":5630,"name":"no_data_ipac.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"\\catalog = sao\n\\date = \"Wed Sp 20 09:48:36 1995\"\n\\mykeyword = 'Another way for defining keyvalue string'\n\\ This is an example of a valid comment.\n\\ The 2nd data line is used to verify the exact column parsing \n\\ (unclear if this is a valid for the IPAC format)\n|     ra   |    dec   |   sai   |-----v2---|    sptype        |\n|    real  |   real   |   int   |    real  |     char         |\n|    unit  |   unit   |   unit  |    unit  |     ergs         |\n|    null  |   null   |   null  |    null  |     -999         |\n"},{"col":4,"comment":"null","endLoc":310,"header":"def process_lines(self, lines)","id":5631,"name":"process_lines","nodeType":"Function","startLoc":274,"text":"def process_lines(self, lines):\n\n        markers, block, header = self.search_multiline(lines)\n        self.data.is_multiline = markers is not None\n        self.data.markers = markers\n        self.data.first_block = block\n        # set the header lines returned by the search as a attribute of the header\n        self.data.header.lines = header\n\n        if markers is not None:\n            lines = lines[markers[0]:]\n\n        continuation_char = self.continuation_char\n        multiline_char = self.multiline_char\n        replace_char = self.replace_char\n\n        parts = []\n        outlines = []\n        for i, line in enumerate(lines):\n            mo = self.re_multiline.search(line)\n            if mo:\n                comment, special, cont = mo.groups()\n                if comment or cont:\n                    line = line.replace(continuation_char, replace_char)\n                if special:\n                    line = line.replace(multiline_char, replace_char)\n                if cont and not comment:\n                    parts.append(line)\n                if not cont:\n                    parts.append(line)\n                    outlines.append(''.join(parts))\n                    parts = []\n            else:\n                raise core.InconsistentTableError('multiline re could not match line '\n                                                  '{}: {}'.format(i, line))\n\n        return outlines"},{"id":5632,"name":"apostrophe.rdb","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"# first comment\nagasc_id\tn_noids\tn_obs\n11S\tN\tN\njean's \t1\t1\n  # second comment\n335416352\t3\t8\n"},{"id":5633,"name":"astropy/io/ascii/tests/data/cds/glob","nodeType":"Package"},{"id":5634,"name":"lmxbrefs.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data/cds/glob","text":"LZ Aqr       2002ApJ...581..570T Tomsick, J.A., Heindl, W.A., Chakrabarty, D., Kaaret, P. 2002, ApJ 581, 570 (Orb.Per., Spectr2)\nLZ Aqr       2003ApJ...585..443S Shahbaz, T., et al. (7 authors) 2003, ApJ 585, 443 (M1/M2, Incl, M1, M2)\nLZ Aqr       2004ApJ...610..933T Tomsick, J.A., Gelino, D.M., Halpern, J.P., Kaaret, P. 2004, ApJ 610, 933\nV1333 Aql    1998IAUC.6806Q...1M Chevalier, C., Ilovaisky, S.A. 1998, IAU Circ. No. 6806 (Orb.Per.)\nV1333 Aql    1999A&A...347L..51C Chevalier, C., Ilovaisky, S.A., Leisy, P., Patat, F. 1999, A&A 347, L51 (Spectr2)\nV1333 Aql    2007MNRAS.375.1463C Cornelisse, R., et al. (7 authors) 2007, MNRAS 375, 1463 (M1)\nV1333 Aql    2008ApJ...674L..41C Casella, P., Altamirano, D., Wijnands, R., van der Klis, M. 2008, ApJ 674, L41 (3. Per.)\nV1405 Aql    2001ApJ...549L..85G Galloway, D.K., Chakrabarty, D., Muno, M.P., Savov, P. 2001, ApJ 549, L85 (3. Per.)\nV1405 Aql    2001MNRAS.322..827H Homer, L., et al. (7 authors) 2001, MNRAS 322, 827 (Orb.Per., 2. Per.)\nV1405 Aql    2006ApJ...647.1341I Iaria, R., Di Salvo, T., Lavagetto, G., Robba, N.R., Burderi, L. 2006, ApJ 647, 1341\nV1405 Aql    2006MNRAS.370..255N Nelemans, G., Jonker, P.G., Steeghs, D. 2006, MNRAS 370, 255\nV1405 Aql    2008ApJ...680.1405H Hu, C.-P., Chou, Y., Chung, Y.-Y. 2008, ApJ 680, 1405 (Orb.Per.)\nV1408 Aql    2010MNRAS.402.2671R Russell, D.M., et al. (6 authors) 2010, MNRAS 402, 2671\nV1408 Aql    ................... Bayless, A., Robinson, E.L., Mason, P.A., Robertson, P. 2011, ApJ, in press = arXiv:1004.4904 (Orb.Per.)\nV1487 Aql    1994Natur.371...46M Mirabel, I.F., Rodriguez, L.F. 1994, Nat 371, 46 (Incl)\nV1487 Aql    2004A&A...414L..13H Harlaftis, E.T., Greiner, J. 2004, A&A 414, L13 (Spectr2, M1/M2, Incl, M1, M2)\nV1487 Aql    2007ApJ...668..430D Dhawan, V., Mirabel, I.F., Ribo, M., Rodrigues, I. 2007, ApJ 668, 430\nV1487 Aql    2007ApJ...657..409N Neil, E.T., Bailyn, C.D., Cobb, B.E. 2007, ApJ 657, 409 (Orb.Per., 2. Per.)\nV801 Ara     1986ApJ...305..246F Fujimoto, M.Y., Taam, R.E. 1986, ApJ 305, 246 (M1)\nV801 Ara     2002ApJ...568..279G Giles, A.B., Hill, K.M., Strohmayer, T.E., Cummings, N. 2002, ApJ 568, 279 (Orb.Per., 3. Per)\nV801 Ara     2002ApJ...577..377M Strohmayer, T.E., Markwardt, C.B. 2002, ApJ 577, 377 (3. Per.)\nV801 Ara     2006MNRAS.373.1235C Casares, J., et al. (7 authors) 2006, MNRAS 373, 1235 (Orb.Per.)\nV821 Ara     2002MNRAS.331.1065C Chaty, S., et al. (7 authors) 2002, MNRAS 331, 1065 (Spectr2)\nV821 Ara     2003ApJ...583L..95H Hynes, R.I., Steeghs, D., Casares, J., Charles, P.A., O'Brien, K. 2003, ApJ 583, L95 (Orb.Per., M1/M2, M1)\nV821 Ara     2008ApJ...679L.113M Miller, J.M., et al. (9 authors) 2008, ApJ 679, L113\nV821 Ara     2008MNRAS.385.2205M Munoz-Darias, T., Casares, J., Martinez-Pais, I.G. 2008, MNRAS 385, 2205\nV395 Car     1999A&A...344..101S Shahbaz, T., et al. (6 authors) 1999, A&A 344, 101 (Spectr2)\nV395 Car     2004ApJ...616L.123S Shahbaz, T., et al. (7 authors) 2004, ApJ 616, L123 (Orb.Per.)\nV395 Car     2005MNRAS.356..621J Jonker, P.G., Steeghs, D., Nelemans, G., van der Klis, M. 2005, MNRAS 356, 621 (Orb.Per.)\nV395 Car     2007A&A...474..969S Shahbaz, T., Watson, C.A. 2007, A&A 474, 969\nV395 Car     2007ApJ...669L..85S Steeghs, D., Jonker, P.G. 2007, ApJ 669, L85 (M1/M2, Incl, M1, M2)\nV822 Cen     2007A&A...470.1033C Casares, J., Bonifacio, P., Gonzalez Hernandez, J.I., Molaro, P., Zoccali, M. 2007, A&A 470, 1033 (Orb.Per., M1/M2, Incl, M1, M2)\nV822 Cen     2010ApJ...716.1105K Khargaria, J., Froning, C.S., Robinson, E.L. 2010, ApJ 716, 1105 (Spectr2, Incl, M1)\nBW Cir       2004ApJ...613L.133C Casares, J., Zurita, C., Shahbaz, T., Charles, P.A., Fender, R. 2004, ApJ 613, L133 ( Spectr2)\nBW Cir       2009ApJS..181..238C Casares, J., et al. (11 authors) 2009, ApJS 181, 238 (Orb.Per., M1/M2, Incl, M1, M2)\nV691 CrA     2003MNRAS.339..663J Jonker, P.G., van der Klis, M., Groot, P.J. 2002, MNRAS 339, 663 (Incl)\nV691 CrA     2005ApJ...635..502M Munoz-Darias, T., Casares, J., Martinez-Pais, I.G. 2005, ApJ 635, 502 (M1/M2, M1, M2)\nV691 CrA     2010ApJ...709..251B Bayless, A.J., Robinson, E.L., Cornell, M.E., Hynes, R.I., Ashcraft, T.A. 2010, ApJ 709, 251 (Orb.Per.)\nV691 CrA     2010A&A...515A...1A Burderi, L., et al. (7 authors) 2010, A&A 515, A44 (Orb.Per.)\nV691 CrA     2010MNRAS.409..755J Jain, C., Paul, B., Dutta, A. 2010, MNRAS 409, 755 (Orb.Per., 3. Per.)\nUW CrB       2008ApJ...685..428M Mason, P.A., Robinson, E.L., Gray, C.L., Hynes, R.I. 2008, ApJ 685, 428 (Orb.Per., 2. Per.)\nUW CrB       2009MNRAS.394..892H Hakala, P., Hjalmarsdotter, L., Hannikainen, D., Muhli, P. 2009, MNRAS 394, 892 (Orb.Per., 2. Per.)\nUW CrB       2009ApJ...690.1145N Narita, T., Palmieri, J.B., Tow, E.S. 2009, ApJ 690, 1145\nV404 Cyg     1993MNRAS.265..834C Casares, J., Charles, P.A., Naylor, T., Pavlenko, E.P. 1993, MNRAS 265, 834 (2. Per.)\nV404 Cyg     1994MNRAS.271L...5C Casares, J., Charles, P.A. 1994, MNRAS 271, L5 (Orb.Per., M1/M2)\nV404 Cyg     1994MNRAS.271L..10S Shahbaz, T., et al. (6 authors) 1994, MNRAS 271, L10 (Incl, M2)\nV404 Cyg     1996MNRAS.282..977S Shahbaz, T., Bandyopadhyay, R., Charles, P.A., Naylor, T. 1996, MNRAS 282, 977 (M1)\nV404 Cyg     2009ApJ...706L.230M Miller-Jones, J.C.A., et al. (7 authors) 2009, ApJ 706, L230\nV404 Cyg     2010ApJ...716.1105K Khargaria, J., Froning, C.S., Robinson, E.L. 2010, ApJ 716, 1105 (Spectr2, Incl, M1)\nV1341 Cyg    1998ApJ...493L..39C Casares, J., Charles, P.A., Kuulkers, E. 1997, ApJ 493, L39 (Spectr2)\nV1341 Cyg    2009MNRAS.395.2029E Elebert, P., Callanan, P.J., Torres, M.A.P., Garcia, M.R. 2009, MNRAS 395, 2029\nV1341 Cyg    2010MNRAS.401.2517C Casares, J., Gonzalez Hernandez, J.I., Israelian, G., Rebolo, R. 2010, MNRAS 401, 2517 (Orb.Per., M1/M2, Incl, M1, M2)\nV1341 Cyg    ................... Sazonov, A.N. 2010, arXiv:1011.3980\nV1727 Cyg    1996MNRAS.282.1437S Shahbaz, T. et al. (7 authors) 1996, MNRAS 282, 1437 (Spectr2)\nV1727 Cyg    2007A&A...476..301B Bozzo, E., et al. (11 authors) 2007, A&A 476, 301 (Orb.Per.)\nV1727 Cyg    2008A&A...485..773B Bothwell, M.S., Torres, M.A.P., Garcia, M.R., Charles, P.A. 2008, A&A 485, 773\nV1727 Cyg    2009ApJ...706.1069L Lin, J., Nowak, M.A., Chakrabarty, D. 2009, ApJ 706, 1069 (Orb.Per.)\nIL Lup       1998ApJ...499..375O Orosz, J.A., Jain, R.K., Bailyn, C.D., McClintock, J.E., Remillard, J.A. 1998, ApJ 499, 375 (Spectr2, M2)\nIL Lup       ................... Orosz, J.A. 2003, in: A Massive Star Odyssey: From Main Sequence to Supernova, K.A. van der Hucht, A. Herrero, C. Esteban (eds.), IAU Symp. No. 212, ASP, San Francisco, p. 365 (Orb.Per., M1/M2, Incl, M1)\nIL Lup       2004ApJ...615..880B Buxton, M.M., Bailyn, C.D. 2004, ApJ 615, 880\nIL Lup       2004ApJ...610..378P Park, S.Q., et al. (11 authors) 2004, ApJ 610, 378\nV616 Mon     2007ApJ...663.1215F Froning, C.S., Robinson, E.L., Bitner, M.A. 2007, ApJ 663, 1215 (Spectr2, Incl)\nV616 Mon     2007AJ....133..162H Harrison, T.E., Howell, S.B., Szkody, P., Cordova, F.A. 2007, AJ 133, 162 (Spectr2)\nV616 Mon     2008ApJ...673L.159C Cantrell, A.G., Bailyn, C.D., McClintock, J.E., Orosz, J.A. 2008, ApJ 673, L159\nV616 Mon     2008MNRAS.384..849N Neilsen, J., Steeghs, D., Vrtilek, S.D. 2008, MNRAS 384, 849\nV616 Mon     2010ApJ...710.1127C Cantrell, A.G., et al. (9 authors) 2010, ApJ 710, 1127 (Spectr2, M1/M2, Incl, M1, M2)\nV616 Mon     2010A&A...516A...1L Gonzalez Hernandez, J.I., Casares, J. 2010, A&A 516, A58 (Orb.Per.)\nGR Mus       1987ApJ...313..792M Motch, C., Pedersen, H., Beuermann, K., Pakull, M.W., Courvoisier, T.J.-L. 1987, ApJ 313, 792 (Incl)\nGR Mus       2007MNRAS.380.1182B Barnes, A.D., et al. (7 authors) 2007, MNRAS 380, 1182 (M1/M2, M1, M2)\nGR Mus       2007MNRAS.377..198B Bhattacharyya, S. 2007, MNRAS 377, 198 (3. Per.)\nGR Mus       2009A&A...493..145D Diaz Trigo, M., et al. (6 authors) 2009, A&A 493, 145 (Orb.Per.)\nGU Mus       1994ApJ...436..848O Orosz, J., Bailyn, C.D., Remillard, R.A., McClintock, J.E., Foltz, C.B. 1994, ApJ 436, 848 (M1/M2)\nGU Mus       1996MNRAS.282..191O O'Donoghue, D., Charles, P.A. 1996, MNRAS 282, 191 (2. Per.)\nGU Mus       1996ApJ...468..380O Orosz, J.A., Bailyn, C.D., McClintock, J.E., Remillard, R.A. 1996, ApJ 468, 380 (Orb.Per., M2)\nGU Mus       1997NewA....1..299C Casares, J., Martin, E.L., Charles, P.A., Molaro, P., Rebolo, R. 1997, New Astron. 1, 299 (Orb.Per., Spectr2)\nGU Mus       2001AJ....122..971G Gelino, D.M., Harrison, T.E., McNamara, B.J. 2001, AJ 122, 971 (Incl, M1)\nGU Mus       2002A&A...391..993S Sutaria, F.K., et al. (10 authors) 2002, A&A 391, 993\nGU Mus       2003MNRAS.340..447H Hynes, R.I., et al. (6 authors) 2003, MNRAS 340, 447\nQX Nor       2002ApJ...568..901W Wachter, S., Hoard, D.W., Bailyn, C.D., Corbel, S., Kaaret, P. 2002, ApJ 568, 901 (Orb.Per.)\nQX Nor       ................... Strohmayer, T., Bildsten, L. 2006, in: Compact Stellar X-Ray Sources, W.H.G. Lewin, and M. van der Klis (eds.), Cambridge Astrophysics Series 39, Cambridge University Press, Cambridge, p. 113 (3. Per.)\nQX Nor       2008A&A...479..177K Keek, L., et al. (6 authors) 2008, A&A 479, 177\nQX Nor       2010ApJ...712..964G Guever, T., Oezel, F., Cabrera-Lavers, A., Wroblewski, P. 2010, ApJ 712, 964 (M1)\nV381 Nor     2002ApJ...568..845O Orosz, J.A., et al. (9 authors) 2002, ApJ 568, 845 (Orb.Per, Spectr2, M1/M2, Incl, M1, M2)\nV381 Nor     2004MNRAS.353..980K Kubota, A., Done, C. 2004, MNRAS 353, 980\nV2107 Oph    1996ApJ...459..226R Remillard, R.A., Orosz, J.A., McClintock, J.E., Bailyn, C.D. 1996, ApJ 459, 226 (Orb.Per.)\nV2107 Oph    1997PASP..109..461F Filippenko, A.V., Matheson, T., Leonard, D.C., Barth, A.J., van Dyk, S.D. 1997, PASP 109, 461 (Incl, M1, M2)\nV2107 Oph    1997AJ....114.1170H Harlaftis, E.T., Steeghs, D., Horne, K., Filippenko, A.V. 1997, AJ 114, 1170 (Spectr2, M1/M2)\nV2134 Oph    1984ApJ...283..765C Cominsky, L.R., Wood, K.S. 1984, ApJ 283, 765 (Incl)\nV2134 Oph    2001A&A...376..532O Oosterbroek, T., Parmar, A.N., Sidoli, L., in 't Zand, J.J.M., Heise, J. 2001, A&A 376, 532 (Orb.Per.)\nV2134 Oph    2006MNRAS.372..479C Cackett, E.M., et al. (6 authors) 2006, MNRAS 372, 479\nV2216 Oph    2006MNRAS.368..781K Kong, A.K.H., Charles, P.A., Homer, L., Kuulkers, E., O'Donoghue, D. 2006, MNRAS 368, 781 (Orb.Per.)\nV2216 Oph    2007MNRAS.380.1219C Cornelisse, R., et al. (7 authors) 2007, MNRAS 380, 1219 (Orb.Per.)\nV2216 Oph    2009ApJ...696.1987H Harris, R.J., et al. (6 authors) 2009, ApJ 696, 1987 (Orb.Per.)\nV2293 Oph    1996A&A...314..123M Masetti, N., Bianchini, A., Bonibaker, J., Della Valle, M., Vio, R. 1996, A&A 314, 123 (2. Per.)\nV2293 Oph    2002MNRAS.331.1065C Chaty, S., et al. (7 authors) 2002, MNRAS 331, 1065 (Spectr2)\nV1055 Ori    2006MNRAS.370..255N Nelemans, G., Jonker, P.G., Steeghs, D. 2006, MNRAS 370, 255 (Orb.Per., 2. Per.)\nV1055 Ori    2008PASP..120..848S Shahbaz, T., Watson, C.A., Zurita, C., Villaver, E., Hernandez-Peralta, H. 2008, PASP 120, 848\nV1055 Ori    2008ApJ...672L..37S Strohmayer, T.E., Markwardt, C.B., Kuulkers, E. 2008, ApJ 672, L37 (3. Per.)\nV518 Per     2000MNRAS.317..528W Webb, N.A., Naylor, T., Ioannou, Z., Charles, P.A., Shahbaz, T. 2000, MNRAS 317, 528 (Orb. Per., M1/M2)\nV518 Per     2003ApJ...599.1254G Gelino, D.M., Harrison, T.E. 2003, ApJ 599, 1254 (Spectr2, Incl, M1, M2)\nV518 Per     2007MNRAS.374..657R Reynolds, M.T., Callanan, P.J., Fillipenko, A.V. 2007, MNRAS 374, 657\nV518 Per     2009PASJ...61....1I Kato, T., et al. (130 authors) 2009, PASJ 61, S395 (2. Per.)\nV4134 Sgr    1985MNRAS.216.1033M Mason, K.O., Parmar, A.N., White, N.E. 1985, MNRAS 216, 1033 (Orb.Per.)\nV4134 Sgr    2006ApJ...641..410K Kaaret, P., et al. (7 authors) 2006, ApJ 641,410\nV4580 Sgr    2008MNRAS.391.1619D Deloye, C.J., Heinke, C.O., Taam, R.E., Jonker, P.G. 2008, MNRAS 391, 1619\nV4580 Sgr    2008MNRAS.389.1851S Di Salvo, T., Burderi, L., Riggio, A., Papitto, A., Menna, M.T. 2008, MNRAS 389, 1851\nV4580 Sgr    2008ApJ...675.1468H Hartman, J.M., et al. (9 authors) 2008, ApJ 675, 1468 (Orb.Per., 3. Per.)\nV4580 Sgr    2009A&A...496L..17B Burderi, L., et al. (7 authors) 2009, A&A 496, L17 (Orb.Per., 3. Per.)\nV4580 Sgr    2009ApJ...694L..21C Cackett, E.M., et al. (7 authors) 2009, ApJ 694, L21 (Incl)\nV4580 Sgr    2009A&A...495L...1C Cornelisse, R., et al. (9 authors) 2009, A&A 495, L1\nV4580 Sgr    2009MNRAS.395..884E Elebert, P., et al. (11 authors) 2009, MNRAS 395, 884 (M1/M2, M1, M2)\nV4580 Sgr    2009ApJ...702.1673H Hartman, J.M., et al. (7 authors) 2009, ApJ 702, 1673 (Orb.Per., 3. Per.)\nV4580 Sgr    2009ApJ...691.1035H Heinke, C.O., Jonker, P.G., Wijnands, R., Deloye, C.J., Taam, R.E. 2009, ApJ 691, 1035\nV4580 Sgr    2009MNRAS.400..492I Ibragimov, A., Poutanen, J. 2009, MNRAS 400, 492 (Incl)\nV4580 Sgr    2009ApJ...698L..60P Patruno, A., Wijnands, R., van der Klis, M. 2009, ApJ 698, L60 (3. Per.)\nV4580 Sgr    2009ApJ...694.1115W Wang, Z., Bassa, C., Cumming, A., Kaspi, V.M. 2009, ApJ 694, 1115\nV4634 Sgr    2005ApJ...634.1261T Thompson, T.W.J., Rothschild, R.E., Tomsick, J.A., Marshall, H.L. 2005, ApJ 634, 1261 (3. Per.)\nV4634 Sgr    2010AstL...36..738M Meshcheryakov, A.V., Revnivtsev, M.G., Pavlinsky, M.N., Khamitov, I., Bikmaev, I.F. 2010, Astron. Letters 36, 738 (Orb.Per.)\nV4641 Sgr    2001IBVS.5068....1G Goranskij, V.P. 2001, IBVS No. 5068 (Orb.Per.)\nV4641 Sgr    2001ApJ...555..489O Orosz, J., et al. (9 authors) 2001, ApJ 555, 489 (Orb.Per.)\nV4641 Sgr    ................... Orosz, J.A. 2003, in: A Massive Star Odyssey: From Main Sequence to Supernova, K.A. van der Hucht, A. Herrero, C. Esteban (eds.), IAU Symp. No. 212, ASP, San Francisco, P. 365 (M1/M2, Incl, M1, M2)\nV4641 Sgr    2006PASJ...58..595S Sadakane, K, et al. (13 authors) 2006, PASJ, 58, 595\nV5511 Sgr    2007MNRAS.375..971P Papitto, A., et al. (6 authors) 2006, MNRAS 375, 971 (Orb.Per., 3. Per.)\nV5511 Sgr    2008MNRAS.391..254C Chung, C.T.Y., Galloway, D.K., Melatos, A. 2008, MNRAS 391, 254 (Orb.Per., 3. Per.)\nV5511 Sgr    2009ApJ...698L..60P Patruno, A., Wijnands, R., van der Klis, M. 2009, ApJ 698, L60 (3. Per.)\nV818 Sco     2003A&A...398L..25M Mirabel, I.F., Rodrigues, I. 2003, A&A 398, L25\nV818 Sco     2003PASP..115..739V Vanderlinde, K.W., Levine, A.M., Rappaport, S.A. 2003, PASP 115, 739 (Orb.Per.)\nV926 Sco     1998A&A...332..561A Augusteijn, T., van der Hooft, F., de Jong, J.A., van Kerkwijk, M.H., van Paradijs, J. 1998, A&A 332, 561 (Orb.Per.)\nV926 Sco     2006MNRAS.373.1235C Casares, J., et al. (7 authors) 2006, MNRAS 373, 1235 (Orb.Per.)\nV1033 Sco    2001ApJ...554.1290G Greene, J., Bailyn, C.D., Orosz, J.A. 2001, ApJ 554, 1290 (Orb.Per.)\nV1033 Sco    2003MNRAS.339.1031S Shahbaz, T. 2003, MNRAS 339, 1031 (M1/M2, Incl, M1, M2)\nV1033 Sco    2006A&A...457..249F Foellmi, C., Depagne, E., Dall, T.H., Mirabel, I.F. 2006, A&A 457, 249 (Spectr2)\nV1033 Sco    2008A&A...478..203G Gonzalez Hernandez, J.I., Rebolo, R., Israelian, G. 2008, A&A 478, 203; Erratum in A&A 499, 891 (2009) (Orb.Per.)\nV1101 Sco    1997A&A...325.1035B Barziv, O., et al. (8 authors) 1997, A&A 325, 1035\nV1101 Sco    1997ApJ...490..401W Wachter, S. 1997, ApJ 490, 401 (Orb.Per.)\nMM Ser       ................... Ponman, T.J. 1981, Space Sci. Rev. 30, 353 (2. Per.)\nMM Ser       ................... Mason, K.O. 1986, in: Physics of Accretion onto Compact Objects, K.O. Mason, M.G. Watson and N.E. White (eds.), Lecture Notes in Physics 266, Springer Verlag, Heidelberg, p. 29 (Orb.Per.)\nMM Ser       2004MNRAS.348..100H Hynes, R.I., et al. (7 authors) 2004, MNRAS 348, 100\nKZ TrA       1981ApJ...244.1001M Middleditch, J., Mason, K.O., Nelson, J.E., White, N.E. 1981, ApJ 244, 1001 (Orb.Per.)\nKZ TrA       2007ApJ...660..605K Krauss, M.I., Schulz, N.S., Chakrabarty, D., Juett, A.M., Cottam, J. 2007, ApJ 660, 605 (3. Per.)\nKZ TrA       2010ApJ...708.1500C Camero-Arranz, A., Finger, M.H., Ikhsanov, N.R., Wilson-Hodge, C.A., Beklen, E. 2010, ApJ 708, 1500 (3. Per.)\nLU TrA       ................... Brammer, G., Wachter, S., Hoard, D.W., Smale, A.P. 2001, BAAS 33(4), Abstr. 6.1 (Orb.Per.)\nLU TrA       2006MNRAS.370..255N Nelemans, G., Jonker, P.G., Steeghs, D. 2006, MNRAS 370, 255\nKV UMa       2006ApJ...642..438G Gelino, D.M., et al. (6 authors) 2006, ApJ 642, 438 (Spectr2, M1/M2, Incl, M1, M2)\nKV UMa       2008ApJ...679..732H Gonzalez-Hernandez, J.I., et al. (8 authors) 2008, ApJ 679, 732 (Orb.Per., Spectr2)\nKV UMa       2009MNRAS.399..539C Calvelo, D.E., et al. (7 authors) 2009, MNRAS 399, 539 (M1/M2)\nKV UMa       2009PASJ...61....1I Kato, T., et al. (130 authors) 2009, PASJ 61, S395 (2. Per.)\nMM Vel       1999PASP..111..969F Filippenko, A.V., et al. (6 authors) 1999, PASP 111, 969 (Orb.Per., M1/M2, Incl, M1, M2)\nMM Vel       2003MNRAS.340..447H Hynes, R.I., et al. (6 authors) 2003, MNRAS 340, 447\nMM Vel       ................... Macias, P., et al. (8 authors) 2011, BAAS 43, abstract 143.04\nUY Vol       2009MNRAS.399.2055B Bassa, C.G., Jonker, P.G., Steeghs, D., Torres, M.A.P. 2009, MNRAS 399, 2055 (M1)\nUY Vol       ................... Galloway, D.K., Chakrabarty, D., Lin, J.R. 2009, ATel #2094 (3. Per.)\nUY Vol       2010ApJ...711L.148G Galloway, D.K., Chakrabarty, D., Lin, J.R., Hartman, J.M. 2010, ApJ 711, L148 (3. Per.)\nUY Vol       2009ApJ...697L..14H Hynes, R.I., Jones, E.D. 2009, ApJ 697, L14\nUY Vol       2009MNRAS.394L.136M Munoz-Darias, T., et al. (7 authors) 2009, MNRAS 394, L136\nUY Vol       2009ApJS..183..156W Wolff, M.T., Ray, P.S., Wood, K.S., Hertz, P.L. 2009, ApJS 183, 156 (Orb.Per.)\nQZ Vul       1996PASP..108..762H Harlaftis, E., Horne, K., Filippenko, A.V. 1996, PASP 108, 762 (Spectr2)\nQZ Vul       1996MNRAS.282..191O O'Donoghue, D., Charles, P.A. 1996, MNRAS 282, 191 (2. Per.)\nQZ Vul       ................... Orosz, J.A. 2003, in: A Massive Star Odyssey: From Main Sequence to Supernova, K.A. van der Hucht, A. Herrero, C. Esteban (eds.), IAU Symp. No. 212, ASP, San Francisco, p. 365 (M1/M2, Incl, M1, M2)\nQZ Vul       2004AJ....127..481I Ioannou, Z., Robinson, E.L., Welsh, W.F., Haswell, C.A. 2004, AJ 127, 481 (Orb.Per)\nV406 Vul     2001IAUC.7644....1C Filippenko, A.V., Chornock, R. 2001, IAU Circ. No. 7644 (Orb.Per., Spectr2, M1)\nV406 Vul     2004PASJ...56....1S Uemura, M., et al. (7 authors) 2004, PASJ 56, S147 (2. Per.)\nAC 211       2003A&A...399..211I Ioannou, Z., et al. (7 authors) 2003, A&A 399, 211 (Orb.Per.)\nAC 211       2004MNRAS.350..649V van Zyl, L., et al. (6 authors) 2004, MNRAS 350, 649 (M1/M2, Incl, M1, M2)\nAC 211       2006ApJS..163..372W Wen, L., Levine, A.M., Corbet, R.H.D., Bradt, H.V. 2006, ApJS 163, 372 (Orb.Per.)\nLMC X-2      1991ApJ...373..228C Cowley, A.P., Schmidtke, P.C., Crampton, D., Hutchings, J.B., Bolte, M. 1991, ApJ 373, 228 (2. Per.)\nLMC X-2      2007MNRAS.381..194C Cornelisse, R., et al. (7 authors) 2007, MNRAS 381, 194 (Orb.Per.)\nM 51 X-7     2002ApJ...581L..93L Liu, J.-F., Bregman, J.N., Irwin, J., Seitzer, P. 2002, ApJ 581, L93\nM 51 X-7     2005ApJ...635..198D Dewangan, G.C., Griffiths, R.E., Choudhuey, M., Miyaji, T., Schurch, N.J. 2005, ApJ 635, 198 (Orb.Per.)\nNGC 104-W37  2005ApJ...622..556H Heinke, C.O., Grindaly, J.E., Edmonds, P.D. 2005, ApJ 622, 556 (Orb.Per.)\nNGC 104-X5   2002ApJ...564L..17E Edmonds, P.D., Heinke, C.O., Grindaly, J.E., Gilliland, R.L. 2002, ApJ 564, L17 (Orb.Per.)\nNGC 104-X5   2003ApJ...588..452H Heinke, C.O., Grindlay, J.E., Lloyd, D.A., Edmonds, P.D. 2003, ApJ 588, 452 (Orb.Per.)\nNGC 104-X7   2002ApJ...564L..17E Edmonds, P.D., Heinke, C.O., Grindaly, J.E., Gilliland, R.L. 2002, ApJ 564, L17 (Orb.Per.)\nNGC 104-X7   2003ApJ...588..452H Heinke, C.O., Grindlay, J.E., Lloyd, D.A., Edmonds, P.D. 2003, ApJ 588, 452\nNGC 7078-X2  2005ApJ...634L.105D Dieball, A., et al. (8 authors) 2005, ApJ 634, L105 (Orb.Per.)\nJ0029+5934   2008ApJ...680..615J Jonker, P.G., Torres, M.A.P., Steeghs, D. 2008, ApJ 680, 615\nJ0029+5934   2008ApJ...672.1079T Torres, M.A.P., et al. (13 authors) 2008, ApJ 672, 1079\nJ0029+5934   2009ApJ...698L..60P Patruno, A., Wijnands, R., van der Klis, M. 2009, ApJ 698, L60 (3. Per.)\nJ0029+5934   2010A&A...517A...1H Lewis, F., et al. (21 authors) 2010, A&A 517, A72\nJ0029+5934   2010ApJ...722..909P Patruno, A. 2010, ApJ 722, 909 (Orb.Per., 3. Per.)\nJ0029+5934   2011ApJ...726...26H Hartman, J.M., Galloway, D.K., Chakrabarty, D. 2011, ApJ 726, 26 (Orb.Per., 3. Per.)\nJ0029+5934   ................... Papitto, A., et al. (6 authors) 2011, A&A, subm. = arXiv:1006.1303 (Orb.Per., 3. Per.)\n0042+3244    ................... Charles, P., Thorstensen, J., Bowyer, S. 1978, MNRAS 183, 29P\n0042+3244    ................... Watson, M.G., Ricketts, M.J. 1978, MNRAS 183, 35P (Orb.Per.)\nJ0042+4118   ................... Barnard, R., Kolb, U., Osborne, J.P. 2002, in: New Visions of the X-ray Universe in the XMM-Newton and Chandra Era, F. Jensen (ed.), ESA SP-488, (has not been published), = astro-ph/0203475 (Orb.Per.)\nJ0043+4107   2002ApJ...581L..27T Trudolyubov, S.P., et al. (7 authors) 2002, ApJ 581, L27 (Orb.Per.)\nJ0043+4107   2006MNRAS.366..287B Barnard, R., et al. (6 authors) 2006, MNRAS 366, 287\nJ0043+4112   2004A&A...419.1045M Mangano, V., Israel, G.L., Stella, L. 2004, A&A 419, 1045 (Orb.Per.)\nJ0055-3738   2003ApJ...590L..13K Kong, A.K.H., Di Stefano, R. 2003, ApJ 590, L13 (Orb.Per.)\n0512-4006    2009ApJ...699.1113Z Zurek, D.R., Knigge, C., Maccarone, T.J., Dieball, A., Long, K.S. 2009, ApJ 699, 1113 (Orb.Per.)\n0512-4006    2010MNRAS.406.2087M Maccarone, T.J., Long, K.S., Knigge, C., Dieball, A., Zurek, D.R. 2010, MNRAS 406, 2087\n0918-5459    ................... Zhong, J., Wang, Z. 2010, ApJ, subm. = arXiv:1006.3980 (Orb.Per.)\nJ0929-3123   2002ApJ...576L.137G Galloway, D.K., Chackrabarty, D., Morgan, E.H., Remillard, R.A. 2002, ApJ 576, L137 (Orb.Per., 3. Per.)\nJ0929-3123   2009A&A...497..445I Iacolina, M.N., Burgay, M., Burderi, L., Posenti, A., Di Salvo, T. 2009, A&A 497, 445\nJ0929-3123   2009ApJ...698L..60P Patruno, A., Wijnands, R., van der Klis, M. 2009, ApJ 698, L60 (3. Per.)\nJ1023+0038   2005AJ....130..759T Thorstensen, J.R., Armstrong, E. 2005, AJ 130, 759 (Spectr2)\nJ1023+0038   ................... Archibald, A.M., et al. (18 authors) 2009, Sci 324, 1411 (Orb.Per., 3. Per., M1/M2, Incl)\nJ1023+0038   2009ApJ...703.2017W Wang, Z., et al. (7 authors) 2009, ApJ 703, 2017\nJ1047+1234   2006ApJ...650..879F Fabbiano, G., et al. (12 authors) 2006, ApJ 650, 879 (Orb.Per.)\nJ1227-4853   2008A&A...487..271B Butters, O.W., Norton, A.J., Hakala, P., Mukai, K., Barlow, E.J. 2008, A&A 487, 271 (3. Per.)\nJ1227-4853   2009MNRAS.395..386P Pretorius, M.L. 2009, MNRAS 395, 386\nJ1227-4853   2009PASJ...61L..13S Saitou, K., Tsujimoto, M., Ebisawa, K., Ishida, M. 2009, PASJ 61, L13\nJ1227-4853   2010A&A...515A...1A de Martino, D., et al. (10 authors) 2010, A&A 515, A25 (Orb.Per.)\nJ1242+3232   2007A&A...471L..55C Carpano, S., Pollock, A.M.T., King, A.R., Wilms, J., Ehle, M. 2007, A&A 471, L55 (Orb.Per.)\n1323-6152    2005A&A...436..195B Boirin, L., Mendez, M., Diaz Trigo, M., Parmar, A.N., Kaastra, J.S. 2005, A&A 436, 195\n1323-6152    ................... Levine, A.M., Corbet, R. 2006, ATel #940 (Orb.Per.)\n1323-6152    2009A&A...500..873B Balucinska-Church, M., Dotani, T., Hirotsu, T., Church, M.J. 2009, A&A 500, 873\nJ1538-5542   ................... Kennea, J.A., et al. (12 authors) 2007, ATel #1209 (Orb.Per.)\n1543-6224    2004MNRAS.348L...7N Nelemans, G., Jonker, P.G., Marsh, T.R., van der Klis, M. 2004, MNRAS 348, L7\n1543-6224    2004ApJ...616L.139W Wang, Z., Chakrabarty, D. 2004, ApJ 616, L139 (Orb.Per.)\n1624-4904    2001A&A...378..847B Balucinska-Church, M., Barnard, R., Church, M.J., Smale, A.P. 2001, A&A 378, 847\n1624-4904    2001ApJ...550..962S Smale, A.P., Church, M.J., Balucinska-Church, M. 2001, ApJ 550, 962 (Orb.Per.)\nJ1650-4957   2003ApJ...586..419K Kalemci, E., et al. (8 authors) 2003, ApJ 586, 419\nJ1650-4957   2003ApJ...592.1100T Tomsick, J.A., Kalemci, E., Corbel, S., Kaaret, P. 2003, ApJ 592, 1100\nJ1650-4957   2004ApJ...616..376O Orosz, J.A., McClintock, J.E., Remiilard, R.A., Corbel, S. 2004, ApJ 616, 376 (Orb.Per., Spectr2, Incl, M1)\nJ1659-1515   ................... Belloni, T.M., Munoz-Darias, T., Kuulkers, E. 2010, ATel #2926 (Orb.Per.)\n1705-4402    1987ApJ...323..288L Langmeier, M., Sztajno, M., Hasinger, G., Truemper, J., Gottwald, M. 1987, ApJ 323, 288 (Orb.Per.)\n1705-4402    2009ApJ...692...73H Homan, J., Kaplan, D.L., van den Berg, M., Young, A.J. 2009, ApJ 692, 73\nJ1710-2807   2009A&A...502..905Y Younes, G., Boirin, L., Sabra, B. 2009, A&A 502, 905\nJ1710-2807   ................... Jain, C., Paul. B. 2011, MNRAS, in press = arXiv:1011.6054 (Orb.Per.)\n1728-3347    1999ApJ...516L..81S Strohmayer, T.E., Markwardt, C.B. 1999, ApJ 516, L81 (3. Per.)\n1728-3347    2001ApJ...551..907V van Straaten, S., van der Klis, M., Kuulkers, E., Mendez, M. 2001, ApJ 551, 907 (3. Per.)\n1728-3347    2010ApJ...724..417G Galloway, D.K., Yao, Y., Marshall, H., Misanovic, Z., Weinberg, N. 2010, ApJ 724, 417 (Orb.Per.)\n1740-2943    1997A&A...319..184A Marti, J., Mirabel, I.F., Chaty, S., Rodriguez, L.F. 2000, A&A 319, 184\n1740-2943    2002ApJ...578L.129S Smith, D.M., Heindl, W.A., Swank, J.H. 2002, ApJ 578, L129 (Orb.Per.)\nJ1744-2844   1997IAUC.6530Q...1K Finger, M.H., Robinson, C.R., Harmon, B.A., Vaughan, B.A. 1997, IAU Circ. No. 6530 (Orb.Per., 3. Per.)\nJ1744-2844   2007MNRAS.380.1511G Gosling, A.J., Bandyopadhyay, R.M., Miller-Jones, J.C.A., Farrell, S.A. 2007, MNRAS 380, 1511\nJ1745-2901   2009A&A...495..547D Degenaar, N., Wijnands, R. 2009, A&A 495, 547\nJ1745-2901   2009PASJ...61....1I Hyodo, Y., et al. (6 authors) 2009, PASJ 61, S99 (Orb.Per.)\nJ1745-2900   2005ApJ...622L.113M Muno, M.P., et al. (7 authors) 2005, ApJ 622, L113\nJ1745-2900   2005A&A...443..571P Porquet, D., et al. (7 authors) 2005, A&A 443, 571 (Orb.Per.)\n1746-3702    2002AJ....123.3255H Homer, L., Anderson, S.F., Margon, B., Downes, R.A., Deutsch, E.W. 2002, AJ 123, 3255\n1746-3702    2004MNRAS.347..334B Baluchinska-Church, M., Church, M.J., Smale, A.P. 2004, MNRAS 347, 334 (Orb.Per.)\n1746-3702    ................... Levine, A.M., Corbet, R. 2006, ATel #940 (Orb.Per.)\n1747-3116    2003A&A...406..233I in 't Zand, J.J.M., et al. (9 authors) 2003, A&A 406, 233 (Orb.Per.)\n1747-3116    2003A&A...409..659I in 't Zand, J.J.M., Strohmayer, T.E., Markwardt, C.B., Swank, J. 2003, A&A 409, 659\nJ1748-3607   2006ApJ...639L..31B Bhattacharyya, S., Strohmayer, T.E., Markwardt, C.B., Swank, J.H. 2006, ApJ 639, L31 (3. Per.)\nJ1748-3607   ................... Gavriil, F.P., Strohmayer, T.E., Bhattacharyya, S. 2009, ApJ, subm. = arXiv:0909.1607 (Orb.Per.)\nJ1748-2446   2011A&A...526L...3P Papitto, A., et al. (8 authors) 2011, A&A 526, L3 (Orb.Per., 3. Per)\nJ1748-2446   ................... Strohmayer, T.E., Markwardt, C.B., Pereira, D., Smith, E.A. 2010, ATel #2946\nJ1748-2021#1 2007ApJ...669L..29G Gavriil, F.P., Strohmayer, T.E., Swank, J.H., Markwardt, C.B. 2007, ApJ 669, L29 (3. Per.)\nJ1748-2021#1 2008ApJ...674L..45A Altamirano, D., Casella, P., Patruno, A., Wijnands, R., van der Klis, M. 2008, ApJ 674, L45 (M2)\nJ1748-2021#1 2009ApJ...690.1856P Patruno, A., et al. (6 authors) 2009, ApJ 690, 1856 (Orb.Per., 3. Per.)\nJ1748-2021#2 2010ApJ...714..894H Heinke, C.O., et al. (14 authors) 2009, ApJ 714, 894\nJ1748-2021#2 2010ApJ...712L..58A Altamirano, D., et al. (9 authors) 2010, ApJ 712, L58 (Orb.Per., 3. Per., M2)\nJ1749-2808   2011A&A...525A...1P Ferrigno, C., et al. (10 authors) 2010, A&A 525, A48 (Orb.Per., 3. Per.)\nJ1749-2808   ................... Markwardt, C.B., Strohmayer, T.E. 2010, ApJ 717, L49 (Orb.Per., 3. Per., Incl, M2)\nJ1749-2808   2011ApJ...727L..18A Altamirano, D., et al. (15 authors) 2011, ApJ 727, L18\nJ1751-3057   2010MNRAS.409.1136A Altamirano, D., et al. (6 authors) 2010, MNRAS 409, 1136\nJ1751-3057   2010MNRAS.407.2575P Papitto, A., et al. (8 authors) 2010, MNRAS 407, 2575 (Orb.Per., 3. Per., M2)\nJ1751-3057   2011A&A...526A...1D Riggio, A., et al. (8 authors) 2011, A&A 526, A95 (Orb.Per., 3. Per.)\nJ1751-3037   2002ApJ...575L..21M Markwardt, C.B., Swank, J., Strohmayer, T.E., in 't Zand, J.J.M. 2002, ApJ 575, L21, Erratum in ApJ 667, L211 (2007) (Orb.Per., 3. Per., M2)\nJ1751-3037   2008MNRAS.383..411P Papitto, A., Menna, M.T., Burderi, L., Di Salvo, T., Riggio, A. 2008, MNRAS 383, 411 (Orb.Per., 3. Per.)\nJ1751-3037   2009ApJ...698L..60P Patruno, A., Wijnands, R., van der Klis, M. 2009, ApJ 698, L60 (3. Per.)\nJ1753-0127   2008ApJ...681.1458Z Zurita, C., et al. (6 authors) 2008, ApJ 681, 1458 (2. Per.)\nJ1753-0127   2009MNRAS.392..309D Durant, M., Gandhi, P., Shahbaz, T., Peralta, H.H., Dhillon, V.S. 2009, MNRAS 392, 309\nJ1753-0127   2009MNRAS.399..281H Hynes, R.I., O'Brien, K., Mullally, F., Ashcraft, T. 2009, MNRAS 399, 281\nJ1753-0127   2009MNRAS.395.1257R Reis, R.C., Fabian, A.C., Ross, R.R., Miller, J.M. 2009, MNRAS 395, 1257\nJ1756-2506   2007ApJ...668L.147K Krimm, H.A., et al. (13 authors) 2007, ApJ 668, L147; erratum in ApJ 703, L183 (2009) (Orb.Per, 3. Per., M2)\nJ1756-2506   2010MNRAS.403.1426P Patruno, A., Altamirano, D., Messenger, C. 2009, MNRAS 403, 1426 (Orb.Per., 3. Per.)\n1758-2544    2002ApJ...580L..61R Rothstein, D.M., et al. (6 authors) 2002, ApJ 580, L61 (Spectr2)\n1758-2544    2002ApJ...578L.129S Smith, D.M., Heindl, W.A., Swank, J.H. 2002, ApJ 578, L129 (Orb.Per.)\n1758-2544    2010A&A...519A...1L Munoz-Arjonilla, A.J., et al. (7 authors) 2010, A&A 519, A15\nJ1806-2924   2007MNRAS.382.1751R Riggio, A., et al. (7 authors) 2007, MNRAS 382, 1751 (Orb.Per., 3. Per.)\nJ1806-2924   2008ApJ...678.1316C Chou, Y., Chung, Y., Hu, C.P., Yang, T.C. 2008, ApJ 678, 1316 (Orb.Per., 3. Per.)\nJ1806-2924   2008ApJ...678.1273R Riggio, A., et al. (7 authors) 2008, ApJ 678, 1273\nJ1806-2924   2009A&A...508..297D D'Avanzo, P., et al. (6 authors) 2009, A&A 508, 297\nJ1806-2924   2009ApJ...698L..60P Patruno, A., Wijnands, R., van der Klis, M. 2009, ApJ 698, L60 (3. Per.)\nJ1806-2924   2010ApJ...717.1253P Patruno, A., Hartman, J.M., Wijnands, R., Chakrabarty, D., van der Klis, M. 2010, ApJ 717, 1253 (Orb.Per., 3. Per.)\n1811-1710    1999MNRAS.306..417B Bandyopadhyay, R.M., Shahbaz, T., Charles, P.A., Naylor, T. 1999, MNRAS 306,417 (Spectr2)\n1811-1710    2003ApJ...595.1086C Corbet, R.H.D. 2003, ApJ 595, 1086 (Orb.Per.)\n1811-1710    2010ApJ...719..979C Corbet, R.H.D., Pearlman, A.B., Buxton, M., Levine, A.M. 2010, ApJ 719, 979\n1813-1403    1986IAUC.4235....0H Hertz, P., Wood, K.S. 1986, IAU Circ. No. 4235 (Orb.Per.)\n1813-1403    2002ApJ...574L.143C Callanan, P.J., et al. (9 authors) 2002, ApJ 574, L143\n1813-1403    2002A&A...382..947K Kuulkers, E., Homan, J., van der Klis, M., Lewin, W.H.G., Mendez, M. 2002, A&A 382, 947\n1820-3023    1997ApJ...482L..69A Anderson, S.F., Margon, B., Deutsch, E.W., Downes, R.A., Allen, R.G. 1997, ApJ 482, L69 (Orb.Per.)\n1820-3023    ................... Levine, A.M., Corbet, R. 2006, ATel #940 (Orb.Per.)\n1820-3023    2010ApJ...719.1807G Guever, T., Wroblewski, P., Camarota, L., Oezel, F. 2010, ApJ 719, 1807\n1820-3023    2010ApJ...712..653W Wang, Z., Chakrabarty, D. 2010, ApJ 712, 653 (2. Per.)\n1822-0002    2005ApJ...627..926J Juett, A.M., Chakrabarty, D. 2005, ApJ 627, 926\n1822-0002    2007MNRAS.376.1886S Shahbaz, T., Watson, C.A., Hernandez-Peralta, H. 2007, MNRAS 376, 1886 (Orb.Per.)\n1850-0846    1996MNRAS.282L..37H Homer, L., et al. (6 authors) 1996, MNRAS 282, L37 (Orb.Per.)\n1850-0846    2005A&A...443..223S Sidoli, L., La Palombara, N., Oosterbroek, T., Parmar, A.N. 2005, A&A 443, 223\nJ1900-2455   2006ApJ...638..963K Kaaret, P., Morgan, E.H., Vanderspeck, R., Tomsick, J.A. 2006, ApJ 638, 963 (Orb.Per., 3. Per.)\nJ1900-2455   2008MNRAS.383.1581E Elebert, P., et al. (7 authors) 2008, MNRAS 383, 1581\nJ1900-2455   2009ApJ...698L.174W Watts, A., et al. (11 authors) 2009, ApJ 698, L174\nJ1910-5959   2009AcA....59..273K Kaluzny, J., Thompson, I.B. 2009, AA 59, 273 (Orb.Per.)\nJ1914+0953   ................... Corbet, R.H.D., Hannikainen, D.C., Remillard, R. 2004, ATel #269 (Orb.Per.)\nJ1914+0953   2004A&A...423L..17H Hannikainen, D.C., et al. (8 authors) 2004, A&A 423, L17\nJ1914+0953   2005A&A...432..235R Rodriguez, J., et al. (6 authors) 2004, A&A 432, 235\nJ1914+0953   ................... Schultz, J., et al. (8 authors) 2004, in: The INTEGRAL Universe, V. Schoenfelder, G. Lichti, C. Winkler (eds.), ESA SP-552, p. 243\n"},{"id":5635,"name":"astropy/io/ascii/tests/data/cds/null","nodeType":"Package"},{"id":5636,"name":"ReadMe1","nodeType":"TextFile","path":"astropy/io/ascii/tests/data/cds/null","text":"J/A+A/511/A56       Abundances of five open clusters            (Pancino+, 2010)\n================================================================================\nChemical abundance analysis of the open clusters Cr 110, NGC 2420, NGC 7789,\nand M 67 (NGC 2682).\n    Pancino E., Carrera R., Rossetti, E., Gallart C.\n   <Astron. Astrophys. 511, A56 (2010)>\n   =2010A&A...511A..56P\n================================================================================\nADC_Keywords: Clusters, open ; Stars, giant ; Equivalent widths ; Spectroscopy\nKeywords: stars: abundances - Galaxy: disk -\n          open clusters and associations: general\n\nAbstract:\n    Tables modified for testing. Added order specifiers \"+=\", \"-=\" and \"+\"\n    to cols 5, 8 and 9 respectively and removed whitespace after \"?\" in \n    col 6.\n    Beginning of original abstract follows:\n    The present number of Galactic open clusters that have high resolution\n    abundance determinations, not only of [Fe/H], but also of other key\n    elements, is largely insufficient to enable a clear modeling of the\n    Galactic disk chemical evolution. To increase the number of Galactic\n    open clusters with high quality measurements, we obtained high\n    resolution (R~30000), high quality (S/N~50-100 per pixel), echelle\n    spectra with the fiber spectrograph FOCES, at Calar Alto, Spain, for\n    three red clump stars in each of five Open Clusters. We used the\n    classical equivalent width analysis method to obtain accurate\n    abundances of sixteen elements: Al, Ba, Ca, Co, Cr, Fe, La, Mg, Na,\n    Nd, Ni, Sc, Si, Ti, V, and Y. We also derived the oxygen abundance\n    using spectral synthesis of the 6300{AA} forbidden line.\n\nDescription:\n    Atomic data and equivalent widths for 15 red clump giants in 5 open\n    clusters: Cr 110, NGC 2099, NGC 2420, M 67, NGC 7789.\n\nFile Summary:\n--------------------------------------------------------------------------------\n FileName   Lrecl  Records   Explanations\n--------------------------------------------------------------------------------\nReadMe         80        .   This file\ntable1.dat    103       15   Observing logs and programme stars information\ntable5.dat     56     5265   Atomic data and equivalent widths\n--------------------------------------------------------------------------------\n\nSee also:\n J/A+A/455/271 : Abundances of red giants in NGC 6441 (Gratton+, 2006)\n J/A+A/464/953 : Abundances of red giants in NGC 6441 (Gratton+, 2007)\n J/A+A/505/117 : Abund. of red giants in 15 globular clusters (Carretta+, 2009)\n\nByte-by-byte Description of file: table.dat\n--------------------------------------------------------------------------------\n   Bytes Format Units     Label     Explanations\n--------------------------------------------------------------------------------\n   1-  7  A7    ---       Cluster   Cluster name\n   9- 12  I4    ---       Star      \n  14- 20  F7.2  0.1nm     Wave      wave\n                                    ? Wavelength in Angstroms\n  22- 23  A2    ---       El        a\n      24  I1    ---       ion       ?=0\n                                    - Ionization stage (1 for neutral element)\n  26- 30  F5.2  eV        chiEx     [1/20843]?+= Catalogue Identification Number\n  32- 37  F6.2  ---       loggf     ]0/140[?Temperature class codified (10)\n  39- 43  F5.1  0.1pm     EW        ?=-9.9 Equivalent width (in mA)\n  44- 45  F5.1  0.1pm     EW        [1/52]?-= Equivalent width (in mA)\n  46- 49  F4.1  0.1pm   e_EW        [1/6]?+ Luminosity class codified (11)\n  51- 56  F6.3  ---       Q         ?=-9.999 DAOSPEC quality parameter Q\n                                     (large values are bad)\n--------------------------------------------------------------------------------\n\nAcknowledgements:\n    Elena Pancino, elena.pancino(at)oabo.inaf.it\n================================================================================\n(End)    Elena Pancino [INAF-OABo, Italy], Patricia Vannier [CDS]    23-Nov-2009\n"},{"id":5637,"name":"table.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data/cds/null","text":"Cr110   2108 6696.79 Al1  4.02  -1.42  29.5   2.2  0.289\nCr110   2108 6698.67 Al1  3.14  -1.65  58.0   2.0  0.325\n"},{"id":5638,"name":"ReadMe","nodeType":"TextFile","path":"astropy/io/ascii/tests/data/cds/null","text":"J/A+A/511/A56       Abundances of five open clusters            (Pancino+, 2010)\n================================================================================\nChemical abundance analysis of the open clusters Cr 110, NGC 2420, NGC 7789,\nand M 67 (NGC 2682).\n    Pancino E., Carrera R., Rossetti, E., Gallart C.\n   <Astron. Astrophys. 511, A56 (2010)>\n   =2010A&A...511A..56P\n================================================================================\nADC_Keywords: Clusters, open ; Stars, giant ; Equivalent widths ; Spectroscopy\nKeywords: stars: abundances - Galaxy: disk -\n          open clusters and associations: general\n\nAbstract:\n    The present number of Galactic open clusters that have high resolution\n    abundance determinations, not only of [Fe/H], but also of other key\n    elements, is largely insufficient to enable a clear modeling of the\n    Galactic disk chemical evolution. To increase the number of Galactic\n    open clusters with high quality measurements, we obtained high\n    resolution (R~30000), high quality (S/N~50-100 per pixel), echelle\n    spectra with the fiber spectrograph FOCES, at Calar Alto, Spain, for\n    three red clump stars in each of five Open Clusters. We used the\n    classical equivalent width analysis method to obtain accurate\n    abundances of sixteen elements: Al, Ba, Ca, Co, Cr, Fe, La, Mg, Na,\n    Nd, Ni, Sc, Si, Ti, V, and Y. We also derived the oxygen abundance\n    using spectral synthesis of the 6300{AA} forbidden line.\n\nDescription:\n    Atomic data and equivalent widths for 15 red clump giants in 5 open\n    clusters: Cr 110, NGC 2099, NGC 2420, M 67, NGC 7789.\n\nFile Summary:\n--------------------------------------------------------------------------------\n FileName   Lrecl  Records   Explanations\n--------------------------------------------------------------------------------\nReadMe         80        .   This file\ntable1.dat    103       15   Observing logs and programme stars information\ntable5.dat     56     5265   Atomic data and equivalent widths\n--------------------------------------------------------------------------------\n\nSee also:\n J/A+A/455/271 : Abundances of red giants in NGC 6441 (Gratton+, 2006)\n J/A+A/464/953 : Abundances of red giants in NGC 6441 (Gratton+, 2007)\n J/A+A/505/117 : Abund. of red giants in 15 globular clusters (Carretta+, 2009)\n\nByte-by-byte Description of file: table.dat\n--------------------------------------------------------------------------------\n   Bytes Format Units     Label     Explanations\n--------------------------------------------------------------------------------\n   1-  7  A7    ---       Cluster   Cluster name\n   9- 12  I4    ---       Star      \n  14- 20  F7.2  0.1nm     Wave      wave\n                                    ? Wavelength in Angstroms\n  22- 23  A2    ---       El        a\n      24  I1    ---       ion       ?=0\n                                    - Ionization stage (1 for neutral element)\n  26- 30  F5.2  eV        chiEx     [-180/180]? Pericenter position angle (18)\n  32- 37  F6.2  ---       loggf     ]0/140[? Temperature class codified (10)\n  39- 43  F5.1  0.1pm     EW        ?=-9.9 Equivalent width (in mA)\n  46- 49  F4.1  0.1pm   e_EW        [1/6]? Luminosity class codified (11)\n  51- 56  F6.3  ---       Q         ?=-9.999 DAOSPEC quality parameter Q\n                                     (large values are bad)\n--------------------------------------------------------------------------------\n\nAcknowledgements:\n    Elena Pancino, elena.pancino(at)oabo.inaf.it\n================================================================================\n(End)    Elena Pancino [INAF-OABo, Italy], Patricia Vannier [CDS]    23-Nov-2009\n"},{"id":5639,"name":"astropy/io/ascii/tests/data/cds/multi","nodeType":"Package"},{"id":5640,"name":"lhs2065.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data/cds/multi","text":"     6476.09   0.383329\n     6476.28   0.515559\n     6476.47   0.288042\n     6476.66   0.373343\n     6476.85   0.472194\n     6477.04   0.352547\n     6477.23   0.215444\n     6477.42   0.371470\n     6477.61   0.382175\n     6477.80   0.300221\n     6477.99   0.252524\n     6478.18   0.346887\n     6478.37   0.389587\n     6478.56   0.328543\n     6478.75   0.328281\n     6478.94   0.294363\n     6479.13   0.336826\n     6479.32   0.285937\n"},{"id":5641,"name":"ReadMe","nodeType":"TextFile","path":"astropy/io/ascii/tests/data/cds/multi","text":"J/MNRAS/301/1031      High resolution spectra of VLM stars (Tinney+ 1998)\n================================================================================\nHigh resolution spectra of Very Low-Mass Stars\n   Tinney C.G., Reid I.N.\n   <Mon. Not. R. Astron. Soc. 301, 1031 (1998)>\n   =1998MNRAS.301.1031T\n================================================================================\nADC_Keywords: Stars, dwarfs ; Stars, late-type ; Spectroscopy\n\nDescription:\n   A high resolution optical spectral atlas for three very low-mass\n   stars are provided, along with a high resolution observation of\n   an atmospheric absorption calibrator. This is the data used to\n   produce Figures 4-9 in the paper.\n\n   These data were acquired with CASPEC on the ESO3.6m telescope.\n   The FWHM resolution is 16km/s (eg. 0.043nm at 800nm), at a dispersion\n   of 9km/s. Incomplete wavelength coverage produces inter-order gaps\n   at wavelengths longer than 804.5nm.\n\nObjects:\n    ---------------------------------------------------------------------\n       RA   (2000)   DE    Designation(s)                 (File)\n    ---------------------------------------------------------------------\n    16 55 35.7 -08 23 36   VB 8 = LHS 429 = Gl 644 C      (vb8.dat)\n    08 53 36   -03 29 30   LHS 2065 = LP 666-9            (lhs2065.dat)\n    03 39 34.6 -35 25 51   LP 944-20                      (lp944-20.dat)\n    05 45 59.9 -32 18 23   {mu} Col = HR 1996 = HD 38666  (mucol.dat)\n    ---------------------------------------------------------------------\n\nFile Summary:\n---------------------------------------------------------------------\n  FileName    Lrecl    Records   Explanations\n---------------------------------------------------------------------\nReadMe          80          .    This file\nvb8.dat         26      14390    Spectrum for VB8\nlhs2065.dat     26      14390    Spectrum for LHS2065\nlp944-20.dat    26      14390    Spectrum for LP944-20\nmucol.dat       23      14390    Atmospheric Spectrum for Mu Columbae\n---------------------------------------------------------------------\n\nByte-by-byte Description of file: vb8.dat, lhs2065.dat\nByte-by-byte Description of file: lp944-20.dat\n-------------------------------------------------------------------------\n   Bytes  Format   Units  Label     Explanations\n-------------------------------------------------------------------------\n   1- 12  F12.2    0.1nm  Lambda    Central wavelength of the flux bin\n  13- 26  A14.9    mJy    Fnu       Data in interorder gaps has value 0.0\n-------------------------------------------------------------------------\n\nByte-by-byte Description of file: mucol.dat\n-------------------------------------------------------------------------\n   Bytes  Format   Units  Label     Explanations\n-------------------------------------------------------------------------\n   1- 12  F12.2    0.1nm  Lambda    Central wavelength of the flux bin\n  13- 23  F11.6    ---    Fnu      *Data in interorder gaps has value 0.0\n-------------------------------------------------------------------------\nNote on Fnu:\n  mJy which have been normalised to value 1.0\n  in the continuum of the atmospheric standard star\n-------------------------------------------------------------------------\n\n================================================================================\n(End)                  C.G. Tinney [AAO]                             04-Feb-1999\n"},{"id":5642,"name":"lp944-20.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data/cds/multi","text":"     6476.09   0.342236\n     6476.28   0.380582\n     6476.47   0.429476\n     6476.66   0.463431\n     6476.85   0.475528\n     6477.04   0.387025\n     6477.23   0.304608\n     6477.42   0.404995\n     6477.61   0.388829\n     6477.80   0.264535\n     6477.99   0.715199\n     6478.18   0.656017\n     6478.37   0.327062\n     6478.56   0.245733\n     6478.75   0.403018\n     6478.94   7.89686E-02\n     6479.13   0.321100\n     6479.32   0.489005"},{"id":5643,"name":"astropy/io/ascii/tests/data/cds/description","nodeType":"Package"},{"id":5644,"name":"table.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data/cds/description","text":"Cr110   2108 6696.79 Al1  4.02  -1.42  29.5   2.2  0.289\nCr110   2108 6698.67 Al1  3.14  -1.65  58.0   2.0  0.325\n"},{"id":5645,"name":"ReadMe","nodeType":"TextFile","path":"astropy/io/ascii/tests/data/cds/glob","text":"B/cb        Cataclysmic Binaries, LMXBs, and related objects   (Ritter+, 2011)\n================================================================================\nCatalogue of cataclysmic binaries, low-mass X-ray binaries\nand related objects (7th Edition, rev. 7.14, September 2010)\n     Ritter H., Kolb U.\n    <Astron. Astrophys. 404, 301 (2003)>\n    =2003A&A...404..301R\n================================================================================\nADC_Keywords: Binaries, cataclysmic ; Binaries, X-ray ; Novae\nKeywords: catalogues - stars: novae, cataclysmic variables -\n          stars: binaries: close\n\nDescription (Release 7.15):\n    Cataclysmic Binaries are semi-detached binaries consisting of a white\n    dwarf or a white dwarf precursor primary and a low-mass secondary\n    which is filling its critical Roche lobe. The secondary is not\n    necessarily unevolved, it may even be a highly evolved star as for\n    example in the case of the AM CVn-type stars.\n\n    Low-Mass X-Ray Binaries are semi-detached binaries consisting of\n    either a neutron star or a black hole primary, and a low-mass\n    secondary which is filling its critical Roche lobe.\n\n    Related Objects are detached binaries consisting of either a white\n    dwarf or a white dwarf precursor primary and of a low-mass secondary.\n    The secondary may also be a highly evolved star.\n\n    The catalogue lists coordinates, apparent magnitudes, orbital\n    parameters, and stellar parameters of the components and other\n    characteristic properties of 880 cataclysmic binaries, 98 low-mass\n    X-ray binaries and 319 related objects with known or suspected orbital\n    periods together with a comprehensive selection of the relevant recent\n    literature. In addition the catalogue contains a list of references to\n    published finding charts for 1259 of the 1297 objects, and a cross-\n    reference list of alias object designations. Literature published\n    before 1 July 2010 has, as far as possible, been taken into account.\n    Updated information will be provided regularly, currently every six\n    months.\n\n    Old editions include catalogue <V/59> (5th edition),\n    <V/99> (6th edition) and <V/113> (7th edition);\n    the successive versions of the 7th edition are available\n    in dedicated subdirectories (v7.00 tp v7.13)\n\nFile Summary:\n--------------------------------------------------------------------------------\n  FileName    Lrecl  Records   Explanations\n--------------------------------------------------------------------------------\nReadMe           80        .   This file\ncbdata.dat      226      880   Catalogue of Cataclysmic Binaries\nlmxbdata.dat    228       98   Catalogue of Low-Mass X-Ray Binaries\npcbdata.dat     216      319   Catalogue of Related Objects\nfindrefs.dat    274     3230   References for finding charts\ncbrefs.dat      257     1937   References for cbdata.dat\nlmxbrefs.dat    236      291   References for lmxbdata.dat\npcbrefs.dat     302      655   References for pcbdata.dat\nwhoswho.txt      72     8927  *Names of objects, and references of designations\nwhoswho1.dat    199     5052  *Alternative names in lexigraphical order\nwhoswho2.dat    100     3595  *Provisional and Common designations\nwhoswho5.dat     73     1453  *References to the catalogue acronyms\n--------------------------------------------------------------------------------\nNote on whoswho.txt:\n    contains the 3 parts whoswho1.dat to whoswho5.dat (without the bibcodes)\nNote on whoswho1.dat, whoswho2.dat, whoswho5.dat:\n    formatted files corresponding to whoswho.txt\n--------------------------------------------------------------------------------\n\nSee also:\n  http://www.MPA-Garching.MPG.DE/RKcat/ : Catalog Home page  or\n  http://physics.open.ac.uk/RKcat/      : Catalog Home page\n\nByte-by-byte Description of file: cbdata.dat\n--------------------------------------------------------------------------------\n   Bytes Format Units     Label   Explanations\n--------------------------------------------------------------------------------\n   1- 12  A12   ---       Name    Object name (G1)\n      14  A1    ---      whoswho  [*] * indicating that further alternative\n                                     designations are in the whoswho1.dat file\n  16- 27  A12   ---      AltName  A frequently used alternative name (G2)\n  30- 31  I2    h         RAh     Right Ascension J2000 (hours)\n  33- 34  I2    min       RAm     Right Ascension J2000 (minutes)\n  36- 39  F4.1  s         RAs     [0,60]? Right Ascension J2000 (seconds)\n      41  A1    ---       DE-     Declination J2000 (sign)\n  42- 43  I2    deg       DEd     Declination J2000 (degrees)\n  45- 46  I2    arcmin    DEm     Declination J2000 (minutes of arc)\n  48- 49  I2    arcsec    DEs     [0,60]? Declination J2000 (seconds of arc)\n      51  A1    arcsec    epos    [0-9] Position accuracy in (G3)\n  53- 54  A2    ---       Type1   Object type (3)\n      55  A1    ---     u_Type1   [?:] Uncertainty flag for object type\n  57- 58  A2    ---       Type2   Object type (3)\n      59  A1    ---     u_Type2   [?:] Uncertainty flag for object type\n  61- 62  A2    ---       Type3   Object type (3)\n      63  A1    ---     u_Type3   [?:] Uncertainty flag for Object type\n  65- 66  A2    ---       Type4   Object type (3)\n      67  A1    ---     u_Type4   [?] Uncertainty flag for Object type\n      69  A1    ---     l_mag1    [><] Limit flag for magnitude mag1\n  70- 73  F4.1  mag       mag1    ? Apparent V (or B, b, g, R, I) magnitude\n                                    at maximum brightness (4)\n      74  A1    ---     f_mag1    [:BbgRiIJKprw] uncertainty flag/band for mag1\n                                    (w=\"white light\")\n      76  A1    ---     l_mag2    [><] Limit flag for magnitude mag2\n  77- 80  F4.1  mag       mag2    ? Apparent V (or B, g, R) magnitude\n                                    at mideclipse (5)\n      81  A1    ---     f_mag2    [:?BbgRiKpw] uncertainty flag/band for mag2\n      83  A1    ---     l_mag3    [><] Limit flag for magnitude mag3\n  84- 87  F4.1  mag       mag3    ? Apparent V (or B, g, R) magnitude\n                                    of outbursts (6)\n      88  A1    ---     f_mag3    [:?BbgpRrw] uncertainty flag/band for mag3\n      90  A1    ---     l_mag4    [><] Limit flag for magnitude mag4\n  91- 94  F4.1  mag       mag4    ? Apparent V (or B, R) magnitude\n                                    in superoutburst (7)\n      95  A1    ---     f_mag4    [:?BgRUIpw] uncertainty flag/band for mag4\n  97-101  A5    d         T1      Time interval between two subsequent\n                                   outbursts (8)\n 103-107  A5    d         T2      Time interval between two subsequent\n                                   superoutbursts (8)\n 109-116  F8.6  d         Orb.Per ? Orbital period, in case of object\n                                     type DQ: spectroscopic period, if it is\n                                     different from the photometric one\n     117  A1    ---     u_Orb.Per [:*] Uncertainty flag for Orb.Per (9)\n 119-126  F8.6  d         2.__Per ? Second period (10)\n     127  A1    ---     u_2.__Per Uncertainty flag for 2.__Per\n 128-137  F10.3 s         3.__Per ? Additional period in the system (11)\n     138  A1    ---     f_3.__Per [:TQ] Flag for 3.__Per (12)\n 139-148  F10.3 s         4.__Per ? Additional period in the system (13)\n     149  A1    ---     f_4.__Per [:T] \":\" uncertainty flag for 4.__Per\n                                       \"T\" flag indicating transient pulsations\n     151  A1    ---       EB      [D21 ] Flag indicating the\n                                          occurrence of eclipses (G4)\n     152  A1    ---     u_EB      [?:] Uncertainty flag for EB\n     154  I1    ---       SB      [1,2]? Flag specifying the type of\n                                          spectroscopic binary (G5)\n     155  A1    ---     u_SB      [:] Uncertainty flag for SB\n 157-163  A7    ---       SpType2 Spectral type of the secondary (G6)\n 165-171  A7    ---       SpType1 Spectral type of the primary (G6)\n     174  A1    ---     l_M1/M2   Limit flag for M1/M2\n 175-179  F5.2  ---       M1/M2   ? Mass ratio M1/M2\n     180  A1    ---     u_M1/M2   Uncertainty flag for M1/M2\n 183-186  F4.2  ---     e_M1/M2   ? Error of M1/M2\n     188  A1    ---     l_Incl    Limit flag for the orbital inclination\n 189-192  F4.1  deg       Incl    ? Orbital inclination\n     193  A1    ---     u_Incl    Uncertainty flag for the inclination\n 195-198  F4.1  deg     e_Incl    ? Error of orbital inclination\n     200  A1    ---     l_M1      Limit flag for primary mass M1\n 201-205  F5.3  solMass   M1      ? Primary mass M1\n     206  A1    ---     u_M1      Uncertainty flag for primary mass M1\n 208-212  F5.3  solMass e_M1      ? Error of primary mass M1\n     214  A1    ---     l_M2      Limit flag for secondary mass M2\n 215-219  F5.3  solMass   M2      ? Secondary mass M2\n     220  A1    ---     u_M2      Uncertainty flag for secondary mass M2\n 222-226  F5.3  solMass e_M2      ? Error of secondary mass M2\n--------------------------------------------------------------------------------\nNote (3): Object type coarsely characterised using the following abbreviations:\n    AC = AM CVn star, spectrum devoid of hydrogen lines, subtype of NL\n    AM = polar = AM Her system, subtype of NL, contains a synchronously\n         or nearly synchronously rotating, magnetized white dwarf\n    AS = subtype of AM, with a slowly asynchronously rotating, magnetized\n         white dwarf\n    BD = secondary star is a brown dwarf\n    CP = coherent pulsator, contains a coherently pulsating white dwarf\n    CV = cataclysmic variable of unspecified subtype\n    DA = non-magnetic direct accretor\n    DN = dwarf nova\n    DQ = DQ Her star, contains a non-synchronously rotating, magnetized\n         white dwarf; usually not seen in X-rays\n    EG = extragalactic source\n    ER = ER UMa star = SU UMa star with an extremely short supercycle\n    GC = source in a globular cluster\n    GW = contains a pulsating white dwarf of the GW Vir = PG 1159-035 type\n    IP = intermediate polar, shows coherent X-ray period from a\n         non-synchronously spinning, magnetized white dwarf; usually a\n         strong X-ray source\n    LA = low accretion rate polar (LARP), i.e. a somewhat detached magnetic\n         CV/pre-CV\n    N  = classical nova\n    Na = fast nova (decline from max. by 3mag in less than about 100days)\n    Nb = slow nova (decline from max. by 3mag in more than about 100days)\n    Nc = extremely slow nova (typical time scale of the decline from\n         maximum: decades)\n    NL = nova-like variable\n    Nr = recurrent nova\n    NS = system showing negative (nodal) superhumps\n    PW = precessing white dwarf\n    SH = non-SU UMa star showing either permanent or transient positive\n         (apsidal) superhumps\n    SS = supersoft X-ray source; CV with stationary hydrogen burning on\n         the white dwarf\n    SU = SU UMa star, subtype of DN\n    SW = SW Sex star, subtype of NL\n    UG = dwarf nova of either U Gem or SS Cyg subtype\n    UL = ultra-luminous X-ray source\n    UX = UX UMa star, subtype of NL\n    VY = VY Scl star (anti dwarf nova), subtype of NL\n    WZ = WZ Sge star = SU UMa star with an extremely long supercycle\n    ZC = Z Cam star, subtype of DN\n    ZZ = white dwarf shows ZZ Ceti-type pulsations\n\nNote (4): Apparent V magnitude at maximum brightness of:\n    novae (N,Na,Nb,Nc,Nr) in minimum\n    DN    (UG,ZC,SU)      in minimum\n    NL    (UX,AC)         in normal state\n    NL    (DQ,IP,AM,VY)   in high state.\n    SS                    in high state.\n\nNote (5): In case of eclipses magnitude at mideclipse, of:\n    novae (N,Na,Nb,Nc,Nr) in minimum\n    DN    (UG,ZC,SU)      in minimum\n    NL    (UX,AC)         in normal state\n    NL    (DQ,IP,AM,VY)   in high state.\n    SS                    in high state.\n\nNote (6): Apparent magnitude at maximum brightness of:\n    novae (N,Na,Nb,Nc,Nr) in outburst\n    DN    (UG,ZC)         in outburst\n    DN    (SU)            in normal outburst\n    DN    (WZ)            in echo outburst\n    NL    (AM,VY)         in low state\n    NL    (DQ,IP)         in low state\n    SS                    in low state.\n\nNote (7): Apparent magnitude at maximum brightness of:\n    DN    (ZC)            in standstill\n    DN    (SU)            in superoutburst\n    WZ                    in superoutburst\n    NL    (DQ,IP)         in flaring state or outburst\n    iNL    (AM, VY)       in low state\n    SS                    in low state\n\nNote (8): Time interval between outbursts is defined:\n    - for dwarf novae of subtype UG or ZC: the typical time interval\n      between two subsequent outbursts;\n    - for dwarf novae of subtype SU:\n      T1 is the typical time interval between two subsequent normal\n         outburst, and\n      T2 is the typical time interval between subsequent superoutbursts.\n\nNote (9): the * indicates, in case of object type SU, that the orbital\n    period has been estimated from the known superhump period using the\n    empirical relation given by B. Stolz and R. Schoembs (1984A&A...132..187S).\n\nNote (10): The second period is, in case of object type:\n     DQ or IP: photometric period if it is different from the\n         spectroscopic one\n     AM: polarization period = spin period of the white dwarf, if it is\n         different from the presumed orbital period (subtype AS)\n     SU: superhump period, wherever possible, at the beginning of a\n         superoutburst\n     SH: photometric period, presumably superhump period of either\n         permanent or transient superhumps\n     NS: photometric period, period of either permanent or transient\n         negative superhumps if 2.__Per. < Orb.Per.\n\nNote (11): This additional period is, in case of object type:\n    CP: period of coherent pulsation, (transient if f_3.__Per=T)\n    DQ: spin period of the white dwarf\n    IP: spin period of the white dwarf, usually detected in X-Rays\n    SW: probably the spin period of the white dwarf\n\nNote (12): the flag takes the values:\n    ':' uncertainty flag\n    'T' indicating transient pulsations\n    'Q' indicating the occurrence of quasi- periodic oscillations (QPO)\n        in objects of type N, DN, NL.\n\nNote (13): This additional period is, in case of object type:\n    CP: second period of coherent pulsation, (transient if f_4.__Per=T)\n    DQ: additional period, presumably due to reprocessed X-Rays\n    IP: additional period, usually seen in the optical and presumably\n        due to reprocessed X-Rays\n--------------------------------------------------------------------------------\n\nByte-by-byte Description of file: lmxbdata.dat\n--------------------------------------------------------------------------------\n   Bytes Format Units     Label   Explanations\n--------------------------------------------------------------------------------\n   1- 12  A12   ---       Name    Object name (G1)\n      14  A1    ---       whoswho [*] * indicating that further alternative\n                                      designations are in the whoswho1.dat file\n  16- 27  A12   ---       AltName A frequently used alternative name (G2)\n  30- 31  I2    h         RAh     Right Ascension J2000 (hours)\n  33- 34  I2    min       RAm     Right Ascension J2000 (minutes)\n  36- 39  F4.1  s         RAs     Right Ascension J2000 (seconds)\n      41  A1    ---       DE-     Declination J2000 (sign)\n  42- 43  I2    deg       DEd     Declination J2000 (degrees)\n  45- 46  I2    arcmin    DEm     Declination J2000 (minutes of arc)\n  48- 49  I2    arcsec    DEs     Declination J2000 (seconds of arc)\n      51  A1    arcsec    epos    [0-9] Position accuracy in (G3)\n  53- 54  A2    ---       Type1   Object type (3)\n      55  A1    ---     u_Type1   [?] Uncertainty flag for object type\n  57- 58  A2    ---       Type2   Object type (3)\n      59  A1    ---     u_Type2   [?] Uncertainty flag for object type\n  61- 62  A2    ---       Type3   Object type (3)\n      63  A1    ---     u_Type3   [?] Uncertainty flag for Object type\n  65- 66  A2    ---       Type4   Object type (3)\n      67  A1    ---     u_Type4   [?] Uncertainty flag for Object type\n      69  A1    ---     l_mag1    [><] Limit flag for magnitude mag1\n  70- 73  F4.1  mag       mag1    ? Apparent V (or B, g, R, I, K) magnitude\n                                    at maximum brightness,\n                                    in case of XT in quiescence\n      74  A1    ---     f_mag1    [:UBgRIJK] uncertainty flag/band for mag1\n      76  A1    ---     l_mag2    [><] Limit flag for magnitude mag2\n  77- 80  F4.1  mag       mag2    ? Apparent V (or B, R, I) magnitude\n                                    at mid-eclipse (4)\n      81  A1    ---     f_mag2    [:BRIJK] Uncertainty flag/band for mag2\n  84- 87  F4.1  mag       mag3    ? Apparent V (or other) magnitude\n                                    at outburst (5)\n      88  A1    ---     f_mag3    [:BRI] Uncertainty flag/band for mag3\n      90  A1    ---     l_mag4    Limit flag of magnitude mag4\n  91- 94  F4.1  mag       mag4    ? Apparent V (or other) magnitude at\n                                    superoutburst (5)\n      96  A1    ---     l_LX/Lopt Limit flag on LX/Lopt\n  97-103  F7.1  ---       LX/Lopt ? The ratio of X-ray to optical luminosity\n 106-108  I3    d         T1      ? Typical time interval between two subsequent\n                                    X-ray active states in case of subtype XT\n 110-118  F9.6  d         Orb.Per ? Orbital period\n     119  A1    ---     u_Orb.Per [:*] Uncertainty flag for Orb.Per (6)\n 120-128  F9.6  d         2.__Per ? Second period, in case of object type SH:\n                                    photometric period, presumably superhump\n                                    period of either permanent or transient\n                                    superhumps\n     129  A1    ---     u_2.__Per Uncertainty flag for 2.__Per\n 130-140  F11.7 s         3.__Per ? Additional period in the system, in case of\n                                    object type\n                                    BO: period of burst oscillations = rotation\n                                        period of the neutron star;\n                                    XP: pulse period of the pulsar\n     141  A1    ---     u_3.__Per Uncertainty flag for 3.__Per\n 142-146  F5.1  s         4.__Per ? Additional period in the system, in case of\n                                    object type XP: optical period, presumably\n                                    due to e_processed X-Rays\n     152  A1    ---       EB      [D1 ] Occurrence of eclipses (G4)\n     153  A1    ---     u_EB      [?] Uncertainty flag on EB\n     155  I1    ---       SB      [1,2]? Flag specifying the type of\n                                         spectroscopic binary (G5)\n 158-164  A7    ---       SpType2 Spectral type of the secondary (G6)\n 167-173  A7    ---       SpType1 Spectral type of the primary (G6)\n     175  A1    ---     l_M1/M2   Limit flag for M1/M2\n 176-180  F5.2  ---       M1/M2   ? Mass ratio M1/M2\n     181  A1    ---     u_M1/M2   Uncertainty flag for M1/M2\n 182-186  F5.2  ---     e_M1/M2   ? Error of M1/M2\n     189  A1    ---     l_Incl    Limit flag for the orbital inclination\n 190-193  F4.1  deg       Incl    ? Orbital inclination\n     194  A1    ---     u_Incl    Uncertainty flag (:) on Incl\n 196-199  F4.1  deg     e_Incl    ? Error of orbital inclination\n     201  A1    ---     l_M1      Limit flag on M1\n 202-206  F5.2  solMass   M1      ? Primary mass M1\n     207  A1    ---     u_M1      Uncertainty flag (:) on M1\n 209-213  F5.2  solMass e_M1      ? Error of primary mass M1\n     215  A1    ---     l_M2      Limit flag for secondary mass M2\n 216-221  F6.3  solMass   M2      ? Secondary mass M2\n     222  A1    ---     u_M2      Uncertainty flag (:) on M2\n 223-228  F6.3  solMass e_M2      ? Error of secondary mass M2\n--------------------------------------------------------------------------------\nNote (3): the object type is coarsely characterised using\n          the following abbreviations:\n    AS = atoll source, subtype of the LMXBs\n    BH = black hole candidate, subtype of the LMXBs\n    BO = X-ray burster with coherent burst oscillations at the neutron\n         star spin period\n    DC = source with an accretion disc corona, subtype of the LMXBs\n    GC = source in a globular cluster\n    MQ = microquasar, source of relativistic jets\n    NS = system showing negative (nodal) superhumps\n    QN = quiescent neutron star LMXB\n    RP = primary is also seen as a radio pulsar\n    SH = system showing either permanent or transient superhumps\n    SS = supersoft X-ray source\n    UL = ultra-luminous X-ray source\n    XB = X-ray burst source\n    XP = X-ray pulsar\n    XT = transient X-ray source\n    ZS = Z-source, subtype of the LMXBs\n\nNote (4): in case of eclipses magnitude at mideclipse,\n          in case of XT in quiescence\n\nNote (5): in case of XL (XB, XT) in outburst\n\nNote (6): the * indicates, in case of object type SU, that the orbital\n    period has been estimated from the known superhump period using the\n    empirical relation given by B. Stolz and R. Schoembs (1984A&A...132..187S).\n--------------------------------------------------------------------------------\n\nByte-by-byte Description of file: pcbdata.dat\n--------------------------------------------------------------------------------\n   Bytes Format Units    Label    Explanations\n--------------------------------------------------------------------------------\n   1- 12  A12   ---       Name    Object name (G1)\n      14  A1    ---      whoswho  [*] * indicating that further alternative\n                                    designations are in the whoswho1.dat file\n  16- 27  A12   ---      AltName  A frequently used alternative name (G2)\n  30- 31  I2    h         RAh     ? Right Ascension J2000 (hours)\n  33- 34  I2    min       RAm     ? Right Ascension J2000 (minutes)\n  36- 39  F4.1  s         RAs     ? Right Ascension J2000 (seconds)\n      41  A1    ---       DE-     ? Declination J2000 (sign)\n  42- 43  I2    deg       DEd     ? Declination J2000 (degrees)\n  45- 46  I2    arcmin    DEm     ? Declination J2000 (minutes of arc)\n  48- 49  I2    arcsec    DEs     ? Declination J2000 (seconds of arc)\n      51  A1    arcsec    epos    [0-9P] Position accuracy (G3)\n  53- 54  A2    ---      Type1    Object type (3)\n      55  A1    ---    u_Type1    [?] Uncertainty flag for object type\n  57- 58  A2    ---      Type2    Object type (3)\n      59  A1    ---    u_Type2    [?] Uncertainty flag for object type\n  61- 62  A2    ---      Type3    Object type (3)\n      63  A1    ---    u_Type3    [?] Uncertainty flag for object type\n  65- 66  A2    ---      Type4    Object type (3)\n  70- 73  F4.1  mag       mag1    ? Apparent V (or other) magnitude at maximum\n                                    brightness outside eclipse\n      74  A1    ---     f_mag1    [:BbpgRiIK] uncertainty flag/band for mag1\n      76  A1    ---     l_mag2    [><] Limit flag for magnitude mag2\n  77- 80  F4.1  mag       mag2    ? Apparent V (or other) magnitude at minimum\n                                    brightness, in case of eclipses magnitude\n                                    at mideclipse.\n      81  A1    ---     f_mag2    [:BgRiI] uncertainty flag/band for mag2\n  82- 90  F9.6  d         Orb.Per Orbital period\n      91  A1    ---     u_Orb.Per Uncertainty flag for Orb.Per\n  92-101  F10.4 s         2.__Per ? Spin period of the accretor (white dwarf\n                                    or neutron star).\n     103  I1    ---       EB      [1,2]? Flag indicating the occurrence of\n                                        eclipses (G4)\n     104  A1    ---     u_EB      [?] Uncertainty flag for EB\n     106  I1    ---       SB      [1,2]? Flag specifying the type of\n                                         spectroscopic binary (G5)\n 109-115  A7    ---      SpType2  Spectral type of the secondary (G6)\n 117-123  A7    ---      SpType1  Spectral type of the primary (G6)\n     125  A1    ---     l_E       [><] Limit flag for the orbital eccentricity\n 126-129  F4.2  ---       E       ? Orbital eccentricity\n     130  A1    ---     u_E       Uncertainty flag on orbital eccentricity\n 132-135  F4.2  ---     e_E       ? Error of orbital eccentricity\n     137  A1    ---     l_M1/M2   Limit flag for mass ratio M1/M2\n 138-141  F4.2  ---       M1/M2   ? Mass ratio M1/M2\n     142  A1    ---     u_M1/M2   Uncertainty flag on mass ratio M1/M2\n 144-147  F4.2  ---     e_M1/M2   ? Error of M1/M2\n     149  A1    ---     l_Incl    Limit flag for the orbital inclination\n 150-153  F4.1  deg       Incl    ? Orbital inclination\n     154  A1    ---     u_Incl    Uncertainty flag for the inclination\n 156-159  F4.1  deg     e_Incl    ? Error of orbital inclination\n     161  A1    ---     l_M1      Limit flag for primary mass M1\n 162-166  F5.3  solMass   M1      ? Primary mass M1\n     167  A1    ---     u_M1      Uncertainty flag for primary mass M1\n 169-173  F5.3  solMass e_M1      ? Error of primary mass M1\n     175  A1    ---     l_R1      Limit flag for primary radius R1\n 176-180  F5.3  solRad    R1      ? Primary radius\n     181  A1    ---     u_R1      Uncertainty flag [:] for primary radius R1\n 183-187  F5.3  solRad  e_R1      ? Error of primary radius R1\n     189  A1    ---     l_M2      Limit flag for secondary mass M2\n 190-194  F5.3  solMass   M2      ? Secondary mass M2\n     195  A1    ---     u_M2      Uncertainty flag for secondary mass M2\n 197-201  F5.3  solMass e_M2      ? Error of secondary mass M2\n     203  A1    ---     l_R2      Limit flag on secondary radius R2\n 204-209  F6.4  solRad    R2      ? Secondary radius R2\n     210  A1    ---     u_R2      Uncertainty flag [:] for secondary radius R2\n 212-217  F6.4  solRad  e_R2      ? Error of secondary radius\n--------------------------------------------------------------------------------\nNote (3): Object type coarsely characterised using the following abbreviations:\n     CP = coherent pulsator, contains a coherently pulsating white dwarf or\n          subdwarf\n     DD = system consists of two degenerate components\n     DS = detached system\n     EC = contains a pulsating sdB star of the EC 14026-2647 type\n     GC = source in a globular cluster\n     GP = sdB-star with g-mode pulsations\n     GW = contains a pulsating white dwarf of the GW Vir = PG 1159-035 type\n     PN = central star of a planetary nebula\n     RS = system shows RS CVn-like chromospheric activity\n     SC = sub-stellar companion\n--------------------------------------------------------------------------------\n\nByte-by-byte Description of file: *refs.dat\n--------------------------------------------------------------------------------\n   Bytes Format Units   Label     Explanations\n--------------------------------------------------------------------------------\n   1- 12  A12   ---     Name      Object name\n  14- 32  A19   ---     BibCode   BibCode\n  34-302  A269  ---     Text      Text of reference\n--------------------------------------------------------------------------------\n\nByte-by-byte Description of file: whoswho1.dat\n--------------------------------------------------------------------------------\n   Bytes Format Units   Label     Explanations\n--------------------------------------------------------------------------------\n       1  A1    ---     B         [B] when the name is based on B1950 position\n   2- 25  A24   ---     Name      Object name\n      27  A1    ---     ---       [=]\n  29-212  A184  ---     AltName   Other name, or comment (1)\n--------------------------------------------------------------------------------\nNote (1): Catalogue designations involving the equatorial coordinates\n          are given in the following format:\n   HHMM+DDMM (catalogue acronyms) if the position is given in B1950\n              coordinates -- a 'B' is then present in byte 1.\n  JHHMM+DDMM (catalogue acronyms) if the position is given in J2000\n              coordinates.\n         Here HHMM is the truncated right ascension in hours (HH) and\n              minutes (MM), DDMM the truncated declination in  degrees (DD)\n              and arcminutes (MM), and + the sign of the declination.\n--------------------------------------------------------------------------------\n\nByte-by-byte Description of file: whoswho2.dat\n--------------------------------------------------------------------------------\n   Bytes Format Units   Label     Explanations\n--------------------------------------------------------------------------------\n       1  A1    ---     B         [B] when the name is based on B1950 position\n   2- 53  A52   ---     cName     Common or Provisional designation (G2)\n  55- 56  A2    ---     ---       [->]\n  58-101  A44   ---     Name      Usual name\n--------------------------------------------------------------------------------\n\nByte-by-byte Description of file: whoswho5.dat\n--------------------------------------------------------------------------------\n   Bytes Format Units   Label     Explanations\n--------------------------------------------------------------------------------\n   1- 10  A10   ---     Abbr      Catalogue abbreviation\n  14- 73  A60   ---     Text      Text of References\n--------------------------------------------------------------------------------\n\nGlobal Notes:\n\nNote (G1): Wherever possible, the designation of the object given in the\n    General Catalogue of Variable Stars (Cat. <II/214>) is used here.\n\nNote (G2): The acronyms used in lists are detailed in the last part of\n    the file \"whoswho.txt\"\n\nNote (G3): The number indicates the accuracy of position in seconds of arc.\n     If the positional error is larger than 9arcsec, or unknown, this field\n     is left blank. The letter [P] indicates an object with a large proper\n     motion.\n\nNote (G4): The EB flag means:\n    EB= : (blank) no eclipses observed.\n    EB=1: 1 eclipse per orbital revolution observed.\n    EB=2: 2 eclipses per orbital revolution observed.\n    EB=D: periodic eclipse-like dips observed.\n\nNote (G5): The SB flag means:\n    SB=1: single-line spectroscopic binary\n    SB=2: double-line spectroscopic binary\n\nNote (G6): Spectral types are given in the following format:\n    [Spectral class/Luminosity class], where the usual roman numerals for\n    the latter are replaced by the corresponding arabic numerals, i.e.\n    I = 1, II = 2, III = 3, IV = 4, V = 5, VI = 6.\n--------------------------------------------------------------------------------\n\nHistory:\n  * 16-Apr-2003: 7th Edition\n  * 28-Aug-2003: 7.1 Edition\n  * 12-Mar-2004: 7.2 Edition\n  * 01-Sep-2004: 7.3 Edition\n  * 24-Mar-2005: 7.4 Edition\n  * 25-Jul-2005: 7.5 Edition\n  * 01-Feb-2006: 7.6 Edition\n  * 29-May-2006: 7.6rev1 Edition (no new object)\n  * 07-Dec-2006: 7.7 Edition\n  * 17-Aug-2007: 7.8 Edition\n  * 18-Mar-2008: 7.9 Edition\n  * 26-Jul-2008: 7.10 Edition\n  * 06-Apr-2009: 7.11 Edition\n  * 18-Sep-2009: 7.12 Edition\n  * 20-Mar-2010: 7.13 Edition\n  * 05-Nov-2010: 7.14 Edition\n  * 23-Mar-2011: 7.15 Edition\n\nReferences:\n  Ritter H., 1984A&AS...57..385R (3rd edition)\n  Ritter H., 1987A&AS...70..335R (4th edition)\n  Ritter H., 1990A&AS...85.1179R (5th edition) (Catalogue: V/59)\n  Ritter H., Kolb U., 1995, in \"X-ray Binaries\", Lewin W.H.G,\n    van Paradijs J., van den Heuvel E.P. (eds),\n    Cambridge Univ. Press, p. 578 (Cat. <V/82>)\n================================================================================\n(End) H. Ritter, U. Kolb [MPA Garching], Francois Ochsenbein [CDS]   05-Nov-2010\n"},{"id":5646,"name":"astropy/io/ascii/tests/data/vizier","nodeType":"Package"},{"id":5647,"name":"table1.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data/vizier","text":"Cr110   2108 06 38 52.5 +02 01 58.4 14.79 13.35 --    ---    9.76 6 16200  70 Cl* Collinder 110 DI 2108\nCr110   2129 06 38 41.1 +02 01 05.5 15.00 13.66 12.17 12.94 10.29 7 18900  70 Cl* Collinder 110 DI 2129\nCr110   3144 06 38 30.3 +02 03 03.0 14.80 13.49 12.04 12.72 10.19 6 16195  65 Cl* Collinder 110 DI 3144\nNGC2099   67 05 52 16.6 +32 34 45.6 12.38 11.12  9.87 ---    8.17 3  3600  95 NGC 2099   67\nNGC2099  148 05 52 08.1 +32 30 33.1 12.36 11.09 -     ---    8.05 3  3600 105 NGC 2099  148 \nNGC2099  508 05 52 33.2 +32 27 43.5 12.24 10.98 --    ---    7.92 3  3900  85 NGC 2099  508\nNGC2420   41 07 38 06.2 +21 36 54.7 13.75 12.67 11.61 12.13 10.13 5  9000  70 NGC 2420   41 \nNGC2420   76 07 38 15.5 +21 38 01.8 13.65 12.66 11.65 12.14 10.31 5  9000  75 NGC 2420   76\nNGC2420  174 07 38 26.9 +21 38 24.8 13.41 12.40 ----  ---    9.98 5  9000  60 NGC 2420  174\nNGC2682  141 08 51 22.8 +11 48 01.7 11.59 10.48  9.40  9.92  7.92 3  2700  85 Cl* NGC 2682 MMU 141\nNGC2682  223 08 51 43.9 +11 56 42.3 11.68 10.58  9.50 10.02  8.00 3  2700  85 Cl* NGC 2682 MMU 223\nNGC2682  286 08 52 18.6 +11 44 26.3 11.53 10.47  9.43  9.93  7.92 3  2700 105 Cl* NGC 2682 MMU 286\nNGC7789 5237 23 56 50.6 +56 49 20.9 13.92 12.81 11.52 ---    9.89 5  9000  70 Cl* NGC 7789 G 5237\nNGC7789 7840 23 57 19.3 +56 40 51.5 14.03 12.82 11.49 ---    9.83 6  9000  75 Cl* NGC 7789 G 7840\nNGC7789 8556 23 57 27.6 +56 45 39.2 14.18 12.97 11.65 ---   10.03 3  5400  45 Cl* NGC 7789 G 8556\n"},{"id":5648,"name":"table5.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data/vizier","text":"Cr110   2108 6696.79 Al1  4.02  -1.42  29.5   2.2  0.289\nCr110   2108 6698.67 Al1  3.14  -1.65  58.0   2.0  0.325\nCr110   2108 7361.57 Al1  4.02  -0.90  44.1   4.0  0.510\nCr110   2108 7362.30 Al1  4.02  -0.75  62.7   3.9  0.577\nCr110   2108 7835.31 Al1  4.02  -0.65  73.7   6.6  0.539\nCr110   2108 7836.13 Al1  4.02  -0.49  87.6   4.1  0.390\nCr110   2108 8772.86 Al1  4.02  -0.32  87.6   5.1  0.957\nCr110   2108 8773.90 Al1  4.02  -0.16 118.6  14.6  0.736\nCr110   2108 5853.67 Ba2  0.60  -1.00 121.9   5.5  1.435\nCr110   2108 6141.71 Ba2  0.70  -0.08 191.0   8.7  1.117\nCr110   2108 6496.90 Ba2  0.60  -0.38 175.8   6.8  1.473\nCr110   2108 5261.70 Ca1  2.52  -0.59 149.1   5.3  0.808\nCr110   2108 5512.98 Ca1  2.93  -0.71 106.7   6.2  1.416\nCr110   2108 5857.45 Ca1  2.93   0.26 163.8  19.8  2.209\nCr110   2108 6156.02 Ca1  2.52  -2.50  42.0   4.0  0.617\nCr110   2108 6166.44 Ca1  2.52  -1.16 110.7   3.3  1.046\nCr110   2108 6169.04 Ca1  2.52  -0.80 127.3   5.5  1.604\nCr110   2108 6169.56 Ca1  2.53  -0.53 148.2   6.0  1.419\nCr110   2108 6471.66 Ca1  2.53  -0.65 130.4   5.0  1.431\nCr110   2108 6499.65 Ca1  2.52  -0.72 129.0   5.4  1.183\nCr110   2108 5230.20 Co1  1.74  -1.84  60.4   6.7  1.210\nCr110   2108 5530.77 Co1  1.71  -2.06  73.2   4.3  1.005\nCr110   2108 5590.72 Co1  2.04  -1.87  69.9   3.2  0.706\nCr110   2108 5935.38 Co1  1.88  -2.68  33.0   4.4  0.665\nCr110   2108 6429.91 Co1  2.14  -2.41  28.2   1.3  0.340\nCr110   2108 6490.34 Co1  2.04  -2.52  33.6   3.5  0.323\nCr110   2108 6632.43 Co1  2.28  -2.00  50.9   2.1  0.391\nCr110   2108 7154.67 Co1  2.04  -2.42  45.9   1.9  0.280\nCr110   2108 7388.69 Co1  2.72  -1.65  36.6   1.8  0.343\nCr110   2108 7417.37 Co1  2.04  -2.07  71.4   1.9  0.369\nCr110   2108 7838.13 Co1  3.97  -0.30  32.7   2.7  0.495\nCr110   2108 5243.36 Cr1  3.40  -0.57  47.9   4.0  0.828\nCr110   2108 5329.14 Cr1  2.91  -0.06 110.4   4.9  1.113\nCr110   2108 5442.37 Cr1  3.42  -1.06  33.3   2.5  0.499\nCr110   2108 5712.75 Cr1  3.01  -1.30  49.4   5.3  1.038\nCr110   2108 5788.39 Cr1  3.01  -1.83  26.1   1.3  0.260\nCr110   2108 5844.59 Cr1  3.01  -1.76  26.2   3.9  0.863\nCr110   2108 6330.09 Cr1  0.94  -2.92  94.4   6.6  1.638\nCr110   2108 6537.93 Cr1  1.00  -4.07  33.0   2.4  0.479\nCr110   2108 6630.01 Cr1  1.03  -3.56  60.7   1.5  0.232\nCr110   2108 6661.08 Cr1  4.19  -0.19  33.5   6.4  0.627\nCr110   2108 7355.94 Cr1  2.89  -0.28 126.7   4.1  0.671\nCr110   2108 5055.99 Fe1  4.31  -2.01  41.2   3.3  0.371\nCr110   2108 5178.80 Fe1  4.39  -1.84  45.4   7.1  0.851\nCr110   2108 5285.13 Fe1  4.43  -1.64  50.1   5.2  0.607\nCr110   2108 5294.55 Fe1  3.64  -2.86  -9.9  -9.9 -9.999\nCr110   2108 5295.31 Fe1  4.42  -1.69  38.3   9.5  1.958\nCr110   2108 5373.71 Fe1  4.47  -0.86  91.5   5.3  1.416\nCr110   2108 5386.33 Fe1  4.15  -1.77  55.9   6.6  0.949\n"},{"id":5649,"name":"ReadMe","nodeType":"TextFile","path":"astropy/io/ascii/tests/data/vizier","text":"J/A+A/511/A56       Abundances of five open clusters            (Pancino+, 2010)\n================================================================================\nChemical abundance analysis of the open clusters Cr 110, NGC 2420, NGC 7789,\nand M 67 (NGC 2682).\n    Pancino E., Carrera R., Rossetti, E., Gallart C.\n   <Astron. Astrophys. 511, A56 (2010)>\n   =2010A&A...511A..56P\n================================================================================\nADC_Keywords: Clusters, open ; Stars, giant ; Equivalent widths ; Spectroscopy\nKeywords: stars: abundances - Galaxy: disk -\n          open clusters and associations: general\n\nAbstract:\n    The present number of Galactic open clusters that have high resolution\n    abundance determinations, not only of [Fe/H], but also of other key\n    elements, is largely insufficient to enable a clear modeling of the\n    Galactic disk chemical evolution. To increase the number of Galactic\n    open clusters with high quality measurements, we obtained high\n    resolution (R~30000), high quality (S/N~50-100 per pixel), echelle\n    spectra with the fiber spectrograph FOCES, at Calar Alto, Spain, for\n    three red clump stars in each of five Open Clusters. We used the\n    classical equivalent width analysis method to obtain accurate\n    abundances of sixteen elements: Al, Ba, Ca, Co, Cr, Fe, La, Mg, Na,\n    Nd, Ni, Sc, Si, Ti, V, and Y. We also derived the oxygen abundance\n    using spectral synthesis of the 6300{AA} forbidden line.\n\nDescription:\n    Atomic data and equivalent widths for 15 red clump giants in 5 open\n    clusters: Cr 110, NGC 2099, NGC 2420, M 67, NGC 7789.\n\nFile Summary:\n--------------------------------------------------------------------------------\n FileName   Lrecl  Records   Explanations\n--------------------------------------------------------------------------------\nReadMe         80        .   This file\ntable1.dat    103       15   Observing logs and programme stars information\ntable5.dat     56     5265   Atomic data and equivalent widths\n--------------------------------------------------------------------------------\n\nSee also:\n J/A+A/455/271 : Abundances of red giants in NGC 6441 (Gratton+, 2006)\n J/A+A/464/953 : Abundances of red giants in NGC 6441 (Gratton+, 2007)\n J/A+A/505/117 : Abund. of red giants in 15 globular clusters (Carretta+, 2009)\n\nByte-by-byte Description of file: table1.dat\n--------------------------------------------------------------------------------\n   Bytes Format Units   Label     Explanations\n--------------------------------------------------------------------------------\n   1-  7  A7    ---     Cluster   Cluster name\n   9- 12  I4    ---     Star      Star number within the cluster\n  14- 15  I2    h       RAh       Right ascension (J2000)\n  17- 18  I2    min     RAm       Right ascension (J2000)\n  20- 23  F4.1  s       RAs       Right ascension (J2000)\n      25  A1    ---     DE-       Declination sign (J2000)\n  26- 27  I2    deg     DEd       Declination (J2000)\n  29- 30  I2    arcmin  DEm       Declination (J2000)\n  32- 35  F4.1  arcsec  DEs       Declination (J2000)\n  37- 41  F5.2  mag     Bmag      B magnitude\n  43- 47  F5.2  mag     Vmag      V magnitude\n  49- 53  F5.2  mag     Icmag     ?=- Cousins I magnitude\n  55- 59  F5.2  mag     Rmag      ?=- R magnitude\n  61- 65  F5.2  mag     Ksmag     Ks magnitude\n      67  I1    ---     NExp      Number of exposures\n  69- 73  I5    s       TExp      Total exposure time\n  75- 77  I3    ---     S/N       Signal-to-nois ratio\n  79-103  A25   ---     SName     Simbad name\n--------------------------------------------------------------------------------\n\nByte-by-byte Description of file: table5.dat\n--------------------------------------------------------------------------------\n   Bytes Format Units     Label     Explanations\n--------------------------------------------------------------------------------\n   1-  7  A7    ---       Cluster   Cluster name\n   9- 12  I4    ---       Star      Star number within the cluster\n  14- 20  F7.2  0.1nm     Wave      Wavelength in Angstroms\n  22- 23  A2    ---       El        Element name\n      24  I1    ---       ion       Ionization stage (1 for neutral element)\n  26- 30  F5.2  eV        chiEx     Excitation potential\n  32- 37  F6.2  ---       loggf     Logarithm of the oscillator strength\n  39- 43  F5.1  0.1pm     EW        ?=-9.9 Equivalent width (in mA)\n  46- 49  F4.1  0.1pm   e_EW        ?=-9.9 rms uncertainty on EW\n  51- 56  F6.3  ---       Q         ?=-9.999 DAOSPEC quality parameter Q\n                                     (large values are bad)\n--------------------------------------------------------------------------------\n\nAcknowledgements:\n    Elena Pancino, elena.pancino(at)oabo.inaf.it\n================================================================================\n(End)    Elena Pancino [INAF-OABo, Italy], Patricia Vannier [CDS]    23-Nov-2009\n"},{"id":5650,"name":"ReadMe","nodeType":"TextFile","path":"astropy/io/ascii/tests/data/cds/description","text":"J/A+A/511/A56       Abundances of five open clusters            (Pancino+, 2010)\n================================================================================\nChemical abundance analysis of the open clusters Cr 110, NGC 2420, NGC 7789,\nand M 67 (NGC 2682).\n    Pancino E., Carrera R., Rossetti, E., Gallart C.\n   <Astron. Astrophys. 511, A56 (2010)>\n   =2010A&A...511A..56P\n================================================================================\nADC_Keywords: Clusters, open ; Stars, giant ; Equivalent widths ; Spectroscopy\nKeywords: stars: abundances - Galaxy: disk -\n          open clusters and associations: general\n\nAbstract:\n    The present number of Galactic open clusters that have high resolution\n    abundance determinations, not only of [Fe/H], but also of other key\n    elements, is largely insufficient to enable a clear modeling of the\n    Galactic disk chemical evolution. To increase the number of Galactic\n    open clusters with high quality measurements, we obtained high\n    resolution (R~30000), high quality (S/N~50-100 per pixel), echelle\n    spectra with the fiber spectrograph FOCES, at Calar Alto, Spain, for\n    three red clump stars in each of five Open Clusters. We used the\n    classical equivalent width analysis method to obtain accurate\n    abundances of sixteen elements: Al, Ba, Ca, Co, Cr, Fe, La, Mg, Na,\n    Nd, Ni, Sc, Si, Ti, V, and Y. We also derived the oxygen abundance\n    using spectral synthesis of the 6300{AA} forbidden line.\n\nDescription:\n    Atomic data and equivalent widths for 15 red clump giants in 5 open\n    clusters: Cr 110, NGC 2099, NGC 2420, M 67, NGC 7789.\n\nFile Summary:\n--------------------------------------------------------------------------------\n FileName   Lrecl  Records   Explanations\n--------------------------------------------------------------------------------\nReadMe         80        .   This file\ntable1.dat    103       15   Observing logs and programme stars information\ntable5.dat     56     5265   Atomic data and equivalent widths\n--------------------------------------------------------------------------------\n\nSee also:\n J/A+A/455/271 : Abundances of red giants in NGC 6441 (Gratton+, 2006)\n J/A+A/464/953 : Abundances of red giants in NGC 6441 (Gratton+, 2007)\n J/A+A/505/117 : Abund. of red giants in 15 globular clusters (Carretta+, 2009)\n\nByte-by-byte Description of file: table.dat\n--------------------------------------------------------------------------------\n   Bytes Format Units     Label     Explanations\n--------------------------------------------------------------------------------\n   1-  7  A7    ---       Cluster   Cluster name\n   9- 12  I4    ---       Star      \n  14- 20  F7.2  0.1nm     Wave      wave\n                                    ? Wavelength in Angstroms\n  22- 23  A2    ---       El        a\n      24  I1    ---       ion       ?=0\n                                    - Ionization stage (1 for neutral element)\n  26- 30  F5.2  eV        chiEx     Excitation potential\n  32- 37  F6.2  ---       loggf     Logarithm of the oscillator strength\n  39- 43  F5.1  0.1pm     EW        ?=-9.9 Equivalent width (in mA)\n  46- 49  F4.1  0.1pm   e_EW        ?=-9.9 rms uncertainty on EW\n  51- 56  F6.3  ---       Q         ?=-9.999 DAOSPEC quality parameter Q\n                                     (large values are bad)\n--------------------------------------------------------------------------------\n\nAcknowledgements:\n    Elena Pancino, elena.pancino(at)oabo.inaf.it\n================================================================================\n(End)    Elena Pancino [INAF-OABo, Italy], Patricia Vannier [CDS]    23-Nov-2009\n"},{"id":5651,"name":"astropy/io/tests","nodeType":"Package"},{"fileName":"mixin_columns.py","filePath":"astropy/io/tests","id":5652,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nMixin columns for use in ascii/tests/test_ecsv.py, fits/tests/test_connect.py,\nand misc/tests/test_hdf5.py\n\"\"\"\n\nfrom astropy import coordinates, table, time, units as u\n\n\nel = coordinates.EarthLocation(x=[1, 2] * u.km, y=[3, 4] * u.km, z=[5, 6] * u.km)\nsr = coordinates.SphericalRepresentation(\n    [0, 1]*u.deg, [2, 3]*u.deg, 1*u.kpc)\ncr = coordinates.CartesianRepresentation(\n    [0, 1]*u.pc, [4, 5]*u.pc, [8, 6]*u.pc)\nsd = coordinates.SphericalCosLatDifferential(\n    [0, 1]*u.mas/u.yr, [0, 1]*u.mas/u.yr, 10*u.km/u.s)\nsrd = coordinates.SphericalRepresentation(\n    sr, differentials=sd)\nsc = coordinates.SkyCoord([1, 2], [3, 4], unit='deg,deg',\n                          frame='fk4', obstime='J1990.5')\nscd = coordinates.SkyCoord(\n    [1, 2], [3, 4], [5, 6], unit='deg,deg,m', frame='fk4',\n    obstime=['J1990.5'] * 2)\nscdc = scd.copy()\nscdc.representation_type = 'cartesian'\nscpm = coordinates.SkyCoord(\n    [1, 2], [3, 4], [5, 6], unit='deg,deg,pc',\n    pm_ra_cosdec=[7, 8]*u.mas/u.yr, pm_dec=[9, 10]*u.mas/u.yr)\nscpmrv = coordinates.SkyCoord(\n    [1, 2], [3, 4], [5, 6], unit='deg,deg,pc',\n    pm_ra_cosdec=[7, 8]*u.mas/u.yr, pm_dec=[9, 10]*u.mas/u.yr,\n    radial_velocity=[11, 12]*u.km/u.s)\nscrv = coordinates.SkyCoord(\n    [1, 2], [3, 4], [5, 6], unit='deg,deg,pc',\n    radial_velocity=[11, 12]*u.km/u.s)\ntm = time.Time([51000.5, 51001.5], format='mjd', scale='tai',\n               precision=5, location=el[0])\ntm2 = time.Time(tm, precision=3, format='iso')\ntm3 = time.Time(tm, location=el)\ntm3.info.serialize_method['ecsv'] = 'jd1_jd2'\nobj = table.Column([{'a': 1}, {'b': [2]}], dtype='object')\n\n# NOTE: for testing, the name of the column \"x\" for the\n# Quantity is important since it tests the fix for #10215\n# (namespace clash, where \"x\" clashes with \"el.x\").\nmixin_cols = {\n    'tm': tm,\n    'tm2': tm2,\n    'tm3': tm3,\n    'dt': time.TimeDelta([1, 2] * u.day),\n    'sc': sc,\n    'scd': scd,\n    'scdc': scdc,\n    'scpm': scpm,\n    'scpmrv': scpmrv,\n    'scrv': scrv,\n    'x': [1, 2] * u.m,\n    'qdb': [10, 20] * u.dB(u.mW),\n    'qdex': [4.5, 5.5] * u.dex(u.cm / u.s**2),\n    'qmag': [21, 22] * u.ABmag,\n    'lat': coordinates.Latitude([1, 2] * u.deg),\n    'lon': coordinates.Longitude([1, 2] * u.deg, wrap_angle=180. * u.deg),\n    'ang': coordinates.Angle([1, 2] * u.deg),\n    'el': el,\n    'sr': sr,\n    'cr': cr,\n    'sd': sd,\n    'srd': srd,\n    'nd': table.NdarrayMixin([1, 2]),\n    'obj': obj,\n}\ntime_attrs = ['value', 'shape', 'format', 'scale', 'precision',\n              'in_subfmt', 'out_subfmt', 'location']\ncompare_attrs = {\n    'tm': time_attrs,\n    'tm2': time_attrs,\n    'tm3': time_attrs,\n    'dt': ['shape', 'value', 'format', 'scale'],\n    'sc': ['ra', 'dec', 'representation_type', 'frame.name'],\n    'scd': ['ra', 'dec', 'distance', 'representation_type', 'frame.name'],\n    'scdc': ['x', 'y', 'z', 'representation_type', 'frame.name'],\n    'scpm': ['ra', 'dec', 'distance', 'pm_ra_cosdec', 'pm_dec',\n             'representation_type', 'frame.name'],\n    'scpmrv': ['ra', 'dec', 'distance', 'pm_ra_cosdec', 'pm_dec',\n               'radial_velocity', 'representation_type', 'frame.name'],\n    'scrv': ['ra', 'dec', 'distance', 'radial_velocity',\n             'representation_type', 'frame.name'],\n    'x': ['value', 'unit'],\n    'qdb': ['value', 'unit'],\n    'qdex': ['value', 'unit'],\n    'qmag': ['value', 'unit'],\n    'lon': ['value', 'unit', 'wrap_angle'],\n    'lat': ['value', 'unit'],\n    'ang': ['value', 'unit'],\n    'el': ['x', 'y', 'z', 'ellipsoid'],\n    'nd': ['data'],\n    'sr': ['lon', 'lat', 'distance'],\n    'cr': ['x', 'y', 'z'],\n    'sd': ['d_lon_coslat', 'd_lat', 'd_distance'],\n    'srd': ['lon', 'lat', 'distance', 'differentials.s.d_lon_coslat',\n            'differentials.s.d_lat', 'differentials.s.d_distance'],\n    'obj': [],\n    'su': ['i', 'f'],\n    'tab': ['tm', 'c', 'x'],\n    'qtab': ['tm', 'c', 'x'],\n}\nnon_trivial_names = {\n    'cr': ['cr.x', 'cr.y', 'cr.z'],\n    'dt': ['dt.jd1', 'dt.jd2'],\n    'el': ['el.x', 'el.y', 'el.z'],\n    'sc': ['sc.ra', 'sc.dec'],\n    'scd': ['scd.ra', 'scd.dec', 'scd.distance',\n            'scd.obstime.jd1', 'scd.obstime.jd2'],\n    'scdc': ['scdc.x', 'scdc.y', 'scdc.z',\n             'scdc.obstime.jd1', 'scdc.obstime.jd2'],\n    'scfc': ['scdc.x', 'scdc.y', 'scdc.z',\n             'scdc.obstime.jd1', 'scdc.obstime.jd2'],\n    'scpm': ['scpm.ra', 'scpm.dec', 'scpm.distance',\n             'scpm.pm_ra_cosdec', 'scpm.pm_dec'],\n    'scpmrv': ['scpmrv.ra', 'scpmrv.dec', 'scpmrv.distance',\n               'scpmrv.pm_ra_cosdec', 'scpmrv.pm_dec',\n               'scpmrv.radial_velocity'],\n    'scrv': ['scrv.ra', 'scrv.dec', 'scrv.distance',\n             'scrv.radial_velocity'],\n    'sd': ['sd.d_lon_coslat', 'sd.d_lat', 'sd.d_distance'],\n    'sr': ['sr.lon', 'sr.lat', 'sr.distance'],\n    'srd': ['srd.lon', 'srd.lat', 'srd.distance',\n            'srd.differentials.s.d_lon_coslat',\n            'srd.differentials.s.d_lat',\n            'srd.differentials.s.d_distance'],\n    'tm': ['tm.jd1', 'tm.jd2'],\n    'tm2': ['tm2.jd1', 'tm2.jd2'],\n    'tm3': ['tm3.jd1', 'tm3.jd2',\n            'tm3.location.x', 'tm3.location.y', 'tm3.location.z'],\n}\nserialized_names = {name: non_trivial_names.get(name, [name])\n                    for name in sorted(mixin_cols)}\n"},{"id":5653,"name":"no_data_with_header.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/data","text":"a b c\n"},{"fileName":"__init__.py","filePath":"astropy/io/tests","id":5654,"nodeType":"File","text":""},{"fileName":"safeio.py","filePath":"astropy/io/tests","id":5655,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport io\n\n\nclass CatchZeroByteWriter(io.BufferedWriter):\n    \"\"\"File handle to intercept 0-byte writes\"\"\"\n\n    def write(self, buffer):\n        nbytes = super().write(buffer)\n        if nbytes == 0:\n            raise ValueError(\"This writer does not allow empty writes\")\n        return nbytes\n"},{"attributeType":"null","col":55,"comment":"null","endLoc":7,"id":5656,"name":"u","nodeType":"Attribute","startLoc":7,"text":"u"},{"attributeType":"EarthLocation","col":0,"comment":"null","endLoc":10,"id":5657,"name":"el","nodeType":"Attribute","startLoc":10,"text":"el"},{"id":5658,"name":"astropy/io/votable","nodeType":"Package"},{"fileName":"tree.py","filePath":"astropy/io/votable","id":5659,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# TODO: Test FITS parsing\n\n# STDLIB\nimport io\nimport re\nimport gzip\nimport base64\nimport codecs\nimport urllib.request\nimport warnings\n\n# THIRD-PARTY\nimport numpy as np\nfrom numpy import ma\n\n# LOCAL\nfrom astropy.io import fits\nfrom astropy import __version__ as astropy_version\nfrom astropy.utils.collections import HomogeneousList\nfrom astropy.utils.xml.writer import XMLWriter\nfrom astropy.utils.exceptions import AstropyDeprecationWarning\n\nfrom . import converters\nfrom .exceptions import (warn_or_raise, vo_warn, vo_raise, vo_reraise,\n                         warn_unknown_attrs, W06, W07, W08, W09, W10, W11, W12,\n                         W13, W15, W17, W18, W19, W20, W21, W22, W26, W27, W28,\n                         W29, W32, W33, W35, W36, W37, W38, W40, W41, W42, W43,\n                         W44, W45, W50, W52, W53, W54, E06, E08, E09, E10, E11,\n                         E12, E13, E15, E16, E17, E18, E19, E20, E21, E22, E23,\n                         E25)\nfrom . import ucd as ucd_mod\nfrom . import util\nfrom . import xmlutil\n\ntry:\n    from . import tablewriter\n    _has_c_tabledata_writer = True\nexcept ImportError:\n    _has_c_tabledata_writer = False\n\n\n__all__ = [\n    'Link', 'Info', 'Values', 'Field', 'Param', 'CooSys', 'TimeSys',\n    'FieldRef', 'ParamRef', 'Group', 'Table', 'Resource',\n    'VOTableFile', 'Element'\n    ]\n\n\n# The default number of rows to read in each chunk before converting\n# to an array.\nDEFAULT_CHUNK_SIZE = 256\nRESIZE_AMOUNT = 1.5\n\n######################################################################\n# FACTORY FUNCTIONS\n\n\ndef _resize(masked, new_size):\n    \"\"\"\n    Masked arrays can not be resized inplace, and `np.resize` and\n    `ma.resize` are both incompatible with structured arrays.\n    Therefore, we do all this.\n    \"\"\"\n    new_array = ma.zeros((new_size,), dtype=masked.dtype)\n    length = min(len(masked), new_size)\n    new_array[:length] = masked[:length]\n\n    return new_array\n\n\ndef _lookup_by_attr_factory(attr, unique, iterator, element_name, doc):\n    \"\"\"\n    Creates a function useful for looking up an element by a given\n    attribute.\n\n    Parameters\n    ----------\n    attr : str\n        The attribute name\n\n    unique : bool\n        Should be `True` if the attribute is unique and therefore this\n        should return only one value.  Otherwise, returns a list of\n        values.\n\n    iterator : generator\n        A generator that iterates over some arbitrary set of elements\n\n    element_name : str\n        The XML element name of the elements being iterated over (used\n        for error messages only).\n\n    doc : str\n        A docstring to apply to the generated function.\n\n    Returns\n    -------\n    factory : function\n        A function that looks up an element by the given attribute.\n    \"\"\"\n\n    def lookup_by_attr(self, ref, before=None):\n        \"\"\"\n        Given a string *ref*, finds the first element in the iterator\n        where the given attribute == *ref*.  If *before* is provided,\n        will stop searching at the object *before*.  This is\n        important, since \"forward references\" are not allowed in the\n        VOTABLE format.\n        \"\"\"\n        for element in getattr(self, iterator)():\n            if element is before:\n                if getattr(element, attr, None) == ref:\n                    vo_raise(\n                        f\"{element_name} references itself\",\n                        element._config, element._pos, KeyError)\n                break\n            if getattr(element, attr, None) == ref:\n                yield element\n\n    def lookup_by_attr_unique(self, ref, before=None):\n        for element in lookup_by_attr(self, ref, before=before):\n            return element\n        raise KeyError(\n            \"No {} with {} '{}' found before the referencing {}\".format(\n                element_name, attr, ref, element_name))\n\n    if unique:\n        lookup_by_attr_unique.__doc__ = doc\n        return lookup_by_attr_unique\n    else:\n        lookup_by_attr.__doc__ = doc\n        return lookup_by_attr\n\n\ndef _lookup_by_id_or_name_factory(iterator, element_name, doc):\n    \"\"\"\n    Like `_lookup_by_attr_factory`, but looks in both the \"ID\" and\n    \"name\" attributes.\n    \"\"\"\n\n    def lookup_by_id_or_name(self, ref, before=None):\n        \"\"\"\n        Given an key *ref*, finds the first element in the iterator\n        with the attribute ID == *ref* or name == *ref*.  If *before*\n        is provided, will stop searching at the object *before*.  This\n        is important, since \"forward references\" are not allowed in\n        the VOTABLE format.\n        \"\"\"\n        for element in getattr(self, iterator)():\n            if element is before:\n                if ref in (element.ID, element.name):\n                    vo_raise(\n                        f\"{element_name} references itself\",\n                        element._config, element._pos, KeyError)\n                break\n            if ref in (element.ID, element.name):\n                return element\n        raise KeyError(\n            \"No {} with ID or name '{}' found before the referencing {}\".format(\n                element_name, ref, element_name))\n\n    lookup_by_id_or_name.__doc__ = doc\n    return lookup_by_id_or_name\n\n\ndef _get_default_unit_format(config):\n    \"\"\"\n    Get the default unit format as specified in the VOTable spec.\n    \"\"\"\n    # The unit format changed between VOTable versions 1.3 and 1.4,\n    # see issue #10791.\n    if config['version_1_4_or_later']:\n        return 'vounit'\n    else:\n        return 'cds'\n\n\ndef _get_unit_format(config):\n    \"\"\"\n    Get the unit format based on the configuration.\n    \"\"\"\n    if config.get('unit_format') is None:\n        format = _get_default_unit_format(config)\n    else:\n        format = config['unit_format']\n    return format\n\n\n######################################################################\n# ATTRIBUTE CHECKERS\ndef check_astroyear(year, field, config=None, pos=None):\n    \"\"\"\n    Raises a `~astropy.io.votable.exceptions.VOTableSpecError` if\n    *year* is not a valid astronomical year as defined by the VOTABLE\n    standard.\n\n    Parameters\n    ----------\n    year : str\n        An astronomical year string\n\n    field : str\n        The name of the field this year was found in (used for error\n        message)\n\n    config, pos : optional\n        Information about the source of the value\n    \"\"\"\n    if (year is not None and\n        re.match(r\"^[JB]?[0-9]+([.][0-9]*)?$\", year) is None):\n        warn_or_raise(W07, W07, (field, year), config, pos)\n        return False\n    return True\n\n\ndef check_string(string, attr_name, config=None, pos=None):\n    \"\"\"\n    Raises a `~astropy.io.votable.exceptions.VOTableSpecError` if\n    *string* is not a string or Unicode string.\n\n    Parameters\n    ----------\n    string : str\n        An astronomical year string\n\n    attr_name : str\n        The name of the field this year was found in (used for error\n        message)\n\n    config, pos : optional\n        Information about the source of the value\n    \"\"\"\n    if string is not None and not isinstance(string, str):\n        warn_or_raise(W08, W08, attr_name, config, pos)\n        return False\n    return True\n\n\ndef resolve_id(ID, id, config=None, pos=None):\n    if ID is None and id is not None:\n        warn_or_raise(W09, W09, (), config, pos)\n        return id\n    return ID\n\n\ndef check_ucd(ucd, config=None, pos=None):\n    \"\"\"\n    Warns or raises a\n    `~astropy.io.votable.exceptions.VOTableSpecError` if *ucd* is not\n    a valid `unified content descriptor`_ string as defined by the\n    VOTABLE standard.\n\n    Parameters\n    ----------\n    ucd : str\n        A UCD string.\n\n    config, pos : optional\n        Information about the source of the value\n    \"\"\"\n    if config is None:\n        config = {}\n    if config.get('version_1_1_or_later'):\n        try:\n            ucd_mod.parse_ucd(\n                ucd,\n                check_controlled_vocabulary=config.get(\n                    'version_1_2_or_later', False),\n                has_colon=config.get('version_1_2_or_later', False))\n        except ValueError as e:\n            # This weird construction is for Python 3 compatibility\n            if config.get('verify', 'ignore') == 'exception':\n                vo_raise(W06, (ucd, str(e)), config, pos)\n            elif config.get('verify', 'ignore') == 'warn':\n                vo_warn(W06, (ucd, str(e)), config, pos)\n                return False\n            else:\n                return False\n    return True\n\n\n######################################################################\n# PROPERTY MIXINS\nclass _IDProperty:\n    @property\n    def ID(self):\n        \"\"\"\n        The XML ID_ of the element.  May be `None` or a string\n        conforming to XML ID_ syntax.\n        \"\"\"\n        return self._ID\n\n    @ID.setter\n    def ID(self, ID):\n        xmlutil.check_id(ID, 'ID', self._config, self._pos)\n        self._ID = ID\n\n    @ID.deleter\n    def ID(self):\n        self._ID = None\n\n\nclass _NameProperty:\n    @property\n    def name(self):\n        \"\"\"An optional name for the element.\"\"\"\n        return self._name\n\n    @name.setter\n    def name(self, name):\n        xmlutil.check_token(name, 'name', self._config, self._pos)\n        self._name = name\n\n    @name.deleter\n    def name(self):\n        self._name = None\n\n\nclass _XtypeProperty:\n    @property\n    def xtype(self):\n        \"\"\"Extended data type information.\"\"\"\n        return self._xtype\n\n    @xtype.setter\n    def xtype(self, xtype):\n        if xtype is not None and not self._config.get('version_1_2_or_later'):\n            warn_or_raise(\n                W28, W28, ('xtype', self._element_name, '1.2'),\n                self._config, self._pos)\n        check_string(xtype, 'xtype', self._config, self._pos)\n        self._xtype = xtype\n\n    @xtype.deleter\n    def xtype(self):\n        self._xtype = None\n\n\nclass _UtypeProperty:\n    _utype_in_v1_2 = False\n\n    @property\n    def utype(self):\n        \"\"\"The usage-specific or `unique type`_ of the element.\"\"\"\n        return self._utype\n\n    @utype.setter\n    def utype(self, utype):\n        if (self._utype_in_v1_2 and\n            utype is not None and\n            not self._config.get('version_1_2_or_later')):\n            warn_or_raise(\n                W28, W28, ('utype', self._element_name, '1.2'),\n                self._config, self._pos)\n        check_string(utype, 'utype', self._config, self._pos)\n        self._utype = utype\n\n    @utype.deleter\n    def utype(self):\n        self._utype = None\n\n\nclass _UcdProperty:\n    _ucd_in_v1_2 = False\n\n    @property\n    def ucd(self):\n        \"\"\"The `unified content descriptor`_ for the element.\"\"\"\n        return self._ucd\n\n    @ucd.setter\n    def ucd(self, ucd):\n        if ucd is not None and ucd.strip() == '':\n            ucd = None\n        if ucd is not None:\n            if (self._ucd_in_v1_2 and\n                not self._config.get('version_1_2_or_later')):\n                warn_or_raise(\n                    W28, W28, ('ucd', self._element_name, '1.2'),\n                    self._config, self._pos)\n            check_ucd(ucd, self._config, self._pos)\n        self._ucd = ucd\n\n    @ucd.deleter\n    def ucd(self):\n        self._ucd = None\n\n\nclass _DescriptionProperty:\n    @property\n    def description(self):\n        \"\"\"\n        An optional string describing the element.  Corresponds to the\n        DESCRIPTION_ element.\n        \"\"\"\n        return self._description\n\n    @description.setter\n    def description(self, description):\n        self._description = description\n\n    @description.deleter\n    def description(self):\n        self._description = None\n\n\n######################################################################\n# ELEMENT CLASSES\nclass Element:\n    \"\"\"\n    A base class for all classes that represent XML elements in the\n    VOTABLE file.\n    \"\"\"\n    _element_name = ''\n    _attr_list = []\n\n    def _add_unknown_tag(self, iterator, tag, data, config, pos):\n        warn_or_raise(W10, W10, tag, config, pos)\n\n    def _ignore_add(self, iterator, tag, data, config, pos):\n        warn_unknown_attrs(tag, data.keys(), config, pos)\n\n    def _add_definitions(self, iterator, tag, data, config, pos):\n        if config.get('version_1_1_or_later'):\n            warn_or_raise(W22, W22, (), config, pos)\n        warn_unknown_attrs(tag, data.keys(), config, pos)\n\n    def parse(self, iterator, config):\n        \"\"\"\n        For internal use. Parse the XML content of the children of the\n        element.\n\n        Parameters\n        ----------\n        iterator : xml iterable\n            An iterator over XML elements as returned by\n            `~astropy.utils.xml.iterparser.get_xml_iterator`.\n\n        config : dict\n            The configuration dictionary that affects how certain\n            elements are read.\n\n        Returns\n        -------\n        self : `~astropy.io.votable.tree.Element`\n            Returns self as a convenience.\n        \"\"\"\n        raise NotImplementedError()\n\n    def to_xml(self, w, **kwargs):\n        \"\"\"\n        For internal use. Output the element to XML.\n\n        Parameters\n        ----------\n        w : astropy.utils.xml.writer.XMLWriter object\n            An XML writer to write to.\n        **kwargs : dict\n            Any configuration parameters to control the output.\n        \"\"\"\n        raise NotImplementedError()\n\n\nclass SimpleElement(Element):\n    \"\"\"\n    A base class for simple elements, such as FIELD, PARAM and INFO\n    that don't require any special parsing or outputting machinery.\n    \"\"\"\n\n    def __init__(self):\n        Element.__init__(self)\n\n    def __repr__(self):\n        buff = io.StringIO()\n        SimpleElement.to_xml(self, XMLWriter(buff))\n        return buff.getvalue().strip()\n\n    def parse(self, iterator, config):\n        for start, tag, data, pos in iterator:\n            if start and tag != self._element_name:\n                self._add_unknown_tag(iterator, tag, data, config, pos)\n            elif tag == self._element_name:\n                break\n\n        return self\n\n    def to_xml(self, w, **kwargs):\n        w.element(self._element_name,\n                  attrib=w.object_attrs(self, self._attr_list))\n\n\nclass SimpleElementWithContent(SimpleElement):\n    \"\"\"\n    A base class for simple elements, such as FIELD, PARAM and INFO\n    that don't require any special parsing or outputting machinery.\n    \"\"\"\n\n    def __init__(self):\n        SimpleElement.__init__(self)\n\n        self._content = None\n\n    def parse(self, iterator, config):\n        for start, tag, data, pos in iterator:\n            if start and tag != self._element_name:\n                self._add_unknown_tag(iterator, tag, data, config, pos)\n            elif tag == self._element_name:\n                if data:\n                    self.content = data\n                break\n\n        return self\n\n    def to_xml(self, w, **kwargs):\n        w.element(self._element_name, self._content,\n                  attrib=w.object_attrs(self, self._attr_list))\n\n    @property\n    def content(self):\n        \"\"\"The content of the element.\"\"\"\n        return self._content\n\n    @content.setter\n    def content(self, content):\n        check_string(content, 'content', self._config, self._pos)\n        self._content = content\n\n    @content.deleter\n    def content(self):\n        self._content = None\n\n\nclass Link(SimpleElement, _IDProperty):\n    \"\"\"\n    LINK_ elements: used to reference external documents and servers through a URI.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    \"\"\"\n    _attr_list = ['ID', 'content_role', 'content_type', 'title', 'value',\n                  'href', 'action']\n    _element_name = 'LINK'\n\n    def __init__(self, ID=None, title=None, value=None, href=None, action=None,\n                 id=None, config=None, pos=None, **kwargs):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        SimpleElement.__init__(self)\n\n        content_role = kwargs.get('content-role') or kwargs.get('content_role')\n        content_type = kwargs.get('content-type') or kwargs.get('content_type')\n\n        if 'gref' in kwargs:\n            warn_or_raise(W11, W11, (), config, pos)\n\n        self.ID = resolve_id(ID, id, config, pos)\n        self.content_role = content_role\n        self.content_type = content_type\n        self.title = title\n        self.value = value\n        self.href = href\n        self.action = action\n\n        warn_unknown_attrs(\n            'LINK', kwargs.keys(), config, pos,\n            ['content-role', 'content_role', 'content-type', 'content_type',\n             'gref'])\n\n    @property\n    def content_role(self):\n        \"\"\"\n        Defines the MIME role of the referenced object.  Must be one of:\n\n          None, 'query', 'hints', 'doc', 'location' or 'type'\n        \"\"\"\n        return self._content_role\n\n    @content_role.setter\n    def content_role(self, content_role):\n        if ((content_role == 'type' and\n             not self._config['version_1_3_or_later']) or\n             content_role not in\n             (None, 'query', 'hints', 'doc', 'location')):\n            vo_warn(W45, (content_role,), self._config, self._pos)\n        self._content_role = content_role\n\n    @content_role.deleter\n    def content_role(self):\n        self._content_role = None\n\n    @property\n    def content_type(self):\n        \"\"\"Defines the MIME content type of the referenced object.\"\"\"\n        return self._content_type\n\n    @content_type.setter\n    def content_type(self, content_type):\n        xmlutil.check_mime_content_type(content_type, self._config, self._pos)\n        self._content_type = content_type\n\n    @content_type.deleter\n    def content_type(self):\n        self._content_type = None\n\n    @property\n    def href(self):\n        \"\"\"\n        A URI to an arbitrary protocol.  The vo package only supports\n        http and anonymous ftp.\n        \"\"\"\n        return self._href\n\n    @href.setter\n    def href(self, href):\n        xmlutil.check_anyuri(href, self._config, self._pos)\n        self._href = href\n\n    @href.deleter\n    def href(self):\n        self._href = None\n\n    def to_table_column(self, column):\n        meta = {}\n        for key in self._attr_list:\n            val = getattr(self, key, None)\n            if val is not None:\n                meta[key] = val\n\n        column.meta.setdefault('links', [])\n        column.meta['links'].append(meta)\n\n    @classmethod\n    def from_table_column(cls, d):\n        return cls(**d)\n\n\nclass Info(SimpleElementWithContent, _IDProperty, _XtypeProperty,\n           _UtypeProperty):\n    \"\"\"\n    INFO_ elements: arbitrary key-value pairs for extensions to the standard.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    \"\"\"\n    _element_name = 'INFO'\n    _attr_list_11 = ['ID', 'name', 'value']\n    _attr_list_12 = _attr_list_11 + ['xtype', 'ref', 'unit', 'ucd', 'utype']\n    _utype_in_v1_2 = True\n\n    def __init__(self, ID=None, name=None, value=None, id=None, xtype=None,\n                 ref=None, unit=None, ucd=None, utype=None,\n                 config=None, pos=None, **extra):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        SimpleElementWithContent.__init__(self)\n\n        self.ID = (resolve_id(ID, id, config, pos) or\n                        xmlutil.fix_id(name, config, pos))\n        self.name = name\n        self.value = value\n        self.xtype = xtype\n        self.ref = ref\n        self.unit = unit\n        self.ucd = ucd\n        self.utype = utype\n\n        if config.get('version_1_2_or_later'):\n            self._attr_list = self._attr_list_12\n        else:\n            self._attr_list = self._attr_list_11\n            if xtype is not None:\n                warn_unknown_attrs('INFO', ['xtype'], config, pos)\n            if ref is not None:\n                warn_unknown_attrs('INFO', ['ref'], config, pos)\n            if unit is not None:\n                warn_unknown_attrs('INFO', ['unit'], config, pos)\n            if ucd is not None:\n                warn_unknown_attrs('INFO', ['ucd'], config, pos)\n            if utype is not None:\n                warn_unknown_attrs('INFO', ['utype'], config, pos)\n\n        warn_unknown_attrs('INFO', extra.keys(), config, pos)\n\n    @property\n    def name(self):\n        \"\"\"[*required*] The key of the key-value pair.\"\"\"\n        return self._name\n\n    @name.setter\n    def name(self, name):\n        if name is None:\n            warn_or_raise(W35, W35, ('name'), self._config, self._pos)\n        xmlutil.check_token(name, 'name', self._config, self._pos)\n        self._name = name\n\n    @property\n    def value(self):\n        \"\"\"\n        [*required*] The value of the key-value pair.  (Always stored\n        as a string or unicode string).\n        \"\"\"\n        return self._value\n\n    @value.setter\n    def value(self, value):\n        if value is None:\n            warn_or_raise(W35, W35, ('value'), self._config, self._pos)\n        check_string(value, 'value', self._config, self._pos)\n        self._value = value\n\n    @property\n    def content(self):\n        \"\"\"The content inside the INFO element.\"\"\"\n        return self._content\n\n    @content.setter\n    def content(self, content):\n        check_string(content, 'content', self._config, self._pos)\n        self._content = content\n\n    @content.deleter\n    def content(self):\n        self._content = None\n\n    @property\n    def ref(self):\n        \"\"\"\n        Refer to another INFO_ element by ID_, defined previously in\n        the document.\n        \"\"\"\n        return self._ref\n\n    @ref.setter\n    def ref(self, ref):\n        if ref is not None and not self._config.get('version_1_2_or_later'):\n            warn_or_raise(W28, W28, ('ref', 'INFO', '1.2'),\n                          self._config, self._pos)\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        # TODO: actually apply the reference\n        # if ref is not None:\n        #     try:\n        #         other = self._votable.get_values_by_id(ref, before=self)\n        #     except KeyError:\n        #         vo_raise(\n        #             \"VALUES ref='%s', which has not already been defined.\" %\n        #             self.ref, self._config, self._pos, KeyError)\n        #     self.null = other.null\n        #     self.type = other.type\n        #     self.min = other.min\n        #     self.min_inclusive = other.min_inclusive\n        #     self.max = other.max\n        #     self.max_inclusive = other.max_inclusive\n        #     self._options[:] = other.options\n        self._ref = ref\n\n    @ref.deleter\n    def ref(self):\n        self._ref = None\n\n    @property\n    def unit(self):\n        \"\"\"A string specifying the units_ for the INFO_.\"\"\"\n        return self._unit\n\n    @unit.setter\n    def unit(self, unit):\n        if unit is None:\n            self._unit = None\n            return\n\n        from astropy import units as u\n\n        if not self._config.get('version_1_2_or_later'):\n            warn_or_raise(W28, W28, ('unit', 'INFO', '1.2'),\n                          self._config, self._pos)\n\n        # First, parse the unit in the default way, so that we can\n        # still emit a warning if the unit is not to spec.\n        default_format = _get_default_unit_format(self._config)\n        unit_obj = u.Unit(\n            unit, format=default_format, parse_strict='silent')\n        if isinstance(unit_obj, u.UnrecognizedUnit):\n            warn_or_raise(W50, W50, (unit,),\n                          self._config, self._pos)\n\n        format = _get_unit_format(self._config)\n        if format != default_format:\n            unit_obj = u.Unit(\n                unit, format=format, parse_strict='silent')\n\n        self._unit = unit_obj\n\n    @unit.deleter\n    def unit(self):\n        self._unit = None\n\n    def to_xml(self, w, **kwargs):\n        attrib = w.object_attrs(self, self._attr_list)\n        if 'unit' in attrib:\n            attrib['unit'] = self.unit.to_string('cds')\n        w.element(self._element_name, self._content,\n                  attrib=attrib)\n\n\nclass Values(Element, _IDProperty):\n    \"\"\"\n    VALUES_ element: used within FIELD_ and PARAM_ elements to define the domain of values.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    \"\"\"\n\n    def __init__(self, votable, field, ID=None, null=None, ref=None,\n                 type=\"legal\", id=None, config=None, pos=None, **extras):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        Element.__init__(self)\n\n        self._votable = votable\n        self._field = field\n        self.ID = resolve_id(ID, id, config, pos)\n        self.null = null\n        self._ref = ref\n        self.type = type\n\n        self.min = None\n        self.max = None\n        self.min_inclusive = True\n        self.max_inclusive = True\n        self._options = []\n\n        warn_unknown_attrs('VALUES', extras.keys(), config, pos)\n\n    def __repr__(self):\n        buff = io.StringIO()\n        self.to_xml(XMLWriter(buff))\n        return buff.getvalue().strip()\n\n    @property\n    def null(self):\n        \"\"\"\n        For integral datatypes, *null* is used to define the value\n        used for missing values.\n        \"\"\"\n        return self._null\n\n    @null.setter\n    def null(self, null):\n        if null is not None and isinstance(null, str):\n            try:\n                null_val = self._field.converter.parse_scalar(\n                    null, self._config, self._pos)[0]\n            except Exception:\n                warn_or_raise(W36, W36, null, self._config, self._pos)\n                null_val = self._field.converter.parse_scalar(\n                    '0', self._config, self._pos)[0]\n        else:\n            null_val = null\n        self._null = null_val\n\n    @null.deleter\n    def null(self):\n        self._null = None\n\n    @property\n    def type(self):\n        \"\"\"\n        [*required*] Defines the applicability of the domain defined\n        by this VALUES_ element.  Must be one of the following\n        strings:\n\n          - 'legal': The domain of this column applies in general to\n            this datatype. (default)\n\n          - 'actual': The domain of this column applies only to the\n            data enclosed in the parent table.\n        \"\"\"\n        return self._type\n\n    @type.setter\n    def type(self, type):\n        if type not in ('legal', 'actual'):\n            vo_raise(E08, type, self._config, self._pos)\n        self._type = type\n\n    @property\n    def ref(self):\n        \"\"\"\n        Refer to another VALUES_ element by ID_, defined previously in\n        the document, for MIN/MAX/OPTION information.\n        \"\"\"\n        return self._ref\n\n    @ref.setter\n    def ref(self, ref):\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        if ref is not None:\n            try:\n                other = self._votable.get_values_by_id(ref, before=self)\n            except KeyError:\n                warn_or_raise(W43, W43, ('VALUES', self.ref), self._config,\n                              self._pos)\n                ref = None\n            else:\n                self.null = other.null\n                self.type = other.type\n                self.min = other.min\n                self.min_inclusive = other.min_inclusive\n                self.max = other.max\n                self.max_inclusive = other.max_inclusive\n                self._options[:] = other.options\n        self._ref = ref\n\n    @ref.deleter\n    def ref(self):\n        self._ref = None\n\n    @property\n    def min(self):\n        \"\"\"\n        The minimum value of the domain.  See :attr:`min_inclusive`.\n        \"\"\"\n        return self._min\n\n    @min.setter\n    def min(self, min):\n        if hasattr(self._field, 'converter') and min is not None:\n            self._min = self._field.converter.parse(min)[0]\n        else:\n            self._min = min\n\n    @min.deleter\n    def min(self):\n        self._min = None\n\n    @property\n    def min_inclusive(self):\n        \"\"\"When `True`, the domain includes the minimum value.\"\"\"\n        return self._min_inclusive\n\n    @min_inclusive.setter\n    def min_inclusive(self, inclusive):\n        if inclusive == 'yes':\n            self._min_inclusive = True\n        elif inclusive == 'no':\n            self._min_inclusive = False\n        else:\n            self._min_inclusive = bool(inclusive)\n\n    @min_inclusive.deleter\n    def min_inclusive(self):\n        self._min_inclusive = True\n\n    @property\n    def max(self):\n        \"\"\"\n        The maximum value of the domain.  See :attr:`max_inclusive`.\n        \"\"\"\n        return self._max\n\n    @max.setter\n    def max(self, max):\n        if hasattr(self._field, 'converter') and max is not None:\n            self._max = self._field.converter.parse(max)[0]\n        else:\n            self._max = max\n\n    @max.deleter\n    def max(self):\n        self._max = None\n\n    @property\n    def max_inclusive(self):\n        \"\"\"When `True`, the domain includes the maximum value.\"\"\"\n        return self._max_inclusive\n\n    @max_inclusive.setter\n    def max_inclusive(self, inclusive):\n        if inclusive == 'yes':\n            self._max_inclusive = True\n        elif inclusive == 'no':\n            self._max_inclusive = False\n        else:\n            self._max_inclusive = bool(inclusive)\n\n    @max_inclusive.deleter\n    def max_inclusive(self):\n        self._max_inclusive = True\n\n    @property\n    def options(self):\n        \"\"\"\n        A list of string key-value tuples defining other OPTION\n        elements for the domain.  All options are ignored -- they are\n        stored for round-tripping purposes only.\n        \"\"\"\n        return self._options\n\n    def parse(self, iterator, config):\n        if self.ref is not None:\n            for start, tag, data, pos in iterator:\n                if start:\n                    warn_or_raise(W44, W44, tag, config, pos)\n                else:\n                    if tag != 'VALUES':\n                        warn_or_raise(W44, W44, tag, config, pos)\n                    break\n        else:\n            for start, tag, data, pos in iterator:\n                if start:\n                    if tag == 'MIN':\n                        if 'value' not in data:\n                            vo_raise(E09, 'MIN', config, pos)\n                        self.min = data['value']\n                        self.min_inclusive = data.get('inclusive', 'yes')\n                        warn_unknown_attrs(\n                            'MIN', data.keys(), config, pos,\n                            ['value', 'inclusive'])\n                    elif tag == 'MAX':\n                        if 'value' not in data:\n                            vo_raise(E09, 'MAX', config, pos)\n                        self.max = data['value']\n                        self.max_inclusive = data.get('inclusive', 'yes')\n                        warn_unknown_attrs(\n                            'MAX', data.keys(), config, pos,\n                            ['value', 'inclusive'])\n                    elif tag == 'OPTION':\n                        if 'value' not in data:\n                            vo_raise(E09, 'OPTION', config, pos)\n                        xmlutil.check_token(\n                            data.get('name'), 'name', config, pos)\n                        self.options.append(\n                            (data.get('name'), data.get('value')))\n                        warn_unknown_attrs(\n                            'OPTION', data.keys(), config, pos,\n                            ['value', 'name'])\n                elif tag == 'VALUES':\n                    break\n\n        return self\n\n    def is_defaults(self):\n        \"\"\"\n        Are the settings on this ``VALUE`` element all the same as the\n        XML defaults?\n        \"\"\"\n        # If there's nothing meaningful or non-default to write,\n        # don't write anything.\n        return (self.ref is None and self.null is None and self.ID is None and\n                self.max is None and self.min is None and self.options == [])\n\n    def to_xml(self, w, **kwargs):\n        def yes_no(value):\n            if value:\n                return 'yes'\n            return 'no'\n\n        if self.is_defaults():\n            return\n\n        if self.ref is not None:\n            w.element('VALUES', attrib=w.object_attrs(self, ['ref']))\n        else:\n            with w.tag('VALUES',\n                       attrib=w.object_attrs(\n                           self, ['ID', 'null', 'ref'])):\n                if self.min is not None:\n                    w.element(\n                        'MIN',\n                        value=self._field.converter.output(self.min, False),\n                        inclusive=yes_no(self.min_inclusive))\n                if self.max is not None:\n                    w.element(\n                        'MAX',\n                        value=self._field.converter.output(self.max, False),\n                        inclusive=yes_no(self.max_inclusive))\n                for name, value in self.options:\n                    w.element(\n                        'OPTION',\n                        name=name,\n                        value=value)\n\n    def to_table_column(self, column):\n        # Have the ref filled in here\n        meta = {}\n        for key in ['ID', 'null']:\n            val = getattr(self, key, None)\n            if val is not None:\n                meta[key] = val\n        if self.min is not None:\n            meta['min'] = {\n                'value': self.min,\n                'inclusive': self.min_inclusive}\n        if self.max is not None:\n            meta['max'] = {\n                'value': self.max,\n                'inclusive': self.max_inclusive}\n        if len(self.options):\n            meta['options'] = dict(self.options)\n\n        column.meta['values'] = meta\n\n    def from_table_column(self, column):\n        if column.info.meta is None or 'values' not in column.info.meta:\n            return\n\n        meta = column.info.meta['values']\n        for key in ['ID', 'null']:\n            val = meta.get(key, None)\n            if val is not None:\n                setattr(self, key, val)\n        if 'min' in meta:\n            self.min = meta['min']['value']\n            self.min_inclusive = meta['min']['inclusive']\n        if 'max' in meta:\n            self.max = meta['max']['value']\n            self.max_inclusive = meta['max']['inclusive']\n        if 'options' in meta:\n            self._options = list(meta['options'].items())\n\n\nclass Field(SimpleElement, _IDProperty, _NameProperty, _XtypeProperty,\n            _UtypeProperty, _UcdProperty):\n    \"\"\"\n    FIELD_ element: describes the datatype of a particular column of data.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n\n    If *ID* is provided, it is used for the column name in the\n    resulting recarray of the table.  If no *ID* is provided, *name*\n    is used instead.  If neither is provided, an exception will be\n    raised.\n    \"\"\"\n    _attr_list_11 = ['ID', 'name', 'datatype', 'arraysize', 'ucd',\n                     'unit', 'width', 'precision', 'utype', 'ref']\n    _attr_list_12 = _attr_list_11 + ['xtype']\n    _element_name = 'FIELD'\n\n    def __init__(self, votable, ID=None, name=None, datatype=None,\n                 arraysize=None, ucd=None, unit=None, width=None,\n                 precision=None, utype=None, ref=None, type=None, id=None,\n                 xtype=None,\n                 config=None, pos=None, **extra):\n        if config is None:\n            if hasattr(votable, '_get_version_checks'):\n                config = votable._get_version_checks()\n            else:\n                config = {}\n        self._config = config\n        self._pos = pos\n\n        SimpleElement.__init__(self)\n\n        if config.get('version_1_2_or_later'):\n            self._attr_list = self._attr_list_12\n        else:\n            self._attr_list = self._attr_list_11\n            if xtype is not None:\n                warn_unknown_attrs(self._element_name, ['xtype'], config, pos)\n\n        # TODO: REMOVE ME ----------------------------------------\n        # This is a terrible hack to support Simple Image Access\n        # Protocol results from https://astroarchive.noirlab.edu/ .  It creates a field\n        # for the coordinate projection type of type \"double\", which\n        # actually contains character data.  We have to hack the field\n        # to store character data, or we can't read it in.  A warning\n        # will be raised when this happens.\n        if (config.get('verify', 'ignore') != 'exception' and name == 'cprojection' and\n            ID == 'cprojection' and ucd == 'VOX:WCS_CoordProjection' and\n            datatype == 'double'):\n            datatype = 'char'\n            arraysize = '3'\n            vo_warn(W40, (), config, pos)\n        # ----------------------------------------\n\n        self.description = None\n        self._votable = votable\n\n        self.ID = (resolve_id(ID, id, config, pos) or\n                   xmlutil.fix_id(name, config, pos))\n        self.name = name\n        if name is None:\n            if (self._element_name == 'PARAM' and\n                not config.get('version_1_1_or_later')):\n                pass\n            else:\n                warn_or_raise(W15, W15, self._element_name, config, pos)\n            self.name = self.ID\n\n        if self._ID is None and name is None:\n            vo_raise(W12, self._element_name, config, pos)\n\n        datatype_mapping = {\n            'string': 'char',\n            'unicodeString': 'unicodeChar',\n            'int16': 'short',\n            'int32': 'int',\n            'int64': 'long',\n            'float32': 'float',\n            'float64': 'double',\n            # The following appear in some Vizier tables\n            'unsignedInt': 'long',\n            'unsignedShort': 'int'\n        }\n\n        datatype_mapping.update(config.get('datatype_mapping', {}))\n\n        if datatype in datatype_mapping:\n            warn_or_raise(W13, W13, (datatype, datatype_mapping[datatype]),\n                          config, pos)\n            datatype = datatype_mapping[datatype]\n\n        self.ref = ref\n        self.datatype = datatype\n        self.arraysize = arraysize\n        self.ucd = ucd\n        self.unit = unit\n        self.width = width\n        self.precision = precision\n        self.utype = utype\n        self.type = type\n        self._links = HomogeneousList(Link)\n        self.title = self.name\n        self.values = Values(self._votable, self)\n        self.xtype = xtype\n\n        self._setup(config, pos)\n\n        warn_unknown_attrs(self._element_name, extra.keys(), config, pos)\n\n    @classmethod\n    def uniqify_names(cls, fields):\n        \"\"\"\n        Make sure that all names and titles in a list of fields are\n        unique, by appending numbers if necessary.\n        \"\"\"\n        unique = {}\n        for field in fields:\n            i = 2\n            new_id = field.ID\n            while new_id in unique:\n                new_id = field.ID + f\"_{i:d}\"\n                i += 1\n            if new_id != field.ID:\n                vo_warn(W32, (field.ID, new_id), field._config, field._pos)\n            field.ID = new_id\n            unique[new_id] = field.ID\n\n        for field in fields:\n            i = 2\n            if field.name is None:\n                new_name = field.ID\n                implicit = True\n            else:\n                new_name = field.name\n                implicit = False\n            if new_name != field.ID:\n                while new_name in unique:\n                    new_name = field.name + f\" {i:d}\"\n                    i += 1\n\n            if (not implicit and\n                new_name != field.name):\n                vo_warn(W33, (field.name, new_name), field._config, field._pos)\n            field._unique_name = new_name\n            unique[new_name] = field.name\n\n    def _setup(self, config, pos):\n        if self.values._ref is not None:\n            self.values.ref = self.values._ref\n        self.converter = converters.get_converter(self, config, pos)\n\n    @property\n    def datatype(self):\n        \"\"\"\n        [*required*] The datatype of the column.  Valid values (as\n        defined by the spec) are:\n\n          'boolean', 'bit', 'unsignedByte', 'short', 'int', 'long',\n          'char', 'unicodeChar', 'float', 'double', 'floatComplex', or\n          'doubleComplex'\n\n        Many VOTABLE files in the wild use 'string' instead of 'char',\n        so that is also a valid option, though 'string' will always be\n        converted to 'char' when writing the file back out.\n        \"\"\"\n        return self._datatype\n\n    @datatype.setter\n    def datatype(self, datatype):\n        if datatype is None:\n            if self._config.get('version_1_1_or_later'):\n                warn_or_raise(E10, E10, self._element_name, self._config,\n                              self._pos)\n            datatype = 'char'\n        if datatype not in converters.converter_mapping:\n            vo_raise(E06, (datatype, self.ID), self._config, self._pos)\n        self._datatype = datatype\n\n    @property\n    def precision(self):\n        \"\"\"\n        Along with :attr:`width`, defines the `numerical accuracy`_\n        associated with the data.  These values are used to limit the\n        precision when writing floating point values back to the XML\n        file.  Otherwise, it is purely informational -- the Numpy\n        recarray containing the data itself does not use this\n        information.\n        \"\"\"\n        return self._precision\n\n    @precision.setter\n    def precision(self, precision):\n        if precision is not None and not re.match(r\"^[FE]?[0-9]+$\", precision):\n            vo_raise(E11, precision, self._config, self._pos)\n        self._precision = precision\n\n    @precision.deleter\n    def precision(self):\n        self._precision = None\n\n    @property\n    def width(self):\n        \"\"\"\n        Along with :attr:`precision`, defines the `numerical\n        accuracy`_ associated with the data.  These values are used to\n        limit the precision when writing floating point values back to\n        the XML file.  Otherwise, it is purely informational -- the\n        Numpy recarray containing the data itself does not use this\n        information.\n        \"\"\"\n        return self._width\n\n    @width.setter\n    def width(self, width):\n        if width is not None:\n            width = int(width)\n            if width <= 0:\n                vo_raise(E12, width, self._config, self._pos)\n        self._width = width\n\n    @width.deleter\n    def width(self):\n        self._width = None\n\n    # ref on FIELD and PARAM behave differently than elsewhere -- here\n    # they're just informational, such as to refer to a coordinate\n    # system.\n    @property\n    def ref(self):\n        \"\"\"\n        On FIELD_ elements, ref is used only for informational\n        purposes, for example to refer to a COOSYS_ or TIMESYS_ element.\n        \"\"\"\n        return self._ref\n\n    @ref.setter\n    def ref(self, ref):\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        self._ref = ref\n\n    @ref.deleter\n    def ref(self):\n        self._ref = None\n\n    @property\n    def unit(self):\n        \"\"\"A string specifying the units_ for the FIELD_.\"\"\"\n        return self._unit\n\n    @unit.setter\n    def unit(self, unit):\n        if unit is None:\n            self._unit = None\n            return\n\n        from astropy import units as u\n\n        # First, parse the unit in the default way, so that we can\n        # still emit a warning if the unit is not to spec.\n        default_format = _get_default_unit_format(self._config)\n        unit_obj = u.Unit(\n            unit, format=default_format, parse_strict='silent')\n        if isinstance(unit_obj, u.UnrecognizedUnit):\n            warn_or_raise(W50, W50, (unit,),\n                          self._config, self._pos)\n\n        format = _get_unit_format(self._config)\n        if format != default_format:\n            unit_obj = u.Unit(\n                unit, format=format, parse_strict='silent')\n\n        self._unit = unit_obj\n\n    @unit.deleter\n    def unit(self):\n        self._unit = None\n\n    @property\n    def arraysize(self):\n        \"\"\"\n        Specifies the size of the multidimensional array if this\n        FIELD_ contains more than a single value.\n\n        See `multidimensional arrays`_.\n        \"\"\"\n        return self._arraysize\n\n    @arraysize.setter\n    def arraysize(self, arraysize):\n        if (arraysize is not None and\n            not re.match(r\"^([0-9]+x)*[0-9]*[*]?(s\\W)?$\", arraysize)):\n            vo_raise(E13, arraysize, self._config, self._pos)\n        self._arraysize = arraysize\n\n    @arraysize.deleter\n    def arraysize(self):\n        self._arraysize = None\n\n    @property\n    def type(self):\n        \"\"\"\n        The type attribute on FIELD_ elements is reserved for future\n        extensions.\n        \"\"\"\n        return self._type\n\n    @type.setter\n    def type(self, type):\n        self._type = type\n\n    @type.deleter\n    def type(self):\n        self._type = None\n\n    @property\n    def values(self):\n        \"\"\"\n        A :class:`Values` instance (or `None`) defining the domain\n        of the column.\n        \"\"\"\n        return self._values\n\n    @values.setter\n    def values(self, values):\n        assert values is None or isinstance(values, Values)\n        self._values = values\n\n    @values.deleter\n    def values(self):\n        self._values = None\n\n    @property\n    def links(self):\n        \"\"\"\n        A list of :class:`Link` instances used to reference more\n        details about the meaning of the FIELD_.  This is purely\n        informational and is not used by the `astropy.io.votable`\n        package.\n        \"\"\"\n        return self._links\n\n    def parse(self, iterator, config):\n        for start, tag, data, pos in iterator:\n            if start:\n                if tag == 'VALUES':\n                    self.values.__init__(\n                        self._votable, self, config=config, pos=pos, **data)\n                    self.values.parse(iterator, config)\n                elif tag == 'LINK':\n                    link = Link(config=config, pos=pos, **data)\n                    self.links.append(link)\n                    link.parse(iterator, config)\n                elif tag == 'DESCRIPTION':\n                    warn_unknown_attrs(\n                        'DESCRIPTION', data.keys(), config, pos)\n                elif tag != self._element_name:\n                    self._add_unknown_tag(iterator, tag, data, config, pos)\n            else:\n                if tag == 'DESCRIPTION':\n                    if self.description is not None:\n                        warn_or_raise(\n                            W17, W17, self._element_name, config, pos)\n                    self.description = data or None\n                elif tag == self._element_name:\n                    break\n\n        if self.description is not None:\n            self.title = \" \".join(x.strip() for x in\n                                  self.description.splitlines())\n        else:\n            self.title = self.name\n\n        self._setup(config, pos)\n\n        return self\n\n    def to_xml(self, w, **kwargs):\n        attrib = w.object_attrs(self, self._attr_list)\n        if 'unit' in attrib:\n            attrib['unit'] = self.unit.to_string('cds')\n        with w.tag(self._element_name, attrib=attrib):\n            if self.description is not None:\n                w.element('DESCRIPTION', self.description, wrap=True)\n            if not self.values.is_defaults():\n                self.values.to_xml(w, **kwargs)\n            for link in self.links:\n                link.to_xml(w, **kwargs)\n\n    def to_table_column(self, column):\n        \"\"\"\n        Sets the attributes of a given `astropy.table.Column` instance\n        to match the information in this `Field`.\n        \"\"\"\n        for key in ['ucd', 'width', 'precision', 'utype', 'xtype']:\n            val = getattr(self, key, None)\n            if val is not None:\n                column.meta[key] = val\n        if not self.values.is_defaults():\n            self.values.to_table_column(column)\n        for link in self.links:\n            link.to_table_column(column)\n        if self.description is not None:\n            column.description = self.description\n        if self.unit is not None:\n            # TODO: Use units framework when it's available\n            column.unit = self.unit\n        if (isinstance(self.converter, converters.FloatingPoint) and\n                self.converter.output_format != '{!r:>}'):\n            column.format = self.converter.output_format\n        elif isinstance(self.converter, converters.Char):\n            column.info.meta['_votable_string_dtype'] = 'char'\n        elif isinstance(self.converter, converters.UnicodeChar):\n            column.info.meta['_votable_string_dtype'] = 'unicodeChar'\n\n    @classmethod\n    def from_table_column(cls, votable, column):\n        \"\"\"\n        Restores a `Field` instance from a given\n        `astropy.table.Column` instance.\n        \"\"\"\n        kwargs = {}\n        meta = column.info.meta\n        if meta:\n            for key in ['ucd', 'width', 'precision', 'utype', 'xtype']:\n                val = meta.get(key, None)\n                if val is not None:\n                    kwargs[key] = val\n        # TODO: Use the unit framework when available\n        if column.info.unit is not None:\n            kwargs['unit'] = column.info.unit\n        kwargs['name'] = column.info.name\n        result = converters.table_column_to_votable_datatype(column)\n        kwargs.update(result)\n\n        field = cls(votable, **kwargs)\n\n        if column.info.description is not None:\n            field.description = column.info.description\n        field.values.from_table_column(column)\n        if meta and 'links' in meta:\n            for link in meta['links']:\n                field.links.append(Link.from_table_column(link))\n\n        # TODO: Parse format into precision and width\n        return field\n\n\nclass Param(Field):\n    \"\"\"\n    PARAM_ element: constant-valued columns in the data.\n\n    :class:`Param` objects are a subclass of :class:`Field`, and have\n    all of its methods and members.  Additionally, it defines :attr:`value`.\n    \"\"\"\n    _attr_list_11 = Field._attr_list_11 + ['value']\n    _attr_list_12 = Field._attr_list_12 + ['value']\n    _element_name = 'PARAM'\n\n    def __init__(self, votable, ID=None, name=None, value=None, datatype=None,\n                 arraysize=None, ucd=None, unit=None, width=None,\n                 precision=None, utype=None, type=None, id=None, config=None,\n                 pos=None, **extra):\n        self._value = value\n        Field.__init__(self, votable, ID=ID, name=name, datatype=datatype,\n                       arraysize=arraysize, ucd=ucd, unit=unit,\n                       precision=precision, utype=utype, type=type,\n                       id=id, config=config, pos=pos, **extra)\n\n    @property\n    def value(self):\n        \"\"\"\n        [*required*] The constant value of the parameter.  Its type is\n        determined by the :attr:`~Field.datatype` member.\n        \"\"\"\n        return self._value\n\n    @value.setter\n    def value(self, value):\n        if value is None:\n            value = \"\"\n        if isinstance(value, str):\n            self._value = self.converter.parse(\n                value, self._config, self._pos)[0]\n        else:\n            self._value = value\n\n    def _setup(self, config, pos):\n        Field._setup(self, config, pos)\n        self.value = self._value\n\n    def to_xml(self, w, **kwargs):\n        tmp_value = self._value\n        self._value = self.converter.output(tmp_value, False)\n        # We must always have a value\n        if self._value is None:\n            self._value = \"\"\n        Field.to_xml(self, w, **kwargs)\n        self._value = tmp_value\n\n\nclass CooSys(SimpleElement):\n    \"\"\"\n    COOSYS_ element: defines a coordinate system.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    \"\"\"\n    _attr_list = ['ID', 'equinox', 'epoch', 'system']\n    _element_name = 'COOSYS'\n\n    def __init__(self, ID=None, equinox=None, epoch=None, system=None, id=None,\n                 config=None, pos=None, **extra):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        # COOSYS was deprecated in 1.2 but then re-instated in 1.3\n        if (config.get('version_1_2_or_later') and\n                not config.get('version_1_3_or_later')):\n            warn_or_raise(W27, W27, (), config, pos)\n\n        SimpleElement.__init__(self)\n\n        self.ID = resolve_id(ID, id, config, pos)\n        self.equinox = equinox\n        self.epoch = epoch\n        self.system = system\n\n        warn_unknown_attrs('COOSYS', extra.keys(), config, pos)\n\n    @property\n    def ID(self):\n        \"\"\"\n        [*required*] The XML ID of the COOSYS_ element, used for\n        cross-referencing.  May be `None` or a string conforming to\n        XML ID_ syntax.\n        \"\"\"\n        return self._ID\n\n    @ID.setter\n    def ID(self, ID):\n        if self._config.get('version_1_1_or_later'):\n            if ID is None:\n                vo_raise(E15, (), self._config, self._pos)\n        xmlutil.check_id(ID, 'ID', self._config, self._pos)\n        self._ID = ID\n\n    @property\n    def system(self):\n        \"\"\"\n        Specifies the type of coordinate system.  Valid choices are:\n\n          'eq_FK4', 'eq_FK5', 'ICRS', 'ecl_FK4', 'ecl_FK5', 'galactic',\n          'supergalactic', 'xy', 'barycentric', or 'geo_app'\n        \"\"\"\n        return self._system\n\n    @system.setter\n    def system(self, system):\n        if system not in ('eq_FK4', 'eq_FK5', 'ICRS', 'ecl_FK4', 'ecl_FK5',\n                          'galactic', 'supergalactic', 'xy', 'barycentric',\n                          'geo_app'):\n            warn_or_raise(E16, E16, system, self._config, self._pos)\n        self._system = system\n\n    @system.deleter\n    def system(self):\n        self._system = None\n\n    @property\n    def equinox(self):\n        \"\"\"\n        A parameter required to fix the equatorial or ecliptic systems\n        (as e.g. \"J2000\" as the default \"eq_FK5\" or \"B1950\" as the\n        default \"eq_FK4\").\n        \"\"\"\n        return self._equinox\n\n    @equinox.setter\n    def equinox(self, equinox):\n        check_astroyear(equinox, 'equinox', self._config, self._pos)\n        self._equinox = equinox\n\n    @equinox.deleter\n    def equinox(self):\n        self._equinox = None\n\n    @property\n    def epoch(self):\n        \"\"\"\n        Specifies the epoch of the positions.  It must be a string\n        specifying an astronomical year.\n        \"\"\"\n        return self._epoch\n\n    @epoch.setter\n    def epoch(self, epoch):\n        check_astroyear(epoch, 'epoch', self._config, self._pos)\n        self._epoch = epoch\n\n    @epoch.deleter\n    def epoch(self):\n        self._epoch = None\n\n\nclass TimeSys(SimpleElement):\n    \"\"\"\n    TIMESYS_ element: defines a time system.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    \"\"\"\n    _attr_list = ['ID', 'timeorigin', 'timescale', 'refposition']\n    _element_name = 'TIMESYS'\n\n    def __init__(self, ID=None, timeorigin=None, timescale=None, refposition=None, id=None,\n                 config=None, pos=None, **extra):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        # TIMESYS is supported starting in version 1.4\n        if not config['version_1_4_or_later']:\n            warn_or_raise(\n                W54, W54, config['version'], config, pos)\n\n        SimpleElement.__init__(self)\n\n        self.ID = resolve_id(ID, id, config, pos)\n        self.timeorigin = timeorigin\n        self.timescale = timescale\n        self.refposition = refposition\n\n        warn_unknown_attrs('TIMESYS', extra.keys(), config, pos,\n                           ['ID', 'timeorigin', 'timescale', 'refposition'])\n\n    @property\n    def ID(self):\n        \"\"\"\n        [*required*] The XML ID of the TIMESYS_ element, used for\n        cross-referencing.  Must be a string conforming to\n        XML ID_ syntax.\n        \"\"\"\n        return self._ID\n\n    @ID.setter\n    def ID(self, ID):\n        if ID is None:\n            vo_raise(E22, (), self._config, self._pos)\n        xmlutil.check_id(ID, 'ID', self._config, self._pos)\n        self._ID = ID\n\n    @property\n    def timeorigin(self):\n        \"\"\"\n        Specifies the time origin of the time coordinate,\n        given as a Julian Date for the the time scale and\n        reference point defined. It is usually given as a\n        floating point literal; for convenience, the magic\n        strings \"MJD-origin\" (standing for 2400000.5) and\n        \"JD-origin\" (standing for 0) are also allowed.\n\n        The timeorigin attribute MUST be given unless the\n        time’s representation contains a year of a calendar\n        era, in which case it MUST NOT be present. In VOTables,\n        these representations currently are Gregorian calendar\n        years with xtype=\"timestamp\", or years in the Julian\n        or Besselian calendar when a column has yr, a, or Ba as\n        its unit and no time origin is given.\n        \"\"\"\n        return self._timeorigin\n\n    @timeorigin.setter\n    def timeorigin(self, timeorigin):\n        if (timeorigin is not None and\n                timeorigin != 'MJD-origin' and timeorigin != 'JD-origin'):\n            try:\n                timeorigin = float(timeorigin)\n            except ValueError:\n                warn_or_raise(E23, E23, timeorigin, self._config, self._pos)\n        self._timeorigin = timeorigin\n\n    @timeorigin.deleter\n    def timeorigin(self):\n        self._timeorigin = None\n\n    @property\n    def timescale(self):\n        \"\"\"\n        [*required*] String specifying the time scale used. Values\n        should be taken from the IVOA timescale vocabulary (documented\n        at http://www.ivoa.net/rdf/timescale).\n        \"\"\"\n        return self._timescale\n\n    @timescale.setter\n    def timescale(self, timescale):\n        self._timescale = timescale\n\n    @timescale.deleter\n    def timescale(self):\n        self._timescale = None\n\n    @property\n    def refposition(self):\n        \"\"\"\n        [*required*] String specifying the reference position. Values\n        should be taken from the IVOA refposition vocabulary (documented\n        at http://www.ivoa.net/rdf/refposition).\n        \"\"\"\n        return self._refposition\n\n    @refposition.setter\n    def refposition(self, refposition):\n        self._refposition = refposition\n\n    @refposition.deleter\n    def refposition(self):\n        self._refposition = None\n\n\nclass FieldRef(SimpleElement, _UtypeProperty, _UcdProperty):\n    \"\"\"\n    FIELDref_ element: used inside of GROUP_ elements to refer to remote FIELD_ elements.\n    \"\"\"\n    _attr_list_11 = ['ref']\n    _attr_list_12 = _attr_list_11 + ['ucd', 'utype']\n    _element_name = \"FIELDref\"\n    _utype_in_v1_2 = True\n    _ucd_in_v1_2 = True\n\n    def __init__(self, table, ref, ucd=None, utype=None, config=None, pos=None,\n                 **extra):\n        \"\"\"\n        *table* is the :class:`Table` object that this :class:`FieldRef`\n        is a member of.\n\n        *ref* is the ID to reference a :class:`Field` object defined\n        elsewhere.\n        \"\"\"\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        SimpleElement.__init__(self)\n        self._table = table\n        self.ref = ref\n        self.ucd = ucd\n        self.utype = utype\n\n        if config.get('version_1_2_or_later'):\n            self._attr_list = self._attr_list_12\n        else:\n            self._attr_list = self._attr_list_11\n            if ucd is not None:\n                warn_unknown_attrs(self._element_name, ['ucd'], config, pos)\n            if utype is not None:\n                warn_unknown_attrs(self._element_name, ['utype'], config, pos)\n\n    @property\n    def ref(self):\n        \"\"\"The ID_ of the FIELD_ that this FIELDref_ references.\"\"\"\n        return self._ref\n\n    @ref.setter\n    def ref(self, ref):\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        self._ref = ref\n\n    @ref.deleter\n    def ref(self):\n        self._ref = None\n\n    def get_ref(self):\n        \"\"\"\n        Lookup the :class:`Field` instance that this :class:`FieldRef`\n        references.\n        \"\"\"\n        for field in self._table._votable.iter_fields_and_params():\n            if isinstance(field, Field) and field.ID == self.ref:\n                return field\n        vo_raise(\n            f\"No field named '{self.ref}'\",\n            self._config, self._pos, KeyError)\n\n\nclass ParamRef(SimpleElement, _UtypeProperty, _UcdProperty):\n    \"\"\"\n    PARAMref_ element: used inside of GROUP_ elements to refer to remote PARAM_ elements.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n\n    It contains the following publicly-accessible members:\n\n      *ref*: An XML ID referring to a <PARAM> element.\n    \"\"\"\n    _attr_list_11 = ['ref']\n    _attr_list_12 = _attr_list_11 + ['ucd', 'utype']\n    _element_name = \"PARAMref\"\n    _utype_in_v1_2 = True\n    _ucd_in_v1_2 = True\n\n    def __init__(self, table, ref, ucd=None, utype=None, config=None, pos=None):\n        if config is None:\n            config = {}\n\n        self._config = config\n        self._pos = pos\n\n        Element.__init__(self)\n        self._table = table\n        self.ref = ref\n        self.ucd = ucd\n        self.utype = utype\n\n        if config.get('version_1_2_or_later'):\n            self._attr_list = self._attr_list_12\n        else:\n            self._attr_list = self._attr_list_11\n            if ucd is not None:\n                warn_unknown_attrs(self._element_name, ['ucd'], config, pos)\n            if utype is not None:\n                warn_unknown_attrs(self._element_name, ['utype'], config, pos)\n\n    @property\n    def ref(self):\n        \"\"\"The ID_ of the PARAM_ that this PARAMref_ references.\"\"\"\n        return self._ref\n\n    @ref.setter\n    def ref(self, ref):\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        self._ref = ref\n\n    @ref.deleter\n    def ref(self):\n        self._ref = None\n\n    def get_ref(self):\n        \"\"\"\n        Lookup the :class:`Param` instance that this :class:``PARAMref``\n        references.\n        \"\"\"\n        for param in self._table._votable.iter_fields_and_params():\n            if isinstance(param, Param) and param.ID == self.ref:\n                return param\n        vo_raise(\n            f\"No params named '{self.ref}'\",\n            self._config, self._pos, KeyError)\n\n\nclass Group(Element, _IDProperty, _NameProperty, _UtypeProperty,\n            _UcdProperty, _DescriptionProperty):\n    \"\"\"\n    GROUP_ element: groups FIELD_ and PARAM_ elements.\n\n    This information is currently ignored by the vo package---that is\n    the columns in the recarray are always flat---but the grouping\n    information is stored so that it can be written out again to the\n    XML file.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    \"\"\"\n\n    def __init__(self, table, ID=None, name=None, ref=None, ucd=None,\n                 utype=None, id=None, config=None, pos=None, **extra):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        Element.__init__(self)\n        self._table = table\n\n        self.ID = (resolve_id(ID, id, config, pos)\n                            or xmlutil.fix_id(name, config, pos))\n        self.name = name\n        self.ref = ref\n        self.ucd = ucd\n        self.utype = utype\n        self.description = None\n\n        self._entries = HomogeneousList(\n            (FieldRef, ParamRef, Group, Param))\n\n        warn_unknown_attrs('GROUP', extra.keys(), config, pos)\n\n    def __repr__(self):\n        return f'<GROUP>... {len(self._entries)} entries ...</GROUP>'\n\n    @property\n    def ref(self):\n        \"\"\"\n        Currently ignored, as it's not clear from the spec how this is\n        meant to work.\n        \"\"\"\n        return self._ref\n\n    @ref.setter\n    def ref(self, ref):\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        self._ref = ref\n\n    @ref.deleter\n    def ref(self):\n        self._ref = None\n\n    @property\n    def entries(self):\n        \"\"\"\n        [read-only] A list of members of the GROUP_.  This list may\n        only contain objects of type :class:`Param`, :class:`Group`,\n        :class:`ParamRef` and :class:`FieldRef`.\n        \"\"\"\n        return self._entries\n\n    def _add_fieldref(self, iterator, tag, data, config, pos):\n        fieldref = FieldRef(self._table, config=config, pos=pos, **data)\n        self.entries.append(fieldref)\n\n    def _add_paramref(self, iterator, tag, data, config, pos):\n        paramref = ParamRef(self._table, config=config, pos=pos, **data)\n        self.entries.append(paramref)\n\n    def _add_param(self, iterator, tag, data, config, pos):\n        if isinstance(self._table, VOTableFile):\n            votable = self._table\n        else:\n            votable = self._table._votable\n        param = Param(votable, config=config, pos=pos, **data)\n        self.entries.append(param)\n        param.parse(iterator, config)\n\n    def _add_group(self, iterator, tag, data, config, pos):\n        group = Group(self._table, config=config, pos=pos, **data)\n        self.entries.append(group)\n        group.parse(iterator, config)\n\n    def parse(self, iterator, config):\n        tag_mapping = {\n            'FIELDref': self._add_fieldref,\n            'PARAMref': self._add_paramref,\n            'PARAM': self._add_param,\n            'GROUP': self._add_group,\n            'DESCRIPTION': self._ignore_add}\n\n        for start, tag, data, pos in iterator:\n            if start:\n                tag_mapping.get(tag, self._add_unknown_tag)(\n                    iterator, tag, data, config, pos)\n            else:\n                if tag == 'DESCRIPTION':\n                    if self.description is not None:\n                        warn_or_raise(W17, W17, 'GROUP', config, pos)\n                    self.description = data or None\n                elif tag == 'GROUP':\n                    break\n        return self\n\n    def to_xml(self, w, **kwargs):\n        with w.tag(\n            'GROUP',\n            attrib=w.object_attrs(\n                self, ['ID', 'name', 'ref', 'ucd', 'utype'])):\n            if self.description is not None:\n                w.element(\"DESCRIPTION\", self.description, wrap=True)\n            for entry in self.entries:\n                entry.to_xml(w, **kwargs)\n\n    def iter_fields_and_params(self):\n        \"\"\"\n        Recursively iterate over all :class:`Param` elements in this\n        :class:`Group`.\n        \"\"\"\n        for entry in self.entries:\n            if isinstance(entry, Param):\n                yield entry\n            elif isinstance(entry, Group):\n                for field in entry.iter_fields_and_params():\n                    yield field\n\n    def iter_groups(self):\n        \"\"\"\n        Recursively iterate over all sub-:class:`Group` instances in\n        this :class:`Group`.\n        \"\"\"\n        for entry in self.entries:\n            if isinstance(entry, Group):\n                yield entry\n                for group in entry.iter_groups():\n                    yield group\n\n\nclass Table(Element, _IDProperty, _NameProperty, _UcdProperty,\n            _DescriptionProperty):\n    \"\"\"\n    TABLE_ element: optionally contains data.\n\n    It contains the following publicly-accessible and mutable\n    attribute:\n\n        *array*: A Numpy masked array of the data itself, where each\n        row is a row of votable data, and columns are named and typed\n        based on the <FIELD> elements of the table.  The mask is\n        parallel to the data array, except for variable-length fields.\n        For those fields, the numpy array's column type is \"object\"\n        (``\"O\"``), and another masked array is stored there.\n\n    If the Table contains no data, (for example, its enclosing\n    :class:`Resource` has :attr:`~Resource.type` == 'meta') *array*\n    will have zero-length.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    \"\"\"\n\n    def __init__(self, votable, ID=None, name=None, ref=None, ucd=None,\n                 utype=None, nrows=None, id=None, config=None, pos=None,\n                 **extra):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n        self._empty = False\n\n        Element.__init__(self)\n        self._votable = votable\n\n        self.ID = (resolve_id(ID, id, config, pos)\n                   or xmlutil.fix_id(name, config, pos))\n        self.name = name\n        xmlutil.check_id(ref, 'ref', config, pos)\n        self._ref = ref\n        self.ucd = ucd\n        self.utype = utype\n        if nrows is not None:\n            nrows = int(nrows)\n            if nrows < 0:\n                raise ValueError(\"'nrows' cannot be negative.\")\n        self._nrows = nrows\n        self.description = None\n        self.format = 'tabledata'\n\n        self._fields = HomogeneousList(Field)\n        self._params = HomogeneousList(Param)\n        self._groups = HomogeneousList(Group)\n        self._links = HomogeneousList(Link)\n        self._infos = HomogeneousList(Info)\n\n        self.array = ma.array([])\n\n        warn_unknown_attrs('TABLE', extra.keys(), config, pos)\n\n    def __repr__(self):\n        return repr(self.to_table())\n\n    def __bytes__(self):\n        return bytes(self.to_table())\n\n    def __str__(self):\n        return str(self.to_table())\n\n    @property\n    def ref(self):\n        return self._ref\n\n    @ref.setter\n    def ref(self, ref):\n        \"\"\"\n        Refer to another TABLE, previously defined, by the *ref* ID_\n        for all metadata (FIELD_, PARAM_ etc.) information.\n        \"\"\"\n        # When the ref changes, we want to verify that it will work\n        # by actually going and looking for the referenced table.\n        # If found, set a bunch of properties in this table based\n        # on the other one.\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        if ref is not None:\n            try:\n                table = self._votable.get_table_by_id(ref, before=self)\n            except KeyError:\n                warn_or_raise(\n                    W43, W43, ('TABLE', self.ref), self._config, self._pos)\n                ref = None\n            else:\n                self._fields = table.fields\n                self._params = table.params\n                self._groups = table.groups\n                self._links = table.links\n        else:\n            del self._fields[:]\n            del self._params[:]\n            del self._groups[:]\n            del self._links[:]\n        self._ref = ref\n\n    @ref.deleter\n    def ref(self):\n        self._ref = None\n\n    @property\n    def format(self):\n        \"\"\"\n        [*required*] The serialization format of the table.  Must be\n        one of:\n\n          'tabledata' (TABLEDATA_), 'binary' (BINARY_), 'binary2' (BINARY2_)\n          'fits' (FITS_).\n\n        Note that the 'fits' format, since it requires an external\n        file, can not be written out.  Any file read in with 'fits'\n        format will be read out, by default, in 'tabledata' format.\n\n        See :ref:`astropy:votable-serialization`.\n        \"\"\"\n        return self._format\n\n    @format.setter\n    def format(self, format):\n        format = format.lower()\n        if format == 'fits':\n            vo_raise(\"fits format can not be written out, only read.\",\n                     self._config, self._pos, NotImplementedError)\n        if format == 'binary2':\n            if not self._config['version_1_3_or_later']:\n                vo_raise(\n                    \"binary2 only supported in votable 1.3 or later\",\n                    self._config, self._pos)\n        elif format not in ('tabledata', 'binary'):\n            vo_raise(f\"Invalid format '{format}'\",\n                     self._config, self._pos)\n        self._format = format\n\n    @property\n    def nrows(self):\n        \"\"\"\n        [*immutable*] The number of rows in the table, as specified in\n        the XML file.\n        \"\"\"\n        return self._nrows\n\n    @property\n    def fields(self):\n        \"\"\"\n        A list of :class:`Field` objects describing the types of each\n        of the data columns.\n        \"\"\"\n        return self._fields\n\n    @property\n    def params(self):\n        \"\"\"\n        A list of parameters (constant-valued columns) for the\n        table.  Must contain only :class:`Param` objects.\n        \"\"\"\n        return self._params\n\n    @property\n    def groups(self):\n        \"\"\"\n        A list of :class:`Group` objects describing how the columns\n        and parameters are grouped.  Currently this information is\n        only kept around for round-tripping and informational\n        purposes.\n        \"\"\"\n        return self._groups\n\n    @property\n    def links(self):\n        \"\"\"\n        A list of :class:`Link` objects (pointers to other documents\n        or servers through a URI) for the table.\n        \"\"\"\n        return self._links\n\n    @property\n    def infos(self):\n        \"\"\"\n        A list of :class:`Info` objects for the table.  Allows for\n        post-operational diagnostics.\n        \"\"\"\n        return self._infos\n\n    def is_empty(self):\n        \"\"\"\n        Returns True if this table doesn't contain any real data\n        because it was skipped over by the parser (through use of the\n        ``table_number`` kwarg).\n        \"\"\"\n        return self._empty\n\n    def create_arrays(self, nrows=0, config=None):\n        \"\"\"\n        Create a new array to hold the data based on the current set\n        of fields, and store them in the *array* and member variable.\n        Any data in the existing array will be lost.\n\n        *nrows*, if provided, is the number of rows to allocate.\n        \"\"\"\n        if nrows is None:\n            nrows = 0\n\n        fields = self.fields\n\n        if len(fields) == 0:\n            array = np.recarray((nrows,), dtype='O')\n            mask = np.zeros((nrows,), dtype='b')\n        else:\n            # for field in fields: field._setup(config)\n            Field.uniqify_names(fields)\n\n            dtype = []\n            for x in fields:\n                if x._unique_name == x.ID:\n                    id = x.ID\n                else:\n                    id = (x._unique_name, x.ID)\n                dtype.append((id, x.converter.format))\n\n            array = np.recarray((nrows,), dtype=np.dtype(dtype))\n            descr_mask = []\n            for d in array.dtype.descr:\n                new_type = (d[1][1] == 'O' and 'O') or 'bool'\n                if len(d) == 2:\n                    descr_mask.append((d[0], new_type))\n                elif len(d) == 3:\n                    descr_mask.append((d[0], new_type, d[2]))\n            mask = np.zeros((nrows,), dtype=descr_mask)\n\n        self.array = ma.array(array, mask=mask)\n\n    def _resize_strategy(self, size):\n        \"\"\"\n        Return a new (larger) size based on size, used for\n        reallocating an array when it fills up.  This is in its own\n        function so the resizing strategy can be easily replaced.\n        \"\"\"\n        # Once we go beyond 0, make a big step -- after that use a\n        # factor of 1.5 to help keep memory usage compact\n        if size == 0:\n            return 512\n        return int(np.ceil(size * RESIZE_AMOUNT))\n\n    def _add_field(self, iterator, tag, data, config, pos):\n        field = Field(self._votable, config=config, pos=pos, **data)\n        self.fields.append(field)\n        field.parse(iterator, config)\n\n    def _add_param(self, iterator, tag, data, config, pos):\n        param = Param(self._votable, config=config, pos=pos, **data)\n        self.params.append(param)\n        param.parse(iterator, config)\n\n    def _add_group(self, iterator, tag, data, config, pos):\n        group = Group(self, config=config, pos=pos, **data)\n        self.groups.append(group)\n        group.parse(iterator, config)\n\n    def _add_link(self, iterator, tag, data, config, pos):\n        link = Link(config=config, pos=pos, **data)\n        self.links.append(link)\n        link.parse(iterator, config)\n\n    def _add_info(self, iterator, tag, data, config, pos):\n        if not config.get('version_1_2_or_later'):\n            warn_or_raise(W26, W26, ('INFO', 'TABLE', '1.2'), config, pos)\n        info = Info(config=config, pos=pos, **data)\n        self.infos.append(info)\n        info.parse(iterator, config)\n\n    def parse(self, iterator, config):\n        columns = config.get('columns')\n\n        # If we've requested to read in only a specific table, skip\n        # all others\n        table_number = config.get('table_number')\n        current_table_number = config.get('_current_table_number')\n        skip_table = False\n        if current_table_number is not None:\n            config['_current_table_number'] += 1\n            if (table_number is not None and\n                table_number != current_table_number):\n                skip_table = True\n                self._empty = True\n\n        table_id = config.get('table_id')\n        if table_id is not None:\n            if table_id != self.ID:\n                skip_table = True\n                self._empty = True\n\n        if self.ref is not None:\n            # This table doesn't have its own datatype descriptors, it\n            # just references those from another table.\n\n            # This is to call the property setter to go and get the\n            # referenced information\n            self.ref = self.ref\n\n            for start, tag, data, pos in iterator:\n                if start:\n                    if tag == 'DATA':\n                        warn_unknown_attrs(\n                            'DATA', data.keys(), config, pos)\n                        break\n                else:\n                    if tag == 'TABLE':\n                        return self\n                    elif tag == 'DESCRIPTION':\n                        if self.description is not None:\n                            warn_or_raise(W17, W17, 'RESOURCE', config, pos)\n                        self.description = data or None\n        else:\n            tag_mapping = {\n                'FIELD': self._add_field,\n                'PARAM': self._add_param,\n                'GROUP': self._add_group,\n                'LINK': self._add_link,\n                'INFO': self._add_info,\n                'DESCRIPTION': self._ignore_add}\n\n            for start, tag, data, pos in iterator:\n                if start:\n                    if tag == 'DATA':\n                        if len(self.fields) == 0:\n                            warn_or_raise(E25, E25, None, config, pos)\n                        warn_unknown_attrs(\n                            'DATA', data.keys(), config, pos)\n                        break\n\n                    tag_mapping.get(tag, self._add_unknown_tag)(\n                        iterator, tag, data, config, pos)\n                else:\n                    if tag == 'DESCRIPTION':\n                        if self.description is not None:\n                            warn_or_raise(W17, W17, 'RESOURCE', config, pos)\n                        self.description = data or None\n                    elif tag == 'TABLE':\n                        # For error checking purposes\n                        Field.uniqify_names(self.fields)\n                        # We still need to create arrays, even if the file\n                        # contains no DATA section\n                        self.create_arrays(nrows=0, config=config)\n                        return self\n\n        self.create_arrays(nrows=self._nrows, config=config)\n        fields = self.fields\n        names = [x.ID for x in fields]\n        # Deal with a subset of the columns, if requested.\n        if not columns:\n            colnumbers = list(range(len(fields)))\n        else:\n            if isinstance(columns, str):\n                columns = [columns]\n            columns = np.asarray(columns)\n            if issubclass(columns.dtype.type, np.integer):\n                if np.any(columns < 0) or np.any(columns > len(fields)):\n                    raise ValueError(\n                        \"Some specified column numbers out of range\")\n                colnumbers = columns\n            elif issubclass(columns.dtype.type, np.character):\n                try:\n                    colnumbers = [names.index(x) for x in columns]\n                except ValueError:\n                    raise ValueError(\n                        f\"Columns '{columns}' not found in fields list\")\n            else:\n                raise TypeError(\"Invalid columns list\")\n\n        if (not skip_table) and (len(fields) > 0):\n            for start, tag, data, pos in iterator:\n                if start:\n                    if tag == 'TABLEDATA':\n                        warn_unknown_attrs(\n                            'TABLEDATA', data.keys(), config, pos)\n                        self.array = self._parse_tabledata(\n                            iterator, colnumbers, fields, config)\n                        break\n                    elif tag == 'BINARY':\n                        warn_unknown_attrs(\n                            'BINARY', data.keys(), config, pos)\n                        self.array = self._parse_binary(\n                            1, iterator, colnumbers, fields, config, pos)\n                        break\n                    elif tag == 'BINARY2':\n                        if not config['version_1_3_or_later']:\n                            warn_or_raise(\n                                W52, W52, config['version'], config, pos)\n                        self.array = self._parse_binary(\n                            2, iterator, colnumbers, fields, config, pos)\n                        break\n                    elif tag == 'FITS':\n                        warn_unknown_attrs(\n                            'FITS', data.keys(), config, pos, ['extnum'])\n                        try:\n                            extnum = int(data.get('extnum', 0))\n                            if extnum < 0:\n                                raise ValueError(\"'extnum' cannot be negative.\")\n                        except ValueError:\n                            vo_raise(E17, (), config, pos)\n                        self.array = self._parse_fits(\n                            iterator, extnum, config)\n                        break\n                    else:\n                        warn_or_raise(W37, W37, tag, config, pos)\n                        break\n\n        for start, tag, data, pos in iterator:\n            if not start and tag == 'DATA':\n                break\n\n        for start, tag, data, pos in iterator:\n            if start and tag == 'INFO':\n                if not config.get('version_1_2_or_later'):\n                    warn_or_raise(\n                        W26, W26, ('INFO', 'TABLE', '1.2'), config, pos)\n                info = Info(config=config, pos=pos, **data)\n                self.infos.append(info)\n                info.parse(iterator, config)\n            elif not start and tag == 'TABLE':\n                break\n\n        return self\n\n    def _parse_tabledata(self, iterator, colnumbers, fields, config):\n        # Since we don't know the number of rows up front, we'll\n        # reallocate the record array to make room as we go.  This\n        # prevents the need to scan through the XML twice.  The\n        # allocation is by factors of 1.5.\n        invalid = config.get('invalid', 'exception')\n\n        # Need to have only one reference so that we can resize the\n        # array\n        array = self.array\n        del self.array\n\n        parsers = [field.converter.parse for field in fields]\n        binparsers = [field.converter.binparse for field in fields]\n\n        numrows = 0\n        alloc_rows = len(array)\n        colnumbers_bits = [i in colnumbers for i in range(len(fields))]\n        row_default = [x.converter.default for x in fields]\n        mask_default = [True] * len(fields)\n        array_chunk = []\n        mask_chunk = []\n        chunk_size = config.get('chunk_size', DEFAULT_CHUNK_SIZE)\n        for start, tag, data, pos in iterator:\n            if tag == 'TR':\n                # Now parse one row\n                row = row_default[:]\n                row_mask = mask_default[:]\n                i = 0\n                for start, tag, data, pos in iterator:\n                    if start:\n                        binary = (data.get('encoding', None) == 'base64')\n                        warn_unknown_attrs(\n                            tag, data.keys(), config, pos, ['encoding'])\n                    else:\n                        if tag == 'TD':\n                            if i >= len(fields):\n                                vo_raise(E20, len(fields), config, pos)\n\n                            if colnumbers_bits[i]:\n                                try:\n                                    if binary:\n                                        rawdata = base64.b64decode(\n                                            data.encode('ascii'))\n                                        buf = io.BytesIO(rawdata)\n                                        buf.seek(0)\n                                        try:\n                                            value, mask_value = binparsers[i](\n                                                buf.read)\n                                        except Exception as e:\n                                            vo_reraise(\n                                                e, config, pos,\n                                                \"(in row {:d}, col '{}')\".format(\n                                                    len(array_chunk),\n                                                    fields[i].ID))\n                                    else:\n                                        try:\n                                            value, mask_value = parsers[i](\n                                                data, config, pos)\n                                        except Exception as e:\n                                            vo_reraise(\n                                                e, config, pos,\n                                                \"(in row {:d}, col '{}')\".format(\n                                                    len(array_chunk),\n                                                    fields[i].ID))\n                                except Exception as e:\n                                    if invalid == 'exception':\n                                        vo_reraise(e, config, pos)\n                                else:\n                                    row[i] = value\n                                    row_mask[i] = mask_value\n                        elif tag == 'TR':\n                            break\n                        else:\n                            self._add_unknown_tag(\n                                iterator, tag, data, config, pos)\n                        i += 1\n\n                if i < len(fields):\n                    vo_raise(E21, (i, len(fields)), config, pos)\n\n                array_chunk.append(tuple(row))\n                mask_chunk.append(tuple(row_mask))\n\n                if len(array_chunk) == chunk_size:\n                    while numrows + chunk_size > alloc_rows:\n                        alloc_rows = self._resize_strategy(alloc_rows)\n                    if alloc_rows != len(array):\n                        array = _resize(array, alloc_rows)\n                    array[numrows:numrows + chunk_size] = array_chunk\n                    array.mask[numrows:numrows + chunk_size] = mask_chunk\n                    numrows += chunk_size\n                    array_chunk = []\n                    mask_chunk = []\n\n            elif not start and tag == 'TABLEDATA':\n                break\n\n        # Now, resize the array to the exact number of rows we need and\n        # put the last chunk values in there.\n        alloc_rows = numrows + len(array_chunk)\n\n        array = _resize(array, alloc_rows)\n        array[numrows:] = array_chunk\n        if alloc_rows != 0:\n            array.mask[numrows:] = mask_chunk\n        numrows += len(array_chunk)\n\n        if (self.nrows is not None and\n            self.nrows >= 0 and\n            self.nrows != numrows):\n            warn_or_raise(W18, W18, (self.nrows, numrows), config, pos)\n        self._nrows = numrows\n\n        return array\n\n    def _get_binary_data_stream(self, iterator, config):\n        have_local_stream = False\n        for start, tag, data, pos in iterator:\n            if tag == 'STREAM':\n                if start:\n                    warn_unknown_attrs(\n                        'STREAM', data.keys(), config, pos,\n                        ['type', 'href', 'actuate', 'encoding', 'expires',\n                         'rights'])\n                    if 'href' not in data:\n                        have_local_stream = True\n                        if data.get('encoding', None) != 'base64':\n                            warn_or_raise(\n                                W38, W38, data.get('encoding', None),\n                                config, pos)\n                    else:\n                        href = data['href']\n                        xmlutil.check_anyuri(href, config, pos)\n                        encoding = data.get('encoding', None)\n                else:\n                    buffer = data\n                    break\n\n        if have_local_stream:\n            buffer = base64.b64decode(buffer.encode('ascii'))\n            string_io = io.BytesIO(buffer)\n            string_io.seek(0)\n            read = string_io.read\n        else:\n            if not href.startswith(('http', 'ftp', 'file')):\n                vo_raise(\n                    \"The vo package only supports remote data through http, \" +\n                    \"ftp or file\",\n                    self._config, self._pos, NotImplementedError)\n            fd = urllib.request.urlopen(href)\n            if encoding is not None:\n                if encoding == 'gzip':\n                    fd = gzip.GzipFile(href, 'rb', fileobj=fd)\n                elif encoding == 'base64':\n                    fd = codecs.EncodedFile(fd, 'base64')\n                else:\n                    vo_raise(\n                        f\"Unknown encoding type '{encoding}'\",\n                        self._config, self._pos, NotImplementedError)\n            read = fd.read\n\n        def careful_read(length):\n            result = read(length)\n            if len(result) != length:\n                raise EOFError\n            return result\n\n        return careful_read\n\n    def _parse_binary(self, mode, iterator, colnumbers, fields, config, pos):\n        fields = self.fields\n\n        careful_read = self._get_binary_data_stream(iterator, config)\n\n        # Need to have only one reference so that we can resize the\n        # array\n        array = self.array\n        del self.array\n\n        binparsers = [field.converter.binparse for field in fields]\n\n        numrows = 0\n        alloc_rows = len(array)\n        while True:\n            # Resize result arrays if necessary\n            if numrows >= alloc_rows:\n                alloc_rows = self._resize_strategy(alloc_rows)\n                array = _resize(array, alloc_rows)\n\n            row_data = []\n            row_mask_data = []\n\n            try:\n                if mode == 2:\n                    mask_bits = careful_read(int((len(fields) + 7) / 8))\n                    row_mask_data = list(converters.bitarray_to_bool(\n                        mask_bits, len(fields)))\n\n                    # Ignore the mask for string columns (see issue 8995)\n                    for i, f in enumerate(fields):\n                        if row_mask_data[i] and (f.datatype == 'char' or f.datatype == 'unicodeChar'):\n                            row_mask_data[i] = False\n\n                for i, binparse in enumerate(binparsers):\n                    try:\n                        value, value_mask = binparse(careful_read)\n                    except EOFError:\n                        raise\n                    except Exception as e:\n                        vo_reraise(\n                            e, config, pos, \"(in row {:d}, col '{}')\".format(\n                                numrows, fields[i].ID))\n                    row_data.append(value)\n                    if mode == 1:\n                        row_mask_data.append(value_mask)\n                    else:\n                        row_mask_data[i] = row_mask_data[i] or value_mask\n            except EOFError:\n                break\n\n            row = [x.converter.default for x in fields]\n            row_mask = [False] * len(fields)\n            for i in colnumbers:\n                row[i] = row_data[i]\n                row_mask[i] = row_mask_data[i]\n\n            array[numrows] = tuple(row)\n            array.mask[numrows] = tuple(row_mask)\n            numrows += 1\n\n        array = _resize(array, numrows)\n\n        return array\n\n    def _parse_fits(self, iterator, extnum, config):\n        for start, tag, data, pos in iterator:\n            if tag == 'STREAM':\n                if start:\n                    warn_unknown_attrs(\n                        'STREAM', data.keys(), config, pos,\n                        ['type', 'href', 'actuate', 'encoding', 'expires',\n                         'rights'])\n                    href = data['href']\n                    encoding = data.get('encoding', None)\n                else:\n                    break\n\n        if not href.startswith(('http', 'ftp', 'file')):\n            vo_raise(\n                \"The vo package only supports remote data through http, \"\n                \"ftp or file\",\n                self._config, self._pos, NotImplementedError)\n\n        fd = urllib.request.urlopen(href)\n        if encoding is not None:\n            if encoding == 'gzip':\n                fd = gzip.GzipFile(href, 'r', fileobj=fd)\n            elif encoding == 'base64':\n                fd = codecs.EncodedFile(fd, 'base64')\n            else:\n                vo_raise(\n                    f\"Unknown encoding type '{encoding}'\",\n                    self._config, self._pos, NotImplementedError)\n\n        hdulist = fits.open(fd)\n\n        array = hdulist[int(extnum)].data\n        if array.dtype != self.array.dtype:\n            warn_or_raise(W19, W19, (), self._config, self._pos)\n\n        return array\n\n    def to_xml(self, w, **kwargs):\n        specified_format = kwargs.get('tabledata_format')\n        if specified_format is not None:\n            format = specified_format\n        else:\n            format = self.format\n        if format == 'fits':\n            format = 'tabledata'\n\n        with w.tag(\n            'TABLE',\n            attrib=w.object_attrs(\n                self,\n                ('ID', 'name', 'ref', 'ucd', 'utype', 'nrows'))):\n\n            if self.description is not None:\n                w.element(\"DESCRIPTION\", self.description, wrap=True)\n\n            for element_set in (self.fields, self.params):\n                for element in element_set:\n                    element._setup({}, None)\n\n            if self.ref is None:\n                for element_set in (self.fields, self.params, self.groups,\n                                    self.links):\n                    for element in element_set:\n                        element.to_xml(w, **kwargs)\n            elif kwargs['version_1_2_or_later']:\n                index = list(self._votable.iter_tables()).index(self)\n                group = Group(self, ID=f\"_g{index}\")\n                group.to_xml(w, **kwargs)\n\n            if len(self.array):\n                with w.tag('DATA'):\n                    if format == 'tabledata':\n                        self._write_tabledata(w, **kwargs)\n                    elif format == 'binary':\n                        self._write_binary(1, w, **kwargs)\n                    elif format == 'binary2':\n                        self._write_binary(2, w, **kwargs)\n\n            if kwargs['version_1_2_or_later']:\n                for element in self._infos:\n                    element.to_xml(w, **kwargs)\n\n    def _write_tabledata(self, w, **kwargs):\n        fields = self.fields\n        array = self.array\n\n        with w.tag('TABLEDATA'):\n            w._flush()\n            if (_has_c_tabledata_writer and\n                not kwargs.get('_debug_python_based_parser')):\n                supports_empty_values = [\n                    field.converter.supports_empty_values(kwargs)\n                    for field in fields]\n                fields = [field.converter.output for field in fields]\n                indent = len(w._tags) - 1\n                tablewriter.write_tabledata(\n                    w.write, array.data, array.mask, fields,\n                    supports_empty_values, indent, 1 << 8)\n            else:\n                write = w.write\n                indent_spaces = w.get_indentation_spaces()\n                tr_start = indent_spaces + \"<TR>\\n\"\n                tr_end = indent_spaces + \"</TR>\\n\"\n                td = indent_spaces + \" <TD>{}</TD>\\n\"\n                td_empty = indent_spaces + \" <TD/>\\n\"\n                fields = [(i, field.converter.output,\n                           field.converter.supports_empty_values(kwargs))\n                          for i, field in enumerate(fields)]\n                for row in range(len(array)):\n                    write(tr_start)\n                    array_row = array.data[row]\n                    mask_row = array.mask[row]\n                    for i, output, supports_empty_values in fields:\n                        data = array_row[i]\n                        masked = mask_row[i]\n                        if supports_empty_values and np.all(masked):\n                            write(td_empty)\n                        else:\n                            try:\n                                val = output(data, masked)\n                            except Exception as e:\n                                vo_reraise(\n                                    e,\n                                    additional=\"(in row {:d}, col '{}')\".format(\n                                        row, self.fields[i].ID))\n                            if len(val):\n                                write(td.format(val))\n                            else:\n                                write(td_empty)\n                    write(tr_end)\n\n    def _write_binary(self, mode, w, **kwargs):\n        fields = self.fields\n        array = self.array\n        if mode == 1:\n            tag_name = 'BINARY'\n        else:\n            tag_name = 'BINARY2'\n\n        with w.tag(tag_name):\n            with w.tag('STREAM', encoding='base64'):\n                fields_basic = [(i, field.converter.binoutput)\n                                for (i, field) in enumerate(fields)]\n\n                data = io.BytesIO()\n                for row in range(len(array)):\n                    array_row = array.data[row]\n                    array_mask = array.mask[row]\n\n                    if mode == 2:\n                        flattened = np.array([np.all(x) for x in array_mask])\n                        data.write(converters.bool_to_bitarray(flattened))\n\n                    for i, converter in fields_basic:\n                        try:\n                            chunk = converter(array_row[i], array_mask[i])\n                            assert type(chunk) == bytes\n                        except Exception as e:\n                            vo_reraise(\n                                e, additional=f\"(in row {row:d}, col '{fields[i].ID}')\")\n                        data.write(chunk)\n\n                w._flush()\n                w.write(base64.b64encode(data.getvalue()).decode('ascii'))\n\n    def to_table(self, use_names_over_ids=False):\n        \"\"\"\n        Convert this VO Table to an `astropy.table.Table` instance.\n\n        Parameters\n        ----------\n        use_names_over_ids : bool, optional\n           When `True` use the ``name`` attributes of columns as the\n           names of columns in the `astropy.table.Table` instance.\n           Since names are not guaranteed to be unique, this may cause\n           some columns to be renamed by appending numbers to the end.\n           Otherwise (default), use the ID attributes as the column\n           names.\n\n        .. warning::\n           Variable-length array fields may not be restored\n           identically when round-tripping through the\n           `astropy.table.Table` instance.\n        \"\"\"\n        from astropy.table import Table\n\n        meta = {}\n        for key in ['ID', 'name', 'ref', 'ucd', 'utype', 'description']:\n            val = getattr(self, key, None)\n            if val is not None:\n                meta[key] = val\n\n        if use_names_over_ids:\n            names = [field.name for field in self.fields]\n            unique_names = []\n            for i, name in enumerate(names):\n                new_name = name\n                i = 2\n                while new_name in unique_names:\n                    new_name = f'{name}{i}'\n                    i += 1\n                unique_names.append(new_name)\n            names = unique_names\n        else:\n            names = [field.ID for field in self.fields]\n\n        table = Table(self.array, names=names, meta=meta)\n\n        for name, field in zip(names, self.fields):\n            column = table[name]\n            field.to_table_column(column)\n\n        return table\n\n    @classmethod\n    def from_table(cls, votable, table):\n        \"\"\"\n        Create a `Table` instance from a given `astropy.table.Table`\n        instance.\n        \"\"\"\n        kwargs = {}\n        for key in ['ID', 'name', 'ref', 'ucd', 'utype']:\n            val = table.meta.get(key)\n            if val is not None:\n                kwargs[key] = val\n        new_table = cls(votable, **kwargs)\n        if 'description' in table.meta:\n            new_table.description = table.meta['description']\n\n        for colname in table.colnames:\n            column = table[colname]\n            new_table.fields.append(Field.from_table_column(votable, column))\n\n        if table.mask is None:\n            new_table.array = ma.array(np.asarray(table))\n        else:\n            new_table.array = ma.array(np.asarray(table),\n                                       mask=np.asarray(table.mask))\n\n        return new_table\n\n    def iter_fields_and_params(self):\n        \"\"\"\n        Recursively iterate over all FIELD and PARAM elements in the\n        TABLE.\n        \"\"\"\n        for param in self.params:\n            yield param\n        for field in self.fields:\n            yield field\n        for group in self.groups:\n            for field in group.iter_fields_and_params():\n                yield field\n\n    get_field_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_fields_and_params', 'FIELD or PARAM',\n        \"\"\"\n        Looks up a FIELD or PARAM element by the given ID.\n        \"\"\")\n\n    get_field_by_id_or_name = _lookup_by_id_or_name_factory(\n        'iter_fields_and_params', 'FIELD or PARAM',\n        \"\"\"\n        Looks up a FIELD or PARAM element by the given ID or name.\n        \"\"\")\n\n    get_fields_by_utype = _lookup_by_attr_factory(\n        'utype', False, 'iter_fields_and_params', 'FIELD or PARAM',\n        \"\"\"\n        Looks up a FIELD or PARAM element by the given utype and\n        returns an iterator emitting all matches.\n        \"\"\")\n\n    def iter_groups(self):\n        \"\"\"\n        Recursively iterate over all GROUP elements in the TABLE.\n        \"\"\"\n        for group in self.groups:\n            yield group\n            for g in group.iter_groups():\n                yield g\n\n    get_group_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_groups', 'GROUP',\n        \"\"\"\n        Looks up a GROUP element by the given ID.  Used by the group's\n        \"ref\" attribute\n        \"\"\")\n\n    get_groups_by_utype = _lookup_by_attr_factory(\n        'utype', False, 'iter_groups', 'GROUP',\n        \"\"\"\n        Looks up a GROUP element by the given utype and returns an\n        iterator emitting all matches.\n        \"\"\")\n\n    def iter_info(self):\n        for info in self.infos:\n            yield info\n\n\nclass Resource(Element, _IDProperty, _NameProperty, _UtypeProperty,\n               _DescriptionProperty):\n    \"\"\"\n    RESOURCE_ element: Groups TABLE_ and RESOURCE_ elements.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    \"\"\"\n\n    def __init__(self, name=None, ID=None, utype=None, type='results',\n                 id=None, config=None, pos=None, **kwargs):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        Element.__init__(self)\n        self.name = name\n        self.ID = resolve_id(ID, id, config, pos)\n        self.utype = utype\n        self.type = type\n        self._extra_attributes = kwargs\n        self.description = None\n\n        self._coordinate_systems = HomogeneousList(CooSys)\n        self._time_systems = HomogeneousList(TimeSys)\n        self._groups = HomogeneousList(Group)\n        self._params = HomogeneousList(Param)\n        self._infos = HomogeneousList(Info)\n        self._links = HomogeneousList(Link)\n        self._tables = HomogeneousList(Table)\n        self._resources = HomogeneousList(Resource)\n\n        warn_unknown_attrs('RESOURCE', kwargs.keys(), config, pos)\n\n    def __repr__(self):\n        buff = io.StringIO()\n        w = XMLWriter(buff)\n        w.element(\n            self._element_name,\n            attrib=w.object_attrs(self, self._attr_list))\n        return buff.getvalue().strip()\n\n    @property\n    def type(self):\n        \"\"\"\n        [*required*] The type of the resource.  Must be either:\n\n          - 'results': This resource contains actual result values\n            (default)\n\n          - 'meta': This resource contains only datatype descriptions\n            (FIELD_ elements), but no actual data.\n        \"\"\"\n        return self._type\n\n    @type.setter\n    def type(self, type):\n        if type not in ('results', 'meta'):\n            vo_raise(E18, type, self._config, self._pos)\n        self._type = type\n\n    @property\n    def extra_attributes(self):\n        \"\"\"\n        A dictionary of string keys to string values containing any\n        extra attributes of the RESOURCE_ element that are not defined\n        in the specification.  (The specification explicitly allows\n        for extra attributes here, but nowhere else.)\n        \"\"\"\n        return self._extra_attributes\n\n    @property\n    def coordinate_systems(self):\n        \"\"\"\n        A list of coordinate system definitions (COOSYS_ elements) for\n        the RESOURCE_.  Must contain only `CooSys` objects.\n        \"\"\"\n        return self._coordinate_systems\n\n    @property\n    def time_systems(self):\n        \"\"\"\n        A list of time system definitions (TIMESYS_ elements) for\n        the RESOURCE_.  Must contain only `TimeSys` objects.\n        \"\"\"\n        return self._time_systems\n\n    @property\n    def infos(self):\n        \"\"\"\n        A list of informational parameters (key-value pairs) for the\n        resource.  Must only contain `Info` objects.\n        \"\"\"\n        return self._infos\n\n    @property\n    def groups(self):\n        \"\"\"\n        A list of groups\n        \"\"\"\n        return self._groups\n\n    @property\n    def params(self):\n        \"\"\"\n        A list of parameters (constant-valued columns) for the\n        resource.  Must contain only `Param` objects.\n        \"\"\"\n        return self._params\n\n    @property\n    def links(self):\n        \"\"\"\n        A list of links (pointers to other documents or servers\n        through a URI) for the resource.  Must contain only `Link`\n        objects.\n        \"\"\"\n        return self._links\n\n    @property\n    def tables(self):\n        \"\"\"\n        A list of tables in the resource.  Must contain only\n        `Table` objects.\n        \"\"\"\n        return self._tables\n\n    @property\n    def resources(self):\n        \"\"\"\n        A list of nested resources inside this resource.  Must contain\n        only `Resource` objects.\n        \"\"\"\n        return self._resources\n\n    def _add_table(self, iterator, tag, data, config, pos):\n        table = Table(self._votable, config=config, pos=pos, **data)\n        self.tables.append(table)\n        table.parse(iterator, config)\n\n    def _add_info(self, iterator, tag, data, config, pos):\n        info = Info(config=config, pos=pos, **data)\n        self.infos.append(info)\n        info.parse(iterator, config)\n\n    def _add_group(self, iterator, tag, data, config, pos):\n        group = Group(self, config=config, pos=pos, **data)\n        self.groups.append(group)\n        group.parse(iterator, config)\n\n    def _add_param(self, iterator, tag, data, config, pos):\n        param = Param(self._votable, config=config, pos=pos, **data)\n        self.params.append(param)\n        param.parse(iterator, config)\n\n    def _add_coosys(self, iterator, tag, data, config, pos):\n        coosys = CooSys(config=config, pos=pos, **data)\n        self.coordinate_systems.append(coosys)\n        coosys.parse(iterator, config)\n\n    def _add_timesys(self, iterator, tag, data, config, pos):\n        timesys = TimeSys(config=config, pos=pos, **data)\n        self.time_systems.append(timesys)\n        timesys.parse(iterator, config)\n\n    def _add_resource(self, iterator, tag, data, config, pos):\n        resource = Resource(config=config, pos=pos, **data)\n        self.resources.append(resource)\n        resource.parse(self._votable, iterator, config)\n\n    def _add_link(self, iterator, tag, data, config, pos):\n        link = Link(config=config, pos=pos, **data)\n        self.links.append(link)\n        link.parse(iterator, config)\n\n    def parse(self, votable, iterator, config):\n        self._votable = votable\n\n        tag_mapping = {\n            'TABLE': self._add_table,\n            'INFO': self._add_info,\n            'PARAM': self._add_param,\n            'GROUP': self._add_group,\n            'COOSYS': self._add_coosys,\n            'TIMESYS': self._add_timesys,\n            'RESOURCE': self._add_resource,\n            'LINK': self._add_link,\n            'DESCRIPTION': self._ignore_add\n            }\n\n        for start, tag, data, pos in iterator:\n            if start:\n                tag_mapping.get(tag, self._add_unknown_tag)(\n                    iterator, tag, data, config, pos)\n            elif tag == 'DESCRIPTION':\n                if self.description is not None:\n                    warn_or_raise(W17, W17, 'RESOURCE', config, pos)\n                self.description = data or None\n            elif tag == 'RESOURCE':\n                break\n\n        del self._votable\n\n        return self\n\n    def to_xml(self, w, **kwargs):\n        attrs = w.object_attrs(self, ('ID', 'type', 'utype'))\n        attrs.update(self.extra_attributes)\n        with w.tag('RESOURCE', attrib=attrs):\n            if self.description is not None:\n                w.element(\"DESCRIPTION\", self.description, wrap=True)\n            for element_set in (self.coordinate_systems, self.time_systems,\n                                self.params, self.infos, self.links,\n                                self.tables, self.resources):\n                for element in element_set:\n                    element.to_xml(w, **kwargs)\n\n    def iter_tables(self):\n        \"\"\"\n        Recursively iterates over all tables in the resource and\n        nested resources.\n        \"\"\"\n        for table in self.tables:\n            yield table\n        for resource in self.resources:\n            for table in resource.iter_tables():\n                yield table\n\n    def iter_fields_and_params(self):\n        \"\"\"\n        Recursively iterates over all FIELD_ and PARAM_ elements in\n        the resource, its tables and nested resources.\n        \"\"\"\n        for param in self.params:\n            yield param\n        for table in self.tables:\n            for param in table.iter_fields_and_params():\n                yield param\n        for resource in self.resources:\n            for param in resource.iter_fields_and_params():\n                yield param\n\n    def iter_coosys(self):\n        \"\"\"\n        Recursively iterates over all the COOSYS_ elements in the\n        resource and nested resources.\n        \"\"\"\n        for coosys in self.coordinate_systems:\n            yield coosys\n        for resource in self.resources:\n            for coosys in resource.iter_coosys():\n                yield coosys\n\n    def iter_timesys(self):\n        \"\"\"\n        Recursively iterates over all the TIMESYS_ elements in the\n        resource and nested resources.\n        \"\"\"\n        for timesys in self.time_systems:\n            yield timesys\n        for resource in self.resources:\n            for timesys in resource.iter_timesys():\n                yield timesys\n\n    def iter_info(self):\n        \"\"\"\n        Recursively iterates over all the INFO_ elements in the\n        resource and nested resources.\n        \"\"\"\n        for info in self.infos:\n            yield info\n        for table in self.tables:\n            for info in table.iter_info():\n                yield info\n        for resource in self.resources:\n            for info in resource.iter_info():\n                yield info\n\n\nclass VOTableFile(Element, _IDProperty, _DescriptionProperty):\n    \"\"\"\n    VOTABLE_ element: represents an entire file.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n\n    *version* is settable at construction time only, since conformance\n    tests for building the rest of the structure depend on it.\n    \"\"\"\n\n    def __init__(self, ID=None, id=None, config=None, pos=None, version=\"1.4\"):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        Element.__init__(self)\n        self.ID = resolve_id(ID, id, config, pos)\n        self.description = None\n\n        self._coordinate_systems = HomogeneousList(CooSys)\n        self._time_systems = HomogeneousList(TimeSys)\n        self._params = HomogeneousList(Param)\n        self._infos = HomogeneousList(Info)\n        self._resources = HomogeneousList(Resource)\n        self._groups = HomogeneousList(Group)\n\n        version = str(version)\n        if version == '1.0':\n            warnings.warn('VOTable 1.0 support is deprecated in astropy 4.3 and will be '\n                          'removed in a future release', AstropyDeprecationWarning)\n        elif (version != '1.0') and (version not in self._version_namespace_map):\n            allowed_from_map = \"', '\".join(self._version_namespace_map)\n            raise ValueError(f\"'version' should be in ('1.0', '{allowed_from_map}').\")\n\n        self._version = version\n\n    def __repr__(self):\n        n_tables = len(list(self.iter_tables()))\n        return f'<VOTABLE>... {n_tables} tables ...</VOTABLE>'\n\n    @property\n    def version(self):\n        \"\"\"\n        The version of the VOTable specification that the file uses.\n        \"\"\"\n        return self._version\n\n    @version.setter\n    def version(self, version):\n        version = str(version)\n        if version not in self._version_namespace_map:\n            allowed_from_map = \"', '\".join(self._version_namespace_map)\n            raise ValueError(\n                f\"astropy.io.votable only supports VOTable versions '{allowed_from_map}'\")\n        self._version = version\n\n    @property\n    def coordinate_systems(self):\n        \"\"\"\n        A list of coordinate system descriptions for the file.  Must\n        contain only `CooSys` objects.\n        \"\"\"\n        return self._coordinate_systems\n\n    @property\n    def time_systems(self):\n        \"\"\"\n        A list of time system descriptions for the file.  Must\n        contain only `TimeSys` objects.\n        \"\"\"\n        return self._time_systems\n\n    @property\n    def params(self):\n        \"\"\"\n        A list of parameters (constant-valued columns) that apply to\n        the entire file.  Must contain only `Param` objects.\n        \"\"\"\n        return self._params\n\n    @property\n    def infos(self):\n        \"\"\"\n        A list of informational parameters (key-value pairs) for the\n        entire file.  Must only contain `Info` objects.\n        \"\"\"\n        return self._infos\n\n    @property\n    def resources(self):\n        \"\"\"\n        A list of resources, in the order they appear in the file.\n        Must only contain `Resource` objects.\n        \"\"\"\n        return self._resources\n\n    @property\n    def groups(self):\n        \"\"\"\n        A list of groups, in the order they appear in the file.  Only\n        supported as a child of the VOTABLE element in VOTable 1.2 or\n        later.\n        \"\"\"\n        return self._groups\n\n    def _add_param(self, iterator, tag, data, config, pos):\n        param = Param(self, config=config, pos=pos, **data)\n        self.params.append(param)\n        param.parse(iterator, config)\n\n    def _add_resource(self, iterator, tag, data, config, pos):\n        resource = Resource(config=config, pos=pos, **data)\n        self.resources.append(resource)\n        resource.parse(self, iterator, config)\n\n    def _add_coosys(self, iterator, tag, data, config, pos):\n        coosys = CooSys(config=config, pos=pos, **data)\n        self.coordinate_systems.append(coosys)\n        coosys.parse(iterator, config)\n\n    def _add_timesys(self, iterator, tag, data, config, pos):\n        timesys = TimeSys(config=config, pos=pos, **data)\n        self.time_systems.append(timesys)\n        timesys.parse(iterator, config)\n\n    def _add_info(self, iterator, tag, data, config, pos):\n        info = Info(config=config, pos=pos, **data)\n        self.infos.append(info)\n        info.parse(iterator, config)\n\n    def _add_group(self, iterator, tag, data, config, pos):\n        if not config.get('version_1_2_or_later'):\n            warn_or_raise(W26, W26, ('GROUP', 'VOTABLE', '1.2'), config, pos)\n        group = Group(self, config=config, pos=pos, **data)\n        self.groups.append(group)\n        group.parse(iterator, config)\n\n    def _get_version_checks(self):\n        config = {}\n        config['version_1_1_or_later'] = \\\n            util.version_compare(self.version, '1.1') >= 0\n        config['version_1_2_or_later'] = \\\n            util.version_compare(self.version, '1.2') >= 0\n        config['version_1_3_or_later'] = \\\n            util.version_compare(self.version, '1.3') >= 0\n        config['version_1_4_or_later'] = \\\n            util.version_compare(self.version, '1.4') >= 0\n        return config\n\n    # Map VOTable version numbers to namespace URIs and schema information.\n    _version_namespace_map = {\n        # Version 1.0 isn't well-supported, but is allowed on parse (with a warning).\n        # It used DTD rather than schema, so this information would not be useful.\n        # By omitting 1.0 from this dict we can use the keys as the list of versions\n        # that are allowed in various other checks.\n        \"1.1\": {\n            \"namespace_uri\": \"http://www.ivoa.net/xml/VOTable/v1.1\",\n            \"schema_location_attr\": \"xsi:noNamespaceSchemaLocation\",\n            \"schema_location_value\": \"http://www.ivoa.net/xml/VOTable/v1.1\"\n        },\n        \"1.2\": {\n            \"namespace_uri\": \"http://www.ivoa.net/xml/VOTable/v1.2\",\n            \"schema_location_attr\": \"xsi:noNamespaceSchemaLocation\",\n            \"schema_location_value\": \"http://www.ivoa.net/xml/VOTable/v1.2\"\n        },\n        # With 1.3 we'll be more explicit with the schema location.\n        # - xsi:schemaLocation uses the namespace name along with the URL\n        #   to reference it.\n        # - For convenience, but somewhat confusingly, the namespace URIs\n        #   are also usable URLs for accessing an applicable schema.\n        #   However to avoid confusion, we'll use the explicit schema URL.\n        \"1.3\": {\n            \"namespace_uri\": \"http://www.ivoa.net/xml/VOTable/v1.3\",\n            \"schema_location_attr\": \"xsi:schemaLocation\",\n            \"schema_location_value\":\n            \"http://www.ivoa.net/xml/VOTable/v1.3 http://www.ivoa.net/xml/VOTable/VOTable-1.3.xsd\"\n        },\n        # With 1.4 namespace URIs stopped incrementing with minor version changes\n        # so we use the same URI as with 1.3.  See this IVOA note for more info:\n        # http://www.ivoa.net/documents/Notes/XMLVers/20180529/\n        \"1.4\": {\n            \"namespace_uri\": \"http://www.ivoa.net/xml/VOTable/v1.3\",\n            \"schema_location_attr\": \"xsi:schemaLocation\",\n            \"schema_location_value\":\n            \"http://www.ivoa.net/xml/VOTable/v1.3 http://www.ivoa.net/xml/VOTable/VOTable-1.4.xsd\"\n        }\n    }\n\n    def parse(self, iterator, config):\n        config['_current_table_number'] = 0\n\n        for start, tag, data, pos in iterator:\n            if start:\n                if tag == 'xml':\n                    pass\n                elif tag == 'VOTABLE':\n                    if 'version' not in data:\n                        warn_or_raise(W20, W20, self.version, config, pos)\n                        config['version'] = self.version\n                    else:\n                        config['version'] = self._version = data['version']\n                        if config['version'].lower().startswith('v'):\n                            warn_or_raise(\n                                W29, W29, config['version'], config, pos)\n                            self._version = config['version'] = \\\n                                            config['version'][1:]\n                        if config['version'] not in self._version_namespace_map:\n                            vo_warn(W21, config['version'], config, pos)\n\n                    if 'xmlns' in data:\n                        ns_info = self._version_namespace_map.get(config['version'], {})\n                        correct_ns = ns_info.get('namespace_uri')\n                        if data['xmlns'] != correct_ns:\n                            vo_warn(W41, (correct_ns, data['xmlns']), config, pos)\n                    else:\n                        vo_warn(W42, (), config, pos)\n\n                    break\n                else:\n                    vo_raise(E19, (), config, pos)\n        config.update(self._get_version_checks())\n\n        tag_mapping = {\n            'PARAM': self._add_param,\n            'RESOURCE': self._add_resource,\n            'COOSYS': self._add_coosys,\n            'TIMESYS': self._add_timesys,\n            'INFO': self._add_info,\n            'DEFINITIONS': self._add_definitions,\n            'DESCRIPTION': self._ignore_add,\n            'GROUP': self._add_group}\n\n        for start, tag, data, pos in iterator:\n            if start:\n                tag_mapping.get(tag, self._add_unknown_tag)(\n                    iterator, tag, data, config, pos)\n            elif tag == 'DESCRIPTION':\n                if self.description is not None:\n                    warn_or_raise(W17, W17, 'VOTABLE', config, pos)\n                self.description = data or None\n\n        if not len(self.resources) and config['version_1_2_or_later']:\n            warn_or_raise(W53, W53, (), config, pos)\n\n        return self\n\n    def to_xml(self, fd, compressed=False, tabledata_format=None,\n               _debug_python_based_parser=False, _astropy_version=None):\n        \"\"\"\n        Write to an XML file.\n\n        Parameters\n        ----------\n        fd : str or file-like\n            Where to write the file. If a file-like object, must be writable.\n\n        compressed : bool, optional\n            When `True`, write to a gzip-compressed file.  (Default:\n            `False`)\n\n        tabledata_format : str, optional\n            Override the format of the table(s) data to write.  Must\n            be one of ``tabledata`` (text representation), ``binary`` or\n            ``binary2``.  By default, use the format that was specified\n            in each `Table` object as it was created or read in.  See\n            :ref:`astropy:votable-serialization`.\n        \"\"\"\n        if tabledata_format is not None:\n            if tabledata_format.lower() not in (\n                    'tabledata', 'binary', 'binary2'):\n                raise ValueError(f\"Unknown format type '{format}'\")\n\n        kwargs = {\n            'version': self.version,\n            'tabledata_format':\n                tabledata_format,\n            '_debug_python_based_parser': _debug_python_based_parser,\n            '_group_number': 1}\n        kwargs.update(self._get_version_checks())\n\n        with util.convert_to_writable_filelike(\n            fd, compressed=compressed) as fd:\n            w = XMLWriter(fd)\n            version = self.version\n            if _astropy_version is None:\n                lib_version = astropy_version\n            else:\n                lib_version = _astropy_version\n\n            xml_header = \"\"\"\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Produced with astropy.io.votable version {lib_version}\n     http://www.astropy.org/ -->\\n\"\"\"\n            w.write(xml_header.lstrip().format(**locals()))\n\n            # Build the VOTABLE tag attributes.\n            votable_attr = {\n                'version': version,\n                'xmlns:xsi': \"http://www.w3.org/2001/XMLSchema-instance\"\n            }\n            ns_info = self._version_namespace_map.get(version, {})\n            namespace_uri = ns_info.get('namespace_uri')\n            if namespace_uri:\n                votable_attr['xmlns'] = namespace_uri\n            schema_location_attr = ns_info.get('schema_location_attr')\n            schema_location_value = ns_info.get('schema_location_value')\n            if schema_location_attr and schema_location_value:\n                votable_attr[schema_location_attr] = schema_location_value\n\n            with w.tag('VOTABLE', votable_attr):\n                if self.description is not None:\n                    w.element(\"DESCRIPTION\", self.description, wrap=True)\n                element_sets = [self.coordinate_systems, self.time_systems,\n                                self.params, self.infos, self.resources]\n                if kwargs['version_1_2_or_later']:\n                    element_sets[0] = self.groups\n                for element_set in element_sets:\n                    for element in element_set:\n                        element.to_xml(w, **kwargs)\n\n    def iter_tables(self):\n        \"\"\"\n        Iterates over all tables in the VOTable file in a \"flat\" way,\n        ignoring the nesting of resources etc.\n        \"\"\"\n        for resource in self.resources:\n            for table in resource.iter_tables():\n                yield table\n\n    def get_first_table(self):\n        \"\"\"\n        Often, you know there is only one table in the file, and\n        that's all you need.  This method returns that first table.\n        \"\"\"\n        for table in self.iter_tables():\n            if not table.is_empty():\n                return table\n        raise IndexError(\"No table found in VOTABLE file.\")\n\n    get_table_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_tables', 'TABLE',\n        \"\"\"\n        Looks up a TABLE_ element by the given ID.  Used by the table\n        \"ref\" attribute.\n        \"\"\")\n\n    get_tables_by_utype = _lookup_by_attr_factory(\n        'utype', False, 'iter_tables', 'TABLE',\n        \"\"\"\n        Looks up a TABLE_ element by the given utype, and returns an\n        iterator emitting all matches.\n        \"\"\")\n\n    def get_table_by_index(self, idx):\n        \"\"\"\n        Get a table by its ordinal position in the file.\n        \"\"\"\n        for i, table in enumerate(self.iter_tables()):\n            if i == idx:\n                return table\n        raise IndexError(\n            f\"No table at index {idx:d} found in VOTABLE file.\")\n\n    def iter_fields_and_params(self):\n        \"\"\"\n        Recursively iterate over all FIELD_ and PARAM_ elements in the\n        VOTABLE_ file.\n        \"\"\"\n        for resource in self.resources:\n            for field in resource.iter_fields_and_params():\n                yield field\n\n    get_field_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_fields_and_params', 'FIELD',\n        \"\"\"\n        Looks up a FIELD_ element by the given ID_.  Used by the field's\n        \"ref\" attribute.\n        \"\"\")\n\n    get_fields_by_utype = _lookup_by_attr_factory(\n        'utype', False, 'iter_fields_and_params', 'FIELD',\n        \"\"\"\n        Looks up a FIELD_ element by the given utype and returns an\n        iterator emitting all matches.\n        \"\"\")\n\n    get_field_by_id_or_name = _lookup_by_id_or_name_factory(\n        'iter_fields_and_params', 'FIELD',\n        \"\"\"\n        Looks up a FIELD_ element by the given ID_ or name.\n        \"\"\")\n\n    def iter_values(self):\n        \"\"\"\n        Recursively iterate over all VALUES_ elements in the VOTABLE_\n        file.\n        \"\"\"\n        for field in self.iter_fields_and_params():\n            yield field.values\n\n    get_values_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_values', 'VALUES',\n        \"\"\"\n        Looks up a VALUES_ element by the given ID.  Used by the values\n        \"ref\" attribute.\n        \"\"\")\n\n    def iter_groups(self):\n        \"\"\"\n        Recursively iterate over all GROUP_ elements in the VOTABLE_\n        file.\n        \"\"\"\n        for table in self.iter_tables():\n            for group in table.iter_groups():\n                yield group\n\n    get_group_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_groups', 'GROUP',\n        \"\"\"\n        Looks up a GROUP_ element by the given ID.  Used by the group's\n        \"ref\" attribute\n        \"\"\")\n\n    get_groups_by_utype = _lookup_by_attr_factory(\n        'utype', False, 'iter_groups', 'GROUP',\n        \"\"\"\n        Looks up a GROUP_ element by the given utype and returns an\n        iterator emitting all matches.\n        \"\"\")\n\n    def iter_coosys(self):\n        \"\"\"\n        Recursively iterate over all COOSYS_ elements in the VOTABLE_\n        file.\n        \"\"\"\n        for coosys in self.coordinate_systems:\n            yield coosys\n        for resource in self.resources:\n            for coosys in resource.iter_coosys():\n                yield coosys\n\n    get_coosys_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_coosys', 'COOSYS',\n        \"\"\"Looks up a COOSYS_ element by the given ID.\"\"\")\n\n    def iter_timesys(self):\n        \"\"\"\n        Recursively iterate over all TIMESYS_ elements in the VOTABLE_\n        file.\n        \"\"\"\n        for timesys in self.time_systems:\n            yield timesys\n        for resource in self.resources:\n            for timesys in resource.iter_timesys():\n                yield timesys\n\n    get_timesys_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_timesys', 'TIMESYS',\n        \"\"\"Looks up a TIMESYS_ element by the given ID.\"\"\")\n\n    def iter_info(self):\n        \"\"\"\n        Recursively iterate over all INFO_ elements in the VOTABLE_\n        file.\n        \"\"\"\n        for info in self.infos:\n            yield info\n        for resource in self.resources:\n            for info in resource.iter_info():\n                yield info\n\n    get_info_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_info', 'INFO',\n        \"\"\"Looks up a INFO element by the given ID.\"\"\")\n\n    def set_all_tables_format(self, format):\n        \"\"\"\n        Set the output storage format of all tables in the file.\n        \"\"\"\n        for table in self.iter_tables():\n            table.format = format\n\n    @classmethod\n    def from_table(cls, table, table_id=None):\n        \"\"\"\n        Create a `VOTableFile` instance from a given\n        `astropy.table.Table` instance.\n\n        Parameters\n        ----------\n        table_id : str, optional\n            Set the given ID attribute on the returned Table instance.\n        \"\"\"\n        votable_file = cls()\n        resource = Resource()\n        votable = Table.from_table(votable_file, table)\n        if table_id is not None:\n            votable.ID = table_id\n        resource.tables.append(votable)\n        votable_file.resources.append(resource)\n        return votable_file\n"},{"className":"CatchZeroByteWriter","col":0,"comment":"File handle to intercept 0-byte writes","endLoc":13,"id":5660,"nodeType":"Class","startLoc":6,"text":"class CatchZeroByteWriter(io.BufferedWriter):\n    \"\"\"File handle to intercept 0-byte writes\"\"\"\n\n    def write(self, buffer):\n        nbytes = super().write(buffer)\n        if nbytes == 0:\n            raise ValueError(\"This writer does not allow empty writes\")\n        return nbytes"},{"col":4,"comment":"null","endLoc":13,"header":"def write(self, buffer)","id":5661,"name":"write","nodeType":"Function","startLoc":9,"text":"def write(self, buffer):\n        nbytes = super().write(buffer)\n        if nbytes == 0:\n            raise ValueError(\"This writer does not allow empty writes\")\n        return nbytes"},{"fileName":"exceptions.py","filePath":"astropy/io/votable","id":5662,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\"\"\"\n.. _warnings:\n\nWarnings\n--------\n\n.. note::\n    Most of the following warnings indicate violations of the VOTable\n    specification.  They should be reported to the authors of the\n    tools that produced the VOTable file.\n\n    To control the warnings emitted, use the standard Python\n    :mod:`warnings` module and the ``astropy.io.votable.exceptions.conf.max_warnings``\n    configuration item.  Most of these are of the type `VOTableSpecWarning`.\n\n{warnings}\n\n.. _exceptions:\n\nExceptions\n----------\n\n.. note::\n\n    This is a list of many of the fatal exceptions emitted by ``astropy.io.votable``\n    when the file does not conform to spec.  Other exceptions may be\n    raised due to unforeseen cases or bugs in ``astropy.io.votable`` itself.\n\n{exceptions}\n\"\"\"\n\n# STDLIB\nimport io\nimport re\n\nfrom textwrap import dedent\nfrom warnings import warn\n\nfrom astropy import config as _config\nfrom astropy.utils.exceptions import AstropyWarning\n\n__all__ = [\n    'Conf', 'conf', 'warn_or_raise', 'vo_raise', 'vo_reraise', 'vo_warn',\n    'warn_unknown_attrs', 'parse_vowarning', 'VOWarning',\n    'VOTableChangeWarning', 'VOTableSpecWarning',\n    'UnimplementedWarning', 'IOWarning', 'VOTableSpecError']\n\n\n# NOTE: Cannot put this in __init__.py due to circular import.\nclass Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.io.votable.exceptions`.\n    \"\"\"\n    max_warnings = _config.ConfigItem(\n        10,\n        'Number of times the same type of warning is displayed '\n        'before being suppressed',\n        cfgtype='integer')\n\n\nconf = Conf()\n\n\ndef _format_message(message, name, config=None, pos=None):\n    if config is None:\n        config = {}\n    if pos is None:\n        pos = ('?', '?')\n    filename = config.get('filename', '?')\n    return f'{filename}:{pos[0]}:{pos[1]}: {name}: {message}'\n\n\ndef _suppressed_warning(warning, config, stacklevel=2):\n    warning_class = type(warning)\n    config.setdefault('_warning_counts', dict()).setdefault(warning_class, 0)\n    config['_warning_counts'][warning_class] += 1\n    message_count = config['_warning_counts'][warning_class]\n    if message_count <= conf.max_warnings:\n        if message_count == conf.max_warnings:\n            warning.formatted_message += \\\n                ' (suppressing further warnings of this type...)'\n        warn(warning, stacklevel=stacklevel+1)\n\n\ndef warn_or_raise(warning_class, exception_class=None, args=(), config=None,\n                  pos=None, stacklevel=1):\n    \"\"\"\n    Warn or raise an exception, depending on the verify setting.\n    \"\"\"\n    if config is None:\n        config = {}\n    # NOTE: the default here is deliberately warn rather than ignore, since\n    # one would expect that calling warn_or_raise without config should not\n    # silence the warnings.\n    config_value = config.get('verify', 'warn')\n    if config_value == 'exception':\n        if exception_class is None:\n            exception_class = warning_class\n        vo_raise(exception_class, args, config, pos)\n    elif config_value == 'warn':\n        vo_warn(warning_class, args, config, pos, stacklevel=stacklevel+1)\n\n\ndef vo_raise(exception_class, args=(), config=None, pos=None):\n    \"\"\"\n    Raise an exception, with proper position information if available.\n    \"\"\"\n    if config is None:\n        config = {}\n    raise exception_class(args, config, pos)\n\n\ndef vo_reraise(exc, config=None, pos=None, additional=''):\n    \"\"\"\n    Raise an exception, with proper position information if available.\n\n    Restores the original traceback of the exception, and should only\n    be called within an \"except:\" block of code.\n    \"\"\"\n    if config is None:\n        config = {}\n    message = _format_message(str(exc), exc.__class__.__name__, config, pos)\n    if message.split()[0] == str(exc).split()[0]:\n        message = str(exc)\n    if len(additional):\n        message += ' ' + additional\n    exc.args = (message,)\n    raise exc\n\n\ndef vo_warn(warning_class, args=(), config=None, pos=None, stacklevel=1):\n    \"\"\"\n    Warn, with proper position information if available.\n    \"\"\"\n    if config is None:\n        config = {}\n    # NOTE: the default here is deliberately warn rather than ignore, since\n    # one would expect that calling warn_or_raise without config should not\n    # silence the warnings.\n    if config.get('verify', 'warn') != 'ignore':\n        warning = warning_class(args, config, pos)\n        _suppressed_warning(warning, config, stacklevel=stacklevel+1)\n\n\ndef warn_unknown_attrs(element, attrs, config, pos, good_attr=[], stacklevel=1):\n    for attr in attrs:\n        if attr not in good_attr:\n            vo_warn(W48, (attr, element), config, pos, stacklevel=stacklevel+1)\n\n\n_warning_pat = re.compile(\n    r\":?(?P<nline>[0-9?]+):(?P<nchar>[0-9?]+): \" +\n    r\"((?P<warning>[WE]\\d+): )?(?P<rest>.*)$\")\n\n\ndef parse_vowarning(line):\n    \"\"\"\n    Parses the vo warning string back into its parts.\n    \"\"\"\n    result = {}\n    match = _warning_pat.search(line)\n    if match:\n        result['warning'] = warning = match.group('warning')\n        if warning is not None:\n            result['is_warning'] = (warning[0].upper() == 'W')\n            result['is_exception'] = not result['is_warning']\n            result['number'] = int(match.group('warning')[1:])\n            result['doc_url'] = f\"io/votable/api_exceptions.html#{warning.lower()}\"\n        else:\n            result['is_warning'] = False\n            result['is_exception'] = False\n            result['is_other'] = True\n            result['number'] = None\n            result['doc_url'] = None\n        try:\n            result['nline'] = int(match.group('nline'))\n        except ValueError:\n            result['nline'] = 0\n        try:\n            result['nchar'] = int(match.group('nchar'))\n        except ValueError:\n            result['nchar'] = 0\n        result['message'] = match.group('rest')\n        result['is_something'] = True\n    else:\n        result['warning'] = None\n        result['is_warning'] = False\n        result['is_exception'] = False\n        result['is_other'] = False\n        result['is_something'] = False\n        if not isinstance(line, str):\n            line = line.decode('utf-8')\n        result['message'] = line\n\n    return result\n\n\nclass VOWarning(AstropyWarning):\n    \"\"\"\n    The base class of all VO warnings and exceptions.\n\n    Handles the formatting of the message with a warning or exception\n    code, filename, line and column number.\n    \"\"\"\n    default_args = ()\n    message_template = ''\n\n    def __init__(self, args, config=None, pos=None):\n        if config is None:\n            config = {}\n        if not isinstance(args, tuple):\n            args = (args, )\n        msg = self.message_template.format(*args)\n\n        self.formatted_message = _format_message(\n            msg, self.__class__.__name__, config, pos)\n        Warning.__init__(self, self.formatted_message)\n\n    def __str__(self):\n        return self.formatted_message\n\n    @classmethod\n    def get_short_name(cls):\n        if len(cls.default_args):\n            return cls.message_template.format(*cls.default_args)\n        return cls.message_template\n\n\nclass VOTableChangeWarning(VOWarning, SyntaxWarning):\n    \"\"\"\n    A change has been made to the input XML file.\n    \"\"\"\n\n\nclass VOTableSpecWarning(VOWarning, SyntaxWarning):\n    \"\"\"\n    The input XML file violates the spec, but there is an obvious workaround.\n    \"\"\"\n\n\nclass UnimplementedWarning(VOWarning, SyntaxWarning):\n    \"\"\"\n    A feature of the VOTABLE_ spec is not implemented.\n    \"\"\"\n\n\nclass IOWarning(VOWarning, RuntimeWarning):\n    \"\"\"\n    A network or IO error occurred, but was recovered using the cache.\n    \"\"\"\n\n\nclass VOTableSpecError(VOWarning, ValueError):\n    \"\"\"\n    The input XML file violates the spec and there is no good workaround.\n    \"\"\"\n\n\nclass W01(VOTableSpecWarning):\n    \"\"\"\n    The VOTable spec states:\n\n        If a cell contains an array or complex number, it should be\n        encoded as multiple numbers separated by whitespace.\n\n    Many VOTable files in the wild use commas as a separator instead,\n    and ``astropy.io.votable`` can support this convention depending on the\n    :ref:`astropy:verifying-votables` setting.\n\n    ``astropy.io.votable`` always outputs files using only spaces, regardless of\n    how they were input.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#toc-header-35>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:TABLEDATA>`__\n    \"\"\"\n\n    message_template = \"Array uses commas rather than whitespace\"\n\n\nclass W02(VOTableSpecWarning):\n    r\"\"\"\n    XML ids must match the following regular expression::\n\n        ^[A-Za-z_][A-Za-z0-9_\\.\\-]*$\n\n    The VOTable 1.1 says the following:\n\n        According to the XML standard, the attribute ``ID`` is a\n        string beginning with a letter or underscore (``_``), followed\n        by a sequence of letters, digits, or any of the punctuation\n        characters ``.`` (dot), ``-`` (dash), ``_`` (underscore), or\n        ``:`` (colon).\n\n    However, this is in conflict with the XML standard, which says\n    colons may not be used.  VOTable 1.1's own schema does not allow a\n    colon here.  Therefore, ``astropy.io.votable`` disallows the colon.\n\n    VOTable 1.2 corrects this error in the specification.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `XML Names <http://www.w3.org/TR/REC-xml/#NT-Name>`__\n    \"\"\"\n\n    message_template = \"{} attribute '{}' is invalid.  Must be a standard XML id\"\n    default_args = ('x', 'y')\n\n\nclass W03(VOTableChangeWarning):\n    \"\"\"\n    The VOTable 1.1 spec says the following about ``name`` vs. ``ID``\n    on ``FIELD`` and ``VALUE`` elements:\n\n        ``ID`` and ``name`` attributes have a different role in\n        VOTable: the ``ID`` is meant as a *unique identifier* of an\n        element seen as a VOTable component, while the ``name`` is\n        meant for presentation purposes, and need not to be unique\n        throughout the VOTable document. The ``ID`` attribute is\n        therefore required in the elements which have to be\n        referenced, but in principle any element may have an ``ID``\n        attribute. ... In summary, the ``ID`` is different from the\n        ``name`` attribute in that (a) the ``ID`` attribute is made\n        from a restricted character set, and must be unique throughout\n        a VOTable document whereas names are standard XML attributes\n        and need not be unique; and (b) there should be support in the\n        parsing software to look up references and extract the\n        relevant element with matching ``ID``.\n\n    It is further recommended in the VOTable 1.2 spec:\n\n        While the ``ID`` attribute has to be unique in a VOTable\n        document, the ``name`` attribute need not. It is however\n        recommended, as a good practice, to assign unique names within\n        a ``TABLE`` element. This recommendation means that, between a\n        ``TABLE`` and its corresponding closing ``TABLE`` tag,\n        ``name`` attributes of ``FIELD``, ``PARAM`` and optional\n        ``GROUP`` elements should be all different.\n\n    Since ``astropy.io.votable`` requires a unique identifier for each of its\n    columns, ``ID`` is used for the column name when present.\n    However, when ``ID`` is not present, (since it is not required by\n    the specification) ``name`` is used instead.  However, ``name``\n    must be cleansed by replacing invalid characters (such as\n    whitespace) with underscores.\n\n    .. note::\n        This warning does not indicate that the input file is invalid\n        with respect to the VOTable specification, only that the\n        column names in the record array may not match exactly the\n        ``name`` attributes specified in the file.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    \"\"\"\n\n    message_template = \"Implicitly generating an ID from a name '{}' -> '{}'\"\n    default_args = ('x', 'y')\n\n\nclass W04(VOTableSpecWarning):\n    \"\"\"\n    The ``content-type`` attribute must use MIME content-type syntax as\n    defined in `RFC 2046 <https://tools.ietf.org/html/rfc2046>`__.\n\n    The current check for validity is somewhat over-permissive.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:link>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:link>`__\n    \"\"\"\n\n    message_template = \"content-type '{}' must be a valid MIME content type\"\n    default_args = ('x',)\n\n\nclass W05(VOTableSpecWarning):\n    \"\"\"\n    The attribute must be a valid URI as defined in `RFC 2396\n    <https://www.ietf.org/rfc/rfc2396.txt>`_.\n    \"\"\"\n\n    message_template = \"'{}' is not a valid URI\"\n    default_args = ('x',)\n\n\nclass W06(VOTableSpecWarning):\n    \"\"\"\n    This warning is emitted when a ``ucd`` attribute does not match\n    the syntax of a `unified content descriptor\n    <http://vizier.u-strasbg.fr/doc/UCD.htx>`__.\n\n    If the VOTable version is 1.2 or later, the UCD will also be\n    checked to ensure it conforms to the controlled vocabulary defined\n    by UCD1+.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:ucd>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:ucd>`__\n    \"\"\"\n\n    message_template = \"Invalid UCD '{}': {}\"\n    default_args = ('x', 'explanation')\n\n\nclass W07(VOTableSpecWarning):\n    \"\"\"\n    As astro year field is a Besselian or Julian year matching the\n    regular expression::\n\n        ^[JB]?[0-9]+([.][0-9]*)?$\n\n    Defined in this XML Schema snippet::\n\n        <xs:simpleType  name=\"astroYear\">\n          <xs:restriction base=\"xs:token\">\n            <xs:pattern  value=\"[JB]?[0-9]+([.][0-9]*)?\"/>\n          </xs:restriction>\n        </xs:simpleType>\n    \"\"\"\n\n    message_template = \"Invalid astroYear in {}: '{}'\"\n    default_args = ('x', 'y')\n\n\nclass W08(VOTableSpecWarning):\n    \"\"\"\n    To avoid local-dependent number parsing differences, ``astropy.io.votable``\n    may require a string or unicode string where a numeric type may\n    make more sense.\n    \"\"\"\n\n    message_template = \"'{}' must be a str or bytes object\"\n\n    default_args = ('x',)\n\n\nclass W09(VOTableSpecWarning):\n    \"\"\"\n    The VOTable specification uses the attribute name ``ID`` (with\n    uppercase letters) to specify unique identifiers.  Some\n    VOTable-producing tools use the more standard lowercase ``id``\n    instead. ``astropy.io.votable`` accepts ``id`` and emits this warning if\n    ``verify`` is ``'warn'``.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    \"\"\"\n\n    message_template = \"ID attribute not capitalized\"\n\n\nclass W10(VOTableSpecWarning):\n    \"\"\"\n    The parser has encountered an element that does not exist in the\n    specification, or appears in an invalid context.  Check the file\n    against the VOTable schema (with a tool such as `xmllint\n    <http://xmlsoft.org/xmllint.html>`__.  If the file validates\n    against the schema, and you still receive this warning, this may\n    indicate a bug in ``astropy.io.votable``.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__\n    \"\"\"\n\n    message_template = \"Unknown tag '{}'.  Ignoring\"\n    default_args = ('x',)\n\n\nclass W11(VOTableSpecWarning):\n    \"\"\"\n    Earlier versions of the VOTable specification used a ``gref``\n    attribute on the ``LINK`` element to specify a `GLU reference\n    <http://aladin.u-strasbg.fr/glu/>`__.  New files should\n    specify a ``glu:`` protocol using the ``href`` attribute.\n\n    Since ``astropy.io.votable`` does not currently support GLU references, it\n    likewise does not automatically convert the ``gref`` attribute to\n    the new form.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:link>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:link>`__\n    \"\"\"\n\n    message_template = \"The gref attribute on LINK is deprecated in VOTable 1.1\"\n\n\nclass W12(VOTableChangeWarning):\n    \"\"\"\n    In order to name the columns of the Numpy record array, each\n    ``FIELD`` element must have either an ``ID`` or ``name`` attribute\n    to derive a name from.  Strictly speaking, according to the\n    VOTable schema, the ``name`` attribute is required.  However, if\n    ``name`` is not present by ``ID`` is, and ``verify`` is not ``'exception'``,\n    ``astropy.io.votable`` will continue without a ``name`` defined.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    \"\"\"\n\n    message_template = (\n        \"'{}' element must have at least one of 'ID' or 'name' attributes\")\n    default_args = ('x',)\n\n\nclass W13(VOTableSpecWarning):\n    \"\"\"\n    Some VOTable files in the wild use non-standard datatype names.  These\n    are mapped to standard ones using the following mapping::\n\n       string        -> char\n       unicodeString -> unicodeChar\n       int16         -> short\n       int32         -> int\n       int64         -> long\n       float32       -> float\n       float64       -> double\n       unsignedInt   -> long\n       unsignedShort -> int\n\n    To add more datatype mappings during parsing, use the\n    ``datatype_mapping`` keyword to `astropy.io.votable.parse`.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    \"\"\"\n\n    message_template = \"'{}' is not a valid VOTable datatype, should be '{}'\"\n    default_args = ('x', 'y')\n\n\n# W14: Deprecated\n\n\nclass W15(VOTableSpecWarning):\n    \"\"\"\n    The ``name`` attribute is required on every ``FIELD`` element.\n    However, many VOTable files in the wild omit it and provide only\n    an ``ID`` instead.  In this case, when ``verify`` is not ``'exception'``\n    ``astropy.io.votable`` will copy the ``name`` attribute to a new ``ID``\n    attribute.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    \"\"\"\n\n    message_template = \"{} element missing required 'name' attribute\"\n    default_args = ('x',)\n\n# W16: Deprecated\n\n\nclass W17(VOTableSpecWarning):\n    \"\"\"\n    A ``DESCRIPTION`` element can only appear once within its parent\n    element.\n\n    According to the schema, it may only occur once (`1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__)\n\n    However, it is a `proposed extension\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:addesc>`__\n    to VOTable 1.2.\n    \"\"\"\n\n    message_template = \"{} element contains more than one DESCRIPTION element\"\n    default_args = ('x',)\n\n\nclass W18(VOTableSpecWarning):\n    \"\"\"\n    The number of rows explicitly specified in the ``nrows`` attribute\n    does not match the actual number of rows (``TR`` elements) present\n    in the ``TABLE``.  This may indicate truncation of the file, or an\n    internal error in the tool that produced it.  If ``verify`` is not\n    ``'exception'``, parsing will proceed, with the loss of some performance.\n\n    **References:** `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC10>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC10>`__\n    \"\"\"\n\n    message_template = 'TABLE specified nrows={}, but table contains {} rows'\n    default_args = ('x', 'y')\n\n\nclass W19(VOTableSpecWarning):\n    \"\"\"\n    The column fields as defined using ``FIELD`` elements do not match\n    those in the headers of the embedded FITS file.  If ``verify`` is not\n    ``'exception'``, the embedded FITS file will take precedence.\n    \"\"\"\n\n    message_template = (\n        'The fields defined in the VOTable do not match those in the ' +\n        'embedded FITS file')\n\n\nclass W20(VOTableSpecWarning):\n    \"\"\"\n    If no version number is explicitly given in the VOTable file, the\n    parser assumes it is written to the VOTable 1.1 specification.\n    \"\"\"\n\n    message_template = 'No version number specified in file.  Assuming {}'\n    default_args = ('1.1',)\n\n\nclass W21(UnimplementedWarning):\n    \"\"\"\n    Unknown issues may arise using ``astropy.io.votable`` with VOTable files\n    from a version other than 1.1, 1.2, 1.3, or 1.4.\n    \"\"\"\n\n    message_template = (\n        'astropy.io.votable is designed for VOTable version 1.1, 1.2, 1.3,'\n        ' and 1.4, but this file is {}')\n    default_args = ('x',)\n\n\nclass W22(VOTableSpecWarning):\n    \"\"\"\n    Version 1.0 of the VOTable specification used the ``DEFINITIONS``\n    element to define coordinate systems.  Version 1.1 now uses\n    ``COOSYS`` elements throughout the document.\n\n    **References:** `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:definitions>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:definitions>`__\n    \"\"\"\n\n    message_template = 'The DEFINITIONS element is deprecated in VOTable 1.1.  Ignoring'\n\n\nclass W23(IOWarning):\n    \"\"\"\n    Raised when the VO service database can not be updated (possibly\n    due to a network outage).  This is only a warning, since an older\n    and possible out-of-date VO service database was available\n    locally.\n    \"\"\"\n\n    message_template = \"Unable to update service information for '{}'\"\n    default_args = ('x',)\n\n\nclass W24(VOWarning, FutureWarning):\n    \"\"\"\n    The VO catalog database retrieved from the www is designed for a\n    newer version of ``astropy.io.votable``.  This may cause problems or limited\n    features performing service queries.  Consider upgrading ``astropy.io.votable``\n    to the latest version.\n    \"\"\"\n\n    message_template = \"The VO catalog database is for a later version of astropy.io.votable\"\n\n\nclass W25(IOWarning):\n    \"\"\"\n    A VO service query failed due to a network error or malformed\n    arguments.  Another alternative service may be attempted.  If all\n    services fail, an exception will be raised.\n    \"\"\"\n\n    message_template = \"'{}' failed with: {}\"\n    default_args = ('service', '...')\n\n\nclass W26(VOTableSpecWarning):\n    \"\"\"\n    The given element was not supported inside of the given element\n    until the specified VOTable version, however the version declared\n    in the file is for an earlier version.  These attributes may not\n    be written out to the file.\n    \"\"\"\n\n    message_template = \"'{}' inside '{}' added in VOTable {}\"\n    default_args = ('child', 'parent', 'X.X')\n\n\nclass W27(VOTableSpecWarning):\n    \"\"\"\n    The ``COOSYS`` element was deprecated in VOTABLE version 1.2 in\n    favor of a reference to the Space-Time Coordinate (STC) data\n    model (see `utype\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:utype>`__\n    and the IVOA note `referencing STC in VOTable\n    <http://ivoa.net/Documents/latest/VOTableSTC.html>`__.\n    \"\"\"\n\n    message_template = \"COOSYS deprecated in VOTable 1.2\"\n\n\nclass W28(VOTableSpecWarning):\n    \"\"\"\n    The given attribute was not supported on the given element until the\n    specified VOTable version, however the version declared in the file is\n    for an earlier version.  These attributes may not be written out to\n    the file.\n    \"\"\"\n\n    message_template = \"'{}' on '{}' added in VOTable {}\"\n    default_args = ('attribute', 'element', 'X.X')\n\n\nclass W29(VOTableSpecWarning):\n    \"\"\"\n    Some VOTable files specify their version number in the form \"v1.0\",\n    when the only supported forms in the spec are \"1.0\".\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__\n    \"\"\"\n\n    message_template = \"Version specified in non-standard form '{}'\"\n    default_args = ('v1.0',)\n\n\nclass W30(VOTableSpecWarning):\n    \"\"\"\n    Some VOTable files write missing floating-point values in non-standard ways,\n    such as \"null\" and \"-\".  If ``verify`` is not ``'exception'``, any\n    non-standard floating-point literals are treated as missing values.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    \"\"\"\n\n    message_template = \"Invalid literal for float '{}'.  Treating as empty.\"\n    default_args = ('x',)\n\n\nclass W31(VOTableSpecWarning):\n    \"\"\"\n    Since NaN's can not be represented in integer fields directly, a null\n    value must be specified in the FIELD descriptor to support reading\n    NaN's from the tabledata.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    \"\"\"\n\n    message_template = \"NaN given in an integral field without a specified null value\"\n\n\nclass W32(VOTableSpecWarning):\n    \"\"\"\n    Each field in a table must have a unique ID.  If two or more fields\n    have the same ID, some will be renamed to ensure that all IDs are\n    unique.\n\n    From the VOTable 1.2 spec:\n\n        The ``ID`` and ``ref`` attributes are defined as XML types\n        ``ID`` and ``IDREF`` respectively. This means that the\n        contents of ``ID`` is an identifier which must be unique\n        throughout a VOTable document, and that the contents of the\n        ``ref`` attribute represents a reference to an identifier\n        which must exist in the VOTable document.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    \"\"\"\n\n    message_template = \"Duplicate ID '{}' renamed to '{}' to ensure uniqueness\"\n    default_args = ('x', 'x_2')\n\n\nclass W33(VOTableChangeWarning):\n    \"\"\"\n    Each field in a table must have a unique name.  If two or more\n    fields have the same name, some will be renamed to ensure that all\n    names are unique.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    \"\"\"\n\n    message_template = \"Column name '{}' renamed to '{}' to ensure uniqueness\"\n    default_args = ('x', 'x_2')\n\n\nclass W34(VOTableSpecWarning):\n    \"\"\"\n    The attribute requires the value to be a valid XML token, as\n    defined by `XML 1.0\n    <http://www.w3.org/TR/2000/WD-xml-2e-20000814#NT-Nmtoken>`__.\n    \"\"\"\n\n    message_template = \"'{}' is an invalid token for attribute '{}'\"\n    default_args = ('x', 'y')\n\n\nclass W35(VOTableSpecWarning):\n    \"\"\"\n    The ``name`` and ``value`` attributes are required on all ``INFO``\n    elements.\n\n    **References:** `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC32>`__\n    \"\"\"\n\n    message_template = \"'{}' attribute required for INFO elements\"\n    default_args = ('x',)\n\n\nclass W36(VOTableSpecWarning):\n    \"\"\"\n    If the field specifies a ``null`` value, that value must conform\n    to the given ``datatype``.\n\n    **References:** `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:values>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:values>`__\n    \"\"\"\n\n    message_template = \"null value '{}' does not match field datatype, setting to 0\"\n    default_args = ('x',)\n\n\nclass W37(UnimplementedWarning):\n    \"\"\"\n    The 3 datatypes defined in the VOTable specification and supported by\n    ``astropy.io.votable`` are ``TABLEDATA``, ``BINARY`` and ``FITS``.\n\n    **References:** `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:data>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:data>`__\n    \"\"\"\n\n    message_template = \"Unsupported data format '{}'\"\n    default_args = ('x',)\n\n\nclass W38(VOTableSpecWarning):\n    \"\"\"\n    The only encoding for local binary data supported by the VOTable\n    specification is base64.\n    \"\"\"\n\n    message_template = \"Inline binary data must be base64 encoded, got '{}'\"\n    default_args = ('x',)\n\n\nclass W39(VOTableSpecWarning):\n    \"\"\"\n    Bit values do not support masking.  This warning is raised upon\n    setting masked data in a bit column.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    \"\"\"\n\n    message_template = \"Bit values can not be masked\"\n\n\nclass W40(VOTableSpecWarning):\n    \"\"\"\n    This is a terrible hack to support Simple Image Access Protocol\n    results from `NOIRLab Astro Data Archive <https://astroarchive.noirlab.edu/>`__.  It\n    creates a field for the coordinate projection type of type \"double\",\n    which actually contains character data.  We have to hack the field\n    to store character data, or we can't read it in.  A warning will be\n    raised when this happens.\n    \"\"\"\n\n    message_template = \"'cprojection' datatype repaired\"\n\n\nclass W41(VOTableSpecWarning):\n    \"\"\"\n    An XML namespace was specified on the ``VOTABLE`` element, but the\n    namespace does not match what is expected for a ``VOTABLE`` file.\n\n    The ``VOTABLE`` namespace is::\n\n      http://www.ivoa.net/xml/VOTable/vX.X\n\n    where \"X.X\" is the version number.\n\n    Some files in the wild set the namespace to the location of the\n    VOTable schema, which is not correct and will not pass some\n    validating parsers.\n    \"\"\"\n\n    message_template = (\n        \"An XML namespace is specified, but is incorrect.  Expected \" +\n        \"'{}', got '{}'\")\n    default_args = ('x', 'y')\n\n\nclass W42(VOTableSpecWarning):\n    \"\"\"\n    The root element should specify a namespace.\n\n    The ``VOTABLE`` namespace is::\n\n        http://www.ivoa.net/xml/VOTable/vX.X\n\n    where \"X.X\" is the version number.\n    \"\"\"\n\n    message_template = \"No XML namespace specified\"\n\n\nclass W43(VOTableSpecWarning):\n    \"\"\"\n    Referenced elements should be defined before referees.  From the\n    VOTable 1.2 spec:\n\n       In VOTable1.2, it is further recommended to place the ID\n       attribute prior to referencing it whenever possible.\n    \"\"\"\n\n    message_template = \"{} ref='{}' which has not already been defined\"\n    default_args = ('element', 'x',)\n\n\nclass W44(VOTableSpecWarning):\n    \"\"\"\n    ``VALUES`` elements that reference another element should not have\n    their own content.\n\n    From the VOTable 1.2 spec:\n\n        The ``ref`` attribute of a ``VALUES`` element can be used to\n        avoid a repetition of the domain definition, by referring to a\n        previously defined ``VALUES`` element having the referenced\n        ``ID`` attribute. When specified, the ``ref`` attribute\n        defines completely the domain without any other element or\n        attribute, as e.g. ``<VALUES ref=\"RAdomain\"/>``\n    \"\"\"\n\n    message_template = \"VALUES element with ref attribute has content ('{}')\"\n    default_args = ('element',)\n\n\nclass W45(VOWarning, ValueError):\n    \"\"\"\n    The ``content-role`` attribute on the ``LINK`` element must be one of\n    the following::\n\n        query, hints, doc, location\n\n    And in VOTable 1.3, additionally::\n\n        type\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__\n    `1.3\n    <http://www.ivoa.net/documents/VOTable/20130315/PR-VOTable-1.3-20130315.html#sec:link>`__\n    \"\"\"\n\n    message_template = \"content-role attribute '{}' invalid\"\n    default_args = ('x',)\n\n\nclass W46(VOTableSpecWarning):\n    \"\"\"\n    The given char or unicode string is too long for the specified\n    field length.\n    \"\"\"\n\n    message_template = \"{} value is too long for specified length of {}\"\n    default_args = ('char or unicode', 'x')\n\n\nclass W47(VOTableSpecWarning):\n    \"\"\"\n    If no arraysize is specified on a char field, the default of '1'\n    is implied, but this is rarely what is intended.\n    \"\"\"\n\n    message_template = \"Missing arraysize indicates length 1\"\n\n\nclass W48(VOTableSpecWarning):\n    \"\"\"\n    The attribute is not defined in the specification.\n    \"\"\"\n\n    message_template = \"Unknown attribute '{}' on {}\"\n    default_args = ('attribute', 'element')\n\n\nclass W49(VOTableSpecWarning):\n    \"\"\"\n    Prior to VOTable 1.3, the empty cell was illegal for integer\n    fields.\n\n    If a \\\"null\\\" value was specified for the cell, it will be used\n    for the value, otherwise, 0 will be used.\n    \"\"\"\n\n    message_template = \"Empty cell illegal for integer fields.\"\n\n\nclass W50(VOTableSpecWarning):\n    \"\"\"\n    Invalid unit string as defined in the `Units in the VO, Version 1.0\n    <https://www.ivoa.net/documents/VOUnits>`_ (VOTable version >= 1.4)\n    or `Standards for Astronomical Catalogues, Version 2.0\n    <http://cdsarc.u-strasbg.fr/doc/catstd-3.2.htx>`_ (version < 1.4).\n\n    Consider passing an explicit ``unit_format`` parameter if the units\n    in this file conform to another specification.\n    \"\"\"\n\n    message_template = \"Invalid unit string '{}'\"\n    default_args = ('x',)\n\n\nclass W51(VOTableSpecWarning):\n    \"\"\"\n    The integer value is out of range for the size of the field.\n    \"\"\"\n\n    message_template = \"Value '{}' is out of range for a {} integer field\"\n    default_args = ('x', 'n-bit')\n\n\nclass W52(VOTableSpecWarning):\n    \"\"\"\n    The BINARY2 format was introduced in VOTable 1.3.  It should\n    not be present in files marked as an earlier version.\n    \"\"\"\n\n    message_template = (\"The BINARY2 format was introduced in VOTable 1.3, but \"\n                        \"this file is declared as version '{}'\")\n    default_args = ('1.2',)\n\n\nclass W53(VOTableSpecWarning):\n    \"\"\"\n    The VOTABLE element must contain at least one RESOURCE element.\n    \"\"\"\n\n    message_template = (\"VOTABLE element must contain at least one RESOURCE element.\")\n    default_args = ()\n\n\nclass W54(VOTableSpecWarning):\n    \"\"\"\n    The TIMESYS element was introduced in VOTable 1.4.  It should\n    not be present in files marked as an earlier version.\n    \"\"\"\n\n    message_template = (\n        \"The TIMESYS element was introduced in VOTable 1.4, but \"\n        \"this file is declared as version '{}'\")\n    default_args = ('1.3',)\n\n\nclass W55(VOTableSpecWarning):\n    \"\"\"\n    When non-ASCII characters are detected when reading\n    a TABLEDATA value for a FIELD with ``datatype=\"char\"``, we\n    can issue this warning.\n    \"\"\"\n\n    message_template = (\n        'FIELD ({}) has datatype=\"char\" but contains non-ASCII '\n        'value ({})')\n    default_args = ('', '')\n\n\nclass E01(VOWarning, ValueError):\n    \"\"\"\n    The size specifier for a ``char`` or ``unicode`` field must be\n    only a number followed, optionally, by an asterisk.\n    Multi-dimensional size specifiers are not supported for these\n    datatypes.\n\n    Strings, which are defined as a set of characters, can be\n    represented in VOTable as a fixed- or variable-length array of\n    characters::\n\n        <FIELD name=\"unboundedString\" datatype=\"char\" arraysize=\"*\"/>\n\n    A 1D array of strings can be represented as a 2D array of\n    characters, but given the logic above, it is possible to define a\n    variable-length array of fixed-length strings, but not a\n    fixed-length array of variable-length strings.\n    \"\"\"\n\n    message_template = \"Invalid size specifier '{}' for a {} field (in field '{}')\"\n    default_args = ('x', 'char/unicode', 'y')\n\n\nclass E02(VOWarning, ValueError):\n    \"\"\"\n    The number of array elements in the data does not match that specified\n    in the FIELD specifier.\n    \"\"\"\n\n    message_template = (\n        \"Incorrect number of elements in array. \" +\n        \"Expected multiple of {}, got {}\")\n    default_args = ('x', 'y')\n\n\nclass E03(VOWarning, ValueError):\n    \"\"\"\n    Complex numbers should be two values separated by whitespace.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    \"\"\"\n\n    message_template = \"'{}' does not parse as a complex number\"\n    default_args = ('x',)\n\n\nclass E04(VOWarning, ValueError):\n    \"\"\"\n    A ``bit`` array should be a string of '0's and '1's.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    \"\"\"\n\n    message_template = \"Invalid bit value '{}'\"\n    default_args = ('x',)\n\n\nclass E05(VOWarning, ValueError):\n    r\"\"\"\n    A ``boolean`` value should be one of the following strings (case\n    insensitive) in the ``TABLEDATA`` format::\n\n        'TRUE', 'FALSE', '1', '0', 'T', 'F', '\\0', ' ', '?'\n\n    and in ``BINARY`` format::\n\n        'T', 'F', '1', '0', '\\0', ' ', '?'\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    \"\"\"\n\n    message_template = \"Invalid boolean value '{}'\"\n    default_args = ('x',)\n\n\nclass E06(VOWarning, ValueError):\n    \"\"\"\n    The supported datatypes are::\n\n        double, float, bit, boolean, unsignedByte, short, int, long,\n        floatComplex, doubleComplex, char, unicodeChar\n\n    The following non-standard aliases are also supported, but in\n    these case :ref:`W13 <W13>` will be raised::\n\n        string        -> char\n        unicodeString -> unicodeChar\n        int16         -> short\n        int32         -> int\n        int64         -> long\n        float32       -> float\n        float64       -> double\n        unsignedInt   -> long\n        unsignedShort -> int\n\n    To add more datatype mappings during parsing, use the\n    ``datatype_mapping`` keyword to `astropy.io.votable.parse`.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    \"\"\"\n\n    message_template = \"Unknown datatype '{}' on field '{}'\"\n    default_args = ('x', 'y')\n\n# E07: Deprecated\n\n\nclass E08(VOWarning, ValueError):\n    \"\"\"\n    The ``type`` attribute on the ``VALUES`` element must be either\n    ``legal`` or ``actual``.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:values>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:values>`__\n    \"\"\"\n\n    message_template = \"type must be 'legal' or 'actual', but is '{}'\"\n    default_args = ('x',)\n\n\nclass E09(VOWarning, ValueError):\n    \"\"\"\n    The ``MIN``, ``MAX`` and ``OPTION`` elements must always have a\n    ``value`` attribute.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:values>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:values>`__\n    \"\"\"\n\n    message_template = \"'{}' must have a value attribute\"\n    default_args = ('x',)\n\n\nclass E10(VOWarning, ValueError):\n    \"\"\"\n    From VOTable 1.1 and later, ``FIELD`` and ``PARAM`` elements must have\n    a ``datatype`` field.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#elem:FIELD>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#elem:FIELD>`__\n    \"\"\"\n\n    message_template = \"'datatype' attribute required on all '{}' elements\"\n    default_args = ('FIELD',)\n\n\nclass E11(VOWarning, ValueError):\n    \"\"\"\n    The precision attribute is meant to express the number of significant\n    digits, either as a number of decimal places (e.g. ``precision=\"F2\"`` or\n    equivalently ``precision=\"2\"`` to express 2 significant figures\n    after the decimal point), or as a number of significant figures\n    (e.g. ``precision=\"E5\"`` indicates a relative precision of 10-5).\n\n    It is validated using the following regular expression::\n\n        [EF]?[1-9][0-9]*\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:form>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:form>`__\n    \"\"\"\n\n    message_template = \"precision '{}' is invalid\"\n    default_args = ('x',)\n\n\nclass E12(VOWarning, ValueError):\n    \"\"\"\n    The width attribute is meant to indicate to the application the\n    number of characters to be used for input or output of the\n    quantity.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:form>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:form>`__\n    \"\"\"\n\n    message_template = \"width must be a positive integer, got '{}'\"\n    default_args = ('x',)\n\n\nclass E13(VOWarning, ValueError):\n    r\"\"\"\n    From the VOTable 1.2 spec:\n\n        A table cell can contain an array of a given primitive type,\n        with a fixed or variable number of elements; the array may\n        even be multidimensional. For instance, the position of a\n        point in a 3D space can be defined by the following::\n\n            <FIELD ID=\"point_3D\" datatype=\"double\" arraysize=\"3\"/>\n\n        and each cell corresponding to that definition must contain\n        exactly 3 numbers. An asterisk (\\*) may be appended to\n        indicate a variable number of elements in the array, as in::\n\n            <FIELD ID=\"values\" datatype=\"int\" arraysize=\"100*\"/>\n\n        where it is specified that each cell corresponding to that\n        definition contains 0 to 100 integer numbers. The number may\n        be omitted to specify an unbounded array (in practice up to\n        =~2×10⁹ elements).\n\n        A table cell can also contain a multidimensional array of a\n        given primitive type. This is specified by a sequence of\n        dimensions separated by the ``x`` character, with the first\n        dimension changing fastest; as in the case of a simple array,\n        the last dimension may be variable in length. As an example,\n        the following definition declares a table cell which may\n        contain a set of up to 10 images, each of 64×64 bytes::\n\n            <FIELD ID=\"thumbs\" datatype=\"unsignedByte\" arraysize=\"64×64×10*\"/>\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:dim>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:dim>`__\n    \"\"\"\n\n    message_template = \"Invalid arraysize attribute '{}'\"\n    default_args = ('x',)\n\n\nclass E14(VOWarning, ValueError):\n    \"\"\"\n    All ``PARAM`` elements must have a ``value`` attribute.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#elem:FIELD>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#elem:FIELD>`__\n    \"\"\"\n\n    message_template = \"value attribute is required for all PARAM elements\"\n\n\nclass E15(VOWarning, ValueError):\n    \"\"\"\n    All ``COOSYS`` elements must have an ``ID`` attribute.\n\n    Note that the VOTable 1.1 specification says this attribute is\n    optional, but its corresponding schema indicates it is required.\n\n    In VOTable 1.2, the ``COOSYS`` element is deprecated.\n    \"\"\"\n\n    message_template = \"ID attribute is required for all COOSYS elements\"\n\n\nclass E16(VOTableSpecWarning):\n    \"\"\"\n    The ``system`` attribute on the ``COOSYS`` element must be one of the\n    following::\n\n      'eq_FK4', 'eq_FK5', 'ICRS', 'ecl_FK4', 'ecl_FK5', 'galactic',\n      'supergalactic', 'xy', 'barycentric', 'geo_app'\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#elem:COOSYS>`__\n    \"\"\"\n\n    message_template = \"Invalid system attribute '{}'\"\n    default_args = ('x',)\n\n\nclass E17(VOWarning, ValueError):\n    \"\"\"\n    ``extnum`` attribute must be a positive integer.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__\n    \"\"\"\n\n    message_template = \"extnum must be a positive integer\"\n\n\nclass E18(VOWarning, ValueError):\n    \"\"\"\n    The ``type`` attribute of the ``RESOURCE`` element must be one of\n    \"results\" or \"meta\".\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__\n    \"\"\"\n\n    message_template = \"type must be 'results' or 'meta', not '{}'\"\n    default_args = ('x',)\n\n\nclass E19(VOWarning, ValueError):\n    \"\"\"\n    Raised either when the file doesn't appear to be XML, or the root\n    element is not VOTABLE.\n    \"\"\"\n\n    message_template = \"File does not appear to be a VOTABLE\"\n\n\nclass E20(VOTableSpecError):\n    \"\"\"\n    The table had only *x* fields defined, but the data itself has more\n    columns than that.\n    \"\"\"\n\n    message_template = \"Data has more columns than are defined in the header ({})\"\n    default_args = ('x',)\n\n\nclass E21(VOWarning, ValueError):\n    \"\"\"\n    The table had *x* fields defined, but the data itself has only *y*\n    columns.\n    \"\"\"\n\n    message_template = \"Data has fewer columns ({}) than are defined in the header ({})\"\n    default_args = ('x', 'y')\n\n\nclass E22(VOWarning, ValueError):\n    \"\"\"\n    All ``TIMESYS`` elements must have an ``ID`` attribute.\n    \"\"\"\n\n    message_template = \"ID attribute is required for all TIMESYS elements\"\n\n\nclass E23(VOTableSpecWarning):\n    \"\"\"\n    The ``timeorigin`` attribute on the ``TIMESYS`` element must be\n    either a floating point literal specifying a valid Julian Date,\n    or, for convenience, the string \"MJD-origin\" (standing for 2400000.5)\n    or the string \"JD-origin\" (standing for 0).\n\n    **References**: `1.4\n    <http://www.ivoa.net/documents/VOTable/20191021/REC-VOTable-1.4-20191021.html#ToC21>`__\n    \"\"\"\n\n    message_template = \"Invalid timeorigin attribute '{}'\"\n    default_args = ('x',)\n\n\nclass E24(VOWarning, ValueError):\n    \"\"\"\n    Non-ASCII unicode values should not be written when the FIELD ``datatype=\"char\"``,\n    and cannot be written in BINARY or BINARY2 serialization.\n    \"\"\"\n\n    message_template = (\n        'Attempt to write non-ASCII value ({}) to FIELD ({}) which '\n        'has datatype=\"char\"')\n    default_args = ('', '')\n\n\nclass E25(VOTableSpecWarning):\n    \"\"\"\n    A VOTable cannot have a DATA section without any defined FIELD; DATA will be ignored.\n    \"\"\"\n\n    message_template = \"No FIELDs are defined; DATA section will be ignored.\"\n\n\ndef _get_warning_and_exception_classes(prefix):\n    classes = []\n    for key, val in globals().items():\n        if re.match(prefix + \"[0-9]{2}\", key):\n            classes.append((key, val))\n    classes.sort()\n    return classes\n\n\ndef _build_doc_string():\n    def generate_set(prefix):\n        classes = _get_warning_and_exception_classes(prefix)\n\n        out = io.StringIO()\n\n        for name, cls in classes:\n            out.write(f\".. _{name}:\\n\\n\")\n            msg = f\"{cls.__name__}: {cls.get_short_name()}\"\n            if not isinstance(msg, str):\n                msg = msg.decode('utf-8')\n            out.write(msg)\n            out.write('\\n')\n            out.write('~' * len(msg))\n            out.write('\\n\\n')\n            doc = cls.__doc__\n            if not isinstance(doc, str):\n                doc = doc.decode('utf-8')\n            out.write(dedent(doc))\n            out.write('\\n\\n')\n\n        return out.getvalue()\n\n    warnings = generate_set('W')\n    exceptions = generate_set('E')\n\n    return {'warnings': warnings,\n            'exceptions': exceptions}\n\n\nif __doc__ is not None:\n    __doc__ = __doc__.format(**_build_doc_string())\n\n__all__.extend([x[0] for x in _get_warning_and_exception_classes('W')])\n__all__.extend([x[0] for x in _get_warning_and_exception_classes('E')])\n"},{"attributeType":"SphericalRepresentation","col":0,"comment":"null","endLoc":11,"id":5663,"name":"sr","nodeType":"Attribute","startLoc":11,"text":"sr"},{"attributeType":"null","col":4,"comment":"null","endLoc":221,"id":5664,"name":"continuation_char","nodeType":"Attribute","startLoc":221,"text":"continuation_char"},{"attributeType":"null","col":4,"comment":"null","endLoc":222,"id":5665,"name":"multiline_char","nodeType":"Attribute","startLoc":222,"text":"multiline_char"},{"attributeType":"null","col":4,"comment":"null","endLoc":223,"id":5666,"name":"replace_char","nodeType":"Attribute","startLoc":223,"text":"replace_char"},{"attributeType":"null","col":4,"comment":"null","endLoc":224,"id":5667,"name":"re_multiline","nodeType":"Attribute","startLoc":224,"text":"re_multiline"},{"attributeType":"null","col":16,"comment":"null","endLoc":13,"id":5668,"name":"np","nodeType":"Attribute","startLoc":13,"text":"np"},{"attributeType":"null","col":20,"comment":"null","endLoc":14,"id":5669,"name":"itt","nodeType":"Attribute","startLoc":14,"text":"itt"},{"col":0,"comment":"","endLoc":9,"header":"daophot.py#<anonymous>","id":5670,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nAn extensible ASCII table reader and writer.\n\nClasses to read DAOphot table format\n\n:Copyright: Smithsonian Astrophysical Observatory (2011)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\""},{"fileName":"table.py","filePath":"astropy/io/votable","id":5671,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis file contains a contains the high-level functions to read a\nVOTable file.\n\"\"\"\n\n# STDLIB\nimport io\nimport os\nimport sys\nimport textwrap\nimport warnings\n\n# LOCAL\nfrom . import exceptions\nfrom . import tree\nfrom astropy.utils.xml import iterparser\nfrom astropy.utils import data\nfrom astropy.utils.decorators import deprecated_renamed_argument\n\n__all__ = ['parse', 'parse_single_table', 'from_table', 'writeto', 'validate',\n           'reset_vo_warnings']\n\nVERIFY_OPTIONS = ['ignore', 'warn', 'exception']\n\n\n@deprecated_renamed_argument('pedantic', 'verify', since='5.0')\ndef parse(source, columns=None, invalid='exception', verify=None,\n          chunk_size=tree.DEFAULT_CHUNK_SIZE, table_number=None,\n          table_id=None, filename=None, unit_format=None,\n          datatype_mapping=None, _debug_python_based_parser=False):\n    \"\"\"\n    Parses a VOTABLE_ xml file (or file-like object), and returns a\n    `~astropy.io.votable.tree.VOTableFile` object.\n\n    Parameters\n    ----------\n    source : path-like or file-like\n        Path or file-like object containing a VOTABLE_ xml file.\n        If file, must be readable.\n\n    columns : sequence of str, optional\n        List of field names to include in the output.  The default is\n        to include all fields.\n\n    invalid : str, optional\n        One of the following values:\n\n            - 'exception': throw an exception when an invalid value is\n              encountered (default)\n\n            - 'mask': mask out invalid values\n\n    verify : {'ignore', 'warn', 'exception'}, optional\n        When ``'exception'``, raise an error when the file violates the spec,\n        otherwise either issue a warning (``'warn'``) or silently continue\n        (``'ignore'``). Warnings may be controlled using the standard Python\n        mechanisms.  See the `warnings` module in the Python standard library\n        for more information. When not provided, uses the configuration setting\n        ``astropy.io.votable.verify``, which defaults to 'ignore'.\n\n        .. versionchanged:: 4.0\n           ``verify`` replaces the ``pedantic`` argument, which will be\n           deprecated in future.\n        .. versionchanged:: 5.0\n            The ``pedantic`` argument is deprecated.\n\n    chunk_size : int, optional\n        The number of rows to read before converting to an array.\n        Higher numbers are likely to be faster, but will consume more\n        memory.\n\n    table_number : int, optional\n        The number of table in the file to read in.  If `None`, all\n        tables will be read.  If a number, 0 refers to the first table\n        in the file, and only that numbered table will be parsed and\n        read in.  Should not be used with ``table_id``.\n\n    table_id : str, optional\n        The ID of the table in the file to read in.  Should not be\n        used with ``table_number``.\n\n    filename : str, optional\n        A filename, URL or other identifier to use in error messages.\n        If *filename* is None and *source* is a string (i.e. a path),\n        then *source* will be used as a filename for error messages.\n        Therefore, *filename* is only required when source is a\n        file-like object.\n\n    unit_format : str, astropy.units.format.Base instance or None, optional\n        The unit format to use when parsing unit attributes.  If a\n        string, must be the name of a unit formatter. The built-in\n        formats include ``generic``, ``fits``, ``cds``, and\n        ``vounit``.  A custom formatter may be provided by passing a\n        `~astropy.units.UnitBase` instance.  If `None` (default),\n        the unit format to use will be the one specified by the\n        VOTable specification (which is ``cds`` up to version 1.3 of\n        VOTable, and ``vounit`` in more recent versions of the spec).\n\n    datatype_mapping : dict, optional\n        A mapping of datatype names (`str`) to valid VOTable datatype names\n        (str). For example, if the file being read contains the datatype\n        \"unsignedInt\" (an invalid datatype in VOTable), include the mapping\n        ``{\"unsignedInt\": \"long\"}``.\n\n    Returns\n    -------\n    votable : `~astropy.io.votable.tree.VOTableFile` object\n\n    See Also\n    --------\n    astropy.io.votable.exceptions : The exceptions this function may raise.\n    \"\"\"\n    from . import conf\n\n    invalid = invalid.lower()\n    if invalid not in ('exception', 'mask'):\n        raise ValueError(\"accepted values of ``invalid`` are: \"\n                         \"``'exception'`` or ``'mask'``.\")\n\n    if verify is None:\n\n        conf_verify_lowercase = conf.verify.lower()\n\n        # We need to allow verify to be booleans as strings since the\n        # configuration framework doesn't make it easy/possible to have mixed\n        # types.\n        if conf_verify_lowercase in ['false', 'true']:\n            verify = conf_verify_lowercase == 'true'\n        else:\n            verify = conf_verify_lowercase\n\n    if isinstance(verify, bool):\n        verify = 'exception' if verify else 'warn'\n    elif verify not in VERIFY_OPTIONS:\n        raise ValueError(f\"verify should be one of {'/'.join(VERIFY_OPTIONS)}\")\n\n    if datatype_mapping is None:\n        datatype_mapping = {}\n\n    config = {\n        'columns': columns,\n        'invalid': invalid,\n        'verify': verify,\n        'chunk_size': chunk_size,\n        'table_number': table_number,\n        'filename': filename,\n        'unit_format': unit_format,\n        'datatype_mapping': datatype_mapping\n    }\n\n    if filename is None and isinstance(source, str):\n        config['filename'] = source\n\n    with iterparser.get_xml_iterator(\n            source,\n            _debug_python_based_parser=_debug_python_based_parser) as iterator:\n        return tree.VOTableFile(\n            config=config, pos=(1, 1)).parse(iterator, config)\n\n\ndef parse_single_table(source, **kwargs):\n    \"\"\"\n    Parses a VOTABLE_ xml file (or file-like object), reading and\n    returning only the first `~astropy.io.votable.tree.Table`\n    instance.\n\n    See `parse` for a description of the keyword arguments.\n\n    Returns\n    -------\n    votable : `~astropy.io.votable.tree.Table` object\n    \"\"\"\n    if kwargs.get('table_number') is None:\n        kwargs['table_number'] = 0\n\n    votable = parse(source, **kwargs)\n\n    return votable.get_first_table()\n\n\ndef writeto(table, file, tabledata_format=None):\n    \"\"\"\n    Writes a `~astropy.io.votable.tree.VOTableFile` to a VOTABLE_ xml file.\n\n    Parameters\n    ----------\n    table : `~astropy.io.votable.tree.VOTableFile` or `~astropy.table.Table` instance.\n\n    file : str or writable file-like\n        Path or file object to write to\n\n    tabledata_format : str, optional\n        Override the format of the table(s) data to write.  Must be\n        one of ``tabledata`` (text representation), ``binary`` or\n        ``binary2``.  By default, use the format that was specified in\n        each ``table`` object as it was created or read in.  See\n        :ref:`astropy:astropy:votable-serialization`.\n    \"\"\"\n    from astropy.table import Table\n    if isinstance(table, Table):\n        table = tree.VOTableFile.from_table(table)\n    elif not isinstance(table, tree.VOTableFile):\n        raise TypeError(\n            \"first argument must be astropy.io.vo.VOTableFile or \"\n            \"astropy.table.Table instance\")\n    table.to_xml(file, tabledata_format=tabledata_format,\n                 _debug_python_based_parser=True)\n\n\ndef validate(source, output=sys.stdout, xmllint=False, filename=None):\n    \"\"\"\n    Prints a validation report for the given file.\n\n    Parameters\n    ----------\n    source : path-like or file-like\n        Path to a VOTABLE_ xml file or `~pathlib.Path`\n        object having Path to a VOTABLE_ xml file.\n        If file-like object, must be readable.\n\n    output : file-like, optional\n        Where to output the report.  Defaults to ``sys.stdout``.\n        If `None`, the output will be returned as a string.\n        Must be writable.\n\n    xmllint : bool, optional\n        When `True`, also send the file to ``xmllint`` for schema and\n        DTD validation.  Requires that ``xmllint`` is installed.  The\n        default is `False`.  ``source`` must be a file on the local\n        filesystem in order for ``xmllint`` to work.\n\n    filename : str, optional\n        A filename to use in the error messages.  If not provided, one\n        will be automatically determined from ``source``.\n\n    Returns\n    -------\n    is_valid : bool or str\n        Returns `True` if no warnings were found.  If ``output`` is\n        `None`, the return value will be a string.\n    \"\"\"\n\n    from astropy.utils.console import print_code_line, color_print\n\n    return_as_str = False\n    if output is None:\n        output = io.StringIO()\n        return_as_str = True\n\n    lines = []\n    votable = None\n\n    reset_vo_warnings()\n\n    with data.get_readable_fileobj(source, encoding='binary') as fd:\n        content = fd.read()\n    content_buffer = io.BytesIO(content)\n    content_buffer.seek(0)\n\n    if filename is None:\n        if isinstance(source, str):\n            filename = source\n        elif hasattr(source, 'name'):\n            filename = source.name\n        elif hasattr(source, 'url'):\n            filename = source.url\n        else:\n            filename = \"<unknown>\"\n\n    with warnings.catch_warnings(record=True) as warning_lines:\n        warnings.resetwarnings()\n        warnings.simplefilter(\"always\", exceptions.VOWarning, append=True)\n        try:\n            votable = parse(content_buffer, verify='warn', filename=filename)\n        except ValueError as e:\n            lines.append(str(e))\n\n    lines = [str(x.message) for x in warning_lines if\n             issubclass(x.category, exceptions.VOWarning)] + lines\n\n    content_buffer.seek(0)\n    output.write(f\"Validation report for {filename}\\n\\n\")\n\n    if len(lines):\n        xml_lines = iterparser.xml_readlines(content_buffer)\n\n        for warning in lines:\n            w = exceptions.parse_vowarning(warning)\n\n            if not w['is_something']:\n                output.write(w['message'])\n                output.write('\\n\\n')\n            else:\n                line = xml_lines[w['nline'] - 1]\n                warning = w['warning']\n                if w['is_warning']:\n                    color = 'yellow'\n                else:\n                    color = 'red'\n                color_print(\n                    f\"{w['nline']:d}: \", '',\n                    warning or 'EXC', color,\n                    ': ', '',\n                    textwrap.fill(\n                        w['message'],\n                        initial_indent='          ',\n                        subsequent_indent='  ').lstrip(),\n                    file=output)\n                print_code_line(line, w['nchar'], file=output)\n            output.write('\\n')\n    else:\n        output.write('astropy.io.votable found no violations.\\n\\n')\n\n    success = 0\n    if xmllint and os.path.exists(filename):\n        from . import xmlutil\n\n        if votable is None:\n            version = \"1.1\"\n        else:\n            version = votable.version\n        success, stdout, stderr = xmlutil.validate_schema(\n            filename, version)\n\n        if success != 0:\n            output.write(\n                'xmllint schema violations:\\n\\n')\n            output.write(stderr.decode('utf-8'))\n        else:\n            output.write('xmllint passed\\n')\n\n    if return_as_str:\n        return output.getvalue()\n    return len(lines) == 0 and success == 0\n\n\ndef from_table(table, table_id=None):\n    \"\"\"\n    Given an `~astropy.table.Table` object, return a\n    `~astropy.io.votable.tree.VOTableFile` file structure containing\n    just that single table.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table` instance\n\n    table_id : str, optional\n        If not `None`, set the given id on the returned\n        `~astropy.io.votable.tree.Table` instance.\n\n    Returns\n    -------\n    votable : `~astropy.io.votable.tree.VOTableFile` instance\n    \"\"\"\n    return tree.VOTableFile.from_table(table, table_id=table_id)\n\n\ndef is_votable(source):\n    \"\"\"\n    Reads the header of a file to determine if it is a VOTable file.\n\n    Parameters\n    ----------\n    source : path-like or file-like\n        Path or file object containing a VOTABLE_ xml file.\n        If file, must be readable.\n\n    Returns\n    -------\n    is_votable : bool\n        Returns `True` if the given file is a VOTable file.\n    \"\"\"\n    try:\n        with iterparser.get_xml_iterator(source) as iterator:\n            for start, tag, d, pos in iterator:\n                if tag != 'xml':\n                    return False\n                break\n\n            for start, tag, d, pos in iterator:\n                if tag != 'VOTABLE':\n                    return False\n                break\n\n            return True\n    except ValueError:\n        return False\n\n\ndef reset_vo_warnings():\n    \"\"\"\n    Resets all of the vo warning state so that warnings that\n    have already been emitted will be emitted again. This is\n    used, for example, by `validate` which must emit all\n    warnings each time it is called.\n\n    \"\"\"\n    from . import converters, xmlutil\n\n    # -----------------------------------------------------------#\n    #  This is a special variable used by the Python warnings    #\n    #  infrastructure to keep track of warnings that have        #\n    #  already been seen.  Since we want to get every single     #\n    #  warning out of this, we have to delete all of them first. #\n    # -----------------------------------------------------------#\n    for module in (converters, exceptions, tree, xmlutil):\n        try:\n            del module.__warningregistry__\n        except AttributeError:\n            pass\n"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.io.votable.exceptions`.\n    ","endLoc":60,"id":5672,"nodeType":"Class","startLoc":52,"text":"class Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.io.votable.exceptions`.\n    \"\"\"\n    max_warnings = _config.ConfigItem(\n        10,\n        'Number of times the same type of warning is displayed '\n        'before being suppressed',\n        cfgtype='integer')"},{"attributeType":"CartesianRepresentation","col":0,"comment":"null","endLoc":13,"id":5673,"name":"cr","nodeType":"Attribute","startLoc":13,"text":"cr"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":56,"id":5674,"name":"max_warnings","nodeType":"Attribute","startLoc":56,"text":"max_warnings"},{"col":4,"comment":"Write header.\n\n        The width of each column is determined in Ipac.write. Writing the header\n        must be delayed until that time.\n        This function is called from there, once the width information is\n        available.","endLoc":303,"header":"def write(self, lines, widths)","id":5675,"name":"write","nodeType":"Function","startLoc":293,"text":"def write(self, lines, widths):\n        '''Write header.\n\n        The width of each column is determined in Ipac.write. Writing the header\n        must be delayed until that time.\n        This function is called from there, once the width information is\n        available.'''\n\n        for vals in self.str_vals():\n            lines.append(self.splitter.join(vals, widths))\n        return lines"},{"className":"VOWarning","col":0,"comment":"\n    The base class of all VO warnings and exceptions.\n\n    Handles the formatting of the message with a warning or exception\n    code, filename, line and column number.\n    ","endLoc":228,"id":5676,"nodeType":"Class","startLoc":200,"text":"class VOWarning(AstropyWarning):\n    \"\"\"\n    The base class of all VO warnings and exceptions.\n\n    Handles the formatting of the message with a warning or exception\n    code, filename, line and column number.\n    \"\"\"\n    default_args = ()\n    message_template = ''\n\n    def __init__(self, args, config=None, pos=None):\n        if config is None:\n            config = {}\n        if not isinstance(args, tuple):\n            args = (args, )\n        msg = self.message_template.format(*args)\n\n        self.formatted_message = _format_message(\n            msg, self.__class__.__name__, config, pos)\n        Warning.__init__(self, self.formatted_message)\n\n    def __str__(self):\n        return self.formatted_message\n\n    @classmethod\n    def get_short_name(cls):\n        if len(cls.default_args):\n            return cls.message_template.format(*cls.default_args)\n        return cls.message_template"},{"col":4,"comment":"null","endLoc":219,"header":"def __init__(self, args, config=None, pos=None)","id":5677,"name":"__init__","nodeType":"Function","startLoc":210,"text":"def __init__(self, args, config=None, pos=None):\n        if config is None:\n            config = {}\n        if not isinstance(args, tuple):\n            args = (args, )\n        msg = self.message_template.format(*args)\n\n        self.formatted_message = _format_message(\n            msg, self.__class__.__name__, config, pos)\n        Warning.__init__(self, self.formatted_message)"},{"attributeType":"IpacHeaderSplitter","col":4,"comment":"null","endLoc":68,"id":5678,"name":"splitter_class","nodeType":"Attribute","startLoc":68,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":73,"id":5679,"name":"col_type_list","nodeType":"Attribute","startLoc":73,"text":"col_type_list"},{"attributeType":"null","col":4,"comment":"null","endLoc":80,"id":5680,"name":"definition","nodeType":"Attribute","startLoc":80,"text":"definition"},{"attributeType":"None","col":4,"comment":"null","endLoc":81,"id":5681,"name":"start_line","nodeType":"Attribute","startLoc":81,"text":"start_line"},{"attributeType":"null","col":8,"comment":"null","endLoc":214,"id":5682,"name":"names","nodeType":"Attribute","startLoc":214,"text":"self.names"},{"attributeType":"null","col":8,"comment":"null","endLoc":215,"id":5683,"name":"cols","nodeType":"Attribute","startLoc":215,"text":"self.cols"},{"className":"IpacDataSplitter","col":0,"comment":"null","endLoc":309,"id":5684,"nodeType":"Class","startLoc":306,"text":"class IpacDataSplitter(fixedwidth.FixedWidthSplitter):\n    delimiter = ' '\n    delimiter_pad = ''\n    bookend = True"},{"attributeType":"null","col":4,"comment":"null","endLoc":307,"id":5685,"name":"delimiter","nodeType":"Attribute","startLoc":307,"text":"delimiter"},{"attributeType":"null","col":4,"comment":"null","endLoc":308,"id":5686,"name":"delimiter_pad","nodeType":"Attribute","startLoc":308,"text":"delimiter_pad"},{"attributeType":"null","col":4,"comment":"null","endLoc":309,"id":5687,"name":"bookend","nodeType":"Attribute","startLoc":309,"text":"bookend"},{"className":"IpacData","col":0,"comment":"IPAC table data reader","endLoc":323,"id":5688,"nodeType":"Class","startLoc":312,"text":"class IpacData(fixedwidth.FixedWidthData):\n    \"\"\"IPAC table data reader\"\"\"\n    comment = r'[|\\\\]'\n    start_line = 0\n    splitter_class = IpacDataSplitter\n    fill_values = [(core.masked, 'null')]\n\n    def write(self, lines, widths, vals_list):\n        \"\"\" IPAC writer, modified from FixedWidth writer \"\"\"\n        for vals in vals_list:\n            lines.append(self.splitter.join(vals, widths))\n        return lines"},{"col":0,"comment":"null","endLoc":72,"header":"def _format_message(message, name, config=None, pos=None)","id":5689,"name":"_format_message","nodeType":"Function","startLoc":66,"text":"def _format_message(message, name, config=None, pos=None):\n    if config is None:\n        config = {}\n    if pos is None:\n        pos = ('?', '?')\n    filename = config.get('filename', '?')\n    return f'{filename}:{pos[0]}:{pos[1]}: {name}: {message}'"},{"col":0,"comment":"\n    Parses a VOTABLE_ xml file (or file-like object), and returns a\n    `~astropy.io.votable.tree.VOTableFile` object.\n\n    Parameters\n    ----------\n    source : path-like or file-like\n        Path or file-like object containing a VOTABLE_ xml file.\n        If file, must be readable.\n\n    columns : sequence of str, optional\n        List of field names to include in the output.  The default is\n        to include all fields.\n\n    invalid : str, optional\n        One of the following values:\n\n            - 'exception': throw an exception when an invalid value is\n              encountered (default)\n\n            - 'mask': mask out invalid values\n\n    verify : {'ignore', 'warn', 'exception'}, optional\n        When ``'exception'``, raise an error when the file violates the spec,\n        otherwise either issue a warning (``'warn'``) or silently continue\n        (``'ignore'``). Warnings may be controlled using the standard Python\n        mechanisms.  See the `warnings` module in the Python standard library\n        for more information. When not provided, uses the configuration setting\n        ``astropy.io.votable.verify``, which defaults to 'ignore'.\n\n        .. versionchanged:: 4.0\n           ``verify`` replaces the ``pedantic`` argument, which will be\n           deprecated in future.\n        .. versionchanged:: 5.0\n            The ``pedantic`` argument is deprecated.\n\n    chunk_size : int, optional\n        The number of rows to read before converting to an array.\n        Higher numbers are likely to be faster, but will consume more\n        memory.\n\n    table_number : int, optional\n        The number of table in the file to read in.  If `None`, all\n        tables will be read.  If a number, 0 refers to the first table\n        in the file, and only that numbered table will be parsed and\n        read in.  Should not be used with ``table_id``.\n\n    table_id : str, optional\n        The ID of the table in the file to read in.  Should not be\n        used with ``table_number``.\n\n    filename : str, optional\n        A filename, URL or other identifier to use in error messages.\n        If *filename* is None and *source* is a string (i.e. a path),\n        then *source* will be used as a filename for error messages.\n        Therefore, *filename* is only required when source is a\n        file-like object.\n\n    unit_format : str, astropy.units.format.Base instance or None, optional\n        The unit format to use when parsing unit attributes.  If a\n        string, must be the name of a unit formatter. The built-in\n        formats include ``generic``, ``fits``, ``cds``, and\n        ``vounit``.  A custom formatter may be provided by passing a\n        `~astropy.units.UnitBase` instance.  If `None` (default),\n        the unit format to use will be the one specified by the\n        VOTable specification (which is ``cds`` up to version 1.3 of\n        VOTable, and ``vounit`` in more recent versions of the spec).\n\n    datatype_mapping : dict, optional\n        A mapping of datatype names (`str`) to valid VOTable datatype names\n        (str). For example, if the file being read contains the datatype\n        \"unsignedInt\" (an invalid datatype in VOTable), include the mapping\n        ``{\"unsignedInt\": \"long\"}``.\n\n    Returns\n    -------\n    votable : `~astropy.io.votable.tree.VOTableFile` object\n\n    See Also\n    --------\n    astropy.io.votable.exceptions : The exceptions this function may raise.\n    ","endLoc":160,"header":"@deprecated_renamed_argument('pedantic', 'verify', since='5.0')\ndef parse(source, columns=None, invalid='exception', verify=None,\n          chunk_size=tree.DEFAULT_CHUNK_SIZE, table_number=None,\n          table_id=None, filename=None, unit_format=None,\n          datatype_mapping=None, _debug_python_based_parser=False)","id":5690,"name":"parse","nodeType":"Function","startLoc":28,"text":"@deprecated_renamed_argument('pedantic', 'verify', since='5.0')\ndef parse(source, columns=None, invalid='exception', verify=None,\n          chunk_size=tree.DEFAULT_CHUNK_SIZE, table_number=None,\n          table_id=None, filename=None, unit_format=None,\n          datatype_mapping=None, _debug_python_based_parser=False):\n    \"\"\"\n    Parses a VOTABLE_ xml file (or file-like object), and returns a\n    `~astropy.io.votable.tree.VOTableFile` object.\n\n    Parameters\n    ----------\n    source : path-like or file-like\n        Path or file-like object containing a VOTABLE_ xml file.\n        If file, must be readable.\n\n    columns : sequence of str, optional\n        List of field names to include in the output.  The default is\n        to include all fields.\n\n    invalid : str, optional\n        One of the following values:\n\n            - 'exception': throw an exception when an invalid value is\n              encountered (default)\n\n            - 'mask': mask out invalid values\n\n    verify : {'ignore', 'warn', 'exception'}, optional\n        When ``'exception'``, raise an error when the file violates the spec,\n        otherwise either issue a warning (``'warn'``) or silently continue\n        (``'ignore'``). Warnings may be controlled using the standard Python\n        mechanisms.  See the `warnings` module in the Python standard library\n        for more information. When not provided, uses the configuration setting\n        ``astropy.io.votable.verify``, which defaults to 'ignore'.\n\n        .. versionchanged:: 4.0\n           ``verify`` replaces the ``pedantic`` argument, which will be\n           deprecated in future.\n        .. versionchanged:: 5.0\n            The ``pedantic`` argument is deprecated.\n\n    chunk_size : int, optional\n        The number of rows to read before converting to an array.\n        Higher numbers are likely to be faster, but will consume more\n        memory.\n\n    table_number : int, optional\n        The number of table in the file to read in.  If `None`, all\n        tables will be read.  If a number, 0 refers to the first table\n        in the file, and only that numbered table will be parsed and\n        read in.  Should not be used with ``table_id``.\n\n    table_id : str, optional\n        The ID of the table in the file to read in.  Should not be\n        used with ``table_number``.\n\n    filename : str, optional\n        A filename, URL or other identifier to use in error messages.\n        If *filename* is None and *source* is a string (i.e. a path),\n        then *source* will be used as a filename for error messages.\n        Therefore, *filename* is only required when source is a\n        file-like object.\n\n    unit_format : str, astropy.units.format.Base instance or None, optional\n        The unit format to use when parsing unit attributes.  If a\n        string, must be the name of a unit formatter. The built-in\n        formats include ``generic``, ``fits``, ``cds``, and\n        ``vounit``.  A custom formatter may be provided by passing a\n        `~astropy.units.UnitBase` instance.  If `None` (default),\n        the unit format to use will be the one specified by the\n        VOTable specification (which is ``cds`` up to version 1.3 of\n        VOTable, and ``vounit`` in more recent versions of the spec).\n\n    datatype_mapping : dict, optional\n        A mapping of datatype names (`str`) to valid VOTable datatype names\n        (str). For example, if the file being read contains the datatype\n        \"unsignedInt\" (an invalid datatype in VOTable), include the mapping\n        ``{\"unsignedInt\": \"long\"}``.\n\n    Returns\n    -------\n    votable : `~astropy.io.votable.tree.VOTableFile` object\n\n    See Also\n    --------\n    astropy.io.votable.exceptions : The exceptions this function may raise.\n    \"\"\"\n    from . import conf\n\n    invalid = invalid.lower()\n    if invalid not in ('exception', 'mask'):\n        raise ValueError(\"accepted values of ``invalid`` are: \"\n                         \"``'exception'`` or ``'mask'``.\")\n\n    if verify is None:\n\n        conf_verify_lowercase = conf.verify.lower()\n\n        # We need to allow verify to be booleans as strings since the\n        # configuration framework doesn't make it easy/possible to have mixed\n        # types.\n        if conf_verify_lowercase in ['false', 'true']:\n            verify = conf_verify_lowercase == 'true'\n        else:\n            verify = conf_verify_lowercase\n\n    if isinstance(verify, bool):\n        verify = 'exception' if verify else 'warn'\n    elif verify not in VERIFY_OPTIONS:\n        raise ValueError(f\"verify should be one of {'/'.join(VERIFY_OPTIONS)}\")\n\n    if datatype_mapping is None:\n        datatype_mapping = {}\n\n    config = {\n        'columns': columns,\n        'invalid': invalid,\n        'verify': verify,\n        'chunk_size': chunk_size,\n        'table_number': table_number,\n        'filename': filename,\n        'unit_format': unit_format,\n        'datatype_mapping': datatype_mapping\n    }\n\n    if filename is None and isinstance(source, str):\n        config['filename'] = source\n\n    with iterparser.get_xml_iterator(\n            source,\n            _debug_python_based_parser=_debug_python_based_parser) as iterator:\n        return tree.VOTableFile(\n            config=config, pos=(1, 1)).parse(iterator, config)"},{"col":4,"comment":" IPAC writer, modified from FixedWidth writer ","endLoc":323,"header":"def write(self, lines, widths, vals_list)","id":5691,"name":"write","nodeType":"Function","startLoc":319,"text":"def write(self, lines, widths, vals_list):\n        \"\"\" IPAC writer, modified from FixedWidth writer \"\"\"\n        for vals in vals_list:\n            lines.append(self.splitter.join(vals, widths))\n        return lines"},{"attributeType":"SphericalCosLatDifferential","col":0,"comment":"null","endLoc":15,"id":5692,"name":"sd","nodeType":"Attribute","startLoc":15,"text":"sd"},{"attributeType":"null","col":4,"comment":"null","endLoc":314,"id":5693,"name":"comment","nodeType":"Attribute","startLoc":314,"text":"comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":315,"id":5694,"name":"start_line","nodeType":"Attribute","startLoc":315,"text":"start_line"},{"attributeType":"IpacDataSplitter","col":4,"comment":"null","endLoc":316,"id":5695,"name":"splitter_class","nodeType":"Attribute","startLoc":316,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":317,"id":5696,"name":"fill_values","nodeType":"Attribute","startLoc":317,"text":"fill_values"},{"attributeType":"SphericalRepresentation","col":0,"comment":"null","endLoc":17,"id":5697,"name":"srd","nodeType":"Attribute","startLoc":17,"text":"srd"},{"col":4,"comment":"null","endLoc":222,"header":"def __str__(self)","id":5698,"name":"__str__","nodeType":"Function","startLoc":221,"text":"def __str__(self):\n        return self.formatted_message"},{"col":4,"comment":"null","endLoc":228,"header":"@classmethod\n    def get_short_name(cls)","id":5699,"name":"get_short_name","nodeType":"Function","startLoc":224,"text":"@classmethod\n    def get_short_name(cls):\n        if len(cls.default_args):\n            return cls.message_template.format(*cls.default_args)\n        return cls.message_template"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":19,"id":5700,"name":"sc","nodeType":"Attribute","startLoc":19,"text":"sc"},{"col":0,"comment":"","endLoc":9,"header":"ipac.py#<anonymous>","id":5701,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"An extensible ASCII table reader and writer.\n\nipac.py:\n  Classes to read IPAC table format\n\n:Copyright: Smithsonian Astrophysical Observatory (2011)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)\n\"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":207,"id":5702,"name":"default_args","nodeType":"Attribute","startLoc":207,"text":"default_args"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":21,"id":5703,"name":"scd","nodeType":"Attribute","startLoc":21,"text":"scd"},{"attributeType":"null","col":4,"comment":"null","endLoc":208,"id":5704,"name":"message_template","nodeType":"Attribute","startLoc":208,"text":"message_template"},{"attributeType":"null","col":8,"comment":"null","endLoc":217,"id":5705,"name":"formatted_message","nodeType":"Attribute","startLoc":217,"text":"self.formatted_message"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":5706,"name":"scdc","nodeType":"Attribute","startLoc":24,"text":"scdc"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":5707,"name":"representation_type","nodeType":"Attribute","startLoc":25,"text":"scdc.representation_type"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":26,"id":5708,"name":"scpm","nodeType":"Attribute","startLoc":26,"text":"scpm"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":29,"id":5709,"name":"scpmrv","nodeType":"Attribute","startLoc":29,"text":"scpmrv"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":33,"id":5710,"name":"scrv","nodeType":"Attribute","startLoc":33,"text":"scrv"},{"className":"VOTableChangeWarning","col":0,"comment":"\n    A change has been made to the input XML file.\n    ","endLoc":234,"id":5711,"nodeType":"Class","startLoc":231,"text":"class VOTableChangeWarning(VOWarning, SyntaxWarning):\n    \"\"\"\n    A change has been made to the input XML file.\n    \"\"\""},{"className":"VOTableSpecWarning","col":0,"comment":"\n    The input XML file violates the spec, but there is an obvious workaround.\n    ","endLoc":240,"id":5712,"nodeType":"Class","startLoc":237,"text":"class VOTableSpecWarning(VOWarning, SyntaxWarning):\n    \"\"\"\n    The input XML file violates the spec, but there is an obvious workaround.\n    \"\"\""},{"className":"UnimplementedWarning","col":0,"comment":"\n    A feature of the VOTABLE_ spec is not implemented.\n    ","endLoc":246,"id":5713,"nodeType":"Class","startLoc":243,"text":"class UnimplementedWarning(VOWarning, SyntaxWarning):\n    \"\"\"\n    A feature of the VOTABLE_ spec is not implemented.\n    \"\"\""},{"fileName":"util.py","filePath":"astropy/io/votable","id":5714,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nVarious utilities and cookbook-like things.\n\"\"\"\n\n\n# STDLIB\nimport codecs\nimport contextlib\nimport io\nimport re\nimport gzip\n\nfrom packaging.version import Version\n\n\n__all__ = [\n    'convert_to_writable_filelike',\n    'stc_reference_frames',\n    'coerce_range_list_param',\n    ]\n\n\n@contextlib.contextmanager\ndef convert_to_writable_filelike(fd, compressed=False):\n    \"\"\"\n    Returns a writable file-like object suitable for streaming output.\n\n    Parameters\n    ----------\n    fd : str or file-like\n        May be:\n\n            - a file path string, in which case it is opened, and the file\n              object is returned.\n\n            - an object with a :meth:``write`` method, in which case that\n              object is returned.\n\n    compressed : bool, optional\n        If `True`, create a gzip-compressed file.  (Default is `False`).\n\n    Returns\n    -------\n    fd : writable file-like\n    \"\"\"\n    if isinstance(fd, str):\n        if fd.endswith('.gz') or compressed:\n            with gzip.GzipFile(fd, 'wb') as real_fd:\n                encoded_fd = io.TextIOWrapper(real_fd, encoding='utf8')\n                yield encoded_fd\n                encoded_fd.flush()\n                real_fd.flush()\n                return\n        else:\n            with open(fd, 'wt', encoding='utf8') as real_fd:\n                yield real_fd\n                return\n    elif hasattr(fd, 'write'):\n        assert callable(fd.write)\n\n        if compressed:\n            fd = gzip.GzipFile(fileobj=fd)\n\n        # If we can't write Unicode strings, use a codecs.StreamWriter\n        # object\n        needs_wrapper = False\n        try:\n            fd.write('')\n        except TypeError:\n            needs_wrapper = True\n\n        if not hasattr(fd, 'encoding') or fd.encoding is None:\n            needs_wrapper = True\n\n        if needs_wrapper:\n            yield codecs.getwriter('utf-8')(fd)\n            fd.flush()\n        else:\n            yield fd\n            fd.flush()\n\n        return\n    else:\n        raise TypeError(\"Can not be coerced to writable file-like object\")\n\n\n# <http://www.ivoa.net/documents/REC/DM/STC-20071030.html>\nstc_reference_frames = set([\n    'FK4', 'FK5', 'ECLIPTIC', 'ICRS', 'GALACTIC', 'GALACTIC_I', 'GALACTIC_II',\n    'SUPER_GALACTIC', 'AZ_EL', 'BODY', 'GEO_C', 'GEO_D', 'MAG', 'GSE', 'GSM',\n    'SM', 'HGC', 'HGS', 'HEEQ', 'HRTN', 'HPC', 'HPR', 'HCC', 'HGI',\n    'MERCURY_C', 'VENUS_C', 'LUNA_C', 'MARS_C', 'JUPITER_C_III',\n    'SATURN_C_III', 'URANUS_C_III', 'NEPTUNE_C_III', 'PLUTO_C', 'MERCURY_G',\n    'VENUS_G', 'LUNA_G', 'MARS_G', 'JUPITER_G_III', 'SATURN_G_III',\n    'URANUS_G_III', 'NEPTUNE_G_III', 'PLUTO_G', 'UNKNOWNFrame'])\n\n\ndef coerce_range_list_param(p, frames=None, numeric=True):\n    \"\"\"\n    Coerces and/or verifies the object *p* into a valid range-list-format parameter.\n\n    As defined in `Section 8.7.2 of Simple\n    Spectral Access Protocol\n    <http://www.ivoa.net/documents/REC/DAL/SSA-20080201.html>`_.\n\n    Parameters\n    ----------\n    p : str or sequence\n        May be a string as passed verbatim to the service expecting a\n        range-list, or a sequence.  If a sequence, each item must be\n        either:\n\n            - a numeric value\n\n            - a named value, such as, for example, 'J' for named\n              spectrum (if the *numeric* kwarg is False)\n\n            - a 2-tuple indicating a range\n\n            - the last item my be a string indicating the frame of\n              reference\n\n    frames : sequence of str, optional\n        A sequence of acceptable frame of reference keywords.  If not\n        provided, the default set in ``set_reference_frames`` will be\n        used.\n\n    numeric : bool, optional\n        TODO\n\n    Returns\n    -------\n    parts : tuple\n        The result is a tuple:\n            - a string suitable for passing to a service as a range-list\n              argument\n\n            - an integer counting the number of elements\n    \"\"\"\n    def str_or_none(x):\n        if x is None:\n            return ''\n        if numeric:\n            x = float(x)\n        return str(x)\n\n    def numeric_or_range(x):\n        if isinstance(x, tuple) and len(x) == 2:\n            return f'{str_or_none(x[0])}/{str_or_none(x[1])}'\n        else:\n            return str_or_none(x)\n\n    def is_frame_of_reference(x):\n        return isinstance(x, str)\n\n    if p is None:\n        return None, 0\n\n    elif isinstance(p, (tuple, list)):\n        has_frame_of_reference = len(p) > 1 and is_frame_of_reference(p[-1])\n        if has_frame_of_reference:\n            points = p[:-1]\n        else:\n            points = p[:]\n\n        out = ','.join([numeric_or_range(x) for x in points])\n        length = len(points)\n        if has_frame_of_reference:\n            if frames is not None and p[-1] not in frames:\n                raise ValueError(\n                    f\"'{p[-1]}' is not a valid frame of reference\")\n            out += ';' + p[-1]\n            length += 1\n\n        return out, length\n\n    elif isinstance(p, str):\n        number = r'([-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)?'\n        if not numeric:\n            number = r'(' + number + ')|([A-Z_]+)'\n        match = re.match(\n            '^' + number + r'([,/]' + number +\n            r')+(;(?P<frame>[<A-Za-z_0-9]+))?$',\n            p)\n\n        if match is None:\n            raise ValueError(f\"'{p}' is not a valid range list\")\n\n        frame = match.groupdict()['frame']\n        if frames is not None and frame is not None and frame not in frames:\n            raise ValueError(\n                f\"'{frame}' is not a valid frame of reference\")\n        return p, p.count(',') + p.count(';') + 1\n\n    try:\n        float(p)\n        return str(p), 1\n    except TypeError:\n        raise ValueError(f\"'{p}' is not a valid range list\")\n\n\ndef version_compare(a, b):\n    \"\"\"\n    Compare two VOTable version identifiers.\n    \"\"\"\n    def version_to_tuple(v):\n        if v[0].lower() == 'v':\n            v = v[1:]\n        return Version(v)\n    av = version_to_tuple(a)\n    bv = version_to_tuple(b)\n    # Can't use cmp because it was removed from Python 3.x\n    return (av > bv) - (av < bv)\n"},{"className":"IOWarning","col":0,"comment":"\n    A network or IO error occurred, but was recovered using the cache.\n    ","endLoc":252,"id":5715,"nodeType":"Class","startLoc":249,"text":"class IOWarning(VOWarning, RuntimeWarning):\n    \"\"\"\n    A network or IO error occurred, but was recovered using the cache.\n    \"\"\""},{"col":0,"comment":"\n    Returns an iterator over the elements of an XML file.\n\n    The iterator doesn't ever build a tree, so it is much more memory\n    and time efficient than the alternative in ``cElementTree``.\n\n    Parameters\n    ----------\n    source : path-like, readable file-like, or callable\n        Handle that contains the data or function that reads it.\n        If a function or callable object, it must directly read from a stream.\n        Non-callable objects must define a ``read`` method.\n\n    Returns\n    -------\n    parts : iterator\n\n        The iterator returns 4-tuples (*start*, *tag*, *data*, *pos*):\n\n            - *start*: when `True` is a start element event, otherwise\n              an end element event.\n\n            - *tag*: The name of the element\n\n            - *data*: Depends on the value of *event*:\n\n                - if *start* == `True`, data is a dictionary of\n                  attributes\n\n                - if *start* == `False`, data is a string containing\n                  the text content of the element\n\n            - *pos*: Tuple (*line*, *col*) indicating the source of the\n              event.\n    ","endLoc":165,"header":"@contextlib.contextmanager\ndef get_xml_iterator(source, _debug_python_based_parser=False)","id":5716,"name":"get_xml_iterator","nodeType":"Function","startLoc":123,"text":"@contextlib.contextmanager\ndef get_xml_iterator(source, _debug_python_based_parser=False):\n    \"\"\"\n    Returns an iterator over the elements of an XML file.\n\n    The iterator doesn't ever build a tree, so it is much more memory\n    and time efficient than the alternative in ``cElementTree``.\n\n    Parameters\n    ----------\n    source : path-like, readable file-like, or callable\n        Handle that contains the data or function that reads it.\n        If a function or callable object, it must directly read from a stream.\n        Non-callable objects must define a ``read`` method.\n\n    Returns\n    -------\n    parts : iterator\n\n        The iterator returns 4-tuples (*start*, *tag*, *data*, *pos*):\n\n            - *start*: when `True` is a start element event, otherwise\n              an end element event.\n\n            - *tag*: The name of the element\n\n            - *data*: Depends on the value of *event*:\n\n                - if *start* == `True`, data is a dictionary of\n                  attributes\n\n                - if *start* == `False`, data is a string containing\n                  the text content of the element\n\n            - *pos*: Tuple (*line*, *col*) indicating the source of the\n              event.\n    \"\"\"\n    with _convert_to_fd_or_read_function(source) as fd:\n        if _debug_python_based_parser:\n            context = _slow_iterparse(fd)\n        else:\n            context = _fast_iterparse(fd)\n        yield iter(context)"},{"className":"VOTableSpecError","col":0,"comment":"\n    The input XML file violates the spec and there is no good workaround.\n    ","endLoc":258,"id":5717,"nodeType":"Class","startLoc":255,"text":"class VOTableSpecError(VOWarning, ValueError):\n    \"\"\"\n    The input XML file violates the spec and there is no good workaround.\n    \"\"\""},{"className":"W01","col":0,"comment":"\n    The VOTable spec states:\n\n        If a cell contains an array or complex number, it should be\n        encoded as multiple numbers separated by whitespace.\n\n    Many VOTable files in the wild use commas as a separator instead,\n    and ``astropy.io.votable`` can support this convention depending on the\n    :ref:`astropy:verifying-votables` setting.\n\n    ``astropy.io.votable`` always outputs files using only spaces, regardless of\n    how they were input.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#toc-header-35>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:TABLEDATA>`__\n    ","endLoc":281,"id":5718,"nodeType":"Class","startLoc":261,"text":"class W01(VOTableSpecWarning):\n    \"\"\"\n    The VOTable spec states:\n\n        If a cell contains an array or complex number, it should be\n        encoded as multiple numbers separated by whitespace.\n\n    Many VOTable files in the wild use commas as a separator instead,\n    and ``astropy.io.votable`` can support this convention depending on the\n    :ref:`astropy:verifying-votables` setting.\n\n    ``astropy.io.votable`` always outputs files using only spaces, regardless of\n    how they were input.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#toc-header-35>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:TABLEDATA>`__\n    \"\"\"\n\n    message_template = \"Array uses commas rather than whitespace\""},{"attributeType":"null","col":4,"comment":"null","endLoc":281,"id":5719,"name":"message_template","nodeType":"Attribute","startLoc":281,"text":"message_template"},{"className":"W02","col":0,"comment":"\n    XML ids must match the following regular expression::\n\n        ^[A-Za-z_][A-Za-z0-9_\\.\\-]*$\n\n    The VOTable 1.1 says the following:\n\n        According to the XML standard, the attribute ``ID`` is a\n        string beginning with a letter or underscore (``_``), followed\n        by a sequence of letters, digits, or any of the punctuation\n        characters ``.`` (dot), ``-`` (dash), ``_`` (underscore), or\n        ``:`` (colon).\n\n    However, this is in conflict with the XML standard, which says\n    colons may not be used.  VOTable 1.1's own schema does not allow a\n    colon here.  Therefore, ``astropy.io.votable`` disallows the colon.\n\n    VOTable 1.2 corrects this error in the specification.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `XML Names <http://www.w3.org/TR/REC-xml/#NT-Name>`__\n    ","endLoc":310,"id":5720,"nodeType":"Class","startLoc":284,"text":"class W02(VOTableSpecWarning):\n    r\"\"\"\n    XML ids must match the following regular expression::\n\n        ^[A-Za-z_][A-Za-z0-9_\\.\\-]*$\n\n    The VOTable 1.1 says the following:\n\n        According to the XML standard, the attribute ``ID`` is a\n        string beginning with a letter or underscore (``_``), followed\n        by a sequence of letters, digits, or any of the punctuation\n        characters ``.`` (dot), ``-`` (dash), ``_`` (underscore), or\n        ``:`` (colon).\n\n    However, this is in conflict with the XML standard, which says\n    colons may not be used.  VOTable 1.1's own schema does not allow a\n    colon here.  Therefore, ``astropy.io.votable`` disallows the colon.\n\n    VOTable 1.2 corrects this error in the specification.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `XML Names <http://www.w3.org/TR/REC-xml/#NT-Name>`__\n    \"\"\"\n\n    message_template = \"{} attribute '{}' is invalid.  Must be a standard XML id\"\n    default_args = ('x', 'y')"},{"attributeType":"null","col":4,"comment":"null","endLoc":309,"id":5721,"name":"message_template","nodeType":"Attribute","startLoc":309,"text":"message_template"},{"col":0,"comment":"\n    Returns a writable file-like object suitable for streaming output.\n\n    Parameters\n    ----------\n    fd : str or file-like\n        May be:\n\n            - a file path string, in which case it is opened, and the file\n              object is returned.\n\n            - an object with a :meth:``write`` method, in which case that\n              object is returned.\n\n    compressed : bool, optional\n        If `True`, create a gzip-compressed file.  (Default is `False`).\n\n    Returns\n    -------\n    fd : writable file-like\n    ","endLoc":85,"header":"@contextlib.contextmanager\ndef convert_to_writable_filelike(fd, compressed=False)","id":5722,"name":"convert_to_writable_filelike","nodeType":"Function","startLoc":24,"text":"@contextlib.contextmanager\ndef convert_to_writable_filelike(fd, compressed=False):\n    \"\"\"\n    Returns a writable file-like object suitable for streaming output.\n\n    Parameters\n    ----------\n    fd : str or file-like\n        May be:\n\n            - a file path string, in which case it is opened, and the file\n              object is returned.\n\n            - an object with a :meth:``write`` method, in which case that\n              object is returned.\n\n    compressed : bool, optional\n        If `True`, create a gzip-compressed file.  (Default is `False`).\n\n    Returns\n    -------\n    fd : writable file-like\n    \"\"\"\n    if isinstance(fd, str):\n        if fd.endswith('.gz') or compressed:\n            with gzip.GzipFile(fd, 'wb') as real_fd:\n                encoded_fd = io.TextIOWrapper(real_fd, encoding='utf8')\n                yield encoded_fd\n                encoded_fd.flush()\n                real_fd.flush()\n                return\n        else:\n            with open(fd, 'wt', encoding='utf8') as real_fd:\n                yield real_fd\n                return\n    elif hasattr(fd, 'write'):\n        assert callable(fd.write)\n\n        if compressed:\n            fd = gzip.GzipFile(fileobj=fd)\n\n        # If we can't write Unicode strings, use a codecs.StreamWriter\n        # object\n        needs_wrapper = False\n        try:\n            fd.write('')\n        except TypeError:\n            needs_wrapper = True\n\n        if not hasattr(fd, 'encoding') or fd.encoding is None:\n            needs_wrapper = True\n\n        if needs_wrapper:\n            yield codecs.getwriter('utf-8')(fd)\n            fd.flush()\n        else:\n            yield fd\n            fd.flush()\n\n        return\n    else:\n        raise TypeError(\"Can not be coerced to writable file-like object\")"},{"col":0,"comment":"\n    Returns a function suitable for streaming input, or a file object.\n\n    This function is only useful if passing off to C code where:\n\n       - If it's a real file object, we want to use it as a real\n         C file object to avoid the Python overhead.\n\n       - If it's not a real file object, it's much handier to just\n         have a Python function to call.\n\n    This is somewhat quirky behavior, of course, which is why it is\n    private.  For a more useful version of similar behavior, see\n    `astropy.utils.misc.get_readable_fileobj`.\n\n    Parameters\n    ----------\n    fd : object\n        May be:\n\n            - a file object.  If the file is uncompressed, this raw\n              file object is returned verbatim.  Otherwise, the read\n              method is returned.\n\n            - a function that reads from a stream, in which case it is\n              returned verbatim.\n\n            - a file path, in which case it is opened.  Again, like a\n              file object, if it's uncompressed, a raw file object is\n              returned, otherwise its read method.\n\n            - an object with a :meth:`read` method, in which case that\n              method is returned.\n\n    Returns\n    -------\n    fd : context-dependent\n        See above.\n    ","endLoc":70,"header":"@contextlib.contextmanager\ndef _convert_to_fd_or_read_function(fd)","id":5723,"name":"_convert_to_fd_or_read_function","nodeType":"Function","startLoc":18,"text":"@contextlib.contextmanager\ndef _convert_to_fd_or_read_function(fd):\n    \"\"\"\n    Returns a function suitable for streaming input, or a file object.\n\n    This function is only useful if passing off to C code where:\n\n       - If it's a real file object, we want to use it as a real\n         C file object to avoid the Python overhead.\n\n       - If it's not a real file object, it's much handier to just\n         have a Python function to call.\n\n    This is somewhat quirky behavior, of course, which is why it is\n    private.  For a more useful version of similar behavior, see\n    `astropy.utils.misc.get_readable_fileobj`.\n\n    Parameters\n    ----------\n    fd : object\n        May be:\n\n            - a file object.  If the file is uncompressed, this raw\n              file object is returned verbatim.  Otherwise, the read\n              method is returned.\n\n            - a function that reads from a stream, in which case it is\n              returned verbatim.\n\n            - a file path, in which case it is opened.  Again, like a\n              file object, if it's uncompressed, a raw file object is\n              returned, otherwise its read method.\n\n            - an object with a :meth:`read` method, in which case that\n              method is returned.\n\n    Returns\n    -------\n    fd : context-dependent\n        See above.\n    \"\"\"\n    if callable(fd):\n        yield fd\n        return\n\n    with data.get_readable_fileobj(fd, encoding='binary') as new_fd:\n        if sys.platform.startswith('win'):\n            yield new_fd.read\n        else:\n            if isinstance(new_fd, io.FileIO):\n                yield new_fd\n            else:\n                yield new_fd.read"},{"attributeType":"null","col":4,"comment":"null","endLoc":310,"id":5724,"name":"default_args","nodeType":"Attribute","startLoc":310,"text":"default_args"},{"className":"W03","col":0,"comment":"\n    The VOTable 1.1 spec says the following about ``name`` vs. ``ID``\n    on ``FIELD`` and ``VALUE`` elements:\n\n        ``ID`` and ``name`` attributes have a different role in\n        VOTable: the ``ID`` is meant as a *unique identifier* of an\n        element seen as a VOTable component, while the ``name`` is\n        meant for presentation purposes, and need not to be unique\n        throughout the VOTable document. The ``ID`` attribute is\n        therefore required in the elements which have to be\n        referenced, but in principle any element may have an ``ID``\n        attribute. ... In summary, the ``ID`` is different from the\n        ``name`` attribute in that (a) the ``ID`` attribute is made\n        from a restricted character set, and must be unique throughout\n        a VOTable document whereas names are standard XML attributes\n        and need not be unique; and (b) there should be support in the\n        parsing software to look up references and extract the\n        relevant element with matching ``ID``.\n\n    It is further recommended in the VOTable 1.2 spec:\n\n        While the ``ID`` attribute has to be unique in a VOTable\n        document, the ``name`` attribute need not. It is however\n        recommended, as a good practice, to assign unique names within\n        a ``TABLE`` element. This recommendation means that, between a\n        ``TABLE`` and its corresponding closing ``TABLE`` tag,\n        ``name`` attributes of ``FIELD``, ``PARAM`` and optional\n        ``GROUP`` elements should be all different.\n\n    Since ``astropy.io.votable`` requires a unique identifier for each of its\n    columns, ``ID`` is used for the column name when present.\n    However, when ``ID`` is not present, (since it is not required by\n    the specification) ``name`` is used instead.  However, ``name``\n    must be cleansed by replacing invalid characters (such as\n    whitespace) with underscores.\n\n    .. note::\n        This warning does not indicate that the input file is invalid\n        with respect to the VOTable specification, only that the\n        column names in the record array may not match exactly the\n        ``name`` attributes specified in the file.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    ","endLoc":363,"id":5725,"nodeType":"Class","startLoc":313,"text":"class W03(VOTableChangeWarning):\n    \"\"\"\n    The VOTable 1.1 spec says the following about ``name`` vs. ``ID``\n    on ``FIELD`` and ``VALUE`` elements:\n\n        ``ID`` and ``name`` attributes have a different role in\n        VOTable: the ``ID`` is meant as a *unique identifier* of an\n        element seen as a VOTable component, while the ``name`` is\n        meant for presentation purposes, and need not to be unique\n        throughout the VOTable document. The ``ID`` attribute is\n        therefore required in the elements which have to be\n        referenced, but in principle any element may have an ``ID``\n        attribute. ... In summary, the ``ID`` is different from the\n        ``name`` attribute in that (a) the ``ID`` attribute is made\n        from a restricted character set, and must be unique throughout\n        a VOTable document whereas names are standard XML attributes\n        and need not be unique; and (b) there should be support in the\n        parsing software to look up references and extract the\n        relevant element with matching ``ID``.\n\n    It is further recommended in the VOTable 1.2 spec:\n\n        While the ``ID`` attribute has to be unique in a VOTable\n        document, the ``name`` attribute need not. It is however\n        recommended, as a good practice, to assign unique names within\n        a ``TABLE`` element. This recommendation means that, between a\n        ``TABLE`` and its corresponding closing ``TABLE`` tag,\n        ``name`` attributes of ``FIELD``, ``PARAM`` and optional\n        ``GROUP`` elements should be all different.\n\n    Since ``astropy.io.votable`` requires a unique identifier for each of its\n    columns, ``ID`` is used for the column name when present.\n    However, when ``ID`` is not present, (since it is not required by\n    the specification) ``name`` is used instead.  However, ``name``\n    must be cleansed by replacing invalid characters (such as\n    whitespace) with underscores.\n\n    .. note::\n        This warning does not indicate that the input file is invalid\n        with respect to the VOTable specification, only that the\n        column names in the record array may not match exactly the\n        ``name`` attributes specified in the file.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    \"\"\"\n\n    message_template = \"Implicitly generating an ID from a name '{}' -> '{}'\"\n    default_args = ('x', 'y')"},{"col":0,"comment":"null","endLoc":110,"header":"def _fast_iterparse(fd, buffersize=2 ** 10)","id":5726,"name":"_fast_iterparse","nodeType":"Function","startLoc":73,"text":"def _fast_iterparse(fd, buffersize=2 ** 10):\n    from xml.parsers import expat\n\n    if not callable(fd):\n        read = fd.read\n    else:\n        read = fd\n\n    queue = []\n    text = []\n\n    def start(name, attr):\n        queue.append((True, name, attr,\n                      (parser.CurrentLineNumber, parser.CurrentColumnNumber)))\n        del text[:]\n\n    def end(name):\n        queue.append((False, name, ''.join(text).strip(),\n                      (parser.CurrentLineNumber, parser.CurrentColumnNumber)))\n\n    parser = expat.ParserCreate()\n    parser.specified_attributes = True\n    parser.StartElementHandler = start\n    parser.EndElementHandler = end\n    parser.CharacterDataHandler = text.append\n    Parse = parser.Parse\n\n    data = read(buffersize)\n    while data:\n        Parse(data, False)\n        for elem in queue:\n            yield elem\n        del queue[:]\n        data = read(buffersize)\n\n    Parse('', True)\n    for elem in queue:\n        yield elem"},{"attributeType":"Time","col":0,"comment":"null","endLoc":36,"id":5727,"name":"tm","nodeType":"Attribute","startLoc":36,"text":"tm"},{"attributeType":"null","col":4,"comment":"null","endLoc":362,"id":5728,"name":"message_template","nodeType":"Attribute","startLoc":362,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":363,"id":5729,"name":"default_args","nodeType":"Attribute","startLoc":363,"text":"default_args"},{"className":"W04","col":0,"comment":"\n    The ``content-type`` attribute must use MIME content-type syntax as\n    defined in `RFC 2046 <https://tools.ietf.org/html/rfc2046>`__.\n\n    The current check for validity is somewhat over-permissive.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:link>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:link>`__\n    ","endLoc":380,"id":5730,"nodeType":"Class","startLoc":366,"text":"class W04(VOTableSpecWarning):\n    \"\"\"\n    The ``content-type`` attribute must use MIME content-type syntax as\n    defined in `RFC 2046 <https://tools.ietf.org/html/rfc2046>`__.\n\n    The current check for validity is somewhat over-permissive.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:link>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:link>`__\n    \"\"\"\n\n    message_template = \"content-type '{}' must be a valid MIME content type\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":379,"id":5731,"name":"message_template","nodeType":"Attribute","startLoc":379,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":380,"id":5732,"name":"default_args","nodeType":"Attribute","startLoc":380,"text":"default_args"},{"className":"W05","col":0,"comment":"\n    The attribute must be a valid URI as defined in `RFC 2396\n    <https://www.ietf.org/rfc/rfc2396.txt>`_.\n    ","endLoc":390,"id":5733,"nodeType":"Class","startLoc":383,"text":"class W05(VOTableSpecWarning):\n    \"\"\"\n    The attribute must be a valid URI as defined in `RFC 2396\n    <https://www.ietf.org/rfc/rfc2396.txt>`_.\n    \"\"\"\n\n    message_template = \"'{}' is not a valid URI\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":389,"id":5734,"name":"message_template","nodeType":"Attribute","startLoc":389,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":390,"id":5735,"name":"default_args","nodeType":"Attribute","startLoc":390,"text":"default_args"},{"className":"W06","col":0,"comment":"\n    This warning is emitted when a ``ucd`` attribute does not match\n    the syntax of a `unified content descriptor\n    <http://vizier.u-strasbg.fr/doc/UCD.htx>`__.\n\n    If the VOTable version is 1.2 or later, the UCD will also be\n    checked to ensure it conforms to the controlled vocabulary defined\n    by UCD1+.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:ucd>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:ucd>`__\n    ","endLoc":410,"id":5736,"nodeType":"Class","startLoc":393,"text":"class W06(VOTableSpecWarning):\n    \"\"\"\n    This warning is emitted when a ``ucd`` attribute does not match\n    the syntax of a `unified content descriptor\n    <http://vizier.u-strasbg.fr/doc/UCD.htx>`__.\n\n    If the VOTable version is 1.2 or later, the UCD will also be\n    checked to ensure it conforms to the controlled vocabulary defined\n    by UCD1+.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:ucd>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:ucd>`__\n    \"\"\"\n\n    message_template = \"Invalid UCD '{}': {}\"\n    default_args = ('x', 'explanation')"},{"attributeType":"null","col":4,"comment":"null","endLoc":409,"id":5737,"name":"message_template","nodeType":"Attribute","startLoc":409,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":410,"id":5738,"name":"default_args","nodeType":"Attribute","startLoc":410,"text":"default_args"},{"className":"W07","col":0,"comment":"\n    As astro year field is a Besselian or Julian year matching the\n    regular expression::\n\n        ^[JB]?[0-9]+([.][0-9]*)?$\n\n    Defined in this XML Schema snippet::\n\n        <xs:simpleType  name=\"astroYear\">\n          <xs:restriction base=\"xs:token\">\n            <xs:pattern  value=\"[JB]?[0-9]+([.][0-9]*)?\"/>\n          </xs:restriction>\n        </xs:simpleType>\n    ","endLoc":430,"id":5739,"nodeType":"Class","startLoc":413,"text":"class W07(VOTableSpecWarning):\n    \"\"\"\n    As astro year field is a Besselian or Julian year matching the\n    regular expression::\n\n        ^[JB]?[0-9]+([.][0-9]*)?$\n\n    Defined in this XML Schema snippet::\n\n        <xs:simpleType  name=\"astroYear\">\n          <xs:restriction base=\"xs:token\">\n            <xs:pattern  value=\"[JB]?[0-9]+([.][0-9]*)?\"/>\n          </xs:restriction>\n        </xs:simpleType>\n    \"\"\"\n\n    message_template = \"Invalid astroYear in {}: '{}'\"\n    default_args = ('x', 'y')"},{"attributeType":"null","col":4,"comment":"null","endLoc":429,"id":5740,"name":"message_template","nodeType":"Attribute","startLoc":429,"text":"message_template"},{"col":0,"comment":"\n    Coerces and/or verifies the object *p* into a valid range-list-format parameter.\n\n    As defined in `Section 8.7.2 of Simple\n    Spectral Access Protocol\n    <http://www.ivoa.net/documents/REC/DAL/SSA-20080201.html>`_.\n\n    Parameters\n    ----------\n    p : str or sequence\n        May be a string as passed verbatim to the service expecting a\n        range-list, or a sequence.  If a sequence, each item must be\n        either:\n\n            - a numeric value\n\n            - a named value, such as, for example, 'J' for named\n              spectrum (if the *numeric* kwarg is False)\n\n            - a 2-tuple indicating a range\n\n            - the last item my be a string indicating the frame of\n              reference\n\n    frames : sequence of str, optional\n        A sequence of acceptable frame of reference keywords.  If not\n        provided, the default set in ``set_reference_frames`` will be\n        used.\n\n    numeric : bool, optional\n        TODO\n\n    Returns\n    -------\n    parts : tuple\n        The result is a tuple:\n            - a string suitable for passing to a service as a range-list\n              argument\n\n            - an integer counting the number of elements\n    ","endLoc":200,"header":"def coerce_range_list_param(p, frames=None, numeric=True)","id":5741,"name":"coerce_range_list_param","nodeType":"Function","startLoc":99,"text":"def coerce_range_list_param(p, frames=None, numeric=True):\n    \"\"\"\n    Coerces and/or verifies the object *p* into a valid range-list-format parameter.\n\n    As defined in `Section 8.7.2 of Simple\n    Spectral Access Protocol\n    <http://www.ivoa.net/documents/REC/DAL/SSA-20080201.html>`_.\n\n    Parameters\n    ----------\n    p : str or sequence\n        May be a string as passed verbatim to the service expecting a\n        range-list, or a sequence.  If a sequence, each item must be\n        either:\n\n            - a numeric value\n\n            - a named value, such as, for example, 'J' for named\n              spectrum (if the *numeric* kwarg is False)\n\n            - a 2-tuple indicating a range\n\n            - the last item my be a string indicating the frame of\n              reference\n\n    frames : sequence of str, optional\n        A sequence of acceptable frame of reference keywords.  If not\n        provided, the default set in ``set_reference_frames`` will be\n        used.\n\n    numeric : bool, optional\n        TODO\n\n    Returns\n    -------\n    parts : tuple\n        The result is a tuple:\n            - a string suitable for passing to a service as a range-list\n              argument\n\n            - an integer counting the number of elements\n    \"\"\"\n    def str_or_none(x):\n        if x is None:\n            return ''\n        if numeric:\n            x = float(x)\n        return str(x)\n\n    def numeric_or_range(x):\n        if isinstance(x, tuple) and len(x) == 2:\n            return f'{str_or_none(x[0])}/{str_or_none(x[1])}'\n        else:\n            return str_or_none(x)\n\n    def is_frame_of_reference(x):\n        return isinstance(x, str)\n\n    if p is None:\n        return None, 0\n\n    elif isinstance(p, (tuple, list)):\n        has_frame_of_reference = len(p) > 1 and is_frame_of_reference(p[-1])\n        if has_frame_of_reference:\n            points = p[:-1]\n        else:\n            points = p[:]\n\n        out = ','.join([numeric_or_range(x) for x in points])\n        length = len(points)\n        if has_frame_of_reference:\n            if frames is not None and p[-1] not in frames:\n                raise ValueError(\n                    f\"'{p[-1]}' is not a valid frame of reference\")\n            out += ';' + p[-1]\n            length += 1\n\n        return out, length\n\n    elif isinstance(p, str):\n        number = r'([-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)?'\n        if not numeric:\n            number = r'(' + number + ')|([A-Z_]+)'\n        match = re.match(\n            '^' + number + r'([,/]' + number +\n            r')+(;(?P<frame>[<A-Za-z_0-9]+))?$',\n            p)\n\n        if match is None:\n            raise ValueError(f\"'{p}' is not a valid range list\")\n\n        frame = match.groupdict()['frame']\n        if frames is not None and frame is not None and frame not in frames:\n            raise ValueError(\n                f\"'{frame}' is not a valid frame of reference\")\n        return p, p.count(',') + p.count(';') + 1\n\n    try:\n        float(p)\n        return str(p), 1\n    except TypeError:\n        raise ValueError(f\"'{p}' is not a valid range list\")"},{"attributeType":"null","col":4,"comment":"null","endLoc":430,"id":5742,"name":"default_args","nodeType":"Attribute","startLoc":430,"text":"default_args"},{"className":"W08","col":0,"comment":"\n    To avoid local-dependent number parsing differences, ``astropy.io.votable``\n    may require a string or unicode string where a numeric type may\n    make more sense.\n    ","endLoc":442,"id":5743,"nodeType":"Class","startLoc":433,"text":"class W08(VOTableSpecWarning):\n    \"\"\"\n    To avoid local-dependent number parsing differences, ``astropy.io.votable``\n    may require a string or unicode string where a numeric type may\n    make more sense.\n    \"\"\"\n\n    message_template = \"'{}' must be a str or bytes object\"\n\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":440,"id":5744,"name":"message_template","nodeType":"Attribute","startLoc":440,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":442,"id":5746,"name":"default_args","nodeType":"Attribute","startLoc":442,"text":"default_args"},{"className":"W09","col":0,"comment":"\n    The VOTable specification uses the attribute name ``ID`` (with\n    uppercase letters) to specify unique identifiers.  Some\n    VOTable-producing tools use the more standard lowercase ``id``\n    instead. ``astropy.io.votable`` accepts ``id`` and emits this warning if\n    ``verify`` is ``'warn'``.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    ","endLoc":459,"id":5747,"nodeType":"Class","startLoc":445,"text":"class W09(VOTableSpecWarning):\n    \"\"\"\n    The VOTable specification uses the attribute name ``ID`` (with\n    uppercase letters) to specify unique identifiers.  Some\n    VOTable-producing tools use the more standard lowercase ``id``\n    instead. ``astropy.io.votable`` accepts ``id`` and emits this warning if\n    ``verify`` is ``'warn'``.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    \"\"\"\n\n    message_template = \"ID attribute not capitalized\""},{"attributeType":"null","col":4,"comment":"null","endLoc":459,"id":5748,"name":"message_template","nodeType":"Attribute","startLoc":459,"text":"message_template"},{"className":"W10","col":0,"comment":"\n    The parser has encountered an element that does not exist in the\n    specification, or appears in an invalid context.  Check the file\n    against the VOTable schema (with a tool such as `xmllint\n    <http://xmlsoft.org/xmllint.html>`__.  If the file validates\n    against the schema, and you still receive this warning, this may\n    indicate a bug in ``astropy.io.votable``.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__\n    ","endLoc":478,"id":5749,"nodeType":"Class","startLoc":462,"text":"class W10(VOTableSpecWarning):\n    \"\"\"\n    The parser has encountered an element that does not exist in the\n    specification, or appears in an invalid context.  Check the file\n    against the VOTable schema (with a tool such as `xmllint\n    <http://xmlsoft.org/xmllint.html>`__.  If the file validates\n    against the schema, and you still receive this warning, this may\n    indicate a bug in ``astropy.io.votable``.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__\n    \"\"\"\n\n    message_template = \"Unknown tag '{}'.  Ignoring\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":477,"id":5750,"name":"message_template","nodeType":"Attribute","startLoc":477,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":478,"id":5752,"name":"default_args","nodeType":"Attribute","startLoc":478,"text":"default_args"},{"className":"W11","col":0,"comment":"\n    Earlier versions of the VOTable specification used a ``gref``\n    attribute on the ``LINK`` element to specify a `GLU reference\n    <http://aladin.u-strasbg.fr/glu/>`__.  New files should\n    specify a ``glu:`` protocol using the ``href`` attribute.\n\n    Since ``astropy.io.votable`` does not currently support GLU references, it\n    likewise does not automatically convert the ``gref`` attribute to\n    the new form.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:link>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:link>`__\n    ","endLoc":498,"id":5754,"nodeType":"Class","startLoc":481,"text":"class W11(VOTableSpecWarning):\n    \"\"\"\n    Earlier versions of the VOTable specification used a ``gref``\n    attribute on the ``LINK`` element to specify a `GLU reference\n    <http://aladin.u-strasbg.fr/glu/>`__.  New files should\n    specify a ``glu:`` protocol using the ``href`` attribute.\n\n    Since ``astropy.io.votable`` does not currently support GLU references, it\n    likewise does not automatically convert the ``gref`` attribute to\n    the new form.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:link>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:link>`__\n    \"\"\"\n\n    message_template = \"The gref attribute on LINK is deprecated in VOTable 1.1\""},{"attributeType":"null","col":4,"comment":"null","endLoc":498,"id":5755,"name":"message_template","nodeType":"Attribute","startLoc":498,"text":"message_template"},{"col":0,"comment":"\n    Compare two VOTable version identifiers.\n    ","endLoc":214,"header":"def version_compare(a, b)","id":5756,"name":"version_compare","nodeType":"Function","startLoc":203,"text":"def version_compare(a, b):\n    \"\"\"\n    Compare two VOTable version identifiers.\n    \"\"\"\n    def version_to_tuple(v):\n        if v[0].lower() == 'v':\n            v = v[1:]\n        return Version(v)\n    av = version_to_tuple(a)\n    bv = version_to_tuple(b)\n    # Can't use cmp because it was removed from Python 3.x\n    return (av > bv) - (av < bv)"},{"className":"W12","col":0,"comment":"\n    In order to name the columns of the Numpy record array, each\n    ``FIELD`` element must have either an ``ID`` or ``name`` attribute\n    to derive a name from.  Strictly speaking, according to the\n    VOTable schema, the ``name`` attribute is required.  However, if\n    ``name`` is not present by ``ID`` is, and ``verify`` is not ``'exception'``,\n    ``astropy.io.votable`` will continue without a ``name`` defined.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    ","endLoc":518,"id":5757,"nodeType":"Class","startLoc":501,"text":"class W12(VOTableChangeWarning):\n    \"\"\"\n    In order to name the columns of the Numpy record array, each\n    ``FIELD`` element must have either an ``ID`` or ``name`` attribute\n    to derive a name from.  Strictly speaking, according to the\n    VOTable schema, the ``name`` attribute is required.  However, if\n    ``name`` is not present by ``ID`` is, and ``verify`` is not ``'exception'``,\n    ``astropy.io.votable`` will continue without a ``name`` defined.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    \"\"\"\n\n    message_template = (\n        \"'{}' element must have at least one of 'ID' or 'name' attributes\")\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":516,"id":5758,"name":"message_template","nodeType":"Attribute","startLoc":516,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":518,"id":5759,"name":"default_args","nodeType":"Attribute","startLoc":518,"text":"default_args"},{"className":"W13","col":0,"comment":"\n    Some VOTable files in the wild use non-standard datatype names.  These\n    are mapped to standard ones using the following mapping::\n\n       string        -> char\n       unicodeString -> unicodeChar\n       int16         -> short\n       int32         -> int\n       int64         -> long\n       float32       -> float\n       float64       -> double\n       unsignedInt   -> long\n       unsignedShort -> int\n\n    To add more datatype mappings during parsing, use the\n    ``datatype_mapping`` keyword to `astropy.io.votable.parse`.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    ","endLoc":546,"id":5760,"nodeType":"Class","startLoc":521,"text":"class W13(VOTableSpecWarning):\n    \"\"\"\n    Some VOTable files in the wild use non-standard datatype names.  These\n    are mapped to standard ones using the following mapping::\n\n       string        -> char\n       unicodeString -> unicodeChar\n       int16         -> short\n       int32         -> int\n       int64         -> long\n       float32       -> float\n       float64       -> double\n       unsignedInt   -> long\n       unsignedShort -> int\n\n    To add more datatype mappings during parsing, use the\n    ``datatype_mapping`` keyword to `astropy.io.votable.parse`.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    \"\"\"\n\n    message_template = \"'{}' is not a valid VOTable datatype, should be '{}'\"\n    default_args = ('x', 'y')"},{"attributeType":"null","col":4,"comment":"null","endLoc":545,"id":5762,"name":"message_template","nodeType":"Attribute","startLoc":545,"text":"message_template"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":5763,"name":"__all__","nodeType":"Attribute","startLoc":17,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":89,"id":5764,"name":"stc_reference_frames","nodeType":"Attribute","startLoc":89,"text":"stc_reference_frames"},{"attributeType":"null","col":4,"comment":"null","endLoc":546,"id":5765,"name":"default_args","nodeType":"Attribute","startLoc":546,"text":"default_args"},{"col":0,"comment":"","endLoc":4,"header":"util.py#<anonymous>","id":5766,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nVarious utilities and cookbook-like things.\n\"\"\"\n\n__all__ = [\n    'convert_to_writable_filelike',\n    'stc_reference_frames',\n    'coerce_range_list_param',\n    ]\n\nstc_reference_frames = set([\n    'FK4', 'FK5', 'ECLIPTIC', 'ICRS', 'GALACTIC', 'GALACTIC_I', 'GALACTIC_II',\n    'SUPER_GALACTIC', 'AZ_EL', 'BODY', 'GEO_C', 'GEO_D', 'MAG', 'GSE', 'GSM',\n    'SM', 'HGC', 'HGS', 'HEEQ', 'HRTN', 'HPC', 'HPR', 'HCC', 'HGI',\n    'MERCURY_C', 'VENUS_C', 'LUNA_C', 'MARS_C', 'JUPITER_C_III',\n    'SATURN_C_III', 'URANUS_C_III', 'NEPTUNE_C_III', 'PLUTO_C', 'MERCURY_G',\n    'VENUS_G', 'LUNA_G', 'MARS_G', 'JUPITER_G_III', 'SATURN_G_III',\n    'URANUS_G_III', 'NEPTUNE_G_III', 'PLUTO_G', 'UNKNOWNFrame'])"},{"className":"W15","col":0,"comment":"\n    The ``name`` attribute is required on every ``FIELD`` element.\n    However, many VOTable files in the wild omit it and provide only\n    an ``ID`` instead.  In this case, when ``verify`` is not ``'exception'``\n    ``astropy.io.votable`` will copy the ``name`` attribute to a new ``ID``\n    attribute.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    ","endLoc":567,"id":5767,"nodeType":"Class","startLoc":552,"text":"class W15(VOTableSpecWarning):\n    \"\"\"\n    The ``name`` attribute is required on every ``FIELD`` element.\n    However, many VOTable files in the wild omit it and provide only\n    an ``ID`` instead.  In this case, when ``verify`` is not ``'exception'``\n    ``astropy.io.votable`` will copy the ``name`` attribute to a new ``ID``\n    attribute.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    \"\"\"\n\n    message_template = \"{} element missing required 'name' attribute\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":566,"id":5768,"name":"message_template","nodeType":"Attribute","startLoc":566,"text":"message_template"},{"fileName":"ucd.py","filePath":"astropy/io/votable","id":5769,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis file contains routines to verify the correctness of UCD strings.\n\"\"\"\n\n\n# STDLIB\nimport re\n\n# LOCAL\nfrom astropy.utils import data\n\n__all__ = ['parse_ucd', 'check_ucd']\n\n\nclass UCDWords:\n    \"\"\"\n    Manages a list of acceptable UCD words.\n\n    Works by reading in a data file exactly as provided by IVOA.  This\n    file resides in data/ucd1p-words.txt.\n    \"\"\"\n\n    def __init__(self):\n        self._primary = set()\n        self._secondary = set()\n        self._descriptions = {}\n        self._capitalization = {}\n\n        with data.get_pkg_data_fileobj(\n                \"data/ucd1p-words.txt\", encoding='ascii') as fd:\n            for line in fd.readlines():\n                type, name, descr = [\n                    x.strip() for x in line.split('|')]\n                name_lower = name.lower()\n                if type in 'QPEVC':\n                    self._primary.add(name_lower)\n                if type in 'QSEVC':\n                    self._secondary.add(name_lower)\n                self._descriptions[name_lower] = descr\n                self._capitalization[name_lower] = name\n\n    def is_primary(self, name):\n        \"\"\"\n        Returns True if *name* is a valid primary name.\n        \"\"\"\n        return name.lower() in self._primary\n\n    def is_secondary(self, name):\n        \"\"\"\n        Returns True if *name* is a valid secondary name.\n        \"\"\"\n        return name.lower() in self._secondary\n\n    def get_description(self, name):\n        \"\"\"\n        Returns the official English description of the given UCD\n        *name*.\n        \"\"\"\n        return self._descriptions[name.lower()]\n\n    def normalize_capitalization(self, name):\n        \"\"\"\n        Returns the standard capitalization form of the given name.\n        \"\"\"\n        return self._capitalization[name.lower()]\n\n\n_ucd_singleton = None\n\n\ndef parse_ucd(ucd, check_controlled_vocabulary=False, has_colon=False):\n    \"\"\"\n    Parse the UCD into its component parts.\n\n    Parameters\n    ----------\n    ucd : str\n        The UCD string\n\n    check_controlled_vocabulary : bool, optional\n        If `True`, then each word in the UCD will be verified against\n        the UCD1+ controlled vocabulary, (as required by the VOTable\n        specification version 1.2), otherwise not.\n\n    has_colon : bool, optional\n        If `True`, the UCD may contain a colon (as defined in earlier\n        versions of the standard).\n\n    Returns\n    -------\n    parts : list\n        The result is a list of tuples of the form:\n\n            (*namespace*, *word*)\n\n        If no namespace was explicitly specified, *namespace* will be\n        returned as ``'ivoa'`` (i.e., the default namespace).\n\n    Raises\n    ------\n    ValueError\n        if *ucd* is invalid\n    \"\"\"\n    global _ucd_singleton\n    if _ucd_singleton is None:\n        _ucd_singleton = UCDWords()\n\n    if has_colon:\n        m = re.search(r'[^A-Za-z0-9_.:;\\-]', ucd)\n    else:\n        m = re.search(r'[^A-Za-z0-9_.;\\-]', ucd)\n    if m is not None:\n        raise ValueError(f\"UCD has invalid character '{m.group(0)}' in '{ucd}'\")\n\n    word_component_re = r'[A-Za-z0-9][A-Za-z0-9\\-_]*'\n    word_re = fr'{word_component_re}(\\.{word_component_re})*'\n\n    parts = ucd.split(';')\n    words = []\n    for i, word in enumerate(parts):\n        colon_count = word.count(':')\n        if colon_count == 1:\n            ns, word = word.split(':', 1)\n            if not re.match(word_component_re, ns):\n                raise ValueError(f\"Invalid namespace '{ns}'\")\n            ns = ns.lower()\n        elif colon_count > 1:\n            raise ValueError(f\"Too many colons in '{word}'\")\n        else:\n            ns = 'ivoa'\n\n        if not re.match(word_re, word):\n            raise ValueError(f\"Invalid word '{word}'\")\n\n        if ns == 'ivoa' and check_controlled_vocabulary:\n            if i == 0:\n                if not _ucd_singleton.is_primary(word):\n                    if _ucd_singleton.is_secondary(word):\n                        raise ValueError(\n                            f\"Secondary word '{word}' is not valid as a primary word\")\n                    else:\n                        raise ValueError(f\"Unknown word '{word}'\")\n            else:\n                if not _ucd_singleton.is_secondary(word):\n                    if _ucd_singleton.is_primary(word):\n                        raise ValueError(\n                            f\"Primary word '{word}' is not valid as a secondary word\")\n                    else:\n                        raise ValueError(f\"Unknown word '{word}'\")\n\n        try:\n            normalized_word = _ucd_singleton.normalize_capitalization(word)\n        except KeyError:\n            normalized_word = word\n        words.append((ns, normalized_word))\n\n    return words\n\n\ndef check_ucd(ucd, check_controlled_vocabulary=False, has_colon=False):\n    \"\"\"\n    Returns False if *ucd* is not a valid `unified content descriptor`_.\n\n    Parameters\n    ----------\n    ucd : str\n        The UCD string\n\n    check_controlled_vocabulary : bool, optional\n        If `True`, then each word in the UCD will be verified against\n        the UCD1+ controlled vocabulary, (as required by the VOTable\n        specification version 1.2), otherwise not.\n\n    has_colon : bool, optional\n        If `True`, the UCD may contain a colon (as defined in earlier\n        versions of the standard).\n\n    Returns\n    -------\n    valid : bool\n    \"\"\"\n    if ucd is None:\n        return True\n\n    try:\n        parse_ucd(ucd,\n                  check_controlled_vocabulary=check_controlled_vocabulary,\n                  has_colon=has_colon)\n    except ValueError:\n        return False\n    return True\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":567,"id":5770,"name":"default_args","nodeType":"Attribute","startLoc":567,"text":"default_args"},{"className":"W17","col":0,"comment":"\n    A ``DESCRIPTION`` element can only appear once within its parent\n    element.\n\n    According to the schema, it may only occur once (`1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__)\n\n    However, it is a `proposed extension\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:addesc>`__\n    to VOTable 1.2.\n    ","endLoc":588,"id":5771,"nodeType":"Class","startLoc":572,"text":"class W17(VOTableSpecWarning):\n    \"\"\"\n    A ``DESCRIPTION`` element can only appear once within its parent\n    element.\n\n    According to the schema, it may only occur once (`1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__)\n\n    However, it is a `proposed extension\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:addesc>`__\n    to VOTable 1.2.\n    \"\"\"\n\n    message_template = \"{} element contains more than one DESCRIPTION element\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":587,"id":5772,"name":"message_template","nodeType":"Attribute","startLoc":587,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":588,"id":5773,"name":"default_args","nodeType":"Attribute","startLoc":588,"text":"default_args"},{"className":"W18","col":0,"comment":"\n    The number of rows explicitly specified in the ``nrows`` attribute\n    does not match the actual number of rows (``TR`` elements) present\n    in the ``TABLE``.  This may indicate truncation of the file, or an\n    internal error in the tool that produced it.  If ``verify`` is not\n    ``'exception'``, parsing will proceed, with the loss of some performance.\n\n    **References:** `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC10>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC10>`__\n    ","endLoc":606,"id":5774,"nodeType":"Class","startLoc":591,"text":"class W18(VOTableSpecWarning):\n    \"\"\"\n    The number of rows explicitly specified in the ``nrows`` attribute\n    does not match the actual number of rows (``TR`` elements) present\n    in the ``TABLE``.  This may indicate truncation of the file, or an\n    internal error in the tool that produced it.  If ``verify`` is not\n    ``'exception'``, parsing will proceed, with the loss of some performance.\n\n    **References:** `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC10>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC10>`__\n    \"\"\"\n\n    message_template = 'TABLE specified nrows={}, but table contains {} rows'\n    default_args = ('x', 'y')"},{"attributeType":"null","col":4,"comment":"null","endLoc":605,"id":5775,"name":"message_template","nodeType":"Attribute","startLoc":605,"text":"message_template"},{"className":"UCDWords","col":0,"comment":"\n    Manages a list of acceptable UCD words.\n\n    Works by reading in a data file exactly as provided by IVOA.  This\n    file resides in data/ucd1p-words.txt.\n    ","endLoc":66,"id":5776,"nodeType":"Class","startLoc":16,"text":"class UCDWords:\n    \"\"\"\n    Manages a list of acceptable UCD words.\n\n    Works by reading in a data file exactly as provided by IVOA.  This\n    file resides in data/ucd1p-words.txt.\n    \"\"\"\n\n    def __init__(self):\n        self._primary = set()\n        self._secondary = set()\n        self._descriptions = {}\n        self._capitalization = {}\n\n        with data.get_pkg_data_fileobj(\n                \"data/ucd1p-words.txt\", encoding='ascii') as fd:\n            for line in fd.readlines():\n                type, name, descr = [\n                    x.strip() for x in line.split('|')]\n                name_lower = name.lower()\n                if type in 'QPEVC':\n                    self._primary.add(name_lower)\n                if type in 'QSEVC':\n                    self._secondary.add(name_lower)\n                self._descriptions[name_lower] = descr\n                self._capitalization[name_lower] = name\n\n    def is_primary(self, name):\n        \"\"\"\n        Returns True if *name* is a valid primary name.\n        \"\"\"\n        return name.lower() in self._primary\n\n    def is_secondary(self, name):\n        \"\"\"\n        Returns True if *name* is a valid secondary name.\n        \"\"\"\n        return name.lower() in self._secondary\n\n    def get_description(self, name):\n        \"\"\"\n        Returns the official English description of the given UCD\n        *name*.\n        \"\"\"\n        return self._descriptions[name.lower()]\n\n    def normalize_capitalization(self, name):\n        \"\"\"\n        Returns the standard capitalization form of the given name.\n        \"\"\"\n        return self._capitalization[name.lower()]"},{"col":4,"comment":"null","endLoc":41,"header":"def __init__(self)","id":5777,"name":"__init__","nodeType":"Function","startLoc":24,"text":"def __init__(self):\n        self._primary = set()\n        self._secondary = set()\n        self._descriptions = {}\n        self._capitalization = {}\n\n        with data.get_pkg_data_fileobj(\n                \"data/ucd1p-words.txt\", encoding='ascii') as fd:\n            for line in fd.readlines():\n                type, name, descr = [\n                    x.strip() for x in line.split('|')]\n                name_lower = name.lower()\n                if type in 'QPEVC':\n                    self._primary.add(name_lower)\n                if type in 'QSEVC':\n                    self._secondary.add(name_lower)\n                self._descriptions[name_lower] = descr\n                self._capitalization[name_lower] = name"},{"attributeType":"null","col":4,"comment":"null","endLoc":606,"id":5778,"name":"default_args","nodeType":"Attribute","startLoc":606,"text":"default_args"},{"className":"HomogeneousList","col":0,"comment":"\n    A subclass of list that contains only elements of a given type or\n    types.  If an item that is not of the specified type is added to\n    the list, a `TypeError` is raised.\n    ","endLoc":56,"id":5779,"nodeType":"Class","startLoc":7,"text":"class HomogeneousList(list):\n    \"\"\"\n    A subclass of list that contains only elements of a given type or\n    types.  If an item that is not of the specified type is added to\n    the list, a `TypeError` is raised.\n    \"\"\"\n    def __init__(self, types, values=[]):\n        \"\"\"\n        Parameters\n        ----------\n        types : sequence of types\n            The types to accept.\n\n        values : sequence, optional\n            An initial set of values.\n        \"\"\"\n        self._types = types\n        super().__init__()\n        self.extend(values)\n\n    def _assert(self, x):\n        if not isinstance(x, self._types):\n            raise TypeError(\n                f\"homogeneous list must contain only objects of type '{self._types}'\")\n\n    def __iadd__(self, other):\n        self.extend(other)\n        return self\n\n    def __setitem__(self, idx, value):\n        if isinstance(idx, slice):\n            value = list(value)\n            for item in value:\n                self._assert(item)\n        else:\n            self._assert(value)\n        return super().__setitem__(idx, value)\n\n    def append(self, x):\n        self._assert(x)\n        return super().append(x)\n\n    def insert(self, i, x):\n        self._assert(x)\n        return super().insert(i, x)\n\n    def extend(self, x):\n        for item in x:\n            self._assert(item)\n            super().append(item)"},{"className":"W19","col":0,"comment":"\n    The column fields as defined using ``FIELD`` elements do not match\n    those in the headers of the embedded FITS file.  If ``verify`` is not\n    ``'exception'``, the embedded FITS file will take precedence.\n    ","endLoc":618,"id":5780,"nodeType":"Class","startLoc":609,"text":"class W19(VOTableSpecWarning):\n    \"\"\"\n    The column fields as defined using ``FIELD`` elements do not match\n    those in the headers of the embedded FITS file.  If ``verify`` is not\n    ``'exception'``, the embedded FITS file will take precedence.\n    \"\"\"\n\n    message_template = (\n        'The fields defined in the VOTable do not match those in the ' +\n        'embedded FITS file')"},{"attributeType":"null","col":4,"comment":"null","endLoc":616,"id":5781,"name":"message_template","nodeType":"Attribute","startLoc":616,"text":"message_template"},{"className":"W20","col":0,"comment":"\n    If no version number is explicitly given in the VOTable file, the\n    parser assumes it is written to the VOTable 1.1 specification.\n    ","endLoc":628,"id":5782,"nodeType":"Class","startLoc":621,"text":"class W20(VOTableSpecWarning):\n    \"\"\"\n    If no version number is explicitly given in the VOTable file, the\n    parser assumes it is written to the VOTable 1.1 specification.\n    \"\"\"\n\n    message_template = 'No version number specified in file.  Assuming {}'\n    default_args = ('1.1',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":627,"id":5783,"name":"message_template","nodeType":"Attribute","startLoc":627,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":628,"id":5784,"name":"default_args","nodeType":"Attribute","startLoc":628,"text":"default_args"},{"className":"W21","col":0,"comment":"\n    Unknown issues may arise using ``astropy.io.votable`` with VOTable files\n    from a version other than 1.1, 1.2, 1.3, or 1.4.\n    ","endLoc":640,"id":5785,"nodeType":"Class","startLoc":631,"text":"class W21(UnimplementedWarning):\n    \"\"\"\n    Unknown issues may arise using ``astropy.io.votable`` with VOTable files\n    from a version other than 1.1, 1.2, 1.3, or 1.4.\n    \"\"\"\n\n    message_template = (\n        'astropy.io.votable is designed for VOTable version 1.1, 1.2, 1.3,'\n        ' and 1.4, but this file is {}')\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":637,"id":5786,"name":"message_template","nodeType":"Attribute","startLoc":637,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":640,"id":5787,"name":"default_args","nodeType":"Attribute","startLoc":640,"text":"default_args"},{"className":"W22","col":0,"comment":"\n    Version 1.0 of the VOTable specification used the ``DEFINITIONS``\n    element to define coordinate systems.  Version 1.1 now uses\n    ``COOSYS`` elements throughout the document.\n\n    **References:** `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:definitions>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:definitions>`__\n    ","endLoc":655,"id":5788,"nodeType":"Class","startLoc":643,"text":"class W22(VOTableSpecWarning):\n    \"\"\"\n    Version 1.0 of the VOTable specification used the ``DEFINITIONS``\n    element to define coordinate systems.  Version 1.1 now uses\n    ``COOSYS`` elements throughout the document.\n\n    **References:** `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:definitions>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:definitions>`__\n    \"\"\"\n\n    message_template = 'The DEFINITIONS element is deprecated in VOTable 1.1.  Ignoring'"},{"attributeType":"null","col":4,"comment":"null","endLoc":655,"id":5789,"name":"message_template","nodeType":"Attribute","startLoc":655,"text":"message_template"},{"col":4,"comment":"\n        Parameters\n        ----------\n        types : sequence of types\n            The types to accept.\n\n        values : sequence, optional\n            An initial set of values.\n        ","endLoc":25,"header":"def __init__(self, types, values=[])","id":5790,"name":"__init__","nodeType":"Function","startLoc":13,"text":"def __init__(self, types, values=[]):\n        \"\"\"\n        Parameters\n        ----------\n        types : sequence of types\n            The types to accept.\n\n        values : sequence, optional\n            An initial set of values.\n        \"\"\"\n        self._types = types\n        super().__init__()\n        self.extend(values)"},{"className":"W23","col":0,"comment":"\n    Raised when the VO service database can not be updated (possibly\n    due to a network outage).  This is only a warning, since an older\n    and possible out-of-date VO service database was available\n    locally.\n    ","endLoc":667,"id":5791,"nodeType":"Class","startLoc":658,"text":"class W23(IOWarning):\n    \"\"\"\n    Raised when the VO service database can not be updated (possibly\n    due to a network outage).  This is only a warning, since an older\n    and possible out-of-date VO service database was available\n    locally.\n    \"\"\"\n\n    message_template = \"Unable to update service information for '{}'\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":666,"id":5792,"name":"message_template","nodeType":"Attribute","startLoc":666,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":667,"id":5793,"name":"default_args","nodeType":"Attribute","startLoc":667,"text":"default_args"},{"className":"W24","col":0,"comment":"\n    The VO catalog database retrieved from the www is designed for a\n    newer version of ``astropy.io.votable``.  This may cause problems or limited\n    features performing service queries.  Consider upgrading ``astropy.io.votable``\n    to the latest version.\n    ","endLoc":678,"id":5794,"nodeType":"Class","startLoc":670,"text":"class W24(VOWarning, FutureWarning):\n    \"\"\"\n    The VO catalog database retrieved from the www is designed for a\n    newer version of ``astropy.io.votable``.  This may cause problems or limited\n    features performing service queries.  Consider upgrading ``astropy.io.votable``\n    to the latest version.\n    \"\"\"\n\n    message_template = \"The VO catalog database is for a later version of astropy.io.votable\""},{"attributeType":"null","col":4,"comment":"null","endLoc":678,"id":5795,"name":"message_template","nodeType":"Attribute","startLoc":678,"text":"message_template"},{"className":"W25","col":0,"comment":"\n    A VO service query failed due to a network error or malformed\n    arguments.  Another alternative service may be attempted.  If all\n    services fail, an exception will be raised.\n    ","endLoc":689,"id":5796,"nodeType":"Class","startLoc":681,"text":"class W25(IOWarning):\n    \"\"\"\n    A VO service query failed due to a network error or malformed\n    arguments.  Another alternative service may be attempted.  If all\n    services fail, an exception will be raised.\n    \"\"\"\n\n    message_template = \"'{}' failed with: {}\"\n    default_args = ('service', '...')"},{"attributeType":"null","col":4,"comment":"null","endLoc":688,"id":5797,"name":"message_template","nodeType":"Attribute","startLoc":688,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":689,"id":5798,"name":"default_args","nodeType":"Attribute","startLoc":689,"text":"default_args"},{"col":4,"comment":"null","endLoc":56,"header":"def extend(self, x)","id":5799,"name":"extend","nodeType":"Function","startLoc":53,"text":"def extend(self, x):\n        for item in x:\n            self._assert(item)\n            super().append(item)"},{"col":4,"comment":"null","endLoc":30,"header":"def _assert(self, x)","id":5800,"name":"_assert","nodeType":"Function","startLoc":27,"text":"def _assert(self, x):\n        if not isinstance(x, self._types):\n            raise TypeError(\n                f\"homogeneous list must contain only objects of type '{self._types}'\")"},{"col":4,"comment":"null","endLoc":34,"header":"def __iadd__(self, other)","id":5801,"name":"__iadd__","nodeType":"Function","startLoc":32,"text":"def __iadd__(self, other):\n        self.extend(other)\n        return self"},{"col":4,"comment":"null","endLoc":43,"header":"def __setitem__(self, idx, value)","id":5802,"name":"__setitem__","nodeType":"Function","startLoc":36,"text":"def __setitem__(self, idx, value):\n        if isinstance(idx, slice):\n            value = list(value)\n            for item in value:\n                self._assert(item)\n        else:\n            self._assert(value)\n        return super().__setitem__(idx, value)"},{"col":4,"comment":"\n        Returns True if *name* is a valid primary name.\n        ","endLoc":47,"header":"def is_primary(self, name)","id":5803,"name":"is_primary","nodeType":"Function","startLoc":43,"text":"def is_primary(self, name):\n        \"\"\"\n        Returns True if *name* is a valid primary name.\n        \"\"\"\n        return name.lower() in self._primary"},{"col":4,"comment":"\n        Returns True if *name* is a valid secondary name.\n        ","endLoc":53,"header":"def is_secondary(self, name)","id":5804,"name":"is_secondary","nodeType":"Function","startLoc":49,"text":"def is_secondary(self, name):\n        \"\"\"\n        Returns True if *name* is a valid secondary name.\n        \"\"\"\n        return name.lower() in self._secondary"},{"col":4,"comment":"\n        Returns the official English description of the given UCD\n        *name*.\n        ","endLoc":60,"header":"def get_description(self, name)","id":5805,"name":"get_description","nodeType":"Function","startLoc":55,"text":"def get_description(self, name):\n        \"\"\"\n        Returns the official English description of the given UCD\n        *name*.\n        \"\"\"\n        return self._descriptions[name.lower()]"},{"col":4,"comment":"\n        Returns the standard capitalization form of the given name.\n        ","endLoc":66,"header":"def normalize_capitalization(self, name)","id":5806,"name":"normalize_capitalization","nodeType":"Function","startLoc":62,"text":"def normalize_capitalization(self, name):\n        \"\"\"\n        Returns the standard capitalization form of the given name.\n        \"\"\"\n        return self._capitalization[name.lower()]"},{"col":4,"comment":"null","endLoc":47,"header":"def append(self, x)","id":5807,"name":"append","nodeType":"Function","startLoc":45,"text":"def append(self, x):\n        self._assert(x)\n        return super().append(x)"},{"attributeType":"null","col":8,"comment":"null","endLoc":26,"id":5808,"name":"_secondary","nodeType":"Attribute","startLoc":26,"text":"self._secondary"},{"attributeType":"null","col":8,"comment":"null","endLoc":28,"id":5809,"name":"_capitalization","nodeType":"Attribute","startLoc":28,"text":"self._capitalization"},{"col":4,"comment":"null","endLoc":51,"header":"def insert(self, i, x)","id":5810,"name":"insert","nodeType":"Function","startLoc":49,"text":"def insert(self, i, x):\n        self._assert(x)\n        return super().insert(i, x)"},{"attributeType":"Time","col":0,"comment":"null","endLoc":38,"id":5811,"name":"tm2","nodeType":"Attribute","startLoc":38,"text":"tm2"},{"attributeType":"null","col":8,"comment":"null","endLoc":27,"id":5812,"name":"_descriptions","nodeType":"Attribute","startLoc":27,"text":"self._descriptions"},{"attributeType":"null","col":8,"comment":"null","endLoc":23,"id":5813,"name":"_types","nodeType":"Attribute","startLoc":23,"text":"self._types"},{"attributeType":"null","col":8,"comment":"null","endLoc":25,"id":5814,"name":"_primary","nodeType":"Attribute","startLoc":25,"text":"self._primary"},{"col":0,"comment":"\n    Parse the UCD into its component parts.\n\n    Parameters\n    ----------\n    ucd : str\n        The UCD string\n\n    check_controlled_vocabulary : bool, optional\n        If `True`, then each word in the UCD will be verified against\n        the UCD1+ controlled vocabulary, (as required by the VOTable\n        specification version 1.2), otherwise not.\n\n    has_colon : bool, optional\n        If `True`, the UCD may contain a colon (as defined in earlier\n        versions of the standard).\n\n    Returns\n    -------\n    parts : list\n        The result is a list of tuples of the form:\n\n            (*namespace*, *word*)\n\n        If no namespace was explicitly specified, *namespace* will be\n        returned as ``'ivoa'`` (i.e., the default namespace).\n\n    Raises\n    ------\n    ValueError\n        if *ucd* is invalid\n    ","endLoc":158,"header":"def parse_ucd(ucd, check_controlled_vocabulary=False, has_colon=False)","id":5815,"name":"parse_ucd","nodeType":"Function","startLoc":72,"text":"def parse_ucd(ucd, check_controlled_vocabulary=False, has_colon=False):\n    \"\"\"\n    Parse the UCD into its component parts.\n\n    Parameters\n    ----------\n    ucd : str\n        The UCD string\n\n    check_controlled_vocabulary : bool, optional\n        If `True`, then each word in the UCD will be verified against\n        the UCD1+ controlled vocabulary, (as required by the VOTable\n        specification version 1.2), otherwise not.\n\n    has_colon : bool, optional\n        If `True`, the UCD may contain a colon (as defined in earlier\n        versions of the standard).\n\n    Returns\n    -------\n    parts : list\n        The result is a list of tuples of the form:\n\n            (*namespace*, *word*)\n\n        If no namespace was explicitly specified, *namespace* will be\n        returned as ``'ivoa'`` (i.e., the default namespace).\n\n    Raises\n    ------\n    ValueError\n        if *ucd* is invalid\n    \"\"\"\n    global _ucd_singleton\n    if _ucd_singleton is None:\n        _ucd_singleton = UCDWords()\n\n    if has_colon:\n        m = re.search(r'[^A-Za-z0-9_.:;\\-]', ucd)\n    else:\n        m = re.search(r'[^A-Za-z0-9_.;\\-]', ucd)\n    if m is not None:\n        raise ValueError(f\"UCD has invalid character '{m.group(0)}' in '{ucd}'\")\n\n    word_component_re = r'[A-Za-z0-9][A-Za-z0-9\\-_]*'\n    word_re = fr'{word_component_re}(\\.{word_component_re})*'\n\n    parts = ucd.split(';')\n    words = []\n    for i, word in enumerate(parts):\n        colon_count = word.count(':')\n        if colon_count == 1:\n            ns, word = word.split(':', 1)\n            if not re.match(word_component_re, ns):\n                raise ValueError(f\"Invalid namespace '{ns}'\")\n            ns = ns.lower()\n        elif colon_count > 1:\n            raise ValueError(f\"Too many colons in '{word}'\")\n        else:\n            ns = 'ivoa'\n\n        if not re.match(word_re, word):\n            raise ValueError(f\"Invalid word '{word}'\")\n\n        if ns == 'ivoa' and check_controlled_vocabulary:\n            if i == 0:\n                if not _ucd_singleton.is_primary(word):\n                    if _ucd_singleton.is_secondary(word):\n                        raise ValueError(\n                            f\"Secondary word '{word}' is not valid as a primary word\")\n                    else:\n                        raise ValueError(f\"Unknown word '{word}'\")\n            else:\n                if not _ucd_singleton.is_secondary(word):\n                    if _ucd_singleton.is_primary(word):\n                        raise ValueError(\n                            f\"Primary word '{word}' is not valid as a secondary word\")\n                    else:\n                        raise ValueError(f\"Unknown word '{word}'\")\n\n        try:\n            normalized_word = _ucd_singleton.normalize_capitalization(word)\n        except KeyError:\n            normalized_word = word\n        words.append((ns, normalized_word))\n\n    return words"},{"className":"XMLWriter","col":0,"comment":"\n    A class to write well-formed and nicely indented XML.\n\n    Use like this::\n\n        w = XMLWriter(fh)\n        with w.tag('html'):\n            with w.tag('body'):\n                w.data('This is the content')\n\n    Which produces::\n\n        <html>\n         <body>\n          This is the content\n         </body>\n        </html>\n    ","endLoc":345,"id":5816,"nodeType":"Class","startLoc":38,"text":"class XMLWriter:\n    \"\"\"\n    A class to write well-formed and nicely indented XML.\n\n    Use like this::\n\n        w = XMLWriter(fh)\n        with w.tag('html'):\n            with w.tag('body'):\n                w.data('This is the content')\n\n    Which produces::\n\n        <html>\n         <body>\n          This is the content\n         </body>\n        </html>\n    \"\"\"\n\n    def __init__(self, file):\n        \"\"\"\n        Parameters\n        ----------\n        file : writable file-like\n        \"\"\"\n        self.write = file.write\n        if hasattr(file, \"flush\"):\n            self.flush = file.flush\n        self._open = 0  # true if start tag is open\n        self._tags = []\n        self._data = []\n        self._indentation = \" \" * 64\n\n        self.xml_escape_cdata = xml_escape_cdata\n        self.xml_escape = xml_escape\n\n    def _flush(self, indent=True, wrap=False):\n        \"\"\"\n        Flush internal buffers.\n        \"\"\"\n        if self._open:\n            if indent:\n                self.write(\">\\n\")\n            else:\n                self.write(\">\")\n            self._open = 0\n        if self._data:\n            data = ''.join(self._data)\n            if wrap:\n                indent = self.get_indentation_spaces(1)\n                data = textwrap.fill(\n                    data,\n                    initial_indent=indent,\n                    subsequent_indent=indent)\n                self.write('\\n')\n                self.write(self.xml_escape_cdata(data))\n                self.write('\\n')\n                self.write(self.get_indentation_spaces())\n            else:\n                self.write(self.xml_escape_cdata(data))\n            self._data = []\n\n    def start(self, tag, attrib={}, **extra):\n        \"\"\"\n        Opens a new element.  Attributes can be given as keyword\n        arguments, or as a string/string dictionary.  The method\n        returns an opaque identifier that can be passed to the\n        :meth:`close` method, to close all open elements up to and\n        including this one.\n\n        Parameters\n        ----------\n        tag : str\n            The element name\n\n        attrib : dict of str -> str\n            Attribute dictionary.  Alternatively, attributes can\n            be given as keyword arguments.\n\n        Returns\n        -------\n        id : int\n            Returns an element identifier.\n        \"\"\"\n        self._flush()\n        # This is just busy work -- we know our tag names are clean\n        # tag = xml_escape_cdata(tag)\n        self._data = []\n        self._tags.append(tag)\n        self.write(self.get_indentation_spaces(-1))\n        self.write(f\"<{tag}\")\n        if attrib or extra:\n            attrib = attrib.copy()\n            attrib.update(extra)\n            attrib = list(attrib.items())\n            attrib.sort()\n            for k, v in attrib:\n                if v is not None:\n                    # This is just busy work -- we know our keys are clean\n                    # k = xml_escape_cdata(k)\n                    v = self.xml_escape(v)\n                    self.write(f\" {k}=\\\"{v}\\\"\")\n        self._open = 1\n\n        return len(self._tags)\n\n    @contextlib.contextmanager\n    def xml_cleaning_method(self, method='escape_xml', **clean_kwargs):\n        \"\"\"Context manager to control how XML data tags are cleaned (escaped) to\n        remove potentially unsafe characters or constructs.\n\n        The default (``method='escape_xml'``) applies brute-force escaping of\n        certain key XML characters like ``<``, ``>``, and ``&`` to ensure that\n        the output is not valid XML.\n\n        In order to explicitly allow certain XML tags (e.g. link reference or\n        emphasis tags), use ``method='bleach_clean'``.  This sanitizes the data\n        string using the ``clean`` function of the\n        `bleach <https://bleach.readthedocs.io/en/latest/clean.html>`_ package.\n        Any additional keyword arguments will be passed directly to the\n        ``clean`` function.\n\n        Finally, use ``method='none'`` to disable any sanitization. This should\n        be used sparingly.\n\n        Example::\n\n          w = writer.XMLWriter(ListWriter(lines))\n          with w.xml_cleaning_method('bleach_clean'):\n              w.start('td')\n              w.data('<a href=\"https://google.com\">google.com</a>')\n              w.end()\n\n        Parameters\n        ----------\n        method : str\n            Cleaning method.  Allowed values are \"escape_xml\",\n            \"bleach_clean\", and \"none\".\n\n        **clean_kwargs : keyword args\n            Additional keyword args that are passed to the\n            bleach.clean() function.\n        \"\"\"\n        current_xml_escape_cdata = self.xml_escape_cdata\n\n        if method == 'bleach_clean':\n            # NOTE: bleach is imported locally to avoid importing it when\n            # it is not nocessary\n            try:\n                import bleach\n            except ImportError:\n                raise ValueError('bleach package is required when HTML escaping is disabled.\\n'\n                                 'Use \"pip install bleach\".')\n\n            if clean_kwargs is None:\n                clean_kwargs = {}\n            self.xml_escape_cdata = lambda x: bleach.clean(x, **clean_kwargs)\n        elif method == \"none\":\n            self.xml_escape_cdata = lambda x: x\n        elif method != 'escape_xml':\n            raise ValueError('allowed values of method are \"escape_xml\", \"bleach_clean\", and \"none\"')\n\n        yield\n\n        self.xml_escape_cdata = current_xml_escape_cdata\n\n    @contextlib.contextmanager\n    def tag(self, tag, attrib={}, **extra):\n        \"\"\"\n        A convenience method for creating wrapper elements using the\n        ``with`` statement.\n\n        Examples\n        --------\n\n        >>> with writer.tag('foo'):  # doctest: +SKIP\n        ...     writer.element('bar')\n        ... # </foo> is implicitly closed here\n        ...\n\n        Parameters are the same as to `start`.\n        \"\"\"\n        self.start(tag, attrib, **extra)\n        yield\n        self.end(tag)\n\n    def comment(self, comment):\n        \"\"\"\n        Adds a comment to the output stream.\n\n        Parameters\n        ----------\n        comment : str\n            Comment text, as a Unicode string.\n        \"\"\"\n        self._flush()\n        self.write(self.get_indentation_spaces())\n        self.write(f\"<!-- {self.xml_escape_cdata(comment)} -->\\n\")\n\n    def data(self, text):\n        \"\"\"\n        Adds character data to the output stream.\n\n        Parameters\n        ----------\n        text : str\n            Character data, as a Unicode string.\n        \"\"\"\n        self._data.append(text)\n\n    def end(self, tag=None, indent=True, wrap=False):\n        \"\"\"\n        Closes the current element (opened by the most recent call to\n        `start`).\n\n        Parameters\n        ----------\n        tag : str\n            Element name.  If given, the tag must match the start tag.\n            If omitted, the current element is closed.\n        \"\"\"\n        if tag:\n            if not self._tags:\n                raise ValueError(f\"unbalanced end({tag})\")\n            if tag != self._tags[-1]:\n                raise ValueError(f\"expected end({self._tags[-1]}), got {tag}\")\n        else:\n            if not self._tags:\n                raise ValueError(\"unbalanced end()\")\n        tag = self._tags.pop()\n        if self._data:\n            self._flush(indent, wrap)\n        elif self._open:\n            self._open = 0\n            self.write(\"/>\\n\")\n            return\n        if indent:\n            self.write(self.get_indentation_spaces())\n        self.write(f\"</{tag}>\\n\")\n\n    def close(self, id):\n        \"\"\"\n        Closes open elements, up to (and including) the element identified\n        by the given identifier.\n\n        Parameters\n        ----------\n        id : int\n            Element identifier, as returned by the `start` method.\n        \"\"\"\n        while len(self._tags) > id:\n            self.end()\n\n    def element(self, tag, text=None, wrap=False, attrib={}, **extra):\n        \"\"\"\n        Adds an entire element.  This is the same as calling `start`,\n        `data`, and `end` in sequence. The ``text`` argument\n        can be omitted.\n        \"\"\"\n        self.start(tag, attrib, **extra)\n        if text:\n            self.data(text)\n        self.end(indent=False, wrap=wrap)\n\n    def flush(self):\n        pass  # replaced by the constructor\n\n    def get_indentation(self):\n        \"\"\"\n        Returns the number of indentation levels the file is currently\n        in.\n        \"\"\"\n        return len(self._tags)\n\n    def get_indentation_spaces(self, offset=0):\n        \"\"\"\n        Returns a string of spaces that matches the current\n        indentation level.\n        \"\"\"\n        return self._indentation[:len(self._tags) + offset]\n\n    @staticmethod\n    def object_attrs(obj, attrs):\n        \"\"\"\n        Converts an object with a bunch of attributes on an object\n        into a dictionary for use by the `XMLWriter`.\n\n        Parameters\n        ----------\n        obj : object\n            Any Python object\n\n        attrs : sequence of str\n            Attribute names to pull from the object\n\n        Returns\n        -------\n        attrs : dict\n            Maps attribute names to the values retrieved from\n            ``obj.attr``.  If any of the attributes is `None`, it will\n            not appear in the output dictionary.\n        \"\"\"\n        d = {}\n        for attr in attrs:\n            if getattr(obj, attr) is not None:\n                d[attr.replace('_', '-')] = str(getattr(obj, attr))\n        return d"},{"col":4,"comment":"null","endLoc":3415,"header":"def __init__(self, ID=None, id=None, config=None, pos=None, version=\"1.4\")","id":5817,"name":"__init__","nodeType":"Function","startLoc":3390,"text":"def __init__(self, ID=None, id=None, config=None, pos=None, version=\"1.4\"):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        Element.__init__(self)\n        self.ID = resolve_id(ID, id, config, pos)\n        self.description = None\n\n        self._coordinate_systems = HomogeneousList(CooSys)\n        self._time_systems = HomogeneousList(TimeSys)\n        self._params = HomogeneousList(Param)\n        self._infos = HomogeneousList(Info)\n        self._resources = HomogeneousList(Resource)\n        self._groups = HomogeneousList(Group)\n\n        version = str(version)\n        if version == '1.0':\n            warnings.warn('VOTable 1.0 support is deprecated in astropy 4.3 and will be '\n                          'removed in a future release', AstropyDeprecationWarning)\n        elif (version != '1.0') and (version not in self._version_namespace_map):\n            allowed_from_map = \"', '\".join(self._version_namespace_map)\n            raise ValueError(f\"'version' should be in ('1.0', '{allowed_from_map}').\")\n\n        self._version = version"},{"col":4,"comment":"\n        Adds a comment to the output stream.\n\n        Parameters\n        ----------\n        comment : str\n            Comment text, as a Unicode string.\n        ","endLoc":236,"header":"def comment(self, comment)","id":5818,"name":"comment","nodeType":"Function","startLoc":225,"text":"def comment(self, comment):\n        \"\"\"\n        Adds a comment to the output stream.\n\n        Parameters\n        ----------\n        comment : str\n            Comment text, as a Unicode string.\n        \"\"\"\n        self._flush()\n        self.write(self.get_indentation_spaces())\n        self.write(f\"<!-- {self.xml_escape_cdata(comment)} -->\\n\")"},{"col":4,"comment":"\n        Closes open elements, up to (and including) the element identified\n        by the given identifier.\n\n        Parameters\n        ----------\n        id : int\n            Element identifier, as returned by the `start` method.\n        ","endLoc":290,"header":"def close(self, id)","id":5819,"name":"close","nodeType":"Function","startLoc":279,"text":"def close(self, id):\n        \"\"\"\n        Closes open elements, up to (and including) the element identified\n        by the given identifier.\n\n        Parameters\n        ----------\n        id : int\n            Element identifier, as returned by the `start` method.\n        \"\"\"\n        while len(self._tags) > id:\n            self.end()"},{"col":4,"comment":"\n        Adds an entire element.  This is the same as calling `start`,\n        `data`, and `end` in sequence. The ``text`` argument\n        can be omitted.\n        ","endLoc":301,"header":"def element(self, tag, text=None, wrap=False, attrib={}, **extra)","id":5820,"name":"element","nodeType":"Function","startLoc":292,"text":"def element(self, tag, text=None, wrap=False, attrib={}, **extra):\n        \"\"\"\n        Adds an entire element.  This is the same as calling `start`,\n        `data`, and `end` in sequence. The ``text`` argument\n        can be omitted.\n        \"\"\"\n        self.start(tag, attrib, **extra)\n        if text:\n            self.data(text)\n        self.end(indent=False, wrap=wrap)"},{"className":"W26","col":0,"comment":"\n    The given element was not supported inside of the given element\n    until the specified VOTable version, however the version declared\n    in the file is for an earlier version.  These attributes may not\n    be written out to the file.\n    ","endLoc":701,"id":5821,"nodeType":"Class","startLoc":692,"text":"class W26(VOTableSpecWarning):\n    \"\"\"\n    The given element was not supported inside of the given element\n    until the specified VOTable version, however the version declared\n    in the file is for an earlier version.  These attributes may not\n    be written out to the file.\n    \"\"\"\n\n    message_template = \"'{}' inside '{}' added in VOTable {}\"\n    default_args = ('child', 'parent', 'X.X')"},{"attributeType":"null","col":4,"comment":"null","endLoc":700,"id":5822,"name":"message_template","nodeType":"Attribute","startLoc":700,"text":"message_template"},{"col":4,"comment":"null","endLoc":304,"header":"def flush(self)","id":5823,"name":"flush","nodeType":"Function","startLoc":303,"text":"def flush(self):\n        pass  # replaced by the constructor"},{"col":4,"comment":"\n        Returns the number of indentation levels the file is currently\n        in.\n        ","endLoc":311,"header":"def get_indentation(self)","id":5824,"name":"get_indentation","nodeType":"Function","startLoc":306,"text":"def get_indentation(self):\n        \"\"\"\n        Returns the number of indentation levels the file is currently\n        in.\n        \"\"\"\n        return len(self._tags)"},{"col":4,"comment":"\n        Converts an object with a bunch of attributes on an object\n        into a dictionary for use by the `XMLWriter`.\n\n        Parameters\n        ----------\n        obj : object\n            Any Python object\n\n        attrs : sequence of str\n            Attribute names to pull from the object\n\n        Returns\n        -------\n        attrs : dict\n            Maps attribute names to the values retrieved from\n            ``obj.attr``.  If any of the attributes is `None`, it will\n            not appear in the output dictionary.\n        ","endLoc":345,"header":"@staticmethod\n    def object_attrs(obj, attrs)","id":5825,"name":"object_attrs","nodeType":"Function","startLoc":320,"text":"@staticmethod\n    def object_attrs(obj, attrs):\n        \"\"\"\n        Converts an object with a bunch of attributes on an object\n        into a dictionary for use by the `XMLWriter`.\n\n        Parameters\n        ----------\n        obj : object\n            Any Python object\n\n        attrs : sequence of str\n            Attribute names to pull from the object\n\n        Returns\n        -------\n        attrs : dict\n            Maps attribute names to the values retrieved from\n            ``obj.attr``.  If any of the attributes is `None`, it will\n            not appear in the output dictionary.\n        \"\"\"\n        d = {}\n        for attr in attrs:\n            if getattr(obj, attr) is not None:\n                d[attr.replace('_', '-')] = str(getattr(obj, attr))\n        return d"},{"attributeType":"Time","col":0,"comment":"null","endLoc":39,"id":5826,"name":"tm3","nodeType":"Attribute","startLoc":39,"text":"tm3"},{"attributeType":"null","col":8,"comment":"null","endLoc":69,"id":5827,"name":"_data","nodeType":"Attribute","startLoc":69,"text":"self._data"},{"attributeType":"null","col":8,"comment":"null","endLoc":73,"id":5828,"name":"xml_escape","nodeType":"Attribute","startLoc":73,"text":"self.xml_escape"},{"attributeType":"null","col":12,"comment":"null","endLoc":66,"id":5829,"name":"flush","nodeType":"Attribute","startLoc":66,"text":"self.flush"},{"attributeType":"null","col":8,"comment":"null","endLoc":67,"id":5830,"name":"_open","nodeType":"Attribute","startLoc":67,"text":"self._open"},{"attributeType":"null","col":8,"comment":"null","endLoc":68,"id":5831,"name":"_tags","nodeType":"Attribute","startLoc":68,"text":"self._tags"},{"attributeType":"null","col":8,"comment":"null","endLoc":72,"id":5832,"name":"xml_escape_cdata","nodeType":"Attribute","startLoc":72,"text":"self.xml_escape_cdata"},{"attributeType":"null","col":8,"comment":"null","endLoc":64,"id":5833,"name":"write","nodeType":"Attribute","startLoc":64,"text":"self.write"},{"attributeType":"null","col":8,"comment":"null","endLoc":70,"id":5834,"name":"_indentation","nodeType":"Attribute","startLoc":70,"text":"self._indentation"},{"attributeType":"Column","col":0,"comment":"null","endLoc":41,"id":5835,"name":"obj","nodeType":"Attribute","startLoc":41,"text":"obj"},{"col":0,"comment":"\n    Warn or raise an exception, depending on the verify setting.\n    ","endLoc":103,"header":"def warn_or_raise(warning_class, exception_class=None, args=(), config=None,\n                  pos=None, stacklevel=1)","id":5836,"name":"warn_or_raise","nodeType":"Function","startLoc":87,"text":"def warn_or_raise(warning_class, exception_class=None, args=(), config=None,\n                  pos=None, stacklevel=1):\n    \"\"\"\n    Warn or raise an exception, depending on the verify setting.\n    \"\"\"\n    if config is None:\n        config = {}\n    # NOTE: the default here is deliberately warn rather than ignore, since\n    # one would expect that calling warn_or_raise without config should not\n    # silence the warnings.\n    config_value = config.get('verify', 'warn')\n    if config_value == 'exception':\n        if exception_class is None:\n            exception_class = warning_class\n        vo_raise(exception_class, args, config, pos)\n    elif config_value == 'warn':\n        vo_warn(warning_class, args, config, pos, stacklevel=stacklevel+1)"},{"col":0,"comment":"\n    Raise an exception, with proper position information if available.\n    ","endLoc":112,"header":"def vo_raise(exception_class, args=(), config=None, pos=None)","id":5837,"name":"vo_raise","nodeType":"Function","startLoc":106,"text":"def vo_raise(exception_class, args=(), config=None, pos=None):\n    \"\"\"\n    Raise an exception, with proper position information if available.\n    \"\"\"\n    if config is None:\n        config = {}\n    raise exception_class(args, config, pos)"},{"col":0,"comment":"\n    Warn, with proper position information if available.\n    ","endLoc":144,"header":"def vo_warn(warning_class, args=(), config=None, pos=None, stacklevel=1)","id":5838,"name":"vo_warn","nodeType":"Function","startLoc":133,"text":"def vo_warn(warning_class, args=(), config=None, pos=None, stacklevel=1):\n    \"\"\"\n    Warn, with proper position information if available.\n    \"\"\"\n    if config is None:\n        config = {}\n    # NOTE: the default here is deliberately warn rather than ignore, since\n    # one would expect that calling warn_or_raise without config should not\n    # silence the warnings.\n    if config.get('verify', 'warn') != 'ignore':\n        warning = warning_class(args, config, pos)\n        _suppressed_warning(warning, config, stacklevel=stacklevel+1)"},{"col":0,"comment":"null","endLoc":84,"header":"def _suppressed_warning(warning, config, stacklevel=2)","id":5839,"name":"_suppressed_warning","nodeType":"Function","startLoc":75,"text":"def _suppressed_warning(warning, config, stacklevel=2):\n    warning_class = type(warning)\n    config.setdefault('_warning_counts', dict()).setdefault(warning_class, 0)\n    config['_warning_counts'][warning_class] += 1\n    message_count = config['_warning_counts'][warning_class]\n    if message_count <= conf.max_warnings:\n        if message_count == conf.max_warnings:\n            warning.formatted_message += \\\n                ' (suppressing further warnings of this type...)'\n        warn(warning, stacklevel=stacklevel+1)"},{"col":0,"comment":"\n    Raise an exception, with proper position information if available.\n\n    Restores the original traceback of the exception, and should only\n    be called within an \"except:\" block of code.\n    ","endLoc":130,"header":"def vo_reraise(exc, config=None, pos=None, additional='')","id":5840,"name":"vo_reraise","nodeType":"Function","startLoc":115,"text":"def vo_reraise(exc, config=None, pos=None, additional=''):\n    \"\"\"\n    Raise an exception, with proper position information if available.\n\n    Restores the original traceback of the exception, and should only\n    be called within an \"except:\" block of code.\n    \"\"\"\n    if config is None:\n        config = {}\n    message = _format_message(str(exc), exc.__class__.__name__, config, pos)\n    if message.split()[0] == str(exc).split()[0]:\n        message = str(exc)\n    if len(additional):\n        message += ' ' + additional\n    exc.args = (message,)\n    raise exc"},{"col":0,"comment":"\n    Returns False if *ucd* is not a valid `unified content descriptor`_.\n\n    Parameters\n    ----------\n    ucd : str\n        The UCD string\n\n    check_controlled_vocabulary : bool, optional\n        If `True`, then each word in the UCD will be verified against\n        the UCD1+ controlled vocabulary, (as required by the VOTable\n        specification version 1.2), otherwise not.\n\n    has_colon : bool, optional\n        If `True`, the UCD may contain a colon (as defined in earlier\n        versions of the standard).\n\n    Returns\n    -------\n    valid : bool\n    ","endLoc":192,"header":"def check_ucd(ucd, check_controlled_vocabulary=False, has_colon=False)","id":5841,"name":"check_ucd","nodeType":"Function","startLoc":161,"text":"def check_ucd(ucd, check_controlled_vocabulary=False, has_colon=False):\n    \"\"\"\n    Returns False if *ucd* is not a valid `unified content descriptor`_.\n\n    Parameters\n    ----------\n    ucd : str\n        The UCD string\n\n    check_controlled_vocabulary : bool, optional\n        If `True`, then each word in the UCD will be verified against\n        the UCD1+ controlled vocabulary, (as required by the VOTable\n        specification version 1.2), otherwise not.\n\n    has_colon : bool, optional\n        If `True`, the UCD may contain a colon (as defined in earlier\n        versions of the standard).\n\n    Returns\n    -------\n    valid : bool\n    \"\"\"\n    if ucd is None:\n        return True\n\n    try:\n        parse_ucd(ucd,\n                  check_controlled_vocabulary=check_controlled_vocabulary,\n                  has_colon=has_colon)\n    except ValueError:\n        return False\n    return True"},{"col":0,"comment":"null","endLoc":150,"header":"def warn_unknown_attrs(element, attrs, config, pos, good_attr=[], stacklevel=1)","id":5842,"name":"warn_unknown_attrs","nodeType":"Function","startLoc":147,"text":"def warn_unknown_attrs(element, attrs, config, pos, good_attr=[], stacklevel=1):\n    for attr in attrs:\n        if attr not in good_attr:\n            vo_warn(W48, (attr, element), config, pos, stacklevel=stacklevel+1)"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":5843,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"attributeType":"None","col":0,"comment":"null","endLoc":69,"id":5844,"name":"_ucd_singleton","nodeType":"Attribute","startLoc":69,"text":"_ucd_singleton"},{"col":0,"comment":"","endLoc":4,"header":"ucd.py#<anonymous>","id":5845,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis file contains routines to verify the correctness of UCD strings.\n\"\"\"\n\n__all__ = ['parse_ucd', 'check_ucd']\n\n_ucd_singleton = None"},{"attributeType":"null","col":4,"comment":"null","endLoc":701,"id":5846,"name":"default_args","nodeType":"Attribute","startLoc":701,"text":"default_args"},{"className":"W27","col":0,"comment":"\n    The ``COOSYS`` element was deprecated in VOTABLE version 1.2 in\n    favor of a reference to the Space-Time Coordinate (STC) data\n    model (see `utype\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:utype>`__\n    and the IVOA note `referencing STC in VOTable\n    <http://ivoa.net/Documents/latest/VOTableSTC.html>`__.\n    ","endLoc":714,"id":5847,"nodeType":"Class","startLoc":704,"text":"class W27(VOTableSpecWarning):\n    \"\"\"\n    The ``COOSYS`` element was deprecated in VOTABLE version 1.2 in\n    favor of a reference to the Space-Time Coordinate (STC) data\n    model (see `utype\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:utype>`__\n    and the IVOA note `referencing STC in VOTable\n    <http://ivoa.net/Documents/latest/VOTableSTC.html>`__.\n    \"\"\"\n\n    message_template = \"COOSYS deprecated in VOTable 1.2\""},{"attributeType":"null","col":4,"comment":"null","endLoc":714,"id":5848,"name":"message_template","nodeType":"Attribute","startLoc":714,"text":"message_template"},{"className":"W28","col":0,"comment":"\n    The given attribute was not supported on the given element until the\n    specified VOTable version, however the version declared in the file is\n    for an earlier version.  These attributes may not be written out to\n    the file.\n    ","endLoc":726,"id":5849,"nodeType":"Class","startLoc":717,"text":"class W28(VOTableSpecWarning):\n    \"\"\"\n    The given attribute was not supported on the given element until the\n    specified VOTable version, however the version declared in the file is\n    for an earlier version.  These attributes may not be written out to\n    the file.\n    \"\"\"\n\n    message_template = \"'{}' on '{}' added in VOTable {}\"\n    default_args = ('attribute', 'element', 'X.X')"},{"attributeType":"null","col":4,"comment":"null","endLoc":725,"id":5850,"name":"message_template","nodeType":"Attribute","startLoc":725,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":726,"id":5851,"name":"default_args","nodeType":"Attribute","startLoc":726,"text":"default_args"},{"className":"W29","col":0,"comment":"\n    Some VOTable files specify their version number in the form \"v1.0\",\n    when the only supported forms in the spec are \"1.0\".\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__\n    ","endLoc":741,"id":5852,"nodeType":"Class","startLoc":729,"text":"class W29(VOTableSpecWarning):\n    \"\"\"\n    Some VOTable files specify their version number in the form \"v1.0\",\n    when the only supported forms in the spec are \"1.0\".\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__\n    \"\"\"\n\n    message_template = \"Version specified in non-standard form '{}'\"\n    default_args = ('v1.0',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":740,"id":5853,"name":"message_template","nodeType":"Attribute","startLoc":740,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":741,"id":5854,"name":"default_args","nodeType":"Attribute","startLoc":741,"text":"default_args"},{"className":"W30","col":0,"comment":"\n    Some VOTable files write missing floating-point values in non-standard ways,\n    such as \"null\" and \"-\".  If ``verify`` is not ``'exception'``, any\n    non-standard floating-point literals are treated as missing values.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    ","endLoc":757,"id":5855,"nodeType":"Class","startLoc":744,"text":"class W30(VOTableSpecWarning):\n    \"\"\"\n    Some VOTable files write missing floating-point values in non-standard ways,\n    such as \"null\" and \"-\".  If ``verify`` is not ``'exception'``, any\n    non-standard floating-point literals are treated as missing values.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    \"\"\"\n\n    message_template = \"Invalid literal for float '{}'.  Treating as empty.\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":756,"id":5856,"name":"message_template","nodeType":"Attribute","startLoc":756,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":757,"id":5857,"name":"default_args","nodeType":"Attribute","startLoc":757,"text":"default_args"},{"className":"W31","col":0,"comment":"\n    Since NaN's can not be represented in integer fields directly, a null\n    value must be specified in the FIELD descriptor to support reading\n    NaN's from the tabledata.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    ","endLoc":772,"id":5858,"nodeType":"Class","startLoc":760,"text":"class W31(VOTableSpecWarning):\n    \"\"\"\n    Since NaN's can not be represented in integer fields directly, a null\n    value must be specified in the FIELD descriptor to support reading\n    NaN's from the tabledata.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    \"\"\"\n\n    message_template = \"NaN given in an integral field without a specified null value\""},{"attributeType":"null","col":4,"comment":"null","endLoc":772,"id":5859,"name":"message_template","nodeType":"Attribute","startLoc":772,"text":"message_template"},{"className":"W32","col":0,"comment":"\n    Each field in a table must have a unique ID.  If two or more fields\n    have the same ID, some will be renamed to ensure that all IDs are\n    unique.\n\n    From the VOTable 1.2 spec:\n\n        The ``ID`` and ``ref`` attributes are defined as XML types\n        ``ID`` and ``IDREF`` respectively. This means that the\n        contents of ``ID`` is an identifier which must be unique\n        throughout a VOTable document, and that the contents of the\n        ``ref`` attribute represents a reference to an identifier\n        which must exist in the VOTable document.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    ","endLoc":797,"id":5860,"nodeType":"Class","startLoc":775,"text":"class W32(VOTableSpecWarning):\n    \"\"\"\n    Each field in a table must have a unique ID.  If two or more fields\n    have the same ID, some will be renamed to ensure that all IDs are\n    unique.\n\n    From the VOTable 1.2 spec:\n\n        The ``ID`` and ``ref`` attributes are defined as XML types\n        ``ID`` and ``IDREF`` respectively. This means that the\n        contents of ``ID`` is an identifier which must be unique\n        throughout a VOTable document, and that the contents of the\n        ``ref`` attribute represents a reference to an identifier\n        which must exist in the VOTable document.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    \"\"\"\n\n    message_template = \"Duplicate ID '{}' renamed to '{}' to ensure uniqueness\"\n    default_args = ('x', 'x_2')"},{"attributeType":"null","col":4,"comment":"null","endLoc":796,"id":5861,"name":"message_template","nodeType":"Attribute","startLoc":796,"text":"message_template"},{"className":"W33","col":0,"comment":"\n    Each field in a table must have a unique name.  If two or more\n    fields have the same name, some will be renamed to ensure that all\n    names are unique.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    ","endLoc":813,"id":5862,"nodeType":"Class","startLoc":800,"text":"class W33(VOTableChangeWarning):\n    \"\"\"\n    Each field in a table must have a unique name.  If two or more\n    fields have the same name, some will be renamed to ensure that all\n    names are unique.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:name>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:name>`__\n    \"\"\"\n\n    message_template = \"Column name '{}' renamed to '{}' to ensure uniqueness\"\n    default_args = ('x', 'x_2')"},{"attributeType":"null","col":4,"comment":"null","endLoc":812,"id":5863,"name":"message_template","nodeType":"Attribute","startLoc":812,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":797,"id":5864,"name":"default_args","nodeType":"Attribute","startLoc":797,"text":"default_args"},{"className":"W34","col":0,"comment":"\n    The attribute requires the value to be a valid XML token, as\n    defined by `XML 1.0\n    <http://www.w3.org/TR/2000/WD-xml-2e-20000814#NT-Nmtoken>`__.\n    ","endLoc":824,"id":5865,"nodeType":"Class","startLoc":816,"text":"class W34(VOTableSpecWarning):\n    \"\"\"\n    The attribute requires the value to be a valid XML token, as\n    defined by `XML 1.0\n    <http://www.w3.org/TR/2000/WD-xml-2e-20000814#NT-Nmtoken>`__.\n    \"\"\"\n\n    message_template = \"'{}' is an invalid token for attribute '{}'\"\n    default_args = ('x', 'y')"},{"attributeType":"null","col":4,"comment":"null","endLoc":823,"id":5866,"name":"message_template","nodeType":"Attribute","startLoc":823,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":813,"id":5867,"name":"default_args","nodeType":"Attribute","startLoc":813,"text":"default_args"},{"attributeType":"null","col":4,"comment":"null","endLoc":824,"id":5868,"name":"default_args","nodeType":"Attribute","startLoc":824,"text":"default_args"},{"className":"W35","col":0,"comment":"\n    The ``name`` and ``value`` attributes are required on all ``INFO``\n    elements.\n\n    **References:** `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC32>`__\n    ","endLoc":839,"id":5869,"nodeType":"Class","startLoc":827,"text":"class W35(VOTableSpecWarning):\n    \"\"\"\n    The ``name`` and ``value`` attributes are required on all ``INFO``\n    elements.\n\n    **References:** `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC32>`__\n    \"\"\"\n\n    message_template = \"'{}' attribute required for INFO elements\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":838,"id":5870,"name":"message_template","nodeType":"Attribute","startLoc":838,"text":"message_template"},{"fileName":"converters.py","filePath":"astropy/io/votable","id":5871,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module handles the conversion of various VOTABLE datatypes\nto/from TABLEDATA_ and BINARY_ formats.\n\"\"\"\n\n\n# STDLIB\nimport re\nimport sys\nfrom struct import unpack as _struct_unpack\nfrom struct import pack as _struct_pack\n\n# THIRD-PARTY\nimport numpy as np\nfrom numpy import ma\n\n# ASTROPY\nfrom astropy.utils.xml.writer import xml_escape_cdata\n\n# LOCAL\nfrom .exceptions import (vo_raise, vo_warn, warn_or_raise, W01,\n    W30, W31, W39, W46, W47, W49, W51, W55, E01, E02, E03, E04,\n    E05, E06, E24)\n\n\n__all__ = ['get_converter', 'Converter', 'table_column_to_votable_datatype']\n\n\npedantic_array_splitter = re.compile(r\" +\")\narray_splitter = re.compile(r\"\\s+|(?:\\s*,\\s*)\")\n\"\"\"\nA regex to handle splitting values on either whitespace or commas.\n\nSPEC: Usage of commas is not actually allowed by the spec, but many\nfiles in the wild use them.\n\"\"\"\n\n_zero_int = b'\\0\\0\\0\\0'\n_empty_bytes = b''\n_zero_byte = b'\\0'\n\n\nstruct_unpack = _struct_unpack\nstruct_pack = _struct_pack\n\n\nif sys.byteorder == 'little':\n    def _ensure_bigendian(x):\n        if x.dtype.byteorder != '>':\n            return x.byteswap()\n        return x\nelse:\n    def _ensure_bigendian(x):\n        if x.dtype.byteorder == '<':\n            return x.byteswap()\n        return x\n\n\ndef _make_masked_array(data, mask):\n    \"\"\"\n    Masked arrays of zero length that also have a mask of zero length\n    cause problems in Numpy (at least in 1.6.2).  This function\n    creates a masked array from data and a mask, unless it is zero\n    length.\n    \"\"\"\n    # np.ma doesn't like setting mask to []\n    if len(data):\n        return ma.array(\n            np.array(data),\n            mask=np.array(mask, dtype='bool'))\n    else:\n        return ma.array(np.array(data))\n\n\ndef bitarray_to_bool(data, length):\n    \"\"\"\n    Converts a bit array (a string of bits in a bytes object) to a\n    boolean Numpy array.\n\n    Parameters\n    ----------\n    data : bytes\n        The bit array.  The most significant byte is read first.\n\n    length : int\n        The number of bits to read.  The least significant bits in the\n        data bytes beyond length will be ignored.\n\n    Returns\n    -------\n    array : numpy bool array\n    \"\"\"\n    results = []\n    for byte in data:\n        for bit_no in range(7, -1, -1):\n            bit = byte & (1 << bit_no)\n            bit = (bit != 0)\n            results.append(bit)\n            if len(results) == length:\n                break\n        if len(results) == length:\n            break\n\n    return np.array(results, dtype='b1')\n\n\ndef bool_to_bitarray(value):\n    \"\"\"\n    Converts a numpy boolean array to a bit array (a string of bits in\n    a bytes object).\n\n    Parameters\n    ----------\n    value : numpy bool array\n\n    Returns\n    -------\n    bit_array : bytes\n        The first value in the input array will be the most\n        significant bit in the result.  The length will be `floor((N +\n        7) / 8)` where `N` is the length of `value`.\n    \"\"\"\n    value = value.flat\n    bit_no = 7\n    byte = 0\n    bytes = []\n    for v in value:\n        if v:\n            byte |= 1 << bit_no\n        if bit_no == 0:\n            bytes.append(byte)\n            bit_no = 7\n            byte = 0\n        else:\n            bit_no -= 1\n    if bit_no != 7:\n        bytes.append(byte)\n\n    return struct_pack(f\"{len(bytes)}B\", *bytes)\n\n\nclass Converter:\n    \"\"\"\n    The base class for all converters.  Each subclass handles\n    converting a specific VOTABLE data type to/from the TABLEDATA_ and\n    BINARY_ on-disk representations.\n\n    Parameters\n    ----------\n    field : `~astropy.io.votable.tree.Field`\n        object describing the datatype\n\n    config : dict\n        The parser configuration dictionary\n\n    pos : tuple\n        The position in the XML file where the FIELD object was\n        found.  Used for error messages.\n\n    \"\"\"\n\n    def __init__(self, field, config=None, pos=None):\n        pass\n\n    @staticmethod\n    def _parse_length(read):\n        return struct_unpack(\">I\", read(4))[0]\n\n    @staticmethod\n    def _write_length(length):\n        return struct_pack(\">I\", int(length))\n\n    def supports_empty_values(self, config):\n        \"\"\"\n        Returns True when the field can be completely empty.\n        \"\"\"\n        return config.get('version_1_3_or_later')\n\n    def parse(self, value, config=None, pos=None):\n        \"\"\"\n        Convert the string *value* from the TABLEDATA_ format into an\n        object with the correct native in-memory datatype and mask flag.\n\n        Parameters\n        ----------\n        value : str\n            value in TABLEDATA format\n\n        Returns\n        -------\n        native : tuple\n            A two-element tuple of: value, mask.\n            The value as a Numpy array or scalar, and *mask* is True\n            if the value is missing.\n        \"\"\"\n        raise NotImplementedError(\n            \"This datatype must implement a 'parse' method.\")\n\n    def parse_scalar(self, value, config=None, pos=None):\n        \"\"\"\n        Parse a single scalar of the underlying type of the converter.\n        For non-array converters, this is equivalent to parse.  For\n        array converters, this is used to parse a single\n        element of the array.\n\n        Parameters\n        ----------\n        value : str\n            value in TABLEDATA format\n\n        Returns\n        -------\n        native : (2,) tuple\n            (value, mask)\n            The value as a Numpy array or scalar, and *mask* is True\n            if the value is missing.\n        \"\"\"\n        return self.parse(value, config, pos)\n\n    def output(self, value, mask):\n        \"\"\"\n        Convert the object *value* (in the native in-memory datatype)\n        to a unicode string suitable for serializing in the TABLEDATA_\n        format.\n\n        Parameters\n        ----------\n        value\n            The value, the native type corresponding to this converter\n\n        mask : bool\n            If `True`, will return the string representation of a\n            masked value.\n\n        Returns\n        -------\n        tabledata_repr : unicode\n        \"\"\"\n        raise NotImplementedError(\n            \"This datatype must implement a 'output' method.\")\n\n    def binparse(self, read):\n        \"\"\"\n        Reads some number of bytes from the BINARY_ format\n        representation by calling the function *read*, and returns the\n        native in-memory object representation for the datatype\n        handled by *self*.\n\n        Parameters\n        ----------\n        read : function\n            A function that given a number of bytes, returns a byte\n            string.\n\n        Returns\n        -------\n        native : (2,) tuple\n            (value, mask). The value as a Numpy array or scalar, and *mask* is\n            True if the value is missing.\n        \"\"\"\n        raise NotImplementedError(\n            \"This datatype must implement a 'binparse' method.\")\n\n    def binoutput(self, value, mask):\n        \"\"\"\n        Convert the object *value* in the native in-memory datatype to\n        a string of bytes suitable for serialization in the BINARY_\n        format.\n\n        Parameters\n        ----------\n        value\n            The value, the native type corresponding to this converter\n\n        mask : bool\n            If `True`, will return the string representation of a\n            masked value.\n\n        Returns\n        -------\n        bytes : bytes\n            The binary representation of the value, suitable for\n            serialization in the BINARY_ format.\n        \"\"\"\n        raise NotImplementedError(\n            \"This datatype must implement a 'binoutput' method.\")\n\n\nclass Char(Converter):\n    \"\"\"\n    Handles the char datatype. (7-bit unsigned characters)\n\n    Missing values are not handled for string or unicode types.\n    \"\"\"\n    default = _empty_bytes\n\n    def __init__(self, field, config=None, pos=None):\n        if config is None:\n            config = {}\n\n        Converter.__init__(self, field, config, pos)\n\n        self.field_name = field.name\n\n        if field.arraysize is None:\n            vo_warn(W47, (), config, pos)\n            field.arraysize = '1'\n\n        if field.arraysize == '*':\n            self.format = 'O'\n            self.binparse = self._binparse_var\n            self.binoutput = self._binoutput_var\n            self.arraysize = '*'\n        else:\n            if field.arraysize.endswith('*'):\n                field.arraysize = field.arraysize[:-1]\n            try:\n                self.arraysize = int(field.arraysize)\n            except ValueError:\n                vo_raise(E01, (field.arraysize, 'char', field.ID), config)\n            self.format = f'U{self.arraysize:d}'\n            self.binparse = self._binparse_fixed\n            self.binoutput = self._binoutput_fixed\n            self._struct_format = f\">{self.arraysize:d}s\"\n\n    def supports_empty_values(self, config):\n        return True\n\n    def parse(self, value, config=None, pos=None):\n        if self.arraysize != '*' and len(value) > self.arraysize:\n            vo_warn(W46, ('char', self.arraysize), config, pos)\n\n        # Warn about non-ascii characters if warnings are enabled.\n        try:\n            value.encode('ascii')\n        except UnicodeEncodeError:\n            vo_warn(W55, (self.field_name, value), config, pos)\n        return value, False\n\n    def output(self, value, mask):\n        if mask:\n            return ''\n\n        # The output methods for Char assume that value is either str or bytes.\n        # This method needs to return a str, but needs to warn if the str contains\n        # non-ASCII characters.\n        try:\n            if isinstance(value, str):\n                value.encode('ascii')\n            else:\n                # Check for non-ASCII chars in the bytes object.\n                value = value.decode('ascii')\n        except (ValueError, UnicodeEncodeError):\n            warn_or_raise(E24, UnicodeEncodeError, (value, self.field_name))\n        finally:\n            if isinstance(value, bytes):\n                # Convert the bytes to str regardless of non-ASCII chars.\n                value = value.decode('utf-8')\n\n        return xml_escape_cdata(value)\n\n    def _binparse_var(self, read):\n        length = self._parse_length(read)\n        return read(length).decode('ascii'), False\n\n    def _binparse_fixed(self, read):\n        s = struct_unpack(self._struct_format, read(self.arraysize))[0]\n        end = s.find(_zero_byte)\n        s = s.decode('ascii')\n        if end != -1:\n            return s[:end], False\n        return s, False\n\n    def _binoutput_var(self, value, mask):\n        if mask or value is None or value == '':\n            return _zero_int\n        if isinstance(value, str):\n            try:\n                value = value.encode('ascii')\n            except ValueError:\n                vo_raise(E24, (value, self.field_name))\n        return self._write_length(len(value)) + value\n\n    def _binoutput_fixed(self, value, mask):\n        if mask:\n            value = _empty_bytes\n        elif isinstance(value, str):\n            try:\n                value = value.encode('ascii')\n            except ValueError:\n                vo_raise(E24, (value, self.field_name))\n        return struct_pack(self._struct_format, value)\n\n\nclass UnicodeChar(Converter):\n    \"\"\"\n    Handles the unicodeChar data type. UTF-16-BE.\n\n    Missing values are not handled for string or unicode types.\n    \"\"\"\n    default = ''\n\n    def __init__(self, field, config=None, pos=None):\n        Converter.__init__(self, field, config, pos)\n\n        if field.arraysize is None:\n            vo_warn(W47, (), config, pos)\n            field.arraysize = '1'\n\n        if field.arraysize == '*':\n            self.format = 'O'\n            self.binparse = self._binparse_var\n            self.binoutput = self._binoutput_var\n            self.arraysize = '*'\n        else:\n            try:\n                self.arraysize = int(field.arraysize)\n            except ValueError:\n                vo_raise(E01, (field.arraysize, 'unicode', field.ID), config)\n            self.format = f'U{self.arraysize:d}'\n            self.binparse = self._binparse_fixed\n            self.binoutput = self._binoutput_fixed\n            self._struct_format = f\">{self.arraysize*2:d}s\"\n\n    def parse(self, value, config=None, pos=None):\n        if self.arraysize != '*' and len(value) > self.arraysize:\n            vo_warn(W46, ('unicodeChar', self.arraysize), config, pos)\n        return value, False\n\n    def output(self, value, mask):\n        if mask:\n            return ''\n        return xml_escape_cdata(str(value))\n\n    def _binparse_var(self, read):\n        length = self._parse_length(read)\n        return read(length * 2).decode('utf_16_be'), False\n\n    def _binparse_fixed(self, read):\n        s = struct_unpack(self._struct_format, read(self.arraysize * 2))[0]\n        s = s.decode('utf_16_be')\n        end = s.find('\\0')\n        if end != -1:\n            return s[:end], False\n        return s, False\n\n    def _binoutput_var(self, value, mask):\n        if mask or value is None or value == '':\n            return _zero_int\n        encoded = value.encode('utf_16_be')\n        return self._write_length(len(encoded) / 2) + encoded\n\n    def _binoutput_fixed(self, value, mask):\n        if mask:\n            value = ''\n        return struct_pack(self._struct_format, value.encode('utf_16_be'))\n\n\nclass Array(Converter):\n    \"\"\"\n    Handles both fixed and variable-lengths arrays.\n    \"\"\"\n\n    def __init__(self, field, config=None, pos=None):\n        if config is None:\n            config = {}\n        Converter.__init__(self, field, config, pos)\n        if config.get('verify', 'ignore') == 'exception':\n            self._splitter = self._splitter_pedantic\n        else:\n            self._splitter = self._splitter_lax\n\n    def parse_scalar(self, value, config=None, pos=0):\n        return self._base.parse_scalar(value, config, pos)\n\n    @staticmethod\n    def _splitter_pedantic(value, config=None, pos=None):\n        return pedantic_array_splitter.split(value)\n\n    @staticmethod\n    def _splitter_lax(value, config=None, pos=None):\n        if ',' in value:\n            vo_warn(W01, (), config, pos)\n        return array_splitter.split(value)\n\n\nclass VarArray(Array):\n    \"\"\"\n    Handles variable lengths arrays (i.e. where *arraysize* is '*').\n    \"\"\"\n    format = 'O'\n\n    def __init__(self, field, base, arraysize, config=None, pos=None):\n        Array.__init__(self, field, config)\n\n        self._base = base\n        self.default = np.array([], dtype=self._base.format)\n\n    def output(self, value, mask):\n        output = self._base.output\n        result = [output(x, m) for x, m in np.broadcast(value, mask)]\n        return ' '.join(result)\n\n    def binparse(self, read):\n        length = self._parse_length(read)\n\n        result = []\n        result_mask = []\n        binparse = self._base.binparse\n        for i in range(length):\n            val, mask = binparse(read)\n            result.append(val)\n            result_mask.append(mask)\n\n        return _make_masked_array(result, result_mask), False\n\n    def binoutput(self, value, mask):\n        if value is None or len(value) == 0:\n            return _zero_int\n\n        length = len(value)\n        result = [self._write_length(length)]\n        binoutput = self._base.binoutput\n        for x, m in zip(value, value.mask):\n            result.append(binoutput(x, m))\n        return _empty_bytes.join(result)\n\n\nclass ArrayVarArray(VarArray):\n    \"\"\"\n    Handles an array of variable-length arrays, i.e. where *arraysize*\n    ends in '*'.\n    \"\"\"\n\n    def parse(self, value, config=None, pos=None):\n        if value.strip() == '':\n            return ma.array([]), False\n\n        parts = self._splitter(value, config, pos)\n        items = self._base._items\n        parse_parts = self._base.parse_parts\n        if len(parts) % items != 0:\n            vo_raise(E02, (items, len(parts)), config, pos)\n        result = []\n        result_mask = []\n        for i in range(0, len(parts), items):\n            value, mask = parse_parts(parts[i:i+items], config, pos)\n            result.append(value)\n            result_mask.append(mask)\n\n        return _make_masked_array(result, result_mask), False\n\n\nclass ScalarVarArray(VarArray):\n    \"\"\"\n    Handles a variable-length array of numeric scalars.\n    \"\"\"\n\n    def parse(self, value, config=None, pos=None):\n        if value.strip() == '':\n            return ma.array([]), False\n\n        parts = self._splitter(value, config, pos)\n\n        parse = self._base.parse\n        result = []\n        result_mask = []\n        for x in parts:\n            value, mask = parse(x, config, pos)\n            result.append(value)\n            result_mask.append(mask)\n\n        return _make_masked_array(result, result_mask), False\n\n\nclass NumericArray(Array):\n    \"\"\"\n    Handles a fixed-length array of numeric scalars.\n    \"\"\"\n    vararray_type = ArrayVarArray\n\n    def __init__(self, field, base, arraysize, config=None, pos=None):\n        Array.__init__(self, field, config, pos)\n\n        self._base = base\n        self._arraysize = arraysize\n        self.format = f\"{tuple(arraysize)}{base.format}\"\n\n        self._items = 1\n        for dim in arraysize:\n            self._items *= dim\n\n        self._memsize = np.dtype(self.format).itemsize\n        self._bigendian_format = '>' + self.format\n\n        self.default = np.empty(arraysize, dtype=self._base.format)\n        self.default[...] = self._base.default\n\n    def parse(self, value, config=None, pos=None):\n        if config is None:\n            config = {}\n        elif config['version_1_3_or_later'] and value == '':\n            return np.zeros(self._arraysize, dtype=self._base.format), True\n        parts = self._splitter(value, config, pos)\n        if len(parts) != self._items:\n            warn_or_raise(E02, E02, (self._items, len(parts)), config, pos)\n        if config.get('verify', 'ignore') == 'exception':\n            return self.parse_parts(parts, config, pos)\n        else:\n            if len(parts) == self._items:\n                pass\n            elif len(parts) > self._items:\n                parts = parts[:self._items]\n            else:\n                parts = (parts +\n                         ([self._base.default] * (self._items - len(parts))))\n            return self.parse_parts(parts, config, pos)\n\n    def parse_parts(self, parts, config=None, pos=None):\n        base_parse = self._base.parse\n        result = []\n        result_mask = []\n        for x in parts:\n            value, mask = base_parse(x, config, pos)\n            result.append(value)\n            result_mask.append(mask)\n        result = np.array(result, dtype=self._base.format).reshape(\n            self._arraysize)\n        result_mask = np.array(result_mask, dtype='bool').reshape(\n            self._arraysize)\n        return result, result_mask\n\n    def output(self, value, mask):\n        base_output = self._base.output\n        value = np.asarray(value)\n        mask = np.asarray(mask)\n        if mask.size <= 1:\n            func = np.broadcast\n        else:  # When mask is already array but value is scalar, this prevents broadcast\n            func = zip\n        return ' '.join(base_output(x, m) for x, m in\n                        func(value.flat, mask.flat))\n\n    def binparse(self, read):\n        result = np.frombuffer(read(self._memsize),\n                               dtype=self._bigendian_format)[0]\n        result_mask = self._base.is_null(result)\n        return result, result_mask\n\n    def binoutput(self, value, mask):\n        filtered = self._base.filter_array(value, mask)\n        filtered = _ensure_bigendian(filtered)\n        return filtered.tobytes()\n\n\nclass Numeric(Converter):\n    \"\"\"\n    The base class for all numeric data types.\n    \"\"\"\n    array_type = NumericArray\n    vararray_type = ScalarVarArray\n    null = None\n\n    def __init__(self, field, config=None, pos=None):\n        Converter.__init__(self, field, config, pos)\n\n        self._memsize = np.dtype(self.format).itemsize\n        self._bigendian_format = '>' + self.format\n        if field.values.null is not None:\n            self.null = np.asarray(field.values.null, dtype=self.format)\n            self.default = self.null\n            self.is_null = self._is_null\n        else:\n            self.is_null = np.isnan\n\n    def binparse(self, read):\n        result = np.frombuffer(read(self._memsize),\n                               dtype=self._bigendian_format)\n        return result[0], self.is_null(result[0])\n\n    def _is_null(self, value):\n        return value == self.null\n\n\nclass FloatingPoint(Numeric):\n    \"\"\"\n    The base class for floating-point datatypes.\n    \"\"\"\n    default = np.nan\n\n    def __init__(self, field, config=None, pos=None):\n        if config is None:\n            config = {}\n\n        Numeric.__init__(self, field, config, pos)\n\n        precision = field.precision\n        width = field.width\n\n        if precision is None:\n            format_parts = ['{!r:>']\n        else:\n            format_parts = ['{:']\n\n        if width is not None:\n            format_parts.append(str(width))\n\n        if precision is not None:\n            if precision.startswith(\"E\"):\n                format_parts.append(f'.{int(precision[1:]):d}g')\n            elif precision.startswith(\"F\"):\n                format_parts.append(f'.{int(precision[1:]):d}f')\n            else:\n                format_parts.append(f'.{int(precision):d}f')\n\n        format_parts.append('}')\n\n        self._output_format = ''.join(format_parts)\n\n        self.nan = np.array(np.nan, self.format)\n\n        if self.null is None:\n            self._null_output = 'NaN'\n            self._null_binoutput = self.binoutput(self.nan, False)\n            self.filter_array = self._filter_nan\n        else:\n            self._null_output = self.output(np.asarray(self.null), False)\n            self._null_binoutput = self.binoutput(np.asarray(self.null), False)\n            self.filter_array = self._filter_null\n\n        if config.get('verify', 'ignore') == 'exception':\n            self.parse = self._parse_pedantic\n        else:\n            self.parse = self._parse_permissive\n\n    def supports_empty_values(self, config):\n        return True\n\n    def _parse_pedantic(self, value, config=None, pos=None):\n        if value.strip() == '':\n            return self.null, True\n        f = float(value)\n        return f, self.is_null(f)\n\n    def _parse_permissive(self, value, config=None, pos=None):\n        try:\n            f = float(value)\n            return f, self.is_null(f)\n        except ValueError:\n            # IRSA VOTables use the word 'null' to specify empty values,\n            # but this is not defined in the VOTable spec.\n            if value.strip() != '':\n                vo_warn(W30, value, config, pos)\n            return self.null, True\n\n    @property\n    def output_format(self):\n        return self._output_format\n\n    def output(self, value, mask):\n        if mask:\n            return self._null_output\n        if np.isfinite(value):\n            if not np.isscalar(value):\n                value = value.dtype.type(value)\n            result = self._output_format.format(value)\n            if result.startswith('array'):\n                raise RuntimeError()\n            if (self._output_format[2] == 'r' and\n                result.endswith('.0')):\n                result = result[:-2]\n            return result\n        elif np.isnan(value):\n            return 'NaN'\n        elif np.isposinf(value):\n            return '+InF'\n        elif np.isneginf(value):\n            return '-InF'\n        # Should never raise\n        vo_raise(f\"Invalid floating point value '{value}'\")\n\n    def binoutput(self, value, mask):\n        if mask:\n            return self._null_binoutput\n\n        value = _ensure_bigendian(value)\n        return value.tobytes()\n\n    def _filter_nan(self, value, mask):\n        return np.where(mask, np.nan, value)\n\n    def _filter_null(self, value, mask):\n        return np.where(mask, self.null, value)\n\n\nclass Double(FloatingPoint):\n    \"\"\"\n    Handles the double datatype.  Double-precision IEEE\n    floating-point.\n    \"\"\"\n    format = 'f8'\n\n\nclass Float(FloatingPoint):\n    \"\"\"\n    Handles the float datatype.  Single-precision IEEE floating-point.\n    \"\"\"\n    format = 'f4'\n\n\nclass Integer(Numeric):\n    \"\"\"\n    The base class for all the integral datatypes.\n    \"\"\"\n    default = 0\n\n    def __init__(self, field, config=None, pos=None):\n        Numeric.__init__(self, field, config, pos)\n\n    def parse(self, value, config=None, pos=None):\n        if config is None:\n            config = {}\n        mask = False\n        if isinstance(value, str):\n            value = value.lower()\n            if value == '':\n                if config['version_1_3_or_later']:\n                    mask = True\n                else:\n                    warn_or_raise(W49, W49, (), config, pos)\n                if self.null is not None:\n                    value = self.null\n                else:\n                    value = self.default\n            elif value == 'nan':\n                mask = True\n                if self.null is None:\n                    warn_or_raise(W31, W31, (), config, pos)\n                    value = self.default\n                else:\n                    value = self.null\n            elif value.startswith('0x'):\n                value = int(value[2:], 16)\n            else:\n                value = int(value, 10)\n        else:\n            value = int(value)\n        if self.null is not None and value == self.null:\n            mask = True\n\n        if value < self.val_range[0]:\n            warn_or_raise(W51, W51, (value, self.bit_size), config, pos)\n            value = self.val_range[0]\n        elif value > self.val_range[1]:\n            warn_or_raise(W51, W51, (value, self.bit_size), config, pos)\n            value = self.val_range[1]\n\n        return value, mask\n\n    def output(self, value, mask):\n        if mask:\n            if self.null is None:\n                warn_or_raise(W31, W31)\n                return 'NaN'\n            return str(self.null)\n        return str(value)\n\n    def binoutput(self, value, mask):\n        if mask:\n            if self.null is None:\n                vo_raise(W31)\n            else:\n                value = self.null\n\n        value = _ensure_bigendian(value)\n        return value.tobytes()\n\n    def filter_array(self, value, mask):\n        if np.any(mask):\n            if self.null is not None:\n                return np.where(mask, self.null, value)\n            else:\n                vo_raise(W31)\n        return value\n\n\nclass UnsignedByte(Integer):\n    \"\"\"\n    Handles the unsignedByte datatype.  Unsigned 8-bit integer.\n    \"\"\"\n    format = 'u1'\n    val_range = (0, 255)\n    bit_size = '8-bit unsigned'\n\n\nclass Short(Integer):\n    \"\"\"\n    Handles the short datatype.  Signed 16-bit integer.\n    \"\"\"\n    format = 'i2'\n    val_range = (-32768, 32767)\n    bit_size = '16-bit'\n\n\nclass Int(Integer):\n    \"\"\"\n    Handles the int datatype.  Signed 32-bit integer.\n    \"\"\"\n    format = 'i4'\n    val_range = (-2147483648, 2147483647)\n    bit_size = '32-bit'\n\n\nclass Long(Integer):\n    \"\"\"\n    Handles the long datatype.  Signed 64-bit integer.\n    \"\"\"\n    format = 'i8'\n    val_range = (-9223372036854775808, 9223372036854775807)\n    bit_size = '64-bit'\n\n\nclass ComplexArrayVarArray(VarArray):\n    \"\"\"\n    Handles an array of variable-length arrays of complex numbers.\n    \"\"\"\n\n    def parse(self, value, config=None, pos=None):\n        if value.strip() == '':\n            return ma.array([]), True\n\n        parts = self._splitter(value, config, pos)\n        items = self._base._items\n        parse_parts = self._base.parse_parts\n        if len(parts) % items != 0:\n            vo_raise(E02, (items, len(parts)), config, pos)\n        result = []\n        result_mask = []\n        for i in range(0, len(parts), items):\n            value, mask = parse_parts(parts[i:i + items], config, pos)\n            result.append(value)\n            result_mask.append(mask)\n\n        return _make_masked_array(result, result_mask), False\n\n\nclass ComplexVarArray(VarArray):\n    \"\"\"\n    Handles a variable-length array of complex numbers.\n    \"\"\"\n\n    def parse(self, value, config=None, pos=None):\n        if value.strip() == '':\n            return ma.array([]), True\n\n        parts = self._splitter(value, config, pos)\n        parse_parts = self._base.parse_parts\n        result = []\n        result_mask = []\n        for i in range(0, len(parts), 2):\n            value = [float(x) for x in parts[i:i + 2]]\n            value, mask = parse_parts(value, config, pos)\n            result.append(value)\n            result_mask.append(mask)\n\n        return _make_masked_array(\n            np.array(result, dtype=self._base.format), result_mask), False\n\n\nclass ComplexArray(NumericArray):\n    \"\"\"\n    Handles a fixed-size array of complex numbers.\n    \"\"\"\n    vararray_type = ComplexArrayVarArray\n\n    def __init__(self, field, base, arraysize, config=None, pos=None):\n        NumericArray.__init__(self, field, base, arraysize, config, pos)\n        self._items *= 2\n\n    def parse(self, value, config=None, pos=None):\n        parts = self._splitter(value, config, pos)\n        if parts == ['']:\n            parts = []\n        return self.parse_parts(parts, config, pos)\n\n    def parse_parts(self, parts, config=None, pos=None):\n        if len(parts) != self._items:\n            vo_raise(E02, (self._items, len(parts)), config, pos)\n        base_parse = self._base.parse_parts\n        result = []\n        result_mask = []\n        for i in range(0, self._items, 2):\n            value = [float(x) for x in parts[i:i + 2]]\n            value, mask = base_parse(value, config, pos)\n            result.append(value)\n            result_mask.append(mask)\n        result = np.array(\n            result, dtype=self._base.format).reshape(self._arraysize)\n        result_mask = np.array(\n            result_mask, dtype='bool').reshape(self._arraysize)\n        return result, result_mask\n\n\nclass Complex(FloatingPoint, Array):\n    \"\"\"\n    The base class for complex numbers.\n    \"\"\"\n    array_type = ComplexArray\n    vararray_type = ComplexVarArray\n    default = np.nan\n\n    def __init__(self, field, config=None, pos=None):\n        FloatingPoint.__init__(self, field, config, pos)\n        Array.__init__(self, field, config, pos)\n\n    def parse(self, value, config=None, pos=None):\n        stripped = value.strip()\n        if stripped == '' or stripped.lower() == 'nan':\n            return np.nan, True\n        splitter = self._splitter\n        parts = [float(x) for x in splitter(value, config, pos)]\n        if len(parts) != 2:\n            vo_raise(E03, (value,), config, pos)\n        return self.parse_parts(parts, config, pos)\n    _parse_permissive = parse\n    _parse_pedantic = parse\n\n    def parse_parts(self, parts, config=None, pos=None):\n        value = complex(*parts)\n        return value, self.is_null(value)\n\n    def output(self, value, mask):\n        if mask:\n            if self.null is None:\n                return 'NaN'\n            else:\n                value = self.null\n        real = self._output_format.format(float(value.real))\n        imag = self._output_format.format(float(value.imag))\n        if self._output_format[2] == 'r':\n            if real.endswith('.0'):\n                real = real[:-2]\n            if imag.endswith('.0'):\n                imag = imag[:-2]\n        return real + ' ' + imag\n\n\nclass FloatComplex(Complex):\n    \"\"\"\n    Handle floatComplex datatype.  Pair of single-precision IEEE\n    floating-point numbers.\n    \"\"\"\n    format = 'c8'\n\n\nclass DoubleComplex(Complex):\n    \"\"\"\n    Handle doubleComplex datatype.  Pair of double-precision IEEE\n    floating-point numbers.\n    \"\"\"\n    format = 'c16'\n\n\nclass BitArray(NumericArray):\n    \"\"\"\n    Handles an array of bits.\n    \"\"\"\n    vararray_type = ArrayVarArray\n\n    def __init__(self, field, base, arraysize, config=None, pos=None):\n        NumericArray.__init__(self, field, base, arraysize, config, pos)\n\n        self._bytes = ((self._items - 1) // 8) + 1\n\n    @staticmethod\n    def _splitter_pedantic(value, config=None, pos=None):\n        return list(re.sub(r'\\s', '', value))\n\n    @staticmethod\n    def _splitter_lax(value, config=None, pos=None):\n        if ',' in value:\n            vo_warn(W01, (), config, pos)\n        return list(re.sub(r'\\s|,', '', value))\n\n    def output(self, value, mask):\n        if np.any(mask):\n            vo_warn(W39)\n        value = np.asarray(value)\n        mapping = {False: '0', True: '1'}\n        return ''.join(mapping[x] for x in value.flat)\n\n    def binparse(self, read):\n        data = read(self._bytes)\n        result = bitarray_to_bool(data, self._items)\n        result = result.reshape(self._arraysize)\n        result_mask = np.zeros(self._arraysize, dtype='b1')\n        return result, result_mask\n\n    def binoutput(self, value, mask):\n        if np.any(mask):\n            vo_warn(W39)\n\n        return bool_to_bitarray(value)\n\n\nclass Bit(Converter):\n    \"\"\"\n    Handles the bit datatype.\n    \"\"\"\n    format = 'b1'\n    array_type = BitArray\n    vararray_type = ScalarVarArray\n    default = False\n    binary_one = b'\\x08'\n    binary_zero = b'\\0'\n\n    def parse(self, value, config=None, pos=None):\n        if config is None:\n            config = {}\n        mapping = {'1': True, '0': False}\n        if value is False or value.strip() == '':\n            if not config['version_1_3_or_later']:\n                warn_or_raise(W49, W49, (), config, pos)\n            return False, True\n        else:\n            try:\n                return mapping[value], False\n            except KeyError:\n                vo_raise(E04, (value,), config, pos)\n\n    def output(self, value, mask):\n        if mask:\n            vo_warn(W39)\n\n        if value:\n            return '1'\n        else:\n            return '0'\n\n    def binparse(self, read):\n        data = read(1)\n        return (ord(data) & 0x8) != 0, False\n\n    def binoutput(self, value, mask):\n        if mask:\n            vo_warn(W39)\n\n        if value:\n            return self.binary_one\n        return self.binary_zero\n\n\nclass BooleanArray(NumericArray):\n    \"\"\"\n    Handles an array of boolean values.\n    \"\"\"\n    vararray_type = ArrayVarArray\n\n    def binparse(self, read):\n        data = read(self._items)\n        binparse = self._base.binparse_value\n        result = []\n        result_mask = []\n        for char in data:\n            value, mask = binparse(char)\n            result.append(value)\n            result_mask.append(mask)\n        result = np.array(result, dtype='b1').reshape(\n            self._arraysize)\n        result_mask = np.array(result_mask, dtype='b1').reshape(\n            self._arraysize)\n        return result, result_mask\n\n    def binoutput(self, value, mask):\n        binoutput = self._base.binoutput\n        value = np.asarray(value)\n        mask = np.asarray(mask)\n        result = [binoutput(x, m)\n                  for x, m in np.broadcast(value.flat, mask.flat)]\n        return _empty_bytes.join(result)\n\n\nclass Boolean(Converter):\n    \"\"\"\n    Handles the boolean datatype.\n    \"\"\"\n    format = 'b1'\n    array_type = BooleanArray\n    vararray_type = ScalarVarArray\n    default = False\n    binary_question_mark = b'?'\n    binary_true = b'T'\n    binary_false = b'F'\n\n    def parse(self, value, config=None, pos=None):\n        if value == '':\n            return False, True\n        if value is False:\n            return False, True\n        mapping = {'TRUE': (True, False),\n                   'FALSE': (False, False),\n                   '1': (True, False),\n                   '0': (False, False),\n                   'T': (True, False),\n                   'F': (False, False),\n                   '\\0': (False, True),\n                   ' ': (False, True),\n                   '?': (False, True),\n                   '': (False, True)}\n        try:\n            return mapping[value.upper()]\n        except KeyError:\n            vo_raise(E05, (value,), config, pos)\n\n    def output(self, value, mask):\n        if mask:\n            return '?'\n        if value:\n            return 'T'\n        return 'F'\n\n    def binparse(self, read):\n        value = ord(read(1))\n        return self.binparse_value(value)\n\n    _binparse_mapping = {\n        ord('T'): (True, False),\n        ord('t'): (True, False),\n        ord('1'): (True, False),\n        ord('F'): (False, False),\n        ord('f'): (False, False),\n        ord('0'): (False, False),\n        ord('\\0'): (False, True),\n        ord(' '): (False, True),\n        ord('?'): (False, True)}\n\n    def binparse_value(self, value):\n        try:\n            return self._binparse_mapping[value]\n        except KeyError:\n            vo_raise(E05, (value,))\n\n    def binoutput(self, value, mask):\n        if mask:\n            return self.binary_question_mark\n        if value:\n            return self.binary_true\n        return self.binary_false\n\n\nconverter_mapping = {\n    'double': Double,\n    'float': Float,\n    'bit': Bit,\n    'boolean': Boolean,\n    'unsignedByte': UnsignedByte,\n    'short': Short,\n    'int': Int,\n    'long': Long,\n    'floatComplex': FloatComplex,\n    'doubleComplex': DoubleComplex,\n    'char': Char,\n    'unicodeChar': UnicodeChar}\n\n\ndef get_converter(field, config=None, pos=None):\n    \"\"\"\n    Get an appropriate converter instance for a given field.\n\n    Parameters\n    ----------\n    field : astropy.io.votable.tree.Field\n\n    config : dict, optional\n        Parser configuration dictionary\n\n    pos : tuple\n        Position in the input XML file.  Used for error messages.\n\n    Returns\n    -------\n    converter : astropy.io.votable.converters.Converter\n    \"\"\"\n    if config is None:\n        config = {}\n\n    if field.datatype not in converter_mapping:\n        vo_raise(E06, (field.datatype, field.ID), config)\n\n    cls = converter_mapping[field.datatype]\n    converter = cls(field, config, pos)\n\n    arraysize = field.arraysize\n\n    # With numeric datatypes, special things need to happen for\n    # arrays.\n    if (field.datatype not in ('char', 'unicodeChar') and\n        arraysize is not None):\n        if arraysize[-1] == '*':\n            arraysize = arraysize[:-1]\n            last_x = arraysize.rfind('x')\n            if last_x == -1:\n                arraysize = ''\n            else:\n                arraysize = arraysize[:last_x]\n            fixed = False\n        else:\n            fixed = True\n\n        if arraysize != '':\n            arraysize = [int(x) for x in arraysize.split(\"x\")]\n            arraysize.reverse()\n        else:\n            arraysize = []\n\n        if arraysize != []:\n            converter = converter.array_type(\n                field, converter, arraysize, config)\n\n        if not fixed:\n            converter = converter.vararray_type(\n                field, converter, arraysize, config)\n\n    return converter\n\n\nnumpy_dtype_to_field_mapping = {\n    np.float64().dtype.num: 'double',\n    np.float32().dtype.num: 'float',\n    np.bool_().dtype.num: 'bit',\n    np.uint8().dtype.num: 'unsignedByte',\n    np.int16().dtype.num: 'short',\n    np.int32().dtype.num: 'int',\n    np.int64().dtype.num: 'long',\n    np.complex64().dtype.num: 'floatComplex',\n    np.complex128().dtype.num: 'doubleComplex',\n    np.unicode_().dtype.num: 'unicodeChar'\n}\n\n\nnumpy_dtype_to_field_mapping[np.bytes_().dtype.num] = 'char'\n\n\ndef _all_matching_dtype(column):\n    first_dtype = False\n    first_shape = ()\n    for x in column:\n        if not isinstance(x, np.ndarray) or len(x) == 0:\n            continue\n\n        if first_dtype is False:\n            first_dtype = x.dtype\n            first_shape = x.shape[1:]\n        elif first_dtype != x.dtype:\n            return False, ()\n        elif first_shape != x.shape[1:]:\n            first_shape = ()\n    return first_dtype, first_shape\n\n\ndef numpy_to_votable_dtype(dtype, shape):\n    \"\"\"\n    Converts a numpy dtype and shape to a dictionary of attributes for\n    a VOTable FIELD element and correspond to that type.\n\n    Parameters\n    ----------\n    dtype : Numpy dtype instance\n\n    shape : tuple\n\n    Returns\n    -------\n    attributes : dict\n        A dict containing 'datatype' and 'arraysize' keys that can be\n        set on a VOTable FIELD element.\n    \"\"\"\n    if dtype.num not in numpy_dtype_to_field_mapping:\n        raise TypeError(\n            f\"{dtype!r} can not be represented in VOTable\")\n\n    if dtype.char == 'S':\n        return {'datatype': 'char',\n                'arraysize': str(dtype.itemsize)}\n    elif dtype.char == 'U':\n        return {'datatype': 'unicodeChar',\n                'arraysize': str(dtype.itemsize // 4)}\n    else:\n        result = {\n            'datatype': numpy_dtype_to_field_mapping[dtype.num]}\n        if len(shape):\n            result['arraysize'] = 'x'.join(str(x) for x in shape)\n\n        return result\n\n\ndef table_column_to_votable_datatype(column):\n    \"\"\"\n    Given a `astropy.table.Column` instance, returns the attributes\n    necessary to create a VOTable FIELD element that corresponds to\n    the type of the column.\n\n    This necessarily must perform some heuristics to determine the\n    type of variable length arrays fields, since they are not directly\n    supported by Numpy.\n\n    If the column has dtype of \"object\", it performs the following\n    tests:\n\n       - If all elements are byte or unicode strings, it creates a\n         variable-length byte or unicode field, respectively.\n\n       - If all elements are numpy arrays of the same dtype and with a\n         consistent shape in all but the first dimension, it creates a\n         variable length array of fixed sized arrays.  If the dtypes\n         match, but the shapes do not, a variable length array is\n         created.\n\n    If the dtype of the input is not understood, it sets the data type\n    to the most inclusive: a variable length unicodeChar array.\n\n    Parameters\n    ----------\n    column : `astropy.table.Column` instance\n\n    Returns\n    -------\n    attributes : dict\n        A dict containing 'datatype' and 'arraysize' keys that can be\n        set on a VOTable FIELD element.\n    \"\"\"\n    votable_string_dtype = None\n    if column.info.meta is not None:\n        votable_string_dtype = column.info.meta.get('_votable_string_dtype')\n    if column.dtype.char == 'O':\n        if votable_string_dtype is not None:\n            return {'datatype': votable_string_dtype, 'arraysize': '*'}\n        elif isinstance(column[0], np.ndarray):\n            dtype, shape = _all_matching_dtype(column)\n            if dtype is not False:\n                result = numpy_to_votable_dtype(dtype, shape)\n                if 'arraysize' not in result:\n                    result['arraysize'] = '*'\n                else:\n                    result['arraysize'] += '*'\n                return result\n\n        # All bets are off, do the most generic thing\n        return {'datatype': 'unicodeChar', 'arraysize': '*'}\n\n    # For fixed size string columns, datatype here will be unicodeChar,\n    # but honor the original FIELD datatype if present.\n    result = numpy_to_votable_dtype(column.dtype, column.shape[1:])\n    if result['datatype'] == 'unicodeChar' and votable_string_dtype == 'char':\n        result['datatype'] = 'char'\n\n    return result\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":839,"id":5872,"name":"default_args","nodeType":"Attribute","startLoc":839,"text":"default_args"},{"className":"W36","col":0,"comment":"\n    If the field specifies a ``null`` value, that value must conform\n    to the given ``datatype``.\n\n    **References:** `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:values>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:values>`__\n    ","endLoc":854,"id":5873,"nodeType":"Class","startLoc":842,"text":"class W36(VOTableSpecWarning):\n    \"\"\"\n    If the field specifies a ``null`` value, that value must conform\n    to the given ``datatype``.\n\n    **References:** `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:values>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:values>`__\n    \"\"\"\n\n    message_template = \"null value '{}' does not match field datatype, setting to 0\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":853,"id":5874,"name":"message_template","nodeType":"Attribute","startLoc":853,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":854,"id":5875,"name":"default_args","nodeType":"Attribute","startLoc":854,"text":"default_args"},{"className":"W37","col":0,"comment":"\n    The 3 datatypes defined in the VOTable specification and supported by\n    ``astropy.io.votable`` are ``TABLEDATA``, ``BINARY`` and ``FITS``.\n\n    **References:** `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:data>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:data>`__\n    ","endLoc":869,"id":5877,"nodeType":"Class","startLoc":857,"text":"class W37(UnimplementedWarning):\n    \"\"\"\n    The 3 datatypes defined in the VOTable specification and supported by\n    ``astropy.io.votable`` are ``TABLEDATA``, ``BINARY`` and ``FITS``.\n\n    **References:** `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:data>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:data>`__\n    \"\"\"\n\n    message_template = \"Unsupported data format '{}'\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":868,"id":5878,"name":"message_template","nodeType":"Attribute","startLoc":868,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":869,"id":5879,"name":"default_args","nodeType":"Attribute","startLoc":869,"text":"default_args"},{"className":"W38","col":0,"comment":"\n    The only encoding for local binary data supported by the VOTable\n    specification is base64.\n    ","endLoc":879,"id":5880,"nodeType":"Class","startLoc":872,"text":"class W38(VOTableSpecWarning):\n    \"\"\"\n    The only encoding for local binary data supported by the VOTable\n    specification is base64.\n    \"\"\"\n\n    message_template = \"Inline binary data must be base64 encoded, got '{}'\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":878,"id":5881,"name":"message_template","nodeType":"Attribute","startLoc":878,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":879,"id":5882,"name":"default_args","nodeType":"Attribute","startLoc":879,"text":"default_args"},{"className":"W39","col":0,"comment":"\n    Bit values do not support masking.  This warning is raised upon\n    setting masked data in a bit column.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    ","endLoc":893,"id":5883,"nodeType":"Class","startLoc":882,"text":"class W39(VOTableSpecWarning):\n    \"\"\"\n    Bit values do not support masking.  This warning is raised upon\n    setting masked data in a bit column.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    \"\"\"\n\n    message_template = \"Bit values can not be masked\""},{"attributeType":"null","col":4,"comment":"null","endLoc":893,"id":5884,"name":"message_template","nodeType":"Attribute","startLoc":893,"text":"message_template"},{"className":"W40","col":0,"comment":"\n    This is a terrible hack to support Simple Image Access Protocol\n    results from `NOIRLab Astro Data Archive <https://astroarchive.noirlab.edu/>`__.  It\n    creates a field for the coordinate projection type of type \"double\",\n    which actually contains character data.  We have to hack the field\n    to store character data, or we can't read it in.  A warning will be\n    raised when this happens.\n    ","endLoc":906,"id":5885,"nodeType":"Class","startLoc":896,"text":"class W40(VOTableSpecWarning):\n    \"\"\"\n    This is a terrible hack to support Simple Image Access Protocol\n    results from `NOIRLab Astro Data Archive <https://astroarchive.noirlab.edu/>`__.  It\n    creates a field for the coordinate projection type of type \"double\",\n    which actually contains character data.  We have to hack the field\n    to store character data, or we can't read it in.  A warning will be\n    raised when this happens.\n    \"\"\"\n\n    message_template = \"'cprojection' datatype repaired\""},{"attributeType":"null","col":4,"comment":"null","endLoc":906,"id":5886,"name":"message_template","nodeType":"Attribute","startLoc":906,"text":"message_template"},{"className":"W41","col":0,"comment":"\n    An XML namespace was specified on the ``VOTABLE`` element, but the\n    namespace does not match what is expected for a ``VOTABLE`` file.\n\n    The ``VOTABLE`` namespace is::\n\n      http://www.ivoa.net/xml/VOTable/vX.X\n\n    where \"X.X\" is the version number.\n\n    Some files in the wild set the namespace to the location of the\n    VOTable schema, which is not correct and will not pass some\n    validating parsers.\n    ","endLoc":928,"id":5887,"nodeType":"Class","startLoc":909,"text":"class W41(VOTableSpecWarning):\n    \"\"\"\n    An XML namespace was specified on the ``VOTABLE`` element, but the\n    namespace does not match what is expected for a ``VOTABLE`` file.\n\n    The ``VOTABLE`` namespace is::\n\n      http://www.ivoa.net/xml/VOTable/vX.X\n\n    where \"X.X\" is the version number.\n\n    Some files in the wild set the namespace to the location of the\n    VOTable schema, which is not correct and will not pass some\n    validating parsers.\n    \"\"\"\n\n    message_template = (\n        \"An XML namespace is specified, but is incorrect.  Expected \" +\n        \"'{}', got '{}'\")\n    default_args = ('x', 'y')"},{"attributeType":"null","col":4,"comment":"null","endLoc":925,"id":5888,"name":"message_template","nodeType":"Attribute","startLoc":925,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":928,"id":5889,"name":"default_args","nodeType":"Attribute","startLoc":928,"text":"default_args"},{"className":"W42","col":0,"comment":"\n    The root element should specify a namespace.\n\n    The ``VOTABLE`` namespace is::\n\n        http://www.ivoa.net/xml/VOTable/vX.X\n\n    where \"X.X\" is the version number.\n    ","endLoc":942,"id":5890,"nodeType":"Class","startLoc":931,"text":"class W42(VOTableSpecWarning):\n    \"\"\"\n    The root element should specify a namespace.\n\n    The ``VOTABLE`` namespace is::\n\n        http://www.ivoa.net/xml/VOTable/vX.X\n\n    where \"X.X\" is the version number.\n    \"\"\"\n\n    message_template = \"No XML namespace specified\""},{"attributeType":"null","col":4,"comment":"null","endLoc":942,"id":5891,"name":"message_template","nodeType":"Attribute","startLoc":942,"text":"message_template"},{"className":"W43","col":0,"comment":"\n    Referenced elements should be defined before referees.  From the\n    VOTable 1.2 spec:\n\n       In VOTable1.2, it is further recommended to place the ID\n       attribute prior to referencing it whenever possible.\n    ","endLoc":955,"id":5892,"nodeType":"Class","startLoc":945,"text":"class W43(VOTableSpecWarning):\n    \"\"\"\n    Referenced elements should be defined before referees.  From the\n    VOTable 1.2 spec:\n\n       In VOTable1.2, it is further recommended to place the ID\n       attribute prior to referencing it whenever possible.\n    \"\"\"\n\n    message_template = \"{} ref='{}' which has not already been defined\"\n    default_args = ('element', 'x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":63,"id":5893,"name":"_subfmt","nodeType":"Attribute","startLoc":63,"text":"_subfmt"},{"className":"W44","col":0,"comment":"\n    ``VALUES`` elements that reference another element should not have\n    their own content.\n\n    From the VOTable 1.2 spec:\n\n        The ``ref`` attribute of a ``VALUES`` element can be used to\n        avoid a repetition of the domain definition, by referring to a\n        previously defined ``VALUES`` element having the referenced\n        ``ID`` attribute. When specified, the ``ref`` attribute\n        defines completely the domain without any other element or\n        attribute, as e.g. ``<VALUES ref=\"RAdomain\"/>``\n    ","endLoc":974,"id":5894,"nodeType":"Class","startLoc":958,"text":"class W44(VOTableSpecWarning):\n    \"\"\"\n    ``VALUES`` elements that reference another element should not have\n    their own content.\n\n    From the VOTable 1.2 spec:\n\n        The ``ref`` attribute of a ``VALUES`` element can be used to\n        avoid a repetition of the domain definition, by referring to a\n        previously defined ``VALUES`` element having the referenced\n        ``ID`` attribute. When specified, the ``ref`` attribute\n        defines completely the domain without any other element or\n        attribute, as e.g. ``<VALUES ref=\"RAdomain\"/>``\n    \"\"\"\n\n    message_template = \"VALUES element with ref attribute has content ('{}')\"\n    default_args = ('element',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":954,"id":5895,"name":"message_template","nodeType":"Attribute","startLoc":954,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":973,"id":5896,"name":"message_template","nodeType":"Attribute","startLoc":973,"text":"message_template"},{"attributeType":"null","col":8,"comment":"null","endLoc":406,"id":5897,"name":"linewidth","nodeType":"Attribute","startLoc":406,"text":"self.linewidth"},{"attributeType":"null","col":4,"comment":"null","endLoc":974,"id":5898,"name":"default_args","nodeType":"Attribute","startLoc":974,"text":"default_args"},{"className":"W45","col":0,"comment":"\n    The ``content-role`` attribute on the ``LINK`` element must be one of\n    the following::\n\n        query, hints, doc, location\n\n    And in VOTable 1.3, additionally::\n\n        type\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__\n    `1.3\n    <http://www.ivoa.net/documents/VOTable/20130315/PR-VOTable-1.3-20130315.html#sec:link>`__\n    ","endLoc":997,"id":5899,"nodeType":"Class","startLoc":977,"text":"class W45(VOWarning, ValueError):\n    \"\"\"\n    The ``content-role`` attribute on the ``LINK`` element must be one of\n    the following::\n\n        query, hints, doc, location\n\n    And in VOTable 1.3, additionally::\n\n        type\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__\n    `1.3\n    <http://www.ivoa.net/documents/VOTable/20130315/PR-VOTable-1.3-20130315.html#sec:link>`__\n    \"\"\"\n\n    message_template = \"content-role attribute '{}' invalid\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":996,"id":5900,"name":"message_template","nodeType":"Attribute","startLoc":996,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":955,"id":5901,"name":"default_args","nodeType":"Attribute","startLoc":955,"text":"default_args"},{"attributeType":"null","col":4,"comment":"null","endLoc":997,"id":5902,"name":"default_args","nodeType":"Attribute","startLoc":997,"text":"default_args"},{"className":"W46","col":0,"comment":"\n    The given char or unicode string is too long for the specified\n    field length.\n    ","endLoc":1007,"id":5903,"nodeType":"Class","startLoc":1000,"text":"class W46(VOTableSpecWarning):\n    \"\"\"\n    The given char or unicode string is too long for the specified\n    field length.\n    \"\"\"\n\n    message_template = \"{} value is too long for specified length of {}\"\n    default_args = ('char or unicode', 'x')"},{"attributeType":"null","col":4,"comment":"null","endLoc":1006,"id":5904,"name":"message_template","nodeType":"Attribute","startLoc":1006,"text":"message_template"},{"className":"W50","col":0,"comment":"\n    Invalid unit string as defined in the `Units in the VO, Version 1.0\n    <https://www.ivoa.net/documents/VOUnits>`_ (VOTable version >= 1.4)\n    or `Standards for Astronomical Catalogues, Version 2.0\n    <http://cdsarc.u-strasbg.fr/doc/catstd-3.2.htx>`_ (version < 1.4).\n\n    Consider passing an explicit ``unit_format`` parameter if the units\n    in this file conform to another specification.\n    ","endLoc":1052,"id":5905,"nodeType":"Class","startLoc":1040,"text":"class W50(VOTableSpecWarning):\n    \"\"\"\n    Invalid unit string as defined in the `Units in the VO, Version 1.0\n    <https://www.ivoa.net/documents/VOUnits>`_ (VOTable version >= 1.4)\n    or `Standards for Astronomical Catalogues, Version 2.0\n    <http://cdsarc.u-strasbg.fr/doc/catstd-3.2.htx>`_ (version < 1.4).\n\n    Consider passing an explicit ``unit_format`` parameter if the units\n    in this file conform to another specification.\n    \"\"\"\n\n    message_template = \"Invalid unit string '{}'\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1051,"id":5906,"name":"message_template","nodeType":"Attribute","startLoc":1051,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1052,"id":5907,"name":"default_args","nodeType":"Attribute","startLoc":1052,"text":"default_args"},{"className":"W52","col":0,"comment":"\n    The BINARY2 format was introduced in VOTable 1.3.  It should\n    not be present in files marked as an earlier version.\n    ","endLoc":1072,"id":5908,"nodeType":"Class","startLoc":1064,"text":"class W52(VOTableSpecWarning):\n    \"\"\"\n    The BINARY2 format was introduced in VOTable 1.3.  It should\n    not be present in files marked as an earlier version.\n    \"\"\"\n\n    message_template = (\"The BINARY2 format was introduced in VOTable 1.3, but \"\n                        \"this file is declared as version '{}'\")\n    default_args = ('1.2',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1007,"id":5909,"name":"default_args","nodeType":"Attribute","startLoc":1007,"text":"default_args"},{"className":"W47","col":0,"comment":"\n    If no arraysize is specified on a char field, the default of '1'\n    is implied, but this is rarely what is intended.\n    ","endLoc":1016,"id":5910,"nodeType":"Class","startLoc":1010,"text":"class W47(VOTableSpecWarning):\n    \"\"\"\n    If no arraysize is specified on a char field, the default of '1'\n    is implied, but this is rarely what is intended.\n    \"\"\"\n\n    message_template = \"Missing arraysize indicates length 1\""},{"attributeType":"null","col":4,"comment":"null","endLoc":1070,"id":5911,"name":"message_template","nodeType":"Attribute","startLoc":1070,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1016,"id":5912,"name":"message_template","nodeType":"Attribute","startLoc":1016,"text":"message_template"},{"attributeType":"null","col":0,"comment":"null","endLoc":46,"id":5913,"name":"mixin_cols","nodeType":"Attribute","startLoc":46,"text":"mixin_cols"},{"attributeType":"null","col":0,"comment":"null","endLoc":72,"id":5914,"name":"time_attrs","nodeType":"Attribute","startLoc":72,"text":"time_attrs"},{"className":"W48","col":0,"comment":"\n    The attribute is not defined in the specification.\n    ","endLoc":1025,"id":5915,"nodeType":"Class","startLoc":1019,"text":"class W48(VOTableSpecWarning):\n    \"\"\"\n    The attribute is not defined in the specification.\n    \"\"\"\n\n    message_template = \"Unknown attribute '{}' on {}\"\n    default_args = ('attribute', 'element')"},{"attributeType":"null","col":0,"comment":"null","endLoc":74,"id":5916,"name":"compare_attrs","nodeType":"Attribute","startLoc":74,"text":"compare_attrs"},{"attributeType":"null","col":4,"comment":"null","endLoc":1024,"id":5917,"name":"message_template","nodeType":"Attribute","startLoc":1024,"text":"message_template"},{"attributeType":"null","col":0,"comment":"null","endLoc":107,"id":5918,"name":"non_trivial_names","nodeType":"Attribute","startLoc":107,"text":"non_trivial_names"},{"attributeType":"null","col":0,"comment":"null","endLoc":136,"id":5919,"name":"serialized_names","nodeType":"Attribute","startLoc":136,"text":"serialized_names"},{"attributeType":"null","col":24,"comment":"null","endLoc":137,"id":5920,"name":"name","nodeType":"Attribute","startLoc":137,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1025,"id":5921,"name":"default_args","nodeType":"Attribute","startLoc":1025,"text":"default_args"},{"col":0,"comment":"","endLoc":5,"header":"mixin_columns.py#<anonymous>","id":5922,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nMixin columns for use in ascii/tests/test_ecsv.py, fits/tests/test_connect.py,\nand misc/tests/test_hdf5.py\n\"\"\"\n\nel = coordinates.EarthLocation(x=[1, 2] * u.km, y=[3, 4] * u.km, z=[5, 6] * u.km)\n\nsr = coordinates.SphericalRepresentation(\n    [0, 1]*u.deg, [2, 3]*u.deg, 1*u.kpc)\n\ncr = coordinates.CartesianRepresentation(\n    [0, 1]*u.pc, [4, 5]*u.pc, [8, 6]*u.pc)\n\nsd = coordinates.SphericalCosLatDifferential(\n    [0, 1]*u.mas/u.yr, [0, 1]*u.mas/u.yr, 10*u.km/u.s)\n\nsrd = coordinates.SphericalRepresentation(\n    sr, differentials=sd)\n\nsc = coordinates.SkyCoord([1, 2], [3, 4], unit='deg,deg',\n                          frame='fk4', obstime='J1990.5')\n\nscd = coordinates.SkyCoord(\n    [1, 2], [3, 4], [5, 6], unit='deg,deg,m', frame='fk4',\n    obstime=['J1990.5'] * 2)\n\nscdc = scd.copy()\n\nscdc.representation_type = 'cartesian'\n\nscpm = coordinates.SkyCoord(\n    [1, 2], [3, 4], [5, 6], unit='deg,deg,pc',\n    pm_ra_cosdec=[7, 8]*u.mas/u.yr, pm_dec=[9, 10]*u.mas/u.yr)\n\nscpmrv = coordinates.SkyCoord(\n    [1, 2], [3, 4], [5, 6], unit='deg,deg,pc',\n    pm_ra_cosdec=[7, 8]*u.mas/u.yr, pm_dec=[9, 10]*u.mas/u.yr,\n    radial_velocity=[11, 12]*u.km/u.s)\n\nscrv = coordinates.SkyCoord(\n    [1, 2], [3, 4], [5, 6], unit='deg,deg,pc',\n    radial_velocity=[11, 12]*u.km/u.s)\n\ntm = time.Time([51000.5, 51001.5], format='mjd', scale='tai',\n               precision=5, location=el[0])\n\ntm2 = time.Time(tm, precision=3, format='iso')\n\ntm3 = time.Time(tm, location=el)\n\ntm3.info.serialize_method['ecsv'] = 'jd1_jd2'\n\nobj = table.Column([{'a': 1}, {'b': [2]}], dtype='object')\n\nmixin_cols = {\n    'tm': tm,\n    'tm2': tm2,\n    'tm3': tm3,\n    'dt': time.TimeDelta([1, 2] * u.day),\n    'sc': sc,\n    'scd': scd,\n    'scdc': scdc,\n    'scpm': scpm,\n    'scpmrv': scpmrv,\n    'scrv': scrv,\n    'x': [1, 2] * u.m,\n    'qdb': [10, 20] * u.dB(u.mW),\n    'qdex': [4.5, 5.5] * u.dex(u.cm / u.s**2),\n    'qmag': [21, 22] * u.ABmag,\n    'lat': coordinates.Latitude([1, 2] * u.deg),\n    'lon': coordinates.Longitude([1, 2] * u.deg, wrap_angle=180. * u.deg),\n    'ang': coordinates.Angle([1, 2] * u.deg),\n    'el': el,\n    'sr': sr,\n    'cr': cr,\n    'sd': sd,\n    'srd': srd,\n    'nd': table.NdarrayMixin([1, 2]),\n    'obj': obj,\n}\n\ntime_attrs = ['value', 'shape', 'format', 'scale', 'precision',\n              'in_subfmt', 'out_subfmt', 'location']\n\ncompare_attrs = {\n    'tm': time_attrs,\n    'tm2': time_attrs,\n    'tm3': time_attrs,\n    'dt': ['shape', 'value', 'format', 'scale'],\n    'sc': ['ra', 'dec', 'representation_type', 'frame.name'],\n    'scd': ['ra', 'dec', 'distance', 'representation_type', 'frame.name'],\n    'scdc': ['x', 'y', 'z', 'representation_type', 'frame.name'],\n    'scpm': ['ra', 'dec', 'distance', 'pm_ra_cosdec', 'pm_dec',\n             'representation_type', 'frame.name'],\n    'scpmrv': ['ra', 'dec', 'distance', 'pm_ra_cosdec', 'pm_dec',\n               'radial_velocity', 'representation_type', 'frame.name'],\n    'scrv': ['ra', 'dec', 'distance', 'radial_velocity',\n             'representation_type', 'frame.name'],\n    'x': ['value', 'unit'],\n    'qdb': ['value', 'unit'],\n    'qdex': ['value', 'unit'],\n    'qmag': ['value', 'unit'],\n    'lon': ['value', 'unit', 'wrap_angle'],\n    'lat': ['value', 'unit'],\n    'ang': ['value', 'unit'],\n    'el': ['x', 'y', 'z', 'ellipsoid'],\n    'nd': ['data'],\n    'sr': ['lon', 'lat', 'distance'],\n    'cr': ['x', 'y', 'z'],\n    'sd': ['d_lon_coslat', 'd_lat', 'd_distance'],\n    'srd': ['lon', 'lat', 'distance', 'differentials.s.d_lon_coslat',\n            'differentials.s.d_lat', 'differentials.s.d_distance'],\n    'obj': [],\n    'su': ['i', 'f'],\n    'tab': ['tm', 'c', 'x'],\n    'qtab': ['tm', 'c', 'x'],\n}\n\nnon_trivial_names = {\n    'cr': ['cr.x', 'cr.y', 'cr.z'],\n    'dt': ['dt.jd1', 'dt.jd2'],\n    'el': ['el.x', 'el.y', 'el.z'],\n    'sc': ['sc.ra', 'sc.dec'],\n    'scd': ['scd.ra', 'scd.dec', 'scd.distance',\n            'scd.obstime.jd1', 'scd.obstime.jd2'],\n    'scdc': ['scdc.x', 'scdc.y', 'scdc.z',\n             'scdc.obstime.jd1', 'scdc.obstime.jd2'],\n    'scfc': ['scdc.x', 'scdc.y', 'scdc.z',\n             'scdc.obstime.jd1', 'scdc.obstime.jd2'],\n    'scpm': ['scpm.ra', 'scpm.dec', 'scpm.distance',\n             'scpm.pm_ra_cosdec', 'scpm.pm_dec'],\n    'scpmrv': ['scpmrv.ra', 'scpmrv.dec', 'scpmrv.distance',\n               'scpmrv.pm_ra_cosdec', 'scpmrv.pm_dec',\n               'scpmrv.radial_velocity'],\n    'scrv': ['scrv.ra', 'scrv.dec', 'scrv.distance',\n             'scrv.radial_velocity'],\n    'sd': ['sd.d_lon_coslat', 'sd.d_lat', 'sd.d_distance'],\n    'sr': ['sr.lon', 'sr.lat', 'sr.distance'],\n    'srd': ['srd.lon', 'srd.lat', 'srd.distance',\n            'srd.differentials.s.d_lon_coslat',\n            'srd.differentials.s.d_lat',\n            'srd.differentials.s.d_distance'],\n    'tm': ['tm.jd1', 'tm.jd2'],\n    'tm2': ['tm2.jd1', 'tm2.jd2'],\n    'tm3': ['tm3.jd1', 'tm3.jd2',\n            'tm3.location.x', 'tm3.location.y', 'tm3.location.z'],\n}\n\nserialized_names = {name: non_trivial_names.get(name, [name])\n                    for name in sorted(mixin_cols)}"},{"className":"W49","col":0,"comment":"\n    Prior to VOTable 1.3, the empty cell was illegal for integer\n    fields.\n\n    If a \"null\" value was specified for the cell, it will be used\n    for the value, otherwise, 0 will be used.\n    ","endLoc":1037,"id":5923,"nodeType":"Class","startLoc":1028,"text":"class W49(VOTableSpecWarning):\n    \"\"\"\n    Prior to VOTable 1.3, the empty cell was illegal for integer\n    fields.\n\n    If a \\\"null\\\" value was specified for the cell, it will be used\n    for the value, otherwise, 0 will be used.\n    \"\"\"\n\n    message_template = \"Empty cell illegal for integer fields.\""},{"attributeType":"null","col":4,"comment":"null","endLoc":1072,"id":5924,"name":"default_args","nodeType":"Attribute","startLoc":1072,"text":"default_args"},{"attributeType":"null","col":4,"comment":"null","endLoc":1037,"id":5925,"name":"message_template","nodeType":"Attribute","startLoc":1037,"text":"message_template"},{"col":4,"comment":"null","endLoc":1942,"header":"def __init__(self, lon, lat=None, distance=None, differentials=None,\n                 copy=True)","id":5926,"name":"__init__","nodeType":"Function","startLoc":1927,"text":"def __init__(self, lon, lat=None, distance=None, differentials=None,\n                 copy=True):\n        super().__init__(lon, lat, distance, copy=copy,\n                         differentials=differentials)\n        if (not isinstance(self._distance, Distance)\n                and self._distance.unit.physical_type == 'length'):\n            try:\n                self._distance = Distance(self._distance, copy=False)\n            except ValueError as e:\n                if e.args[0].startswith('distance must be >= 0'):\n                    raise ValueError(\"Distance must be >= 0. To allow negative \"\n                                     \"distance values, you must explicitly pass\"\n                                     \" in a `Distance` object with the the \"\n                                     \"argument 'allow_negative=True'.\") from e\n                else:\n                    raise"},{"className":"W51","col":0,"comment":"\n    The integer value is out of range for the size of the field.\n    ","endLoc":1061,"id":5927,"nodeType":"Class","startLoc":1055,"text":"class W51(VOTableSpecWarning):\n    \"\"\"\n    The integer value is out of range for the size of the field.\n    \"\"\"\n\n    message_template = \"Value '{}' is out of range for a {} integer field\"\n    default_args = ('x', 'n-bit')"},{"attributeType":"null","col":4,"comment":"null","endLoc":1060,"id":5928,"name":"message_template","nodeType":"Attribute","startLoc":1060,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1061,"id":5929,"name":"default_args","nodeType":"Attribute","startLoc":1061,"text":"default_args"},{"className":"MrtData","col":0,"comment":"MRT table data reader\n    ","endLoc":570,"id":5930,"nodeType":"Class","startLoc":562,"text":"class MrtData(cds.CdsData):\n    \"\"\"MRT table data reader\n    \"\"\"\n    _subfmt = 'MRT'\n    splitter_class = MrtSplitter\n\n    def write(self, lines):\n        self.splitter.delimiter = ' '\n        fixedwidth.FixedWidthData.write(self, lines)"},{"className":"W53","col":0,"comment":"\n    The VOTABLE element must contain at least one RESOURCE element.\n    ","endLoc":1081,"id":5932,"nodeType":"Class","startLoc":1075,"text":"class W53(VOTableSpecWarning):\n    \"\"\"\n    The VOTABLE element must contain at least one RESOURCE element.\n    \"\"\"\n\n    message_template = (\"VOTABLE element must contain at least one RESOURCE element.\")\n    default_args = ()"},{"attributeType":"null","col":4,"comment":"null","endLoc":1080,"id":5933,"name":"message_template","nodeType":"Attribute","startLoc":1080,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1081,"id":5934,"name":"default_args","nodeType":"Attribute","startLoc":1081,"text":"default_args"},{"className":"W54","col":0,"comment":"\n    The TIMESYS element was introduced in VOTable 1.4.  It should\n    not be present in files marked as an earlier version.\n    ","endLoc":1093,"id":5935,"nodeType":"Class","startLoc":1084,"text":"class W54(VOTableSpecWarning):\n    \"\"\"\n    The TIMESYS element was introduced in VOTable 1.4.  It should\n    not be present in files marked as an earlier version.\n    \"\"\"\n\n    message_template = (\n        \"The TIMESYS element was introduced in VOTable 1.4, but \"\n        \"this file is declared as version '{}'\")\n    default_args = ('1.3',)"},{"col":4,"comment":"null","endLoc":570,"header":"def write(self, lines)","id":5936,"name":"write","nodeType":"Function","startLoc":568,"text":"def write(self, lines):\n        self.splitter.delimiter = ' '\n        fixedwidth.FixedWidthData.write(self, lines)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1090,"id":5937,"name":"message_template","nodeType":"Attribute","startLoc":1090,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1093,"id":5938,"name":"default_args","nodeType":"Attribute","startLoc":1093,"text":"default_args"},{"className":"W55","col":0,"comment":"\n    When non-ASCII characters are detected when reading\n    a TABLEDATA value for a FIELD with ``datatype=\"char\"``, we\n    can issue this warning.\n    ","endLoc":1106,"id":5939,"nodeType":"Class","startLoc":1096,"text":"class W55(VOTableSpecWarning):\n    \"\"\"\n    When non-ASCII characters are detected when reading\n    a TABLEDATA value for a FIELD with ``datatype=\"char\"``, we\n    can issue this warning.\n    \"\"\"\n\n    message_template = (\n        'FIELD ({}) has datatype=\"char\" but contains non-ASCII '\n        'value ({})')\n    default_args = ('', '')"},{"attributeType":"null","col":4,"comment":"null","endLoc":1103,"id":5940,"name":"message_template","nodeType":"Attribute","startLoc":1103,"text":"message_template"},{"className":"E06","col":0,"comment":"\n    The supported datatypes are::\n\n        double, float, bit, boolean, unsignedByte, short, int, long,\n        floatComplex, doubleComplex, char, unicodeChar\n\n    The following non-standard aliases are also supported, but in\n    these case :ref:`W13 <W13>` will be raised::\n\n        string        -> char\n        unicodeString -> unicodeChar\n        int16         -> short\n        int32         -> int\n        int64         -> long\n        float32       -> float\n        float64       -> double\n        unsignedInt   -> long\n        unsignedShort -> int\n\n    To add more datatype mappings during parsing, use the\n    ``datatype_mapping`` keyword to `astropy.io.votable.parse`.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    ","endLoc":1223,"id":5941,"nodeType":"Class","startLoc":1193,"text":"class E06(VOWarning, ValueError):\n    \"\"\"\n    The supported datatypes are::\n\n        double, float, bit, boolean, unsignedByte, short, int, long,\n        floatComplex, doubleComplex, char, unicodeChar\n\n    The following non-standard aliases are also supported, but in\n    these case :ref:`W13 <W13>` will be raised::\n\n        string        -> char\n        unicodeString -> unicodeChar\n        int16         -> short\n        int32         -> int\n        int64         -> long\n        float32       -> float\n        float64       -> double\n        unsignedInt   -> long\n        unsignedShort -> int\n\n    To add more datatype mappings during parsing, use the\n    ``datatype_mapping`` keyword to `astropy.io.votable.parse`.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    \"\"\"\n\n    message_template = \"Unknown datatype '{}' on field '{}'\"\n    default_args = ('x', 'y')"},{"attributeType":"null","col":4,"comment":"null","endLoc":1106,"id":5942,"name":"default_args","nodeType":"Attribute","startLoc":1106,"text":"default_args"},{"className":"E01","col":0,"comment":"\n    The size specifier for a ``char`` or ``unicode`` field must be\n    only a number followed, optionally, by an asterisk.\n    Multi-dimensional size specifiers are not supported for these\n    datatypes.\n\n    Strings, which are defined as a set of characters, can be\n    represented in VOTable as a fixed- or variable-length array of\n    characters::\n\n        <FIELD name=\"unboundedString\" datatype=\"char\" arraysize=\"*\"/>\n\n    A 1D array of strings can be represented as a 2D array of\n    characters, but given the logic above, it is possible to define a\n    variable-length array of fixed-length strings, but not a\n    fixed-length array of variable-length strings.\n    ","endLoc":1129,"id":5943,"nodeType":"Class","startLoc":1109,"text":"class E01(VOWarning, ValueError):\n    \"\"\"\n    The size specifier for a ``char`` or ``unicode`` field must be\n    only a number followed, optionally, by an asterisk.\n    Multi-dimensional size specifiers are not supported for these\n    datatypes.\n\n    Strings, which are defined as a set of characters, can be\n    represented in VOTable as a fixed- or variable-length array of\n    characters::\n\n        <FIELD name=\"unboundedString\" datatype=\"char\" arraysize=\"*\"/>\n\n    A 1D array of strings can be represented as a 2D array of\n    characters, but given the logic above, it is possible to define a\n    variable-length array of fixed-length strings, but not a\n    fixed-length array of variable-length strings.\n    \"\"\"\n\n    message_template = \"Invalid size specifier '{}' for a {} field (in field '{}')\"\n    default_args = ('x', 'char/unicode', 'y')"},{"attributeType":"null","col":4,"comment":"null","endLoc":1128,"id":5944,"name":"message_template","nodeType":"Attribute","startLoc":1128,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1222,"id":5945,"name":"message_template","nodeType":"Attribute","startLoc":1222,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":565,"id":5946,"name":"_subfmt","nodeType":"Attribute","startLoc":565,"text":"_subfmt"},{"attributeType":"null","col":4,"comment":"null","endLoc":1129,"id":5947,"name":"default_args","nodeType":"Attribute","startLoc":1129,"text":"default_args"},{"className":"E02","col":0,"comment":"\n    The number of array elements in the data does not match that specified\n    in the FIELD specifier.\n    ","endLoc":1141,"id":5948,"nodeType":"Class","startLoc":1132,"text":"class E02(VOWarning, ValueError):\n    \"\"\"\n    The number of array elements in the data does not match that specified\n    in the FIELD specifier.\n    \"\"\"\n\n    message_template = (\n        \"Incorrect number of elements in array. \" +\n        \"Expected multiple of {}, got {}\")\n    default_args = ('x', 'y')"},{"attributeType":"null","col":4,"comment":"null","endLoc":1138,"id":5949,"name":"message_template","nodeType":"Attribute","startLoc":1138,"text":"message_template"},{"col":0,"comment":"null","endLoc":244,"header":"def resolve_id(ID, id, config=None, pos=None)","id":5950,"name":"resolve_id","nodeType":"Function","startLoc":240,"text":"def resolve_id(ID, id, config=None, pos=None):\n    if ID is None and id is not None:\n        warn_or_raise(W09, W09, (), config, pos)\n        return id\n    return ID"},{"attributeType":"MrtSplitter","col":4,"comment":"null","endLoc":566,"id":5951,"name":"splitter_class","nodeType":"Attribute","startLoc":566,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":1141,"id":5952,"name":"default_args","nodeType":"Attribute","startLoc":1141,"text":"default_args"},{"className":"E03","col":0,"comment":"\n    Complex numbers should be two values separated by whitespace.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    ","endLoc":1155,"id":5953,"nodeType":"Class","startLoc":1144,"text":"class E03(VOWarning, ValueError):\n    \"\"\"\n    Complex numbers should be two values separated by whitespace.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    \"\"\"\n\n    message_template = \"'{}' does not parse as a complex number\"\n    default_args = ('x',)"},{"attributeType":"null","col":16,"comment":"null","endLoc":14,"id":5954,"name":"np","nodeType":"Attribute","startLoc":14,"text":"np"},{"attributeType":"null","col":4,"comment":"null","endLoc":1154,"id":5955,"name":"message_template","nodeType":"Attribute","startLoc":1154,"text":"message_template"},{"attributeType":"null","col":29,"comment":"null","endLoc":20,"id":5956,"name":"u","nodeType":"Attribute","startLoc":20,"text":"u"},{"attributeType":"null","col":4,"comment":"null","endLoc":1223,"id":5957,"name":"default_args","nodeType":"Attribute","startLoc":1223,"text":"default_args"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":5958,"name":"MAX_SIZE_README_LINE","nodeType":"Attribute","startLoc":27,"text":"MAX_SIZE_README_LINE"},{"attributeType":"null","col":4,"comment":"null","endLoc":1155,"id":5959,"name":"default_args","nodeType":"Attribute","startLoc":1155,"text":"default_args"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":5960,"name":"MAX_COL_INTLIMIT","nodeType":"Attribute","startLoc":28,"text":"MAX_COL_INTLIMIT"},{"className":"E08","col":0,"comment":"\n    The ``type`` attribute on the ``VALUES`` element must be either\n    ``legal`` or ``actual``.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:values>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:values>`__\n    ","endLoc":1240,"id":5961,"nodeType":"Class","startLoc":1228,"text":"class E08(VOWarning, ValueError):\n    \"\"\"\n    The ``type`` attribute on the ``VALUES`` element must be either\n    ``legal`` or ``actual``.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:values>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:values>`__\n    \"\"\"\n\n    message_template = \"type must be 'legal' or 'actual', but is '{}'\"\n    default_args = ('x',)"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":5962,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":31,"text":"__doctest_skip__"},{"className":"E04","col":0,"comment":"\n    A ``bit`` array should be a string of '0's and '1's.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    ","endLoc":1169,"id":5963,"nodeType":"Class","startLoc":1158,"text":"class E04(VOWarning, ValueError):\n    \"\"\"\n    A ``bit`` array should be a string of '0's and '1's.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    \"\"\"\n\n    message_template = \"Invalid bit value '{}'\"\n    default_args = ('x',)"},{"attributeType":"null","col":0,"comment":"null","endLoc":34,"id":5964,"name":"BYTE_BY_BYTE_TEMPLATE","nodeType":"Attribute","startLoc":34,"text":"BYTE_BY_BYTE_TEMPLATE"},{"attributeType":"null","col":4,"comment":"null","endLoc":1239,"id":5965,"name":"message_template","nodeType":"Attribute","startLoc":1239,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1168,"id":5966,"name":"message_template","nodeType":"Attribute","startLoc":1168,"text":"message_template"},{"attributeType":"null","col":0,"comment":"null","endLoc":42,"id":5967,"name":"MRT_TEMPLATE","nodeType":"Attribute","startLoc":42,"text":"MRT_TEMPLATE"},{"attributeType":"null","col":4,"comment":"null","endLoc":1240,"id":5968,"name":"default_args","nodeType":"Attribute","startLoc":1240,"text":"default_args"},{"className":"E09","col":0,"comment":"\n    The ``MIN``, ``MAX`` and ``OPTION`` elements must always have a\n    ``value`` attribute.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:values>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:values>`__\n    ","endLoc":1255,"id":5969,"nodeType":"Class","startLoc":1243,"text":"class E09(VOWarning, ValueError):\n    \"\"\"\n    The ``MIN``, ``MAX`` and ``OPTION`` elements must always have a\n    ``value`` attribute.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:values>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:values>`__\n    \"\"\"\n\n    message_template = \"'{}' must have a value attribute\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1254,"id":5970,"name":"message_template","nodeType":"Attribute","startLoc":1254,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1255,"id":5971,"name":"default_args","nodeType":"Attribute","startLoc":1255,"text":"default_args"},{"attributeType":"null","col":4,"comment":"null","endLoc":1169,"id":5972,"name":"default_args","nodeType":"Attribute","startLoc":1169,"text":"default_args"},{"className":"E10","col":0,"comment":"\n    From VOTable 1.1 and later, ``FIELD`` and ``PARAM`` elements must have\n    a ``datatype`` field.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#elem:FIELD>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#elem:FIELD>`__\n    ","endLoc":1270,"id":5973,"nodeType":"Class","startLoc":1258,"text":"class E10(VOWarning, ValueError):\n    \"\"\"\n    From VOTable 1.1 and later, ``FIELD`` and ``PARAM`` elements must have\n    a ``datatype`` field.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#elem:FIELD>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#elem:FIELD>`__\n    \"\"\"\n\n    message_template = \"'datatype' attribute required on all '{}' elements\"\n    default_args = ('FIELD',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1269,"id":5974,"name":"message_template","nodeType":"Attribute","startLoc":1269,"text":"message_template"},{"col":0,"comment":"","endLoc":9,"header":"mrt.py#<anonymous>","id":5975,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"Classes to read AAS MRT table format\n\nRef: https://journals.aas.org/mrt-standards\n\n:Copyright: Smithsonian Astrophysical Observatory (2021)\n:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu), \\\n         Suyog Garg (suyog7130@gmail.com)\n\"\"\"\n\nMAX_SIZE_README_LINE = 80\n\nMAX_COL_INTLIMIT = 100000\n\n__doctest_skip__ = ['*']\n\nBYTE_BY_BYTE_TEMPLATE = [\n    \"Byte-by-byte Description of file: $file\",\n    \"--------------------------------------------------------------------------------\",\n    \" Bytes Format Units  Label     Explanations\",\n    \"--------------------------------------------------------------------------------\",\n    \"$bytebybyte\",\n    \"--------------------------------------------------------------------------------\"]\n\nMRT_TEMPLATE = [\n    \"Title:\",\n    \"Authors:\",\n    \"Table:\",\n    \"================================================================================\",\n    \"$bytebybyte\",\n    \"Notes:\",\n    \"--------------------------------------------------------------------------------\"]"},{"className":"E05","col":0,"comment":"\n    A ``boolean`` value should be one of the following strings (case\n    insensitive) in the ``TABLEDATA`` format::\n\n        'TRUE', 'FALSE', '1', '0', 'T', 'F', '\\0', ' ', '?'\n\n    and in ``BINARY`` format::\n\n        'T', 'F', '1', '0', '\\0', ' ', '?'\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    ","endLoc":1190,"id":5976,"nodeType":"Class","startLoc":1172,"text":"class E05(VOWarning, ValueError):\n    r\"\"\"\n    A ``boolean`` value should be one of the following strings (case\n    insensitive) in the ``TABLEDATA`` format::\n\n        'TRUE', 'FALSE', '1', '0', 'T', 'F', '\\0', ' ', '?'\n\n    and in ``BINARY`` format::\n\n        'T', 'F', '1', '0', '\\0', ' ', '?'\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:datatypes>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:datatypes>`__\n    \"\"\"\n\n    message_template = \"Invalid boolean value '{}'\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1189,"id":5977,"name":"message_template","nodeType":"Attribute","startLoc":1189,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1190,"id":5978,"name":"default_args","nodeType":"Attribute","startLoc":1190,"text":"default_args"},{"className":"E11","col":0,"comment":"\n    The precision attribute is meant to express the number of significant\n    digits, either as a number of decimal places (e.g. ``precision=\"F2\"`` or\n    equivalently ``precision=\"2\"`` to express 2 significant figures\n    after the decimal point), or as a number of significant figures\n    (e.g. ``precision=\"E5\"`` indicates a relative precision of 10-5).\n\n    It is validated using the following regular expression::\n\n        [EF]?[1-9][0-9]*\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:form>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:form>`__\n    ","endLoc":1292,"id":5979,"nodeType":"Class","startLoc":1273,"text":"class E11(VOWarning, ValueError):\n    \"\"\"\n    The precision attribute is meant to express the number of significant\n    digits, either as a number of decimal places (e.g. ``precision=\"F2\"`` or\n    equivalently ``precision=\"2\"`` to express 2 significant figures\n    after the decimal point), or as a number of significant figures\n    (e.g. ``precision=\"E5\"`` indicates a relative precision of 10-5).\n\n    It is validated using the following regular expression::\n\n        [EF]?[1-9][0-9]*\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:form>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:form>`__\n    \"\"\"\n\n    message_template = \"precision '{}' is invalid\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1291,"id":5980,"name":"message_template","nodeType":"Attribute","startLoc":1291,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1292,"id":5981,"name":"default_args","nodeType":"Attribute","startLoc":1292,"text":"default_args"},{"className":"E12","col":0,"comment":"\n    The width attribute is meant to indicate to the application the\n    number of characters to be used for input or output of the\n    quantity.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:form>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:form>`__\n    ","endLoc":1308,"id":5982,"nodeType":"Class","startLoc":1295,"text":"class E12(VOWarning, ValueError):\n    \"\"\"\n    The width attribute is meant to indicate to the application the\n    number of characters to be used for input or output of the\n    quantity.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:form>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:form>`__\n    \"\"\"\n\n    message_template = \"width must be a positive integer, got '{}'\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1307,"id":5983,"name":"message_template","nodeType":"Attribute","startLoc":1307,"text":"message_template"},{"fileName":"setup_package.py","filePath":"astropy/io/votable","id":5984,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom setuptools import Extension\nfrom os.path import join\n\n\ndef get_extensions(build_type='release'):\n    VO_DIR = 'astropy/io/votable/src'\n\n    return [Extension(\n        \"astropy.io.votable.tablewriter\",\n        [join(VO_DIR, \"tablewriter.c\")],\n        include_dirs=[VO_DIR])]\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":1308,"id":5985,"name":"default_args","nodeType":"Attribute","startLoc":1308,"text":"default_args"},{"className":"E13","col":0,"comment":"\n    From the VOTable 1.2 spec:\n\n        A table cell can contain an array of a given primitive type,\n        with a fixed or variable number of elements; the array may\n        even be multidimensional. For instance, the position of a\n        point in a 3D space can be defined by the following::\n\n            <FIELD ID=\"point_3D\" datatype=\"double\" arraysize=\"3\"/>\n\n        and each cell corresponding to that definition must contain\n        exactly 3 numbers. An asterisk (\\*) may be appended to\n        indicate a variable number of elements in the array, as in::\n\n            <FIELD ID=\"values\" datatype=\"int\" arraysize=\"100*\"/>\n\n        where it is specified that each cell corresponding to that\n        definition contains 0 to 100 integer numbers. The number may\n        be omitted to specify an unbounded array (in practice up to\n        =~2×10⁹ elements).\n\n        A table cell can also contain a multidimensional array of a\n        given primitive type. This is specified by a sequence of\n        dimensions separated by the ``x`` character, with the first\n        dimension changing fastest; as in the case of a simple array,\n        the last dimension may be variable in length. As an example,\n        the following definition declares a table cell which may\n        contain a set of up to 10 images, each of 64×64 bytes::\n\n            <FIELD ID=\"thumbs\" datatype=\"unsignedByte\" arraysize=\"64×64×10*\"/>\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:dim>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:dim>`__\n    ","endLoc":1350,"id":5986,"nodeType":"Class","startLoc":1311,"text":"class E13(VOWarning, ValueError):\n    r\"\"\"\n    From the VOTable 1.2 spec:\n\n        A table cell can contain an array of a given primitive type,\n        with a fixed or variable number of elements; the array may\n        even be multidimensional. For instance, the position of a\n        point in a 3D space can be defined by the following::\n\n            <FIELD ID=\"point_3D\" datatype=\"double\" arraysize=\"3\"/>\n\n        and each cell corresponding to that definition must contain\n        exactly 3 numbers. An asterisk (\\*) may be appended to\n        indicate a variable number of elements in the array, as in::\n\n            <FIELD ID=\"values\" datatype=\"int\" arraysize=\"100*\"/>\n\n        where it is specified that each cell corresponding to that\n        definition contains 0 to 100 integer numbers. The number may\n        be omitted to specify an unbounded array (in practice up to\n        =~2×10⁹ elements).\n\n        A table cell can also contain a multidimensional array of a\n        given primitive type. This is specified by a sequence of\n        dimensions separated by the ``x`` character, with the first\n        dimension changing fastest; as in the case of a simple array,\n        the last dimension may be variable in length. As an example,\n        the following definition declares a table cell which may\n        contain a set of up to 10 images, each of 64×64 bytes::\n\n            <FIELD ID=\"thumbs\" datatype=\"unsignedByte\" arraysize=\"64×64×10*\"/>\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:dim>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#sec:dim>`__\n    \"\"\"\n\n    message_template = \"Invalid arraysize attribute '{}'\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1349,"id":5987,"name":"message_template","nodeType":"Attribute","startLoc":1349,"text":"message_template"},{"col":0,"comment":"null","endLoc":13,"header":"def get_extensions(build_type='release')","id":5988,"name":"get_extensions","nodeType":"Function","startLoc":7,"text":"def get_extensions(build_type='release'):\n    VO_DIR = 'astropy/io/votable/src'\n\n    return [Extension(\n        \"astropy.io.votable.tablewriter\",\n        [join(VO_DIR, \"tablewriter.c\")],\n        include_dirs=[VO_DIR])]"},{"attributeType":"null","col":4,"comment":"null","endLoc":1350,"id":5989,"name":"default_args","nodeType":"Attribute","startLoc":1350,"text":"default_args"},{"className":"E14","col":0,"comment":"\n    All ``PARAM`` elements must have a ``value`` attribute.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#elem:FIELD>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#elem:FIELD>`__\n    ","endLoc":1363,"id":5990,"nodeType":"Class","startLoc":1353,"text":"class E14(VOWarning, ValueError):\n    \"\"\"\n    All ``PARAM`` elements must have a ``value`` attribute.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#elem:FIELD>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#elem:FIELD>`__\n    \"\"\"\n\n    message_template = \"value attribute is required for all PARAM elements\""},{"attributeType":"null","col":4,"comment":"null","endLoc":1363,"id":5991,"name":"message_template","nodeType":"Attribute","startLoc":1363,"text":"message_template"},{"className":"E15","col":0,"comment":"\n    All ``COOSYS`` elements must have an ``ID`` attribute.\n\n    Note that the VOTable 1.1 specification says this attribute is\n    optional, but its corresponding schema indicates it is required.\n\n    In VOTable 1.2, the ``COOSYS`` element is deprecated.\n    ","endLoc":1376,"id":5992,"nodeType":"Class","startLoc":1366,"text":"class E15(VOWarning, ValueError):\n    \"\"\"\n    All ``COOSYS`` elements must have an ``ID`` attribute.\n\n    Note that the VOTable 1.1 specification says this attribute is\n    optional, but its corresponding schema indicates it is required.\n\n    In VOTable 1.2, the ``COOSYS`` element is deprecated.\n    \"\"\"\n\n    message_template = \"ID attribute is required for all COOSYS elements\""},{"attributeType":"null","col":4,"comment":"null","endLoc":1376,"id":5993,"name":"message_template","nodeType":"Attribute","startLoc":1376,"text":"message_template"},{"className":"E16","col":0,"comment":"\n    The ``system`` attribute on the ``COOSYS`` element must be one of the\n    following::\n\n      'eq_FK4', 'eq_FK5', 'ICRS', 'ecl_FK4', 'ecl_FK5', 'galactic',\n      'supergalactic', 'xy', 'barycentric', 'geo_app'\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#elem:COOSYS>`__\n    ","endLoc":1392,"id":5994,"nodeType":"Class","startLoc":1379,"text":"class E16(VOTableSpecWarning):\n    \"\"\"\n    The ``system`` attribute on the ``COOSYS`` element must be one of the\n    following::\n\n      'eq_FK4', 'eq_FK5', 'ICRS', 'ecl_FK4', 'ecl_FK5', 'galactic',\n      'supergalactic', 'xy', 'barycentric', 'geo_app'\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#elem:COOSYS>`__\n    \"\"\"\n\n    message_template = \"Invalid system attribute '{}'\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1391,"id":5995,"name":"message_template","nodeType":"Attribute","startLoc":1391,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1392,"id":5996,"name":"default_args","nodeType":"Attribute","startLoc":1392,"text":"default_args"},{"className":"E17","col":0,"comment":"\n    ``extnum`` attribute must be a positive integer.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__\n    ","endLoc":1405,"id":5997,"nodeType":"Class","startLoc":1395,"text":"class E17(VOWarning, ValueError):\n    \"\"\"\n    ``extnum`` attribute must be a positive integer.\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__\n    \"\"\"\n\n    message_template = \"extnum must be a positive integer\""},{"attributeType":"null","col":4,"comment":"null","endLoc":1405,"id":5998,"name":"message_template","nodeType":"Attribute","startLoc":1405,"text":"message_template"},{"className":"E18","col":0,"comment":"\n    The ``type`` attribute of the ``RESOURCE`` element must be one of\n    \"results\" or \"meta\".\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__\n    ","endLoc":1420,"id":5999,"nodeType":"Class","startLoc":1408,"text":"class E18(VOWarning, ValueError):\n    \"\"\"\n    The ``type`` attribute of the ``RESOURCE`` element must be one of\n    \"results\" or \"meta\".\n\n    **References**: `1.1\n    <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,\n    `1.2\n    <http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2.html#ToC58>`__\n    \"\"\"\n\n    message_template = \"type must be 'results' or 'meta', not '{}'\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1419,"id":6000,"name":"message_template","nodeType":"Attribute","startLoc":1419,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1420,"id":6001,"name":"default_args","nodeType":"Attribute","startLoc":1420,"text":"default_args"},{"className":"E19","col":0,"comment":"\n    Raised either when the file doesn't appear to be XML, or the root\n    element is not VOTABLE.\n    ","endLoc":1429,"id":6002,"nodeType":"Class","startLoc":1423,"text":"class E19(VOWarning, ValueError):\n    \"\"\"\n    Raised either when the file doesn't appear to be XML, or the root\n    element is not VOTABLE.\n    \"\"\"\n\n    message_template = \"File does not appear to be a VOTABLE\""},{"attributeType":"null","col":4,"comment":"null","endLoc":1429,"id":6003,"name":"message_template","nodeType":"Attribute","startLoc":1429,"text":"message_template"},{"className":"E20","col":0,"comment":"\n    The table had only *x* fields defined, but the data itself has more\n    columns than that.\n    ","endLoc":1439,"id":6004,"nodeType":"Class","startLoc":1432,"text":"class E20(VOTableSpecError):\n    \"\"\"\n    The table had only *x* fields defined, but the data itself has more\n    columns than that.\n    \"\"\"\n\n    message_template = \"Data has more columns than are defined in the header ({})\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1438,"id":6005,"name":"message_template","nodeType":"Attribute","startLoc":1438,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1439,"id":6006,"name":"default_args","nodeType":"Attribute","startLoc":1439,"text":"default_args"},{"className":"E21","col":0,"comment":"\n    The table had *x* fields defined, but the data itself has only *y*\n    columns.\n    ","endLoc":1449,"id":6007,"nodeType":"Class","startLoc":1442,"text":"class E21(VOWarning, ValueError):\n    \"\"\"\n    The table had *x* fields defined, but the data itself has only *y*\n    columns.\n    \"\"\"\n\n    message_template = \"Data has fewer columns ({}) than are defined in the header ({})\"\n    default_args = ('x', 'y')"},{"attributeType":"null","col":4,"comment":"null","endLoc":1448,"id":6008,"name":"message_template","nodeType":"Attribute","startLoc":1448,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1449,"id":6009,"name":"default_args","nodeType":"Attribute","startLoc":1449,"text":"default_args"},{"className":"E22","col":0,"comment":"\n    All ``TIMESYS`` elements must have an ``ID`` attribute.\n    ","endLoc":1457,"id":6010,"nodeType":"Class","startLoc":1452,"text":"class E22(VOWarning, ValueError):\n    \"\"\"\n    All ``TIMESYS`` elements must have an ``ID`` attribute.\n    \"\"\"\n\n    message_template = \"ID attribute is required for all TIMESYS elements\""},{"attributeType":"null","col":4,"comment":"null","endLoc":1457,"id":6011,"name":"message_template","nodeType":"Attribute","startLoc":1457,"text":"message_template"},{"className":"E23","col":0,"comment":"\n    The ``timeorigin`` attribute on the ``TIMESYS`` element must be\n    either a floating point literal specifying a valid Julian Date,\n    or, for convenience, the string \"MJD-origin\" (standing for 2400000.5)\n    or the string \"JD-origin\" (standing for 0).\n\n    **References**: `1.4\n    <http://www.ivoa.net/documents/VOTable/20191021/REC-VOTable-1.4-20191021.html#ToC21>`__\n    ","endLoc":1472,"id":6012,"nodeType":"Class","startLoc":1460,"text":"class E23(VOTableSpecWarning):\n    \"\"\"\n    The ``timeorigin`` attribute on the ``TIMESYS`` element must be\n    either a floating point literal specifying a valid Julian Date,\n    or, for convenience, the string \"MJD-origin\" (standing for 2400000.5)\n    or the string \"JD-origin\" (standing for 0).\n\n    **References**: `1.4\n    <http://www.ivoa.net/documents/VOTable/20191021/REC-VOTable-1.4-20191021.html#ToC21>`__\n    \"\"\"\n\n    message_template = \"Invalid timeorigin attribute '{}'\"\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1471,"id":6013,"name":"message_template","nodeType":"Attribute","startLoc":1471,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1472,"id":6014,"name":"default_args","nodeType":"Attribute","startLoc":1472,"text":"default_args"},{"className":"E24","col":0,"comment":"\n    Non-ASCII unicode values should not be written when the FIELD ``datatype=\"char\"``,\n    and cannot be written in BINARY or BINARY2 serialization.\n    ","endLoc":1484,"id":6015,"nodeType":"Class","startLoc":1475,"text":"class E24(VOWarning, ValueError):\n    \"\"\"\n    Non-ASCII unicode values should not be written when the FIELD ``datatype=\"char\"``,\n    and cannot be written in BINARY or BINARY2 serialization.\n    \"\"\"\n\n    message_template = (\n        'Attempt to write non-ASCII value ({}) to FIELD ({}) which '\n        'has datatype=\"char\"')\n    default_args = ('', '')"},{"attributeType":"null","col":4,"comment":"null","endLoc":1481,"id":6016,"name":"message_template","nodeType":"Attribute","startLoc":1481,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1484,"id":6017,"name":"default_args","nodeType":"Attribute","startLoc":1484,"text":"default_args"},{"className":"E25","col":0,"comment":"\n    A VOTable cannot have a DATA section without any defined FIELD; DATA will be ignored.\n    ","endLoc":1492,"id":6018,"nodeType":"Class","startLoc":1487,"text":"class E25(VOTableSpecWarning):\n    \"\"\"\n    A VOTable cannot have a DATA section without any defined FIELD; DATA will be ignored.\n    \"\"\"\n\n    message_template = \"No FIELDs are defined; DATA section will be ignored.\""},{"attributeType":"null","col":4,"comment":"null","endLoc":1492,"id":6019,"name":"message_template","nodeType":"Attribute","startLoc":1492,"text":"message_template"},{"col":0,"comment":"\n    Parses the vo warning string back into its parts.\n    ","endLoc":197,"header":"def parse_vowarning(line)","id":6020,"name":"parse_vowarning","nodeType":"Function","startLoc":158,"text":"def parse_vowarning(line):\n    \"\"\"\n    Parses the vo warning string back into its parts.\n    \"\"\"\n    result = {}\n    match = _warning_pat.search(line)\n    if match:\n        result['warning'] = warning = match.group('warning')\n        if warning is not None:\n            result['is_warning'] = (warning[0].upper() == 'W')\n            result['is_exception'] = not result['is_warning']\n            result['number'] = int(match.group('warning')[1:])\n            result['doc_url'] = f\"io/votable/api_exceptions.html#{warning.lower()}\"\n        else:\n            result['is_warning'] = False\n            result['is_exception'] = False\n            result['is_other'] = True\n            result['number'] = None\n            result['doc_url'] = None\n        try:\n            result['nline'] = int(match.group('nline'))\n        except ValueError:\n            result['nline'] = 0\n        try:\n            result['nchar'] = int(match.group('nchar'))\n        except ValueError:\n            result['nchar'] = 0\n        result['message'] = match.group('rest')\n        result['is_something'] = True\n    else:\n        result['warning'] = None\n        result['is_warning'] = False\n        result['is_exception'] = False\n        result['is_other'] = False\n        result['is_something'] = False\n        if not isinstance(line, str):\n            line = line.decode('utf-8')\n        result['message'] = line\n\n    return result"},{"fileName":"xmlutil.py","filePath":"astropy/io/votable","id":6021,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nVarious XML-related utilities\n\"\"\"\n\n\n# ASTROPY\nfrom astropy.logger import log\nfrom astropy.utils import data\nfrom astropy.utils.xml import check as xml_check\nfrom astropy.utils.xml import validate\n\n# LOCAL\nfrom .exceptions import (warn_or_raise, vo_warn, W02, W03, W04, W05)\n\n\n__all__ = [\n    'check_id', 'fix_id', 'check_token', 'check_mime_content_type',\n    'check_anyuri', 'validate_schema'\n    ]\n\n\ndef check_id(ID, name='ID', config=None, pos=None):\n    \"\"\"\n    Raises a `~astropy.io.votable.exceptions.VOTableSpecError` if *ID*\n    is not a valid XML ID_.\n\n    *name* is the name of the attribute being checked (used only for\n    error messages).\n    \"\"\"\n    if (ID is not None and not xml_check.check_id(ID)):\n        warn_or_raise(W02, W02, (name, ID), config, pos)\n        return False\n    return True\n\n\ndef fix_id(ID, config=None, pos=None):\n    \"\"\"\n    Given an arbitrary string, create one that can be used as an xml id.\n\n    This is rather simplistic at the moment, since it just replaces\n    non-valid characters with underscores.\n    \"\"\"\n    if ID is None:\n        return None\n    corrected = xml_check.fix_id(ID)\n    if corrected != ID:\n        vo_warn(W03, (ID, corrected), config, pos)\n    return corrected\n\n\n_token_regex = r\"(?![\\r\\l\\t ])[^\\r\\l\\t]*(?![\\r\\l\\t ])\"\n\n\ndef check_token(token, attr_name, config=None, pos=None):\n    \"\"\"\n    Raises a `ValueError` if *token* is not a valid XML token.\n\n    As defined by XML Schema Part 2.\n    \"\"\"\n    if (token is not None and not xml_check.check_token(token)):\n        return False\n    return True\n\n\ndef check_mime_content_type(content_type, config=None, pos=None):\n    \"\"\"\n    Raises a `~astropy.io.votable.exceptions.VOTableSpecError` if\n    *content_type* is not a valid MIME content type.\n\n    As defined by RFC 2045 (syntactically, at least).\n    \"\"\"\n    if (content_type is not None and\n        not xml_check.check_mime_content_type(content_type)):\n        warn_or_raise(W04, W04, content_type, config, pos)\n        return False\n    return True\n\n\ndef check_anyuri(uri, config=None, pos=None):\n    \"\"\"\n    Raises a `~astropy.io.votable.exceptions.VOTableSpecError` if\n    *uri* is not a valid URI.\n\n    As defined in RFC 2396.\n    \"\"\"\n    if (uri is not None and not xml_check.check_anyuri(uri)):\n        warn_or_raise(W05, W05, uri, config, pos)\n        return False\n    return True\n\n\ndef validate_schema(filename, version='1.1'):\n    \"\"\"\n    Validates the given file against the appropriate VOTable schema.\n\n    Parameters\n    ----------\n    filename : str\n        The path to the XML file to validate\n\n    version : str, optional\n        The VOTABLE version to check, which must be a string \\\"1.0\\\",\n        \\\"1.1\\\", \\\"1.2\\\" or \\\"1.3\\\".  If it is not one of these,\n        version \\\"1.1\\\" is assumed.\n\n        For version \\\"1.0\\\", it is checked against a DTD, since that\n        version did not have an XML Schema.\n\n    Returns\n    -------\n    returncode, stdout, stderr : int, str, str\n        Returns the returncode from xmllint and the stdout and stderr\n        as strings\n    \"\"\"\n    if version not in ('1.0', '1.1', '1.2', '1.3'):\n        log.info(f'{filename} has version {version}, using schema 1.1')\n        version = '1.1'\n\n    if version in ('1.1', '1.2', '1.3'):\n        schema_path = data.get_pkg_data_filename(\n            f'data/VOTable.v{version}.xsd')\n    else:\n        schema_path = data.get_pkg_data_filename(\n            'data/VOTable.dtd')\n\n    return validate.validate_schema(filename, schema_path)\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":1270,"id":6022,"name":"default_args","nodeType":"Attribute","startLoc":1270,"text":"default_args"},{"className":"_IDProperty","col":0,"comment":"null","endLoc":301,"id":6023,"nodeType":"Class","startLoc":285,"text":"class _IDProperty:\n    @property\n    def ID(self):\n        \"\"\"\n        The XML ID_ of the element.  May be `None` or a string\n        conforming to XML ID_ syntax.\n        \"\"\"\n        return self._ID\n\n    @ID.setter\n    def ID(self, ID):\n        xmlutil.check_id(ID, 'ID', self._config, self._pos)\n        self._ID = ID\n\n    @ID.deleter\n    def ID(self):\n        self._ID = None"},{"col":4,"comment":"\n        The XML ID_ of the element.  May be `None` or a string\n        conforming to XML ID_ syntax.\n        ","endLoc":292,"header":"@property\n    def ID(self)","id":6024,"name":"ID","nodeType":"Function","startLoc":286,"text":"@property\n    def ID(self):\n        \"\"\"\n        The XML ID_ of the element.  May be `None` or a string\n        conforming to XML ID_ syntax.\n        \"\"\"\n        return self._ID"},{"col":4,"comment":"null","endLoc":297,"header":"@ID.setter\n    def ID(self, ID)","id":6025,"name":"ID","nodeType":"Function","startLoc":294,"text":"@ID.setter\n    def ID(self, ID):\n        xmlutil.check_id(ID, 'ID', self._config, self._pos)\n        self._ID = ID"},{"col":4,"comment":"null","endLoc":3625,"header":"def parse(self, iterator, config)","id":6026,"name":"parse","nodeType":"Function","startLoc":3569,"text":"def parse(self, iterator, config):\n        config['_current_table_number'] = 0\n\n        for start, tag, data, pos in iterator:\n            if start:\n                if tag == 'xml':\n                    pass\n                elif tag == 'VOTABLE':\n                    if 'version' not in data:\n                        warn_or_raise(W20, W20, self.version, config, pos)\n                        config['version'] = self.version\n                    else:\n                        config['version'] = self._version = data['version']\n                        if config['version'].lower().startswith('v'):\n                            warn_or_raise(\n                                W29, W29, config['version'], config, pos)\n                            self._version = config['version'] = \\\n                                            config['version'][1:]\n                        if config['version'] not in self._version_namespace_map:\n                            vo_warn(W21, config['version'], config, pos)\n\n                    if 'xmlns' in data:\n                        ns_info = self._version_namespace_map.get(config['version'], {})\n                        correct_ns = ns_info.get('namespace_uri')\n                        if data['xmlns'] != correct_ns:\n                            vo_warn(W41, (correct_ns, data['xmlns']), config, pos)\n                    else:\n                        vo_warn(W42, (), config, pos)\n\n                    break\n                else:\n                    vo_raise(E19, (), config, pos)\n        config.update(self._get_version_checks())\n\n        tag_mapping = {\n            'PARAM': self._add_param,\n            'RESOURCE': self._add_resource,\n            'COOSYS': self._add_coosys,\n            'TIMESYS': self._add_timesys,\n            'INFO': self._add_info,\n            'DEFINITIONS': self._add_definitions,\n            'DESCRIPTION': self._ignore_add,\n            'GROUP': self._add_group}\n\n        for start, tag, data, pos in iterator:\n            if start:\n                tag_mapping.get(tag, self._add_unknown_tag)(\n                    iterator, tag, data, config, pos)\n            elif tag == 'DESCRIPTION':\n                if self.description is not None:\n                    warn_or_raise(W17, W17, 'VOTABLE', config, pos)\n                self.description = data or None\n\n        if not len(self.resources) and config['version_1_2_or_later']:\n            warn_or_raise(W53, W53, (), config, pos)\n\n        return self"},{"col":4,"comment":"null","endLoc":3300,"header":"def __init__(self, d_lon_coslat, d_lat=None, d_distance=None, copy=True)","id":6027,"name":"__init__","nodeType":"Function","startLoc":3296,"text":"def __init__(self, d_lon_coslat, d_lat=None, d_distance=None, copy=True):\n        super().__init__(d_lon_coslat, d_lat, d_distance, copy=copy)\n        if not self._d_lon_coslat.unit.is_equivalent(self._d_lat.unit):\n            raise u.UnitsError('d_lon_coslat and d_lat should have equivalent '\n                               'units.')"},{"col":0,"comment":"\n    Raises a `~astropy.io.votable.exceptions.VOTableSpecError` if *ID*\n    is not a valid XML ID_.\n\n    *name* is the name of the attribute being checked (used only for\n    error messages).\n    ","endLoc":34,"header":"def check_id(ID, name='ID', config=None, pos=None)","id":6028,"name":"check_id","nodeType":"Function","startLoc":23,"text":"def check_id(ID, name='ID', config=None, pos=None):\n    \"\"\"\n    Raises a `~astropy.io.votable.exceptions.VOTableSpecError` if *ID*\n    is not a valid XML ID_.\n\n    *name* is the name of the attribute being checked (used only for\n    error messages).\n    \"\"\"\n    if (ID is not None and not xml_check.check_id(ID)):\n        warn_or_raise(W02, W02, (name, ID), config, pos)\n        return False\n    return True"},{"attributeType":"null","col":4,"comment":"null","endLoc":34,"id":6029,"name":"xml_escape_cdata","nodeType":"Attribute","startLoc":34,"text":"xml_escape_cdata"},{"col":0,"comment":"null","endLoc":1501,"header":"def _get_warning_and_exception_classes(prefix)","id":6030,"name":"_get_warning_and_exception_classes","nodeType":"Function","startLoc":1495,"text":"def _get_warning_and_exception_classes(prefix):\n    classes = []\n    for key, val in globals().items():\n        if re.match(prefix + \"[0-9]{2}\", key):\n            classes.append((key, val))\n    classes.sort()\n    return classes"},{"className":"Converter","col":0,"comment":"\n    The base class for all converters.  Each subclass handles\n    converting a specific VOTABLE data type to/from the TABLEDATA_ and\n    BINARY_ on-disk representations.\n\n    Parameters\n    ----------\n    field : `~astropy.io.votable.tree.Field`\n        object describing the datatype\n\n    config : dict\n        The parser configuration dictionary\n\n    pos : tuple\n        The position in the XML file where the FIELD object was\n        found.  Used for error messages.\n\n    ","endLoc":287,"id":6031,"nodeType":"Class","startLoc":143,"text":"class Converter:\n    \"\"\"\n    The base class for all converters.  Each subclass handles\n    converting a specific VOTABLE data type to/from the TABLEDATA_ and\n    BINARY_ on-disk representations.\n\n    Parameters\n    ----------\n    field : `~astropy.io.votable.tree.Field`\n        object describing the datatype\n\n    config : dict\n        The parser configuration dictionary\n\n    pos : tuple\n        The position in the XML file where the FIELD object was\n        found.  Used for error messages.\n\n    \"\"\"\n\n    def __init__(self, field, config=None, pos=None):\n        pass\n\n    @staticmethod\n    def _parse_length(read):\n        return struct_unpack(\">I\", read(4))[0]\n\n    @staticmethod\n    def _write_length(length):\n        return struct_pack(\">I\", int(length))\n\n    def supports_empty_values(self, config):\n        \"\"\"\n        Returns True when the field can be completely empty.\n        \"\"\"\n        return config.get('version_1_3_or_later')\n\n    def parse(self, value, config=None, pos=None):\n        \"\"\"\n        Convert the string *value* from the TABLEDATA_ format into an\n        object with the correct native in-memory datatype and mask flag.\n\n        Parameters\n        ----------\n        value : str\n            value in TABLEDATA format\n\n        Returns\n        -------\n        native : tuple\n            A two-element tuple of: value, mask.\n            The value as a Numpy array or scalar, and *mask* is True\n            if the value is missing.\n        \"\"\"\n        raise NotImplementedError(\n            \"This datatype must implement a 'parse' method.\")\n\n    def parse_scalar(self, value, config=None, pos=None):\n        \"\"\"\n        Parse a single scalar of the underlying type of the converter.\n        For non-array converters, this is equivalent to parse.  For\n        array converters, this is used to parse a single\n        element of the array.\n\n        Parameters\n        ----------\n        value : str\n            value in TABLEDATA format\n\n        Returns\n        -------\n        native : (2,) tuple\n            (value, mask)\n            The value as a Numpy array or scalar, and *mask* is True\n            if the value is missing.\n        \"\"\"\n        return self.parse(value, config, pos)\n\n    def output(self, value, mask):\n        \"\"\"\n        Convert the object *value* (in the native in-memory datatype)\n        to a unicode string suitable for serializing in the TABLEDATA_\n        format.\n\n        Parameters\n        ----------\n        value\n            The value, the native type corresponding to this converter\n\n        mask : bool\n            If `True`, will return the string representation of a\n            masked value.\n\n        Returns\n        -------\n        tabledata_repr : unicode\n        \"\"\"\n        raise NotImplementedError(\n            \"This datatype must implement a 'output' method.\")\n\n    def binparse(self, read):\n        \"\"\"\n        Reads some number of bytes from the BINARY_ format\n        representation by calling the function *read*, and returns the\n        native in-memory object representation for the datatype\n        handled by *self*.\n\n        Parameters\n        ----------\n        read : function\n            A function that given a number of bytes, returns a byte\n            string.\n\n        Returns\n        -------\n        native : (2,) tuple\n            (value, mask). The value as a Numpy array or scalar, and *mask* is\n            True if the value is missing.\n        \"\"\"\n        raise NotImplementedError(\n            \"This datatype must implement a 'binparse' method.\")\n\n    def binoutput(self, value, mask):\n        \"\"\"\n        Convert the object *value* in the native in-memory datatype to\n        a string of bytes suitable for serialization in the BINARY_\n        format.\n\n        Parameters\n        ----------\n        value\n            The value, the native type corresponding to this converter\n\n        mask : bool\n            If `True`, will return the string representation of a\n            masked value.\n\n        Returns\n        -------\n        bytes : bytes\n            The binary representation of the value, suitable for\n            serialization in the BINARY_ format.\n        \"\"\"\n        raise NotImplementedError(\n            \"This datatype must implement a 'binoutput' method.\")"},{"col":0,"comment":"\n    Returns `True` if *ID* is a valid XML ID.\n    ","endLoc":16,"header":"def check_id(ID)","id":6032,"name":"check_id","nodeType":"Function","startLoc":12,"text":"def check_id(ID):\n    \"\"\"\n    Returns `True` if *ID* is a valid XML ID.\n    \"\"\"\n    return re.match(r\"^[A-Za-z_][A-Za-z0-9_\\.\\-]*$\", ID) is not None"},{"col":4,"comment":"null","endLoc":164,"header":"def __init__(self, field, config=None, pos=None)","id":6033,"name":"__init__","nodeType":"Function","startLoc":163,"text":"def __init__(self, field, config=None, pos=None):\n        pass"},{"col":4,"comment":"null","endLoc":168,"header":"@staticmethod\n    def _parse_length(read)","id":6034,"name":"_parse_length","nodeType":"Function","startLoc":166,"text":"@staticmethod\n    def _parse_length(read):\n        return struct_unpack(\">I\", read(4))[0]"},{"col":4,"comment":"null","endLoc":3528,"header":"def _get_version_checks(self)","id":6035,"name":"_get_version_checks","nodeType":"Function","startLoc":3518,"text":"def _get_version_checks(self):\n        config = {}\n        config['version_1_1_or_later'] = \\\n            util.version_compare(self.version, '1.1') >= 0\n        config['version_1_2_or_later'] = \\\n            util.version_compare(self.version, '1.2') >= 0\n        config['version_1_3_or_later'] = \\\n            util.version_compare(self.version, '1.3') >= 0\n        config['version_1_4_or_later'] = \\\n            util.version_compare(self.version, '1.4') >= 0\n        return config"},{"col":0,"comment":"null","endLoc":1531,"header":"def _build_doc_string()","id":6036,"name":"_build_doc_string","nodeType":"Function","startLoc":1504,"text":"def _build_doc_string():\n    def generate_set(prefix):\n        classes = _get_warning_and_exception_classes(prefix)\n\n        out = io.StringIO()\n\n        for name, cls in classes:\n            out.write(f\".. _{name}:\\n\\n\")\n            msg = f\"{cls.__name__}: {cls.get_short_name()}\"\n            if not isinstance(msg, str):\n                msg = msg.decode('utf-8')\n            out.write(msg)\n            out.write('\\n')\n            out.write('~' * len(msg))\n            out.write('\\n\\n')\n            doc = cls.__doc__\n            if not isinstance(doc, str):\n                doc = doc.decode('utf-8')\n            out.write(dedent(doc))\n            out.write('\\n\\n')\n\n        return out.getvalue()\n\n    warnings = generate_set('W')\n    exceptions = generate_set('E')\n\n    return {'warnings': warnings,\n            'exceptions': exceptions}"},{"col":0,"comment":"\n    Given an arbitrary string, create one that can be used as an xml id.\n\n    This is rather simplistic at the moment, since it just replaces\n    non-valid characters with underscores.\n    ","endLoc":49,"header":"def fix_id(ID, config=None, pos=None)","id":6037,"name":"fix_id","nodeType":"Function","startLoc":37,"text":"def fix_id(ID, config=None, pos=None):\n    \"\"\"\n    Given an arbitrary string, create one that can be used as an xml id.\n\n    This is rather simplistic at the moment, since it just replaces\n    non-valid characters with underscores.\n    \"\"\"\n    if ID is None:\n        return None\n    corrected = xml_check.fix_id(ID)\n    if corrected != ID:\n        vo_warn(W03, (ID, corrected), config, pos)\n    return corrected"},{"col":0,"comment":"\n    Given an arbitrary string, create one that can be used as an xml\n    id.  This is rather simplistic at the moment, since it just\n    replaces non-valid characters with underscores.\n    ","endLoc":34,"header":"def fix_id(ID)","id":6038,"name":"fix_id","nodeType":"Function","startLoc":19,"text":"def fix_id(ID):\n    \"\"\"\n    Given an arbitrary string, create one that can be used as an xml\n    id.  This is rather simplistic at the moment, since it just\n    replaces non-valid characters with underscores.\n    \"\"\"\n    if re.match(r\"^[A-Za-z_][A-Za-z0-9_\\.\\-]*$\", ID):\n        return ID\n    if len(ID):\n        corrected = ID\n        if not len(corrected) or re.match('^[^A-Za-z_]$', corrected[0]):\n            corrected = '_' + corrected\n        corrected = (re.sub(r\"[^A-Za-z_]\", '_', corrected[0]) +\n                     re.sub(r\"[^A-Za-z0-9_\\.\\-]\", \"_\", corrected[1:]))\n        return corrected\n    return ''"},{"col":4,"comment":"null","endLoc":301,"header":"@ID.deleter\n    def ID(self)","id":6039,"name":"ID","nodeType":"Function","startLoc":299,"text":"@ID.deleter\n    def ID(self):\n        self._ID = None"},{"attributeType":"null","col":8,"comment":"null","endLoc":297,"id":6040,"name":"_ID","nodeType":"Attribute","startLoc":297,"text":"self._ID"},{"col":0,"comment":"\n    Raises a `ValueError` if *token* is not a valid XML token.\n\n    As defined by XML Schema Part 2.\n    ","endLoc":63,"header":"def check_token(token, attr_name, config=None, pos=None)","id":6041,"name":"check_token","nodeType":"Function","startLoc":55,"text":"def check_token(token, attr_name, config=None, pos=None):\n    \"\"\"\n    Raises a `ValueError` if *token* is not a valid XML token.\n\n    As defined by XML Schema Part 2.\n    \"\"\"\n    if (token is not None and not xml_check.check_token(token)):\n        return False\n    return True"},{"col":0,"comment":"\n    Parses a VOTABLE_ xml file (or file-like object), reading and\n    returning only the first `~astropy.io.votable.tree.Table`\n    instance.\n\n    See `parse` for a description of the keyword arguments.\n\n    Returns\n    -------\n    votable : `~astropy.io.votable.tree.Table` object\n    ","endLoc":180,"header":"def parse_single_table(source, **kwargs)","id":6042,"name":"parse_single_table","nodeType":"Function","startLoc":163,"text":"def parse_single_table(source, **kwargs):\n    \"\"\"\n    Parses a VOTABLE_ xml file (or file-like object), reading and\n    returning only the first `~astropy.io.votable.tree.Table`\n    instance.\n\n    See `parse` for a description of the keyword arguments.\n\n    Returns\n    -------\n    votable : `~astropy.io.votable.tree.Table` object\n    \"\"\"\n    if kwargs.get('table_number') is None:\n        kwargs['table_number'] = 0\n\n    votable = parse(source, **kwargs)\n\n    return votable.get_first_table()"},{"col":0,"comment":"\n    Returns `True` if *token* is a valid XML token, as defined by XML\n    Schema Part 2.\n    ","endLoc":48,"header":"def check_token(token)","id":6043,"name":"check_token","nodeType":"Function","startLoc":40,"text":"def check_token(token):\n    \"\"\"\n    Returns `True` if *token* is a valid XML token, as defined by XML\n    Schema Part 2.\n    \"\"\"\n    return (token == '' or\n            re.match(\n                r\"[^\\r\\n\\t ]?([^\\r\\n\\t ]| [^\\r\\n\\t ])*[^\\r\\n\\t ]?$\", token)\n            is not None)"},{"col":0,"comment":"\n    Raises a `~astropy.io.votable.exceptions.VOTableSpecError` if\n    *content_type* is not a valid MIME content type.\n\n    As defined by RFC 2045 (syntactically, at least).\n    ","endLoc":77,"header":"def check_mime_content_type(content_type, config=None, pos=None)","id":6044,"name":"check_mime_content_type","nodeType":"Function","startLoc":66,"text":"def check_mime_content_type(content_type, config=None, pos=None):\n    \"\"\"\n    Raises a `~astropy.io.votable.exceptions.VOTableSpecError` if\n    *content_type* is not a valid MIME content type.\n\n    As defined by RFC 2045 (syntactically, at least).\n    \"\"\"\n    if (content_type is not None and\n        not xml_check.check_mime_content_type(content_type)):\n        warn_or_raise(W04, W04, content_type, config, pos)\n        return False\n    return True"},{"col":0,"comment":"\n    Returns `True` if *content_type* is a valid MIME content type\n    (syntactically at least), as defined by RFC 2045.\n    ","endLoc":60,"header":"def check_mime_content_type(content_type)","id":6045,"name":"check_mime_content_type","nodeType":"Function","startLoc":51,"text":"def check_mime_content_type(content_type):\n    \"\"\"\n    Returns `True` if *content_type* is a valid MIME content type\n    (syntactically at least), as defined by RFC 2045.\n    \"\"\"\n    ctrls = ''.join(chr(x) for x in range(0, 0x20))\n    token_regex = f'[^()<>@,;:\\\\\\\"/[\\\\]?= {ctrls}\\x7f]+'\n    return re.match(\n        fr'(?P<type>{token_regex})/(?P<subtype>{token_regex})$',\n        content_type) is not None"},{"col":0,"comment":"\n    Raises a `~astropy.io.votable.exceptions.VOTableSpecError` if\n    *uri* is not a valid URI.\n\n    As defined in RFC 2396.\n    ","endLoc":90,"header":"def check_anyuri(uri, config=None, pos=None)","id":6046,"name":"check_anyuri","nodeType":"Function","startLoc":80,"text":"def check_anyuri(uri, config=None, pos=None):\n    \"\"\"\n    Raises a `~astropy.io.votable.exceptions.VOTableSpecError` if\n    *uri* is not a valid URI.\n\n    As defined in RFC 2396.\n    \"\"\"\n    if (uri is not None and not xml_check.check_anyuri(uri)):\n        warn_or_raise(W05, W05, uri, config, pos)\n        return False\n    return True"},{"col":0,"comment":"\n    Returns `True` if *uri* is a valid URI as defined in RFC 2396.\n    ","endLoc":76,"header":"def check_anyuri(uri)","id":6047,"name":"check_anyuri","nodeType":"Function","startLoc":63,"text":"def check_anyuri(uri):\n    \"\"\"\n    Returns `True` if *uri* is a valid URI as defined in RFC 2396.\n    \"\"\"\n    if (re.match(\n        (r\"(([a-zA-Z][0-9a-zA-Z+\\-\\.]*:)?/{0,2}[0-9a-zA-Z;\" +\n         r\"/?:@&=+$\\.\\-_!~*'()%]+)?(#[0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?\"),\n        uri) is None):\n        return False\n    try:\n        urllib.parse.urlparse(uri)\n    except Exception:\n        return False\n    return True"},{"col":0,"comment":"\n    Validates the given file against the appropriate VOTable schema.\n\n    Parameters\n    ----------\n    filename : str\n        The path to the XML file to validate\n\n    version : str, optional\n        The VOTABLE version to check, which must be a string \"1.0\",\n        \"1.1\", \"1.2\" or \"1.3\".  If it is not one of these,\n        version \"1.1\" is assumed.\n\n        For version \"1.0\", it is checked against a DTD, since that\n        version did not have an XML Schema.\n\n    Returns\n    -------\n    returncode, stdout, stderr : int, str, str\n        Returns the returncode from xmllint and the stdout and stderr\n        as strings\n    ","endLoc":127,"header":"def validate_schema(filename, version='1.1')","id":6048,"name":"validate_schema","nodeType":"Function","startLoc":93,"text":"def validate_schema(filename, version='1.1'):\n    \"\"\"\n    Validates the given file against the appropriate VOTable schema.\n\n    Parameters\n    ----------\n    filename : str\n        The path to the XML file to validate\n\n    version : str, optional\n        The VOTABLE version to check, which must be a string \\\"1.0\\\",\n        \\\"1.1\\\", \\\"1.2\\\" or \\\"1.3\\\".  If it is not one of these,\n        version \\\"1.1\\\" is assumed.\n\n        For version \\\"1.0\\\", it is checked against a DTD, since that\n        version did not have an XML Schema.\n\n    Returns\n    -------\n    returncode, stdout, stderr : int, str, str\n        Returns the returncode from xmllint and the stdout and stderr\n        as strings\n    \"\"\"\n    if version not in ('1.0', '1.1', '1.2', '1.3'):\n        log.info(f'{filename} has version {version}, using schema 1.1')\n        version = '1.1'\n\n    if version in ('1.1', '1.2', '1.3'):\n        schema_path = data.get_pkg_data_filename(\n            f'data/VOTable.v{version}.xsd')\n    else:\n        schema_path = data.get_pkg_data_filename(\n            'data/VOTable.dtd')\n\n    return validate.validate_schema(filename, schema_path)"},{"col":0,"comment":"\n    Writes a `~astropy.io.votable.tree.VOTableFile` to a VOTABLE_ xml file.\n\n    Parameters\n    ----------\n    table : `~astropy.io.votable.tree.VOTableFile` or `~astropy.table.Table` instance.\n\n    file : str or writable file-like\n        Path or file object to write to\n\n    tabledata_format : str, optional\n        Override the format of the table(s) data to write.  Must be\n        one of ``tabledata`` (text representation), ``binary`` or\n        ``binary2``.  By default, use the format that was specified in\n        each ``table`` object as it was created or read in.  See\n        :ref:`astropy:astropy:votable-serialization`.\n    ","endLoc":209,"header":"def writeto(table, file, tabledata_format=None)","id":6049,"name":"writeto","nodeType":"Function","startLoc":183,"text":"def writeto(table, file, tabledata_format=None):\n    \"\"\"\n    Writes a `~astropy.io.votable.tree.VOTableFile` to a VOTABLE_ xml file.\n\n    Parameters\n    ----------\n    table : `~astropy.io.votable.tree.VOTableFile` or `~astropy.table.Table` instance.\n\n    file : str or writable file-like\n        Path or file object to write to\n\n    tabledata_format : str, optional\n        Override the format of the table(s) data to write.  Must be\n        one of ``tabledata`` (text representation), ``binary`` or\n        ``binary2``.  By default, use the format that was specified in\n        each ``table`` object as it was created or read in.  See\n        :ref:`astropy:astropy:votable-serialization`.\n    \"\"\"\n    from astropy.table import Table\n    if isinstance(table, Table):\n        table = tree.VOTableFile.from_table(table)\n    elif not isinstance(table, tree.VOTableFile):\n        raise TypeError(\n            \"first argument must be astropy.io.vo.VOTableFile or \"\n            \"astropy.table.Table instance\")\n    table.to_xml(file, tabledata_format=tabledata_format,\n                 _debug_python_based_parser=True)"},{"col":4,"comment":"null","endLoc":172,"header":"@staticmethod\n    def _write_length(length)","id":6050,"name":"_write_length","nodeType":"Function","startLoc":170,"text":"@staticmethod\n    def _write_length(length):\n        return struct_pack(\">I\", int(length))"},{"col":4,"comment":"\n        Returns True when the field can be completely empty.\n        ","endLoc":178,"header":"def supports_empty_values(self, config)","id":6051,"name":"supports_empty_values","nodeType":"Function","startLoc":174,"text":"def supports_empty_values(self, config):\n        \"\"\"\n        Returns True when the field can be completely empty.\n        \"\"\"\n        return config.get('version_1_3_or_later')"},{"col":4,"comment":"\n        Convert the string *value* from the TABLEDATA_ format into an\n        object with the correct native in-memory datatype and mask flag.\n\n        Parameters\n        ----------\n        value : str\n            value in TABLEDATA format\n\n        Returns\n        -------\n        native : tuple\n            A two-element tuple of: value, mask.\n            The value as a Numpy array or scalar, and *mask* is True\n            if the value is missing.\n        ","endLoc":198,"header":"def parse(self, value, config=None, pos=None)","id":6052,"name":"parse","nodeType":"Function","startLoc":180,"text":"def parse(self, value, config=None, pos=None):\n        \"\"\"\n        Convert the string *value* from the TABLEDATA_ format into an\n        object with the correct native in-memory datatype and mask flag.\n\n        Parameters\n        ----------\n        value : str\n            value in TABLEDATA format\n\n        Returns\n        -------\n        native : tuple\n            A two-element tuple of: value, mask.\n            The value as a Numpy array or scalar, and *mask* is True\n            if the value is missing.\n        \"\"\"\n        raise NotImplementedError(\n            \"This datatype must implement a 'parse' method.\")"},{"col":4,"comment":"\n        Parse a single scalar of the underlying type of the converter.\n        For non-array converters, this is equivalent to parse.  For\n        array converters, this is used to parse a single\n        element of the array.\n\n        Parameters\n        ----------\n        value : str\n            value in TABLEDATA format\n\n        Returns\n        -------\n        native : (2,) tuple\n            (value, mask)\n            The value as a Numpy array or scalar, and *mask* is True\n            if the value is missing.\n        ","endLoc":219,"header":"def parse_scalar(self, value, config=None, pos=None)","id":6053,"name":"parse_scalar","nodeType":"Function","startLoc":200,"text":"def parse_scalar(self, value, config=None, pos=None):\n        \"\"\"\n        Parse a single scalar of the underlying type of the converter.\n        For non-array converters, this is equivalent to parse.  For\n        array converters, this is used to parse a single\n        element of the array.\n\n        Parameters\n        ----------\n        value : str\n            value in TABLEDATA format\n\n        Returns\n        -------\n        native : (2,) tuple\n            (value, mask)\n            The value as a Numpy array or scalar, and *mask* is True\n            if the value is missing.\n        \"\"\"\n        return self.parse(value, config, pos)"},{"col":4,"comment":"\n        Create a `VOTableFile` instance from a given\n        `astropy.table.Table` instance.\n\n        Parameters\n        ----------\n        table_id : str, optional\n            Set the given ID attribute on the returned Table instance.\n        ","endLoc":3881,"header":"@classmethod\n    def from_table(cls, table, table_id=None)","id":6054,"name":"from_table","nodeType":"Function","startLoc":3863,"text":"@classmethod\n    def from_table(cls, table, table_id=None):\n        \"\"\"\n        Create a `VOTableFile` instance from a given\n        `astropy.table.Table` instance.\n\n        Parameters\n        ----------\n        table_id : str, optional\n            Set the given ID attribute on the returned Table instance.\n        \"\"\"\n        votable_file = cls()\n        resource = Resource()\n        votable = Table.from_table(votable_file, table)\n        if table_id is not None:\n            votable.ID = table_id\n        resource.tables.append(votable)\n        votable_file.resources.append(resource)\n        return votable_file"},{"className":"_NameProperty","col":0,"comment":"null","endLoc":317,"id":6055,"nodeType":"Class","startLoc":304,"text":"class _NameProperty:\n    @property\n    def name(self):\n        \"\"\"An optional name for the element.\"\"\"\n        return self._name\n\n    @name.setter\n    def name(self, name):\n        xmlutil.check_token(name, 'name', self._config, self._pos)\n        self._name = name\n\n    @name.deleter\n    def name(self):\n        self._name = None"},{"col":4,"comment":"An optional name for the element.","endLoc":308,"header":"@property\n    def name(self)","id":6056,"name":"name","nodeType":"Function","startLoc":305,"text":"@property\n    def name(self):\n        \"\"\"An optional name for the element.\"\"\"\n        return self._name"},{"col":4,"comment":"null","endLoc":313,"header":"@name.setter\n    def name(self, name)","id":6057,"name":"name","nodeType":"Function","startLoc":310,"text":"@name.setter\n    def name(self, name):\n        xmlutil.check_token(name, 'name', self._config, self._pos)\n        self._name = name"},{"col":4,"comment":"null","endLoc":317,"header":"@name.deleter\n    def name(self)","id":6058,"name":"name","nodeType":"Function","startLoc":315,"text":"@name.deleter\n    def name(self):\n        self._name = None"},{"attributeType":"null","col":8,"comment":"null","endLoc":313,"id":6059,"name":"_name","nodeType":"Attribute","startLoc":313,"text":"self._name"},{"attributeType":"null","col":30,"comment":"null","endLoc":41,"id":6061,"name":"_config","nodeType":"Attribute","startLoc":41,"text":"_config"},{"attributeType":"null","col":0,"comment":"null","endLoc":44,"id":6062,"name":"__all__","nodeType":"Attribute","startLoc":44,"text":"__all__"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":63,"id":6063,"name":"conf","nodeType":"Attribute","startLoc":63,"text":"conf"},{"className":"_XtypeProperty","col":0,"comment":"null","endLoc":337,"id":6064,"nodeType":"Class","startLoc":320,"text":"class _XtypeProperty:\n    @property\n    def xtype(self):\n        \"\"\"Extended data type information.\"\"\"\n        return self._xtype\n\n    @xtype.setter\n    def xtype(self, xtype):\n        if xtype is not None and not self._config.get('version_1_2_or_later'):\n            warn_or_raise(\n                W28, W28, ('xtype', self._element_name, '1.2'),\n                self._config, self._pos)\n        check_string(xtype, 'xtype', self._config, self._pos)\n        self._xtype = xtype\n\n    @xtype.deleter\n    def xtype(self):\n        self._xtype = None"},{"col":4,"comment":"Extended data type information.","endLoc":324,"header":"@property\n    def xtype(self)","id":6065,"name":"xtype","nodeType":"Function","startLoc":321,"text":"@property\n    def xtype(self):\n        \"\"\"Extended data type information.\"\"\"\n        return self._xtype"},{"col":4,"comment":"null","endLoc":333,"header":"@xtype.setter\n    def xtype(self, xtype)","id":6066,"name":"xtype","nodeType":"Function","startLoc":326,"text":"@xtype.setter\n    def xtype(self, xtype):\n        if xtype is not None and not self._config.get('version_1_2_or_later'):\n            warn_or_raise(\n                W28, W28, ('xtype', self._element_name, '1.2'),\n                self._config, self._pos)\n        check_string(xtype, 'xtype', self._config, self._pos)\n        self._xtype = xtype"},{"attributeType":"null","col":0,"comment":"null","endLoc":153,"id":6067,"name":"_warning_pat","nodeType":"Attribute","startLoc":153,"text":"_warning_pat"},{"attributeType":"null","col":4,"comment":"null","endLoc":1535,"id":6068,"name":"__doc__","nodeType":"Attribute","startLoc":1535,"text":"__doc__"},{"col":0,"comment":"\n    Raises a `~astropy.io.votable.exceptions.VOTableSpecError` if\n    *string* is not a string or Unicode string.\n\n    Parameters\n    ----------\n    string : str\n        An astronomical year string\n\n    attr_name : str\n        The name of the field this year was found in (used for error\n        message)\n\n    config, pos : optional\n        Information about the source of the value\n    ","endLoc":237,"header":"def check_string(string, attr_name, config=None, pos=None)","id":6069,"name":"check_string","nodeType":"Function","startLoc":217,"text":"def check_string(string, attr_name, config=None, pos=None):\n    \"\"\"\n    Raises a `~astropy.io.votable.exceptions.VOTableSpecError` if\n    *string* is not a string or Unicode string.\n\n    Parameters\n    ----------\n    string : str\n        An astronomical year string\n\n    attr_name : str\n        The name of the field this year was found in (used for error\n        message)\n\n    config, pos : optional\n        Information about the source of the value\n    \"\"\"\n    if string is not None and not isinstance(string, str):\n        warn_or_raise(W08, W08, attr_name, config, pos)\n        return False\n    return True"},{"col":4,"comment":"null","endLoc":337,"header":"@xtype.deleter\n    def xtype(self)","id":6070,"name":"xtype","nodeType":"Function","startLoc":335,"text":"@xtype.deleter\n    def xtype(self):\n        self._xtype = None"},{"attributeType":"None","col":8,"comment":"null","endLoc":333,"id":6071,"name":"_xtype","nodeType":"Attribute","startLoc":333,"text":"self._xtype"},{"attributeType":"null","col":25,"comment":"null","endLoc":1537,"id":6072,"name":"x","nodeType":"Attribute","startLoc":1537,"text":"x"},{"className":"_UtypeProperty","col":0,"comment":"null","endLoc":361,"id":6073,"nodeType":"Class","startLoc":340,"text":"class _UtypeProperty:\n    _utype_in_v1_2 = False\n\n    @property\n    def utype(self):\n        \"\"\"The usage-specific or `unique type`_ of the element.\"\"\"\n        return self._utype\n\n    @utype.setter\n    def utype(self, utype):\n        if (self._utype_in_v1_2 and\n            utype is not None and\n            not self._config.get('version_1_2_or_later')):\n            warn_or_raise(\n                W28, W28, ('utype', self._element_name, '1.2'),\n                self._config, self._pos)\n        check_string(utype, 'utype', self._config, self._pos)\n        self._utype = utype\n\n    @utype.deleter\n    def utype(self):\n        self._utype = None"},{"col":4,"comment":"The usage-specific or `unique type`_ of the element.","endLoc":346,"header":"@property\n    def utype(self)","id":6074,"name":"utype","nodeType":"Function","startLoc":343,"text":"@property\n    def utype(self):\n        \"\"\"The usage-specific or `unique type`_ of the element.\"\"\"\n        return self._utype"},{"col":4,"comment":"null","endLoc":357,"header":"@utype.setter\n    def utype(self, utype)","id":6075,"name":"utype","nodeType":"Function","startLoc":348,"text":"@utype.setter\n    def utype(self, utype):\n        if (self._utype_in_v1_2 and\n            utype is not None and\n            not self._config.get('version_1_2_or_later')):\n            warn_or_raise(\n                W28, W28, ('utype', self._element_name, '1.2'),\n                self._config, self._pos)\n        check_string(utype, 'utype', self._config, self._pos)\n        self._utype = utype"},{"col":4,"comment":"\n        Convert the object *value* (in the native in-memory datatype)\n        to a unicode string suitable for serializing in the TABLEDATA_\n        format.\n\n        Parameters\n        ----------\n        value\n            The value, the native type corresponding to this converter\n\n        mask : bool\n            If `True`, will return the string representation of a\n            masked value.\n\n        Returns\n        -------\n        tabledata_repr : unicode\n        ","endLoc":241,"header":"def output(self, value, mask)","id":6076,"name":"output","nodeType":"Function","startLoc":221,"text":"def output(self, value, mask):\n        \"\"\"\n        Convert the object *value* (in the native in-memory datatype)\n        to a unicode string suitable for serializing in the TABLEDATA_\n        format.\n\n        Parameters\n        ----------\n        value\n            The value, the native type corresponding to this converter\n\n        mask : bool\n            If `True`, will return the string representation of a\n            masked value.\n\n        Returns\n        -------\n        tabledata_repr : unicode\n        \"\"\"\n        raise NotImplementedError(\n            \"This datatype must implement a 'output' method.\")"},{"attributeType":"null","col":25,"comment":"null","endLoc":1538,"id":6077,"name":"x","nodeType":"Attribute","startLoc":1538,"text":"x"},{"col":4,"comment":"\n        Reads some number of bytes from the BINARY_ format\n        representation by calling the function *read*, and returns the\n        native in-memory object representation for the datatype\n        handled by *self*.\n\n        Parameters\n        ----------\n        read : function\n            A function that given a number of bytes, returns a byte\n            string.\n\n        Returns\n        -------\n        native : (2,) tuple\n            (value, mask). The value as a Numpy array or scalar, and *mask* is\n            True if the value is missing.\n        ","endLoc":263,"header":"def binparse(self, read)","id":6078,"name":"binparse","nodeType":"Function","startLoc":243,"text":"def binparse(self, read):\n        \"\"\"\n        Reads some number of bytes from the BINARY_ format\n        representation by calling the function *read*, and returns the\n        native in-memory object representation for the datatype\n        handled by *self*.\n\n        Parameters\n        ----------\n        read : function\n            A function that given a number of bytes, returns a byte\n            string.\n\n        Returns\n        -------\n        native : (2,) tuple\n            (value, mask). The value as a Numpy array or scalar, and *mask* is\n            True if the value is missing.\n        \"\"\"\n        raise NotImplementedError(\n            \"This datatype must implement a 'binparse' method.\")"},{"col":4,"comment":"\n        Convert the object *value* in the native in-memory datatype to\n        a string of bytes suitable for serialization in the BINARY_\n        format.\n\n        Parameters\n        ----------\n        value\n            The value, the native type corresponding to this converter\n\n        mask : bool\n            If `True`, will return the string representation of a\n            masked value.\n\n        Returns\n        -------\n        bytes : bytes\n            The binary representation of the value, suitable for\n            serialization in the BINARY_ format.\n        ","endLoc":287,"header":"def binoutput(self, value, mask)","id":6079,"name":"binoutput","nodeType":"Function","startLoc":265,"text":"def binoutput(self, value, mask):\n        \"\"\"\n        Convert the object *value* in the native in-memory datatype to\n        a string of bytes suitable for serialization in the BINARY_\n        format.\n\n        Parameters\n        ----------\n        value\n            The value, the native type corresponding to this converter\n\n        mask : bool\n            If `True`, will return the string representation of a\n            masked value.\n\n        Returns\n        -------\n        bytes : bytes\n            The binary representation of the value, suitable for\n            serialization in the BINARY_ format.\n        \"\"\"\n        raise NotImplementedError(\n            \"This datatype must implement a 'binoutput' method.\")"},{"className":"Char","col":0,"comment":"\n    Handles the char datatype. (7-bit unsigned characters)\n\n    Missing values are not handled for string or unicode types.\n    ","endLoc":393,"id":6080,"nodeType":"Class","startLoc":290,"text":"class Char(Converter):\n    \"\"\"\n    Handles the char datatype. (7-bit unsigned characters)\n\n    Missing values are not handled for string or unicode types.\n    \"\"\"\n    default = _empty_bytes\n\n    def __init__(self, field, config=None, pos=None):\n        if config is None:\n            config = {}\n\n        Converter.__init__(self, field, config, pos)\n\n        self.field_name = field.name\n\n        if field.arraysize is None:\n            vo_warn(W47, (), config, pos)\n            field.arraysize = '1'\n\n        if field.arraysize == '*':\n            self.format = 'O'\n            self.binparse = self._binparse_var\n            self.binoutput = self._binoutput_var\n            self.arraysize = '*'\n        else:\n            if field.arraysize.endswith('*'):\n                field.arraysize = field.arraysize[:-1]\n            try:\n                self.arraysize = int(field.arraysize)\n            except ValueError:\n                vo_raise(E01, (field.arraysize, 'char', field.ID), config)\n            self.format = f'U{self.arraysize:d}'\n            self.binparse = self._binparse_fixed\n            self.binoutput = self._binoutput_fixed\n            self._struct_format = f\">{self.arraysize:d}s\"\n\n    def supports_empty_values(self, config):\n        return True\n\n    def parse(self, value, config=None, pos=None):\n        if self.arraysize != '*' and len(value) > self.arraysize:\n            vo_warn(W46, ('char', self.arraysize), config, pos)\n\n        # Warn about non-ascii characters if warnings are enabled.\n        try:\n            value.encode('ascii')\n        except UnicodeEncodeError:\n            vo_warn(W55, (self.field_name, value), config, pos)\n        return value, False\n\n    def output(self, value, mask):\n        if mask:\n            return ''\n\n        # The output methods for Char assume that value is either str or bytes.\n        # This method needs to return a str, but needs to warn if the str contains\n        # non-ASCII characters.\n        try:\n            if isinstance(value, str):\n                value.encode('ascii')\n            else:\n                # Check for non-ASCII chars in the bytes object.\n                value = value.decode('ascii')\n        except (ValueError, UnicodeEncodeError):\n            warn_or_raise(E24, UnicodeEncodeError, (value, self.field_name))\n        finally:\n            if isinstance(value, bytes):\n                # Convert the bytes to str regardless of non-ASCII chars.\n                value = value.decode('utf-8')\n\n        return xml_escape_cdata(value)\n\n    def _binparse_var(self, read):\n        length = self._parse_length(read)\n        return read(length).decode('ascii'), False\n\n    def _binparse_fixed(self, read):\n        s = struct_unpack(self._struct_format, read(self.arraysize))[0]\n        end = s.find(_zero_byte)\n        s = s.decode('ascii')\n        if end != -1:\n            return s[:end], False\n        return s, False\n\n    def _binoutput_var(self, value, mask):\n        if mask or value is None or value == '':\n            return _zero_int\n        if isinstance(value, str):\n            try:\n                value = value.encode('ascii')\n            except ValueError:\n                vo_raise(E24, (value, self.field_name))\n        return self._write_length(len(value)) + value\n\n    def _binoutput_fixed(self, value, mask):\n        if mask:\n            value = _empty_bytes\n        elif isinstance(value, str):\n            try:\n                value = value.encode('ascii')\n            except ValueError:\n                vo_raise(E24, (value, self.field_name))\n        return struct_pack(self._struct_format, value)"},{"col":4,"comment":"null","endLoc":36,"header":"def __new__(cls, obj, *args, **kwargs)","id":6081,"name":"__new__","nodeType":"Function","startLoc":32,"text":"def __new__(cls, obj, *args, **kwargs):\n        self = np.array(obj, *args, **kwargs).view(cls)\n        if 'info' in getattr(obj, '__dict__', ()):\n            self.info = obj.info\n        return self"},{"col":0,"comment":"","endLoc":32,"header":"exceptions.py#<anonymous>","id":6082,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\n.. _warnings:\n\nWarnings\n--------\n\n.. note::\n    Most of the following warnings indicate violations of the VOTable\n    specification.  They should be reported to the authors of the\n    tools that produced the VOTable file.\n\n    To control the warnings emitted, use the standard Python\n    :mod:`warnings` module and the ``astropy.io.votable.exceptions.conf.max_warnings``\n    configuration item.  Most of these are of the type `VOTableSpecWarning`.\n\n{warnings}\n\n.. _exceptions:\n\nExceptions\n----------\n\n.. note::\n\n    This is a list of many of the fatal exceptions emitted by ``astropy.io.votable``\n    when the file does not conform to spec.  Other exceptions may be\n    raised due to unforeseen cases or bugs in ``astropy.io.votable`` itself.\n\n{exceptions}\n\"\"\"\n\n__all__ = [\n    'Conf', 'conf', 'warn_or_raise', 'vo_raise', 'vo_reraise', 'vo_warn',\n    'warn_unknown_attrs', 'parse_vowarning', 'VOWarning',\n    'VOTableChangeWarning', 'VOTableSpecWarning',\n    'UnimplementedWarning', 'IOWarning', 'VOTableSpecError']\n\nconf = Conf()\n\n_warning_pat = re.compile(\n    r\":?(?P<nline>[0-9?]+):(?P<nchar>[0-9?]+): \" +\n    r\"((?P<warning>[WE]\\d+): )?(?P<rest>.*)$\")\n\nif __doc__ is not None:\n    __doc__ = __doc__.format(**_build_doc_string())\n\n__all__.extend([x[0] for x in _get_warning_and_exception_classes('W')])\n\n__all__.extend([x[0] for x in _get_warning_and_exception_classes('E')])"},{"col":4,"comment":"null","endLoc":325,"header":"def __init__(self, field, config=None, pos=None)","id":6083,"name":"__init__","nodeType":"Function","startLoc":298,"text":"def __init__(self, field, config=None, pos=None):\n        if config is None:\n            config = {}\n\n        Converter.__init__(self, field, config, pos)\n\n        self.field_name = field.name\n\n        if field.arraysize is None:\n            vo_warn(W47, (), config, pos)\n            field.arraysize = '1'\n\n        if field.arraysize == '*':\n            self.format = 'O'\n            self.binparse = self._binparse_var\n            self.binoutput = self._binoutput_var\n            self.arraysize = '*'\n        else:\n            if field.arraysize.endswith('*'):\n                field.arraysize = field.arraysize[:-1]\n            try:\n                self.arraysize = int(field.arraysize)\n            except ValueError:\n                vo_raise(E01, (field.arraysize, 'char', field.ID), config)\n            self.format = f'U{self.arraysize:d}'\n            self.binparse = self._binparse_fixed\n            self.binoutput = self._binoutput_fixed\n            self._struct_format = f\">{self.arraysize:d}s\""},{"col":4,"comment":"null","endLoc":361,"header":"@utype.deleter\n    def utype(self)","id":6084,"name":"utype","nodeType":"Function","startLoc":359,"text":"@utype.deleter\n    def utype(self):\n        self._utype = None"},{"attributeType":"null","col":4,"comment":"null","endLoc":341,"id":6085,"name":"_utype_in_v1_2","nodeType":"Attribute","startLoc":341,"text":"_utype_in_v1_2"},{"attributeType":"None","col":8,"comment":"null","endLoc":357,"id":6086,"name":"_utype","nodeType":"Attribute","startLoc":357,"text":"self._utype"},{"fileName":"__init__.py","filePath":"astropy/io/votable","id":6087,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis package reads and writes data formats used by the Virtual\nObservatory (VO) initiative, particularly the VOTable XML format.\n\"\"\"\n\n\nfrom .table import (\n    parse, parse_single_table, validate, from_table, is_votable, writeto)\nfrom .exceptions import (\n    VOWarning, VOTableChangeWarning, VOTableSpecWarning, UnimplementedWarning,\n    IOWarning, VOTableSpecError)\nfrom astropy import config as _config\n\n__all__ = [\n    'Conf', 'conf', 'parse', 'parse_single_table', 'validate',\n    'from_table', 'is_votable', 'writeto', 'VOWarning',\n    'VOTableChangeWarning', 'VOTableSpecWarning',\n    'UnimplementedWarning', 'IOWarning', 'VOTableSpecError']\n\n\nclass Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.io.votable`.\n    \"\"\"\n\n    verify = _config.ConfigItem(\n        'ignore',\n        \"Can be 'exception' (treat fixable violations of the VOTable spec as \"\n        \"exceptions), 'warn' (show warnings for VOTable spec violations), or \"\n        \"'ignore' (silently ignore VOTable spec violations)\",\n        aliases=['astropy.io.votable.table.pedantic',\n                 'astropy.io.votable.pedantic'])\n\n\nconf = Conf()\n"},{"col":4,"comment":"null","endLoc":3132,"header":"def __init__(self, name=None, ID=None, utype=None, type='results',\n                 id=None, config=None, pos=None, **kwargs)","id":6088,"name":"__init__","nodeType":"Function","startLoc":3108,"text":"def __init__(self, name=None, ID=None, utype=None, type='results',\n                 id=None, config=None, pos=None, **kwargs):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        Element.__init__(self)\n        self.name = name\n        self.ID = resolve_id(ID, id, config, pos)\n        self.utype = utype\n        self.type = type\n        self._extra_attributes = kwargs\n        self.description = None\n\n        self._coordinate_systems = HomogeneousList(CooSys)\n        self._time_systems = HomogeneousList(TimeSys)\n        self._groups = HomogeneousList(Group)\n        self._params = HomogeneousList(Param)\n        self._infos = HomogeneousList(Info)\n        self._links = HomogeneousList(Link)\n        self._tables = HomogeneousList(Table)\n        self._resources = HomogeneousList(Resource)\n\n        warn_unknown_attrs('RESOURCE', kwargs.keys(), config, pos)"},{"col":0,"comment":"\n    Prints a validation report for the given file.\n\n    Parameters\n    ----------\n    source : path-like or file-like\n        Path to a VOTABLE_ xml file or `~pathlib.Path`\n        object having Path to a VOTABLE_ xml file.\n        If file-like object, must be readable.\n\n    output : file-like, optional\n        Where to output the report.  Defaults to ``sys.stdout``.\n        If `None`, the output will be returned as a string.\n        Must be writable.\n\n    xmllint : bool, optional\n        When `True`, also send the file to ``xmllint`` for schema and\n        DTD validation.  Requires that ``xmllint`` is installed.  The\n        default is `False`.  ``source`` must be a file on the local\n        filesystem in order for ``xmllint`` to work.\n\n    filename : str, optional\n        A filename to use in the error messages.  If not provided, one\n        will be automatically determined from ``source``.\n\n    Returns\n    -------\n    is_valid : bool or str\n        Returns `True` if no warnings were found.  If ``output`` is\n        `None`, the return value will be a string.\n    ","endLoc":336,"header":"def validate(source, output=sys.stdout, xmllint=False, filename=None)","id":6089,"name":"validate","nodeType":"Function","startLoc":212,"text":"def validate(source, output=sys.stdout, xmllint=False, filename=None):\n    \"\"\"\n    Prints a validation report for the given file.\n\n    Parameters\n    ----------\n    source : path-like or file-like\n        Path to a VOTABLE_ xml file or `~pathlib.Path`\n        object having Path to a VOTABLE_ xml file.\n        If file-like object, must be readable.\n\n    output : file-like, optional\n        Where to output the report.  Defaults to ``sys.stdout``.\n        If `None`, the output will be returned as a string.\n        Must be writable.\n\n    xmllint : bool, optional\n        When `True`, also send the file to ``xmllint`` for schema and\n        DTD validation.  Requires that ``xmllint`` is installed.  The\n        default is `False`.  ``source`` must be a file on the local\n        filesystem in order for ``xmllint`` to work.\n\n    filename : str, optional\n        A filename to use in the error messages.  If not provided, one\n        will be automatically determined from ``source``.\n\n    Returns\n    -------\n    is_valid : bool or str\n        Returns `True` if no warnings were found.  If ``output`` is\n        `None`, the return value will be a string.\n    \"\"\"\n\n    from astropy.utils.console import print_code_line, color_print\n\n    return_as_str = False\n    if output is None:\n        output = io.StringIO()\n        return_as_str = True\n\n    lines = []\n    votable = None\n\n    reset_vo_warnings()\n\n    with data.get_readable_fileobj(source, encoding='binary') as fd:\n        content = fd.read()\n    content_buffer = io.BytesIO(content)\n    content_buffer.seek(0)\n\n    if filename is None:\n        if isinstance(source, str):\n            filename = source\n        elif hasattr(source, 'name'):\n            filename = source.name\n        elif hasattr(source, 'url'):\n            filename = source.url\n        else:\n            filename = \"<unknown>\"\n\n    with warnings.catch_warnings(record=True) as warning_lines:\n        warnings.resetwarnings()\n        warnings.simplefilter(\"always\", exceptions.VOWarning, append=True)\n        try:\n            votable = parse(content_buffer, verify='warn', filename=filename)\n        except ValueError as e:\n            lines.append(str(e))\n\n    lines = [str(x.message) for x in warning_lines if\n             issubclass(x.category, exceptions.VOWarning)] + lines\n\n    content_buffer.seek(0)\n    output.write(f\"Validation report for {filename}\\n\\n\")\n\n    if len(lines):\n        xml_lines = iterparser.xml_readlines(content_buffer)\n\n        for warning in lines:\n            w = exceptions.parse_vowarning(warning)\n\n            if not w['is_something']:\n                output.write(w['message'])\n                output.write('\\n\\n')\n            else:\n                line = xml_lines[w['nline'] - 1]\n                warning = w['warning']\n                if w['is_warning']:\n                    color = 'yellow'\n                else:\n                    color = 'red'\n                color_print(\n                    f\"{w['nline']:d}: \", '',\n                    warning or 'EXC', color,\n                    ': ', '',\n                    textwrap.fill(\n                        w['message'],\n                        initial_indent='          ',\n                        subsequent_indent='  ').lstrip(),\n                    file=output)\n                print_code_line(line, w['nchar'], file=output)\n            output.write('\\n')\n    else:\n        output.write('astropy.io.votable found no violations.\\n\\n')\n\n    success = 0\n    if xmllint and os.path.exists(filename):\n        from . import xmlutil\n\n        if votable is None:\n            version = \"1.1\"\n        else:\n            version = votable.version\n        success, stdout, stderr = xmlutil.validate_schema(\n            filename, version)\n\n        if success != 0:\n            output.write(\n                'xmllint schema violations:\\n\\n')\n            output.write(stderr.decode('utf-8'))\n        else:\n            output.write('xmllint passed\\n')\n\n    if return_as_str:\n        return output.getvalue()\n    return len(lines) == 0 and success == 0"},{"col":0,"comment":"\n    Resets all of the vo warning state so that warnings that\n    have already been emitted will be emitted again. This is\n    used, for example, by `validate` which must emit all\n    warnings each time it is called.\n\n    ","endLoc":412,"header":"def reset_vo_warnings()","id":6090,"name":"reset_vo_warnings","nodeType":"Function","startLoc":392,"text":"def reset_vo_warnings():\n    \"\"\"\n    Resets all of the vo warning state so that warnings that\n    have already been emitted will be emitted again. This is\n    used, for example, by `validate` which must emit all\n    warnings each time it is called.\n\n    \"\"\"\n    from . import converters, xmlutil\n\n    # -----------------------------------------------------------#\n    #  This is a special variable used by the Python warnings    #\n    #  infrastructure to keep track of warnings that have        #\n    #  already been seen.  Since we want to get every single     #\n    #  warning out of this, we have to delete all of them first. #\n    # -----------------------------------------------------------#\n    for module in (converters, exceptions, tree, xmlutil):\n        try:\n            del module.__warningregistry__\n        except AttributeError:\n            pass"},{"className":"_UcdProperty","col":0,"comment":"null","endLoc":387,"id":6091,"nodeType":"Class","startLoc":364,"text":"class _UcdProperty:\n    _ucd_in_v1_2 = False\n\n    @property\n    def ucd(self):\n        \"\"\"The `unified content descriptor`_ for the element.\"\"\"\n        return self._ucd\n\n    @ucd.setter\n    def ucd(self, ucd):\n        if ucd is not None and ucd.strip() == '':\n            ucd = None\n        if ucd is not None:\n            if (self._ucd_in_v1_2 and\n                not self._config.get('version_1_2_or_later')):\n                warn_or_raise(\n                    W28, W28, ('ucd', self._element_name, '1.2'),\n                    self._config, self._pos)\n            check_ucd(ucd, self._config, self._pos)\n        self._ucd = ucd\n\n    @ucd.deleter\n    def ucd(self):\n        self._ucd = None"},{"col":4,"comment":"The `unified content descriptor`_ for the element.","endLoc":370,"header":"@property\n    def ucd(self)","id":6092,"name":"ucd","nodeType":"Function","startLoc":367,"text":"@property\n    def ucd(self):\n        \"\"\"The `unified content descriptor`_ for the element.\"\"\"\n        return self._ucd"},{"col":4,"comment":"null","endLoc":383,"header":"@ucd.setter\n    def ucd(self, ucd)","id":6093,"name":"ucd","nodeType":"Function","startLoc":372,"text":"@ucd.setter\n    def ucd(self, ucd):\n        if ucd is not None and ucd.strip() == '':\n            ucd = None\n        if ucd is not None:\n            if (self._ucd_in_v1_2 and\n                not self._config.get('version_1_2_or_later')):\n                warn_or_raise(\n                    W28, W28, ('ucd', self._element_name, '1.2'),\n                    self._config, self._pos)\n            check_ucd(ucd, self._config, self._pos)\n        self._ucd = ucd"},{"col":0,"comment":"\n    Validates an XML file against a schema or DTD.\n\n    Parameters\n    ----------\n    filename : str\n        The path to the XML file to validate\n\n    schema_file : str\n        The path to the XML schema or DTD\n\n    Returns\n    -------\n    returncode, stdout, stderr : int, str, str\n        Returns the returncode from xmllint and the stdout and stderr\n        as strings\n    ","endLoc":56,"header":"def validate_schema(filename, schema_file)","id":6094,"name":"validate_schema","nodeType":"Function","startLoc":15,"text":"def validate_schema(filename, schema_file):\n    \"\"\"\n    Validates an XML file against a schema or DTD.\n\n    Parameters\n    ----------\n    filename : str\n        The path to the XML file to validate\n\n    schema_file : str\n        The path to the XML schema or DTD\n\n    Returns\n    -------\n    returncode, stdout, stderr : int, str, str\n        Returns the returncode from xmllint and the stdout and stderr\n        as strings\n    \"\"\"\n\n    base, ext = os.path.splitext(schema_file)\n    if ext == '.xsd':\n        schema_part = '--schema ' + schema_file\n    elif ext == '.dtd':\n        schema_part = '--dtdvalid ' + schema_file\n    else:\n        raise TypeError(\"schema_file must be a path to an XML Schema or DTD\")\n\n    p = subprocess.Popen(\n        f\"xmllint --noout --nonet {schema_part} {filename}\",\n        shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n    stdout, stderr = p.communicate()\n\n    if p.returncode == 127:\n        raise OSError(\n            \"xmllint not found, so can not validate schema\")\n    elif p.returncode < 0:\n        from astropy.utils.misc import signal_number_to_name\n        raise OSError(\n            \"xmllint was terminated by signal '{}'\".format(\n                signal_number_to_name(-p.returncode)))\n\n    return p.returncode, stdout, stderr"},{"fileName":"volint.py","filePath":"astropy/io/votable","id":6095,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nScript support for validating a VO file.\n\"\"\"\n\n\ndef main(args=None):\n    from . import table\n    import argparse\n\n    parser = argparse.ArgumentParser(\n        description=(\"Check a VOTable file for compliance to the \"\n                     \"VOTable specification\"))\n    parser.add_argument(\n        'filename', nargs=1, help='Path to VOTable file to check')\n    args = parser.parse_args(args)\n\n    table.validate(args.filename[0])\n"},{"col":0,"comment":"null","endLoc":18,"header":"def main(args=None)","id":6096,"name":"main","nodeType":"Function","startLoc":7,"text":"def main(args=None):\n    from . import table\n    import argparse\n\n    parser = argparse.ArgumentParser(\n        description=(\"Check a VOTable file for compliance to the \"\n                     \"VOTable specification\"))\n    parser.add_argument(\n        'filename', nargs=1, help='Path to VOTable file to check')\n    args = parser.parse_args(args)\n\n    table.validate(args.filename[0])"},{"col":0,"comment":"\n    Warns or raises a\n    `~astropy.io.votable.exceptions.VOTableSpecError` if *ucd* is not\n    a valid `unified content descriptor`_ string as defined by the\n    VOTABLE standard.\n\n    Parameters\n    ----------\n    ucd : str\n        A UCD string.\n\n    config, pos : optional\n        Information about the source of the value\n    ","endLoc":280,"header":"def check_ucd(ucd, config=None, pos=None)","id":6097,"name":"check_ucd","nodeType":"Function","startLoc":247,"text":"def check_ucd(ucd, config=None, pos=None):\n    \"\"\"\n    Warns or raises a\n    `~astropy.io.votable.exceptions.VOTableSpecError` if *ucd* is not\n    a valid `unified content descriptor`_ string as defined by the\n    VOTABLE standard.\n\n    Parameters\n    ----------\n    ucd : str\n        A UCD string.\n\n    config, pos : optional\n        Information about the source of the value\n    \"\"\"\n    if config is None:\n        config = {}\n    if config.get('version_1_1_or_later'):\n        try:\n            ucd_mod.parse_ucd(\n                ucd,\n                check_controlled_vocabulary=config.get(\n                    'version_1_2_or_later', False),\n                has_colon=config.get('version_1_2_or_later', False))\n        except ValueError as e:\n            # This weird construction is for Python 3 compatibility\n            if config.get('verify', 'ignore') == 'exception':\n                vo_raise(W06, (ucd, str(e)), config, pos)\n            elif config.get('verify', 'ignore') == 'warn':\n                vo_warn(W06, (ucd, str(e)), config, pos)\n                return False\n            else:\n                return False\n    return True"},{"col":4,"comment":"null","endLoc":328,"header":"def supports_empty_values(self, config)","id":6098,"name":"supports_empty_values","nodeType":"Function","startLoc":327,"text":"def supports_empty_values(self, config):\n        return True"},{"col":4,"comment":"null","endLoc":339,"header":"def parse(self, value, config=None, pos=None)","id":6099,"name":"parse","nodeType":"Function","startLoc":330,"text":"def parse(self, value, config=None, pos=None):\n        if self.arraysize != '*' and len(value) > self.arraysize:\n            vo_warn(W46, ('char', self.arraysize), config, pos)\n\n        # Warn about non-ascii characters if warnings are enabled.\n        try:\n            value.encode('ascii')\n        except UnicodeEncodeError:\n            vo_warn(W55, (self.field_name, value), config, pos)\n        return value, False"},{"col":0,"comment":"","endLoc":4,"header":"volint.py#<anonymous>","id":6100,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nScript support for validating a VO file.\n\"\"\""},{"col":4,"comment":"null","endLoc":387,"header":"@ucd.deleter\n    def ucd(self)","id":6101,"name":"ucd","nodeType":"Function","startLoc":385,"text":"@ucd.deleter\n    def ucd(self):\n        self._ucd = None"},{"attributeType":"null","col":4,"comment":"null","endLoc":365,"id":6102,"name":"_ucd_in_v1_2","nodeType":"Attribute","startLoc":365,"text":"_ucd_in_v1_2"},{"attributeType":"None","col":8,"comment":"null","endLoc":383,"id":6103,"name":"_ucd","nodeType":"Attribute","startLoc":383,"text":"self._ucd"},{"className":"_DescriptionProperty","col":0,"comment":"null","endLoc":405,"id":6104,"nodeType":"Class","startLoc":390,"text":"class _DescriptionProperty:\n    @property\n    def description(self):\n        \"\"\"\n        An optional string describing the element.  Corresponds to the\n        DESCRIPTION_ element.\n        \"\"\"\n        return self._description\n\n    @description.setter\n    def description(self, description):\n        self._description = description\n\n    @description.deleter\n    def description(self):\n        self._description = None"},{"col":4,"comment":"\n        An optional string describing the element.  Corresponds to the\n        DESCRIPTION_ element.\n        ","endLoc":397,"header":"@property\n    def description(self)","id":6105,"name":"description","nodeType":"Function","startLoc":391,"text":"@property\n    def description(self):\n        \"\"\"\n        An optional string describing the element.  Corresponds to the\n        DESCRIPTION_ element.\n        \"\"\"\n        return self._description"},{"col":4,"comment":"null","endLoc":401,"header":"@description.setter\n    def description(self, description)","id":6106,"name":"description","nodeType":"Function","startLoc":399,"text":"@description.setter\n    def description(self, description):\n        self._description = description"},{"col":4,"comment":"null","endLoc":405,"header":"@description.deleter\n    def description(self)","id":6107,"name":"description","nodeType":"Function","startLoc":403,"text":"@description.deleter\n    def description(self):\n        self._description = None"},{"attributeType":"null","col":8,"comment":"null","endLoc":401,"id":6108,"name":"_description","nodeType":"Attribute","startLoc":401,"text":"self._description"},{"fileName":"connect.py","filePath":"astropy/io/votable","id":6109,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport os\n\n\nfrom . import parse, from_table\nfrom .tree import VOTableFile, Table as VOTable\nfrom astropy.io import registry as io_registry\nfrom astropy.table import Table\nfrom astropy.table.column import BaseColumn\nfrom astropy.units import Quantity\nfrom astropy.utils.misc import NOT_OVERWRITING_MSG\n\n\ndef is_votable(origin, filepath, fileobj, *args, **kwargs):\n    \"\"\"\n    Reads the header of a file to determine if it is a VOTable file.\n\n    Parameters\n    ----------\n    origin : str or readable file-like\n        Path or file object containing a VOTABLE_ xml file.\n\n    Returns\n    -------\n    is_votable : bool\n        Returns `True` if the given file is a VOTable file.\n    \"\"\"\n    from . import is_votable\n    if origin == 'read':\n        if fileobj is not None:\n            try:\n                result = is_votable(fileobj)\n            finally:\n                fileobj.seek(0)\n            return result\n        elif filepath is not None:\n            return is_votable(filepath)\n        elif isinstance(args[0], (VOTableFile, VOTable)):\n            return True\n        else:\n            return False\n    else:\n        return False\n\n\ndef read_table_votable(input, table_id=None, use_names_over_ids=False,\n                       verify=None, **kwargs):\n    \"\"\"\n    Read a Table object from an VO table file\n\n    Parameters\n    ----------\n    input : str or `~astropy.io.votable.tree.VOTableFile` or `~astropy.io.votable.tree.Table`\n        If a string, the filename to read the table from. If a\n        :class:`~astropy.io.votable.tree.VOTableFile` or\n        :class:`~astropy.io.votable.tree.Table` object, the object to extract\n        the table from.\n\n    table_id : str or int, optional\n        The table to read in.  If a `str`, it is an ID corresponding\n        to the ID of the table in the file (not all VOTable files\n        assign IDs to their tables).  If an `int`, it is the index of\n        the table in the file, starting at 0.\n\n    use_names_over_ids : bool, optional\n        When `True` use the ``name`` attributes of columns as the names\n        of columns in the `~astropy.table.Table` instance.  Since names\n        are not guaranteed to be unique, this may cause some columns\n        to be renamed by appending numbers to the end.  Otherwise\n        (default), use the ID attributes as the column names.\n\n    verify : {'ignore', 'warn', 'exception'}, optional\n        When ``'exception'``, raise an error when the file violates the spec,\n        otherwise either issue a warning (``'warn'``) or silently continue\n        (``'ignore'``). Warnings may be controlled using the standard Python\n        mechanisms.  See the `warnings` module in the Python standard library\n        for more information. When not provided, uses the configuration setting\n        ``astropy.io.votable.verify``, which defaults to ``'ignore'``.\n\n    **kwargs\n        Additional keyword arguments are passed on to\n        :func:`astropy.io.votable.table.parse`.\n    \"\"\"\n    if not isinstance(input, (VOTableFile, VOTable)):\n        input = parse(input, table_id=table_id, verify=verify, **kwargs)\n\n    # Parse all table objects\n    table_id_mapping = dict()\n    tables = []\n    if isinstance(input, VOTableFile):\n        for table in input.iter_tables():\n            if table.ID is not None:\n                table_id_mapping[table.ID] = table\n            tables.append(table)\n\n        if len(tables) > 1:\n            if table_id is None:\n                raise ValueError(\n                    \"Multiple tables found: table id should be set via \"\n                    \"the table_id= argument. The available tables are {}, \"\n                    'or integers less than {}.'.format(\n                        ', '.join(table_id_mapping.keys()), len(tables)))\n            elif isinstance(table_id, str):\n                if table_id in table_id_mapping:\n                    table = table_id_mapping[table_id]\n                else:\n                    raise ValueError(\n                        f\"No tables with id={table_id} found\")\n            elif isinstance(table_id, int):\n                if table_id < len(tables):\n                    table = tables[table_id]\n                else:\n                    raise IndexError(\n                        \"Table index {} is out of range. \"\n                        \"{} tables found\".format(\n                            table_id, len(tables)))\n        elif len(tables) == 1:\n            table = tables[0]\n        else:\n            raise ValueError(\"No table found\")\n    elif isinstance(input, VOTable):\n        table = input\n\n    # Convert to an astropy.table.Table object\n    return table.to_table(use_names_over_ids=use_names_over_ids)\n\n\ndef write_table_votable(input, output, table_id=None, overwrite=False,\n                        tabledata_format=None):\n    \"\"\"\n    Write a Table object to an VO table file\n\n    Parameters\n    ----------\n    input : Table\n        The table to write out.\n\n    output : str\n        The filename to write the table to.\n\n    table_id : str, optional\n        The table ID to use. If this is not specified, the 'ID' keyword in the\n        ``meta`` object of the table will be used.\n\n    overwrite : bool, optional\n        Whether to overwrite any existing file without warning.\n\n    tabledata_format : str, optional\n        The format of table data to write.  Must be one of ``tabledata``\n        (text representation), ``binary`` or ``binary2``.  Default is\n        ``tabledata``.  See :ref:`astropy:votable-serialization`.\n    \"\"\"\n\n    # Only those columns which are instances of BaseColumn or Quantity can be written\n    unsupported_cols = input.columns.not_isinstance((BaseColumn, Quantity))\n    if unsupported_cols:\n        unsupported_names = [col.info.name for col in unsupported_cols]\n        raise ValueError('cannot write table with mixin column(s) {} to VOTable'\n                         .format(unsupported_names))\n\n    # Check if output file already exists\n    if isinstance(output, str) and os.path.exists(output):\n        if overwrite:\n            os.remove(output)\n        else:\n            raise OSError(NOT_OVERWRITING_MSG.format(output))\n\n    # Create a new VOTable file\n    table_file = from_table(input, table_id=table_id)\n\n    # Write out file\n    table_file.to_xml(output, tabledata_format=tabledata_format)\n\n\nio_registry.register_reader('votable', Table, read_table_votable)\nio_registry.register_writer('votable', Table, write_table_votable)\nio_registry.register_identifier('votable', Table, is_votable)\n"},{"col":0,"comment":"\n    Given an OS signal number, returns a signal name.  If the signal\n    number is unknown, returns ``'UNKNOWN'``.\n    ","endLoc":299,"header":"def signal_number_to_name(signum)","id":6110,"name":"signal_number_to_name","nodeType":"Function","startLoc":288,"text":"def signal_number_to_name(signum):\n    \"\"\"\n    Given an OS signal number, returns a signal name.  If the signal\n    number is unknown, returns ``'UNKNOWN'``.\n    \"\"\"\n    # Since these numbers and names are platform specific, we use the\n    # builtin signal module and build a reverse mapping.\n\n    signal_to_name_map = dict((k, v) for v, k in signal.__dict__.items()\n                              if v.startswith('SIG'))\n\n    return signal_to_name_map.get(signum, 'UNKNOWN')"},{"className":"Element","col":0,"comment":"\n    A base class for all classes that represent XML elements in the\n    VOTABLE file.\n    ","endLoc":462,"id":6111,"nodeType":"Class","startLoc":410,"text":"class Element:\n    \"\"\"\n    A base class for all classes that represent XML elements in the\n    VOTABLE file.\n    \"\"\"\n    _element_name = ''\n    _attr_list = []\n\n    def _add_unknown_tag(self, iterator, tag, data, config, pos):\n        warn_or_raise(W10, W10, tag, config, pos)\n\n    def _ignore_add(self, iterator, tag, data, config, pos):\n        warn_unknown_attrs(tag, data.keys(), config, pos)\n\n    def _add_definitions(self, iterator, tag, data, config, pos):\n        if config.get('version_1_1_or_later'):\n            warn_or_raise(W22, W22, (), config, pos)\n        warn_unknown_attrs(tag, data.keys(), config, pos)\n\n    def parse(self, iterator, config):\n        \"\"\"\n        For internal use. Parse the XML content of the children of the\n        element.\n\n        Parameters\n        ----------\n        iterator : xml iterable\n            An iterator over XML elements as returned by\n            `~astropy.utils.xml.iterparser.get_xml_iterator`.\n\n        config : dict\n            The configuration dictionary that affects how certain\n            elements are read.\n\n        Returns\n        -------\n        self : `~astropy.io.votable.tree.Element`\n            Returns self as a convenience.\n        \"\"\"\n        raise NotImplementedError()\n\n    def to_xml(self, w, **kwargs):\n        \"\"\"\n        For internal use. Output the element to XML.\n\n        Parameters\n        ----------\n        w : astropy.utils.xml.writer.XMLWriter object\n            An XML writer to write to.\n        **kwargs : dict\n            Any configuration parameters to control the output.\n        \"\"\"\n        raise NotImplementedError()"},{"col":4,"comment":"null","endLoc":419,"header":"def _add_unknown_tag(self, iterator, tag, data, config, pos)","id":6112,"name":"_add_unknown_tag","nodeType":"Function","startLoc":418,"text":"def _add_unknown_tag(self, iterator, tag, data, config, pos):\n        warn_or_raise(W10, W10, tag, config, pos)"},{"col":0,"comment":"\n    Given an `~astropy.table.Table` object, return a\n    `~astropy.io.votable.tree.VOTableFile` file structure containing\n    just that single table.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table` instance\n\n    table_id : str, optional\n        If not `None`, set the given id on the returned\n        `~astropy.io.votable.tree.Table` instance.\n\n    Returns\n    -------\n    votable : `~astropy.io.votable.tree.VOTableFile` instance\n    ","endLoc":357,"header":"def from_table(table, table_id=None)","id":6113,"name":"from_table","nodeType":"Function","startLoc":339,"text":"def from_table(table, table_id=None):\n    \"\"\"\n    Given an `~astropy.table.Table` object, return a\n    `~astropy.io.votable.tree.VOTableFile` file structure containing\n    just that single table.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table` instance\n\n    table_id : str, optional\n        If not `None`, set the given id on the returned\n        `~astropy.io.votable.tree.Table` instance.\n\n    Returns\n    -------\n    votable : `~astropy.io.votable.tree.VOTableFile` instance\n    \"\"\"\n    return tree.VOTableFile.from_table(table, table_id=table_id)"},{"col":4,"comment":"null","endLoc":422,"header":"def _ignore_add(self, iterator, tag, data, config, pos)","id":6114,"name":"_ignore_add","nodeType":"Function","startLoc":421,"text":"def _ignore_add(self, iterator, tag, data, config, pos):\n        warn_unknown_attrs(tag, data.keys(), config, pos)"},{"attributeType":"null","col":39,"comment":"null","endLoc":10,"id":6115,"name":"xml_check","nodeType":"Attribute","startLoc":10,"text":"xml_check"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":6116,"name":"__all__","nodeType":"Attribute","startLoc":17,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":52,"id":6117,"name":"_token_regex","nodeType":"Attribute","startLoc":52,"text":"_token_regex"},{"col":0,"comment":"","endLoc":4,"header":"xmlutil.py#<anonymous>","id":6118,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nVarious XML-related utilities\n\"\"\"\n\n__all__ = [\n    'check_id', 'fix_id', 'check_token', 'check_mime_content_type',\n    'check_anyuri', 'validate_schema'\n    ]\n\n_token_regex = r\"(?![\\r\\l\\t ])[^\\r\\l\\t]*(?![\\r\\l\\t ])\""},{"id":6119,"name":"astropy/io/votable/src","nodeType":"Package"},{"id":6120,"name":"tablewriter.c","nodeType":"TextFile","path":"astropy/io/votable/src","text":"/******************************************************************************\n * C extension code for vo.table.\n *\n * Everything in this file has an alternate Python implementation and\n * is included for performance reasons only.\n *\n * This contains a write_tabledata function to quickly write out a Numpy array\n * in TABLEDATA format.\n *\n ******************************************************************************/\n\n#define PY_SSIZE_T_CLEAN\n#include <Python.h>\n\n/******************************************************************************\n * Convenience macros and functions\n ******************************************************************************/\n#undef  CLAMP\n#define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))\n\nstatic Py_ssize_t\nnext_power_of_2(Py_ssize_t n)\n{\n    /* Calculate the next-highest power of two */\n    n--;\n    n |= n >> 1;\n    n |= n >> 2;\n    n |= n >> 4;\n    n |= n >> 8;\n    n |= n >> 16;\n    n++;\n\n    return n == 0 ? 2 : n;\n}\n\n/******************************************************************************\n * Write TABLEDATA\n ******************************************************************************/\n\n#define CHAR char\n\n/*\n * Reallocate the write buffer to the requested size\n */\nstatic int\n_buffer_realloc(\n        CHAR** buffer, Py_ssize_t* buffer_size, CHAR** x, Py_ssize_t req_size)\n{\n    Py_ssize_t  n       = req_size;\n    CHAR *      new_mem = NULL;\n\n    if (req_size < *buffer_size) {\n        return 0;\n    }\n\n    /* Calculate the next-highest power of two */\n    n = next_power_of_2(n);\n\n    if (n < req_size) {\n        PyErr_SetString(PyExc_MemoryError, \"Out of memory for XML text.\");\n        return -1;\n    }\n\n    new_mem = PyMem_Realloc((void *)*buffer, n * sizeof(CHAR));\n    if (new_mem == NULL) {\n        PyErr_SetString(PyExc_MemoryError, \"Out of memory for XML text.\");\n        return -1;\n    }\n\n    *x = (CHAR *)new_mem + (*x - *buffer);\n    *buffer = new_mem;\n    *buffer_size = n;\n\n    return 0;\n}\n\n/*\n * Write *indent* spaces to the buffer\n */\nstatic int\n_write_indent(CHAR** buffer, Py_ssize_t* buffer_size,\n              CHAR** x, Py_ssize_t indent)\n{\n    if (_buffer_realloc(buffer, buffer_size, x,\n                        (*x - *buffer + indent))) {\n        return 1;\n    }\n\n    for (; indent; --indent) {\n        *(*x)++ = ' ';\n    }\n\n    return 0;\n}\n\n/*\n * Write a string into a buffer.\n */\nstatic int\n_write_string(CHAR** buffer, Py_ssize_t* buffer_size,\n              CHAR** x, const CHAR* src, const Py_ssize_t len) {\n    if (_buffer_realloc(buffer, buffer_size, x,\n                        (*x - *buffer + len))) {\n        return 1;\n    }\n\n    while (*src != (CHAR)0) {\n        *(*x)++ = *src++;\n    }\n\n    return 0;\n}\n\n/*\n * Write an 8-bit ascii-encoded C string to a Unicode string.\n */\nstatic int\n_write_cstring(CHAR** buffer, Py_ssize_t* buffer_size,\n               CHAR** x, const char* src, const Py_ssize_t len) {\n    if (_buffer_realloc(buffer, buffer_size, x,\n                        (*x - *buffer + len))) {\n        return 1;\n    }\n\n    while (*src != (char)0) {\n        *(*x)++ = *src++;\n    }\n\n    return 0;\n}\n\n/*\n * Write a TABLEDATA element tree to the given write method.\n *\n * The Python arguments are:\n *\n * *write_method* (callable): A Python callable that takes a unicode\n *    string and writes it to a file or buffer.\n *\n * *array* (numpy structured array): A Numpy record array containing\n *    the data\n *\n * *mask* (numpy array): A Numpy array which is True everywhere a\n *    value is missing.  Must have the same shape as *array*.\n *\n * *converters* (list of callables): A sequence of methods which\n *    convert from the native data types in the columns of *array* to\n *    a unicode string in VOTABLE XML format.  Must have the same\n *    length as the number of columns in *array*.\n *\n * *write_null_values* (boolean): When True, write null values in\n *    their entirety in the table.  When False, just write empty <TD/>\n *    elements when the data is null or missing.\n *\n * *indent* (integer): The number of spaces to indent the table.\n *\n * *buf_size* (integer): The size of the write buffer.\n *\n * Returns None.\n */\nstatic PyObject*\nwrite_tabledata(PyObject* self, PyObject *args, PyObject *kwds)\n{\n    /* Inputs */\n    PyObject* write_method = NULL;\n    PyObject* array = NULL;\n    PyObject* mask = NULL;\n    PyObject* converters = NULL;\n    PyObject* py_supports_empty_values = NULL;\n    Py_ssize_t indent = 0;\n    Py_ssize_t buf_size = (Py_ssize_t)1 << 8;\n\n    /* Output buffer */\n    CHAR* buf = NULL;\n    CHAR* x;\n\n    Py_ssize_t nrows = 0;\n    Py_ssize_t ncols = 0;\n    Py_ssize_t i, j;\n    int write_full;\n    int all;\n    PyObject* numpy_module = NULL;\n    PyObject* numpy_all_method = NULL;\n    PyObject* array_row = NULL;\n    PyObject* mask_row = NULL;\n    PyObject* array_val = NULL;\n    PyObject* mask_val = NULL;\n    PyObject* converter = NULL;\n    PyObject* all_masked_obj = NULL;\n    PyObject* str_val = NULL;\n    PyObject* tmp = NULL;\n    CHAR* str_tmp = NULL;\n    Py_ssize_t str_len = 0;\n    int* supports_empty_values = NULL;\n    PyObject* result = 0;\n\n    if (!PyArg_ParseTuple(args, \"OOOOOnn:write_tabledata\",\n                          &write_method, &array, &mask, &converters,\n                          &py_supports_empty_values, &indent, &buf_size)) {\n        goto exit;\n    }\n\n    if (!PyCallable_Check(write_method)) goto exit;\n    if (!PySequence_Check(array)) goto exit;\n    if (!PySequence_Check(mask)) goto exit;\n    if (!PyList_Check(converters)) goto exit;\n    if (!PyList_Check(py_supports_empty_values)) goto exit;\n    indent = CLAMP(indent, (Py_ssize_t)0, (Py_ssize_t)80);\n    buf_size = CLAMP(buf_size, (Py_ssize_t)1 << 8, (Py_ssize_t)1 << 24);\n\n    if ((numpy_module = PyImport_ImportModule(\"numpy\")) == NULL) goto exit;\n    if ((numpy_all_method = PyObject_GetAttrString(numpy_module, \"all\"))\n        == NULL) goto exit;\n\n    if ((nrows = PySequence_Size(array)) == -1) goto exit;\n    if ((ncols = PyList_Size(converters)) == -1) goto exit;\n    if (PyList_Size(py_supports_empty_values) != ncols) goto exit;\n\n    supports_empty_values = PyMem_Malloc(sizeof(int) * ncols);\n    if (!supports_empty_values) goto exit;\n    for (i = 0; i < ncols; ++i) {\n        supports_empty_values[i] = PyObject_IsTrue(\n                PyList_GET_ITEM(py_supports_empty_values, i));\n    }\n\n    if ((buf = PyMem_Malloc((size_t)buf_size * sizeof(CHAR))) == NULL) goto exit;\n\n    for (i = 0; i < nrows; ++i) {\n        if ((array_row = PySequence_GetItem(array, i)) == NULL) goto exit;\n        if ((mask_row = PySequence_GetItem(mask, i)) == NULL) goto exit;\n\n        x = buf;\n        if (_write_indent(&buf, &buf_size, &x, indent)) goto exit;\n        if (_write_cstring(&buf, &buf_size, &x, \" <TR>\\n\", 6)) goto exit;\n\n        for (j = 0; j < ncols; ++j) {\n            if ((converter = PyList_GET_ITEM(converters, j)) == NULL) goto exit;\n            if ((array_val = PySequence_GetItem(array_row, j)) == NULL) goto exit;\n            if ((mask_val = PySequence_GetItem(mask_row, j)) == NULL) goto exit;\n\n            write_full = 1;\n            if (mask_val == Py_True) {\n                write_full = 0;\n            } else if (mask_val == Py_False) {\n                // pass\n            } else if (supports_empty_values[j]) {\n                if ((all_masked_obj =\n                     PyObject_CallFunctionObjArgs(numpy_all_method, mask_val, NULL))\n                    == NULL) goto exit;\n                if ((all = PyObject_IsTrue(all_masked_obj)) == -1) {\n                    Py_DECREF(all_masked_obj);\n                    goto exit;\n                }\n                Py_DECREF(all_masked_obj);\n\n                write_full = !all;\n            }\n\n            if (write_full) {\n                if (_write_indent(&buf, &buf_size, &x, indent)) goto exit;\n\n                if ((str_val =\n                     PyObject_CallFunctionObjArgs(converter, array_val, mask_val, NULL))\n                    == NULL) goto exit;\n                if (PyBytes_Check(str_val)) {\n                    tmp = PyUnicode_FromEncodedObject(str_val, \"utf-8\", \"ignore\");\n                    Py_DECREF(str_val);\n                    str_val = tmp;\n                }\n                if ((str_tmp = PyUnicode_AsUTF8AndSize(str_val, &str_len)) == NULL) {\n                    Py_DECREF(str_val);\n                    goto exit;\n                }\n\n                if (str_len) {\n                    if (_write_cstring(&buf, &buf_size, &x, \"  <TD>\", 6) ||\n                        _write_string(&buf, &buf_size, &x, str_tmp, str_len) ||\n                        _write_cstring(&buf, &buf_size, &x, \"</TD>\\n\", 6)) {\n                        Py_DECREF(str_val);\n                        goto exit;\n                    }\n                } else {\n                    if (_write_cstring(&buf, &buf_size, &x, \"  <TD/>\\n\", 8)) {\n                        Py_DECREF(str_val);\n                        goto exit;\n                    }\n                }\n\n                Py_DECREF(str_val);\n            } else {\n                if (_write_indent(&buf, &buf_size, &x, indent)) goto exit;\n                if (_write_cstring(&buf, &buf_size, &x, \"  <TD/>\\n\", 8)) goto exit;\n            }\n\n            Py_DECREF(array_val); array_val = NULL;\n            Py_DECREF(mask_val);  mask_val = NULL;\n        }\n\n        Py_DECREF(array_row); array_row = NULL;\n        Py_DECREF(mask_row);  mask_row = NULL;\n\n        if (_write_indent(&buf, &buf_size, &x, indent)) goto exit;\n        if (_write_cstring(&buf, &buf_size, &x, \" </TR>\\n\", 7)) goto exit;\n\n        /* NULL-terminate the string */\n        *x = (CHAR)0;\n        if ((tmp = PyObject_CallFunction(write_method, \"s#\",\n                buf, (Py_ssize_t)(x - buf))) == NULL) goto exit;\n        Py_DECREF(tmp);\n    }\n\n    Py_INCREF(Py_None);\n    result = Py_None;\n\n exit:\n    Py_XDECREF(numpy_module);\n    Py_XDECREF(numpy_all_method);\n\n    Py_XDECREF(array_row);\n    Py_XDECREF(mask_row);\n    Py_XDECREF(array_val);\n    Py_XDECREF(mask_val);\n\n    PyMem_Free(buf);\n    PyMem_Free(supports_empty_values);\n\n    return result;\n}\n\n/******************************************************************************\n * Module setup\n ******************************************************************************/\n\nstatic PyMethodDef module_methods[] =\n{\n    {\"write_tabledata\", (PyCFunction)write_tabledata, METH_VARARGS,\n     \"Fast C method to write tabledata\"},\n    {NULL}  /* Sentinel */\n};\n\nstruct module_state {\n    void* none;\n};\n\nstatic int module_traverse(PyObject* m, visitproc visit, void* arg)\n{\n    return 0;\n}\n\nstatic int module_clear(PyObject* m)\n{\n    return 0;\n}\n\nstatic struct PyModuleDef moduledef = {\n    PyModuleDef_HEAD_INIT,\n    \"tablewriter\",\n    \"Fast way to write VOTABLE TABLEDATA\",\n    sizeof(struct module_state),\n    module_methods,\n    NULL,\n    module_traverse,\n    module_clear,\n    NULL\n};\n\nPyMODINIT_FUNC\nPyInit_tablewriter(void)\n{\n    return PyModule_Create(&moduledef);\n}\n"},{"id":6121,"name":".gitignore","nodeType":"TextFile","path":"astropy/io/votable/src","text":"!*.c\n"},{"id":6122,"name":"astropy/io/votable/data","nodeType":"Package"},{"id":6123,"name":"ucd1p-words.txt","nodeType":"TextFile","path":"astropy/io/votable/data","text":"Q|arith                                |Arithmetic quantities\nS|arith.diff                           |Difference between two quantities described by the same UCD\nP|arith.factor                         |Numerical factor\nP|arith.grad                           |Gradient\nP|arith.rate                           |Rate (per time unit)\nS|arith.ratio                          |Ratio between two quantities described by the same UCD\nQ|arith.zp                             |Zero point\nS|em                                   |Electromagnetic spectrum\nS|em.IR                                |Infrared part of the spectrum\nS|em.IR.15-30um                        |Infrared between 15 and 30 micron\nS|em.IR.3-4um                          |Infrared between 3 and 4 micron\nS|em.IR.30-60um                        |Infrared between 30 and 60 micron\nS|em.IR.4-8um                          |Infrared between 4 and 8 micron\nS|em.IR.60-100um                       |Infrared between 60 and 100 micron\nS|em.IR.8-15um                         |Infrared between 8 and 15 micron\nS|em.IR.FIR                            |Far-Infrared, 30-100 microns\nS|em.IR.H                              |Infrared between 1.5 and 2 micron\nS|em.IR.J                              |Infrared between 1.0 and 1.5 micron\nS|em.IR.K                              |Infrared between 2 and 3 micron\nS|em.IR.MIR                            |Medium-Infrared, 5-30 microns\nS|em.IR.NIR                            |Near-Infrared, 1-5 microns\nS|em.UV                                |Ultraviolet part of the spectrum\nS|em.UV.10-50nm                        |Ultraviolet between 10 and 50 nm\nS|em.UV.100-200nm                      |Ultraviolet between 100 and 200 nm\nS|em.UV.200-300nm                      |Ultraviolet between 200 and 300 nm\nS|em.UV.50-100nm                       |Ultraviolet between 50 and 100 nm\nS|em.UV.FUV                            |Far-Ultraviolet\nS|em.X-ray                             |X-ray part of the spectrum\nS|em.X-ray.hard                        |Hard X-ray (12 - 120 keV)\nS|em.X-ray.medium                      |Medium X-ray (2 - 12 keV)\nS|em.X-ray.soft                        |Soft X-ray (0.12 - 2 keV)\nQ|em.bin                               |Channel / instrumental spectral bin coordinate (bin number)\nQ|em.energy                            |Energy value in the em frame\nQ|em.freq                              |Frequency value in the em frame\nS|em.gamma                             |Gamma rays part of the spectrum\nS|em.gamma.hard                        |Hard gamma ray (>500 keV)\nS|em.gamma.soft                        |Soft gamma ray (120 - 500 keV)\nS|em.line                              |Designation of major atomic lines\nS|em.line.HI                           |21cm hydrogen line\nS|em.line.Brgamma                      |Bracket gamma line\nS|em.line.Halpha                       |H-alpha line\nS|em.line.Hbeta                        |H-beta line\nS|em.line.Hgamma                       |H-gamma line\nS|em.line.Hdelta                       |H-delta line\nS|em.line.Lyalpha                      |H-Lyalpha line\nS|em.line.OIII                         |[OIII] line whose rest wl is 500.7 nm\nS|em.line.CO                           |CO radio line, e.g. 12CO(1-0) rest wl 115GHz\nS|em.mm                                |Millimetric part of the spectrum\nS|em.mm.100-200GHz                     |Millimetric between 100 and 200 GHz\nS|em.mm.1500-3000GHz                   |Millimetric between 1500 and 3000 GHz\nS|em.mm.200-400GHz                     |Millimetric between 200 and 400 GHz\nS|em.mm.30-50GHz                       |Millimetric between 30 and 50 GHz\nS|em.mm.400-750GHz                     |Millimetric between 400 and 750 GHz\nS|em.mm.50-100GHz                      |Millimetric between 50 and 100 GHz\nS|em.mm.750-1500GHz                    |Millimetric between 750 and 1500 GHz\nS|em.opt                               |Optical part of the spectrum\nS|em.opt.B                             |Optical band between 400 and 500 nm\nS|em.opt.I                             |Optical band between 750 and 1000 nm\nS|em.opt.R                             |Optical band between 600 and 750 nm\nS|em.opt.U                             |Optical band between 300 and 400 nm\nS|em.opt.V                             |Optical band between 500 and 600 nm\nS|em.radio                             |Radio part of the spectrum\nS|em.radio.100-200MHz                  |Radio between 100 and 200 MHz\nS|em.radio.12-30GHz                    |Radio between 12 and 30 GHz\nS|em.radio.1500-3000MHz                |Radio between 1500 and 3000 MHz\nS|em.radio.20-100MHz                   |Radio between 20 and 100 MHz\nS|em.radio.200-400MHz                  |Radio between 200 and 400 MHz\nS|em.radio.3-6GHz                      |Radio between 3 and 6 GHz\nS|em.radio.400-750MHz                  |Radio between 400 and 750 MHz\nS|em.radio.6-12GHz                     |Radio between 6 and 12 GHz\nS|em.radio.750-1500MHz                 |Radio between 750 and 1500 MHz\nQ|em.wavenumber                        |Wavenumber value in the em frame\nQ|em.wl                                |Wavelength value in the em frame\nQ|em.wl.central                        |Central wavelength\nQ|em.wl.effective                      |Effective wavelength\nQ|instr                                |Instrument\nE|instr.background                     |Instrumental background\nQ|instr.bandpass                       |Bandpass (e.g.: band name) of instrument\nQ|instr.bandwidth                      |Bandwidth of the instrument\nQ|instr.baseline                       |Baseline for interferometry\nS|instr.beam                           |Beam\nQ|instr.calib                          |Calibration parameter\nS|instr.det                            |Detector\nQ|instr.det.noise                      |Instrument noise\nQ|instr.det.psf                        |Point Spread Function\nQ|instr.det.qe                         |Quantum efficiency\nQ|instr.dispersion                     |Dispersion of a spectrograph\nS|instr.filter                         |Filter\nS|instr.fov                            |Field of view\nS|instr.obsty                          |Observatory, satellite, mission\nQ|instr.obsty.seeing                   |Seeing\nQ|instr.offset                         |Offset angle respect to main direction of observation\nQ|instr.order                          |Spectral order in a spectrograph\nQ|instr.param                          |Various instrumental parameters\nS|instr.pixel                          |Pixel (default size: angular)\nS|instr.plate                          |Photographic plate\nQ|instr.plate.emulsion                 |Plate emulsion\nQ|instr.precision                      |Instrument precision\nQ|instr.saturation                     |Instrument saturation threshold\nQ|instr.scale                          |Instrument scale (for CCD, plate, image)\nQ|instr.sensitivity                    |Instrument sensitivity, detection threshold\nQ|instr.setup                          |Instrument configuration or setup\nQ|instr.skyLevel                       |Sky level\nQ|instr.skyTemp                        |Sky temperature\nQ|instr.tel                            |Telescope\nQ|instr.tel.focalLength                |Telescope focal length\nP|meta                                 |Metadata\nP|meta.abstract                        |Abstract (of paper, proposal,etc.)\nP|meta.bib                             |Bibliographic reference\nP|meta.bib.author                      |Author name\nP|meta.bib.bibcode                     |Bibcode\nP|meta.bib.fig                         |Figure in a paper\nP|meta.bib.journal                     |Journal name\nP|meta.bib.page                        |Page number\nP|meta.bib.volume                      |Volume number\nP|meta.code                            |Code or flag\nP|meta.code.class                      |Classification code\nP|meta.code.error                      |limit uncertainty error flag\nP|meta.code.member                     |Membership code\nP|meta.code.mime                       |MIME type\nP|meta.code.multip                     |Multiplicity or binarity flag\nP|meta.code.qual                       |Quality, precision, reliability flag or code\nP|meta.code.status                     |Status code (e.g.: status of a proposal/observation)\nP|meta.cryptic                         |Unknown or impossible to understand quantity\nP|meta.curation                        |Identity of man/organization responsible for the data\nQ|meta.dataset                         |Dataset\nQ|meta.email                           |Curation/contact e-mail\nS|meta.file                            |File\nS|meta.fits                            |FITS standard\nP|meta.id                              |Identifier, name or designation\nP|meta.id.assoc                        |Identifier of associated counterpart\nP|meta.id.CoI                          |Name of Co-Investigator\nP|meta.id.cross                        |Cross identification\nP|meta.id.parent                       |Identification of parent source\nP|meta.id.part                         |Part of identifier, suffix or sub-component\nP|meta.id.PI                           |Name of Principal Investigator\nS|meta.main                            |Main value of something\nS|meta.modelled                        |Quantity was produced by a model\nP|meta.note                            |Note or remark (longer than a code or flag)\nP|meta.number                          |Number (of things; e.g. nb of object in an image)\nP|meta.record                          |Record number\nP|meta.ref                             |Reference, or origin\nQ|meta.ref.ivorn                       |IVORN, Int. VO Resource Name (ivo://)\nQ|meta.ref.uri                         |URI, universal resource identifier\nP|meta.ref.url                         |URL, web address\nS|meta.software                        |Software used in generating data\nS|meta.table                           |Table or catalogue\nP|meta.title                           |Title or explanation\nQ|meta.ucd                             |UCD\nP|meta.unit                            |Unit\nP|meta.version                         |Version\nS|obs                                  |Observation\nQ|obs.airMass                          |Airmass\nS|obs.atmos                            |Atmosphere, atmospheric phenomena affecting an observation\nQ|obs.atmos.extinction                 |Atmospheric extinction\nQ|obs.atmos.refractAngle               |Atmospheric refraction angle\nS|obs.calib                            |Calibration observation\nS|obs.calib.flat                       |Related to flat-field calibration observation (dome, sky, ..)\nS|obs.exposure                         |Exposure\nS|obs.field                            |Region covered by the observation\nS|obs.image                            |Image\nQ|obs.observer                         |Observer, discoverer\nQ|obs.param                            |Various observation or reduction parameter\nS|obs.proposal                         |Observation proposal\nQ|obs.proposal.cycle                   |Proposal cycle\nS|obs.sequence                         |Sequence of observations, exposures or events\nE|phot                                 |Photometry\nE|phot.antennaTemp                     |Antenna temperature\nQ|phot.calib                           |Photometric calibration\nC|phot.color                           |Color index or magnitude difference\nQ|phot.color.excess                    |color excess\nQ|phot.color.reddFree                  |Dereddened color\nE|phot.count                           |Flux expressed in counts\nE|phot.fluence                         |fluence\nE|phot.flux                            |Photon flux\nQ|phot.flux.bol                        |Bolometric flux\nE|phot.flux.density                    |Flux density (per wl/freq/energy interval)\nE|phot.flux.density.sb                 |Flux density surface brightness\nE|phot.flux.sb                         |Flux surface brightness\nE|phot.limbDark                        |Limb-darkening coefficients\nE|phot.mag                             |Photometric magnitude\nE|phot.mag.bc                          |Bolometric correction\nQ|phot.mag.bol                         |Bolometric magnitude\nQ|phot.mag.distMod                     |Distance modulus\nE|phot.mag.reddFree                    |Dereddened magnitude\nE|phot.mag.sb                          |Surface brightness in magnitude units\nQ|phys                                 |Physical quantities\nQ|phys.SFR                             |Star formation rate\nE|phys.absorption                      |Extinction or absorption along the line of sight\nQ|phys.absorption.coeff                |Absorption coefficient (e.g. in a spectral line)\nQ|phys.absorption.gal                  |Galactic extinction\nQ|phys.absorption.opticalDepth         |Optical depth\nQ|phys.abund                           |Abundance\nQ|phys.abund.Fe                        |Fe/H abundance\nQ|phys.abund.X                         |Hydrogen abundance\nQ|phys.abund.Y                         |Helium abundance\nQ|phys.abund.Z                         |Metallicity abundance\nQ|phys.acceleration                    |Acceleration\nQ|phys.albedo                          |Albedo or reflectance\nQ|phys.angArea                         |Angular area\nQ|phys.angMomentum                     |Angular momentum\nE|phys.angSize                         |Angular size width diameter dimension extension major minor axis extraction radius\nE|phys.angSize.smajAxis                |angular size extent or extension of semi-major axis\nE|phys.angSize.sminAxis                |angular size extent or extension of semi-minor axis\nQ|phys.area                            |Area (in linear units)\nS|phys.atmol                           |Atomic and molecular physics (shared properties)\nQ|phys.atmol.branchingRatio            |Branching ratio\nQ|phys.atmol.collisional               |Related to collisions\nQ|phys.atmol.collStrength              |Collisional strength\nQ|phys.atmol.configuration             |Configuration\nQ|phys.atmol.crossSection              |Atomic / molecular cross-section\nQ|phys.atmol.element                   |Element\nQ|phys.atmol.excitation                |Atomic molecular excitation parameter\nQ|phys.atmol.final                     |Quantity refers to atomic/molecular final/ground state, level, ecc.\nQ|phys.atmol.initial                   |Quantity refers to atomic/molecular initial state, level, ecc.\nQ|phys.atmol.ionStage                  |Ion, ionization stage\nS|phys.atmol.ionization                |Related to ionization\nQ|phys.atmol.lande                     |Lande factor\nS|phys.atmol.level                     |Atomic level\nQ|phys.atmol.lifetime                  |Lifetime of a level\nQ|phys.atmol.lineShift                 |Line shifting coefficient\nQ|phys.atmol.number                    |Atomic number Z\nQ|phys.atmol.oscStrength               |Oscillator strength\nQ|phys.atmol.parity                    |Parity\nQ|phys.atmol.qn                        |Quantum number\nQ|phys.atmol.radiationType             |Type of radiation characterizing atomic lines (electric dipole/quadrupole, magnetic dipole)\nQ|phys.atmol.symmetry                  |Type of nuclear spin symmetry\nQ|phys.atmol.sWeight                   |Statistical weight\nQ|phys.atmol.sWeight.nuclear           |Statistical weight for nuclear spin states\nQ|phys.atmol.term                      |Atomic term\nS|phys.atmol.transition                |Transition between states\nQ|phys.atmol.transProb                 |Transition probability, Einstein A coefficient\nQ|phys.atmol.wOscStrength              |Weighted oscillator strength\nQ|phys.atmol.weight                    |Atomic weight\nQ|phys.columnDensity                   |Column density\nS|phys.composition                     |Quantities related to composition of objects\nQ|phys.composition.massLightRatio      |Mass to light ratio\nQ|phys.composition.yield               |Mass yield\nS|phys.cosmology                       |Related to cosmology\nQ|phys.damping                         |Generic damping quantities\nQ|phys.density                         |Density (of mass, electron, ...)\nQ|phys.dielectric                      |Complex dielectric function\nQ|phys.dispMeasure                     |Dispersion measure\nV|phys.electField                      |Electric field\nS|phys.electron                        |Electron\nQ|phys.electron.degen                  |Electron degeneracy parameter\nQ|phys.emissMeasure                    |Emission measure\nQ|phys.emissivity                      |Emissivity\nQ|phys.energy                          |Energy\nQ|phys.energy.density                  |Energy-density\nQ|phys.entropy                         |Entropy\nQ|phys.eos                             |Equation of state\nQ|phys.excitParam                      |Excitation parameter U\nQ|phys.gauntFactor                     |Gaunt factor/correction\nQ|phys.gravity                         |Gravity\nQ|phys.ionizParam                      |Ionization parameter\nQ|phys.ionizParam.coll                 |Collisional ionization\nQ|phys.ionizParam.rad                  |Radiative ionization\nE|phys.luminosity                      |Luminosity\nQ|phys.luminosity.fun                  |Luminosity function\nE|phys.magAbs                          |Absolute magnitude\nQ|phys.magAbs.bol                      |Bolometric absolute magnitude\nV|phys.magField                        |Magnetic field\nQ|phys.mass                            |Mass\nQ|phys.mass.loss                       |Mass loss\nQ|phys.mol                             |Molecular data\nQ|phys.mol.dipole                      |Molecular dipole\nQ|phys.mol.dipole.electric             |Molecular electric dipole moment\nQ|phys.mol.dipole.magnetic             |Molecular magnetic dipole moment\nQ|phys.mol.dissociation                |Molecular dissociation\nQ|phys.mol.formationHeat               |Formation heat for molecules\nQ|phys.mol.quadrupole                  |Molecular quadrupole\nQ|phys.mol.quadrupole.electric         |Molecular electric quadrupole moment\nS|phys.mol.rotation                    |Molecular rotation\nS|phys.mol.vibration                   |Molecular vibration\nS|phys.particle.neutrino               |Related to neutrino\nE|phys.polarization                    |Polarization degree (or percentage)\nQ|phys.polarization.circular           |Circular polarization\nQ|phys.polarization.linear             |Linear polarization\nQ|phys.polarization.rotMeasure         |Rotation measure polarization\nQ|phys.polarization.stokes             |Stokes polarization\nQ|phys.pressure                        |Pressure\nQ|phys.recombination.coeff             |Recombination coefficient\nQ|phys.refractIndex                    |Refraction index\nQ|phys.size                            |Linear size, length (not angular)\nQ|phys.size.axisRatio                  |Axis ratio (a/b) or (b/a)\nQ|phys.size.diameter                   |Diameter\nQ|phys.size.radius                     |Radius\nQ|phys.size.smajAxis                   |Linear semi major axis\nQ|phys.size.sminAxis                   |Linear semi minor axis\nQ|phys.temperature                     |Temperature\nQ|phys.temperature.effective           |Effective temperature\nQ|phys.temperature.electron            |Electron temperature\nQ|phys.transmission                    |Transmission (of filter, instrument, ...)\nV|phys.veloc                           |Space velocity\nQ|phys.veloc.ang                       |Angular velocity\nQ|phys.veloc.dispersion                |Velocity dispersion\nQ|phys.veloc.escape                    |Escape velocity\nQ|phys.veloc.expansion                 |Expansion velocity\nQ|phys.veloc.microTurb                 |Microturbulence velocity\nQ|phys.veloc.orbital                   |Orbital velocity\nQ|phys.veloc.pulsat                    |Pulsational velocity\nQ|phys.veloc.rotat                     |Rotational velocity\nQ|phys.veloc.transverse                |Transverse / tangential velocity\nQ|phys.virial                          |Related to virial quantities (mass, radius, ..)\nQ|pos                                  |Position and coordinates\nQ|pos.angDistance                      |Angular distance, elongation\nQ|pos.angResolution                    |Angular resolution\nQ|pos.az                               |Position in alt-azimutal frame\nQ|pos.az.alt                           |Alt-azimutal altitude\nQ|pos.az.azi                           |Alt-azimutal azimut\nQ|pos.az.zd                            |Alt-azimutal zenith distance\nS|pos.barycenter                       |Barycenter\nS|pos.bodyrc                           |Body related coordinates\nQ|pos.bodyrc.alt                       |Body related coordinate (altitude on the body)\nQ|pos.bodyrc.lat                       |Body related coordinate (latitude on the body)\nQ|pos.bodyrc.long                      |Body related coordinate (longitude on the body)\nS|pos.cartesian                        |Cartesian (rectangular) coordinates\nQ|pos.cartesian.x                      |Cartesian coordinate along the x-axis\nQ|pos.cartesian.y                      |Cartesian coordinate along the y-axis\nQ|pos.cartesian.z                      |Cartesian coordinate along the z-axis\nS|pos.cmb                              |Cosmic Microwave Background reference frame\nQ|pos.dirCos                           |Direction cosine\nV|pos.distance                         |Linear distance\nS|pos.earth                            |Coordinates related to Earth\nQ|pos.earth.altitude                   |Altitude, height on Earth  above sea level\nQ|pos.earth.lat                        |Latitude on Earth\nQ|pos.earth.lon                        |Longitude on Earth\nS|pos.ecliptic                         |Ecliptic coordinates\nQ|pos.ecliptic.lat                     |Ecliptic latitude\nQ|pos.ecliptic.lon                     |Ecliptic longitude\nS|pos.eop                              |Earth orientation parameters\nQ|pos.eop.nutation                     |Earth nutation\nQ|pos.ephem                            |Ephemeris\nS|pos.eq                               |Equatorial coordinates\nQ|pos.eq.dec                           |Declination in equatorial coordinates\nQ|pos.eq.ha                            |Hour-angle\nQ|pos.eq.ra                            |Right ascension in equatorial coordinates\nQ|pos.eq.spd                           |South polar distance in equatorial coordinates\nS|pos.errorEllipse                     |Positional error ellipse\nQ|pos.frame                            |Reference frame used for positions\nS|pos.galactic                         |Galactic coordinates\nQ|pos.galactic.lat                     |Latitude in galactic coordinates\nQ|pos.galactic.lon                     |Longitude in galactic coordinates\nS|pos.galactocentric                   |Galactocentric coordinate system\nS|pos.geocentric                       |Geocentric coordinate system\nQ|pos.healpix                          |Hierarchical Equal Area IsoLatitude Pixelization\nS|pos.heliocentric                     |Heliocentric position coordinate (solar system bodies)\nQ|pos.HTM                              |Hierarchical Triangular Mesh\nS|pos.lambert                          |Lambert projection\nS|pos.lg                               |Local Group reference frame\nS|pos.lsr                              |Local Standard of Rest reference frame\nQ|pos.lunar                            |Lunar coordinates\nQ|pos.lunar.occult                     |Occultation by lunar limb\nQ|pos.parallax                         |Parallax\nQ|pos.parallax.dyn                     |Dynamical parallax\nQ|pos.parallax.phot                    |Photometric parallaxes\nQ|pos.parallax.spect                   |Spectroscopic parallax\nQ|pos.parallax.trig                    |Trigonometric parallax\nQ|pos.phaseAng                         |Phase angle, e.g. elongation of earth from sun as seen from a third cel. object\nV|pos.pm                               |Proper motion\nQ|pos.posAng                           |Position angle of a given vector\nV|pos.precess                          |Precession (in equatorial coordinates)\nS|pos.supergalactic                    |Supergalactic coordinates\nQ|pos.supergalactic.lat                |Latitude in supergalactic coordinates\nQ|pos.supergalactic.lon                |Longitude in supergalactic coordinates\nP|pos.wcs                              |WCS keywords\nP|pos.wcs.cdmatrix                     |WCS CDMATRIX\nP|pos.wcs.crpix                        |WCS CRPIX\nP|pos.wcs.crval                        |WCS CRVAL\nP|pos.wcs.ctype                        |WCS CTYPE\nP|pos.wcs.naxes                        |WCS NAXES\nP|pos.wcs.naxis                        |WCS NAXIS\nP|pos.wcs.scale                        |WCS scale or scale of an image\nQ|spect                                |Spectroscopy\nQ|spect.binSize                        |Spectral bin size\nS|spect.continuum                      |Continuum spectrum\nQ|spect.dopplerParam                   |Doppler parameter b\nE|spect.dopplerVeloc                   |Radial velocity, derived from the shift of some spectral feature\nE|spect.dopplerVeloc.opt               |Radial velocity derived from a wavelength shift using the optical convention\nE|spect.dopplerVeloc.radio             |Radial velocity derived from a frequency shift using the radio convention\nE|spect.index                          |Spectral index\nS|spect.line                           |Spectral line\nE|spect.line.asymmetry                 |Line asymmetry\nE|spect.line.broad                     |Spectral line broadening\nQ|spect.line.broad.Stark               |Stark line broadening coefficient\nE|spect.line.broad.Zeeman              |Zeeman broadening\nE|spect.line.eqWidth                   |Line equivalent width\nE|spect.line.intensity                 |Line intensity\nE|spect.line.profile                   |Line profile\nQ|spect.line.strength                  |Spectral line strength S\nE|spect.line.width                     |Spectral line fwhm\nQ|spect.resolution                     |Spectral (or velocity) resolution\nS|src                                  |Observed source viewed on the sky\nS|src.calib                            |Calibration source\nS|src.calib.guideStar                  |Guide star\nQ|src.class                            |Source classification (star, galaxy, cluster...)\nQ|src.class.color                      |Color classification\nQ|src.class.distance                   |Distance class e.g. Abell\nQ|src.class.luminosity                 |Luminosity class\nQ|src.class.richness                   |Richness class e.g. Abell\nQ|src.class.starGalaxy                 |Star/galaxy discriminator, stellarity index\nQ|src.class.struct                     |Structure classification e.g. Bautz-Morgan\nQ|src.density                          |Density of sources\nQ|src.ellipticity                      |Source ellipticity\nQ|src.impactParam                      |Impact parameter\nQ|src.morph                            |Morphology structure\nQ|src.morph.param                      |Morphological parameter\nQ|src.morph.scLength                   |Scale length for a galactic component (disc or bulge)\nQ|src.morph.type                       |Hubble morphological type (galaxies)\nS|src.net                              |Qualifier indicating that a quantity (e.g. flux) is background subtracted rather than total\nQ|src.orbital                          |Orbital parameters\nQ|src.orbital.eccentricity             |Orbit eccentricity\nQ|src.orbital.inclination              |Orbit inclination\nQ|src.orbital.meanAnomaly              |Orbit mean anomaly\nQ|src.orbital.meanMotion               |Mean motion\nQ|src.orbital.node                     |Ascending node\nQ|src.orbital.periastron               |Periastron\nQ|src.redshift                         |Redshift\nQ|src.redshift.phot                    |Photometric redshift\nQ|src.sample                           |Sample\nQ|src.spType                           |Spectral type MK\nQ|src.var                              |Variability of source\nE|src.var.amplitude                    |Amplitude of variation\nQ|src.var.index                        |Variability index\nQ|src.var.pulse                        |Pulse\nQ|stat                                 |Statistical parameters\nQ|stat.Fourier                         |Fourier coefficient\nQ|stat.Fourier.amplitude               |Amplitude Fourier coefficient\nP|stat.correlation                     |Correlation between two parameters\nP|stat.covariance                      |Covariance between two parameters\nP|stat.error                           |Statistical error\nP|stat.error.sys                       |Systematic error\nQ|stat.filling                         |Filling factor (volume, time, ..)\nQ|stat.fit                             |Fit\nP|stat.fit.chi2                        |Chi2\nP|stat.fit.dof                         |Degrees of freedom\nP|stat.fit.goodness                    |Goodness or significance of fit\nS|stat.fit.omc                         |Observed minus computed\nQ|stat.fit.param                       |Parameter of fit\nP|stat.fit.residual                    |Residual fit\nP|stat.likelihood                      |Likelihood\nS|stat.max                             |Maximum or upper limit\nS|stat.mean                            |Mean, average value\nS|stat.median                          |Median value\nS|stat.min                             |Minimum or lowest limit\nQ|stat.param                           |Parameter\nQ|stat.probability                     |Probability\nP|stat.snr                             |Signal to noise ratio\nP|stat.stdev                           |Standard deviation\nS|stat.uncalib                         |Qualifier of a generic incalibrated quantity\nQ|stat.value                           |Miscellaneous value\nP|stat.variance                        |Variance\nP|stat.weight                          |Statistical weight\nQ|time                                 |Time, generic quantity in units of time or date\nQ|time.age                             |Age\nQ|time.creation                        |Creation time/date (of dataset, file, catalogue,...)\nQ|time.crossing                        |Crossing time\nQ|time.duration                        |Interval of time describing the duration of a generic event or phenomenon\nQ|time.end                             |End time/date of a generic event\nQ|time.epoch                           |Instant of time related to a generic event (epoch, date, Julian date, time stamp/tag,...)\nQ|time.equinox                         |Equinox\nQ|time.interval                        |Time interval, time-bin, time elapsed between two events, not the duration of an event\nQ|time.lifetime                        |Lifetime\nQ|time.period                          |Period, interval of time between the recurrence of phases in a periodic phenomenon\nQ|time.phase                           |Phase, position within a period\nQ|time.processing                      |A time/date associated with the processing of data\nQ|time.publiYear                       |Publication year\nQ|time.relax                           |Relaxation time\nQ|time.release                         |The time/date data is available to the public\nQ|time.resolution                      |Time resolution\nQ|time.scale                           |Timescale\nQ|time.start                           |Start time/date of generic event\n"},{"col":4,"comment":"null","endLoc":427,"header":"def _add_definitions(self, iterator, tag, data, config, pos)","id":6124,"name":"_add_definitions","nodeType":"Function","startLoc":424,"text":"def _add_definitions(self, iterator, tag, data, config, pos):\n        if config.get('version_1_1_or_later'):\n            warn_or_raise(W22, W22, (), config, pos)\n        warn_unknown_attrs(tag, data.keys(), config, pos)"},{"className":"VOTableFile","col":0,"comment":"\n    VOTABLE_ element: represents an entire file.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n\n    *version* is settable at construction time only, since conformance\n    tests for building the rest of the structure depend on it.\n    ","endLoc":3881,"id":6125,"nodeType":"Class","startLoc":3379,"text":"class VOTableFile(Element, _IDProperty, _DescriptionProperty):\n    \"\"\"\n    VOTABLE_ element: represents an entire file.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n\n    *version* is settable at construction time only, since conformance\n    tests for building the rest of the structure depend on it.\n    \"\"\"\n\n    def __init__(self, ID=None, id=None, config=None, pos=None, version=\"1.4\"):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        Element.__init__(self)\n        self.ID = resolve_id(ID, id, config, pos)\n        self.description = None\n\n        self._coordinate_systems = HomogeneousList(CooSys)\n        self._time_systems = HomogeneousList(TimeSys)\n        self._params = HomogeneousList(Param)\n        self._infos = HomogeneousList(Info)\n        self._resources = HomogeneousList(Resource)\n        self._groups = HomogeneousList(Group)\n\n        version = str(version)\n        if version == '1.0':\n            warnings.warn('VOTable 1.0 support is deprecated in astropy 4.3 and will be '\n                          'removed in a future release', AstropyDeprecationWarning)\n        elif (version != '1.0') and (version not in self._version_namespace_map):\n            allowed_from_map = \"', '\".join(self._version_namespace_map)\n            raise ValueError(f\"'version' should be in ('1.0', '{allowed_from_map}').\")\n\n        self._version = version\n\n    def __repr__(self):\n        n_tables = len(list(self.iter_tables()))\n        return f'<VOTABLE>... {n_tables} tables ...</VOTABLE>'\n\n    @property\n    def version(self):\n        \"\"\"\n        The version of the VOTable specification that the file uses.\n        \"\"\"\n        return self._version\n\n    @version.setter\n    def version(self, version):\n        version = str(version)\n        if version not in self._version_namespace_map:\n            allowed_from_map = \"', '\".join(self._version_namespace_map)\n            raise ValueError(\n                f\"astropy.io.votable only supports VOTable versions '{allowed_from_map}'\")\n        self._version = version\n\n    @property\n    def coordinate_systems(self):\n        \"\"\"\n        A list of coordinate system descriptions for the file.  Must\n        contain only `CooSys` objects.\n        \"\"\"\n        return self._coordinate_systems\n\n    @property\n    def time_systems(self):\n        \"\"\"\n        A list of time system descriptions for the file.  Must\n        contain only `TimeSys` objects.\n        \"\"\"\n        return self._time_systems\n\n    @property\n    def params(self):\n        \"\"\"\n        A list of parameters (constant-valued columns) that apply to\n        the entire file.  Must contain only `Param` objects.\n        \"\"\"\n        return self._params\n\n    @property\n    def infos(self):\n        \"\"\"\n        A list of informational parameters (key-value pairs) for the\n        entire file.  Must only contain `Info` objects.\n        \"\"\"\n        return self._infos\n\n    @property\n    def resources(self):\n        \"\"\"\n        A list of resources, in the order they appear in the file.\n        Must only contain `Resource` objects.\n        \"\"\"\n        return self._resources\n\n    @property\n    def groups(self):\n        \"\"\"\n        A list of groups, in the order they appear in the file.  Only\n        supported as a child of the VOTABLE element in VOTable 1.2 or\n        later.\n        \"\"\"\n        return self._groups\n\n    def _add_param(self, iterator, tag, data, config, pos):\n        param = Param(self, config=config, pos=pos, **data)\n        self.params.append(param)\n        param.parse(iterator, config)\n\n    def _add_resource(self, iterator, tag, data, config, pos):\n        resource = Resource(config=config, pos=pos, **data)\n        self.resources.append(resource)\n        resource.parse(self, iterator, config)\n\n    def _add_coosys(self, iterator, tag, data, config, pos):\n        coosys = CooSys(config=config, pos=pos, **data)\n        self.coordinate_systems.append(coosys)\n        coosys.parse(iterator, config)\n\n    def _add_timesys(self, iterator, tag, data, config, pos):\n        timesys = TimeSys(config=config, pos=pos, **data)\n        self.time_systems.append(timesys)\n        timesys.parse(iterator, config)\n\n    def _add_info(self, iterator, tag, data, config, pos):\n        info = Info(config=config, pos=pos, **data)\n        self.infos.append(info)\n        info.parse(iterator, config)\n\n    def _add_group(self, iterator, tag, data, config, pos):\n        if not config.get('version_1_2_or_later'):\n            warn_or_raise(W26, W26, ('GROUP', 'VOTABLE', '1.2'), config, pos)\n        group = Group(self, config=config, pos=pos, **data)\n        self.groups.append(group)\n        group.parse(iterator, config)\n\n    def _get_version_checks(self):\n        config = {}\n        config['version_1_1_or_later'] = \\\n            util.version_compare(self.version, '1.1') >= 0\n        config['version_1_2_or_later'] = \\\n            util.version_compare(self.version, '1.2') >= 0\n        config['version_1_3_or_later'] = \\\n            util.version_compare(self.version, '1.3') >= 0\n        config['version_1_4_or_later'] = \\\n            util.version_compare(self.version, '1.4') >= 0\n        return config\n\n    # Map VOTable version numbers to namespace URIs and schema information.\n    _version_namespace_map = {\n        # Version 1.0 isn't well-supported, but is allowed on parse (with a warning).\n        # It used DTD rather than schema, so this information would not be useful.\n        # By omitting 1.0 from this dict we can use the keys as the list of versions\n        # that are allowed in various other checks.\n        \"1.1\": {\n            \"namespace_uri\": \"http://www.ivoa.net/xml/VOTable/v1.1\",\n            \"schema_location_attr\": \"xsi:noNamespaceSchemaLocation\",\n            \"schema_location_value\": \"http://www.ivoa.net/xml/VOTable/v1.1\"\n        },\n        \"1.2\": {\n            \"namespace_uri\": \"http://www.ivoa.net/xml/VOTable/v1.2\",\n            \"schema_location_attr\": \"xsi:noNamespaceSchemaLocation\",\n            \"schema_location_value\": \"http://www.ivoa.net/xml/VOTable/v1.2\"\n        },\n        # With 1.3 we'll be more explicit with the schema location.\n        # - xsi:schemaLocation uses the namespace name along with the URL\n        #   to reference it.\n        # - For convenience, but somewhat confusingly, the namespace URIs\n        #   are also usable URLs for accessing an applicable schema.\n        #   However to avoid confusion, we'll use the explicit schema URL.\n        \"1.3\": {\n            \"namespace_uri\": \"http://www.ivoa.net/xml/VOTable/v1.3\",\n            \"schema_location_attr\": \"xsi:schemaLocation\",\n            \"schema_location_value\":\n            \"http://www.ivoa.net/xml/VOTable/v1.3 http://www.ivoa.net/xml/VOTable/VOTable-1.3.xsd\"\n        },\n        # With 1.4 namespace URIs stopped incrementing with minor version changes\n        # so we use the same URI as with 1.3.  See this IVOA note for more info:\n        # http://www.ivoa.net/documents/Notes/XMLVers/20180529/\n        \"1.4\": {\n            \"namespace_uri\": \"http://www.ivoa.net/xml/VOTable/v1.3\",\n            \"schema_location_attr\": \"xsi:schemaLocation\",\n            \"schema_location_value\":\n            \"http://www.ivoa.net/xml/VOTable/v1.3 http://www.ivoa.net/xml/VOTable/VOTable-1.4.xsd\"\n        }\n    }\n\n    def parse(self, iterator, config):\n        config['_current_table_number'] = 0\n\n        for start, tag, data, pos in iterator:\n            if start:\n                if tag == 'xml':\n                    pass\n                elif tag == 'VOTABLE':\n                    if 'version' not in data:\n                        warn_or_raise(W20, W20, self.version, config, pos)\n                        config['version'] = self.version\n                    else:\n                        config['version'] = self._version = data['version']\n                        if config['version'].lower().startswith('v'):\n                            warn_or_raise(\n                                W29, W29, config['version'], config, pos)\n                            self._version = config['version'] = \\\n                                            config['version'][1:]\n                        if config['version'] not in self._version_namespace_map:\n                            vo_warn(W21, config['version'], config, pos)\n\n                    if 'xmlns' in data:\n                        ns_info = self._version_namespace_map.get(config['version'], {})\n                        correct_ns = ns_info.get('namespace_uri')\n                        if data['xmlns'] != correct_ns:\n                            vo_warn(W41, (correct_ns, data['xmlns']), config, pos)\n                    else:\n                        vo_warn(W42, (), config, pos)\n\n                    break\n                else:\n                    vo_raise(E19, (), config, pos)\n        config.update(self._get_version_checks())\n\n        tag_mapping = {\n            'PARAM': self._add_param,\n            'RESOURCE': self._add_resource,\n            'COOSYS': self._add_coosys,\n            'TIMESYS': self._add_timesys,\n            'INFO': self._add_info,\n            'DEFINITIONS': self._add_definitions,\n            'DESCRIPTION': self._ignore_add,\n            'GROUP': self._add_group}\n\n        for start, tag, data, pos in iterator:\n            if start:\n                tag_mapping.get(tag, self._add_unknown_tag)(\n                    iterator, tag, data, config, pos)\n            elif tag == 'DESCRIPTION':\n                if self.description is not None:\n                    warn_or_raise(W17, W17, 'VOTABLE', config, pos)\n                self.description = data or None\n\n        if not len(self.resources) and config['version_1_2_or_later']:\n            warn_or_raise(W53, W53, (), config, pos)\n\n        return self\n\n    def to_xml(self, fd, compressed=False, tabledata_format=None,\n               _debug_python_based_parser=False, _astropy_version=None):\n        \"\"\"\n        Write to an XML file.\n\n        Parameters\n        ----------\n        fd : str or file-like\n            Where to write the file. If a file-like object, must be writable.\n\n        compressed : bool, optional\n            When `True`, write to a gzip-compressed file.  (Default:\n            `False`)\n\n        tabledata_format : str, optional\n            Override the format of the table(s) data to write.  Must\n            be one of ``tabledata`` (text representation), ``binary`` or\n            ``binary2``.  By default, use the format that was specified\n            in each `Table` object as it was created or read in.  See\n            :ref:`astropy:votable-serialization`.\n        \"\"\"\n        if tabledata_format is not None:\n            if tabledata_format.lower() not in (\n                    'tabledata', 'binary', 'binary2'):\n                raise ValueError(f\"Unknown format type '{format}'\")\n\n        kwargs = {\n            'version': self.version,\n            'tabledata_format':\n                tabledata_format,\n            '_debug_python_based_parser': _debug_python_based_parser,\n            '_group_number': 1}\n        kwargs.update(self._get_version_checks())\n\n        with util.convert_to_writable_filelike(\n            fd, compressed=compressed) as fd:\n            w = XMLWriter(fd)\n            version = self.version\n            if _astropy_version is None:\n                lib_version = astropy_version\n            else:\n                lib_version = _astropy_version\n\n            xml_header = \"\"\"\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Produced with astropy.io.votable version {lib_version}\n     http://www.astropy.org/ -->\\n\"\"\"\n            w.write(xml_header.lstrip().format(**locals()))\n\n            # Build the VOTABLE tag attributes.\n            votable_attr = {\n                'version': version,\n                'xmlns:xsi': \"http://www.w3.org/2001/XMLSchema-instance\"\n            }\n            ns_info = self._version_namespace_map.get(version, {})\n            namespace_uri = ns_info.get('namespace_uri')\n            if namespace_uri:\n                votable_attr['xmlns'] = namespace_uri\n            schema_location_attr = ns_info.get('schema_location_attr')\n            schema_location_value = ns_info.get('schema_location_value')\n            if schema_location_attr and schema_location_value:\n                votable_attr[schema_location_attr] = schema_location_value\n\n            with w.tag('VOTABLE', votable_attr):\n                if self.description is not None:\n                    w.element(\"DESCRIPTION\", self.description, wrap=True)\n                element_sets = [self.coordinate_systems, self.time_systems,\n                                self.params, self.infos, self.resources]\n                if kwargs['version_1_2_or_later']:\n                    element_sets[0] = self.groups\n                for element_set in element_sets:\n                    for element in element_set:\n                        element.to_xml(w, **kwargs)\n\n    def iter_tables(self):\n        \"\"\"\n        Iterates over all tables in the VOTable file in a \"flat\" way,\n        ignoring the nesting of resources etc.\n        \"\"\"\n        for resource in self.resources:\n            for table in resource.iter_tables():\n                yield table\n\n    def get_first_table(self):\n        \"\"\"\n        Often, you know there is only one table in the file, and\n        that's all you need.  This method returns that first table.\n        \"\"\"\n        for table in self.iter_tables():\n            if not table.is_empty():\n                return table\n        raise IndexError(\"No table found in VOTABLE file.\")\n\n    get_table_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_tables', 'TABLE',\n        \"\"\"\n        Looks up a TABLE_ element by the given ID.  Used by the table\n        \"ref\" attribute.\n        \"\"\")\n\n    get_tables_by_utype = _lookup_by_attr_factory(\n        'utype', False, 'iter_tables', 'TABLE',\n        \"\"\"\n        Looks up a TABLE_ element by the given utype, and returns an\n        iterator emitting all matches.\n        \"\"\")\n\n    def get_table_by_index(self, idx):\n        \"\"\"\n        Get a table by its ordinal position in the file.\n        \"\"\"\n        for i, table in enumerate(self.iter_tables()):\n            if i == idx:\n                return table\n        raise IndexError(\n            f\"No table at index {idx:d} found in VOTABLE file.\")\n\n    def iter_fields_and_params(self):\n        \"\"\"\n        Recursively iterate over all FIELD_ and PARAM_ elements in the\n        VOTABLE_ file.\n        \"\"\"\n        for resource in self.resources:\n            for field in resource.iter_fields_and_params():\n                yield field\n\n    get_field_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_fields_and_params', 'FIELD',\n        \"\"\"\n        Looks up a FIELD_ element by the given ID_.  Used by the field's\n        \"ref\" attribute.\n        \"\"\")\n\n    get_fields_by_utype = _lookup_by_attr_factory(\n        'utype', False, 'iter_fields_and_params', 'FIELD',\n        \"\"\"\n        Looks up a FIELD_ element by the given utype and returns an\n        iterator emitting all matches.\n        \"\"\")\n\n    get_field_by_id_or_name = _lookup_by_id_or_name_factory(\n        'iter_fields_and_params', 'FIELD',\n        \"\"\"\n        Looks up a FIELD_ element by the given ID_ or name.\n        \"\"\")\n\n    def iter_values(self):\n        \"\"\"\n        Recursively iterate over all VALUES_ elements in the VOTABLE_\n        file.\n        \"\"\"\n        for field in self.iter_fields_and_params():\n            yield field.values\n\n    get_values_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_values', 'VALUES',\n        \"\"\"\n        Looks up a VALUES_ element by the given ID.  Used by the values\n        \"ref\" attribute.\n        \"\"\")\n\n    def iter_groups(self):\n        \"\"\"\n        Recursively iterate over all GROUP_ elements in the VOTABLE_\n        file.\n        \"\"\"\n        for table in self.iter_tables():\n            for group in table.iter_groups():\n                yield group\n\n    get_group_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_groups', 'GROUP',\n        \"\"\"\n        Looks up a GROUP_ element by the given ID.  Used by the group's\n        \"ref\" attribute\n        \"\"\")\n\n    get_groups_by_utype = _lookup_by_attr_factory(\n        'utype', False, 'iter_groups', 'GROUP',\n        \"\"\"\n        Looks up a GROUP_ element by the given utype and returns an\n        iterator emitting all matches.\n        \"\"\")\n\n    def iter_coosys(self):\n        \"\"\"\n        Recursively iterate over all COOSYS_ elements in the VOTABLE_\n        file.\n        \"\"\"\n        for coosys in self.coordinate_systems:\n            yield coosys\n        for resource in self.resources:\n            for coosys in resource.iter_coosys():\n                yield coosys\n\n    get_coosys_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_coosys', 'COOSYS',\n        \"\"\"Looks up a COOSYS_ element by the given ID.\"\"\")\n\n    def iter_timesys(self):\n        \"\"\"\n        Recursively iterate over all TIMESYS_ elements in the VOTABLE_\n        file.\n        \"\"\"\n        for timesys in self.time_systems:\n            yield timesys\n        for resource in self.resources:\n            for timesys in resource.iter_timesys():\n                yield timesys\n\n    get_timesys_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_timesys', 'TIMESYS',\n        \"\"\"Looks up a TIMESYS_ element by the given ID.\"\"\")\n\n    def iter_info(self):\n        \"\"\"\n        Recursively iterate over all INFO_ elements in the VOTABLE_\n        file.\n        \"\"\"\n        for info in self.infos:\n            yield info\n        for resource in self.resources:\n            for info in resource.iter_info():\n                yield info\n\n    get_info_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_info', 'INFO',\n        \"\"\"Looks up a INFO element by the given ID.\"\"\")\n\n    def set_all_tables_format(self, format):\n        \"\"\"\n        Set the output storage format of all tables in the file.\n        \"\"\"\n        for table in self.iter_tables():\n            table.format = format\n\n    @classmethod\n    def from_table(cls, table, table_id=None):\n        \"\"\"\n        Create a `VOTableFile` instance from a given\n        `astropy.table.Table` instance.\n\n        Parameters\n        ----------\n        table_id : str, optional\n            Set the given ID attribute on the returned Table instance.\n        \"\"\"\n        votable_file = cls()\n        resource = Resource()\n        votable = Table.from_table(votable_file, table)\n        if table_id is not None:\n            votable.ID = table_id\n        resource.tables.append(votable)\n        votable_file.resources.append(resource)\n        return votable_file"},{"id":6126,"name":"VOTable.v1.2.xsd","nodeType":"TextFile","path":"astropy/io/votable/data","text":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--W3C Schema for VOTable  = Virtual Observatory Tabular Format\n.Version 1.0 : 15-Apr-2002\n.Version 1.09: 23-Jan-2004 Version 1.09\n.Version 1.09: 30-Jan-2004 Version 1.091\n.Version 1.09: 22-Mar-2004 Version 1.092\n.Version 1.094: 02-Jun-2004 GROUP does not contain FIELD\n.Version 1.1 :  10-Jun-2004 remove the complexContent\n.Version 1.11: GL: 23-May-2006 remove most root elements, use name= type= iso ref= structure\n.Version 1.11: GL: 29-Aug-2006 review and added comments (prefixed by GL) \n              before sending to Francois Ochsenbein\n.Version 1.12: FO: Preliminary Version 1.2\n.Version 1.18: FO: Tested (jax) version 1.2\n.Version 1.19: FO: Completed INFO attributes\n.Version 1.20: FO: Added xtype; content-role is less restrictive (May2009)\n.Version 1.20a: FO: PR-20090710 Cosmetics.\n.Version 1.20b: FO: INFO does not accept sub-elements (2009-09-29)\n.Version 1.20c: FO: elementFormDefault=\"qualified\" to stay compatible with 1.1\n-->\n<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" elementFormDefault=\"qualified\" xmlns=\"http://www.ivoa.net/xml/VOTable/v1.2\" targetNamespace=\"http://www.ivoa.net/xml/VOTable/v1.2\">\n<xs:annotation><xs:documentation>\n    VOTable1.2 is meant to serialize tabular documents in the\n    context of Virtual Observatory applications. This schema\n    corresponds to the VOTable document available from\n    http://www.ivoa.net/Documents/latest/VOT.html\n</xs:documentation></xs:annotation>\n\n<!-- Here we define some interesting new datatypes:\n     - anyTEXT   may have embedded XHTML (conforming HTML)\n     - astroYear is an epoch in Besselian or Julian year, e.g. J2000\n     - arrayDEF  specifies an array size e.g. 12x23x*\n     - dataType  defines the acceptable datatypes\n     - ucdType   defines the acceptable UCDs (UCD1+)\n     - precType  defines the acceptable precisions\n     - yesno     defines just the 2 alternatives\n-->\n\n<xs:complexType name=\"anyTEXT\" mixed=\"true\">\n  <xs:sequence>\n    <xs:any minOccurs=\"0\" maxOccurs=\"unbounded\" processContents=\"skip\"/>\n  </xs:sequence>\n</xs:complexType>\n\n<xs:simpleType name=\"astroYear\">\n  <xs:restriction base=\"xs:token\">\n    <xs:pattern value=\"[JB]?[0-9]+([.][0-9]*)?\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"ucdType\">\n  <xs:restriction base=\"xs:token\">\n    <xs:annotation><xs:documentation>\n      Accept UCD1+\n      Accept also old UCD1 (but not / + %) including SIAP convention (with :)\n    </xs:documentation></xs:annotation>\n    <xs:pattern value=\"[A-Za-z0-9_.:;\\-]*\"/><!-- UCD1 use also / + % -->\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"arrayDEF\">\n  <xs:restriction base=\"xs:token\">\n    <xs:pattern value=\"([0-9]+x)*[0-9]*[*]?(s\\W)?\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"encodingType\">\n  <xs:restriction base=\"xs:NMTOKEN\">\n    <xs:enumeration value=\"gzip\"/>\n    <xs:enumeration value=\"base64\"/>\n    <xs:enumeration value=\"dynamic\"/>\n    <xs:enumeration value=\"none\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"dataType\">\n  <xs:restriction base=\"xs:NMTOKEN\">\n    <xs:enumeration value=\"boolean\"/>\n    <xs:enumeration value=\"bit\"/>\n    <xs:enumeration value=\"unsignedByte\"/>\n    <xs:enumeration value=\"short\"/>\n    <xs:enumeration value=\"int\"/>\n    <xs:enumeration value=\"long\"/>\n    <xs:enumeration value=\"char\"/>\n    <xs:enumeration value=\"unicodeChar\"/>\n    <xs:enumeration value=\"float\"/>\n    <xs:enumeration value=\"double\"/>\n    <xs:enumeration value=\"floatComplex\"/>\n    <xs:enumeration value=\"doubleComplex\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"precType\">\n  <xs:restriction base=\"xs:token\">\n    <xs:pattern value=\"[EF]?[1-9][0-9]*\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"yesno\">\n  <xs:restriction base=\"xs:NMTOKEN\">\n    <xs:enumeration value=\"yes\"/>\n    <xs:enumeration value=\"no\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n  <xs:complexType name=\"Min\">\n    <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n    <xs:attribute name=\"inclusive\" type=\"yesno\" default=\"yes\"/>\n  </xs:complexType>\n  <xs:complexType name=\"Max\">\n    <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n    <xs:attribute name=\"inclusive\" type=\"yesno\" default=\"yes\"/>\n  </xs:complexType>\n  <xs:complexType name=\"Option\">\n    <xs:sequence>\n      <xs:element name=\"OPTION\" type=\"Option\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    </xs:sequence>\n    <xs:attribute name=\"name\" type=\"xs:token\"/>\n    <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n  </xs:complexType>\n  \n  <!-- VALUES expresses the values that can be taken by the data \n    in a column or by a parameter\n  -->\n  <xs:complexType name=\"Values\">\n    <xs:sequence>\n      <xs:element name=\"MIN\" type=\"Min\" minOccurs=\"0\"/>\n      <xs:element name=\"MAX\" type=\"Max\" minOccurs=\"0\"/>\n      <xs:element name=\"OPTION\" type=\"Option\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    </xs:sequence>\n    <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n    <xs:attribute name=\"type\" default=\"legal\">\n      <xs:simpleType>\n        <xs:restriction base=\"xs:NMTOKEN\">\n          <xs:enumeration value=\"legal\"/>\n          <xs:enumeration value=\"actual\"/>\n        </xs:restriction>\n      </xs:simpleType>\n    </xs:attribute>\n    <xs:attribute name=\"null\" type=\"xs:token\"/>\n    <xs:attribute name=\"ref\" type=\"xs:IDREF\"/>\n    <!-- xs:attribute name=\"invalid\" type=\"yesno\" default=\"no\"/ -->\n  </xs:complexType>\n  \n  <!-- The LINK is a URL (href) or some other kind of reference (gref) -->\n  <xs:complexType name=\"Link\">\n    <xs:annotation><xs:documentation> \n    content-role was previously restricted as: <![CDATA[\n    <xs:attribute name=\"content-role\">\n      <xs:simpleType>\n        <xs:restriction base=\"xs:NMTOKEN\">\n          <xs:enumeration value=\"query\"/>\n          <xs:enumeration value=\"hints\"/>\n          <xs:enumeration value=\"doc\"/>\n          <xs:enumeration value=\"location\"/>\n        </xs:restriction>\n      </xs:simpleType>\n    </xs:attribute>]]>; is now a name token.\n    </xs:documentation></xs:annotation>\n    <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n    <xs:attribute name=\"content-role\" type=\"xs:NMTOKEN\"/>\n    <xs:attribute name=\"content-type\" type=\"xs:NMTOKEN\"/>\n    <xs:attribute name=\"title\" type=\"xs:string\"/>\n    <xs:attribute name=\"value\" type=\"xs:string\"/>\n    <xs:attribute name=\"href\" type=\"xs:anyURI\"/>\n    <xs:attribute name=\"gref\" type=\"xs:token\"/><!-- Deprecated in V1.1 -->\n    <xs:attribute name=\"action\" type=\"xs:anyURI\"/>\n  </xs:complexType>\n  \n<!-- INFO is defined in Version 1.2 as a PARAM of String type \n<xs:complexType name=\"Info\">\n  <xs:complexContent>\n    <xs:restriction base=\"Param\">\n      <xs:attribute name=\"unit\" fixed=\"\"/>\n      <xs:attribute name=\"datatype\" fixed=\"char\"/>\n      <xs:attribute name=\"arraysize\" fixed=\"*\"/>\n    </xs:restriction>\n  </xs:complexContent>\n</xs:complexType>\n -or- as a full definition:\n<xs:complexType name=\"Info\">\n  <xs:sequence> \n  <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n    <xs:element name=\"VALUES\" type=\"Values\" minOccurs=\"0\"/>\n    <xs:element name=\"LINK\" type=\"Link\" minOccurs=\"0\" maxOccurs=\"unbounded\"/> \n  </xs:sequence>\n  <xs:attribute name=\"name\" type=\"xs:token\" use=\"required\"/>\n  <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n  <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n  <xs:attribute name=\"unit\" type=\"xs:token\"/>\n  <xs:attribute name=\"xtype\" type=\"xs:token\"/>\n  <xs:attribute name=\"ref\" type=\"xs:IDREF\"/>\n  <xs:attribute name=\"ucd\" type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n</xs:complexType>\n-->\n<!-- No sub-element is accepted in INFO for backward compatibility -->\n<xs:complexType name=\"Info\">\n  <xs:simpleContent>\n    <xs:extension base=\"xs:string\">\n      <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n      <xs:attribute name=\"name\" type=\"xs:token\" use=\"required\"/>\n      <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n      <xs:attribute name=\"unit\" type=\"xs:token\"/>\n      <xs:attribute name=\"xtype\" type=\"xs:token\"/>\n      <xs:attribute name=\"ref\" type=\"xs:IDREF\"/>\n      <xs:attribute name=\"ucd\" type=\"ucdType\"/>\n      <xs:attribute name=\"utype\" type=\"xs:string\"/>\n    </xs:extension>\n  </xs:simpleContent>\n</xs:complexType>\n\n<!-- Expresses the coordinate system we are using --><!-- Deprecated V1.2 -->\n<xs:complexType name=\"CoordinateSystem\">\n  <xs:annotation><xs:documentation>\n    Deprecated in Version 1.2\n  </xs:documentation></xs:annotation>\n  <xs:simpleContent>\n    <xs:extension base=\"xs:string\">\n      <xs:attribute name=\"ID\" type=\"xs:ID\" use=\"required\"/>\n      <xs:attribute name=\"equinox\" type=\"astroYear\"/>\n      <xs:attribute name=\"epoch\" type=\"astroYear\"/>\n      <xs:attribute name=\"system\" default=\"eq_FK5\">\n        <xs:simpleType>\n          <xs:restriction base=\"xs:NMTOKEN\">\n            <xs:enumeration value=\"eq_FK4\"/>\n            <xs:enumeration value=\"eq_FK5\"/>\n            <xs:enumeration value=\"ICRS\"/>\n            <xs:enumeration value=\"ecl_FK4\"/>\n            <xs:enumeration value=\"ecl_FK5\"/>\n            <xs:enumeration value=\"galactic\"/>\n            <xs:enumeration value=\"supergalactic\"/>\n            <xs:enumeration value=\"xy\"/>\n            <xs:enumeration value=\"barycentric\"/>\n            <xs:enumeration value=\"geo_app\"/>\n          </xs:restriction>\n        </xs:simpleType>\n      </xs:attribute>\n    </xs:extension>\n  </xs:simpleContent>\n</xs:complexType>\n\n<xs:complexType name=\"Definitions\">\n  <xs:annotation><xs:documentation>\n    Deprecated in Version 1.1\n  </xs:documentation></xs:annotation>\n  <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n    <xs:element name=\"COOSYS\" type=\"CoordinateSystem\"/><!-- Deprecated in V1.2 -->\n    <xs:element name=\"PARAM\" type=\"Param\"/>\n  </xs:choice>\n</xs:complexType>\n\n<!-- FIELD is the definition of what is in a column of the table -->\n<xs:complexType name=\"Field\">\n  <xs:sequence> <!-- minOccurs=\"0\" maxOccurs=\"unbounded\" -->\n    <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n    <xs:element name=\"VALUES\" type=\"Values\" minOccurs=\"0\"/> <!-- maxOccurs=\"2\" -->\n    <xs:element name=\"LINK\" type=\"Link\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n  <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n  <xs:attribute name=\"unit\" type=\"xs:token\"/>\n  <xs:attribute name=\"datatype\" type=\"dataType\" use=\"required\"/>\n  <xs:attribute name=\"precision\" type=\"precType\"/>\n  <xs:attribute name=\"width\" type=\"xs:positiveInteger\"/>\n  <xs:attribute name=\"xtype\" type=\"xs:token\"/>\n  <xs:attribute name=\"ref\" type=\"xs:IDREF\"/>\n  <xs:attribute name=\"name\" type=\"xs:token\" use=\"required\"/>\n  <xs:attribute name=\"ucd\" type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n  <xs:attribute name=\"arraysize\" type=\"xs:string\"/>\n    <!-- GL: is the next deprecated element remaining \n        (is not in PARAM, but will in new model be inherited) \n    -->\n  <xs:attribute name=\"type\">\n    <!-- type is not in the Version 1.1, but is kept for\n         backward compatibility purposes\n    -->\n    <xs:simpleType>\n      <xs:restriction base=\"xs:NMTOKEN\">\n        <xs:enumeration value=\"hidden\"/>\n        <xs:enumeration value=\"no_query\"/>\n        <xs:enumeration value=\"trigger\"/>\n        <xs:enumeration value=\"location\"/>\n      </xs:restriction>\n    </xs:simpleType>\n  </xs:attribute>\n</xs:complexType>\n\n\n<!-- A PARAM is similar to a FIELD, but it also has a \"value\" attribute -->\n<!--  GL: implemented here as a subtype as suggested we do in Kyoto. -->\n<xs:complexType name=\"Param\">\n  <xs:complexContent>\n    <xs:extension base=\"Field\">\n      <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n    </xs:extension>\n  </xs:complexContent>\n</xs:complexType>\n\n\n<!-- GROUP groups columns; may include descriptions, fields/params/groups -->\n<xs:complexType name=\"Group\">\n  <xs:sequence>\n    <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n<!--  GL I guess I can understand the next choice element as one may (?) \n      really want to group fields and params and groups in a particular order.\n-->    \n    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n      <xs:element name=\"FIELDref\" type=\"FieldRef\"/> \n      <xs:element name=\"PARAMref\" type=\"ParamRef\"/> \n      <xs:element name=\"PARAM\" type=\"Param\"/> \n      <xs:element name=\"GROUP\" type=\"Group\"/> \n      <!-- GL a GroupRef could remove recursion -->\n    </xs:choice>\n  </xs:sequence>\n  <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n  <xs:attribute name=\"name\" type=\"xs:token\"/>\n  <xs:attribute name=\"ref\" type=\"xs:IDREF\"/>\n  <xs:attribute name=\"ucd\" type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n</xs:complexType>\n\n<!-- FIELDref and PARAMref are references to FIELD or PARAM defined\n     in the parent TABLE or RESOURCE -->\n<!-- GL This can not be enforced in XML Schema, so why not IDREF in <Group> ?\n     In particular if the UCD and utype attributes will NOT be added -->\n<xs:complexType name=\"FieldRef\">\n  <xs:attribute name=\"ref\" type=\"xs:IDREF\" use=\"required\"/>\n  <xs:attribute name=\"ucd\" type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n</xs:complexType>\n\n<xs:complexType name=\"ParamRef\">\n  <xs:attribute name=\"ref\" type=\"xs:IDREF\" use=\"required\"/>\n  <xs:attribute name=\"ucd\" type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n</xs:complexType>\n\n<!-- DATA is the actual table data, in one of three formats -->\n<!-- \n  GL in Kyoto we discussed the option of having the specific Data items \n  be subtypes of Data:\n-->\n<!-- \n<xs:complexType name=\"Data\" abstract=\"true\"/>\n\n<xs:complexType name=\"TableData\">\n  <xs:complexContent>\n    <xs:extension base=\"Data\">\n     ... etc\n    </xs:extension>\n  </xs:complexContent>\n</xs:complexType>\n -->\n<xs:complexType name=\"Data\">\n  <xs:annotation><xs:documentation>\n    Added in Version 1.2: INFO for diagnostics\n  </xs:documentation></xs:annotation>\n  <xs:sequence>\n    <xs:choice>\n      <xs:element name=\"TABLEDATA\" type=\"TableData\"/>\n      <xs:element name=\"BINARY\" type=\"Binary\"/>\n      <xs:element name=\"FITS\" type=\"FITS\"/>\n    </xs:choice>\n    <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n</xs:complexType>\n\n<!-- Pure XML data -->\n<xs:complexType name=\"TableData\">\n  <xs:sequence>\n    <xs:element name=\"TR\" type=\"Tr\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n</xs:complexType>\n\n<xs:complexType name=\"Td\">\n  <xs:simpleContent>\n    <xs:extension base=\"xs:string\">\n      <!-- xs:attribute name=\"ref\" type=\"xs:IDREF\"/ -->\n      <xs:annotation><xs:documentation>\n          The 'encoding' attribute is added here to avoid\n          problems of code generators which do not properly\n          interpret the TR/TD structures.\n          'encoding' was chosen because it appears in\n          appendix A.5\n      </xs:documentation></xs:annotation>\n      <xs:attribute name=\"encoding\" type=\"encodingType\"/>\n    </xs:extension>\n  </xs:simpleContent>\n</xs:complexType>\n\n<xs:complexType name=\"Tr\">\n  <xs:annotation><xs:documentation>\n    The ID attribute is added here to the TR tag to avoid \n    problems of code generators which do not properly \n    interpret the TR/TD structures\n  </xs:documentation></xs:annotation>\n  <xs:sequence>\n    <xs:element name=\"TD\" type=\"Td\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n  <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n</xs:complexType>\n\n<!-- FITS file, perhaps with specification of which extension to seek to -->\n<xs:complexType name=\"FITS\">\n  <xs:sequence>\n    <xs:element name=\"STREAM\" type=\"Stream\"/>\n  </xs:sequence>\n  <xs:attribute name=\"extnum\" type=\"xs:positiveInteger\"/>\n</xs:complexType>\n\n<!-- BINARY data format -->\n<xs:complexType name=\"Binary\">\n  <xs:sequence>\n    <xs:element name=\"STREAM\" type=\"Stream\"/>\n  </xs:sequence>\n</xs:complexType>\n\n<!-- STREAM can be local or remote, encoded or not -->\n<xs:complexType name=\"Stream\">\n  <xs:simpleContent>\n    <xs:extension base=\"xs:string\">\n      <xs:attribute name=\"type\" default=\"locator\">\n        <xs:simpleType>\n          <xs:restriction base=\"xs:NMTOKEN\">\n            <xs:enumeration value=\"locator\"/>\n            <xs:enumeration value=\"other\"/>\n          </xs:restriction>\n        </xs:simpleType>\n      </xs:attribute>\n      <xs:attribute name=\"href\" type=\"xs:anyURI\"/>\n      <xs:attribute name=\"actuate\" default=\"onRequest\">\n        <xs:simpleType>\n          <xs:restriction base=\"xs:NMTOKEN\">\n            <xs:enumeration value=\"onLoad\"/>\n            <xs:enumeration value=\"onRequest\"/>\n            <xs:enumeration value=\"other\"/>\n            <xs:enumeration value=\"none\"/>\n          </xs:restriction>\n        </xs:simpleType>\n      </xs:attribute>\n      <xs:attribute name=\"encoding\" type=\"encodingType\" default=\"none\"/>\n      <xs:attribute name=\"expires\" type=\"xs:dateTime\"/>\n      <xs:attribute name=\"rights\" type=\"xs:token\"/>\n    </xs:extension>\n  </xs:simpleContent>\n</xs:complexType>\n\n<!-- A TABLE is a sequence of FIELD/PARAMs and LINKS and DESCRIPTION, \n     possibly followed by a DATA section \n-->\n<xs:complexType name=\"Table\">\n  <xs:annotation><xs:documentation>\n    Added in Version 1.2: INFO for diagnostics\n  </xs:documentation></xs:annotation>\n  <xs:sequence>\n    <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n<!-- GL: why a choice iso for example -->\n<!-- \n      <xs:element name=\"PARAM\" type=\"Param\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n      <xs:element name=\"FIELD\" type=\"Field\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n      <xs:element name=\"GROUP\" type=\"Group\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n-->\n<!-- \n  This could also enforce groups to be defined after the fields and params \n  to which they must have a reference, which is somewhat more logical\n-->\n    <!-- Added Version 1.2: -->\n    <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/> \n    <!-- An empty table without any FIELD/PARAM should not be acceptable -->\n    <xs:choice minOccurs=\"1\" maxOccurs=\"unbounded\"> \n      <xs:element name=\"FIELD\" type=\"Field\"/>\n      <xs:element name=\"PARAM\" type=\"Param\"/>\n      <xs:element name=\"GROUP\" type=\"Group\"/>\n    </xs:choice>\n    <xs:element name=\"LINK\" type=\"Link\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    <!-- This would allow several DATA parts in a table (future extension?)\n    <xs:sequence minOccurs=\"0\" maxOccurs=\"unbounded\">  \n      <xs:element name=\"DATA\" type=\"Data\"/>\n      <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    </xs:sequence>\n    -->\n    <xs:element name=\"DATA\" type=\"Data\" minOccurs=\"0\"/>\n    <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n  <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n  <xs:attribute name=\"name\" type=\"xs:token\"/>\n  <xs:attribute name=\"ref\" type=\"xs:IDREF\"/>\n  <xs:attribute name=\"ucd\" type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n  <xs:attribute name=\"nrows\" type=\"xs:nonNegativeInteger\"/>\n</xs:complexType>\n\n<!-- RESOURCES can contain DESCRIPTION, (INFO|PARAM|COSYS), LINK, TABLEs -->\n<xs:complexType name=\"Resource\">\n  <xs:annotation><xs:documentation>\n     Added in Version 1.2: INFO for diagnostics in several places\n  </xs:documentation></xs:annotation>\n  <xs:sequence>\n    <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n    <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n      <xs:element name=\"COOSYS\" type=\"CoordinateSystem\"/><!-- Deprecated in V1.2 -->\n      <xs:element name=\"GROUP\" type=\"Group\"/>\n      <xs:element name=\"PARAM\" type=\"Param\"/>\n    </xs:choice>\n    <xs:sequence minOccurs=\"0\" maxOccurs=\"unbounded\">\n      <xs:element name=\"LINK\" type=\"Link\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n      <xs:choice>\n        <xs:element name=\"TABLE\" type=\"Table\"/>\n        <xs:element name=\"RESOURCE\" type=\"Resource\"/>\n      </xs:choice>\n      <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    </xs:sequence>\n    <!-- Suggested Doug Tody, to include new RESOURCE types -->\n    <xs:any namespace=\"##other\" processContents=\"lax\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n  <xs:attribute name=\"name\" type=\"xs:token\"/>\n  <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n  <xs:attribute name=\"type\" default=\"results\">\n    <xs:simpleType>\n      <xs:restriction base=\"xs:NMTOKEN\">\n        <xs:enumeration value=\"results\"/>\n        <xs:enumeration value=\"meta\"/>\n      </xs:restriction>\n    </xs:simpleType>\n  </xs:attribute>\n  <!-- Suggested Doug Tody, to include new RESOURCE attributes -->\n  <xs:anyAttribute namespace=\"##other\" processContents=\"lax\"/>\n</xs:complexType>\n\n<!-- VOTable is the root element -->\n<xs:element name=\"VOTABLE\">\n<xs:complexType>\n  <xs:sequence>\n    <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n    <xs:element name=\"DEFINITIONS\" type=\"Definitions\" minOccurs=\"0\"/><!-- Deprecated -->\n    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n      <xs:element name=\"COOSYS\" type=\"CoordinateSystem\"/><!-- Deprecated in V1.2 -->\n      <xs:element name=\"GROUP\" type=\"Group\"/>\n      <xs:element name=\"PARAM\" type=\"Param\"/>\n      <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    </xs:choice>\n    <xs:element name=\"RESOURCE\" type=\"Resource\" minOccurs=\"1\" maxOccurs=\"unbounded\"/>\n    <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n  <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n  <xs:attribute name=\"version\">\n     <xs:simpleType>\n       <xs:restriction base=\"xs:NMTOKEN\">\n         <xs:enumeration value=\"1.2\"/>\n       </xs:restriction>\n     </xs:simpleType>\n   </xs:attribute>\n</xs:complexType>\n</xs:element>\n\n</xs:schema>"},{"col":0,"comment":"\n    Get the lines from a given XML file.  Correctly determines the\n    encoding and always returns unicode.\n\n    Parameters\n    ----------\n    source : path-like, readable file-like, or callable\n        Handle that contains the data or function that reads it.\n        If a function or callable object, it must directly read from a stream.\n        Non-callable objects must define a ``read`` method.\n\n    Returns\n    -------\n    lines : list of unicode\n    ","endLoc":214,"header":"def xml_readlines(source)","id":6127,"name":"xml_readlines","nodeType":"Function","startLoc":192,"text":"def xml_readlines(source):\n    \"\"\"\n    Get the lines from a given XML file.  Correctly determines the\n    encoding and always returns unicode.\n\n    Parameters\n    ----------\n    source : path-like, readable file-like, or callable\n        Handle that contains the data or function that reads it.\n        If a function or callable object, it must directly read from a stream.\n        Non-callable objects must define a ``read`` method.\n\n    Returns\n    -------\n    lines : list of unicode\n    \"\"\"\n    encoding = get_xml_encoding(source)\n\n    with data.get_readable_fileobj(source, encoding=encoding) as input:\n        input.seek(0)\n        xml_lines = input.readlines()\n\n    return xml_lines"},{"col":0,"comment":"\n    Determine the encoding of an XML file by reading its header.\n\n    Parameters\n    ----------\n    source : path-like, readable file-like, or callable\n        Handle that contains the data or function that reads it.\n        If a function or callable object, it must directly read from a stream.\n        Non-callable objects must define a ``read`` method.\n\n    Returns\n    -------\n    encoding : str\n    ","endLoc":189,"header":"def get_xml_encoding(source)","id":6128,"name":"get_xml_encoding","nodeType":"Function","startLoc":168,"text":"def get_xml_encoding(source):\n    \"\"\"\n    Determine the encoding of an XML file by reading its header.\n\n    Parameters\n    ----------\n    source : path-like, readable file-like, or callable\n        Handle that contains the data or function that reads it.\n        If a function or callable object, it must directly read from a stream.\n        Non-callable objects must define a ``read`` method.\n\n    Returns\n    -------\n    encoding : str\n    \"\"\"\n    with get_xml_iterator(source) as iterator:\n        start, tag, data, pos = next(iterator)\n        if not start or tag != 'xml':\n            raise OSError('Invalid XML file')\n\n    # The XML spec says that no encoding === utf-8\n    return data.get('encoding') or 'utf-8'"},{"id":6129,"name":"VOTable.dtd","nodeType":"TextFile","path":"astropy/io/votable/data","text":"<!-- DOCUMENT TYPE DEFINITION for VOTable = Virtual Observatory Tabular Format\n     See History at      http://vizier.u-strasbg.fr/doc/VOTable\n     See Discussions at  http://archives.us-vo.org/VOTable\n     Reference DTD as    http://us-vo.org/xml/VOTable.dtd\n\t\tor at    http://cdsweb.u-strasbg.fr/xml/VOTable.dtd\n     XML Schema at       http://us-vo.org/xml/VOTable.xsd\n\t\tor at    http://cdsweb.u-strasbg.fr/xml/VOTable.xsd\n.Version 1.0 : 15-Apr-2002\n-->\n\n<!-- VOTABLE is the root element -->\n<!ELEMENT VOTABLE (DESCRIPTION?, DEFINITIONS?, INFO*, RESOURCE*)>\n<!ATTLIST VOTABLE\n        ID ID #IMPLIED\n        version CDATA #IMPLIED\n>\n\n<!-- RESOURCEs can contain other RESOURCES,\n     together with TABLEs and other stuff -->\n<!ELEMENT RESOURCE (DESCRIPTION?, INFO*, COOSYS*, PARAM*, LINK*, \n     TABLE*, RESOURCE*)>\n<!ATTLIST RESOURCE\n        name CDATA #IMPLIED\n        ID ID #IMPLIED\n        type (results | meta) \"results\"\n>\n\n<!ELEMENT DESCRIPTION (#PCDATA)>\n<!ELEMENT DEFINITIONS (COOSYS?, PARAM?)*>\n\n<!-- INFO is a name-value pair -->\n<!ELEMENT INFO (#PCDATA)>\n<!ATTLIST INFO\n        ID ID #IMPLIED\n        name CDATA #IMPLIED\n        value CDATA #IMPLIED\n>\n\n<!-- A PARAM is similar to a FIELD, but it also has a \"value attribute -->\n<!ELEMENT PARAM (DESCRIPTION?, VALUES?, LINK*)>\n<!ATTLIST PARAM\n        ID ID #IMPLIED\n        unit CDATA #IMPLIED\n        datatype (boolean | bit | unsignedByte | short | int | long | char\n\t| unicodeChar | float | double | floatComplex | doubleComplex) #IMPLIED\n        precision CDATA #IMPLIED\n        width CDATA #IMPLIED\n        ref IDREF #IMPLIED\n        name CDATA #IMPLIED\n        ucd CDATA #IMPLIED\n        value CDATA #IMPLIED\n        arraysize CDATA #IMPLIED\n>\n\n<!-- A TABLE is a sequence of FIELDS and LINKS and DESCRIPTION,\n     possibly followed by a DATA section -->\n<!-- ELEMENT TABLE (DESCRIPTION?, LINK*, FIELD*, DATA?) -->\n<!ELEMENT TABLE (DESCRIPTION?, FIELD*, LINK*, DATA?)>\n<!ATTLIST TABLE\n        ID ID #IMPLIED\n        name CDATA #IMPLIED\n        ref IDREF #IMPLIED\n>\n\n<!-- FIELD is the definition of what is in a column of the table -->\n<!-- A field may have 2 sets of VALUES: \"legfal\" and \"actual\" -->\n<!ELEMENT FIELD (DESCRIPTION?, VALUES*, LINK*)>\n<!ATTLIST FIELD\n        ID ID #IMPLIED\n        unit CDATA #IMPLIED\n        datatype (boolean | bit | unsignedByte | short | int | long | char\n\t| unicodeChar | float | double | floatComplex | doubleComplex) #IMPLIED\n        precision CDATA #IMPLIED\n        width CDATA #IMPLIED\n        ref IDREF #IMPLIED\n        name CDATA #IMPLIED\n        ucd CDATA #IMPLIED\n        arraysize CDATA #IMPLIED\n        type (hidden | no_query | trigger) #IMPLIED\n>\n\n<!-- VALUES expresses the values that can be taken by the data in a column. -->\n<!ELEMENT VALUES (MIN?, MAX?, OPTION*)>\n<!ATTLIST VALUES\n        ID ID #IMPLIED\n        type (legal | actual) \"legal\"\n        null CDATA #IMPLIED\n        invalid (yes | no) \"no\"\n>\n<!ELEMENT MIN (#PCDATA)>\n<!ATTLIST MIN\n        value CDATA #REQUIRED\n        inclusive (yes | no) \"yes\"\n>\n<!ELEMENT MAX (#PCDATA)>\n<!ATTLIST MAX\n        value CDATA #REQUIRED\n        inclusive (yes | no) \"yes\"\n>\n<!ELEMENT OPTION (OPTION*)>\n<!ATTLIST OPTION\n        name CDATA #IMPLIED\n        value CDATA #REQUIRED\n>\n\n<!-- The link is a URL (href) or some other kind of reference (gref). -->\n<!ELEMENT LINK (#PCDATA)>\n<!ATTLIST LINK\n        ID ID #IMPLIED\n        content-role (query | hints | doc) #IMPLIED\n        content-type CDATA #IMPLIED\n        title CDATA #IMPLIED\n        value CDATA #IMPLIED\n        href CDATA #IMPLIED\n        gref CDATA #IMPLIED\n        action CDATA #IMPLIED\n>\n\n<!-- DATA is the actual table data, in one of three formats -->\n<!ELEMENT DATA (TABLEDATA | BINARY | FITS)>\n\n<!-- Pure XML data -->\n<!ELEMENT TABLEDATA (TR*)>\n<!ELEMENT TR (TD+)>\n<!ELEMENT TD (#PCDATA)>\n<!ATTLIST TD\n        ref IDREF #IMPLIED\n>\n\n<!-- FITS file, perhaps with specification of which extension to seek to -->\n<!ELEMENT FITS (STREAM)>\n<!ATTLIST FITS\n        extnum CDATA #IMPLIED\n>\n\n<!-- Binary data format -->\n<!ELEMENT BINARY (STREAM)>\n\n<!-- Stream can be local or remote, encoded or not -->\n<!ELEMENT STREAM (#PCDATA)>\n<!ATTLIST STREAM\n        type (locator | other) \"locator\"\n        href CDATA #IMPLIED\n        actuate (onLoad | onRequest | other | none) \"onRequest\"\n        encoding (gzip | base64 | dynamic | none) \"none\"\n        expires CDATA #IMPLIED\n        rights CDATA #IMPLIED\n>\n\n<!-- Expresses the coordinate system we are using -->\n<!ELEMENT COOSYS (#PCDATA)>\n<!ATTLIST COOSYS\n        ID ID #IMPLIED\n        equinox CDATA #IMPLIED\n        epoch CDATA #IMPLIED\n        system (eq_FK4 | eq_FK5 | ICRS | ecl_FK4 | ecl_FK5 | galactic\n               | supergalactic | xy | barycentric | geo_app) \"eq_FK5\"\n>\n"},{"id":6130,"name":"VOTable.v1.4.xsd","nodeType":"TextFile","path":"astropy/io/votable/data","text":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--W3C Schema for VOTable  = Virtual Observatory Tabular Format\n.Version 1.0 : 15-Apr-2002\n.Version 1.09: 23-Jan-2004 Version 1.09\n.Version 1.09: 30-Jan-2004 Version 1.091\n.Version 1.09: 22-Mar-2004 Version 1.092\n.Version 1.094: 02-Jun-2004 GROUP does not contain FIELD\n.Version 1.1 :  10-Jun-2004 remove the complexContent\n.Version 1.11: GL: 23-May-2006 remove most root elements, use name= type= iso ref= structure\n.Version 1.11: GL: 29-Aug-2006 review and added comments (prefixed by GL) \n              before sending to Francois Ochsenbein\n.Version 1.12: FO: Preliminary Version 1.2\n.Version 1.18: FO: Tested (jax) version 1.2\n.Version 1.19: FO: Completed INFO attributes\n.Version 1.20: FO: Added xtype; content-role is less restrictive (May2009)\n.Version 1.20a: FO: PR-20090710 Cosmetics.\n.Version 1.20b: FO: INFO does not accept sub-elements (2009-09-29)\n.Version 1.20c: FO: elementFormDefault=\"qualified\" to stay compatible with 1.1\n.Version 1.3: MT: Added BINARY2 element\n.Version 1.3: MT: Further relaxed LINK content-role type to token\n.Version 1.3-Erratum-2 MT: Made slight change to precType pattern\n.Version 1.4pre1: MD: merged 1.3-Erratrum 2, added TIMESYS.\n.Version 1.4wd-a: TD: updates for initial draft of v1.4.\n.Version 1.4: TD: Change version to 1.4\n-->\n<xs:schema \n   xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" elementFormDefault=\"qualified\"\n   xmlns=\"http://www.ivoa.net/xml/VOTable/v1.3\"\n   targetNamespace=\"http://www.ivoa.net/xml/VOTable/v1.3\" \n   version=\"1.4\"\n>\n<xs:annotation><xs:documentation>\n    VOTable is meant to serialize tabular documents in the\n    context of Virtual Observatory applications. This schema\n    corresponds to the VOTable document available from\n    http://www.ivoa.net/Documents/latest/VOT.html\n</xs:documentation></xs:annotation>\n\n<!-- Here we define some interesting new datatypes:\n     - anyTEXT   may have embedded XHTML (conforming HTML)\n     - astroYear is an epoch in Besselian or Julian year, e.g. J2000\n     - arrayDEF  specifies an array size e.g. 12x23x*\n     - dataType  defines the acceptable datatypes\n     - ucdType   defines the acceptable UCDs (UCD1+)\n     - precType  defines the acceptable precisions\n     - yesno     defines just the 2 alternatives\n-->\n\n<xs:complexType name=\"anyTEXT\" mixed=\"true\">\n  <xs:sequence>\n    <xs:any minOccurs=\"0\" maxOccurs=\"unbounded\" processContents=\"skip\"/>\n  </xs:sequence>\n</xs:complexType>\n\n<xs:simpleType  name=\"astroYear\">\n  <xs:restriction base=\"xs:token\">\n    <xs:pattern  value=\"[JB]?[0-9]+([.][0-9]*)?\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType  name=\"ucdType\">\n  <xs:restriction base=\"xs:token\">\n    <xs:annotation><xs:documentation>\n      Accept UCD1+\n      Accept also old UCD1 (but not / + %) including SIAP convention (with :)\n    </xs:documentation></xs:annotation>\n    <xs:pattern  value=\"[A-Za-z0-9_.:;\\-]*\"/><!-- UCD1 use also / + % -->\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType  name=\"arrayDEF\">\n  <xs:restriction base=\"xs:token\">\n    <xs:pattern  value=\"([0-9]+x)*[0-9]*[*]?(s\\W)?\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType  name=\"encodingType\">\n  <xs:restriction base=\"xs:NMTOKEN\">\n    <xs:enumeration value=\"gzip\"/>\n    <xs:enumeration value=\"base64\"/>\n    <xs:enumeration value=\"dynamic\"/>\n    <xs:enumeration value=\"none\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"dataType\">\n  <xs:restriction base=\"xs:NMTOKEN\">\n    <xs:enumeration value=\"boolean\"/>\n    <xs:enumeration value=\"bit\"/>\n    <xs:enumeration value=\"unsignedByte\"/>\n    <xs:enumeration value=\"short\"/>\n    <xs:enumeration value=\"int\"/>\n    <xs:enumeration value=\"long\"/>\n    <xs:enumeration value=\"char\"/>\n    <xs:enumeration value=\"unicodeChar\"/>\n    <xs:enumeration value=\"float\"/>\n    <xs:enumeration value=\"double\"/>\n    <xs:enumeration value=\"floatComplex\"/>\n    <xs:enumeration value=\"doubleComplex\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"precType\">\n  <xs:restriction base=\"xs:token\">\n    <xs:pattern value=\"[EF]?[0-9][0-9]*\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"yesno\">\n  <xs:restriction base=\"xs:NMTOKEN\">\n    <xs:enumeration value=\"yes\"/>\n    <xs:enumeration value=\"no\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n  <xs:complexType name=\"Min\">\n    <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n    <xs:attribute name=\"inclusive\" type=\"yesno\" default=\"yes\"/>\n  </xs:complexType>\n  <xs:complexType name=\"Max\">\n    <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n    <xs:attribute name=\"inclusive\" type=\"yesno\" default=\"yes\"/>\n  </xs:complexType>\n  <xs:complexType name=\"Option\">\n    <xs:sequence>\n      <xs:element name=\"OPTION\" type=\"Option\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    </xs:sequence>\n    <xs:attribute name=\"name\" type=\"xs:token\"/>\n    <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n  </xs:complexType>\n  \n  <!-- VALUES expresses the values that can be taken by the data \n    in a column or by a parameter\n  -->\n  <xs:complexType name=\"Values\">\n    <xs:sequence>\n      <xs:element name=\"MIN\" type=\"Min\" minOccurs=\"0\"/>\n      <xs:element name=\"MAX\" type=\"Max\" minOccurs=\"0\"/>\n      <xs:element name=\"OPTION\" type=\"Option\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    </xs:sequence>\n    <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n    <xs:attribute name=\"type\" default=\"legal\">\n      <xs:simpleType>\n        <xs:restriction base=\"xs:NMTOKEN\">\n          <xs:enumeration value=\"legal\"/>\n          <xs:enumeration value=\"actual\"/>\n        </xs:restriction>\n      </xs:simpleType>\n    </xs:attribute>\n    <xs:attribute name=\"null\" type=\"xs:token\"/>\n    <xs:attribute name=\"ref\"  type=\"xs:IDREF\"/>\n    <!-- xs:attribute name=\"invalid\" type=\"yesno\" default=\"no\"/ -->\n  </xs:complexType>\n  \n  <!-- The LINK is a URL (href) or some other kind of reference (gref) -->\n  <xs:complexType name=\"Link\">\n    <xs:annotation><xs:documentation> \n    content-role was previously restricted as: <![CDATA[\n    <xs:attribute name=\"content-role\">\n      <xs:simpleType>\n        <xs:restriction base=\"xs:NMTOKEN\">\n          <xs:enumeration value=\"query\"/>\n          <xs:enumeration value=\"hints\"/>\n          <xs:enumeration value=\"doc\"/>\n          <xs:enumeration value=\"location\"/>\n        </xs:restriction>\n      </xs:simpleType>\n    </xs:attribute>]]>; is now a token.\n    </xs:documentation></xs:annotation>\n    <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n    <xs:attribute name=\"content-role\" type=\"xs:token\"/>\n    <xs:attribute name=\"content-type\" type=\"xs:token\"/>\n    <xs:attribute name=\"title\" type=\"xs:string\"/>\n    <xs:attribute name=\"value\" type=\"xs:string\"/>\n    <xs:attribute name=\"href\" type=\"xs:anyURI\"/>\n    <xs:attribute name=\"gref\" type=\"xs:token\"/><!-- Deprecated in V1.1 -->\n    <xs:attribute name=\"action\" type=\"xs:anyURI\"/>\n  </xs:complexType>\n  \n<!-- INFO is defined in Version 1.2 as a PARAM of String type \n<xs:complexType name=\"Info\">\n  <xs:complexContent>\n    <xs:restriction base=\"Param\">\n      <xs:attribute name=\"unit\" fixed=\"\"/>\n      <xs:attribute name=\"datatype\" fixed=\"char\"/>\n      <xs:attribute name=\"arraysize\" fixed=\"*\"/>\n    </xs:restriction>\n  </xs:complexContent>\n</xs:complexType>\n -or- as a full definition:\n<xs:complexType name=\"Info\">\n  <xs:sequence> \n  <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n    <xs:element name=\"VALUES\" type=\"Values\" minOccurs=\"0\"/>\n    <xs:element name=\"LINK\" type=\"Link\" minOccurs=\"0\" maxOccurs=\"unbounded\"/> \n  </xs:sequence>\n  <xs:attribute name=\"name\" type=\"xs:token\" use=\"required\"/>\n  <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n  <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n  <xs:attribute name=\"unit\" type=\"xs:token\"/>\n  <xs:attribute name=\"xtype\" type=\"xs:token\"/>\n  <xs:attribute name=\"ref\" type=\"xs:IDREF\"/>\n  <xs:attribute name=\"ucd\" type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n</xs:complexType>\n-->\n<!-- No sub-element is accepted in INFO for backward compatibility -->\n<xs:complexType name=\"Info\">\n  <xs:simpleContent>\n    <xs:extension base=\"xs:string\">\n      <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n      <xs:attribute name=\"name\"  type=\"xs:token\" use=\"required\"/>\n      <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n      <xs:attribute name=\"unit\"  type=\"xs:token\"/>\n      <xs:attribute name=\"xtype\" type=\"xs:token\"/>\n      <xs:attribute name=\"ref\"   type=\"xs:IDREF\"/>\n      <xs:attribute name=\"ucd\"   type=\"ucdType\"/>\n      <xs:attribute name=\"utype\" type=\"xs:string\"/>\n    </xs:extension>\n  </xs:simpleContent>\n</xs:complexType>\n\n<!-- Expresses the coordinate system we are using --><!-- Deprecated V1.2 -->\n<xs:complexType name=\"CoordinateSystem\">\n  <xs:annotation><xs:documentation>\n    Deprecated in Version 1.2\n  </xs:documentation></xs:annotation>\n  <xs:simpleContent>\n    <xs:extension base=\"xs:string\">\n      <xs:attribute name=\"ID\" type=\"xs:ID\" use=\"required\"/>\n      <xs:attribute name=\"equinox\" type=\"astroYear\"/>\n      <xs:attribute name=\"epoch\" type=\"astroYear\"/>\n      <xs:attribute name=\"system\" default=\"eq_FK5\">\n        <xs:simpleType>\n          <xs:restriction base=\"xs:NMTOKEN\">\n            <xs:enumeration value=\"eq_FK4\"/>\n            <xs:enumeration value=\"eq_FK5\"/>\n            <xs:enumeration value=\"ICRS\"/>\n            <xs:enumeration value=\"ecl_FK4\"/>\n            <xs:enumeration value=\"ecl_FK5\"/>\n            <xs:enumeration value=\"galactic\"/>\n            <xs:enumeration value=\"supergalactic\"/>\n            <xs:enumeration value=\"xy\"/>\n            <xs:enumeration value=\"barycentric\"/>\n            <xs:enumeration value=\"geo_app\"/>\n          </xs:restriction>\n        </xs:simpleType>\n      </xs:attribute>\n    </xs:extension>\n  </xs:simpleContent>\n</xs:complexType>\n\n<xs:simpleType name=\"Timeorigin\">\n  <xs:annotation>\n    <xs:documentation>\n        This is a time origin of a time coordinate, given as a \n        Julian Date for the the time scale and reference point\n        defined.  It is usually given as a floating point\n        literal; for convenience, the magic strings “MJD-origin” \n        (standing for 2400000.5) and “JD-origin” (standing for 0) \n        are also allowed.    \n    </xs:documentation>\n  </xs:annotation>\n  <xs:restriction base=\"xs:token\">\n     <xs:pattern value=\"[+-]?([0-9]+\\.?[0-9]*|\\.[0-9]+)([eE][+-]?[0-9]+)?|(JD|MJD)-origin\">\n     </xs:pattern>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:complexType name=\"TimeSystem\">\n  <xs:simpleContent>\n    <xs:extension base=\"xs:string\">\n      <xs:attribute name=\"ID\" type=\"xs:ID\" use=\"required\"/>\n      <xs:attribute name=\"timeorigin\" type=\"Timeorigin\">\n        <xs:annotation>\n          <xs:documentation>\n          \tThe time origin is the offset or the time coordinate to Julian\n          \tDate.  The timeorigin attribute MUST be given unless the time's\n          \trepresentation contains a year of a calendar era, in which case it\n          \tMUST NOT be present.\n          </xs:documentation>\n        </xs:annotation>\n      </xs:attribute>\n      <xs:attribute name=\"timescale\" use=\"required\" type=\"xs:token\">\n        <xs:annotation>\n          <xs:documentation>\n            This is the time scale used.  Values SHOULD be\n            taken from the IVOA timescale vocabulary (http://www.ivoa.net/rdf/timescale).\n          </xs:documentation>\n        </xs:annotation>\n      </xs:attribute>\n      <xs:attribute name=\"refposition\" use=\"required\" type=\"xs:token\">\n        <xs:annotation>\n          <xs:documentation>\n            The reference position SHOULD be taken from the IVOA \n            refposition vocabulary (http://www.ivoa.net/rdf/refposition).\n          </xs:documentation>\n        </xs:annotation>\n      </xs:attribute>\n    </xs:extension>\n  </xs:simpleContent>\n</xs:complexType>\n\n<xs:complexType name=\"Definitions\">\n  <xs:annotation><xs:documentation>\n    Deprecated in Version 1.1\n  </xs:documentation></xs:annotation>\n  <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n    <xs:element name=\"COOSYS\" type=\"CoordinateSystem\"/>\n    <xs:element name=\"TIMESYS\" type=\"TimeSystem\"/>\n    <xs:element name=\"PARAM\" type=\"Param\"/>\n  </xs:choice>\n</xs:complexType>\n\n<!-- FIELD is the definition of what is in a column of the table -->\n<xs:complexType name=\"Field\">\n  <xs:sequence> <!-- minOccurs=\"0\" maxOccurs=\"unbounded\" -->\n    <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n    <xs:element name=\"VALUES\" type=\"Values\" minOccurs=\"0\"/> <!-- maxOccurs=\"2\" -->\n    <xs:element name=\"LINK\" type=\"Link\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n  <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n  <xs:attribute name=\"unit\" type=\"xs:token\"/>\n  <xs:attribute name=\"datatype\" type=\"dataType\" use=\"required\"/>\n  <xs:attribute name=\"precision\" type=\"precType\"/>\n  <xs:attribute name=\"width\" type=\"xs:positiveInteger\"/>\n  <xs:attribute name=\"xtype\" type=\"xs:token\"/>\n  <xs:attribute name=\"ref\" type=\"xs:IDREF\"/>\n  <xs:attribute name=\"name\" type=\"xs:token\" use=\"required\"/>\n  <xs:attribute name=\"ucd\" type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n  <xs:attribute name=\"arraysize\" type=\"xs:string\"/>\n    <!-- GL: is the next deprecated element remaining \n        (is not in PARAM, but will in new model be inherited) \n    -->\n  <xs:attribute name=\"type\">\n    <!-- type is not in the Version 1.1, but is kept for\n         backward compatibility purposes\n    -->\n    <xs:simpleType>\n      <xs:restriction base=\"xs:NMTOKEN\">\n        <xs:enumeration value=\"hidden\"/>\n        <xs:enumeration value=\"no_query\"/>\n        <xs:enumeration value=\"trigger\"/>\n        <xs:enumeration value=\"location\"/>\n      </xs:restriction>\n    </xs:simpleType>\n  </xs:attribute>\n</xs:complexType>\n\n\n<!-- A PARAM is similar to a FIELD, but it also has a \"value\" attribute -->\n<!--  GL: implemented here as a subtype as suggested we do in Kyoto. -->\n<xs:complexType name=\"Param\">\n  <xs:complexContent>\n    <xs:extension base=\"Field\">\n      <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n    </xs:extension>\n  </xs:complexContent>\n</xs:complexType>\n\n\n<!-- GROUP groups columns; may include descriptions, fields/params/groups -->\n<xs:complexType name=\"Group\">\n  <xs:sequence>\n    <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n<!--  GL I guess I can understand the next choice element as one may (?) \n      really want to group fields and params and groups in a particular order.\n-->    \n    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n      <xs:element name=\"FIELDref\" type=\"FieldRef\"/> \n      <xs:element name=\"PARAMref\" type=\"ParamRef\"/> \n      <xs:element name=\"PARAM\" type=\"Param\"/> \n      <xs:element name=\"GROUP\" type=\"Group\"/> \n      <!-- GL a GroupRef could remove recursion -->\n    </xs:choice>\n  </xs:sequence>\n  <xs:attribute name=\"ID\"   type=\"xs:ID\"/>\n  <xs:attribute name=\"name\" type=\"xs:token\"/>\n  <xs:attribute name=\"ref\"  type=\"xs:IDREF\"/>\n  <xs:attribute name=\"ucd\"  type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n</xs:complexType>\n\n<!-- FIELDref and PARAMref are references to FIELD or PARAM defined\n     in the parent TABLE or RESOURCE -->\n<!-- GL This can not be enforced in XML Schema, so why not IDREF in <Group> ?\n     In particular if the UCD and utype attributes will NOT be added -->\n<xs:complexType name=\"FieldRef\">\n  <xs:attribute name=\"ref\" type=\"xs:IDREF\" use=\"required\"/>\n  <xs:attribute name=\"ucd\"  type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n</xs:complexType>\n\n<xs:complexType name=\"ParamRef\">\n  <xs:attribute name=\"ref\" type=\"xs:IDREF\" use=\"required\"/>\n  <xs:attribute name=\"ucd\"  type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n</xs:complexType>\n\n<!-- DATA is the actual table data, in one of three formats -->\n<!-- \n  GL in Kyoto we discussed the option of having the specific Data items \n  be subtypes of Data:\n-->\n<!-- \n<xs:complexType name=\"Data\" abstract=\"true\"/>\n\n<xs:complexType name=\"TableData\">\n  <xs:complexContent>\n    <xs:extension base=\"Data\">\n     ... etc\n    </xs:extension>\n  </xs:complexContent>\n</xs:complexType>\n -->\n<xs:complexType name=\"Data\">\n  <xs:annotation><xs:documentation>\n    Added in Version 1.2: INFO for diagnostics\n  </xs:documentation></xs:annotation>\n  <xs:sequence>\n    <xs:choice>\n      <xs:element name=\"TABLEDATA\" type=\"TableData\"/>\n      <xs:element name=\"BINARY\" type=\"Binary\"/>\n      <xs:element name=\"BINARY2\" type=\"Binary2\"/>\n      <xs:element name=\"FITS\" type=\"FITS\"/>\n    </xs:choice>\n    <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n</xs:complexType>\n\n<!-- Pure XML data -->\n<xs:complexType name=\"TableData\">\n  <xs:sequence>\n    <xs:element name=\"TR\" type=\"Tr\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n</xs:complexType>\n\n<xs:complexType name=\"Td\">\n  <xs:simpleContent>\n    <xs:extension base=\"xs:string\">\n      <!-- xs:attribute name=\"ref\" type=\"xs:IDREF\"/ -->\n      <xs:annotation><xs:documentation>\n          The 'encoding' attribute is added here to avoid\n          problems of code generators which do not properly\n          interpret the TR/TD structures.\n          'encoding' was chosen because it appears in\n          appendix A.5\n      </xs:documentation></xs:annotation>\n      <xs:attribute name=\"encoding\" type=\"encodingType\"/>\n    </xs:extension>\n  </xs:simpleContent>\n</xs:complexType>\n\n<xs:complexType name=\"Tr\">\n  <xs:annotation><xs:documentation>\n    The ID attribute is added here to the TR tag to avoid \n    problems of code generators which do not properly \n    interpret the TR/TD structures\n  </xs:documentation></xs:annotation>\n  <xs:sequence>\n    <xs:element name=\"TD\" type=\"Td\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n  <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n</xs:complexType>\n\n<!-- FITS file, perhaps with specification of which extension to seek to -->\n<xs:complexType name=\"FITS\">\n  <xs:sequence>\n    <xs:element name=\"STREAM\" type=\"Stream\"/>\n  </xs:sequence>\n  <xs:attribute name=\"extnum\" type=\"xs:positiveInteger\"/>\n</xs:complexType>\n\n<!-- BINARY data format -->\n<xs:complexType name=\"Binary\">\n  <xs:sequence>\n    <xs:element name=\"STREAM\" type=\"Stream\"/>\n  </xs:sequence>\n</xs:complexType>\n\n<!-- BINARY2 data format -->\n<xs:complexType name=\"Binary2\">\n  <xs:sequence>\n    <xs:element name=\"STREAM\" type=\"Stream\"/>\n  </xs:sequence>\n</xs:complexType>\n\n<!-- STREAM can be local or remote, encoded or not -->\n<xs:complexType name=\"Stream\">\n  <xs:simpleContent>\n    <xs:extension base=\"xs:string\">\n      <xs:attribute name=\"type\" default=\"locator\">\n        <xs:simpleType>\n          <xs:restriction base=\"xs:NMTOKEN\">\n            <xs:enumeration value=\"locator\"/>\n            <xs:enumeration value=\"other\"/>\n          </xs:restriction>\n        </xs:simpleType>\n      </xs:attribute>\n      <xs:attribute name=\"href\" type=\"xs:anyURI\"/>\n      <xs:attribute name=\"actuate\" default=\"onRequest\">\n        <xs:simpleType>\n          <xs:restriction base=\"xs:NMTOKEN\">\n            <xs:enumeration value=\"onLoad\"/>\n            <xs:enumeration value=\"onRequest\"/>\n            <xs:enumeration value=\"other\"/>\n            <xs:enumeration value=\"none\"/>\n          </xs:restriction>\n        </xs:simpleType>\n      </xs:attribute>\n      <xs:attribute name=\"encoding\" type=\"encodingType\" default=\"none\"/>\n      <xs:attribute name=\"expires\" type=\"xs:dateTime\"/>\n      <xs:attribute name=\"rights\" type=\"xs:token\"/>\n    </xs:extension>\n  </xs:simpleContent>\n</xs:complexType>\n\n<!-- A TABLE is a sequence of FIELD/PARAMs and LINKS and DESCRIPTION, \n     possibly followed by a DATA section \n-->\n<xs:complexType name=\"Table\">\n  <xs:annotation><xs:documentation>\n    Added in Version 1.2: INFO for diagnostics\n  </xs:documentation></xs:annotation>\n  <xs:sequence>\n    <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n<!-- GL: why a choice iso for example -->\n<!-- \n      <xs:element name=\"PARAM\" type=\"Param\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n      <xs:element name=\"FIELD\" type=\"Field\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n      <xs:element name=\"GROUP\" type=\"Group\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n-->\n<!-- \n  This could also enforce groups to be defined after the fields and params \n  to which they must have a reference, which is somewhat more logical\n-->\n    <!-- Added Version 1.2: -->\n    <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/> \n    <!-- An empty table without any FIELD/PARAM should not be acceptable -->\n    <xs:choice minOccurs=\"1\" maxOccurs=\"unbounded\"> \n      <xs:element name=\"FIELD\" type=\"Field\"/>\n      <xs:element name=\"PARAM\" type=\"Param\"/>\n      <xs:element name=\"GROUP\" type=\"Group\"/>\n    </xs:choice>\n    <xs:element name=\"LINK\" type=\"Link\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    <!-- This would allow several DATA parts in a table (future extension?)\n    <xs:sequence minOccurs=\"0\" maxOccurs=\"unbounded\">  \n      <xs:element name=\"DATA\" type=\"Data\"/>\n      <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    </xs:sequence>\n    -->\n    <xs:element name=\"DATA\" type=\"Data\" minOccurs=\"0\"/>\n    <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n  <xs:attribute name=\"ID\"   type=\"xs:ID\"/>\n  <xs:attribute name=\"name\" type=\"xs:token\"/>\n  <xs:attribute name=\"ref\"  type=\"xs:IDREF\"/>\n  <xs:attribute name=\"ucd\"  type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n  <xs:attribute name=\"nrows\" type=\"xs:nonNegativeInteger\"/>\n</xs:complexType>\n\n<!-- RESOURCES can contain DESCRIPTION, (INFO|PARAM|COSYS), LINK, TABLEs -->\n<xs:complexType name=\"Resource\">\n  <xs:annotation><xs:documentation>\n     Added in Version 1.2: INFO for diagnostics in several places\n  </xs:documentation></xs:annotation>\n  <xs:sequence>\n    <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n    <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n      <xs:element name=\"COOSYS\" type=\"CoordinateSystem\"/>\n      <xs:element name=\"TIMESYS\" type=\"TimeSystem\"/>\n      <xs:element name=\"GROUP\" type=\"Group\" />\n      <xs:element name=\"PARAM\" type=\"Param\" />\n    </xs:choice>\n    <xs:sequence minOccurs=\"0\" maxOccurs=\"unbounded\">\n      <xs:element name=\"LINK\" type=\"Link\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n      <xs:choice>\n        <xs:element name=\"TABLE\" type=\"Table\" />\n        <xs:element name=\"RESOURCE\" type=\"Resource\" />\n      </xs:choice>\n      <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    </xs:sequence>\n    <!-- Suggested Doug Tody, to include new RESOURCE types -->\n    <xs:any namespace=\"##other\" processContents=\"lax\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n  <xs:attribute name=\"name\" type=\"xs:token\"/>\n  <xs:attribute name=\"ID\"   type=\"xs:ID\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n  <xs:attribute name=\"type\" default=\"results\">\n    <xs:simpleType>\n      <xs:restriction base=\"xs:NMTOKEN\">\n        <xs:enumeration value=\"results\"/>\n        <xs:enumeration value=\"meta\"/>\n      </xs:restriction>\n    </xs:simpleType>\n  </xs:attribute>\n  <!-- Suggested Doug Tody, to include new RESOURCE attributes -->\n  <xs:anyAttribute namespace=\"##other\" processContents=\"lax\"/>\n</xs:complexType>\n\n<!-- VOTable is the root element -->\n<xs:element name=\"VOTABLE\">\n<xs:complexType>\n  <xs:sequence>\n    <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n    <xs:element name=\"DEFINITIONS\" type=\"Definitions\" minOccurs=\"0\"/><!-- Deprecated -->\n    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n      <xs:element name=\"COOSYS\" type=\"CoordinateSystem\"/>\n      <xs:element name=\"TIMESYS\" type=\"TimeSystem\"/>\n      <xs:element name=\"GROUP\" type=\"Group\" />\n      <xs:element name=\"PARAM\" type=\"Param\" />\n      <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    </xs:choice>\n    <xs:element name=\"RESOURCE\" type=\"Resource\" minOccurs=\"1\" maxOccurs=\"unbounded\"/>\n    <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n  <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n  <xs:attribute name=\"version\">\n     <xs:simpleType>\n       <xs:restriction base=\"xs:NMTOKEN\">\n         <xs:enumeration value=\"1.3\"/>\n         <xs:enumeration value=\"1.4\"/>\n       </xs:restriction>\n     </xs:simpleType>\n   </xs:attribute>\n</xs:complexType>\n</xs:element>\n\n</xs:schema>\n"},{"id":6131,"name":"VOTable.v1.3.xsd","nodeType":"TextFile","path":"astropy/io/votable/data","text":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--W3C Schema for VOTable  = Virtual Observatory Tabular Format\n.Version 1.0 : 15-Apr-2002\n.Version 1.09: 23-Jan-2004 Version 1.09\n.Version 1.09: 30-Jan-2004 Version 1.091\n.Version 1.09: 22-Mar-2004 Version 1.092\n.Version 1.094: 02-Jun-2004 GROUP does not contain FIELD\n.Version 1.1 :  10-Jun-2004 remove the complexContent\n.Version 1.11: GL: 23-May-2006 remove most root elements, use name= type= iso ref= structure\n.Version 1.11: GL: 29-Aug-2006 review and added comments (prefixed by GL)\n              before sending to Francois Ochsenbein\n.Version 1.12: FO: Preliminary Version 1.2\n.Version 1.18: FO: Tested (jax) version 1.2\n.Version 1.19: FO: Completed INFO attributes\n.Version 1.20: FO: Added xtype; content-role is less restrictive (May2009)\n.Version 1.20a: FO: PR-20090710 Cosmetics.\n.Version 1.20b: FO: INFO does not accept sub-elements (2009-09-29)\n.Version 1.20c: FO: elementFormDefault=\"qualified\" to stay compatible with 1.1\n.Version 1.3: MT: Added BINARY2 element\n.Version 1.3: MT: Further relaxed LINK content-role type to token\n-->\n<xs:schema\n   xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" elementFormDefault=\"qualified\"\n   xmlns=\"http://www.ivoa.net/xml/VOTable/v1.3\"\n   targetNamespace=\"http://www.ivoa.net/xml/VOTable/v1.3\"\n>\n<xs:annotation><xs:documentation>\n    VOTable is meant to serialize tabular documents in the\n    context of Virtual Observatory applications. This schema\n    corresponds to the VOTable document available from\n    http://www.ivoa.net/Documents/latest/VOT.html\n</xs:documentation></xs:annotation>\n\n<!-- Here we define some interesting new datatypes:\n     - anyTEXT   may have embedded XHTML (conforming HTML)\n     - astroYear is an epoch in Besselian or Julian year, e.g. J2000\n     - arrayDEF  specifies an array size e.g. 12x23x*\n     - dataType  defines the acceptable datatypes\n     - ucdType   defines the acceptable UCDs (UCD1+)\n     - precType  defines the acceptable precisions\n     - yesno     defines just the 2 alternatives\n-->\n\n<xs:complexType name=\"anyTEXT\" mixed=\"true\">\n  <xs:sequence>\n    <xs:any minOccurs=\"0\" maxOccurs=\"unbounded\" processContents=\"skip\"/>\n  </xs:sequence>\n</xs:complexType>\n\n<xs:simpleType  name=\"astroYear\">\n  <xs:restriction base=\"xs:token\">\n    <xs:pattern  value=\"[JB]?[0-9]+([.][0-9]*)?\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType  name=\"ucdType\">\n  <xs:restriction base=\"xs:token\">\n    <xs:annotation><xs:documentation>\n      Accept UCD1+\n      Accept also old UCD1 (but not / + %) including SIAP convention (with :)\n    </xs:documentation></xs:annotation>\n    <xs:pattern  value=\"[A-Za-z0-9_.:;\\-]*\"/><!-- UCD1 use also / + % -->\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType  name=\"arrayDEF\">\n  <xs:restriction base=\"xs:token\">\n    <xs:pattern  value=\"([0-9]+x)*[0-9]*[*]?(s\\W)?\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType  name=\"encodingType\">\n  <xs:restriction base=\"xs:NMTOKEN\">\n    <xs:enumeration value=\"gzip\"/>\n    <xs:enumeration value=\"base64\"/>\n    <xs:enumeration value=\"dynamic\"/>\n    <xs:enumeration value=\"none\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"dataType\">\n  <xs:restriction base=\"xs:NMTOKEN\">\n    <xs:enumeration value=\"boolean\"/>\n    <xs:enumeration value=\"bit\"/>\n    <xs:enumeration value=\"unsignedByte\"/>\n    <xs:enumeration value=\"short\"/>\n    <xs:enumeration value=\"int\"/>\n    <xs:enumeration value=\"long\"/>\n    <xs:enumeration value=\"char\"/>\n    <xs:enumeration value=\"unicodeChar\"/>\n    <xs:enumeration value=\"float\"/>\n    <xs:enumeration value=\"double\"/>\n    <xs:enumeration value=\"floatComplex\"/>\n    <xs:enumeration value=\"doubleComplex\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"precType\">\n  <xs:restriction base=\"xs:token\">\n    <xs:pattern value=\"[EF]?[1-9][0-9]*\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"yesno\">\n  <xs:restriction base=\"xs:NMTOKEN\">\n    <xs:enumeration value=\"yes\"/>\n    <xs:enumeration value=\"no\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n  <xs:complexType name=\"Min\">\n    <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n    <xs:attribute name=\"inclusive\" type=\"yesno\" default=\"yes\"/>\n  </xs:complexType>\n  <xs:complexType name=\"Max\">\n    <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n    <xs:attribute name=\"inclusive\" type=\"yesno\" default=\"yes\"/>\n  </xs:complexType>\n  <xs:complexType name=\"Option\">\n    <xs:sequence>\n      <xs:element name=\"OPTION\" type=\"Option\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    </xs:sequence>\n    <xs:attribute name=\"name\" type=\"xs:token\"/>\n    <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n  </xs:complexType>\n\n  <!-- VALUES expresses the values that can be taken by the data\n    in a column or by a parameter\n  -->\n  <xs:complexType name=\"Values\">\n    <xs:sequence>\n      <xs:element name=\"MIN\" type=\"Min\" minOccurs=\"0\"/>\n      <xs:element name=\"MAX\" type=\"Max\" minOccurs=\"0\"/>\n      <xs:element name=\"OPTION\" type=\"Option\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    </xs:sequence>\n    <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n    <xs:attribute name=\"type\" default=\"legal\">\n      <xs:simpleType>\n        <xs:restriction base=\"xs:NMTOKEN\">\n          <xs:enumeration value=\"legal\"/>\n          <xs:enumeration value=\"actual\"/>\n        </xs:restriction>\n      </xs:simpleType>\n    </xs:attribute>\n    <xs:attribute name=\"null\" type=\"xs:token\"/>\n    <xs:attribute name=\"ref\"  type=\"xs:IDREF\"/>\n    <!-- xs:attribute name=\"invalid\" type=\"yesno\" default=\"no\"/ -->\n  </xs:complexType>\n\n  <!-- The LINK is a URL (href) or some other kind of reference (gref) -->\n  <xs:complexType name=\"Link\">\n    <xs:annotation><xs:documentation>\n    content-role was previously restricted as: <![CDATA[\n    <xs:attribute name=\"content-role\">\n      <xs:simpleType>\n        <xs:restriction base=\"xs:NMTOKEN\">\n          <xs:enumeration value=\"query\"/>\n          <xs:enumeration value=\"hints\"/>\n          <xs:enumeration value=\"doc\"/>\n          <xs:enumeration value=\"location\"/>\n        </xs:restriction>\n      </xs:simpleType>\n    </xs:attribute>]]>; is now a token.\n    </xs:documentation></xs:annotation>\n    <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n    <xs:attribute name=\"content-role\" type=\"xs:token\"/>\n    <xs:attribute name=\"content-type\" type=\"xs:token\"/>\n    <xs:attribute name=\"title\" type=\"xs:string\"/>\n    <xs:attribute name=\"value\" type=\"xs:string\"/>\n    <xs:attribute name=\"href\" type=\"xs:anyURI\"/>\n    <xs:attribute name=\"gref\" type=\"xs:token\"/><!-- Deprecated in V1.1 -->\n    <xs:attribute name=\"action\" type=\"xs:anyURI\"/>\n  </xs:complexType>\n\n<!-- INFO is defined in Version 1.2 as a PARAM of String type\n<xs:complexType name=\"Info\">\n  <xs:complexContent>\n    <xs:restriction base=\"Param\">\n      <xs:attribute name=\"unit\" fixed=\"\"/>\n      <xs:attribute name=\"datatype\" fixed=\"char\"/>\n      <xs:attribute name=\"arraysize\" fixed=\"*\"/>\n    </xs:restriction>\n  </xs:complexContent>\n</xs:complexType>\n -or- as a full definition:\n<xs:complexType name=\"Info\">\n  <xs:sequence>\n  <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n    <xs:element name=\"VALUES\" type=\"Values\" minOccurs=\"0\"/>\n    <xs:element name=\"LINK\" type=\"Link\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n  <xs:attribute name=\"name\" type=\"xs:token\" use=\"required\"/>\n  <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n  <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n  <xs:attribute name=\"unit\" type=\"xs:token\"/>\n  <xs:attribute name=\"xtype\" type=\"xs:token\"/>\n  <xs:attribute name=\"ref\" type=\"xs:IDREF\"/>\n  <xs:attribute name=\"ucd\" type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n</xs:complexType>\n-->\n<!-- No sub-element is accepted in INFO for backward compatibility -->\n<xs:complexType name=\"Info\">\n  <xs:simpleContent>\n    <xs:extension base=\"xs:string\">\n      <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n      <xs:attribute name=\"name\"  type=\"xs:token\" use=\"required\"/>\n      <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n      <xs:attribute name=\"unit\"  type=\"xs:token\"/>\n      <xs:attribute name=\"xtype\" type=\"xs:token\"/>\n      <xs:attribute name=\"ref\"   type=\"xs:IDREF\"/>\n      <xs:attribute name=\"ucd\"   type=\"ucdType\"/>\n      <xs:attribute name=\"utype\" type=\"xs:string\"/>\n    </xs:extension>\n  </xs:simpleContent>\n</xs:complexType>\n\n<!-- Expresses the coordinate system we are using --><!-- Deprecated V1.2 -->\n<xs:complexType name=\"CoordinateSystem\">\n  <xs:annotation><xs:documentation>\n    Deprecated in Version 1.2\n  </xs:documentation></xs:annotation>\n  <xs:simpleContent>\n    <xs:extension base=\"xs:string\">\n      <xs:attribute name=\"ID\" type=\"xs:ID\" use=\"required\"/>\n      <xs:attribute name=\"equinox\" type=\"astroYear\"/>\n      <xs:attribute name=\"epoch\" type=\"astroYear\"/>\n      <xs:attribute name=\"system\" default=\"eq_FK5\">\n        <xs:simpleType>\n          <xs:restriction base=\"xs:NMTOKEN\">\n            <xs:enumeration value=\"eq_FK4\"/>\n            <xs:enumeration value=\"eq_FK5\"/>\n            <xs:enumeration value=\"ICRS\"/>\n            <xs:enumeration value=\"ecl_FK4\"/>\n            <xs:enumeration value=\"ecl_FK5\"/>\n            <xs:enumeration value=\"galactic\"/>\n            <xs:enumeration value=\"supergalactic\"/>\n            <xs:enumeration value=\"xy\"/>\n            <xs:enumeration value=\"barycentric\"/>\n            <xs:enumeration value=\"geo_app\"/>\n          </xs:restriction>\n        </xs:simpleType>\n      </xs:attribute>\n    </xs:extension>\n  </xs:simpleContent>\n</xs:complexType>\n\n<xs:complexType name=\"Definitions\">\n  <xs:annotation><xs:documentation>\n    Deprecated in Version 1.1\n  </xs:documentation></xs:annotation>\n  <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n    <xs:element name=\"COOSYS\" type=\"CoordinateSystem\"/><!-- Deprecated in V1.2 -->\n    <xs:element name=\"PARAM\" type=\"Param\"/>\n  </xs:choice>\n</xs:complexType>\n\n<!-- FIELD is the definition of what is in a column of the table -->\n<xs:complexType name=\"Field\">\n  <xs:sequence> <!-- minOccurs=\"0\" maxOccurs=\"unbounded\" -->\n    <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n    <xs:element name=\"VALUES\" type=\"Values\" minOccurs=\"0\"/> <!-- maxOccurs=\"2\" -->\n    <xs:element name=\"LINK\" type=\"Link\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n  <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n  <xs:attribute name=\"unit\" type=\"xs:token\"/>\n  <xs:attribute name=\"datatype\" type=\"dataType\" use=\"required\"/>\n  <xs:attribute name=\"precision\" type=\"precType\"/>\n  <xs:attribute name=\"width\" type=\"xs:positiveInteger\"/>\n  <xs:attribute name=\"xtype\" type=\"xs:token\"/>\n  <xs:attribute name=\"ref\" type=\"xs:IDREF\"/>\n  <xs:attribute name=\"name\" type=\"xs:token\" use=\"required\"/>\n  <xs:attribute name=\"ucd\" type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n  <xs:attribute name=\"arraysize\" type=\"xs:string\"/>\n    <!-- GL: is the next deprecated element remaining\n        (is not in PARAM, but will in new model be inherited)\n    -->\n  <xs:attribute name=\"type\">\n    <!-- type is not in the Version 1.1, but is kept for\n         backward compatibility purposes\n    -->\n    <xs:simpleType>\n      <xs:restriction base=\"xs:NMTOKEN\">\n        <xs:enumeration value=\"hidden\"/>\n        <xs:enumeration value=\"no_query\"/>\n        <xs:enumeration value=\"trigger\"/>\n        <xs:enumeration value=\"location\"/>\n      </xs:restriction>\n    </xs:simpleType>\n  </xs:attribute>\n</xs:complexType>\n\n\n<!-- A PARAM is similar to a FIELD, but it also has a \"value\" attribute -->\n<!--  GL: implemented here as a subtype as suggested we do in Kyoto. -->\n<xs:complexType name=\"Param\">\n  <xs:complexContent>\n    <xs:extension base=\"Field\">\n      <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n    </xs:extension>\n  </xs:complexContent>\n</xs:complexType>\n\n\n<!-- GROUP groups columns; may include descriptions, fields/params/groups -->\n<xs:complexType name=\"Group\">\n  <xs:sequence>\n    <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n<!--  GL I guess I can understand the next choice element as one may (?)\n      really want to group fields and params and groups in a particular order.\n-->\n    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n      <xs:element name=\"FIELDref\" type=\"FieldRef\"/>\n      <xs:element name=\"PARAMref\" type=\"ParamRef\"/>\n      <xs:element name=\"PARAM\" type=\"Param\"/>\n      <xs:element name=\"GROUP\" type=\"Group\"/>\n      <!-- GL a GroupRef could remove recursion -->\n    </xs:choice>\n  </xs:sequence>\n  <xs:attribute name=\"ID\"   type=\"xs:ID\"/>\n  <xs:attribute name=\"name\" type=\"xs:token\"/>\n  <xs:attribute name=\"ref\"  type=\"xs:IDREF\"/>\n  <xs:attribute name=\"ucd\"  type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n</xs:complexType>\n\n<!-- FIELDref and PARAMref are references to FIELD or PARAM defined\n     in the parent TABLE or RESOURCE -->\n<!-- GL This can not be enforced in XML Schema, so why not IDREF in <Group> ?\n     In particular if the UCD and utype attributes will NOT be added -->\n<xs:complexType name=\"FieldRef\">\n  <xs:attribute name=\"ref\" type=\"xs:IDREF\" use=\"required\"/>\n  <xs:attribute name=\"ucd\"  type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n</xs:complexType>\n\n<xs:complexType name=\"ParamRef\">\n  <xs:attribute name=\"ref\" type=\"xs:IDREF\" use=\"required\"/>\n  <xs:attribute name=\"ucd\"  type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n</xs:complexType>\n\n<!-- DATA is the actual table data, in one of three formats -->\n<!--\n  GL in Kyoto we discussed the option of having the specific Data items\n  be subtypes of Data:\n-->\n<!--\n<xs:complexType name=\"Data\" abstract=\"true\"/>\n\n<xs:complexType name=\"TableData\">\n  <xs:complexContent>\n    <xs:extension base=\"Data\">\n     ... etc\n    </xs:extension>\n  </xs:complexContent>\n</xs:complexType>\n -->\n<xs:complexType name=\"Data\">\n  <xs:annotation><xs:documentation>\n    Added in Version 1.2: INFO for diagnostics\n  </xs:documentation></xs:annotation>\n  <xs:sequence>\n    <xs:choice>\n      <xs:element name=\"TABLEDATA\" type=\"TableData\"/>\n      <xs:element name=\"BINARY\" type=\"Binary\"/>\n      <xs:element name=\"BINARY2\" type=\"Binary2\"/>\n      <xs:element name=\"FITS\" type=\"FITS\"/>\n    </xs:choice>\n    <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n</xs:complexType>\n\n<!-- Pure XML data -->\n<xs:complexType name=\"TableData\">\n  <xs:sequence>\n    <xs:element name=\"TR\" type=\"Tr\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n</xs:complexType>\n\n<xs:complexType name=\"Td\">\n  <xs:simpleContent>\n    <xs:extension base=\"xs:string\">\n      <!-- xs:attribute name=\"ref\" type=\"xs:IDREF\"/ -->\n      <xs:annotation><xs:documentation>\n          The 'encoding' attribute is added here to avoid\n          problems of code generators which do not properly\n          interpret the TR/TD structures.\n          'encoding' was chosen because it appears in\n          appendix A.5\n      </xs:documentation></xs:annotation>\n      <xs:attribute name=\"encoding\" type=\"encodingType\"/>\n    </xs:extension>\n  </xs:simpleContent>\n</xs:complexType>\n\n<xs:complexType name=\"Tr\">\n  <xs:annotation><xs:documentation>\n    The ID attribute is added here to the TR tag to avoid\n    problems of code generators which do not properly\n    interpret the TR/TD structures\n  </xs:documentation></xs:annotation>\n  <xs:sequence>\n    <xs:element name=\"TD\" type=\"Td\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n  <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n</xs:complexType>\n\n<!-- FITS file, perhaps with specification of which extension to seek to -->\n<xs:complexType name=\"FITS\">\n  <xs:sequence>\n    <xs:element name=\"STREAM\" type=\"Stream\"/>\n  </xs:sequence>\n  <xs:attribute name=\"extnum\" type=\"xs:positiveInteger\"/>\n</xs:complexType>\n\n<!-- BINARY data format -->\n<xs:complexType name=\"Binary\">\n  <xs:sequence>\n    <xs:element name=\"STREAM\" type=\"Stream\"/>\n  </xs:sequence>\n</xs:complexType>\n\n<!-- BINARY2 data format -->\n<xs:complexType name=\"Binary2\">\n  <xs:sequence>\n    <xs:element name=\"STREAM\" type=\"Stream\"/>\n  </xs:sequence>\n</xs:complexType>\n\n<!-- STREAM can be local or remote, encoded or not -->\n<xs:complexType name=\"Stream\">\n  <xs:simpleContent>\n    <xs:extension base=\"xs:string\">\n      <xs:attribute name=\"type\" default=\"locator\">\n        <xs:simpleType>\n          <xs:restriction base=\"xs:NMTOKEN\">\n            <xs:enumeration value=\"locator\"/>\n            <xs:enumeration value=\"other\"/>\n          </xs:restriction>\n        </xs:simpleType>\n      </xs:attribute>\n      <xs:attribute name=\"href\" type=\"xs:anyURI\"/>\n      <xs:attribute name=\"actuate\" default=\"onRequest\">\n        <xs:simpleType>\n          <xs:restriction base=\"xs:NMTOKEN\">\n            <xs:enumeration value=\"onLoad\"/>\n            <xs:enumeration value=\"onRequest\"/>\n            <xs:enumeration value=\"other\"/>\n            <xs:enumeration value=\"none\"/>\n          </xs:restriction>\n        </xs:simpleType>\n      </xs:attribute>\n      <xs:attribute name=\"encoding\" type=\"encodingType\" default=\"none\"/>\n      <xs:attribute name=\"expires\" type=\"xs:dateTime\"/>\n      <xs:attribute name=\"rights\" type=\"xs:token\"/>\n    </xs:extension>\n  </xs:simpleContent>\n</xs:complexType>\n\n<!-- A TABLE is a sequence of FIELD/PARAMs and LINKS and DESCRIPTION,\n     possibly followed by a DATA section\n-->\n<xs:complexType name=\"Table\">\n  <xs:annotation><xs:documentation>\n    Added in Version 1.2: INFO for diagnostics\n  </xs:documentation></xs:annotation>\n  <xs:sequence>\n    <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n<!-- GL: why a choice iso for example -->\n<!--\n      <xs:element name=\"PARAM\" type=\"Param\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n      <xs:element name=\"FIELD\" type=\"Field\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n      <xs:element name=\"GROUP\" type=\"Group\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n-->\n<!--\n  This could also enforce groups to be defined after the fields and params\n  to which they must have a reference, which is somewhat more logical\n-->\n    <!-- Added Version 1.2: -->\n    <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    <!-- An empty table without any FIELD/PARAM should not be acceptable -->\n    <xs:choice minOccurs=\"1\" maxOccurs=\"unbounded\">\n      <xs:element name=\"FIELD\" type=\"Field\"/>\n      <xs:element name=\"PARAM\" type=\"Param\"/>\n      <xs:element name=\"GROUP\" type=\"Group\"/>\n    </xs:choice>\n    <xs:element name=\"LINK\" type=\"Link\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    <!-- This would allow several DATA parts in a table (future extension?)\n    <xs:sequence minOccurs=\"0\" maxOccurs=\"unbounded\">\n      <xs:element name=\"DATA\" type=\"Data\"/>\n      <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    </xs:sequence>\n    -->\n    <xs:element name=\"DATA\" type=\"Data\" minOccurs=\"0\"/>\n    <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n  <xs:attribute name=\"ID\"   type=\"xs:ID\"/>\n  <xs:attribute name=\"name\" type=\"xs:token\"/>\n  <xs:attribute name=\"ref\"  type=\"xs:IDREF\"/>\n  <xs:attribute name=\"ucd\"  type=\"ucdType\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n  <xs:attribute name=\"nrows\" type=\"xs:nonNegativeInteger\"/>\n</xs:complexType>\n\n<!-- RESOURCES can contain DESCRIPTION, (INFO|PARAM|COSYS), LINK, TABLEs -->\n<xs:complexType name=\"Resource\">\n  <xs:annotation><xs:documentation>\n     Added in Version 1.2: INFO for diagnostics in several places\n  </xs:documentation></xs:annotation>\n  <xs:sequence>\n    <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n    <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n      <xs:element name=\"COOSYS\" type=\"CoordinateSystem\"/><!-- Deprecated in V1.2 -->\n      <xs:element name=\"GROUP\" type=\"Group\" />\n      <xs:element name=\"PARAM\" type=\"Param\" />\n    </xs:choice>\n    <xs:sequence minOccurs=\"0\" maxOccurs=\"unbounded\">\n      <xs:element name=\"LINK\" type=\"Link\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n      <xs:choice>\n        <xs:element name=\"TABLE\" type=\"Table\" />\n        <xs:element name=\"RESOURCE\" type=\"Resource\" />\n      </xs:choice>\n      <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    </xs:sequence>\n    <!-- Suggested Doug Tody, to include new RESOURCE types -->\n    <xs:any namespace=\"##other\" processContents=\"lax\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n  <xs:attribute name=\"name\" type=\"xs:token\"/>\n  <xs:attribute name=\"ID\"   type=\"xs:ID\"/>\n  <xs:attribute name=\"utype\" type=\"xs:string\"/>\n  <xs:attribute name=\"type\" default=\"results\">\n    <xs:simpleType>\n      <xs:restriction base=\"xs:NMTOKEN\">\n        <xs:enumeration value=\"results\"/>\n        <xs:enumeration value=\"meta\"/>\n      </xs:restriction>\n    </xs:simpleType>\n  </xs:attribute>\n  <!-- Suggested Doug Tody, to include new RESOURCE attributes -->\n  <xs:anyAttribute namespace=\"##other\" processContents=\"lax\"/>\n</xs:complexType>\n\n<!-- VOTable is the root element -->\n<xs:element name=\"VOTABLE\">\n<xs:complexType>\n  <xs:sequence>\n    <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\" minOccurs=\"0\"/>\n    <xs:element name=\"DEFINITIONS\" type=\"Definitions\" minOccurs=\"0\"/><!-- Deprecated -->\n    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n      <xs:element name=\"COOSYS\" type=\"CoordinateSystem\"/><!-- Deprecated in V1.2 -->\n      <xs:element name=\"GROUP\" type=\"Group\" />\n      <xs:element name=\"PARAM\" type=\"Param\" />\n      <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n    </xs:choice>\n    <xs:element name=\"RESOURCE\" type=\"Resource\" minOccurs=\"1\" maxOccurs=\"unbounded\"/>\n    <xs:element name=\"INFO\" type=\"Info\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n  </xs:sequence>\n  <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n  <xs:attribute name=\"version\">\n     <xs:simpleType>\n       <xs:restriction base=\"xs:NMTOKEN\">\n         <xs:enumeration value=\"1.3\"/>\n       </xs:restriction>\n     </xs:simpleType>\n   </xs:attribute>\n</xs:complexType>\n</xs:element>\n\n</xs:schema>"},{"col":4,"comment":"null","endLoc":3419,"header":"def __repr__(self)","id":6132,"name":"__repr__","nodeType":"Function","startLoc":3417,"text":"def __repr__(self):\n        n_tables = len(list(self.iter_tables()))\n        return f'<VOTABLE>... {n_tables} tables ...</VOTABLE>'"},{"id":6133,"name":"VOTable.v1.1.xsd","nodeType":"TextFile","path":"astropy/io/votable/data","text":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--W3C Schema for VOTable  = Virtual Observatory Tabular Format\n.Version 1.0 : 15-Apr-2002\n.Version 1.09: 23-Jan-2004 Version 1.09\n.Version 1.09: 30-Jan-2004 Version 1.091\n.Version 1.09: 22-Mar-2004 Version 1.092\n.Version 1.094: 02-Jun-2004 GROUP does not contain FIELD\n.Version 1.1 :  10-Jun-2004 remove the complexContent\n-->\n<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" elementFormDefault=\"qualified\" targetNamespace=\"http://www.ivoa.net/xml/VOTable/v1.1\" xmlns=\"http://www.ivoa.net/xml/VOTable/v1.1\">\n\n<!-- Here we define some interesting new datatypes:\n     - anyTEXT   may have embedded XHTML (conforming HTML)\n     - astroYear is an epoch in Besselian or Julian year, e.g. J2000\n     - arrayDEF  specifies an array size e.g. 12x23x*\n     - dataType  defines the acceptable datatypes\n     - ucdType   defines the acceptable UCDs (UCD1+)\n     - precType  defines the acceptable precisions\n     - yesno     defines just the 2 alternatives\n-->\n\n<xs:complexType name=\"anyTEXT\" mixed=\"true\">\n      <xs:sequence>\n        <xs:any minOccurs=\"0\" maxOccurs=\"unbounded\" processContents=\"skip\"/>\n      </xs:sequence>\n</xs:complexType>\n\n<xs:simpleType name=\"astroYear\">\n  <xs:restriction base=\"xs:token\">\n    <xs:pattern value=\"[JB]?[0-9]+([.][0-9]*)?\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"ucdType\">\n  <xs:restriction base=\"xs:token\">\n    <xs:pattern value=\"[A-Za-z0-9_.;\\-]*\"/><!-- UCD1 use also / + % -->\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"arrayDEF\">\n  <xs:restriction base=\"xs:token\">\n    <xs:pattern value=\"([0-9]+x)*[0-9]*[*]?(s\\W)?\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"encodingType\">\n  <xs:restriction base=\"xs:NMTOKEN\">\n    <xs:enumeration value=\"gzip\"/>\n    <xs:enumeration value=\"base64\"/>\n    <xs:enumeration value=\"dynamic\"/>\n    <xs:enumeration value=\"none\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"dataType\">\n  <xs:restriction base=\"xs:NMTOKEN\">\n    <xs:enumeration value=\"boolean\"/>\n    <xs:enumeration value=\"bit\"/>\n    <xs:enumeration value=\"unsignedByte\"/>\n    <xs:enumeration value=\"short\"/>\n    <xs:enumeration value=\"int\"/>\n    <xs:enumeration value=\"long\"/>\n    <xs:enumeration value=\"char\"/>\n    <xs:enumeration value=\"unicodeChar\"/>\n    <xs:enumeration value=\"float\"/>\n    <xs:enumeration value=\"double\"/>\n    <xs:enumeration value=\"floatComplex\"/>\n    <xs:enumeration value=\"doubleComplex\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"precType\">\n  <xs:restriction base=\"xs:token\">\n    <xs:pattern value=\"[EF]?[1-9][0-9]*\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<xs:simpleType name=\"yesno\">\n  <xs:restriction base=\"xs:NMTOKEN\">\n    <xs:enumeration value=\"yes\"/>\n    <xs:enumeration value=\"no\"/>\n  </xs:restriction>\n</xs:simpleType>\n\n<!-- VOTable is the root element -->\n  <xs:element name=\"VOTABLE\">\n    <xs:complexType>\n      <xs:sequence>\n        <xs:element ref=\"DESCRIPTION\" minOccurs=\"0\"/>\n        <xs:element ref=\"DEFINITIONS\" minOccurs=\"0\"/><!-- Deprecated -->\n\t<xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n          <xs:element ref=\"COOSYS\"/>\n          <xs:element ref=\"PARAM\"/>\n          <xs:element ref=\"INFO\"/>\n\t</xs:choice>\n        <xs:element ref=\"RESOURCE\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n      </xs:sequence>\n      <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n      <xs:attribute name=\"version\">\n        <xs:simpleType>\n          <xs:restriction base=\"xs:NMTOKEN\">\n            <xs:enumeration value=\"1.1\"/>\n          </xs:restriction>\n        </xs:simpleType>\n      </xs:attribute>\n    </xs:complexType>\n  </xs:element>\n\n<!-- RESOURCES can contain DESCRIPTION, (INFO|PARAM|COSYS), LINK, TABLEs -->\n  <xs:element name=\"RESOURCE\">\n    <xs:complexType>\n      <xs:sequence>\n        <xs:element ref=\"DESCRIPTION\" minOccurs=\"0\"/>\n\t<xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n          <xs:element ref=\"INFO\"/>\n          <xs:element ref=\"COOSYS\"/>\n          <xs:element ref=\"PARAM\"/>\n\t</xs:choice>\n        <xs:element ref=\"LINK\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n        <xs:element ref=\"TABLE\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n        <xs:element ref=\"RESOURCE\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n\t<!-- Suggested Doug Tody, to include new RESOURCE types -->\n\t<xs:any namespace=\"##other\" processContents=\"lax\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n      </xs:sequence>\n      <xs:attribute name=\"name\" type=\"xs:token\"/>\n      <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n      <xs:attribute name=\"utype\" type=\"xs:string\"/>\n      <xs:attribute name=\"type\" default=\"results\">\n        <xs:simpleType>\n          <xs:restriction base=\"xs:NMTOKEN\">\n            <xs:enumeration value=\"results\"/>\n            <xs:enumeration value=\"meta\"/>\n          </xs:restriction>\n        </xs:simpleType>\n      </xs:attribute>\n      <!-- Suggested Doug Tody, to include new RESOURCE attributes -->\n      <xs:anyAttribute namespace=\"##other\" processContents=\"lax\"/>\n    </xs:complexType>\n  </xs:element>\n\n  <xs:element name=\"DESCRIPTION\" type=\"anyTEXT\"/>\n\n  <xs:element name=\"DEFINITIONS\">\n  <xs:annotation>\n    <xs:documentation>Deprecated in Version 1.1</xs:documentation>\n  </xs:annotation>\n    <xs:complexType>\n      <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n        <xs:element ref=\"COOSYS\"/>\n        <xs:element ref=\"PARAM\"/>\n      </xs:choice>\n    </xs:complexType>\n  </xs:element>\n\n<!-- INFO is a name-value pair -->\n  <xs:element name=\"INFO\">\n    <xs:complexType><xs:simpleContent>\n      <xs:extension base=\"xs:string\">\n        <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n        <xs:attribute name=\"name\" type=\"xs:token\" use=\"required\"/>\n        <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n      </xs:extension>\n    </xs:simpleContent></xs:complexType>\n  </xs:element>\n\n<!-- A PARAM is similar to a FIELD, but it also has a \"value\" attribute -->\n  <xs:element name=\"PARAM\">\n    <xs:complexType>\n      <xs:sequence>\n        <xs:element ref=\"DESCRIPTION\" minOccurs=\"0\"/>\n        <xs:element ref=\"VALUES\" minOccurs=\"0\"/>\n        <xs:element ref=\"LINK\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n      </xs:sequence>\n      <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n      <xs:attribute name=\"unit\" type=\"xs:token\"/>\n      <xs:attribute name=\"datatype\" type=\"dataType\" use=\"required\"/>\n      <xs:attribute name=\"precision\" type=\"precType\"/>\n      <xs:attribute name=\"width\" type=\"xs:positiveInteger\"/>\n      <xs:attribute name=\"ref\" type=\"xs:IDREF\"/>\n      <xs:attribute name=\"name\" type=\"xs:token\" use=\"required\"/>\n      <xs:attribute name=\"ucd\" type=\"ucdType\"/>\n      <xs:attribute name=\"utype\" type=\"xs:string\"/>\n      <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n      <xs:attribute name=\"arraysize\" type=\"arrayDEF\"/>\n    </xs:complexType>\n  </xs:element>\n\n<!-- A TABLE is a sequence of FIELD/PARAMs and LINKS and DESCRIPTION,\n     possibly followed by a DATA section\n-->\n  <xs:element name=\"TABLE\">\n    <xs:complexType>\n      <xs:sequence>\n        <xs:element ref=\"DESCRIPTION\" minOccurs=\"0\"/>\n\t<xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n          <xs:element ref=\"FIELD\"/>\n          <xs:element ref=\"PARAM\"/>\n          <xs:element ref=\"GROUP\"/>\n\t</xs:choice>\n        <xs:element ref=\"LINK\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n        <xs:element ref=\"DATA\" minOccurs=\"0\"/>\n      </xs:sequence>\n      <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n      <xs:attribute name=\"name\" type=\"xs:token\"/>\n      <xs:attribute name=\"ref\" type=\"xs:IDREF\"/>\n      <xs:attribute name=\"ucd\" type=\"ucdType\"/>\n      <xs:attribute name=\"utype\" type=\"xs:string\"/>\n      <xs:attribute name=\"nrows\" type=\"xs:nonNegativeInteger\"/>\n    </xs:complexType>\n  </xs:element>\n\n<!-- FIELD is the definition of what is in a column of the table -->\n  <xs:element name=\"FIELD\">\n    <xs:complexType>\n      <xs:sequence> <!-- minOccurs=\"0\" maxOccurs=\"unbounded\" -->\n        <xs:element ref=\"DESCRIPTION\" minOccurs=\"0\"/>\n        <xs:element ref=\"VALUES\" minOccurs=\"0\"/> <!-- maxOccurs=\"2\" -->\n        <xs:element ref=\"LINK\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n      </xs:sequence>\n      <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n      <xs:attribute name=\"unit\" type=\"xs:token\"/>\n      <xs:attribute name=\"datatype\" type=\"dataType\" use=\"required\"/>\n      <xs:attribute name=\"precision\" type=\"precType\"/>\n      <xs:attribute name=\"width\" type=\"xs:positiveInteger\"/>\n      <xs:attribute name=\"ref\" type=\"xs:IDREF\"/>\n      <xs:attribute name=\"name\" type=\"xs:token\" use=\"required\"/>\n      <xs:attribute name=\"ucd\" type=\"ucdType\"/>\n      <xs:attribute name=\"utype\" type=\"xs:string\"/>\n      <xs:attribute name=\"arraysize\" type=\"xs:string\"/>\n      <xs:attribute name=\"type\">\n\t<!-- type is not in the Version 1.1, but is kept for\n\t     backward compatibility purposes\n\t-->\n        <xs:simpleType>\n          <xs:restriction base=\"xs:NMTOKEN\">\n            <xs:enumeration value=\"hidden\"/>\n            <xs:enumeration value=\"no_query\"/>\n            <xs:enumeration value=\"trigger\"/>\n            <xs:enumeration value=\"location\"/>\n          </xs:restriction>\n        </xs:simpleType>\n      </xs:attribute>\n    </xs:complexType>\n  </xs:element>\n\n<!-- GROUP groups columns; may include descriptions, fields/params/groups -->\n  <xs:element name=\"GROUP\">\n    <xs:complexType>\n      <xs:sequence>\n        <xs:element ref=\"DESCRIPTION\" minOccurs=\"0\"/>\n        <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n\t  <xs:element ref=\"FIELDref\"/>\n\t  <xs:element ref=\"PARAMref\"/>\n\t  <xs:element ref=\"PARAM\"/>\n\t  <xs:element ref=\"GROUP\"/>\n        </xs:choice>\n      </xs:sequence>\n      <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n      <xs:attribute name=\"name\" type=\"xs:token\"/>\n      <xs:attribute name=\"ref\" type=\"xs:IDREF\"/>\n      <xs:attribute name=\"ucd\" type=\"ucdType\"/>\n      <xs:attribute name=\"utype\" type=\"xs:string\"/>\n    </xs:complexType>\n  </xs:element>\n\n<!-- FIELDref and PARAMref are references to FIELD or PARAM defined\n     in the parent TABLE or RESOURCE -->\n  <xs:element name=\"FIELDref\">\n    <xs:complexType>\n      <xs:attribute name=\"ref\" type=\"xs:IDREF\" use=\"required\"/>\n      <!-- utype and maybe ucd could well be added there,\n\t   will be if necessary -->\n    </xs:complexType>\n  </xs:element>\n  <xs:element name=\"PARAMref\">\n    <xs:complexType>\n      <xs:attribute name=\"ref\" type=\"xs:IDREF\" use=\"required\"/>\n      <!-- utype and maybe ucd could well be added there,\n\t   will be if necessary -->\n    </xs:complexType>\n  </xs:element>\n\n<!-- VALUES expresses the values that can be taken by the data\n     in a column or by a parameter\n-->\n  <xs:element name=\"VALUES\">\n    <xs:complexType>\n      <xs:sequence>\n        <xs:element ref=\"MIN\" minOccurs=\"0\"/>\n        <xs:element ref=\"MAX\" minOccurs=\"0\"/>\n        <xs:element ref=\"OPTION\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n      </xs:sequence>\n      <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n      <xs:attribute name=\"type\" default=\"legal\">\n        <xs:simpleType>\n          <xs:restriction base=\"xs:NMTOKEN\">\n            <xs:enumeration value=\"legal\"/>\n            <xs:enumeration value=\"actual\"/>\n          </xs:restriction>\n        </xs:simpleType>\n      </xs:attribute>\n      <xs:attribute name=\"null\" type=\"xs:token\"/>\n      <xs:attribute name=\"ref\" type=\"xs:IDREF\"/>\n      <!-- xs:attribute name=\"invalid\" type=\"yesno\" default=\"no\"/ -->\n    </xs:complexType>\n  </xs:element>\n  <xs:element name=\"MIN\">\n    <xs:complexType>\n      <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n      <xs:attribute name=\"inclusive\" type=\"yesno\" default=\"yes\"/>\n    </xs:complexType>\n  </xs:element>\n  <xs:element name=\"MAX\">\n    <xs:complexType>\n      <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n      <xs:attribute name=\"inclusive\" type=\"yesno\" default=\"yes\"/>\n    </xs:complexType>\n  </xs:element>\n  <xs:element name=\"OPTION\">\n    <xs:complexType>\n      <xs:sequence>\n        <xs:element ref=\"OPTION\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n      </xs:sequence>\n      <xs:attribute name=\"name\" type=\"xs:token\"/>\n      <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n    </xs:complexType>\n  </xs:element>\n\n<!-- The LINK is a URL (href) or some other kind of reference (gref) -->\n  <xs:element name=\"LINK\">\n    <xs:complexType mixed=\"true\">\n      <xs:attribute name=\"ID\" type=\"xs:ID\"/>\n      <xs:attribute name=\"content-role\">\n        <xs:simpleType>\n          <xs:restriction base=\"xs:NMTOKEN\">\n            <xs:enumeration value=\"query\"/>\n            <xs:enumeration value=\"hints\"/>\n            <xs:enumeration value=\"doc\"/>\n            <xs:enumeration value=\"location\"/>\n          </xs:restriction>\n        </xs:simpleType>\n      </xs:attribute>\n      <xs:attribute name=\"content-type\" type=\"xs:token\"/>\n      <xs:attribute name=\"title\" type=\"xs:string\"/>\n      <xs:attribute name=\"value\" type=\"xs:string\"/>\n      <xs:attribute name=\"href\" type=\"xs:anyURI\"/>\n      <xs:attribute name=\"gref\" type=\"xs:token\"/><!-- Deprecated in V1.1 -->\n      <xs:attribute name=\"action\" type=\"xs:anyURI\"/>\n    </xs:complexType>\n  </xs:element>\n\n<!-- DATA is the actual table data, in one of three formats -->\n  <xs:element name=\"DATA\">\n    <xs:complexType>\n      <xs:choice>\n        <xs:element ref=\"TABLEDATA\"/>\n        <xs:element ref=\"BINARY\"/>\n        <xs:element ref=\"FITS\"/>\n      </xs:choice>\n    </xs:complexType>\n  </xs:element>\n\n<!-- Pure XML data -->\n  <xs:element name=\"TABLEDATA\">\n    <xs:complexType>\n      <xs:sequence>\n        <xs:element ref=\"TR\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n      </xs:sequence>\n    </xs:complexType>\n  </xs:element>\n\n  <xs:element name=\"TD\">\n    <xs:complexType><xs:simpleContent>\n      <xs:extension base=\"xs:string\">\n        <!-- xs:attribute name=\"ref\" type=\"xs:IDREF\"/ -->\n        <xs:attribute name=\"encoding\" type=\"encodingType\"/>\n      </xs:extension>\n    </xs:simpleContent></xs:complexType>\n  </xs:element>\n\n  <xs:element name=\"TR\">\n    <xs:complexType>\n      <xs:sequence>\n        <xs:element ref=\"TD\" maxOccurs=\"unbounded\"/>\n      </xs:sequence>\n    </xs:complexType>\n  </xs:element>\n\n<!-- FITS file, perhaps with specification of which extension to seek to -->\n  <xs:element name=\"FITS\">\n    <xs:complexType>\n      <xs:sequence>\n        <xs:element ref=\"STREAM\"/>\n      </xs:sequence>\n      <xs:attribute name=\"extnum\" type=\"xs:positiveInteger\"/>\n    </xs:complexType>\n  </xs:element>\n\n<!-- BINARY data format -->\n  <xs:element name=\"BINARY\">\n    <xs:complexType>\n      <xs:sequence>\n        <xs:element ref=\"STREAM\"/>\n      </xs:sequence>\n    </xs:complexType>\n  </xs:element>\n\n<!-- STREAM can be local or remote, encoded or not -->\n  <xs:element name=\"STREAM\">\n    <xs:complexType>\n      <xs:simpleContent>\n        <xs:extension base=\"xs:string\">\n          <xs:attribute name=\"type\" default=\"locator\">\n            <xs:simpleType>\n              <xs:restriction base=\"xs:NMTOKEN\">\n                <xs:enumeration value=\"locator\"/>\n                <xs:enumeration value=\"other\"/>\n              </xs:restriction>\n            </xs:simpleType>\n          </xs:attribute>\n          <xs:attribute name=\"href\" type=\"xs:anyURI\"/>\n          <xs:attribute name=\"actuate\" default=\"onRequest\">\n            <xs:simpleType>\n              <xs:restriction base=\"xs:NMTOKEN\">\n                <xs:enumeration value=\"onLoad\"/>\n                <xs:enumeration value=\"onRequest\"/>\n                <xs:enumeration value=\"other\"/>\n                <xs:enumeration value=\"none\"/>\n              </xs:restriction>\n            </xs:simpleType>\n          </xs:attribute>\n          <xs:attribute name=\"encoding\" type=\"encodingType\" default=\"none\"/>\n          <xs:attribute name=\"expires\" type=\"xs:dateTime\"/>\n          <xs:attribute name=\"rights\" type=\"xs:token\"/>\n        </xs:extension>\n      </xs:simpleContent>\n    </xs:complexType>\n  </xs:element>\n\n<!-- Expresses the coordinate system we are using -->\n  <xs:element name=\"COOSYS\">\n    <xs:complexType><xs:simpleContent>\n      <xs:extension base=\"xs:string\">\n        <xs:attribute name=\"ID\" type=\"xs:ID\" use=\"required\"/>\n        <xs:attribute name=\"equinox\" type=\"astroYear\"/>\n        <xs:attribute name=\"epoch\" type=\"astroYear\"/>\n        <xs:attribute name=\"system\" default=\"eq_FK5\">\n          <xs:simpleType>\n            <xs:restriction base=\"xs:NMTOKEN\">\n              <xs:enumeration value=\"eq_FK4\"/>\n              <xs:enumeration value=\"eq_FK5\"/>\n              <xs:enumeration value=\"ICRS\"/>\n              <xs:enumeration value=\"ecl_FK4\"/>\n              <xs:enumeration value=\"ecl_FK5\"/>\n              <xs:enumeration value=\"galactic\"/>\n              <xs:enumeration value=\"supergalactic\"/>\n              <xs:enumeration value=\"xy\"/>\n              <xs:enumeration value=\"barycentric\"/>\n              <xs:enumeration value=\"geo_app\"/>\n            </xs:restriction>\n          </xs:simpleType>\n        </xs:attribute>\n      </xs:extension></xs:simpleContent></xs:complexType>\n  </xs:element>\n\n</xs:schema>\n"},{"col":4,"comment":"\n        Iterates over all tables in the VOTable file in a \"flat\" way,\n        ignoring the nesting of resources etc.\n        ","endLoc":3708,"header":"def iter_tables(self)","id":6134,"name":"iter_tables","nodeType":"Function","startLoc":3701,"text":"def iter_tables(self):\n        \"\"\"\n        Iterates over all tables in the VOTable file in a \"flat\" way,\n        ignoring the nesting of resources etc.\n        \"\"\"\n        for resource in self.resources:\n            for table in resource.iter_tables():\n                yield table"},{"col":4,"comment":"null","endLoc":361,"header":"def output(self, value, mask)","id":6135,"name":"output","nodeType":"Function","startLoc":341,"text":"def output(self, value, mask):\n        if mask:\n            return ''\n\n        # The output methods for Char assume that value is either str or bytes.\n        # This method needs to return a str, but needs to warn if the str contains\n        # non-ASCII characters.\n        try:\n            if isinstance(value, str):\n                value.encode('ascii')\n            else:\n                # Check for non-ASCII chars in the bytes object.\n                value = value.decode('ascii')\n        except (ValueError, UnicodeEncodeError):\n            warn_or_raise(E24, UnicodeEncodeError, (value, self.field_name))\n        finally:\n            if isinstance(value, bytes):\n                # Convert the bytes to str regardless of non-ASCII chars.\n                value = value.decode('utf-8')\n\n        return xml_escape_cdata(value)"},{"col":0,"comment":"\n    Prints a line of source code, highlighting a particular character\n    position in the line.  Useful for displaying the context of error\n    messages.\n\n    If the line is more than ``width`` characters, the line is truncated\n    accordingly and '…' characters are inserted at the front and/or\n    end.\n\n    It looks like this::\n\n        there_is_a_syntax_error_here :\n                                     ^\n\n    Parameters\n    ----------\n    line : unicode\n        The line of code to display\n\n    col : int, optional\n        The character in the line to highlight.  ``col`` must be less\n        than ``len(line)``.\n\n    file : writable file-like, optional\n        Where to write to.  Defaults to `sys.stdout`.\n\n    tabwidth : int, optional\n        The number of spaces per tab (``'\\t'``) character.  Default\n        is 8.  All tabs will be converted to spaces to ensure that the\n        caret lines up with the correct column.\n\n    width : int, optional\n        The width of the display, beyond which the line will be\n        truncated.  Defaults to 70 (this matches the default in the\n        standard library's `textwrap` module).\n    ","endLoc":1106,"header":"def print_code_line(line, col=None, file=None, tabwidth=8, width=70)","id":6136,"name":"print_code_line","nodeType":"Function","startLoc":1031,"text":"def print_code_line(line, col=None, file=None, tabwidth=8, width=70):\n    \"\"\"\n    Prints a line of source code, highlighting a particular character\n    position in the line.  Useful for displaying the context of error\n    messages.\n\n    If the line is more than ``width`` characters, the line is truncated\n    accordingly and '…' characters are inserted at the front and/or\n    end.\n\n    It looks like this::\n\n        there_is_a_syntax_error_here :\n                                     ^\n\n    Parameters\n    ----------\n    line : unicode\n        The line of code to display\n\n    col : int, optional\n        The character in the line to highlight.  ``col`` must be less\n        than ``len(line)``.\n\n    file : writable file-like, optional\n        Where to write to.  Defaults to `sys.stdout`.\n\n    tabwidth : int, optional\n        The number of spaces per tab (``'\\\\t'``) character.  Default\n        is 8.  All tabs will be converted to spaces to ensure that the\n        caret lines up with the correct column.\n\n    width : int, optional\n        The width of the display, beyond which the line will be\n        truncated.  Defaults to 70 (this matches the default in the\n        standard library's `textwrap` module).\n    \"\"\"\n\n    if file is None:\n        file = _get_stdout()\n\n    if conf.unicode_output:\n        ellipsis = '…'\n    else:\n        ellipsis = '...'\n\n    write = file.write\n\n    if col is not None:\n        if col >= len(line):\n            raise ValueError('col must be less the the line length.')\n        ntabs = line[:col].count('\\t')\n        col += ntabs * (tabwidth - 1)\n\n    line = line.rstrip('\\n')\n    line = line.replace('\\t', ' ' * tabwidth)\n\n    if col is not None and col > width:\n        new_col = min(width // 2, len(line) - col)\n        offset = col - new_col\n        line = line[offset + len(ellipsis):]\n        width -= len(ellipsis)\n        new_col = col\n        col -= offset\n        color_print(ellipsis, 'darkgrey', file=file, end='')\n\n    if len(line) > width:\n        write(line[:width - len(ellipsis)])\n        color_print(ellipsis, 'darkgrey', file=file)\n    else:\n        write(line)\n        write('\\n')\n\n    if col is not None:\n        write(' ' * col)\n        color_print('^', 'red', file=file)"},{"id":6137,"name":"astropy/io/votable/tests","nodeType":"Package"},{"fileName":"util_test.py","filePath":"astropy/io/votable/tests","id":6138,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nA set of tests for the util.py module\n\"\"\"\nimport pytest\n\nfrom astropy.io.votable import util\n\n\ndef test_range_list():\n    assert util.coerce_range_list_param((5,)) == (\"5.0\", 1)\n\n\ndef test_range_list2():\n    assert util.coerce_range_list_param((5e-7, 8e-7)) == (\"5e-07,8e-07\", 2)\n\n\ndef test_range_list3():\n    assert util.coerce_range_list_param((5e-7, 8e-7, \"FOO\")) == (\n        \"5e-07,8e-07;FOO\", 3)\n\n\ndef test_range_list4a():\n    with pytest.raises(ValueError):\n        util.coerce_range_list_param(\n            (5e-7, (None, 8e-7), (4, None), (4, 5), \"J\", \"FOO\"))\n\n\ndef test_range_list4():\n    assert (util.coerce_range_list_param(\n        (5e-7, (None, 8e-7), (4, None), (4, 5), \"J\", \"FOO\"), numeric=False) ==\n            (\"5e-07,/8e-07,4/,4/5,J;FOO\", 6))\n\n\ndef test_range_list5():\n    with pytest.raises(ValueError):\n        util.coerce_range_list_param(('FOO', ))\n\n\ndef test_range_list6():\n    with pytest.raises(ValueError):\n        print(util.coerce_range_list_param((5, 'FOO'), util.stc_reference_frames))\n\n\ndef test_range_list7():\n    assert util.coerce_range_list_param((\"J\",), numeric=False) == (\"J\", 1)\n\n\ndef test_range_list8():\n    for s in [\"5.0\",\n              \"5e-07,8e-07\",\n              \"5e-07,8e-07;FOO\",\n              \"5e-07,/8e-07,4.0/,4.0/5.0;FOO\",\n              \"J\"]:\n        assert util.coerce_range_list_param(s, numeric=False)[0] == s\n\n\ndef test_range_list9a():\n    with pytest.raises(ValueError):\n        util.coerce_range_list_param(\"52,-27.8;FOO\", util.stc_reference_frames)\n\n\ndef test_range_list9():\n    assert util.coerce_range_list_param(\n        \"52,-27.8;GALACTIC\", util.stc_reference_frames)\n"},{"col":4,"comment":"\n        The version of the VOTable specification that the file uses.\n        ","endLoc":3426,"header":"@property\n    def version(self)","id":6139,"name":"version","nodeType":"Function","startLoc":3421,"text":"@property\n    def version(self):\n        \"\"\"\n        The version of the VOTable specification that the file uses.\n        \"\"\"\n        return self._version"},{"col":4,"comment":"null","endLoc":3435,"header":"@version.setter\n    def version(self, version)","id":6140,"name":"version","nodeType":"Function","startLoc":3428,"text":"@version.setter\n    def version(self, version):\n        version = str(version)\n        if version not in self._version_namespace_map:\n            allowed_from_map = \"', '\".join(self._version_namespace_map)\n            raise ValueError(\n                f\"astropy.io.votable only supports VOTable versions '{allowed_from_map}'\")\n        self._version = version"},{"col":4,"comment":"\n        A list of coordinate system descriptions for the file.  Must\n        contain only `CooSys` objects.\n        ","endLoc":3443,"header":"@property\n    def coordinate_systems(self)","id":6141,"name":"coordinate_systems","nodeType":"Function","startLoc":3437,"text":"@property\n    def coordinate_systems(self):\n        \"\"\"\n        A list of coordinate system descriptions for the file.  Must\n        contain only `CooSys` objects.\n        \"\"\"\n        return self._coordinate_systems"},{"col":4,"comment":"\n        A list of time system descriptions for the file.  Must\n        contain only `TimeSys` objects.\n        ","endLoc":3451,"header":"@property\n    def time_systems(self)","id":6142,"name":"time_systems","nodeType":"Function","startLoc":3445,"text":"@property\n    def time_systems(self):\n        \"\"\"\n        A list of time system descriptions for the file.  Must\n        contain only `TimeSys` objects.\n        \"\"\"\n        return self._time_systems"},{"col":4,"comment":"\n        A list of parameters (constant-valued columns) that apply to\n        the entire file.  Must contain only `Param` objects.\n        ","endLoc":3459,"header":"@property\n    def params(self)","id":6143,"name":"params","nodeType":"Function","startLoc":3453,"text":"@property\n    def params(self):\n        \"\"\"\n        A list of parameters (constant-valued columns) that apply to\n        the entire file.  Must contain only `Param` objects.\n        \"\"\"\n        return self._params"},{"col":4,"comment":"\n        A list of informational parameters (key-value pairs) for the\n        entire file.  Must only contain `Info` objects.\n        ","endLoc":3467,"header":"@property\n    def infos(self)","id":6144,"name":"infos","nodeType":"Function","startLoc":3461,"text":"@property\n    def infos(self):\n        \"\"\"\n        A list of informational parameters (key-value pairs) for the\n        entire file.  Must only contain `Info` objects.\n        \"\"\"\n        return self._infos"},{"col":4,"comment":"\n        A list of resources, in the order they appear in the file.\n        Must only contain `Resource` objects.\n        ","endLoc":3475,"header":"@property\n    def resources(self)","id":6145,"name":"resources","nodeType":"Function","startLoc":3469,"text":"@property\n    def resources(self):\n        \"\"\"\n        A list of resources, in the order they appear in the file.\n        Must only contain `Resource` objects.\n        \"\"\"\n        return self._resources"},{"col":4,"comment":"\n        A list of groups, in the order they appear in the file.  Only\n        supported as a child of the VOTABLE element in VOTable 1.2 or\n        later.\n        ","endLoc":3484,"header":"@property\n    def groups(self)","id":6146,"name":"groups","nodeType":"Function","startLoc":3477,"text":"@property\n    def groups(self):\n        \"\"\"\n        A list of groups, in the order they appear in the file.  Only\n        supported as a child of the VOTABLE element in VOTable 1.2 or\n        later.\n        \"\"\"\n        return self._groups"},{"col":4,"comment":"null","endLoc":3489,"header":"def _add_param(self, iterator, tag, data, config, pos)","id":6147,"name":"_add_param","nodeType":"Function","startLoc":3486,"text":"def _add_param(self, iterator, tag, data, config, pos):\n        param = Param(self, config=config, pos=pos, **data)\n        self.params.append(param)\n        param.parse(iterator, config)"},{"col":4,"comment":"\n        Create a `Table` instance from a given `astropy.table.Table`\n        instance.\n        ","endLoc":3037,"header":"@classmethod\n    def from_table(cls, votable, table)","id":6148,"name":"from_table","nodeType":"Function","startLoc":3012,"text":"@classmethod\n    def from_table(cls, votable, table):\n        \"\"\"\n        Create a `Table` instance from a given `astropy.table.Table`\n        instance.\n        \"\"\"\n        kwargs = {}\n        for key in ['ID', 'name', 'ref', 'ucd', 'utype']:\n            val = table.meta.get(key)\n            if val is not None:\n                kwargs[key] = val\n        new_table = cls(votable, **kwargs)\n        if 'description' in table.meta:\n            new_table.description = table.meta['description']\n\n        for colname in table.colnames:\n            column = table[colname]\n            new_table.fields.append(Field.from_table_column(votable, column))\n\n        if table.mask is None:\n            new_table.array = ma.array(np.asarray(table))\n        else:\n            new_table.array = ma.array(np.asarray(table),\n                                       mask=np.asarray(table.mask))\n\n        return new_table"},{"col":0,"comment":"null","endLoc":11,"header":"def test_range_list()","id":6149,"name":"test_range_list","nodeType":"Function","startLoc":10,"text":"def test_range_list():\n    assert util.coerce_range_list_param((5,)) == (\"5.0\", 1)"},{"col":4,"comment":"null","endLoc":365,"header":"def _binparse_var(self, read)","id":6150,"name":"_binparse_var","nodeType":"Function","startLoc":363,"text":"def _binparse_var(self, read):\n        length = self._parse_length(read)\n        return read(length).decode('ascii'), False"},{"col":0,"comment":"null","endLoc":15,"header":"def test_range_list2()","id":6151,"name":"test_range_list2","nodeType":"Function","startLoc":14,"text":"def test_range_list2():\n    assert util.coerce_range_list_param((5e-7, 8e-7)) == (\"5e-07,8e-07\", 2)"},{"col":0,"comment":"null","endLoc":20,"header":"def test_range_list3()","id":6152,"name":"test_range_list3","nodeType":"Function","startLoc":18,"text":"def test_range_list3():\n    assert util.coerce_range_list_param((5e-7, 8e-7, \"FOO\")) == (\n        \"5e-07,8e-07;FOO\", 3)"},{"col":0,"comment":"null","endLoc":26,"header":"def test_range_list4a()","id":6153,"name":"test_range_list4a","nodeType":"Function","startLoc":23,"text":"def test_range_list4a():\n    with pytest.raises(ValueError):\n        util.coerce_range_list_param(\n            (5e-7, (None, 8e-7), (4, None), (4, 5), \"J\", \"FOO\"))"},{"col":0,"comment":"null","endLoc":32,"header":"def test_range_list4()","id":6154,"name":"test_range_list4","nodeType":"Function","startLoc":29,"text":"def test_range_list4():\n    assert (util.coerce_range_list_param(\n        (5e-7, (None, 8e-7), (4, None), (4, 5), \"J\", \"FOO\"), numeric=False) ==\n            (\"5e-07,/8e-07,4/,4/5,J;FOO\", 6))"},{"col":0,"comment":"null","endLoc":37,"header":"def test_range_list5()","id":6155,"name":"test_range_list5","nodeType":"Function","startLoc":35,"text":"def test_range_list5():\n    with pytest.raises(ValueError):\n        util.coerce_range_list_param(('FOO', ))"},{"col":0,"comment":"null","endLoc":42,"header":"def test_range_list6()","id":6156,"name":"test_range_list6","nodeType":"Function","startLoc":40,"text":"def test_range_list6():\n    with pytest.raises(ValueError):\n        print(util.coerce_range_list_param((5, 'FOO'), util.stc_reference_frames))"},{"col":0,"comment":"null","endLoc":46,"header":"def test_range_list7()","id":6157,"name":"test_range_list7","nodeType":"Function","startLoc":45,"text":"def test_range_list7():\n    assert util.coerce_range_list_param((\"J\",), numeric=False) == (\"J\", 1)"},{"col":0,"comment":"null","endLoc":55,"header":"def test_range_list8()","id":6158,"name":"test_range_list8","nodeType":"Function","startLoc":49,"text":"def test_range_list8():\n    for s in [\"5.0\",\n              \"5e-07,8e-07\",\n              \"5e-07,8e-07;FOO\",\n              \"5e-07,/8e-07,4.0/,4.0/5.0;FOO\",\n              \"J\"]:\n        assert util.coerce_range_list_param(s, numeric=False)[0] == s"},{"col":0,"comment":"null","endLoc":60,"header":"def test_range_list9a()","id":6159,"name":"test_range_list9a","nodeType":"Function","startLoc":58,"text":"def test_range_list9a():\n    with pytest.raises(ValueError):\n        util.coerce_range_list_param(\"52,-27.8;FOO\", util.stc_reference_frames)"},{"col":4,"comment":"null","endLoc":373,"header":"def _binparse_fixed(self, read)","id":6160,"name":"_binparse_fixed","nodeType":"Function","startLoc":367,"text":"def _binparse_fixed(self, read):\n        s = struct_unpack(self._struct_format, read(self.arraysize))[0]\n        end = s.find(_zero_byte)\n        s = s.decode('ascii')\n        if end != -1:\n            return s[:end], False\n        return s, False"},{"col":0,"comment":"null","endLoc":65,"header":"def test_range_list9()","id":6161,"name":"test_range_list9","nodeType":"Function","startLoc":63,"text":"def test_range_list9():\n    assert util.coerce_range_list_param(\n        \"52,-27.8;GALACTIC\", util.stc_reference_frames)"},{"col":0,"comment":"","endLoc":4,"header":"util_test.py#<anonymous>","id":6162,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nA set of tests for the util.py module\n\"\"\""},{"col":4,"comment":"null","endLoc":383,"header":"def _binoutput_var(self, value, mask)","id":6163,"name":"_binoutput_var","nodeType":"Function","startLoc":375,"text":"def _binoutput_var(self, value, mask):\n        if mask or value is None or value == '':\n            return _zero_int\n        if isinstance(value, str):\n            try:\n                value = value.encode('ascii')\n            except ValueError:\n                vo_raise(E24, (value, self.field_name))\n        return self._write_length(len(value)) + value"},{"fileName":"exception_test.py","filePath":"astropy/io/votable/tests","id":6164,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport pytest\n\n# LOCAL\nfrom astropy.io.votable import converters, exceptions, tree\n\n\ndef test_reraise():\n    def fail():\n        raise RuntimeError(\"This failed\")\n\n    try:\n        try:\n            fail()\n        except RuntimeError as e:\n            exceptions.vo_reraise(e, additional=\"From here\")\n    except RuntimeError as e:\n        assert \"From here\" in str(e)\n    else:\n        assert False\n\n\ndef test_parse_vowarning():\n    config = {'verify': 'exception',\n              'filename': 'foo.xml'}\n    pos = (42, 64)\n    with pytest.warns(exceptions.W47) as w:\n        field = tree.Field(\n            None, name='c', datatype='char',\n            config=config, pos=pos)\n        converters.get_converter(field, config=config, pos=pos)\n\n    parts = exceptions.parse_vowarning(str(w[0].message))\n\n    match = {\n        'number': 47,\n        'is_exception': False,\n        'nchar': 64,\n        'warning': 'W47',\n        'is_something': True,\n        'message': 'Missing arraysize indicates length 1',\n        'doc_url': 'io/votable/api_exceptions.html#w47',\n        'nline': 42,\n        'is_warning': True\n        }\n    assert parts == match\n\n\ndef test_suppress_warnings():\n    cfg = {}\n    warn = exceptions.W01('foo')\n\n    with exceptions.conf.set_temp('max_warnings', 2):\n        with pytest.warns(exceptions.W01) as record:\n            exceptions._suppressed_warning(warn, cfg)\n            assert len(record) == 1\n            assert 'suppressing' not in str(record[0].message)\n\n        with pytest.warns(exceptions.W01, match='suppressing'):\n            exceptions._suppressed_warning(warn, cfg)\n\n        exceptions._suppressed_warning(warn, cfg)\n\n    assert cfg['_warning_counts'][exceptions.W01] == 3\n    assert exceptions.conf.max_warnings == 10\n"},{"col":0,"comment":"null","endLoc":20,"header":"def test_reraise()","id":6165,"name":"test_reraise","nodeType":"Function","startLoc":8,"text":"def test_reraise():\n    def fail():\n        raise RuntimeError(\"This failed\")\n\n    try:\n        try:\n            fail()\n        except RuntimeError as e:\n            exceptions.vo_reraise(e, additional=\"From here\")\n    except RuntimeError as e:\n        assert \"From here\" in str(e)\n    else:\n        assert False"},{"col":4,"comment":"null","endLoc":2189,"header":"def __init__(self, votable, ID=None, name=None, ref=None, ucd=None,\n                 utype=None, nrows=None, id=None, config=None, pos=None,\n                 **extra)","id":6166,"name":"__init__","nodeType":"Function","startLoc":2154,"text":"def __init__(self, votable, ID=None, name=None, ref=None, ucd=None,\n                 utype=None, nrows=None, id=None, config=None, pos=None,\n                 **extra):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n        self._empty = False\n\n        Element.__init__(self)\n        self._votable = votable\n\n        self.ID = (resolve_id(ID, id, config, pos)\n                   or xmlutil.fix_id(name, config, pos))\n        self.name = name\n        xmlutil.check_id(ref, 'ref', config, pos)\n        self._ref = ref\n        self.ucd = ucd\n        self.utype = utype\n        if nrows is not None:\n            nrows = int(nrows)\n            if nrows < 0:\n                raise ValueError(\"'nrows' cannot be negative.\")\n        self._nrows = nrows\n        self.description = None\n        self.format = 'tabledata'\n\n        self._fields = HomogeneousList(Field)\n        self._params = HomogeneousList(Param)\n        self._groups = HomogeneousList(Group)\n        self._links = HomogeneousList(Link)\n        self._infos = HomogeneousList(Info)\n\n        self.array = ma.array([])\n\n        warn_unknown_attrs('TABLE', extra.keys(), config, pos)"},{"col":4,"comment":"\n        For internal use. Parse the XML content of the children of the\n        element.\n\n        Parameters\n        ----------\n        iterator : xml iterable\n            An iterator over XML elements as returned by\n            `~astropy.utils.xml.iterparser.get_xml_iterator`.\n\n        config : dict\n            The configuration dictionary that affects how certain\n            elements are read.\n\n        Returns\n        -------\n        self : `~astropy.io.votable.tree.Element`\n            Returns self as a convenience.\n        ","endLoc":449,"header":"def parse(self, iterator, config)","id":6168,"name":"parse","nodeType":"Function","startLoc":429,"text":"def parse(self, iterator, config):\n        \"\"\"\n        For internal use. Parse the XML content of the children of the\n        element.\n\n        Parameters\n        ----------\n        iterator : xml iterable\n            An iterator over XML elements as returned by\n            `~astropy.utils.xml.iterparser.get_xml_iterator`.\n\n        config : dict\n            The configuration dictionary that affects how certain\n            elements are read.\n\n        Returns\n        -------\n        self : `~astropy.io.votable.tree.Element`\n            Returns self as a convenience.\n        \"\"\"\n        raise NotImplementedError()"},{"col":4,"comment":"\n        For internal use. Output the element to XML.\n\n        Parameters\n        ----------\n        w : astropy.utils.xml.writer.XMLWriter object\n            An XML writer to write to.\n        **kwargs : dict\n            Any configuration parameters to control the output.\n        ","endLoc":462,"header":"def to_xml(self, w, **kwargs)","id":6169,"name":"to_xml","nodeType":"Function","startLoc":451,"text":"def to_xml(self, w, **kwargs):\n        \"\"\"\n        For internal use. Output the element to XML.\n\n        Parameters\n        ----------\n        w : astropy.utils.xml.writer.XMLWriter object\n            An XML writer to write to.\n        **kwargs : dict\n            Any configuration parameters to control the output.\n        \"\"\"\n        raise NotImplementedError()"},{"attributeType":"null","col":4,"comment":"null","endLoc":415,"id":6170,"name":"_element_name","nodeType":"Attribute","startLoc":415,"text":"_element_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":416,"id":6171,"name":"_attr_list","nodeType":"Attribute","startLoc":416,"text":"_attr_list"},{"className":"SimpleElement","col":0,"comment":"\n    A base class for simple elements, such as FIELD, PARAM and INFO\n    that don't require any special parsing or outputting machinery.\n    ","endLoc":490,"id":6172,"nodeType":"Class","startLoc":465,"text":"class SimpleElement(Element):\n    \"\"\"\n    A base class for simple elements, such as FIELD, PARAM and INFO\n    that don't require any special parsing or outputting machinery.\n    \"\"\"\n\n    def __init__(self):\n        Element.__init__(self)\n\n    def __repr__(self):\n        buff = io.StringIO()\n        SimpleElement.to_xml(self, XMLWriter(buff))\n        return buff.getvalue().strip()\n\n    def parse(self, iterator, config):\n        for start, tag, data, pos in iterator:\n            if start and tag != self._element_name:\n                self._add_unknown_tag(iterator, tag, data, config, pos)\n            elif tag == self._element_name:\n                break\n\n        return self\n\n    def to_xml(self, w, **kwargs):\n        w.element(self._element_name,\n                  attrib=w.object_attrs(self, self._attr_list))"},{"col":4,"comment":"null","endLoc":472,"header":"def __init__(self)","id":6173,"name":"__init__","nodeType":"Function","startLoc":471,"text":"def __init__(self):\n        Element.__init__(self)"},{"col":4,"comment":"null","endLoc":393,"header":"def _binoutput_fixed(self, value, mask)","id":6174,"name":"_binoutput_fixed","nodeType":"Function","startLoc":385,"text":"def _binoutput_fixed(self, value, mask):\n        if mask:\n            value = _empty_bytes\n        elif isinstance(value, str):\n            try:\n                value = value.encode('ascii')\n            except ValueError:\n                vo_raise(E24, (value, self.field_name))\n        return struct_pack(self._struct_format, value)"},{"col":4,"comment":"null","endLoc":477,"header":"def __repr__(self)","id":6175,"name":"__repr__","nodeType":"Function","startLoc":474,"text":"def __repr__(self):\n        buff = io.StringIO()\n        SimpleElement.to_xml(self, XMLWriter(buff))\n        return buff.getvalue().strip()"},{"attributeType":"null","col":4,"comment":"null","endLoc":296,"id":6176,"name":"default","nodeType":"Attribute","startLoc":296,"text":"default"},{"attributeType":"function","col":12,"comment":"null","endLoc":323,"id":6177,"name":"binparse","nodeType":"Attribute","startLoc":323,"text":"self.binparse"},{"col":0,"comment":"\n    Reads the header of a file to determine if it is a VOTable file.\n\n    Parameters\n    ----------\n    source : path-like or file-like\n        Path or file object containing a VOTABLE_ xml file.\n        If file, must be readable.\n\n    Returns\n    -------\n    is_votable : bool\n        Returns `True` if the given file is a VOTable file.\n    ","endLoc":389,"header":"def is_votable(source)","id":6178,"name":"is_votable","nodeType":"Function","startLoc":360,"text":"def is_votable(source):\n    \"\"\"\n    Reads the header of a file to determine if it is a VOTable file.\n\n    Parameters\n    ----------\n    source : path-like or file-like\n        Path or file object containing a VOTABLE_ xml file.\n        If file, must be readable.\n\n    Returns\n    -------\n    is_votable : bool\n        Returns `True` if the given file is a VOTable file.\n    \"\"\"\n    try:\n        with iterparser.get_xml_iterator(source) as iterator:\n            for start, tag, d, pos in iterator:\n                if tag != 'xml':\n                    return False\n                break\n\n            for start, tag, d, pos in iterator:\n                if tag != 'VOTABLE':\n                    return False\n                break\n\n            return True\n    except ValueError:\n        return False"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.io.votable`.\n    ","endLoc":33,"id":6179,"nodeType":"Class","startLoc":22,"text":"class Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.io.votable`.\n    \"\"\"\n\n    verify = _config.ConfigItem(\n        'ignore',\n        \"Can be 'exception' (treat fixable violations of the VOTable spec as \"\n        \"exceptions), 'warn' (show warnings for VOTable spec violations), or \"\n        \"'ignore' (silently ignore VOTable spec violations)\",\n        aliases=['astropy.io.votable.table.pedantic',\n                 'astropy.io.votable.pedantic'])"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":27,"id":6180,"name":"verify","nodeType":"Attribute","startLoc":27,"text":"verify"},{"col":4,"comment":"null","endLoc":490,"header":"def to_xml(self, w, **kwargs)","id":6181,"name":"to_xml","nodeType":"Function","startLoc":488,"text":"def to_xml(self, w, **kwargs):\n        w.element(self._element_name,\n                  attrib=w.object_attrs(self, self._attr_list))"},{"attributeType":"null","col":12,"comment":"null","endLoc":325,"id":6182,"name":"_struct_format","nodeType":"Attribute","startLoc":325,"text":"self._struct_format"},{"attributeType":"function","col":12,"comment":"null","endLoc":324,"id":6183,"name":"binoutput","nodeType":"Attribute","startLoc":324,"text":"self.binoutput"},{"col":4,"comment":"null","endLoc":486,"header":"def parse(self, iterator, config)","id":6184,"name":"parse","nodeType":"Function","startLoc":479,"text":"def parse(self, iterator, config):\n        for start, tag, data, pos in iterator:\n            if start and tag != self._element_name:\n                self._add_unknown_tag(iterator, tag, data, config, pos)\n            elif tag == self._element_name:\n                break\n\n        return self"},{"attributeType":"null","col":16,"comment":"null","endLoc":319,"id":6185,"name":"arraysize","nodeType":"Attribute","startLoc":319,"text":"self.arraysize"},{"attributeType":"null","col":12,"comment":"null","endLoc":322,"id":6186,"name":"format","nodeType":"Attribute","startLoc":322,"text":"self.format"},{"attributeType":"null","col":8,"comment":"null","endLoc":304,"id":6187,"name":"field_name","nodeType":"Attribute","startLoc":304,"text":"self.field_name"},{"className":"UnicodeChar","col":0,"comment":"\n    Handles the unicodeChar data type. UTF-16-BE.\n\n    Missing values are not handled for string or unicode types.\n    ","endLoc":457,"id":6188,"nodeType":"Class","startLoc":396,"text":"class UnicodeChar(Converter):\n    \"\"\"\n    Handles the unicodeChar data type. UTF-16-BE.\n\n    Missing values are not handled for string or unicode types.\n    \"\"\"\n    default = ''\n\n    def __init__(self, field, config=None, pos=None):\n        Converter.__init__(self, field, config, pos)\n\n        if field.arraysize is None:\n            vo_warn(W47, (), config, pos)\n            field.arraysize = '1'\n\n        if field.arraysize == '*':\n            self.format = 'O'\n            self.binparse = self._binparse_var\n            self.binoutput = self._binoutput_var\n            self.arraysize = '*'\n        else:\n            try:\n                self.arraysize = int(field.arraysize)\n            except ValueError:\n                vo_raise(E01, (field.arraysize, 'unicode', field.ID), config)\n            self.format = f'U{self.arraysize:d}'\n            self.binparse = self._binparse_fixed\n            self.binoutput = self._binoutput_fixed\n            self._struct_format = f\">{self.arraysize*2:d}s\"\n\n    def parse(self, value, config=None, pos=None):\n        if self.arraysize != '*' and len(value) > self.arraysize:\n            vo_warn(W46, ('unicodeChar', self.arraysize), config, pos)\n        return value, False\n\n    def output(self, value, mask):\n        if mask:\n            return ''\n        return xml_escape_cdata(str(value))\n\n    def _binparse_var(self, read):\n        length = self._parse_length(read)\n        return read(length * 2).decode('utf_16_be'), False\n\n    def _binparse_fixed(self, read):\n        s = struct_unpack(self._struct_format, read(self.arraysize * 2))[0]\n        s = s.decode('utf_16_be')\n        end = s.find('\\0')\n        if end != -1:\n            return s[:end], False\n        return s, False\n\n    def _binoutput_var(self, value, mask):\n        if mask or value is None or value == '':\n            return _zero_int\n        encoded = value.encode('utf_16_be')\n        return self._write_length(len(encoded) / 2) + encoded\n\n    def _binoutput_fixed(self, value, mask):\n        if mask:\n            value = ''\n        return struct_pack(self._struct_format, value.encode('utf_16_be'))"},{"col":4,"comment":"null","endLoc":424,"header":"def __init__(self, field, config=None, pos=None)","id":6189,"name":"__init__","nodeType":"Function","startLoc":404,"text":"def __init__(self, field, config=None, pos=None):\n        Converter.__init__(self, field, config, pos)\n\n        if field.arraysize is None:\n            vo_warn(W47, (), config, pos)\n            field.arraysize = '1'\n\n        if field.arraysize == '*':\n            self.format = 'O'\n            self.binparse = self._binparse_var\n            self.binoutput = self._binoutput_var\n            self.arraysize = '*'\n        else:\n            try:\n                self.arraysize = int(field.arraysize)\n            except ValueError:\n                vo_raise(E01, (field.arraysize, 'unicode', field.ID), config)\n            self.format = f'U{self.arraysize:d}'\n            self.binparse = self._binparse_fixed\n            self.binoutput = self._binoutput_fixed\n            self._struct_format = f\">{self.arraysize*2:d}s\""},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":6190,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":36,"id":6191,"name":"conf","nodeType":"Attribute","startLoc":36,"text":"conf"},{"col":4,"comment":"null","endLoc":429,"header":"def parse(self, value, config=None, pos=None)","id":6192,"name":"parse","nodeType":"Function","startLoc":426,"text":"def parse(self, value, config=None, pos=None):\n        if self.arraysize != '*' and len(value) > self.arraysize:\n            vo_warn(W46, ('unicodeChar', self.arraysize), config, pos)\n        return value, False"},{"col":0,"comment":"","endLoc":5,"header":"__init__.py#<anonymous>","id":6193,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis package reads and writes data formats used by the Virtual\nObservatory (VO) initiative, particularly the VOTable XML format.\n\"\"\"\n\n__all__ = [\n    'Conf', 'conf', 'parse', 'parse_single_table', 'validate',\n    'from_table', 'is_votable', 'writeto', 'VOWarning',\n    'VOTableChangeWarning', 'VOTableSpecWarning',\n    'UnimplementedWarning', 'IOWarning', 'VOTableSpecError']\n\nconf = Conf()"},{"className":"SimpleElementWithContent","col":0,"comment":"\n    A base class for simple elements, such as FIELD, PARAM and INFO\n    that don't require any special parsing or outputting machinery.\n    ","endLoc":531,"id":6194,"nodeType":"Class","startLoc":493,"text":"class SimpleElementWithContent(SimpleElement):\n    \"\"\"\n    A base class for simple elements, such as FIELD, PARAM and INFO\n    that don't require any special parsing or outputting machinery.\n    \"\"\"\n\n    def __init__(self):\n        SimpleElement.__init__(self)\n\n        self._content = None\n\n    def parse(self, iterator, config):\n        for start, tag, data, pos in iterator:\n            if start and tag != self._element_name:\n                self._add_unknown_tag(iterator, tag, data, config, pos)\n            elif tag == self._element_name:\n                if data:\n                    self.content = data\n                break\n\n        return self\n\n    def to_xml(self, w, **kwargs):\n        w.element(self._element_name, self._content,\n                  attrib=w.object_attrs(self, self._attr_list))\n\n    @property\n    def content(self):\n        \"\"\"The content of the element.\"\"\"\n        return self._content\n\n    @content.setter\n    def content(self, content):\n        check_string(content, 'content', self._config, self._pos)\n        self._content = content\n\n    @content.deleter\n    def content(self):\n        self._content = None"},{"col":4,"comment":"null","endLoc":502,"header":"def __init__(self)","id":6195,"name":"__init__","nodeType":"Function","startLoc":499,"text":"def __init__(self):\n        SimpleElement.__init__(self)\n\n        self._content = None"},{"col":0,"comment":"null","endLoc":46,"header":"def test_parse_vowarning()","id":6196,"name":"test_parse_vowarning","nodeType":"Function","startLoc":23,"text":"def test_parse_vowarning():\n    config = {'verify': 'exception',\n              'filename': 'foo.xml'}\n    pos = (42, 64)\n    with pytest.warns(exceptions.W47) as w:\n        field = tree.Field(\n            None, name='c', datatype='char',\n            config=config, pos=pos)\n        converters.get_converter(field, config=config, pos=pos)\n\n    parts = exceptions.parse_vowarning(str(w[0].message))\n\n    match = {\n        'number': 47,\n        'is_exception': False,\n        'nchar': 64,\n        'warning': 'W47',\n        'is_something': True,\n        'message': 'Missing arraysize indicates length 1',\n        'doc_url': 'io/votable/api_exceptions.html#w47',\n        'nline': 42,\n        'is_warning': True\n        }\n    assert parts == match"},{"col":4,"comment":"null","endLoc":513,"header":"def parse(self, iterator, config)","id":6197,"name":"parse","nodeType":"Function","startLoc":504,"text":"def parse(self, iterator, config):\n        for start, tag, data, pos in iterator:\n            if start and tag != self._element_name:\n                self._add_unknown_tag(iterator, tag, data, config, pos)\n            elif tag == self._element_name:\n                if data:\n                    self.content = data\n                break\n\n        return self"},{"col":4,"comment":"\n        Restores a `Field` instance from a given\n        `astropy.table.Column` instance.\n        ","endLoc":1577,"header":"@classmethod\n    def from_table_column(cls, votable, column)","id":6198,"name":"from_table_column","nodeType":"Function","startLoc":1547,"text":"@classmethod\n    def from_table_column(cls, votable, column):\n        \"\"\"\n        Restores a `Field` instance from a given\n        `astropy.table.Column` instance.\n        \"\"\"\n        kwargs = {}\n        meta = column.info.meta\n        if meta:\n            for key in ['ucd', 'width', 'precision', 'utype', 'xtype']:\n                val = meta.get(key, None)\n                if val is not None:\n                    kwargs[key] = val\n        # TODO: Use the unit framework when available\n        if column.info.unit is not None:\n            kwargs['unit'] = column.info.unit\n        kwargs['name'] = column.info.name\n        result = converters.table_column_to_votable_datatype(column)\n        kwargs.update(result)\n\n        field = cls(votable, **kwargs)\n\n        if column.info.description is not None:\n            field.description = column.info.description\n        field.values.from_table_column(column)\n        if meta and 'links' in meta:\n            for link in meta['links']:\n                field.links.append(Link.from_table_column(link))\n\n        # TODO: Parse format into precision and width\n        return field"},{"col":0,"comment":"\n    Given a `astropy.table.Column` instance, returns the attributes\n    necessary to create a VOTable FIELD element that corresponds to\n    the type of the column.\n\n    This necessarily must perform some heuristics to determine the\n    type of variable length arrays fields, since they are not directly\n    supported by Numpy.\n\n    If the column has dtype of \"object\", it performs the following\n    tests:\n\n       - If all elements are byte or unicode strings, it creates a\n         variable-length byte or unicode field, respectively.\n\n       - If all elements are numpy arrays of the same dtype and with a\n         consistent shape in all but the first dimension, it creates a\n         variable length array of fixed sized arrays.  If the dtypes\n         match, but the shapes do not, a variable length array is\n         created.\n\n    If the dtype of the input is not understood, it sets the data type\n    to the most inclusive: a variable length unicodeChar array.\n\n    Parameters\n    ----------\n    column : `astropy.table.Column` instance\n\n    Returns\n    -------\n    attributes : dict\n        A dict containing 'datatype' and 'arraysize' keys that can be\n        set on a VOTable FIELD element.\n    ","endLoc":1458,"header":"def table_column_to_votable_datatype(column)","id":6199,"name":"table_column_to_votable_datatype","nodeType":"Function","startLoc":1398,"text":"def table_column_to_votable_datatype(column):\n    \"\"\"\n    Given a `astropy.table.Column` instance, returns the attributes\n    necessary to create a VOTable FIELD element that corresponds to\n    the type of the column.\n\n    This necessarily must perform some heuristics to determine the\n    type of variable length arrays fields, since they are not directly\n    supported by Numpy.\n\n    If the column has dtype of \"object\", it performs the following\n    tests:\n\n       - If all elements are byte or unicode strings, it creates a\n         variable-length byte or unicode field, respectively.\n\n       - If all elements are numpy arrays of the same dtype and with a\n         consistent shape in all but the first dimension, it creates a\n         variable length array of fixed sized arrays.  If the dtypes\n         match, but the shapes do not, a variable length array is\n         created.\n\n    If the dtype of the input is not understood, it sets the data type\n    to the most inclusive: a variable length unicodeChar array.\n\n    Parameters\n    ----------\n    column : `astropy.table.Column` instance\n\n    Returns\n    -------\n    attributes : dict\n        A dict containing 'datatype' and 'arraysize' keys that can be\n        set on a VOTable FIELD element.\n    \"\"\"\n    votable_string_dtype = None\n    if column.info.meta is not None:\n        votable_string_dtype = column.info.meta.get('_votable_string_dtype')\n    if column.dtype.char == 'O':\n        if votable_string_dtype is not None:\n            return {'datatype': votable_string_dtype, 'arraysize': '*'}\n        elif isinstance(column[0], np.ndarray):\n            dtype, shape = _all_matching_dtype(column)\n            if dtype is not False:\n                result = numpy_to_votable_dtype(dtype, shape)\n                if 'arraysize' not in result:\n                    result['arraysize'] = '*'\n                else:\n                    result['arraysize'] += '*'\n                return result\n\n        # All bets are off, do the most generic thing\n        return {'datatype': 'unicodeChar', 'arraysize': '*'}\n\n    # For fixed size string columns, datatype here will be unicodeChar,\n    # but honor the original FIELD datatype if present.\n    result = numpy_to_votable_dtype(column.dtype, column.shape[1:])\n    if result['datatype'] == 'unicodeChar' and votable_string_dtype == 'char':\n        result['datatype'] = 'char'\n\n    return result"},{"col":4,"comment":"null","endLoc":517,"header":"def to_xml(self, w, **kwargs)","id":6200,"name":"to_xml","nodeType":"Function","startLoc":515,"text":"def to_xml(self, w, **kwargs):\n        w.element(self._element_name, self._content,\n                  attrib=w.object_attrs(self, self._attr_list))"},{"col":4,"comment":"null","endLoc":434,"header":"def output(self, value, mask)","id":6201,"name":"output","nodeType":"Function","startLoc":431,"text":"def output(self, value, mask):\n        if mask:\n            return ''\n        return xml_escape_cdata(str(value))"},{"col":4,"comment":"The content of the element.","endLoc":522,"header":"@property\n    def content(self)","id":6202,"name":"content","nodeType":"Function","startLoc":519,"text":"@property\n    def content(self):\n        \"\"\"The content of the element.\"\"\"\n        return self._content"},{"col":4,"comment":"null","endLoc":527,"header":"@content.setter\n    def content(self, content)","id":6203,"name":"content","nodeType":"Function","startLoc":524,"text":"@content.setter\n    def content(self, content):\n        check_string(content, 'content', self._config, self._pos)\n        self._content = content"},{"col":4,"comment":"null","endLoc":531,"header":"@content.deleter\n    def content(self)","id":6204,"name":"content","nodeType":"Function","startLoc":529,"text":"@content.deleter\n    def content(self):\n        self._content = None"},{"attributeType":"None","col":8,"comment":"null","endLoc":502,"id":6205,"name":"_content","nodeType":"Attribute","startLoc":502,"text":"self._content"},{"col":0,"comment":"null","endLoc":1359,"header":"def _all_matching_dtype(column)","id":6206,"name":"_all_matching_dtype","nodeType":"Function","startLoc":1345,"text":"def _all_matching_dtype(column):\n    first_dtype = False\n    first_shape = ()\n    for x in column:\n        if not isinstance(x, np.ndarray) or len(x) == 0:\n            continue\n\n        if first_dtype is False:\n            first_dtype = x.dtype\n            first_shape = x.shape[1:]\n        elif first_dtype != x.dtype:\n            return False, ()\n        elif first_shape != x.shape[1:]:\n            first_shape = ()\n    return first_dtype, first_shape"},{"attributeType":"null","col":20,"comment":"null","endLoc":510,"id":6207,"name":"content","nodeType":"Attribute","startLoc":510,"text":"self.content"},{"col":0,"comment":"\n    Converts a numpy dtype and shape to a dictionary of attributes for\n    a VOTable FIELD element and correspond to that type.\n\n    Parameters\n    ----------\n    dtype : Numpy dtype instance\n\n    shape : tuple\n\n    Returns\n    -------\n    attributes : dict\n        A dict containing 'datatype' and 'arraysize' keys that can be\n        set on a VOTable FIELD element.\n    ","endLoc":1395,"header":"def numpy_to_votable_dtype(dtype, shape)","id":6208,"name":"numpy_to_votable_dtype","nodeType":"Function","startLoc":1362,"text":"def numpy_to_votable_dtype(dtype, shape):\n    \"\"\"\n    Converts a numpy dtype and shape to a dictionary of attributes for\n    a VOTable FIELD element and correspond to that type.\n\n    Parameters\n    ----------\n    dtype : Numpy dtype instance\n\n    shape : tuple\n\n    Returns\n    -------\n    attributes : dict\n        A dict containing 'datatype' and 'arraysize' keys that can be\n        set on a VOTable FIELD element.\n    \"\"\"\n    if dtype.num not in numpy_dtype_to_field_mapping:\n        raise TypeError(\n            f\"{dtype!r} can not be represented in VOTable\")\n\n    if dtype.char == 'S':\n        return {'datatype': 'char',\n                'arraysize': str(dtype.itemsize)}\n    elif dtype.char == 'U':\n        return {'datatype': 'unicodeChar',\n                'arraysize': str(dtype.itemsize // 4)}\n    else:\n        result = {\n            'datatype': numpy_dtype_to_field_mapping[dtype.num]}\n        if len(shape):\n            result['arraysize'] = 'x'.join(str(x) for x in shape)\n\n        return result"},{"className":"Link","col":0,"comment":"\n    LINK_ elements: used to reference external documents and servers through a URI.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    ","endLoc":638,"id":6209,"nodeType":"Class","startLoc":534,"text":"class Link(SimpleElement, _IDProperty):\n    \"\"\"\n    LINK_ elements: used to reference external documents and servers through a URI.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    \"\"\"\n    _attr_list = ['ID', 'content_role', 'content_type', 'title', 'value',\n                  'href', 'action']\n    _element_name = 'LINK'\n\n    def __init__(self, ID=None, title=None, value=None, href=None, action=None,\n                 id=None, config=None, pos=None, **kwargs):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        SimpleElement.__init__(self)\n\n        content_role = kwargs.get('content-role') or kwargs.get('content_role')\n        content_type = kwargs.get('content-type') or kwargs.get('content_type')\n\n        if 'gref' in kwargs:\n            warn_or_raise(W11, W11, (), config, pos)\n\n        self.ID = resolve_id(ID, id, config, pos)\n        self.content_role = content_role\n        self.content_type = content_type\n        self.title = title\n        self.value = value\n        self.href = href\n        self.action = action\n\n        warn_unknown_attrs(\n            'LINK', kwargs.keys(), config, pos,\n            ['content-role', 'content_role', 'content-type', 'content_type',\n             'gref'])\n\n    @property\n    def content_role(self):\n        \"\"\"\n        Defines the MIME role of the referenced object.  Must be one of:\n\n          None, 'query', 'hints', 'doc', 'location' or 'type'\n        \"\"\"\n        return self._content_role\n\n    @content_role.setter\n    def content_role(self, content_role):\n        if ((content_role == 'type' and\n             not self._config['version_1_3_or_later']) or\n             content_role not in\n             (None, 'query', 'hints', 'doc', 'location')):\n            vo_warn(W45, (content_role,), self._config, self._pos)\n        self._content_role = content_role\n\n    @content_role.deleter\n    def content_role(self):\n        self._content_role = None\n\n    @property\n    def content_type(self):\n        \"\"\"Defines the MIME content type of the referenced object.\"\"\"\n        return self._content_type\n\n    @content_type.setter\n    def content_type(self, content_type):\n        xmlutil.check_mime_content_type(content_type, self._config, self._pos)\n        self._content_type = content_type\n\n    @content_type.deleter\n    def content_type(self):\n        self._content_type = None\n\n    @property\n    def href(self):\n        \"\"\"\n        A URI to an arbitrary protocol.  The vo package only supports\n        http and anonymous ftp.\n        \"\"\"\n        return self._href\n\n    @href.setter\n    def href(self, href):\n        xmlutil.check_anyuri(href, self._config, self._pos)\n        self._href = href\n\n    @href.deleter\n    def href(self):\n        self._href = None\n\n    def to_table_column(self, column):\n        meta = {}\n        for key in self._attr_list:\n            val = getattr(self, key, None)\n            if val is not None:\n                meta[key] = val\n\n        column.meta.setdefault('links', [])\n        column.meta['links'].append(meta)\n\n    @classmethod\n    def from_table_column(cls, d):\n        return cls(**d)"},{"col":4,"comment":"null","endLoc":438,"header":"def _binparse_var(self, read)","id":6210,"name":"_binparse_var","nodeType":"Function","startLoc":436,"text":"def _binparse_var(self, read):\n        length = self._parse_length(read)\n        return read(length * 2).decode('utf_16_be'), False"},{"col":4,"comment":"null","endLoc":571,"header":"def __init__(self, ID=None, title=None, value=None, href=None, action=None,\n                 id=None, config=None, pos=None, **kwargs)","id":6211,"name":"__init__","nodeType":"Function","startLoc":545,"text":"def __init__(self, ID=None, title=None, value=None, href=None, action=None,\n                 id=None, config=None, pos=None, **kwargs):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        SimpleElement.__init__(self)\n\n        content_role = kwargs.get('content-role') or kwargs.get('content_role')\n        content_type = kwargs.get('content-type') or kwargs.get('content_type')\n\n        if 'gref' in kwargs:\n            warn_or_raise(W11, W11, (), config, pos)\n\n        self.ID = resolve_id(ID, id, config, pos)\n        self.content_role = content_role\n        self.content_type = content_type\n        self.title = title\n        self.value = value\n        self.href = href\n        self.action = action\n\n        warn_unknown_attrs(\n            'LINK', kwargs.keys(), config, pos,\n            ['content-role', 'content_role', 'content-type', 'content_type',\n             'gref'])"},{"fileName":"vo_test.py","filePath":"astropy/io/votable/tests","id":6212,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis is a set of regression tests for vo.\n\"\"\"\n\n# STDLIB\nimport difflib\nimport io\nimport pathlib\nimport sys\nimport gzip\nfrom unittest import mock\n\n# THIRD-PARTY\nimport pytest\nimport numpy as np\nfrom numpy.testing import assert_array_equal\n\n# LOCAL\nfrom astropy.io.votable.table import parse, parse_single_table, validate\nfrom astropy.io.votable import tree\nfrom astropy.io.votable.exceptions import VOTableSpecError, VOWarning, W39\nfrom astropy.io.votable.xmlutil import validate_schema\nfrom astropy.utils.data import get_pkg_data_filename, get_pkg_data_filenames\n\n# Determine the kind of float formatting in this build of Python\nif hasattr(sys, 'float_repr_style'):\n    legacy_float_repr = (sys.float_repr_style == 'legacy')\nelse:\n    legacy_float_repr = sys.platform.startswith('win')\n\n\ndef assert_validate_schema(filename, version):\n    if sys.platform.startswith('win'):\n        return\n\n    try:\n        rc, stdout, stderr = validate_schema(filename, version)\n    except OSError:\n        # If xmllint is not installed, we want the test to pass anyway\n        return\n    assert rc == 0, 'File did not validate against VOTable schema'\n\n\ndef test_parse_single_table():\n    table = parse_single_table(get_pkg_data_filename('data/regression.xml'))\n    assert isinstance(table, tree.Table)\n    assert len(table.array) == 5\n\n\ndef test_parse_single_table2():\n    table2 = parse_single_table(get_pkg_data_filename('data/regression.xml'),\n                                table_number=1)\n    assert isinstance(table2, tree.Table)\n    assert len(table2.array) == 1\n    assert len(table2.array.dtype.names) == 28\n\n\ndef test_parse_single_table3():\n    with pytest.raises(IndexError):\n        parse_single_table(get_pkg_data_filename('data/regression.xml'),\n                           table_number=3)\n\n\ndef _test_regression(tmpdir, _python_based=False, binary_mode=1):\n    # Read the VOTABLE\n    votable = parse(get_pkg_data_filename('data/regression.xml'),\n                    _debug_python_based_parser=_python_based)\n    table = votable.get_first_table()\n\n    dtypes = [\n        (('string test', 'string_test'), '|O8'),\n        (('fixed string test', 'string_test_2'), '<U10'),\n        ('unicode_test', '|O8'),\n        (('unicode test', 'fixed_unicode_test'), '<U10'),\n        (('string array test', 'string_array_test'), '<U4'),\n        ('unsignedByte', '|u1'),\n        ('short', '<i2'),\n        ('int', '<i4'),\n        ('long', '<i8'),\n        ('double', '<f8'),\n        ('float', '<f4'),\n        ('array', '|O8'),\n        ('bit', '|b1'),\n        ('bitarray', '|b1', (3, 2)),\n        ('bitvararray', '|O8'),\n        ('bitvararray2', '|O8'),\n        ('floatComplex', '<c8'),\n        ('doubleComplex', '<c16'),\n        ('doubleComplexArray', '|O8'),\n        ('doubleComplexArrayFixed', '<c16', (2,)),\n        ('boolean', '|b1'),\n        ('booleanArray', '|b1', (4,)),\n        ('nulls', '<i4'),\n        ('nulls_array', '<i4', (2, 2)),\n        ('precision1', '<f8'),\n        ('precision2', '<f8'),\n        ('doublearray', '|O8'),\n        ('bitarray2', '|b1', (16,))\n        ]\n    if sys.byteorder == 'big':\n        new_dtypes = []\n        for dtype in dtypes:\n            dtype = list(dtype)\n            dtype[1] = dtype[1].replace('<', '>')\n            new_dtypes.append(tuple(dtype))\n        dtypes = new_dtypes\n    assert table.array.dtype == dtypes\n\n    votable.to_xml(str(tmpdir.join(\"regression.tabledata.xml\")),\n                   _debug_python_based_parser=_python_based)\n    assert_validate_schema(str(tmpdir.join(\"regression.tabledata.xml\")),\n                           votable.version)\n\n    if binary_mode == 1:\n        votable.get_first_table().format = 'binary'\n        votable.version = '1.1'\n    elif binary_mode == 2:\n        votable.get_first_table()._config['version_1_3_or_later'] = True\n        votable.get_first_table().format = 'binary2'\n        votable.version = '1.3'\n\n    # Also try passing a file handle\n    with open(str(tmpdir.join(\"regression.binary.xml\")), \"wb\") as fd:\n        votable.to_xml(fd, _debug_python_based_parser=_python_based)\n    assert_validate_schema(str(tmpdir.join(\"regression.binary.xml\")),\n                           votable.version)\n    # Also try passing a file handle\n    with open(str(tmpdir.join(\"regression.binary.xml\")), \"rb\") as fd:\n        votable2 = parse(fd, _debug_python_based_parser=_python_based)\n    votable2.get_first_table().format = 'tabledata'\n    votable2.to_xml(str(tmpdir.join(\"regression.bin.tabledata.xml\")),\n                    _astropy_version=\"testing\",\n                    _debug_python_based_parser=_python_based)\n    assert_validate_schema(str(tmpdir.join(\"regression.bin.tabledata.xml\")),\n                           votable.version)\n\n    with open(\n        get_pkg_data_filename(\n            f'data/regression.bin.tabledata.truth.{votable.version}.xml'),\n            'rt', encoding='utf-8') as fd:\n        truth = fd.readlines()\n    with open(str(tmpdir.join(\"regression.bin.tabledata.xml\")),\n              'rt', encoding='utf-8') as fd:\n        output = fd.readlines()\n\n    # If the lines happen to be different, print a diff\n    # This is convenient for debugging\n    sys.stdout.writelines(\n        difflib.unified_diff(truth, output, fromfile='truth', tofile='output'))\n\n    assert truth == output\n\n    # Test implicit gzip saving\n    votable2.to_xml(\n        str(tmpdir.join(\"regression.bin.tabledata.xml.gz\")),\n        _astropy_version=\"testing\",\n        _debug_python_based_parser=_python_based)\n    with gzip.GzipFile(\n            str(tmpdir.join(\"regression.bin.tabledata.xml.gz\")), 'rb') as gzfd:\n        output = gzfd.readlines()\n    output = [x.decode('utf-8').rstrip() for x in output]\n    truth = [x.rstrip() for x in truth]\n\n    assert truth == output\n\n\n@pytest.mark.xfail('legacy_float_repr')\ndef test_regression(tmpdir):\n    # W39: Bit values can not be masked\n    with pytest.warns(W39):\n        _test_regression(tmpdir, False)\n\n\n@pytest.mark.xfail('legacy_float_repr')\ndef test_regression_python_based_parser(tmpdir):\n    # W39: Bit values can not be masked\n    with pytest.warns(W39):\n        _test_regression(tmpdir, True)\n\n\n@pytest.mark.xfail('legacy_float_repr')\ndef test_regression_binary2(tmpdir):\n    # W39: Bit values can not be masked\n    with pytest.warns(W39):\n        _test_regression(tmpdir, False, 2)\n\n\nclass TestFixups:\n    def setup_class(self):\n        self.table = parse(\n            get_pkg_data_filename('data/regression.xml')).get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask\n\n    def test_implicit_id(self):\n        assert_array_equal(self.array['string_test_2'],\n                           self.array['fixed string test'])\n\n\nclass TestReferences:\n    def setup_class(self):\n        self.votable = parse(get_pkg_data_filename('data/regression.xml'))\n        self.table = self.votable.get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask\n\n    def test_fieldref(self):\n        fieldref = self.table.groups[1].entries[0]\n        assert isinstance(fieldref, tree.FieldRef)\n        assert fieldref.get_ref().name == 'boolean'\n        assert fieldref.get_ref().datatype == 'boolean'\n\n    def test_paramref(self):\n        paramref = self.table.groups[0].entries[0]\n        assert isinstance(paramref, tree.ParamRef)\n        assert paramref.get_ref().name == 'INPUT'\n        assert paramref.get_ref().datatype == 'float'\n\n    def test_iter_fields_and_params_on_a_group(self):\n        assert len(list(self.table.groups[1].iter_fields_and_params())) == 2\n\n    def test_iter_groups_on_a_group(self):\n        assert len(list(self.table.groups[1].iter_groups())) == 1\n\n    def test_iter_groups(self):\n        # Because of the ref'd table, there are more logical groups\n        # than actually exist in the file\n        assert len(list(self.votable.iter_groups())) == 9\n\n    def test_ref_table(self):\n        tables = list(self.votable.iter_tables())\n        for x, y in zip(tables[0].array.data[0], tables[1].array.data[0]):\n            assert_array_equal(x, y)\n\n    def test_iter_coosys(self):\n        assert len(list(self.votable.iter_coosys())) == 1\n\n\ndef test_select_columns_by_index():\n    columns = [0, 5, 13]\n    table = parse(\n        get_pkg_data_filename('data/regression.xml'), columns=columns).get_first_table()  # noqa\n    array = table.array\n    mask = table.array.mask\n    assert array['string_test'][0] == \"String & test\"\n    columns = ['string_test', 'unsignedByte', 'bitarray']\n    for c in columns:\n        assert not np.all(mask[c])\n    assert np.all(mask['unicode_test'])\n\n\ndef test_select_columns_by_name():\n    columns = ['string_test', 'unsignedByte', 'bitarray']\n    table = parse(\n        get_pkg_data_filename('data/regression.xml'), columns=columns).get_first_table()  # noqa\n    array = table.array\n    mask = table.array.mask\n    assert array['string_test'][0] == \"String & test\"\n    for c in columns:\n        assert not np.all(mask[c])\n    assert np.all(mask['unicode_test'])\n\n\nclass TestParse:\n    def setup_class(self):\n        self.votable = parse(get_pkg_data_filename('data/regression.xml'))\n        self.table = self.votable.get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask\n\n    def test_string_test(self):\n        assert issubclass(self.array['string_test'].dtype.type,\n                          np.object_)\n        assert_array_equal(\n            self.array['string_test'],\n            ['String & test', 'String &amp; test', 'XXXX', '', ''])\n\n    def test_fixed_string_test(self):\n        assert issubclass(self.array['string_test_2'].dtype.type,\n                          np.unicode_)\n        assert_array_equal(\n            self.array['string_test_2'],\n            ['Fixed stri', '0123456789', 'XXXX', '', ''])\n\n    def test_unicode_test(self):\n        assert issubclass(self.array['unicode_test'].dtype.type,\n                          np.object_)\n        assert_array_equal(self.array['unicode_test'],\n                           [\"Ceçi n'est pas un pipe\",\n                            'வணக்கம்',\n                            'XXXX', '', ''])\n\n    def test_fixed_unicode_test(self):\n        assert issubclass(self.array['fixed_unicode_test'].dtype.type,\n                          np.unicode_)\n        assert_array_equal(self.array['fixed_unicode_test'],\n                           [\"Ceçi n'est\",\n                            'வணக்கம்',\n                            '0123456789', '', ''])\n\n    def test_unsignedByte(self):\n        assert issubclass(self.array['unsignedByte'].dtype.type,\n                          np.uint8)\n        assert_array_equal(self.array['unsignedByte'],\n                           [128, 255, 0, 255, 255])\n        assert not np.any(self.mask['unsignedByte'])\n\n    def test_short(self):\n        assert issubclass(self.array['short'].dtype.type,\n                          np.int16)\n        assert_array_equal(self.array['short'],\n                           [4096, 32767, -4096, 32767, 32767])\n        assert not np.any(self.mask['short'])\n\n    def test_int(self):\n        assert issubclass(self.array['int'].dtype.type,\n                          np.int32)\n        assert_array_equal(\n            self.array['int'],\n            [268435456, 2147483647, -268435456, 268435455, 123456789])\n        assert_array_equal(self.mask['int'],\n                           [False, False, False, False, True])\n\n    def test_long(self):\n        assert issubclass(self.array['long'].dtype.type,\n                          np.int64)\n        assert_array_equal(\n            self.array['long'],\n            [922337203685477, 123456789, -1152921504606846976,\n             1152921504606846975, 123456789])\n        assert_array_equal(self.mask['long'],\n                           [False, True, False, False, True])\n\n    def test_double(self):\n        assert issubclass(self.array['double'].dtype.type,\n                          np.float64)\n        assert_array_equal(self.array['double'],\n                           [8.9990234375, 0.0, np.inf, np.nan, -np.inf])\n        assert_array_equal(self.mask['double'],\n                           [False, False, False, True, False])\n\n    def test_float(self):\n        assert issubclass(self.array['float'].dtype.type,\n                          np.float32)\n        assert_array_equal(self.array['float'],\n                           [1.0, 0.0, np.inf, np.inf, np.nan])\n        assert_array_equal(self.mask['float'],\n                           [False, False, False, False, True])\n\n    def test_array(self):\n        assert issubclass(self.array['array'].dtype.type,\n                          np.object_)\n        match = [[],\n                 [[42, 32], [12, 32]],\n                 [[12, 34], [56, 78], [87, 65], [43, 21]],\n                 [[-1, 23]],\n                 [[31, -1]]]\n        for a, b in zip(self.array['array'], match):\n            # assert issubclass(a.dtype.type, np.int64)\n            # assert a.shape[1] == 2\n            for a0, b0 in zip(a, b):\n                assert issubclass(a0.dtype.type, np.int64)\n                assert_array_equal(a0, b0)\n        assert self.array.data['array'][3].mask[0][0]\n        assert self.array.data['array'][4].mask[0][1]\n\n    def test_bit(self):\n        assert issubclass(self.array['bit'].dtype.type,\n                          np.bool_)\n        assert_array_equal(self.array['bit'],\n                           [True, False, True, False, False])\n\n    def test_bit_mask(self):\n        assert_array_equal(self.mask['bit'],\n                           [False, False, False, False, True])\n\n    def test_bitarray(self):\n        assert issubclass(self.array['bitarray'].dtype.type,\n                          np.bool_)\n        assert self.array['bitarray'].shape == (5, 3, 2)\n        assert_array_equal(self.array['bitarray'],\n                           [[[True, False],\n                             [True, True],\n                             [False, True]],\n\n                            [[False, True],\n                             [False, False],\n                             [True, True]],\n\n                            [[True, True],\n                             [True, False],\n                             [False, False]],\n\n                            [[False, False],\n                             [False, False],\n                             [False, False]],\n\n                            [[False, False],\n                             [False, False],\n                             [False, False]]])\n\n    def test_bitarray_mask(self):\n        assert_array_equal(self.mask['bitarray'],\n                           [[[False, False],\n                             [False, False],\n                             [False, False]],\n\n                            [[False, False],\n                             [False, False],\n                             [False, False]],\n\n                            [[False, False],\n                             [False, False],\n                             [False, False]],\n\n                            [[True, True],\n                             [True, True],\n                             [True, True]],\n\n                            [[True, True],\n                             [True, True],\n                             [True, True]]])\n\n    def test_bitvararray(self):\n        assert issubclass(self.array['bitvararray'].dtype.type,\n                          np.object_)\n        match = [[True, True, True],\n                 [False, False, False, False, False],\n                 [True, False, True, False, True],\n                 [], []]\n        for a, b in zip(self.array['bitvararray'], match):\n            assert_array_equal(a, b)\n        match_mask = [[False, False, False],\n                      [False, False, False, False, False],\n                      [False, False, False, False, False],\n                      False, False]\n        for a, b in zip(self.array['bitvararray'], match_mask):\n            assert_array_equal(a.mask, b)\n\n    def test_bitvararray2(self):\n        assert issubclass(self.array['bitvararray2'].dtype.type,\n                          np.object_)\n        match = [[],\n\n                 [[[False, True],\n                   [False, False],\n                   [True, False]],\n                  [[True, False],\n                   [True, False],\n                   [True, False]]],\n\n                 [[[True, True],\n                   [True, True],\n                   [True, True]]],\n\n                 [],\n\n                 []]\n        for a, b in zip(self.array['bitvararray2'], match):\n            for a0, b0 in zip(a, b):\n                assert a0.shape == (3, 2)\n                assert issubclass(a0.dtype.type, np.bool_)\n                assert_array_equal(a0, b0)\n\n    def test_floatComplex(self):\n        assert issubclass(self.array['floatComplex'].dtype.type,\n                          np.complex64)\n        assert_array_equal(self.array['floatComplex'],\n                           [np.nan+0j, 0+0j, 0+-1j, np.nan+0j, np.nan+0j])\n        assert_array_equal(self.mask['floatComplex'],\n                           [True, False, False, True, True])\n\n    def test_doubleComplex(self):\n        assert issubclass(self.array['doubleComplex'].dtype.type,\n                          np.complex128)\n        assert_array_equal(\n            self.array['doubleComplex'],\n            [np.nan+0j, 0+0j, 0+-1j, np.nan+(np.inf*1j), np.nan+0j])\n        assert_array_equal(self.mask['doubleComplex'],\n                           [True, False, False, True, True])\n\n    def test_doubleComplexArray(self):\n        assert issubclass(self.array['doubleComplexArray'].dtype.type,\n                          np.object_)\n        assert ([len(x) for x in self.array['doubleComplexArray']] ==\n                [0, 2, 2, 0, 0])\n\n    def test_boolean(self):\n        assert issubclass(self.array['boolean'].dtype.type,\n                          np.bool_)\n        assert_array_equal(self.array['boolean'],\n                           [True, False, True, False, False])\n\n    def test_boolean_mask(self):\n        assert_array_equal(self.mask['boolean'],\n                           [False, False, False, False, True])\n\n    def test_boolean_array(self):\n        assert issubclass(self.array['booleanArray'].dtype.type,\n                          np.bool_)\n        assert_array_equal(self.array['booleanArray'],\n                           [[True, True, True, True],\n                            [True, True, False, True],\n                            [True, True, False, True],\n                            [False, False, False, False],\n                            [False, False, False, False]])\n\n    def test_boolean_array_mask(self):\n        assert_array_equal(self.mask['booleanArray'],\n                           [[False, False, False, False],\n                            [False, False, False, False],\n                            [False, False, True, False],\n                            [True, True, True, True],\n                            [True, True, True, True]])\n\n    def test_nulls(self):\n        assert_array_equal(self.array['nulls'],\n                           [0, -9, 2, -9, -9])\n        assert_array_equal(self.mask['nulls'],\n                           [False, True, False, True, True])\n\n    def test_nulls_array(self):\n        assert_array_equal(self.array['nulls_array'],\n                           [[[-9, -9], [-9, -9]],\n                            [[0, 1], [2, 3]],\n                            [[-9, 0], [-9, 1]],\n                            [[0, -9], [1, -9]],\n                            [[-9, -9], [-9, -9]]])\n        assert_array_equal(self.mask['nulls_array'],\n                           [[[True, True],\n                             [True, True]],\n\n                            [[False, False],\n                             [False, False]],\n\n                            [[True, False],\n                             [True, False]],\n\n                            [[False, True],\n                             [False, True]],\n\n                            [[True, True],\n                             [True, True]]])\n\n    def test_double_array(self):\n        assert issubclass(self.array['doublearray'].dtype.type,\n                          np.object_)\n        assert len(self.array['doublearray'][0]) == 0\n        assert_array_equal(self.array['doublearray'][1],\n                           [0, 1, np.inf, -np.inf, np.nan, 0, -1])\n        assert_array_equal(self.array.data['doublearray'][1].mask,\n                           [False, False, False, False, False, False, True])\n\n    def test_bit_array2(self):\n        assert_array_equal(self.array['bitarray2'][0],\n                           [True, True, True, True,\n                            False, False, False, False,\n                            True, True, True, True,\n                            False, False, False, False])\n\n    def test_bit_array2_mask(self):\n        assert not np.any(self.mask['bitarray2'][0])\n        assert np.all(self.mask['bitarray2'][1:])\n\n    def test_get_coosys_by_id(self):\n        coosys = self.votable.get_coosys_by_id('J2000')\n        assert coosys.system == 'eq_FK5'\n\n    def test_get_field_by_utype(self):\n        fields = list(self.votable.get_fields_by_utype(\"myint\"))\n        assert fields[0].name == \"int\"\n        assert fields[0].values.min == -1000\n\n    def test_get_info_by_id(self):\n        info = self.votable.get_info_by_id('QUERY_STATUS')\n        assert info.value == 'OK'\n\n        if self.votable.version != '1.1':\n            info = self.votable.get_info_by_id(\"ErrorInfo\")\n            assert info.value == \"One might expect to find some INFO here, too...\"  # noqa\n\n    def test_repr(self):\n        assert '3 tables' in repr(self.votable)\n        assert repr(list(self.votable.iter_fields_and_params())[0]) == \\\n            '<PARAM ID=\"awesome\" arraysize=\"*\" datatype=\"float\" name=\"INPUT\" unit=\"deg\" value=\"[0.0 0.0]\"/>'  # noqa\n        # Smoke test\n        repr(list(self.votable.iter_groups()))\n\n        # Resource\n        assert repr(self.votable.resources) == '[</>]'\n\n\nclass TestThroughTableData(TestParse):\n    def setup_class(self):\n        votable = parse(get_pkg_data_filename('data/regression.xml'))\n\n        self.xmlout = bio = io.BytesIO()\n        # W39: Bit values can not be masked\n        with pytest.warns(W39):\n            votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio)\n        self.table = self.votable.get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask\n\n    def test_bit_mask(self):\n        assert_array_equal(self.mask['bit'],\n                           [False, False, False, False, False])\n\n    def test_bitarray_mask(self):\n        assert not np.any(self.mask['bitarray'])\n\n    def test_bit_array2_mask(self):\n        assert not np.any(self.mask['bitarray2'])\n\n    def test_schema(self, tmpdir):\n        # have to use an actual file because assert_validate_schema only works\n        # on filenames, not file-like objects\n        fn = str(tmpdir.join(\"test_through_tabledata.xml\"))\n        with open(fn, 'wb') as f:\n            f.write(self.xmlout.getvalue())\n        assert_validate_schema(fn, '1.1')\n\n\nclass TestThroughBinary(TestParse):\n    def setup_class(self):\n        votable = parse(get_pkg_data_filename('data/regression.xml'))\n        votable.get_first_table().format = 'binary'\n\n        self.xmlout = bio = io.BytesIO()\n        # W39: Bit values can not be masked\n        with pytest.warns(W39):\n            votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio)\n\n        self.table = self.votable.get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask\n\n    # Masked values in bit fields don't roundtrip through the binary\n    # representation -- that's not a bug, just a limitation, so\n    # override the mask array checks here.\n    def test_bit_mask(self):\n        assert not np.any(self.mask['bit'])\n\n    def test_bitarray_mask(self):\n        assert not np.any(self.mask['bitarray'])\n\n    def test_bit_array2_mask(self):\n        assert not np.any(self.mask['bitarray2'])\n\n\nclass TestThroughBinary2(TestParse):\n    def setup_class(self):\n        votable = parse(get_pkg_data_filename('data/regression.xml'))\n        votable.version = '1.3'\n        votable.get_first_table()._config['version_1_3_or_later'] = True\n        votable.get_first_table().format = 'binary2'\n\n        self.xmlout = bio = io.BytesIO()\n        # W39: Bit values can not be masked\n        with pytest.warns(W39):\n            votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio)\n\n        self.table = self.votable.get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask\n\n    def test_get_coosys_by_id(self):\n        # No COOSYS in VOTable 1.2 or later\n        pass\n\n\ndef table_from_scratch():\n    from astropy.io.votable.tree import VOTableFile, Resource, Table, Field\n\n    # Create a new VOTable file...\n    votable = VOTableFile()\n\n    # ...with one resource...\n    resource = Resource()\n    votable.resources.append(resource)\n\n    # ... with one table\n    table = Table(votable)\n    resource.tables.append(table)\n\n    # Define some fields\n    table.fields.extend([\n            Field(votable, ID=\"filename\", datatype=\"char\"),\n            Field(votable, ID=\"matrix\", datatype=\"double\", arraysize=\"2x2\")])\n\n    # Now, use those field definitions to create the numpy record arrays, with\n    # the given number of rows\n    table.create_arrays(2)\n\n    # Now table.array can be filled with data\n    table.array[0] = ('test1.xml', [[1, 0], [0, 1]])\n    table.array[1] = ('test2.xml', [[0.5, 0.3], [0.2, 0.1]])\n\n    # Now write the whole thing to a file.\n    # Note, we have to use the top-level votable file object\n    out = io.StringIO()\n    votable.to_xml(out)\n\n\ndef test_open_files():\n    for filename in get_pkg_data_filenames('data', pattern='*.xml'):\n        if (filename.endswith('custom_datatype.xml') or\n                filename.endswith('timesys_errors.xml')):\n            continue\n        parse(filename)\n\n\ndef test_too_many_columns():\n    with pytest.raises(VOTableSpecError):\n        parse(get_pkg_data_filename('data/too_many_columns.xml.gz'))\n\n\ndef test_build_from_scratch(tmpdir):\n    # Create a new VOTable file...\n    votable = tree.VOTableFile()\n\n    # ...with one resource...\n    resource = tree.Resource()\n    votable.resources.append(resource)\n\n    # ... with one table\n    table = tree.Table(votable)\n    resource.tables.append(table)\n\n    # Define some fields\n    table.fields.extend([\n        tree.Field(votable, ID=\"filename\", name='filename', datatype=\"char\",\n                   arraysize='1'),\n        tree.Field(votable, ID=\"matrix\", name='matrix', datatype=\"double\",\n                   arraysize=\"2x2\")])\n\n    # Now, use those field definitions to create the numpy record arrays, with\n    # the given number of rows\n    table.create_arrays(2)\n\n    # Now table.array can be filled with data\n    table.array[0] = ('test1.xml', [[1, 0], [0, 1]])\n    table.array[1] = ('test2.xml', [[0.5, 0.3], [0.2, 0.1]])\n\n    # Now write the whole thing to a file.\n    # Note, we have to use the top-level votable file object\n    votable.to_xml(str(tmpdir.join(\"new_votable.xml\")))\n\n    votable = parse(str(tmpdir.join(\"new_votable.xml\")))\n\n    table = votable.get_first_table()\n    assert_array_equal(\n        table.array.mask, np.array([(False, [[False, False], [False, False]]),\n                                    (False, [[False, False], [False, False]])],\n                                   dtype=[('filename', '?'),\n                                          ('matrix', '?', (2, 2))]))\n\n\ndef test_validate(test_path_object=False):\n    \"\"\"\n    test_path_object is needed for test below ``test_validate_path_object``\n    so that file could be passed as pathlib.Path object.\n    \"\"\"\n    output = io.StringIO()\n    fpath = get_pkg_data_filename('data/regression.xml')\n    if test_path_object:\n        fpath = pathlib.Path(fpath)\n\n    # We can't test xmllint, because we can't rely on it being on the\n    # user's machine.\n    result = validate(fpath, output, xmllint=False)\n\n    assert result is False\n\n    output.seek(0)\n    output = output.readlines()\n\n    # Uncomment to generate new groundtruth\n    # with open('validation.txt', 'wt', encoding='utf-8') as fd:\n    #    fd.write(u''.join(output))\n\n    with open(\n        get_pkg_data_filename('data/validation.txt'),\n            'rt', encoding='utf-8') as fd:\n        truth = fd.readlines()\n\n    truth = truth[1:]\n    output = output[1:-1]\n\n    sys.stdout.writelines(\n        difflib.unified_diff(truth, output, fromfile='truth', tofile='output'))\n\n    assert truth == output\n\n\n@mock.patch('subprocess.Popen')\ndef test_validate_xmllint_true(mock_subproc_popen):\n    process_mock = mock.Mock()\n    attrs = {'communicate.return_value': ('ok', 'ko'),\n             'returncode': 0}\n    process_mock.configure_mock(**attrs)\n    mock_subproc_popen.return_value = process_mock\n\n    assert validate(get_pkg_data_filename('data/empty_table.xml'),\n                    xmllint=True)\n\n\ndef test_validate_path_object():\n    \"\"\"\n    Validating when source is passed as path object. (#4412)\n    \"\"\"\n    test_validate(test_path_object=True)\n\n\ndef test_gzip_filehandles(tmpdir):\n    votable = parse(get_pkg_data_filename('data/regression.xml'))\n\n    # W39: Bit values can not be masked\n    with pytest.warns(W39):\n        with open(str(tmpdir.join(\"regression.compressed.xml\")), 'wb') as fd:\n            votable.to_xml(fd, compressed=True, _astropy_version=\"testing\")\n\n    with open(str(tmpdir.join(\"regression.compressed.xml\")), 'rb') as fd:\n        votable = parse(fd)\n\n\ndef test_from_scratch_example():\n    _run_test_from_scratch_example()\n\n\ndef _run_test_from_scratch_example():\n    from astropy.io.votable.tree import VOTableFile, Resource, Table, Field\n\n    # Create a new VOTable file...\n    votable = VOTableFile()\n\n    # ...with one resource...\n    resource = Resource()\n    votable.resources.append(resource)\n\n    # ... with one table\n    table = Table(votable)\n    resource.tables.append(table)\n\n    # Define some fields\n    table.fields.extend([\n        Field(votable, name=\"filename\", datatype=\"char\", arraysize=\"*\"),\n        Field(votable, name=\"matrix\", datatype=\"double\", arraysize=\"2x2\")])\n\n    # Now, use those field definitions to create the numpy record arrays, with\n    # the given number of rows\n    table.create_arrays(2)\n\n    # Now table.array can be filled with data\n    table.array[0] = ('test1.xml', [[1, 0], [0, 1]])\n    table.array[1] = ('test2.xml', [[0.5, 0.3], [0.2, 0.1]])\n\n    assert table.array[0][0] == 'test1.xml'\n\n\ndef test_fileobj():\n    # Assert that what we get back is a raw C file pointer\n    # so it will be super fast in the C extension.\n    from astropy.utils.xml import iterparser\n    filename = get_pkg_data_filename('data/regression.xml')\n    with iterparser._convert_to_fd_or_read_function(filename) as fd:\n        if sys.platform == 'win32':\n            fd()\n        else:\n            assert isinstance(fd, io.FileIO)\n\n\ndef test_nonstandard_units():\n    from astropy import units as u\n\n    votable = parse(get_pkg_data_filename('data/nonstandard_units.xml'))\n\n    assert isinstance(\n        votable.get_first_table().fields[0].unit, u.UnrecognizedUnit)\n\n    votable = parse(get_pkg_data_filename('data/nonstandard_units.xml'),\n                    unit_format='generic')\n\n    assert not isinstance(\n        votable.get_first_table().fields[0].unit, u.UnrecognizedUnit)\n\n\ndef test_resource_structure():\n    # Based on issue #1223, as reported by @astro-friedel and @RayPlante\n    from astropy.io.votable import tree as vot\n\n    vtf = vot.VOTableFile()\n\n    r1 = vot.Resource()\n    vtf.resources.append(r1)\n    t1 = vot.Table(vtf)\n    t1.name = \"t1\"\n    t2 = vot.Table(vtf)\n    t2.name = 't2'\n    r1.tables.append(t1)\n    r1.tables.append(t2)\n\n    r2 = vot.Resource()\n    vtf.resources.append(r2)\n    t3 = vot.Table(vtf)\n    t3.name = \"t3\"\n    t4 = vot.Table(vtf)\n    t4.name = \"t4\"\n    r2.tables.append(t3)\n    r2.tables.append(t4)\n\n    r3 = vot.Resource()\n    vtf.resources.append(r3)\n    t5 = vot.Table(vtf)\n    t5.name = \"t5\"\n    t6 = vot.Table(vtf)\n    t6.name = \"t6\"\n    r3.tables.append(t5)\n    r3.tables.append(t6)\n\n    buff = io.BytesIO()\n    vtf.to_xml(buff)\n\n    buff.seek(0)\n    vtf2 = parse(buff)\n\n    assert len(vtf2.resources) == 3\n\n    for r in range(len(vtf2.resources)):\n        res = vtf2.resources[r]\n        assert len(res.tables) == 2\n        assert len(res.resources) == 0\n\n\ndef test_no_resource_check():\n    output = io.StringIO()\n\n    # We can't test xmllint, because we can't rely on it being on the\n    # user's machine.\n    result = validate(get_pkg_data_filename('data/no_resource.xml'),\n                      output, xmllint=False)\n\n    assert result is False\n\n    output.seek(0)\n    output = output.readlines()\n\n    # Uncomment to generate new groundtruth\n    # with open('no_resource.txt', 'wt', encoding='utf-8') as fd:\n    #     fd.write(u''.join(output))\n\n    with open(\n        get_pkg_data_filename('data/no_resource.txt'),\n            'rt', encoding='utf-8') as fd:\n        truth = fd.readlines()\n\n    truth = truth[1:]\n    output = output[1:-1]\n\n    sys.stdout.writelines(\n        difflib.unified_diff(truth, output, fromfile='truth', tofile='output'))\n\n    assert truth == output\n\n\ndef test_instantiate_vowarning():\n    # This used to raise a deprecation exception.\n    # See https://github.com/astropy/astroquery/pull/276\n    VOWarning(())\n\n\ndef test_custom_datatype():\n    votable = parse(get_pkg_data_filename('data/custom_datatype.xml'),\n                    datatype_mapping={'bar': 'int'})\n\n    table = votable.get_first_table()\n    assert table.array.dtype['foo'] == np.int32\n\n\ndef _timesys_tests(votable):\n    assert len(list(votable.iter_timesys())) == 4\n\n    timesys = votable.get_timesys_by_id('time_frame')\n    assert timesys.timeorigin == 2455197.5\n    assert timesys.timescale == 'TCB'\n    assert timesys.refposition == 'BARYCENTER'\n\n    timesys = votable.get_timesys_by_id('mjd_origin')\n    assert timesys.timeorigin == 'MJD-origin'\n    assert timesys.timescale == 'TDB'\n    assert timesys.refposition == 'EMBARYCENTER'\n\n    timesys = votable.get_timesys_by_id('jd_origin')\n    assert timesys.timeorigin == 'JD-origin'\n    assert timesys.timescale == 'TT'\n    assert timesys.refposition == 'HELIOCENTER'\n\n    timesys = votable.get_timesys_by_id('no_origin')\n    assert timesys.timeorigin is None\n    assert timesys.timescale == 'UTC'\n    assert timesys.refposition == 'TOPOCENTER'\n\n\ndef test_timesys():\n    votable = parse(get_pkg_data_filename('data/timesys.xml'))\n    _timesys_tests(votable)\n\n\ndef test_timesys_roundtrip():\n    orig_votable = parse(get_pkg_data_filename('data/timesys.xml'))\n    bio = io.BytesIO()\n    orig_votable.to_xml(bio)\n    bio.seek(0)\n    votable = parse(bio)\n    _timesys_tests(votable)\n\n\ndef test_timesys_errors():\n    output = io.StringIO()\n    validate(get_pkg_data_filename('data/timesys_errors.xml'), output,\n             xmllint=False)\n    outstr = output.getvalue()\n    assert(\"E23: Invalid timeorigin attribute 'bad-origin'\" in outstr)\n    assert(\"E22: ID attribute is required for all TIMESYS elements\" in outstr)\n    assert(\"W48: Unknown attribute 'refposition_mispelled' on TIMESYS\"\n           in outstr)\n"},{"col":4,"comment":"null","endLoc":1599,"header":"def __init__(self, votable, ID=None, name=None, value=None, datatype=None,\n                 arraysize=None, ucd=None, unit=None, width=None,\n                 precision=None, utype=None, type=None, id=None, config=None,\n                 pos=None, **extra)","id":6213,"name":"__init__","nodeType":"Function","startLoc":1591,"text":"def __init__(self, votable, ID=None, name=None, value=None, datatype=None,\n                 arraysize=None, ucd=None, unit=None, width=None,\n                 precision=None, utype=None, type=None, id=None, config=None,\n                 pos=None, **extra):\n        self._value = value\n        Field.__init__(self, votable, ID=ID, name=name, datatype=datatype,\n                       arraysize=arraysize, ucd=ucd, unit=unit,\n                       precision=precision, utype=utype, type=type,\n                       id=id, config=config, pos=pos, **extra)"},{"col":4,"comment":"\n        Defines the MIME role of the referenced object.  Must be one of:\n\n          None, 'query', 'hints', 'doc', 'location' or 'type'\n        ","endLoc":580,"header":"@property\n    def content_role(self)","id":6214,"name":"content_role","nodeType":"Function","startLoc":573,"text":"@property\n    def content_role(self):\n        \"\"\"\n        Defines the MIME role of the referenced object.  Must be one of:\n\n          None, 'query', 'hints', 'doc', 'location' or 'type'\n        \"\"\"\n        return self._content_role"},{"col":4,"comment":"null","endLoc":589,"header":"@content_role.setter\n    def content_role(self, content_role)","id":6215,"name":"content_role","nodeType":"Function","startLoc":582,"text":"@content_role.setter\n    def content_role(self, content_role):\n        if ((content_role == 'type' and\n             not self._config['version_1_3_or_later']) or\n             content_role not in\n             (None, 'query', 'hints', 'doc', 'location')):\n            vo_warn(W45, (content_role,), self._config, self._pos)\n        self._content_role = content_role"},{"col":4,"comment":"null","endLoc":593,"header":"@content_role.deleter\n    def content_role(self)","id":6216,"name":"content_role","nodeType":"Function","startLoc":591,"text":"@content_role.deleter\n    def content_role(self):\n        self._content_role = None"},{"col":4,"comment":"Defines the MIME content type of the referenced object.","endLoc":598,"header":"@property\n    def content_type(self)","id":6217,"name":"content_type","nodeType":"Function","startLoc":595,"text":"@property\n    def content_type(self):\n        \"\"\"Defines the MIME content type of the referenced object.\"\"\"\n        return self._content_type"},{"col":4,"comment":"null","endLoc":603,"header":"@content_type.setter\n    def content_type(self, content_type)","id":6218,"name":"content_type","nodeType":"Function","startLoc":600,"text":"@content_type.setter\n    def content_type(self, content_type):\n        xmlutil.check_mime_content_type(content_type, self._config, self._pos)\n        self._content_type = content_type"},{"col":4,"comment":"null","endLoc":446,"header":"def _binparse_fixed(self, read)","id":6219,"name":"_binparse_fixed","nodeType":"Function","startLoc":440,"text":"def _binparse_fixed(self, read):\n        s = struct_unpack(self._struct_format, read(self.arraysize * 2))[0]\n        s = s.decode('utf_16_be')\n        end = s.find('\\0')\n        if end != -1:\n            return s[:end], False\n        return s, False"},{"col":4,"comment":"null","endLoc":607,"header":"@content_type.deleter\n    def content_type(self)","id":6220,"name":"content_type","nodeType":"Function","startLoc":605,"text":"@content_type.deleter\n    def content_type(self):\n        self._content_type = None"},{"col":4,"comment":"\n        A URI to an arbitrary protocol.  The vo package only supports\n        http and anonymous ftp.\n        ","endLoc":615,"header":"@property\n    def href(self)","id":6221,"name":"href","nodeType":"Function","startLoc":609,"text":"@property\n    def href(self):\n        \"\"\"\n        A URI to an arbitrary protocol.  The vo package only supports\n        http and anonymous ftp.\n        \"\"\"\n        return self._href"},{"col":4,"comment":"null","endLoc":620,"header":"@href.setter\n    def href(self, href)","id":6222,"name":"href","nodeType":"Function","startLoc":617,"text":"@href.setter\n    def href(self, href):\n        xmlutil.check_anyuri(href, self._config, self._pos)\n        self._href = href"},{"col":4,"comment":"null","endLoc":624,"header":"@href.deleter\n    def href(self)","id":6223,"name":"href","nodeType":"Function","startLoc":622,"text":"@href.deleter\n    def href(self):\n        self._href = None"},{"col":4,"comment":"null","endLoc":634,"header":"def to_table_column(self, column)","id":6224,"name":"to_table_column","nodeType":"Function","startLoc":626,"text":"def to_table_column(self, column):\n        meta = {}\n        for key in self._attr_list:\n            val = getattr(self, key, None)\n            if val is not None:\n                meta[key] = val\n\n        column.meta.setdefault('links', [])\n        column.meta['links'].append(meta)"},{"col":4,"comment":"null","endLoc":452,"header":"def _binoutput_var(self, value, mask)","id":6225,"name":"_binoutput_var","nodeType":"Function","startLoc":448,"text":"def _binoutput_var(self, value, mask):\n        if mask or value is None or value == '':\n            return _zero_int\n        encoded = value.encode('utf_16_be')\n        return self._write_length(len(encoded) / 2) + encoded"},{"col":4,"comment":"null","endLoc":1240,"header":"def __init__(self, votable, ID=None, name=None, datatype=None,\n                 arraysize=None, ucd=None, unit=None, width=None,\n                 precision=None, utype=None, ref=None, type=None, id=None,\n                 xtype=None,\n                 config=None, pos=None, **extra)","id":6226,"name":"__init__","nodeType":"Function","startLoc":1150,"text":"def __init__(self, votable, ID=None, name=None, datatype=None,\n                 arraysize=None, ucd=None, unit=None, width=None,\n                 precision=None, utype=None, ref=None, type=None, id=None,\n                 xtype=None,\n                 config=None, pos=None, **extra):\n        if config is None:\n            if hasattr(votable, '_get_version_checks'):\n                config = votable._get_version_checks()\n            else:\n                config = {}\n        self._config = config\n        self._pos = pos\n\n        SimpleElement.__init__(self)\n\n        if config.get('version_1_2_or_later'):\n            self._attr_list = self._attr_list_12\n        else:\n            self._attr_list = self._attr_list_11\n            if xtype is not None:\n                warn_unknown_attrs(self._element_name, ['xtype'], config, pos)\n\n        # TODO: REMOVE ME ----------------------------------------\n        # This is a terrible hack to support Simple Image Access\n        # Protocol results from https://astroarchive.noirlab.edu/ .  It creates a field\n        # for the coordinate projection type of type \"double\", which\n        # actually contains character data.  We have to hack the field\n        # to store character data, or we can't read it in.  A warning\n        # will be raised when this happens.\n        if (config.get('verify', 'ignore') != 'exception' and name == 'cprojection' and\n            ID == 'cprojection' and ucd == 'VOX:WCS_CoordProjection' and\n            datatype == 'double'):\n            datatype = 'char'\n            arraysize = '3'\n            vo_warn(W40, (), config, pos)\n        # ----------------------------------------\n\n        self.description = None\n        self._votable = votable\n\n        self.ID = (resolve_id(ID, id, config, pos) or\n                   xmlutil.fix_id(name, config, pos))\n        self.name = name\n        if name is None:\n            if (self._element_name == 'PARAM' and\n                not config.get('version_1_1_or_later')):\n                pass\n            else:\n                warn_or_raise(W15, W15, self._element_name, config, pos)\n            self.name = self.ID\n\n        if self._ID is None and name is None:\n            vo_raise(W12, self._element_name, config, pos)\n\n        datatype_mapping = {\n            'string': 'char',\n            'unicodeString': 'unicodeChar',\n            'int16': 'short',\n            'int32': 'int',\n            'int64': 'long',\n            'float32': 'float',\n            'float64': 'double',\n            # The following appear in some Vizier tables\n            'unsignedInt': 'long',\n            'unsignedShort': 'int'\n        }\n\n        datatype_mapping.update(config.get('datatype_mapping', {}))\n\n        if datatype in datatype_mapping:\n            warn_or_raise(W13, W13, (datatype, datatype_mapping[datatype]),\n                          config, pos)\n            datatype = datatype_mapping[datatype]\n\n        self.ref = ref\n        self.datatype = datatype\n        self.arraysize = arraysize\n        self.ucd = ucd\n        self.unit = unit\n        self.width = width\n        self.precision = precision\n        self.utype = utype\n        self.type = type\n        self._links = HomogeneousList(Link)\n        self.title = self.name\n        self.values = Values(self._votable, self)\n        self.xtype = xtype\n\n        self._setup(config, pos)\n\n        warn_unknown_attrs(self._element_name, extra.keys(), config, pos)"},{"col":4,"comment":"null","endLoc":638,"header":"@classmethod\n    def from_table_column(cls, d)","id":6227,"name":"from_table_column","nodeType":"Function","startLoc":636,"text":"@classmethod\n    def from_table_column(cls, d):\n        return cls(**d)"},{"col":4,"comment":"null","endLoc":457,"header":"def _binoutput_fixed(self, value, mask)","id":6228,"name":"_binoutput_fixed","nodeType":"Function","startLoc":454,"text":"def _binoutput_fixed(self, value, mask):\n        if mask:\n            value = ''\n        return struct_pack(self._struct_format, value.encode('utf_16_be'))"},{"col":0,"comment":"\n    Get an appropriate converter instance for a given field.\n\n    Parameters\n    ----------\n    field : astropy.io.votable.tree.Field\n\n    config : dict, optional\n        Parser configuration dictionary\n\n    pos : tuple\n        Position in the input XML file.  Used for error messages.\n\n    Returns\n    -------\n    converter : astropy.io.votable.converters.Converter\n    ","endLoc":1325,"header":"def get_converter(field, config=None, pos=None)","id":6229,"name":"get_converter","nodeType":"Function","startLoc":1267,"text":"def get_converter(field, config=None, pos=None):\n    \"\"\"\n    Get an appropriate converter instance for a given field.\n\n    Parameters\n    ----------\n    field : astropy.io.votable.tree.Field\n\n    config : dict, optional\n        Parser configuration dictionary\n\n    pos : tuple\n        Position in the input XML file.  Used for error messages.\n\n    Returns\n    -------\n    converter : astropy.io.votable.converters.Converter\n    \"\"\"\n    if config is None:\n        config = {}\n\n    if field.datatype not in converter_mapping:\n        vo_raise(E06, (field.datatype, field.ID), config)\n\n    cls = converter_mapping[field.datatype]\n    converter = cls(field, config, pos)\n\n    arraysize = field.arraysize\n\n    # With numeric datatypes, special things need to happen for\n    # arrays.\n    if (field.datatype not in ('char', 'unicodeChar') and\n        arraysize is not None):\n        if arraysize[-1] == '*':\n            arraysize = arraysize[:-1]\n            last_x = arraysize.rfind('x')\n            if last_x == -1:\n                arraysize = ''\n            else:\n                arraysize = arraysize[:last_x]\n            fixed = False\n        else:\n            fixed = True\n\n        if arraysize != '':\n            arraysize = [int(x) for x in arraysize.split(\"x\")]\n            arraysize.reverse()\n        else:\n            arraysize = []\n\n        if arraysize != []:\n            converter = converter.array_type(\n                field, converter, arraysize, config)\n\n        if not fixed:\n            converter = converter.vararray_type(\n                field, converter, arraysize, config)\n\n    return converter"},{"attributeType":"null","col":4,"comment":"null","endLoc":402,"id":6230,"name":"default","nodeType":"Attribute","startLoc":402,"text":"default"},{"attributeType":"function","col":12,"comment":"null","endLoc":422,"id":6231,"name":"binparse","nodeType":"Attribute","startLoc":422,"text":"self.binparse"},{"attributeType":"null","col":4,"comment":"null","endLoc":541,"id":6232,"name":"_attr_list","nodeType":"Attribute","startLoc":541,"text":"_attr_list"},{"attributeType":"null","col":4,"comment":"null","endLoc":543,"id":6233,"name":"_element_name","nodeType":"Attribute","startLoc":543,"text":"_element_name"},{"col":0,"comment":"null","endLoc":65,"header":"def test_suppress_warnings()","id":6234,"name":"test_suppress_warnings","nodeType":"Function","startLoc":49,"text":"def test_suppress_warnings():\n    cfg = {}\n    warn = exceptions.W01('foo')\n\n    with exceptions.conf.set_temp('max_warnings', 2):\n        with pytest.warns(exceptions.W01) as record:\n            exceptions._suppressed_warning(warn, cfg)\n            assert len(record) == 1\n            assert 'suppressing' not in str(record[0].message)\n\n        with pytest.warns(exceptions.W01, match='suppressing'):\n            exceptions._suppressed_warning(warn, cfg)\n\n        exceptions._suppressed_warning(warn, cfg)\n\n    assert cfg['_warning_counts'][exceptions.W01] == 3\n    assert exceptions.conf.max_warnings == 10"},{"attributeType":"null","col":8,"comment":"null","endLoc":620,"id":6235,"name":"_href","nodeType":"Attribute","startLoc":620,"text":"self._href"},{"attributeType":"null","col":8,"comment":"null","endLoc":562,"id":6236,"name":"content_type","nodeType":"Attribute","startLoc":562,"text":"self.content_type"},{"attributeType":"{__eq__}","col":8,"comment":"null","endLoc":589,"id":6237,"name":"_content_role","nodeType":"Attribute","startLoc":589,"text":"self._content_role"},{"col":0,"comment":"\n    Returns the path of all of the data files in a given directory\n    that match a given glob pattern.\n\n    Parameters\n    ----------\n    datadir : str\n        Name/location of the desired data files.  One of the following:\n\n            * The name of a directory included in the source\n              distribution.  The path is relative to the module\n              calling this function.  For example, if calling from\n              ``astropy.pkname``, use ``'data'`` to get the\n              files in ``astropy/pkgname/data``.\n            * Remote URLs are not currently supported.\n\n    package : str, optional\n        If specified, look for a file relative to the given package, rather\n        than the default of looking relative to the calling module's package.\n\n    pattern : str, optional\n        A UNIX-style filename glob pattern to match files.  See the\n        `glob` module in the standard library for more information.\n        By default, matches all files.\n\n    Returns\n    -------\n    filenames : iterator of str\n        Paths on the local filesystem in *datadir* matching *pattern*.\n\n    Examples\n    --------\n    This will retrieve the contents of the data file for the `astropy.wcs`\n    tests::\n\n        >>> from astropy.utils.data import get_pkg_data_filenames\n        >>> for fn in get_pkg_data_filenames('data/maps', 'astropy.wcs.tests',\n        ...                                  '*.hdr'):\n        ...     with open(fn) as f:\n        ...         fcontents = f.read()\n        ...\n    ","endLoc":790,"header":"def get_pkg_data_filenames(datadir, package=None, pattern='*')","id":6238,"name":"get_pkg_data_filenames","nodeType":"Function","startLoc":736,"text":"def get_pkg_data_filenames(datadir, package=None, pattern='*'):\n    \"\"\"\n    Returns the path of all of the data files in a given directory\n    that match a given glob pattern.\n\n    Parameters\n    ----------\n    datadir : str\n        Name/location of the desired data files.  One of the following:\n\n            * The name of a directory included in the source\n              distribution.  The path is relative to the module\n              calling this function.  For example, if calling from\n              ``astropy.pkname``, use ``'data'`` to get the\n              files in ``astropy/pkgname/data``.\n            * Remote URLs are not currently supported.\n\n    package : str, optional\n        If specified, look for a file relative to the given package, rather\n        than the default of looking relative to the calling module's package.\n\n    pattern : str, optional\n        A UNIX-style filename glob pattern to match files.  See the\n        `glob` module in the standard library for more information.\n        By default, matches all files.\n\n    Returns\n    -------\n    filenames : iterator of str\n        Paths on the local filesystem in *datadir* matching *pattern*.\n\n    Examples\n    --------\n    This will retrieve the contents of the data file for the `astropy.wcs`\n    tests::\n\n        >>> from astropy.utils.data import get_pkg_data_filenames\n        >>> for fn in get_pkg_data_filenames('data/maps', 'astropy.wcs.tests',\n        ...                                  '*.hdr'):\n        ...     with open(fn) as f:\n        ...         fcontents = f.read()\n        ...\n    \"\"\"\n\n    path = get_pkg_data_path(datadir, package=package)\n    if os.path.isfile(path):\n        raise OSError(\n            \"Tried to access a data directory that's actually \"\n            \"a package data file\")\n    elif os.path.isdir(path):\n        for filename in os.listdir(path):\n            if fnmatch.fnmatch(filename, pattern):\n                yield os.path.join(path, filename)\n    else:\n        raise OSError(\"Path not found\")"},{"fileName":"ucd_test.py","filePath":"astropy/io/votable/tests","id":6239,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport pytest\n\nfrom astropy.io.votable import ucd\n\n\ndef test_none():\n    assert ucd.check_ucd(None)\n\n\nexamples = {\n    'phys.temperature':\n        [('ivoa', 'phys.temperature')],\n    'pos.eq.ra;meta.main':\n        [('ivoa', 'pos.eq.ra'), ('ivoa', 'meta.main')],\n    'meta.id;src':\n        [('ivoa', 'meta.id'), ('ivoa', 'src')],\n    'phot.flux;em.radio;arith.ratio':\n        [('ivoa', 'phot.flux'), ('ivoa', 'em.radio'), ('ivoa', 'arith.ratio')],\n    'PHot.Flux;EM.Radio;ivoa:arith.Ratio':\n        [('ivoa', 'phot.flux'), ('ivoa', 'em.radio'), ('ivoa', 'arith.ratio')],\n    'pos.galactic.lat':\n        [('ivoa', 'pos.galactic.lat')],\n    'meta.code;phot.mag':\n        [('ivoa', 'meta.code'), ('ivoa', 'phot.mag')],\n    'stat.error;phot.mag':\n        [('ivoa', 'stat.error'), ('ivoa', 'phot.mag')],\n    'phys.temperature;instr;stat.max':\n        [('ivoa', 'phys.temperature'), ('ivoa', 'instr'),\n         ('ivoa', 'stat.max')],\n    'stat.error;phot.mag;em.opt.V':\n        [('ivoa', 'stat.error'), ('ivoa', 'phot.mag'), ('ivoa', 'em.opt.V')],\n    'phot.color;em.opt.B;em.opt.V':\n        [('ivoa', 'phot.color'), ('ivoa', 'em.opt.B'), ('ivoa', 'em.opt.V')],\n    'stat.error;phot.color;em.opt.B;em.opt.V':\n        [('ivoa', 'stat.error'), ('ivoa', 'phot.color'), ('ivoa', 'em.opt.B'),\n         ('ivoa', 'em.opt.V')],\n}\n\n\ndef test_check():\n    for s, p in examples.items():\n        assert ucd.parse_ucd(s, True, True) == p\n        assert ucd.check_ucd(s, True, True)\n\n\ndef test_too_many_colons():\n    with pytest.raises(ValueError):\n        ucd.parse_ucd(\"ivoa:stsci:phot\", True, True)\n\n\ndef test_invalid_namespace():\n    with pytest.raises(ValueError):\n        ucd.parse_ucd(\"_ivoa:phot.mag\", True, True)\n\n\ndef test_invalid_word():\n    with pytest.raises(ValueError):\n        ucd.parse_ucd(\"-pho\")\n"},{"col":0,"comment":"null","endLoc":9,"header":"def test_none()","id":6240,"name":"test_none","nodeType":"Function","startLoc":8,"text":"def test_none():\n    assert ucd.check_ucd(None)"},{"col":0,"comment":"null","endLoc":45,"header":"def test_check()","id":6241,"name":"test_check","nodeType":"Function","startLoc":42,"text":"def test_check():\n    for s, p in examples.items():\n        assert ucd.parse_ucd(s, True, True) == p\n        assert ucd.check_ucd(s, True, True)"},{"attributeType":"null","col":12,"comment":"null","endLoc":424,"id":6242,"name":"_struct_format","nodeType":"Attribute","startLoc":424,"text":"self._struct_format"},{"col":4,"comment":"null","endLoc":842,"header":"def __init__(self, votable, field, ID=None, null=None, ref=None,\n                 type=\"legal\", id=None, config=None, pos=None, **extras)","id":6243,"name":"__init__","nodeType":"Function","startLoc":820,"text":"def __init__(self, votable, field, ID=None, null=None, ref=None,\n                 type=\"legal\", id=None, config=None, pos=None, **extras):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        Element.__init__(self)\n\n        self._votable = votable\n        self._field = field\n        self.ID = resolve_id(ID, id, config, pos)\n        self.null = null\n        self._ref = ref\n        self.type = type\n\n        self.min = None\n        self.max = None\n        self.min_inclusive = True\n        self.max_inclusive = True\n        self._options = []\n\n        warn_unknown_attrs('VALUES', extras.keys(), config, pos)"},{"attributeType":"function","col":12,"comment":"null","endLoc":423,"id":6244,"name":"binoutput","nodeType":"Attribute","startLoc":423,"text":"self.binoutput"},{"className":"TestFixups","col":0,"comment":"null","endLoc":199,"id":6245,"nodeType":"Class","startLoc":190,"text":"class TestFixups:\n    def setup_class(self):\n        self.table = parse(\n            get_pkg_data_filename('data/regression.xml')).get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask\n\n    def test_implicit_id(self):\n        assert_array_equal(self.array['string_test_2'],\n                           self.array['fixed string test'])"},{"col":4,"comment":"null","endLoc":195,"header":"def setup_class(self)","id":6246,"name":"setup_class","nodeType":"Function","startLoc":191,"text":"def setup_class(self):\n        self.table = parse(\n            get_pkg_data_filename('data/regression.xml')).get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask"},{"attributeType":"null","col":16,"comment":"null","endLoc":418,"id":6247,"name":"arraysize","nodeType":"Attribute","startLoc":418,"text":"self.arraysize"},{"attributeType":"null","col":12,"comment":"null","endLoc":421,"id":6248,"name":"format","nodeType":"Attribute","startLoc":421,"text":"self.format"},{"col":0,"comment":"null","endLoc":50,"header":"def test_too_many_colons()","id":6249,"name":"test_too_many_colons","nodeType":"Function","startLoc":48,"text":"def test_too_many_colons():\n    with pytest.raises(ValueError):\n        ucd.parse_ucd(\"ivoa:stsci:phot\", True, True)"},{"className":"Array","col":0,"comment":"\n    Handles both fixed and variable-lengths arrays.\n    ","endLoc":485,"id":6250,"nodeType":"Class","startLoc":460,"text":"class Array(Converter):\n    \"\"\"\n    Handles both fixed and variable-lengths arrays.\n    \"\"\"\n\n    def __init__(self, field, config=None, pos=None):\n        if config is None:\n            config = {}\n        Converter.__init__(self, field, config, pos)\n        if config.get('verify', 'ignore') == 'exception':\n            self._splitter = self._splitter_pedantic\n        else:\n            self._splitter = self._splitter_lax\n\n    def parse_scalar(self, value, config=None, pos=0):\n        return self._base.parse_scalar(value, config, pos)\n\n    @staticmethod\n    def _splitter_pedantic(value, config=None, pos=None):\n        return pedantic_array_splitter.split(value)\n\n    @staticmethod\n    def _splitter_lax(value, config=None, pos=None):\n        if ',' in value:\n            vo_warn(W01, (), config, pos)\n        return array_splitter.split(value)"},{"col":4,"comment":"null","endLoc":472,"header":"def __init__(self, field, config=None, pos=None)","id":6251,"name":"__init__","nodeType":"Function","startLoc":465,"text":"def __init__(self, field, config=None, pos=None):\n        if config is None:\n            config = {}\n        Converter.__init__(self, field, config, pos)\n        if config.get('verify', 'ignore') == 'exception':\n            self._splitter = self._splitter_pedantic\n        else:\n            self._splitter = self._splitter_lax"},{"col":0,"comment":"null","endLoc":55,"header":"def test_invalid_namespace()","id":6252,"name":"test_invalid_namespace","nodeType":"Function","startLoc":53,"text":"def test_invalid_namespace():\n    with pytest.raises(ValueError):\n        ucd.parse_ucd(\"_ivoa:phot.mag\", True, True)"},{"col":4,"comment":"null","endLoc":475,"header":"def parse_scalar(self, value, config=None, pos=0)","id":6253,"name":"parse_scalar","nodeType":"Function","startLoc":474,"text":"def parse_scalar(self, value, config=None, pos=0):\n        return self._base.parse_scalar(value, config, pos)"},{"col":0,"comment":"null","endLoc":60,"header":"def test_invalid_word()","id":6254,"name":"test_invalid_word","nodeType":"Function","startLoc":58,"text":"def test_invalid_word():\n    with pytest.raises(ValueError):\n        ucd.parse_ucd(\"-pho\")"},{"col":4,"comment":"null","endLoc":479,"header":"@staticmethod\n    def _splitter_pedantic(value, config=None, pos=None)","id":6255,"name":"_splitter_pedantic","nodeType":"Function","startLoc":477,"text":"@staticmethod\n    def _splitter_pedantic(value, config=None, pos=None):\n        return pedantic_array_splitter.split(value)"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":6256,"name":"examples","nodeType":"Attribute","startLoc":12,"text":"examples"},{"col":0,"comment":"","endLoc":3,"header":"ucd_test.py#<anonymous>","id":6257,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"examples = {\n    'phys.temperature':\n        [('ivoa', 'phys.temperature')],\n    'pos.eq.ra;meta.main':\n        [('ivoa', 'pos.eq.ra'), ('ivoa', 'meta.main')],\n    'meta.id;src':\n        [('ivoa', 'meta.id'), ('ivoa', 'src')],\n    'phot.flux;em.radio;arith.ratio':\n        [('ivoa', 'phot.flux'), ('ivoa', 'em.radio'), ('ivoa', 'arith.ratio')],\n    'PHot.Flux;EM.Radio;ivoa:arith.Ratio':\n        [('ivoa', 'phot.flux'), ('ivoa', 'em.radio'), ('ivoa', 'arith.ratio')],\n    'pos.galactic.lat':\n        [('ivoa', 'pos.galactic.lat')],\n    'meta.code;phot.mag':\n        [('ivoa', 'meta.code'), ('ivoa', 'phot.mag')],\n    'stat.error;phot.mag':\n        [('ivoa', 'stat.error'), ('ivoa', 'phot.mag')],\n    'phys.temperature;instr;stat.max':\n        [('ivoa', 'phys.temperature'), ('ivoa', 'instr'),\n         ('ivoa', 'stat.max')],\n    'stat.error;phot.mag;em.opt.V':\n        [('ivoa', 'stat.error'), ('ivoa', 'phot.mag'), ('ivoa', 'em.opt.V')],\n    'phot.color;em.opt.B;em.opt.V':\n        [('ivoa', 'phot.color'), ('ivoa', 'em.opt.B'), ('ivoa', 'em.opt.V')],\n    'stat.error;phot.color;em.opt.B;em.opt.V':\n        [('ivoa', 'stat.error'), ('ivoa', 'phot.color'), ('ivoa', 'em.opt.B'),\n         ('ivoa', 'em.opt.V')],\n}"},{"fileName":"__init__.py","filePath":"astropy/io/votable/tests","id":6258,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n"},{"fileName":"converter_test.py","filePath":"astropy/io/votable/tests","id":6259,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport io\n\n# THIRD-PARTY\nimport numpy as np\nfrom numpy.testing import assert_array_equal\nimport pytest\n\n# LOCAL\nfrom astropy.io.votable import converters\nfrom astropy.io.votable import exceptions\nfrom astropy.io.votable import tree\n\nfrom astropy.io.votable.table import parse_single_table\nfrom astropy.utils.data import get_pkg_data_filename\n\n\ndef test_invalid_arraysize():\n    with pytest.raises(exceptions.E13):\n        field = tree.Field(\n            None, name='broken', datatype='char', arraysize='foo')\n        converters.get_converter(field)\n\n\ndef test_oversize_char():\n    config = {'verify': 'exception'}\n    with pytest.warns(exceptions.W47) as w:\n        field = tree.Field(\n            None, name='c', datatype='char',\n            config=config)\n        c = converters.get_converter(field, config=config)\n    assert len(w) == 1\n\n    with pytest.warns(exceptions.W46) as w:\n        c.parse(\"XXX\")\n    assert len(w) == 1\n\n\ndef test_char_mask():\n    config = {'verify': 'exception'}\n    field = tree.Field(None, name='c', arraysize='1', datatype='char',\n                       config=config)\n    c = converters.get_converter(field, config=config)\n    assert c.output(\"Foo\", True) == ''\n\n\ndef test_oversize_unicode():\n    config = {'verify': 'exception'}\n    with pytest.warns(exceptions.W46) as w:\n        field = tree.Field(\n            None, name='c2', datatype='unicodeChar',\n            arraysize='1', config=config)\n        c = converters.get_converter(field, config=config)\n        c.parse(\"XXX\")\n    assert len(w) == 1\n\n\ndef test_unicode_mask():\n    config = {'verify': 'exception'}\n    field = tree.Field(None, name='c', arraysize='1', datatype='unicodeChar',\n                       config=config)\n    c = converters.get_converter(field, config=config)\n    assert c.output(\"Foo\", True) == ''\n\n\ndef test_unicode_as_char():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='unicode_in_char', datatype='char',\n        arraysize='*', config=config)\n    c = converters.get_converter(field, config=config)\n\n    # Test parsing.\n    c.parse('XYZ')  # ASCII succeeds\n    with pytest.warns(\n            exceptions.W55,\n            match=r'FIELD \\(unicode_in_char\\) has datatype=\"char\" but contains non-ASCII value'):\n        c.parse(\"zła\")  # non-ASCII\n\n    # Test output.\n    c.output('XYZ', False)  # ASCII str succeeds\n    c.output(b'XYZ', False)  # ASCII bytes succeeds\n    value = 'zła'\n    value_bytes = value.encode('utf-8')\n    with pytest.warns(\n            exceptions.E24,\n            match=r'E24: Attempt to write non-ASCII value'):\n        c.output(value, False)  # non-ASCII str raises\n    with pytest.warns(\n            exceptions.E24,\n            match=r'E24: Attempt to write non-ASCII value'):\n        c.output(value_bytes, False)  # non-ASCII bytes raises\n\n\ndef test_unicode_as_char_binary():\n    config = {'verify': 'exception'}\n\n    field = tree.Field(\n        None, name='unicode_in_char', datatype='char',\n        arraysize='*', config=config)\n    c = converters.get_converter(field, config=config)\n    c._binoutput_var('abc', False)  # ASCII succeeds\n    with pytest.raises(exceptions.E24, match=r\"E24: Attempt to write non-ASCII value\"):\n        c._binoutput_var('zła', False)\n\n    field = tree.Field(\n        None, name='unicode_in_char', datatype='char',\n        arraysize='3', config=config)\n    c = converters.get_converter(field, config=config)\n    c._binoutput_fixed('xyz', False)\n    with pytest.raises(exceptions.E24, match=r\"E24: Attempt to write non-ASCII value\"):\n        c._binoutput_fixed('zła', False)\n\n\ndef test_wrong_number_of_elements():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='int', arraysize='2x3*',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    with pytest.raises(exceptions.E02):\n        c.parse(\"2 3 4 5 6\")\n\n\ndef test_float_mask():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='float',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    assert c.parse('') == (c.null, True)\n    with pytest.raises(ValueError):\n        c.parse('null')\n\n\ndef test_float_mask_permissive():\n    config = {'verify': 'ignore'}\n    field = tree.Field(\n        None, name='c', datatype='float',\n        config=config)\n\n    # config needs to be also passed into parse() to work.\n    # https://github.com/astropy/astropy/issues/8775\n    c = converters.get_converter(field, config=config)\n    assert c.parse('null', config=config) == (c.null, True)\n\n\ndef test_double_array():\n    config = {'verify': 'exception', 'version_1_3_or_later': True}\n    field = tree.Field(None, name='c', datatype='double', arraysize='3',\n                       config=config)\n    data = (1.0, 2.0, 3.0)\n    c = converters.get_converter(field, config=config)\n    assert c.output(1.0, False) == '1'\n    assert c.output(1.0, [False, False]) == '1'\n    assert c.output(data, False) == '1 2 3'\n    assert c.output(data, [False, False, False]) == '1 2 3'\n    assert c.output(data, [False, False, True]) == '1 2 NaN'\n    assert c.output(data, [False, False]) == '1 2'\n\n    a = c.parse(\"1 2 3\", config=config)\n    assert_array_equal(a[0], data)\n    assert_array_equal(a[1], False)\n\n    with pytest.raises(exceptions.E02):\n        c.parse(\"1\", config=config)\n\n    with pytest.raises(AttributeError), pytest.warns(exceptions.E02):\n        c.parse(\"1\")\n\n    with pytest.raises(exceptions.E02):\n        c.parse(\"2 3 4 5 6\", config=config)\n\n    with pytest.warns(exceptions.E02):\n        a = c.parse(\"2 3 4 5 6\")\n\n    assert_array_equal(a[0], [2, 3, 4])\n    assert_array_equal(a[1], False)\n\n\ndef test_complex_array_vararray():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='floatComplex', arraysize='2x3*',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    with pytest.raises(exceptions.E02):\n        c.parse(\"2 3 4 5 6\")\n\n\ndef test_complex_array_vararray2():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='floatComplex', arraysize='2x3*',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    x = c.parse(\"\")\n    assert len(x[0]) == 0\n\n\ndef test_complex_array_vararray3():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='doubleComplex', arraysize='2x3*',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    x = c.parse(\"1 2 3 4 5 6 7 8 9 10 11 12\")\n    assert len(x) == 2\n    assert np.all(x[0][0][0] == complex(1, 2))\n\n\ndef test_complex_vararray():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='doubleComplex', arraysize='*',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    x = c.parse(\"1 2 3 4\")\n    assert len(x) == 2\n    assert x[0][0] == complex(1, 2)\n\n\ndef test_complex():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='doubleComplex',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    with pytest.raises(exceptions.E03):\n        c.parse(\"1 2 3\")\n\n\ndef test_bit():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='bit',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    with pytest.raises(exceptions.E04):\n        c.parse(\"T\")\n\n\ndef test_bit_mask():\n    config = {'verify': 'exception'}\n    with pytest.warns(exceptions.W39) as w:\n        field = tree.Field(\n            None, name='c', datatype='bit',\n            config=config)\n        c = converters.get_converter(field, config=config)\n        c.output(True, True)\n    assert len(w) == 1\n\n\ndef test_boolean():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='boolean',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    with pytest.raises(exceptions.E05):\n        c.parse('YES')\n\n\ndef test_boolean_array():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='boolean', arraysize='*',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    r, mask = c.parse('TRUE FALSE T F 0 1')\n    assert_array_equal(r, [True, False, True, False, False, True])\n\n\ndef test_invalid_type():\n    config = {'verify': 'exception'}\n    with pytest.raises(exceptions.E06):\n        field = tree.Field(\n            None, name='c', datatype='foobar',\n            config=config)\n        converters.get_converter(field, config=config)\n\n\ndef test_precision():\n    config = {'verify': 'exception'}\n\n    field = tree.Field(\n        None, name='c', datatype='float', precision=\"E4\",\n        config=config)\n    c = converters.get_converter(field, config=config)\n    assert c.output(266.248, False) == '266.2'\n\n    field = tree.Field(\n        None, name='c', datatype='float', precision=\"F4\",\n        config=config)\n    c = converters.get_converter(field, config=config)\n    assert c.output(266.248, False) == '266.2480'\n\n\ndef test_integer_overflow():\n    config = {'verify': 'exception'}\n\n    field = tree.Field(\n        None, name='c', datatype='int', config=config)\n    c = converters.get_converter(field, config=config)\n    with pytest.raises(exceptions.W51):\n        c.parse('-2208988800', config=config)\n\n\ndef test_float_default_precision():\n    config = {'verify': 'exception'}\n\n    field = tree.Field(\n        None, name='c', datatype='float', arraysize=\"4\",\n        config=config)\n    c = converters.get_converter(field, config=config)\n    assert (c.output([1, 2, 3, 8.9990234375], [False, False, False, False]) ==\n            '1 2 3 8.9990234375')\n\n\ndef test_vararray():\n    votable = tree.VOTableFile()\n    resource = tree.Resource()\n    votable.resources.append(resource)\n    table = tree.Table(votable)\n    resource.tables.append(table)\n\n    tabarr = []\n    heads = ['headA', 'headB', 'headC']\n    types = [\"char\", \"double\", \"int\"]\n\n    vals = [[\"A\", 1.0, 2],\n            [\"B\", 2.0, 3],\n            [\"C\", 3.0, 4]]\n    for i in range(len(heads)):\n        tabarr.append(tree.Field(\n            votable, name=heads[i], datatype=types[i], arraysize=\"*\"))\n\n    table.fields.extend(tabarr)\n    table.create_arrays(len(vals))\n    for i in range(len(vals)):\n        values = tuple(vals[i])\n        table.array[i] = values\n    buff = io.BytesIO()\n    votable.to_xml(buff)\n\n\ndef test_gemini_v1_2():\n    '''\n    see Pull Request 4782 or Issue 4781 for details\n    '''\n    table = parse_single_table(get_pkg_data_filename('data/gemini.xml'))\n    assert table is not None\n\n    tt = table.to_table()\n    assert tt['access_url'][0] == (\n        'http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/data/pub/GEMINI/'\n        'S20120515S0064?runid=bx9b1o8cvk1qesrt')\n"},{"col":4,"comment":"null","endLoc":199,"header":"def test_implicit_id(self)","id":6260,"name":"test_implicit_id","nodeType":"Function","startLoc":197,"text":"def test_implicit_id(self):\n        assert_array_equal(self.array['string_test_2'],\n                           self.array['fixed string test'])"},{"attributeType":"null","col":8,"comment":"null","endLoc":194,"id":6261,"name":"array","nodeType":"Attribute","startLoc":194,"text":"self.array"},{"col":4,"comment":"null","endLoc":1282,"header":"def _setup(self, config, pos)","id":6262,"name":"_setup","nodeType":"Function","startLoc":1279,"text":"def _setup(self, config, pos):\n        if self.values._ref is not None:\n            self.values.ref = self.values._ref\n        self.converter = converters.get_converter(self, config, pos)"},{"col":4,"comment":"null","endLoc":485,"header":"@staticmethod\n    def _splitter_lax(value, config=None, pos=None)","id":6263,"name":"_splitter_lax","nodeType":"Function","startLoc":481,"text":"@staticmethod\n    def _splitter_lax(value, config=None, pos=None):\n        if ',' in value:\n            vo_warn(W01, (), config, pos)\n        return array_splitter.split(value)"},{"attributeType":"null","col":8,"comment":"null","endLoc":192,"id":6264,"name":"table","nodeType":"Attribute","startLoc":192,"text":"self.table"},{"attributeType":"null","col":8,"comment":"null","endLoc":195,"id":6265,"name":"mask","nodeType":"Attribute","startLoc":195,"text":"self.mask"},{"attributeType":"function","col":12,"comment":"null","endLoc":472,"id":6266,"name":"_splitter","nodeType":"Attribute","startLoc":472,"text":"self._splitter"},{"className":"TestReferences","col":0,"comment":"null","endLoc":238,"id":6267,"nodeType":"Class","startLoc":202,"text":"class TestReferences:\n    def setup_class(self):\n        self.votable = parse(get_pkg_data_filename('data/regression.xml'))\n        self.table = self.votable.get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask\n\n    def test_fieldref(self):\n        fieldref = self.table.groups[1].entries[0]\n        assert isinstance(fieldref, tree.FieldRef)\n        assert fieldref.get_ref().name == 'boolean'\n        assert fieldref.get_ref().datatype == 'boolean'\n\n    def test_paramref(self):\n        paramref = self.table.groups[0].entries[0]\n        assert isinstance(paramref, tree.ParamRef)\n        assert paramref.get_ref().name == 'INPUT'\n        assert paramref.get_ref().datatype == 'float'\n\n    def test_iter_fields_and_params_on_a_group(self):\n        assert len(list(self.table.groups[1].iter_fields_and_params())) == 2\n\n    def test_iter_groups_on_a_group(self):\n        assert len(list(self.table.groups[1].iter_groups())) == 1\n\n    def test_iter_groups(self):\n        # Because of the ref'd table, there are more logical groups\n        # than actually exist in the file\n        assert len(list(self.votable.iter_groups())) == 9\n\n    def test_ref_table(self):\n        tables = list(self.votable.iter_tables())\n        for x, y in zip(tables[0].array.data[0], tables[1].array.data[0]):\n            assert_array_equal(x, y)\n\n    def test_iter_coosys(self):\n        assert len(list(self.votable.iter_coosys())) == 1"},{"col":4,"comment":"null","endLoc":207,"header":"def setup_class(self)","id":6268,"name":"setup_class","nodeType":"Function","startLoc":203,"text":"def setup_class(self):\n        self.votable = parse(get_pkg_data_filename('data/regression.xml'))\n        self.table = self.votable.get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask"},{"col":4,"comment":"null","endLoc":3494,"header":"def _add_resource(self, iterator, tag, data, config, pos)","id":6269,"name":"_add_resource","nodeType":"Function","startLoc":3491,"text":"def _add_resource(self, iterator, tag, data, config, pos):\n        resource = Resource(config=config, pos=pos, **data)\n        self.resources.append(resource)\n        resource.parse(self, iterator, config)"},{"col":0,"comment":"null","endLoc":23,"header":"def test_invalid_arraysize()","id":6270,"name":"test_invalid_arraysize","nodeType":"Function","startLoc":19,"text":"def test_invalid_arraysize():\n    with pytest.raises(exceptions.E13):\n        field = tree.Field(\n            None, name='broken', datatype='char', arraysize='foo')\n        converters.get_converter(field)"},{"className":"VarArray","col":0,"comment":"\n    Handles variable lengths arrays (i.e. where *arraysize* is '*').\n    ","endLoc":527,"id":6271,"nodeType":"Class","startLoc":488,"text":"class VarArray(Array):\n    \"\"\"\n    Handles variable lengths arrays (i.e. where *arraysize* is '*').\n    \"\"\"\n    format = 'O'\n\n    def __init__(self, field, base, arraysize, config=None, pos=None):\n        Array.__init__(self, field, config)\n\n        self._base = base\n        self.default = np.array([], dtype=self._base.format)\n\n    def output(self, value, mask):\n        output = self._base.output\n        result = [output(x, m) for x, m in np.broadcast(value, mask)]\n        return ' '.join(result)\n\n    def binparse(self, read):\n        length = self._parse_length(read)\n\n        result = []\n        result_mask = []\n        binparse = self._base.binparse\n        for i in range(length):\n            val, mask = binparse(read)\n            result.append(val)\n            result_mask.append(mask)\n\n        return _make_masked_array(result, result_mask), False\n\n    def binoutput(self, value, mask):\n        if value is None or len(value) == 0:\n            return _zero_int\n\n        length = len(value)\n        result = [self._write_length(length)]\n        binoutput = self._base.binoutput\n        for x, m in zip(value, value.mask):\n            result.append(binoutput(x, m))\n        return _empty_bytes.join(result)"},{"col":4,"comment":"null","endLoc":498,"header":"def __init__(self, field, base, arraysize, config=None, pos=None)","id":6272,"name":"__init__","nodeType":"Function","startLoc":494,"text":"def __init__(self, field, base, arraysize, config=None, pos=None):\n        Array.__init__(self, field, config)\n\n        self._base = base\n        self.default = np.array([], dtype=self._base.format)"},{"col":4,"comment":"null","endLoc":503,"header":"def output(self, value, mask)","id":6273,"name":"output","nodeType":"Function","startLoc":500,"text":"def output(self, value, mask):\n        output = self._base.output\n        result = [output(x, m) for x, m in np.broadcast(value, mask)]\n        return ' '.join(result)"},{"col":4,"comment":"null","endLoc":516,"header":"def binparse(self, read)","id":6274,"name":"binparse","nodeType":"Function","startLoc":505,"text":"def binparse(self, read):\n        length = self._parse_length(read)\n\n        result = []\n        result_mask = []\n        binparse = self._base.binparse\n        for i in range(length):\n            val, mask = binparse(read)\n            result.append(val)\n            result_mask.append(mask)\n\n        return _make_masked_array(result, result_mask), False"},{"attributeType":"null","col":8,"comment":"null","endLoc":550,"id":6275,"name":"_pos","nodeType":"Attribute","startLoc":550,"text":"self._pos"},{"col":0,"comment":"\n    Masked arrays of zero length that also have a mask of zero length\n    cause problems in Numpy (at least in 1.6.2).  This function\n    creates a masked array from data and a mask, unless it is zero\n    length.\n    ","endLoc":73,"header":"def _make_masked_array(data, mask)","id":6276,"name":"_make_masked_array","nodeType":"Function","startLoc":60,"text":"def _make_masked_array(data, mask):\n    \"\"\"\n    Masked arrays of zero length that also have a mask of zero length\n    cause problems in Numpy (at least in 1.6.2).  This function\n    creates a masked array from data and a mask, unless it is zero\n    length.\n    \"\"\"\n    # np.ma doesn't like setting mask to []\n    if len(data):\n        return ma.array(\n            np.array(data),\n            mask=np.array(mask, dtype='bool'))\n    else:\n        return ma.array(np.array(data))"},{"attributeType":"null","col":8,"comment":"null","endLoc":566,"id":6277,"name":"action","nodeType":"Attribute","startLoc":566,"text":"self.action"},{"col":4,"comment":"null","endLoc":527,"header":"def binoutput(self, value, mask)","id":6278,"name":"binoutput","nodeType":"Function","startLoc":518,"text":"def binoutput(self, value, mask):\n        if value is None or len(value) == 0:\n            return _zero_int\n\n        length = len(value)\n        result = [self._write_length(length)]\n        binoutput = self._base.binoutput\n        for x, m in zip(value, value.mask):\n            result.append(binoutput(x, m))\n        return _empty_bytes.join(result)"},{"attributeType":"null","col":8,"comment":"null","endLoc":560,"id":6279,"name":"ID","nodeType":"Attribute","startLoc":560,"text":"self.ID"},{"attributeType":"null","col":8,"comment":"null","endLoc":565,"id":6280,"name":"href","nodeType":"Attribute","startLoc":565,"text":"self.href"},{"attributeType":"null","col":8,"comment":"null","endLoc":603,"id":6281,"name":"_content_type","nodeType":"Attribute","startLoc":603,"text":"self._content_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":492,"id":6282,"name":"format","nodeType":"Attribute","startLoc":492,"text":"format"},{"attributeType":"null","col":8,"comment":"null","endLoc":498,"id":6283,"name":"default","nodeType":"Attribute","startLoc":498,"text":"self.default"},{"attributeType":"null","col":8,"comment":"null","endLoc":497,"id":6284,"name":"_base","nodeType":"Attribute","startLoc":497,"text":"self._base"},{"className":"ArrayVarArray","col":0,"comment":"\n    Handles an array of variable-length arrays, i.e. where *arraysize*\n    ends in '*'.\n    ","endLoc":552,"id":6285,"nodeType":"Class","startLoc":530,"text":"class ArrayVarArray(VarArray):\n    \"\"\"\n    Handles an array of variable-length arrays, i.e. where *arraysize*\n    ends in '*'.\n    \"\"\"\n\n    def parse(self, value, config=None, pos=None):\n        if value.strip() == '':\n            return ma.array([]), False\n\n        parts = self._splitter(value, config, pos)\n        items = self._base._items\n        parse_parts = self._base.parse_parts\n        if len(parts) % items != 0:\n            vo_raise(E02, (items, len(parts)), config, pos)\n        result = []\n        result_mask = []\n        for i in range(0, len(parts), items):\n            value, mask = parse_parts(parts[i:i+items], config, pos)\n            result.append(value)\n            result_mask.append(mask)\n\n        return _make_masked_array(result, result_mask), False"},{"col":4,"comment":"null","endLoc":552,"header":"def parse(self, value, config=None, pos=None)","id":6286,"name":"parse","nodeType":"Function","startLoc":536,"text":"def parse(self, value, config=None, pos=None):\n        if value.strip() == '':\n            return ma.array([]), False\n\n        parts = self._splitter(value, config, pos)\n        items = self._base._items\n        parse_parts = self._base.parse_parts\n        if len(parts) % items != 0:\n            vo_raise(E02, (items, len(parts)), config, pos)\n        result = []\n        result_mask = []\n        for i in range(0, len(parts), items):\n            value, mask = parse_parts(parts[i:i+items], config, pos)\n            result.append(value)\n            result_mask.append(mask)\n\n        return _make_masked_array(result, result_mask), False"},{"col":0,"comment":"null","endLoc":37,"header":"def test_oversize_char()","id":6287,"name":"test_oversize_char","nodeType":"Function","startLoc":26,"text":"def test_oversize_char():\n    config = {'verify': 'exception'}\n    with pytest.warns(exceptions.W47) as w:\n        field = tree.Field(\n            None, name='c', datatype='char',\n            config=config)\n        c = converters.get_converter(field, config=config)\n    assert len(w) == 1\n\n    with pytest.warns(exceptions.W46) as w:\n        c.parse(\"XXX\")\n    assert len(w) == 1"},{"attributeType":"null","col":8,"comment":"null","endLoc":563,"id":6288,"name":"title","nodeType":"Attribute","startLoc":563,"text":"self.title"},{"attributeType":"null","col":8,"comment":"null","endLoc":564,"id":6289,"name":"value","nodeType":"Attribute","startLoc":564,"text":"self.value"},{"attributeType":"null","col":8,"comment":"null","endLoc":549,"id":6290,"name":"_config","nodeType":"Attribute","startLoc":549,"text":"self._config"},{"attributeType":"null","col":8,"comment":"null","endLoc":561,"id":6291,"name":"content_role","nodeType":"Attribute","startLoc":561,"text":"self.content_role"},{"className":"Info","col":0,"comment":"\n    INFO_ elements: arbitrary key-value pairs for extensions to the standard.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    ","endLoc":809,"id":6292,"nodeType":"Class","startLoc":641,"text":"class Info(SimpleElementWithContent, _IDProperty, _XtypeProperty,\n           _UtypeProperty):\n    \"\"\"\n    INFO_ elements: arbitrary key-value pairs for extensions to the standard.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    \"\"\"\n    _element_name = 'INFO'\n    _attr_list_11 = ['ID', 'name', 'value']\n    _attr_list_12 = _attr_list_11 + ['xtype', 'ref', 'unit', 'ucd', 'utype']\n    _utype_in_v1_2 = True\n\n    def __init__(self, ID=None, name=None, value=None, id=None, xtype=None,\n                 ref=None, unit=None, ucd=None, utype=None,\n                 config=None, pos=None, **extra):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        SimpleElementWithContent.__init__(self)\n\n        self.ID = (resolve_id(ID, id, config, pos) or\n                        xmlutil.fix_id(name, config, pos))\n        self.name = name\n        self.value = value\n        self.xtype = xtype\n        self.ref = ref\n        self.unit = unit\n        self.ucd = ucd\n        self.utype = utype\n\n        if config.get('version_1_2_or_later'):\n            self._attr_list = self._attr_list_12\n        else:\n            self._attr_list = self._attr_list_11\n            if xtype is not None:\n                warn_unknown_attrs('INFO', ['xtype'], config, pos)\n            if ref is not None:\n                warn_unknown_attrs('INFO', ['ref'], config, pos)\n            if unit is not None:\n                warn_unknown_attrs('INFO', ['unit'], config, pos)\n            if ucd is not None:\n                warn_unknown_attrs('INFO', ['ucd'], config, pos)\n            if utype is not None:\n                warn_unknown_attrs('INFO', ['utype'], config, pos)\n\n        warn_unknown_attrs('INFO', extra.keys(), config, pos)\n\n    @property\n    def name(self):\n        \"\"\"[*required*] The key of the key-value pair.\"\"\"\n        return self._name\n\n    @name.setter\n    def name(self, name):\n        if name is None:\n            warn_or_raise(W35, W35, ('name'), self._config, self._pos)\n        xmlutil.check_token(name, 'name', self._config, self._pos)\n        self._name = name\n\n    @property\n    def value(self):\n        \"\"\"\n        [*required*] The value of the key-value pair.  (Always stored\n        as a string or unicode string).\n        \"\"\"\n        return self._value\n\n    @value.setter\n    def value(self, value):\n        if value is None:\n            warn_or_raise(W35, W35, ('value'), self._config, self._pos)\n        check_string(value, 'value', self._config, self._pos)\n        self._value = value\n\n    @property\n    def content(self):\n        \"\"\"The content inside the INFO element.\"\"\"\n        return self._content\n\n    @content.setter\n    def content(self, content):\n        check_string(content, 'content', self._config, self._pos)\n        self._content = content\n\n    @content.deleter\n    def content(self):\n        self._content = None\n\n    @property\n    def ref(self):\n        \"\"\"\n        Refer to another INFO_ element by ID_, defined previously in\n        the document.\n        \"\"\"\n        return self._ref\n\n    @ref.setter\n    def ref(self, ref):\n        if ref is not None and not self._config.get('version_1_2_or_later'):\n            warn_or_raise(W28, W28, ('ref', 'INFO', '1.2'),\n                          self._config, self._pos)\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        # TODO: actually apply the reference\n        # if ref is not None:\n        #     try:\n        #         other = self._votable.get_values_by_id(ref, before=self)\n        #     except KeyError:\n        #         vo_raise(\n        #             \"VALUES ref='%s', which has not already been defined.\" %\n        #             self.ref, self._config, self._pos, KeyError)\n        #     self.null = other.null\n        #     self.type = other.type\n        #     self.min = other.min\n        #     self.min_inclusive = other.min_inclusive\n        #     self.max = other.max\n        #     self.max_inclusive = other.max_inclusive\n        #     self._options[:] = other.options\n        self._ref = ref\n\n    @ref.deleter\n    def ref(self):\n        self._ref = None\n\n    @property\n    def unit(self):\n        \"\"\"A string specifying the units_ for the INFO_.\"\"\"\n        return self._unit\n\n    @unit.setter\n    def unit(self, unit):\n        if unit is None:\n            self._unit = None\n            return\n\n        from astropy import units as u\n\n        if not self._config.get('version_1_2_or_later'):\n            warn_or_raise(W28, W28, ('unit', 'INFO', '1.2'),\n                          self._config, self._pos)\n\n        # First, parse the unit in the default way, so that we can\n        # still emit a warning if the unit is not to spec.\n        default_format = _get_default_unit_format(self._config)\n        unit_obj = u.Unit(\n            unit, format=default_format, parse_strict='silent')\n        if isinstance(unit_obj, u.UnrecognizedUnit):\n            warn_or_raise(W50, W50, (unit,),\n                          self._config, self._pos)\n\n        format = _get_unit_format(self._config)\n        if format != default_format:\n            unit_obj = u.Unit(\n                unit, format=format, parse_strict='silent')\n\n        self._unit = unit_obj\n\n    @unit.deleter\n    def unit(self):\n        self._unit = None\n\n    def to_xml(self, w, **kwargs):\n        attrib = w.object_attrs(self, self._attr_list)\n        if 'unit' in attrib:\n            attrib['unit'] = self.unit.to_string('cds')\n        w.element(self._element_name, self._content,\n                  attrib=attrib)"},{"col":4,"comment":"null","endLoc":689,"header":"def __init__(self, ID=None, name=None, value=None, id=None, xtype=None,\n                 ref=None, unit=None, ucd=None, utype=None,\n                 config=None, pos=None, **extra)","id":6293,"name":"__init__","nodeType":"Function","startLoc":654,"text":"def __init__(self, ID=None, name=None, value=None, id=None, xtype=None,\n                 ref=None, unit=None, ucd=None, utype=None,\n                 config=None, pos=None, **extra):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        SimpleElementWithContent.__init__(self)\n\n        self.ID = (resolve_id(ID, id, config, pos) or\n                        xmlutil.fix_id(name, config, pos))\n        self.name = name\n        self.value = value\n        self.xtype = xtype\n        self.ref = ref\n        self.unit = unit\n        self.ucd = ucd\n        self.utype = utype\n\n        if config.get('version_1_2_or_later'):\n            self._attr_list = self._attr_list_12\n        else:\n            self._attr_list = self._attr_list_11\n            if xtype is not None:\n                warn_unknown_attrs('INFO', ['xtype'], config, pos)\n            if ref is not None:\n                warn_unknown_attrs('INFO', ['ref'], config, pos)\n            if unit is not None:\n                warn_unknown_attrs('INFO', ['unit'], config, pos)\n            if ucd is not None:\n                warn_unknown_attrs('INFO', ['ucd'], config, pos)\n            if utype is not None:\n                warn_unknown_attrs('INFO', ['utype'], config, pos)\n\n        warn_unknown_attrs('INFO', extra.keys(), config, pos)"},{"className":"ScalarVarArray","col":0,"comment":"\n    Handles a variable-length array of numeric scalars.\n    ","endLoc":574,"id":6294,"nodeType":"Class","startLoc":555,"text":"class ScalarVarArray(VarArray):\n    \"\"\"\n    Handles a variable-length array of numeric scalars.\n    \"\"\"\n\n    def parse(self, value, config=None, pos=None):\n        if value.strip() == '':\n            return ma.array([]), False\n\n        parts = self._splitter(value, config, pos)\n\n        parse = self._base.parse\n        result = []\n        result_mask = []\n        for x in parts:\n            value, mask = parse(x, config, pos)\n            result.append(value)\n            result_mask.append(mask)\n\n        return _make_masked_array(result, result_mask), False"},{"col":4,"comment":"null","endLoc":574,"header":"def parse(self, value, config=None, pos=None)","id":6295,"name":"parse","nodeType":"Function","startLoc":560,"text":"def parse(self, value, config=None, pos=None):\n        if value.strip() == '':\n            return ma.array([]), False\n\n        parts = self._splitter(value, config, pos)\n\n        parse = self._base.parse\n        result = []\n        result_mask = []\n        for x in parts:\n            value, mask = parse(x, config, pos)\n            result.append(value)\n            result_mask.append(mask)\n\n        return _make_masked_array(result, result_mask), False"},{"col":0,"comment":"null","endLoc":45,"header":"def test_char_mask()","id":6296,"name":"test_char_mask","nodeType":"Function","startLoc":40,"text":"def test_char_mask():\n    config = {'verify': 'exception'}\n    field = tree.Field(None, name='c', arraysize='1', datatype='char',\n                       config=config)\n    c = converters.get_converter(field, config=config)\n    assert c.output(\"Foo\", True) == ''"},{"className":"NumericArray","col":0,"comment":"\n    Handles a fixed-length array of numeric scalars.\n    ","endLoc":654,"id":6297,"nodeType":"Class","startLoc":577,"text":"class NumericArray(Array):\n    \"\"\"\n    Handles a fixed-length array of numeric scalars.\n    \"\"\"\n    vararray_type = ArrayVarArray\n\n    def __init__(self, field, base, arraysize, config=None, pos=None):\n        Array.__init__(self, field, config, pos)\n\n        self._base = base\n        self._arraysize = arraysize\n        self.format = f\"{tuple(arraysize)}{base.format}\"\n\n        self._items = 1\n        for dim in arraysize:\n            self._items *= dim\n\n        self._memsize = np.dtype(self.format).itemsize\n        self._bigendian_format = '>' + self.format\n\n        self.default = np.empty(arraysize, dtype=self._base.format)\n        self.default[...] = self._base.default\n\n    def parse(self, value, config=None, pos=None):\n        if config is None:\n            config = {}\n        elif config['version_1_3_or_later'] and value == '':\n            return np.zeros(self._arraysize, dtype=self._base.format), True\n        parts = self._splitter(value, config, pos)\n        if len(parts) != self._items:\n            warn_or_raise(E02, E02, (self._items, len(parts)), config, pos)\n        if config.get('verify', 'ignore') == 'exception':\n            return self.parse_parts(parts, config, pos)\n        else:\n            if len(parts) == self._items:\n                pass\n            elif len(parts) > self._items:\n                parts = parts[:self._items]\n            else:\n                parts = (parts +\n                         ([self._base.default] * (self._items - len(parts))))\n            return self.parse_parts(parts, config, pos)\n\n    def parse_parts(self, parts, config=None, pos=None):\n        base_parse = self._base.parse\n        result = []\n        result_mask = []\n        for x in parts:\n            value, mask = base_parse(x, config, pos)\n            result.append(value)\n            result_mask.append(mask)\n        result = np.array(result, dtype=self._base.format).reshape(\n            self._arraysize)\n        result_mask = np.array(result_mask, dtype='bool').reshape(\n            self._arraysize)\n        return result, result_mask\n\n    def output(self, value, mask):\n        base_output = self._base.output\n        value = np.asarray(value)\n        mask = np.asarray(mask)\n        if mask.size <= 1:\n            func = np.broadcast\n        else:  # When mask is already array but value is scalar, this prevents broadcast\n            func = zip\n        return ' '.join(base_output(x, m) for x, m in\n                        func(value.flat, mask.flat))\n\n    def binparse(self, read):\n        result = np.frombuffer(read(self._memsize),\n                               dtype=self._bigendian_format)[0]\n        result_mask = self._base.is_null(result)\n        return result, result_mask\n\n    def binoutput(self, value, mask):\n        filtered = self._base.filter_array(value, mask)\n        filtered = _ensure_bigendian(filtered)\n        return filtered.tobytes()"},{"col":4,"comment":"null","endLoc":598,"header":"def __init__(self, field, base, arraysize, config=None, pos=None)","id":6298,"name":"__init__","nodeType":"Function","startLoc":583,"text":"def __init__(self, field, base, arraysize, config=None, pos=None):\n        Array.__init__(self, field, config, pos)\n\n        self._base = base\n        self._arraysize = arraysize\n        self.format = f\"{tuple(arraysize)}{base.format}\"\n\n        self._items = 1\n        for dim in arraysize:\n            self._items *= dim\n\n        self._memsize = np.dtype(self.format).itemsize\n        self._bigendian_format = '>' + self.format\n\n        self.default = np.empty(arraysize, dtype=self._base.format)\n        self.default[...] = self._base.default"},{"col":4,"comment":"null","endLoc":618,"header":"def parse(self, value, config=None, pos=None)","id":6299,"name":"parse","nodeType":"Function","startLoc":600,"text":"def parse(self, value, config=None, pos=None):\n        if config is None:\n            config = {}\n        elif config['version_1_3_or_later'] and value == '':\n            return np.zeros(self._arraysize, dtype=self._base.format), True\n        parts = self._splitter(value, config, pos)\n        if len(parts) != self._items:\n            warn_or_raise(E02, E02, (self._items, len(parts)), config, pos)\n        if config.get('verify', 'ignore') == 'exception':\n            return self.parse_parts(parts, config, pos)\n        else:\n            if len(parts) == self._items:\n                pass\n            elif len(parts) > self._items:\n                parts = parts[:self._items]\n            else:\n                parts = (parts +\n                         ([self._base.default] * (self._items - len(parts))))\n            return self.parse_parts(parts, config, pos)"},{"col":0,"comment":"null","endLoc":56,"header":"def test_oversize_unicode()","id":6300,"name":"test_oversize_unicode","nodeType":"Function","startLoc":48,"text":"def test_oversize_unicode():\n    config = {'verify': 'exception'}\n    with pytest.warns(exceptions.W46) as w:\n        field = tree.Field(\n            None, name='c2', datatype='unicodeChar',\n            arraysize='1', config=config)\n        c = converters.get_converter(field, config=config)\n        c.parse(\"XXX\")\n    assert len(w) == 1"},{"col":4,"comment":"null","endLoc":213,"header":"def test_fieldref(self)","id":6301,"name":"test_fieldref","nodeType":"Function","startLoc":209,"text":"def test_fieldref(self):\n        fieldref = self.table.groups[1].entries[0]\n        assert isinstance(fieldref, tree.FieldRef)\n        assert fieldref.get_ref().name == 'boolean'\n        assert fieldref.get_ref().datatype == 'boolean'"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":6302,"name":"__all__","nodeType":"Attribute","startLoc":22,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":6303,"name":"VERIFY_OPTIONS","nodeType":"Attribute","startLoc":25,"text":"VERIFY_OPTIONS"},{"col":0,"comment":"","endLoc":6,"header":"table.py#<anonymous>","id":6304,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis file contains a contains the high-level functions to read a\nVOTable file.\n\"\"\"\n\n__all__ = ['parse', 'parse_single_table', 'from_table', 'writeto', 'validate',\n           'reset_vo_warnings']\n\nVERIFY_OPTIONS = ['ignore', 'warn', 'exception']"},{"fileName":"table_test.py","filePath":"astropy/io/votable/tests","id":6305,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nTest the conversion to/from astropy.table\n\"\"\"\nimport io\nimport os\n\nimport pathlib\nimport pytest\nimport numpy as np\n\nfrom astropy.config import set_temp_config, reload_config\nfrom astropy.utils.data import get_pkg_data_filename, get_pkg_data_fileobj\nfrom astropy.io.votable.table import parse, writeto\nfrom astropy.io.votable import tree, conf, validate\nfrom astropy.io.votable.exceptions import VOWarning, W39, E25\nfrom astropy.table import Column, Table\nfrom astropy.table.table_helpers import simple_table\nfrom astropy.units import Unit\nfrom astropy.utils.exceptions import AstropyDeprecationWarning\nfrom astropy.utils.misc import _NOT_OVERWRITING_MSG_MATCH\n\n\ndef test_table(tmpdir):\n    # Read the VOTABLE\n    votable = parse(get_pkg_data_filename('data/regression.xml'))\n    table = votable.get_first_table()\n    astropy_table = table.to_table()\n\n    for name in table.array.dtype.names:\n        assert np.all(astropy_table.mask[name] == table.array.mask[name])\n\n    votable2 = tree.VOTableFile.from_table(astropy_table)\n    t = votable2.get_first_table()\n\n    field_types = [\n        ('string_test', {'datatype': 'char', 'arraysize': '*'}),\n        ('string_test_2', {'datatype': 'char', 'arraysize': '10'}),\n        ('unicode_test', {'datatype': 'unicodeChar', 'arraysize': '*'}),\n        ('fixed_unicode_test', {'datatype': 'unicodeChar', 'arraysize': '10'}),\n        ('string_array_test', {'datatype': 'char', 'arraysize': '4'}),\n        ('unsignedByte', {'datatype': 'unsignedByte'}),\n        ('short', {'datatype': 'short'}),\n        ('int', {'datatype': 'int'}),\n        ('long', {'datatype': 'long'}),\n        ('double', {'datatype': 'double'}),\n        ('float', {'datatype': 'float'}),\n        ('array', {'datatype': 'long', 'arraysize': '2*'}),\n        ('bit', {'datatype': 'bit'}),\n        ('bitarray', {'datatype': 'bit', 'arraysize': '3x2'}),\n        ('bitvararray', {'datatype': 'bit', 'arraysize': '*'}),\n        ('bitvararray2', {'datatype': 'bit', 'arraysize': '3x2*'}),\n        ('floatComplex', {'datatype': 'floatComplex'}),\n        ('doubleComplex', {'datatype': 'doubleComplex'}),\n        ('doubleComplexArray', {'datatype': 'doubleComplex', 'arraysize': '*'}),\n        ('doubleComplexArrayFixed', {'datatype': 'doubleComplex', 'arraysize': '2'}),\n        ('boolean', {'datatype': 'bit'}),\n        ('booleanArray', {'datatype': 'bit', 'arraysize': '4'}),\n        ('nulls', {'datatype': 'int'}),\n        ('nulls_array', {'datatype': 'int', 'arraysize': '2x2'}),\n        ('precision1', {'datatype': 'double'}),\n        ('precision2', {'datatype': 'double'}),\n        ('doublearray', {'datatype': 'double', 'arraysize': '*'}),\n        ('bitarray2', {'datatype': 'bit', 'arraysize': '16'})]\n\n    for field, type in zip(t.fields, field_types):\n        name, d = type\n        assert field.ID == name\n        assert field.datatype == d['datatype'], f'{name} expected {d[\"datatype\"]} but get {field.datatype}'  # noqa\n        if 'arraysize' in d:\n            assert field.arraysize == d['arraysize']\n\n    # W39: Bit values can not be masked\n    with pytest.warns(W39):\n        writeto(votable2, os.path.join(str(tmpdir), \"through_table.xml\"))\n\n\ndef test_read_through_table_interface(tmpdir):\n    with get_pkg_data_fileobj('data/regression.xml', encoding='binary') as fd:\n        t = Table.read(fd, format='votable', table_id='main_table')\n\n    assert len(t) == 5\n\n    # Issue 8354\n    assert t['float'].format is None\n\n    fn = os.path.join(str(tmpdir), \"table_interface.xml\")\n\n    # W39: Bit values can not be masked\n    with pytest.warns(W39):\n        t.write(fn, table_id='FOO', format='votable')\n\n    with open(fn, 'rb') as fd:\n        t2 = Table.read(fd, format='votable', table_id='FOO')\n\n    assert len(t2) == 5\n\n\ndef test_read_through_table_interface2():\n    with get_pkg_data_fileobj('data/regression.xml', encoding='binary') as fd:\n        t = Table.read(fd, format='votable', table_id='last_table')\n\n    assert len(t) == 0\n\n\ndef test_pass_kwargs_through_table_interface():\n    # Table.read() should pass on keyword arguments meant for parse()\n    filename = get_pkg_data_filename('data/nonstandard_units.xml')\n    t = Table.read(filename, format='votable', unit_format='generic')\n    assert t['Flux1'].unit == Unit(\"erg / (Angstrom cm2 s)\")\n\n\ndef test_names_over_ids():\n    with get_pkg_data_fileobj('data/names.xml', encoding='binary') as fd:\n        votable = parse(fd)\n\n    table = votable.get_first_table().to_table(use_names_over_ids=True)\n\n    assert table.colnames == [\n        'Name', 'GLON', 'GLAT', 'RAdeg', 'DEdeg', 'Jmag', 'Hmag', 'Kmag',\n        'G3.6mag', 'G4.5mag', 'G5.8mag', 'G8.0mag', '4.5mag', '8.0mag',\n        'Emag', '24mag', 'f_Name']\n\n\ndef test_explicit_ids():\n    with get_pkg_data_fileobj('data/names.xml', encoding='binary') as fd:\n        votable = parse(fd)\n\n    table = votable.get_first_table().to_table(use_names_over_ids=False)\n\n    assert table.colnames == [\n        'col1', 'col2', 'col3', 'col4', 'col5', 'col6', 'col7', 'col8', 'col9',\n        'col10', 'col11', 'col12', 'col13', 'col14', 'col15', 'col16', 'col17']\n\n\ndef test_table_read_with_unnamed_tables():\n    \"\"\"\n    Issue #927\n    \"\"\"\n    with get_pkg_data_fileobj('data/names.xml', encoding='binary') as fd:\n        t = Table.read(fd, format='votable')\n\n    assert len(t) == 1\n\n\ndef test_votable_path_object():\n    \"\"\"\n    Testing when votable is passed as pathlib.Path object #4412.\n    \"\"\"\n    fpath = pathlib.Path(get_pkg_data_filename('data/names.xml'))\n    table = parse(fpath).get_first_table().to_table()\n\n    assert len(table) == 1\n    assert int(table[0][3]) == 266\n\n\ndef test_from_table_without_mask():\n    t = Table()\n    c = Column(data=[1, 2, 3], name='a')\n    t.add_column(c)\n    output = io.BytesIO()\n    t.write(output, format='votable')\n\n\ndef test_write_with_format():\n    t = Table()\n    c = Column(data=[1, 2, 3], name='a')\n    t.add_column(c)\n\n    output = io.BytesIO()\n    t.write(output, format='votable', tabledata_format=\"binary\")\n    obuff = output.getvalue()\n    assert b'VOTABLE version=\"1.4\"' in obuff\n    assert b'BINARY' in obuff\n    assert b'TABLEDATA' not in obuff\n\n    output = io.BytesIO()\n    t.write(output, format='votable', tabledata_format=\"binary2\")\n    obuff = output.getvalue()\n    assert b'VOTABLE version=\"1.4\"' in obuff\n    assert b'BINARY2' in obuff\n    assert b'TABLEDATA' not in obuff\n\n\ndef test_write_overwrite(tmpdir):\n    t = simple_table(3, 3)\n    filename = os.path.join(tmpdir, 'overwrite_test.vot')\n    t.write(filename, format='votable')\n    with pytest.raises(OSError, match=_NOT_OVERWRITING_MSG_MATCH):\n        t.write(filename, format='votable')\n    t.write(filename, format='votable', overwrite=True)\n\n\ndef test_empty_table():\n    votable = parse(get_pkg_data_filename('data/empty_table.xml'))\n    table = votable.get_first_table()\n    astropy_table = table.to_table()  # noqa\n\n\ndef test_no_field_not_empty_table():\n    votable = parse(get_pkg_data_filename('data/no_field_not_empty_table.xml'))\n    table = votable.get_first_table()\n    assert len(table.fields) == 0\n    assert len(table.infos) == 1\n\n\ndef test_no_field_not_empty_table_exception():\n    with pytest.raises(E25):\n        parse(get_pkg_data_filename('data/no_field_not_empty_table.xml'), verify='exception')\n\n\ndef test_binary2_masked_strings():\n    \"\"\"\n    Issue #8995\n    \"\"\"\n    # Read a VOTable which sets the null mask bit for each empty string value.\n    votable = parse(get_pkg_data_filename('data/binary2_masked_strings.xml'))\n    table = votable.get_first_table()\n    astropy_table = table.to_table()\n\n    # Ensure string columns have no masked values and can be written out\n    assert not np.any(table.array.mask['epoch_photometry_url'])\n    output = io.BytesIO()\n    astropy_table.write(output, format='votable')\n\n\ndef test_validate_output_invalid():\n    \"\"\"\n    Issue #12603. Test that we get the correct output from votable.validate with an invalid\n    votable.\n    \"\"\"\n\n    # A votable with errors\n    invalid_votable_filepath = get_pkg_data_filename('data/regression.xml')\n\n    # When output is None, check that validate returns validation output as a string\n    validate_out = validate(invalid_votable_filepath, output=None)\n    assert isinstance(validate_out, str)\n    # Check for known error string\n    assert \"E02: Incorrect number of elements in array.\" in validate_out\n\n    # When output is not set, check that validate returns a bool\n    validate_out = validate(invalid_votable_filepath)\n    assert isinstance(validate_out, bool)\n    # Check that validation output is correct (votable is not valid)\n    assert validate_out is False\n\n\ndef test_validate_output_valid():\n    \"\"\"\n    Issue #12603. Test that we get the correct output from votable.validate with a valid\n    votable\n    \"\"\"\n\n    # A valid votable. (Example from the votable standard:\n    # https://www.ivoa.net/documents/VOTable/20191021/REC-VOTable-1.4-20191021.html )\n    valid_votable_filepath = get_pkg_data_filename('data/valid_votable.xml')\n\n    # When output is None, check that validate returns validation output as a string\n    validate_out = validate(valid_votable_filepath, output=None)\n    assert isinstance(validate_out, str)\n    # Check for known good output string\n    assert \"astropy.io.votable found no violations\" in validate_out\n\n    # When output is not set, check that validate returns a bool\n    validate_out = validate(valid_votable_filepath)\n    assert isinstance(validate_out, bool)\n    # Check that validation output is correct (votable is valid)\n    assert validate_out is True\n\n\nclass TestVerifyOptions:\n\n    # Start off by checking the default (ignore)\n\n    def test_default(self):\n        parse(get_pkg_data_filename('data/gemini.xml'))\n\n    # Then try the various explicit options\n\n    def test_verify_ignore(self):\n        parse(get_pkg_data_filename('data/gemini.xml'), verify='ignore')\n\n    def test_verify_warn(self):\n        with pytest.warns(VOWarning) as w:\n            parse(get_pkg_data_filename('data/gemini.xml'), verify='warn')\n        assert len(w) == 24\n\n    def test_verify_exception(self):\n        with pytest.raises(VOWarning):\n            parse(get_pkg_data_filename('data/gemini.xml'), verify='exception')\n\n    # Make sure the deprecated pedantic option still works for now\n\n    def test_pedantic_false(self):\n        with pytest.warns(VOWarning) as w:\n            parse(get_pkg_data_filename('data/gemini.xml'), pedantic=False)\n        assert len(w) == 25\n\n    def test_pedantic_true(self):\n        with pytest.warns(AstropyDeprecationWarning):\n            with pytest.raises(VOWarning):\n                parse(get_pkg_data_filename('data/gemini.xml'), pedantic=True)\n\n    # Make sure that the default behavior can be set via configuration items\n\n    def test_conf_verify_ignore(self):\n        with conf.set_temp('verify', 'ignore'):\n            parse(get_pkg_data_filename('data/gemini.xml'))\n\n    def test_conf_verify_warn(self):\n        with conf.set_temp('verify', 'warn'):\n            with pytest.warns(VOWarning) as w:\n                parse(get_pkg_data_filename('data/gemini.xml'))\n            assert len(w) == 24\n\n    def test_conf_verify_exception(self):\n        with conf.set_temp('verify', 'exception'):\n            with pytest.raises(VOWarning):\n                parse(get_pkg_data_filename('data/gemini.xml'))\n\n    # And make sure the old configuration item will keep working\n\n    def test_conf_pedantic_false(self, tmpdir):\n\n        with set_temp_config(tmpdir.strpath):\n\n            with open(tmpdir.join('astropy').join('astropy.cfg').strpath, 'w') as f:\n                f.write('[io.votable]\\npedantic = False')\n\n            reload_config('astropy.io.votable')\n\n            with pytest.warns(VOWarning) as w:\n                parse(get_pkg_data_filename('data/gemini.xml'))\n            assert len(w) == 25\n\n    def test_conf_pedantic_true(self, tmpdir):\n\n        with set_temp_config(tmpdir.strpath):\n\n            with open(tmpdir.join('astropy').join('astropy.cfg').strpath, 'w') as f:\n                f.write('[io.votable]\\npedantic = True')\n\n            reload_config('astropy.io.votable')\n\n            with pytest.warns(AstropyDeprecationWarning):\n                with pytest.raises(VOWarning):\n                    parse(get_pkg_data_filename('data/gemini.xml'))\n"},{"col":4,"comment":"[*required*] The key of the key-value pair.","endLoc":694,"header":"@property\n    def name(self)","id":6306,"name":"name","nodeType":"Function","startLoc":691,"text":"@property\n    def name(self):\n        \"\"\"[*required*] The key of the key-value pair.\"\"\"\n        return self._name"},{"col":4,"comment":"null","endLoc":701,"header":"@name.setter\n    def name(self, name)","id":6307,"name":"name","nodeType":"Function","startLoc":696,"text":"@name.setter\n    def name(self, name):\n        if name is None:\n            warn_or_raise(W35, W35, ('name'), self._config, self._pos)\n        xmlutil.check_token(name, 'name', self._config, self._pos)\n        self._name = name"},{"col":4,"comment":"null","endLoc":3499,"header":"def _add_coosys(self, iterator, tag, data, config, pos)","id":6308,"name":"_add_coosys","nodeType":"Function","startLoc":3496,"text":"def _add_coosys(self, iterator, tag, data, config, pos):\n        coosys = CooSys(config=config, pos=pos, **data)\n        self.coordinate_systems.append(coosys)\n        coosys.parse(iterator, config)"},{"col":4,"comment":"\n        [*required*] The value of the key-value pair.  (Always stored\n        as a string or unicode string).\n        ","endLoc":709,"header":"@property\n    def value(self)","id":6309,"name":"value","nodeType":"Function","startLoc":703,"text":"@property\n    def value(self):\n        \"\"\"\n        [*required*] The value of the key-value pair.  (Always stored\n        as a string or unicode string).\n        \"\"\"\n        return self._value"},{"className":"set_temp_config","col":0,"comment":"\n    Context manager to set a temporary path for the Astropy config, primarily\n    for use with testing.\n\n    If the path set by this context manager does not already exist it will be\n    created, if possible.\n\n    This may also be used as a decorator on a function to set the config path\n    just within that function.\n\n    Parameters\n    ----------\n\n    path : str, optional\n        The directory (which must exist) in which to find the Astropy config\n        files, or create them if they do not already exist.  If None, this\n        restores the config path to the user's default config path as returned\n        by `get_config_dir` as though this context manager were not in effect\n        (this is useful for testing).  In this case the ``delete`` argument is\n        always ignored.\n\n    delete : bool, optional\n        If True, cleans up the temporary directory after exiting the temp\n        context (default: False).\n    ","endLoc":254,"id":6310,"nodeType":"Class","startLoc":210,"text":"class set_temp_config(_SetTempPath):\n    \"\"\"\n    Context manager to set a temporary path for the Astropy config, primarily\n    for use with testing.\n\n    If the path set by this context manager does not already exist it will be\n    created, if possible.\n\n    This may also be used as a decorator on a function to set the config path\n    just within that function.\n\n    Parameters\n    ----------\n\n    path : str, optional\n        The directory (which must exist) in which to find the Astropy config\n        files, or create them if they do not already exist.  If None, this\n        restores the config path to the user's default config path as returned\n        by `get_config_dir` as though this context manager were not in effect\n        (this is useful for testing).  In this case the ``delete`` argument is\n        always ignored.\n\n    delete : bool, optional\n        If True, cleans up the temporary directory after exiting the temp\n        context (default: False).\n    \"\"\"\n\n    _default_path_getter = staticmethod(get_config_dir)\n\n    def __enter__(self):\n        # Special case for the config case, where we need to reset all the\n        # cached config objects.  We do keep the cache, since some of it\n        # may have been set programmatically rather than be stored in the\n        # config file (e.g., iers.conf.auto_download=False for our tests).\n        from .configuration import _cfgobjs\n        self._cfgobjs_copy = _cfgobjs.copy()\n        _cfgobjs.clear()\n        return super().__enter__()\n\n    def __exit__(self, *args):\n        from .configuration import _cfgobjs\n        _cfgobjs.clear()\n        _cfgobjs.update(self._cfgobjs_copy)\n        del self._cfgobjs_copy\n        super().__exit__(*args)"},{"col":4,"comment":"null","endLoc":716,"header":"@value.setter\n    def value(self, value)","id":6311,"name":"value","nodeType":"Function","startLoc":711,"text":"@value.setter\n    def value(self, value):\n        if value is None:\n            warn_or_raise(W35, W35, ('value'), self._config, self._pos)\n        check_string(value, 'value', self._config, self._pos)\n        self._value = value"},{"className":"_SetTempPath","col":0,"comment":"null","endLoc":207,"id":6312,"nodeType":"Class","startLoc":173,"text":"class _SetTempPath:\n    _temp_path = None\n    _default_path_getter = None\n\n    def __init__(self, path=None, delete=False):\n        if path is not None:\n            path = os.path.abspath(path)\n\n        self._path = path\n        self._delete = delete\n        self._prev_path = self.__class__._temp_path\n\n    def __enter__(self):\n        self.__class__._temp_path = self._path\n        try:\n            return self._default_path_getter('astropy')\n        except Exception:\n            self.__class__._temp_path = self._prev_path\n            raise\n\n    def __exit__(self, *args):\n        self.__class__._temp_path = self._prev_path\n\n        if self._delete and self._path is not None:\n            shutil.rmtree(self._path)\n\n    def __call__(self, func):\n        \"\"\"Implements use as a decorator.\"\"\"\n\n        @wraps(func)\n        def wrapper(*args, **kwargs):\n            with self:\n                func(*args, **kwargs)\n\n        return wrapper"},{"col":4,"comment":"null","endLoc":191,"header":"def __enter__(self)","id":6313,"name":"__enter__","nodeType":"Function","startLoc":185,"text":"def __enter__(self):\n        self.__class__._temp_path = self._path\n        try:\n            return self._default_path_getter('astropy')\n        except Exception:\n            self.__class__._temp_path = self._prev_path\n            raise"},{"col":4,"comment":"The content inside the INFO element.","endLoc":721,"header":"@property\n    def content(self)","id":6314,"name":"content","nodeType":"Function","startLoc":718,"text":"@property\n    def content(self):\n        \"\"\"The content inside the INFO element.\"\"\"\n        return self._content"},{"col":4,"comment":"null","endLoc":726,"header":"@content.setter\n    def content(self, content)","id":6315,"name":"content","nodeType":"Function","startLoc":723,"text":"@content.setter\n    def content(self, content):\n        check_string(content, 'content', self._config, self._pos)\n        self._content = content"},{"col":4,"comment":"null","endLoc":730,"header":"@content.deleter\n    def content(self)","id":6316,"name":"content","nodeType":"Function","startLoc":728,"text":"@content.deleter\n    def content(self):\n        self._content = None"},{"col":4,"comment":"\n        Refer to another INFO_ element by ID_, defined previously in\n        the document.\n        ","endLoc":738,"header":"@property\n    def ref(self)","id":6317,"name":"ref","nodeType":"Function","startLoc":732,"text":"@property\n    def ref(self):\n        \"\"\"\n        Refer to another INFO_ element by ID_, defined previously in\n        the document.\n        \"\"\"\n        return self._ref"},{"col":4,"comment":"null","endLoc":761,"header":"@ref.setter\n    def ref(self, ref)","id":6318,"name":"ref","nodeType":"Function","startLoc":740,"text":"@ref.setter\n    def ref(self, ref):\n        if ref is not None and not self._config.get('version_1_2_or_later'):\n            warn_or_raise(W28, W28, ('ref', 'INFO', '1.2'),\n                          self._config, self._pos)\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        # TODO: actually apply the reference\n        # if ref is not None:\n        #     try:\n        #         other = self._votable.get_values_by_id(ref, before=self)\n        #     except KeyError:\n        #         vo_raise(\n        #             \"VALUES ref='%s', which has not already been defined.\" %\n        #             self.ref, self._config, self._pos, KeyError)\n        #     self.null = other.null\n        #     self.type = other.type\n        #     self.min = other.min\n        #     self.min_inclusive = other.min_inclusive\n        #     self.max = other.max\n        #     self.max_inclusive = other.max_inclusive\n        #     self._options[:] = other.options\n        self._ref = ref"},{"col":4,"comment":"null","endLoc":197,"header":"def __exit__(self, *args)","id":6319,"name":"__exit__","nodeType":"Function","startLoc":193,"text":"def __exit__(self, *args):\n        self.__class__._temp_path = self._prev_path\n\n        if self._delete and self._path is not None:\n            shutil.rmtree(self._path)"},{"col":4,"comment":"Implements use as a decorator.","endLoc":207,"header":"def __call__(self, func)","id":6320,"name":"__call__","nodeType":"Function","startLoc":199,"text":"def __call__(self, func):\n        \"\"\"Implements use as a decorator.\"\"\"\n\n        @wraps(func)\n        def wrapper(*args, **kwargs):\n            with self:\n                func(*args, **kwargs)\n\n        return wrapper"},{"col":4,"comment":"null","endLoc":1662,"header":"def __init__(self, ID=None, equinox=None, epoch=None, system=None, id=None,\n                 config=None, pos=None, **extra)","id":6321,"name":"__init__","nodeType":"Function","startLoc":1643,"text":"def __init__(self, ID=None, equinox=None, epoch=None, system=None, id=None,\n                 config=None, pos=None, **extra):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        # COOSYS was deprecated in 1.2 but then re-instated in 1.3\n        if (config.get('version_1_2_or_later') and\n                not config.get('version_1_3_or_later')):\n            warn_or_raise(W27, W27, (), config, pos)\n\n        SimpleElement.__init__(self)\n\n        self.ID = resolve_id(ID, id, config, pos)\n        self.equinox = equinox\n        self.epoch = epoch\n        self.system = system\n\n        warn_unknown_attrs('COOSYS', extra.keys(), config, pos)"},{"attributeType":"null","col":4,"comment":"null","endLoc":174,"id":6322,"name":"_temp_path","nodeType":"Attribute","startLoc":174,"text":"_temp_path"},{"attributeType":"null","col":4,"comment":"null","endLoc":175,"id":6323,"name":"_default_path_getter","nodeType":"Attribute","startLoc":175,"text":"_default_path_getter"},{"attributeType":"null","col":8,"comment":"null","endLoc":183,"id":6324,"name":"_prev_path","nodeType":"Attribute","startLoc":183,"text":"self._prev_path"},{"attributeType":"null","col":8,"comment":"null","endLoc":181,"id":6325,"name":"_path","nodeType":"Attribute","startLoc":181,"text":"self._path"},{"col":4,"comment":"null","endLoc":3504,"header":"def _add_timesys(self, iterator, tag, data, config, pos)","id":6326,"name":"_add_timesys","nodeType":"Function","startLoc":3501,"text":"def _add_timesys(self, iterator, tag, data, config, pos):\n        timesys = TimeSys(config=config, pos=pos, **data)\n        self.time_systems.append(timesys)\n        timesys.parse(iterator, config)"},{"attributeType":"null","col":8,"comment":"null","endLoc":182,"id":6327,"name":"_delete","nodeType":"Attribute","startLoc":182,"text":"self._delete"},{"col":4,"comment":"null","endLoc":765,"header":"@ref.deleter\n    def ref(self)","id":6328,"name":"ref","nodeType":"Function","startLoc":763,"text":"@ref.deleter\n    def ref(self):\n        self._ref = None"},{"col":4,"comment":"null","endLoc":247,"header":"def __enter__(self)","id":6329,"name":"__enter__","nodeType":"Function","startLoc":239,"text":"def __enter__(self):\n        # Special case for the config case, where we need to reset all the\n        # cached config objects.  We do keep the cache, since some of it\n        # may have been set programmatically rather than be stored in the\n        # config file (e.g., iers.conf.auto_download=False for our tests).\n        from .configuration import _cfgobjs\n        self._cfgobjs_copy = _cfgobjs.copy()\n        _cfgobjs.clear()\n        return super().__enter__()"},{"col":4,"comment":"A string specifying the units_ for the INFO_.","endLoc":770,"header":"@property\n    def unit(self)","id":6330,"name":"unit","nodeType":"Function","startLoc":767,"text":"@property\n    def unit(self):\n        \"\"\"A string specifying the units_ for the INFO_.\"\"\"\n        return self._unit"},{"col":4,"comment":"null","endLoc":798,"header":"@unit.setter\n    def unit(self, unit)","id":6331,"name":"unit","nodeType":"Function","startLoc":772,"text":"@unit.setter\n    def unit(self, unit):\n        if unit is None:\n            self._unit = None\n            return\n\n        from astropy import units as u\n\n        if not self._config.get('version_1_2_or_later'):\n            warn_or_raise(W28, W28, ('unit', 'INFO', '1.2'),\n                          self._config, self._pos)\n\n        # First, parse the unit in the default way, so that we can\n        # still emit a warning if the unit is not to spec.\n        default_format = _get_default_unit_format(self._config)\n        unit_obj = u.Unit(\n            unit, format=default_format, parse_strict='silent')\n        if isinstance(unit_obj, u.UnrecognizedUnit):\n            warn_or_raise(W50, W50, (unit,),\n                          self._config, self._pos)\n\n        format = _get_unit_format(self._config)\n        if format != default_format:\n            unit_obj = u.Unit(\n                unit, format=format, parse_strict='silent')\n\n        self._unit = unit_obj"},{"col":4,"comment":"null","endLoc":254,"header":"def __exit__(self, *args)","id":6332,"name":"__exit__","nodeType":"Function","startLoc":249,"text":"def __exit__(self, *args):\n        from .configuration import _cfgobjs\n        _cfgobjs.clear()\n        _cfgobjs.update(self._cfgobjs_copy)\n        del self._cfgobjs_copy\n        super().__exit__(*args)"},{"col":4,"comment":"null","endLoc":1769,"header":"def __init__(self, ID=None, timeorigin=None, timescale=None, refposition=None, id=None,\n                 config=None, pos=None, **extra)","id":6333,"name":"__init__","nodeType":"Function","startLoc":1749,"text":"def __init__(self, ID=None, timeorigin=None, timescale=None, refposition=None, id=None,\n                 config=None, pos=None, **extra):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        # TIMESYS is supported starting in version 1.4\n        if not config['version_1_4_or_later']:\n            warn_or_raise(\n                W54, W54, config['version'], config, pos)\n\n        SimpleElement.__init__(self)\n\n        self.ID = resolve_id(ID, id, config, pos)\n        self.timeorigin = timeorigin\n        self.timescale = timescale\n        self.refposition = refposition\n\n        warn_unknown_attrs('TIMESYS', extra.keys(), config, pos,\n                           ['ID', 'timeorigin', 'timescale', 'refposition'])"},{"attributeType":"null","col":4,"comment":"null","endLoc":237,"id":6334,"name":"_default_path_getter","nodeType":"Attribute","startLoc":237,"text":"_default_path_getter"},{"attributeType":"null","col":8,"comment":"null","endLoc":245,"id":6335,"name":"_cfgobjs_copy","nodeType":"Attribute","startLoc":245,"text":"self._cfgobjs_copy"},{"col":0,"comment":" Reloads configuration settings from a configuration file for the root\n    package of the requested package/module.\n\n    This overwrites any changes that may have been made in `ConfigItem`\n    objects.  This applies for any items that are based on this file, which\n    is determined by the *root* package of ``packageormod``\n    (e.g. ``'astropy.cfg'`` for the ``'astropy.config.configuration'``\n    module).\n\n    Parameters\n    ----------\n    packageormod : str or None\n        The package or module name - see `get_config` for details.\n    rootname : str or None\n        Name of the root configuration directory - see `get_config`\n        for details.\n    ","endLoc":709,"header":"def reload_config(packageormod=None, rootname=None)","id":6336,"name":"reload_config","nodeType":"Function","startLoc":687,"text":"def reload_config(packageormod=None, rootname=None):\n    \"\"\" Reloads configuration settings from a configuration file for the root\n    package of the requested package/module.\n\n    This overwrites any changes that may have been made in `ConfigItem`\n    objects.  This applies for any items that are based on this file, which\n    is determined by the *root* package of ``packageormod``\n    (e.g. ``'astropy.cfg'`` for the ``'astropy.config.configuration'``\n    module).\n\n    Parameters\n    ----------\n    packageormod : str or None\n        The package or module name - see `get_config` for details.\n    rootname : str or None\n        Name of the root configuration directory - see `get_config`\n        for details.\n    \"\"\"\n    sec = get_config(packageormod, True, rootname=rootname)\n    # look for the section that is its own parent - that's the base object\n    while sec.parent is not sec:\n        sec = sec.parent\n    sec.reload()"},{"col":0,"comment":"\n    Get the default unit format as specified in the VOTable spec.\n    ","endLoc":176,"header":"def _get_default_unit_format(config)","id":6337,"name":"_get_default_unit_format","nodeType":"Function","startLoc":167,"text":"def _get_default_unit_format(config):\n    \"\"\"\n    Get the default unit format as specified in the VOTable spec.\n    \"\"\"\n    # The unit format changed between VOTable versions 1.3 and 1.4,\n    # see issue #10791.\n    if config['version_1_4_or_later']:\n        return 'vounit'\n    else:\n        return 'cds'"},{"col":0,"comment":" Gets the configuration object or section associated with a particular\n    package or module.\n\n    Parameters\n    ----------\n    packageormod : str or None\n        The package for which to retrieve the configuration object. If a\n        string, it must be a valid package name, or if ``None``, the package from\n        which this function is called will be used.\n\n    reload : bool, optional\n        Reload the file, even if we have it cached.\n\n    rootname : str or None\n        Name of the root configuration directory. If ``None`` and\n        ``packageormod`` is ``None``, this defaults to be the name of\n        the package from which this function is called. If ``None`` and\n        ``packageormod`` is not ``None``, this defaults to ``astropy``.\n\n    Returns\n    -------\n    cfgobj : ``configobj.ConfigObj`` or ``configobj.Section``\n        If the requested package is a base package, this will be the\n        ``configobj.ConfigObj`` for that package, or if it is a subpackage or\n        module, it will return the relevant ``configobj.Section`` object.\n\n    Raises\n    ------\n    RuntimeError\n        If ``packageormod`` is `None`, but the package this item is created\n        from cannot be determined.\n    ","endLoc":592,"header":"def get_config(packageormod=None, reload=False, rootname=None)","id":6338,"name":"get_config","nodeType":"Function","startLoc":510,"text":"def get_config(packageormod=None, reload=False, rootname=None):\n    \"\"\" Gets the configuration object or section associated with a particular\n    package or module.\n\n    Parameters\n    ----------\n    packageormod : str or None\n        The package for which to retrieve the configuration object. If a\n        string, it must be a valid package name, or if ``None``, the package from\n        which this function is called will be used.\n\n    reload : bool, optional\n        Reload the file, even if we have it cached.\n\n    rootname : str or None\n        Name of the root configuration directory. If ``None`` and\n        ``packageormod`` is ``None``, this defaults to be the name of\n        the package from which this function is called. If ``None`` and\n        ``packageormod`` is not ``None``, this defaults to ``astropy``.\n\n    Returns\n    -------\n    cfgobj : ``configobj.ConfigObj`` or ``configobj.Section``\n        If the requested package is a base package, this will be the\n        ``configobj.ConfigObj`` for that package, or if it is a subpackage or\n        module, it will return the relevant ``configobj.Section`` object.\n\n    Raises\n    ------\n    RuntimeError\n        If ``packageormod`` is `None`, but the package this item is created\n        from cannot be determined.\n    \"\"\"\n\n    if packageormod is None:\n        packageormod = find_current_module(2)\n        if packageormod is None:\n            msg1 = 'Cannot automatically determine get_config module, '\n            msg2 = 'because it is not called from inside a valid module'\n            raise RuntimeError(msg1 + msg2)\n        else:\n            packageormod = packageormod.__name__\n\n        _autopkg = True\n\n    else:\n        _autopkg = False\n\n    packageormodspl = packageormod.split('.')\n    pkgname = packageormodspl[0]\n    secname = '.'.join(packageormodspl[1:])\n\n    if rootname is None:\n        if _autopkg:\n            rootname = pkgname\n        else:\n            rootname = 'astropy'  # so we don't break affiliated packages\n\n    cobj = _cfgobjs.get(pkgname, None)\n\n    if cobj is None or reload:\n        cfgfn = None\n        try:\n            # This feature is intended only for use by the unit tests\n            if _override_config_file is not None:\n                cfgfn = _override_config_file\n            else:\n                cfgfn = path.join(get_config_dir(rootname=rootname), pkgname + '.cfg')\n            cobj = configobj.ConfigObj(cfgfn, interpolation=False)\n        except OSError:\n            # This can happen when HOME is not set\n            cobj = configobj.ConfigObj(interpolation=False)\n\n        # This caches the object, so if the file becomes accessible, this\n        # function won't see it unless the module is reloaded\n        _cfgobjs[pkgname] = cobj\n\n    if secname:  # not the root package\n        if secname not in cobj:\n            cobj[secname] = {}\n        return cobj[secname]\n    else:\n        return cobj"},{"col":0,"comment":"\n    Get the unit format based on the configuration.\n    ","endLoc":187,"header":"def _get_unit_format(config)","id":6339,"name":"_get_unit_format","nodeType":"Function","startLoc":179,"text":"def _get_unit_format(config):\n    \"\"\"\n    Get the unit format based on the configuration.\n    \"\"\"\n    if config.get('unit_format') is None:\n        format = _get_default_unit_format(config)\n    else:\n        format = config['unit_format']\n    return format"},{"col":4,"comment":"\n        Lookup the :class:`Field` instance that this :class:`FieldRef`\n        references.\n        ","endLoc":1919,"header":"def get_ref(self)","id":6340,"name":"get_ref","nodeType":"Function","startLoc":1909,"text":"def get_ref(self):\n        \"\"\"\n        Lookup the :class:`Field` instance that this :class:`FieldRef`\n        references.\n        \"\"\"\n        for field in self._table._votable.iter_fields_and_params():\n            if isinstance(field, Field) and field.ID == self.ref:\n                return field\n        vo_raise(\n            f\"No field named '{self.ref}'\",\n            self._config, self._pos, KeyError)"},{"col":0,"comment":"null","endLoc":64,"header":"def test_unicode_mask()","id":6341,"name":"test_unicode_mask","nodeType":"Function","startLoc":59,"text":"def test_unicode_mask():\n    config = {'verify': 'exception'}\n    field = tree.Field(None, name='c', arraysize='1', datatype='unicodeChar',\n                       config=config)\n    c = converters.get_converter(field, config=config)\n    assert c.output(\"Foo\", True) == ''"},{"col":4,"comment":"null","endLoc":219,"header":"def test_paramref(self)","id":6342,"name":"test_paramref","nodeType":"Function","startLoc":215,"text":"def test_paramref(self):\n        paramref = self.table.groups[0].entries[0]\n        assert isinstance(paramref, tree.ParamRef)\n        assert paramref.get_ref().name == 'INPUT'\n        assert paramref.get_ref().datatype == 'float'"},{"col":4,"comment":"null","endLoc":802,"header":"@unit.deleter\n    def unit(self)","id":6343,"name":"unit","nodeType":"Function","startLoc":800,"text":"@unit.deleter\n    def unit(self):\n        self._unit = None"},{"col":4,"comment":"null","endLoc":809,"header":"def to_xml(self, w, **kwargs)","id":6344,"name":"to_xml","nodeType":"Function","startLoc":804,"text":"def to_xml(self, w, **kwargs):\n        attrib = w.object_attrs(self, self._attr_list)\n        if 'unit' in attrib:\n            attrib['unit'] = self.unit.to_string('cds')\n        w.element(self._element_name, self._content,\n                  attrib=attrib)"},{"col":4,"comment":"null","endLoc":3509,"header":"def _add_info(self, iterator, tag, data, config, pos)","id":6345,"name":"_add_info","nodeType":"Function","startLoc":3506,"text":"def _add_info(self, iterator, tag, data, config, pos):\n        info = Info(config=config, pos=pos, **data)\n        self.infos.append(info)\n        info.parse(iterator, config)"},{"col":0,"comment":"null","endLoc":93,"header":"def test_unicode_as_char()","id":6346,"name":"test_unicode_as_char","nodeType":"Function","startLoc":67,"text":"def test_unicode_as_char():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='unicode_in_char', datatype='char',\n        arraysize='*', config=config)\n    c = converters.get_converter(field, config=config)\n\n    # Test parsing.\n    c.parse('XYZ')  # ASCII succeeds\n    with pytest.warns(\n            exceptions.W55,\n            match=r'FIELD \\(unicode_in_char\\) has datatype=\"char\" but contains non-ASCII value'):\n        c.parse(\"zła\")  # non-ASCII\n\n    # Test output.\n    c.output('XYZ', False)  # ASCII str succeeds\n    c.output(b'XYZ', False)  # ASCII bytes succeeds\n    value = 'zła'\n    value_bytes = value.encode('utf-8')\n    with pytest.warns(\n            exceptions.E24,\n            match=r'E24: Attempt to write non-ASCII value'):\n        c.output(value, False)  # non-ASCII str raises\n    with pytest.warns(\n            exceptions.E24,\n            match=r'E24: Attempt to write non-ASCII value'):\n        c.output(value_bytes, False)  # non-ASCII bytes raises"},{"col":4,"comment":"\n        Parse a config file or create a config file object.\n\n        ``ConfigObj(infile=None, configspec=None, encoding=None,\n                    interpolation=True, raise_errors=False, list_values=True,\n                    create_empty=False, file_error=False, stringify=True,\n                    indent_type=None, default_encoding=None, unrepr=False,\n                    write_empty_values=False, _inspec=False)``\n        ","endLoc":1227,"header":"def __init__(self, infile=None, options=None, configspec=None, encoding=None,\n                 interpolation=True, raise_errors=False, list_values=True,\n                 create_empty=False, file_error=False, stringify=True,\n                 indent_type=None, default_encoding=None, unrepr=False,\n                 write_empty_values=False, _inspec=False)","id":6347,"name":"__init__","nodeType":"Function","startLoc":1172,"text":"def __init__(self, infile=None, options=None, configspec=None, encoding=None,\n                 interpolation=True, raise_errors=False, list_values=True,\n                 create_empty=False, file_error=False, stringify=True,\n                 indent_type=None, default_encoding=None, unrepr=False,\n                 write_empty_values=False, _inspec=False):\n        \"\"\"\n        Parse a config file or create a config file object.\n\n        ``ConfigObj(infile=None, configspec=None, encoding=None,\n                    interpolation=True, raise_errors=False, list_values=True,\n                    create_empty=False, file_error=False, stringify=True,\n                    indent_type=None, default_encoding=None, unrepr=False,\n                    write_empty_values=False, _inspec=False)``\n        \"\"\"\n        self._inspec = _inspec\n        # init the superclass\n        Section.__init__(self, self, 0, self)\n\n        infile = infile or []\n\n        _options = {'configspec': configspec,\n                    'encoding': encoding, 'interpolation': interpolation,\n                    'raise_errors': raise_errors, 'list_values': list_values,\n                    'create_empty': create_empty, 'file_error': file_error,\n                    'stringify': stringify, 'indent_type': indent_type,\n                    'default_encoding': default_encoding, 'unrepr': unrepr,\n                    'write_empty_values': write_empty_values}\n\n        if options is None:\n            options = _options\n        else:\n            import warnings\n            warnings.warn('Passing in an options dictionary to ConfigObj() is '\n                          'deprecated. Use **options instead.',\n                          DeprecationWarning)\n\n            # TODO: check the values too.\n            for entry in options:\n                if entry not in OPTION_DEFAULTS:\n                    raise TypeError('Unrecognized option \"%s\".' % entry)\n            for entry, value in list(OPTION_DEFAULTS.items()):\n                if entry not in options:\n                    options[entry] = value\n                keyword_value = _options[entry]\n                if value != keyword_value:\n                    options[entry] = keyword_value\n\n        # XXXX this ignores an explicit list_values = True in combination\n        # with _inspec. The user should *never* do that anyway, but still...\n        if _inspec:\n            options['list_values'] = False\n\n        self._initialise(options)\n        configspec = options['configspec']\n        self._original_configspec = configspec\n        self._load(infile, configspec)"},{"attributeType":"null","col":4,"comment":"null","endLoc":649,"id":6348,"name":"_element_name","nodeType":"Attribute","startLoc":649,"text":"_element_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":650,"id":6349,"name":"_attr_list_11","nodeType":"Attribute","startLoc":650,"text":"_attr_list_11"},{"attributeType":"null","col":4,"comment":"null","endLoc":651,"id":6350,"name":"_attr_list_12","nodeType":"Attribute","startLoc":651,"text":"_attr_list_12"},{"attributeType":"null","col":4,"comment":"null","endLoc":652,"id":6351,"name":"_utype_in_v1_2","nodeType":"Attribute","startLoc":652,"text":"_utype_in_v1_2"},{"attributeType":"null","col":8,"comment":"null","endLoc":668,"id":6352,"name":"xtype","nodeType":"Attribute","startLoc":668,"text":"self.xtype"},{"attributeType":"None","col":8,"comment":"null","endLoc":701,"id":6353,"name":"_name","nodeType":"Attribute","startLoc":701,"text":"self._name"},{"col":0,"comment":"null","endLoc":113,"header":"def test_unicode_as_char_binary()","id":6354,"name":"test_unicode_as_char_binary","nodeType":"Function","startLoc":96,"text":"def test_unicode_as_char_binary():\n    config = {'verify': 'exception'}\n\n    field = tree.Field(\n        None, name='unicode_in_char', datatype='char',\n        arraysize='*', config=config)\n    c = converters.get_converter(field, config=config)\n    c._binoutput_var('abc', False)  # ASCII succeeds\n    with pytest.raises(exceptions.E24, match=r\"E24: Attempt to write non-ASCII value\"):\n        c._binoutput_var('zła', False)\n\n    field = tree.Field(\n        None, name='unicode_in_char', datatype='char',\n        arraysize='3', config=config)\n    c = converters.get_converter(field, config=config)\n    c._binoutput_fixed('xyz', False)\n    with pytest.raises(exceptions.E24, match=r\"E24: Attempt to write non-ASCII value\"):\n        c._binoutput_fixed('zła', False)"},{"attributeType":"null","col":8,"comment":"null","endLoc":672,"id":6355,"name":"utype","nodeType":"Attribute","startLoc":672,"text":"self.utype"},{"attributeType":"null","col":12,"comment":"null","endLoc":677,"id":6356,"name":"_attr_list","nodeType":"Attribute","startLoc":677,"text":"self._attr_list"},{"attributeType":"{get} | None","col":8,"comment":"null","endLoc":659,"id":6357,"name":"_config","nodeType":"Attribute","startLoc":659,"text":"self._config"},{"attributeType":"null","col":8,"comment":"null","endLoc":669,"id":6358,"name":"ref","nodeType":"Attribute","startLoc":669,"text":"self.ref"},{"col":4,"comment":"null","endLoc":3516,"header":"def _add_group(self, iterator, tag, data, config, pos)","id":6359,"name":"_add_group","nodeType":"Function","startLoc":3511,"text":"def _add_group(self, iterator, tag, data, config, pos):\n        if not config.get('version_1_2_or_later'):\n            warn_or_raise(W26, W26, ('GROUP', 'VOTABLE', '1.2'), config, pos)\n        group = Group(self, config=config, pos=pos, **data)\n        self.groups.append(group)\n        group.parse(iterator, config)"},{"attributeType":"null","col":8,"comment":"null","endLoc":670,"id":6360,"name":"unit","nodeType":"Attribute","startLoc":670,"text":"self.unit"},{"attributeType":"None","col":12,"comment":"null","endLoc":775,"id":6361,"name":"_unit","nodeType":"Attribute","startLoc":775,"text":"self._unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":671,"id":6362,"name":"ucd","nodeType":"Attribute","startLoc":671,"text":"self.ucd"},{"attributeType":"null","col":8,"comment":"null","endLoc":666,"id":6363,"name":"name","nodeType":"Attribute","startLoc":666,"text":"self.name"},{"attributeType":"None","col":8,"comment":"null","endLoc":761,"id":6364,"name":"_ref","nodeType":"Attribute","startLoc":761,"text":"self._ref"},{"col":0,"comment":"null","endLoc":123,"header":"def test_wrong_number_of_elements()","id":6365,"name":"test_wrong_number_of_elements","nodeType":"Function","startLoc":116,"text":"def test_wrong_number_of_elements():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='int', arraysize='2x3*',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    with pytest.raises(exceptions.E02):\n        c.parse(\"2 3 4 5 6\")"},{"attributeType":"null","col":8,"comment":"null","endLoc":660,"id":6366,"name":"_pos","nodeType":"Attribute","startLoc":660,"text":"self._pos"},{"col":4,"comment":"null","endLoc":2023,"header":"def __init__(self, table, ID=None, name=None, ref=None, ucd=None,\n                 utype=None, id=None, config=None, pos=None, **extra)","id":6367,"name":"__init__","nodeType":"Function","startLoc":2002,"text":"def __init__(self, table, ID=None, name=None, ref=None, ucd=None,\n                 utype=None, id=None, config=None, pos=None, **extra):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        Element.__init__(self)\n        self._table = table\n\n        self.ID = (resolve_id(ID, id, config, pos)\n                            or xmlutil.fix_id(name, config, pos))\n        self.name = name\n        self.ref = ref\n        self.ucd = ucd\n        self.utype = utype\n        self.description = None\n\n        self._entries = HomogeneousList(\n            (FieldRef, ParamRef, Group, Param))\n\n        warn_unknown_attrs('GROUP', extra.keys(), config, pos)"},{"attributeType":"None","col":8,"comment":"null","endLoc":716,"id":6368,"name":"_value","nodeType":"Attribute","startLoc":716,"text":"self._value"},{"attributeType":"null","col":8,"comment":"null","endLoc":664,"id":6369,"name":"ID","nodeType":"Attribute","startLoc":664,"text":"self.ID"},{"col":4,"comment":"\n        Write to an XML file.\n\n        Parameters\n        ----------\n        fd : str or file-like\n            Where to write the file. If a file-like object, must be writable.\n\n        compressed : bool, optional\n            When `True`, write to a gzip-compressed file.  (Default:\n            `False`)\n\n        tabledata_format : str, optional\n            Override the format of the table(s) data to write.  Must\n            be one of ``tabledata`` (text representation), ``binary`` or\n            ``binary2``.  By default, use the format that was specified\n            in each `Table` object as it was created or read in.  See\n            :ref:`astropy:votable-serialization`.\n        ","endLoc":3699,"header":"def to_xml(self, fd, compressed=False, tabledata_format=None,\n               _debug_python_based_parser=False, _astropy_version=None)","id":6370,"name":"to_xml","nodeType":"Function","startLoc":3627,"text":"def to_xml(self, fd, compressed=False, tabledata_format=None,\n               _debug_python_based_parser=False, _astropy_version=None):\n        \"\"\"\n        Write to an XML file.\n\n        Parameters\n        ----------\n        fd : str or file-like\n            Where to write the file. If a file-like object, must be writable.\n\n        compressed : bool, optional\n            When `True`, write to a gzip-compressed file.  (Default:\n            `False`)\n\n        tabledata_format : str, optional\n            Override the format of the table(s) data to write.  Must\n            be one of ``tabledata`` (text representation), ``binary`` or\n            ``binary2``.  By default, use the format that was specified\n            in each `Table` object as it was created or read in.  See\n            :ref:`astropy:votable-serialization`.\n        \"\"\"\n        if tabledata_format is not None:\n            if tabledata_format.lower() not in (\n                    'tabledata', 'binary', 'binary2'):\n                raise ValueError(f\"Unknown format type '{format}'\")\n\n        kwargs = {\n            'version': self.version,\n            'tabledata_format':\n                tabledata_format,\n            '_debug_python_based_parser': _debug_python_based_parser,\n            '_group_number': 1}\n        kwargs.update(self._get_version_checks())\n\n        with util.convert_to_writable_filelike(\n            fd, compressed=compressed) as fd:\n            w = XMLWriter(fd)\n            version = self.version\n            if _astropy_version is None:\n                lib_version = astropy_version\n            else:\n                lib_version = _astropy_version\n\n            xml_header = \"\"\"\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Produced with astropy.io.votable version {lib_version}\n     http://www.astropy.org/ -->\\n\"\"\"\n            w.write(xml_header.lstrip().format(**locals()))\n\n            # Build the VOTABLE tag attributes.\n            votable_attr = {\n                'version': version,\n                'xmlns:xsi': \"http://www.w3.org/2001/XMLSchema-instance\"\n            }\n            ns_info = self._version_namespace_map.get(version, {})\n            namespace_uri = ns_info.get('namespace_uri')\n            if namespace_uri:\n                votable_attr['xmlns'] = namespace_uri\n            schema_location_attr = ns_info.get('schema_location_attr')\n            schema_location_value = ns_info.get('schema_location_value')\n            if schema_location_attr and schema_location_value:\n                votable_attr[schema_location_attr] = schema_location_value\n\n            with w.tag('VOTABLE', votable_attr):\n                if self.description is not None:\n                    w.element(\"DESCRIPTION\", self.description, wrap=True)\n                element_sets = [self.coordinate_systems, self.time_systems,\n                                self.params, self.infos, self.resources]\n                if kwargs['version_1_2_or_later']:\n                    element_sets[0] = self.groups\n                for element_set in element_sets:\n                    for element in element_set:\n                        element.to_xml(w, **kwargs)"},{"attributeType":"null","col":8,"comment":"null","endLoc":726,"id":6371,"name":"_content","nodeType":"Attribute","startLoc":726,"text":"self._content"},{"col":0,"comment":"null","endLoc":134,"header":"def test_float_mask()","id":6372,"name":"test_float_mask","nodeType":"Function","startLoc":126,"text":"def test_float_mask():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='float',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    assert c.parse('') == (c.null, True)\n    with pytest.raises(ValueError):\n        c.parse('null')"},{"col":4,"comment":"null","endLoc":632,"header":"def parse_parts(self, parts, config=None, pos=None)","id":6373,"name":"parse_parts","nodeType":"Function","startLoc":620,"text":"def parse_parts(self, parts, config=None, pos=None):\n        base_parse = self._base.parse\n        result = []\n        result_mask = []\n        for x in parts:\n            value, mask = base_parse(x, config, pos)\n            result.append(value)\n            result_mask.append(mask)\n        result = np.array(result, dtype=self._base.format).reshape(\n            self._arraysize)\n        result_mask = np.array(result_mask, dtype='bool').reshape(\n            self._arraysize)\n        return result, result_mask"},{"attributeType":"null","col":8,"comment":"null","endLoc":667,"id":6374,"name":"value","nodeType":"Attribute","startLoc":667,"text":"self.value"},{"col":4,"comment":"null","endLoc":643,"header":"def output(self, value, mask)","id":6375,"name":"output","nodeType":"Function","startLoc":634,"text":"def output(self, value, mask):\n        base_output = self._base.output\n        value = np.asarray(value)\n        mask = np.asarray(mask)\n        if mask.size <= 1:\n            func = np.broadcast\n        else:  # When mask is already array but value is scalar, this prevents broadcast\n            func = zip\n        return ' '.join(base_output(x, m) for x, m in\n                        func(value.flat, mask.flat))"},{"col":4,"comment":"\n        Lookup the :class:`Param` instance that this :class:``PARAMref``\n        references.\n        ","endLoc":1985,"header":"def get_ref(self)","id":6376,"name":"get_ref","nodeType":"Function","startLoc":1975,"text":"def get_ref(self):\n        \"\"\"\n        Lookup the :class:`Param` instance that this :class:``PARAMref``\n        references.\n        \"\"\"\n        for param in self._table._votable.iter_fields_and_params():\n            if isinstance(param, Param) and param.ID == self.ref:\n                return param\n        vo_raise(\n            f\"No params named '{self.ref}'\",\n            self._config, self._pos, KeyError)"},{"className":"Values","col":0,"comment":"\n    VALUES_ element: used within FIELD_ and PARAM_ elements to define the domain of values.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    ","endLoc":1129,"id":6377,"nodeType":"Class","startLoc":812,"text":"class Values(Element, _IDProperty):\n    \"\"\"\n    VALUES_ element: used within FIELD_ and PARAM_ elements to define the domain of values.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    \"\"\"\n\n    def __init__(self, votable, field, ID=None, null=None, ref=None,\n                 type=\"legal\", id=None, config=None, pos=None, **extras):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        Element.__init__(self)\n\n        self._votable = votable\n        self._field = field\n        self.ID = resolve_id(ID, id, config, pos)\n        self.null = null\n        self._ref = ref\n        self.type = type\n\n        self.min = None\n        self.max = None\n        self.min_inclusive = True\n        self.max_inclusive = True\n        self._options = []\n\n        warn_unknown_attrs('VALUES', extras.keys(), config, pos)\n\n    def __repr__(self):\n        buff = io.StringIO()\n        self.to_xml(XMLWriter(buff))\n        return buff.getvalue().strip()\n\n    @property\n    def null(self):\n        \"\"\"\n        For integral datatypes, *null* is used to define the value\n        used for missing values.\n        \"\"\"\n        return self._null\n\n    @null.setter\n    def null(self, null):\n        if null is not None and isinstance(null, str):\n            try:\n                null_val = self._field.converter.parse_scalar(\n                    null, self._config, self._pos)[0]\n            except Exception:\n                warn_or_raise(W36, W36, null, self._config, self._pos)\n                null_val = self._field.converter.parse_scalar(\n                    '0', self._config, self._pos)[0]\n        else:\n            null_val = null\n        self._null = null_val\n\n    @null.deleter\n    def null(self):\n        self._null = None\n\n    @property\n    def type(self):\n        \"\"\"\n        [*required*] Defines the applicability of the domain defined\n        by this VALUES_ element.  Must be one of the following\n        strings:\n\n          - 'legal': The domain of this column applies in general to\n            this datatype. (default)\n\n          - 'actual': The domain of this column applies only to the\n            data enclosed in the parent table.\n        \"\"\"\n        return self._type\n\n    @type.setter\n    def type(self, type):\n        if type not in ('legal', 'actual'):\n            vo_raise(E08, type, self._config, self._pos)\n        self._type = type\n\n    @property\n    def ref(self):\n        \"\"\"\n        Refer to another VALUES_ element by ID_, defined previously in\n        the document, for MIN/MAX/OPTION information.\n        \"\"\"\n        return self._ref\n\n    @ref.setter\n    def ref(self, ref):\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        if ref is not None:\n            try:\n                other = self._votable.get_values_by_id(ref, before=self)\n            except KeyError:\n                warn_or_raise(W43, W43, ('VALUES', self.ref), self._config,\n                              self._pos)\n                ref = None\n            else:\n                self.null = other.null\n                self.type = other.type\n                self.min = other.min\n                self.min_inclusive = other.min_inclusive\n                self.max = other.max\n                self.max_inclusive = other.max_inclusive\n                self._options[:] = other.options\n        self._ref = ref\n\n    @ref.deleter\n    def ref(self):\n        self._ref = None\n\n    @property\n    def min(self):\n        \"\"\"\n        The minimum value of the domain.  See :attr:`min_inclusive`.\n        \"\"\"\n        return self._min\n\n    @min.setter\n    def min(self, min):\n        if hasattr(self._field, 'converter') and min is not None:\n            self._min = self._field.converter.parse(min)[0]\n        else:\n            self._min = min\n\n    @min.deleter\n    def min(self):\n        self._min = None\n\n    @property\n    def min_inclusive(self):\n        \"\"\"When `True`, the domain includes the minimum value.\"\"\"\n        return self._min_inclusive\n\n    @min_inclusive.setter\n    def min_inclusive(self, inclusive):\n        if inclusive == 'yes':\n            self._min_inclusive = True\n        elif inclusive == 'no':\n            self._min_inclusive = False\n        else:\n            self._min_inclusive = bool(inclusive)\n\n    @min_inclusive.deleter\n    def min_inclusive(self):\n        self._min_inclusive = True\n\n    @property\n    def max(self):\n        \"\"\"\n        The maximum value of the domain.  See :attr:`max_inclusive`.\n        \"\"\"\n        return self._max\n\n    @max.setter\n    def max(self, max):\n        if hasattr(self._field, 'converter') and max is not None:\n            self._max = self._field.converter.parse(max)[0]\n        else:\n            self._max = max\n\n    @max.deleter\n    def max(self):\n        self._max = None\n\n    @property\n    def max_inclusive(self):\n        \"\"\"When `True`, the domain includes the maximum value.\"\"\"\n        return self._max_inclusive\n\n    @max_inclusive.setter\n    def max_inclusive(self, inclusive):\n        if inclusive == 'yes':\n            self._max_inclusive = True\n        elif inclusive == 'no':\n            self._max_inclusive = False\n        else:\n            self._max_inclusive = bool(inclusive)\n\n    @max_inclusive.deleter\n    def max_inclusive(self):\n        self._max_inclusive = True\n\n    @property\n    def options(self):\n        \"\"\"\n        A list of string key-value tuples defining other OPTION\n        elements for the domain.  All options are ignored -- they are\n        stored for round-tripping purposes only.\n        \"\"\"\n        return self._options\n\n    def parse(self, iterator, config):\n        if self.ref is not None:\n            for start, tag, data, pos in iterator:\n                if start:\n                    warn_or_raise(W44, W44, tag, config, pos)\n                else:\n                    if tag != 'VALUES':\n                        warn_or_raise(W44, W44, tag, config, pos)\n                    break\n        else:\n            for start, tag, data, pos in iterator:\n                if start:\n                    if tag == 'MIN':\n                        if 'value' not in data:\n                            vo_raise(E09, 'MIN', config, pos)\n                        self.min = data['value']\n                        self.min_inclusive = data.get('inclusive', 'yes')\n                        warn_unknown_attrs(\n                            'MIN', data.keys(), config, pos,\n                            ['value', 'inclusive'])\n                    elif tag == 'MAX':\n                        if 'value' not in data:\n                            vo_raise(E09, 'MAX', config, pos)\n                        self.max = data['value']\n                        self.max_inclusive = data.get('inclusive', 'yes')\n                        warn_unknown_attrs(\n                            'MAX', data.keys(), config, pos,\n                            ['value', 'inclusive'])\n                    elif tag == 'OPTION':\n                        if 'value' not in data:\n                            vo_raise(E09, 'OPTION', config, pos)\n                        xmlutil.check_token(\n                            data.get('name'), 'name', config, pos)\n                        self.options.append(\n                            (data.get('name'), data.get('value')))\n                        warn_unknown_attrs(\n                            'OPTION', data.keys(), config, pos,\n                            ['value', 'name'])\n                elif tag == 'VALUES':\n                    break\n\n        return self\n\n    def is_defaults(self):\n        \"\"\"\n        Are the settings on this ``VALUE`` element all the same as the\n        XML defaults?\n        \"\"\"\n        # If there's nothing meaningful or non-default to write,\n        # don't write anything.\n        return (self.ref is None and self.null is None and self.ID is None and\n                self.max is None and self.min is None and self.options == [])\n\n    def to_xml(self, w, **kwargs):\n        def yes_no(value):\n            if value:\n                return 'yes'\n            return 'no'\n\n        if self.is_defaults():\n            return\n\n        if self.ref is not None:\n            w.element('VALUES', attrib=w.object_attrs(self, ['ref']))\n        else:\n            with w.tag('VALUES',\n                       attrib=w.object_attrs(\n                           self, ['ID', 'null', 'ref'])):\n                if self.min is not None:\n                    w.element(\n                        'MIN',\n                        value=self._field.converter.output(self.min, False),\n                        inclusive=yes_no(self.min_inclusive))\n                if self.max is not None:\n                    w.element(\n                        'MAX',\n                        value=self._field.converter.output(self.max, False),\n                        inclusive=yes_no(self.max_inclusive))\n                for name, value in self.options:\n                    w.element(\n                        'OPTION',\n                        name=name,\n                        value=value)\n\n    def to_table_column(self, column):\n        # Have the ref filled in here\n        meta = {}\n        for key in ['ID', 'null']:\n            val = getattr(self, key, None)\n            if val is not None:\n                meta[key] = val\n        if self.min is not None:\n            meta['min'] = {\n                'value': self.min,\n                'inclusive': self.min_inclusive}\n        if self.max is not None:\n            meta['max'] = {\n                'value': self.max,\n                'inclusive': self.max_inclusive}\n        if len(self.options):\n            meta['options'] = dict(self.options)\n\n        column.meta['values'] = meta\n\n    def from_table_column(self, column):\n        if column.info.meta is None or 'values' not in column.info.meta:\n            return\n\n        meta = column.info.meta['values']\n        for key in ['ID', 'null']:\n            val = meta.get(key, None)\n            if val is not None:\n                setattr(self, key, val)\n        if 'min' in meta:\n            self.min = meta['min']['value']\n            self.min_inclusive = meta['min']['inclusive']\n        if 'max' in meta:\n            self.max = meta['max']['value']\n            self.max_inclusive = meta['max']['inclusive']\n        if 'options' in meta:\n            self._options = list(meta['options'].items())"},{"col":4,"comment":"null","endLoc":847,"header":"def __repr__(self)","id":6378,"name":"__repr__","nodeType":"Function","startLoc":844,"text":"def __repr__(self):\n        buff = io.StringIO()\n        self.to_xml(XMLWriter(buff))\n        return buff.getvalue().strip()"},{"col":4,"comment":"null","endLoc":649,"header":"def binparse(self, read)","id":6379,"name":"binparse","nodeType":"Function","startLoc":645,"text":"def binparse(self, read):\n        result = np.frombuffer(read(self._memsize),\n                               dtype=self._bigendian_format)[0]\n        result_mask = self._base.is_null(result)\n        return result, result_mask"},{"col":4,"comment":"null","endLoc":222,"header":"def test_iter_fields_and_params_on_a_group(self)","id":6380,"name":"test_iter_fields_and_params_on_a_group","nodeType":"Function","startLoc":221,"text":"def test_iter_fields_and_params_on_a_group(self):\n        assert len(list(self.table.groups[1].iter_fields_and_params())) == 2"},{"col":4,"comment":"null","endLoc":654,"header":"def binoutput(self, value, mask)","id":6381,"name":"binoutput","nodeType":"Function","startLoc":651,"text":"def binoutput(self, value, mask):\n        filtered = self._base.filter_array(value, mask)\n        filtered = _ensure_bigendian(filtered)\n        return filtered.tobytes()"},{"col":4,"comment":"null","endLoc":225,"header":"def test_iter_groups_on_a_group(self)","id":6382,"name":"test_iter_groups_on_a_group","nodeType":"Function","startLoc":224,"text":"def test_iter_groups_on_a_group(self):\n        assert len(list(self.table.groups[1].iter_groups())) == 1"},{"col":4,"comment":"null","endLoc":52,"header":"def _ensure_bigendian(x)","id":6383,"name":"_ensure_bigendian","nodeType":"Function","startLoc":49,"text":"def _ensure_bigendian(x):\n        if x.dtype.byteorder != '>':\n            return x.byteswap()\n        return x"},{"col":4,"comment":"null","endLoc":57,"header":"def _ensure_bigendian(x)","id":6384,"name":"_ensure_bigendian","nodeType":"Function","startLoc":54,"text":"def _ensure_bigendian(x):\n        if x.dtype.byteorder == '<':\n            return x.byteswap()\n        return x"},{"col":0,"comment":"null","endLoc":146,"header":"def test_float_mask_permissive()","id":6385,"name":"test_float_mask_permissive","nodeType":"Function","startLoc":137,"text":"def test_float_mask_permissive():\n    config = {'verify': 'ignore'}\n    field = tree.Field(\n        None, name='c', datatype='float',\n        config=config)\n\n    # config needs to be also passed into parse() to work.\n    # https://github.com/astropy/astropy/issues/8775\n    c = converters.get_converter(field, config=config)\n    assert c.parse('null', config=config) == (c.null, True)"},{"col":4,"comment":"null","endLoc":230,"header":"def test_iter_groups(self)","id":6386,"name":"test_iter_groups","nodeType":"Function","startLoc":227,"text":"def test_iter_groups(self):\n        # Because of the ref'd table, there are more logical groups\n        # than actually exist in the file\n        assert len(list(self.votable.iter_groups())) == 9"},{"attributeType":"ArrayVarArray","col":4,"comment":"null","endLoc":581,"id":6387,"name":"vararray_type","nodeType":"Attribute","startLoc":581,"text":"vararray_type"},{"attributeType":"null","col":8,"comment":"null","endLoc":594,"id":6388,"name":"_memsize","nodeType":"Attribute","startLoc":594,"text":"self._memsize"},{"col":4,"comment":"null","endLoc":235,"header":"def test_ref_table(self)","id":6389,"name":"test_ref_table","nodeType":"Function","startLoc":232,"text":"def test_ref_table(self):\n        tables = list(self.votable.iter_tables())\n        for x, y in zip(tables[0].array.data[0], tables[1].array.data[0]):\n            assert_array_equal(x, y)"},{"attributeType":"null","col":8,"comment":"null","endLoc":597,"id":6390,"name":"default","nodeType":"Attribute","startLoc":597,"text":"self.default"},{"attributeType":"{format}","col":8,"comment":"null","endLoc":586,"id":6391,"name":"_base","nodeType":"Attribute","startLoc":586,"text":"self._base"},{"attributeType":"null","col":8,"comment":"null","endLoc":588,"id":6392,"name":"format","nodeType":"Attribute","startLoc":588,"text":"self.format"},{"col":4,"comment":"\n        Often, you know there is only one table in the file, and\n        that's all you need.  This method returns that first table.\n        ","endLoc":3718,"header":"def get_first_table(self)","id":6393,"name":"get_first_table","nodeType":"Function","startLoc":3710,"text":"def get_first_table(self):\n        \"\"\"\n        Often, you know there is only one table in the file, and\n        that's all you need.  This method returns that first table.\n        \"\"\"\n        for table in self.iter_tables():\n            if not table.is_empty():\n                return table\n        raise IndexError(\"No table found in VOTABLE file.\")"},{"attributeType":"{__iter__}","col":8,"comment":"null","endLoc":587,"id":6394,"name":"_arraysize","nodeType":"Attribute","startLoc":587,"text":"self._arraysize"},{"col":4,"comment":"null","endLoc":238,"header":"def test_iter_coosys(self)","id":6395,"name":"test_iter_coosys","nodeType":"Function","startLoc":237,"text":"def test_iter_coosys(self):\n        assert len(list(self.votable.iter_coosys())) == 1"},{"attributeType":"null","col":8,"comment":"null","endLoc":590,"id":6396,"name":"_items","nodeType":"Attribute","startLoc":590,"text":"self._items"},{"attributeType":"null","col":8,"comment":"null","endLoc":595,"id":6397,"name":"_bigendian_format","nodeType":"Attribute","startLoc":595,"text":"self._bigendian_format"},{"attributeType":"null","col":8,"comment":"null","endLoc":206,"id":6398,"name":"array","nodeType":"Attribute","startLoc":206,"text":"self.array"},{"attributeType":"null","col":8,"comment":"null","endLoc":204,"id":6399,"name":"votable","nodeType":"Attribute","startLoc":204,"text":"self.votable"},{"attributeType":"null","col":8,"comment":"null","endLoc":205,"id":6400,"name":"table","nodeType":"Attribute","startLoc":205,"text":"self.table"},{"attributeType":"null","col":8,"comment":"null","endLoc":207,"id":6401,"name":"mask","nodeType":"Attribute","startLoc":207,"text":"self.mask"},{"className":"Numeric","col":0,"comment":"\n    The base class for all numeric data types.\n    ","endLoc":683,"id":6402,"nodeType":"Class","startLoc":657,"text":"class Numeric(Converter):\n    \"\"\"\n    The base class for all numeric data types.\n    \"\"\"\n    array_type = NumericArray\n    vararray_type = ScalarVarArray\n    null = None\n\n    def __init__(self, field, config=None, pos=None):\n        Converter.__init__(self, field, config, pos)\n\n        self._memsize = np.dtype(self.format).itemsize\n        self._bigendian_format = '>' + self.format\n        if field.values.null is not None:\n            self.null = np.asarray(field.values.null, dtype=self.format)\n            self.default = self.null\n            self.is_null = self._is_null\n        else:\n            self.is_null = np.isnan\n\n    def binparse(self, read):\n        result = np.frombuffer(read(self._memsize),\n                               dtype=self._bigendian_format)\n        return result[0], self.is_null(result[0])\n\n    def _is_null(self, value):\n        return value == self.null"},{"col":4,"comment":"null","endLoc":675,"header":"def __init__(self, field, config=None, pos=None)","id":6403,"name":"__init__","nodeType":"Function","startLoc":665,"text":"def __init__(self, field, config=None, pos=None):\n        Converter.__init__(self, field, config, pos)\n\n        self._memsize = np.dtype(self.format).itemsize\n        self._bigendian_format = '>' + self.format\n        if field.values.null is not None:\n            self.null = np.asarray(field.values.null, dtype=self.format)\n            self.default = self.null\n            self.is_null = self._is_null\n        else:\n            self.is_null = np.isnan"},{"className":"TestParse","col":0,"comment":"null","endLoc":592,"id":6404,"nodeType":"Class","startLoc":266,"text":"class TestParse:\n    def setup_class(self):\n        self.votable = parse(get_pkg_data_filename('data/regression.xml'))\n        self.table = self.votable.get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask\n\n    def test_string_test(self):\n        assert issubclass(self.array['string_test'].dtype.type,\n                          np.object_)\n        assert_array_equal(\n            self.array['string_test'],\n            ['String & test', 'String &amp; test', 'XXXX', '', ''])\n\n    def test_fixed_string_test(self):\n        assert issubclass(self.array['string_test_2'].dtype.type,\n                          np.unicode_)\n        assert_array_equal(\n            self.array['string_test_2'],\n            ['Fixed stri', '0123456789', 'XXXX', '', ''])\n\n    def test_unicode_test(self):\n        assert issubclass(self.array['unicode_test'].dtype.type,\n                          np.object_)\n        assert_array_equal(self.array['unicode_test'],\n                           [\"Ceçi n'est pas un pipe\",\n                            'வணக்கம்',\n                            'XXXX', '', ''])\n\n    def test_fixed_unicode_test(self):\n        assert issubclass(self.array['fixed_unicode_test'].dtype.type,\n                          np.unicode_)\n        assert_array_equal(self.array['fixed_unicode_test'],\n                           [\"Ceçi n'est\",\n                            'வணக்கம்',\n                            '0123456789', '', ''])\n\n    def test_unsignedByte(self):\n        assert issubclass(self.array['unsignedByte'].dtype.type,\n                          np.uint8)\n        assert_array_equal(self.array['unsignedByte'],\n                           [128, 255, 0, 255, 255])\n        assert not np.any(self.mask['unsignedByte'])\n\n    def test_short(self):\n        assert issubclass(self.array['short'].dtype.type,\n                          np.int16)\n        assert_array_equal(self.array['short'],\n                           [4096, 32767, -4096, 32767, 32767])\n        assert not np.any(self.mask['short'])\n\n    def test_int(self):\n        assert issubclass(self.array['int'].dtype.type,\n                          np.int32)\n        assert_array_equal(\n            self.array['int'],\n            [268435456, 2147483647, -268435456, 268435455, 123456789])\n        assert_array_equal(self.mask['int'],\n                           [False, False, False, False, True])\n\n    def test_long(self):\n        assert issubclass(self.array['long'].dtype.type,\n                          np.int64)\n        assert_array_equal(\n            self.array['long'],\n            [922337203685477, 123456789, -1152921504606846976,\n             1152921504606846975, 123456789])\n        assert_array_equal(self.mask['long'],\n                           [False, True, False, False, True])\n\n    def test_double(self):\n        assert issubclass(self.array['double'].dtype.type,\n                          np.float64)\n        assert_array_equal(self.array['double'],\n                           [8.9990234375, 0.0, np.inf, np.nan, -np.inf])\n        assert_array_equal(self.mask['double'],\n                           [False, False, False, True, False])\n\n    def test_float(self):\n        assert issubclass(self.array['float'].dtype.type,\n                          np.float32)\n        assert_array_equal(self.array['float'],\n                           [1.0, 0.0, np.inf, np.inf, np.nan])\n        assert_array_equal(self.mask['float'],\n                           [False, False, False, False, True])\n\n    def test_array(self):\n        assert issubclass(self.array['array'].dtype.type,\n                          np.object_)\n        match = [[],\n                 [[42, 32], [12, 32]],\n                 [[12, 34], [56, 78], [87, 65], [43, 21]],\n                 [[-1, 23]],\n                 [[31, -1]]]\n        for a, b in zip(self.array['array'], match):\n            # assert issubclass(a.dtype.type, np.int64)\n            # assert a.shape[1] == 2\n            for a0, b0 in zip(a, b):\n                assert issubclass(a0.dtype.type, np.int64)\n                assert_array_equal(a0, b0)\n        assert self.array.data['array'][3].mask[0][0]\n        assert self.array.data['array'][4].mask[0][1]\n\n    def test_bit(self):\n        assert issubclass(self.array['bit'].dtype.type,\n                          np.bool_)\n        assert_array_equal(self.array['bit'],\n                           [True, False, True, False, False])\n\n    def test_bit_mask(self):\n        assert_array_equal(self.mask['bit'],\n                           [False, False, False, False, True])\n\n    def test_bitarray(self):\n        assert issubclass(self.array['bitarray'].dtype.type,\n                          np.bool_)\n        assert self.array['bitarray'].shape == (5, 3, 2)\n        assert_array_equal(self.array['bitarray'],\n                           [[[True, False],\n                             [True, True],\n                             [False, True]],\n\n                            [[False, True],\n                             [False, False],\n                             [True, True]],\n\n                            [[True, True],\n                             [True, False],\n                             [False, False]],\n\n                            [[False, False],\n                             [False, False],\n                             [False, False]],\n\n                            [[False, False],\n                             [False, False],\n                             [False, False]]])\n\n    def test_bitarray_mask(self):\n        assert_array_equal(self.mask['bitarray'],\n                           [[[False, False],\n                             [False, False],\n                             [False, False]],\n\n                            [[False, False],\n                             [False, False],\n                             [False, False]],\n\n                            [[False, False],\n                             [False, False],\n                             [False, False]],\n\n                            [[True, True],\n                             [True, True],\n                             [True, True]],\n\n                            [[True, True],\n                             [True, True],\n                             [True, True]]])\n\n    def test_bitvararray(self):\n        assert issubclass(self.array['bitvararray'].dtype.type,\n                          np.object_)\n        match = [[True, True, True],\n                 [False, False, False, False, False],\n                 [True, False, True, False, True],\n                 [], []]\n        for a, b in zip(self.array['bitvararray'], match):\n            assert_array_equal(a, b)\n        match_mask = [[False, False, False],\n                      [False, False, False, False, False],\n                      [False, False, False, False, False],\n                      False, False]\n        for a, b in zip(self.array['bitvararray'], match_mask):\n            assert_array_equal(a.mask, b)\n\n    def test_bitvararray2(self):\n        assert issubclass(self.array['bitvararray2'].dtype.type,\n                          np.object_)\n        match = [[],\n\n                 [[[False, True],\n                   [False, False],\n                   [True, False]],\n                  [[True, False],\n                   [True, False],\n                   [True, False]]],\n\n                 [[[True, True],\n                   [True, True],\n                   [True, True]]],\n\n                 [],\n\n                 []]\n        for a, b in zip(self.array['bitvararray2'], match):\n            for a0, b0 in zip(a, b):\n                assert a0.shape == (3, 2)\n                assert issubclass(a0.dtype.type, np.bool_)\n                assert_array_equal(a0, b0)\n\n    def test_floatComplex(self):\n        assert issubclass(self.array['floatComplex'].dtype.type,\n                          np.complex64)\n        assert_array_equal(self.array['floatComplex'],\n                           [np.nan+0j, 0+0j, 0+-1j, np.nan+0j, np.nan+0j])\n        assert_array_equal(self.mask['floatComplex'],\n                           [True, False, False, True, True])\n\n    def test_doubleComplex(self):\n        assert issubclass(self.array['doubleComplex'].dtype.type,\n                          np.complex128)\n        assert_array_equal(\n            self.array['doubleComplex'],\n            [np.nan+0j, 0+0j, 0+-1j, np.nan+(np.inf*1j), np.nan+0j])\n        assert_array_equal(self.mask['doubleComplex'],\n                           [True, False, False, True, True])\n\n    def test_doubleComplexArray(self):\n        assert issubclass(self.array['doubleComplexArray'].dtype.type,\n                          np.object_)\n        assert ([len(x) for x in self.array['doubleComplexArray']] ==\n                [0, 2, 2, 0, 0])\n\n    def test_boolean(self):\n        assert issubclass(self.array['boolean'].dtype.type,\n                          np.bool_)\n        assert_array_equal(self.array['boolean'],\n                           [True, False, True, False, False])\n\n    def test_boolean_mask(self):\n        assert_array_equal(self.mask['boolean'],\n                           [False, False, False, False, True])\n\n    def test_boolean_array(self):\n        assert issubclass(self.array['booleanArray'].dtype.type,\n                          np.bool_)\n        assert_array_equal(self.array['booleanArray'],\n                           [[True, True, True, True],\n                            [True, True, False, True],\n                            [True, True, False, True],\n                            [False, False, False, False],\n                            [False, False, False, False]])\n\n    def test_boolean_array_mask(self):\n        assert_array_equal(self.mask['booleanArray'],\n                           [[False, False, False, False],\n                            [False, False, False, False],\n                            [False, False, True, False],\n                            [True, True, True, True],\n                            [True, True, True, True]])\n\n    def test_nulls(self):\n        assert_array_equal(self.array['nulls'],\n                           [0, -9, 2, -9, -9])\n        assert_array_equal(self.mask['nulls'],\n                           [False, True, False, True, True])\n\n    def test_nulls_array(self):\n        assert_array_equal(self.array['nulls_array'],\n                           [[[-9, -9], [-9, -9]],\n                            [[0, 1], [2, 3]],\n                            [[-9, 0], [-9, 1]],\n                            [[0, -9], [1, -9]],\n                            [[-9, -9], [-9, -9]]])\n        assert_array_equal(self.mask['nulls_array'],\n                           [[[True, True],\n                             [True, True]],\n\n                            [[False, False],\n                             [False, False]],\n\n                            [[True, False],\n                             [True, False]],\n\n                            [[False, True],\n                             [False, True]],\n\n                            [[True, True],\n                             [True, True]]])\n\n    def test_double_array(self):\n        assert issubclass(self.array['doublearray'].dtype.type,\n                          np.object_)\n        assert len(self.array['doublearray'][0]) == 0\n        assert_array_equal(self.array['doublearray'][1],\n                           [0, 1, np.inf, -np.inf, np.nan, 0, -1])\n        assert_array_equal(self.array.data['doublearray'][1].mask,\n                           [False, False, False, False, False, False, True])\n\n    def test_bit_array2(self):\n        assert_array_equal(self.array['bitarray2'][0],\n                           [True, True, True, True,\n                            False, False, False, False,\n                            True, True, True, True,\n                            False, False, False, False])\n\n    def test_bit_array2_mask(self):\n        assert not np.any(self.mask['bitarray2'][0])\n        assert np.all(self.mask['bitarray2'][1:])\n\n    def test_get_coosys_by_id(self):\n        coosys = self.votable.get_coosys_by_id('J2000')\n        assert coosys.system == 'eq_FK5'\n\n    def test_get_field_by_utype(self):\n        fields = list(self.votable.get_fields_by_utype(\"myint\"))\n        assert fields[0].name == \"int\"\n        assert fields[0].values.min == -1000\n\n    def test_get_info_by_id(self):\n        info = self.votable.get_info_by_id('QUERY_STATUS')\n        assert info.value == 'OK'\n\n        if self.votable.version != '1.1':\n            info = self.votable.get_info_by_id(\"ErrorInfo\")\n            assert info.value == \"One might expect to find some INFO here, too...\"  # noqa\n\n    def test_repr(self):\n        assert '3 tables' in repr(self.votable)\n        assert repr(list(self.votable.iter_fields_and_params())[0]) == \\\n            '<PARAM ID=\"awesome\" arraysize=\"*\" datatype=\"float\" name=\"INPUT\" unit=\"deg\" value=\"[0.0 0.0]\"/>'  # noqa\n        # Smoke test\n        repr(list(self.votable.iter_groups()))\n\n        # Resource\n        assert repr(self.votable.resources) == '[</>]'"},{"col":4,"comment":"null","endLoc":271,"header":"def setup_class(self)","id":6405,"name":"setup_class","nodeType":"Function","startLoc":267,"text":"def setup_class(self):\n        self.votable = parse(get_pkg_data_filename('data/regression.xml'))\n        self.table = self.votable.get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask"},{"col":0,"comment":"null","endLoc":179,"header":"def test_double_array()","id":6406,"name":"test_double_array","nodeType":"Function","startLoc":149,"text":"def test_double_array():\n    config = {'verify': 'exception', 'version_1_3_or_later': True}\n    field = tree.Field(None, name='c', datatype='double', arraysize='3',\n                       config=config)\n    data = (1.0, 2.0, 3.0)\n    c = converters.get_converter(field, config=config)\n    assert c.output(1.0, False) == '1'\n    assert c.output(1.0, [False, False]) == '1'\n    assert c.output(data, False) == '1 2 3'\n    assert c.output(data, [False, False, False]) == '1 2 3'\n    assert c.output(data, [False, False, True]) == '1 2 NaN'\n    assert c.output(data, [False, False]) == '1 2'\n\n    a = c.parse(\"1 2 3\", config=config)\n    assert_array_equal(a[0], data)\n    assert_array_equal(a[1], False)\n\n    with pytest.raises(exceptions.E02):\n        c.parse(\"1\", config=config)\n\n    with pytest.raises(AttributeError), pytest.warns(exceptions.E02):\n        c.parse(\"1\")\n\n    with pytest.raises(exceptions.E02):\n        c.parse(\"2 3 4 5 6\", config=config)\n\n    with pytest.warns(exceptions.E02):\n        a = c.parse(\"2 3 4 5 6\")\n\n    assert_array_equal(a[0], [2, 3, 4])\n    assert_array_equal(a[1], False)"},{"col":4,"comment":"null","endLoc":680,"header":"def binparse(self, read)","id":6407,"name":"binparse","nodeType":"Function","startLoc":677,"text":"def binparse(self, read):\n        result = np.frombuffer(read(self._memsize),\n                               dtype=self._bigendian_format)\n        return result[0], self.is_null(result[0])"},{"col":4,"comment":"null","endLoc":278,"header":"def test_string_test(self)","id":6408,"name":"test_string_test","nodeType":"Function","startLoc":273,"text":"def test_string_test(self):\n        assert issubclass(self.array['string_test'].dtype.type,\n                          np.object_)\n        assert_array_equal(\n            self.array['string_test'],\n            ['String & test', 'String &amp; test', 'XXXX', '', ''])"},{"col":4,"comment":"null","endLoc":285,"header":"def test_fixed_string_test(self)","id":6409,"name":"test_fixed_string_test","nodeType":"Function","startLoc":280,"text":"def test_fixed_string_test(self):\n        assert issubclass(self.array['string_test_2'].dtype.type,\n                          np.unicode_)\n        assert_array_equal(\n            self.array['string_test_2'],\n            ['Fixed stri', '0123456789', 'XXXX', '', ''])"},{"col":4,"comment":"null","endLoc":293,"header":"def test_unicode_test(self)","id":6410,"name":"test_unicode_test","nodeType":"Function","startLoc":287,"text":"def test_unicode_test(self):\n        assert issubclass(self.array['unicode_test'].dtype.type,\n                          np.object_)\n        assert_array_equal(self.array['unicode_test'],\n                           [\"Ceçi n'est pas un pipe\",\n                            'வணக்கம்',\n                            'XXXX', '', ''])"},{"col":4,"comment":"null","endLoc":301,"header":"def test_fixed_unicode_test(self)","id":6411,"name":"test_fixed_unicode_test","nodeType":"Function","startLoc":295,"text":"def test_fixed_unicode_test(self):\n        assert issubclass(self.array['fixed_unicode_test'].dtype.type,\n                          np.unicode_)\n        assert_array_equal(self.array['fixed_unicode_test'],\n                           [\"Ceçi n'est\",\n                            'வணக்கம்',\n                            '0123456789', '', ''])"},{"col":4,"comment":"null","endLoc":308,"header":"def test_unsignedByte(self)","id":6412,"name":"test_unsignedByte","nodeType":"Function","startLoc":303,"text":"def test_unsignedByte(self):\n        assert issubclass(self.array['unsignedByte'].dtype.type,\n                          np.uint8)\n        assert_array_equal(self.array['unsignedByte'],\n                           [128, 255, 0, 255, 255])\n        assert not np.any(self.mask['unsignedByte'])"},{"col":4,"comment":"null","endLoc":315,"header":"def test_short(self)","id":6413,"name":"test_short","nodeType":"Function","startLoc":310,"text":"def test_short(self):\n        assert issubclass(self.array['short'].dtype.type,\n                          np.int16)\n        assert_array_equal(self.array['short'],\n                           [4096, 32767, -4096, 32767, 32767])\n        assert not np.any(self.mask['short'])"},{"col":4,"comment":"null","endLoc":324,"header":"def test_int(self)","id":6414,"name":"test_int","nodeType":"Function","startLoc":317,"text":"def test_int(self):\n        assert issubclass(self.array['int'].dtype.type,\n                          np.int32)\n        assert_array_equal(\n            self.array['int'],\n            [268435456, 2147483647, -268435456, 268435455, 123456789])\n        assert_array_equal(self.mask['int'],\n                           [False, False, False, False, True])"},{"col":4,"comment":"null","endLoc":334,"header":"def test_long(self)","id":6415,"name":"test_long","nodeType":"Function","startLoc":326,"text":"def test_long(self):\n        assert issubclass(self.array['long'].dtype.type,\n                          np.int64)\n        assert_array_equal(\n            self.array['long'],\n            [922337203685477, 123456789, -1152921504606846976,\n             1152921504606846975, 123456789])\n        assert_array_equal(self.mask['long'],\n                           [False, True, False, False, True])"},{"col":4,"comment":"null","endLoc":342,"header":"def test_double(self)","id":6416,"name":"test_double","nodeType":"Function","startLoc":336,"text":"def test_double(self):\n        assert issubclass(self.array['double'].dtype.type,\n                          np.float64)\n        assert_array_equal(self.array['double'],\n                           [8.9990234375, 0.0, np.inf, np.nan, -np.inf])\n        assert_array_equal(self.mask['double'],\n                           [False, False, False, True, False])"},{"col":4,"comment":"null","endLoc":683,"header":"def _is_null(self, value)","id":6417,"name":"_is_null","nodeType":"Function","startLoc":682,"text":"def _is_null(self, value):\n        return value == self.null"},{"attributeType":"NumericArray","col":4,"comment":"null","endLoc":661,"id":6418,"name":"array_type","nodeType":"Attribute","startLoc":661,"text":"array_type"},{"col":4,"comment":"null","endLoc":350,"header":"def test_float(self)","id":6419,"name":"test_float","nodeType":"Function","startLoc":344,"text":"def test_float(self):\n        assert issubclass(self.array['float'].dtype.type,\n                          np.float32)\n        assert_array_equal(self.array['float'],\n                           [1.0, 0.0, np.inf, np.inf, np.nan])\n        assert_array_equal(self.mask['float'],\n                           [False, False, False, False, True])"},{"col":4,"comment":"null","endLoc":367,"header":"def test_array(self)","id":6420,"name":"test_array","nodeType":"Function","startLoc":352,"text":"def test_array(self):\n        assert issubclass(self.array['array'].dtype.type,\n                          np.object_)\n        match = [[],\n                 [[42, 32], [12, 32]],\n                 [[12, 34], [56, 78], [87, 65], [43, 21]],\n                 [[-1, 23]],\n                 [[31, -1]]]\n        for a, b in zip(self.array['array'], match):\n            # assert issubclass(a.dtype.type, np.int64)\n            # assert a.shape[1] == 2\n            for a0, b0 in zip(a, b):\n                assert issubclass(a0.dtype.type, np.int64)\n                assert_array_equal(a0, b0)\n        assert self.array.data['array'][3].mask[0][0]\n        assert self.array.data['array'][4].mask[0][1]"},{"attributeType":"ScalarVarArray","col":4,"comment":"null","endLoc":662,"id":6421,"name":"vararray_type","nodeType":"Attribute","startLoc":662,"text":"vararray_type"},{"attributeType":"None","col":4,"comment":"null","endLoc":663,"id":6422,"name":"null","nodeType":"Attribute","startLoc":663,"text":"null"},{"col":4,"comment":"null","endLoc":373,"header":"def test_bit(self)","id":6423,"name":"test_bit","nodeType":"Function","startLoc":369,"text":"def test_bit(self):\n        assert issubclass(self.array['bit'].dtype.type,\n                          np.bool_)\n        assert_array_equal(self.array['bit'],\n                           [True, False, True, False, False])"},{"attributeType":"null","col":8,"comment":"null","endLoc":668,"id":6424,"name":"_memsize","nodeType":"Attribute","startLoc":668,"text":"self._memsize"},{"col":4,"comment":"null","endLoc":377,"header":"def test_bit_mask(self)","id":6425,"name":"test_bit_mask","nodeType":"Function","startLoc":375,"text":"def test_bit_mask(self):\n        assert_array_equal(self.mask['bit'],\n                           [False, False, False, False, True])"},{"col":4,"comment":"null","endLoc":402,"header":"def test_bitarray(self)","id":6426,"name":"test_bitarray","nodeType":"Function","startLoc":379,"text":"def test_bitarray(self):\n        assert issubclass(self.array['bitarray'].dtype.type,\n                          np.bool_)\n        assert self.array['bitarray'].shape == (5, 3, 2)\n        assert_array_equal(self.array['bitarray'],\n                           [[[True, False],\n                             [True, True],\n                             [False, True]],\n\n                            [[False, True],\n                             [False, False],\n                             [True, True]],\n\n                            [[True, True],\n                             [True, False],\n                             [False, False]],\n\n                            [[False, False],\n                             [False, False],\n                             [False, False]],\n\n                            [[False, False],\n                             [False, False],\n                             [False, False]]])"},{"col":4,"comment":"null","endLoc":424,"header":"def test_bitarray_mask(self)","id":6427,"name":"test_bitarray_mask","nodeType":"Function","startLoc":404,"text":"def test_bitarray_mask(self):\n        assert_array_equal(self.mask['bitarray'],\n                           [[[False, False],\n                             [False, False],\n                             [False, False]],\n\n                            [[False, False],\n                             [False, False],\n                             [False, False]],\n\n                            [[False, False],\n                             [False, False],\n                             [False, False]],\n\n                            [[True, True],\n                             [True, True],\n                             [True, True]],\n\n                            [[True, True],\n                             [True, True],\n                             [True, True]]])"},{"col":4,"comment":"null","endLoc":1091,"header":"def to_xml(self, w, **kwargs)","id":6428,"name":"to_xml","nodeType":"Function","startLoc":1062,"text":"def to_xml(self, w, **kwargs):\n        def yes_no(value):\n            if value:\n                return 'yes'\n            return 'no'\n\n        if self.is_defaults():\n            return\n\n        if self.ref is not None:\n            w.element('VALUES', attrib=w.object_attrs(self, ['ref']))\n        else:\n            with w.tag('VALUES',\n                       attrib=w.object_attrs(\n                           self, ['ID', 'null', 'ref'])):\n                if self.min is not None:\n                    w.element(\n                        'MIN',\n                        value=self._field.converter.output(self.min, False),\n                        inclusive=yes_no(self.min_inclusive))\n                if self.max is not None:\n                    w.element(\n                        'MAX',\n                        value=self._field.converter.output(self.max, False),\n                        inclusive=yes_no(self.max_inclusive))\n                for name, value in self.options:\n                    w.element(\n                        'OPTION',\n                        name=name,\n                        value=value)"},{"col":4,"comment":"null","endLoc":440,"header":"def test_bitvararray(self)","id":6429,"name":"test_bitvararray","nodeType":"Function","startLoc":426,"text":"def test_bitvararray(self):\n        assert issubclass(self.array['bitvararray'].dtype.type,\n                          np.object_)\n        match = [[True, True, True],\n                 [False, False, False, False, False],\n                 [True, False, True, False, True],\n                 [], []]\n        for a, b in zip(self.array['bitvararray'], match):\n            assert_array_equal(a, b)\n        match_mask = [[False, False, False],\n                      [False, False, False, False, False],\n                      [False, False, False, False, False],\n                      False, False]\n        for a, b in zip(self.array['bitvararray'], match_mask):\n            assert_array_equal(a.mask, b)"},{"attributeType":"null","col":12,"comment":"null","endLoc":672,"id":6430,"name":"default","nodeType":"Attribute","startLoc":672,"text":"self.default"},{"col":4,"comment":"null","endLoc":465,"header":"def test_bitvararray2(self)","id":6431,"name":"test_bitvararray2","nodeType":"Function","startLoc":442,"text":"def test_bitvararray2(self):\n        assert issubclass(self.array['bitvararray2'].dtype.type,\n                          np.object_)\n        match = [[],\n\n                 [[[False, True],\n                   [False, False],\n                   [True, False]],\n                  [[True, False],\n                   [True, False],\n                   [True, False]]],\n\n                 [[[True, True],\n                   [True, True],\n                   [True, True]]],\n\n                 [],\n\n                 []]\n        for a, b in zip(self.array['bitvararray2'], match):\n            for a0, b0 in zip(a, b):\n                assert a0.shape == (3, 2)\n                assert issubclass(a0.dtype.type, np.bool_)\n                assert_array_equal(a0, b0)"},{"col":4,"comment":"null","endLoc":473,"header":"def test_floatComplex(self)","id":6432,"name":"test_floatComplex","nodeType":"Function","startLoc":467,"text":"def test_floatComplex(self):\n        assert issubclass(self.array['floatComplex'].dtype.type,\n                          np.complex64)\n        assert_array_equal(self.array['floatComplex'],\n                           [np.nan+0j, 0+0j, 0+-1j, np.nan+0j, np.nan+0j])\n        assert_array_equal(self.mask['floatComplex'],\n                           [True, False, False, True, True])"},{"col":4,"comment":"null","endLoc":482,"header":"def test_doubleComplex(self)","id":6433,"name":"test_doubleComplex","nodeType":"Function","startLoc":475,"text":"def test_doubleComplex(self):\n        assert issubclass(self.array['doubleComplex'].dtype.type,\n                          np.complex128)\n        assert_array_equal(\n            self.array['doubleComplex'],\n            [np.nan+0j, 0+0j, 0+-1j, np.nan+(np.inf*1j), np.nan+0j])\n        assert_array_equal(self.mask['doubleComplex'],\n                           [True, False, False, True, True])"},{"col":4,"comment":"null","endLoc":488,"header":"def test_doubleComplexArray(self)","id":6434,"name":"test_doubleComplexArray","nodeType":"Function","startLoc":484,"text":"def test_doubleComplexArray(self):\n        assert issubclass(self.array['doubleComplexArray'].dtype.type,\n                          np.object_)\n        assert ([len(x) for x in self.array['doubleComplexArray']] ==\n                [0, 2, 2, 0, 0])"},{"attributeType":"null","col":12,"comment":"null","endLoc":671,"id":6435,"name":"null","nodeType":"Attribute","startLoc":671,"text":"self.null"},{"attributeType":"null","col":12,"comment":"null","endLoc":675,"id":6436,"name":"is_null","nodeType":"Attribute","startLoc":675,"text":"self.is_null"},{"attributeType":"null","col":8,"comment":"null","endLoc":669,"id":6437,"name":"_bigendian_format","nodeType":"Attribute","startLoc":669,"text":"self._bigendian_format"},{"col":4,"comment":"null","endLoc":494,"header":"def test_boolean(self)","id":6438,"name":"test_boolean","nodeType":"Function","startLoc":490,"text":"def test_boolean(self):\n        assert issubclass(self.array['boolean'].dtype.type,\n                          np.bool_)\n        assert_array_equal(self.array['boolean'],\n                           [True, False, True, False, False])"},{"col":4,"comment":"null","endLoc":498,"header":"def test_boolean_mask(self)","id":6439,"name":"test_boolean_mask","nodeType":"Function","startLoc":496,"text":"def test_boolean_mask(self):\n        assert_array_equal(self.mask['boolean'],\n                           [False, False, False, False, True])"},{"col":4,"comment":"null","endLoc":508,"header":"def test_boolean_array(self)","id":6440,"name":"test_boolean_array","nodeType":"Function","startLoc":500,"text":"def test_boolean_array(self):\n        assert issubclass(self.array['booleanArray'].dtype.type,\n                          np.bool_)\n        assert_array_equal(self.array['booleanArray'],\n                           [[True, True, True, True],\n                            [True, True, False, True],\n                            [True, True, False, True],\n                            [False, False, False, False],\n                            [False, False, False, False]])"},{"col":4,"comment":"null","endLoc":516,"header":"def test_boolean_array_mask(self)","id":6441,"name":"test_boolean_array_mask","nodeType":"Function","startLoc":510,"text":"def test_boolean_array_mask(self):\n        assert_array_equal(self.mask['booleanArray'],\n                           [[False, False, False, False],\n                            [False, False, False, False],\n                            [False, False, True, False],\n                            [True, True, True, True],\n                            [True, True, True, True]])"},{"col":4,"comment":"null","endLoc":522,"header":"def test_nulls(self)","id":6442,"name":"test_nulls","nodeType":"Function","startLoc":518,"text":"def test_nulls(self):\n        assert_array_equal(self.array['nulls'],\n                           [0, -9, 2, -9, -9])\n        assert_array_equal(self.mask['nulls'],\n                           [False, True, False, True, True])"},{"className":"FloatingPoint","col":0,"comment":"\n    The base class for floating-point datatypes.\n    ","endLoc":794,"id":6443,"nodeType":"Class","startLoc":686,"text":"class FloatingPoint(Numeric):\n    \"\"\"\n    The base class for floating-point datatypes.\n    \"\"\"\n    default = np.nan\n\n    def __init__(self, field, config=None, pos=None):\n        if config is None:\n            config = {}\n\n        Numeric.__init__(self, field, config, pos)\n\n        precision = field.precision\n        width = field.width\n\n        if precision is None:\n            format_parts = ['{!r:>']\n        else:\n            format_parts = ['{:']\n\n        if width is not None:\n            format_parts.append(str(width))\n\n        if precision is not None:\n            if precision.startswith(\"E\"):\n                format_parts.append(f'.{int(precision[1:]):d}g')\n            elif precision.startswith(\"F\"):\n                format_parts.append(f'.{int(precision[1:]):d}f')\n            else:\n                format_parts.append(f'.{int(precision):d}f')\n\n        format_parts.append('}')\n\n        self._output_format = ''.join(format_parts)\n\n        self.nan = np.array(np.nan, self.format)\n\n        if self.null is None:\n            self._null_output = 'NaN'\n            self._null_binoutput = self.binoutput(self.nan, False)\n            self.filter_array = self._filter_nan\n        else:\n            self._null_output = self.output(np.asarray(self.null), False)\n            self._null_binoutput = self.binoutput(np.asarray(self.null), False)\n            self.filter_array = self._filter_null\n\n        if config.get('verify', 'ignore') == 'exception':\n            self.parse = self._parse_pedantic\n        else:\n            self.parse = self._parse_permissive\n\n    def supports_empty_values(self, config):\n        return True\n\n    def _parse_pedantic(self, value, config=None, pos=None):\n        if value.strip() == '':\n            return self.null, True\n        f = float(value)\n        return f, self.is_null(f)\n\n    def _parse_permissive(self, value, config=None, pos=None):\n        try:\n            f = float(value)\n            return f, self.is_null(f)\n        except ValueError:\n            # IRSA VOTables use the word 'null' to specify empty values,\n            # but this is not defined in the VOTable spec.\n            if value.strip() != '':\n                vo_warn(W30, value, config, pos)\n            return self.null, True\n\n    @property\n    def output_format(self):\n        return self._output_format\n\n    def output(self, value, mask):\n        if mask:\n            return self._null_output\n        if np.isfinite(value):\n            if not np.isscalar(value):\n                value = value.dtype.type(value)\n            result = self._output_format.format(value)\n            if result.startswith('array'):\n                raise RuntimeError()\n            if (self._output_format[2] == 'r' and\n                result.endswith('.0')):\n                result = result[:-2]\n            return result\n        elif np.isnan(value):\n            return 'NaN'\n        elif np.isposinf(value):\n            return '+InF'\n        elif np.isneginf(value):\n            return '-InF'\n        # Should never raise\n        vo_raise(f\"Invalid floating point value '{value}'\")\n\n    def binoutput(self, value, mask):\n        if mask:\n            return self._null_binoutput\n\n        value = _ensure_bigendian(value)\n        return value.tobytes()\n\n    def _filter_nan(self, value, mask):\n        return np.where(mask, np.nan, value)\n\n    def _filter_null(self, value, mask):\n        return np.where(mask, self.null, value)"},{"col":4,"comment":"null","endLoc":545,"header":"def test_nulls_array(self)","id":6444,"name":"test_nulls_array","nodeType":"Function","startLoc":524,"text":"def test_nulls_array(self):\n        assert_array_equal(self.array['nulls_array'],\n                           [[[-9, -9], [-9, -9]],\n                            [[0, 1], [2, 3]],\n                            [[-9, 0], [-9, 1]],\n                            [[0, -9], [1, -9]],\n                            [[-9, -9], [-9, -9]]])\n        assert_array_equal(self.mask['nulls_array'],\n                           [[[True, True],\n                             [True, True]],\n\n                            [[False, False],\n                             [False, False]],\n\n                            [[True, False],\n                             [True, False]],\n\n                            [[False, True],\n                             [False, True]],\n\n                            [[True, True],\n                             [True, True]]])"},{"col":4,"comment":"null","endLoc":735,"header":"def __init__(self, field, config=None, pos=None)","id":6445,"name":"__init__","nodeType":"Function","startLoc":692,"text":"def __init__(self, field, config=None, pos=None):\n        if config is None:\n            config = {}\n\n        Numeric.__init__(self, field, config, pos)\n\n        precision = field.precision\n        width = field.width\n\n        if precision is None:\n            format_parts = ['{!r:>']\n        else:\n            format_parts = ['{:']\n\n        if width is not None:\n            format_parts.append(str(width))\n\n        if precision is not None:\n            if precision.startswith(\"E\"):\n                format_parts.append(f'.{int(precision[1:]):d}g')\n            elif precision.startswith(\"F\"):\n                format_parts.append(f'.{int(precision[1:]):d}f')\n            else:\n                format_parts.append(f'.{int(precision):d}f')\n\n        format_parts.append('}')\n\n        self._output_format = ''.join(format_parts)\n\n        self.nan = np.array(np.nan, self.format)\n\n        if self.null is None:\n            self._null_output = 'NaN'\n            self._null_binoutput = self.binoutput(self.nan, False)\n            self.filter_array = self._filter_nan\n        else:\n            self._null_output = self.output(np.asarray(self.null), False)\n            self._null_binoutput = self.binoutput(np.asarray(self.null), False)\n            self.filter_array = self._filter_null\n\n        if config.get('verify', 'ignore') == 'exception':\n            self.parse = self._parse_pedantic\n        else:\n            self.parse = self._parse_permissive"},{"col":4,"comment":"null","endLoc":554,"header":"def test_double_array(self)","id":6446,"name":"test_double_array","nodeType":"Function","startLoc":547,"text":"def test_double_array(self):\n        assert issubclass(self.array['doublearray'].dtype.type,\n                          np.object_)\n        assert len(self.array['doublearray'][0]) == 0\n        assert_array_equal(self.array['doublearray'][1],\n                           [0, 1, np.inf, -np.inf, np.nan, 0, -1])\n        assert_array_equal(self.array.data['doublearray'][1].mask,\n                           [False, False, False, False, False, False, True])"},{"col":4,"comment":"null","endLoc":561,"header":"def test_bit_array2(self)","id":6447,"name":"test_bit_array2","nodeType":"Function","startLoc":556,"text":"def test_bit_array2(self):\n        assert_array_equal(self.array['bitarray2'][0],\n                           [True, True, True, True,\n                            False, False, False, False,\n                            True, True, True, True,\n                            False, False, False, False])"},{"col":4,"comment":"null","endLoc":565,"header":"def test_bit_array2_mask(self)","id":6448,"name":"test_bit_array2_mask","nodeType":"Function","startLoc":563,"text":"def test_bit_array2_mask(self):\n        assert not np.any(self.mask['bitarray2'][0])\n        assert np.all(self.mask['bitarray2'][1:])"},{"col":4,"comment":"null","endLoc":569,"header":"def test_get_coosys_by_id(self)","id":6449,"name":"test_get_coosys_by_id","nodeType":"Function","startLoc":567,"text":"def test_get_coosys_by_id(self):\n        coosys = self.votable.get_coosys_by_id('J2000')\n        assert coosys.system == 'eq_FK5'"},{"col":4,"comment":"\n        Get a table by its ordinal position in the file.\n        ","endLoc":3742,"header":"def get_table_by_index(self, idx)","id":6450,"name":"get_table_by_index","nodeType":"Function","startLoc":3734,"text":"def get_table_by_index(self, idx):\n        \"\"\"\n        Get a table by its ordinal position in the file.\n        \"\"\"\n        for i, table in enumerate(self.iter_tables()):\n            if i == idx:\n                return table\n        raise IndexError(\n            f\"No table at index {idx:d} found in VOTABLE file.\")"},{"col":4,"comment":"\n        Are the settings on this ``VALUE`` element all the same as the\n        XML defaults?\n        ","endLoc":1060,"header":"def is_defaults(self)","id":6451,"name":"is_defaults","nodeType":"Function","startLoc":1052,"text":"def is_defaults(self):\n        \"\"\"\n        Are the settings on this ``VALUE`` element all the same as the\n        XML defaults?\n        \"\"\"\n        # If there's nothing meaningful or non-default to write,\n        # don't write anything.\n        return (self.ref is None and self.null is None and self.ID is None and\n                self.max is None and self.min is None and self.options == [])"},{"col":4,"comment":"\n        For integral datatypes, *null* is used to define the value\n        used for missing values.\n        ","endLoc":855,"header":"@property\n    def null(self)","id":6453,"name":"null","nodeType":"Function","startLoc":849,"text":"@property\n    def null(self):\n        \"\"\"\n        For integral datatypes, *null* is used to define the value\n        used for missing values.\n        \"\"\"\n        return self._null"},{"col":4,"comment":"null","endLoc":869,"header":"@null.setter\n    def null(self, null)","id":6454,"name":"null","nodeType":"Function","startLoc":857,"text":"@null.setter\n    def null(self, null):\n        if null is not None and isinstance(null, str):\n            try:\n                null_val = self._field.converter.parse_scalar(\n                    null, self._config, self._pos)[0]\n            except Exception:\n                warn_or_raise(W36, W36, null, self._config, self._pos)\n                null_val = self._field.converter.parse_scalar(\n                    '0', self._config, self._pos)[0]\n        else:\n            null_val = null\n        self._null = null_val"},{"col":4,"comment":"\n        Recursively iterate over all FIELD_ and PARAM_ elements in the\n        VOTABLE_ file.\n        ","endLoc":3751,"header":"def iter_fields_and_params(self)","id":6455,"name":"iter_fields_and_params","nodeType":"Function","startLoc":3744,"text":"def iter_fields_and_params(self):\n        \"\"\"\n        Recursively iterate over all FIELD_ and PARAM_ elements in the\n        VOTABLE_ file.\n        \"\"\"\n        for resource in self.resources:\n            for field in resource.iter_fields_and_params():\n                yield field"},{"col":4,"comment":"\n        Recursively iterate over all VALUES_ elements in the VOTABLE_\n        file.\n        ","endLoc":3779,"header":"def iter_values(self)","id":6456,"name":"iter_values","nodeType":"Function","startLoc":3773,"text":"def iter_values(self):\n        \"\"\"\n        Recursively iterate over all VALUES_ elements in the VOTABLE_\n        file.\n        \"\"\"\n        for field in self.iter_fields_and_params():\n            yield field.values"},{"col":0,"comment":"null","endLoc":189,"header":"def test_complex_array_vararray()","id":6457,"name":"test_complex_array_vararray","nodeType":"Function","startLoc":182,"text":"def test_complex_array_vararray():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='floatComplex', arraysize='2x3*',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    with pytest.raises(exceptions.E02):\n        c.parse(\"2 3 4 5 6\")"},{"col":4,"comment":"\n        Recursively iterate over all GROUP_ elements in the VOTABLE_\n        file.\n        ","endLoc":3795,"header":"def iter_groups(self)","id":6458,"name":"iter_groups","nodeType":"Function","startLoc":3788,"text":"def iter_groups(self):\n        \"\"\"\n        Recursively iterate over all GROUP_ elements in the VOTABLE_\n        file.\n        \"\"\"\n        for table in self.iter_tables():\n            for group in table.iter_groups():\n                yield group"},{"col":4,"comment":"null","endLoc":574,"header":"def test_get_field_by_utype(self)","id":6459,"name":"test_get_field_by_utype","nodeType":"Function","startLoc":571,"text":"def test_get_field_by_utype(self):\n        fields = list(self.votable.get_fields_by_utype(\"myint\"))\n        assert fields[0].name == \"int\"\n        assert fields[0].values.min == -1000"},{"col":4,"comment":"null","endLoc":873,"header":"@null.deleter\n    def null(self)","id":6460,"name":"null","nodeType":"Function","startLoc":871,"text":"@null.deleter\n    def null(self):\n        self._null = None"},{"col":4,"comment":"\n        [*required*] Defines the applicability of the domain defined\n        by this VALUES_ element.  Must be one of the following\n        strings:\n\n          - 'legal': The domain of this column applies in general to\n            this datatype. (default)\n\n          - 'actual': The domain of this column applies only to the\n            data enclosed in the parent table.\n        ","endLoc":888,"header":"@property\n    def type(self)","id":6461,"name":"type","nodeType":"Function","startLoc":875,"text":"@property\n    def type(self):\n        \"\"\"\n        [*required*] Defines the applicability of the domain defined\n        by this VALUES_ element.  Must be one of the following\n        strings:\n\n          - 'legal': The domain of this column applies in general to\n            this datatype. (default)\n\n          - 'actual': The domain of this column applies only to the\n            data enclosed in the parent table.\n        \"\"\"\n        return self._type"},{"col":4,"comment":"null","endLoc":894,"header":"@type.setter\n    def type(self, type)","id":6462,"name":"type","nodeType":"Function","startLoc":890,"text":"@type.setter\n    def type(self, type):\n        if type not in ('legal', 'actual'):\n            vo_raise(E08, type, self._config, self._pos)\n        self._type = type"},{"col":4,"comment":"\n        Refer to another VALUES_ element by ID_, defined previously in\n        the document, for MIN/MAX/OPTION information.\n        ","endLoc":902,"header":"@property\n    def ref(self)","id":6463,"name":"ref","nodeType":"Function","startLoc":896,"text":"@property\n    def ref(self):\n        \"\"\"\n        Refer to another VALUES_ element by ID_, defined previously in\n        the document, for MIN/MAX/OPTION information.\n        \"\"\"\n        return self._ref"},{"col":4,"comment":"null","endLoc":922,"header":"@ref.setter\n    def ref(self, ref)","id":6464,"name":"ref","nodeType":"Function","startLoc":904,"text":"@ref.setter\n    def ref(self, ref):\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        if ref is not None:\n            try:\n                other = self._votable.get_values_by_id(ref, before=self)\n            except KeyError:\n                warn_or_raise(W43, W43, ('VALUES', self.ref), self._config,\n                              self._pos)\n                ref = None\n            else:\n                self.null = other.null\n                self.type = other.type\n                self.min = other.min\n                self.min_inclusive = other.min_inclusive\n                self.max = other.max\n                self.max_inclusive = other.max_inclusive\n                self._options[:] = other.options\n        self._ref = ref"},{"col":0,"comment":"null","endLoc":199,"header":"def test_complex_array_vararray2()","id":6465,"name":"test_complex_array_vararray2","nodeType":"Function","startLoc":192,"text":"def test_complex_array_vararray2():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='floatComplex', arraysize='2x3*',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    x = c.parse(\"\")\n    assert len(x[0]) == 0"},{"col":4,"comment":"\n        Recursively iterate over all COOSYS_ elements in the VOTABLE_\n        file.\n        ","endLoc":3820,"header":"def iter_coosys(self)","id":6466,"name":"iter_coosys","nodeType":"Function","startLoc":3811,"text":"def iter_coosys(self):\n        \"\"\"\n        Recursively iterate over all COOSYS_ elements in the VOTABLE_\n        file.\n        \"\"\"\n        for coosys in self.coordinate_systems:\n            yield coosys\n        for resource in self.resources:\n            for coosys in resource.iter_coosys():\n                yield coosys"},{"col":4,"comment":"\n        Recursively iterate over all TIMESYS_ elements in the VOTABLE_\n        file.\n        ","endLoc":3835,"header":"def iter_timesys(self)","id":6467,"name":"iter_timesys","nodeType":"Function","startLoc":3826,"text":"def iter_timesys(self):\n        \"\"\"\n        Recursively iterate over all TIMESYS_ elements in the VOTABLE_\n        file.\n        \"\"\"\n        for timesys in self.time_systems:\n            yield timesys\n        for resource in self.resources:\n            for timesys in resource.iter_timesys():\n                yield timesys"},{"col":4,"comment":"\n        Recursively iterate over all INFO_ elements in the VOTABLE_\n        file.\n        ","endLoc":3850,"header":"def iter_info(self)","id":6468,"name":"iter_info","nodeType":"Function","startLoc":3841,"text":"def iter_info(self):\n        \"\"\"\n        Recursively iterate over all INFO_ elements in the VOTABLE_\n        file.\n        \"\"\"\n        for info in self.infos:\n            yield info\n        for resource in self.resources:\n            for info in resource.iter_info():\n                yield info"},{"col":4,"comment":"null","endLoc":582,"header":"def test_get_info_by_id(self)","id":6469,"name":"test_get_info_by_id","nodeType":"Function","startLoc":576,"text":"def test_get_info_by_id(self):\n        info = self.votable.get_info_by_id('QUERY_STATUS')\n        assert info.value == 'OK'\n\n        if self.votable.version != '1.1':\n            info = self.votable.get_info_by_id(\"ErrorInfo\")\n            assert info.value == \"One might expect to find some INFO here, too...\"  # noqa"},{"col":4,"comment":"\n        Set the output storage format of all tables in the file.\n        ","endLoc":3861,"header":"def set_all_tables_format(self, format)","id":6470,"name":"set_all_tables_format","nodeType":"Function","startLoc":3856,"text":"def set_all_tables_format(self, format):\n        \"\"\"\n        Set the output storage format of all tables in the file.\n        \"\"\"\n        for table in self.iter_tables():\n            table.format = format"},{"attributeType":"null","col":4,"comment":"null","endLoc":3531,"id":6471,"name":"_version_namespace_map","nodeType":"Attribute","startLoc":3531,"text":"_version_namespace_map"},{"attributeType":"null","col":4,"comment":"null","endLoc":3720,"id":6472,"name":"get_table_by_id","nodeType":"Attribute","startLoc":3720,"text":"get_table_by_id"},{"col":4,"comment":"null","endLoc":592,"header":"def test_repr(self)","id":6473,"name":"test_repr","nodeType":"Function","startLoc":584,"text":"def test_repr(self):\n        assert '3 tables' in repr(self.votable)\n        assert repr(list(self.votable.iter_fields_and_params())[0]) == \\\n            '<PARAM ID=\"awesome\" arraysize=\"*\" datatype=\"float\" name=\"INPUT\" unit=\"deg\" value=\"[0.0 0.0]\"/>'  # noqa\n        # Smoke test\n        repr(list(self.votable.iter_groups()))\n\n        # Resource\n        assert repr(self.votable.resources) == '[</>]'"},{"attributeType":"null","col":4,"comment":"null","endLoc":3727,"id":6474,"name":"get_tables_by_utype","nodeType":"Attribute","startLoc":3727,"text":"get_tables_by_utype"},{"attributeType":"null","col":4,"comment":"null","endLoc":3753,"id":6475,"name":"get_field_by_id","nodeType":"Attribute","startLoc":3753,"text":"get_field_by_id"},{"attributeType":"null","col":4,"comment":"null","endLoc":3760,"id":6476,"name":"get_fields_by_utype","nodeType":"Attribute","startLoc":3760,"text":"get_fields_by_utype"},{"attributeType":"null","col":4,"comment":"null","endLoc":3767,"id":6477,"name":"get_field_by_id_or_name","nodeType":"Attribute","startLoc":3767,"text":"get_field_by_id_or_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":3781,"id":6478,"name":"get_values_by_id","nodeType":"Attribute","startLoc":3781,"text":"get_values_by_id"},{"attributeType":"null","col":4,"comment":"null","endLoc":3797,"id":6479,"name":"get_group_by_id","nodeType":"Attribute","startLoc":3797,"text":"get_group_by_id"},{"attributeType":"null","col":4,"comment":"null","endLoc":3804,"id":6480,"name":"get_groups_by_utype","nodeType":"Attribute","startLoc":3804,"text":"get_groups_by_utype"},{"attributeType":"null","col":4,"comment":"null","endLoc":3822,"id":6481,"name":"get_coosys_by_id","nodeType":"Attribute","startLoc":3822,"text":"get_coosys_by_id"},{"attributeType":"null","col":4,"comment":"null","endLoc":3837,"id":6482,"name":"get_timesys_by_id","nodeType":"Attribute","startLoc":3837,"text":"get_timesys_by_id"},{"col":4,"comment":"null","endLoc":926,"header":"@ref.deleter\n    def ref(self)","id":6483,"name":"ref","nodeType":"Function","startLoc":924,"text":"@ref.deleter\n    def ref(self):\n        self._ref = None"},{"col":4,"comment":"\n        The minimum value of the domain.  See :attr:`min_inclusive`.\n        ","endLoc":933,"header":"@property\n    def min(self)","id":6484,"name":"min","nodeType":"Function","startLoc":928,"text":"@property\n    def min(self):\n        \"\"\"\n        The minimum value of the domain.  See :attr:`min_inclusive`.\n        \"\"\"\n        return self._min"},{"attributeType":"null","col":4,"comment":"null","endLoc":3852,"id":6485,"name":"get_info_by_id","nodeType":"Attribute","startLoc":3852,"text":"get_info_by_id"},{"col":4,"comment":"null","endLoc":940,"header":"@min.setter\n    def min(self, min)","id":6486,"name":"min","nodeType":"Function","startLoc":935,"text":"@min.setter\n    def min(self, min):\n        if hasattr(self._field, 'converter') and min is not None:\n            self._min = self._field.converter.parse(min)[0]\n        else:\n            self._min = min"},{"attributeType":"null","col":8,"comment":"null","endLoc":3403,"id":6487,"name":"_infos","nodeType":"Attribute","startLoc":3403,"text":"self._infos"},{"col":0,"comment":"null","endLoc":210,"header":"def test_complex_array_vararray3()","id":6488,"name":"test_complex_array_vararray3","nodeType":"Function","startLoc":202,"text":"def test_complex_array_vararray3():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='doubleComplex', arraysize='2x3*',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    x = c.parse(\"1 2 3 4 5 6 7 8 9 10 11 12\")\n    assert len(x) == 2\n    assert np.all(x[0][0][0] == complex(1, 2))"},{"col":4,"comment":"null","endLoc":944,"header":"@min.deleter\n    def min(self)","id":6489,"name":"min","nodeType":"Function","startLoc":942,"text":"@min.deleter\n    def min(self):\n        self._min = None"},{"col":4,"comment":"When `True`, the domain includes the minimum value.","endLoc":949,"header":"@property\n    def min_inclusive(self)","id":6490,"name":"min_inclusive","nodeType":"Function","startLoc":946,"text":"@property\n    def min_inclusive(self):\n        \"\"\"When `True`, the domain includes the minimum value.\"\"\"\n        return self._min_inclusive"},{"col":4,"comment":"null","endLoc":958,"header":"@min_inclusive.setter\n    def min_inclusive(self, inclusive)","id":6491,"name":"min_inclusive","nodeType":"Function","startLoc":951,"text":"@min_inclusive.setter\n    def min_inclusive(self, inclusive):\n        if inclusive == 'yes':\n            self._min_inclusive = True\n        elif inclusive == 'no':\n            self._min_inclusive = False\n        else:\n            self._min_inclusive = bool(inclusive)"},{"col":4,"comment":"null","endLoc":962,"header":"@min_inclusive.deleter\n    def min_inclusive(self)","id":6492,"name":"min_inclusive","nodeType":"Function","startLoc":960,"text":"@min_inclusive.deleter\n    def min_inclusive(self):\n        self._min_inclusive = True"},{"col":4,"comment":"\n        The maximum value of the domain.  See :attr:`max_inclusive`.\n        ","endLoc":969,"header":"@property\n    def max(self)","id":6493,"name":"max","nodeType":"Function","startLoc":964,"text":"@property\n    def max(self):\n        \"\"\"\n        The maximum value of the domain.  See :attr:`max_inclusive`.\n        \"\"\"\n        return self._max"},{"col":4,"comment":"null","endLoc":976,"header":"@max.setter\n    def max(self, max)","id":6494,"name":"max","nodeType":"Function","startLoc":971,"text":"@max.setter\n    def max(self, max):\n        if hasattr(self._field, 'converter') and max is not None:\n            self._max = self._field.converter.parse(max)[0]\n        else:\n            self._max = max"},{"attributeType":"null","col":8,"comment":"null","endLoc":3401,"id":6495,"name":"_time_systems","nodeType":"Attribute","startLoc":3401,"text":"self._time_systems"},{"col":4,"comment":"null","endLoc":980,"header":"@max.deleter\n    def max(self)","id":6496,"name":"max","nodeType":"Function","startLoc":978,"text":"@max.deleter\n    def max(self):\n        self._max = None"},{"col":4,"comment":"When `True`, the domain includes the maximum value.","endLoc":985,"header":"@property\n    def max_inclusive(self)","id":6497,"name":"max_inclusive","nodeType":"Function","startLoc":982,"text":"@property\n    def max_inclusive(self):\n        \"\"\"When `True`, the domain includes the maximum value.\"\"\"\n        return self._max_inclusive"},{"col":4,"comment":"null","endLoc":994,"header":"@max_inclusive.setter\n    def max_inclusive(self, inclusive)","id":6498,"name":"max_inclusive","nodeType":"Function","startLoc":987,"text":"@max_inclusive.setter\n    def max_inclusive(self, inclusive):\n        if inclusive == 'yes':\n            self._max_inclusive = True\n        elif inclusive == 'no':\n            self._max_inclusive = False\n        else:\n            self._max_inclusive = bool(inclusive)"},{"col":4,"comment":"null","endLoc":998,"header":"@max_inclusive.deleter\n    def max_inclusive(self)","id":6499,"name":"max_inclusive","nodeType":"Function","startLoc":996,"text":"@max_inclusive.deleter\n    def max_inclusive(self):\n        self._max_inclusive = True"},{"col":4,"comment":"\n        A list of string key-value tuples defining other OPTION\n        elements for the domain.  All options are ignored -- they are\n        stored for round-tripping purposes only.\n        ","endLoc":1007,"header":"@property\n    def options(self)","id":6500,"name":"options","nodeType":"Function","startLoc":1000,"text":"@property\n    def options(self):\n        \"\"\"\n        A list of string key-value tuples defining other OPTION\n        elements for the domain.  All options are ignored -- they are\n        stored for round-tripping purposes only.\n        \"\"\"\n        return self._options"},{"col":4,"comment":"null","endLoc":1050,"header":"def parse(self, iterator, config)","id":6501,"name":"parse","nodeType":"Function","startLoc":1009,"text":"def parse(self, iterator, config):\n        if self.ref is not None:\n            for start, tag, data, pos in iterator:\n                if start:\n                    warn_or_raise(W44, W44, tag, config, pos)\n                else:\n                    if tag != 'VALUES':\n                        warn_or_raise(W44, W44, tag, config, pos)\n                    break\n        else:\n            for start, tag, data, pos in iterator:\n                if start:\n                    if tag == 'MIN':\n                        if 'value' not in data:\n                            vo_raise(E09, 'MIN', config, pos)\n                        self.min = data['value']\n                        self.min_inclusive = data.get('inclusive', 'yes')\n                        warn_unknown_attrs(\n                            'MIN', data.keys(), config, pos,\n                            ['value', 'inclusive'])\n                    elif tag == 'MAX':\n                        if 'value' not in data:\n                            vo_raise(E09, 'MAX', config, pos)\n                        self.max = data['value']\n                        self.max_inclusive = data.get('inclusive', 'yes')\n                        warn_unknown_attrs(\n                            'MAX', data.keys(), config, pos,\n                            ['value', 'inclusive'])\n                    elif tag == 'OPTION':\n                        if 'value' not in data:\n                            vo_raise(E09, 'OPTION', config, pos)\n                        xmlutil.check_token(\n                            data.get('name'), 'name', config, pos)\n                        self.options.append(\n                            (data.get('name'), data.get('value')))\n                        warn_unknown_attrs(\n                            'OPTION', data.keys(), config, pos,\n                            ['value', 'name'])\n                elif tag == 'VALUES':\n                    break\n\n        return self"},{"attributeType":"null","col":8,"comment":"null","endLoc":3394,"id":6502,"name":"_pos","nodeType":"Attribute","startLoc":3394,"text":"self._pos"},{"attributeType":"null","col":8,"comment":"null","endLoc":270,"id":6503,"name":"array","nodeType":"Attribute","startLoc":270,"text":"self.array"},{"col":0,"comment":"null","endLoc":221,"header":"def test_complex_vararray()","id":6504,"name":"test_complex_vararray","nodeType":"Function","startLoc":213,"text":"def test_complex_vararray():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='doubleComplex', arraysize='*',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    x = c.parse(\"1 2 3 4\")\n    assert len(x) == 2\n    assert x[0][0] == complex(1, 2)"},{"attributeType":"null","col":8,"comment":"null","endLoc":3398,"id":6505,"name":"description","nodeType":"Attribute","startLoc":3398,"text":"self.description"},{"attributeType":"null","col":8,"comment":"null","endLoc":3400,"id":6506,"name":"_coordinate_systems","nodeType":"Attribute","startLoc":3400,"text":"self._coordinate_systems"},{"attributeType":"null","col":8,"comment":"null","endLoc":268,"id":6507,"name":"votable","nodeType":"Attribute","startLoc":268,"text":"self.votable"},{"attributeType":"null","col":8,"comment":"null","endLoc":269,"id":6508,"name":"table","nodeType":"Attribute","startLoc":269,"text":"self.table"},{"attributeType":"null","col":8,"comment":"null","endLoc":271,"id":6509,"name":"mask","nodeType":"Attribute","startLoc":271,"text":"self.mask"},{"className":"TestThroughTableData","col":0,"comment":"null","endLoc":625,"id":6510,"nodeType":"Class","startLoc":595,"text":"class TestThroughTableData(TestParse):\n    def setup_class(self):\n        votable = parse(get_pkg_data_filename('data/regression.xml'))\n\n        self.xmlout = bio = io.BytesIO()\n        # W39: Bit values can not be masked\n        with pytest.warns(W39):\n            votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio)\n        self.table = self.votable.get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask\n\n    def test_bit_mask(self):\n        assert_array_equal(self.mask['bit'],\n                           [False, False, False, False, False])\n\n    def test_bitarray_mask(self):\n        assert not np.any(self.mask['bitarray'])\n\n    def test_bit_array2_mask(self):\n        assert not np.any(self.mask['bitarray2'])\n\n    def test_schema(self, tmpdir):\n        # have to use an actual file because assert_validate_schema only works\n        # on filenames, not file-like objects\n        fn = str(tmpdir.join(\"test_through_tabledata.xml\"))\n        with open(fn, 'wb') as f:\n            f.write(self.xmlout.getvalue())\n        assert_validate_schema(fn, '1.1')"},{"col":4,"comment":"null","endLoc":607,"header":"def setup_class(self)","id":6511,"name":"setup_class","nodeType":"Function","startLoc":596,"text":"def setup_class(self):\n        votable = parse(get_pkg_data_filename('data/regression.xml'))\n\n        self.xmlout = bio = io.BytesIO()\n        # W39: Bit values can not be masked\n        with pytest.warns(W39):\n            votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio)\n        self.table = self.votable.get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask"},{"attributeType":"null","col":8,"comment":"null","endLoc":3397,"id":6512,"name":"ID","nodeType":"Attribute","startLoc":3397,"text":"self.ID"},{"col":4,"comment":"null","endLoc":788,"header":"def binoutput(self, value, mask)","id":6513,"name":"binoutput","nodeType":"Function","startLoc":783,"text":"def binoutput(self, value, mask):\n        if mask:\n            return self._null_binoutput\n\n        value = _ensure_bigendian(value)\n        return value.tobytes()"},{"col":4,"comment":"null","endLoc":781,"header":"def output(self, value, mask)","id":6514,"name":"output","nodeType":"Function","startLoc":761,"text":"def output(self, value, mask):\n        if mask:\n            return self._null_output\n        if np.isfinite(value):\n            if not np.isscalar(value):\n                value = value.dtype.type(value)\n            result = self._output_format.format(value)\n            if result.startswith('array'):\n                raise RuntimeError()\n            if (self._output_format[2] == 'r' and\n                result.endswith('.0')):\n                result = result[:-2]\n            return result\n        elif np.isnan(value):\n            return 'NaN'\n        elif np.isposinf(value):\n            return '+InF'\n        elif np.isneginf(value):\n            return '-InF'\n        # Should never raise\n        vo_raise(f\"Invalid floating point value '{value}'\")"},{"attributeType":"null","col":8,"comment":"null","endLoc":3404,"id":6515,"name":"_resources","nodeType":"Attribute","startLoc":3404,"text":"self._resources"},{"col":4,"comment":"null","endLoc":738,"header":"def supports_empty_values(self, config)","id":6516,"name":"supports_empty_values","nodeType":"Function","startLoc":737,"text":"def supports_empty_values(self, config):\n        return True"},{"col":4,"comment":"null","endLoc":744,"header":"def _parse_pedantic(self, value, config=None, pos=None)","id":6517,"name":"_parse_pedantic","nodeType":"Function","startLoc":740,"text":"def _parse_pedantic(self, value, config=None, pos=None):\n        if value.strip() == '':\n            return self.null, True\n        f = float(value)\n        return f, self.is_null(f)"},{"col":4,"comment":"null","endLoc":611,"header":"def test_bit_mask(self)","id":6518,"name":"test_bit_mask","nodeType":"Function","startLoc":609,"text":"def test_bit_mask(self):\n        assert_array_equal(self.mask['bit'],\n                           [False, False, False, False, False])"},{"col":4,"comment":"null","endLoc":614,"header":"def test_bitarray_mask(self)","id":6519,"name":"test_bitarray_mask","nodeType":"Function","startLoc":613,"text":"def test_bitarray_mask(self):\n        assert not np.any(self.mask['bitarray'])"},{"col":4,"comment":"null","endLoc":617,"header":"def test_bit_array2_mask(self)","id":6520,"name":"test_bit_array2_mask","nodeType":"Function","startLoc":616,"text":"def test_bit_array2_mask(self):\n        assert not np.any(self.mask['bitarray2'])"},{"col":4,"comment":"null","endLoc":625,"header":"def test_schema(self, tmpdir)","id":6521,"name":"test_schema","nodeType":"Function","startLoc":619,"text":"def test_schema(self, tmpdir):\n        # have to use an actual file because assert_validate_schema only works\n        # on filenames, not file-like objects\n        fn = str(tmpdir.join(\"test_through_tabledata.xml\"))\n        with open(fn, 'wb') as f:\n            f.write(self.xmlout.getvalue())\n        assert_validate_schema(fn, '1.1')"},{"attributeType":"null","col":8,"comment":"null","endLoc":3415,"id":6522,"name":"_version","nodeType":"Attribute","startLoc":3415,"text":"self._version"},{"col":4,"comment":"null","endLoc":755,"header":"def _parse_permissive(self, value, config=None, pos=None)","id":6523,"name":"_parse_permissive","nodeType":"Function","startLoc":746,"text":"def _parse_permissive(self, value, config=None, pos=None):\n        try:\n            f = float(value)\n            return f, self.is_null(f)\n        except ValueError:\n            # IRSA VOTables use the word 'null' to specify empty values,\n            # but this is not defined in the VOTable spec.\n            if value.strip() != '':\n                vo_warn(W30, value, config, pos)\n            return self.null, True"},{"attributeType":"null","col":8,"comment":"null","endLoc":3393,"id":6524,"name":"_config","nodeType":"Attribute","startLoc":3393,"text":"self._config"},{"col":4,"comment":"null","endLoc":759,"header":"@property\n    def output_format(self)","id":6525,"name":"output_format","nodeType":"Function","startLoc":757,"text":"@property\n    def output_format(self):\n        return self._output_format"},{"col":4,"comment":"null","endLoc":791,"header":"def _filter_nan(self, value, mask)","id":6526,"name":"_filter_nan","nodeType":"Function","startLoc":790,"text":"def _filter_nan(self, value, mask):\n        return np.where(mask, np.nan, value)"},{"col":4,"comment":"null","endLoc":794,"header":"def _filter_null(self, value, mask)","id":6527,"name":"_filter_null","nodeType":"Function","startLoc":793,"text":"def _filter_null(self, value, mask):\n        return np.where(mask, self.null, value)"},{"attributeType":"null","col":4,"comment":"null","endLoc":690,"id":6528,"name":"default","nodeType":"Attribute","startLoc":690,"text":"default"},{"attributeType":"null","col":8,"comment":"null","endLoc":719,"id":6529,"name":"_output_format","nodeType":"Attribute","startLoc":719,"text":"self._output_format"},{"attributeType":"null","col":8,"comment":"null","endLoc":721,"id":6530,"name":"nan","nodeType":"Attribute","startLoc":721,"text":"self.nan"},{"attributeType":"null","col":8,"comment":"null","endLoc":3405,"id":6531,"name":"_groups","nodeType":"Attribute","startLoc":3405,"text":"self._groups"},{"col":4,"comment":"null","endLoc":1111,"header":"def to_table_column(self, column)","id":6532,"name":"to_table_column","nodeType":"Function","startLoc":1093,"text":"def to_table_column(self, column):\n        # Have the ref filled in here\n        meta = {}\n        for key in ['ID', 'null']:\n            val = getattr(self, key, None)\n            if val is not None:\n                meta[key] = val\n        if self.min is not None:\n            meta['min'] = {\n                'value': self.min,\n                'inclusive': self.min_inclusive}\n        if self.max is not None:\n            meta['max'] = {\n                'value': self.max,\n                'inclusive': self.max_inclusive}\n        if len(self.options):\n            meta['options'] = dict(self.options)\n\n        column.meta['values'] = meta"},{"attributeType":"null","col":12,"comment":"null","endLoc":728,"id":6533,"name":"_null_output","nodeType":"Attribute","startLoc":728,"text":"self._null_output"},{"attributeType":"null","col":12,"comment":"null","endLoc":729,"id":6534,"name":"_null_binoutput","nodeType":"Attribute","startLoc":729,"text":"self._null_binoutput"},{"attributeType":"function","col":12,"comment":"null","endLoc":730,"id":6535,"name":"filter_array","nodeType":"Attribute","startLoc":730,"text":"self.filter_array"},{"col":4,"comment":"null","endLoc":1129,"header":"def from_table_column(self, column)","id":6536,"name":"from_table_column","nodeType":"Function","startLoc":1113,"text":"def from_table_column(self, column):\n        if column.info.meta is None or 'values' not in column.info.meta:\n            return\n\n        meta = column.info.meta['values']\n        for key in ['ID', 'null']:\n            val = meta.get(key, None)\n            if val is not None:\n                setattr(self, key, val)\n        if 'min' in meta:\n            self.min = meta['min']['value']\n            self.min_inclusive = meta['min']['inclusive']\n        if 'max' in meta:\n            self.max = meta['max']['value']\n            self.max_inclusive = meta['max']['inclusive']\n        if 'options' in meta:\n            self._options = list(meta['options'].items())"},{"attributeType":"null","col":8,"comment":"null","endLoc":3402,"id":6537,"name":"_params","nodeType":"Attribute","startLoc":3402,"text":"self._params"},{"attributeType":"None","col":8,"comment":"null","endLoc":837,"id":6538,"name":"max","nodeType":"Attribute","startLoc":837,"text":"self.max"},{"attributeType":"null","col":8,"comment":"null","endLoc":838,"id":6539,"name":"min_inclusive","nodeType":"Attribute","startLoc":838,"text":"self.min_inclusive"},{"className":"Table","col":0,"comment":"\n    TABLE_ element: optionally contains data.\n\n    It contains the following publicly-accessible and mutable\n    attribute:\n\n        *array*: A Numpy masked array of the data itself, where each\n        row is a row of votable data, and columns are named and typed\n        based on the <FIELD> elements of the table.  The mask is\n        parallel to the data array, except for variable-length fields.\n        For those fields, the numpy array's column type is \"object\"\n        (``\"O\"``), and another masked array is stored there.\n\n    If the Table contains no data, (for example, its enclosing\n    :class:`Resource` has :attr:`~Resource.type` == 'meta') *array*\n    will have zero-length.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    ","endLoc":3096,"id":6540,"nodeType":"Class","startLoc":2131,"text":"class Table(Element, _IDProperty, _NameProperty, _UcdProperty,\n            _DescriptionProperty):\n    \"\"\"\n    TABLE_ element: optionally contains data.\n\n    It contains the following publicly-accessible and mutable\n    attribute:\n\n        *array*: A Numpy masked array of the data itself, where each\n        row is a row of votable data, and columns are named and typed\n        based on the <FIELD> elements of the table.  The mask is\n        parallel to the data array, except for variable-length fields.\n        For those fields, the numpy array's column type is \"object\"\n        (``\"O\"``), and another masked array is stored there.\n\n    If the Table contains no data, (for example, its enclosing\n    :class:`Resource` has :attr:`~Resource.type` == 'meta') *array*\n    will have zero-length.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    \"\"\"\n\n    def __init__(self, votable, ID=None, name=None, ref=None, ucd=None,\n                 utype=None, nrows=None, id=None, config=None, pos=None,\n                 **extra):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n        self._empty = False\n\n        Element.__init__(self)\n        self._votable = votable\n\n        self.ID = (resolve_id(ID, id, config, pos)\n                   or xmlutil.fix_id(name, config, pos))\n        self.name = name\n        xmlutil.check_id(ref, 'ref', config, pos)\n        self._ref = ref\n        self.ucd = ucd\n        self.utype = utype\n        if nrows is not None:\n            nrows = int(nrows)\n            if nrows < 0:\n                raise ValueError(\"'nrows' cannot be negative.\")\n        self._nrows = nrows\n        self.description = None\n        self.format = 'tabledata'\n\n        self._fields = HomogeneousList(Field)\n        self._params = HomogeneousList(Param)\n        self._groups = HomogeneousList(Group)\n        self._links = HomogeneousList(Link)\n        self._infos = HomogeneousList(Info)\n\n        self.array = ma.array([])\n\n        warn_unknown_attrs('TABLE', extra.keys(), config, pos)\n\n    def __repr__(self):\n        return repr(self.to_table())\n\n    def __bytes__(self):\n        return bytes(self.to_table())\n\n    def __str__(self):\n        return str(self.to_table())\n\n    @property\n    def ref(self):\n        return self._ref\n\n    @ref.setter\n    def ref(self, ref):\n        \"\"\"\n        Refer to another TABLE, previously defined, by the *ref* ID_\n        for all metadata (FIELD_, PARAM_ etc.) information.\n        \"\"\"\n        # When the ref changes, we want to verify that it will work\n        # by actually going and looking for the referenced table.\n        # If found, set a bunch of properties in this table based\n        # on the other one.\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        if ref is not None:\n            try:\n                table = self._votable.get_table_by_id(ref, before=self)\n            except KeyError:\n                warn_or_raise(\n                    W43, W43, ('TABLE', self.ref), self._config, self._pos)\n                ref = None\n            else:\n                self._fields = table.fields\n                self._params = table.params\n                self._groups = table.groups\n                self._links = table.links\n        else:\n            del self._fields[:]\n            del self._params[:]\n            del self._groups[:]\n            del self._links[:]\n        self._ref = ref\n\n    @ref.deleter\n    def ref(self):\n        self._ref = None\n\n    @property\n    def format(self):\n        \"\"\"\n        [*required*] The serialization format of the table.  Must be\n        one of:\n\n          'tabledata' (TABLEDATA_), 'binary' (BINARY_), 'binary2' (BINARY2_)\n          'fits' (FITS_).\n\n        Note that the 'fits' format, since it requires an external\n        file, can not be written out.  Any file read in with 'fits'\n        format will be read out, by default, in 'tabledata' format.\n\n        See :ref:`astropy:votable-serialization`.\n        \"\"\"\n        return self._format\n\n    @format.setter\n    def format(self, format):\n        format = format.lower()\n        if format == 'fits':\n            vo_raise(\"fits format can not be written out, only read.\",\n                     self._config, self._pos, NotImplementedError)\n        if format == 'binary2':\n            if not self._config['version_1_3_or_later']:\n                vo_raise(\n                    \"binary2 only supported in votable 1.3 or later\",\n                    self._config, self._pos)\n        elif format not in ('tabledata', 'binary'):\n            vo_raise(f\"Invalid format '{format}'\",\n                     self._config, self._pos)\n        self._format = format\n\n    @property\n    def nrows(self):\n        \"\"\"\n        [*immutable*] The number of rows in the table, as specified in\n        the XML file.\n        \"\"\"\n        return self._nrows\n\n    @property\n    def fields(self):\n        \"\"\"\n        A list of :class:`Field` objects describing the types of each\n        of the data columns.\n        \"\"\"\n        return self._fields\n\n    @property\n    def params(self):\n        \"\"\"\n        A list of parameters (constant-valued columns) for the\n        table.  Must contain only :class:`Param` objects.\n        \"\"\"\n        return self._params\n\n    @property\n    def groups(self):\n        \"\"\"\n        A list of :class:`Group` objects describing how the columns\n        and parameters are grouped.  Currently this information is\n        only kept around for round-tripping and informational\n        purposes.\n        \"\"\"\n        return self._groups\n\n    @property\n    def links(self):\n        \"\"\"\n        A list of :class:`Link` objects (pointers to other documents\n        or servers through a URI) for the table.\n        \"\"\"\n        return self._links\n\n    @property\n    def infos(self):\n        \"\"\"\n        A list of :class:`Info` objects for the table.  Allows for\n        post-operational diagnostics.\n        \"\"\"\n        return self._infos\n\n    def is_empty(self):\n        \"\"\"\n        Returns True if this table doesn't contain any real data\n        because it was skipped over by the parser (through use of the\n        ``table_number`` kwarg).\n        \"\"\"\n        return self._empty\n\n    def create_arrays(self, nrows=0, config=None):\n        \"\"\"\n        Create a new array to hold the data based on the current set\n        of fields, and store them in the *array* and member variable.\n        Any data in the existing array will be lost.\n\n        *nrows*, if provided, is the number of rows to allocate.\n        \"\"\"\n        if nrows is None:\n            nrows = 0\n\n        fields = self.fields\n\n        if len(fields) == 0:\n            array = np.recarray((nrows,), dtype='O')\n            mask = np.zeros((nrows,), dtype='b')\n        else:\n            # for field in fields: field._setup(config)\n            Field.uniqify_names(fields)\n\n            dtype = []\n            for x in fields:\n                if x._unique_name == x.ID:\n                    id = x.ID\n                else:\n                    id = (x._unique_name, x.ID)\n                dtype.append((id, x.converter.format))\n\n            array = np.recarray((nrows,), dtype=np.dtype(dtype))\n            descr_mask = []\n            for d in array.dtype.descr:\n                new_type = (d[1][1] == 'O' and 'O') or 'bool'\n                if len(d) == 2:\n                    descr_mask.append((d[0], new_type))\n                elif len(d) == 3:\n                    descr_mask.append((d[0], new_type, d[2]))\n            mask = np.zeros((nrows,), dtype=descr_mask)\n\n        self.array = ma.array(array, mask=mask)\n\n    def _resize_strategy(self, size):\n        \"\"\"\n        Return a new (larger) size based on size, used for\n        reallocating an array when it fills up.  This is in its own\n        function so the resizing strategy can be easily replaced.\n        \"\"\"\n        # Once we go beyond 0, make a big step -- after that use a\n        # factor of 1.5 to help keep memory usage compact\n        if size == 0:\n            return 512\n        return int(np.ceil(size * RESIZE_AMOUNT))\n\n    def _add_field(self, iterator, tag, data, config, pos):\n        field = Field(self._votable, config=config, pos=pos, **data)\n        self.fields.append(field)\n        field.parse(iterator, config)\n\n    def _add_param(self, iterator, tag, data, config, pos):\n        param = Param(self._votable, config=config, pos=pos, **data)\n        self.params.append(param)\n        param.parse(iterator, config)\n\n    def _add_group(self, iterator, tag, data, config, pos):\n        group = Group(self, config=config, pos=pos, **data)\n        self.groups.append(group)\n        group.parse(iterator, config)\n\n    def _add_link(self, iterator, tag, data, config, pos):\n        link = Link(config=config, pos=pos, **data)\n        self.links.append(link)\n        link.parse(iterator, config)\n\n    def _add_info(self, iterator, tag, data, config, pos):\n        if not config.get('version_1_2_or_later'):\n            warn_or_raise(W26, W26, ('INFO', 'TABLE', '1.2'), config, pos)\n        info = Info(config=config, pos=pos, **data)\n        self.infos.append(info)\n        info.parse(iterator, config)\n\n    def parse(self, iterator, config):\n        columns = config.get('columns')\n\n        # If we've requested to read in only a specific table, skip\n        # all others\n        table_number = config.get('table_number')\n        current_table_number = config.get('_current_table_number')\n        skip_table = False\n        if current_table_number is not None:\n            config['_current_table_number'] += 1\n            if (table_number is not None and\n                table_number != current_table_number):\n                skip_table = True\n                self._empty = True\n\n        table_id = config.get('table_id')\n        if table_id is not None:\n            if table_id != self.ID:\n                skip_table = True\n                self._empty = True\n\n        if self.ref is not None:\n            # This table doesn't have its own datatype descriptors, it\n            # just references those from another table.\n\n            # This is to call the property setter to go and get the\n            # referenced information\n            self.ref = self.ref\n\n            for start, tag, data, pos in iterator:\n                if start:\n                    if tag == 'DATA':\n                        warn_unknown_attrs(\n                            'DATA', data.keys(), config, pos)\n                        break\n                else:\n                    if tag == 'TABLE':\n                        return self\n                    elif tag == 'DESCRIPTION':\n                        if self.description is not None:\n                            warn_or_raise(W17, W17, 'RESOURCE', config, pos)\n                        self.description = data or None\n        else:\n            tag_mapping = {\n                'FIELD': self._add_field,\n                'PARAM': self._add_param,\n                'GROUP': self._add_group,\n                'LINK': self._add_link,\n                'INFO': self._add_info,\n                'DESCRIPTION': self._ignore_add}\n\n            for start, tag, data, pos in iterator:\n                if start:\n                    if tag == 'DATA':\n                        if len(self.fields) == 0:\n                            warn_or_raise(E25, E25, None, config, pos)\n                        warn_unknown_attrs(\n                            'DATA', data.keys(), config, pos)\n                        break\n\n                    tag_mapping.get(tag, self._add_unknown_tag)(\n                        iterator, tag, data, config, pos)\n                else:\n                    if tag == 'DESCRIPTION':\n                        if self.description is not None:\n                            warn_or_raise(W17, W17, 'RESOURCE', config, pos)\n                        self.description = data or None\n                    elif tag == 'TABLE':\n                        # For error checking purposes\n                        Field.uniqify_names(self.fields)\n                        # We still need to create arrays, even if the file\n                        # contains no DATA section\n                        self.create_arrays(nrows=0, config=config)\n                        return self\n\n        self.create_arrays(nrows=self._nrows, config=config)\n        fields = self.fields\n        names = [x.ID for x in fields]\n        # Deal with a subset of the columns, if requested.\n        if not columns:\n            colnumbers = list(range(len(fields)))\n        else:\n            if isinstance(columns, str):\n                columns = [columns]\n            columns = np.asarray(columns)\n            if issubclass(columns.dtype.type, np.integer):\n                if np.any(columns < 0) or np.any(columns > len(fields)):\n                    raise ValueError(\n                        \"Some specified column numbers out of range\")\n                colnumbers = columns\n            elif issubclass(columns.dtype.type, np.character):\n                try:\n                    colnumbers = [names.index(x) for x in columns]\n                except ValueError:\n                    raise ValueError(\n                        f\"Columns '{columns}' not found in fields list\")\n            else:\n                raise TypeError(\"Invalid columns list\")\n\n        if (not skip_table) and (len(fields) > 0):\n            for start, tag, data, pos in iterator:\n                if start:\n                    if tag == 'TABLEDATA':\n                        warn_unknown_attrs(\n                            'TABLEDATA', data.keys(), config, pos)\n                        self.array = self._parse_tabledata(\n                            iterator, colnumbers, fields, config)\n                        break\n                    elif tag == 'BINARY':\n                        warn_unknown_attrs(\n                            'BINARY', data.keys(), config, pos)\n                        self.array = self._parse_binary(\n                            1, iterator, colnumbers, fields, config, pos)\n                        break\n                    elif tag == 'BINARY2':\n                        if not config['version_1_3_or_later']:\n                            warn_or_raise(\n                                W52, W52, config['version'], config, pos)\n                        self.array = self._parse_binary(\n                            2, iterator, colnumbers, fields, config, pos)\n                        break\n                    elif tag == 'FITS':\n                        warn_unknown_attrs(\n                            'FITS', data.keys(), config, pos, ['extnum'])\n                        try:\n                            extnum = int(data.get('extnum', 0))\n                            if extnum < 0:\n                                raise ValueError(\"'extnum' cannot be negative.\")\n                        except ValueError:\n                            vo_raise(E17, (), config, pos)\n                        self.array = self._parse_fits(\n                            iterator, extnum, config)\n                        break\n                    else:\n                        warn_or_raise(W37, W37, tag, config, pos)\n                        break\n\n        for start, tag, data, pos in iterator:\n            if not start and tag == 'DATA':\n                break\n\n        for start, tag, data, pos in iterator:\n            if start and tag == 'INFO':\n                if not config.get('version_1_2_or_later'):\n                    warn_or_raise(\n                        W26, W26, ('INFO', 'TABLE', '1.2'), config, pos)\n                info = Info(config=config, pos=pos, **data)\n                self.infos.append(info)\n                info.parse(iterator, config)\n            elif not start and tag == 'TABLE':\n                break\n\n        return self\n\n    def _parse_tabledata(self, iterator, colnumbers, fields, config):\n        # Since we don't know the number of rows up front, we'll\n        # reallocate the record array to make room as we go.  This\n        # prevents the need to scan through the XML twice.  The\n        # allocation is by factors of 1.5.\n        invalid = config.get('invalid', 'exception')\n\n        # Need to have only one reference so that we can resize the\n        # array\n        array = self.array\n        del self.array\n\n        parsers = [field.converter.parse for field in fields]\n        binparsers = [field.converter.binparse for field in fields]\n\n        numrows = 0\n        alloc_rows = len(array)\n        colnumbers_bits = [i in colnumbers for i in range(len(fields))]\n        row_default = [x.converter.default for x in fields]\n        mask_default = [True] * len(fields)\n        array_chunk = []\n        mask_chunk = []\n        chunk_size = config.get('chunk_size', DEFAULT_CHUNK_SIZE)\n        for start, tag, data, pos in iterator:\n            if tag == 'TR':\n                # Now parse one row\n                row = row_default[:]\n                row_mask = mask_default[:]\n                i = 0\n                for start, tag, data, pos in iterator:\n                    if start:\n                        binary = (data.get('encoding', None) == 'base64')\n                        warn_unknown_attrs(\n                            tag, data.keys(), config, pos, ['encoding'])\n                    else:\n                        if tag == 'TD':\n                            if i >= len(fields):\n                                vo_raise(E20, len(fields), config, pos)\n\n                            if colnumbers_bits[i]:\n                                try:\n                                    if binary:\n                                        rawdata = base64.b64decode(\n                                            data.encode('ascii'))\n                                        buf = io.BytesIO(rawdata)\n                                        buf.seek(0)\n                                        try:\n                                            value, mask_value = binparsers[i](\n                                                buf.read)\n                                        except Exception as e:\n                                            vo_reraise(\n                                                e, config, pos,\n                                                \"(in row {:d}, col '{}')\".format(\n                                                    len(array_chunk),\n                                                    fields[i].ID))\n                                    else:\n                                        try:\n                                            value, mask_value = parsers[i](\n                                                data, config, pos)\n                                        except Exception as e:\n                                            vo_reraise(\n                                                e, config, pos,\n                                                \"(in row {:d}, col '{}')\".format(\n                                                    len(array_chunk),\n                                                    fields[i].ID))\n                                except Exception as e:\n                                    if invalid == 'exception':\n                                        vo_reraise(e, config, pos)\n                                else:\n                                    row[i] = value\n                                    row_mask[i] = mask_value\n                        elif tag == 'TR':\n                            break\n                        else:\n                            self._add_unknown_tag(\n                                iterator, tag, data, config, pos)\n                        i += 1\n\n                if i < len(fields):\n                    vo_raise(E21, (i, len(fields)), config, pos)\n\n                array_chunk.append(tuple(row))\n                mask_chunk.append(tuple(row_mask))\n\n                if len(array_chunk) == chunk_size:\n                    while numrows + chunk_size > alloc_rows:\n                        alloc_rows = self._resize_strategy(alloc_rows)\n                    if alloc_rows != len(array):\n                        array = _resize(array, alloc_rows)\n                    array[numrows:numrows + chunk_size] = array_chunk\n                    array.mask[numrows:numrows + chunk_size] = mask_chunk\n                    numrows += chunk_size\n                    array_chunk = []\n                    mask_chunk = []\n\n            elif not start and tag == 'TABLEDATA':\n                break\n\n        # Now, resize the array to the exact number of rows we need and\n        # put the last chunk values in there.\n        alloc_rows = numrows + len(array_chunk)\n\n        array = _resize(array, alloc_rows)\n        array[numrows:] = array_chunk\n        if alloc_rows != 0:\n            array.mask[numrows:] = mask_chunk\n        numrows += len(array_chunk)\n\n        if (self.nrows is not None and\n            self.nrows >= 0 and\n            self.nrows != numrows):\n            warn_or_raise(W18, W18, (self.nrows, numrows), config, pos)\n        self._nrows = numrows\n\n        return array\n\n    def _get_binary_data_stream(self, iterator, config):\n        have_local_stream = False\n        for start, tag, data, pos in iterator:\n            if tag == 'STREAM':\n                if start:\n                    warn_unknown_attrs(\n                        'STREAM', data.keys(), config, pos,\n                        ['type', 'href', 'actuate', 'encoding', 'expires',\n                         'rights'])\n                    if 'href' not in data:\n                        have_local_stream = True\n                        if data.get('encoding', None) != 'base64':\n                            warn_or_raise(\n                                W38, W38, data.get('encoding', None),\n                                config, pos)\n                    else:\n                        href = data['href']\n                        xmlutil.check_anyuri(href, config, pos)\n                        encoding = data.get('encoding', None)\n                else:\n                    buffer = data\n                    break\n\n        if have_local_stream:\n            buffer = base64.b64decode(buffer.encode('ascii'))\n            string_io = io.BytesIO(buffer)\n            string_io.seek(0)\n            read = string_io.read\n        else:\n            if not href.startswith(('http', 'ftp', 'file')):\n                vo_raise(\n                    \"The vo package only supports remote data through http, \" +\n                    \"ftp or file\",\n                    self._config, self._pos, NotImplementedError)\n            fd = urllib.request.urlopen(href)\n            if encoding is not None:\n                if encoding == 'gzip':\n                    fd = gzip.GzipFile(href, 'rb', fileobj=fd)\n                elif encoding == 'base64':\n                    fd = codecs.EncodedFile(fd, 'base64')\n                else:\n                    vo_raise(\n                        f\"Unknown encoding type '{encoding}'\",\n                        self._config, self._pos, NotImplementedError)\n            read = fd.read\n\n        def careful_read(length):\n            result = read(length)\n            if len(result) != length:\n                raise EOFError\n            return result\n\n        return careful_read\n\n    def _parse_binary(self, mode, iterator, colnumbers, fields, config, pos):\n        fields = self.fields\n\n        careful_read = self._get_binary_data_stream(iterator, config)\n\n        # Need to have only one reference so that we can resize the\n        # array\n        array = self.array\n        del self.array\n\n        binparsers = [field.converter.binparse for field in fields]\n\n        numrows = 0\n        alloc_rows = len(array)\n        while True:\n            # Resize result arrays if necessary\n            if numrows >= alloc_rows:\n                alloc_rows = self._resize_strategy(alloc_rows)\n                array = _resize(array, alloc_rows)\n\n            row_data = []\n            row_mask_data = []\n\n            try:\n                if mode == 2:\n                    mask_bits = careful_read(int((len(fields) + 7) / 8))\n                    row_mask_data = list(converters.bitarray_to_bool(\n                        mask_bits, len(fields)))\n\n                    # Ignore the mask for string columns (see issue 8995)\n                    for i, f in enumerate(fields):\n                        if row_mask_data[i] and (f.datatype == 'char' or f.datatype == 'unicodeChar'):\n                            row_mask_data[i] = False\n\n                for i, binparse in enumerate(binparsers):\n                    try:\n                        value, value_mask = binparse(careful_read)\n                    except EOFError:\n                        raise\n                    except Exception as e:\n                        vo_reraise(\n                            e, config, pos, \"(in row {:d}, col '{}')\".format(\n                                numrows, fields[i].ID))\n                    row_data.append(value)\n                    if mode == 1:\n                        row_mask_data.append(value_mask)\n                    else:\n                        row_mask_data[i] = row_mask_data[i] or value_mask\n            except EOFError:\n                break\n\n            row = [x.converter.default for x in fields]\n            row_mask = [False] * len(fields)\n            for i in colnumbers:\n                row[i] = row_data[i]\n                row_mask[i] = row_mask_data[i]\n\n            array[numrows] = tuple(row)\n            array.mask[numrows] = tuple(row_mask)\n            numrows += 1\n\n        array = _resize(array, numrows)\n\n        return array\n\n    def _parse_fits(self, iterator, extnum, config):\n        for start, tag, data, pos in iterator:\n            if tag == 'STREAM':\n                if start:\n                    warn_unknown_attrs(\n                        'STREAM', data.keys(), config, pos,\n                        ['type', 'href', 'actuate', 'encoding', 'expires',\n                         'rights'])\n                    href = data['href']\n                    encoding = data.get('encoding', None)\n                else:\n                    break\n\n        if not href.startswith(('http', 'ftp', 'file')):\n            vo_raise(\n                \"The vo package only supports remote data through http, \"\n                \"ftp or file\",\n                self._config, self._pos, NotImplementedError)\n\n        fd = urllib.request.urlopen(href)\n        if encoding is not None:\n            if encoding == 'gzip':\n                fd = gzip.GzipFile(href, 'r', fileobj=fd)\n            elif encoding == 'base64':\n                fd = codecs.EncodedFile(fd, 'base64')\n            else:\n                vo_raise(\n                    f\"Unknown encoding type '{encoding}'\",\n                    self._config, self._pos, NotImplementedError)\n\n        hdulist = fits.open(fd)\n\n        array = hdulist[int(extnum)].data\n        if array.dtype != self.array.dtype:\n            warn_or_raise(W19, W19, (), self._config, self._pos)\n\n        return array\n\n    def to_xml(self, w, **kwargs):\n        specified_format = kwargs.get('tabledata_format')\n        if specified_format is not None:\n            format = specified_format\n        else:\n            format = self.format\n        if format == 'fits':\n            format = 'tabledata'\n\n        with w.tag(\n            'TABLE',\n            attrib=w.object_attrs(\n                self,\n                ('ID', 'name', 'ref', 'ucd', 'utype', 'nrows'))):\n\n            if self.description is not None:\n                w.element(\"DESCRIPTION\", self.description, wrap=True)\n\n            for element_set in (self.fields, self.params):\n                for element in element_set:\n                    element._setup({}, None)\n\n            if self.ref is None:\n                for element_set in (self.fields, self.params, self.groups,\n                                    self.links):\n                    for element in element_set:\n                        element.to_xml(w, **kwargs)\n            elif kwargs['version_1_2_or_later']:\n                index = list(self._votable.iter_tables()).index(self)\n                group = Group(self, ID=f\"_g{index}\")\n                group.to_xml(w, **kwargs)\n\n            if len(self.array):\n                with w.tag('DATA'):\n                    if format == 'tabledata':\n                        self._write_tabledata(w, **kwargs)\n                    elif format == 'binary':\n                        self._write_binary(1, w, **kwargs)\n                    elif format == 'binary2':\n                        self._write_binary(2, w, **kwargs)\n\n            if kwargs['version_1_2_or_later']:\n                for element in self._infos:\n                    element.to_xml(w, **kwargs)\n\n    def _write_tabledata(self, w, **kwargs):\n        fields = self.fields\n        array = self.array\n\n        with w.tag('TABLEDATA'):\n            w._flush()\n            if (_has_c_tabledata_writer and\n                not kwargs.get('_debug_python_based_parser')):\n                supports_empty_values = [\n                    field.converter.supports_empty_values(kwargs)\n                    for field in fields]\n                fields = [field.converter.output for field in fields]\n                indent = len(w._tags) - 1\n                tablewriter.write_tabledata(\n                    w.write, array.data, array.mask, fields,\n                    supports_empty_values, indent, 1 << 8)\n            else:\n                write = w.write\n                indent_spaces = w.get_indentation_spaces()\n                tr_start = indent_spaces + \"<TR>\\n\"\n                tr_end = indent_spaces + \"</TR>\\n\"\n                td = indent_spaces + \" <TD>{}</TD>\\n\"\n                td_empty = indent_spaces + \" <TD/>\\n\"\n                fields = [(i, field.converter.output,\n                           field.converter.supports_empty_values(kwargs))\n                          for i, field in enumerate(fields)]\n                for row in range(len(array)):\n                    write(tr_start)\n                    array_row = array.data[row]\n                    mask_row = array.mask[row]\n                    for i, output, supports_empty_values in fields:\n                        data = array_row[i]\n                        masked = mask_row[i]\n                        if supports_empty_values and np.all(masked):\n                            write(td_empty)\n                        else:\n                            try:\n                                val = output(data, masked)\n                            except Exception as e:\n                                vo_reraise(\n                                    e,\n                                    additional=\"(in row {:d}, col '{}')\".format(\n                                        row, self.fields[i].ID))\n                            if len(val):\n                                write(td.format(val))\n                            else:\n                                write(td_empty)\n                    write(tr_end)\n\n    def _write_binary(self, mode, w, **kwargs):\n        fields = self.fields\n        array = self.array\n        if mode == 1:\n            tag_name = 'BINARY'\n        else:\n            tag_name = 'BINARY2'\n\n        with w.tag(tag_name):\n            with w.tag('STREAM', encoding='base64'):\n                fields_basic = [(i, field.converter.binoutput)\n                                for (i, field) in enumerate(fields)]\n\n                data = io.BytesIO()\n                for row in range(len(array)):\n                    array_row = array.data[row]\n                    array_mask = array.mask[row]\n\n                    if mode == 2:\n                        flattened = np.array([np.all(x) for x in array_mask])\n                        data.write(converters.bool_to_bitarray(flattened))\n\n                    for i, converter in fields_basic:\n                        try:\n                            chunk = converter(array_row[i], array_mask[i])\n                            assert type(chunk) == bytes\n                        except Exception as e:\n                            vo_reraise(\n                                e, additional=f\"(in row {row:d}, col '{fields[i].ID}')\")\n                        data.write(chunk)\n\n                w._flush()\n                w.write(base64.b64encode(data.getvalue()).decode('ascii'))\n\n    def to_table(self, use_names_over_ids=False):\n        \"\"\"\n        Convert this VO Table to an `astropy.table.Table` instance.\n\n        Parameters\n        ----------\n        use_names_over_ids : bool, optional\n           When `True` use the ``name`` attributes of columns as the\n           names of columns in the `astropy.table.Table` instance.\n           Since names are not guaranteed to be unique, this may cause\n           some columns to be renamed by appending numbers to the end.\n           Otherwise (default), use the ID attributes as the column\n           names.\n\n        .. warning::\n           Variable-length array fields may not be restored\n           identically when round-tripping through the\n           `astropy.table.Table` instance.\n        \"\"\"\n        from astropy.table import Table\n\n        meta = {}\n        for key in ['ID', 'name', 'ref', 'ucd', 'utype', 'description']:\n            val = getattr(self, key, None)\n            if val is not None:\n                meta[key] = val\n\n        if use_names_over_ids:\n            names = [field.name for field in self.fields]\n            unique_names = []\n            for i, name in enumerate(names):\n                new_name = name\n                i = 2\n                while new_name in unique_names:\n                    new_name = f'{name}{i}'\n                    i += 1\n                unique_names.append(new_name)\n            names = unique_names\n        else:\n            names = [field.ID for field in self.fields]\n\n        table = Table(self.array, names=names, meta=meta)\n\n        for name, field in zip(names, self.fields):\n            column = table[name]\n            field.to_table_column(column)\n\n        return table\n\n    @classmethod\n    def from_table(cls, votable, table):\n        \"\"\"\n        Create a `Table` instance from a given `astropy.table.Table`\n        instance.\n        \"\"\"\n        kwargs = {}\n        for key in ['ID', 'name', 'ref', 'ucd', 'utype']:\n            val = table.meta.get(key)\n            if val is not None:\n                kwargs[key] = val\n        new_table = cls(votable, **kwargs)\n        if 'description' in table.meta:\n            new_table.description = table.meta['description']\n\n        for colname in table.colnames:\n            column = table[colname]\n            new_table.fields.append(Field.from_table_column(votable, column))\n\n        if table.mask is None:\n            new_table.array = ma.array(np.asarray(table))\n        else:\n            new_table.array = ma.array(np.asarray(table),\n                                       mask=np.asarray(table.mask))\n\n        return new_table\n\n    def iter_fields_and_params(self):\n        \"\"\"\n        Recursively iterate over all FIELD and PARAM elements in the\n        TABLE.\n        \"\"\"\n        for param in self.params:\n            yield param\n        for field in self.fields:\n            yield field\n        for group in self.groups:\n            for field in group.iter_fields_and_params():\n                yield field\n\n    get_field_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_fields_and_params', 'FIELD or PARAM',\n        \"\"\"\n        Looks up a FIELD or PARAM element by the given ID.\n        \"\"\")\n\n    get_field_by_id_or_name = _lookup_by_id_or_name_factory(\n        'iter_fields_and_params', 'FIELD or PARAM',\n        \"\"\"\n        Looks up a FIELD or PARAM element by the given ID or name.\n        \"\"\")\n\n    get_fields_by_utype = _lookup_by_attr_factory(\n        'utype', False, 'iter_fields_and_params', 'FIELD or PARAM',\n        \"\"\"\n        Looks up a FIELD or PARAM element by the given utype and\n        returns an iterator emitting all matches.\n        \"\"\")\n\n    def iter_groups(self):\n        \"\"\"\n        Recursively iterate over all GROUP elements in the TABLE.\n        \"\"\"\n        for group in self.groups:\n            yield group\n            for g in group.iter_groups():\n                yield g\n\n    get_group_by_id = _lookup_by_attr_factory(\n        'ID', True, 'iter_groups', 'GROUP',\n        \"\"\"\n        Looks up a GROUP element by the given ID.  Used by the group's\n        \"ref\" attribute\n        \"\"\")\n\n    get_groups_by_utype = _lookup_by_attr_factory(\n        'utype', False, 'iter_groups', 'GROUP',\n        \"\"\"\n        Looks up a GROUP element by the given utype and returns an\n        iterator emitting all matches.\n        \"\"\")\n\n    def iter_info(self):\n        for info in self.infos:\n            yield info"},{"attributeType":"null","col":12,"comment":"null","endLoc":954,"id":6541,"name":"_min_inclusive","nodeType":"Attribute","startLoc":954,"text":"self._min_inclusive"},{"attributeType":"null","col":8,"comment":"null","endLoc":869,"id":6542,"name":"_null","nodeType":"Attribute","startLoc":869,"text":"self._null"},{"col":4,"comment":"null","endLoc":2192,"header":"def __repr__(self)","id":6543,"name":"__repr__","nodeType":"Function","startLoc":2191,"text":"def __repr__(self):\n        return repr(self.to_table())"},{"col":4,"comment":"\n        Convert this VO Table to an `astropy.table.Table` instance.\n\n        Parameters\n        ----------\n        use_names_over_ids : bool, optional\n           When `True` use the ``name`` attributes of columns as the\n           names of columns in the `astropy.table.Table` instance.\n           Since names are not guaranteed to be unique, this may cause\n           some columns to be renamed by appending numbers to the end.\n           Otherwise (default), use the ID attributes as the column\n           names.\n\n        .. warning::\n           Variable-length array fields may not be restored\n           identically when round-tripping through the\n           `astropy.table.Table` instance.\n        ","endLoc":3010,"header":"def to_table(self, use_names_over_ids=False)","id":6544,"name":"to_table","nodeType":"Function","startLoc":2963,"text":"def to_table(self, use_names_over_ids=False):\n        \"\"\"\n        Convert this VO Table to an `astropy.table.Table` instance.\n\n        Parameters\n        ----------\n        use_names_over_ids : bool, optional\n           When `True` use the ``name`` attributes of columns as the\n           names of columns in the `astropy.table.Table` instance.\n           Since names are not guaranteed to be unique, this may cause\n           some columns to be renamed by appending numbers to the end.\n           Otherwise (default), use the ID attributes as the column\n           names.\n\n        .. warning::\n           Variable-length array fields may not be restored\n           identically when round-tripping through the\n           `astropy.table.Table` instance.\n        \"\"\"\n        from astropy.table import Table\n\n        meta = {}\n        for key in ['ID', 'name', 'ref', 'ucd', 'utype', 'description']:\n            val = getattr(self, key, None)\n            if val is not None:\n                meta[key] = val\n\n        if use_names_over_ids:\n            names = [field.name for field in self.fields]\n            unique_names = []\n            for i, name in enumerate(names):\n                new_name = name\n                i = 2\n                while new_name in unique_names:\n                    new_name = f'{name}{i}'\n                    i += 1\n                unique_names.append(new_name)\n            names = unique_names\n        else:\n            names = [field.ID for field in self.fields]\n\n        table = Table(self.array, names=names, meta=meta)\n\n        for name, field in zip(names, self.fields):\n            column = table[name]\n            field.to_table_column(column)\n\n        return table"},{"attributeType":"null","col":8,"comment":"null","endLoc":894,"id":6545,"name":"_type","nodeType":"Attribute","startLoc":894,"text":"self._type"},{"attributeType":"function","col":12,"comment":"null","endLoc":735,"id":6546,"name":"parse","nodeType":"Attribute","startLoc":735,"text":"self.parse"},{"attributeType":"null","col":8,"comment":"null","endLoc":840,"id":6547,"name":"_options","nodeType":"Attribute","startLoc":840,"text":"self._options"},{"attributeType":"null","col":12,"comment":"null","endLoc":974,"id":6548,"name":"_max","nodeType":"Attribute","startLoc":974,"text":"self._max"},{"attributeType":"null","col":8,"comment":"null","endLoc":839,"id":6549,"name":"max_inclusive","nodeType":"Attribute","startLoc":839,"text":"self.max_inclusive"},{"attributeType":"null","col":8,"comment":"null","endLoc":834,"id":6550,"name":"type","nodeType":"Attribute","startLoc":834,"text":"self.type"},{"attributeType":"null","col":8,"comment":"null","endLoc":824,"id":6551,"name":"_config","nodeType":"Attribute","startLoc":824,"text":"self._config"},{"col":0,"comment":"null","endLoc":43,"header":"def assert_validate_schema(filename, version)","id":6552,"name":"assert_validate_schema","nodeType":"Function","startLoc":34,"text":"def assert_validate_schema(filename, version):\n    if sys.platform.startswith('win'):\n        return\n\n    try:\n        rc, stdout, stderr = validate_schema(filename, version)\n    except OSError:\n        # If xmllint is not installed, we want the test to pass anyway\n        return\n    assert rc == 0, 'File did not validate against VOTable schema'"},{"col":4,"comment":"\n        * parent is the section above\n        * depth is the depth level of this section\n        * main is the main ConfigObj\n        * indict is a dictionary to initialise the section with\n        ","endLoc":507,"header":"def __init__(self, parent, depth, main, indict=None, name=None)","id":6553,"name":"__init__","nodeType":"Function","startLoc":484,"text":"def __init__(self, parent, depth, main, indict=None, name=None):\n        \"\"\"\n        * parent is the section above\n        * depth is the depth level of this section\n        * main is the main ConfigObj\n        * indict is a dictionary to initialise the section with\n        \"\"\"\n        if indict is None:\n            indict = {}\n        dict.__init__(self)\n        # used for nesting level *and* interpolation\n        self.parent = parent\n        # used for the interpolation attribute\n        self.main = main\n        # level of nesting depth of this Section\n        self.depth = depth\n        # purely for information\n        self.name = name\n        #\n        self._initialise()\n        # we do this explicitly so that __setitem__ is used properly\n        # (rather than just passing to ``dict.__init__``)\n        for entry, value in indict.items():\n            self[entry] = value"},{"attributeType":"null","col":8,"comment":"null","endLoc":606,"id":6554,"name":"array","nodeType":"Attribute","startLoc":606,"text":"self.array"},{"col":4,"comment":"null","endLoc":524,"header":"def _initialise(self)","id":6555,"name":"_initialise","nodeType":"Function","startLoc":510,"text":"def _initialise(self):\n        # the sequence of scalar values in this Section\n        self.scalars = []\n        # the sequence of sections in this Section\n        self.sections = []\n        # for comments :-)\n        self.comments = {}\n        self.inline_comments = {}\n        # the configspec\n        self.configspec = None\n        # for defaults\n        self.defaults = []\n        self.default_values = {}\n        self.extra_values = []\n        self._created = False"},{"attributeType":"null","col":8,"comment":"null","endLoc":604,"id":6556,"name":"votable","nodeType":"Attribute","startLoc":604,"text":"self.votable"},{"attributeType":"null","col":8,"comment":"null","endLoc":605,"id":6557,"name":"table","nodeType":"Attribute","startLoc":605,"text":"self.table"},{"attributeType":"null","col":8,"comment":"null","endLoc":599,"id":6558,"name":"xmlout","nodeType":"Attribute","startLoc":599,"text":"self.xmlout"},{"attributeType":"null","col":8,"comment":"null","endLoc":607,"id":6559,"name":"mask","nodeType":"Attribute","startLoc":607,"text":"self.mask"},{"col":0,"comment":"null","endLoc":231,"header":"def test_complex()","id":6560,"name":"test_complex","nodeType":"Function","startLoc":224,"text":"def test_complex():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='doubleComplex',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    with pytest.raises(exceptions.E03):\n        c.parse(\"1 2 3\")"},{"className":"TestThroughBinary","col":0,"comment":"null","endLoc":654,"id":6561,"nodeType":"Class","startLoc":628,"text":"class TestThroughBinary(TestParse):\n    def setup_class(self):\n        votable = parse(get_pkg_data_filename('data/regression.xml'))\n        votable.get_first_table().format = 'binary'\n\n        self.xmlout = bio = io.BytesIO()\n        # W39: Bit values can not be masked\n        with pytest.warns(W39):\n            votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio)\n\n        self.table = self.votable.get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask\n\n    # Masked values in bit fields don't roundtrip through the binary\n    # representation -- that's not a bug, just a limitation, so\n    # override the mask array checks here.\n    def test_bit_mask(self):\n        assert not np.any(self.mask['bit'])\n\n    def test_bitarray_mask(self):\n        assert not np.any(self.mask['bitarray'])\n\n    def test_bit_array2_mask(self):\n        assert not np.any(self.mask['bitarray2'])"},{"col":4,"comment":"null","endLoc":642,"header":"def setup_class(self)","id":6562,"name":"setup_class","nodeType":"Function","startLoc":629,"text":"def setup_class(self):\n        votable = parse(get_pkg_data_filename('data/regression.xml'))\n        votable.get_first_table().format = 'binary'\n\n        self.xmlout = bio = io.BytesIO()\n        # W39: Bit values can not be masked\n        with pytest.warns(W39):\n            votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio)\n\n        self.table = self.votable.get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask"},{"attributeType":"null","col":8,"comment":"null","endLoc":830,"id":6563,"name":"_field","nodeType":"Attribute","startLoc":830,"text":"self._field"},{"attributeType":"None","col":8,"comment":"null","endLoc":836,"id":6564,"name":"min","nodeType":"Attribute","startLoc":836,"text":"self.min"},{"col":0,"comment":"null","endLoc":241,"header":"def test_bit()","id":6565,"name":"test_bit","nodeType":"Function","startLoc":234,"text":"def test_bit():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='bit',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    with pytest.raises(exceptions.E04):\n        c.parse(\"T\")"},{"attributeType":"null","col":8,"comment":"null","endLoc":832,"id":6566,"name":"null","nodeType":"Attribute","startLoc":832,"text":"self.null"},{"col":4,"comment":"null","endLoc":648,"header":"def test_bit_mask(self)","id":6567,"name":"test_bit_mask","nodeType":"Function","startLoc":647,"text":"def test_bit_mask(self):\n        assert not np.any(self.mask['bit'])"},{"col":4,"comment":"null","endLoc":651,"header":"def test_bitarray_mask(self)","id":6568,"name":"test_bitarray_mask","nodeType":"Function","startLoc":650,"text":"def test_bitarray_mask(self):\n        assert not np.any(self.mask['bitarray'])"},{"col":0,"comment":"null","endLoc":252,"header":"def test_bit_mask()","id":6569,"name":"test_bit_mask","nodeType":"Function","startLoc":244,"text":"def test_bit_mask():\n    config = {'verify': 'exception'}\n    with pytest.warns(exceptions.W39) as w:\n        field = tree.Field(\n            None, name='c', datatype='bit',\n            config=config)\n        c = converters.get_converter(field, config=config)\n        c.output(True, True)\n    assert len(w) == 1"},{"col":4,"comment":"null","endLoc":654,"header":"def test_bit_array2_mask(self)","id":6570,"name":"test_bit_array2_mask","nodeType":"Function","startLoc":653,"text":"def test_bit_array2_mask(self):\n        assert not np.any(self.mask['bitarray2'])"},{"attributeType":"null","col":8,"comment":"null","endLoc":641,"id":6571,"name":"array","nodeType":"Attribute","startLoc":641,"text":"self.array"},{"className":"Double","col":0,"comment":"\n    Handles the double datatype.  Double-precision IEEE\n    floating-point.\n    ","endLoc":802,"id":6572,"nodeType":"Class","startLoc":797,"text":"class Double(FloatingPoint):\n    \"\"\"\n    Handles the double datatype.  Double-precision IEEE\n    floating-point.\n    \"\"\"\n    format = 'f8'"},{"attributeType":"null","col":8,"comment":"null","endLoc":833,"id":6573,"name":"_ref","nodeType":"Attribute","startLoc":833,"text":"self._ref"},{"attributeType":"null","col":4,"comment":"null","endLoc":802,"id":6574,"name":"format","nodeType":"Attribute","startLoc":802,"text":"format"},{"attributeType":"null","col":8,"comment":"null","endLoc":638,"id":6575,"name":"votable","nodeType":"Attribute","startLoc":638,"text":"self.votable"},{"attributeType":"null","col":8,"comment":"null","endLoc":640,"id":6576,"name":"table","nodeType":"Attribute","startLoc":640,"text":"self.table"},{"attributeType":"null","col":8,"comment":"null","endLoc":633,"id":6577,"name":"xmlout","nodeType":"Attribute","startLoc":633,"text":"self.xmlout"},{"attributeType":"null","col":8,"comment":"null","endLoc":642,"id":6578,"name":"mask","nodeType":"Attribute","startLoc":642,"text":"self.mask"},{"attributeType":"null","col":8,"comment":"null","endLoc":825,"id":6579,"name":"_pos","nodeType":"Attribute","startLoc":825,"text":"self._pos"},{"className":"TestThroughBinary2","col":0,"comment":"null","endLoc":677,"id":6580,"nodeType":"Class","startLoc":657,"text":"class TestThroughBinary2(TestParse):\n    def setup_class(self):\n        votable = parse(get_pkg_data_filename('data/regression.xml'))\n        votable.version = '1.3'\n        votable.get_first_table()._config['version_1_3_or_later'] = True\n        votable.get_first_table().format = 'binary2'\n\n        self.xmlout = bio = io.BytesIO()\n        # W39: Bit values can not be masked\n        with pytest.warns(W39):\n            votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio)\n\n        self.table = self.votable.get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask\n\n    def test_get_coosys_by_id(self):\n        # No COOSYS in VOTable 1.2 or later\n        pass"},{"className":"Float","col":0,"comment":"\n    Handles the float datatype.  Single-precision IEEE floating-point.\n    ","endLoc":809,"id":6581,"nodeType":"Class","startLoc":805,"text":"class Float(FloatingPoint):\n    \"\"\"\n    Handles the float datatype.  Single-precision IEEE floating-point.\n    \"\"\"\n    format = 'f4'"},{"col":4,"comment":"null","endLoc":673,"header":"def setup_class(self)","id":6582,"name":"setup_class","nodeType":"Function","startLoc":658,"text":"def setup_class(self):\n        votable = parse(get_pkg_data_filename('data/regression.xml'))\n        votable.version = '1.3'\n        votable.get_first_table()._config['version_1_3_or_later'] = True\n        votable.get_first_table().format = 'binary2'\n\n        self.xmlout = bio = io.BytesIO()\n        # W39: Bit values can not be masked\n        with pytest.warns(W39):\n            votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio)\n\n        self.table = self.votable.get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask"},{"col":0,"comment":"null","endLoc":262,"header":"def test_boolean()","id":6583,"name":"test_boolean","nodeType":"Function","startLoc":255,"text":"def test_boolean():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='boolean',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    with pytest.raises(exceptions.E05):\n        c.parse('YES')"},{"attributeType":"null","col":4,"comment":"null","endLoc":809,"id":6584,"name":"format","nodeType":"Attribute","startLoc":809,"text":"format"},{"attributeType":"null","col":8,"comment":"null","endLoc":831,"id":6585,"name":"ID","nodeType":"Attribute","startLoc":831,"text":"self.ID"},{"className":"Integer","col":0,"comment":"\n    The base class for all the integral datatypes.\n    ","endLoc":885,"id":6586,"nodeType":"Class","startLoc":812,"text":"class Integer(Numeric):\n    \"\"\"\n    The base class for all the integral datatypes.\n    \"\"\"\n    default = 0\n\n    def __init__(self, field, config=None, pos=None):\n        Numeric.__init__(self, field, config, pos)\n\n    def parse(self, value, config=None, pos=None):\n        if config is None:\n            config = {}\n        mask = False\n        if isinstance(value, str):\n            value = value.lower()\n            if value == '':\n                if config['version_1_3_or_later']:\n                    mask = True\n                else:\n                    warn_or_raise(W49, W49, (), config, pos)\n                if self.null is not None:\n                    value = self.null\n                else:\n                    value = self.default\n            elif value == 'nan':\n                mask = True\n                if self.null is None:\n                    warn_or_raise(W31, W31, (), config, pos)\n                    value = self.default\n                else:\n                    value = self.null\n            elif value.startswith('0x'):\n                value = int(value[2:], 16)\n            else:\n                value = int(value, 10)\n        else:\n            value = int(value)\n        if self.null is not None and value == self.null:\n            mask = True\n\n        if value < self.val_range[0]:\n            warn_or_raise(W51, W51, (value, self.bit_size), config, pos)\n            value = self.val_range[0]\n        elif value > self.val_range[1]:\n            warn_or_raise(W51, W51, (value, self.bit_size), config, pos)\n            value = self.val_range[1]\n\n        return value, mask\n\n    def output(self, value, mask):\n        if mask:\n            if self.null is None:\n                warn_or_raise(W31, W31)\n                return 'NaN'\n            return str(self.null)\n        return str(value)\n\n    def binoutput(self, value, mask):\n        if mask:\n            if self.null is None:\n                vo_raise(W31)\n            else:\n                value = self.null\n\n        value = _ensure_bigendian(value)\n        return value.tobytes()\n\n    def filter_array(self, value, mask):\n        if np.any(mask):\n            if self.null is not None:\n                return np.where(mask, self.null, value)\n            else:\n                vo_raise(W31)\n        return value"},{"col":4,"comment":"null","endLoc":819,"header":"def __init__(self, field, config=None, pos=None)","id":6587,"name":"__init__","nodeType":"Function","startLoc":818,"text":"def __init__(self, field, config=None, pos=None):\n        Numeric.__init__(self, field, config, pos)"},{"attributeType":"null","col":12,"comment":"null","endLoc":990,"id":6588,"name":"_max_inclusive","nodeType":"Attribute","startLoc":990,"text":"self._max_inclusive"},{"col":4,"comment":"null","endLoc":859,"header":"def parse(self, value, config=None, pos=None)","id":6589,"name":"parse","nodeType":"Function","startLoc":821,"text":"def parse(self, value, config=None, pos=None):\n        if config is None:\n            config = {}\n        mask = False\n        if isinstance(value, str):\n            value = value.lower()\n            if value == '':\n                if config['version_1_3_or_later']:\n                    mask = True\n                else:\n                    warn_or_raise(W49, W49, (), config, pos)\n                if self.null is not None:\n                    value = self.null\n                else:\n                    value = self.default\n            elif value == 'nan':\n                mask = True\n                if self.null is None:\n                    warn_or_raise(W31, W31, (), config, pos)\n                    value = self.default\n                else:\n                    value = self.null\n            elif value.startswith('0x'):\n                value = int(value[2:], 16)\n            else:\n                value = int(value, 10)\n        else:\n            value = int(value)\n        if self.null is not None and value == self.null:\n            mask = True\n\n        if value < self.val_range[0]:\n            warn_or_raise(W51, W51, (value, self.bit_size), config, pos)\n            value = self.val_range[0]\n        elif value > self.val_range[1]:\n            warn_or_raise(W51, W51, (value, self.bit_size), config, pos)\n            value = self.val_range[1]\n\n        return value, mask"},{"attributeType":"null","col":8,"comment":"null","endLoc":829,"id":6590,"name":"_votable","nodeType":"Attribute","startLoc":829,"text":"self._votable"},{"attributeType":"null","col":12,"comment":"null","endLoc":938,"id":6591,"name":"_min","nodeType":"Attribute","startLoc":938,"text":"self._min"},{"col":0,"comment":"null","endLoc":272,"header":"def test_boolean_array()","id":6592,"name":"test_boolean_array","nodeType":"Function","startLoc":265,"text":"def test_boolean_array():\n    config = {'verify': 'exception'}\n    field = tree.Field(\n        None, name='c', datatype='boolean', arraysize='*',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    r, mask = c.parse('TRUE FALSE T F 0 1')\n    assert_array_equal(r, [True, False, True, False, False, True])"},{"className":"Field","col":0,"comment":"\n    FIELD_ element: describes the datatype of a particular column of data.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n\n    If *ID* is provided, it is used for the column name in the\n    resulting recarray of the table.  If no *ID* is provided, *name*\n    is used instead.  If neither is provided, an exception will be\n    raised.\n    ","endLoc":1577,"id":6593,"nodeType":"Class","startLoc":1132,"text":"class Field(SimpleElement, _IDProperty, _NameProperty, _XtypeProperty,\n            _UtypeProperty, _UcdProperty):\n    \"\"\"\n    FIELD_ element: describes the datatype of a particular column of data.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n\n    If *ID* is provided, it is used for the column name in the\n    resulting recarray of the table.  If no *ID* is provided, *name*\n    is used instead.  If neither is provided, an exception will be\n    raised.\n    \"\"\"\n    _attr_list_11 = ['ID', 'name', 'datatype', 'arraysize', 'ucd',\n                     'unit', 'width', 'precision', 'utype', 'ref']\n    _attr_list_12 = _attr_list_11 + ['xtype']\n    _element_name = 'FIELD'\n\n    def __init__(self, votable, ID=None, name=None, datatype=None,\n                 arraysize=None, ucd=None, unit=None, width=None,\n                 precision=None, utype=None, ref=None, type=None, id=None,\n                 xtype=None,\n                 config=None, pos=None, **extra):\n        if config is None:\n            if hasattr(votable, '_get_version_checks'):\n                config = votable._get_version_checks()\n            else:\n                config = {}\n        self._config = config\n        self._pos = pos\n\n        SimpleElement.__init__(self)\n\n        if config.get('version_1_2_or_later'):\n            self._attr_list = self._attr_list_12\n        else:\n            self._attr_list = self._attr_list_11\n            if xtype is not None:\n                warn_unknown_attrs(self._element_name, ['xtype'], config, pos)\n\n        # TODO: REMOVE ME ----------------------------------------\n        # This is a terrible hack to support Simple Image Access\n        # Protocol results from https://astroarchive.noirlab.edu/ .  It creates a field\n        # for the coordinate projection type of type \"double\", which\n        # actually contains character data.  We have to hack the field\n        # to store character data, or we can't read it in.  A warning\n        # will be raised when this happens.\n        if (config.get('verify', 'ignore') != 'exception' and name == 'cprojection' and\n            ID == 'cprojection' and ucd == 'VOX:WCS_CoordProjection' and\n            datatype == 'double'):\n            datatype = 'char'\n            arraysize = '3'\n            vo_warn(W40, (), config, pos)\n        # ----------------------------------------\n\n        self.description = None\n        self._votable = votable\n\n        self.ID = (resolve_id(ID, id, config, pos) or\n                   xmlutil.fix_id(name, config, pos))\n        self.name = name\n        if name is None:\n            if (self._element_name == 'PARAM' and\n                not config.get('version_1_1_or_later')):\n                pass\n            else:\n                warn_or_raise(W15, W15, self._element_name, config, pos)\n            self.name = self.ID\n\n        if self._ID is None and name is None:\n            vo_raise(W12, self._element_name, config, pos)\n\n        datatype_mapping = {\n            'string': 'char',\n            'unicodeString': 'unicodeChar',\n            'int16': 'short',\n            'int32': 'int',\n            'int64': 'long',\n            'float32': 'float',\n            'float64': 'double',\n            # The following appear in some Vizier tables\n            'unsignedInt': 'long',\n            'unsignedShort': 'int'\n        }\n\n        datatype_mapping.update(config.get('datatype_mapping', {}))\n\n        if datatype in datatype_mapping:\n            warn_or_raise(W13, W13, (datatype, datatype_mapping[datatype]),\n                          config, pos)\n            datatype = datatype_mapping[datatype]\n\n        self.ref = ref\n        self.datatype = datatype\n        self.arraysize = arraysize\n        self.ucd = ucd\n        self.unit = unit\n        self.width = width\n        self.precision = precision\n        self.utype = utype\n        self.type = type\n        self._links = HomogeneousList(Link)\n        self.title = self.name\n        self.values = Values(self._votable, self)\n        self.xtype = xtype\n\n        self._setup(config, pos)\n\n        warn_unknown_attrs(self._element_name, extra.keys(), config, pos)\n\n    @classmethod\n    def uniqify_names(cls, fields):\n        \"\"\"\n        Make sure that all names and titles in a list of fields are\n        unique, by appending numbers if necessary.\n        \"\"\"\n        unique = {}\n        for field in fields:\n            i = 2\n            new_id = field.ID\n            while new_id in unique:\n                new_id = field.ID + f\"_{i:d}\"\n                i += 1\n            if new_id != field.ID:\n                vo_warn(W32, (field.ID, new_id), field._config, field._pos)\n            field.ID = new_id\n            unique[new_id] = field.ID\n\n        for field in fields:\n            i = 2\n            if field.name is None:\n                new_name = field.ID\n                implicit = True\n            else:\n                new_name = field.name\n                implicit = False\n            if new_name != field.ID:\n                while new_name in unique:\n                    new_name = field.name + f\" {i:d}\"\n                    i += 1\n\n            if (not implicit and\n                new_name != field.name):\n                vo_warn(W33, (field.name, new_name), field._config, field._pos)\n            field._unique_name = new_name\n            unique[new_name] = field.name\n\n    def _setup(self, config, pos):\n        if self.values._ref is not None:\n            self.values.ref = self.values._ref\n        self.converter = converters.get_converter(self, config, pos)\n\n    @property\n    def datatype(self):\n        \"\"\"\n        [*required*] The datatype of the column.  Valid values (as\n        defined by the spec) are:\n\n          'boolean', 'bit', 'unsignedByte', 'short', 'int', 'long',\n          'char', 'unicodeChar', 'float', 'double', 'floatComplex', or\n          'doubleComplex'\n\n        Many VOTABLE files in the wild use 'string' instead of 'char',\n        so that is also a valid option, though 'string' will always be\n        converted to 'char' when writing the file back out.\n        \"\"\"\n        return self._datatype\n\n    @datatype.setter\n    def datatype(self, datatype):\n        if datatype is None:\n            if self._config.get('version_1_1_or_later'):\n                warn_or_raise(E10, E10, self._element_name, self._config,\n                              self._pos)\n            datatype = 'char'\n        if datatype not in converters.converter_mapping:\n            vo_raise(E06, (datatype, self.ID), self._config, self._pos)\n        self._datatype = datatype\n\n    @property\n    def precision(self):\n        \"\"\"\n        Along with :attr:`width`, defines the `numerical accuracy`_\n        associated with the data.  These values are used to limit the\n        precision when writing floating point values back to the XML\n        file.  Otherwise, it is purely informational -- the Numpy\n        recarray containing the data itself does not use this\n        information.\n        \"\"\"\n        return self._precision\n\n    @precision.setter\n    def precision(self, precision):\n        if precision is not None and not re.match(r\"^[FE]?[0-9]+$\", precision):\n            vo_raise(E11, precision, self._config, self._pos)\n        self._precision = precision\n\n    @precision.deleter\n    def precision(self):\n        self._precision = None\n\n    @property\n    def width(self):\n        \"\"\"\n        Along with :attr:`precision`, defines the `numerical\n        accuracy`_ associated with the data.  These values are used to\n        limit the precision when writing floating point values back to\n        the XML file.  Otherwise, it is purely informational -- the\n        Numpy recarray containing the data itself does not use this\n        information.\n        \"\"\"\n        return self._width\n\n    @width.setter\n    def width(self, width):\n        if width is not None:\n            width = int(width)\n            if width <= 0:\n                vo_raise(E12, width, self._config, self._pos)\n        self._width = width\n\n    @width.deleter\n    def width(self):\n        self._width = None\n\n    # ref on FIELD and PARAM behave differently than elsewhere -- here\n    # they're just informational, such as to refer to a coordinate\n    # system.\n    @property\n    def ref(self):\n        \"\"\"\n        On FIELD_ elements, ref is used only for informational\n        purposes, for example to refer to a COOSYS_ or TIMESYS_ element.\n        \"\"\"\n        return self._ref\n\n    @ref.setter\n    def ref(self, ref):\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        self._ref = ref\n\n    @ref.deleter\n    def ref(self):\n        self._ref = None\n\n    @property\n    def unit(self):\n        \"\"\"A string specifying the units_ for the FIELD_.\"\"\"\n        return self._unit\n\n    @unit.setter\n    def unit(self, unit):\n        if unit is None:\n            self._unit = None\n            return\n\n        from astropy import units as u\n\n        # First, parse the unit in the default way, so that we can\n        # still emit a warning if the unit is not to spec.\n        default_format = _get_default_unit_format(self._config)\n        unit_obj = u.Unit(\n            unit, format=default_format, parse_strict='silent')\n        if isinstance(unit_obj, u.UnrecognizedUnit):\n            warn_or_raise(W50, W50, (unit,),\n                          self._config, self._pos)\n\n        format = _get_unit_format(self._config)\n        if format != default_format:\n            unit_obj = u.Unit(\n                unit, format=format, parse_strict='silent')\n\n        self._unit = unit_obj\n\n    @unit.deleter\n    def unit(self):\n        self._unit = None\n\n    @property\n    def arraysize(self):\n        \"\"\"\n        Specifies the size of the multidimensional array if this\n        FIELD_ contains more than a single value.\n\n        See `multidimensional arrays`_.\n        \"\"\"\n        return self._arraysize\n\n    @arraysize.setter\n    def arraysize(self, arraysize):\n        if (arraysize is not None and\n            not re.match(r\"^([0-9]+x)*[0-9]*[*]?(s\\W)?$\", arraysize)):\n            vo_raise(E13, arraysize, self._config, self._pos)\n        self._arraysize = arraysize\n\n    @arraysize.deleter\n    def arraysize(self):\n        self._arraysize = None\n\n    @property\n    def type(self):\n        \"\"\"\n        The type attribute on FIELD_ elements is reserved for future\n        extensions.\n        \"\"\"\n        return self._type\n\n    @type.setter\n    def type(self, type):\n        self._type = type\n\n    @type.deleter\n    def type(self):\n        self._type = None\n\n    @property\n    def values(self):\n        \"\"\"\n        A :class:`Values` instance (or `None`) defining the domain\n        of the column.\n        \"\"\"\n        return self._values\n\n    @values.setter\n    def values(self, values):\n        assert values is None or isinstance(values, Values)\n        self._values = values\n\n    @values.deleter\n    def values(self):\n        self._values = None\n\n    @property\n    def links(self):\n        \"\"\"\n        A list of :class:`Link` instances used to reference more\n        details about the meaning of the FIELD_.  This is purely\n        informational and is not used by the `astropy.io.votable`\n        package.\n        \"\"\"\n        return self._links\n\n    def parse(self, iterator, config):\n        for start, tag, data, pos in iterator:\n            if start:\n                if tag == 'VALUES':\n                    self.values.__init__(\n                        self._votable, self, config=config, pos=pos, **data)\n                    self.values.parse(iterator, config)\n                elif tag == 'LINK':\n                    link = Link(config=config, pos=pos, **data)\n                    self.links.append(link)\n                    link.parse(iterator, config)\n                elif tag == 'DESCRIPTION':\n                    warn_unknown_attrs(\n                        'DESCRIPTION', data.keys(), config, pos)\n                elif tag != self._element_name:\n                    self._add_unknown_tag(iterator, tag, data, config, pos)\n            else:\n                if tag == 'DESCRIPTION':\n                    if self.description is not None:\n                        warn_or_raise(\n                            W17, W17, self._element_name, config, pos)\n                    self.description = data or None\n                elif tag == self._element_name:\n                    break\n\n        if self.description is not None:\n            self.title = \" \".join(x.strip() for x in\n                                  self.description.splitlines())\n        else:\n            self.title = self.name\n\n        self._setup(config, pos)\n\n        return self\n\n    def to_xml(self, w, **kwargs):\n        attrib = w.object_attrs(self, self._attr_list)\n        if 'unit' in attrib:\n            attrib['unit'] = self.unit.to_string('cds')\n        with w.tag(self._element_name, attrib=attrib):\n            if self.description is not None:\n                w.element('DESCRIPTION', self.description, wrap=True)\n            if not self.values.is_defaults():\n                self.values.to_xml(w, **kwargs)\n            for link in self.links:\n                link.to_xml(w, **kwargs)\n\n    def to_table_column(self, column):\n        \"\"\"\n        Sets the attributes of a given `astropy.table.Column` instance\n        to match the information in this `Field`.\n        \"\"\"\n        for key in ['ucd', 'width', 'precision', 'utype', 'xtype']:\n            val = getattr(self, key, None)\n            if val is not None:\n                column.meta[key] = val\n        if not self.values.is_defaults():\n            self.values.to_table_column(column)\n        for link in self.links:\n            link.to_table_column(column)\n        if self.description is not None:\n            column.description = self.description\n        if self.unit is not None:\n            # TODO: Use units framework when it's available\n            column.unit = self.unit\n        if (isinstance(self.converter, converters.FloatingPoint) and\n                self.converter.output_format != '{!r:>}'):\n            column.format = self.converter.output_format\n        elif isinstance(self.converter, converters.Char):\n            column.info.meta['_votable_string_dtype'] = 'char'\n        elif isinstance(self.converter, converters.UnicodeChar):\n            column.info.meta['_votable_string_dtype'] = 'unicodeChar'\n\n    @classmethod\n    def from_table_column(cls, votable, column):\n        \"\"\"\n        Restores a `Field` instance from a given\n        `astropy.table.Column` instance.\n        \"\"\"\n        kwargs = {}\n        meta = column.info.meta\n        if meta:\n            for key in ['ucd', 'width', 'precision', 'utype', 'xtype']:\n                val = meta.get(key, None)\n                if val is not None:\n                    kwargs[key] = val\n        # TODO: Use the unit framework when available\n        if column.info.unit is not None:\n            kwargs['unit'] = column.info.unit\n        kwargs['name'] = column.info.name\n        result = converters.table_column_to_votable_datatype(column)\n        kwargs.update(result)\n\n        field = cls(votable, **kwargs)\n\n        if column.info.description is not None:\n            field.description = column.info.description\n        field.values.from_table_column(column)\n        if meta and 'links' in meta:\n            for link in meta['links']:\n                field.links.append(Link.from_table_column(link))\n\n        # TODO: Parse format into precision and width\n        return field"},{"col":4,"comment":"\n        Make sure that all names and titles in a list of fields are\n        unique, by appending numbers if necessary.\n        ","endLoc":1277,"header":"@classmethod\n    def uniqify_names(cls, fields)","id":6594,"name":"uniqify_names","nodeType":"Function","startLoc":1242,"text":"@classmethod\n    def uniqify_names(cls, fields):\n        \"\"\"\n        Make sure that all names and titles in a list of fields are\n        unique, by appending numbers if necessary.\n        \"\"\"\n        unique = {}\n        for field in fields:\n            i = 2\n            new_id = field.ID\n            while new_id in unique:\n                new_id = field.ID + f\"_{i:d}\"\n                i += 1\n            if new_id != field.ID:\n                vo_warn(W32, (field.ID, new_id), field._config, field._pos)\n            field.ID = new_id\n            unique[new_id] = field.ID\n\n        for field in fields:\n            i = 2\n            if field.name is None:\n                new_name = field.ID\n                implicit = True\n            else:\n                new_name = field.name\n                implicit = False\n            if new_name != field.ID:\n                while new_name in unique:\n                    new_name = field.name + f\" {i:d}\"\n                    i += 1\n\n            if (not implicit and\n                new_name != field.name):\n                vo_warn(W33, (field.name, new_name), field._config, field._pos)\n            field._unique_name = new_name\n            unique[new_name] = field.name"},{"col":4,"comment":"\n        [*required*] The datatype of the column.  Valid values (as\n        defined by the spec) are:\n\n          'boolean', 'bit', 'unsignedByte', 'short', 'int', 'long',\n          'char', 'unicodeChar', 'float', 'double', 'floatComplex', or\n          'doubleComplex'\n\n        Many VOTABLE files in the wild use 'string' instead of 'char',\n        so that is also a valid option, though 'string' will always be\n        converted to 'char' when writing the file back out.\n        ","endLoc":1298,"header":"@property\n    def datatype(self)","id":6595,"name":"datatype","nodeType":"Function","startLoc":1284,"text":"@property\n    def datatype(self):\n        \"\"\"\n        [*required*] The datatype of the column.  Valid values (as\n        defined by the spec) are:\n\n          'boolean', 'bit', 'unsignedByte', 'short', 'int', 'long',\n          'char', 'unicodeChar', 'float', 'double', 'floatComplex', or\n          'doubleComplex'\n\n        Many VOTABLE files in the wild use 'string' instead of 'char',\n        so that is also a valid option, though 'string' will always be\n        converted to 'char' when writing the file back out.\n        \"\"\"\n        return self._datatype"},{"col":4,"comment":"null","endLoc":1309,"header":"@datatype.setter\n    def datatype(self, datatype)","id":6596,"name":"datatype","nodeType":"Function","startLoc":1300,"text":"@datatype.setter\n    def datatype(self, datatype):\n        if datatype is None:\n            if self._config.get('version_1_1_or_later'):\n                warn_or_raise(E10, E10, self._element_name, self._config,\n                              self._pos)\n            datatype = 'char'\n        if datatype not in converters.converter_mapping:\n            vo_raise(E06, (datatype, self.ID), self._config, self._pos)\n        self._datatype = datatype"},{"col":4,"comment":"null","endLoc":1355,"header":"def _initialise(self, options=None)","id":6597,"name":"_initialise","nodeType":"Function","startLoc":1326,"text":"def _initialise(self, options=None):\n        if options is None:\n            options = OPTION_DEFAULTS\n\n        # initialise a few variables\n        self.filename = None\n        self._errors = []\n        self.raise_errors = options['raise_errors']\n        self.interpolation = options['interpolation']\n        self.list_values = options['list_values']\n        self.create_empty = options['create_empty']\n        self.file_error = options['file_error']\n        self.stringify = options['stringify']\n        self.indent_type = options['indent_type']\n        self.encoding = options['encoding']\n        self.default_encoding = options['default_encoding']\n        self.BOM = False\n        self.newlines = None\n        self.write_empty_values = options['write_empty_values']\n        self.unrepr = options['unrepr']\n\n        self.initial_comment = []\n        self.final_comment = []\n        self.configspec = None\n\n        if self._inspec:\n            self.list_values = False\n\n        # Clear section attributes as well\n        Section._initialise(self)"},{"col":4,"comment":"null","endLoc":867,"header":"def output(self, value, mask)","id":6598,"name":"output","nodeType":"Function","startLoc":861,"text":"def output(self, value, mask):\n        if mask:\n            if self.null is None:\n                warn_or_raise(W31, W31)\n                return 'NaN'\n            return str(self.null)\n        return str(value)"},{"col":0,"comment":"null","endLoc":281,"header":"def test_invalid_type()","id":6599,"name":"test_invalid_type","nodeType":"Function","startLoc":275,"text":"def test_invalid_type():\n    config = {'verify': 'exception'}\n    with pytest.raises(exceptions.E06):\n        field = tree.Field(\n            None, name='c', datatype='foobar',\n            config=config)\n        converters.get_converter(field, config=config)"},{"col":4,"comment":"null","endLoc":1323,"header":"def _load(self, infile, configspec)","id":6600,"name":"_load","nodeType":"Function","startLoc":1230,"text":"def _load(self, infile, configspec):\n        if isinstance(infile, str):\n            self.filename = infile\n            if os.path.isfile(infile):\n                with open(infile, 'rb') as h:\n                    content = h.readlines() or []\n            elif self.file_error:\n                # raise an error if the file doesn't exist\n                raise IOError('Config file not found: \"%s\".' % self.filename)\n            else:\n                # file doesn't already exist\n                if self.create_empty:\n                    # this is a good test that the filename specified\n                    # isn't impossible - like on a non-existent device\n                    with open(infile, 'w') as h:\n                        h.write('')\n                content = []\n\n        elif isinstance(infile, (list, tuple)):\n            content = list(infile)\n\n        elif isinstance(infile, dict):\n            # initialise self\n            # the Section class handles creating subsections\n            if isinstance(infile, ConfigObj):\n                # get a copy of our ConfigObj\n                def set_section(in_section, this_section):\n                    for entry in in_section.scalars:\n                        this_section[entry] = in_section[entry]\n                    for section in in_section.sections:\n                        this_section[section] = {}\n                        set_section(in_section[section], this_section[section])\n                set_section(infile, self)\n\n            else:\n                for entry in infile:\n                    self[entry] = infile[entry]\n            del self._errors\n\n            if configspec is not None:\n                self._handle_configspec(configspec)\n            else:\n                self.configspec = None\n            return\n\n        elif getattr(infile, 'read', MISSING) is not MISSING:\n            # This supports file like objects\n            content = infile.read() or []\n            # needs splitting into lines - but needs doing *after* decoding\n            # in case it's not an 8 bit encoding\n        else:\n            raise TypeError('infile must be a filename, file like object, or list of lines.')\n\n        if content:\n            # don't do it for the empty ConfigObj\n            content = self._handle_bom(content)\n            # infile is now *always* a list\n            #\n            # Set the newlines attribute (first line ending it finds)\n            # and strip trailing '\\n' or '\\r' from lines\n            for line in content:\n                if (not line) or (line[-1] not in ('\\r', '\\n')):\n                    continue\n                for end in ('\\r\\n', '\\n', '\\r'):\n                    if line.endswith(end):\n                        self.newlines = end\n                        break\n                break\n\n        assert all(isinstance(line, str) for line in content), repr(content)\n        content = [line.rstrip('\\r\\n') for line in content]\n\n        self._parse(content)\n        # if we had any errors, now is the time to raise them\n        if self._errors:\n            info = \"at line %s.\" % self._errors[0].line_number\n            if len(self._errors) > 1:\n                msg = \"Parsing failed with several errors.\\nFirst error %s\" % info\n                error = ConfigObjError(msg)\n            else:\n                error = self._errors[0]\n            # set the errors attribute; it's a list of tuples:\n            # (error_type, message, line_number)\n            error.errors = self._errors\n            # set the config attribute\n            error.config = self\n            raise error\n        # delete private attributes\n        del self._errors\n\n        if configspec is None:\n            self.configspec = None\n        else:\n            self._handle_configspec(configspec)"},{"col":4,"comment":"null","endLoc":877,"header":"def binoutput(self, value, mask)","id":6601,"name":"binoutput","nodeType":"Function","startLoc":869,"text":"def binoutput(self, value, mask):\n        if mask:\n            if self.null is None:\n                vo_raise(W31)\n            else:\n                value = self.null\n\n        value = _ensure_bigendian(value)\n        return value.tobytes()"},{"col":0,"comment":"null","endLoc":297,"header":"def test_precision()","id":6602,"name":"test_precision","nodeType":"Function","startLoc":284,"text":"def test_precision():\n    config = {'verify': 'exception'}\n\n    field = tree.Field(\n        None, name='c', datatype='float', precision=\"E4\",\n        config=config)\n    c = converters.get_converter(field, config=config)\n    assert c.output(266.248, False) == '266.2'\n\n    field = tree.Field(\n        None, name='c', datatype='float', precision=\"F4\",\n        config=config)\n    c = converters.get_converter(field, config=config)\n    assert c.output(266.248, False) == '266.2480'"},{"col":4,"comment":"Parse the configspec.","endLoc":1943,"header":"def _handle_configspec(self, configspec)","id":6604,"name":"_handle_configspec","nodeType":"Function","startLoc":1926,"text":"def _handle_configspec(self, configspec):\n        \"\"\"Parse the configspec.\"\"\"\n        # FIXME: Should we check that the configspec was created with the\n        #        correct settings ? (i.e. ``list_values=False``)\n        if not isinstance(configspec, ConfigObj):\n            try:\n                configspec = ConfigObj(configspec,\n                                       raise_errors=True,\n                                       file_error=True,\n                                       _inspec=True)\n            except ConfigObjError as e:\n                # FIXME: Should these errors have a reference\n                #        to the already parsed ConfigObj ?\n                raise ConfigspecError('Parsing configspec failed: %s' % e)\n            except IOError as e:\n                raise IOError('Reading configspec failed: %s' % e)\n\n        self.configspec = configspec"},{"col":4,"comment":"null","endLoc":885,"header":"def filter_array(self, value, mask)","id":6605,"name":"filter_array","nodeType":"Function","startLoc":879,"text":"def filter_array(self, value, mask):\n        if np.any(mask):\n            if self.null is not None:\n                return np.where(mask, self.null, value)\n            else:\n                vo_raise(W31)\n        return value"},{"attributeType":"null","col":4,"comment":"null","endLoc":816,"id":6606,"name":"default","nodeType":"Attribute","startLoc":816,"text":"default"},{"className":"UnsignedByte","col":0,"comment":"\n    Handles the unsignedByte datatype.  Unsigned 8-bit integer.\n    ","endLoc":894,"id":6607,"nodeType":"Class","startLoc":888,"text":"class UnsignedByte(Integer):\n    \"\"\"\n    Handles the unsignedByte datatype.  Unsigned 8-bit integer.\n    \"\"\"\n    format = 'u1'\n    val_range = (0, 255)\n    bit_size = '8-bit unsigned'"},{"attributeType":"null","col":4,"comment":"null","endLoc":892,"id":6608,"name":"format","nodeType":"Attribute","startLoc":892,"text":"format"},{"attributeType":"null","col":4,"comment":"null","endLoc":893,"id":6609,"name":"val_range","nodeType":"Attribute","startLoc":893,"text":"val_range"},{"attributeType":"null","col":4,"comment":"null","endLoc":894,"id":6610,"name":"bit_size","nodeType":"Attribute","startLoc":894,"text":"bit_size"},{"className":"Short","col":0,"comment":"\n    Handles the short datatype.  Signed 16-bit integer.\n    ","endLoc":903,"id":6611,"nodeType":"Class","startLoc":897,"text":"class Short(Integer):\n    \"\"\"\n    Handles the short datatype.  Signed 16-bit integer.\n    \"\"\"\n    format = 'i2'\n    val_range = (-32768, 32767)\n    bit_size = '16-bit'"},{"attributeType":"null","col":4,"comment":"null","endLoc":901,"id":6612,"name":"format","nodeType":"Attribute","startLoc":901,"text":"format"},{"attributeType":"null","col":4,"comment":"null","endLoc":902,"id":6613,"name":"val_range","nodeType":"Attribute","startLoc":902,"text":"val_range"},{"attributeType":"null","col":4,"comment":"null","endLoc":903,"id":6614,"name":"bit_size","nodeType":"Attribute","startLoc":903,"text":"bit_size"},{"className":"Int","col":0,"comment":"\n    Handles the int datatype.  Signed 32-bit integer.\n    ","endLoc":912,"id":6615,"nodeType":"Class","startLoc":906,"text":"class Int(Integer):\n    \"\"\"\n    Handles the int datatype.  Signed 32-bit integer.\n    \"\"\"\n    format = 'i4'\n    val_range = (-2147483648, 2147483647)\n    bit_size = '32-bit'"},{"attributeType":"null","col":4,"comment":"null","endLoc":910,"id":6616,"name":"format","nodeType":"Attribute","startLoc":910,"text":"format"},{"col":4,"comment":"null","endLoc":677,"header":"def test_get_coosys_by_id(self)","id":6617,"name":"test_get_coosys_by_id","nodeType":"Function","startLoc":675,"text":"def test_get_coosys_by_id(self):\n        # No COOSYS in VOTable 1.2 or later\n        pass"},{"attributeType":"null","col":8,"comment":"null","endLoc":672,"id":6618,"name":"array","nodeType":"Attribute","startLoc":672,"text":"self.array"},{"attributeType":"null","col":4,"comment":"null","endLoc":911,"id":6619,"name":"val_range","nodeType":"Attribute","startLoc":911,"text":"val_range"},{"attributeType":"null","col":4,"comment":"null","endLoc":912,"id":6620,"name":"bit_size","nodeType":"Attribute","startLoc":912,"text":"bit_size"},{"className":"Long","col":0,"comment":"\n    Handles the long datatype.  Signed 64-bit integer.\n    ","endLoc":921,"id":6621,"nodeType":"Class","startLoc":915,"text":"class Long(Integer):\n    \"\"\"\n    Handles the long datatype.  Signed 64-bit integer.\n    \"\"\"\n    format = 'i8'\n    val_range = (-9223372036854775808, 9223372036854775807)\n    bit_size = '64-bit'"},{"attributeType":"null","col":4,"comment":"null","endLoc":919,"id":6622,"name":"format","nodeType":"Attribute","startLoc":919,"text":"format"},{"col":0,"comment":"null","endLoc":307,"header":"def test_integer_overflow()","id":6623,"name":"test_integer_overflow","nodeType":"Function","startLoc":300,"text":"def test_integer_overflow():\n    config = {'verify': 'exception'}\n\n    field = tree.Field(\n        None, name='c', datatype='int', config=config)\n    c = converters.get_converter(field, config=config)\n    with pytest.raises(exceptions.W51):\n        c.parse('-2208988800', config=config)"},{"attributeType":"null","col":4,"comment":"null","endLoc":920,"id":6624,"name":"val_range","nodeType":"Attribute","startLoc":920,"text":"val_range"},{"attributeType":"null","col":4,"comment":"null","endLoc":921,"id":6625,"name":"bit_size","nodeType":"Attribute","startLoc":921,"text":"bit_size"},{"className":"ComplexArrayVarArray","col":0,"comment":"\n    Handles an array of variable-length arrays of complex numbers.\n    ","endLoc":945,"id":6626,"nodeType":"Class","startLoc":924,"text":"class ComplexArrayVarArray(VarArray):\n    \"\"\"\n    Handles an array of variable-length arrays of complex numbers.\n    \"\"\"\n\n    def parse(self, value, config=None, pos=None):\n        if value.strip() == '':\n            return ma.array([]), True\n\n        parts = self._splitter(value, config, pos)\n        items = self._base._items\n        parse_parts = self._base.parse_parts\n        if len(parts) % items != 0:\n            vo_raise(E02, (items, len(parts)), config, pos)\n        result = []\n        result_mask = []\n        for i in range(0, len(parts), items):\n            value, mask = parse_parts(parts[i:i + items], config, pos)\n            result.append(value)\n            result_mask.append(mask)\n\n        return _make_masked_array(result, result_mask), False"},{"col":4,"comment":"null","endLoc":945,"header":"def parse(self, value, config=None, pos=None)","id":6627,"name":"parse","nodeType":"Function","startLoc":929,"text":"def parse(self, value, config=None, pos=None):\n        if value.strip() == '':\n            return ma.array([]), True\n\n        parts = self._splitter(value, config, pos)\n        items = self._base._items\n        parse_parts = self._base.parse_parts\n        if len(parts) % items != 0:\n            vo_raise(E02, (items, len(parts)), config, pos)\n        result = []\n        result_mask = []\n        for i in range(0, len(parts), items):\n            value, mask = parse_parts(parts[i:i + items], config, pos)\n            result.append(value)\n            result_mask.append(mask)\n\n        return _make_masked_array(result, result_mask), False"},{"attributeType":"null","col":8,"comment":"null","endLoc":669,"id":6628,"name":"votable","nodeType":"Attribute","startLoc":669,"text":"self.votable"},{"attributeType":"null","col":8,"comment":"null","endLoc":671,"id":6629,"name":"table","nodeType":"Attribute","startLoc":671,"text":"self.table"},{"attributeType":"null","col":8,"comment":"null","endLoc":664,"id":6630,"name":"xmlout","nodeType":"Attribute","startLoc":664,"text":"self.xmlout"},{"attributeType":"null","col":8,"comment":"null","endLoc":673,"id":6631,"name":"mask","nodeType":"Attribute","startLoc":673,"text":"self.mask"},{"col":0,"comment":"null","endLoc":49,"header":"def test_parse_single_table()","id":6632,"name":"test_parse_single_table","nodeType":"Function","startLoc":46,"text":"def test_parse_single_table():\n    table = parse_single_table(get_pkg_data_filename('data/regression.xml'))\n    assert isinstance(table, tree.Table)\n    assert len(table.array) == 5"},{"col":0,"comment":"null","endLoc":57,"header":"def test_parse_single_table2()","id":6633,"name":"test_parse_single_table2","nodeType":"Function","startLoc":52,"text":"def test_parse_single_table2():\n    table2 = parse_single_table(get_pkg_data_filename('data/regression.xml'),\n                                table_number=1)\n    assert isinstance(table2, tree.Table)\n    assert len(table2.array) == 1\n    assert len(table2.array.dtype.names) == 28"},{"col":0,"comment":"null","endLoc":63,"header":"def test_parse_single_table3()","id":6634,"name":"test_parse_single_table3","nodeType":"Function","startLoc":60,"text":"def test_parse_single_table3():\n    with pytest.raises(IndexError):\n        parse_single_table(get_pkg_data_filename('data/regression.xml'),\n                           table_number=3)"},{"col":0,"comment":"null","endLoc":166,"header":"def _test_regression(tmpdir, _python_based=False, binary_mode=1)","id":6635,"name":"_test_regression","nodeType":"Function","startLoc":66,"text":"def _test_regression(tmpdir, _python_based=False, binary_mode=1):\n    # Read the VOTABLE\n    votable = parse(get_pkg_data_filename('data/regression.xml'),\n                    _debug_python_based_parser=_python_based)\n    table = votable.get_first_table()\n\n    dtypes = [\n        (('string test', 'string_test'), '|O8'),\n        (('fixed string test', 'string_test_2'), '<U10'),\n        ('unicode_test', '|O8'),\n        (('unicode test', 'fixed_unicode_test'), '<U10'),\n        (('string array test', 'string_array_test'), '<U4'),\n        ('unsignedByte', '|u1'),\n        ('short', '<i2'),\n        ('int', '<i4'),\n        ('long', '<i8'),\n        ('double', '<f8'),\n        ('float', '<f4'),\n        ('array', '|O8'),\n        ('bit', '|b1'),\n        ('bitarray', '|b1', (3, 2)),\n        ('bitvararray', '|O8'),\n        ('bitvararray2', '|O8'),\n        ('floatComplex', '<c8'),\n        ('doubleComplex', '<c16'),\n        ('doubleComplexArray', '|O8'),\n        ('doubleComplexArrayFixed', '<c16', (2,)),\n        ('boolean', '|b1'),\n        ('booleanArray', '|b1', (4,)),\n        ('nulls', '<i4'),\n        ('nulls_array', '<i4', (2, 2)),\n        ('precision1', '<f8'),\n        ('precision2', '<f8'),\n        ('doublearray', '|O8'),\n        ('bitarray2', '|b1', (16,))\n        ]\n    if sys.byteorder == 'big':\n        new_dtypes = []\n        for dtype in dtypes:\n            dtype = list(dtype)\n            dtype[1] = dtype[1].replace('<', '>')\n            new_dtypes.append(tuple(dtype))\n        dtypes = new_dtypes\n    assert table.array.dtype == dtypes\n\n    votable.to_xml(str(tmpdir.join(\"regression.tabledata.xml\")),\n                   _debug_python_based_parser=_python_based)\n    assert_validate_schema(str(tmpdir.join(\"regression.tabledata.xml\")),\n                           votable.version)\n\n    if binary_mode == 1:\n        votable.get_first_table().format = 'binary'\n        votable.version = '1.1'\n    elif binary_mode == 2:\n        votable.get_first_table()._config['version_1_3_or_later'] = True\n        votable.get_first_table().format = 'binary2'\n        votable.version = '1.3'\n\n    # Also try passing a file handle\n    with open(str(tmpdir.join(\"regression.binary.xml\")), \"wb\") as fd:\n        votable.to_xml(fd, _debug_python_based_parser=_python_based)\n    assert_validate_schema(str(tmpdir.join(\"regression.binary.xml\")),\n                           votable.version)\n    # Also try passing a file handle\n    with open(str(tmpdir.join(\"regression.binary.xml\")), \"rb\") as fd:\n        votable2 = parse(fd, _debug_python_based_parser=_python_based)\n    votable2.get_first_table().format = 'tabledata'\n    votable2.to_xml(str(tmpdir.join(\"regression.bin.tabledata.xml\")),\n                    _astropy_version=\"testing\",\n                    _debug_python_based_parser=_python_based)\n    assert_validate_schema(str(tmpdir.join(\"regression.bin.tabledata.xml\")),\n                           votable.version)\n\n    with open(\n        get_pkg_data_filename(\n            f'data/regression.bin.tabledata.truth.{votable.version}.xml'),\n            'rt', encoding='utf-8') as fd:\n        truth = fd.readlines()\n    with open(str(tmpdir.join(\"regression.bin.tabledata.xml\")),\n              'rt', encoding='utf-8') as fd:\n        output = fd.readlines()\n\n    # If the lines happen to be different, print a diff\n    # This is convenient for debugging\n    sys.stdout.writelines(\n        difflib.unified_diff(truth, output, fromfile='truth', tofile='output'))\n\n    assert truth == output\n\n    # Test implicit gzip saving\n    votable2.to_xml(\n        str(tmpdir.join(\"regression.bin.tabledata.xml.gz\")),\n        _astropy_version=\"testing\",\n        _debug_python_based_parser=_python_based)\n    with gzip.GzipFile(\n            str(tmpdir.join(\"regression.bin.tabledata.xml.gz\")), 'rb') as gzfd:\n        output = gzfd.readlines()\n    output = [x.decode('utf-8').rstrip() for x in output]\n    truth = [x.rstrip() for x in truth]\n\n    assert truth == output"},{"col":0,"comment":"null","endLoc":318,"header":"def test_float_default_precision()","id":6636,"name":"test_float_default_precision","nodeType":"Function","startLoc":310,"text":"def test_float_default_precision():\n    config = {'verify': 'exception'}\n\n    field = tree.Field(\n        None, name='c', datatype='float', arraysize=\"4\",\n        config=config)\n    c = converters.get_converter(field, config=config)\n    assert (c.output([1, 2, 3, 8.9990234375], [False, False, False, False]) ==\n            '1 2 3 8.9990234375')"},{"col":4,"comment":"null","endLoc":214,"header":"def __init__(self, message='', line_number=None, line='')","id":6637,"name":"__init__","nodeType":"Function","startLoc":211,"text":"def __init__(self, message='', line_number=None, line=''):\n        self.line = line\n        self.line_number = line_number\n        SyntaxError.__init__(self, message)"},{"col":4,"comment":"null","endLoc":2195,"header":"def __bytes__(self)","id":6638,"name":"__bytes__","nodeType":"Function","startLoc":2194,"text":"def __bytes__(self):\n        return bytes(self.to_table())"},{"col":4,"comment":"\n        Handle any BOM, and decode if necessary.\n\n        If an encoding is specified, that *must* be used - but the BOM should\n        still be removed (and the BOM attribute set).\n\n        (If the encoding is wrongly specified, then a BOM for an alternative\n        encoding won't be discovered or removed.)\n\n        If an encoding is not specified, UTF8 or UTF16 BOM will be detected and\n        removed. The BOM attribute will be set. UTF16 will be decoded to\n        unicode.\n\n        NOTE: This method must not be called with an empty ``infile``.\n\n        Specifying the *wrong* encoding is likely to cause a\n        ``UnicodeDecodeError``.\n\n        ``infile`` must always be returned as a list of lines, but may be\n        passed in as a single string.\n        ","endLoc":1478,"header":"def _handle_bom(self, infile)","id":6639,"name":"_handle_bom","nodeType":"Function","startLoc":1369,"text":"def _handle_bom(self, infile):\n        \"\"\"\n        Handle any BOM, and decode if necessary.\n\n        If an encoding is specified, that *must* be used - but the BOM should\n        still be removed (and the BOM attribute set).\n\n        (If the encoding is wrongly specified, then a BOM for an alternative\n        encoding won't be discovered or removed.)\n\n        If an encoding is not specified, UTF8 or UTF16 BOM will be detected and\n        removed. The BOM attribute will be set. UTF16 will be decoded to\n        unicode.\n\n        NOTE: This method must not be called with an empty ``infile``.\n\n        Specifying the *wrong* encoding is likely to cause a\n        ``UnicodeDecodeError``.\n\n        ``infile`` must always be returned as a list of lines, but may be\n        passed in as a single string.\n        \"\"\"\n\n        if ((self.encoding is not None) and\n            (self.encoding.lower() not in BOM_LIST)):\n            # No need to check for a BOM\n            # the encoding specified doesn't have one\n            # just decode\n            return self._decode(infile, self.encoding)\n\n        if isinstance(infile, (list, tuple)):\n            line = infile[0]\n        else:\n            line = infile\n\n        if isinstance(line, str):\n            # it's already decoded and there's no need to do anything\n            # else, just use the _decode utility method to handle\n            # listifying appropriately\n            return self._decode(infile, self.encoding)\n\n        if self.encoding is not None:\n            # encoding explicitly supplied\n            # And it could have an associated BOM\n            # TODO: if encoding is just UTF16 - we ought to check for both\n            # TODO: big endian and little endian versions.\n            enc = BOM_LIST[self.encoding.lower()]\n            if enc == 'utf_16':\n                # For UTF16 we try big endian and little endian\n                for BOM, (encoding, final_encoding) in list(BOMS.items()):\n                    if not final_encoding:\n                        # skip UTF8\n                        continue\n                    if infile.startswith(BOM):\n                        ### BOM discovered\n                        ##self.BOM = True\n                        # Don't need to remove BOM\n                        return self._decode(infile, encoding)\n\n                # If we get this far, will *probably* raise a DecodeError\n                # As it doesn't appear to start with a BOM\n                return self._decode(infile, self.encoding)\n\n            # Must be UTF8\n            BOM = BOM_SET[enc]\n            if not line.startswith(BOM):\n                return self._decode(infile, self.encoding)\n\n            newline = line[len(BOM):]\n\n            # BOM removed\n            if isinstance(infile, (list, tuple)):\n                infile[0] = newline\n            else:\n                infile = newline\n            self.BOM = True\n            return self._decode(infile, self.encoding)\n\n        # No encoding specified - so we need to check for UTF8/UTF16\n        for BOM, (encoding, final_encoding) in list(BOMS.items()):\n            if not isinstance(line, bytes) or not line.startswith(BOM):\n                # didn't specify a BOM, or it's not a bytestring\n                continue\n            else:\n                # BOM discovered\n                self.encoding = final_encoding\n                if not final_encoding:\n                    self.BOM = True\n                    # UTF8\n                    # remove BOM\n                    newline = line[len(BOM):]\n                    if isinstance(infile, (list, tuple)):\n                        infile[0] = newline\n                    else:\n                        infile = newline\n                    # UTF-8\n                    if isinstance(infile, str):\n                        return infile.splitlines(True)\n                    elif isinstance(infile, bytes):\n                        return infile.decode('utf-8').splitlines(True)\n                    else:\n                        return self._decode(infile, 'utf-8')\n                # UTF16 - have to decode\n                return self._decode(infile, encoding)\n\n        # No BOM discovered and no encoding specified, default to UTF-8\n        if isinstance(infile, bytes):\n            return infile.decode('utf-8').splitlines(True)\n        else:\n            return self._decode(infile, 'utf-8')"},{"col":4,"comment":"null","endLoc":2198,"header":"def __str__(self)","id":6640,"name":"__str__","nodeType":"Function","startLoc":2197,"text":"def __str__(self):\n        return str(self.to_table())"},{"col":4,"comment":"null","endLoc":2202,"header":"@property\n    def ref(self)","id":6641,"name":"ref","nodeType":"Function","startLoc":2200,"text":"@property\n    def ref(self):\n        return self._ref"},{"col":4,"comment":"\n        Refer to another TABLE, previously defined, by the *ref* ID_\n        for all metadata (FIELD_, PARAM_ etc.) information.\n        ","endLoc":2232,"header":"@ref.setter\n    def ref(self, ref)","id":6642,"name":"ref","nodeType":"Function","startLoc":2204,"text":"@ref.setter\n    def ref(self, ref):\n        \"\"\"\n        Refer to another TABLE, previously defined, by the *ref* ID_\n        for all metadata (FIELD_, PARAM_ etc.) information.\n        \"\"\"\n        # When the ref changes, we want to verify that it will work\n        # by actually going and looking for the referenced table.\n        # If found, set a bunch of properties in this table based\n        # on the other one.\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        if ref is not None:\n            try:\n                table = self._votable.get_table_by_id(ref, before=self)\n            except KeyError:\n                warn_or_raise(\n                    W43, W43, ('TABLE', self.ref), self._config, self._pos)\n                ref = None\n            else:\n                self._fields = table.fields\n                self._params = table.params\n                self._groups = table.groups\n                self._links = table.links\n        else:\n            del self._fields[:]\n            del self._params[:]\n            del self._groups[:]\n            del self._links[:]\n        self._ref = ref"},{"col":0,"comment":"null","endLoc":345,"header":"def test_vararray()","id":6643,"name":"test_vararray","nodeType":"Function","startLoc":321,"text":"def test_vararray():\n    votable = tree.VOTableFile()\n    resource = tree.Resource()\n    votable.resources.append(resource)\n    table = tree.Table(votable)\n    resource.tables.append(table)\n\n    tabarr = []\n    heads = ['headA', 'headB', 'headC']\n    types = [\"char\", \"double\", \"int\"]\n\n    vals = [[\"A\", 1.0, 2],\n            [\"B\", 2.0, 3],\n            [\"C\", 3.0, 4]]\n    for i in range(len(heads)):\n        tabarr.append(tree.Field(\n            votable, name=heads[i], datatype=types[i], arraysize=\"*\"))\n\n    table.fields.extend(tabarr)\n    table.create_arrays(len(vals))\n    for i in range(len(vals)):\n        values = tuple(vals[i])\n        table.array[i] = values\n    buff = io.BytesIO()\n    votable.to_xml(buff)"},{"col":4,"comment":"\n        Decode infile to unicode. Using the specified encoding.\n\n        if is a string, it also needs converting to a list.\n        ","endLoc":1511,"header":"def _decode(self, infile, encoding)","id":6644,"name":"_decode","nodeType":"Function","startLoc":1489,"text":"def _decode(self, infile, encoding):\n        \"\"\"\n        Decode infile to unicode. Using the specified encoding.\n\n        if is a string, it also needs converting to a list.\n        \"\"\"\n        if isinstance(infile, str):\n            return infile.splitlines(True)\n        if isinstance(infile, bytes):\n            # NOTE: Could raise a ``UnicodeDecodeError``\n            if encoding:\n                return infile.decode(encoding).splitlines(True)\n            else:\n                return infile.splitlines(True)\n\n        if encoding:\n            for i, line in enumerate(infile):\n                if isinstance(line, bytes):\n                    # NOTE: The isinstance test here handles mixed lists of unicode/string\n                    # NOTE: But the decode will break on any non-string values\n                    # NOTE: Or could raise a ``UnicodeDecodeError``\n                    infile[i] = line.decode(encoding)\n        return infile"},{"col":4,"comment":"null","endLoc":2236,"header":"@ref.deleter\n    def ref(self)","id":6645,"name":"ref","nodeType":"Function","startLoc":2234,"text":"@ref.deleter\n    def ref(self):\n        self._ref = None"},{"col":4,"comment":"\n        [*required*] The serialization format of the table.  Must be\n        one of:\n\n          'tabledata' (TABLEDATA_), 'binary' (BINARY_), 'binary2' (BINARY2_)\n          'fits' (FITS_).\n\n        Note that the 'fits' format, since it requires an external\n        file, can not be written out.  Any file read in with 'fits'\n        format will be read out, by default, in 'tabledata' format.\n\n        See :ref:`astropy:votable-serialization`.\n        ","endLoc":2253,"header":"@property\n    def format(self)","id":6646,"name":"format","nodeType":"Function","startLoc":2238,"text":"@property\n    def format(self):\n        \"\"\"\n        [*required*] The serialization format of the table.  Must be\n        one of:\n\n          'tabledata' (TABLEDATA_), 'binary' (BINARY_), 'binary2' (BINARY2_)\n          'fits' (FITS_).\n\n        Note that the 'fits' format, since it requires an external\n        file, can not be written out.  Any file read in with 'fits'\n        format will be read out, by default, in 'tabledata' format.\n\n        See :ref:`astropy:votable-serialization`.\n        \"\"\"\n        return self._format"},{"col":4,"comment":"null","endLoc":2269,"header":"@format.setter\n    def format(self, format)","id":6647,"name":"format","nodeType":"Function","startLoc":2255,"text":"@format.setter\n    def format(self, format):\n        format = format.lower()\n        if format == 'fits':\n            vo_raise(\"fits format can not be written out, only read.\",\n                     self._config, self._pos, NotImplementedError)\n        if format == 'binary2':\n            if not self._config['version_1_3_or_later']:\n                vo_raise(\n                    \"binary2 only supported in votable 1.3 or later\",\n                    self._config, self._pos)\n        elif format not in ('tabledata', 'binary'):\n            vo_raise(f\"Invalid format '{format}'\",\n                     self._config, self._pos)\n        self._format = format"},{"col":4,"comment":"\n        [*immutable*] The number of rows in the table, as specified in\n        the XML file.\n        ","endLoc":2277,"header":"@property\n    def nrows(self)","id":6648,"name":"nrows","nodeType":"Function","startLoc":2271,"text":"@property\n    def nrows(self):\n        \"\"\"\n        [*immutable*] The number of rows in the table, as specified in\n        the XML file.\n        \"\"\"\n        return self._nrows"},{"col":4,"comment":"\n        A list of :class:`Field` objects describing the types of each\n        of the data columns.\n        ","endLoc":2285,"header":"@property\n    def fields(self)","id":6649,"name":"fields","nodeType":"Function","startLoc":2279,"text":"@property\n    def fields(self):\n        \"\"\"\n        A list of :class:`Field` objects describing the types of each\n        of the data columns.\n        \"\"\"\n        return self._fields"},{"col":4,"comment":"\n        A list of parameters (constant-valued columns) for the\n        table.  Must contain only :class:`Param` objects.\n        ","endLoc":2293,"header":"@property\n    def params(self)","id":6650,"name":"params","nodeType":"Function","startLoc":2287,"text":"@property\n    def params(self):\n        \"\"\"\n        A list of parameters (constant-valued columns) for the\n        table.  Must contain only :class:`Param` objects.\n        \"\"\"\n        return self._params"},{"col":4,"comment":"\n        A list of :class:`Group` objects describing how the columns\n        and parameters are grouped.  Currently this information is\n        only kept around for round-tripping and informational\n        purposes.\n        ","endLoc":2303,"header":"@property\n    def groups(self)","id":6651,"name":"groups","nodeType":"Function","startLoc":2295,"text":"@property\n    def groups(self):\n        \"\"\"\n        A list of :class:`Group` objects describing how the columns\n        and parameters are grouped.  Currently this information is\n        only kept around for round-tripping and informational\n        purposes.\n        \"\"\"\n        return self._groups"},{"col":4,"comment":"\n        A list of :class:`Link` objects (pointers to other documents\n        or servers through a URI) for the table.\n        ","endLoc":2311,"header":"@property\n    def links(self)","id":6652,"name":"links","nodeType":"Function","startLoc":2305,"text":"@property\n    def links(self):\n        \"\"\"\n        A list of :class:`Link` objects (pointers to other documents\n        or servers through a URI) for the table.\n        \"\"\"\n        return self._links"},{"col":4,"comment":"\n        A list of :class:`Info` objects for the table.  Allows for\n        post-operational diagnostics.\n        ","endLoc":2319,"header":"@property\n    def infos(self)","id":6653,"name":"infos","nodeType":"Function","startLoc":2313,"text":"@property\n    def infos(self):\n        \"\"\"\n        A list of :class:`Info` objects for the table.  Allows for\n        post-operational diagnostics.\n        \"\"\"\n        return self._infos"},{"col":4,"comment":"\n        Returns True if this table doesn't contain any real data\n        because it was skipped over by the parser (through use of the\n        ``table_number`` kwarg).\n        ","endLoc":2327,"header":"def is_empty(self)","id":6654,"name":"is_empty","nodeType":"Function","startLoc":2321,"text":"def is_empty(self):\n        \"\"\"\n        Returns True if this table doesn't contain any real data\n        because it was skipped over by the parser (through use of the\n        ``table_number`` kwarg).\n        \"\"\"\n        return self._empty"},{"col":4,"comment":"\n        Create a new array to hold the data based on the current set\n        of fields, and store them in the *array* and member variable.\n        Any data in the existing array will be lost.\n\n        *nrows*, if provided, is the number of rows to allocate.\n        ","endLoc":2367,"header":"def create_arrays(self, nrows=0, config=None)","id":6655,"name":"create_arrays","nodeType":"Function","startLoc":2329,"text":"def create_arrays(self, nrows=0, config=None):\n        \"\"\"\n        Create a new array to hold the data based on the current set\n        of fields, and store them in the *array* and member variable.\n        Any data in the existing array will be lost.\n\n        *nrows*, if provided, is the number of rows to allocate.\n        \"\"\"\n        if nrows is None:\n            nrows = 0\n\n        fields = self.fields\n\n        if len(fields) == 0:\n            array = np.recarray((nrows,), dtype='O')\n            mask = np.zeros((nrows,), dtype='b')\n        else:\n            # for field in fields: field._setup(config)\n            Field.uniqify_names(fields)\n\n            dtype = []\n            for x in fields:\n                if x._unique_name == x.ID:\n                    id = x.ID\n                else:\n                    id = (x._unique_name, x.ID)\n                dtype.append((id, x.converter.format))\n\n            array = np.recarray((nrows,), dtype=np.dtype(dtype))\n            descr_mask = []\n            for d in array.dtype.descr:\n                new_type = (d[1][1] == 'O' and 'O') or 'bool'\n                if len(d) == 2:\n                    descr_mask.append((d[0], new_type))\n                elif len(d) == 3:\n                    descr_mask.append((d[0], new_type, d[2]))\n            mask = np.zeros((nrows,), dtype=descr_mask)\n\n        self.array = ma.array(array, mask=mask)"},{"col":4,"comment":"\n        Return a new (larger) size based on size, used for\n        reallocating an array when it fills up.  This is in its own\n        function so the resizing strategy can be easily replaced.\n        ","endLoc":2379,"header":"def _resize_strategy(self, size)","id":6656,"name":"_resize_strategy","nodeType":"Function","startLoc":2369,"text":"def _resize_strategy(self, size):\n        \"\"\"\n        Return a new (larger) size based on size, used for\n        reallocating an array when it fills up.  This is in its own\n        function so the resizing strategy can be easily replaced.\n        \"\"\"\n        # Once we go beyond 0, make a big step -- after that use a\n        # factor of 1.5 to help keep memory usage compact\n        if size == 0:\n            return 512\n        return int(np.ceil(size * RESIZE_AMOUNT))"},{"col":4,"comment":"null","endLoc":2384,"header":"def _add_field(self, iterator, tag, data, config, pos)","id":6657,"name":"_add_field","nodeType":"Function","startLoc":2381,"text":"def _add_field(self, iterator, tag, data, config, pos):\n        field = Field(self._votable, config=config, pos=pos, **data)\n        self.fields.append(field)\n        field.parse(iterator, config)"},{"col":4,"comment":"null","endLoc":2389,"header":"def _add_param(self, iterator, tag, data, config, pos)","id":6658,"name":"_add_param","nodeType":"Function","startLoc":2386,"text":"def _add_param(self, iterator, tag, data, config, pos):\n        param = Param(self._votable, config=config, pos=pos, **data)\n        self.params.append(param)\n        param.parse(iterator, config)"},{"col":4,"comment":"null","endLoc":2394,"header":"def _add_group(self, iterator, tag, data, config, pos)","id":6659,"name":"_add_group","nodeType":"Function","startLoc":2391,"text":"def _add_group(self, iterator, tag, data, config, pos):\n        group = Group(self, config=config, pos=pos, **data)\n        self.groups.append(group)\n        group.parse(iterator, config)"},{"col":0,"comment":"null","endLoc":173,"header":"@pytest.mark.xfail('legacy_float_repr')\ndef test_regression(tmpdir)","id":6660,"name":"test_regression","nodeType":"Function","startLoc":169,"text":"@pytest.mark.xfail('legacy_float_repr')\ndef test_regression(tmpdir):\n    # W39: Bit values can not be masked\n    with pytest.warns(W39):\n        _test_regression(tmpdir, False)"},{"col":0,"comment":"null","endLoc":180,"header":"@pytest.mark.xfail('legacy_float_repr')\ndef test_regression_python_based_parser(tmpdir)","id":6661,"name":"test_regression_python_based_parser","nodeType":"Function","startLoc":176,"text":"@pytest.mark.xfail('legacy_float_repr')\ndef test_regression_python_based_parser(tmpdir):\n    # W39: Bit values can not be masked\n    with pytest.warns(W39):\n        _test_regression(tmpdir, True)"},{"col":0,"comment":"null","endLoc":187,"header":"@pytest.mark.xfail('legacy_float_repr')\ndef test_regression_binary2(tmpdir)","id":6662,"name":"test_regression_binary2","nodeType":"Function","startLoc":183,"text":"@pytest.mark.xfail('legacy_float_repr')\ndef test_regression_binary2(tmpdir):\n    # W39: Bit values can not be masked\n    with pytest.warns(W39):\n        _test_regression(tmpdir, False, 2)"},{"col":4,"comment":"Actually parse the config file.","endLoc":1700,"header":"def _parse(self, infile)","id":6663,"name":"_parse","nodeType":"Function","startLoc":1536,"text":"def _parse(self, infile):\n        \"\"\"Actually parse the config file.\"\"\"\n        temp_list_values = self.list_values\n        if self.unrepr:\n            self.list_values = False\n\n        comment_list = []\n        done_start = False\n        this_section = self\n        maxline = len(infile) - 1\n        cur_index = -1\n        reset_comment = False\n\n        while cur_index < maxline:\n            if reset_comment:\n                comment_list = []\n            cur_index += 1\n            line = infile[cur_index]\n            sline = line.strip()\n            # do we have anything on the line ?\n            if not sline or sline.startswith('#'):\n                reset_comment = False\n                comment_list.append(line)\n                continue\n\n            if not done_start:\n                # preserve initial comment\n                self.initial_comment = comment_list\n                comment_list = []\n                done_start = True\n\n            reset_comment = True\n            # first we check if it's a section marker\n            mat = self._sectionmarker.match(line)\n            if mat is not None:\n                # is a section line\n                (indent, sect_open, sect_name, sect_close, comment) = mat.groups()\n                if indent and (self.indent_type is None):\n                    self.indent_type = indent\n                cur_depth = sect_open.count('[')\n                if cur_depth != sect_close.count(']'):\n                    self._handle_error(\"Cannot compute the section depth\",\n                                       NestingError, infile, cur_index)\n                    continue\n\n                if cur_depth < this_section.depth:\n                    # the new section is dropping back to a previous level\n                    try:\n                        parent = self._match_depth(this_section,\n                                                   cur_depth).parent\n                    except SyntaxError:\n                        self._handle_error(\"Cannot compute nesting level\",\n                                           NestingError, infile, cur_index)\n                        continue\n                elif cur_depth == this_section.depth:\n                    # the new section is a sibling of the current section\n                    parent = this_section.parent\n                elif cur_depth == this_section.depth + 1:\n                    # the new section is a child the current section\n                    parent = this_section\n                else:\n                    self._handle_error(\"Section too nested\",\n                                       NestingError, infile, cur_index)\n                    continue\n\n                sect_name = self._unquote(sect_name)\n                if sect_name in parent:\n                    self._handle_error('Duplicate section name',\n                                       DuplicateError, infile, cur_index)\n                    continue\n\n                # create the new section\n                this_section = Section(\n                    parent,\n                    cur_depth,\n                    self,\n                    name=sect_name)\n                parent[sect_name] = this_section\n                parent.inline_comments[sect_name] = comment\n                parent.comments[sect_name] = comment_list\n                continue\n            #\n            # it's not a section marker,\n            # so it should be a valid ``key = value`` line\n            mat = self._keyword.match(line)\n            if mat is None:\n                self._handle_error(\n                    'Invalid line ({0!r}) (matched as neither section nor keyword)'.format(line),\n                    ParseError, infile, cur_index)\n            else:\n                # is a keyword value\n                # value will include any inline comment\n                (indent, key, value) = mat.groups()\n                if indent and (self.indent_type is None):\n                    self.indent_type = indent\n                # check for a multiline value\n                if value[:3] in ['\"\"\"', \"'''\"]:\n                    try:\n                        value, comment, cur_index = self._multiline(\n                            value, infile, cur_index, maxline)\n                    except SyntaxError:\n                        self._handle_error(\n                            'Parse error in multiline value',\n                            ParseError, infile, cur_index)\n                        continue\n                    else:\n                        if self.unrepr:\n                            comment = ''\n                            try:\n                                value = unrepr(value)\n                            except Exception as e:\n                                if type(e) == UnknownType:\n                                    msg = 'Unknown name or type in value'\n                                else:\n                                    msg = 'Parse error from unrepr-ing multiline value'\n                                self._handle_error(msg, UnreprError, infile,\n                                    cur_index)\n                                continue\n                else:\n                    if self.unrepr:\n                        comment = ''\n                        try:\n                            value = unrepr(value)\n                        except Exception as e:\n                            if isinstance(e, UnknownType):\n                                msg = 'Unknown name or type in value'\n                            else:\n                                msg = 'Parse error from unrepr-ing value'\n                            self._handle_error(msg, UnreprError, infile,\n                                cur_index)\n                            continue\n                    else:\n                        # extract comment and lists\n                        try:\n                            (value, comment) = self._handle_value(value)\n                        except SyntaxError:\n                            self._handle_error(\n                                'Parse error in value',\n                                ParseError, infile, cur_index)\n                            continue\n                #\n                key = self._unquote(key)\n                if key in this_section:\n                    self._handle_error(\n                        'Duplicate keyword name',\n                        DuplicateError, infile, cur_index)\n                    continue\n                # add the key.\n                # we set unrepr because if we have got this far we will never\n                # be creating a new section\n                this_section.__setitem__(key, value, unrepr=True)\n                this_section.inline_comments[key] = comment\n                this_section.comments[key] = comment_list\n                continue\n        #\n        if self.indent_type is None:\n            # no indentation used, set the type accordingly\n            self.indent_type = ''\n\n        # preserve the final comment\n        if not self and not self.initial_comment:\n            self.initial_comment = comment_list\n        elif not reset_comment:\n            self.final_comment = comment_list\n        self.list_values = temp_list_values"},{"col":4,"comment":"null","endLoc":2399,"header":"def _add_link(self, iterator, tag, data, config, pos)","id":6664,"name":"_add_link","nodeType":"Function","startLoc":2396,"text":"def _add_link(self, iterator, tag, data, config, pos):\n        link = Link(config=config, pos=pos, **data)\n        self.links.append(link)\n        link.parse(iterator, config)"},{"col":0,"comment":"null","endLoc":251,"header":"def test_select_columns_by_index()","id":6665,"name":"test_select_columns_by_index","nodeType":"Function","startLoc":241,"text":"def test_select_columns_by_index():\n    columns = [0, 5, 13]\n    table = parse(\n        get_pkg_data_filename('data/regression.xml'), columns=columns).get_first_table()  # noqa\n    array = table.array\n    mask = table.array.mask\n    assert array['string_test'][0] == \"String & test\"\n    columns = ['string_test', 'unsignedByte', 'bitarray']\n    for c in columns:\n        assert not np.all(mask[c])\n    assert np.all(mask['unicode_test'])"},{"col":0,"comment":"null","endLoc":263,"header":"def test_select_columns_by_name()","id":6666,"name":"test_select_columns_by_name","nodeType":"Function","startLoc":254,"text":"def test_select_columns_by_name():\n    columns = ['string_test', 'unsignedByte', 'bitarray']\n    table = parse(\n        get_pkg_data_filename('data/regression.xml'), columns=columns).get_first_table()  # noqa\n    array = table.array\n    mask = table.array.mask\n    assert array['string_test'][0] == \"String & test\"\n    for c in columns:\n        assert not np.all(mask[c])\n    assert np.all(mask['unicode_test'])"},{"className":"ComplexVarArray","col":0,"comment":"\n    Handles a variable-length array of complex numbers.\n    ","endLoc":968,"id":6667,"nodeType":"Class","startLoc":948,"text":"class ComplexVarArray(VarArray):\n    \"\"\"\n    Handles a variable-length array of complex numbers.\n    \"\"\"\n\n    def parse(self, value, config=None, pos=None):\n        if value.strip() == '':\n            return ma.array([]), True\n\n        parts = self._splitter(value, config, pos)\n        parse_parts = self._base.parse_parts\n        result = []\n        result_mask = []\n        for i in range(0, len(parts), 2):\n            value = [float(x) for x in parts[i:i + 2]]\n            value, mask = parse_parts(value, config, pos)\n            result.append(value)\n            result_mask.append(mask)\n\n        return _make_masked_array(\n            np.array(result, dtype=self._base.format), result_mask), False"},{"col":4,"comment":"null","endLoc":968,"header":"def parse(self, value, config=None, pos=None)","id":6668,"name":"parse","nodeType":"Function","startLoc":953,"text":"def parse(self, value, config=None, pos=None):\n        if value.strip() == '':\n            return ma.array([]), True\n\n        parts = self._splitter(value, config, pos)\n        parse_parts = self._base.parse_parts\n        result = []\n        result_mask = []\n        for i in range(0, len(parts), 2):\n            value = [float(x) for x in parts[i:i + 2]]\n            value, mask = parse_parts(value, config, pos)\n            result.append(value)\n            result_mask.append(mask)\n\n        return _make_masked_array(\n            np.array(result, dtype=self._base.format), result_mask), False"},{"col":4,"comment":"null","endLoc":2406,"header":"def _add_info(self, iterator, tag, data, config, pos)","id":6669,"name":"_add_info","nodeType":"Function","startLoc":2401,"text":"def _add_info(self, iterator, tag, data, config, pos):\n        if not config.get('version_1_2_or_later'):\n            warn_or_raise(W26, W26, ('INFO', 'TABLE', '1.2'), config, pos)\n        info = Info(config=config, pos=pos, **data)\n        self.infos.append(info)\n        info.parse(iterator, config)"},{"col":4,"comment":"null","endLoc":2560,"header":"def parse(self, iterator, config)","id":6670,"name":"parse","nodeType":"Function","startLoc":2408,"text":"def parse(self, iterator, config):\n        columns = config.get('columns')\n\n        # If we've requested to read in only a specific table, skip\n        # all others\n        table_number = config.get('table_number')\n        current_table_number = config.get('_current_table_number')\n        skip_table = False\n        if current_table_number is not None:\n            config['_current_table_number'] += 1\n            if (table_number is not None and\n                table_number != current_table_number):\n                skip_table = True\n                self._empty = True\n\n        table_id = config.get('table_id')\n        if table_id is not None:\n            if table_id != self.ID:\n                skip_table = True\n                self._empty = True\n\n        if self.ref is not None:\n            # This table doesn't have its own datatype descriptors, it\n            # just references those from another table.\n\n            # This is to call the property setter to go and get the\n            # referenced information\n            self.ref = self.ref\n\n            for start, tag, data, pos in iterator:\n                if start:\n                    if tag == 'DATA':\n                        warn_unknown_attrs(\n                            'DATA', data.keys(), config, pos)\n                        break\n                else:\n                    if tag == 'TABLE':\n                        return self\n                    elif tag == 'DESCRIPTION':\n                        if self.description is not None:\n                            warn_or_raise(W17, W17, 'RESOURCE', config, pos)\n                        self.description = data or None\n        else:\n            tag_mapping = {\n                'FIELD': self._add_field,\n                'PARAM': self._add_param,\n                'GROUP': self._add_group,\n                'LINK': self._add_link,\n                'INFO': self._add_info,\n                'DESCRIPTION': self._ignore_add}\n\n            for start, tag, data, pos in iterator:\n                if start:\n                    if tag == 'DATA':\n                        if len(self.fields) == 0:\n                            warn_or_raise(E25, E25, None, config, pos)\n                        warn_unknown_attrs(\n                            'DATA', data.keys(), config, pos)\n                        break\n\n                    tag_mapping.get(tag, self._add_unknown_tag)(\n                        iterator, tag, data, config, pos)\n                else:\n                    if tag == 'DESCRIPTION':\n                        if self.description is not None:\n                            warn_or_raise(W17, W17, 'RESOURCE', config, pos)\n                        self.description = data or None\n                    elif tag == 'TABLE':\n                        # For error checking purposes\n                        Field.uniqify_names(self.fields)\n                        # We still need to create arrays, even if the file\n                        # contains no DATA section\n                        self.create_arrays(nrows=0, config=config)\n                        return self\n\n        self.create_arrays(nrows=self._nrows, config=config)\n        fields = self.fields\n        names = [x.ID for x in fields]\n        # Deal with a subset of the columns, if requested.\n        if not columns:\n            colnumbers = list(range(len(fields)))\n        else:\n            if isinstance(columns, str):\n                columns = [columns]\n            columns = np.asarray(columns)\n            if issubclass(columns.dtype.type, np.integer):\n                if np.any(columns < 0) or np.any(columns > len(fields)):\n                    raise ValueError(\n                        \"Some specified column numbers out of range\")\n                colnumbers = columns\n            elif issubclass(columns.dtype.type, np.character):\n                try:\n                    colnumbers = [names.index(x) for x in columns]\n                except ValueError:\n                    raise ValueError(\n                        f\"Columns '{columns}' not found in fields list\")\n            else:\n                raise TypeError(\"Invalid columns list\")\n\n        if (not skip_table) and (len(fields) > 0):\n            for start, tag, data, pos in iterator:\n                if start:\n                    if tag == 'TABLEDATA':\n                        warn_unknown_attrs(\n                            'TABLEDATA', data.keys(), config, pos)\n                        self.array = self._parse_tabledata(\n                            iterator, colnumbers, fields, config)\n                        break\n                    elif tag == 'BINARY':\n                        warn_unknown_attrs(\n                            'BINARY', data.keys(), config, pos)\n                        self.array = self._parse_binary(\n                            1, iterator, colnumbers, fields, config, pos)\n                        break\n                    elif tag == 'BINARY2':\n                        if not config['version_1_3_or_later']:\n                            warn_or_raise(\n                                W52, W52, config['version'], config, pos)\n                        self.array = self._parse_binary(\n                            2, iterator, colnumbers, fields, config, pos)\n                        break\n                    elif tag == 'FITS':\n                        warn_unknown_attrs(\n                            'FITS', data.keys(), config, pos, ['extnum'])\n                        try:\n                            extnum = int(data.get('extnum', 0))\n                            if extnum < 0:\n                                raise ValueError(\"'extnum' cannot be negative.\")\n                        except ValueError:\n                            vo_raise(E17, (), config, pos)\n                        self.array = self._parse_fits(\n                            iterator, extnum, config)\n                        break\n                    else:\n                        warn_or_raise(W37, W37, tag, config, pos)\n                        break\n\n        for start, tag, data, pos in iterator:\n            if not start and tag == 'DATA':\n                break\n\n        for start, tag, data, pos in iterator:\n            if start and tag == 'INFO':\n                if not config.get('version_1_2_or_later'):\n                    warn_or_raise(\n                        W26, W26, ('INFO', 'TABLE', '1.2'), config, pos)\n                info = Info(config=config, pos=pos, **data)\n                self.infos.append(info)\n                info.parse(iterator, config)\n            elif not start and tag == 'TABLE':\n                break\n\n        return self"},{"className":"ComplexArray","col":0,"comment":"\n    Handles a fixed-size array of complex numbers.\n    ","endLoc":1002,"id":6671,"nodeType":"Class","startLoc":971,"text":"class ComplexArray(NumericArray):\n    \"\"\"\n    Handles a fixed-size array of complex numbers.\n    \"\"\"\n    vararray_type = ComplexArrayVarArray\n\n    def __init__(self, field, base, arraysize, config=None, pos=None):\n        NumericArray.__init__(self, field, base, arraysize, config, pos)\n        self._items *= 2\n\n    def parse(self, value, config=None, pos=None):\n        parts = self._splitter(value, config, pos)\n        if parts == ['']:\n            parts = []\n        return self.parse_parts(parts, config, pos)\n\n    def parse_parts(self, parts, config=None, pos=None):\n        if len(parts) != self._items:\n            vo_raise(E02, (self._items, len(parts)), config, pos)\n        base_parse = self._base.parse_parts\n        result = []\n        result_mask = []\n        for i in range(0, self._items, 2):\n            value = [float(x) for x in parts[i:i + 2]]\n            value, mask = base_parse(value, config, pos)\n            result.append(value)\n            result_mask.append(mask)\n        result = np.array(\n            result, dtype=self._base.format).reshape(self._arraysize)\n        result_mask = np.array(\n            result_mask, dtype='bool').reshape(self._arraysize)\n        return result, result_mask"},{"col":4,"comment":"null","endLoc":979,"header":"def __init__(self, field, base, arraysize, config=None, pos=None)","id":6672,"name":"__init__","nodeType":"Function","startLoc":977,"text":"def __init__(self, field, base, arraysize, config=None, pos=None):\n        NumericArray.__init__(self, field, base, arraysize, config, pos)\n        self._items *= 2"},{"col":0,"comment":"null","endLoc":710,"header":"def table_from_scratch()","id":6673,"name":"table_from_scratch","nodeType":"Function","startLoc":680,"text":"def table_from_scratch():\n    from astropy.io.votable.tree import VOTableFile, Resource, Table, Field\n\n    # Create a new VOTable file...\n    votable = VOTableFile()\n\n    # ...with one resource...\n    resource = Resource()\n    votable.resources.append(resource)\n\n    # ... with one table\n    table = Table(votable)\n    resource.tables.append(table)\n\n    # Define some fields\n    table.fields.extend([\n            Field(votable, ID=\"filename\", datatype=\"char\"),\n            Field(votable, ID=\"matrix\", datatype=\"double\", arraysize=\"2x2\")])\n\n    # Now, use those field definitions to create the numpy record arrays, with\n    # the given number of rows\n    table.create_arrays(2)\n\n    # Now table.array can be filled with data\n    table.array[0] = ('test1.xml', [[1, 0], [0, 1]])\n    table.array[1] = ('test2.xml', [[0.5, 0.3], [0.2, 0.1]])\n\n    # Now write the whole thing to a file.\n    # Note, we have to use the top-level votable file object\n    out = io.StringIO()\n    votable.to_xml(out)"},{"col":4,"comment":"null","endLoc":985,"header":"def parse(self, value, config=None, pos=None)","id":6674,"name":"parse","nodeType":"Function","startLoc":981,"text":"def parse(self, value, config=None, pos=None):\n        parts = self._splitter(value, config, pos)\n        if parts == ['']:\n            parts = []\n        return self.parse_parts(parts, config, pos)"},{"col":4,"comment":"\n        Handle an error according to the error settings.\n\n        Either raise the error or store it.\n        The error will have occured at ``cur_index``\n        ","endLoc":1738,"header":"def _handle_error(self, text, ErrorClass, infile, cur_index)","id":6675,"name":"_handle_error","nodeType":"Function","startLoc":1722,"text":"def _handle_error(self, text, ErrorClass, infile, cur_index):\n        \"\"\"\n        Handle an error according to the error settings.\n\n        Either raise the error or store it.\n        The error will have occured at ``cur_index``\n        \"\"\"\n        line = infile[cur_index]\n        cur_index += 1\n        message = '{0} at line {1}.'.format(text, cur_index)\n        error = ErrorClass(message, cur_index, line)\n        if self.raise_errors:\n            # raise the error - parsing stops here\n            raise error\n        # store the error\n        # reraise when parsing has finished\n        self._errors.append(error)"},{"col":4,"comment":"\n        Given a section and a depth level, walk back through the sections\n        parents to see if the depth level matches a previous section.\n\n        Return a reference to the right section,\n        or raise a SyntaxError.\n        ","endLoc":1719,"header":"def _match_depth(self, sect, depth)","id":6676,"name":"_match_depth","nodeType":"Function","startLoc":1703,"text":"def _match_depth(self, sect, depth):\n        \"\"\"\n        Given a section and a depth level, walk back through the sections\n        parents to see if the depth level matches a previous section.\n\n        Return a reference to the right section,\n        or raise a SyntaxError.\n        \"\"\"\n        while depth < sect.depth:\n            if sect is sect.parent:\n                # we've reached the top level already\n                raise SyntaxError()\n            sect = sect.parent\n        if sect.depth == depth:\n            return sect\n        # shouldn't get here\n        raise SyntaxError()"},{"col":4,"comment":"Return an unquoted version of a value","endLoc":1748,"header":"def _unquote(self, value)","id":6677,"name":"_unquote","nodeType":"Function","startLoc":1741,"text":"def _unquote(self, value):\n        \"\"\"Return an unquoted version of a value\"\"\"\n        if not value:\n            # should only happen during parsing of lists\n            raise SyntaxError\n        if (value[0] == value[-1]) and (value[0] in ('\"', \"'\")):\n            value = value[1:-1]\n        return value"},{"col":0,"comment":"\n    see Pull Request 4782 or Issue 4781 for details\n    ","endLoc":358,"header":"def test_gemini_v1_2()","id":6678,"name":"test_gemini_v1_2","nodeType":"Function","startLoc":348,"text":"def test_gemini_v1_2():\n    '''\n    see Pull Request 4782 or Issue 4781 for details\n    '''\n    table = parse_single_table(get_pkg_data_filename('data/gemini.xml'))\n    assert table is not None\n\n    tt = table.to_table()\n    assert tt['access_url'][0] == (\n        'http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/data/pub/GEMINI/'\n        'S20120515S0064?runid=bx9b1o8cvk1qesrt')"},{"attributeType":"null","col":16,"comment":"null","endLoc":6,"id":6679,"name":"np","nodeType":"Attribute","startLoc":6,"text":"np"},{"col":4,"comment":"Extract the value, where we are in a multiline situation.","endLoc":1923,"header":"def _multiline(self, value, infile, cur_index, maxline)","id":6680,"name":"_multiline","nodeType":"Function","startLoc":1891,"text":"def _multiline(self, value, infile, cur_index, maxline):\n        \"\"\"Extract the value, where we are in a multiline situation.\"\"\"\n        quot = value[:3]\n        newvalue = value[3:]\n        single_line = self._triple_quote[quot][0]\n        multi_line = self._triple_quote[quot][1]\n        mat = single_line.match(value)\n        if mat is not None:\n            retval = list(mat.groups())\n            retval.append(cur_index)\n            return retval\n        elif newvalue.find(quot) != -1:\n            # somehow the triple quote is missing\n            raise SyntaxError()\n        #\n        while cur_index < maxline:\n            cur_index += 1\n            newvalue += '\\n'\n            line = infile[cur_index]\n            if line.find(quot) == -1:\n                newvalue += line\n            else:\n                # end of multiline, process it\n                break\n        else:\n            # we've got to the end of the config, oops...\n            raise SyntaxError()\n        mat = multi_line.match(line)\n        if mat is None:\n            # a badly formed line\n            raise SyntaxError()\n        (value, comment) = mat.groups()\n        return (newvalue + value, comment, cur_index)"},{"fileName":"tree_test.py","filePath":"astropy/io/votable/tests","id":6681,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport io\n\nimport pytest\n\nfrom astropy.io.votable.exceptions import W07, W08, W21, W41\nfrom astropy.io.votable import tree\nfrom astropy.io.votable.table import parse\nfrom astropy.io.votable.tree import VOTableFile, Resource\nfrom astropy.utils.data import get_pkg_data_filename\nfrom astropy.utils.exceptions import AstropyDeprecationWarning\n\n\ndef test_check_astroyear_fail():\n    config = {'verify': 'exception'}\n    field = tree.Field(None, name='astroyear', arraysize='1')\n    with pytest.raises(W07):\n        tree.check_astroyear('X2100', field, config)\n\n\ndef test_string_fail():\n    config = {'verify': 'exception'}\n    with pytest.raises(W08):\n        tree.check_string(42, 'foo', config)\n\n\ndef test_make_Fields():\n    votable = tree.VOTableFile()\n    # ...with one resource...\n    resource = tree.Resource()\n    votable.resources.append(resource)\n\n    # ... with one table\n    table = tree.Table(votable)\n    resource.tables.append(table)\n\n    table.fields.extend([tree.Field(\n        votable, name='Test', datatype=\"float\", unit=\"mag\")])\n\n\ndef test_unit_format():\n    data = parse(get_pkg_data_filename('data/irsa-nph-error.xml'))\n    assert data._config['version'] == '1.0'\n    assert tree._get_default_unit_format(data._config) == 'cds'\n    data = parse(get_pkg_data_filename('data/names.xml'))\n    assert data._config['version'] == '1.1'\n    assert tree._get_default_unit_format(data._config) == 'cds'\n    data = parse(get_pkg_data_filename('data/gemini.xml'))\n    assert data._config['version'] == '1.2'\n    assert tree._get_default_unit_format(data._config) == 'cds'\n    data = parse(get_pkg_data_filename('data/binary2_masked_strings.xml'))\n    assert data._config['version'] == '1.3'\n    assert tree._get_default_unit_format(data._config) == 'cds'\n    data = parse(get_pkg_data_filename('data/timesys.xml'))\n    assert data._config['version'] == '1.4'\n    assert tree._get_default_unit_format(data._config) == 'vounit'\n\n\ndef test_namespace_warning():\n    \"\"\"\n    A version 1.4 VOTable must use the same namespace as 1.3.\n    (see https://www.ivoa.net/documents/VOTable/20191021/REC-VOTable-1.4-20191021.html#ToC16)\n    \"\"\"\n    bad_namespace = b'''<?xml version=\"1.0\" encoding=\"utf-8\"?>\n        <VOTABLE version=\"1.4\" xmlns=\"http://www.ivoa.net/xml/VOTable/v1.4\"\n                               xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n          <RESOURCE/>\n        </VOTABLE>\n    '''\n    with pytest.warns(W41):\n        parse(io.BytesIO(bad_namespace), verify='exception')\n\n    good_namespace_14 = b'''<?xml version=\"1.0\" encoding=\"utf-8\"?>\n        <VOTABLE version=\"1.4\" xmlns=\"http://www.ivoa.net/xml/VOTable/v1.3\"\n                               xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n          <RESOURCE/>\n        </VOTABLE>\n    '''\n    parse(io.BytesIO(good_namespace_14), verify='exception')\n\n    good_namespace_13 = b'''<?xml version=\"1.0\" encoding=\"utf-8\"?>\n        <VOTABLE version=\"1.3\" xmlns=\"http://www.ivoa.net/xml/VOTable/v1.3\"\n                               xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n          <RESOURCE/>\n        </VOTABLE>\n    '''\n    parse(io.BytesIO(good_namespace_13), verify='exception')\n\n\ndef test_version():\n    \"\"\"\n    VOTableFile.__init__ allows versions of '1.0', '1.1', '1.2', '1.3' and '1.4'.\n    The '1.0' is curious since other checks in parse() and the version setter do not allow '1.0'.\n    This test confirms that behavior for now.  A future change may remove the '1.0'.\n    \"\"\"\n\n    # Exercise the checks in __init__\n    with pytest.warns(AstropyDeprecationWarning):\n        VOTableFile(version='1.0')\n    for version in ('1.1', '1.2', '1.3', '1.4'):\n        VOTableFile(version=version)\n    for version in ('0.9', '2.0'):\n        with pytest.raises(ValueError, match=r\"should be in \\('1.0', '1.1', '1.2', '1.3', '1.4'\\).\"):\n            VOTableFile(version=version)\n\n    # Exercise the checks in the setter\n    vot = VOTableFile()\n    for version in ('1.1', '1.2', '1.3', '1.4'):\n        vot.version = version\n    for version in ('1.0', '2.0'):\n        with pytest.raises(ValueError, match=r\"supports VOTable versions '1.1', '1.2', '1.3', '1.4'$\"):\n            vot.version = version\n\n    # Exercise the checks in the parser.\n    begin = b'<?xml version=\"1.0\" encoding=\"utf-8\"?><VOTABLE version=\"'\n    middle = b'\" xmlns=\"http://www.ivoa.net/xml/VOTable/v'\n    end = b'\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><RESOURCE/></VOTABLE>'\n\n    # Valid versions\n    for bversion in (b'1.1', b'1.2', b'1.3'):\n        parse(io.BytesIO(begin + bversion + middle + bversion + end), verify='exception')\n    parse(io.BytesIO(begin + b'1.4' + middle + b'1.3' + end), verify='exception')\n\n    # Invalid versions\n    for bversion in (b'1.0', b'2.0'):\n        with pytest.warns(W21):\n            parse(io.BytesIO(begin + bversion + middle + bversion + end), verify='exception')\n\n\ndef votable_xml_string(version):\n    votable_file = VOTableFile(version=version)\n    votable_file.resources.append(Resource())\n\n    xml_bytes = io.BytesIO()\n    votable_file.to_xml(xml_bytes)\n    xml_bytes.seek(0)\n    bstring = xml_bytes.read()\n    s = bstring.decode(\"utf-8\")\n    return s\n\n\ndef test_votable_tag():\n    xml = votable_xml_string('1.1')\n    assert 'xmlns=\"http://www.ivoa.net/xml/VOTable/v1.1\"' in xml\n    assert 'xsi:noNamespaceSchemaLocation=\"http://www.ivoa.net/xml/VOTable/v1.1\"' in xml\n\n    xml = votable_xml_string('1.2')\n    assert 'xmlns=\"http://www.ivoa.net/xml/VOTable/v1.2\"' in xml\n    assert 'xsi:noNamespaceSchemaLocation=\"http://www.ivoa.net/xml/VOTable/v1.2\"' in xml\n\n    xml = votable_xml_string('1.3')\n    assert 'xmlns=\"http://www.ivoa.net/xml/VOTable/v1.3\"' in xml\n    assert 'xsi:schemaLocation=\"http://www.ivoa.net/xml/VOTable/v1.3 '\n    assert 'http://www.ivoa.net/xml/VOTable/VOTable-1.3.xsd\"' in xml\n\n    xml = votable_xml_string('1.4')\n    assert 'xmlns=\"http://www.ivoa.net/xml/VOTable/v1.3\"' in xml\n    assert 'xsi:schemaLocation=\"http://www.ivoa.net/xml/VOTable/v1.3 '\n    assert 'http://www.ivoa.net/xml/VOTable/VOTable-1.4.xsd\"' in xml\n"},{"className":"Resource","col":0,"comment":"\n    RESOURCE_ element: Groups TABLE_ and RESOURCE_ elements.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    ","endLoc":3376,"id":6682,"nodeType":"Class","startLoc":3099,"text":"class Resource(Element, _IDProperty, _NameProperty, _UtypeProperty,\n               _DescriptionProperty):\n    \"\"\"\n    RESOURCE_ element: Groups TABLE_ and RESOURCE_ elements.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    \"\"\"\n\n    def __init__(self, name=None, ID=None, utype=None, type='results',\n                 id=None, config=None, pos=None, **kwargs):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        Element.__init__(self)\n        self.name = name\n        self.ID = resolve_id(ID, id, config, pos)\n        self.utype = utype\n        self.type = type\n        self._extra_attributes = kwargs\n        self.description = None\n\n        self._coordinate_systems = HomogeneousList(CooSys)\n        self._time_systems = HomogeneousList(TimeSys)\n        self._groups = HomogeneousList(Group)\n        self._params = HomogeneousList(Param)\n        self._infos = HomogeneousList(Info)\n        self._links = HomogeneousList(Link)\n        self._tables = HomogeneousList(Table)\n        self._resources = HomogeneousList(Resource)\n\n        warn_unknown_attrs('RESOURCE', kwargs.keys(), config, pos)\n\n    def __repr__(self):\n        buff = io.StringIO()\n        w = XMLWriter(buff)\n        w.element(\n            self._element_name,\n            attrib=w.object_attrs(self, self._attr_list))\n        return buff.getvalue().strip()\n\n    @property\n    def type(self):\n        \"\"\"\n        [*required*] The type of the resource.  Must be either:\n\n          - 'results': This resource contains actual result values\n            (default)\n\n          - 'meta': This resource contains only datatype descriptions\n            (FIELD_ elements), but no actual data.\n        \"\"\"\n        return self._type\n\n    @type.setter\n    def type(self, type):\n        if type not in ('results', 'meta'):\n            vo_raise(E18, type, self._config, self._pos)\n        self._type = type\n\n    @property\n    def extra_attributes(self):\n        \"\"\"\n        A dictionary of string keys to string values containing any\n        extra attributes of the RESOURCE_ element that are not defined\n        in the specification.  (The specification explicitly allows\n        for extra attributes here, but nowhere else.)\n        \"\"\"\n        return self._extra_attributes\n\n    @property\n    def coordinate_systems(self):\n        \"\"\"\n        A list of coordinate system definitions (COOSYS_ elements) for\n        the RESOURCE_.  Must contain only `CooSys` objects.\n        \"\"\"\n        return self._coordinate_systems\n\n    @property\n    def time_systems(self):\n        \"\"\"\n        A list of time system definitions (TIMESYS_ elements) for\n        the RESOURCE_.  Must contain only `TimeSys` objects.\n        \"\"\"\n        return self._time_systems\n\n    @property\n    def infos(self):\n        \"\"\"\n        A list of informational parameters (key-value pairs) for the\n        resource.  Must only contain `Info` objects.\n        \"\"\"\n        return self._infos\n\n    @property\n    def groups(self):\n        \"\"\"\n        A list of groups\n        \"\"\"\n        return self._groups\n\n    @property\n    def params(self):\n        \"\"\"\n        A list of parameters (constant-valued columns) for the\n        resource.  Must contain only `Param` objects.\n        \"\"\"\n        return self._params\n\n    @property\n    def links(self):\n        \"\"\"\n        A list of links (pointers to other documents or servers\n        through a URI) for the resource.  Must contain only `Link`\n        objects.\n        \"\"\"\n        return self._links\n\n    @property\n    def tables(self):\n        \"\"\"\n        A list of tables in the resource.  Must contain only\n        `Table` objects.\n        \"\"\"\n        return self._tables\n\n    @property\n    def resources(self):\n        \"\"\"\n        A list of nested resources inside this resource.  Must contain\n        only `Resource` objects.\n        \"\"\"\n        return self._resources\n\n    def _add_table(self, iterator, tag, data, config, pos):\n        table = Table(self._votable, config=config, pos=pos, **data)\n        self.tables.append(table)\n        table.parse(iterator, config)\n\n    def _add_info(self, iterator, tag, data, config, pos):\n        info = Info(config=config, pos=pos, **data)\n        self.infos.append(info)\n        info.parse(iterator, config)\n\n    def _add_group(self, iterator, tag, data, config, pos):\n        group = Group(self, config=config, pos=pos, **data)\n        self.groups.append(group)\n        group.parse(iterator, config)\n\n    def _add_param(self, iterator, tag, data, config, pos):\n        param = Param(self._votable, config=config, pos=pos, **data)\n        self.params.append(param)\n        param.parse(iterator, config)\n\n    def _add_coosys(self, iterator, tag, data, config, pos):\n        coosys = CooSys(config=config, pos=pos, **data)\n        self.coordinate_systems.append(coosys)\n        coosys.parse(iterator, config)\n\n    def _add_timesys(self, iterator, tag, data, config, pos):\n        timesys = TimeSys(config=config, pos=pos, **data)\n        self.time_systems.append(timesys)\n        timesys.parse(iterator, config)\n\n    def _add_resource(self, iterator, tag, data, config, pos):\n        resource = Resource(config=config, pos=pos, **data)\n        self.resources.append(resource)\n        resource.parse(self._votable, iterator, config)\n\n    def _add_link(self, iterator, tag, data, config, pos):\n        link = Link(config=config, pos=pos, **data)\n        self.links.append(link)\n        link.parse(iterator, config)\n\n    def parse(self, votable, iterator, config):\n        self._votable = votable\n\n        tag_mapping = {\n            'TABLE': self._add_table,\n            'INFO': self._add_info,\n            'PARAM': self._add_param,\n            'GROUP': self._add_group,\n            'COOSYS': self._add_coosys,\n            'TIMESYS': self._add_timesys,\n            'RESOURCE': self._add_resource,\n            'LINK': self._add_link,\n            'DESCRIPTION': self._ignore_add\n            }\n\n        for start, tag, data, pos in iterator:\n            if start:\n                tag_mapping.get(tag, self._add_unknown_tag)(\n                    iterator, tag, data, config, pos)\n            elif tag == 'DESCRIPTION':\n                if self.description is not None:\n                    warn_or_raise(W17, W17, 'RESOURCE', config, pos)\n                self.description = data or None\n            elif tag == 'RESOURCE':\n                break\n\n        del self._votable\n\n        return self\n\n    def to_xml(self, w, **kwargs):\n        attrs = w.object_attrs(self, ('ID', 'type', 'utype'))\n        attrs.update(self.extra_attributes)\n        with w.tag('RESOURCE', attrib=attrs):\n            if self.description is not None:\n                w.element(\"DESCRIPTION\", self.description, wrap=True)\n            for element_set in (self.coordinate_systems, self.time_systems,\n                                self.params, self.infos, self.links,\n                                self.tables, self.resources):\n                for element in element_set:\n                    element.to_xml(w, **kwargs)\n\n    def iter_tables(self):\n        \"\"\"\n        Recursively iterates over all tables in the resource and\n        nested resources.\n        \"\"\"\n        for table in self.tables:\n            yield table\n        for resource in self.resources:\n            for table in resource.iter_tables():\n                yield table\n\n    def iter_fields_and_params(self):\n        \"\"\"\n        Recursively iterates over all FIELD_ and PARAM_ elements in\n        the resource, its tables and nested resources.\n        \"\"\"\n        for param in self.params:\n            yield param\n        for table in self.tables:\n            for param in table.iter_fields_and_params():\n                yield param\n        for resource in self.resources:\n            for param in resource.iter_fields_and_params():\n                yield param\n\n    def iter_coosys(self):\n        \"\"\"\n        Recursively iterates over all the COOSYS_ elements in the\n        resource and nested resources.\n        \"\"\"\n        for coosys in self.coordinate_systems:\n            yield coosys\n        for resource in self.resources:\n            for coosys in resource.iter_coosys():\n                yield coosys\n\n    def iter_timesys(self):\n        \"\"\"\n        Recursively iterates over all the TIMESYS_ elements in the\n        resource and nested resources.\n        \"\"\"\n        for timesys in self.time_systems:\n            yield timesys\n        for resource in self.resources:\n            for timesys in resource.iter_timesys():\n                yield timesys\n\n    def iter_info(self):\n        \"\"\"\n        Recursively iterates over all the INFO_ elements in the\n        resource and nested resources.\n        \"\"\"\n        for info in self.infos:\n            yield info\n        for table in self.tables:\n            for info in table.iter_info():\n                yield info\n        for resource in self.resources:\n            for info in resource.iter_info():\n                yield info"},{"col":4,"comment":"null","endLoc":3140,"header":"def __repr__(self)","id":6683,"name":"__repr__","nodeType":"Function","startLoc":3134,"text":"def __repr__(self):\n        buff = io.StringIO()\n        w = XMLWriter(buff)\n        w.element(\n            self._element_name,\n            attrib=w.object_attrs(self, self._attr_list))\n        return buff.getvalue().strip()"},{"col":0,"comment":"null","endLoc":203,"header":"def unrepr(s)","id":6684,"name":"unrepr","nodeType":"Function","startLoc":197,"text":"def unrepr(s):\n    if not s:\n        return s\n\n    # this is supposed to be safe\n    import ast\n    return ast.literal_eval(s)"},{"col":4,"comment":"\n        [*required*] The type of the resource.  Must be either:\n\n          - 'results': This resource contains actual result values\n            (default)\n\n          - 'meta': This resource contains only datatype descriptions\n            (FIELD_ elements), but no actual data.\n        ","endLoc":3153,"header":"@property\n    def type(self)","id":6685,"name":"type","nodeType":"Function","startLoc":3142,"text":"@property\n    def type(self):\n        \"\"\"\n        [*required*] The type of the resource.  Must be either:\n\n          - 'results': This resource contains actual result values\n            (default)\n\n          - 'meta': This resource contains only datatype descriptions\n            (FIELD_ elements), but no actual data.\n        \"\"\"\n        return self._type"},{"col":4,"comment":"null","endLoc":3159,"header":"@type.setter\n    def type(self, type)","id":6686,"name":"type","nodeType":"Function","startLoc":3155,"text":"@type.setter\n    def type(self, type):\n        if type not in ('results', 'meta'):\n            vo_raise(E18, type, self._config, self._pos)\n        self._type = type"},{"col":4,"comment":"\n        Given a value string, unquote, remove comment,\n        handle lists. (including empty and single member lists)\n        ","endLoc":1888,"header":"def _handle_value(self, value)","id":6687,"name":"_handle_value","nodeType":"Function","startLoc":1842,"text":"def _handle_value(self, value):\n        \"\"\"\n        Given a value string, unquote, remove comment,\n        handle lists. (including empty and single member lists)\n        \"\"\"\n        if self._inspec:\n            # Parsing a configspec so don't handle comments\n            return (value, '')\n        # do we look for lists in values ?\n        if not self.list_values:\n            mat = self._nolistvalue.match(value)\n            if mat is None:\n                raise SyntaxError()\n            # NOTE: we don't unquote here\n            return mat.groups()\n        #\n        mat = self._valueexp.match(value)\n        if mat is None:\n            # the value is badly constructed, probably badly quoted,\n            # or an invalid list\n            raise SyntaxError()\n        (list_values, single, empty_list, comment) = mat.groups()\n        if (list_values == '') and (single is None):\n            # change this if you want to accept empty values\n            raise SyntaxError()\n        # NOTE: note there is no error handling from here if the regex\n        # is wrong: then incorrect values will slip through\n        if empty_list is not None:\n            # the single comma - meaning an empty list\n            return ([], comment)\n        if single is not None:\n            # handle empty values\n            if list_values and not single:\n                # FIXME: the '' is a workaround because our regex now matches\n                #   '' at the end of a list if it has a trailing comma\n                single = None\n            else:\n                single = single or '\"\"'\n                single = self._unquote(single)\n        if list_values == '':\n            # not a list value\n            return (single, comment)\n        the_list = self._listvalueexp.findall(list_values)\n        the_list = [self._unquote(val) for val in the_list]\n        if single is not None:\n            the_list += [single]\n        return (the_list, comment)"},{"col":4,"comment":"\n        A dictionary of string keys to string values containing any\n        extra attributes of the RESOURCE_ element that are not defined\n        in the specification.  (The specification explicitly allows\n        for extra attributes here, but nowhere else.)\n        ","endLoc":3169,"header":"@property\n    def extra_attributes(self)","id":6688,"name":"extra_attributes","nodeType":"Function","startLoc":3161,"text":"@property\n    def extra_attributes(self):\n        \"\"\"\n        A dictionary of string keys to string values containing any\n        extra attributes of the RESOURCE_ element that are not defined\n        in the specification.  (The specification explicitly allows\n        for extra attributes here, but nowhere else.)\n        \"\"\"\n        return self._extra_attributes"},{"col":4,"comment":"\n        A list of coordinate system definitions (COOSYS_ elements) for\n        the RESOURCE_.  Must contain only `CooSys` objects.\n        ","endLoc":3177,"header":"@property\n    def coordinate_systems(self)","id":6689,"name":"coordinate_systems","nodeType":"Function","startLoc":3171,"text":"@property\n    def coordinate_systems(self):\n        \"\"\"\n        A list of coordinate system definitions (COOSYS_ elements) for\n        the RESOURCE_.  Must contain only `CooSys` objects.\n        \"\"\"\n        return self._coordinate_systems"},{"col":4,"comment":"\n        A list of time system definitions (TIMESYS_ elements) for\n        the RESOURCE_.  Must contain only `TimeSys` objects.\n        ","endLoc":3185,"header":"@property\n    def time_systems(self)","id":6690,"name":"time_systems","nodeType":"Function","startLoc":3179,"text":"@property\n    def time_systems(self):\n        \"\"\"\n        A list of time system definitions (TIMESYS_ elements) for\n        the RESOURCE_.  Must contain only `TimeSys` objects.\n        \"\"\"\n        return self._time_systems"},{"col":4,"comment":"\n        A list of informational parameters (key-value pairs) for the\n        resource.  Must only contain `Info` objects.\n        ","endLoc":3193,"header":"@property\n    def infos(self)","id":6691,"name":"infos","nodeType":"Function","startLoc":3187,"text":"@property\n    def infos(self):\n        \"\"\"\n        A list of informational parameters (key-value pairs) for the\n        resource.  Must only contain `Info` objects.\n        \"\"\"\n        return self._infos"},{"col":4,"comment":"\n        A list of groups\n        ","endLoc":3200,"header":"@property\n    def groups(self)","id":6692,"name":"groups","nodeType":"Function","startLoc":3195,"text":"@property\n    def groups(self):\n        \"\"\"\n        A list of groups\n        \"\"\"\n        return self._groups"},{"col":4,"comment":"\n        A list of parameters (constant-valued columns) for the\n        resource.  Must contain only `Param` objects.\n        ","endLoc":3208,"header":"@property\n    def params(self)","id":6693,"name":"params","nodeType":"Function","startLoc":3202,"text":"@property\n    def params(self):\n        \"\"\"\n        A list of parameters (constant-valued columns) for the\n        resource.  Must contain only `Param` objects.\n        \"\"\"\n        return self._params"},{"col":4,"comment":"\n        A list of links (pointers to other documents or servers\n        through a URI) for the resource.  Must contain only `Link`\n        objects.\n        ","endLoc":3217,"header":"@property\n    def links(self)","id":6694,"name":"links","nodeType":"Function","startLoc":3210,"text":"@property\n    def links(self):\n        \"\"\"\n        A list of links (pointers to other documents or servers\n        through a URI) for the resource.  Must contain only `Link`\n        objects.\n        \"\"\"\n        return self._links"},{"col":4,"comment":"\n        A list of tables in the resource.  Must contain only\n        `Table` objects.\n        ","endLoc":3225,"header":"@property\n    def tables(self)","id":6695,"name":"tables","nodeType":"Function","startLoc":3219,"text":"@property\n    def tables(self):\n        \"\"\"\n        A list of tables in the resource.  Must contain only\n        `Table` objects.\n        \"\"\"\n        return self._tables"},{"col":4,"comment":"\n        A list of nested resources inside this resource.  Must contain\n        only `Resource` objects.\n        ","endLoc":3233,"header":"@property\n    def resources(self)","id":6696,"name":"resources","nodeType":"Function","startLoc":3227,"text":"@property\n    def resources(self):\n        \"\"\"\n        A list of nested resources inside this resource.  Must contain\n        only `Resource` objects.\n        \"\"\"\n        return self._resources"},{"col":4,"comment":"null","endLoc":3238,"header":"def _add_table(self, iterator, tag, data, config, pos)","id":6697,"name":"_add_table","nodeType":"Function","startLoc":3235,"text":"def _add_table(self, iterator, tag, data, config, pos):\n        table = Table(self._votable, config=config, pos=pos, **data)\n        self.tables.append(table)\n        table.parse(iterator, config)"},{"col":4,"comment":"null","endLoc":1002,"header":"def parse_parts(self, parts, config=None, pos=None)","id":6698,"name":"parse_parts","nodeType":"Function","startLoc":987,"text":"def parse_parts(self, parts, config=None, pos=None):\n        if len(parts) != self._items:\n            vo_raise(E02, (self._items, len(parts)), config, pos)\n        base_parse = self._base.parse_parts\n        result = []\n        result_mask = []\n        for i in range(0, self._items, 2):\n            value = [float(x) for x in parts[i:i + 2]]\n            value, mask = base_parse(value, config, pos)\n            result.append(value)\n            result_mask.append(mask)\n        result = np.array(\n            result, dtype=self._base.format).reshape(self._arraysize)\n        result_mask = np.array(\n            result_mask, dtype='bool').reshape(self._arraysize)\n        return result, result_mask"},{"attributeType":"ComplexArrayVarArray","col":4,"comment":"null","endLoc":975,"id":6699,"name":"vararray_type","nodeType":"Attribute","startLoc":975,"text":"vararray_type"},{"className":"Complex","col":0,"comment":"\n    The base class for complex numbers.\n    ","endLoc":1046,"id":6700,"nodeType":"Class","startLoc":1005,"text":"class Complex(FloatingPoint, Array):\n    \"\"\"\n    The base class for complex numbers.\n    \"\"\"\n    array_type = ComplexArray\n    vararray_type = ComplexVarArray\n    default = np.nan\n\n    def __init__(self, field, config=None, pos=None):\n        FloatingPoint.__init__(self, field, config, pos)\n        Array.__init__(self, field, config, pos)\n\n    def parse(self, value, config=None, pos=None):\n        stripped = value.strip()\n        if stripped == '' or stripped.lower() == 'nan':\n            return np.nan, True\n        splitter = self._splitter\n        parts = [float(x) for x in splitter(value, config, pos)]\n        if len(parts) != 2:\n            vo_raise(E03, (value,), config, pos)\n        return self.parse_parts(parts, config, pos)\n    _parse_permissive = parse\n    _parse_pedantic = parse\n\n    def parse_parts(self, parts, config=None, pos=None):\n        value = complex(*parts)\n        return value, self.is_null(value)\n\n    def output(self, value, mask):\n        if mask:\n            if self.null is None:\n                return 'NaN'\n            else:\n                value = self.null\n        real = self._output_format.format(float(value.real))\n        imag = self._output_format.format(float(value.imag))\n        if self._output_format[2] == 'r':\n            if real.endswith('.0'):\n                real = real[:-2]\n            if imag.endswith('.0'):\n                imag = imag[:-2]\n        return real + ' ' + imag"},{"col":4,"comment":"null","endLoc":1015,"header":"def __init__(self, field, config=None, pos=None)","id":6701,"name":"__init__","nodeType":"Function","startLoc":1013,"text":"def __init__(self, field, config=None, pos=None):\n        FloatingPoint.__init__(self, field, config, pos)\n        Array.__init__(self, field, config, pos)"},{"col":4,"comment":"\n        Along with :attr:`width`, defines the `numerical accuracy`_\n        associated with the data.  These values are used to limit the\n        precision when writing floating point values back to the XML\n        file.  Otherwise, it is purely informational -- the Numpy\n        recarray containing the data itself does not use this\n        information.\n        ","endLoc":1321,"header":"@property\n    def precision(self)","id":6702,"name":"precision","nodeType":"Function","startLoc":1311,"text":"@property\n    def precision(self):\n        \"\"\"\n        Along with :attr:`width`, defines the `numerical accuracy`_\n        associated with the data.  These values are used to limit the\n        precision when writing floating point values back to the XML\n        file.  Otherwise, it is purely informational -- the Numpy\n        recarray containing the data itself does not use this\n        information.\n        \"\"\"\n        return self._precision"},{"col":4,"comment":"null","endLoc":1327,"header":"@precision.setter\n    def precision(self, precision)","id":6703,"name":"precision","nodeType":"Function","startLoc":1323,"text":"@precision.setter\n    def precision(self, precision):\n        if precision is not None and not re.match(r\"^[FE]?[0-9]+$\", precision):\n            vo_raise(E11, precision, self._config, self._pos)\n        self._precision = precision"},{"col":4,"comment":"null","endLoc":1331,"header":"@precision.deleter\n    def precision(self)","id":6704,"name":"precision","nodeType":"Function","startLoc":1329,"text":"@precision.deleter\n    def precision(self):\n        self._precision = None"},{"col":4,"comment":"\n        Along with :attr:`precision`, defines the `numerical\n        accuracy`_ associated with the data.  These values are used to\n        limit the precision when writing floating point values back to\n        the XML file.  Otherwise, it is purely informational -- the\n        Numpy recarray containing the data itself does not use this\n        information.\n        ","endLoc":1343,"header":"@property\n    def width(self)","id":6705,"name":"width","nodeType":"Function","startLoc":1333,"text":"@property\n    def width(self):\n        \"\"\"\n        Along with :attr:`precision`, defines the `numerical\n        accuracy`_ associated with the data.  These values are used to\n        limit the precision when writing floating point values back to\n        the XML file.  Otherwise, it is purely informational -- the\n        Numpy recarray containing the data itself does not use this\n        information.\n        \"\"\"\n        return self._width"},{"col":4,"comment":"null","endLoc":1351,"header":"@width.setter\n    def width(self, width)","id":6706,"name":"width","nodeType":"Function","startLoc":1345,"text":"@width.setter\n    def width(self, width):\n        if width is not None:\n            width = int(width)\n            if width <= 0:\n                vo_raise(E12, width, self._config, self._pos)\n        self._width = width"},{"col":4,"comment":"null","endLoc":1355,"header":"@width.deleter\n    def width(self)","id":6707,"name":"width","nodeType":"Function","startLoc":1353,"text":"@width.deleter\n    def width(self):\n        self._width = None"},{"col":4,"comment":"\n        On FIELD_ elements, ref is used only for informational\n        purposes, for example to refer to a COOSYS_ or TIMESYS_ element.\n        ","endLoc":1366,"header":"@property\n    def ref(self)","id":6708,"name":"ref","nodeType":"Function","startLoc":1360,"text":"@property\n    def ref(self):\n        \"\"\"\n        On FIELD_ elements, ref is used only for informational\n        purposes, for example to refer to a COOSYS_ or TIMESYS_ element.\n        \"\"\"\n        return self._ref"},{"col":4,"comment":"null","endLoc":1371,"header":"@ref.setter\n    def ref(self, ref)","id":6709,"name":"ref","nodeType":"Function","startLoc":1368,"text":"@ref.setter\n    def ref(self, ref):\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        self._ref = ref"},{"col":4,"comment":"null","endLoc":1025,"header":"def parse(self, value, config=None, pos=None)","id":6710,"name":"parse","nodeType":"Function","startLoc":1017,"text":"def parse(self, value, config=None, pos=None):\n        stripped = value.strip()\n        if stripped == '' or stripped.lower() == 'nan':\n            return np.nan, True\n        splitter = self._splitter\n        parts = [float(x) for x in splitter(value, config, pos)]\n        if len(parts) != 2:\n            vo_raise(E03, (value,), config, pos)\n        return self.parse_parts(parts, config, pos)"},{"col":4,"comment":"null","endLoc":2676,"header":"def _parse_tabledata(self, iterator, colnumbers, fields, config)","id":6711,"name":"_parse_tabledata","nodeType":"Function","startLoc":2562,"text":"def _parse_tabledata(self, iterator, colnumbers, fields, config):\n        # Since we don't know the number of rows up front, we'll\n        # reallocate the record array to make room as we go.  This\n        # prevents the need to scan through the XML twice.  The\n        # allocation is by factors of 1.5.\n        invalid = config.get('invalid', 'exception')\n\n        # Need to have only one reference so that we can resize the\n        # array\n        array = self.array\n        del self.array\n\n        parsers = [field.converter.parse for field in fields]\n        binparsers = [field.converter.binparse for field in fields]\n\n        numrows = 0\n        alloc_rows = len(array)\n        colnumbers_bits = [i in colnumbers for i in range(len(fields))]\n        row_default = [x.converter.default for x in fields]\n        mask_default = [True] * len(fields)\n        array_chunk = []\n        mask_chunk = []\n        chunk_size = config.get('chunk_size', DEFAULT_CHUNK_SIZE)\n        for start, tag, data, pos in iterator:\n            if tag == 'TR':\n                # Now parse one row\n                row = row_default[:]\n                row_mask = mask_default[:]\n                i = 0\n                for start, tag, data, pos in iterator:\n                    if start:\n                        binary = (data.get('encoding', None) == 'base64')\n                        warn_unknown_attrs(\n                            tag, data.keys(), config, pos, ['encoding'])\n                    else:\n                        if tag == 'TD':\n                            if i >= len(fields):\n                                vo_raise(E20, len(fields), config, pos)\n\n                            if colnumbers_bits[i]:\n                                try:\n                                    if binary:\n                                        rawdata = base64.b64decode(\n                                            data.encode('ascii'))\n                                        buf = io.BytesIO(rawdata)\n                                        buf.seek(0)\n                                        try:\n                                            value, mask_value = binparsers[i](\n                                                buf.read)\n                                        except Exception as e:\n                                            vo_reraise(\n                                                e, config, pos,\n                                                \"(in row {:d}, col '{}')\".format(\n                                                    len(array_chunk),\n                                                    fields[i].ID))\n                                    else:\n                                        try:\n                                            value, mask_value = parsers[i](\n                                                data, config, pos)\n                                        except Exception as e:\n                                            vo_reraise(\n                                                e, config, pos,\n                                                \"(in row {:d}, col '{}')\".format(\n                                                    len(array_chunk),\n                                                    fields[i].ID))\n                                except Exception as e:\n                                    if invalid == 'exception':\n                                        vo_reraise(e, config, pos)\n                                else:\n                                    row[i] = value\n                                    row_mask[i] = mask_value\n                        elif tag == 'TR':\n                            break\n                        else:\n                            self._add_unknown_tag(\n                                iterator, tag, data, config, pos)\n                        i += 1\n\n                if i < len(fields):\n                    vo_raise(E21, (i, len(fields)), config, pos)\n\n                array_chunk.append(tuple(row))\n                mask_chunk.append(tuple(row_mask))\n\n                if len(array_chunk) == chunk_size:\n                    while numrows + chunk_size > alloc_rows:\n                        alloc_rows = self._resize_strategy(alloc_rows)\n                    if alloc_rows != len(array):\n                        array = _resize(array, alloc_rows)\n                    array[numrows:numrows + chunk_size] = array_chunk\n                    array.mask[numrows:numrows + chunk_size] = mask_chunk\n                    numrows += chunk_size\n                    array_chunk = []\n                    mask_chunk = []\n\n            elif not start and tag == 'TABLEDATA':\n                break\n\n        # Now, resize the array to the exact number of rows we need and\n        # put the last chunk values in there.\n        alloc_rows = numrows + len(array_chunk)\n\n        array = _resize(array, alloc_rows)\n        array[numrows:] = array_chunk\n        if alloc_rows != 0:\n            array.mask[numrows:] = mask_chunk\n        numrows += len(array_chunk)\n\n        if (self.nrows is not None and\n            self.nrows >= 0 and\n            self.nrows != numrows):\n            warn_or_raise(W18, W18, (self.nrows, numrows), config, pos)\n        self._nrows = numrows\n\n        return array"},{"col":4,"comment":"null","endLoc":1375,"header":"@ref.deleter\n    def ref(self)","id":6712,"name":"ref","nodeType":"Function","startLoc":1373,"text":"@ref.deleter\n    def ref(self):\n        self._ref = None"},{"col":4,"comment":"A string specifying the units_ for the FIELD_.","endLoc":1380,"header":"@property\n    def unit(self)","id":6713,"name":"unit","nodeType":"Function","startLoc":1377,"text":"@property\n    def unit(self):\n        \"\"\"A string specifying the units_ for the FIELD_.\"\"\"\n        return self._unit"},{"col":4,"comment":"null","endLoc":1404,"header":"@unit.setter\n    def unit(self, unit)","id":6714,"name":"unit","nodeType":"Function","startLoc":1382,"text":"@unit.setter\n    def unit(self, unit):\n        if unit is None:\n            self._unit = None\n            return\n\n        from astropy import units as u\n\n        # First, parse the unit in the default way, so that we can\n        # still emit a warning if the unit is not to spec.\n        default_format = _get_default_unit_format(self._config)\n        unit_obj = u.Unit(\n            unit, format=default_format, parse_strict='silent')\n        if isinstance(unit_obj, u.UnrecognizedUnit):\n            warn_or_raise(W50, W50, (unit,),\n                          self._config, self._pos)\n\n        format = _get_unit_format(self._config)\n        if format != default_format:\n            unit_obj = u.Unit(\n                unit, format=format, parse_strict='silent')\n\n        self._unit = unit_obj"},{"col":4,"comment":"\n        Correctly set a value.\n\n        Making dictionary values Section instances.\n        (We have to special case 'Section' instances - which are also dicts)\n\n        Keys must be strings.\n        Values need only be strings (or lists of strings) if\n        ``main.stringify`` is set.\n\n        ``unrepr`` must be set when setting a value to a dictionary, without\n        creating a new sub-section.\n        ","endLoc":623,"header":"def __setitem__(self, key, value, unrepr=False)","id":6715,"name":"__setitem__","nodeType":"Function","startLoc":567,"text":"def __setitem__(self, key, value, unrepr=False):\n        \"\"\"\n        Correctly set a value.\n\n        Making dictionary values Section instances.\n        (We have to special case 'Section' instances - which are also dicts)\n\n        Keys must be strings.\n        Values need only be strings (or lists of strings) if\n        ``main.stringify`` is set.\n\n        ``unrepr`` must be set when setting a value to a dictionary, without\n        creating a new sub-section.\n        \"\"\"\n        if not isinstance(key, str):\n            raise ValueError('The key \"%s\" is not a string.' % key)\n\n        # add the comment\n        if key not in self.comments:\n            self.comments[key] = []\n            self.inline_comments[key] = ''\n        # remove the entry from defaults\n        if key in self.defaults:\n            self.defaults.remove(key)\n        #\n        if isinstance(value, Section):\n            if key not in self:\n                self.sections.append(key)\n            dict.__setitem__(self, key, value)\n        elif isinstance(value, Mapping) and not unrepr:\n            # First create the new depth level,\n            # then create the section\n            if key not in self:\n                self.sections.append(key)\n            new_depth = self.depth + 1\n            dict.__setitem__(\n                self,\n                key,\n                Section(\n                    self,\n                    new_depth,\n                    self.main,\n                    indict=value,\n                    name=key))\n        else:\n            if key not in self:\n                self.scalars.append(key)\n            if not self.main.stringify:\n                if isinstance(value, str):\n                    pass\n                elif isinstance(value, (list, tuple)):\n                    for entry in value:\n                        if not isinstance(entry, str):\n                            raise TypeError('Value is not a string \"%s\".' % entry)\n                else:\n                    raise TypeError('Value is not a string \"%s\".' % value)\n            dict.__setitem__(self, key, value)"},{"col":4,"comment":"null","endLoc":1408,"header":"@unit.deleter\n    def unit(self)","id":6716,"name":"unit","nodeType":"Function","startLoc":1406,"text":"@unit.deleter\n    def unit(self):\n        self._unit = None"},{"col":4,"comment":"\n        Specifies the size of the multidimensional array if this\n        FIELD_ contains more than a single value.\n\n        See `multidimensional arrays`_.\n        ","endLoc":1418,"header":"@property\n    def arraysize(self)","id":6717,"name":"arraysize","nodeType":"Function","startLoc":1410,"text":"@property\n    def arraysize(self):\n        \"\"\"\n        Specifies the size of the multidimensional array if this\n        FIELD_ contains more than a single value.\n\n        See `multidimensional arrays`_.\n        \"\"\"\n        return self._arraysize"},{"col":4,"comment":"null","endLoc":1425,"header":"@arraysize.setter\n    def arraysize(self, arraysize)","id":6718,"name":"arraysize","nodeType":"Function","startLoc":1420,"text":"@arraysize.setter\n    def arraysize(self, arraysize):\n        if (arraysize is not None and\n            not re.match(r\"^([0-9]+x)*[0-9]*[*]?(s\\W)?$\", arraysize)):\n            vo_raise(E13, arraysize, self._config, self._pos)\n        self._arraysize = arraysize"},{"col":4,"comment":"null","endLoc":1429,"header":"@arraysize.deleter\n    def arraysize(self)","id":6719,"name":"arraysize","nodeType":"Function","startLoc":1427,"text":"@arraysize.deleter\n    def arraysize(self):\n        self._arraysize = None"},{"col":4,"comment":"\n        The type attribute on FIELD_ elements is reserved for future\n        extensions.\n        ","endLoc":1437,"header":"@property\n    def type(self)","id":6720,"name":"type","nodeType":"Function","startLoc":1431,"text":"@property\n    def type(self):\n        \"\"\"\n        The type attribute on FIELD_ elements is reserved for future\n        extensions.\n        \"\"\"\n        return self._type"},{"col":4,"comment":"null","endLoc":1441,"header":"@type.setter\n    def type(self, type)","id":6721,"name":"type","nodeType":"Function","startLoc":1439,"text":"@type.setter\n    def type(self, type):\n        self._type = type"},{"col":4,"comment":"null","endLoc":1445,"header":"@type.deleter\n    def type(self)","id":6722,"name":"type","nodeType":"Function","startLoc":1443,"text":"@type.deleter\n    def type(self):\n        self._type = None"},{"col":4,"comment":"\n        A :class:`Values` instance (or `None`) defining the domain\n        of the column.\n        ","endLoc":1453,"header":"@property\n    def values(self)","id":6723,"name":"values","nodeType":"Function","startLoc":1447,"text":"@property\n    def values(self):\n        \"\"\"\n        A :class:`Values` instance (or `None`) defining the domain\n        of the column.\n        \"\"\"\n        return self._values"},{"col":4,"comment":"null","endLoc":1458,"header":"@values.setter\n    def values(self, values)","id":6724,"name":"values","nodeType":"Function","startLoc":1455,"text":"@values.setter\n    def values(self, values):\n        assert values is None or isinstance(values, Values)\n        self._values = values"},{"col":4,"comment":"null","endLoc":1031,"header":"def parse_parts(self, parts, config=None, pos=None)","id":6725,"name":"parse_parts","nodeType":"Function","startLoc":1029,"text":"def parse_parts(self, parts, config=None, pos=None):\n        value = complex(*parts)\n        return value, self.is_null(value)"},{"col":4,"comment":"null","endLoc":1462,"header":"@values.deleter\n    def values(self)","id":6726,"name":"values","nodeType":"Function","startLoc":1460,"text":"@values.deleter\n    def values(self):\n        self._values = None"},{"col":4,"comment":"\n        A list of :class:`Link` instances used to reference more\n        details about the meaning of the FIELD_.  This is purely\n        informational and is not used by the `astropy.io.votable`\n        package.\n        ","endLoc":1472,"header":"@property\n    def links(self)","id":6727,"name":"links","nodeType":"Function","startLoc":1464,"text":"@property\n    def links(self):\n        \"\"\"\n        A list of :class:`Link` instances used to reference more\n        details about the meaning of the FIELD_.  This is purely\n        informational and is not used by the `astropy.io.votable`\n        package.\n        \"\"\"\n        return self._links"},{"col":4,"comment":"null","endLoc":1046,"header":"def output(self, value, mask)","id":6728,"name":"output","nodeType":"Function","startLoc":1033,"text":"def output(self, value, mask):\n        if mask:\n            if self.null is None:\n                return 'NaN'\n            else:\n                value = self.null\n        real = self._output_format.format(float(value.real))\n        imag = self._output_format.format(float(value.imag))\n        if self._output_format[2] == 'r':\n            if real.endswith('.0'):\n                real = real[:-2]\n            if imag.endswith('.0'):\n                imag = imag[:-2]\n        return real + ' ' + imag"},{"col":4,"comment":"null","endLoc":1507,"header":"def parse(self, iterator, config)","id":6729,"name":"parse","nodeType":"Function","startLoc":1474,"text":"def parse(self, iterator, config):\n        for start, tag, data, pos in iterator:\n            if start:\n                if tag == 'VALUES':\n                    self.values.__init__(\n                        self._votable, self, config=config, pos=pos, **data)\n                    self.values.parse(iterator, config)\n                elif tag == 'LINK':\n                    link = Link(config=config, pos=pos, **data)\n                    self.links.append(link)\n                    link.parse(iterator, config)\n                elif tag == 'DESCRIPTION':\n                    warn_unknown_attrs(\n                        'DESCRIPTION', data.keys(), config, pos)\n                elif tag != self._element_name:\n                    self._add_unknown_tag(iterator, tag, data, config, pos)\n            else:\n                if tag == 'DESCRIPTION':\n                    if self.description is not None:\n                        warn_or_raise(\n                            W17, W17, self._element_name, config, pos)\n                    self.description = data or None\n                elif tag == self._element_name:\n                    break\n\n        if self.description is not None:\n            self.title = \" \".join(x.strip() for x in\n                                  self.description.splitlines())\n        else:\n            self.title = self.name\n\n        self._setup(config, pos)\n\n        return self"},{"col":4,"comment":"null","endLoc":3243,"header":"def _add_info(self, iterator, tag, data, config, pos)","id":6730,"name":"_add_info","nodeType":"Function","startLoc":3240,"text":"def _add_info(self, iterator, tag, data, config, pos):\n        info = Info(config=config, pos=pos, **data)\n        self.infos.append(info)\n        info.parse(iterator, config)"},{"attributeType":"ComplexArray","col":4,"comment":"null","endLoc":1009,"id":6731,"name":"array_type","nodeType":"Attribute","startLoc":1009,"text":"array_type"},{"attributeType":"ComplexVarArray","col":4,"comment":"null","endLoc":1010,"id":6732,"name":"vararray_type","nodeType":"Attribute","startLoc":1010,"text":"vararray_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":1011,"id":6733,"name":"default","nodeType":"Attribute","startLoc":1011,"text":"default"},{"attributeType":"function","col":4,"comment":"null","endLoc":1026,"id":6734,"name":"_parse_permissive","nodeType":"Attribute","startLoc":1026,"text":"_parse_permissive"},{"attributeType":"function","col":4,"comment":"null","endLoc":1027,"id":6735,"name":"_parse_pedantic","nodeType":"Attribute","startLoc":1027,"text":"_parse_pedantic"},{"className":"FloatComplex","col":0,"comment":"\n    Handle floatComplex datatype.  Pair of single-precision IEEE\n    floating-point numbers.\n    ","endLoc":1054,"id":6736,"nodeType":"Class","startLoc":1049,"text":"class FloatComplex(Complex):\n    \"\"\"\n    Handle floatComplex datatype.  Pair of single-precision IEEE\n    floating-point numbers.\n    \"\"\"\n    format = 'c8'"},{"attributeType":"null","col":4,"comment":"null","endLoc":1054,"id":6737,"name":"format","nodeType":"Attribute","startLoc":1054,"text":"format"},{"className":"DoubleComplex","col":0,"comment":"\n    Handle doubleComplex datatype.  Pair of double-precision IEEE\n    floating-point numbers.\n    ","endLoc":1062,"id":6738,"nodeType":"Class","startLoc":1057,"text":"class DoubleComplex(Complex):\n    \"\"\"\n    Handle doubleComplex datatype.  Pair of double-precision IEEE\n    floating-point numbers.\n    \"\"\"\n    format = 'c16'"},{"attributeType":"null","col":4,"comment":"null","endLoc":1062,"id":6739,"name":"format","nodeType":"Attribute","startLoc":1062,"text":"format"},{"className":"BitArray","col":0,"comment":"\n    Handles an array of bits.\n    ","endLoc":1104,"id":6740,"nodeType":"Class","startLoc":1065,"text":"class BitArray(NumericArray):\n    \"\"\"\n    Handles an array of bits.\n    \"\"\"\n    vararray_type = ArrayVarArray\n\n    def __init__(self, field, base, arraysize, config=None, pos=None):\n        NumericArray.__init__(self, field, base, arraysize, config, pos)\n\n        self._bytes = ((self._items - 1) // 8) + 1\n\n    @staticmethod\n    def _splitter_pedantic(value, config=None, pos=None):\n        return list(re.sub(r'\\s', '', value))\n\n    @staticmethod\n    def _splitter_lax(value, config=None, pos=None):\n        if ',' in value:\n            vo_warn(W01, (), config, pos)\n        return list(re.sub(r'\\s|,', '', value))\n\n    def output(self, value, mask):\n        if np.any(mask):\n            vo_warn(W39)\n        value = np.asarray(value)\n        mapping = {False: '0', True: '1'}\n        return ''.join(mapping[x] for x in value.flat)\n\n    def binparse(self, read):\n        data = read(self._bytes)\n        result = bitarray_to_bool(data, self._items)\n        result = result.reshape(self._arraysize)\n        result_mask = np.zeros(self._arraysize, dtype='b1')\n        return result, result_mask\n\n    def binoutput(self, value, mask):\n        if np.any(mask):\n            vo_warn(W39)\n\n        return bool_to_bitarray(value)"},{"col":4,"comment":"null","endLoc":1074,"header":"def __init__(self, field, base, arraysize, config=None, pos=None)","id":6741,"name":"__init__","nodeType":"Function","startLoc":1071,"text":"def __init__(self, field, base, arraysize, config=None, pos=None):\n        NumericArray.__init__(self, field, base, arraysize, config, pos)\n\n        self._bytes = ((self._items - 1) // 8) + 1"},{"col":4,"comment":"null","endLoc":1078,"header":"@staticmethod\n    def _splitter_pedantic(value, config=None, pos=None)","id":6742,"name":"_splitter_pedantic","nodeType":"Function","startLoc":1076,"text":"@staticmethod\n    def _splitter_pedantic(value, config=None, pos=None):\n        return list(re.sub(r'\\s', '', value))"},{"col":4,"comment":"null","endLoc":1084,"header":"@staticmethod\n    def _splitter_lax(value, config=None, pos=None)","id":6743,"name":"_splitter_lax","nodeType":"Function","startLoc":1080,"text":"@staticmethod\n    def _splitter_lax(value, config=None, pos=None):\n        if ',' in value:\n            vo_warn(W01, (), config, pos)\n        return list(re.sub(r'\\s|,', '', value))"},{"col":4,"comment":"null","endLoc":3248,"header":"def _add_group(self, iterator, tag, data, config, pos)","id":6744,"name":"_add_group","nodeType":"Function","startLoc":3245,"text":"def _add_group(self, iterator, tag, data, config, pos):\n        group = Group(self, config=config, pos=pos, **data)\n        self.groups.append(group)\n        group.parse(iterator, config)"},{"col":0,"comment":"\n    Return a simple table for testing.\n\n    Example\n    --------\n    ::\n\n      >>> from astropy.table.table_helpers import simple_table\n      >>> print(simple_table(3, 6, masked=True, kinds='ifOS'))\n       a   b     c      d   e   f\n      --- --- -------- --- --- ---\n       -- 1.0 {'c': 2}  --   5 5.0\n        2 2.0       --   e   6  --\n        3  -- {'e': 4}   f  -- 7.0\n\n    Parameters\n    ----------\n    size : int\n        Number of table rows\n    cols : int, optional\n        Number of table columns. Defaults to number of kinds.\n    kinds : str\n        String consisting of the column dtype.kinds.  This string\n        will be cycled through to generate the column dtype.\n        The allowed values are 'i', 'f', 'S', 'O'.\n\n    Returns\n    -------\n    out : `Table`\n        New table with appropriate characteristics\n    ","endLoc":118,"header":"def simple_table(size=3, cols=None, kinds='ifS', masked=False)","id":6745,"name":"simple_table","nodeType":"Function","startLoc":56,"text":"def simple_table(size=3, cols=None, kinds='ifS', masked=False):\n    \"\"\"\n    Return a simple table for testing.\n\n    Example\n    --------\n    ::\n\n      >>> from astropy.table.table_helpers import simple_table\n      >>> print(simple_table(3, 6, masked=True, kinds='ifOS'))\n       a   b     c      d   e   f\n      --- --- -------- --- --- ---\n       -- 1.0 {'c': 2}  --   5 5.0\n        2 2.0       --   e   6  --\n        3  -- {'e': 4}   f  -- 7.0\n\n    Parameters\n    ----------\n    size : int\n        Number of table rows\n    cols : int, optional\n        Number of table columns. Defaults to number of kinds.\n    kinds : str\n        String consisting of the column dtype.kinds.  This string\n        will be cycled through to generate the column dtype.\n        The allowed values are 'i', 'f', 'S', 'O'.\n\n    Returns\n    -------\n    out : `Table`\n        New table with appropriate characteristics\n    \"\"\"\n    if cols is None:\n        cols = len(kinds)\n    if cols > 26:\n        raise ValueError(\"Max 26 columns in SimpleTable\")\n\n    columns = []\n    names = [chr(ord('a') + ii) for ii in range(cols)]\n    letters = np.array([c for c in string.ascii_letters])\n    for jj, kind in zip(range(cols), cycle(kinds)):\n        if kind == 'i':\n            data = np.arange(1, size + 1, dtype=np.int64) + jj\n        elif kind == 'f':\n            data = np.arange(size, dtype=np.float64) + jj\n        elif kind == 'S':\n            indices = (np.arange(size) + jj) % len(letters)\n            data = letters[indices]\n        elif kind == 'O':\n            indices = (np.arange(size) + jj) % len(letters)\n            vals = letters[indices]\n            data = [{val: index} for val, index in zip(vals, indices)]\n        else:\n            raise ValueError('Unknown data kind')\n        columns.append(Column(data))\n\n    table = Table(columns, names=names, masked=masked)\n    if masked:\n        for ii, col in enumerate(table.columns.values()):\n            mask = np.array((np.arange(size) + ii) % 3, dtype=bool)\n            col.mask = ~mask\n\n    return table"},{"col":4,"comment":"null","endLoc":1091,"header":"def output(self, value, mask)","id":6746,"name":"output","nodeType":"Function","startLoc":1086,"text":"def output(self, value, mask):\n        if np.any(mask):\n            vo_warn(W39)\n        value = np.asarray(value)\n        mapping = {False: '0', True: '1'}\n        return ''.join(mapping[x] for x in value.flat)"},{"col":4,"comment":"null","endLoc":1098,"header":"def binparse(self, read)","id":6747,"name":"binparse","nodeType":"Function","startLoc":1093,"text":"def binparse(self, read):\n        data = read(self._bytes)\n        result = bitarray_to_bool(data, self._items)\n        result = result.reshape(self._arraysize)\n        result_mask = np.zeros(self._arraysize, dtype='b1')\n        return result, result_mask"},{"col":0,"comment":"null","endLoc":718,"header":"def test_open_files()","id":6748,"name":"test_open_files","nodeType":"Function","startLoc":713,"text":"def test_open_files():\n    for filename in get_pkg_data_filenames('data', pattern='*.xml'):\n        if (filename.endswith('custom_datatype.xml') or\n                filename.endswith('timesys_errors.xml')):\n            continue\n        parse(filename)"},{"col":0,"comment":"\n    Converts a bit array (a string of bits in a bytes object) to a\n    boolean Numpy array.\n\n    Parameters\n    ----------\n    data : bytes\n        The bit array.  The most significant byte is read first.\n\n    length : int\n        The number of bits to read.  The least significant bits in the\n        data bytes beyond length will be ignored.\n\n    Returns\n    -------\n    array : numpy bool array\n    ","endLoc":105,"header":"def bitarray_to_bool(data, length)","id":6749,"name":"bitarray_to_bool","nodeType":"Function","startLoc":76,"text":"def bitarray_to_bool(data, length):\n    \"\"\"\n    Converts a bit array (a string of bits in a bytes object) to a\n    boolean Numpy array.\n\n    Parameters\n    ----------\n    data : bytes\n        The bit array.  The most significant byte is read first.\n\n    length : int\n        The number of bits to read.  The least significant bits in the\n        data bytes beyond length will be ignored.\n\n    Returns\n    -------\n    array : numpy bool array\n    \"\"\"\n    results = []\n    for byte in data:\n        for bit_no in range(7, -1, -1):\n            bit = byte & (1 << bit_no)\n            bit = (bit != 0)\n            results.append(bit)\n            if len(results) == length:\n                break\n        if len(results) == length:\n            break\n\n    return np.array(results, dtype='b1')"},{"col":4,"comment":"null","endLoc":3253,"header":"def _add_param(self, iterator, tag, data, config, pos)","id":6750,"name":"_add_param","nodeType":"Function","startLoc":3250,"text":"def _add_param(self, iterator, tag, data, config, pos):\n        param = Param(self._votable, config=config, pos=pos, **data)\n        self.params.append(param)\n        param.parse(iterator, config)"},{"col":0,"comment":"\n    Masked arrays can not be resized inplace, and `np.resize` and\n    `ma.resize` are both incompatible with structured arrays.\n    Therefore, we do all this.\n    ","endLoc":69,"header":"def _resize(masked, new_size)","id":6751,"name":"_resize","nodeType":"Function","startLoc":59,"text":"def _resize(masked, new_size):\n    \"\"\"\n    Masked arrays can not be resized inplace, and `np.resize` and\n    `ma.resize` are both incompatible with structured arrays.\n    Therefore, we do all this.\n    \"\"\"\n    new_array = ma.zeros((new_size,), dtype=masked.dtype)\n    length = min(len(masked), new_size)\n    new_array[:length] = masked[:length]\n\n    return new_array"},{"col":4,"comment":"null","endLoc":1104,"header":"def binoutput(self, value, mask)","id":6752,"name":"binoutput","nodeType":"Function","startLoc":1100,"text":"def binoutput(self, value, mask):\n        if np.any(mask):\n            vo_warn(W39)\n\n        return bool_to_bitarray(value)"},{"col":0,"comment":"null","endLoc":723,"header":"def test_too_many_columns()","id":6753,"name":"test_too_many_columns","nodeType":"Function","startLoc":721,"text":"def test_too_many_columns():\n    with pytest.raises(VOTableSpecError):\n        parse(get_pkg_data_filename('data/too_many_columns.xml.gz'))"},{"col":0,"comment":"\n    Converts a numpy boolean array to a bit array (a string of bits in\n    a bytes object).\n\n    Parameters\n    ----------\n    value : numpy bool array\n\n    Returns\n    -------\n    bit_array : bytes\n        The first value in the input array will be the most\n        significant bit in the result.  The length will be `floor((N +\n        7) / 8)` where `N` is the length of `value`.\n    ","endLoc":140,"header":"def bool_to_bitarray(value)","id":6754,"name":"bool_to_bitarray","nodeType":"Function","startLoc":108,"text":"def bool_to_bitarray(value):\n    \"\"\"\n    Converts a numpy boolean array to a bit array (a string of bits in\n    a bytes object).\n\n    Parameters\n    ----------\n    value : numpy bool array\n\n    Returns\n    -------\n    bit_array : bytes\n        The first value in the input array will be the most\n        significant bit in the result.  The length will be `floor((N +\n        7) / 8)` where `N` is the length of `value`.\n    \"\"\"\n    value = value.flat\n    bit_no = 7\n    byte = 0\n    bytes = []\n    for v in value:\n        if v:\n            byte |= 1 << bit_no\n        if bit_no == 0:\n            bytes.append(byte)\n            bit_no = 7\n            byte = 0\n        else:\n            bit_no -= 1\n    if bit_no != 7:\n        bytes.append(byte)\n\n    return struct_pack(f\"{len(bytes)}B\", *bytes)"},{"col":0,"comment":"null","endLoc":764,"header":"def test_build_from_scratch(tmpdir)","id":6755,"name":"test_build_from_scratch","nodeType":"Function","startLoc":726,"text":"def test_build_from_scratch(tmpdir):\n    # Create a new VOTable file...\n    votable = tree.VOTableFile()\n\n    # ...with one resource...\n    resource = tree.Resource()\n    votable.resources.append(resource)\n\n    # ... with one table\n    table = tree.Table(votable)\n    resource.tables.append(table)\n\n    # Define some fields\n    table.fields.extend([\n        tree.Field(votable, ID=\"filename\", name='filename', datatype=\"char\",\n                   arraysize='1'),\n        tree.Field(votable, ID=\"matrix\", name='matrix', datatype=\"double\",\n                   arraysize=\"2x2\")])\n\n    # Now, use those field definitions to create the numpy record arrays, with\n    # the given number of rows\n    table.create_arrays(2)\n\n    # Now table.array can be filled with data\n    table.array[0] = ('test1.xml', [[1, 0], [0, 1]])\n    table.array[1] = ('test2.xml', [[0.5, 0.3], [0.2, 0.1]])\n\n    # Now write the whole thing to a file.\n    # Note, we have to use the top-level votable file object\n    votable.to_xml(str(tmpdir.join(\"new_votable.xml\")))\n\n    votable = parse(str(tmpdir.join(\"new_votable.xml\")))\n\n    table = votable.get_first_table()\n    assert_array_equal(\n        table.array.mask, np.array([(False, [[False, False], [False, False]]),\n                                    (False, [[False, False], [False, False]])],\n                                   dtype=[('filename', '?'),\n                                          ('matrix', '?', (2, 2))]))"},{"col":4,"comment":"null","endLoc":2795,"header":"def _parse_binary(self, mode, iterator, colnumbers, fields, config, pos)","id":6756,"name":"_parse_binary","nodeType":"Function","startLoc":2732,"text":"def _parse_binary(self, mode, iterator, colnumbers, fields, config, pos):\n        fields = self.fields\n\n        careful_read = self._get_binary_data_stream(iterator, config)\n\n        # Need to have only one reference so that we can resize the\n        # array\n        array = self.array\n        del self.array\n\n        binparsers = [field.converter.binparse for field in fields]\n\n        numrows = 0\n        alloc_rows = len(array)\n        while True:\n            # Resize result arrays if necessary\n            if numrows >= alloc_rows:\n                alloc_rows = self._resize_strategy(alloc_rows)\n                array = _resize(array, alloc_rows)\n\n            row_data = []\n            row_mask_data = []\n\n            try:\n                if mode == 2:\n                    mask_bits = careful_read(int((len(fields) + 7) / 8))\n                    row_mask_data = list(converters.bitarray_to_bool(\n                        mask_bits, len(fields)))\n\n                    # Ignore the mask for string columns (see issue 8995)\n                    for i, f in enumerate(fields):\n                        if row_mask_data[i] and (f.datatype == 'char' or f.datatype == 'unicodeChar'):\n                            row_mask_data[i] = False\n\n                for i, binparse in enumerate(binparsers):\n                    try:\n                        value, value_mask = binparse(careful_read)\n                    except EOFError:\n                        raise\n                    except Exception as e:\n                        vo_reraise(\n                            e, config, pos, \"(in row {:d}, col '{}')\".format(\n                                numrows, fields[i].ID))\n                    row_data.append(value)\n                    if mode == 1:\n                        row_mask_data.append(value_mask)\n                    else:\n                        row_mask_data[i] = row_mask_data[i] or value_mask\n            except EOFError:\n                break\n\n            row = [x.converter.default for x in fields]\n            row_mask = [False] * len(fields)\n            for i in colnumbers:\n                row[i] = row_data[i]\n                row_mask[i] = row_mask_data[i]\n\n            array[numrows] = tuple(row)\n            array.mask[numrows] = tuple(row_mask)\n            numrows += 1\n\n        array = _resize(array, numrows)\n\n        return array"},{"attributeType":"ArrayVarArray","col":4,"comment":"null","endLoc":1069,"id":6757,"name":"vararray_type","nodeType":"Attribute","startLoc":1069,"text":"vararray_type"},{"attributeType":"null","col":8,"comment":"null","endLoc":1074,"id":6758,"name":"_bytes","nodeType":"Attribute","startLoc":1074,"text":"self._bytes"},{"col":4,"comment":"null","endLoc":2730,"header":"def _get_binary_data_stream(self, iterator, config)","id":6759,"name":"_get_binary_data_stream","nodeType":"Function","startLoc":2678,"text":"def _get_binary_data_stream(self, iterator, config):\n        have_local_stream = False\n        for start, tag, data, pos in iterator:\n            if tag == 'STREAM':\n                if start:\n                    warn_unknown_attrs(\n                        'STREAM', data.keys(), config, pos,\n                        ['type', 'href', 'actuate', 'encoding', 'expires',\n                         'rights'])\n                    if 'href' not in data:\n                        have_local_stream = True\n                        if data.get('encoding', None) != 'base64':\n                            warn_or_raise(\n                                W38, W38, data.get('encoding', None),\n                                config, pos)\n                    else:\n                        href = data['href']\n                        xmlutil.check_anyuri(href, config, pos)\n                        encoding = data.get('encoding', None)\n                else:\n                    buffer = data\n                    break\n\n        if have_local_stream:\n            buffer = base64.b64decode(buffer.encode('ascii'))\n            string_io = io.BytesIO(buffer)\n            string_io.seek(0)\n            read = string_io.read\n        else:\n            if not href.startswith(('http', 'ftp', 'file')):\n                vo_raise(\n                    \"The vo package only supports remote data through http, \" +\n                    \"ftp or file\",\n                    self._config, self._pos, NotImplementedError)\n            fd = urllib.request.urlopen(href)\n            if encoding is not None:\n                if encoding == 'gzip':\n                    fd = gzip.GzipFile(href, 'rb', fileobj=fd)\n                elif encoding == 'base64':\n                    fd = codecs.EncodedFile(fd, 'base64')\n                else:\n                    vo_raise(\n                        f\"Unknown encoding type '{encoding}'\",\n                        self._config, self._pos, NotImplementedError)\n            read = fd.read\n\n        def careful_read(length):\n            result = read(length)\n            if len(result) != length:\n                raise EOFError\n            return result\n\n        return careful_read"},{"className":"Bit","col":0,"comment":"\n    Handles the bit datatype.\n    ","endLoc":1151,"id":6760,"nodeType":"Class","startLoc":1107,"text":"class Bit(Converter):\n    \"\"\"\n    Handles the bit datatype.\n    \"\"\"\n    format = 'b1'\n    array_type = BitArray\n    vararray_type = ScalarVarArray\n    default = False\n    binary_one = b'\\x08'\n    binary_zero = b'\\0'\n\n    def parse(self, value, config=None, pos=None):\n        if config is None:\n            config = {}\n        mapping = {'1': True, '0': False}\n        if value is False or value.strip() == '':\n            if not config['version_1_3_or_later']:\n                warn_or_raise(W49, W49, (), config, pos)\n            return False, True\n        else:\n            try:\n                return mapping[value], False\n            except KeyError:\n                vo_raise(E04, (value,), config, pos)\n\n    def output(self, value, mask):\n        if mask:\n            vo_warn(W39)\n\n        if value:\n            return '1'\n        else:\n            return '0'\n\n    def binparse(self, read):\n        data = read(1)\n        return (ord(data) & 0x8) != 0, False\n\n    def binoutput(self, value, mask):\n        if mask:\n            vo_warn(W39)\n\n        if value:\n            return self.binary_one\n        return self.binary_zero"},{"col":4,"comment":"null","endLoc":1130,"header":"def parse(self, value, config=None, pos=None)","id":6761,"name":"parse","nodeType":"Function","startLoc":1118,"text":"def parse(self, value, config=None, pos=None):\n        if config is None:\n            config = {}\n        mapping = {'1': True, '0': False}\n        if value is False or value.strip() == '':\n            if not config['version_1_3_or_later']:\n                warn_or_raise(W49, W49, (), config, pos)\n            return False, True\n        else:\n            try:\n                return mapping[value], False\n            except KeyError:\n                vo_raise(E04, (value,), config, pos)"},{"col":4,"comment":"null","endLoc":1139,"header":"def output(self, value, mask)","id":6762,"name":"output","nodeType":"Function","startLoc":1132,"text":"def output(self, value, mask):\n        if mask:\n            vo_warn(W39)\n\n        if value:\n            return '1'\n        else:\n            return '0'"},{"col":4,"comment":"null","endLoc":1143,"header":"def binparse(self, read)","id":6763,"name":"binparse","nodeType":"Function","startLoc":1141,"text":"def binparse(self, read):\n        data = read(1)\n        return (ord(data) & 0x8) != 0, False"},{"col":4,"comment":"null","endLoc":1151,"header":"def binoutput(self, value, mask)","id":6764,"name":"binoutput","nodeType":"Function","startLoc":1145,"text":"def binoutput(self, value, mask):\n        if mask:\n            vo_warn(W39)\n\n        if value:\n            return self.binary_one\n        return self.binary_zero"},{"attributeType":"null","col":4,"comment":"null","endLoc":1111,"id":6765,"name":"format","nodeType":"Attribute","startLoc":1111,"text":"format"},{"attributeType":"BitArray","col":4,"comment":"null","endLoc":1112,"id":6766,"name":"array_type","nodeType":"Attribute","startLoc":1112,"text":"array_type"},{"attributeType":"ScalarVarArray","col":4,"comment":"null","endLoc":1113,"id":6767,"name":"vararray_type","nodeType":"Attribute","startLoc":1113,"text":"vararray_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":1114,"id":6768,"name":"default","nodeType":"Attribute","startLoc":1114,"text":"default"},{"attributeType":"null","col":4,"comment":"null","endLoc":1115,"id":6769,"name":"binary_one","nodeType":"Attribute","startLoc":1115,"text":"binary_one"},{"attributeType":"null","col":4,"comment":"null","endLoc":1116,"id":6770,"name":"binary_zero","nodeType":"Attribute","startLoc":1116,"text":"binary_zero"},{"className":"BooleanArray","col":0,"comment":"\n    Handles an array of boolean values.\n    ","endLoc":1181,"id":6771,"nodeType":"Class","startLoc":1154,"text":"class BooleanArray(NumericArray):\n    \"\"\"\n    Handles an array of boolean values.\n    \"\"\"\n    vararray_type = ArrayVarArray\n\n    def binparse(self, read):\n        data = read(self._items)\n        binparse = self._base.binparse_value\n        result = []\n        result_mask = []\n        for char in data:\n            value, mask = binparse(char)\n            result.append(value)\n            result_mask.append(mask)\n        result = np.array(result, dtype='b1').reshape(\n            self._arraysize)\n        result_mask = np.array(result_mask, dtype='b1').reshape(\n            self._arraysize)\n        return result, result_mask\n\n    def binoutput(self, value, mask):\n        binoutput = self._base.binoutput\n        value = np.asarray(value)\n        mask = np.asarray(mask)\n        result = [binoutput(x, m)\n                  for x, m in np.broadcast(value.flat, mask.flat)]\n        return _empty_bytes.join(result)"},{"col":4,"comment":"null","endLoc":1173,"header":"def binparse(self, read)","id":6772,"name":"binparse","nodeType":"Function","startLoc":1160,"text":"def binparse(self, read):\n        data = read(self._items)\n        binparse = self._base.binparse_value\n        result = []\n        result_mask = []\n        for char in data:\n            value, mask = binparse(char)\n            result.append(value)\n            result_mask.append(mask)\n        result = np.array(result, dtype='b1').reshape(\n            self._arraysize)\n        result_mask = np.array(result_mask, dtype='b1').reshape(\n            self._arraysize)\n        return result, result_mask"},{"col":4,"comment":"null","endLoc":1181,"header":"def binoutput(self, value, mask)","id":6773,"name":"binoutput","nodeType":"Function","startLoc":1175,"text":"def binoutput(self, value, mask):\n        binoutput = self._base.binoutput\n        value = np.asarray(value)\n        mask = np.asarray(mask)\n        result = [binoutput(x, m)\n                  for x, m in np.broadcast(value.flat, mask.flat)]\n        return _empty_bytes.join(result)"},{"attributeType":"ArrayVarArray","col":4,"comment":"null","endLoc":1158,"id":6774,"name":"vararray_type","nodeType":"Attribute","startLoc":1158,"text":"vararray_type"},{"className":"Boolean","col":0,"comment":"\n    Handles the boolean datatype.\n    ","endLoc":1249,"id":6775,"nodeType":"Class","startLoc":1184,"text":"class Boolean(Converter):\n    \"\"\"\n    Handles the boolean datatype.\n    \"\"\"\n    format = 'b1'\n    array_type = BooleanArray\n    vararray_type = ScalarVarArray\n    default = False\n    binary_question_mark = b'?'\n    binary_true = b'T'\n    binary_false = b'F'\n\n    def parse(self, value, config=None, pos=None):\n        if value == '':\n            return False, True\n        if value is False:\n            return False, True\n        mapping = {'TRUE': (True, False),\n                   'FALSE': (False, False),\n                   '1': (True, False),\n                   '0': (False, False),\n                   'T': (True, False),\n                   'F': (False, False),\n                   '\\0': (False, True),\n                   ' ': (False, True),\n                   '?': (False, True),\n                   '': (False, True)}\n        try:\n            return mapping[value.upper()]\n        except KeyError:\n            vo_raise(E05, (value,), config, pos)\n\n    def output(self, value, mask):\n        if mask:\n            return '?'\n        if value:\n            return 'T'\n        return 'F'\n\n    def binparse(self, read):\n        value = ord(read(1))\n        return self.binparse_value(value)\n\n    _binparse_mapping = {\n        ord('T'): (True, False),\n        ord('t'): (True, False),\n        ord('1'): (True, False),\n        ord('F'): (False, False),\n        ord('f'): (False, False),\n        ord('0'): (False, False),\n        ord('\\0'): (False, True),\n        ord(' '): (False, True),\n        ord('?'): (False, True)}\n\n    def binparse_value(self, value):\n        try:\n            return self._binparse_mapping[value]\n        except KeyError:\n            vo_raise(E05, (value,))\n\n    def binoutput(self, value, mask):\n        if mask:\n            return self.binary_question_mark\n        if value:\n            return self.binary_true\n        return self.binary_false"},{"col":4,"comment":"null","endLoc":1214,"header":"def parse(self, value, config=None, pos=None)","id":6776,"name":"parse","nodeType":"Function","startLoc":1196,"text":"def parse(self, value, config=None, pos=None):\n        if value == '':\n            return False, True\n        if value is False:\n            return False, True\n        mapping = {'TRUE': (True, False),\n                   'FALSE': (False, False),\n                   '1': (True, False),\n                   '0': (False, False),\n                   'T': (True, False),\n                   'F': (False, False),\n                   '\\0': (False, True),\n                   ' ': (False, True),\n                   '?': (False, True),\n                   '': (False, True)}\n        try:\n            return mapping[value.upper()]\n        except KeyError:\n            vo_raise(E05, (value,), config, pos)"},{"col":4,"comment":"null","endLoc":1221,"header":"def output(self, value, mask)","id":6777,"name":"output","nodeType":"Function","startLoc":1216,"text":"def output(self, value, mask):\n        if mask:\n            return '?'\n        if value:\n            return 'T'\n        return 'F'"},{"col":4,"comment":"null","endLoc":1225,"header":"def binparse(self, read)","id":6778,"name":"binparse","nodeType":"Function","startLoc":1223,"text":"def binparse(self, read):\n        value = ord(read(1))\n        return self.binparse_value(value)"},{"col":4,"comment":"null","endLoc":1242,"header":"def binparse_value(self, value)","id":6779,"name":"binparse_value","nodeType":"Function","startLoc":1238,"text":"def binparse_value(self, value):\n        try:\n            return self._binparse_mapping[value]\n        except KeyError:\n            vo_raise(E05, (value,))"},{"col":4,"comment":"null","endLoc":1249,"header":"def binoutput(self, value, mask)","id":6780,"name":"binoutput","nodeType":"Function","startLoc":1244,"text":"def binoutput(self, value, mask):\n        if mask:\n            return self.binary_question_mark\n        if value:\n            return self.binary_true\n        return self.binary_false"},{"attributeType":"null","col":4,"comment":"null","endLoc":1188,"id":6781,"name":"format","nodeType":"Attribute","startLoc":1188,"text":"format"},{"attributeType":"BooleanArray","col":4,"comment":"null","endLoc":1189,"id":6782,"name":"array_type","nodeType":"Attribute","startLoc":1189,"text":"array_type"},{"attributeType":"null","col":0,"comment":"null","endLoc":41,"id":6783,"name":"_NOT_OVERWRITING_MSG_MATCH","nodeType":"Attribute","startLoc":41,"text":"_NOT_OVERWRITING_MSG_MATCH"},{"className":"TestVerifyOptions","col":0,"comment":"null","endLoc":348,"id":6784,"nodeType":"Class","startLoc":272,"text":"class TestVerifyOptions:\n\n    # Start off by checking the default (ignore)\n\n    def test_default(self):\n        parse(get_pkg_data_filename('data/gemini.xml'))\n\n    # Then try the various explicit options\n\n    def test_verify_ignore(self):\n        parse(get_pkg_data_filename('data/gemini.xml'), verify='ignore')\n\n    def test_verify_warn(self):\n        with pytest.warns(VOWarning) as w:\n            parse(get_pkg_data_filename('data/gemini.xml'), verify='warn')\n        assert len(w) == 24\n\n    def test_verify_exception(self):\n        with pytest.raises(VOWarning):\n            parse(get_pkg_data_filename('data/gemini.xml'), verify='exception')\n\n    # Make sure the deprecated pedantic option still works for now\n\n    def test_pedantic_false(self):\n        with pytest.warns(VOWarning) as w:\n            parse(get_pkg_data_filename('data/gemini.xml'), pedantic=False)\n        assert len(w) == 25\n\n    def test_pedantic_true(self):\n        with pytest.warns(AstropyDeprecationWarning):\n            with pytest.raises(VOWarning):\n                parse(get_pkg_data_filename('data/gemini.xml'), pedantic=True)\n\n    # Make sure that the default behavior can be set via configuration items\n\n    def test_conf_verify_ignore(self):\n        with conf.set_temp('verify', 'ignore'):\n            parse(get_pkg_data_filename('data/gemini.xml'))\n\n    def test_conf_verify_warn(self):\n        with conf.set_temp('verify', 'warn'):\n            with pytest.warns(VOWarning) as w:\n                parse(get_pkg_data_filename('data/gemini.xml'))\n            assert len(w) == 24\n\n    def test_conf_verify_exception(self):\n        with conf.set_temp('verify', 'exception'):\n            with pytest.raises(VOWarning):\n                parse(get_pkg_data_filename('data/gemini.xml'))\n\n    # And make sure the old configuration item will keep working\n\n    def test_conf_pedantic_false(self, tmpdir):\n\n        with set_temp_config(tmpdir.strpath):\n\n            with open(tmpdir.join('astropy').join('astropy.cfg').strpath, 'w') as f:\n                f.write('[io.votable]\\npedantic = False')\n\n            reload_config('astropy.io.votable')\n\n            with pytest.warns(VOWarning) as w:\n                parse(get_pkg_data_filename('data/gemini.xml'))\n            assert len(w) == 25\n\n    def test_conf_pedantic_true(self, tmpdir):\n\n        with set_temp_config(tmpdir.strpath):\n\n            with open(tmpdir.join('astropy').join('astropy.cfg').strpath, 'w') as f:\n                f.write('[io.votable]\\npedantic = True')\n\n            reload_config('astropy.io.votable')\n\n            with pytest.warns(AstropyDeprecationWarning):\n                with pytest.raises(VOWarning):\n                    parse(get_pkg_data_filename('data/gemini.xml'))"},{"attributeType":"ScalarVarArray","col":4,"comment":"null","endLoc":1190,"id":6785,"name":"vararray_type","nodeType":"Attribute","startLoc":1190,"text":"vararray_type"},{"col":4,"comment":"null","endLoc":277,"header":"def test_default(self)","id":6786,"name":"test_default","nodeType":"Function","startLoc":276,"text":"def test_default(self):\n        parse(get_pkg_data_filename('data/gemini.xml'))"},{"attributeType":"null","col":4,"comment":"null","endLoc":1191,"id":6787,"name":"default","nodeType":"Attribute","startLoc":1191,"text":"default"},{"attributeType":"null","col":4,"comment":"null","endLoc":1192,"id":6788,"name":"binary_question_mark","nodeType":"Attribute","startLoc":1192,"text":"binary_question_mark"},{"attributeType":"null","col":4,"comment":"null","endLoc":1193,"id":6789,"name":"binary_true","nodeType":"Attribute","startLoc":1193,"text":"binary_true"},{"attributeType":"null","col":4,"comment":"null","endLoc":1194,"id":6790,"name":"binary_false","nodeType":"Attribute","startLoc":1194,"text":"binary_false"},{"attributeType":"null","col":4,"comment":"null","endLoc":1227,"id":6791,"name":"_binparse_mapping","nodeType":"Attribute","startLoc":1227,"text":"_binparse_mapping"},{"attributeType":"null","col":29,"comment":"null","endLoc":11,"id":6792,"name":"_struct_unpack","nodeType":"Attribute","startLoc":11,"text":"_struct_unpack"},{"attributeType":"null","col":27,"comment":"null","endLoc":12,"id":6793,"name":"_struct_pack","nodeType":"Attribute","startLoc":12,"text":"_struct_pack"},{"attributeType":"null","col":16,"comment":"null","endLoc":15,"id":6794,"name":"np","nodeType":"Attribute","startLoc":15,"text":"np"},{"col":4,"comment":"null","endLoc":2833,"header":"def _parse_fits(self, iterator, extnum, config)","id":6795,"name":"_parse_fits","nodeType":"Function","startLoc":2797,"text":"def _parse_fits(self, iterator, extnum, config):\n        for start, tag, data, pos in iterator:\n            if tag == 'STREAM':\n                if start:\n                    warn_unknown_attrs(\n                        'STREAM', data.keys(), config, pos,\n                        ['type', 'href', 'actuate', 'encoding', 'expires',\n                         'rights'])\n                    href = data['href']\n                    encoding = data.get('encoding', None)\n                else:\n                    break\n\n        if not href.startswith(('http', 'ftp', 'file')):\n            vo_raise(\n                \"The vo package only supports remote data through http, \"\n                \"ftp or file\",\n                self._config, self._pos, NotImplementedError)\n\n        fd = urllib.request.urlopen(href)\n        if encoding is not None:\n            if encoding == 'gzip':\n                fd = gzip.GzipFile(href, 'r', fileobj=fd)\n            elif encoding == 'base64':\n                fd = codecs.EncodedFile(fd, 'base64')\n            else:\n                vo_raise(\n                    f\"Unknown encoding type '{encoding}'\",\n                    self._config, self._pos, NotImplementedError)\n\n        hdulist = fits.open(fd)\n\n        array = hdulist[int(extnum)].data\n        if array.dtype != self.array.dtype:\n            warn_or_raise(W19, W19, (), self._config, self._pos)\n\n        return array"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":6796,"name":"__all__","nodeType":"Attribute","startLoc":27,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":6797,"name":"pedantic_array_splitter","nodeType":"Attribute","startLoc":30,"text":"pedantic_array_splitter"},{"attributeType":"null","col":0,"comment":"\nA regex to handle splitting values on either whitespace or commas.\n\nSPEC: Usage of commas is not actually allowed by the spec, but many\nfiles in the wild use them.\n","endLoc":31,"id":6798,"name":"array_splitter","nodeType":"Attribute","startLoc":31,"text":"array_splitter"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":6799,"name":"_zero_int","nodeType":"Attribute","startLoc":39,"text":"_zero_int"},{"attributeType":"null","col":0,"comment":"null","endLoc":40,"id":6800,"name":"_empty_bytes","nodeType":"Attribute","startLoc":40,"text":"_empty_bytes"},{"attributeType":"null","col":0,"comment":"null","endLoc":41,"id":6801,"name":"_zero_byte","nodeType":"Attribute","startLoc":41,"text":"_zero_byte"},{"attributeType":"null","col":0,"comment":"null","endLoc":44,"id":6802,"name":"struct_unpack","nodeType":"Attribute","startLoc":44,"text":"struct_unpack"},{"attributeType":"null","col":0,"comment":"null","endLoc":45,"id":6803,"name":"struct_pack","nodeType":"Attribute","startLoc":45,"text":"struct_pack"},{"attributeType":"null","col":0,"comment":"null","endLoc":1252,"id":6804,"name":"converter_mapping","nodeType":"Attribute","startLoc":1252,"text":"converter_mapping"},{"attributeType":"null","col":0,"comment":"null","endLoc":1328,"id":6805,"name":"numpy_dtype_to_field_mapping","nodeType":"Attribute","startLoc":1328,"text":"numpy_dtype_to_field_mapping"},{"col":0,"comment":"","endLoc":5,"header":"converters.py#<anonymous>","id":6806,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module handles the conversion of various VOTABLE datatypes\nto/from TABLEDATA_ and BINARY_ formats.\n\"\"\"\n\n__all__ = ['get_converter', 'Converter', 'table_column_to_votable_datatype']\n\npedantic_array_splitter = re.compile(r\" +\")\n\narray_splitter = re.compile(r\"\\s+|(?:\\s*,\\s*)\")\n\n\"\"\"\nA regex to handle splitting values on either whitespace or commas.\n\nSPEC: Usage of commas is not actually allowed by the spec, but many\nfiles in the wild use them.\n\"\"\"\n\n_zero_int = b'\\0\\0\\0\\0'\n\n_empty_bytes = b''\n\n_zero_byte = b'\\0'\n\nstruct_unpack = _struct_unpack\n\nstruct_pack = _struct_pack\n\nif sys.byteorder == 'little':\n    def _ensure_bigendian(x):\n        if x.dtype.byteorder != '>':\n            return x.byteswap()\n        return x\nelse:\n    def _ensure_bigendian(x):\n        if x.dtype.byteorder == '<':\n            return x.byteswap()\n        return x\n\nconverter_mapping = {\n    'double': Double,\n    'float': Float,\n    'bit': Bit,\n    'boolean': Boolean,\n    'unsignedByte': UnsignedByte,\n    'short': Short,\n    'int': Int,\n    'long': Long,\n    'floatComplex': FloatComplex,\n    'doubleComplex': DoubleComplex,\n    'char': Char,\n    'unicodeChar': UnicodeChar}\n\nnumpy_dtype_to_field_mapping = {\n    np.float64().dtype.num: 'double',\n    np.float32().dtype.num: 'float',\n    np.bool_().dtype.num: 'bit',\n    np.uint8().dtype.num: 'unsignedByte',\n    np.int16().dtype.num: 'short',\n    np.int32().dtype.num: 'int',\n    np.int64().dtype.num: 'long',\n    np.complex64().dtype.num: 'floatComplex',\n    np.complex128().dtype.num: 'doubleComplex',\n    np.unicode_().dtype.num: 'unicodeChar'\n}\n\nnumpy_dtype_to_field_mapping[np.bytes_().dtype.num] = 'char'"},{"col":4,"comment":"null","endLoc":282,"header":"def test_verify_ignore(self)","id":6807,"name":"test_verify_ignore","nodeType":"Function","startLoc":281,"text":"def test_verify_ignore(self):\n        parse(get_pkg_data_filename('data/gemini.xml'), verify='ignore')"},{"col":4,"comment":"null","endLoc":287,"header":"def test_verify_warn(self)","id":6808,"name":"test_verify_warn","nodeType":"Function","startLoc":284,"text":"def test_verify_warn(self):\n        with pytest.warns(VOWarning) as w:\n            parse(get_pkg_data_filename('data/gemini.xml'), verify='warn')\n        assert len(w) == 24"},{"col":4,"comment":"null","endLoc":291,"header":"def test_verify_exception(self)","id":6809,"name":"test_verify_exception","nodeType":"Function","startLoc":289,"text":"def test_verify_exception(self):\n        with pytest.raises(VOWarning):\n            parse(get_pkg_data_filename('data/gemini.xml'), verify='exception')"},{"col":4,"comment":"null","endLoc":298,"header":"def test_pedantic_false(self)","id":6810,"name":"test_pedantic_false","nodeType":"Function","startLoc":295,"text":"def test_pedantic_false(self):\n        with pytest.warns(VOWarning) as w:\n            parse(get_pkg_data_filename('data/gemini.xml'), pedantic=False)\n        assert len(w) == 25"},{"col":4,"comment":"null","endLoc":303,"header":"def test_pedantic_true(self)","id":6811,"name":"test_pedantic_true","nodeType":"Function","startLoc":300,"text":"def test_pedantic_true(self):\n        with pytest.warns(AstropyDeprecationWarning):\n            with pytest.raises(VOWarning):\n                parse(get_pkg_data_filename('data/gemini.xml'), pedantic=True)"},{"col":4,"comment":"null","endLoc":2878,"header":"def to_xml(self, w, **kwargs)","id":6812,"name":"to_xml","nodeType":"Function","startLoc":2835,"text":"def to_xml(self, w, **kwargs):\n        specified_format = kwargs.get('tabledata_format')\n        if specified_format is not None:\n            format = specified_format\n        else:\n            format = self.format\n        if format == 'fits':\n            format = 'tabledata'\n\n        with w.tag(\n            'TABLE',\n            attrib=w.object_attrs(\n                self,\n                ('ID', 'name', 'ref', 'ucd', 'utype', 'nrows'))):\n\n            if self.description is not None:\n                w.element(\"DESCRIPTION\", self.description, wrap=True)\n\n            for element_set in (self.fields, self.params):\n                for element in element_set:\n                    element._setup({}, None)\n\n            if self.ref is None:\n                for element_set in (self.fields, self.params, self.groups,\n                                    self.links):\n                    for element in element_set:\n                        element.to_xml(w, **kwargs)\n            elif kwargs['version_1_2_or_later']:\n                index = list(self._votable.iter_tables()).index(self)\n                group = Group(self, ID=f\"_g{index}\")\n                group.to_xml(w, **kwargs)\n\n            if len(self.array):\n                with w.tag('DATA'):\n                    if format == 'tabledata':\n                        self._write_tabledata(w, **kwargs)\n                    elif format == 'binary':\n                        self._write_binary(1, w, **kwargs)\n                    elif format == 'binary2':\n                        self._write_binary(2, w, **kwargs)\n\n            if kwargs['version_1_2_or_later']:\n                for element in self._infos:\n                    element.to_xml(w, **kwargs)"},{"col":4,"comment":"null","endLoc":309,"header":"def test_conf_verify_ignore(self)","id":6813,"name":"test_conf_verify_ignore","nodeType":"Function","startLoc":307,"text":"def test_conf_verify_ignore(self):\n        with conf.set_temp('verify', 'ignore'):\n            parse(get_pkg_data_filename('data/gemini.xml'))"},{"fileName":"resource_test.py","filePath":"astropy/io/votable/tests","id":6814,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# LOCAL\nfrom astropy.io.votable import parse\nfrom astropy.utils.data import get_pkg_data_filename\n\n\ndef test_resource_groups():\n    # Read the VOTABLE\n    votable = parse(get_pkg_data_filename('data/resource_groups.xml'))\n\n    resource = votable.resources[0]\n    groups = resource.groups\n    params = resource.params\n\n    # Test that params inside groups are not outside\n\n    assert len(groups[0].entries) == 1\n    assert groups[0].entries[0].name == \"ID\"\n\n    assert len(params) == 2\n    assert params[0].name == \"standardID\"\n    assert params[1].name == \"accessURL\"\n"},{"col":4,"comment":"null","endLoc":315,"header":"def test_conf_verify_warn(self)","id":6815,"name":"test_conf_verify_warn","nodeType":"Function","startLoc":311,"text":"def test_conf_verify_warn(self):\n        with conf.set_temp('verify', 'warn'):\n            with pytest.warns(VOWarning) as w:\n                parse(get_pkg_data_filename('data/gemini.xml'))\n            assert len(w) == 24"},{"col":0,"comment":"null","endLoc":22,"header":"def test_resource_groups()","id":6816,"name":"test_resource_groups","nodeType":"Function","startLoc":7,"text":"def test_resource_groups():\n    # Read the VOTABLE\n    votable = parse(get_pkg_data_filename('data/resource_groups.xml'))\n\n    resource = votable.resources[0]\n    groups = resource.groups\n    params = resource.params\n\n    # Test that params inside groups are not outside\n\n    assert len(groups[0].entries) == 1\n    assert groups[0].entries[0].name == \"ID\"\n\n    assert len(params) == 2\n    assert params[0].name == \"standardID\"\n    assert params[1].name == \"accessURL\""},{"col":4,"comment":"null","endLoc":320,"header":"def test_conf_verify_exception(self)","id":6817,"name":"test_conf_verify_exception","nodeType":"Function","startLoc":317,"text":"def test_conf_verify_exception(self):\n        with conf.set_temp('verify', 'exception'):\n            with pytest.raises(VOWarning):\n                parse(get_pkg_data_filename('data/gemini.xml'))"},{"col":4,"comment":"null","endLoc":335,"header":"def test_conf_pedantic_false(self, tmpdir)","id":6818,"name":"test_conf_pedantic_false","nodeType":"Function","startLoc":324,"text":"def test_conf_pedantic_false(self, tmpdir):\n\n        with set_temp_config(tmpdir.strpath):\n\n            with open(tmpdir.join('astropy').join('astropy.cfg').strpath, 'w') as f:\n                f.write('[io.votable]\\npedantic = False')\n\n            reload_config('astropy.io.votable')\n\n            with pytest.warns(VOWarning) as w:\n                parse(get_pkg_data_filename('data/gemini.xml'))\n            assert len(w) == 25"},{"id":6819,"name":"astropy/io/votable/tests/data","nodeType":"Package"},{"id":6820,"name":"custom_datatype.xml","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<VOTABLE version=\"1.1\"\nxmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\nxsi:noNamespaceSchemaLocation=\"xmlns:http://www.ivoa.net/xml/VOTable/VOTable-1.1.xsd\"\nxmlns=\"http://www.ivoa.net/xml/VOTable/v1.1\">\n  <RESOURCE>\n    <TABLE>\n      <FIELD name=\"foo\" datatype=\"bar\"/>\n      <DATA>\n        <TABLEDATA>\n          <TR>\n            <TD>42</TD>\n          </TR>\n        </TABLEDATA>\n      </DATA>\n    </TABLE>\n  </RESOURCE>\n</VOTABLE>\n"},{"id":6821,"name":"no_field_not_empty_table.xml","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Produced with astropy.io.votable version 4.0\n http://www.astropy.org/ -->\n<VOTABLE version=\"1.4\" xmlns=\"http://www.ivoa.net/xml/VOTable/v1.3\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://www.ivoa.net/xml/VOTable/v1.3\">\n <RESOURCE type=\"results\">\n  <TABLE>\n   <DATA>\n    <TABLEDATA>\n     <TR></TR>\n     <TR></TR>\n     <TR></TR>\n    </TABLEDATA>\n   </DATA>\n   <INFO name=\"matches\" value=\"3\">matching records</INFO>\n  </TABLE>\n </RESOURCE>\n</VOTABLE>\n"},{"id":6822,"name":"valid_votable.xml","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<VOTABLE version=\"1.4\" xmlns=\"http://www.ivoa.net/xml/VOTable/v1.3\">\n  <RESOURCE name=\"myFavouriteGalaxies\">\n    <COOSYS ID=\"sys\" equinox=\"J2000\" epoch=\"J2000\" system=\"eq_FK5\"/>\n    <TABLE name=\"results\">\n      <DESCRIPTION>Velocities and Distance estimations</DESCRIPTION>\n      <PARAM name=\"Telescope\" datatype=\"float\" ucd=\"phys.size;instr.tel\"\n             unit=\"m\" value=\"3.6\"/>\n      <FIELD name=\"RA\"   ID=\"col1\" ucd=\"pos.eq.ra;meta.main\"\n             datatype=\"float\" width=\"6\" precision=\"2\" unit=\"deg\" ref=\"sys\"/>\n      <FIELD name=\"Dec\"  ID=\"col2\" ucd=\"pos.eq.dec;meta.main\"\n             datatype=\"float\" width=\"6\" precision=\"2\" unit=\"deg\" ref=\"sys\"/>\n      <FIELD name=\"Name\" ID=\"col3\" ucd=\"meta.id;meta.main\"\n             datatype=\"char\" arraysize=\"8*\"/>\n      <FIELD name=\"RVel\" ID=\"col4\" ucd=\"spect.dopplerVeloc\" datatype=\"int\"\n             width=\"5\" unit=\"km/s\"/>\n      <FIELD name=\"e_RVel\" ID=\"col5\" ucd=\"stat.error;spect.dopplerVeloc\"\n             datatype=\"int\" width=\"3\" unit=\"km/s\"/>\n      <FIELD name=\"R\" ID=\"col6\" ucd=\"pos.distance;pos.heliocentric\"\n             datatype=\"float\" width=\"4\" precision=\"1\" unit=\"Mpc\">\n        <DESCRIPTION>Distance of Galaxy, assuming H=75km/s/Mpc</DESCRIPTION>\n      </FIELD>\n      <DATA>\n        <TABLEDATA>\n        <TR>\n          <TD>010.68</TD><TD>+41.27</TD><TD>N 224</TD><TD>-297</TD><TD>5</TD><TD>0.7</TD>\n        </TR>\n        <TR>\n          <TD>287.43</TD><TD>-63.85</TD><TD>N 6744</TD><TD>839</TD><TD>6</TD><TD>10.4</TD>\n        </TR>\n        <TR>\n          <TD>023.48</TD><TD>+30.66</TD><TD>N 598</TD><TD>-182</TD><TD>3</TD><TD>0.7</TD>\n        </TR>\n        </TABLEDATA>\n      </DATA>\n    </TABLE>\n  </RESOURCE>\n</VOTABLE>\n"},{"id":6823,"name":"no_resource.xml","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<VOTABLE version=\"1.2\"\nxmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\nxsi:noNamespaceSchemaLocation=\"xmlns:http://www.ivoa.net/xml/VOTable/VOTable-1.2.xsd\"\nxmlns=\"http://www.ivoa.net/xml/VOTable/v1.2\">\n</VOTABLE>\n"},{"id":6824,"name":"validation.txt","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"Validation report for regression.xml\n\n11: W01: Array uses commas rather than whitespace\n<PARAM datatype=\"float\" name=\"wrong_arraysize\" value=\"0.000000,0.00...\n^\n\n11: E02: Incorrect number of elements in array. Expected multiple of\n  0, got 2\n<PARAM datatype=\"float\" name=\"wrong_arraysize\" value=\"0.000000,0.00...\n^\n\n12: W01: Array uses commas rather than whitespace\n<PARAM datatype=\"float\" name=\"INPUT\" value=\"0.000000,0.000000\" arra...\n^\n\n20: W01: Array uses commas rather than whitespace\n<PARAM ID=\"awesome\" datatype=\"float\" name=\"INPUT\" value=\"0.000000,0...\n^\n\n21: W50: Invalid unit string 'foo'\n<PARAM ID=\"empty_value\" arraysize=\"*\" datatype=\"char\" name=\"empty_v...\n^\n\n27: W11: The gref attribute on LINK is deprecated in VOTable 1.1\n<LINK href=\"http://www.foo.com/\" gref=\"DECPRECATED\">\n^\n\n28: W10: Unknown tag 'DESCRIPTION'.  Ignoring\n  <DESCRIPTION>Really, this link is totally bogus.</DESCRIPTION>\n  ^\n\n34: W26: 'INFO' inside 'TABLE' added in VOTable 1.2\n<INFO name=\"Error\" ID=\"ErrorInfo\" value=\"One might expect to find s...\n^\n\n38: W01: Array uses commas rather than whitespace\n<PARAM datatype=\"float\" name=\"INPUT2\" value=\"0.000000,0.000000\" arr...\n^\n\n41: W09: ID attribute not capitalized\n<FIELD id=\"string_test\" name=\"string test\" datatype=\"char\" arraysiz...\n^\n\n44: W13: 'unicodeString' is not a valid VOTable datatype, should be\n  'unicodeChar'\n<FIELD ID=\"fixed_unicode_test\" name=\"unicode test\" datatype=\"unicod...\n^\n\n46: W13: 'string' is not a valid VOTable datatype, should be 'char'\n<FIELD ID=\"string_array_test\" name=\"string array test\" datatype=\"st...\n^\n\n49: W51: Value '-32769' is out of range for a 16-bit integer field\n  <VALUES null=\"-32769\"/>\n  ^\n\n57: W10: Unknown tag 'IGNORE_ME'.  Ignoring\n  <IGNORE_ME/>\n  ^\n\n97: W17: GROUP element contains more than one DESCRIPTION element\n    This should warn of a second description.\n^\n\n104: W01: Array uses commas rather than whitespace\n  <PARAM datatype=\"float\" name=\"INPUT3\" value=\"0.000000,0.000000\" a...\n  ^\n\n42: W32: Duplicate ID 'string_test' renamed to 'string_test_2' to\n  ensure uniqueness\n<FIELD ID=\"string_test\" name=\"fixed string test\" datatype=\"char\" ar...\n^\n\n112: W46: char value is too long for specified length of 10\n  <TD>Fixed string long test</TD> <!-- Should truncate -->\n      ^\n\n114: W46: unicodeChar value is too long for specified length of 10\n  <TD>Ceçi n'est pas un pipe</TD>\n      ^\n\n115: W46: char value is too long for specified length of 4\n  <TD>ab cd</TD>\n      ^\n\n134: E02: Incorrect number of elements in array. Expected multiple of\n  4, got 1\n  <TD/>\n  ^\n\n134: W49: Empty cell illegal for integer fields.\n  <TD/>\n  ^\n\n142: W46: char value is too long for specified length of 10\n  <TD>0123456789A</TD>\n      ^\n\n145: W46: char value is too long for specified length of 4\n  <TD>0123456789A</TD>\n      ^\n\n146: W51: Value '256' is out of range for a 8-bit unsigned integer\n  field\n  <TD>256</TD> <!-- should overflow to 0 -->\n      ^\n\n147: W51: Value '65536' is out of range for a 16-bit integer field\n  <TD>65536</TD> <!-- should overflow to 0-->\n      ^\n\n149: W49: Empty cell illegal for integer fields.\n  <TD></TD>\n  ^\n\n152: W01: Array uses commas rather than whitespace\n  <TD>42 32, 12 32</TD>\n      ^\n\n168: E02: Incorrect number of elements in array. Expected multiple of\n  16, got 0\n  <TD/>\n  ^\n\n168: W49: Empty cell illegal for integer fields.\n  <TD/>\n  ^\n\n168: W49: Empty cell illegal for integer fields.\n  <TD/>\n  ^\n\n168: W49: Empty cell illegal for integer fields.\n  <TD/>\n  ^\n\n168: W49: Empty cell illegal for integer fields.\n  <TD/>\n  ^\n\n168: W49: Empty cell illegal for integer fields.\n  <TD/>\n  ^\n\n168: W49: Empty cell illegal for integer fields.\n  <TD/>\n  ^\n\n168: W49: Empty cell illegal for integer fields.\n  <TD/>\n  ^\n\n168: W49: Empty cell illegal for integer fields. (suppressing further\n  warnings of this type...)\n  <TD/>\n  ^\n\n174: W46: unicodeChar value is too long for specified length of 10\n  <TD>0123456789A</TD>\n      ^\n\n176: W51: Value '-23' is out of range for a 8-bit unsigned integer\n  field\n  <TD>-23</TD> <!-- negative, should wrap around to positive -->\n      ^\n\n198: E02: Incorrect number of elements in array. Expected multiple of\n  16, got 0\n  <TD/>\n  ^\n\n207: W51: Value '65535' is out of range for a 16-bit integer field\n  <TD>0xffff</TD> <!-- hex - negative value -->\n      ^\n\n212: W01: Array uses commas rather than whitespace\n  <TD>NaN, 23</TD>\n      ^\n\n214: E02: Incorrect number of elements in array. Expected multiple of\n  6, got 0\n  <TD/>\n  ^\n\n222: E02: Incorrect number of elements in array. Expected multiple of\n  4, got 1\n  <TD/>\n  ^\n\n228: E02: Incorrect number of elements in array. Expected multiple of\n  16, got 0\n  <TD/>\n  ^\n\n236: W51: Value '256' is out of range for a 8-bit unsigned integer\n  field\n  <TD>0x100</TD> <!-- hex, overflow -->\n      ^\n\n237: W51: Value '65536' is out of range for a 16-bit integer field\n  <TD>0x10000</TD> <!-- hex, overflow -->\n      ^\n\n242: W01: Array uses commas rather than whitespace\n  <TD>31, -1</TD>\n      ^\n\n244: E02: Incorrect number of elements in array. Expected multiple of\n  6, got 0\n  <TD/>\n  ^\n\n252: E02: Incorrect number of elements in array. Expected multiple of\n  4, got 1\n  <TD/>\n  ^\n\n254: E02: Incorrect number of elements in array. Expected multiple of\n  4, got 1 (suppressing further warnings of this type...)\n  <TD/>\n  ^\n\n272: W46: char value is too long for specified length of 10\n  <TD>Fixed string long test</TD> <!-- Should truncate -->\n      ^\n\n274: W46: unicodeChar value is too long for specified length of 10\n  <TD>Ceçi n'est pas un pipe</TD>\n      ^\n\n275: W46: char value is too long for specified length of 4\n  <TD>ab cd</TD>\n      ^\n"},{"id":6825,"name":"irsa-nph-m31.xml","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"<?xml version=\"1.0\"?>\n<!DOCTYPE VOTABLE SYSTEM \"http://us-vo.org/xml/VOTable.dtd\">\n<VOTABLE version=\"v1.0\">\n<DEFINITIONS>\n<COOSYS ID=\"J2000\" equinox=\"2000.\" epoch=\"2000.\" system=\"eq_FK5\" />\n</DEFINITIONS>\n<RESOURCE>\n<PARAM name=\"fixlen\" datatype=\"char\" arraysize=\"*\" value=\"T\" />\n<PARAM name=\"primary\" datatype=\"char\" arraysize=\"*\" value=\"0\" />\n<PARAM name=\"RowsRetrieved\" datatype=\"char\" arraysize=\"*\" value=\"18\" />\n<PARAM name=\"QueryTime\" datatype=\"char\" arraysize=\"*\" value=\"00:00:00.01625\" />\n<PARAM name=\"ORIGIN\" datatype=\"char\" arraysize=\"*\" value=\"&apos;IPAC Infrared Science Archive (IRSA), Caltech/JPL&apos;\" />\n<PARAM name=\"DATETIME\" datatype=\"char\" arraysize=\"*\" value=\"&apos;2010-06-16 17:10:01&apos;\" />\n<PARAM name=\"DataTag\" datatype=\"char\" arraysize=\"*\" value=\"&apos;ADS/IRSA.Gator#2010/0616/171001_27166&apos;\" />\n<PARAM name=\"DATABASE\" datatype=\"char\" arraysize=\"*\" value=\"&apos;2MASS All-Sky Point Source Catalog (PSC) (fp_psc)&apos;\" />\n<PARAM name=\"EQUINOX\" datatype=\"char\" arraysize=\"*\" value=\"&apos;J2000&apos;\" />\n<PARAM name=\"SKYAREA\" datatype=\"char\" arraysize=\"*\" value=\"&apos;within 10 arcsec of  ra=10.68468 dec=+41.26904 Eq J2000 &apos;\" />\n<PARAM name=\"SQL\" datatype=\"char\" arraysize=\"*\" value=\"&apos;WHERE (no constraints)\" />\n<PARAM name=\"SQL\" datatype=\"char\" arraysize=\"*\" value=\"&apos;SELECT (19 column names follow in next row.)&apos;\" />\n<TABLE>\n<FIELD name=\"ra\" ucd=\"POS_EQ_RA_MAIN\" ref=\"J2000\" datatype=\"float\" unit=\"deg\" precision=\"F3\" width=\"7\" />\n<FIELD name=\"dec\" ucd=\"POS_EQ_DEC_MAIN\" ref=\"J2000\" datatype=\"float\" unit=\"deg\" precision=\"F3\" width=\"7\" />\n<FIELD name=\"clon\" datatype=\"char\" arraysize=\"*\"/>\n<FIELD name=\"clat\" datatype=\"char\" arraysize=\"*\"/>\n<FIELD name=\"err_maj\" datatype=\"double\" unit=\"arcsec\"/>\n<FIELD name=\"err_min\" datatype=\"double\" unit=\"arcsec\"/>\n<FIELD name=\"designation\" datatype=\"char\" arraysize=\"*\"/>\n<FIELD name=\"j_m\" datatype=\"double\" unit=\"mag\"/>\n<FIELD name=\"j_msigcom\" datatype=\"double\" unit=\"mag\"/>\n<FIELD name=\"h_m\" datatype=\"double\" unit=\"mag\"/>\n<FIELD name=\"h_msigcom\" datatype=\"double\" unit=\"mag\"/>\n<FIELD name=\"k_m\" datatype=\"double\" unit=\"mag\"/>\n<FIELD name=\"k_msigcom\" datatype=\"double\" unit=\"mag\"/>\n<FIELD name=\"ph_qual\" datatype=\"char\" arraysize=\"*\"/>\n<FIELD name=\"rd_flg\" datatype=\"char\" arraysize=\"*\"/>\n<FIELD name=\"bl_flg\" datatype=\"char\" arraysize=\"*\"/>\n<FIELD name=\"cc_flg\" datatype=\"char\" arraysize=\"*\"/>\n<FIELD name=\"gal_contam\" datatype=\"int\" unit=\" \"/>\n<FIELD name=\"mp_flg\" datatype=\"int\" unit=\" \"/>\n<FIELD name=\"dist\" datatype=\"double\" unit=\" \"/>\n<FIELD name=\"angle\" datatype=\"double\" unit=\" \"/>\n<FIELD name=\"j_h\" datatype=\"double\" unit=\" \"/>\n<FIELD name=\"h_k\" datatype=\"double\" unit=\" \"/>\n<FIELD name=\"j_k\" datatype=\"double\" unit=\" \"/>\n<FIELD name=\"id\" ucd=\"ID_MAIN\" datatype=\"char\" arraysize=\"*\" />\n<DATA>\n<TABLEDATA>\n<TR><TD>10.683263</TD><TD>41.267456</TD><TD>00h42m43.98s</TD><TD>41d16m02.84s</TD><TD>0.13</TD><TD>0.12</TD><TD>00424398+4116028</TD><TD>12.136</TD><TD>0.040</TD><TD>9.226</TD><TD>null</TD><TD>8.994</TD><TD>null</TD><TD>AUU</TD><TD>200</TD><TD>100</TD><TD>c00</TD><TD>2</TD><TD>0</TD><TD>6.871574</TD><TD>213.916</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>0</TD></TR>\n<TR><TD>10.682777</TD><TD>41.270111</TD><TD>00h42m43.87s</TD><TD>41d16m12.40s</TD><TD>0.10</TD><TD>0.09</TD><TD>00424386+4116123</TD><TD>9.977</TD><TD>null</TD><TD>11.683</TD><TD>0.056</TD><TD>11.839</TD><TD>0.062</TD><TD>UAA</TD><TD>022</TD><TD>011</TD><TD>0cc</TD><TD>2</TD><TD>0</TD><TD>6.432619</TD><TD>306.825</TD><TD>-</TD><TD>-0.1560</TD><TD>-</TD><TD>1</TD></TR>\n<TR><TD>10.684737</TD><TD>41.269035</TD><TD>00h42m44.34s</TD><TD>41d16m08.53s</TD><TD>0.08</TD><TD>0.07</TD><TD>00424433+4116085</TD><TD>9.453</TD><TD>0.052</TD><TD>8.668</TD><TD>0.051</TD><TD>8.475</TD><TD>0.051</TD><TD>EEE</TD><TD>222</TD><TD>111</TD><TD>000</TD><TD>2</TD><TD>0</TD><TD>0.155330</TD><TD>96.656</TD><TD>0.7850</TD><TD>0.1930</TD><TD>0.9780</TD><TD>2</TD></TR>\n<TR><TD>10.682383</TD><TD>41.267925</TD><TD>00h42m43.77s</TD><TD>41d16m04.53s</TD><TD>0.10</TD><TD>0.09</TD><TD>00424377+4116045</TD><TD>12.446</TD><TD>0.061</TD><TD>11.753</TD><TD>0.063</TD><TD>9.075</TD><TD>null</TD><TD>AAU</TD><TD>220</TD><TD>110</TD><TD>cc0</TD><TD>2</TD><TD>0</TD><TD>7.398810</TD><TD>237.145</TD><TD>0.6930</TD><TD>-</TD><TD>-</TD><TD>3</TD></TR>\n<TR><TD>10.686026</TD><TD>41.269226</TD><TD>00h42m44.65s</TD><TD>41d16m09.21s</TD><TD>0.13</TD><TD>0.12</TD><TD>00424464+4116092</TD><TD>9.299</TD><TD>null</TD><TD>8.606</TD><TD>null</TD><TD>10.119</TD><TD>0.056</TD><TD>UUE</TD><TD>002</TD><TD>001</TD><TD>00c</TD><TD>2</TD><TD>0</TD><TD>3.703143</TD><TD>79.581</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>4</TD></TR>\n<TR><TD>10.685657</TD><TD>41.269550</TD><TD>00h42m44.56s</TD><TD>41d16m10.38s</TD><TD>0.13</TD><TD>0.12</TD><TD>00424455+4116103</TD><TD>10.773</TD><TD>0.069</TD><TD>8.532</TD><TD>null</TD><TD>8.254</TD><TD>null</TD><TD>EUU</TD><TD>200</TD><TD>200</TD><TD>c00</TD><TD>2</TD><TD>0</TD><TD>3.218640</TD><TD>55.219</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>5</TD></TR>\n<TR><TD>10.684029</TD><TD>41.270901</TD><TD>00h42m44.17s</TD><TD>41d16m15.24s</TD><TD>0.13</TD><TD>0.12</TD><TD>00424416+4116152</TD><TD>10.063</TD><TD>null</TD><TD>9.359</TD><TD>null</TD><TD>11.409</TD><TD>0.055</TD><TD>UUA</TD><TD>002</TD><TD>001</TD><TD>00c</TD><TD>2</TD><TD>0</TD><TD>6.927244</TD><TD>345.269</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>6</TD></TR>\n<TR><TD>10.687611</TD><TD>41.270302</TD><TD>00h42m45.03s</TD><TD>41d16m13.09s</TD><TD>0.18</TD><TD>0.14</TD><TD>00424502+4116130</TD><TD>13.055</TD><TD>0.109</TD><TD>9.504</TD><TD>null</TD><TD>9.246</TD><TD>null</TD><TD>AUU</TD><TD>200</TD><TD>200</TD><TD>c00</TD><TD>2</TD><TD>0</TD><TD>9.139894</TD><TD>60.192</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>7</TD></TR>\n<TR><TD>10.687414</TD><TD>41.267632</TD><TD>00h42m44.98s</TD><TD>41d16m03.48s</TD><TD>0.13</TD><TD>0.12</TD><TD>00424497+4116034</TD><TD>12.371</TD><TD>0.036</TD><TD>9.627</TD><TD>null</TD><TD>9.379</TD><TD>null</TD><TD>EUU</TD><TD>200</TD><TD>100</TD><TD>c00</TD><TD>2</TD><TD>0</TD><TD>8.967827</TD><TD>124.417</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>8</TD></TR>\n<TR><TD>10.684180</TD><TD>41.266941</TD><TD>00h42m44.20s</TD><TD>41d16m00.99s</TD><TD>0.13</TD><TD>0.12</TD><TD>00424420+4116009</TD><TD>10.065</TD><TD>null</TD><TD>9.374</TD><TD>null</TD><TD>11.504</TD><TD>0.052</TD><TD>UUA</TD><TD>002</TD><TD>002</TD><TD>00c</TD><TD>2</TD><TD>0</TD><TD>7.676590</TD><TD>190.151</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>9</TD></TR>\n<TR><TD>10.685270</TD><TD>41.267124</TD><TD>00h42m44.46s</TD><TD>41d16m01.65s</TD><TD>0.13</TD><TD>0.12</TD><TD>00424446+4116016</TD><TD>12.070</TD><TD>0.035</TD><TD>9.301</TD><TD>null</TD><TD>9.057</TD><TD>null</TD><TD>EUU</TD><TD>206</TD><TD>200</TD><TD>c00</TD><TD>2</TD><TD>0</TD><TD>7.079993</TD><TD>166.968</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>10</TD></TR>\n<TR><TD>10.682713</TD><TD>41.267056</TD><TD>00h42m43.85s</TD><TD>41d16m01.40s</TD><TD>0.13</TD><TD>0.12</TD><TD>00424385+4116014</TD><TD>10.176</TD><TD>null</TD><TD>11.876</TD><TD>0.050</TD><TD>9.252</TD><TD>null</TD><TD>UEU</TD><TD>020</TD><TD>010</TD><TD>0c0</TD><TD>2</TD><TD>0</TD><TD>8.907431</TD><TD>216.693</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>11</TD></TR>\n<TR><TD>10.686846</TD><TD>41.270714</TD><TD>00h42m44.84s</TD><TD>41d16m14.57s</TD><TD>0.13</TD><TD>0.11</TD><TD>00424484+4116145</TD><TD>12.872</TD><TD>0.061</TD><TD>9.433</TD><TD>null</TD><TD>9.178</TD><TD>null</TD><TD>AUU</TD><TD>200</TD><TD>200</TD><TD>c00</TD><TD>2</TD><TD>0</TD><TD>8.406324</TD><TD>44.200</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>12</TD></TR>\n<TR><TD>10.686015</TD><TD>41.269630</TD><TD>00h42m44.64s</TD><TD>41d16m10.67s</TD><TD>0.13</TD><TD>0.12</TD><TD>00424464+4116106</TD><TD>9.399</TD><TD>null</TD><TD>9.985</TD><TD>0.070</TD><TD>8.429</TD><TD>null</TD><TD>UEU</TD><TD>020</TD><TD>020</TD><TD>0c0</TD><TD>2</TD><TD>0</TD><TD>4.190485</TD><TD>59.544</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>13</TD></TR>\n<TR><TD>10.683469</TD><TD>41.268585</TD><TD>00h42m44.03s</TD><TD>41d16m06.91s</TD><TD>0.13</TD><TD>0.12</TD><TD>00424403+4116069</TD><TD>9.321</TD><TD>null</TD><TD>8.614</TD><TD>null</TD><TD>10.601</TD><TD>0.025</TD><TD>UUE</TD><TD>002</TD><TD>001</TD><TD>00c</TD><TD>2</TD><TD>0</TD><TD>3.663337</TD><TD>243.440</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>14</TD></TR>\n<TR><TD>10.683944</TD><TD>41.266682</TD><TD>00h42m44.15s</TD><TD>41d16m00.06s</TD><TD>0.13</TD><TD>0.12</TD><TD>00424414+4116000</TD><TD>12.565</TD><TD>0.055</TD><TD>9.510</TD><TD>null</TD><TD>9.274</TD><TD>null</TD><TD>AUU</TD><TD>206</TD><TD>200</TD><TD>c00</TD><TD>2</TD><TD>0</TD><TD>8.719308</TD><TD>193.203</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>15</TD></TR>\n<TR><TD>10.685837</TD><TD>41.270599</TD><TD>00h42m44.60s</TD><TD>41d16m14.16s</TD><TD>0.13</TD><TD>0.12</TD><TD>00424460+4116141</TD><TD>9.880</TD><TD>null</TD><TD>12.051</TD><TD>0.068</TD><TD>8.934</TD><TD>null</TD><TD>UAU</TD><TD>020</TD><TD>020</TD><TD>0c0</TD><TD>2</TD><TD>0</TD><TD>6.426487</TD><TD>29.152</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>16</TD></TR>\n<TR><TD>10.683465</TD><TD>41.269676</TD><TD>00h42m44.03s</TD><TD>41d16m10.83s</TD><TD>0.13</TD><TD>0.11</TD><TD>00424403+4116108</TD><TD>11.507</TD><TD>0.056</TD><TD>8.744</TD><TD>null</TD><TD>8.489</TD><TD>null</TD><TD>EUU</TD><TD>200</TD><TD>100</TD><TD>c00</TD><TD>2</TD><TD>0</TD><TD>4.006223</TD><TD>304.855</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>17</TD></TR>\n</TABLEDATA>\n</DATA>\n</TABLE>\n</RESOURCE>\n</VOTABLE>\n"},{"id":6826,"name":"gemini.xml","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<VOTABLE xmlns=\"http://www.ivoa.net/xml/VOTable/v1.2\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" version=\"1.2\">\n  <RESOURCE type=\"results\">\n    <TABLE>\n      <FIELD name=\"ID\" datatype=\"char\" ucd=\"meta.id;meta.main\" arraysize=\"*\" />\n      <FIELD name=\"access_url\" datatype=\"char\" ucd=\"meta.ref.url\" arraysize=\"*\" />\n      <FIELD name=\"service_def\" datatype=\"char\" ucd=\"meta.ref\" arraysize=\"*\" />\n      <FIELD name=\"error_message\" datatype=\"char\" ucd=\"meta.code.error\" arraysize=\"*\" />\n      <FIELD name=\"semantics\" datatype=\"char\" ucd=\"meta.code\" arraysize=\"*\" />\n      <FIELD name=\"description\" datatype=\"char\" ucd=\"meta.note\" arraysize=\"*\" />\n      <FIELD name=\"content_type\" datatype=\"char\" ucd=\"meta.code.mime\" arraysize=\"*\" />\n      <FIELD name=\"content_length\" datatype=\"long\" ucd=\"phys.size;meta.file\" unit=\"byte\" />\n      <FIELD name=\"product_type\" datatype=\"char\" utype=\"caom:Artifact.productType\" arraysize=\"*\" />\n      <FIELD name=\"file_uri\" datatype=\"char\" ID=\"fileURIRef\" arraysize=\"*\" />\n      <DATA>\n        <TABLEDATA>\n          <TR>\n            <TD>caom:GEMINI/GS-2012A-Q-5-116-003/GS-2012A-Q-5-116-003</TD>\n            <TD>http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/data/pub/GEMINI/S20120515S0064?runid=bx9b1o8cvk1qesrt</TD>\n            <TD />\n            <TD />\n            <TD>#this</TD>\n            <TD />\n            <TD>application/fits</TD>\n            <TD>7068398</TD>\n            <TD>science</TD>\n            <TD />\n          </TR>\n          <TR>\n            <TD>caom:GEMINI/GS-2012A-Q-5-116-003/GS-2012A-Q-5-116-003</TD>\n            <TD />\n            <TD>cutout</TD>\n            <TD />\n            <TD>#cutout</TD>\n            <TD />\n            <TD>application/fits</TD>\n            <TD />\n            <TD>science</TD>\n            <TD>ad:GEMINI/S20120515S0064</TD>\n          </TR>\n          <TR>\n            <TD>caom:GEMINI/GS-2012A-Q-5-116-003/GS-2012A-Q-5-116-003</TD>\n            <TD />\n            <TD>soda-62b3e0b3-2718-442f-920a-ce8028687c2b</TD>\n            <TD />\n            <TD>#cutout</TD>\n            <TD />\n            <TD>application/fits</TD>\n            <TD />\n            <TD>science</TD>\n            <TD>ad:GEMINI/S20120515S0064</TD>\n          </TR>\n          <TR>\n            <TD>caom:GEMINI/GS-2012A-Q-5-116-003/GS-2012A-Q-5-116-003</TD>\n            <TD />\n            <TD>soda-d0378127-e438-46a2-880f-42df8884a2ff</TD>\n            <TD />\n            <TD>#cutout</TD>\n            <TD />\n            <TD>application/fits</TD>\n            <TD />\n            <TD>science</TD>\n            <TD>ad:GEMINI/S20120515S0064</TD>\n          </TR>\n        </TABLEDATA>\n      </DATA>\n    </TABLE>\n    <INFO name=\"QUERY_STATUS\" value=\"OK\" />\n  </RESOURCE>\n  <RESOURCE type=\"meta\" ID=\"this\" utype=\"adhoc:service\">\n    <PARAM name=\"resourceIdentifier\" datatype=\"char\" arraysize=\"*\" value=\"ivo://cadc.nrc.ca/datalink\" />\n    <PARAM name=\"standardID\" datatype=\"char\" arraysize=\"*\" value=\"ivo://ivoa.net/std/DataLink#links-1.0\" />\n    <PARAM name=\"accessURL\" datatype=\"char\" arraysize=\"*\" value=\"http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2ops/datalink\" />\n    <GROUP name=\"inputParams\">\n      <PARAM name=\"ID\" datatype=\"char\" arraysize=\"*\" value=\"\" />\n      <PARAM name=\"RESPONSEFORMAT\" datatype=\"char\" arraysize=\"*\" value=\"application/x-votable+xml;content=datalink\">\n        <VALUES>\n          <OPTION value=\"application/x-votable+xml;content=datalink\" name=\"good\"/>\n          <OPTION value=\"application/x-download-manifest+txt\" spurious=\"bad\"/>\n        </VALUES>\n      </PARAM>\n    </GROUP>\n  </RESOURCE>\n  <RESOURCE type=\"meta\" ID=\"cutout\" utype=\"adhoc:service\">\n    <PARAM name=\"resourceIdentifier\" datatype=\"char\" arraysize=\"*\" value=\"ivo://cadc.nrc.ca/cutout\" />\n    <PARAM name=\"accessURL\" datatype=\"char\" arraysize=\"*\" value=\"http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2ops/cutout\" />\n    <GROUP name=\"inputParams\">\n      <PARAM name=\"uri\" datatype=\"char\" ref=\"fileURIRef\" arraysize=\"*\" value=\"\" />\n      <PARAM name=\"cutout\" datatype=\"char\" xtype=\"stc:AstroCoordArea\" arraysize=\"*\" value=\"\" />\n    </GROUP>\n  </RESOURCE>\n  <RESOURCE type=\"meta\" ID=\"soda-sync\" utype=\"adhoc:service\">\n    <PARAM name=\"resourceIdentifier\" datatype=\"char\" arraysize=\"*\" value=\"ivo://cadc.nrc.ca/soda#sync\" />\n    <PARAM name=\"standardID\" datatype=\"char\" arraysize=\"*\" value=\"ivo://ivoa.net/std/SODA#sync-1.0\" />\n    <PARAM name=\"accessURL\" datatype=\"char\" arraysize=\"*\" value=\"http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2ops/sync\" />\n    <GROUP name=\"inputParams\">\n      <PARAM name=\"ID\" datatype=\"char\" ref=\"fileURIRef\" arraysize=\"*\" value=\"\" />\n      <PARAM name=\"POS\" datatype=\"char\" ucd=\"obs.field\" arraysize=\"*\" value=\"\" />\n      <PARAM name=\"CIRC\" datatype=\"double\" ucd=\"obs.field\" unit=\"deg\" xtype=\"circle\" arraysize=\"3\" value=\"\" />\n      <PARAM name=\"POLY\" datatype=\"double\" ucd=\"obs.field\" unit=\"deg\" xtype=\"polygon\" arraysize=\"*\" value=\"\" />\n      <PARAM name=\"BAND\" datatype=\"double\" ucd=\"em.wl;stat.interval\" unit=\"m\" xtype=\"interval\" arraysize=\"2\" value=\"\" />\n      <PARAM name=\"TIME\" datatype=\"double\" ucd=\"time;stat.interval\" unit=\"d\" xtype=\"interval\" arraysize=\"2\" value=\"\" />\n      <PARAM name=\"POL\" datatype=\"char\" ucd=\"phys.polarization.stokes\" arraysize=\"2*\" value=\"\" />\n    </GROUP>\n  </RESOURCE>\n  <RESOURCE type=\"meta\" ID=\"soda-async\" utype=\"adhoc:service\">\n    <PARAM name=\"resourceIdentifier\" datatype=\"char\" arraysize=\"*\" value=\"ivo://cadc.nrc.ca/soda#async\" />\n    <PARAM name=\"standardID\" datatype=\"char\" arraysize=\"*\" value=\"ivo://ivoa.net/std/SODA#async-1.0\" />\n    <PARAM name=\"accessURL\" datatype=\"char\" arraysize=\"*\" value=\"http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2ops/async\" />\n    <GROUP name=\"inputParams\">\n      <PARAM name=\"ID\" datatype=\"char\" ref=\"fileURIRef\" arraysize=\"*\" value=\"\" />\n      <PARAM name=\"POS\" datatype=\"char\" ucd=\"obs.field\" arraysize=\"*\" value=\"\" />\n      <PARAM name=\"CIRC\" datatype=\"double\" ucd=\"obs.field\" unit=\"deg\" xtype=\"circle\" arraysize=\"3\" value=\"\" />\n      <PARAM name=\"POLY\" datatype=\"double\" ucd=\"obs.field\" unit=\"deg\" xtype=\"polygon\" arraysize=\"*\" value=\"\" />\n      <PARAM name=\"BAND\" datatype=\"double\" ucd=\"em.wl;stat.interval\" unit=\"m\" xtype=\"interval\" arraysize=\"2\" value=\"\" />\n      <PARAM name=\"TIME\" datatype=\"double\" ucd=\"time;stat.interval\" unit=\"d\" xtype=\"interval\" arraysize=\"2\" value=\"\" />\n      <PARAM name=\"POL\" datatype=\"char\" ucd=\"phys.polarization.stokes\" arraysize=\"2*\" value=\"\" />\n    </GROUP>\n  </RESOURCE>\n  <RESOURCE type=\"meta\" ID=\"soda-62b3e0b3-2718-442f-920a-ce8028687c2b\" utype=\"adhoc:service\">\n    <PARAM name=\"resourceIdentifier\" datatype=\"char\" arraysize=\"27\" value=\"ivo://cadc.nrc.ca/soda#sync\" />\n    <PARAM name=\"standardID\" datatype=\"char\" arraysize=\"32\" value=\"ivo://ivoa.net/std/SODA#sync-1.0\" />\n    <PARAM name=\"accessURL\" datatype=\"char\" arraysize=\"*\" value=\"http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2ops/sync\" />\n    <GROUP name=\"inputParams\">\n      <PARAM name=\"ID\" datatype=\"char\" ucd=\"\" arraysize=\"*\" value=\"ad:GEMINI/S20120515S0064\" />\n      <PARAM name=\"POS\" datatype=\"char\" ucd=\"obs.field\" arraysize=\"*\" value=\"\" />\n      <PARAM name=\"CIRC\" datatype=\"double\" ucd=\"obs.field\" unit=\"deg\" xtype=\"circle\" arraysize=\"3\" value=\"\">\n        <VALUES>\n          <MAX value=\"249.4461412814794 6.208882135413049 0.04682149110213382\" />\n        </VALUES>\n      </PARAM>\n      <PARAM name=\"POLY\" datatype=\"double\" ucd=\"obs.field\" unit=\"deg\" xtype=\"polygon\" arraysize=\"*\" value=\"\">\n        <VALUES>\n          <MAX value=\"249.39904413680034 6.208645591686135 249.39911774129286 6.209064581212914 249.49323846809307 6.209114516657962 249.49307002200794 6.208699271984017\" />\n        </VALUES>\n      </PARAM>\n      <PARAM name=\"BAND\" datatype=\"double\" ucd=\"em.wl;stat.interval\" unit=\"m\" xtype=\"interval\" arraysize=\"2\" value=\"\">\n        <VALUES>\n          <MAX value=\"4.1449399999999995E-7 7.416079999999999E-7\" />\n        </VALUES>\n      </PARAM>\n    </GROUP>\n  </RESOURCE>\n  <RESOURCE type=\"meta\" ID=\"soda-d0378127-e438-46a2-880f-42df8884a2ff\" utype=\"adhoc:service\">\n    <PARAM name=\"resourceIdentifier\" datatype=\"char\" arraysize=\"28\" value=\"ivo://cadc.nrc.ca/soda#async\" />\n    <PARAM name=\"standardID\" datatype=\"char\" arraysize=\"33\" value=\"ivo://ivoa.net/std/SODA#async-1.0\" />\n    <PARAM name=\"accessURL\" datatype=\"char\" arraysize=\"*\" value=\"http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2ops/async\" />\n    <GROUP name=\"inputParams\">\n      <PARAM name=\"ID\" datatype=\"char\" ucd=\"\" arraysize=\"*\" value=\"ad:GEMINI/S20120515S0064\" />\n      <PARAM name=\"POS\" datatype=\"char\" ucd=\"obs.field\" arraysize=\"*\" value=\"\" />\n      <PARAM name=\"CIRC\" datatype=\"double\" ucd=\"obs.field\" unit=\"deg\" xtype=\"circle\" arraysize=\"3\" value=\"\">\n        <VALUES>\n          <MAX value=\"249.4461412814794 6.208882135413049 0.04682149110213382\" />\n        </VALUES>\n      </PARAM>\n      <PARAM name=\"POLY\" datatype=\"double\" ucd=\"obs.field\" unit=\"deg\" xtype=\"polygon\" arraysize=\"*\" value=\"\">\n        <VALUES>\n          <MAX value=\"249.39904413680034 6.208645591686135 249.39911774129286 6.209064581212914 249.49323846809307 6.209114516657962 249.49307002200794 6.208699271984017\" />\n        </VALUES>\n      </PARAM>\n      <PARAM name=\"BAND\" datatype=\"double\" ucd=\"em.wl;stat.interval\" unit=\"m\" xtype=\"interval\" arraysize=\"2\" value=\"\">\n        <VALUES>\n          <MAX value=\"4.1449399999999995E-7 7.416079999999999E-7\" />\n        </VALUES>\n      </PARAM>\n    </GROUP>\n  </RESOURCE>\n</VOTABLE>\n"},{"id":6827,"name":"empty_table.xml","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<VOTABLE version=\"1.2\"\nxmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\nxsi:noNamespaceSchemaLocation=\"xmlns:http://www.ivoa.net/xml/VOTable/VOTable-1.2.xsd\"\nxmlns=\"http://www.ivoa.net/xml/VOTable/v1.2\">\n  <RESOURCE>\n    <TABLE>\n      <FIELD ID=\"unsignedByte\" name=\"unsignedByte\" datatype=\"unsignedByte\"/>\n      <FIELD ID=\"short\" name=\"short\" datatype=\"short\"/>\n    </TABLE>\n  </RESOURCE>\n</VOTABLE>\n"},{"id":6828,"name":"regression.bin.tabledata.truth.1.1.xml","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Produced with astropy.io.votable version testing\n     http://www.astropy.org/ -->\n<VOTABLE version=\"1.1\" xmlns=\"http://www.ivoa.net/xml/VOTable/v1.1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://www.ivoa.net/xml/VOTable/v1.1\">\n <DESCRIPTION>\n  The VOTable format is an XML standard for the interchange of data\n  represented as a set of tables. In this context, a table is an\n  unordered set of rows, each of a uniform format, as specified in the\n  table metadata. Each row in a table is a sequence of table cells,\n  and each of these contains either a primitive data type, or an array\n  of such primitives. VOTable is derived from the Astrores format [1],\n  itself modeled on the FITS Table format [2]; VOTable was designed to\n  be closer to the FITS Binary Table format.\n </DESCRIPTION>\n <COOSYS ID=\"J2000\" equinox=\"J2000\" system=\"eq_FK5\"/>\n <PARAM ID=\"wrong_arraysize\" arraysize=\"0\" datatype=\"float\" name=\"wrong_arraysize\" value=\"\"/>\n <PARAM ID=\"INPUT\" arraysize=\"*\" datatype=\"float\" name=\"INPUT\" ucd=\"phys.size;instr.tel\" unit=\"km.h-1\" value=\"0 0\">\n  <DESCRIPTION>\n   This is the most interesting parameter in the world, and it drinks\n   Dos Equis\n  </DESCRIPTION>\n </PARAM>\n <INFO ID=\"QUERY_STATUS\" name=\"QUERY_STATUS\" value=\"OK\">This is some information.</INFO>\n <RESOURCE type=\"results\">\n  <DESCRIPTION>\n   This is a resource description\n  </DESCRIPTION>\n  <PARAM ID=\"awesome\" arraysize=\"*\" datatype=\"float\" name=\"INPUT\" unit=\"deg\" value=\"0 0\"/>\n  <PARAM ID=\"empty_value\" arraysize=\"*\" datatype=\"char\" name=\"empty_value\" unit=\"foo\" value=\"\">\n   <VALUES>\n    <OPTION name=\"empty_value\" value=\"\"/>\n    <OPTION value=\"90prime\"/>\n   </VALUES>\n  </PARAM>\n  <LINK href=\"http://www.foo.com/\"/>\n  <TABLE ID=\"main_table\" nrows=\"5\">\n   <DESCRIPTION>\n    This describes the table.\n   </DESCRIPTION>\n   <FIELD ID=\"string_test\" arraysize=\"*\" datatype=\"char\" name=\"string test\"/>\n   <FIELD ID=\"string_test_2\" arraysize=\"10\" datatype=\"char\" name=\"fixed string test\"/>\n   <FIELD ID=\"unicode_test\" arraysize=\"*\" datatype=\"unicodeChar\" name=\"unicode_test\"/>\n   <FIELD ID=\"fixed_unicode_test\" arraysize=\"10\" datatype=\"unicodeChar\" name=\"unicode test\"/>\n   <FIELD ID=\"string_array_test\" arraysize=\"4\" datatype=\"char\" name=\"string array test\"/>\n   <FIELD ID=\"unsignedByte\" datatype=\"unsignedByte\" name=\"unsignedByte\"/>\n   <FIELD ID=\"short\" datatype=\"short\" name=\"short\">\n    <VALUES null=\"-32768\"/>\n   </FIELD>\n   <FIELD ID=\"int\" datatype=\"int\" name=\"int\" utype=\"myint\">\n    <VALUES ID=\"int_nulls\" null=\"123456789\">\n     <MIN inclusive=\"no\" value=\"-1000\"/>\n     <MAX inclusive=\"yes\" value=\"1000\"/>\n     <OPTION name=\"bogus\" value=\"whatever\"/>\n    </VALUES>\n   </FIELD>\n   <FIELD ID=\"long\" datatype=\"long\" name=\"long\">\n    <VALUES ref=\"int_nulls\"/>\n    <LINK href=\"http://www.long-integers.com/\"/>\n   </FIELD>\n   <FIELD ID=\"double\" datatype=\"double\" name=\"double\"/>\n   <FIELD ID=\"float\" datatype=\"float\" name=\"float\"/>\n   <FIELD ID=\"array\" arraysize=\"2x2*\" datatype=\"long\" name=\"array\">\n    <VALUES null=\"-1\"/>\n   </FIELD>\n   <FIELD ID=\"bit\" datatype=\"bit\" name=\"bit\"/>\n   <FIELD ID=\"bitarray\" arraysize=\"2x3\" datatype=\"bit\" name=\"bitarray\"/>\n   <FIELD ID=\"bitvararray\" arraysize=\"*\" datatype=\"bit\" name=\"bitvararray\"/>\n   <FIELD ID=\"bitvararray2\" arraysize=\"2x3x*\" datatype=\"bit\" name=\"bitvararray2\"/>\n   <FIELD ID=\"floatComplex\" datatype=\"floatComplex\" name=\"floatComplex\"/>\n   <FIELD ID=\"doubleComplex\" datatype=\"doubleComplex\" name=\"doubleComplex\"/>\n   <FIELD ID=\"doubleComplexArray\" arraysize=\"*\" datatype=\"doubleComplex\" name=\"doubleComplexArray\"/>\n   <FIELD ID=\"doubleComplexArrayFixed\" arraysize=\"2\" datatype=\"doubleComplex\" name=\"doubleComplexArrayFixed\"/>\n   <FIELD ID=\"boolean\" datatype=\"boolean\" name=\"boolean\"/>\n   <FIELD ID=\"booleanArray\" arraysize=\"4\" datatype=\"boolean\" name=\"booleanArray\"/>\n   <FIELD ID=\"nulls\" datatype=\"int\" name=\"nulls\">\n    <VALUES null=\"-9\"/>\n   </FIELD>\n   <FIELD ID=\"nulls_array\" arraysize=\"2x2\" datatype=\"int\" name=\"nulls_array\">\n    <VALUES null=\"-9\"/>\n   </FIELD>\n   <FIELD ID=\"precision1\" datatype=\"double\" name=\"precision1\" precision=\"E3\" width=\"10\"/>\n   <FIELD ID=\"precision2\" datatype=\"double\" name=\"precision2\" precision=\"F3\"/>\n   <FIELD ID=\"doublearray\" arraysize=\"*\" datatype=\"double\" name=\"doublearray\">\n    <VALUES null=\"-1.0\"/>\n   </FIELD>\n   <FIELD ID=\"bitarray2\" arraysize=\"16\" datatype=\"bit\" name=\"bitarray2\"/>\n   <PARAM ID=\"INPUT2\" arraysize=\"*\" datatype=\"float\" name=\"INPUT2\" unit=\"deg\" value=\"0 0\">\n    <DESCRIPTION>\n     This is the most interesting parameter in the world, and it\n     drinks Dos Equis\n    </DESCRIPTION>\n   </PARAM>\n   <GROUP>\n    <PARAMref ref=\"awesome\"/>\n   </GROUP>\n   <GROUP>\n    <DESCRIPTION>\n     This should warn of a second description.\n    </DESCRIPTION>\n    <FIELDref ref=\"boolean\"/>\n    <GROUP>\n     <PARAMref ref=\"awesome\"/>\n     <PARAM ID=\"OUTPUT\" datatype=\"float\" name=\"OUTPUT\" value=\"42\"/>\n    </GROUP>\n    <PARAM ID=\"INPUT3\" arraysize=\"*\" datatype=\"float\" name=\"INPUT3\" unit=\"deg\" value=\"0 0\">\n     <DESCRIPTION>\n      This is the most interesting parameter in the world, and it\n      drinks Dos Equis\n     </DESCRIPTION>\n    </PARAM>\n   </GROUP>\n   <LINK href=\"http://tabledata.org/\"/>\n   <DATA>\n    <TABLEDATA>\n     <TR>\n      <TD>String &amp; test</TD>\n      <TD>Fixed stri</TD>\n      <TD>Ceçi n'est pas un pipe</TD>\n      <TD>Ceçi n'est</TD>\n      <TD>ab c</TD>\n      <TD>128</TD>\n      <TD>4096</TD>\n      <TD>268435456</TD>\n      <TD>922337203685477</TD>\n      <TD>8.9990234375</TD>\n      <TD>1</TD>\n      <TD/>\n      <TD>1</TD>\n      <TD>101101</TD>\n      <TD>1 1 1</TD>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD>0 0 0 0</TD>\n      <TD>T</TD>\n      <TD>T T T T</TD>\n      <TD>0</TD>\n      <TD>-9 -9 -9 -9</TD>\n      <TD>      1.33</TD>\n      <TD>1.333</TD>\n      <TD/>\n      <TD>1111000011110000</TD>\n     </TR>\n     <TR>\n      <TD>String &amp;amp; test</TD>\n      <TD>0123456789</TD>\n      <TD>வணக்கம்</TD>\n      <TD>வணக்கம்</TD>\n      <TD>0123</TD>\n      <TD>255</TD>\n      <TD>32767</TD>\n      <TD>2147483647</TD>\n      <TD>123456789</TD>\n      <TD>0</TD>\n      <TD>0</TD>\n      <TD>42 32 12 32</TD>\n      <TD>0</TD>\n      <TD>010011</TD>\n      <TD>0 0 0 0 0</TD>\n      <TD>0 1 0 0 1 0 1 0 1 0 1 0</TD>\n      <TD>0 0</TD>\n      <TD>0 0</TD>\n      <TD>0 0 0 0</TD>\n      <TD>0 -1 -1 -1</TD>\n      <TD>F</TD>\n      <TD>T T F T</TD>\n      <TD>-9</TD>\n      <TD>0 1 2 3</TD>\n      <TD>         1</TD>\n      <TD>1.000</TD>\n      <TD>0 1 +InF -InF NaN 0 -1</TD>\n      <TD>0000000000000000</TD>\n     </TR>\n     <TR>\n      <TD>XXXX</TD>\n      <TD>XXXX</TD>\n      <TD>XXXX</TD>\n      <TD>0123456789</TD>\n      <TD/>\n      <TD>0</TD>\n      <TD>-4096</TD>\n      <TD>-268435456</TD>\n      <TD>-1152921504606846976</TD>\n      <TD>+InF</TD>\n      <TD>+InF</TD>\n      <TD>12 34 56 78 87 65 43 21</TD>\n      <TD>1</TD>\n      <TD>111000</TD>\n      <TD>1 0 1 0 1</TD>\n      <TD>1 1 1 1 1 1</TD>\n      <TD>0 -1</TD>\n      <TD>0 -1</TD>\n      <TD>0 0 0 0</TD>\n      <TD>0 0 0 0</TD>\n      <TD>T</TD>\n      <TD>T T ? T</TD>\n      <TD>2</TD>\n      <TD>-9 0 -9 1</TD>\n      <TD>     1e+34</TD>\n      <TD>9999999999999999455752309870428160.000</TD>\n      <TD/>\n      <TD>0000000000000000</TD>\n     </TR>\n     <TR>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD>255</TD>\n      <TD>32767</TD>\n      <TD>268435455</TD>\n      <TD>1152921504606846975</TD>\n      <TD/>\n      <TD>+InF</TD>\n      <TD>-1 23</TD>\n      <TD>0</TD>\n      <TD>000000</TD>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD>0 0 0 0</TD>\n      <TD>F</TD>\n      <TD>? ? ? ?</TD>\n      <TD>-9</TD>\n      <TD>0 -9 1 -9</TD>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD>0000000000000000</TD>\n     </TR>\n     <TR>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD>255</TD>\n      <TD>32767</TD>\n      <TD>123456789</TD>\n      <TD>123456789</TD>\n      <TD>-InF</TD>\n      <TD/>\n      <TD>31 -1</TD>\n      <TD>0</TD>\n      <TD>000000</TD>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD>0 0 0 0</TD>\n      <TD>?</TD>\n      <TD>? ? ? ?</TD>\n      <TD>-9</TD>\n      <TD>-9 -9 -9 -9</TD>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD>0000000000000000</TD>\n     </TR>\n    </TABLEDATA>\n   </DATA>\n  </TABLE>\n  <RESOURCE type=\"results\">\n   <TABLE nrows=\"1\" ref=\"main_table\">\n    <DESCRIPTION>\n     This is a referenced table\n    </DESCRIPTION>\n    <DATA>\n     <TABLEDATA>\n      <TR>\n       <TD>String &amp; test</TD>\n       <TD>Fixed stri</TD>\n       <TD>Ceçi n'est pas un pipe</TD>\n       <TD>Ceçi n'est</TD>\n       <TD>ab c</TD>\n       <TD>128</TD>\n       <TD>4096</TD>\n       <TD>268435456</TD>\n       <TD>922337203685477</TD>\n       <TD>8.9990234375</TD>\n       <TD>1</TD>\n       <TD/>\n       <TD>1</TD>\n       <TD>101101</TD>\n       <TD>1 1 1</TD>\n       <TD/>\n       <TD/>\n       <TD/>\n       <TD/>\n       <TD>0 0 0 0</TD>\n       <TD>T</TD>\n       <TD>T T T T</TD>\n       <TD>0</TD>\n       <TD>-9 -9 -9 -9</TD>\n       <TD>      1.33</TD>\n       <TD>1.333</TD>\n       <TD/>\n       <TD>1111000011110000</TD>\n      </TR>\n     </TABLEDATA>\n    </DATA>\n   </TABLE>\n   <TABLE ID=\"last_table\" nrows=\"0\" ref=\"main_table\"/>\n  </RESOURCE>\n </RESOURCE>\n</VOTABLE>\n"},{"id":6829,"name":"binary2_masked_strings.xml","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<VOTABLE version=\"1.3\" xmlns=\"http://www.ivoa.net/xml/VOTable/v1.3\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.ivoa.net/xml/VOTable/v1.3 http://www.ivoa.net/xml/VOTable/v1.3\">\n<RESOURCE type=\"results\">\n<INFO name=\"QUERY_STATUS\" value=\"OK\"/>\n<INFO name=\"QUERY\" value=\"\"><![CDATA[\n    select top 3 source_id, ra, dec, a_g_val, datalink_url, epoch_photometry_url\n    from gaiadr2.gaia_source;\n    ]]></INFO>\n<INFO name=\"CAPTION\" value=\"\"><![CDATA[How to cite and acknowledge Gaia: http://gea.esac.esa.int/archive/documentation/credits.html]]></INFO>\n<INFO name=\"PAGE\" value=\"\"></INFO>\n<INFO name=\"PAGE_SIZE\" value=\"\"></INFO>\n<INFO name=\"JOBID\" value=\"1564151313219O\"><![CDATA[1564151313219O]]></INFO>\n<INFO name=\"JOBNAME\" value=\"\"></INFO>\n<COOSYS ID=\"GAIADR2\" epoch=\"J2015.5\" system=\"ICRS\" />\n\n<TABLE>\n<FIELD datatype=\"long\" name=\"source_id\" ucd=\"meta.id\">\n<DESCRIPTION>Unique source identifier (unique within a particular Data Release)</DESCRIPTION>\n</FIELD>\n<FIELD datatype=\"double\" name=\"ra\" ref=\"GAIADR2\" ucd=\"pos.eq.ra;meta.main\" unit=\"deg\" utype=\"Char.SpatialAxis.Coverage.Location.Coord.Position2D.Value2.C1\">\n<DESCRIPTION>Right ascension</DESCRIPTION>\n</FIELD>\n<FIELD datatype=\"double\" name=\"dec\" ref=\"GAIADR2\" ucd=\"pos.eq.dec;meta.main\" unit=\"deg\" utype=\"Char.SpatialAxis.Coverage.Location.Coord.Position2D.Value2.C2\">\n<DESCRIPTION>Declination</DESCRIPTION>\n</FIELD>\n<FIELD datatype=\"float\" name=\"a_g_val\" ucd=\"phys.absorption.gal\" unit=\"mag\">\n<DESCRIPTION>line-of-sight extinction in the G band, A_G)</DESCRIPTION>\n</FIELD>\n<FIELD arraysize=\"*\" datatype=\"char\" name=\"datalink_url\" ucd=\"meta.ref.url\" utype=\"Acess.reference\">\n<DESCRIPTION>datalink url</DESCRIPTION>\n</FIELD>\n<FIELD arraysize=\"*\" datatype=\"char\" name=\"epoch_photometry_url\" ucd=\"meta.ref.url\" utype=\"Acess.reference\">\n<DESCRIPTION>epoch photometry url</DESCRIPTION>\n</FIELD>\n<DATA>\n<BINARY2>\n<STREAM encoding='base64'>\nFFLLmBAAGRWAQHAVRQ+m94jARLCaKTcsmH/AAAAAAABNaHR0cDovL2dlYWRhdGEu\nZXNhYy5lc2EuaW50L2RhdGEtc2VydmVyL2RhdGFsaW5rL2xpbmtzP0lEPTU5NjYw\nMjkzMjU4NzA4OTY1MTIAAAAAFFLLkKkAGZWAQHAT1HglkUvARMFn9Z1IbH/AAAAA\nAABNaHR0cDovL2dlYWRhdGEuZXNhYy5lc2EuaW50L2RhdGEtc2VydmVyL2RhdGFs\naW5rL2xpbmtzP0lEPTU5NjYwMjExODY5MDc5MDMzNjAAAAAAFFLLjfkAPRcAQHAW\n5p3URUPARKpfojAl2n/AAAAAAABNaHR0cDovL2dlYWRhdGEuZXNhYy5lc2EuaW50\nL2RhdGEtc2VydmVyL2RhdGFsaW5rL2xpbmtzP0lEPTU5NjYwMTgyMzE5NzI3MzA2\nMjQAAAAA\n</STREAM>\n</BINARY2>\n</DATA>\n</TABLE>\n</RESOURCE>\n</VOTABLE>\n"},{"col":0,"comment":"\n    test_path_object is needed for test below ``test_validate_path_object``\n    so that file could be passed as pathlib.Path object.\n    ","endLoc":801,"header":"def test_validate(test_path_object=False)","id":6830,"name":"test_validate","nodeType":"Function","startLoc":767,"text":"def test_validate(test_path_object=False):\n    \"\"\"\n    test_path_object is needed for test below ``test_validate_path_object``\n    so that file could be passed as pathlib.Path object.\n    \"\"\"\n    output = io.StringIO()\n    fpath = get_pkg_data_filename('data/regression.xml')\n    if test_path_object:\n        fpath = pathlib.Path(fpath)\n\n    # We can't test xmllint, because we can't rely on it being on the\n    # user's machine.\n    result = validate(fpath, output, xmllint=False)\n\n    assert result is False\n\n    output.seek(0)\n    output = output.readlines()\n\n    # Uncomment to generate new groundtruth\n    # with open('validation.txt', 'wt', encoding='utf-8') as fd:\n    #    fd.write(u''.join(output))\n\n    with open(\n        get_pkg_data_filename('data/validation.txt'),\n            'rt', encoding='utf-8') as fd:\n        truth = fd.readlines()\n\n    truth = truth[1:]\n    output = output[1:-1]\n\n    sys.stdout.writelines(\n        difflib.unified_diff(truth, output, fromfile='truth', tofile='output'))\n\n    assert truth == output"},{"id":6831,"name":"no_resource.txt","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"Validation report for no_resource.xml\n\n5: W53: VOTABLE element must contain at least one RESOURCE element.\nxmlns=\"http://www.ivoa.net/xml/VOTable/v1.2\">\n                                             ^\n"},{"id":6832,"name":"timesys.xml","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<VOTABLE version=\"1.4\" xmlns=\"http://www.ivoa.net/xml/VOTable/v1.3\">\n  <RESOURCE>\n    <COOSYS ID=\"system\" epoch=\"J2015.5\" system=\"ICRS\"/>\n    <TIMESYS ID=\"time_frame\" refposition=\"BARYCENTER\" timeorigin=\"2455197.5\" timescale=\"TCB\"/>\n    <TIMESYS ID=\"mjd_origin\" refposition=\"EMBARYCENTER\" timeorigin=\"MJD-origin\" timescale=\"TDB\"/>\n    <TIMESYS ID=\"jd_origin\" refposition=\"HELIOCENTER\" timeorigin=\"JD-origin\" timescale=\"TT\"/>\n    <TIMESYS ID=\"no_origin\" refposition=\"TOPOCENTER\" timescale=\"UTC\"/>\n    <TABLE name=\"ts_data\">\n      <FIELD datatype=\"double\" name=\"obs_time\" ucd=\"time.epoch\" unit=\"d\" ref=\"time_frame\"/>\n      <FIELD datatype=\"float\" name=\"flux\" ucd=\"phot.flux;em.opt.V\" unit=\"s**-1\"/>\n      <FIELD datatype=\"float\" name=\"mag\" ucd=\"phot.mag;em.opt.V\" unit=\"mag\"/>\n      <FIELD datatype=\"float\" name=\"flux_error\" ucd=\"stat.error;phot.flux;em.opt.V\" \n        unit=\"s**-1\"/>\n      <PARAM datatype=\"double\" name=\"ra\" ucd=\"pos.eq.ra\" value=\"45.7164887146879\" ref=\"system\"/>\n      <PARAM datatype=\"double\" name=\"dec\" ucd=\"pos.eq.dec\" value=\"1.18583048057467\" ref=\"system\"/>\n      <DATA>\n        <TABLEDATA>\n          <TR>\n            <TD>1821.2846388435</TD>\n            <TD>168.358</TD>\n            <TD>20.12281560517953</TD>\n            <TD>8.71437</TD>\n          </TR>\n        </TABLEDATA>\n      </DATA>\n    </TABLE>\n  </RESOURCE>\n</VOTABLE>\n"},{"col":4,"comment":"null","endLoc":2927,"header":"def _write_tabledata(self, w, **kwargs)","id":6833,"name":"_write_tabledata","nodeType":"Function","startLoc":2880,"text":"def _write_tabledata(self, w, **kwargs):\n        fields = self.fields\n        array = self.array\n\n        with w.tag('TABLEDATA'):\n            w._flush()\n            if (_has_c_tabledata_writer and\n                not kwargs.get('_debug_python_based_parser')):\n                supports_empty_values = [\n                    field.converter.supports_empty_values(kwargs)\n                    for field in fields]\n                fields = [field.converter.output for field in fields]\n                indent = len(w._tags) - 1\n                tablewriter.write_tabledata(\n                    w.write, array.data, array.mask, fields,\n                    supports_empty_values, indent, 1 << 8)\n            else:\n                write = w.write\n                indent_spaces = w.get_indentation_spaces()\n                tr_start = indent_spaces + \"<TR>\\n\"\n                tr_end = indent_spaces + \"</TR>\\n\"\n                td = indent_spaces + \" <TD>{}</TD>\\n\"\n                td_empty = indent_spaces + \" <TD/>\\n\"\n                fields = [(i, field.converter.output,\n                           field.converter.supports_empty_values(kwargs))\n                          for i, field in enumerate(fields)]\n                for row in range(len(array)):\n                    write(tr_start)\n                    array_row = array.data[row]\n                    mask_row = array.mask[row]\n                    for i, output, supports_empty_values in fields:\n                        data = array_row[i]\n                        masked = mask_row[i]\n                        if supports_empty_values and np.all(masked):\n                            write(td_empty)\n                        else:\n                            try:\n                                val = output(data, masked)\n                            except Exception as e:\n                                vo_reraise(\n                                    e,\n                                    additional=\"(in row {:d}, col '{}')\".format(\n                                        row, self.fields[i].ID))\n                            if len(val):\n                                write(td.format(val))\n                            else:\n                                write(td_empty)\n                    write(tr_end)"},{"id":6834,"name":"names.xml","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Produced with astropy.io.votable version 0.2.dev2731\n     http://www.astropy.org/ -->\n<VOTABLE version=\"1.1\" xmlns=\"http://www.ivoa.net/xml/VOTable/v1.1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://www.ivoa.net/xml/VOTable/v1.1\">\n <DESCRIPTION>\n  VOTable generated from the original AAS Journal Machine Readable\n  Table\n </DESCRIPTION>\n <COOSYS ID=\"J2000\" epoch=\"J2000.\" equinox=\"J2000.\" system=\"eq_FK5\"/>\n <RESOURCE ID=\"aj285677t2_votable\" type=\"results\">\n  <DESCRIPTION>\n   Intrinsically Red Sources observed by Spitzer in the Galactic Mid-\n   Plane  (Robitaille T.P. et al.)\n  </DESCRIPTION>\n  <LINK href=\"https://doi.org/10.1088/0004-6256/136/6/2413\"/>\n  <TABLE nrows=\"18949\">\n   <DESCRIPTION>\n    Final red source catalog\n   </DESCRIPTION>\n   <FIELD ID=\"col1\" arraysize=\"25\" datatype=\"char\" name=\"Name\" ucd=\"meta.id;meta.main\" unit=\"---\">\n    <DESCRIPTION>\n     GLIMPSE source name\n    </DESCRIPTION>\n   </FIELD>\n   <FIELD ID=\"col2\" datatype=\"float\" name=\"GLON\" precision=\"4\" ucd=\"pos.galactic.lon\" unit=\"deg\" width=\"8\">\n    <DESCRIPTION>\n     Galactic longtitude (1) These coordinates are set to the average\n     position of the source at            4.5 and at 8.0 microns. This\n     position may differ slightly from the            `official'\n     GLIMPSE position in cases where PSF fitting was used to\n     determine the flux of the source if the position of the source\n     was            adjusted to obtain a better residual.\n    </DESCRIPTION>\n   </FIELD>\n   <FIELD ID=\"col3\" datatype=\"float\" name=\"GLAT\" precision=\"4\" ucd=\"pos.galactic.lat\" unit=\"deg\" width=\"7\">\n    <DESCRIPTION>\n     Galactic latitude (1) These coordinates are set to the average\n     position of the source at            4.5 and at 8.0 microns. This\n     position may differ slightly from the            `official'\n     GLIMPSE position in cases where PSF fitting was used to\n     determine the flux of the source if the position of the source\n     was            adjusted to obtain a better residual.\n    </DESCRIPTION>\n   </FIELD>\n   <FIELD ID=\"col4\" datatype=\"float\" name=\"RAdeg\" precision=\"4\" ucd=\"pos.eq.ra\" unit=\"deg\" width=\"8\">\n    <DESCRIPTION>\n     Right Ascension in decimal degrees (J2000) (1) These coordinates\n     are set to the average position of the source at            4.5\n     and at 8.0 microns. This position may differ slightly from the\n     `official' GLIMPSE position in cases where PSF fitting was used\n     to            determine the flux of the source if the position of\n     the source was            adjusted to obtain a better residual.\n    </DESCRIPTION>\n   </FIELD>\n   <FIELD ID=\"col5\" datatype=\"float\" name=\"DEdeg\" precision=\"4\" ucd=\"pos.eq.dec\" unit=\"deg\" width=\"8\">\n    <DESCRIPTION>\n     Declination in decimal degrees (J2000) (1) These coordinates are\n     set to the average position of the source at            4.5 and\n     at 8.0 microns. This position may differ slightly from the\n     `official' GLIMPSE position in cases where PSF fitting was used\n     to            determine the flux of the source if the position of\n     the source was            adjusted to obtain a better residual.\n    </DESCRIPTION>\n   </FIELD>\n   <FIELD ID=\"col6\" datatype=\"float\" name=\"Jmag\" precision=\"2\" ucd=\"phot.mag;em.IR.J\" unit=\"mag\" width=\"5\">\n    <DESCRIPTION>\n     ? 2MASS J band magnitude (2) The zero-magnitude fluxes assumed\n     throughout this paper are:            F_{nu}_(J) = 1594 Jy,\n     F_{nu}_(H) = 1024 Jy, F_{nu}_(K_s_) = 666.7 Jy,\n     F_{nu}_(3.6 microns) = 280.9 Jy, F_{nu}_(4.5 microns) = 179.7 Jy,\n     F_{nu}_(5.8 microns) = 115.0 Jy, F_{nu}_(8.0 microns) = 64.13 Jy,\n     F_{nu}_(MSX E) = 8.75 Jy, F_{nu}_(24.0 micron) = 7.14 Jy.\n    </DESCRIPTION>\n   </FIELD>\n   <FIELD ID=\"col7\" datatype=\"float\" name=\"Hmag\" precision=\"2\" ucd=\"phot.mag;em.IR.H\" unit=\"mag\" width=\"5\">\n    <DESCRIPTION>\n     ? 2MASS H band magnitude (2) The zero-magnitude fluxes assumed\n     throughout this paper are:            F_{nu}_(J) = 1594 Jy,\n     F_{nu}_(H) = 1024 Jy, F_{nu}_(K_s_) = 666.7 Jy,\n     F_{nu}_(3.6 microns) = 280.9 Jy, F_{nu}_(4.5 microns) = 179.7 Jy,\n     F_{nu}_(5.8 microns) = 115.0 Jy, F_{nu}_(8.0 microns) = 64.13 Jy,\n     F_{nu}_(MSX E) = 8.75 Jy, F_{nu}_(24.0 micron) = 7.14 Jy.\n    </DESCRIPTION>\n   </FIELD>\n   <FIELD ID=\"col8\" datatype=\"float\" name=\"Kmag\" precision=\"2\" ucd=\"phot.mag;em.IR.K\" unit=\"mag\" width=\"5\">\n    <DESCRIPTION>\n     ? 2MASS K_s_ band magnitude (2) The zero-magnitude fluxes assumed\n     throughout this paper are:            F_{nu}_(J) = 1594 Jy,\n     F_{nu}_(H) = 1024 Jy, F_{nu}_(K_s_) = 666.7 Jy,\n     F_{nu}_(3.6 microns) = 280.9 Jy, F_{nu}_(4.5 microns) = 179.7 Jy,\n     F_{nu}_(5.8 microns) = 115.0 Jy, F_{nu}_(8.0 microns) = 64.13 Jy,\n     F_{nu}_(MSX E) = 8.75 Jy, F_{nu}_(24.0 micron) = 7.14 Jy.\n    </DESCRIPTION>\n   </FIELD>\n   <FIELD ID=\"col9\" datatype=\"float\" name=\"G3.6mag\" precision=\"2\" ucd=\"phot.mag;em.IR.3-4um\" unit=\"mag\" width=\"5\">\n    <DESCRIPTION>\n     ? GLIMPSE catalog 3.6 micron band magnitude (2) The zero-\n     magnitude fluxes assumed throughout this paper are:\n     F_{nu}_(J) = 1594 Jy, F_{nu}_(H) = 1024 Jy, F_{nu}_(K_s_) = 666.7\n     Jy,           F_{nu}_(3.6 microns) = 280.9 Jy, F_{nu}_(4.5\n     microns) = 179.7 Jy,            F_{nu}_(5.8 microns) = 115.0 Jy,\n     F_{nu}_(8.0 microns) = 64.13 Jy,            F_{nu}_(MSX E) = 8.75\n     Jy, F_{nu}_(24.0 micron) = 7.14 Jy.\n    </DESCRIPTION>\n   </FIELD>\n   <FIELD ID=\"col10\" datatype=\"float\" name=\"G4.5mag\" precision=\"2\" ucd=\"phot.mag;em.IR.4-8um\" unit=\"mag\" width=\"5\">\n    <DESCRIPTION>\n     GLIMPSE catalog 4.5 micron band magnitude (2) The zero-magnitude\n     fluxes assumed throughout this paper are:            F_{nu}_(J) =\n     1594 Jy, F_{nu}_(H) = 1024 Jy, F_{nu}_(K_s_) = 666.7 Jy,\n     F_{nu}_(3.6 microns) = 280.9 Jy, F_{nu}_(4.5 microns) = 179.7 Jy,\n     F_{nu}_(5.8 microns) = 115.0 Jy, F_{nu}_(8.0 microns) = 64.13 Jy,\n     F_{nu}_(MSX E) = 8.75 Jy, F_{nu}_(24.0 micron) = 7.14 Jy.\n    </DESCRIPTION>\n   </FIELD>\n   <FIELD ID=\"col11\" datatype=\"float\" name=\"G5.8mag\" precision=\"2\" ucd=\"phot.mag;em.IR.4-8um\" unit=\"mag\" width=\"5\">\n    <DESCRIPTION>\n     ? GLIMPSE catalog 5.8 micron band magnitude (2) The zero-\n     magnitude fluxes assumed throughout this paper are:\n     F_{nu}_(J) = 1594 Jy, F_{nu}_(H) = 1024 Jy, F_{nu}_(K_s_) = 666.7\n     Jy,           F_{nu}_(3.6 microns) = 280.9 Jy, F_{nu}_(4.5\n     microns) = 179.7 Jy,            F_{nu}_(5.8 microns) = 115.0 Jy,\n     F_{nu}_(8.0 microns) = 64.13 Jy,            F_{nu}_(MSX E) = 8.75\n     Jy, F_{nu}_(24.0 micron) = 7.14 Jy.\n    </DESCRIPTION>\n   </FIELD>\n   <FIELD ID=\"col12\" datatype=\"float\" name=\"G8.0mag\" precision=\"2\" ucd=\"phot.mag;em.IR.4-8um\" unit=\"mag\" width=\"4\">\n    <DESCRIPTION>\n     GLIMPSE catalog 8.0 micron band magnitude (2) The zero-magnitude\n     fluxes assumed throughout this paper are:            F_{nu}_(J) =\n     1594 Jy, F_{nu}_(H) = 1024 Jy, F_{nu}_(K_s_) = 666.7 Jy,\n     F_{nu}_(3.6 microns) = 280.9 Jy, F_{nu}_(4.5 microns) = 179.7 Jy,\n     F_{nu}_(5.8 microns) = 115.0 Jy, F_{nu}_(8.0 microns) = 64.13 Jy,\n     F_{nu}_(MSX E) = 8.75 Jy, F_{nu}_(24.0 micron) = 7.14 Jy.\n    </DESCRIPTION>\n   </FIELD>\n   <FIELD ID=\"col13\" datatype=\"float\" name=\"4.5mag\" precision=\"2\" ucd=\"phot.mag;em.IR.4-8um\" unit=\"mag\" width=\"5\">\n    <DESCRIPTION>\n     This paper's 4.5 micron band magnitude (2) The zero-magnitude\n     fluxes assumed throughout this paper are:            F_{nu}_(J) =\n     1594 Jy, F_{nu}_(H) = 1024 Jy, F_{nu}_(K_s_) = 666.7 Jy,\n     F_{nu}_(3.6 microns) = 280.9 Jy, F_{nu}_(4.5 microns) = 179.7 Jy,\n     F_{nu}_(5.8 microns) = 115.0 Jy, F_{nu}_(8.0 microns) = 64.13 Jy,\n     F_{nu}_(MSX E) = 8.75 Jy, F_{nu}_(24.0 micron) = 7.14 Jy.\n    </DESCRIPTION>\n   </FIELD>\n   <FIELD ID=\"col14\" datatype=\"float\" name=\"8.0mag\" precision=\"2\" ucd=\"phot.mag;em.IR.4-8um\" unit=\"mag\" width=\"4\">\n    <DESCRIPTION>\n     This paper's 8.0 micron band magnitude (2) The zero-magnitude\n     fluxes assumed throughout this paper are:            F_{nu}_(J) =\n     1594 Jy, F_{nu}_(H) = 1024 Jy, F_{nu}_(K_s_) = 666.7 Jy,\n     F_{nu}_(3.6 microns) = 280.9 Jy, F_{nu}_(4.5 microns) = 179.7 Jy,\n     F_{nu}_(5.8 microns) = 115.0 Jy, F_{nu}_(8.0 microns) = 64.13 Jy,\n     F_{nu}_(MSX E) = 8.75 Jy, F_{nu}_(24.0 micron) = 7.14 Jy.\n    </DESCRIPTION>\n   </FIELD>\n   <FIELD ID=\"col15\" datatype=\"float\" name=\"Emag\" precision=\"2\" ucd=\"phot.mag;em.IR.8-15um\" unit=\"mag\" width=\"5\">\n    <DESCRIPTION>\n     ? This paper's MSX E band magnitude (2) The zero-magnitude fluxes\n     assumed throughout this paper are:            F_{nu}_(J) = 1594\n     Jy, F_{nu}_(H) = 1024 Jy, F_{nu}_(K_s_) = 666.7 Jy,\n     F_{nu}_(3.6 microns) = 280.9 Jy, F_{nu}_(4.5 microns) = 179.7 Jy,\n     F_{nu}_(5.8 microns) = 115.0 Jy, F_{nu}_(8.0 microns) = 64.13 Jy,\n     F_{nu}_(MSX E) = 8.75 Jy, F_{nu}_(24.0 micron) = 7.14 Jy.\n    </DESCRIPTION>\n   </FIELD>\n   <FIELD ID=\"col16\" datatype=\"float\" name=\"24mag\" precision=\"2\" ucd=\"phot.mag;em.IR.15-30um\" unit=\"mag\" width=\"4\">\n    <DESCRIPTION>\n     ? This paper's 24 micron band magnitude (2) The zero-magnitude\n     fluxes assumed throughout this paper are:            F_{nu}_(J) =\n     1594 Jy, F_{nu}_(H) = 1024 Jy, F_{nu}_(K_s_) = 666.7 Jy,\n     F_{nu}_(3.6 microns) = 280.9 Jy, F_{nu}_(4.5 microns) = 179.7 Jy,\n     F_{nu}_(5.8 microns) = 115.0 Jy, F_{nu}_(8.0 microns) = 64.13 Jy,\n     F_{nu}_(MSX E) = 8.75 Jy, F_{nu}_(24.0 micron) = 7.14 Jy.\n    </DESCRIPTION>\n   </FIELD>\n   <FIELD ID=\"col17\" arraysize=\"2\" datatype=\"char\" name=\"f_Name\" ucd=\"meta.code\" unit=\"---\">\n    <DESCRIPTION>\n     Flag on Name (3)  This column lists two characters, which are\n     flags for 4.5 and            8.0 microns respectively.      A =\n     GLIMPSE Catalog magnitudes are in agreement with the independent\n     magnitudes calculated in this paper;     I = the independent\n     magnitudes calculated in this paper should be trusted\n     over the GLIMPSE Catalog magnitudes.\n    </DESCRIPTION>\n   </FIELD>\n   <DATA>\n    <TABLEDATA>\n     <TR>\n      <TD>SSTGLMC G000.0000+00.1611</TD>\n      <TD>  0.0000</TD>\n      <TD> 0.1611</TD>\n      <TD>266.2480</TD>\n      <TD>-28.8521</TD>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD> 9.78</TD>\n      <TD> 9.19</TD>\n      <TD> 8.64</TD>\n      <TD>8.05</TD>\n      <TD> 9.13</TD>\n      <TD>8.17</TD>\n      <TD/>\n      <TD/>\n      <TD>AA</TD>\n     </TR>\n    </TABLEDATA>\n   </DATA>\n  </TABLE>\n </RESOURCE>\n</VOTABLE>\n"},{"col":4,"comment":"null","endLoc":3258,"header":"def _add_coosys(self, iterator, tag, data, config, pos)","id":6835,"name":"_add_coosys","nodeType":"Function","startLoc":3255,"text":"def _add_coosys(self, iterator, tag, data, config, pos):\n        coosys = CooSys(config=config, pos=pos, **data)\n        self.coordinate_systems.append(coosys)\n        coosys.parse(iterator, config)"},{"id":6836,"name":"nonstandard_units.xml","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<VOTABLE version=\"1.1\"\nxmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\nxsi:noNamespaceSchemaLocation=\"xmlns:http://www.ivoa.net/xml/VOTable/VOTable-1.1.xsd\"\nxmlns:spec=\"http://www.ivoa.net/xml/SpectrumModel/v1.01\"\nxmlns=\"http://www.ivoa.net/xml/VOTable/v1.1\">\n<RESOURCE utype=\"spec:Spectrum\">\n<TABLE utype=\"spec:Spectrum\">\n<FIELD name=\"Flux\" ID=\"Flux1\" utype=\"spec:Data.FluxAxis.value\" ucd=\"phot.flux.density;em.wl\"\ndatatype=\"double\" unit=\"erg cm**(-2) s**(-1) angstrom**(-1)\"/>\n</TABLE>\n</RESOURCE>\n</VOTABLE>\n"},{"id":6837,"name":"regression.bin.tabledata.truth.1.3.xml","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Produced with astropy.io.votable version testing\n     http://www.astropy.org/ -->\n<VOTABLE version=\"1.3\" xmlns=\"http://www.ivoa.net/xml/VOTable/v1.3\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.ivoa.net/xml/VOTable/v1.3 http://www.ivoa.net/xml/VOTable/VOTable-1.3.xsd\">\n <DESCRIPTION>\n  The VOTable format is an XML standard for the interchange of data\n  represented as a set of tables. In this context, a table is an\n  unordered set of rows, each of a uniform format, as specified in the\n  table metadata. Each row in a table is a sequence of table cells,\n  and each of these contains either a primitive data type, or an array\n  of such primitives. VOTable is derived from the Astrores format [1],\n  itself modeled on the FITS Table format [2]; VOTable was designed to\n  be closer to the FITS Binary Table format.\n </DESCRIPTION>\n <PARAM ID=\"wrong_arraysize\" arraysize=\"0\" datatype=\"float\" name=\"wrong_arraysize\" value=\"\"/>\n <PARAM ID=\"INPUT\" arraysize=\"*\" datatype=\"float\" name=\"INPUT\" ucd=\"phys.size;instr.tel\" unit=\"km.h-1\" value=\"0 0\">\n  <DESCRIPTION>\n   This is the most interesting parameter in the world, and it drinks\n   Dos Equis\n  </DESCRIPTION>\n </PARAM>\n <INFO ID=\"QUERY_STATUS\" name=\"QUERY_STATUS\" value=\"OK\">This is some information.</INFO>\n <RESOURCE type=\"results\">\n  <DESCRIPTION>\n   This is a resource description\n  </DESCRIPTION>\n  <PARAM ID=\"awesome\" arraysize=\"*\" datatype=\"float\" name=\"INPUT\" unit=\"deg\" value=\"0 0\"/>\n  <PARAM ID=\"empty_value\" arraysize=\"*\" datatype=\"char\" name=\"empty_value\" unit=\"foo\" value=\"\">\n   <VALUES>\n    <OPTION name=\"empty_value\" value=\"\"/>\n    <OPTION value=\"90prime\"/>\n   </VALUES>\n  </PARAM>\n  <LINK href=\"http://www.foo.com/\"/>\n  <TABLE ID=\"main_table\" nrows=\"5\">\n   <DESCRIPTION>\n    This describes the table.\n   </DESCRIPTION>\n   <FIELD ID=\"string_test\" arraysize=\"*\" datatype=\"char\" name=\"string test\"/>\n   <FIELD ID=\"string_test_2\" arraysize=\"10\" datatype=\"char\" name=\"fixed string test\"/>\n   <FIELD ID=\"unicode_test\" arraysize=\"*\" datatype=\"unicodeChar\" name=\"unicode_test\"/>\n   <FIELD ID=\"fixed_unicode_test\" arraysize=\"10\" datatype=\"unicodeChar\" name=\"unicode test\"/>\n   <FIELD ID=\"string_array_test\" arraysize=\"4\" datatype=\"char\" name=\"string array test\"/>\n   <FIELD ID=\"unsignedByte\" datatype=\"unsignedByte\" name=\"unsignedByte\"/>\n   <FIELD ID=\"short\" datatype=\"short\" name=\"short\">\n    <VALUES null=\"-32768\"/>\n   </FIELD>\n   <FIELD ID=\"int\" datatype=\"int\" name=\"int\" utype=\"myint\">\n    <VALUES ID=\"int_nulls\" null=\"123456789\">\n     <MIN inclusive=\"no\" value=\"-1000\"/>\n     <MAX inclusive=\"yes\" value=\"1000\"/>\n     <OPTION name=\"bogus\" value=\"whatever\"/>\n    </VALUES>\n   </FIELD>\n   <FIELD ID=\"long\" datatype=\"long\" name=\"long\">\n    <VALUES ref=\"int_nulls\"/>\n    <LINK href=\"http://www.long-integers.com/\"/>\n   </FIELD>\n   <FIELD ID=\"double\" datatype=\"double\" name=\"double\"/>\n   <FIELD ID=\"float\" datatype=\"float\" name=\"float\"/>\n   <FIELD ID=\"array\" arraysize=\"2x2*\" datatype=\"long\" name=\"array\">\n    <VALUES null=\"-1\"/>\n   </FIELD>\n   <FIELD ID=\"bit\" datatype=\"bit\" name=\"bit\"/>\n   <FIELD ID=\"bitarray\" arraysize=\"2x3\" datatype=\"bit\" name=\"bitarray\"/>\n   <FIELD ID=\"bitvararray\" arraysize=\"*\" datatype=\"bit\" name=\"bitvararray\"/>\n   <FIELD ID=\"bitvararray2\" arraysize=\"2x3x*\" datatype=\"bit\" name=\"bitvararray2\"/>\n   <FIELD ID=\"floatComplex\" datatype=\"floatComplex\" name=\"floatComplex\"/>\n   <FIELD ID=\"doubleComplex\" datatype=\"doubleComplex\" name=\"doubleComplex\"/>\n   <FIELD ID=\"doubleComplexArray\" arraysize=\"*\" datatype=\"doubleComplex\" name=\"doubleComplexArray\"/>\n   <FIELD ID=\"doubleComplexArrayFixed\" arraysize=\"2\" datatype=\"doubleComplex\" name=\"doubleComplexArrayFixed\"/>\n   <FIELD ID=\"boolean\" datatype=\"boolean\" name=\"boolean\"/>\n   <FIELD ID=\"booleanArray\" arraysize=\"4\" datatype=\"boolean\" name=\"booleanArray\"/>\n   <FIELD ID=\"nulls\" datatype=\"int\" name=\"nulls\">\n    <VALUES null=\"-9\"/>\n   </FIELD>\n   <FIELD ID=\"nulls_array\" arraysize=\"2x2\" datatype=\"int\" name=\"nulls_array\">\n    <VALUES null=\"-9\"/>\n   </FIELD>\n   <FIELD ID=\"precision1\" datatype=\"double\" name=\"precision1\" precision=\"E3\" width=\"10\"/>\n   <FIELD ID=\"precision2\" datatype=\"double\" name=\"precision2\" precision=\"F3\"/>\n   <FIELD ID=\"doublearray\" arraysize=\"*\" datatype=\"double\" name=\"doublearray\">\n    <VALUES null=\"-1.0\"/>\n   </FIELD>\n   <FIELD ID=\"bitarray2\" arraysize=\"16\" datatype=\"bit\" name=\"bitarray2\"/>\n   <PARAM ID=\"INPUT2\" arraysize=\"*\" datatype=\"float\" name=\"INPUT2\" unit=\"deg\" value=\"0 0\">\n    <DESCRIPTION>\n     This is the most interesting parameter in the world, and it\n     drinks Dos Equis\n    </DESCRIPTION>\n   </PARAM>\n   <GROUP>\n    <PARAMref ref=\"awesome\"/>\n   </GROUP>\n   <GROUP>\n    <DESCRIPTION>\n     This should warn of a second description.\n    </DESCRIPTION>\n    <FIELDref ref=\"boolean\"/>\n    <GROUP>\n     <PARAMref ref=\"awesome\"/>\n     <PARAM ID=\"OUTPUT\" datatype=\"float\" name=\"OUTPUT\" value=\"42\"/>\n    </GROUP>\n    <PARAM ID=\"INPUT3\" arraysize=\"*\" datatype=\"float\" name=\"INPUT3\" unit=\"deg\" value=\"0 0\">\n     <DESCRIPTION>\n      This is the most interesting parameter in the world, and it\n      drinks Dos Equis\n     </DESCRIPTION>\n    </PARAM>\n   </GROUP>\n   <LINK href=\"http://tabledata.org/\"/>\n   <DATA>\n    <TABLEDATA>\n     <TR>\n      <TD>String &amp; test</TD>\n      <TD>Fixed stri</TD>\n      <TD>Ceçi n'est pas un pipe</TD>\n      <TD>Ceçi n'est</TD>\n      <TD>ab c</TD>\n      <TD>128</TD>\n      <TD>4096</TD>\n      <TD>268435456</TD>\n      <TD>922337203685477</TD>\n      <TD>8.9990234375</TD>\n      <TD>1</TD>\n      <TD/>\n      <TD>1</TD>\n      <TD>101101</TD>\n      <TD>1 1 1</TD>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD>0 0 0 0</TD>\n      <TD>T</TD>\n      <TD>T T T T</TD>\n      <TD>0</TD>\n      <TD/>\n      <TD>      1.33</TD>\n      <TD>1.333</TD>\n      <TD/>\n      <TD>1111000011110000</TD>\n     </TR>\n     <TR>\n      <TD>String &amp;amp; test</TD>\n      <TD>0123456789</TD>\n      <TD>வணக்கம்</TD>\n      <TD>வணக்கம்</TD>\n      <TD>0123</TD>\n      <TD>255</TD>\n      <TD>32767</TD>\n      <TD>2147483647</TD>\n      <TD/>\n      <TD>0</TD>\n      <TD>0</TD>\n      <TD>42 32 12 32</TD>\n      <TD>0</TD>\n      <TD>010011</TD>\n      <TD>0 0 0 0 0</TD>\n      <TD>0 1 0 0 1 0 1 0 1 0 1 0</TD>\n      <TD>0 0</TD>\n      <TD>0 0</TD>\n      <TD>0 0 0 0</TD>\n      <TD>0 -1 -1 -1</TD>\n      <TD>F</TD>\n      <TD>T T F T</TD>\n      <TD/>\n      <TD>0 1 2 3</TD>\n      <TD>         1</TD>\n      <TD>1.000</TD>\n      <TD>0 1 +InF -InF NaN 0 -1</TD>\n      <TD/>\n     </TR>\n     <TR>\n      <TD>XXXX</TD>\n      <TD>XXXX</TD>\n      <TD>XXXX</TD>\n      <TD>0123456789</TD>\n      <TD/>\n      <TD>0</TD>\n      <TD>-4096</TD>\n      <TD>-268435456</TD>\n      <TD>-1152921504606846976</TD>\n      <TD>+InF</TD>\n      <TD>+InF</TD>\n      <TD>12 34 56 78 87 65 43 21</TD>\n      <TD>1</TD>\n      <TD>111000</TD>\n      <TD>1 0 1 0 1</TD>\n      <TD>1 1 1 1 1 1</TD>\n      <TD>0 -1</TD>\n      <TD>0 -1</TD>\n      <TD>0 0 0 0</TD>\n      <TD>0 0 0 0</TD>\n      <TD>T</TD>\n      <TD>T T ? T</TD>\n      <TD>2</TD>\n      <TD>-9 0 -9 1</TD>\n      <TD>     1e+34</TD>\n      <TD>9999999999999999455752309870428160.000</TD>\n      <TD/>\n      <TD/>\n     </TR>\n     <TR>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD>255</TD>\n      <TD>32767</TD>\n      <TD>268435455</TD>\n      <TD>1152921504606846975</TD>\n      <TD/>\n      <TD>+InF</TD>\n      <TD>-1 23</TD>\n      <TD>0</TD>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD>0 0 0 0</TD>\n      <TD>F</TD>\n      <TD/>\n      <TD/>\n      <TD>0 -9 1 -9</TD>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n     </TR>\n     <TR>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD>255</TD>\n      <TD>32767</TD>\n      <TD/>\n      <TD/>\n      <TD>-InF</TD>\n      <TD/>\n      <TD>31 -1</TD>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD>0 0 0 0</TD>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n      <TD/>\n     </TR>\n    </TABLEDATA>\n   </DATA>\n   <INFO ID=\"ErrorInfo\" name=\"Error\" value=\"One might expect to find some INFO here, too...\"/>\n  </TABLE>\n  <RESOURCE type=\"results\">\n   <TABLE nrows=\"1\" ref=\"main_table\">\n    <DESCRIPTION>\n     This is a referenced table\n    </DESCRIPTION>\n    <GROUP ID=\"_g1\"/>\n    <DATA>\n     <TABLEDATA>\n      <TR>\n       <TD>String &amp; test</TD>\n       <TD>Fixed stri</TD>\n       <TD>Ceçi n'est pas un pipe</TD>\n       <TD>Ceçi n'est</TD>\n       <TD>ab c</TD>\n       <TD>128</TD>\n       <TD>4096</TD>\n       <TD>268435456</TD>\n       <TD>922337203685477</TD>\n       <TD>8.9990234375</TD>\n       <TD>1</TD>\n       <TD/>\n       <TD>1</TD>\n       <TD>101101</TD>\n       <TD>1 1 1</TD>\n       <TD/>\n       <TD/>\n       <TD/>\n       <TD/>\n       <TD>0 0 0 0</TD>\n       <TD>T</TD>\n       <TD>T T T T</TD>\n       <TD>0</TD>\n       <TD/>\n       <TD>      1.33</TD>\n       <TD>1.333</TD>\n       <TD/>\n       <TD>1111000011110000</TD>\n      </TR>\n     </TABLEDATA>\n    </DATA>\n   </TABLE>\n   <TABLE ID=\"last_table\" nrows=\"0\" ref=\"main_table\">\n    <GROUP ID=\"_g2\"/>\n   </TABLE>\n  </RESOURCE>\n </RESOURCE>\n</VOTABLE>\n"},{"id":6838,"name":"timesys_errors.xml","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<VOTABLE version=\"1.4\" xmlns=\"http://www.ivoa.net/xml/VOTable/v1.3\">\n  <RESOURCE>\n    <COOSYS ID=\"system\" epoch=\"J2015.5\" system=\"ICRS\"/>\n    <TIMESYS ID=\"bad_origin\" refposition=\"BARYCENTER\" timeorigin=\"bad-origin\" timescale=\"TCB\"/>\n    <TIMESYS ID=\"extra_attribute\" refposition_mispelled=\"BARYCENTER\" timeorigin=\"2455197.5\" timescale=\"TCB\"/>\n    <TIMESYS refposition=\"BARYCENTER\" timeorigin=\"2455197.5\" timescale=\"TCB\"/>\n    <TABLE name=\"ts_data\">\n      <FIELD datatype=\"double\" name=\"obs_time\" ucd=\"time.epoch\" unit=\"d\" ref=\"time_frame\"/>\n      <FIELD datatype=\"float\" name=\"flux\" ucd=\"phot.flux;em.opt.V\" unit=\"s**-1\"/>\n      <FIELD datatype=\"float\" name=\"mag\" ucd=\"phot.mag;em.opt.V\" unit=\"mag\"/>\n      <FIELD datatype=\"float\" name=\"flux_error\" ucd=\"stat.error;phot.flux;em.opt.V\" \n        unit=\"s**-1\"/>\n      <PARAM datatype=\"double\" name=\"ra\" ucd=\"pos.eq.ra\" value=\"45.7164887146879\" ref=\"system\"/>\n      <PARAM datatype=\"double\" name=\"dec\" ucd=\"pos.eq.dec\" value=\"1.18583048057467\" ref=\"system\"/>\n      <DATA>\n        <TABLEDATA>\n          <TR>\n            <TD>1821.2846388435</TD>\n            <TD>168.358</TD>\n            <TD>20.12281560517953</TD>\n            <TD>8.71437</TD>\n          </TR>\n        </TABLEDATA>\n      </DATA>\n    </TABLE>\n  </RESOURCE>\n</VOTABLE>\n"},{"id":6839,"name":"resource_groups.xml","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"<?xml version=\"1.0\"?>\n<VOTABLE xmlns=\"http://www.ivoa.net/xml/VOTable/v1.3\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <RESOURCE type=\"meta\" utype=\"adhoc:service\">\n    <GROUP name=\"inputParams\">\n      <PARAM arraysize=\"*\" datatype=\"char\" name=\"ID\" ref=\"a_reference\" ucd=\"meta.id;meta.main\" value=\"\"/>\n    </GROUP>\n    <PARAM arraysize=\"*\" datatype=\"char\" name=\"standardID\" value=\"ivo://ivoa.net/std/DataLink#links-1.0\"/>\n    <PARAM arraysize=\"*\" datatype=\"char\" name=\"accessURL\" value=\"http://example.org/ivoa/std/DataLink\"/>\n  </RESOURCE>\n</VOTABLE>\n"},{"col":0,"comment":"null","endLoc":813,"header":"@mock.patch('subprocess.Popen')\ndef test_validate_xmllint_true(mock_subproc_popen)","id":6840,"name":"test_validate_xmllint_true","nodeType":"Function","startLoc":804,"text":"@mock.patch('subprocess.Popen')\ndef test_validate_xmllint_true(mock_subproc_popen):\n    process_mock = mock.Mock()\n    attrs = {'communicate.return_value': ('ok', 'ko'),\n             'returncode': 0}\n    process_mock.configure_mock(**attrs)\n    mock_subproc_popen.return_value = process_mock\n\n    assert validate(get_pkg_data_filename('data/empty_table.xml'),\n                    xmllint=True)"},{"id":6841,"name":"regression.xml","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE VOTABLE SYSTEM \"http://us-vo.org/xml/VOTable.dtd\">\n<VOTABLE version=\"1.1\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:noNamespaceSchemaLocation=\"http://www.ivoa.net/xml/VOTable/v1.1\"\n xmlns=\"http://www.ivoa.net/xml/VOTable/v1.1\">\n<DESCRIPTION > <!-- This should get word-wrapped -->\nThe VOTable format is an XML standard for the interchange of data represented as a set of tables. In this context, a table is an unordered set of rows, each of a uniform format, as specified in the table metadata. Each row in a table is a sequence of table cells, and each of these contains either a primitive data type, or an array of such primitives. VOTable is derived from the Astrores format [1], itself modeled on the FITS Table format [2]; VOTable was designed to be closer to the FITS Binary Table format.\n</DESCRIPTION>\n<COOSYS ID=\"J2000\" system=\"eq_FK5\" equinox=\"J2000\"/>\n<PARAM datatype=\"float\" name=\"wrong_arraysize\" value=\"0.000000,0.000000\" arraysize=\"0\"/>\n<PARAM datatype=\"float\" name=\"INPUT\" value=\"0.000000,0.000000\" arraysize=\"*\" unit=\"km/h\" ucd=\"phys.size;instr.tel\">\n  <DESCRIPTION>This is the most interesting parameter in the world, and it drinks Dos Equis</DESCRIPTION>\n</PARAM>\n<INFO ID=\"QUERY_STATUS\" name=\"QUERY_STATUS\" value=\"OK\">This is some information.</INFO>\n<RESOURCE type=\"results\">\n<DESCRIPTION>\n  This is a resource description\n</DESCRIPTION>\n<PARAM ID=\"awesome\" datatype=\"float\" name=\"INPUT\" value=\"0.000000,0.000000\" arraysize=\"*\" unit=\"deg\"></PARAM>\n<PARAM ID=\"empty_value\" arraysize=\"*\" datatype=\"char\" name=\"empty_value\" unit=\"foo\" value=\"\">\n  <VALUES>\n    <OPTION name=\"empty_value\" value=\"\"/>\n    <OPTION value=\"90prime\"/>\n  </VALUES>\n</PARAM>\n<LINK href=\"http://www.foo.com/\" gref=\"DECPRECATED\">\n  <DESCRIPTION>Really, this link is totally bogus.</DESCRIPTION>\n</LINK>\n<TABLE ID=\"main_table\">\n<DESCRIPTION>\n  This describes the table.\n</DESCRIPTION>\n<INFO name=\"Error\" ID=\"ErrorInfo\" value=\"One might expect to find some INFO here, too...\"/>\n<GROUP>\n  <PARAMref ref=\"awesome\"/>\n</GROUP>\n<PARAM datatype=\"float\" name=\"INPUT2\" value=\"0.000000,0.000000\" arraysize=\"*\" unit=\"deg\">\n  <DESCRIPTION>This is the most interesting parameter in the world, and it drinks Dos Equis</DESCRIPTION>\n</PARAM>\n<FIELD id=\"string_test\" name=\"string test\" datatype=\"char\" arraysize=\"*\"></FIELD>\n<FIELD ID=\"string_test\" name=\"fixed string test\" datatype=\"char\" arraysize=\"10\"/>\n<FIELD ID=\"unicode_test\" name=\"unicode_test\" datatype=\"unicodeChar\" arraysize=\"*\"/>\n<FIELD ID=\"fixed_unicode_test\" name=\"unicode test\" datatype=\"unicodeString\" arraysize=\"10\"/>\n<LINK href=\"http://tabledata.org/\"/>\n<FIELD ID=\"string_array_test\" name=\"string array test\" datatype=\"string\" arraysize=\"4*\"/>\n<FIELD ID=\"unsignedByte\" name=\"unsignedByte\" datatype=\"unsignedByte\"/>\n<FIELD ID=\"short\" name=\"short\" datatype=\"short\">\n  <VALUES null=\"-32769\"/>\n</FIELD>\n<FIELD ID=\"int\" name=\"int\" datatype=\"int\" utype=\"myint\">\n  <VALUES null=\"123456789\" ID=\"int_nulls\">\n    <MIN value=\"-1000\" inclusive=\"no\"/>\n    <MAX value=\"1000\" inclusive=\"yes\"/>\n    <OPTION name=\"bogus\" value=\"whatever\"/>\n  </VALUES>\n  <IGNORE_ME/>\n</FIELD>\n<FIELD ID=\"long\" name=\"long\" datatype=\"long\">\n  <LINK href=\"http://www.long-integers.com/\"/>\n  <VALUES ref=\"int_nulls\"/>\n</FIELD>\n<FIELD ID=\"double\" name=\"double\" datatype=\"double\"/>\n<FIELD ID=\"float\" name=\"float\" datatype=\"float\">\n  <VALUES null=\"\"/>\n</FIELD>\n<FIELD ID=\"array\" name=\"array\" datatype=\"long\" arraysize=\"2x2*\">\n  <VALUES null=\"-1\"/>\n</FIELD>\n<FIELD ID=\"bit\" name=\"bit\" datatype=\"bit\"/>\n<FIELD ID=\"bitarray\" name=\"bitarray\" datatype=\"bit\" arraysize=\"2x3\"/>\n<FIELD ID=\"bitvararray\" name=\"bitvararray\" datatype=\"bit\" arraysize=\"*\"/>\n<FIELD ID=\"bitvararray2\" name=\"bitvararray2\" datatype=\"bit\" arraysize=\"2x3x*\"/>\n<FIELD ID=\"floatComplex\" name=\"floatComplex\" datatype=\"floatComplex\"/>\n<FIELD ID=\"doubleComplex\" name=\"doubleComplex\" datatype=\"doubleComplex\"/>\n<FIELD ID=\"doubleComplexArray\" name=\"doubleComplexArray\" datatype=\"doubleComplex\" arraysize=\"*\"/>\n<FIELD ID=\"doubleComplexArrayFixed\" name=\"doubleComplexArrayFixed\" datatype=\"doubleComplex\" arraysize=\"2\"/>\n<FIELD ID=\"boolean\" name=\"boolean\" datatype=\"boolean\"/>\n<FIELD ID=\"booleanArray\" name=\"booleanArray\" datatype=\"boolean\" arraysize=\"4\"/>\n<FIELD ID=\"nulls\" name=\"nulls\" datatype=\"int\">\n  <VALUES null=\"-9\"/>\n</FIELD>\n<FIELD ID=\"nulls_array\" name=\"nulls_array\" datatype=\"int\" arraysize=\"2x2\">\n  <VALUES null=\"-9\"/>\n</FIELD>\n<FIELD ID=\"precision1\" name=\"precision1\" datatype=\"double\" precision=\"E3\" width=\"10\"/>\n<FIELD ID=\"precision2\" name=\"precision2\" datatype=\"double\" precision=\"F3\"/>\n<FIELD ID=\"doublearray\" name=\"doublearray\" datatype=\"double\" arraysize=\"*\">\n  <VALUES null=\"-1\"/>\n</FIELD>\n<FIELD ID=\"bitarray2\" name=\"bitarray2\" datatype=\"bit\" arraysize=\"16\"/>\n<GROUP>\n  <DESCRIPTION>\n    This is just a group to make sure we can round-trip them.\n  </DESCRIPTION>\n  <DESCRIPTION>\n    This should warn of a second description.\n  </DESCRIPTION>\n  <FIELDref ref=\"boolean\"/>\n  <GROUP>\n    <PARAMref ref=\"awesome\"/>\n    <PARAM datatype=\"float\" name=\"OUTPUT\" value=\"42\"/>\n  </GROUP>\n  <PARAM datatype=\"float\" name=\"INPUT3\" value=\"0.000000,0.000000\" arraysize=\"*\" unit=\"deg\">\n    <DESCRIPTION>This is the most interesting parameter in the world, and it drinks Dos Equis</DESCRIPTION>\n  </PARAM>\n</GROUP>\n<DATA>\n<TABLEDATA>\n<TR>\n  <TD>String &amp; test</TD>\n  <TD>Fixed string long test</TD> <!-- Should truncate -->\n  <TD>Ceçi n'est pas un pipe</TD> <!-- French, n'est-ce pas? -->\n  <TD>Ceçi n'est pas un pipe</TD>\n  <TD>ab cd</TD>\n  <TD>128</TD>\n  <TD>4096</TD>\n  <TD>268435456</TD>\n  <TD>922337203685477</TD>\n  <TD>8.9990234375</TD>\n  <TD encoding=\"base64\">P4AAAA==</TD>\n  <TD>   </TD>\n  <TD>1</TD>\n  <TD>1 0 1 1 0 1</TD>\n  <TD>1 1 1</TD>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD>0 0 0 0</TD>\n  <TD>True</TD>\n  <TD>True True True True</TD>\n  <TD>0</TD>\n  <TD/>\n  <TD>1.333333333333333333333333333333333</TD>\n  <TD>1.333333333333333333333333333333333</TD>\n  <TD/>\n  <TD>1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0</TD>\n</TR>\n<TR>\n  <TD><![CDATA[String &amp; test]]></TD> <!-- Test that &amp; is treated literally inside CDATA -->\n  <TD>0123456789A</TD>\n  <TD>வணக்கம்</TD>\n  <TD>வணக்கம்</TD>\n  <TD>0123456789A</TD>\n  <TD>256</TD> <!-- should overflow to 0 -->\n  <TD>65536</TD> <!-- should overflow to 0-->\n  <TD>2147483647</TD> <!-- overflowing here would raise a Numpy exception -->\n  <TD></TD>\n  <TD>1.0e-325</TD> <!-- underflow to 0 -->\n  <TD>1.0e-46</TD> <!-- underflow to 0 -->\n  <TD>42 32, 12 32</TD>\n  <TD>0</TD>\n  <TD>0 1 0 0 1 1</TD>\n  <TD>0 0 0 0 0</TD>\n  <TD>0 1 0 0 1 0 1 0 1 0 1 0</TD>\n  <TD>0 0</TD>\n  <TD>0 0</TD>\n  <TD>0 0 0 0</TD>\n  <TD>0 -1 -1 -1</TD>\n  <TD>FaLsE</TD>\n  <TD>true true falSE TRUE</TD>\n  <TD>-9</TD>\n  <TD>0 1 2 3</TD>\n  <TD>1.0</TD>\n  <TD>1.0</TD>\n  <TD>0 1 Inf -Inf NaN 0 -1</TD>\n  <TD/>\n</TR>\n<TR>\n  <TD>XXXX </TD>\n  <TD> XXXX </TD> <!-- Shouldn't output extra 0 bytes even though field is wider than string -->\n  <TD> XXXX </TD>\n  <TD>0123456789A</TD>\n  <TD/>\n  <TD>-23</TD> <!-- negative, should wrap around to positive -->\n  <TD>-4096</TD> <!-- negative, perfectly valid -->\n  <TD>-268435456</TD> <!-- negative, perfectly valid -->\n  <TD>-1152921504606846976</TD>  <!-- negative, perfectly valid -->\n  <TD>1.0E309</TD>\n  <TD>1.0E45</TD>\n  <TD>12 34 56 78 87 65 43 21</TD>\n  <TD>1</TD>\n  <TD>1 1 1 0 0 0</TD>\n  <TD>1 0 1 0 1</TD>\n  <TD>1 1 1 1 1 1</TD>\n  <TD>0 -1</TD>\n  <TD>0 -1</TD>\n  <TD>0 0 0 0</TD>\n  <TD>0 0 0 0</TD>\n  <TD>true</TD>\n  <TD>true True ? true</TD>\n  <TD>2</TD>\n  <TD>-9 0 -9 1</TD>\n  <TD>1e34</TD>\n  <TD>1e34</TD>\n  <TD/>\n  <TD/>\n</TR>\n<TR>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD>0xff</TD> <!-- hex -->\n  <TD>0xffff</TD> <!-- hex - negative value -->\n  <TD>0xfffffff</TD>\n  <TD>0xfffffffffffffff</TD>\n  <TD>NaN</TD>\n  <TD>+Inf</TD>\n  <TD>NaN, 23</TD>\n  <TD>0</TD>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD>NaN Inf</TD>\n  <TD/>\n  <TD>0 0 0 0</TD>\n  <TD>false</TD>\n  <TD/>\n  <TD/>\n  <TD>0 -9 1 -9</TD>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD/>\n</TR>\n<TR>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD>0x100</TD> <!-- hex, overflow -->\n  <TD>0x10000</TD> <!-- hex, overflow -->\n  <TD/>\n  <TD/>\n  <TD>-Inf</TD>\n  <TD/>\n  <TD>31, -1</TD>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD>0 0 0 0</TD>\n  <TD/>\n  <TD/>\n  <TD>-9</TD>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD/>\n</TR>\n</TABLEDATA>\n</DATA>\n</TABLE>\n<RESOURCE>\n <TABLE ref=\"main_table\">\n   <DESCRIPTION>\n     This is a referenced table\n   </DESCRIPTION>\n   <DATA>\n<TABLEDATA>\n<TR>\n  <TD>String &amp; test</TD>\n  <TD>Fixed string long test</TD> <!-- Should truncate -->\n  <TD>Ceçi n'est pas un pipe</TD> <!-- French, n'est-ce pas? -->\n  <TD>Ceçi n'est pas un pipe</TD>\n  <TD>ab cd</TD>\n  <TD>128</TD>\n  <TD>4096</TD>\n  <TD>268435456</TD>\n  <TD>922337203685477</TD>\n  <TD>8.9990234375</TD>\n  <TD encoding=\"base64\">P4AAAA==</TD>\n  <TD>   </TD>\n  <TD>1</TD>\n  <TD>1 0 1 1 0 1</TD>\n  <TD>1 1 1</TD>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD/>\n  <TD>0 0 0 0</TD>\n  <TD>True</TD>\n  <TD>True True True True</TD>\n  <TD>0</TD>\n  <TD/>\n  <TD>1.333333333333333333333333333333333</TD>\n  <TD>1.333333333333333333333333333333333</TD>\n  <TD/>\n  <TD>1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0</TD>\n</TR>\n</TABLEDATA>\n</DATA>\n</TABLE>\n<TABLE ref=\"main_table\" ID=\"last_table\">\n<DATA>\n<TABLEDATA/> <!-- Add an empty table because it's a useful thing to test -->\n</DATA>\n</TABLE>\n</RESOURCE>\n</RESOURCE>\n</VOTABLE>\n"},{"id":6842,"name":"irsa-nph-error.xml","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE VOTABLE SYSTEM \"http://us-vo.org/xml/VOTable.dtd\">\n<VOTABLE version=\"v1.0\">\n<INFO name=\"ERROR\"> \"Either wrong or missing coordinate/object name.\" </INFO>\n</VOTABLE>"},{"id":6843,"name":"astropy/io/votable/validator","nodeType":"Package"},{"fileName":"main.py","filePath":"astropy/io/votable/validator","id":6844,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nValidates a large collection of web-accessible VOTable files,\nand generates a report as a directory tree of HTML files.\n\"\"\"\n\n# STDLIB\nimport os\n\n# LOCAL\nfrom astropy.utils.data import get_pkg_data_filename\nfrom . import html\nfrom . import result\n\n\n__all__ = ['make_validation_report']\n\n\ndef get_srcdir():\n    return os.path.dirname(__file__)\n\n\ndef get_urls(destdir, s):\n    import gzip\n\n    types = ['good', 'broken', 'incorrect']\n\n    seen = set()\n    urls = []\n    for type in types:\n        filename = get_pkg_data_filename(\n            f'data/urls/cone.{type}.dat.gz')\n        with gzip.open(filename, 'rb') as fd:\n            for url in fd.readlines():\n                next(s)\n                url = url.strip()\n                if url not in seen:\n                    with result.Result(url, root=destdir) as r:\n                        r['expected'] = type\n                    urls.append(url)\n                seen.add(url)\n\n    return urls\n\n\ndef download(args):\n    url, destdir = args\n    with result.Result(url, root=destdir) as r:\n        r.download_xml_content()\n\n\ndef validate_vo(args):\n    url, destdir = args\n    with result.Result(url, root=destdir) as r:\n        r.validate_vo()\n\n\ndef votlint_validate(args):\n    path_to_stilts_jar, url, destdir = args\n    with result.Result(url, root=destdir) as r:\n        if r['network_error'] is None:\n            r.validate_with_votlint(path_to_stilts_jar)\n\n\ndef write_html_result(args):\n    url, destdir = args\n    with result.Result(url, root=destdir) as r:\n        html.write_result(r)\n\n\ndef write_subindex(args):\n    subset, destdir, total = args\n    html.write_index_table(destdir, *subset, total=total)\n\n\ndef make_validation_report(\n    urls=None, destdir='astropy.io.votable.validator.results',\n    multiprocess=True, stilts=None):\n    \"\"\"\n    Validates a large collection of web-accessible VOTable files.\n\n    Generates a report as a directory tree of HTML files.\n\n    Parameters\n    ----------\n    urls : list of str, optional\n        If provided, is a list of HTTP urls to download VOTable files\n        from.  If not provided, a built-in set of ~22,000 urls\n        compiled by HEASARC will be used.\n\n    destdir : path-like, optional\n        The directory to write the report to.  By default, this is a\n        directory called ``'results'`` in the current directory. If the\n        directory does not exist, it will be created.\n\n    multiprocess : bool, optional\n        If `True` (default), perform validations in parallel using all\n        of the cores on this machine.\n\n    stilts : path-like, optional\n        To perform validation with ``votlint`` from the the Java-based\n        `STILTS <http://www.star.bris.ac.uk/~mbt/stilts/>`_ VOTable\n        parser, in addition to `astropy.io.votable`, set this to the\n        path of the ``'stilts.jar'`` file.  ``java`` on the system shell\n        path will be used to run it.\n\n    Notes\n    -----\n    Downloads of each given URL will be performed only once and cached\n    locally in *destdir*.  To refresh the cache, remove *destdir*\n    first.\n    \"\"\"\n    from astropy.utils.console import (color_print, ProgressBar, Spinner)\n\n    if stilts is not None:\n        if not os.path.exists(stilts):\n            raise ValueError(\n                f'{stilts} does not exist.')\n\n    destdir = os.path.abspath(destdir)\n\n    if urls is None:\n        with Spinner('Loading URLs', 'green') as s:\n            urls = get_urls(destdir, s)\n    else:\n        color_print('Marking URLs', 'green')\n        for url in ProgressBar.iterate(urls):\n            with result.Result(url, root=destdir) as r:\n                r['expected'] = type\n\n    args = [(url, destdir) for url in urls]\n\n    color_print('Downloading VO files', 'green')\n    ProgressBar.map(\n        download, args, multiprocess=multiprocess)\n\n    color_print('Validating VO files', 'green')\n    ProgressBar.map(\n        validate_vo, args, multiprocess=multiprocess)\n\n    if stilts is not None:\n        color_print('Validating with votlint', 'green')\n        votlint_args = [(stilts, x, destdir) for x in urls]\n        ProgressBar.map(\n            votlint_validate, votlint_args, multiprocess=multiprocess)\n\n    color_print('Generating HTML files', 'green')\n    ProgressBar.map(\n        write_html_result, args, multiprocess=multiprocess)\n\n    with Spinner('Grouping results', 'green') as s:\n        subsets = result.get_result_subsets(urls, destdir, s)\n\n    color_print('Generating index', 'green')\n    html.write_index(subsets, urls, destdir)\n\n    color_print('Generating subindices', 'green')\n    subindex_args = [(subset, destdir, len(urls)) for subset in subsets]\n    ProgressBar.map(\n        write_subindex, subindex_args, multiprocess=multiprocess)\n"},{"col":0,"comment":"\n    Validating when source is passed as path object. (#4412)\n    ","endLoc":820,"header":"def test_validate_path_object()","id":6845,"name":"test_validate_path_object","nodeType":"Function","startLoc":816,"text":"def test_validate_path_object():\n    \"\"\"\n    Validating when source is passed as path object. (#4412)\n    \"\"\"\n    test_validate(test_path_object=True)"},{"col":0,"comment":"null","endLoc":832,"header":"def test_gzip_filehandles(tmpdir)","id":6846,"name":"test_gzip_filehandles","nodeType":"Function","startLoc":823,"text":"def test_gzip_filehandles(tmpdir):\n    votable = parse(get_pkg_data_filename('data/regression.xml'))\n\n    # W39: Bit values can not be masked\n    with pytest.warns(W39):\n        with open(str(tmpdir.join(\"regression.compressed.xml\")), 'wb') as fd:\n            votable.to_xml(fd, compressed=True, _astropy_version=\"testing\")\n\n    with open(str(tmpdir.join(\"regression.compressed.xml\")), 'rb') as fd:\n        votable = parse(fd)"},{"col":0,"comment":"null","endLoc":20,"header":"def get_srcdir()","id":6847,"name":"get_srcdir","nodeType":"Function","startLoc":19,"text":"def get_srcdir():\n    return os.path.dirname(__file__)"},{"col":0,"comment":"null","endLoc":43,"header":"def get_urls(destdir, s)","id":6848,"name":"get_urls","nodeType":"Function","startLoc":23,"text":"def get_urls(destdir, s):\n    import gzip\n\n    types = ['good', 'broken', 'incorrect']\n\n    seen = set()\n    urls = []\n    for type in types:\n        filename = get_pkg_data_filename(\n            f'data/urls/cone.{type}.dat.gz')\n        with gzip.open(filename, 'rb') as fd:\n            for url in fd.readlines():\n                next(s)\n                url = url.strip()\n                if url not in seen:\n                    with result.Result(url, root=destdir) as r:\n                        r['expected'] = type\n                    urls.append(url)\n                seen.add(url)\n\n    return urls"},{"col":4,"comment":"null","endLoc":2961,"header":"def _write_binary(self, mode, w, **kwargs)","id":6849,"name":"_write_binary","nodeType":"Function","startLoc":2929,"text":"def _write_binary(self, mode, w, **kwargs):\n        fields = self.fields\n        array = self.array\n        if mode == 1:\n            tag_name = 'BINARY'\n        else:\n            tag_name = 'BINARY2'\n\n        with w.tag(tag_name):\n            with w.tag('STREAM', encoding='base64'):\n                fields_basic = [(i, field.converter.binoutput)\n                                for (i, field) in enumerate(fields)]\n\n                data = io.BytesIO()\n                for row in range(len(array)):\n                    array_row = array.data[row]\n                    array_mask = array.mask[row]\n\n                    if mode == 2:\n                        flattened = np.array([np.all(x) for x in array_mask])\n                        data.write(converters.bool_to_bitarray(flattened))\n\n                    for i, converter in fields_basic:\n                        try:\n                            chunk = converter(array_row[i], array_mask[i])\n                            assert type(chunk) == bytes\n                        except Exception as e:\n                            vo_reraise(\n                                e, additional=f\"(in row {row:d}, col '{fields[i].ID}')\")\n                        data.write(chunk)\n\n                w._flush()\n                w.write(base64.b64encode(data.getvalue()).decode('ascii'))"},{"col":4,"comment":"null","endLoc":1519,"header":"def to_xml(self, w, **kwargs)","id":6850,"name":"to_xml","nodeType":"Function","startLoc":1509,"text":"def to_xml(self, w, **kwargs):\n        attrib = w.object_attrs(self, self._attr_list)\n        if 'unit' in attrib:\n            attrib['unit'] = self.unit.to_string('cds')\n        with w.tag(self._element_name, attrib=attrib):\n            if self.description is not None:\n                w.element('DESCRIPTION', self.description, wrap=True)\n            if not self.values.is_defaults():\n                self.values.to_xml(w, **kwargs)\n            for link in self.links:\n                link.to_xml(w, **kwargs)"},{"col":0,"comment":"null","endLoc":836,"header":"def test_from_scratch_example()","id":6851,"name":"test_from_scratch_example","nodeType":"Function","startLoc":835,"text":"def test_from_scratch_example():\n    _run_test_from_scratch_example()"},{"col":0,"comment":"null","endLoc":866,"header":"def _run_test_from_scratch_example()","id":6852,"name":"_run_test_from_scratch_example","nodeType":"Function","startLoc":839,"text":"def _run_test_from_scratch_example():\n    from astropy.io.votable.tree import VOTableFile, Resource, Table, Field\n\n    # Create a new VOTable file...\n    votable = VOTableFile()\n\n    # ...with one resource...\n    resource = Resource()\n    votable.resources.append(resource)\n\n    # ... with one table\n    table = Table(votable)\n    resource.tables.append(table)\n\n    # Define some fields\n    table.fields.extend([\n        Field(votable, name=\"filename\", datatype=\"char\", arraysize=\"*\"),\n        Field(votable, name=\"matrix\", datatype=\"double\", arraysize=\"2x2\")])\n\n    # Now, use those field definitions to create the numpy record arrays, with\n    # the given number of rows\n    table.create_arrays(2)\n\n    # Now table.array can be filled with data\n    table.array[0] = ('test1.xml', [[1, 0], [0, 1]])\n    table.array[1] = ('test2.xml', [[0.5, 0.3], [0.2, 0.1]])\n\n    assert table.array[0][0] == 'test1.xml'"},{"col":4,"comment":"null","endLoc":3263,"header":"def _add_timesys(self, iterator, tag, data, config, pos)","id":6853,"name":"_add_timesys","nodeType":"Function","startLoc":3260,"text":"def _add_timesys(self, iterator, tag, data, config, pos):\n        timesys = TimeSys(config=config, pos=pos, **data)\n        self.time_systems.append(timesys)\n        timesys.parse(iterator, config)"},{"col":4,"comment":"null","endLoc":348,"header":"def test_conf_pedantic_true(self, tmpdir)","id":6854,"name":"test_conf_pedantic_true","nodeType":"Function","startLoc":337,"text":"def test_conf_pedantic_true(self, tmpdir):\n\n        with set_temp_config(tmpdir.strpath):\n\n            with open(tmpdir.join('astropy').join('astropy.cfg').strpath, 'w') as f:\n                f.write('[io.votable]\\npedantic = True')\n\n            reload_config('astropy.io.votable')\n\n            with pytest.warns(AstropyDeprecationWarning):\n                with pytest.raises(VOWarning):\n                    parse(get_pkg_data_filename('data/gemini.xml'))"},{"col":4,"comment":"null","endLoc":39,"header":"def __init__(self, url, root='results', timeout=10)","id":6855,"name":"__init__","nodeType":"Function","startLoc":28,"text":"def __init__(self, url, root='results', timeout=10):\n        self.url = url\n        m = hashlib.md5()\n        m.update(url)\n        self._hash = m.hexdigest()\n        self._root = root\n        self._path = os.path.join(\n            self._hash[0:2], self._hash[2:4], self._hash[4:])\n        if not os.path.exists(self.get_dirpath()):\n            os.makedirs(self.get_dirpath())\n        self.timeout = timeout\n        self.load_attributes()"},{"col":4,"comment":"\n        Sets the attributes of a given `astropy.table.Column` instance\n        to match the information in this `Field`.\n        ","endLoc":1545,"header":"def to_table_column(self, column)","id":6856,"name":"to_table_column","nodeType":"Function","startLoc":1521,"text":"def to_table_column(self, column):\n        \"\"\"\n        Sets the attributes of a given `astropy.table.Column` instance\n        to match the information in this `Field`.\n        \"\"\"\n        for key in ['ucd', 'width', 'precision', 'utype', 'xtype']:\n            val = getattr(self, key, None)\n            if val is not None:\n                column.meta[key] = val\n        if not self.values.is_defaults():\n            self.values.to_table_column(column)\n        for link in self.links:\n            link.to_table_column(column)\n        if self.description is not None:\n            column.description = self.description\n        if self.unit is not None:\n            # TODO: Use units framework when it's available\n            column.unit = self.unit\n        if (isinstance(self.converter, converters.FloatingPoint) and\n                self.converter.output_format != '{!r:>}'):\n            column.format = self.converter.output_format\n        elif isinstance(self.converter, converters.Char):\n            column.info.meta['_votable_string_dtype'] = 'char'\n        elif isinstance(self.converter, converters.UnicodeChar):\n            column.info.meta['_votable_string_dtype'] = 'unicodeChar'"},{"col":4,"comment":"null","endLoc":3268,"header":"def _add_resource(self, iterator, tag, data, config, pos)","id":6857,"name":"_add_resource","nodeType":"Function","startLoc":3265,"text":"def _add_resource(self, iterator, tag, data, config, pos):\n        resource = Resource(config=config, pos=pos, **data)\n        self.resources.append(resource)\n        resource.parse(self._votable, iterator, config)"},{"col":0,"comment":"null","endLoc":75,"header":"def test_table(tmpdir)","id":6858,"name":"test_table","nodeType":"Function","startLoc":24,"text":"def test_table(tmpdir):\n    # Read the VOTABLE\n    votable = parse(get_pkg_data_filename('data/regression.xml'))\n    table = votable.get_first_table()\n    astropy_table = table.to_table()\n\n    for name in table.array.dtype.names:\n        assert np.all(astropy_table.mask[name] == table.array.mask[name])\n\n    votable2 = tree.VOTableFile.from_table(astropy_table)\n    t = votable2.get_first_table()\n\n    field_types = [\n        ('string_test', {'datatype': 'char', 'arraysize': '*'}),\n        ('string_test_2', {'datatype': 'char', 'arraysize': '10'}),\n        ('unicode_test', {'datatype': 'unicodeChar', 'arraysize': '*'}),\n        ('fixed_unicode_test', {'datatype': 'unicodeChar', 'arraysize': '10'}),\n        ('string_array_test', {'datatype': 'char', 'arraysize': '4'}),\n        ('unsignedByte', {'datatype': 'unsignedByte'}),\n        ('short', {'datatype': 'short'}),\n        ('int', {'datatype': 'int'}),\n        ('long', {'datatype': 'long'}),\n        ('double', {'datatype': 'double'}),\n        ('float', {'datatype': 'float'}),\n        ('array', {'datatype': 'long', 'arraysize': '2*'}),\n        ('bit', {'datatype': 'bit'}),\n        ('bitarray', {'datatype': 'bit', 'arraysize': '3x2'}),\n        ('bitvararray', {'datatype': 'bit', 'arraysize': '*'}),\n        ('bitvararray2', {'datatype': 'bit', 'arraysize': '3x2*'}),\n        ('floatComplex', {'datatype': 'floatComplex'}),\n        ('doubleComplex', {'datatype': 'doubleComplex'}),\n        ('doubleComplexArray', {'datatype': 'doubleComplex', 'arraysize': '*'}),\n        ('doubleComplexArrayFixed', {'datatype': 'doubleComplex', 'arraysize': '2'}),\n        ('boolean', {'datatype': 'bit'}),\n        ('booleanArray', {'datatype': 'bit', 'arraysize': '4'}),\n        ('nulls', {'datatype': 'int'}),\n        ('nulls_array', {'datatype': 'int', 'arraysize': '2x2'}),\n        ('precision1', {'datatype': 'double'}),\n        ('precision2', {'datatype': 'double'}),\n        ('doublearray', {'datatype': 'double', 'arraysize': '*'}),\n        ('bitarray2', {'datatype': 'bit', 'arraysize': '16'})]\n\n    for field, type in zip(t.fields, field_types):\n        name, d = type\n        assert field.ID == name\n        assert field.datatype == d['datatype'], f'{name} expected {d[\"datatype\"]} but get {field.datatype}'  # noqa\n        if 'arraysize' in d:\n            assert field.arraysize == d['arraysize']\n\n    # W39: Bit values can not be masked\n    with pytest.warns(W39):\n        writeto(votable2, os.path.join(str(tmpdir), \"through_table.xml\"))"},{"attributeType":"null","col":4,"comment":"null","endLoc":1145,"id":6859,"name":"_attr_list_11","nodeType":"Attribute","startLoc":1145,"text":"_attr_list_11"},{"col":0,"comment":"null","endLoc":878,"header":"def test_fileobj()","id":6860,"name":"test_fileobj","nodeType":"Function","startLoc":869,"text":"def test_fileobj():\n    # Assert that what we get back is a raw C file pointer\n    # so it will be super fast in the C extension.\n    from astropy.utils.xml import iterparser\n    filename = get_pkg_data_filename('data/regression.xml')\n    with iterparser._convert_to_fd_or_read_function(filename) as fd:\n        if sys.platform == 'win32':\n            fd()\n        else:\n            assert isinstance(fd, io.FileIO)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1147,"id":6861,"name":"_attr_list_12","nodeType":"Attribute","startLoc":1147,"text":"_attr_list_12"},{"attributeType":"null","col":4,"comment":"null","endLoc":1148,"id":6862,"name":"_element_name","nodeType":"Attribute","startLoc":1148,"text":"_element_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":1226,"id":6863,"name":"arraysize","nodeType":"Attribute","startLoc":1226,"text":"self.arraysize"},{"col":0,"comment":"null","endLoc":893,"header":"def test_nonstandard_units()","id":6864,"name":"test_nonstandard_units","nodeType":"Function","startLoc":881,"text":"def test_nonstandard_units():\n    from astropy import units as u\n\n    votable = parse(get_pkg_data_filename('data/nonstandard_units.xml'))\n\n    assert isinstance(\n        votable.get_first_table().fields[0].unit, u.UnrecognizedUnit)\n\n    votable = parse(get_pkg_data_filename('data/nonstandard_units.xml'),\n                    unit_format='generic')\n\n    assert not isinstance(\n        votable.get_first_table().fields[0].unit, u.UnrecognizedUnit)"},{"attributeType":"HomogeneousList","col":8,"comment":"null","endLoc":1233,"id":6865,"name":"_links","nodeType":"Attribute","startLoc":1233,"text":"self._links"},{"attributeType":"None","col":8,"comment":"null","endLoc":1327,"id":6866,"name":"_precision","nodeType":"Attribute","startLoc":1327,"text":"self._precision"},{"col":4,"comment":"null","endLoc":3273,"header":"def _add_link(self, iterator, tag, data, config, pos)","id":6867,"name":"_add_link","nodeType":"Function","startLoc":3270,"text":"def _add_link(self, iterator, tag, data, config, pos):\n        link = Link(config=config, pos=pos, **data)\n        self.links.append(link)\n        link.parse(iterator, config)"},{"col":4,"comment":"\n        Recursively iterate over all FIELD and PARAM elements in the\n        TABLE.\n        ","endLoc":3050,"header":"def iter_fields_and_params(self)","id":6868,"name":"iter_fields_and_params","nodeType":"Function","startLoc":3039,"text":"def iter_fields_and_params(self):\n        \"\"\"\n        Recursively iterate over all FIELD and PARAM elements in the\n        TABLE.\n        \"\"\"\n        for param in self.params:\n            yield param\n        for field in self.fields:\n            yield field\n        for group in self.groups:\n            for field in group.iter_fields_and_params():\n                yield field"},{"col":4,"comment":"\n        Recursively iterate over all GROUP elements in the TABLE.\n        ","endLoc":3078,"header":"def iter_groups(self)","id":6869,"name":"iter_groups","nodeType":"Function","startLoc":3071,"text":"def iter_groups(self):\n        \"\"\"\n        Recursively iterate over all GROUP elements in the TABLE.\n        \"\"\"\n        for group in self.groups:\n            yield group\n            for g in group.iter_groups():\n                yield g"},{"col":4,"comment":"null","endLoc":3096,"header":"def iter_info(self)","id":6870,"name":"iter_info","nodeType":"Function","startLoc":3094,"text":"def iter_info(self):\n        for info in self.infos:\n            yield info"},{"attributeType":"null","col":4,"comment":"null","endLoc":3052,"id":6871,"name":"get_field_by_id","nodeType":"Attribute","startLoc":3052,"text":"get_field_by_id"},{"col":0,"comment":"null","endLoc":940,"header":"def test_resource_structure()","id":6872,"name":"test_resource_structure","nodeType":"Function","startLoc":896,"text":"def test_resource_structure():\n    # Based on issue #1223, as reported by @astro-friedel and @RayPlante\n    from astropy.io.votable import tree as vot\n\n    vtf = vot.VOTableFile()\n\n    r1 = vot.Resource()\n    vtf.resources.append(r1)\n    t1 = vot.Table(vtf)\n    t1.name = \"t1\"\n    t2 = vot.Table(vtf)\n    t2.name = 't2'\n    r1.tables.append(t1)\n    r1.tables.append(t2)\n\n    r2 = vot.Resource()\n    vtf.resources.append(r2)\n    t3 = vot.Table(vtf)\n    t3.name = \"t3\"\n    t4 = vot.Table(vtf)\n    t4.name = \"t4\"\n    r2.tables.append(t3)\n    r2.tables.append(t4)\n\n    r3 = vot.Resource()\n    vtf.resources.append(r3)\n    t5 = vot.Table(vtf)\n    t5.name = \"t5\"\n    t6 = vot.Table(vtf)\n    t6.name = \"t6\"\n    r3.tables.append(t5)\n    r3.tables.append(t6)\n\n    buff = io.BytesIO()\n    vtf.to_xml(buff)\n\n    buff.seek(0)\n    vtf2 = parse(buff)\n\n    assert len(vtf2.resources) == 3\n\n    for r in range(len(vtf2.resources)):\n        res = vtf2.resources[r]\n        assert len(res.tables) == 2\n        assert len(res.resources) == 0"},{"attributeType":"null","col":4,"comment":"null","endLoc":3058,"id":6873,"name":"get_field_by_id_or_name","nodeType":"Attribute","startLoc":3058,"text":"get_field_by_id_or_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":1230,"id":6874,"name":"precision","nodeType":"Attribute","startLoc":1230,"text":"self.precision"},{"attributeType":"null","col":4,"comment":"null","endLoc":3064,"id":6875,"name":"get_fields_by_utype","nodeType":"Attribute","startLoc":3064,"text":"get_fields_by_utype"},{"attributeType":"null","col":4,"comment":"null","endLoc":3080,"id":6876,"name":"get_group_by_id","nodeType":"Attribute","startLoc":3080,"text":"get_group_by_id"},{"attributeType":"Values","col":8,"comment":"null","endLoc":1235,"id":6877,"name":"values","nodeType":"Attribute","startLoc":1235,"text":"self.values"},{"attributeType":"null","col":4,"comment":"null","endLoc":3087,"id":6878,"name":"get_groups_by_utype","nodeType":"Attribute","startLoc":3087,"text":"get_groups_by_utype"},{"attributeType":"null","col":8,"comment":"null","endLoc":2184,"id":6879,"name":"_links","nodeType":"Attribute","startLoc":2184,"text":"self._links"},{"col":4,"comment":"null","endLoc":48,"header":"def get_dirpath(self)","id":6880,"name":"get_dirpath","nodeType":"Function","startLoc":47,"text":"def get_dirpath(self):\n        return os.path.join(self._root, self._path)"},{"attributeType":"Converter","col":8,"comment":"null","endLoc":1282,"id":6881,"name":"converter","nodeType":"Attribute","startLoc":1282,"text":"self.converter"},{"attributeType":"null","col":8,"comment":"null","endLoc":2172,"id":6882,"name":"utype","nodeType":"Attribute","startLoc":2172,"text":"self.utype"},{"col":4,"comment":"null","endLoc":72,"header":"def load_attributes(self)","id":6883,"name":"load_attributes","nodeType":"Function","startLoc":61,"text":"def load_attributes(self):\n        path = self.get_attribute_path()\n        if os.path.exists(path):\n            try:\n                with open(path, 'rb') as fd:\n                    self._attributes = pickle.load(fd)\n            except Exception:\n                shutil.rmtree(self.get_dirpath())\n                os.makedirs(self.get_dirpath())\n                self._attributes = {}\n        else:\n            self._attributes = {}"},{"col":4,"comment":"null","endLoc":54,"header":"def get_attribute_path(self)","id":6884,"name":"get_attribute_path","nodeType":"Function","startLoc":53,"text":"def get_attribute_path(self):\n        return os.path.join(self.get_dirpath(), \"values.dat\")"},{"attributeType":"null","col":8,"comment":"null","endLoc":1231,"id":6885,"name":"utype","nodeType":"Attribute","startLoc":1231,"text":"self.utype"},{"attributeType":"None","col":8,"comment":"null","endLoc":1187,"id":6886,"name":"description","nodeType":"Attribute","startLoc":1187,"text":"self.description"},{"col":0,"comment":"null","endLoc":49,"header":"def download(args)","id":6887,"name":"download","nodeType":"Function","startLoc":46,"text":"def download(args):\n    url, destdir = args\n    with result.Result(url, root=destdir) as r:\n        r.download_xml_content()"},{"attributeType":"null","col":8,"comment":"null","endLoc":1232,"id":6888,"name":"type","nodeType":"Attribute","startLoc":1232,"text":"self.type"},{"col":4,"comment":"null","endLoc":3303,"header":"def parse(self, votable, iterator, config)","id":6889,"name":"parse","nodeType":"Function","startLoc":3275,"text":"def parse(self, votable, iterator, config):\n        self._votable = votable\n\n        tag_mapping = {\n            'TABLE': self._add_table,\n            'INFO': self._add_info,\n            'PARAM': self._add_param,\n            'GROUP': self._add_group,\n            'COOSYS': self._add_coosys,\n            'TIMESYS': self._add_timesys,\n            'RESOURCE': self._add_resource,\n            'LINK': self._add_link,\n            'DESCRIPTION': self._ignore_add\n            }\n\n        for start, tag, data, pos in iterator:\n            if start:\n                tag_mapping.get(tag, self._add_unknown_tag)(\n                    iterator, tag, data, config, pos)\n            elif tag == 'DESCRIPTION':\n                if self.description is not None:\n                    warn_or_raise(W17, W17, 'RESOURCE', config, pos)\n                self.description = data or None\n            elif tag == 'RESOURCE':\n                break\n\n        del self._votable\n\n        return self"},{"col":4,"comment":"null","endLoc":136,"header":"def download_xml_content(self)","id":6890,"name":"download_xml_content","nodeType":"Function","startLoc":90,"text":"def download_xml_content(self):\n        path = self.get_vo_xml_path()\n\n        if 'network_error' not in self._attributes:\n            self['network_error'] = None\n\n        if os.path.exists(path):\n            return\n\n        def fail(reason):\n            reason = str(reason)\n            with open(path, 'wb') as fd:\n                fd.write(f'FAILED: {reason}\\n'.encode('utf-8'))\n            self['network_error'] = reason\n\n        r = None\n        try:\n            r = urllib.request.urlopen(\n                self.url.decode('ascii'), timeout=self.timeout)\n        except urllib.error.URLError as e:\n            if hasattr(e, 'reason'):\n                reason = e.reason\n            else:\n                reason = e.code\n            fail(reason)\n            return\n        except http.client.HTTPException as e:\n            fail(f\"HTTPException: {str(e)}\")\n            return\n        except (socket.timeout, socket.error) as e:\n            fail(\"Timeout\")\n            return\n\n        if r is None:\n            fail(\"Invalid URL\")\n            return\n\n        try:\n            content = r.read()\n        except socket.timeout as e:\n            fail(\"Timeout\")\n            return\n        else:\n            r.close()\n\n        with open(path, 'wb') as fd:\n            fd.write(content)"},{"col":0,"comment":"null","endLoc":96,"header":"def test_read_through_table_interface(tmpdir)","id":6891,"name":"test_read_through_table_interface","nodeType":"Function","startLoc":78,"text":"def test_read_through_table_interface(tmpdir):\n    with get_pkg_data_fileobj('data/regression.xml', encoding='binary') as fd:\n        t = Table.read(fd, format='votable', table_id='main_table')\n\n    assert len(t) == 5\n\n    # Issue 8354\n    assert t['float'].format is None\n\n    fn = os.path.join(str(tmpdir), \"table_interface.xml\")\n\n    # W39: Bit values can not be masked\n    with pytest.warns(W39):\n        t.write(fn, table_id='FOO', format='votable')\n\n    with open(fn, 'rb') as fd:\n        t2 = Table.read(fd, format='votable', table_id='FOO')\n\n    assert len(t2) == 5"},{"attributeType":"null","col":8,"comment":"null","endLoc":1234,"id":6892,"name":"title","nodeType":"Attribute","startLoc":1234,"text":"self.title"},{"col":4,"comment":"null","endLoc":57,"header":"def get_vo_xml_path(self)","id":6893,"name":"get_vo_xml_path","nodeType":"Function","startLoc":56,"text":"def get_vo_xml_path(self):\n        return os.path.join(self.get_dirpath(), \"vo.xml\")"},{"col":4,"comment":"null","endLoc":3315,"header":"def to_xml(self, w, **kwargs)","id":6894,"name":"to_xml","nodeType":"Function","startLoc":3305,"text":"def to_xml(self, w, **kwargs):\n        attrs = w.object_attrs(self, ('ID', 'type', 'utype'))\n        attrs.update(self.extra_attributes)\n        with w.tag('RESOURCE', attrib=attrs):\n            if self.description is not None:\n                w.element(\"DESCRIPTION\", self.description, wrap=True)\n            for element_set in (self.coordinate_systems, self.time_systems,\n                                self.params, self.infos, self.links,\n                                self.tables, self.resources):\n                for element in element_set:\n                    element.to_xml(w, **kwargs)"},{"attributeType":"{get} | None","col":8,"comment":"null","endLoc":1160,"id":6895,"name":"_config","nodeType":"Attribute","startLoc":1160,"text":"self._config"},{"attributeType":"null","col":8,"comment":"null","endLoc":1224,"id":6896,"name":"ref","nodeType":"Attribute","startLoc":1224,"text":"self.ref"},{"attributeType":"null","col":8,"comment":"null","endLoc":2179,"id":6897,"name":"format","nodeType":"Attribute","startLoc":2179,"text":"self.format"},{"col":4,"comment":"\n        Recursively iterates over all tables in the resource and\n        nested resources.\n        ","endLoc":3326,"header":"def iter_tables(self)","id":6898,"name":"iter_tables","nodeType":"Function","startLoc":3317,"text":"def iter_tables(self):\n        \"\"\"\n        Recursively iterates over all tables in the resource and\n        nested resources.\n        \"\"\"\n        for table in self.tables:\n            yield table\n        for resource in self.resources:\n            for table in resource.iter_tables():\n                yield table"},{"attributeType":"None","col":12,"comment":"null","endLoc":1385,"id":6900,"name":"_unit","nodeType":"Attribute","startLoc":1385,"text":"self._unit"},{"attributeType":"Values","col":8,"comment":"null","endLoc":1458,"id":6901,"name":"_values","nodeType":"Attribute","startLoc":1458,"text":"self._values"},{"attributeType":"{__eq__}","col":8,"comment":"null","endLoc":1225,"id":6902,"name":"datatype","nodeType":"Attribute","startLoc":1225,"text":"self.datatype"},{"col":4,"comment":"\n        Recursively iterates over all FIELD_ and PARAM_ elements in\n        the resource, its tables and nested resources.\n        ","endLoc":3340,"header":"def iter_fields_and_params(self)","id":6903,"name":"iter_fields_and_params","nodeType":"Function","startLoc":3328,"text":"def iter_fields_and_params(self):\n        \"\"\"\n        Recursively iterates over all FIELD_ and PARAM_ elements in\n        the resource, its tables and nested resources.\n        \"\"\"\n        for param in self.params:\n            yield param\n        for table in self.tables:\n            for param in table.iter_fields_and_params():\n                yield param\n        for resource in self.resources:\n            for param in resource.iter_fields_and_params():\n                yield param"},{"col":4,"comment":"\n        Recursively iterates over all the COOSYS_ elements in the\n        resource and nested resources.\n        ","endLoc":3351,"header":"def iter_coosys(self)","id":6904,"name":"iter_coosys","nodeType":"Function","startLoc":3342,"text":"def iter_coosys(self):\n        \"\"\"\n        Recursively iterates over all the COOSYS_ elements in the\n        resource and nested resources.\n        \"\"\"\n        for coosys in self.coordinate_systems:\n            yield coosys\n        for resource in self.resources:\n            for coosys in resource.iter_coosys():\n                yield coosys"},{"col":4,"comment":"\n        Recursively iterates over all the TIMESYS_ elements in the\n        resource and nested resources.\n        ","endLoc":3362,"header":"def iter_timesys(self)","id":6905,"name":"iter_timesys","nodeType":"Function","startLoc":3353,"text":"def iter_timesys(self):\n        \"\"\"\n        Recursively iterates over all the TIMESYS_ elements in the\n        resource and nested resources.\n        \"\"\"\n        for timesys in self.time_systems:\n            yield timesys\n        for resource in self.resources:\n            for timesys in resource.iter_timesys():\n                yield timesys"},{"col":4,"comment":"\n        Recursively iterates over all the INFO_ elements in the\n        resource and nested resources.\n        ","endLoc":3376,"header":"def iter_info(self)","id":6906,"name":"iter_info","nodeType":"Function","startLoc":3364,"text":"def iter_info(self):\n        \"\"\"\n        Recursively iterates over all the INFO_ elements in the\n        resource and nested resources.\n        \"\"\"\n        for info in self.infos:\n            yield info\n        for table in self.tables:\n            for info in table.iter_info():\n                yield info\n        for resource in self.resources:\n            for info in resource.iter_info():\n                yield info"},{"col":0,"comment":"null","endLoc":55,"header":"def validate_vo(args)","id":6907,"name":"validate_vo","nodeType":"Function","startLoc":52,"text":"def validate_vo(args):\n    url, destdir = args\n    with result.Result(url, root=destdir) as r:\n        r.validate_vo()"},{"col":0,"comment":"null","endLoc":103,"header":"def test_read_through_table_interface2()","id":6908,"name":"test_read_through_table_interface2","nodeType":"Function","startLoc":99,"text":"def test_read_through_table_interface2():\n    with get_pkg_data_fileobj('data/regression.xml', encoding='binary') as fd:\n        t = Table.read(fd, format='votable', table_id='last_table')\n\n    assert len(t) == 0"},{"attributeType":"null","col":8,"comment":"null","endLoc":3124,"id":6909,"name":"_time_systems","nodeType":"Attribute","startLoc":3124,"text":"self._time_systems"},{"attributeType":"null","col":8,"comment":"null","endLoc":2178,"id":6910,"name":"description","nodeType":"Attribute","startLoc":2178,"text":"self.description"},{"col":4,"comment":"null","endLoc":203,"header":"def validate_vo(self)","id":6911,"name":"validate_vo","nodeType":"Function","startLoc":146,"text":"def validate_vo(self):\n        path = self.get_vo_xml_path()\n        if not os.path.exists(path):\n            self.download_xml_content()\n        self['version'] = ''\n        if 'network_error' in self and self['network_error'] is not None:\n            self['nwarnings'] = 0\n            self['nexceptions'] = 0\n            self['warnings'] = []\n            self['xmllint'] = None\n            self['warning_types'] = set()\n            return\n\n        nexceptions = 0\n        nwarnings = 0\n        t = None\n        lines = []\n        with open(path, 'rb') as input:\n            with warnings.catch_warnings(record=True) as warning_lines:\n                try:\n                    t = table.parse(input, verify='warn', filename=path)\n                except (ValueError, TypeError, ExpatError) as e:\n                    lines.append(str(e))\n                    nexceptions += 1\n        lines = [str(x.message) for x in warning_lines] + lines\n\n        if t is not None:\n            self['version'] = version = t.version\n        else:\n            self['version'] = version = \"1.0\"\n\n        if 'xmllint' not in self:\n            # Now check the VO schema based on the version in\n            # the file.\n            try:\n                success, stdout, stderr = xmlutil.validate_schema(path, version)\n            # OSError is raised when XML file eats all memory and\n            # system sends kill signal.\n            except OSError as e:\n                self['xmllint'] = None\n                self['xmllint_content'] = str(e)\n            else:\n                self['xmllint'] = (success == 0)\n                self['xmllint_content'] = stderr\n\n        warning_types = set()\n        for line in lines:\n            w = exceptions.parse_vowarning(line)\n            if w['is_warning']:\n                nwarnings += 1\n            if w['is_exception']:\n                nexceptions += 1\n            warning_types.add(w['warning'])\n\n        self['nwarnings'] = nwarnings\n        self['nexceptions'] = nexceptions\n        self['warnings'] = lines\n        self['warning_types'] = warning_types"},{"attributeType":"null","col":8,"comment":"null","endLoc":3129,"id":6912,"name":"_tables","nodeType":"Attribute","startLoc":3129,"text":"self._tables"},{"col":0,"comment":"null","endLoc":110,"header":"def test_pass_kwargs_through_table_interface()","id":6913,"name":"test_pass_kwargs_through_table_interface","nodeType":"Function","startLoc":106,"text":"def test_pass_kwargs_through_table_interface():\n    # Table.read() should pass on keyword arguments meant for parse()\n    filename = get_pkg_data_filename('data/nonstandard_units.xml')\n    t = Table.read(filename, format='votable', unit_format='generic')\n    assert t['Flux1'].unit == Unit(\"erg / (Angstrom cm2 s)\")"},{"attributeType":"null","col":8,"comment":"null","endLoc":3128,"id":6914,"name":"_links","nodeType":"Attribute","startLoc":3128,"text":"self._links"},{"attributeType":"null","col":8,"comment":"null","endLoc":3120,"id":6915,"name":"_extra_attributes","nodeType":"Attribute","startLoc":3120,"text":"self._extra_attributes"},{"col":0,"comment":"null","endLoc":971,"header":"def test_no_resource_check()","id":6916,"name":"test_no_resource_check","nodeType":"Function","startLoc":943,"text":"def test_no_resource_check():\n    output = io.StringIO()\n\n    # We can't test xmllint, because we can't rely on it being on the\n    # user's machine.\n    result = validate(get_pkg_data_filename('data/no_resource.xml'),\n                      output, xmllint=False)\n\n    assert result is False\n\n    output.seek(0)\n    output = output.readlines()\n\n    # Uncomment to generate new groundtruth\n    # with open('no_resource.txt', 'wt', encoding='utf-8') as fd:\n    #     fd.write(u''.join(output))\n\n    with open(\n        get_pkg_data_filename('data/no_resource.txt'),\n            'rt', encoding='utf-8') as fd:\n        truth = fd.readlines()\n\n    truth = truth[1:]\n    output = output[1:-1]\n\n    sys.stdout.writelines(\n        difflib.unified_diff(truth, output, fromfile='truth', tofile='output'))\n\n    assert truth == output"},{"attributeType":"null","col":8,"comment":"null","endLoc":2181,"id":6917,"name":"_fields","nodeType":"Attribute","startLoc":2181,"text":"self._fields"},{"attributeType":"null","col":8,"comment":"null","endLoc":3118,"id":6918,"name":"utype","nodeType":"Attribute","startLoc":3118,"text":"self.utype"},{"attributeType":"null","col":8,"comment":"null","endLoc":3159,"id":6919,"name":"_type","nodeType":"Attribute","startLoc":3159,"text":"self._type"},{"attributeType":"null","col":8,"comment":"null","endLoc":3121,"id":6920,"name":"description","nodeType":"Attribute","startLoc":3121,"text":"self.description"},{"attributeType":"null","col":8,"comment":"null","endLoc":2159,"id":6921,"name":"_config","nodeType":"Attribute","startLoc":2159,"text":"self._config"},{"col":0,"comment":"null","endLoc":122,"header":"def test_names_over_ids()","id":6922,"name":"test_names_over_ids","nodeType":"Function","startLoc":113,"text":"def test_names_over_ids():\n    with get_pkg_data_fileobj('data/names.xml', encoding='binary') as fd:\n        votable = parse(fd)\n\n    table = votable.get_first_table().to_table(use_names_over_ids=True)\n\n    assert table.colnames == [\n        'Name', 'GLON', 'GLAT', 'RAdeg', 'DEdeg', 'Jmag', 'Hmag', 'Kmag',\n        'G3.6mag', 'G4.5mag', 'G5.8mag', 'G8.0mag', '4.5mag', '8.0mag',\n        'Emag', '24mag', 'f_Name']"},{"attributeType":"null","col":8,"comment":"null","endLoc":3130,"id":6923,"name":"_resources","nodeType":"Attribute","startLoc":3130,"text":"self._resources"},{"col":0,"comment":"null","endLoc":977,"header":"def test_instantiate_vowarning()","id":6924,"name":"test_instantiate_vowarning","nodeType":"Function","startLoc":974,"text":"def test_instantiate_vowarning():\n    # This used to raise a deprecation exception.\n    # See https://github.com/astropy/astroquery/pull/276\n    VOWarning(())"},{"attributeType":"null","col":8,"comment":"null","endLoc":3119,"id":6925,"name":"type","nodeType":"Attribute","startLoc":3119,"text":"self.type"},{"attributeType":"null","col":8,"comment":"null","endLoc":1309,"id":6926,"name":"_datatype","nodeType":"Attribute","startLoc":1309,"text":"self._datatype"},{"attributeType":"null","col":8,"comment":"null","endLoc":3112,"id":6927,"name":"_config","nodeType":"Attribute","startLoc":3112,"text":"self._config"},{"attributeType":"null","col":8,"comment":"null","endLoc":2161,"id":6928,"name":"_empty","nodeType":"Attribute","startLoc":2161,"text":"self._empty"},{"col":0,"comment":"null","endLoc":133,"header":"def test_explicit_ids()","id":6929,"name":"test_explicit_ids","nodeType":"Function","startLoc":125,"text":"def test_explicit_ids():\n    with get_pkg_data_fileobj('data/names.xml', encoding='binary') as fd:\n        votable = parse(fd)\n\n    table = votable.get_first_table().to_table(use_names_over_ids=False)\n\n    assert table.colnames == [\n        'col1', 'col2', 'col3', 'col4', 'col5', 'col6', 'col7', 'col8', 'col9',\n        'col10', 'col11', 'col12', 'col13', 'col14', 'col15', 'col16', 'col17']"},{"attributeType":"null","col":8,"comment":"null","endLoc":3127,"id":6930,"name":"_infos","nodeType":"Attribute","startLoc":3127,"text":"self._infos"},{"col":0,"comment":"null","endLoc":985,"header":"def test_custom_datatype()","id":6931,"name":"test_custom_datatype","nodeType":"Function","startLoc":980,"text":"def test_custom_datatype():\n    votable = parse(get_pkg_data_filename('data/custom_datatype.xml'),\n                    datatype_mapping={'bar': 'int'})\n\n    table = votable.get_first_table()\n    assert table.array.dtype['foo'] == np.int32"},{"attributeType":"null","col":8,"comment":"null","endLoc":2185,"id":6932,"name":"_infos","nodeType":"Attribute","startLoc":2185,"text":"self._infos"},{"attributeType":"null","col":8,"comment":"null","endLoc":3116,"id":6933,"name":"name","nodeType":"Attribute","startLoc":3116,"text":"self.name"},{"col":0,"comment":"\n    Issue #927\n    ","endLoc":143,"header":"def test_table_read_with_unnamed_tables()","id":6934,"name":"test_table_read_with_unnamed_tables","nodeType":"Function","startLoc":136,"text":"def test_table_read_with_unnamed_tables():\n    \"\"\"\n    Issue #927\n    \"\"\"\n    with get_pkg_data_fileobj('data/names.xml', encoding='binary') as fd:\n        t = Table.read(fd, format='votable')\n\n    assert len(t) == 1"},{"attributeType":"null","col":8,"comment":"null","endLoc":3113,"id":6935,"name":"_pos","nodeType":"Attribute","startLoc":3113,"text":"self._pos"},{"col":0,"comment":"null","endLoc":1009,"header":"def _timesys_tests(votable)","id":6936,"name":"_timesys_tests","nodeType":"Function","startLoc":988,"text":"def _timesys_tests(votable):\n    assert len(list(votable.iter_timesys())) == 4\n\n    timesys = votable.get_timesys_by_id('time_frame')\n    assert timesys.timeorigin == 2455197.5\n    assert timesys.timescale == 'TCB'\n    assert timesys.refposition == 'BARYCENTER'\n\n    timesys = votable.get_timesys_by_id('mjd_origin')\n    assert timesys.timeorigin == 'MJD-origin'\n    assert timesys.timescale == 'TDB'\n    assert timesys.refposition == 'EMBARYCENTER'\n\n    timesys = votable.get_timesys_by_id('jd_origin')\n    assert timesys.timeorigin == 'JD-origin'\n    assert timesys.timescale == 'TT'\n    assert timesys.refposition == 'HELIOCENTER'\n\n    timesys = votable.get_timesys_by_id('no_origin')\n    assert timesys.timeorigin is None\n    assert timesys.timescale == 'UTC'\n    assert timesys.refposition == 'TOPOCENTER'"},{"attributeType":"null","col":8,"comment":"null","endLoc":3123,"id":6937,"name":"_coordinate_systems","nodeType":"Attribute","startLoc":3123,"text":"self._coordinate_systems"},{"col":0,"comment":"\n    Testing when votable is passed as pathlib.Path object #4412.\n    ","endLoc":154,"header":"def test_votable_path_object()","id":6938,"name":"test_votable_path_object","nodeType":"Function","startLoc":146,"text":"def test_votable_path_object():\n    \"\"\"\n    Testing when votable is passed as pathlib.Path object #4412.\n    \"\"\"\n    fpath = pathlib.Path(get_pkg_data_filename('data/names.xml'))\n    table = parse(fpath).get_first_table().to_table()\n\n    assert len(table) == 1\n    assert int(table[0][3]) == 266"},{"attributeType":"null","col":8,"comment":"null","endLoc":3117,"id":6939,"name":"ID","nodeType":"Attribute","startLoc":3117,"text":"self.ID"},{"attributeType":"null","col":8,"comment":"null","endLoc":3125,"id":6940,"name":"_groups","nodeType":"Attribute","startLoc":3125,"text":"self._groups"},{"col":0,"comment":"null","endLoc":162,"header":"def test_from_table_without_mask()","id":6941,"name":"test_from_table_without_mask","nodeType":"Function","startLoc":157,"text":"def test_from_table_without_mask():\n    t = Table()\n    c = Column(data=[1, 2, 3], name='a')\n    t.add_column(c)\n    output = io.BytesIO()\n    t.write(output, format='votable')"},{"attributeType":"null","col":8,"comment":"null","endLoc":3126,"id":6942,"name":"_params","nodeType":"Attribute","startLoc":3126,"text":"self._params"},{"attributeType":"null","col":8,"comment":"null","endLoc":3276,"id":6943,"name":"_votable","nodeType":"Attribute","startLoc":3276,"text":"self._votable"},{"col":0,"comment":"null","endLoc":62,"header":"def votlint_validate(args)","id":6944,"name":"votlint_validate","nodeType":"Function","startLoc":58,"text":"def votlint_validate(args):\n    path_to_stilts_jar, url, destdir = args\n    with result.Result(url, root=destdir) as r:\n        if r['network_error'] is None:\n            r.validate_with_votlint(path_to_stilts_jar)"},{"col":0,"comment":"null","endLoc":1014,"header":"def test_timesys()","id":6945,"name":"test_timesys","nodeType":"Function","startLoc":1012,"text":"def test_timesys():\n    votable = parse(get_pkg_data_filename('data/timesys.xml'))\n    _timesys_tests(votable)"},{"col":0,"comment":"null","endLoc":1023,"header":"def test_timesys_roundtrip()","id":6946,"name":"test_timesys_roundtrip","nodeType":"Function","startLoc":1017,"text":"def test_timesys_roundtrip():\n    orig_votable = parse(get_pkg_data_filename('data/timesys.xml'))\n    bio = io.BytesIO()\n    orig_votable.to_xml(bio)\n    bio.seek(0)\n    votable = parse(bio)\n    _timesys_tests(votable)"},{"col":0,"comment":"null","endLoc":18,"header":"def test_check_astroyear_fail()","id":6947,"name":"test_check_astroyear_fail","nodeType":"Function","startLoc":14,"text":"def test_check_astroyear_fail():\n    config = {'verify': 'exception'}\n    field = tree.Field(None, name='astroyear', arraysize='1')\n    with pytest.raises(W07):\n        tree.check_astroyear('X2100', field, config)"},{"col":0,"comment":"null","endLoc":1034,"header":"def test_timesys_errors()","id":6948,"name":"test_timesys_errors","nodeType":"Function","startLoc":1026,"text":"def test_timesys_errors():\n    output = io.StringIO()\n    validate(get_pkg_data_filename('data/timesys_errors.xml'), output,\n             xmllint=False)\n    outstr = output.getvalue()\n    assert(\"E23: Invalid timeorigin attribute 'bad-origin'\" in outstr)\n    assert(\"E22: ID attribute is required for all TIMESYS elements\" in outstr)\n    assert(\"W48: Unknown attribute 'refposition_mispelled' on TIMESYS\"\n           in outstr)"},{"attributeType":"{__eq__}","col":8,"comment":"null","endLoc":1227,"id":6949,"name":"ucd","nodeType":"Attribute","startLoc":1227,"text":"self.ucd"},{"attributeType":"null","col":16,"comment":"null","endLoc":17,"id":6950,"name":"np","nodeType":"Attribute","startLoc":17,"text":"np"},{"attributeType":"null","col":4,"comment":"null","endLoc":29,"id":6951,"name":"legacy_float_repr","nodeType":"Attribute","startLoc":29,"text":"legacy_float_repr"},{"attributeType":"function","col":12,"comment":"null","endLoc":2435,"id":6952,"name":"ref","nodeType":"Attribute","startLoc":2435,"text":"self.ref"},{"attributeType":"null","col":4,"comment":"null","endLoc":31,"id":6953,"name":"legacy_float_repr","nodeType":"Attribute","startLoc":31,"text":"legacy_float_repr"},{"col":0,"comment":"","endLoc":5,"header":"vo_test.py#<anonymous>","id":6954,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis is a set of regression tests for vo.\n\"\"\"\n\nif hasattr(sys, 'float_repr_style'):\n    legacy_float_repr = (sys.float_repr_style == 'legacy')\nelse:\n    legacy_float_repr = sys.platform.startswith('win')"},{"col":0,"comment":"\n    Raises a `~astropy.io.votable.exceptions.VOTableSpecError` if\n    *year* is not a valid astronomical year as defined by the VOTABLE\n    standard.\n\n    Parameters\n    ----------\n    year : str\n        An astronomical year string\n\n    field : str\n        The name of the field this year was found in (used for error\n        message)\n\n    config, pos : optional\n        Information about the source of the value\n    ","endLoc":214,"header":"def check_astroyear(year, field, config=None, pos=None)","id":6955,"name":"check_astroyear","nodeType":"Function","startLoc":192,"text":"def check_astroyear(year, field, config=None, pos=None):\n    \"\"\"\n    Raises a `~astropy.io.votable.exceptions.VOTableSpecError` if\n    *year* is not a valid astronomical year as defined by the VOTABLE\n    standard.\n\n    Parameters\n    ----------\n    year : str\n        An astronomical year string\n\n    field : str\n        The name of the field this year was found in (used for error\n        message)\n\n    config, pos : optional\n        Information about the source of the value\n    \"\"\"\n    if (year is not None and\n        re.match(r\"^[JB]?[0-9]+([.][0-9]*)?$\", year) is None):\n        warn_or_raise(W07, W07, (field, year), config, pos)\n        return False\n    return True"},{"col":4,"comment":"null","endLoc":233,"header":"def validate_with_votlint(self, path_to_stilts_jar)","id":6956,"name":"validate_with_votlint","nodeType":"Function","startLoc":223,"text":"def validate_with_votlint(self, path_to_stilts_jar):\n        filename = self.get_vo_xml_path()\n        p = subprocess.Popen(\n            f\"java -jar {path_to_stilts_jar} votlint validate=false {filename}\",\n            shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n        stdout, stderr = p.communicate()\n        if len(stdout) or p.returncode:\n            self['votlint'] = False\n        else:\n            self['votlint'] = True\n        self['votlint_content'] = stdout"},{"attributeType":"null","col":8,"comment":"null","endLoc":2187,"id":6957,"name":"array","nodeType":"Attribute","startLoc":2187,"text":"self.array"},{"col":0,"comment":"null","endLoc":24,"header":"def test_string_fail()","id":6958,"name":"test_string_fail","nodeType":"Function","startLoc":21,"text":"def test_string_fail():\n    config = {'verify': 'exception'}\n    with pytest.raises(W08):\n        tree.check_string(42, 'foo', config)"},{"fileName":"__init__.py","filePath":"astropy/io/votable/validator","id":6959,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom .main import make_validation_report\n\nfrom . import main\n__doc__ = main.__doc__\ndel main\n"},{"col":0,"comment":"null","endLoc":38,"header":"def test_make_Fields()","id":6960,"name":"test_make_Fields","nodeType":"Function","startLoc":27,"text":"def test_make_Fields():\n    votable = tree.VOTableFile()\n    # ...with one resource...\n    resource = tree.Resource()\n    votable.resources.append(resource)\n\n    # ... with one table\n    table = tree.Table(votable)\n    resource.tables.append(table)\n\n    table.fields.extend([tree.Field(\n        votable, name='Test', datatype=\"float\", unit=\"mag\")])"},{"col":0,"comment":"null","endLoc":182,"header":"def test_write_with_format()","id":6961,"name":"test_write_with_format","nodeType":"Function","startLoc":165,"text":"def test_write_with_format():\n    t = Table()\n    c = Column(data=[1, 2, 3], name='a')\n    t.add_column(c)\n\n    output = io.BytesIO()\n    t.write(output, format='votable', tabledata_format=\"binary\")\n    obuff = output.getvalue()\n    assert b'VOTABLE version=\"1.4\"' in obuff\n    assert b'BINARY' in obuff\n    assert b'TABLEDATA' not in obuff\n\n    output = io.BytesIO()\n    t.write(output, format='votable', tabledata_format=\"binary2\")\n    obuff = output.getvalue()\n    assert b'VOTABLE version=\"1.4\"' in obuff\n    assert b'BINARY2' in obuff\n    assert b'TABLEDATA' not in obuff"},{"col":0,"comment":"\n    Validates a large collection of web-accessible VOTable files.\n\n    Generates a report as a directory tree of HTML files.\n\n    Parameters\n    ----------\n    urls : list of str, optional\n        If provided, is a list of HTTP urls to download VOTable files\n        from.  If not provided, a built-in set of ~22,000 urls\n        compiled by HEASARC will be used.\n\n    destdir : path-like, optional\n        The directory to write the report to.  By default, this is a\n        directory called ``'results'`` in the current directory. If the\n        directory does not exist, it will be created.\n\n    multiprocess : bool, optional\n        If `True` (default), perform validations in parallel using all\n        of the cores on this machine.\n\n    stilts : path-like, optional\n        To perform validation with ``votlint`` from the the Java-based\n        `STILTS <http://www.star.bris.ac.uk/~mbt/stilts/>`_ VOTable\n        parser, in addition to `astropy.io.votable`, set this to the\n        path of the ``'stilts.jar'`` file.  ``java`` on the system shell\n        path will be used to run it.\n\n    Notes\n    -----\n    Downloads of each given URL will be performed only once and cached\n    locally in *destdir*.  To refresh the cache, remove *destdir*\n    first.\n    ","endLoc":160,"header":"def make_validation_report(\n    urls=None, destdir='astropy.io.votable.validator.results',\n    multiprocess=True, stilts=None)","id":6962,"name":"make_validation_report","nodeType":"Function","startLoc":76,"text":"def make_validation_report(\n    urls=None, destdir='astropy.io.votable.validator.results',\n    multiprocess=True, stilts=None):\n    \"\"\"\n    Validates a large collection of web-accessible VOTable files.\n\n    Generates a report as a directory tree of HTML files.\n\n    Parameters\n    ----------\n    urls : list of str, optional\n        If provided, is a list of HTTP urls to download VOTable files\n        from.  If not provided, a built-in set of ~22,000 urls\n        compiled by HEASARC will be used.\n\n    destdir : path-like, optional\n        The directory to write the report to.  By default, this is a\n        directory called ``'results'`` in the current directory. If the\n        directory does not exist, it will be created.\n\n    multiprocess : bool, optional\n        If `True` (default), perform validations in parallel using all\n        of the cores on this machine.\n\n    stilts : path-like, optional\n        To perform validation with ``votlint`` from the the Java-based\n        `STILTS <http://www.star.bris.ac.uk/~mbt/stilts/>`_ VOTable\n        parser, in addition to `astropy.io.votable`, set this to the\n        path of the ``'stilts.jar'`` file.  ``java`` on the system shell\n        path will be used to run it.\n\n    Notes\n    -----\n    Downloads of each given URL will be performed only once and cached\n    locally in *destdir*.  To refresh the cache, remove *destdir*\n    first.\n    \"\"\"\n    from astropy.utils.console import (color_print, ProgressBar, Spinner)\n\n    if stilts is not None:\n        if not os.path.exists(stilts):\n            raise ValueError(\n                f'{stilts} does not exist.')\n\n    destdir = os.path.abspath(destdir)\n\n    if urls is None:\n        with Spinner('Loading URLs', 'green') as s:\n            urls = get_urls(destdir, s)\n    else:\n        color_print('Marking URLs', 'green')\n        for url in ProgressBar.iterate(urls):\n            with result.Result(url, root=destdir) as r:\n                r['expected'] = type\n\n    args = [(url, destdir) for url in urls]\n\n    color_print('Downloading VO files', 'green')\n    ProgressBar.map(\n        download, args, multiprocess=multiprocess)\n\n    color_print('Validating VO files', 'green')\n    ProgressBar.map(\n        validate_vo, args, multiprocess=multiprocess)\n\n    if stilts is not None:\n        color_print('Validating with votlint', 'green')\n        votlint_args = [(stilts, x, destdir) for x in urls]\n        ProgressBar.map(\n            votlint_validate, votlint_args, multiprocess=multiprocess)\n\n    color_print('Generating HTML files', 'green')\n    ProgressBar.map(\n        write_html_result, args, multiprocess=multiprocess)\n\n    with Spinner('Grouping results', 'green') as s:\n        subsets = result.get_result_subsets(urls, destdir, s)\n\n    color_print('Generating index', 'green')\n    html.write_index(subsets, urls, destdir)\n\n    color_print('Generating subindices', 'green')\n    subindex_args = [(subset, destdir, len(urls)) for subset in subsets]\n    ProgressBar.map(\n        write_subindex, subindex_args, multiprocess=multiprocess)"},{"col":0,"comment":"null","endLoc":68,"header":"def write_html_result(args)","id":6963,"name":"write_html_result","nodeType":"Function","startLoc":65,"text":"def write_html_result(args):\n    url, destdir = args\n    with result.Result(url, root=destdir) as r:\n        html.write_result(r)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1190,"id":6964,"name":"ID","nodeType":"Attribute","startLoc":1190,"text":"self.ID"},{"attributeType":"None","col":8,"comment":"null","endLoc":1351,"id":6965,"name":"_width","nodeType":"Attribute","startLoc":1351,"text":"self._width"},{"col":0,"comment":"null","endLoc":159,"header":"def write_result(result)","id":6966,"name":"write_result","nodeType":"Function","startLoc":117,"text":"def write_result(result):\n    if 'network_error' in result and result['network_error'] is not None:\n        return\n\n    xml = result.get_xml_content()\n    xml_lines = xml.splitlines()\n\n    path = os.path.join(result.get_dirpath(), 'index.html')\n\n    with open(path, 'w', encoding='utf-8') as fd:\n        w = XMLWriter(fd)\n        with make_html_header(w):\n            with w.tag('p'):\n                with w.tag('a', href='vo.xml'):\n                    w.data(result.url.decode('ascii'))\n            w.element('hr')\n\n            with w.tag('pre'):\n                w._flush()\n                for line in result['warnings']:\n                    write_warning(w, line, xml_lines)\n\n            if result['xmllint'] is False:\n                w.element('hr')\n                w.element('p', 'xmllint results:')\n                content = result['xmllint_content']\n                if not isinstance(content, str):\n                    content = content.decode('ascii')\n                content = content.replace(result.get_dirpath() + '/', '')\n                with w.tag('pre'):\n                    w.data(content)\n\n            if 'votlint' in result:\n                if result['votlint'] is False:\n                    w.element('hr')\n                    w.element('p', 'votlint results:')\n                    content = result['votlint_content']\n                    if not isinstance(content, str):\n                        content = content.decode('ascii')\n                    with w.tag('pre'):\n                        w._flush()\n                        for line in content.splitlines():\n                            write_votlint_warning(w, line, xml_lines)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2171,"id":6967,"name":"ucd","nodeType":"Attribute","startLoc":2171,"text":"self.ucd"},{"attributeType":"null","col":8,"comment":"null","endLoc":2177,"id":6968,"name":"_nrows","nodeType":"Attribute","startLoc":2177,"text":"self._nrows"},{"col":4,"comment":"Map function over items while displaying a progress bar with percentage complete.\n\n        The map operation may run in arbitrary order on the items, but the results are\n        returned in sequential order.\n\n        ::\n\n            def work(i):\n                print(i)\n\n            ProgressBar.map(work, range(50))\n\n        Parameters\n        ----------\n        function : function\n            Function to call for each step\n\n        items : sequence\n            Sequence where each element is a tuple of arguments to pass to\n            *function*.\n\n        multiprocess : bool, int, optional\n            If `True`, use the `multiprocessing` module to distribute each task\n            to a different processor core. If a number greater than 1, then use\n            that number of cores.\n\n        ipython_widget : bool, optional\n            If `True`, the progress bar will display as an IPython\n            notebook widget.\n\n        file : writable file-like, optional\n            The file to write the progress bar to.  Defaults to\n            `sys.stdout`.  If ``file`` is not a tty (as determined by\n            calling its `isatty` member, if any), the scrollbar will\n            be completely silent.\n\n        step : int, optional\n            Update the progress bar at least every *step* steps (default: 100).\n            If ``multiprocess`` is `True`, this will affect the size\n            of the chunks of ``items`` that are submitted as separate tasks\n            to the process pool.  A large step size may make the job\n            complete faster if ``items`` is very long.\n\n        multiprocessing_start_method : str, optional\n            Useful primarily for testing; if in doubt leave it as the default.\n            When using multiprocessing, certain anomalies occur when starting\n            processes with the \"spawn\" method (the only option on Windows);\n            other anomalies occur with the \"fork\" method (the default on\n            Linux).\n        ","endLoc":731,"header":"@classmethod\n    def map(cls, function, items, multiprocess=False, file=None, step=100,\n            ipython_widget=False, multiprocessing_start_method=None)","id":6969,"name":"map","nodeType":"Function","startLoc":663,"text":"@classmethod\n    def map(cls, function, items, multiprocess=False, file=None, step=100,\n            ipython_widget=False, multiprocessing_start_method=None):\n        \"\"\"Map function over items while displaying a progress bar with percentage complete.\n\n        The map operation may run in arbitrary order on the items, but the results are\n        returned in sequential order.\n\n        ::\n\n            def work(i):\n                print(i)\n\n            ProgressBar.map(work, range(50))\n\n        Parameters\n        ----------\n        function : function\n            Function to call for each step\n\n        items : sequence\n            Sequence where each element is a tuple of arguments to pass to\n            *function*.\n\n        multiprocess : bool, int, optional\n            If `True`, use the `multiprocessing` module to distribute each task\n            to a different processor core. If a number greater than 1, then use\n            that number of cores.\n\n        ipython_widget : bool, optional\n            If `True`, the progress bar will display as an IPython\n            notebook widget.\n\n        file : writable file-like, optional\n            The file to write the progress bar to.  Defaults to\n            `sys.stdout`.  If ``file`` is not a tty (as determined by\n            calling its `isatty` member, if any), the scrollbar will\n            be completely silent.\n\n        step : int, optional\n            Update the progress bar at least every *step* steps (default: 100).\n            If ``multiprocess`` is `True`, this will affect the size\n            of the chunks of ``items`` that are submitted as separate tasks\n            to the process pool.  A large step size may make the job\n            complete faster if ``items`` is very long.\n\n        multiprocessing_start_method : str, optional\n            Useful primarily for testing; if in doubt leave it as the default.\n            When using multiprocessing, certain anomalies occur when starting\n            processes with the \"spawn\" method (the only option on Windows);\n            other anomalies occur with the \"fork\" method (the default on\n            Linux).\n        \"\"\"\n\n        if multiprocess:\n            function = _mapfunc(function)\n            items = list(enumerate(items))\n\n        results = cls.map_unordered(\n            function, items, multiprocess=multiprocess,\n            file=file, step=step,\n            ipython_widget=ipython_widget,\n            multiprocessing_start_method=multiprocessing_start_method)\n\n        if multiprocess:\n            _, results = zip(*sorted(results))\n            results = list(results)\n\n        return results"},{"col":4,"comment":"null","endLoc":466,"header":"def __init__(self, func)","id":6970,"name":"__init__","nodeType":"Function","startLoc":465,"text":"def __init__(self, func):\n        self._func = func"},{"attributeType":"null","col":8,"comment":"null","endLoc":2168,"id":6971,"name":"name","nodeType":"Attribute","startLoc":2168,"text":"self.name"},{"col":4,"comment":"Map function over items, reporting the progress.\n\n        Does a `map` operation while displaying a progress bar with\n        percentage complete. The map operation may run on arbitrary order\n        on the items, and the results may be returned in arbitrary order.\n\n        ::\n\n            def work(i):\n                print(i)\n\n            ProgressBar.map(work, range(50))\n\n        Parameters\n        ----------\n        function : function\n            Function to call for each step\n\n        items : sequence\n            Sequence where each element is a tuple of arguments to pass to\n            *function*.\n\n        multiprocess : bool, int, optional\n            If `True`, use the `multiprocessing` module to distribute each task\n            to a different processor core. If a number greater than 1, then use\n            that number of cores.\n\n        ipython_widget : bool, optional\n            If `True`, the progress bar will display as an IPython\n            notebook widget.\n\n        file : writable file-like, optional\n            The file to write the progress bar to.  Defaults to\n            `sys.stdout`.  If ``file`` is not a tty (as determined by\n            calling its `isatty` member, if any), the scrollbar will\n            be completely silent.\n\n        step : int, optional\n            Update the progress bar at least every *step* steps (default: 100).\n            If ``multiprocess`` is `True`, this will affect the size\n            of the chunks of ``items`` that are submitted as separate tasks\n            to the process pool.  A large step size may make the job\n            complete faster if ``items`` is very long.\n\n        multiprocessing_start_method : str, optional\n            Useful primarily for testing; if in doubt leave it as the default.\n            When using multiprocessing, certain anomalies occur when starting\n            processes with the \"spawn\" method (the only option on Windows);\n            other anomalies occur with the \"fork\" method (the default on\n            Linux).\n        ","endLoc":821,"header":"@classmethod\n    def map_unordered(cls, function, items, multiprocess=False, file=None,\n                      step=100, ipython_widget=False,\n                      multiprocessing_start_method=None)","id":6972,"name":"map_unordered","nodeType":"Function","startLoc":733,"text":"@classmethod\n    def map_unordered(cls, function, items, multiprocess=False, file=None,\n                      step=100, ipython_widget=False,\n                      multiprocessing_start_method=None):\n        \"\"\"Map function over items, reporting the progress.\n\n        Does a `map` operation while displaying a progress bar with\n        percentage complete. The map operation may run on arbitrary order\n        on the items, and the results may be returned in arbitrary order.\n\n        ::\n\n            def work(i):\n                print(i)\n\n            ProgressBar.map(work, range(50))\n\n        Parameters\n        ----------\n        function : function\n            Function to call for each step\n\n        items : sequence\n            Sequence where each element is a tuple of arguments to pass to\n            *function*.\n\n        multiprocess : bool, int, optional\n            If `True`, use the `multiprocessing` module to distribute each task\n            to a different processor core. If a number greater than 1, then use\n            that number of cores.\n\n        ipython_widget : bool, optional\n            If `True`, the progress bar will display as an IPython\n            notebook widget.\n\n        file : writable file-like, optional\n            The file to write the progress bar to.  Defaults to\n            `sys.stdout`.  If ``file`` is not a tty (as determined by\n            calling its `isatty` member, if any), the scrollbar will\n            be completely silent.\n\n        step : int, optional\n            Update the progress bar at least every *step* steps (default: 100).\n            If ``multiprocess`` is `True`, this will affect the size\n            of the chunks of ``items`` that are submitted as separate tasks\n            to the process pool.  A large step size may make the job\n            complete faster if ``items`` is very long.\n\n        multiprocessing_start_method : str, optional\n            Useful primarily for testing; if in doubt leave it as the default.\n            When using multiprocessing, certain anomalies occur when starting\n            processes with the \"spawn\" method (the only option on Windows);\n            other anomalies occur with the \"fork\" method (the default on\n            Linux).\n        \"\"\"\n\n        results = []\n\n        if file is None:\n            file = _get_stdout()\n\n        with cls(len(items), ipython_widget=ipython_widget, file=file) as bar:\n            if bar._ipython_widget:\n                chunksize = step\n            else:\n                default_step = max(int(float(len(items)) / bar._bar_length), 1)\n                chunksize = min(default_step, step)\n            if not multiprocess or multiprocess < 1:\n                for i, item in enumerate(items):\n                    results.append(function(item))\n                    if (i % chunksize) == 0:\n                        bar.update(i)\n            else:\n                ctx = multiprocessing.get_context(multiprocessing_start_method)\n                kwargs = dict(mp_context=ctx)\n\n                with ProcessPoolExecutor(\n                        max_workers=(int(multiprocess)\n                                     if multiprocess is not True\n                                     else None),\n                        **kwargs) as p:\n                    for i, f in enumerate(\n                            as_completed(\n                                p.submit(function, item)\n                                for item in items)):\n                        bar.update(i)\n                        results.append(f.result())\n\n        return results"},{"attributeType":"null","col":8,"comment":"null","endLoc":1188,"id":6973,"name":"_votable","nodeType":"Attribute","startLoc":1188,"text":"self._votable"},{"col":0,"comment":"null","endLoc":191,"header":"def test_write_overwrite(tmpdir)","id":6974,"name":"test_write_overwrite","nodeType":"Function","startLoc":185,"text":"def test_write_overwrite(tmpdir):\n    t = simple_table(3, 3)\n    filename = os.path.join(tmpdir, 'overwrite_test.vot')\n    t.write(filename, format='votable')\n    with pytest.raises(OSError, match=_NOT_OVERWRITING_MSG_MATCH):\n        t.write(filename, format='votable')\n    t.write(filename, format='votable', overwrite=True)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2170,"id":6975,"name":"_ref","nodeType":"Attribute","startLoc":2170,"text":"self._ref"},{"attributeType":"None","col":8,"comment":"null","endLoc":1236,"id":6976,"name":"xtype","nodeType":"Attribute","startLoc":1236,"text":"self.xtype"},{"attributeType":"null","col":8,"comment":"null","endLoc":1441,"id":6977,"name":"_type","nodeType":"Attribute","startLoc":1441,"text":"self._type"},{"col":0,"comment":"null","endLoc":71,"header":"@contextlib.contextmanager\ndef make_html_header(w)","id":6978,"name":"make_html_header","nodeType":"Function","startLoc":62,"text":"@contextlib.contextmanager\ndef make_html_header(w):\n    w.write(html_header)\n    with w.tag('html', xmlns=\"http://www.w3.org/1999/xhtml\", lang=\"en-US\"):\n        with w.tag('head'):\n            w.element('title', 'VO Validation results')\n            w.element('style', default_style)\n\n            with w.tag('body'):\n                yield"},{"attributeType":"null","col":8,"comment":"null","endLoc":2160,"id":6979,"name":"_pos","nodeType":"Attribute","startLoc":2160,"text":"self._pos"},{"attributeType":"null","col":12,"comment":"null","endLoc":1168,"id":6980,"name":"_attr_list","nodeType":"Attribute","startLoc":1168,"text":"self._attr_list"},{"col":0,"comment":"null","endLoc":197,"header":"def test_empty_table()","id":6981,"name":"test_empty_table","nodeType":"Function","startLoc":194,"text":"def test_empty_table():\n    votable = parse(get_pkg_data_filename('data/empty_table.xml'))\n    table = votable.get_first_table()\n    astropy_table = table.to_table()  # noqa"},{"attributeType":"null","col":8,"comment":"null","endLoc":1228,"id":6982,"name":"unit","nodeType":"Attribute","startLoc":1228,"text":"self.unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":2269,"id":6983,"name":"_format","nodeType":"Attribute","startLoc":2269,"text":"self._format"},{"attributeType":"null","col":8,"comment":"null","endLoc":2166,"id":6984,"name":"ID","nodeType":"Attribute","startLoc":2166,"text":"self.ID"},{"attributeType":"null","col":12,"comment":"null","endLoc":1199,"id":6985,"name":"name","nodeType":"Attribute","startLoc":1199,"text":"self.name"},{"attributeType":"null","col":8,"comment":"null","endLoc":2183,"id":6986,"name":"_groups","nodeType":"Attribute","startLoc":2183,"text":"self._groups"},{"col":0,"comment":"null","endLoc":101,"header":"def write_warning(w, line, xml_lines)","id":6987,"name":"write_warning","nodeType":"Function","startLoc":86,"text":"def write_warning(w, line, xml_lines):\n    warning = exceptions.parse_vowarning(line)\n    if not warning['is_something']:\n        w.data(line)\n    else:\n        w.write(f\"Line {warning['nline']:d}: \")\n        if warning['warning']:\n            w.write('<a href=\"{}/{}\">{}</a>: '.format(\n                online_docs_root, warning['doc_url'], warning['warning']))\n        msg = warning['message']\n        if not isinstance(warning['message'], str):\n            msg = msg.decode('utf-8')\n        w.write(xml_escape(msg))\n        w.write('\\n')\n        if 1 <= warning['nline'] < len(xml_lines):\n            write_source_line(w, xml_lines[warning['nline'] - 1], warning['nchar'])"},{"col":0,"comment":"null","endLoc":204,"header":"def test_no_field_not_empty_table()","id":6988,"name":"test_no_field_not_empty_table","nodeType":"Function","startLoc":200,"text":"def test_no_field_not_empty_table():\n    votable = parse(get_pkg_data_filename('data/no_field_not_empty_table.xml'))\n    table = votable.get_first_table()\n    assert len(table.fields) == 0\n    assert len(table.infos) == 1"},{"attributeType":"null","col":8,"comment":"null","endLoc":1229,"id":6989,"name":"width","nodeType":"Attribute","startLoc":1229,"text":"self.width"},{"col":0,"comment":"null","endLoc":209,"header":"def test_no_field_not_empty_table_exception()","id":6990,"name":"test_no_field_not_empty_table_exception","nodeType":"Function","startLoc":207,"text":"def test_no_field_not_empty_table_exception():\n    with pytest.raises(E25):\n        parse(get_pkg_data_filename('data/no_field_not_empty_table.xml'), verify='exception')"},{"col":0,"comment":"null","endLoc":56,"header":"def test_unit_format()","id":6991,"name":"test_unit_format","nodeType":"Function","startLoc":41,"text":"def test_unit_format():\n    data = parse(get_pkg_data_filename('data/irsa-nph-error.xml'))\n    assert data._config['version'] == '1.0'\n    assert tree._get_default_unit_format(data._config) == 'cds'\n    data = parse(get_pkg_data_filename('data/names.xml'))\n    assert data._config['version'] == '1.1'\n    assert tree._get_default_unit_format(data._config) == 'cds'\n    data = parse(get_pkg_data_filename('data/gemini.xml'))\n    assert data._config['version'] == '1.2'\n    assert tree._get_default_unit_format(data._config) == 'cds'\n    data = parse(get_pkg_data_filename('data/binary2_masked_strings.xml'))\n    assert data._config['version'] == '1.3'\n    assert tree._get_default_unit_format(data._config) == 'cds'\n    data = parse(get_pkg_data_filename('data/timesys.xml'))\n    assert data._config['version'] == '1.4'\n    assert tree._get_default_unit_format(data._config) == 'vounit'"},{"col":0,"comment":"\n    Issue #8995\n    ","endLoc":224,"header":"def test_binary2_masked_strings()","id":6992,"name":"test_binary2_masked_strings","nodeType":"Function","startLoc":212,"text":"def test_binary2_masked_strings():\n    \"\"\"\n    Issue #8995\n    \"\"\"\n    # Read a VOTable which sets the null mask bit for each empty string value.\n    votable = parse(get_pkg_data_filename('data/binary2_masked_strings.xml'))\n    table = votable.get_first_table()\n    astropy_table = table.to_table()\n\n    # Ensure string columns have no masked values and can be written out\n    assert not np.any(table.array.mask['epoch_photometry_url'])\n    output = io.BytesIO()\n    astropy_table.write(output, format='votable')"},{"col":0,"comment":"null","endLoc":83,"header":"def write_source_line(w, line, nchar=0)","id":6993,"name":"write_source_line","nodeType":"Function","startLoc":74,"text":"def write_source_line(w, line, nchar=0):\n    part1 = xml_escape(line[:nchar].decode('utf-8'))\n    char = xml_escape(line[nchar:nchar+1].decode('utf-8'))\n    part2 = xml_escape(line[nchar+1:].decode('utf-8'))\n\n    w.write('  ')\n    w.write(part1)\n    w.write(f'<span class=\"highlight\">{char}</span>')\n    w.write(part2)\n    w.write('\\n\\n')"},{"attributeType":"null","col":8,"comment":"null","endLoc":1371,"id":6994,"name":"_ref","nodeType":"Attribute","startLoc":1371,"text":"self._ref"},{"col":0,"comment":"null","endLoc":356,"header":"def get_result_subsets(results, root, s=None)","id":6995,"name":"get_result_subsets","nodeType":"Function","startLoc":236,"text":"def get_result_subsets(results, root, s=None):\n    all_results = []\n    correct = []\n    not_expected = []\n    fail_schema = []\n    schema_mismatch = []\n    fail_votlint = []\n    votlint_mismatch = []\n    network_failures = []\n    version_10 = []\n    version_11 = []\n    version_12 = []\n    version_unknown = []\n    has_warnings = []\n    warning_set = {}\n    has_exceptions = []\n    exception_set = {}\n\n    for url in results:\n        if s:\n            next(s)\n\n        if isinstance(url, Result):\n            x = url\n        else:\n            x = Result(url, root=root)\n\n        all_results.append(x)\n        if (x['nwarnings'] == 0 and\n                x['nexceptions'] == 0 and\n                x['xmllint'] is True):\n            correct.append(x)\n        if not x.match_expectations():\n            not_expected.append(x)\n        if x['xmllint'] is False:\n            fail_schema.append(x)\n        if (x['xmllint'] is False and\n                x['nwarnings'] == 0 and\n                x['nexceptions'] == 0):\n            schema_mismatch.append(x)\n        if 'votlint' in x and x['votlint'] is False:\n            fail_votlint.append(x)\n            if 'network_error' not in x:\n                x['network_error'] = None\n            if (x['nwarnings'] == 0 and\n                    x['nexceptions'] == 0 and\n                    x['network_error'] is None):\n                votlint_mismatch.append(x)\n        if 'network_error' in x and x['network_error'] is not None:\n            network_failures.append(x)\n        version = x['version']\n        if version == '1.0':\n            version_10.append(x)\n        elif version == '1.1':\n            version_11.append(x)\n        elif version == '1.2':\n            version_12.append(x)\n        else:\n            version_unknown.append(x)\n        if x['nwarnings'] > 0:\n            has_warnings.append(x)\n            for warning in x['warning_types']:\n                if (warning is not None and\n                        len(warning) == 3 and\n                        warning.startswith('W')):\n                    warning_set.setdefault(warning, [])\n                    warning_set[warning].append(x)\n        if x['nexceptions'] > 0:\n            has_exceptions.append(x)\n            for exc in x['warning_types']:\n                if exc is not None and len(exc) == 3 and exc.startswith('E'):\n                    exception_set.setdefault(exc, [])\n                    exception_set[exc].append(x)\n\n    warning_set = list(warning_set.items())\n    warning_set.sort()\n    exception_set = list(exception_set.items())\n    exception_set.sort()\n\n    tables = [\n        ('all', 'All tests', all_results),\n        ('correct', 'Correct', correct),\n        ('unexpected', 'Unexpected', not_expected),\n        ('schema', 'Invalid against schema', fail_schema),\n        ('schema_mismatch', 'Invalid against schema/Passed vo.table',\n         schema_mismatch, ['ul']),\n        ('fail_votlint', 'Failed votlint', fail_votlint),\n        ('votlint_mismatch', 'Failed votlint/Passed vo.table',\n         votlint_mismatch, ['ul']),\n        ('network_failures', 'Network failures', network_failures),\n        ('version1.0', 'Version 1.0', version_10),\n        ('version1.1', 'Version 1.1', version_11),\n        ('version1.2', 'Version 1.2', version_12),\n        ('version_unknown', 'Version unknown', version_unknown),\n        ('warnings', 'Warnings', has_warnings)]\n    for warning_code, warning in warning_set:\n        if s:\n            next(s)\n\n        warning_class = getattr(exceptions, warning_code, None)\n        if warning_class:\n            warning_descr = warning_class.get_short_name()\n            tables.append(\n                (warning_code,\n                 f'{warning_code}: {warning_descr}',\n                 warning, ['ul', 'li']))\n    tables.append(\n        ('exceptions', 'Exceptions', has_exceptions))\n    for exception_code, exc in exception_set:\n        if s:\n            next(s)\n\n        exception_class = getattr(exceptions, exception_code, None)\n        if exception_class:\n            exception_descr = exception_class.get_short_name()\n            tables.append(\n                (exception_code,\n                 f'{exception_code}: {exception_descr}',\n                 exc, ['ul', 'li']))\n\n    return tables"},{"col":0,"comment":"\n    Issue #12603. Test that we get the correct output from votable.validate with an invalid\n    votable.\n    ","endLoc":246,"header":"def test_validate_output_invalid()","id":6996,"name":"test_validate_output_invalid","nodeType":"Function","startLoc":227,"text":"def test_validate_output_invalid():\n    \"\"\"\n    Issue #12603. Test that we get the correct output from votable.validate with an invalid\n    votable.\n    \"\"\"\n\n    # A votable with errors\n    invalid_votable_filepath = get_pkg_data_filename('data/regression.xml')\n\n    # When output is None, check that validate returns validation output as a string\n    validate_out = validate(invalid_votable_filepath, output=None)\n    assert isinstance(validate_out, str)\n    # Check for known error string\n    assert \"E02: Incorrect number of elements in array.\" in validate_out\n\n    # When output is not set, check that validate returns a bool\n    validate_out = validate(invalid_votable_filepath)\n    assert isinstance(validate_out, bool)\n    # Check that validation output is correct (votable is not valid)\n    assert validate_out is False"},{"attributeType":"null","col":8,"comment":"null","endLoc":1161,"id":6997,"name":"_pos","nodeType":"Attribute","startLoc":1161,"text":"self._pos"},{"col":0,"comment":"\n    Issue #12603. Test that we get the correct output from votable.validate with a valid\n    votable\n    ","endLoc":269,"header":"def test_validate_output_valid()","id":6998,"name":"test_validate_output_valid","nodeType":"Function","startLoc":249,"text":"def test_validate_output_valid():\n    \"\"\"\n    Issue #12603. Test that we get the correct output from votable.validate with a valid\n    votable\n    \"\"\"\n\n    # A valid votable. (Example from the votable standard:\n    # https://www.ivoa.net/documents/VOTable/20191021/REC-VOTable-1.4-20191021.html )\n    valid_votable_filepath = get_pkg_data_filename('data/valid_votable.xml')\n\n    # When output is None, check that validate returns validation output as a string\n    validate_out = validate(valid_votable_filepath, output=None)\n    assert isinstance(validate_out, str)\n    # Check for known good output string\n    assert \"astropy.io.votable found no violations\" in validate_out\n\n    # When output is not set, check that validate returns a bool\n    validate_out = validate(valid_votable_filepath)\n    assert isinstance(validate_out, bool)\n    # Check that validation output is correct (votable is valid)\n    assert validate_out is True"},{"attributeType":"None","col":8,"comment":"null","endLoc":1425,"id":6999,"name":"_arraysize","nodeType":"Attribute","startLoc":1425,"text":"self._arraysize"},{"col":0,"comment":"null","endLoc":114,"header":"def write_votlint_warning(w, line, xml_lines)","id":7000,"name":"write_votlint_warning","nodeType":"Function","startLoc":104,"text":"def write_votlint_warning(w, line, xml_lines):\n    match = re.search(r\"(WARNING|ERROR|INFO) \\(l.(?P<line>[0-9]+), c.(?P<column>[0-9]+)\\): (?P<rest>.*)\", line)\n    if match:\n        w.write('Line {:d}: {}\\n'.format(\n                int(match.group('line')), xml_escape(match.group('rest'))))\n        write_source_line(\n            w, xml_lines[int(match.group('line')) - 1],\n            int(match.group('column')) - 1)\n    else:\n        w.data(line)\n        w.data('\\n')"},{"attributeType":"null","col":16,"comment":"null","endLoc":10,"id":7001,"name":"np","nodeType":"Attribute","startLoc":10,"text":"np"},{"col":0,"comment":"","endLoc":4,"header":"table_test.py#<anonymous>","id":7002,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nTest the conversion to/from astropy.table\n\"\"\""},{"className":"Param","col":0,"comment":"\n    PARAM_ element: constant-valued columns in the data.\n\n    :class:`Param` objects are a subclass of :class:`Field`, and have\n    all of its methods and members.  Additionally, it defines :attr:`value`.\n    ","endLoc":1630,"id":7003,"nodeType":"Class","startLoc":1580,"text":"class Param(Field):\n    \"\"\"\n    PARAM_ element: constant-valued columns in the data.\n\n    :class:`Param` objects are a subclass of :class:`Field`, and have\n    all of its methods and members.  Additionally, it defines :attr:`value`.\n    \"\"\"\n    _attr_list_11 = Field._attr_list_11 + ['value']\n    _attr_list_12 = Field._attr_list_12 + ['value']\n    _element_name = 'PARAM'\n\n    def __init__(self, votable, ID=None, name=None, value=None, datatype=None,\n                 arraysize=None, ucd=None, unit=None, width=None,\n                 precision=None, utype=None, type=None, id=None, config=None,\n                 pos=None, **extra):\n        self._value = value\n        Field.__init__(self, votable, ID=ID, name=name, datatype=datatype,\n                       arraysize=arraysize, ucd=ucd, unit=unit,\n                       precision=precision, utype=utype, type=type,\n                       id=id, config=config, pos=pos, **extra)\n\n    @property\n    def value(self):\n        \"\"\"\n        [*required*] The constant value of the parameter.  Its type is\n        determined by the :attr:`~Field.datatype` member.\n        \"\"\"\n        return self._value\n\n    @value.setter\n    def value(self, value):\n        if value is None:\n            value = \"\"\n        if isinstance(value, str):\n            self._value = self.converter.parse(\n                value, self._config, self._pos)[0]\n        else:\n            self._value = value\n\n    def _setup(self, config, pos):\n        Field._setup(self, config, pos)\n        self.value = self._value\n\n    def to_xml(self, w, **kwargs):\n        tmp_value = self._value\n        self._value = self.converter.output(tmp_value, False)\n        # We must always have a value\n        if self._value is None:\n            self._value = \"\"\n        Field.to_xml(self, w, **kwargs)\n        self._value = tmp_value"},{"col":4,"comment":"\n        [*required*] The constant value of the parameter.  Its type is\n        determined by the :attr:`~Field.datatype` member.\n        ","endLoc":1607,"header":"@property\n    def value(self)","id":7004,"name":"value","nodeType":"Function","startLoc":1601,"text":"@property\n    def value(self):\n        \"\"\"\n        [*required*] The constant value of the parameter.  Its type is\n        determined by the :attr:`~Field.datatype` member.\n        \"\"\"\n        return self._value"},{"col":4,"comment":"null","endLoc":1617,"header":"@value.setter\n    def value(self, value)","id":7005,"name":"value","nodeType":"Function","startLoc":1609,"text":"@value.setter\n    def value(self, value):\n        if value is None:\n            value = \"\"\n        if isinstance(value, str):\n            self._value = self.converter.parse(\n                value, self._config, self._pos)[0]\n        else:\n            self._value = value"},{"fileName":"html.py","filePath":"astropy/io/votable/validator","id":7006,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# STDLIB\nimport contextlib\nfrom math import ceil\nimport os\nimport re\n\n# ASTROPY\nfrom astropy.utils.xml.writer import XMLWriter, xml_escape\nfrom astropy import online_docs_root\n\n# VO\nfrom astropy.io.votable import exceptions\n\nhtml_header = \"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE html\n        PUBLIC \"-//W3C//DTD XHTML Basic 1.0//EN\"\n        \"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd\">\n\"\"\"\n\ndefault_style = \"\"\"\nbody {\nfont-family: sans-serif\n}\na {\ntext-decoration: none\n}\n.highlight {\ncolor: red;\nfont-weight: bold;\ntext-decoration: underline;\n}\n.green { background-color: #ddffdd }\n.red   { background-color: #ffdddd }\n.yellow { background-color: #ffffdd }\ntr:hover { background-color: #dddddd }\ntable {\n        border-width: 1px;\n        border-spacing: 0px;\n        border-style: solid;\n        border-color: gray;\n        border-collapse: collapse;\n        background-color: white;\n        padding: 5px;\n}\ntable th {\n        border-width: 1px;\n        padding: 5px;\n        border-style: solid;\n        border-color: gray;\n}\ntable td {\n        border-width: 1px;\n        padding: 5px;\n        border-style: solid;\n        border-color: gray;\n}\n\"\"\"\n\n\n@contextlib.contextmanager\ndef make_html_header(w):\n    w.write(html_header)\n    with w.tag('html', xmlns=\"http://www.w3.org/1999/xhtml\", lang=\"en-US\"):\n        with w.tag('head'):\n            w.element('title', 'VO Validation results')\n            w.element('style', default_style)\n\n            with w.tag('body'):\n                yield\n\n\ndef write_source_line(w, line, nchar=0):\n    part1 = xml_escape(line[:nchar].decode('utf-8'))\n    char = xml_escape(line[nchar:nchar+1].decode('utf-8'))\n    part2 = xml_escape(line[nchar+1:].decode('utf-8'))\n\n    w.write('  ')\n    w.write(part1)\n    w.write(f'<span class=\"highlight\">{char}</span>')\n    w.write(part2)\n    w.write('\\n\\n')\n\n\ndef write_warning(w, line, xml_lines):\n    warning = exceptions.parse_vowarning(line)\n    if not warning['is_something']:\n        w.data(line)\n    else:\n        w.write(f\"Line {warning['nline']:d}: \")\n        if warning['warning']:\n            w.write('<a href=\"{}/{}\">{}</a>: '.format(\n                online_docs_root, warning['doc_url'], warning['warning']))\n        msg = warning['message']\n        if not isinstance(warning['message'], str):\n            msg = msg.decode('utf-8')\n        w.write(xml_escape(msg))\n        w.write('\\n')\n        if 1 <= warning['nline'] < len(xml_lines):\n            write_source_line(w, xml_lines[warning['nline'] - 1], warning['nchar'])\n\n\ndef write_votlint_warning(w, line, xml_lines):\n    match = re.search(r\"(WARNING|ERROR|INFO) \\(l.(?P<line>[0-9]+), c.(?P<column>[0-9]+)\\): (?P<rest>.*)\", line)\n    if match:\n        w.write('Line {:d}: {}\\n'.format(\n                int(match.group('line')), xml_escape(match.group('rest'))))\n        write_source_line(\n            w, xml_lines[int(match.group('line')) - 1],\n            int(match.group('column')) - 1)\n    else:\n        w.data(line)\n        w.data('\\n')\n\n\ndef write_result(result):\n    if 'network_error' in result and result['network_error'] is not None:\n        return\n\n    xml = result.get_xml_content()\n    xml_lines = xml.splitlines()\n\n    path = os.path.join(result.get_dirpath(), 'index.html')\n\n    with open(path, 'w', encoding='utf-8') as fd:\n        w = XMLWriter(fd)\n        with make_html_header(w):\n            with w.tag('p'):\n                with w.tag('a', href='vo.xml'):\n                    w.data(result.url.decode('ascii'))\n            w.element('hr')\n\n            with w.tag('pre'):\n                w._flush()\n                for line in result['warnings']:\n                    write_warning(w, line, xml_lines)\n\n            if result['xmllint'] is False:\n                w.element('hr')\n                w.element('p', 'xmllint results:')\n                content = result['xmllint_content']\n                if not isinstance(content, str):\n                    content = content.decode('ascii')\n                content = content.replace(result.get_dirpath() + '/', '')\n                with w.tag('pre'):\n                    w.data(content)\n\n            if 'votlint' in result:\n                if result['votlint'] is False:\n                    w.element('hr')\n                    w.element('p', 'votlint results:')\n                    content = result['votlint_content']\n                    if not isinstance(content, str):\n                        content = content.decode('ascii')\n                    with w.tag('pre'):\n                        w._flush()\n                        for line in content.splitlines():\n                            write_votlint_warning(w, line, xml_lines)\n\n\ndef write_result_row(w, result):\n    with w.tag('tr'):\n        with w.tag('td'):\n            if ('network_error' in result and\n                    result['network_error'] is not None):\n                w.data(result.url.decode('ascii'))\n            else:\n                w.element('a', result.url.decode('ascii'),\n                          href=f'{result.get_htmlpath()}/index.html')\n\n        if 'network_error' in result and result['network_error'] is not None:\n            w.element('td', str(result['network_error']),\n                      attrib={'class': 'red'})\n            w.element('td', '-')\n            w.element('td', '-')\n            w.element('td', '-')\n            w.element('td', '-')\n        else:\n            w.element('td', '-', attrib={'class': 'green'})\n\n            if result['nexceptions']:\n                cls = 'red'\n                msg = 'Fatal'\n            elif result['nwarnings']:\n                cls = 'yellow'\n                msg = str(result['nwarnings'])\n            else:\n                cls = 'green'\n                msg = '-'\n            w.element('td', msg, attrib={'class': cls})\n\n            msg = result['version']\n            if result['xmllint'] is None:\n                cls = ''\n            elif result['xmllint'] is False:\n                cls = 'red'\n            else:\n                cls = 'green'\n            w.element('td', msg, attrib={'class': cls})\n\n            if result['expected'] == 'good':\n                cls = 'green'\n                msg = '-'\n            elif result['expected'] == 'broken':\n                cls = 'red'\n                msg = 'net'\n            elif result['expected'] == 'incorrect':\n                cls = 'yellow'\n                msg = 'invalid'\n            w.element('td', msg, attrib={'class': cls})\n\n            if 'votlint' in result:\n                if result['votlint']:\n                    cls = 'green'\n                    msg = 'Passed'\n                else:\n                    cls = 'red'\n                    msg = 'Failed'\n            else:\n                cls = ''\n                msg = '?'\n            w.element('td', msg, attrib={'class': cls})\n\n\ndef write_table(basename, name, results, root=\"results\", chunk_size=500):\n    def write_page_links(j):\n        if npages <= 1:\n            return\n        with w.tag('center'):\n            if j > 0:\n                w.element('a', '<< ', href=f'{basename}_{j - 1:02d}.html')\n            for i in range(npages):\n                if i == j:\n                    w.data(str(i+1))\n                else:\n                    w.element(\n                        'a', str(i+1),\n                        href=f'{basename}_{i:02d}.html')\n                w.data(' ')\n            if j < npages - 1:\n                w.element('a', '>>', href=f'{basename}_{j + 1:02d}.html')\n\n    npages = int(ceil(float(len(results)) / chunk_size))\n\n    for i, j in enumerate(range(0, max(len(results), 1), chunk_size)):\n        subresults = results[j:j+chunk_size]\n        path = os.path.join(root, f'{basename}_{i:02d}.html')\n        with open(path, 'w', encoding='utf-8') as fd:\n            w = XMLWriter(fd)\n            with make_html_header(w):\n                write_page_links(i)\n\n                w.element('h2', name)\n\n                with w.tag('table'):\n                    with w.tag('tr'):\n                        w.element('th', 'URL')\n                        w.element('th', 'Network')\n                        w.element('th', 'Warnings')\n                        w.element('th', 'Schema')\n                        w.element('th', 'Expected')\n                        w.element('th', 'votlint')\n\n                    for result in subresults:\n                        write_result_row(w, result)\n\n                write_page_links(i)\n\n\ndef add_subset(w, basename, name, subresults, inside=['p'], total=None):\n    with w.tag('tr'):\n        subresults = list(subresults)\n        if total is None:\n            total = len(subresults)\n        if total == 0:  # pragma: no cover\n            percentage = 0.0\n        else:\n            percentage = (float(len(subresults)) / total)\n        with w.tag('td'):\n            for element in inside:\n                w.start(element)\n            w.element('a', name, href=f'{basename}_00.html')\n            for element in reversed(inside):\n                w.end(element)\n        numbers = f'{len(subresults):d} ({percentage:.2%})'\n        with w.tag('td'):\n            w.data(numbers)\n\n\ndef write_index(subsets, results, root='results'):\n    path = os.path.join(root, 'index.html')\n    with open(path, 'w', encoding='utf-8') as fd:\n        w = XMLWriter(fd)\n        with make_html_header(w):\n            w.element('h1', 'VO Validation results')\n\n            with w.tag('table'):\n                for subset in subsets:\n                    add_subset(w, *subset, total=len(results))\n\n\ndef write_index_table(root, basename, name, subresults, inside=None,\n                      total=None, chunk_size=500):\n    if total is None:\n        total = len(subresults)\n    percentage = (float(len(subresults)) / total)\n    numbers = f'{len(subresults):d} ({percentage:.2%})'\n    write_table(basename, name + ' ' + numbers, subresults, root, chunk_size)\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":35,"id":7007,"name":"xml_escape","nodeType":"Attribute","startLoc":35,"text":"xml_escape"},{"col":0,"comment":"null","endLoc":223,"header":"def write_result_row(w, result)","id":7008,"name":"write_result_row","nodeType":"Function","startLoc":162,"text":"def write_result_row(w, result):\n    with w.tag('tr'):\n        with w.tag('td'):\n            if ('network_error' in result and\n                    result['network_error'] is not None):\n                w.data(result.url.decode('ascii'))\n            else:\n                w.element('a', result.url.decode('ascii'),\n                          href=f'{result.get_htmlpath()}/index.html')\n\n        if 'network_error' in result and result['network_error'] is not None:\n            w.element('td', str(result['network_error']),\n                      attrib={'class': 'red'})\n            w.element('td', '-')\n            w.element('td', '-')\n            w.element('td', '-')\n            w.element('td', '-')\n        else:\n            w.element('td', '-', attrib={'class': 'green'})\n\n            if result['nexceptions']:\n                cls = 'red'\n                msg = 'Fatal'\n            elif result['nwarnings']:\n                cls = 'yellow'\n                msg = str(result['nwarnings'])\n            else:\n                cls = 'green'\n                msg = '-'\n            w.element('td', msg, attrib={'class': cls})\n\n            msg = result['version']\n            if result['xmllint'] is None:\n                cls = ''\n            elif result['xmllint'] is False:\n                cls = 'red'\n            else:\n                cls = 'green'\n            w.element('td', msg, attrib={'class': cls})\n\n            if result['expected'] == 'good':\n                cls = 'green'\n                msg = '-'\n            elif result['expected'] == 'broken':\n                cls = 'red'\n                msg = 'net'\n            elif result['expected'] == 'incorrect':\n                cls = 'yellow'\n                msg = 'invalid'\n            w.element('td', msg, attrib={'class': cls})\n\n            if 'votlint' in result:\n                if result['votlint']:\n                    cls = 'green'\n                    msg = 'Passed'\n                else:\n                    cls = 'red'\n                    msg = 'Failed'\n            else:\n                cls = ''\n                msg = '?'\n            w.element('td', msg, attrib={'class': cls})"},{"col":0,"comment":"null","endLoc":73,"header":"def write_subindex(args)","id":7009,"name":"write_subindex","nodeType":"Function","startLoc":71,"text":"def write_subindex(args):\n    subset, destdir, total = args\n    html.write_index_table(destdir, *subset, total=total)"},{"col":0,"comment":"\n    A version 1.4 VOTable must use the same namespace as 1.3.\n    (see https://www.ivoa.net/documents/VOTable/20191021/REC-VOTable-1.4-20191021.html#ToC16)\n    ","endLoc":87,"header":"def test_namespace_warning()","id":7010,"name":"test_namespace_warning","nodeType":"Function","startLoc":59,"text":"def test_namespace_warning():\n    \"\"\"\n    A version 1.4 VOTable must use the same namespace as 1.3.\n    (see https://www.ivoa.net/documents/VOTable/20191021/REC-VOTable-1.4-20191021.html#ToC16)\n    \"\"\"\n    bad_namespace = b'''<?xml version=\"1.0\" encoding=\"utf-8\"?>\n        <VOTABLE version=\"1.4\" xmlns=\"http://www.ivoa.net/xml/VOTable/v1.4\"\n                               xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n          <RESOURCE/>\n        </VOTABLE>\n    '''\n    with pytest.warns(W41):\n        parse(io.BytesIO(bad_namespace), verify='exception')\n\n    good_namespace_14 = b'''<?xml version=\"1.0\" encoding=\"utf-8\"?>\n        <VOTABLE version=\"1.4\" xmlns=\"http://www.ivoa.net/xml/VOTable/v1.3\"\n                               xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n          <RESOURCE/>\n        </VOTABLE>\n    '''\n    parse(io.BytesIO(good_namespace_14), verify='exception')\n\n    good_namespace_13 = b'''<?xml version=\"1.0\" encoding=\"utf-8\"?>\n        <VOTABLE version=\"1.3\" xmlns=\"http://www.ivoa.net/xml/VOTable/v1.3\"\n                               xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n          <RESOURCE/>\n        </VOTABLE>\n    '''\n    parse(io.BytesIO(good_namespace_13), verify='exception')"},{"col":0,"comment":"\n    VOTableFile.__init__ allows versions of '1.0', '1.1', '1.2', '1.3' and '1.4'.\n    The '1.0' is curious since other checks in parse() and the version setter do not allow '1.0'.\n    This test confirms that behavior for now.  A future change may remove the '1.0'.\n    ","endLoc":127,"header":"def test_version()","id":7011,"name":"test_version","nodeType":"Function","startLoc":90,"text":"def test_version():\n    \"\"\"\n    VOTableFile.__init__ allows versions of '1.0', '1.1', '1.2', '1.3' and '1.4'.\n    The '1.0' is curious since other checks in parse() and the version setter do not allow '1.0'.\n    This test confirms that behavior for now.  A future change may remove the '1.0'.\n    \"\"\"\n\n    # Exercise the checks in __init__\n    with pytest.warns(AstropyDeprecationWarning):\n        VOTableFile(version='1.0')\n    for version in ('1.1', '1.2', '1.3', '1.4'):\n        VOTableFile(version=version)\n    for version in ('0.9', '2.0'):\n        with pytest.raises(ValueError, match=r\"should be in \\('1.0', '1.1', '1.2', '1.3', '1.4'\\).\"):\n            VOTableFile(version=version)\n\n    # Exercise the checks in the setter\n    vot = VOTableFile()\n    for version in ('1.1', '1.2', '1.3', '1.4'):\n        vot.version = version\n    for version in ('1.0', '2.0'):\n        with pytest.raises(ValueError, match=r\"supports VOTable versions '1.1', '1.2', '1.3', '1.4'$\"):\n            vot.version = version\n\n    # Exercise the checks in the parser.\n    begin = b'<?xml version=\"1.0\" encoding=\"utf-8\"?><VOTABLE version=\"'\n    middle = b'\" xmlns=\"http://www.ivoa.net/xml/VOTable/v'\n    end = b'\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><RESOURCE/></VOTABLE>'\n\n    # Valid versions\n    for bversion in (b'1.1', b'1.2', b'1.3'):\n        parse(io.BytesIO(begin + bversion + middle + bversion + end), verify='exception')\n    parse(io.BytesIO(begin + b'1.4' + middle + b'1.3' + end), verify='exception')\n\n    # Invalid versions\n    for bversion in (b'1.0', b'2.0'):\n        with pytest.warns(W21):\n            parse(io.BytesIO(begin + bversion + middle + bversion + end), verify='exception')"},{"col":0,"comment":"null","endLoc":309,"header":"def write_index_table(root, basename, name, subresults, inside=None,\n                      total=None, chunk_size=500)","id":7012,"name":"write_index_table","nodeType":"Function","startLoc":303,"text":"def write_index_table(root, basename, name, subresults, inside=None,\n                      total=None, chunk_size=500):\n    if total is None:\n        total = len(subresults)\n    percentage = (float(len(subresults)) / total)\n    numbers = f'{len(subresults):d} ({percentage:.2%})'\n    write_table(basename, name + ' ' + numbers, subresults, root, chunk_size)"},{"col":0,"comment":"null","endLoc":268,"header":"def write_table(basename, name, results, root=\"results\", chunk_size=500)","id":7013,"name":"write_table","nodeType":"Function","startLoc":226,"text":"def write_table(basename, name, results, root=\"results\", chunk_size=500):\n    def write_page_links(j):\n        if npages <= 1:\n            return\n        with w.tag('center'):\n            if j > 0:\n                w.element('a', '<< ', href=f'{basename}_{j - 1:02d}.html')\n            for i in range(npages):\n                if i == j:\n                    w.data(str(i+1))\n                else:\n                    w.element(\n                        'a', str(i+1),\n                        href=f'{basename}_{i:02d}.html')\n                w.data(' ')\n            if j < npages - 1:\n                w.element('a', '>>', href=f'{basename}_{j + 1:02d}.html')\n\n    npages = int(ceil(float(len(results)) / chunk_size))\n\n    for i, j in enumerate(range(0, max(len(results), 1), chunk_size)):\n        subresults = results[j:j+chunk_size]\n        path = os.path.join(root, f'{basename}_{i:02d}.html')\n        with open(path, 'w', encoding='utf-8') as fd:\n            w = XMLWriter(fd)\n            with make_html_header(w):\n                write_page_links(i)\n\n                w.element('h2', name)\n\n                with w.tag('table'):\n                    with w.tag('tr'):\n                        w.element('th', 'URL')\n                        w.element('th', 'Network')\n                        w.element('th', 'Warnings')\n                        w.element('th', 'Schema')\n                        w.element('th', 'Expected')\n                        w.element('th', 'votlint')\n\n                    for result in subresults:\n                        write_result_row(w, result)\n\n                write_page_links(i)"},{"col":4,"comment":"null","endLoc":1621,"header":"def _setup(self, config, pos)","id":7014,"name":"_setup","nodeType":"Function","startLoc":1619,"text":"def _setup(self, config, pos):\n        Field._setup(self, config, pos)\n        self.value = self._value"},{"attributeType":"null","col":8,"comment":"null","endLoc":2164,"id":7015,"name":"_votable","nodeType":"Attribute","startLoc":2164,"text":"self._votable"},{"attributeType":"null","col":8,"comment":"null","endLoc":2182,"id":7016,"name":"_params","nodeType":"Attribute","startLoc":2182,"text":"self._params"},{"col":4,"comment":"null","endLoc":1630,"header":"def to_xml(self, w, **kwargs)","id":7017,"name":"to_xml","nodeType":"Function","startLoc":1623,"text":"def to_xml(self, w, **kwargs):\n        tmp_value = self._value\n        self._value = self.converter.output(tmp_value, False)\n        # We must always have a value\n        if self._value is None:\n            self._value = \"\"\n        Field.to_xml(self, w, **kwargs)\n        self._value = tmp_value"},{"col":0,"comment":"\n    Reads the header of a file to determine if it is a VOTable file.\n\n    Parameters\n    ----------\n    origin : str or readable file-like\n        Path or file object containing a VOTABLE_ xml file.\n\n    Returns\n    -------\n    is_votable : bool\n        Returns `True` if the given file is a VOTable file.\n    ","endLoc":45,"header":"def is_votable(origin, filepath, fileobj, *args, **kwargs)","id":7018,"name":"is_votable","nodeType":"Function","startLoc":16,"text":"def is_votable(origin, filepath, fileobj, *args, **kwargs):\n    \"\"\"\n    Reads the header of a file to determine if it is a VOTable file.\n\n    Parameters\n    ----------\n    origin : str or readable file-like\n        Path or file object containing a VOTABLE_ xml file.\n\n    Returns\n    -------\n    is_votable : bool\n        Returns `True` if the given file is a VOTable file.\n    \"\"\"\n    from . import is_votable\n    if origin == 'read':\n        if fileobj is not None:\n            try:\n                result = is_votable(fileobj)\n            finally:\n                fileobj.seek(0)\n            return result\n        elif filepath is not None:\n            return is_votable(filepath)\n        elif isinstance(args[0], (VOTableFile, VOTable)):\n            return True\n        else:\n            return False\n    else:\n        return False"},{"attributeType":"null","col":4,"comment":"null","endLoc":1587,"id":7020,"name":"_attr_list_11","nodeType":"Attribute","startLoc":1587,"text":"_attr_list_11"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":7021,"name":"__all__","nodeType":"Attribute","startLoc":16,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"main.py#<anonymous>","id":7022,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nValidates a large collection of web-accessible VOTable files,\nand generates a report as a directory tree of HTML files.\n\"\"\"\n\n__all__ = ['make_validation_report']"},{"attributeType":"null","col":4,"comment":"null","endLoc":1588,"id":7023,"name":"_attr_list_12","nodeType":"Attribute","startLoc":1588,"text":"_attr_list_12"},{"attributeType":"null","col":4,"comment":"null","endLoc":1589,"id":7024,"name":"_element_name","nodeType":"Attribute","startLoc":1589,"text":"_element_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":1595,"id":7025,"name":"_value","nodeType":"Attribute","startLoc":1595,"text":"self._value"},{"fileName":"result.py","filePath":"astropy/io/votable/validator","id":7026,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nContains a class to handle a validation result for a single VOTable\nfile.\n\"\"\"\n\n\n# STDLIB\nfrom xml.parsers.expat import ExpatError\nimport hashlib\nimport os\nimport shutil\nimport socket\nimport subprocess\nimport warnings\nimport pickle\nimport urllib.request\nimport urllib.error\nimport http.client\n\n# VO\nfrom astropy.io.votable import table\nfrom astropy.io.votable import exceptions\nfrom astropy.io.votable import xmlutil\n\n\nclass Result:\n    def __init__(self, url, root='results', timeout=10):\n        self.url = url\n        m = hashlib.md5()\n        m.update(url)\n        self._hash = m.hexdigest()\n        self._root = root\n        self._path = os.path.join(\n            self._hash[0:2], self._hash[2:4], self._hash[4:])\n        if not os.path.exists(self.get_dirpath()):\n            os.makedirs(self.get_dirpath())\n        self.timeout = timeout\n        self.load_attributes()\n\n    def __enter__(self):\n        return self\n\n    def __exit__(self, *args):\n        self.save_attributes()\n\n    def get_dirpath(self):\n        return os.path.join(self._root, self._path)\n\n    def get_htmlpath(self):\n        return self._path\n\n    def get_attribute_path(self):\n        return os.path.join(self.get_dirpath(), \"values.dat\")\n\n    def get_vo_xml_path(self):\n        return os.path.join(self.get_dirpath(), \"vo.xml\")\n\n    # ATTRIBUTES\n\n    def load_attributes(self):\n        path = self.get_attribute_path()\n        if os.path.exists(path):\n            try:\n                with open(path, 'rb') as fd:\n                    self._attributes = pickle.load(fd)\n            except Exception:\n                shutil.rmtree(self.get_dirpath())\n                os.makedirs(self.get_dirpath())\n                self._attributes = {}\n        else:\n            self._attributes = {}\n\n    def save_attributes(self):\n        path = self.get_attribute_path()\n        with open(path, 'wb') as fd:\n            pickle.dump(self._attributes, fd)\n\n    def __getitem__(self, key):\n        return self._attributes[key]\n\n    def __setitem__(self, key, val):\n        self._attributes[key] = val\n\n    def __contains__(self, key):\n        return key in self._attributes\n\n    # VO XML\n\n    def download_xml_content(self):\n        path = self.get_vo_xml_path()\n\n        if 'network_error' not in self._attributes:\n            self['network_error'] = None\n\n        if os.path.exists(path):\n            return\n\n        def fail(reason):\n            reason = str(reason)\n            with open(path, 'wb') as fd:\n                fd.write(f'FAILED: {reason}\\n'.encode('utf-8'))\n            self['network_error'] = reason\n\n        r = None\n        try:\n            r = urllib.request.urlopen(\n                self.url.decode('ascii'), timeout=self.timeout)\n        except urllib.error.URLError as e:\n            if hasattr(e, 'reason'):\n                reason = e.reason\n            else:\n                reason = e.code\n            fail(reason)\n            return\n        except http.client.HTTPException as e:\n            fail(f\"HTTPException: {str(e)}\")\n            return\n        except (socket.timeout, socket.error) as e:\n            fail(\"Timeout\")\n            return\n\n        if r is None:\n            fail(\"Invalid URL\")\n            return\n\n        try:\n            content = r.read()\n        except socket.timeout as e:\n            fail(\"Timeout\")\n            return\n        else:\n            r.close()\n\n        with open(path, 'wb') as fd:\n            fd.write(content)\n\n    def get_xml_content(self):\n        path = self.get_vo_xml_path()\n        if not os.path.exists(path):\n            self.download_xml_content()\n        with open(path, 'rb') as fd:\n            content = fd.read()\n        return content\n\n    def validate_vo(self):\n        path = self.get_vo_xml_path()\n        if not os.path.exists(path):\n            self.download_xml_content()\n        self['version'] = ''\n        if 'network_error' in self and self['network_error'] is not None:\n            self['nwarnings'] = 0\n            self['nexceptions'] = 0\n            self['warnings'] = []\n            self['xmllint'] = None\n            self['warning_types'] = set()\n            return\n\n        nexceptions = 0\n        nwarnings = 0\n        t = None\n        lines = []\n        with open(path, 'rb') as input:\n            with warnings.catch_warnings(record=True) as warning_lines:\n                try:\n                    t = table.parse(input, verify='warn', filename=path)\n                except (ValueError, TypeError, ExpatError) as e:\n                    lines.append(str(e))\n                    nexceptions += 1\n        lines = [str(x.message) for x in warning_lines] + lines\n\n        if t is not None:\n            self['version'] = version = t.version\n        else:\n            self['version'] = version = \"1.0\"\n\n        if 'xmllint' not in self:\n            # Now check the VO schema based on the version in\n            # the file.\n            try:\n                success, stdout, stderr = xmlutil.validate_schema(path, version)\n            # OSError is raised when XML file eats all memory and\n            # system sends kill signal.\n            except OSError as e:\n                self['xmllint'] = None\n                self['xmllint_content'] = str(e)\n            else:\n                self['xmllint'] = (success == 0)\n                self['xmllint_content'] = stderr\n\n        warning_types = set()\n        for line in lines:\n            w = exceptions.parse_vowarning(line)\n            if w['is_warning']:\n                nwarnings += 1\n            if w['is_exception']:\n                nexceptions += 1\n            warning_types.add(w['warning'])\n\n        self['nwarnings'] = nwarnings\n        self['nexceptions'] = nexceptions\n        self['warnings'] = lines\n        self['warning_types'] = warning_types\n\n    def has_warning(self, warning_code):\n        return warning_code in self['warning_types']\n\n    def match_expectations(self):\n        if 'network_error' not in self:\n            self['network_error'] = None\n\n        if self['expected'] == 'good':\n            return (not self['network_error'] and\n                    self['nwarnings'] == 0 and\n                    self['nexceptions'] == 0)\n        elif self['expected'] == 'incorrect':\n            return (not self['network_error'] and\n                    (self['nwarnings'] > 0 or\n                     self['nexceptions'] > 0))\n        elif self['expected'] == 'broken':\n            return self['network_error'] is not None\n\n    def validate_with_votlint(self, path_to_stilts_jar):\n        filename = self.get_vo_xml_path()\n        p = subprocess.Popen(\n            f\"java -jar {path_to_stilts_jar} votlint validate=false {filename}\",\n            shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n        stdout, stderr = p.communicate()\n        if len(stdout) or p.returncode:\n            self['votlint'] = False\n        else:\n            self['votlint'] = True\n        self['votlint_content'] = stdout\n\n\ndef get_result_subsets(results, root, s=None):\n    all_results = []\n    correct = []\n    not_expected = []\n    fail_schema = []\n    schema_mismatch = []\n    fail_votlint = []\n    votlint_mismatch = []\n    network_failures = []\n    version_10 = []\n    version_11 = []\n    version_12 = []\n    version_unknown = []\n    has_warnings = []\n    warning_set = {}\n    has_exceptions = []\n    exception_set = {}\n\n    for url in results:\n        if s:\n            next(s)\n\n        if isinstance(url, Result):\n            x = url\n        else:\n            x = Result(url, root=root)\n\n        all_results.append(x)\n        if (x['nwarnings'] == 0 and\n                x['nexceptions'] == 0 and\n                x['xmllint'] is True):\n            correct.append(x)\n        if not x.match_expectations():\n            not_expected.append(x)\n        if x['xmllint'] is False:\n            fail_schema.append(x)\n        if (x['xmllint'] is False and\n                x['nwarnings'] == 0 and\n                x['nexceptions'] == 0):\n            schema_mismatch.append(x)\n        if 'votlint' in x and x['votlint'] is False:\n            fail_votlint.append(x)\n            if 'network_error' not in x:\n                x['network_error'] = None\n            if (x['nwarnings'] == 0 and\n                    x['nexceptions'] == 0 and\n                    x['network_error'] is None):\n                votlint_mismatch.append(x)\n        if 'network_error' in x and x['network_error'] is not None:\n            network_failures.append(x)\n        version = x['version']\n        if version == '1.0':\n            version_10.append(x)\n        elif version == '1.1':\n            version_11.append(x)\n        elif version == '1.2':\n            version_12.append(x)\n        else:\n            version_unknown.append(x)\n        if x['nwarnings'] > 0:\n            has_warnings.append(x)\n            for warning in x['warning_types']:\n                if (warning is not None and\n                        len(warning) == 3 and\n                        warning.startswith('W')):\n                    warning_set.setdefault(warning, [])\n                    warning_set[warning].append(x)\n        if x['nexceptions'] > 0:\n            has_exceptions.append(x)\n            for exc in x['warning_types']:\n                if exc is not None and len(exc) == 3 and exc.startswith('E'):\n                    exception_set.setdefault(exc, [])\n                    exception_set[exc].append(x)\n\n    warning_set = list(warning_set.items())\n    warning_set.sort()\n    exception_set = list(exception_set.items())\n    exception_set.sort()\n\n    tables = [\n        ('all', 'All tests', all_results),\n        ('correct', 'Correct', correct),\n        ('unexpected', 'Unexpected', not_expected),\n        ('schema', 'Invalid against schema', fail_schema),\n        ('schema_mismatch', 'Invalid against schema/Passed vo.table',\n         schema_mismatch, ['ul']),\n        ('fail_votlint', 'Failed votlint', fail_votlint),\n        ('votlint_mismatch', 'Failed votlint/Passed vo.table',\n         votlint_mismatch, ['ul']),\n        ('network_failures', 'Network failures', network_failures),\n        ('version1.0', 'Version 1.0', version_10),\n        ('version1.1', 'Version 1.1', version_11),\n        ('version1.2', 'Version 1.2', version_12),\n        ('version_unknown', 'Version unknown', version_unknown),\n        ('warnings', 'Warnings', has_warnings)]\n    for warning_code, warning in warning_set:\n        if s:\n            next(s)\n\n        warning_class = getattr(exceptions, warning_code, None)\n        if warning_class:\n            warning_descr = warning_class.get_short_name()\n            tables.append(\n                (warning_code,\n                 f'{warning_code}: {warning_descr}',\n                 warning, ['ul', 'li']))\n    tables.append(\n        ('exceptions', 'Exceptions', has_exceptions))\n    for exception_code, exc in exception_set:\n        if s:\n            next(s)\n\n        exception_class = getattr(exceptions, exception_code, None)\n        if exception_class:\n            exception_descr = exception_class.get_short_name()\n            tables.append(\n                (exception_code,\n                 f'{exception_code}: {exception_descr}',\n                 exc, ['ul', 'li']))\n\n    return tables\n"},{"className":"Result","col":0,"comment":"null","endLoc":233,"id":7027,"nodeType":"Class","startLoc":27,"text":"class Result:\n    def __init__(self, url, root='results', timeout=10):\n        self.url = url\n        m = hashlib.md5()\n        m.update(url)\n        self._hash = m.hexdigest()\n        self._root = root\n        self._path = os.path.join(\n            self._hash[0:2], self._hash[2:4], self._hash[4:])\n        if not os.path.exists(self.get_dirpath()):\n            os.makedirs(self.get_dirpath())\n        self.timeout = timeout\n        self.load_attributes()\n\n    def __enter__(self):\n        return self\n\n    def __exit__(self, *args):\n        self.save_attributes()\n\n    def get_dirpath(self):\n        return os.path.join(self._root, self._path)\n\n    def get_htmlpath(self):\n        return self._path\n\n    def get_attribute_path(self):\n        return os.path.join(self.get_dirpath(), \"values.dat\")\n\n    def get_vo_xml_path(self):\n        return os.path.join(self.get_dirpath(), \"vo.xml\")\n\n    # ATTRIBUTES\n\n    def load_attributes(self):\n        path = self.get_attribute_path()\n        if os.path.exists(path):\n            try:\n                with open(path, 'rb') as fd:\n                    self._attributes = pickle.load(fd)\n            except Exception:\n                shutil.rmtree(self.get_dirpath())\n                os.makedirs(self.get_dirpath())\n                self._attributes = {}\n        else:\n            self._attributes = {}\n\n    def save_attributes(self):\n        path = self.get_attribute_path()\n        with open(path, 'wb') as fd:\n            pickle.dump(self._attributes, fd)\n\n    def __getitem__(self, key):\n        return self._attributes[key]\n\n    def __setitem__(self, key, val):\n        self._attributes[key] = val\n\n    def __contains__(self, key):\n        return key in self._attributes\n\n    # VO XML\n\n    def download_xml_content(self):\n        path = self.get_vo_xml_path()\n\n        if 'network_error' not in self._attributes:\n            self['network_error'] = None\n\n        if os.path.exists(path):\n            return\n\n        def fail(reason):\n            reason = str(reason)\n            with open(path, 'wb') as fd:\n                fd.write(f'FAILED: {reason}\\n'.encode('utf-8'))\n            self['network_error'] = reason\n\n        r = None\n        try:\n            r = urllib.request.urlopen(\n                self.url.decode('ascii'), timeout=self.timeout)\n        except urllib.error.URLError as e:\n            if hasattr(e, 'reason'):\n                reason = e.reason\n            else:\n                reason = e.code\n            fail(reason)\n            return\n        except http.client.HTTPException as e:\n            fail(f\"HTTPException: {str(e)}\")\n            return\n        except (socket.timeout, socket.error) as e:\n            fail(\"Timeout\")\n            return\n\n        if r is None:\n            fail(\"Invalid URL\")\n            return\n\n        try:\n            content = r.read()\n        except socket.timeout as e:\n            fail(\"Timeout\")\n            return\n        else:\n            r.close()\n\n        with open(path, 'wb') as fd:\n            fd.write(content)\n\n    def get_xml_content(self):\n        path = self.get_vo_xml_path()\n        if not os.path.exists(path):\n            self.download_xml_content()\n        with open(path, 'rb') as fd:\n            content = fd.read()\n        return content\n\n    def validate_vo(self):\n        path = self.get_vo_xml_path()\n        if not os.path.exists(path):\n            self.download_xml_content()\n        self['version'] = ''\n        if 'network_error' in self and self['network_error'] is not None:\n            self['nwarnings'] = 0\n            self['nexceptions'] = 0\n            self['warnings'] = []\n            self['xmllint'] = None\n            self['warning_types'] = set()\n            return\n\n        nexceptions = 0\n        nwarnings = 0\n        t = None\n        lines = []\n        with open(path, 'rb') as input:\n            with warnings.catch_warnings(record=True) as warning_lines:\n                try:\n                    t = table.parse(input, verify='warn', filename=path)\n                except (ValueError, TypeError, ExpatError) as e:\n                    lines.append(str(e))\n                    nexceptions += 1\n        lines = [str(x.message) for x in warning_lines] + lines\n\n        if t is not None:\n            self['version'] = version = t.version\n        else:\n            self['version'] = version = \"1.0\"\n\n        if 'xmllint' not in self:\n            # Now check the VO schema based on the version in\n            # the file.\n            try:\n                success, stdout, stderr = xmlutil.validate_schema(path, version)\n            # OSError is raised when XML file eats all memory and\n            # system sends kill signal.\n            except OSError as e:\n                self['xmllint'] = None\n                self['xmllint_content'] = str(e)\n            else:\n                self['xmllint'] = (success == 0)\n                self['xmllint_content'] = stderr\n\n        warning_types = set()\n        for line in lines:\n            w = exceptions.parse_vowarning(line)\n            if w['is_warning']:\n                nwarnings += 1\n            if w['is_exception']:\n                nexceptions += 1\n            warning_types.add(w['warning'])\n\n        self['nwarnings'] = nwarnings\n        self['nexceptions'] = nexceptions\n        self['warnings'] = lines\n        self['warning_types'] = warning_types\n\n    def has_warning(self, warning_code):\n        return warning_code in self['warning_types']\n\n    def match_expectations(self):\n        if 'network_error' not in self:\n            self['network_error'] = None\n\n        if self['expected'] == 'good':\n            return (not self['network_error'] and\n                    self['nwarnings'] == 0 and\n                    self['nexceptions'] == 0)\n        elif self['expected'] == 'incorrect':\n            return (not self['network_error'] and\n                    (self['nwarnings'] > 0 or\n                     self['nexceptions'] > 0))\n        elif self['expected'] == 'broken':\n            return self['network_error'] is not None\n\n    def validate_with_votlint(self, path_to_stilts_jar):\n        filename = self.get_vo_xml_path()\n        p = subprocess.Popen(\n            f\"java -jar {path_to_stilts_jar} votlint validate=false {filename}\",\n            shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n        stdout, stderr = p.communicate()\n        if len(stdout) or p.returncode:\n            self['votlint'] = False\n        else:\n            self['votlint'] = True\n        self['votlint_content'] = stdout"},{"col":0,"comment":"\n    Read a Table object from an VO table file\n\n    Parameters\n    ----------\n    input : str or `~astropy.io.votable.tree.VOTableFile` or `~astropy.io.votable.tree.Table`\n        If a string, the filename to read the table from. If a\n        :class:`~astropy.io.votable.tree.VOTableFile` or\n        :class:`~astropy.io.votable.tree.Table` object, the object to extract\n        the table from.\n\n    table_id : str or int, optional\n        The table to read in.  If a `str`, it is an ID corresponding\n        to the ID of the table in the file (not all VOTable files\n        assign IDs to their tables).  If an `int`, it is the index of\n        the table in the file, starting at 0.\n\n    use_names_over_ids : bool, optional\n        When `True` use the ``name`` attributes of columns as the names\n        of columns in the `~astropy.table.Table` instance.  Since names\n        are not guaranteed to be unique, this may cause some columns\n        to be renamed by appending numbers to the end.  Otherwise\n        (default), use the ID attributes as the column names.\n\n    verify : {'ignore', 'warn', 'exception'}, optional\n        When ``'exception'``, raise an error when the file violates the spec,\n        otherwise either issue a warning (``'warn'``) or silently continue\n        (``'ignore'``). Warnings may be controlled using the standard Python\n        mechanisms.  See the `warnings` module in the Python standard library\n        for more information. When not provided, uses the configuration setting\n        ``astropy.io.votable.verify``, which defaults to ``'ignore'``.\n\n    **kwargs\n        Additional keyword arguments are passed on to\n        :func:`astropy.io.votable.table.parse`.\n    ","endLoc":127,"header":"def read_table_votable(input, table_id=None, use_names_over_ids=False,\n                       verify=None, **kwargs)","id":7028,"name":"read_table_votable","nodeType":"Function","startLoc":48,"text":"def read_table_votable(input, table_id=None, use_names_over_ids=False,\n                       verify=None, **kwargs):\n    \"\"\"\n    Read a Table object from an VO table file\n\n    Parameters\n    ----------\n    input : str or `~astropy.io.votable.tree.VOTableFile` or `~astropy.io.votable.tree.Table`\n        If a string, the filename to read the table from. If a\n        :class:`~astropy.io.votable.tree.VOTableFile` or\n        :class:`~astropy.io.votable.tree.Table` object, the object to extract\n        the table from.\n\n    table_id : str or int, optional\n        The table to read in.  If a `str`, it is an ID corresponding\n        to the ID of the table in the file (not all VOTable files\n        assign IDs to their tables).  If an `int`, it is the index of\n        the table in the file, starting at 0.\n\n    use_names_over_ids : bool, optional\n        When `True` use the ``name`` attributes of columns as the names\n        of columns in the `~astropy.table.Table` instance.  Since names\n        are not guaranteed to be unique, this may cause some columns\n        to be renamed by appending numbers to the end.  Otherwise\n        (default), use the ID attributes as the column names.\n\n    verify : {'ignore', 'warn', 'exception'}, optional\n        When ``'exception'``, raise an error when the file violates the spec,\n        otherwise either issue a warning (``'warn'``) or silently continue\n        (``'ignore'``). Warnings may be controlled using the standard Python\n        mechanisms.  See the `warnings` module in the Python standard library\n        for more information. When not provided, uses the configuration setting\n        ``astropy.io.votable.verify``, which defaults to ``'ignore'``.\n\n    **kwargs\n        Additional keyword arguments are passed on to\n        :func:`astropy.io.votable.table.parse`.\n    \"\"\"\n    if not isinstance(input, (VOTableFile, VOTable)):\n        input = parse(input, table_id=table_id, verify=verify, **kwargs)\n\n    # Parse all table objects\n    table_id_mapping = dict()\n    tables = []\n    if isinstance(input, VOTableFile):\n        for table in input.iter_tables():\n            if table.ID is not None:\n                table_id_mapping[table.ID] = table\n            tables.append(table)\n\n        if len(tables) > 1:\n            if table_id is None:\n                raise ValueError(\n                    \"Multiple tables found: table id should be set via \"\n                    \"the table_id= argument. The available tables are {}, \"\n                    'or integers less than {}.'.format(\n                        ', '.join(table_id_mapping.keys()), len(tables)))\n            elif isinstance(table_id, str):\n                if table_id in table_id_mapping:\n                    table = table_id_mapping[table_id]\n                else:\n                    raise ValueError(\n                        f\"No tables with id={table_id} found\")\n            elif isinstance(table_id, int):\n                if table_id < len(tables):\n                    table = tables[table_id]\n                else:\n                    raise IndexError(\n                        \"Table index {} is out of range. \"\n                        \"{} tables found\".format(\n                            table_id, len(tables)))\n        elif len(tables) == 1:\n            table = tables[0]\n        else:\n            raise ValueError(\"No table found\")\n    elif isinstance(input, VOTable):\n        table = input\n\n    # Convert to an astropy.table.Table object\n    return table.to_table(use_names_over_ids=use_names_over_ids)"},{"col":4,"comment":"null","endLoc":42,"header":"def __enter__(self)","id":7029,"name":"__enter__","nodeType":"Function","startLoc":41,"text":"def __enter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":45,"header":"def __exit__(self, *args)","id":7030,"name":"__exit__","nodeType":"Function","startLoc":44,"text":"def __exit__(self, *args):\n        self.save_attributes()"},{"col":4,"comment":"null","endLoc":77,"header":"def save_attributes(self)","id":7031,"name":"save_attributes","nodeType":"Function","startLoc":74,"text":"def save_attributes(self):\n        path = self.get_attribute_path()\n        with open(path, 'wb') as fd:\n            pickle.dump(self._attributes, fd)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1621,"id":7032,"name":"value","nodeType":"Attribute","startLoc":1621,"text":"self.value"},{"col":4,"comment":"null","endLoc":51,"header":"def get_htmlpath(self)","id":7033,"name":"get_htmlpath","nodeType":"Function","startLoc":50,"text":"def get_htmlpath(self):\n        return self._path"},{"col":4,"comment":"null","endLoc":80,"header":"def __getitem__(self, key)","id":7034,"name":"__getitem__","nodeType":"Function","startLoc":79,"text":"def __getitem__(self, key):\n        return self._attributes[key]"},{"col":4,"comment":"null","endLoc":83,"header":"def __setitem__(self, key, val)","id":7035,"name":"__setitem__","nodeType":"Function","startLoc":82,"text":"def __setitem__(self, key, val):\n        self._attributes[key] = val"},{"col":4,"comment":"null","endLoc":86,"header":"def __contains__(self, key)","id":7036,"name":"__contains__","nodeType":"Function","startLoc":85,"text":"def __contains__(self, key):\n        return key in self._attributes"},{"col":4,"comment":"null","endLoc":144,"header":"def get_xml_content(self)","id":7037,"name":"get_xml_content","nodeType":"Function","startLoc":138,"text":"def get_xml_content(self):\n        path = self.get_vo_xml_path()\n        if not os.path.exists(path):\n            self.download_xml_content()\n        with open(path, 'rb') as fd:\n            content = fd.read()\n        return content"},{"className":"CooSys","col":0,"comment":"\n    COOSYS_ element: defines a coordinate system.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    ","endLoc":1736,"id":7038,"nodeType":"Class","startLoc":1633,"text":"class CooSys(SimpleElement):\n    \"\"\"\n    COOSYS_ element: defines a coordinate system.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    \"\"\"\n    _attr_list = ['ID', 'equinox', 'epoch', 'system']\n    _element_name = 'COOSYS'\n\n    def __init__(self, ID=None, equinox=None, epoch=None, system=None, id=None,\n                 config=None, pos=None, **extra):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        # COOSYS was deprecated in 1.2 but then re-instated in 1.3\n        if (config.get('version_1_2_or_later') and\n                not config.get('version_1_3_or_later')):\n            warn_or_raise(W27, W27, (), config, pos)\n\n        SimpleElement.__init__(self)\n\n        self.ID = resolve_id(ID, id, config, pos)\n        self.equinox = equinox\n        self.epoch = epoch\n        self.system = system\n\n        warn_unknown_attrs('COOSYS', extra.keys(), config, pos)\n\n    @property\n    def ID(self):\n        \"\"\"\n        [*required*] The XML ID of the COOSYS_ element, used for\n        cross-referencing.  May be `None` or a string conforming to\n        XML ID_ syntax.\n        \"\"\"\n        return self._ID\n\n    @ID.setter\n    def ID(self, ID):\n        if self._config.get('version_1_1_or_later'):\n            if ID is None:\n                vo_raise(E15, (), self._config, self._pos)\n        xmlutil.check_id(ID, 'ID', self._config, self._pos)\n        self._ID = ID\n\n    @property\n    def system(self):\n        \"\"\"\n        Specifies the type of coordinate system.  Valid choices are:\n\n          'eq_FK4', 'eq_FK5', 'ICRS', 'ecl_FK4', 'ecl_FK5', 'galactic',\n          'supergalactic', 'xy', 'barycentric', or 'geo_app'\n        \"\"\"\n        return self._system\n\n    @system.setter\n    def system(self, system):\n        if system not in ('eq_FK4', 'eq_FK5', 'ICRS', 'ecl_FK4', 'ecl_FK5',\n                          'galactic', 'supergalactic', 'xy', 'barycentric',\n                          'geo_app'):\n            warn_or_raise(E16, E16, system, self._config, self._pos)\n        self._system = system\n\n    @system.deleter\n    def system(self):\n        self._system = None\n\n    @property\n    def equinox(self):\n        \"\"\"\n        A parameter required to fix the equatorial or ecliptic systems\n        (as e.g. \"J2000\" as the default \"eq_FK5\" or \"B1950\" as the\n        default \"eq_FK4\").\n        \"\"\"\n        return self._equinox\n\n    @equinox.setter\n    def equinox(self, equinox):\n        check_astroyear(equinox, 'equinox', self._config, self._pos)\n        self._equinox = equinox\n\n    @equinox.deleter\n    def equinox(self):\n        self._equinox = None\n\n    @property\n    def epoch(self):\n        \"\"\"\n        Specifies the epoch of the positions.  It must be a string\n        specifying an astronomical year.\n        \"\"\"\n        return self._epoch\n\n    @epoch.setter\n    def epoch(self, epoch):\n        check_astroyear(epoch, 'epoch', self._config, self._pos)\n        self._epoch = epoch\n\n    @epoch.deleter\n    def epoch(self):\n        self._epoch = None"},{"col":4,"comment":"\n        [*required*] The XML ID of the COOSYS_ element, used for\n        cross-referencing.  May be `None` or a string conforming to\n        XML ID_ syntax.\n        ","endLoc":1671,"header":"@property\n    def ID(self)","id":7039,"name":"ID","nodeType":"Function","startLoc":1664,"text":"@property\n    def ID(self):\n        \"\"\"\n        [*required*] The XML ID of the COOSYS_ element, used for\n        cross-referencing.  May be `None` or a string conforming to\n        XML ID_ syntax.\n        \"\"\"\n        return self._ID"},{"col":4,"comment":"null","endLoc":1679,"header":"@ID.setter\n    def ID(self, ID)","id":7040,"name":"ID","nodeType":"Function","startLoc":1673,"text":"@ID.setter\n    def ID(self, ID):\n        if self._config.get('version_1_1_or_later'):\n            if ID is None:\n                vo_raise(E15, (), self._config, self._pos)\n        xmlutil.check_id(ID, 'ID', self._config, self._pos)\n        self._ID = ID"},{"col":4,"comment":"null","endLoc":206,"header":"def has_warning(self, warning_code)","id":7041,"name":"has_warning","nodeType":"Function","startLoc":205,"text":"def has_warning(self, warning_code):\n        return warning_code in self['warning_types']"},{"col":4,"comment":"null","endLoc":221,"header":"def match_expectations(self)","id":7042,"name":"match_expectations","nodeType":"Function","startLoc":208,"text":"def match_expectations(self):\n        if 'network_error' not in self:\n            self['network_error'] = None\n\n        if self['expected'] == 'good':\n            return (not self['network_error'] and\n                    self['nwarnings'] == 0 and\n                    self['nexceptions'] == 0)\n        elif self['expected'] == 'incorrect':\n            return (not self['network_error'] and\n                    (self['nwarnings'] > 0 or\n                     self['nexceptions'] > 0))\n        elif self['expected'] == 'broken':\n            return self['network_error'] is not None"},{"attributeType":"null","col":8,"comment":"null","endLoc":33,"id":7043,"name":"_root","nodeType":"Attribute","startLoc":33,"text":"self._root"},{"col":0,"comment":"null","endLoc":288,"header":"def add_subset(w, basename, name, subresults, inside=['p'], total=None)","id":7044,"name":"add_subset","nodeType":"Function","startLoc":271,"text":"def add_subset(w, basename, name, subresults, inside=['p'], total=None):\n    with w.tag('tr'):\n        subresults = list(subresults)\n        if total is None:\n            total = len(subresults)\n        if total == 0:  # pragma: no cover\n            percentage = 0.0\n        else:\n            percentage = (float(len(subresults)) / total)\n        with w.tag('td'):\n            for element in inside:\n                w.start(element)\n            w.element('a', name, href=f'{basename}_00.html')\n            for element in reversed(inside):\n                w.end(element)\n        numbers = f'{len(subresults):d} ({percentage:.2%})'\n        with w.tag('td'):\n            w.data(numbers)"},{"col":0,"comment":"null","endLoc":300,"header":"def write_index(subsets, results, root='results')","id":7045,"name":"write_index","nodeType":"Function","startLoc":291,"text":"def write_index(subsets, results, root='results'):\n    path = os.path.join(root, 'index.html')\n    with open(path, 'w', encoding='utf-8') as fd:\n        w = XMLWriter(fd)\n        with make_html_header(w):\n            w.element('h1', 'VO Validation results')\n\n            with w.tag('table'):\n                for subset in subsets:\n                    add_subset(w, *subset, total=len(results))"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":7046,"name":"html_header","nodeType":"Attribute","startLoc":16,"text":"html_header"},{"attributeType":"null","col":8,"comment":"null","endLoc":32,"id":7047,"name":"_hash","nodeType":"Attribute","startLoc":32,"text":"self._hash"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":7048,"name":"default_style","nodeType":"Attribute","startLoc":22,"text":"default_style"},{"col":0,"comment":"","endLoc":4,"header":"html.py#<anonymous>","id":7049,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"html_header = \"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE html\n        PUBLIC \"-//W3C//DTD XHTML Basic 1.0//EN\"\n        \"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd\">\n\"\"\"\n\ndefault_style = \"\"\"\nbody {\nfont-family: sans-serif\n}\na {\ntext-decoration: none\n}\n.highlight {\ncolor: red;\nfont-weight: bold;\ntext-decoration: underline;\n}\n.green { background-color: #ddffdd }\n.red   { background-color: #ffdddd }\n.yellow { background-color: #ffffdd }\ntr:hover { background-color: #dddddd }\ntable {\n        border-width: 1px;\n        border-spacing: 0px;\n        border-style: solid;\n        border-color: gray;\n        border-collapse: collapse;\n        background-color: white;\n        padding: 5px;\n}\ntable th {\n        border-width: 1px;\n        padding: 5px;\n        border-style: solid;\n        border-color: gray;\n}\ntable td {\n        border-width: 1px;\n        padding: 5px;\n        border-style: solid;\n        border-color: gray;\n}\n\"\"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":34,"id":7050,"name":"_path","nodeType":"Attribute","startLoc":34,"text":"self._path"},{"col":4,"comment":"\n        Specifies the type of coordinate system.  Valid choices are:\n\n          'eq_FK4', 'eq_FK5', 'ICRS', 'ecl_FK4', 'ecl_FK5', 'galactic',\n          'supergalactic', 'xy', 'barycentric', or 'geo_app'\n        ","endLoc":1689,"header":"@property\n    def system(self)","id":7051,"name":"system","nodeType":"Function","startLoc":1681,"text":"@property\n    def system(self):\n        \"\"\"\n        Specifies the type of coordinate system.  Valid choices are:\n\n          'eq_FK4', 'eq_FK5', 'ICRS', 'ecl_FK4', 'ecl_FK5', 'galactic',\n          'supergalactic', 'xy', 'barycentric', or 'geo_app'\n        \"\"\"\n        return self._system"},{"col":4,"comment":"null","endLoc":1697,"header":"@system.setter\n    def system(self, system)","id":7052,"name":"system","nodeType":"Function","startLoc":1691,"text":"@system.setter\n    def system(self, system):\n        if system not in ('eq_FK4', 'eq_FK5', 'ICRS', 'ecl_FK4', 'ecl_FK5',\n                          'galactic', 'supergalactic', 'xy', 'barycentric',\n                          'geo_app'):\n            warn_or_raise(E16, E16, system, self._config, self._pos)\n        self._system = system"},{"id":7053,"name":"astropy/io/registry","nodeType":"Package"},{"fileName":"core.py","filePath":"astropy/io/registry","id":7054,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\nimport sys\nfrom collections import OrderedDict\n\nimport numpy as np\n\nfrom .base import IORegistryError, _UnifiedIORegistryBase\n\n__all__ = ['UnifiedIORegistry', 'UnifiedInputRegistry', 'UnifiedOutputRegistry']\n\n\nPATH_TYPES = (str, os.PathLike)  # TODO! include bytes\n\n\n# -----------------------------------------------------------------------------\n\nclass UnifiedInputRegistry(_UnifiedIORegistryBase):\n    \"\"\"Read-only Unified Registry.\n\n    .. versionadded:: 5.0\n\n    Examples\n    --------\n    First let's start by creating a read-only registry.\n\n    .. code-block:: python\n\n        >>> from astropy.io.registry import UnifiedInputRegistry\n        >>> read_reg = UnifiedInputRegistry()\n\n    There is nothing in this registry. Let's make a reader for the\n    :class:`~astropy.table.Table` class::\n\n        from astropy.table import Table\n\n        def my_table_reader(filename, some_option=1):\n            # Read in the table by any means necessary\n            return table  # should be an instance of Table\n\n    Such a function can then be registered with the I/O registry::\n\n        read_reg.register_reader('my-table-format', Table, my_table_reader)\n\n    Note that we CANNOT then read in a table with::\n\n        d = Table.read('my_table_file.mtf', format='my-table-format')\n\n    Why? because ``Table.read`` uses Astropy's default global registry and this\n    is a separate registry.\n    Instead we can read by the read method on the registry::\n\n        d = read_reg.read(Table, 'my_table_file.mtf', format='my-table-format')\n\n    \"\"\"\n\n    def __init__(self):\n        super().__init__()  # set _identifiers\n        self._readers = OrderedDict()\n        self._registries[\"read\"] = dict(attr=\"_readers\", column=\"Read\")\n        self._registries_order = (\"read\", \"identify\")\n\n    # =========================================================================\n    # Read methods\n\n    def register_reader(self, data_format, data_class, function, force=False,\n                        priority=0):\n        \"\"\"\n        Register a reader function.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that will be used to\n            specify the data type when reading.\n        data_class : class\n            The class of the object that the reader produces.\n        function : function\n            The function to read in a data object.\n        force : bool, optional\n            Whether to override any existing function if already present.\n            Default is ``False``.\n        priority : int, optional\n            The priority of the reader, used to compare possible formats when\n            trying to determine the best reader to use. Higher priorities are\n            preferred over lower priorities, with the default priority being 0\n            (negative numbers are allowed though).\n        \"\"\"\n        if not (data_format, data_class) in self._readers or force:\n            self._readers[(data_format, data_class)] = function, priority\n        else:\n            raise IORegistryError(\"Reader for format '{}' and class '{}' is \"\n                              'already defined'\n                              ''.format(data_format, data_class.__name__))\n\n        if data_class not in self._delayed_docs_classes:\n            self._update__doc__(data_class, 'read')\n\n    def unregister_reader(self, data_format, data_class):\n        \"\"\"\n        Unregister a reader function\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier.\n        data_class : class\n            The class of the object that the reader produces.\n        \"\"\"\n\n        if (data_format, data_class) in self._readers:\n            self._readers.pop((data_format, data_class))\n        else:\n            raise IORegistryError(\"No reader defined for format '{}' and class '{}'\"\n                                  ''.format(data_format, data_class.__name__))\n\n        if data_class not in self._delayed_docs_classes:\n            self._update__doc__(data_class, 'read')\n\n    def get_reader(self, data_format, data_class):\n        \"\"\"Get reader for ``data_format``.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that is used to\n            specify the data type when reading/writing.\n        data_class : class\n            The class of the object that can be written.\n\n        Returns\n        -------\n        reader : callable\n            The registered reader function for this format and class.\n        \"\"\"\n        readers = [(fmt, cls) for fmt, cls in self._readers if fmt == data_format]\n        for reader_format, reader_class in readers:\n            if self._is_best_match(data_class, reader_class, readers):\n                return self._readers[(reader_format, reader_class)][0]\n        else:\n            format_table_str = self._get_format_table_str(data_class, 'Read')\n            raise IORegistryError(\n                \"No reader defined for format '{}' and class '{}'.\\n\\nThe \"\n                \"available formats are:\\n\\n{}\".format(\n                    data_format, data_class.__name__, format_table_str))\n\n    def read(self, cls, *args, format=None, cache=False, **kwargs):\n        \"\"\"\n        Read in data.\n\n        Parameters\n        ----------\n        cls : class\n        *args\n            The arguments passed to this method depend on the format.\n        format : str or None\n        cache : bool\n            Whether to cache the results of reading in the data.\n        **kwargs\n            The arguments passed to this method depend on the format.\n\n        Returns\n        -------\n        object or None\n            The output of the registered reader.\n        \"\"\"\n        ctx = None\n        try:\n            if format is None:\n                path = None\n                fileobj = None\n\n                if len(args):\n                    if isinstance(args[0], PATH_TYPES) and not os.path.isdir(args[0]):\n                        from astropy.utils.data import get_readable_fileobj\n\n                        # path might be a os.PathLike object\n                        if isinstance(args[0], os.PathLike):\n                            args = (os.fspath(args[0]),) + args[1:]\n                        path = args[0]\n                        try:\n                            ctx = get_readable_fileobj(args[0], encoding='binary', cache=cache)\n                            fileobj = ctx.__enter__()\n                        except OSError:\n                            raise\n                        except Exception:\n                            fileobj = None\n                        else:\n                            args = [fileobj] + list(args[1:])\n                    elif hasattr(args[0], 'read'):\n                        path = None\n                        fileobj = args[0]\n\n                format = self._get_valid_format(\n                    'read', cls, path, fileobj, args, kwargs)\n\n            reader = self.get_reader(format, cls)\n            data = reader(*args, **kwargs)\n\n            if not isinstance(data, cls):\n                # User has read with a subclass where only the parent class is\n                # registered.  This returns the parent class, so try coercing\n                # to desired subclass.\n                try:\n                    data = cls(data)\n                except Exception:\n                    raise TypeError('could not convert reader output to {} '\n                                    'class.'.format(cls.__name__))\n        finally:\n            if ctx is not None:\n                ctx.__exit__(*sys.exc_info())\n\n        return data\n\n\n# -----------------------------------------------------------------------------\n\nclass UnifiedOutputRegistry(_UnifiedIORegistryBase):\n    \"\"\"Write-only Registry.\n\n    .. versionadded:: 5.0\n    \"\"\"\n\n    def __init__(self):\n        super().__init__()\n        self._writers = OrderedDict()\n        self._registries[\"write\"] = dict(attr=\"_writers\", column=\"Write\")\n        self._registries_order = (\"write\", \"identify\", )\n\n    # =========================================================================\n    # Write Methods\n\n    def register_writer(self, data_format, data_class, function, force=False, priority=0):\n        \"\"\"\n        Register a table writer function.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that will be used to\n            specify the data type when writing.\n        data_class : class\n            The class of the object that can be written.\n        function : function\n            The function to write out a data object.\n        force : bool, optional\n            Whether to override any existing function if already present.\n            Default is ``False``.\n        priority : int, optional\n            The priority of the writer, used to compare possible formats when trying\n            to determine the best writer to use. Higher priorities are preferred\n            over lower priorities, with the default priority being 0 (negative\n            numbers are allowed though).\n        \"\"\"\n        if not (data_format, data_class) in self._writers or force:\n            self._writers[(data_format, data_class)] = function, priority\n        else:\n            raise IORegistryError(\"Writer for format '{}' and class '{}' is \"\n                                  'already defined'\n                                  ''.format(data_format, data_class.__name__))\n\n        if data_class not in self._delayed_docs_classes:\n            self._update__doc__(data_class, 'write')\n\n    def unregister_writer(self, data_format, data_class):\n        \"\"\"\n        Unregister a writer function\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier.\n        data_class : class\n            The class of the object that can be written.\n        \"\"\"\n\n        if (data_format, data_class) in self._writers:\n            self._writers.pop((data_format, data_class))\n        else:\n            raise IORegistryError(\"No writer defined for format '{}' and class '{}'\"\n                                  ''.format(data_format, data_class.__name__))\n\n        if data_class not in self._delayed_docs_classes:\n            self._update__doc__(data_class, 'write')\n\n    def get_writer(self, data_format, data_class):\n        \"\"\"Get writer for ``data_format``.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that is used to\n            specify the data type when reading/writing.\n        data_class : class\n            The class of the object that can be written.\n\n        Returns\n        -------\n        writer : callable\n            The registered writer function for this format and class.\n        \"\"\"\n        writers = [(fmt, cls) for fmt, cls in self._writers if fmt == data_format]\n        for writer_format, writer_class in writers:\n            if self._is_best_match(data_class, writer_class, writers):\n                return self._writers[(writer_format, writer_class)][0]\n        else:\n            format_table_str = self._get_format_table_str(data_class, 'Write')\n            raise IORegistryError(\n                \"No writer defined for format '{}' and class '{}'.\\n\\nThe \"\n                \"available formats are:\\n\\n{}\".format(\n                    data_format, data_class.__name__, format_table_str))\n\n    def write(self, data, *args, format=None, **kwargs):\n        \"\"\"\n        Write out data.\n\n        Parameters\n        ----------\n        data : object\n            The data to write.\n        *args\n            The arguments passed to this method depend on the format.\n        format : str or None\n        **kwargs\n            The arguments passed to this method depend on the format.\n\n        Returns\n        -------\n        object or None\n            The output of the registered writer. Most often `None`.\n\n            .. versionadded:: 4.3\n        \"\"\"\n\n        if format is None:\n            path = None\n            fileobj = None\n            if len(args):\n                if isinstance(args[0], PATH_TYPES):\n                    # path might be a os.PathLike object\n                    if isinstance(args[0], os.PathLike):\n                        args = (os.fspath(args[0]),) + args[1:]\n                    path = args[0]\n                    fileobj = None\n                elif hasattr(args[0], 'read'):\n                    path = None\n                    fileobj = args[0]\n\n            format = self._get_valid_format(\n                'write', data.__class__, path, fileobj, args, kwargs)\n\n        writer = self.get_writer(format, data.__class__)\n        return writer(data, *args, **kwargs)\n\n\n# -----------------------------------------------------------------------------\n\nclass UnifiedIORegistry(UnifiedInputRegistry, UnifiedOutputRegistry):\n    \"\"\"Unified I/O Registry.\n\n    .. versionadded:: 5.0\n    \"\"\"\n\n    def __init__(self):\n        super().__init__()\n        self._registries_order = (\"read\", \"write\", \"identify\")\n\n    def get_formats(self, data_class=None, readwrite=None):\n        \"\"\"\n        Get the list of registered I/O formats as a `~astropy.table.Table`.\n\n        Parameters\n        ----------\n        data_class : class, optional\n            Filter readers/writer to match data class (default = all classes).\n\n        readwrite : str or None, optional\n            Search only for readers (``\"Read\"``) or writers (``\"Write\"``).\n            If None search for both.  Default is None.\n\n            .. versionadded:: 1.3\n\n        Returns\n        -------\n        format_table : :class:`~astropy.table.Table`\n            Table of available I/O formats.\n        \"\"\"\n        return super().get_formats(data_class, readwrite)\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":7055,"name":"__doc__","nodeType":"Attribute","startLoc":5,"text":"__doc__"},{"col":4,"comment":"null","endLoc":1701,"header":"@system.deleter\n    def system(self)","id":7056,"name":"system","nodeType":"Function","startLoc":1699,"text":"@system.deleter\n    def system(self):\n        self._system = None"},{"col":4,"comment":"\n        A parameter required to fix the equatorial or ecliptic systems\n        (as e.g. \"J2000\" as the default \"eq_FK5\" or \"B1950\" as the\n        default \"eq_FK4\").\n        ","endLoc":1710,"header":"@property\n    def equinox(self)","id":7057,"name":"equinox","nodeType":"Function","startLoc":1703,"text":"@property\n    def equinox(self):\n        \"\"\"\n        A parameter required to fix the equatorial or ecliptic systems\n        (as e.g. \"J2000\" as the default \"eq_FK5\" or \"B1950\" as the\n        default \"eq_FK4\").\n        \"\"\"\n        return self._equinox"},{"col":4,"comment":"null","endLoc":1715,"header":"@equinox.setter\n    def equinox(self, equinox)","id":7058,"name":"equinox","nodeType":"Function","startLoc":1712,"text":"@equinox.setter\n    def equinox(self, equinox):\n        check_astroyear(equinox, 'equinox', self._config, self._pos)\n        self._equinox = equinox"},{"attributeType":"null","col":20,"comment":"null","endLoc":66,"id":7059,"name":"_attributes","nodeType":"Attribute","startLoc":66,"text":"self._attributes"},{"col":4,"comment":"null","endLoc":1719,"header":"@equinox.deleter\n    def equinox(self)","id":7060,"name":"equinox","nodeType":"Function","startLoc":1717,"text":"@equinox.deleter\n    def equinox(self):\n        self._equinox = None"},{"col":4,"comment":"\n        Specifies the epoch of the positions.  It must be a string\n        specifying an astronomical year.\n        ","endLoc":1727,"header":"@property\n    def epoch(self)","id":7061,"name":"epoch","nodeType":"Function","startLoc":1721,"text":"@property\n    def epoch(self):\n        \"\"\"\n        Specifies the epoch of the positions.  It must be a string\n        specifying an astronomical year.\n        \"\"\"\n        return self._epoch"},{"col":4,"comment":"null","endLoc":1732,"header":"@epoch.setter\n    def epoch(self, epoch)","id":7062,"name":"epoch","nodeType":"Function","startLoc":1729,"text":"@epoch.setter\n    def epoch(self, epoch):\n        check_astroyear(epoch, 'epoch', self._config, self._pos)\n        self._epoch = epoch"},{"col":4,"comment":"null","endLoc":1736,"header":"@epoch.deleter\n    def epoch(self)","id":7063,"name":"epoch","nodeType":"Function","startLoc":1734,"text":"@epoch.deleter\n    def epoch(self):\n        self._epoch = None"},{"attributeType":"null","col":4,"comment":"null","endLoc":1640,"id":7064,"name":"_attr_list","nodeType":"Attribute","startLoc":1640,"text":"_attr_list"},{"attributeType":"null","col":4,"comment":"null","endLoc":1641,"id":7065,"name":"_element_name","nodeType":"Attribute","startLoc":1641,"text":"_element_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":1697,"id":7066,"name":"_system","nodeType":"Attribute","startLoc":1697,"text":"self._system"},{"col":0,"comment":"null","endLoc":139,"header":"def votable_xml_string(version)","id":7067,"name":"votable_xml_string","nodeType":"Function","startLoc":130,"text":"def votable_xml_string(version):\n    votable_file = VOTableFile(version=version)\n    votable_file.resources.append(Resource())\n\n    xml_bytes = io.BytesIO()\n    votable_file.to_xml(xml_bytes)\n    xml_bytes.seek(0)\n    bstring = xml_bytes.read()\n    s = bstring.decode(\"utf-8\")\n    return s"},{"col":0,"comment":"","endLoc":2,"header":"__init__.py#<anonymous>","id":7068,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"__doc__ = main.__doc__\n\ndel main"},{"attributeType":"null","col":8,"comment":"null","endLoc":1715,"id":7069,"name":"_equinox","nodeType":"Attribute","startLoc":1715,"text":"self._equinox"},{"fileName":"interface.py","filePath":"astropy/io/registry","id":7070,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport inspect\nimport os\nimport re\n\nfrom .base import IORegistryError\n\n__all__ = ['UnifiedReadWriteMethod', 'UnifiedReadWrite']\n\n\n# -----------------------------------------------------------------------------\n\nclass UnifiedReadWrite:\n    \"\"\"Base class for the worker object used in unified read() or write() methods.\n\n    This lightweight object is created for each `read()` or `write()` call\n    via ``read`` / ``write`` descriptors on the data object class.  The key\n    driver is to allow complete format-specific documentation of available\n    method options via a ``help()`` method, e.g. ``Table.read.help('fits')``.\n\n    Subclasses must define a ``__call__`` method which is what actually gets\n    called when the data object ``read()`` or ``write()`` method is called.\n\n    For the canonical example see the `~astropy.table.Table` class\n    implementation (in particular the ``connect.py`` module there).\n\n    Parameters\n    ----------\n    instance : object\n        Descriptor calling instance or None if no instance\n    cls : type\n        Descriptor calling class (either owner class or instance class)\n    method_name : str\n        Method name, e.g. 'read' or 'write'\n    registry : ``_UnifiedIORegistryBase`` or None, optional\n        The IO registry.\n    \"\"\"\n    def __init__(self, instance, cls, method_name, registry=None):\n        if registry is None:\n            from astropy.io.registry.compat import default_registry as registry\n\n        self._registry = registry\n        self._instance = instance\n        self._cls = cls\n        self._method_name = method_name  # 'read' or 'write'\n\n    @property\n    def registry(self):\n        \"\"\"Unified I/O registry instance.\"\"\"\n        return self._registry\n\n    def help(self, format=None, out=None):\n        \"\"\"Output help documentation for the specified unified I/O ``format``.\n\n        By default the help output is printed to the console via ``pydoc.pager``.\n        Instead one can supplied a file handle object as ``out`` and the output\n        will be written to that handle.\n\n        Parameters\n        ----------\n        format : str\n            Unified I/O format name, e.g. 'fits' or 'ascii.ecsv'\n        out : None or path-like\n            Output destination (default is stdout via a pager)\n        \"\"\"\n        cls = self._cls\n        method_name = self._method_name\n\n        # Get reader or writer function associated with the registry\n        get_func = (self._registry.get_reader if method_name == 'read'\n                    else self._registry.get_writer)\n        try:\n            if format:\n                read_write_func = get_func(format, cls)\n        except IORegistryError as err:\n            reader_doc = 'ERROR: ' + str(err)\n        else:\n            if format:\n                # Format-specific\n                header = (\"{}.{}(format='{}') documentation\\n\"\n                          .format(cls.__name__, method_name, format))\n                doc = read_write_func.__doc__\n            else:\n                # General docs\n                header = f'{cls.__name__}.{method_name} general documentation\\n'\n                doc = getattr(cls, method_name).__doc__\n\n            reader_doc = re.sub('.', '=', header)\n            reader_doc += header\n            reader_doc += re.sub('.', '=', header)\n            reader_doc += os.linesep\n            if doc is not None:\n                reader_doc += inspect.cleandoc(doc)\n\n        if out is None:\n            import pydoc\n            pydoc.pager(reader_doc)\n        else:\n            out.write(reader_doc)\n\n    def list_formats(self, out=None):\n        \"\"\"Print a list of available formats to console (or ``out`` filehandle)\n\n        out : None or file handle object\n            Output destination (default is stdout via a pager)\n        \"\"\"\n        tbl = self._registry.get_formats(self._cls, self._method_name.capitalize())\n        del tbl['Data class']\n\n        if out is None:\n            tbl.pprint(max_lines=-1, max_width=-1)\n        else:\n            out.write('\\n'.join(tbl.pformat(max_lines=-1, max_width=-1)))\n\n        return out\n\n\n# -----------------------------------------------------------------------------\n\nclass UnifiedReadWriteMethod(property):\n    \"\"\"Descriptor class for creating read() and write() methods in unified I/O.\n\n    The canonical example is in the ``Table`` class, where the ``connect.py``\n    module creates subclasses of the ``UnifiedReadWrite`` class.  These have\n    custom ``__call__`` methods that do the setup work related to calling the\n    registry read() or write() functions.  With this, the ``Table`` class\n    defines read and write methods as follows::\n\n      read = UnifiedReadWriteMethod(TableRead)\n      write = UnifiedReadWriteMethod(TableWrite)\n\n    Parameters\n    ----------\n    func : `~astropy.io.registry.UnifiedReadWrite` subclass\n        Class that defines read or write functionality\n\n    \"\"\"\n    # We subclass property to ensure that __set__ is defined and that,\n    # therefore, we are a data descriptor, which cannot be overridden.\n    # This also means we automatically inherit the __doc__ of fget (which will\n    # be a UnifiedReadWrite subclass), and that this docstring gets recognized\n    # and properly typeset by sphinx (which was previously an issue; see\n    # gh-11554).\n    # We override __get__ to pass both instance and class to UnifiedReadWrite.\n    def __get__(self, instance, owner_cls):\n        return self.fget(instance, owner_cls)\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":29,"id":7072,"name":"url","nodeType":"Attribute","startLoc":29,"text":"self.url"},{"attributeType":"null","col":8,"comment":"null","endLoc":1660,"id":7073,"name":"system","nodeType":"Attribute","startLoc":1660,"text":"self.system"},{"className":"IORegistryError","col":0,"comment":"Custom error for registry clashes.\n    ","endLoc":18,"id":7074,"nodeType":"Class","startLoc":15,"text":"class IORegistryError(Exception):\n    \"\"\"Custom error for registry clashes.\n    \"\"\"\n    pass"},{"attributeType":"null","col":8,"comment":"null","endLoc":38,"id":7075,"name":"timeout","nodeType":"Attribute","startLoc":38,"text":"self.timeout"},{"col":0,"comment":"null","endLoc":159,"header":"def test_votable_tag()","id":7076,"name":"test_votable_tag","nodeType":"Function","startLoc":142,"text":"def test_votable_tag():\n    xml = votable_xml_string('1.1')\n    assert 'xmlns=\"http://www.ivoa.net/xml/VOTable/v1.1\"' in xml\n    assert 'xsi:noNamespaceSchemaLocation=\"http://www.ivoa.net/xml/VOTable/v1.1\"' in xml\n\n    xml = votable_xml_string('1.2')\n    assert 'xmlns=\"http://www.ivoa.net/xml/VOTable/v1.2\"' in xml\n    assert 'xsi:noNamespaceSchemaLocation=\"http://www.ivoa.net/xml/VOTable/v1.2\"' in xml\n\n    xml = votable_xml_string('1.3')\n    assert 'xmlns=\"http://www.ivoa.net/xml/VOTable/v1.3\"' in xml\n    assert 'xsi:schemaLocation=\"http://www.ivoa.net/xml/VOTable/v1.3 '\n    assert 'http://www.ivoa.net/xml/VOTable/VOTable-1.3.xsd\"' in xml\n\n    xml = votable_xml_string('1.4')\n    assert 'xmlns=\"http://www.ivoa.net/xml/VOTable/v1.3\"' in xml\n    assert 'xsi:schemaLocation=\"http://www.ivoa.net/xml/VOTable/v1.3 '\n    assert 'http://www.ivoa.net/xml/VOTable/VOTable-1.4.xsd\"' in xml"},{"attributeType":"null","col":8,"comment":"null","endLoc":1648,"id":7077,"name":"_pos","nodeType":"Attribute","startLoc":1648,"text":"self._pos"},{"className":"_UnifiedIORegistryBase","col":0,"comment":"Base class for registries in Astropy's Unified IO.\n\n    This base class provides identification functions and miscellaneous\n    utilities. For an example how to build a registry subclass we suggest\n    :class:`~astropy.io.registry.UnifiedInputRegistry`, which enables\n    read-only registries. These higher-level subclasses will probably serve\n    better as a baseclass, for instance\n    :class:`~astropy.io.registry.UnifiedIORegistry` subclasses both\n    :class:`~astropy.io.registry.UnifiedInputRegistry` and\n    :class:`~astropy.io.registry.UnifiedOutputRegistry` to enable both\n    reading from and writing to files.\n\n    .. versionadded:: 5.0\n\n    ","endLoc":447,"id":7078,"nodeType":"Class","startLoc":23,"text":"class _UnifiedIORegistryBase(metaclass=abc.ABCMeta):\n    \"\"\"Base class for registries in Astropy's Unified IO.\n\n    This base class provides identification functions and miscellaneous\n    utilities. For an example how to build a registry subclass we suggest\n    :class:`~astropy.io.registry.UnifiedInputRegistry`, which enables\n    read-only registries. These higher-level subclasses will probably serve\n    better as a baseclass, for instance\n    :class:`~astropy.io.registry.UnifiedIORegistry` subclasses both\n    :class:`~astropy.io.registry.UnifiedInputRegistry` and\n    :class:`~astropy.io.registry.UnifiedOutputRegistry` to enable both\n    reading from and writing to files.\n\n    .. versionadded:: 5.0\n\n    \"\"\"\n\n    def __init__(self):\n        # registry of identifier functions\n        self._identifiers = OrderedDict()\n\n        # what this class can do: e.g. 'read' &/or 'write'\n        self._registries = dict()\n        self._registries[\"identify\"] = dict(attr=\"_identifiers\", column=\"Auto-identify\")\n        self._registries_order = (\"identify\", )  # match keys in `_registries`\n\n        # If multiple formats are added to one class the update of the docs is quite\n        # expensive. Classes for which the doc update is temporarly delayed are added\n        # to this set.\n        self._delayed_docs_classes = set()\n\n    @property\n    def available_registries(self):\n        \"\"\"Available registries.\n\n        Returns\n        -------\n        ``dict_keys``\n        \"\"\"\n        return self._registries.keys()\n\n    def get_formats(self, data_class=None, filter_on=None):\n        \"\"\"\n        Get the list of registered formats as a `~astropy.table.Table`.\n\n        Parameters\n        ----------\n        data_class : class or None, optional\n            Filter readers/writer to match data class (default = all classes).\n        filter_on : str or None, optional\n            Which registry to show. E.g. \"identify\"\n            If None search for both.  Default is None.\n\n        Returns\n        -------\n        format_table : :class:`~astropy.table.Table`\n            Table of available I/O formats.\n\n        Raises\n        ------\n        ValueError\n            If ``filter_on`` is not None nor a registry name.\n        \"\"\"\n        from astropy.table import Table\n\n        # set up the column names\n        colnames = (\n            \"Data class\", \"Format\",\n            *[self._registries[k][\"column\"] for k in self._registries_order],\n            \"Deprecated\")\n        i_dataclass = colnames.index(\"Data class\")\n        i_format = colnames.index(\"Format\")\n        i_regstart = colnames.index(self._registries[self._registries_order[0]][\"column\"])\n        i_deprecated = colnames.index(\"Deprecated\")\n\n        # registries\n        regs = set()\n        for k in self._registries.keys() - {\"identify\"}:\n            regs |= set(getattr(self, self._registries[k][\"attr\"]))\n        format_classes = sorted(regs, key=itemgetter(0))\n        # the format classes from all registries except \"identify\"\n\n        rows = []\n        for (fmt, cls) in format_classes:\n            # see if can skip, else need to document in row\n            if (data_class is not None and not self._is_best_match(\n                data_class, cls, format_classes)):\n                continue\n\n            # flags for each registry\n            has_ = {k: \"Yes\" if (fmt, cls) in getattr(self, v[\"attr\"]) else \"No\"\n                    for k, v in self._registries.items()}\n\n            # Check if this is a short name (e.g. 'rdb') which is deprecated in\n            # favor of the full 'ascii.rdb'.\n            ascii_format_class = ('ascii.' + fmt, cls)\n            # deprecation flag\n            deprecated = \"Yes\" if ascii_format_class in format_classes else \"\"\n\n            # add to rows\n            rows.append((cls.__name__, fmt,\n                         *[has_[n] for n in self._registries_order], deprecated))\n\n        # filter_on can be in self_registries_order or None\n        if str(filter_on).lower() in self._registries_order:\n            index = self._registries_order.index(str(filter_on).lower())\n            rows = [row for row in rows if row[i_regstart + index] == 'Yes']\n        elif filter_on is not None:\n            raise ValueError('unrecognized value for \"filter_on\": {0}.\\n'\n                             f'Allowed are {self._registries_order} and None.')\n\n        # Sorting the list of tuples is much faster than sorting it after the\n        # table is created. (#5262)\n        if rows:\n            # Indices represent \"Data Class\", \"Deprecated\" and \"Format\".\n            data = list(zip(*sorted(\n                rows, key=itemgetter(i_dataclass, i_deprecated, i_format))))\n        else:\n            data = None\n\n        # make table\n        # need to filter elementwise comparison failure issue\n        # https://github.com/numpy/numpy/issues/6784\n        with warnings.catch_warnings():\n            warnings.simplefilter(action='ignore', category=FutureWarning)\n\n            format_table = Table(data, names=colnames)\n            if not np.any(format_table['Deprecated'].data == 'Yes'):\n                format_table.remove_column('Deprecated')\n\n        return format_table\n\n    @contextlib.contextmanager\n    def delay_doc_updates(self, cls):\n        \"\"\"Contextmanager to disable documentation updates when registering\n        reader and writer. The documentation is only built once when the\n        contextmanager exits.\n\n        .. versionadded:: 1.3\n\n        Parameters\n        ----------\n        cls : class\n            Class for which the documentation updates should be delayed.\n\n        Notes\n        -----\n        Registering multiple readers and writers can cause significant overhead\n        because the documentation of the corresponding ``read`` and ``write``\n        methods are build every time.\n\n        Examples\n        --------\n        see for example the source code of ``astropy.table.__init__``.\n        \"\"\"\n        self._delayed_docs_classes.add(cls)\n\n        yield\n\n        self._delayed_docs_classes.discard(cls)\n        for method in self._registries.keys() - {\"identify\"}:\n            self._update__doc__(cls, method)\n\n    # =========================================================================\n    # Identifier methods\n\n    def register_identifier(self, data_format, data_class, identifier, force=False):\n        \"\"\"\n        Associate an identifier function with a specific data type.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that is used to\n            specify the data type when reading/writing.\n        data_class : class\n            The class of the object that can be written.\n        identifier : function\n            A function that checks the argument specified to `read` or `write` to\n            determine whether the input can be interpreted as a table of type\n            ``data_format``. This function should take the following arguments:\n\n               - ``origin``: A string ``\"read\"`` or ``\"write\"`` identifying whether\n                 the file is to be opened for reading or writing.\n               - ``path``: The path to the file.\n               - ``fileobj``: An open file object to read the file's contents, or\n                 `None` if the file could not be opened.\n               - ``*args``: Positional arguments for the `read` or `write`\n                 function.\n               - ``**kwargs``: Keyword arguments for the `read` or `write`\n                 function.\n\n            One or both of ``path`` or ``fileobj`` may be `None`.  If they are\n            both `None`, the identifier will need to work from ``args[0]``.\n\n            The function should return True if the input can be identified\n            as being of format ``data_format``, and False otherwise.\n        force : bool, optional\n            Whether to override any existing function if already present.\n            Default is ``False``.\n\n        Examples\n        --------\n        To set the identifier based on extensions, for formats that take a\n        filename as a first argument, you can do for example\n\n        .. code-block:: python\n\n            from astropy.io.registry import register_identifier\n            from astropy.table import Table\n            def my_identifier(*args, **kwargs):\n                return isinstance(args[0], str) and args[0].endswith('.tbl')\n            register_identifier('ipac', Table, my_identifier)\n            unregister_identifier('ipac', Table)\n        \"\"\"\n        if not (data_format, data_class) in self._identifiers or force:\n            self._identifiers[(data_format, data_class)] = identifier\n        else:\n            raise IORegistryError(\"Identifier for format '{}' and class '{}' is \"\n                                  'already defined'.format(data_format,\n                                                           data_class.__name__))\n\n    def unregister_identifier(self, data_format, data_class):\n        \"\"\"\n        Unregister an identifier function\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier.\n        data_class : class\n            The class of the object that can be read/written.\n        \"\"\"\n        if (data_format, data_class) in self._identifiers:\n            self._identifiers.pop((data_format, data_class))\n        else:\n            raise IORegistryError(\"No identifier defined for format '{}' and class\"\n                                  \" '{}'\".format(data_format, data_class.__name__))\n\n    def identify_format(self, origin, data_class_required, path, fileobj, args, kwargs):\n        \"\"\"Loop through identifiers to see which formats match.\n\n        Parameters\n        ----------\n        origin : str\n            A string ``\"read`` or ``\"write\"`` identifying whether the file is to be\n            opened for reading or writing.\n        data_class_required : object\n            The specified class for the result of `read` or the class that is to be\n            written.\n        path : str or path-like or None\n            The path to the file or None.\n        fileobj : file-like or None.\n            An open file object to read the file's contents, or ``None`` if the\n            file could not be opened.\n        args : sequence\n            Positional arguments for the `read` or `write` function. Note that\n            these must be provided as sequence.\n        kwargs : dict-like\n            Keyword arguments for the `read` or `write` function. Note that this\n            parameter must be `dict`-like.\n\n        Returns\n        -------\n        valid_formats : list\n            List of matching formats.\n        \"\"\"\n        valid_formats = []\n        for data_format, data_class in self._identifiers:\n            if self._is_best_match(data_class_required, data_class, self._identifiers):\n                if self._identifiers[(data_format, data_class)](\n                        origin, path, fileobj, *args, **kwargs):\n                    valid_formats.append(data_format)\n\n        return valid_formats\n\n    # =========================================================================\n    # Utils\n\n    def _get_format_table_str(self, data_class, filter_on):\n        \"\"\"``get_formats()``, without column \"Data class\", as a str.\"\"\"\n        format_table = self.get_formats(data_class, filter_on)\n        format_table.remove_column('Data class')\n        format_table_str = '\\n'.join(format_table.pformat(max_lines=-1))\n        return format_table_str\n\n    def _is_best_match(self, class1, class2, format_classes):\n        \"\"\"\n        Determine if class2 is the \"best\" match for class1 in the list\n        of classes.  It is assumed that (class2 in classes) is True.\n        class2 is the the best match if:\n\n        - ``class1`` is a subclass of ``class2`` AND\n        - ``class2`` is the nearest ancestor of ``class1`` that is in classes\n          (which includes the case that ``class1 is class2``)\n        \"\"\"\n        if issubclass(class1, class2):\n            classes = {cls for fmt, cls in format_classes}\n            for parent in class1.__mro__:\n                if parent is class2:  # class2 is closest registered ancestor\n                    return True\n                if parent in classes:  # class2 was superceded\n                    return False\n        return False\n\n    def _get_valid_format(self, mode, cls, path, fileobj, args, kwargs):\n        \"\"\"\n        Returns the first valid format that can be used to read/write the data in\n        question.  Mode can be either 'read' or 'write'.\n        \"\"\"\n        valid_formats = self.identify_format(mode, cls, path, fileobj, args, kwargs)\n\n        if len(valid_formats) == 0:\n            format_table_str = self._get_format_table_str(cls, mode.capitalize())\n            raise IORegistryError(\"Format could not be identified based on the\"\n                                  \" file name or contents, please provide a\"\n                                  \" 'format' argument.\\n\"\n                                  \"The available formats are:\\n\"\n                                  \"{}\".format(format_table_str))\n        elif len(valid_formats) > 1:\n            return self._get_highest_priority_format(mode, cls, valid_formats)\n\n        return valid_formats[0]\n\n    def _get_highest_priority_format(self, mode, cls, valid_formats):\n        \"\"\"\n        Returns the reader or writer with the highest priority. If it is a tie,\n        error.\n        \"\"\"\n        if mode == \"read\":\n            format_dict = self._readers\n            mode_loader = \"reader\"\n        elif mode == \"write\":\n            format_dict = self._writers\n            mode_loader = \"writer\"\n\n        best_formats = []\n        current_priority = - np.inf\n        for format in valid_formats:\n            try:\n                _, priority = format_dict[(format, cls)]\n            except KeyError:\n                # We could throw an exception here, but get_reader/get_writer handle\n                # this case better, instead maximally deprioritise the format.\n                priority = - np.inf\n\n            if priority == current_priority:\n                best_formats.append(format)\n            elif priority > current_priority:\n                best_formats = [format]\n                current_priority = priority\n\n        if len(best_formats) > 1:\n            raise IORegistryError(\"Format is ambiguous - options are: {}\".format(\n                ', '.join(sorted(valid_formats, key=itemgetter(0)))\n            ))\n        return best_formats[0]\n\n    def _update__doc__(self, data_class, readwrite):\n        \"\"\"\n        Update the docstring to include all the available readers / writers for\n        the ``data_class.read``/``data_class.write`` functions (respectively).\n        Don't update if the data_class does not have the relevant method.\n        \"\"\"\n        # abort if method \"readwrite\" isn't on data_class\n        if not hasattr(data_class, readwrite):\n            return\n\n        from .interface import UnifiedReadWrite\n\n        FORMATS_TEXT = 'The available built-in formats are:'\n\n        # Get the existing read or write method and its docstring\n        class_readwrite_func = getattr(data_class, readwrite)\n\n        if not isinstance(class_readwrite_func.__doc__, str):\n            # No docstring--could just be test code, or possibly code compiled\n            # without docstrings\n            return\n\n        lines = class_readwrite_func.__doc__.splitlines()\n\n        # Find the location of the existing formats table if it exists\n        sep_indices = [ii for ii, line in enumerate(lines) if FORMATS_TEXT in line]\n        if sep_indices:\n            # Chop off the existing formats table, including the initial blank line\n            chop_index = sep_indices[0]\n            lines = lines[:chop_index]\n\n        # Find the minimum indent, skipping the first line because it might be odd\n        matches = [re.search(r'(\\S)', line) for line in lines[1:]]\n        left_indent = ' ' * min(match.start() for match in matches if match)\n\n        # Get the available unified I/O formats for this class\n        # Include only formats that have a reader, and drop the 'Data class' column\n        format_table = self.get_formats(data_class, readwrite.capitalize())\n        format_table.remove_column('Data class')\n\n        # Get the available formats as a table, then munge the output of pformat()\n        # a bit and put it into the docstring.\n        new_lines = format_table.pformat(max_lines=-1, max_width=80)\n        table_rst_sep = re.sub('-', '=', new_lines[1])\n        new_lines[1] = table_rst_sep\n        new_lines.insert(0, table_rst_sep)\n        new_lines.append(table_rst_sep)\n\n        # Check for deprecated names and include a warning at the end.\n        if 'Deprecated' in format_table.colnames:\n            new_lines.extend(['',\n                              'Deprecated format names like ``aastex`` will be '\n                              'removed in a future version. Use the full ',\n                              'name (e.g. ``ascii.aastex``) instead.'])\n\n        new_lines = [FORMATS_TEXT, ''] + new_lines\n        lines.extend([left_indent + line for line in new_lines])\n\n        # Depending on Python version and whether class_readwrite_func is\n        # an instancemethod or classmethod, one of the following will work.\n        if isinstance(class_readwrite_func, UnifiedReadWrite):\n            class_readwrite_func.__class__.__doc__ = '\\n'.join(lines)\n        else:\n            try:\n                class_readwrite_func.__doc__ = '\\n'.join(lines)\n            except AttributeError:\n                class_readwrite_func.__func__.__doc__ = '\\n'.join(lines)"},{"className":"UnifiedReadWrite","col":0,"comment":"Base class for the worker object used in unified read() or write() methods.\n\n    This lightweight object is created for each `read()` or `write()` call\n    via ``read`` / ``write`` descriptors on the data object class.  The key\n    driver is to allow complete format-specific documentation of available\n    method options via a ``help()`` method, e.g. ``Table.read.help('fits')``.\n\n    Subclasses must define a ``__call__`` method which is what actually gets\n    called when the data object ``read()`` or ``write()`` method is called.\n\n    For the canonical example see the `~astropy.table.Table` class\n    implementation (in particular the ``connect.py`` module there).\n\n    Parameters\n    ----------\n    instance : object\n        Descriptor calling instance or None if no instance\n    cls : type\n        Descriptor calling class (either owner class or instance class)\n    method_name : str\n        Method name, e.g. 'read' or 'write'\n    registry : ``_UnifiedIORegistryBase`` or None, optional\n        The IO registry.\n    ","endLoc":116,"id":7079,"nodeType":"Class","startLoc":14,"text":"class UnifiedReadWrite:\n    \"\"\"Base class for the worker object used in unified read() or write() methods.\n\n    This lightweight object is created for each `read()` or `write()` call\n    via ``read`` / ``write`` descriptors on the data object class.  The key\n    driver is to allow complete format-specific documentation of available\n    method options via a ``help()`` method, e.g. ``Table.read.help('fits')``.\n\n    Subclasses must define a ``__call__`` method which is what actually gets\n    called when the data object ``read()`` or ``write()`` method is called.\n\n    For the canonical example see the `~astropy.table.Table` class\n    implementation (in particular the ``connect.py`` module there).\n\n    Parameters\n    ----------\n    instance : object\n        Descriptor calling instance or None if no instance\n    cls : type\n        Descriptor calling class (either owner class or instance class)\n    method_name : str\n        Method name, e.g. 'read' or 'write'\n    registry : ``_UnifiedIORegistryBase`` or None, optional\n        The IO registry.\n    \"\"\"\n    def __init__(self, instance, cls, method_name, registry=None):\n        if registry is None:\n            from astropy.io.registry.compat import default_registry as registry\n\n        self._registry = registry\n        self._instance = instance\n        self._cls = cls\n        self._method_name = method_name  # 'read' or 'write'\n\n    @property\n    def registry(self):\n        \"\"\"Unified I/O registry instance.\"\"\"\n        return self._registry\n\n    def help(self, format=None, out=None):\n        \"\"\"Output help documentation for the specified unified I/O ``format``.\n\n        By default the help output is printed to the console via ``pydoc.pager``.\n        Instead one can supplied a file handle object as ``out`` and the output\n        will be written to that handle.\n\n        Parameters\n        ----------\n        format : str\n            Unified I/O format name, e.g. 'fits' or 'ascii.ecsv'\n        out : None or path-like\n            Output destination (default is stdout via a pager)\n        \"\"\"\n        cls = self._cls\n        method_name = self._method_name\n\n        # Get reader or writer function associated with the registry\n        get_func = (self._registry.get_reader if method_name == 'read'\n                    else self._registry.get_writer)\n        try:\n            if format:\n                read_write_func = get_func(format, cls)\n        except IORegistryError as err:\n            reader_doc = 'ERROR: ' + str(err)\n        else:\n            if format:\n                # Format-specific\n                header = (\"{}.{}(format='{}') documentation\\n\"\n                          .format(cls.__name__, method_name, format))\n                doc = read_write_func.__doc__\n            else:\n                # General docs\n                header = f'{cls.__name__}.{method_name} general documentation\\n'\n                doc = getattr(cls, method_name).__doc__\n\n            reader_doc = re.sub('.', '=', header)\n            reader_doc += header\n            reader_doc += re.sub('.', '=', header)\n            reader_doc += os.linesep\n            if doc is not None:\n                reader_doc += inspect.cleandoc(doc)\n\n        if out is None:\n            import pydoc\n            pydoc.pager(reader_doc)\n        else:\n            out.write(reader_doc)\n\n    def list_formats(self, out=None):\n        \"\"\"Print a list of available formats to console (or ``out`` filehandle)\n\n        out : None or file handle object\n            Output destination (default is stdout via a pager)\n        \"\"\"\n        tbl = self._registry.get_formats(self._cls, self._method_name.capitalize())\n        del tbl['Data class']\n\n        if out is None:\n            tbl.pprint(max_lines=-1, max_width=-1)\n        else:\n            out.write('\\n'.join(tbl.pformat(max_lines=-1, max_width=-1)))\n\n        return out"},{"col":4,"comment":"null","endLoc":46,"header":"def __init__(self, instance, cls, method_name, registry=None)","id":7080,"name":"__init__","nodeType":"Function","startLoc":39,"text":"def __init__(self, instance, cls, method_name, registry=None):\n        if registry is None:\n            from astropy.io.registry.compat import default_registry as registry\n\n        self._registry = registry\n        self._instance = instance\n        self._cls = cls\n        self._method_name = method_name  # 'read' or 'write'"},{"col":4,"comment":"Unified I/O registry instance.","endLoc":51,"header":"@property\n    def registry(self)","id":7081,"name":"registry","nodeType":"Function","startLoc":48,"text":"@property\n    def registry(self):\n        \"\"\"Unified I/O registry instance.\"\"\"\n        return self._registry"},{"col":4,"comment":"Output help documentation for the specified unified I/O ``format``.\n\n        By default the help output is printed to the console via ``pydoc.pager``.\n        Instead one can supplied a file handle object as ``out`` and the output\n        will be written to that handle.\n\n        Parameters\n        ----------\n        format : str\n            Unified I/O format name, e.g. 'fits' or 'ascii.ecsv'\n        out : None or path-like\n            Output destination (default is stdout via a pager)\n        ","endLoc":100,"header":"def help(self, format=None, out=None)","id":7082,"name":"help","nodeType":"Function","startLoc":53,"text":"def help(self, format=None, out=None):\n        \"\"\"Output help documentation for the specified unified I/O ``format``.\n\n        By default the help output is printed to the console via ``pydoc.pager``.\n        Instead one can supplied a file handle object as ``out`` and the output\n        will be written to that handle.\n\n        Parameters\n        ----------\n        format : str\n            Unified I/O format name, e.g. 'fits' or 'ascii.ecsv'\n        out : None or path-like\n            Output destination (default is stdout via a pager)\n        \"\"\"\n        cls = self._cls\n        method_name = self._method_name\n\n        # Get reader or writer function associated with the registry\n        get_func = (self._registry.get_reader if method_name == 'read'\n                    else self._registry.get_writer)\n        try:\n            if format:\n                read_write_func = get_func(format, cls)\n        except IORegistryError as err:\n            reader_doc = 'ERROR: ' + str(err)\n        else:\n            if format:\n                # Format-specific\n                header = (\"{}.{}(format='{}') documentation\\n\"\n                          .format(cls.__name__, method_name, format))\n                doc = read_write_func.__doc__\n            else:\n                # General docs\n                header = f'{cls.__name__}.{method_name} general documentation\\n'\n                doc = getattr(cls, method_name).__doc__\n\n            reader_doc = re.sub('.', '=', header)\n            reader_doc += header\n            reader_doc += re.sub('.', '=', header)\n            reader_doc += os.linesep\n            if doc is not None:\n                reader_doc += inspect.cleandoc(doc)\n\n        if out is None:\n            import pydoc\n            pydoc.pager(reader_doc)\n        else:\n            out.write(reader_doc)"},{"col":4,"comment":"null","endLoc":52,"header":"def __init__(self)","id":7083,"name":"__init__","nodeType":"Function","startLoc":40,"text":"def __init__(self):\n        # registry of identifier functions\n        self._identifiers = OrderedDict()\n\n        # what this class can do: e.g. 'read' &/or 'write'\n        self._registries = dict()\n        self._registries[\"identify\"] = dict(attr=\"_identifiers\", column=\"Auto-identify\")\n        self._registries_order = (\"identify\", )  # match keys in `_registries`\n\n        # If multiple formats are added to one class the update of the docs is quite\n        # expensive. Classes for which the doc update is temporarly delayed are added\n        # to this set.\n        self._delayed_docs_classes = set()"},{"fileName":"base.py","filePath":"astropy/io/registry","id":7084,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport abc\nimport contextlib\nimport re\nimport warnings\nfrom collections import OrderedDict\nfrom operator import itemgetter\n\nimport numpy as np\n\n__all__ = ['IORegistryError']\n\n\nclass IORegistryError(Exception):\n    \"\"\"Custom error for registry clashes.\n    \"\"\"\n    pass\n\n\n# -----------------------------------------------------------------------------\n\nclass _UnifiedIORegistryBase(metaclass=abc.ABCMeta):\n    \"\"\"Base class for registries in Astropy's Unified IO.\n\n    This base class provides identification functions and miscellaneous\n    utilities. For an example how to build a registry subclass we suggest\n    :class:`~astropy.io.registry.UnifiedInputRegistry`, which enables\n    read-only registries. These higher-level subclasses will probably serve\n    better as a baseclass, for instance\n    :class:`~astropy.io.registry.UnifiedIORegistry` subclasses both\n    :class:`~astropy.io.registry.UnifiedInputRegistry` and\n    :class:`~astropy.io.registry.UnifiedOutputRegistry` to enable both\n    reading from and writing to files.\n\n    .. versionadded:: 5.0\n\n    \"\"\"\n\n    def __init__(self):\n        # registry of identifier functions\n        self._identifiers = OrderedDict()\n\n        # what this class can do: e.g. 'read' &/or 'write'\n        self._registries = dict()\n        self._registries[\"identify\"] = dict(attr=\"_identifiers\", column=\"Auto-identify\")\n        self._registries_order = (\"identify\", )  # match keys in `_registries`\n\n        # If multiple formats are added to one class the update of the docs is quite\n        # expensive. Classes for which the doc update is temporarly delayed are added\n        # to this set.\n        self._delayed_docs_classes = set()\n\n    @property\n    def available_registries(self):\n        \"\"\"Available registries.\n\n        Returns\n        -------\n        ``dict_keys``\n        \"\"\"\n        return self._registries.keys()\n\n    def get_formats(self, data_class=None, filter_on=None):\n        \"\"\"\n        Get the list of registered formats as a `~astropy.table.Table`.\n\n        Parameters\n        ----------\n        data_class : class or None, optional\n            Filter readers/writer to match data class (default = all classes).\n        filter_on : str or None, optional\n            Which registry to show. E.g. \"identify\"\n            If None search for both.  Default is None.\n\n        Returns\n        -------\n        format_table : :class:`~astropy.table.Table`\n            Table of available I/O formats.\n\n        Raises\n        ------\n        ValueError\n            If ``filter_on`` is not None nor a registry name.\n        \"\"\"\n        from astropy.table import Table\n\n        # set up the column names\n        colnames = (\n            \"Data class\", \"Format\",\n            *[self._registries[k][\"column\"] for k in self._registries_order],\n            \"Deprecated\")\n        i_dataclass = colnames.index(\"Data class\")\n        i_format = colnames.index(\"Format\")\n        i_regstart = colnames.index(self._registries[self._registries_order[0]][\"column\"])\n        i_deprecated = colnames.index(\"Deprecated\")\n\n        # registries\n        regs = set()\n        for k in self._registries.keys() - {\"identify\"}:\n            regs |= set(getattr(self, self._registries[k][\"attr\"]))\n        format_classes = sorted(regs, key=itemgetter(0))\n        # the format classes from all registries except \"identify\"\n\n        rows = []\n        for (fmt, cls) in format_classes:\n            # see if can skip, else need to document in row\n            if (data_class is not None and not self._is_best_match(\n                data_class, cls, format_classes)):\n                continue\n\n            # flags for each registry\n            has_ = {k: \"Yes\" if (fmt, cls) in getattr(self, v[\"attr\"]) else \"No\"\n                    for k, v in self._registries.items()}\n\n            # Check if this is a short name (e.g. 'rdb') which is deprecated in\n            # favor of the full 'ascii.rdb'.\n            ascii_format_class = ('ascii.' + fmt, cls)\n            # deprecation flag\n            deprecated = \"Yes\" if ascii_format_class in format_classes else \"\"\n\n            # add to rows\n            rows.append((cls.__name__, fmt,\n                         *[has_[n] for n in self._registries_order], deprecated))\n\n        # filter_on can be in self_registries_order or None\n        if str(filter_on).lower() in self._registries_order:\n            index = self._registries_order.index(str(filter_on).lower())\n            rows = [row for row in rows if row[i_regstart + index] == 'Yes']\n        elif filter_on is not None:\n            raise ValueError('unrecognized value for \"filter_on\": {0}.\\n'\n                             f'Allowed are {self._registries_order} and None.')\n\n        # Sorting the list of tuples is much faster than sorting it after the\n        # table is created. (#5262)\n        if rows:\n            # Indices represent \"Data Class\", \"Deprecated\" and \"Format\".\n            data = list(zip(*sorted(\n                rows, key=itemgetter(i_dataclass, i_deprecated, i_format))))\n        else:\n            data = None\n\n        # make table\n        # need to filter elementwise comparison failure issue\n        # https://github.com/numpy/numpy/issues/6784\n        with warnings.catch_warnings():\n            warnings.simplefilter(action='ignore', category=FutureWarning)\n\n            format_table = Table(data, names=colnames)\n            if not np.any(format_table['Deprecated'].data == 'Yes'):\n                format_table.remove_column('Deprecated')\n\n        return format_table\n\n    @contextlib.contextmanager\n    def delay_doc_updates(self, cls):\n        \"\"\"Contextmanager to disable documentation updates when registering\n        reader and writer. The documentation is only built once when the\n        contextmanager exits.\n\n        .. versionadded:: 1.3\n\n        Parameters\n        ----------\n        cls : class\n            Class for which the documentation updates should be delayed.\n\n        Notes\n        -----\n        Registering multiple readers and writers can cause significant overhead\n        because the documentation of the corresponding ``read`` and ``write``\n        methods are build every time.\n\n        Examples\n        --------\n        see for example the source code of ``astropy.table.__init__``.\n        \"\"\"\n        self._delayed_docs_classes.add(cls)\n\n        yield\n\n        self._delayed_docs_classes.discard(cls)\n        for method in self._registries.keys() - {\"identify\"}:\n            self._update__doc__(cls, method)\n\n    # =========================================================================\n    # Identifier methods\n\n    def register_identifier(self, data_format, data_class, identifier, force=False):\n        \"\"\"\n        Associate an identifier function with a specific data type.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that is used to\n            specify the data type when reading/writing.\n        data_class : class\n            The class of the object that can be written.\n        identifier : function\n            A function that checks the argument specified to `read` or `write` to\n            determine whether the input can be interpreted as a table of type\n            ``data_format``. This function should take the following arguments:\n\n               - ``origin``: A string ``\"read\"`` or ``\"write\"`` identifying whether\n                 the file is to be opened for reading or writing.\n               - ``path``: The path to the file.\n               - ``fileobj``: An open file object to read the file's contents, or\n                 `None` if the file could not be opened.\n               - ``*args``: Positional arguments for the `read` or `write`\n                 function.\n               - ``**kwargs``: Keyword arguments for the `read` or `write`\n                 function.\n\n            One or both of ``path`` or ``fileobj`` may be `None`.  If they are\n            both `None`, the identifier will need to work from ``args[0]``.\n\n            The function should return True if the input can be identified\n            as being of format ``data_format``, and False otherwise.\n        force : bool, optional\n            Whether to override any existing function if already present.\n            Default is ``False``.\n\n        Examples\n        --------\n        To set the identifier based on extensions, for formats that take a\n        filename as a first argument, you can do for example\n\n        .. code-block:: python\n\n            from astropy.io.registry import register_identifier\n            from astropy.table import Table\n            def my_identifier(*args, **kwargs):\n                return isinstance(args[0], str) and args[0].endswith('.tbl')\n            register_identifier('ipac', Table, my_identifier)\n            unregister_identifier('ipac', Table)\n        \"\"\"\n        if not (data_format, data_class) in self._identifiers or force:\n            self._identifiers[(data_format, data_class)] = identifier\n        else:\n            raise IORegistryError(\"Identifier for format '{}' and class '{}' is \"\n                                  'already defined'.format(data_format,\n                                                           data_class.__name__))\n\n    def unregister_identifier(self, data_format, data_class):\n        \"\"\"\n        Unregister an identifier function\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier.\n        data_class : class\n            The class of the object that can be read/written.\n        \"\"\"\n        if (data_format, data_class) in self._identifiers:\n            self._identifiers.pop((data_format, data_class))\n        else:\n            raise IORegistryError(\"No identifier defined for format '{}' and class\"\n                                  \" '{}'\".format(data_format, data_class.__name__))\n\n    def identify_format(self, origin, data_class_required, path, fileobj, args, kwargs):\n        \"\"\"Loop through identifiers to see which formats match.\n\n        Parameters\n        ----------\n        origin : str\n            A string ``\"read`` or ``\"write\"`` identifying whether the file is to be\n            opened for reading or writing.\n        data_class_required : object\n            The specified class for the result of `read` or the class that is to be\n            written.\n        path : str or path-like or None\n            The path to the file or None.\n        fileobj : file-like or None.\n            An open file object to read the file's contents, or ``None`` if the\n            file could not be opened.\n        args : sequence\n            Positional arguments for the `read` or `write` function. Note that\n            these must be provided as sequence.\n        kwargs : dict-like\n            Keyword arguments for the `read` or `write` function. Note that this\n            parameter must be `dict`-like.\n\n        Returns\n        -------\n        valid_formats : list\n            List of matching formats.\n        \"\"\"\n        valid_formats = []\n        for data_format, data_class in self._identifiers:\n            if self._is_best_match(data_class_required, data_class, self._identifiers):\n                if self._identifiers[(data_format, data_class)](\n                        origin, path, fileobj, *args, **kwargs):\n                    valid_formats.append(data_format)\n\n        return valid_formats\n\n    # =========================================================================\n    # Utils\n\n    def _get_format_table_str(self, data_class, filter_on):\n        \"\"\"``get_formats()``, without column \"Data class\", as a str.\"\"\"\n        format_table = self.get_formats(data_class, filter_on)\n        format_table.remove_column('Data class')\n        format_table_str = '\\n'.join(format_table.pformat(max_lines=-1))\n        return format_table_str\n\n    def _is_best_match(self, class1, class2, format_classes):\n        \"\"\"\n        Determine if class2 is the \"best\" match for class1 in the list\n        of classes.  It is assumed that (class2 in classes) is True.\n        class2 is the the best match if:\n\n        - ``class1`` is a subclass of ``class2`` AND\n        - ``class2`` is the nearest ancestor of ``class1`` that is in classes\n          (which includes the case that ``class1 is class2``)\n        \"\"\"\n        if issubclass(class1, class2):\n            classes = {cls for fmt, cls in format_classes}\n            for parent in class1.__mro__:\n                if parent is class2:  # class2 is closest registered ancestor\n                    return True\n                if parent in classes:  # class2 was superceded\n                    return False\n        return False\n\n    def _get_valid_format(self, mode, cls, path, fileobj, args, kwargs):\n        \"\"\"\n        Returns the first valid format that can be used to read/write the data in\n        question.  Mode can be either 'read' or 'write'.\n        \"\"\"\n        valid_formats = self.identify_format(mode, cls, path, fileobj, args, kwargs)\n\n        if len(valid_formats) == 0:\n            format_table_str = self._get_format_table_str(cls, mode.capitalize())\n            raise IORegistryError(\"Format could not be identified based on the\"\n                                  \" file name or contents, please provide a\"\n                                  \" 'format' argument.\\n\"\n                                  \"The available formats are:\\n\"\n                                  \"{}\".format(format_table_str))\n        elif len(valid_formats) > 1:\n            return self._get_highest_priority_format(mode, cls, valid_formats)\n\n        return valid_formats[0]\n\n    def _get_highest_priority_format(self, mode, cls, valid_formats):\n        \"\"\"\n        Returns the reader or writer with the highest priority. If it is a tie,\n        error.\n        \"\"\"\n        if mode == \"read\":\n            format_dict = self._readers\n            mode_loader = \"reader\"\n        elif mode == \"write\":\n            format_dict = self._writers\n            mode_loader = \"writer\"\n\n        best_formats = []\n        current_priority = - np.inf\n        for format in valid_formats:\n            try:\n                _, priority = format_dict[(format, cls)]\n            except KeyError:\n                # We could throw an exception here, but get_reader/get_writer handle\n                # this case better, instead maximally deprioritise the format.\n                priority = - np.inf\n\n            if priority == current_priority:\n                best_formats.append(format)\n            elif priority > current_priority:\n                best_formats = [format]\n                current_priority = priority\n\n        if len(best_formats) > 1:\n            raise IORegistryError(\"Format is ambiguous - options are: {}\".format(\n                ', '.join(sorted(valid_formats, key=itemgetter(0)))\n            ))\n        return best_formats[0]\n\n    def _update__doc__(self, data_class, readwrite):\n        \"\"\"\n        Update the docstring to include all the available readers / writers for\n        the ``data_class.read``/``data_class.write`` functions (respectively).\n        Don't update if the data_class does not have the relevant method.\n        \"\"\"\n        # abort if method \"readwrite\" isn't on data_class\n        if not hasattr(data_class, readwrite):\n            return\n\n        from .interface import UnifiedReadWrite\n\n        FORMATS_TEXT = 'The available built-in formats are:'\n\n        # Get the existing read or write method and its docstring\n        class_readwrite_func = getattr(data_class, readwrite)\n\n        if not isinstance(class_readwrite_func.__doc__, str):\n            # No docstring--could just be test code, or possibly code compiled\n            # without docstrings\n            return\n\n        lines = class_readwrite_func.__doc__.splitlines()\n\n        # Find the location of the existing formats table if it exists\n        sep_indices = [ii for ii, line in enumerate(lines) if FORMATS_TEXT in line]\n        if sep_indices:\n            # Chop off the existing formats table, including the initial blank line\n            chop_index = sep_indices[0]\n            lines = lines[:chop_index]\n\n        # Find the minimum indent, skipping the first line because it might be odd\n        matches = [re.search(r'(\\S)', line) for line in lines[1:]]\n        left_indent = ' ' * min(match.start() for match in matches if match)\n\n        # Get the available unified I/O formats for this class\n        # Include only formats that have a reader, and drop the 'Data class' column\n        format_table = self.get_formats(data_class, readwrite.capitalize())\n        format_table.remove_column('Data class')\n\n        # Get the available formats as a table, then munge the output of pformat()\n        # a bit and put it into the docstring.\n        new_lines = format_table.pformat(max_lines=-1, max_width=80)\n        table_rst_sep = re.sub('-', '=', new_lines[1])\n        new_lines[1] = table_rst_sep\n        new_lines.insert(0, table_rst_sep)\n        new_lines.append(table_rst_sep)\n\n        # Check for deprecated names and include a warning at the end.\n        if 'Deprecated' in format_table.colnames:\n            new_lines.extend(['',\n                              'Deprecated format names like ``aastex`` will be '\n                              'removed in a future version. Use the full ',\n                              'name (e.g. ``ascii.aastex``) instead.'])\n\n        new_lines = [FORMATS_TEXT, ''] + new_lines\n        lines.extend([left_indent + line for line in new_lines])\n\n        # Depending on Python version and whether class_readwrite_func is\n        # an instancemethod or classmethod, one of the following will work.\n        if isinstance(class_readwrite_func, UnifiedReadWrite):\n            class_readwrite_func.__class__.__doc__ = '\\n'.join(lines)\n        else:\n            try:\n                class_readwrite_func.__doc__ = '\\n'.join(lines)\n            except AttributeError:\n                class_readwrite_func.__func__.__doc__ = '\\n'.join(lines)\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":7085,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"base.py#<anonymous>","id":7086,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['IORegistryError']"},{"attributeType":"null","col":8,"comment":"null","endLoc":1659,"id":7087,"name":"epoch","nodeType":"Attribute","startLoc":1659,"text":"self.epoch"},{"fileName":"__init__.py","filePath":"astropy/io/registry","id":7088,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nUnified I/O Registry.\n\"\"\"\n\nfrom . import base, compat, core, interface\nfrom .base import *\nfrom .compat import *\nfrom .compat import _identifiers, _readers, _writers  # for backwards compat\nfrom .core import *\nfrom .interface import *\n\n__all__ = core.__all__ + interface.__all__ + compat.__all__ + base.__all__\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":7089,"name":"_identifiers","nodeType":"Attribute","startLoc":18,"text":"_identifiers"},{"attributeType":"null","col":8,"comment":"null","endLoc":1732,"id":7090,"name":"_epoch","nodeType":"Attribute","startLoc":1732,"text":"self._epoch"},{"col":0,"comment":"","endLoc":5,"header":"result.py#<anonymous>","id":7091,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nContains a class to handle a validation result for a single VOTable\nfile.\n\"\"\""},{"col":4,"comment":"Available registries.\n\n        Returns\n        -------\n        ``dict_keys``\n        ","endLoc":62,"header":"@property\n    def available_registries(self)","id":7092,"name":"available_registries","nodeType":"Function","startLoc":54,"text":"@property\n    def available_registries(self):\n        \"\"\"Available registries.\n\n        Returns\n        -------\n        ``dict_keys``\n        \"\"\"\n        return self._registries.keys()"},{"fileName":"compat.py","filePath":"astropy/io/registry","id":7093,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport functools\nimport sys\n\nfrom .core import UnifiedIORegistry\n\n__all__ = [\"register_reader\", \"register_writer\", \"register_identifier\",  # noqa: F822\n           \"unregister_reader\", \"unregister_writer\", \"unregister_identifier\",\n           \"get_reader\", \"get_writer\", \"get_formats\",\n           \"read\", \"write\",\n           \"identify_format\", \"delay_doc_updates\"]\n\n# make a default global-state registry  (not publicly scoped, but often accessed)\n# this is for backward compatibility when ``io.registry`` was a file.\ndefault_registry = UnifiedIORegistry()\n# also need to expose the enclosed registries\n_identifiers = default_registry._identifiers\n_readers = default_registry._readers\n_writers = default_registry._writers\n\n\ndef _make_io_func(method_name):\n    \"\"\"Makes a function for a method on UnifiedIORegistry.\n\n    .. todo::\n\n        Make kwarg \"registry\" not hidden.\n\n    Returns\n    -------\n    wrapper : callable\n        Signature matches method on UnifiedIORegistry.\n        Accepts (hidden) kwarg \"registry\". default is ``default_registry``.\n    \"\"\"\n\n    @functools.wraps(getattr(default_registry, method_name))\n    def wrapper(*args, registry=None, **kwargs):\n        # written this way in case ever controlled by ScienceState\n        if registry is None:\n            registry = default_registry\n        # get and call bound method from registry instance\n        return getattr(registry, method_name)(*args, **kwargs)\n\n    return wrapper\n\n\n# =============================================================================\n# JIT function creation and lookup (PEP 562)\n\n\ndef __dir__():\n    dir_out = list(globals())\n    return sorted(dir_out + __all__)\n\n\ndef __getattr__(method: str):\n    if method in __all__:\n        return _make_io_func(method)\n\n    raise AttributeError(f\"module {__name__!r} has no attribute {method!r}\")\n"},{"className":"UnifiedIORegistry","col":0,"comment":"Unified I/O Registry.\n\n    .. versionadded:: 5.0\n    ","endLoc":389,"id":7094,"nodeType":"Class","startLoc":359,"text":"class UnifiedIORegistry(UnifiedInputRegistry, UnifiedOutputRegistry):\n    \"\"\"Unified I/O Registry.\n\n    .. versionadded:: 5.0\n    \"\"\"\n\n    def __init__(self):\n        super().__init__()\n        self._registries_order = (\"read\", \"write\", \"identify\")\n\n    def get_formats(self, data_class=None, readwrite=None):\n        \"\"\"\n        Get the list of registered I/O formats as a `~astropy.table.Table`.\n\n        Parameters\n        ----------\n        data_class : class, optional\n            Filter readers/writer to match data class (default = all classes).\n\n        readwrite : str or None, optional\n            Search only for readers (``\"Read\"``) or writers (``\"Write\"``).\n            If None search for both.  Default is None.\n\n            .. versionadded:: 1.3\n\n        Returns\n        -------\n        format_table : :class:`~astropy.table.Table`\n            Table of available I/O formats.\n        \"\"\"\n        return super().get_formats(data_class, readwrite)"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":7095,"name":"_readers","nodeType":"Attribute","startLoc":19,"text":"_readers"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":7096,"name":"_writers","nodeType":"Attribute","startLoc":20,"text":"_writers"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":7097,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"__init__.py#<anonymous>","id":7098,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nUnified I/O Registry.\n\"\"\"\n\n__all__ = core.__all__ + interface.__all__ + compat.__all__ + base.__all__"},{"attributeType":"null","col":8,"comment":"null","endLoc":1657,"id":7099,"name":"ID","nodeType":"Attribute","startLoc":1657,"text":"self.ID"},{"className":"UnifiedInputRegistry","col":0,"comment":"Read-only Unified Registry.\n\n    .. versionadded:: 5.0\n\n    Examples\n    --------\n    First let's start by creating a read-only registry.\n\n    .. code-block:: python\n\n        >>> from astropy.io.registry import UnifiedInputRegistry\n        >>> read_reg = UnifiedInputRegistry()\n\n    There is nothing in this registry. Let's make a reader for the\n    :class:`~astropy.table.Table` class::\n\n        from astropy.table import Table\n\n        def my_table_reader(filename, some_option=1):\n            # Read in the table by any means necessary\n            return table  # should be an instance of Table\n\n    Such a function can then be registered with the I/O registry::\n\n        read_reg.register_reader('my-table-format', Table, my_table_reader)\n\n    Note that we CANNOT then read in a table with::\n\n        d = Table.read('my_table_file.mtf', format='my-table-format')\n\n    Why? because ``Table.read`` uses Astropy's default global registry and this\n    is a separate registry.\n    Instead we can read by the read method on the registry::\n\n        d = read_reg.read(Table, 'my_table_file.mtf', format='my-table-format')\n\n    ","endLoc":214,"id":7100,"nodeType":"Class","startLoc":19,"text":"class UnifiedInputRegistry(_UnifiedIORegistryBase):\n    \"\"\"Read-only Unified Registry.\n\n    .. versionadded:: 5.0\n\n    Examples\n    --------\n    First let's start by creating a read-only registry.\n\n    .. code-block:: python\n\n        >>> from astropy.io.registry import UnifiedInputRegistry\n        >>> read_reg = UnifiedInputRegistry()\n\n    There is nothing in this registry. Let's make a reader for the\n    :class:`~astropy.table.Table` class::\n\n        from astropy.table import Table\n\n        def my_table_reader(filename, some_option=1):\n            # Read in the table by any means necessary\n            return table  # should be an instance of Table\n\n    Such a function can then be registered with the I/O registry::\n\n        read_reg.register_reader('my-table-format', Table, my_table_reader)\n\n    Note that we CANNOT then read in a table with::\n\n        d = Table.read('my_table_file.mtf', format='my-table-format')\n\n    Why? because ``Table.read`` uses Astropy's default global registry and this\n    is a separate registry.\n    Instead we can read by the read method on the registry::\n\n        d = read_reg.read(Table, 'my_table_file.mtf', format='my-table-format')\n\n    \"\"\"\n\n    def __init__(self):\n        super().__init__()  # set _identifiers\n        self._readers = OrderedDict()\n        self._registries[\"read\"] = dict(attr=\"_readers\", column=\"Read\")\n        self._registries_order = (\"read\", \"identify\")\n\n    # =========================================================================\n    # Read methods\n\n    def register_reader(self, data_format, data_class, function, force=False,\n                        priority=0):\n        \"\"\"\n        Register a reader function.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that will be used to\n            specify the data type when reading.\n        data_class : class\n            The class of the object that the reader produces.\n        function : function\n            The function to read in a data object.\n        force : bool, optional\n            Whether to override any existing function if already present.\n            Default is ``False``.\n        priority : int, optional\n            The priority of the reader, used to compare possible formats when\n            trying to determine the best reader to use. Higher priorities are\n            preferred over lower priorities, with the default priority being 0\n            (negative numbers are allowed though).\n        \"\"\"\n        if not (data_format, data_class) in self._readers or force:\n            self._readers[(data_format, data_class)] = function, priority\n        else:\n            raise IORegistryError(\"Reader for format '{}' and class '{}' is \"\n                              'already defined'\n                              ''.format(data_format, data_class.__name__))\n\n        if data_class not in self._delayed_docs_classes:\n            self._update__doc__(data_class, 'read')\n\n    def unregister_reader(self, data_format, data_class):\n        \"\"\"\n        Unregister a reader function\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier.\n        data_class : class\n            The class of the object that the reader produces.\n        \"\"\"\n\n        if (data_format, data_class) in self._readers:\n            self._readers.pop((data_format, data_class))\n        else:\n            raise IORegistryError(\"No reader defined for format '{}' and class '{}'\"\n                                  ''.format(data_format, data_class.__name__))\n\n        if data_class not in self._delayed_docs_classes:\n            self._update__doc__(data_class, 'read')\n\n    def get_reader(self, data_format, data_class):\n        \"\"\"Get reader for ``data_format``.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that is used to\n            specify the data type when reading/writing.\n        data_class : class\n            The class of the object that can be written.\n\n        Returns\n        -------\n        reader : callable\n            The registered reader function for this format and class.\n        \"\"\"\n        readers = [(fmt, cls) for fmt, cls in self._readers if fmt == data_format]\n        for reader_format, reader_class in readers:\n            if self._is_best_match(data_class, reader_class, readers):\n                return self._readers[(reader_format, reader_class)][0]\n        else:\n            format_table_str = self._get_format_table_str(data_class, 'Read')\n            raise IORegistryError(\n                \"No reader defined for format '{}' and class '{}'.\\n\\nThe \"\n                \"available formats are:\\n\\n{}\".format(\n                    data_format, data_class.__name__, format_table_str))\n\n    def read(self, cls, *args, format=None, cache=False, **kwargs):\n        \"\"\"\n        Read in data.\n\n        Parameters\n        ----------\n        cls : class\n        *args\n            The arguments passed to this method depend on the format.\n        format : str or None\n        cache : bool\n            Whether to cache the results of reading in the data.\n        **kwargs\n            The arguments passed to this method depend on the format.\n\n        Returns\n        -------\n        object or None\n            The output of the registered reader.\n        \"\"\"\n        ctx = None\n        try:\n            if format is None:\n                path = None\n                fileobj = None\n\n                if len(args):\n                    if isinstance(args[0], PATH_TYPES) and not os.path.isdir(args[0]):\n                        from astropy.utils.data import get_readable_fileobj\n\n                        # path might be a os.PathLike object\n                        if isinstance(args[0], os.PathLike):\n                            args = (os.fspath(args[0]),) + args[1:]\n                        path = args[0]\n                        try:\n                            ctx = get_readable_fileobj(args[0], encoding='binary', cache=cache)\n                            fileobj = ctx.__enter__()\n                        except OSError:\n                            raise\n                        except Exception:\n                            fileobj = None\n                        else:\n                            args = [fileobj] + list(args[1:])\n                    elif hasattr(args[0], 'read'):\n                        path = None\n                        fileobj = args[0]\n\n                format = self._get_valid_format(\n                    'read', cls, path, fileobj, args, kwargs)\n\n            reader = self.get_reader(format, cls)\n            data = reader(*args, **kwargs)\n\n            if not isinstance(data, cls):\n                # User has read with a subclass where only the parent class is\n                # registered.  This returns the parent class, so try coercing\n                # to desired subclass.\n                try:\n                    data = cls(data)\n                except Exception:\n                    raise TypeError('could not convert reader output to {} '\n                                    'class.'.format(cls.__name__))\n        finally:\n            if ctx is not None:\n                ctx.__exit__(*sys.exc_info())\n\n        return data"},{"attributeType":"None","col":8,"comment":"null","endLoc":1679,"id":7101,"name":"_ID","nodeType":"Attribute","startLoc":1679,"text":"self._ID"},{"col":4,"comment":"null","endLoc":62,"header":"def __init__(self)","id":7102,"name":"__init__","nodeType":"Function","startLoc":58,"text":"def __init__(self):\n        super().__init__()  # set _identifiers\n        self._readers = OrderedDict()\n        self._registries[\"read\"] = dict(attr=\"_readers\", column=\"Read\")\n        self._registries_order = (\"read\", \"identify\")"},{"id":7103,"name":"astropy/io/registry/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/registry/tests","id":7104,"nodeType":"File","text":""},{"attributeType":"null","col":8,"comment":"null","endLoc":1658,"id":7105,"name":"equinox","nodeType":"Attribute","startLoc":1658,"text":"self.equinox"},{"id":7106,"name":"astropy/wcs","nodeType":"Package"},{"fileName":"docstrings.py","filePath":"astropy/wcs","id":7107,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# It gets to be really tedious to type long docstrings in ANSI C\n# syntax (since multi-line string literals are not valid).\n# Therefore, the docstrings are written here in doc/docstrings.py,\n# which are then converted by setup.py into docstrings.h, which is\n# included by pywcs.c\n\n__all__ = ['TWO_OR_MORE_ARGS', 'RETURNS', 'ORIGIN', 'RA_DEC_ORDER']\n\n\ndef _fix(content, indent=0):\n    lines = content.split('\\n')\n    indent = '\\n' + ' ' * indent\n    return indent.join(lines)\n\n\ndef TWO_OR_MORE_ARGS(naxis, indent=0):\n    return _fix(\nf\"\"\"*args\n    There are two accepted forms for the positional arguments:\n\n        - 2 arguments: An *N* x *{naxis}* array of coordinates, and an\n          *origin*.\n\n        - more than 2 arguments: An array for each axis, followed by\n          an *origin*.  These arrays must be broadcastable to one\n          another.\n\n    Here, *origin* is the coordinate in the upper left corner of the\n    image.  In FITS and Fortran standards, this is 1.  In Numpy and C\n    standards this is 0.\n\"\"\", indent)\n\n\ndef RETURNS(out_type, indent=0):\n    return _fix(f\"\"\"result : array\n    Returns the {out_type}.  If the input was a single array and\n    origin, a single array is returned, otherwise a tuple of arrays is\n    returned.\"\"\", indent)\n\n\ndef ORIGIN(indent=0):\n    return _fix(\n\"\"\"\norigin : int\n    Specifies the origin of pixel values.  The Fortran and FITS\n    standards use an origin of 1.  Numpy and C use array indexing with\n    origin at 0.\n\"\"\", indent)\n\n\ndef RA_DEC_ORDER(indent=0):\n    return _fix(\n\"\"\"\nra_dec_order : bool, optional\n    When `True` will ensure that world coordinates are always given\n    and returned in as (*ra*, *dec*) pairs, regardless of the order of\n    the axes specified by the in the ``CTYPE`` keywords.  Default is\n    `False`.\n\"\"\", indent)\n\n\na = \"\"\"\n``double array[a_order+1][a_order+1]`` Focal plane transformation\nmatrix.\n\nThe `SIP`_ ``A_i_j`` matrix used for pixel to focal plane\ntransformation.\n\nIts values may be changed in place, but it may not be resized, without\ncreating a new `~astropy.wcs.Sip` object.\n\"\"\"\n\na_order = \"\"\"\n``int`` (read-only) Order of the polynomial (``A_ORDER``).\n\"\"\"\n\nall_pix2world = \"\"\"\nall_pix2world(pixcrd, origin) -> ``double array[ncoord][nelem]``\n\nTransforms pixel coordinates to world coordinates.\n\nDoes the following:\n\n    - Detector to image plane correction (if present)\n\n    - SIP distortion correction (if present)\n\n    - FITS WCS distortion correction (if present)\n\n    - wcslib \"core\" WCS transformation\n\nThe first three (the distortion corrections) are done in parallel.\n\nParameters\n----------\npixcrd : ndarray\n    Array of pixel coordinates as ``double array[ncoord][nelem]``.\n\n{}\n\nReturns\n-------\nworld : ndarray\n    Returns an array of world coordinates as ``double array[ncoord][nelem]``.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nSingularMatrixError\n    Linear transformation matrix is singular.\n\nInconsistentAxisTypesError\n    Inconsistent or unrecognized coordinate axis types.\n\nValueError\n    Invalid parameter value.\n\nValueError\n    Invalid coordinate transformation parameters.\n\nValueError\n    x- and y-coordinate arrays are not the same size.\n\nInvalidTransformError\n    Invalid coordinate transformation.\n\nInvalidTransformError\n    Ill-conditioned coordinate transformation parameters.\n\"\"\".format(ORIGIN())\n\nalt = \"\"\"\n``str`` Character code for alternate coordinate descriptions.\n\nFor example, the ``\"a\"`` in keyword names such as ``CTYPEia``.  This\nis a space character for the primary coordinate description, or one of\nthe 26 upper-case letters, A-Z.\n\"\"\"\n\nap = \"\"\"\n``double array[ap_order+1][ap_order+1]`` Focal plane to pixel\ntransformation matrix.\n\nThe `SIP`_ ``AP_i_j`` matrix used for focal plane to pixel\ntransformation.  Its values may be changed in place, but it may not be\nresized, without creating a new `~astropy.wcs.Sip` object.\n\"\"\"\n\nap_order = \"\"\"\n``int`` (read-only) Order of the polynomial (``AP_ORDER``).\n\"\"\"\n\ncel = \"\"\"\n`~astropy.wcs.Celprm` Information required to transform celestial coordinates.\n\"\"\"\n\nCelprm = \"\"\"\nClass that contains information required to transform celestial coordinates.\nIt consists of certain members that must be set by the user (given) and others\nthat are set by the WCSLIB routines (returned).\nSome of the latter are supplied for informational purposes and others are for\ninternal use only.\n\"\"\"\n\nPrjprm = \"\"\"\nClass that contains information needed to project or deproject native spherical coordinates.\nIt consists of certain members that must be set by the user (given) and others\nthat are set by the WCSLIB routines (returned).\nSome of the latter are supplied for informational purposes and others are for\ninternal use only.\n\"\"\"\n\naux = \"\"\"\n`~astropy.wcs.Auxprm` Auxiliary coordinate system information of a specialist nature.\n\"\"\"\n\nAuxprm = \"\"\"\nClass that contains auxiliary coordinate system information of a specialist\nnature.\n\nThis class can not be constructed directly from Python, but instead is\nreturned from `~astropy.wcs.Wcsprm.aux`.\n\"\"\"\n\naxis_types = \"\"\"\n``int array[naxis]`` An array of four-digit type codes for each axis.\n\n- First digit (i.e. 1000s):\n\n  - 0: Non-specific coordinate type.\n\n  - 1: Stokes coordinate.\n\n  - 2: Celestial coordinate (including ``CUBEFACE``).\n\n  - 3: Spectral coordinate.\n\n- Second digit (i.e. 100s):\n\n  - 0: Linear axis.\n\n  - 1: Quantized axis (``STOKES``, ``CUBEFACE``).\n\n  - 2: Non-linear celestial axis.\n\n  - 3: Non-linear spectral axis.\n\n  - 4: Logarithmic axis.\n\n  - 5: Tabular axis.\n\n- Third digit (i.e. 10s):\n\n  - 0: Group number, e.g. lookup table number\n\n- The fourth digit is used as a qualifier depending on the axis type.\n\n  - For celestial axes:\n\n    - 0: Longitude coordinate.\n\n    - 1: Latitude coordinate.\n\n    - 2: ``CUBEFACE`` number.\n\n  - For lookup tables: the axis number in a multidimensional table.\n\n``CTYPEia`` in ``\"4-3\"`` form with unrecognized algorithm code will\nhave its type set to -1 and generate an error.\n\"\"\"\n\nb = \"\"\"\n``double array[b_order+1][b_order+1]`` Pixel to focal plane\ntransformation matrix.\n\nThe `SIP`_ ``B_i_j`` matrix used for pixel to focal plane\ntransformation.  Its values may be changed in place, but it may not be\nresized, without creating a new `~astropy.wcs.Sip` object.\n\"\"\"\n\nb_order = \"\"\"\n``int`` (read-only) Order of the polynomial (``B_ORDER``).\n\"\"\"\n\nbounds_check = \"\"\"\nbounds_check(pix2world, world2pix)\n\nEnable/disable bounds checking.\n\nParameters\n----------\npix2world : bool, optional\n    When `True`, enable bounds checking for the pixel-to-world (p2x)\n    transformations.  Default is `True`.\n\nworld2pix : bool, optional\n    When `True`, enable bounds checking for the world-to-pixel (s2x)\n    transformations.  Default is `True`.\n\nNotes\n-----\nNote that by default (without calling `bounds_check`) strict bounds\nchecking is enabled.\n\"\"\"\n\nbp = \"\"\"\n``double array[bp_order+1][bp_order+1]`` Focal plane to pixel\ntransformation matrix.\n\nThe `SIP`_ ``BP_i_j`` matrix used for focal plane to pixel\ntransformation.  Its values may be changed in place, but it may not be\nresized, without creating a new `~astropy.wcs.Sip` object.\n\"\"\"\n\nbp_order = \"\"\"\n``int`` (read-only) Order of the polynomial (``BP_ORDER``).\n\"\"\"\n\ncd = \"\"\"\n``double array[naxis][naxis]`` The ``CDi_ja`` linear transformation\nmatrix.\n\nFor historical compatibility, three alternate specifications of the\nlinear transformations are available in wcslib.  The canonical\n``PCi_ja`` with ``CDELTia``, ``CDi_ja``, and the deprecated\n``CROTAia`` keywords.  Although the latter may not formally co-exist\nwith ``PCi_ja``, the approach here is simply to ignore them if given\nin conjunction with ``PCi_ja``.\n\n`~astropy.wcs.Wcsprm.has_pc`, `~astropy.wcs.Wcsprm.has_cd` and\n`~astropy.wcs.Wcsprm.has_crota` can be used to determine which of\nthese alternatives are present in the header.\n\nThese alternate specifications of the linear transformation matrix are\ntranslated immediately to ``PCi_ja`` by `~astropy.wcs.Wcsprm.set` and\nare nowhere visible to the lower-level routines.  In particular,\n`~astropy.wcs.Wcsprm.set` resets `~astropy.wcs.Wcsprm.cdelt` to unity\nif ``CDi_ja`` is present (and no ``PCi_ja``).  If no ``CROTAia`` is\nassociated with the latitude axis, `~astropy.wcs.Wcsprm.set` reverts\nto a unity ``PCi_ja`` matrix.\n\"\"\"\n\ncdelt = \"\"\"\n``double array[naxis]`` Coordinate increments (``CDELTia``) for each\ncoord axis.\n\nIf a ``CDi_ja`` linear transformation matrix is present, a warning is\nraised and `~astropy.wcs.Wcsprm.cdelt` is ignored.  The ``CDi_ja``\nmatrix may be deleted by::\n\n  del wcs.wcs.cd\n\nAn undefined value is represented by NaN.\n\"\"\"\n\ncdfix = \"\"\"\ncdfix()\n\nFix erroneously omitted ``CDi_ja`` keywords.\n\nSets the diagonal element of the ``CDi_ja`` matrix to unity if all\n``CDi_ja`` keywords associated with a given axis were omitted.\nAccording to Paper I, if any ``CDi_ja`` keywords at all are given in a\nFITS header then those not given default to zero.  This results in a\nsingular matrix with an intersecting row and column of zeros.\n\nReturns\n-------\nsuccess : int\n    Returns ``0`` for success; ``-1`` if no change required.\n\"\"\"\n\ncel_offset = \"\"\"\n``boolean`` Is there an offset?\n\nIf `True`, an offset will be applied to ``(x, y)`` to force ``(x, y) =\n(0, 0)`` at the fiducial point, (phi_0, theta_0).  Default is `False`.\n\"\"\"\n\ncelprm_phi0 = r\"\"\"\n`float`, `None`. The native longitude, :math:`\\phi_0`, in degrees of the\nfiducial point, i.e., the point whose celestial coordinates are given in\n''Celprm.ref[0:1]''. If `None` or ``nan``, the initialization routine,\n``celset()``, will set this to a projection-specific default.\n\"\"\"\n\ncelprm_theta0 = r\"\"\"\n`float`, `None`. The native latitude, :math:`\\theta_0`, in degrees of the\nfiducial point, i.e. the point whose celestial coordinates are given in\n``Celprm:ref[0:1]``. If `None` or ``nan``, the initialization routine,\n``celset()``, will set this to a projection-specific default.\n\"\"\"\n\ncelprm_ref = \"\"\"\n``numpy.ndarray`` with 4 elements.\n(Given) The first pair of values should be set to the celestial longitude and\nlatitude of the fiducial point in degrees - typically right ascension and\ndeclination. These are given by the ``CRVALia`` keywords in ``FITS``.\n\n(Given and returned) The second pair of values are the native longitude,\n``phi_p`` (in degrees), and latitude, ``theta_p`` (in degrees), of the\ncelestial pole (the latter is the same as the celestial latitude of the\nnative pole, ``delta_p``) and these are given by the ``FITS`` keywords\n``LONPOLEa`` and ``LATPOLEa`` (or by ``PVi_2a`` and ``PVi_3a`` attached\nto the longitude axis which take precedence if defined).\n\n``LONPOLEa`` defaults to ``phi0`` if the celestial latitude of the fiducial\npoint of the projection is greater than or equal to the native latitude,\notherwise ``phi0 + 180`` (degrees). (This is the condition for the celestial\nlatitude to increase in the same direction as the native latitude at the\nfiducial point.) ``ref[2]`` may be set to `None` or ``numpy.nan``\nor 999.0 to indicate that the correct default should be substituted.\n\n``theta_p``, the native latitude of the celestial pole (or equally the\ncelestial latitude of the native pole, ``delta_p``) is often determined\nuniquely by ``CRVALia`` and ``LONPOLEa`` in which case ``LATPOLEa`` is ignored.\nHowever, in some circumstances there are two valid solutions for ``theta_p``\nand ``LATPOLEa`` is used to choose between them. ``LATPOLEa`` is set in\n``ref[3]`` and the solution closest to this value is used to reset ``ref[3]``.\nIt is therefore legitimate, for example, to set ``ref[3]`` to ``+90.0``\nto choose the more northerly solution - the default if the ``LATPOLEa`` keyword\nis omitted from the ``FITS`` header. For the special case where the fiducial\npoint of the projection is at native latitude zero, its celestial latitude\nis zero, and ``LONPOLEa`` = ``+/- 90.0`` then the celestial latitude of the\nnative pole is not determined by the first three reference values and\n``LATPOLEa`` specifies it completely.\n\nThe returned value, celprm.latpreq, specifies how ``LATPOLEa``\nwas actually used.\"\"\"\n\ncelprm_euler = \"\"\"\n*Read-only* ``numpy.ndarray`` with 5 elements. Euler angles and associated\nintermediaries derived from the coordinate reference values. The first three\nvalues are the ``Z-``, ``X-``, and ``Z``-Euler angles in degrees, and the\nremaining two are the cosine and sine of the ``X``-Euler angle.\n\"\"\"\n\ncelprm_latpreq = \"\"\"\n``int``, *read-only*. For informational purposes, this indicates how the\n``LATPOLEa`` keyword was used:\n\n- 0: Not required, ``theta_p == delta_p`` was determined uniquely by the\n    ``CRVALia`` and ``LONPOLEa`` keywords.\n- 1: Required to select between two valid solutions of ``theta_p``.\n- 2: ``theta_p`` was specified solely by ``LATPOLEa``.\n\"\"\"\n\ncelprm_isolat = \"\"\"\n``bool``, *read-only*. True if the spherical rotation preserves the magnitude\nof the latitude, which occurs if the axes of the native and celestial\ncoordinates are coincident. It signals an opportunity to cache intermediate\ncalculations common to all elements in a vector computation.\n\"\"\"\n\ncelprm_prj = \"\"\"\n*Read-only* Celestial transformation parameters. Some members of `Prjprm`\nare read-write, i.e., can be set by the user. For more details, see\ndocumentation for `Prjprm`.\n\"\"\"\n\nprjprm_r0 = r\"\"\"\nThe radius of the generating sphere for the projection, a linear scaling\nparameter. If this is zero, it will be reset to its default value of\n:math:`180^\\circ/\\pi` (the value for FITS WCS).\n\"\"\"\n\nprjprm_code = \"\"\"\nThree-letter projection code defined by the FITS standard.\n\"\"\"\n\nprjprm_pv = \"\"\"\nProjection parameters. These correspond to the ``PVi_ma`` keywords in FITS,\nso ``pv[0]`` is ``PVi_0a``, ``pv[1]`` is ``PVi_1a``, etc., where ``i`` denotes\nthe latitude-like axis. Many projections use ``pv[1]`` (``PVi_1a``),\nsome also use ``pv[2]`` (``PVi_2a``) and ``SZP`` uses ``pv[3]`` (``PVi_3a``).\n``ZPN`` is currently the only projection that uses any of the others.\n\nWhen setting ``pv`` values using lists or ``numpy.ndarray``,\nelements set to `None` will be left unchanged while those set to ``numpy.nan``\nwill be set to ``WCSLIB``'s ``UNDEFINED`` special value. For efficiency\npurposes, if supplied list or ``numpy.ndarray`` is shorter than the length of\nthe ``pv`` member, then remaining values in ``pv`` will be left unchanged.\n\n.. note::\n    When retrieving ``pv``, a copy of the ``prjprm.pv`` array is returned.\n    Modifying this array values will not modify underlying ``WCSLIB``'s\n    ``prjprm.pv`` data.\n\"\"\"\n\nprjprm_pvi = \"\"\"\nSet/Get projection parameters for specific index. These correspond to the\n``PVi_ma`` keywords in FITS, so ``pv[0]`` is ``PVi_0a``, ``pv[1]`` is\n``PVi_1a``, etc., where ``i`` denotes the latitude-like axis.\nMany projections use ``pv[1]`` (``PVi_1a``),\nsome also use ``pv[2]`` (``PVi_2a``) and ``SZP`` uses ``pv[3]`` (``PVi_3a``).\n``ZPN`` is currently the only projection that uses any of the others.\n\nSetting a ``pvi`` value to `None` will reset the corresponding ``WCSLIB``'s\n``prjprm.pv`` element to the default value as set by ``WCSLIB``'s ``prjini()``.\n\nSetting a ``pvi`` value to ``numpy.nan`` will set the corresponding\n``WCSLIB``'s ``prjprm.pv`` element to ``WCSLIB``'s ``UNDEFINED`` special value.\n\"\"\"\n\nprjprm_phi0 = r\"\"\"\nThe native longitude, :math:`\\phi_0` (in degrees) of the reference point,\ni.e. the point ``(x,y) = (0,0)``. If undefined the initialization routine\nwill set this to a projection-specific default.\n\"\"\"\n\nprjprm_theta0 = r\"\"\"\nthe native latitude, :math:`\\theta_0` (in degrees) of the reference point,\ni.e. the point ``(x,y) = (0,0)``. If undefined the initialization routine\nwill set this to a projection-specific default.\n\"\"\"\n\nprjprm_bounds = \"\"\"\nControls bounds checking. If ``bounds&1`` then enable strict bounds checking\nfor the spherical-to-Cartesian (``s2x``) transformation for the\n``AZP``, ``SZP``, ``TAN``, ``SIN``, ``ZPN``, and ``COP`` projections.\nIf ``bounds&2`` then enable strict bounds checking for the\nCartesian-to-spherical transformation (``x2s``) for the ``HPX`` and ``XPH``\nprojections. If ``bounds&4`` then the Cartesian- to-spherical transformations\n(``x2s``) will invoke WCSLIB's ``prjbchk()`` to perform bounds checking on the\ncomputed native coordinates, with a tolerance set to suit each projection.\nbounds is set to 7 during initialization by default which enables all checks.\nZero it to disable all checking.\n\nIt is not necessary to reset the ``Prjprm`` struct (via ``Prjprm.set()``) when\n``bounds`` is changed.\n\"\"\"\n\nprjprm_name = \"\"\"\n*Read-only.* Long name of the projection.\n\"\"\"\n\nprjprm_category = \"\"\"\n*Read-only.* Projection category matching the value of the relevant ``wcs``\nmodule constants:\n\nPRJ_ZENITHAL,\nPRJ_CYLINDRICAL,\nPRJ_PSEUDOCYLINDRICAL,\nPRJ_CONVENTIONAL,\nPRJ_CONIC,\nPRJ_POLYCONIC,\nPRJ_QUADCUBE, and\nPRJ_HEALPIX.\n\"\"\"\n\nprjprm_w = \"\"\"\n*Read-only.* Intermediate floating-point values derived from the projection\nparameters, cached here to save recomputation.\n\n.. note::\n    When retrieving ``w``, a copy of the ``prjprm.w`` array is returned.\n    Modifying this array values will not modify underlying ``WCSLIB``'s\n    ``prjprm.w`` data.\n\n\"\"\"\n\nprjprm_pvrange = \"\"\"\n*Read-only.* Range of projection parameter indices: 100 times the first allowed\nindex plus the number of parameters, e.g. ``TAN`` is 0 (no parameters),\n``SZP`` is 103 (1 to 3), and ``ZPN`` is 30 (0 to 29).\n\"\"\"\n\nprjprm_simplezen = \"\"\"\n*Read-only.* True if the projection is a radially-symmetric zenithal projection.\n\"\"\"\n\nprjprm_equiareal = \"\"\"\n*Read-only.* True if the projection is equal area.\n\"\"\"\n\nprjprm_conformal = \"\"\"\n*Read-only.* True if the projection is conformal.\n\"\"\"\n\nprjprm_global_projection = \"\"\"\n*Read-only.* True if the projection can represent the whole sphere in a finite,\nnon-overlapped mapping.\n\"\"\"\n\nprjprm_divergent = \"\"\"\n*Read-only.* True if the projection diverges in latitude.\n\"\"\"\n\nprjprm_x0 = r\"\"\"\n*Read-only.* The offset in ``x`` used to force :math:`(x,y) = (0,0)` at\n:math:`(\\phi_0, \\theta_0)`.\n\"\"\"\n\nprjprm_y0 = r\"\"\"\n*Read-only.* The offset in ``y`` used to force :math:`(x,y) = (0,0)` at\n:math:`(\\phi_0, \\theta_0)`.\n\"\"\"\n\nprjprm_m = \"\"\"\n*Read-only.* Intermediate integer value (used only for the ``ZPN`` and ``HPX`` projections).\n\"\"\"\n\nprjprm_n = \"\"\"\n*Read-only.* Intermediate integer value (used only for the ``ZPN`` and ``HPX`` projections).\n\"\"\"\n\nprjprm_set = \"\"\"\nThis method sets up a ``Prjprm`` object according to information supplied\nwithin it.\n\nNote that this routine need not be called directly; it will be invoked by\n`prjx2s` and `prjs2x` if ``Prjprm.flag`` is anything other than a predefined\nmagic value.\n\nThe one important property of ``set()`` is that the projection code must be\ndefined in the ``Prjprm`` in order for ``set()`` to identify the required\nprojection.\n\nRaises\n------\nMemoryError\n    Null ``prjprm`` pointer passed to WCSLIB routines.\n\nInvalidPrjParametersError\n    Invalid projection parameters.\n\nInvalidCoordinateError\n    One or more of the ``(x,y)`` or ``(lon,lat)`` coordinates were invalid.\n\"\"\"\n\nprjprm_prjx2s = r\"\"\"\nDeproject Cartesian ``(x,y)`` coordinates in the plane of projection to native\nspherical coordinates :math:`(\\phi,\\theta)`.\n\nThe projection is that specified by ``Prjprm.code``.\n\nParameters\n----------\nx, y : numpy.ndarray\n    Arrays corresponding to the first (``x``) and second (``y``) projected\n    coordinates.\n\nReturns\n-------\nphi, theta : tuple of numpy.ndarray\n    Longitude and latitude :math:`(\\phi,\\theta)` of the projected point in\n    native spherical coordinates (in degrees). Values corresponding to\n    invalid ``(x,y)`` coordinates are set to ``numpy.nan``.\n\nRaises\n------\nMemoryError\n    Null ``prjprm`` pointer passed to WCSLIB routines.\n\nInvalidPrjParametersError\n    Invalid projection parameters.\n\n\"\"\"\n\nprjprm_prjs2x = r\"\"\"\nProject native spherical coordinates :math:`(\\phi,\\theta)` to Cartesian\n``(x,y)`` coordinates in the plane of projection.\n\nThe projection is that specified by ``Prjprm.code``.\n\nParameters\n----------\nphi : numpy.ndarray\n    Array corresponding to the longitude :math:`\\phi` of the projected point\n    in native spherical coordinates (in degrees).\ntheta : numpy.ndarray\n    Array corresponding to the longitude :math:`\\theta` of the projected point\n    in native spherical coordinatess (in degrees). Values corresponding to\n    invalid :math:`(\\phi, \\theta)` coordinates are set to ``numpy.nan``.\n\nReturns\n-------\nx, y : tuple of numpy.ndarray\n    Projected coordinates.\n\nRaises\n------\nMemoryError\n    Null ``prjprm`` pointer passed to WCSLIB routines.\n\nInvalidPrjParametersError\n    Invalid projection parameters.\n\n\"\"\"\n\ncelfix = \"\"\"\nTranslates AIPS-convention celestial projection types, ``-NCP`` and\n``-GLS``.\n\nReturns\n-------\nsuccess : int\n    Returns ``0`` for success; ``-1`` if no change required.\n\"\"\"\n\ncname = \"\"\"\n``list of strings`` A list of the coordinate axis names, from\n``CNAMEia``.\n\"\"\"\n\ncolax = \"\"\"\n``int array[naxis]`` An array recording the column numbers for each\naxis in a pixel list.\n\"\"\"\n\ncolnum = \"\"\"\n``int`` Column of FITS binary table associated with this WCS.\n\nWhere the coordinate representation is associated with an image-array\ncolumn in a FITS binary table, this property may be used to record the\nrelevant column number.\n\nIt should be set to zero for an image header or pixel list.\n\"\"\"\n\ncompare = \"\"\"\ncompare(other, cmp=0, tolerance=0.0)\n\nCompare two Wcsprm objects for equality.\n\nParameters\n----------\n\nother : Wcsprm\n    The other Wcsprm object to compare to.\n\ncmp : int, optional\n    A bit field controlling the strictness of the comparison.  When 0,\n    (the default), all fields must be identical.\n\n    The following constants, defined in the `astropy.wcs` module,\n    may be or'ed together to loosen the comparison.\n\n    - ``WCSCOMPARE_ANCILLARY``: Ignores ancillary keywords that don't\n      change the WCS transformation, such as ``XPOSURE`` or\n      ``EQUINOX``. Note that this also ignores ``DATE-OBS``, which does\n      change the WCS transformation in some cases.\n\n    - ``WCSCOMPARE_TILING``: Ignore integral differences in\n      ``CRPIXja``.  This is the 'tiling' condition, where two WCSes\n      cover different regions of the same map projection and align on\n      the same map grid.\n\n    - ``WCSCOMPARE_CRPIX``: Ignore any differences at all in\n      ``CRPIXja``.  The two WCSes cover different regions of the same\n      map projection but may not align on the same grid map.\n      Overrides ``WCSCOMPARE_TILING``.\n\ntolerance : float, optional\n    The amount of tolerance required.  For example, for a value of\n    1e-6, all floating-point values in the objects must be equal to\n    the first 6 decimal places.  The default value of 0.0 implies\n    exact equality.\n\nReturns\n-------\nequal : bool\n\"\"\"\n\nconvert = \"\"\"\nconvert(array)\n\nPerform the unit conversion on the elements of the given *array*,\nreturning an array of the same shape.\n\"\"\"\n\ncoord = \"\"\"\n``double array[K_M]...[K_2][K_1][M]`` The tabular coordinate array.\n\nHas the dimensions::\n\n    (K_M, ... K_2, K_1, M)\n\n(see `~astropy.wcs.Tabprm.K`) i.e. with the `M` dimension\nvarying fastest so that the `M` elements of a coordinate vector are\nstored contiguously in memory.\n\"\"\"\n\ncopy = \"\"\"\nCreates a deep copy of the WCS object.\n\"\"\"\n\ncpdis1 = \"\"\"\n`~astropy.wcs.DistortionLookupTable`\n\nThe pre-linear transformation distortion lookup table, ``CPDIS1``.\n\"\"\"\n\ncpdis2 = \"\"\"\n`~astropy.wcs.DistortionLookupTable`\n\nThe pre-linear transformation distortion lookup table, ``CPDIS2``.\n\"\"\"\n\ncrder = \"\"\"\n``double array[naxis]`` The random error in each coordinate axis,\n``CRDERia``.\n\nAn undefined value is represented by NaN.\n\"\"\"\n\ncrln_obs = \"\"\"\n``double`` Carrington heliographic longitude of the observer (deg). If\nundefined, this is set to `None`.\n\"\"\"\n\ncrota = \"\"\"\n``double array[naxis]`` ``CROTAia`` keyvalues for each coordinate\naxis.\n\nFor historical compatibility, three alternate specifications of the\nlinear transformations are available in wcslib.  The canonical\n``PCi_ja`` with ``CDELTia``, ``CDi_ja``, and the deprecated\n``CROTAia`` keywords.  Although the latter may not formally co-exist\nwith ``PCi_ja``, the approach here is simply to ignore them if given\nin conjunction with ``PCi_ja``.\n\n`~astropy.wcs.Wcsprm.has_pc`, `~astropy.wcs.Wcsprm.has_cd` and\n`~astropy.wcs.Wcsprm.has_crota` can be used to determine which of\nthese alternatives are present in the header.\n\nThese alternate specifications of the linear transformation matrix are\ntranslated immediately to ``PCi_ja`` by `~astropy.wcs.Wcsprm.set` and\nare nowhere visible to the lower-level routines.  In particular,\n`~astropy.wcs.Wcsprm.set` resets `~astropy.wcs.Wcsprm.cdelt` to unity\nif ``CDi_ja`` is present (and no ``PCi_ja``).  If no ``CROTAia`` is\nassociated with the latitude axis, `~astropy.wcs.Wcsprm.set` reverts\nto a unity ``PCi_ja`` matrix.\n\"\"\"\n\ncrpix = \"\"\"\n``double array[naxis]`` Coordinate reference pixels (``CRPIXja``) for\neach pixel axis.\n\"\"\"\n\ncrval = \"\"\"\n``double array[naxis]`` Coordinate reference values (``CRVALia``) for\neach coordinate axis.\n\"\"\"\n\ncrval_tabprm = \"\"\"\n``double array[M]`` Index values for the reference pixel for each of\nthe tabular coord axes.\n\"\"\"\n\ncsyer = \"\"\"\n``double array[naxis]`` The systematic error in the coordinate value\naxes, ``CSYERia``.\n\nAn undefined value is represented by NaN.\n\"\"\"\n\nctype = \"\"\"\n``list of strings[naxis]`` List of ``CTYPEia`` keyvalues.\n\nThe `~astropy.wcs.Wcsprm.ctype` keyword values must be in upper case\nand there must be zero or one pair of matched celestial axis types,\nand zero or one spectral axis.\n\"\"\"\n\ncubeface = \"\"\"\n``int`` Index into the ``pixcrd`` (pixel coordinate) array for the\n``CUBEFACE`` axis.\n\nThis is used for quadcube projections where the cube faces are stored\non a separate axis.\n\nThe quadcube projections (``TSC``, ``CSC``, ``QSC``) may be\nrepresented in FITS in either of two ways:\n\n    - The six faces may be laid out in one plane and numbered as\n      follows::\n\n\n                                       0\n\n                              4  3  2  1  4  3  2\n\n                                       5\n\n      Faces 2, 3 and 4 may appear on one side or the other (or both).\n      The world-to-pixel routines map faces 2, 3 and 4 to the left but\n      the pixel-to-world routines accept them on either side.\n\n    - The ``COBE`` convention in which the six faces are stored in a\n      three-dimensional structure using a ``CUBEFACE`` axis indexed\n      from 0 to 5 as above.\n\nThese routines support both methods; `~astropy.wcs.Wcsprm.set`\ndetermines which is being used by the presence or absence of a\n``CUBEFACE`` axis in `~astropy.wcs.Wcsprm.ctype`.\n`~astropy.wcs.Wcsprm.p2s` and `~astropy.wcs.Wcsprm.s2p` translate the\n``CUBEFACE`` axis representation to the single plane representation\nunderstood by the lower-level projection routines.\n\"\"\"\n\ncunit = \"\"\"\n``list of astropy.UnitBase[naxis]`` List of ``CUNITia`` keyvalues as\n`astropy.units.UnitBase` instances.\n\nThese define the units of measurement of the ``CRVALia``, ``CDELTia``\nand ``CDi_ja`` keywords.\n\nAs ``CUNITia`` is an optional header keyword,\n`~astropy.wcs.Wcsprm.cunit` may be left blank but otherwise is\nexpected to contain a standard units specification as defined by WCS\nPaper I.  `~astropy.wcs.Wcsprm.unitfix` is available to translate\ncommonly used non-standard units specifications but this must be done\nas a separate step before invoking `~astropy.wcs.Wcsprm.set`.\n\nFor celestial axes, if `~astropy.wcs.Wcsprm.cunit` is not blank,\n`~astropy.wcs.Wcsprm.set` uses ``wcsunits`` to parse it and scale\n`~astropy.wcs.Wcsprm.cdelt`, `~astropy.wcs.Wcsprm.crval`, and\n`~astropy.wcs.Wcsprm.cd` to decimal degrees.  It then resets\n`~astropy.wcs.Wcsprm.cunit` to ``\"deg\"``.\n\nFor spectral axes, if `~astropy.wcs.Wcsprm.cunit` is not blank,\n`~astropy.wcs.Wcsprm.set` uses ``wcsunits`` to parse it and scale\n`~astropy.wcs.Wcsprm.cdelt`, `~astropy.wcs.Wcsprm.crval`, and\n`~astropy.wcs.Wcsprm.cd` to SI units.  It then resets\n`~astropy.wcs.Wcsprm.cunit` accordingly.\n\n`~astropy.wcs.Wcsprm.set` ignores `~astropy.wcs.Wcsprm.cunit` for\nother coordinate types; `~astropy.wcs.Wcsprm.cunit` may be used to\nlabel coordinate values.\n\"\"\"\n\ncylfix = \"\"\"\ncylfix()\n\nFixes WCS keyvalues for malformed cylindrical projections.\n\nReturns\n-------\nsuccess : int\n    Returns ``0`` for success; ``-1`` if no change required.\n\"\"\"\n\ndata = \"\"\"\n``float array`` The array data for the\n`~astropy.wcs.DistortionLookupTable`.\n\"\"\"\n\ndata_wtbarr = \"\"\"\n``double array``\n\nThe array data for the BINTABLE.\n\"\"\"\n\ndateavg = \"\"\"\n``string`` Representative mid-point of the date of observation.\n\nIn ISO format, ``yyyy-mm-ddThh:mm:ss``.\n\nSee also\n--------\nastropy.wcs.Wcsprm.dateobs\n\"\"\"\n\ndateobs = \"\"\"\n``string`` Start of the date of observation.\n\nIn ISO format, ``yyyy-mm-ddThh:mm:ss``.\n\nSee also\n--------\nastropy.wcs.Wcsprm.dateavg\n\"\"\"\n\ndatfix = \"\"\"\ndatfix()\n\nTranslates the old ``DATE-OBS`` date format to year-2000 standard form\n``(yyyy-mm-ddThh:mm:ss)`` and derives ``MJD-OBS`` from it if not\nalready set.\n\nAlternatively, if `~astropy.wcs.Wcsprm.mjdobs` is set and\n`~astropy.wcs.Wcsprm.dateobs` isn't, then `~astropy.wcs.Wcsprm.datfix`\nderives `~astropy.wcs.Wcsprm.dateobs` from it.  If both are set but\ndisagree by more than half a day then `ValueError` is raised.\n\nReturns\n-------\nsuccess : int\n    Returns ``0`` for success; ``-1`` if no change required.\n\"\"\"\n\ndelta = \"\"\"\n``double array[M]`` (read-only) Interpolated indices into the coord\narray.\n\nArray of interpolated indices into the coordinate array such that\nUpsilon_m, as defined in Paper III, is equal to\n(`~astropy.wcs.Tabprm.p0` [m] + 1) + delta[m].\n\"\"\"\n\ndet2im = \"\"\"\nConvert detector coordinates to image plane coordinates.\n\"\"\"\n\ndet2im1 = \"\"\"\nA `~astropy.wcs.DistortionLookupTable` object for detector to image plane\ncorrection in the *x*-axis.\n\"\"\"\n\ndet2im2 = \"\"\"\nA `~astropy.wcs.DistortionLookupTable` object for detector to image plane\ncorrection in the *y*-axis.\n\"\"\"\n\ndims = \"\"\"\n``int array[ndim]`` (read-only)\n\nThe dimensions of the tabular array\n`~astropy.wcs.Wtbarr.data`.\n\"\"\"\n\nDistortionLookupTable = \"\"\"\nDistortionLookupTable(*table*, *crpix*, *crval*, *cdelt*)\n\nRepresents a single lookup table for a `distortion paper`_\ntransformation.\n\nParameters\n----------\ntable : 2-dimensional array\n    The distortion lookup table.\n\ncrpix : 2-tuple\n    The distortion array reference pixel\n\ncrval : 2-tuple\n    The image array pixel coordinate\n\ncdelt : 2-tuple\n    The grid step size\n\"\"\"\n\ndsun_obs = \"\"\"\n``double`` Distance between the centre of the Sun and the observer (m). If\nundefined, this is set to `None`.\n\"\"\"\n\nequinox = \"\"\"\n``double`` The equinox associated with dynamical equatorial or\necliptic coordinate systems.\n\n``EQUINOXa`` (or ``EPOCH`` in older headers).  Not applicable to ICRS\nequatorial or ecliptic coordinates.\n\nAn undefined value is represented by NaN.\n\"\"\"\n\nextlev = \"\"\"\n``int`` (read-only) ``EXTLEV`` identifying the binary table extension.\n\"\"\"\n\nextnam = \"\"\"\n``str`` (read-only) ``EXTNAME`` identifying the binary table extension.\n\"\"\"\n\nextrema = \"\"\"\n``double array[K_M]...[K_2][2][M]`` (read-only)\n\nAn array recording the minimum and maximum value of each element of\nthe coordinate vector in each row of the coordinate array, with the\ndimensions::\n\n    (K_M, ... K_2, 2, M)\n\n(see `~astropy.wcs.Tabprm.K`).  The minimum is recorded\nin the first element of the compressed K_1 dimension, then the\nmaximum.  This array is used by the inverse table lookup function to\nspeed up table searches.\n\"\"\"\n\nextver = \"\"\"\n``int`` (read-only) ``EXTVER`` identifying the binary table extension.\n\"\"\"\n\nfind_all_wcs = \"\"\"\nfind_all_wcs(relax=0, keysel=0)\n\nFind all WCS transformations in the header.\n\nParameters\n----------\n\nheader : str\n    The raw FITS header data.\n\nrelax : bool or int\n    Degree of permissiveness:\n\n    - `False`: Recognize only FITS keywords defined by the published\n      WCS standard.\n\n    - `True`: Admit all recognized informal extensions of the WCS\n      standard.\n\n    - `int`: a bit field selecting specific extensions to accept.  See\n      :ref:`astropy:relaxread` for details.\n\nkeysel : sequence of flags\n    Used to restrict the keyword types considered:\n\n    - ``WCSHDR_IMGHEAD``: Image header keywords.\n\n    - ``WCSHDR_BIMGARR``: Binary table image array.\n\n    - ``WCSHDR_PIXLIST``: Pixel list keywords.\n\n    If zero, there is no restriction.  If -1, `wcspih` is called,\n    rather than `wcstbh`.\n\nReturns\n-------\nwcs_list : list of `~astropy.wcs.Wcsprm`\n\"\"\"\n\nfix = \"\"\"\nfix(translate_units='', naxis=0)\n\nApplies all of the corrections handled separately by\n`~astropy.wcs.Wcsprm.datfix`, `~astropy.wcs.Wcsprm.unitfix`,\n`~astropy.wcs.Wcsprm.celfix`, `~astropy.wcs.Wcsprm.spcfix`,\n`~astropy.wcs.Wcsprm.cylfix` and `~astropy.wcs.Wcsprm.cdfix`.\n\nParameters\n----------\n\ntranslate_units : str, optional\n    Specify which potentially unsafe translations of non-standard unit\n    strings to perform.  By default, performs all.\n\n    Although ``\"S\"`` is commonly used to represent seconds, its\n    translation to ``\"s\"`` is potentially unsafe since the standard\n    recognizes ``\"S\"`` formally as Siemens, however rarely that may be\n    used.  The same applies to ``\"H\"`` for hours (Henry), and ``\"D\"``\n    for days (Debye).\n\n    This string controls what to do in such cases, and is\n    case-insensitive.\n\n    - If the string contains ``\"s\"``, translate ``\"S\"`` to ``\"s\"``.\n\n    - If the string contains ``\"h\"``, translate ``\"H\"`` to ``\"h\"``.\n\n    - If the string contains ``\"d\"``, translate ``\"D\"`` to ``\"d\"``.\n\n    Thus ``''`` doesn't do any unsafe translations, whereas ``'shd'``\n    does all of them.\n\nnaxis : int array, optional\n    Image axis lengths.  If this array is set to zero or ``None``,\n    then `~astropy.wcs.Wcsprm.cylfix` will not be invoked.\n\nReturns\n-------\nstatus : dict\n\n    Returns a dictionary containing the following keys, each referring\n    to a status string for each of the sub-fix functions that were\n    called:\n\n    - `~astropy.wcs.Wcsprm.cdfix`\n\n    - `~astropy.wcs.Wcsprm.datfix`\n\n    - `~astropy.wcs.Wcsprm.unitfix`\n\n    - `~astropy.wcs.Wcsprm.celfix`\n\n    - `~astropy.wcs.Wcsprm.spcfix`\n\n    - `~astropy.wcs.Wcsprm.cylfix`\n\"\"\"\n\nget_offset = \"\"\"\nget_offset(x, y) -> (x, y)\n\nReturns the offset as defined in the distortion lookup table.\n\nReturns\n-------\ncoordinate : (2,) tuple\n    The offset from the distortion table for pixel point (*x*, *y*).\n\"\"\"\n\nget_cdelt = \"\"\"\nget_cdelt() -> numpy.ndarray\n\nCoordinate increments (``CDELTia``) for each coord axis as ``double array[naxis]``.\n\nReturns the ``CDELT`` offsets in read-only form.  Unlike the\n`~astropy.wcs.Wcsprm.cdelt` property, this works even when the header\nspecifies the linear transformation matrix in one of the alternative\n``CDi_ja`` or ``CROTAia`` forms.  This is useful when you want access\nto the linear transformation matrix, but don't care how it was\nspecified in the header.\n\"\"\"\n\nget_pc = \"\"\"\nget_pc() -> numpy.ndarray\n\nReturns the ``PC`` matrix in read-only form as ``double array[naxis][naxis]``.  Unlike the\n`~astropy.wcs.Wcsprm.pc` property, this works even when the header\nspecifies the linear transformation matrix in one of the alternative\n``CDi_ja`` or ``CROTAia`` forms.  This is useful when you want access\nto the linear transformation matrix, but don't care how it was\nspecified in the header.\n\"\"\"\n\nget_ps = \"\"\"\nget_ps() -> list\n\nReturns ``PSi_ma`` keywords for each *i* and *m* as list of tuples.\n\nReturns\n-------\nps : list\n\n    Returned as a list of tuples of the form (*i*, *m*, *value*):\n\n    - *i*: int.  Axis number, as in ``PSi_ma``, (i.e. 1-relative)\n\n    - *m*: int.  Parameter number, as in ``PSi_ma``, (i.e. 0-relative)\n\n    - *value*: string.  Parameter value.\n\nSee also\n--------\nastropy.wcs.Wcsprm.set_ps : Set ``PSi_ma`` values\n\"\"\"\n\nget_pv = \"\"\"\nget_pv() -> list\n\nReturns ``PVi_ma`` keywords for each *i* and *m* as list of tuples.\n\nReturns\n-------\nsequence of tuple\n    Returned as a list of tuples of the form (*i*, *m*, *value*):\n\n    - *i*: int.  Axis number, as in ``PVi_ma``, (i.e. 1-relative)\n\n    - *m*: int.  Parameter number, as in ``PVi_ma``, (i.e. 0-relative)\n\n    - *value*: string. Parameter value.\n\nSee also\n--------\nastropy.wcs.Wcsprm.set_pv : Set ``PVi_ma`` values\n\nNotes\n-----\n\nNote that, if they were not given, `~astropy.wcs.Wcsprm.set` resets\nthe entries for ``PVi_1a``, ``PVi_2a``, ``PVi_3a``, and ``PVi_4a`` for\nlongitude axis *i* to match (``phi_0``, ``theta_0``), the native\nlongitude and latitude of the reference point given by ``LONPOLEa``\nand ``LATPOLEa``.\n\"\"\"\n\nhas_cd = \"\"\"\nhas_cd() -> bool\n\nReturns `True` if ``CDi_ja`` is present.\n\n``CDi_ja`` is an alternate specification of the linear transformation\nmatrix, maintained for historical compatibility.\n\nMatrix elements in the IRAF convention are equivalent to the product\n``CDi_ja = CDELTia * PCi_ja``, but the defaults differ from that of\nthe ``PCi_ja`` matrix.  If one or more ``CDi_ja`` keywords are present\nthen all unspecified ``CDi_ja`` default to zero.  If no ``CDi_ja`` (or\n``CROTAia``) keywords are present, then the header is assumed to be in\n``PCi_ja`` form whether or not any ``PCi_ja`` keywords are present\nsince this results in an interpretation of ``CDELTia`` consistent with\nthe original FITS specification.\n\nWhile ``CDi_ja`` may not formally co-exist with ``PCi_ja``, it may\nco-exist with ``CDELTia`` and ``CROTAia`` which are to be ignored.\n\nSee also\n--------\nastropy.wcs.Wcsprm.cd : Get the raw ``CDi_ja`` values.\n\"\"\"\n\nhas_cdi_ja = \"\"\"\nhas_cdi_ja() -> bool\n\nAlias for `~astropy.wcs.Wcsprm.has_cd`.  Maintained for backward\ncompatibility.\n\"\"\"\n\nhas_crota = \"\"\"\nhas_crota() -> bool\n\nReturns `True` if ``CROTAia`` is present.\n\n``CROTAia`` is an alternate specification of the linear transformation\nmatrix, maintained for historical compatibility.\n\nIn the AIPS convention, ``CROTAia`` may only be associated with the\nlatitude axis of a celestial axis pair.  It specifies a rotation in\nthe image plane that is applied *after* the ``CDELTia``; any other\n``CROTAia`` keywords are ignored.\n\n``CROTAia`` may not formally co-exist with ``PCi_ja``.  ``CROTAia`` and\n``CDELTia`` may formally co-exist with ``CDi_ja`` but if so are to be\nignored.\n\nSee also\n--------\nastropy.wcs.Wcsprm.crota : Get the raw ``CROTAia`` values\n\"\"\"\n\nhas_crotaia = \"\"\"\nhas_crotaia() -> bool\n\nAlias for `~astropy.wcs.Wcsprm.has_crota`.  Maintained for backward\ncompatibility.\n\"\"\"\n\nhas_pc = \"\"\"\nhas_pc() -> bool\n\nReturns `True` if ``PCi_ja`` is present.  ``PCi_ja`` is the\nrecommended way to specify the linear transformation matrix.\n\nSee also\n--------\nastropy.wcs.Wcsprm.pc : Get the raw ``PCi_ja`` values\n\"\"\"\n\nhas_pci_ja = \"\"\"\nhas_pci_ja() -> bool\n\nAlias for `~astropy.wcs.Wcsprm.has_pc`.  Maintained for backward\ncompatibility.\n\"\"\"\n\nhgln_obs = \"\"\"\n``double`` Stonyhurst heliographic longitude of the observer. If\nundefined, this is set to `None`.\n\"\"\"\n\nhglt_obs = \"\"\"\n``double``  Heliographic latitude (Carrington or Stonyhurst) of the observer\n(deg). If undefined, this is set to `None`.\n\"\"\"\n\ni = \"\"\"\n``int`` (read-only) Image axis number.\n\"\"\"\n\nimgpix_matrix = \"\"\"\n``double array[2][2]`` (read-only) Inverse of the ``CDELT`` or ``PC``\nmatrix.\n\nInverse containing the product of the ``CDELTia`` diagonal matrix and\nthe ``PCi_ja`` matrix.\n\"\"\"\n\nis_unity = \"\"\"\nis_unity() -> bool\n\nReturns `True` if the linear transformation matrix\n(`~astropy.wcs.Wcsprm.cd`) is unity.\n\"\"\"\n\nK = \"\"\"\n``int array[M]`` (read-only) The lengths of the axes of the coordinate\narray.\n\nAn array of length `M` whose elements record the lengths of the axes of\nthe coordinate array and of each indexing vector.\n\"\"\"\n\nkind = \"\"\"\n``str`` (read-only) ``wcstab`` array type.\n\nCharacter identifying the ``wcstab`` array type:\n\n    - ``'c'``: coordinate array,\n    - ``'i'``: index vector.\n\"\"\"\n\nlat = \"\"\"\n``int`` (read-only) The index into the world coord array containing\nlatitude values.\n\"\"\"\n\nlatpole = \"\"\"\n``double`` The native latitude of the celestial pole, ``LATPOLEa`` (deg).\n\"\"\"\n\nlattyp = \"\"\"\n``string`` (read-only) Celestial axis type for latitude.\n\nFor example, \"RA\", \"DEC\", \"GLON\", \"GLAT\", etc. extracted from \"RA--\",\n\"DEC-\", \"GLON\", \"GLAT\", etc. in the first four characters of\n``CTYPEia`` but with trailing dashes removed.\n\"\"\"\n\nlng = \"\"\"\n``int`` (read-only) The index into the world coord array containing\nlongitude values.\n\"\"\"\n\nlngtyp = \"\"\"\n``string`` (read-only) Celestial axis type for longitude.\n\nFor example, \"RA\", \"DEC\", \"GLON\", \"GLAT\", etc. extracted from \"RA--\",\n\"DEC-\", \"GLON\", \"GLAT\", etc. in the first four characters of\n``CTYPEia`` but with trailing dashes removed.\n\"\"\"\n\nlonpole = \"\"\"\n``double`` The native longitude of the celestial pole.\n\n``LONPOLEa`` (deg).\n\"\"\"\n\nM = \"\"\"\n``int`` (read-only) Number of tabular coordinate axes.\n\"\"\"\n\nm = \"\"\"\n``int`` (read-only) ``wcstab`` axis number for index vectors.\n\"\"\"\n\nmap = \"\"\"\n``int array[M]`` Association between axes.\n\nA vector of length `~astropy.wcs.Tabprm.M` that defines\nthe association between axis *m* in the *M*-dimensional coordinate\narray (1 <= *m* <= *M*) and the indices of the intermediate world\ncoordinate and world coordinate arrays.\n\nWhen the intermediate and world coordinate arrays contain the full\ncomplement of coordinate elements in image-order, as will usually be\nthe case, then ``map[m-1] == i-1`` for axis *i* in the *N*-dimensional\nimage (1 <= *i* <= *N*).  In terms of the FITS keywords::\n\n    map[PVi_3a - 1] == i - 1.\n\nHowever, a different association may result if the intermediate\ncoordinates, for example, only contains a (relevant) subset of\nintermediate world coordinate elements.  For example, if *M* == 1 for\nan image with *N* > 1, it is possible to fill the intermediate\ncoordinates with the relevant coordinate element with ``nelem`` set to\n1.  In this case ``map[0] = 0`` regardless of the value of *i*.\n\"\"\"\n\nmix = \"\"\"\nmix(mixpix, mixcel, vspan, vstep, viter, world, pixcrd, origin)\n\nGiven either the celestial longitude or latitude plus an element of\nthe pixel coordinate, solves for the remaining elements by iterating\non the unknown celestial coordinate element using\n`~astropy.wcs.Wcsprm.s2p`.\n\nParameters\n----------\nmixpix : int\n    Which element on the pixel coordinate is given.\n\nmixcel : int\n    Which element of the celestial coordinate is given. If *mixcel* =\n    ``1``, celestial longitude is given in ``world[self.lng]``,\n    latitude returned in ``world[self.lat]``.  If *mixcel* = ``2``,\n    celestial latitude is given in ``world[self.lat]``, longitude\n    returned in ``world[self.lng]``.\n\nvspan : (float, float)\n    Solution interval for the celestial coordinate, in degrees.  The\n    ordering of the two limits is irrelevant.  Longitude ranges may be\n    specified with any convenient normalization, for example\n    ``(-120,+120)`` is the same as ``(240,480)``, except that the\n    solution will be returned with the same normalization, i.e. lie\n    within the interval specified.\n\nvstep : float\n    Step size for solution search, in degrees.  If ``0``, a sensible,\n    although perhaps non-optimal default will be used.\n\nviter : int\n    If a solution is not found then the step size will be halved and\n    the search recommenced.  *viter* controls how many times the step\n    size is halved.  The allowed range is 5 - 10.\n\nworld : ndarray\n    World coordinate elements as ``double array[naxis]``.  ``world[self.lng]`` and\n    ``world[self.lat]`` are the celestial longitude and latitude, in\n    degrees.  Which is given and which returned depends on the value\n    of *mixcel*.  All other elements are given.  The results will be\n    written to this array in-place.\n\npixcrd : ndarray\n    Pixel coordinates as ``double array[naxis]``.  The element indicated by *mixpix* is given and\n    the remaining elements will be written in-place.\n\n{}\n\nReturns\n-------\nresult : dict\n\n    Returns a dictionary with the following keys:\n\n    - *phi* (``double array[naxis]``)\n\n    - *theta* (``double array[naxis]``)\n\n        - Longitude and latitude in the native coordinate system of\n          the projection, in degrees.\n\n    - *imgcrd* (``double array[naxis]``)\n\n        - Image coordinate elements.  ``imgcrd[self.lng]`` and\n          ``imgcrd[self.lat]`` are the projected *x*- and\n          *y*-coordinates, in decimal degrees.\n\n    - *world* (``double array[naxis]``)\n\n        - Another reference to the *world* argument passed in.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nSingularMatrixError\n    Linear transformation matrix is singular.\n\nInconsistentAxisTypesError\n    Inconsistent or unrecognized coordinate axis types.\n\nValueError\n    Invalid parameter value.\n\nInvalidTransformError\n    Invalid coordinate transformation parameters.\n\nInvalidTransformError\n    Ill-conditioned coordinate transformation parameters.\n\nInvalidCoordinateError\n    Invalid world coordinate.\n\nNoSolutionError\n    No solution found in the specified interval.\n\nSee also\n--------\nastropy.wcs.Wcsprm.lat, astropy.wcs.Wcsprm.lng\n    Get the axes numbers for latitude and longitude\n\nNotes\n-----\n\nInitially, the specified solution interval is checked to see if it's a\n\\\"crossing\\\" interval.  If it isn't, a search is made for a crossing\nsolution by iterating on the unknown celestial coordinate starting at\nthe upper limit of the solution interval and decrementing by the\nspecified step size.  A crossing is indicated if the trial value of\nthe pixel coordinate steps through the value specified.  If a crossing\ninterval is found then the solution is determined by a modified form\nof \\\"regula falsi\\\" division of the crossing interval.  If no crossing\ninterval was found within the specified solution interval then a\nsearch is made for a \\\"non-crossing\\\" solution as may arise from a\npoint of tangency.  The process is complicated by having to make\nallowance for the discontinuities that occur in all map projections.\n\nOnce one solution has been determined others may be found by\nsubsequent invocations of `~astropy.wcs.Wcsprm.mix` with suitably\nrestricted solution intervals.\n\nNote the circumstance that arises when the solution point lies at a\nnative pole of a projection in which the pole is represented as a\nfinite curve, for example the zenithals and conics.  In such cases two\nor more valid solutions may exist but `~astropy.wcs.Wcsprm.mix` only\never returns one.\n\nBecause of its generality, `~astropy.wcs.Wcsprm.mix` is very\ncompute-intensive.  For compute-limited applications, more efficient\nspecial-case solvers could be written for simple projections, for\nexample non-oblique cylindrical projections.\n\"\"\".format(ORIGIN())\n\nmjdavg = \"\"\"\n``double`` Modified Julian Date corresponding to ``DATE-AVG``.\n\n``(MJD = JD - 2400000.5)``.\n\nAn undefined value is represented by NaN.\n\nSee also\n--------\nastropy.wcs.Wcsprm.mjdobs\n\"\"\"\n\nmjdobs = \"\"\"\n``double`` Modified Julian Date corresponding to ``DATE-OBS``.\n\n``(MJD = JD - 2400000.5)``.\n\nAn undefined value is represented by NaN.\n\nSee also\n--------\nastropy.wcs.Wcsprm.mjdavg\n\"\"\"\n\nname = \"\"\"\n``string`` The name given to the coordinate representation\n``WCSNAMEa``.\n\"\"\"\n\nnaxis = \"\"\"\n``int`` (read-only) The number of axes (pixel and coordinate).\n\nGiven by the ``NAXIS`` or ``WCSAXESa`` keyvalues.\n\nThe number of coordinate axes is determined at parsing time, and can\nnot be subsequently changed.\n\nIt is determined from the highest of the following:\n\n  1. ``NAXIS``\n\n  2. ``WCSAXESa``\n\n  3. The highest axis number in any parameterized WCS keyword.  The\n     keyvalue, as well as the keyword, must be syntactically valid\n     otherwise it will not be considered.\n\nIf none of these keyword types is present, i.e. if the header only\ncontains auxiliary WCS keywords for a particular coordinate\nrepresentation, then no coordinate description is constructed for it.\n\nThis value may differ for different coordinate representations of the\nsame image.\n\"\"\"\n\nnc = \"\"\"\n``int`` (read-only) Total number of coord vectors in the coord array.\n\nTotal number of coordinate vectors in the coordinate array being the\nproduct K_1 * K_2 * ... * K_M.\n\"\"\"\n\nndim = \"\"\"\n``int`` (read-only) Expected dimensionality of the ``wcstab`` array.\n\"\"\"\n\nobsgeo = \"\"\"\n``double array[3]`` Location of the observer in a standard terrestrial\nreference frame.\n\n``OBSGEO-X``, ``OBSGEO-Y``, ``OBSGEO-Z`` (in meters).\n\nAn undefined value is represented by NaN.\n\"\"\"\n\np0 = \"\"\"\n``int array[M]`` Interpolated indices into the coordinate array.\n\nVector of length `~astropy.wcs.Tabprm.M` of interpolated\nindices into the coordinate array such that Upsilon_m, as defined in\nPaper III, is equal to ``(p0[m] + 1) + delta[m]``.\n\"\"\"\n\np2s = \"\"\"\np2s(pixcrd, origin)\n\nConverts pixel to world coordinates.\n\nParameters\n----------\n\npixcrd : ndarray\n    Array of pixel coordinates as ``double array[ncoord][nelem]``.\n\n{}\n\nReturns\n-------\nresult : dict\n    Returns a dictionary with the following keys:\n\n    - *imgcrd*: ndarray\n\n      - Array of intermediate world coordinates as ``double array[ncoord][nelem]``.  For celestial axes,\n        ``imgcrd[][self.lng]`` and ``imgcrd[][self.lat]`` are the\n        projected *x*-, and *y*-coordinates, in pseudo degrees.  For\n        spectral axes, ``imgcrd[][self.spec]`` is the intermediate\n        spectral coordinate, in SI units.\n\n    - *phi*: ndarray\n\n      - Array as ``double array[ncoord]``.\n\n    - *theta*: ndarray\n\n      - Longitude and latitude in the native coordinate system of the\n        projection, in degrees, as ``double array[ncoord]``.\n\n    - *world*: ndarray\n\n      - Array of world coordinates as ``double array[ncoord][nelem]``.  For celestial axes,\n        ``world[][self.lng]`` and ``world[][self.lat]`` are the\n        celestial longitude and latitude, in degrees.  For spectral\n        axes, ``world[][self.spec]`` is the intermediate spectral\n        coordinate, in SI units.\n\n    - *stat*: ndarray\n\n      - Status return value for each coordinate as ``int array[ncoord]``. ``0`` for success,\n        ``1+`` for invalid pixel coordinate.\n\nRaises\n------\n\nMemoryError\n    Memory allocation failed.\n\nSingularMatrixError\n    Linear transformation matrix is singular.\n\nInconsistentAxisTypesError\n    Inconsistent or unrecognized coordinate axis types.\n\nValueError\n    Invalid parameter value.\n\nValueError\n    *x*- and *y*-coordinate arrays are not the same size.\n\nInvalidTransformError\n    Invalid coordinate transformation parameters.\n\nInvalidTransformError\n    Ill-conditioned coordinate transformation parameters.\n\nSee also\n--------\nastropy.wcs.Wcsprm.lat, astropy.wcs.Wcsprm.lng\n    Definition of the latitude and longitude axes\n\"\"\".format(ORIGIN())\n\np4_pix2foc = \"\"\"\np4_pix2foc(*pixcrd, origin*) -> ``double array[ncoord][nelem]``\n\nConvert pixel coordinates to focal plane coordinates using `distortion\npaper`_ lookup-table correction.\n\nParameters\n----------\npixcrd : ndarray\n    Array of pixel coordinates as ``double array[ncoord][nelem]``.\n\n{}\n\nReturns\n-------\nfoccrd : ndarray\n    Returns an array of focal plane coordinates as ``double array[ncoord][nelem]``.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nValueError\n    Invalid coordinate transformation parameters.\n\"\"\".format(ORIGIN())\n\npc = \"\"\"\n``double array[naxis][naxis]`` The ``PCi_ja`` (pixel coordinate)\ntransformation matrix.\n\nThe order is::\n\n  [[PC1_1, PC1_2],\n   [PC2_1, PC2_2]]\n\nFor historical compatibility, three alternate specifications of the\nlinear transformations are available in wcslib.  The canonical\n``PCi_ja`` with ``CDELTia``, ``CDi_ja``, and the deprecated\n``CROTAia`` keywords.  Although the latter may not formally co-exist\nwith ``PCi_ja``, the approach here is simply to ignore them if given\nin conjunction with ``PCi_ja``.\n\n`~astropy.wcs.Wcsprm.has_pc`, `~astropy.wcs.Wcsprm.has_cd` and\n`~astropy.wcs.Wcsprm.has_crota` can be used to determine which of\nthese alternatives are present in the header.\n\nThese alternate specifications of the linear transformation matrix are\ntranslated immediately to ``PCi_ja`` by `~astropy.wcs.Wcsprm.set` and\nare nowhere visible to the lower-level routines.  In particular,\n`~astropy.wcs.Wcsprm.set` resets `~astropy.wcs.Wcsprm.cdelt` to unity\nif ``CDi_ja`` is present (and no ``PCi_ja``).  If no ``CROTAia`` is\nassociated with the latitude axis, `~astropy.wcs.Wcsprm.set` reverts\nto a unity ``PCi_ja`` matrix.\n\"\"\"\n\nphi0 = \"\"\"\n``double`` The native latitude of the fiducial point.\n\nThe point whose celestial coordinates are given in ``ref[1:2]``.  If\nundefined (NaN) the initialization routine, `~astropy.wcs.Wcsprm.set`,\nwill set this to a projection-specific default.\n\nSee also\n--------\nastropy.wcs.Wcsprm.theta0\n\"\"\"\n\npix2foc = \"\"\"\npix2foc(*pixcrd, origin*) -> ``double array[ncoord][nelem]``\n\nPerform both `SIP`_ polynomial and `distortion paper`_ lookup-table\ncorrection in parallel.\n\nParameters\n----------\npixcrd : ndarray\n    Array of pixel coordinates as ``double array[ncoord][nelem]``.\n\n{}\n\nReturns\n-------\nfoccrd : ndarray\n    Returns an array of focal plane coordinates as ``double array[ncoord][nelem]``.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nValueError\n    Invalid coordinate transformation parameters.\n\"\"\".format(ORIGIN())\n\npiximg_matrix = \"\"\"\n``double array[2][2]`` (read-only) Matrix containing the product of\nthe ``CDELTia`` diagonal matrix and the ``PCi_ja`` matrix.\n\"\"\"\n\nprint_contents = \"\"\"\nprint_contents()\n\nPrint the contents of the `~astropy.wcs.Wcsprm` object to stdout.\nProbably only useful for debugging purposes, and may be removed in the\nfuture.\n\nTo get a string of the contents, use `repr`.\n\"\"\"\n\nprint_contents_tabprm = \"\"\"\nprint_contents()\n\nPrint the contents of the `~astropy.wcs.Tabprm` object to\nstdout.  Probably only useful for debugging purposes, and may be\nremoved in the future.\n\nTo get a string of the contents, use `repr`.\n\"\"\"\n\nprint_contents_wtbarr = \"\"\"\nprint_contents()\n\nPrint the contents of the `~astropy.wcs.Wtbarr` object to\nstdout. Probably only useful for debugging purposes, and may be\nremoved in the future.\n\nTo get a string of the contents, use `repr`.\n\"\"\"\n\nradesys = \"\"\"\n``string`` The equatorial or ecliptic coordinate system type,\n``RADESYSa``.\n\"\"\"\n\nrestfrq = \"\"\"\n``double`` Rest frequency (Hz) from ``RESTFRQa``.\n\nAn undefined value is represented by NaN.\n\"\"\"\n\nrestwav = \"\"\"\n``double`` Rest wavelength (m) from ``RESTWAVa``.\n\nAn undefined value is represented by NaN.\n\"\"\"\n\nrow = \"\"\"\n``int`` (read-only) Table row number.\n\"\"\"\n\nrsun_ref = \"\"\"\n``double`` Reference radius of the Sun used in coordinate calculations (m).\nIf undefined, this is set to `None`.\n\"\"\"\n\ns2p = \"\"\"\ns2p(world, origin)\n\nTransforms world coordinates to pixel coordinates.\n\nParameters\n----------\nworld : ndarray\n    Array of world coordinates, in decimal degrees, as ``double array[ncoord][nelem]``.\n\n{}\n\nReturns\n-------\nresult : dict\n    Returns a dictionary with the following keys:\n\n    - *phi*: ``double array[ncoord]``\n\n    - *theta*: ``double array[ncoord]``\n\n        - Longitude and latitude in the native coordinate system of\n          the projection, in degrees.\n\n    - *imgcrd*: ``double array[ncoord][nelem]``\n\n       - Array of intermediate world coordinates.  For celestial axes,\n         ``imgcrd[][self.lng]`` and ``imgcrd[][self.lat]`` are the\n         projected *x*-, and *y*-coordinates, in pseudo \\\"degrees\\\".\n         For quadcube projections with a ``CUBEFACE`` axis, the face\n         number is also returned in ``imgcrd[][self.cubeface]``.  For\n         spectral axes, ``imgcrd[][self.spec]`` is the intermediate\n         spectral coordinate, in SI units.\n\n    - *pixcrd*: ``double array[ncoord][nelem]``\n\n        - Array of pixel coordinates.  Pixel coordinates are\n          zero-based.\n\n    - *stat*: ``int array[ncoord]``\n\n        - Status return value for each coordinate. ``0`` for success,\n          ``1+`` for invalid pixel coordinate.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nSingularMatrixError\n    Linear transformation matrix is singular.\n\nInconsistentAxisTypesError\n    Inconsistent or unrecognized coordinate axis types.\n\nValueError\n    Invalid parameter value.\n\nInvalidTransformError\n   Invalid coordinate transformation parameters.\n\nInvalidTransformError\n    Ill-conditioned coordinate transformation parameters.\n\nSee also\n--------\nastropy.wcs.Wcsprm.lat, astropy.wcs.Wcsprm.lng\n    Definition of the latitude and longitude axes\n\"\"\".format(ORIGIN())\n\nsense = \"\"\"\n``int array[M]`` +1 if monotonically increasing, -1 if decreasing.\n\nA vector of length `~astropy.wcs.Tabprm.M` whose elements\nindicate whether the corresponding indexing vector is monotonically\nincreasing (+1), or decreasing (-1).\n\"\"\"\n\nset = \"\"\"\nset()\n\nSets up a WCS object for use according to information supplied within\nit.\n\nNote that this routine need not be called directly; it will be invoked\nby `~astropy.wcs.Wcsprm.p2s` and `~astropy.wcs.Wcsprm.s2p` if\nnecessary.\n\nSome attributes that are based on other attributes (such as\n`~astropy.wcs.Wcsprm.lattyp` on `~astropy.wcs.Wcsprm.ctype`) may not\nbe correct until after `~astropy.wcs.Wcsprm.set` is called.\n\n`~astropy.wcs.Wcsprm.set` strips off trailing blanks in all string\nmembers.\n\n`~astropy.wcs.Wcsprm.set` recognizes the ``NCP`` projection and\nconverts it to the equivalent ``SIN`` projection and it also\nrecognizes ``GLS`` as a synonym for ``SFL``.  It does alias\ntranslation for the AIPS spectral types (``FREQ-LSR``, ``FELO-HEL``,\netc.) but without changing the input header keywords.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nSingularMatrixError\n    Linear transformation matrix is singular.\n\nInconsistentAxisTypesError\n    Inconsistent or unrecognized coordinate axis types.\n\nValueError\n    Invalid parameter value.\n\nInvalidTransformError\n    Invalid coordinate transformation parameters.\n\nInvalidTransformError\n    Ill-conditioned coordinate transformation parameters.\n\"\"\"\n\nset_tabprm = \"\"\"\nset()\n\nAllocates memory for work arrays.\n\nAlso sets up the class according to information supplied within it.\n\nNote that this routine need not be called directly; it will be invoked\nby functions that need it.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nInvalidTabularParametersError\n    Invalid tabular parameters.\n\"\"\"\n\nset_celprm = \"\"\"\nset()\n\nSets up a ``celprm`` struct according to information supplied within it.\n\nNote that this routine need not be called directly; it will be invoked\nby functions that need it.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nInvalidPrjParametersError\n    Invalid celestial parameters.\n\"\"\"\n\nset_ps = \"\"\"\nset_ps(ps)\n\nSets ``PSi_ma`` keywords for each *i* and *m*.\n\nParameters\n----------\nps : sequence of tuple\n\n    The input must be a sequence of tuples of the form (*i*, *m*,\n    *value*):\n\n    - *i*: int.  Axis number, as in ``PSi_ma``, (i.e. 1-relative)\n\n    - *m*: int.  Parameter number, as in ``PSi_ma``, (i.e. 0-relative)\n\n    - *value*: string.  Parameter value.\n\nSee also\n--------\nastropy.wcs.Wcsprm.get_ps\n\"\"\"\n\nset_pv = \"\"\"\nset_pv(pv)\n\nSets ``PVi_ma`` keywords for each *i* and *m*.\n\nParameters\n----------\npv : list of tuple\n\n    The input must be a sequence of tuples of the form (*i*, *m*,\n    *value*):\n\n    - *i*: int.  Axis number, as in ``PVi_ma``, (i.e. 1-relative)\n\n    - *m*: int.  Parameter number, as in ``PVi_ma``, (i.e. 0-relative)\n\n    - *value*: float.  Parameter value.\n\nSee also\n--------\nastropy.wcs.Wcsprm.get_pv\n\"\"\"\n\nsip = \"\"\"\nGet/set the `~astropy.wcs.Sip` object for performing `SIP`_ distortion\ncorrection.\n\"\"\"\n\nSip = \"\"\"\nSip(*a, b, ap, bp, crpix*)\n\nThe `~astropy.wcs.Sip` class performs polynomial distortion correction\nusing the `SIP`_ convention in both directions.\n\nParameters\n----------\na : ndarray\n    The ``A_i_j`` polynomial for pixel to focal plane transformation as ``double array[m+1][m+1]``.\n    Its size must be (*m* + 1, *m* + 1) where *m* = ``A_ORDER``.\n\nb : ndarray\n    The ``B_i_j`` polynomial for pixel to focal plane transformation as ``double array[m+1][m+1]``.\n    Its size must be (*m* + 1, *m* + 1) where *m* = ``B_ORDER``.\n\nap : ndarray\n    The ``AP_i_j`` polynomial for pixel to focal plane transformation as ``double array[m+1][m+1]``.\n    Its size must be (*m* + 1, *m* + 1) where *m* = ``AP_ORDER``.\n\nbp : ndarray\n    The ``BP_i_j`` polynomial for pixel to focal plane transformation as ``double array[m+1][m+1]``.\n    Its size must be (*m* + 1, *m* + 1) where *m* = ``BP_ORDER``.\n\ncrpix : ndarray\n    The reference pixel as ``double array[2]``.\n\nNotes\n-----\nShupe, D. L., M. Moshir, J. Li, D. Makovoz and R. Narron.  2005.\n\"The SIP Convention for Representing Distortion in FITS Image\nHeaders.\"  ADASS XIV.\n\"\"\"\n\nsip_foc2pix = \"\"\"\nsip_foc2pix(*foccrd, origin*) -> ``double array[ncoord][nelem]``\n\nConvert focal plane coordinates to pixel coordinates using the `SIP`_\npolynomial distortion convention.\n\nParameters\n----------\nfoccrd : ndarray\n    Array of focal plane coordinates as ``double array[ncoord][nelem]``.\n\n{}\n\nReturns\n-------\npixcrd : ndarray\n    Returns an array of pixel coordinates as ``double array[ncoord][nelem]``.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nValueError\n    Invalid coordinate transformation parameters.\n\"\"\".format(ORIGIN())\n\nsip_pix2foc = \"\"\"\nsip_pix2foc(*pixcrd, origin*) -> ``double array[ncoord][nelem]``\n\nConvert pixel coordinates to focal plane coordinates using the `SIP`_\npolynomial distortion convention.\n\nParameters\n----------\npixcrd : ndarray\n    Array of pixel coordinates as ``double array[ncoord][nelem]``.\n\n{}\n\nReturns\n-------\nfoccrd : ndarray\n    Returns an array of focal plane coordinates as ``double array[ncoord][nelem]``.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nValueError\n    Invalid coordinate transformation parameters.\n\"\"\".format(ORIGIN())\n\nspcfix = \"\"\"\nspcfix() -> int\n\nTranslates AIPS-convention spectral coordinate types.  {``FREQ``,\n``VELO``, ``FELO``}-{``OBS``, ``HEL``, ``LSR``} (e.g. ``FREQ-LSR``,\n``VELO-OBS``, ``FELO-HEL``)\n\nReturns\n-------\nsuccess : int\n    Returns ``0`` for success; ``-1`` if no change required.\n\"\"\"\n\nspec = \"\"\"\n``int`` (read-only) The index containing the spectral axis values.\n\"\"\"\n\nspecsys = \"\"\"\n``string`` Spectral reference frame (standard of rest), ``SPECSYSa``.\n\nSee also\n--------\nastropy.wcs.Wcsprm.ssysobs, astropy.wcs.Wcsprm.velosys\n\"\"\"\n\nsptr = \"\"\"\nsptr(ctype, i=-1)\n\nTranslates the spectral axis in a WCS object.\n\nFor example, a ``FREQ`` axis may be translated into ``ZOPT-F2W`` and\nvice versa.\n\nParameters\n----------\nctype : str\n    Required spectral ``CTYPEia``, maximum of 8 characters.  The first\n    four characters are required to be given and are never modified.\n    The remaining four, the algorithm code, are completely determined\n    by, and must be consistent with, the first four characters.\n    Wildcarding may be used, i.e.  if the final three characters are\n    specified as ``\\\"???\\\"``, or if just the eighth character is\n    specified as ``\\\"?\\\"``, the correct algorithm code will be\n    substituted and returned.\n\ni : int\n    Index of the spectral axis (0-relative).  If ``i < 0`` (or not\n    provided), it will be set to the first spectral axis identified\n    from the ``CTYPE`` keyvalues in the FITS header.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nSingularMatrixError\n    Linear transformation matrix is singular.\n\nInconsistentAxisTypesError\n    Inconsistent or unrecognized coordinate axis types.\n\nValueError\n    Invalid parameter value.\n\nInvalidTransformError\n    Invalid coordinate transformation parameters.\n\nInvalidTransformError\n    Ill-conditioned coordinate transformation parameters.\n\nInvalidSubimageSpecificationError\n    Invalid subimage specification (no spectral axis).\n\"\"\"\n\nssysobs = \"\"\"\n``string`` Spectral reference frame.\n\nThe spectral reference frame in which there is no differential\nvariation in the spectral coordinate across the field-of-view,\n``SSYSOBSa``.\n\nSee also\n--------\nastropy.wcs.Wcsprm.specsys, astropy.wcs.Wcsprm.velosys\n\"\"\"\n\nssyssrc = \"\"\"\n``string`` Spectral reference frame for redshift.\n\nThe spectral reference frame (standard of rest) in which the redshift\nwas measured, ``SSYSSRCa``.\n\"\"\"\n\nsub = \"\"\"\nsub(axes)\n\nExtracts the coordinate description for a subimage from a\n`~astropy.wcs.WCS` object.\n\nThe world coordinate system of the subimage must be separable in the\nsense that the world coordinates at any point in the subimage must\ndepend only on the pixel coordinates of the axes extracted.  In\npractice, this means that the ``PCi_ja`` matrix of the original image\nmust not contain non-zero off-diagonal terms that associate any of the\nsubimage axes with any of the non-subimage axes.\n\n`sub` can also add axes to a wcsprm object.  The new axes will be\ncreated using the defaults set by the Wcsprm constructor which produce\na simple, unnamed, linear axis with world coordinates equal to the\npixel coordinate.  These default values can be changed before\ninvoking `set`.\n\nParameters\n----------\naxes : int or a sequence.\n\n    - If an int, include the first *N* axes in their original order.\n\n    - If a sequence, may contain a combination of image axis numbers\n      (1-relative) or special axis identifiers (see below).  Order is\n      significant; ``axes[0]`` is the axis number of the input image\n      that corresponds to the first axis in the subimage, etc.  Use an\n      axis number of 0 to create a new axis using the defaults.\n\n    - If ``0``, ``[]`` or ``None``, do a deep copy.\n\n    Coordinate axes types may be specified using either strings or\n    special integer constants.  The available types are:\n\n    - ``'longitude'`` / ``WCSSUB_LONGITUDE``: Celestial longitude\n\n    - ``'latitude'`` / ``WCSSUB_LATITUDE``: Celestial latitude\n\n    - ``'cubeface'`` / ``WCSSUB_CUBEFACE``: Quadcube ``CUBEFACE`` axis\n\n    - ``'spectral'`` / ``WCSSUB_SPECTRAL``: Spectral axis\n\n    - ``'stokes'`` / ``WCSSUB_STOKES``: Stokes axis\n\n    - ``'celestial'`` / ``WCSSUB_CELESTIAL``: An alias for the\n      combination of ``'longitude'``, ``'latitude'`` and ``'cubeface'``.\n\nReturns\n-------\nnew_wcs : `~astropy.wcs.WCS` object\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nInvalidSubimageSpecificationError\n    Invalid subimage specification (no spectral axis).\n\nNonseparableSubimageCoordinateSystemError\n    Non-separable subimage coordinate system.\n\nNotes\n-----\nCombinations of subimage axes of particular types may be extracted in\nthe same order as they occur in the input image by combining the\ninteger constants with the 'binary or' (``|``) operator.  For\nexample::\n\n    wcs.sub([WCSSUB_LONGITUDE | WCSSUB_LATITUDE | WCSSUB_SPECTRAL])\n\nwould extract the longitude, latitude, and spectral axes in the same\norder as the input image.  If one of each were present, the resulting\nobject would have three dimensions.\n\nFor convenience, ``WCSSUB_CELESTIAL`` is defined as the combination\n``WCSSUB_LONGITUDE | WCSSUB_LATITUDE | WCSSUB_CUBEFACE``.\n\nThe codes may also be negated to extract all but the types specified,\nfor example::\n\n    wcs.sub([\n      WCSSUB_LONGITUDE,\n      WCSSUB_LATITUDE,\n      WCSSUB_CUBEFACE,\n      -(WCSSUB_SPECTRAL | WCSSUB_STOKES)])\n\nThe last of these specifies all axis types other than spectral or\nStokes.  Extraction is done in the order specified by ``axes``, i.e. a\nlongitude axis (if present) would be extracted first (via ``axes[0]``)\nand not subsequently (via ``axes[3]``).  Likewise for the latitude and\ncubeface axes in this example.\n\nThe number of dimensions in the returned object may be less than or\ngreater than the length of ``axes``.  However, it will never exceed the\nnumber of axes in the input image.\n\"\"\"\n\ntab = \"\"\"\n``list of Tabprm`` Tabular coordinate objects.\n\nA list of tabular coordinate objects associated with this WCS.\n\"\"\"\n\nTabprm = \"\"\"\nA class to store the information related to tabular coordinates,\ni.e., coordinates that are defined via a lookup table.\n\nThis class can not be constructed directly from Python, but instead is\nreturned from `~astropy.wcs.Wcsprm.tab`.\n\"\"\"\n\ntheta0 = \"\"\"\n``double``  The native longitude of the fiducial point.\n\nThe point whose celestial coordinates are given in ``ref[1:2]``.  If\nundefined (NaN) the initialization routine, `~astropy.wcs.Wcsprm.set`,\nwill set this to a projection-specific default.\n\nSee also\n--------\nastropy.wcs.Wcsprm.phi0\n\"\"\"\n\nto_header = \"\"\"\nto_header(relax=False)\n\n`to_header` translates a WCS object into a FITS header.\n\nThe details of the header depends on context:\n\n    - If the `~astropy.wcs.Wcsprm.colnum` member is non-zero then a\n      binary table image array header will be produced.\n\n    - Otherwise, if the `~astropy.wcs.Wcsprm.colax` member is set\n      non-zero then a pixel list header will be produced.\n\n    - Otherwise, a primary image or image extension header will be\n      produced.\n\nThe output header will almost certainly differ from the input in a\nnumber of respects:\n\n    1. The output header only contains WCS-related keywords.  In\n       particular, it does not contain syntactically-required keywords\n       such as ``SIMPLE``, ``NAXIS``, ``BITPIX``, or ``END``.\n\n    2. Deprecated (e.g. ``CROTAn``) or non-standard usage will be\n       translated to standard (this is partially dependent on whether\n       ``fix`` was applied).\n\n    3. Quantities will be converted to the units used internally,\n       basically SI with the addition of degrees.\n\n    4. Floating-point quantities may be given to a different decimal\n       precision.\n\n    5. Elements of the ``PCi_j`` matrix will be written if and only if\n       they differ from the unit matrix.  Thus, if the matrix is unity\n       then no elements will be written.\n\n    6. Additional keywords such as ``WCSAXES``, ``CUNITia``,\n       ``LONPOLEa`` and ``LATPOLEa`` may appear.\n\n    7. The original keycomments will be lost, although\n       `~astropy.wcs.Wcsprm.to_header` tries hard to write meaningful\n       comments.\n\n    8. Keyword order may be changed.\n\nKeywords can be translated between the image array, binary table, and\npixel lists forms by manipulating the `~astropy.wcs.Wcsprm.colnum` or\n`~astropy.wcs.Wcsprm.colax` members of the `~astropy.wcs.WCS`\nobject.\n\nParameters\n----------\n\nrelax : bool or int\n    Degree of permissiveness:\n\n    - `False`: Recognize only FITS keywords defined by the published\n      WCS standard.\n\n    - `True`: Admit all recognized informal extensions of the WCS\n      standard.\n\n    - `int`: a bit field selecting specific extensions to write.\n      See :ref:`astropy:relaxwrite` for details.\n\nReturns\n-------\nheader : str\n    Raw FITS header as a string.\n\"\"\"\n\nttype = \"\"\"\n``str`` (read-only) ``TTYPEn`` identifying the column of the binary table that contains\nthe wcstab array.\n\"\"\"\n\nunitfix = \"\"\"\nunitfix(translate_units='')\n\nTranslates non-standard ``CUNITia`` keyvalues.\n\nFor example, ``DEG`` -> ``deg``, also stripping off unnecessary\nwhitespace.\n\nParameters\n----------\ntranslate_units : str, optional\n    Do potentially unsafe translations of non-standard unit strings.\n\n    Although ``\\\"S\\\"`` is commonly used to represent seconds, its\n    recognizes ``\\\"S\\\"`` formally as Siemens, however rarely that may\n    be translation to ``\\\"s\\\"`` is potentially unsafe since the\n    standard used.  The same applies to ``\\\"H\\\"`` for hours (Henry),\n    and ``\\\"D\\\"`` for days (Debye).\n\n    This string controls what to do in such cases, and is\n    case-insensitive.\n\n    - If the string contains ``\\\"s\\\"``, translate ``\\\"S\\\"`` to ``\\\"s\\\"``.\n\n    - If the string contains ``\\\"h\\\"``, translate ``\\\"H\\\"`` to ``\\\"h\\\"``.\n\n    - If the string contains ``\\\"d\\\"``, translate ``\\\"D\\\"`` to ``\\\"d\\\"``.\n\n    Thus ``''`` doesn't do any unsafe translations, whereas ``'shd'``\n    does all of them.\n\nReturns\n-------\nsuccess : int\n    Returns ``0`` for success; ``-1`` if no change required.\n\"\"\"\n\nvelangl = \"\"\"\n``double`` Velocity angle.\n\nThe angle in degrees that should be used to decompose an observed\nvelocity into radial and transverse components.\n\nAn undefined value is represented by NaN.\n\"\"\"\n\nvelosys = \"\"\"\n``double`` Relative radial velocity.\n\nThe relative radial velocity (m/s) between the observer and the\nselected standard of rest in the direction of the celestial reference\ncoordinate, ``VELOSYSa``.\n\nAn undefined value is represented by NaN.\n\nSee also\n--------\nastropy.wcs.Wcsprm.specsys, astropy.wcs.Wcsprm.ssysobs\n\"\"\"\n\nvelref = \"\"\"\n``int`` AIPS velocity code.\n\nFrom ``VELREF`` keyword.\n\"\"\"\n\nwcs = \"\"\"\nA `~astropy.wcs.Wcsprm` object to perform the basic `wcslib`_ WCS\ntransformation.\n\"\"\"\n\nWcs = \"\"\"\nWcs(*sip, cpdis, wcsprm, det2im*)\n\nWcs objects amalgamate basic WCS (as provided by `wcslib`_), with\n`SIP`_ and `distortion paper`_ operations.\n\nTo perform all distortion corrections and WCS transformation, use\n``all_pix2world``.\n\nParameters\n----------\nsip : `~astropy.wcs.Sip` object or None\n\ncpdis : (2,) tuple of `~astropy.wcs.DistortionLookupTable` or None\n\nwcsprm : `~astropy.wcs.Wcsprm`\n\ndet2im : (2,) tuple of `~astropy.wcs.DistortionLookupTable` or None\n\"\"\"\n\nWcsprm = \"\"\"\nWcsprm(header=None, key=' ', relax=False, naxis=2, keysel=0, colsel=None)\n\n`~astropy.wcs.Wcsprm` performs the core WCS transformations.\n\n.. note::\n    The members of this object correspond roughly to the key/value\n    pairs in the FITS header.  However, they are adjusted and\n    normalized in a number of ways that make performing the WCS\n    transformation easier.  Therefore, they can not be relied upon to\n    get the original values in the header.  For that, use\n    `astropy.io.fits.Header` directly.\n\nThe FITS header parsing enforces correct FITS \"keyword = value\" syntax\nwith regard to the equals sign occurring in columns 9 and 10.\nHowever, it does recognize free-format character (NOST 100-2.0,\nSect. 5.2.1), integer (Sect. 5.2.3), and floating-point values\n(Sect. 5.2.4) for all keywords.\n\n\n.. warning::\n\n    Many of the attributes of this class require additional processing when\n    modifying underlying C structure.  When needed, this additional processing\n    is implemented in attribute setters. Therefore, for mutable attributes, one\n    should always set the attribute rather than a slice of its current value (or\n    its individual elements) since the latter may lead the class instance to be\n    in an invalid state.  For example, attribute ``crpix`` of a 2D WCS'\n    ``Wcsprm`` object ``wcs`` should be set as ``wcs.crpix = [crpix1, crpix2]``\n    instead of ``wcs.crpix[0] = crpix1; wcs.crpix[1] = crpix2]``.\n\n\nParameters\n----------\nheader : `~astropy.io.fits.Header`, str, or None.\n  If ``None``, the object will be initialized to default values.\n\nkey : str, optional\n    The key referring to a particular WCS transform in the header.\n    This may be either ``' '`` or ``'A'``-``'Z'`` and corresponds to\n    the ``\\\"a\\\"`` part of ``\\\"CTYPEia\\\"``.  (*key* may only be\n    provided if *header* is also provided.)\n\nrelax : bool or int, optional\n\n    Degree of permissiveness:\n\n    - `False`: Recognize only FITS keywords defined by the published\n      WCS standard.\n\n    - `True`: Admit all recognized informal extensions of the WCS\n      standard.\n\n    - `int`: a bit field selecting specific extensions to accept.  See\n      :ref:`astropy:relaxread` for details.\n\nnaxis : int, optional\n    The number of world coordinates axes for the object.  (*naxis* may\n    only be provided if *header* is `None`.)\n\nkeysel : sequence of flag bits, optional\n    Vector of flag bits that may be used to restrict the keyword types\n    considered:\n\n        - ``WCSHDR_IMGHEAD``: Image header keywords.\n\n        - ``WCSHDR_BIMGARR``: Binary table image array.\n\n        - ``WCSHDR_PIXLIST``: Pixel list keywords.\n\n    If zero, there is no restriction.  If -1, the underlying wcslib\n    function ``wcspih()`` is called, rather than ``wcstbh()``.\n\ncolsel : sequence of int\n    A sequence of table column numbers used to restrict the keywords\n    considered.  `None` indicates no restriction.\n\nRaises\n------\nMemoryError\n     Memory allocation failed.\n\nValueError\n     Invalid key.\n\nKeyError\n     Key not found in FITS header.\n\"\"\"\n\nwtb = \"\"\"\n``list of Wtbarr`` objects to construct coordinate lookup tables from BINTABLE.\n\n\"\"\"\n\nWtbarr = \"\"\"\nClasses to construct coordinate lookup tables from a binary table\nextension (BINTABLE).\n\nThis class can not be constructed directly from Python, but instead is\nreturned from `~astropy.wcs.Wcsprm.wtb`.\n\"\"\"\n\nzsource = \"\"\"\n``double`` The redshift, ``ZSOURCEa``, of the source.\n\nAn undefined value is represented by NaN.\n\"\"\"\n\nWcsError = \"\"\"\nBase class of all invalid WCS errors.\n\"\"\"\n\nSingularMatrix = \"\"\"\nSingularMatrixError()\n\nThe linear transformation matrix is singular.\n\"\"\"\n\nInconsistentAxisTypes = \"\"\"\nInconsistentAxisTypesError()\n\nThe WCS header inconsistent or unrecognized coordinate axis type(s).\n\"\"\"\n\nInvalidTransform = \"\"\"\nInvalidTransformError()\n\nThe WCS transformation is invalid, or the transformation parameters\nare invalid.\n\"\"\"\n\nInvalidCoordinate = \"\"\"\nInvalidCoordinateError()\n\nOne or more of the world coordinates is invalid.\n\"\"\"\n\nNoSolution = \"\"\"\nNoSolutionError()\n\nNo solution can be found in the given interval.\n\"\"\"\n\nInvalidSubimageSpecification = \"\"\"\nInvalidSubimageSpecificationError()\n\nThe subimage specification is invalid.\n\"\"\"\n\nNonseparableSubimageCoordinateSystem = \"\"\"\nNonseparableSubimageCoordinateSystemError()\n\nNon-separable subimage coordinate system.\n\"\"\"\n\nNoWcsKeywordsFound = \"\"\"\nNoWcsKeywordsFoundError()\n\nNo WCS keywords were found in the given header.\n\"\"\"\n\nInvalidTabularParameters = \"\"\"\nInvalidTabularParametersError()\n\nThe given tabular parameters are invalid.\n\"\"\"\n\nInvalidPrjParameters = \"\"\"\nInvalidPrjParametersError()\n\nThe given projection parameters are invalid.\n\"\"\"\n\nmjdbeg = \"\"\"\n``double`` Modified Julian Date corresponding to ``DATE-BEG``.\n\n``(MJD = JD - 2400000.5)``.\n\nAn undefined value is represented by NaN.\n\nSee also\n--------\nastropy.wcs.Wcsprm.mjdbeg\n\"\"\"\n\nmjdend = \"\"\"\n``double`` Modified Julian Date corresponding to ``DATE-END``.\n\n``(MJD = JD - 2400000.5)``.\n\nAn undefined value is represented by NaN.\n\nSee also\n--------\nastropy.wcs.Wcsprm.mjdend\n\"\"\"\n\nmjdref = \"\"\"\n``double`` Modified Julian Date corresponding to ``DATE-REF``.\n\n``(MJD = JD - 2400000.5)``.\n\nAn undefined value is represented by NaN.\n\nSee also\n--------\nastropy.wcs.Wcsprm.dateref\n\"\"\"\n\nbepoch = \"\"\"\n``double`` Equivalent to ``DATE-OBS``.\n\nExpressed as a Besselian epoch.\n\nSee also\n--------\nastropy.wcs.Wcsprm.dateobs\n\"\"\"\n\njepoch = \"\"\"\n``double`` Equivalent to ``DATE-OBS``.\n\nExpressed as a Julian epoch.\n\nSee also\n--------\nastropy.wcs.Wcsprm.dateobs\n\"\"\"\n\ndatebeg = \"\"\"\n``string`` Date at the start of the observation.\n\nIn ISO format, ``yyyy-mm-ddThh:mm:ss``.\n\nSee also\n--------\nastropy.wcs.Wcsprm.datebeg\n\"\"\"\n\ndateend = \"\"\"\n``string`` Date at the end of the observation.\n\nIn ISO format, ``yyyy-mm-ddThh:mm:ss``.\n\nSee also\n--------\nastropy.wcs.Wcsprm.dateend\n\"\"\"\n\ndateref = \"\"\"\n``string`` Date of a reference epoch relative to which\nother time measurements refer.\n\nSee also\n--------\nastropy.wcs.Wcsprm.dateref\n\"\"\"\n\ntimesys = \"\"\"\n``string`` Time scale (UTC, TAI, etc.) in which all other time-related\nauxiliary header values are recorded. Also defines the time scale for\nan image axis with CTYPEia set to 'TIME'.\n\nSee also\n--------\nastropy.wcs.Wcsprm.timesys\n\"\"\"\n\ntrefpos = \"\"\"\n``string`` Location in space where the recorded time is valid.\n\nSee also\n--------\nastropy.wcs.Wcsprm.trefpos\n\"\"\"\n\ntrefdir = \"\"\"\n``string`` Reference direction used in calculating a pathlength delay.\n\nSee also\n--------\nastropy.wcs.Wcsprm.trefdir\n\"\"\"\n\ntimeunit = \"\"\"\n``string`` Time units in which the following header values are expressed:\n``TSTART``, ``TSTOP``, ``TIMEOFFS``, ``TIMSYER``, ``TIMRDER``, ``TIMEDEL``.\n\nIt also provides the default value for ``CUNITia`` for time axes.\n\nSee also\n--------\nastropy.wcs.Wcsprm.trefdir\n\"\"\"\n\nplephem = \"\"\"\n``string`` The Solar System ephemeris used for calculating a pathlength delay.\n\nSee also\n--------\nastropy.wcs.Wcsprm.plephem\n\"\"\"\n\ntstart = \"\"\"\n``double`` equivalent to DATE-BEG expressed as a time in units of TIMEUNIT relative to DATEREF+TIMEOFFS.\n\nSee also\n--------\nastropy.wcs.Wcsprm.tstop\n\"\"\"\n\ntstop = \"\"\"\n``double`` equivalent to DATE-END expressed as a time in units of TIMEUNIT relative to DATEREF+TIMEOFFS.\n\nSee also\n--------\nastropy.wcs.Wcsprm.tstart\n\"\"\"\n\ntelapse = \"\"\"\n``double`` equivalent to the elapsed time between DATE-BEG and DATE-END, in units of TIMEUNIT.\n\nSee also\n--------\nastropy.wcs.Wcsprm.tstart\n\"\"\"\n\ntimeoffs = \"\"\"\n``double`` Time offset, which may be used, for example, to provide a uniform clock correction\n           for times referenced to DATEREF.\n\nSee also\n--------\nastropy.wcs.Wcsprm.timeoffs\n\"\"\"\n\ntimsyer = \"\"\"\n``double`` the absolute error of the time values, in units of TIMEUNIT.\n\nSee also\n--------\nastropy.wcs.Wcsprm.timrder\n\"\"\"\n\ntimrder = \"\"\"\n``double`` the accuracy of time stamps relative to each other, in units of TIMEUNIT.\n\nSee also\n--------\nastropy.wcs.Wcsprm.timsyer\n\"\"\"\n\ntimedel = \"\"\"\n``double`` the resolution of the time stamps.\n\nSee also\n--------\nastropy.wcs.Wcsprm.timedel\n\"\"\"\n\ntimepixr = \"\"\"\n``double`` relative position of the time stamps in binned time intervals, a value between 0.0 and 1.0.\n\nSee also\n--------\nastropy.wcs.Wcsprm.timepixr\n\"\"\"\n\nobsorbit = \"\"\"\n``string`` URI, URL, or name of an orbit ephemeris file giving spacecraft coordinates relating to TREFPOS.\n\nSee also\n--------\nastropy.wcs.Wcsprm.trefpos\n\n\"\"\"\nxposure = \"\"\"\n``double`` effective exposure time in units of TIMEUNIT.\n\nSee also\n--------\nastropy.wcs.Wcsprm.timeunit\n\"\"\"\n\nczphs = \"\"\"\n``double array[naxis]`` The time at the zero point of a phase axis, ``CSPHSia``.\n\nAn undefined value is represented by NaN.\n\"\"\"\n\ncperi = \"\"\"\n``double array[naxis]`` period of a phase axis, CPERIia.\n\nAn undefined value is represented by NaN.\n\"\"\"\n"},{"attributeType":"{get} | None","col":8,"comment":"null","endLoc":1647,"id":7108,"name":"_config","nodeType":"Attribute","startLoc":1647,"text":"self._config"},{"className":"TimeSys","col":0,"comment":"\n    TIMESYS_ element: defines a time system.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    ","endLoc":1853,"id":7109,"nodeType":"Class","startLoc":1739,"text":"class TimeSys(SimpleElement):\n    \"\"\"\n    TIMESYS_ element: defines a time system.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    \"\"\"\n    _attr_list = ['ID', 'timeorigin', 'timescale', 'refposition']\n    _element_name = 'TIMESYS'\n\n    def __init__(self, ID=None, timeorigin=None, timescale=None, refposition=None, id=None,\n                 config=None, pos=None, **extra):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        # TIMESYS is supported starting in version 1.4\n        if not config['version_1_4_or_later']:\n            warn_or_raise(\n                W54, W54, config['version'], config, pos)\n\n        SimpleElement.__init__(self)\n\n        self.ID = resolve_id(ID, id, config, pos)\n        self.timeorigin = timeorigin\n        self.timescale = timescale\n        self.refposition = refposition\n\n        warn_unknown_attrs('TIMESYS', extra.keys(), config, pos,\n                           ['ID', 'timeorigin', 'timescale', 'refposition'])\n\n    @property\n    def ID(self):\n        \"\"\"\n        [*required*] The XML ID of the TIMESYS_ element, used for\n        cross-referencing.  Must be a string conforming to\n        XML ID_ syntax.\n        \"\"\"\n        return self._ID\n\n    @ID.setter\n    def ID(self, ID):\n        if ID is None:\n            vo_raise(E22, (), self._config, self._pos)\n        xmlutil.check_id(ID, 'ID', self._config, self._pos)\n        self._ID = ID\n\n    @property\n    def timeorigin(self):\n        \"\"\"\n        Specifies the time origin of the time coordinate,\n        given as a Julian Date for the the time scale and\n        reference point defined. It is usually given as a\n        floating point literal; for convenience, the magic\n        strings \"MJD-origin\" (standing for 2400000.5) and\n        \"JD-origin\" (standing for 0) are also allowed.\n\n        The timeorigin attribute MUST be given unless the\n        time’s representation contains a year of a calendar\n        era, in which case it MUST NOT be present. In VOTables,\n        these representations currently are Gregorian calendar\n        years with xtype=\"timestamp\", or years in the Julian\n        or Besselian calendar when a column has yr, a, or Ba as\n        its unit and no time origin is given.\n        \"\"\"\n        return self._timeorigin\n\n    @timeorigin.setter\n    def timeorigin(self, timeorigin):\n        if (timeorigin is not None and\n                timeorigin != 'MJD-origin' and timeorigin != 'JD-origin'):\n            try:\n                timeorigin = float(timeorigin)\n            except ValueError:\n                warn_or_raise(E23, E23, timeorigin, self._config, self._pos)\n        self._timeorigin = timeorigin\n\n    @timeorigin.deleter\n    def timeorigin(self):\n        self._timeorigin = None\n\n    @property\n    def timescale(self):\n        \"\"\"\n        [*required*] String specifying the time scale used. Values\n        should be taken from the IVOA timescale vocabulary (documented\n        at http://www.ivoa.net/rdf/timescale).\n        \"\"\"\n        return self._timescale\n\n    @timescale.setter\n    def timescale(self, timescale):\n        self._timescale = timescale\n\n    @timescale.deleter\n    def timescale(self):\n        self._timescale = None\n\n    @property\n    def refposition(self):\n        \"\"\"\n        [*required*] String specifying the reference position. Values\n        should be taken from the IVOA refposition vocabulary (documented\n        at http://www.ivoa.net/rdf/refposition).\n        \"\"\"\n        return self._refposition\n\n    @refposition.setter\n    def refposition(self, refposition):\n        self._refposition = refposition\n\n    @refposition.deleter\n    def refposition(self):\n        self._refposition = None"},{"col":4,"comment":"\n        [*required*] The XML ID of the TIMESYS_ element, used for\n        cross-referencing.  Must be a string conforming to\n        XML ID_ syntax.\n        ","endLoc":1778,"header":"@property\n    def ID(self)","id":7110,"name":"ID","nodeType":"Function","startLoc":1771,"text":"@property\n    def ID(self):\n        \"\"\"\n        [*required*] The XML ID of the TIMESYS_ element, used for\n        cross-referencing.  Must be a string conforming to\n        XML ID_ syntax.\n        \"\"\"\n        return self._ID"},{"col":4,"comment":"null","endLoc":1785,"header":"@ID.setter\n    def ID(self, ID)","id":7111,"name":"ID","nodeType":"Function","startLoc":1780,"text":"@ID.setter\n    def ID(self, ID):\n        if ID is None:\n            vo_raise(E22, (), self._config, self._pos)\n        xmlutil.check_id(ID, 'ID', self._config, self._pos)\n        self._ID = ID"},{"col":4,"comment":"Print a list of available formats to console (or ``out`` filehandle)\n\n        out : None or file handle object\n            Output destination (default is stdout via a pager)\n        ","endLoc":116,"header":"def list_formats(self, out=None)","id":7112,"name":"list_formats","nodeType":"Function","startLoc":102,"text":"def list_formats(self, out=None):\n        \"\"\"Print a list of available formats to console (or ``out`` filehandle)\n\n        out : None or file handle object\n            Output destination (default is stdout via a pager)\n        \"\"\"\n        tbl = self._registry.get_formats(self._cls, self._method_name.capitalize())\n        del tbl['Data class']\n\n        if out is None:\n            tbl.pprint(max_lines=-1, max_width=-1)\n        else:\n            out.write('\\n'.join(tbl.pformat(max_lines=-1, max_width=-1)))\n\n        return out"},{"col":4,"comment":"\n        Specifies the time origin of the time coordinate,\n        given as a Julian Date for the the time scale and\n        reference point defined. It is usually given as a\n        floating point literal; for convenience, the magic\n        strings \"MJD-origin\" (standing for 2400000.5) and\n        \"JD-origin\" (standing for 0) are also allowed.\n\n        The timeorigin attribute MUST be given unless the\n        time’s representation contains a year of a calendar\n        era, in which case it MUST NOT be present. In VOTables,\n        these representations currently are Gregorian calendar\n        years with xtype=\"timestamp\", or years in the Julian\n        or Besselian calendar when a column has yr, a, or Ba as\n        its unit and no time origin is given.\n        ","endLoc":1805,"header":"@property\n    def timeorigin(self)","id":7113,"name":"timeorigin","nodeType":"Function","startLoc":1787,"text":"@property\n    def timeorigin(self):\n        \"\"\"\n        Specifies the time origin of the time coordinate,\n        given as a Julian Date for the the time scale and\n        reference point defined. It is usually given as a\n        floating point literal; for convenience, the magic\n        strings \"MJD-origin\" (standing for 2400000.5) and\n        \"JD-origin\" (standing for 0) are also allowed.\n\n        The timeorigin attribute MUST be given unless the\n        time’s representation contains a year of a calendar\n        era, in which case it MUST NOT be present. In VOTables,\n        these representations currently are Gregorian calendar\n        years with xtype=\"timestamp\", or years in the Julian\n        or Besselian calendar when a column has yr, a, or Ba as\n        its unit and no time origin is given.\n        \"\"\"\n        return self._timeorigin"},{"col":4,"comment":"\n        Register a reader function.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that will be used to\n            specify the data type when reading.\n        data_class : class\n            The class of the object that the reader produces.\n        function : function\n            The function to read in a data object.\n        force : bool, optional\n            Whether to override any existing function if already present.\n            Default is ``False``.\n        priority : int, optional\n            The priority of the reader, used to compare possible formats when\n            trying to determine the best reader to use. Higher priorities are\n            preferred over lower priorities, with the default priority being 0\n            (negative numbers are allowed though).\n        ","endLoc":98,"header":"def register_reader(self, data_format, data_class, function, force=False,\n                        priority=0)","id":7114,"name":"register_reader","nodeType":"Function","startLoc":67,"text":"def register_reader(self, data_format, data_class, function, force=False,\n                        priority=0):\n        \"\"\"\n        Register a reader function.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that will be used to\n            specify the data type when reading.\n        data_class : class\n            The class of the object that the reader produces.\n        function : function\n            The function to read in a data object.\n        force : bool, optional\n            Whether to override any existing function if already present.\n            Default is ``False``.\n        priority : int, optional\n            The priority of the reader, used to compare possible formats when\n            trying to determine the best reader to use. Higher priorities are\n            preferred over lower priorities, with the default priority being 0\n            (negative numbers are allowed though).\n        \"\"\"\n        if not (data_format, data_class) in self._readers or force:\n            self._readers[(data_format, data_class)] = function, priority\n        else:\n            raise IORegistryError(\"Reader for format '{}' and class '{}' is \"\n                              'already defined'\n                              ''.format(data_format, data_class.__name__))\n\n        if data_class not in self._delayed_docs_classes:\n            self._update__doc__(data_class, 'read')"},{"col":4,"comment":"null","endLoc":1815,"header":"@timeorigin.setter\n    def timeorigin(self, timeorigin)","id":7115,"name":"timeorigin","nodeType":"Function","startLoc":1807,"text":"@timeorigin.setter\n    def timeorigin(self, timeorigin):\n        if (timeorigin is not None and\n                timeorigin != 'MJD-origin' and timeorigin != 'JD-origin'):\n            try:\n                timeorigin = float(timeorigin)\n            except ValueError:\n                warn_or_raise(E23, E23, timeorigin, self._config, self._pos)\n        self._timeorigin = timeorigin"},{"col":4,"comment":"null","endLoc":1819,"header":"@timeorigin.deleter\n    def timeorigin(self)","id":7116,"name":"timeorigin","nodeType":"Function","startLoc":1817,"text":"@timeorigin.deleter\n    def timeorigin(self):\n        self._timeorigin = None"},{"col":4,"comment":"\n        [*required*] String specifying the time scale used. Values\n        should be taken from the IVOA timescale vocabulary (documented\n        at http://www.ivoa.net/rdf/timescale).\n        ","endLoc":1828,"header":"@property\n    def timescale(self)","id":7117,"name":"timescale","nodeType":"Function","startLoc":1821,"text":"@property\n    def timescale(self):\n        \"\"\"\n        [*required*] String specifying the time scale used. Values\n        should be taken from the IVOA timescale vocabulary (documented\n        at http://www.ivoa.net/rdf/timescale).\n        \"\"\"\n        return self._timescale"},{"col":4,"comment":"null","endLoc":1832,"header":"@timescale.setter\n    def timescale(self, timescale)","id":7118,"name":"timescale","nodeType":"Function","startLoc":1830,"text":"@timescale.setter\n    def timescale(self, timescale):\n        self._timescale = timescale"},{"col":4,"comment":"null","endLoc":1836,"header":"@timescale.deleter\n    def timescale(self)","id":7119,"name":"timescale","nodeType":"Function","startLoc":1834,"text":"@timescale.deleter\n    def timescale(self):\n        self._timescale = None"},{"col":4,"comment":"\n        [*required*] String specifying the reference position. Values\n        should be taken from the IVOA refposition vocabulary (documented\n        at http://www.ivoa.net/rdf/refposition).\n        ","endLoc":1845,"header":"@property\n    def refposition(self)","id":7120,"name":"refposition","nodeType":"Function","startLoc":1838,"text":"@property\n    def refposition(self):\n        \"\"\"\n        [*required*] String specifying the reference position. Values\n        should be taken from the IVOA refposition vocabulary (documented\n        at http://www.ivoa.net/rdf/refposition).\n        \"\"\"\n        return self._refposition"},{"col":4,"comment":"null","endLoc":1849,"header":"@refposition.setter\n    def refposition(self, refposition)","id":7121,"name":"refposition","nodeType":"Function","startLoc":1847,"text":"@refposition.setter\n    def refposition(self, refposition):\n        self._refposition = refposition"},{"col":4,"comment":"null","endLoc":1853,"header":"@refposition.deleter\n    def refposition(self)","id":7122,"name":"refposition","nodeType":"Function","startLoc":1851,"text":"@refposition.deleter\n    def refposition(self):\n        self._refposition = None"},{"attributeType":"null","col":4,"comment":"null","endLoc":1746,"id":7123,"name":"_attr_list","nodeType":"Attribute","startLoc":1746,"text":"_attr_list"},{"col":4,"comment":"\n        Get the list of registered formats as a `~astropy.table.Table`.\n\n        Parameters\n        ----------\n        data_class : class or None, optional\n            Filter readers/writer to match data class (default = all classes).\n        filter_on : str or None, optional\n            Which registry to show. E.g. \"identify\"\n            If None search for both.  Default is None.\n\n        Returns\n        -------\n        format_table : :class:`~astropy.table.Table`\n            Table of available I/O formats.\n\n        Raises\n        ------\n        ValueError\n            If ``filter_on`` is not None nor a registry name.\n        ","endLoc":153,"header":"def get_formats(self, data_class=None, filter_on=None)","id":7124,"name":"get_formats","nodeType":"Function","startLoc":64,"text":"def get_formats(self, data_class=None, filter_on=None):\n        \"\"\"\n        Get the list of registered formats as a `~astropy.table.Table`.\n\n        Parameters\n        ----------\n        data_class : class or None, optional\n            Filter readers/writer to match data class (default = all classes).\n        filter_on : str or None, optional\n            Which registry to show. E.g. \"identify\"\n            If None search for both.  Default is None.\n\n        Returns\n        -------\n        format_table : :class:`~astropy.table.Table`\n            Table of available I/O formats.\n\n        Raises\n        ------\n        ValueError\n            If ``filter_on`` is not None nor a registry name.\n        \"\"\"\n        from astropy.table import Table\n\n        # set up the column names\n        colnames = (\n            \"Data class\", \"Format\",\n            *[self._registries[k][\"column\"] for k in self._registries_order],\n            \"Deprecated\")\n        i_dataclass = colnames.index(\"Data class\")\n        i_format = colnames.index(\"Format\")\n        i_regstart = colnames.index(self._registries[self._registries_order[0]][\"column\"])\n        i_deprecated = colnames.index(\"Deprecated\")\n\n        # registries\n        regs = set()\n        for k in self._registries.keys() - {\"identify\"}:\n            regs |= set(getattr(self, self._registries[k][\"attr\"]))\n        format_classes = sorted(regs, key=itemgetter(0))\n        # the format classes from all registries except \"identify\"\n\n        rows = []\n        for (fmt, cls) in format_classes:\n            # see if can skip, else need to document in row\n            if (data_class is not None and not self._is_best_match(\n                data_class, cls, format_classes)):\n                continue\n\n            # flags for each registry\n            has_ = {k: \"Yes\" if (fmt, cls) in getattr(self, v[\"attr\"]) else \"No\"\n                    for k, v in self._registries.items()}\n\n            # Check if this is a short name (e.g. 'rdb') which is deprecated in\n            # favor of the full 'ascii.rdb'.\n            ascii_format_class = ('ascii.' + fmt, cls)\n            # deprecation flag\n            deprecated = \"Yes\" if ascii_format_class in format_classes else \"\"\n\n            # add to rows\n            rows.append((cls.__name__, fmt,\n                         *[has_[n] for n in self._registries_order], deprecated))\n\n        # filter_on can be in self_registries_order or None\n        if str(filter_on).lower() in self._registries_order:\n            index = self._registries_order.index(str(filter_on).lower())\n            rows = [row for row in rows if row[i_regstart + index] == 'Yes']\n        elif filter_on is not None:\n            raise ValueError('unrecognized value for \"filter_on\": {0}.\\n'\n                             f'Allowed are {self._registries_order} and None.')\n\n        # Sorting the list of tuples is much faster than sorting it after the\n        # table is created. (#5262)\n        if rows:\n            # Indices represent \"Data Class\", \"Deprecated\" and \"Format\".\n            data = list(zip(*sorted(\n                rows, key=itemgetter(i_dataclass, i_deprecated, i_format))))\n        else:\n            data = None\n\n        # make table\n        # need to filter elementwise comparison failure issue\n        # https://github.com/numpy/numpy/issues/6784\n        with warnings.catch_warnings():\n            warnings.simplefilter(action='ignore', category=FutureWarning)\n\n            format_table = Table(data, names=colnames)\n            if not np.any(format_table['Deprecated'].data == 'Yes'):\n                format_table.remove_column('Deprecated')\n\n        return format_table"},{"attributeType":"null","col":4,"comment":"null","endLoc":1747,"id":7125,"name":"_element_name","nodeType":"Attribute","startLoc":1747,"text":"_element_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":1766,"id":7126,"name":"refposition","nodeType":"Attribute","startLoc":1766,"text":"self.refposition"},{"attributeType":"null","col":8,"comment":"null","endLoc":46,"id":7127,"name":"_method_name","nodeType":"Attribute","startLoc":46,"text":"self._method_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":45,"id":7128,"name":"_cls","nodeType":"Attribute","startLoc":45,"text":"self._cls"},{"col":4,"comment":"\n        Update the docstring to include all the available readers / writers for\n        the ``data_class.read``/``data_class.write`` functions (respectively).\n        Don't update if the data_class does not have the relevant method.\n        ","endLoc":447,"header":"def _update__doc__(self, data_class, readwrite)","id":7129,"name":"_update__doc__","nodeType":"Function","startLoc":381,"text":"def _update__doc__(self, data_class, readwrite):\n        \"\"\"\n        Update the docstring to include all the available readers / writers for\n        the ``data_class.read``/``data_class.write`` functions (respectively).\n        Don't update if the data_class does not have the relevant method.\n        \"\"\"\n        # abort if method \"readwrite\" isn't on data_class\n        if not hasattr(data_class, readwrite):\n            return\n\n        from .interface import UnifiedReadWrite\n\n        FORMATS_TEXT = 'The available built-in formats are:'\n\n        # Get the existing read or write method and its docstring\n        class_readwrite_func = getattr(data_class, readwrite)\n\n        if not isinstance(class_readwrite_func.__doc__, str):\n            # No docstring--could just be test code, or possibly code compiled\n            # without docstrings\n            return\n\n        lines = class_readwrite_func.__doc__.splitlines()\n\n        # Find the location of the existing formats table if it exists\n        sep_indices = [ii for ii, line in enumerate(lines) if FORMATS_TEXT in line]\n        if sep_indices:\n            # Chop off the existing formats table, including the initial blank line\n            chop_index = sep_indices[0]\n            lines = lines[:chop_index]\n\n        # Find the minimum indent, skipping the first line because it might be odd\n        matches = [re.search(r'(\\S)', line) for line in lines[1:]]\n        left_indent = ' ' * min(match.start() for match in matches if match)\n\n        # Get the available unified I/O formats for this class\n        # Include only formats that have a reader, and drop the 'Data class' column\n        format_table = self.get_formats(data_class, readwrite.capitalize())\n        format_table.remove_column('Data class')\n\n        # Get the available formats as a table, then munge the output of pformat()\n        # a bit and put it into the docstring.\n        new_lines = format_table.pformat(max_lines=-1, max_width=80)\n        table_rst_sep = re.sub('-', '=', new_lines[1])\n        new_lines[1] = table_rst_sep\n        new_lines.insert(0, table_rst_sep)\n        new_lines.append(table_rst_sep)\n\n        # Check for deprecated names and include a warning at the end.\n        if 'Deprecated' in format_table.colnames:\n            new_lines.extend(['',\n                              'Deprecated format names like ``aastex`` will be '\n                              'removed in a future version. Use the full ',\n                              'name (e.g. ``ascii.aastex``) instead.'])\n\n        new_lines = [FORMATS_TEXT, ''] + new_lines\n        lines.extend([left_indent + line for line in new_lines])\n\n        # Depending on Python version and whether class_readwrite_func is\n        # an instancemethod or classmethod, one of the following will work.\n        if isinstance(class_readwrite_func, UnifiedReadWrite):\n            class_readwrite_func.__class__.__doc__ = '\\n'.join(lines)\n        else:\n            try:\n                class_readwrite_func.__doc__ = '\\n'.join(lines)\n            except AttributeError:\n                class_readwrite_func.__func__.__doc__ = '\\n'.join(lines)"},{"attributeType":"null","col":8,"comment":"null","endLoc":43,"id":7130,"name":"_registry","nodeType":"Attribute","startLoc":43,"text":"self._registry"},{"attributeType":"null","col":8,"comment":"null","endLoc":44,"id":7131,"name":"_instance","nodeType":"Attribute","startLoc":44,"text":"self._instance"},{"className":"UnifiedReadWriteMethod","col":0,"comment":"Descriptor class for creating read() and write() methods in unified I/O.\n\n    The canonical example is in the ``Table`` class, where the ``connect.py``\n    module creates subclasses of the ``UnifiedReadWrite`` class.  These have\n    custom ``__call__`` methods that do the setup work related to calling the\n    registry read() or write() functions.  With this, the ``Table`` class\n    defines read and write methods as follows::\n\n      read = UnifiedReadWriteMethod(TableRead)\n      write = UnifiedReadWriteMethod(TableWrite)\n\n    Parameters\n    ----------\n    func : `~astropy.io.registry.UnifiedReadWrite` subclass\n        Class that defines read or write functionality\n\n    ","endLoc":147,"id":7132,"nodeType":"Class","startLoc":121,"text":"class UnifiedReadWriteMethod(property):\n    \"\"\"Descriptor class for creating read() and write() methods in unified I/O.\n\n    The canonical example is in the ``Table`` class, where the ``connect.py``\n    module creates subclasses of the ``UnifiedReadWrite`` class.  These have\n    custom ``__call__`` methods that do the setup work related to calling the\n    registry read() or write() functions.  With this, the ``Table`` class\n    defines read and write methods as follows::\n\n      read = UnifiedReadWriteMethod(TableRead)\n      write = UnifiedReadWriteMethod(TableWrite)\n\n    Parameters\n    ----------\n    func : `~astropy.io.registry.UnifiedReadWrite` subclass\n        Class that defines read or write functionality\n\n    \"\"\"\n    # We subclass property to ensure that __set__ is defined and that,\n    # therefore, we are a data descriptor, which cannot be overridden.\n    # This also means we automatically inherit the __doc__ of fget (which will\n    # be a UnifiedReadWrite subclass), and that this docstring gets recognized\n    # and properly typeset by sphinx (which was previously an issue; see\n    # gh-11554).\n    # We override __get__ to pass both instance and class to UnifiedReadWrite.\n    def __get__(self, instance, owner_cls):\n        return self.fget(instance, owner_cls)"},{"col":4,"comment":"null","endLoc":147,"header":"def __get__(self, instance, owner_cls)","id":7133,"name":"__get__","nodeType":"Function","startLoc":146,"text":"def __get__(self, instance, owner_cls):\n        return self.fget(instance, owner_cls)"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":7134,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"interface.py#<anonymous>","id":7135,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['UnifiedReadWriteMethod', 'UnifiedReadWrite']"},{"col":4,"comment":"\n        Determine if class2 is the \"best\" match for class1 in the list\n        of classes.  It is assumed that (class2 in classes) is True.\n        class2 is the the best match if:\n\n        - ``class1`` is a subclass of ``class2`` AND\n        - ``class2`` is the nearest ancestor of ``class1`` that is in classes\n          (which includes the case that ``class1 is class2``)\n        ","endLoc":326,"header":"def _is_best_match(self, class1, class2, format_classes)","id":7136,"name":"_is_best_match","nodeType":"Function","startLoc":309,"text":"def _is_best_match(self, class1, class2, format_classes):\n        \"\"\"\n        Determine if class2 is the \"best\" match for class1 in the list\n        of classes.  It is assumed that (class2 in classes) is True.\n        class2 is the the best match if:\n\n        - ``class1`` is a subclass of ``class2`` AND\n        - ``class2`` is the nearest ancestor of ``class1`` that is in classes\n          (which includes the case that ``class1 is class2``)\n        \"\"\"\n        if issubclass(class1, class2):\n            classes = {cls for fmt, cls in format_classes}\n            for parent in class1.__mro__:\n                if parent is class2:  # class2 is closest registered ancestor\n                    return True\n                if parent in classes:  # class2 was superceded\n                    return False\n        return False"},{"col":0,"comment":"null","endLoc":15,"header":"def _fix(content, indent=0)","id":7137,"name":"_fix","nodeType":"Function","startLoc":12,"text":"def _fix(content, indent=0):\n    lines = content.split('\\n')\n    indent = '\\n' + ' ' * indent\n    return indent.join(lines)"},{"col":4,"comment":"\n        Unregister a reader function\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier.\n        data_class : class\n            The class of the object that the reader produces.\n        ","endLoc":119,"header":"def unregister_reader(self, data_format, data_class)","id":7138,"name":"unregister_reader","nodeType":"Function","startLoc":100,"text":"def unregister_reader(self, data_format, data_class):\n        \"\"\"\n        Unregister a reader function\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier.\n        data_class : class\n            The class of the object that the reader produces.\n        \"\"\"\n\n        if (data_format, data_class) in self._readers:\n            self._readers.pop((data_format, data_class))\n        else:\n            raise IORegistryError(\"No reader defined for format '{}' and class '{}'\"\n                                  ''.format(data_format, data_class.__name__))\n\n        if data_class not in self._delayed_docs_classes:\n            self._update__doc__(data_class, 'read')"},{"fileName":"setup_package.py","filePath":"astropy/wcs","id":7139,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport io\nimport os\nfrom os.path import join\nimport os.path\nimport shutil\nimport sys\nfrom collections import defaultdict\n\nfrom setuptools import Extension\nfrom setuptools.dep_util import newer_group\n\nimport numpy\n\nfrom extension_helpers import import_file, write_if_different, get_compiler, pkg_config\n\nWCSROOT = os.path.relpath(os.path.dirname(__file__))\nWCSVERSION = \"7.7\"\n\n\ndef b(s):\n    return s.encode('ascii')\n\n\ndef string_escape(s):\n    s = s.decode('ascii').encode('ascii', 'backslashreplace')\n    s = s.replace(b'\\n', b'\\\\n')\n    s = s.replace(b'\\0', b'\\\\0')\n    return s.decode('ascii')\n\n\ndef determine_64_bit_int():\n    \"\"\"\n    The only configuration parameter needed at compile-time is how to\n    specify a 64-bit signed integer.  Python's ctypes module can get us\n    that information.\n    If we can't be absolutely certain, we default to \"long long int\",\n    which is correct on most platforms (x86, x86_64).  If we find\n    platforms where this heuristic doesn't work, we may need to\n    hardcode for them.\n    \"\"\"\n    try:\n        try:\n            import ctypes\n        except ImportError:\n            raise ValueError()\n\n        if ctypes.sizeof(ctypes.c_longlong) == 8:\n            return \"long long int\"\n        elif ctypes.sizeof(ctypes.c_long) == 8:\n            return \"long int\"\n        elif ctypes.sizeof(ctypes.c_int) == 8:\n            return \"int\"\n        else:\n            raise ValueError()\n\n    except ValueError:\n        return \"long long int\"\n\n\ndef write_wcsconfig_h(paths):\n    \"\"\"\n    Writes out the wcsconfig.h header with local configuration.\n    \"\"\"\n    h_file = io.StringIO()\n    h_file.write(\"\"\"\n    /* The bundled version has WCSLIB_VERSION */\n    #define HAVE_WCSLIB_VERSION 1\n\n    /* WCSLIB library version number. */\n    #define WCSLIB_VERSION {}\n\n    /* 64-bit integer data type. */\n    #define WCSLIB_INT64 {}\n\n    /* Windows needs some other defines to prevent inclusion of wcsset()\n       which conflicts with wcslib's wcsset().  These need to be set\n       on code that *uses* astropy.wcs, in addition to astropy.wcs itself.\n       */\n    #if defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) || defined (__MINGW64__)\n\n    #ifndef YY_NO_UNISTD_H\n    #define YY_NO_UNISTD_H\n    #endif\n\n    #ifndef _CRT_SECURE_NO_WARNINGS\n    #define _CRT_SECURE_NO_WARNINGS\n    #endif\n\n    #ifndef _NO_OLDNAMES\n    #define _NO_OLDNAMES\n    #endif\n\n    #ifndef NO_OLDNAMES\n    #define NO_OLDNAMES\n    #endif\n\n    #ifndef __STDC__\n    #define __STDC__ 1\n    #endif\n\n    #endif\n    \"\"\".format(WCSVERSION, determine_64_bit_int()))\n    content = h_file.getvalue().encode('ascii')\n    for path in paths:\n        write_if_different(path, content)\n\n\n######################################################################\n# GENERATE DOCSTRINGS IN C\n\n\ndef generate_c_docstrings():\n    docstrings = import_file(os.path.join(WCSROOT, 'docstrings.py'))\n    docstrings = docstrings.__dict__\n    keys = [\n        key for key, val in docstrings.items()\n        if not key.startswith('__') and isinstance(val, str)]\n    keys.sort()\n    docs = {}\n    for key in keys:\n        docs[key] = docstrings[key].encode('utf8').lstrip() + b'\\0'\n\n    h_file = io.StringIO()\n    h_file.write(\"\"\"/*\nDO NOT EDIT!\n\nThis file is autogenerated by astropy/wcs/setup_package.py.  To edit\nits contents, edit astropy/wcs/docstrings.py\n*/\n\n#ifndef __DOCSTRINGS_H__\n#define __DOCSTRINGS_H__\n\n\"\"\")\n    for key in keys:\n        val = docs[key]\n        h_file.write(f'extern char doc_{key}[{len(val)}];\\n')\n    h_file.write(\"\\n#endif\\n\\n\")\n\n    write_if_different(\n        join(WCSROOT, 'include', 'astropy_wcs', 'docstrings.h'),\n        h_file.getvalue().encode('utf-8'))\n\n    c_file = io.StringIO()\n    c_file.write(\"\"\"/*\nDO NOT EDIT!\n\nThis file is autogenerated by astropy/wcs/setup_package.py.  To edit\nits contents, edit astropy/wcs/docstrings.py\n\nThe weirdness here with strncpy is because some C compilers, notably\nMSVC, do not support string literals greater than 256 characters.\n*/\n\n#include <string.h>\n#include \"astropy_wcs/docstrings.h\"\n\n\"\"\")\n    for key in keys:\n        val = docs[key]\n        c_file.write(f'char doc_{key}[{len(val)}] = {{\\n')\n        for i in range(0, len(val), 12):\n            section = val[i:i+12]\n            c_file.write('    ')\n            c_file.write(''.join(f'0x{x:02x}, ' for x in section))\n            c_file.write('\\n')\n\n        c_file.write(\"    };\\n\\n\")\n\n    write_if_different(\n        join(WCSROOT, 'src', 'docstrings.c'),\n        c_file.getvalue().encode('utf-8'))\n\n\ndef get_wcslib_cfg(cfg, wcslib_files, include_paths):\n\n    debug = '--debug' in sys.argv\n\n    cfg['include_dirs'].append(numpy.get_include())\n    cfg['define_macros'].extend([\n        ('ECHO', None),\n        ('WCSTRIG_MACRO', None),\n        ('ASTROPY_WCS_BUILD', None),\n        ('_GNU_SOURCE', None)])\n\n    if ((int(os.environ.get('ASTROPY_USE_SYSTEM_WCSLIB', 0))\n            or int(os.environ.get('ASTROPY_USE_SYSTEM_ALL', 0)))\n            and not sys.platform == 'win32'):\n        wcsconfig_h_path = join(WCSROOT, 'include', 'wcsconfig.h')\n        if os.path.exists(wcsconfig_h_path):\n            os.unlink(wcsconfig_h_path)\n        for k, v in pkg_config(['wcslib'], ['wcs']).items():\n            cfg[k].extend(v)\n    else:\n        write_wcsconfig_h(include_paths)\n\n        wcslib_path = join(\"cextern\", \"wcslib\")  # Path to wcslib\n        wcslib_cpath = join(wcslib_path, \"C\")  # Path to wcslib source files\n        cfg['sources'].extend(join(wcslib_cpath, x) for x in wcslib_files)\n        cfg['include_dirs'].append(wcslib_cpath)\n\n    if debug:\n        cfg['define_macros'].append(('DEBUG', None))\n        cfg['undef_macros'].append('NDEBUG')\n        if (not sys.platform.startswith('sun') and\n                not sys.platform == 'win32'):\n            cfg['extra_compile_args'].extend([\"-fno-inline\", \"-O0\", \"-g\"])\n    else:\n        # Define ECHO as nothing to prevent spurious newlines from\n        # printing within the libwcs parser\n        cfg['define_macros'].append(('NDEBUG', None))\n        cfg['undef_macros'].append('DEBUG')\n\n    if sys.platform == 'win32':\n        # These are written into wcsconfig.h, but that file is not\n        # used by all parts of wcslib.\n        cfg['define_macros'].extend([\n            ('YY_NO_UNISTD_H', None),\n            ('_CRT_SECURE_NO_WARNINGS', None),\n            ('_NO_OLDNAMES', None),  # for mingw32\n            ('NO_OLDNAMES', None),  # for mingw64\n            ('__STDC__', None)  # for MSVC\n        ])\n\n    if sys.platform.startswith('linux'):\n        cfg['define_macros'].append(('HAVE_SINCOS', None))\n\n    # For 4.7+ enable C99 syntax in older compilers (need 'gnu99' std for gcc)\n    if get_compiler() == 'unix':\n        cfg['extra_compile_args'].extend(['-std=gnu99'])\n\n    # Squelch a few compilation warnings in WCSLIB\n    if get_compiler() in ('unix', 'mingw32'):\n        if not debug:\n            cfg['extra_compile_args'].extend([\n                '-Wno-strict-prototypes',\n                '-Wno-unused-function',\n                '-Wno-unused-value',\n                '-Wno-uninitialized'])\n\n\ndef get_extensions():\n    generate_c_docstrings()\n\n    ######################################################################\n    # DISTUTILS SETUP\n    cfg = defaultdict(list)\n\n    wcslib_files = [  # List of wcslib files to compile\n        'flexed/wcsbth.c',\n        'flexed/wcspih.c',\n        'flexed/wcsulex.c',\n        'flexed/wcsutrn.c',\n        'cel.c',\n        'dis.c',\n        'lin.c',\n        'log.c',\n        'prj.c',\n        'spc.c',\n        'sph.c',\n        'spx.c',\n        'tab.c',\n        'wcs.c',\n        'wcserr.c',\n        'wcsfix.c',\n        'wcshdr.c',\n        'wcsprintf.c',\n        'wcsunits.c',\n        'wcsutil.c'\n    ]\n\n    wcslib_config_paths = [\n        join(WCSROOT, 'include', 'astropy_wcs', 'wcsconfig.h'),\n        join(WCSROOT, 'include', 'wcsconfig.h')\n    ]\n\n    get_wcslib_cfg(cfg, wcslib_files, wcslib_config_paths)\n\n    cfg['include_dirs'].append(join(WCSROOT, \"include\"))\n\n    astropy_wcs_files = [  # List of astropy.wcs files to compile\n        'distortion.c',\n        'distortion_wrap.c',\n        'docstrings.c',\n        'pipeline.c',\n        'pyutil.c',\n        'astropy_wcs.c',\n        'astropy_wcs_api.c',\n        'sip.c',\n        'sip_wrap.c',\n        'str_list_proxy.c',\n        'unit_list_proxy.c',\n        'util.c',\n        'wcslib_wrap.c',\n        'wcslib_auxprm_wrap.c',\n        'wcslib_prjprm_wrap.c',\n        'wcslib_celprm_wrap.c',\n        'wcslib_tabprm_wrap.c',\n        'wcslib_wtbarr_wrap.c'\n    ]\n    cfg['sources'].extend(join(WCSROOT, 'src', x) for x in astropy_wcs_files)\n\n    cfg['sources'] = [str(x) for x in cfg['sources']]\n    cfg = dict((str(key), val) for key, val in cfg.items())\n\n    # Copy over header files from WCSLIB into the installed version of Astropy\n    # so that other Python packages can write extensions that link to it. We\n    # do the copying here then include the data in [options.package_data] in\n    # the setup.cfg file\n\n    wcslib_headers = [\n        'cel.h',\n        'lin.h',\n        'prj.h',\n        'spc.h',\n        'spx.h',\n        'tab.h',\n        'wcs.h',\n        'wcserr.h',\n        'wcsmath.h',\n        'wcsprintf.h',\n    ]\n\n    if not (int(os.environ.get('ASTROPY_USE_SYSTEM_WCSLIB', 0))\n            or int(os.environ.get('ASTROPY_USE_SYSTEM_ALL', 0))):\n        for header in wcslib_headers:\n            source = join('cextern', 'wcslib', 'C', header)\n            dest = join('astropy', 'wcs', 'include', 'wcslib', header)\n            if newer_group([source], dest, 'newer'):\n                shutil.copy(source, dest)\n\n    return [Extension('astropy.wcs._wcs', **cfg)]\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":1754,"id":7140,"name":"_pos","nodeType":"Attribute","startLoc":1754,"text":"self._pos"},{"col":4,"comment":"Get reader for ``data_format``.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that is used to\n            specify the data type when reading/writing.\n        data_class : class\n            The class of the object that can be written.\n\n        Returns\n        -------\n        reader : callable\n            The registered reader function for this format and class.\n        ","endLoc":146,"header":"def get_reader(self, data_format, data_class)","id":7141,"name":"get_reader","nodeType":"Function","startLoc":121,"text":"def get_reader(self, data_format, data_class):\n        \"\"\"Get reader for ``data_format``.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that is used to\n            specify the data type when reading/writing.\n        data_class : class\n            The class of the object that can be written.\n\n        Returns\n        -------\n        reader : callable\n            The registered reader function for this format and class.\n        \"\"\"\n        readers = [(fmt, cls) for fmt, cls in self._readers if fmt == data_format]\n        for reader_format, reader_class in readers:\n            if self._is_best_match(data_class, reader_class, readers):\n                return self._readers[(reader_format, reader_class)][0]\n        else:\n            format_table_str = self._get_format_table_str(data_class, 'Read')\n            raise IORegistryError(\n                \"No reader defined for format '{}' and class '{}'.\\n\\nThe \"\n                \"available formats are:\\n\\n{}\".format(\n                    data_format, data_class.__name__, format_table_str))"},{"attributeType":"null","col":8,"comment":"null","endLoc":1849,"id":7142,"name":"_refposition","nodeType":"Attribute","startLoc":1849,"text":"self._refposition"},{"attributeType":"null","col":8,"comment":"null","endLoc":1763,"id":7143,"name":"ID","nodeType":"Attribute","startLoc":1763,"text":"self.ID"},{"col":4,"comment":"``get_formats()``, without column \"Data class\", as a str.","endLoc":307,"header":"def _get_format_table_str(self, data_class, filter_on)","id":7144,"name":"_get_format_table_str","nodeType":"Function","startLoc":302,"text":"def _get_format_table_str(self, data_class, filter_on):\n        \"\"\"``get_formats()``, without column \"Data class\", as a str.\"\"\"\n        format_table = self.get_formats(data_class, filter_on)\n        format_table.remove_column('Data class')\n        format_table_str = '\\n'.join(format_table.pformat(max_lines=-1))\n        return format_table_str"},{"attributeType":"None","col":8,"comment":"null","endLoc":1785,"id":7145,"name":"_ID","nodeType":"Attribute","startLoc":1785,"text":"self._ID"},{"col":0,"comment":"null","endLoc":23,"header":"def b(s)","id":7146,"name":"b","nodeType":"Function","startLoc":22,"text":"def b(s):\n    return s.encode('ascii')"},{"attributeType":"null","col":8,"comment":"null","endLoc":1764,"id":7147,"name":"timeorigin","nodeType":"Attribute","startLoc":1764,"text":"self.timeorigin"},{"attributeType":"null","col":8,"comment":"null","endLoc":1765,"id":7148,"name":"timescale","nodeType":"Attribute","startLoc":1765,"text":"self.timescale"},{"col":0,"comment":"null","endLoc":30,"header":"def string_escape(s)","id":7149,"name":"string_escape","nodeType":"Function","startLoc":26,"text":"def string_escape(s):\n    s = s.decode('ascii').encode('ascii', 'backslashreplace')\n    s = s.replace(b'\\n', b'\\\\n')\n    s = s.replace(b'\\0', b'\\\\0')\n    return s.decode('ascii')"},{"attributeType":"None","col":8,"comment":"null","endLoc":1815,"id":7150,"name":"_timeorigin","nodeType":"Attribute","startLoc":1815,"text":"self._timeorigin"},{"col":4,"comment":"Contextmanager to disable documentation updates when registering\n        reader and writer. The documentation is only built once when the\n        contextmanager exits.\n\n        .. versionadded:: 1.3\n\n        Parameters\n        ----------\n        cls : class\n            Class for which the documentation updates should be delayed.\n\n        Notes\n        -----\n        Registering multiple readers and writers can cause significant overhead\n        because the documentation of the corresponding ``read`` and ``write``\n        methods are build every time.\n\n        Examples\n        --------\n        see for example the source code of ``astropy.table.__init__``.\n        ","endLoc":184,"header":"@contextlib.contextmanager\n    def delay_doc_updates(self, cls)","id":7151,"name":"delay_doc_updates","nodeType":"Function","startLoc":155,"text":"@contextlib.contextmanager\n    def delay_doc_updates(self, cls):\n        \"\"\"Contextmanager to disable documentation updates when registering\n        reader and writer. The documentation is only built once when the\n        contextmanager exits.\n\n        .. versionadded:: 1.3\n\n        Parameters\n        ----------\n        cls : class\n            Class for which the documentation updates should be delayed.\n\n        Notes\n        -----\n        Registering multiple readers and writers can cause significant overhead\n        because the documentation of the corresponding ``read`` and ``write``\n        methods are build every time.\n\n        Examples\n        --------\n        see for example the source code of ``astropy.table.__init__``.\n        \"\"\"\n        self._delayed_docs_classes.add(cls)\n\n        yield\n\n        self._delayed_docs_classes.discard(cls)\n        for method in self._registries.keys() - {\"identify\"}:\n            self._update__doc__(cls, method)"},{"col":4,"comment":"\n        Read in data.\n\n        Parameters\n        ----------\n        cls : class\n        *args\n            The arguments passed to this method depend on the format.\n        format : str or None\n        cache : bool\n            Whether to cache the results of reading in the data.\n        **kwargs\n            The arguments passed to this method depend on the format.\n\n        Returns\n        -------\n        object or None\n            The output of the registered reader.\n        ","endLoc":214,"header":"def read(self, cls, *args, format=None, cache=False, **kwargs)","id":7152,"name":"read","nodeType":"Function","startLoc":148,"text":"def read(self, cls, *args, format=None, cache=False, **kwargs):\n        \"\"\"\n        Read in data.\n\n        Parameters\n        ----------\n        cls : class\n        *args\n            The arguments passed to this method depend on the format.\n        format : str or None\n        cache : bool\n            Whether to cache the results of reading in the data.\n        **kwargs\n            The arguments passed to this method depend on the format.\n\n        Returns\n        -------\n        object or None\n            The output of the registered reader.\n        \"\"\"\n        ctx = None\n        try:\n            if format is None:\n                path = None\n                fileobj = None\n\n                if len(args):\n                    if isinstance(args[0], PATH_TYPES) and not os.path.isdir(args[0]):\n                        from astropy.utils.data import get_readable_fileobj\n\n                        # path might be a os.PathLike object\n                        if isinstance(args[0], os.PathLike):\n                            args = (os.fspath(args[0]),) + args[1:]\n                        path = args[0]\n                        try:\n                            ctx = get_readable_fileobj(args[0], encoding='binary', cache=cache)\n                            fileobj = ctx.__enter__()\n                        except OSError:\n                            raise\n                        except Exception:\n                            fileobj = None\n                        else:\n                            args = [fileobj] + list(args[1:])\n                    elif hasattr(args[0], 'read'):\n                        path = None\n                        fileobj = args[0]\n\n                format = self._get_valid_format(\n                    'read', cls, path, fileobj, args, kwargs)\n\n            reader = self.get_reader(format, cls)\n            data = reader(*args, **kwargs)\n\n            if not isinstance(data, cls):\n                # User has read with a subclass where only the parent class is\n                # registered.  This returns the parent class, so try coercing\n                # to desired subclass.\n                try:\n                    data = cls(data)\n                except Exception:\n                    raise TypeError('could not convert reader output to {} '\n                                    'class.'.format(cls.__name__))\n        finally:\n            if ctx is not None:\n                ctx.__exit__(*sys.exc_info())\n\n        return data"},{"attributeType":"null","col":8,"comment":"null","endLoc":1832,"id":7153,"name":"_timescale","nodeType":"Attribute","startLoc":1832,"text":"self._timescale"},{"col":4,"comment":"\n        Associate an identifier function with a specific data type.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that is used to\n            specify the data type when reading/writing.\n        data_class : class\n            The class of the object that can be written.\n        identifier : function\n            A function that checks the argument specified to `read` or `write` to\n            determine whether the input can be interpreted as a table of type\n            ``data_format``. This function should take the following arguments:\n\n               - ``origin``: A string ``\"read\"`` or ``\"write\"`` identifying whether\n                 the file is to be opened for reading or writing.\n               - ``path``: The path to the file.\n               - ``fileobj``: An open file object to read the file's contents, or\n                 `None` if the file could not be opened.\n               - ``*args``: Positional arguments for the `read` or `write`\n                 function.\n               - ``**kwargs``: Keyword arguments for the `read` or `write`\n                 function.\n\n            One or both of ``path`` or ``fileobj`` may be `None`.  If they are\n            both `None`, the identifier will need to work from ``args[0]``.\n\n            The function should return True if the input can be identified\n            as being of format ``data_format``, and False otherwise.\n        force : bool, optional\n            Whether to override any existing function if already present.\n            Default is ``False``.\n\n        Examples\n        --------\n        To set the identifier based on extensions, for formats that take a\n        filename as a first argument, you can do for example\n\n        .. code-block:: python\n\n            from astropy.io.registry import register_identifier\n            from astropy.table import Table\n            def my_identifier(*args, **kwargs):\n                return isinstance(args[0], str) and args[0].endswith('.tbl')\n            register_identifier('ipac', Table, my_identifier)\n            unregister_identifier('ipac', Table)\n        ","endLoc":243,"header":"def register_identifier(self, data_format, data_class, identifier, force=False)","id":7154,"name":"register_identifier","nodeType":"Function","startLoc":189,"text":"def register_identifier(self, data_format, data_class, identifier, force=False):\n        \"\"\"\n        Associate an identifier function with a specific data type.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that is used to\n            specify the data type when reading/writing.\n        data_class : class\n            The class of the object that can be written.\n        identifier : function\n            A function that checks the argument specified to `read` or `write` to\n            determine whether the input can be interpreted as a table of type\n            ``data_format``. This function should take the following arguments:\n\n               - ``origin``: A string ``\"read\"`` or ``\"write\"`` identifying whether\n                 the file is to be opened for reading or writing.\n               - ``path``: The path to the file.\n               - ``fileobj``: An open file object to read the file's contents, or\n                 `None` if the file could not be opened.\n               - ``*args``: Positional arguments for the `read` or `write`\n                 function.\n               - ``**kwargs``: Keyword arguments for the `read` or `write`\n                 function.\n\n            One or both of ``path`` or ``fileobj`` may be `None`.  If they are\n            both `None`, the identifier will need to work from ``args[0]``.\n\n            The function should return True if the input can be identified\n            as being of format ``data_format``, and False otherwise.\n        force : bool, optional\n            Whether to override any existing function if already present.\n            Default is ``False``.\n\n        Examples\n        --------\n        To set the identifier based on extensions, for formats that take a\n        filename as a first argument, you can do for example\n\n        .. code-block:: python\n\n            from astropy.io.registry import register_identifier\n            from astropy.table import Table\n            def my_identifier(*args, **kwargs):\n                return isinstance(args[0], str) and args[0].endswith('.tbl')\n            register_identifier('ipac', Table, my_identifier)\n            unregister_identifier('ipac', Table)\n        \"\"\"\n        if not (data_format, data_class) in self._identifiers or force:\n            self._identifiers[(data_format, data_class)] = identifier\n        else:\n            raise IORegistryError(\"Identifier for format '{}' and class '{}' is \"\n                                  'already defined'.format(data_format,\n                                                           data_class.__name__))"},{"col":4,"comment":"\n        Unregister an identifier function\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier.\n        data_class : class\n            The class of the object that can be read/written.\n        ","endLoc":260,"header":"def unregister_identifier(self, data_format, data_class)","id":7155,"name":"unregister_identifier","nodeType":"Function","startLoc":245,"text":"def unregister_identifier(self, data_format, data_class):\n        \"\"\"\n        Unregister an identifier function\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier.\n        data_class : class\n            The class of the object that can be read/written.\n        \"\"\"\n        if (data_format, data_class) in self._identifiers:\n            self._identifiers.pop((data_format, data_class))\n        else:\n            raise IORegistryError(\"No identifier defined for format '{}' and class\"\n                                  \" '{}'\".format(data_format, data_class.__name__))"},{"attributeType":"{__getitem__} | None","col":8,"comment":"null","endLoc":1753,"id":7156,"name":"_config","nodeType":"Attribute","startLoc":1753,"text":"self._config"},{"className":"FieldRef","col":0,"comment":"\n    FIELDref_ element: used inside of GROUP_ elements to refer to remote FIELD_ elements.\n    ","endLoc":1919,"id":7157,"nodeType":"Class","startLoc":1856,"text":"class FieldRef(SimpleElement, _UtypeProperty, _UcdProperty):\n    \"\"\"\n    FIELDref_ element: used inside of GROUP_ elements to refer to remote FIELD_ elements.\n    \"\"\"\n    _attr_list_11 = ['ref']\n    _attr_list_12 = _attr_list_11 + ['ucd', 'utype']\n    _element_name = \"FIELDref\"\n    _utype_in_v1_2 = True\n    _ucd_in_v1_2 = True\n\n    def __init__(self, table, ref, ucd=None, utype=None, config=None, pos=None,\n                 **extra):\n        \"\"\"\n        *table* is the :class:`Table` object that this :class:`FieldRef`\n        is a member of.\n\n        *ref* is the ID to reference a :class:`Field` object defined\n        elsewhere.\n        \"\"\"\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        SimpleElement.__init__(self)\n        self._table = table\n        self.ref = ref\n        self.ucd = ucd\n        self.utype = utype\n\n        if config.get('version_1_2_or_later'):\n            self._attr_list = self._attr_list_12\n        else:\n            self._attr_list = self._attr_list_11\n            if ucd is not None:\n                warn_unknown_attrs(self._element_name, ['ucd'], config, pos)\n            if utype is not None:\n                warn_unknown_attrs(self._element_name, ['utype'], config, pos)\n\n    @property\n    def ref(self):\n        \"\"\"The ID_ of the FIELD_ that this FIELDref_ references.\"\"\"\n        return self._ref\n\n    @ref.setter\n    def ref(self, ref):\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        self._ref = ref\n\n    @ref.deleter\n    def ref(self):\n        self._ref = None\n\n    def get_ref(self):\n        \"\"\"\n        Lookup the :class:`Field` instance that this :class:`FieldRef`\n        references.\n        \"\"\"\n        for field in self._table._votable.iter_fields_and_params():\n            if isinstance(field, Field) and field.ID == self.ref:\n                return field\n        vo_raise(\n            f\"No field named '{self.ref}'\",\n            self._config, self._pos, KeyError)"},{"col":0,"comment":"null","endLoc":33,"header":"def TWO_OR_MORE_ARGS(naxis, indent=0)","id":7158,"name":"TWO_OR_MORE_ARGS","nodeType":"Function","startLoc":18,"text":"def TWO_OR_MORE_ARGS(naxis, indent=0):\n    return _fix(\nf\"\"\"*args\n    There are two accepted forms for the positional arguments:\n\n        - 2 arguments: An *N* x *{naxis}* array of coordinates, and an\n          *origin*.\n\n        - more than 2 arguments: An array for each axis, followed by\n          an *origin*.  These arrays must be broadcastable to one\n          another.\n\n    Here, *origin* is the coordinate in the upper left corner of the\n    image.  In FITS and Fortran standards, this is 1.  In Numpy and C\n    standards this is 0.\n\"\"\", indent)"},{"col":4,"comment":"Loop through identifiers to see which formats match.\n\n        Parameters\n        ----------\n        origin : str\n            A string ``\"read`` or ``\"write\"`` identifying whether the file is to be\n            opened for reading or writing.\n        data_class_required : object\n            The specified class for the result of `read` or the class that is to be\n            written.\n        path : str or path-like or None\n            The path to the file or None.\n        fileobj : file-like or None.\n            An open file object to read the file's contents, or ``None`` if the\n            file could not be opened.\n        args : sequence\n            Positional arguments for the `read` or `write` function. Note that\n            these must be provided as sequence.\n        kwargs : dict-like\n            Keyword arguments for the `read` or `write` function. Note that this\n            parameter must be `dict`-like.\n\n        Returns\n        -------\n        valid_formats : list\n            List of matching formats.\n        ","endLoc":297,"header":"def identify_format(self, origin, data_class_required, path, fileobj, args, kwargs)","id":7159,"name":"identify_format","nodeType":"Function","startLoc":262,"text":"def identify_format(self, origin, data_class_required, path, fileobj, args, kwargs):\n        \"\"\"Loop through identifiers to see which formats match.\n\n        Parameters\n        ----------\n        origin : str\n            A string ``\"read`` or ``\"write\"`` identifying whether the file is to be\n            opened for reading or writing.\n        data_class_required : object\n            The specified class for the result of `read` or the class that is to be\n            written.\n        path : str or path-like or None\n            The path to the file or None.\n        fileobj : file-like or None.\n            An open file object to read the file's contents, or ``None`` if the\n            file could not be opened.\n        args : sequence\n            Positional arguments for the `read` or `write` function. Note that\n            these must be provided as sequence.\n        kwargs : dict-like\n            Keyword arguments for the `read` or `write` function. Note that this\n            parameter must be `dict`-like.\n\n        Returns\n        -------\n        valid_formats : list\n            List of matching formats.\n        \"\"\"\n        valid_formats = []\n        for data_format, data_class in self._identifiers:\n            if self._is_best_match(data_class_required, data_class, self._identifiers):\n                if self._identifiers[(data_format, data_class)](\n                        origin, path, fileobj, *args, **kwargs):\n                    valid_formats.append(data_format)\n\n        return valid_formats"},{"col":4,"comment":"\n        *table* is the :class:`Table` object that this :class:`FieldRef`\n        is a member of.\n\n        *ref* is the ID to reference a :class:`Field` object defined\n        elsewhere.\n        ","endLoc":1893,"header":"def __init__(self, table, ref, ucd=None, utype=None, config=None, pos=None,\n                 **extra)","id":7160,"name":"__init__","nodeType":"Function","startLoc":1866,"text":"def __init__(self, table, ref, ucd=None, utype=None, config=None, pos=None,\n                 **extra):\n        \"\"\"\n        *table* is the :class:`Table` object that this :class:`FieldRef`\n        is a member of.\n\n        *ref* is the ID to reference a :class:`Field` object defined\n        elsewhere.\n        \"\"\"\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        SimpleElement.__init__(self)\n        self._table = table\n        self.ref = ref\n        self.ucd = ucd\n        self.utype = utype\n\n        if config.get('version_1_2_or_later'):\n            self._attr_list = self._attr_list_12\n        else:\n            self._attr_list = self._attr_list_11\n            if ucd is not None:\n                warn_unknown_attrs(self._element_name, ['ucd'], config, pos)\n            if utype is not None:\n                warn_unknown_attrs(self._element_name, ['utype'], config, pos)"},{"col":0,"comment":"\n    The only configuration parameter needed at compile-time is how to\n    specify a 64-bit signed integer.  Python's ctypes module can get us\n    that information.\n    If we can't be absolutely certain, we default to \"long long int\",\n    which is correct on most platforms (x86, x86_64).  If we find\n    platforms where this heuristic doesn't work, we may need to\n    hardcode for them.\n    ","endLoc":59,"header":"def determine_64_bit_int()","id":7161,"name":"determine_64_bit_int","nodeType":"Function","startLoc":33,"text":"def determine_64_bit_int():\n    \"\"\"\n    The only configuration parameter needed at compile-time is how to\n    specify a 64-bit signed integer.  Python's ctypes module can get us\n    that information.\n    If we can't be absolutely certain, we default to \"long long int\",\n    which is correct on most platforms (x86, x86_64).  If we find\n    platforms where this heuristic doesn't work, we may need to\n    hardcode for them.\n    \"\"\"\n    try:\n        try:\n            import ctypes\n        except ImportError:\n            raise ValueError()\n\n        if ctypes.sizeof(ctypes.c_longlong) == 8:\n            return \"long long int\"\n        elif ctypes.sizeof(ctypes.c_long) == 8:\n            return \"long int\"\n        elif ctypes.sizeof(ctypes.c_int) == 8:\n            return \"int\"\n        else:\n            raise ValueError()\n\n    except ValueError:\n        return \"long long int\""},{"col":4,"comment":"\n        Returns the first valid format that can be used to read/write the data in\n        question.  Mode can be either 'read' or 'write'.\n        ","endLoc":345,"header":"def _get_valid_format(self, mode, cls, path, fileobj, args, kwargs)","id":7162,"name":"_get_valid_format","nodeType":"Function","startLoc":328,"text":"def _get_valid_format(self, mode, cls, path, fileobj, args, kwargs):\n        \"\"\"\n        Returns the first valid format that can be used to read/write the data in\n        question.  Mode can be either 'read' or 'write'.\n        \"\"\"\n        valid_formats = self.identify_format(mode, cls, path, fileobj, args, kwargs)\n\n        if len(valid_formats) == 0:\n            format_table_str = self._get_format_table_str(cls, mode.capitalize())\n            raise IORegistryError(\"Format could not be identified based on the\"\n                                  \" file name or contents, please provide a\"\n                                  \" 'format' argument.\\n\"\n                                  \"The available formats are:\\n\"\n                                  \"{}\".format(format_table_str))\n        elif len(valid_formats) > 1:\n            return self._get_highest_priority_format(mode, cls, valid_formats)\n\n        return valid_formats[0]"},{"col":0,"comment":"null","endLoc":40,"header":"def RETURNS(out_type, indent=0)","id":7163,"name":"RETURNS","nodeType":"Function","startLoc":36,"text":"def RETURNS(out_type, indent=0):\n    return _fix(f\"\"\"result : array\n    Returns the {out_type}.  If the input was a single array and\n    origin, a single array is returned, otherwise a tuple of arrays is\n    returned.\"\"\", indent)"},{"col":4,"comment":"The ID_ of the FIELD_ that this FIELDref_ references.","endLoc":1898,"header":"@property\n    def ref(self)","id":7164,"name":"ref","nodeType":"Function","startLoc":1895,"text":"@property\n    def ref(self):\n        \"\"\"The ID_ of the FIELD_ that this FIELDref_ references.\"\"\"\n        return self._ref"},{"col":4,"comment":"null","endLoc":1903,"header":"@ref.setter\n    def ref(self, ref)","id":7165,"name":"ref","nodeType":"Function","startLoc":1900,"text":"@ref.setter\n    def ref(self, ref):\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        self._ref = ref"},{"col":4,"comment":"\n        Returns the reader or writer with the highest priority. If it is a tie,\n        error.\n        ","endLoc":379,"header":"def _get_highest_priority_format(self, mode, cls, valid_formats)","id":7166,"name":"_get_highest_priority_format","nodeType":"Function","startLoc":347,"text":"def _get_highest_priority_format(self, mode, cls, valid_formats):\n        \"\"\"\n        Returns the reader or writer with the highest priority. If it is a tie,\n        error.\n        \"\"\"\n        if mode == \"read\":\n            format_dict = self._readers\n            mode_loader = \"reader\"\n        elif mode == \"write\":\n            format_dict = self._writers\n            mode_loader = \"writer\"\n\n        best_formats = []\n        current_priority = - np.inf\n        for format in valid_formats:\n            try:\n                _, priority = format_dict[(format, cls)]\n            except KeyError:\n                # We could throw an exception here, but get_reader/get_writer handle\n                # this case better, instead maximally deprioritise the format.\n                priority = - np.inf\n\n            if priority == current_priority:\n                best_formats.append(format)\n            elif priority > current_priority:\n                best_formats = [format]\n                current_priority = priority\n\n        if len(best_formats) > 1:\n            raise IORegistryError(\"Format is ambiguous - options are: {}\".format(\n                ', '.join(sorted(valid_formats, key=itemgetter(0)))\n            ))\n        return best_formats[0]"},{"col":4,"comment":"null","endLoc":1907,"header":"@ref.deleter\n    def ref(self)","id":7167,"name":"ref","nodeType":"Function","startLoc":1905,"text":"@ref.deleter\n    def ref(self):\n        self._ref = None"},{"attributeType":"null","col":4,"comment":"null","endLoc":1860,"id":7168,"name":"_attr_list_11","nodeType":"Attribute","startLoc":1860,"text":"_attr_list_11"},{"col":0,"comment":"\n    Writes out the wcsconfig.h header with local configuration.\n    ","endLoc":107,"header":"def write_wcsconfig_h(paths)","id":7169,"name":"write_wcsconfig_h","nodeType":"Function","startLoc":62,"text":"def write_wcsconfig_h(paths):\n    \"\"\"\n    Writes out the wcsconfig.h header with local configuration.\n    \"\"\"\n    h_file = io.StringIO()\n    h_file.write(\"\"\"\n    /* The bundled version has WCSLIB_VERSION */\n    #define HAVE_WCSLIB_VERSION 1\n\n    /* WCSLIB library version number. */\n    #define WCSLIB_VERSION {}\n\n    /* 64-bit integer data type. */\n    #define WCSLIB_INT64 {}\n\n    /* Windows needs some other defines to prevent inclusion of wcsset()\n       which conflicts with wcslib's wcsset().  These need to be set\n       on code that *uses* astropy.wcs, in addition to astropy.wcs itself.\n       */\n    #if defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) || defined (__MINGW64__)\n\n    #ifndef YY_NO_UNISTD_H\n    #define YY_NO_UNISTD_H\n    #endif\n\n    #ifndef _CRT_SECURE_NO_WARNINGS\n    #define _CRT_SECURE_NO_WARNINGS\n    #endif\n\n    #ifndef _NO_OLDNAMES\n    #define _NO_OLDNAMES\n    #endif\n\n    #ifndef NO_OLDNAMES\n    #define NO_OLDNAMES\n    #endif\n\n    #ifndef __STDC__\n    #define __STDC__ 1\n    #endif\n\n    #endif\n    \"\"\".format(WCSVERSION, determine_64_bit_int()))\n    content = h_file.getvalue().encode('ascii')\n    for path in paths:\n        write_if_different(path, content)"},{"col":0,"comment":"null","endLoc":50,"header":"def ORIGIN(indent=0)","id":7170,"name":"ORIGIN","nodeType":"Function","startLoc":43,"text":"def ORIGIN(indent=0):\n    return _fix(\n\"\"\"\norigin : int\n    Specifies the origin of pixel values.  The Fortran and FITS\n    standards use an origin of 1.  Numpy and C use array indexing with\n    origin at 0.\n\"\"\", indent)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1861,"id":7171,"name":"_attr_list_12","nodeType":"Attribute","startLoc":1861,"text":"_attr_list_12"},{"col":0,"comment":"null","endLoc":174,"header":"def generate_c_docstrings()","id":7172,"name":"generate_c_docstrings","nodeType":"Function","startLoc":114,"text":"def generate_c_docstrings():\n    docstrings = import_file(os.path.join(WCSROOT, 'docstrings.py'))\n    docstrings = docstrings.__dict__\n    keys = [\n        key for key, val in docstrings.items()\n        if not key.startswith('__') and isinstance(val, str)]\n    keys.sort()\n    docs = {}\n    for key in keys:\n        docs[key] = docstrings[key].encode('utf8').lstrip() + b'\\0'\n\n    h_file = io.StringIO()\n    h_file.write(\"\"\"/*\nDO NOT EDIT!\n\nThis file is autogenerated by astropy/wcs/setup_package.py.  To edit\nits contents, edit astropy/wcs/docstrings.py\n*/\n\n#ifndef __DOCSTRINGS_H__\n#define __DOCSTRINGS_H__\n\n\"\"\")\n    for key in keys:\n        val = docs[key]\n        h_file.write(f'extern char doc_{key}[{len(val)}];\\n')\n    h_file.write(\"\\n#endif\\n\\n\")\n\n    write_if_different(\n        join(WCSROOT, 'include', 'astropy_wcs', 'docstrings.h'),\n        h_file.getvalue().encode('utf-8'))\n\n    c_file = io.StringIO()\n    c_file.write(\"\"\"/*\nDO NOT EDIT!\n\nThis file is autogenerated by astropy/wcs/setup_package.py.  To edit\nits contents, edit astropy/wcs/docstrings.py\n\nThe weirdness here with strncpy is because some C compilers, notably\nMSVC, do not support string literals greater than 256 characters.\n*/\n\n#include <string.h>\n#include \"astropy_wcs/docstrings.h\"\n\n\"\"\")\n    for key in keys:\n        val = docs[key]\n        c_file.write(f'char doc_{key}[{len(val)}] = {{\\n')\n        for i in range(0, len(val), 12):\n            section = val[i:i+12]\n            c_file.write('    ')\n            c_file.write(''.join(f'0x{x:02x}, ' for x in section))\n            c_file.write('\\n')\n\n        c_file.write(\"    };\\n\\n\")\n\n    write_if_different(\n        join(WCSROOT, 'src', 'docstrings.c'),\n        c_file.getvalue().encode('utf-8'))"},{"attributeType":"null","col":4,"comment":"null","endLoc":1862,"id":7173,"name":"_element_name","nodeType":"Attribute","startLoc":1862,"text":"_element_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1863,"id":7174,"name":"_utype_in_v1_2","nodeType":"Attribute","startLoc":1863,"text":"_utype_in_v1_2"},{"col":0,"comment":"null","endLoc":61,"header":"def RA_DEC_ORDER(indent=0)","id":7175,"name":"RA_DEC_ORDER","nodeType":"Function","startLoc":53,"text":"def RA_DEC_ORDER(indent=0):\n    return _fix(\n\"\"\"\nra_dec_order : bool, optional\n    When `True` will ensure that world coordinates are always given\n    and returned in as (*ra*, *dec*) pairs, regardless of the order of\n    the axes specified by the in the ``CTYPE`` keywords.  Default is\n    `False`.\n\"\"\", indent)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1864,"id":7176,"name":"_ucd_in_v1_2","nodeType":"Attribute","startLoc":1864,"text":"_ucd_in_v1_2"},{"attributeType":"null","col":8,"comment":"null","endLoc":1882,"id":7177,"name":"ref","nodeType":"Attribute","startLoc":1882,"text":"self.ref"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":7178,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":64,"id":7179,"name":"a","nodeType":"Attribute","startLoc":64,"text":"a"},{"attributeType":"null","col":0,"comment":"null","endLoc":75,"id":7180,"name":"a_order","nodeType":"Attribute","startLoc":75,"text":"a_order"},{"attributeType":"null","col":0,"comment":"null","endLoc":79,"id":7181,"name":"all_pix2world","nodeType":"Attribute","startLoc":79,"text":"all_pix2world"},{"attributeType":"null","col":0,"comment":"null","endLoc":135,"id":7182,"name":"alt","nodeType":"Attribute","startLoc":135,"text":"alt"},{"attributeType":"null","col":0,"comment":"null","endLoc":143,"id":7183,"name":"ap","nodeType":"Attribute","startLoc":143,"text":"ap"},{"attributeType":"null","col":0,"comment":"null","endLoc":152,"id":7184,"name":"ap_order","nodeType":"Attribute","startLoc":152,"text":"ap_order"},{"attributeType":"null","col":0,"comment":"null","endLoc":156,"id":7185,"name":"cel","nodeType":"Attribute","startLoc":156,"text":"cel"},{"attributeType":"null","col":0,"comment":"null","endLoc":160,"id":7186,"name":"Celprm","nodeType":"Attribute","startLoc":160,"text":"Celprm"},{"attributeType":"null","col":0,"comment":"null","endLoc":168,"id":7187,"name":"Prjprm","nodeType":"Attribute","startLoc":168,"text":"Prjprm"},{"attributeType":"null","col":0,"comment":"null","endLoc":176,"id":7188,"name":"aux","nodeType":"Attribute","startLoc":176,"text":"aux"},{"attributeType":"null","col":8,"comment":"null","endLoc":60,"id":7189,"name":"_readers","nodeType":"Attribute","startLoc":60,"text":"self._readers"},{"attributeType":"null","col":8,"comment":"null","endLoc":62,"id":7190,"name":"_registries_order","nodeType":"Attribute","startLoc":62,"text":"self._registries_order"},{"attributeType":"null","col":0,"comment":"null","endLoc":180,"id":7191,"name":"Auxprm","nodeType":"Attribute","startLoc":180,"text":"Auxprm"},{"attributeType":"null","col":0,"comment":"null","endLoc":188,"id":7192,"name":"axis_types","nodeType":"Attribute","startLoc":188,"text":"axis_types"},{"attributeType":"null","col":0,"comment":"null","endLoc":235,"id":7193,"name":"b","nodeType":"Attribute","startLoc":235,"text":"b"},{"attributeType":"null","col":8,"comment":"null","endLoc":1881,"id":7194,"name":"_table","nodeType":"Attribute","startLoc":1881,"text":"self._table"},{"attributeType":"null","col":0,"comment":"null","endLoc":244,"id":7195,"name":"b_order","nodeType":"Attribute","startLoc":244,"text":"b_order"},{"attributeType":"null","col":0,"comment":"null","endLoc":248,"id":7196,"name":"bounds_check","nodeType":"Attribute","startLoc":248,"text":"bounds_check"},{"attributeType":"null","col":0,"comment":"null","endLoc":269,"id":7197,"name":"bp","nodeType":"Attribute","startLoc":269,"text":"bp"},{"attributeType":"null","col":0,"comment":"null","endLoc":278,"id":7198,"name":"bp_order","nodeType":"Attribute","startLoc":278,"text":"bp_order"},{"attributeType":"null","col":0,"comment":"null","endLoc":282,"id":7199,"name":"cd","nodeType":"Attribute","startLoc":282,"text":"cd"},{"attributeType":"null","col":0,"comment":"null","endLoc":306,"id":7200,"name":"cdelt","nodeType":"Attribute","startLoc":306,"text":"cdelt"},{"className":"UnifiedOutputRegistry","col":0,"comment":"Write-only Registry.\n\n    .. versionadded:: 5.0\n    ","endLoc":354,"id":7201,"nodeType":"Class","startLoc":219,"text":"class UnifiedOutputRegistry(_UnifiedIORegistryBase):\n    \"\"\"Write-only Registry.\n\n    .. versionadded:: 5.0\n    \"\"\"\n\n    def __init__(self):\n        super().__init__()\n        self._writers = OrderedDict()\n        self._registries[\"write\"] = dict(attr=\"_writers\", column=\"Write\")\n        self._registries_order = (\"write\", \"identify\", )\n\n    # =========================================================================\n    # Write Methods\n\n    def register_writer(self, data_format, data_class, function, force=False, priority=0):\n        \"\"\"\n        Register a table writer function.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that will be used to\n            specify the data type when writing.\n        data_class : class\n            The class of the object that can be written.\n        function : function\n            The function to write out a data object.\n        force : bool, optional\n            Whether to override any existing function if already present.\n            Default is ``False``.\n        priority : int, optional\n            The priority of the writer, used to compare possible formats when trying\n            to determine the best writer to use. Higher priorities are preferred\n            over lower priorities, with the default priority being 0 (negative\n            numbers are allowed though).\n        \"\"\"\n        if not (data_format, data_class) in self._writers or force:\n            self._writers[(data_format, data_class)] = function, priority\n        else:\n            raise IORegistryError(\"Writer for format '{}' and class '{}' is \"\n                                  'already defined'\n                                  ''.format(data_format, data_class.__name__))\n\n        if data_class not in self._delayed_docs_classes:\n            self._update__doc__(data_class, 'write')\n\n    def unregister_writer(self, data_format, data_class):\n        \"\"\"\n        Unregister a writer function\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier.\n        data_class : class\n            The class of the object that can be written.\n        \"\"\"\n\n        if (data_format, data_class) in self._writers:\n            self._writers.pop((data_format, data_class))\n        else:\n            raise IORegistryError(\"No writer defined for format '{}' and class '{}'\"\n                                  ''.format(data_format, data_class.__name__))\n\n        if data_class not in self._delayed_docs_classes:\n            self._update__doc__(data_class, 'write')\n\n    def get_writer(self, data_format, data_class):\n        \"\"\"Get writer for ``data_format``.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that is used to\n            specify the data type when reading/writing.\n        data_class : class\n            The class of the object that can be written.\n\n        Returns\n        -------\n        writer : callable\n            The registered writer function for this format and class.\n        \"\"\"\n        writers = [(fmt, cls) for fmt, cls in self._writers if fmt == data_format]\n        for writer_format, writer_class in writers:\n            if self._is_best_match(data_class, writer_class, writers):\n                return self._writers[(writer_format, writer_class)][0]\n        else:\n            format_table_str = self._get_format_table_str(data_class, 'Write')\n            raise IORegistryError(\n                \"No writer defined for format '{}' and class '{}'.\\n\\nThe \"\n                \"available formats are:\\n\\n{}\".format(\n                    data_format, data_class.__name__, format_table_str))\n\n    def write(self, data, *args, format=None, **kwargs):\n        \"\"\"\n        Write out data.\n\n        Parameters\n        ----------\n        data : object\n            The data to write.\n        *args\n            The arguments passed to this method depend on the format.\n        format : str or None\n        **kwargs\n            The arguments passed to this method depend on the format.\n\n        Returns\n        -------\n        object or None\n            The output of the registered writer. Most often `None`.\n\n            .. versionadded:: 4.3\n        \"\"\"\n\n        if format is None:\n            path = None\n            fileobj = None\n            if len(args):\n                if isinstance(args[0], PATH_TYPES):\n                    # path might be a os.PathLike object\n                    if isinstance(args[0], os.PathLike):\n                        args = (os.fspath(args[0]),) + args[1:]\n                    path = args[0]\n                    fileobj = None\n                elif hasattr(args[0], 'read'):\n                    path = None\n                    fileobj = args[0]\n\n            format = self._get_valid_format(\n                'write', data.__class__, path, fileobj, args, kwargs)\n\n        writer = self.get_writer(format, data.__class__)\n        return writer(data, *args, **kwargs)"},{"attributeType":"null","col":0,"comment":"null","endLoc":319,"id":7202,"name":"cdfix","nodeType":"Attribute","startLoc":319,"text":"cdfix"},{"attributeType":"null","col":0,"comment":"null","endLoc":336,"id":7203,"name":"cel_offset","nodeType":"Attribute","startLoc":336,"text":"cel_offset"},{"attributeType":"null","col":0,"comment":"null","endLoc":343,"id":7204,"name":"celprm_phi0","nodeType":"Attribute","startLoc":343,"text":"celprm_phi0"},{"attributeType":"null","col":0,"comment":"null","endLoc":350,"id":7205,"name":"celprm_theta0","nodeType":"Attribute","startLoc":350,"text":"celprm_theta0"},{"attributeType":"null","col":0,"comment":"null","endLoc":357,"id":7206,"name":"celprm_ref","nodeType":"Attribute","startLoc":357,"text":"celprm_ref"},{"attributeType":"null","col":0,"comment":"null","endLoc":394,"id":7207,"name":"celprm_euler","nodeType":"Attribute","startLoc":394,"text":"celprm_euler"},{"attributeType":"null","col":0,"comment":"null","endLoc":401,"id":7208,"name":"celprm_latpreq","nodeType":"Attribute","startLoc":401,"text":"celprm_latpreq"},{"attributeType":"null","col":0,"comment":"null","endLoc":411,"id":7209,"name":"celprm_isolat","nodeType":"Attribute","startLoc":411,"text":"celprm_isolat"},{"attributeType":"null","col":0,"comment":"null","endLoc":418,"id":7210,"name":"celprm_prj","nodeType":"Attribute","startLoc":418,"text":"celprm_prj"},{"attributeType":"null","col":0,"comment":"null","endLoc":424,"id":7211,"name":"prjprm_r0","nodeType":"Attribute","startLoc":424,"text":"prjprm_r0"},{"attributeType":"null","col":0,"comment":"null","endLoc":430,"id":7212,"name":"prjprm_code","nodeType":"Attribute","startLoc":430,"text":"prjprm_code"},{"attributeType":"null","col":0,"comment":"null","endLoc":434,"id":7213,"name":"prjprm_pv","nodeType":"Attribute","startLoc":434,"text":"prjprm_pv"},{"attributeType":"null","col":0,"comment":"null","endLoc":453,"id":7214,"name":"prjprm_pvi","nodeType":"Attribute","startLoc":453,"text":"prjprm_pvi"},{"attributeType":"null","col":0,"comment":"null","endLoc":468,"id":7215,"name":"prjprm_phi0","nodeType":"Attribute","startLoc":468,"text":"prjprm_phi0"},{"attributeType":"null","col":0,"comment":"null","endLoc":474,"id":7216,"name":"prjprm_theta0","nodeType":"Attribute","startLoc":474,"text":"prjprm_theta0"},{"col":4,"comment":"null","endLoc":229,"header":"def __init__(self)","id":7217,"name":"__init__","nodeType":"Function","startLoc":225,"text":"def __init__(self):\n        super().__init__()\n        self._writers = OrderedDict()\n        self._registries[\"write\"] = dict(attr=\"_writers\", column=\"Write\")\n        self._registries_order = (\"write\", \"identify\", )"},{"attributeType":"null","col":0,"comment":"null","endLoc":480,"id":7218,"name":"prjprm_bounds","nodeType":"Attribute","startLoc":480,"text":"prjprm_bounds"},{"attributeType":"null","col":0,"comment":"null","endLoc":496,"id":7219,"name":"prjprm_name","nodeType":"Attribute","startLoc":496,"text":"prjprm_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":42,"id":7220,"name":"_identifiers","nodeType":"Attribute","startLoc":42,"text":"self._identifiers"},{"attributeType":"null","col":8,"comment":"null","endLoc":45,"id":7221,"name":"_registries","nodeType":"Attribute","startLoc":45,"text":"self._registries"},{"attributeType":"null","col":8,"comment":"null","endLoc":47,"id":7222,"name":"_registries_order","nodeType":"Attribute","startLoc":47,"text":"self._registries_order"},{"attributeType":"null","col":8,"comment":"null","endLoc":52,"id":7223,"name":"_delayed_docs_classes","nodeType":"Attribute","startLoc":52,"text":"self._delayed_docs_classes"},{"attributeType":"null","col":0,"comment":"null","endLoc":500,"id":7224,"name":"prjprm_category","nodeType":"Attribute","startLoc":500,"text":"prjprm_category"},{"attributeType":"null","col":0,"comment":"null","endLoc":514,"id":7225,"name":"prjprm_w","nodeType":"Attribute","startLoc":514,"text":"prjprm_w"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":7226,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":7227,"name":"PATH_TYPES","nodeType":"Attribute","startLoc":14,"text":"PATH_TYPES"},{"attributeType":"null","col":0,"comment":"null","endLoc":525,"id":7228,"name":"prjprm_pvrange","nodeType":"Attribute","startLoc":525,"text":"prjprm_pvrange"},{"attributeType":"null","col":0,"comment":"null","endLoc":531,"id":7229,"name":"prjprm_simplezen","nodeType":"Attribute","startLoc":531,"text":"prjprm_simplezen"},{"attributeType":"null","col":0,"comment":"null","endLoc":535,"id":7230,"name":"prjprm_equiareal","nodeType":"Attribute","startLoc":535,"text":"prjprm_equiareal"},{"attributeType":"null","col":0,"comment":"null","endLoc":539,"id":7231,"name":"prjprm_conformal","nodeType":"Attribute","startLoc":539,"text":"prjprm_conformal"},{"attributeType":"null","col":0,"comment":"null","endLoc":543,"id":7232,"name":"prjprm_global_projection","nodeType":"Attribute","startLoc":543,"text":"prjprm_global_projection"},{"attributeType":"null","col":8,"comment":"null","endLoc":1883,"id":7233,"name":"ucd","nodeType":"Attribute","startLoc":1883,"text":"self.ucd"},{"attributeType":"null","col":0,"comment":"null","endLoc":548,"id":7234,"name":"prjprm_divergent","nodeType":"Attribute","startLoc":548,"text":"prjprm_divergent"},{"col":0,"comment":"","endLoc":3,"header":"core.py#<anonymous>","id":7235,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['UnifiedIORegistry', 'UnifiedInputRegistry', 'UnifiedOutputRegistry']\n\nPATH_TYPES = (str, os.PathLike)  # TODO! include bytes"},{"attributeType":"null","col":0,"comment":"null","endLoc":552,"id":7236,"name":"prjprm_x0","nodeType":"Attribute","startLoc":552,"text":"prjprm_x0"},{"col":4,"comment":"\n        Register a table writer function.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that will be used to\n            specify the data type when writing.\n        data_class : class\n            The class of the object that can be written.\n        function : function\n            The function to write out a data object.\n        force : bool, optional\n            Whether to override any existing function if already present.\n            Default is ``False``.\n        priority : int, optional\n            The priority of the writer, used to compare possible formats when trying\n            to determine the best writer to use. Higher priorities are preferred\n            over lower priorities, with the default priority being 0 (negative\n            numbers are allowed though).\n        ","endLoc":264,"header":"def register_writer(self, data_format, data_class, function, force=False, priority=0)","id":7237,"name":"register_writer","nodeType":"Function","startLoc":234,"text":"def register_writer(self, data_format, data_class, function, force=False, priority=0):\n        \"\"\"\n        Register a table writer function.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that will be used to\n            specify the data type when writing.\n        data_class : class\n            The class of the object that can be written.\n        function : function\n            The function to write out a data object.\n        force : bool, optional\n            Whether to override any existing function if already present.\n            Default is ``False``.\n        priority : int, optional\n            The priority of the writer, used to compare possible formats when trying\n            to determine the best writer to use. Higher priorities are preferred\n            over lower priorities, with the default priority being 0 (negative\n            numbers are allowed though).\n        \"\"\"\n        if not (data_format, data_class) in self._writers or force:\n            self._writers[(data_format, data_class)] = function, priority\n        else:\n            raise IORegistryError(\"Writer for format '{}' and class '{}' is \"\n                                  'already defined'\n                                  ''.format(data_format, data_class.__name__))\n\n        if data_class not in self._delayed_docs_classes:\n            self._update__doc__(data_class, 'write')"},{"attributeType":"null","col":0,"comment":"null","endLoc":557,"id":7238,"name":"prjprm_y0","nodeType":"Attribute","startLoc":557,"text":"prjprm_y0"},{"fileName":"wcs.py","filePath":"astropy/wcs","id":7239,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# Under the hood, there are 3 separate classes that perform different\n# parts of the transformation:\n#\n#    - `~astropy.wcs.Wcsprm`: Is a direct wrapper of the core WCS\n#      functionality in `wcslib`_.  (This includes TPV and TPD\n#      polynomial distortion, but not SIP distortion).\n#\n#    - `~astropy.wcs.Sip`: Handles polynomial distortion as defined in the\n#      `SIP`_ convention.\n#\n#    - `~astropy.wcs.DistortionLookupTable`: Handles `distortion paper`_\n#      lookup tables.\n#\n# Additionally, the class `WCS` aggregates all of these transformations\n# together in a pipeline:\n#\n#    - Detector to image plane correction (by a pair of\n#      `~astropy.wcs.DistortionLookupTable` objects).\n#\n#    - `SIP`_ distortion correction (by an underlying `~astropy.wcs.Sip`\n#      object)\n#\n#    - `distortion paper`_ table-lookup correction (by a pair of\n#      `~astropy.wcs.DistortionLookupTable` objects).\n#\n#    - `wcslib`_ WCS transformation (by a `~astropy.wcs.Wcsprm` object)\n\n# STDLIB\nimport copy\nimport uuid\nimport io\nimport itertools\nimport os\nimport re\nimport textwrap\nimport warnings\nimport builtins\n\n# THIRD-PARTY\nimport numpy as np\n\n# LOCAL\nfrom astropy import log\nfrom astropy.io import fits\nfrom . import docstrings\nfrom . import _wcs\n\nfrom astropy import units as u\nfrom astropy.utils.compat import possible_filename\nfrom astropy.utils.exceptions import AstropyWarning, AstropyUserWarning, AstropyDeprecationWarning\nfrom astropy.utils.decorators import deprecated_renamed_argument\n\n# Mix-in class that provides the APE 14 API\nfrom .wcsapi.fitswcs import FITSWCSAPIMixin, SlicedFITSWCS\n\n__all__ = ['FITSFixedWarning', 'WCS', 'find_all_wcs',\n           'DistortionLookupTable', 'Sip', 'Tabprm', 'Wcsprm', 'Auxprm',\n           'Celprm', 'Prjprm', 'Wtbarr', 'WCSBase', 'validate', 'WcsError',\n           'SingularMatrixError', 'InconsistentAxisTypesError',\n           'InvalidTransformError', 'InvalidCoordinateError',\n           'InvalidPrjParametersError', 'NoSolutionError',\n           'InvalidSubimageSpecificationError', 'NoConvergence',\n           'NonseparableSubimageCoordinateSystemError',\n           'NoWcsKeywordsFoundError', 'InvalidTabularParametersError']\n\n\n__doctest_skip__ = ['WCS.all_world2pix']\n\n\nif _wcs is not None:\n    _parsed_version = _wcs.__version__.split('.')\n    if int(_parsed_version[0]) == 5 and int(_parsed_version[1]) < 8:\n        raise ImportError(\n            \"astropy.wcs is built with wcslib {0}, but only versions 5.8 and \"\n            \"later on the 5.x series are known to work.  The version of wcslib \"\n            \"that ships with astropy may be used.\")\n\n    if not _wcs._sanity_check():\n        raise RuntimeError(\n            \"astropy.wcs did not pass its sanity check for your build \"\n            \"on your platform.\")\n\n    WCSBase = _wcs._Wcs\n    DistortionLookupTable = _wcs.DistortionLookupTable\n    Sip = _wcs.Sip\n    Wcsprm = _wcs.Wcsprm\n    Auxprm = _wcs.Auxprm\n    Celprm = _wcs.Celprm\n    Prjprm = _wcs.Prjprm\n    Tabprm = _wcs.Tabprm\n    Wtbarr = _wcs.Wtbarr\n    WcsError = _wcs.WcsError\n    SingularMatrixError = _wcs.SingularMatrixError\n    InconsistentAxisTypesError = _wcs.InconsistentAxisTypesError\n    InvalidTransformError = _wcs.InvalidTransformError\n    InvalidCoordinateError = _wcs.InvalidCoordinateError\n    NoSolutionError = _wcs.NoSolutionError\n    InvalidSubimageSpecificationError = _wcs.InvalidSubimageSpecificationError\n    NonseparableSubimageCoordinateSystemError = _wcs.NonseparableSubimageCoordinateSystemError\n    NoWcsKeywordsFoundError = _wcs.NoWcsKeywordsFoundError\n    InvalidTabularParametersError = _wcs.InvalidTabularParametersError\n    InvalidPrjParametersError = _wcs.InvalidPrjParametersError\n\n    # Copy all the constants from the C extension into this module's namespace\n    for key, val in _wcs.__dict__.items():\n        if key.startswith(('WCSSUB_', 'WCSHDR_', 'WCSHDO_', 'WCSCOMPARE_', 'PRJ_')):\n            locals()[key] = val\n            __all__.append(key)\n\n    # Set coordinate extraction callback for WCS -TAB:\n    def _load_tab_bintable(hdulist, extnam, extver, extlev, kind, ttype, row, ndim):\n        arr = hdulist[(extnam, extver)].data[ttype][row - 1]\n\n        if arr.ndim != ndim:\n            if kind == 'c' and ndim == 2:\n                arr = arr.reshape((arr.size, 1))\n            else:\n                raise ValueError(\"Bad TDIM\")\n\n        return np.ascontiguousarray(arr, dtype=np.double)\n\n    _wcs.set_wtbarr_fitsio_callback(_load_tab_bintable)\n\nelse:\n    WCSBase = object\n    Wcsprm = object\n    DistortionLookupTable = object\n    Sip = object\n    Tabprm = object\n    Wtbarr = object\n    WcsError = None\n    SingularMatrixError = None\n    InconsistentAxisTypesError = None\n    InvalidTransformError = None\n    InvalidCoordinateError = None\n    NoSolutionError = None\n    InvalidSubimageSpecificationError = None\n    NonseparableSubimageCoordinateSystemError = None\n    NoWcsKeywordsFoundError = None\n    InvalidTabularParametersError = None\n\n\n# Additional relax bit flags\nWCSHDO_SIP = 0x80000\n\n# Regular expression defining SIP keyword It matches keyword that starts with A\n# or B, optionally followed by P, followed by an underscore then a number in\n# range of 0-19, followed by an underscore and another number in range of 0-19.\n# Keyword optionally ends with a capital letter.\nSIP_KW = re.compile('''^[AB]P?_1?[0-9]_1?[0-9][A-Z]?$''')\n\n\ndef _parse_keysel(keysel):\n    keysel_flags = 0\n    if keysel is not None:\n        for element in keysel:\n            if element.lower() == 'image':\n                keysel_flags |= _wcs.WCSHDR_IMGHEAD\n            elif element.lower() == 'binary':\n                keysel_flags |= _wcs.WCSHDR_BIMGARR\n            elif element.lower() == 'pixel':\n                keysel_flags |= _wcs.WCSHDR_PIXLIST\n            else:\n                raise ValueError(\n                    \"keysel must be a list of 'image', 'binary' \" +\n                    \"and/or 'pixel'\")\n    else:\n        keysel_flags = -1\n\n    return keysel_flags\n\n\nclass NoConvergence(Exception):\n    \"\"\"\n    An error class used to report non-convergence and/or divergence\n    of numerical methods. It is used to report errors in the\n    iterative solution used by\n    the :py:meth:`~astropy.wcs.WCS.all_world2pix`.\n\n    Attributes\n    ----------\n\n    best_solution : `numpy.ndarray`\n        Best solution achieved by the numerical method.\n\n    accuracy : `numpy.ndarray`\n        Accuracy of the ``best_solution``.\n\n    niter : `int`\n        Number of iterations performed by the numerical method\n        to compute ``best_solution``.\n\n    divergent : None, `numpy.ndarray`\n        Indices of the points in ``best_solution`` array\n        for which the solution appears to be divergent. If the\n        solution does not diverge, ``divergent`` will be set to `None`.\n\n    slow_conv : None, `numpy.ndarray`\n        Indices of the solutions in ``best_solution`` array\n        for which the solution failed to converge within the\n        specified maximum number of iterations. If there are no\n        non-converging solutions (i.e., if the required accuracy\n        has been achieved for all input data points)\n        then ``slow_conv`` will be set to `None`.\n\n    \"\"\"\n\n    def __init__(self, *args, best_solution=None, accuracy=None, niter=None,\n                 divergent=None, slow_conv=None, **kwargs):\n        super().__init__(*args)\n\n        self.best_solution = best_solution\n        self.accuracy = accuracy\n        self.niter = niter\n        self.divergent = divergent\n        self.slow_conv = slow_conv\n\n        if kwargs:\n            warnings.warn(\"Function received unexpected arguments ({}) these \"\n                          \"are ignored but will raise an Exception in the \"\n                          \"future.\".format(list(kwargs)),\n                          AstropyDeprecationWarning)\n\n\nclass FITSFixedWarning(AstropyWarning):\n    \"\"\"\n    The warning raised when the contents of the FITS header have been\n    modified to be standards compliant.\n    \"\"\"\n    pass\n\n\nclass WCS(FITSWCSAPIMixin, WCSBase):\n    \"\"\"WCS objects perform standard WCS transformations, and correct for\n    `SIP`_ and `distortion paper`_ table-lookup transformations, based\n    on the WCS keywords and supplementary data read from a FITS file.\n\n    See also: https://docs.astropy.org/en/stable/wcs/\n\n    Parameters\n    ----------\n    header : `~astropy.io.fits.Header`, `~astropy.io.fits.hdu.image.PrimaryHDU`, `~astropy.io.fits.hdu.image.ImageHDU`, str, dict-like, or None, optional\n        If *header* is not provided or None, the object will be\n        initialized to default values.\n\n    fobj : `~astropy.io.fits.HDUList`, optional\n        It is needed when header keywords point to a `distortion\n        paper`_ lookup table stored in a different extension.\n\n    key : str, optional\n        The name of a particular WCS transform to use.  This may be\n        either ``' '`` or ``'A'``-``'Z'`` and corresponds to the\n        ``\\\"a\\\"`` part of the ``CTYPEia`` cards.  *key* may only be\n        provided if *header* is also provided.\n\n    minerr : float, optional\n        The minimum value a distortion correction must have in order\n        to be applied. If the value of ``CQERRja`` is smaller than\n        *minerr*, the corresponding distortion is not applied.\n\n    relax : bool or int, optional\n        Degree of permissiveness:\n\n        - `True` (default): Admit all recognized informal extensions\n          of the WCS standard.\n\n        - `False`: Recognize only FITS keywords defined by the\n          published WCS standard.\n\n        - `int`: a bit field selecting specific extensions to accept.\n          See :ref:`astropy:relaxread` for details.\n\n    naxis : int or sequence, optional\n        Extracts specific coordinate axes using\n        :meth:`~astropy.wcs.Wcsprm.sub`.  If a header is provided, and\n        *naxis* is not ``None``, *naxis* will be passed to\n        :meth:`~astropy.wcs.Wcsprm.sub` in order to select specific\n        axes from the header.  See :meth:`~astropy.wcs.Wcsprm.sub` for\n        more details about this parameter.\n\n    keysel : sequence of str, optional\n        A sequence of flags used to select the keyword types\n        considered by wcslib.  When ``None``, only the standard image\n        header keywords are considered (and the underlying wcspih() C\n        function is called).  To use binary table image array or pixel\n        list keywords, *keysel* must be set.\n\n        Each element in the list should be one of the following\n        strings:\n\n        - 'image': Image header keywords\n\n        - 'binary': Binary table image array keywords\n\n        - 'pixel': Pixel list keywords\n\n        Keywords such as ``EQUIna`` or ``RFRQna`` that are common to\n        binary table image arrays and pixel lists (including\n        ``WCSNna`` and ``TWCSna``) are selected by both 'binary' and\n        'pixel'.\n\n    colsel : sequence of int, optional\n        A sequence of table column numbers used to restrict the WCS\n        transformations considered to only those pertaining to the\n        specified columns.  If `None`, there is no restriction.\n\n    fix : bool, optional\n        When `True` (default), call `~astropy.wcs.Wcsprm.fix` on\n        the resulting object to fix any non-standard uses in the\n        header.  `FITSFixedWarning` Warnings will be emitted if any\n        changes were made.\n\n    translate_units : str, optional\n        Specify which potentially unsafe translations of non-standard\n        unit strings to perform.  By default, performs none.  See\n        `WCS.fix` for more information about this parameter.  Only\n        effective when ``fix`` is `True`.\n\n    Raises\n    ------\n    MemoryError\n         Memory allocation failed.\n\n    ValueError\n         Invalid key.\n\n    KeyError\n         Key not found in FITS header.\n\n    ValueError\n         Lookup table distortion present in the header but *fobj* was\n         not provided.\n\n    Notes\n    -----\n\n    1. astropy.wcs supports arbitrary *n* dimensions for the core WCS\n       (the transformations handled by WCSLIB).  However, the\n       `distortion paper`_ lookup table and `SIP`_ distortions must be\n       two dimensional.  Therefore, if you try to create a WCS object\n       where the core WCS has a different number of dimensions than 2\n       and that object also contains a `distortion paper`_ lookup\n       table or `SIP`_ distortion, a `ValueError`\n       exception will be raised.  To avoid this, consider using the\n       *naxis* kwarg to select two dimensions from the core WCS.\n\n    2. The number of coordinate axes in the transformation is not\n       determined directly from the ``NAXIS`` keyword but instead from\n       the highest of:\n\n           - ``NAXIS`` keyword\n\n           - ``WCSAXESa`` keyword\n\n           - The highest axis number in any parameterized WCS keyword.\n             The keyvalue, as well as the keyword, must be\n             syntactically valid otherwise it will not be considered.\n\n       If none of these keyword types is present, i.e. if the header\n       only contains auxiliary WCS keywords for a particular\n       coordinate representation, then no coordinate description is\n       constructed for it.\n\n       The number of axes, which is set as the ``naxis`` member, may\n       differ for different coordinate representations of the same\n       image.\n\n    3. When the header includes duplicate keywords, in most cases the\n       last encountered is used.\n\n    4. `~astropy.wcs.Wcsprm.set` is called immediately after\n       construction, so any invalid keywords or transformations will\n       be raised by the constructor, not when subsequently calling a\n       transformation method.\n\n    \"\"\"  # noqa: E501\n\n    def __init__(self, header=None, fobj=None, key=' ', minerr=0.0,\n                 relax=True, naxis=None, keysel=None, colsel=None,\n                 fix=True, translate_units='', _do_set=True):\n        close_fds = []\n\n        # these parameters are stored to be used when unpickling a WCS object:\n        self._init_kwargs = {\n            'keysel': copy.copy(keysel),\n            'colsel': copy.copy(colsel),\n        }\n\n        if header is None:\n            if naxis is None:\n                naxis = 2\n            wcsprm = _wcs.Wcsprm(header=None, key=key,\n                                 relax=relax, naxis=naxis)\n            self.naxis = wcsprm.naxis\n            # Set some reasonable defaults.\n            det2im = (None, None)\n            cpdis = (None, None)\n            sip = None\n        else:\n            keysel_flags = _parse_keysel(keysel)\n\n            if isinstance(header, (str, bytes)):\n                try:\n                    is_path = (possible_filename(header) and\n                               os.path.exists(header))\n                except (OSError, ValueError):\n                    is_path = False\n\n                if is_path:\n                    if fobj is not None:\n                        raise ValueError(\n                            \"Can not provide both a FITS filename to \"\n                            \"argument 1 and a FITS file object to argument 2\")\n                    fobj = fits.open(header)\n                    close_fds.append(fobj)\n                    header = fobj[0].header\n            elif isinstance(header, fits.hdu.image._ImageBaseHDU):\n                header = header.header\n            elif not isinstance(header, fits.Header):\n                try:\n                    # Accept any dict-like object\n                    orig_header = header\n                    header = fits.Header()\n                    for dict_key in orig_header.keys():\n                        header[dict_key] = orig_header[dict_key]\n                except TypeError:\n                    raise TypeError(\n                        \"header must be a string, an astropy.io.fits.Header \"\n                        \"object, or a dict-like object\")\n\n            if isinstance(header, fits.Header):\n                header_string = header.tostring().rstrip()\n            else:\n                header_string = header\n\n            # Importantly, header is a *copy* of the passed-in header\n            # because we will be modifying it\n            if isinstance(header_string, str):\n                header_bytes = header_string.encode('ascii')\n                header_string = header_string\n            else:\n                header_bytes = header_string\n                header_string = header_string.decode('ascii')\n\n            if not (fobj is None or isinstance(fobj, fits.HDUList)):\n                raise AssertionError(\"'fobj' must be either None or an \"\n                                     \"astropy.io.fits.HDUList object.\")\n\n            est_naxis = 2\n            try:\n                tmp_header = fits.Header.fromstring(header_string)\n                self._remove_sip_kw(tmp_header)\n                tmp_header_bytes = tmp_header.tostring().rstrip()\n                if isinstance(tmp_header_bytes, str):\n                    tmp_header_bytes = tmp_header_bytes.encode('ascii')\n                tmp_wcsprm = _wcs.Wcsprm(header=tmp_header_bytes, key=key,\n                                         relax=relax, keysel=keysel_flags,\n                                         colsel=colsel, warnings=False,\n                                         hdulist=fobj)\n                if naxis is not None:\n                    try:\n                        tmp_wcsprm = tmp_wcsprm.sub(naxis)\n                    except ValueError:\n                        pass\n                    est_naxis = tmp_wcsprm.naxis if tmp_wcsprm.naxis else 2\n\n            except _wcs.NoWcsKeywordsFoundError:\n                pass\n\n            self.naxis = est_naxis\n\n            header = fits.Header.fromstring(header_string)\n\n            det2im = self._read_det2im_kw(header, fobj, err=minerr)\n            cpdis = self._read_distortion_kw(\n                header, fobj, dist='CPDIS', err=minerr)\n            sip = self._read_sip_kw(header, wcskey=key)\n            self._remove_sip_kw(header)\n\n            header_string = header.tostring()\n            header_string = header_string.replace('END' + ' ' * 77, '')\n\n            if isinstance(header_string, str):\n                header_bytes = header_string.encode('ascii')\n                header_string = header_string\n            else:\n                header_bytes = header_string\n                header_string = header_string.decode('ascii')\n\n            try:\n                wcsprm = _wcs.Wcsprm(header=header_bytes, key=key,\n                                     relax=relax, keysel=keysel_flags,\n                                     colsel=colsel, hdulist=fobj)\n            except _wcs.NoWcsKeywordsFoundError:\n                # The header may have SIP or distortions, but no core\n                # WCS.  That isn't an error -- we want a \"default\"\n                # (identity) core Wcs transformation in that case.\n                if colsel is None:\n                    wcsprm = _wcs.Wcsprm(header=None, key=key,\n                                         relax=relax, keysel=keysel_flags,\n                                         colsel=colsel, hdulist=fobj)\n                else:\n                    raise\n\n            if naxis is not None:\n                wcsprm = wcsprm.sub(naxis)\n            self.naxis = wcsprm.naxis\n\n            if (wcsprm.naxis != 2 and\n                    (det2im[0] or det2im[1] or cpdis[0] or cpdis[1] or sip)):\n                raise ValueError(\n                    \"\"\"\nFITS WCS distortion paper lookup tables and SIP distortions only work\nin 2 dimensions.  However, WCSLIB has detected {} dimensions in the\ncore WCS keywords.  To use core WCS in conjunction with FITS WCS\ndistortion paper lookup tables or SIP distortion, you must select or\nreduce these to 2 dimensions using the naxis kwarg.\n\"\"\".format(wcsprm.naxis))\n\n            header_naxis = header.get('NAXIS', None)\n            if header_naxis is not None and header_naxis < wcsprm.naxis:\n                warnings.warn(\n                    \"The WCS transformation has more axes ({:d}) than the \"\n                    \"image it is associated with ({:d})\".format(\n                        wcsprm.naxis, header_naxis), FITSFixedWarning)\n\n        self._get_naxis(header)\n        WCSBase.__init__(self, sip, cpdis, wcsprm, det2im)\n\n        if fix:\n            if header is None:\n                with warnings.catch_warnings():\n                    warnings.simplefilter('ignore', FITSFixedWarning)\n                    self.fix(translate_units=translate_units)\n            else:\n                self.fix(translate_units=translate_units)\n\n        if _do_set:\n            self.wcs.set()\n\n        for fd in close_fds:\n            fd.close()\n\n        self._pixel_bounds = None\n\n    def __copy__(self):\n        new_copy = self.__class__()\n        WCSBase.__init__(new_copy, self.sip,\n                         (self.cpdis1, self.cpdis2),\n                         self.wcs,\n                         (self.det2im1, self.det2im2))\n        new_copy.__dict__.update(self.__dict__)\n        return new_copy\n\n    def __deepcopy__(self, memo):\n        from copy import deepcopy\n\n        new_copy = self.__class__()\n        new_copy.naxis = deepcopy(self.naxis, memo)\n        WCSBase.__init__(new_copy, deepcopy(self.sip, memo),\n                         (deepcopy(self.cpdis1, memo),\n                          deepcopy(self.cpdis2, memo)),\n                         deepcopy(self.wcs, memo),\n                         (deepcopy(self.det2im1, memo),\n                          deepcopy(self.det2im2, memo)))\n        for key, val in self.__dict__.items():\n            new_copy.__dict__[key] = deepcopy(val, memo)\n        return new_copy\n\n    def copy(self):\n        \"\"\"\n        Return a shallow copy of the object.\n\n        Convenience method so user doesn't have to import the\n        :mod:`copy` stdlib module.\n\n        .. warning::\n            Use `deepcopy` instead of `copy` unless you know why you need a\n            shallow copy.\n        \"\"\"\n        return copy.copy(self)\n\n    def deepcopy(self):\n        \"\"\"\n        Return a deep copy of the object.\n\n        Convenience method so user doesn't have to import the\n        :mod:`copy` stdlib module.\n        \"\"\"\n        return copy.deepcopy(self)\n\n    def sub(self, axes=None):\n\n        copy = self.deepcopy()\n\n        # We need to know which axes have been dropped, but there is no easy\n        # way to do this with the .sub function, so instead we assign UUIDs to\n        # the CNAME parameters in copy.wcs. We can later access the original\n        # CNAME properties from self.wcs.\n        cname_uuid = [str(uuid.uuid4()) for i in range(copy.wcs.naxis)]\n        copy.wcs.cname = cname_uuid\n\n        # Subset the WCS\n        copy.wcs = copy.wcs.sub(axes)\n        copy.naxis = copy.wcs.naxis\n\n        # Construct a list of dimensions from the original WCS in the order\n        # in which they appear in the final WCS.\n        keep = [cname_uuid.index(cname) if cname in cname_uuid else None\n                for cname in copy.wcs.cname]\n\n        # Restore the original CNAMEs\n        copy.wcs.cname = ['' if i is None else self.wcs.cname[i] for i in keep]\n\n        # Subset pixel_shape and pixel_bounds\n        if self.pixel_shape:\n            copy.pixel_shape = tuple([None if i is None else self.pixel_shape[i] for i in keep])\n        if self.pixel_bounds:\n            copy.pixel_bounds = [None if i is None else self.pixel_bounds[i] for i in keep]\n\n        return copy\n\n    if _wcs is not None:\n        sub.__doc__ = _wcs.Wcsprm.sub.__doc__\n\n    def _fix_scamp(self):\n        \"\"\"\n        Remove SCAMP's PVi_m distortion parameters if SIP distortion parameters\n        are also present. Some projects (e.g., Palomar Transient Factory)\n        convert SCAMP's distortion parameters (which abuse the PVi_m cards) to\n        SIP. However, wcslib gets confused by the presence of both SCAMP and\n        SIP distortion parameters.\n\n        See https://github.com/astropy/astropy/issues/299.\n        \"\"\"\n        # Nothing to be done if no WCS attached\n        if self.wcs is None:\n            return\n\n        # Nothing to be done if no PV parameters attached\n        pv = self.wcs.get_pv()\n        if not pv:\n            return\n\n        # Nothing to be done if axes don't use SIP distortion parameters\n        if self.sip is None:\n            return\n\n        # Nothing to be done if any radial terms are present...\n        # Loop over list to find any radial terms.\n        # Certain values of the `j' index are used for storing\n        # radial terms; refer to Equation (1) in\n        # <http://web.ipac.caltech.edu/staff/shupe/reprints/SIP_to_PV_SPIE2012.pdf>.\n        pv = np.asarray(pv)\n        # Loop over distinct values of `i' index\n        for i in set(pv[:, 0]):\n            # Get all values of `j' index for this value of `i' index\n            js = set(pv[:, 1][pv[:, 0] == i])\n            # Find max value of `j' index\n            max_j = max(js)\n            for j in (3, 11, 23, 39):\n                if j < max_j and j in js:\n                    return\n\n        self.wcs.set_pv([])\n        warnings.warn(\"Removed redundant SCAMP distortion parameters \" +\n                      \"because SIP parameters are also present\", FITSFixedWarning)\n\n    def fix(self, translate_units='', naxis=None):\n        \"\"\"\n        Perform the fix operations from wcslib, and warn about any\n        changes it has made.\n\n        Parameters\n        ----------\n        translate_units : str, optional\n            Specify which potentially unsafe translations of\n            non-standard unit strings to perform.  By default,\n            performs none.\n\n            Although ``\"S\"`` is commonly used to represent seconds,\n            its translation to ``\"s\"`` is potentially unsafe since the\n            standard recognizes ``\"S\"`` formally as Siemens, however\n            rarely that may be used.  The same applies to ``\"H\"`` for\n            hours (Henry), and ``\"D\"`` for days (Debye).\n\n            This string controls what to do in such cases, and is\n            case-insensitive.\n\n            - If the string contains ``\"s\"``, translate ``\"S\"`` to\n              ``\"s\"``.\n\n            - If the string contains ``\"h\"``, translate ``\"H\"`` to\n              ``\"h\"``.\n\n            - If the string contains ``\"d\"``, translate ``\"D\"`` to\n              ``\"d\"``.\n\n            Thus ``''`` doesn't do any unsafe translations, whereas\n            ``'shd'`` does all of them.\n\n        naxis : int array, optional\n            Image axis lengths.  If this array is set to zero or\n            ``None``, then `~astropy.wcs.Wcsprm.cylfix` will not be\n            invoked.\n        \"\"\"\n        if self.wcs is not None:\n            self._fix_scamp()\n            fixes = self.wcs.fix(translate_units, naxis)\n            for key, val in fixes.items():\n                if val != \"No change\":\n                    if (key == 'datfix' and '1858-11-17' in val and\n                            not np.count_nonzero(self.wcs.mjdref)):\n                        continue\n                    warnings.warn(\n                        (\"'{0}' made the change '{1}'.\").\n                        format(key, val),\n                        FITSFixedWarning)\n\n    def calc_footprint(self, header=None, undistort=True, axes=None, center=True):\n        \"\"\"\n        Calculates the footprint of the image on the sky.\n\n        A footprint is defined as the positions of the corners of the\n        image on the sky after all available distortions have been\n        applied.\n\n        Parameters\n        ----------\n        header : `~astropy.io.fits.Header` object, optional\n            Used to get ``NAXIS1`` and ``NAXIS2``\n            header and axes are mutually exclusive, alternative ways\n            to provide the same information.\n\n        undistort : bool, optional\n            If `True`, take SIP and distortion lookup table into\n            account\n\n        axes : (int, int), optional\n            If provided, use the given sequence as the shape of the\n            image.  Otherwise, use the ``NAXIS1`` and ``NAXIS2``\n            keywords from the header that was used to create this\n            `WCS` object.\n\n        center : bool, optional\n            If `True` use the center of the pixel, otherwise use the corner.\n\n        Returns\n        -------\n        coord : (4, 2) array of (*x*, *y*) coordinates.\n            The order is clockwise starting with the bottom left corner.\n        \"\"\"\n        if axes is not None:\n            naxis1, naxis2 = axes\n        else:\n            if header is None:\n                try:\n                    # classes that inherit from WCS and define naxis1/2\n                    # do not require a header parameter\n                    naxis1, naxis2 = self.pixel_shape\n                except (AttributeError, TypeError):\n                    warnings.warn(\n                        \"Need a valid header in order to calculate footprint\\n\", AstropyUserWarning)\n                    return None\n            else:\n                naxis1 = header.get('NAXIS1', None)\n                naxis2 = header.get('NAXIS2', None)\n\n        if naxis1 is None or naxis2 is None:\n            raise ValueError(\n                    \"Image size could not be determined.\")\n\n        if center:\n            corners = np.array([[1, 1],\n                                [1, naxis2],\n                                [naxis1, naxis2],\n                                [naxis1, 1]], dtype=np.float64)\n        else:\n            corners = np.array([[0.5, 0.5],\n                                [0.5, naxis2 + 0.5],\n                                [naxis1 + 0.5, naxis2 + 0.5],\n                                [naxis1 + 0.5, 0.5]], dtype=np.float64)\n\n        if undistort:\n            return self.all_pix2world(corners, 1)\n        else:\n            return self.wcs_pix2world(corners, 1)\n\n    def _read_det2im_kw(self, header, fobj, err=0.0):\n        \"\"\"\n        Create a `distortion paper`_ type lookup table for detector to\n        image plane correction.\n        \"\"\"\n        if fobj is None:\n            return (None, None)\n\n        if not isinstance(fobj, fits.HDUList):\n            return (None, None)\n\n        try:\n            axiscorr = header['AXISCORR']\n            d2imdis = self._read_d2im_old_format(header, fobj, axiscorr)\n            return d2imdis\n        except KeyError:\n            pass\n\n        dist = 'D2IMDIS'\n        d_kw = 'D2IM'\n        err_kw = 'D2IMERR'\n        tables = {}\n        for i in range(1, self.naxis + 1):\n            d_error = header.get(err_kw + str(i), 0.0)\n            if d_error < err:\n                tables[i] = None\n                continue\n            distortion = dist + str(i)\n            if distortion in header:\n                dis = header[distortion].lower()\n                if dis == 'lookup':\n                    del header[distortion]\n                    assert isinstance(fobj, fits.HDUList), (\n                        'An astropy.io.fits.HDUList'\n                        'is required for Lookup table distortion.')\n                    dp = (d_kw + str(i)).strip()\n                    dp_extver_key = dp + '.EXTVER'\n                    if dp_extver_key in header:\n                        d_extver = header[dp_extver_key]\n                        del header[dp_extver_key]\n                    else:\n                        d_extver = 1\n                    dp_axis_key = dp + f'.AXIS.{i:d}'\n                    if i == header[dp_axis_key]:\n                        d_data = fobj['D2IMARR', d_extver].data\n                    else:\n                        d_data = (fobj['D2IMARR', d_extver].data).transpose()\n                    del header[dp_axis_key]\n                    d_header = fobj['D2IMARR', d_extver].header\n                    d_crpix = (d_header.get('CRPIX1', 0.0), d_header.get('CRPIX2', 0.0))\n                    d_crval = (d_header.get('CRVAL1', 0.0), d_header.get('CRVAL2', 0.0))\n                    d_cdelt = (d_header.get('CDELT1', 1.0), d_header.get('CDELT2', 1.0))\n                    d_lookup = DistortionLookupTable(d_data, d_crpix,\n                                                     d_crval, d_cdelt)\n                    tables[i] = d_lookup\n                else:\n                    warnings.warn('Polynomial distortion is not implemented.\\n', AstropyUserWarning)\n                for key in set(header):\n                    if key.startswith(dp + '.'):\n                        del header[key]\n            else:\n                tables[i] = None\n        if not tables:\n            return (None, None)\n        else:\n            return (tables.get(1), tables.get(2))\n\n    def _read_d2im_old_format(self, header, fobj, axiscorr):\n        warnings.warn(\n            \"The use of ``AXISCORR`` for D2IM correction has been deprecated.\"\n            \"`~astropy.wcs` will read in files with ``AXISCORR`` but ``to_fits()`` will write \"\n            \"out files without it.\",\n            AstropyDeprecationWarning)\n        cpdis = [None, None]\n        crpix = [0., 0.]\n        crval = [0., 0.]\n        cdelt = [1., 1.]\n        try:\n            d2im_data = fobj[('D2IMARR', 1)].data\n        except KeyError:\n            return (None, None)\n        except AttributeError:\n            return (None, None)\n\n        d2im_data = np.array([d2im_data])\n        d2im_hdr = fobj[('D2IMARR', 1)].header\n        naxis = d2im_hdr['NAXIS']\n\n        for i in range(1, naxis + 1):\n            crpix[i - 1] = d2im_hdr.get('CRPIX' + str(i), 0.0)\n            crval[i - 1] = d2im_hdr.get('CRVAL' + str(i), 0.0)\n            cdelt[i - 1] = d2im_hdr.get('CDELT' + str(i), 1.0)\n\n        cpdis = DistortionLookupTable(d2im_data, crpix, crval, cdelt)\n\n        if axiscorr == 1:\n            return (cpdis, None)\n        elif axiscorr == 2:\n            return (None, cpdis)\n        else:\n            warnings.warn(\"Expected AXISCORR to be 1 or 2\", AstropyUserWarning)\n            return (None, None)\n\n    def _write_det2im(self, hdulist):\n        \"\"\"\n        Writes a `distortion paper`_ type lookup table to the given\n        `~astropy.io.fits.HDUList`.\n        \"\"\"\n\n        if self.det2im1 is None and self.det2im2 is None:\n            return\n        dist = 'D2IMDIS'\n        d_kw = 'D2IM'\n\n        def write_d2i(num, det2im):\n            if det2im is None:\n                return\n\n            hdulist[0].header[f'{dist}{num:d}'] = (\n                'LOOKUP', 'Detector to image correction type')\n            hdulist[0].header[f'{d_kw}{num:d}.EXTVER'] = (\n                num, 'Version number of WCSDVARR extension')\n            hdulist[0].header[f'{d_kw}{num:d}.NAXES'] = (\n                len(det2im.data.shape), 'Number of independent variables in D2IM function')\n\n            for i in range(det2im.data.ndim):\n                jth = {1: '1st', 2: '2nd', 3: '3rd'}.get(i + 1, f'{i + 1}th')\n                hdulist[0].header[f'{d_kw}{num:d}.AXIS.{i + 1:d}'] = (\n                    i + 1, f'Axis number of the {jth} variable in a D2IM function')\n\n            image = fits.ImageHDU(det2im.data, name='D2IMARR')\n            header = image.header\n\n            header['CRPIX1'] = (det2im.crpix[0],\n                                'Coordinate system reference pixel')\n            header['CRPIX2'] = (det2im.crpix[1],\n                                'Coordinate system reference pixel')\n            header['CRVAL1'] = (det2im.crval[0],\n                                'Coordinate system value at reference pixel')\n            header['CRVAL2'] = (det2im.crval[1],\n                                'Coordinate system value at reference pixel')\n            header['CDELT1'] = (det2im.cdelt[0],\n                                'Coordinate increment along axis')\n            header['CDELT2'] = (det2im.cdelt[1],\n                                'Coordinate increment along axis')\n            image.ver = int(hdulist[0].header[f'{d_kw}{num:d}.EXTVER'])\n            hdulist.append(image)\n        write_d2i(1, self.det2im1)\n        write_d2i(2, self.det2im2)\n\n    def _read_distortion_kw(self, header, fobj, dist='CPDIS', err=0.0):\n        \"\"\"\n        Reads `distortion paper`_ table-lookup keywords and data, and\n        returns a 2-tuple of `~astropy.wcs.DistortionLookupTable`\n        objects.\n\n        If no `distortion paper`_ keywords are found, ``(None, None)``\n        is returned.\n        \"\"\"\n        if isinstance(header, (str, bytes)):\n            return (None, None)\n\n        if dist == 'CPDIS':\n            d_kw = 'DP'\n            err_kw = 'CPERR'\n        else:\n            d_kw = 'DQ'\n            err_kw = 'CQERR'\n\n        tables = {}\n        for i in range(1, self.naxis + 1):\n            d_error_key = err_kw + str(i)\n            if d_error_key in header:\n                d_error = header[d_error_key]\n                del header[d_error_key]\n            else:\n                d_error = 0.0\n            if d_error < err:\n                tables[i] = None\n                continue\n            distortion = dist + str(i)\n            if distortion in header:\n                dis = header[distortion].lower()\n                del header[distortion]\n                if dis == 'lookup':\n                    if not isinstance(fobj, fits.HDUList):\n                        raise ValueError('an astropy.io.fits.HDUList is '\n                                         'required for Lookup table distortion.')\n                    dp = (d_kw + str(i)).strip()\n                    dp_extver_key = dp + '.EXTVER'\n                    if dp_extver_key in header:\n                        d_extver = header[dp_extver_key]\n                        del header[dp_extver_key]\n                    else:\n                        d_extver = 1\n                    dp_axis_key = dp + f'.AXIS.{i:d}'\n                    if i == header[dp_axis_key]:\n                        d_data = fobj['WCSDVARR', d_extver].data\n                    else:\n                        d_data = (fobj['WCSDVARR', d_extver].data).transpose()\n                    del header[dp_axis_key]\n                    d_header = fobj['WCSDVARR', d_extver].header\n                    d_crpix = (d_header.get('CRPIX1', 0.0),\n                               d_header.get('CRPIX2', 0.0))\n                    d_crval = (d_header.get('CRVAL1', 0.0),\n                               d_header.get('CRVAL2', 0.0))\n                    d_cdelt = (d_header.get('CDELT1', 1.0),\n                               d_header.get('CDELT2', 1.0))\n                    d_lookup = DistortionLookupTable(d_data, d_crpix, d_crval, d_cdelt)\n                    tables[i] = d_lookup\n\n                    for key in set(header):\n                        if key.startswith(dp + '.'):\n                            del header[key]\n                else:\n                    warnings.warn('Polynomial distortion is not implemented.\\n', AstropyUserWarning)\n            else:\n                tables[i] = None\n\n        if not tables:\n            return (None, None)\n        else:\n            return (tables.get(1), tables.get(2))\n\n    def _write_distortion_kw(self, hdulist, dist='CPDIS'):\n        \"\"\"\n        Write out `distortion paper`_ keywords to the given\n        `~astropy.io.fits.HDUList`.\n        \"\"\"\n        if self.cpdis1 is None and self.cpdis2 is None:\n            return\n\n        if dist == 'CPDIS':\n            d_kw = 'DP'\n        else:\n            d_kw = 'DQ'\n\n        def write_dist(num, cpdis):\n            if cpdis is None:\n                return\n\n            hdulist[0].header[f'{dist}{num:d}'] = (\n                'LOOKUP', 'Prior distortion function type')\n            hdulist[0].header[f'{d_kw}{num:d}.EXTVER'] = (\n                num, 'Version number of WCSDVARR extension')\n            hdulist[0].header[f'{d_kw}{num:d}.NAXES'] = (\n                len(cpdis.data.shape), f'Number of independent variables in {dist} function')\n\n            for i in range(cpdis.data.ndim):\n                jth = {1: '1st', 2: '2nd', 3: '3rd'}.get(i + 1, f'{i + 1}th')\n                hdulist[0].header[f'{d_kw}{num:d}.AXIS.{i + 1:d}'] = (\n                    i + 1,\n                    f'Axis number of the {jth} variable in a {dist} function')\n\n            image = fits.ImageHDU(cpdis.data, name='WCSDVARR')\n            header = image.header\n\n            header['CRPIX1'] = (cpdis.crpix[0], 'Coordinate system reference pixel')\n            header['CRPIX2'] = (cpdis.crpix[1], 'Coordinate system reference pixel')\n            header['CRVAL1'] = (cpdis.crval[0], 'Coordinate system value at reference pixel')\n            header['CRVAL2'] = (cpdis.crval[1], 'Coordinate system value at reference pixel')\n            header['CDELT1'] = (cpdis.cdelt[0], 'Coordinate increment along axis')\n            header['CDELT2'] = (cpdis.cdelt[1], 'Coordinate increment along axis')\n            image.ver = int(hdulist[0].header[f'{d_kw}{num:d}.EXTVER'])\n            hdulist.append(image)\n\n        write_dist(1, self.cpdis1)\n        write_dist(2, self.cpdis2)\n\n    def _remove_sip_kw(self, header):\n        \"\"\"\n        Remove SIP information from a header.\n        \"\"\"\n        # Never pass SIP coefficients to wcslib\n        # CTYPE must be passed with -SIP to wcslib\n        for key in set(m.group() for m in map(SIP_KW.match, list(header))\n                       if m is not None):\n            del header[key]\n\n    def _read_sip_kw(self, header, wcskey=\"\"):\n        \"\"\"\n        Reads `SIP`_ header keywords and returns a `~astropy.wcs.Sip`\n        object.\n\n        If no `SIP`_ header keywords are found, ``None`` is returned.\n        \"\"\"\n        if isinstance(header, (str, bytes)):\n            # TODO: Parse SIP from a string without pyfits around\n            return None\n\n        if \"A_ORDER\" in header and header['A_ORDER'] > 1:\n            if \"B_ORDER\" not in header:\n                raise ValueError(\n                    \"A_ORDER provided without corresponding B_ORDER \"\n                    \"keyword for SIP distortion\")\n\n            m = int(header[\"A_ORDER\"])\n            a = np.zeros((m + 1, m + 1), np.double)\n            for i in range(m + 1):\n                for j in range(m - i + 1):\n                    key = f\"A_{i}_{j}\"\n                    if key in header:\n                        a[i, j] = header[key]\n                        del header[key]\n\n            m = int(header[\"B_ORDER\"])\n            if m > 1:\n                b = np.zeros((m + 1, m + 1), np.double)\n                for i in range(m + 1):\n                    for j in range(m - i + 1):\n                        key = f\"B_{i}_{j}\"\n                        if key in header:\n                            b[i, j] = header[key]\n                            del header[key]\n            else:\n                a = None\n                b = None\n\n            del header['A_ORDER']\n            del header['B_ORDER']\n\n            ctype = [header[f'CTYPE{nax}{wcskey}'] for nax in range(1, self.naxis + 1)]\n            if any(not ctyp.endswith('-SIP') for ctyp in ctype):\n                message = \"\"\"\n                Inconsistent SIP distortion information is present in the FITS header and the WCS object:\n                SIP coefficients were detected, but CTYPE is missing a \"-SIP\" suffix.\n                astropy.wcs is using the SIP distortion coefficients,\n                therefore the coordinates calculated here might be incorrect.\n\n                If you do not want to apply the SIP distortion coefficients,\n                please remove the SIP coefficients from the FITS header or the\n                WCS object.  As an example, if the image is already distortion-corrected\n                (e.g., drizzled) then distortion components should not apply and the SIP\n                coefficients should be removed.\n\n                While the SIP distortion coefficients are being applied here, if that was indeed the intent,\n                for consistency please append \"-SIP\" to the CTYPE in the FITS header or the WCS object.\n\n                \"\"\"  # noqa: E501\n                log.info(message)\n        elif \"B_ORDER\" in header and header['B_ORDER'] > 1:\n            raise ValueError(\n                \"B_ORDER provided without corresponding A_ORDER \" +\n                \"keyword for SIP distortion\")\n        else:\n            a = None\n            b = None\n\n        if \"AP_ORDER\" in header and header['AP_ORDER'] > 1:\n            if \"BP_ORDER\" not in header:\n                raise ValueError(\n                    \"AP_ORDER provided without corresponding BP_ORDER \"\n                    \"keyword for SIP distortion\")\n\n            m = int(header[\"AP_ORDER\"])\n            ap = np.zeros((m + 1, m + 1), np.double)\n            for i in range(m + 1):\n                for j in range(m - i + 1):\n                    key = f\"AP_{i}_{j}\"\n                    if key in header:\n                        ap[i, j] = header[key]\n                        del header[key]\n\n            m = int(header[\"BP_ORDER\"])\n            if m > 1:\n                bp = np.zeros((m + 1, m + 1), np.double)\n                for i in range(m + 1):\n                    for j in range(m - i + 1):\n                        key = f\"BP_{i}_{j}\"\n                        if key in header:\n                            bp[i, j] = header[key]\n                            del header[key]\n            else:\n                ap = None\n                bp = None\n\n            del header['AP_ORDER']\n            del header['BP_ORDER']\n        elif \"BP_ORDER\" in header and header['BP_ORDER'] > 1:\n            raise ValueError(\n                \"BP_ORDER provided without corresponding AP_ORDER \"\n                \"keyword for SIP distortion\")\n        else:\n            ap = None\n            bp = None\n\n        if a is None and b is None and ap is None and bp is None:\n            return None\n\n        if f\"CRPIX1{wcskey}\" not in header or f\"CRPIX2{wcskey}\" not in header:\n            raise ValueError(\n                \"Header has SIP keywords without CRPIX keywords\")\n\n        crpix1 = header.get(f\"CRPIX1{wcskey}\")\n        crpix2 = header.get(f\"CRPIX2{wcskey}\")\n\n        return Sip(a, b, ap, bp, (crpix1, crpix2))\n\n    def _write_sip_kw(self):\n        \"\"\"\n        Write out SIP keywords.  Returns a dictionary of key-value\n        pairs.\n        \"\"\"\n        if self.sip is None:\n            return {}\n\n        keywords = {}\n\n        def write_array(name, a):\n            if a is None:\n                return\n            size = a.shape[0]\n            trdir = 'sky to detector' if name[-1] == 'P' else 'detector to sky'\n            comment = ('SIP polynomial order, axis {:d}, {:s}'\n                       .format(ord(name[0]) - ord('A'), trdir))\n            keywords[f'{name}_ORDER'] = size - 1, comment\n\n            comment = 'SIP distortion coefficient'\n            for i in range(size):\n                for j in range(size - i):\n                    if a[i, j] != 0.0:\n                        keywords[\n                            f'{name}_{i:d}_{j:d}'] = a[i, j], comment\n\n        write_array('A', self.sip.a)\n        write_array('B', self.sip.b)\n        write_array('AP', self.sip.ap)\n        write_array('BP', self.sip.bp)\n\n        return keywords\n\n    def _denormalize_sky(self, sky):\n        if self.wcs.lngtyp != 'RA':\n            raise ValueError(\n                \"WCS does not have longitude type of 'RA', therefore \" +\n                \"(ra, dec) data can not be used as input\")\n        if self.wcs.lattyp != 'DEC':\n            raise ValueError(\n                \"WCS does not have longitude type of 'DEC', therefore \" +\n                \"(ra, dec) data can not be used as input\")\n        if self.wcs.naxis == 2:\n            if self.wcs.lng == 0 and self.wcs.lat == 1:\n                return sky\n            elif self.wcs.lng == 1 and self.wcs.lat == 0:\n                # Reverse the order of the columns\n                return sky[:, ::-1]\n            else:\n                raise ValueError(\n                    \"WCS does not have longitude and latitude celestial \" +\n                    \"axes, therefore (ra, dec) data can not be used as input\")\n        else:\n            if self.wcs.lng < 0 or self.wcs.lat < 0:\n                raise ValueError(\n                    \"WCS does not have both longitude and latitude \"\n                    \"celestial axes, therefore (ra, dec) data can not be \" +\n                    \"used as input\")\n            out = np.zeros((sky.shape[0], self.wcs.naxis))\n            out[:, self.wcs.lng] = sky[:, 0]\n            out[:, self.wcs.lat] = sky[:, 1]\n            return out\n\n    def _normalize_sky(self, sky):\n        if self.wcs.lngtyp != 'RA':\n            raise ValueError(\n                \"WCS does not have longitude type of 'RA', therefore \" +\n                \"(ra, dec) data can not be returned\")\n        if self.wcs.lattyp != 'DEC':\n            raise ValueError(\n                \"WCS does not have longitude type of 'DEC', therefore \" +\n                \"(ra, dec) data can not be returned\")\n        if self.wcs.naxis == 2:\n            if self.wcs.lng == 0 and self.wcs.lat == 1:\n                return sky\n            elif self.wcs.lng == 1 and self.wcs.lat == 0:\n                # Reverse the order of the columns\n                return sky[:, ::-1]\n            else:\n                raise ValueError(\n                    \"WCS does not have longitude and latitude celestial \"\n                    \"axes, therefore (ra, dec) data can not be returned\")\n        else:\n            if self.wcs.lng < 0 or self.wcs.lat < 0:\n                raise ValueError(\n                    \"WCS does not have both longitude and latitude celestial \"\n                    \"axes, therefore (ra, dec) data can not be returned\")\n            out = np.empty((sky.shape[0], 2))\n            out[:, 0] = sky[:, self.wcs.lng]\n            out[:, 1] = sky[:, self.wcs.lat]\n            return out\n\n    def _array_converter(self, func, sky, *args, ra_dec_order=False):\n        \"\"\"\n        A helper function to support reading either a pair of arrays\n        or a single Nx2 array.\n        \"\"\"\n\n        def _return_list_of_arrays(axes, origin):\n            if any([x.size == 0 for x in axes]):\n                return axes\n\n            try:\n                axes = np.broadcast_arrays(*axes)\n            except ValueError:\n                raise ValueError(\n                    \"Coordinate arrays are not broadcastable to each other\")\n\n            xy = np.hstack([x.reshape((x.size, 1)) for x in axes])\n\n            if ra_dec_order and sky == 'input':\n                xy = self._denormalize_sky(xy)\n            output = func(xy, origin)\n            if ra_dec_order and sky == 'output':\n                output = self._normalize_sky(output)\n                return (output[:, 0].reshape(axes[0].shape),\n                        output[:, 1].reshape(axes[0].shape))\n            return [output[:, i].reshape(axes[0].shape)\n                    for i in range(output.shape[1])]\n\n        def _return_single_array(xy, origin):\n            if xy.shape[-1] != self.naxis:\n                raise ValueError(\n                    \"When providing two arguments, the array must be \"\n                    \"of shape (N, {})\".format(self.naxis))\n            if 0 in xy.shape:\n                return xy\n            if ra_dec_order and sky == 'input':\n                xy = self._denormalize_sky(xy)\n            result = func(xy, origin)\n            if ra_dec_order and sky == 'output':\n                result = self._normalize_sky(result)\n            return result\n\n        if len(args) == 2:\n            try:\n                xy, origin = args\n                xy = np.asarray(xy)\n                origin = int(origin)\n            except Exception:\n                raise TypeError(\n                    \"When providing two arguments, they must be \"\n                    \"(coords[N][{}], origin)\".format(self.naxis))\n            if xy.shape == () or len(xy.shape) == 1:\n                return _return_list_of_arrays([xy], origin)\n            return _return_single_array(xy, origin)\n\n        elif len(args) == self.naxis + 1:\n            axes = args[:-1]\n            origin = args[-1]\n            try:\n                axes = [np.asarray(x) for x in axes]\n                origin = int(origin)\n            except Exception:\n                raise TypeError(\n                    \"When providing more than two arguments, they must be \" +\n                    \"a 1-D array for each axis, followed by an origin.\")\n\n            return _return_list_of_arrays(axes, origin)\n\n        raise TypeError(\n            \"WCS projection has {0} dimensions, so expected 2 (an Nx{0} array \"\n            \"and the origin argument) or {1} arguments (the position in each \"\n            \"dimension, and the origin argument). Instead, {2} arguments were \"\n            \"given.\".format(\n                self.naxis, self.naxis + 1, len(args)))\n\n    def all_pix2world(self, *args, **kwargs):\n        return self._array_converter(\n            self._all_pix2world, 'output', *args, **kwargs)\n    all_pix2world.__doc__ = \"\"\"\n        Transforms pixel coordinates to world coordinates.\n\n        Performs all of the following in series:\n\n            - Detector to image plane correction (if present in the\n              FITS file)\n\n            - `SIP`_ distortion correction (if present in the FITS\n              file)\n\n            - `distortion paper`_ table-lookup correction (if present\n              in the FITS file)\n\n            - `wcslib`_ \"core\" WCS transformation\n\n        Parameters\n        ----------\n        {}\n\n            For a transformation that is not two-dimensional, the\n            two-argument form must be used.\n\n        {}\n\n        Returns\n        -------\n\n        {}\n\n        Notes\n        -----\n        The order of the axes for the result is determined by the\n        ``CTYPEia`` keywords in the FITS header, therefore it may not\n        always be of the form (*ra*, *dec*).  The\n        `~astropy.wcs.Wcsprm.lat`, `~astropy.wcs.Wcsprm.lng`,\n        `~astropy.wcs.Wcsprm.lattyp` and `~astropy.wcs.Wcsprm.lngtyp`\n        members can be used to determine the order of the axes.\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        SingularMatrixError\n            Linear transformation matrix is singular.\n\n        InconsistentAxisTypesError\n            Inconsistent or unrecognized coordinate axis types.\n\n        ValueError\n            Invalid parameter value.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n\n        ValueError\n            x- and y-coordinate arrays are not the same size.\n\n        InvalidTransformError\n            Invalid coordinate transformation parameters.\n\n        InvalidTransformError\n            Ill-conditioned coordinate transformation parameters.\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('naxis', 8),\n                   docstrings.RA_DEC_ORDER(8),\n                   docstrings.RETURNS('sky coordinates, in degrees', 8))\n\n    def wcs_pix2world(self, *args, **kwargs):\n        if self.wcs is None:\n            raise ValueError(\"No basic WCS settings were created.\")\n        return self._array_converter(\n            lambda xy, o: self.wcs.p2s(xy, o)['world'],\n            'output', *args, **kwargs)\n    wcs_pix2world.__doc__ = \"\"\"\n        Transforms pixel coordinates to world coordinates by doing\n        only the basic `wcslib`_ transformation.\n\n        No `SIP`_ or `distortion paper`_ table lookup correction is\n        applied.  To perform distortion correction, see\n        `~astropy.wcs.WCS.all_pix2world`,\n        `~astropy.wcs.WCS.sip_pix2foc`, `~astropy.wcs.WCS.p4_pix2foc`,\n        or `~astropy.wcs.WCS.pix2foc`.\n\n        Parameters\n        ----------\n        {}\n\n            For a transformation that is not two-dimensional, the\n            two-argument form must be used.\n\n        {}\n\n        Returns\n        -------\n\n        {}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        SingularMatrixError\n            Linear transformation matrix is singular.\n\n        InconsistentAxisTypesError\n            Inconsistent or unrecognized coordinate axis types.\n\n        ValueError\n            Invalid parameter value.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n\n        ValueError\n            x- and y-coordinate arrays are not the same size.\n\n        InvalidTransformError\n            Invalid coordinate transformation parameters.\n\n        InvalidTransformError\n            Ill-conditioned coordinate transformation parameters.\n\n        Notes\n        -----\n        The order of the axes for the result is determined by the\n        ``CTYPEia`` keywords in the FITS header, therefore it may not\n        always be of the form (*ra*, *dec*).  The\n        `~astropy.wcs.Wcsprm.lat`, `~astropy.wcs.Wcsprm.lng`,\n        `~astropy.wcs.Wcsprm.lattyp` and `~astropy.wcs.Wcsprm.lngtyp`\n        members can be used to determine the order of the axes.\n\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('naxis', 8),\n                   docstrings.RA_DEC_ORDER(8),\n                   docstrings.RETURNS('world coordinates, in degrees', 8))\n\n    def _all_world2pix(self, world, origin, tolerance, maxiter, adaptive,\n                       detect_divergence, quiet):\n        # ############################################################\n        # #          DESCRIPTION OF THE NUMERICAL METHOD            ##\n        # ############################################################\n        # In this section I will outline the method of solving\n        # the inverse problem of converting world coordinates to\n        # pixel coordinates (*inverse* of the direct transformation\n        # `all_pix2world`) and I will summarize some of the aspects\n        # of the method proposed here and some of the issues of the\n        # original `all_world2pix` (in relation to this method)\n        # discussed in https://github.com/astropy/astropy/issues/1977\n        # A more detailed discussion can be found here:\n        # https://github.com/astropy/astropy/pull/2373\n        #\n        #\n        #                  ### Background ###\n        #\n        #\n        # I will refer here to the [SIP Paper]\n        # (http://fits.gsfc.nasa.gov/registry/sip/SIP_distortion_v1_0.pdf).\n        # According to this paper, the effect of distortions as\n        # described in *their* equation (1) is:\n        #\n        # (1)   x = CD*(u+f(u)),\n        #\n        # where `x` is a *vector* of \"intermediate spherical\n        # coordinates\" (equivalent to (x,y) in the paper) and `u`\n        # is a *vector* of \"pixel coordinates\", and `f` is a vector\n        # function describing geometrical distortions\n        # (see equations 2 and 3 in SIP Paper.\n        # However, I prefer to use `w` for \"intermediate world\n        # coordinates\", `x` for pixel coordinates, and assume that\n        # transformation `W` performs the **linear**\n        # (CD matrix + projection onto celestial sphere) part of the\n        # conversion from pixel coordinates to world coordinates.\n        # Then we can re-write (1) as:\n        #\n        # (2)   w = W*(x+f(x)) = T(x)\n        #\n        # In `astropy.wcs.WCS` transformation `W` is represented by\n        # the `wcs_pix2world` member, while the combined (\"total\")\n        # transformation (linear part + distortions) is performed by\n        # `all_pix2world`. Below I summarize the notations and their\n        # equivalents in `astropy.wcs.WCS`:\n        #\n        # | Equation term | astropy.WCS/meaning          |\n        # | ------------- | ---------------------------- |\n        # | `x`           | pixel coordinates            |\n        # | `w`           | world coordinates            |\n        # | `W`           | `wcs_pix2world()`            |\n        # | `W^{-1}`      | `wcs_world2pix()`            |\n        # | `T`           | `all_pix2world()`            |\n        # | `x+f(x)`      | `pix2foc()`                  |\n        #\n        #\n        #      ### Direct Solving of Equation (2)  ###\n        #\n        #\n        # In order to find the pixel coordinates that correspond to\n        # given world coordinates `w`, it is necessary to invert\n        # equation (2): `x=T^{-1}(w)`, or solve equation `w==T(x)`\n        # for `x`. However, this approach has the following\n        # disadvantages:\n        #    1. It requires unnecessary transformations (see next\n        #       section).\n        #    2. It is prone to \"RA wrapping\" issues as described in\n        # https://github.com/astropy/astropy/issues/1977\n        # (essentially because `all_pix2world` may return points with\n        # a different phase than user's input `w`).\n        #\n        #\n        #      ### Description of the Method Used here ###\n        #\n        #\n        # By applying inverse linear WCS transformation (`W^{-1}`)\n        # to both sides of equation (2) and introducing notation `x'`\n        # (prime) for the pixels coordinates obtained from the world\n        # coordinates by applying inverse *linear* WCS transformation\n        # (\"focal plane coordinates\"):\n        #\n        # (3)   x' = W^{-1}(w)\n        #\n        # we obtain the following equation:\n        #\n        # (4)   x' = x+f(x),\n        #\n        # or,\n        #\n        # (5)   x = x'-f(x)\n        #\n        # This equation is well suited for solving using the method\n        # of fixed-point iterations\n        # (http://en.wikipedia.org/wiki/Fixed-point_iteration):\n        #\n        # (6)   x_{i+1} = x'-f(x_i)\n        #\n        # As an initial value of the pixel coordinate `x_0` we take\n        # \"focal plane coordinate\" `x'=W^{-1}(w)=wcs_world2pix(w)`.\n        # We stop iterations when `|x_{i+1}-x_i|<tolerance`. We also\n        # consider the process to be diverging if\n        # `|x_{i+1}-x_i|>|x_i-x_{i-1}|`\n        # **when** `|x_{i+1}-x_i|>=tolerance` (when current\n        # approximation is close to the true solution,\n        # `|x_{i+1}-x_i|>|x_i-x_{i-1}|` may be due to rounding errors\n        # and we ignore such \"divergences\" when\n        # `|x_{i+1}-x_i|<tolerance`). It may appear that checking for\n        # `|x_{i+1}-x_i|<tolerance` in order to ignore divergence is\n        # unnecessary since the iterative process should stop anyway,\n        # however, the proposed implementation of this iterative\n        # process is completely vectorized and, therefore, we may\n        # continue iterating over *some* points even though they have\n        # converged to within a specified tolerance (while iterating\n        # over other points that have not yet converged to\n        # a solution).\n        #\n        # In order to efficiently implement iterative process (6)\n        # using available methods in `astropy.wcs.WCS`, we add and\n        # subtract `x_i` from the right side of equation (6):\n        #\n        # (7)   x_{i+1} = x'-(x_i+f(x_i))+x_i = x'-pix2foc(x_i)+x_i,\n        #\n        # where `x'=wcs_world2pix(w)` and it is computed only *once*\n        # before the beginning of the iterative process (and we also\n        # set `x_0=x'`). By using `pix2foc` at each iteration instead\n        # of `all_pix2world` we get about 25% increase in performance\n        # (by not performing the linear `W` transformation at each\n        # step) and we also avoid the \"RA wrapping\" issue described\n        # above (by working in focal plane coordinates and avoiding\n        # pix->world transformations).\n        #\n        # As an added benefit, the process converges to the correct\n        # solution in just one iteration when distortions are not\n        # present (compare to\n        # https://github.com/astropy/astropy/issues/1977 and\n        # https://github.com/astropy/astropy/pull/2294): in this case\n        # `pix2foc` is the identical transformation\n        # `x_i=pix2foc(x_i)` and from equation (7) we get:\n        #\n        # x' = x_0 = wcs_world2pix(w)\n        # x_1 = x' - pix2foc(x_0) + x_0 = x' - pix2foc(x') + x' = x'\n        #     = wcs_world2pix(w) = x_0\n        # =>\n        # |x_1-x_0| = 0 < tolerance (with tolerance > 0)\n        #\n        # However, for performance reasons, it is still better to\n        # avoid iterations altogether and return the exact linear\n        # solution (`wcs_world2pix`) right-away when non-linear\n        # distortions are not present by checking that attributes\n        # `sip`, `cpdis1`, `cpdis2`, `det2im1`, and `det2im2` are\n        # *all* `None`.\n        #\n        #\n        #         ### Outline of the Algorithm ###\n        #\n        #\n        # While the proposed code is relatively long (considering\n        # the simplicity of the algorithm), this is due to: 1)\n        # checking if iterative solution is necessary at all; 2)\n        # checking for divergence; 3) re-implementation of the\n        # completely vectorized algorithm as an \"adaptive\" vectorized\n        # algorithm (for cases when some points diverge for which we\n        # want to stop iterations). In my tests, the adaptive version\n        # of the algorithm is about 50% slower than non-adaptive\n        # version for all HST images.\n        #\n        # The essential part of the vectorized non-adaptive algorithm\n        # (without divergence and other checks) can be described\n        # as follows:\n        #\n        #     pix0 = self.wcs_world2pix(world, origin)\n        #     pix  = pix0.copy() # 0-order solution\n        #\n        #     for k in range(maxiter):\n        #         # find correction to the previous solution:\n        #         dpix = self.pix2foc(pix, origin) - pix0\n        #\n        #         # compute norm (L2) of the correction:\n        #         dn = np.linalg.norm(dpix, axis=1)\n        #\n        #         # apply correction:\n        #         pix -= dpix\n        #\n        #         # check convergence:\n        #         if np.max(dn) < tolerance:\n        #             break\n        #\n        #    return pix\n        #\n        # Here, the input parameter `world` can be a `MxN` array\n        # where `M` is the number of coordinate axes in WCS and `N`\n        # is the number of points to be converted simultaneously to\n        # image coordinates.\n        #\n        #\n        #                ###  IMPORTANT NOTE:  ###\n        #\n        # If, in the future releases of the `~astropy.wcs`,\n        # `pix2foc` will not apply all the required distortion\n        # corrections then in the code below, calls to `pix2foc` will\n        # have to be replaced with\n        # wcs_world2pix(all_pix2world(pix_list, origin), origin)\n        #\n\n        # ############################################################\n        # #            INITIALIZE ITERATIVE PROCESS:                ##\n        # ############################################################\n\n        # initial approximation (linear WCS based only)\n        pix0 = self.wcs_world2pix(world, origin)\n\n        # Check that an iterative solution is required at all\n        # (when any of the non-CD-matrix-based corrections are\n        # present). If not required return the initial\n        # approximation (pix0).\n        if not self.has_distortion:\n            # No non-WCS corrections detected so\n            # simply return initial approximation:\n            return pix0\n\n        pix = pix0.copy()  # 0-order solution\n\n        # initial correction:\n        dpix = self.pix2foc(pix, origin) - pix0\n\n        # Update initial solution:\n        pix -= dpix\n\n        # Norm (L2) squared of the correction:\n        dn = np.sum(dpix*dpix, axis=1)\n        dnprev = dn.copy()  # if adaptive else dn\n        tol2 = tolerance**2\n\n        # Prepare for iterative process\n        k = 1\n        ind = None\n        inddiv = None\n\n        # Turn off numpy runtime warnings for 'invalid' and 'over':\n        old_invalid = np.geterr()['invalid']\n        old_over = np.geterr()['over']\n        np.seterr(invalid='ignore', over='ignore')\n\n        # ############################################################\n        # #                NON-ADAPTIVE ITERATIONS:                 ##\n        # ############################################################\n        if not adaptive:\n            # Fixed-point iterations:\n            while (np.nanmax(dn) >= tol2 and k < maxiter):\n                # Find correction to the previous solution:\n                dpix = self.pix2foc(pix, origin) - pix0\n\n                # Compute norm (L2) squared of the correction:\n                dn = np.sum(dpix*dpix, axis=1)\n\n                # Check for divergence (we do this in two stages\n                # to optimize performance for the most common\n                # scenario when successive approximations converge):\n                if detect_divergence:\n                    divergent = (dn >= dnprev)\n                    if np.any(divergent):\n                        # Find solutions that have not yet converged:\n                        slowconv = (dn >= tol2)\n                        inddiv, = np.where(divergent & slowconv)\n\n                        if inddiv.shape[0] > 0:\n                            # Update indices of elements that\n                            # still need correction:\n                            conv = (dn < dnprev)\n                            iconv = np.where(conv)\n\n                            # Apply correction:\n                            dpixgood = dpix[iconv]\n                            pix[iconv] -= dpixgood\n                            dpix[iconv] = dpixgood\n\n                            # For the next iteration choose\n                            # non-divergent points that have not yet\n                            # converged to the requested accuracy:\n                            ind, = np.where(slowconv & conv)\n                            pix0 = pix0[ind]\n                            dnprev[ind] = dn[ind]\n                            k += 1\n\n                            # Switch to adaptive iterations:\n                            adaptive = True\n                            break\n                    # Save current correction magnitudes for later:\n                    dnprev = dn\n\n                # Apply correction:\n                pix -= dpix\n                k += 1\n\n        # ############################################################\n        # #                  ADAPTIVE ITERATIONS:                   ##\n        # ############################################################\n        if adaptive:\n            if ind is None:\n                ind, = np.where(np.isfinite(pix).all(axis=1))\n                pix0 = pix0[ind]\n\n            # \"Adaptive\" fixed-point iterations:\n            while (ind.shape[0] > 0 and k < maxiter):\n                # Find correction to the previous solution:\n                dpixnew = self.pix2foc(pix[ind], origin) - pix0\n\n                # Compute norm (L2) of the correction:\n                dnnew = np.sum(np.square(dpixnew), axis=1)\n\n                # Bookkeeping of corrections:\n                dnprev[ind] = dn[ind].copy()\n                dn[ind] = dnnew\n\n                if detect_divergence:\n                    # Find indices of pixels that are converging:\n                    conv = (dnnew < dnprev[ind])\n                    iconv = np.where(conv)\n                    iiconv = ind[iconv]\n\n                    # Apply correction:\n                    dpixgood = dpixnew[iconv]\n                    pix[iiconv] -= dpixgood\n                    dpix[iiconv] = dpixgood\n\n                    # Find indices of solutions that have not yet\n                    # converged to the requested accuracy\n                    # AND that do not diverge:\n                    subind, = np.where((dnnew >= tol2) & conv)\n\n                else:\n                    # Apply correction:\n                    pix[ind] -= dpixnew\n                    dpix[ind] = dpixnew\n\n                    # Find indices of solutions that have not yet\n                    # converged to the requested accuracy:\n                    subind, = np.where(dnnew >= tol2)\n\n                # Choose solutions that need more iterations:\n                ind = ind[subind]\n                pix0 = pix0[subind]\n\n                k += 1\n\n        # ############################################################\n        # #         FINAL DETECTION OF INVALID, DIVERGING,          ##\n        # #         AND FAILED-TO-CONVERGE POINTS                   ##\n        # ############################################################\n        # Identify diverging and/or invalid points:\n        invalid = ((~np.all(np.isfinite(pix), axis=1)) &\n                   (np.all(np.isfinite(world), axis=1)))\n\n        # When detect_divergence==False, dnprev is outdated\n        # (it is the norm of the very first correction).\n        # Still better than nothing...\n        inddiv, = np.where(((dn >= tol2) & (dn >= dnprev)) | invalid)\n        if inddiv.shape[0] == 0:\n            inddiv = None\n\n        # Identify points that did not converge within 'maxiter'\n        # iterations:\n        if k >= maxiter:\n            ind, = np.where((dn >= tol2) & (dn < dnprev) & (~invalid))\n            if ind.shape[0] == 0:\n                ind = None\n        else:\n            ind = None\n\n        # Restore previous numpy error settings:\n        np.seterr(invalid=old_invalid, over=old_over)\n\n        # ############################################################\n        # #  RAISE EXCEPTION IF DIVERGING OR TOO SLOWLY CONVERGING  ##\n        # #  DATA POINTS HAVE BEEN DETECTED:                        ##\n        # ############################################################\n        if (ind is not None or inddiv is not None) and not quiet:\n            if inddiv is None:\n                raise NoConvergence(\n                    \"'WCS.all_world2pix' failed to \"\n                    \"converge to the requested accuracy after {:d} \"\n                    \"iterations.\".format(k), best_solution=pix,\n                    accuracy=np.abs(dpix), niter=k,\n                    slow_conv=ind, divergent=None)\n            else:\n                raise NoConvergence(\n                    \"'WCS.all_world2pix' failed to \"\n                    \"converge to the requested accuracy.\\n\"\n                    \"After {:d} iterations, the solution is diverging \"\n                    \"at least for one input point.\"\n                    .format(k), best_solution=pix,\n                    accuracy=np.abs(dpix), niter=k,\n                    slow_conv=ind, divergent=inddiv)\n\n        return pix\n\n    @deprecated_renamed_argument('accuracy', 'tolerance', '4.3')\n    def all_world2pix(self, *args, tolerance=1e-4, maxiter=20, adaptive=False,\n                      detect_divergence=True, quiet=False, **kwargs):\n        if self.wcs is None:\n            raise ValueError(\"No basic WCS settings were created.\")\n\n        return self._array_converter(\n            lambda *args, **kwargs:\n            self._all_world2pix(\n                *args, tolerance=tolerance, maxiter=maxiter,\n                adaptive=adaptive, detect_divergence=detect_divergence,\n                quiet=quiet),\n            'input', *args, **kwargs\n        )\n\n    all_world2pix.__doc__ = \"\"\"\n        all_world2pix(*arg, tolerance=1.0e-4, maxiter=20,\n        adaptive=False, detect_divergence=True, quiet=False)\n\n        Transforms world coordinates to pixel coordinates, using\n        numerical iteration to invert the full forward transformation\n        `~astropy.wcs.WCS.all_pix2world` with complete\n        distortion model.\n\n\n        Parameters\n        ----------\n        {0}\n\n            For a transformation that is not two-dimensional, the\n            two-argument form must be used.\n\n        {1}\n\n        tolerance : float, optional (default = 1.0e-4)\n            Tolerance of solution. Iteration terminates when the\n            iterative solver estimates that the \"true solution\" is\n            within this many pixels current estimate, more\n            specifically, when the correction to the solution found\n            during the previous iteration is smaller\n            (in the sense of the L2 norm) than ``tolerance``.\n\n        maxiter : int, optional (default = 20)\n            Maximum number of iterations allowed to reach a solution.\n\n        quiet : bool, optional (default = False)\n            Do not throw :py:class:`NoConvergence` exceptions when\n            the method does not converge to a solution with the\n            required accuracy within a specified number of maximum\n            iterations set by ``maxiter`` parameter. Instead,\n            simply return the found solution.\n\n        Other Parameters\n        ----------------\n        adaptive : bool, optional (default = False)\n            Specifies whether to adaptively select only points that\n            did not converge to a solution within the required\n            accuracy for the next iteration. Default is recommended\n            for HST as well as most other instruments.\n\n            .. note::\n               The :py:meth:`all_world2pix` uses a vectorized\n               implementation of the method of consecutive\n               approximations (see ``Notes`` section below) in which it\n               iterates over *all* input points *regardless* until\n               the required accuracy has been reached for *all* input\n               points. In some cases it may be possible that\n               *almost all* points have reached the required accuracy\n               but there are only a few of input data points for\n               which additional iterations may be needed (this\n               depends mostly on the characteristics of the geometric\n               distortions for a given instrument). In this situation\n               it may be advantageous to set ``adaptive`` = `True` in\n               which case :py:meth:`all_world2pix` will continue\n               iterating *only* over the points that have not yet\n               converged to the required accuracy. However, for the\n               HST's ACS/WFC detector, which has the strongest\n               distortions of all HST instruments, testing has\n               shown that enabling this option would lead to a about\n               50-100% penalty in computational time (depending on\n               specifics of the image, geometric distortions, and\n               number of input points to be converted). Therefore,\n               for HST and possibly instruments, it is recommended\n               to set ``adaptive`` = `False`. The only danger in\n               getting this setting wrong will be a performance\n               penalty.\n\n            .. note::\n               When ``detect_divergence`` is `True`,\n               :py:meth:`all_world2pix` will automatically switch\n               to the adaptive algorithm once divergence has been\n               detected.\n\n        detect_divergence : bool, optional (default = True)\n            Specifies whether to perform a more detailed analysis\n            of the convergence to a solution. Normally\n            :py:meth:`all_world2pix` may not achieve the required\n            accuracy if either the ``tolerance`` or ``maxiter`` arguments\n            are too low. However, it may happen that for some\n            geometric distortions the conditions of convergence for\n            the the method of consecutive approximations used by\n            :py:meth:`all_world2pix` may not be satisfied, in which\n            case consecutive approximations to the solution will\n            diverge regardless of the ``tolerance`` or ``maxiter``\n            settings.\n\n            When ``detect_divergence`` is `False`, these divergent\n            points will be detected as not having achieved the\n            required accuracy (without further details). In addition,\n            if ``adaptive`` is `False` then the algorithm will not\n            know that the solution (for specific points) is diverging\n            and will continue iterating and trying to \"improve\"\n            diverging solutions. This may result in ``NaN`` or\n            ``Inf`` values in the return results (in addition to a\n            performance penalties). Even when ``detect_divergence``\n            is `False`, :py:meth:`all_world2pix`, at the end of the\n            iterative process, will identify invalid results\n            (``NaN`` or ``Inf``) as \"diverging\" solutions and will\n            raise :py:class:`NoConvergence` unless the ``quiet``\n            parameter is set to `True`.\n\n            When ``detect_divergence`` is `True`,\n            :py:meth:`all_world2pix` will detect points for which\n            current correction to the coordinates is larger than\n            the correction applied during the previous iteration\n            **if** the requested accuracy **has not yet been\n            achieved**. In this case, if ``adaptive`` is `True`,\n            these points will be excluded from further iterations and\n            if ``adaptive`` is `False`, :py:meth:`all_world2pix` will\n            automatically switch to the adaptive algorithm. Thus, the\n            reported divergent solution will be the latest converging\n            solution computed immediately *before* divergence\n            has been detected.\n\n            .. note::\n               When accuracy has been achieved, small increases in\n               current corrections may be possible due to rounding\n               errors (when ``adaptive`` is `False`) and such\n               increases will be ignored.\n\n            .. note::\n               Based on our testing using HST ACS/WFC images, setting\n               ``detect_divergence`` to `True` will incur about 5-20%\n               performance penalty with the larger penalty\n               corresponding to ``adaptive`` set to `True`.\n               Because the benefits of enabling this\n               feature outweigh the small performance penalty,\n               especially when ``adaptive`` = `False`, it is\n               recommended to set ``detect_divergence`` to `True`,\n               unless extensive testing of the distortion models for\n               images from specific instruments show a good stability\n               of the numerical method for a wide range of\n               coordinates (even outside the image itself).\n\n            .. note::\n               Indices of the diverging inverse solutions will be\n               reported in the ``divergent`` attribute of the\n               raised :py:class:`NoConvergence` exception object.\n\n        Returns\n        -------\n\n        {2}\n\n        Notes\n        -----\n        The order of the axes for the input world array is determined by\n        the ``CTYPEia`` keywords in the FITS header, therefore it may\n        not always be of the form (*ra*, *dec*).  The\n        `~astropy.wcs.Wcsprm.lat`, `~astropy.wcs.Wcsprm.lng`,\n        `~astropy.wcs.Wcsprm.lattyp`, and\n        `~astropy.wcs.Wcsprm.lngtyp`\n        members can be used to determine the order of the axes.\n\n        Using the method of fixed-point iterations approximations we\n        iterate starting with the initial approximation, which is\n        computed using the non-distortion-aware\n        :py:meth:`wcs_world2pix` (or equivalent).\n\n        The :py:meth:`all_world2pix` function uses a vectorized\n        implementation of the method of consecutive approximations and\n        therefore it is highly efficient (>30x) when *all* data points\n        that need to be converted from sky coordinates to image\n        coordinates are passed at *once*. Therefore, it is advisable,\n        whenever possible, to pass as input a long array of all points\n        that need to be converted to :py:meth:`all_world2pix` instead\n        of calling :py:meth:`all_world2pix` for each data point. Also\n        see the note to the ``adaptive`` parameter.\n\n        Raises\n        ------\n        NoConvergence\n            The method did not converge to a\n            solution to the required accuracy within a specified\n            number of maximum iterations set by the ``maxiter``\n            parameter. To turn off this exception, set ``quiet`` to\n            `True`. Indices of the points for which the requested\n            accuracy was not achieved (if any) will be listed in the\n            ``slow_conv`` attribute of the\n            raised :py:class:`NoConvergence` exception object.\n\n            See :py:class:`NoConvergence` documentation for\n            more details.\n\n        MemoryError\n            Memory allocation failed.\n\n        SingularMatrixError\n            Linear transformation matrix is singular.\n\n        InconsistentAxisTypesError\n            Inconsistent or unrecognized coordinate axis types.\n\n        ValueError\n            Invalid parameter value.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n\n        ValueError\n            x- and y-coordinate arrays are not the same size.\n\n        InvalidTransformError\n            Invalid coordinate transformation parameters.\n\n        InvalidTransformError\n            Ill-conditioned coordinate transformation parameters.\n\n        Examples\n        --------\n        >>> import astropy.io.fits as fits\n        >>> import astropy.wcs as wcs\n        >>> import numpy as np\n        >>> import os\n\n        >>> filename = os.path.join(wcs.__path__[0], 'tests/data/j94f05bgq_flt.fits')\n        >>> hdulist = fits.open(filename)\n        >>> w = wcs.WCS(hdulist[('sci',1)].header, hdulist)\n        >>> hdulist.close()\n\n        >>> ra, dec = w.all_pix2world([1,2,3], [1,1,1], 1)\n        >>> print(ra)  # doctest: +FLOAT_CMP\n        [ 5.52645627  5.52649663  5.52653698]\n        >>> print(dec)  # doctest: +FLOAT_CMP\n        [-72.05171757 -72.05171276 -72.05170795]\n        >>> radec = w.all_pix2world([[1,1], [2,1], [3,1]], 1)\n        >>> print(radec)  # doctest: +FLOAT_CMP\n        [[  5.52645627 -72.05171757]\n         [  5.52649663 -72.05171276]\n         [  5.52653698 -72.05170795]]\n        >>> x, y = w.all_world2pix(ra, dec, 1)\n        >>> print(x)  # doctest: +FLOAT_CMP\n        [ 1.00000238  2.00000237  3.00000236]\n        >>> print(y)  # doctest: +FLOAT_CMP\n        [ 0.99999996  0.99999997  0.99999997]\n        >>> xy = w.all_world2pix(radec, 1)\n        >>> print(xy)  # doctest: +FLOAT_CMP\n        [[ 1.00000238  0.99999996]\n         [ 2.00000237  0.99999997]\n         [ 3.00000236  0.99999997]]\n        >>> xy = w.all_world2pix(radec, 1, maxiter=3,\n        ...                      tolerance=1.0e-10, quiet=False)\n        Traceback (most recent call last):\n        ...\n        NoConvergence: 'WCS.all_world2pix' failed to converge to the\n        requested accuracy. After 3 iterations, the solution is\n        diverging at least for one input point.\n\n        >>> # Now try to use some diverging data:\n        >>> divradec = w.all_pix2world([[1.0, 1.0],\n        ...                             [10000.0, 50000.0],\n        ...                             [3.0, 1.0]], 1)\n        >>> print(divradec)  # doctest: +FLOAT_CMP\n        [[  5.52645627 -72.05171757]\n         [  7.15976932 -70.8140779 ]\n         [  5.52653698 -72.05170795]]\n\n        >>> # First, turn detect_divergence on:\n        >>> try:  # doctest: +FLOAT_CMP\n        ...   xy = w.all_world2pix(divradec, 1, maxiter=20,\n        ...                        tolerance=1.0e-4, adaptive=False,\n        ...                        detect_divergence=True,\n        ...                        quiet=False)\n        ... except wcs.wcs.NoConvergence as e:\n        ...   print(\"Indices of diverging points: {{0}}\"\n        ...         .format(e.divergent))\n        ...   print(\"Indices of poorly converging points: {{0}}\"\n        ...         .format(e.slow_conv))\n        ...   print(\"Best solution:\\\\n{{0}}\".format(e.best_solution))\n        ...   print(\"Achieved accuracy:\\\\n{{0}}\".format(e.accuracy))\n        Indices of diverging points: [1]\n        Indices of poorly converging points: None\n        Best solution:\n        [[  1.00000238e+00   9.99999965e-01]\n         [ -1.99441636e+06   1.44309097e+06]\n         [  3.00000236e+00   9.99999966e-01]]\n        Achieved accuracy:\n        [[  6.13968380e-05   8.59638593e-07]\n         [  8.59526812e+11   6.61713548e+11]\n         [  6.09398446e-05   8.38759724e-07]]\n        >>> raise e\n        Traceback (most recent call last):\n        ...\n        NoConvergence: 'WCS.all_world2pix' failed to converge to the\n        requested accuracy.  After 5 iterations, the solution is\n        diverging at least for one input point.\n\n        >>> # This time turn detect_divergence off:\n        >>> try:  # doctest: +FLOAT_CMP\n        ...   xy = w.all_world2pix(divradec, 1, maxiter=20,\n        ...                        tolerance=1.0e-4, adaptive=False,\n        ...                        detect_divergence=False,\n        ...                        quiet=False)\n        ... except wcs.wcs.NoConvergence as e:\n        ...   print(\"Indices of diverging points: {{0}}\"\n        ...         .format(e.divergent))\n        ...   print(\"Indices of poorly converging points: {{0}}\"\n        ...         .format(e.slow_conv))\n        ...   print(\"Best solution:\\\\n{{0}}\".format(e.best_solution))\n        ...   print(\"Achieved accuracy:\\\\n{{0}}\".format(e.accuracy))\n        Indices of diverging points: [1]\n        Indices of poorly converging points: None\n        Best solution:\n        [[ 1.00000009  1.        ]\n         [        nan         nan]\n         [ 3.00000009  1.        ]]\n        Achieved accuracy:\n        [[  2.29417358e-06   3.21222995e-08]\n         [             nan              nan]\n         [  2.27407877e-06   3.13005639e-08]]\n        >>> raise e\n        Traceback (most recent call last):\n        ...\n        NoConvergence: 'WCS.all_world2pix' failed to converge to the\n        requested accuracy.  After 6 iterations, the solution is\n        diverging at least for one input point.\n\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('naxis', 8),\n                   docstrings.RA_DEC_ORDER(8),\n                   docstrings.RETURNS('pixel coordinates', 8))\n\n    def wcs_world2pix(self, *args, **kwargs):\n        if self.wcs is None:\n            raise ValueError(\"No basic WCS settings were created.\")\n        return self._array_converter(\n            lambda xy, o: self.wcs.s2p(xy, o)['pixcrd'],\n            'input', *args, **kwargs)\n    wcs_world2pix.__doc__ = \"\"\"\n        Transforms world coordinates to pixel coordinates, using only\n        the basic `wcslib`_ WCS transformation.  No `SIP`_ or\n        `distortion paper`_ table lookup transformation is applied.\n\n        Parameters\n        ----------\n        {}\n\n            For a transformation that is not two-dimensional, the\n            two-argument form must be used.\n\n        {}\n\n        Returns\n        -------\n\n        {}\n\n        Notes\n        -----\n        The order of the axes for the input world array is determined by\n        the ``CTYPEia`` keywords in the FITS header, therefore it may\n        not always be of the form (*ra*, *dec*).  The\n        `~astropy.wcs.Wcsprm.lat`, `~astropy.wcs.Wcsprm.lng`,\n        `~astropy.wcs.Wcsprm.lattyp` and `~astropy.wcs.Wcsprm.lngtyp`\n        members can be used to determine the order of the axes.\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        SingularMatrixError\n            Linear transformation matrix is singular.\n\n        InconsistentAxisTypesError\n            Inconsistent or unrecognized coordinate axis types.\n\n        ValueError\n            Invalid parameter value.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n\n        ValueError\n            x- and y-coordinate arrays are not the same size.\n\n        InvalidTransformError\n            Invalid coordinate transformation parameters.\n\n        InvalidTransformError\n            Ill-conditioned coordinate transformation parameters.\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('naxis', 8),\n                   docstrings.RA_DEC_ORDER(8),\n                   docstrings.RETURNS('pixel coordinates', 8))\n\n    def pix2foc(self, *args):\n        return self._array_converter(self._pix2foc, None, *args)\n    pix2foc.__doc__ = \"\"\"\n        Convert pixel coordinates to focal plane coordinates using the\n        `SIP`_ polynomial distortion convention and `distortion\n        paper`_ table-lookup correction.\n\n        The output is in absolute pixel coordinates, not relative to\n        ``CRPIX``.\n\n        Parameters\n        ----------\n\n        {}\n\n        Returns\n        -------\n\n        {}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('2', 8),\n                   docstrings.RETURNS('focal coordinates', 8))\n\n    def p4_pix2foc(self, *args):\n        return self._array_converter(self._p4_pix2foc, None, *args)\n    p4_pix2foc.__doc__ = \"\"\"\n        Convert pixel coordinates to focal plane coordinates using\n        `distortion paper`_ table-lookup correction.\n\n        The output is in absolute pixel coordinates, not relative to\n        ``CRPIX``.\n\n        Parameters\n        ----------\n\n        {}\n\n        Returns\n        -------\n\n        {}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('2', 8),\n                   docstrings.RETURNS('focal coordinates', 8))\n\n    def det2im(self, *args):\n        return self._array_converter(self._det2im, None, *args)\n    det2im.__doc__ = \"\"\"\n        Convert detector coordinates to image plane coordinates using\n        `distortion paper`_ table-lookup correction.\n\n        The output is in absolute pixel coordinates, not relative to\n        ``CRPIX``.\n\n        Parameters\n        ----------\n\n        {}\n\n        Returns\n        -------\n\n        {}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('2', 8),\n                   docstrings.RETURNS('pixel coordinates', 8))\n\n    def sip_pix2foc(self, *args):\n        if self.sip is None:\n            if len(args) == 2:\n                return args[0]\n            elif len(args) == 3:\n                return args[:2]\n            else:\n                raise TypeError(\"Wrong number of arguments\")\n        return self._array_converter(self.sip.pix2foc, None, *args)\n    sip_pix2foc.__doc__ = \"\"\"\n        Convert pixel coordinates to focal plane coordinates using the\n        `SIP`_ polynomial distortion convention.\n\n        The output is in pixel coordinates, relative to ``CRPIX``.\n\n        FITS WCS `distortion paper`_ table lookup correction is not\n        applied, even if that information existed in the FITS file\n        that initialized this :class:`~astropy.wcs.WCS` object.  To\n        correct for that, use `~astropy.wcs.WCS.pix2foc` or\n        `~astropy.wcs.WCS.p4_pix2foc`.\n\n        Parameters\n        ----------\n\n        {}\n\n        Returns\n        -------\n\n        {}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('2', 8),\n                   docstrings.RETURNS('focal coordinates', 8))\n\n    def sip_foc2pix(self, *args):\n        if self.sip is None:\n            if len(args) == 2:\n                return args[0]\n            elif len(args) == 3:\n                return args[:2]\n            else:\n                raise TypeError(\"Wrong number of arguments\")\n        return self._array_converter(self.sip.foc2pix, None, *args)\n    sip_foc2pix.__doc__ = \"\"\"\n        Convert focal plane coordinates to pixel coordinates using the\n        `SIP`_ polynomial distortion convention.\n\n        FITS WCS `distortion paper`_ table lookup distortion\n        correction is not applied, even if that information existed in\n        the FITS file that initialized this `~astropy.wcs.WCS` object.\n\n        Parameters\n        ----------\n\n        {}\n\n        Returns\n        -------\n\n        {}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(docstrings.TWO_OR_MORE_ARGS('2', 8),\n                   docstrings.RETURNS('pixel coordinates', 8))\n\n    def proj_plane_pixel_scales(self):\n        \"\"\"\n        Calculate pixel scales along each axis of the image pixel at\n        the ``CRPIX`` location once it is projected onto the\n        \"plane of intermediate world coordinates\" as defined in\n        `Greisen & Calabretta 2002, A&A, 395, 1061 <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1061G>`_.\n\n        .. note::\n            This method is concerned **only** about the transformation\n            \"image plane\"->\"projection plane\" and **not** about the\n            transformation \"celestial sphere\"->\"projection plane\"->\"image plane\".\n            Therefore, this function ignores distortions arising due to\n            non-linear nature of most projections.\n\n        .. note::\n            This method only returns sensible answers if the WCS contains\n            celestial axes, i.e., the `~astropy.wcs.WCS.celestial` WCS object.\n\n        Returns\n        -------\n        scale : list of `~astropy.units.Quantity`\n            A vector of projection plane increments corresponding to each\n            pixel side (axis).\n\n        See Also\n        --------\n        astropy.wcs.utils.proj_plane_pixel_scales\n\n        \"\"\"  # noqa: E501\n        from astropy.wcs.utils import proj_plane_pixel_scales  # Avoid circular import\n        values = proj_plane_pixel_scales(self)\n        units = [u.Unit(x) for x in self.wcs.cunit]\n        return [value * unit for (value, unit) in zip(values, units)]  # Can have different units\n\n    def proj_plane_pixel_area(self):\n        \"\"\"\n        For a **celestial** WCS (see `astropy.wcs.WCS.celestial`), returns pixel\n        area of the image pixel at the ``CRPIX`` location once it is projected\n        onto the \"plane of intermediate world coordinates\" as defined in\n        `Greisen & Calabretta 2002, A&A, 395, 1061 <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1061G>`_.\n\n        .. note::\n            This function is concerned **only** about the transformation\n            \"image plane\"->\"projection plane\" and **not** about the\n            transformation \"celestial sphere\"->\"projection plane\"->\"image plane\".\n            Therefore, this function ignores distortions arising due to\n            non-linear nature of most projections.\n\n        .. note::\n            This method only returns sensible answers if the WCS contains\n            celestial axes, i.e., the `~astropy.wcs.WCS.celestial` WCS object.\n\n        Returns\n        -------\n        area : `~astropy.units.Quantity`\n            Area (in the projection plane) of the pixel at ``CRPIX`` location.\n\n        Raises\n        ------\n        ValueError\n            Pixel area is defined only for 2D pixels. Most likely the\n            `~astropy.wcs.Wcsprm.cd` matrix of the `~astropy.wcs.WCS.celestial`\n            WCS is not a square matrix of second order.\n\n        Notes\n        -----\n\n        Depending on the application, square root of the pixel area can be used to\n        represent a single pixel scale of an equivalent square pixel\n        whose area is equal to the area of a generally non-square pixel.\n\n        See Also\n        --------\n        astropy.wcs.utils.proj_plane_pixel_area\n\n        \"\"\"  # noqa: E501\n        from astropy.wcs.utils import proj_plane_pixel_area  # Avoid circular import\n        value = proj_plane_pixel_area(self)\n        unit = u.Unit(self.wcs.cunit[0]) * u.Unit(self.wcs.cunit[1])  # 2D only\n        return value * unit\n\n    def to_fits(self, relax=False, key=None):\n        \"\"\"\n        Generate an `~astropy.io.fits.HDUList` object with all of the\n        information stored in this object.  This should be logically identical\n        to the input FITS file, but it will be normalized in a number of ways.\n\n        See `to_header` for some warnings about the output produced.\n\n        Parameters\n        ----------\n\n        relax : bool or int, optional\n            Degree of permissiveness:\n\n            - `False` (default): Write all extensions that are\n              considered to be safe and recommended.\n\n            - `True`: Write all recognized informal extensions of the\n              WCS standard.\n\n            - `int`: a bit field selecting specific extensions to\n              write.  See :ref:`astropy:relaxwrite` for details.\n\n        key : str\n            The name of a particular WCS transform to use.  This may be\n            either ``' '`` or ``'A'``-``'Z'`` and corresponds to the ``\"a\"``\n            part of the ``CTYPEia`` cards.\n\n        Returns\n        -------\n        hdulist : `~astropy.io.fits.HDUList`\n        \"\"\"\n\n        header = self.to_header(relax=relax, key=key)\n\n        hdu = fits.PrimaryHDU(header=header)\n        hdulist = fits.HDUList(hdu)\n\n        self._write_det2im(hdulist)\n        self._write_distortion_kw(hdulist)\n\n        return hdulist\n\n    def to_header(self, relax=None, key=None):\n        \"\"\"Generate an `astropy.io.fits.Header` object with the basic WCS\n        and SIP information stored in this object.  This should be\n        logically identical to the input FITS file, but it will be\n        normalized in a number of ways.\n\n        .. warning::\n\n          This function does not write out FITS WCS `distortion\n          paper`_ information, since that requires multiple FITS\n          header data units.  To get a full representation of\n          everything in this object, use `to_fits`.\n\n        Parameters\n        ----------\n        relax : bool or int, optional\n            Degree of permissiveness:\n\n            - `False` (default): Write all extensions that are\n              considered to be safe and recommended.\n\n            - `True`: Write all recognized informal extensions of the\n              WCS standard.\n\n            - `int`: a bit field selecting specific extensions to\n              write.  See :ref:`astropy:relaxwrite` for details.\n\n            If the ``relax`` keyword argument is not given and any\n            keywords were omitted from the output, an\n            `~astropy.utils.exceptions.AstropyWarning` is displayed.\n            To override this, explicitly pass a value to ``relax``.\n\n        key : str\n            The name of a particular WCS transform to use.  This may be\n            either ``' '`` or ``'A'``-``'Z'`` and corresponds to the ``\"a\"``\n            part of the ``CTYPEia`` cards.\n\n        Returns\n        -------\n        header : `astropy.io.fits.Header`\n\n        Notes\n        -----\n        The output header will almost certainly differ from the input in a\n        number of respects:\n\n          1. The output header only contains WCS-related keywords.  In\n             particular, it does not contain syntactically-required\n             keywords such as ``SIMPLE``, ``NAXIS``, ``BITPIX``, or\n             ``END``.\n\n          2. Deprecated (e.g. ``CROTAn``) or non-standard usage will\n             be translated to standard (this is partially dependent on\n             whether ``fix`` was applied).\n\n          3. Quantities will be converted to the units used internally,\n             basically SI with the addition of degrees.\n\n          4. Floating-point quantities may be given to a different decimal\n             precision.\n\n          5. Elements of the ``PCi_j`` matrix will be written if and\n             only if they differ from the unit matrix.  Thus, if the\n             matrix is unity then no elements will be written.\n\n          6. Additional keywords such as ``WCSAXES``, ``CUNITia``,\n             ``LONPOLEa`` and ``LATPOLEa`` may appear.\n\n          7. The original keycomments will be lost, although\n             `to_header` tries hard to write meaningful comments.\n\n          8. Keyword order may be changed.\n\n        \"\"\"\n        # default precision for numerical WCS keywords\n        precision = WCSHDO_P14  # Defined by C-ext  # noqa: F821\n        display_warning = False\n        if relax is None:\n            display_warning = True\n            relax = False\n\n        if relax not in (True, False):\n            do_sip = relax & WCSHDO_SIP\n            relax &= ~WCSHDO_SIP\n        else:\n            do_sip = relax\n            relax = WCSHDO_all if relax is True else WCSHDO_safe  # Defined by C-ext  # noqa: F821\n\n        relax = precision | relax\n\n        if self.wcs is not None:\n            if key is not None:\n                orig_key = self.wcs.alt\n                self.wcs.alt = key\n            header_string = self.wcs.to_header(relax)\n            header = fits.Header.fromstring(header_string)\n            keys_to_remove = [\"\", \" \", \"COMMENT\"]\n            for kw in keys_to_remove:\n                if kw in header:\n                    del header[kw]\n            # Check if we can handle TPD distortion correctly\n            if int(_parsed_version[0]) * 10 + int(_parsed_version[1]) < 71:\n                for kw, val in header.items():\n                    if kw[:5] in ('CPDIS', 'CQDIS') and val == 'TPD':\n                        warnings.warn(\n                            f\"WCS contains a TPD distortion model in {kw}. WCSLIB \"\n                            f\"{_wcs.__version__} is writing this in a format incompatible with \"\n                            f\"current versions - please update to 7.4 or use the bundled WCSLIB.\",\n                            AstropyWarning)\n            elif int(_parsed_version[0]) * 10 + int(_parsed_version[1]) < 74:\n                for kw, val in header.items():\n                    if kw[:5] in ('CPDIS', 'CQDIS') and val == 'TPD':\n                        warnings.warn(\n                            f\"WCS contains a TPD distortion model in {kw}, which requires WCSLIB \"\n                            f\"7.4 or later to store in a FITS header (having {_wcs.__version__}).\",\n                            AstropyWarning)\n        else:\n            header = fits.Header()\n\n        if do_sip and self.sip is not None:\n            if self.wcs is not None and any(not ctyp.endswith('-SIP') for ctyp in self.wcs.ctype):\n                self._fix_ctype(header, add_sip=True)\n\n            for kw, val in self._write_sip_kw().items():\n                header[kw] = val\n\n        if not do_sip and self.wcs is not None and any(self.wcs.ctype) and self.sip is not None:\n            # This is called when relax is not False or WCSHDO_SIP\n            # The default case of ``relax=None`` is handled further in the code.\n            header = self._fix_ctype(header, add_sip=False)\n\n        if display_warning:\n            full_header = self.to_header(relax=True, key=key)\n            missing_keys = []\n            for kw, val in full_header.items():\n                if kw not in header:\n                    missing_keys.append(kw)\n\n            if len(missing_keys):\n                warnings.warn(\n                    \"Some non-standard WCS keywords were excluded: {} \"\n                    \"Use the ``relax`` kwarg to control this.\".format(\n                        ', '.join(missing_keys)),\n                    AstropyWarning)\n            # called when ``relax=None``\n            # This is different from the case of ``relax=False``.\n            if any(self.wcs.ctype) and self.sip is not None:\n                header = self._fix_ctype(header, add_sip=False, log_message=False)\n        # Finally reset the key. This must be called after ``_fix_ctype``.\n        if key is not None:\n            self.wcs.alt = orig_key\n        return header\n\n    def _fix_ctype(self, header, add_sip=True, log_message=True):\n        \"\"\"\n        Parameters\n        ----------\n        header : `~astropy.io.fits.Header`\n            FITS header.\n        add_sip : bool\n            Flag indicating whether \"-SIP\" should be added or removed from CTYPE keywords.\n\n            Remove \"-SIP\" from CTYPE when writing out a header with relax=False.\n            This needs to be done outside ``to_header`` because ``to_header`` runs\n            twice when ``relax=False`` and the second time ``relax`` is set to ``True``\n            to display the missing keywords.\n\n            If the user requested SIP distortion to be written out add \"-SIP\" to\n            CTYPE if it is missing.\n        \"\"\"\n\n        _add_sip_to_ctype = \"\"\"\n        Inconsistent SIP distortion information is present in the current WCS:\n        SIP coefficients were detected, but CTYPE is missing \"-SIP\" suffix,\n        therefore the current WCS is internally inconsistent.\n\n        Because relax has been set to True, the resulting output WCS will have\n        \"-SIP\" appended to CTYPE in order to make the header internally consistent.\n\n        However, this may produce incorrect astrometry in the output WCS, if\n        in fact the current WCS is already distortion-corrected.\n\n        Therefore, if current WCS is already distortion-corrected (eg, drizzled)\n        then SIP distortion components should not apply. In that case, for a WCS\n        that is already distortion-corrected, please remove the SIP coefficients\n        from the header.\n\n        \"\"\"\n        if log_message:\n            if add_sip:\n                log.info(_add_sip_to_ctype)\n        for i in range(1, self.naxis+1):\n            # strip() must be called here to cover the case of alt key= \" \"\n            kw = f'CTYPE{i}{self.wcs.alt}'.strip()\n            if kw in header:\n                if add_sip:\n                    val = header[kw].strip(\"-SIP\") + \"-SIP\"\n                else:\n                    val = header[kw].strip(\"-SIP\")\n                header[kw] = val\n            else:\n                continue\n        return header\n\n    def to_header_string(self, relax=None):\n        \"\"\"\n        Identical to `to_header`, but returns a string containing the\n        header cards.\n        \"\"\"\n        return str(self.to_header(relax))\n\n    def footprint_to_file(self, filename='footprint.reg', color='green',\n                          width=2, coordsys=None):\n        \"\"\"\n        Writes out a `ds9`_ style regions file. It can be loaded\n        directly by `ds9`_.\n\n        Parameters\n        ----------\n        filename : str, optional\n            Output file name - default is ``'footprint.reg'``\n\n        color : str, optional\n            Color to use when plotting the line.\n\n        width : int, optional\n            Width of the region line.\n\n        coordsys : str, optional\n            Coordinate system. If not specified (default), the ``radesys``\n            value is used. For all possible values, see\n            http://ds9.si.edu/doc/ref/region.html#RegionFileFormat\n\n        \"\"\"\n        comments = ('# Region file format: DS9 version 4.0 \\n'\n                    '# global color=green font=\"helvetica 12 bold '\n                    'select=1 highlite=1 edit=1 move=1 delete=1 '\n                    'include=1 fixed=0 source\\n')\n\n        coordsys = coordsys or self.wcs.radesys\n\n        if coordsys not in ('PHYSICAL', 'IMAGE', 'FK4', 'B1950', 'FK5',\n                            'J2000', 'GALACTIC', 'ECLIPTIC', 'ICRS', 'LINEAR',\n                            'AMPLIFIER', 'DETECTOR'):\n            raise ValueError(\"Coordinate system '{}' is not supported. A valid\"\n                             \" one can be given with the 'coordsys' argument.\"\n                             .format(coordsys))\n\n        with open(filename, mode='w') as f:\n            f.write(comments)\n            f.write(f'{coordsys}\\n')\n            f.write('polygon(')\n            ftpr = self.calc_footprint()\n            if ftpr is not None:\n                ftpr.tofile(f, sep=',')\n                f.write(f') # color={color}, width={width:d} \\n')\n\n    def _get_naxis(self, header=None):\n        _naxis = []\n        if (header is not None and\n                not isinstance(header, (str, bytes))):\n            for naxis in itertools.count(1):\n                try:\n                    _naxis.append(header[f'NAXIS{naxis}'])\n                except KeyError:\n                    break\n        if len(_naxis) == 0:\n            _naxis = [0, 0]\n        elif len(_naxis) == 1:\n            _naxis.append(0)\n        self._naxis = _naxis\n\n    def printwcs(self):\n        print(repr(self))\n\n    def __repr__(self):\n        '''\n        Return a short description. Simply porting the behavior from\n        the `printwcs()` method.\n        '''\n        description = [\"WCS Keywords\\n\",\n                       f\"Number of WCS axes: {self.naxis!r}\"]\n        sfmt = ' : ' + \"\".join([\"{\"+f\"{i}\"+\"!r}  \" for i in range(self.naxis)])\n\n        keywords = ['CTYPE', 'CRVAL', 'CRPIX']\n        values = [self.wcs.ctype, self.wcs.crval, self.wcs.crpix]\n        for keyword, value in zip(keywords, values):\n            description.append(keyword+sfmt.format(*value))\n\n        if hasattr(self.wcs, 'pc'):\n            for i in range(self.naxis):\n                s = ''\n                for j in range(self.naxis):\n                    s += ''.join(['PC', str(i+1), '_', str(j+1), ' '])\n                s += sfmt\n                description.append(s.format(*self.wcs.pc[i]))\n            s = 'CDELT' + sfmt\n            description.append(s.format(*self.wcs.cdelt))\n        elif hasattr(self.wcs, 'cd'):\n            for i in range(self.naxis):\n                s = ''\n                for j in range(self.naxis):\n                    s += \"\".join(['CD', str(i+1), '_', str(j+1), ' '])\n                s += sfmt\n                description.append(s.format(*self.wcs.cd[i]))\n\n        description.append(f\"NAXIS : {'  '.join(map(str, self._naxis))}\")\n        return '\\n'.join(description)\n\n    def get_axis_types(self):\n        \"\"\"\n        Similar to `self.wcsprm.axis_types <astropy.wcs.Wcsprm.axis_types>`\n        but provides the information in a more Python-friendly format.\n\n        Returns\n        -------\n        result : list of dict\n\n            Returns a list of dictionaries, one for each axis, each\n            containing attributes about the type of that axis.\n\n            Each dictionary has the following keys:\n\n            - 'coordinate_type':\n\n              - None: Non-specific coordinate type.\n\n              - 'stokes': Stokes coordinate.\n\n              - 'celestial': Celestial coordinate (including ``CUBEFACE``).\n\n              - 'spectral': Spectral coordinate.\n\n            - 'scale':\n\n              - 'linear': Linear axis.\n\n              - 'quantized': Quantized axis (``STOKES``, ``CUBEFACE``).\n\n              - 'non-linear celestial': Non-linear celestial axis.\n\n              - 'non-linear spectral': Non-linear spectral axis.\n\n              - 'logarithmic': Logarithmic axis.\n\n              - 'tabular': Tabular axis.\n\n            - 'group'\n\n              - Group number, e.g. lookup table number\n\n            - 'number'\n\n              - For celestial axes:\n\n                - 0: Longitude coordinate.\n\n                - 1: Latitude coordinate.\n\n                - 2: ``CUBEFACE`` number.\n\n              - For lookup tables:\n\n                - the axis number in a multidimensional table.\n\n            ``CTYPEia`` in ``\"4-3\"`` form with unrecognized algorithm code will\n            generate an error.\n        \"\"\"\n        if self.wcs is None:\n            raise AttributeError(\n                \"This WCS object does not have a wcsprm object.\")\n\n        coordinate_type_map = {\n            0: None,\n            1: 'stokes',\n            2: 'celestial',\n            3: 'spectral'}\n\n        scale_map = {\n            0: 'linear',\n            1: 'quantized',\n            2: 'non-linear celestial',\n            3: 'non-linear spectral',\n            4: 'logarithmic',\n            5: 'tabular'}\n\n        result = []\n        for axis_type in self.wcs.axis_types:\n            subresult = {}\n\n            coordinate_type = (axis_type // 1000) % 10\n            subresult['coordinate_type'] = coordinate_type_map[coordinate_type]\n\n            scale = (axis_type // 100) % 10\n            subresult['scale'] = scale_map[scale]\n\n            group = (axis_type // 10) % 10\n            subresult['group'] = group\n\n            number = axis_type % 10\n            subresult['number'] = number\n\n            result.append(subresult)\n\n        return result\n\n    def __reduce__(self):\n        \"\"\"\n        Support pickling of WCS objects.  This is done by serializing\n        to an in-memory FITS file and dumping that as a string.\n        \"\"\"\n\n        hdulist = self.to_fits(relax=True)\n\n        buffer = io.BytesIO()\n        hdulist.writeto(buffer)\n\n        dct = self.__dict__.copy()\n        dct['_alt_wcskey'] = self.wcs.alt\n\n        return (__WCS_unpickle__,\n                (self.__class__, dct, buffer.getvalue(),))\n\n    def dropaxis(self, dropax):\n        \"\"\"\n        Remove an axis from the WCS.\n\n        Parameters\n        ----------\n        wcs : `~astropy.wcs.WCS`\n            The WCS with naxis to be chopped to naxis-1\n        dropax : int\n            The index of the WCS to drop, counting from 0 (i.e., python convention,\n            not FITS convention)\n\n        Returns\n        -------\n        `~astropy.wcs.WCS`\n            A new `~astropy.wcs.WCS` instance with one axis fewer\n        \"\"\"\n        inds = list(range(self.wcs.naxis))\n        inds.pop(dropax)\n\n        # axis 0 has special meaning to sub\n        # if wcs.wcs.ctype == ['RA','DEC','VLSR'], you want\n        # wcs.sub([1,2]) to get 'RA','DEC' back\n        return self.sub([i+1 for i in inds])\n\n    def swapaxes(self, ax0, ax1):\n        \"\"\"\n        Swap axes in a WCS.\n\n        Parameters\n        ----------\n        wcs : `~astropy.wcs.WCS`\n            The WCS to have its axes swapped\n        ax0 : int\n        ax1 : int\n            The indices of the WCS to be swapped, counting from 0 (i.e., python\n            convention, not FITS convention)\n\n        Returns\n        -------\n        `~astropy.wcs.WCS`\n            A new `~astropy.wcs.WCS` instance with the same number of axes,\n            but two swapped\n        \"\"\"\n        inds = list(range(self.wcs.naxis))\n        inds[ax0], inds[ax1] = inds[ax1], inds[ax0]\n\n        return self.sub([i+1 for i in inds])\n\n    def reorient_celestial_first(self):\n        \"\"\"\n        Reorient the WCS such that the celestial axes are first, followed by\n        the spectral axis, followed by any others.\n        Assumes at least celestial axes are present.\n        \"\"\"\n        return self.sub([WCSSUB_CELESTIAL, WCSSUB_SPECTRAL, WCSSUB_STOKES])  # Defined by C-ext  # noqa: F821 E501\n\n    def slice(self, view, numpy_order=True):\n        \"\"\"\n        Slice a WCS instance using a Numpy slice. The order of the slice should\n        be reversed (as for the data) compared to the natural WCS order.\n\n        Parameters\n        ----------\n        view : tuple\n            A tuple containing the same number of slices as the WCS system.\n            The ``step`` method, the third argument to a slice, is not\n            presently supported.\n        numpy_order : bool\n            Use numpy order, i.e. slice the WCS so that an identical slice\n            applied to a numpy array will slice the array and WCS in the same\n            way. If set to `False`, the WCS will be sliced in FITS order,\n            meaning the first slice will be applied to the *last* numpy index\n            but the *first* WCS axis.\n\n        Returns\n        -------\n        wcs_new : `~astropy.wcs.WCS`\n            A new resampled WCS axis\n        \"\"\"\n        if hasattr(view, '__len__') and len(view) > self.wcs.naxis:\n            raise ValueError(\"Must have # of slices <= # of WCS axes\")\n        elif not hasattr(view, '__len__'):  # view MUST be an iterable\n            view = [view]\n\n        if not all(isinstance(x, slice) for x in view):\n            # We need to drop some dimensions, but this may not always be\n            # possible with .sub due to correlated axes, so instead we use the\n            # generalized slicing infrastructure from astropy.wcs.wcsapi.\n            return SlicedFITSWCS(self, view)\n\n        # NOTE: we could in principle use SlicedFITSWCS as above for all slicing,\n        # but in the simple case where there are no axes dropped, we can just\n        # create a full WCS object with updated WCS parameters which is faster\n        # for this specific case and also backward-compatible.\n\n        wcs_new = self.deepcopy()\n        if wcs_new.sip is not None:\n            sip_crpix = wcs_new.sip.crpix.tolist()\n\n        for i, iview in enumerate(view):\n            if iview.step is not None and iview.step < 0:\n                raise NotImplementedError(\"Reversing an axis is not \"\n                                          \"implemented.\")\n\n            if numpy_order:\n                wcs_index = self.wcs.naxis - 1 - i\n            else:\n                wcs_index = i\n\n            if iview.step is not None and iview.start is None:\n                # Slice from \"None\" is equivalent to slice from 0 (but one\n                # might want to downsample, so allow slices with\n                # None,None,step or None,stop,step)\n                iview = slice(0, iview.stop, iview.step)\n\n            if iview.start is not None:\n                if iview.step not in (None, 1):\n                    crpix = self.wcs.crpix[wcs_index]\n                    cdelt = self.wcs.cdelt[wcs_index]\n                    # equivalently (keep this comment so you can compare eqns):\n                    # wcs_new.wcs.crpix[wcs_index] =\n                    # (crpix - iview.start)*iview.step + 0.5 - iview.step/2.\n                    crp = ((crpix - iview.start - 1.)/iview.step\n                           + 0.5 + 1./iview.step/2.)\n                    wcs_new.wcs.crpix[wcs_index] = crp\n                    if wcs_new.sip is not None:\n                        sip_crpix[wcs_index] = crp\n                    wcs_new.wcs.cdelt[wcs_index] = cdelt * iview.step\n                else:\n                    wcs_new.wcs.crpix[wcs_index] -= iview.start\n                    if wcs_new.sip is not None:\n                        sip_crpix[wcs_index] -= iview.start\n\n            try:\n                # range requires integers but the other attributes can also\n                # handle arbitrary values, so this needs to be in a try/except.\n                nitems = len(builtins.range(self._naxis[wcs_index])[iview])\n            except TypeError as exc:\n                if 'indices must be integers' not in str(exc):\n                    raise\n                warnings.warn(\"NAXIS{} attribute is not updated because at \"\n                              \"least one index ('{}') is no integer.\"\n                              \"\".format(wcs_index, iview), AstropyUserWarning)\n            else:\n                wcs_new._naxis[wcs_index] = nitems\n\n        if wcs_new.sip is not None:\n            wcs_new.sip = Sip(self.sip.a, self.sip.b, self.sip.ap, self.sip.bp,\n                              sip_crpix)\n\n        return wcs_new\n\n    def __getitem__(self, item):\n        # \"getitem\" is a shortcut for self.slice; it is very limited\n        # there is no obvious and unambiguous interpretation of wcs[1,2,3]\n        # We COULD allow wcs[1] to link to wcs.sub([2])\n        # (wcs[i] -> wcs.sub([i+1])\n        return self.slice(item)\n\n    def __iter__(self):\n        # Having __getitem__ makes Python think WCS is iterable. However,\n        # Python first checks whether __iter__ is present, so we can raise an\n        # exception here.\n        raise TypeError(f\"'{self.__class__.__name__}' object is not iterable\")\n\n    @property\n    def axis_type_names(self):\n        \"\"\"\n        World names for each coordinate axis\n\n        Returns\n        -------\n        list of str\n            A list of names along each axis.\n        \"\"\"\n        names = list(self.wcs.cname)\n        types = self.wcs.ctype\n        for i in range(len(names)):\n            if len(names[i]) > 0:\n                continue\n            names[i] = types[i].split('-')[0]\n        return names\n\n    @property\n    def celestial(self):\n        \"\"\"\n        A copy of the current WCS with only the celestial axes included\n        \"\"\"\n        return self.sub([WCSSUB_CELESTIAL])  # Defined by C-ext  # noqa: F821\n\n    @property\n    def is_celestial(self):\n        return self.has_celestial and self.naxis == 2\n\n    @property\n    def has_celestial(self):\n        try:\n            return self.wcs.lng >= 0 and self.wcs.lat >= 0\n        except InconsistentAxisTypesError:\n            return False\n\n    @property\n    def spectral(self):\n        \"\"\"\n        A copy of the current WCS with only the spectral axes included\n        \"\"\"\n        return self.sub([WCSSUB_SPECTRAL])  # Defined by C-ext  # noqa: F821\n\n    @property\n    def is_spectral(self):\n        return self.has_spectral and self.naxis == 1\n\n    @property\n    def has_spectral(self):\n        try:\n            return self.wcs.spec >= 0\n        except InconsistentAxisTypesError:\n            return False\n\n    @property\n    def has_distortion(self):\n        \"\"\"\n        Returns `True` if any distortion terms are present.\n        \"\"\"\n        return (self.sip is not None or\n                self.cpdis1 is not None or self.cpdis2 is not None or\n                self.det2im1 is not None and self.det2im2 is not None)\n\n    @property\n    def pixel_scale_matrix(self):\n\n        try:\n            cdelt = np.diag(self.wcs.get_cdelt())\n            pc = self.wcs.get_pc()\n        except InconsistentAxisTypesError:\n            try:\n                # for non-celestial axes, get_cdelt doesn't work\n                with warnings.catch_warnings():\n                    warnings.filterwarnings(\n                        'ignore', 'cdelt will be ignored since cd is present', RuntimeWarning)\n                    cdelt = np.dot(self.wcs.cd, np.diag(self.wcs.cdelt))\n            except AttributeError:\n                cdelt = np.diag(self.wcs.cdelt)\n\n            try:\n                pc = self.wcs.pc\n            except AttributeError:\n                pc = 1\n\n        pccd = np.dot(cdelt, pc)\n\n        return pccd\n\n    def footprint_contains(self, coord, **kwargs):\n        \"\"\"\n        Determines if a given SkyCoord is contained in the wcs footprint.\n\n        Parameters\n        ----------\n        coord : `~astropy.coordinates.SkyCoord`\n            The coordinate to check if it is within the wcs coordinate.\n        **kwargs :\n           Additional arguments to pass to `~astropy.coordinates.SkyCoord.to_pixel`\n\n        Returns\n        -------\n        response : bool\n           True means the WCS footprint contains the coordinate, False means it does not.\n        \"\"\"\n\n        return coord.contained_by(self, **kwargs)\n\n\ndef __WCS_unpickle__(cls, dct, fits_data):\n    \"\"\"\n    Unpickles a WCS object from a serialized FITS string.\n    \"\"\"\n\n    self = cls.__new__(cls)\n\n    buffer = io.BytesIO(fits_data)\n    hdulist = fits.open(buffer)\n\n    naxis = dct.pop('naxis', None)\n    if naxis:\n        hdulist[0].header['naxis'] = naxis\n        naxes = dct.pop('_naxis', [])\n        for k, na in enumerate(naxes):\n            hdulist[0].header[f'naxis{k + 1:d}'] = na\n\n    kwargs = dct.pop('_init_kwargs', {})\n    self.__dict__.update(dct)\n\n    wcskey = dct.pop('_alt_wcskey', ' ')\n    WCS.__init__(self, hdulist[0].header, hdulist, key=wcskey, **kwargs)\n    self.pixel_bounds = dct.get('_pixel_bounds', None)\n\n    return self\n\n\ndef find_all_wcs(header, relax=True, keysel=None, fix=True,\n                 translate_units='',\n                 _do_set=True):\n    \"\"\"\n    Find all the WCS transformations in the given header.\n\n    Parameters\n    ----------\n    header : str or `~astropy.io.fits.Header` object.\n\n    relax : bool or int, optional\n        Degree of permissiveness:\n\n        - `True` (default): Admit all recognized informal extensions of the\n          WCS standard.\n\n        - `False`: Recognize only FITS keywords defined by the\n          published WCS standard.\n\n        - `int`: a bit field selecting specific extensions to accept.\n          See :ref:`astropy:relaxread` for details.\n\n    keysel : sequence of str, optional\n        A list of flags used to select the keyword types considered by\n        wcslib.  When ``None``, only the standard image header\n        keywords are considered (and the underlying wcspih() C\n        function is called).  To use binary table image array or pixel\n        list keywords, *keysel* must be set.\n\n        Each element in the list should be one of the following strings:\n\n            - 'image': Image header keywords\n\n            - 'binary': Binary table image array keywords\n\n            - 'pixel': Pixel list keywords\n\n        Keywords such as ``EQUIna`` or ``RFRQna`` that are common to\n        binary table image arrays and pixel lists (including\n        ``WCSNna`` and ``TWCSna``) are selected by both 'binary' and\n        'pixel'.\n\n    fix : bool, optional\n        When `True` (default), call `~astropy.wcs.Wcsprm.fix` on\n        the resulting objects to fix any non-standard uses in the\n        header.  `FITSFixedWarning` warnings will be emitted if any\n        changes were made.\n\n    translate_units : str, optional\n        Specify which potentially unsafe translations of non-standard\n        unit strings to perform.  By default, performs none.  See\n        `WCS.fix` for more information about this parameter.  Only\n        effective when ``fix`` is `True`.\n\n    Returns\n    -------\n    wcses : list of `WCS`\n    \"\"\"\n\n    if isinstance(header, (str, bytes)):\n        header_string = header\n    elif isinstance(header, fits.Header):\n        header_string = header.tostring()\n    else:\n        raise TypeError(\n            \"header must be a string or astropy.io.fits.Header object\")\n\n    keysel_flags = _parse_keysel(keysel)\n\n    if isinstance(header_string, str):\n        header_bytes = header_string.encode('ascii')\n    else:\n        header_bytes = header_string\n\n    wcsprms = _wcs.find_all_wcs(header_bytes, relax, keysel_flags)\n\n    result = []\n    for wcsprm in wcsprms:\n        subresult = WCS(fix=False, _do_set=False)\n        subresult.wcs = wcsprm\n        result.append(subresult)\n\n        if fix:\n            subresult.fix(translate_units)\n\n        if _do_set:\n            subresult.wcs.set()\n\n    return result\n\n\ndef validate(source):\n    \"\"\"\n    Prints a WCS validation report for the given FITS file.\n\n    Parameters\n    ----------\n    source : str or file-like or `~astropy.io.fits.HDUList`\n        The FITS file to validate.\n\n    Returns\n    -------\n    results : list subclass instance\n        The result is returned as nested lists.  The first level\n        corresponds to the HDUs in the given file.  The next level has\n        an entry for each WCS found in that header.  The special\n        subclass of list will pretty-print the results as a table when\n        printed.\n\n    \"\"\"\n    class _WcsValidateWcsResult(list):\n        def __init__(self, key):\n            self._key = key\n\n        def __repr__(self):\n            result = [f\"  WCS key '{self._key or ' '}':\"]\n            if len(self):\n                for entry in self:\n                    for i, line in enumerate(entry.splitlines()):\n                        if i == 0:\n                            initial_indent = '    - '\n                        else:\n                            initial_indent = '      '\n                        result.extend(\n                            textwrap.wrap(\n                                line,\n                                initial_indent=initial_indent,\n                                subsequent_indent='      '))\n            else:\n                result.append(\"    No issues.\")\n            return '\\n'.join(result)\n\n    class _WcsValidateHduResult(list):\n        def __init__(self, hdu_index, hdu_name):\n            self._hdu_index = hdu_index\n            self._hdu_name = hdu_name\n            list.__init__(self)\n\n        def __repr__(self):\n            if len(self):\n                if self._hdu_name:\n                    hdu_name = f' ({self._hdu_name})'\n                else:\n                    hdu_name = ''\n                result = [f'HDU {self._hdu_index}{hdu_name}:']\n                for wcs in self:\n                    result.append(repr(wcs))\n                return '\\n'.join(result)\n            return ''\n\n    class _WcsValidateResults(list):\n        def __repr__(self):\n            result = []\n            for hdu in self:\n                content = repr(hdu)\n                if len(content):\n                    result.append(content)\n            return '\\n\\n'.join(result)\n\n    global __warningregistry__\n\n    if isinstance(source, fits.HDUList):\n        hdulist = source\n    else:\n        hdulist = fits.open(source)\n\n    results = _WcsValidateResults()\n\n    for i, hdu in enumerate(hdulist):\n        hdu_results = _WcsValidateHduResult(i, hdu.name)\n        results.append(hdu_results)\n\n        with warnings.catch_warnings(record=True) as warning_lines:\n            wcses = find_all_wcs(\n                hdu.header, relax=_wcs.WCSHDR_reject,\n                fix=False, _do_set=False)\n\n        for wcs in wcses:\n            wcs_results = _WcsValidateWcsResult(wcs.wcs.alt)\n            hdu_results.append(wcs_results)\n\n            try:\n                del __warningregistry__\n            except NameError:\n                pass\n\n            with warnings.catch_warnings(record=True) as warning_lines:\n                warnings.resetwarnings()\n                warnings.simplefilter(\n                    \"always\", FITSFixedWarning, append=True)\n\n                try:\n                    WCS(hdu.header,\n                        key=wcs.wcs.alt or ' ',\n                        relax=_wcs.WCSHDR_reject,\n                        fix=True, _do_set=False)\n                except WcsError as e:\n                    wcs_results.append(str(e))\n\n                wcs_results.extend([str(x.message) for x in warning_lines])\n\n    return results\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":1884,"id":7240,"name":"utype","nodeType":"Attribute","startLoc":1884,"text":"self.utype"},{"attributeType":"null","col":0,"comment":"null","endLoc":562,"id":7241,"name":"prjprm_m","nodeType":"Attribute","startLoc":562,"text":"prjprm_m"},{"attributeType":"null","col":0,"comment":"null","endLoc":566,"id":7242,"name":"prjprm_n","nodeType":"Attribute","startLoc":566,"text":"prjprm_n"},{"attributeType":"null","col":0,"comment":"null","endLoc":570,"id":7243,"name":"prjprm_set","nodeType":"Attribute","startLoc":570,"text":"prjprm_set"},{"attributeType":"null","col":0,"comment":"null","endLoc":594,"id":7244,"name":"prjprm_prjx2s","nodeType":"Attribute","startLoc":594,"text":"prjprm_prjx2s"},{"attributeType":"null","col":8,"comment":"null","endLoc":1903,"id":7245,"name":"_ref","nodeType":"Attribute","startLoc":1903,"text":"self._ref"},{"attributeType":"null","col":0,"comment":"null","endLoc":623,"id":7246,"name":"prjprm_prjs2x","nodeType":"Attribute","startLoc":623,"text":"prjprm_prjs2x"},{"className":"SlicedFITSWCS","col":0,"comment":"null","endLoc":193,"id":7247,"nodeType":"Class","startLoc":192,"text":"class SlicedFITSWCS(SlicedLowLevelWCS, HighLevelWCSMixin):\n    pass"},{"attributeType":"null","col":0,"comment":"null","endLoc":654,"id":7248,"name":"celfix","nodeType":"Attribute","startLoc":654,"text":"celfix"},{"attributeType":"null","col":0,"comment":"null","endLoc":664,"id":7249,"name":"cname","nodeType":"Attribute","startLoc":664,"text":"cname"},{"className":"SlicedLowLevelWCS","col":0,"comment":"\n    A Low Level WCS wrapper which applies an array slice to a WCS.\n\n    This class does not modify the underlying WCS object and can therefore drop\n    coupled dimensions as it stores which pixel and world dimensions have been\n    sliced out (or modified) in the underlying WCS and returns the modified\n    results on all the Low Level WCS methods.\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.wcsapi.BaseLowLevelWCS`\n        The WCS to slice.\n    slices : `slice` or `tuple` or `int`\n        A valid array slice to apply to the WCS.\n\n    ","endLoc":308,"id":7250,"nodeType":"Class","startLoc":105,"text":"class SlicedLowLevelWCS(BaseWCSWrapper):\n    \"\"\"\n    A Low Level WCS wrapper which applies an array slice to a WCS.\n\n    This class does not modify the underlying WCS object and can therefore drop\n    coupled dimensions as it stores which pixel and world dimensions have been\n    sliced out (or modified) in the underlying WCS and returns the modified\n    results on all the Low Level WCS methods.\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.wcsapi.BaseLowLevelWCS`\n        The WCS to slice.\n    slices : `slice` or `tuple` or `int`\n        A valid array slice to apply to the WCS.\n\n    \"\"\"\n    def __init__(self, wcs, slices):\n\n        slices = sanitize_slices(slices, wcs.pixel_n_dim)\n\n        if isinstance(wcs, SlicedLowLevelWCS):\n            # Here we combine the current slices with the previous slices\n            # to avoid ending up with many nested WCSes\n            self._wcs = wcs._wcs\n            slices_original = wcs._slices_array.copy()\n            for ipixel in range(wcs.pixel_n_dim):\n                ipixel_orig = wcs._wcs.pixel_n_dim - 1 - wcs._pixel_keep[ipixel]\n                ipixel_new = wcs.pixel_n_dim - 1 - ipixel\n                slices_original[ipixel_orig] = combine_slices(slices_original[ipixel_orig],\n                                                              slices[ipixel_new])\n            self._slices_array = slices_original\n        else:\n            self._wcs = wcs\n            self._slices_array = slices\n\n        self._slices_pixel = self._slices_array[::-1]\n\n        # figure out which pixel dimensions have been kept, then use axis correlation\n        # matrix to figure out which world dims are kept\n        self._pixel_keep = np.nonzero([not isinstance(self._slices_pixel[ip], numbers.Integral)\n                                       for ip in range(self._wcs.pixel_n_dim)])[0]\n\n        # axis_correlation_matrix[world, pixel]\n        self._world_keep = np.nonzero(\n            self._wcs.axis_correlation_matrix[:, self._pixel_keep].any(axis=1))[0]\n\n        if len(self._pixel_keep) == 0 or len(self._world_keep) == 0:\n            raise ValueError(\"Cannot slice WCS: the resulting WCS should have \"\n                             \"at least one pixel and one world dimension.\")\n\n    @lazyproperty\n    def dropped_world_dimensions(self):\n        \"\"\"\n        Information describing the dropped world dimensions.\n        \"\"\"\n        world_coords = self._pixel_to_world_values_all(*[0]*len(self._pixel_keep))\n        dropped_info = defaultdict(list)\n\n        for i in range(self._wcs.world_n_dim):\n\n            if i in self._world_keep:\n                continue\n\n            if \"world_axis_object_classes\" not in dropped_info:\n                dropped_info[\"world_axis_object_classes\"] = dict()\n\n            wao_classes = self._wcs.world_axis_object_classes\n            wao_components = self._wcs.world_axis_object_components\n\n            dropped_info[\"value\"].append(world_coords[i])\n            dropped_info[\"world_axis_names\"].append(self._wcs.world_axis_names[i])\n            dropped_info[\"world_axis_physical_types\"].append(self._wcs.world_axis_physical_types[i])\n            dropped_info[\"world_axis_units\"].append(self._wcs.world_axis_units[i])\n            dropped_info[\"world_axis_object_components\"].append(wao_components[i])\n            dropped_info[\"world_axis_object_classes\"].update(dict(\n                filter(\n                    lambda x: x[0] == wao_components[i][0], wao_classes.items()\n                )\n            ))\n            dropped_info[\"serialized_classes\"] = self.serialized_classes\n        return dict(dropped_info)\n\n    @property\n    def pixel_n_dim(self):\n        return len(self._pixel_keep)\n\n    @property\n    def world_n_dim(self):\n        return len(self._world_keep)\n\n    @property\n    def world_axis_physical_types(self):\n        return [self._wcs.world_axis_physical_types[i] for i in self._world_keep]\n\n    @property\n    def world_axis_units(self):\n        return [self._wcs.world_axis_units[i] for i in self._world_keep]\n\n    @property\n    def pixel_axis_names(self):\n        return [self._wcs.pixel_axis_names[i] for i in self._pixel_keep]\n\n    @property\n    def world_axis_names(self):\n        return [self._wcs.world_axis_names[i] for i in self._world_keep]\n\n    def _pixel_to_world_values_all(self, *pixel_arrays):\n        pixel_arrays = tuple(map(np.asanyarray, pixel_arrays))\n        pixel_arrays_new = []\n        ipix_curr = -1\n        for ipix in range(self._wcs.pixel_n_dim):\n            if isinstance(self._slices_pixel[ipix], numbers.Integral):\n                pixel_arrays_new.append(self._slices_pixel[ipix])\n            else:\n                ipix_curr += 1\n                if self._slices_pixel[ipix].start is not None:\n                    pixel_arrays_new.append(pixel_arrays[ipix_curr] + self._slices_pixel[ipix].start)\n                else:\n                    pixel_arrays_new.append(pixel_arrays[ipix_curr])\n\n        pixel_arrays_new = np.broadcast_arrays(*pixel_arrays_new)\n        return self._wcs.pixel_to_world_values(*pixel_arrays_new)\n\n    def pixel_to_world_values(self, *pixel_arrays):\n        world_arrays = self._pixel_to_world_values_all(*pixel_arrays)\n\n        # Detect the case of a length 0 array\n        if isinstance(world_arrays, np.ndarray) and not world_arrays.shape:\n            return world_arrays\n\n        if self._wcs.world_n_dim > 1:\n            # Select the dimensions of the original WCS we are keeping.\n            world_arrays = [world_arrays[iw] for iw in self._world_keep]\n            # If there is only one world dimension (after slicing) we shouldn't return a tuple.\n            if self.world_n_dim == 1:\n                world_arrays = world_arrays[0]\n\n        return world_arrays\n\n    def world_to_pixel_values(self, *world_arrays):\n        world_arrays = tuple(map(np.asanyarray, world_arrays))\n        world_arrays_new = []\n        iworld_curr = -1\n        for iworld in range(self._wcs.world_n_dim):\n            if iworld in self._world_keep:\n                iworld_curr += 1\n                world_arrays_new.append(world_arrays[iworld_curr])\n            else:\n                world_arrays_new.append(1.)\n\n        world_arrays_new = np.broadcast_arrays(*world_arrays_new)\n        pixel_arrays = list(self._wcs.world_to_pixel_values(*world_arrays_new))\n\n        for ipixel in range(self._wcs.pixel_n_dim):\n            if isinstance(self._slices_pixel[ipixel], slice) and self._slices_pixel[ipixel].start is not None:\n                pixel_arrays[ipixel] -= self._slices_pixel[ipixel].start\n\n        # Detect the case of a length 0 array\n        if isinstance(pixel_arrays, np.ndarray) and not pixel_arrays.shape:\n            return pixel_arrays\n        pixel = tuple(pixel_arrays[ip] for ip in self._pixel_keep)\n        if self.pixel_n_dim == 1 and self._wcs.pixel_n_dim > 1:\n            pixel = pixel[0]\n        return pixel\n\n    @property\n    def world_axis_object_components(self):\n        return [self._wcs.world_axis_object_components[idx] for idx in self._world_keep]\n\n    @property\n    def world_axis_object_classes(self):\n        keys_keep = [item[0] for item in self.world_axis_object_components]\n        return dict([item for item in self._wcs.world_axis_object_classes.items() if item[0] in keys_keep])\n\n    @property\n    def array_shape(self):\n        if self._wcs.array_shape:\n            return np.broadcast_to(0, self._wcs.array_shape)[tuple(self._slices_array)].shape\n\n    @property\n    def pixel_shape(self):\n        if self.array_shape:\n            return tuple(self.array_shape[::-1])\n\n    @property\n    def pixel_bounds(self):\n        if self._wcs.pixel_bounds is None:\n            return\n\n        bounds = []\n        for idx in self._pixel_keep:\n            if self._slices_pixel[idx].start is None:\n                bounds.append(self._wcs.pixel_bounds[idx])\n            else:\n                imin, imax = self._wcs.pixel_bounds[idx]\n                start = self._slices_pixel[idx].start\n                bounds.append((imin - start, imax - start))\n\n        return tuple(bounds)\n\n    @property\n    def axis_correlation_matrix(self):\n        return self._wcs.axis_correlation_matrix[self._world_keep][:, self._pixel_keep]"},{"attributeType":"null","col":0,"comment":"null","endLoc":669,"id":7251,"name":"colax","nodeType":"Attribute","startLoc":669,"text":"colax"},{"col":4,"comment":"\n        Unregister a writer function\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier.\n        data_class : class\n            The class of the object that can be written.\n        ","endLoc":285,"header":"def unregister_writer(self, data_format, data_class)","id":7252,"name":"unregister_writer","nodeType":"Function","startLoc":266,"text":"def unregister_writer(self, data_format, data_class):\n        \"\"\"\n        Unregister a writer function\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier.\n        data_class : class\n            The class of the object that can be written.\n        \"\"\"\n\n        if (data_format, data_class) in self._writers:\n            self._writers.pop((data_format, data_class))\n        else:\n            raise IORegistryError(\"No writer defined for format '{}' and class '{}'\"\n                                  ''.format(data_format, data_class.__name__))\n\n        if data_class not in self._delayed_docs_classes:\n            self._update__doc__(data_class, 'write')"},{"attributeType":"null","col":0,"comment":"null","endLoc":674,"id":7253,"name":"colnum","nodeType":"Attribute","startLoc":674,"text":"colnum"},{"className":"BaseWCSWrapper","col":0,"comment":"\n    A base wrapper class for things that modify Low Level WCSes.\n\n    This wrapper implements a transparent wrapper to many of the properties,\n    with the idea that not all of them would need to be overridden in your\n    wrapper, but some probably will.\n\n    Parameters\n    ----------\n    wcs : `astropy.wcs.wcsapi.BaseLowLevelWCS`\n        The WCS object to wrap\n    ","endLoc":82,"id":7254,"nodeType":"Class","startLoc":6,"text":"class BaseWCSWrapper(BaseLowLevelWCS, metaclass=abc.ABCMeta):\n    \"\"\"\n    A base wrapper class for things that modify Low Level WCSes.\n\n    This wrapper implements a transparent wrapper to many of the properties,\n    with the idea that not all of them would need to be overridden in your\n    wrapper, but some probably will.\n\n    Parameters\n    ----------\n    wcs : `astropy.wcs.wcsapi.BaseLowLevelWCS`\n        The WCS object to wrap\n    \"\"\"\n    def __init__(self, wcs, *args, **kwargs):\n        self._wcs = wcs\n\n    @property\n    def pixel_n_dim(self):\n        return self._wcs.pixel_n_dim\n\n    @property\n    def world_n_dim(self):\n        return self._wcs.world_n_dim\n\n    @property\n    def world_axis_physical_types(self):\n        return self._wcs.world_axis_physical_types\n\n    @property\n    def world_axis_units(self):\n        return self._wcs.world_axis_units\n\n    @property\n    def world_axis_object_components(self):\n        return self._wcs.world_axis_object_components\n\n    @property\n    def world_axis_object_classes(self):\n        return self._wcs.world_axis_object_classes\n\n    @property\n    def pixel_shape(self):\n        return self._wcs.pixel_shape\n\n    @property\n    def pixel_bounds(self):\n        return self._wcs.pixel_bounds\n\n    @property\n    def pixel_axis_names(self):\n        return self._wcs.pixel_axis_names\n\n    @property\n    def world_axis_names(self):\n        return self._wcs.world_axis_names\n\n    @property\n    def axis_correlation_matrix(self):\n        return self._wcs.axis_correlation_matrix\n\n    @property\n    def serialized_classes(self):\n        return self._wcs.serialized_classes\n\n    @abc.abstractmethod\n    def pixel_to_world_values(self, *pixel_arrays):\n        pass\n\n    @abc.abstractmethod\n    def world_to_pixel_values(self, *world_arrays):\n        pass\n\n    def __repr__(self):\n        return f\"{object.__repr__(self)}\\n{str(self)}\"\n\n    def __str__(self):\n        return wcs_info_str(self)"},{"attributeType":"null","col":0,"comment":"null","endLoc":684,"id":7255,"name":"compare","nodeType":"Attribute","startLoc":684,"text":"compare"},{"attributeType":"null","col":8,"comment":"null","endLoc":1878,"id":7256,"name":"_pos","nodeType":"Attribute","startLoc":1878,"text":"self._pos"},{"attributeType":"null","col":0,"comment":"null","endLoc":728,"id":7257,"name":"convert","nodeType":"Attribute","startLoc":728,"text":"convert"},{"attributeType":"null","col":0,"comment":"null","endLoc":735,"id":7258,"name":"coord","nodeType":"Attribute","startLoc":735,"text":"coord"},{"attributeType":"null","col":0,"comment":"null","endLoc":747,"id":7259,"name":"copy","nodeType":"Attribute","startLoc":747,"text":"copy"},{"col":4,"comment":"Get writer for ``data_format``.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that is used to\n            specify the data type when reading/writing.\n        data_class : class\n            The class of the object that can be written.\n\n        Returns\n        -------\n        writer : callable\n            The registered writer function for this format and class.\n        ","endLoc":312,"header":"def get_writer(self, data_format, data_class)","id":7260,"name":"get_writer","nodeType":"Function","startLoc":287,"text":"def get_writer(self, data_format, data_class):\n        \"\"\"Get writer for ``data_format``.\n\n        Parameters\n        ----------\n        data_format : str\n            The data format identifier. This is the string that is used to\n            specify the data type when reading/writing.\n        data_class : class\n            The class of the object that can be written.\n\n        Returns\n        -------\n        writer : callable\n            The registered writer function for this format and class.\n        \"\"\"\n        writers = [(fmt, cls) for fmt, cls in self._writers if fmt == data_format]\n        for writer_format, writer_class in writers:\n            if self._is_best_match(data_class, writer_class, writers):\n                return self._writers[(writer_format, writer_class)][0]\n        else:\n            format_table_str = self._get_format_table_str(data_class, 'Write')\n            raise IORegistryError(\n                \"No writer defined for format '{}' and class '{}'.\\n\\nThe \"\n                \"available formats are:\\n\\n{}\".format(\n                    data_format, data_class.__name__, format_table_str))"},{"attributeType":"null","col":0,"comment":"null","endLoc":751,"id":7261,"name":"cpdis1","nodeType":"Attribute","startLoc":751,"text":"cpdis1"},{"attributeType":"null","col":0,"comment":"null","endLoc":757,"id":7262,"name":"cpdis2","nodeType":"Attribute","startLoc":757,"text":"cpdis2"},{"attributeType":"null","col":0,"comment":"null","endLoc":763,"id":7263,"name":"crder","nodeType":"Attribute","startLoc":763,"text":"crder"},{"attributeType":"null","col":0,"comment":"null","endLoc":770,"id":7264,"name":"crln_obs","nodeType":"Attribute","startLoc":770,"text":"crln_obs"},{"attributeType":"null","col":0,"comment":"null","endLoc":775,"id":7265,"name":"crota","nodeType":"Attribute","startLoc":775,"text":"crota"},{"attributeType":"null","col":0,"comment":"null","endLoc":799,"id":7266,"name":"crpix","nodeType":"Attribute","startLoc":799,"text":"crpix"},{"attributeType":"null","col":12,"comment":"null","endLoc":1889,"id":7267,"name":"_attr_list","nodeType":"Attribute","startLoc":1889,"text":"self._attr_list"},{"col":4,"comment":"null","endLoc":20,"header":"def __init__(self, wcs, *args, **kwargs)","id":7268,"name":"__init__","nodeType":"Function","startLoc":19,"text":"def __init__(self, wcs, *args, **kwargs):\n        self._wcs = wcs"},{"col":4,"comment":"null","endLoc":24,"header":"@property\n    def pixel_n_dim(self)","id":7269,"name":"pixel_n_dim","nodeType":"Function","startLoc":22,"text":"@property\n    def pixel_n_dim(self):\n        return self._wcs.pixel_n_dim"},{"col":4,"comment":"null","endLoc":28,"header":"@property\n    def world_n_dim(self)","id":7270,"name":"world_n_dim","nodeType":"Function","startLoc":26,"text":"@property\n    def world_n_dim(self):\n        return self._wcs.world_n_dim"},{"col":4,"comment":"null","endLoc":32,"header":"@property\n    def world_axis_physical_types(self)","id":7271,"name":"world_axis_physical_types","nodeType":"Function","startLoc":30,"text":"@property\n    def world_axis_physical_types(self):\n        return self._wcs.world_axis_physical_types"},{"col":4,"comment":"null","endLoc":36,"header":"@property\n    def world_axis_units(self)","id":7272,"name":"world_axis_units","nodeType":"Function","startLoc":34,"text":"@property\n    def world_axis_units(self):\n        return self._wcs.world_axis_units"},{"col":4,"comment":"null","endLoc":40,"header":"@property\n    def world_axis_object_components(self)","id":7273,"name":"world_axis_object_components","nodeType":"Function","startLoc":38,"text":"@property\n    def world_axis_object_components(self):\n        return self._wcs.world_axis_object_components"},{"col":4,"comment":"null","endLoc":44,"header":"@property\n    def world_axis_object_classes(self)","id":7274,"name":"world_axis_object_classes","nodeType":"Function","startLoc":42,"text":"@property\n    def world_axis_object_classes(self):\n        return self._wcs.world_axis_object_classes"},{"col":4,"comment":"null","endLoc":48,"header":"@property\n    def pixel_shape(self)","id":7275,"name":"pixel_shape","nodeType":"Function","startLoc":46,"text":"@property\n    def pixel_shape(self):\n        return self._wcs.pixel_shape"},{"attributeType":"null","col":0,"comment":"null","endLoc":804,"id":7276,"name":"crval","nodeType":"Attribute","startLoc":804,"text":"crval"},{"col":4,"comment":"null","endLoc":52,"header":"@property\n    def pixel_bounds(self)","id":7277,"name":"pixel_bounds","nodeType":"Function","startLoc":50,"text":"@property\n    def pixel_bounds(self):\n        return self._wcs.pixel_bounds"},{"col":4,"comment":"null","endLoc":56,"header":"@property\n    def pixel_axis_names(self)","id":7278,"name":"pixel_axis_names","nodeType":"Function","startLoc":54,"text":"@property\n    def pixel_axis_names(self):\n        return self._wcs.pixel_axis_names"},{"col":4,"comment":"null","endLoc":60,"header":"@property\n    def world_axis_names(self)","id":7279,"name":"world_axis_names","nodeType":"Function","startLoc":58,"text":"@property\n    def world_axis_names(self):\n        return self._wcs.world_axis_names"},{"col":4,"comment":"null","endLoc":64,"header":"@property\n    def axis_correlation_matrix(self)","id":7280,"name":"axis_correlation_matrix","nodeType":"Function","startLoc":62,"text":"@property\n    def axis_correlation_matrix(self):\n        return self._wcs.axis_correlation_matrix"},{"col":4,"comment":"null","endLoc":68,"header":"@property\n    def serialized_classes(self)","id":7281,"name":"serialized_classes","nodeType":"Function","startLoc":66,"text":"@property\n    def serialized_classes(self):\n        return self._wcs.serialized_classes"},{"col":4,"comment":"null","endLoc":72,"header":"@abc.abstractmethod\n    def pixel_to_world_values(self, *pixel_arrays)","id":7282,"name":"pixel_to_world_values","nodeType":"Function","startLoc":70,"text":"@abc.abstractmethod\n    def pixel_to_world_values(self, *pixel_arrays):\n        pass"},{"col":0,"comment":"null","endLoc":241,"header":"def get_wcslib_cfg(cfg, wcslib_files, include_paths)","id":7283,"name":"get_wcslib_cfg","nodeType":"Function","startLoc":177,"text":"def get_wcslib_cfg(cfg, wcslib_files, include_paths):\n\n    debug = '--debug' in sys.argv\n\n    cfg['include_dirs'].append(numpy.get_include())\n    cfg['define_macros'].extend([\n        ('ECHO', None),\n        ('WCSTRIG_MACRO', None),\n        ('ASTROPY_WCS_BUILD', None),\n        ('_GNU_SOURCE', None)])\n\n    if ((int(os.environ.get('ASTROPY_USE_SYSTEM_WCSLIB', 0))\n            or int(os.environ.get('ASTROPY_USE_SYSTEM_ALL', 0)))\n            and not sys.platform == 'win32'):\n        wcsconfig_h_path = join(WCSROOT, 'include', 'wcsconfig.h')\n        if os.path.exists(wcsconfig_h_path):\n            os.unlink(wcsconfig_h_path)\n        for k, v in pkg_config(['wcslib'], ['wcs']).items():\n            cfg[k].extend(v)\n    else:\n        write_wcsconfig_h(include_paths)\n\n        wcslib_path = join(\"cextern\", \"wcslib\")  # Path to wcslib\n        wcslib_cpath = join(wcslib_path, \"C\")  # Path to wcslib source files\n        cfg['sources'].extend(join(wcslib_cpath, x) for x in wcslib_files)\n        cfg['include_dirs'].append(wcslib_cpath)\n\n    if debug:\n        cfg['define_macros'].append(('DEBUG', None))\n        cfg['undef_macros'].append('NDEBUG')\n        if (not sys.platform.startswith('sun') and\n                not sys.platform == 'win32'):\n            cfg['extra_compile_args'].extend([\"-fno-inline\", \"-O0\", \"-g\"])\n    else:\n        # Define ECHO as nothing to prevent spurious newlines from\n        # printing within the libwcs parser\n        cfg['define_macros'].append(('NDEBUG', None))\n        cfg['undef_macros'].append('DEBUG')\n\n    if sys.platform == 'win32':\n        # These are written into wcsconfig.h, but that file is not\n        # used by all parts of wcslib.\n        cfg['define_macros'].extend([\n            ('YY_NO_UNISTD_H', None),\n            ('_CRT_SECURE_NO_WARNINGS', None),\n            ('_NO_OLDNAMES', None),  # for mingw32\n            ('NO_OLDNAMES', None),  # for mingw64\n            ('__STDC__', None)  # for MSVC\n        ])\n\n    if sys.platform.startswith('linux'):\n        cfg['define_macros'].append(('HAVE_SINCOS', None))\n\n    # For 4.7+ enable C99 syntax in older compilers (need 'gnu99' std for gcc)\n    if get_compiler() == 'unix':\n        cfg['extra_compile_args'].extend(['-std=gnu99'])\n\n    # Squelch a few compilation warnings in WCSLIB\n    if get_compiler() in ('unix', 'mingw32'):\n        if not debug:\n            cfg['extra_compile_args'].extend([\n                '-Wno-strict-prototypes',\n                '-Wno-unused-function',\n                '-Wno-unused-value',\n                '-Wno-uninitialized'])"},{"attributeType":"null","col":0,"comment":"null","endLoc":809,"id":7284,"name":"crval_tabprm","nodeType":"Attribute","startLoc":809,"text":"crval_tabprm"},{"col":4,"comment":"null","endLoc":76,"header":"@abc.abstractmethod\n    def world_to_pixel_values(self, *world_arrays)","id":7285,"name":"world_to_pixel_values","nodeType":"Function","startLoc":74,"text":"@abc.abstractmethod\n    def world_to_pixel_values(self, *world_arrays):\n        pass"},{"col":4,"comment":"null","endLoc":79,"header":"def __repr__(self)","id":7286,"name":"__repr__","nodeType":"Function","startLoc":78,"text":"def __repr__(self):\n        return f\"{object.__repr__(self)}\\n{str(self)}\""},{"attributeType":"null","col":0,"comment":"null","endLoc":814,"id":7287,"name":"csyer","nodeType":"Attribute","startLoc":814,"text":"csyer"},{"attributeType":"null","col":0,"comment":"null","endLoc":821,"id":7288,"name":"ctype","nodeType":"Attribute","startLoc":821,"text":"ctype"},{"col":4,"comment":"null","endLoc":82,"header":"def __str__(self)","id":7289,"name":"__str__","nodeType":"Function","startLoc":81,"text":"def __str__(self):\n        return wcs_info_str(self)"},{"col":4,"comment":"\n        Write out data.\n\n        Parameters\n        ----------\n        data : object\n            The data to write.\n        *args\n            The arguments passed to this method depend on the format.\n        format : str or None\n        **kwargs\n            The arguments passed to this method depend on the format.\n\n        Returns\n        -------\n        object or None\n            The output of the registered writer. Most often `None`.\n\n            .. versionadded:: 4.3\n        ","endLoc":354,"header":"def write(self, data, *args, format=None, **kwargs)","id":7290,"name":"write","nodeType":"Function","startLoc":314,"text":"def write(self, data, *args, format=None, **kwargs):\n        \"\"\"\n        Write out data.\n\n        Parameters\n        ----------\n        data : object\n            The data to write.\n        *args\n            The arguments passed to this method depend on the format.\n        format : str or None\n        **kwargs\n            The arguments passed to this method depend on the format.\n\n        Returns\n        -------\n        object or None\n            The output of the registered writer. Most often `None`.\n\n            .. versionadded:: 4.3\n        \"\"\"\n\n        if format is None:\n            path = None\n            fileobj = None\n            if len(args):\n                if isinstance(args[0], PATH_TYPES):\n                    # path might be a os.PathLike object\n                    if isinstance(args[0], os.PathLike):\n                        args = (os.fspath(args[0]),) + args[1:]\n                    path = args[0]\n                    fileobj = None\n                elif hasattr(args[0], 'read'):\n                    path = None\n                    fileobj = args[0]\n\n            format = self._get_valid_format(\n                'write', data.__class__, path, fileobj, args, kwargs)\n\n        writer = self.get_writer(format, data.__class__)\n        return writer(data, *args, **kwargs)"},{"attributeType":"null","col":0,"comment":"null","endLoc":829,"id":7291,"name":"cubeface","nodeType":"Attribute","startLoc":829,"text":"cubeface"},{"attributeType":"null","col":0,"comment":"null","endLoc":865,"id":7292,"name":"cunit","nodeType":"Attribute","startLoc":865,"text":"cunit"},{"col":0,"comment":"null","endLoc":115,"header":"def wcs_info_str(wcs)","id":7293,"name":"wcs_info_str","nodeType":"Function","startLoc":31,"text":"def wcs_info_str(wcs):\n\n    # Overall header\n\n    s = f'{wcs.__class__.__name__} Transformation\\n\\n'\n    s += ('This transformation has {} pixel and {} world dimensions\\n\\n'\n            .format(wcs.pixel_n_dim, wcs.world_n_dim))\n    s += f'Array shape (Numpy order): {wcs.array_shape}\\n\\n'\n\n    # Pixel dimensions table\n\n    array_shape = wcs.array_shape or (0,)\n    pixel_shape = wcs.pixel_shape or (None,) * wcs.pixel_n_dim\n\n    # Find largest between header size and value length\n    pixel_dim_width = max(9, len(str(wcs.pixel_n_dim)))\n    pixel_nam_width = max(9, max(len(x) for x in wcs.pixel_axis_names))\n    pixel_siz_width = max(9, len(str(max(array_shape))))\n\n    s += (('{0:' + str(pixel_dim_width) + 's}').format('Pixel Dim') + '  ' +\n            ('{0:' + str(pixel_nam_width) + 's}').format('Axis Name') + '  ' +\n            ('{0:' + str(pixel_siz_width) + 's}').format('Data size') + '  ' +\n            'Bounds\\n')\n\n    for ipix in range(wcs.pixel_n_dim):\n        s += (('{0:' + str(pixel_dim_width) + 'g}').format(ipix) + '  ' +\n                ('{0:' + str(pixel_nam_width) + 's}').format(wcs.pixel_axis_names[ipix] or 'None') + '  ' +\n                (\" \" * 5 + str(None) if pixel_shape[ipix] is None else\n                ('{0:' + str(pixel_siz_width) + 'g}').format(pixel_shape[ipix])) + '  ' +\n                '{:s}'.format(str(None if wcs.pixel_bounds is None else wcs.pixel_bounds[ipix]) + '\\n'))\n\n    s += '\\n'\n\n    # World dimensions table\n\n    # Find largest between header size and value length\n    world_dim_width = max(9, len(str(wcs.world_n_dim)))\n    world_nam_width = max(9, max(len(x) if x is not None else 0 for x in wcs.world_axis_names))\n    world_typ_width = max(13, max(len(x) if x is not None else 0 for x in wcs.world_axis_physical_types))\n\n    s += (('{0:' + str(world_dim_width) + 's}').format('World Dim') + '  ' +\n            ('{0:' + str(world_nam_width) + 's}').format('Axis Name') + '  ' +\n            ('{0:' + str(world_typ_width) + 's}').format('Physical Type') + '  ' +\n            'Units\\n')\n\n    for iwrl in range(wcs.world_n_dim):\n\n        name = wcs.world_axis_names[iwrl] or 'None'\n        typ = wcs.world_axis_physical_types[iwrl] or 'None'\n        unit = wcs.world_axis_units[iwrl] or 'unknown'\n\n        s += (('{0:' + str(world_dim_width) + 'd}').format(iwrl) + '  ' +\n                ('{0:' + str(world_nam_width) + 's}').format(name) + '  ' +\n                ('{0:' + str(world_typ_width) + 's}').format(typ) + '  ' +\n                '{:s}'.format(unit + '\\n'))\n    s += '\\n'\n\n    # Axis correlation matrix\n\n    pixel_dim_width = max(3, len(str(wcs.world_n_dim)))\n\n    s += 'Correlation between pixel and world axes:\\n\\n'\n\n    s += (' ' * world_dim_width + '  ' +\n            ('{0:^' + str(wcs.pixel_n_dim * 5 - 2) + 's}').format('Pixel Dim') +\n            '\\n')\n\n    s += (('{0:' + str(world_dim_width) + 's}').format('World Dim') +\n            ''.join(['  ' + ('{0:' + str(pixel_dim_width) + 'd}').format(ipix)\n                    for ipix in range(wcs.pixel_n_dim)]) +\n            '\\n')\n\n    matrix = wcs.axis_correlation_matrix\n    matrix_str = np.empty(matrix.shape, dtype='U3')\n    matrix_str[matrix] = 'yes'\n    matrix_str[~matrix] = 'no'\n\n    for iwrl in range(wcs.world_n_dim):\n        s += (('{0:' + str(world_dim_width) + 'd}').format(iwrl) +\n                ''.join(['  ' + ('{0:>' + str(pixel_dim_width) + 's}').format(matrix_str[iwrl, ipix])\n                        for ipix in range(wcs.pixel_n_dim)]) +\n                '\\n')\n\n    # Make sure we get rid of the extra whitespace at the end of some lines\n    return '\\n'.join([l.rstrip() for l in s.splitlines()])"},{"attributeType":"null","col":0,"comment":"null","endLoc":896,"id":7294,"name":"cylfix","nodeType":"Attribute","startLoc":896,"text":"cylfix"},{"attributeType":"null","col":0,"comment":"null","endLoc":907,"id":7295,"name":"data","nodeType":"Attribute","startLoc":907,"text":"data"},{"attributeType":"null","col":0,"comment":"null","endLoc":912,"id":7296,"name":"data_wtbarr","nodeType":"Attribute","startLoc":912,"text":"data_wtbarr"},{"attributeType":"null","col":0,"comment":"null","endLoc":918,"id":7297,"name":"dateavg","nodeType":"Attribute","startLoc":918,"text":"dateavg"},{"attributeType":"null","col":0,"comment":"null","endLoc":928,"id":7298,"name":"dateobs","nodeType":"Attribute","startLoc":928,"text":"dateobs"},{"attributeType":"{get} | None","col":8,"comment":"null","endLoc":1877,"id":7299,"name":"_config","nodeType":"Attribute","startLoc":1877,"text":"self._config"},{"attributeType":"null","col":8,"comment":"null","endLoc":229,"id":7300,"name":"_registries_order","nodeType":"Attribute","startLoc":229,"text":"self._registries_order"},{"className":"ParamRef","col":0,"comment":"\n    PARAMref_ element: used inside of GROUP_ elements to refer to remote PARAM_ elements.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n\n    It contains the following publicly-accessible members:\n\n      *ref*: An XML ID referring to a <PARAM> element.\n    ","endLoc":1985,"id":7301,"nodeType":"Class","startLoc":1922,"text":"class ParamRef(SimpleElement, _UtypeProperty, _UcdProperty):\n    \"\"\"\n    PARAMref_ element: used inside of GROUP_ elements to refer to remote PARAM_ elements.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n\n    It contains the following publicly-accessible members:\n\n      *ref*: An XML ID referring to a <PARAM> element.\n    \"\"\"\n    _attr_list_11 = ['ref']\n    _attr_list_12 = _attr_list_11 + ['ucd', 'utype']\n    _element_name = \"PARAMref\"\n    _utype_in_v1_2 = True\n    _ucd_in_v1_2 = True\n\n    def __init__(self, table, ref, ucd=None, utype=None, config=None, pos=None):\n        if config is None:\n            config = {}\n\n        self._config = config\n        self._pos = pos\n\n        Element.__init__(self)\n        self._table = table\n        self.ref = ref\n        self.ucd = ucd\n        self.utype = utype\n\n        if config.get('version_1_2_or_later'):\n            self._attr_list = self._attr_list_12\n        else:\n            self._attr_list = self._attr_list_11\n            if ucd is not None:\n                warn_unknown_attrs(self._element_name, ['ucd'], config, pos)\n            if utype is not None:\n                warn_unknown_attrs(self._element_name, ['utype'], config, pos)\n\n    @property\n    def ref(self):\n        \"\"\"The ID_ of the PARAM_ that this PARAMref_ references.\"\"\"\n        return self._ref\n\n    @ref.setter\n    def ref(self, ref):\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        self._ref = ref\n\n    @ref.deleter\n    def ref(self):\n        self._ref = None\n\n    def get_ref(self):\n        \"\"\"\n        Lookup the :class:`Param` instance that this :class:``PARAMref``\n        references.\n        \"\"\"\n        for param in self._table._votable.iter_fields_and_params():\n            if isinstance(param, Param) and param.ID == self.ref:\n                return param\n        vo_raise(\n            f\"No params named '{self.ref}'\",\n            self._config, self._pos, KeyError)"},{"attributeType":"null","col":8,"comment":"null","endLoc":227,"id":7302,"name":"_writers","nodeType":"Attribute","startLoc":227,"text":"self._writers"},{"col":4,"comment":"null","endLoc":367,"header":"def __init__(self)","id":7303,"name":"__init__","nodeType":"Function","startLoc":365,"text":"def __init__(self):\n        super().__init__()\n        self._registries_order = (\"read\", \"write\", \"identify\")"},{"col":4,"comment":"null","endLoc":1959,"header":"def __init__(self, table, ref, ucd=None, utype=None, config=None, pos=None)","id":7304,"name":"__init__","nodeType":"Function","startLoc":1939,"text":"def __init__(self, table, ref, ucd=None, utype=None, config=None, pos=None):\n        if config is None:\n            config = {}\n\n        self._config = config\n        self._pos = pos\n\n        Element.__init__(self)\n        self._table = table\n        self.ref = ref\n        self.ucd = ucd\n        self.utype = utype\n\n        if config.get('version_1_2_or_later'):\n            self._attr_list = self._attr_list_12\n        else:\n            self._attr_list = self._attr_list_11\n            if ucd is not None:\n                warn_unknown_attrs(self._element_name, ['ucd'], config, pos)\n            if utype is not None:\n                warn_unknown_attrs(self._element_name, ['utype'], config, pos)"},{"attributeType":"null","col":0,"comment":"null","endLoc":938,"id":7305,"name":"datfix","nodeType":"Attribute","startLoc":938,"text":"datfix"},{"attributeType":"null","col":0,"comment":"null","endLoc":956,"id":7306,"name":"delta","nodeType":"Attribute","startLoc":956,"text":"delta"},{"attributeType":"null","col":0,"comment":"null","endLoc":965,"id":7307,"name":"det2im","nodeType":"Attribute","startLoc":965,"text":"det2im"},{"attributeType":"null","col":0,"comment":"null","endLoc":969,"id":7308,"name":"det2im1","nodeType":"Attribute","startLoc":969,"text":"det2im1"},{"attributeType":"null","col":0,"comment":"null","endLoc":974,"id":7309,"name":"det2im2","nodeType":"Attribute","startLoc":974,"text":"det2im2"},{"attributeType":"null","col":0,"comment":"null","endLoc":979,"id":7310,"name":"dims","nodeType":"Attribute","startLoc":979,"text":"dims"},{"attributeType":"null","col":0,"comment":"null","endLoc":986,"id":7311,"name":"DistortionLookupTable","nodeType":"Attribute","startLoc":986,"text":"DistortionLookupTable"},{"attributeType":"null","col":0,"comment":"null","endLoc":1007,"id":7312,"name":"dsun_obs","nodeType":"Attribute","startLoc":1007,"text":"dsun_obs"},{"attributeType":"null","col":0,"comment":"null","endLoc":1012,"id":7313,"name":"equinox","nodeType":"Attribute","startLoc":1012,"text":"equinox"},{"attributeType":"null","col":0,"comment":"null","endLoc":1022,"id":7314,"name":"extlev","nodeType":"Attribute","startLoc":1022,"text":"extlev"},{"attributeType":"null","col":0,"comment":"null","endLoc":1026,"id":7315,"name":"extnam","nodeType":"Attribute","startLoc":1026,"text":"extnam"},{"attributeType":"null","col":0,"comment":"null","endLoc":1030,"id":7316,"name":"extrema","nodeType":"Attribute","startLoc":1030,"text":"extrema"},{"attributeType":"null","col":0,"comment":"null","endLoc":1045,"id":7317,"name":"extver","nodeType":"Attribute","startLoc":1045,"text":"extver"},{"attributeType":"null","col":0,"comment":"null","endLoc":1049,"id":7318,"name":"find_all_wcs","nodeType":"Attribute","startLoc":1049,"text":"find_all_wcs"},{"attributeType":"null","col":0,"comment":"null","endLoc":1089,"id":7319,"name":"fix","nodeType":"Attribute","startLoc":1089,"text":"fix"},{"attributeType":"null","col":0,"comment":"null","endLoc":1147,"id":7320,"name":"get_offset","nodeType":"Attribute","startLoc":1147,"text":"get_offset"},{"attributeType":"null","col":0,"comment":"null","endLoc":1158,"id":7321,"name":"get_cdelt","nodeType":"Attribute","startLoc":1158,"text":"get_cdelt"},{"attributeType":"null","col":0,"comment":"null","endLoc":1171,"id":7322,"name":"get_pc","nodeType":"Attribute","startLoc":1171,"text":"get_pc"},{"attributeType":"null","col":0,"comment":"null","endLoc":1182,"id":7323,"name":"get_ps","nodeType":"Attribute","startLoc":1182,"text":"get_ps"},{"attributeType":"null","col":0,"comment":"null","endLoc":1204,"id":7324,"name":"get_pv","nodeType":"Attribute","startLoc":1204,"text":"get_pv"},{"attributeType":"null","col":0,"comment":"null","endLoc":1234,"id":7325,"name":"has_cd","nodeType":"Attribute","startLoc":1234,"text":"has_cd"},{"attributeType":"null","col":0,"comment":"null","endLoc":1259,"id":7326,"name":"has_cdi_ja","nodeType":"Attribute","startLoc":1259,"text":"has_cdi_ja"},{"attributeType":"null","col":0,"comment":"null","endLoc":1266,"id":7327,"name":"has_crota","nodeType":"Attribute","startLoc":1266,"text":"has_crota"},{"col":4,"comment":"The ID_ of the PARAM_ that this PARAMref_ references.","endLoc":1964,"header":"@property\n    def ref(self)","id":7328,"name":"ref","nodeType":"Function","startLoc":1961,"text":"@property\n    def ref(self):\n        \"\"\"The ID_ of the PARAM_ that this PARAMref_ references.\"\"\"\n        return self._ref"},{"col":4,"comment":"null","endLoc":1969,"header":"@ref.setter\n    def ref(self, ref)","id":7329,"name":"ref","nodeType":"Function","startLoc":1966,"text":"@ref.setter\n    def ref(self, ref):\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        self._ref = ref"},{"col":4,"comment":"null","endLoc":1973,"header":"@ref.deleter\n    def ref(self)","id":7330,"name":"ref","nodeType":"Function","startLoc":1971,"text":"@ref.deleter\n    def ref(self):\n        self._ref = None"},{"attributeType":"null","col":4,"comment":"null","endLoc":1933,"id":7331,"name":"_attr_list_11","nodeType":"Attribute","startLoc":1933,"text":"_attr_list_11"},{"attributeType":"null","col":0,"comment":"null","endLoc":1288,"id":7332,"name":"has_crotaia","nodeType":"Attribute","startLoc":1288,"text":"has_crotaia"},{"attributeType":"null","col":0,"comment":"null","endLoc":1295,"id":7333,"name":"has_pc","nodeType":"Attribute","startLoc":1295,"text":"has_pc"},{"attributeType":"null","col":4,"comment":"null","endLoc":1934,"id":7334,"name":"_attr_list_12","nodeType":"Attribute","startLoc":1934,"text":"_attr_list_12"},{"attributeType":"null","col":0,"comment":"null","endLoc":1306,"id":7335,"name":"has_pci_ja","nodeType":"Attribute","startLoc":1306,"text":"has_pci_ja"},{"attributeType":"null","col":0,"comment":"null","endLoc":1313,"id":7336,"name":"hgln_obs","nodeType":"Attribute","startLoc":1313,"text":"hgln_obs"},{"attributeType":"null","col":0,"comment":"null","endLoc":1318,"id":7337,"name":"hglt_obs","nodeType":"Attribute","startLoc":1318,"text":"hglt_obs"},{"col":4,"comment":"\n        Get the list of registered I/O formats as a `~astropy.table.Table`.\n\n        Parameters\n        ----------\n        data_class : class, optional\n            Filter readers/writer to match data class (default = all classes).\n\n        readwrite : str or None, optional\n            Search only for readers (``\"Read\"``) or writers (``\"Write\"``).\n            If None search for both.  Default is None.\n\n            .. versionadded:: 1.3\n\n        Returns\n        -------\n        format_table : :class:`~astropy.table.Table`\n            Table of available I/O formats.\n        ","endLoc":389,"header":"def get_formats(self, data_class=None, readwrite=None)","id":7338,"name":"get_formats","nodeType":"Function","startLoc":369,"text":"def get_formats(self, data_class=None, readwrite=None):\n        \"\"\"\n        Get the list of registered I/O formats as a `~astropy.table.Table`.\n\n        Parameters\n        ----------\n        data_class : class, optional\n            Filter readers/writer to match data class (default = all classes).\n\n        readwrite : str or None, optional\n            Search only for readers (``\"Read\"``) or writers (``\"Write\"``).\n            If None search for both.  Default is None.\n\n            .. versionadded:: 1.3\n\n        Returns\n        -------\n        format_table : :class:`~astropy.table.Table`\n            Table of available I/O formats.\n        \"\"\"\n        return super().get_formats(data_class, readwrite)"},{"attributeType":"null","col":0,"comment":"null","endLoc":1323,"id":7339,"name":"i","nodeType":"Attribute","startLoc":1323,"text":"i"},{"attributeType":"null","col":0,"comment":"null","endLoc":1327,"id":7340,"name":"imgpix_matrix","nodeType":"Attribute","startLoc":1327,"text":"imgpix_matrix"},{"attributeType":"null","col":0,"comment":"null","endLoc":1335,"id":7341,"name":"is_unity","nodeType":"Attribute","startLoc":1335,"text":"is_unity"},{"attributeType":"null","col":4,"comment":"null","endLoc":1935,"id":7342,"name":"_element_name","nodeType":"Attribute","startLoc":1935,"text":"_element_name"},{"attributeType":"null","col":0,"comment":"null","endLoc":1342,"id":7343,"name":"K","nodeType":"Attribute","startLoc":1342,"text":"K"},{"attributeType":"null","col":0,"comment":"null","endLoc":1350,"id":7344,"name":"kind","nodeType":"Attribute","startLoc":1350,"text":"kind"},{"attributeType":"null","col":0,"comment":"null","endLoc":1359,"id":7345,"name":"lat","nodeType":"Attribute","startLoc":1359,"text":"lat"},{"attributeType":"null","col":4,"comment":"null","endLoc":1936,"id":7346,"name":"_utype_in_v1_2","nodeType":"Attribute","startLoc":1936,"text":"_utype_in_v1_2"},{"attributeType":"null","col":0,"comment":"null","endLoc":1364,"id":7347,"name":"latpole","nodeType":"Attribute","startLoc":1364,"text":"latpole"},{"attributeType":"null","col":4,"comment":"null","endLoc":1937,"id":7348,"name":"_ucd_in_v1_2","nodeType":"Attribute","startLoc":1937,"text":"_ucd_in_v1_2"},{"attributeType":"null","col":0,"comment":"null","endLoc":1368,"id":7349,"name":"lattyp","nodeType":"Attribute","startLoc":1368,"text":"lattyp"},{"attributeType":"null","col":8,"comment":"null","endLoc":1948,"id":7350,"name":"ref","nodeType":"Attribute","startLoc":1948,"text":"self.ref"},{"attributeType":"null","col":8,"comment":"null","endLoc":367,"id":7351,"name":"_registries_order","nodeType":"Attribute","startLoc":367,"text":"self._registries_order"},{"attributeType":"null","col":0,"comment":"null","endLoc":1376,"id":7352,"name":"lng","nodeType":"Attribute","startLoc":1376,"text":"lng"},{"attributeType":"null","col":0,"comment":"null","endLoc":1381,"id":7353,"name":"lngtyp","nodeType":"Attribute","startLoc":1381,"text":"lngtyp"},{"attributeType":"null","col":0,"comment":"null","endLoc":1389,"id":7354,"name":"lonpole","nodeType":"Attribute","startLoc":1389,"text":"lonpole"},{"col":0,"comment":"Makes a function for a method on UnifiedIORegistry.\n\n    .. todo::\n\n        Make kwarg \"registry\" not hidden.\n\n    Returns\n    -------\n    wrapper : callable\n        Signature matches method on UnifiedIORegistry.\n        Accepts (hidden) kwarg \"registry\". default is ``default_registry``.\n    ","endLoc":45,"header":"def _make_io_func(method_name)","id":7355,"name":"_make_io_func","nodeType":"Function","startLoc":23,"text":"def _make_io_func(method_name):\n    \"\"\"Makes a function for a method on UnifiedIORegistry.\n\n    .. todo::\n\n        Make kwarg \"registry\" not hidden.\n\n    Returns\n    -------\n    wrapper : callable\n        Signature matches method on UnifiedIORegistry.\n        Accepts (hidden) kwarg \"registry\". default is ``default_registry``.\n    \"\"\"\n\n    @functools.wraps(getattr(default_registry, method_name))\n    def wrapper(*args, registry=None, **kwargs):\n        # written this way in case ever controlled by ScienceState\n        if registry is None:\n            registry = default_registry\n        # get and call bound method from registry instance\n        return getattr(registry, method_name)(*args, **kwargs)\n\n    return wrapper"},{"attributeType":"null","col":8,"comment":"null","endLoc":1947,"id":7356,"name":"_table","nodeType":"Attribute","startLoc":1947,"text":"self._table"},{"col":0,"comment":"null","endLoc":54,"header":"def __dir__()","id":7357,"name":"__dir__","nodeType":"Function","startLoc":52,"text":"def __dir__():\n    dir_out = list(globals())\n    return sorted(dir_out + __all__)"},{"attributeType":"null","col":0,"comment":"null","endLoc":1395,"id":7358,"name":"M","nodeType":"Attribute","startLoc":1395,"text":"M"},{"attributeType":"null","col":0,"comment":"null","endLoc":1399,"id":7359,"name":"m","nodeType":"Attribute","startLoc":1399,"text":"m"},{"col":0,"comment":"null","endLoc":61,"header":"def __getattr__(method: str)","id":7360,"name":"__getattr__","nodeType":"Function","startLoc":57,"text":"def __getattr__(method: str):\n    if method in __all__:\n        return _make_io_func(method)\n\n    raise AttributeError(f\"module {__name__!r} has no attribute {method!r}\")"},{"attributeType":"null","col":0,"comment":"null","endLoc":1403,"id":7361,"name":"map","nodeType":"Attribute","startLoc":1403,"text":"map"},{"attributeType":"null","col":0,"comment":"null","endLoc":1426,"id":7362,"name":"mix","nodeType":"Attribute","startLoc":1426,"text":"mix"},{"attributeType":"null","col":0,"comment":"null","endLoc":1562,"id":7363,"name":"mjdavg","nodeType":"Attribute","startLoc":1562,"text":"mjdavg"},{"attributeType":"null","col":0,"comment":"null","endLoc":1574,"id":7364,"name":"mjdobs","nodeType":"Attribute","startLoc":1574,"text":"mjdobs"},{"attributeType":"null","col":0,"comment":"null","endLoc":1586,"id":7365,"name":"name","nodeType":"Attribute","startLoc":1586,"text":"name"},{"attributeType":"null","col":0,"comment":"null","endLoc":1591,"id":7366,"name":"naxis","nodeType":"Attribute","startLoc":1591,"text":"naxis"},{"attributeType":"null","col":0,"comment":"null","endLoc":1617,"id":7367,"name":"nc","nodeType":"Attribute","startLoc":1617,"text":"nc"},{"attributeType":"null","col":0,"comment":"null","endLoc":1624,"id":7368,"name":"ndim","nodeType":"Attribute","startLoc":1624,"text":"ndim"},{"attributeType":"null","col":0,"comment":"null","endLoc":1628,"id":7369,"name":"obsgeo","nodeType":"Attribute","startLoc":1628,"text":"obsgeo"},{"attributeType":"BaseLowLevelWCS","col":8,"comment":"null","endLoc":20,"id":7370,"name":"_wcs","nodeType":"Attribute","startLoc":20,"text":"self._wcs"},{"attributeType":"null","col":0,"comment":"null","endLoc":1637,"id":7371,"name":"p0","nodeType":"Attribute","startLoc":1637,"text":"p0"},{"attributeType":"null","col":0,"comment":"null","endLoc":1645,"id":7372,"name":"p2s","nodeType":"Attribute","startLoc":1645,"text":"p2s"},{"attributeType":"null","col":0,"comment":"null","endLoc":1723,"id":7373,"name":"p4_pix2foc","nodeType":"Attribute","startLoc":1723,"text":"p4_pix2foc"},{"attributeType":"null","col":0,"comment":"null","endLoc":1750,"id":7374,"name":"pc","nodeType":"Attribute","startLoc":1750,"text":"pc"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":7375,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"attributeType":"UnifiedIORegistry","col":0,"comment":"null","endLoc":16,"id":7376,"name":"default_registry","nodeType":"Attribute","startLoc":16,"text":"default_registry"},{"attributeType":"null","col":0,"comment":"null","endLoc":1779,"id":7377,"name":"phi0","nodeType":"Attribute","startLoc":1779,"text":"phi0"},{"attributeType":"null","col":0,"comment":"null","endLoc":1791,"id":7378,"name":"pix2foc","nodeType":"Attribute","startLoc":1791,"text":"pix2foc"},{"attributeType":"null","col":0,"comment":"null","endLoc":1818,"id":7379,"name":"piximg_matrix","nodeType":"Attribute","startLoc":1818,"text":"piximg_matrix"},{"attributeType":"null","col":0,"comment":"null","endLoc":1823,"id":7380,"name":"print_contents","nodeType":"Attribute","startLoc":1823,"text":"print_contents"},{"attributeType":"null","col":0,"comment":"null","endLoc":1833,"id":7381,"name":"print_contents_tabprm","nodeType":"Attribute","startLoc":1833,"text":"print_contents_tabprm"},{"attributeType":"null","col":0,"comment":"null","endLoc":1843,"id":7382,"name":"print_contents_wtbarr","nodeType":"Attribute","startLoc":1843,"text":"print_contents_wtbarr"},{"attributeType":"null","col":0,"comment":"null","endLoc":1853,"id":7383,"name":"radesys","nodeType":"Attribute","startLoc":1853,"text":"radesys"},{"attributeType":"null","col":0,"comment":"null","endLoc":1858,"id":7384,"name":"restfrq","nodeType":"Attribute","startLoc":1858,"text":"restfrq"},{"attributeType":"null","col":0,"comment":"null","endLoc":1864,"id":7385,"name":"restwav","nodeType":"Attribute","startLoc":1864,"text":"restwav"},{"attributeType":"null","col":0,"comment":"null","endLoc":1870,"id":7386,"name":"row","nodeType":"Attribute","startLoc":1870,"text":"row"},{"attributeType":"null","col":0,"comment":"null","endLoc":1874,"id":7387,"name":"rsun_ref","nodeType":"Attribute","startLoc":1874,"text":"rsun_ref"},{"attributeType":"null","col":0,"comment":"null","endLoc":1879,"id":7388,"name":"s2p","nodeType":"Attribute","startLoc":1879,"text":"s2p"},{"attributeType":"null","col":0,"comment":"null","endLoc":1949,"id":7389,"name":"sense","nodeType":"Attribute","startLoc":1949,"text":"sense"},{"col":0,"comment":"","endLoc":3,"header":"compat.py#<anonymous>","id":7390,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = [\"register_reader\", \"register_writer\", \"register_identifier\",  # noqa: F822\n           \"unregister_reader\", \"unregister_writer\", \"unregister_identifier\",\n           \"get_reader\", \"get_writer\", \"get_formats\",\n           \"read\", \"write\",\n           \"identify_format\", \"delay_doc_updates\"]\n\ndefault_registry = UnifiedIORegistry()\n\n_identifiers = default_registry._identifiers\n\n_readers = default_registry._readers\n\n_writers = default_registry._writers"},{"attributeType":"null","col":0,"comment":"null","endLoc":1957,"id":7391,"name":"set","nodeType":"Attribute","startLoc":1957,"text":"set"},{"attributeType":"null","col":0,"comment":"null","endLoc":2001,"id":7392,"name":"set_tabprm","nodeType":"Attribute","startLoc":2001,"text":"set_tabprm"},{"attributeType":"null","col":0,"comment":"null","endLoc":2020,"id":7393,"name":"set_celprm","nodeType":"Attribute","startLoc":2020,"text":"set_celprm"},{"attributeType":"null","col":0,"comment":"null","endLoc":2037,"id":7394,"name":"set_ps","nodeType":"Attribute","startLoc":2037,"text":"set_ps"},{"attributeType":"null","col":0,"comment":"null","endLoc":2060,"id":7395,"name":"set_pv","nodeType":"Attribute","startLoc":2060,"text":"set_pv"},{"attributeType":"null","col":0,"comment":"null","endLoc":2083,"id":7396,"name":"sip","nodeType":"Attribute","startLoc":2083,"text":"sip"},{"attributeType":"null","col":0,"comment":"null","endLoc":2088,"id":7397,"name":"Sip","nodeType":"Attribute","startLoc":2088,"text":"Sip"},{"attributeType":"null","col":0,"comment":"null","endLoc":2122,"id":7398,"name":"sip_foc2pix","nodeType":"Attribute","startLoc":2122,"text":"sip_foc2pix"},{"attributeType":"null","col":8,"comment":"null","endLoc":1949,"id":7399,"name":"ucd","nodeType":"Attribute","startLoc":1949,"text":"self.ucd"},{"attributeType":"null","col":0,"comment":"null","endLoc":2149,"id":7400,"name":"sip_pix2foc","nodeType":"Attribute","startLoc":2149,"text":"sip_pix2foc"},{"attributeType":"null","col":0,"comment":"null","endLoc":2176,"id":7401,"name":"spcfix","nodeType":"Attribute","startLoc":2176,"text":"spcfix"},{"attributeType":"null","col":0,"comment":"null","endLoc":2189,"id":7402,"name":"spec","nodeType":"Attribute","startLoc":2189,"text":"spec"},{"attributeType":"null","col":0,"comment":"null","endLoc":2193,"id":7403,"name":"specsys","nodeType":"Attribute","startLoc":2193,"text":"specsys"},{"attributeType":"null","col":0,"comment":"null","endLoc":2201,"id":7404,"name":"sptr","nodeType":"Attribute","startLoc":2201,"text":"sptr"},{"attributeType":"null","col":0,"comment":"null","endLoc":2250,"id":7405,"name":"ssysobs","nodeType":"Attribute","startLoc":2250,"text":"ssysobs"},{"attributeType":"null","col":0,"comment":"null","endLoc":2262,"id":7406,"name":"ssyssrc","nodeType":"Attribute","startLoc":2262,"text":"ssyssrc"},{"col":4,"comment":"\n        Information describing the dropped world dimensions.\n        ","endLoc":186,"header":"@lazyproperty\n    def dropped_world_dimensions(self)","id":7407,"name":"dropped_world_dimensions","nodeType":"Function","startLoc":156,"text":"@lazyproperty\n    def dropped_world_dimensions(self):\n        \"\"\"\n        Information describing the dropped world dimensions.\n        \"\"\"\n        world_coords = self._pixel_to_world_values_all(*[0]*len(self._pixel_keep))\n        dropped_info = defaultdict(list)\n\n        for i in range(self._wcs.world_n_dim):\n\n            if i in self._world_keep:\n                continue\n\n            if \"world_axis_object_classes\" not in dropped_info:\n                dropped_info[\"world_axis_object_classes\"] = dict()\n\n            wao_classes = self._wcs.world_axis_object_classes\n            wao_components = self._wcs.world_axis_object_components\n\n            dropped_info[\"value\"].append(world_coords[i])\n            dropped_info[\"world_axis_names\"].append(self._wcs.world_axis_names[i])\n            dropped_info[\"world_axis_physical_types\"].append(self._wcs.world_axis_physical_types[i])\n            dropped_info[\"world_axis_units\"].append(self._wcs.world_axis_units[i])\n            dropped_info[\"world_axis_object_components\"].append(wao_components[i])\n            dropped_info[\"world_axis_object_classes\"].update(dict(\n                filter(\n                    lambda x: x[0] == wao_components[i][0], wao_classes.items()\n                )\n            ))\n            dropped_info[\"serialized_classes\"] = self.serialized_classes\n        return dict(dropped_info)"},{"attributeType":"null","col":0,"comment":"null","endLoc":2269,"id":7408,"name":"sub","nodeType":"Attribute","startLoc":2269,"text":"sub"},{"attributeType":"null","col":0,"comment":"null","endLoc":2369,"id":7409,"name":"tab","nodeType":"Attribute","startLoc":2369,"text":"tab"},{"attributeType":"null","col":0,"comment":"null","endLoc":2375,"id":7410,"name":"Tabprm","nodeType":"Attribute","startLoc":2375,"text":"Tabprm"},{"attributeType":"null","col":0,"comment":"null","endLoc":2383,"id":7411,"name":"theta0","nodeType":"Attribute","startLoc":2383,"text":"theta0"},{"attributeType":"null","col":0,"comment":"null","endLoc":2395,"id":7412,"name":"to_header","nodeType":"Attribute","startLoc":2395,"text":"to_header"},{"attributeType":"null","col":0,"comment":"null","endLoc":2467,"id":7413,"name":"ttype","nodeType":"Attribute","startLoc":2467,"text":"ttype"},{"attributeType":"null","col":0,"comment":"null","endLoc":2472,"id":7414,"name":"unitfix","nodeType":"Attribute","startLoc":2472,"text":"unitfix"},{"attributeType":"null","col":0,"comment":"null","endLoc":2509,"id":7415,"name":"velangl","nodeType":"Attribute","startLoc":2509,"text":"velangl"},{"attributeType":"null","col":0,"comment":"null","endLoc":2518,"id":7416,"name":"velosys","nodeType":"Attribute","startLoc":2518,"text":"velosys"},{"attributeType":"null","col":8,"comment":"null","endLoc":1950,"id":7417,"name":"utype","nodeType":"Attribute","startLoc":1950,"text":"self.utype"},{"attributeType":"null","col":0,"comment":"null","endLoc":2532,"id":7418,"name":"velref","nodeType":"Attribute","startLoc":2532,"text":"velref"},{"attributeType":"null","col":0,"comment":"null","endLoc":2538,"id":7419,"name":"wcs","nodeType":"Attribute","startLoc":2538,"text":"wcs"},{"attributeType":"null","col":0,"comment":"null","endLoc":2543,"id":7420,"name":"Wcs","nodeType":"Attribute","startLoc":2543,"text":"Wcs"},{"attributeType":"null","col":0,"comment":"null","endLoc":2563,"id":7421,"name":"Wcsprm","nodeType":"Attribute","startLoc":2563,"text":"Wcsprm"},{"attributeType":"null","col":0,"comment":"null","endLoc":2652,"id":7422,"name":"wtb","nodeType":"Attribute","startLoc":2652,"text":"wtb"},{"attributeType":"null","col":0,"comment":"null","endLoc":2657,"id":7423,"name":"Wtbarr","nodeType":"Attribute","startLoc":2657,"text":"Wtbarr"},{"attributeType":"null","col":0,"comment":"null","endLoc":2665,"id":7424,"name":"zsource","nodeType":"Attribute","startLoc":2665,"text":"zsource"},{"col":0,"comment":"null","endLoc":334,"header":"def get_extensions()","id":7425,"name":"get_extensions","nodeType":"Function","startLoc":244,"text":"def get_extensions():\n    generate_c_docstrings()\n\n    ######################################################################\n    # DISTUTILS SETUP\n    cfg = defaultdict(list)\n\n    wcslib_files = [  # List of wcslib files to compile\n        'flexed/wcsbth.c',\n        'flexed/wcspih.c',\n        'flexed/wcsulex.c',\n        'flexed/wcsutrn.c',\n        'cel.c',\n        'dis.c',\n        'lin.c',\n        'log.c',\n        'prj.c',\n        'spc.c',\n        'sph.c',\n        'spx.c',\n        'tab.c',\n        'wcs.c',\n        'wcserr.c',\n        'wcsfix.c',\n        'wcshdr.c',\n        'wcsprintf.c',\n        'wcsunits.c',\n        'wcsutil.c'\n    ]\n\n    wcslib_config_paths = [\n        join(WCSROOT, 'include', 'astropy_wcs', 'wcsconfig.h'),\n        join(WCSROOT, 'include', 'wcsconfig.h')\n    ]\n\n    get_wcslib_cfg(cfg, wcslib_files, wcslib_config_paths)\n\n    cfg['include_dirs'].append(join(WCSROOT, \"include\"))\n\n    astropy_wcs_files = [  # List of astropy.wcs files to compile\n        'distortion.c',\n        'distortion_wrap.c',\n        'docstrings.c',\n        'pipeline.c',\n        'pyutil.c',\n        'astropy_wcs.c',\n        'astropy_wcs_api.c',\n        'sip.c',\n        'sip_wrap.c',\n        'str_list_proxy.c',\n        'unit_list_proxy.c',\n        'util.c',\n        'wcslib_wrap.c',\n        'wcslib_auxprm_wrap.c',\n        'wcslib_prjprm_wrap.c',\n        'wcslib_celprm_wrap.c',\n        'wcslib_tabprm_wrap.c',\n        'wcslib_wtbarr_wrap.c'\n    ]\n    cfg['sources'].extend(join(WCSROOT, 'src', x) for x in astropy_wcs_files)\n\n    cfg['sources'] = [str(x) for x in cfg['sources']]\n    cfg = dict((str(key), val) for key, val in cfg.items())\n\n    # Copy over header files from WCSLIB into the installed version of Astropy\n    # so that other Python packages can write extensions that link to it. We\n    # do the copying here then include the data in [options.package_data] in\n    # the setup.cfg file\n\n    wcslib_headers = [\n        'cel.h',\n        'lin.h',\n        'prj.h',\n        'spc.h',\n        'spx.h',\n        'tab.h',\n        'wcs.h',\n        'wcserr.h',\n        'wcsmath.h',\n        'wcsprintf.h',\n    ]\n\n    if not (int(os.environ.get('ASTROPY_USE_SYSTEM_WCSLIB', 0))\n            or int(os.environ.get('ASTROPY_USE_SYSTEM_ALL', 0))):\n        for header in wcslib_headers:\n            source = join('cextern', 'wcslib', 'C', header)\n            dest = join('astropy', 'wcs', 'include', 'wcslib', header)\n            if newer_group([source], dest, 'newer'):\n                shutil.copy(source, dest)\n\n    return [Extension('astropy.wcs._wcs', **cfg)]"},{"attributeType":"null","col":0,"comment":"null","endLoc":2671,"id":7426,"name":"WcsError","nodeType":"Attribute","startLoc":2671,"text":"WcsError"},{"attributeType":"null","col":0,"comment":"null","endLoc":2675,"id":7427,"name":"SingularMatrix","nodeType":"Attribute","startLoc":2675,"text":"SingularMatrix"},{"attributeType":"null","col":0,"comment":"null","endLoc":2681,"id":7428,"name":"InconsistentAxisTypes","nodeType":"Attribute","startLoc":2681,"text":"InconsistentAxisTypes"},{"attributeType":"null","col":0,"comment":"null","endLoc":2687,"id":7429,"name":"InvalidTransform","nodeType":"Attribute","startLoc":2687,"text":"InvalidTransform"},{"attributeType":"null","col":0,"comment":"null","endLoc":2694,"id":7430,"name":"InvalidCoordinate","nodeType":"Attribute","startLoc":2694,"text":"InvalidCoordinate"},{"attributeType":"null","col":0,"comment":"null","endLoc":2700,"id":7431,"name":"NoSolution","nodeType":"Attribute","startLoc":2700,"text":"NoSolution"},{"attributeType":"null","col":8,"comment":"null","endLoc":1969,"id":7432,"name":"_ref","nodeType":"Attribute","startLoc":1969,"text":"self._ref"},{"attributeType":"null","col":0,"comment":"null","endLoc":2706,"id":7433,"name":"InvalidSubimageSpecification","nodeType":"Attribute","startLoc":2706,"text":"InvalidSubimageSpecification"},{"attributeType":"null","col":0,"comment":"null","endLoc":2712,"id":7434,"name":"NonseparableSubimageCoordinateSystem","nodeType":"Attribute","startLoc":2712,"text":"NonseparableSubimageCoordinateSystem"},{"attributeType":"null","col":0,"comment":"null","endLoc":2718,"id":7435,"name":"NoWcsKeywordsFound","nodeType":"Attribute","startLoc":2718,"text":"NoWcsKeywordsFound"},{"attributeType":"null","col":0,"comment":"null","endLoc":2724,"id":7436,"name":"InvalidTabularParameters","nodeType":"Attribute","startLoc":2724,"text":"InvalidTabularParameters"},{"attributeType":"null","col":0,"comment":"null","endLoc":2730,"id":7437,"name":"InvalidPrjParameters","nodeType":"Attribute","startLoc":2730,"text":"InvalidPrjParameters"},{"attributeType":"null","col":0,"comment":"null","endLoc":2736,"id":7438,"name":"mjdbeg","nodeType":"Attribute","startLoc":2736,"text":"mjdbeg"},{"attributeType":"null","col":0,"comment":"null","endLoc":2748,"id":7439,"name":"mjdend","nodeType":"Attribute","startLoc":2748,"text":"mjdend"},{"attributeType":"null","col":0,"comment":"null","endLoc":2760,"id":7440,"name":"mjdref","nodeType":"Attribute","startLoc":2760,"text":"mjdref"},{"attributeType":"null","col":0,"comment":"null","endLoc":2772,"id":7441,"name":"bepoch","nodeType":"Attribute","startLoc":2772,"text":"bepoch"},{"fileName":"__init__.py","filePath":"astropy/wcs","id":7442,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\n.. _wcslib: https://www.atnf.csiro.au/people/mcalabre/WCS/wcslib/index.html\n.. _distortion paper: https://www.atnf.csiro.au/people/mcalabre/WCS/dcs_20040422.pdf\n.. _SIP: https://irsa.ipac.caltech.edu/data/SPITZER/docs/files/spitzer/shupeADASS.pdf\n.. _FITS WCS standard: https://fits.gsfc.nasa.gov/fits_wcs.html\n\n`astropy.wcs` contains utilities for managing World Coordinate System\n(WCS) transformations in FITS files.  These transformations map the\npixel locations in an image to their real-world units, such as their\nposition on the sky sphere.\n\nIt performs three separate classes of WCS transformations:\n\n- Core WCS, as defined in the `FITS WCS standard`_, based on Mark\n  Calabretta's `wcslib`_.  See `~astropy.wcs.Wcsprm`.\n- Simple Imaging Polynomial (`SIP`_) convention.  See\n  `~astropy.wcs.Sip`.\n- table lookup distortions as defined in WCS `distortion paper`_.  See\n  `~astropy.wcs.DistortionLookupTable`.\n\nEach of these transformations can be used independently or together in\na standard pipeline.\n\"\"\"\n\nfrom .wcs import *\nfrom .wcs import InvalidTabularParametersError  # just for docs\nfrom . import utils\n\n\ndef get_include():\n    \"\"\"\n    Get the path to astropy.wcs's C header files.\n    \"\"\"\n    import os\n    return os.path.join(os.path.dirname(__file__), \"include\")\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":142,"id":7443,"name":"InvalidTabularParametersError","nodeType":"Attribute","startLoc":142,"text":"InvalidTabularParametersError"},{"attributeType":"null","col":4,"comment":"null","endLoc":103,"id":7444,"name":"InvalidTabularParametersError","nodeType":"Attribute","startLoc":103,"text":"InvalidTabularParametersError"},{"col":0,"comment":"\n    Get the path to astropy.wcs's C header files.\n    ","endLoc":36,"header":"def get_include()","id":7445,"name":"get_include","nodeType":"Function","startLoc":31,"text":"def get_include():\n    \"\"\"\n    Get the path to astropy.wcs's C header files.\n    \"\"\"\n    import os\n    return os.path.join(os.path.dirname(__file__), \"include\")"},{"attributeType":"null","col":0,"comment":"null","endLoc":2782,"id":7446,"name":"jepoch","nodeType":"Attribute","startLoc":2782,"text":"jepoch"},{"attributeType":"null","col":0,"comment":"null","endLoc":2792,"id":7447,"name":"datebeg","nodeType":"Attribute","startLoc":2792,"text":"datebeg"},{"attributeType":"null","col":0,"comment":"null","endLoc":2802,"id":7448,"name":"dateend","nodeType":"Attribute","startLoc":2802,"text":"dateend"},{"attributeType":"null","col":0,"comment":"null","endLoc":2812,"id":7449,"name":"dateref","nodeType":"Attribute","startLoc":2812,"text":"dateref"},{"col":0,"comment":"","endLoc":24,"header":"__init__.py#<anonymous>","id":7450,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n.. _wcslib: https://www.atnf.csiro.au/people/mcalabre/WCS/wcslib/index.html\n.. _distortion paper: https://www.atnf.csiro.au/people/mcalabre/WCS/dcs_20040422.pdf\n.. _SIP: https://irsa.ipac.caltech.edu/data/SPITZER/docs/files/spitzer/shupeADASS.pdf\n.. _FITS WCS standard: https://fits.gsfc.nasa.gov/fits_wcs.html\n\n`astropy.wcs` contains utilities for managing World Coordinate System\n(WCS) transformations in FITS files.  These transformations map the\npixel locations in an image to their real-world units, such as their\nposition on the sky sphere.\n\nIt performs three separate classes of WCS transformations:\n\n- Core WCS, as defined in the `FITS WCS standard`_, based on Mark\n  Calabretta's `wcslib`_.  See `~astropy.wcs.Wcsprm`.\n- Simple Imaging Polynomial (`SIP`_) convention.  See\n  `~astropy.wcs.Sip`.\n- table lookup distortions as defined in WCS `distortion paper`_.  See\n  `~astropy.wcs.DistortionLookupTable`.\n\nEach of these transformations can be used independently or together in\na standard pipeline.\n\"\"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":2821,"id":7451,"name":"timesys","nodeType":"Attribute","startLoc":2821,"text":"timesys"},{"attributeType":"null","col":0,"comment":"null","endLoc":2831,"id":7452,"name":"trefpos","nodeType":"Attribute","startLoc":2831,"text":"trefpos"},{"attributeType":"null","col":0,"comment":"null","endLoc":2839,"id":7453,"name":"trefdir","nodeType":"Attribute","startLoc":2839,"text":"trefdir"},{"attributeType":"null","col":0,"comment":"null","endLoc":2847,"id":7454,"name":"timeunit","nodeType":"Attribute","startLoc":2847,"text":"timeunit"},{"col":4,"comment":"null","endLoc":227,"header":"def _pixel_to_world_values_all(self, *pixel_arrays)","id":7455,"name":"_pixel_to_world_values_all","nodeType":"Function","startLoc":212,"text":"def _pixel_to_world_values_all(self, *pixel_arrays):\n        pixel_arrays = tuple(map(np.asanyarray, pixel_arrays))\n        pixel_arrays_new = []\n        ipix_curr = -1\n        for ipix in range(self._wcs.pixel_n_dim):\n            if isinstance(self._slices_pixel[ipix], numbers.Integral):\n                pixel_arrays_new.append(self._slices_pixel[ipix])\n            else:\n                ipix_curr += 1\n                if self._slices_pixel[ipix].start is not None:\n                    pixel_arrays_new.append(pixel_arrays[ipix_curr] + self._slices_pixel[ipix].start)\n                else:\n                    pixel_arrays_new.append(pixel_arrays[ipix_curr])\n\n        pixel_arrays_new = np.broadcast_arrays(*pixel_arrays_new)\n        return self._wcs.pixel_to_world_values(*pixel_arrays_new)"},{"attributeType":"null","col":0,"comment":"null","endLoc":2858,"id":7456,"name":"plephem","nodeType":"Attribute","startLoc":2858,"text":"plephem"},{"attributeType":"null","col":0,"comment":"null","endLoc":2866,"id":7457,"name":"tstart","nodeType":"Attribute","startLoc":2866,"text":"tstart"},{"fileName":"utils.py","filePath":"astropy/wcs","id":7458,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport copy\n\nimport numpy as np\n\nimport astropy.units as u\nfrom astropy.coordinates import CartesianRepresentation, SphericalRepresentation, ITRS\nfrom astropy.utils import unbroadcast\n\nfrom .wcs import WCS, WCSSUB_LATITUDE, WCSSUB_LONGITUDE\n\n__doctest_skip__ = ['wcs_to_celestial_frame', 'celestial_frame_to_wcs']\n\n__all__ = ['obsgeo_to_frame', 'add_stokes_axis_to_wcs',\n           'celestial_frame_to_wcs', 'wcs_to_celestial_frame',\n           'proj_plane_pixel_scales', 'proj_plane_pixel_area',\n           'is_proj_plane_distorted', 'non_celestial_pixel_scales',\n           'skycoord_to_pixel', 'pixel_to_skycoord',\n           'custom_wcs_to_frame_mappings', 'custom_frame_to_wcs_mappings',\n           'pixel_to_pixel', 'local_partial_pixel_derivatives',\n           'fit_wcs_from_points']\n\n\ndef add_stokes_axis_to_wcs(wcs, add_before_ind):\n    \"\"\"\n    Add a new Stokes axis that is uncorrelated with any other axes.\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.WCS`\n        The WCS to add to\n    add_before_ind : int\n        Index of the WCS to insert the new Stokes axis in front of.\n        To add at the end, do add_before_ind = wcs.wcs.naxis\n        The beginning is at position 0.\n\n    Returns\n    -------\n    `~astropy.wcs.WCS`\n        A new `~astropy.wcs.WCS` instance with an additional axis\n    \"\"\"\n\n    inds = [i + 1 for i in range(wcs.wcs.naxis)]\n    inds.insert(add_before_ind, 0)\n    newwcs = wcs.sub(inds)\n    newwcs.wcs.ctype[add_before_ind] = 'STOKES'\n    newwcs.wcs.cname[add_before_ind] = 'STOKES'\n    return newwcs\n\n\ndef _wcs_to_celestial_frame_builtin(wcs):\n\n    # Import astropy.coordinates here to avoid circular imports\n    from astropy.coordinates import (FK4, FK5, ICRS, ITRS, FK4NoETerms,\n                                     Galactic, SphericalRepresentation)\n    # Import astropy.time here otherwise setup.py fails before extensions are compiled\n    from astropy.time import Time\n\n    if wcs.wcs.lng == -1 or wcs.wcs.lat == -1:\n        return None\n\n    radesys = wcs.wcs.radesys\n\n    if np.isnan(wcs.wcs.equinox):\n        equinox = None\n    else:\n        equinox = wcs.wcs.equinox\n\n    xcoord = wcs.wcs.ctype[wcs.wcs.lng][:4]\n    ycoord = wcs.wcs.ctype[wcs.wcs.lat][:4]\n\n    # Apply logic from FITS standard to determine the default radesys\n    if radesys == '' and xcoord == 'RA--' and ycoord == 'DEC-':\n        if equinox is None:\n            radesys = \"ICRS\"\n        elif equinox < 1984.:\n            radesys = \"FK4\"\n        else:\n            radesys = \"FK5\"\n\n    if radesys == 'FK4':\n        if equinox is not None:\n            equinox = Time(equinox, format='byear')\n        frame = FK4(equinox=equinox)\n    elif radesys == 'FK4-NO-E':\n        if equinox is not None:\n            equinox = Time(equinox, format='byear')\n        frame = FK4NoETerms(equinox=equinox)\n    elif radesys == 'FK5':\n        if equinox is not None:\n            equinox = Time(equinox, format='jyear')\n        frame = FK5(equinox=equinox)\n    elif radesys == 'ICRS':\n        frame = ICRS()\n    else:\n        if xcoord == 'GLON' and ycoord == 'GLAT':\n            frame = Galactic()\n        elif xcoord == 'TLON' and ycoord == 'TLAT':\n            # The default representation for ITRS is cartesian, but for WCS\n            # purposes, we need the spherical representation.\n            frame = ITRS(representation_type=SphericalRepresentation,\n                         obstime=wcs.wcs.dateobs or None)\n        else:\n            frame = None\n\n    return frame\n\n\ndef _celestial_frame_to_wcs_builtin(frame, projection='TAN'):\n\n    # Import astropy.coordinates here to avoid circular imports\n    from astropy.coordinates import FK4, FK5, ICRS, ITRS, BaseRADecFrame, FK4NoETerms, Galactic\n\n    # Create a 2-dimensional WCS\n    wcs = WCS(naxis=2)\n\n    if isinstance(frame, BaseRADecFrame):\n\n        xcoord = 'RA--'\n        ycoord = 'DEC-'\n        if isinstance(frame, ICRS):\n            wcs.wcs.radesys = 'ICRS'\n        elif isinstance(frame, FK4NoETerms):\n            wcs.wcs.radesys = 'FK4-NO-E'\n            wcs.wcs.equinox = frame.equinox.byear\n        elif isinstance(frame, FK4):\n            wcs.wcs.radesys = 'FK4'\n            wcs.wcs.equinox = frame.equinox.byear\n        elif isinstance(frame, FK5):\n            wcs.wcs.radesys = 'FK5'\n            wcs.wcs.equinox = frame.equinox.jyear\n        else:\n            return None\n    elif isinstance(frame, Galactic):\n        xcoord = 'GLON'\n        ycoord = 'GLAT'\n    elif isinstance(frame, ITRS):\n        xcoord = 'TLON'\n        ycoord = 'TLAT'\n        wcs.wcs.radesys = 'ITRS'\n        wcs.wcs.dateobs = frame.obstime.utc.isot\n    else:\n        return None\n\n    wcs.wcs.ctype = [xcoord + '-' + projection, ycoord + '-' + projection]\n\n    return wcs\n\n\nWCS_FRAME_MAPPINGS = [[_wcs_to_celestial_frame_builtin]]\nFRAME_WCS_MAPPINGS = [[_celestial_frame_to_wcs_builtin]]\n\n\nclass custom_wcs_to_frame_mappings:\n    def __init__(self, mappings=[]):\n        if hasattr(mappings, '__call__'):\n            mappings = [mappings]\n        WCS_FRAME_MAPPINGS.append(mappings)\n\n    def __enter__(self):\n        pass\n\n    def __exit__(self, type, value, tb):\n        WCS_FRAME_MAPPINGS.pop()\n\n\n# Backward-compatibility\ncustom_frame_mappings = custom_wcs_to_frame_mappings\n\n\nclass custom_frame_to_wcs_mappings:\n    def __init__(self, mappings=[]):\n        if hasattr(mappings, '__call__'):\n            mappings = [mappings]\n        FRAME_WCS_MAPPINGS.append(mappings)\n\n    def __enter__(self):\n        pass\n\n    def __exit__(self, type, value, tb):\n        FRAME_WCS_MAPPINGS.pop()\n\n\ndef wcs_to_celestial_frame(wcs):\n    \"\"\"\n    For a given WCS, return the coordinate frame that matches the celestial\n    component of the WCS.\n\n    Parameters\n    ----------\n    wcs : :class:`~astropy.wcs.WCS` instance\n        The WCS to find the frame for\n\n    Returns\n    -------\n    frame : :class:`~astropy.coordinates.baseframe.BaseCoordinateFrame` subclass instance\n        An instance of a :class:`~astropy.coordinates.baseframe.BaseCoordinateFrame`\n        subclass instance that best matches the specified WCS.\n\n    Notes\n    -----\n\n    To extend this function to frames not defined in astropy.coordinates, you\n    can write your own function which should take a :class:`~astropy.wcs.WCS`\n    instance and should return either an instance of a frame, or `None` if no\n    matching frame was found. You can register this function temporarily with::\n\n        >>> from astropy.wcs.utils import wcs_to_celestial_frame, custom_wcs_to_frame_mappings\n        >>> with custom_wcs_to_frame_mappings(my_function):\n        ...     wcs_to_celestial_frame(...)\n\n    \"\"\"\n    for mapping_set in WCS_FRAME_MAPPINGS:\n        for func in mapping_set:\n            frame = func(wcs)\n            if frame is not None:\n                return frame\n    raise ValueError(\"Could not determine celestial frame corresponding to \"\n                     \"the specified WCS object\")\n\n\ndef celestial_frame_to_wcs(frame, projection='TAN'):\n    \"\"\"\n    For a given coordinate frame, return the corresponding WCS object.\n\n    Note that the returned WCS object has only the elements corresponding to\n    coordinate frames set (e.g. ctype, equinox, radesys).\n\n    Parameters\n    ----------\n    frame : :class:`~astropy.coordinates.baseframe.BaseCoordinateFrame` subclass instance\n        An instance of a :class:`~astropy.coordinates.baseframe.BaseCoordinateFrame`\n        subclass instance for which to find the WCS\n    projection : str\n        Projection code to use in ctype, if applicable\n\n    Returns\n    -------\n    wcs : :class:`~astropy.wcs.WCS` instance\n        The corresponding WCS object\n\n    Examples\n    --------\n\n    ::\n\n        >>> from astropy.wcs.utils import celestial_frame_to_wcs\n        >>> from astropy.coordinates import FK5\n        >>> frame = FK5(equinox='J2010')\n        >>> wcs = celestial_frame_to_wcs(frame)\n        >>> wcs.to_header()\n        WCSAXES =                    2 / Number of coordinate axes\n        CRPIX1  =                  0.0 / Pixel coordinate of reference point\n        CRPIX2  =                  0.0 / Pixel coordinate of reference point\n        CDELT1  =                  1.0 / [deg] Coordinate increment at reference point\n        CDELT2  =                  1.0 / [deg] Coordinate increment at reference point\n        CUNIT1  = 'deg'                / Units of coordinate increment and value\n        CUNIT2  = 'deg'                / Units of coordinate increment and value\n        CTYPE1  = 'RA---TAN'           / Right ascension, gnomonic projection\n        CTYPE2  = 'DEC--TAN'           / Declination, gnomonic projection\n        CRVAL1  =                  0.0 / [deg] Coordinate value at reference point\n        CRVAL2  =                  0.0 / [deg] Coordinate value at reference point\n        LONPOLE =                180.0 / [deg] Native longitude of celestial pole\n        LATPOLE =                  0.0 / [deg] Native latitude of celestial pole\n        RADESYS = 'FK5'                / Equatorial coordinate system\n        EQUINOX =               2010.0 / [yr] Equinox of equatorial coordinates\n\n\n    Notes\n    -----\n\n    To extend this function to frames not defined in astropy.coordinates, you\n    can write your own function which should take a\n    :class:`~astropy.coordinates.baseframe.BaseCoordinateFrame` subclass\n    instance and a projection (given as a string) and should return either a WCS\n    instance, or `None` if the WCS could not be determined. You can register\n    this function temporarily with::\n\n        >>> from astropy.wcs.utils import celestial_frame_to_wcs, custom_frame_to_wcs_mappings\n        >>> with custom_frame_to_wcs_mappings(my_function):\n        ...     celestial_frame_to_wcs(...)\n\n    \"\"\"\n    for mapping_set in FRAME_WCS_MAPPINGS:\n        for func in mapping_set:\n            wcs = func(frame, projection=projection)\n            if wcs is not None:\n                return wcs\n    raise ValueError(\"Could not determine WCS corresponding to the specified \"\n                     \"coordinate frame.\")\n\n\ndef proj_plane_pixel_scales(wcs):\n    \"\"\"\n    For a WCS returns pixel scales along each axis of the image pixel at\n    the ``CRPIX`` location once it is projected onto the\n    \"plane of intermediate world coordinates\" as defined in\n    `Greisen & Calabretta 2002, A&A, 395, 1061 <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1061G>`_.\n\n    .. note::\n        This function is concerned **only** about the transformation\n        \"image plane\"->\"projection plane\" and **not** about the\n        transformation \"celestial sphere\"->\"projection plane\"->\"image plane\".\n        Therefore, this function ignores distortions arising due to\n        non-linear nature of most projections.\n\n    .. note::\n        In order to compute the scales corresponding to celestial axes only,\n        make sure that the input `~astropy.wcs.WCS` object contains\n        celestial axes only, e.g., by passing in the\n        `~astropy.wcs.WCS.celestial` WCS object.\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.WCS`\n        A world coordinate system object.\n\n    Returns\n    -------\n    scale : ndarray\n        A vector (`~numpy.ndarray`) of projection plane increments\n        corresponding to each pixel side (axis). The units of the returned\n        results are the same as the units of `~astropy.wcs.Wcsprm.cdelt`,\n        `~astropy.wcs.Wcsprm.crval`, and `~astropy.wcs.Wcsprm.cd` for\n        the celestial WCS and can be obtained by inquiring the value\n        of `~astropy.wcs.Wcsprm.cunit` property of the input\n        `~astropy.wcs.WCS` WCS object.\n\n    See Also\n    --------\n    astropy.wcs.utils.proj_plane_pixel_area\n\n    \"\"\"\n    return np.sqrt((wcs.pixel_scale_matrix**2).sum(axis=0, dtype=float))\n\n\ndef proj_plane_pixel_area(wcs):\n    \"\"\"\n    For a **celestial** WCS (see `astropy.wcs.WCS.celestial`) returns pixel\n    area of the image pixel at the ``CRPIX`` location once it is projected\n    onto the \"plane of intermediate world coordinates\" as defined in\n    `Greisen & Calabretta 2002, A&A, 395, 1061 <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1061G>`_.\n\n    .. note::\n        This function is concerned **only** about the transformation\n        \"image plane\"->\"projection plane\" and **not** about the\n        transformation \"celestial sphere\"->\"projection plane\"->\"image plane\".\n        Therefore, this function ignores distortions arising due to\n        non-linear nature of most projections.\n\n    .. note::\n        In order to compute the area of pixels corresponding to celestial\n        axes only, this function uses the `~astropy.wcs.WCS.celestial` WCS\n        object of the input ``wcs``.  This is different from the\n        `~astropy.wcs.utils.proj_plane_pixel_scales` function\n        that computes the scales for the axes of the input WCS itself.\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.WCS`\n        A world coordinate system object.\n\n    Returns\n    -------\n    area : float\n        Area (in the projection plane) of the pixel at ``CRPIX`` location.\n        The units of the returned result are the same as the units of\n        the `~astropy.wcs.Wcsprm.cdelt`, `~astropy.wcs.Wcsprm.crval`,\n        and `~astropy.wcs.Wcsprm.cd` for the celestial WCS and can be\n        obtained by inquiring the value of `~astropy.wcs.Wcsprm.cunit`\n        property of the `~astropy.wcs.WCS.celestial` WCS object.\n\n    Raises\n    ------\n    ValueError\n        Pixel area is defined only for 2D pixels. Most likely the\n        `~astropy.wcs.Wcsprm.cd` matrix of the `~astropy.wcs.WCS.celestial`\n        WCS is not a square matrix of second order.\n\n    Notes\n    -----\n\n    Depending on the application, square root of the pixel area can be used to\n    represent a single pixel scale of an equivalent square pixel\n    whose area is equal to the area of a generally non-square pixel.\n\n    See Also\n    --------\n    astropy.wcs.utils.proj_plane_pixel_scales\n\n    \"\"\"\n    psm = wcs.celestial.pixel_scale_matrix\n    if psm.shape != (2, 2):\n        raise ValueError(\"Pixel area is defined only for 2D pixels.\")\n    return np.abs(np.linalg.det(psm))\n\n\ndef is_proj_plane_distorted(wcs, maxerr=1.0e-5):\n    r\"\"\"\n    For a WCS returns `False` if square image (detector) pixels stay square\n    when projected onto the \"plane of intermediate world coordinates\"\n    as defined in\n    `Greisen & Calabretta 2002, A&A, 395, 1061 <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1061G>`_.\n    It will return `True` if transformation from image (detector) coordinates\n    to the focal plane coordinates is non-orthogonal or if WCS contains\n    non-linear (e.g., SIP) distortions.\n\n    .. note::\n        Since this function is concerned **only** about the transformation\n        \"image plane\"->\"focal plane\" and **not** about the transformation\n        \"celestial sphere\"->\"focal plane\"->\"image plane\",\n        this function ignores distortions arising due to non-linear nature\n        of most projections.\n\n    Let's denote by *C* either the original or the reconstructed\n    (from ``PC`` and ``CDELT``) CD matrix. `is_proj_plane_distorted`\n    verifies that the transformation from image (detector) coordinates\n    to the focal plane coordinates is orthogonal using the following\n    check:\n\n    .. math::\n        \\left \\| \\frac{C \\cdot C^{\\mathrm{T}}}\n        {| det(C)|} - I \\right \\|_{\\mathrm{max}} < \\epsilon .\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.WCS`\n        World coordinate system object\n\n    maxerr : float, optional\n        Accuracy to which the CD matrix, **normalized** such\n        that :math:`|det(CD)|=1`, should be close to being an\n        orthogonal matrix as described in the above equation\n        (see :math:`\\epsilon`).\n\n    Returns\n    -------\n    distorted : bool\n        Returns `True` if focal (projection) plane is distorted and `False`\n        otherwise.\n\n    \"\"\"\n    cwcs = wcs.celestial\n    return (not _is_cd_orthogonal(cwcs.pixel_scale_matrix, maxerr) or\n            _has_distortion(cwcs))\n\n\ndef _is_cd_orthogonal(cd, maxerr):\n    shape = cd.shape\n    if not (len(shape) == 2 and shape[0] == shape[1]):\n        raise ValueError(\"CD (or PC) matrix must be a 2D square matrix.\")\n\n    pixarea = np.abs(np.linalg.det(cd))\n    if (pixarea == 0.0):\n        raise ValueError(\"CD (or PC) matrix is singular.\")\n\n    # NOTE: Technically, below we should use np.dot(cd, np.conjugate(cd.T))\n    # However, I am not aware of complex CD/PC matrices...\n    I = np.dot(cd, cd.T) / pixarea\n    cd_unitary_err = np.amax(np.abs(I - np.eye(shape[0])))\n\n    return (cd_unitary_err < maxerr)\n\n\ndef non_celestial_pixel_scales(inwcs):\n    \"\"\"\n    Calculate the pixel scale along each axis of a non-celestial WCS,\n    for example one with mixed spectral and spatial axes.\n\n    Parameters\n    ----------\n    inwcs : `~astropy.wcs.WCS`\n        The world coordinate system object.\n\n    Returns\n    -------\n    scale : `numpy.ndarray`\n        The pixel scale along each axis.\n    \"\"\"\n\n    if inwcs.is_celestial:\n        raise ValueError(\"WCS is celestial, use celestial_pixel_scales instead\")\n\n    pccd = inwcs.pixel_scale_matrix\n\n    if np.allclose(np.extract(1-np.eye(*pccd.shape), pccd), 0):\n        return np.abs(np.diagonal(pccd))*u.deg\n    else:\n        raise ValueError(\"WCS is rotated, cannot determine consistent pixel scales\")\n\n\ndef _has_distortion(wcs):\n    \"\"\"\n    `True` if contains any SIP or image distortion components.\n    \"\"\"\n    return any(getattr(wcs, dist_attr) is not None\n               for dist_attr in ['cpdis1', 'cpdis2', 'det2im1', 'det2im2', 'sip'])\n\n\n# TODO: in future, we should think about how the following two functions can be\n# integrated better into the WCS class.\n\ndef skycoord_to_pixel(coords, wcs, origin=0, mode='all'):\n    \"\"\"\n    Convert a set of SkyCoord coordinates into pixels.\n\n    Parameters\n    ----------\n    coords : `~astropy.coordinates.SkyCoord`\n        The coordinates to convert.\n    wcs : `~astropy.wcs.WCS`\n        The WCS transformation to use.\n    origin : int\n        Whether to return 0 or 1-based pixel coordinates.\n    mode : 'all' or 'wcs'\n        Whether to do the transformation including distortions (``'all'``) or\n        only including only the core WCS transformation (``'wcs'``).\n\n    Returns\n    -------\n    xp, yp : `numpy.ndarray`\n        The pixel coordinates\n\n    See Also\n    --------\n    astropy.coordinates.SkyCoord.from_pixel\n    \"\"\"\n\n    if _has_distortion(wcs) and wcs.naxis != 2:\n        raise ValueError(\"Can only handle WCS with distortions for 2-dimensional WCS\")\n\n    # Keep only the celestial part of the axes, also re-orders lon/lat\n    wcs = wcs.sub([WCSSUB_LONGITUDE, WCSSUB_LATITUDE])\n\n    if wcs.naxis != 2:\n        raise ValueError(\"WCS should contain celestial component\")\n\n    # Check which frame the WCS uses\n    frame = wcs_to_celestial_frame(wcs)\n\n    # Check what unit the WCS needs\n    xw_unit = u.Unit(wcs.wcs.cunit[0])\n    yw_unit = u.Unit(wcs.wcs.cunit[1])\n\n    # Convert positions to frame\n    coords = coords.transform_to(frame)\n\n    # Extract longitude and latitude. We first try and use lon/lat directly,\n    # but if the representation is not spherical or unit spherical this will\n    # fail. We should then force the use of the unit spherical\n    # representation. We don't do that directly to make sure that we preserve\n    # custom lon/lat representations if available.\n    try:\n        lon = coords.data.lon.to(xw_unit)\n        lat = coords.data.lat.to(yw_unit)\n    except AttributeError:\n        lon = coords.spherical.lon.to(xw_unit)\n        lat = coords.spherical.lat.to(yw_unit)\n\n    # Convert to pixel coordinates\n    if mode == 'all':\n        xp, yp = wcs.all_world2pix(lon.value, lat.value, origin)\n    elif mode == 'wcs':\n        xp, yp = wcs.wcs_world2pix(lon.value, lat.value, origin)\n    else:\n        raise ValueError(\"mode should be either 'all' or 'wcs'\")\n\n    return xp, yp\n\n\ndef pixel_to_skycoord(xp, yp, wcs, origin=0, mode='all', cls=None):\n    \"\"\"\n    Convert a set of pixel coordinates into a `~astropy.coordinates.SkyCoord`\n    coordinate.\n\n    Parameters\n    ----------\n    xp, yp : float or ndarray\n        The coordinates to convert.\n    wcs : `~astropy.wcs.WCS`\n        The WCS transformation to use.\n    origin : int\n        Whether to return 0 or 1-based pixel coordinates.\n    mode : 'all' or 'wcs'\n        Whether to do the transformation including distortions (``'all'``) or\n        only including only the core WCS transformation (``'wcs'``).\n    cls : class or None\n        The class of object to create.  Should be a\n        `~astropy.coordinates.SkyCoord` subclass.  If None, defaults to\n        `~astropy.coordinates.SkyCoord`.\n\n    Returns\n    -------\n    coords : `~astropy.coordinates.SkyCoord` subclass\n        The celestial coordinates. Whatever ``cls`` type is.\n\n    See Also\n    --------\n    astropy.coordinates.SkyCoord.from_pixel\n    \"\"\"\n\n    # Import astropy.coordinates here to avoid circular imports\n    from astropy.coordinates import SkyCoord, UnitSphericalRepresentation\n\n    # we have to do this instead of actually setting the default to SkyCoord\n    # because importing SkyCoord at the module-level leads to circular\n    # dependencies.\n    if cls is None:\n        cls = SkyCoord\n\n    if _has_distortion(wcs) and wcs.naxis != 2:\n        raise ValueError(\"Can only handle WCS with distortions for 2-dimensional WCS\")\n\n    # Keep only the celestial part of the axes, also re-orders lon/lat\n    wcs = wcs.sub([WCSSUB_LONGITUDE, WCSSUB_LATITUDE])\n\n    if wcs.naxis != 2:\n        raise ValueError(\"WCS should contain celestial component\")\n\n    # Check which frame the WCS uses\n    frame = wcs_to_celestial_frame(wcs)\n\n    # Check what unit the WCS gives\n    lon_unit = u.Unit(wcs.wcs.cunit[0])\n    lat_unit = u.Unit(wcs.wcs.cunit[1])\n\n    # Convert pixel coordinates to celestial coordinates\n    if mode == 'all':\n        lon, lat = wcs.all_pix2world(xp, yp, origin)\n    elif mode == 'wcs':\n        lon, lat = wcs.wcs_pix2world(xp, yp, origin)\n    else:\n        raise ValueError(\"mode should be either 'all' or 'wcs'\")\n\n    # Add units to longitude/latitude\n    lon = lon * lon_unit\n    lat = lat * lat_unit\n\n    # Create a SkyCoord-like object\n    data = UnitSphericalRepresentation(lon=lon, lat=lat)\n    coords = cls(frame.realize_frame(data))\n\n    return coords\n\n\ndef _unique_with_order_preserved(items):\n    \"\"\"\n    Return a list of unique items in the list provided, preserving the order\n    in which they are found.\n    \"\"\"\n    new_items = []\n    for item in items:\n        if item not in new_items:\n            new_items.append(item)\n    return new_items\n\n\ndef _pixel_to_world_correlation_matrix(wcs):\n    \"\"\"\n    Return a correlation matrix between the pixel coordinates and the\n    high level world coordinates, along with the list of high level world\n    coordinate classes.\n\n    The shape of the matrix is ``(n_world, n_pix)``, where ``n_world`` is the\n    number of high level world coordinates.\n    \"\"\"\n\n    # We basically want to collapse the world dimensions together that are\n    # combined into the same high-level objects.\n\n    # Get the following in advance as getting these properties can be expensive\n    all_components = wcs.low_level_wcs.world_axis_object_components\n    all_classes = wcs.low_level_wcs.world_axis_object_classes\n    axis_correlation_matrix = wcs.low_level_wcs.axis_correlation_matrix\n\n    components = _unique_with_order_preserved([c[0] for c in all_components])\n\n    matrix = np.zeros((len(components), wcs.pixel_n_dim), dtype=bool)\n\n    for iworld in range(wcs.world_n_dim):\n        iworld_unique = components.index(all_components[iworld][0])\n        matrix[iworld_unique] |= axis_correlation_matrix[iworld]\n\n    classes = [all_classes[component][0] for component in components]\n\n    return matrix, classes\n\n\ndef _pixel_to_pixel_correlation_matrix(wcs_in, wcs_out):\n    \"\"\"\n    Correlation matrix between the input and output pixel coordinates for a\n    pixel -> world -> pixel transformation specified by two WCS instances.\n\n    The first WCS specified is the one used for the pixel -> world\n    transformation and the second WCS specified is the one used for the world ->\n    pixel transformation. The shape of the matrix is\n    ``(n_pixel_out, n_pixel_in)``.\n    \"\"\"\n\n    matrix1, classes1 = _pixel_to_world_correlation_matrix(wcs_in)\n    matrix2, classes2 = _pixel_to_world_correlation_matrix(wcs_out)\n\n    if len(classes1) != len(classes2):\n        raise ValueError(\"The two WCS return a different number of world coordinates\")\n\n    # Check if classes match uniquely\n    unique_match = True\n    mapping = []\n    for class1 in classes1:\n        matches = classes2.count(class1)\n        if matches == 0:\n            raise ValueError(\"The world coordinate types of the two WCS do not match\")\n        elif matches > 1:\n            unique_match = False\n            break\n        else:\n            mapping.append(classes2.index(class1))\n\n    if unique_match:\n\n        # Classes are unique, so we need to re-order matrix2 along the world\n        # axis using the mapping we found above.\n        matrix2 = matrix2[mapping]\n\n    elif classes1 != classes2:\n\n        raise ValueError(\"World coordinate order doesn't match and automatic matching is ambiguous\")\n\n    matrix = np.matmul(matrix2.T, matrix1)\n\n    return matrix\n\n\ndef _split_matrix(matrix):\n    \"\"\"\n    Given an axis correlation matrix from a WCS object, return information about\n    the individual WCS that can be split out.\n\n    The output is a list of tuples, where each tuple contains a list of\n    pixel dimensions and a list of world dimensions that can be extracted to\n    form a new WCS. For example, in the case of a spectral cube with the first\n    two world coordinates being the celestial coordinates and the third\n    coordinate being an uncorrelated spectral axis, the matrix would look like::\n\n        array([[ True,  True, False],\n               [ True,  True, False],\n               [False, False,  True]])\n\n    and this function will return ``[([0, 1], [0, 1]), ([2], [2])]``.\n    \"\"\"\n\n    pixel_used = []\n\n    split_info = []\n\n    for ipix in range(matrix.shape[1]):\n        if ipix in pixel_used:\n            continue\n        pixel_include = np.zeros(matrix.shape[1], dtype=bool)\n        pixel_include[ipix] = True\n        n_pix_prev, n_pix = 0, 1\n        while n_pix > n_pix_prev:\n            world_include = matrix[:, pixel_include].any(axis=1)\n            pixel_include = matrix[world_include, :].any(axis=0)\n            n_pix_prev, n_pix = n_pix, np.sum(pixel_include)\n        pixel_indices = list(np.nonzero(pixel_include)[0])\n        world_indices = list(np.nonzero(world_include)[0])\n        pixel_used.extend(pixel_indices)\n        split_info.append((pixel_indices, world_indices))\n\n    return split_info\n\n\ndef pixel_to_pixel(wcs_in, wcs_out, *inputs):\n    \"\"\"\n    Transform pixel coordinates in a dataset with a WCS to pixel coordinates\n    in another dataset with a different WCS.\n\n    This function is designed to efficiently deal with input pixel arrays that\n    are broadcasted views of smaller arrays, and is compatible with any\n    APE14-compliant WCS.\n\n    Parameters\n    ----------\n    wcs_in : `~astropy.wcs.wcsapi.BaseHighLevelWCS`\n        A WCS object for the original dataset which complies with the\n        high-level shared APE 14 WCS API.\n    wcs_out : `~astropy.wcs.wcsapi.BaseHighLevelWCS`\n        A WCS object for the target dataset which complies with the\n        high-level shared APE 14 WCS API.\n    *inputs :\n        Scalars or arrays giving the pixel coordinates to transform.\n    \"\"\"\n\n    # Shortcut for scalars\n    if np.isscalar(inputs[0]):\n        world_outputs = wcs_in.pixel_to_world(*inputs)\n        if not isinstance(world_outputs, (tuple, list)):\n            world_outputs = (world_outputs,)\n        return wcs_out.world_to_pixel(*world_outputs)\n\n    # Remember original shape\n    original_shape = inputs[0].shape\n\n    matrix = _pixel_to_pixel_correlation_matrix(wcs_in, wcs_out)\n    split_info = _split_matrix(matrix)\n\n    outputs = [None] * wcs_out.pixel_n_dim\n\n    for (pixel_in_indices, pixel_out_indices) in split_info:\n\n        pixel_inputs = []\n        for ipix in range(wcs_in.pixel_n_dim):\n            if ipix in pixel_in_indices:\n                pixel_inputs.append(unbroadcast(inputs[ipix]))\n            else:\n                pixel_inputs.append(inputs[ipix].flat[0])\n\n        pixel_inputs = np.broadcast_arrays(*pixel_inputs)\n\n        world_outputs = wcs_in.pixel_to_world(*pixel_inputs)\n\n        if not isinstance(world_outputs, (tuple, list)):\n            world_outputs = (world_outputs,)\n\n        pixel_outputs = wcs_out.world_to_pixel(*world_outputs)\n\n        if wcs_out.pixel_n_dim == 1:\n            pixel_outputs = (pixel_outputs,)\n\n        for ipix in range(wcs_out.pixel_n_dim):\n            if ipix in pixel_out_indices:\n                outputs[ipix] = np.broadcast_to(pixel_outputs[ipix], original_shape)\n\n    return outputs[0] if wcs_out.pixel_n_dim == 1 else outputs\n\n\ndef local_partial_pixel_derivatives(wcs, *pixel, normalize_by_world=False):\n    \"\"\"\n    Return a matrix of shape ``(world_n_dim, pixel_n_dim)`` where each entry\n    ``[i, j]`` is the partial derivative d(world_i)/d(pixel_j) at the requested\n    pixel position.\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.WCS`\n        The WCS transformation to evaluate the derivatives for.\n    *pixel : float\n        The scalar pixel coordinates at which to evaluate the derivatives.\n    normalize_by_world : bool\n        If `True`, the matrix is normalized so that for each world entry\n        the derivatives add up to 1.\n    \"\"\"\n\n    # Find the world coordinates at the requested pixel\n    pixel_ref = np.array(pixel)\n    world_ref = np.array(wcs.pixel_to_world_values(*pixel_ref))\n\n    # Set up the derivative matrix\n    derivatives = np.zeros((wcs.world_n_dim, wcs.pixel_n_dim))\n\n    for i in range(wcs.pixel_n_dim):\n        pixel_off = pixel_ref.copy()\n        pixel_off[i] += 1\n        world_off = np.array(wcs.pixel_to_world_values(*pixel_off))\n        derivatives[:, i] = world_off - world_ref\n\n    if normalize_by_world:\n        derivatives /= derivatives.sum(axis=0)[:, np.newaxis]\n\n    return derivatives\n\n\ndef _linear_wcs_fit(params, lon, lat, x, y, w_obj):\n    \"\"\"\n    Objective function for fitting linear terms.\n\n    Parameters\n    ----------\n    params : array\n        6 element array. First 4 elements are PC matrix, last 2 are CRPIX.\n    lon, lat: array\n        Sky coordinates.\n    x, y: array\n        Pixel coordinates\n    w_obj: `~astropy.wcs.WCS`\n        WCS object\n        \"\"\"\n    cd = params[0:4]\n    crpix = params[4:6]\n\n    w_obj.wcs.cd = ((cd[0], cd[1]), (cd[2], cd[3]))\n    w_obj.wcs.crpix = crpix\n    lon2, lat2 = w_obj.wcs_pix2world(x, y, 0)\n\n    lat_resids = lat - lat2\n    lon_resids = lon - lon2\n    # In case the longitude has wrapped around\n    lon_resids = np.mod(lon_resids - 180.0, 360.0) - 180.0\n\n    resids = np.concatenate((lon_resids * np.cos(np.radians(lat)), lat_resids))\n\n    return resids\n\n\ndef _sip_fit(params, lon, lat, u, v, w_obj, order, coeff_names):\n\n    \"\"\" Objective function for fitting SIP.\n\n    Parameters\n    ----------\n    params : array\n        Fittable parameters. First 4 elements are PC matrix, last 2 are CRPIX.\n    lon, lat: array\n        Sky coordinates.\n    u, v: array\n        Pixel coordinates\n    w_obj: `~astropy.wcs.WCS`\n        WCS object\n    \"\"\"\n\n    from ..modeling.models import SIP  # here to avoid circular import\n\n    # unpack params\n    crpix = params[0:2]\n    cdx = params[2:6].reshape((2, 2))\n    a_params = params[6:6+len(coeff_names)]\n    b_params = params[6+len(coeff_names):]\n\n    # assign to wcs, used for transfomations in this function\n    w_obj.wcs.cd = cdx\n    w_obj.wcs.crpix = crpix\n\n    a_coeff, b_coeff = {}, {}\n    for i in range(len(coeff_names)):\n        a_coeff['A_' + coeff_names[i]] = a_params[i]\n        b_coeff['B_' + coeff_names[i]] = b_params[i]\n\n    sip = SIP(crpix=crpix, a_order=order, b_order=order,\n              a_coeff=a_coeff, b_coeff=b_coeff)\n    fuv, guv = sip(u, v)\n\n    xo, yo = np.dot(cdx, np.array([u+fuv-crpix[0], v+guv-crpix[1]]))\n\n    # use all pix2world in case `projection` contains distortion table\n    x, y = w_obj.all_world2pix(lon, lat, 0)\n    x, y = np.dot(w_obj.wcs.cd, (x-w_obj.wcs.crpix[0], y-w_obj.wcs.crpix[1]))\n\n    resids = np.concatenate((x-xo, y-yo))\n\n    return resids\n\n\ndef fit_wcs_from_points(xy, world_coords, proj_point='center',\n                        projection='TAN', sip_degree=None):\n    \"\"\"\n    Given two matching sets of coordinates on detector and sky,\n    compute the WCS.\n\n    Fits a WCS object to matched set of input detector and sky coordinates.\n    Optionally, a SIP can be fit to account for geometric\n    distortion. Returns an `~astropy.wcs.WCS` object with the best fit\n    parameters for mapping between input pixel and sky coordinates.\n\n    The projection type (default 'TAN') can passed in as a string, one of\n    the valid three-letter projection codes - or as a WCS object with\n    projection keywords already set. Note that if an input WCS has any\n    non-polynomial distortion, this will be applied and reflected in the\n    fit terms and coefficients. Passing in a WCS object in this way essentially\n    allows it to be refit based on the matched input coordinates and projection\n    point, but take care when using this option as non-projection related\n    keywords in the input might cause unexpected behavior.\n\n    Notes\n    -----\n    - The fiducial point for the spherical projection can be set to 'center'\n      to use the mean position of input sky coordinates, or as an\n      `~astropy.coordinates.SkyCoord` object.\n    - Units in all output WCS objects will always be in degrees.\n    - If the coordinate frame differs between `~astropy.coordinates.SkyCoord`\n      objects passed in for ``world_coords`` and ``proj_point``, the frame for\n      ``world_coords``  will override as the frame for the output WCS.\n    - If a WCS object is passed in to ``projection`` the CD/PC matrix will\n      be used as an initial guess for the fit. If this is known to be\n      significantly off and may throw off the fit, set to the identity matrix\n      (for example, by doing wcs.wcs.pc = [(1., 0.,), (0., 1.)])\n\n    Parameters\n    ----------\n    xy : (`numpy.ndarray`, `numpy.ndarray`) tuple\n        x & y pixel coordinates.\n    world_coords : `~astropy.coordinates.SkyCoord`\n        Skycoord object with world coordinates.\n    proj_point : 'center' or ~astropy.coordinates.SkyCoord`\n        Defaults to 'center', in which the geometric center of input world\n        coordinates will be used as the projection point. To specify an exact\n        point for the projection, a Skycoord object with a coordinate pair can\n        be passed in. For consistency, the units and frame of these coordinates\n        will be transformed to match ``world_coords`` if they don't.\n    projection : str or `~astropy.wcs.WCS`\n        Three letter projection code, of any of standard projections defined\n        in the FITS WCS standard. Optionally, a WCS object with projection\n        keywords set may be passed in.\n    sip_degree : None or int\n        If set to a non-zero integer value, will fit SIP of degree\n        ``sip_degree`` to model geometric distortion. Defaults to None, meaning\n        no distortion corrections will be fit.\n\n    Returns\n    -------\n    wcs : `~astropy.wcs.WCS`\n        The best-fit WCS to the points given.\n    \"\"\"\n\n    from scipy.optimize import least_squares\n\n    import astropy.units as u\n    from astropy.coordinates import SkyCoord  # here to avoid circular import\n\n    from .wcs import Sip\n\n    xp, yp = xy\n    try:\n        lon, lat = world_coords.data.lon.deg, world_coords.data.lat.deg\n    except AttributeError:\n        unit_sph =  world_coords.unit_spherical\n        lon, lat = unit_sph.lon.deg, unit_sph.lat.deg\n\n    # verify input\n    if (type(proj_point) != type(world_coords)) and (proj_point != 'center'):\n        raise ValueError(\"proj_point must be set to 'center', or an\" +\n                         \"`~astropy.coordinates.SkyCoord` object with \" +\n                         \"a pair of points.\")\n\n    use_center_as_proj_point = (str(proj_point) == 'center')\n\n    if not use_center_as_proj_point:\n        assert proj_point.size == 1\n\n    proj_codes = [\n        'AZP', 'SZP', 'TAN', 'STG', 'SIN', 'ARC', 'ZEA', 'AIR', 'CYP',\n        'CEA', 'CAR', 'MER', 'SFL', 'PAR', 'MOL', 'AIT', 'COP', 'COE',\n        'COD', 'COO', 'BON', 'PCO', 'TSC', 'CSC', 'QSC', 'HPX', 'XPH'\n    ]\n    if type(projection) == str:\n        if projection not in proj_codes:\n            raise ValueError(\"Must specify valid projection code from list of \"\n                             + \"supported types: \", ', '.join(proj_codes))\n        # empty wcs to fill in with fit values\n        wcs = celestial_frame_to_wcs(frame=world_coords.frame,\n                                     projection=projection)\n    else: #if projection is not string, should be wcs object. use as template.\n        wcs = copy.deepcopy(projection)\n        wcs.cdelt = (1., 1.) # make sure cdelt is 1\n        wcs.sip = None\n\n    # Change PC to CD, since cdelt will be set to 1\n    if wcs.wcs.has_pc():\n        wcs.wcs.cd = wcs.wcs.pc\n        wcs.wcs.__delattr__('pc')\n\n    if (type(sip_degree) != type(None)) and (type(sip_degree) != int):\n        raise ValueError(\"sip_degree must be None, or integer.\")\n\n    # compute bounding box for sources in image coordinates:\n    xpmin, xpmax, ypmin, ypmax = xp.min(), xp.max(), yp.min(), yp.max()\n\n    # set pixel_shape to span of input points\n    wcs.pixel_shape = (1 if xpmax <= 0.0 else int(np.ceil(xpmax)),\n                       1 if ypmax <= 0.0 else int(np.ceil(ypmax)))\n\n    # determine CRVAL from input\n    close = lambda l, p: p[np.argmin(np.abs(l))]\n    if use_center_as_proj_point:  # use center of input points\n        sc1 = SkyCoord(lon.min()*u.deg, lat.max()*u.deg)\n        sc2 = SkyCoord(lon.max()*u.deg, lat.min()*u.deg)\n        pa = sc1.position_angle(sc2)\n        sep = sc1.separation(sc2)\n        midpoint_sc = sc1.directional_offset_by(pa, sep/2)\n        wcs.wcs.crval = ((midpoint_sc.data.lon.deg, midpoint_sc.data.lat.deg))\n        wcs.wcs.crpix = ((xpmax + xpmin) / 2., (ypmax + ypmin) / 2.)\n    else:  # convert units, initial guess for crpix\n        proj_point.transform_to(world_coords)\n        wcs.wcs.crval = (proj_point.data.lon.deg, proj_point.data.lat.deg)\n        wcs.wcs.crpix = (close(lon - wcs.wcs.crval[0], xp + 1),\n                         close(lon - wcs.wcs.crval[1], yp + 1))\n\n    # fit linear terms, assign to wcs\n    # use (1, 0, 0, 1) as initial guess, in case input wcs was passed in\n    # and cd terms are way off.\n    # Use bounds to require that the fit center pixel is on the input image\n    if xpmin == xpmax:\n        xpmin, xpmax = xpmin - 0.5, xpmax + 0.5\n    if ypmin == ypmax:\n        ypmin, ypmax = ypmin - 0.5, ypmax + 0.5\n\n    p0 = np.concatenate([wcs.wcs.cd.flatten(), wcs.wcs.crpix.flatten()])\n    fit = least_squares(\n        _linear_wcs_fit, p0,\n        args=(lon, lat, xp, yp, wcs),\n        bounds=[[-np.inf, -np.inf, -np.inf, -np.inf, xpmin + 1, ypmin + 1],\n                [np.inf, np.inf, np.inf, np.inf, xpmax + 1, ypmax + 1]]\n    )\n    wcs.wcs.crpix = np.array(fit.x[4:6])\n    wcs.wcs.cd = np.array(fit.x[0:4].reshape((2, 2)))\n\n    # fit SIP, if specified. Only fit forward coefficients\n    if sip_degree:\n        degree = sip_degree\n        if '-SIP' not in wcs.wcs.ctype[0]:\n            wcs.wcs.ctype = [x + '-SIP' for x in wcs.wcs.ctype]\n\n        coef_names = [f'{i}_{j}' for i in range(degree+1)\n                      for j in range(degree+1) if (i+j) < (degree+1) and\n                      (i+j) > 1]\n        p0 = np.concatenate((np.array(wcs.wcs.crpix), wcs.wcs.cd.flatten(),\n                             np.zeros(2*len(coef_names))))\n\n        fit = least_squares(\n            _sip_fit, p0,\n            args=(lon, lat, xp, yp, wcs, degree, coef_names),\n            bounds=[[xpmin + 1, ypmin + 1] + [-np.inf]*(4 + 2*len(coef_names)),\n                    [xpmax + 1, ypmax + 1] + [np.inf]*(4 + 2*len(coef_names))]\n        )\n        coef_fit = (list(fit.x[6:6+len(coef_names)]),\n                    list(fit.x[6+len(coef_names):]))\n\n        # put fit values in wcs\n        wcs.wcs.cd = fit.x[2:6].reshape((2, 2))\n        wcs.wcs.crpix = fit.x[0:2]\n\n        a_vals = np.zeros((degree+1, degree+1))\n        b_vals = np.zeros((degree+1, degree+1))\n\n        for coef_name in coef_names:\n            a_vals[int(coef_name[0])][int(coef_name[2])] = coef_fit[0].pop(0)\n            b_vals[int(coef_name[0])][int(coef_name[2])] = coef_fit[1].pop(0)\n\n        wcs.sip = Sip(a_vals, b_vals, np.zeros((degree+1, degree+1)),\n                      np.zeros((degree+1, degree+1)), wcs.wcs.crpix)\n\n    return wcs\n\n\ndef obsgeo_to_frame(obsgeo, obstime):\n    \"\"\"\n    Convert a WCS obsgeo property into an `~.builtin_frames.ITRS` coordinate frame.\n\n    Parameters\n    ----------\n    obsgeo : array-like\n        A shape ``(6, )`` array representing ``OBSGEO-[XYZ], OBSGEO-[BLH]`` as\n        returned by ``WCS.wcs.obsgeo``.\n\n    obstime : time-like\n        The time associated with the coordinate, will be passed to\n        `~.builtin_frames.ITRS` as the obstime keyword.\n\n    Returns\n    -------\n    `~.builtin_frames.ITRS`\n        An `~.builtin_frames.ITRS` coordinate frame\n        representing the coordinates.\n\n    Notes\n    -----\n\n    The obsgeo array as accessed on a `.WCS` object is a length 6 numpy array\n    where the first three elements are the coordinate in a cartesian\n    representation and the second 3 are the coordinate in a spherical\n    representation.\n\n    This function priorities reading the cartesian coordinates, and will only\n    read the spherical coordinates if the cartesian coordinates are either all\n    zero or any of the cartesian coordinates are non-finite.\n\n    In the case where both the spherical and cartesian coordinates have some\n    non-finite values the spherical coordinates will be returned with the\n    non-finite values included.\n\n    \"\"\"\n    if (obsgeo is None\n        or len(obsgeo) != 6\n        or np.all(np.array(obsgeo) == 0)\n        or np.all(~np.isfinite(obsgeo))\n    ):\n        raise ValueError(f\"Can not parse the 'obsgeo' location ({obsgeo}). \"\n                         \"obsgeo should be a length 6 non-zero, finite numpy array\")\n\n    # If the cartesian coords are zero or have NaNs in them use the spherical ones\n    if np.all(obsgeo[:3] == 0) or np.any(~np.isfinite(obsgeo[:3])):\n        data = SphericalRepresentation(*(obsgeo[3:] * (u.deg, u.deg, u.m)))\n\n    # Otherwise we assume the cartesian ones are valid\n    else:\n        data = CartesianRepresentation(*obsgeo[:3] * u.m)\n\n    return ITRS(data, obstime=obstime)\n"},{"className":"CartesianRepresentation","col":0,"comment":"\n    Representation of points in 3D cartesian coordinates.\n\n    Parameters\n    ----------\n    x, y, z : `~astropy.units.Quantity` or array\n        The x, y, and z coordinates of the point(s). If ``x``, ``y``, and ``z``\n        have different shapes, they should be broadcastable. If not quantity,\n        ``unit`` should be set.  If only ``x`` is given, it is assumed that it\n        contains an array with the 3 coordinates stored along ``xyz_axis``.\n    unit : unit-like\n        If given, the coordinates will be converted to this unit (or taken to\n        be in this unit if not given.\n    xyz_axis : int, optional\n        The axis along which the coordinates are stored when a single array is\n        provided rather than distinct ``x``, ``y``, and ``z`` (default: 0).\n\n    differentials : dict, `CartesianDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single\n        `CartesianDifferential` instance, or a dictionary of\n        `CartesianDifferential` s with keys set to a string representation of\n        the SI unit with which the differential (derivative) is taken. For\n        example, for a velocity differential on a positional representation, the\n        key would be ``'s'`` for seconds, indicating that the derivative is a\n        time derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    ","endLoc":1515,"id":7459,"nodeType":"Class","startLoc":1225,"text":"class CartesianRepresentation(BaseRepresentation):\n    \"\"\"\n    Representation of points in 3D cartesian coordinates.\n\n    Parameters\n    ----------\n    x, y, z : `~astropy.units.Quantity` or array\n        The x, y, and z coordinates of the point(s). If ``x``, ``y``, and ``z``\n        have different shapes, they should be broadcastable. If not quantity,\n        ``unit`` should be set.  If only ``x`` is given, it is assumed that it\n        contains an array with the 3 coordinates stored along ``xyz_axis``.\n    unit : unit-like\n        If given, the coordinates will be converted to this unit (or taken to\n        be in this unit if not given.\n    xyz_axis : int, optional\n        The axis along which the coordinates are stored when a single array is\n        provided rather than distinct ``x``, ``y``, and ``z`` (default: 0).\n\n    differentials : dict, `CartesianDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single\n        `CartesianDifferential` instance, or a dictionary of\n        `CartesianDifferential` s with keys set to a string representation of\n        the SI unit with which the differential (derivative) is taken. For\n        example, for a velocity differential on a positional representation, the\n        key would be ``'s'`` for seconds, indicating that the derivative is a\n        time derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n\n    attr_classes = {'x': u.Quantity,\n                    'y': u.Quantity,\n                    'z': u.Quantity}\n\n    _xyz = None\n\n    def __init__(self, x, y=None, z=None, unit=None, xyz_axis=None,\n                 differentials=None, copy=True):\n\n        if y is None and z is None:\n            if isinstance(x, np.ndarray) and x.dtype.kind not in 'OV':\n                # Short-cut for 3-D array input.\n                x = u.Quantity(x, unit, copy=copy, subok=True)\n                # Keep a link to the array with all three coordinates\n                # so that we can return it quickly if needed in get_xyz.\n                self._xyz = x\n                if xyz_axis:\n                    x = np.moveaxis(x, xyz_axis, 0)\n                    self._xyz_axis = xyz_axis\n                else:\n                    self._xyz_axis = 0\n\n                self._x, self._y, self._z = x\n                self._differentials = self._validate_differentials(differentials)\n                return\n\n            elif (isinstance(x, CartesianRepresentation)\n                  and unit is None and xyz_axis is None):\n                if differentials is None:\n                    differentials = x._differentials\n\n                return super().__init__(x, differentials=differentials,\n                                        copy=copy)\n\n            else:\n                x, y, z = x\n\n        if xyz_axis is not None:\n            raise ValueError(\"xyz_axis should only be set if x, y, and z are \"\n                             \"in a single array passed in through x, \"\n                             \"i.e., y and z should not be not given.\")\n\n        if y is None or z is None:\n            raise ValueError(\"x, y, and z are required to instantiate {}\"\n                             .format(self.__class__.__name__))\n\n        if unit is not None:\n            x = u.Quantity(x, unit, copy=copy, subok=True)\n            y = u.Quantity(y, unit, copy=copy, subok=True)\n            z = u.Quantity(z, unit, copy=copy, subok=True)\n            copy = False\n\n        super().__init__(x, y, z, copy=copy, differentials=differentials)\n        if not (self._x.unit.is_equivalent(self._y.unit) and\n                self._x.unit.is_equivalent(self._z.unit)):\n            raise u.UnitsError(\"x, y, and z should have matching physical types\")\n\n    def unit_vectors(self):\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        o = np.broadcast_to(0.*u.one, self.shape, subok=True)\n        return {\n            'x': CartesianRepresentation(l, o, o, copy=False),\n            'y': CartesianRepresentation(o, l, o, copy=False),\n            'z': CartesianRepresentation(o, o, l, copy=False)}\n\n    def scale_factors(self):\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return {'x': l, 'y': l, 'z': l}\n\n    def get_xyz(self, xyz_axis=0):\n        \"\"\"Return a vector array of the x, y, and z coordinates.\n\n        Parameters\n        ----------\n        xyz_axis : int, optional\n            The axis in the final array along which the x, y, z components\n            should be stored (default: 0).\n\n        Returns\n        -------\n        xyz : `~astropy.units.Quantity`\n            With dimension 3 along ``xyz_axis``.  Note that, if possible,\n            this will be a view.\n        \"\"\"\n        if self._xyz is not None:\n            if self._xyz_axis == xyz_axis:\n                return self._xyz\n            else:\n                return np.moveaxis(self._xyz, self._xyz_axis, xyz_axis)\n\n        # Create combined array.  TO DO: keep it in _xyz for repeated use?\n        # But then in-place changes have to cancel it. Likely best to\n        # also update components.\n        return np.stack([self._x, self._y, self._z], axis=xyz_axis)\n\n    xyz = property(get_xyz)\n\n    @classmethod\n    def from_cartesian(cls, other):\n        return other\n\n    def to_cartesian(self):\n        return self\n\n    def transform(self, matrix):\n        \"\"\"\n        Transform the cartesian coordinates using a 3x3 matrix.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : ndarray\n            A 3x3 transformation matrix, such as a rotation matrix.\n\n        Examples\n        --------\n\n        We can start off by creating a cartesian representation object:\n\n            >>> from astropy import units as u\n            >>> from astropy.coordinates import CartesianRepresentation\n            >>> rep = CartesianRepresentation([1, 2] * u.pc,\n            ...                               [2, 3] * u.pc,\n            ...                               [3, 4] * u.pc)\n\n        We now create a rotation matrix around the z axis:\n\n            >>> from astropy.coordinates.matrix_utilities import rotation_matrix\n            >>> rotation = rotation_matrix(30 * u.deg, axis='z')\n\n        Finally, we can apply this transformation:\n\n            >>> rep_new = rep.transform(rotation)\n            >>> rep_new.xyz  # doctest: +FLOAT_CMP\n            <Quantity [[ 1.8660254 , 3.23205081],\n                       [ 1.23205081, 1.59807621],\n                       [ 3.        , 4.        ]] pc>\n        \"\"\"\n        # erfa rxp: Multiply a p-vector by an r-matrix.\n        p = erfa_ufunc.rxp(matrix, self.get_xyz(xyz_axis=-1))\n        # transformed representation\n        rep = self.__class__(p, xyz_axis=-1, copy=False)\n        # Handle differentials attached to this representation\n        new_diffs = dict((k, d.transform(matrix, self, rep))\n                         for k, d in self.differentials.items())\n        return rep.with_differentials(new_diffs)\n\n    def _combine_operation(self, op, other, reverse=False):\n        self._raise_if_has_differentials(op.__name__)\n\n        try:\n            other_c = other.to_cartesian()\n        except Exception:\n            return NotImplemented\n\n        first, second = ((self, other_c) if not reverse else\n                         (other_c, self))\n        return self.__class__(*(op(getattr(first, component),\n                                   getattr(second, component))\n                                for component in first.components))\n\n    def norm(self):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.\n\n        Note that any associated differentials will be dropped during this\n        operation.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\n        # erfa pm: Modulus of p-vector.\n        return erfa_ufunc.pm(self.get_xyz(xyz_axis=-1))\n\n    def mean(self, *args, **kwargs):\n        \"\"\"Vector mean.\n\n        Returns a new CartesianRepresentation instance with the means of the\n        x, y, and z components.\n\n        Refer to `~numpy.mean` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n        \"\"\"\n        self._raise_if_has_differentials('mean')\n        return self._apply('mean', *args, **kwargs)\n\n    def sum(self, *args, **kwargs):\n        \"\"\"Vector sum.\n\n        Returns a new CartesianRepresentation instance with the sums of the\n        x, y, and z components.\n\n        Refer to `~numpy.sum` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n        \"\"\"\n        self._raise_if_has_differentials('sum')\n        return self._apply('sum', *args, **kwargs)\n\n    def dot(self, other):\n        \"\"\"Dot product of two representations.\n\n        Note that any associated differentials will be dropped during this\n        operation.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            If not already cartesian, it is converted.\n\n        Returns\n        -------\n        dot_product : `~astropy.units.Quantity`\n            The sum of the product of the x, y, and z components of ``self``\n            and ``other``.\n        \"\"\"\n        try:\n            other_c = other.to_cartesian()\n        except Exception as err:\n            raise TypeError(\"cannot only take dot product with another \"\n                            \"representation, not a {} instance.\"\n                            .format(type(other))) from err\n        # erfa pdp: p-vector inner (=scalar=dot) product.\n        return erfa_ufunc.pdp(self.get_xyz(xyz_axis=-1),\n                              other_c.get_xyz(xyz_axis=-1))\n\n    def cross(self, other):\n        \"\"\"Cross product of two representations.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            If not already cartesian, it is converted.\n\n        Returns\n        -------\n        cross_product : `~astropy.coordinates.CartesianRepresentation`\n            With vectors perpendicular to both ``self`` and ``other``.\n        \"\"\"\n        self._raise_if_has_differentials('cross')\n        try:\n            other_c = other.to_cartesian()\n        except Exception as err:\n            raise TypeError(\"cannot only take cross product with another \"\n                            \"representation, not a {} instance.\"\n                            .format(type(other))) from err\n        # erfa pxp: p-vector outer (=vector=cross) product.\n        sxo = erfa_ufunc.pxp(self.get_xyz(xyz_axis=-1),\n                             other_c.get_xyz(xyz_axis=-1))\n        return self.__class__(sxo, xyz_axis=-1)"},{"className":"BaseRepresentation","col":0,"comment":"Base for representing a point in a 3D coordinate system.\n\n    Parameters\n    ----------\n    comp1, comp2, comp3 : `~astropy.units.Quantity` or subclass\n        The components of the 3D points.  The names are the keys and the\n        subclasses the values of the ``attr_classes`` attribute.\n    differentials : dict, `~astropy.coordinates.BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `~astropy.coordinates.BaseDifferential`\n        subclass instance, or a dictionary with keys set to a string\n        representation of the SI unit with which the differential (derivative)\n        is taken. For example, for a velocity differential on a positional\n        representation, the key would be ``'s'`` for seconds, indicating that\n        the derivative is a time derivative.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n\n    Notes\n    -----\n    All representation classes should subclass this base representation class,\n    and define an ``attr_classes`` attribute, a `dict`\n    which maps component names to the class that creates them. They must also\n    define a ``to_cartesian`` method and a ``from_cartesian`` class method. By\n    default, transformations are done via the cartesian system, but classes\n    that want to define a smarter transformation path can overload the\n    ``represent_as`` method. If one wants to use an associated differential\n    class, one should also define ``unit_vectors`` and ``scale_factors``\n    methods (see those methods for details).\n    ","endLoc":1222,"id":7460,"nodeType":"Class","startLoc":578,"text":"class BaseRepresentation(BaseRepresentationOrDifferential):\n    \"\"\"Base for representing a point in a 3D coordinate system.\n\n    Parameters\n    ----------\n    comp1, comp2, comp3 : `~astropy.units.Quantity` or subclass\n        The components of the 3D points.  The names are the keys and the\n        subclasses the values of the ``attr_classes`` attribute.\n    differentials : dict, `~astropy.coordinates.BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `~astropy.coordinates.BaseDifferential`\n        subclass instance, or a dictionary with keys set to a string\n        representation of the SI unit with which the differential (derivative)\n        is taken. For example, for a velocity differential on a positional\n        representation, the key would be ``'s'`` for seconds, indicating that\n        the derivative is a time derivative.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n\n    Notes\n    -----\n    All representation classes should subclass this base representation class,\n    and define an ``attr_classes`` attribute, a `dict`\n    which maps component names to the class that creates them. They must also\n    define a ``to_cartesian`` method and a ``from_cartesian`` class method. By\n    default, transformations are done via the cartesian system, but classes\n    that want to define a smarter transformation path can overload the\n    ``represent_as`` method. If one wants to use an associated differential\n    class, one should also define ``unit_vectors`` and ``scale_factors``\n    methods (see those methods for details).\n    \"\"\"\n\n    info = RepresentationInfo()\n\n    def __init_subclass__(cls, **kwargs):\n        # Register representation name (except for BaseRepresentation)\n        if cls.__name__ == 'BaseRepresentation':\n            return\n\n        if not hasattr(cls, 'attr_classes'):\n            raise NotImplementedError('Representations must have an '\n                                      '\"attr_classes\" class attribute.')\n\n        repr_name = cls.get_name()\n        # first time a duplicate is added\n        # remove first entry and add both using their qualnames\n        if repr_name in REPRESENTATION_CLASSES:\n            DUPLICATE_REPRESENTATIONS.add(repr_name)\n\n            fqn_cls = _fqn_class(cls)\n            existing = REPRESENTATION_CLASSES[repr_name]\n            fqn_existing = _fqn_class(existing)\n\n            if fqn_cls == fqn_existing:\n                raise ValueError(f'Representation \"{fqn_cls}\" already defined')\n\n            msg = (\n                f'Representation \"{repr_name}\" already defined, removing it to avoid confusion.'\n                f'Use qualnames \"{fqn_cls}\" and \"{fqn_existing}\" or class instances directly'\n            )\n            warnings.warn(msg, DuplicateRepresentationWarning)\n\n            del REPRESENTATION_CLASSES[repr_name]\n            REPRESENTATION_CLASSES[fqn_existing] = existing\n            repr_name = fqn_cls\n\n        # further definitions with the same name, just add qualname\n        elif repr_name in DUPLICATE_REPRESENTATIONS:\n            fqn_cls = _fqn_class(cls)\n            warnings.warn(f'Representation \"{repr_name}\" already defined, using qualname '\n                          f'\"{fqn_cls}\".')\n            repr_name = fqn_cls\n            if repr_name in REPRESENTATION_CLASSES:\n                raise ValueError(\n                    f'Representation \"{repr_name}\" already defined'\n                )\n\n        REPRESENTATION_CLASSES[repr_name] = cls\n        _invalidate_reprdiff_cls_hash()\n\n        # define getters for any component that does not yet have one.\n        for component in cls.attr_classes:\n            if not hasattr(cls, component):\n                setattr(cls, component,\n                        property(_make_getter(component),\n                                 doc=f\"The '{component}' component of the points(s).\"))\n\n        super().__init_subclass__(**kwargs)\n\n    def __init__(self, *args, differentials=None, **kwargs):\n        # Handle any differentials passed in.\n        super().__init__(*args, **kwargs)\n        if (differentials is None\n                and args and isinstance(args[0], self.__class__)):\n            differentials = args[0]._differentials\n        self._differentials = self._validate_differentials(differentials)\n\n    def _validate_differentials(self, differentials):\n        \"\"\"\n        Validate that the provided differentials are appropriate for this\n        representation and recast/reshape as necessary and then return.\n\n        Note that this does *not* set the differentials on\n        ``self._differentials``, but rather leaves that for the caller.\n        \"\"\"\n\n        # Now handle the actual validation of any specified differential classes\n        if differentials is None:\n            differentials = dict()\n\n        elif isinstance(differentials, BaseDifferential):\n            # We can't handle auto-determining the key for this combo\n            if (isinstance(differentials, RadialDifferential) and\n                    isinstance(self, UnitSphericalRepresentation)):\n                raise ValueError(\"To attach a RadialDifferential to a \"\n                                 \"UnitSphericalRepresentation, you must supply \"\n                                 \"a dictionary with an appropriate key.\")\n\n            key = differentials._get_deriv_key(self)\n            differentials = {key: differentials}\n\n        for key in differentials:\n            try:\n                diff = differentials[key]\n            except TypeError as err:\n                raise TypeError(\"'differentials' argument must be a \"\n                                \"dictionary-like object\") from err\n\n            diff._check_base(self)\n\n            if (isinstance(diff, RadialDifferential) and\n                    isinstance(self, UnitSphericalRepresentation)):\n                # We trust the passing of a key for a RadialDifferential\n                # attached to a UnitSphericalRepresentation because it will not\n                # have a paired component name (UnitSphericalRepresentation has\n                # no .distance) to automatically determine the expected key\n                pass\n\n            else:\n                expected_key = diff._get_deriv_key(self)\n                if key != expected_key:\n                    raise ValueError(\"For differential object '{}', expected \"\n                                     \"unit key = '{}' but received key = '{}'\"\n                                     .format(repr(diff), expected_key, key))\n\n            # For now, we are very rigid: differentials must have the same shape\n            # as the representation. This makes it easier to handle __getitem__\n            # and any other shape-changing operations on representations that\n            # have associated differentials\n            if diff.shape != self.shape:\n                # TODO: message of IncompatibleShapeError is not customizable,\n                #       so use a valueerror instead?\n                raise ValueError(\"Shape of differentials must be the same \"\n                                 \"as the shape of the representation ({} vs \"\n                                 \"{})\".format(diff.shape, self.shape))\n\n        return differentials\n\n    def _raise_if_has_differentials(self, op_name):\n        \"\"\"\n        Used to raise a consistent exception for any operation that is not\n        supported when a representation has differentials attached.\n        \"\"\"\n        if self.differentials:\n            raise TypeError(\"Operation '{}' is not supported when \"\n                            \"differentials are attached to a {}.\"\n                            .format(op_name, self.__class__.__name__))\n\n    @classproperty\n    def _compatible_differentials(cls):\n        return [DIFFERENTIAL_CLASSES[cls.get_name()]]\n\n    @property\n    def differentials(self):\n        \"\"\"A dictionary of differential class instances.\n\n        The keys of this dictionary must be a string representation of the SI\n        unit with which the differential (derivative) is taken. For example, for\n        a velocity differential on a positional representation, the key would be\n        ``'s'`` for seconds, indicating that the derivative is a time\n        derivative.\n        \"\"\"\n        return self._differentials\n\n    # We do not make unit_vectors and scale_factors abstract methods, since\n    # they are only necessary if one also defines an associated Differential.\n    # Also, doing so would break pre-differential representation subclasses.\n    def unit_vectors(self):\n        r\"\"\"Cartesian unit vectors in the direction of each component.\n\n        Given unit vectors :math:`\\hat{e}_c` and scale factors :math:`f_c`,\n        a change in one component of :math:`\\delta c` corresponds to a change\n        in representation of :math:`\\delta c \\times f_c \\times \\hat{e}_c`.\n\n        Returns\n        -------\n        unit_vectors : dict of `CartesianRepresentation`\n            The keys are the component names.\n        \"\"\"\n        raise NotImplementedError(f\"{type(self)} has not implemented unit vectors\")\n\n    def scale_factors(self):\n        r\"\"\"Scale factors for each component's direction.\n\n        Given unit vectors :math:`\\hat{e}_c` and scale factors :math:`f_c`,\n        a change in one component of :math:`\\delta c` corresponds to a change\n        in representation of :math:`\\delta c \\times f_c \\times \\hat{e}_c`.\n\n        Returns\n        -------\n        scale_factors : dict of `~astropy.units.Quantity`\n            The keys are the component names.\n        \"\"\"\n        raise NotImplementedError(f\"{type(self)} has not implemented scale factors.\")\n\n    def _re_represent_differentials(self, new_rep, differential_class):\n        \"\"\"Re-represent the differentials to the specified classes.\n\n        This returns a new dictionary with the same keys but with the\n        attached differentials converted to the new differential classes.\n        \"\"\"\n        if differential_class is None:\n            return dict()\n\n        if not self.differentials and differential_class:\n            raise ValueError(\"No differentials associated with this \"\n                             \"representation!\")\n\n        elif (len(self.differentials) == 1 and\n                inspect.isclass(differential_class) and\n                issubclass(differential_class, BaseDifferential)):\n            # TODO: is there a better way to do this?\n            differential_class = {\n                list(self.differentials.keys())[0]: differential_class\n            }\n\n        elif differential_class.keys() != self.differentials.keys():\n            raise ValueError(\"Desired differential classes must be passed in \"\n                             \"as a dictionary with keys equal to a string \"\n                             \"representation of the unit of the derivative \"\n                             \"for each differential stored with this \"\n                             \"representation object ({0})\"\n                             .format(self.differentials))\n\n        new_diffs = dict()\n        for k in self.differentials:\n            diff = self.differentials[k]\n            try:\n                new_diffs[k] = diff.represent_as(differential_class[k],\n                                                 base=self)\n            except Exception as err:\n                if (differential_class[k] not in\n                        new_rep._compatible_differentials):\n                    raise TypeError(\"Desired differential class {} is not \"\n                                    \"compatible with the desired \"\n                                    \"representation class {}\"\n                                    .format(differential_class[k],\n                                            new_rep.__class__)) from err\n                else:\n                    raise\n\n        return new_diffs\n\n    def represent_as(self, other_class, differential_class=None):\n        \"\"\"Convert coordinates to another representation.\n\n        If the instance is of the requested class, it is returned unmodified.\n        By default, conversion is done via Cartesian coordinates.\n        Also note that orientation information at the origin is *not* preserved by\n        conversions through Cartesian coordinates. See the docstring for\n        :meth:`~astropy.coordinates.BaseRepresentationOrDifferential.to_cartesian`\n        for an example.\n\n        Parameters\n        ----------\n        other_class : `~astropy.coordinates.BaseRepresentation` subclass\n            The type of representation to turn the coordinates into.\n        differential_class : dict of `~astropy.coordinates.BaseDifferential`, optional\n            Classes in which the differentials should be represented.\n            Can be a single class if only a single differential is attached,\n            otherwise it should be a `dict` keyed by the same keys as the\n            differentials.\n        \"\"\"\n        if other_class is self.__class__ and not differential_class:\n            return self.without_differentials()\n\n        else:\n            if isinstance(other_class, str):\n                raise ValueError(\"Input to a representation's represent_as \"\n                                 \"must be a class, not a string. For \"\n                                 \"strings, use frame objects\")\n\n            if other_class is not self.__class__:\n                # The default is to convert via cartesian coordinates\n                new_rep = other_class.from_cartesian(self.to_cartesian())\n            else:\n                new_rep = self\n\n            new_rep._differentials = self._re_represent_differentials(\n                new_rep, differential_class)\n\n            return new_rep\n\n    def transform(self, matrix):\n        \"\"\"Transform coordinates using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n\n        \"\"\"\n        # route transformation through Cartesian\n        difs_cls = {k: CartesianDifferential for k in self.differentials.keys()}\n        crep = self.represent_as(CartesianRepresentation,\n                                 differential_class=difs_cls\n                                ).transform(matrix)\n\n        # move back to original representation\n        difs_cls = {k: diff.__class__ for k, diff in self.differentials.items()}\n        rep = crep.represent_as(self.__class__, difs_cls)\n        return rep\n\n    def with_differentials(self, differentials):\n        \"\"\"\n        Create a new representation with the same positions as this\n        representation, but with these new differentials.\n\n        Differential keys that already exist in this object's differential dict\n        are overwritten.\n\n        Parameters\n        ----------\n        differentials : sequence of `~astropy.coordinates.BaseDifferential` subclass instance\n            The differentials for the new representation to have.\n\n        Returns\n        -------\n        `~astropy.coordinates.BaseRepresentation` subclass instance\n            A copy of this representation, but with the ``differentials`` as\n            its differentials.\n        \"\"\"\n        if not differentials:\n            return self\n\n        args = [getattr(self, component) for component in self.components]\n\n        # We shallow copy the differentials dictionary so we don't update the\n        # current object's dictionary when adding new keys\n        new_rep = self.__class__(*args, differentials=self.differentials.copy(),\n                                 copy=False)\n        new_rep._differentials.update(\n            new_rep._validate_differentials(differentials))\n\n        return new_rep\n\n    def without_differentials(self):\n        \"\"\"Return a copy of the representation without attached differentials.\n\n        Returns\n        -------\n        `~astropy.coordinates.BaseRepresentation` subclass instance\n            A shallow copy of this representation, without any differentials.\n            If no differentials were present, no copy is made.\n        \"\"\"\n\n        if not self._differentials:\n            return self\n\n        args = [getattr(self, component) for component in self.components]\n        return self.__class__(*args, copy=False)\n\n    @classmethod\n    def from_representation(cls, representation):\n        \"\"\"Create a new instance of this representation from another one.\n\n        Parameters\n        ----------\n        representation : `~astropy.coordinates.BaseRepresentation` instance\n            The presentation that should be converted to this class.\n        \"\"\"\n        return representation.represent_as(cls)\n\n    def __eq__(self, value):\n        \"\"\"Equality operator for BaseRepresentation\n\n        This implements strict equality and requires that the representation\n        classes are identical, the differentials are identical, and that the\n        representation data are exactly equal.\n        \"\"\"\n        # BaseRepresentationOrDifferental (checks classes and compares components)\n        out = super().__eq__(value)\n\n        # super() checks that the class is identical so can this even happen?\n        # (same class, different differentials ?)\n        if self._differentials.keys() != value._differentials.keys():\n            raise ValueError(f'cannot compare: objects must have same differentials')\n\n        for self_diff, value_diff in zip(self._differentials.values(),\n                                         value._differentials.values()):\n            out &= (self_diff == value_diff)\n\n        return out\n\n    def __ne__(self, value):\n        return np.logical_not(self == value)\n\n    def _apply(self, method, *args, **kwargs):\n        \"\"\"Create a new representation with ``method`` applied to the component\n        data.\n\n        This is not a simple inherit from ``BaseRepresentationOrDifferential``\n        because we need to call ``._apply()`` on any associated differential\n        classes.\n\n        See docstring for `BaseRepresentationOrDifferential._apply`.\n\n        Parameters\n        ----------\n        method : str or callable\n            If str, it is the name of a method that is applied to the internal\n            ``components``. If callable, the function is applied.\n        *args : tuple\n            Any positional arguments for ``method``.\n        **kwargs : dict\n            Any keyword arguments for ``method``.\n\n        \"\"\"\n        rep = super()._apply(method, *args, **kwargs)\n\n        rep._differentials = dict(\n            [(k, diff._apply(method, *args, **kwargs))\n             for k, diff in self._differentials.items()])\n        return rep\n\n    def __setitem__(self, item, value):\n        if not isinstance(value, BaseRepresentation):\n            raise TypeError(f'value must be a representation instance, '\n                            f'not {type(value)}.')\n\n        if not (isinstance(value, self.__class__)\n                or len(value.attr_classes) == len(self.attr_classes)):\n            raise ValueError(\n                f'value must be representable as {self.__class__.__name__} '\n                f'without loss of information.')\n\n        diff_classes = {}\n        if self._differentials:\n            if self._differentials.keys() != value._differentials.keys():\n                raise ValueError('value must have the same differentials.')\n\n            for key, self_diff in self._differentials.items():\n                diff_classes[key] = self_diff_cls = self_diff.__class__\n                value_diff_cls = value._differentials[key].__class__\n                if not (isinstance(value_diff_cls, self_diff_cls)\n                        or (len(value_diff_cls.attr_classes)\n                            == len(self_diff_cls.attr_classes))):\n                    raise ValueError(\n                        f'value differential {key!r} must be representable as '\n                        f'{self_diff.__class__.__name__} without loss of information.')\n\n        value = value.represent_as(self.__class__, diff_classes)\n        super().__setitem__(item, value)\n        for key, differential in self._differentials.items():\n            differential[item] = value._differentials[key]\n\n    def _scale_operation(self, op, *args):\n        \"\"\"Scale all non-angular components, leaving angular ones unchanged.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.mul`, `~operator.neg`, etc.\n        *args\n            Any arguments required for the operator (typically, what is to\n            be multiplied with, divided by).\n        \"\"\"\n        results = []\n        for component, cls in self.attr_classes.items():\n            value = getattr(self, component)\n            if issubclass(cls, Angle):\n                results.append(value)\n            else:\n                results.append(op(value, *args))\n\n        # try/except catches anything that cannot initialize the class, such\n        # as operations that returned NotImplemented or a representation\n        # instead of a quantity (as would happen for, e.g., rep * rep).\n        try:\n            result = self.__class__(*results)\n        except Exception:\n            return NotImplemented\n\n        for key, differential in self.differentials.items():\n            diff_result = differential._scale_operation(op, *args, scaled_base=True)\n            result.differentials[key] = diff_result\n\n        return result\n\n    def _combine_operation(self, op, other, reverse=False):\n        \"\"\"Combine two representation.\n\n        By default, operate on the cartesian representations of both.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.add`, `~operator.sub`, etc.\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The other representation.\n        reverse : bool\n            Whether the operands should be reversed (e.g., as we got here via\n            ``self.__rsub__`` because ``self`` is a subclass of ``other``).\n        \"\"\"\n        self._raise_if_has_differentials(op.__name__)\n\n        result = self.to_cartesian()._combine_operation(op, other, reverse)\n        if result is NotImplemented:\n            return NotImplemented\n        else:\n            return self.from_cartesian(result)\n\n    # We need to override this setter to support differentials\n    @BaseRepresentationOrDifferential.shape.setter\n    def shape(self, shape):\n        orig_shape = self.shape\n\n        # See: https://stackoverflow.com/questions/3336767/ for an example\n        BaseRepresentationOrDifferential.shape.fset(self, shape)\n\n        # also try to perform shape-setting on any associated differentials\n        try:\n            for k in self.differentials:\n                self.differentials[k].shape = shape\n        except Exception:\n            BaseRepresentationOrDifferential.shape.fset(self, orig_shape)\n            for k in self.differentials:\n                self.differentials[k].shape = orig_shape\n\n            raise\n\n    def norm(self):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.\n\n        Note that any associated differentials will be dropped during this\n        operation.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\n        return np.sqrt(functools.reduce(\n            operator.add, (getattr(self, component)**2\n                           for component, cls in self.attr_classes.items()\n                           if not issubclass(cls, Angle))))\n\n    def mean(self, *args, **kwargs):\n        \"\"\"Vector mean.\n\n        Averaging is done by converting the representation to cartesian, and\n        taking the mean of the x, y, and z components. The result is converted\n        back to the same representation as the input.\n\n        Refer to `~numpy.mean` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n\n        Returns\n        -------\n        mean : `~astropy.coordinates.BaseRepresentation` subclass instance\n            Vector mean, in the same representation as that of the input.\n        \"\"\"\n        self._raise_if_has_differentials('mean')\n        return self.from_cartesian(self.to_cartesian().mean(*args, **kwargs))\n\n    def sum(self, *args, **kwargs):\n        \"\"\"Vector sum.\n\n        Adding is done by converting the representation to cartesian, and\n        summing the x, y, and z components. The result is converted back to the\n        same representation as the input.\n\n        Refer to `~numpy.sum` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n\n        Returns\n        -------\n        sum : `~astropy.coordinates.BaseRepresentation` subclass instance\n            Vector sum, in the same representation as that of the input.\n        \"\"\"\n        self._raise_if_has_differentials('sum')\n        return self.from_cartesian(self.to_cartesian().sum(*args, **kwargs))\n\n    def dot(self, other):\n        \"\"\"Dot product of two representations.\n\n        The calculation is done by converting both ``self`` and ``other``\n        to `~astropy.coordinates.CartesianRepresentation`.\n\n        Note that any associated differentials will be dropped during this\n        operation.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation`\n            The representation to take the dot product with.\n\n        Returns\n        -------\n        dot_product : `~astropy.units.Quantity`\n            The sum of the product of the x, y, and z components of the\n            cartesian representations of ``self`` and ``other``.\n        \"\"\"\n        return self.to_cartesian().dot(other)\n\n    def cross(self, other):\n        \"\"\"Vector cross product of two representations.\n\n        The calculation is done by converting both ``self`` and ``other``\n        to `~astropy.coordinates.CartesianRepresentation`, and converting the\n        result back to the type of representation of ``self``.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The representation to take the cross product with.\n\n        Returns\n        -------\n        cross_product : `~astropy.coordinates.BaseRepresentation` subclass instance\n            With vectors perpendicular to both ``self`` and ``other``, in the\n            same type of representation as ``self``.\n        \"\"\"\n        self._raise_if_has_differentials('cross')\n        return self.from_cartesian(self.to_cartesian().cross(other))"},{"col":4,"comment":"null","endLoc":666,"header":"def __init_subclass__(cls, **kwargs)","id":7461,"name":"__init_subclass__","nodeType":"Function","startLoc":613,"text":"def __init_subclass__(cls, **kwargs):\n        # Register representation name (except for BaseRepresentation)\n        if cls.__name__ == 'BaseRepresentation':\n            return\n\n        if not hasattr(cls, 'attr_classes'):\n            raise NotImplementedError('Representations must have an '\n                                      '\"attr_classes\" class attribute.')\n\n        repr_name = cls.get_name()\n        # first time a duplicate is added\n        # remove first entry and add both using their qualnames\n        if repr_name in REPRESENTATION_CLASSES:\n            DUPLICATE_REPRESENTATIONS.add(repr_name)\n\n            fqn_cls = _fqn_class(cls)\n            existing = REPRESENTATION_CLASSES[repr_name]\n            fqn_existing = _fqn_class(existing)\n\n            if fqn_cls == fqn_existing:\n                raise ValueError(f'Representation \"{fqn_cls}\" already defined')\n\n            msg = (\n                f'Representation \"{repr_name}\" already defined, removing it to avoid confusion.'\n                f'Use qualnames \"{fqn_cls}\" and \"{fqn_existing}\" or class instances directly'\n            )\n            warnings.warn(msg, DuplicateRepresentationWarning)\n\n            del REPRESENTATION_CLASSES[repr_name]\n            REPRESENTATION_CLASSES[fqn_existing] = existing\n            repr_name = fqn_cls\n\n        # further definitions with the same name, just add qualname\n        elif repr_name in DUPLICATE_REPRESENTATIONS:\n            fqn_cls = _fqn_class(cls)\n            warnings.warn(f'Representation \"{repr_name}\" already defined, using qualname '\n                          f'\"{fqn_cls}\".')\n            repr_name = fqn_cls\n            if repr_name in REPRESENTATION_CLASSES:\n                raise ValueError(\n                    f'Representation \"{repr_name}\" already defined'\n                )\n\n        REPRESENTATION_CLASSES[repr_name] = cls\n        _invalidate_reprdiff_cls_hash()\n\n        # define getters for any component that does not yet have one.\n        for component in cls.attr_classes:\n            if not hasattr(cls, component):\n                setattr(cls, component,\n                        property(_make_getter(component),\n                                 doc=f\"The '{component}' component of the points(s).\"))\n\n        super().__init_subclass__(**kwargs)"},{"attributeType":"null","col":0,"comment":"null","endLoc":2874,"id":7462,"name":"tstop","nodeType":"Attribute","startLoc":2874,"text":"tstop"},{"attributeType":"null","col":0,"comment":"null","endLoc":2882,"id":7463,"name":"telapse","nodeType":"Attribute","startLoc":2882,"text":"telapse"},{"attributeType":"null","col":0,"comment":"null","endLoc":2890,"id":7464,"name":"timeoffs","nodeType":"Attribute","startLoc":2890,"text":"timeoffs"},{"attributeType":"null","col":0,"comment":"null","endLoc":2899,"id":7465,"name":"timsyer","nodeType":"Attribute","startLoc":2899,"text":"timsyer"},{"attributeType":"null","col":0,"comment":"null","endLoc":2907,"id":7466,"name":"timrder","nodeType":"Attribute","startLoc":2907,"text":"timrder"},{"attributeType":"null","col":0,"comment":"null","endLoc":2915,"id":7467,"name":"timedel","nodeType":"Attribute","startLoc":2915,"text":"timedel"},{"attributeType":"null","col":0,"comment":"null","endLoc":2923,"id":7468,"name":"timepixr","nodeType":"Attribute","startLoc":2923,"text":"timepixr"},{"attributeType":"null","col":0,"comment":"null","endLoc":2931,"id":7469,"name":"obsorbit","nodeType":"Attribute","startLoc":2931,"text":"obsorbit"},{"attributeType":"null","col":0,"comment":"null","endLoc":2939,"id":7470,"name":"xposure","nodeType":"Attribute","startLoc":2939,"text":"xposure"},{"col":0,"comment":" Get the fully qualified name of a class ","endLoc":50,"header":"def _fqn_class(cls)","id":7471,"name":"_fqn_class","nodeType":"Function","startLoc":48,"text":"def _fqn_class(cls):\n    ''' Get the fully qualified name of a class '''\n    return cls.__module__ + '.' + cls.__qualname__"},{"attributeType":"null","col":0,"comment":"null","endLoc":2947,"id":7472,"name":"czphs","nodeType":"Attribute","startLoc":2947,"text":"czphs"},{"attributeType":"null","col":0,"comment":"null","endLoc":2953,"id":7473,"name":"cperi","nodeType":"Attribute","startLoc":2953,"text":"cperi"},{"col":0,"comment":"","endLoc":9,"header":"docstrings.py#<anonymous>","id":7474,"name":"<anonymous>","nodeType":"Function","startLoc":9,"text":"__all__ = ['TWO_OR_MORE_ARGS', 'RETURNS', 'ORIGIN', 'RA_DEC_ORDER']\n\na = \"\"\"\n``double array[a_order+1][a_order+1]`` Focal plane transformation\nmatrix.\n\nThe `SIP`_ ``A_i_j`` matrix used for pixel to focal plane\ntransformation.\n\nIts values may be changed in place, but it may not be resized, without\ncreating a new `~astropy.wcs.Sip` object.\n\"\"\"\n\na_order = \"\"\"\n``int`` (read-only) Order of the polynomial (``A_ORDER``).\n\"\"\"\n\nall_pix2world = \"\"\"\nall_pix2world(pixcrd, origin) -> ``double array[ncoord][nelem]``\n\nTransforms pixel coordinates to world coordinates.\n\nDoes the following:\n\n    - Detector to image plane correction (if present)\n\n    - SIP distortion correction (if present)\n\n    - FITS WCS distortion correction (if present)\n\n    - wcslib \"core\" WCS transformation\n\nThe first three (the distortion corrections) are done in parallel.\n\nParameters\n----------\npixcrd : ndarray\n    Array of pixel coordinates as ``double array[ncoord][nelem]``.\n\n{}\n\nReturns\n-------\nworld : ndarray\n    Returns an array of world coordinates as ``double array[ncoord][nelem]``.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nSingularMatrixError\n    Linear transformation matrix is singular.\n\nInconsistentAxisTypesError\n    Inconsistent or unrecognized coordinate axis types.\n\nValueError\n    Invalid parameter value.\n\nValueError\n    Invalid coordinate transformation parameters.\n\nValueError\n    x- and y-coordinate arrays are not the same size.\n\nInvalidTransformError\n    Invalid coordinate transformation.\n\nInvalidTransformError\n    Ill-conditioned coordinate transformation parameters.\n\"\"\".format(ORIGIN())\n\nalt = \"\"\"\n``str`` Character code for alternate coordinate descriptions.\n\nFor example, the ``\"a\"`` in keyword names such as ``CTYPEia``.  This\nis a space character for the primary coordinate description, or one of\nthe 26 upper-case letters, A-Z.\n\"\"\"\n\nap = \"\"\"\n``double array[ap_order+1][ap_order+1]`` Focal plane to pixel\ntransformation matrix.\n\nThe `SIP`_ ``AP_i_j`` matrix used for focal plane to pixel\ntransformation.  Its values may be changed in place, but it may not be\nresized, without creating a new `~astropy.wcs.Sip` object.\n\"\"\"\n\nap_order = \"\"\"\n``int`` (read-only) Order of the polynomial (``AP_ORDER``).\n\"\"\"\n\ncel = \"\"\"\n`~astropy.wcs.Celprm` Information required to transform celestial coordinates.\n\"\"\"\n\nCelprm = \"\"\"\nClass that contains information required to transform celestial coordinates.\nIt consists of certain members that must be set by the user (given) and others\nthat are set by the WCSLIB routines (returned).\nSome of the latter are supplied for informational purposes and others are for\ninternal use only.\n\"\"\"\n\nPrjprm = \"\"\"\nClass that contains information needed to project or deproject native spherical coordinates.\nIt consists of certain members that must be set by the user (given) and others\nthat are set by the WCSLIB routines (returned).\nSome of the latter are supplied for informational purposes and others are for\ninternal use only.\n\"\"\"\n\naux = \"\"\"\n`~astropy.wcs.Auxprm` Auxiliary coordinate system information of a specialist nature.\n\"\"\"\n\nAuxprm = \"\"\"\nClass that contains auxiliary coordinate system information of a specialist\nnature.\n\nThis class can not be constructed directly from Python, but instead is\nreturned from `~astropy.wcs.Wcsprm.aux`.\n\"\"\"\n\naxis_types = \"\"\"\n``int array[naxis]`` An array of four-digit type codes for each axis.\n\n- First digit (i.e. 1000s):\n\n  - 0: Non-specific coordinate type.\n\n  - 1: Stokes coordinate.\n\n  - 2: Celestial coordinate (including ``CUBEFACE``).\n\n  - 3: Spectral coordinate.\n\n- Second digit (i.e. 100s):\n\n  - 0: Linear axis.\n\n  - 1: Quantized axis (``STOKES``, ``CUBEFACE``).\n\n  - 2: Non-linear celestial axis.\n\n  - 3: Non-linear spectral axis.\n\n  - 4: Logarithmic axis.\n\n  - 5: Tabular axis.\n\n- Third digit (i.e. 10s):\n\n  - 0: Group number, e.g. lookup table number\n\n- The fourth digit is used as a qualifier depending on the axis type.\n\n  - For celestial axes:\n\n    - 0: Longitude coordinate.\n\n    - 1: Latitude coordinate.\n\n    - 2: ``CUBEFACE`` number.\n\n  - For lookup tables: the axis number in a multidimensional table.\n\n``CTYPEia`` in ``\"4-3\"`` form with unrecognized algorithm code will\nhave its type set to -1 and generate an error.\n\"\"\"\n\nb = \"\"\"\n``double array[b_order+1][b_order+1]`` Pixel to focal plane\ntransformation matrix.\n\nThe `SIP`_ ``B_i_j`` matrix used for pixel to focal plane\ntransformation.  Its values may be changed in place, but it may not be\nresized, without creating a new `~astropy.wcs.Sip` object.\n\"\"\"\n\nb_order = \"\"\"\n``int`` (read-only) Order of the polynomial (``B_ORDER``).\n\"\"\"\n\nbounds_check = \"\"\"\nbounds_check(pix2world, world2pix)\n\nEnable/disable bounds checking.\n\nParameters\n----------\npix2world : bool, optional\n    When `True`, enable bounds checking for the pixel-to-world (p2x)\n    transformations.  Default is `True`.\n\nworld2pix : bool, optional\n    When `True`, enable bounds checking for the world-to-pixel (s2x)\n    transformations.  Default is `True`.\n\nNotes\n-----\nNote that by default (without calling `bounds_check`) strict bounds\nchecking is enabled.\n\"\"\"\n\nbp = \"\"\"\n``double array[bp_order+1][bp_order+1]`` Focal plane to pixel\ntransformation matrix.\n\nThe `SIP`_ ``BP_i_j`` matrix used for focal plane to pixel\ntransformation.  Its values may be changed in place, but it may not be\nresized, without creating a new `~astropy.wcs.Sip` object.\n\"\"\"\n\nbp_order = \"\"\"\n``int`` (read-only) Order of the polynomial (``BP_ORDER``).\n\"\"\"\n\ncd = \"\"\"\n``double array[naxis][naxis]`` The ``CDi_ja`` linear transformation\nmatrix.\n\nFor historical compatibility, three alternate specifications of the\nlinear transformations are available in wcslib.  The canonical\n``PCi_ja`` with ``CDELTia``, ``CDi_ja``, and the deprecated\n``CROTAia`` keywords.  Although the latter may not formally co-exist\nwith ``PCi_ja``, the approach here is simply to ignore them if given\nin conjunction with ``PCi_ja``.\n\n`~astropy.wcs.Wcsprm.has_pc`, `~astropy.wcs.Wcsprm.has_cd` and\n`~astropy.wcs.Wcsprm.has_crota` can be used to determine which of\nthese alternatives are present in the header.\n\nThese alternate specifications of the linear transformation matrix are\ntranslated immediately to ``PCi_ja`` by `~astropy.wcs.Wcsprm.set` and\nare nowhere visible to the lower-level routines.  In particular,\n`~astropy.wcs.Wcsprm.set` resets `~astropy.wcs.Wcsprm.cdelt` to unity\nif ``CDi_ja`` is present (and no ``PCi_ja``).  If no ``CROTAia`` is\nassociated with the latitude axis, `~astropy.wcs.Wcsprm.set` reverts\nto a unity ``PCi_ja`` matrix.\n\"\"\"\n\ncdelt = \"\"\"\n``double array[naxis]`` Coordinate increments (``CDELTia``) for each\ncoord axis.\n\nIf a ``CDi_ja`` linear transformation matrix is present, a warning is\nraised and `~astropy.wcs.Wcsprm.cdelt` is ignored.  The ``CDi_ja``\nmatrix may be deleted by::\n\n  del wcs.wcs.cd\n\nAn undefined value is represented by NaN.\n\"\"\"\n\ncdfix = \"\"\"\ncdfix()\n\nFix erroneously omitted ``CDi_ja`` keywords.\n\nSets the diagonal element of the ``CDi_ja`` matrix to unity if all\n``CDi_ja`` keywords associated with a given axis were omitted.\nAccording to Paper I, if any ``CDi_ja`` keywords at all are given in a\nFITS header then those not given default to zero.  This results in a\nsingular matrix with an intersecting row and column of zeros.\n\nReturns\n-------\nsuccess : int\n    Returns ``0`` for success; ``-1`` if no change required.\n\"\"\"\n\ncel_offset = \"\"\"\n``boolean`` Is there an offset?\n\nIf `True`, an offset will be applied to ``(x, y)`` to force ``(x, y) =\n(0, 0)`` at the fiducial point, (phi_0, theta_0).  Default is `False`.\n\"\"\"\n\ncelprm_phi0 = r\"\"\"\n`float`, `None`. The native longitude, :math:`\\phi_0`, in degrees of the\nfiducial point, i.e., the point whose celestial coordinates are given in\n''Celprm.ref[0:1]''. If `None` or ``nan``, the initialization routine,\n``celset()``, will set this to a projection-specific default.\n\"\"\"\n\ncelprm_theta0 = r\"\"\"\n`float`, `None`. The native latitude, :math:`\\theta_0`, in degrees of the\nfiducial point, i.e. the point whose celestial coordinates are given in\n``Celprm:ref[0:1]``. If `None` or ``nan``, the initialization routine,\n``celset()``, will set this to a projection-specific default.\n\"\"\"\n\ncelprm_ref = \"\"\"\n``numpy.ndarray`` with 4 elements.\n(Given) The first pair of values should be set to the celestial longitude and\nlatitude of the fiducial point in degrees - typically right ascension and\ndeclination. These are given by the ``CRVALia`` keywords in ``FITS``.\n\n(Given and returned) The second pair of values are the native longitude,\n``phi_p`` (in degrees), and latitude, ``theta_p`` (in degrees), of the\ncelestial pole (the latter is the same as the celestial latitude of the\nnative pole, ``delta_p``) and these are given by the ``FITS`` keywords\n``LONPOLEa`` and ``LATPOLEa`` (or by ``PVi_2a`` and ``PVi_3a`` attached\nto the longitude axis which take precedence if defined).\n\n``LONPOLEa`` defaults to ``phi0`` if the celestial latitude of the fiducial\npoint of the projection is greater than or equal to the native latitude,\notherwise ``phi0 + 180`` (degrees). (This is the condition for the celestial\nlatitude to increase in the same direction as the native latitude at the\nfiducial point.) ``ref[2]`` may be set to `None` or ``numpy.nan``\nor 999.0 to indicate that the correct default should be substituted.\n\n``theta_p``, the native latitude of the celestial pole (or equally the\ncelestial latitude of the native pole, ``delta_p``) is often determined\nuniquely by ``CRVALia`` and ``LONPOLEa`` in which case ``LATPOLEa`` is ignored.\nHowever, in some circumstances there are two valid solutions for ``theta_p``\nand ``LATPOLEa`` is used to choose between them. ``LATPOLEa`` is set in\n``ref[3]`` and the solution closest to this value is used to reset ``ref[3]``.\nIt is therefore legitimate, for example, to set ``ref[3]`` to ``+90.0``\nto choose the more northerly solution - the default if the ``LATPOLEa`` keyword\nis omitted from the ``FITS`` header. For the special case where the fiducial\npoint of the projection is at native latitude zero, its celestial latitude\nis zero, and ``LONPOLEa`` = ``+/- 90.0`` then the celestial latitude of the\nnative pole is not determined by the first three reference values and\n``LATPOLEa`` specifies it completely.\n\nThe returned value, celprm.latpreq, specifies how ``LATPOLEa``\nwas actually used.\"\"\"\n\ncelprm_euler = \"\"\"\n*Read-only* ``numpy.ndarray`` with 5 elements. Euler angles and associated\nintermediaries derived from the coordinate reference values. The first three\nvalues are the ``Z-``, ``X-``, and ``Z``-Euler angles in degrees, and the\nremaining two are the cosine and sine of the ``X``-Euler angle.\n\"\"\"\n\ncelprm_latpreq = \"\"\"\n``int``, *read-only*. For informational purposes, this indicates how the\n``LATPOLEa`` keyword was used:\n\n- 0: Not required, ``theta_p == delta_p`` was determined uniquely by the\n    ``CRVALia`` and ``LONPOLEa`` keywords.\n- 1: Required to select between two valid solutions of ``theta_p``.\n- 2: ``theta_p`` was specified solely by ``LATPOLEa``.\n\"\"\"\n\ncelprm_isolat = \"\"\"\n``bool``, *read-only*. True if the spherical rotation preserves the magnitude\nof the latitude, which occurs if the axes of the native and celestial\ncoordinates are coincident. It signals an opportunity to cache intermediate\ncalculations common to all elements in a vector computation.\n\"\"\"\n\ncelprm_prj = \"\"\"\n*Read-only* Celestial transformation parameters. Some members of `Prjprm`\nare read-write, i.e., can be set by the user. For more details, see\ndocumentation for `Prjprm`.\n\"\"\"\n\nprjprm_r0 = r\"\"\"\nThe radius of the generating sphere for the projection, a linear scaling\nparameter. If this is zero, it will be reset to its default value of\n:math:`180^\\circ/\\pi` (the value for FITS WCS).\n\"\"\"\n\nprjprm_code = \"\"\"\nThree-letter projection code defined by the FITS standard.\n\"\"\"\n\nprjprm_pv = \"\"\"\nProjection parameters. These correspond to the ``PVi_ma`` keywords in FITS,\nso ``pv[0]`` is ``PVi_0a``, ``pv[1]`` is ``PVi_1a``, etc., where ``i`` denotes\nthe latitude-like axis. Many projections use ``pv[1]`` (``PVi_1a``),\nsome also use ``pv[2]`` (``PVi_2a``) and ``SZP`` uses ``pv[3]`` (``PVi_3a``).\n``ZPN`` is currently the only projection that uses any of the others.\n\nWhen setting ``pv`` values using lists or ``numpy.ndarray``,\nelements set to `None` will be left unchanged while those set to ``numpy.nan``\nwill be set to ``WCSLIB``'s ``UNDEFINED`` special value. For efficiency\npurposes, if supplied list or ``numpy.ndarray`` is shorter than the length of\nthe ``pv`` member, then remaining values in ``pv`` will be left unchanged.\n\n.. note::\n    When retrieving ``pv``, a copy of the ``prjprm.pv`` array is returned.\n    Modifying this array values will not modify underlying ``WCSLIB``'s\n    ``prjprm.pv`` data.\n\"\"\"\n\nprjprm_pvi = \"\"\"\nSet/Get projection parameters for specific index. These correspond to the\n``PVi_ma`` keywords in FITS, so ``pv[0]`` is ``PVi_0a``, ``pv[1]`` is\n``PVi_1a``, etc., where ``i`` denotes the latitude-like axis.\nMany projections use ``pv[1]`` (``PVi_1a``),\nsome also use ``pv[2]`` (``PVi_2a``) and ``SZP`` uses ``pv[3]`` (``PVi_3a``).\n``ZPN`` is currently the only projection that uses any of the others.\n\nSetting a ``pvi`` value to `None` will reset the corresponding ``WCSLIB``'s\n``prjprm.pv`` element to the default value as set by ``WCSLIB``'s ``prjini()``.\n\nSetting a ``pvi`` value to ``numpy.nan`` will set the corresponding\n``WCSLIB``'s ``prjprm.pv`` element to ``WCSLIB``'s ``UNDEFINED`` special value.\n\"\"\"\n\nprjprm_phi0 = r\"\"\"\nThe native longitude, :math:`\\phi_0` (in degrees) of the reference point,\ni.e. the point ``(x,y) = (0,0)``. If undefined the initialization routine\nwill set this to a projection-specific default.\n\"\"\"\n\nprjprm_theta0 = r\"\"\"\nthe native latitude, :math:`\\theta_0` (in degrees) of the reference point,\ni.e. the point ``(x,y) = (0,0)``. If undefined the initialization routine\nwill set this to a projection-specific default.\n\"\"\"\n\nprjprm_bounds = \"\"\"\nControls bounds checking. If ``bounds&1`` then enable strict bounds checking\nfor the spherical-to-Cartesian (``s2x``) transformation for the\n``AZP``, ``SZP``, ``TAN``, ``SIN``, ``ZPN``, and ``COP`` projections.\nIf ``bounds&2`` then enable strict bounds checking for the\nCartesian-to-spherical transformation (``x2s``) for the ``HPX`` and ``XPH``\nprojections. If ``bounds&4`` then the Cartesian- to-spherical transformations\n(``x2s``) will invoke WCSLIB's ``prjbchk()`` to perform bounds checking on the\ncomputed native coordinates, with a tolerance set to suit each projection.\nbounds is set to 7 during initialization by default which enables all checks.\nZero it to disable all checking.\n\nIt is not necessary to reset the ``Prjprm`` struct (via ``Prjprm.set()``) when\n``bounds`` is changed.\n\"\"\"\n\nprjprm_name = \"\"\"\n*Read-only.* Long name of the projection.\n\"\"\"\n\nprjprm_category = \"\"\"\n*Read-only.* Projection category matching the value of the relevant ``wcs``\nmodule constants:\n\nPRJ_ZENITHAL,\nPRJ_CYLINDRICAL,\nPRJ_PSEUDOCYLINDRICAL,\nPRJ_CONVENTIONAL,\nPRJ_CONIC,\nPRJ_POLYCONIC,\nPRJ_QUADCUBE, and\nPRJ_HEALPIX.\n\"\"\"\n\nprjprm_w = \"\"\"\n*Read-only.* Intermediate floating-point values derived from the projection\nparameters, cached here to save recomputation.\n\n.. note::\n    When retrieving ``w``, a copy of the ``prjprm.w`` array is returned.\n    Modifying this array values will not modify underlying ``WCSLIB``'s\n    ``prjprm.w`` data.\n\n\"\"\"\n\nprjprm_pvrange = \"\"\"\n*Read-only.* Range of projection parameter indices: 100 times the first allowed\nindex plus the number of parameters, e.g. ``TAN`` is 0 (no parameters),\n``SZP`` is 103 (1 to 3), and ``ZPN`` is 30 (0 to 29).\n\"\"\"\n\nprjprm_simplezen = \"\"\"\n*Read-only.* True if the projection is a radially-symmetric zenithal projection.\n\"\"\"\n\nprjprm_equiareal = \"\"\"\n*Read-only.* True if the projection is equal area.\n\"\"\"\n\nprjprm_conformal = \"\"\"\n*Read-only.* True if the projection is conformal.\n\"\"\"\n\nprjprm_global_projection = \"\"\"\n*Read-only.* True if the projection can represent the whole sphere in a finite,\nnon-overlapped mapping.\n\"\"\"\n\nprjprm_divergent = \"\"\"\n*Read-only.* True if the projection diverges in latitude.\n\"\"\"\n\nprjprm_x0 = r\"\"\"\n*Read-only.* The offset in ``x`` used to force :math:`(x,y) = (0,0)` at\n:math:`(\\phi_0, \\theta_0)`.\n\"\"\"\n\nprjprm_y0 = r\"\"\"\n*Read-only.* The offset in ``y`` used to force :math:`(x,y) = (0,0)` at\n:math:`(\\phi_0, \\theta_0)`.\n\"\"\"\n\nprjprm_m = \"\"\"\n*Read-only.* Intermediate integer value (used only for the ``ZPN`` and ``HPX`` projections).\n\"\"\"\n\nprjprm_n = \"\"\"\n*Read-only.* Intermediate integer value (used only for the ``ZPN`` and ``HPX`` projections).\n\"\"\"\n\nprjprm_set = \"\"\"\nThis method sets up a ``Prjprm`` object according to information supplied\nwithin it.\n\nNote that this routine need not be called directly; it will be invoked by\n`prjx2s` and `prjs2x` if ``Prjprm.flag`` is anything other than a predefined\nmagic value.\n\nThe one important property of ``set()`` is that the projection code must be\ndefined in the ``Prjprm`` in order for ``set()`` to identify the required\nprojection.\n\nRaises\n------\nMemoryError\n    Null ``prjprm`` pointer passed to WCSLIB routines.\n\nInvalidPrjParametersError\n    Invalid projection parameters.\n\nInvalidCoordinateError\n    One or more of the ``(x,y)`` or ``(lon,lat)`` coordinates were invalid.\n\"\"\"\n\nprjprm_prjx2s = r\"\"\"\nDeproject Cartesian ``(x,y)`` coordinates in the plane of projection to native\nspherical coordinates :math:`(\\phi,\\theta)`.\n\nThe projection is that specified by ``Prjprm.code``.\n\nParameters\n----------\nx, y : numpy.ndarray\n    Arrays corresponding to the first (``x``) and second (``y``) projected\n    coordinates.\n\nReturns\n-------\nphi, theta : tuple of numpy.ndarray\n    Longitude and latitude :math:`(\\phi,\\theta)` of the projected point in\n    native spherical coordinates (in degrees). Values corresponding to\n    invalid ``(x,y)`` coordinates are set to ``numpy.nan``.\n\nRaises\n------\nMemoryError\n    Null ``prjprm`` pointer passed to WCSLIB routines.\n\nInvalidPrjParametersError\n    Invalid projection parameters.\n\n\"\"\"\n\nprjprm_prjs2x = r\"\"\"\nProject native spherical coordinates :math:`(\\phi,\\theta)` to Cartesian\n``(x,y)`` coordinates in the plane of projection.\n\nThe projection is that specified by ``Prjprm.code``.\n\nParameters\n----------\nphi : numpy.ndarray\n    Array corresponding to the longitude :math:`\\phi` of the projected point\n    in native spherical coordinates (in degrees).\ntheta : numpy.ndarray\n    Array corresponding to the longitude :math:`\\theta` of the projected point\n    in native spherical coordinatess (in degrees). Values corresponding to\n    invalid :math:`(\\phi, \\theta)` coordinates are set to ``numpy.nan``.\n\nReturns\n-------\nx, y : tuple of numpy.ndarray\n    Projected coordinates.\n\nRaises\n------\nMemoryError\n    Null ``prjprm`` pointer passed to WCSLIB routines.\n\nInvalidPrjParametersError\n    Invalid projection parameters.\n\n\"\"\"\n\ncelfix = \"\"\"\nTranslates AIPS-convention celestial projection types, ``-NCP`` and\n``-GLS``.\n\nReturns\n-------\nsuccess : int\n    Returns ``0`` for success; ``-1`` if no change required.\n\"\"\"\n\ncname = \"\"\"\n``list of strings`` A list of the coordinate axis names, from\n``CNAMEia``.\n\"\"\"\n\ncolax = \"\"\"\n``int array[naxis]`` An array recording the column numbers for each\naxis in a pixel list.\n\"\"\"\n\ncolnum = \"\"\"\n``int`` Column of FITS binary table associated with this WCS.\n\nWhere the coordinate representation is associated with an image-array\ncolumn in a FITS binary table, this property may be used to record the\nrelevant column number.\n\nIt should be set to zero for an image header or pixel list.\n\"\"\"\n\ncompare = \"\"\"\ncompare(other, cmp=0, tolerance=0.0)\n\nCompare two Wcsprm objects for equality.\n\nParameters\n----------\n\nother : Wcsprm\n    The other Wcsprm object to compare to.\n\ncmp : int, optional\n    A bit field controlling the strictness of the comparison.  When 0,\n    (the default), all fields must be identical.\n\n    The following constants, defined in the `astropy.wcs` module,\n    may be or'ed together to loosen the comparison.\n\n    - ``WCSCOMPARE_ANCILLARY``: Ignores ancillary keywords that don't\n      change the WCS transformation, such as ``XPOSURE`` or\n      ``EQUINOX``. Note that this also ignores ``DATE-OBS``, which does\n      change the WCS transformation in some cases.\n\n    - ``WCSCOMPARE_TILING``: Ignore integral differences in\n      ``CRPIXja``.  This is the 'tiling' condition, where two WCSes\n      cover different regions of the same map projection and align on\n      the same map grid.\n\n    - ``WCSCOMPARE_CRPIX``: Ignore any differences at all in\n      ``CRPIXja``.  The two WCSes cover different regions of the same\n      map projection but may not align on the same grid map.\n      Overrides ``WCSCOMPARE_TILING``.\n\ntolerance : float, optional\n    The amount of tolerance required.  For example, for a value of\n    1e-6, all floating-point values in the objects must be equal to\n    the first 6 decimal places.  The default value of 0.0 implies\n    exact equality.\n\nReturns\n-------\nequal : bool\n\"\"\"\n\nconvert = \"\"\"\nconvert(array)\n\nPerform the unit conversion on the elements of the given *array*,\nreturning an array of the same shape.\n\"\"\"\n\ncoord = \"\"\"\n``double array[K_M]...[K_2][K_1][M]`` The tabular coordinate array.\n\nHas the dimensions::\n\n    (K_M, ... K_2, K_1, M)\n\n(see `~astropy.wcs.Tabprm.K`) i.e. with the `M` dimension\nvarying fastest so that the `M` elements of a coordinate vector are\nstored contiguously in memory.\n\"\"\"\n\ncopy = \"\"\"\nCreates a deep copy of the WCS object.\n\"\"\"\n\ncpdis1 = \"\"\"\n`~astropy.wcs.DistortionLookupTable`\n\nThe pre-linear transformation distortion lookup table, ``CPDIS1``.\n\"\"\"\n\ncpdis2 = \"\"\"\n`~astropy.wcs.DistortionLookupTable`\n\nThe pre-linear transformation distortion lookup table, ``CPDIS2``.\n\"\"\"\n\ncrder = \"\"\"\n``double array[naxis]`` The random error in each coordinate axis,\n``CRDERia``.\n\nAn undefined value is represented by NaN.\n\"\"\"\n\ncrln_obs = \"\"\"\n``double`` Carrington heliographic longitude of the observer (deg). If\nundefined, this is set to `None`.\n\"\"\"\n\ncrota = \"\"\"\n``double array[naxis]`` ``CROTAia`` keyvalues for each coordinate\naxis.\n\nFor historical compatibility, three alternate specifications of the\nlinear transformations are available in wcslib.  The canonical\n``PCi_ja`` with ``CDELTia``, ``CDi_ja``, and the deprecated\n``CROTAia`` keywords.  Although the latter may not formally co-exist\nwith ``PCi_ja``, the approach here is simply to ignore them if given\nin conjunction with ``PCi_ja``.\n\n`~astropy.wcs.Wcsprm.has_pc`, `~astropy.wcs.Wcsprm.has_cd` and\n`~astropy.wcs.Wcsprm.has_crota` can be used to determine which of\nthese alternatives are present in the header.\n\nThese alternate specifications of the linear transformation matrix are\ntranslated immediately to ``PCi_ja`` by `~astropy.wcs.Wcsprm.set` and\nare nowhere visible to the lower-level routines.  In particular,\n`~astropy.wcs.Wcsprm.set` resets `~astropy.wcs.Wcsprm.cdelt` to unity\nif ``CDi_ja`` is present (and no ``PCi_ja``).  If no ``CROTAia`` is\nassociated with the latitude axis, `~astropy.wcs.Wcsprm.set` reverts\nto a unity ``PCi_ja`` matrix.\n\"\"\"\n\ncrpix = \"\"\"\n``double array[naxis]`` Coordinate reference pixels (``CRPIXja``) for\neach pixel axis.\n\"\"\"\n\ncrval = \"\"\"\n``double array[naxis]`` Coordinate reference values (``CRVALia``) for\neach coordinate axis.\n\"\"\"\n\ncrval_tabprm = \"\"\"\n``double array[M]`` Index values for the reference pixel for each of\nthe tabular coord axes.\n\"\"\"\n\ncsyer = \"\"\"\n``double array[naxis]`` The systematic error in the coordinate value\naxes, ``CSYERia``.\n\nAn undefined value is represented by NaN.\n\"\"\"\n\nctype = \"\"\"\n``list of strings[naxis]`` List of ``CTYPEia`` keyvalues.\n\nThe `~astropy.wcs.Wcsprm.ctype` keyword values must be in upper case\nand there must be zero or one pair of matched celestial axis types,\nand zero or one spectral axis.\n\"\"\"\n\ncubeface = \"\"\"\n``int`` Index into the ``pixcrd`` (pixel coordinate) array for the\n``CUBEFACE`` axis.\n\nThis is used for quadcube projections where the cube faces are stored\non a separate axis.\n\nThe quadcube projections (``TSC``, ``CSC``, ``QSC``) may be\nrepresented in FITS in either of two ways:\n\n    - The six faces may be laid out in one plane and numbered as\n      follows::\n\n\n                                       0\n\n                              4  3  2  1  4  3  2\n\n                                       5\n\n      Faces 2, 3 and 4 may appear on one side or the other (or both).\n      The world-to-pixel routines map faces 2, 3 and 4 to the left but\n      the pixel-to-world routines accept them on either side.\n\n    - The ``COBE`` convention in which the six faces are stored in a\n      three-dimensional structure using a ``CUBEFACE`` axis indexed\n      from 0 to 5 as above.\n\nThese routines support both methods; `~astropy.wcs.Wcsprm.set`\ndetermines which is being used by the presence or absence of a\n``CUBEFACE`` axis in `~astropy.wcs.Wcsprm.ctype`.\n`~astropy.wcs.Wcsprm.p2s` and `~astropy.wcs.Wcsprm.s2p` translate the\n``CUBEFACE`` axis representation to the single plane representation\nunderstood by the lower-level projection routines.\n\"\"\"\n\ncunit = \"\"\"\n``list of astropy.UnitBase[naxis]`` List of ``CUNITia`` keyvalues as\n`astropy.units.UnitBase` instances.\n\nThese define the units of measurement of the ``CRVALia``, ``CDELTia``\nand ``CDi_ja`` keywords.\n\nAs ``CUNITia`` is an optional header keyword,\n`~astropy.wcs.Wcsprm.cunit` may be left blank but otherwise is\nexpected to contain a standard units specification as defined by WCS\nPaper I.  `~astropy.wcs.Wcsprm.unitfix` is available to translate\ncommonly used non-standard units specifications but this must be done\nas a separate step before invoking `~astropy.wcs.Wcsprm.set`.\n\nFor celestial axes, if `~astropy.wcs.Wcsprm.cunit` is not blank,\n`~astropy.wcs.Wcsprm.set` uses ``wcsunits`` to parse it and scale\n`~astropy.wcs.Wcsprm.cdelt`, `~astropy.wcs.Wcsprm.crval`, and\n`~astropy.wcs.Wcsprm.cd` to decimal degrees.  It then resets\n`~astropy.wcs.Wcsprm.cunit` to ``\"deg\"``.\n\nFor spectral axes, if `~astropy.wcs.Wcsprm.cunit` is not blank,\n`~astropy.wcs.Wcsprm.set` uses ``wcsunits`` to parse it and scale\n`~astropy.wcs.Wcsprm.cdelt`, `~astropy.wcs.Wcsprm.crval`, and\n`~astropy.wcs.Wcsprm.cd` to SI units.  It then resets\n`~astropy.wcs.Wcsprm.cunit` accordingly.\n\n`~astropy.wcs.Wcsprm.set` ignores `~astropy.wcs.Wcsprm.cunit` for\nother coordinate types; `~astropy.wcs.Wcsprm.cunit` may be used to\nlabel coordinate values.\n\"\"\"\n\ncylfix = \"\"\"\ncylfix()\n\nFixes WCS keyvalues for malformed cylindrical projections.\n\nReturns\n-------\nsuccess : int\n    Returns ``0`` for success; ``-1`` if no change required.\n\"\"\"\n\ndata = \"\"\"\n``float array`` The array data for the\n`~astropy.wcs.DistortionLookupTable`.\n\"\"\"\n\ndata_wtbarr = \"\"\"\n``double array``\n\nThe array data for the BINTABLE.\n\"\"\"\n\ndateavg = \"\"\"\n``string`` Representative mid-point of the date of observation.\n\nIn ISO format, ``yyyy-mm-ddThh:mm:ss``.\n\nSee also\n--------\nastropy.wcs.Wcsprm.dateobs\n\"\"\"\n\ndateobs = \"\"\"\n``string`` Start of the date of observation.\n\nIn ISO format, ``yyyy-mm-ddThh:mm:ss``.\n\nSee also\n--------\nastropy.wcs.Wcsprm.dateavg\n\"\"\"\n\ndatfix = \"\"\"\ndatfix()\n\nTranslates the old ``DATE-OBS`` date format to year-2000 standard form\n``(yyyy-mm-ddThh:mm:ss)`` and derives ``MJD-OBS`` from it if not\nalready set.\n\nAlternatively, if `~astropy.wcs.Wcsprm.mjdobs` is set and\n`~astropy.wcs.Wcsprm.dateobs` isn't, then `~astropy.wcs.Wcsprm.datfix`\nderives `~astropy.wcs.Wcsprm.dateobs` from it.  If both are set but\ndisagree by more than half a day then `ValueError` is raised.\n\nReturns\n-------\nsuccess : int\n    Returns ``0`` for success; ``-1`` if no change required.\n\"\"\"\n\ndelta = \"\"\"\n``double array[M]`` (read-only) Interpolated indices into the coord\narray.\n\nArray of interpolated indices into the coordinate array such that\nUpsilon_m, as defined in Paper III, is equal to\n(`~astropy.wcs.Tabprm.p0` [m] + 1) + delta[m].\n\"\"\"\n\ndet2im = \"\"\"\nConvert detector coordinates to image plane coordinates.\n\"\"\"\n\ndet2im1 = \"\"\"\nA `~astropy.wcs.DistortionLookupTable` object for detector to image plane\ncorrection in the *x*-axis.\n\"\"\"\n\ndet2im2 = \"\"\"\nA `~astropy.wcs.DistortionLookupTable` object for detector to image plane\ncorrection in the *y*-axis.\n\"\"\"\n\ndims = \"\"\"\n``int array[ndim]`` (read-only)\n\nThe dimensions of the tabular array\n`~astropy.wcs.Wtbarr.data`.\n\"\"\"\n\nDistortionLookupTable = \"\"\"\nDistortionLookupTable(*table*, *crpix*, *crval*, *cdelt*)\n\nRepresents a single lookup table for a `distortion paper`_\ntransformation.\n\nParameters\n----------\ntable : 2-dimensional array\n    The distortion lookup table.\n\ncrpix : 2-tuple\n    The distortion array reference pixel\n\ncrval : 2-tuple\n    The image array pixel coordinate\n\ncdelt : 2-tuple\n    The grid step size\n\"\"\"\n\ndsun_obs = \"\"\"\n``double`` Distance between the centre of the Sun and the observer (m). If\nundefined, this is set to `None`.\n\"\"\"\n\nequinox = \"\"\"\n``double`` The equinox associated with dynamical equatorial or\necliptic coordinate systems.\n\n``EQUINOXa`` (or ``EPOCH`` in older headers).  Not applicable to ICRS\nequatorial or ecliptic coordinates.\n\nAn undefined value is represented by NaN.\n\"\"\"\n\nextlev = \"\"\"\n``int`` (read-only) ``EXTLEV`` identifying the binary table extension.\n\"\"\"\n\nextnam = \"\"\"\n``str`` (read-only) ``EXTNAME`` identifying the binary table extension.\n\"\"\"\n\nextrema = \"\"\"\n``double array[K_M]...[K_2][2][M]`` (read-only)\n\nAn array recording the minimum and maximum value of each element of\nthe coordinate vector in each row of the coordinate array, with the\ndimensions::\n\n    (K_M, ... K_2, 2, M)\n\n(see `~astropy.wcs.Tabprm.K`).  The minimum is recorded\nin the first element of the compressed K_1 dimension, then the\nmaximum.  This array is used by the inverse table lookup function to\nspeed up table searches.\n\"\"\"\n\nextver = \"\"\"\n``int`` (read-only) ``EXTVER`` identifying the binary table extension.\n\"\"\"\n\nfind_all_wcs = \"\"\"\nfind_all_wcs(relax=0, keysel=0)\n\nFind all WCS transformations in the header.\n\nParameters\n----------\n\nheader : str\n    The raw FITS header data.\n\nrelax : bool or int\n    Degree of permissiveness:\n\n    - `False`: Recognize only FITS keywords defined by the published\n      WCS standard.\n\n    - `True`: Admit all recognized informal extensions of the WCS\n      standard.\n\n    - `int`: a bit field selecting specific extensions to accept.  See\n      :ref:`astropy:relaxread` for details.\n\nkeysel : sequence of flags\n    Used to restrict the keyword types considered:\n\n    - ``WCSHDR_IMGHEAD``: Image header keywords.\n\n    - ``WCSHDR_BIMGARR``: Binary table image array.\n\n    - ``WCSHDR_PIXLIST``: Pixel list keywords.\n\n    If zero, there is no restriction.  If -1, `wcspih` is called,\n    rather than `wcstbh`.\n\nReturns\n-------\nwcs_list : list of `~astropy.wcs.Wcsprm`\n\"\"\"\n\nfix = \"\"\"\nfix(translate_units='', naxis=0)\n\nApplies all of the corrections handled separately by\n`~astropy.wcs.Wcsprm.datfix`, `~astropy.wcs.Wcsprm.unitfix`,\n`~astropy.wcs.Wcsprm.celfix`, `~astropy.wcs.Wcsprm.spcfix`,\n`~astropy.wcs.Wcsprm.cylfix` and `~astropy.wcs.Wcsprm.cdfix`.\n\nParameters\n----------\n\ntranslate_units : str, optional\n    Specify which potentially unsafe translations of non-standard unit\n    strings to perform.  By default, performs all.\n\n    Although ``\"S\"`` is commonly used to represent seconds, its\n    translation to ``\"s\"`` is potentially unsafe since the standard\n    recognizes ``\"S\"`` formally as Siemens, however rarely that may be\n    used.  The same applies to ``\"H\"`` for hours (Henry), and ``\"D\"``\n    for days (Debye).\n\n    This string controls what to do in such cases, and is\n    case-insensitive.\n\n    - If the string contains ``\"s\"``, translate ``\"S\"`` to ``\"s\"``.\n\n    - If the string contains ``\"h\"``, translate ``\"H\"`` to ``\"h\"``.\n\n    - If the string contains ``\"d\"``, translate ``\"D\"`` to ``\"d\"``.\n\n    Thus ``''`` doesn't do any unsafe translations, whereas ``'shd'``\n    does all of them.\n\nnaxis : int array, optional\n    Image axis lengths.  If this array is set to zero or ``None``,\n    then `~astropy.wcs.Wcsprm.cylfix` will not be invoked.\n\nReturns\n-------\nstatus : dict\n\n    Returns a dictionary containing the following keys, each referring\n    to a status string for each of the sub-fix functions that were\n    called:\n\n    - `~astropy.wcs.Wcsprm.cdfix`\n\n    - `~astropy.wcs.Wcsprm.datfix`\n\n    - `~astropy.wcs.Wcsprm.unitfix`\n\n    - `~astropy.wcs.Wcsprm.celfix`\n\n    - `~astropy.wcs.Wcsprm.spcfix`\n\n    - `~astropy.wcs.Wcsprm.cylfix`\n\"\"\"\n\nget_offset = \"\"\"\nget_offset(x, y) -> (x, y)\n\nReturns the offset as defined in the distortion lookup table.\n\nReturns\n-------\ncoordinate : (2,) tuple\n    The offset from the distortion table for pixel point (*x*, *y*).\n\"\"\"\n\nget_cdelt = \"\"\"\nget_cdelt() -> numpy.ndarray\n\nCoordinate increments (``CDELTia``) for each coord axis as ``double array[naxis]``.\n\nReturns the ``CDELT`` offsets in read-only form.  Unlike the\n`~astropy.wcs.Wcsprm.cdelt` property, this works even when the header\nspecifies the linear transformation matrix in one of the alternative\n``CDi_ja`` or ``CROTAia`` forms.  This is useful when you want access\nto the linear transformation matrix, but don't care how it was\nspecified in the header.\n\"\"\"\n\nget_pc = \"\"\"\nget_pc() -> numpy.ndarray\n\nReturns the ``PC`` matrix in read-only form as ``double array[naxis][naxis]``.  Unlike the\n`~astropy.wcs.Wcsprm.pc` property, this works even when the header\nspecifies the linear transformation matrix in one of the alternative\n``CDi_ja`` or ``CROTAia`` forms.  This is useful when you want access\nto the linear transformation matrix, but don't care how it was\nspecified in the header.\n\"\"\"\n\nget_ps = \"\"\"\nget_ps() -> list\n\nReturns ``PSi_ma`` keywords for each *i* and *m* as list of tuples.\n\nReturns\n-------\nps : list\n\n    Returned as a list of tuples of the form (*i*, *m*, *value*):\n\n    - *i*: int.  Axis number, as in ``PSi_ma``, (i.e. 1-relative)\n\n    - *m*: int.  Parameter number, as in ``PSi_ma``, (i.e. 0-relative)\n\n    - *value*: string.  Parameter value.\n\nSee also\n--------\nastropy.wcs.Wcsprm.set_ps : Set ``PSi_ma`` values\n\"\"\"\n\nget_pv = \"\"\"\nget_pv() -> list\n\nReturns ``PVi_ma`` keywords for each *i* and *m* as list of tuples.\n\nReturns\n-------\nsequence of tuple\n    Returned as a list of tuples of the form (*i*, *m*, *value*):\n\n    - *i*: int.  Axis number, as in ``PVi_ma``, (i.e. 1-relative)\n\n    - *m*: int.  Parameter number, as in ``PVi_ma``, (i.e. 0-relative)\n\n    - *value*: string. Parameter value.\n\nSee also\n--------\nastropy.wcs.Wcsprm.set_pv : Set ``PVi_ma`` values\n\nNotes\n-----\n\nNote that, if they were not given, `~astropy.wcs.Wcsprm.set` resets\nthe entries for ``PVi_1a``, ``PVi_2a``, ``PVi_3a``, and ``PVi_4a`` for\nlongitude axis *i* to match (``phi_0``, ``theta_0``), the native\nlongitude and latitude of the reference point given by ``LONPOLEa``\nand ``LATPOLEa``.\n\"\"\"\n\nhas_cd = \"\"\"\nhas_cd() -> bool\n\nReturns `True` if ``CDi_ja`` is present.\n\n``CDi_ja`` is an alternate specification of the linear transformation\nmatrix, maintained for historical compatibility.\n\nMatrix elements in the IRAF convention are equivalent to the product\n``CDi_ja = CDELTia * PCi_ja``, but the defaults differ from that of\nthe ``PCi_ja`` matrix.  If one or more ``CDi_ja`` keywords are present\nthen all unspecified ``CDi_ja`` default to zero.  If no ``CDi_ja`` (or\n``CROTAia``) keywords are present, then the header is assumed to be in\n``PCi_ja`` form whether or not any ``PCi_ja`` keywords are present\nsince this results in an interpretation of ``CDELTia`` consistent with\nthe original FITS specification.\n\nWhile ``CDi_ja`` may not formally co-exist with ``PCi_ja``, it may\nco-exist with ``CDELTia`` and ``CROTAia`` which are to be ignored.\n\nSee also\n--------\nastropy.wcs.Wcsprm.cd : Get the raw ``CDi_ja`` values.\n\"\"\"\n\nhas_cdi_ja = \"\"\"\nhas_cdi_ja() -> bool\n\nAlias for `~astropy.wcs.Wcsprm.has_cd`.  Maintained for backward\ncompatibility.\n\"\"\"\n\nhas_crota = \"\"\"\nhas_crota() -> bool\n\nReturns `True` if ``CROTAia`` is present.\n\n``CROTAia`` is an alternate specification of the linear transformation\nmatrix, maintained for historical compatibility.\n\nIn the AIPS convention, ``CROTAia`` may only be associated with the\nlatitude axis of a celestial axis pair.  It specifies a rotation in\nthe image plane that is applied *after* the ``CDELTia``; any other\n``CROTAia`` keywords are ignored.\n\n``CROTAia`` may not formally co-exist with ``PCi_ja``.  ``CROTAia`` and\n``CDELTia`` may formally co-exist with ``CDi_ja`` but if so are to be\nignored.\n\nSee also\n--------\nastropy.wcs.Wcsprm.crota : Get the raw ``CROTAia`` values\n\"\"\"\n\nhas_crotaia = \"\"\"\nhas_crotaia() -> bool\n\nAlias for `~astropy.wcs.Wcsprm.has_crota`.  Maintained for backward\ncompatibility.\n\"\"\"\n\nhas_pc = \"\"\"\nhas_pc() -> bool\n\nReturns `True` if ``PCi_ja`` is present.  ``PCi_ja`` is the\nrecommended way to specify the linear transformation matrix.\n\nSee also\n--------\nastropy.wcs.Wcsprm.pc : Get the raw ``PCi_ja`` values\n\"\"\"\n\nhas_pci_ja = \"\"\"\nhas_pci_ja() -> bool\n\nAlias for `~astropy.wcs.Wcsprm.has_pc`.  Maintained for backward\ncompatibility.\n\"\"\"\n\nhgln_obs = \"\"\"\n``double`` Stonyhurst heliographic longitude of the observer. If\nundefined, this is set to `None`.\n\"\"\"\n\nhglt_obs = \"\"\"\n``double``  Heliographic latitude (Carrington or Stonyhurst) of the observer\n(deg). If undefined, this is set to `None`.\n\"\"\"\n\ni = \"\"\"\n``int`` (read-only) Image axis number.\n\"\"\"\n\nimgpix_matrix = \"\"\"\n``double array[2][2]`` (read-only) Inverse of the ``CDELT`` or ``PC``\nmatrix.\n\nInverse containing the product of the ``CDELTia`` diagonal matrix and\nthe ``PCi_ja`` matrix.\n\"\"\"\n\nis_unity = \"\"\"\nis_unity() -> bool\n\nReturns `True` if the linear transformation matrix\n(`~astropy.wcs.Wcsprm.cd`) is unity.\n\"\"\"\n\nK = \"\"\"\n``int array[M]`` (read-only) The lengths of the axes of the coordinate\narray.\n\nAn array of length `M` whose elements record the lengths of the axes of\nthe coordinate array and of each indexing vector.\n\"\"\"\n\nkind = \"\"\"\n``str`` (read-only) ``wcstab`` array type.\n\nCharacter identifying the ``wcstab`` array type:\n\n    - ``'c'``: coordinate array,\n    - ``'i'``: index vector.\n\"\"\"\n\nlat = \"\"\"\n``int`` (read-only) The index into the world coord array containing\nlatitude values.\n\"\"\"\n\nlatpole = \"\"\"\n``double`` The native latitude of the celestial pole, ``LATPOLEa`` (deg).\n\"\"\"\n\nlattyp = \"\"\"\n``string`` (read-only) Celestial axis type for latitude.\n\nFor example, \"RA\", \"DEC\", \"GLON\", \"GLAT\", etc. extracted from \"RA--\",\n\"DEC-\", \"GLON\", \"GLAT\", etc. in the first four characters of\n``CTYPEia`` but with trailing dashes removed.\n\"\"\"\n\nlng = \"\"\"\n``int`` (read-only) The index into the world coord array containing\nlongitude values.\n\"\"\"\n\nlngtyp = \"\"\"\n``string`` (read-only) Celestial axis type for longitude.\n\nFor example, \"RA\", \"DEC\", \"GLON\", \"GLAT\", etc. extracted from \"RA--\",\n\"DEC-\", \"GLON\", \"GLAT\", etc. in the first four characters of\n``CTYPEia`` but with trailing dashes removed.\n\"\"\"\n\nlonpole = \"\"\"\n``double`` The native longitude of the celestial pole.\n\n``LONPOLEa`` (deg).\n\"\"\"\n\nM = \"\"\"\n``int`` (read-only) Number of tabular coordinate axes.\n\"\"\"\n\nm = \"\"\"\n``int`` (read-only) ``wcstab`` axis number for index vectors.\n\"\"\"\n\nmap = \"\"\"\n``int array[M]`` Association between axes.\n\nA vector of length `~astropy.wcs.Tabprm.M` that defines\nthe association between axis *m* in the *M*-dimensional coordinate\narray (1 <= *m* <= *M*) and the indices of the intermediate world\ncoordinate and world coordinate arrays.\n\nWhen the intermediate and world coordinate arrays contain the full\ncomplement of coordinate elements in image-order, as will usually be\nthe case, then ``map[m-1] == i-1`` for axis *i* in the *N*-dimensional\nimage (1 <= *i* <= *N*).  In terms of the FITS keywords::\n\n    map[PVi_3a - 1] == i - 1.\n\nHowever, a different association may result if the intermediate\ncoordinates, for example, only contains a (relevant) subset of\nintermediate world coordinate elements.  For example, if *M* == 1 for\nan image with *N* > 1, it is possible to fill the intermediate\ncoordinates with the relevant coordinate element with ``nelem`` set to\n1.  In this case ``map[0] = 0`` regardless of the value of *i*.\n\"\"\"\n\nmix = \"\"\"\nmix(mixpix, mixcel, vspan, vstep, viter, world, pixcrd, origin)\n\nGiven either the celestial longitude or latitude plus an element of\nthe pixel coordinate, solves for the remaining elements by iterating\non the unknown celestial coordinate element using\n`~astropy.wcs.Wcsprm.s2p`.\n\nParameters\n----------\nmixpix : int\n    Which element on the pixel coordinate is given.\n\nmixcel : int\n    Which element of the celestial coordinate is given. If *mixcel* =\n    ``1``, celestial longitude is given in ``world[self.lng]``,\n    latitude returned in ``world[self.lat]``.  If *mixcel* = ``2``,\n    celestial latitude is given in ``world[self.lat]``, longitude\n    returned in ``world[self.lng]``.\n\nvspan : (float, float)\n    Solution interval for the celestial coordinate, in degrees.  The\n    ordering of the two limits is irrelevant.  Longitude ranges may be\n    specified with any convenient normalization, for example\n    ``(-120,+120)`` is the same as ``(240,480)``, except that the\n    solution will be returned with the same normalization, i.e. lie\n    within the interval specified.\n\nvstep : float\n    Step size for solution search, in degrees.  If ``0``, a sensible,\n    although perhaps non-optimal default will be used.\n\nviter : int\n    If a solution is not found then the step size will be halved and\n    the search recommenced.  *viter* controls how many times the step\n    size is halved.  The allowed range is 5 - 10.\n\nworld : ndarray\n    World coordinate elements as ``double array[naxis]``.  ``world[self.lng]`` and\n    ``world[self.lat]`` are the celestial longitude and latitude, in\n    degrees.  Which is given and which returned depends on the value\n    of *mixcel*.  All other elements are given.  The results will be\n    written to this array in-place.\n\npixcrd : ndarray\n    Pixel coordinates as ``double array[naxis]``.  The element indicated by *mixpix* is given and\n    the remaining elements will be written in-place.\n\n{}\n\nReturns\n-------\nresult : dict\n\n    Returns a dictionary with the following keys:\n\n    - *phi* (``double array[naxis]``)\n\n    - *theta* (``double array[naxis]``)\n\n        - Longitude and latitude in the native coordinate system of\n          the projection, in degrees.\n\n    - *imgcrd* (``double array[naxis]``)\n\n        - Image coordinate elements.  ``imgcrd[self.lng]`` and\n          ``imgcrd[self.lat]`` are the projected *x*- and\n          *y*-coordinates, in decimal degrees.\n\n    - *world* (``double array[naxis]``)\n\n        - Another reference to the *world* argument passed in.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nSingularMatrixError\n    Linear transformation matrix is singular.\n\nInconsistentAxisTypesError\n    Inconsistent or unrecognized coordinate axis types.\n\nValueError\n    Invalid parameter value.\n\nInvalidTransformError\n    Invalid coordinate transformation parameters.\n\nInvalidTransformError\n    Ill-conditioned coordinate transformation parameters.\n\nInvalidCoordinateError\n    Invalid world coordinate.\n\nNoSolutionError\n    No solution found in the specified interval.\n\nSee also\n--------\nastropy.wcs.Wcsprm.lat, astropy.wcs.Wcsprm.lng\n    Get the axes numbers for latitude and longitude\n\nNotes\n-----\n\nInitially, the specified solution interval is checked to see if it's a\n\\\"crossing\\\" interval.  If it isn't, a search is made for a crossing\nsolution by iterating on the unknown celestial coordinate starting at\nthe upper limit of the solution interval and decrementing by the\nspecified step size.  A crossing is indicated if the trial value of\nthe pixel coordinate steps through the value specified.  If a crossing\ninterval is found then the solution is determined by a modified form\nof \\\"regula falsi\\\" division of the crossing interval.  If no crossing\ninterval was found within the specified solution interval then a\nsearch is made for a \\\"non-crossing\\\" solution as may arise from a\npoint of tangency.  The process is complicated by having to make\nallowance for the discontinuities that occur in all map projections.\n\nOnce one solution has been determined others may be found by\nsubsequent invocations of `~astropy.wcs.Wcsprm.mix` with suitably\nrestricted solution intervals.\n\nNote the circumstance that arises when the solution point lies at a\nnative pole of a projection in which the pole is represented as a\nfinite curve, for example the zenithals and conics.  In such cases two\nor more valid solutions may exist but `~astropy.wcs.Wcsprm.mix` only\never returns one.\n\nBecause of its generality, `~astropy.wcs.Wcsprm.mix` is very\ncompute-intensive.  For compute-limited applications, more efficient\nspecial-case solvers could be written for simple projections, for\nexample non-oblique cylindrical projections.\n\"\"\".format(ORIGIN())\n\nmjdavg = \"\"\"\n``double`` Modified Julian Date corresponding to ``DATE-AVG``.\n\n``(MJD = JD - 2400000.5)``.\n\nAn undefined value is represented by NaN.\n\nSee also\n--------\nastropy.wcs.Wcsprm.mjdobs\n\"\"\"\n\nmjdobs = \"\"\"\n``double`` Modified Julian Date corresponding to ``DATE-OBS``.\n\n``(MJD = JD - 2400000.5)``.\n\nAn undefined value is represented by NaN.\n\nSee also\n--------\nastropy.wcs.Wcsprm.mjdavg\n\"\"\"\n\nname = \"\"\"\n``string`` The name given to the coordinate representation\n``WCSNAMEa``.\n\"\"\"\n\nnaxis = \"\"\"\n``int`` (read-only) The number of axes (pixel and coordinate).\n\nGiven by the ``NAXIS`` or ``WCSAXESa`` keyvalues.\n\nThe number of coordinate axes is determined at parsing time, and can\nnot be subsequently changed.\n\nIt is determined from the highest of the following:\n\n  1. ``NAXIS``\n\n  2. ``WCSAXESa``\n\n  3. The highest axis number in any parameterized WCS keyword.  The\n     keyvalue, as well as the keyword, must be syntactically valid\n     otherwise it will not be considered.\n\nIf none of these keyword types is present, i.e. if the header only\ncontains auxiliary WCS keywords for a particular coordinate\nrepresentation, then no coordinate description is constructed for it.\n\nThis value may differ for different coordinate representations of the\nsame image.\n\"\"\"\n\nnc = \"\"\"\n``int`` (read-only) Total number of coord vectors in the coord array.\n\nTotal number of coordinate vectors in the coordinate array being the\nproduct K_1 * K_2 * ... * K_M.\n\"\"\"\n\nndim = \"\"\"\n``int`` (read-only) Expected dimensionality of the ``wcstab`` array.\n\"\"\"\n\nobsgeo = \"\"\"\n``double array[3]`` Location of the observer in a standard terrestrial\nreference frame.\n\n``OBSGEO-X``, ``OBSGEO-Y``, ``OBSGEO-Z`` (in meters).\n\nAn undefined value is represented by NaN.\n\"\"\"\n\np0 = \"\"\"\n``int array[M]`` Interpolated indices into the coordinate array.\n\nVector of length `~astropy.wcs.Tabprm.M` of interpolated\nindices into the coordinate array such that Upsilon_m, as defined in\nPaper III, is equal to ``(p0[m] + 1) + delta[m]``.\n\"\"\"\n\np2s = \"\"\"\np2s(pixcrd, origin)\n\nConverts pixel to world coordinates.\n\nParameters\n----------\n\npixcrd : ndarray\n    Array of pixel coordinates as ``double array[ncoord][nelem]``.\n\n{}\n\nReturns\n-------\nresult : dict\n    Returns a dictionary with the following keys:\n\n    - *imgcrd*: ndarray\n\n      - Array of intermediate world coordinates as ``double array[ncoord][nelem]``.  For celestial axes,\n        ``imgcrd[][self.lng]`` and ``imgcrd[][self.lat]`` are the\n        projected *x*-, and *y*-coordinates, in pseudo degrees.  For\n        spectral axes, ``imgcrd[][self.spec]`` is the intermediate\n        spectral coordinate, in SI units.\n\n    - *phi*: ndarray\n\n      - Array as ``double array[ncoord]``.\n\n    - *theta*: ndarray\n\n      - Longitude and latitude in the native coordinate system of the\n        projection, in degrees, as ``double array[ncoord]``.\n\n    - *world*: ndarray\n\n      - Array of world coordinates as ``double array[ncoord][nelem]``.  For celestial axes,\n        ``world[][self.lng]`` and ``world[][self.lat]`` are the\n        celestial longitude and latitude, in degrees.  For spectral\n        axes, ``world[][self.spec]`` is the intermediate spectral\n        coordinate, in SI units.\n\n    - *stat*: ndarray\n\n      - Status return value for each coordinate as ``int array[ncoord]``. ``0`` for success,\n        ``1+`` for invalid pixel coordinate.\n\nRaises\n------\n\nMemoryError\n    Memory allocation failed.\n\nSingularMatrixError\n    Linear transformation matrix is singular.\n\nInconsistentAxisTypesError\n    Inconsistent or unrecognized coordinate axis types.\n\nValueError\n    Invalid parameter value.\n\nValueError\n    *x*- and *y*-coordinate arrays are not the same size.\n\nInvalidTransformError\n    Invalid coordinate transformation parameters.\n\nInvalidTransformError\n    Ill-conditioned coordinate transformation parameters.\n\nSee also\n--------\nastropy.wcs.Wcsprm.lat, astropy.wcs.Wcsprm.lng\n    Definition of the latitude and longitude axes\n\"\"\".format(ORIGIN())\n\np4_pix2foc = \"\"\"\np4_pix2foc(*pixcrd, origin*) -> ``double array[ncoord][nelem]``\n\nConvert pixel coordinates to focal plane coordinates using `distortion\npaper`_ lookup-table correction.\n\nParameters\n----------\npixcrd : ndarray\n    Array of pixel coordinates as ``double array[ncoord][nelem]``.\n\n{}\n\nReturns\n-------\nfoccrd : ndarray\n    Returns an array of focal plane coordinates as ``double array[ncoord][nelem]``.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nValueError\n    Invalid coordinate transformation parameters.\n\"\"\".format(ORIGIN())\n\npc = \"\"\"\n``double array[naxis][naxis]`` The ``PCi_ja`` (pixel coordinate)\ntransformation matrix.\n\nThe order is::\n\n  [[PC1_1, PC1_2],\n   [PC2_1, PC2_2]]\n\nFor historical compatibility, three alternate specifications of the\nlinear transformations are available in wcslib.  The canonical\n``PCi_ja`` with ``CDELTia``, ``CDi_ja``, and the deprecated\n``CROTAia`` keywords.  Although the latter may not formally co-exist\nwith ``PCi_ja``, the approach here is simply to ignore them if given\nin conjunction with ``PCi_ja``.\n\n`~astropy.wcs.Wcsprm.has_pc`, `~astropy.wcs.Wcsprm.has_cd` and\n`~astropy.wcs.Wcsprm.has_crota` can be used to determine which of\nthese alternatives are present in the header.\n\nThese alternate specifications of the linear transformation matrix are\ntranslated immediately to ``PCi_ja`` by `~astropy.wcs.Wcsprm.set` and\nare nowhere visible to the lower-level routines.  In particular,\n`~astropy.wcs.Wcsprm.set` resets `~astropy.wcs.Wcsprm.cdelt` to unity\nif ``CDi_ja`` is present (and no ``PCi_ja``).  If no ``CROTAia`` is\nassociated with the latitude axis, `~astropy.wcs.Wcsprm.set` reverts\nto a unity ``PCi_ja`` matrix.\n\"\"\"\n\nphi0 = \"\"\"\n``double`` The native latitude of the fiducial point.\n\nThe point whose celestial coordinates are given in ``ref[1:2]``.  If\nundefined (NaN) the initialization routine, `~astropy.wcs.Wcsprm.set`,\nwill set this to a projection-specific default.\n\nSee also\n--------\nastropy.wcs.Wcsprm.theta0\n\"\"\"\n\npix2foc = \"\"\"\npix2foc(*pixcrd, origin*) -> ``double array[ncoord][nelem]``\n\nPerform both `SIP`_ polynomial and `distortion paper`_ lookup-table\ncorrection in parallel.\n\nParameters\n----------\npixcrd : ndarray\n    Array of pixel coordinates as ``double array[ncoord][nelem]``.\n\n{}\n\nReturns\n-------\nfoccrd : ndarray\n    Returns an array of focal plane coordinates as ``double array[ncoord][nelem]``.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nValueError\n    Invalid coordinate transformation parameters.\n\"\"\".format(ORIGIN())\n\npiximg_matrix = \"\"\"\n``double array[2][2]`` (read-only) Matrix containing the product of\nthe ``CDELTia`` diagonal matrix and the ``PCi_ja`` matrix.\n\"\"\"\n\nprint_contents = \"\"\"\nprint_contents()\n\nPrint the contents of the `~astropy.wcs.Wcsprm` object to stdout.\nProbably only useful for debugging purposes, and may be removed in the\nfuture.\n\nTo get a string of the contents, use `repr`.\n\"\"\"\n\nprint_contents_tabprm = \"\"\"\nprint_contents()\n\nPrint the contents of the `~astropy.wcs.Tabprm` object to\nstdout.  Probably only useful for debugging purposes, and may be\nremoved in the future.\n\nTo get a string of the contents, use `repr`.\n\"\"\"\n\nprint_contents_wtbarr = \"\"\"\nprint_contents()\n\nPrint the contents of the `~astropy.wcs.Wtbarr` object to\nstdout. Probably only useful for debugging purposes, and may be\nremoved in the future.\n\nTo get a string of the contents, use `repr`.\n\"\"\"\n\nradesys = \"\"\"\n``string`` The equatorial or ecliptic coordinate system type,\n``RADESYSa``.\n\"\"\"\n\nrestfrq = \"\"\"\n``double`` Rest frequency (Hz) from ``RESTFRQa``.\n\nAn undefined value is represented by NaN.\n\"\"\"\n\nrestwav = \"\"\"\n``double`` Rest wavelength (m) from ``RESTWAVa``.\n\nAn undefined value is represented by NaN.\n\"\"\"\n\nrow = \"\"\"\n``int`` (read-only) Table row number.\n\"\"\"\n\nrsun_ref = \"\"\"\n``double`` Reference radius of the Sun used in coordinate calculations (m).\nIf undefined, this is set to `None`.\n\"\"\"\n\ns2p = \"\"\"\ns2p(world, origin)\n\nTransforms world coordinates to pixel coordinates.\n\nParameters\n----------\nworld : ndarray\n    Array of world coordinates, in decimal degrees, as ``double array[ncoord][nelem]``.\n\n{}\n\nReturns\n-------\nresult : dict\n    Returns a dictionary with the following keys:\n\n    - *phi*: ``double array[ncoord]``\n\n    - *theta*: ``double array[ncoord]``\n\n        - Longitude and latitude in the native coordinate system of\n          the projection, in degrees.\n\n    - *imgcrd*: ``double array[ncoord][nelem]``\n\n       - Array of intermediate world coordinates.  For celestial axes,\n         ``imgcrd[][self.lng]`` and ``imgcrd[][self.lat]`` are the\n         projected *x*-, and *y*-coordinates, in pseudo \\\"degrees\\\".\n         For quadcube projections with a ``CUBEFACE`` axis, the face\n         number is also returned in ``imgcrd[][self.cubeface]``.  For\n         spectral axes, ``imgcrd[][self.spec]`` is the intermediate\n         spectral coordinate, in SI units.\n\n    - *pixcrd*: ``double array[ncoord][nelem]``\n\n        - Array of pixel coordinates.  Pixel coordinates are\n          zero-based.\n\n    - *stat*: ``int array[ncoord]``\n\n        - Status return value for each coordinate. ``0`` for success,\n          ``1+`` for invalid pixel coordinate.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nSingularMatrixError\n    Linear transformation matrix is singular.\n\nInconsistentAxisTypesError\n    Inconsistent or unrecognized coordinate axis types.\n\nValueError\n    Invalid parameter value.\n\nInvalidTransformError\n   Invalid coordinate transformation parameters.\n\nInvalidTransformError\n    Ill-conditioned coordinate transformation parameters.\n\nSee also\n--------\nastropy.wcs.Wcsprm.lat, astropy.wcs.Wcsprm.lng\n    Definition of the latitude and longitude axes\n\"\"\".format(ORIGIN())\n\nsense = \"\"\"\n``int array[M]`` +1 if monotonically increasing, -1 if decreasing.\n\nA vector of length `~astropy.wcs.Tabprm.M` whose elements\nindicate whether the corresponding indexing vector is monotonically\nincreasing (+1), or decreasing (-1).\n\"\"\"\n\nset = \"\"\"\nset()\n\nSets up a WCS object for use according to information supplied within\nit.\n\nNote that this routine need not be called directly; it will be invoked\nby `~astropy.wcs.Wcsprm.p2s` and `~astropy.wcs.Wcsprm.s2p` if\nnecessary.\n\nSome attributes that are based on other attributes (such as\n`~astropy.wcs.Wcsprm.lattyp` on `~astropy.wcs.Wcsprm.ctype`) may not\nbe correct until after `~astropy.wcs.Wcsprm.set` is called.\n\n`~astropy.wcs.Wcsprm.set` strips off trailing blanks in all string\nmembers.\n\n`~astropy.wcs.Wcsprm.set` recognizes the ``NCP`` projection and\nconverts it to the equivalent ``SIN`` projection and it also\nrecognizes ``GLS`` as a synonym for ``SFL``.  It does alias\ntranslation for the AIPS spectral types (``FREQ-LSR``, ``FELO-HEL``,\netc.) but without changing the input header keywords.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nSingularMatrixError\n    Linear transformation matrix is singular.\n\nInconsistentAxisTypesError\n    Inconsistent or unrecognized coordinate axis types.\n\nValueError\n    Invalid parameter value.\n\nInvalidTransformError\n    Invalid coordinate transformation parameters.\n\nInvalidTransformError\n    Ill-conditioned coordinate transformation parameters.\n\"\"\"\n\nset_tabprm = \"\"\"\nset()\n\nAllocates memory for work arrays.\n\nAlso sets up the class according to information supplied within it.\n\nNote that this routine need not be called directly; it will be invoked\nby functions that need it.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nInvalidTabularParametersError\n    Invalid tabular parameters.\n\"\"\"\n\nset_celprm = \"\"\"\nset()\n\nSets up a ``celprm`` struct according to information supplied within it.\n\nNote that this routine need not be called directly; it will be invoked\nby functions that need it.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nInvalidPrjParametersError\n    Invalid celestial parameters.\n\"\"\"\n\nset_ps = \"\"\"\nset_ps(ps)\n\nSets ``PSi_ma`` keywords for each *i* and *m*.\n\nParameters\n----------\nps : sequence of tuple\n\n    The input must be a sequence of tuples of the form (*i*, *m*,\n    *value*):\n\n    - *i*: int.  Axis number, as in ``PSi_ma``, (i.e. 1-relative)\n\n    - *m*: int.  Parameter number, as in ``PSi_ma``, (i.e. 0-relative)\n\n    - *value*: string.  Parameter value.\n\nSee also\n--------\nastropy.wcs.Wcsprm.get_ps\n\"\"\"\n\nset_pv = \"\"\"\nset_pv(pv)\n\nSets ``PVi_ma`` keywords for each *i* and *m*.\n\nParameters\n----------\npv : list of tuple\n\n    The input must be a sequence of tuples of the form (*i*, *m*,\n    *value*):\n\n    - *i*: int.  Axis number, as in ``PVi_ma``, (i.e. 1-relative)\n\n    - *m*: int.  Parameter number, as in ``PVi_ma``, (i.e. 0-relative)\n\n    - *value*: float.  Parameter value.\n\nSee also\n--------\nastropy.wcs.Wcsprm.get_pv\n\"\"\"\n\nsip = \"\"\"\nGet/set the `~astropy.wcs.Sip` object for performing `SIP`_ distortion\ncorrection.\n\"\"\"\n\nSip = \"\"\"\nSip(*a, b, ap, bp, crpix*)\n\nThe `~astropy.wcs.Sip` class performs polynomial distortion correction\nusing the `SIP`_ convention in both directions.\n\nParameters\n----------\na : ndarray\n    The ``A_i_j`` polynomial for pixel to focal plane transformation as ``double array[m+1][m+1]``.\n    Its size must be (*m* + 1, *m* + 1) where *m* = ``A_ORDER``.\n\nb : ndarray\n    The ``B_i_j`` polynomial for pixel to focal plane transformation as ``double array[m+1][m+1]``.\n    Its size must be (*m* + 1, *m* + 1) where *m* = ``B_ORDER``.\n\nap : ndarray\n    The ``AP_i_j`` polynomial for pixel to focal plane transformation as ``double array[m+1][m+1]``.\n    Its size must be (*m* + 1, *m* + 1) where *m* = ``AP_ORDER``.\n\nbp : ndarray\n    The ``BP_i_j`` polynomial for pixel to focal plane transformation as ``double array[m+1][m+1]``.\n    Its size must be (*m* + 1, *m* + 1) where *m* = ``BP_ORDER``.\n\ncrpix : ndarray\n    The reference pixel as ``double array[2]``.\n\nNotes\n-----\nShupe, D. L., M. Moshir, J. Li, D. Makovoz and R. Narron.  2005.\n\"The SIP Convention for Representing Distortion in FITS Image\nHeaders.\"  ADASS XIV.\n\"\"\"\n\nsip_foc2pix = \"\"\"\nsip_foc2pix(*foccrd, origin*) -> ``double array[ncoord][nelem]``\n\nConvert focal plane coordinates to pixel coordinates using the `SIP`_\npolynomial distortion convention.\n\nParameters\n----------\nfoccrd : ndarray\n    Array of focal plane coordinates as ``double array[ncoord][nelem]``.\n\n{}\n\nReturns\n-------\npixcrd : ndarray\n    Returns an array of pixel coordinates as ``double array[ncoord][nelem]``.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nValueError\n    Invalid coordinate transformation parameters.\n\"\"\".format(ORIGIN())\n\nsip_pix2foc = \"\"\"\nsip_pix2foc(*pixcrd, origin*) -> ``double array[ncoord][nelem]``\n\nConvert pixel coordinates to focal plane coordinates using the `SIP`_\npolynomial distortion convention.\n\nParameters\n----------\npixcrd : ndarray\n    Array of pixel coordinates as ``double array[ncoord][nelem]``.\n\n{}\n\nReturns\n-------\nfoccrd : ndarray\n    Returns an array of focal plane coordinates as ``double array[ncoord][nelem]``.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nValueError\n    Invalid coordinate transformation parameters.\n\"\"\".format(ORIGIN())\n\nspcfix = \"\"\"\nspcfix() -> int\n\nTranslates AIPS-convention spectral coordinate types.  {``FREQ``,\n``VELO``, ``FELO``}-{``OBS``, ``HEL``, ``LSR``} (e.g. ``FREQ-LSR``,\n``VELO-OBS``, ``FELO-HEL``)\n\nReturns\n-------\nsuccess : int\n    Returns ``0`` for success; ``-1`` if no change required.\n\"\"\"\n\nspec = \"\"\"\n``int`` (read-only) The index containing the spectral axis values.\n\"\"\"\n\nspecsys = \"\"\"\n``string`` Spectral reference frame (standard of rest), ``SPECSYSa``.\n\nSee also\n--------\nastropy.wcs.Wcsprm.ssysobs, astropy.wcs.Wcsprm.velosys\n\"\"\"\n\nsptr = \"\"\"\nsptr(ctype, i=-1)\n\nTranslates the spectral axis in a WCS object.\n\nFor example, a ``FREQ`` axis may be translated into ``ZOPT-F2W`` and\nvice versa.\n\nParameters\n----------\nctype : str\n    Required spectral ``CTYPEia``, maximum of 8 characters.  The first\n    four characters are required to be given and are never modified.\n    The remaining four, the algorithm code, are completely determined\n    by, and must be consistent with, the first four characters.\n    Wildcarding may be used, i.e.  if the final three characters are\n    specified as ``\\\"???\\\"``, or if just the eighth character is\n    specified as ``\\\"?\\\"``, the correct algorithm code will be\n    substituted and returned.\n\ni : int\n    Index of the spectral axis (0-relative).  If ``i < 0`` (or not\n    provided), it will be set to the first spectral axis identified\n    from the ``CTYPE`` keyvalues in the FITS header.\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nSingularMatrixError\n    Linear transformation matrix is singular.\n\nInconsistentAxisTypesError\n    Inconsistent or unrecognized coordinate axis types.\n\nValueError\n    Invalid parameter value.\n\nInvalidTransformError\n    Invalid coordinate transformation parameters.\n\nInvalidTransformError\n    Ill-conditioned coordinate transformation parameters.\n\nInvalidSubimageSpecificationError\n    Invalid subimage specification (no spectral axis).\n\"\"\"\n\nssysobs = \"\"\"\n``string`` Spectral reference frame.\n\nThe spectral reference frame in which there is no differential\nvariation in the spectral coordinate across the field-of-view,\n``SSYSOBSa``.\n\nSee also\n--------\nastropy.wcs.Wcsprm.specsys, astropy.wcs.Wcsprm.velosys\n\"\"\"\n\nssyssrc = \"\"\"\n``string`` Spectral reference frame for redshift.\n\nThe spectral reference frame (standard of rest) in which the redshift\nwas measured, ``SSYSSRCa``.\n\"\"\"\n\nsub = \"\"\"\nsub(axes)\n\nExtracts the coordinate description for a subimage from a\n`~astropy.wcs.WCS` object.\n\nThe world coordinate system of the subimage must be separable in the\nsense that the world coordinates at any point in the subimage must\ndepend only on the pixel coordinates of the axes extracted.  In\npractice, this means that the ``PCi_ja`` matrix of the original image\nmust not contain non-zero off-diagonal terms that associate any of the\nsubimage axes with any of the non-subimage axes.\n\n`sub` can also add axes to a wcsprm object.  The new axes will be\ncreated using the defaults set by the Wcsprm constructor which produce\na simple, unnamed, linear axis with world coordinates equal to the\npixel coordinate.  These default values can be changed before\ninvoking `set`.\n\nParameters\n----------\naxes : int or a sequence.\n\n    - If an int, include the first *N* axes in their original order.\n\n    - If a sequence, may contain a combination of image axis numbers\n      (1-relative) or special axis identifiers (see below).  Order is\n      significant; ``axes[0]`` is the axis number of the input image\n      that corresponds to the first axis in the subimage, etc.  Use an\n      axis number of 0 to create a new axis using the defaults.\n\n    - If ``0``, ``[]`` or ``None``, do a deep copy.\n\n    Coordinate axes types may be specified using either strings or\n    special integer constants.  The available types are:\n\n    - ``'longitude'`` / ``WCSSUB_LONGITUDE``: Celestial longitude\n\n    - ``'latitude'`` / ``WCSSUB_LATITUDE``: Celestial latitude\n\n    - ``'cubeface'`` / ``WCSSUB_CUBEFACE``: Quadcube ``CUBEFACE`` axis\n\n    - ``'spectral'`` / ``WCSSUB_SPECTRAL``: Spectral axis\n\n    - ``'stokes'`` / ``WCSSUB_STOKES``: Stokes axis\n\n    - ``'celestial'`` / ``WCSSUB_CELESTIAL``: An alias for the\n      combination of ``'longitude'``, ``'latitude'`` and ``'cubeface'``.\n\nReturns\n-------\nnew_wcs : `~astropy.wcs.WCS` object\n\nRaises\n------\nMemoryError\n    Memory allocation failed.\n\nInvalidSubimageSpecificationError\n    Invalid subimage specification (no spectral axis).\n\nNonseparableSubimageCoordinateSystemError\n    Non-separable subimage coordinate system.\n\nNotes\n-----\nCombinations of subimage axes of particular types may be extracted in\nthe same order as they occur in the input image by combining the\ninteger constants with the 'binary or' (``|``) operator.  For\nexample::\n\n    wcs.sub([WCSSUB_LONGITUDE | WCSSUB_LATITUDE | WCSSUB_SPECTRAL])\n\nwould extract the longitude, latitude, and spectral axes in the same\norder as the input image.  If one of each were present, the resulting\nobject would have three dimensions.\n\nFor convenience, ``WCSSUB_CELESTIAL`` is defined as the combination\n``WCSSUB_LONGITUDE | WCSSUB_LATITUDE | WCSSUB_CUBEFACE``.\n\nThe codes may also be negated to extract all but the types specified,\nfor example::\n\n    wcs.sub([\n      WCSSUB_LONGITUDE,\n      WCSSUB_LATITUDE,\n      WCSSUB_CUBEFACE,\n      -(WCSSUB_SPECTRAL | WCSSUB_STOKES)])\n\nThe last of these specifies all axis types other than spectral or\nStokes.  Extraction is done in the order specified by ``axes``, i.e. a\nlongitude axis (if present) would be extracted first (via ``axes[0]``)\nand not subsequently (via ``axes[3]``).  Likewise for the latitude and\ncubeface axes in this example.\n\nThe number of dimensions in the returned object may be less than or\ngreater than the length of ``axes``.  However, it will never exceed the\nnumber of axes in the input image.\n\"\"\"\n\ntab = \"\"\"\n``list of Tabprm`` Tabular coordinate objects.\n\nA list of tabular coordinate objects associated with this WCS.\n\"\"\"\n\nTabprm = \"\"\"\nA class to store the information related to tabular coordinates,\ni.e., coordinates that are defined via a lookup table.\n\nThis class can not be constructed directly from Python, but instead is\nreturned from `~astropy.wcs.Wcsprm.tab`.\n\"\"\"\n\ntheta0 = \"\"\"\n``double``  The native longitude of the fiducial point.\n\nThe point whose celestial coordinates are given in ``ref[1:2]``.  If\nundefined (NaN) the initialization routine, `~astropy.wcs.Wcsprm.set`,\nwill set this to a projection-specific default.\n\nSee also\n--------\nastropy.wcs.Wcsprm.phi0\n\"\"\"\n\nto_header = \"\"\"\nto_header(relax=False)\n\n`to_header` translates a WCS object into a FITS header.\n\nThe details of the header depends on context:\n\n    - If the `~astropy.wcs.Wcsprm.colnum` member is non-zero then a\n      binary table image array header will be produced.\n\n    - Otherwise, if the `~astropy.wcs.Wcsprm.colax` member is set\n      non-zero then a pixel list header will be produced.\n\n    - Otherwise, a primary image or image extension header will be\n      produced.\n\nThe output header will almost certainly differ from the input in a\nnumber of respects:\n\n    1. The output header only contains WCS-related keywords.  In\n       particular, it does not contain syntactically-required keywords\n       such as ``SIMPLE``, ``NAXIS``, ``BITPIX``, or ``END``.\n\n    2. Deprecated (e.g. ``CROTAn``) or non-standard usage will be\n       translated to standard (this is partially dependent on whether\n       ``fix`` was applied).\n\n    3. Quantities will be converted to the units used internally,\n       basically SI with the addition of degrees.\n\n    4. Floating-point quantities may be given to a different decimal\n       precision.\n\n    5. Elements of the ``PCi_j`` matrix will be written if and only if\n       they differ from the unit matrix.  Thus, if the matrix is unity\n       then no elements will be written.\n\n    6. Additional keywords such as ``WCSAXES``, ``CUNITia``,\n       ``LONPOLEa`` and ``LATPOLEa`` may appear.\n\n    7. The original keycomments will be lost, although\n       `~astropy.wcs.Wcsprm.to_header` tries hard to write meaningful\n       comments.\n\n    8. Keyword order may be changed.\n\nKeywords can be translated between the image array, binary table, and\npixel lists forms by manipulating the `~astropy.wcs.Wcsprm.colnum` or\n`~astropy.wcs.Wcsprm.colax` members of the `~astropy.wcs.WCS`\nobject.\n\nParameters\n----------\n\nrelax : bool or int\n    Degree of permissiveness:\n\n    - `False`: Recognize only FITS keywords defined by the published\n      WCS standard.\n\n    - `True`: Admit all recognized informal extensions of the WCS\n      standard.\n\n    - `int`: a bit field selecting specific extensions to write.\n      See :ref:`astropy:relaxwrite` for details.\n\nReturns\n-------\nheader : str\n    Raw FITS header as a string.\n\"\"\"\n\nttype = \"\"\"\n``str`` (read-only) ``TTYPEn`` identifying the column of the binary table that contains\nthe wcstab array.\n\"\"\"\n\nunitfix = \"\"\"\nunitfix(translate_units='')\n\nTranslates non-standard ``CUNITia`` keyvalues.\n\nFor example, ``DEG`` -> ``deg``, also stripping off unnecessary\nwhitespace.\n\nParameters\n----------\ntranslate_units : str, optional\n    Do potentially unsafe translations of non-standard unit strings.\n\n    Although ``\\\"S\\\"`` is commonly used to represent seconds, its\n    recognizes ``\\\"S\\\"`` formally as Siemens, however rarely that may\n    be translation to ``\\\"s\\\"`` is potentially unsafe since the\n    standard used.  The same applies to ``\\\"H\\\"`` for hours (Henry),\n    and ``\\\"D\\\"`` for days (Debye).\n\n    This string controls what to do in such cases, and is\n    case-insensitive.\n\n    - If the string contains ``\\\"s\\\"``, translate ``\\\"S\\\"`` to ``\\\"s\\\"``.\n\n    - If the string contains ``\\\"h\\\"``, translate ``\\\"H\\\"`` to ``\\\"h\\\"``.\n\n    - If the string contains ``\\\"d\\\"``, translate ``\\\"D\\\"`` to ``\\\"d\\\"``.\n\n    Thus ``''`` doesn't do any unsafe translations, whereas ``'shd'``\n    does all of them.\n\nReturns\n-------\nsuccess : int\n    Returns ``0`` for success; ``-1`` if no change required.\n\"\"\"\n\nvelangl = \"\"\"\n``double`` Velocity angle.\n\nThe angle in degrees that should be used to decompose an observed\nvelocity into radial and transverse components.\n\nAn undefined value is represented by NaN.\n\"\"\"\n\nvelosys = \"\"\"\n``double`` Relative radial velocity.\n\nThe relative radial velocity (m/s) between the observer and the\nselected standard of rest in the direction of the celestial reference\ncoordinate, ``VELOSYSa``.\n\nAn undefined value is represented by NaN.\n\nSee also\n--------\nastropy.wcs.Wcsprm.specsys, astropy.wcs.Wcsprm.ssysobs\n\"\"\"\n\nvelref = \"\"\"\n``int`` AIPS velocity code.\n\nFrom ``VELREF`` keyword.\n\"\"\"\n\nwcs = \"\"\"\nA `~astropy.wcs.Wcsprm` object to perform the basic `wcslib`_ WCS\ntransformation.\n\"\"\"\n\nWcs = \"\"\"\nWcs(*sip, cpdis, wcsprm, det2im*)\n\nWcs objects amalgamate basic WCS (as provided by `wcslib`_), with\n`SIP`_ and `distortion paper`_ operations.\n\nTo perform all distortion corrections and WCS transformation, use\n``all_pix2world``.\n\nParameters\n----------\nsip : `~astropy.wcs.Sip` object or None\n\ncpdis : (2,) tuple of `~astropy.wcs.DistortionLookupTable` or None\n\nwcsprm : `~astropy.wcs.Wcsprm`\n\ndet2im : (2,) tuple of `~astropy.wcs.DistortionLookupTable` or None\n\"\"\"\n\nWcsprm = \"\"\"\nWcsprm(header=None, key=' ', relax=False, naxis=2, keysel=0, colsel=None)\n\n`~astropy.wcs.Wcsprm` performs the core WCS transformations.\n\n.. note::\n    The members of this object correspond roughly to the key/value\n    pairs in the FITS header.  However, they are adjusted and\n    normalized in a number of ways that make performing the WCS\n    transformation easier.  Therefore, they can not be relied upon to\n    get the original values in the header.  For that, use\n    `astropy.io.fits.Header` directly.\n\nThe FITS header parsing enforces correct FITS \"keyword = value\" syntax\nwith regard to the equals sign occurring in columns 9 and 10.\nHowever, it does recognize free-format character (NOST 100-2.0,\nSect. 5.2.1), integer (Sect. 5.2.3), and floating-point values\n(Sect. 5.2.4) for all keywords.\n\n\n.. warning::\n\n    Many of the attributes of this class require additional processing when\n    modifying underlying C structure.  When needed, this additional processing\n    is implemented in attribute setters. Therefore, for mutable attributes, one\n    should always set the attribute rather than a slice of its current value (or\n    its individual elements) since the latter may lead the class instance to be\n    in an invalid state.  For example, attribute ``crpix`` of a 2D WCS'\n    ``Wcsprm`` object ``wcs`` should be set as ``wcs.crpix = [crpix1, crpix2]``\n    instead of ``wcs.crpix[0] = crpix1; wcs.crpix[1] = crpix2]``.\n\n\nParameters\n----------\nheader : `~astropy.io.fits.Header`, str, or None.\n  If ``None``, the object will be initialized to default values.\n\nkey : str, optional\n    The key referring to a particular WCS transform in the header.\n    This may be either ``' '`` or ``'A'``-``'Z'`` and corresponds to\n    the ``\\\"a\\\"`` part of ``\\\"CTYPEia\\\"``.  (*key* may only be\n    provided if *header* is also provided.)\n\nrelax : bool or int, optional\n\n    Degree of permissiveness:\n\n    - `False`: Recognize only FITS keywords defined by the published\n      WCS standard.\n\n    - `True`: Admit all recognized informal extensions of the WCS\n      standard.\n\n    - `int`: a bit field selecting specific extensions to accept.  See\n      :ref:`astropy:relaxread` for details.\n\nnaxis : int, optional\n    The number of world coordinates axes for the object.  (*naxis* may\n    only be provided if *header* is `None`.)\n\nkeysel : sequence of flag bits, optional\n    Vector of flag bits that may be used to restrict the keyword types\n    considered:\n\n        - ``WCSHDR_IMGHEAD``: Image header keywords.\n\n        - ``WCSHDR_BIMGARR``: Binary table image array.\n\n        - ``WCSHDR_PIXLIST``: Pixel list keywords.\n\n    If zero, there is no restriction.  If -1, the underlying wcslib\n    function ``wcspih()`` is called, rather than ``wcstbh()``.\n\ncolsel : sequence of int\n    A sequence of table column numbers used to restrict the keywords\n    considered.  `None` indicates no restriction.\n\nRaises\n------\nMemoryError\n     Memory allocation failed.\n\nValueError\n     Invalid key.\n\nKeyError\n     Key not found in FITS header.\n\"\"\"\n\nwtb = \"\"\"\n``list of Wtbarr`` objects to construct coordinate lookup tables from BINTABLE.\n\n\"\"\"\n\nWtbarr = \"\"\"\nClasses to construct coordinate lookup tables from a binary table\nextension (BINTABLE).\n\nThis class can not be constructed directly from Python, but instead is\nreturned from `~astropy.wcs.Wcsprm.wtb`.\n\"\"\"\n\nzsource = \"\"\"\n``double`` The redshift, ``ZSOURCEa``, of the source.\n\nAn undefined value is represented by NaN.\n\"\"\"\n\nWcsError = \"\"\"\nBase class of all invalid WCS errors.\n\"\"\"\n\nSingularMatrix = \"\"\"\nSingularMatrixError()\n\nThe linear transformation matrix is singular.\n\"\"\"\n\nInconsistentAxisTypes = \"\"\"\nInconsistentAxisTypesError()\n\nThe WCS header inconsistent or unrecognized coordinate axis type(s).\n\"\"\"\n\nInvalidTransform = \"\"\"\nInvalidTransformError()\n\nThe WCS transformation is invalid, or the transformation parameters\nare invalid.\n\"\"\"\n\nInvalidCoordinate = \"\"\"\nInvalidCoordinateError()\n\nOne or more of the world coordinates is invalid.\n\"\"\"\n\nNoSolution = \"\"\"\nNoSolutionError()\n\nNo solution can be found in the given interval.\n\"\"\"\n\nInvalidSubimageSpecification = \"\"\"\nInvalidSubimageSpecificationError()\n\nThe subimage specification is invalid.\n\"\"\"\n\nNonseparableSubimageCoordinateSystem = \"\"\"\nNonseparableSubimageCoordinateSystemError()\n\nNon-separable subimage coordinate system.\n\"\"\"\n\nNoWcsKeywordsFound = \"\"\"\nNoWcsKeywordsFoundError()\n\nNo WCS keywords were found in the given header.\n\"\"\"\n\nInvalidTabularParameters = \"\"\"\nInvalidTabularParametersError()\n\nThe given tabular parameters are invalid.\n\"\"\"\n\nInvalidPrjParameters = \"\"\"\nInvalidPrjParametersError()\n\nThe given projection parameters are invalid.\n\"\"\"\n\nmjdbeg = \"\"\"\n``double`` Modified Julian Date corresponding to ``DATE-BEG``.\n\n``(MJD = JD - 2400000.5)``.\n\nAn undefined value is represented by NaN.\n\nSee also\n--------\nastropy.wcs.Wcsprm.mjdbeg\n\"\"\"\n\nmjdend = \"\"\"\n``double`` Modified Julian Date corresponding to ``DATE-END``.\n\n``(MJD = JD - 2400000.5)``.\n\nAn undefined value is represented by NaN.\n\nSee also\n--------\nastropy.wcs.Wcsprm.mjdend\n\"\"\"\n\nmjdref = \"\"\"\n``double`` Modified Julian Date corresponding to ``DATE-REF``.\n\n``(MJD = JD - 2400000.5)``.\n\nAn undefined value is represented by NaN.\n\nSee also\n--------\nastropy.wcs.Wcsprm.dateref\n\"\"\"\n\nbepoch = \"\"\"\n``double`` Equivalent to ``DATE-OBS``.\n\nExpressed as a Besselian epoch.\n\nSee also\n--------\nastropy.wcs.Wcsprm.dateobs\n\"\"\"\n\njepoch = \"\"\"\n``double`` Equivalent to ``DATE-OBS``.\n\nExpressed as a Julian epoch.\n\nSee also\n--------\nastropy.wcs.Wcsprm.dateobs\n\"\"\"\n\ndatebeg = \"\"\"\n``string`` Date at the start of the observation.\n\nIn ISO format, ``yyyy-mm-ddThh:mm:ss``.\n\nSee also\n--------\nastropy.wcs.Wcsprm.datebeg\n\"\"\"\n\ndateend = \"\"\"\n``string`` Date at the end of the observation.\n\nIn ISO format, ``yyyy-mm-ddThh:mm:ss``.\n\nSee also\n--------\nastropy.wcs.Wcsprm.dateend\n\"\"\"\n\ndateref = \"\"\"\n``string`` Date of a reference epoch relative to which\nother time measurements refer.\n\nSee also\n--------\nastropy.wcs.Wcsprm.dateref\n\"\"\"\n\ntimesys = \"\"\"\n``string`` Time scale (UTC, TAI, etc.) in which all other time-related\nauxiliary header values are recorded. Also defines the time scale for\nan image axis with CTYPEia set to 'TIME'.\n\nSee also\n--------\nastropy.wcs.Wcsprm.timesys\n\"\"\"\n\ntrefpos = \"\"\"\n``string`` Location in space where the recorded time is valid.\n\nSee also\n--------\nastropy.wcs.Wcsprm.trefpos\n\"\"\"\n\ntrefdir = \"\"\"\n``string`` Reference direction used in calculating a pathlength delay.\n\nSee also\n--------\nastropy.wcs.Wcsprm.trefdir\n\"\"\"\n\ntimeunit = \"\"\"\n``string`` Time units in which the following header values are expressed:\n``TSTART``, ``TSTOP``, ``TIMEOFFS``, ``TIMSYER``, ``TIMRDER``, ``TIMEDEL``.\n\nIt also provides the default value for ``CUNITia`` for time axes.\n\nSee also\n--------\nastropy.wcs.Wcsprm.trefdir\n\"\"\"\n\nplephem = \"\"\"\n``string`` The Solar System ephemeris used for calculating a pathlength delay.\n\nSee also\n--------\nastropy.wcs.Wcsprm.plephem\n\"\"\"\n\ntstart = \"\"\"\n``double`` equivalent to DATE-BEG expressed as a time in units of TIMEUNIT relative to DATEREF+TIMEOFFS.\n\nSee also\n--------\nastropy.wcs.Wcsprm.tstop\n\"\"\"\n\ntstop = \"\"\"\n``double`` equivalent to DATE-END expressed as a time in units of TIMEUNIT relative to DATEREF+TIMEOFFS.\n\nSee also\n--------\nastropy.wcs.Wcsprm.tstart\n\"\"\"\n\ntelapse = \"\"\"\n``double`` equivalent to the elapsed time between DATE-BEG and DATE-END, in units of TIMEUNIT.\n\nSee also\n--------\nastropy.wcs.Wcsprm.tstart\n\"\"\"\n\ntimeoffs = \"\"\"\n``double`` Time offset, which may be used, for example, to provide a uniform clock correction\n           for times referenced to DATEREF.\n\nSee also\n--------\nastropy.wcs.Wcsprm.timeoffs\n\"\"\"\n\ntimsyer = \"\"\"\n``double`` the absolute error of the time values, in units of TIMEUNIT.\n\nSee also\n--------\nastropy.wcs.Wcsprm.timrder\n\"\"\"\n\ntimrder = \"\"\"\n``double`` the accuracy of time stamps relative to each other, in units of TIMEUNIT.\n\nSee also\n--------\nastropy.wcs.Wcsprm.timsyer\n\"\"\"\n\ntimedel = \"\"\"\n``double`` the resolution of the time stamps.\n\nSee also\n--------\nastropy.wcs.Wcsprm.timedel\n\"\"\"\n\ntimepixr = \"\"\"\n``double`` relative position of the time stamps in binned time intervals, a value between 0.0 and 1.0.\n\nSee also\n--------\nastropy.wcs.Wcsprm.timepixr\n\"\"\"\n\nobsorbit = \"\"\"\n``string`` URI, URL, or name of an orbit ephemeris file giving spacecraft coordinates relating to TREFPOS.\n\nSee also\n--------\nastropy.wcs.Wcsprm.trefpos\n\n\"\"\"\n\nxposure = \"\"\"\n``double`` effective exposure time in units of TIMEUNIT.\n\nSee also\n--------\nastropy.wcs.Wcsprm.timeunit\n\"\"\"\n\nczphs = \"\"\"\n``double array[naxis]`` The time at the zero point of a phase axis, ``CSPHSia``.\n\nAn undefined value is represented by NaN.\n\"\"\"\n\ncperi = \"\"\"\n``double array[naxis]`` period of a phase axis, CPERIia.\n\nAn undefined value is represented by NaN.\n\"\"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":1944,"id":7475,"name":"_pos","nodeType":"Attribute","startLoc":1944,"text":"self._pos"},{"col":0,"comment":"null","endLoc":68,"header":"def _invalidate_reprdiff_cls_hash()","id":7476,"name":"_invalidate_reprdiff_cls_hash","nodeType":"Function","startLoc":66,"text":"def _invalidate_reprdiff_cls_hash():\n    global _REPRDIFF_HASH\n    _REPRDIFF_HASH = None"},{"col":20,"endLoc":182,"id":7477,"nodeType":"Lambda","startLoc":182,"text":"lambda x: x[0] == wao_components[i][0]"},{"col":0,"comment":"Make an attribute getter for use in a property.\n\n    Parameters\n    ----------\n    component : str\n        The name of the component that should be accessed.  This assumes the\n        actual value is stored in an attribute of that name prefixed by '_'.\n    ","endLoc":551,"header":"def _make_getter(component)","id":7478,"name":"_make_getter","nodeType":"Function","startLoc":536,"text":"def _make_getter(component):\n    \"\"\"Make an attribute getter for use in a property.\n\n    Parameters\n    ----------\n    component : str\n        The name of the component that should be accessed.  This assumes the\n        actual value is stored in an attribute of that name prefixed by '_'.\n    \"\"\"\n    # This has to be done in a function to ensure the reference to component\n    # is not lost/redirected.\n    component = '_' + component\n\n    def get_component(self):\n        return getattr(self, component)\n    return get_component"},{"col":4,"comment":"null","endLoc":190,"header":"@property\n    def pixel_n_dim(self)","id":7479,"name":"pixel_n_dim","nodeType":"Function","startLoc":188,"text":"@property\n    def pixel_n_dim(self):\n        return len(self._pixel_keep)"},{"col":4,"comment":"null","endLoc":194,"header":"@property\n    def world_n_dim(self)","id":7480,"name":"world_n_dim","nodeType":"Function","startLoc":192,"text":"@property\n    def world_n_dim(self):\n        return len(self._world_keep)"},{"col":4,"comment":"null","endLoc":198,"header":"@property\n    def world_axis_physical_types(self)","id":7481,"name":"world_axis_physical_types","nodeType":"Function","startLoc":196,"text":"@property\n    def world_axis_physical_types(self):\n        return [self._wcs.world_axis_physical_types[i] for i in self._world_keep]"},{"col":4,"comment":"null","endLoc":202,"header":"@property\n    def world_axis_units(self)","id":7482,"name":"world_axis_units","nodeType":"Function","startLoc":200,"text":"@property\n    def world_axis_units(self):\n        return [self._wcs.world_axis_units[i] for i in self._world_keep]"},{"col":4,"comment":"null","endLoc":206,"header":"@property\n    def pixel_axis_names(self)","id":7483,"name":"pixel_axis_names","nodeType":"Function","startLoc":204,"text":"@property\n    def pixel_axis_names(self):\n        return [self._wcs.pixel_axis_names[i] for i in self._pixel_keep]"},{"col":4,"comment":"null","endLoc":210,"header":"@property\n    def world_axis_names(self)","id":7484,"name":"world_axis_names","nodeType":"Function","startLoc":208,"text":"@property\n    def world_axis_names(self):\n        return [self._wcs.world_axis_names[i] for i in self._world_keep]"},{"col":4,"comment":"null","endLoc":243,"header":"def pixel_to_world_values(self, *pixel_arrays)","id":7485,"name":"pixel_to_world_values","nodeType":"Function","startLoc":229,"text":"def pixel_to_world_values(self, *pixel_arrays):\n        world_arrays = self._pixel_to_world_values_all(*pixel_arrays)\n\n        # Detect the case of a length 0 array\n        if isinstance(world_arrays, np.ndarray) and not world_arrays.shape:\n            return world_arrays\n\n        if self._wcs.world_n_dim > 1:\n            # Select the dimensions of the original WCS we are keeping.\n            world_arrays = [world_arrays[iw] for iw in self._world_keep]\n            # If there is only one world dimension (after slicing) we shouldn't return a tuple.\n            if self.world_n_dim == 1:\n                world_arrays = world_arrays[0]\n\n        return world_arrays"},{"col":4,"comment":"\n        Used to raise a consistent exception for any operation that is not\n        supported when a representation has differentials attached.\n        ","endLoc":745,"header":"def _raise_if_has_differentials(self, op_name)","id":7486,"name":"_raise_if_has_differentials","nodeType":"Function","startLoc":737,"text":"def _raise_if_has_differentials(self, op_name):\n        \"\"\"\n        Used to raise a consistent exception for any operation that is not\n        supported when a representation has differentials attached.\n        \"\"\"\n        if self.differentials:\n            raise TypeError(\"Operation '{}' is not supported when \"\n                            \"differentials are attached to a {}.\"\n                            .format(op_name, self.__class__.__name__))"},{"col":4,"comment":"null","endLoc":749,"header":"@classproperty\n    def _compatible_differentials(cls)","id":7487,"name":"_compatible_differentials","nodeType":"Function","startLoc":747,"text":"@classproperty\n    def _compatible_differentials(cls):\n        return [DIFFERENTIAL_CLASSES[cls.get_name()]]"},{"col":4,"comment":"A dictionary of differential class instances.\n\n        The keys of this dictionary must be a string representation of the SI\n        unit with which the differential (derivative) is taken. For example, for\n        a velocity differential on a positional representation, the key would be\n        ``'s'`` for seconds, indicating that the derivative is a time\n        derivative.\n        ","endLoc":761,"header":"@property\n    def differentials(self)","id":7488,"name":"differentials","nodeType":"Function","startLoc":751,"text":"@property\n    def differentials(self):\n        \"\"\"A dictionary of differential class instances.\n\n        The keys of this dictionary must be a string representation of the SI\n        unit with which the differential (derivative) is taken. For example, for\n        a velocity differential on a positional representation, the key would be\n        ``'s'`` for seconds, indicating that the derivative is a time\n        derivative.\n        \"\"\"\n        return self._differentials"},{"col":4,"comment":"Cartesian unit vectors in the direction of each component.\n\n        Given unit vectors :math:`\\hat{e}_c` and scale factors :math:`f_c`,\n        a change in one component of :math:`\\delta c` corresponds to a change\n        in representation of :math:`\\delta c \\times f_c \\times \\hat{e}_c`.\n\n        Returns\n        -------\n        unit_vectors : dict of `CartesianRepresentation`\n            The keys are the component names.\n        ","endLoc":778,"header":"def unit_vectors(self)","id":7489,"name":"unit_vectors","nodeType":"Function","startLoc":766,"text":"def unit_vectors(self):\n        r\"\"\"Cartesian unit vectors in the direction of each component.\n\n        Given unit vectors :math:`\\hat{e}_c` and scale factors :math:`f_c`,\n        a change in one component of :math:`\\delta c` corresponds to a change\n        in representation of :math:`\\delta c \\times f_c \\times \\hat{e}_c`.\n\n        Returns\n        -------\n        unit_vectors : dict of `CartesianRepresentation`\n            The keys are the component names.\n        \"\"\"\n        raise NotImplementedError(f\"{type(self)} has not implemented unit vectors\")"},{"col":4,"comment":"null","endLoc":269,"header":"def world_to_pixel_values(self, *world_arrays)","id":7490,"name":"world_to_pixel_values","nodeType":"Function","startLoc":245,"text":"def world_to_pixel_values(self, *world_arrays):\n        world_arrays = tuple(map(np.asanyarray, world_arrays))\n        world_arrays_new = []\n        iworld_curr = -1\n        for iworld in range(self._wcs.world_n_dim):\n            if iworld in self._world_keep:\n                iworld_curr += 1\n                world_arrays_new.append(world_arrays[iworld_curr])\n            else:\n                world_arrays_new.append(1.)\n\n        world_arrays_new = np.broadcast_arrays(*world_arrays_new)\n        pixel_arrays = list(self._wcs.world_to_pixel_values(*world_arrays_new))\n\n        for ipixel in range(self._wcs.pixel_n_dim):\n            if isinstance(self._slices_pixel[ipixel], slice) and self._slices_pixel[ipixel].start is not None:\n                pixel_arrays[ipixel] -= self._slices_pixel[ipixel].start\n\n        # Detect the case of a length 0 array\n        if isinstance(pixel_arrays, np.ndarray) and not pixel_arrays.shape:\n            return pixel_arrays\n        pixel = tuple(pixel_arrays[ip] for ip in self._pixel_keep)\n        if self.pixel_n_dim == 1 and self._wcs.pixel_n_dim > 1:\n            pixel = pixel[0]\n        return pixel"},{"col":4,"comment":"Scale factors for each component's direction.\n\n        Given unit vectors :math:`\\hat{e}_c` and scale factors :math:`f_c`,\n        a change in one component of :math:`\\delta c` corresponds to a change\n        in representation of :math:`\\delta c \\times f_c \\times \\hat{e}_c`.\n\n        Returns\n        -------\n        scale_factors : dict of `~astropy.units.Quantity`\n            The keys are the component names.\n        ","endLoc":792,"header":"def scale_factors(self)","id":7491,"name":"scale_factors","nodeType":"Function","startLoc":780,"text":"def scale_factors(self):\n        r\"\"\"Scale factors for each component's direction.\n\n        Given unit vectors :math:`\\hat{e}_c` and scale factors :math:`f_c`,\n        a change in one component of :math:`\\delta c` corresponds to a change\n        in representation of :math:`\\delta c \\times f_c \\times \\hat{e}_c`.\n\n        Returns\n        -------\n        scale_factors : dict of `~astropy.units.Quantity`\n            The keys are the component names.\n        \"\"\"\n        raise NotImplementedError(f\"{type(self)} has not implemented scale factors.\")"},{"col":4,"comment":"Transform coordinates using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n\n        ","endLoc":904,"header":"def transform(self, matrix)","id":7492,"name":"transform","nodeType":"Function","startLoc":882,"text":"def transform(self, matrix):\n        \"\"\"Transform coordinates using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n\n        \"\"\"\n        # route transformation through Cartesian\n        difs_cls = {k: CartesianDifferential for k in self.differentials.keys()}\n        crep = self.represent_as(CartesianRepresentation,\n                                 differential_class=difs_cls\n                                ).transform(matrix)\n\n        # move back to original representation\n        difs_cls = {k: diff.__class__ for k, diff in self.differentials.items()}\n        rep = crep.represent_as(self.__class__, difs_cls)\n        return rep"},{"col":4,"comment":"null","endLoc":273,"header":"@property\n    def world_axis_object_components(self)","id":7493,"name":"world_axis_object_components","nodeType":"Function","startLoc":271,"text":"@property\n    def world_axis_object_components(self):\n        return [self._wcs.world_axis_object_components[idx] for idx in self._world_keep]"},{"col":4,"comment":"null","endLoc":278,"header":"@property\n    def world_axis_object_classes(self)","id":7494,"name":"world_axis_object_classes","nodeType":"Function","startLoc":275,"text":"@property\n    def world_axis_object_classes(self):\n        keys_keep = [item[0] for item in self.world_axis_object_components]\n        return dict([item for item in self._wcs.world_axis_object_classes.items() if item[0] in keys_keep])"},{"col":4,"comment":"\n        Create a new representation with the same positions as this\n        representation, but with these new differentials.\n\n        Differential keys that already exist in this object's differential dict\n        are overwritten.\n\n        Parameters\n        ----------\n        differentials : sequence of `~astropy.coordinates.BaseDifferential` subclass instance\n            The differentials for the new representation to have.\n\n        Returns\n        -------\n        `~astropy.coordinates.BaseRepresentation` subclass instance\n            A copy of this representation, but with the ``differentials`` as\n            its differentials.\n        ","endLoc":937,"header":"def with_differentials(self, differentials)","id":7495,"name":"with_differentials","nodeType":"Function","startLoc":906,"text":"def with_differentials(self, differentials):\n        \"\"\"\n        Create a new representation with the same positions as this\n        representation, but with these new differentials.\n\n        Differential keys that already exist in this object's differential dict\n        are overwritten.\n\n        Parameters\n        ----------\n        differentials : sequence of `~astropy.coordinates.BaseDifferential` subclass instance\n            The differentials for the new representation to have.\n\n        Returns\n        -------\n        `~astropy.coordinates.BaseRepresentation` subclass instance\n            A copy of this representation, but with the ``differentials`` as\n            its differentials.\n        \"\"\"\n        if not differentials:\n            return self\n\n        args = [getattr(self, component) for component in self.components]\n\n        # We shallow copy the differentials dictionary so we don't update the\n        # current object's dictionary when adding new keys\n        new_rep = self.__class__(*args, differentials=self.differentials.copy(),\n                                 copy=False)\n        new_rep._differentials.update(\n            new_rep._validate_differentials(differentials))\n\n        return new_rep"},{"attributeType":"null","col":12,"comment":"null","endLoc":1955,"id":7496,"name":"_attr_list","nodeType":"Attribute","startLoc":1955,"text":"self._attr_list"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":7497,"name":"WCSROOT","nodeType":"Attribute","startLoc":18,"text":"WCSROOT"},{"col":4,"comment":"null","endLoc":283,"header":"@property\n    def array_shape(self)","id":7498,"name":"array_shape","nodeType":"Function","startLoc":280,"text":"@property\n    def array_shape(self):\n        if self._wcs.array_shape:\n            return np.broadcast_to(0, self._wcs.array_shape)[tuple(self._slices_array)].shape"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":7499,"name":"WCSVERSION","nodeType":"Attribute","startLoc":19,"text":"WCSVERSION"},{"col":0,"comment":"","endLoc":3,"header":"setup_package.py#<anonymous>","id":7500,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"WCSROOT = os.path.relpath(os.path.dirname(__file__))\n\nWCSVERSION = \"7.7\""},{"col":4,"comment":"null","endLoc":288,"header":"@property\n    def pixel_shape(self)","id":7501,"name":"pixel_shape","nodeType":"Function","startLoc":285,"text":"@property\n    def pixel_shape(self):\n        if self.array_shape:\n            return tuple(self.array_shape[::-1])"},{"col":4,"comment":"null","endLoc":304,"header":"@property\n    def pixel_bounds(self)","id":7502,"name":"pixel_bounds","nodeType":"Function","startLoc":290,"text":"@property\n    def pixel_bounds(self):\n        if self._wcs.pixel_bounds is None:\n            return\n\n        bounds = []\n        for idx in self._pixel_keep:\n            if self._slices_pixel[idx].start is None:\n                bounds.append(self._wcs.pixel_bounds[idx])\n            else:\n                imin, imax = self._wcs.pixel_bounds[idx]\n                start = self._slices_pixel[idx].start\n                bounds.append((imin - start, imax - start))\n\n        return tuple(bounds)"},{"fileName":"wcslint.py","filePath":"astropy/wcs","id":7503,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nScript support for validating the WCS keywords in a FITS file.\n\"\"\"\n\n\ndef main(args=None):\n    from . import wcs\n    import argparse\n\n    parser = argparse.ArgumentParser(\n        description=(\"Check the WCS keywords in a FITS file for \"\n                     \"compliance against the standards\"))\n    parser.add_argument(\n        'filename', nargs=1, help='Path to FITS file to check')\n    args = parser.parse_args(args)\n\n    print(wcs.validate(args.filename[0]))\n"},{"col":4,"comment":"null","endLoc":308,"header":"@property\n    def axis_correlation_matrix(self)","id":7504,"name":"axis_correlation_matrix","nodeType":"Function","startLoc":306,"text":"@property\n    def axis_correlation_matrix(self):\n        return self._wcs.axis_correlation_matrix[self._world_keep][:, self._pixel_keep]"},{"attributeType":"null","col":12,"comment":"null","endLoc":139,"id":7505,"name":"_slices_array","nodeType":"Attribute","startLoc":139,"text":"self._slices_array"},{"col":0,"comment":"null","endLoc":18,"header":"def main(args=None)","id":7506,"name":"main","nodeType":"Function","startLoc":7,"text":"def main(args=None):\n    from . import wcs\n    import argparse\n\n    parser = argparse.ArgumentParser(\n        description=(\"Check the WCS keywords in a FITS file for \"\n                     \"compliance against the standards\"))\n    parser.add_argument(\n        'filename', nargs=1, help='Path to FITS file to check')\n    args = parser.parse_args(args)\n\n    print(wcs.validate(args.filename[0]))"},{"col":4,"comment":"Create a new instance of this representation from another one.\n\n        Parameters\n        ----------\n        representation : `~astropy.coordinates.BaseRepresentation` instance\n            The presentation that should be converted to this class.\n        ","endLoc":964,"header":"@classmethod\n    def from_representation(cls, representation)","id":7507,"name":"from_representation","nodeType":"Function","startLoc":955,"text":"@classmethod\n    def from_representation(cls, representation):\n        \"\"\"Create a new instance of this representation from another one.\n\n        Parameters\n        ----------\n        representation : `~astropy.coordinates.BaseRepresentation` instance\n            The presentation that should be converted to this class.\n        \"\"\"\n        return representation.represent_as(cls)"},{"attributeType":"null","col":8,"comment":"null","endLoc":145,"id":7508,"name":"_pixel_keep","nodeType":"Attribute","startLoc":145,"text":"self._pixel_keep"},{"col":4,"comment":"Equality operator for BaseRepresentation\n\n        This implements strict equality and requires that the representation\n        classes are identical, the differentials are identical, and that the\n        representation data are exactly equal.\n        ","endLoc":985,"header":"def __eq__(self, value)","id":7509,"name":"__eq__","nodeType":"Function","startLoc":966,"text":"def __eq__(self, value):\n        \"\"\"Equality operator for BaseRepresentation\n\n        This implements strict equality and requires that the representation\n        classes are identical, the differentials are identical, and that the\n        representation data are exactly equal.\n        \"\"\"\n        # BaseRepresentationOrDifferental (checks classes and compares components)\n        out = super().__eq__(value)\n\n        # super() checks that the class is identical so can this even happen?\n        # (same class, different differentials ?)\n        if self._differentials.keys() != value._differentials.keys():\n            raise ValueError(f'cannot compare: objects must have same differentials')\n\n        for self_diff, value_diff in zip(self._differentials.values(),\n                                         value._differentials.values()):\n            out &= (self_diff == value_diff)\n\n        return out"},{"attributeType":"null","col":12,"comment":"null","endLoc":138,"id":7510,"name":"_wcs","nodeType":"Attribute","startLoc":138,"text":"self._wcs"},{"attributeType":"null","col":8,"comment":"null","endLoc":149,"id":7511,"name":"_world_keep","nodeType":"Attribute","startLoc":149,"text":"self._world_keep"},{"attributeType":"null","col":8,"comment":"null","endLoc":141,"id":7512,"name":"_slices_pixel","nodeType":"Attribute","startLoc":141,"text":"self._slices_pixel"},{"col":0,"comment":"\n    Prints a WCS validation report for the given FITS file.\n\n    Parameters\n    ----------\n    source : str or file-like or `~astropy.io.fits.HDUList`\n        The FITS file to validate.\n\n    Returns\n    -------\n    results : list subclass instance\n        The result is returned as nested lists.  The first level\n        corresponds to the HDUs in the given file.  The next level has\n        an entry for each WCS found in that header.  The special\n        subclass of list will pretty-print the results as a table when\n        printed.\n\n    ","endLoc":3511,"header":"def validate(source)","id":7513,"name":"validate","nodeType":"Function","startLoc":3401,"text":"def validate(source):\n    \"\"\"\n    Prints a WCS validation report for the given FITS file.\n\n    Parameters\n    ----------\n    source : str or file-like or `~astropy.io.fits.HDUList`\n        The FITS file to validate.\n\n    Returns\n    -------\n    results : list subclass instance\n        The result is returned as nested lists.  The first level\n        corresponds to the HDUs in the given file.  The next level has\n        an entry for each WCS found in that header.  The special\n        subclass of list will pretty-print the results as a table when\n        printed.\n\n    \"\"\"\n    class _WcsValidateWcsResult(list):\n        def __init__(self, key):\n            self._key = key\n\n        def __repr__(self):\n            result = [f\"  WCS key '{self._key or ' '}':\"]\n            if len(self):\n                for entry in self:\n                    for i, line in enumerate(entry.splitlines()):\n                        if i == 0:\n                            initial_indent = '    - '\n                        else:\n                            initial_indent = '      '\n                        result.extend(\n                            textwrap.wrap(\n                                line,\n                                initial_indent=initial_indent,\n                                subsequent_indent='      '))\n            else:\n                result.append(\"    No issues.\")\n            return '\\n'.join(result)\n\n    class _WcsValidateHduResult(list):\n        def __init__(self, hdu_index, hdu_name):\n            self._hdu_index = hdu_index\n            self._hdu_name = hdu_name\n            list.__init__(self)\n\n        def __repr__(self):\n            if len(self):\n                if self._hdu_name:\n                    hdu_name = f' ({self._hdu_name})'\n                else:\n                    hdu_name = ''\n                result = [f'HDU {self._hdu_index}{hdu_name}:']\n                for wcs in self:\n                    result.append(repr(wcs))\n                return '\\n'.join(result)\n            return ''\n\n    class _WcsValidateResults(list):\n        def __repr__(self):\n            result = []\n            for hdu in self:\n                content = repr(hdu)\n                if len(content):\n                    result.append(content)\n            return '\\n\\n'.join(result)\n\n    global __warningregistry__\n\n    if isinstance(source, fits.HDUList):\n        hdulist = source\n    else:\n        hdulist = fits.open(source)\n\n    results = _WcsValidateResults()\n\n    for i, hdu in enumerate(hdulist):\n        hdu_results = _WcsValidateHduResult(i, hdu.name)\n        results.append(hdu_results)\n\n        with warnings.catch_warnings(record=True) as warning_lines:\n            wcses = find_all_wcs(\n                hdu.header, relax=_wcs.WCSHDR_reject,\n                fix=False, _do_set=False)\n\n        for wcs in wcses:\n            wcs_results = _WcsValidateWcsResult(wcs.wcs.alt)\n            hdu_results.append(wcs_results)\n\n            try:\n                del __warningregistry__\n            except NameError:\n                pass\n\n            with warnings.catch_warnings(record=True) as warning_lines:\n                warnings.resetwarnings()\n                warnings.simplefilter(\n                    \"always\", FITSFixedWarning, append=True)\n\n                try:\n                    WCS(hdu.header,\n                        key=wcs.wcs.alt or ' ',\n                        relax=_wcs.WCSHDR_reject,\n                        fix=True, _do_set=False)\n                except WcsError as e:\n                    wcs_results.append(str(e))\n\n                wcs_results.extend([str(x.message) for x in warning_lines])\n\n    return results"},{"className":"NoConvergence","col":0,"comment":"\n    An error class used to report non-convergence and/or divergence\n    of numerical methods. It is used to report errors in the\n    iterative solution used by\n    the :py:meth:`~astropy.wcs.WCS.all_world2pix`.\n\n    Attributes\n    ----------\n\n    best_solution : `numpy.ndarray`\n        Best solution achieved by the numerical method.\n\n    accuracy : `numpy.ndarray`\n        Accuracy of the ``best_solution``.\n\n    niter : `int`\n        Number of iterations performed by the numerical method\n        to compute ``best_solution``.\n\n    divergent : None, `numpy.ndarray`\n        Indices of the points in ``best_solution`` array\n        for which the solution appears to be divergent. If the\n        solution does not diverge, ``divergent`` will be set to `None`.\n\n    slow_conv : None, `numpy.ndarray`\n        Indices of the solutions in ``best_solution`` array\n        for which the solution failed to converge within the\n        specified maximum number of iterations. If there are no\n        non-converging solutions (i.e., if the required accuracy\n        has been achieved for all input data points)\n        then ``slow_conv`` will be set to `None`.\n\n    ","endLoc":224,"id":7514,"nodeType":"Class","startLoc":175,"text":"class NoConvergence(Exception):\n    \"\"\"\n    An error class used to report non-convergence and/or divergence\n    of numerical methods. It is used to report errors in the\n    iterative solution used by\n    the :py:meth:`~astropy.wcs.WCS.all_world2pix`.\n\n    Attributes\n    ----------\n\n    best_solution : `numpy.ndarray`\n        Best solution achieved by the numerical method.\n\n    accuracy : `numpy.ndarray`\n        Accuracy of the ``best_solution``.\n\n    niter : `int`\n        Number of iterations performed by the numerical method\n        to compute ``best_solution``.\n\n    divergent : None, `numpy.ndarray`\n        Indices of the points in ``best_solution`` array\n        for which the solution appears to be divergent. If the\n        solution does not diverge, ``divergent`` will be set to `None`.\n\n    slow_conv : None, `numpy.ndarray`\n        Indices of the solutions in ``best_solution`` array\n        for which the solution failed to converge within the\n        specified maximum number of iterations. If there are no\n        non-converging solutions (i.e., if the required accuracy\n        has been achieved for all input data points)\n        then ``slow_conv`` will be set to `None`.\n\n    \"\"\"\n\n    def __init__(self, *args, best_solution=None, accuracy=None, niter=None,\n                 divergent=None, slow_conv=None, **kwargs):\n        super().__init__(*args)\n\n        self.best_solution = best_solution\n        self.accuracy = accuracy\n        self.niter = niter\n        self.divergent = divergent\n        self.slow_conv = slow_conv\n\n        if kwargs:\n            warnings.warn(\"Function received unexpected arguments ({}) these \"\n                          \"are ignored but will raise an Exception in the \"\n                          \"future.\".format(list(kwargs)),\n                          AstropyDeprecationWarning)"},{"attributeType":"null","col":8,"comment":"null","endLoc":214,"id":7515,"name":"best_solution","nodeType":"Attribute","startLoc":214,"text":"self.best_solution"},{"attributeType":"{get} | None","col":8,"comment":"null","endLoc":1943,"id":7516,"name":"_config","nodeType":"Attribute","startLoc":1943,"text":"self._config"},{"className":"Group","col":0,"comment":"\n    GROUP_ element: groups FIELD_ and PARAM_ elements.\n\n    This information is currently ignored by the vo package---that is\n    the columns in the recarray are always flat---but the grouping\n    information is stored so that it can be written out again to the\n    XML file.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    ","endLoc":2128,"id":7517,"nodeType":"Class","startLoc":1988,"text":"class Group(Element, _IDProperty, _NameProperty, _UtypeProperty,\n            _UcdProperty, _DescriptionProperty):\n    \"\"\"\n    GROUP_ element: groups FIELD_ and PARAM_ elements.\n\n    This information is currently ignored by the vo package---that is\n    the columns in the recarray are always flat---but the grouping\n    information is stored so that it can be written out again to the\n    XML file.\n\n    The keyword arguments correspond to setting members of the same\n    name, documented below.\n    \"\"\"\n\n    def __init__(self, table, ID=None, name=None, ref=None, ucd=None,\n                 utype=None, id=None, config=None, pos=None, **extra):\n        if config is None:\n            config = {}\n        self._config = config\n        self._pos = pos\n\n        Element.__init__(self)\n        self._table = table\n\n        self.ID = (resolve_id(ID, id, config, pos)\n                            or xmlutil.fix_id(name, config, pos))\n        self.name = name\n        self.ref = ref\n        self.ucd = ucd\n        self.utype = utype\n        self.description = None\n\n        self._entries = HomogeneousList(\n            (FieldRef, ParamRef, Group, Param))\n\n        warn_unknown_attrs('GROUP', extra.keys(), config, pos)\n\n    def __repr__(self):\n        return f'<GROUP>... {len(self._entries)} entries ...</GROUP>'\n\n    @property\n    def ref(self):\n        \"\"\"\n        Currently ignored, as it's not clear from the spec how this is\n        meant to work.\n        \"\"\"\n        return self._ref\n\n    @ref.setter\n    def ref(self, ref):\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        self._ref = ref\n\n    @ref.deleter\n    def ref(self):\n        self._ref = None\n\n    @property\n    def entries(self):\n        \"\"\"\n        [read-only] A list of members of the GROUP_.  This list may\n        only contain objects of type :class:`Param`, :class:`Group`,\n        :class:`ParamRef` and :class:`FieldRef`.\n        \"\"\"\n        return self._entries\n\n    def _add_fieldref(self, iterator, tag, data, config, pos):\n        fieldref = FieldRef(self._table, config=config, pos=pos, **data)\n        self.entries.append(fieldref)\n\n    def _add_paramref(self, iterator, tag, data, config, pos):\n        paramref = ParamRef(self._table, config=config, pos=pos, **data)\n        self.entries.append(paramref)\n\n    def _add_param(self, iterator, tag, data, config, pos):\n        if isinstance(self._table, VOTableFile):\n            votable = self._table\n        else:\n            votable = self._table._votable\n        param = Param(votable, config=config, pos=pos, **data)\n        self.entries.append(param)\n        param.parse(iterator, config)\n\n    def _add_group(self, iterator, tag, data, config, pos):\n        group = Group(self._table, config=config, pos=pos, **data)\n        self.entries.append(group)\n        group.parse(iterator, config)\n\n    def parse(self, iterator, config):\n        tag_mapping = {\n            'FIELDref': self._add_fieldref,\n            'PARAMref': self._add_paramref,\n            'PARAM': self._add_param,\n            'GROUP': self._add_group,\n            'DESCRIPTION': self._ignore_add}\n\n        for start, tag, data, pos in iterator:\n            if start:\n                tag_mapping.get(tag, self._add_unknown_tag)(\n                    iterator, tag, data, config, pos)\n            else:\n                if tag == 'DESCRIPTION':\n                    if self.description is not None:\n                        warn_or_raise(W17, W17, 'GROUP', config, pos)\n                    self.description = data or None\n                elif tag == 'GROUP':\n                    break\n        return self\n\n    def to_xml(self, w, **kwargs):\n        with w.tag(\n            'GROUP',\n            attrib=w.object_attrs(\n                self, ['ID', 'name', 'ref', 'ucd', 'utype'])):\n            if self.description is not None:\n                w.element(\"DESCRIPTION\", self.description, wrap=True)\n            for entry in self.entries:\n                entry.to_xml(w, **kwargs)\n\n    def iter_fields_and_params(self):\n        \"\"\"\n        Recursively iterate over all :class:`Param` elements in this\n        :class:`Group`.\n        \"\"\"\n        for entry in self.entries:\n            if isinstance(entry, Param):\n                yield entry\n            elif isinstance(entry, Group):\n                for field in entry.iter_fields_and_params():\n                    yield field\n\n    def iter_groups(self):\n        \"\"\"\n        Recursively iterate over all sub-:class:`Group` instances in\n        this :class:`Group`.\n        \"\"\"\n        for entry in self.entries:\n            if isinstance(entry, Group):\n                yield entry\n                for group in entry.iter_groups():\n                    yield group"},{"attributeType":"null","col":8,"comment":"null","endLoc":217,"id":7518,"name":"divergent","nodeType":"Attribute","startLoc":217,"text":"self.divergent"},{"attributeType":"null","col":8,"comment":"null","endLoc":218,"id":7519,"name":"slow_conv","nodeType":"Attribute","startLoc":218,"text":"self.slow_conv"},{"col":4,"comment":"null","endLoc":2026,"header":"def __repr__(self)","id":7520,"name":"__repr__","nodeType":"Function","startLoc":2025,"text":"def __repr__(self):\n        return f'<GROUP>... {len(self._entries)} entries ...</GROUP>'"},{"col":4,"comment":"\n        Currently ignored, as it's not clear from the spec how this is\n        meant to work.\n        ","endLoc":2034,"header":"@property\n    def ref(self)","id":7521,"name":"ref","nodeType":"Function","startLoc":2028,"text":"@property\n    def ref(self):\n        \"\"\"\n        Currently ignored, as it's not clear from the spec how this is\n        meant to work.\n        \"\"\"\n        return self._ref"},{"col":4,"comment":"null","endLoc":2039,"header":"@ref.setter\n    def ref(self, ref)","id":7522,"name":"ref","nodeType":"Function","startLoc":2036,"text":"@ref.setter\n    def ref(self, ref):\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        self._ref = ref"},{"col":4,"comment":"null","endLoc":2043,"header":"@ref.deleter\n    def ref(self)","id":7523,"name":"ref","nodeType":"Function","startLoc":2041,"text":"@ref.deleter\n    def ref(self):\n        self._ref = None"},{"col":4,"comment":"\n        [read-only] A list of members of the GROUP_.  This list may\n        only contain objects of type :class:`Param`, :class:`Group`,\n        :class:`ParamRef` and :class:`FieldRef`.\n        ","endLoc":2052,"header":"@property\n    def entries(self)","id":7524,"name":"entries","nodeType":"Function","startLoc":2045,"text":"@property\n    def entries(self):\n        \"\"\"\n        [read-only] A list of members of the GROUP_.  This list may\n        only contain objects of type :class:`Param`, :class:`Group`,\n        :class:`ParamRef` and :class:`FieldRef`.\n        \"\"\"\n        return self._entries"},{"col":4,"comment":"null","endLoc":2056,"header":"def _add_fieldref(self, iterator, tag, data, config, pos)","id":7525,"name":"_add_fieldref","nodeType":"Function","startLoc":2054,"text":"def _add_fieldref(self, iterator, tag, data, config, pos):\n        fieldref = FieldRef(self._table, config=config, pos=pos, **data)\n        self.entries.append(fieldref)"},{"attributeType":"null","col":8,"comment":"null","endLoc":215,"id":7526,"name":"accuracy","nodeType":"Attribute","startLoc":215,"text":"self.accuracy"},{"attributeType":"null","col":8,"comment":"null","endLoc":216,"id":7527,"name":"niter","nodeType":"Attribute","startLoc":216,"text":"self.niter"},{"className":"FITSFixedWarning","col":0,"comment":"\n    The warning raised when the contents of the FITS header have been\n    modified to be standards compliant.\n    ","endLoc":232,"id":7528,"nodeType":"Class","startLoc":227,"text":"class FITSFixedWarning(AstropyWarning):\n    \"\"\"\n    The warning raised when the contents of the FITS header have been\n    modified to be standards compliant.\n    \"\"\"\n    pass"},{"col":4,"comment":"null","endLoc":122,"header":"def _load_tab_bintable(hdulist, extnam, extver, extlev, kind, ttype, row, ndim)","id":7529,"name":"_load_tab_bintable","nodeType":"Function","startLoc":113,"text":"def _load_tab_bintable(hdulist, extnam, extver, extlev, kind, ttype, row, ndim):\n        arr = hdulist[(extnam, extver)].data[ttype][row - 1]\n\n        if arr.ndim != ndim:\n            if kind == 'c' and ndim == 2:\n                arr = arr.reshape((arr.size, 1))\n            else:\n                raise ValueError(\"Bad TDIM\")\n\n        return np.ascontiguousarray(arr, dtype=np.double)"},{"col":0,"comment":"\n    Unpickles a WCS object from a serialized FITS string.\n    ","endLoc":3307,"header":"def __WCS_unpickle__(cls, dct, fits_data)","id":7531,"name":"__WCS_unpickle__","nodeType":"Function","startLoc":3283,"text":"def __WCS_unpickle__(cls, dct, fits_data):\n    \"\"\"\n    Unpickles a WCS object from a serialized FITS string.\n    \"\"\"\n\n    self = cls.__new__(cls)\n\n    buffer = io.BytesIO(fits_data)\n    hdulist = fits.open(buffer)\n\n    naxis = dct.pop('naxis', None)\n    if naxis:\n        hdulist[0].header['naxis'] = naxis\n        naxes = dct.pop('_naxis', [])\n        for k, na in enumerate(naxes):\n            hdulist[0].header[f'naxis{k + 1:d}'] = na\n\n    kwargs = dct.pop('_init_kwargs', {})\n    self.__dict__.update(dct)\n\n    wcskey = dct.pop('_alt_wcskey', ' ')\n    WCS.__init__(self, hdulist[0].header, hdulist, key=wcskey, **kwargs)\n    self.pixel_bounds = dct.get('_pixel_bounds', None)\n\n    return self"},{"col":0,"comment":"\n    Find all the WCS transformations in the given header.\n\n    Parameters\n    ----------\n    header : str or `~astropy.io.fits.Header` object.\n\n    relax : bool or int, optional\n        Degree of permissiveness:\n\n        - `True` (default): Admit all recognized informal extensions of the\n          WCS standard.\n\n        - `False`: Recognize only FITS keywords defined by the\n          published WCS standard.\n\n        - `int`: a bit field selecting specific extensions to accept.\n          See :ref:`astropy:relaxread` for details.\n\n    keysel : sequence of str, optional\n        A list of flags used to select the keyword types considered by\n        wcslib.  When ``None``, only the standard image header\n        keywords are considered (and the underlying wcspih() C\n        function is called).  To use binary table image array or pixel\n        list keywords, *keysel* must be set.\n\n        Each element in the list should be one of the following strings:\n\n            - 'image': Image header keywords\n\n            - 'binary': Binary table image array keywords\n\n            - 'pixel': Pixel list keywords\n\n        Keywords such as ``EQUIna`` or ``RFRQna`` that are common to\n        binary table image arrays and pixel lists (including\n        ``WCSNna`` and ``TWCSna``) are selected by both 'binary' and\n        'pixel'.\n\n    fix : bool, optional\n        When `True` (default), call `~astropy.wcs.Wcsprm.fix` on\n        the resulting objects to fix any non-standard uses in the\n        header.  `FITSFixedWarning` warnings will be emitted if any\n        changes were made.\n\n    translate_units : str, optional\n        Specify which potentially unsafe translations of non-standard\n        unit strings to perform.  By default, performs none.  See\n        `WCS.fix` for more information about this parameter.  Only\n        effective when ``fix`` is `True`.\n\n    Returns\n    -------\n    wcses : list of `WCS`\n    ","endLoc":3398,"header":"def find_all_wcs(header, relax=True, keysel=None, fix=True,\n                 translate_units='',\n                 _do_set=True)","id":7532,"name":"find_all_wcs","nodeType":"Function","startLoc":3310,"text":"def find_all_wcs(header, relax=True, keysel=None, fix=True,\n                 translate_units='',\n                 _do_set=True):\n    \"\"\"\n    Find all the WCS transformations in the given header.\n\n    Parameters\n    ----------\n    header : str or `~astropy.io.fits.Header` object.\n\n    relax : bool or int, optional\n        Degree of permissiveness:\n\n        - `True` (default): Admit all recognized informal extensions of the\n          WCS standard.\n\n        - `False`: Recognize only FITS keywords defined by the\n          published WCS standard.\n\n        - `int`: a bit field selecting specific extensions to accept.\n          See :ref:`astropy:relaxread` for details.\n\n    keysel : sequence of str, optional\n        A list of flags used to select the keyword types considered by\n        wcslib.  When ``None``, only the standard image header\n        keywords are considered (and the underlying wcspih() C\n        function is called).  To use binary table image array or pixel\n        list keywords, *keysel* must be set.\n\n        Each element in the list should be one of the following strings:\n\n            - 'image': Image header keywords\n\n            - 'binary': Binary table image array keywords\n\n            - 'pixel': Pixel list keywords\n\n        Keywords such as ``EQUIna`` or ``RFRQna`` that are common to\n        binary table image arrays and pixel lists (including\n        ``WCSNna`` and ``TWCSna``) are selected by both 'binary' and\n        'pixel'.\n\n    fix : bool, optional\n        When `True` (default), call `~astropy.wcs.Wcsprm.fix` on\n        the resulting objects to fix any non-standard uses in the\n        header.  `FITSFixedWarning` warnings will be emitted if any\n        changes were made.\n\n    translate_units : str, optional\n        Specify which potentially unsafe translations of non-standard\n        unit strings to perform.  By default, performs none.  See\n        `WCS.fix` for more information about this parameter.  Only\n        effective when ``fix`` is `True`.\n\n    Returns\n    -------\n    wcses : list of `WCS`\n    \"\"\"\n\n    if isinstance(header, (str, bytes)):\n        header_string = header\n    elif isinstance(header, fits.Header):\n        header_string = header.tostring()\n    else:\n        raise TypeError(\n            \"header must be a string or astropy.io.fits.Header object\")\n\n    keysel_flags = _parse_keysel(keysel)\n\n    if isinstance(header_string, str):\n        header_bytes = header_string.encode('ascii')\n    else:\n        header_bytes = header_string\n\n    wcsprms = _wcs.find_all_wcs(header_bytes, relax, keysel_flags)\n\n    result = []\n    for wcsprm in wcsprms:\n        subresult = WCS(fix=False, _do_set=False)\n        subresult.wcs = wcsprm\n        result.append(subresult)\n\n        if fix:\n            subresult.fix(translate_units)\n\n        if _do_set:\n            subresult.wcs.set()\n\n    return result"},{"col":0,"comment":"\n    Write a Table object to an VO table file\n\n    Parameters\n    ----------\n    input : Table\n        The table to write out.\n\n    output : str\n        The filename to write the table to.\n\n    table_id : str, optional\n        The table ID to use. If this is not specified, the 'ID' keyword in the\n        ``meta`` object of the table will be used.\n\n    overwrite : bool, optional\n        Whether to overwrite any existing file without warning.\n\n    tabledata_format : str, optional\n        The format of table data to write.  Must be one of ``tabledata``\n        (text representation), ``binary`` or ``binary2``.  Default is\n        ``tabledata``.  See :ref:`astropy:votable-serialization`.\n    ","endLoc":174,"header":"def write_table_votable(input, output, table_id=None, overwrite=False,\n                        tabledata_format=None)","id":7533,"name":"write_table_votable","nodeType":"Function","startLoc":130,"text":"def write_table_votable(input, output, table_id=None, overwrite=False,\n                        tabledata_format=None):\n    \"\"\"\n    Write a Table object to an VO table file\n\n    Parameters\n    ----------\n    input : Table\n        The table to write out.\n\n    output : str\n        The filename to write the table to.\n\n    table_id : str, optional\n        The table ID to use. If this is not specified, the 'ID' keyword in the\n        ``meta`` object of the table will be used.\n\n    overwrite : bool, optional\n        Whether to overwrite any existing file without warning.\n\n    tabledata_format : str, optional\n        The format of table data to write.  Must be one of ``tabledata``\n        (text representation), ``binary`` or ``binary2``.  Default is\n        ``tabledata``.  See :ref:`astropy:votable-serialization`.\n    \"\"\"\n\n    # Only those columns which are instances of BaseColumn or Quantity can be written\n    unsupported_cols = input.columns.not_isinstance((BaseColumn, Quantity))\n    if unsupported_cols:\n        unsupported_names = [col.info.name for col in unsupported_cols]\n        raise ValueError('cannot write table with mixin column(s) {} to VOTable'\n                         .format(unsupported_names))\n\n    # Check if output file already exists\n    if isinstance(output, str) and os.path.exists(output):\n        if overwrite:\n            os.remove(output)\n        else:\n            raise OSError(NOT_OVERWRITING_MSG.format(output))\n\n    # Create a new VOTable file\n    table_file = from_table(input, table_id=table_id)\n\n    # Write out file\n    table_file.to_xml(output, tabledata_format=tabledata_format)"},{"id":7534,"name":"astropy/wcs/src","nodeType":"Package"},{"id":7535,"name":"wcslib_tabprm_wrap.c","nodeType":"TextFile","path":"astropy/wcs/src","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#define NO_IMPORT_ARRAY\n\n#include \"astropy_wcs/wcslib_tabprm_wrap.h\"\n\n#include <wcs.h>\n#include <wcsprintf.h>\n#include <tab.h>\n\n/*\n It gets to be really tedious to type long docstrings in ANSI C syntax\n (since multi-line strings literals are not valid).  Therefore, the\n docstrings are written in doc/docstrings.py, which are then converted\n by setup.py into docstrings.h, which we include here.\n*/\n#include \"astropy_wcs/docstrings.h\"\n\n/***************************************************************************\n * Helper functions                                                        *\n ***************************************************************************/\n\nstatic INLINE void\nnote_change(PyTabprm* self) {\n  self->x->flag = 0;\n}\n\nstatic int\nmake_fancy_dims(PyTabprm* self, int* ndims, npy_intp* dims) {\n  int i, M;\n\n  M = self->x->M;\n  if (M + 1 > NPY_MAXDIMS) {\n    PyErr_SetString(PyExc_ValueError, \"Too many dimensions\");\n    return -1;\n  }\n\n  *ndims = M + 1;\n\n  for (i = 0; i < M; ++i) {\n    dims[i] = self->x->K[M-1-i];\n  }\n\n  dims[M] = M;\n\n  return 0;\n}\n\nPyObject** tab_errexc[6];\n\nstatic void\nwcslib_tab_to_python_exc(int status) {\n  if (status > 0 && status < 6) {\n    PyErr_SetString(*tab_errexc[status], tab_errmsg[status]);\n  } else {\n    PyErr_SetString(\n        PyExc_RuntimeError,\n        \"Unknown error occurred.  Something is seriously wrong.\");\n  }\n}\n\n/***************************************************************************\n * PyTabprm methods\n */\n\nstatic int\nPyTabprm_traverse(\n    PyTabprm* self, visitproc visit, void *arg) {\n  Py_VISIT(self->owner);\n  return 0;\n}\n\nstatic int\nPyTabprm_clear(\n    PyTabprm* self) {\n\n  Py_CLEAR(self->owner);\n\n  return 0;\n}\n\nstatic void\nPyTabprm_dealloc(\n    PyTabprm* self) {\n\n  PyTabprm_clear(self);\n  Py_TYPE(self)->tp_free((PyObject*)self);\n}\n\nPyTabprm*\nPyTabprm_cnew(PyObject* wcsprm, struct tabprm* x) {\n  PyTabprm* self;\n  self = (PyTabprm*)(&PyTabprmType)->tp_alloc(&PyTabprmType, 0);\n  if (self == NULL) return NULL;\n  self->x = x;\n  Py_INCREF(wcsprm);\n  self->owner = wcsprm;\n  return self;\n}\n\nstatic int\nPyTabprm_cset(\n    PyTabprm* self) {\n\n  int status = 0;\n\n  status = tabset(self->x);\n\n  if (status == 0) {\n    return 0;\n  } else {\n    wcslib_tab_to_python_exc(status);\n    return -1;\n  }\n}\n\n/*@null@*/ static PyObject*\nPyTabprm_set(\n    PyTabprm* self) {\n\n  if (PyTabprm_cset(self)) {\n    return NULL;\n  }\n\n  Py_RETURN_NONE;\n}\n\n/*@null@*/ static PyObject*\nPyTabprm_print_contents(\n    PyTabprm* self) {\n\n  if (PyTabprm_cset(self)) {\n    return NULL;\n  }\n\n  /* This is not thread-safe, but since we're holding onto the GIL,\n     we can assume we won't have thread conflicts */\n  wcsprintf_set(NULL);\n  tabprt(self->x);\n  printf(\"%s\", wcsprintf_buf());\n  fflush(stdout);\n  Py_RETURN_NONE;\n}\n\n/*@null@*/ static PyObject*\nPyTabprm___str__(\n    PyTabprm* self) {\n\n  if (PyTabprm_cset(self)) {\n    return NULL;\n  }\n\n  /* This is not thread-safe, but since we're holding onto the GIL,\n     we can assume we won't have thread conflicts */\n  wcsprintf_set(NULL);\n\n  tabprt(self->x);\n\n  return PyUnicode_FromString(wcsprintf_buf());\n}\n\n/***************************************************************************\n * Member getters/setters (properties)\n */\n\n/*@null@*/ static PyObject*\nPyTabprm_get_coord(\n    PyTabprm* self,\n    /*@unused@*/ void* closure) {\n\n  int ndims;\n  npy_intp dims[NPY_MAXDIMS];\n\n  if (is_null(self->x->coord)) {\n    return NULL;\n  }\n\n  if (make_fancy_dims(self, &ndims, dims)) {\n    return NULL;\n  }\n\n  return get_double_array(\"coord\", self->x->coord, ndims, dims, (PyObject*)self);\n}\n\n/*@null@*/ static int\nPyTabprm_set_coord(\n    PyTabprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  int ndims;\n  npy_intp dims[NPY_MAXDIMS];\n\n  if (is_null(self->x->coord)) {\n    return -1;\n  }\n\n  if (make_fancy_dims(self, &ndims, dims)) {\n    return -1;\n  }\n\n  return set_double_array(\"coord\", value, ndims, dims, self->x->coord);\n}\n\n/*@null@*/ static PyObject*\nPyTabprm_get_crval(\n    PyTabprm* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t M = 0;\n\n  if (is_null(self->x->crval)) {\n    return NULL;\n  }\n\n  M = (Py_ssize_t)self->x->M;\n\n  return get_double_array(\"crval\", self->x->crval, 1, &M, (PyObject*)self);\n}\n\nstatic int\nPyTabprm_set_crval(\n    PyTabprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp M = 0;\n\n  if (is_null(self->x->crval)) {\n    return -1;\n  }\n\n  M = (Py_ssize_t)self->x->M;\n\n  note_change(self);\n\n  return set_double_array(\"crval\", value, 1, &M, self->x->crval);\n}\n\n/*@null@*/ static PyObject*\nPyTabprm_get_delta(\n    PyTabprm* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t M = 0;\n\n  if (is_null(self->x->delta)) {\n    return NULL;\n  }\n\n  M = (Py_ssize_t)self->x->M;\n\n  return get_double_array(\"delta\", self->x->delta, 1, &M, (PyObject*)self);\n}\n\n/*@null@*/ static PyObject*\nPyTabprm_get_extrema(\n    PyTabprm* self,\n    /*@unused@*/ void* closure) {\n\n  int ndims;\n  npy_intp dims[NPY_MAXDIMS];\n\n  if (is_null(self->x->coord)) {\n    return NULL;\n  }\n\n  if (make_fancy_dims(self, &ndims, dims)) {\n    return NULL;\n  }\n\n  dims[ndims-2] = 2;\n\n  return get_double_array(\"extrema\", self->x->extrema, ndims, dims, (PyObject*)self);\n}\n\n/*@null@*/ static PyObject*\nPyTabprm_get_K(\n    PyTabprm* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t M = 0;\n\n  if (is_null(self->x->K)) {\n    return NULL;\n  }\n\n  M = (Py_ssize_t)self->x->M;\n\n  return get_int_array(\"K\", self->x->K, 1, &M, (PyObject*)self);\n}\n\n/*@null@*/ static PyObject*\nPyTabprm_get_M(\n    PyTabprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_int(\"M\", self->x->M);\n}\n\n/*@null@*/ static PyObject*\nPyTabprm_get_map(\n    PyTabprm* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t M = 0;\n\n  if (is_null(self->x->map)) {\n    return NULL;\n  }\n\n  M = (Py_ssize_t)self->x->M;\n\n  return get_int_array(\"map\", self->x->map, 1, &M, (PyObject*)self);\n}\n\nstatic int\nPyTabprm_set_map(\n    PyTabprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp M = 0;\n\n  if (is_null(self->x->map)) {\n    return -1;\n  }\n\n  M = (Py_ssize_t)self->x->M;\n\n  note_change(self);\n\n  return set_int_array(\"map\", value, 1, &M, self->x->map);\n}\n\n/*@null@*/ static PyObject*\nPyTabprm_get_nc(\n    PyTabprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_int(\"nc\", self->x->nc);\n}\n\n/*@null@*/ static PyObject*\nPyTabprm_get_p0(\n    PyTabprm* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t M = 0;\n\n  if (is_null(self->x->p0)) {\n    return NULL;\n  }\n\n  M = (Py_ssize_t)self->x->M;\n\n  return get_int_array(\"p0\", self->x->p0, 1, &M, (PyObject*)self);\n}\n\n/*@null@*/ static PyObject*\nPyTabprm_get_sense(\n    PyTabprm* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t M = 0;\n\n  if (is_null(self->x->sense)) {\n    return NULL;\n  }\n\n  M = (Py_ssize_t)self->x->M;\n\n  return get_int_array(\"sense\", self->x->sense, 1, &M, (PyObject*)self);\n}\n\n/***************************************************************************\n * PyTabprm definition structures\n */\n\nstatic PyGetSetDef PyTabprm_getset[] = {\n  {\"coord\", (getter)PyTabprm_get_coord, (setter)PyTabprm_set_coord, (char *)doc_coord},\n  {\"crval\", (getter)PyTabprm_get_crval, (setter)PyTabprm_set_crval, (char *)doc_crval_tabprm},\n  {\"delta\", (getter)PyTabprm_get_delta, NULL, (char *)doc_delta},\n  {\"extrema\", (getter)PyTabprm_get_extrema, NULL, (char *)doc_extrema},\n  {\"K\", (getter)PyTabprm_get_K, NULL, (char *)doc_K},\n  {\"M\", (getter)PyTabprm_get_M, NULL, (char *)doc_M},\n  {\"map\", (getter)PyTabprm_get_map, (setter)PyTabprm_set_map, (char *)doc_map},\n  {\"nc\", (getter)PyTabprm_get_nc, NULL, (char *)doc_nc},\n  {\"p0\", (getter)PyTabprm_get_p0, NULL, (char *)doc_p0},\n  {\"sense\", (getter)PyTabprm_get_sense, NULL, (char *)doc_sense},\n  {NULL}\n};\n\nstatic PyMethodDef PyTabprm_methods[] = {\n  {\"print_contents\", (PyCFunction)PyTabprm_print_contents, METH_NOARGS, doc_print_contents_tabprm},\n  {\"set\", (PyCFunction)PyTabprm_set, METH_NOARGS, doc_set_tabprm},\n  {NULL}\n};\n\nPyTypeObject PyTabprmType = {\n  PyVarObject_HEAD_INIT(NULL, 0)\n  \"astropy.wcs.Tabprm\",         /*tp_name*/\n  sizeof(PyTabprm),             /*tp_basicsize*/\n  0,                            /*tp_itemsize*/\n  (destructor)PyTabprm_dealloc, /*tp_dealloc*/\n  0,                            /*tp_print*/\n  0,                            /*tp_getattr*/\n  0,                            /*tp_setattr*/\n  0,                            /*tp_compare*/\n  0,                            /*tp_repr*/\n  0,                            /*tp_as_number*/\n  0,                            /*tp_as_sequence*/\n  0,                            /*tp_as_mapping*/\n  0,                            /*tp_hash */\n  0,                            /*tp_call*/\n  (reprfunc)PyTabprm___str__,   /*tp_str*/\n  0,                            /*tp_getattro*/\n  0,                            /*tp_setattro*/\n  0,                            /*tp_as_buffer*/\n  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/\n  doc_Tabprm,                   /* tp_doc */\n  (traverseproc)PyTabprm_traverse, /* tp_traverse */\n  (inquiry)PyTabprm_clear,         /* tp_clear */\n  0,                            /* tp_richcompare */\n  0,                            /* tp_weaklistoffset */\n  0,                            /* tp_iter */\n  0,                            /* tp_iternext */\n  PyTabprm_methods,             /* tp_methods */\n  0,                            /* tp_members */\n  PyTabprm_getset,              /* tp_getset */\n  0,                            /* tp_base */\n  0,                            /* tp_dict */\n  0,                            /* tp_descr_get */\n  0,                            /* tp_descr_set */\n  0,                            /* tp_dictoffset */\n  0,                            /* tp_init */\n  0,                            /* tp_alloc */\n  0,                            /* tp_new */\n};\n\nint\n_setup_tabprm_type(\n    PyObject* m) {\n\n  if (PyType_Ready(&PyTabprmType) < 0) {\n    return -1;\n  }\n\n  Py_INCREF(&PyTabprmType);\n\n  PyModule_AddObject(m, \"Tabprm\", (PyObject *)&PyTabprmType);\n\n  tab_errexc[0] = NULL;                         /* Success */\n  tab_errexc[1] = &PyExc_MemoryError;           /* Null wcsprm pointer passed */\n  tab_errexc[2] = &PyExc_MemoryError;           /* Memory allocation failed */\n  tab_errexc[3] = &WcsExc_InvalidTabularParameters;  /* Invalid tabular parameters */\n  tab_errexc[4] = &WcsExc_InvalidCoordinate; /* One or more of the x coordinates were invalid */\n  tab_errexc[5] = &WcsExc_InvalidCoordinate; /* One or more of the world coordinates were invalid */\n\n  return 0;\n}\n"},{"id":7536,"name":"pyutil.c","nodeType":"TextFile","path":"astropy/wcs/src","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#define NO_IMPORT_ARRAY\n\n/* util.h must be imported first */\n#include \"astropy_wcs/pyutil.h\"\n\n#include \"astropy_wcs/docstrings.h\"\n\n#include \"wcsfix.h\"\n#include \"wcshdr.h\"\n#include \"wcsprintf.h\"\n#include \"wcsunits.h\"\n\n/*@null@*/ static INLINE PyObject*\n_PyArrayProxy_New(\n    /*@shared@*/ PyObject* self,\n    int nd,\n    const npy_intp* dims,\n    int typenum,\n    const void* data,\n    const int flags) {\n\n  PyArray_Descr* type_descr = NULL;\n  PyObject*      result     = NULL;\n\n  type_descr = (PyArray_Descr*)PyArray_DescrFromType(typenum);\n  if (type_descr == NULL) {\n    return NULL;\n  }\n\n  result = (PyObject*)PyArray_NewFromDescr(\n      &PyArray_Type,\n      type_descr,\n      nd, (npy_intp*)dims,\n      NULL,\n      (void*)data,\n      NPY_ARRAY_C_CONTIGUOUS | flags,\n      NULL);\n\n  if (result == NULL) {\n    return NULL;\n  }\n  Py_INCREF(self);\n  PyArray_SetBaseObject((PyArrayObject *)result, self);\n  return result;\n}\n\n/*@null@*/ PyObject*\nPyArrayProxy_New(\n    /*@shared@*/ PyObject* self,\n    int nd,\n    const npy_intp* dims,\n    int typenum,\n    const void* data) {\n\n  return _PyArrayProxy_New(self, nd, dims, typenum, data, NPY_ARRAY_WRITEABLE);\n}\n\n/*@null@*/ PyObject*\nPyArrayReadOnlyProxy_New(\n    /*@shared@*/ PyObject* self,\n    int nd,\n    const npy_intp* dims,\n    int typenum,\n    const void* data) {\n\n  return _PyArrayProxy_New(self, nd, dims, typenum, data, 0);\n}\n\nvoid\npreoffset_array(\n    PyArrayObject* array,\n    int value) {\n\n  npy_intp  size;\n  double   *data;\n\n  if (value == 1) {\n    return;\n  }\n\n  size = PyArray_Size((PyObject*)array);\n  data = (double*)PyArray_DATA(array);\n  offset_c_array(data, size, (double)(1 - value));\n}\n\nvoid\nunoffset_array(\n    PyArrayObject* array,\n    int value) {\n\n  npy_intp  size;\n  double   *data;\n\n  if (value == 1) {\n    return;\n  }\n\n  size = PyArray_Size((PyObject*)array);\n  data = (double*)PyArray_DATA(array);\n  offset_c_array(data, size, (double)-(1 - value));\n}\n\nvoid\ncopy_array_to_c_double(\n    PyArrayObject* array,\n    double* dest) {\n\n  npy_intp size = 1;\n  double*  data = NULL;\n\n  size = PyArray_Size((PyObject*)array);\n  data = (double*)PyArray_DATA(array);\n\n  memcpy(dest, data, size * sizeof(double));\n}\n\nvoid\ncopy_array_to_c_int(\n    PyArrayObject* array,\n    int* dest) {\n\n  npy_intp size = 1;\n  int*     data = NULL;\n\n  size = PyArray_Size((PyObject*)array);\n  data = (int*)PyArray_DATA(array);\n\n  memcpy(dest, data, size * sizeof(int));\n}\n\nint\nis_null(\n    /*@null@*/ void *p) {\n\n  if (p == NULL) {\n    PyErr_SetString(PyExc_AssertionError, \"Underlying object is NULL.\");\n    return 1;\n  }\n  return 0;\n}\n\n/* wcslib represents undefined values using its own special constant,\n   UNDEFINED.  To be consistent with the Pythonic way of doing things,\n   it's nicer to represent undefined values using NaN.  Unfortunately,\n   in order to get nice mutable arrays in Python, Python must be able\n   to edit the wcsprm values directly.  The solution is to store NaNs\n   in the struct \"canonically\", but convert those NaNs to/from\n   UNDEFINED around every call into a wcslib function.  It's not as\n   computationally expensive as it sounds, as all these arrays are\n   quite small.\n*/\n\nstatic INLINE void\nwcsprm_fix_values(\n    struct wcsprm* x,\n    value_fixer_t value_fixer) {\n\n  unsigned int naxis = (unsigned int)x->naxis;\n\n  value_fixer(x->cd, naxis * naxis);\n  value_fixer(x->cdelt, naxis);\n  value_fixer(x->crder, naxis);\n  value_fixer(x->crota, naxis);\n  value_fixer(x->crpix, naxis);\n  value_fixer(x->crval, naxis);\n  value_fixer(x->csyer, naxis);\n  value_fixer(&x->equinox, 1);\n  value_fixer(&x->latpole, 1);\n  value_fixer(&x->lonpole, 1);\n  value_fixer(&x->mjdavg, 1);\n  value_fixer(&x->mjdobs, 1);\n  value_fixer(x->obsgeo, 6);\n  value_fixer(&x->cel.phi0, 1);\n  value_fixer(&x->restfrq, 1);\n  value_fixer(&x->restwav, 1);\n  value_fixer(&x->cel.theta0, 1);\n  value_fixer(&x->velangl, 1);\n  value_fixer(&x->velosys, 1);\n  value_fixer(&x->zsource, 1);\n  value_fixer(x->czphs, naxis);\n  value_fixer(x->cperi, naxis);\n  value_fixer(x->mjdref, 2);\n  value_fixer(&x->mjdbeg, 1);\n  value_fixer(&x->mjdend, 1);\n  value_fixer(&x->jepoch, 1);\n  value_fixer(&x->bepoch, 1);\n  value_fixer(&x->tstart, 1);\n  value_fixer(&x->tstop, 1);\n  value_fixer(&x->xposure, 1);\n  value_fixer(&x->timsyer, 1);\n  value_fixer(&x->timrder, 1);\n  value_fixer(&x->timedel, 1);\n  value_fixer(&x->timepixr, 1);\n  value_fixer(&x->timeoffs, 1);\n  value_fixer(&x->telapse, 1);\n}\n\nvoid\nwcsprm_c2python(\n    /*@null@*/ struct wcsprm* x) {\n\n  if (x != NULL) {\n    wcsprm_fix_values(x, &undefined2nan);\n  }\n}\n\nvoid\nwcsprm_python2c(\n    /*@null@*/ struct wcsprm* x) {\n\n  if (x != NULL) {\n    wcsprm_fix_values(x, &nan2undefined);\n  }\n}\n\n/***************************************************************************\n * Exceptions                                                              *\n ***************************************************************************/\n\nPyObject* WcsExc_Wcs;\nPyObject* WcsExc_SingularMatrix;\nPyObject* WcsExc_InconsistentAxisTypes;\nPyObject* WcsExc_InvalidTransform;\nPyObject* WcsExc_InvalidCoordinate;\nPyObject* WcsExc_NoSolution;\nPyObject* WcsExc_InvalidSubimageSpecification;\nPyObject* WcsExc_NonseparableSubimageCoordinateSystem;\nPyObject* WcsExc_NoWcsKeywordsFound;\nPyObject* WcsExc_InvalidTabularParameters;\nPyObject* WcsExc_InvalidPrjParameters;\n\n/* This is an array mapping the wcs status codes to Python exception\n * types.  The exception string is stored as part of wcslib itself in\n * wcs_errmsg.\n */\nPyObject** wcs_errexc[14];\n\nstatic PyObject*\n_new_exception_with_doc(char *name, char *doc, PyObject *base)\n{\n  return PyErr_NewExceptionWithDoc(name, doc, base, NULL);\n}\n\n#define DEFINE_EXCEPTION(exc) \\\n  WcsExc_##exc = _new_exception_with_doc(                             \\\n      \"astropy.wcs._wcs.\" #exc \"Error\",                                 \\\n      doc_##exc,                                                        \\\n      WcsExc_Wcs);                                                      \\\n  if (WcsExc_##exc == NULL) \\\n    return 1; \\\n  PyModule_AddObject(m, #exc \"Error\", WcsExc_##exc); \\\n\nint\n_define_exceptions(\n    PyObject* m) {\n\n  WcsExc_Wcs = _new_exception_with_doc(\n      \"astropy.wcs._wcs.WcsError\",\n      doc_WcsError,\n      PyExc_ValueError);\n  if (WcsExc_Wcs == NULL) {\n    return 1;\n  }\n  PyModule_AddObject(m, \"WcsError\", WcsExc_Wcs);\n\n  DEFINE_EXCEPTION(SingularMatrix);\n  DEFINE_EXCEPTION(InconsistentAxisTypes);\n  DEFINE_EXCEPTION(InvalidTransform);\n  DEFINE_EXCEPTION(InvalidCoordinate);\n  DEFINE_EXCEPTION(NoSolution);\n  DEFINE_EXCEPTION(InvalidSubimageSpecification);\n  DEFINE_EXCEPTION(NonseparableSubimageCoordinateSystem);\n  DEFINE_EXCEPTION(NoWcsKeywordsFound);\n  DEFINE_EXCEPTION(InvalidTabularParameters);\n  DEFINE_EXCEPTION(InvalidPrjParameters);\n  return 0;\n}\n\nconst char*\nwcslib_get_error_message(int status) {\n  return wcs_errmsg[status];\n}\n\nvoid\nwcserr_to_python_exc(const struct wcserr *err) {\n  PyObject *exc;\n  if (err == NULL) {\n    PyErr_SetString(PyExc_RuntimeError, \"NULL error object in wcslib\");\n  } else {\n    if (err->status > 0 && err->status <= WCS_ERRMSG_MAX) {\n      exc = *wcs_errexc[err->status];\n    } else {\n      exc = PyExc_RuntimeError;\n    }\n    /* This is technically not thread-safe -- make sure we have the GIL */\n    wcsprintf_set(NULL);\n    wcserr_prt(err, \"\");\n    PyErr_SetString(exc, wcsprintf_buf());\n  }\n}\n\nvoid\nwcs_to_python_exc(const struct wcsprm *wcs) {\n  PyObject* exc;\n  const struct wcserr *err = wcs->err;\n  if (err == NULL) {\n    PyErr_SetString(PyExc_RuntimeError, \"NULL error object in wcslib\");\n  } else {\n    if (err->status > 0 && err->status < WCS_ERRMSG_MAX) {\n      exc = *wcs_errexc[err->status];\n    } else {\n      exc = PyExc_RuntimeError;\n    }\n    /* This is technically not thread-safe -- make sure we have the GIL */\n    wcsprintf_set(NULL);\n    wcsperr(wcs, \"\");\n    PyErr_SetString(exc, wcsprintf_buf());\n  }\n}\n\nvoid\nwcserr_fix_to_python_exc(const struct wcserr *err) {\n  PyObject *exc;\n  if (err == NULL) {\n    PyErr_SetString(PyExc_RuntimeError, \"NULL error object in wcslib\");\n  } else {\n    if (err->status > 0 && err->status <= FIXERR_NO_REF_PIX_VAL) {\n      exc = PyExc_ValueError;\n    } else {\n      exc = PyExc_RuntimeError;\n    }\n    /* This is technically not thread-safe -- make sure we have the GIL */\n    wcsprintf_set(NULL);\n    wcserr_prt(err, \"\");\n    PyErr_SetString(exc, wcsprintf_buf());\n  }\n}\n\nvoid\nwcshdr_err_to_python_exc(int status, const struct wcsprm *wcs) {\n  /* Add error to wcslib error buffer */\n  wcsperr(wcs, NULL);\n  if (status > 0 && status != WCSHDRERR_PARSER) {\n    PyErr_Format(\n      PyExc_MemoryError,\n      \"Memory allocation error:\\n%s\",\n      wcsprintf_buf()\n    );\n  } else {\n    PyErr_Format(\n      PyExc_ValueError,\n      \"Internal error in wcslib header parser:\\n %s\",\n      wcsprintf_buf()\n    );\n  }\n}\n\n\n/***************************************************************************\n  Property helpers\n ***************************************************************************/\n\n#define SHAPE_STR_LEN 2048\n\n/* Helper function to display the desired shape of an array as a\n   string, eg. 2x2 */\nstatic void\nshape_to_string(\n    int ndims,\n    const npy_intp* dims,\n    char* str /* [SHAPE_STR_LEN] */) {\n\n  int i;\n  char value[32]; /* More than large enough to hold string rep of a\n                     64-bit integer (way overkill) */\n\n  if (ndims > 3) {\n    strncpy(str, \"ERROR\", 6);\n    return;\n  }\n\n  str[0] = 0;\n  for (i = 0; i < ndims; ++i) {\n      snprintf(value, 32, \"%d\", (int)dims[i]);\n    strncat(str, value, 32);\n    if (i != ndims - 1) {\n      strncat(str, \"x\", 2);\n    }\n  }\n}\n\n/* get_string is inlined */\n\nint\nset_string(\n    const char* propname,\n    PyObject* value,\n    char* dest,\n    Py_ssize_t maxlen) {\n\n  char*      buffer;\n  Py_ssize_t len;\n  PyObject*  ascii_obj = NULL;\n  int        result = -1;\n\n  if (check_delete(propname, value)) {\n    return -1;\n  }\n\n  if (PyUnicode_Check(value)) {\n    ascii_obj = PyUnicode_AsASCIIString(value);\n    if (ascii_obj == NULL) {\n      goto end;\n    }\n    if (PyBytes_AsStringAndSize(ascii_obj, &buffer, &len) == -1) {\n      goto end;\n    }\n  } else if (PyBytes_Check(value)) {\n    if (PyBytes_AsStringAndSize(value, &buffer, &len) == -1) {\n      goto end;\n    }\n  } else {\n    PyErr_SetString(PyExc_TypeError, \"'value' must be bytes or unicode.\");\n    goto end;\n  }\n\n  if (len >= maxlen) {\n    PyErr_Format(\n        PyExc_ValueError,\n        \"'%s' length must be less than %u characters.\",\n        propname,\n        (unsigned int) maxlen);\n    goto end;\n  }\n\n  strncpy(dest, buffer, (size_t)len + 1);\n  result = 0;\n\n end:\n  Py_XDECREF(ascii_obj);\n  return result;\n}\n\n/* get_bool is inlined */\n\nint\nset_bool(\n    const char* propname,\n    PyObject* value,\n    int* dest) {\n\n  if (check_delete(propname, value)) {\n    return -1;\n  }\n\n  *dest = PyObject_IsTrue(value);\n\n  return 0;\n}\n\n/* get_int is inlined */\n\nint\nset_int(\n    const char* propname,\n    PyObject* value,\n    int* dest) {\n  long value_int;\n\n  if (check_delete(propname, value)) {\n    return -1;\n  }\n\n  value_int = PyLong_AsLong(value);\n  if (value_int == -1 && PyErr_Occurred()) {\n    return -1;\n  }\n\n  if ((unsigned long)value_int > 0x7fffffff) {\n    PyErr_SetString(PyExc_OverflowError, \"integer value too large\");\n    return -1;\n  }\n\n  *dest = (int)value_int;\n\n  return 0;\n}\n\n/* get_double is inlined */\n\nint\nset_double(\n    const char* propname,\n    PyObject* value,\n    double* dest) {\n\n  if (check_delete(propname, value)) {\n    return -1;\n  }\n\n  *dest = PyFloat_AsDouble(value);\n\n  if (PyErr_Occurred()) {\n    return -1;\n  } else {\n    return 0;\n  }\n}\n\n/* get_double_array is inlined */\n\nint\nset_double_array(\n    const char* propname,\n    PyObject* value,\n    int ndims,\n    const npy_intp* dims,\n    double* dest) {\n\n  PyArrayObject* value_array = NULL;\n  npy_int        i           = 0;\n  char           shape_str[SHAPE_STR_LEN];\n\n  if (check_delete(propname, value)) {\n    return -1;\n  }\n\n  value_array = (PyArrayObject*)PyArray_ContiguousFromAny(value, NPY_DOUBLE,\n                                                          ndims, ndims);\n  if (value_array == NULL) {\n    return -1;\n  }\n\n  if (dims != NULL) {\n    for (i = 0; i < ndims; ++i) {\n      if (PyArray_DIM(value_array, i) != dims[i]) {\n        shape_to_string(ndims, dims, shape_str);\n        PyErr_Format(\n            PyExc_ValueError,\n            \"'%s' array is the wrong shape, must be %s\",\n            propname, shape_str);\n        Py_DECREF(value_array);\n        return -1;\n      }\n    }\n  }\n\n  copy_array_to_c_double(value_array, dest);\n\n  Py_DECREF(value_array);\n\n  return 0;\n}\n\nint\nset_int_array(\n    const char* propname,\n    PyObject* value,\n    int ndims,\n    const npy_intp* dims,\n    int* dest) {\n  PyArrayObject* value_array = NULL;\n  npy_int        i           = 0;\n  char           shape_str[SHAPE_STR_LEN];\n\n  if (check_delete(propname, value)) {\n    return -1;\n  }\n\n  value_array = (PyArrayObject*)PyArray_ContiguousFromAny(value, NPY_INT,\n                                                          ndims, ndims);\n  if (value_array == NULL) {\n    return -1;\n  }\n\n  if (dims != NULL) {\n    for (i = 0; i < ndims; ++i) {\n      if (PyArray_DIM(value_array, i) != dims[i]) {\n        shape_to_string(ndims, dims, shape_str);\n        PyErr_Format(\n            PyExc_ValueError,\n            \"'%s' array is the wrong shape, must be %s\",\n            propname, shape_str);\n        Py_DECREF(value_array);\n        return -1;\n      }\n    }\n  }\n\n  copy_array_to_c_int(value_array, dest);\n\n  Py_DECREF(value_array);\n\n  return 0;\n}\n\n/* get_str_list is inlined */\n\nint\nset_str_list(\n    const char* propname,\n    PyObject* value,\n    Py_ssize_t len,\n    Py_ssize_t maxlen,\n    char (*dest)[72]) {\n\n  PyObject*  str      = NULL;\n  Py_ssize_t input_len;\n  Py_ssize_t i        = 0;\n\n  if (check_delete(propname, value)) {\n    return -1;\n  }\n\n  if (maxlen == 0) {\n    maxlen = 68;\n  }\n\n  if (!PySequence_Check(value)) {\n    PyErr_Format(\n        PyExc_TypeError,\n        \"'%s' must be a sequence of strings\",\n        propname);\n    return -1;\n  }\n\n  if (PySequence_Size(value) != len) {\n    PyErr_Format(\n        PyExc_ValueError,\n        \"len(%s) must be %u\",\n        propname,\n        (unsigned int)len);\n    return -1;\n  }\n\n  /* We go through the list twice, once to verify that the list is\n     in the correct format, and then again to do the data copy.  This\n     way, we won't partially copy the contents and then throw an\n     exception. */\n  for (i = 0; i < len; ++i) {\n    str = PySequence_GetItem(value, i);\n    if (str == NULL) {\n      return -1;\n    }\n\n    if (!(PyBytes_CheckExact(str) || PyUnicode_CheckExact(str))) {\n      PyErr_Format(\n          PyExc_TypeError,\n          \"'%s' must be a sequence of bytes or strings\",\n          propname);\n      Py_DECREF(str);\n      return -1;\n    }\n\n    input_len = PySequence_Size(str);\n    if (input_len > maxlen) {\n      PyErr_Format(\n          PyExc_ValueError,\n          \"Each entry in '%s' must be less than %u characters\",\n          propname, (unsigned int)maxlen);\n      Py_DECREF(str);\n      return -1;\n    } else if (input_len == -1) {\n      Py_DECREF(str);\n      return -1;\n    }\n\n    Py_DECREF(str);\n  }\n\n  for (i = 0; i < len; ++i) {\n    str = PySequence_GetItem(value, i);\n    if (str == NULL) {\n      /* Theoretically, something has gone really wrong here, since\n         we've already verified the list. */\n      PyErr_Clear();\n      PyErr_Format(\n          PyExc_RuntimeError,\n          \"Input values have changed underneath us.  Something is seriously wrong.\");\n      return -1;\n    }\n\n    if (set_string(propname, str, dest[i], maxlen)) {\n      PyErr_Clear();\n      PyErr_Format(\n          PyExc_RuntimeError,\n          \"Input values have changed underneath us.  Something is seriously wrong.\");\n      Py_DECREF(str);\n      return -1;\n    }\n\n    Py_DECREF(str);\n  }\n\n  return 0;\n}\n\n\n/*@null@*/ PyObject*\nget_pscards(\n    /*@unused@*/ const char* propname,\n    struct pscard* ps,\n    int nps) {\n\n  PyObject*  result    = NULL;\n  PyObject*  subresult = NULL;\n  Py_ssize_t i         = 0;\n\n  if (nps < 0) {\n    nps = 0;\n  }\n\n  result = PyList_New((Py_ssize_t)nps);\n  if (result == NULL) {\n    return NULL;\n  }\n\n  if (nps && ps == NULL) {\n    PyErr_SetString(PyExc_MemoryError, \"NULL pointer\");\n    return NULL;\n  }\n\n  for (i = 0; i < (Py_ssize_t)nps; ++i) {\n    subresult = Py_BuildValue(\"iis\", ps[i].i, ps[i].m, ps[i].value);\n    if (subresult == NULL) {\n      Py_DECREF(result);\n      return NULL;\n    }\n\n    if (PyList_SetItem(result, i, subresult)) {\n      Py_DECREF(subresult);\n      Py_DECREF(result);\n      return NULL;\n    }\n  }\n\n  return result;\n}\n\nint\nset_pscards(\n    /*@unused@*/ const char* propname,\n    PyObject* value,\n    struct pscard** ps,\n    int *nps,\n    int *npsmax) {\n\n  PyObject*   subvalue  = NULL;\n  Py_ssize_t  i         = 0;\n  Py_ssize_t  size      = 0;\n  int         ival      = 0;\n  int         mval      = 0;\n  const char* strvalue  = 0;\n  void*       newmem    = NULL;\n\n  if (!PySequence_Check(value))\n    return -1;\n  size = PySequence_Size(value);\n  if (size > 0x7fffffff) {\n    /* Must be a 32-bit size */\n    return -1;\n  }\n\n  if (size > (Py_ssize_t)*npsmax) {\n    newmem = malloc(sizeof(struct pscard) * size);\n    if (newmem == NULL) {\n      PyErr_SetString(PyExc_MemoryError, \"Could not allocate memory.\");\n      return -1;\n    }\n    free(*ps);\n    *ps = newmem;\n    *npsmax = (int)size;\n  }\n\n  /* Verify the entire list for correct types first, so we don't have\n     to undo anything copied into the canonical array. */\n  for (i = 0; i < size; ++i) {\n    subvalue = PySequence_GetItem(value, i);\n    if (subvalue == NULL) {\n      return -1;\n    }\n    if (!PyArg_ParseTuple(subvalue, \"iis\", &ival, &mval, &strvalue)) {\n      Py_DECREF(subvalue);\n      return -1;\n    }\n    Py_DECREF(subvalue);\n  }\n\n  for (i = 0; i < size; ++i) {\n    subvalue = PySequence_GetItem(value, i);\n    if (subvalue == NULL) {\n      return -1;\n    }\n    if (!PyArg_ParseTuple(subvalue, \"iis\", &ival, &mval, &strvalue)) {\n      Py_DECREF(subvalue);\n      return -1;\n    }\n    Py_DECREF(subvalue);\n\n    (*ps)[i].i = ival;\n    (*ps)[i].m = mval;\n    strncpy((*ps)[i].value, strvalue, 72);\n    (*ps)[i].value[71] = '\\0';\n    (*nps) = (int)(i + 1);\n  }\n\n  return 0;\n}\n\n/*@null@*/ PyObject*\nget_pvcards(\n    /*@unused@*/ const char* propname,\n    struct pvcard* pv,\n    int npv) {\n\n  PyObject*  result    = NULL;\n  PyObject*  subresult = NULL;\n  Py_ssize_t i         = 0;\n\n  if (npv < 0) {\n    npv = 0;\n  }\n\n  result = PyList_New((Py_ssize_t)npv);\n  if (result == NULL) {\n    return NULL;\n  }\n\n  if (npv && pv == NULL) {\n    PyErr_SetString(PyExc_MemoryError, \"NULL pointer\");\n    return NULL;\n  }\n\n  for (i = 0; i < (Py_ssize_t)npv; ++i) {\n    subresult = Py_BuildValue(\"iid\", pv[i].i, pv[i].m, pv[i].value);\n    if (subresult == NULL) {\n      Py_DECREF(result);\n      return NULL;\n    }\n\n    if (PyList_SetItem(result, i, subresult)) {\n      Py_DECREF(subresult);\n      Py_DECREF(result);\n      return NULL;\n    }\n  }\n\n  return result;\n}\n\nint\nset_pvcards(\n    /*@propname@*/ const char* propname,\n    PyObject* value,\n    struct pvcard** pv,\n    int *npv,\n    int *npvmax) {\n\n  PyObject* fastseq = NULL;\n  struct pvcard* newmem = NULL;\n  Py_ssize_t size;\n  int ret = -1;\n  int i;\n\n  fastseq = PySequence_Fast(value, \"Expected sequence type\");\n  if (!fastseq)\n    goto done;\n\n  size = PySequence_Fast_GET_SIZE(value);\n  newmem = malloc(sizeof(struct pvcard) * size);\n\n  /* Raise exception if size is nonzero but newmem\n   * could not be allocated. */\n  if (size && !newmem) {\n    PyErr_SetString(PyExc_MemoryError, \"Could not allocate memory.\");\n    return -1;\n  }\n\n  for (i = 0; i < size; ++i)\n  {\n    if (!PyArg_ParseTuple(PySequence_Fast_GET_ITEM(value, i), \"iid\",\n        &newmem[i].i, &newmem[i].m, &newmem[i].value))\n    {\n      goto done;\n    }\n  }\n\n  if (size <= (Py_ssize_t)*npvmax) {\n    memcpy(*pv, newmem, sizeof(struct pvcard) * size);\n  } else { /* (size > (Py_ssize_t)*npvmax) */\n    free(*pv);\n    *npv = (int)size;\n    *pv = newmem;\n    newmem = NULL;\n  }\n  *npv = (int)size;\n\n  ret = 0;\ndone:\n  Py_XDECREF(fastseq);\n  free(newmem);\n  return ret;\n}\n\nPyObject*\nget_deepcopy(\n    PyObject* obj,\n    PyObject* memo) {\n\n  if (PyObject_HasAttrString(obj, \"__deepcopy__\")) {\n    return PyObject_CallMethod(obj, \"__deepcopy__\", \"O\", memo);\n  } else {\n    return PyObject_CallMethod(obj, \"__copy__\", \"\");\n  }\n}\n\n/***************************************************************************\n * Miscellaneous helper functions                                          *\n ***************************************************************************/\n\nint\nparse_unsafe_unit_conversion_spec(\n    const char* arg, int* ctrl) {\n\n  const char* p = NULL;\n\n  *ctrl = 0;\n\n  for (p = arg; *p != '\\0'; ++p) {\n    switch (*p) {\n    case 's':\n    case 'S':\n      *ctrl |= 1;\n      break;\n    case 'h':\n    case 'H':\n      *ctrl |= 2;\n      break;\n    case 'd':\n    case 'D':\n      *ctrl |= 4;\n      break;\n    default:\n      PyErr_SetString(\n          PyExc_ValueError,\n          \"translate_units may only contain the characters 's', 'h' or 'd'\");\n      return 1;\n    }\n  }\n\n  return 0;\n}\n"},{"id":7537,"name":"str_list_proxy.c","nodeType":"TextFile","path":"astropy/wcs/src","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#define NO_IMPORT_ARRAY\n\n#include \"astropy_wcs/pyutil.h\"\n\n/***************************************************************************\n * List-of-strings proxy object\n ***************************************************************************/\n\nstatic PyTypeObject PyStrListProxyType;\n\ntypedef struct {\n  PyObject_HEAD\n  /*@null@*/ /*@shared@*/ PyObject* pyobject;\n  Py_ssize_t size;\n  Py_ssize_t maxsize;\n  char (*array)[72];\n} PyStrListProxy;\n\nstatic void\nPyStrListProxy_dealloc(\n    PyStrListProxy* self) {\n\n  PyObject_GC_UnTrack(self);\n  Py_XDECREF(self->pyobject);\n  Py_TYPE(self)->tp_free((PyObject*)self);\n}\n\n/*@null@*/ static PyObject *\nPyStrListProxy_new(\n    PyTypeObject* type,\n    /*@unused@*/ PyObject* args,\n    /*@unused@*/ PyObject* kwds) {\n\n  PyStrListProxy* self = NULL;\n\n  self = (PyStrListProxy*)type->tp_alloc(type, 0);\n  if (self != NULL) {\n    self->pyobject = NULL;\n  }\n  return (PyObject*)self;\n}\n\nstatic int\nPyStrListProxy_traverse(\n    PyStrListProxy* self,\n    visitproc visit,\n    void *arg) {\n\n  Py_VISIT(self->pyobject);\n  return 0;\n}\n\nstatic int\nPyStrListProxy_clear(\n    PyStrListProxy *self) {\n\n  Py_CLEAR(self->pyobject);\n\n  return 0;\n}\n\n/*@null@*/ PyObject *\nPyStrListProxy_New(\n    /*@shared@*/ PyObject* owner,\n    Py_ssize_t size,\n    Py_ssize_t maxsize,\n    char (*array)[72]) {\n\n  PyStrListProxy* self = NULL;\n\n  if (maxsize == 0) {\n    maxsize = 68;\n  }\n\n  self = (PyStrListProxy*)PyStrListProxyType.tp_alloc(&PyStrListProxyType, 0);\n  if (self == NULL) {\n    return NULL;\n  }\n\n  Py_XINCREF(owner);\n  self->pyobject = owner;\n  self->size = size;\n  self->maxsize = maxsize;\n  self->array = array;\n  return (PyObject*)self;\n}\n\nstatic Py_ssize_t\nPyStrListProxy_len(\n    PyStrListProxy* self) {\n\n  return self->size;\n}\n\n/*@null@*/ static PyObject*\nPyStrListProxy_getitem(\n    PyStrListProxy* self,\n    Py_ssize_t index) {\n\n  if (index >= self->size || index < 0) {\n    PyErr_SetString(PyExc_IndexError, \"index out of range\");\n    return NULL;\n  }\n\n  return get_string(\"string\", self->array[index]);\n}\n\nstatic int\nPyStrListProxy_setitem(\n    PyStrListProxy* self,\n    Py_ssize_t index,\n    PyObject* arg) {\n\n  if (index >= self->size || index < 0) {\n    PyErr_SetString(PyExc_IndexError, \"index out of range\");\n    return -1;\n  }\n\n  return set_string(\"string\", arg, self->array[index], self->maxsize);\n}\n\n/*@null@*/ PyObject*\nstr_list_proxy_repr(\n    char (*array)[72],\n    Py_ssize_t size,\n    Py_ssize_t maxsize) {\n\n  char*       buffer  = NULL;\n  char*       wp      = NULL;\n  char*       rp      = NULL;\n  Py_ssize_t  i       = 0;\n  Py_ssize_t  j       = 0;\n  PyObject*   result  = NULL;\n  /* These are in descending order, so we can exit the loop quickly.  They\n     are in pairs: (char_to_escape, char_escaped) */\n  const char* escapes   = \"\\\\\\\\''\\rr\\ff\\vv\\nn\\tt\\bb\\aa\";\n  const char* e         = NULL;\n  char        next_char = '\\0';\n\n  /* Overallocating to allow for escaped characters */\n  buffer = malloc((size_t)size*maxsize*2 + 2);\n  if (buffer == NULL) {\n    PyErr_SetString(PyExc_MemoryError, \"Could not allocate memory.\");\n    return NULL;\n  }\n\n  wp = buffer;\n  *wp++ = '[';\n\n  for (i = 0; i < size; ++i) {\n    *wp++ = '\\'';\n    rp = array[i];\n    for (j = 0; j < maxsize && *rp != '\\0'; ++j) {\n      /* Check if this character should be escaped */\n      e = escapes;\n      next_char = *rp++;\n      do {\n        if (next_char > *e) {\n          break;\n        } else if (next_char == *e) {\n          *wp++ = '\\\\';\n          next_char = *(++e);\n          break;\n        } else {\n          e += 2;\n        }\n      } while (*e != '\\0');\n\n      *wp++ = next_char;\n    }\n    *wp++ = '\\'';\n\n    /* Add a comma for all but the last one */\n    if (i != size - 1) {\n      *wp++ = ',';\n      *wp++ = ' ';\n    }\n  }\n\n  *wp++ = ']';\n  *wp++ = '\\0';\n\n  result = PyUnicode_FromString(buffer);\n  free(buffer);\n  return result;\n}\n\n/*@null@*/ static PyObject*\nPyStrListProxy_repr(\n    PyStrListProxy* self) {\n\n  return str_list_proxy_repr(self->array, self->size, self->maxsize);\n}\n\nstatic PySequenceMethods PyStrListProxy_sequence_methods = {\n  (lenfunc)PyStrListProxy_len,\n  NULL,\n  NULL,\n  (ssizeargfunc)PyStrListProxy_getitem,\n  NULL,\n  (ssizeobjargproc)PyStrListProxy_setitem,\n  NULL,\n  NULL,\n  NULL,\n  NULL\n};\n\nstatic PyTypeObject PyStrListProxyType = {\n  PyVarObject_HEAD_INIT(NULL, 0)\n  \"astropy.wcs.StrListProxy\", /*tp_name*/\n  sizeof(PyStrListProxy),  /*tp_basicsize*/\n  0,                          /*tp_itemsize*/\n  (destructor)PyStrListProxy_dealloc, /*tp_dealloc*/\n  0,                          /*tp_print*/\n  0,                          /*tp_getattr*/\n  0,                          /*tp_setattr*/\n  0,                          /*tp_compare*/\n  (reprfunc)PyStrListProxy_repr, /*tp_repr*/\n  0,                          /*tp_as_number*/\n  &PyStrListProxy_sequence_methods, /*tp_as_sequence*/\n  0,                          /*tp_as_mapping*/\n  0,                          /*tp_hash */\n  0,                          /*tp_call*/\n  (reprfunc)PyStrListProxy_repr, /*tp_str*/\n  0,                          /*tp_getattro*/\n  0,                          /*tp_setattro*/\n  0,                          /*tp_as_buffer*/\n  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/\n  0,                          /* tp_doc */\n  (traverseproc)PyStrListProxy_traverse, /* tp_traverse */\n  (inquiry)PyStrListProxy_clear, /* tp_clear */\n  0,                          /* tp_richcompare */\n  0,                          /* tp_weaklistoffset */\n  0,                          /* tp_iter */\n  0,                          /* tp_iternext */\n  0,                          /* tp_methods */\n  0,                          /* tp_members */\n  0,                          /* tp_getset */\n  0,                          /* tp_base */\n  0,                          /* tp_dict */\n  0,                          /* tp_descr_get */\n  0,                          /* tp_descr_set */\n  0,                          /* tp_dictoffset */\n  0,                          /* tp_init */\n  0,                          /* tp_alloc */\n  PyStrListProxy_new,      /* tp_new */\n};\n\nint\n_setup_str_list_proxy_type(\n    /*@unused@*/ PyObject* m) {\n\n  if (PyType_Ready(&PyStrListProxyType) < 0) {\n    return 1;\n  }\n\n  return 0;\n}\n"},{"id":7538,"name":"wcslib_auxprm_wrap.c","nodeType":"TextFile","path":"astropy/wcs/src","text":"#define NO_IMPORT_ARRAY\n\n#include \"astropy_wcs/wcslib_auxprm_wrap.h\"\n\n#include <wcs.h>\n#include <wcsprintf.h>\n#include <tab.h>\n\n/*\n It gets to be really tedious to type long docstrings in ANSI C syntax\n (since multi-line strings literals are not valid).  Therefore, the\n docstrings are written in doc/docstrings.py, which are then converted\n by setup.py into docstrings.h, which we include here.\n*/\n#include \"astropy_wcs/docstrings.h\"\n\n\n/***************************************************************************\n * PyAuxprm methods                                                        *\n ***************************************************************************/\n\nstatic PyObject*\nPyAuxprm_new(PyTypeObject* type, PyObject* args, PyObject* kwds) {\n  PyAuxprm* self;\n  self = (PyAuxprm*)type->tp_alloc(type, 0);\n  return (PyObject*)self;\n}\n\n\nstatic int\nPyAuxprm_traverse(PyAuxprm* self, visitproc visit, void *arg) {\n  Py_VISIT(self->owner);\n  return 0;\n}\n\n\nstatic int\nPyAuxprm_clear(PyAuxprm* self) {\n  Py_CLEAR(self->owner);\n  return 0;\n}\n\n\nstatic void PyAuxprm_dealloc(PyAuxprm* self) {\n  PyAuxprm_clear(self);\n  Py_TYPE(self)->tp_free((PyObject*)self);\n}\n\n\nPyAuxprm* PyAuxprm_cnew(PyObject* wcsprm, struct auxprm* x) {\n  PyAuxprm* self;\n  self = (PyAuxprm*)(&PyAuxprmType)->tp_alloc(&PyAuxprmType, 0);\n  if (self == NULL) return NULL;\n  self->x = x;\n  Py_INCREF(wcsprm);\n  self->owner = wcsprm;\n  return self;\n}\n\n\nstatic void auxprmprt(const struct auxprm *aux) {\n\n  if (aux == 0x0) return;\n\n  wcsprintf(\"rsun_ref:\");\n  if (aux->rsun_ref != UNDEFINED) wcsprintf(\" %f\", aux->rsun_ref);\n  wcsprintf(\"\\ndsun_obs:\");\n  if (aux->dsun_obs != UNDEFINED) wcsprintf(\" %f\", aux->dsun_obs);\n  wcsprintf(\"\\ncrln_obs:\");\n  if (aux->crln_obs != UNDEFINED) wcsprintf(\" %f\", aux->crln_obs);\n  wcsprintf(\"\\nhgln_obs:\");\n  if (aux->hgln_obs != UNDEFINED) wcsprintf(\" %f\", aux->hgln_obs);\n  wcsprintf(\"\\nhglt_obs:\");\n  if (aux->hglt_obs != UNDEFINED) wcsprintf(\" %f\", aux->hglt_obs);\n\n  return;\n}\n\n\nstatic PyObject* PyAuxprm___str__(PyAuxprm* self) {\n  /* This is not thread-safe, but since we're holding onto the GIL,\n     we can assume we won't have thread conflicts */\n  wcsprintf_set(NULL);\n  auxprmprt(self->x);\n  return PyUnicode_FromString(wcsprintf_buf());\n}\n\n\n/***************************************************************************\n * Member getters/setters (properties)\n */\n\nstatic PyObject* PyAuxprm_get_rsun_ref(PyAuxprm* self, void* closure) {\n  if(self->x == NULL || self->x->rsun_ref == UNDEFINED) {\n    Py_RETURN_NONE;\n  } else {\n    return get_double(\"rsun_ref\", self->x->rsun_ref);\n  }\n}\n\nstatic int PyAuxprm_set_rsun_ref(PyAuxprm* self, PyObject* value, void* closure) {\n  if(self->x == NULL) {\n    return -1;\n  } else if (value == Py_None) {\n    self->x->rsun_ref = UNDEFINED;\n    return 0;\n  } else {\n    return set_double(\"rsun_ref\", value, &self->x->rsun_ref);\n  }\n}\n\nstatic PyObject* PyAuxprm_get_dsun_obs(PyAuxprm* self, void* closure) {\n  if(self->x == NULL || self->x->dsun_obs == UNDEFINED) {\n    Py_RETURN_NONE;\n  } else {\n    return get_double(\"dsun_obs\", self->x->dsun_obs);\n  }\n}\n\nstatic int PyAuxprm_set_dsun_obs(PyAuxprm* self, PyObject* value, void* closure) {\n  if(self->x == NULL) {\n    return -1;\n  } else if (value == Py_None) {\n    self->x->dsun_obs = UNDEFINED;\n    return 0;\n  } else {\n    return set_double(\"dsun_obs\", value, &self->x->dsun_obs);\n  }\n}\n\nstatic PyObject* PyAuxprm_get_crln_obs(PyAuxprm* self, void* closure) {\n  if(self->x == NULL || self->x->crln_obs == UNDEFINED) {\n    Py_RETURN_NONE;\n  } else {\n    return get_double(\"crln_obs\", self->x->crln_obs);\n  }\n}\n\nstatic int PyAuxprm_set_crln_obs(PyAuxprm* self, PyObject* value, void* closure) {\n  if(self->x == NULL) {\n    return -1;\n  } else if (value == Py_None) {\n    self->x->crln_obs = UNDEFINED;\n    return 0;\n  } else {\n    return set_double(\"crln_obs\", value, &self->x->crln_obs);\n  }\n}\n\nstatic PyObject* PyAuxprm_get_hgln_obs(PyAuxprm* self, void* closure) {\n  if(self->x == NULL || self->x->hgln_obs == UNDEFINED) {\n    Py_RETURN_NONE;\n  } else {\n    return get_double(\"hgln_obs\", self->x->hgln_obs);\n  }\n}\n\nstatic int PyAuxprm_set_hgln_obs(PyAuxprm* self, PyObject* value, void* closure) {\n  if(self->x == NULL) {\n    return -1;\n  } else if (value == Py_None) {\n    self->x->hgln_obs = UNDEFINED;\n    return 0;\n  } else {\n    return set_double(\"hgln_obs\", value, &self->x->hgln_obs);\n  }\n}\n\nstatic PyObject* PyAuxprm_get_hglt_obs(PyAuxprm* self, void* closure) {\n  if(self->x == NULL || self->x->hglt_obs == UNDEFINED) {\n    Py_RETURN_NONE;\n  } else {\n    return get_double(\"hglt_obs\", self->x->hglt_obs);\n  }\n}\n\nstatic int PyAuxprm_set_hglt_obs(PyAuxprm* self, PyObject* value, void* closure) {\n  if(self->x == NULL) {\n    return -1;\n  } else if (value == Py_None) {\n    self->x->hglt_obs = UNDEFINED;\n    return 0;\n  } else {\n    return set_double(\"hglt_obs\", value, &self->x->hglt_obs);\n  }\n}\n\n/***************************************************************************\n * PyAuxprm definition structures\n */\n\nstatic PyGetSetDef PyAuxprm_getset[] = {\n  {\"rsun_ref\", (getter)PyAuxprm_get_rsun_ref, (setter)PyAuxprm_set_rsun_ref, (char *)doc_rsun_ref},\n  {\"dsun_obs\", (getter)PyAuxprm_get_dsun_obs, (setter)PyAuxprm_set_dsun_obs, (char *)doc_dsun_obs},\n  {\"crln_obs\", (getter)PyAuxprm_get_crln_obs, (setter)PyAuxprm_set_crln_obs, (char *)doc_crln_obs},\n  {\"hgln_obs\", (getter)PyAuxprm_get_hgln_obs, (setter)PyAuxprm_set_hgln_obs, (char *)doc_hgln_obs},\n  {\"hglt_obs\", (getter)PyAuxprm_get_hglt_obs, (setter)PyAuxprm_set_hglt_obs, (char *)doc_hglt_obs},\n  {NULL}\n};\n\nPyTypeObject PyAuxprmType = {\n  PyVarObject_HEAD_INIT(NULL, 0)\n  \"astropy.wcs.Auxprm\",         /*tp_name*/\n  sizeof(PyAuxprm),             /*tp_basicsize*/\n  0,                            /*tp_itemsize*/\n  (destructor)PyAuxprm_dealloc, /*tp_dealloc*/\n  0,                            /*tp_print*/\n  0,                            /*tp_getattr*/\n  0,                            /*tp_setattr*/\n  0,                            /*tp_compare*/\n  0,                            /*tp_repr*/\n  0,                            /*tp_as_number*/\n  0,                            /*tp_as_sequence*/\n  0,                            /*tp_as_mapping*/\n  0,                            /*tp_hash */\n  0,                            /*tp_call*/\n  (reprfunc)PyAuxprm___str__,   /*tp_str*/\n  0,                            /*tp_getattro*/\n  0,                            /*tp_setattro*/\n  0,                            /*tp_as_buffer*/\n  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/\n  doc_Auxprm,                   /* tp_doc */\n  (traverseproc)PyAuxprm_traverse, /* tp_traverse */\n  (inquiry)PyAuxprm_clear,      /* tp_clear */\n  0,                            /* tp_richcompare */\n  0,                            /* tp_weaklistoffset */\n  0,                            /* tp_iter */\n  0,                            /* tp_iternext */\n  0,                            /* tp_methods */\n  0,                            /* tp_members */\n  PyAuxprm_getset,              /* tp_getset */\n  0,                            /* tp_base */\n  0,                            /* tp_dict */\n  0,                            /* tp_descr_get */\n  0,                            /* tp_descr_set */\n  0,                            /* tp_dictoffset */\n  0,                            /* tp_init */\n  0,                            /* tp_alloc */\n  0,                            /* tp_new */\n};\n\n\nint\n_setup_auxprm_type(PyObject* m) {\n  if (PyType_Ready(&PyAuxprmType) < 0) {\n    return -1;\n  }\n\n  Py_INCREF(&PyAuxprmType);\n\n  PyModule_AddObject(m, \"Auxprm\", (PyObject *)&PyAuxprmType);\n\n  return 0;\n}\n"},{"id":7539,"name":"wcslib_wtbarr_wrap.c","nodeType":"TextFile","path":"astropy/wcs/src","text":"#define NO_IMPORT_ARRAY\n\n#include \"astropy_wcs/wcslib_wtbarr_wrap.h\"\n\n#include <wcs.h>\n#include <wcsprintf.h>\n#include <tab.h>\n#include <wtbarr.h>\n\n/*\n It gets to be really tedious to type long docstrings in ANSI C syntax\n (since multi-line strings literals are not valid).  Therefore, the\n docstrings are written in doc/docstrings.py, which are then converted\n by setup.py into docstrings.h, which we include here.\n*/\n#include \"astropy_wcs/docstrings.h\"\n\n\n/***************************************************************************\n * PyWtbarr methods                                                        *\n ***************************************************************************/\n\nstatic PyObject*\nPyWtbarr_new(PyTypeObject* type, PyObject* args, PyObject* kwds) {\n  PyWtbarr* self;\n  self = (PyWtbarr*)type->tp_alloc(type, 0);\n  return (PyObject*)self;\n}\n\n\nstatic int\nPyWtbarr_traverse(PyWtbarr* self, visitproc visit, void *arg) {\n  Py_VISIT(self->owner);\n  return 0;\n}\n\n\nstatic int\nPyWtbarr_clear(PyWtbarr* self) {\n  Py_CLEAR(self->owner);\n  return 0;\n}\n\n\nstatic void PyWtbarr_dealloc(PyWtbarr* self) {\n  PyWtbarr_clear(self);\n  Py_TYPE(self)->tp_free((PyObject*)self);\n}\n\n\nPyWtbarr* PyWtbarr_cnew(PyObject* wcsprm, struct wtbarr* x) {\n  PyWtbarr* self;\n  self = (PyWtbarr*)(&PyWtbarrType)->tp_alloc(&PyWtbarrType, 0);\n  if (self == NULL) return NULL;\n  self->x = x;\n  Py_INCREF(wcsprm);\n  self->owner = wcsprm;\n  return self;\n}\n\n\nstatic void wtbarrprt(const struct wtbarr *wtb) {\n  int i, nd, ndim;\n\n  if (wtb == 0x0) return;\n\n  wcsprintf(\"     i: %d\\n\", wtb->i);\n  wcsprintf(\"     m: %d\\n\", wtb->m);\n  wcsprintf(\"  kind: %c\\n\", wtb->kind);\n  wcsprintf(\"extnam: %s\\n\", wtb->extnam);\n  wcsprintf(\"extver: %d\\n\", wtb->extver);\n  wcsprintf(\"extlev: %d\\n\", wtb->extlev);\n  wcsprintf(\" ttype: %s\\n\", wtb->ttype);\n  wcsprintf(\"   row: %ld\\n\", wtb->row);\n  wcsprintf(\"  ndim: %d\\n\", wtb->ndim);\n  wcsprintf(\"dimlen: %p\\n\", (void *)wtb->dimlen);\n\n  ndim = wtb->ndim - (int)(wtb->kind == 'c');\n  nd = 1 + (int) log10(ndim ? ndim : 1);\n  for (i = 0; i < ndim; i++) {\n    wcsprintf(\"        %*d:   %d\\n\", nd, i, wtb->dimlen[i]);\n  }\n  wcsprintf(\"arrayp: %p\\n\", (void *)wtb->arrayp);\n\n  return;\n}\n\n\nstatic PyObject* PyWtbarr_print_contents(PyWtbarr* self) {\n  /* This is not thread-safe, but since we're holding onto the GIL,\n     we can assume we won't have thread conflicts */\n  wcsprintf_set(NULL);\n  wtbarrprt(self->x);\n  printf(\"%s\", wcsprintf_buf());\n  fflush(stdout);\n  Py_RETURN_NONE;\n}\n\n\nstatic PyObject* PyWtbarr___str__(PyWtbarr* self) {\n  /* This is not thread-safe, but since we're holding onto the GIL,\n     we can assume we won't have thread conflicts */\n  wcsprintf_set(NULL);\n  wtbarrprt(self->x);\n  return PyUnicode_FromString(wcsprintf_buf());\n}\n\n\n/***************************************************************************\n * Member getters/setters (properties)\n */\n\n\nstatic PyObject* PyWtbarr_get_i(PyWtbarr* self, void* closure) {\n  return get_int(\"i\", self->x->i);\n}\n\n\nstatic PyObject* PyWtbarr_get_m(PyWtbarr* self, void* closure) {\n  return get_int(\"m\", self->x->m);\n}\n\n\nstatic PyObject* PyWtbarr_get_extver(PyWtbarr* self, void* closure) {\n  return get_int(\"extver\", self->x->extver);\n}\n\n\nstatic PyObject* PyWtbarr_get_extlev(PyWtbarr* self, void* closure) {\n  return get_int(\"extlev\", self->x->extlev);\n}\n\n\nstatic PyObject* PyWtbarr_get_ndim(PyWtbarr* self, void* closure) {\n  return get_int(\"ndim\", self->x->ndim);\n}\n\n\nstatic PyObject* PyWtbarr_get_row(PyWtbarr* self, void* closure) {\n  return get_int(\"row\", self->x->row);\n}\n\n\nstatic PyObject* PyWtbarr_get_extnam(PyWtbarr* self, void* closure) {\n  if (is_null(self->x->extnam)) return NULL;\n  return get_string(\"extnam\", self->x->extnam);\n}\n\n\nstatic PyObject* PyWtbarr_get_ttype(PyWtbarr* self, void* closure) {\n  if (is_null(self->x->ttype)) return NULL;\n  return get_string(\"ttype\", self->x->ttype);\n}\n\n\nstatic PyObject* PyWtbarr_get_kind(PyWtbarr* self, void* closure) {\n  return PyUnicode_FromFormat(\"%c\", self->x->kind);\n}\n\n\n/***************************************************************************\n * PyWtbarr definition structures\n */\n\nstatic PyGetSetDef PyWtbarr_getset[] = {\n  {\"i\", (getter)PyWtbarr_get_i, NULL, (char *) doc_i},\n  {\"m\", (getter)PyWtbarr_get_m, NULL, (char *) doc_m},\n  {\"kind\", (getter)PyWtbarr_get_kind, NULL, (char *) doc_kind},\n  {\"extnam\", (getter)PyWtbarr_get_extnam, NULL, (char *) doc_extnam},\n  {\"extver\", (getter)PyWtbarr_get_extver, NULL, (char *) doc_extver},\n  {\"extlev\", (getter)PyWtbarr_get_extlev, NULL, (char *) doc_extlev},\n  {\"ttype\", (getter)PyWtbarr_get_ttype, NULL, (char *) doc_ttype},\n  {\"row\", (getter)PyWtbarr_get_row, NULL, (char *) doc_row},\n  {\"ndim\", (getter)PyWtbarr_get_ndim, NULL, (char *) doc_ndim},\n/*  {\"dimlen\", (getter)PyWtbarr_get_dimlen, NULL, (char *) NULL}, */\n/*  {\"arrayp\", (getter)PyWtbarr_get_arrayp, NULL, (char *) NULL}, */\n  {NULL}\n};\n\n\nstatic PyMethodDef PyWtbarr_methods[] = {\n  {\"print_contents\", (PyCFunction)PyWtbarr_print_contents, METH_NOARGS, doc_print_contents_wtbarr},\n  {NULL}\n};\n\nPyTypeObject PyWtbarrType = {\n  PyVarObject_HEAD_INIT(NULL, 0)\n  \"astropy.wcs.Wtbarr\",         /*tp_name*/\n  sizeof(PyWtbarr),             /*tp_basicsize*/\n  0,                            /*tp_itemsize*/\n  (destructor)PyWtbarr_dealloc, /*tp_dealloc*/\n  0,                            /*tp_print*/\n  0,                            /*tp_getattr*/\n  0,                            /*tp_setattr*/\n  0,                            /*tp_compare*/\n  0,                            /*tp_repr*/\n  0,                            /*tp_as_number*/\n  0,                            /*tp_as_sequence*/\n  0,                            /*tp_as_mapping*/\n  0,                            /*tp_hash */\n  0,                            /*tp_call*/\n  (reprfunc)PyWtbarr___str__,   /*tp_str*/\n  0,                            /*tp_getattro*/\n  0,                            /*tp_setattro*/\n  0,                            /*tp_as_buffer*/\n  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/\n  doc_Wtbarr,                   /* tp_doc */\n  PyWtbarr_traverse,            /* tp_traverse */\n  PyWtbarr_clear,               /* tp_clear */\n  0,                            /* tp_richcompare */\n  0,                            /* tp_weaklistoffset */\n  0,                            /* tp_iter */\n  0,                            /* tp_iternext */\n  PyWtbarr_methods,             /* tp_methods */\n  0,                            /* tp_members */\n  PyWtbarr_getset,              /* tp_getset */\n  0,                            /* tp_base */\n  0,                            /* tp_dict */\n  0,                            /* tp_descr_get */\n  0,                            /* tp_descr_set */\n  0,                            /* tp_dictoffset */\n  0,                            /* tp_init */\n  0,                            /* tp_alloc */\n  0,                            /* tp_new */\n};\n\n\nint\n_setup_wtbarr_type(PyObject* m) {\n  if (PyType_Ready(&PyWtbarrType) < 0) {\n    return -1;\n  }\n\n  Py_INCREF(&PyWtbarrType);\n\n  PyModule_AddObject(m, \"Wtbarr\", (PyObject *)&PyWtbarrType);\n\n  return 0;\n}\n"},{"id":7540,"name":"sip_wrap.c","nodeType":"TextFile","path":"astropy/wcs/src","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#define NO_IMPORT_ARRAY\n\n#include \"astropy_wcs/sip_wrap.h\"\n#include \"astropy_wcs/docstrings.h\"\n#include \"wcs.h\"\n\nstatic void\nPySip_dealloc(\n    PySip* self) {\n\n  sip_free(&self->x);\n  Py_TYPE(self)->tp_free((PyObject*)self);\n}\n\n/*@null@*/ static PyObject *\nPySip_new(\n    PyTypeObject* type,\n    /*@unused@*/ PyObject* args,\n    /*@unused@*/ PyObject* kwds) {\n\n  PySip* self;\n\n  self = (PySip*)type->tp_alloc(type, 0);\n  if (self != NULL) {\n    sip_clear(&self->x);\n  }\n  return (PyObject*)self;\n}\n\nstatic int\nconvert_matrix(\n    /*@null@*/ PyObject* pyobj,\n    PyArrayObject** array,\n    double** data,\n    unsigned int* order) {\n\n  if (pyobj == Py_None) {\n    *array = NULL;\n    *data = NULL;\n    *order = 0;\n    return 0;\n  }\n\n  *array = (PyArrayObject*)PyArray_ContiguousFromAny(\n      pyobj, NPY_DOUBLE, 2, 2);\n  if (*array == NULL) {\n    return -1;\n  }\n\n  if (PyArray_DIM(*array, 0) != PyArray_DIM(*array, 1)) {\n    PyErr_SetString(PyExc_ValueError,\n                    \"Matrix must be square.\");\n    return -1;\n  }\n\n  *data = (double*)PyArray_DATA(*array);\n  *order = (unsigned int)PyArray_DIM(*array, 0) - 1;\n\n  return 0;\n}\n\nstatic int\nPySip_init(\n    PySip* self,\n    PyObject* args,\n    /*@unused@*/ PyObject* kwds) {\n\n  PyObject*      py_a     = NULL;\n  PyObject*      py_b     = NULL;\n  PyObject*      py_ap    = NULL;\n  PyObject*      py_bp    = NULL;\n  PyObject*      py_crpix = NULL;\n  PyArrayObject* a        = NULL;\n  PyArrayObject* b        = NULL;\n  PyArrayObject* ap       = NULL;\n  PyArrayObject* bp       = NULL;\n  PyArrayObject* crpix    = NULL;\n  double*        a_data   = NULL;\n  double*        b_data   = NULL;\n  double*        ap_data  = NULL;\n  double*        bp_data  = NULL;\n  unsigned int   a_order  = 0;\n  unsigned int   b_order  = 0;\n  unsigned int   ap_order = 0;\n  unsigned int   bp_order = 0;\n  int            status   = -1;\n\n  if (!PyArg_ParseTuple(args, \"OOOOO:Sip.__init__\",\n                        &py_a, &py_b, &py_ap, &py_bp, &py_crpix)) {\n    return -1;\n  }\n\n  if (convert_matrix(py_a, &a, &a_data, &a_order) ||\n      convert_matrix(py_b, &b, &b_data, &b_order) ||\n      convert_matrix(py_ap, &ap, &ap_data, &ap_order) ||\n      convert_matrix(py_bp, &bp, &bp_data, &bp_order)) {\n    goto exit;\n  }\n\n  crpix = (PyArrayObject*)PyArray_ContiguousFromAny(py_crpix, NPY_DOUBLE,\n                                                    1, 1);\n  if (crpix == NULL) {\n    goto exit;\n  }\n\n  if (PyArray_DIM(crpix, 0) != 2) {\n    PyErr_SetString(PyExc_ValueError, \"CRPIX wrong length\");\n    goto exit;\n  }\n\n  status = sip_init(&self->x,\n                    a_order, a_data,\n                    b_order, b_data,\n                    ap_order, ap_data,\n                    bp_order, bp_data,\n                    PyArray_DATA(crpix));\n\n exit:\n  Py_XDECREF(a);\n  Py_XDECREF(b);\n  Py_XDECREF(ap);\n  Py_XDECREF(bp);\n  Py_XDECREF(crpix);\n\n  if (status == 0) {\n    return 0;\n  } else if (status == -1) {\n    /* Exception already set */\n    return -1;\n  } else {\n    wcserr_to_python_exc(self->x.err);\n    return -1;\n  }\n}\n\n/*@null@*/ static PyObject*\nPySip_pix2foc(\n    PySip* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  PyObject*      pixcrd_obj = NULL;\n  int            origin     = 1;\n  PyArrayObject* pixcrd     = NULL;\n  PyArrayObject* foccrd     = NULL;\n  double*        foccrd_data = NULL;\n  unsigned int   nelem      = 0;\n  unsigned int   i, j;\n  int            status     = -1;\n  const char*    keywords[] = {\n    \"pixcrd\", \"origin\", NULL };\n\n  if (!PyArg_ParseTupleAndKeywords(args, kwds, \"Oi:pix2foc\", (char **)keywords,\n                                   &pixcrd_obj, &origin)) {\n    return NULL;\n  }\n\n  if (self->x.a == NULL || self->x.b == NULL) {\n    PyErr_SetString(\n        PyExc_ValueError,\n        \"SIP object does not have coefficients for pix2foc transformation (A and B)\");\n    return NULL;\n  }\n\n  pixcrd = (PyArrayObject*)PyArray_ContiguousFromAny(pixcrd_obj, NPY_DOUBLE, 2, 2);\n  if (pixcrd == NULL) {\n    goto exit;\n  }\n\n  if (PyArray_DIM(pixcrd, 1) != 2) {\n    PyErr_SetString(PyExc_ValueError, \"Pixel array must be an Nx2 array\");\n    goto exit;\n  }\n\n  foccrd = (PyArrayObject*)PyArray_SimpleNew(2, PyArray_DIMS(pixcrd),\n                                             NPY_DOUBLE);\n  if (foccrd == NULL) {\n    goto exit;\n  }\n\n  Py_BEGIN_ALLOW_THREADS\n  preoffset_array(pixcrd, origin);\n  status = sip_pix2foc(&self->x,\n                       (unsigned int)PyArray_DIM(pixcrd, 1),\n                       (unsigned int)PyArray_DIM(pixcrd, 0),\n                       (const double*)PyArray_DATA(pixcrd),\n                       (double*)PyArray_DATA(foccrd));\n  unoffset_array(pixcrd, origin);\n\n  /* Adjust for crpix */\n  foccrd_data = (double *)PyArray_DATA(foccrd);\n  nelem = (unsigned int)PyArray_DIM(foccrd, 0);\n  for (i = 0; i < nelem; ++i) {\n    for (j = 0; j < 2; ++j) {\n      foccrd_data[i*2 + j] -= self->x.crpix[j];\n    }\n  }\n  unoffset_array(foccrd, origin);\n  Py_END_ALLOW_THREADS\n\n exit:\n\n  Py_XDECREF(pixcrd);\n\n  if (status == 0) {\n    return (PyObject*)foccrd;\n  } else {\n    Py_XDECREF(foccrd);\n    if (status == -1) {\n      /* Exception already set */\n      return NULL;\n    } else {\n      wcserr_to_python_exc(self->x.err);\n      return NULL;\n    }\n  }\n}\n\n/*@null@*/ static PyObject*\nPySip_foc2pix(\n    PySip* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  PyObject*      foccrd_obj = NULL;\n  int            origin     = 1;\n  PyArrayObject* foccrd     = NULL;\n  PyArrayObject* pixcrd     = NULL;\n  int            status     = -1;\n  double*        foccrd_data = NULL;\n  unsigned int   nelem      = 0;\n  unsigned int   i, j;\n  const char*    keywords[] = {\n    \"foccrd\", \"origin\", NULL };\n\n  if (!PyArg_ParseTupleAndKeywords(args, kwds, \"Oi:foc2pix\", (char **)keywords,\n                                   &foccrd_obj, &origin)) {\n    return NULL;\n  }\n\n  if (self->x.ap == NULL || self->x.bp == NULL) {\n    PyErr_SetString(\n        PyExc_ValueError,\n        \"SIP object does not have coefficients for foc2pix transformation (AP and BP)\");\n    return NULL;\n  }\n\n  foccrd = (PyArrayObject*)PyArray_ContiguousFromAny(foccrd_obj, NPY_DOUBLE, 2, 2);\n  if (foccrd == NULL) {\n    goto exit;\n  }\n\n  if (PyArray_DIM(foccrd, 1) != 2) {\n    PyErr_SetString(PyExc_ValueError, \"Pixel array must be an Nx2 array\");\n    goto exit;\n  }\n\n  pixcrd = (PyArrayObject*)PyArray_SimpleNew(2, PyArray_DIMS(foccrd),\n                                             NPY_DOUBLE);\n  if (pixcrd == NULL) {\n    status = 2;\n    goto exit;\n  }\n\n  Py_BEGIN_ALLOW_THREADS\n  preoffset_array(foccrd, origin);\n  /* Adjust for crpix */\n  foccrd_data = (double *)PyArray_DATA(foccrd);\n  nelem = (unsigned int)PyArray_DIM(foccrd, 0);\n  for (i = 0; i < nelem; ++i) {\n    for (j = 0; j < 2; ++j) {\n      foccrd_data[i*2 + j] += self->x.crpix[j];\n    }\n  }\n\n  status = sip_foc2pix(&self->x,\n                       (unsigned int)PyArray_DIM(pixcrd, 1),\n                       (unsigned int)PyArray_DIM(pixcrd, 0),\n                       (double*)PyArray_DATA(foccrd),\n                       (double*)PyArray_DATA(pixcrd));\n\n  /* Adjust for crpix */\n  for (i = 0; i < nelem; ++i) {\n    for (j = 0; j < 2; ++j) {\n      foccrd_data[i*2 + j] -= self->x.crpix[j];\n    }\n  }\n  unoffset_array(foccrd, origin);\n  unoffset_array(pixcrd, origin);\n  Py_END_ALLOW_THREADS\n\n exit:\n  Py_XDECREF(foccrd);\n\n  if (status == 0) {\n    return (PyObject*)pixcrd;\n  } else {\n    Py_XDECREF(pixcrd);\n    if (status == -1) {\n      /* Exception already set */\n      return NULL;\n    } else {\n      wcserr_to_python_exc(self->x.err);\n      return NULL;\n    }\n  }\n}\n\n/*@null@*/ static PyObject*\nPySip_get_a(\n    PySip* self,\n    /*@unused@*/ void* closure) {\n\n  npy_intp dims[2];\n\n  if (self->x.a == NULL) {\n    Py_INCREF(Py_None);\n    return Py_None;\n  }\n\n  dims[0] = (npy_intp)self->x.a_order + 1;\n  dims[1] = (npy_intp)self->x.a_order + 1;\n\n  return get_double_array(\"a\", self->x.a, 2, dims, (PyObject*)self);\n}\n\n/*@null@*/ static PyObject*\nPySip_get_b(\n    PySip* self,\n    /*@unused@*/ void* closure) {\n\n  npy_intp dims[2];\n\n  if (self->x.b == NULL) {\n    Py_INCREF(Py_None);\n    return Py_None;\n  }\n\n  dims[0] = (npy_intp)self->x.b_order + 1;\n  dims[1] = (npy_intp)self->x.b_order + 1;\n\n  return get_double_array(\"b\", self->x.b, 2, dims, (PyObject*)self);\n}\n\n/*@null@*/ static PyObject*\nPySip_get_ap(\n    PySip* self,\n    /*@unused@*/ void* closure) {\n\n  npy_intp dims[2];\n\n  if (self->x.ap == NULL) {\n    Py_INCREF(Py_None);\n    return Py_None;\n  }\n\n  dims[0] = (npy_intp)self->x.ap_order + 1;\n  dims[1] = (npy_intp)self->x.ap_order + 1;\n\n  return get_double_array(\"ap\", self->x.ap, 2, dims, (PyObject*)self);\n}\n\n/*@null@*/ static PyObject*\nPySip_get_bp(\n    PySip* self,\n    /*@unused@*/ void* closure) {\n\n  npy_intp dims[2];\n\n  if (self->x.bp == NULL) {\n    Py_INCREF(Py_None);\n    return Py_None;\n  }\n\n  dims[0] = (npy_intp)self->x.bp_order + 1;\n  dims[1] = (npy_intp)self->x.bp_order + 1;\n\n  return get_double_array(\"bp\", self->x.bp, 2, dims, (PyObject*)self);\n}\n\nstatic PyObject*\nPySip_get_a_order(\n    PySip* self,\n    /*@unused@*/ void* closure) {\n\n  return get_int(\"a_order\", (long int)self->x.a_order);\n}\n\nstatic PyObject*\nPySip_get_b_order(\n    PySip* self,\n    /*@unused@*/ void* closure) {\n\n  return get_int(\"b_order\", (long int)self->x.b_order);\n}\n\nstatic PyObject*\nPySip_get_ap_order(\n    PySip* self,\n    /*@unused@*/ void* closure) {\n\n  return get_int(\"ap_order\", (long int)self->x.ap_order);\n}\n\nstatic PyObject*\nPySip_get_bp_order(\n    PySip* self,\n    /*@unused@*/ void* closure) {\n\n  return get_int(\"bp_order\", (long int)self->x.bp_order);\n}\n\nstatic PyObject*\nPySip_get_crpix(\n    PySip* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t naxis = 2;\n\n  return get_double_array(\"crpix\", self->x.crpix, 1, &naxis, (PyObject*)self);\n}\n\nstatic PyObject*\nPySip___copy__(\n    PySip* self,\n    /*@unused@*/ PyObject* args,\n    /*@unused@*/ PyObject* kwds) {\n\n  PySip* copy         = NULL;\n\n  copy = (PySip*)PySip_new(&PySipType, NULL, NULL);\n  if (copy == NULL) {\n    return NULL;\n  }\n\n  if (sip_init(&copy->x,\n               self->x.a_order, self->x.a,\n               self->x.b_order, self->x.b,\n               self->x.ap_order, self->x.ap,\n               self->x.bp_order, self->x.bp,\n               self->x.crpix)) {\n    Py_DECREF(copy);\n    return NULL;\n  }\n\n  return (PyObject*)copy;\n}\n\n\nstatic PyGetSetDef PySip_getset[] = {\n  {\"a\", (getter)PySip_get_a, NULL, (char *)doc_a},\n  {\"a_order\", (getter)PySip_get_a_order, NULL, (char *)doc_a_order},\n  {\"b\", (getter)PySip_get_b, NULL, (char *)doc_b},\n  {\"b_order\", (getter)PySip_get_b_order, NULL, (char *)doc_b_order},\n  {\"ap\", (getter)PySip_get_ap, NULL, (char *)doc_ap},\n  {\"ap_order\", (getter)PySip_get_ap_order, NULL, (char *)doc_ap_order},\n  {\"bp\", (getter)PySip_get_bp, NULL, (char *)doc_bp},\n  {\"bp_order\", (getter)PySip_get_bp_order, NULL, (char *)doc_bp_order},\n  {\"crpix\", (getter)PySip_get_crpix, NULL, (char *)doc_crpix},\n  {NULL}\n};\n\nstatic PyMethodDef PySip_methods[] = {\n  {\"__copy__\", (PyCFunction)PySip___copy__, METH_NOARGS, NULL},\n  {\"__deepcopy__\", (PyCFunction)PySip___copy__, METH_O, NULL},\n  {\"pix2foc\", (PyCFunction)PySip_pix2foc, METH_VARARGS|METH_KEYWORDS, doc_sip_pix2foc},\n  {\"foc2pix\", (PyCFunction)PySip_foc2pix, METH_VARARGS|METH_KEYWORDS, doc_sip_foc2pix},\n  {NULL}\n};\n\nPyTypeObject PySipType = {\n  PyVarObject_HEAD_INIT(NULL, 0)\n  \"astropy.wcs.Sip\",            /*tp_name*/\n  sizeof(PySip),                /*tp_basicsize*/\n  0,                            /*tp_itemsize*/\n  (destructor)PySip_dealloc,    /*tp_dealloc*/\n  0,                            /*tp_print*/\n  0,                            /*tp_getattr*/\n  0,                            /*tp_setattr*/\n  0,                            /*tp_compare*/\n  0,                            /*tp_repr*/\n  0,                            /*tp_as_number*/\n  0,                            /*tp_as_sequence*/\n  0,                            /*tp_as_mapping*/\n  0,                            /*tp_hash */\n  0,                            /*tp_call*/\n  0,                            /*tp_str*/\n  0,                            /*tp_getattro*/\n  0,                            /*tp_setattro*/\n  0,                            /*tp_as_buffer*/\n  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/\n  doc_Sip,                      /* tp_doc */\n  0,                            /* tp_traverse */\n  0,                            /* tp_clear */\n  0,                            /* tp_richcompare */\n  0,                            /* tp_weaklistoffset */\n  0,                            /* tp_iter */\n  0,                            /* tp_iternext */\n  PySip_methods,                /* tp_methods */\n  0,                            /* tp_members */\n  PySip_getset,                 /* tp_getset */\n  0,                            /* tp_base */\n  0,                            /* tp_dict */\n  0,                            /* tp_descr_get */\n  0,                            /* tp_descr_set */\n  0,                            /* tp_dictoffset */\n  (initproc)PySip_init,         /* tp_init */\n  0,                            /* tp_alloc */\n  PySip_new,                    /* tp_new */\n};\n\nint\n_setup_sip_type(\n    PyObject* m) {\n\n  if (PyType_Ready(&PySipType) < 0)\n    return -1;\n\n  Py_INCREF(&PySipType);\n  return PyModule_AddObject(m, \"Sip\", (PyObject *)&PySipType);\n}\n"},{"id":7541,"name":"wcslib_prjprm_wrap.c","nodeType":"TextFile","path":"astropy/wcs/src","text":"#define NO_IMPORT_ARRAY\n#include <math.h>\n#include <float.h>\n\n#include \"astropy_wcs/wcslib_celprm_wrap.h\"\n#include \"astropy_wcs/wcslib_prjprm_wrap.h\"\n\n#include <wcs.h>\n#include <wcsprintf.h>\n#include <prj.h>\n#include <numpy/npy_math.h>\n#include \"astropy_wcs/docstrings.h\"\n\n\nPyObject** prj_errexc[5];\n\n\nstatic int is_dbl_equal(double x1, double x2)\n{\n    double ax1 = fabs(x1);\n    double ax2 = fabs(x2);\n    double minx = (ax1 < ax2) ? ax1 : ax2;\n    double diff = fabs(x1 - x2);\n    return (diff <= (2.0 * DBL_EPSILON * minx) || diff < DBL_MIN);\n}\n\n\nstatic int wcslib_prj_to_python_exc(int status)\n{\n    if (status > 0 && status < 5) {\n        PyErr_SetString(*prj_errexc[status], prj_errmsg[status]);\n    } else if (status > 5) {\n        PyErr_SetString(\n            PyExc_RuntimeError,\n            \"Unknown WCSLIB prjprm-related error occurred.\");\n    }\n    return status;\n}\n\n\nstatic int is_readonly(PyPrjprm* self)\n{\n    if (self != NULL && self->owner != NULL &&\n        ((PyCelprm*)self->owner)->owner != NULL) {\n        PyErr_SetString(\n            PyExc_AttributeError,\n            \"Attribute 'prj' of 'astropy.wcs.Wcsprm.cel' objects is read-only.\");\n        return 1;\n    } else {\n        return 0;\n    }\n}\n\n\nstatic int is_prj_null(PyPrjprm* self)\n{\n    if (self->x == NULL) {\n        PyErr_SetString(PyExc_MemoryError, \"Underlying 'prjprm' object is NULL.\");\n        return 1;\n    } else {\n        return 0;\n    }\n}\n\n\n/***************************************************************************\n * PyPrjprm methods                                                        *\n ***************************************************************************/\n\nstatic PyObject* PyPrjprm_new(PyTypeObject* type, PyObject* args, PyObject* kwds)\n{\n    PyPrjprm* self;\n    self = (PyPrjprm*)type->tp_alloc(type, 0);\n    if (self == NULL) return NULL;\n    self->owner = NULL;\n    self->x = NULL;\n    self->prefcount = NULL;\n    if ((self->x = calloc(1, sizeof(struct prjprm))) == 0x0) {\n        PyErr_SetString(PyExc_MemoryError, \"Could not allocate memory.\");\n        return NULL;\n    }\n    if ((self->prefcount = (int*) malloc(sizeof(int))) == 0x0) {\n        PyErr_SetString(PyExc_MemoryError, \"Could not allocate memory.\");\n        free(self->x);\n        return NULL;\n    }\n    if (wcslib_prj_to_python_exc(prjini(self->x)))\n    {\n        free(self->x);\n        free(self->prefcount);\n        return NULL;\n    }\n    *(self->prefcount) = 1;\n    return (PyObject*)self;\n}\n\n\nstatic int PyPrjprm_traverse(PyPrjprm* self, visitproc visit, void *arg)\n{\n    Py_VISIT(self->owner);\n    return 0;\n}\n\n\nstatic int PyPrjprm_clear(PyPrjprm* self)\n{\n    Py_CLEAR(self->owner);\n    return 0;\n}\n\n\nstatic void PyPrjprm_dealloc(PyPrjprm* self)\n{\n    PyPrjprm_clear(self);\n    if (self->prefcount && (--(*self->prefcount)) == 0) {\n        wcslib_prj_to_python_exc(prjfree(self->x));\n        free(self->x);\n        free(self->prefcount);\n    }\n    Py_TYPE(self)->tp_free((PyObject*)self);\n}\n\n\nPyPrjprm* PyPrjprm_cnew(PyObject* celprm_obj, struct prjprm* x, int* prefcount)\n{\n    PyPrjprm* self;\n    self = (PyPrjprm*)(&PyPrjprmType)->tp_alloc(&PyPrjprmType, 0);\n    if (self == NULL) return NULL;\n    self->x = x;\n    Py_XINCREF(celprm_obj);\n    self->owner = celprm_obj;\n    self->prefcount = prefcount;\n    if (prefcount) (*prefcount)++;\n    return self;\n}\n\n\nstatic PyObject* PyPrjprm_copy(PyPrjprm* self)\n{\n    PyPrjprm* copy = NULL;\n    copy = PyPrjprm_cnew(self->owner, self->x, self->prefcount);\n    if (copy == NULL) return NULL;\n    return (PyObject*)copy;\n}\n\n\nstatic PyObject* PyPrjprm_deepcopy(PyPrjprm* self)\n{\n    PyPrjprm* copy = PyPrjprm_new(&PyPrjprmType, NULL, NULL);\n    if (copy == NULL) return NULL;\n\n    memcpy(copy->x, self->x, sizeof(struct prjprm));\n    copy->x->err = NULL;\n    return (PyObject*)copy;\n}\n\n\nstatic PyObject* PyPrjprm___str__(PyPrjprm* self)\n{\n    wcsprintf_set(NULL);\n    if (wcslib_prj_to_python_exc(prjprt(self->x))) {\n        return NULL;\n    }\n    return PyUnicode_FromString(wcsprintf_buf());\n}\n\n\nstatic int PyPrjprm_cset(PyPrjprm* self)\n{\n    if (wcslib_prj_to_python_exc(prjset(self->x))) {\n        return -1;\n    }\n    return 0;\n}\n\n\nstatic PyObject* PyPrjprm_set(PyPrjprm* self)\n{\n    if (is_readonly(self) || PyPrjprm_cset(self)) return NULL;\n    Py_RETURN_NONE;\n}\n\n\nstatic PyObject* _prj_eval(PyPrjprm* self, int (*prjfn)(PRJX2S_ARGS),\n                           PyObject* x1_in, PyObject* x2_in)\n{\n    Py_ssize_t i, ndim;\n    npy_intp *x1_dims, *x2_dims;\n    Py_ssize_t     nelem      = 1;\n    PyArrayObject* x1         = NULL;\n    PyArrayObject* x2         = NULL;\n    PyArrayObject* prj_x1     = NULL;\n    PyArrayObject* prj_x2     = NULL;\n    PyArrayObject* stat       = NULL;\n    PyObject*      result     = NULL;\n    int            status     = -1;\n\n    // TODO: This assumes the same shape for the input arrays.\n    //       Instead, we should broadcast.\n\n    x1 = (PyArrayObject *) PyArray_ContiguousFromObject(x1_in, NPY_DOUBLE, 1, NPY_MAXDIMS);\n    if (x1 == NULL) {\n      goto exit;\n    }\n    x2 = (PyArrayObject *) PyArray_ContiguousFromObject(x2_in, NPY_DOUBLE, 1, NPY_MAXDIMS);\n    if (x2 == NULL) {\n      goto exit;\n    }\n\n    ndim = PyArray_NDIM(x1);\n\n    if (ndim != PyArray_NDIM(x2)) {\n        PyErr_SetString(PyExc_ValueError, \"Input array dimensions do not match.\");\n        goto exit;\n    }\n\n    x1_dims = PyArray_DIMS(x1);\n    x2_dims = PyArray_DIMS(x2);\n    for (i = 0; i < ndim; i++) {\n        if (x1_dims[i] != x2_dims[i]) {\n            PyErr_SetString(PyExc_ValueError, \"Input array dimensions do not match.\");\n            goto exit;\n        }\n        nelem *= x1_dims[i];\n    }\n\n    prj_x1 = (PyArrayObject*)PyArray_SimpleNew(ndim, x1_dims, NPY_DOUBLE);\n    if (prj_x1 == NULL) {\n      goto exit;\n    }\n\n    prj_x2 = (PyArrayObject*)PyArray_SimpleNew(ndim, x1_dims, NPY_DOUBLE);\n    if (prj_x2 == NULL) {\n      goto exit;\n    }\n\n    stat = (PyArrayObject*)PyArray_SimpleNew(ndim, x1_dims, NPY_INT);\n    if (stat == NULL) {\n      goto exit;\n    }\n\n    Py_BEGIN_ALLOW_THREADS\n    status = prjfn(\n        self->x,\n        nelem, 0, 1, 1,\n        (double*)PyArray_DATA(x1),\n        (double*)PyArray_DATA(x2),\n        (double*)PyArray_DATA(prj_x1),\n        (double*)PyArray_DATA(prj_x2),\n        (int*)PyArray_DATA(stat));\n    Py_END_ALLOW_THREADS\n\n    switch (status) {\n    case 3:\n    case 4:\n        for (i = 0; i < nelem; ++i) {\n            if (((int *)PyArray_DATA(stat))[i]) {\n                ((double *)PyArray_DATA(prj_x1))[i] = NPY_NAN;\n                ((double *)PyArray_DATA(prj_x2))[i] = NPY_NAN;\n            }\n        }\n    case 0:\n        result = Py_BuildValue(\"(OO)\", prj_x1, prj_x2);\n        break;\n    default:\n        wcslib_prj_to_python_exc(status);\n        break;\n    }\n\n    exit:\n        Py_XDECREF(x1);\n        Py_XDECREF(x2);\n        Py_XDECREF(prj_x1);\n        Py_XDECREF(prj_x2);\n        Py_XDECREF(stat);\n\n    return result;\n}\n\n\nstatic PyObject* PyPrjprm_prjx2s(PyPrjprm* self, PyObject* args, PyObject* kwds)\n{\n    PyObject* x = NULL;\n    PyObject* y = NULL;\n    const char* keywords[] = { \"x\", \"y\", NULL };\n\n    if (is_prj_null(self)) return NULL;\n\n    if (!PyArg_ParseTupleAndKeywords(args, kwds, \"OO:prjx2s\",\n        (char **)keywords, &x, &y)) {\n        return NULL;\n    }\n\n    if (self->x->prjx2s == NULL || self->x->flag == 0) {\n        if (is_readonly(self)) {\n            PyErr_SetString(\n                PyExc_AttributeError,\n                \"Attribute 'prj' of 'astropy.wcs.Wcsprm.cel' objects is \"\n                \"read-only and cannot be automatically set.\");\n            return NULL;\n        } else if (PyPrjprm_cset(self)) {\n            return NULL;\n        }\n    }\n\n    return _prj_eval(self, self->x->prjx2s, x, y);\n}\n\n\nstatic PyObject* PyPrjprm_prjs2x(PyPrjprm* self, PyObject* args, PyObject* kwds)\n{\n    PyObject* phi = NULL;\n    PyObject* theta = NULL;\n    const char* keywords[] = { \"phi\", \"theta\", NULL };\n\n    if (is_prj_null(self)) return NULL;\n\n    if (!PyArg_ParseTupleAndKeywords(args, kwds, \"OO:prjs2x\",\n        (char **)keywords, &phi, &theta)) {\n        return NULL;\n    }\n\n    if (self->x->prjs2x == NULL || self->x->flag == 0) {\n        if (is_readonly(self)) {\n            PyErr_SetString(\n                PyExc_AttributeError,\n                \"Attribute 'prj' of 'astropy.wcs.Wcsprm.cel' objects is \"\n                \"read-only and cannot be automatically set.\");\n            return NULL;\n        } else if (PyPrjprm_cset(self)) {\n            return NULL;\n        }\n    }\n\n    return _prj_eval(self, self->x->prjs2x, phi, theta);\n}\n\n\n/***************************************************************************\n * Member getters/setters (properties)\n */\n\nstatic PyObject* PyPrjprm_get_flag(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else {\n        return get_int(\"flag\", self->x->flag);\n    }\n}\n\n\nstatic PyObject* PyPrjprm_get_code(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else {\n        return get_string(\"code\", self->x->code);\n    }\n}\n\n\nstatic int PyPrjprm_set_code(PyPrjprm* self, PyObject* value, void* closure)\n{\n    char code[4];\n    int code_len;\n\n    if (is_prj_null(self) || is_readonly(self)) {\n        return -1;\n    } else if (value == Py_None) {\n        if (strcmp(\"   \", self->x->code)) {\n            strcpy(self->x->code, \"   \");\n            self->x->flag = 0;\n            if (self->owner) ((PyCelprm*)self->owner)->x->flag = 0;\n        }\n    } else {\n        if (set_string(\"code\", value, code, 4)) return -1;\n        code_len = strlen(code);\n        if (code_len != 3) {\n            PyErr_Format(PyExc_ValueError,\n                \"'code' must be exactly a three character string. \"\n                \"Provided 'code' ('%s') is %d characters long.\",\n                code, code_len);\n            return -1;\n        }\n        if (strcmp(code, self->x->code)) {\n            strncpy(self->x->code, code, 4);\n            self->x->code[3] = '\\0';  /* just to be safe */\n            self->x->flag = 0;\n            if (self->owner) ((PyCelprm*)self->owner)->x->flag = 0;\n        }\n    }\n    return 0;\n}\n\n\nstatic PyObject* PyPrjprm_get_r0(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else if (self->x->r0 == UNDEFINED) {\n        Py_RETURN_NONE;\n    } else {\n        return get_double(\"r0\", self->x->r0);\n    }\n}\n\n\nstatic int PyPrjprm_set_r0(PyPrjprm* self, PyObject* value, void* closure)\n{\n    int result;\n    double r0;\n    if (is_prj_null(self) || is_readonly(self)) {\n        return -1;\n    } else if (value == Py_None) {\n        if (self->x->r0 != UNDEFINED) {\n            self->x->r0 = UNDEFINED;\n            self->x->flag = 0;\n            if (self->owner) ((PyCelprm*)self->owner)->x->flag = 0;\n        }\n    } else {\n        result = set_double(\"r0\", value, &r0);\n        if (result) return result;\n        if (r0 != self->x->r0) {\n            self->x->r0 = r0;\n            self->x->flag = 0;\n            if (self->owner) ((PyCelprm*)self->owner)->x->flag = 0;\n        }\n    }\n    return 0;\n}\n\n\nstatic PyObject* PyPrjprm_get_phi0(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else if (self->x->phi0 == UNDEFINED) {\n        Py_RETURN_NONE;\n    } else {\n        return get_double(\"phi0\", self->x->phi0);\n    }\n}\n\n\nstatic int PyPrjprm_set_phi0(PyPrjprm* self, PyObject* value, void* closure)\n{\n    int result;\n    double phi0;\n    if (is_prj_null(self) || is_readonly(self)) {\n        return -1;\n    } else if (value == Py_None) {\n        if (self->x->phi0 != UNDEFINED) {\n            self->x->phi0 = UNDEFINED;\n            self->x->flag = 0;\n            if (self->owner) ((PyCelprm*)self->owner)->x->flag = 0;\n        }\n    } else {\n        result = set_double(\"phi0\", value, &phi0);\n        if (result) return result;\n        if (phi0 != self->x->phi0) {\n            self->x->phi0 = phi0;\n            self->x->flag = 0;\n            if (self->owner) ((PyCelprm*)self->owner)->x->flag = 0;\n        }\n    }\n    return 0;\n}\n\n\nstatic PyObject* PyPrjprm_get_theta0(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else if (self->x->theta0 == UNDEFINED) {\n        Py_RETURN_NONE;\n    } else {\n        return get_double(\"theta0\", self->x->theta0);\n    }\n}\n\n\nstatic int PyPrjprm_set_theta0(PyPrjprm* self, PyObject* value, void* closure)\n{\n    int result;\n    double theta0;\n    if (is_prj_null(self) || is_readonly(self)) {\n        return -1;\n    } else if (value == Py_None) {\n        if (self->x->theta0 != UNDEFINED) {\n            self->x->theta0 = UNDEFINED;\n            self->x->flag = 0;\n            if (self->owner) ((PyCelprm*)self->owner)->x->flag = 0;\n        }\n    } else {\n        result = set_double(\"theta0\", value, &theta0);\n        if (result) return result;\n        if (theta0 != self->x->theta0) {\n            self->x->theta0 = theta0;\n            self->x->flag = 0;\n            if (self->owner) ((PyCelprm*)self->owner)->x->flag = 0;\n        }\n    }\n    return 0;\n}\n\n\nstatic PyObject* PyPrjprm_get_pv(PyPrjprm* self, void* closure)\n{\n    int k;\n    Py_ssize_t size = PVN;\n    double *pv;\n    PyObject* pv_array;\n\n    if (is_prj_null(self)) return NULL;\n\n    pv_array = (PyArrayObject*) PyArray_SimpleNew(1, &size, NPY_DOUBLE);\n    if (pv_array == NULL) return NULL;\n    pv = (double*) PyArray_DATA(pv_array);\n\n    for (k = 0; k < PVN; k++) {\n        if (self->x->pv[k] == UNDEFINED) {\n            pv[k] = (double) NPY_NAN;\n        } else {\n            pv[k] = self->x->pv[k];\n        }\n    }\n\n    return pv_array;\n}\n\n\nstatic int PyPrjprm_set_pv(PyPrjprm* self, PyObject* value, void* closure)\n{\n    int k, modified;\n    npy_intp size;\n    double *data;\n    PyObject* value_array = NULL;\n    int skip[PVN];\n\n    if (is_prj_null(self) || is_readonly(self)) return -1;\n\n    if (value == Py_None) {\n        /* If pv is set to None - reset pv to prjini values: */\n        self->x->pv[0] = 0.0;\n        for (k = 1; k < 4; self->x->pv[k++] = UNDEFINED);\n        for (k = 4; k < PVN; self->x->pv[k++] = 0.0);\n        self->x->flag = 0;\n        if (self->owner) ((PyCelprm*)self->owner)->x->flag = 0;\n        return 0;\n    }\n\n    value_array = PyArray_ContiguousFromAny(value, NPY_DOUBLE, 1, 1);\n    if (!value_array) return -1;\n\n    size = PyArray_SIZE(value_array);\n\n    if (size < 1) {\n        Py_DECREF(value_array);\n        PyErr_SetString(PyExc_ValueError,\n            \"PV must be a non-empty 1-dimentional list of values or None.\");\n        return -1;\n    }\n\n    if (size > PVN) {\n        Py_DECREF(value_array);\n        PyErr_Format(PyExc_RuntimeError, \"Number of PV values cannot exceed %d.\", PVN);\n        return -1;\n    }\n\n    if (PyList_Check(value)) {\n        for (k = 0; k < size; k++) {\n            skip[k] = (PyList_GetItem(value, k) == Py_None);\n        }\n    } else if (PyTuple_Check(value)) {\n        for (k = 0; k < size; k++) {\n            skip[k] = (PyTuple_GetItem(value, k) == Py_None);\n        }\n    } else {\n        for (k = 0; k < size; k++) skip[k] = 0;\n    }\n\n    data = (double*) PyArray_DATA(value_array);\n\n    modified = 0;\n    for (k = 0; k < size; k++) {\n        if (skip[k]) continue;\n        if (is_dbl_equal(self->x->pv[k], data[k])) {\n            /* update PV but do not flag it as modified since values are\n               essentially the same.\n            */\n            self->x->pv[k] = data[k];\n        } else if (npy_isnan(data[k])) {\n            self->x->pv[k] = UNDEFINED;\n            modified = 1;\n        } else {\n            self->x->pv[k] = data[k];\n            modified = 1;\n        }\n    }\n    Py_DECREF(value_array);\n\n    if (modified) {\n        self->x->flag = 0;\n        if (self->owner) ((PyCelprm*)self->owner)->x->flag = 0;\n    }\n    return 0;\n}\n\n\nstatic PyObject* PyPrjprm_get_pvi(PyPrjprm* self, PyObject* args, PyObject* kwds)\n{\n    int idx;\n    PyObject* index = NULL;\n    PyObject* value = NULL;\n    const char* keywords[] = { \"index\", NULL };\n\n    if (is_prj_null(self)) return NULL;\n\n    if (!PyArg_ParseTupleAndKeywords(args, kwds, \"O:get_pvi\",\n        (char **)keywords, &index)) {\n        return NULL;\n    }\n\n    if (!PyLong_Check(index)) {\n        PyErr_SetString(PyExc_TypeError,\n        \"PV index must be an integer number.\");\n    }\n\n    idx = PyLong_AsLong(index);\n    if (idx == -1 && PyErr_Occurred()) {\n        return NULL;\n    }\n\n    if (idx < 0 || idx >= PVN) {\n        PyErr_Format(PyExc_ValueError,\n            \"PV index must be an integer number between 0 and %d.\", PVN - 1);\n        return NULL;\n    }\n\n    if (self->x->pv[idx] == UNDEFINED) {\n        return PyFloat_FromDouble((double) NPY_NAN);\n    } else {\n        return PyFloat_FromDouble(self->x->pv[idx]);\n    }\n}\n\n\nstatic PyObject* PyPrjprm_set_pvi(PyPrjprm* self, PyObject* args, PyObject* kwds)\n{\n    int idx, size;\n    double data;\n    PyObject* scalar= NULL;\n    PyObject* index = NULL;\n    PyObject* value = NULL;\n    PyObject* flt_value = NULL;\n    PyObject* value_array = NULL;\n    const char* keywords[] = { \"index\", \"value\", NULL };\n    PyArray_Descr* dbl_descr = PyArray_DescrNewFromType(NPY_DOUBLE);\n\n    if (is_prj_null(self) || is_readonly(self)) return NULL;\n\n    if (!PyArg_ParseTupleAndKeywords(args, kwds, \"OO:set_pvi\",\n        (char **)keywords, &index, &value)) {\n        return NULL;\n    }\n\n    if (!PyLong_Check(index)) {\n        PyErr_SetString(PyExc_TypeError,\n        \"PV index must be an integer number.\");\n    }\n\n    idx = PyLong_AsLong(index);\n    if (idx == -1 && PyErr_Occurred()) {\n        return NULL;\n    }\n\n    if (idx < 0 || idx >= PVN) {\n        PyErr_Format(PyExc_ValueError,\n            \"PV index must be an integer number between 0 and %d.\", PVN - 1);\n        return NULL;\n    }\n\n    if (value == Py_None) {\n        /* If pv is set to None - reset pv to prjini values: */\n        self->x->pv[idx] = (idx > 0 && idx < 4) ? UNDEFINED : 0.0;\n        self->x->flag = 0;\n        if (self->owner) ((PyCelprm*)self->owner)->x->flag = 0;\n        Py_RETURN_NONE;\n    }\n\n    if (PyFloat_Check(value) || PyLong_Check(value)) {\n        data = PyFloat_AsDouble(value);\n        if (data == -1.0 && PyErr_Occurred()) {\n            return NULL;\n        }\n\n    } else if (PyUnicode_Check(value)) {\n        flt_value = PyFloat_FromString(value);\n        if (!flt_value) return NULL;\n        data = PyFloat_AsDouble(flt_value);\n        Py_DECREF(flt_value);\n        if (data == -1.0 && PyErr_Occurred()) {\n            return NULL;\n        }\n\n    } else {\n        if (PyArray_Converter(value, &value_array) == NPY_FAIL) {\n            return NULL;\n        }\n\n        size = PyArray_SIZE(value_array);\n        if (size != 1) {\n            Py_DECREF(value_array);\n            PyErr_SetString(PyExc_ValueError,\n                \"PV value must be a scalar-like object or None.\");\n            return NULL;\n        }\n\n        scalar = PyArray_ToScalar(PyArray_DATA(value_array), value_array);\n        Py_DECREF(value_array);\n        if (!scalar) {\n            Py_DECREF(scalar);\n            PyErr_SetString(PyExc_TypeError, \"Unable to convert value to scalar.\");\n        }\n\n        PyArray_CastScalarToCtype(scalar, &data, dbl_descr);\n        Py_DECREF(scalar);\n        if (PyErr_Occurred()) {\n            return NULL;\n        }\n    }\n\n    data = (isnan(data)) ? UNDEFINED : data;\n\n    if (!is_dbl_equal(self->x->pv[idx], data)) {\n        self->x->flag = 0;\n        if (self->owner) ((PyCelprm*)self->owner)->x->flag = 0;\n    }\n    self->x->pv[idx] = data;\n\n    Py_RETURN_NONE;\n}\n\n\nstatic PyObject* PyPrjprm_get_bounds(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else {\n        return get_int(\"bounds\", self->x->bounds);\n    }\n}\n\n\nstatic int PyPrjprm_set_bounds(PyPrjprm* self, PyObject* value, void* closure)\n{\n    if (is_prj_null(self) || is_readonly(self)) {\n        return -1;\n    } else if (value == Py_None) {\n        self->x->bounds = 0;\n        return 0;\n    } else {\n        return set_int(\"bounds\", value, &self->x->bounds);\n    }\n}\n\n\nstatic PyObject* PyPrjprm_get_w(PyPrjprm* self, void* closure)\n{\n    Py_ssize_t size = 10;\n    int k;\n    double *w;\n    PyObject* w_array;\n\n    if (is_prj_null(self)) return NULL;\n\n    w_array = (PyObject*) PyArray_SimpleNew(1, &size, NPY_DOUBLE);\n    if (w_array == NULL) return NULL;\n    w = (double*) PyArray_DATA(w_array);\n\n    for (k = 0; k < size; k++) {\n        if (self->x->w[k] == UNDEFINED) {\n            w[k] = (double) NPY_NAN;\n        } else {\n            w[k] = self->x->w[k];\n        }\n    }\n\n    return w_array;\n}\n\n\nstatic PyObject* PyPrjprm_get_name(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else {\n        return get_string(\"name\", self->x->name);\n    }\n}\n\n\nstatic PyObject* PyPrjprm_get_category(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else {\n        return get_int(\"category\", self->x->category);\n    }\n}\n\n\nstatic PyObject* PyPrjprm_get_pvrange(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else {\n        return get_int(\"pvrange\", self->x->pvrange);\n    }\n}\n\n\nstatic PyObject* PyPrjprm_get_simplezen(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else {\n        return PyBool_FromLong(self->x->simplezen);\n    }\n}\n\n\nstatic PyObject* PyPrjprm_get_equiareal(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else {\n        return PyBool_FromLong(self->x->equiareal);\n    }\n}\n\n\nstatic PyObject* PyPrjprm_get_conformal(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else {\n        return PyBool_FromLong(self->x->conformal);\n    }\n}\n\n\nstatic PyObject* PyPrjprm_get_global_projection(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else {\n        return PyBool_FromLong(self->x->global);\n    }\n}\n\n\nstatic PyObject* PyPrjprm_get_divergent(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else {\n        return PyBool_FromLong(self->x->divergent);\n    }\n}\n\n\nstatic PyObject* PyPrjprm_get_x0(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else {\n        return get_double(\"x0\", self->x->x0);\n    }\n}\n\n\nstatic PyObject* PyPrjprm_get_y0(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else {\n        return get_double(\"y0\", self->x->y0);\n    }\n}\n\n\nstatic PyObject* PyPrjprm_get_m(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else {\n        return get_int(\"m\", self->x->m);\n    }\n}\n\n\nstatic PyObject* PyPrjprm_get_n(PyPrjprm* self, void* closure)\n{\n    if (is_prj_null(self)) {\n        return NULL;\n    } else {\n        return get_int(\"n\", self->x->n);\n    }\n}\n\n\n/***************************************************************************\n * PyPrjprm definition structures\n */\n\nstatic PyGetSetDef PyPrjprm_getset[] = {\n    {\"r0\", (getter)PyPrjprm_get_r0, (setter)PyPrjprm_set_r0, (char *)doc_prjprm_r0},\n    {\"phi0\", (getter)PyPrjprm_get_phi0, (setter)PyPrjprm_set_phi0, (char *)doc_prjprm_phi0},\n    {\"theta0\", (getter)PyPrjprm_get_theta0, (setter)PyPrjprm_set_theta0, (char *)doc_prjprm_theta0},\n    {\"pv\", (getter)PyPrjprm_get_pv, (setter)PyPrjprm_set_pv, (char *)doc_prjprm_pv},\n    {\"w\", (getter)PyPrjprm_get_w, NULL, (char *)doc_prjprm_w},\n    {\"name\", (getter)PyPrjprm_get_name, NULL, (char *)doc_prjprm_name},\n    {\"code\", (getter)PyPrjprm_get_code, (setter)PyPrjprm_set_code, (char *)doc_prjprm_code},\n    {\"bounds\", (getter)PyPrjprm_get_bounds, (setter)PyPrjprm_set_bounds, (char *)doc_prjprm_bounds},\n    {\"category\", (getter)PyPrjprm_get_category, NULL, (char *)doc_prjprm_category},\n    {\"pvrange\", (getter)PyPrjprm_get_pvrange, NULL, (char *)doc_prjprm_pvrange},\n    {\"simplezen\", (getter)PyPrjprm_get_simplezen, NULL, (char *)doc_prjprm_simplezen},\n    {\"equiareal\", (getter)PyPrjprm_get_equiareal, NULL, (char *)doc_prjprm_equiareal},\n    {\"conformal\", (getter)PyPrjprm_get_conformal, NULL, (char *)doc_prjprm_conformal},\n    {\"global_projection\", (getter)PyPrjprm_get_global_projection, NULL, (char *)doc_prjprm_global_projection},\n    {\"divergent\", (getter)PyPrjprm_get_divergent, NULL, (char *)doc_prjprm_divergent},\n    {\"x0\", (getter)PyPrjprm_get_x0, NULL, (char *)doc_prjprm_x0},\n    {\"y0\", (getter)PyPrjprm_get_y0, NULL, (char *)doc_prjprm_y0},\n    {\"m\", (getter)PyPrjprm_get_m, NULL, (char *)doc_prjprm_m},\n    {\"n\", (getter)PyPrjprm_get_n, NULL, (char *)doc_prjprm_n},\n    {\"_flag\", (getter)PyPrjprm_get_flag, NULL, \"\"},\n    {NULL}\n};\n\n\nstatic PyMethodDef PyPrjprm_methods[] = {\n    {\"set\", (PyCFunction)PyPrjprm_set, METH_NOARGS, (char*)doc_prjprm_set},\n    {\"prjx2s\", (PyCFunction)PyPrjprm_prjx2s, METH_VARARGS|METH_KEYWORDS, (char*)doc_prjprm_prjx2s},\n    {\"prjs2x\", (PyCFunction)PyPrjprm_prjs2x, METH_VARARGS|METH_KEYWORDS, (char*)doc_prjprm_prjs2x},\n    {\"set_pvi\", (PyCFunction)PyPrjprm_set_pvi, METH_VARARGS|METH_KEYWORDS, (char*)doc_prjprm_pvi},\n    {\"get_pvi\", (PyCFunction)PyPrjprm_get_pvi, METH_VARARGS|METH_KEYWORDS, (char*)doc_prjprm_pvi},\n    {\"__copy__\", (PyCFunction)PyPrjprm_copy, METH_NOARGS, \"\"},\n    {\"__deepcopy__\", (PyCFunction)PyPrjprm_deepcopy, METH_O, \"\"},\n    {NULL}\n};\n\n\nPyTypeObject PyPrjprmType = {\n    PyVarObject_HEAD_INIT(NULL, 0)\n    \"astropy.wcs.Prjprm\",         /*tp_name*/\n    sizeof(PyPrjprm),             /*tp_basicsize*/\n    0,                            /*tp_itemsize*/\n    (destructor)PyPrjprm_dealloc, /*tp_dealloc*/\n    0,                            /*tp_print*/\n    0,                            /*tp_getattr*/\n    0,                            /*tp_setattr*/\n    0,                            /*tp_compare*/\n    0,                            /*tp_repr*/\n    0,                            /*tp_as_number*/\n    0,                            /*tp_as_sequence*/\n    0,                            /*tp_as_mapping*/\n    0,                            /*tp_hash */\n    0,                            /*tp_call*/\n    (reprfunc)PyPrjprm___str__,   /*tp_str*/\n    0,                            /*tp_getattro*/\n    0,                            /*tp_setattro*/\n    0,                            /*tp_as_buffer*/\n    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/\n    doc_Prjprm,                   /* tp_doc */\n    (traverseproc)PyPrjprm_traverse, /* tp_traverse */\n    (inquiry)PyPrjprm_clear,      /* tp_clear */\n    0,                            /* tp_richcompare */\n    0,                            /* tp_weaklistoffset */\n    0,                            /* tp_iter */\n    0,                            /* tp_iternext */\n    PyPrjprm_methods,             /* tp_methods */\n    0,                            /* tp_members */\n    PyPrjprm_getset,              /* tp_getset */\n    0,                            /* tp_base */\n    0,                            /* tp_dict */\n    0,                            /* tp_descr_get */\n    0,                            /* tp_descr_set */\n    0,                            /* tp_dictoffset */\n    0,                            /* tp_init */\n    0,                            /* tp_alloc */\n    PyPrjprm_new,                 /* tp_new */\n};\n\n\nint _setup_prjprm_type(PyObject* m)\n{\n    if (PyType_Ready(&PyPrjprmType) < 0) return -1;\n    Py_INCREF(&PyPrjprmType);\n    PyModule_AddObject(m, \"Prjprm\", (PyObject *)&PyPrjprmType);\n\n    prj_errexc[0] = NULL;                         /* Success */\n    prj_errexc[1] = &PyExc_MemoryError;           /* Null prjprm pointer passed */\n    prj_errexc[2] = &WcsExc_InvalidPrjParameters; /* Invalid projection parameters */\n    prj_errexc[3] = &WcsExc_InvalidCoordinate;    /* One or more of the (x,y) coordinates were invalid */\n    prj_errexc[4] = &WcsExc_InvalidCoordinate;    /* One or more of the (lng,lat) coordinates were invalid */\n\n    return 0;\n}\n"},{"id":7542,"name":"wcslib_celprm_wrap.c","nodeType":"TextFile","path":"astropy/wcs/src","text":"#define NO_IMPORT_ARRAY\n\n#include \"astropy_wcs/wcslib_celprm_wrap.h\"\n#include \"astropy_wcs/wcslib_prjprm_wrap.h\"\n\n#include <wcs.h>\n#include <wcsprintf.h>\n#include <cel.h>\n#include <prj.h>\n#include <wcserr.h>\n#include <numpy/npy_math.h>\n\n#include <stdio.h>\n\n/*\n It gets to be really tedious to type long docstrings in ANSI C syntax\n (since multi-line strings literals are not valid).  Therefore, the\n docstrings are written in doc/docstrings.py, which are then converted\n by setup.py into docstrings.h, which we include here.\n*/\n#include \"astropy_wcs/docstrings.h\"\n#include \"astropy_wcs/wcslib_wrap.h\"\n\n\nPyObject** cel_errexc[7];\n\n\nstatic int wcslib_cel_to_python_exc(int status)\n{\n    if (status > 0 && status < 7) {\n        PyErr_SetString(*cel_errexc[status], cel_errmsg[status]);\n    } else if (status > 6) {\n        PyErr_SetString(\n            PyExc_RuntimeError,\n            \"Unknown WCSLIB celprm-related error occurred.\");\n    }\n    return status;\n}\n\n\nstatic int is_readonly(PyCelprm* self)\n{\n    if (self != NULL && self->owner != NULL) {\n        PyErr_SetString(\n                PyExc_AttributeError,\n                \"Attribute 'cel' of 'astropy.wcs.Wcsprm' objects is read-only.\");\n        return 1;\n    } else {\n        return 0;\n    }\n}\n\n\nstatic int is_cel_null(PyCelprm* self)\n{\n    if (self->x == NULL) {\n        PyErr_SetString(\n                PyExc_MemoryError,\n                \"Underlying 'celprm' object is NULL.\");\n        return 1;\n    } else {\n        return 0;\n    }\n}\n\n\n/***************************************************************************\n * PyCelprm methods                                                        *\n ***************************************************************************/\n\nstatic PyObject* PyCelprm_new(PyTypeObject* type, PyObject* args, PyObject* kwds)\n{\n    PyCelprm* self;\n    self = (PyCelprm*)type->tp_alloc(type, 0);\n    if (self == NULL) return NULL;\n    self->owner = NULL;\n    self->prefcount = NULL;\n\n    if ((self->x = calloc(1, sizeof(struct celprm))) == 0x0) {\n        PyErr_SetString(PyExc_MemoryError,\n        \"Could not allocate memory for celprm structure.\");\n        return NULL;\n    }\n    if ((self->prefcount = (int*) malloc(sizeof(int))) == 0x0) {\n        PyErr_SetString(PyExc_MemoryError, \"Could not allocate memory.\");\n        free(self->x);\n        return NULL;\n    }\n\n    if (wcslib_cel_to_python_exc(celini(self->x))) {\n        free(self->x);\n        free(self->prefcount);\n        return NULL;\n    }\n    *(self->prefcount) = 1;\n    return (PyObject*)self;\n}\n\n\nstatic int PyCelprm_traverse(PyCelprm* self, visitproc visit, void *arg)\n{\n    Py_VISIT(self->owner);\n    return 0;\n}\n\n\nstatic int PyCelprm_clear(PyCelprm* self)\n{\n    Py_CLEAR(self->owner);\n    return 0;\n}\n\n\nstatic void PyCelprm_dealloc(PyCelprm* self)\n{\n    PyCelprm_clear(self);\n    wcslib_cel_to_python_exc(celfree(self->x)); // free memory used for err msg\n    if (self->prefcount && (--(*self->prefcount)) == 0) {\n        free(self->x);\n        free(self->prefcount);\n    }\n    Py_TYPE(self)->tp_free((PyObject*)self);\n}\n\n\nstatic int PyCelprm_cset(PyCelprm* self)\n{\n    if (wcslib_cel_to_python_exc(celset(self->x))) {\n        return -1;\n    }\n    return 0;\n}\n\n\nstatic PyObject* PyCelprm_set(PyCelprm* self)\n{\n    if (is_readonly(self) || PyCelprm_cset(self)) return NULL;\n    Py_RETURN_NONE;\n}\n\n\nPyCelprm* PyCelprm_cnew(PyObject* wcsprm_obj, struct celprm* x, int* prefcount)\n{\n    PyCelprm* self;\n    self = (PyCelprm*)(&PyCelprmType)->tp_alloc(&PyCelprmType, 0);\n    if (self == NULL) return NULL;\n    self->x = x;\n    Py_XINCREF(wcsprm_obj);\n    self->owner = wcsprm_obj;\n    self->prefcount = prefcount;\n    if (prefcount) (*prefcount)++;\n    return self;\n}\n\n\nstatic PyObject* PyCelprm_copy(PyCelprm* self)\n{\n    PyCelprm* copy = NULL;\n    copy = PyCelprm_cnew(self->owner, self->x, self->prefcount);\n    if (copy == NULL) return NULL;\n    return (PyObject*)copy;\n}\n\n\nstatic PyObject* PyCelprm_deepcopy(PyCelprm* self)\n{\n    PyCelprm* copy = PyCelprm_new(&PyCelprmType, NULL, NULL);\n    if (copy == NULL) return NULL;\n\n    memcpy(copy->x, self->x, sizeof(struct celprm));\n    copy->x->err = NULL;\n    return (PyObject*)copy;\n}\n\n\nstatic PyObject* PyCelprm___str__(PyCelprm* self) {\n    /* if (PyCelprm_cset(self)) return NULL; */\n    /* This is not thread-safe, but since we're holding onto the GIL,\n       we can assume we won't have thread conflicts */\n    wcsprintf_set(NULL);\n    if (wcslib_cel_to_python_exc(celprt(self->x))) {\n        return NULL;\n    }\n    return PyUnicode_FromString(wcsprintf_buf());\n}\n\n\n/***************************************************************************\n * Member getters/setters (properties)\n */\n\n\nstatic PyObject* PyCelprm_get_flag(PyCelprm* self, void* closure)\n{\n    if (is_cel_null(self)) {\n        return NULL;\n    } else {\n        return get_int(\"flag\", self->x->flag);\n    }\n}\n\nstatic PyObject* PyCelprm_get_offset(PyCelprm* self, void* closure)\n{\n    if (is_cel_null(self)) {\n        return NULL;\n    } else {\n        return get_bool(\"offset\", self->x->offset);\n    }\n}\n\n\nstatic int PyCelprm_set_offset(PyCelprm* self, PyObject* value, void* closure)\n{\n    if (is_cel_null(self) || is_readonly(self)) {\n        return -1;\n    } else if (value == Py_None) {\n        self->x->offset = 0;\n        return 0;\n    } else {\n        return set_bool(\"offset\", value, &self->x->offset);\n    }\n}\n\n\nstatic PyObject* PyCelprm_get_phi0(PyCelprm* self, void* closure)\n{\n    if (is_cel_null(self)) {\n        return NULL;\n    } else if (self->x->phi0 != UNDEFINED) {\n        return get_double(\"phi0\", self->x->phi0);\n    }\n    Py_RETURN_NONE;\n}\n\n\nstatic int PyCelprm_set_phi0(PyCelprm* self, PyObject* value, void* closure)\n{\n    int result;\n    double phi0;\n\n    if (is_cel_null(self) || is_readonly(self)) {\n        return -1;\n    } else if (value == Py_None) {\n        if (self->x->phi0 != UNDEFINED) {\n            self->x->phi0 = UNDEFINED;\n            self->x->flag = 0;\n        }\n    } else {\n        result = set_double(\"phi0\", value, &phi0);\n        if (result) return result;\n        if (phi0 != self->x->phi0) {\n            self->x->phi0 = phi0;\n            self->x->flag = 0;\n        }\n    }\n    return 0;\n}\n\n\nstatic PyObject* PyCelprm_get_theta0(PyCelprm* self, void* closure)\n{\n    if (is_cel_null(self)) {\n        return NULL;\n    } else if (self->x->theta0 != UNDEFINED) {\n        return get_double(\"theta0\", self->x->theta0);\n    }\n    Py_RETURN_NONE;\n}\n\n\nstatic int PyCelprm_set_theta0(PyCelprm* self, PyObject* value, void* closure)\n{\n    int result;\n    double theta0;\n    if(is_cel_null(self) || is_readonly(self)) {\n        return -1;\n    } else if (value == Py_None) {\n        if (self->x->theta0 != UNDEFINED) {\n            self->x->theta0 = UNDEFINED;\n            self->x->flag = 0;\n        }\n    } else {\n        result = set_double(\"theta0\", value, &theta0);\n        if (result) return result;\n        if (theta0 != self->x->theta0) {\n            self->x->theta0 = theta0;\n            self->x->flag = 0;\n        }\n    }\n    return 0;\n}\n\n\nstatic PyObject* PyCelprm_get_ref(PyCelprm* self, void* closure)\n{\n    Py_ssize_t size = 4;\n    if (is_cel_null(self)) {\n        return NULL;\n    } else {\n        return get_double_array(\"ref\", self->x->ref, 1, &size, (PyObject*) self);\n    }\n}\n\n\nstatic int PyCelprm_set_ref(PyCelprm* self, PyObject* value, void* closure)\n{\n    int i;\n    int skip[4] = {0, 0, 0, 0};\n    double ref[4] = {0.0, 0.0, UNDEFINED, +90.0};\n    npy_intp size;\n    double *data;\n\n    if (is_cel_null(self) || is_readonly(self)) return -1;\n\n    if (value == Py_None) {\n        /* If ref is set to None - reset ref to celini values: */\n        for (i = 0; i < 4; i++) {\n            self->x->ref[i] = ref[i];\n        }\n        self->x->flag = 0;\n        return 0;\n    }\n\n    PyObject* value_array = PyArray_ContiguousFromAny(value, NPY_DOUBLE, 1, 1);\n    if (!value_array) return -1;\n\n    size = PyArray_SIZE(value_array);\n\n    if (size < 1) {\n        Py_DECREF(value_array);\n        PyErr_SetString(PyExc_ValueError,\n            \"'ref' must be a non-empty 1-dimentional list of values or None.\");\n        return -1;\n    }\n\n    if (size > 4) {\n        Py_DECREF(value_array);\n        PyErr_SetString(PyExc_RuntimeError, \"Number of 'ref' values cannot exceed 4.\");\n        return -1;\n    }\n\n    if (PyList_Check(value)) {\n        for (i = 0; i < size; i++) {\n            skip[i] = (PyList_GetItem(value, i) == Py_None);\n        }\n    }\n\n    data = (double*) PyArray_DATA(value_array);\n\n    for (i = 0; i < size; i++) {\n        if (skip[i]) continue;\n        if (npy_isnan(self->x->ref[i])) {\n            self->x->ref[i] = UNDEFINED;\n        } else {\n            self->x->ref[i] = data[i];\n        }\n    }\n    for (i = size; i < 4; i++) {\n        self->x->ref[i] = ref[i];\n    }\n\n    self->x->flag = 0;\n    Py_DECREF(value_array);\n    return 0;\n}\n\n\nstatic PyObject* PyCelprm_get_prj(PyCelprm* self, void* closure)\n{\n    if (is_cel_null(self)) return NULL;\n    return (PyObject*)PyPrjprm_cnew((PyObject *)self, &(self->x->prj), NULL);\n}\n\n\nstatic PyObject* PyCelprm_get_euler(PyCelprm* self, void* closure)\n{\n    Py_ssize_t size = 5;\n    if (is_cel_null(self)) return NULL;\n    return get_double_array(\"euler\", self->x->euler, 1, &size, (PyObject*) self);\n}\n\n\nstatic PyObject* PyCelprm_get_latpreq(PyCelprm* self, void* closure)\n{\n    if (is_cel_null(self)) return NULL;\n    return get_int(\"lapreq\", self->x->latpreq);\n}\n\n\nstatic PyObject* PyCelprm_get_isolat(PyCelprm* self, void* closure)\n{\n    if (is_cel_null(self)) {\n        return NULL;\n    } else {\n        return get_bool(\"isolat\", self->x->isolat);\n    }\n}\n\n\n/***************************************************************************\n * PyCelprm definition structures\n */\n\nstatic PyGetSetDef PyCelprm_getset[] = {\n    {\"offset\", (getter)PyCelprm_get_offset, (setter)PyCelprm_set_offset, (char *)doc_cel_offset},\n    {\"phi0\", (getter)PyCelprm_get_phi0, (setter)PyCelprm_set_phi0, (char *)doc_celprm_phi0},\n    {\"theta0\", (getter)PyCelprm_get_theta0, (setter)PyCelprm_set_theta0, (char *)doc_celprm_theta0},\n    {\"ref\", (getter)PyCelprm_get_ref, (setter)PyCelprm_set_ref, (char *)doc_celprm_ref},\n    {\"euler\", (getter)PyCelprm_get_euler, NULL, (char *)doc_celprm_euler},\n    {\"latpreq\", (getter)PyCelprm_get_latpreq, NULL, (char *)doc_celprm_latpreq},\n    {\"isolat\", (getter)PyCelprm_get_isolat, NULL, (char *)doc_celprm_isolat},\n    {\"_flag\", (getter)PyCelprm_get_flag, NULL, \"\"},\n    {\"prj\", (getter)PyCelprm_get_prj, NULL, (char *)doc_celprm_prj},\n    {NULL}\n};\n\n\nstatic PyMethodDef PyCelprm_methods[] = {\n    {\"set\", (PyCFunction)PyCelprm_set, METH_NOARGS, doc_set_celprm},\n    {\"__copy__\", (PyCFunction)PyCelprm_copy, METH_NOARGS, \"\"},\n    {\"__deepcopy__\", (PyCFunction)PyCelprm_deepcopy, METH_O, \"\"},\n    {NULL}\n};\n\n\nPyTypeObject PyCelprmType = {\n    PyVarObject_HEAD_INIT(NULL, 0)\n    \"astropy.wcs.Celprm\",         /*tp_name*/\n    sizeof(PyCelprm),             /*tp_basicsize*/\n    0,                            /*tp_itemsize*/\n    (destructor)PyCelprm_dealloc, /*tp_dealloc*/\n    0,                            /*tp_print*/\n    0,                            /*tp_getattr*/\n    0,                            /*tp_setattr*/\n    0,                            /*tp_compare*/\n    0,                            /*tp_repr*/\n    0,                            /*tp_as_number*/\n    0,                            /*tp_as_sequence*/\n    0,                            /*tp_as_mapping*/\n    0,                            /*tp_hash */\n    0,                            /*tp_call*/\n    (reprfunc)PyCelprm___str__,   /*tp_str*/\n    0,                            /*tp_getattro*/\n    0,                            /*tp_setattro*/\n    0,                            /*tp_as_buffer*/\n    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/\n    doc_Celprm,                   /* tp_doc */\n    (traverseproc)PyCelprm_traverse, /* tp_traverse */\n    (inquiry)PyCelprm_clear,      /* tp_clear */\n    0,                            /* tp_richcompare */\n    0,                            /* tp_weaklistoffset */\n    0,                            /* tp_iter */\n    0,                            /* tp_iternext */\n    PyCelprm_methods,             /* tp_methods */\n    0,                            /* tp_members */\n    PyCelprm_getset,              /* tp_getset */\n    0,                            /* tp_base */\n    0,                            /* tp_dict */\n    0,                            /* tp_descr_get */\n    0,                            /* tp_descr_set */\n    0,                            /* tp_dictoffset */\n    0,                            /* tp_init */\n    0,                            /* tp_alloc */\n    PyCelprm_new,                 /* tp_new */\n};\n\n\nint _setup_celprm_type(PyObject* m)\n{\n    if (PyType_Ready(&PyCelprmType) < 0) return -1;\n    Py_INCREF(&PyCelprmType);\n    PyModule_AddObject(m, \"Celprm\", (PyObject *)&PyCelprmType);\n\n    cel_errexc[0] = NULL;                         /* Success */\n    cel_errexc[1] = &PyExc_MemoryError;           /* Null celprm pointer passed */\n    cel_errexc[2] = &WcsExc_InvalidPrjParameters; /* Invalid projection parameters */\n    cel_errexc[3] = &WcsExc_InvalidTransform;     /* Invalid coordinate transformation parameters */\n    cel_errexc[4] = &WcsExc_InvalidTransform;     /* Ill-conditioned coordinate transformation parameters */\n    cel_errexc[5] = &WcsExc_InvalidCoordinate;    /* One or more of the (x,y) coordinates were invalid */\n    cel_errexc[6] = &WcsExc_InvalidCoordinate;    /* One or more of the (lng,lat) coordinates were invalid */\n\n    return 0;\n}\n"},{"id":7543,"name":"unit_list_proxy.c","nodeType":"TextFile","path":"astropy/wcs/src","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#define NO_IMPORT_ARRAY\n\n#include \"astropy_wcs/pyutil.h\"\n#include \"astropy_wcs/str_list_proxy.h\"\n\n/***************************************************************************\n * List-of-units proxy object\n ***************************************************************************/\n\n#define MAXSIZE 68\n#define ARRAYSIZE 72\n\nstatic PyTypeObject PyUnitListProxyType;\n\ntypedef struct {\n  PyObject_HEAD\n  /*@null@*/ /*@shared@*/ PyObject* pyobject;\n  Py_ssize_t size;\n  char (*array)[ARRAYSIZE];\n  PyObject* unit_class;\n} PyUnitListProxy;\n\nstatic void\nPyUnitListProxy_dealloc(\n    PyUnitListProxy* self) {\n\n  PyObject_GC_UnTrack(self);\n  Py_XDECREF(self->pyobject);\n  Py_TYPE(self)->tp_free((PyObject*)self);\n}\n\n/*@null@*/ static PyObject *\nPyUnitListProxy_new(\n    PyTypeObject* type,\n    /*@unused@*/ PyObject* args,\n    /*@unused@*/ PyObject* kwds) {\n\n  PyUnitListProxy* self = NULL;\n\n  self = (PyUnitListProxy*)type->tp_alloc(type, 0);\n  if (self != NULL) {\n    self->pyobject = NULL;\n    self->unit_class = NULL;\n  }\n  return (PyObject*)self;\n}\n\nstatic int\nPyUnitListProxy_traverse(\n    PyUnitListProxy* self,\n    visitproc visit,\n    void *arg) {\n\n  Py_VISIT(self->pyobject);\n  Py_VISIT(self->unit_class);\n  return 0;\n}\n\nstatic int\nPyUnitListProxy_clear(\n    PyUnitListProxy *self) {\n\n  Py_CLEAR(self->pyobject);\n  Py_CLEAR(self->unit_class);\n\n  return 0;\n}\n\n/*@null@*/ PyObject *\nPyUnitListProxy_New(\n    /*@shared@*/ PyObject* owner,\n    Py_ssize_t size,\n    char (*array)[ARRAYSIZE]) {\n\n  PyUnitListProxy* self = NULL;\n  PyObject *units_module;\n  PyObject *units_dict;\n  PyObject *unit_class;\n\n  units_module = PyImport_ImportModule(\"astropy.units\");\n  if (units_module == NULL) {\n    return NULL;\n  }\n\n  units_dict = PyModule_GetDict(units_module);\n  if (units_dict == NULL) {\n    return NULL;\n  }\n\n  unit_class = PyDict_GetItemString(units_dict, \"Unit\");\n  if (unit_class == NULL) {\n    PyErr_SetString(PyExc_RuntimeError, \"Could not import Unit class\");\n    return NULL;\n  }\n\n  Py_INCREF(unit_class);\n\n  self = (PyUnitListProxy*)PyUnitListProxyType.tp_alloc(\n      &PyUnitListProxyType, 0);\n  if (self == NULL) {\n    return NULL;\n  }\n\n  Py_XINCREF(owner);\n  self->pyobject = owner;\n  self->size = size;\n  self->array = array;\n  self->unit_class = unit_class;\n  return (PyObject*)self;\n}\n\nstatic Py_ssize_t\nPyUnitListProxy_len(\n    PyUnitListProxy* self) {\n\n  return self->size;\n}\n\nstatic PyObject*\n_get_unit(\n    PyObject *unit_class,\n    PyObject *unit) {\n\n  PyObject *args;\n  PyObject *kw;\n  PyObject *result;\n\n  kw = Py_BuildValue(\"{s:s,s:s}\", \"format\", \"fits\", \"parse_strict\", \"warn\");\n  if (kw == NULL) {\n      return NULL;\n  }\n\n  args = PyTuple_New(1);\n  if (args == NULL) {\n      Py_DECREF(kw);\n      return NULL;\n  }\n  PyTuple_SetItem(args, 0, unit);\n  Py_INCREF(unit);\n\n  result = PyObject_Call(unit_class, args, kw);\n\n  Py_DECREF(args);\n  Py_DECREF(kw);\n  return result;\n}\n\n/*@null@*/ static PyObject*\nPyUnitListProxy_getitem(\n    PyUnitListProxy* self,\n    Py_ssize_t index) {\n\n  PyObject *value;\n  PyObject *result;\n\n  if (index >= self->size || index < 0) {\n    PyErr_SetString(PyExc_IndexError, \"index out of range\");\n    return NULL;\n  }\n\n  value = PyUnicode_FromString(self->array[index]);\n\n  result = _get_unit(self->unit_class, value);\n\n  Py_DECREF(value);\n  return result;\n}\n\nstatic PyObject*\nPyUnitListProxy_richcmp(\n\tPyObject *a,\n\tPyObject *b,\n\tint op){\n  PyUnitListProxy *lhs, *rhs;\n  Py_ssize_t idx;\n  int equal = 1;\n  assert(a != NULL && b != NULL);\n  if (!PyObject_TypeCheck(a, &PyUnitListProxyType) ||\n      !PyObject_TypeCheck(b, &PyUnitListProxyType)) {\n    Py_RETURN_NOTIMPLEMENTED;\n  }\n  if (op != Py_EQ && op != Py_NE) {\n    Py_RETURN_NOTIMPLEMENTED;\n  }\n\n  /* The actual comparison of the two objects. unit_class is ignored because\n   * it's not an essential property of the instances.\n   */\n  lhs = (PyUnitListProxy *)a;\n  rhs = (PyUnitListProxy *)b;\n  if (lhs->size != rhs->size) {\n    equal = 0;\n  }\n  for (idx = 0; idx < lhs->size && equal == 1; idx++) {\n    if (strncmp(lhs->array[idx], rhs->array[idx], ARRAYSIZE) != 0) {\n      equal = 0;\n    }\n  }\n  if ((op == Py_EQ && equal == 1) ||\n      (op == Py_NE && equal == 0)) {\n    Py_RETURN_TRUE;\n  } else {\n    Py_RETURN_FALSE;\n  }\n}\n\nstatic int\nPyUnitListProxy_setitem(\n    PyUnitListProxy* self,\n    Py_ssize_t index,\n    PyObject* arg) {\n\n  PyObject* value;\n  PyObject* unicode_value;\n  PyObject* bytes_value;\n\n  if (index >= self->size || index < 0) {\n    PyErr_SetString(PyExc_IndexError, \"index out of range\");\n    return -1;\n  }\n\n  value = _get_unit(self->unit_class, arg);\n  if (value == NULL) {\n    return -1;\n  }\n\n  unicode_value = PyObject_CallMethod(value, \"to_string\", \"s\", \"fits\");\n  if (unicode_value == NULL) {\n    Py_DECREF(value);\n    return -1;\n  }\n  Py_DECREF(value);\n\n  if (PyUnicode_Check(unicode_value)) {\n    bytes_value = PyUnicode_AsASCIIString(unicode_value);\n    if (bytes_value == NULL) {\n      Py_DECREF(unicode_value);\n      return -1;\n    }\n    Py_DECREF(unicode_value);\n  } else {\n    bytes_value = unicode_value;\n  }\n\n  strncpy(self->array[index], PyBytes_AsString(bytes_value), MAXSIZE);\n  Py_DECREF(bytes_value);\n\n  return 0;\n}\n\n/*@null@*/ static PyObject*\nPyUnitListProxy_repr(\n    PyUnitListProxy* self) {\n\n  return str_list_proxy_repr(self->array, self->size, MAXSIZE);\n}\n\nstatic PySequenceMethods PyUnitListProxy_sequence_methods = {\n  (lenfunc)PyUnitListProxy_len,\n  NULL,\n  NULL,\n  (ssizeargfunc)PyUnitListProxy_getitem,\n  NULL,\n  (ssizeobjargproc)PyUnitListProxy_setitem,\n  NULL,\n  NULL,\n  NULL,\n  NULL\n};\n\nstatic PyTypeObject PyUnitListProxyType = {\n  PyVarObject_HEAD_INIT(NULL, 0)\n  \"astropy.wcs.UnitListProxy\", /*tp_name*/\n  sizeof(PyUnitListProxy),  /*tp_basicsize*/\n  0,                          /*tp_itemsize*/\n  (destructor)PyUnitListProxy_dealloc, /*tp_dealloc*/\n  0,                          /*tp_print*/\n  0,                          /*tp_getattr*/\n  0,                          /*tp_setattr*/\n  0,                          /*tp_compare*/\n  (reprfunc)PyUnitListProxy_repr, /*tp_repr*/\n  0,                          /*tp_as_number*/\n  &PyUnitListProxy_sequence_methods, /*tp_as_sequence*/\n  0,                          /*tp_as_mapping*/\n  0,                          /*tp_hash */\n  0,                          /*tp_call*/\n  (reprfunc)PyUnitListProxy_repr, /*tp_str*/\n  0,                          /*tp_getattro*/\n  0,                          /*tp_setattro*/\n  0,                          /*tp_as_buffer*/\n  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/\n  0,                          /* tp_doc */\n  (traverseproc)PyUnitListProxy_traverse, /* tp_traverse */\n  (inquiry)PyUnitListProxy_clear, /* tp_clear */\n  (richcmpfunc)PyUnitListProxy_richcmp, /* tp_richcompare */\n  0,                          /* tp_weaklistoffset */\n  0,                          /* tp_iter */\n  0,                          /* tp_iternext */\n  0,                          /* tp_methods */\n  0,                          /* tp_members */\n  0,                          /* tp_getset */\n  0,                          /* tp_base */\n  0,                          /* tp_dict */\n  0,                          /* tp_descr_get */\n  0,                          /* tp_descr_set */\n  0,                          /* tp_dictoffset */\n  0,                          /* tp_init */\n  0,                          /* tp_alloc */\n  PyUnitListProxy_new,      /* tp_new */\n};\n\n\nint\nset_unit_list(\n    PyObject* owner,\n    const char* propname,\n    PyObject* value,\n    Py_ssize_t len,\n    char (*dest)[ARRAYSIZE]) {\n\n  PyObject*  unit  = NULL;\n  PyObject*  proxy = NULL;\n  Py_ssize_t i        = 0;\n\n  if (check_delete(propname, value)) {\n    return -1;\n  }\n\n  if (!PySequence_Check(value)) {\n    PyErr_Format(\n        PyExc_TypeError,\n        \"'%s' must be a sequence of strings\",\n        propname);\n    return -1;\n  }\n\n  if (PySequence_Size(value) != len) {\n    PyErr_Format(\n        PyExc_ValueError,\n        \"len(%s) must be %u\",\n        propname,\n        (unsigned int)len);\n    return -1;\n  }\n\n  proxy = PyUnitListProxy_New(owner, len, dest);\n  if (proxy == NULL) {\n      return -1;\n  }\n\n  for (i = 0; i < len; ++i) {\n    unit = PySequence_GetItem(value, i);\n    if (unit == NULL) {\n      Py_DECREF(proxy);\n      return -1;\n    }\n\n    if (PySequence_SetItem(proxy, i, unit) == -1) {\n      Py_DECREF(proxy);\n      Py_DECREF(unit);\n      return -1;\n    }\n\n    Py_DECREF(unit);\n  }\n\n  Py_DECREF(proxy);\n\n  return 0;\n}\n\n\nint\n_setup_unit_list_proxy_type(\n    /*@unused@*/ PyObject* m) {\n\n  if (PyType_Ready(&PyUnitListProxyType) < 0) {\n    return 1;\n  }\n\n  return 0;\n}\n"},{"id":7544,"name":".gitignore","nodeType":"TextFile","path":"astropy/wcs/src","text":"# Don't ignore *.c files in this directory tree.  We don't have any\n# Cython files here.\n\n!*.c\ndocstrings.c\n"},{"id":7545,"name":"pipeline.c","nodeType":"TextFile","path":"astropy/wcs/src","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#include \"astropy_wcs/pipeline.h\"\n#include \"astropy_wcs/util.h\"\n#include \"wcserr.h\"\n#include <assert.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define PIP_ERRMSG(status) WCSERR_SET(status)\n\nvoid\npipeline_clear(\n    pipeline_t* pipeline) {\n\n  pipeline->det2im[0] = NULL;\n  pipeline->det2im[1] = NULL;\n  pipeline->sip = NULL;\n  pipeline->cpdis[0] = NULL;\n  pipeline->cpdis[1] = NULL;\n  pipeline->wcs = NULL;\n  pipeline->err = NULL;\n}\n\nvoid\npipeline_init(\n    pipeline_t* pipeline,\n    /*@shared@*/ distortion_lookup_t** det2im /* [2] */,\n    /*@shared@*/ sip_t* sip,\n    /*@shared@*/ distortion_lookup_t** cpdis /* [2] */,\n    /*@shared@*/ struct wcsprm* wcs) {\n\n  pipeline->det2im[0] = det2im[0];\n  pipeline->det2im[1] = det2im[1];\n  pipeline->sip = sip;\n  pipeline->cpdis[0] = cpdis[0];\n  pipeline->cpdis[1] = cpdis[1];\n  pipeline->wcs = wcs;\n  pipeline->err = NULL;\n}\n\nvoid\npipeline_free(\n    pipeline_t* pipeline) {\n\n  free(pipeline->err);\n  pipeline->err = NULL;\n}\n\nint\npipeline_all_pixel2world(\n    pipeline_t* pipeline,\n    const unsigned int ncoord,\n    const unsigned int nelem,\n    const double* const pixcrd /* [ncoord][nelem] */,\n    double* world /* [ncoord][nelem] */) {\n\n  static const char* function = \"pipeline_all_pixel2world\";\n\n  const double*   wcs_input  = NULL;\n  double*         wcs_output = NULL;\n  int             has_det2im;\n  int             has_sip;\n  int             has_p4;\n  int             has_wcs;\n  int             status     = 1;\n  struct wcserr **err;\n\n  /* Temporary buffer for performing WCS calculations */\n  unsigned char*     buffer = NULL;\n  unsigned char*     mem = NULL;\n  /*@null@*/ double* tmp;\n  /*@null@*/ double* imgcrd;\n  /*@null@*/ double* phi;\n  /*@null@*/ double* theta;\n  /*@null@*/ int*    stat;\n\n  if (pipeline == NULL || pixcrd == NULL || world == NULL) {\n    return WCSERR_NULL_POINTER;\n  }\n\n  err = &(pipeline->err);\n\n  has_det2im = pipeline->det2im[0] != NULL || pipeline->det2im[1] != NULL;\n  has_sip    = pipeline->sip != NULL;\n  has_p4     = pipeline->cpdis[0] != NULL || pipeline->cpdis[1] != NULL;\n  has_wcs    = pipeline->wcs != NULL;\n\n  if (has_det2im || has_sip || has_p4) {\n    if (nelem != 2) {\n      status = wcserr_set(\n        PIP_ERRMSG(WCSERR_BAD_COORD_TRANS),\n        \"Data must be 2-dimensional when Paper IV lookup table or SIP transform is present.\");\n      goto exit;\n    }\n  }\n\n  if (has_wcs) {\n    if (ncoord < 1) {\n      status = wcserr_set(\n        PIP_ERRMSG(WCSERR_BAD_PIX),\n        \"The number of coordinates must be > 0\");\n      goto exit;\n    }\n\n    buffer = mem = malloc(\n        ncoord * nelem * sizeof(double) + /* imgcrd */\n        ncoord * sizeof(double) +         /* phi */\n        ncoord * sizeof(double) +         /* theta */\n        ncoord * nelem * sizeof(double) + /* tmp */\n        ncoord * nelem * sizeof(int)      /* stat */\n        );\n\n    if (buffer == NULL) {\n      status = wcserr_set(\n        PIP_ERRMSG(WCSERR_MEMORY), \"Memory allocation failed\");\n      goto exit;\n    }\n\n    imgcrd = (double *)mem;\n    mem += ncoord * nelem * sizeof(double);\n\n    phi = (double *)mem;\n    mem += ncoord * sizeof(double);\n\n    theta = (double *)mem;\n    mem += ncoord * sizeof(double);\n\n    tmp = (double *)mem;\n    mem += ncoord * nelem * sizeof(double);\n\n    stat = (int *)mem;\n    /* mem += ncoord * nelem * sizeof(int); */\n\n    if (has_det2im || has_sip || has_p4) {\n      status = pipeline_pix2foc(pipeline, ncoord, nelem, pixcrd, tmp);\n      if (status != 0) {\n        goto exit;\n      }\n\n      wcs_input = tmp;\n      wcs_output = world;\n    } else {\n      wcs_input = pixcrd;\n      wcs_output = world;\n    }\n\n    if ((status = wcsp2s(pipeline->wcs, (int)ncoord, (int)nelem, wcs_input, imgcrd,\n                         phi, theta, wcs_output, stat))) {\n      if (pipeline->err == NULL) {\n        pipeline->err = calloc(1, sizeof(struct wcserr));\n      }\n      wcserr_copy(pipeline->wcs->err, pipeline->err);\n    }\n\n    if (status == 8) {\n      set_invalid_to_nan((int)ncoord, (int)nelem, wcs_output, stat);\n    }\n  } else {\n    if (has_det2im || has_sip || has_p4) {\n      status = pipeline_pix2foc(pipeline, ncoord, nelem, pixcrd, world);\n    }\n  }\n\n exit:\n  free(buffer);\n\n  return status;\n}\n\nint pipeline_pix2foc(\n    pipeline_t* pipeline,\n    const unsigned int ncoord,\n    const unsigned int nelem,\n    const double* const pixcrd /* [ncoord][nelem] */,\n    double* foc /* [ncoord][nelem] */) {\n\n  static const char* function = \"pipeline_pix2foc\";\n\n  int              has_det2im;\n  int              has_sip;\n  int              has_p4;\n  const double *   input  = NULL;\n  double *         tmp    = NULL;\n  int              status = 1;\n  struct wcserr  **err;\n\n  assert(nelem == 2);\n  assert(pixcrd != foc);\n\n  if (pipeline == NULL || pixcrd == NULL || foc == NULL) {\n    return WCSERR_NULL_POINTER;\n  }\n\n  err = &(pipeline->err);\n\n  if (ncoord < 1) {\n      status = wcserr_set(\n        PIP_ERRMSG(WCSERR_BAD_PIX),\n        \"The number of coordinates must be > 0\");\n      goto exit;\n    }\n\n  has_det2im = pipeline->det2im[0] != NULL || pipeline->det2im[1] != NULL;\n  has_sip    = pipeline->sip != NULL;\n  has_p4     = pipeline->cpdis[0] != NULL || pipeline->cpdis[1] != NULL;\n\n  if (has_det2im) {\n    if (has_sip || has_p4) {\n      tmp = malloc(ncoord * nelem * sizeof(double));\n      if (tmp == NULL) {\n        status = wcserr_set(\n          PIP_ERRMSG(WCSERR_MEMORY), \"Memory allocation failed\");\n        goto exit;\n      }\n\n      memcpy(tmp, pixcrd, sizeof(double) * ncoord * nelem);\n\n      status = p4_pix2deltas(2, (void*)pipeline->det2im, ncoord, pixcrd, tmp);\n      if (status) {\n        wcserr_set(PIP_ERRMSG(WCSERR_NULL_POINTER), \"NULL pointer passed\");\n        goto exit;\n      }\n\n      input = tmp;\n      memcpy(foc, input, sizeof(double) * ncoord * nelem);\n    } else {\n      memcpy(foc, pixcrd, sizeof(double) * ncoord * nelem);\n\n      status = p4_pix2deltas(2, (void*)pipeline->det2im, ncoord, pixcrd, foc);\n      if (status) {\n        wcserr_set(PIP_ERRMSG(WCSERR_NULL_POINTER), \"NULL pointer passed\");\n        goto exit;\n      }\n    }\n  } else {\n    /* Copy pixcrd to foc as a starting point.  The \"deltas\" functions\n       below will undistort from there */\n    memcpy(foc, pixcrd, sizeof(double) * ncoord * nelem);\n    input = pixcrd;\n  }\n\n  if (has_sip) {\n    status = sip_pix2deltas(pipeline->sip, 2, ncoord, input, foc);\n    if (status) {\n      if (pipeline->err == NULL) {\n        pipeline->err = calloc(1, sizeof(struct wcserr));\n      }\n      wcserr_copy(pipeline->sip->err, pipeline->err);\n      goto exit;\n    }\n  }\n\n  if (has_p4) {\n    status = p4_pix2deltas(2, (void*)pipeline->cpdis, ncoord, input, foc);\n    if (status) {\n      wcserr_set(PIP_ERRMSG(WCSERR_NULL_POINTER), \"NULL pointer passed\");\n      goto exit;\n    }\n  }\n\n  status = 0;\n\n exit:\n  free(tmp);\n\n  return status;\n}\n"},{"id":7546,"name":"astropy_wcs_api.c","nodeType":"TextFile","path":"astropy/wcs/src","text":"#define NO_IMPORT_ARRAY\n\n#include \"astropy_wcs/astropy_wcs_api.h\"\n\nint\nAstropyWcs_GetCVersion(void) {\n  return REVISION;\n}\n\nvoid* AstropyWcs_API[] = {\n  /*  0 */ (void *)AstropyWcs_GetCVersion,\n  /* pyutil.h */\n  /*  1 */ (void *)wcsprm_python2c,\n  /*  2 */ (void *)wcsprm_c2python,\n  /* distortion.h */\n  /*  3 */ (void *)distortion_lookup_t_init,\n  /*  4 */ (void *)distortion_lookup_t_free,\n  /*  5 */ (void *)get_distortion_offset,\n  /*  6 */ (void *)p4_pix2foc,\n  /*  7 */ (void *)p4_pix2deltas,\n  /* sip.h */\n  /*  8 */ (void *)sip_clear,\n  /*  9 */ (void *)sip_init,\n  /* 10 */ (void *)sip_free,\n  /* 11 */ (void *)sip_pix2foc,\n  /* 12 */ (void *)sip_pix2deltas,\n  /* 13 */ (void *)sip_foc2pix,\n  /* 14 */ (void *)sip_foc2deltas,\n  /* pipeline.h */\n  /* 15 */ (void *)pipeline_clear,\n  /* 16 */ (void *)pipeline_init,\n  /* 17 */ (void *)pipeline_free,\n  /* 18 */ (void *)pipeline_all_pixel2world,\n  /* 19 */ (void *)pipeline_pix2foc,\n  /* wcs.h */\n  /* 20 */ (void *)wcsp2s,\n  /* 21 */ (void *)wcss2p,\n  /* 22 */ (void *)wcsprt,\n  /* new for api version 2 */\n  /* 23 */ (void *)wcslib_get_error_message,\n  /* new for api version 3 */\n  /* 24 */ (void *)wcsprintf_buf\n};\n\nint _setup_api(PyObject *m) {\n  PyObject* c_api;\n\n  c_api = PyCapsule_New((void *)AstropyWcs_API, \"_wcs._ASTROPY_WCS_API\", NULL);\n  PyModule_AddObject(m, \"_ASTROPY_WCS_API\", c_api);\n\n  return 0;\n}\n"},{"id":7547,"name":"sip.c","nodeType":"TextFile","path":"astropy/wcs/src","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#include \"astropy_wcs/sip.h\"\n\n#include <assert.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include <wcserr.h>\n\n#define SIP_ERRMSG(status) WCSERR_SET(status)\n\nvoid\nsip_clear(\n    sip_t* sip) {\n\n  assert(sip != NULL);\n\n  sip->a_order = 0;\n  sip->a = NULL;\n  sip->b_order = 0;\n  sip->b = NULL;\n  sip->ap_order = 0;\n  sip->ap = NULL;\n  sip->bp_order = 0;\n  sip->bp = NULL;\n  sip->crpix[0] = 0.0;\n  sip->crpix[1] = 0.0;\n  sip->scratch = NULL;\n  sip->err = NULL;\n}\n\nint\nsip_init(\n    sip_t* sip,\n    const unsigned int a_order, const double* a,\n    const unsigned int b_order, const double* b,\n    const unsigned int ap_order, const double* ap,\n    const unsigned int bp_order, const double* bp,\n    const double* crpix /* [2] */) {\n\n  unsigned int       a_size       = 0;\n  unsigned int       b_size       = 0;\n  unsigned int       ap_size      = 0;\n  unsigned int       bp_size      = 0;\n  unsigned int       scratch_size = 0;\n  int                status       = 0;\n  struct wcserr**    err          = NULL;\n  static const char *function     = \"sip_init\";\n\n  assert(sip != NULL);\n  sip_clear(sip);\n  err = &(sip->err);\n\n  /* We we have one of A/B or AP/BP, we must have both. */\n  if ((a == NULL) ^ (b == NULL)) {\n    return wcserr_set(\n      SIP_ERRMSG(WCSERR_BAD_COORD_TRANS),\n      \"Both A and B SIP transform must be defined\");\n  }\n\n  if ((ap == NULL) ^ (bp == NULL)) {\n    return wcserr_set(\n      SIP_ERRMSG(WCSERR_BAD_COORD_TRANS),\n      \"Both AP and BP SIP transform must be defined\");\n  }\n\n\n  if (a != NULL) {\n    sip->a_order = a_order;\n    a_size = (a_order + 1) * (a_order + 1) * sizeof(double);\n    sip->a = malloc(a_size);\n    if (sip->a == NULL) {\n      sip_free(sip);\n      status = wcserr_set(\n        SIP_ERRMSG(WCSERR_MEMORY), \"Memory allocation failed\");\n      goto exit;\n    }\n    memcpy(sip->a, a, a_size);\n    if (a_order > scratch_size) {\n      scratch_size = a_order;\n    }\n\n    sip->b_order = b_order;\n    b_size = (b_order + 1) * (b_order + 1) * sizeof(double);\n    sip->b = malloc(b_size);\n    if (sip->b == NULL) {\n      sip_free(sip);\n      status = wcserr_set(\n        SIP_ERRMSG(WCSERR_MEMORY), \"Memory allocation failed\");\n      goto exit;\n    }\n    memcpy(sip->b, b, b_size);\n    if (b_order > scratch_size) {\n      scratch_size = b_order;\n    }\n  }\n\n  if (ap != NULL) {\n    sip->ap_order = ap_order;\n    ap_size = (ap_order + 1) * (ap_order + 1) * sizeof(double);\n    sip->ap = malloc(ap_size);\n    if (sip->ap == NULL) {\n      sip_free(sip);\n      status = wcserr_set(\n        SIP_ERRMSG(WCSERR_MEMORY), \"Memory allocation failed\");\n      goto exit;\n    }\n    memcpy(sip->ap, ap, ap_size);\n    if (ap_order > scratch_size) {\n      scratch_size = ap_order;\n    }\n\n    sip->bp_order = bp_order;\n    bp_size = (bp_order + 1) * (bp_order + 1) * sizeof(double);\n    sip->bp = malloc(bp_size);\n    if (sip->bp == NULL) {\n      sip_free(sip);\n      status = wcserr_set(\n        SIP_ERRMSG(WCSERR_MEMORY), \"Memory allocation failed\");\n      goto exit;\n    }\n    memcpy(sip->bp, bp, bp_size);\n    if (bp_order > scratch_size) {\n      scratch_size = bp_order;\n    }\n  }\n\n  scratch_size = (scratch_size + 1) * sizeof(double);\n  sip->scratch = malloc(scratch_size);\n  if (sip->scratch == NULL) {\n    sip_free(sip);\n    status = wcserr_set(\n      SIP_ERRMSG(WCSERR_MEMORY), \"Memory allocation failed\");\n    goto exit;\n  }\n\n  sip->crpix[0] = crpix[0];\n  sip->crpix[1] = crpix[1];\n\n exit:\n\n  return status;\n}\n\nvoid\nsip_free(sip_t* sip) {\n  free(sip->a);\n  sip->a = NULL;\n  free(sip->b);\n  sip->b = NULL;\n  free(sip->ap);\n  sip->ap = NULL;\n  free(sip->bp);\n  sip->bp = NULL;\n  free(sip->scratch);\n  sip->scratch = NULL;\n  free(sip->err);\n  sip->err = NULL;\n}\n\nstatic INLINE double\nlu(\n    const unsigned int order,\n    const double* const matrix,\n    const int x,\n    const int y) {\n\n  int index;\n  assert(x >= 0 && x <= (int)order);\n  assert(y >= 0 && y <= (int)order);\n\n  index = x * ((int)order + 1) + y;\n  assert(index >= 0 && index < ((int)order + 1) * ((int)order + 1));\n\n  return matrix[index];\n}\n\nstatic int\nsip_compute(\n    /*@unused@*/ const unsigned int naxes,\n    const unsigned int nelem,\n    const unsigned int m,\n    /*@null@*/ const double* a,\n    const unsigned int n,\n    /*@null@*/ const double* b,\n    const double* crpix /* [2] */,\n    /*@null@*/ double* tmp,\n    /*@null@*/ const double* input /* [NAXES][nelem] */,\n    /*@null@*/ double* output /* [NAXES][nelem] */) {\n\n  unsigned int  i;\n  int           j, k;\n  double        x, y;\n  double        sum;\n  const double* input_ptr;\n  double*       output_ptr;\n\n  assert(a != NULL);\n  assert(b != NULL);\n  assert(crpix != NULL);\n  assert(tmp != NULL);\n  assert(input != NULL);\n  assert(output != NULL);\n\n  /* Avoid segfaults */\n  if (input == NULL || output == NULL || tmp == NULL || crpix == NULL) {\n    return 1;\n  }\n\n  /* If we have one, we must have both... */\n  if ((a == NULL) ^ (b == NULL)) {\n    return 6;\n  }\n\n  /* If no distortion, just return values */\n  if (a == NULL /* && b == NULL ... implied */) {\n    return 0;\n  }\n\n  input_ptr = input;\n  output_ptr = output;\n  for (i = 0; i < nelem; ++i) {\n    x = *input_ptr++ - crpix[0];\n    y = *input_ptr++ - crpix[1];\n\n    for (j = 0; j <= (int)m; ++j) {\n      tmp[j] = lu(m, a, (int)m-j, j);\n      for (k = j-1; k >= 0; --k) {\n        tmp[j] = (y * tmp[j]) + lu(m, a, (int)m-j, k);\n      }\n    }\n\n    sum = tmp[0];\n    for (j = (int)m; j > 0; --j) {\n      sum = x * sum + tmp[(int)m - j + 1];\n    }\n    *output_ptr++ += sum;\n\n    for (j = 0; j <= (int)n; ++j) {\n      tmp[j] = lu(n, b, (int)n-j, j);\n      for (k = j-1; k >= 0; --k) {\n          tmp[j] = (y * tmp[j]) + lu(n, b, (int)n-j, k);\n      }\n    }\n\n    sum = tmp[0];\n    for (j = (int)n; j > 0; --j) {\n      sum = x * sum + tmp[n - j + 1];\n    }\n    *output_ptr++ += sum;\n  }\n\n  return 0;\n}\n\nint\nsip_pix2deltas(\n    const sip_t* sip,\n    const unsigned int naxes,\n    const unsigned int nelem,\n    const double* pix /* [NAXES][nelem] */,\n    double* deltas /* [NAXES][nelem] */) {\n\n  if (sip == NULL) {\n    return 1;\n  }\n\n  return sip_compute(naxes, nelem,\n                     sip->a_order, sip->a,\n                     sip->b_order, sip->b,\n                     sip->crpix,\n                     (double *)sip->scratch,\n                     pix, deltas);\n}\n\nint\nsip_foc2deltas(\n    const sip_t* sip,\n    const unsigned int naxes,\n    const unsigned int nelem,\n    const double* foc /* [NAXES][nelem] */,\n    double* deltas /* [NAXES][nelem] */) {\n\n  if (sip == NULL) {\n    return 1;\n  }\n\n  return sip_compute(naxes, nelem,\n                     sip->ap_order, sip->ap,\n                     sip->bp_order, sip->bp,\n                     sip->crpix,\n                     (double *)sip->scratch,\n                     foc, deltas);\n}\n\nint\nsip_pix2foc(\n    const sip_t* sip,\n    const unsigned int naxes,\n    const unsigned int nelem,\n    const double* pix /* [NAXES][nelem] */,\n    double* foc /* [NAXES][nelem] */) {\n  assert(pix);\n  assert(foc);\n\n  if (pix != foc) {\n      memcpy(foc, pix, sizeof(double) * naxes * nelem);\n  }\n\n  return sip_pix2deltas(sip, naxes, nelem, pix, foc);\n}\n\nint\nsip_foc2pix(\n    const sip_t* sip,\n    const unsigned int naxes,\n    const unsigned int nelem,\n    const double* foc /* [NAXES][nelem] */,\n    double* pix /* [NAXES][nelem] */) {\n  assert(pix);\n  assert(foc);\n\n  if (pix != foc) {\n      memcpy(pix, foc, sizeof(double) * naxes * nelem);\n  }\n\n  return sip_foc2deltas(sip, naxes, nelem, foc, pix);\n}\n"},{"id":7548,"name":"astropy_wcs.c","nodeType":"TextFile","path":"astropy/wcs/src","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#include \"astropy_wcs/astropy_wcs.h\"\n#include \"astropy_wcs/wcslib_wrap.h\"\n#include \"astropy_wcs/wcslib_tabprm_wrap.h\"\n#include \"astropy_wcs/wcslib_auxprm_wrap.h\"\n#include \"astropy_wcs/wcslib_prjprm_wrap.h\"\n#include \"astropy_wcs/wcslib_celprm_wrap.h\"\n#include \"astropy_wcs/wcslib_units_wrap.h\"\n#include \"astropy_wcs/wcslib_wtbarr_wrap.h\"\n#include \"astropy_wcs/distortion_wrap.h\"\n#include \"astropy_wcs/sip_wrap.h\"\n#include \"astropy_wcs/docstrings.h\"\n#include \"astropy_wcs/astropy_wcs_api.h\"\n#include \"astropy_wcs/unit_list_proxy.h\"\n\n#include <structmember.h> /* from Python */\n\n#include <stdlib.h>\n#include <time.h>\n\n#include <tab.h>\n#include <wtbarr.h>\n\n/***************************************************************************\n * Wcs type\n ***************************************************************************/\n\nstatic PyTypeObject WcsType;\n\nstatic int _setup_wcs_type(PyObject* m);\n\n\nPyObject* PyWcsprm_set_wtbarr_fitsio_callback(PyObject *dummy, PyObject *args) {\n    PyObject *callback;\n\n    if (PyArg_ParseTuple(args, \"O:set_wtbarr_fitsio_callback\", &callback)) {\n        if (!PyCallable_Check(callback)) {\n            PyErr_SetString(PyExc_TypeError, \"parameter must be callable\");\n            return NULL;\n        }\n        _set_wtbarr_callback(callback);\n\n        Py_RETURN_NONE;\n    }\n    return NULL;\n}\n\n\n/***************************************************************************\n * PyWcs methods\n */\n\nstatic int\nWcs_traverse(\n    Wcs* self,\n    visitproc visit,\n    void* arg) {\n\n  Py_VISIT(self->py_det2im[0]);\n  Py_VISIT(self->py_det2im[1]);\n  Py_VISIT(self->py_sip);\n  Py_VISIT(self->py_distortion_lookup[0]);\n  Py_VISIT(self->py_distortion_lookup[1]);\n  Py_VISIT(self->py_wcsprm);\n\n  return 0;\n}\n\nstatic int\nWcs_clear(\n    Wcs* self) {\n\n  Py_CLEAR(self->py_det2im[0]);\n  Py_CLEAR(self->py_det2im[1]);\n  Py_CLEAR(self->py_sip);\n  Py_CLEAR(self->py_distortion_lookup[0]);\n  Py_CLEAR(self->py_distortion_lookup[1]);\n  Py_CLEAR(self->py_wcsprm);\n\n  return 0;\n}\n\nstatic void\nWcs_dealloc(\n    Wcs* self) {\n\n  PyObject_GC_UnTrack(self);\n  Wcs_clear(self);\n  pipeline_free(&self->x);\n  Py_TYPE(self)->tp_free((PyObject*)self);\n}\n\n/*@null@*/ static PyObject *\nWcs_new(\n    PyTypeObject* type,\n    /*@unused@*/ PyObject* args,\n    /*@unused@*/ PyObject* kwds) {\n\n  Wcs* self;\n  self = (Wcs*)type->tp_alloc(type, 0);\n  if (self != NULL) {\n    pipeline_clear(&self->x);\n    self->py_det2im[0]            = NULL;\n    self->py_det2im[1]            = NULL;\n    self->py_sip                  = NULL;\n    self->py_distortion_lookup[0] = NULL;\n    self->py_distortion_lookup[1] = NULL;\n    self->py_wcsprm               = NULL;\n  }\n  return (PyObject*)self;\n}\n\nstatic int\nWcs_init(\n    Wcs* self,\n    PyObject* args,\n    /*@unused@*/ PyObject* kwds) {\n\n  size_t       i;\n  PyObject*    py_sip;\n  PyObject*    py_wcsprm;\n  PyObject*    py_distortion_lookup[2];\n  PyObject*    py_det2im[2];\n\n  if (!PyArg_ParseTuple\n      (args, \"O(OO)O(OO):Wcs.__init__\",\n       &py_sip,\n       &py_distortion_lookup[0],\n       &py_distortion_lookup[1],\n       &py_wcsprm,\n       &py_det2im[0],\n       &py_det2im[1])) {\n    return -1;\n  }\n\n  /* Check and set Distortion lookup tables */\n  for (i = 0; i < 2; ++i) {\n    if (py_det2im[i] != NULL && py_det2im[i] != Py_None) {\n      if (!PyObject_TypeCheck(py_det2im[i], &PyDistLookupType)) {\n        PyErr_SetString(PyExc_TypeError,\n                        \"Arg 4 must be a pair of DistortionLookupTable or None objects\");\n        return -1;\n      }\n\n      Py_CLEAR(self->py_det2im[i]);\n      self->py_det2im[i] = py_det2im[i];\n      Py_INCREF(py_det2im[i]);\n      self->x.det2im[i] = &(((PyDistLookup*)py_det2im[i])->x);\n    }\n  }\n\n  /* Check and set SIP */\n  if (py_sip != NULL && py_sip != Py_None) {\n    if (!PyObject_TypeCheck(py_sip, &PySipType)) {\n      PyErr_SetString(PyExc_TypeError,\n                      \"Arg 1 must be Sip object\");\n      return -1;\n    }\n\n    Py_CLEAR(self->py_sip);\n    self->py_sip = py_sip;\n    Py_INCREF(py_sip);\n    self->x.sip = &(((PySip*)py_sip)->x);\n  }\n\n  /* Check and set Distortion lookup tables */\n  for (i = 0; i < 2; ++i) {\n    if (py_distortion_lookup[i] != NULL && py_distortion_lookup[i] != Py_None) {\n      if (!PyObject_TypeCheck(py_distortion_lookup[i], &PyDistLookupType)) {\n        PyErr_SetString(PyExc_TypeError,\n                        \"Arg 2 must be a pair of DistortionLookupTable or None objects\");\n        return -1;\n      }\n\n      Py_CLEAR(self->py_distortion_lookup[i]);\n      self->py_distortion_lookup[i] = py_distortion_lookup[i];\n      Py_INCREF(py_distortion_lookup[i]);\n      self->x.cpdis[i] = &(((PyDistLookup*)py_distortion_lookup[i])->x);\n    }\n  }\n\n  /* Set and lookup Wcsprm object */\n  if (py_wcsprm != NULL && py_wcsprm != Py_None) {\n    if (!PyObject_TypeCheck(py_wcsprm, &PyWcsprmType)) {\n      PyErr_SetString(PyExc_TypeError,\n                      \"Arg 3 must be Wcsprm object\");\n      return -1;\n    }\n\n    Py_CLEAR(self->py_wcsprm);\n    self->py_wcsprm = py_wcsprm;\n    Py_INCREF(py_wcsprm);\n    self->x.wcs = &(((PyWcsprm*)py_wcsprm)->x);\n  }\n\n  return 0;\n}\n\n/*@null@*/ static PyObject*\nWcs_all_pix2world(\n    Wcs* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  int            naxis      = 2;\n  PyObject*      pixcrd_obj = NULL;\n  int            origin     = 1;\n  PyArrayObject* pixcrd     = NULL;\n  PyArrayObject* world      = NULL;\n  int            status     = -1;\n  const char*    keywords[] = {\n    \"pixcrd\", \"origin\", NULL };\n\n  if (!PyArg_ParseTupleAndKeywords(\n          args, kwds, \"Oi:all_pix2world\", (char **)keywords,\n          &pixcrd_obj, &origin)) {\n    return NULL;\n  }\n\n  naxis = self->x.wcs->naxis;\n\n  pixcrd = (PyArrayObject*)PyArray_ContiguousFromAny(pixcrd_obj, NPY_DOUBLE, 2, 2);\n  if (pixcrd == NULL) {\n    return NULL;\n  }\n\n  if (PyArray_DIM(pixcrd, 1) < naxis) {\n    PyErr_Format(\n      PyExc_RuntimeError,\n      \"Input array must be 2-dimensional, where the second dimension >= %d\",\n      naxis);\n    goto exit;\n  }\n\n  world = (PyArrayObject*)PyArray_SimpleNew(2, PyArray_DIMS(pixcrd), NPY_DOUBLE);\n  if (world == NULL) {\n    goto exit;\n  }\n\n  /* Make the call */\n  Py_BEGIN_ALLOW_THREADS\n  preoffset_array(pixcrd, origin);\n  wcsprm_python2c(self->x.wcs);\n  status = pipeline_all_pixel2world(&self->x,\n                                    (unsigned int)PyArray_DIM(pixcrd, 0),\n                                    (unsigned int)PyArray_DIM(pixcrd, 1),\n                                    (double*)PyArray_DATA(pixcrd),\n                                    (double*)PyArray_DATA(world));\n  wcsprm_c2python(self->x.wcs);\n  unoffset_array(pixcrd, origin);\n  Py_END_ALLOW_THREADS\n  /* unoffset_array(world, origin); */\n\n exit:\n  Py_XDECREF(pixcrd);\n\n  if (status == 0 || status == 8) {\n    return (PyObject*)world;\n  } else {\n    Py_XDECREF(world);\n    if (status == -1) {\n      PyErr_SetString(\n        PyExc_ValueError,\n        \"Wrong number of dimensions in input array.  Expected 2.\");\n      return NULL;\n    } else {\n      if (status == -1) {\n        /* exception already set */\n        return NULL;\n      } else {\n        wcserr_to_python_exc(self->x.err);\n        return NULL;\n      }\n    }\n  }\n}\n\n/*@null@*/ static PyObject*\nWcs_p4_pix2foc(\n    Wcs* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  PyObject*      pixcrd_obj = NULL;\n  int            origin     = 1;\n  PyArrayObject* pixcrd     = NULL;\n  PyArrayObject* foccrd     = NULL;\n  int            status     = -1;\n  const char*    keywords[] = {\n    \"pixcrd\", \"origin\", NULL };\n\n  if (!PyArg_ParseTupleAndKeywords(args, kwds, \"Oi:p4_pix2foc\", (char **)keywords,\n                                   &pixcrd_obj, &origin)) {\n    return NULL;\n  }\n\n  if (self->x.cpdis[0] == NULL && self->x.cpdis[1] == NULL) {\n    Py_INCREF(pixcrd_obj);\n    return pixcrd_obj;\n  }\n\n  pixcrd = (PyArrayObject*)PyArray_ContiguousFromAny(pixcrd_obj, NPY_DOUBLE, 2, 2);\n  if (pixcrd == NULL) {\n    return NULL;\n  }\n\n  if (PyArray_DIM(pixcrd, 1) != NAXES) {\n    PyErr_SetString(PyExc_ValueError, \"Pixel array must be an Nx2 array\");\n    goto exit;\n  }\n\n  foccrd = (PyArrayObject*)PyArray_SimpleNew(2, PyArray_DIMS(pixcrd), NPY_DOUBLE);\n  if (foccrd == NULL) {\n    status = 2;\n    goto exit;\n  }\n\n  Py_BEGIN_ALLOW_THREADS\n  preoffset_array(pixcrd, origin);\n  status = p4_pix2foc(2, (void *)self->x.cpdis,\n                      (unsigned int)PyArray_DIM(pixcrd, 0),\n                      (double*)PyArray_DATA(pixcrd),\n                      (double*)PyArray_DATA(foccrd));\n  unoffset_array(pixcrd, origin);\n  unoffset_array(foccrd, origin);\n  Py_END_ALLOW_THREADS\n\n exit:\n\n  Py_XDECREF(pixcrd);\n\n  if (status == 0) {\n    return (PyObject*)foccrd;\n  } else {\n    Py_XDECREF(foccrd);\n    if (status == -1) {\n      /* Exception already set */\n      return NULL;\n    } else {\n      PyErr_SetString(PyExc_MemoryError, \"NULL pointer passed\");\n      return NULL;\n    }\n  }\n}\n\n/*@null@*/ static PyObject*\nWcs_det2im(\n    Wcs* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  PyObject*      detcrd_obj = NULL;\n  int            origin     = 1;\n  PyArrayObject* detcrd     = NULL;\n  PyArrayObject* imcrd     = NULL;\n  int            status     = -1;\n  const char*    keywords[] = {\n    \"detcrd\", \"origin\", NULL };\n\n  if (!PyArg_ParseTupleAndKeywords(args, kwds, \"Oi:det2im\", (char **)keywords,\n                                   &detcrd_obj, &origin)) {\n    return NULL;\n  }\n\n  if (self->x.det2im[0] == NULL && self->x.det2im[1] == NULL) {\n    Py_INCREF(detcrd_obj);\n    return detcrd_obj;\n  }\n\n  detcrd = (PyArrayObject*)PyArray_ContiguousFromAny(detcrd_obj, NPY_DOUBLE, 2, 2);\n  if (detcrd == NULL) {\n    return NULL;\n  }\n\n  if (PyArray_DIM(detcrd, 1) != NAXES) {\n    PyErr_SetString(PyExc_ValueError, \"Pixel array must be an Nx2 array\");\n    goto exit;\n  }\n\n  imcrd = (PyArrayObject*)PyArray_SimpleNew(2, PyArray_DIMS(detcrd), NPY_DOUBLE);\n  if (imcrd == NULL) {\n    status = 2;\n    goto exit;\n  }\n\n  Py_BEGIN_ALLOW_THREADS\n  preoffset_array(detcrd, origin);\n  status = p4_pix2foc(2, (void *)self->x.det2im,\n                      (unsigned int)PyArray_DIM(detcrd, 0),\n                      (double*)PyArray_DATA(detcrd),\n                      (double*)PyArray_DATA(imcrd));\n  unoffset_array(detcrd, origin);\n  unoffset_array(imcrd, origin);\n  Py_END_ALLOW_THREADS\n\n exit:\n\n  Py_XDECREF(detcrd);\n\n  if (status == 0) {\n    return (PyObject*)imcrd;\n  } else {\n    Py_XDECREF(imcrd);\n    if (status == -1) {\n      /* Exception already set */\n      return NULL;\n    } else {\n      PyErr_SetString(PyExc_MemoryError, \"NULL pointer passed\");\n      return NULL;\n    }\n  }\n}\n\n/*@null@*/ static PyObject*\nWcs_pix2foc(\n    Wcs* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  PyObject*      pixcrd_obj = NULL;\n  int            origin     = 1;\n  PyArrayObject* pixcrd     = NULL;\n  PyArrayObject* foccrd     = NULL;\n  int            status     = -1;\n  const char*    keywords[] = {\n    \"pixcrd\", \"origin\", NULL };\n\n  if (!PyArg_ParseTupleAndKeywords(args, kwds, \"Oi:pix2foc\", (char **)keywords,\n                                   &pixcrd_obj, &origin)) {\n    return NULL;\n  }\n\n  pixcrd = (PyArrayObject*)PyArray_ContiguousFromAny(pixcrd_obj, NPY_DOUBLE, 2, 2);\n  if (pixcrd == NULL) {\n    return NULL;\n  }\n\n  if (PyArray_DIM(pixcrd, 1) != NAXES) {\n    PyErr_SetString(PyExc_ValueError, \"Pixel array must be an Nx2 array\");\n    goto _exit;\n  }\n\n  foccrd = (PyArrayObject*)PyArray_SimpleNew(2, PyArray_DIMS(pixcrd), NPY_DOUBLE);\n  if (foccrd == NULL) {\n    goto _exit;\n  }\n\n  Py_BEGIN_ALLOW_THREADS\n  preoffset_array(pixcrd, origin);\n  status = pipeline_pix2foc(&self->x,\n                            (unsigned int)PyArray_DIM(pixcrd, 0),\n                            (unsigned int)PyArray_DIM(pixcrd, 1),\n                            (double*)PyArray_DATA(pixcrd),\n                            (double*)PyArray_DATA(foccrd));\n  unoffset_array(pixcrd, origin);\n  unoffset_array(foccrd, origin);\n  Py_END_ALLOW_THREADS\n\n _exit:\n\n  Py_XDECREF(pixcrd);\n\n  if (status == 0) {\n    return (PyObject*)foccrd;\n  } else {\n    Py_XDECREF(foccrd);\n    if (status == -1) {\n      /* Exception already set */\n      return NULL;\n    } else {\n      wcserr_to_python_exc(self->x.err);\n      return NULL;\n    }\n  }\n}\n\n/*@null@*/ static PyObject*\nWcs_get_wcs(\n    Wcs* self,\n    /*@unused@*/ void* closure) {\n\n  if (self->py_wcsprm) {\n    Py_INCREF(self->py_wcsprm);\n    return self->py_wcsprm;\n  }\n\n  Py_INCREF(Py_None);\n  return Py_None;\n}\n\nstatic int\nWcs_set_wcs(\n    Wcs* self,\n    /*@shared@*/ PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  Py_CLEAR(self->py_wcsprm);\n  self->x.wcs = NULL;\n\n  if (value != NULL && value != Py_None) {\n    if (!PyObject_TypeCheck(value, &PyWcsprmType)) {\n      PyErr_SetString(PyExc_TypeError,\n                      \"wcs must be Wcsprm object\");\n      return -1;\n    }\n\n    Py_INCREF(value);\n    self->py_wcsprm = value;\n    self->x.wcs = &(((PyWcsprm*)value)->x);\n  }\n\n  return 0;\n}\n\nstatic PyObject*\nWcs_get_cpdis1(\n    Wcs* self,\n    /*@unused@*/ void* closure) {\n\n  if (self->py_distortion_lookup[0]) {\n    Py_INCREF(self->py_distortion_lookup[0]);\n    return self->py_distortion_lookup[0];\n  }\n\n  Py_INCREF(Py_None);\n  return Py_None;\n}\n\nstatic int\nWcs_set_cpdis1(\n    Wcs* self,\n    /*@shared@*/ PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  Py_CLEAR(self->py_distortion_lookup[0]);\n  self->x.cpdis[0] = NULL;\n\n  if (value != NULL && value != Py_None) {\n    if (!PyObject_TypeCheck(value, &PyDistLookupType)) {\n      PyErr_SetString(PyExc_TypeError,\n                      \"cpdis1 must be DistortionLookupTable object\");\n      return -1;\n    }\n\n    Py_INCREF(value);\n    self->py_distortion_lookup[0] = value;\n    self->x.cpdis[0] = &(((PyDistLookup*)value)->x);\n  }\n\n  return 0;\n}\n\n/*@shared@*/ static PyObject*\nWcs_get_cpdis2(\n    Wcs* self,\n    /*@unused@*/ void* closure) {\n\n  if (self->py_distortion_lookup[1]) {\n    Py_INCREF(self->py_distortion_lookup[1]);\n    return self->py_distortion_lookup[1];\n  }\n\n  Py_INCREF(Py_None);\n  return Py_None;\n}\n\nstatic int\nWcs_set_cpdis2(\n    Wcs* self,\n    /*@shared@*/ PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  Py_CLEAR(self->py_distortion_lookup[1]);\n  self->x.cpdis[1] = NULL;\n\n  if (value != NULL && value != Py_None) {\n    if (!PyObject_TypeCheck(value, &PyDistLookupType)) {\n      PyErr_SetString(PyExc_TypeError,\n                      \"cpdis2 must be DistortionLookupTable object\");\n      return -1;\n    }\n\n    Py_INCREF(value);\n    self->py_distortion_lookup[1] = value;\n    self->x.cpdis[1] = &(((PyDistLookup*)value)->x);\n  }\n\n  return 0;\n}\n\nstatic PyObject*\nWcs_get_det2im1(\n    Wcs* self,\n    /*@unused@*/ void* closure) {\n\n  if (self->py_det2im[0]) {\n    Py_INCREF(self->py_det2im[0]);\n    return self->py_det2im[0];\n  }\n\n  Py_INCREF(Py_None);\n  return Py_None;\n}\n\nstatic int\nWcs_set_det2im1(\n    Wcs* self,\n    /*@shared@*/ PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  Py_CLEAR(self->py_det2im[0]);\n  self->x.det2im[0] = NULL;\n\n  if (value != NULL && value != Py_None) {\n    if (!PyObject_TypeCheck(value, &PyDistLookupType)) {\n      PyErr_SetString(PyExc_TypeError,\n                      \"det2im1 must be DistortionLookupTable object\");\n      return -1;\n    }\n\n    Py_INCREF(value);\n    self->py_det2im[0] = value;\n    self->x.det2im[0] = &(((PyDistLookup*)value)->x);\n  }\n\n  return 0;\n}\n\n/*@shared@*/ static PyObject*\nWcs_get_det2im2(\n    Wcs* self,\n    /*@unused@*/ void* closure) {\n\n  if (self->py_det2im[1]) {\n    Py_INCREF(self->py_det2im[1]);\n    return self->py_det2im[1];\n  }\n\n  Py_INCREF(Py_None);\n  return Py_None;\n}\n\nstatic int\nWcs_set_det2im2(\n    Wcs* self,\n    /*@shared@*/ PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  Py_CLEAR(self->py_det2im[1]);\n  self->x.det2im[1] = NULL;\n\n  if (value != NULL && value != Py_None) {\n    if (!PyObject_TypeCheck(value, &PyDistLookupType)) {\n      PyErr_SetString(PyExc_TypeError,\n                      \"det2im2 must be DistortionLookupTable object\");\n      return -1;\n    }\n\n    Py_INCREF(value);\n    self->py_det2im[1] = value;\n    self->x.det2im[1] = &(((PyDistLookup*)value)->x);\n  }\n\n  return 0;\n}\n\n/*@shared@*/ static PyObject*\nWcs_get_sip(\n    Wcs* self,\n    /*@unused@*/ void* closure) {\n\n  if (self->py_sip) {\n    Py_INCREF(self->py_sip);\n    return self->py_sip;\n  }\n\n  Py_INCREF(Py_None);\n  return Py_None;\n}\n\nstatic int\nWcs_set_sip(\n    Wcs* self,\n    /*@shared@*/ PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  Py_CLEAR(self->py_sip);\n  self->x.sip = NULL;\n\n  if (value != NULL && value != Py_None) {\n    if (!PyObject_TypeCheck(value, &PySipType)) {\n      PyErr_SetString(PyExc_TypeError,\n                      \"sip must be Sip object\");\n      return -1;\n    }\n\n    Py_INCREF(value);\n    self->py_sip = value;\n    self->x.sip = &(((PySip*)value)->x);\n  }\n\n  return 0;\n}\n\nstatic PyObject*\n_sanity_check(\n    PyObject* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  if (sizeof(WCSLIB_INT64) != 8) {\n    Py_INCREF(Py_False);\n    return Py_False;\n  }\n\n  Py_INCREF(Py_True);\n  return Py_True;\n}\n\n/***************************************************************************\n * Wcs definition structures\n */\n\nstatic PyGetSetDef Wcs_getset[] = {\n  {\"det2im1\", (getter)Wcs_get_det2im1, (setter)Wcs_set_det2im1, (char *)doc_det2im1},\n  {\"det2im2\", (getter)Wcs_get_det2im2, (setter)Wcs_set_det2im2, (char *)doc_det2im2},\n  {\"cpdis1\", (getter)Wcs_get_cpdis1, (setter)Wcs_set_cpdis1, (char *)doc_cpdis1},\n  {\"cpdis2\", (getter)Wcs_get_cpdis2, (setter)Wcs_set_cpdis2, (char *)doc_cpdis2},\n  {\"sip\", (getter)Wcs_get_sip, (setter)Wcs_set_sip, (char *)doc_sip},\n  {\"wcs\", (getter)Wcs_get_wcs, (setter)Wcs_set_wcs, (char *)doc_wcs},\n  {NULL}\n};\n\nstatic PyMethodDef Wcs_methods[] = {\n  {\"_all_pix2world\", (PyCFunction)Wcs_all_pix2world, METH_VARARGS|METH_KEYWORDS, doc_all_pix2world},\n  {\"_det2im\", (PyCFunction)Wcs_det2im, METH_VARARGS|METH_KEYWORDS, doc_det2im},\n  {\"_p4_pix2foc\", (PyCFunction)Wcs_p4_pix2foc, METH_VARARGS|METH_KEYWORDS, doc_p4_pix2foc},\n  {\"_pix2foc\", (PyCFunction)Wcs_pix2foc, METH_VARARGS|METH_KEYWORDS, doc_pix2foc},\n  {NULL}\n};\n\nstatic PyMethodDef module_methods[] = {\n  {\"_sanity_check\", (PyCFunction)_sanity_check, METH_NOARGS, \"\"},\n  {\"find_all_wcs\", (PyCFunction)PyWcsprm_find_all_wcs, METH_VARARGS|METH_KEYWORDS, doc_find_all_wcs},\n  {\"set_wtbarr_fitsio_callback\", (PyCFunction)PyWcsprm_set_wtbarr_fitsio_callback, METH_VARARGS, NULL},\n  {NULL}  /* Sentinel */\n};\n\nstatic PyTypeObject WcsType = {\n  PyVarObject_HEAD_INIT(NULL, 0)\n  \"astropy.wcs.WCSBase\",                 /*tp_name*/\n  sizeof(Wcs),                /*tp_basicsize*/\n  0,                            /*tp_itemsize*/\n  (destructor)Wcs_dealloc,    /*tp_dealloc*/\n  0,                            /*tp_print*/\n  0,                            /*tp_getattr*/\n  0,                            /*tp_setattr*/\n  0,                            /*tp_compare*/\n  0,                            /*tp_repr*/\n  0,                            /*tp_as_number*/\n  0,                            /*tp_as_sequence*/\n  0,                            /*tp_as_mapping*/\n  0,                            /*tp_hash */\n  0,                            /*tp_call*/\n  0,                            /*tp_str*/\n  0,                            /*tp_getattro*/\n  0,                            /*tp_setattro*/\n  0,                            /*tp_as_buffer*/\n  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/\n  doc_Wcs,                      /* tp_doc */\n  (traverseproc)Wcs_traverse, /* tp_traverse */\n  (inquiry)Wcs_clear,         /* tp_clear */\n  0,                            /* tp_richcompare */\n  0,                            /* tp_weaklistoffset */\n  0,                            /* tp_iter */\n  0,                            /* tp_iternext */\n  Wcs_methods,                /* tp_methods */\n  0,                            /* tp_members */\n  Wcs_getset,                 /* tp_getset */\n  0,                            /* tp_base */\n  0,                            /* tp_dict */\n  0,                            /* tp_descr_get */\n  0,                            /* tp_descr_set */\n  0,                            /* tp_dictoffset */\n  (initproc)Wcs_init,         /* tp_init */\n  0,                            /* tp_alloc */\n  Wcs_new,                    /* tp_new */\n};\n\n\n/***************************************************************************\n * Module-level\n ***************************************************************************/\n\nint _setup_wcs_type(\n    PyObject* m) {\n\n  if (PyType_Ready(&WcsType) < 0)\n    return -1;\n\n  Py_INCREF(&WcsType);\n  return PyModule_AddObject(m, \"_Wcs\", (PyObject *)&WcsType);\n}\n\nstruct module_state {\n/* The Sun compiler can't handle empty structs */\n#if defined(__SUNPRO_C) || defined(_MSC_VER)\n    int _dummy;\n#endif\n};\n\nstatic struct PyModuleDef moduledef = {\n    PyModuleDef_HEAD_INIT,\n    \"_wcs\",\n    NULL,\n    sizeof(struct module_state),\n    module_methods,\n    NULL,\n    NULL,\n    NULL,\n    NULL\n};\n\nPyMODINIT_FUNC\nPyInit__wcs(void)\n\n{\n  PyObject* m;\n\n  wcs_errexc[0] = NULL;                         /* Success */\n  wcs_errexc[1] = &PyExc_MemoryError;           /* Null wcsprm pointer passed */\n  wcs_errexc[2] = &PyExc_MemoryError;           /* Memory allocation failed */\n  wcs_errexc[3] = &WcsExc_SingularMatrix;       /* Linear transformation matrix is singular */\n  wcs_errexc[4] = &WcsExc_InconsistentAxisTypes; /* Inconsistent or unrecognized coordinate axis types */\n  wcs_errexc[5] = &PyExc_ValueError;            /* Invalid parameter value */\n  wcs_errexc[6] = &WcsExc_InvalidTransform;     /* Invalid coordinate transformation parameters */\n  wcs_errexc[7] = &WcsExc_InvalidTransform;     /* Ill-conditioned coordinate transformation parameters */\n  wcs_errexc[8] = &WcsExc_InvalidCoordinate;    /* One or more of the pixel coordinates were invalid, */\n  /* as indicated by the stat vector */\n  wcs_errexc[9] = &WcsExc_InvalidCoordinate;    /* One or more of the world coordinates were invalid, */\n  /* as indicated by the stat vector */\n  wcs_errexc[10] = &WcsExc_InvalidCoordinate;    /* Invalid world coordinate */\n  wcs_errexc[11] = &WcsExc_NoSolution;           /* no solution found in the specified interval */\n  wcs_errexc[12] = &WcsExc_InvalidSubimageSpecification; /* Invalid subimage specification (no spectral axis) */\n  wcs_errexc[13] = &WcsExc_NonseparableSubimageCoordinateSystem; /* Non-separable subimage coordinate system */\n\n  m = PyModule_Create(&moduledef);\n\n  if (m == NULL)\n    return NULL;\n\n  import_array();\n\n  if (_setup_api(m)                 ||\n      _setup_str_list_proxy_type(m) ||\n      _setup_unit_list_proxy_type(m)||\n      _setup_wcsprm_type(m)         ||\n      _setup_auxprm_type(m)         ||\n      _setup_prjprm_type(m)         ||\n      _setup_celprm_type(m)         ||\n      _setup_tabprm_type(m)         ||\n      _setup_wtbarr_type(m)         ||\n      _setup_distortion_type(m)     ||\n      _setup_sip_type(m)            ||\n      _setup_wcs_type(m)          ||\n      _define_exceptions(m)) {\n    Py_DECREF(m);\n    return NULL;\n  }\n\n#ifdef HAVE_WCSLIB_VERSION\n  if (PyModule_AddStringConstant(m, \"__version__\", wcslib_version(NULL))) {\n    return NULL;\n  }\n#else\n  if (PyModule_AddStringConstant(m, \"__version__\", \"4.x\")) {\n    return NULL;\n  }\n#endif\n\n  return m;\n}\n"},{"id":7549,"name":"distortion.c","nodeType":"TextFile","path":"astropy/wcs/src","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#include \"astropy_wcs/distortion.h\"\n\n#include <assert.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n\n/* TODO: n-dimensional support */\n\nint\ndistortion_lookup_t_init(\n    distortion_lookup_t* lookup) {\n\n  unsigned int i;\n\n  for (i = 0; i < NAXES; ++i) {\n    lookup->naxis[i] = 0;\n    lookup->crpix[i] = 0.0;\n    lookup->crval[i] = 0.0;\n    lookup->cdelt[i] = 1.0;\n  }\n\n  lookup->data = NULL;\n\n  return 0;\n}\n\nvoid\ndistortion_lookup_t_free(\n    /*@unused@*/ distortion_lookup_t* lookup) {\n\n  /*@empty@*/\n}\n\n/**\n * Get a value at a specific integral location in the lookup table.\n * (This is nothing more special than an array lookup with range\n * checking.)\n */\nstatic INLINE float\nget_dist_clamp(\n    const float* const data,\n    const unsigned int* const naxis,\n    const int x,\n    const int y) {\n\n  return data[\n    ((naxis[0] * CLAMP(y, 0, (long)naxis[1] - 1)) +\n     CLAMP(x, 0, (long)naxis[0] - 1))];\n}\n\nstatic INLINE float\nget_dist(\n    const float* const data,\n    const unsigned int* const naxis,\n    const int x,\n    const int y) {\n\n  return data[(naxis[0] * y) + x];\n}\n\n/**\n * Converts a pixel coordinate to a fractional coordinate in the\n * lookup table on a single axis\n */\nstatic INLINE double\nimage_coord_to_distortion_coord(\n    const distortion_lookup_t * const lookup,\n    const unsigned int axis,\n    const double img) {\n\n  double result;\n\n  assert(lookup != NULL);\n  assert(axis < NAXES);\n\n  /* The \"- 1./stepsize\" is here because the input coordinates are 1-based,\n     but this is a C-array underneath */\n  result = (\n      ((img - lookup->crval[axis]) / lookup->cdelt[axis]) +\n      lookup->crpix[axis]) - 1.0/lookup->cdelt[axis];\n\n  return CLAMP(result, 0.0, (double)(lookup->naxis[axis] - 1));\n}\n\n/**\n * Converts a pixel coordinate to a fractional coordinate in the\n * lookup table.\n */\nstatic INLINE void\nimage_coords_to_distortion_coords(\n    const distortion_lookup_t * const lookup,\n    const double * const img /* [NAXES] */,\n    /* Output parameters */\n    /*@out@*/ double *dist /* [NAXES] */) {\n\n  unsigned int i;\n\n  assert(lookup != NULL);\n  assert(img != NULL);\n  assert(dist != NULL);\n\n  for (i = 0; i < NAXES; ++i) {\n    dist[i] = image_coord_to_distortion_coord(lookup, i, img[i]);\n  }\n}\n\nINLINE double\nget_distortion_offset(\n    const distortion_lookup_t * const lookup,\n    const double * const img /*[NAXES]*/) {\n\n  double              dist[NAXES];\n  double              dist_floor[NAXES];\n  int                 dist_ifloor[NAXES];\n  double              dist_weight[NAXES];\n  double              dist_iweight[NAXES];\n  double              result;\n  const unsigned int* naxis = lookup->naxis;\n  const float*        data  = lookup->data;\n  unsigned int        i;\n\n  assert(lookup != NULL);\n  assert(img != NULL);\n\n  image_coords_to_distortion_coords(lookup, img, dist);\n\n  for (i = 0; i < NAXES; ++i) {\n    dist_floor[i] = floor(dist[i]);\n    dist_ifloor[i] = (int)dist_floor[i];\n    dist_weight[i] = dist[i] - dist_floor[i];\n    dist_iweight[i] = 1.0 - dist_weight[i];\n  }\n\n  /* If we may need to clamp the lookups, use this slower approach */\n  if (dist_ifloor[0] < 0 ||\n      dist_ifloor[1] < 0 ||\n      dist_ifloor[0] >= (long)lookup->naxis[0] - 1 ||\n      dist_ifloor[1] >= (long)lookup->naxis[1] - 1) {\n    result =\n      (double)get_dist_clamp(data, naxis, dist_ifloor[0],     dist_ifloor[1])     * dist_iweight[0] * dist_iweight[1] +\n      (double)get_dist_clamp(data, naxis, dist_ifloor[0],     dist_ifloor[1] + 1) * dist_iweight[0] * dist_weight[1] +\n      (double)get_dist_clamp(data, naxis, dist_ifloor[0] + 1, dist_ifloor[1])     * dist_weight[0] * dist_iweight[1] +\n      (double)get_dist_clamp(data, naxis, dist_ifloor[0] + 1, dist_ifloor[1] + 1) * dist_weight[0] * dist_weight[1];\n  /* Else, we don't need to clamp 4 times for each pixel */\n  } else {\n    result =\n      (double)get_dist(data, naxis, dist_ifloor[0],     dist_ifloor[1])     * dist_iweight[0] * dist_iweight[1] +\n      (double)get_dist(data, naxis, dist_ifloor[0],     dist_ifloor[1] + 1) * dist_iweight[0] * dist_weight[1] +\n      (double)get_dist(data, naxis, dist_ifloor[0] + 1, dist_ifloor[1])     * dist_weight[0] * dist_iweight[1] +\n      (double)get_dist(data, naxis, dist_ifloor[0] + 1, dist_ifloor[1] + 1) * dist_weight[0] * dist_weight[1];\n  }\n\n  return result;\n}\n\nint\np4_pix2deltas(\n    const unsigned int naxes,\n    const distortion_lookup_t **lookup, /* [NAXES] */\n    const unsigned int nelem,\n    const double* pix, /* [NAXES][nelem] */\n    double *foc /* [NAXES][nelem] */) {\n\n  int i;\n  double* foc0;\n  const double* pix0;\n  const double* pixend;\n\n#ifndef NDEBUG\n  unsigned int k;\n#endif\n\n  assert(naxes == NAXES);\n  assert(lookup != NULL);\n  assert(pix != NULL);\n  assert(foc != NULL);\n\n#ifndef NDEBUG\n  for (k = 0; k < naxes; ++k) {\n    if (lookup[k] != NULL) {\n      assert(lookup[k]->data != NULL);\n    }\n  }\n#endif\n\n  if (pix == NULL || foc == NULL) {\n    return 1;\n  }\n\n  pixend = pix + nelem * NAXES;\n  /* This can't be parallelized, because pix may be equal to foc */\n  /* For the same reason, i needs to be in the inner loop */\n  for (pix0 = pix, foc0 = foc; pix0 < pixend; pix0 += NAXES, foc0 += NAXES) {\n    for (i = 0; i < NAXES; ++i) {\n      if (lookup[i]) {\n        foc0[i] += get_distortion_offset(lookup[i], pix0);\n      }\n    }\n  }\n\n  return 0;\n}\n\nint\np4_pix2foc(\n    const unsigned int naxes,\n    const distortion_lookup_t **lookup, /* [NAXES] */\n    const unsigned int nelem,\n    const double* pix, /* [NAXES][nelem] */\n    double *foc /* [NAXES][nelem] */) {\n\n  assert(pix);\n  assert(foc);\n\n  if (pix != foc) {\n    memcpy(foc, pix, sizeof(double) * naxes * nelem);\n  }\n\n  return p4_pix2deltas(naxes, lookup, nelem, pix, foc);\n}\n"},{"id":7550,"name":"distortion_wrap.c","nodeType":"TextFile","path":"astropy/wcs/src","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#define NO_IMPORT_ARRAY\n\n#include \"astropy_wcs/distortion_wrap.h\"\n#include \"astropy_wcs/docstrings.h\"\n\n#include <structmember.h> /* From Python */\n\nstatic int\nPyDistLookup_traverse(\n    PyDistLookup* self,\n    visitproc visit,\n    void* arg) {\n\n  Py_VISIT(self->py_data);\n\n  return 0;\n}\n\nstatic int\nPyDistLookup_clear(\n    PyDistLookup* self) {\n\n  Py_CLEAR(self->py_data);\n\n  return 0;\n}\n\nstatic void\nPyDistLookup_dealloc(\n    PyDistLookup* self) {\n\n  PyObject_GC_UnTrack(self);\n  distortion_lookup_t_free(&self->x);\n  Py_XDECREF(self->py_data);\n  Py_TYPE(self)->tp_free((PyObject*)self);\n}\n\n/*@null@*/ static PyObject *\nPyDistLookup_new(\n    PyTypeObject* type,\n    /*@unused@*/ PyObject* args,\n    /*@unused@*/ PyObject* kwds) {\n\n  PyDistLookup* self;\n\n  self = (PyDistLookup*)type->tp_alloc(type, 0);\n  if (self != NULL) {\n    if (distortion_lookup_t_init(&self->x)) {\n      return NULL;\n    }\n    self->py_data = NULL;\n  }\n  return (PyObject*)self;\n}\n\nstatic int\nPyDistLookup_init(\n    PyDistLookup* self,\n    PyObject* args,\n    /*@unused@*/ PyObject* kwds) {\n\n  PyObject* py_array_obj = NULL;\n  PyArrayObject* array_obj = NULL;\n\n  if (!PyArg_ParseTuple(args, \"O(dd)(dd)(dd):DistortionLookupTable.__init__\",\n                        &py_array_obj,\n                        &(self->x.crpix[0]), &(self->x.crpix[1]),\n                        &(self->x.crval[0]), &(self->x.crval[1]),\n                        &(self->x.cdelt[0]), &(self->x.cdelt[1]))) {\n    return -1;\n  }\n\n  array_obj = (PyArrayObject*)PyArray_ContiguousFromAny(py_array_obj, NPY_FLOAT32, 2, 2);\n  if (array_obj == NULL) {\n    return -1;\n  }\n\n  self->py_data = array_obj;\n  self->x.naxis[0] = (unsigned int)PyArray_DIM(array_obj, 1);\n  self->x.naxis[1] = (unsigned int)PyArray_DIM(array_obj, 0);\n  self->x.data = (float *)PyArray_DATA(array_obj);\n\n  return 0;\n}\n\nstatic PyObject*\nPyDistLookup_get_cdelt(\n    PyDistLookup* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t naxis = 2;\n\n  return get_double_array(\"cdelt\", self->x.cdelt, 1, &naxis, (PyObject*)self);\n}\n\nstatic int\nPyDistLookup_set_cdelt(\n    PyDistLookup* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp naxis = 2;\n\n  return set_double_array(\"cdelt\", value, 1, &naxis, self->x.cdelt);\n}\n\nstatic PyObject*\nPyDistLookup_get_crpix(\n    PyDistLookup* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t naxis = 2;\n\n  return get_double_array(\"crpix\", self->x.crpix, 1, &naxis, (PyObject*)self);\n}\n\nstatic int\nPyDistLookup_set_crpix(\n    PyDistLookup* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp naxis = 2;\n\n  return set_double_array(\"crpix\", value, 1, &naxis, self->x.crpix);\n}\n\nstatic PyObject*\nPyDistLookup_get_crval(\n    PyDistLookup* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t naxis = 2;\n\n  return get_double_array(\"crval\", self->x.crval, 1, &naxis, (PyObject*)self);\n}\n\nstatic int\nPyDistLookup_set_crval(\n    PyDistLookup* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp naxis = 2;\n\n  return set_double_array(\"crval\", value, 1, &naxis, self->x.crval);\n}\n\n/*@shared@*/ static PyObject*\nPyDistLookup_get_data(\n    PyDistLookup* self,\n    /*@unused@*/ void* closure) {\n\n  if (self->py_data == NULL) {\n    Py_INCREF(Py_None);\n    return Py_None;\n  } else {\n    Py_INCREF(self->py_data);\n    return (PyObject*)self->py_data;\n  }\n}\n\nstatic int\nPyDistLookup_set_data(\n    PyDistLookup* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  PyArrayObject* value_array = NULL;\n\n  if (value == NULL) {\n    Py_CLEAR(self->py_data);\n    self->x.data = NULL;\n    return 0;\n  }\n\n  value_array = (PyArrayObject*)PyArray_ContiguousFromAny(value, NPY_FLOAT32, 2, 2);\n\n  if (value_array == NULL) {\n    return -1;\n  }\n\n  Py_XDECREF(self->py_data);\n\n  self->py_data = value_array;\n  self->x.naxis[0] = (unsigned int)PyArray_DIM(value_array, 1);\n  self->x.naxis[1] = (unsigned int)PyArray_DIM(value_array, 0);\n  self->x.data = (float *)PyArray_DATA(value_array);\n\n  return 0;\n}\n\n/*@null@*/ static PyObject*\nPyDistLookup_get_offset(\n    PyDistLookup* self,\n    PyObject* args,\n    /*@unused@*/ PyObject* kwds) {\n\n  double coord[NAXES];\n  double result;\n\n  if (self->x.data == NULL) {\n    PyErr_SetString(PyExc_RuntimeError,\n                    \"No data has been set for the lookup table\");\n    return NULL;\n  }\n\n  if (!PyArg_ParseTuple(args, \"dd:get_offset\", &coord[0], &coord[1])) {\n    return NULL;\n  }\n\n  result = get_distortion_offset(&self->x, coord);\n  return PyFloat_FromDouble(result);\n}\n\nstatic PyObject*\nPyDistLookup___copy__(\n    PyDistLookup* self,\n    /*@unused@*/ PyObject* args,\n    /*@unused@*/ PyObject* kwds) {\n\n  PyDistLookup* copy = NULL;\n  int           i    = 0;\n\n  copy = (PyDistLookup*)PyDistLookup_new(&PyDistLookupType, NULL, NULL);\n  if (copy == NULL) {\n    return NULL;\n  }\n\n  for (i = 0; i < 2; ++i) {\n    copy->x.naxis[i] = self->x.naxis[i];\n    copy->x.crpix[i] = self->x.crpix[i];\n    copy->x.crval[i] = self->x.crval[i];\n    copy->x.cdelt[i] = self->x.cdelt[i];\n  }\n\n  if (self->py_data) {\n    PyDistLookup_set_data(copy, (PyObject*)self->py_data, NULL);\n  }\n\n  return (PyObject*)copy;\n}\n\nstatic PyObject*\nPyDistLookup___deepcopy__(\n    PyDistLookup* self,\n    PyObject* memo,\n    /*@unused@*/ PyObject* kwds) {\n\n  PyDistLookup* copy;\n  PyObject*     obj_copy;\n  int           i = 0;\n\n  copy = (PyDistLookup*)PyDistLookup_new(&PyDistLookupType, NULL, NULL);\n  if (copy == NULL) {\n    return NULL;\n  }\n\n  for (i = 0; i < 2; ++i) {\n    copy->x.naxis[i] = self->x.naxis[i];\n    copy->x.crpix[i] = self->x.crpix[i];\n    copy->x.crval[i] = self->x.crval[i];\n    copy->x.cdelt[i] = self->x.cdelt[i];\n  }\n\n  if (self->py_data) {\n    obj_copy = get_deepcopy((PyObject*)self->py_data, memo);\n    if (obj_copy == NULL) {\n      Py_DECREF(copy);\n      return NULL;\n    }\n    PyDistLookup_set_data(copy, (PyObject*)obj_copy, NULL);\n    Py_DECREF(obj_copy);\n  }\n\n  return (PyObject*)copy;\n}\n\n\nstatic PyGetSetDef PyDistLookup_getset[] = {\n  {\"cdelt\", (getter)PyDistLookup_get_cdelt, (setter)PyDistLookup_set_cdelt, (char *)doc_cdelt},\n  {\"crpix\", (getter)PyDistLookup_get_crpix, (setter)PyDistLookup_set_crpix, (char *)doc_crpix},\n  {\"crval\", (getter)PyDistLookup_get_crval, (setter)PyDistLookup_set_crval, (char *)doc_crval},\n  {\"data\",  (getter)PyDistLookup_get_data,  (setter)PyDistLookup_set_data,  (char *)doc_data},\n  {NULL}\n};\n\nstatic PyMethodDef PyDistLookup_methods[] = {\n  {\"__copy__\", (PyCFunction)PyDistLookup___copy__, METH_NOARGS, NULL},\n  {\"__deepcopy__\", (PyCFunction)PyDistLookup___deepcopy__, METH_O, NULL},\n  {\"get_offset\", (PyCFunction)PyDistLookup_get_offset, METH_VARARGS, doc_get_offset},\n  {NULL}\n};\n\nPyTypeObject PyDistLookupType = {\n  PyVarObject_HEAD_INIT(NULL, 0)\n  \"astropy.wcs.DistortionLookupTable\",  /*tp_name*/\n  sizeof(PyDistLookup),         /*tp_basicsize*/\n  0,                            /*tp_itemsize*/\n  (destructor)PyDistLookup_dealloc, /*tp_dealloc*/\n  0,                            /*tp_print*/\n  0,                            /*tp_getattr*/\n  0,                            /*tp_setattr*/\n  0,                            /*tp_compare*/\n  0,                            /*tp_repr*/\n  0,                            /*tp_as_number*/\n  0,                            /*tp_as_sequence*/\n  0,                            /*tp_as_mapping*/\n  0,                            /*tp_hash */\n  0,                            /*tp_call*/\n  0,                            /*tp_str*/\n  0,                            /*tp_getattro*/\n  0,                            /*tp_setattro*/\n  0,                            /*tp_as_buffer*/\n  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/\n  doc_DistortionLookupTable,    /* tp_doc */\n  (traverseproc)PyDistLookup_traverse, /* tp_traverse */\n  (inquiry)PyDistLookup_clear,  /* tp_clear */\n  0,                            /* tp_richcompare */\n  0,                            /* tp_weaklistoffset */\n  0,                            /* tp_iter */\n  0,                            /* tp_iternext */\n  PyDistLookup_methods,         /* tp_methods */\n  0,                            /* tp_members */\n  PyDistLookup_getset,          /* tp_getset */\n  0,                            /* tp_base */\n  0,                            /* tp_dict */\n  0,                            /* tp_descr_get */\n  0,                            /* tp_descr_set */\n  0,                            /* tp_dictoffset */\n  (initproc)PyDistLookup_init,  /* tp_init */\n  0,                            /* tp_alloc */\n  PyDistLookup_new,             /* tp_new */\n};\n\nint _setup_distortion_type(\n    PyObject* m) {\n\n  if (PyType_Ready(&PyDistLookupType) < 0) {\n    return -1;\n  }\n\n  Py_INCREF(&PyDistLookupType);\n  return PyModule_AddObject(m, \"DistortionLookupTable\", (PyObject *)&PyDistLookupType);\n}\n"},{"id":7551,"name":"wcslib_wrap.c","nodeType":"TextFile","path":"astropy/wcs/src","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#define NO_IMPORT_ARRAY\n\n#include \"astropy_wcs/wcslib_wrap.h\"\n#include \"astropy_wcs/wcslib_auxprm_wrap.h\"\n#include \"astropy_wcs/wcslib_prjprm_wrap.h\"\n#include \"astropy_wcs/wcslib_celprm_wrap.h\"\n#include \"astropy_wcs/wcslib_tabprm_wrap.h\"\n#include \"astropy_wcs/wcslib_wtbarr_wrap.h\"\n#include \"astropy_wcs/wcslib_units_wrap.h\"\n#include \"astropy_wcs/unit_list_proxy.h\"\n#include <structmember.h> /* from Python */\n\n#include <wcs.h>\n#include <wcsfix.h>\n#include <wcshdr.h>\n#include <wcsmath.h>\n#include <wcsprintf.h>\n#include <wcsunits.h>\n#include <cel.h>\n#include <prj.h>\n#include <tab.h>\n#include <wtbarr.h>\n#include <stdio.h>\n\n#include \"astropy_wcs/isnan.h\"\n#include \"astropy_wcs/distortion.h\"\n\n/*\n It gets to be really tedious to type long docstrings in ANSI C syntax\n (since multi-line strings literals are not valid).  Therefore, the\n docstrings are written in doc/docstrings.py, which are then converted\n by setup.py into docstrings.h, which we include here.\n*/\n#include \"astropy_wcs/docstrings.h\"\n\n/***************************************************************************\n * Helper functions                                                        *\n ***************************************************************************/\n\nenum e_altlin {\n  has_pc = 1,\n  has_cd = 2,\n  has_crota = 4\n};\n\nstatic int\nis_valid_alt_key(\n    const char* key) {\n\n  if (key[1] != '\\0' ||\n      !(key[0] == ' ' ||\n        (key[0] >= 'A' && key[0] <= 'Z'))) {\n    PyErr_SetString(PyExc_ValueError, \"key must be ' ' or 'A'-'Z'\");\n    return 0;\n  }\n\n  return 1;\n}\n\nstatic int\nconvert_rejections_to_warnings() {\n  char buf[1024];\n  const char *src;\n  char *dst;\n  int last_was_space;\n  PyObject *wcs_module = NULL;\n  PyObject *FITSFixedWarning = NULL;\n  int status = -1;\n  char delimiter;\n\n#ifdef HAVE_WCSLIB_VERSION\n  delimiter = ',';\n#else\n  delimiter = ':';\n#endif\n\n  if (wcsprintf_buf()[0] == 0) {\n    return 0;\n  }\n\n  wcs_module = PyImport_ImportModule(\"astropy.wcs\");\n  if (wcs_module == NULL) {\n    goto exit;\n  }\n\n  FITSFixedWarning = PyObject_GetAttrString(\n      wcs_module, \"FITSFixedWarning\");\n  if (FITSFixedWarning == NULL) {\n    goto exit;\n  }\n\n  src = wcsprintf_buf();\n  while (*src != 0) {\n    dst = buf;\n\n    /* Read the first line, removing any repeated spaces */\n    last_was_space = 0;\n    for (; *src != 0; ++src) {\n      if (*src == ' ') {\n        if (!last_was_space) {\n          *(dst++) = *src;\n          last_was_space = 1;\n        }\n      } else if (*src == '\\n') {\n        ++src;\n        break;\n      } else {\n        *(dst++) = *src;\n        last_was_space = 0;\n      }\n    }\n\n    *(dst++) = '\\n';\n\n    /* For the second line, remove everything up to and including the\n       first colon */\n    for (; *src != 0; ++src) {\n      if (*src == delimiter) {\n        ++src;\n        break;\n      }\n    }\n\n    /* Read to the end of the second line, removing any repeated\n       spaces */\n    last_was_space = 1;\n    for (; *src != 0; ++src) {\n      if (*src == ' ') {\n        if (!last_was_space) {\n          *(dst++) = *src;\n          last_was_space = 1;\n        }\n      } else if (*src == '\\n') {\n        ++src;\n        break;\n      } else {\n        *(dst++) = *src;\n        last_was_space = 0;\n      }\n    }\n\n    /* NULL terminate the string */\n    *dst = 0;\n\n    /* Raise the warning.  Depending on the user's configuration, this\n       may raise an exception, and PyErr_WarnEx returns -1. */\n    if (PyErr_WarnEx(FITSFixedWarning, buf, 1)) {\n      goto exit;\n    }\n  }\n\n  status = 0;\n\n exit:\n\n  Py_XDECREF(wcs_module);\n  Py_XDECREF(FITSFixedWarning);\n\n  return status;\n}\n\n\n/***************************************************************************\n * wtbarr-related global variables and functions                           *\n ***************************************************************************/\n\nstatic PyObject *get_wtbarr_data = NULL;\n\n\nvoid _set_wtbarr_callback(PyObject* callback) {\n  Py_XINCREF(callback);         /* Add a reference to new callback */\n  Py_XDECREF(get_wtbarr_data);  /* Dispose of previous callback */\n  get_wtbarr_data = callback;   /* Remember new callback */\n}\n\n\nint _update_wtbarr_from_hdulist(PyObject *hdulist, struct wtbarr *wtb) {\n  PyArrayObject *arrayp=NULL;\n  PyObject *result=NULL;\n  int i, naxis, nelem, naxes[NPY_MAXDIMS];\n  npy_intp *npy_naxes;\n  npy_double *appayp_data;\n\n  if (hdulist == NULL || hdulist == Py_None) {\n    PyErr_SetString(PyExc_ValueError,\n                    \"HDUList is required to retrieve -TAB coordinates \"\n                    \"and/or indices.\");\n    return 0;\n  }\n\n  if (wtb->ndim < 1) {\n    PyErr_SetString(PyExc_ValueError, \"Number of dimensions should be positive.\");\n    return 0;\n  }\n\n  result = PyObject_CallFunction(get_wtbarr_data, \"(OsiiCsli)\", hdulist,\n      wtb->extnam, wtb->extver, wtb->extlev, wtb->kind, wtb->ttype, wtb->row,\n      wtb->ndim);\n\n  if (result == NULL) return 0;\n\n  arrayp = (PyArrayObject *)PyArray_FromAny(result,\n      PyArray_DescrFromType(NPY_DOUBLE), 0, 0, NPY_ARRAY_CARRAY, NULL);\n\n  Py_DECREF(result);\n\n  if (arrayp == NULL) {\n    PyErr_SetString(PyExc_TypeError, \"Unable to convert wtbarr callback \"\n                    \"result to a numpy.ndarray.\");\n    return 0;\n  }\n\n  if (!PyArray_Check(arrayp)) {\n    PyErr_SetString(PyExc_TypeError,\n                    \"wtbarr callback must return a numpy.ndarray type \"\n                    \"coordinate or index array.\");\n    Py_DECREF(arrayp);\n    return 0;\n  }\n\n  naxis = PyArray_NDIM(arrayp);\n\n  if (naxis == 0) {\n    PyErr_SetString(PyExc_ValueError, \"-TAB coordinate or index arrays \"\n                    \"cannot be 0-dimensional.\");\n    Py_DECREF(arrayp);\n    return 0;\n  }\n\n  npy_naxes = PyArray_DIMS(arrayp);\n  for (i = 0; i < naxis; i++) {\n    naxes[i] = (int) npy_naxes[i];\n  }\n\n  if (naxis != wtb->ndim) {\n    if (wtb->kind == 'c' && wtb->ndim == 2 && naxis == 1) {\n      /* Allow TDIMn to be omitted for degenerate coordinate arrays. */\n      naxis = 2;\n      naxes[1] = 1;\n    } else {\n      PyErr_Format(PyExc_ValueError,\n          \"An array with an unexpected number of axes was \"\n          \"received from the callback. Expected %d but got %d.\",\n          wtb->ndim, (int) naxis);\n      Py_DECREF(arrayp);\n      return 0;\n    }\n  }\n\n  if (wtb->kind == 'c') {\n    /* Coordinate array; calculate the array size. */\n    nelem = naxes[naxis-1];\n    for (i = 0; i < naxis-1; i++) {\n      *(wtb->dimlen + i) = naxes[naxis-2-i];\n      nelem *= naxes[i];\n    }\n  } else {\n    /* Index vector; check length. */\n    if ((nelem = naxes[naxis-1]) != *(wtb->dimlen)) {\n      /* N.B. coordinate array precedes the index vectors. */\n      PyErr_Format(PyExc_ValueError,\n          \"An index array with an unexpected number of dimensions was \"\n          \"received from the callback. Expected %d but got %d.\",\n          *(wtb->dimlen), (int) nelem);\n      Py_DECREF(arrayp);\n      return 0;\n    }\n  }\n\n  /* Allocate memory for the array. */\n  if (!((*wtb->arrayp) = calloc((size_t)nelem, sizeof(double)))) {\n    PyErr_SetString(PyExc_MemoryError, \"Out of memory: can't allocate \"\n                    \"coordinate or index array.\");\n    Py_DECREF(arrayp);\n    return 0;\n  }\n\n  /* Read the array from the table. */\n  appayp_data = (npy_double*)PyArray_DATA(arrayp);\n  for (i = 0; i < nelem; i++) {\n    (*wtb->arrayp)[i] = (double)appayp_data[i];\n  }\n\n  Py_DECREF(arrayp);\n  return 1;\n}\n\n\n/***************************************************************************\n * PyWcsprm methods\n */\n\nstatic int\nPyWcsprm_cset(PyWcsprm* self, const int convert);\n\nstatic INLINE void\nnote_change(PyWcsprm* self) {\n  self->x.flag = 0;\n}\n\nstatic void\nPyWcsprm_dealloc(\n    PyWcsprm* self) {\n\n  wcsfree(&self->x);\n  Py_TYPE(self)->tp_free((PyObject*)self);\n}\n\nstatic PyWcsprm*\nPyWcsprm_cnew(void) {\n  PyWcsprm* self;\n  self = (PyWcsprm*)(&PyWcsprmType)->tp_alloc(&PyWcsprmType, 0);\n  return self;\n}\n\nstatic PyObject *\nPyWcsprm_new(\n    PyTypeObject* type,\n    /*@unused@*/ PyObject* args,\n    /*@unused@*/ PyObject* kwds) {\n\n  PyWcsprm* self;\n  self = (PyWcsprm*)type->tp_alloc(type, 0);\n  return (PyObject*)self;\n}\n\nstatic int\nPyWcsprm_init(\n    PyWcsprm* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  int            status;\n  PyObject*      header_obj    = NULL;\n  PyObject*      hdulist       = NULL;\n  char *         header        = NULL;\n  Py_ssize_t     header_length = 0;\n  Py_ssize_t     nkeyrec       = 0;\n  const char *   key           = \" \";\n  PyObject*      relax_obj     = NULL;\n  int            relax         = 0;\n  int            naxis         = -1;\n  int            keysel        = -1;\n  PyObject*      colsel        = Py_None;\n  PyArrayObject* colsel_array  = NULL;\n  int*           colsel_data  = NULL;\n  int*           colsel_ints   = NULL;\n  int            warnings      = 1;\n  int            nreject       = 0;\n  int            nwcs          = 0;\n  struct wcsprm* wcs           = NULL;\n  int            i, j;\n  const char*    keywords[]    = {\"header\", \"key\", \"relax\", \"naxis\", \"keysel\",\n                                  \"colsel\", \"warnings\", \"hdulist\", NULL};\n\n  if (!PyArg_ParseTupleAndKeywords(\n          args, kwds, \"|OsOiiOiO:WCSBase.__init__\",\n          (char **)keywords, &header_obj, &key, &relax_obj, &naxis, &keysel,\n          &colsel, &warnings, &hdulist)) {\n    return -1;\n  }\n\n  if (header_obj == NULL || header_obj == Py_None) {\n    if (keysel > 0) {\n      PyErr_SetString(\n          PyExc_ValueError,\n          \"If no header is provided, keysel may not be provided either.\");\n      return -1;\n    }\n\n    if (colsel != Py_None) {\n      PyErr_SetString(\n          PyExc_ValueError,\n          \"If no header is provided, colsel may not be provided either.\");\n      return -1;\n    }\n\n    /* Default number of axes is 2 */\n    if (naxis < 0) {\n        naxis = 2;\n    }\n\n    if (naxis < 1 || naxis > 15) {\n      PyErr_SetString(\n          PyExc_ValueError,\n          \"naxis must be in range 1-15\");\n      return -1;\n    }\n\n    self->x.flag = -1;\n    status = wcsini(1, naxis, &self->x);\n\n    if (status != 0) {\n      PyErr_SetString(\n          PyExc_MemoryError,\n          self->x.err->msg);\n      return -1;\n    }\n\n    self->x.alt[0] = key[0];\n\n    if (PyWcsprm_cset(self, 0)) {\n      return -1;\n    }\n    wcsprm_c2python(&self->x);\n\n    return 0;\n  } else { /* header != NULL */\n    if (PyBytes_AsStringAndSize(header_obj, &header, &header_length)) {\n      return -1;\n    }\n\n    if (relax_obj == Py_True) {\n      relax = WCSHDR_all;\n    } else if (relax_obj == NULL || relax_obj == Py_False) {\n      relax = WCSHDR_none;\n    } else {\n      relax = (int)PyLong_AsLong(relax_obj);\n      if (relax == -1) {\n        PyErr_SetString(\n            PyExc_ValueError,\n            \"relax must be True, False or an integer.\");\n        return -1;\n      }\n    }\n\n    if (!is_valid_alt_key(key)) {\n      return -1;\n    }\n\n    if (naxis >= 0) {\n      PyErr_SetString(\n          PyExc_ValueError,\n          \"naxis may not be provided if a header is provided.\");\n      return -1;\n    }\n\n    nkeyrec = header_length / 80;\n    if (nkeyrec > 0x7fffffff) {\n      PyErr_SetString(\n          PyExc_MemoryError,\n          \"header is too long\");\n      return -1;\n    }\n\n    if (colsel != Py_None) {\n      colsel_array = (PyArrayObject*) PyArray_ContiguousFromAny(\n        colsel, NPY_INT, 1, 1);\n      if (colsel_array == NULL) {\n        return -1;\n      }\n\n      colsel_ints = malloc(sizeof(int) * (PyArray_DIM(colsel_array, 0) + 1));\n      if (colsel_ints == NULL) {\n        Py_DECREF(colsel_array);\n        PyErr_SetString(\n            PyExc_MemoryError,\n            \"Memory allocation error.\");\n        return -1;\n      }\n\n      colsel_ints[0] = (int)PyArray_DIM(colsel_array, 0);\n      colsel_data = (int *)PyArray_DATA(colsel_array);\n      for (i = 0; i < colsel_ints[0]; ++i) {\n        colsel_ints[i+1] = colsel_data[i];\n      }\n\n      Py_DECREF(colsel_array);\n    }\n\n    wcsprintf_set(NULL);\n\n    /* Call the header parser twice, the first time to get warnings\n       out about \"rejected\" keywords (which we can then send to Python\n       as warnings), and the second time to get a corrected wcsprm\n       object. */\n\n    if (keysel < 0) {\n      status = wcspih(\n          header,\n          (int)nkeyrec,\n          WCSHDR_reject,\n          2,\n          &nreject,\n          &nwcs,\n          &wcs);\n    } else {\n      status = wcsbth(\n          header,\n          (int)nkeyrec,\n          WCSHDR_reject,\n          2,\n          keysel,\n          colsel_ints,\n          &nreject,\n          &nwcs,\n          &wcs);\n    }\n\n    if (status != 0) {\n      free(colsel_ints);\n      wcshdr_err_to_python_exc(status, wcs);\n      return -1;\n    }\n\n    wcsvfree(&nwcs, &wcs);\n\n    if (warnings && convert_rejections_to_warnings()) {\n      free(colsel_ints);\n      return -1;\n    }\n\n    if (keysel < 0) {\n      status = wcspih(\n          header,\n          (int)nkeyrec,\n          relax,\n          0,\n          &nreject,\n          &nwcs,\n          &wcs);\n    } else {\n      status = wcsbth(\n          header,\n          (int)nkeyrec,\n          relax,\n          0,\n          keysel,\n          colsel_ints,\n          &nreject,\n          &nwcs,\n          &wcs);\n    }\n\n    free(colsel_ints);\n\n    if (status != 0) {\n      wcshdr_err_to_python_exc(status, wcs);\n      return -1;\n    }\n\n    if (nwcs == 0) {\n      wcsvfree(&nwcs, &wcs);\n      PyErr_SetString(\n          WcsExc_NoWcsKeywordsFound,\n          \"No WCS keywords found in the given header\");\n      return -1;\n    }\n\n    /* Find the desired WCS */\n    for (i = 0; i < nwcs; ++i) {\n      if (wcs[i].alt[0] == key[0]) {\n        break;\n      }\n    }\n\n    if (i >= nwcs) {\n      wcsvfree(&nwcs, &wcs);\n      PyErr_Format(\n          PyExc_KeyError,\n          \"No WCS with key '%s' was found in the given header\",\n          key);\n      return -1;\n    }\n\n    if (wcscopy(1, wcs + i, &self->x) != 0) {\n      wcsvfree(&nwcs, &wcs);\n      PyErr_SetString(\n          PyExc_MemoryError,\n          self->x.err->msg);\n      return -1;\n    }\n\n    if (self->x.ntab) {\n      wcstab(&self->x);\n      for (j = 0; j < self->x.nwtb; j++) {\n        if (!_update_wtbarr_from_hdulist(hdulist, &(self->x.wtb[j]))) {\n          wcsfree(&self->x);\n          return -1;\n        }\n      }\n    }\n\n    note_change(self);\n    wcsprm_c2python(&self->x);\n    wcsvfree(&nwcs, &wcs);\n    return 0;\n  }\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_bounds_check(\n    PyWcsprm* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  unsigned char pix2sky    = 1;\n  unsigned char sky2pix    = 1;\n  int           bounds     = 0;\n  const char*   keywords[] = {\"pix2world\", \"world2pix\", NULL};\n\n  if (!PyArg_ParseTupleAndKeywords(\n          args, kwds, \"|bb:bounds_check\", (char **)keywords,\n          &pix2sky, &sky2pix)) {\n    return NULL;\n  }\n\n  if (pix2sky) {\n      bounds |= 2|4;\n  }\n\n  if (sky2pix) {\n      bounds |= 1;\n  }\n\n  wcsprm_python2c(&self->x);\n  wcsbchk(&self->x, bounds);\n\n  Py_RETURN_NONE;\n}\n\n\n/*@null@*/ static PyObject*\nPyWcsprm_copy(\n    PyWcsprm* self) {\n\n  PyWcsprm*     copy = NULL;\n  int           status, nelem, i, j, ndim;\n  struct wtbarr *wtb, *wtb0;\n\n  copy = PyWcsprm_cnew();\n  if (copy == NULL) {\n    return NULL;\n  }\n\n  wcsini(0, self->x.naxis, &copy->x);\n\n  wcsprm_python2c(&self->x);\n  status = wcscopy(1, &self->x, &copy->x);\n  wcsprm_c2python(&self->x);\n\n  if (status == 0) {\n    if (PyWcsprm_cset(copy, 0)) {\n      Py_XDECREF(copy);\n      return NULL;\n    }\n\n    if (self->x.ntab) {\n      wcstab(&copy->x);\n\n      for (j = 0; j < copy->x.nwtb; j++) {\n        wtb0 = self->x.wtb + j;\n        wtb = copy->x.wtb + j;\n        for (i = 0; i < wtb0->ndim - 1; i++) {\n          wtb->dimlen[i] = wtb0->dimlen[i];\n        }\n        /* Allocate memory for the array. */\n        if (wtb->kind == 'c') {\n          nelem = ndim = wtb->ndim - 1;\n          for (i = 0; i < ndim; i++) {\n            nelem *= wtb->dimlen[i];\n          }\n        } else {\n          nelem = *(wtb->dimlen);\n        }\n\n        if (!((*wtb->arrayp) = calloc((size_t)nelem, sizeof(double)))) {\n          PyErr_SetString(PyExc_MemoryError, \"Out of memory: can't allocate \"\n                                             \"coordinate or index array.\");\n          Py_DECREF(copy);\n          return NULL;\n        }\n\n        for (i = 0; i < nelem; i++) {\n          (*wtb->arrayp)[i] = (*wtb0->arrayp)[i];\n        }\n      }\n    }\n\n    wcsprm_c2python(&copy->x);\n    return (PyObject*)copy;\n  } else {\n    Py_XDECREF(copy);\n    wcs_to_python_exc(&(self->x));\n    return NULL;\n  }\n}\n\nPyObject*\nPyWcsprm_find_all_wcs(\n    PyObject* __,\n    PyObject* args,\n    PyObject* kwds) {\n\n  PyObject*      header_obj    = NULL;\n  char *         header        = NULL;\n  Py_ssize_t     header_length = 0;\n  Py_ssize_t     nkeyrec       = 0;\n  PyObject*      relax_obj     = NULL;\n  int            relax         = 0;\n  int            keysel        = 0;\n  int            warnings      = 1;\n  int            nreject       = 0;\n  int            nwcs          = 0;\n  struct wcsprm* wcs           = NULL;\n  PyObject*      result        = NULL;\n  PyWcsprm*      subresult     = NULL;\n  int            i             = 0;\n  const char*    keywords[]    = {\"header\", \"relax\", \"keysel\", \"warnings\", NULL};\n  int            status        = -1;\n\n  if (!PyArg_ParseTupleAndKeywords(\n          args, kwds, \"O|Oii:find_all_wcs\",\n          (char **)keywords, &header_obj, &relax_obj, &keysel, &warnings)) {\n    return NULL;\n  }\n\n  if (PyBytes_AsStringAndSize(header_obj, &header, &header_length)) {\n    return NULL;\n  }\n\n  nkeyrec = header_length / 80;\n  if (nkeyrec > 0x7fffffff) {\n    PyErr_SetString(\n        PyExc_MemoryError,\n        \"header is too long\");\n    return NULL;\n  }\n\n  if (relax_obj == Py_True) {\n    relax = WCSHDR_all;\n  } else if (relax_obj == NULL || relax_obj == Py_False) {\n    relax = WCSHDR_none;\n  } else {\n    relax = (int)PyLong_AsLong(relax_obj);\n    if (relax == -1) {\n      PyErr_SetString(\n          PyExc_ValueError,\n          \"relax must be True, False or an integer.\");\n      return NULL;\n    }\n  }\n\n  /* Call the header parser twice, the first time to get warnings\n     out about \"rejected\" keywords (which we can then send to Python\n     as warnings), and the second time to get a corrected wcsprm\n     object. */\n\n  Py_BEGIN_ALLOW_THREADS\n  if (keysel < 0) {\n    status = wcspih(\n        header,\n        (int)nkeyrec,\n        WCSHDR_reject,\n        2,\n        &nreject,\n        &nwcs,\n        &wcs);\n  } else {\n    status = wcsbth(\n        header,\n        (int)nkeyrec,\n        WCSHDR_reject,\n        2,\n        keysel,\n        NULL,\n        &nreject,\n        &nwcs,\n        &wcs);\n  }\n  Py_END_ALLOW_THREADS\n\n  if (status != 0) {\n    wcshdr_err_to_python_exc(status, wcs);\n    return NULL;\n  }\n\n  wcsvfree(&nwcs, &wcs);\n\n  if (warnings && convert_rejections_to_warnings()) {\n    return NULL;\n  }\n\n  Py_BEGIN_ALLOW_THREADS\n  if (keysel < 0) {\n    status = wcspih(\n        header,\n        (int)nkeyrec,\n        relax,\n        0,\n        &nreject,\n        &nwcs,\n        &wcs);\n  } else {\n    status = wcsbth(\n        header,\n        (int)nkeyrec,\n        relax,\n        0,\n        keysel,\n        NULL,\n        &nreject,\n        &nwcs,\n        &wcs);\n  }\n  Py_END_ALLOW_THREADS\n\n  if (status != 0) {\n    wcshdr_err_to_python_exc(status, wcs);\n    return NULL;\n  }\n\n  result = PyList_New(nwcs);\n  if (result == NULL) {\n    wcsvfree(&nwcs, &wcs);\n    return NULL;\n  }\n\n  for (i = 0; i < nwcs; ++i) {\n    subresult = PyWcsprm_cnew();\n    if (wcscopy(1, wcs + i, &subresult->x) != 0) {\n      Py_DECREF(result);\n      wcsvfree(&nwcs, &wcs);\n      PyErr_SetString(\n          PyExc_MemoryError,\n          \"Could not initialize wcsprm object\");\n      return NULL;\n    }\n\n    if (PyList_SetItem(result, i, (PyObject *)subresult) == -1) {\n      Py_DECREF(subresult);\n      Py_DECREF(result);\n      wcsvfree(&nwcs, &wcs);\n      return NULL;\n    }\n\n    subresult->x.flag = 0;\n    wcsprm_c2python(&subresult->x);\n  }\n\n  wcsvfree(&nwcs, &wcs);\n  return result;\n}\n\nstatic PyObject*\nPyWcsprm_cdfix(\n    PyWcsprm* self) {\n\n  int status = 0;\n\n  wcsprm_python2c(&self->x);\n  status = cdfix(&self->x);\n  wcsprm_c2python(&self->x);\n\n  if (status == -1 || status == 0) {\n    return PyLong_FromLong((long)status);\n  } else {\n    wcserr_fix_to_python_exc(self->x.err);\n    return NULL;\n  }\n}\n\nstatic PyObject*\nPyWcsprm_celfix(\n    PyWcsprm* self) {\n\n  int status = 0;\n\n  wcsprm_python2c(&self->x);\n  status = celfix(&self->x);\n  wcsprm_c2python(&self->x);\n\n  if (status == -1 || status == 0) {\n    return PyLong_FromLong((long)status);\n  } else {\n    wcserr_fix_to_python_exc(self->x.err);\n    return NULL;\n  }\n}\n\nstatic PyObject *\nPyWcsprm_compare(\n    PyWcsprm* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  int cmp = 0;\n  PyWcsprm *other;\n  double tolerance = 0.0;\n  int equal;\n  int status;\n\n  const char* keywords[] = {\"other\", \"cmp\", \"tolerance\", NULL};\n\n  if (!PyArg_ParseTupleAndKeywords(\n          args, kwds, \"O!|id:compare\", (char **)keywords,\n          &PyWcsprmType, &other, &cmp, &tolerance)) {\n    return NULL;\n  }\n\n\n  wcsprm_python2c(&self->x);\n  wcsprm_python2c(&other->x);\n  status = wcscompare(cmp, tolerance, &self->x, &other->x, &equal);\n  wcsprm_c2python(&self->x);\n  wcsprm_c2python(&other->x);\n\n  if (status) {\n    wcserr_fix_to_python_exc(self->x.err);\n    return NULL;\n  } else {\n    if (equal) {\n      Py_RETURN_TRUE;\n    } else {\n      Py_RETURN_FALSE;\n    }\n  }\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_cylfix(\n    PyWcsprm* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  PyObject*      naxis_obj   = NULL;\n  PyArrayObject* naxis_array = NULL;\n  int*           naxis       = NULL;\n  int            status      = 0;\n  const char*    keywords[]  = {\"naxis\", NULL};\n\n  if (!PyArg_ParseTupleAndKeywords(\n          args, kwds, \"|O:cylfix\", (char **)keywords,\n          &naxis_obj)) {\n    return NULL;\n  }\n\n  if (naxis_obj != NULL && naxis_obj != Py_None) {\n    naxis_array = (PyArrayObject*)PyArray_ContiguousFromAny(\n        naxis_obj, NPY_INT, 1, 1);\n    if (naxis_array == NULL) {\n      return NULL;\n    }\n    if (PyArray_DIM(naxis_array, 0) != self->x.naxis) {\n      PyErr_Format(\n          PyExc_ValueError,\n          \"naxis must be same length as the number of axes of \"\n          \"the Wcsprm object (%d).\",\n          self->x.naxis);\n      Py_DECREF(naxis_array);\n      return NULL;\n    }\n    naxis = (int*)PyArray_DATA(naxis_array);\n  }\n\n  wcsprm_python2c(&self->x);\n  status = cylfix(naxis, &self->x);\n  wcsprm_c2python(&self->x);\n\n  Py_XDECREF(naxis_array);\n\n  if (status == -1 || status == 0) {\n    return PyLong_FromLong((long)status);\n  } else {\n    wcserr_fix_to_python_exc(self->x.err);\n    return NULL;\n  }\n}\n\nstatic PyObject*\nPyWcsprm_datfix(\n    PyWcsprm* self) {\n\n  int status = 0;\n\n  wcsprm_python2c(&self->x);\n  status = datfix(&self->x);\n  wcsprm_c2python(&self->x);\n\n  if (status == -1 || status == 0) {\n    return PyLong_FromLong((long)status);\n  } else {\n    wcserr_fix_to_python_exc(self->x.err);\n    return NULL;\n  }\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_fix(\n    PyWcsprm* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  const char*    translate_units = NULL;\n  int            ctrl            = 0;\n  PyObject*      naxis_obj       = NULL;\n  PyArrayObject* naxis_array     = NULL;\n  int*           naxis           = NULL;\n  int            stat[NWCSFIX];\n  struct wcserr  err[NWCSFIX];\n  PyObject*      subresult;\n  PyObject*      result;\n  int            i               = 0;\n  int            msg_index       = 0;\n  const char*    message;\n\n  struct message_map_entry {\n    const char* name;\n    const int index;\n  };\n  const struct message_map_entry message_map[NWCSFIX] = {\n    {\"cdfix\", CDFIX},\n    {\"datfix\", DATFIX},\n#if (NWCSFIX > 6)\n    {\"obsfix\", OBSFIX},\n#endif\n    {\"unitfix\", UNITFIX},\n    {\"celfix\", CELFIX},\n    {\"spcfix\", SPCFIX},\n    {\"cylfix\", CYLFIX}\n  };\n  const char* keywords[] = {\"translate_units\", \"naxis\", NULL};\n\n  if (!PyArg_ParseTupleAndKeywords(\n          args, kwds, \"|sO:fix\", (char **)keywords,\n          &translate_units, &naxis_obj)) {\n    return NULL;\n  }\n\n  if (translate_units != NULL) {\n    if (parse_unsafe_unit_conversion_spec(translate_units, &ctrl)) {\n      return NULL;\n    }\n  }\n\n  if (naxis_obj != NULL && naxis_obj != Py_None) {\n    naxis_array = (PyArrayObject*)PyArray_ContiguousFromAny(\n        naxis_obj, NPY_INT, 1, 1);\n    if (naxis_array == NULL) {\n      return NULL;\n    }\n    if (PyArray_DIM(naxis_array, 0) != self->x.naxis) {\n      PyErr_Format(\n          PyExc_ValueError,\n          \"naxis must be same length as the number of axes of \"\n          \"the Wcprm object (%d).\",\n          self->x.naxis);\n      Py_DECREF(naxis_array);\n      return NULL;\n    }\n    naxis = (int*)PyArray_DATA(naxis_array);\n  }\n\n  memset(err, 0, sizeof(struct wcserr) * NWCSFIX);\n\n  wcsprm_python2c(&self->x);\n  wcsfixi(ctrl, naxis, &self->x, stat, err);\n  wcsprm_c2python(&self->x);\n\n  /* We're done with this already, so deref now so we don't have to remember\n     later */\n  Py_XDECREF(naxis_array);\n\n  result = PyDict_New();\n  if (result == NULL) {\n    return NULL;\n  }\n\n  for (i = 0; i < NWCSFIX; ++i) {\n    msg_index = stat[message_map[i].index];\n    message = err[message_map[i].index].msg;\n    if (message == NULL || message[0] == 0) {\n      if (msg_index == FIXERR_SUCCESS) {\n        message = \"Success\";\n      } else {\n        message = \"No change\";\n      }\n    }\n    subresult = PyUnicode_FromString(message);\n    if (subresult == NULL ||\n        PyDict_SetItemString(result, message_map[i].name, subresult)) {\n      Py_XDECREF(subresult);\n      Py_XDECREF(result);\n      return NULL;\n    }\n    Py_XDECREF(subresult);\n  }\n\n  return result;\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_cdelt_func(\n    PyWcsprm* self,\n    /*@unused@*/ PyObject* args,\n    /*@unused@*/ PyObject* kwds) {\n\n  Py_ssize_t naxis = 0;\n\n  if (is_null(self->x.cdelt)) {\n    return NULL;\n  }\n\n  if (PyWcsprm_cset(self, 1)) {\n    return NULL;\n  }\n\n  naxis = self->x.naxis;\n\n  return get_double_array_readonly(\"cdelt\", self->x.cdelt, 1, &naxis, (PyObject*)self);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_pc_func(\n    PyWcsprm* self,\n    /*@unused@*/ PyObject* args,\n    /*@unused@*/ PyObject* kwds) {\n\n  npy_intp dims[2];\n\n  if (is_null(self->x.pc)) {\n    return NULL;\n  }\n\n  if (PyWcsprm_cset(self, 1)) {\n    return NULL;\n  }\n\n  dims[0] = self->x.naxis;\n  dims[1] = self->x.naxis;\n\n  return get_double_array_readonly(\"pc\", self->x.pc, 2, dims, (PyObject*)self);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_ps(\n    PyWcsprm* self,\n    /*@unused@*/ PyObject* args,\n    /*@unused@*/ PyObject* kwds) {\n\n  return get_pscards(\"ps\", self->x.ps, self->x.nps);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_pv(\n    PyWcsprm* self,\n    /*@unused@*/ PyObject* args,\n    /*@unused@*/ PyObject* kwds) {\n\n  return get_pvcards(\"pv\", self->x.pv, self->x.npv);\n}\n\nstatic PyObject*\nPyWcsprm_has_cdi_ja(\n    PyWcsprm* self) {\n\n  int result = 0;\n\n  result = self->x.altlin & has_cd;\n\n  return PyBool_FromLong(result);\n}\n\nstatic PyObject*\nPyWcsprm_has_crotaia(\n    PyWcsprm* self) {\n\n  int result = 0;\n\n  result = self->x.altlin & has_crota;\n\n  return PyBool_FromLong(result);\n}\n\nstatic PyObject*\nPyWcsprm_has_pci_ja(\n    PyWcsprm* self) {\n\n  int result = 0;\n\n  result = (self->x.altlin == 0 || self->x.altlin & has_pc);\n\n  return PyBool_FromLong(result);\n}\n\nstatic PyObject*\nPyWcsprm_is_unity(\n    PyWcsprm* self) {\n\n  if (PyWcsprm_cset(self, 1)) {\n    return NULL;\n  }\n\n  return PyBool_FromLong(self->x.lin.unity);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_mix(\n    PyWcsprm* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  int            mixpix     = 0;\n  int            mixcel     = 0;\n  double         vspan[2]   = {0, 0};\n  double         vstep      = 0;\n  int            viter      = 0;\n  Py_ssize_t     naxis      = 0;\n  PyObject*      world_obj  = NULL;\n  PyObject*      pixcrd_obj = NULL;\n  int            origin     = 1;\n  PyArrayObject* world      = NULL;\n  PyArrayObject* phi        = NULL;\n  PyArrayObject* theta      = NULL;\n  PyArrayObject* imgcrd     = NULL;\n  PyArrayObject* pixcrd     = NULL;\n  int            status     = -1;\n  PyObject*      result     = NULL;\n  const char*    keywords[] = {\n    \"mixpix\", \"mixcel\", \"vspan\", \"vstep\", \"viter\", \"world\", \"pixcrd\", \"origin\", NULL };\n\n  if (!PyArg_ParseTupleAndKeywords(\n        args, kwds, \"ii(dd)diOOi:mix\", (char **)keywords,\n        &mixpix, &mixcel, &vspan[0], &vspan[1], &vstep, &viter, &world_obj,\n        &pixcrd_obj, &origin)) {\n    return NULL;\n  }\n\n  if (viter < 5 || viter > 10) {\n    PyErr_SetString(\n        PyExc_ValueError,\n        \"viter must be in the range 5 - 10\");\n    goto exit;\n  }\n\n  world = (PyArrayObject*)PyArray_ContiguousFromAny\n    (world_obj, NPY_DOUBLE, 1, 1);\n  if (world == NULL) {\n    PyErr_SetString(\n        PyExc_TypeError,\n        \"Argument 6 (world) must be a 1-dimensional numpy array\");\n    goto exit;\n  }\n  if ((int)PyArray_DIM(world, 0) != self->x.naxis) {\n    PyErr_Format(\n        PyExc_TypeError,\n        \"Argument 6 (world) must be the same length as the number \"\n        \"of axes (%d)\",\n        self->x.naxis);\n    goto exit;\n  }\n\n  pixcrd = (PyArrayObject*)PyArray_ContiguousFromAny\n    (pixcrd_obj, NPY_DOUBLE, 1, 1);\n  if (pixcrd == NULL) {\n    PyErr_SetString(\n        PyExc_TypeError,\n        \"Argument 7 (pixcrd) must be a 1-dimensional numpy array\");\n    goto exit;\n  }\n  if ((int)PyArray_DIM(pixcrd, 0) != self->x.naxis) {\n    PyErr_Format(\n        PyExc_TypeError,\n        \"Argument 7 (pixcrd) must be the same length as the \"\n        \"number of axes (%d)\",\n        self->x.naxis);\n    goto exit;\n  }\n\n  if (mixpix < 1 || mixpix > self->x.naxis) {\n    PyErr_SetString(\n        PyExc_ValueError,\n        \"Argument 1 (mixpix) must specify a pixel coordinate \"\n        \"axis number\");\n    goto exit;\n  }\n\n  if (mixcel < 1 || mixcel > 2) {\n    PyErr_SetString(\n        PyExc_ValueError,\n        \"Argument 2 (mixcel) must specify a celestial coordinate \"\n        \"axis number (1 for latitude, 2 for longitude)\");\n    goto exit;\n  }\n\n  /* Now we allocate a bunch of numpy arrays to store the\n   * results in.\n   */\n  naxis = (Py_ssize_t)self->x.naxis;\n  phi = (PyArrayObject*)PyArray_SimpleNew\n    (1, &naxis, NPY_DOUBLE);\n  if (phi == NULL) {\n    goto exit;\n  }\n\n  theta = (PyArrayObject*)PyArray_SimpleNew\n    (1, &naxis, NPY_DOUBLE);\n  if (theta == NULL) {\n    goto exit;\n  }\n\n  imgcrd = (PyArrayObject*)PyArray_SimpleNew\n    (1, &naxis, NPY_DOUBLE);\n  if (imgcrd == NULL) {\n    goto exit;\n  }\n\n  /* Convert pixel coordinates to 1-based */\n  Py_BEGIN_ALLOW_THREADS\n  preoffset_array(pixcrd, origin);\n  wcsprm_python2c(&self->x);\n  status = wcsmix(\n      &self->x,\n      mixpix,\n      mixcel,\n      vspan,\n      vstep,\n      viter,\n      (double*)PyArray_DATA(world),\n      (double*)PyArray_DATA(phi),\n      (double*)PyArray_DATA(theta),\n      (double*)PyArray_DATA(imgcrd),\n      (double*)PyArray_DATA(pixcrd));\n  wcsprm_c2python(&self->x);\n  unoffset_array(pixcrd, origin);\n  unoffset_array(imgcrd, origin);\n  Py_END_ALLOW_THREADS\n\n  if (status == 0) {\n    result = PyDict_New();\n    if (result == NULL ||\n        PyDict_SetItemString(result, \"imgcrd\", (PyObject*)imgcrd) ||\n        PyDict_SetItemString(result, \"phi\", (PyObject*)phi) ||\n        PyDict_SetItemString(result, \"theta\", (PyObject*)theta) ||\n        PyDict_SetItemString(result, \"world\", (PyObject*)world)) {\n      goto exit;\n    }\n  }\n\n exit:\n  Py_XDECREF(world);\n  Py_XDECREF(phi);\n  Py_XDECREF(theta);\n  Py_XDECREF(imgcrd);\n  Py_XDECREF(pixcrd);\n\n  if (status == 0) {\n    return result;\n  } else {\n    Py_XDECREF(result);\n    if (status == -1) {\n      /* The error message has already been set */\n      return NULL;\n    } else {\n      wcs_to_python_exc(&(self->x));\n      return NULL;\n    }\n  }\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_p2s(\n    PyWcsprm* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  int            naxis      = 2;\n  int            ncoord     = 0;\n  int            nelem      = 0;\n  PyObject*      pixcrd_obj = NULL;\n  int            origin     = 1;\n  PyArrayObject* pixcrd     = NULL;\n  PyArrayObject* imgcrd     = NULL;\n  PyArrayObject* phi        = NULL;\n  PyArrayObject* theta      = NULL;\n  PyArrayObject* world      = NULL;\n  PyArrayObject* stat       = NULL;\n  PyObject*      result     = NULL;\n  int            status     = 0;\n  const char*    keywords[] = {\n    \"pixcrd\", \"origin\", NULL };\n\n  if (!PyArg_ParseTupleAndKeywords(\n          args, kwds, \"Oi:p2s\", (char **)keywords,\n          &pixcrd_obj, &origin)) {\n    return NULL;\n  }\n\n  naxis = self->x.naxis;\n\n  pixcrd = (PyArrayObject*)PyArray_ContiguousFromAny\n    (pixcrd_obj, NPY_DOUBLE, 2, 2);\n  if (pixcrd == NULL) {\n    return NULL;\n  }\n\n  if (PyArray_DIM(pixcrd, 1) < naxis) {\n    PyErr_Format(\n      PyExc_RuntimeError,\n      \"Input array must be 2-dimensional, where the second dimension >= %d\",\n      naxis);\n    goto exit;\n  }\n\n  /* Now we allocate a bunch of numpy arrays to store the results in.\n   */\n  imgcrd = (PyArrayObject*)PyArray_SimpleNew(\n      2, PyArray_DIMS(pixcrd), NPY_DOUBLE);\n  if (imgcrd == NULL) {\n    goto exit;\n  }\n\n  phi = (PyArrayObject*)PyArray_SimpleNew(\n      1, PyArray_DIMS(pixcrd), NPY_DOUBLE);\n  if (phi == NULL) {\n    goto exit;\n  }\n\n  theta = (PyArrayObject*)PyArray_SimpleNew(\n      1, PyArray_DIMS(pixcrd), NPY_DOUBLE);\n  if (theta == NULL) {\n    goto exit;\n  }\n\n  world = (PyArrayObject*)PyArray_SimpleNew(\n      2, PyArray_DIMS(pixcrd), NPY_DOUBLE);\n  if (world == NULL) {\n    goto exit;\n  }\n\n  stat = (PyArrayObject*)PyArray_SimpleNew(\n      1, PyArray_DIMS(pixcrd), NPY_INT);\n  if (stat == NULL) {\n    goto exit;\n  }\n\n  /* Make the call */\n  Py_BEGIN_ALLOW_THREADS\n  ncoord = PyArray_DIM(pixcrd, 0);\n  nelem = PyArray_DIM(pixcrd, 1);\n  preoffset_array(pixcrd, origin);\n  wcsprm_python2c(&self->x);\n  status = wcsp2s(\n      &self->x,\n      ncoord,\n      nelem,\n      (double*)PyArray_DATA(pixcrd),\n      (double*)PyArray_DATA(imgcrd),\n      (double*)PyArray_DATA(phi),\n      (double*)PyArray_DATA(theta),\n      (double*)PyArray_DATA(world),\n      (int*)PyArray_DATA(stat));\n  wcsprm_c2python(&self->x);\n  unoffset_array(pixcrd, origin);\n  /* unoffset_array(world, origin); */\n  unoffset_array(imgcrd, origin);\n  if (status == 8) {\n    set_invalid_to_nan(\n        ncoord, nelem, (double*)PyArray_DATA(imgcrd), (int*)PyArray_DATA(stat));\n    set_invalid_to_nan(\n        ncoord, 1, (double*)PyArray_DATA(phi), (int*)PyArray_DATA(stat));\n    set_invalid_to_nan(\n        ncoord, 1, (double*)PyArray_DATA(theta), (int*)PyArray_DATA(stat));\n    set_invalid_to_nan(\n        ncoord, nelem, (double*)PyArray_DATA(world), (int*)PyArray_DATA(stat));\n  }\n  Py_END_ALLOW_THREADS\n\n  if (status == 0 || status == 8) {\n    result = PyDict_New();\n    if (result == NULL ||\n        PyDict_SetItemString(result, \"imgcrd\", (PyObject*)imgcrd) ||\n        PyDict_SetItemString(result, \"phi\", (PyObject*)phi) ||\n        PyDict_SetItemString(result, \"theta\", (PyObject*)theta) ||\n        PyDict_SetItemString(result, \"world\", (PyObject*)world) ||\n        PyDict_SetItemString(result, \"stat\", (PyObject*)stat)) {\n      goto exit;\n    }\n  }\n\n exit:\n  Py_XDECREF(pixcrd);\n  Py_XDECREF(imgcrd);\n  Py_XDECREF(phi);\n  Py_XDECREF(theta);\n  Py_XDECREF(world);\n  Py_XDECREF(stat);\n\n  if (status == 0 || status == 8) {\n    return result;\n  } else {\n    Py_XDECREF(result);\n    if (status == -1) {\n      /* Exception already set */\n      return NULL;\n    } else {\n      wcs_to_python_exc(&(self->x));\n      return NULL;\n    }\n  }\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_s2p(\n    PyWcsprm* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  int            naxis     = 2;\n  int            ncoord    = 0;\n  int            nelem     = 0;\n  PyObject*      world_obj = NULL;\n  int            origin    = 1;\n  PyArrayObject* world     = NULL;\n  PyArrayObject* phi       = NULL;\n  PyArrayObject* theta     = NULL;\n  PyArrayObject* imgcrd    = NULL;\n  PyArrayObject* pixcrd    = NULL;\n  PyArrayObject* stat      = NULL;\n  PyObject*      result    = NULL;\n  int            status    = -1;\n  const char*    keywords[] = {\n    \"world\", \"origin\", NULL };\n\n  if (!PyArg_ParseTupleAndKeywords(\n          args, kwds, \"Oi:s2p\", (char **)keywords,\n          &world_obj, &origin)) {\n    return NULL;\n  }\n\n  naxis = self->x.naxis;\n\n  world = (PyArrayObject*)PyArray_ContiguousFromAny(\n      world_obj, NPY_DOUBLE, 2, 2);\n  if (world == NULL) {\n    return NULL;\n  }\n\n  if (PyArray_DIM(world, 1) < naxis) {\n    PyErr_Format(\n      PyExc_RuntimeError,\n      \"Input array must be 2-dimensional, where the second dimension >= %d\",\n      naxis);\n    goto exit;\n  }\n\n  /* Now we allocate a bunch of numpy arrays to store the\n   * results in.\n   */\n  phi = (PyArrayObject*)PyArray_SimpleNew(\n      1, PyArray_DIMS(world), NPY_DOUBLE);\n  if (phi == NULL) {\n    goto exit;\n  }\n\n  theta = (PyArrayObject*)PyArray_SimpleNew(\n      1, PyArray_DIMS(world), NPY_DOUBLE);\n  if (phi == NULL) {\n    goto exit;\n  }\n\n  imgcrd = (PyArrayObject*)PyArray_SimpleNew(\n      2, PyArray_DIMS(world), NPY_DOUBLE);\n  if (theta == NULL) {\n    goto exit;\n  }\n\n  pixcrd = (PyArrayObject*)PyArray_SimpleNew(\n      2, PyArray_DIMS(world), NPY_DOUBLE);\n  if (pixcrd == NULL) {\n    goto exit;\n  }\n\n  stat = (PyArrayObject*)PyArray_SimpleNew(\n      1, PyArray_DIMS(world), NPY_INT);\n  if (stat == NULL) {\n    goto exit;\n  }\n\n  /* Make the call */\n  Py_BEGIN_ALLOW_THREADS\n  ncoord = (int)PyArray_DIM(world, 0);\n  nelem = (int)PyArray_DIM(world, 1);\n  /* preoffset_array(world, origin); */\n  wcsprm_python2c(&self->x);\n  status = wcss2p(\n      &self->x,\n      ncoord,\n      nelem,\n      (double*)PyArray_DATA(world),\n      (double*)PyArray_DATA(phi),\n      (double*)PyArray_DATA(theta),\n      (double*)PyArray_DATA(imgcrd),\n      (double*)PyArray_DATA(pixcrd),\n      (int*)PyArray_DATA(stat));\n  wcsprm_c2python(&self->x);\n  /* unoffset_array(world, origin); */\n  unoffset_array(pixcrd, origin);\n  unoffset_array(imgcrd, origin);\n  if (status == 9) {\n    set_invalid_to_nan(\n        ncoord, 1, (double*)PyArray_DATA(phi), (int*)PyArray_DATA(stat));\n    set_invalid_to_nan(\n        ncoord, 1, (double*)PyArray_DATA(theta), (int*)PyArray_DATA(stat));\n    set_invalid_to_nan(\n        ncoord, nelem, (double*)PyArray_DATA(imgcrd), (int*)PyArray_DATA(stat));\n    set_invalid_to_nan(\n        ncoord, nelem, (double*)PyArray_DATA(pixcrd), (int*)PyArray_DATA(stat));\n  }\n  Py_END_ALLOW_THREADS\n\n  if (status == 0 || status == 9) {\n    result = PyDict_New();\n    if (result == NULL ||\n        PyDict_SetItemString(result, \"phi\", (PyObject*)phi) ||\n        PyDict_SetItemString(result, \"theta\", (PyObject*)theta) ||\n        PyDict_SetItemString(result, \"imgcrd\", (PyObject*)imgcrd) ||\n        PyDict_SetItemString(result, \"pixcrd\", (PyObject*)pixcrd) ||\n        PyDict_SetItemString(result, \"stat\", (PyObject*)stat)) {\n      goto exit;\n    }\n  }\n\n exit:\n  Py_XDECREF(pixcrd);\n  Py_XDECREF(imgcrd);\n  Py_XDECREF(phi);\n  Py_XDECREF(theta);\n  Py_XDECREF(world);\n  Py_XDECREF(stat);\n\n  if (status == 0 || status == 9) {\n    return result;\n  } else {\n    Py_XDECREF(result);\n    if (status == -1) {\n      /* Exception already set */\n      return NULL;\n    } else {\n      wcs_to_python_exc(&(self->x));\n      return NULL;\n    }\n  }\n}\n\nstatic int\nPyWcsprm_cset(\n    PyWcsprm* self,\n    const int convert) {\n\n  int status = 0;\n\n  if (convert) wcsprm_python2c(&self->x);\n  status = wcsset(&self->x);\n  if (convert) wcsprm_c2python(&self->x);\n\n  if (status == 0) {\n    return 0;\n  } else {\n    wcs_to_python_exc(&(self->x));\n    return 1;\n  }\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_set(\n    PyWcsprm* self) {\n\n  if (PyWcsprm_cset(self, 1)) {\n    return NULL;\n  }\n\n  Py_INCREF(Py_None);\n  return Py_None;\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_set_ps(\n    PyWcsprm* self,\n    PyObject* arg,\n    /*@unused@*/ PyObject* kwds) {\n\n  if (is_null(self->x.ps)) {\n    return NULL;\n  }\n\n  if (set_pscards(\"ps\", arg, &self->x.ps, &self->x.nps, &self->x.npsmax)) {\n    self->x.m_ps = self->x.ps;\n    return NULL;\n  }\n  self->x.m_ps = self->x.ps;\n\n  note_change(self);\n\n  Py_INCREF(Py_None);\n  return Py_None;\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_set_pv(\n    PyWcsprm* self,\n    PyObject* arg,\n    /*@unused@*/ PyObject* kwds) {\n\n  if (is_null(self->x.pv)) {\n    return NULL;\n  } else if (set_pvcards(\"pv\", arg, &self->x.pv, &self->x.npv, &self->x.npvmax)) {\n    return NULL;\n  } else {\n    self->x.m_pv = self->x.pv;\n    note_change(self);\n    Py_INCREF(Py_None);\n    return Py_None;\n  }\n}\n\n/* TODO: This is convenient for debugging for now -- but it's not very\n * Pythonic.  It should probably be hooked into __str__ or something.\n */\n/*@null@*/ static PyObject*\nPyWcsprm_print_contents(\n    PyWcsprm* self) {\n\n  /* This is not thread-safe, but since we're holding onto the GIL,\n     we can assume we won't have thread conflicts */\n  wcsprintf_set(NULL);\n\n  wcsprm_python2c(&self->x);\n  if (PyWcsprm_cset(self, 0)) {\n    wcsprm_c2python(&self->x);\n    return NULL;\n  }\n  wcsprt(&self->x);\n  wcsprm_c2python(&self->x);\n\n  printf(\"%s\", wcsprintf_buf());\n\n  Py_INCREF(Py_None);\n  return Py_None;\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_spcfix(\n    PyWcsprm* self) {\n\n  int status = 0;\n\n  wcsprm_python2c(&self->x);\n  status = spcfix(&self->x);\n  wcsprm_c2python(&self->x);\n\n  if (status == -1 || status == 0) {\n    return PyLong_FromLong((long)status);\n  } else {\n    wcserr_fix_to_python_exc(self->x.err);\n    return NULL;\n  }\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_sptr(\n    PyWcsprm* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  int         i          = -1;\n  const char* py_ctype   = NULL;\n  char        ctype[9];\n  int         status     = 0;\n  const char* keywords[] = {\"ctype\", \"i\", NULL};\n\n  if (!PyArg_ParseTupleAndKeywords(\n          args, kwds, \"s|i:sptr\", (char **)keywords,\n          &py_ctype, &i)) {\n    return NULL;\n  }\n\n  if (strlen(py_ctype) > 8) {\n    PyErr_SetString(\n        PyExc_ValueError,\n        \"ctype string has more than 8 characters.\");\n  }\n\n  strncpy(ctype, py_ctype, 9);\n\n  wcsprm_python2c(&self->x);\n  status = wcssptr(&self->x, &i, ctype);\n  wcsprm_c2python(&self->x);\n\n  if (status == 0) {\n    Py_INCREF(Py_None);\n    return Py_None;\n  } else {\n    wcs_to_python_exc(&(self->x));\n    return NULL;\n  }\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm___str__(\n    PyWcsprm* self) {\n\n  /* This is not thread-safe, but since we're holding onto the GIL,\n     we can assume we won't have thread conflicts */\n  wcsprintf_set(NULL);\n\n  wcsprm_python2c(&self->x);\n  if (PyWcsprm_cset(self, 0)) {\n    wcsprm_c2python(&self->x);\n    return NULL;\n  }\n  wcsprt(&self->x);\n  wcsprm_c2python(&self->x);\n\n  return PyUnicode_FromString(wcsprintf_buf());\n}\n\nPyObject *PyWcsprm_richcompare(PyObject *a, PyObject *b, int op) {\n  int equal;\n  int status;\n\n  struct wcsprm *ax;\n  struct wcsprm *bx;\n\n  if ((op == Py_EQ || op == Py_NE) &&\n      PyObject_TypeCheck(b, &PyWcsprmType)) {\n    ax = &((PyWcsprm *)a)->x;\n    bx = &((PyWcsprm *)b)->x;\n\n    wcsprm_python2c(ax);\n    wcsprm_python2c(bx);\n    status = wcscompare(\n        WCSCOMPARE_ANCILLARY, 0.0,\n        ax, bx, &equal);\n    wcsprm_c2python(ax);\n    wcsprm_c2python(bx);\n\n    if (status == 0) {\n      if (op == Py_NE) {\n        equal = !equal;\n      }\n      if (equal) {\n        Py_RETURN_TRUE;\n      } else {\n        Py_RETURN_FALSE;\n      }\n    } else {\n      wcs_to_python_exc(&(((PyWcsprm *)a)->x));\n      return NULL;\n    }\n  }\n\n  Py_INCREF(Py_NotImplemented);\n  return Py_NotImplemented;\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_sub(\n    PyWcsprm* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  int        i              = -1;\n  Py_ssize_t tmp            = 0;\n  PyObject*  py_axes        = NULL;\n  PyWcsprm*  py_dest_wcs    = NULL;\n  PyObject*  element        = NULL;\n  PyObject*  element_utf8   = NULL;\n  char*      element_str    = NULL;\n  int        element_val    = 0;\n  int        nsub           = 0;\n  int*       axes           = NULL;\n  int        status         = -1;\n  const char*    keywords[] = {\"axes\", NULL};\n\n  if (!PyArg_ParseTupleAndKeywords(\n          args, kwds, \"|O:sub\", (char **)keywords,\n          &py_axes)) {\n    goto exit;\n  }\n\n  if (py_axes == NULL || py_axes == Py_None) {\n    /* leave all variables as is */\n  } else if (PyList_Check(py_axes) || PyTuple_Check(py_axes)) {\n    tmp = PySequence_Size(py_axes);\n    if (tmp == -1) {\n      goto exit;\n    }\n    nsub = (int)tmp;\n\n    axes = malloc(nsub * sizeof(int) * 2);\n    if (axes == NULL) {\n      PyErr_SetString(PyExc_MemoryError, \"Out of memory\");\n      goto exit;\n    }\n\n    for (i = 0; i < nsub; ++i) {\n      element = PySequence_GetItem(py_axes, i);\n      if (element == NULL) {\n        goto exit;\n      }\n\n      if (PyUnicode_Check(element) || PyBytes_Check(element)) {\n        if (PyUnicode_Check(element)) {\n          element_utf8 = PyUnicode_AsUTF8String(element);\n          if (element_utf8 == NULL) {\n            goto exit;\n          }\n\n          element_str = PyBytes_AsString(element_utf8);\n        } else if (PyBytes_Check(element)) {\n          element_str = PyBytes_AsString(element);\n        }\n\n        if (strncmp(element_str, \"longitude\", 10) == 0) {\n          element_val = WCSSUB_LONGITUDE;\n        } else if (strncmp(element_str, \"latitude\", 9) == 0) {\n          element_val = WCSSUB_LATITUDE;\n        } else if (strncmp(element_str, \"cubeface\", 9) == 0) {\n          element_val = WCSSUB_CUBEFACE;\n        } else if (strncmp(element_str, \"spectral\", 9) == 0) {\n          element_val = WCSSUB_SPECTRAL;\n        } else if (strncmp(element_str, \"stokes\", 7) == 0) {\n          element_val = WCSSUB_STOKES;\n        } else if (strncmp(element_str, \"celestial\", 10) == 0) {\n          element_val = WCSSUB_CELESTIAL;\n        } else {\n          PyErr_SetString(\n            PyExc_ValueError,\n            \"string values for axis sequence must be one of 'latitude', 'longitude', 'cubeface', 'spectral', 'stokes', or 'celestial'\");\n          goto exit;\n        }\n        Py_CLEAR(element_utf8);\n      } else if (PyLong_Check(element)) {\n        tmp = (Py_ssize_t)PyLong_AsSsize_t(element);\n        if (tmp == -1 && PyErr_Occurred()) {\n          goto exit;\n        }\n        element_val = (int)tmp;\n      } else {\n        PyErr_SetString(\n          PyExc_TypeError,\n          \"axes sequence must contain either strings or ints\");\n        goto exit;\n      }\n\n      axes[i] = element_val;\n\n      Py_CLEAR(element);\n    }\n  } else if (PyLong_Check(py_axes)) {\n    tmp = (Py_ssize_t)PyLong_AsSsize_t(py_axes);\n    if (tmp == -1 && PyErr_Occurred()) {\n      goto exit;\n    }\n    nsub = (int)tmp;\n\n    if (nsub < 0 || nsub > self->x.naxis) {\n      PyErr_Format(\n        PyExc_ValueError,\n        \"If axes is an int, it must be in the range 0-self.naxis (%d)\",\n        self->x.naxis);\n      goto exit;\n    }\n  } else {\n    PyErr_SetString(\n      PyExc_TypeError,\n      \"axes must None, a sequence or an integer\");\n    goto exit;\n  }\n\n  py_dest_wcs = (PyWcsprm*)PyWcsprm_cnew();\n  py_dest_wcs->x.flag = -1;\n  status = wcsini(0, nsub, &py_dest_wcs->x);\n  if (status != 0) {\n    goto exit;\n  }\n\n  wcsprm_python2c(&self->x);\n  status = wcssub(1, &self->x, &nsub, axes, &py_dest_wcs->x);\n  wcsprm_c2python(&self->x);\n  if (PyWcsprm_cset(py_dest_wcs, 0)) {\n    status = -1;\n    goto exit;\n  }\n  wcsprm_c2python(&py_dest_wcs->x);\n\n  if (status != 0) {\n    goto exit;\n  }\n\n exit:\n  free(axes);\n  Py_XDECREF(element);\n  Py_XDECREF(element_utf8);\n\n  if (status == 0) {\n    return (PyObject*)py_dest_wcs;\n  } else if (status == -1) {\n    Py_XDECREF(py_dest_wcs);\n    /* Exception already set */\n    return NULL;\n  } else {\n    wcs_to_python_exc(&(py_dest_wcs->x));\n    Py_XDECREF(py_dest_wcs);\n    return NULL;\n  }\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_to_header(\n    PyWcsprm* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  PyObject* relax_obj    = NULL;\n  int       relax        = 0;\n  int       nkeyrec      = 0;\n  char*     header       = NULL;\n  int       status       = -1;\n  PyObject* result       = NULL;\n  const char* keywords[] = {\"relax\", NULL};\n\n  if (!PyArg_ParseTupleAndKeywords(\n          args, kwds, \"|O:to_header\",\n          (char **)keywords, &relax_obj)) {\n    goto exit;\n  }\n\n  if (relax_obj == Py_True) {\n    relax = WCSHDO_all;\n  } else if (relax_obj == NULL || relax_obj == Py_False) {\n    relax = WCSHDO_safe;\n  } else {\n    relax = (int)PyLong_AsLong(relax_obj);\n    if (relax == -1) {\n      PyErr_SetString(\n          PyExc_ValueError,\n          \"relax must be True, False or an integer.\");\n      return NULL;\n    }\n  }\n\n  wcsprm_python2c(&self->x);\n  status = wcshdo(relax, &self->x, &nkeyrec, &header);\n  wcsprm_c2python(&self->x);\n\n  if (status != 0) {\n    wcs_to_python_exc(&(self->x));\n    goto exit;\n  }\n\n  /* Just return the raw header string.  astropy.io.fits on the Python side will\n     help to parse and use this information. */\n  result = PyUnicode_FromStringAndSize(header, (Py_ssize_t)nkeyrec * 80);\n\n exit:\n  free(header);\n  return result;\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_unitfix(\n    PyWcsprm* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n  const char* translate_units = NULL;\n  int         ctrl            = 0;\n  int         status          = 0;\n  const char* keywords[]      = {\"translate_units\", NULL};\n\n  if (!PyArg_ParseTupleAndKeywords(\n          args, kwds, \"|s:unitfix\", (char **)keywords,\n          &translate_units)) {\n    return NULL;\n  }\n\n  if (translate_units != NULL) {\n    if (parse_unsafe_unit_conversion_spec(translate_units, &ctrl)) {\n      return NULL;\n    }\n  }\n\n  status = unitfix(ctrl, &self->x);\n\n  if (status == -1 || status == 0) {\n    return PyLong_FromLong((long)status);\n  } else {\n    wcserr_fix_to_python_exc(self->x.err);\n    return NULL;\n  }\n}\n\n\n/***************************************************************************\n * Member getters/setters (properties)\n */\n/*@null@*/ static PyObject*\nPyWcsprm_get_alt(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.alt)) {\n    return NULL;\n  }\n\n  /* Force a null-termination of this single-character string */\n  self->x.alt[1] = '\\0';\n  return get_string(\"alt\", self->x.alt);\n}\n\nstatic int\nPyWcsprm_set_alt(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  char value_string[2];\n\n  if (is_null(self->x.alt)) {\n    return -1;\n  }\n\n  if (value == NULL) { /* deletion */\n    self->x.alt[0] = ' ';\n    self->x.alt[1] = '\\0';\n    note_change(self);\n    return 0;\n  }\n\n  if (set_string(\"alt\", value, value_string, 2)) {\n    return -1;\n  }\n\n  if (!is_valid_alt_key(value_string)) {\n    return -1;\n  }\n\n  strncpy(self->x.alt, value_string, 2);\n\n  return 0;\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_axis_types(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t naxis = 0;\n\n  if (is_null(self->x.types)) {\n    return NULL;\n  }\n\n  if (PyWcsprm_cset(self, 1)) {\n    return NULL;\n  }\n\n  naxis = (Py_ssize_t)self->x.naxis;\n\n  return get_int_array(\"axis_types\", self->x.types, 1, &naxis, (PyObject*)self);\n}\n\nstatic PyObject*\nPyWcsprm_get_bepoch(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"bepoch\", self->x.bepoch);\n}\n\nstatic int\nPyWcsprm_set_bepoch(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) {\n    self->x.bepoch = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"bepoch\", value, &self->x.bepoch);\n}\n\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_cd(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  npy_intp dims[2];\n\n  if (is_null(self->x.cd)) {\n    return NULL;\n  }\n\n  if ((self->x.altlin & has_cd) == 0) {\n    PyErr_SetString(PyExc_AttributeError, \"No cd is present.\");\n    return NULL;\n  }\n\n  dims[0] = self->x.naxis;\n  dims[1] = self->x.naxis;\n\n  return get_double_array(\"cd\", self->x.cd, 2, dims, (PyObject*)self);\n}\n\nstatic int\nPyWcsprm_set_cd(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp dims[2];\n\n  if (is_null(self->x.cd)) {\n    return -1;\n  }\n\n\n  if (value == NULL) {\n    self->x.altlin &= ~has_cd;\n    note_change(self);\n    return 0;\n  }\n\n  dims[0] = self->x.naxis;\n  dims[1] = self->x.naxis;\n\n  if (set_double_array(\"cd\", value, 2, dims, self->x.cd)) {\n    return -1;\n  }\n\n  self->x.altlin |= has_cd;\n\n  note_change(self);\n\n  return 0;\n}\n\n /*@null@*/ static PyObject*\nPyWcsprm_get_cdelt(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t naxis = 0;\n\n  if (is_null(self->x.cdelt)) {\n    return NULL;\n  }\n\n  naxis = self->x.naxis;\n\n  if (self->x.altlin & has_cd) {\n    PyErr_WarnEx(NULL, \"cdelt will be ignored since cd is present\", 1);\n  }\n\n  return get_double_array(\"cdelt\", self->x.cdelt, 1, &naxis, (PyObject*)self);\n}\n\n/*@null@*/ static int\nPyWcsprm_set_cdelt(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp dims;\n\n  if (is_null(self->x.cdelt)) {\n    return -1;\n  }\n\n  dims = (npy_int)self->x.naxis;\n\n  if (self->x.altlin & has_cd) {\n    PyErr_WarnEx(NULL, \"cdelt will be ignored since cd is present\", 1);\n  }\n\n  note_change(self);\n\n  return set_double_array(\"cdelt\", value, 1, &dims, self->x.cdelt);\n}\n\nstatic PyObject*\nPyWcsprm_get_cel_offset(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_bool(\"cel_offset\", self->x.cel.offset);\n}\n\nstatic int\nPyWcsprm_set_cel_offset(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  note_change(self);\n\n  return set_bool(\"cel_offset\", value, &self->x.cel.offset);\n}\n\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_cname(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.cname)) {\n    return NULL;\n  }\n\n  return get_str_list(\"cname\", self->x.cname, (Py_ssize_t)self->x.naxis, 68, (PyObject*)self);\n}\n\n/*@null@*/ static int\nPyWcsprm_set_cname(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n  if (is_null(self->x.cname)) {\n    return -1;\n  }\n\n  return set_str_list(\"cname\", value, (Py_ssize_t)self->x.naxis, 0, self->x.cname);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_colax(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t naxis = 0;\n\n  if (is_null(self->x.colax)) {\n    return NULL;\n  }\n\n  naxis = (Py_ssize_t)self->x.naxis;\n\n  return get_int_array(\"colax\", self->x.colax, 1, &naxis, (PyObject*)self);\n}\n\nstatic int\nPyWcsprm_set_colax(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp naxis = 0;\n\n  if (is_null(self->x.colax)) {\n    return -1;\n  }\n\n  naxis = (Py_ssize_t)self->x.naxis;\n\n  return set_int_array(\"colax\", value, 1, &naxis, self->x.colax);\n}\n\nstatic PyObject*\nPyWcsprm_get_colnum(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_int(\"colnum\", self->x.colnum);\n}\n\nstatic int\nPyWcsprm_set_colnum(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  return set_int(\"colnum\", value, &self->x.colnum);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_crder(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t naxis = 0;\n\n  if (is_null(self->x.crder)) {\n    return NULL;\n  }\n\n  naxis = (Py_ssize_t)self->x.naxis;\n\n  return get_double_array(\"crder\", self->x.crder, 1, &naxis, (PyObject*)self);\n}\n\nstatic int\nPyWcsprm_set_crder(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp naxis = 0;\n\n  if (is_null(self->x.crder)) {\n    return -1;\n  }\n\n  naxis = (Py_ssize_t)self->x.naxis;\n\n  return set_double_array(\"crder\", value, 1, &naxis, self->x.crder);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_crota(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t naxis = 0;\n\n  if (is_null(self->x.crota)) {\n    return NULL;\n  }\n\n  if ((self->x.altlin & has_crota) == 0) {\n    PyErr_SetString(PyExc_AttributeError, \"No crota is present.\");\n    return NULL;\n  }\n\n  naxis = (Py_ssize_t)self->x.naxis;\n\n  return get_double_array(\"crota\", self->x.crota, 1, &naxis, (PyObject*)self);\n}\n\nstatic int\nPyWcsprm_set_crota(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp naxis = 0;\n\n  if (is_null(self->x.crota)) {\n    return -1;\n  }\n\n  if (value == NULL) { /* Deletion */\n    self->x.altlin &= ~has_crota;\n    note_change(self);\n    return 0;\n  }\n\n  naxis = (Py_ssize_t)self->x.naxis;\n\n  if (set_double_array(\"crota\", value, 1, &naxis, self->x.crota)) {\n    return -1;\n  }\n\n  self->x.altlin |= has_crota;\n\n  note_change(self);\n\n  return 0;\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_crpix(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t naxis = 0;\n\n  if (is_null(self->x.crpix)) {\n    return NULL;\n  }\n\n  naxis = (Py_ssize_t)self->x.naxis;\n\n  return get_double_array(\"crpix\", self->x.crpix, 1, &naxis, (PyObject*)self);\n}\n\nstatic int\nPyWcsprm_set_crpix(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp naxis = 0;\n\n  if (is_null(self->x.crpix)) {\n    return -1;\n  }\n\n  naxis = (Py_ssize_t)self->x.naxis;\n\n  note_change(self);\n\n  return set_double_array(\"crpix\", value, 1, &naxis, self->x.crpix);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_crval(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t naxis = 0;\n\n  if (is_null(self->x.crval)) {\n    return NULL;\n  }\n\n  naxis = (Py_ssize_t)self->x.naxis;\n\n  return get_double_array(\"crval\", self->x.crval, 1, &naxis, (PyObject*)self);\n}\n\nstatic int\nPyWcsprm_set_crval(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp naxis;\n\n  if (is_null(self->x.crval)) {\n    return -1;\n  }\n\n  naxis = (Py_ssize_t)self->x.naxis;\n\n  note_change(self);\n\n  return set_double_array(\"crval\", value, 1, &naxis, self->x.crval);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_csyer(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t naxis;\n\n  if (is_null(self->x.csyer)) {\n    return NULL;\n  }\n\n  naxis = (Py_ssize_t)self->x.naxis;\n\n  return get_double_array(\"csyer\", self->x.csyer, 1, &naxis, (PyObject*)self);\n}\n\nstatic int\nPyWcsprm_set_csyer(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp naxis;\n\n  if (is_null(self->x.csyer)) {\n    return -1;\n  }\n\n  naxis = (Py_ssize_t)self->x.naxis;\n\n  return set_double_array(\"csyer\", value, 1, &naxis, self->x.csyer);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_ctype(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.ctype)) {\n    return NULL;\n  }\n\n  return get_str_list(\"ctype\", self->x.ctype, self->x.naxis, 68, (PyObject*)self);\n}\n\nstatic int\nPyWcsprm_set_ctype(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.ctype)) {\n    return -1;\n  }\n\n  note_change(self);\n\n  return set_str_list(\"ctype\", value, (Py_ssize_t)self->x.naxis, 0, self->x.ctype);\n}\n\nstatic PyObject*\nPyWcsprm_get_cubeface(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_int(\"cubeface\", self->x.cubeface);\n}\n\nstatic int\nPyWcsprm_set_cubeface(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  note_change(self);\n\n  return set_int(\"cubeface\", value, &self->x.cubeface);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_cunit(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.cunit)) {\n    return NULL;\n  }\n\n  return get_unit_list(\n    \"cunit\", self->x.cunit, (Py_ssize_t)self->x.naxis, (PyObject*)self);\n}\n\nstatic int\nPyWcsprm_set_cunit(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.cunit)) {\n    return -1;\n  }\n\n  note_change(self);\n\n  return set_unit_list(\n    (PyObject *)self, \"cunit\", value, (Py_ssize_t)self->x.naxis, self->x.cunit);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_czphs(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t naxis;\n\n  if (is_null(self->x.czphs)) {\n    return NULL;\n  }\n\n  naxis = (Py_ssize_t)self->x.naxis;\n\n  return get_double_array(\"czphs\", self->x.czphs, 1, &naxis, (PyObject*)self);\n}\n\nstatic int\nPyWcsprm_set_czphs(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp naxis;\n\n  if (is_null(self->x.czphs)) {\n    return -1;\n  }\n\n  naxis = (Py_ssize_t)self->x.naxis;\n\n  return set_double_array(\"czphs\", value, 1, &naxis, self->x.czphs);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_cperi(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t naxis;\n\n  if (is_null(self->x.cperi)) {\n    return NULL;\n  }\n\n  naxis = (Py_ssize_t)self->x.naxis;\n\n  return get_double_array(\"cperi\", self->x.cperi, 1, &naxis, (PyObject*)self);\n}\n\nstatic int\nPyWcsprm_set_cperi(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp naxis;\n\n  if (is_null(self->x.cperi)) {\n    return -1;\n  }\n\n  naxis = (Py_ssize_t)self->x.naxis;\n\n  return set_double_array(\"cperi\", value, 1, &naxis, self->x.cperi);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_dateavg(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.dateavg)) {\n    return NULL;\n  }\n\n  return get_string(\"dateavg\", self->x.dateavg);\n}\n\nstatic int\nPyWcsprm_set_dateavg(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.dateavg)) {\n    return -1;\n  }\n\n  /* TODO: Verify that this looks like a date string */\n\n  return set_string(\"dateavg\", value, self->x.dateavg, 72);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_datebeg(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.datebeg)) {\n    return NULL;\n  }\n\n  return get_string(\"datebeg\", self->x.datebeg);\n}\n\nstatic int\nPyWcsprm_set_datebeg(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.datebeg)) {\n    return -1;\n  }\n\n  return set_string(\"datebeg\", value, self->x.datebeg, 72);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_dateend(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.dateend)) {\n    return NULL;\n  }\n\n  return get_string(\"dateend\", self->x.dateend);\n}\n\nstatic int\nPyWcsprm_set_dateend(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.dateend)) {\n    return -1;\n  }\n\n  return set_string(\"dateend\", value, self->x.dateend, 72);\n}\n\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_dateobs(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.dateobs)) {\n    return NULL;\n  }\n\n  return get_string(\"dateobs\", self->x.dateobs);\n}\n\nstatic int\nPyWcsprm_set_dateobs(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.dateobs)) {\n    return -1;\n  }\n\n  return set_string(\"dateobs\", value, self->x.dateobs, 72);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_dateref(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.dateref)) {\n    return NULL;\n  }\n\n  return get_string(\"dateref\", self->x.dateref);\n}\n\nstatic int\nPyWcsprm_set_dateref(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.dateref)) {\n    return -1;\n  }\n\n  return set_string(\"dateref\", value, self->x.dateref, 72);\n}\n\nstatic PyObject*\nPyWcsprm_get_equinox(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"equinox\", self->x.equinox);\n}\n\nstatic int\nPyWcsprm_set_equinox(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) { /* deletion */\n    self->x.equinox = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"equinox\", value, &self->x.equinox);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_imgpix_matrix(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  npy_intp dims[2];\n\n  if (is_null(self->x.lin.imgpix)) {\n    return NULL;\n  }\n\n  if (PyWcsprm_cset(self, 1)) {\n    return NULL;\n  }\n\n  dims[0] = self->x.naxis;\n  dims[1] = self->x.naxis;\n\n  return get_double_array(\"imgpix_matrix\", self->x.lin.imgpix, 2, dims,\n                          (PyObject*)self);\n}\n\nstatic PyObject*\nPyWcsprm_get_jepoch(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"jepoch\", self->x.jepoch);\n}\n\nstatic int\nPyWcsprm_set_jepoch(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  note_change(self);\n\n  if (value == NULL) {\n    self->x.jepoch = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"jepoch\", value, &self->x.jepoch);\n}\n\n\nstatic PyObject*\nPyWcsprm_get_lat(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (PyWcsprm_cset(self, 1)) {\n    return NULL;\n  }\n\n  return get_int(\"lat\", self->x.lat);\n}\n\nstatic PyObject*\nPyWcsprm_get_latpole(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"latpole\", self->x.latpole);\n}\n\nstatic int\nPyWcsprm_set_latpole(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  note_change(self);\n\n  if (value == NULL) {\n    self->x.latpole = 90.0;\n    return 0;\n  }\n\n  return set_double(\"latpole\", value, &self->x.latpole);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_lattyp(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.lattyp)) {\n    return NULL;\n  }\n\n  if (PyWcsprm_cset(self, 1)) {\n    return NULL;\n  }\n\n  return get_string(\"lattyp\", self->x.lattyp);\n}\n\nstatic PyObject*\nPyWcsprm_get_lng(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (PyWcsprm_cset(self, 1)) {\n    return NULL;\n  }\n\n  return get_int(\"lng\", self->x.lng);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_lngtyp(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.lngtyp)) {\n    return NULL;\n  }\n\n  if (PyWcsprm_cset(self, 1)) {\n    return NULL;\n  }\n\n  return get_string(\"lngtyp\", self->x.lngtyp);\n}\n\nstatic PyObject*\nPyWcsprm_get_lonpole(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"lonpole\", self->x.lonpole);\n}\n\nstatic int\nPyWcsprm_set_lonpole(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  note_change(self);\n\n  if (value == NULL) {\n    self->x.lonpole = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"lonpole\", value, &self->x.lonpole);\n}\n\nstatic PyObject*\nPyWcsprm_get_mjdavg(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"mjdavg\", self->x.mjdavg);\n}\n\nstatic int\nPyWcsprm_set_mjdavg(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) {\n    self->x.mjdavg = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"mjdavg\", value, &self->x.mjdavg);\n}\n\nstatic PyObject*\nPyWcsprm_get_mjdbeg(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"mjdbeg\", self->x.mjdbeg);\n}\n\nstatic int\nPyWcsprm_set_mjdbeg(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) {\n    self->x.mjdbeg = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"mjdbeg\", value, &self->x.mjdbeg);\n}\n\nstatic PyObject*\nPyWcsprm_get_mjdend(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"mjdend\", self->x.mjdend);\n}\n\nstatic int\nPyWcsprm_set_mjdend(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) {\n    self->x.mjdend = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"mjdend\", value, &self->x.mjdend);\n}\n\nstatic PyObject*\nPyWcsprm_get_mjdobs(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"mjdobs\", self->x.mjdobs);\n}\n\nstatic int\nPyWcsprm_set_mjdobs(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  note_change(self);\n\n  if (value == NULL) {\n    self->x.mjdobs = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"mjdobs\", value, &self->x.mjdobs);\n}\n\nstatic PyObject*\nPyWcsprm_get_mjdref(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  npy_intp size = 2;\n\n  return get_double_array(\"mjdref\", self->x.mjdref, 1, &size, (PyObject*)self);\n}\n\nstatic int\nPyWcsprm_set_mjdref(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp size = 2;\n\n  if (value == NULL) {\n    self->x.mjdref[0] = NPY_NAN;\n    self->x.mjdref[1] = NPY_NAN;\n    return 0;\n  }\n  return set_double_array(\"mjdref\", value, 1, &size, self->x.mjdref);\n}\n\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_timesys(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.timesys)) {\n    return NULL;\n  }\n\n  return get_string(\"timesys\", self->x.timesys);\n}\n\nstatic int\nPyWcsprm_set_timesys(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.timesys)) {\n    return -1;\n  }\n\n  return set_string(\"timesys\", value, self->x.timesys, 72);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_trefpos(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.trefpos)) {\n    return NULL;\n  }\n\n  return get_string(\"trefpos\", self->x.trefpos);\n}\n\nstatic int\nPyWcsprm_set_trefpos(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.trefpos)) {\n    return -1;\n  }\n\n  return set_string(\"trefpos\", value, self->x.trefpos, 72);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_trefdir(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.trefdir)) {\n    return NULL;\n  }\n\n  return get_string(\"trefdir\", self->x.trefdir);\n}\n\nstatic int\nPyWcsprm_set_trefdir(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.trefdir)) {\n    return -1;\n  }\n\n  return set_string(\"trefdir\", value, self->x.trefdir, 72);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_timeunit(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.timeunit)) {\n    return NULL;\n  }\n\n  return get_string(\"timeunit\", self->x.timeunit);\n}\n\nstatic int\nPyWcsprm_set_timeunit(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.timeunit)) {\n    return -1;\n  }\n\n  return set_string(\"timeunit\", value, self->x.timeunit, 72);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_plephem(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.plephem)) {\n    return NULL;\n  }\n\n  return get_string(\"plephem\", self->x.plephem);\n}\n\nstatic int\nPyWcsprm_set_plephem(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.plephem)) {\n    return -1;\n  }\n\n  return set_string(\"plephem\", value, self->x.plephem, 72);\n}\n\nstatic PyObject*\nPyWcsprm_get_tstart(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"tstart\", self->x.tstart);\n}\n\nstatic int\nPyWcsprm_set_tstart(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) {\n    self->x.tstart = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"tstart\", value, &self->x.tstart);\n}\n\nstatic PyObject*\nPyWcsprm_get_tstop(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"tstop\", self->x.tstop);\n}\n\nstatic int\nPyWcsprm_set_tstop(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) {\n    self->x.tstop = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"tstop\", value, &self->x.tstop);\n}\n\nstatic PyObject*\nPyWcsprm_get_telapse(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"telapse\", self->x.telapse);\n}\n\nstatic int\nPyWcsprm_set_telapse(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) {\n    self->x.telapse = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"telapse\", value, &self->x.telapse);\n}\n\nstatic PyObject*\nPyWcsprm_get_timeoffs(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"timeoffs\", self->x.timeoffs);\n}\n\nstatic int\nPyWcsprm_set_timeoffs(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) {\n    self->x.timeoffs = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"timeoffs\", value, &self->x.timeoffs);\n}\n\nstatic PyObject*\nPyWcsprm_get_timsyer(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"timsyer\", self->x.timsyer);\n}\n\nstatic int\nPyWcsprm_set_timsyer(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) {\n    self->x.timsyer = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"timsyer\", value, &self->x.timsyer);\n}\n\nstatic PyObject*\nPyWcsprm_get_timrder(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"timrder\", self->x.timrder);\n}\n\nstatic int\nPyWcsprm_set_timrder(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) {\n    self->x.timrder = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"timrder\", value, &self->x.timrder);\n}\n\nstatic PyObject*\nPyWcsprm_get_timedel(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"timedel\", self->x.timedel);\n}\n\nstatic int\nPyWcsprm_set_timedel(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) {\n    self->x.timedel = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"timedel\", value, &self->x.timedel);\n}\n\nstatic PyObject*\nPyWcsprm_get_timepixr(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"timepixr\", self->x.timepixr);\n}\n\nstatic int\nPyWcsprm_set_timepixr(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) {\n    self->x.timepixr = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"timepixr\", value, &self->x.timepixr);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_obsorbit(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.obsorbit)) {\n    return NULL;\n  }\n\n  return get_string(\"obsorbit\", self->x.obsorbit);\n}\n\nstatic int\nPyWcsprm_set_obsorbit(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.obsorbit)) {\n    return -1;\n  }\n\n  return set_string(\"obsorbit\", value, self->x.obsorbit, 72);\n}\n\nstatic PyObject*\nPyWcsprm_get_xposure(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"xposure\", self->x.xposure);\n}\n\nstatic int\nPyWcsprm_set_xposure(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) {\n    self->x.xposure = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"xposure\", value, &self->x.xposure);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_name(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.wcsname)) {\n    return NULL;\n  }\n\n  return get_string(\"name\", self->x.wcsname);\n}\n\nstatic int\nPyWcsprm_set_name(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.wcsname)) {\n    return -1;\n  }\n\n  return set_string(\"name\", value, self->x.wcsname, 72);\n}\n\nstatic PyObject*\nPyWcsprm_get_naxis(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_int(\"naxis\", self->x.naxis);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_obsgeo(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  Py_ssize_t size = 6;\n\n  if (is_null(self->x.obsgeo)) {\n    return NULL;\n  }\n\n  return get_double_array(\"obsgeo\", self->x.obsgeo, 1, &size, (PyObject*)self);\n}\n\nstatic int\nPyWcsprm_set_obsgeo(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp size = 6;\n\n  if (is_null(self->x.obsgeo)) {\n    return -1;\n  }\n\n  if (value == NULL) {\n    self->x.obsgeo[0] = NPY_NAN;\n    self->x.obsgeo[1] = NPY_NAN;\n    self->x.obsgeo[2] = NPY_NAN;\n    self->x.obsgeo[3] = NPY_NAN;\n    self->x.obsgeo[4] = NPY_NAN;\n    self->x.obsgeo[5] = NPY_NAN;\n    return 0;\n  }\n\n  return set_double_array(\"obsgeo\", value, 1, &size, self->x.obsgeo);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_pc(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  npy_intp dims[2];\n\n  if (is_null(self->x.pc)) {\n    return NULL;\n  }\n\n  if (self->x.altlin != 0 && (self->x.altlin & has_pc) == 0) {\n    PyErr_SetString(PyExc_AttributeError, \"No pc is present.\");\n    return NULL;\n  }\n\n  dims[0] = self->x.naxis;\n  dims[1] = self->x.naxis;\n\n  return get_double_array(\"pc\", self->x.pc, 2, dims, (PyObject*)self);\n}\n\nstatic int\nPyWcsprm_set_pc(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  npy_intp dims[2];\n  int i, j, naxis;\n  double* pc;\n\n  if (is_null(self->x.pc)) {\n    return -1;\n  }\n\n  note_change(self);\n\n  if (value == NULL) { /* deletion */\n    self->x.altlin &= ~has_pc;\n\n    /* If this results in deleting all flags, pc is still the default,\n       so we should set the pc matrix itself to default values. */\n    naxis = self->x.naxis;\n    pc = self->x.pc;\n    for (i = 0; i < naxis; i++) {\n      for (j = 0; j < naxis; j++) {\n        if (j == i) {\n          *pc = 1.0;\n        } else {\n          *pc = 0.0;\n        }\n        pc++;\n      }\n    }\n\n    note_change(self);\n\n    return 0;\n  }\n\n  dims[0] = self->x.naxis;\n  dims[1] = self->x.naxis;\n\n  if (set_double_array(\"pc\", value, 2, dims, self->x.pc)) {\n    return -1;\n  }\n\n  self->x.altlin |= has_pc;\n\n  note_change(self);\n\n  return 0;\n}\n\nstatic PyObject*\nPyWcsprm_get_phi0(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"phi0\", self->x.cel.phi0);\n}\n\nstatic int\nPyWcsprm_set_phi0(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  note_change(self);\n\n  if (value == NULL) {\n    self->x.cel.phi0 = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"phi0\", value, &(self->x.cel.phi0));\n}\n\nstatic PyObject*\nPyWcsprm_get_piximg_matrix(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  npy_intp dims[2];\n\n  if (is_null(self->x.lin.piximg)) {\n    return NULL;\n  }\n\n  if (PyWcsprm_cset(self, 1)) {\n    return NULL;\n  }\n\n  dims[0] = self->x.naxis;\n  dims[1] = self->x.naxis;\n\n  return get_double_array(\"piximg_matrix\", self->x.lin.piximg, 2, dims,\n                          (PyObject*)self);\n}\n\nstatic PyObject*\nPyWcsprm_get_radesys(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.radesys)) {\n    return NULL;\n  }\n\n  return get_string(\"radesys\", self->x.radesys);\n}\n\nstatic int\nPyWcsprm_set_radesys(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.radesys)) {\n    return -1;\n  }\n\n  return set_string(\"radesys\", value, self->x.radesys, 72);\n}\n\nstatic PyObject*\nPyWcsprm_get_restfrq(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"restfrq\", self->x.restfrq);\n}\n\nstatic int\nPyWcsprm_set_restfrq(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) { /* deletion */\n    self->x.restfrq = (double)NPY_NAN;\n    return 0;\n  }\n\n  note_change(self);\n\n  return set_double(\"restfrq\", value, &self->x.restfrq);\n}\n\nstatic PyObject*\nPyWcsprm_get_restwav(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"restwav\", self->x.restwav);\n}\n\nstatic int\nPyWcsprm_set_restwav(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) { /* deletion */\n    self->x.restwav = (double)NPY_NAN;\n    return 0;\n  }\n\n  note_change(self);\n\n  return set_double(\"restwav\", value, &self->x.restwav);\n}\n\nstatic PyObject*\nPyWcsprm_get_spec(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_int(\"spec\", self->x.spec);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_specsys(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.specsys)) {\n    return NULL;\n  }\n\n  return get_string(\"specsys\", self->x.specsys);\n}\n\nstatic int\nPyWcsprm_set_specsys(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.specsys)) {\n    return -1;\n  }\n\n  return set_string(\"specsys\", value, self->x.specsys, 72);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_ssysobs(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.ssysobs)) {\n    return NULL;\n  }\n\n  return get_string(\"ssysobs\", self->x.ssysobs);\n}\n\nstatic int\nPyWcsprm_set_ssysobs(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.ssysobs)) {\n    return -1;\n  }\n\n  note_change(self);\n\n  return set_string(\"ssysobs\", value, self->x.ssysobs, 72);\n}\n\n/*@null@*/ static PyObject*\nPyWcsprm_get_ssyssrc(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.ssyssrc)) {\n    return NULL;\n  }\n\n  return get_string(\"ssyssrc\", self->x.ssyssrc);\n}\n\nstatic int\nPyWcsprm_set_ssyssrc(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (is_null(self->x.ssyssrc)) {\n    return -1;\n  }\n\n  return set_string(\"ssyssrc\", value, self->x.ssyssrc, 72);\n}\n\nstatic PyObject*\nPyWcsprm_get_tab(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  PyObject* result;\n  PyObject* subresult;\n  int i, ntab;\n\n  ntab = self->x.ntab;\n\n  result = PyList_New(ntab);\n  if (result == NULL) {\n    return NULL;\n  }\n\n  for (i = 0; i < ntab; ++i) {\n    subresult = (PyObject *)PyTabprm_cnew((PyObject *)self, &(self->x.tab[i]));\n    if (subresult == NULL) {\n      Py_DECREF(result);\n      return NULL;\n    }\n\n    if (PyList_SetItem(result, i, subresult) == -1) {\n      Py_DECREF(subresult);\n      Py_DECREF(result);\n      return NULL;\n    }\n  }\n\n  return result;\n}\n\nstatic PyObject*\nPyWcsprm_get_theta0(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"theta0\", self->x.cel.theta0);\n}\n\nstatic int\nPyWcsprm_set_theta0(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  note_change(self);\n\n  if (value == NULL) {\n    self->x.cel.theta0 = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"theta0\", value, &self->x.cel.theta0);\n}\n\nstatic PyObject*\nPyWcsprm_get_velangl(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"velangl\", self->x.velangl);\n}\n\nstatic int\nPyWcsprm_set_velangl(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) { /* deletion */\n    self->x.velangl = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"velangl\", value, &self->x.velangl);\n}\n\nstatic PyObject*\nPyWcsprm_get_velosys(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"velosys\", self->x.velosys);\n}\n\nstatic int\nPyWcsprm_set_velosys(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) { /* deletion */\n    self->x.velosys = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"velosys\", value, &self->x.velosys);\n}\n\nstatic PyObject*\nPyWcsprm_get_velref(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_int(\"velref\", self->x.velref);\n}\n\nstatic int\nPyWcsprm_set_velref(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) { /* deletion */\n    self->x.velref = 0;\n    return 0;\n  }\n\n  return set_int(\"velref\", value, &self->x.velref);\n}\n\n\nstatic PyObject* PyWcsprm_get_wtb(PyWcsprm* self, void* closure) {\n  PyObject* list;\n  PyObject* elem;\n  int i, nwtb;\n\n  nwtb = self->x.nwtb;\n\n  list = PyList_New(nwtb);\n  if (list == NULL) return NULL;\n\n  for (i = 0; i < nwtb; ++i) {\n    elem = (PyObject *)PyWtbarr_cnew((PyObject *)self, &(self->x.wtb[i]));\n    if (elem == NULL) {\n      Py_DECREF(list);\n      return NULL;\n    }\n\n    PyList_SET_ITEM(list, i, elem);\n  }\n\n  return list;\n}\n\n\nstatic PyObject*\nPyWcsprm_get_zsource(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return get_double(\"zsource\", self->x.zsource);\n}\n\nstatic int\nPyWcsprm_set_zsource(\n    PyWcsprm* self,\n    PyObject* value,\n    /*@unused@*/ void* closure) {\n\n  if (value == NULL) { /* deletion */\n    self->x.zsource = (double)NPY_NAN;\n    return 0;\n  }\n\n  return set_double(\"zsource\", value, &self->x.zsource);\n}\n\n\nstatic PyObject*\nPyWcsprm_get_aux(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  PyObject* result;\n\n    // If wcsprm.aux is not initialized, we should do so here so that users can\n    // set auxiliary parameters on an empty WCS.\n\n    if (self->x.aux == 0x0) {\n      wcsauxi(1, &self->x);\n    }\n\n  result = (PyObject *)PyAuxprm_cnew((PyObject *)self, self->x.aux);\n\n  return result;\n}\n\n\nstatic PyObject*\nPyWcsprm_get_cel(\n    PyWcsprm* self,\n    /*@unused@*/ void* closure) {\n\n  return (PyObject *)PyCelprm_cnew((PyObject *)self, &(self->x.cel), NULL);\n}\n\n/***************************************************************************\n * PyWcsprm definition structures\n */\n\nstatic PyGetSetDef PyWcsprm_getset[] = {\n  {\"alt\", (getter)PyWcsprm_get_alt, (setter)PyWcsprm_set_alt, (char *)doc_alt},\n  {\"aux\", (getter)PyWcsprm_get_aux, NULL, (char *)doc_aux},\n  {\"cel\", (getter)PyWcsprm_get_cel, NULL, (char *)doc_cel},\n  {\"axis_types\", (getter)PyWcsprm_get_axis_types, NULL, (char *)doc_axis_types},\n  {\"bepoch\", (getter)PyWcsprm_get_bepoch, (setter)PyWcsprm_set_bepoch, (char *)doc_bepoch},\n  {\"cd\", (getter)PyWcsprm_get_cd, (setter)PyWcsprm_set_cd, (char *)doc_cd},\n  {\"cdelt\", (getter)PyWcsprm_get_cdelt, (setter)PyWcsprm_set_cdelt, (char *)doc_cdelt},\n  {\"cel_offset\", (getter)PyWcsprm_get_cel_offset, (setter)PyWcsprm_set_cel_offset, (char *)doc_cel_offset},\n  {\"cname\", (getter)PyWcsprm_get_cname, (setter)PyWcsprm_set_cname, (char *)doc_cname},\n  {\"colax\", (getter)PyWcsprm_get_colax, (setter)PyWcsprm_set_colax, (char *)doc_colax},\n  {\"colnum\", (getter)PyWcsprm_get_colnum, (setter)PyWcsprm_set_colnum, (char *)doc_colnum},\n  {\"crder\", (getter)PyWcsprm_get_crder, (setter)PyWcsprm_set_crder, (char *)doc_crder},\n  {\"crota\", (getter)PyWcsprm_get_crota, (setter)PyWcsprm_set_crota, (char *)doc_crota},\n  {\"crpix\", (getter)PyWcsprm_get_crpix, (setter)PyWcsprm_set_crpix, (char *)doc_crpix},\n  {\"crval\", (getter)PyWcsprm_get_crval, (setter)PyWcsprm_set_crval, (char *)doc_crval},\n  {\"csyer\", (getter)PyWcsprm_get_csyer, (setter)PyWcsprm_set_csyer, (char *)doc_csyer},\n  {\"ctype\", (getter)PyWcsprm_get_ctype, (setter)PyWcsprm_set_ctype, (char *)doc_ctype},\n  {\"cubeface\", (getter)PyWcsprm_get_cubeface, (setter)PyWcsprm_set_cubeface, (char *)doc_cubeface},\n  {\"cunit\", (getter)PyWcsprm_get_cunit, (setter)PyWcsprm_set_cunit, (char *)doc_cunit},\n  {\"czphs\", (getter)PyWcsprm_get_czphs, (setter)PyWcsprm_set_czphs, (char *)doc_czphs},\n  {\"cperi\", (getter)PyWcsprm_get_cperi, (setter)PyWcsprm_set_cperi, (char *)doc_cperi},\n  {\"dateavg\", (getter)PyWcsprm_get_dateavg, (setter)PyWcsprm_set_dateavg, (char *)doc_dateavg},\n  {\"datebeg\", (getter)PyWcsprm_get_datebeg, (setter)PyWcsprm_set_datebeg, (char *)doc_datebeg},\n  {\"dateend\", (getter)PyWcsprm_get_dateend, (setter)PyWcsprm_set_dateend, (char *)doc_dateend},\n  {\"dateobs\", (getter)PyWcsprm_get_dateobs, (setter)PyWcsprm_set_dateobs, (char *)doc_dateobs},\n  {\"dateref\", (getter)PyWcsprm_get_dateref, (setter)PyWcsprm_set_dateref, (char *)doc_dateref},\n  {\"equinox\", (getter)PyWcsprm_get_equinox, (setter)PyWcsprm_set_equinox, (char *)doc_equinox},\n  {\"imgpix_matrix\", (getter)PyWcsprm_get_imgpix_matrix, NULL, (char *)doc_imgpix_matrix},\n  {\"jepoch\", (getter)PyWcsprm_get_jepoch, (setter)PyWcsprm_set_jepoch, (char *)doc_jepoch},\n  {\"lat\", (getter)PyWcsprm_get_lat, NULL, (char *)doc_lat},\n  {\"latpole\", (getter)PyWcsprm_get_latpole, (setter)PyWcsprm_set_latpole, (char *)doc_latpole},\n  {\"lattyp\", (getter)PyWcsprm_get_lattyp, NULL, (char *)doc_lattyp},\n  {\"lng\", (getter)PyWcsprm_get_lng, NULL, (char *)doc_lng},\n  {\"lngtyp\", (getter)PyWcsprm_get_lngtyp, NULL, (char *)doc_lngtyp},\n  {\"lonpole\", (getter)PyWcsprm_get_lonpole, (setter)PyWcsprm_set_lonpole, (char *)doc_lonpole},\n  {\"mjdavg\", (getter)PyWcsprm_get_mjdavg, (setter)PyWcsprm_set_mjdavg, (char *)doc_mjdavg},\n  {\"mjdbeg\", (getter)PyWcsprm_get_mjdbeg, (setter)PyWcsprm_set_mjdbeg, (char *)doc_mjdbeg},\n  {\"mjdend\", (getter)PyWcsprm_get_mjdend, (setter)PyWcsprm_set_mjdend, (char *)doc_mjdend},\n  {\"mjdobs\", (getter)PyWcsprm_get_mjdobs, (setter)PyWcsprm_set_mjdobs, (char *)doc_mjdobs},\n  {\"mjdref\", (getter)PyWcsprm_get_mjdref, (setter)PyWcsprm_set_mjdref, (char *)doc_mjdref},\n  {\"name\", (getter)PyWcsprm_get_name, (setter)PyWcsprm_set_name, (char *)doc_name},\n  {\"naxis\", (getter)PyWcsprm_get_naxis, NULL, (char *)doc_naxis},\n  {\"obsgeo\", (getter)PyWcsprm_get_obsgeo, (setter)PyWcsprm_set_obsgeo, (char *)doc_obsgeo},\n  {\"obsorbit\", (getter)PyWcsprm_get_obsorbit, (setter)PyWcsprm_set_obsorbit, (char *)doc_obsorbit},\n  {\"pc\", (getter)PyWcsprm_get_pc, (setter)PyWcsprm_set_pc, (char *)doc_pc},\n  {\"phi0\", (getter)PyWcsprm_get_phi0, (setter)PyWcsprm_set_phi0, (char *)doc_phi0},\n  {\"piximg_matrix\", (getter)PyWcsprm_get_piximg_matrix, NULL, (char *)doc_piximg_matrix},\n  {\"plephem\", (getter)PyWcsprm_get_plephem, (setter)PyWcsprm_set_plephem, (char *) doc_plephem},\n  {\"radesys\", (getter)PyWcsprm_get_radesys, (setter)PyWcsprm_set_radesys, (char *)doc_radesys},\n  {\"restfrq\", (getter)PyWcsprm_get_restfrq, (setter)PyWcsprm_set_restfrq, (char *)doc_restfrq},\n  {\"restwav\", (getter)PyWcsprm_get_restwav, (setter)PyWcsprm_set_restwav, (char *)doc_restwav},\n  {\"spec\", (getter)PyWcsprm_get_spec, NULL, (char *)doc_spec},\n  {\"specsys\", (getter)PyWcsprm_get_specsys, (setter)PyWcsprm_set_specsys, (char *)doc_specsys},\n  {\"ssysobs\", (getter)PyWcsprm_get_ssysobs, (setter)PyWcsprm_set_ssysobs, (char *)doc_ssysobs},\n  {\"ssyssrc\", (getter)PyWcsprm_get_ssyssrc, (setter)PyWcsprm_set_ssyssrc, (char *)doc_ssyssrc},\n  {\"tab\", (getter)PyWcsprm_get_tab, NULL, (char *)doc_tab},\n  {\"theta0\", (getter)PyWcsprm_get_theta0, (setter)PyWcsprm_set_theta0, (char *)doc_theta0},\n  {\"timesys\", (getter)PyWcsprm_get_timesys, (setter)PyWcsprm_set_timesys, (char *) doc_timesys},\n  {\"trefpos\", (getter)PyWcsprm_get_trefpos, (setter)PyWcsprm_set_trefpos, (char *) doc_trefpos},\n  {\"trefdir\", (getter)PyWcsprm_get_trefdir, (setter)PyWcsprm_set_trefdir, (char *) doc_trefdir},\n  {\"tstart\", (getter)PyWcsprm_get_tstart, (setter)PyWcsprm_set_tstart, (char *) doc_tstart},\n  {\"tstop\", (getter)PyWcsprm_get_tstop, (setter)PyWcsprm_set_tstop, (char *) doc_tstop},\n  {\"telapse\", (getter)PyWcsprm_get_telapse, (setter)PyWcsprm_set_telapse, (char *) doc_telapse},\n  {\"timeoffs\", (getter)PyWcsprm_get_timeoffs, (setter)PyWcsprm_set_timeoffs, (char *) doc_timeoffs},\n  {\"timsyer\", (getter)PyWcsprm_get_timsyer, (setter)PyWcsprm_set_timsyer, (char *) doc_timsyer},\n  {\"timrder\", (getter)PyWcsprm_get_timrder, (setter)PyWcsprm_set_timrder, (char *) doc_timrder},\n  {\"timedel\", (getter)PyWcsprm_get_timedel, (setter)PyWcsprm_set_timedel, (char *) doc_timedel},\n  {\"timepixr\", (getter)PyWcsprm_get_timepixr, (setter)PyWcsprm_set_timepixr, (char *) doc_timepixr},\n  {\"timeunit\", (getter)PyWcsprm_get_timeunit, (setter)PyWcsprm_set_timeunit, (char *) doc_timeunit},\n  {\"velangl\", (getter)PyWcsprm_get_velangl, (setter)PyWcsprm_set_velangl, (char *)doc_velangl},\n  {\"velosys\", (getter)PyWcsprm_get_velosys, (setter)PyWcsprm_set_velosys, (char *)doc_velosys},\n  {\"velref\", (getter)PyWcsprm_get_velref, (setter)PyWcsprm_set_velref, (char *)doc_velref},\n  {\"xposure\", (getter)PyWcsprm_get_xposure, (setter)PyWcsprm_set_xposure, (char *)doc_xposure},\n  {\"wtb\", (getter)PyWcsprm_get_wtb, NULL, (char *) doc_wtb},\n  {\"zsource\", (getter)PyWcsprm_get_zsource, (setter)PyWcsprm_set_zsource, (char *)doc_zsource},\n  {NULL}\n};\n\nstatic PyMethodDef PyWcsprm_methods[] = {\n  {\"bounds_check\", (PyCFunction)PyWcsprm_bounds_check, METH_VARARGS|METH_KEYWORDS, doc_bounds_check},\n  {\"cdfix\", (PyCFunction)PyWcsprm_cdfix, METH_NOARGS, doc_cdfix},\n  {\"celfix\", (PyCFunction)PyWcsprm_celfix, METH_NOARGS, doc_celfix},\n  {\"compare\", (PyCFunction)PyWcsprm_compare, METH_VARARGS|METH_KEYWORDS, doc_compare},\n  {\"__copy__\", (PyCFunction)PyWcsprm_copy, METH_NOARGS, doc_copy},\n  {\"cylfix\", (PyCFunction)PyWcsprm_cylfix, METH_VARARGS|METH_KEYWORDS, doc_cylfix},\n  {\"datfix\", (PyCFunction)PyWcsprm_datfix, METH_NOARGS, doc_datfix},\n  {\"__deepcopy__\", (PyCFunction)PyWcsprm_copy, METH_O, doc_copy},\n  {\"fix\", (PyCFunction)PyWcsprm_fix, METH_VARARGS|METH_KEYWORDS, doc_fix},\n  {\"get_cdelt\", (PyCFunction)PyWcsprm_get_cdelt_func, METH_NOARGS, doc_get_cdelt},\n  {\"get_pc\", (PyCFunction)PyWcsprm_get_pc_func, METH_NOARGS, doc_get_pc},\n  {\"get_ps\", (PyCFunction)PyWcsprm_get_ps, METH_NOARGS, doc_get_ps},\n  {\"get_pv\", (PyCFunction)PyWcsprm_get_pv, METH_NOARGS, doc_get_pv},\n  {\"has_cd\", (PyCFunction)PyWcsprm_has_cdi_ja, METH_NOARGS, doc_has_cd},\n  {\"has_cdi_ja\", (PyCFunction)PyWcsprm_has_cdi_ja, METH_NOARGS, doc_has_cdi_ja},\n  {\"has_crota\", (PyCFunction)PyWcsprm_has_crotaia, METH_NOARGS, doc_has_crota},\n  {\"has_crotaia\", (PyCFunction)PyWcsprm_has_crotaia, METH_NOARGS, doc_has_crotaia},\n  {\"has_pc\", (PyCFunction)PyWcsprm_has_pci_ja, METH_NOARGS, doc_has_pc},\n  {\"has_pci_ja\", (PyCFunction)PyWcsprm_has_pci_ja, METH_NOARGS, doc_has_pci_ja},\n  {\"is_unity\", (PyCFunction)PyWcsprm_is_unity, METH_NOARGS, doc_is_unity},\n  {\"mix\", (PyCFunction)PyWcsprm_mix, METH_VARARGS|METH_KEYWORDS, doc_mix},\n  {\"p2s\", (PyCFunction)PyWcsprm_p2s, METH_VARARGS|METH_KEYWORDS, doc_p2s},\n  {\"print_contents\", (PyCFunction)PyWcsprm_print_contents, METH_NOARGS, doc_print_contents},\n  {\"s2p\", (PyCFunction)PyWcsprm_s2p, METH_VARARGS|METH_KEYWORDS, doc_s2p},\n  {\"set\", (PyCFunction)PyWcsprm_set, METH_NOARGS, doc_set},\n  {\"set_ps\", (PyCFunction)PyWcsprm_set_ps, METH_O, doc_set_ps},\n  {\"set_pv\", (PyCFunction)PyWcsprm_set_pv, METH_O, doc_set_pv},\n  {\"spcfix\", (PyCFunction)PyWcsprm_spcfix, METH_NOARGS, doc_spcfix},\n  {\"sptr\", (PyCFunction)PyWcsprm_sptr, METH_VARARGS|METH_KEYWORDS, doc_sptr},\n  {\"sub\", (PyCFunction)PyWcsprm_sub, METH_VARARGS|METH_KEYWORDS, doc_sub},\n  {\"to_header\", (PyCFunction)PyWcsprm_to_header, METH_VARARGS|METH_KEYWORDS, doc_to_header},\n  {\"unitfix\", (PyCFunction)PyWcsprm_unitfix, METH_VARARGS|METH_KEYWORDS, doc_unitfix},\n  {NULL}\n};\n\nPyTypeObject PyWcsprmType = {\n  PyVarObject_HEAD_INIT(NULL, 0)\n  \"astropy.wcs.Wcsprm\",              /*tp_name*/\n  sizeof(PyWcsprm),             /*tp_basicsize*/\n  0,                            /*tp_itemsize*/\n  (destructor)PyWcsprm_dealloc, /*tp_dealloc*/\n  0,                            /*tp_print*/\n  0,                            /*tp_getattr*/\n  0,                            /*tp_setattr*/\n  0,                            /*tp_compare*/\n  (reprfunc)PyWcsprm___str__,   /*tp_repr*/\n  0,                            /*tp_as_number*/\n  0,                            /*tp_as_sequence*/\n  0,                            /*tp_as_mapping*/\n  0,                            /*tp_hash */\n  0,                            /*tp_call*/\n  (reprfunc)PyWcsprm___str__,   /*tp_str*/\n  0,                            /*tp_getattro*/\n  0,                            /*tp_setattro*/\n  0,                            /*tp_as_buffer*/\n  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/\n  doc_Wcsprm,                   /* tp_doc */\n  0,                            /* tp_traverse */\n  0,                            /* tp_clear */\n  PyWcsprm_richcompare,         /* tp_richcompare */\n  0,                            /* tp_weaklistoffset */\n  0,                            /* tp_iter */\n  0,                            /* tp_iternext */\n  PyWcsprm_methods,             /* tp_methods */\n  0,                            /* tp_members */\n  PyWcsprm_getset,              /* tp_getset */\n  0,                            /* tp_base */\n  0,                            /* tp_dict */\n  0,                            /* tp_descr_get */\n  0,                            /* tp_descr_set */\n  0,                            /* tp_dictoffset */\n  (initproc)PyWcsprm_init,      /* tp_init */\n  0,                            /* tp_alloc */\n  PyWcsprm_new,                 /* tp_new */\n};\n\n#define CONSTANT(a) PyModule_AddIntConstant(m, #a, a)\n#define CONSTANT2(n, v) PyModule_AddIntConstant(m, n, v)\n\n#define XSTRINGIFY(s) STRINGIFY(s)\n#define STRINGIFY(s) #s\n\nint add_prj_codes(PyObject* module)\n{\n    int k;\n    PyObject* code;\n    PyObject* list = PyList_New(prj_ncode);\n    if (list == NULL) {\n        return -1;\n    }\n\n    for (k = 0; k < prj_ncode; k++) {\n        code = PyUnicode_FromString(prj_codes[k]);\n        if (PyList_SetItem(list, k, code)) {\n            Py_DECREF(code);\n            Py_DECREF(list);\n            return -1;\n        }\n    }\n\n    if (PyModule_AddObject(module, \"PRJ_CODES\", list)) {\n        Py_DECREF(list);\n        return -1;\n    }\n    return 0;\n}\n\nint\n_setup_wcsprm_type(\n    PyObject* m) {\n\n  if (PyType_Ready(&PyWcsprmType) < 0) {\n    return -1;\n  }\n\n  Py_INCREF(&PyWcsprmType);\n\n  wcsprintf_set(NULL);\n  wcserr_enable(1);\n\n  return (\n    PyModule_AddObject(m, \"Wcsprm\", (PyObject *)&PyWcsprmType) ||\n    CONSTANT(WCSSUB_LONGITUDE) ||\n    CONSTANT(WCSSUB_LATITUDE)  ||\n    CONSTANT(WCSSUB_CUBEFACE)  ||\n    CONSTANT(WCSSUB_SPECTRAL)  ||\n    CONSTANT(WCSSUB_STOKES)    ||\n    CONSTANT(WCSSUB_CELESTIAL) ||\n    CONSTANT(WCSHDR_IMGHEAD)   ||\n    CONSTANT(WCSHDR_BIMGARR)   ||\n    CONSTANT(WCSHDR_PIXLIST)   ||\n    CONSTANT(WCSHDR_none)      ||\n    CONSTANT(WCSHDR_all)       ||\n    CONSTANT(WCSHDR_reject)    ||\n#ifdef WCSHDR_strict\n    CONSTANT(WCSHDR_strict)    ||\n#endif\n    CONSTANT(WCSHDR_CROTAia)   ||\n    CONSTANT(WCSHDR_EPOCHa)    ||\n    CONSTANT(WCSHDR_VELREFa)   ||\n    CONSTANT(WCSHDR_CD00i00j)  ||\n    CONSTANT(WCSHDR_PC00i00j)  ||\n    CONSTANT(WCSHDR_PROJPn)    ||\n#ifdef WCSHDR_CD0i_0ja\n    CONSTANT(WCSHDR_CD0i_0ja)  ||\n#endif\n#ifdef WCSHDR_PC0i_0ja\n    CONSTANT(WCSHDR_PC0i_0ja)  ||\n#endif\n#ifdef WCSHDR_PV0i_0ma\n    CONSTANT(WCSHDR_PV0i_0ma)  ||\n#endif\n#ifdef WCSHDR_PS0i_0ma\n    CONSTANT(WCSHDR_PS0i_0ma)  ||\n#endif\n    CONSTANT(WCSHDR_RADECSYS)  ||\n    CONSTANT(WCSHDR_VSOURCE)   ||\n    CONSTANT(WCSHDR_DOBSn)     ||\n    CONSTANT(WCSHDR_LONGKEY)   ||\n    CONSTANT(WCSHDR_CNAMn)     ||\n    CONSTANT(WCSHDR_AUXIMG)    ||\n    CONSTANT(WCSHDR_ALLIMG)    ||\n    CONSTANT(WCSHDO_none)      ||\n    CONSTANT(WCSHDO_all)       ||\n    CONSTANT(WCSHDO_safe)      ||\n    CONSTANT(WCSHDO_DOBSn)     ||\n    CONSTANT(WCSHDO_TPCn_ka)   ||\n    CONSTANT(WCSHDO_PVn_ma)    ||\n    CONSTANT(WCSHDO_CRPXna)    ||\n    CONSTANT(WCSHDO_CNAMna)    ||\n    CONSTANT(WCSHDO_WCSNna)    ||\n    CONSTANT(WCSHDO_P12)       ||\n    CONSTANT(WCSHDO_P13)       ||\n    CONSTANT(WCSHDO_P14)       ||\n    CONSTANT(WCSHDO_P15)       ||\n    CONSTANT(WCSHDO_P16)       ||\n    CONSTANT(WCSHDO_P17)       ||\n    CONSTANT(WCSHDO_EFMT)      ||\n    CONSTANT(WCSCOMPARE_ANCILLARY) ||\n    CONSTANT(WCSCOMPARE_TILING) ||\n    CONSTANT(WCSCOMPARE_CRPIX)  ||\n    CONSTANT2(\"PRJ_PVN\", PVN)       ||\n    add_prj_codes(m) ||\n    CONSTANT2(\"PRJ_ZENITHAL\", ZENITHAL)                   ||\n    CONSTANT2(\"PRJ_CYLINDRICAL\", CYLINDRICAL)             ||\n    CONSTANT2(\"PRJ_PSEUDOCYLINDRICAL\", PSEUDOCYLINDRICAL) ||\n    CONSTANT2(\"PRJ_CONVENTIONAL\", CONVENTIONAL)           ||\n    CONSTANT2(\"PRJ_CONIC\", CONIC)                         ||\n    CONSTANT2(\"PRJ_POLYCONIC\", POLYCONIC)                 ||\n    CONSTANT2(\"PRJ_QUADCUBE\", QUADCUBE)                   ||\n    CONSTANT2(\"PRJ_HEALPIX\", HEALPIX));\n}\n"},{"attributeType":"null","col":40,"comment":"null","endLoc":8,"id":7552,"name":"VOTable","nodeType":"Attribute","startLoc":8,"text":"VOTable"},{"attributeType":"null","col":35,"comment":"null","endLoc":9,"id":7553,"name":"io_registry","nodeType":"Attribute","startLoc":9,"text":"io_registry"},{"col":0,"comment":"","endLoc":4,"header":"connect.py#<anonymous>","id":7554,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"io_registry.register_reader('votable', Table, read_table_votable)\n\nio_registry.register_writer('votable', Table, write_table_votable)\n\nio_registry.register_identifier('votable', Table, is_votable)"},{"col":4,"comment":"null","endLoc":2060,"header":"def _add_paramref(self, iterator, tag, data, config, pos)","id":7555,"name":"_add_paramref","nodeType":"Function","startLoc":2058,"text":"def _add_paramref(self, iterator, tag, data, config, pos):\n        paramref = ParamRef(self._table, config=config, pos=pos, **data)\n        self.entries.append(paramref)"},{"id":7556,"name":"util.c","nodeType":"TextFile","path":"astropy/wcs/src","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#define NO_IMPORT_ARRAY\n\n#include \"astropy_wcs/util.h\"\n#include <math.h>\n#include <float.h>\n\nvoid set_invalid_to_nan(\n    const int ncoord,\n    const int nelem,\n    double* const data,\n    const int* const stat)\n{\n  int i = 0;\n  double* d = data;\n  const int* s = stat;\n  const int* s_end = stat + ncoord;\n  double n;\n\n  #ifndef NAN\n    #define INF (DBL_MAX+DBL_MAX)\n    #define NAN (INF-INF)\n  #endif\n\n  // Note that stat is a bit mask, so we need to mask only some of\n  // the coordinates depending on the bit mask values.\n\n  n = NAN;\n\n  for ( ; s != s_end; ++s) {\n    if (*s) {\n      int bit = 1;\n      for (i = 0; i < nelem; ++i) {\n        if (*s & bit) {\n          *d = n;\n        }\n        d++;\n        // We don't need to worry about overflow here because the WCS\n        // class cannot be used for naxis > 15 so nelem will always\n        // be <=15.\n        bit <<= 1;\n      }\n    } else {\n      d += nelem;\n    }\n  }\n}\n"},{"col":4,"comment":"null","endLoc":2069,"header":"def _add_param(self, iterator, tag, data, config, pos)","id":7557,"name":"_add_param","nodeType":"Function","startLoc":2062,"text":"def _add_param(self, iterator, tag, data, config, pos):\n        if isinstance(self._table, VOTableFile):\n            votable = self._table\n        else:\n            votable = self._table._votable\n        param = Param(votable, config=config, pos=pos, **data)\n        self.entries.append(param)\n        param.parse(iterator, config)"},{"col":4,"comment":"null","endLoc":988,"header":"def __ne__(self, value)","id":7558,"name":"__ne__","nodeType":"Function","startLoc":987,"text":"def __ne__(self, value):\n        return np.logical_not(self == value)"},{"col":4,"comment":"Create a new representation with ``method`` applied to the component\n        data.\n\n        This is not a simple inherit from ``BaseRepresentationOrDifferential``\n        because we need to call ``._apply()`` on any associated differential\n        classes.\n\n        See docstring for `BaseRepresentationOrDifferential._apply`.\n\n        Parameters\n        ----------\n        method : str or callable\n            If str, it is the name of a method that is applied to the internal\n            ``components``. If callable, the function is applied.\n        *args : tuple\n            Any positional arguments for ``method``.\n        **kwargs : dict\n            Any keyword arguments for ``method``.\n\n        ","endLoc":1016,"header":"def _apply(self, method, *args, **kwargs)","id":7559,"name":"_apply","nodeType":"Function","startLoc":990,"text":"def _apply(self, method, *args, **kwargs):\n        \"\"\"Create a new representation with ``method`` applied to the component\n        data.\n\n        This is not a simple inherit from ``BaseRepresentationOrDifferential``\n        because we need to call ``._apply()`` on any associated differential\n        classes.\n\n        See docstring for `BaseRepresentationOrDifferential._apply`.\n\n        Parameters\n        ----------\n        method : str or callable\n            If str, it is the name of a method that is applied to the internal\n            ``components``. If callable, the function is applied.\n        *args : tuple\n            Any positional arguments for ``method``.\n        **kwargs : dict\n            Any keyword arguments for ``method``.\n\n        \"\"\"\n        rep = super()._apply(method, *args, **kwargs)\n\n        rep._differentials = dict(\n            [(k, diff._apply(method, *args, **kwargs))\n             for k, diff in self._differentials.items()])\n        return rep"},{"col":4,"comment":"null","endLoc":1047,"header":"def __setitem__(self, item, value)","id":7560,"name":"__setitem__","nodeType":"Function","startLoc":1018,"text":"def __setitem__(self, item, value):\n        if not isinstance(value, BaseRepresentation):\n            raise TypeError(f'value must be a representation instance, '\n                            f'not {type(value)}.')\n\n        if not (isinstance(value, self.__class__)\n                or len(value.attr_classes) == len(self.attr_classes)):\n            raise ValueError(\n                f'value must be representable as {self.__class__.__name__} '\n                f'without loss of information.')\n\n        diff_classes = {}\n        if self._differentials:\n            if self._differentials.keys() != value._differentials.keys():\n                raise ValueError('value must have the same differentials.')\n\n            for key, self_diff in self._differentials.items():\n                diff_classes[key] = self_diff_cls = self_diff.__class__\n                value_diff_cls = value._differentials[key].__class__\n                if not (isinstance(value_diff_cls, self_diff_cls)\n                        or (len(value_diff_cls.attr_classes)\n                            == len(self_diff_cls.attr_classes))):\n                    raise ValueError(\n                        f'value differential {key!r} must be representable as '\n                        f'{self_diff.__class__.__name__} without loss of information.')\n\n        value = value.represent_as(self.__class__, diff_classes)\n        super().__setitem__(item, value)\n        for key, differential in self._differentials.items():\n            differential[item] = value._differentials[key]"},{"id":7561,"name":"astropy/wcs/tests","nodeType":"Package"},{"fileName":"helper.py","filePath":"astropy/wcs/tests","id":7562,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport pytest\n\nimport numpy as np\n\nfrom astropy import wcs\nfrom astropy.io import fits\n\n\nclass SimModelTAB:\n    def __init__(self, nx=150, ny=200, crpix=[1, 1], crval = [1, 1],\n                 cdelt = [1, 1], pc = {'PC1_1': 1, 'PC2_2': 1}):\n        \"\"\"  set essential parameters of the model (coord transformations)  \"\"\"\n        assert nx > 2 and ny > 1  # a limitation of this particular simulation\n        self.nx = nx\n        self.ny = ny\n        self.crpix = crpix\n        self.crval = crval\n        self.cdelt = cdelt\n        self.pc = pc\n\n    def fwd_eval(self, xy):\n        xb = 1 + self.nx // 3\n        px = np.array([1, xb, xb, self.nx + 1])\n        py = np.array([1, self.ny + 1])\n\n        xi = self.crval[0] + self.cdelt[0] * (px - self.crpix[0])\n        yi = self.crval[1] + self.cdelt[1] * (py - self.crpix[1])\n\n        cx = np.array([0.0, 0.26, 0.8, 1.0])\n        cy = np.array([-0.5, 0.5])\n\n        xy = np.atleast_2d(xy)\n        x = xy[:, 0]\n        y = xy[:, 1]\n\n        mbad = (x < px[0]) | (y < py[0]) | (x > px[-1]) | (y > py[-1])\n        mgood = np.logical_not(mbad)\n\n        i = 2 * (x > xb).astype(int)\n\n        psix = self.crval[0] + self.cdelt[0] * (x - self.crpix[0])\n        psiy = self.crval[1] + self.cdelt[1] * (y - self.crpix[1])\n\n        cfx = (psix - xi[i]) / (xi[i + 1] - xi[i])\n        cfy = (psiy - yi[0]) / (yi[1] - yi[0])\n\n        ra = cx[i] + cfx * (cx[i + 1] - cx[i])\n        dec = cy[0] + cfy * (cy[1] - cy[0])\n\n        return np.dstack([ra, dec])[0]\n\n    @property\n    def hdulist(self):\n        \"\"\" Simulates 2D data with a _spatial_ WCS that uses the ``-TAB``\n        algorithm with indexing.\n        \"\"\"\n        # coordinate array (some \"arbitrary\" numbers with a \"jump\" along x axis):\n        x = np.array([[0.0, 0.26, 0.8, 1.0], [0.0, 0.26, 0.8, 1.0]])\n        y = np.array([[-0.5, -0.5, -0.5, -0.5], [0.5, 0.5, 0.5, 0.5]])\n        c = np.dstack([x, y])\n\n        # index arrays (skip PC matrix for simplicity - assume it is an\n        # identity matrix):\n        xb = 1 + self.nx // 3\n        px = np.array([1, xb, xb, self.nx + 1])\n        py = np.array([1, self.ny + 1])\n        xi = self.crval[0] + self.cdelt[0] * (px - self.crpix[0])\n        yi = self.crval[1] + self.cdelt[1] * (py - self.crpix[1])\n\n        # structured array (data) for binary table HDU:\n        arr = np.array(\n            [(c, xi, yi)],\n            dtype=[\n                ('wavelength', np.float64, c.shape),\n                ('xi', np.double, (xi.size,)),\n                ('yi', np.double, (yi.size,))\n            ]\n        )\n\n        # create binary table HDU:\n        bt = fits.BinTableHDU(arr);\n        bt.header['EXTNAME'] = 'WCS-TABLE'\n\n        # create primary header:\n        image_data = np.ones((self.ny, self.nx), dtype=np.float32)\n        pu = fits.PrimaryHDU(image_data)\n        pu.header['ctype1'] = 'RA---TAB'\n        pu.header['ctype2'] = 'DEC--TAB'\n        pu.header['naxis1'] = self.nx\n        pu.header['naxis2'] = self.ny\n        pu.header['PS1_0'] = 'WCS-TABLE'\n        pu.header['PS2_0'] = 'WCS-TABLE'\n        pu.header['PS1_1'] = 'wavelength'\n        pu.header['PS2_1'] = 'wavelength'\n        pu.header['PV1_3'] = 1\n        pu.header['PV2_3'] = 2\n        pu.header['CUNIT1'] = 'deg'\n        pu.header['CUNIT2'] = 'deg'\n        pu.header['CDELT1'] = self.cdelt[0]\n        pu.header['CDELT2'] = self.cdelt[1]\n        pu.header['CRPIX1'] = self.crpix[0]\n        pu.header['CRPIX2'] = self.crpix[1]\n        pu.header['CRVAL1'] = self.crval[0]\n        pu.header['CRVAL2'] = self.crval[1]\n        pu.header['PS1_2'] = 'xi'\n        pu.header['PS2_2'] = 'yi'\n        for k, v in self.pc.items():\n            pu.header[k] = v\n\n        hdulist = fits.HDUList([pu, bt])\n        return hdulist\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":58,"id":7563,"name":"__all__","nodeType":"Attribute","startLoc":58,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":69,"id":7564,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":69,"text":"__doctest_skip__"},{"attributeType":"null","col":4,"comment":"null","endLoc":73,"id":7565,"name":"_parsed_version","nodeType":"Attribute","startLoc":73,"text":"_parsed_version"},{"attributeType":"null","col":4,"comment":"null","endLoc":85,"id":7566,"name":"WCSBase","nodeType":"Attribute","startLoc":85,"text":"WCSBase"},{"attributeType":"null","col":4,"comment":"null","endLoc":86,"id":7567,"name":"DistortionLookupTable","nodeType":"Attribute","startLoc":86,"text":"DistortionLookupTable"},{"attributeType":"null","col":4,"comment":"null","endLoc":87,"id":7568,"name":"Sip","nodeType":"Attribute","startLoc":87,"text":"Sip"},{"attributeType":"null","col":4,"comment":"null","endLoc":88,"id":7569,"name":"Wcsprm","nodeType":"Attribute","startLoc":88,"text":"Wcsprm"},{"attributeType":"null","col":4,"comment":"null","endLoc":89,"id":7570,"name":"Auxprm","nodeType":"Attribute","startLoc":89,"text":"Auxprm"},{"attributeType":"null","col":4,"comment":"null","endLoc":90,"id":7571,"name":"Celprm","nodeType":"Attribute","startLoc":90,"text":"Celprm"},{"attributeType":"null","col":4,"comment":"null","endLoc":91,"id":7572,"name":"Prjprm","nodeType":"Attribute","startLoc":91,"text":"Prjprm"},{"attributeType":"null","col":4,"comment":"null","endLoc":92,"id":7573,"name":"Tabprm","nodeType":"Attribute","startLoc":92,"text":"Tabprm"},{"attributeType":"null","col":4,"comment":"null","endLoc":93,"id":7574,"name":"Wtbarr","nodeType":"Attribute","startLoc":93,"text":"Wtbarr"},{"attributeType":"null","col":4,"comment":"null","endLoc":94,"id":7575,"name":"WcsError","nodeType":"Attribute","startLoc":94,"text":"WcsError"},{"attributeType":"null","col":4,"comment":"null","endLoc":95,"id":7576,"name":"SingularMatrixError","nodeType":"Attribute","startLoc":95,"text":"SingularMatrixError"},{"attributeType":"null","col":4,"comment":"null","endLoc":96,"id":7578,"name":"InconsistentAxisTypesError","nodeType":"Attribute","startLoc":96,"text":"InconsistentAxisTypesError"},{"attributeType":"null","col":4,"comment":"null","endLoc":97,"id":7579,"name":"InvalidTransformError","nodeType":"Attribute","startLoc":97,"text":"InvalidTransformError"},{"attributeType":"null","col":4,"comment":"null","endLoc":98,"id":7580,"name":"InvalidCoordinateError","nodeType":"Attribute","startLoc":98,"text":"InvalidCoordinateError"},{"attributeType":"null","col":4,"comment":"null","endLoc":99,"id":7581,"name":"NoSolutionError","nodeType":"Attribute","startLoc":99,"text":"NoSolutionError"},{"attributeType":"null","col":4,"comment":"null","endLoc":100,"id":7582,"name":"InvalidSubimageSpecificationError","nodeType":"Attribute","startLoc":100,"text":"InvalidSubimageSpecificationError"},{"attributeType":"null","col":4,"comment":"null","endLoc":101,"id":7583,"name":"NonseparableSubimageCoordinateSystemError","nodeType":"Attribute","startLoc":101,"text":"NonseparableSubimageCoordinateSystemError"},{"attributeType":"null","col":4,"comment":"null","endLoc":102,"id":7584,"name":"NoWcsKeywordsFoundError","nodeType":"Attribute","startLoc":102,"text":"NoWcsKeywordsFoundError"},{"attributeType":"null","col":4,"comment":"null","endLoc":104,"id":7585,"name":"InvalidPrjParametersError","nodeType":"Attribute","startLoc":104,"text":"InvalidPrjParametersError"},{"fileName":"__init__.py","filePath":"astropy/wcs/tests","id":7586,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":107,"id":7587,"name":"key","nodeType":"Attribute","startLoc":107,"text":"key"},{"attributeType":"null","col":13,"comment":"null","endLoc":107,"id":7588,"name":"val","nodeType":"Attribute","startLoc":107,"text":"val"},{"attributeType":"null","col":4,"comment":"null","endLoc":127,"id":7589,"name":"WCSBase","nodeType":"Attribute","startLoc":127,"text":"WCSBase"},{"attributeType":"null","col":4,"comment":"null","endLoc":128,"id":7590,"name":"Wcsprm","nodeType":"Attribute","startLoc":128,"text":"Wcsprm"},{"attributeType":"null","col":4,"comment":"null","endLoc":129,"id":7591,"name":"DistortionLookupTable","nodeType":"Attribute","startLoc":129,"text":"DistortionLookupTable"},{"attributeType":"null","col":4,"comment":"null","endLoc":130,"id":7592,"name":"Sip","nodeType":"Attribute","startLoc":130,"text":"Sip"},{"attributeType":"null","col":4,"comment":"null","endLoc":131,"id":7593,"name":"Tabprm","nodeType":"Attribute","startLoc":131,"text":"Tabprm"},{"attributeType":"null","col":4,"comment":"null","endLoc":132,"id":7594,"name":"Wtbarr","nodeType":"Attribute","startLoc":132,"text":"Wtbarr"},{"attributeType":"None","col":4,"comment":"null","endLoc":133,"id":7595,"name":"WcsError","nodeType":"Attribute","startLoc":133,"text":"WcsError"},{"attributeType":"None","col":4,"comment":"null","endLoc":134,"id":7596,"name":"SingularMatrixError","nodeType":"Attribute","startLoc":134,"text":"SingularMatrixError"},{"attributeType":"None","col":4,"comment":"null","endLoc":135,"id":7597,"name":"InconsistentAxisTypesError","nodeType":"Attribute","startLoc":135,"text":"InconsistentAxisTypesError"},{"col":0,"comment":"","endLoc":4,"header":"wcslint.py#<anonymous>","id":7598,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nScript support for validating the WCS keywords in a FITS file.\n\"\"\""},{"attributeType":"None","col":4,"comment":"null","endLoc":136,"id":7599,"name":"InvalidTransformError","nodeType":"Attribute","startLoc":136,"text":"InvalidTransformError"},{"attributeType":"None","col":4,"comment":"null","endLoc":137,"id":7600,"name":"InvalidCoordinateError","nodeType":"Attribute","startLoc":137,"text":"InvalidCoordinateError"},{"attributeType":"None","col":4,"comment":"null","endLoc":138,"id":7601,"name":"NoSolutionError","nodeType":"Attribute","startLoc":138,"text":"NoSolutionError"},{"attributeType":"None","col":4,"comment":"null","endLoc":139,"id":7602,"name":"InvalidSubimageSpecificationError","nodeType":"Attribute","startLoc":139,"text":"InvalidSubimageSpecificationError"},{"attributeType":"None","col":4,"comment":"null","endLoc":140,"id":7603,"name":"NonseparableSubimageCoordinateSystemError","nodeType":"Attribute","startLoc":140,"text":"NonseparableSubimageCoordinateSystemError"},{"attributeType":"None","col":4,"comment":"null","endLoc":141,"id":7604,"name":"NoWcsKeywordsFoundError","nodeType":"Attribute","startLoc":141,"text":"NoWcsKeywordsFoundError"},{"attributeType":"null","col":0,"comment":"null","endLoc":146,"id":7605,"name":"WCSHDO_SIP","nodeType":"Attribute","startLoc":146,"text":"WCSHDO_SIP"},{"attributeType":"null","col":0,"comment":"null","endLoc":152,"id":7606,"name":"SIP_KW","nodeType":"Attribute","startLoc":152,"text":"SIP_KW"},{"col":0,"comment":"","endLoc":31,"header":"wcs.py#<anonymous>","id":7607,"name":"<anonymous>","nodeType":"Function","startLoc":31,"text":"__all__ = ['FITSFixedWarning', 'WCS', 'find_all_wcs',\n           'DistortionLookupTable', 'Sip', 'Tabprm', 'Wcsprm', 'Auxprm',\n           'Celprm', 'Prjprm', 'Wtbarr', 'WCSBase', 'validate', 'WcsError',\n           'SingularMatrixError', 'InconsistentAxisTypesError',\n           'InvalidTransformError', 'InvalidCoordinateError',\n           'InvalidPrjParametersError', 'NoSolutionError',\n           'InvalidSubimageSpecificationError', 'NoConvergence',\n           'NonseparableSubimageCoordinateSystemError',\n           'NoWcsKeywordsFoundError', 'InvalidTabularParametersError']\n\n__doctest_skip__ = ['WCS.all_world2pix']\n\nif _wcs is not None:\n    _parsed_version = _wcs.__version__.split('.')\n    if int(_parsed_version[0]) == 5 and int(_parsed_version[1]) < 8:\n        raise ImportError(\n            \"astropy.wcs is built with wcslib {0}, but only versions 5.8 and \"\n            \"later on the 5.x series are known to work.  The version of wcslib \"\n            \"that ships with astropy may be used.\")\n\n    if not _wcs._sanity_check():\n        raise RuntimeError(\n            \"astropy.wcs did not pass its sanity check for your build \"\n            \"on your platform.\")\n\n    WCSBase = _wcs._Wcs\n    DistortionLookupTable = _wcs.DistortionLookupTable\n    Sip = _wcs.Sip\n    Wcsprm = _wcs.Wcsprm\n    Auxprm = _wcs.Auxprm\n    Celprm = _wcs.Celprm\n    Prjprm = _wcs.Prjprm\n    Tabprm = _wcs.Tabprm\n    Wtbarr = _wcs.Wtbarr\n    WcsError = _wcs.WcsError\n    SingularMatrixError = _wcs.SingularMatrixError\n    InconsistentAxisTypesError = _wcs.InconsistentAxisTypesError\n    InvalidTransformError = _wcs.InvalidTransformError\n    InvalidCoordinateError = _wcs.InvalidCoordinateError\n    NoSolutionError = _wcs.NoSolutionError\n    InvalidSubimageSpecificationError = _wcs.InvalidSubimageSpecificationError\n    NonseparableSubimageCoordinateSystemError = _wcs.NonseparableSubimageCoordinateSystemError\n    NoWcsKeywordsFoundError = _wcs.NoWcsKeywordsFoundError\n    InvalidTabularParametersError = _wcs.InvalidTabularParametersError\n    InvalidPrjParametersError = _wcs.InvalidPrjParametersError\n\n    # Copy all the constants from the C extension into this module's namespace\n    for key, val in _wcs.__dict__.items():\n        if key.startswith(('WCSSUB_', 'WCSHDR_', 'WCSHDO_', 'WCSCOMPARE_', 'PRJ_')):\n            locals()[key] = val\n            __all__.append(key)\n\n    # Set coordinate extraction callback for WCS -TAB:\n    def _load_tab_bintable(hdulist, extnam, extver, extlev, kind, ttype, row, ndim):\n        arr = hdulist[(extnam, extver)].data[ttype][row - 1]\n\n        if arr.ndim != ndim:\n            if kind == 'c' and ndim == 2:\n                arr = arr.reshape((arr.size, 1))\n            else:\n                raise ValueError(\"Bad TDIM\")\n\n        return np.ascontiguousarray(arr, dtype=np.double)\n\n    _wcs.set_wtbarr_fitsio_callback(_load_tab_bintable)\n\nelse:\n    WCSBase = object\n    Wcsprm = object\n    DistortionLookupTable = object\n    Sip = object\n    Tabprm = object\n    Wtbarr = object\n    WcsError = None\n    SingularMatrixError = None\n    InconsistentAxisTypesError = None\n    InvalidTransformError = None\n    InvalidCoordinateError = None\n    NoSolutionError = None\n    InvalidSubimageSpecificationError = None\n    NonseparableSubimageCoordinateSystemError = None\n    NoWcsKeywordsFoundError = None\n    InvalidTabularParametersError = None\n\nWCSHDO_SIP = 0x80000\n\nSIP_KW = re.compile('''^[AB]P?_1?[0-9]_1?[0-9][A-Z]?$''')"},{"fileName":"conftest.py","filePath":"astropy/wcs/tests","id":7608,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport pytest\n\nfrom astropy import wcs\n\nfrom . helper import SimModelTAB\n\n\n@pytest.fixture(scope='module')\ndef tab_wcs_2di():\n    model = SimModelTAB(nx=150, ny=200)\n\n    # generate FITS HDU list:\n    hdulist = model.hdulist\n\n    # create WCS object:\n    w = wcs.WCS(hdulist[0].header, hdulist)\n\n    return w\n\n\n@pytest.fixture(scope='module')\ndef tab_wcsh_2di():\n    model = SimModelTAB(nx=150, ny=200)\n\n    # generate FITS HDU list:\n    hdulist = model.hdulist\n\n    # create WCS object:\n    w = wcs.WCS(hdulist[0].header, hdulist)\n\n    return w, hdulist\n\n\n@pytest.fixture(scope='function')\ndef tab_wcs_2di_f():\n    model = SimModelTAB(nx=150, ny=200)\n\n    # generate FITS HDU list:\n    hdulist = model.hdulist\n\n    # create WCS object:\n    w = wcs.WCS(hdulist[0].header, hdulist)\n\n    return w\n\n\n@pytest.fixture(scope='function')\ndef prj_TAB():\n    prj = wcs.Prjprm()\n    prj.code = 'TAN'\n    prj.set()\n    return prj\n"},{"id":7609,"name":"astropy/wcs/tests/data","nodeType":"Package"},{"id":7610,"name":"header_with_time_wcslib71.fits","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"SIMPLE  =                    F / Conforms to FITS standard?  NO!                BITPIX  =                  -32 / IEEE single precision floating point           NAXIS   =                    0 / No image data                                                                                                                  CRPIX1A =                513.0 / Pixel coordinate of reference point            CRPIX2A =                513.0 / Pixel coordinate of reference point            CRPIX3A =               1025.0 / Pixel coordinate of reference point            CRPIX4A =                  1.0 / Pixel coordinate of reference point            PC1_1A  =          0.866025404 / Linear transformation matrix element           PC1_2A  =          0.500000000 / Linear transformation matrix element           PC2_1A  =         -0.500000000 / Linear transformation matrix element           PC2_2A  =          0.866025404 / Linear transformation matrix element                                                                                           CDELT1A =                -0.10 / [deg] x-scale                                  CUNIT1A = 'deg'                / Degree units are required                      CTYPE1A = 'RA---SZP'           / Right ascension in slant zenithal projection   CRVAL1A =                150.0 / [deg] Right ascension at the reference point   CNAME1A = 'Right ascension (J2000)' / Axis name for labelling purposes          CDELT2A =                 0.10 / [deg] y-scale                                  CUNIT2A = 'deg'                / Degree units are required                      CTYPE2A = 'DEC--SZP'           / Declination in a slant zenithal projection     CRVAL2A =                -30.0 / [deg] Declination at the reference point       CNAME2A = 'Declination (J2000)' / Axis name for labelling purposes              PV1_1A  =                  0.0 / [deg] Native longitude of the reference point  PV1_2A  =                 90.0 / [deg] Native latitude  of the reference point  PV1_3A  =                195.0 / [deg] LONPOLEa by another name (precedence)    PV1_4A  =                999.0 / [deg] LATPOLEa by another name (precedence)    PV2_1A  =                  0.0 / SZP distance, in spherical radii               PV2_2A  =                180.0 / [deg] SZP P-longitude                          PV2_3A  =                 45.0 / [deg] SZP P-latitude                           LONPOLEA=                195.0 / [deg] Native longitude of the NCP              LATPOLEA=                999.0 / [deg] Native latitude of the NCP               RADESYSA= 'FK5'                / Mean equatorial coordinates, IAU 1984 system   EQUINOXA=               2000.0 / [yr] Equinox of equatorial coordinates                                                                                         CDELT3A =      -9.635265432E-6 / [m] Wavelength scale                           CUNIT3A = 'm'                  / Wavelength units                               CTYPE3A = 'WAVE-F2W'           / Frequency axis expressed as wavelength         CRVAL3A =          0.214982042 / [m] Reference wavelength                       CNAME3A = 'Wavelength'         / Axis name for labelling purposes               CRDER3A =              1.0E-11 / [m] Wavelength calibration, random error       CSYER3A =              1.0E-12 / [m] Wavelength calibration, systematic error   RESTFRQA=         1.42040575E9 / [Hz] HI rest frequency                         RESTWAVA=          0.211061141 / [m] HI rest wavelength                         SPECSYSA= 'BARYCENT'           / Reference frame of spectral coordinates        SSYSOBSA= 'TOPOCENT'           / Reference frame of observation                 VELOSYSA=               1500.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCA= 'LSRK'               / Reference frame of source redshift             ZSOURCEA=               0.0025 / Redshift of the source                                                                                                         CDELT4A =                  1.0 / [s] Time scale                                 CUNIT4A = 's'                  / Time units                                     CTYPE4A = 'TIME    '           / String value and comment containing quotes (') CRVAL4A =                 -2E3 / [s] Time at the reference point                CNAME4A = 'Time offset'        / Axis name for labelling purposes               PS4_0A  = 'UTC'                / Time measurement system                                                                                                        DATEREFA= '1858-11-17'         / ISO-8601 fiducial time                         MJDREFIA=                  0.0 / [d] MJD of fiducial time, integer part         MJDREFFA=                  0.0 / [d] MJD of fiducial time, fractional part      UNDEF   =                      / Undefined keyvalue                             TRUE    =                    T / Logical                                        FALSE   =                    F / Logical                                        INT32   =          00000012345 / Not a 64-bit integer                           INT32   =     -000000123456789 / Not a 64-bit integer                           INT32   =          -2147483648 / Not a 64-bit integer (INT_MIN)                 INT32   =           2147483647 / Not a 64-bit integer (INT_MAX)                 INT32   =    0000000000000000000000000000000000012345 / Not a very long integer INT32   =       -000000000000000000000000000123456789 / Not a very long integer INT64   =          -2147483649 / 64-bit integer (INT_MIN - 1)                   INT64   =          +2147483648 / 64-bit integer (INT_MAX + 1)                   INT64   =  +100000000000000000 / 64-bit integer                                 INT64   =  -876543210987654321 / 64-bit integer                                 INT64   = -9223372036854775808 / Not a very long integer (LONG_MIN)             INT64   = +9223372036854775807 / Not a very long integer (LONG_MAX)             INT64   = -000000000000000000000000000000876543210987654321 / 64-bit integer    INTVL   = -9223372036854775809 / Very long integer (LONG_MIN - 1)               INTVL   = +9223372036854775808 / Very long integer (LONG_MAX + 1)               INTVL   = -100000000000000000000000000000876543210987654321 / Very-long integer INTVL   = +123456789012345678901234567890123456789012345678901234567890123456789INTVL   = 1234567890123456789012345678901234567890123456789012345678901234567890FLOAT   =        3.14159265358 / Floating point                                 FLOAT   =      1.602176565E-19 / Floating point, lower-case exp allowed         FLOAT   =      2.99792458E8    / Floating point                                 FLOAT   =       6.62606957D-34 / Floating point, lower-case exp allowed         FLOAT   =        6.02214129D23 / Floating point                                 COMPLEX =            (137, -1) / An integer complex keyvalue                    COMPLEX =         (10E5, -0.1) / A floating point complex keyvalue              GOODSTR =     '\"G''DAY\"  '     / A valid string keyvalue                        BLANKS  =   '              '   / An all-blank string equals a single blank      LONGSTR = 'The loooooongest possible non-continued string value, 68 characters.'END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"id":7611,"name":"defunct_keywords.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"SIMPLE  =                    T / Uncompressed file's conforms to FITS           BITPIX  =                   16 / data type of original image                    NAXIS   =                    2 / dimension of original image                    NAXIS1  =                  720 / length of original image axis                  NAXIS2  =                  720 / length of original image axis                  PSLIB_V = '34286   '                                                            MODULE_V= '34287:34288'                                                         PHOT_V  = '34286:34322'                                                         STATS_V = '34286   '                                                            STACK_V = '34286   '                                                            HISTORY ppStack source: 60eb6cdc-a59c-4636-a4e0-dba66a9721fd                    NINPUTS =                   18 / Number of input images                         STK_TYPE= 'DEEP_STACK'         / type of stack                                  STK_ID  = '1237984 '           / type of stack                                  SKYCELL = 'skycell.0680.071'   / type of stack                                  TESS_ID = 'RINGS.V3'           / type of stack                                  AIRM_SLP=                   0. / airmass slope                                  PSCAMERA= 'GPC1    '           / Camera name                                    PSFORMAT= 'SKYCELL '           / Camera format                                  IMAGEID =              1237984 / Image identifier                               SOURCEID=                   35 / Source identifier                              CTYPE1  = 'RA---TAN'                                                            CTYPE2  = 'DEC--TAN'                                                            CRVAL1  =     205.063293456991                                                  CRVAL2  =    -29.9999999999985                                                  CRPIX1  =              17900.5                                                  CRPIX2  =             -13877.5                                                  CDELT1  = 6.94444461259981E-05                                                  CDELT2  = 6.94444461259981E-05                                                  PC001001=                  -1.                                                  PC001002=                   0.                                                  PC002001=                   0.                                                  PC002002=                   1.                                                  RA_DEG  =         206.45559692 / Right Ascension of stamp center                DEC_DEG =         -29.00419807 / Declination of stamp center                    BSCALE  =   1.073792648315E+01 / Scaling: TRUE = BZERO + BSCALE * DISK          BZERO   =   3.501794623489E+05 / Scaling: TRUE = BZERO + BSCALE * DISK          BLANK   =                32767 / Value for undefined pixels                     ZBLANK  =                32767 / Value for undefined pixels                     END"},{"id":7612,"name":"outside_sky.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"SIMPLE  =                    T  /                                               BITPIX  =                  -32  /                                               NAXIS   =                    2  /                                               NAXIS1  =                 2048  /                                               NAXIS2  =                 2048  /                                               EXTEND  =                    T  /                                               BSCALE  =    1.00000000000E+00  /                                               BZERO   =    0.00000000000E+00  /                                               CDELT1  =   -8.19629704013E-02  /                                               CRPIX1  =    1.02500000000E+03  /                                               CRVAL1  =             79.95701                                                  CTYPE1  = 'RA---SIN'  /                                                         CDELT2  =    8.19629704013E-02  /                                               CRPIX2  =    1.02500000000E+03  /                                               CRVAL2  =              -45.779                                                  CTYPE2  = 'DEC--SIN'  /                                                         EPOCH   =    2.00000000000E+03  /                                               PV2_1   =   -0.755124458581295                                                  PV2_2   =    0.209028857410973\n"},{"id":7613,"name":"validate.5.0.txt","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"HDU 1:\n  WCS key ' ':\n    - RADECSYS= 'ICRS ' / Astrometric system\n      the RADECSYS keyword is deprecated, use RADESYSa.\n    - The WCS transformation has more axes (2) than the image it is\n      associated with (0)\n    - Removed redundant SCAMP distortion parameters because SIP\n      parameters are also present\n\nHDU 2:\n  WCS key ' ':\n    - The WCS transformation has more axes (3) than the image it is\n      associated with (0)\n    - 'celfix' made the change 'In CUNIT3 : Mismatched units type\n      'length': have 'Hz', want 'm''.\n    - 'unitfix' made the change 'Changed units: 'HZ      ' -> 'Hz''.\n"},{"id":7614,"name":"sub-segfault.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"WCSAXES =                    4 / Number of coordinate axes\nCRPIX1  =                 8193 / Pixel coordinate of reference point\nCRPIX2  =                 8193 / Pixel coordinate of reference point\nCRPIX3  =                    1 / Pixel coordinate of reference point\nCRPIX4  =                    1 / Pixel coordinate of reference point\nCDELT1  =   -0.000555555555556 / [deg] Coordinate increment at reference point\nCDELT2  =    0.000555555555556 / [deg] Coordinate increment at reference point\nCDELT3  =                    1 / Coordinate increment at reference point\nCDELT4  =             33333332 / [Hz] Coordinate increment at reference point\nCUNIT1  = 'deg'                / Units of coordinate increment and value\nCUNIT2  = 'deg'                / Units of coordinate increment and value\nCUNIT4  = 'Hz'                 / Units of coordinate increment and value\nCTYPE1  = 'RA---SIN'           / Right ascension, orthographic/synthesis project\nCTYPE2  = 'DEC--SIN'           / Declination, orthographic/synthesis projection\nCTYPE3  = 'STOKES'             / Coordinate type code\nCTYPE4  = 'FREQ'               / Frequency (linear)\nCRVAL1  =        35.3324166667 / [deg] Coordinate value at reference point\nCRVAL2  =       -4.51685555556 / [deg] Coordinate value at reference point\nCRVAL3  =                    1 / Coordinate value at reference point\nCRVAL4  =        322601561.836 / [Hz] Coordinate value at reference point\nLONPOLE =                  180 / [deg] Native longitude of celestial pole\nLATPOLE =       -4.51685555556 / [deg] Native latitude of celestial pole\nRESTFRQ =            306000000 / [Hz] Line rest frequency\nRESTWAV =                    0 / [Hz] Line rest wavelength\nEQUINOX =                 2000 / [yr] Equinox of equatorial coordinates\nSPECSYS = 'TOPOCENT'           / Reference frame of spectral coordinates\nMJD-OBS =                55794 / [d] MJD of observation matching DATE-OBS\nDATE-OBS= '2011-08-21T00:00:00.000000' / ISO-8601 observation date matching MJD-"},{"id":7615,"name":"siponly.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"SIMPLE  =                    T / Fits standard                                  BITPIX  =                  -32 / FOUR-BYTE SINGLE PRECISION FLOATING POINT      NAXIS   =                    2 / STANDARD FITS FORMAT                           NAXIS1  =                 2048 / STANDARD FITS FORMAT                           NAXIS2  =                 4096 / STANDARD FITS FORMAT                           ORIGIN  = 'Palomar Transient Factory' / Origin of these image data              CREATOR = 'Infrared Processing and Analysis Center' / Creator of this FITS file TELESCOP= 'P48     '           / Name of telescope                              INSTRUME= 'PTF/MOSAIC'         / Instrument name                                OBSERVER= 'KulkarniPTF'        / Observer name and project                      CCDID   = '5       '           / CCD number (0..11)                             DATE-OBS= '2014-07-31T04:49:58.673' / UTC shutter time YYYY-MM-DDTHH:MM:SS.SSS  DATE    = '2014-07-31T19:20:32' / File creation date (YYYY-MM-DDThh:mm:ss UT)   REFERENC= 'http://www.astro.caltech.edu/ptf' / URL of PTF website                                                                                                         / PROPOSAL INFORMATION                                                                                                                                PTFPRPI = 'Kulkarni'           / PTF Project PI                                 PTFPID  = '52002   '           / Project type: 00000-49999                      OBJECT  = 'Galactic_Plane'     / Fields object                                  PTFFIELD= '1549    '           / PTF unique field ID                            PTFFLAG = '1       '           / 1 = PTF; 0 = non-PTF category                                                                                                            / TIME AND EXPOSURE INFORMATION                                                                                                                       FILTER  = 'R       '           / Filter name                                    FILTERID= '2       '           / Filter ID                                      FILTERSL= '1       '           / Filter changer slot position                   EXPTIME =                  60. / [s] Requested exposure time                    AEXPTIME=                  60. / actual exposure time (sec)                     UTC-OBS = '2014-07-31T04:49:58.673' / UTC time shutter open YYYY-MM-DDTHH:MM:SS.OBSJD   =        2456869.70137 / [day] Julian day corresponds to UTC-OBS        OBSMJD  =          56869.20137 / MJD corresponds to UTC-OBS (day)               OBSLST  = '17:37:29.36'        / Mean LST corresponds to UTC-OBS 'HH:MM:SS.S'   HOURANG = '-0:42:20.82'        / Mean HA (sHH:MM:SS.S) based on LMST at UTC-OBS HJD     =        2456869.70618 / [day] Heliocentric Julian Day                  OBSTYPE = 'object  '           / Image type (dark,science,bias,focus)           IMGTYP  = 'object  '           / Image type (dark,science,bias,focus)                                                                                                     / MOON AND SUN                                                                                                                                        MOONRA  =           173.116974 / [deg] Moon J2000.0 R.A.                        MOONDEC =            -0.404999 / [deg] Moon J2000.0 Dec.                        MOONILLF=             0.155837 / [frac] Moon illuminated fraction               MOONPHAS=             133.4978 / [deg] Moon phase angle                         MOONESB =                  -0. / Moon excess in sky brightness V-band           MOONALT =            -1.271649 / [deg] Moon altitude                            SUNAZ   =             312.4731 / [deg] Sun azimuth                              SUNALT  =            -22.25475 / [deg] Sun altitude                                                                                                                       / PHOTOMETRY                                                                                                                                          BUNIT   = 'DN      '           / Data number (analog-to-digital units or ADU)   PHTCALEX=                    1 / Was phot.-cal. module executed?                PHTCALFL=                    0 / Flag for image is photometric (0=N, 1=Y)       PCALRMSE=             0.171135 / RMSE from (zeropoint, extinction) data fit     IMAGEZPT=             21.22791 / Image magnitude zeropoint                      IZPORIG = 'CALTRANS'           / Photometric-calibration origin                 ZPRULE  = 'COMPUTE '           / Photometric-calibration method                 MAGZPT  =             23.55079 / Magnitude zeropoint at airmass=1               EXTINCT =             1.163014 / Extinction                                     APSFILT = 'r       '           / SDSS filter used in abs phot cal               APSCOL  = 'r-i     '           / SDSS color used in abs phot cal                APRMS   =           0.06677995 / RMS in mag of final abs phot cal               APBSRMS =           0.05033556 / RMS in mag of final abs phot cal for bright staAPNSTDI1=               308233 / Number of standard stars in first iteration    APNSTDIF=               274569 / Number of standard stars in final iteration    APCHI2  =     1861590.34570444 / Chi2 of final abs phot cal                     APDOF   =              274569. / Dof of chi2 of final abs phot cal              APMEDJD =     2456869.84882722 / Median JD used in abs phot cal                 APPN01  = 'ZeroPoint'          / Name of parameter abs phot cal 01              APPAR01 =          23.67499643 / Value of parameter abs phot cal 01             APPARE01=           0.00324545 / Error of parameter abs phot cal 01             APPN02  = 'ColorTerm'          / Name of parameter abs phot cal 02              APPAR02 =           0.44908632 / Value of parameter abs phot cal 02             APPARE02=           0.00423336 / Error of parameter abs phot cal 02             APPN03  = 'AirMassTerm'        / Name of parameter abs phot cal 03              APPAR03 =          -0.18342823 / Value of parameter abs phot cal 03             APPARE03=           0.00288243 / Error of parameter abs phot cal 03             APPN04  = 'AirMassColorTerm'   / Name of parameter abs phot cal 04              APPAR04 =          -0.14534473 / Value of parameter abs phot cal 04             APPARE04=           0.00381178 / Error of parameter abs phot cal 04             APPN05  = 'TimeTerm'           / Name of parameter abs phot cal 05              APPAR05 =           0.42239539 / Value of parameter abs phot cal 05             APPARE05=            0.0019644 / Error of parameter abs phot cal 05             APPN06  = 'Time2Term'          / Name of parameter abs phot cal 06              APPAR06 =           0.16770061 / Value of parameter abs phot cal 06             APPARE06=           0.01549427 / Error of parameter abs phot cal 06             APPN07  = 'XTerm   '           / Name of parameter abs phot cal 07              APPAR07 =           0.02152189 / Value of parameter abs phot cal 07             APPARE07=           0.00047932 / Error of parameter abs phot cal 07             APPN08  = 'YTerm   '           / Name of parameter abs phot cal 08              APPAR08 =           0.02739724 / Value of parameter abs phot cal 08             APPARE08=           0.00117248 / Error of parameter abs phot cal 08             APPN09  = 'Y2Term  '           / Name of parameter abs phot cal 09              APPAR09 =           0.01522565 / Value of parameter abs phot cal 09             APPARE09=            0.0018581 / Error of parameter abs phot cal 09             APPN10  = 'Y3Term  '           / Name of parameter abs phot cal 10              APPAR10 =          -0.23390906 / Value of parameter abs phot cal 10             APPARE10=           0.00723349 / Error of parameter abs phot cal 10             APPN11  = 'XYTerm  '           / Name of parameter abs phot cal 11              APPAR11 =          -0.00677493 / Value of parameter abs phot cal 11             APPARE11=           0.00169149 / Error of parameter abs phot cal 11                                                                                                       / ASTROMETRY                                                                                                                                          CRVAL1  =     274.806945708898 / [deg] RA of reference point                    CRVAL2  =    -25.9746476963393 / [deg] DEC of reference point                   CRPIX1  =             -3925.16 / [pix] Image reference point                    CRPIX2  =              4360.23 / [pix] Image reference point                    CTYPE1  = 'RA---TAN-SIP'       / TAN (gnomic) projection + SIP distortions      CTYPE2  = 'DEC--TAN-SIP'       / TAN (gnomic) projection + SIP distortions      CUNIT1  = 'deg     '           / Image axis-1 celestial-coordinate units        CUNIT2  = 'deg     '           / Image axis-2 celestial-coordinate units        CRTYPE1 = 'deg     '           / Data units of CRVAL1                           CRTYPE2 = 'deg     '           / Data units of CRVAL2                           CD1_1   = 0.000286102658601581 / Transformation matrix                          CD1_2   = -6.28816628331811E-07                                                 CD2_1   = -5.77207018114522E-06                                                 CD2_2   = -0.000281525256171892                                                 OBJRA   = '18:18:56.842'       / Requested field J2000.0 Ra.                    OBJDEC  = '-25:52:30.00'       / Requested field J2000.0 Dec.                   OBJRAD  =            274.73684 / [deg] Requested field RA (J2000.0)             OBJDECD =              -25.875 / [deg] Requested field Dec (J2000.0)            PIXSCALE=                 1.01 / [arcsec/pix] Pixel scale                       EQUINOX =                2000. / [yr] Equatorial coordinates definition                                                                                                   / IMAGE QUALITY                                                                                                                                       SEEING  =                 2.95 / [pix] Seeing FWHM                              PEAKDIST=    0.481336680505667 / [pix] Mean dist brightest pixel-centroid pixel ELLIP   =                0.313 / Mean image ellipticity A/B                     ELLIPPA =                48.58 / [deg] Mean image ellipticity PA                FBIAS   =             785.8855 / [DN] Floating bias of the image                SATURVAL=               50000. / [DN] Saturation value of the CCD array         FWHMSEX =                 2.45 / [arcsec] SExtractor SEEING estimate            MSMAPCZP=             19.20814 / [mag/s-arcsec^2] Median sky abs. phot. cal.    LMGAPCZP=             20.68008 / [mag/s-arcsec^2] Limiting mag. abs. phot. cal. MEDFWHM =             3.417924 / [arcsecond] Median FWHM                        MEDELONG=             1.406608 / [dimensionless] Median elongation              STDELONG=             0.592749 / [dimensionless] Std. dev. of elongation        MEDTHETA=            -31.22347 / [deg] Atan(median sin(theta)/median cos(theta))STDTHETA=             65.37225 / [deg] Atan(stddev sin(theta)/stddev cos(theta))MEDDLMAG=             2.444709 / [mag/s-arcsec^2] Median (MU_MAX-MAG_AUTO)      STDDLMAG=            0.4154117 / [mag/s-arcsec^2] Stddev of (MU_MAX-MAG_AUTO)                                                                                             / OBSERVATORY AND TCS                                                                                                                                 OCS_TIME= '2014-07-31T04:49:58.613' / UTC Date for OCS calc time-dep params     OPERMODE= 'OCS     '           / Mode of operation: OCS | Manual | N/A          SOFTVER = '1.1.1.1 '           / Softwere version (TCS.Camera.OCS.Sched)        OCS_VER = '1       '           / OCS software version and date                  TCS_VER = '1       '           / TCS software version and date                  SCH_VER = '1       '           / OCS-Scheduler software version and date        MAT_VER = '7.7.0.471'          / Matlab version                                 HDR_VER = '1       '           / Header version                                 TRIGGER = 'N/A     '           / trigger ID for TOO, e.g. VOEVENT-Nr            TCSMODE = 'Star    '           / TCS fundamental mode                           TCSSMODE= 'Active  '           / TCS fundamental submode                        TCSFMODE= 'Pos     '           / TCS focus mode                                 TCSFSMOD= 'On-Target'          / TCS focus submode                              TCSDMODE= 'Stop    '           / TCS dome mode                                  TCSDSMOD= 'N/A     '           / TCS dome submode                               TCSWMODE= 'Slave   '           / TCS windscreen mode                            TCSWSMOD= 'N/A     '           / TCS windscreen submode                         OBSLAT  =              33.3574 / [deg] Telescope geodetic latitude in WGS84     OBSLON  =            -116.8599 / [deg] Telescope geodetic longitude in WGS84    OBSALT  =               1703.2 / [m] Telescope geodetic altitude in WGS84       DEFOCUS =                   0. / [mm] Focus position - nominal focus            FOCUSPOS=               1.3655 / [mm] Exposures focusPos                        DOMESTAT= 'open    '           / Dome status at begining of exposure            TRACKRA =                 20.4 / [arcsec/hr] Track speed RA rel to sidereal     TRACKDEC=                 -3.9 / [arcsec/hr] Track speed Dec rel to sidereal    AZIMUTH =             169.2328 / [deg] Telescope Azimuth                        ALTITUDE=             29.95342 / [deg] Telescope altitude                       AIRMASS =             1.997293 / Telescope airmass                              TELRA   =             274.9591 / [deg] Telescope ap equinox of date RA          TELDEC  =             -25.8684 / [deg] Telescope ap equinox of date Dec         TELHA   =             349.4138 / [deg] Telescope ap equinox of date HA          DOMEAZ  =             169.4477 / [deg] Dome azimuth                             WINDSCAL=              12.8995 / [deg] Wind screen altitude                     WINDDIR =                  1.3 / [deg] Azimuth of wind direction                WINDSPED=               14.472 / Wind speed (km/hour)                           OUTTEMP =             22.16667 / [C] Outside temperature                        OUTRELHU=                0.513 / [frac] Outside relative humidity               OUTDEWPT=             11.61111 / [C] Outside dew point                                                                                                                    / INSTRUMENT TELEMETRY                                                                                                                                PANID   = '_p48m   '           / PAN identification                             DHSID   = '_p48m   '           / DHS identification                             CCDSEC  = '[1:2048,1:4096]'    / CCD section                                    CCDSIZE = '[1:2048,1:4096]'    / CCD size                                       DATASEC = '[1:2048,1:4096]'    / Data section                                   DETSEC  = '[1:2048,1:4096]'    / Detector section                               ROISEC  = '[1:2048,1:4096]'    / ROI section                                    FPA     = 'P48MOSAIC'          / Focal plan array                               CCDNAME = 'W53C2   '           / Detector mfg serial number                     CHECKSUM= 'fGoXhEmXfEmXfEmX'   / Image header unit checksum                     DATASUM = '2019013917'         / Image data unit checksum                       DHEINF  = 'SDSU, Gen-III'      / Controller info                                DHEFIRM = '/usr/src/dsp/20090618/tim_m.lod' / DSP software                      CAM_VER = '20090615.1.3.100000' / Camera server date.rev.cfitsio                LV_VER  = '8.5     '           / LabVIEW software version                       PCI_VER = '2.0c    '           / Astropci software version                      DETID   = 'PTF/MOSAIC'         / Detector ID                                    AUTHOR  = 'PTF/OCS/TCS/Camera' / Source for header information                  DATAMIN =                   0. / Minimum value for array                        ROISTATE= 'ROI     '           / ROI State (FULL | ROI)                         LEDBLUE = 'OFF     '           / 470nm LED state (ON | OFF)                     LEDRED  = 'OFF     '           / 660nm LED state (ON | OFF)                     LEDNIR  = 'OFF     '           / 880nm LED state (ON | OFF)                     CCD9TEMP=              174.988 / [K] 0x0 servo temp sensor on CCD09             HSTEMP  =              152.111 / [K] 0x1 heat spreader temp                     DHE0TEMP=              301.098 / [K] 0x2 detector head electronics temp, master DHE1TEMP=              303.178 / [K] 0x3 detector head electronics temp, slave  DEWWTEMP=               287.05 / [K] 0x4 dewar wall temp                        HEADTEMP=              142.103 / [K] 0x5 cryo cooler cold head temp             CCD5TEMP=              175.963 / [K] 0x6 temp sensor on CCD05                   CCD11TEM=              177.375 / [K] 0x7 temp sensor on CCD11                   CCD0TEMP=              170.213 / [K] 0x8 temp sensor on CCD00                   RSTEMP  =              238.936 / [K] 0x9 temp sensor on radiation shield        DEWPRESS=                  40. / [milli-torr] Dewar pressure                    DETHEAT =                  1.6 / [%] Detector focal plane heater power          NAMPSXY = '6 2     '           / Number of amplifiers in x y                    CCDSUM  = '1 1     '           / [pix] Binning in x and y                       MODELFOC= 'N/A     '           / MODELFOC                                       EXPCKSUM= 'fGoXhEmXfEmXfEmX'   / Primary header unit checksum                   EXPDTSUM= '2019013917'         / Primary data unit checksum                     GAIN    =                  1.7 / [e-/D.N.] Gain of detector.                    READNOI =                  3.4 / [e-] Read noise of detector.                   DARKCUR =                  0.1 / [e-/s] Dark current of detector                                                                                                          / SCAMP DISTORTION KEYWORDS                                                                                                                           RADECSYS= 'ICRS    '           / Astrometric system                             FGROUPNO=                    1 / SCAMP field group label                        ASTIRMS1=                   0. / Astrom. dispersion RMS (intern., high S/N)     ASTIRMS2=                   0. / Astrom. dispersion RMS (intern., high S/N)     ASTRRMS1=         2.362887E-05 / Astrom. dispersion RMS (ref., high S/N)        ASTRRMS2=          2.36868E-05 / Astrom. dispersion RMS (ref., high S/N)        ASTINST =                    1 / SCAMP astrometric instrument label             FLXSCALE=                   0. / SCAMP relative flux scale                      MAGZEROP=                   0. / SCAMP zero-point                               PHOTIRMS=                   0. / mag dispersion RMS (internal, high S/N)        RA_RMS  =            0.1040474 / [arcsec] RMS of SCAMP fit from 2MASS matching  DEC_RMS =            0.1017731 / [arcsec] RMS of SCAMP fit from 2MASS matching  ASTROMN =                 2636 / Number of stars in SCAMP astrometric solution  SCAMPPTH= 'NotAvailable'       / SCAMP catalog path                             SCAMPFIL= 'NotAvailable'       / SCAMP catalog file                                                                                                                       / SIP DISTORTION KEYWORDS                                                                                                                             A_ORDER =                    4 / Distortion order for A                         A_0_2   = -6.88320772436348E-08 / Projection distortion parameter               A_0_3   = -3.9165520771852E-11 / Projection distortion parameter                A_0_4   = -1.37347903340862E-15 / Projection distortion parameter               A_1_1   = 1.47451309698268E-06 / Projection distortion parameter                A_1_2   = -5.47895978084324E-11 / Projection distortion parameter               A_1_3   = 4.32571760220798E-15 / Projection distortion parameter                A_2_0   = -4.61014380203131E-06 / Projection distortion parameter               A_2_1   = -3.25701227339755E-10 / Projection distortion parameter               A_2_2   = 5.87253012315133E-15 / Projection distortion parameter                A_3_0   = 5.10801798928538E-10 / Projection distortion parameter                A_3_1   = 2.40245891539354E-14 / Projection distortion parameter                A_4_0   = -2.24100384816689E-14 / Projection distortion parameter               A_DMAX  =     96.5018681533569 / Projection distortion parameter                B_ORDER =                    4 / Distortion order for B                         B_0_2   = 2.10619568626298E-07 / Projection distortion parameter                B_0_3   = -5.06225421390773E-12 / Projection distortion parameter               B_0_4   = 5.17539616845577E-16 / Projection distortion parameter                B_1_1   = 5.91465601878924E-08 / Projection distortion parameter                B_1_2   = -5.12374109506712E-11 / Projection distortion parameter               B_1_3   = -1.85594858389364E-15 / Projection distortion parameter               B_2_0   = -6.29264904991201E-06 / Projection distortion parameter               B_2_1   = -6.77151075883653E-11 / Projection distortion parameter               B_2_2   = 3.33079437463431E-15 / Projection distortion parameter                B_3_0   = 8.62409953895856E-10 / Projection distortion parameter                B_3_1   = 4.00773353822356E-15 / Projection distortion parameter                B_4_0   = -4.38536973214709E-14 / Projection distortion parameter               B_DMAX  =     95.5403565807527 / Projection distortion parameter                AP_ORDER=                    4 / Distortion order for AP                        AP_0_1  = -8.35636338195056E-06 / Projection distortion parameter               AP_0_2  = 6.41919370738511E-08 / Projection distortion parameter                AP_0_3  = 3.82575929801279E-11 / Projection distortion parameter                AP_0_4  = 1.34695941598154E-15 / Projection distortion parameter                AP_1_0  = 5.96496231342059E-06 / Projection distortion parameter                AP_1_1  = -1.47551597085589E-06 / Projection distortion parameter               AP_1_2  =  5.9682183111397E-11 / Projection distortion parameter                AP_1_3  = -4.07431356348696E-15 / Projection distortion parameter               AP_2_0  = 4.63912798241099E-06 / Projection distortion parameter                AP_2_1  =  3.2299095062767E-10 / Projection distortion parameter                AP_2_2  = -6.30497770263709E-15 / Projection distortion parameter               AP_3_0  = -5.03018200403734E-10 / Projection distortion parameter               AP_3_1  = -2.35315281608906E-14 / Projection distortion parameter               AP_4_0  = 2.13944449467657E-14 / Projection distortion parameter                BP_ORDER=                    4 / Distortion order for BP                        BP_0_1  = -5.35341799909328E-06 / Projection distortion parameter               BP_0_2  = -2.17548011382368E-07 / Projection distortion parameter               BP_0_3  = 3.46141884836402E-12 / Projection distortion parameter                BP_0_4  = -5.50225060304376E-16 / Projection distortion parameter               BP_1_0  = 2.24406272193445E-05 / Projection distortion parameter                BP_1_1  = -5.78663264876419E-08 / Projection distortion parameter               BP_1_2  =  5.4445150144274E-11 / Projection distortion parameter                BP_1_3  = 2.29942375548271E-15 / Projection distortion parameter                BP_2_0  = 6.33813482510013E-06 / Projection distortion parameter                BP_2_1  = 5.99623548359284E-11 / Projection distortion parameter                BP_2_2  = -3.3053766170687E-15 / Projection distortion parameter                BP_3_0  = -8.55094688760831E-10 / Projection distortion parameter               BP_3_1  = -2.73327308556661E-15 / Projection distortion parameter               BP_4_0  = 4.26704732113368E-14 / Projection distortion parameter                                                                                                          / DATA FLOW                                                                                                                                           ORIGNAME= '/data/PTF_default_37806.fits' / Filename as written by the camera    FILENAME= 'PTF201407312014_2_o_37806.fits' / Filename of delivered camera image PROCORIG= 'IPAC-PTF pipelines' / Processing origin                              PROCDATE= 'Fri Sep 26 14:52:55 2014' / Processing date/time (Pacific time)      PTFVERSN=                   5. / Version of PTFSCIENCEPIPELINE program          PMASKPTH= '/ptf/pos/archive/fallbackcal/pmasks/' / Pathname of pixel mask       PMASKFIL= '70sOn35s_pixmask_chip5.trimmed.v4.fits' / Filename of pixel mask     SFLATPTH= '/ptf/pos/sbx2/2014/07/31/f2/c5/cal/p4/cId112103/' / Pathname of superSFLATFIL= 'PTF_201407310000_i_s_flat_t120000_u000112103_f02_p000000_c05.fits'   SBIASPTH= '/ptf/pos/sbx2/2014/07/31/f2/c5/cal/p1/cId112095/' / Pathname of superSBIASFIL= 'PTF_201407310000_i_s_bias_t120000_u000112095_f00_p000000_c05.fits'   DBNID   =                 1938 / Database night ID                              DBEXPID =               446050 / Database exposure ID                           DBRID   =              6985566 / Database raw-image ID                          DBPID   =             21528832 / Database processed-image ID                    DBFID   =                    2 / Database filter ID                             DBPIID  =                    1 / Database P.I. ID                               DBPRID  =                   31 / Database project ID                            DBFIELD =               446050 / Database field ID                              DBSVID  =                   54 / Database software-version ID                   DBCVID  =                   60 / Database config-data-file ID                   INFOBITS=                    0 / Database infobits (2^2 and 2^3 excluded)       END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"id":7616,"name":"validate.txt","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"HDU 1:\n  WCS key ' ':\n    - RADECSYS= 'ICRS ' / Astrometric system\n      RADECSYS is non-standard, use RADESYSa.\n    - The WCS transformation has more axes (2) than the image it is\n      associated with (0)\n    - Removed redundant SCAMP distortion parameters because SIP\n      parameters are also present\n\nHDU 2:\n  WCS key ' ':\n    - The WCS transformation has more axes (3) than the image it is\n      associated with (0)\n    - 'celfix' made the change 'In CUNIT3 : Mismatched units type\n      'length': have 'Hz', want 'm''.\n    - 'unitfix' made the change 'Changed units: 'HZ      ' -> 'Hz''.\n"},{"id":7617,"name":"validate.fits","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"SIMPLE  =                    T / conforms to FITS standard                      BITPIX  =                    8 / array data type                                NAXIS   =                    0 / number of array dimensions                     EXTEND  =                    T                                                  END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             XTENSION= 'IMAGE   '           / Image extension                                BITPIX  =                    8 / array data type                                NAXIS   =                    0 / number of array dimensions                     PCOUNT  =                    0 / number of parameters                           GCOUNT  =                    1 / number of groups                               ORIGIN  = 'Palomar Transient Factory' / Origin of these image data              CREATOR = 'Infrared Processing and Analysis Center' / Creator of this FITS file DATE    = '2011-08-01T15:14:04' / File creation date (YYYY-MM-DDThh:mm:ss UT)                                                                                             / PTF DMASK BIT DEFINITIONS                                                                                                                           BIT00   =                    0 / AIRCRAFT/SATELLITE TRACK                       BIT01   =                    1 / OBJECT (detected by SExtractor)                BIT02   =                    2 / HIGH DARK-CURRENT                              BIT03   =                    3 / RESERVED FOR FUTURE USE                        BIT04   =                    4 / NOISY                                          BIT05   =                    5 / GHOST                                          BIT06   =                    6 / CCD BLEED                                      BIT07   =                    7 / RAD HIT                                        BIT08   =                    8 / SATURATED                                      BIT09   =                    9 / DEAD/BAD                                       BIT10   =                   10 / NAN (not a number)                             BIT11   =                   11 / DIRTY (10-sigma below coarse local median)     BIT12   =                   12 / HALO                                           BIT13   =                   13 / RESERVED FOR FUTURE USE                        BIT14   =                   14 / RESERVED FOR FUTURE USE                        BIT15   =                   15 / RESERVED FOR FUTURE USE                                                                                                                  / DATA FLOW                                                                                                                                           PMASKPTH= '/ptf/pos/archive/fallbackcal/pmasks/' / Pixel-mask pathname          PMASKFIL= 'bpm_2009060s_c07.v2.fits' / Pixel-mask filename                      UDMPROC = 'updatemask'         / Update bit in dmask                            UDMVERSN=                   1. / Version of updatemask program                  UDMOP   =                    0 / Operation type                                 UDMMBT  =                    4 / Mask bit template                              UDMIFIL = 'bpm_2009060s_c07.v1.fits' / Program updatemask input file            UDMOFIL = 'bpm_2009060s_c07.v2.fits' / Program updatemask output file           MCVERSN =                   1. / Version of ptfMaskCombine program              PTFPPROC= 'ptfPostProc'        / Flags proc NaNs, CCD-bleeds and rad hits       PPRVERSN=                   3. / Version of ptfPostProc program                                                                                                           / COPY OF IMAGE HEADER BELOW                                                                                                                          ORIGIN  = 'Palomar Transient Factory' / Origin of these image data              CREATOR = 'Infrared Processing and Analysis Center' / Creator of this FITS file TELESCOP= 'P48     '           / Name of telescope                              INSTRUME= 'PTF/MOSAIC'         / Instrument name                                OBSERVER= 'KulkarniPTF'        / Observer name and project                      CCDID   = '7       '           / CCD number (0..11)                             DATE-OBS= '2009-06-25T08:41:23.970' / UTC shutter time YYYY-MM-DDTHH:MM:SS.SSS  DATE    = '2011-07-30T15:04:59' / File creation date (YYYY-MM-DDThh:mm:ss UT)   REFERENC= 'http://www.astro.caltech.edu/ptf' / URL of PTF website                                                                                                         / PROPOSAL INFORMATION                                                                                                                                PTFPRPI = 'Kulkarni'           / PTF Project PI                                 PTFPID  = '20000   '           / Project type: 00000-49999                      OBJECT  = 'PTF_survey'         / Fields object                                  PTFFIELD= '2899    '           / PTF unique field ID                            PTFFLAG = '1       '           / 1 = PTF; 0 = non-PTF category                                                                                                            / TIME AND EXPOSURE INFORMATION                                                                                                                       FILTER  = 'R       '           / Filter name                                    FILTERID= '2       '           / Filter ID                                      FILTERSL= '2       '           / Filter changer slot position                   EXPTIME =                  60. / [s] Requested exposure time                    AEXPTIME=                  60. / actual exposure time (sec)                     UTC-OBS = '2009-06-25T08:41:23.970' / UTC time shutter open YYYY-MM-DDTHH:MM:SS.OBSJD   =        2455007.86207 / [day] Julian day corresponds to UTC-OBS        OBSMJD  =          55007.36207 / MJD corresponds to UTC-OBS (day)               OBSLST  = '19:08:26.70'        / Mean LST corresponds to UTC-OBS 'HH:MM:SS.S'   HOURANG = '-3:09:09.78'        / Mean HA (sHH:MM:SS.S) based on LMST at UTC-OBS HJD     =        2455007.86457 / [day] Heliocentric Julian Day                  OBSTYPE = 'object  '           / Image type (dark,science,bias,focus)           IMGTYP  = 'object  '           / Image type (dark,science,bias,focus)                                                                                                     / MOON AND SUN                                                                                                                                        MOONRA  =           131.676395 / [deg] Moon J2000.0 R.A.                        MOONDEC =            16.207046 / [deg] Moon J2000.0 Dec.                        MOONILLF=             0.095389 / [frac] Moon illuminated fraction               MOONPHAS=             144.0201 / [deg] Moon phase angle                         MOONESB =                  -0. / Moon excess in sky brightness V-band           MOONALT =            -35.16959 / [deg] Moon altitude                            SUNAZ   =             13.90467 / [deg] Sun azimuth                              SUNALT  =            -31.96011 / [deg] Sun altitude                                                                                                                       / PHOTOMETRY                                                                                                                                          BUNIT   = 'DN      '           / Data number (analog-to-digital units or ADU)   PHTCALEX=                    1 / Was phot.-cal. module executed?                PHTCALFL=                    0 / Flag for image is photometric (0=N, 1=Y)       PCALRMSE=             0.030059 / RMSE from (zeropoint, extinction) data fit     IMAGEZPT=             22.43948 / Image magnitude zeropoint                      IZPORIG = 'CALTRANS'           / Photometric-calibration origin                 ZPRULE  = 'COMPUTE '           / Photometric-calibration method                 MAGZPT  =             22.73683 / Magnitude zeropoint at airmass=1               EXTINCT =              0.17995 / Extinction                                     APSFILT = 'r       '           / SDSS filter used in abs phot cal               APSCOL  = 'r-i     '           / SDSS color used in abs phot cal                APRMS   =            0.0554857 / RMS in mag of final abs phot cal               APBSRMS =           0.03911367 / RMS in mag of final abs phot cal for bright staAPNSTDI1=                69501 / Number of standard stars in first iteration    APNSTDIF=                64858 / Number of standard stars in final iteration    APCHI2  =      325618.88012443 / Chi2 of final abs phot cal                     APDOF   =               64858. / Dof of chi2 of final abs phot cal              APMEDJD =     2455007.84500722 / Median JD used in abs phot cal                 APPN01  = 'ZeroPoint'          / Name of parameter abs phot cal 01              APPAR01 =          22.81878918 / Value of parameter abs phot cal 01             APPARE01=           0.00198923 / Error of parameter abs phot cal 01             APPN02  = 'ColorTerm'          / Name of parameter abs phot cal 02              APPAR02 =           0.20481246 / Value of parameter abs phot cal 02             APPARE02=           0.00278076 / Error of parameter abs phot cal 02             APPN03  = 'AirMassTerm'        / Name of parameter abs phot cal 03              APPAR03 =          -0.12104427 / Value of parameter abs phot cal 03             APPARE03=            0.0011621 / Error of parameter abs phot cal 03             APPN04  = 'AirMassColorTerm'   / Name of parameter abs phot cal 04              APPAR04 =           0.00904321 / Value of parameter abs phot cal 04             APPARE04=           0.00176968 / Error of parameter abs phot cal 04             APPN05  = 'TimeTerm'           / Name of parameter abs phot cal 05              APPAR05 =           0.03012546 / Value of parameter abs phot cal 05             APPARE05=           0.00459951 / Error of parameter abs phot cal 05             APPN06  = 'Time2Term'          / Name of parameter abs phot cal 06              APPAR06 =           1.27460327 / Value of parameter abs phot cal 06             APPARE06=           0.07646497 / Error of parameter abs phot cal 06             APPN07  = 'XTerm   '           / Name of parameter abs phot cal 07              APPAR07 =           0.00768843 / Value of parameter abs phot cal 07             APPARE07=           0.00083226 / Error of parameter abs phot cal 07             APPN08  = 'YTerm   '           / Name of parameter abs phot cal 08              APPAR08 =           0.06680527 / Value of parameter abs phot cal 08             APPARE08=           0.00203667 / Error of parameter abs phot cal 08             APPN09  = 'Y2Term  '           / Name of parameter abs phot cal 09              APPAR09 =           0.31486016 / Value of parameter abs phot cal 09             APPARE09=           0.00318862 / Error of parameter abs phot cal 09             APPN10  = 'Y3Term  '           / Name of parameter abs phot cal 10              APPAR10 =           0.69934253 / Value of parameter abs phot cal 10             APPARE10=           0.01257477 / Error of parameter abs phot cal 10             APPN11  = 'XYTerm  '           / Name of parameter abs phot cal 11              APPAR11 =          -0.04590337 / Value of parameter abs phot cal 11             APPARE11=           0.00286729 / Error of parameter abs phot cal 11                                                                                                       / ASTROMETRY                                                                                                                                          CRVAL1  =     333.443801401309 / [deg] RA of reference point                    CRVAL2  =     3.08905544069643 / [deg] DEC of reference point                   CRPIX1  =             1175.019 / [pix] Image reference point                    CRPIX2  =             945.8826 / [pix] Image reference point                    CTYPE1  = 'RA---TAN-SIP'       / TAN (gnomic) projection + SIP distortions      CTYPE2  = 'DEC--TAN-SIP'       / TAN (gnomic) projection + SIP distortions      CUNIT1  = 'deg     '           / Image axis-1 celestial-coordinate units        CUNIT2  = 'deg     '           / Image axis-2 celestial-coordinate units        CRTYPE1 = 'deg     '           / Data units of CRVAL1                           CRTYPE2 = 'deg     '           / Data units of CRVAL2                           CD1_1   = 0.000281094342514378 / Transformation matrix                          CD1_2   = -5.00875320999652E-09                                                 CD2_1   = -2.08930602680508E-07                                                 CD2_2   = -0.000281284158795544                                                 OBJRA   = '22:17:08.571'       / Requested field J2000.0 Ra.                    OBJDEC  = '+03:22:30.00'       / Requested field J2000.0 Dec.                   OBJRAD  =           334.285714 / [deg] Requested field RA (J2000.0)             OBJDECD =                3.375 / [deg] Requested field Dec (J2000.0)            PIXSCALE=                 1.01 / [arcsec/pix] Pixel scale                       WCSAXES =                    2                                                  EQUINOX =                2000. / [yr] Equatorial coordinates definition         LONPOLE =                 180.                                                  LATPOLE =                   0.                                                                                                                                            / IMAGE QUALITY                                                                                                                                       SEEING  =                 2.04 / [pix] Seeing FWHM                              PEAKDIST=    0.396793397122491 / [pix] Mean dist brightest pixel-centroid pixel ELLIP   =                0.063 / Mean image ellipticity A/B                     ELLIPPA =                48.65 / [deg] Mean image ellipticity PA                FBIAS   =             1060.884 / [DN] Floating bias of the image                SATURVAL=               17000. / [DN] Saturation value of the CCD array         FWHMSEX =                 2.45 / [arcsec] SExtractor SEEING estimate            MDSKYMAG=             20.53072 / [mag/s-arcsec^2] Median sky obsolete           MSMAPCZP=             20.70926 / [mag/s-arcsec^2] Median sky abs. phot. cal.    LIMITMAG=             20.92587 / [mag/s-arcsec^2] Limiting magnitude obsolete   LMGAPCZP=             21.10442 / [mag/s-arcsec^2] Limiting mag. abs. phot. cal. MEDFWHM =             2.931446 / [arcsecond] Median FWHM                        MEDELONG=             1.132416 / [dimensionless] Median elongation              STDELONG=            0.3298569 / [dimensionless] Std. dev. of elongation        MEDTHETA=            -42.28234 / [deg] Atan(median sin(theta)/median cos(theta))STDTHETA=             66.21399 / [deg] Atan(stddev sin(theta)/stddev cos(theta))MEDDLMAG=             33.85928 / [mag/s-arcsec^2] Median (MU_MAX-MAG_AUTO)      STDDLMAG=            0.4367887 / [mag/s-arcsec^2] Stddev of (MU_MAX-MAG_AUTO)                                                                                             / OBSERVATORY AND TCS                                                                                                                                 OCS_TIME= '2009-06-25T08:41:23.978' / UTC Date for OCS calc time-dep params     OPERMODE= 'OCS     '           / Mode of operation: OCS | Manual | N/A          SOFTVER = '1.1.1.1 '           / Softwere version (TCS.Camera.OCS.Sched)        OCS_VER = '1       '           / OCS software version and date                  TCS_VER = '1       '           / TCS software version and date                  SCH_VER = '1       '           / OCS-Scheduler software version and date        MAT_VER = '7.7.0.471'          / Matlab version                                 HDR_VER = '1       '           / Header version                                 TRIGGER = 'N/A     '           / trigger ID for TOO, e.g. VOEVENT-Nr            TCSMODE = 'Star    '           / TCS fundamental mode                           TCSSMODE= 'Active  '           / TCS fundamental submode                        TCSFMODE= 'Pos     '           / TCS focus mode                                 TCSFSMOD= 'On-Target'          / TCS focus submode                              TCSDMODE= 'Stop    '           / TCS dome mode                                  TCSDSMOD= 'N/A     '           / TCS dome submode                               TCSWMODE= 'Slave   '           / TCS windscreen mode                            TCSWSMOD= 'N/A     '           / TCS windscreen submode                         OBSLAT  =              33.3574 / [deg] Telescope geodetic latitude in WGS84     OBSLON  =             116.8599 / [deg] Telescope geodetic longitude in WGS84    OBSALT  =               1703.2 / [m] Telescope geodetic altitude in WGS84       DEFOCUS =                   0. / [mm] Focus position - nominal focus            FOCUSPOS=               1.3851 / [mm] Exposures focusPos                        DOMESTAT= 'open    '           / Dome status at begining of exposure            TRACKRA =                 23.7 / [arcsec/hr] Track speed RA rel to sidereal     TRACKDEC=                -11.2 / [arcsec/hr] Track speed Dec rel to sidereal    AZIMUTH =             113.8682 / [deg] Telescope Azimuth                        ALTITUDE=             36.81047 / [deg] Telescope altitude                       AIRMASS =             1.666232 / Telescope airmass                              TELRA   =              334.402 / [deg] Telescope ap equinox of date RA          TELDEC  =               3.4225 / [deg] Telescope ap equinox of date Dec         TELHA   =             312.7096 / [deg] Telescope ap equinox of date HA          DOMEAZ  =             112.8563 / [deg] Dome azimuth                             WINDSCAL=               10.466 / [deg] Wind screen altitude                     WINDDIR =                  2.2 / [deg] Azimuth of wind direction                WINDSPED=              14.6328 / Wind speed (km/hour)                           OUTTEMP =             20.94444 / [C] Outside temperature                        OUTRELHU=                 0.09 / [frac] Outside relative humidity               OUTDEWPT=            -12.94444 / [C] Outside dew point                                                                                                                    / INSTRUMENT TELEMETRY                                                                                                                                PANID   = '_p48s   '           / PAN identification                             DHSID   = '_p48s   '           / DHS identification                             ROISTATE= 'ROI     '           / ROI State (FULL | ROI)                         CCDSEC  = '[1:2048,1:4096]'    / CCD section                                    CCDSIZE = '[1:2048,1:4096]'    / CCD size                                       DATASEC = '[1:2048,1:4096]'    / Data section                                   DETSEC  = '[1:2048,1:4096]'    / Detector section                               ROISEC  = '[1:2048,1:4096]'    / ROI section                                    FPA     = 'P48MOSAIC'          / Focal plan array                               CCDNAME = 'W94C2   '           / Detector mfg serial number                     CHECKSUM= 'O3aBP1ZBO1aBO1YB'   / HDU checksum updated 2010-03-15T13:06:37       DATASUM = '395763289'          / Data unit checksum updated 2010-03-15T13:06:37 DHEINF  = 'SDSU, Gen-III'      / Controller info                                DHEFIRM = '/usr/src/dsp/tim_m.lod' / DSP software                               CAM_VER = '20090615.1.3.100000' / Camera server date.rev.cfitsio                LV_VER  = '8.5     '           / LabVIEW software version                       PCI_VER = '2.0c    '           / Astropci software version                      DETID   = 'PTF/MOSAIC'         / Detector ID                                    AUTHOR  = 'PTF/OCS/TCS/Camera' / Source for header information                  DATAMIN =                   0. / Minimum value for array                        ROISTATE= 'ROI     '           / ROI State (FULL | ROI)                         LEDBLUE = 'OFF     '           / 470nm LED state (ON | OFF)                     LEDRED  = 'OFF     '           / 660nm LED state (ON | OFF)                     LEDNIR  = 'OFF     '           / 880nm LED state (ON | OFF)                     CCD9TEMP=              175.003 / [K] 0x0 servo temp sensor on CCD09             HSTEMP  =              148.207 / [K] 0x1 heat spreader temp                     DHE0TEMP=              295.951 / [K] 0x2 detector head electronics temp, master DHE1TEMP=              298.162 / [K] 0x3 detector head electronics temp, slave  DEWWTEMP=               284.71 / [K] 0x4 dewar wall temp                        HEADTEMP=              138.414 / [K] 0x5 cryo cooler cold head temp             CCD5TEMP=               174.91 / [K] 0x6 temp sensor on CCD05                   CCD11TEM=              176.061 / [K] 0x7 temp sensor on CCD11                   CCD0TEMP=              169.515 / [K] 0x8 temp sensor on CCD00                   RSTEMP  =               232.61 / [K] 0x9 temp sensor on radiation shield        DEWPRESS=                 0.82 / [milli-torr] Dewar pressure                    DETHEAT =                  38. / [%] Detector focal plane heater power          NAMPSXY = '6 2     '           / Number of amplifiers in x y                    CCDSUM  = '1 1     '           / [pix] Binning in x and y                       MODELFOC= 'N/A     '           / MODELFOC                                       CHECKSUM= '6aLZ8ZKZ6aKZ6YKZ'   / HDU checksum updated 2010-03-15T13:06:37       DATASUM = '         0'         / Data unit checksum (2010-03-15T13:06:37)       GAIN    =                  1.7 / [e-/D.N.] Gain of detector.                    READNOI =                  5.1 / [e-] Read noise of detector.                   DARKCUR =                  0.1 / [e-/s] Dark current of detector                                                                                                          / SCAMP DISTORTION KEYWORDS                                                                                                                           RADECSYS= 'ICRS    '           / Astrometric system                             PV1_0   =                   0. / Projection distortion parameter                PV1_1   =                   1. / Projection distortion parameter                PV1_2   =                   0. / Projection distortion parameter                PV1_4   = 0.000811808026654439 / Projection distortion parameter                PV1_5   = 0.000610424561546246 / Projection distortion parameter                PV1_6   = 0.000247550637436069 / Projection distortion parameter                PV1_7   = 0.000103962986153903 / Projection distortion parameter                PV1_8   = -0.000463678684598807 / Projection distortion parameter               PV1_9   = -0.000431244263972048 / Projection distortion parameter               PV1_10  = -0.000152691163850316 / Projection distortion parameter               PV1_12  = -0.00204628855915067 / Projection distortion parameter                PV1_13  = -0.00173071932398225 / Projection distortion parameter                PV1_14  = 0.000212015319199711 / Projection distortion parameter                PV1_15  = -0.000489268678679085 / Projection distortion parameter               PV1_16  = -0.000182891514774611 / Projection distortion parameter               PV2_0   =                   0. / Projection distortion parameter                PV2_1   =                   1. / Projection distortion parameter                PV2_2   =                   0. / Projection distortion parameter                PV2_4   = 0.000273521447624334 / Projection distortion parameter                PV2_5   = 0.000876139200581004 / Projection distortion parameter                PV2_6   = -0.000122736852992318 / Projection distortion parameter               PV2_7   = -0.00115870481394187 / Projection distortion parameter                PV2_8   = 0.000744209714565589 / Projection distortion parameter                PV2_9   = -0.00031431316953523 / Projection distortion parameter                PV2_10  = -0.00025720525696749 / Projection distortion parameter                PV2_12  = -0.00074859772103692 / Projection distortion parameter                PV2_13  = 0.000838107200656415 / Projection distortion parameter                PV2_14  = -0.00012633881376049 / Projection distortion parameter                PV2_15  =  -0.0020312867769692 / Projection distortion parameter                PV2_16  =  0.00524608854745148 / Projection distortion parameter                FGROUPNO=                    1 / SCAMP field group label                        ASTIRMS1=                   0. / Astrom. dispersion RMS (intern., high S/N)     ASTIRMS2=                   0. / Astrom. dispersion RMS (intern., high S/N)     ASTRRMS1=         3.620458E-05 / Astrom. dispersion RMS (ref., high S/N)        ASTRRMS2=         3.332156E-05 / Astrom. dispersion RMS (ref., high S/N)        ASTINST =                    1 / SCAMP astrometric instrument label             FLXSCALE=                   0. / SCAMP relative flux scale                      MAGZEROP=                   0. / SCAMP zero-point                               PHOTIRMS=                   0. / mag dispersion RMS (internal, high S/N)        RA_RMS  =            0.1655724 / [arcsec] RMS of SCAMP fit from 2MASS matching  DEC_RMS =            0.1891921 / [arcsec] RMS of SCAMP fit from 2MASS matching  ASTROMN =                  384 / Number of stars in SCAMP astrometric solution  SCAMPPTH= '/ptf/pos/archive/fallbackcal/scamp/7/' / SCAMP catalog path          SCAMPFIL= 'PTF_201006174759_c_e_uca3_t112521_u001916251_f02_p002899_c07.fits'                                                                                             / SIP DISTORTION KEYWORDS                                                                                                                             A_ORDER =                    4 / Distortion order for A                         A_0_2   = 6.96807813586153E-08 / Projection distortion parameter                A_0_3   = 1.20881759870351E-11 / Projection distortion parameter                A_0_4   = -4.07297345125509E-15 / Projection distortion parameter               A_1_1   = -1.71602989085006E-07 / Projection distortion parameter               A_1_2   = -3.40958003336147E-11 / Projection distortion parameter               A_1_3   = 1.08769435952671E-14 / Projection distortion parameter                A_2_0   = 2.28067760155696E-07 / Projection distortion parameter                A_2_1   =  3.6610309234789E-11 / Projection distortion parameter                A_2_2   = 4.73755078335384E-15 / Projection distortion parameter                A_3_0   = 8.24210855193549E-12 / Projection distortion parameter                A_3_1   = 3.84753767306115E-14 / Projection distortion parameter                A_4_0   = -4.54223812412034E-14 / Projection distortion parameter               A_DMAX  =     1.53122472683886 / Projection distortion parameter                B_ORDER =                    4 / Distortion order for B                         B_0_2   = -7.69933957449607E-08 / Projection distortion parameter               B_0_3   = -9.16855566272424E-11 / Projection distortion parameter               B_0_4   = 1.66630509620112E-14 / Projection distortion parameter                B_1_1   = 2.46289708854316E-07 / Projection distortion parameter                B_1_2   = -5.90207917198792E-11 / Projection distortion parameter               B_1_3   = 1.86811615261732E-14 / Projection distortion parameter                B_2_0   = 3.44908367419592E-08 / Projection distortion parameter                B_2_1   = -2.49509936365959E-11 / Projection distortion parameter               B_2_2   = 2.84841315780067E-15 / Projection distortion parameter                B_3_0   = 2.02845080441181E-11 / Projection distortion parameter                B_3_1   = -4.51317603382652E-14 / Projection distortion parameter               B_4_0   = -1.16438849571175E-13 / Projection distortion parameter               B_DMAX  =     2.89468553502114 / Projection distortion parameter                AP_ORDER=                    4 / Distortion order for AP                        AP_0_1  = -2.3927681685928E-08 / Projection distortion parameter                AP_0_2  = -6.97379868441328E-08 / Projection distortion parameter               AP_0_3  = -1.21069584606865E-11 / Projection distortion parameter               AP_0_4  = 4.07524721573973E-15 / Projection distortion parameter                AP_1_0  = 5.65239128994064E-08 / Projection distortion parameter                AP_1_1  = 1.71734217296344E-07 / Projection distortion parameter                AP_1_2  = 3.41724875038451E-11 / Projection distortion parameter                AP_1_3  = -1.08775499102067E-14 / Projection distortion parameter               AP_2_0  = -2.28068482487158E-07 / Projection distortion parameter               AP_2_1  = -3.66548961802381E-11 / Projection distortion parameter               AP_2_2  = -4.75858241735224E-15 / Projection distortion parameter               AP_3_0  = -8.24781966878619E-12 / Projection distortion parameter               AP_3_1  = -3.85281201904104E-14 / Projection distortion parameter               AP_4_0  = 4.54275049666924E-14 / Projection distortion parameter                BP_ORDER=                    4 / Distortion order for BP                        BP_0_1  = -1.50638746640517E-07 / Projection distortion parameter               BP_0_2  = 7.70565767927487E-08 / Projection distortion parameter                BP_0_3  = 9.18374546897802E-11 / Projection distortion parameter                BP_0_4  = -1.66839467627906E-14 / Projection distortion parameter               BP_1_0  = -4.87195269294628E-08 / Projection distortion parameter               BP_1_1  = -2.46371690411844E-07 / Projection distortion parameter               BP_1_2  =  5.9111535979953E-11 / Projection distortion parameter                BP_1_3  = -1.87729776729012E-14 / Projection distortion parameter               BP_2_0  = -3.46046151217313E-08 / Projection distortion parameter               BP_2_1  = 2.51320825919019E-11 / Projection distortion parameter                BP_2_2  = -2.85758325791527E-15 / Projection distortion parameter               BP_3_0  = -2.04221364218494E-11 / Projection distortion parameter               BP_3_1  = 4.51336286236569E-14 / Projection distortion parameter                BP_4_0  = 1.16567578965612E-13 / Projection distortion parameter                                                                                                          / DATA FLOW                                                                                                                                           ORIGNAME= '/data/PTF_default_38068.fits' / Filename as written by the camera    FILENAME= 'PTF200906253621_2_o_38068.fits' / Filename of delivered camera image PROCORIG= 'IPAC-PTF pipelines' / Processing origin                              PROCDATE= 'Tue Feb 21 03:34:46 2012' / Processing date/time (Pacific time)      PTFVERSN=                   5. / Version of PTFSCIENCEPIPELINE program          PMASKPTH= '/ptf/pos/archive/fallbackcal/pmasks/' / Pathname of pixel mask       PMASKFIL= 'bpm_2009060s_c07.v2.fits' / Filename of pixel mask                   SFLATPTH= '/ptf/pos/sbx1/2009/06/25/f2/c7/cal/p4/cId45986/' / Pathname of super SFLATFIL= 'PTF_200906250000_i_s_flat_t120000_u000045986_f02_p000000_c07.fits'   SBIASPTH= '/ptf/pos/sbx1/2009/06/25/f2/c7/cal/p1/cId45922/' / Pathname of super SBIASFIL= 'PTF_200906250000_i_s_bias_t120000_u000045922_f00_p000000_c07.fits'   DBNID   =                  121 / Database night ID                              DBEXPID =                22920 / Database exposure ID                           DBRID   =              3663141 / Database raw-image ID                          DBPID   =             12052003 / Database processed-image ID                    DBFID   =                    2 / Database filter ID                             DBPIID  =                    1 / Database P.I. ID                               DBPRID  =                    3 / Database project ID                            DBFIELD =                22920 / Database field ID                              DBSVID  =                   50 / Database software-version ID                   DBCVID  =                   56 / Database config-data-file ID                   END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             XTENSION= 'IMAGE   '           / Image extension                                BITPIX  =                    8 / array data type                                NAXIS   =                    0 / number of array dimensions                     PCOUNT  =                    0 / number of parameters                           GCOUNT  =                    1 / number of groups                               CD1_2   =            -3.72E-05                                                  CD1_3   =                    0                                                  CD1_1   =            -4.12E-05                                                  CUNIT3  = 'HZ      '                                                            CUNIT2  = 'deg     '                                                            CTYPE1  = 'RA---TAN'                                                            CTYPE3  = 'AWAV    '                                                            CD2_1   =            -3.72E-05                                                  CTYPE2  = 'DEC--TAN'                                                            CD2_3   =                    0                                                  CD2_2   =             4.12E-05                                                  CUNIT1  = 'deg     '                                                            CD3_1   =                    0                                                  CD3_2   =                    0                                                  CD3_3   =                  0.2                                                  END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"id":7618,"name":"validate.7.4.txt","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"HDU 1:\n  WCS key ' ':\n    - RADECSYS= 'ICRS ' / Astrometric system\n      the RADECSYS keyword is deprecated, use RADESYSa.\n    - The WCS transformation has more axes (2) than the image it is\n      associated with (0)\n    - Removed redundant SCAMP distortion parameters because SIP\n      parameters are also present\n    - 'datfix' made the change 'Set MJD-OBS to 55007.362083 from DATE-\n      OBS'.\n\nHDU 2:\n  WCS key ' ':\n    - The WCS transformation has more axes (3) than the image it is\n      associated with (0)\n    - 'datfix' made the change 'Success'.\n    - 'unitfix' made the change 'Changed units:\n        'HZ' -> 'Hz'.\n    - 'celfix' made the change 'In CUNIT3 : Mismatched units type\n      'length': have 'Hz', want 'm''.\n"},{"id":7619,"name":"chandra-pixlist-wcs.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"DATE    = '2020-04-25T20:17:34' / Date and time of file creation                \nDATE-OBS= '2000-07-07T09:25:15' / Observation start date                        \nDATE-END= '2000-07-07T15:27:29' / Observation end date                          \nTTYPE5  = 'chipx   '           / Chip coords                                    \nTFORM5  = '1I      '           / format of field                                \nTUNIT5  = 'pixel   '                                                            \nTTYPE15 = 'pha_ro  '           / total read-out pulse height of event           \nTFORM15 = '1J      '           / format of field                                \nTUNIT15 = 'adu     '                                                            \nTNULL15 =                    0                                                  \nMTYPE5  = 'CPC     '           / DM Keyword: Descriptor name.                   \nMFORM5  = 'CPCX,CPCY'          / [mm]                                           \nTCTYP5  = 'CPCX    '                                                            \nTCRVL5  =  0.0000000000000E+00                                                  \nTCRPX5  =  5.0000000000000E-01                                                  \nTCDLT5  =  2.3987000000000E-02                                                  \nTCUNI5  = 'mm      '                                                            \nTTYPE6  = 'chipy   '           / Chip coords                                    \nTFORM6  = '1I      '           / format of field                                \nTUNIT6  = 'pixel   '                                                            \nTTYPE16 = 'energy  '           / nominal energy of event (eV)                   \nTFORM16 = '1E      '           / format of field                                \nTUNIT16 = 'eV      '                                                            \nTCTYP6  = 'CPCY    '                                                            \nTCRVL6  =  0.0000000000000E+00                                                  \nTCRPX6  =  5.0000000000000E-01                                                  \nTCDLT6  =  2.3987000000000E-02                                                  \nTCUNI6  = 'mm      '                                                            \nMTYPE6  = 'MSC     '           / DM Keyword: Descriptor name.                   \nMFORM6  = 'PHI,THETA'          / [deg]                                          \nTTYPE9  = 'detx    '           / ACIS detector coordinates                      \nTFORM9  = '1E      '           / format of field                                \nTUNIT9  = 'pixel   '                                                            \nTTYPE19 = 'grade   '           / binned event grade                             \nTFORM19 = '1I      '           / format of field                                \nTCTYP9  = 'LONG-TAN'                                                            \nTCRVL9  =  0.0000000000000E+00                                                  \nTCRPX9  =  4.0965000000000E+03                                                  \nTCDLT9  =  1.3666666666667E-04                                                  \nTCNA9   = 'PHI     '                                                            \nTCUNI9  = 'deg     '                                                            \nLONP9   =  2.7000000000000E+02                                                  \nLATP9   =  9.0000000000000E+01                                                  \nTTYPE10 = 'dety    '           / ACIS detector coordinates                      \nTFORM10 = '1E      '           / format of field                                \nTUNIT10 = 'pixel   '                                                            \nTCTYP10 = 'NPOL-TAN'                                                            \nTCRVL10 =  0.0000000000000E+00                                                  \nTCRPX10 =  4.0965000000000E+03                                                  \nTCDLT10 =  1.3666666666667E-04                                                  \nTCNA10  = 'THETA   '                                                            \nTCUNI10 = 'deg     '                                                            \nTTYPE11 = 'x       '           / sky coordinates                                \nTFORM11 = '1E      '           / format of field                                \nTUNIT11 = 'pixel   '                                                            \nTCTYP11 = 'RA---TAN'                                                            \nTCRVL11 =  2.2938051931869E+02                                                  \nTCRPX11 =  4.0965000000000E+03                                                  \nTCDLT11 = -1.3666666666667E-04                                                  \nTCUNI11 = 'deg     '                                                            \nTTYPE12 = 'y       '           / sky coordinates                                \nTFORM12 = '1E      '           / format of field                                \nTUNIT12 = 'pixel   '                                                            \nTCTYP12 = 'DEC--TAN'                                                            \nTCRVL12 = -5.8811080688850E+01                                                  \nTCRPX12 =  4.0965000000000E+03                                                  \nTCDLT12 =  1.3666666666667E-04                                                  \nTCUNI12 = 'deg     '                                                            \nTIMESYS = 'TT      '           / Time system                                    \nTIMEZERO=  0.0000000000000E+00 / [s] Clock correction                           \nTIMEUNIT= 's       '           / Time unit                                      \nTIMEREF = 'LOCAL   '           / Time reference (barycenter/local)              \nTIMEPIXR=  5.0000000000000E-01 / default                                        \nTIMEDEL =  9.4104000000000E-01 / [s] timedel Lev1                               \nTIMEDELA=  9.4104000000000E-01 / Inferred duration of primary exposure (s)      \nTIMEDELB=  0.0000000000000E+00 / Inferred duration of secondary exp. (s)        \nTIME_ADJ= 'NONE    '           / time adjustment algorithm                      \nTSTART  =  7.9349115922606E+07 / [s] Observation start time (MET)               \nTSTOP   =  7.9370849510907E+07 / [s] Observation end time (MET)                 \nMJD-OBS =  5.1732392545401E+04 / Modified Julian date of observation            \nRADESYS = 'ICRS    '           / Equatorial coordinate system                   "},{"id":7620,"name":"3d_cd.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"CD1_2   =            -3.72E-05                                                  CD1_3   =                    0                                                  CD1_1   =            -4.12E-05                                                  CUNIT3  = 'nm      '                                                            CUNIT2  = 'deg     '                                                            CTYPE1  = 'RA---TAN'                                                            NAXIS   =                    3                                                  CTYPE3  = 'AWAV    '                                                            CD2_1   =            -3.72E-05                                                  CTYPE2  = 'DEC--TAN'                                                            CD2_3   =                    0                                                  CD2_2   =             4.12E-05                                                  CUNIT1  = 'deg     '                                                            CD3_1   =                    0                                                  CD3_2   =                    0                                                  CD3_3   =                  0.2                                                  "},{"id":7621,"name":"header_with_time.fits","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"SIMPLE  =                    F / Conforms to FITS standard?  NO!                BITPIX  =                  -32 / IEEE single precision floating point           NAXIS   =                    0 / No image data                                                                                                                  CRPIX1A =                513.0 / Pixel coordinate of reference point            CRPIX2A =                513.0 / Pixel coordinate of reference point            CRPIX3A =               1025.0 / Pixel coordinate of reference point            CRPIX4A =                  1.0 / Pixel coordinate of reference point            PC1_1A  =          0.866025404 / Linear transformation matrix element           PC1_2A  =          0.500000000 / Linear transformation matrix element           PC2_1A  =         -0.500000000 / Linear transformation matrix element           PC2_2A  =          0.866025404 / Linear transformation matrix element                                                                                           CDELT1A =                -0.10 / [deg] x-scale                                  CUNIT1A = 'deg'                / Degree units are required                      CTYPE1A = 'RA---SZP'           / Right ascension in slant zenithal projection   CRVAL1A =                150.0 / [deg] Right ascension at the reference point   CNAME1A = 'Right ascension (J2000)' / Axis name for labelling purposes          CDELT2A =                 0.10 / [deg] y-scale                                  CUNIT2A = 'deg'                / Degree units are required                      CTYPE2A = 'DEC--SZP'           / Declination in a slant zenithal projection     CRVAL2A =                -30.0 / [deg] Declination at the reference point       CNAME2A = 'Declination (J2000)' / Axis name for labelling purposes              PV1_1A  =                  0.0 / [deg] Native longitude of the reference point  PV1_2A  =                 90.0 / [deg] Native latitude  of the reference point  PV1_3A  =                195.0 / [deg] LONPOLEa by another name (precedence)    PV1_4A  =                999.0 / [deg] LATPOLEa by another name (precedence)    PV2_1A  =                  0.0 / SZP distance, in spherical radii               PV2_2A  =                180.0 / [deg] SZP P-longitude                          PV2_3A  =                 45.0 / [deg] SZP P-latitude                           LONPOLEA=                195.0 / [deg] Native longitude of the NCP              LATPOLEA=                999.0 / [deg] Native latitude of the NCP               RADESYSA= 'FK5'                / Mean equatorial coordinates, IAU 1984 system   EQUINOXA=               2000.0 / [yr] Equinox of equatorial coordinates                                                                                         CDELT3A =      -9.635265432E-6 / [m] Wavelength scale                           CUNIT3A = 'm'                  / Wavelength units                               CTYPE3A = 'WAVE-F2W'           / Frequency axis expressed as wavelength         CRVAL3A =          0.214982042 / [m] Reference wavelength                       CNAME3A = 'Wavelength'         / Axis name for labelling purposes               CRDER3A =              1.0E-11 / [m] Wavelength calibration, random error       CSYER3A =              1.0E-12 / [m] Wavelength calibration, systematic error   RESTFRQA=         1.42040575E9 / [Hz] HI rest frequency                         RESTWAVA=          0.211061141 / [m] HI rest wavelength                         SPECSYSA= 'BARYCENT'           / Reference frame of spectral coordinates        SSYSOBSA= 'TOPOCENT'           / Reference frame of observation                 VELOSYSA=               1500.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCA= 'LSRK'               / Reference frame of source redshift             ZSOURCEA=               0.0025 / Redshift of the source                                                                                                         CDELT4A =                  1.0 / [s] Time scale                                 CUNIT4A = 's'                  / Time units                                     CTYPE4A = 'TIME    '           / String value and comment containing quotes (') CRVAL4A =                 -2E3 / [s] Time at the reference point                CNAME4A = 'Time offset'        / Axis name for labelling purposes               PS4_0A  = 'UTC'                / Time measurement system                                                                                                        UNDEF   =                      / Undefined keyvalue                             TRUE    =                    T / Logical                                        FALSE   =                    F / Logical                                        INT32   =          00000012345 / Not a 64-bit integer                           INT32   =     -000000123456789 / Not a 64-bit integer                           INT32   =          -2147483648 / Not a 64-bit integer (INT_MIN)                 INT32   =           2147483647 / Not a 64-bit integer (INT_MAX)                 INT32   =    0000000000000000000000000000000000012345 / Not a very long integer INT32   =       -000000000000000000000000000123456789 / Not a very long integer INT64   =          -2147483649 / 64-bit integer (INT_MIN - 1)                   INT64   =          +2147483648 / 64-bit integer (INT_MAX + 1)                   INT64   =  +100000000000000000 / 64-bit integer                                 INT64   =  -876543210987654321 / 64-bit integer                                 INT64   = -9223372036854775808 / Not a very long integer (LONG_MIN)             INT64   = +9223372036854775807 / Not a very long integer (LONG_MAX)             INT64   = -000000000000000000000000000000876543210987654321 / 64-bit integer    INTVL   = -9223372036854775809 / Very long integer (LONG_MIN - 1)               INTVL   = +9223372036854775808 / Very long integer (LONG_MAX + 1)               INTVL   = -100000000000000000000000000000876543210987654321 / Very-long integer INTVL   = +123456789012345678901234567890123456789012345678901234567890123456789INTVL   = 1234567890123456789012345678901234567890123456789012345678901234567890FLOAT   =        3.14159265358 / Floating point                                 FLOAT   =      1.602176565E-19 / Floating point, lower-case exp allowed         FLOAT   =      2.99792458E8    / Floating point                                 FLOAT   =       6.62606957D-34 / Floating point, lower-case exp allowed         FLOAT   =        6.02214129D23 / Floating point                                 COMPLEX =            (137, -1) / An integer complex keyvalue                    COMPLEX =         (10E5, -0.1) / A floating point complex keyvalue              GOODSTR =     '\"G''DAY\"  '     / A valid string keyvalue                        BLANKS  =   '              '   / An all-blank string equals a single blank      LONGSTR = 'The loooooongest possible non-continued string value, 68 characters.'END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"id":7622,"name":"sip.fits","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"SIMPLE  =                    T / conforms to FITS standard                      BITPIX  =                    8 / array data type                                NAXIS   =                    0 / number of array dimensions                     WCSAXES =                    2 / Number of coordinate axes                      CRPIX1  =                128.0 / Pixel coordinate of reference point            CRPIX2  =                128.0 / Pixel coordinate of reference point            PC1_1   =    0.000249756880272 / Coordinate transformation matrix element       PC1_2   =    0.000230177809744 / Coordinate transformation matrix element       PC2_1   =    0.000230428519265 / Coordinate transformation matrix element       PC2_2   =   -0.000249965770577 / Coordinate transformation matrix element       CDELT1  =                    1 / [deg] Coordinate increment at reference point  CDELT2  =                    1 / [deg] Coordinate increment at reference point  CUNIT1  = 'deg'                / Units of coordinate increment and value        CUNIT2  = 'deg'                / Units of coordinate increment and value        CTYPE1  = 'RA---TAN-SIP'       / Right ascension, gnomonic projection           CTYPE2  = 'DEC--TAN-SIP'       / Declination, gnomonic projection               CRVAL1  =        202.482322805 / [deg] Coordinate value at reference point      CRVAL2  =          47.17511893 / [deg] Coordinate value at reference point      LONPOLE =                  180 / [deg] Native longitude of celestial pole       LATPOLE =          47.17511893 / [deg] Native latitude of celestial pole        RESTFRQ =                    0 / [Hz] Line rest frequency                       RESTWAV =                    0 / [Hz] Line rest wavelength                      CRDER1  =    4.02509762361E-05 / [deg] Random error in coordinate               CRDER2  =    3.42746131953E-05 / [deg] Random error in coordinate               RADESYS = 'ICRS'               / Equatorial coordinate system                   EQUINOX =                 2000 / [yr] Equinox of equatorial coordinates         BP_0_1  =          -1.6588E-05                                                  BP_0_2  =          -2.3424E-05                                                  A_3_0   =          -1.4172E-07                                                  B_3_0   =          -2.0249E-08                                                  BP_3_0  =           2.0482E-08                                                  B_1_2   =          -5.7813E-09                                                  B_1_1   =          -2.4386E-05                                                  B_2_1   =          -1.6583E-07                                                  B_2_0   =           2.1197E-06                                                  A_ORDER =                    3                                                  B_0_3   =          -1.6168E-07                                                  B_0_2   =             2.31E-05                                                  BP_0_3  =            1.651E-07                                                  B_ORDER =                    3                                                  BP_ORDER=                    3                                                  BP_1_2  =           3.8917E-09                                                  AP_ORDER=                    3                                                  AP_3_0  =           1.4492E-07                                                  A_1_1   =           2.1886E-05                                                  BP_2_0  =           -2.151E-06                                                  A_1_2   =          -1.6847E-07                                                  AP_2_1  =            6.709E-09                                                  AP_2_0  =           2.4146E-05                                                  A_0_2   =           2.9656E-06                                                  A_0_3   =           3.7746E-09                                                  BP_1_1  =           2.4753E-05                                                  BP_1_0  =          -2.6783E-06                                                  A_2_0   =          -2.3863E-05                                                  A_2_1   =           -8.561E-09                                                  AP_1_0  =          -1.4897E-05                                                  AP_1_1  =           -2.225E-05                                                  AP_1_2  =           1.7195E-07                                                  BP_2_1  =              1.7E-07                                                  AP_0_1  =          -6.4275E-07                                                  AP_0_3  =           -3.582E-09                                                  AP_0_2  =          -2.9425E-06                                                  END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"id":7623,"name":"validate.6.txt","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"HDU 1:\n  WCS key ' ':\n    - RADECSYS= 'ICRS ' / Astrometric system\n      the RADECSYS keyword is deprecated, use RADESYSa.\n    - The WCS transformation has more axes (2) than the image it is\n      associated with (0)\n    - Removed redundant SCAMP distortion parameters because SIP\n      parameters are also present\n\nHDU 2:\n  WCS key ' ':\n    - The WCS transformation has more axes (3) than the image it is\n      associated with (0)\n    - 'unitfix' made the change 'Changed units:\n        'HZ' -> 'Hz'.\n    - 'celfix' made the change 'In CUNIT3 : Mismatched units type\n      'length': have 'Hz', want 'm''.\n"},{"col":4,"comment":"Scale all non-angular components, leaving angular ones unchanged.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.mul`, `~operator.neg`, etc.\n        *args\n            Any arguments required for the operator (typically, what is to\n            be multiplied with, divided by).\n        ","endLoc":1080,"header":"def _scale_operation(self, op, *args)","id":7624,"name":"_scale_operation","nodeType":"Function","startLoc":1049,"text":"def _scale_operation(self, op, *args):\n        \"\"\"Scale all non-angular components, leaving angular ones unchanged.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.mul`, `~operator.neg`, etc.\n        *args\n            Any arguments required for the operator (typically, what is to\n            be multiplied with, divided by).\n        \"\"\"\n        results = []\n        for component, cls in self.attr_classes.items():\n            value = getattr(self, component)\n            if issubclass(cls, Angle):\n                results.append(value)\n            else:\n                results.append(op(value, *args))\n\n        # try/except catches anything that cannot initialize the class, such\n        # as operations that returned NotImplemented or a representation\n        # instead of a quantity (as would happen for, e.g., rep * rep).\n        try:\n            result = self.__class__(*results)\n        except Exception:\n            return NotImplemented\n\n        for key, differential in self.differentials.items():\n            diff_result = differential._scale_operation(op, *args, scaled_base=True)\n            result.differentials[key] = diff_result\n\n        return result"},{"id":7625,"name":"2wcses.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"SIMPLE  =                    T / conforms to FITS standard                      BITPIX  =                  -32 / array data type                                NAXIS   =                    2 / number of array dimensions                     NAXIS1  =                 2048                                                  NAXIS2  =                 4096                                                  EXTEND  =                    T                                                  RUN     =               418552 / Run number                                     OBSERVAT= 'LAPALMA '           / Name of observatory (IRAF style)               OBSERVER= 'Drew    '           / Name of principal investigator                 OBJECT  = 'intphas_4970 Ha'    / Title of observation                           LATITUDE=            28.761929 / Telescope latitude  (degrees), +28:45:42.9     LONGITUD=           -17.877577 / Telescope longitude (degrees), -17:52:39.3     HEIGHT  =                 2348 / [m] Height above sea level.                    SLATEL  = 'LPO2.5  '           / Telescope name known to SLALIB                 TELESCOP= 'INT     '           / 2.5m Isaac Newton Telescope                    MJD-OBS =        53240.9816151 / Modified Julian Date of midtime of observation JD      =      2453241.4816151 / Julian Date of midtime of observation          PLATESCA=             6.856013 / [d/m] Platescale ( 24.68arcsec/mm)             TELFOCUS=             0.043969 / Telescope focus (metres)                       AIRMASS =             1.048846 / Effective mean airmass                         DATE-OBS= '2004-08-23T23:32:32.4' / UTC date start of observation               UTSTART = '23:32:32.4'         / UTC of start of observation                    TEMPTUBE=             10.15365 / Truss Temperature (degrees Celsius)            INSTRUME= 'WFC     '           / INT wide-field camera is in use.               WFFPOS  =                    1 / Position-number of deployed filter             WFFBAND = 'Halpha  '           / Waveband of filter                             WFFID   = '197     '           / Unique identifier of filter                    SECPPIX =                0.333 / Arcseconds per pixel                           DETECTOR= 'WFC     '           / Formal name of camera                          CCDSPEED= 'FAST    '           / Readout speed                                  CCDXBIN =                    1 / Binning factor in x axis                       CCDYBIN =                    1 / Binning factor in y axis                       CCDSUM  = '1 1     '           / Binning factors (IRAF style)                   CCDTEMP =              156.114 / [K] Cryostat temperature                       NWINDOWS=                    0 / Number of readout windows                      CCDNAME = 'A5506-4 '           / Name of detector chip.                         CCDXPIXE=             1.35E-05 / [m] Size of pixels in x.                       CCDYPIXE=             1.35E-05 / [m] Size of pixels in y.                       AMPNAME = 'LH      '           / Name of output amplifier.                      GAIN    =                  2.8 / Nominal Photo-electrons per ADU.               READNOIS=                  6.4 / Nominal Readout noise in electrons.            NUMBRMS =                  257 / Number of standards used                       STDCRMS =                0.067 / Astrometric fit error (arcsec)                 PERCORR =                  0.0 / Sky calibration correction (mags)              EXTINCT =                 0.09 / Extinction coefficient (mags)                  RADESYSA= 'ICRS    '                                                            EQUINOX =               2000.0                                                  CTYPE1  = 'RA---ZPN'           / Algorithm type for axis 1                      CTYPE2  = 'DEC--ZPN'           / Algorithm type for axis 2                      CRPIX1  =           -337.20001 / [pixel] Reference pixel along axis 1           CRPIX2  =               3040.5 / [pixel] Reference pixel along axis 2           CRVAL1  =            292.20508 / [deg] Right ascension at the reference pixel   CRVAL2  =            18.582556 / [deg] Declination at the reference pixel       CRUNIT1 = 'deg     '           / Unit of right ascension coordinates            CRUNIT2 = 'deg     '           / Unit of declination coordinates                CD1_1   =       -1.3007094E-06 / Transformation matrix element                  CD1_2   =       -9.2396054E-05 / Transformation matrix element                  CD2_1   =       -9.2389091E-05 / Transformation matrix element                  CD2_2   =        1.3203634E-06 / Transformation matrix element                  PV2_1   =                  1.0 / Coefficient for r term                         PV2_2   =                  0.0 / Coefficient for r**2 term                      PV2_3   =                220.0 / Coefficient for r**3 term                      ORIGZPT =                21.53 / Original nightly ZP; uncorrected for extinctionMAGZPT  =    21.40896253966641 / Re-calibrated DR2 zeropoint                    EXPTIME =               120.02 / [sec] Exposure time assumed by the pipeline    CHECKSUM= '7RREBPRB9PRBAPRB'   / HDU checksum updated 2014-02-06T12:02:07       DATASUM = '1660673036'         / data unit checksum updated 2014-02-06T12:02:07 HISTORY 20041004 14:45:42                                                       HISTORY    $Id: cir_create_file.c,v 1.10 2004/09/03 10:48:45 jim Exp $          HISTORY 20041004 14:45:43                                                       HISTORY    $Id: cir_ccdproc.c,v 1.9 2004/09/07 14:18:51 jim Exp $               HISTORY 20041004 22:52:54                                                       HISTORY    $Id: cir_imcore.c,v 1.11 2004/09/07 14:18:52 jim Exp $               HISTORY 20041004 22:52:56                                                       HISTORY    $Id: cir_platesol.c,v 1.9 2004/09/07 14:18:54 jim Exp $              HISTORY 20041005 16:05:06                                                       HISTORY    $Id: cir_imcore.c,v 1.11 2004/09/07 14:18:52 jim Exp $               HISTORY 20041006 07:31:07                                                       HISTORY    $Id: cir_platesol.c,v 1.9 2004/09/07 14:18:54 jim Exp $              HISTORY 20131220 22:36:15                                                       HISTORY     Headers updated by Geert Barentsen as part of DR2.                  HISTORY     This included changes to MAGZPT, EXPTIME and the WCS.               COMMENT Calibration info                                                        COMMENT ================                                                        COMMENT The MAGZPT keyword in this header has been corrected for atmospheric    COMMENT extinction and gain (PERCORR) and has been re-calibrated as part of DR2.COMMENT                                                                         COMMENT Hence to obtain calibrated magnitudes relative to Vega, use:            COMMENT     mag(Vega) = MAGZPT - 2.5*log(pixel value / EXPTIME)                 END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"id":7626,"name":"tpvonly.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"SIMPLE  =                    T / Fits standard                                  BITPIX  =                  -32 / FOUR-BYTE SINGLE PRECISION FLOATING POINT      NAXIS   =                    2 / STANDARD FITS FORMAT                           NAXIS1  =                 2048 / STANDARD FITS FORMAT                           NAXIS2  =                 4096 / STANDARD FITS FORMAT                           ORIGIN  = 'Palomar Transient Factory' / Origin of these image data              CREATOR = 'Infrared Processing and Analysis Center' / Creator of this FITS file TELESCOP= 'P48     '           / Name of telescope                              INSTRUME= 'PTF/MOSAIC'         / Instrument name                                OBSERVER= 'KulkarniPTF'        / Observer name and project                      CCDID   = '5       '           / CCD number (0..11)                             DATE-OBS= '2014-07-31T04:49:58.673' / UTC shutter time YYYY-MM-DDTHH:MM:SS.SSS  DATE    = '2014-07-31T19:20:32' / File creation date (YYYY-MM-DDThh:mm:ss UT)   REFERENC= 'http://www.astro.caltech.edu/ptf' / URL of PTF website                                                                                                         / PROPOSAL INFORMATION                                                                                                                                PTFPRPI = 'Kulkarni'           / PTF Project PI                                 PTFPID  = '52002   '           / Project type: 00000-49999                      OBJECT  = 'Galactic_Plane'     / Fields object                                  PTFFIELD= '1549    '           / PTF unique field ID                            PTFFLAG = '1       '           / 1 = PTF; 0 = non-PTF category                                                                                                            / TIME AND EXPOSURE INFORMATION                                                                                                                       FILTER  = 'R       '           / Filter name                                    FILTERID= '2       '           / Filter ID                                      FILTERSL= '1       '           / Filter changer slot position                   EXPTIME =                  60. / [s] Requested exposure time                    AEXPTIME=                  60. / actual exposure time (sec)                     UTC-OBS = '2014-07-31T04:49:58.673' / UTC time shutter open YYYY-MM-DDTHH:MM:SS.OBSJD   =        2456869.70137 / [day] Julian day corresponds to UTC-OBS        OBSMJD  =          56869.20137 / MJD corresponds to UTC-OBS (day)               OBSLST  = '17:37:29.36'        / Mean LST corresponds to UTC-OBS 'HH:MM:SS.S'   HOURANG = '-0:42:20.82'        / Mean HA (sHH:MM:SS.S) based on LMST at UTC-OBS HJD     =        2456869.70618 / [day] Heliocentric Julian Day                  OBSTYPE = 'object  '           / Image type (dark,science,bias,focus)           IMGTYP  = 'object  '           / Image type (dark,science,bias,focus)                                                                                                     / MOON AND SUN                                                                                                                                        MOONRA  =           173.116974 / [deg] Moon J2000.0 R.A.                        MOONDEC =            -0.404999 / [deg] Moon J2000.0 Dec.                        MOONILLF=             0.155837 / [frac] Moon illuminated fraction               MOONPHAS=             133.4978 / [deg] Moon phase angle                         MOONESB =                  -0. / Moon excess in sky brightness V-band           MOONALT =            -1.271649 / [deg] Moon altitude                            SUNAZ   =             312.4731 / [deg] Sun azimuth                              SUNALT  =            -22.25475 / [deg] Sun altitude                                                                                                                       / PHOTOMETRY                                                                                                                                          BUNIT   = 'DN      '           / Data number (analog-to-digital units or ADU)   PHTCALEX=                    1 / Was phot.-cal. module executed?                PHTCALFL=                    0 / Flag for image is photometric (0=N, 1=Y)       PCALRMSE=             0.171135 / RMSE from (zeropoint, extinction) data fit     IMAGEZPT=             21.22791 / Image magnitude zeropoint                      IZPORIG = 'CALTRANS'           / Photometric-calibration origin                 ZPRULE  = 'COMPUTE '           / Photometric-calibration method                 MAGZPT  =             23.55079 / Magnitude zeropoint at airmass=1               EXTINCT =             1.163014 / Extinction                                     APSFILT = 'r       '           / SDSS filter used in abs phot cal               APSCOL  = 'r-i     '           / SDSS color used in abs phot cal                APRMS   =           0.06677995 / RMS in mag of final abs phot cal               APBSRMS =           0.05033556 / RMS in mag of final abs phot cal for bright staAPNSTDI1=               308233 / Number of standard stars in first iteration    APNSTDIF=               274569 / Number of standard stars in final iteration    APCHI2  =     1861590.34570444 / Chi2 of final abs phot cal                     APDOF   =              274569. / Dof of chi2 of final abs phot cal              APMEDJD =     2456869.84882722 / Median JD used in abs phot cal                 APPN01  = 'ZeroPoint'          / Name of parameter abs phot cal 01              APPAR01 =          23.67499643 / Value of parameter abs phot cal 01             APPARE01=           0.00324545 / Error of parameter abs phot cal 01             APPN02  = 'ColorTerm'          / Name of parameter abs phot cal 02              APPAR02 =           0.44908632 / Value of parameter abs phot cal 02             APPARE02=           0.00423336 / Error of parameter abs phot cal 02             APPN03  = 'AirMassTerm'        / Name of parameter abs phot cal 03              APPAR03 =          -0.18342823 / Value of parameter abs phot cal 03             APPARE03=           0.00288243 / Error of parameter abs phot cal 03             APPN04  = 'AirMassColorTerm'   / Name of parameter abs phot cal 04              APPAR04 =          -0.14534473 / Value of parameter abs phot cal 04             APPARE04=           0.00381178 / Error of parameter abs phot cal 04             APPN05  = 'TimeTerm'           / Name of parameter abs phot cal 05              APPAR05 =           0.42239539 / Value of parameter abs phot cal 05             APPARE05=            0.0019644 / Error of parameter abs phot cal 05             APPN06  = 'Time2Term'          / Name of parameter abs phot cal 06              APPAR06 =           0.16770061 / Value of parameter abs phot cal 06             APPARE06=           0.01549427 / Error of parameter abs phot cal 06             APPN07  = 'XTerm   '           / Name of parameter abs phot cal 07              APPAR07 =           0.02152189 / Value of parameter abs phot cal 07             APPARE07=           0.00047932 / Error of parameter abs phot cal 07             APPN08  = 'YTerm   '           / Name of parameter abs phot cal 08              APPAR08 =           0.02739724 / Value of parameter abs phot cal 08             APPARE08=           0.00117248 / Error of parameter abs phot cal 08             APPN09  = 'Y2Term  '           / Name of parameter abs phot cal 09              APPAR09 =           0.01522565 / Value of parameter abs phot cal 09             APPARE09=            0.0018581 / Error of parameter abs phot cal 09             APPN10  = 'Y3Term  '           / Name of parameter abs phot cal 10              APPAR10 =          -0.23390906 / Value of parameter abs phot cal 10             APPARE10=           0.00723349 / Error of parameter abs phot cal 10             APPN11  = 'XYTerm  '           / Name of parameter abs phot cal 11              APPAR11 =          -0.00677493 / Value of parameter abs phot cal 11             APPARE11=           0.00169149 / Error of parameter abs phot cal 11                                                                                                       / ASTROMETRY                                                                                                                                          CRVAL1  =     274.806945708898 / [deg] RA of reference point                    CRVAL2  =    -25.9746476963393 / [deg] DEC of reference point                   CRPIX1  =             -3925.16 / [pix] Image reference point                    CRPIX2  =              4360.23 / [pix] Image reference point                    CTYPE1  = 'RA---TPV'           / TAN (gnomic) projection + SIP distortions      CTYPE2  = 'DEC--TPV'           / TAN (gnomic) projection + SIP distortions      CUNIT1  = 'deg     '           / Image axis-1 celestial-coordinate units        CUNIT2  = 'deg     '           / Image axis-2 celestial-coordinate units        CRTYPE1 = 'deg     '           / Data units of CRVAL1                           CRTYPE2 = 'deg     '           / Data units of CRVAL2                           CD1_1   = 0.000286102658601581 / Transformation matrix                          CD1_2   = -6.28816628331811E-07                                                 CD2_1   = -5.77207018114522E-06                                                 CD2_2   = -0.000281525256171892                                                 OBJRA   = '18:18:56.842'       / Requested field J2000.0 Ra.                    OBJDEC  = '-25:52:30.00'       / Requested field J2000.0 Dec.                   OBJRAD  =            274.73684 / [deg] Requested field RA (J2000.0)             OBJDECD =              -25.875 / [deg] Requested field Dec (J2000.0)            PIXSCALE=                 1.01 / [arcsec/pix] Pixel scale                       EQUINOX =                2000. / [yr] Equatorial coordinates definition                                                                                                   / IMAGE QUALITY                                                                                                                                       SEEING  =                 2.95 / [pix] Seeing FWHM                              PEAKDIST=    0.481336680505667 / [pix] Mean dist brightest pixel-centroid pixel ELLIP   =                0.313 / Mean image ellipticity A/B                     ELLIPPA =                48.58 / [deg] Mean image ellipticity PA                FBIAS   =             785.8855 / [DN] Floating bias of the image                SATURVAL=               50000. / [DN] Saturation value of the CCD array         FWHMSEX =                 2.45 / [arcsec] SExtractor SEEING estimate            MSMAPCZP=             19.20814 / [mag/s-arcsec^2] Median sky abs. phot. cal.    LMGAPCZP=             20.68008 / [mag/s-arcsec^2] Limiting mag. abs. phot. cal. MEDFWHM =             3.417924 / [arcsecond] Median FWHM                        MEDELONG=             1.406608 / [dimensionless] Median elongation              STDELONG=             0.592749 / [dimensionless] Std. dev. of elongation        MEDTHETA=            -31.22347 / [deg] Atan(median sin(theta)/median cos(theta))STDTHETA=             65.37225 / [deg] Atan(stddev sin(theta)/stddev cos(theta))MEDDLMAG=             2.444709 / [mag/s-arcsec^2] Median (MU_MAX-MAG_AUTO)      STDDLMAG=            0.4154117 / [mag/s-arcsec^2] Stddev of (MU_MAX-MAG_AUTO)                                                                                             / OBSERVATORY AND TCS                                                                                                                                 OCS_TIME= '2014-07-31T04:49:58.613' / UTC Date for OCS calc time-dep params     OPERMODE= 'OCS     '           / Mode of operation: OCS | Manual | N/A          SOFTVER = '1.1.1.1 '           / Softwere version (TCS.Camera.OCS.Sched)        OCS_VER = '1       '           / OCS software version and date                  TCS_VER = '1       '           / TCS software version and date                  SCH_VER = '1       '           / OCS-Scheduler software version and date        MAT_VER = '7.7.0.471'          / Matlab version                                 HDR_VER = '1       '           / Header version                                 TRIGGER = 'N/A     '           / trigger ID for TOO, e.g. VOEVENT-Nr            TCSMODE = 'Star    '           / TCS fundamental mode                           TCSSMODE= 'Active  '           / TCS fundamental submode                        TCSFMODE= 'Pos     '           / TCS focus mode                                 TCSFSMOD= 'On-Target'          / TCS focus submode                              TCSDMODE= 'Stop    '           / TCS dome mode                                  TCSDSMOD= 'N/A     '           / TCS dome submode                               TCSWMODE= 'Slave   '           / TCS windscreen mode                            TCSWSMOD= 'N/A     '           / TCS windscreen submode                         OBSLAT  =              33.3574 / [deg] Telescope geodetic latitude in WGS84     OBSLON  =            -116.8599 / [deg] Telescope geodetic longitude in WGS84    OBSALT  =               1703.2 / [m] Telescope geodetic altitude in WGS84       DEFOCUS =                   0. / [mm] Focus position - nominal focus            FOCUSPOS=               1.3655 / [mm] Exposures focusPos                        DOMESTAT= 'open    '           / Dome status at begining of exposure            TRACKRA =                 20.4 / [arcsec/hr] Track speed RA rel to sidereal     TRACKDEC=                 -3.9 / [arcsec/hr] Track speed Dec rel to sidereal    AZIMUTH =             169.2328 / [deg] Telescope Azimuth                        ALTITUDE=             29.95342 / [deg] Telescope altitude                       AIRMASS =             1.997293 / Telescope airmass                              TELRA   =             274.9591 / [deg] Telescope ap equinox of date RA          TELDEC  =             -25.8684 / [deg] Telescope ap equinox of date Dec         TELHA   =             349.4138 / [deg] Telescope ap equinox of date HA          DOMEAZ  =             169.4477 / [deg] Dome azimuth                             WINDSCAL=              12.8995 / [deg] Wind screen altitude                     WINDDIR =                  1.3 / [deg] Azimuth of wind direction                WINDSPED=               14.472 / Wind speed (km/hour)                           OUTTEMP =             22.16667 / [C] Outside temperature                        OUTRELHU=                0.513 / [frac] Outside relative humidity               OUTDEWPT=             11.61111 / [C] Outside dew point                                                                                                                    / INSTRUMENT TELEMETRY                                                                                                                                PANID   = '_p48m   '           / PAN identification                             DHSID   = '_p48m   '           / DHS identification                             CCDSEC  = '[1:2048,1:4096]'    / CCD section                                    CCDSIZE = '[1:2048,1:4096]'    / CCD size                                       DATASEC = '[1:2048,1:4096]'    / Data section                                   DETSEC  = '[1:2048,1:4096]'    / Detector section                               ROISEC  = '[1:2048,1:4096]'    / ROI section                                    FPA     = 'P48MOSAIC'          / Focal plan array                               CCDNAME = 'W53C2   '           / Detector mfg serial number                     CHECKSUM= 'fGoXhEmXfEmXfEmX'   / Image header unit checksum                     DATASUM = '2019013917'         / Image data unit checksum                       DHEINF  = 'SDSU, Gen-III'      / Controller info                                DHEFIRM = '/usr/src/dsp/20090618/tim_m.lod' / DSP software                      CAM_VER = '20090615.1.3.100000' / Camera server date.rev.cfitsio                LV_VER  = '8.5     '           / LabVIEW software version                       PCI_VER = '2.0c    '           / Astropci software version                      DETID   = 'PTF/MOSAIC'         / Detector ID                                    AUTHOR  = 'PTF/OCS/TCS/Camera' / Source for header information                  DATAMIN =                   0. / Minimum value for array                        ROISTATE= 'ROI     '           / ROI State (FULL | ROI)                         LEDBLUE = 'OFF     '           / 470nm LED state (ON | OFF)                     LEDRED  = 'OFF     '           / 660nm LED state (ON | OFF)                     LEDNIR  = 'OFF     '           / 880nm LED state (ON | OFF)                     CCD9TEMP=              174.988 / [K] 0x0 servo temp sensor on CCD09             HSTEMP  =              152.111 / [K] 0x1 heat spreader temp                     DHE0TEMP=              301.098 / [K] 0x2 detector head electronics temp, master DHE1TEMP=              303.178 / [K] 0x3 detector head electronics temp, slave  DEWWTEMP=               287.05 / [K] 0x4 dewar wall temp                        HEADTEMP=              142.103 / [K] 0x5 cryo cooler cold head temp             CCD5TEMP=              175.963 / [K] 0x6 temp sensor on CCD05                   CCD11TEM=              177.375 / [K] 0x7 temp sensor on CCD11                   CCD0TEMP=              170.213 / [K] 0x8 temp sensor on CCD00                   RSTEMP  =              238.936 / [K] 0x9 temp sensor on radiation shield        DEWPRESS=                  40. / [milli-torr] Dewar pressure                    DETHEAT =                  1.6 / [%] Detector focal plane heater power          NAMPSXY = '6 2     '           / Number of amplifiers in x y                    CCDSUM  = '1 1     '           / [pix] Binning in x and y                       MODELFOC= 'N/A     '           / MODELFOC                                       EXPCKSUM= 'fGoXhEmXfEmXfEmX'   / Primary header unit checksum                   EXPDTSUM= '2019013917'         / Primary data unit checksum                     GAIN    =                  1.7 / [e-/D.N.] Gain of detector.                    READNOI =                  3.4 / [e-] Read noise of detector.                   DARKCUR =                  0.1 / [e-/s] Dark current of detector                                                                                                          / SCAMP DISTORTION KEYWORDS                                                                                                                           RADECSYS= 'ICRS    '           / Astrometric system                             PV1_0   =                   0. / Projection distortion parameter                PV1_1   =                   1. / Projection distortion parameter                PV1_2   =                   0. / Projection distortion parameter                PV1_4   =   -0.016169561788921 / Projection distortion parameter                PV1_5   =  -0.0051747493874632 / Projection distortion parameter                PV1_6   = -0.000238504358056776 / Projection distortion parameter               PV1_7   =  0.00629760478963159 / Projection distortion parameter                PV1_8   =  0.00397207946734115 / Projection distortion parameter                PV1_9   = -0.000677296206451849 / Projection distortion parameter               PV1_10  = 0.000503546797066621 / Projection distortion parameter                PV1_12  = -0.000973553429744082 / Projection distortion parameter               PV1_13  = -0.00102312736844768 / Projection distortion parameter                PV1_14  = 0.000253623568347818 / Projection distortion parameter                PV1_15  = -0.000200211924758127 / Projection distortion parameter               PV1_16  = -6.21626607050974E-05 / Projection distortion parameter               PV2_0   =                   0. / Projection distortion parameter                PV2_1   =                   1. / Projection distortion parameter                PV2_2   =                   0. / Projection distortion parameter                PV2_4   = -0.000743645656922906 / Projection distortion parameter               PV2_5   = 0.000184250025396486 / Projection distortion parameter                PV2_6   =   0.0219715919766664 / Projection distortion parameter                PV2_7   = -7.54497752637404E-05 / Projection distortion parameter               PV2_8   = 0.000649357185110191 / Projection distortion parameter                PV2_9   = -0.00081219646536117 / Projection distortion parameter                PV2_10  =  -0.0105098433615178 / Projection distortion parameter                PV2_12  = -2.1755521894303E-05 / Projection distortion parameter                PV2_13  = -7.90103717680049E-05 / Projection distortion parameter               PV2_14  = -0.000155711703067327 / Projection distortion parameter               PV2_15  = 0.000169335617180111 / Projection distortion parameter                PV2_16  =  0.00186540574051853 / Projection distortion parameter                FGROUPNO=                    1 / SCAMP field group label                        ASTIRMS1=                   0. / Astrom. dispersion RMS (intern., high S/N)     ASTIRMS2=                   0. / Astrom. dispersion RMS (intern., high S/N)     ASTRRMS1=         2.362887E-05 / Astrom. dispersion RMS (ref., high S/N)        ASTRRMS2=          2.36868E-05 / Astrom. dispersion RMS (ref., high S/N)        ASTINST =                    1 / SCAMP astrometric instrument label             FLXSCALE=                   0. / SCAMP relative flux scale                      MAGZEROP=                   0. / SCAMP zero-point                               PHOTIRMS=                   0. / mag dispersion RMS (internal, high S/N)        RA_RMS  =            0.1040474 / [arcsec] RMS of SCAMP fit from 2MASS matching  DEC_RMS =            0.1017731 / [arcsec] RMS of SCAMP fit from 2MASS matching  ASTROMN =                 2636 / Number of stars in SCAMP astrometric solution  SCAMPPTH= 'NotAvailable'       / SCAMP catalog path                             SCAMPFIL= 'NotAvailable'       / SCAMP catalog file                                                                                                                       / SIP DISTORTION KEYWORDS                                                                                                                                                                                                                       / DATA FLOW                                                                                                                                           ORIGNAME= '/data/PTF_default_37806.fits' / Filename as written by the camera    FILENAME= 'PTF201407312014_2_o_37806.fits' / Filename of delivered camera image PROCORIG= 'IPAC-PTF pipelines' / Processing origin                              PROCDATE= 'Fri Sep 26 14:52:55 2014' / Processing date/time (Pacific time)      PTFVERSN=                   5. / Version of PTFSCIENCEPIPELINE program          PMASKPTH= '/ptf/pos/archive/fallbackcal/pmasks/' / Pathname of pixel mask       PMASKFIL= '70sOn35s_pixmask_chip5.trimmed.v4.fits' / Filename of pixel mask     SFLATPTH= '/ptf/pos/sbx2/2014/07/31/f2/c5/cal/p4/cId112103/' / Pathname of superSFLATFIL= 'PTF_201407310000_i_s_flat_t120000_u000112103_f02_p000000_c05.fits'   SBIASPTH= '/ptf/pos/sbx2/2014/07/31/f2/c5/cal/p1/cId112095/' / Pathname of superSBIASFIL= 'PTF_201407310000_i_s_bias_t120000_u000112095_f00_p000000_c05.fits'   DBNID   =                 1938 / Database night ID                              DBEXPID =               446050 / Database exposure ID                           DBRID   =              6985566 / Database raw-image ID                          DBPID   =             21528832 / Database processed-image ID                    DBFID   =                    2 / Database filter ID                             DBPIID  =                    1 / Database P.I. ID                               DBPRID  =                   31 / Database project ID                            DBFIELD =               446050 / Database field ID                              DBSVID  =                   54 / Database software-version ID                   DBCVID  =                   60 / Database config-data-file ID                   INFOBITS=                    0 / Database infobits (2^2 and 2^3 excluded)       END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"id":7627,"name":"validate.7.6.txt","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"HDU 1:\n  WCS key ' ':\n    - RADECSYS= 'ICRS ' / Astrometric system\n      the RADECSYS keyword is deprecated, use RADESYSa.\n    - The WCS transformation has more axes (2) than the image it is\n      associated with (0)\n    - Removed redundant SCAMP distortion parameters because SIP\n      parameters are also present\n    - 'datfix' made the change 'Set MJD-OBS to 55007.362083 from DATE-\n      OBS'.\n\nHDU 2:\n  WCS key ' ':\n    - The WCS transformation has more axes (3) than the image it is\n      associated with (0)\n    - 'unitfix' made the change 'Changed units:\n        'HZ' -> 'Hz'.\n    - 'celfix' made the change 'In CUNIT3 : Mismatched units type\n      'length': have 'Hz', want 'm''."},{"id":7628,"name":"nonstandard_units.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"CD1_2   =            -3.72E-05                                                  CD1_3   =                    0                                                  CD1_1   =            -4.12E-05                                                  CUNIT3  = 'HZ      '                                                            CUNIT2  = 'M/S     '                                                            CTYPE1  = 'RA---TAN'                                                            NAXIS   =                    3                                                  CTYPE3  = 'AWAV    '                                                            CD2_1   =            -3.72E-05                                                  CTYPE2  = 'DEC--TAN'                                                            CD2_3   =                    0                                                  CD2_2   =             4.12E-05                                                  CUNIT1  = 'deg     '                                                            CD3_1   =                    0                                                  CD3_2   =                    0                                                  CD3_3   =                  0.2                                                  END"},{"id":7629,"name":"unit.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"SIMPLE  =                    T / conforms to FITS standard                      BITPIX  =                  -64 / array data type                                NAXIS   =                    3 / number of array dimensions                     NAXIS1  =                  400                                                  NAXIS2  =                  300                                                  NAXIS3  =                  251                                                  EQUINOX =               2000.0                                                  CTYPE1  = 'GLON-CAR'                                                            CTYPE2  = 'GLAT-CAR'                                                            CTYPE3  = 'VRAD'                                                                SPECSYS = 'LSRK'                                                                CUNIT3  = 'km/s    '                                                            BUNIT   = 'K       '                                                            CRVAL1  =            49.209553                                                  CRVAL2  =                  0.0                                                  CRVAL3  =                 50.0                                                  CRPIX1  =                200.0                                                  CRPIX2  =                288.0                                                  CRPIX3  =                125.0                                                  CDELT1  = -0.00333333333333333                                                  CDELT2  = 0.003333333333333333                                                  CDELT3  =                  0.5                                                  RESTFREQ=                1000.                                                  TELESCOP= 'Arecibo'                                                             END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"id":7630,"name":"sip-broken.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"XTENSION= 'IMAGE   '           / Image extension                                BITPIX  =                  -32 / array data type                                NAXIS   =                    2 / number of array dimensions                     NAXIS1  =                   10                                                  NAXIS2  =                   10                                                  PCOUNT  =                    0 / number of parameters                           GCOUNT  =                    1 / number of groups                               ORIGIN  = 'NOAO-IRAF FITS Image Kernel July 2003' / FITS file originator        EXTNAME = 'SCI     '           / Extension name                                 EXTVER  =                    1 / Extension version                              IRAF-TLM= '2010-01-28T21:42:25' / Time of last modification                     DATE    = '2010-01-15T03:23:55' / Date FITS file was generated                  INHERIT =                    T / inherit the primary header                     EXPNAME = 'ibc301qrq                ' / exposure identifier                     BUNIT   = 'electrons'          / brightness units                                                                                                                             / CCD CHIP IDENTIFICATION                                                                                                                         CCDCHIP =                    2 / CCD chip (1 or 2)                                                                                                                            / World Coordinate System and Related Parameters                                                                                                  WCSAXES =                    2 / number of World Coordinate System axes         CRPIX1  =               2048.0 / x-coordinate of reference pixel                CRPIX2  =               1026.0 / y-coordinate of reference pixel                CRVAL1  =        201.682062444 / first axis value at reference pixel            CRVAL2  =   -47.46654604529999 / second axis value at reference pixel           CTYPE1  = 'RA---TAN-SIP'       / the coordinate type for the first axis         CTYPE2  = 'DEC--TAN-SIP'       / the coordinate type for the second axis        CD1_1   = 9.89532021391661E-06 / partial of first axis coordinate w.r.t. x      CD1_2   = 5.57454535620407E-06 / partial of first axis coordinate w.r.t. y      CD2_1   = 4.96143358219569E-06 / partial of second axis coordinate w.r.t. x     CD2_2   = -9.5612017076973E-06 / partial of second axis coordinate w.r.t. y     LTV1    =        0.0000000E+00 / offset in X to subsection start                LTV2    =        0.0000000E+00 / offset in Y to subsection start                LTM1_1  =                  1.0 / reciprocal of sampling rate in X               LTM2_2  =                  1.0 / reciprocal of sampling rate in Y               PA_APER =              149.806 / Position Angle of reference aperture center (deVAFACTOR=                  1.0 / velocity aberration plate scale factor         ORIENTAT=    149.7956191662691 / position angle of image y axis (deg. e of n)   RA_APER =   2.016928333333E+02 / RA of aperture reference position              DEC_APER=  -4.747905555556E+01 / Declination of aperture reference position                                                                                                   / REPEATED EXPOSURES INFORMATION                                                                                                                  NCOMBINE=                    1 / number of image sets combined during CR rejecti                                                                                              / PHOTOMETRY KEYWORDS                                                                                                                             PHOTMODE= 'WFC3 UVIS2 F606W CAL' / observation con                              PHOTFLAM=        1.1598989E-19 / inverse sensitivity, ergs/cm2/Ang/electron     PHOTFNU =        1.3410633E-07 / inverse sensitivity, Jy*sec/electron           PHOTZPT =       -2.1100000E+01 / ST magnitude zero point                        PHOTPLAM=        5.8874194E+03 / Pivot wavelength (Angstroms)                   PHOTBW  =        6.5663947E+02 / RMS bandwidth of filter plus detector                                                                                                        / READOUT DEFINITION PARAMETERS                                                                                                                   CENTERA1=                 2104 / subarray axis1 center pt in unbinned dect. pix CENTERA2=                 1036 / subarray axis2 center pt in unbinned dect. pix SIZAXIS1=                 4096 / subarray axis1 size in unbinned detector pixelsSIZAXIS2=                 2051 / subarray axis2 size in unbinned detector pixelsBINAXIS1=                    1 / axis1 data bin size in unbinned detector pixelsBINAXIS2=                    1 / axis2 data bin size in unbinned detector pixels                                                                                              / DATA PACKET INFORMATION                                                                                                                         FILLCNT =                    0 / number of segments containing fill             ERRCNT  =                    0 / number of segments containing errors           PODPSFF =                    F / podps fill present (T/F)                       STDCFFF =                    F / science telemetry fill data present (T=1/F=0)  STDCFFP = 'x5569 '             / science telemetry fill pattern (hex)                                                                                                         / IMAGE STATISTICS AND DATA QUALITY FLAGS                                                                                                         NGOODPIX=              8361737 / number of good pixels                          SDQFLAGS=                31743 / serious data quality flags                     GOODMIN =       -1.5353586E+10 / minimum value of good pixels                   GOODMAX =        4.4784176E+08 / maximum value of good pixels                   GOODMEAN=       -1.7965331E+03 / mean value of good pixels                      SNRMIN  =       -4.0580401E+00 / minimum signal to noise of good pixels         SNRMAX  =        2.0669971E+02 / maximum signal to noise of good pixels         SNRMEAN =        9.1055450E+00 / mean value of signal to noise of good pixels   SOFTERRS=                    0 / number of soft error pixels (DQF=1)            MEANDARK=       -9.8821044E-04 / average of the dark values subtracted          MEANBLEV=        2.5543987E+03 / average of all bias levels subtracted          MEANFLSH=             0.000000 / Mean number of counts in post flash exposure   OCX10   = 0.000175023073097690                                                  OCX11   =  0.03978145867586136                                                  OCY10   =  0.03984303399920464                                                  OCY11   = 0.002337893005460501                                                  IDCSCALE=              0.03962                                                  WCSNAMEO= 'OPUS    '                                                            WCSAXESO=                    2                                                  CRPIX1O =               2048.0                                                  CRPIX2O =               1026.0                                                  CDELT1O =                    1                                                  CDELT2O =                    1                                                  CUNIT1O = 'deg     '                                                            CUNIT2O = 'deg     '                                                            CTYPE1O = 'RA---TAN'                                                            CTYPE2O = 'DEC--TAN'                                                            CRVAL1O =        201.682062444                                                  CRVAL2O =       -47.4665460453                                                  LONPOLEO=                  180                                                  LATPOLEO=       -47.4665460453                                                  RESTFRQO=                    0                                                  RESTWAVO=                    0                                                  CD1_1O  = 9.90756999999999E-06                                                  CD1_2O  =          5.55896E-06                                                  CD2_1O  =           4.9244E-06                                                  CD2_2O  =         -9.54957E-06                                                  IDCTAB  = 'iref$v5r1512gi_idc.fits'                                             A_3_1   = -5.1021945200133E-16                                                  A_3_0   = 2.01645819721643E-11                                                  B_3_0   = 1.69320438397225E-12                                                  B_3_1   = 1.63251006567400E-15                                                  B_1_2   = -1.4255424755601E-11                                                  B_1_3   = -2.7323406250153E-15                                                  B_1_1   = 2.81503635244692E-06                                                  B_2_1   = 1.84371537198681E-11                                                  B_2_0   = -4.1200147469028E-08                                                  B_2_2   = 1.39530876683604E-14                                                  A_4_0   = 1.93073916740935E-15                                                  A_ORDER =                    4                                                  B_0_4   = 7.44136342655120E-15                                                  B_0_3   = 1.35699782198128E-11                                                  B_0_2   = -3.0813836048843E-06                                                  B_ORDER =                    4                                                  B_4_0   = 6.75894948156410E-16                                                  A_1_1   = -2.9689459039407E-06                                                  A_1_3   = -2.5561816554973E-15                                                  A_1_2   = 1.61518535366509E-11                                                  A_0_4   = -1.7441112473874E-14                                                  A_0_2   = 9.41762068657988E-08                                                  A_0_3   = 2.11281723091275E-11                                                  A_2_2   = -1.7127070982784E-14                                                  A_2_0   = 2.87050290904523E-06                                                  A_2_1   = -1.4037704327792E-11                                                  IDCTHETA=                 45.0                                                  IDCXREF =               2048.0                                                  IDCYREF =               1026.0                                                  IDCV2REF=   -27.56800079345703                                                  IDCV3REF=   -33.30899810791016                                                  WCSNAMEA= 'IDC_v5r1512gi'                                                       WCSAXESA=                    2                                                  CRPIX1A =                 2048                                                  CRPIX2A =                 1026                                                  CDELT1A =                    1                                                  CDELT2A =                    1                                                  CUNIT1A = 'deg     '                                                            CUNIT2A = 'deg     '                                                            CTYPE1A = 'RA---TAN-SIP'                                                        CTYPE2A = 'DEC--TAN-SIP'                                                        CRVAL1A =        201.682062444                                                  CRVAL2A =       -47.4665460453                                                  LONPOLEA=                  180                                                  LATPOLEA=       -47.4665460453                                                  RESTFRQA=                    0                                                  RESTWAVA=                    0                                                  CD1_1A  =    9.89532021392E-06                                                  CD1_2A  =     5.5745453562E-06                                                  CD2_1A  =     4.9614335822E-06                                                  CD2_2A  =    -9.5612017077E-06                                                  A_3_1O  = -5.1021945200133E-16                                                  A_3_0O  = 2.01645819721643E-11                                                  B_3_0O  = 1.69320438397225E-12                                                  B_3_1O  =   1.632510065674E-15                                                  B_1_2O  = -1.4255424755601E-11                                                  B_1_3O  = -2.7323406250153E-15                                                  B_1_1O  = 2.81503635244692E-06                                                  B_2_1O  = 1.84371537198681E-11                                                  B_2_0O  = -4.1200147469028E-08                                                  B_2_2O  = 1.39530876683604E-14                                                  B_ORDERO=                    4                                                  A_ORDERO=                    4                                                  B_0_4O  =  7.4413634265512E-15                                                  B_0_3O  = 1.35699782198128E-11                                                  B_0_2O  = -3.0813836048843E-06                                                  A_4_0O  = 1.93073916740935E-15                                                  B_4_0O  =  6.7589494815641E-16                                                  A_1_1O  = -2.9689459039407E-06                                                  A_1_3O  = -2.5561816554973E-15                                                  A_1_2O  = 1.61518535366509E-11                                                  A_0_4O  = -1.7441112473874E-14                                                  A_0_2O  = 9.41762068657988E-08                                                  A_0_3O  = 2.11281723091275E-11                                                  A_2_2O  = -1.7127070982784E-14                                                  A_2_0O  = 2.87050290904523E-06                                                  A_2_1O  = -1.4037704327792E-11                                                  WCSNAME = 'IDC_v5r1512gi'                                                       WCSNAMEB= 'IDC_v5r1512gi'                                                       WCSAXESB=                    2                                                  CRPIX1B =               2048.0                                                  CRPIX2B =               1026.0                                                  CDELT1B =                    1                                                  CDELT2B =                    1                                                  CUNIT1B = 'deg     '                                                            CUNIT2B = 'deg     '                                                            CTYPE1B = 'RA---TAN-SIP'                                                        CTYPE2B = 'DEC--TAN-SIP'                                                        CRVAL1B =        201.682062444                                                  CRVAL2B =       -47.4665460453                                                  LONPOLEB=                  180                                                  LATPOLEB=       -47.4665460453                                                  RESTFRQB=                    0                                                  RESTWAVB=                    0                                                  A_3_1B  = -5.1021945200133E-16                                                  A_3_0B  = 2.01645819721643E-11                                                  B_3_0B  = 1.69320438397225E-12                                                  B_3_1B  =   1.632510065674E-15                                                  B_1_2B  = -1.4255424755601E-11                                                  B_1_3B  = -2.7323406250153E-15                                                  B_1_1B  = 2.81503635244692E-06                                                  B_2_1B  = 1.84371537198681E-11                                                  B_2_0B  = -4.1200147469028E-08                                                  B_2_2B  = 1.39530876683604E-14                                                  B_ORDERB=                    4                                                  A_ORDERB=                    4                                                  B_0_4B  =  7.4413634265512E-15                                                  B_0_3B  = 1.35699782198128E-11                                                  B_0_2B  = -3.0813836048843E-06                                                  A_4_0B  = 1.93073916740935E-15                                                  B_4_0B  =  6.7589494815641E-16                                                  A_1_1B  = -2.9689459039407E-06                                                  A_1_3B  = -2.5561816554973E-15                                                  A_1_2B  = 1.61518535366509E-11                                                  A_0_4B  = -1.7441112473874E-14                                                  A_0_2B  = 9.41762068657988E-08                                                  A_0_3B  = 2.11281723091275E-11                                                  A_2_2B  = -1.7127070982784E-14                                                  A_2_0B  = 2.87050290904523E-06                                                  A_2_1B  = -1.4037704327792E-11                                                  CD1_1B  =    9.89532021392E-06                                                  CD1_2B  =     5.5745453562E-06                                                  CD2_1B  =     4.9614335822E-06                                                  CD2_2B  =    -9.5612017077E-06                                                  WCSNAMEC= 'TWEAK_A '                                                            WCSAXESC=                    2                                                  CRPIX1C =               2048.0                                                  CRPIX2C =               1026.0                                                  CDELT1C =                    1                                                  CDELT2C =                    1                                                  CUNIT1C = 'deg     '                                                            CUNIT2C = 'deg     '                                                            CTYPE1C = 'RA---TAN-SIP'                                                        CTYPE2C = 'DEC--TAN-SIP'                                                        CRVAL1C =        201.682062444                                                  CRVAL2C =       -47.4665460453                                                  LONPOLEC=                  180                                                  LATPOLEC=       -47.4665460453                                                  RESTFRQC=                    0                                                  RESTWAVC=                    0                                                  A_3_1C  = -5.1021945200133E-16                                                  A_3_0C  = 2.01645819721643E-11                                                  B_3_0C  = 1.69320438397225E-12                                                  B_3_1C  =   1.632510065674E-15                                                  B_1_2C  = -1.4255424755601E-11                                                  B_1_3C  = -2.7323406250153E-15                                                  B_1_1C  = 2.81503635244692E-06                                                  B_2_1C  = 1.84371537198681E-11                                                  B_2_0C  = -4.1200147469028E-08                                                  B_2_2C  = 1.39530876683604E-14                                                  B_ORDERC=                    4                                                  A_ORDERC=                    4                                                  B_0_4C  =  7.4413634265512E-15                                                  B_0_3C  = 1.35699782198128E-11                                                  B_0_2C  = -3.0813836048843E-06                                                  A_4_0C  = 1.93073916740935E-15                                                  B_4_0C  =  6.7589494815641E-16                                                  A_1_1C  = -2.9689459039407E-06                                                  A_1_3C  = -2.5561816554973E-15                                                  A_1_2C  = 1.61518535366509E-11                                                  A_0_4C  = -1.7441112473874E-14                                                  A_0_2C  = 9.41762068657988E-08                                                  A_0_3C  = 2.11281723091275E-11                                                  A_2_2C  = -1.7127070982784E-14                                                  A_2_0C  = 2.87050290904523E-06                                                  A_2_1C  = -1.4037704327792E-11                                                  CD1_1C  =    9.89532021392E-06                                                  CD1_2C  =     5.5745453562E-06                                                  CD2_1C  =     4.9614335822E-06                                                  CD2_2C  =    -9.5612017077E-06                                                  FITNAMEC= 'TWEAK_A '                                                            NMATCHC =                    0                                                  RMS_RAC =                  0.0                                                  RMS_DECC=                  0.0                                                  HISTORY The following throughput tables were used: crotacomp$hst_ota_007_syn.fitHISTORY s, crwfc3comp$wfc3_pom_001_syn.fits, crwfc3comp$wfc3_uvis_mir1_002_syn.fHISTORY its, crwfc3comp$wfc3_uvis_mir2_002_syn.fits, crwfc3comp$wfc3_uvis_f606w_HISTORY 002_syn.fits, crwfc3comp$wfc3_uvis_owin_002_syn.fits, crwfc3comp$wfc3_uvHISTORY is_iwin_002_syn.fits, crwfc3comp$wfc3_uvis_ccd2_003_syn.fits, crwfc3compHISTORY $wfc3_uvis_f606wf2_001_syn.fits, crwfc3comp$wfc3_uvis_cor_003_syn.fits  END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"id":7631,"name":"zpn-hole.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"NAXIS   = 2                                                                     NAXIS1  =                 200                                                   NAXIS2  =                 200                                                   CTYPE1  = 'RA---ZPN'                                                            CRPIX1  =  100                                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--ZPN'                                                            CRPIX2  =   100                                                                 CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =  -9.000000000000E+01 / Native latitude  of celestial pole             PV2_0   =  10.000000000000E-02 / Projection parameter 0                         PV2_1   =   9.750000000000E-01 / Projection parameter 1                         END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"id":7632,"name":"sip2.fits","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"SIMPLE  =                    T / conforms to FITS standard                      BITPIX  =                    8 / array data type                                NAXIS   =                    0 / number of array dimensions                     WCSAXES =                    2 / Number of coordinate axes                      CRPIX1  =                128.0 / Pixel coordinate of reference point            CRPIX2  =                128.0 / Pixel coordinate of reference point            PC1_1   =    0.000249756880272 / Coordinate transformation matrix element       PC1_2   =    0.000230177809744 / Coordinate transformation matrix element       PC2_1   =    0.000230428519265 / Coordinate transformation matrix element       PC2_2   =   -0.000249965770577 / Coordinate transformation matrix element       CDELT1  =                    1 / [deg] Coordinate increment at reference point  CDELT2  =                    1 / [deg] Coordinate increment at reference point  CUNIT1  = 'deg'                / Units of coordinate increment and value        CUNIT2  = 'deg'                / Units of coordinate increment and value        CTYPE1  = 'RA---TAN-SIP'       / Right ascension, gnomonic projection           CTYPE2  = 'DEC--TAN-SIP'       / Declination, gnomonic projection               CRVAL1  =        202.482322805 / [deg] Coordinate value at reference point      CRVAL2  =          47.17511893 / [deg] Coordinate value at reference point      LONPOLE =                  180 / [deg] Native longitude of celestial pole       LATPOLE =          47.17511893 / [deg] Native latitude of celestial pole        RESTFRQ =                    0 / [Hz] Line rest frequency                       RESTWAV =                    0 / [Hz] Line rest wavelength                      CRDER1  =    4.02509762361E-05 / [deg] Random error in coordinate               CRDER2  =    3.42746131953E-05 / [deg] Random error in coordinate               RADESYS = 'ICRS'               / Equatorial coordinate system                   EQUINOX =                 2000 / [yr] Equinox of equatorial coordinates         A_3_0   =          -1.4172E-07                                                  B_3_0   =          -2.0249E-08                                                  B_1_2   =          -5.7813E-09                                                  B_1_1   =          -2.4386E-05                                                  B_2_1   =          -1.6583E-07                                                  B_2_0   =           2.1197E-06                                                  A_ORDER =                    3                                                  B_0_3   =          -1.6168E-07                                                  B_0_2   =             2.31E-05                                                  B_ORDER =                    3                                                  A_1_1   =           2.1886E-05                                                  A_1_2   =          -1.6847E-07                                                  A_0_2   =           2.9656E-06                                                  A_0_3   =           3.7746E-09                                                  A_2_0   =          -2.3863E-05                                                  A_2_1   =           -8.561E-09                                                  END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"id":7633,"name":"irac_sip.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / FOUR-BYTE SINGLE PRECISION FLOATING POINT      NAXIS   =                    2 / STANDARD FITS FORMAT                           NAXIS1  =                  256 / STANDARD FITS FORMAT                           NAXIS2  =                  256 / STANDARD FITS FORMAT                           EXTEND  =                    T / TAPE MAY HAVE STANDARD FITS EXTENSIONS         ORIGIN  = 'SIRTF Science Center' / Organization generating this FITS file       CREATOR = 'S8.9.0'             / SW version used to create this FITS file       TELESCOP= 'SIRTF   '           / SIRTF spacecraft                               INSTRUME= 'IRAC    '           / SIRTF instrument ID                            COMMENT   Controlled data files (CDFs) used:                                    COMMENT   w_bqd_files_to_copy_to_sandbox.nl, fileID = 2                         COMMENT   w_bqd_pointrefine.nl, fileID = 120903                                 CHNLNUM =                    1 / 1 digit instrument channel number              EXPTYPE = 'sci     '           / Exposure Type                                  REQTYPE = 'AOR     '           / Request type (AOR, IER, or  SER)               AOT_TYPE= 'IracMap '           / Observation template type                      AORLABEL= 'NSMLT-0013 HP'      / AOR Label                                      FOVID   =                   74 / Field of View ID                               FOVNAME = 'IRAC_Center_of_4.5&8.0umArray' / Field of View Name                                                                                                            / PROPOSAL INFORMATION                                                                                                                                OBSRVR  = 'Giovanni Fazio'     / Observer Name (Last, First)                    OBSRVRID=                    2 / Observer ID of Principal Investigator          PROCYCL =                    1 / Proposal Cycle                                 PROGID  =                   35 / Program ID                                     PROTITLE= 'MULTIPLICTY AND INFRARED COLORS OF NEARBY MLT DWARFS' / Program TitlePROGCAT =                   29 / Program Category                                                                                                                         / TIME AND EXPOSURE INFORMATION                                                                                                                       DATE_OBS= '2003-12-06T10:46:35.021' / Date & time at DCE start                  MJD_OBS =            52979.449 / [days] MJD at DCE start (,JD-2400000.05)       UTCS_OBS=        123979595.021 / [sec] J2000 ephem. time at DCE start           SCLK_OBS=        755174834.035 / [sec] SCLK time (since 1/1/1980) at DCE start  SAMPTIME=                  0.2 / [sec] Sample integration time                  FRAMTIME=                  30. / [sec] Time spent integrating (whole array)     COMMENT   Photons in Well = Flux[photons/sec/pixel] * FRAMTIME                  EXPTIME =                 26.8 / [sec] Effective integration time per pixel     COMMENT   DN per pixel = Flux[photons/sec/pixel] / GAIN * EXPTIME               AINTBEG =            43146779. / [Secs since IRAC turn-on] Time of integ. start ATIMEEND=            431497.75 / [Secs since IRAC turn-on] Time of integ. end   AFOWLNUM=                   16 / Fowler number                                  AWAITPER=                  118 / [0.2 sec] Wait period                          ANUMREPS=                    1 / Number of repeat integrations                  AREADMOD=                    0 / Full (0) or subarray (1)                       ABARREL =                    4 / Barrel shift                                   APEDSIG =                    0 / 0=Normal, 1=Pedestal, 2=Signal                                                                                                           / TARGET AND POINTING INFORMATION                                                                                                                     OBJECT  = 'BRI0021-02'         / Target Name                                    OBJTYPE = 'TargetFixedSingle'  / Object Type                                    CRVAL1  =     6.15501347619052 / [deg] RA at CRPIX1,CRPIX2 averaged over DCE    CRVAL2  =    -2.07230798888938 / [deg] DEC at CRPIX1,CRPIX2 averaged over DCE   RA_HMS  = '00h24m37.2s'        / [hh:mm:ss.s] CRVAL1 as sexagesimal             DEC_DMS = '-02d04m20s'         / [dd:mm:ss] CRVAL2 as sexagesimal               RADESYS = 'ICRS    '           / International Celestial Reference System       EQUINOX =  2000.               / Equinox for ICRF celestial coord. system       CD1_1   = -0.000147943581033529                                                 CD1_2   = 0.000305150643914974                                                  CD2_1   = 0.000305100010374518                                                  CD2_2   = 0.000147710276207053                                                  CTYPE1  = 'RA---TAN-SIP'       / RA---TAN with distortion in pixel space        CTYPE2  = 'DEC--TAN-SIP'       / DEC--TAN with distortion in pixel space        CRPIX1  =                 128. / Reference pixel along axis 1                   CRPIX2  =                 128. / Reference pixel along axis 2                   CRDER1  = 0.000630078723280563 / [deg] Uncertainty in CRVAL1                    CRDER2  = 0.000630066308654874 / [deg] Uncertainty in CRVAL2                    UNCRTPA =  0.00186634833181778 / [deg] Uncertainty in position angle            CSDRADEC= 5.27382080384386E-06 / [deg] Costandard deviation in RA and Dec       SIGRA   =    0.141175326515381 / [arcsec] RMS dispersion of RA over DCE         SIGDEC  =   0.0260011516228373 / [arcsec] RMS dispersion of DEC over DCE        SIGPA   =    0.786707814443969 / [arcsec] RMS dispersion of PA over DCE         PA      =      64.170376337596 / [deg] Position angle of axis 2 (E of N) (was ORRA_RQST =     6.15510111508666 / [deg] Requested RA at CRPIX1, CRPIX2           DEC_RQST=    -2.07249338178042 / [deg] Requested Dec at CRPIX1, CRPIX2          PM_RA   =              -1.4108 / [arcsec/yr] Proper Motion in RA (J2000)        PM_DEC  =              1.50775 / [arcsec/yr] Proper Motion in Dec (J200)        RMS_JIT =  0.00840644136311876 / [arcsec] RMS jitter during DCE                 RMS_JITY=  0.00544908399993541 / [arcsec] RMS jitter during DCE along Y         RMS_JITZ=  0.00640122956573203 / [arcsec] RMS jitter during DCE along Z         SIG_JTYZ=  0.00350446005496643 / [arcsec] Costadard deviation of jitter in YZ   PTGDIFF =    0.738140521808859 / [arcsec] Offset btwn actual and rqsted pntng   RA_REF  =     6.10241222222221 / [deg] Commanded RA (J2000) of ref. position    DEC_REF =    -1.97235500000001 / [deg] Commanded Dec (J2000) of ref. position   USEDBPHF=                    T / T if Boresight Pointing History File was used                                                                                            / DISTORTION KEYWORDS                                                                                                                                 A_ORDER =                    2 / polynomial order, axis 1, detector to sky      A_0_2   =            6.666E-06 / distortion coefficient                         A_1_1   =            1.801E-05 / distortion coefficient                         A_2_0   =           -2.353E-05 / distortion coefficient                         A_DMAX  =                 0.58 / [pixel] maximum correction                     B_ORDER =                    2 / polynomial order, axis 2, detector to sky      B_0_2   =            2.601E-05 / distortion coefficient                         B_1_1   =           -2.944E-05 / distortion coefficient                         B_2_0   =           -1.226E-06 / distortion coefficient                         B_DMAX  =                0.902 / [pixel] maximum correction                     AP_ORDER=                    2 / polynomial order, axis 1, sky to detector      AP_0_1  =           -5.463E-06 / distortion coefficient                         AP_0_2  =           -6.666E-06 / distortion coefficient                         AP_1_0  =             1.14E-05 / distortion coefficient                         AP_1_1  =           -1.801E-05 / distortion coefficient                         AP_2_0  =            2.353E-05 / distortion coefficient                         BP_ORDER=                    2 / polynomial order, axis 2, sky to detector      BP_0_1  =            1.975E-05 / distortion coefficient                         BP_0_2  =           -2.601E-05 / distortion coefficient                         BP_1_0  =           -1.495E-05 / distortion coefficient                         BP_1_1  =            2.944E-05 / distortion coefficient                         BP_2_0  =            1.225E-06 / distortion coefficient                                                                                                                   / PHOTOMETRY                                                                                                                                          BUNIT   = 'MJy/sr  '           / Units of image data                            FLUXCONV=                0.111 / Flux Conv. factor (MJy/Str per DN/sec)         GAIN    =                  3.3 / e/DN conversion                                                                                                                          / GENERAL MAPPING KEYWORDS                                                                                                                            CYCLENUM=                    6 / Current cycle number                           DITHPOS =                    1 / Current dither position                                                                                                                  / IRAC MAPPING KEYWORDS                                                                                                                               READMODE= 'FULL    '           / Readout mode                                   DITHSCAL= 'small   '           / Dither scale (small, medium, large)                                                                                                      / INSTRUMENT TELEMETRY DATA                                                                                                                           ASHTCON =                    2 / Shutter condition (1:closed, 2: open)          AWEASIDE=                    0 / WEA side in use (0:B, 1:A)                     ACTXSTAT=                    0 / Cmded transcal status                          ATXSTAT =                    0 / transcal status                                ACFLSTAT=                    0 / Cmded floodcal status                          AFLSTAT =                    0 / floodcal status                                AVRSTUCC=                 -3.5 / [Volts] Cmded VRSTUC Bias                      AVRSTBEG=          -3.51078391 / [Volts] VRSTUC Bias at start integration       AVDETC  =                -2.75 / [Volts] Cmded VDET Bias                        AVDETBEG=          -2.75721574 / [Volts] VDET Bias at start of integration      AVGG1C  =           -3.6500001 / [Volts] Cmded VGG1 Bias                        AVGG1BEG=           -3.2065742 / [Volts] VGG1 Bias at start of integration      AVDDUCC =                   -3 / [Volts] Cmded VDDUC Bias                       AVDDUBEG=                   -3 / [Volts] VDDUC Bias at start integration        AVGGCLC =                    1 / [Volts] Cmnded VGGCL clock rail voltage        AVGGCBEG=                    1 / [Volts] VGGCL clock rail voltage               AHTRIBEG=         204.70100403 / [uAmps] Heater current at start of integ       AHTRVBEG=           2.39006352 / [Volts] Heater Voltage at start integ.         AFPAT2B =          15.02370644 / [Deg_K] FPA Temp sensor #2 at start integ.     AFPAT2BT=          431446.8125 / [Sec] FPA Temp sensor #2 time tag              AFPAT2E =          15.02312088 / [Deg_K] FPA temp sensor #2, end integ.         AFPAT2ET=          431476.9375 / [Sec] FPA temp sensor #2 time tag              ACTENDT =          20.46821594 / [Deg_C] C&T board thermistor                   AFPECTE =          18.34936523 / [Deg_C] FPE control board thermistor           AFPEATE =          21.90242577 / [Deg_C] FPE analog board thermistor            ASHTEMPE=          21.59600639 / [Deg_C] Shutter board thermistor               ATCTEMPE=          22.81523895 / [Deg_C] Temp. controller board thermistor      ACETEMPE=          20.49869537 / [Deg_C] Calib. electronics board thermistor    APDTEMPE=          21.47408295 / [Deg_C] PDU board thermistor                   ACATMP1E=           1.31549275 / [Deg_K] CA Temp, end integration for temp1     ACATMP2E=           1.29850066 / [Deg_K] CA Temp, end integration for temp2     ACATMP3E=           1.33064687 / [Deg_K] CA Temp, end integration for temp3     ACATMP4E=            1.3274169 / [Deg_K] CA Temp, end integration for temp4     ACATMP5E=            1.3255291 / [Deg_K] CA Temp, end integration for temp5     ACATMP6E=           1.32403958 / [Deg_K] CA Temp, end integration for temp6     ACATMP7E=           1.32282794 / [Deg_K] CA Temp, end integration for temp7     ACATMP8E=           1.31592035 / [Deg_K] CA Temp, end integration for temp8                                                                                               / DATA FLOW KEYWORDS                                                                                                                                  ORIGIN0 = 'JPL_FOS '           / Site where RAW FITS file was written           CREATOR0= 'J5.1.0  '           / SW system that created RAW FITS                DATE    = '2003-12-17T00:52:57' / [YYYY-MM-DDThh:mm:ss UTC] file creation date  AORKEY  =              3937792 / AOR or EIR key. Astrnmy Obs Req/Instr Eng Req  EXPID   =                   11 / Exposure ID (0-9999)                           DCENUM  =                    0 / DCE number (0-9999)                            TLMGRPS =                    1 / expected number of groups                      FILE_VER=                    1 / Version of the raw file made by SIS            RAWFILE = 'IRAC.1.0003937792.0011.0000.01.mipl.fits' / Raw data file name       CPT_VER = '3.0.94  '           / Channel Param Table FOS versioN                CTD_VER = '3.0.94S '           / Cmded telemetry data version                   EXPDFLAG=                    F / (T/F) expedited DCE                            MISS_LCT=                    0 / Total Missed Line Cnt in this FITS             MANCPKT =                    F / T if this FITS is Missing Ancillary Data       MISSDATA=                    F / T if this FITS is Missing Image Data           PAONUM  =                  206 / PAO Number                                     CAMPAIGN= 'IRAC003500'         / Campaign                                       DCEID   =              6086781 / Data-Collection-Event ID                       DCEINSID=               626089 / DCE Instance ID                                DPID    =              2631728 / Data Product Instance ID                       PIPENUM =                  107 / Pipeline Script Number                         SOS_VER =                    2 / Data-Product Version                           PLVID   =                    4 / Pipeline Version ID                            CALID   =                    6 / CalTrans Version ID                                                                                                            SDRKEPID=                28809 / Sky Dark ensemble product ID                                                                                                   PMSKFBID=                  341 / Pixel mask ID                                  LINCFBID=                  357 / Fall-back Linearity correction ID              FLATFBID=                  718 / Fall-back flat ID                              FLXCFBID=                  349 / Flux conversion ID                             MBLTFBID=                  696 / Muxbleed Lookup Table ID                       MBCFFBID=                  704 / Muxbleed Coefficients ID                                                                                                                 / PROCESSING HISTORY                                                                                                                                  HISTORY job.c ver: 1.000000                                                     HISTORY TRANHEAD                  v.         11.9, ran Tue Dec 16 16:52:35 2003 HISTORY CALTRANS                 v.        2.7, ran Tue Dec 16 16:52:44 2003    HISTORY cvti2r4           v.  1.25 A30501, generated 12/16/03 at 16:52:44       HISTORY FFCORR                 v. 1.000, ran Tue Dec 16 16:52:46 2003           HISTORY MUXBLEEDCORR              v.        1.600, ran Tue Dec 16 16:52:50 2003 HISTORY FOWLINEARIZE              v.     4.800000, ran Tue Dec 16 16:52:50 2003 HISTORY DARKSUBNG                 v. 1.000, ran Tue Dec 16 16:52:51 2003        HISTORY DARKDRIFT                 v.          3.5, ran Tue Dec 16 16:52:52 2003 HISTORY FLATAP                    v. 1.300   Tue Dec 16 16:52:53 2003           HISTORY DNTOFLUX                  v.          3.7, ran Tue Dec 16 16:52:57 2003 HISTORY PREDICTSAT                v.     3.500000, ran Tue Dec 16 16:57:59 2003 HISTORY CALTRANS                 v.        2.7, ran Tue Dec 16 17:07:31 2003    HISTORY PTNTRAN                   v.          1.2, ran Tue Dec 16 17:07:32 2003 HISTORY FPGen                     v.         1.22, ran Tue Dec 16 17:07:33 2003 HISTORY CALTRANS                 v.        2.7, ran Wed Dec 17 06:14:18 2003    SOFTWARE= 'pointingrefine'     / Pointing refinement using pnt-src correlation  PTGVERSN=                  5.3 / Version number of pointingrefine program       RARFND  =     6.15526023786181 / [deg] Refined RA                               DECRFND =    -2.07244250543341 / [deg] Refined DEC                              CT2RFND =    -64.5569826743286 / [deg] Refined CROTA2                           PA_RFND =     64.5569826743286 / [deg] Refined PA (= -CROTA2_refined)           ERARFND = 0.000535377007940228 / [deg] Error in refined RA                      EDECRFND=  0.00123072014833503 / [deg] Error in refined DEC                     EPA_RFND=     2.28015678741471 / [deg] Error in refined PA or CROTA2            NASTROM =                    6 / # Astrometric sources for absolute refinement  RARESID =   -0.887761029918005 / [arcsec] Residual: Observed-Refined RA         DECRESID=    0.484259558515454 / [arcsec] Residual: Observed-Refined DEC        PA_RESID=     -1391.7828122373 / [arcsec] Residual: Observed-Refined PA         CD11RFND= -0.000145881550132727 / [deg/pix] Refined CD matrix element 1_1       CD12RFND= 0.000306140372692502 / [deg/pix] Refined CD matrix element 1_2        CD21RFND=  0.00030609131452955 / [deg/pix] Refined CD matrix element 2_1        CD22RFND= 0.000145647908967425 / [deg/pix] Refined CD matrix element 2_2        END                                                                             "},{"id":7634,"name":"too_many_pv.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"SIMPLE  =                    T / Fits standard                                  BITPIX  =                   16 / FOUR-BYTE SINGLE PRECISION FLOATING POINT      NAXIS   =                    2 / STANDARD FITS FORMAT                           NAXIS1  =                 2048 / STANDARD FITS FORMAT                           NAXIS2  =                 4096 / STANDARD FITS FORMAT                           ORIGIN  = 'Palomar Transient Factory' / Origin of these image data              CREATOR = 'Infrared Processing and Analysis Center' / Creator of this FITS file DATE    = '2011-08-01T15:14:04' / File creation date (YYYY-MM-DDThh:mm:ss UT)                                                                                             / PTF DMASK BIT DEFINITIONS                                                                                                                           BIT00   =                    0 / AIRCRAFT/SATELLITE TRACK                       BIT01   =                    1 / OBJECT (detected by SExtractor)                BIT02   =                    2 / HIGH DARK-CURRENT                              BIT03   =                    3 / RESERVED FOR FUTURE USE                        BIT04   =                    4 / NOISY                                          BIT05   =                    5 / GHOST                                          BIT06   =                    6 / CCD BLEED                                      BIT07   =                    7 / RAD HIT                                        BIT08   =                    8 / SATURATED                                      BIT09   =                    9 / DEAD/BAD                                       BIT10   =                   10 / NAN (not a number)                             BIT11   =                   11 / DIRTY (10-sigma below coarse local median)     BIT12   =                   12 / HALO                                           BIT13   =                   13 / RESERVED FOR FUTURE USE                        BIT14   =                   14 / RESERVED FOR FUTURE USE                        BIT15   =                   15 / RESERVED FOR FUTURE USE                                                                                                                  / DATA FLOW                                                                                                                                           PMASKPTH= '/ptf/pos/archive/fallbackcal/pmasks/' / Pixel-mask pathname          PMASKFIL= 'bpm_2009060s_c07.v2.fits' / Pixel-mask filename                      UDMPROC = 'updatemask'         / Update bit in dmask                            UDMVERSN=                   1. / Version of updatemask program                  UDMOP   =                    0 / Operation type                                 UDMMBT  =                    4 / Mask bit template                              UDMIFIL = 'bpm_2009060s_c07.v1.fits' / Program updatemask input file            UDMOFIL = 'bpm_2009060s_c07.v2.fits' / Program updatemask output file           MCVERSN =                   1. / Version of ptfMaskCombine program              PTFPPROC= 'ptfPostProc'        / Flags proc NaNs, CCD-bleeds and rad hits       PPRVERSN=                   3. / Version of ptfPostProc program                                                                                                           / COPY OF IMAGE HEADER BELOW                                                                                                                          ORIGIN  = 'Palomar Transient Factory' / Origin of these image data              CREATOR = 'Infrared Processing and Analysis Center' / Creator of this FITS file TELESCOP= 'P48     '           / Name of telescope                              INSTRUME= 'PTF/MOSAIC'         / Instrument name                                OBSERVER= 'KulkarniPTF'        / Observer name and project                      CCDID   = '7       '           / CCD number (0..11)                             DATE-OBS= '2009-06-25T08:41:23.970' / UTC shutter time YYYY-MM-DDTHH:MM:SS.SSS  DATE    = '2011-07-30T15:04:59' / File creation date (YYYY-MM-DDThh:mm:ss UT)   REFERENC= 'http://www.astro.caltech.edu/ptf' / URL of PTF website                                                                                                         / PROPOSAL INFORMATION                                                                                                                                PTFPRPI = 'Kulkarni'           / PTF Project PI                                 PTFPID  = '20000   '           / Project type: 00000-49999                      OBJECT  = 'PTF_survey'         / Fields object                                  PTFFIELD= '2899    '           / PTF unique field ID                            PTFFLAG = '1       '           / 1 = PTF; 0 = non-PTF category                                                                                                            / TIME AND EXPOSURE INFORMATION                                                                                                                       FILTER  = 'R       '           / Filter name                                    FILTERID= '2       '           / Filter ID                                      FILTERSL= '2       '           / Filter changer slot position                   EXPTIME =                  60. / [s] Requested exposure time                    AEXPTIME=                  60. / actual exposure time (sec)                     UTC-OBS = '2009-06-25T08:41:23.970' / UTC time shutter open YYYY-MM-DDTHH:MM:SS.OBSJD   =        2455007.86207 / [day] Julian day corresponds to UTC-OBS        OBSMJD  =          55007.36207 / MJD corresponds to UTC-OBS (day)               OBSLST  = '19:08:26.70'        / Mean LST corresponds to UTC-OBS 'HH:MM:SS.S'   HOURANG = '-3:09:09.78'        / Mean HA (sHH:MM:SS.S) based on LMST at UTC-OBS HJD     =        2455007.86457 / [day] Heliocentric Julian Day                  OBSTYPE = 'object  '           / Image type (dark,science,bias,focus)           IMGTYP  = 'object  '           / Image type (dark,science,bias,focus)                                                                                                     / MOON AND SUN                                                                                                                                        MOONRA  =           131.676395 / [deg] Moon J2000.0 R.A.                        MOONDEC =            16.207046 / [deg] Moon J2000.0 Dec.                        MOONILLF=             0.095389 / [frac] Moon illuminated fraction               MOONPHAS=             144.0201 / [deg] Moon phase angle                         MOONESB =                  -0. / Moon excess in sky brightness V-band           MOONALT =            -35.16959 / [deg] Moon altitude                            SUNAZ   =             13.90467 / [deg] Sun azimuth                              SUNALT  =            -31.96011 / [deg] Sun altitude                                                                                                                       / PHOTOMETRY                                                                                                                                          BUNIT   = 'DN      '           / Data number (analog-to-digital units or ADU)   PHTCALEX=                    1 / Was phot.-cal. module executed?                PHTCALFL=                    0 / Flag for image is photometric (0=N, 1=Y)       PCALRMSE=             0.030059 / RMSE from (zeropoint, extinction) data fit     IMAGEZPT=             22.43948 / Image magnitude zeropoint                      IZPORIG = 'CALTRANS'           / Photometric-calibration origin                 ZPRULE  = 'COMPUTE '           / Photometric-calibration method                 MAGZPT  =             22.73683 / Magnitude zeropoint at airmass=1               EXTINCT =              0.17995 / Extinction                                     APSFILT = 'r       '           / SDSS filter used in abs phot cal               APSCOL  = 'r-i     '           / SDSS color used in abs phot cal                APRMS   =            0.0554857 / RMS in mag of final abs phot cal               APBSRMS =           0.03911367 / RMS in mag of final abs phot cal for bright staAPNSTDI1=                69501 / Number of standard stars in first iteration    APNSTDIF=                64858 / Number of standard stars in final iteration    APCHI2  =      325618.88012443 / Chi2 of final abs phot cal                     APDOF   =               64858. / Dof of chi2 of final abs phot cal              APMEDJD =     2455007.84500722 / Median JD used in abs phot cal                 APPN01  = 'ZeroPoint'          / Name of parameter abs phot cal 01              APPAR01 =          22.81878918 / Value of parameter abs phot cal 01             APPARE01=           0.00198923 / Error of parameter abs phot cal 01             APPN02  = 'ColorTerm'          / Name of parameter abs phot cal 02              APPAR02 =           0.20481246 / Value of parameter abs phot cal 02             APPARE02=           0.00278076 / Error of parameter abs phot cal 02             APPN03  = 'AirMassTerm'        / Name of parameter abs phot cal 03              APPAR03 =          -0.12104427 / Value of parameter abs phot cal 03             APPARE03=            0.0011621 / Error of parameter abs phot cal 03             APPN04  = 'AirMassColorTerm'   / Name of parameter abs phot cal 04              APPAR04 =           0.00904321 / Value of parameter abs phot cal 04             APPARE04=           0.00176968 / Error of parameter abs phot cal 04             APPN05  = 'TimeTerm'           / Name of parameter abs phot cal 05              APPAR05 =           0.03012546 / Value of parameter abs phot cal 05             APPARE05=           0.00459951 / Error of parameter abs phot cal 05             APPN06  = 'Time2Term'          / Name of parameter abs phot cal 06              APPAR06 =           1.27460327 / Value of parameter abs phot cal 06             APPARE06=           0.07646497 / Error of parameter abs phot cal 06             APPN07  = 'XTerm   '           / Name of parameter abs phot cal 07              APPAR07 =           0.00768843 / Value of parameter abs phot cal 07             APPARE07=           0.00083226 / Error of parameter abs phot cal 07             APPN08  = 'YTerm   '           / Name of parameter abs phot cal 08              APPAR08 =           0.06680527 / Value of parameter abs phot cal 08             APPARE08=           0.00203667 / Error of parameter abs phot cal 08             APPN09  = 'Y2Term  '           / Name of parameter abs phot cal 09              APPAR09 =           0.31486016 / Value of parameter abs phot cal 09             APPARE09=           0.00318862 / Error of parameter abs phot cal 09             APPN10  = 'Y3Term  '           / Name of parameter abs phot cal 10              APPAR10 =           0.69934253 / Value of parameter abs phot cal 10             APPARE10=           0.01257477 / Error of parameter abs phot cal 10             APPN11  = 'XYTerm  '           / Name of parameter abs phot cal 11              APPAR11 =          -0.04590337 / Value of parameter abs phot cal 11             APPARE11=           0.00286729 / Error of parameter abs phot cal 11                                                                                                       / ASTROMETRY                                                                                                                                          CRVAL1  =     333.443801401309 / [deg] RA of reference point                    CRVAL2  =     3.08905544069643 / [deg] DEC of reference point                   CRPIX1  =             1175.019 / [pix] Image reference point                    CRPIX2  =             945.8826 / [pix] Image reference point                    CTYPE1  = 'RA---TAN-SIP'       / TAN (gnomic) projection + SIP distortions      CTYPE2  = 'DEC--TAN-SIP'       / TAN (gnomic) projection + SIP distortions      CUNIT1  = 'deg     '           / Image axis-1 celestial-coordinate units        CUNIT2  = 'deg     '           / Image axis-2 celestial-coordinate units        CRTYPE1 = 'deg     '           / Data units of CRVAL1                           CRTYPE2 = 'deg     '           / Data units of CRVAL2                           CD1_1   = 0.000281094342514378 / Transformation matrix                          CD1_2   = -5.00875320999652E-09                                                 CD2_1   = -2.08930602680508E-07                                                 CD2_2   = -0.000281284158795544                                                 OBJRA   = '22:17:08.571'       / Requested field J2000.0 Ra.                    OBJDEC  = '+03:22:30.00'       / Requested field J2000.0 Dec.                   OBJRAD  =           334.285714 / [deg] Requested field RA (J2000.0)             OBJDECD =                3.375 / [deg] Requested field Dec (J2000.0)            PIXSCALE=                 1.01 / [arcsec/pix] Pixel scale                       WCSAXES =                    2                                                  EQUINOX =                2000. / [yr] Equatorial coordinates definition         LONPOLE =                 180.                                                  LATPOLE =                   0.                                                                                                                                            / IMAGE QUALITY                                                                                                                                       SEEING  =                 2.04 / [pix] Seeing FWHM                              PEAKDIST=    0.396793397122491 / [pix] Mean dist brightest pixel-centroid pixel ELLIP   =                0.063 / Mean image ellipticity A/B                     ELLIPPA =                48.65 / [deg] Mean image ellipticity PA                FBIAS   =             1060.884 / [DN] Floating bias of the image                SATURVAL=               17000. / [DN] Saturation value of the CCD array         FWHMSEX =                 2.45 / [arcsec] SExtractor SEEING estimate            MDSKYMAG=             20.53072 / [mag/s-arcsec^2] Median sky obsolete           MSMAPCZP=             20.70926 / [mag/s-arcsec^2] Median sky abs. phot. cal.    LIMITMAG=             20.92587 / [mag/s-arcsec^2] Limiting magnitude obsolete   LMGAPCZP=             21.10442 / [mag/s-arcsec^2] Limiting mag. abs. phot. cal. MEDFWHM =             2.931446 / [arcsecond] Median FWHM                        MEDELONG=             1.132416 / [dimensionless] Median elongation              STDELONG=            0.3298569 / [dimensionless] Std. dev. of elongation        MEDTHETA=            -42.28234 / [deg] Atan(median sin(theta)/median cos(theta))STDTHETA=             66.21399 / [deg] Atan(stddev sin(theta)/stddev cos(theta))MEDDLMAG=             33.85928 / [mag/s-arcsec^2] Median (MU_MAX-MAG_AUTO)      STDDLMAG=            0.4367887 / [mag/s-arcsec^2] Stddev of (MU_MAX-MAG_AUTO)                                                                                             / OBSERVATORY AND TCS                                                                                                                                 OCS_TIME= '2009-06-25T08:41:23.978' / UTC Date for OCS calc time-dep params     OPERMODE= 'OCS     '           / Mode of operation: OCS | Manual | N/A          SOFTVER = '1.1.1.1 '           / Softwere version (TCS.Camera.OCS.Sched)        OCS_VER = '1       '           / OCS software version and date                  TCS_VER = '1       '           / TCS software version and date                  SCH_VER = '1       '           / OCS-Scheduler software version and date        MAT_VER = '7.7.0.471'          / Matlab version                                 HDR_VER = '1       '           / Header version                                 TRIGGER = 'N/A     '           / trigger ID for TOO, e.g. VOEVENT-Nr            TCSMODE = 'Star    '           / TCS fundamental mode                           TCSSMODE= 'Active  '           / TCS fundamental submode                        TCSFMODE= 'Pos     '           / TCS focus mode                                 TCSFSMOD= 'On-Target'          / TCS focus submode                              TCSDMODE= 'Stop    '           / TCS dome mode                                  TCSDSMOD= 'N/A     '           / TCS dome submode                               TCSWMODE= 'Slave   '           / TCS windscreen mode                            TCSWSMOD= 'N/A     '           / TCS windscreen submode                         OBSLAT  =              33.3574 / [deg] Telescope geodetic latitude in WGS84     OBSLON  =             116.8599 / [deg] Telescope geodetic longitude in WGS84    OBSALT  =               1703.2 / [m] Telescope geodetic altitude in WGS84       DEFOCUS =                   0. / [mm] Focus position - nominal focus            FOCUSPOS=               1.3851 / [mm] Exposures focusPos                        DOMESTAT= 'open    '           / Dome status at begining of exposure            TRACKRA =                 23.7 / [arcsec/hr] Track speed RA rel to sidereal     TRACKDEC=                -11.2 / [arcsec/hr] Track speed Dec rel to sidereal    AZIMUTH =             113.8682 / [deg] Telescope Azimuth                        ALTITUDE=             36.81047 / [deg] Telescope altitude                       AIRMASS =             1.666232 / Telescope airmass                              TELRA   =              334.402 / [deg] Telescope ap equinox of date RA          TELDEC  =               3.4225 / [deg] Telescope ap equinox of date Dec         TELHA   =             312.7096 / [deg] Telescope ap equinox of date HA          DOMEAZ  =             112.8563 / [deg] Dome azimuth                             WINDSCAL=               10.466 / [deg] Wind screen altitude                     WINDDIR =                  2.2 / [deg] Azimuth of wind direction                WINDSPED=              14.6328 / Wind speed (km/hour)                           OUTTEMP =             20.94444 / [C] Outside temperature                        OUTRELHU=                 0.09 / [frac] Outside relative humidity               OUTDEWPT=            -12.94444 / [C] Outside dew point                                                                                                                    / INSTRUMENT TELEMETRY                                                                                                                                PANID   = '_p48s   '           / PAN identification                             DHSID   = '_p48s   '           / DHS identification                             ROISTATE= 'ROI     '           / ROI State (FULL | ROI)                         CCDSEC  = '[1:2048,1:4096]'    / CCD section                                    CCDSIZE = '[1:2048,1:4096]'    / CCD size                                       DATASEC = '[1:2048,1:4096]'    / Data section                                   DETSEC  = '[1:2048,1:4096]'    / Detector section                               ROISEC  = '[1:2048,1:4096]'    / ROI section                                    FPA     = 'P48MOSAIC'          / Focal plan array                               CCDNAME = 'W94C2   '           / Detector mfg serial number                     CHECKSUM= 'O3aBP1ZBO1aBO1YB'   / HDU checksum updated 2010-03-15T13:06:37       DATASUM = '395763289'          / Data unit checksum updated 2010-03-15T13:06:37 DHEINF  = 'SDSU, Gen-III'      / Controller info                                DHEFIRM = '/usr/src/dsp/tim_m.lod' / DSP software                               CAM_VER = '20090615.1.3.100000' / Camera server date.rev.cfitsio                LV_VER  = '8.5     '           / LabVIEW software version                       PCI_VER = '2.0c    '           / Astropci software version                      DETID   = 'PTF/MOSAIC'         / Detector ID                                    AUTHOR  = 'PTF/OCS/TCS/Camera' / Source for header information                  DATAMIN =                   0. / Minimum value for array                        ROISTATE= 'ROI     '           / ROI State (FULL | ROI)                         LEDBLUE = 'OFF     '           / 470nm LED state (ON | OFF)                     LEDRED  = 'OFF     '           / 660nm LED state (ON | OFF)                     LEDNIR  = 'OFF     '           / 880nm LED state (ON | OFF)                     CCD9TEMP=              175.003 / [K] 0x0 servo temp sensor on CCD09             HSTEMP  =              148.207 / [K] 0x1 heat spreader temp                     DHE0TEMP=              295.951 / [K] 0x2 detector head electronics temp, master DHE1TEMP=              298.162 / [K] 0x3 detector head electronics temp, slave  DEWWTEMP=               284.71 / [K] 0x4 dewar wall temp                        HEADTEMP=              138.414 / [K] 0x5 cryo cooler cold head temp             CCD5TEMP=               174.91 / [K] 0x6 temp sensor on CCD05                   CCD11TEM=              176.061 / [K] 0x7 temp sensor on CCD11                   CCD0TEMP=              169.515 / [K] 0x8 temp sensor on CCD00                   RSTEMP  =               232.61 / [K] 0x9 temp sensor on radiation shield        DEWPRESS=                 0.82 / [milli-torr] Dewar pressure                    DETHEAT =                  38. / [%] Detector focal plane heater power          NAMPSXY = '6 2     '           / Number of amplifiers in x y                    CCDSUM  = '1 1     '           / [pix] Binning in x and y                       MODELFOC= 'N/A     '           / MODELFOC                                       CHECKSUM= '6aLZ8ZKZ6aKZ6YKZ'   / HDU checksum updated 2010-03-15T13:06:37       DATASUM = '         0'         / Data unit checksum (2010-03-15T13:06:37)       GAIN    =                  1.7 / [e-/D.N.] Gain of detector.                    READNOI =                  5.1 / [e-] Read noise of detector.                   DARKCUR =                  0.1 / [e-/s] Dark current of detector                                                                                                          / SCAMP DISTORTION KEYWORDS                                                                                                                           RADECSYS= 'ICRS    '           / Astrometric system                             PV1_0   =                   0. / Projection distortion parameter                PV1_1   =                   1. / Projection distortion parameter                PV1_2   =                   0. / Projection distortion parameter                PV1_4   = 0.000811808026654439 / Projection distortion parameter                PV1_5   = 0.000610424561546246 / Projection distortion parameter                PV1_6   = 0.000247550637436069 / Projection distortion parameter                PV1_7   = 0.000103962986153903 / Projection distortion parameter                PV1_8   = -0.000463678684598807 / Projection distortion parameter               PV1_9   = -0.000431244263972048 / Projection distortion parameter               PV1_10  = -0.000152691163850316 / Projection distortion parameter               PV1_12  = -0.00204628855915067 / Projection distortion parameter                PV1_13  = -0.00173071932398225 / Projection distortion parameter                PV1_14  = 0.000212015319199711 / Projection distortion parameter                PV1_15  = -0.000489268678679085 / Projection distortion parameter               PV1_16  = -0.000182891514774611 / Projection distortion parameter               PV2_0   =                   0. / Projection distortion parameter                PV2_1   =                   1. / Projection distortion parameter                PV2_2   =                   0. / Projection distortion parameter                PV2_4   = 0.000273521447624334 / Projection distortion parameter                PV2_5   = 0.000876139200581004 / Projection distortion parameter                PV2_6   = -0.000122736852992318 / Projection distortion parameter               PV2_7   = -0.00115870481394187 / Projection distortion parameter                PV2_8   = 0.000744209714565589 / Projection distortion parameter                PV2_9   = -0.00031431316953523 / Projection distortion parameter                PV2_10  = -0.00025720525696749 / Projection distortion parameter                PV2_12  = -0.00074859772103692 / Projection distortion parameter                PV2_13  = 0.000838107200656415 / Projection distortion parameter                PV2_14  = -0.00012633881376049 / Projection distortion parameter                PV2_15  =  -0.0020312867769692 / Projection distortion parameter                PV2_16  =  0.00524608854745148 / Projection distortion parameter                FGROUPNO=                    1 / SCAMP field group label                        ASTIRMS1=                   0. / Astrom. dispersion RMS (intern., high S/N)     ASTIRMS2=                   0. / Astrom. dispersion RMS (intern., high S/N)     ASTRRMS1=         3.620458E-05 / Astrom. dispersion RMS (ref., high S/N)        ASTRRMS2=         3.332156E-05 / Astrom. dispersion RMS (ref., high S/N)        ASTINST =                    1 / SCAMP astrometric instrument label             FLXSCALE=                   0. / SCAMP relative flux scale                      MAGZEROP=                   0. / SCAMP zero-point                               PHOTIRMS=                   0. / mag dispersion RMS (internal, high S/N)        RA_RMS  =            0.1655724 / [arcsec] RMS of SCAMP fit from 2MASS matching  DEC_RMS =            0.1891921 / [arcsec] RMS of SCAMP fit from 2MASS matching  ASTROMN =                  384 / Number of stars in SCAMP astrometric solution  SCAMPPTH= '/ptf/pos/archive/fallbackcal/scamp/7/' / SCAMP catalog path          SCAMPFIL= 'PTF_201006174759_c_e_uca3_t112521_u001916251_f02_p002899_c07.fits'                                                                                             / SIP DISTORTION KEYWORDS                                                                                                                             A_ORDER =                    4 / Distortion order for A                         A_0_2   = 6.96807813586153E-08 / Projection distortion parameter                A_0_3   = 1.20881759870351E-11 / Projection distortion parameter                A_0_4   = -4.07297345125509E-15 / Projection distortion parameter               A_1_1   = -1.71602989085006E-07 / Projection distortion parameter               A_1_2   = -3.40958003336147E-11 / Projection distortion parameter               A_1_3   = 1.08769435952671E-14 / Projection distortion parameter                A_2_0   = 2.28067760155696E-07 / Projection distortion parameter                A_2_1   =  3.6610309234789E-11 / Projection distortion parameter                A_2_2   = 4.73755078335384E-15 / Projection distortion parameter                A_3_0   = 8.24210855193549E-12 / Projection distortion parameter                A_3_1   = 3.84753767306115E-14 / Projection distortion parameter                A_4_0   = -4.54223812412034E-14 / Projection distortion parameter               A_DMAX  =     1.53122472683886 / Projection distortion parameter                B_ORDER =                    4 / Distortion order for B                         B_0_2   = -7.69933957449607E-08 / Projection distortion parameter               B_0_3   = -9.16855566272424E-11 / Projection distortion parameter               B_0_4   = 1.66630509620112E-14 / Projection distortion parameter                B_1_1   = 2.46289708854316E-07 / Projection distortion parameter                B_1_2   = -5.90207917198792E-11 / Projection distortion parameter               B_1_3   = 1.86811615261732E-14 / Projection distortion parameter                B_2_0   = 3.44908367419592E-08 / Projection distortion parameter                B_2_1   = -2.49509936365959E-11 / Projection distortion parameter               B_2_2   = 2.84841315780067E-15 / Projection distortion parameter                B_3_0   = 2.02845080441181E-11 / Projection distortion parameter                B_3_1   = -4.51317603382652E-14 / Projection distortion parameter               B_4_0   = -1.16438849571175E-13 / Projection distortion parameter               B_DMAX  =     2.89468553502114 / Projection distortion parameter                AP_ORDER=                    4 / Distortion order for AP                        AP_0_1  = -2.3927681685928E-08 / Projection distortion parameter                AP_0_2  = -6.97379868441328E-08 / Projection distortion parameter               AP_0_3  = -1.21069584606865E-11 / Projection distortion parameter               AP_0_4  = 4.07524721573973E-15 / Projection distortion parameter                AP_1_0  = 5.65239128994064E-08 / Projection distortion parameter                AP_1_1  = 1.71734217296344E-07 / Projection distortion parameter                AP_1_2  = 3.41724875038451E-11 / Projection distortion parameter                AP_1_3  = -1.08775499102067E-14 / Projection distortion parameter               AP_2_0  = -2.28068482487158E-07 / Projection distortion parameter               AP_2_1  = -3.66548961802381E-11 / Projection distortion parameter               AP_2_2  = -4.75858241735224E-15 / Projection distortion parameter               AP_3_0  = -8.24781966878619E-12 / Projection distortion parameter               AP_3_1  = -3.85281201904104E-14 / Projection distortion parameter               AP_4_0  = 4.54275049666924E-14 / Projection distortion parameter                BP_ORDER=                    4 / Distortion order for BP                        BP_0_1  = -1.50638746640517E-07 / Projection distortion parameter               BP_0_2  = 7.70565767927487E-08 / Projection distortion parameter                BP_0_3  = 9.18374546897802E-11 / Projection distortion parameter                BP_0_4  = -1.66839467627906E-14 / Projection distortion parameter               BP_1_0  = -4.87195269294628E-08 / Projection distortion parameter               BP_1_1  = -2.46371690411844E-07 / Projection distortion parameter               BP_1_2  =  5.9111535979953E-11 / Projection distortion parameter                BP_1_3  = -1.87729776729012E-14 / Projection distortion parameter               BP_2_0  = -3.46046151217313E-08 / Projection distortion parameter               BP_2_1  = 2.51320825919019E-11 / Projection distortion parameter                BP_2_2  = -2.85758325791527E-15 / Projection distortion parameter               BP_3_0  = -2.04221364218494E-11 / Projection distortion parameter               BP_3_1  = 4.51336286236569E-14 / Projection distortion parameter                BP_4_0  = 1.16567578965612E-13 / Projection distortion parameter                                                                                                          / DATA FLOW                                                                                                                                           ORIGNAME= '/data/PTF_default_38068.fits' / Filename as written by the camera    FILENAME= 'PTF200906253621_2_o_38068.fits' / Filename of delivered camera image PROCORIG= 'IPAC-PTF pipelines' / Processing origin                              PROCDATE= 'Tue Feb 21 03:34:46 2012' / Processing date/time (Pacific time)      PTFVERSN=                   5. / Version of PTFSCIENCEPIPELINE program          PMASKPTH= '/ptf/pos/archive/fallbackcal/pmasks/' / Pathname of pixel mask       PMASKFIL= 'bpm_2009060s_c07.v2.fits' / Filename of pixel mask                   SFLATPTH= '/ptf/pos/sbx1/2009/06/25/f2/c7/cal/p4/cId45986/' / Pathname of super SFLATFIL= 'PTF_200906250000_i_s_flat_t120000_u000045986_f02_p000000_c07.fits'   SBIASPTH= '/ptf/pos/sbx1/2009/06/25/f2/c7/cal/p1/cId45922/' / Pathname of super SBIASFIL= 'PTF_200906250000_i_s_bias_t120000_u000045922_f00_p000000_c07.fits'   DBNID   =                  121 / Database night ID                              DBEXPID =                22920 / Database exposure ID                           DBRID   =              3663141 / Database raw-image ID                          DBPID   =             12052003 / Database processed-image ID                    DBFID   =                    2 / Database filter ID                             DBPIID  =                    1 / Database P.I. ID                               DBPRID  =                    3 / Database project ID                            DBFIELD =                22920 / Database field ID                              DBSVID  =                   50 / Database software-version ID                   DBCVID  =                   56 / Database config-data-file ID                   END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"id":7635,"name":"invalid_header.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"SIMPLE  =                    T / file does conform to FITS standard             BITPIX  =                  -32 / number of bits per data pixel                  NAXIS   =                    2 / number of data axes                            NAXIS1  =                 2048 / length of data axis 1                          NAXIS2  =                 4096 / length of data axis 2                          COMMENT   FITS (Flexible Image Transport System) format is defined in 'AstronomyCOMMENT   and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H PANID   = '_p48m   '           / PAN identification                             DHSID   = '_p48m   '           / DHS identification                             ROISTATE= 'FULL    '           / ROI State (FULL | ROI)                         EXPTIME =                  60. / requested exposure time (sec)                  AEXPTIME=                  60. / actual exposure time (sec)                     UTC-OBS = '2012-03-05T04:39:20.696' / UTC time shutter open YYYY-MM-DDTHH:MM:SS.PIXSCALE=                 1.01 / pixel scale (\"/pix)                            CRTYPE1 = 'deg     '                                                            CRTYPE2 = 'deg     '                                                            COMMENT Original key: \"CRVAL1\"                                                  _RVAL1  =     61.8573769316265                                                  COMMENT Original key: \"CRVAL2\"                                                  _RVAL2  =    4.554355555555555                                                  COMMENT Original key: \"CRPIX1\"                                                  _RPIX1  =                    0                                                  COMMENT Original key: \"CRPIX2\"                                                  _RPIX2  =                    0                                                  COMMENT Original key: \"CDELT1\"                                                  _DELT1  = 0.0002805555555555555                                                 COMMENT Original key: \"CDELT2\"                                                  _DELT2  = -0.0002805555555555555                                                COMMENT Original key: \"CROTA2\"                                                  _ROTA2  =                  0.0                                                  RA      = '04:13:42.857'       / Rquested field RA (J2000.0) HH:MM:SS.SSSS      DEC     = '+03:22:30.00'       / Rquested field DEC (J2000.0) sDD:MM:SS.SSSS    COMMENT Original key: \"CTYPE1\"                                                  _TYPE1  = 'RA---TAN'           / type of coordinates in axis=1                  COMMENT Original key: \"CTYPE2\"                                                  _TYPE2  = 'DEC--TAN'           / type of coordinates in axis=2                  AMPSEC  = '[1:2048,1:4096]'    / amplifier section                              CCDSEC  = '[1:2048,1:4096]'    / ccd section                                    CCDSIZE = '[1:2048,1:4096]'    / ccd size                                       TRIMSEC = '[15:2062,1:4096]'   / trim section                                   DATASEC = '[15:2062,1:4096]'   / data section                                   BIASSEC = '[2063:2078,1:4096]' / bias section                                   DETSEC  = '[1:2048,1:4096]'    / detector section                               ROISEC  = '[1:2048,1:4096]'    / roi section                                    FPA     = 'P48MOSAIC'          / focal plan array                               CCDID   = '0       '           / CCD number (0..11)                             CCDNAME = 'W21C2   '           / detector mfg serial number                     GAIN    = '1.5     '           / Gain e-/adu                                    READNOI = '4.2     '           / Read noise e-                                  DARKCUR = '< 0.1   '           / Dark current e-/s @ 150 K                      CHECKSUM= '3S4aAP2a5P2aAP2a'   / HDU checksum updated 2012-03-05T04:40:54       DATASUM = '1654834290'         / data unit checksum updated 2012-03-05T04:40:54 BSCALE  =                    1 / default scaling factor                         DHEINF  = 'SDSU, Gen-III'      / controller info                                DHEFIRM = '/usr/src/dsp/20090618/tim_m.lod' / DSP software                      CAM_VER = '20090615.1.3.100000' / camera server date.rev.cfitsio                LV_VER  = '8.5     '           / LabVIEW software version                       PCI_VER = '2.0c    '           / astropci software version                      ORIGIN  = 'Palomar Transient Factory' / origin of the data                      TELESCOP= 'P48     '           / name of telescope                              INSTRUME= 'PTF/MOSAIC'         / instrument name                                DETID   = 'PTF/MOSAIC'         / detector ID                                    AUTHOR  = 'PTF/OCS/TCS/Camera' / source for header information                  OBSLAT  =              33.3574 / telescope geodetic latitude (dec deg) in WGS84 OBSLON  =            -116.8599 / telescope geodetic longitude (dec deg) in WGS84OBSALT  =               1703.2 / telescope geodetic altitude (meters) in WGS84  DATAMIN =                   0. / minimum value for array                        DATAMAX =               65535. / maximum value for array                        OBSTYPE = 'object  '           / image type (dark,science,bias,focus)           IMGTYP  = 'object  '           / image type (dark,science,bias,focus)           ROISTATE= 'FULL    '           / ROI State (FULL | ROI)                         FILTER  = 'R       '           / Filter name                                    FILTERID= '2       '           / Filter ID                                      FILTERSL= '1       '           / Filter changer slot position                   LEDBLUE = 'OFF     '           / 470nm LED state (ON | OFF)                     LEDRED  = 'OFF     '           / 660nm LED state (ON | OFF)                     LEDNIR  = 'OFF     '           / 880nm LED state (ON | OFF)                     CCD9TEMP=                 175. / 0x0 servo temp sensor on CCD09 (K)             HSTEMP  =              147.919 / 0x1 heat spreader temp (K)                     DHE0TEMP=              290.409 / 0x2 detector head electronics temp, master (K) DHE1TEMP=              292.513 / 0x3 detector head electronics temp, slave (K)  DEWWTEMP=              276.405 / 0x4 dewar wall temp (K)                        HEADTEMP=              137.562 / 0x5 cryo cooler cold head temp (K)             CCD5TEMP=              175.129 / 0x6 temp sensor on CCD05 (K)                   CCD11TEM=              176.167 / 0x7 temp sensor on CCD11 (K)                   CCD0TEMP=              169.115 / 0x8 temp sensor on CCD00 (K)                   RSTEMP  =               230.99 / 0x9 temp sensor on radiation shield (K)        DEWPRESS=                  3.5 / dewar pressure (milli-torr)                    DETHEAT =                 37.4 / detector focal plane heater power (%)          DATE    = '2012-03-05'         / UTC date when file was written YYYY-MM-DD      EXPTIME =                  60. / requested exposure time (sec)                  AEXPTIME=                  60. / actual exposure time (sec)                     NAMPSXY = '6 2     '           / number of amplifiers in x y                    CCDSUM  = '1 1     '           / binning in x and y (pix pix)                   PIXSCALE=                 1.01 / pixel scale (\"/pix)                            ORIGNAME= '/data/PTF_default_62108.fits' / filename as written by the camera    REFERENC= 'http://www.astro.caltech.edu/ptf' / reference - PTF website          PTFPRPI = 'Kulkarni'           / PTF Project PI                                 OPERMODE= 'OCS     '           / Mode of operation: OCS | Manual | N/A          OBJECT  = 'PTF_survey'         / Fields object                                  PTFFIELD= '2820    '           / PTF unique field ID                            SOFTVER = '1.1.1.1 '           / Softwere version (TCS.Camera.OCS.Sched)        OCS_VER = '1       '           / OCS software version and date                  TCS_VER = '1       '           / TCS software version and date                  SCH_VER = '1       '           / OCS-Scheduler software version and date        MAT_VER = '7.7.0.471'          / Matlab version                                 HDR_VER = '1       '           / Header version                                 TRIGGER = 'N/A     '           / trigger ID for TOO, e.g. VOEVENT-Nr            MOONRA  =           124.394847 / Moon J2000.0 R.A. (deg)                        MOONDEC =            15.249532 / Moon J2000.0 Dec. (deg)                        MOONILLF=              0.87268 / Moon illuminated fraction (frac)               MOONPHAS=            41.809906 / Moon phase angle (deg)                         MOONESB =             -2.77365 / Moon excess in sky brightness V-band           MOONALT =            70.469083 / Moon altitude (deg)                            SUNAZ   =           289.304104 / Sun azimuth (deg)                              SUNALT  =           -36.291647 / Sun altitude (deg)                             COMMENT Original key: \"EQUINOX\"                                                 _QUINOX =                2000. / Equinox (Julian years)                         OBJRA   = '04:13:42.857'       / Rquested field J2000.0 Ra.                     OBJDEC  = '+03:22:30.00'       / Rquested field J2000.0 Dec.                    OBJRAD  =            63.428571 / Rquested field RA (J2000.0)  (deg)             OBJDECD =                3.375 / Rquested field Dec (J2000.0) (deg)             AZIMUTH =           250.486706 / Telescope Azimuth (deg)                        ALTITUDE=            32.381913 / Telescope altitude (deg)                       AIRMASS =             1.862939 / Telescope airmass                              OCS_TIME= '2012-03-05T04:39:20.600' / UTC Date for OCS calc time-dep params     OBSERVER= 'KulkarniPTF'        / Observer name and project                      PTFPID  = '20000   '           / Project type: 00000-49999                      PTFFLAG = '1       '           / 1 = PTF ; 0 = non-PTF category                 DEFOCUS =                   0. / Focus position - nominal focus (mm)            FOCUSPOS=               1.3405 / Exposures focusPos (mm)                        DOMESTAT= 'open    '           / Dome status at begining of exposure            TRACKRA =                 29.7 / Track speed RA rel to sidereal \"/hr            TRACKDEC=                 15.2 / Track speed Dec rel to sidereal \"/hr           TELRA   =            63.584159 / Telescope ap equinox of date RA (deg)          TELDEC  =               3.4052 / Telescope ap equinox of date Dec(deg)          TELHA   =              52.7247 / Telescope ap equinox of date HA(deg)           DOMEAZ  =             251.5333 / Dome azimuth (deg)                             WINDSCAL=               9.5761 / Wind screen altitude (deg)                     TCSMODE = 'Star    '           / TCS fundamental mode                           TCSSMODE= 'Active  '           / TCS fundamental submode                        TCSFMODE= 'Pos     '           / TCS focus mode                                 TCSFSMOD= 'On-Target'          / TCS focus submode                              TCSDMODE= 'Stop    '           / TCS dome mode                                  TCSDSMOD= 'N/A     '           / TCS dome submode                               TCSWMODE= 'Slave   '           / TCS windscreen mode                            TCSWSMOD= 'N/A     '           / TCS windscreen submode                         WINDDIR =                  2.2 / Azimuth of wind direction (deg)                WINDSPED=                5.628 / Wind speed (km/hour)                           OUTTEMP =            15.555556 / Outside temperature (C)                        OUTRELHU=                0.273 / Outside relative humidity (frac)               OUTDEWPT=            -3.222222 / Outside dew point (C)                          SEEING  =                  2.3 / seeing FWHM (pix)                              PEAKDIST=   0.3846153923077622 / Mean dist brightest pixel-centeroid pixel (pix)ELLIP   =                0.277 / Mean image ellipticity A/B                     ELLIPPA =                51.34 / Mean image ellipticity PA (deg)                MODELFOC= 'N/A     '           / MODELFOC                                       FILENAME= 'PTF201203051940_2_o_62108.fits' / Image File name as wriited by ptf-dDATE-OBS= '2012-03-05T04:39:20.696' / UTC shutter time YYYY-MM-DDTHH:MM:SS.SSS  OBSJD   =        2455991.69398 / Julian day corresponds to UTC-OBS (day)        OBSMJD  =          55991.19398 / MJD corresponds to UTC-OBS (day)               OBSLST  = '7:45:14.56'         / Mean LST corresponds to UTC-OBS 'HH:MM:SS.S'   HOURANG = '3:30:54.36'         / Mean HA (sHH:MM:SS.S) based on LMST at UTC-OBS HJD     =        2455991.69276 / Heliocentric Julian Day (days)                 UTC-OBS = '2012-03-05T04:39:20.696' / UTC time shutter open YYYY-MM-DDTHH:MM:SS.CHECKSUM= 'Y6baa6ZUZ6aZa6YZ'   / HDU checksum updated 2012-03-05T04:40:54       DATASUM = '         0'         / data unit checksum updated 2012-03-05T04:40:54 MEDOVER =                  810 / Median overscan subtraction in cts             MEDSKY  =            10091.425 / Median sky in cts                              SKYSIG  =            69.755859 / Median skysig in cts                           COMMENT Original key: \"END\"                                                     COMMENT                                                                         COMMENT --Start of Astrometry.net WCS solution--                                COMMENT                                                                         OCTYPE1 = 'RA---TAN-SIP' / TAN (gnomic) projection + SIP distortions            OCTYPE2 = 'DEC--TAN-SIP' / TAN (gnomic) projection + SIP distortions            OWCSAXES=                    2 / no comment                                     OEQUINOX=               2000.0 / Equatorial coordinates definition (yr)         OLONPOLE=                180.0 / no comment                                     OLATPOLE=                  0.0 / no comment                                     OCRVAL1 =        61.8877560481 / RA  of reference point                         OCRVAL2 =        4.38091087278 / DEC of reference point                         OCRPIX1 =        789.496032715 / X reference pixel                              OCRPIX2 =        397.558751106 / Y reference pixel                              OCUNIT1 = 'deg     ' / X pixel scale units                                      OCUNIT2 = 'deg     ' / Y pixel scale units                                      OCD1_1  =    0.000280414050836 / Transformation matrix                          OCD1_2  =    1.69743814134E-06 / no comment                                     OCD2_1  =    2.56032122491E-06 / no comment                                     OCD2_2  =   -0.000280673285207 / no comment                                     OIMAGEW =                 2048 / Image width,  in pixels.                       OIMAGEH =                 4096 / Image height, in pixels.                       OA_ORDER=                    2 / Polynomial order, axis 1                       OA_0_2  =    1.73489369986E-07 / no comment                                     OA_1_1  =    1.58657555974E-07 / no comment                                     OA_2_0  =    6.71067642128E-07 / no comment                                     OB_ORDER=                    2 / Polynomial order, axis 2                       OB_0_2  =    2.45361183805E-07 / no comment                                     OB_1_1  =    4.36889035802E-07 / no comment                                     OB_2_0  =    5.22991769535E-08 / no comment                                     OAP_ORDE=                    2 / Inv polynomial order, axis 1                   OAP_0_1 =   -9.79930635325E-07 / no comment                                     OAP_0_2 =   -1.72800310908E-07 / no comment                                     OAP_1_0 =    -4.2478779666E-07 / no comment                                     OAP_1_1 =    -1.5696285653E-07 / no comment                                     OAP_2_0 =   -6.69877894679E-07 / no comment                                     OBP_ORDE=                    2 / Inv polynomial order, axis 2                   OBP_0_1 =   -1.33340266283E-06 / no comment                                     OBP_0_2 =   -2.44275619788E-07 / no comment                                     OBP_1_0 =   -8.75289177595E-07 / no comment                                     OBP_1_1 =   -4.35275784504E-07 / no comment                                     OBP_2_0 =   -5.14575668137E-08 / no comment                                     HISTORY Created by the Astrometry.net suite.                                    HISTORY For more details, see http://astrometry.net .                           HISTORY Subversion URL                                                          HISTORY   svn+ssh://astrometry.net/svn/tags/tarball-0.25/astrometry/            HISTORY   util/                                                                 HISTORY Subversion revision 10193                                               HISTORY Subversion date 2008-12-09 17:58:39 -0500 (Tue, 09 Dec                  HISTORY   2008)                                                                 HISTORY This WCS header was created by the program \"blind\".                     DATE    = '2012-03-04T20:56:39' / Date this file was created.                   COMMENT -- blind solver parameters: --                                          COMMENT Index(0):                                                               COMMENT   /project/projectdirs/boss/usr/local/data/index-205.quad.fi            COMMENT   ts                                                                    COMMENT Index(1):                                                               COMMENT   /project/projectdirs/boss/usr/local/data/index-204-00.quad            COMMENT   .fits                                                                 COMMENT Index(2):                                                               COMMENT   /project/projectdirs/boss/usr/local/data/index-204-05.quad            COMMENT   .fits                                                                 COMMENT Index(3):                                                               COMMENT   /project/projectdirs/boss/usr/local/data/index-204-08.quad            COMMENT   .fits                                                                 COMMENT Index(4):                                                               COMMENT   /project/projectdirs/boss/usr/local/data/index-203-00.quad            COMMENT   .fits                                                                 COMMENT Index(5):                                                               COMMENT   /project/projectdirs/boss/usr/local/data/index-203-05.quad            COMMENT   .fits                                                                 COMMENT Index(6):                                                               COMMENT   /project/projectdirs/boss/usr/local/data/index-203-08.quad            COMMENT   .fits                                                                 COMMENT Index(7):                                                               COMMENT   /project/projectdirs/boss/usr/local/data/index-202-00.quad            COMMENT   .fits                                                                 COMMENT Index(8):                                                               COMMENT   /project/projectdirs/boss/usr/local/data/index-202-05.quad            COMMENT   .fits                                                                 COMMENT Index(9):                                                               COMMENT   /project/projectdirs/boss/usr/local/data/index-202-08.quad            COMMENT   .fits                                                                 COMMENT Field name: PTF201203051940_2_o_62108_00.axy                            COMMENT Field scale lower: 0.98 arcsec/pixel                                    COMMENT Field scale upper: 1.03 arcsec/pixel                                    COMMENT X col name: X_IMAGE                                                     COMMENT Y col name: Y_IMAGE                                                     COMMENT Start obj: 0                                                            COMMENT End obj: 0                                                              COMMENT Solved_in: (null)                                                       COMMENT Solved_out: (null)                                                      COMMENT Solvedserver: (null)                                                    COMMENT Parity: 2                                                               COMMENT Codetol: 0.01                                                           COMMENT Verify pixels: 1 pix                                                    COMMENT Maxquads: 0                                                             COMMENT Maxmatches: 0                                                           COMMENT Cpu limit: 30.000000 s                                                  COMMENT Time limit: 0 s                                                         COMMENT Total time limit: 0 s                                                   COMMENT Total CPU limit: 0.000000 s                                             COMMENT Tweak: yes                                                              COMMENT Tweak AB order: 2                                                       COMMENT Tweak ABP order: 2                                                      COMMENT --                                                                      COMMENT -- properties of the matching quad: --                                  COMMENT index id: 205                                                           COMMENT index healpix: -1                                                       COMMENT index hpnside: 1                                                        COMMENT log odds: 570.945                                                       COMMENT odds: 9.08044e+247                                                      COMMENT quadno: 13818269                                                        COMMENT stars: 9968100,9968090,9968098,9968093                                  COMMENT field: 3,0,4,2                                                          COMMENT code error: 0.00127394                                                  COMMENT noverlap: 172                                                           COMMENT nconflict: 0                                                            COMMENT nfield: 172                                                             COMMENT nindex: 176                                                             COMMENT scale: 1.00895 arcsec/pix                                               COMMENT parity: 0                                                               COMMENT quads tried: 1                                                          COMMENT quads matched: 2                                                        COMMENT quads verified: 1                                                       COMMENT objs tried: 5                                                           COMMENT cpu time: 0.003999                                                      COMMENT --                                                                      COMMENT                                                                         COMMENT --End of Astrometry.net WCS--                                           COMMENT                                                                         UB1_ZP  =                 27.5                                                  LMT_MG  =               19.192                                                  ASTSOL  = 'scamp   '                                                            HISTORY    Astrometric solution by SCAMP version 1.7.0 (2010-08-05)             COMMENT    (c) Emmanuel BERTIN <bertin@iap.fr>                                  COMMENT                                                                         EQUINOX =            2000.0000 / Mean equinox                                   RADECSYS= 'ICRS    '           / Astrometric system                             CTYPE1  = 'RA---TAN'           / WCS projection type for this axis              CTYPE2  = 'DEC--TAN'           / WCS projection type for this axis              CUNIT1  = 'deg     '           / Axis unit                                      CUNIT2  = 'deg     '           / Axis unit                                      CRVAL1  =      6.188763218E+01 / World coordinate on this axis                  CRVAL2  =      4.380823580E+00 / World coordinate on this axis                  CRPIX1  =      7.894960327E+02 / Reference pixel on this axis                   CRPIX2  =      3.975587511E+02 / Reference pixel on this axis                   CD1_1   =      2.804743351E-04 / Linear projection matrix                       CD1_2   =      1.807931352E-06 / Linear projection matrix                       CD2_1   =      2.367504576E-06 / Linear projection matrix                       CD2_2   =     -2.808315811E-04 / Linear projection matrix                       PV1_0   =      1.456397190E-04 / Projection distortion parameter                PV1_1   =      9.998189362E-01 / Projection distortion parameter                PV1_2   =      3.901789582E-04 / Projection distortion parameter                PV1_4   =      2.684396013E-03 / Projection distortion parameter                PV1_5   =     -7.179465569E-04 / Projection distortion parameter                PV1_6   =      5.132011264E-04 / Projection distortion parameter                PV1_7   =     -1.672242131E-03 / Projection distortion parameter                PV1_8   =      5.565322076E-04 / Projection distortion parameter                PV1_9   =     -8.240132461E-04 / Projection distortion parameter                PV1_10  =     -3.698351238E-05 / Projection distortion parameter                PV1_12  =      3.777486931E-03 / Projection distortion parameter                PV1_13  =     -1.658254611E-03 / Projection distortion parameter                PV1_14  =      2.989635088E-04 / Projection distortion parameter                PV1_15  =     -4.907197064E-04 / Projection distortion parameter                PV1_16  =      2.889486855E-05 / Projection distortion parameter                PV2_0   =      1.104553949E-04 / Projection distortion parameter                PV2_1   =      1.000001456E+00 / Projection distortion parameter                PV2_2   =      5.771870225E-04 / Projection distortion parameter                PV2_4   =      2.836854693E-04 / Projection distortion parameter                PV2_5   =     -1.340251514E-04 / Projection distortion parameter                PV2_6   =     -7.102989931E-04 / Projection distortion parameter                PV2_7   =      1.022790097E-03 / Projection distortion parameter                PV2_8   =      2.436846754E-04 / Projection distortion parameter                PV2_9   =      9.322698310E-04 / Projection distortion parameter                PV2_10  =     -7.413484043E-03 / Projection distortion parameter                PV2_12  =      5.280834355E-04 / Projection distortion parameter                PV2_13  =      4.532076725E-04 / Projection distortion parameter                PV2_14  =     -1.305400687E-04 / Projection distortion parameter                PV2_15  =      6.693583421E-03 / Projection distortion parameter                PV2_16  =      2.823700675E-02 / Projection distortion parameter                FGROUPNO=                    1 / SCAMP field group label                        ASTIRMS1=      0.000000000E+00 / Astrom. dispersion RMS (intern., high S/N)     ASTIRMS2=      0.000000000E+00 / Astrom. dispersion RMS (intern., high S/N)     ASTRRMS1=      8.822499895E-06 / Astrom. dispersion RMS (ref., high S/N)        ASTRRMS2=      2.438161774E-05 / Astrom. dispersion RMS (ref., high S/N)        ASTINST =                    1 / SCAMP astrometric instrument label             FLXSCALE=      1.666666667E-01 / SCAMP relative flux scale                      MAGZEROP=              30.0000 / SCAMP zero-point                               PHOTIRMS=               0.0000 / mag dispersion RMS (internal, high S/N)        PHOTINST=                    1 / SCAMP photometric instrument label             PHOTLINK= '                    F' / True if linked to a photometric field       END\n"},{"id":7636,"name":"locale.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"WCSAXES =                    2 / Number of coordinate axes                      CRPIX1  =               1920.5 / Pixel coordinate of reference point            CRPIX2  =               1920.5 / Pixel coordinate of reference point            CDELT1  =   -0.000416666666667 / [deg] Coordinate increment at reference point  CDELT2  =    0.000416666666667 / [deg] Coordinate increment at reference point  CUNIT1  = 'deg'                / Units of coordinate increment and value        CUNIT2  = 'deg'                / Units of coordinate increment and value        CTYPE1  = 'RA---TAN'           / Right ascension, gnomonic projection           CTYPE2  = 'DEC--TAN'           / Declination, gnomonic projection               CRVAL1  =               36.661 / [deg] Coordinate value at reference point      CRVAL2  =                -4.48 / [deg] Coordinate value at reference point      LONPOLE =                  180 / [deg] Native longitude of celestial pole       LATPOLE =                -4.48 / [deg] Native latitude of celestial pole        RESTFRQ =                    0 / [Hz] Line rest frequency                       RESTWAV =                    0 / [Hz] Line rest wavelength                      EQUINOX =                 2000 / [yr] Equinox of equatorial coordinates         END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"id":7637,"name":"validate.5.13.txt","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"HDU 1:\n  WCS key ' ':\n    - RADECSYS= 'ICRS ' / Astrometric system\n      the RADECSYS keyword is deprecated, use RADESYSa.\n    - The WCS transformation has more axes (2) than the image it is\n      associated with (0)\n    - Removed redundant SCAMP distortion parameters because SIP\n      parameters are also present\n\nHDU 2:\n  WCS key ' ':\n    - The WCS transformation has more axes (3) than the image it is\n      associated with (0)\n    - 'celfix' made the change 'In CUNIT3 : Mismatched units type\n      'length': have 'Hz', want 'm''.\n    - 'unitfix' made the change 'Changed units: 'HZ' -> 'Hz''.\n"},{"id":7638,"name":"astropy/wcs/tests/data/maps","nodeType":"Package"},{"id":7639,"name":"1904-66_CEA.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---CEA'                                                            CRPIX1  =  -2.482173814412E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--CEA'                                                            CRPIX2  =   7.688571124876E+00                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =   0.000000000000E+00 / Native latitude  of celestial pole             PV2_1   =   1.000000000000E+00 / Projection parameter 1                         EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 01:48:41 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_CEA.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7640,"name":"1904-66_CYP.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---CYP'                                                            CRPIX1  =  -1.471055514007E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--CYP'                                                            CRPIX2  =   2.056099939277E+01                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =   0.000000000000E+00 / Native latitude  of celestial pole             PV2_1   =   1.000000000000E+00 / Projection parameter 1                         PV2_2   =   7.071067811870E-01 / Projection parameter 2                         EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 01:46:07 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_CYP.continuum.fits\".                    HISTORY Noise level of continuum map: 62 mJy (RMS)                              "},{"id":7641,"name":"1904-66_AZP.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---AZP'                                                            CRPIX1  =  -2.541100848779E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--AZP'                                                            CRPIX2  =  -1.134948542534E+01                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =  -9.000000000000E+01 / Native latitude  of celestial pole             PV2_1   =   2.000000000000E+00 / Projection parameter 1                         PV2_2   =   3.000000000000E+01 / Projection parameter 2                         EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 01:16:54 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_AZP.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7642,"name":"1904-66_SZP.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---SZP'                                                            CRPIX1  =  -2.478656972779E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--SZP'                                                            CRPIX2  =  -2.262051956373E+01                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =  -9.000000000000E+01 / Native latitude  of celestial pole             PV2_1   =   2.000000000000E+00 / Projection parameter 1                         PV2_2   =   1.800000000000E+02 / Projection parameter 2                         PV2_3   =   6.000000000000E+01 / Projection parameter 3                         EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 01:20:19 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_SZP.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7643,"name":"1904-66_SIN.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---SIN'                                                            CRPIX1  =  -2.371895431541E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--SIN'                                                            CRPIX2  =   7.688571124876E+00                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =  -9.000000000000E+01 / Native latitude  of celestial pole             PV2_1   =   0.000000000000E+00 / Projection parameter 1                         PV2_2   =   0.000000000000E+00 / Projection parameter 2                         EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 01:30:25 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_SIN.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7644,"name":"1904-66_HPX.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T / file does conform to FITS standard             BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2 / number of data axes                            NAXIS1  =                  192 / length of data axis 1                          NAXIS2  =                  192 / length of data axis 2                          EXTEND  =                    T / FITS dataset may contain extensions            COMMENT   FITS (Flexible Image Transport System) format is defined in 'AstronomyCOMMENT   and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H BUNIT   = 'Jy/beam '           / Pixel value is flux density                    CTYPE1  = 'RA---HPX'                                                            CRPIX1  =    -248.217381441188                                                  CDELT1  =  -0.0666666666666667                                                  CRVAL1  =                   0.                                                  CTYPE2  = 'DEC--HPX'                                                            CRPIX2  =    -8.21754831338666                                                  CDELT2  =   0.0666666666666667                                                  CRVAL2  =                 -90.                                                  LONPOLE =                 180. / Native longitude of celestial pole             LATPOLE =                   0. / Native latitude  of celestial pole             RADESYS = 'FK5     '           / Equatorial coordinate system                   EQUINOX =               2000.0 / Equinox of equatorial coordinates              BMAJ    =              0.24000 / Beam major axis in degrees                     BMIN    =              0.24000 / Beam minor axis in degrees                     BPA     =                  0.0 / Beam position angle in degrees                 HISTORY Single-dish continuum map                                               HISTORY Formed on Mon 2005/03/07 04:03:52 GMT by \"pksgridzilla\" which was       HISTORY compiled on Mar  6 2005 08:00:15 (local time) within                    HISTORY AIPS++ version 19.986.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY    Beam RSS cutoff: 0.0                                                 HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_HPX.continuum.fits\".                    HISTORY Noise level of continuum map: 57 mJy (RMS)                              "},{"id":7645,"name":"1904-66_AIR.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---AIR'                                                            CRPIX1  =  -2.347545010835E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--AIR'                                                            CRPIX2  =   8.339330824422E+00                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =  -9.000000000000E+01 / Native latitude  of celestial pole             PV2_1   =   4.500000000000E+01 / Projection parameter 1                         EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 01:43:31 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_AIR.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7646,"name":"1904-66_ZEA.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---ZEA'                                                            CRPIX1  =  -2.444880690361E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--ZEA'                                                            CRPIX2  =   5.738055949994E+00                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =  -9.000000000000E+01 / Native latitude  of celestial pole             EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 01:40:52 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_ZEA.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"className":"SimModelTAB","col":0,"comment":"null","endLoc":112,"id":7647,"nodeType":"Class","startLoc":10,"text":"class SimModelTAB:\n    def __init__(self, nx=150, ny=200, crpix=[1, 1], crval = [1, 1],\n                 cdelt = [1, 1], pc = {'PC1_1': 1, 'PC2_2': 1}):\n        \"\"\"  set essential parameters of the model (coord transformations)  \"\"\"\n        assert nx > 2 and ny > 1  # a limitation of this particular simulation\n        self.nx = nx\n        self.ny = ny\n        self.crpix = crpix\n        self.crval = crval\n        self.cdelt = cdelt\n        self.pc = pc\n\n    def fwd_eval(self, xy):\n        xb = 1 + self.nx // 3\n        px = np.array([1, xb, xb, self.nx + 1])\n        py = np.array([1, self.ny + 1])\n\n        xi = self.crval[0] + self.cdelt[0] * (px - self.crpix[0])\n        yi = self.crval[1] + self.cdelt[1] * (py - self.crpix[1])\n\n        cx = np.array([0.0, 0.26, 0.8, 1.0])\n        cy = np.array([-0.5, 0.5])\n\n        xy = np.atleast_2d(xy)\n        x = xy[:, 0]\n        y = xy[:, 1]\n\n        mbad = (x < px[0]) | (y < py[0]) | (x > px[-1]) | (y > py[-1])\n        mgood = np.logical_not(mbad)\n\n        i = 2 * (x > xb).astype(int)\n\n        psix = self.crval[0] + self.cdelt[0] * (x - self.crpix[0])\n        psiy = self.crval[1] + self.cdelt[1] * (y - self.crpix[1])\n\n        cfx = (psix - xi[i]) / (xi[i + 1] - xi[i])\n        cfy = (psiy - yi[0]) / (yi[1] - yi[0])\n\n        ra = cx[i] + cfx * (cx[i + 1] - cx[i])\n        dec = cy[0] + cfy * (cy[1] - cy[0])\n\n        return np.dstack([ra, dec])[0]\n\n    @property\n    def hdulist(self):\n        \"\"\" Simulates 2D data with a _spatial_ WCS that uses the ``-TAB``\n        algorithm with indexing.\n        \"\"\"\n        # coordinate array (some \"arbitrary\" numbers with a \"jump\" along x axis):\n        x = np.array([[0.0, 0.26, 0.8, 1.0], [0.0, 0.26, 0.8, 1.0]])\n        y = np.array([[-0.5, -0.5, -0.5, -0.5], [0.5, 0.5, 0.5, 0.5]])\n        c = np.dstack([x, y])\n\n        # index arrays (skip PC matrix for simplicity - assume it is an\n        # identity matrix):\n        xb = 1 + self.nx // 3\n        px = np.array([1, xb, xb, self.nx + 1])\n        py = np.array([1, self.ny + 1])\n        xi = self.crval[0] + self.cdelt[0] * (px - self.crpix[0])\n        yi = self.crval[1] + self.cdelt[1] * (py - self.crpix[1])\n\n        # structured array (data) for binary table HDU:\n        arr = np.array(\n            [(c, xi, yi)],\n            dtype=[\n                ('wavelength', np.float64, c.shape),\n                ('xi', np.double, (xi.size,)),\n                ('yi', np.double, (yi.size,))\n            ]\n        )\n\n        # create binary table HDU:\n        bt = fits.BinTableHDU(arr);\n        bt.header['EXTNAME'] = 'WCS-TABLE'\n\n        # create primary header:\n        image_data = np.ones((self.ny, self.nx), dtype=np.float32)\n        pu = fits.PrimaryHDU(image_data)\n        pu.header['ctype1'] = 'RA---TAB'\n        pu.header['ctype2'] = 'DEC--TAB'\n        pu.header['naxis1'] = self.nx\n        pu.header['naxis2'] = self.ny\n        pu.header['PS1_0'] = 'WCS-TABLE'\n        pu.header['PS2_0'] = 'WCS-TABLE'\n        pu.header['PS1_1'] = 'wavelength'\n        pu.header['PS2_1'] = 'wavelength'\n        pu.header['PV1_3'] = 1\n        pu.header['PV2_3'] = 2\n        pu.header['CUNIT1'] = 'deg'\n        pu.header['CUNIT2'] = 'deg'\n        pu.header['CDELT1'] = self.cdelt[0]\n        pu.header['CDELT2'] = self.cdelt[1]\n        pu.header['CRPIX1'] = self.crpix[0]\n        pu.header['CRPIX2'] = self.crpix[1]\n        pu.header['CRVAL1'] = self.crval[0]\n        pu.header['CRVAL2'] = self.crval[1]\n        pu.header['PS1_2'] = 'xi'\n        pu.header['PS2_2'] = 'yi'\n        for k, v in self.pc.items():\n            pu.header[k] = v\n\n        hdulist = fits.HDUList([pu, bt])\n        return hdulist"},{"id":7648,"name":"1904-66_BON.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---BON'                                                            CRPIX1  =  -2.431263982441E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--BON'                                                            CRPIX2  =  -3.307412668190E+01                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =   0.000000000000E+00 / Native latitude  of celestial pole             PV2_1   =   4.500000000000E+01 / Projection parameter 1                         EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 02:17:44 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_BON.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7649,"name":"1904-66_COP.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---COP'                                                            CRPIX1  =  -2.151923139086E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--COP'                                                            CRPIX2  =   1.505768272737E+01                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =  -4.500000000000E+01 / Native latitude  of celestial pole             PV2_1   =   4.500000000000E+01 / Projection parameter 1                         PV2_2   =   2.500000000000E+01 / Projection parameter 2                         EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 02:07:13 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_COP.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"col":4,"comment":"  set essential parameters of the model (coord transformations)  ","endLoc":20,"header":"def __init__(self, nx=150, ny=200, crpix=[1, 1], crval = [1, 1],\n                 cdelt = [1, 1], pc = {'PC1_1': 1, 'PC2_2': 1})","id":7650,"name":"__init__","nodeType":"Function","startLoc":11,"text":"def __init__(self, nx=150, ny=200, crpix=[1, 1], crval = [1, 1],\n                 cdelt = [1, 1], pc = {'PC1_1': 1, 'PC2_2': 1}):\n        \"\"\"  set essential parameters of the model (coord transformations)  \"\"\"\n        assert nx > 2 and ny > 1  # a limitation of this particular simulation\n        self.nx = nx\n        self.ny = ny\n        self.crpix = crpix\n        self.crval = crval\n        self.cdelt = cdelt\n        self.pc = pc"},{"col":0,"comment":"null","endLoc":20,"header":"@pytest.fixture(scope='module')\ndef tab_wcs_2di()","id":7651,"name":"tab_wcs_2di","nodeType":"Function","startLoc":10,"text":"@pytest.fixture(scope='module')\ndef tab_wcs_2di():\n    model = SimModelTAB(nx=150, ny=200)\n\n    # generate FITS HDU list:\n    hdulist = model.hdulist\n\n    # create WCS object:\n    w = wcs.WCS(hdulist[0].header, hdulist)\n\n    return w"},{"col":4,"comment":"null","endLoc":51,"header":"def fwd_eval(self, xy)","id":7652,"name":"fwd_eval","nodeType":"Function","startLoc":22,"text":"def fwd_eval(self, xy):\n        xb = 1 + self.nx // 3\n        px = np.array([1, xb, xb, self.nx + 1])\n        py = np.array([1, self.ny + 1])\n\n        xi = self.crval[0] + self.cdelt[0] * (px - self.crpix[0])\n        yi = self.crval[1] + self.cdelt[1] * (py - self.crpix[1])\n\n        cx = np.array([0.0, 0.26, 0.8, 1.0])\n        cy = np.array([-0.5, 0.5])\n\n        xy = np.atleast_2d(xy)\n        x = xy[:, 0]\n        y = xy[:, 1]\n\n        mbad = (x < px[0]) | (y < py[0]) | (x > px[-1]) | (y > py[-1])\n        mgood = np.logical_not(mbad)\n\n        i = 2 * (x > xb).astype(int)\n\n        psix = self.crval[0] + self.cdelt[0] * (x - self.crpix[0])\n        psiy = self.crval[1] + self.cdelt[1] * (y - self.crpix[1])\n\n        cfx = (psix - xi[i]) / (xi[i + 1] - xi[i])\n        cfy = (psiy - yi[0]) / (yi[1] - yi[0])\n\n        ra = cx[i] + cfx * (cx[i + 1] - cx[i])\n        dec = cy[0] + cfy * (cy[1] - cy[0])\n\n        return np.dstack([ra, dec])[0]"},{"col":4,"comment":"Combine two representation.\n\n        By default, operate on the cartesian representations of both.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.add`, `~operator.sub`, etc.\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The other representation.\n        reverse : bool\n            Whether the operands should be reversed (e.g., as we got here via\n            ``self.__rsub__`` because ``self`` is a subclass of ``other``).\n        ","endLoc":1103,"header":"def _combine_operation(self, op, other, reverse=False)","id":7653,"name":"_combine_operation","nodeType":"Function","startLoc":1082,"text":"def _combine_operation(self, op, other, reverse=False):\n        \"\"\"Combine two representation.\n\n        By default, operate on the cartesian representations of both.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.add`, `~operator.sub`, etc.\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The other representation.\n        reverse : bool\n            Whether the operands should be reversed (e.g., as we got here via\n            ``self.__rsub__`` because ``self`` is a subclass of ``other``).\n        \"\"\"\n        self._raise_if_has_differentials(op.__name__)\n\n        result = self.to_cartesian()._combine_operation(op, other, reverse)\n        if result is NotImplemented:\n            return NotImplemented\n        else:\n            return self.from_cartesian(result)"},{"col":4,"comment":"null","endLoc":2074,"header":"def _add_group(self, iterator, tag, data, config, pos)","id":7654,"name":"_add_group","nodeType":"Function","startLoc":2071,"text":"def _add_group(self, iterator, tag, data, config, pos):\n        group = Group(self._table, config=config, pos=pos, **data)\n        self.entries.append(group)\n        group.parse(iterator, config)"},{"id":7655,"name":"1904-66_STG.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---STG'                                                            CRPIX1  =  -2.519459909290E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--STG'                                                            CRPIX2  =   3.744942537739E+00                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =  -9.000000000000E+01 / Native latitude  of celestial pole             EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 01:26:55 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_STG.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7656,"name":"1904-66_PAR.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---PAR'                                                            CRPIX1  =  -2.465551494284E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--PAR'                                                            CRPIX2  =   3.322937769653E+00                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =   0.000000000000E+00 / Native latitude  of celestial pole             EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 01:59:17 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_PAR.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7657,"name":"1904-66_PCO.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---PCO'                                                            CRPIX1  =  -2.462486098896E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--PCO'                                                            CRPIX2  =   3.620782775517E-01                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =   0.000000000000E+00 / Native latitude  of celestial pole             EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 02:20:22 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_PCO.continuum.fits\".                    HISTORY Noise level of continuum map: 62 mJy (RMS)                              "},{"id":7658,"name":"1904-66_ARC.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---ARC'                                                            CRPIX1  =  -2.469419019050E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--ARC'                                                            CRPIX2  =   5.082274450444E+00                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =  -9.000000000000E+01 / Native latitude  of celestial pole             EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 01:35:43 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_ARC.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7659,"name":"1904-66_MER.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---MER'                                                            CRPIX1  =  -2.482173814412E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--MER'                                                            CRPIX2  =   7.364978412864E+00                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =   0.000000000000E+00 / Native latitude  of celestial pole             EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 01:53:59 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_MER.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7660,"name":"1904-66_TSC.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---TSC'                                                            CRPIX1  =  -1.897220156818E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--TSC'                                                            CRPIX2  =   2.037416464676E+01                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =   0.000000000000E+00 / Native latitude  of celestial pole             EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 02:23:02 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_TSC.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7661,"name":"1904-66_COD.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---COD'                                                            CRPIX1  =  -2.153431714695E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--COD'                                                            CRPIX2  =   1.561302682707E+01                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =  -4.500000000000E+01 / Native latitude  of celestial pole             PV2_1   =   4.500000000000E+01 / Projection parameter 1                         PV2_2   =   2.500000000000E+01 / Projection parameter 2                         EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 02:12:30 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_COD.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7662,"name":"1904-66_ZPN.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---ZPN'                                                            CRPIX1  =  -1.832937255632E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--ZPN'                                                            CRPIX2  =   2.209211120575E+01                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =  -9.000000000000E+01 / Native latitude  of celestial pole             PV2_0   =   5.000000000000E-02 / Projection parameter 0                         PV2_1   =   9.750000000000E-01 / Projection parameter 1                         PV2_2   =  -8.070000000000E-01 / Projection parameter 2                         PV2_3   =   3.370000000000E-01 / Projection parameter 3                         PV2_4   =  -6.500000000000E-02 / Projection parameter 4                         PV2_5   =   1.000000000000E-02 / Projection parameter 5                         PV2_6   =   3.000000000000E-03 / Projection parameter 6                         PV2_7   =  -1.000000000000E-03 / Projection parameter 7                         PV2_8   =   0.000000000000E+00 / Projection parameter 8                         PV2_9   =   0.000000000000E+00 / Projection parameter 9                         PV2_10  =   0.000000000000E+00 / Projection parameter 10                        PV2_11  =   0.000000000000E+00 / Projection parameter 11                        PV2_12  =   0.000000000000E+00 / Projection parameter 12                        PV2_13  =   0.000000000000E+00 / Projection parameter 13                        PV2_14  =   0.000000000000E+00 / Projection parameter 14                        PV2_15  =   0.000000000000E+00 / Projection parameter 15                        PV2_16  =   0.000000000000E+00 / Projection parameter 16                        PV2_17  =   0.000000000000E+00 / Projection parameter 17                        PV2_18  =   0.000000000000E+00 / Projection parameter 18                        PV2_19  =   0.000000000000E+00 / Projection parameter 19                        EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 01:38:20 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_ZPN.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7663,"name":"1904-66_COO.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---COO'                                                            CRPIX1  =  -2.136486051767E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--COO'                                                            CRPIX2  =   1.292640949564E+01                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =  -4.500000000000E+01 / Native latitude  of celestial pole             PV2_1   =   4.500000000000E+01 / Projection parameter 1                         PV2_2   =   2.500000000000E+01 / Projection parameter 2                         EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 02:15:07 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_COO.continuum.fits\".                    HISTORY Noise level of continuum map: 62 mJy (RMS)                              "},{"id":7664,"name":"1904-66_SFL.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---SFL'                                                            CRPIX1  =  -2.463483086237E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--SFL'                                                            CRPIX2  =   7.527038199745E+00                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =   0.000000000000E+00 / Native latitude  of celestial pole             EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 01:56:37 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_SFL.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7665,"name":"1904-66_QSC.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---QSC'                                                            CRPIX1  =  -2.583408175994E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--QSC'                                                            CRPIX2  =  -8.258194421088E+00                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =   0.000000000000E+00 / Native latitude  of celestial pole             EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 02:28:25 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_QSC.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7666,"name":"1904-66_NCP.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---SIN'                                                            CRPIX1  =  -2.371895431541E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--SIN'                                                            CRPIX2  =   7.688572009351E+00                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =  -9.000000000000E+01 / Native latitude  of celestial pole             PV2_1   =   0.000000000000E+00 / Projection parameter 1                         PV2_2   =  -1.216796447506E-08 / Projection parameter 2                         EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 01:33:03 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_NCP.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7667,"name":"1904-66_AIT.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---AIT'                                                            CRPIX1  =  -2.462317116277E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--AIT'                                                            CRPIX2  =   7.115850027049E+00                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =   0.000000000000E+00 / Native latitude  of celestial pole             EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 02:04:34 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_AIT.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7668,"name":"1904-66_COE.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---COE'                                                            CRPIX1  =  -2.230375366798E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--COE'                                                            CRPIX2  =  -1.435249668783E+01                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =   4.500000000000E+01 / Native latitude  of celestial pole             PV2_1   =  -4.500000000000E+01 / Projection parameter 1                         PV2_2   =   2.500000000000E+01 / Projection parameter 2                         EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 02:09:50 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_COE.continuum.fits\".                    HISTORY Noise level of continuum map: 62 mJy (RMS)                              "},{"id":7669,"name":"1904-66_CSC.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---CSC'                                                            CRPIX1  =  -2.686531829635E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--CSC'                                                            CRPIX2  =  -7.043520126533E+00                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =   0.000000000000E+00 / Native latitude  of celestial pole             EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 02:25:39 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_CSC.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7670,"name":"1904-66_TAN.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---TAN'                                                            CRPIX1  =  -2.680658087122E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--TAN'                                                            CRPIX2  =  -5.630437201085E-01                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =  -9.000000000000E+01 / Native latitude  of celestial pole             EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 01:23:37 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_TAN.continuum.fits\".                    HISTORY Noise level of continuum map: 59 mJy (RMS)                              "},{"id":7671,"name":"1904-66_CAR.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---CAR'                                                            CRPIX1  =  -2.482173814412E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--CAR'                                                            CRPIX2  =   7.527038199745E+00                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =   0.000000000000E+00 / Native latitude  of celestial pole             EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 01:51:20 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_CAR.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7672,"name":"1904-66_MOL.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/maps","text":"SIMPLE  =                    T                                                  BITPIX  =                  -32 / IEEE (big-endian) 32-bit floating point data   NAXIS   =                    2                                                  NAXIS1  =                  192                                                  NAXIS2  =                  192                                                  BUNIT   = 'JY/BEAM '                                                            CTYPE1  = 'RA---MOL'                                                            CRPIX1  =  -2.127655947497E+02                                                  CDELT1  =  -6.666666666667E-02                                                  CRVAL1  =   0.000000000000E+00                                                  CTYPE2  = 'DEC--MOL'                                                            CRPIX2  =  -2.310670994515E+00                                                  CDELT2  =   6.666666666667E-02                                                  CRVAL2  =  -9.000000000000E+01                                                  LONPOLE =   1.800000000000E+02 / Native longitude of celestial pole             LATPOLE =   0.000000000000E+00 / Native latitude  of celestial pole             EQUINOX =   2.000000000000E+03 / Equinox of equatorial coordinates              BMAJ    =   2.399999936422E-01 / Beam major axis in degrees                     BMIN    =   2.399999936422E-01 / Beam minor axis in degrees                     BPA     =   0.000000000000E+00 / Beam position angle in degrees                 RESTFRQ =   1.420405750000E+09 / Line rest frequency, Hz                        HISTORY Parkes Multibeam continuum map                                          HISTORY Formed on Mon 2004/02/09 02:01:55 GMT by \"pksgridzilla\" which was       HISTORY compiled on Feb  9 2004 12:08:02 (local time) within                    HISTORY AIPS++ version 19.405.00 dated .                                        HISTORY Polarization mode: A and B aggregated                                   HISTORY Gridding parameters:                                                    HISTORY    Method: WGTMED                                                       HISTORY    Clip fraction: 0.000                                                 HISTORY    Tsys weighting: applied                                              HISTORY    Beam weight order: 1                                                 HISTORY    Beam FWHM: 14.4 arcmin                                               HISTORY    Beam normalization: applied                                          HISTORY    Smoothing kernel type: TOP-HAT                                       HISTORY    Kernel FWHM: 12.0 arcmin                                             HISTORY    Cutoff radius: 6.0 arcmin                                            HISTORY      Beam RSS cutoff: 0.0                                               HISTORY Input data sets:                                                        HISTORY    97-10-09_0356_193558-66_206a.sdfits                                  HISTORY    97-10-12_0142_182123-66_193a.sdfits                                  HISTORY    97-10-12_0151_182707-66_194a.sdfits                                  HISTORY    97-10-12_0200_183252-66_195a.sdfits                                  HISTORY    97-11-07_0510_183836-66_196a.sdfits                                  HISTORY    97-11-07_0519_184420-66_197a.sdfits                                  HISTORY    97-11-07_0528_185004-66_198a.sdfits                                  HISTORY    97-11-07_0537_185548-66_199a.sdfits                                  HISTORY    97-11-07_0546_190132-66_200a.sdfits                                  HISTORY    97-11-07_0556_190717-66_201a.sdfits                                  HISTORY    97-11-07_0645_191301-66_202a.sdfits                                  HISTORY    97-11-07_0654_191845-66_203a.sdfits                                  HISTORY    97-11-07_0703_192429-66_204a.sdfits                                  HISTORY    97-11-07_0712_193013-66_205a.sdfits                                  HISTORY    97-11-07_0724_194142-66_207a.sdfits                                  HISTORY    97-11-18_0256_193815-66_206c.sdfits                                  HISTORY    97-11-18_0306_194359-66_207c.sdfits                                  HISTORY    97-11-19_0447_182341-66_193c.sdfits                                  HISTORY    97-11-19_0456_182925-66_194c.sdfits                                  HISTORY    97-11-19_0507_190350-66_200c.sdfits                                  HISTORY    97-11-19_0516_190934-66_201c.sdfits                                  HISTORY    97-11-19_0525_191519-66_202c.sdfits                                  HISTORY    97-11-19_0534_192103-66_203c.sdfits                                  HISTORY    97-11-19_0544_192647-66_204c.sdfits                                  HISTORY    97-11-19_0553_193231-66_205c.sdfits                                  HISTORY    97-11-19_0602_183509-66_195c.sdfits                                  HISTORY    97-11-19_0612_184053-66_196c.sdfits                                  HISTORY    97-11-19_0622_184638-66_197c.sdfits                                  HISTORY    97-11-19_0631_185222-66_198c.sdfits                                  HISTORY    97-11-19_0640_185806-66_199c.sdfits                                  HISTORY    98-03-24_2107_193706-66_206b.sdfits                                  HISTORY    98-03-24_2116_194251-66_207b.sdfits                                  HISTORY    98-03-25_2020_190826-66_201b.sdfits                                  HISTORY    98-03-25_2029_191410-66_202b.sdfits                                  HISTORY    98-03-25_2038_191954-66_203b.sdfits                                  HISTORY    98-03-25_2047_192538-66_204b.sdfits                                  HISTORY    98-03-25_2056_193122-66_205b.sdfits                                  HISTORY    98-03-26_2048_190459-66_200d.sdfits                                  HISTORY    98-03-27_2034_191627-66_202d.sdfits                                  HISTORY    98-03-27_2043_192212-66_203d.sdfits                                  HISTORY    98-03-27_2052_192756-66_204d.sdfits                                  HISTORY    98-03-27_2102_193340-66_205d.sdfits                                  HISTORY    98-03-27_2111_193924-66_206d.sdfits                                  HISTORY    98-03-27_2120_194508-66_207d.sdfits                                  HISTORY    98-03-27_2130_191043-66_201d.sdfits                                  HISTORY    98-05-10_2123_182232-66_193b.sdfits                                  HISTORY    98-05-10_2133_182816-66_194b.sdfits                                  HISTORY    98-05-10_2142_183400-66_195b.sdfits                                  HISTORY    98-05-10_2151_183945-66_196b.sdfits                                  HISTORY    98-05-10_2200_184529-66_197b.sdfits                                  HISTORY    98-05-10_2209_185113-66_198b.sdfits                                  HISTORY    98-05-10_2219_185657-66_199b.sdfits                                  HISTORY    98-05-10_2228_190241-66_200b.sdfits                                  HISTORY    98-05-13_2132_182450-66_193d.sdfits                                  HISTORY    98-05-13_2151_183034-66_194d.sdfits                                  HISTORY    98-05-13_2200_183618-66_195d.sdfits                                  HISTORY    98-05-13_2210_184202-66_196d.sdfits                                  HISTORY    98-05-13_2219_184746-66_197d.sdfits                                  HISTORY    98-05-13_2228_185331-66_198d.sdfits                                  HISTORY    98-05-13_2237_185915-66_199d.sdfits                                  HISTORY    98-05-25_1711_182559-66_193e.sdfits                                  HISTORY    98-05-25_1720_183143-66_194e.sdfits                                  HISTORY    98-05-25_1729_183727-66_195e.sdfits                                  HISTORY    98-05-25_1738_184311-66_196e.sdfits                                  HISTORY    98-05-25_1747_184855-66_197e.sdfits                                  HISTORY    98-05-25_1756_185439-66_198e.sdfits                                  HISTORY    98-05-25_1806_190024-66_199e.sdfits                                  HISTORY    98-05-25_1815_190608-66_200e.sdfits                                  HISTORY    98-05-25_1824_191152-66_201e.sdfits                                  HISTORY    98-05-25_1833_191736-66_202e.sdfits                                  HISTORY    98-05-25_1842_192320-66_203e.sdfits                                  HISTORY    98-05-25_1851_192905-66_204e.sdfits                                  HISTORY    98-05-25_1901_193449-66_205e.sdfits                                  HISTORY    98-05-25_1910_194033-66_206e.sdfits                                  HISTORY    98-05-25_1919_194617-66_207e.sdfits                                  HISTORY Original FITS filename \"1904-66_MOL.continuum.fits\".                    HISTORY Noise level of continuum map: 61 mJy (RMS)                              "},{"id":7673,"name":"astropy/wcs/tests/data/spectra","nodeType":"Package"},{"id":7674,"name":"orion-freq-1.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/spectra","text":"SIMPLE  =                    T / file does conform to FITS standard             BITPIX  =                  -32 / number of bits per data pixel                  NAXIS   =                    1 / number of data axes                            NAXIS1  =                 4096 / length of data axis 1                          EXTEND  =                    T / FITS dataset may contain extensions            COMMENT   FITS (Flexible Image Transport System) format is defined in 'AstronomyCOMMENT   and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H COMMENT                                                                         COMMENT This FITS file contains an example spectral WCS header constructed by   COMMENT Mark Calabretta (ATNF) and Dirk Petry (ESO) based on an observation     COMMENT of the Orion Kleinmann-Low nebula made by Andrew Walsh (JCU) and        COMMENT Sven Thorwirth (MPIfR) using the Mopra radio telescope.                 COMMENT                                                                         COMMENT The 110GHz 13CO 1-0 spectrum in this file is linear in frequency, as    COMMENT observed, it being the Fourier transform of a lag spectrum produced     COMMENT by a correlating spectrometer.                                          COMMENT                                                                         COMMENT The reference pixel has been placed deliberately well outside the       COMMENT the spectrum in order to test spectral-WCS-interpreting software.       COMMENT                                                                         COMMENT Spectral representations are:                                           COMMENT      Frequency (default)                ...frequency-like               COMMENT   E: Photon energy                      ...frequency-like               COMMENT   N: Wave number                        ...frequency-like               COMMENT   R: Radio velocity                     ...frequency-like               COMMENT   W: Wavelength                         ...wavelength-like              COMMENT   O: Optical velocity                   ...wavelength-like              COMMENT   Z: Redshift                           ...wavelength-like              COMMENT   V: Relativistic velocity              ...velocity-like                COMMENT   B: Relativistic beta                  ...velocity-like                COMMENT                                                                         COMMENT The Mopra radio telescope is operated by the Australia Telescope        COMMENT National Facility.                                                      COMMENT                                                                         COMMENT Author: Mark Calabretta, Australia Telescope National Facility          COMMENT http://www.atnf.csiro.au/~mcalabre/index.html                           COMMENT 2009-04-22                                                              COMMENT ----------------------------------------------------------------------  COMMENT                                                                         OBJECT  = 'Orion-KL'           / Orion Kleinmann-Low nebula                     MOLECULE= '13CO    '           / Carbon(13) monoxide                            TRANSITI= '1-0     '           / 1-0 transition                                 DATE-OBS= '2006-07-09T20:29:00' / Date of observation                           TELESCOP= 'ATNF Mopra'         / 22m mm-wave telescope                          OBSERVER= 'Walsh/Thorwirth'    / Observers                                      BUNIT   = 'K       '           / Brightness units, Kelvin                       COMMENT                                                                         COMMENT ------------------------------------------------------------ Frequency  COMMENT                                                                         CRPIX1  =              32768.0 / Pixel coordinate of reference point            CTYPE1  = 'FREQ    '           / Linear frequency axis (FFT of lag spectrum)    CRVAL1  =       102.1189414E+9 / [Hz] Frequency of reference channel            CDELT1  =      -2.695372970E+5 / [Hz] Channel spacing (lower sideband)          CUNIT1  = 'Hz      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQ =       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAV =        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYS = 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBS = 'TOPOCENT'           / Reference frame of observation                 VELOSYS =                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRC = 'LSRK    '           / Reference frame of source redshift             ZSOURCE =               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2  =                    1                                                  CDELT2  =                  1.0                                                  CTYPE2  = 'RA      '                                                            CRVAL2  =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2  = 'deg     '                                                            COMMENT                                                                         CRPIX3  =                    1                                                  CDELT3  =                  1.0                                                  CTYPE3  = 'DEC     '                                                            CRVAL3  =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3  = 'deg     '                                                            COMMENT                                                                         RADESYS = 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOX =               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4  =                    1                                                  CDELT4  =                  1.0                                                  CTYPE4  = 'STOKES  '                                                            CRVAL4  =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT -------------------------------------------------------- Photon energy  COMMENT                                                                         CRPIX1E =              32768.0 / Pixel coordinate of reference point            CTYPE1E = 'ENER    '           / Photon energy, linear frequency axis           CRVAL1E =       4.223303869E-4 / [eV] Photon energy of reference channel        CDELT1E =      -1.114717695E-9 / [eV] Channel spacing                           CUNIT1E = 'eV      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQE=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVE=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSE= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSE= 'TOPOCENT'           / Reference frame of observation                 VELOSYSE=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCE= 'LSRK    '           / Reference frame of source redshift             ZSOURCEE=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2E =                    1                                                  CDELT2E =                  1.0                                                  CTYPE2E = 'RA      '                                                            CRVAL2E =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2E = 'deg     '                                                            COMMENT                                                                         CRPIX3E =                    1                                                  CDELT3E =                  1.0                                                  CTYPE3E = 'DEC     '                                                            CRVAL3E =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3E = 'deg     '                                                            COMMENT                                                                         RADESYSE= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXE=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4E =                    1                                                  CDELT4E =                  1.0                                                  CTYPE4E = 'STOKES  '                                                            CRVAL4E =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ---------------------------------------------------------- Wave number  COMMENT   N: Wave number                                                        COMMENT                                                                         CRPIX1N =              32768.0 / Pixel coordinate of reference point            CTYPE1N = 'WAVN    '           / Wave number, linear frequency axis             CRVAL1N =       3.406321229E+2 / [/m] Wave number of reference channel          CDELT1N =      -8.990796460E-4 / [/m] Channel spacing                           CUNIT1N = '/m      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQN=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVN=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSN= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSN= 'TOPOCENT'           / Reference frame of observation                 VELOSYSN=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCN= 'LSRK    '           / Reference frame of source redshift             ZSOURCEN=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2N =                    1                                                  CDELT2N =                  1.0                                                  CTYPE2N = 'RA      '                                                            CRVAL2N =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2N = 'deg     '                                                            COMMENT                                                                         CRPIX3N =                    1                                                  CDELT3N =                  1.0                                                  CTYPE3N = 'DEC     '                                                            CRVAL3N =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3N = 'deg     '                                                            COMMENT                                                                         RADESYSN= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXN=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4N =                    1                                                  CDELT4N =                  1.0                                                  CTYPE4N = 'STOKES  '                                                            CRVAL4N =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------------- Radio velocity  COMMENT   N: Wave number                                                        COMMENT   R: Radio velocity                                                     COMMENT                                                                         CRPIX1R =              32768.0 / Pixel coordinate of reference point            CTYPE1R = 'VRAD    '           / Radio velocity, linear frequency axis          CRVAL1R =       2.198744369E+7 / [m/s] Radio velocity of reference channel      CDELT1R =       7.332509683E+2 / [m/s] Channel spacing                          CUNIT1R = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQR=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVR=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSR= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSR= 'TOPOCENT'           / Reference frame of observation                 VELOSYSR=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCR= 'LSRK    '           / Reference frame of source redshift             ZSOURCER=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2R =                    1                                                  CDELT2R =                  1.0                                                  CTYPE2R = 'RA      '                                                            CRVAL2R =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2R = 'deg     '                                                            COMMENT                                                                         CRPIX3R =                    1                                                  CDELT3R =                  1.0                                                  CTYPE3R = 'DEC     '                                                            CRVAL3R =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3R = 'deg     '                                                            COMMENT                                                                         RADESYSR= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXR=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4R =                    1                                                  CDELT4R =                  1.0                                                  CTYPE4R = 'STOKES  '                                                            CRVAL4R =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ----------------------------------------------------------- Wavelength  COMMENT   N: Wave number                                                        COMMENT   R: Radio velocity                                                     COMMENT   W: Wavelength                                                         COMMENT                                                                         CRPIX1W =              32768.0 / Pixel coordinate of reference point            CTYPE1W = 'WAVE-F2W'           / Wavelength in vacuuo, non-linear axis          CRVAL1W =       2.935718427E-3 / [m] Wavelength of reference channel            CDELT1W =       7.748666397E-9 / [m] Channel spacing                            CUNIT1W = 'm       '           / Units of coordinate increment and value        COMMENT                                                                         SPECSYSW= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSW= 'TOPOCENT'           / Reference frame of observation                 VELOSYSW=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCW= 'LSRK    '           / Reference frame of source redshift             ZSOURCEW=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2W =                    1                                                  CDELT2W =                  1.0                                                  CTYPE2W = 'RA      '                                                            CRVAL2W =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2W = 'deg     '                                                            COMMENT                                                                         CRPIX3W =                    1                                                  CDELT3W =                  1.0                                                  CTYPE3W = 'DEC     '                                                            CRVAL3W =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3W = 'deg     '                                                            COMMENT                                                                         RADESYSW= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXW=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4W =                    1                                                  CDELT4W =                  1.0                                                  CTYPE4W = 'STOKES  '                                                            CRVAL4W =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ----------------------------------------------------- Optical velocity  COMMENT                                                                         CRPIX1O =              32768.0 / Pixel coordinate of reference point            CTYPE1O = 'VOPT-F2W'           / Optical velocity, non-linear axis              CRVAL1O =       2.372768470E+7 / [m/s] Optical velocity of reference channel    CDELT1O =       8.539135209E+2 / [m/s] Channel spacing                          CUNIT1O = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQO=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVO=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSO= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSO= 'TOPOCENT'           / Reference frame of observation                 VELOSYSO=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCO= 'LSRK    '           / Reference frame of source redshift             ZSOURCEO=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2O =                    1                                                  CDELT2O =                  1.0                                                  CTYPE2O = 'RA      '                                                            CRVAL2O =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2O = 'deg     '                                                            COMMENT                                                                         CRPIX3O =                    1                                                  CDELT3O =                  1.0                                                  CTYPE3O = 'DEC     '                                                            CRVAL3O =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3O = 'deg     '                                                            COMMENT                                                                         RADESYSO= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXO=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4O =                    1                                                  CDELT4O =                  1.0                                                  CTYPE4O = 'STOKES  '                                                            CRVAL4O =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------------------- Redshift  COMMENT   N: Wave number                                                        COMMENT   R: Radio velocity                                                     COMMENT   W: Wavelength                                                         COMMENT   O: Optical velocity                                                   COMMENT   Z: Redshift                                                           COMMENT                                                                         CRPIX1Z =              32768.0 / Pixel coordinate of reference point            CTYPE1Z = 'ZOPT-F2W'           / Redshift, non-linear axis                      CRVAL1Z =       7.914703679E-2 / [] Redshift of reference channel               CDELT1Z =       2.848348910E-6 / [] Channel spacing                             COMMENT                                                                         RESTFRQZ=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVZ=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSZ= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSZ= 'TOPOCENT'           / Reference frame of observation                 VELOSYSZ=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCZ= 'LSRK    '           / Reference frame of source redshift             ZSOURCEZ=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2Z =                    1                                                  CDELT2Z =                  1.0                                                  CTYPE2Z = 'RA      '                                                            CRVAL2Z =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2Z = 'deg     '                                                            COMMENT                                                                         CRPIX3Z =                    1                                                  CDELT3Z =                  1.0                                                  CTYPE3Z = 'DEC     '                                                            CRVAL3Z =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3Z = 'deg     '                                                            COMMENT                                                                         RADESYSZ= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXZ=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4Z =                    1                                                  CDELT4Z =                  1.0                                                  CTYPE4Z = 'STOKES  '                                                            CRVAL4Z =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------ Relativistic velocity  COMMENT                                                                         CRPIX1V =              32768.0 / Pixel coordinate of reference point            CTYPE1V = 'VELO-F2V'           / Relativistic velocity, non-linear axis         CRVAL1V =       2.279141418E+7 / [m/s] Velocity of reference channel            CDELT1V =       7.867122599E+2 / [m/s] Channel spacing                          CUNIT1V = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQV=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVV=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSV= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSV= 'TOPOCENT'           / Reference frame of observation                 VELOSYSV=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCV= 'LSRK    '           / Reference frame of source redshift             ZSOURCEV=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2V =                    1                                                  CDELT2V =                  1.0                                                  CTYPE2V = 'RA      '                                                            CRVAL2V =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2V = 'deg     '                                                            COMMENT                                                                         CRPIX3V =                    1                                                  CDELT3V =                  1.0                                                  CTYPE3V = 'DEC     '                                                            CRVAL3V =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3V = 'deg     '                                                            COMMENT                                                                         RADESYSV= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXV=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4V =                    1                                                  CDELT4V =                  1.0                                                  CTYPE4V = 'STOKES  '                                                            CRVAL4V =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ---------------------------------------------- Relativistic beta (v/c)  COMMENT                                                                         CRPIX1B =              32768.0 / Pixel coordinate of reference point            CTYPE1B = 'BETA-F2V'           / Relativistic beta (v/c), non-linear axis       CRVAL1B =       7.602397448E-2 / [] Relativistic beta of reference channel      CDELT1B =       2.624189632E-6 / [] Channel spacing                             COMMENT                                                                         RESTFRQB=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVB=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSB= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSB= 'TOPOCENT'           / Reference frame of observation                 VELOSYSB=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCB= 'LSRK    '           / Reference frame of source redshift             ZSOURCEB=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2B =                    1                                                  CDELT2B =                  1.0                                                  CTYPE2B = 'RA      '                                                            CRVAL2B =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2B = 'deg     '                                                            COMMENT                                                                         CRPIX3B =                    1                                                  CDELT3B =                  1.0                                                  CTYPE3B = 'DEC     '                                                            CRVAL3B =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3B = 'deg     '                                                            COMMENT                                                                         RADESYSB= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXB=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4B =                    1                                                  CDELT4B =                  1.0                                                  CTYPE4B = 'STOKES  '                                                            CRVAL4B =                    1 / Stokes I (total intensity)                     COMMENT                                                                         HISTORY fimgcreate 1.0b at 2009-04-22T04:27:55                                  DATE    = '2009-04-22T04:27:55' / file creation date (YYYY-MM-DDThh:mm:ss UT)   "},{"id":7675,"name":"orion-freq-4.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/spectra","text":"SIMPLE  =                    T / file does conform to FITS standard             BITPIX  =                  -32 / number of bits per data pixel                  NAXIS   =                    4 / number of data axes                            NAXIS1  =                 4096 / length of data axis 1                          NAXIS2  =                    1 / length of data axis 2                          NAXIS3  =                    1 / length of data axis 3                          NAXIS4  =                    1 / length of data axis 4                          EXTEND  =                    T / FITS dataset may contain extensions            COMMENT   FITS (Flexible Image Transport System) format is defined in 'AstronomyCOMMENT   and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H COMMENT                                                                         COMMENT This FITS file contains an example spectral WCS header constructed by   COMMENT Mark Calabretta (ATNF) and Dirk Petry (ESO) based on an observation     COMMENT of the Orion Kleinmann-Low nebula made by Andrew Walsh (JCU) and        COMMENT Sven Thorwirth (MPIfR) using the Mopra radio telescope.                 COMMENT                                                                         COMMENT The 110GHz 13CO 1-0 spectrum in this file is linear in frequency, as    COMMENT observed, it being the Fourier transform of a lag spectrum produced     COMMENT by a correlating spectrometer.                                          COMMENT                                                                         COMMENT The reference pixel has been placed deliberately well outside the       COMMENT the spectrum in order to test spectral-WCS-interpreting software.       COMMENT                                                                         COMMENT Spectral representations are:                                           COMMENT      Frequency (default)                ...frequency-like               COMMENT   E: Photon energy                      ...frequency-like               COMMENT   N: Wave number                        ...frequency-like               COMMENT   R: Radio velocity                     ...frequency-like               COMMENT   W: Wavelength                         ...wavelength-like              COMMENT   O: Optical velocity                   ...wavelength-like              COMMENT   Z: Redshift                           ...wavelength-like              COMMENT   V: Relativistic velocity              ...velocity-like                COMMENT   B: Relativistic beta                  ...velocity-like                COMMENT                                                                         COMMENT The Mopra radio telescope is operated by the Australia Telescope        COMMENT National Facility.                                                      COMMENT                                                                         COMMENT Author: Mark Calabretta, Australia Telescope National Facility          COMMENT http://www.atnf.csiro.au/~mcalabre/index.html                           COMMENT 2009-04-22                                                              COMMENT ----------------------------------------------------------------------  COMMENT                                                                         OBJECT  = 'Orion-KL'           / Orion Kleinmann-Low nebula                     MOLECULE= '13CO    '           / Carbon(13) monoxide                            TRANSITI= '1-0     '           / 1-0 transition                                 DATE-OBS= '2006-07-09T20:29:00' / Date of observation                           TELESCOP= 'ATNF Mopra'         / 22m mm-wave telescope                          OBSERVER= 'Walsh/Thorwirth'    / Observers                                      BUNIT   = 'K       '           / Brightness units, Kelvin                       COMMENT                                                                         COMMENT ------------------------------------------------------------ Frequency  COMMENT                                                                         CRPIX1  =              32768.0 / Pixel coordinate of reference point            CTYPE1  = 'FREQ    '           / Linear frequency axis (FFT of lag spectrum)    CRVAL1  =       102.1189414E+9 / [Hz] Frequency of reference channel            CDELT1  =      -2.695372970E+5 / [Hz] Channel spacing (lower sideband)          CUNIT1  = 'Hz      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQ =       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAV =        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYS = 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBS = 'TOPOCENT'           / Reference frame of observation                 VELOSYS =                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRC = 'LSRK    '           / Reference frame of source redshift             ZSOURCE =               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2  =                    1                                                  CDELT2  =                  1.0                                                  CTYPE2  = 'RA      '                                                            CRVAL2  =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2  = 'deg     '                                                            COMMENT                                                                         CRPIX3  =                    1                                                  CDELT3  =                  1.0                                                  CTYPE3  = 'DEC     '                                                            CRVAL3  =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3  = 'deg     '                                                            COMMENT                                                                         RADESYS = 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOX =               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4  =                    1                                                  CDELT4  =                  1.0                                                  CTYPE4  = 'STOKES  '                                                            CRVAL4  =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT -------------------------------------------------------- Photon energy  COMMENT                                                                         CRPIX1E =              32768.0 / Pixel coordinate of reference point            CTYPE1E = 'ENER    '           / Photon energy, linear frequency axis           CRVAL1E =       4.223303869E-4 / [eV] Photon energy of reference channel        CDELT1E =      -1.114717695E-9 / [eV] Channel spacing                           CUNIT1E = 'eV      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQE=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVE=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSE= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSE= 'TOPOCENT'           / Reference frame of observation                 VELOSYSE=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCE= 'LSRK    '           / Reference frame of source redshift             ZSOURCEE=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2E =                    1                                                  CDELT2E =                  1.0                                                  CTYPE2E = 'RA      '                                                            CRVAL2E =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2E = 'deg     '                                                            COMMENT                                                                         CRPIX3E =                    1                                                  CDELT3E =                  1.0                                                  CTYPE3E = 'DEC     '                                                            CRVAL3E =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3E = 'deg     '                                                            COMMENT                                                                         RADESYSE= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXE=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4E =                    1                                                  CDELT4E =                  1.0                                                  CTYPE4E = 'STOKES  '                                                            CRVAL4E =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ---------------------------------------------------------- Wave number  COMMENT   N: Wave number                                                        COMMENT                                                                         CRPIX1N =              32768.0 / Pixel coordinate of reference point            CTYPE1N = 'WAVN    '           / Wave number, linear frequency axis             CRVAL1N =       3.406321229E+2 / [/m] Wave number of reference channel          CDELT1N =      -8.990796460E-4 / [/m] Channel spacing                           CUNIT1N = '/m      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQN=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVN=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSN= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSN= 'TOPOCENT'           / Reference frame of observation                 VELOSYSN=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCN= 'LSRK    '           / Reference frame of source redshift             ZSOURCEN=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2N =                    1                                                  CDELT2N =                  1.0                                                  CTYPE2N = 'RA      '                                                            CRVAL2N =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2N = 'deg     '                                                            COMMENT                                                                         CRPIX3N =                    1                                                  CDELT3N =                  1.0                                                  CTYPE3N = 'DEC     '                                                            CRVAL3N =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3N = 'deg     '                                                            COMMENT                                                                         RADESYSN= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXN=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4N =                    1                                                  CDELT4N =                  1.0                                                  CTYPE4N = 'STOKES  '                                                            CRVAL4N =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------------- Radio velocity  COMMENT   N: Wave number                                                        COMMENT   R: Radio velocity                                                     COMMENT                                                                         CRPIX1R =              32768.0 / Pixel coordinate of reference point            CTYPE1R = 'VRAD    '           / Radio velocity, linear frequency axis          CRVAL1R =       2.198744369E+7 / [m/s] Radio velocity of reference channel      CDELT1R =       7.332509683E+2 / [m/s] Channel spacing                          CUNIT1R = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQR=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVR=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSR= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSR= 'TOPOCENT'           / Reference frame of observation                 VELOSYSR=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCR= 'LSRK    '           / Reference frame of source redshift             ZSOURCER=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2R =                    1                                                  CDELT2R =                  1.0                                                  CTYPE2R = 'RA      '                                                            CRVAL2R =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2R = 'deg     '                                                            COMMENT                                                                         CRPIX3R =                    1                                                  CDELT3R =                  1.0                                                  CTYPE3R = 'DEC     '                                                            CRVAL3R =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3R = 'deg     '                                                            COMMENT                                                                         RADESYSR= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXR=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4R =                    1                                                  CDELT4R =                  1.0                                                  CTYPE4R = 'STOKES  '                                                            CRVAL4R =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ----------------------------------------------------------- Wavelength  COMMENT   N: Wave number                                                        COMMENT   R: Radio velocity                                                     COMMENT   W: Wavelength                                                         COMMENT                                                                         CRPIX1W =              32768.0 / Pixel coordinate of reference point            CTYPE1W = 'WAVE-F2W'           / Wavelength in vacuuo, non-linear axis          CRVAL1W =       2.935718427E-3 / [m] Wavelength of reference channel            CDELT1W =       7.748666397E-9 / [m] Channel spacing                            CUNIT1W = 'm       '           / Units of coordinate increment and value        COMMENT                                                                         SPECSYSW= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSW= 'TOPOCENT'           / Reference frame of observation                 VELOSYSW=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCW= 'LSRK    '           / Reference frame of source redshift             ZSOURCEW=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2W =                    1                                                  CDELT2W =                  1.0                                                  CTYPE2W = 'RA      '                                                            CRVAL2W =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2W = 'deg     '                                                            COMMENT                                                                         CRPIX3W =                    1                                                  CDELT3W =                  1.0                                                  CTYPE3W = 'DEC     '                                                            CRVAL3W =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3W = 'deg     '                                                            COMMENT                                                                         RADESYSW= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXW=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4W =                    1                                                  CDELT4W =                  1.0                                                  CTYPE4W = 'STOKES  '                                                            CRVAL4W =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ----------------------------------------------------- Optical velocity  COMMENT                                                                         CRPIX1O =              32768.0 / Pixel coordinate of reference point            CTYPE1O = 'VOPT-F2W'           / Optical velocity, non-linear axis              CRVAL1O =       2.372768470E+7 / [m/s] Optical velocity of reference channel    CDELT1O =       8.539135209E+2 / [m/s] Channel spacing                          CUNIT1O = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQO=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVO=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSO= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSO= 'TOPOCENT'           / Reference frame of observation                 VELOSYSO=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCO= 'LSRK    '           / Reference frame of source redshift             ZSOURCEO=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2O =                    1                                                  CDELT2O =                  1.0                                                  CTYPE2O = 'RA      '                                                            CRVAL2O =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2O = 'deg     '                                                            COMMENT                                                                         CRPIX3O =                    1                                                  CDELT3O =                  1.0                                                  CTYPE3O = 'DEC     '                                                            CRVAL3O =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3O = 'deg     '                                                            COMMENT                                                                         RADESYSO= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXO=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4O =                    1                                                  CDELT4O =                  1.0                                                  CTYPE4O = 'STOKES  '                                                            CRVAL4O =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------------------- Redshift  COMMENT   N: Wave number                                                        COMMENT   R: Radio velocity                                                     COMMENT   W: Wavelength                                                         COMMENT   O: Optical velocity                                                   COMMENT   Z: Redshift                                                           COMMENT                                                                         CRPIX1Z =              32768.0 / Pixel coordinate of reference point            CTYPE1Z = 'ZOPT-F2W'           / Redshift, non-linear axis                      CRVAL1Z =       7.914703679E-2 / [] Redshift of reference channel               CDELT1Z =       2.848348910E-6 / [] Channel spacing                             COMMENT                                                                         RESTFRQZ=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVZ=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSZ= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSZ= 'TOPOCENT'           / Reference frame of observation                 VELOSYSZ=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCZ= 'LSRK    '           / Reference frame of source redshift             ZSOURCEZ=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2Z =                    1                                                  CDELT2Z =                  1.0                                                  CTYPE2Z = 'RA      '                                                            CRVAL2Z =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2Z = 'deg     '                                                            COMMENT                                                                         CRPIX3Z =                    1                                                  CDELT3Z =                  1.0                                                  CTYPE3Z = 'DEC     '                                                            CRVAL3Z =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3Z = 'deg     '                                                            COMMENT                                                                         RADESYSZ= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXZ=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4Z =                    1                                                  CDELT4Z =                  1.0                                                  CTYPE4Z = 'STOKES  '                                                            CRVAL4Z =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------ Relativistic velocity  COMMENT                                                                         CRPIX1V =              32768.0 / Pixel coordinate of reference point            CTYPE1V = 'VELO-F2V'           / Relativistic velocity, non-linear axis         CRVAL1V =       2.279141418E+7 / [m/s] Velocity of reference channel            CDELT1V =       7.867122599E+2 / [m/s] Channel spacing                          CUNIT1V = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQV=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVV=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSV= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSV= 'TOPOCENT'           / Reference frame of observation                 VELOSYSV=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCV= 'LSRK    '           / Reference frame of source redshift             ZSOURCEV=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2V =                    1                                                  CDELT2V =                  1.0                                                  CTYPE2V = 'RA      '                                                            CRVAL2V =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2V = 'deg     '                                                            COMMENT                                                                         CRPIX3V =                    1                                                  CDELT3V =                  1.0                                                  CTYPE3V = 'DEC     '                                                            CRVAL3V =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3V = 'deg     '                                                            COMMENT                                                                         RADESYSV= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXV=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4V =                    1                                                  CDELT4V =                  1.0                                                  CTYPE4V = 'STOKES  '                                                            CRVAL4V =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ---------------------------------------------- Relativistic beta (v/c)  COMMENT                                                                         CRPIX1B =              32768.0 / Pixel coordinate of reference point            CTYPE1B = 'BETA-F2V'           / Relativistic beta (v/c), non-linear axis       CRVAL1B =       7.602397448E-2 / [] Relativistic beta of reference channel      CDELT1B =       2.624189632E-6 / [] Channel spacing                             COMMENT                                                                         RESTFRQB=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVB=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSB= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSB= 'TOPOCENT'           / Reference frame of observation                 VELOSYSB=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCB= 'LSRK    '           / Reference frame of source redshift             ZSOURCEB=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2B =                    1                                                  CDELT2B =                  1.0                                                  CTYPE2B = 'RA      '                                                            CRVAL2B =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2B = 'deg     '                                                            COMMENT                                                                         CRPIX3B =                    1                                                  CDELT3B =                  1.0                                                  CTYPE3B = 'DEC     '                                                            CRVAL3B =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3B = 'deg     '                                                            COMMENT                                                                         RADESYSB= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXB=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4B =                    1                                                  CDELT4B =                  1.0                                                  CTYPE4B = 'STOKES  '                                                            CRVAL4B =                    1 / Stokes I (total intensity)                     COMMENT                                                                         HISTORY fimgcreate 1.0b at 2009-04-22T04:28:02                                  DATE    = '2009-04-22T04:28:02' / file creation date (YYYY-MM-DDThh:mm:ss UT)   "},{"id":7676,"name":"orion-velo-4.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/spectra","text":"SIMPLE  =                    T / file does conform to FITS standard             BITPIX  =                  -32 / number of bits per data pixel                  NAXIS   =                    4 / number of data axes                            NAXIS1  =                 4096 / length of data axis 1                          NAXIS2  =                    1 / length of data axis 2                          NAXIS3  =                    1 / length of data axis 3                          NAXIS4  =                    1 / length of data axis 4                          EXTEND  =                    T / FITS dataset may contain extensions            COMMENT   FITS (Flexible Image Transport System) format is defined in 'AstronomyCOMMENT   and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H COMMENT                                                                         COMMENT This FITS file contains an example spectral WCS header constructed by   COMMENT Mark Calabretta (ATNF) and Dirk Petry (ESO) based on an observation     COMMENT of the Orion Kleinmann-Low nebula made by Andrew Walsh (JCU) and        COMMENT Sven Thorwirth (MPIfR) using the Mopra radio telescope.                 COMMENT                                                                         COMMENT The 110GHz 13CO 1-0 spectrum in this file is linear in relativistic     COMMENT velocity having been regridded from a linear frequency axis, as         COMMENT observed.                                                               COMMENT                                                                         COMMENT The reference pixel has been placed deliberately well outside the       COMMENT the spectrum in order to test spectral-WCS-interpreting software.       COMMENT                                                                         COMMENT Spectral representations are:                                           COMMENT   F: Frequency                          ...frequency-like               COMMENT   E: Photon energy                      ...frequency-like               COMMENT   N: Wave number                        ...frequency-like               COMMENT   R: Radio velocity                     ...frequency-like               COMMENT   W: Wavelength                         ...wavelength-like              COMMENT   O: Optical velocity                   ...wavelength-like              COMMENT   Z: Redshift                           ...wavelength-like              COMMENT      Relativistic velocity (default)    ...velocity-like                COMMENT   B: Relativistic beta                  ...velocity-like                COMMENT                                                                         COMMENT The Mopra radio telescope is operated by the Australia Telescope        COMMENT National Facility.                                                      COMMENT                                                                         COMMENT Author: Mark Calabretta, Australia Telescope National Facility          COMMENT http://www.atnf.csiro.au/~mcalabre/index.html                           COMMENT 2009-04-22                                                              COMMENT ----------------------------------------------------------------------  COMMENT                                                                         OBJECT  = 'Orion-KL'           / Orion Kleinmann-Low nebula                     MOLECULE= '13CO    '           / Carbon(13) monoxide                            TRANSITI= '1-0     '           / 1-0 transition                                 DATE-OBS= '2006-07-09T20:29:00' / Date of observation                           TELESCOP= 'ATNF Mopra'         / 22m mm-wave telescope                          OBSERVER= 'Walsh/Thorwirth'    / Observers                                      BUNIT   = 'K       '           / Brightness units, Kelvin                       COMMENT                                                                         COMMENT ------------------------------------------------------------ Frequency  COMMENT                                                                         CRPIX1F =              32768.0 / Pixel coordinate of reference point            CTYPE1F = 'FREQ-V2F'           / Frequency, non-linear axis                     CRVAL1F =       102.4071237E+9 / [Hz] Frequency of reference channel            CDELT1F =      -2.513721996E+5 / [Hz] Channel spacing                           CUNIT1F = 'Hz      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQF=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVF=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSF= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSF= 'TOPOCENT'           / Reference frame of observation                 VELOSYSF=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCF= 'LSRK    '           / Reference frame of source redshift             ZSOURCEF=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2F =                    1                                                  CDELT2F =                  1.0                                                  CTYPE2F = 'RA      '                                                            CRVAL2F =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2F = 'deg     '                                                            COMMENT                                                                         CRPIX3F =                    1                                                  CDELT3F =                  1.0                                                  CTYPE3F = 'DEC     '                                                            CRVAL3F =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3F = 'deg     '                                                            COMMENT                                                                         RADESYSF= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXF=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4F =                    1                                                  CDELT4F =                  1.0                                                  CTYPE4F = 'STOKES  '                                                            CRVAL4F =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT -------------------------------------------------------- Photon energy  COMMENT                                                                         CRPIX1E =              32768.0 / Pixel coordinate of reference point            CTYPE1E = 'ENER-V2F'           / Photon energy, non-linear axis                 CRVAL1E =       4.235222141E-4 / [eV] Photon energy of reference channel        CDELT1E =      -1.039592821E-9 / [eV] Channel spacing                           CUNIT1E = 'eV      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQE=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVE=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSE= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSE= 'TOPOCENT'           / Reference frame of observation                 VELOSYSE=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCE= 'LSRK    '           / Reference frame of source redshift             ZSOURCEE=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2E =                    1                                                  CDELT2E =                  1.0                                                  CTYPE2E = 'RA      '                                                            CRVAL2E =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2E = 'deg     '                                                            COMMENT                                                                         CRPIX3E =                    1                                                  CDELT3E =                  1.0                                                  CTYPE3E = 'DEC     '                                                            CRVAL3E =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3E = 'deg     '                                                            COMMENT                                                                         RADESYSE= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXE=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4E =                    1                                                  CDELT4E =                  1.0                                                  CTYPE4E = 'STOKES  '                                                            CRVAL4E =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ---------------------------------------------------------- Wave number  COMMENT                                                                         CRPIX1N =              32768.0 / Pixel coordinate of reference point            CTYPE1N = 'WAVN-V2F'           / Wave number, non-linear axis                   CRVAL1N =       3.415933955E+2 / [/m] Wave number of reference channel          CDELT1N =      -8.384874032E-4 / [/m] Channel spacing                           CUNIT1N = '/m      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQN=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVN=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSN= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSN= 'TOPOCENT'           / Reference frame of observation                 VELOSYSN=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCN= 'LSRK    '           / Reference frame of source redshift             ZSOURCEN=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2N =                    1                                                  CDELT2N =                  1.0                                                  CTYPE2N = 'RA      '                                                            CRVAL2N =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2N = 'deg     '                                                            COMMENT                                                                         CRPIX3N =                    1                                                  CDELT3N =                  1.0                                                  CTYPE3N = 'DEC     '                                                            CRVAL3N =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3N = 'deg     '                                                            COMMENT                                                                         RADESYSN= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXN=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4N =                    1                                                  CDELT4N =                  1.0                                                  CTYPE4N = 'STOKES  '                                                            CRVAL4N =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------------- Radio velocity  COMMENT                                                                         CRPIX1R =              32768.0 / Pixel coordinate of reference point            CTYPE1R = 'VRAD-V2F'           / Radio velocity, non-linear axis                CRVAL1R =       2.120347082E+7 / [m/s] Radio velocity of reference channel      CDELT1R =       6.838345224E+2 / [m/s] Channel spacing                          CUNIT1R = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQR=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVR=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSR= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSR= 'TOPOCENT'           / Reference frame of observation                 VELOSYSR=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCR= 'LSRK    '           / Reference frame of source redshift             ZSOURCER=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2R =                    1                                                  CDELT2R =                  1.0                                                  CTYPE2R = 'RA      '                                                            CRVAL2R =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2R = 'deg     '                                                            COMMENT                                                                         CRPIX3R =                    1                                                  CDELT3R =                  1.0                                                  CTYPE3R = 'DEC     '                                                            CRVAL3R =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3R = 'deg     '                                                            COMMENT                                                                         RADESYSR= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXR=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4R =                    1                                                  CDELT4R =                  1.0                                                  CTYPE4R = 'STOKES  '                                                            CRVAL4R =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ----------------------------------------------------------- Wavelength  COMMENT                                                                         CRPIX1W =              32768.0 / Pixel coordinate of reference point            CTYPE1W = 'WAVE-V2W'           / Wavelength in vacuuo, linear axis              CRVAL1W =       2.927457068E-3 / [m] Wavelength of reference channel            CDELT1W =       7.185841143E-9 / [m] Channel spacing                            CUNIT1W = 'm       '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQW=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVW=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSW= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSW= 'TOPOCENT'           / Reference frame of observation                 VELOSYSW=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCW= 'LSRK    '           / Reference frame of source redshift             ZSOURCEW=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2W =                    1                                                  CDELT2W =                  1.0                                                  CTYPE2W = 'RA      '                                                            CRVAL2W =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2W = 'deg     '                                                            COMMENT                                                                         CRPIX3W =                    1                                                  CDELT3W =                  1.0                                                  CTYPE3W = 'DEC     '                                                            CRVAL3W =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3W = 'deg     '                                                            COMMENT                                                                         RADESYSW= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXW=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4W =                    1                                                  CDELT4W =                  1.0                                                  CTYPE4W = 'STOKES  '                                                            CRVAL4W =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ----------------------------------------------------- Optical velocity  COMMENT                                                                         CRPIX1O =              32768.0 / Pixel coordinate of reference point            CTYPE1O = 'VOPT-V2W'           / Optical velocity, linear axis                  CRVAL1O =       2.281727178E+7 / [m/s] Optical velocity of reference channel    CDELT1O =       7.918894164E+2 / [m/s] Channel spacing                          CUNIT1O = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQO=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVO=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSO= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSO= 'TOPOCENT'           / Reference frame of observation                 VELOSYSO=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCO= 'LSRK    '           / Reference frame of source redshift             ZSOURCEO=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2O =                    1                                                  CDELT2O =                  1.0                                                  CTYPE2O = 'RA      '                                                            CRVAL2O =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2O = 'deg     '                                                            COMMENT                                                                         CRPIX3O =                    1                                                  CDELT3O =                  1.0                                                  CTYPE3O = 'DEC     '                                                            CRVAL3O =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3O = 'deg     '                                                            COMMENT                                                                         RADESYSO= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXO=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4O =                    1                                                  CDELT4O =                  1.0                                                  CTYPE4O = 'STOKES  '                                                            CRVAL4O =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------------------- Redshift  COMMENT                                                                         CRPIX1Z =              32768.0 / Pixel coordinate of reference point            CTYPE1Z = 'ZOPT-V2W'           / Redshift, linear axis                          CRVAL1Z =       7.611022615E-2 / [] Redshift of reference channel               CDELT1Z =       2.641458767E-6 / [] Channel spacing                             COMMENT                                                                         RESTFRQZ=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVZ=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSZ= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSZ= 'TOPOCENT'           / Reference frame of observation                 VELOSYSZ=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCZ= 'LSRK    '           / Reference frame of source redshift             ZSOURCEZ=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2Z =                    1                                                  CDELT2Z =                  1.0                                                  CTYPE2Z = 'RA      '                                                            CRVAL2Z =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2Z = 'deg     '                                                            COMMENT                                                                         CRPIX3Z =                    1                                                  CDELT3Z =                  1.0                                                  CTYPE3Z = 'DEC     '                                                            CRVAL3Z =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3Z = 'deg     '                                                            COMMENT                                                                         RADESYSZ= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXZ=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4Z =                    1                                                  CDELT4Z =                  1.0                                                  CTYPE4Z = 'STOKES  '                                                            CRVAL4Z =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------ Relativistic velocity  COMMENT                                                                         CRPIX1  =              32768.0 / Pixel coordinate of reference point            CTYPE1  = 'VELO    '           / Relativistic velocity, non-linear axis         CRVAL1  =       2.195128874E+7 / [m/s] Velocity of reference channel            CDELT1  =       7.319359645E+2 / [m/s] Channel spacing                          CUNIT1  = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQ =       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAV =        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYS = 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBS = 'TOPOCENT'           / Reference frame of observation                 VELOSYS =                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRC = 'LSRK    '           / Reference frame of source redshift             ZSOURCE =               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2  =                    1                                                  CDELT2  =                  1.0                                                  CTYPE2  = 'RA      '                                                            CRVAL2  =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2  = 'deg     '                                                            COMMENT                                                                         CRPIX3  =                    1                                                  CDELT3  =                  1.0                                                  CTYPE3  = 'DEC     '                                                            CRVAL3  =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3  = 'deg     '                                                            COMMENT                                                                         RADESYS = 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOX =               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4  =                    1                                                  CDELT4  =                  1.0                                                  CTYPE4  = 'STOKES  '                                                            CRVAL4  =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ---------------------------------------------- Relativistic beta (v/c)  COMMENT                                                                         CRPIX1B =              32768.0 / Pixel coordinate of reference point            CTYPE1B = 'BETA    '           / Relativistic beta (v/c), non-linear axis       CRVAL1B =       7.322161766E-2 / [] Relativistic beta of reference channel      CDELT1B =       2.441475578E-6 / [] Channel spacing                             COMMENT                                                                         RESTFRQB=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVB=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSB= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSB= 'TOPOCENT'           / Reference frame of observation                 VELOSYSB=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCB= 'LSRK    '           / Reference frame of source redshift             ZSOURCEB=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2B =                    1                                                  CDELT2B =                  1.0                                                  CTYPE2B = 'RA      '                                                            CRVAL2B =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2B = 'deg     '                                                            COMMENT                                                                         CRPIX3B =                    1                                                  CDELT3B =                  1.0                                                  CTYPE3B = 'DEC     '                                                            CRVAL3B =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3B = 'deg     '                                                            COMMENT                                                                         RADESYSB= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXB=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4B =                    1                                                  CDELT4B =                  1.0                                                  CTYPE4B = 'STOKES  '                                                            CRVAL4B =                    1 / Stokes I (total intensity)                     COMMENT                                                                         HISTORY fimgcreate 1.0b at 2009-04-22T04:28:33                                  DATE    = '2009-04-22T04:28:33' / file creation date (YYYY-MM-DDThh:mm:ss UT)   "},{"id":7677,"name":"orion-velo-1.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/spectra","text":"SIMPLE  =                    T / file does conform to FITS standard             BITPIX  =                  -32 / number of bits per data pixel                  NAXIS   =                    1 / number of data axes                            NAXIS1  =                 4096 / length of data axis 1                          EXTEND  =                    T / FITS dataset may contain extensions            COMMENT   FITS (Flexible Image Transport System) format is defined in 'AstronomyCOMMENT   and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H COMMENT                                                                         COMMENT This FITS file contains an example spectral WCS header constructed by   COMMENT Mark Calabretta (ATNF) and Dirk Petry (ESO) based on an observation     COMMENT of the Orion Kleinmann-Low nebula made by Andrew Walsh (JCU) and        COMMENT Sven Thorwirth (MPIfR) using the Mopra radio telescope.                 COMMENT                                                                         COMMENT The 110GHz 13CO 1-0 spectrum in this file is linear in relativistic     COMMENT velocity having been regridded from a linear frequency axis, as         COMMENT observed.                                                               COMMENT                                                                         COMMENT The reference pixel has been placed deliberately well outside the       COMMENT the spectrum in order to test spectral-WCS-interpreting software.       COMMENT                                                                         COMMENT Spectral representations are:                                           COMMENT   F: Frequency                          ...frequency-like               COMMENT   E: Photon energy                      ...frequency-like               COMMENT   N: Wave number                        ...frequency-like               COMMENT   R: Radio velocity                     ...frequency-like               COMMENT   W: Wavelength                         ...wavelength-like              COMMENT   O: Optical velocity                   ...wavelength-like              COMMENT   Z: Redshift                           ...wavelength-like              COMMENT      Relativistic velocity (default)    ...velocity-like                COMMENT   B: Relativistic beta                  ...velocity-like                COMMENT                                                                         COMMENT The Mopra radio telescope is operated by the Australia Telescope        COMMENT National Facility.                                                      COMMENT                                                                         COMMENT Author: Mark Calabretta, Australia Telescope National Facility          COMMENT http://www.atnf.csiro.au/~mcalabre/index.html                           COMMENT 2009-04-22                                                              COMMENT ----------------------------------------------------------------------  COMMENT                                                                         OBJECT  = 'Orion-KL'           / Orion Kleinmann-Low nebula                     MOLECULE= '13CO    '           / Carbon(13) monoxide                            TRANSITI= '1-0     '           / 1-0 transition                                 DATE-OBS= '2006-07-09T20:29:00' / Date of observation                           TELESCOP= 'ATNF Mopra'         / 22m mm-wave telescope                          OBSERVER= 'Walsh/Thorwirth'    / Observers                                      BUNIT   = 'K       '           / Brightness units, Kelvin                       COMMENT                                                                         COMMENT ------------------------------------------------------------ Frequency  COMMENT                                                                         CRPIX1F =              32768.0 / Pixel coordinate of reference point            CTYPE1F = 'FREQ-V2F'           / Frequency, non-linear axis                     CRVAL1F =       102.4071237E+9 / [Hz] Frequency of reference channel            CDELT1F =      -2.513721996E+5 / [Hz] Channel spacing                           CUNIT1F = 'Hz      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQF=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVF=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSF= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSF= 'TOPOCENT'           / Reference frame of observation                 VELOSYSF=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCF= 'LSRK    '           / Reference frame of source redshift             ZSOURCEF=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2F =                    1                                                  CDELT2F =                  1.0                                                  CTYPE2F = 'RA      '                                                            CRVAL2F =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2F = 'deg     '                                                            COMMENT                                                                         CRPIX3F =                    1                                                  CDELT3F =                  1.0                                                  CTYPE3F = 'DEC     '                                                            CRVAL3F =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3F = 'deg     '                                                            COMMENT                                                                         RADESYSF= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXF=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4F =                    1                                                  CDELT4F =                  1.0                                                  CTYPE4F = 'STOKES  '                                                            CRVAL4F =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT -------------------------------------------------------- Photon energy  COMMENT                                                                         CRPIX1E =              32768.0 / Pixel coordinate of reference point            CTYPE1E = 'ENER-V2F'           / Photon energy, non-linear axis                 CRVAL1E =       4.235222141E-4 / [eV] Photon energy of reference channel        CDELT1E =      -1.039592821E-9 / [eV] Channel spacing                           CUNIT1E = 'eV      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQE=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVE=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSE= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSE= 'TOPOCENT'           / Reference frame of observation                 VELOSYSE=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCE= 'LSRK    '           / Reference frame of source redshift             ZSOURCEE=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2E =                    1                                                  CDELT2E =                  1.0                                                  CTYPE2E = 'RA      '                                                            CRVAL2E =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2E = 'deg     '                                                            COMMENT                                                                         CRPIX3E =                    1                                                  CDELT3E =                  1.0                                                  CTYPE3E = 'DEC     '                                                            CRVAL3E =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3E = 'deg     '                                                            COMMENT                                                                         RADESYSE= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXE=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4E =                    1                                                  CDELT4E =                  1.0                                                  CTYPE4E = 'STOKES  '                                                            CRVAL4E =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ---------------------------------------------------------- Wave number  COMMENT                                                                         CRPIX1N =              32768.0 / Pixel coordinate of reference point            CTYPE1N = 'WAVN-V2F'           / Wave number, non-linear axis                   CRVAL1N =       3.415933955E+2 / [/m] Wave number of reference channel          CDELT1N =      -8.384874032E-4 / [/m] Channel spacing                           CUNIT1N = '/m      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQN=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVN=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSN= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSN= 'TOPOCENT'           / Reference frame of observation                 VELOSYSN=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCN= 'LSRK    '           / Reference frame of source redshift             ZSOURCEN=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2N =                    1                                                  CDELT2N =                  1.0                                                  CTYPE2N = 'RA      '                                                            CRVAL2N =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2N = 'deg     '                                                            COMMENT                                                                         CRPIX3N =                    1                                                  CDELT3N =                  1.0                                                  CTYPE3N = 'DEC     '                                                            CRVAL3N =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3N = 'deg     '                                                            COMMENT                                                                         RADESYSN= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXN=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4N =                    1                                                  CDELT4N =                  1.0                                                  CTYPE4N = 'STOKES  '                                                            CRVAL4N =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------------- Radio velocity  COMMENT                                                                         CRPIX1R =              32768.0 / Pixel coordinate of reference point            CTYPE1R = 'VRAD-V2F'           / Radio velocity, non-linear axis                CRVAL1R =       2.120347082E+7 / [m/s] Radio velocity of reference channel      CDELT1R =       6.838345224E+2 / [m/s] Channel spacing                          CUNIT1R = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQR=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVR=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSR= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSR= 'TOPOCENT'           / Reference frame of observation                 VELOSYSR=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCR= 'LSRK    '           / Reference frame of source redshift             ZSOURCER=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2R =                    1                                                  CDELT2R =                  1.0                                                  CTYPE2R = 'RA      '                                                            CRVAL2R =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2R = 'deg     '                                                            COMMENT                                                                         CRPIX3R =                    1                                                  CDELT3R =                  1.0                                                  CTYPE3R = 'DEC     '                                                            CRVAL3R =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3R = 'deg     '                                                            COMMENT                                                                         RADESYSR= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXR=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4R =                    1                                                  CDELT4R =                  1.0                                                  CTYPE4R = 'STOKES  '                                                            CRVAL4R =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ----------------------------------------------------------- Wavelength  COMMENT                                                                         CRPIX1W =              32768.0 / Pixel coordinate of reference point            CTYPE1W = 'WAVE-V2W'           / Wavelength in vacuuo, linear axis              CRVAL1W =       2.927457068E-3 / [m] Wavelength of reference channel            CDELT1W =       7.185841143E-9 / [m] Channel spacing                            CUNIT1W = 'm       '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQW=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVW=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSW= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSW= 'TOPOCENT'           / Reference frame of observation                 VELOSYSW=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCW= 'LSRK    '           / Reference frame of source redshift             ZSOURCEW=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2W =                    1                                                  CDELT2W =                  1.0                                                  CTYPE2W = 'RA      '                                                            CRVAL2W =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2W = 'deg     '                                                            COMMENT                                                                         CRPIX3W =                    1                                                  CDELT3W =                  1.0                                                  CTYPE3W = 'DEC     '                                                            CRVAL3W =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3W = 'deg     '                                                            COMMENT                                                                         RADESYSW= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXW=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4W =                    1                                                  CDELT4W =                  1.0                                                  CTYPE4W = 'STOKES  '                                                            CRVAL4W =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ----------------------------------------------------- Optical velocity  COMMENT                                                                         CRPIX1O =              32768.0 / Pixel coordinate of reference point            CTYPE1O = 'VOPT-V2W'           / Optical velocity, linear axis                  CRVAL1O =       2.281727178E+7 / [m/s] Optical velocity of reference channel    CDELT1O =       7.918894164E+2 / [m/s] Channel spacing                          CUNIT1O = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQO=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVO=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSO= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSO= 'TOPOCENT'           / Reference frame of observation                 VELOSYSO=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCO= 'LSRK    '           / Reference frame of source redshift             ZSOURCEO=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2O =                    1                                                  CDELT2O =                  1.0                                                  CTYPE2O = 'RA      '                                                            CRVAL2O =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2O = 'deg     '                                                            COMMENT                                                                         CRPIX3O =                    1                                                  CDELT3O =                  1.0                                                  CTYPE3O = 'DEC     '                                                            CRVAL3O =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3O = 'deg     '                                                            COMMENT                                                                         RADESYSO= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXO=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4O =                    1                                                  CDELT4O =                  1.0                                                  CTYPE4O = 'STOKES  '                                                            CRVAL4O =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------------------- Redshift  COMMENT                                                                         CRPIX1Z =              32768.0 / Pixel coordinate of reference point            CTYPE1Z = 'ZOPT-V2W'           / Redshift, linear axis                          CRVAL1Z =       7.611022615E-2 / [] Redshift of reference channel               CDELT1Z =       2.641458767E-6 / [] Channel spacing                             COMMENT                                                                         RESTFRQZ=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVZ=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSZ= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSZ= 'TOPOCENT'           / Reference frame of observation                 VELOSYSZ=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCZ= 'LSRK    '           / Reference frame of source redshift             ZSOURCEZ=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2Z =                    1                                                  CDELT2Z =                  1.0                                                  CTYPE2Z = 'RA      '                                                            CRVAL2Z =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2Z = 'deg     '                                                            COMMENT                                                                         CRPIX3Z =                    1                                                  CDELT3Z =                  1.0                                                  CTYPE3Z = 'DEC     '                                                            CRVAL3Z =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3Z = 'deg     '                                                            COMMENT                                                                         RADESYSZ= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXZ=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4Z =                    1                                                  CDELT4Z =                  1.0                                                  CTYPE4Z = 'STOKES  '                                                            CRVAL4Z =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------ Relativistic velocity  COMMENT                                                                         CRPIX1  =              32768.0 / Pixel coordinate of reference point            CTYPE1  = 'VELO    '           / Relativistic velocity, non-linear axis         CRVAL1  =       2.195128874E+7 / [m/s] Velocity of reference channel            CDELT1  =       7.319359645E+2 / [m/s] Channel spacing                          CUNIT1  = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQ =       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAV =        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYS = 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBS = 'TOPOCENT'           / Reference frame of observation                 VELOSYS =                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRC = 'LSRK    '           / Reference frame of source redshift             ZSOURCE =               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2  =                    1                                                  CDELT2  =                  1.0                                                  CTYPE2  = 'RA      '                                                            CRVAL2  =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2  = 'deg     '                                                            COMMENT                                                                         CRPIX3  =                    1                                                  CDELT3  =                  1.0                                                  CTYPE3  = 'DEC     '                                                            CRVAL3  =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3  = 'deg     '                                                            COMMENT                                                                         RADESYS = 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOX =               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4  =                    1                                                  CDELT4  =                  1.0                                                  CTYPE4  = 'STOKES  '                                                            CRVAL4  =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ---------------------------------------------- Relativistic beta (v/c)  COMMENT                                                                         CRPIX1B =              32768.0 / Pixel coordinate of reference point            CTYPE1B = 'BETA    '           / Relativistic beta (v/c), non-linear axis       CRVAL1B =       7.322161766E-2 / [] Relativistic beta of reference channel      CDELT1B =       2.441475578E-6 / [] Channel spacing                             COMMENT                                                                         RESTFRQB=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVB=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSB= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSB= 'TOPOCENT'           / Reference frame of observation                 VELOSYSB=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCB= 'LSRK    '           / Reference frame of source redshift             ZSOURCEB=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2B =                    1                                                  CDELT2B =                  1.0                                                  CTYPE2B = 'RA      '                                                            CRVAL2B =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2B = 'deg     '                                                            COMMENT                                                                         CRPIX3B =                    1                                                  CDELT3B =                  1.0                                                  CTYPE3B = 'DEC     '                                                            CRVAL3B =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3B = 'deg     '                                                            COMMENT                                                                         RADESYSB= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXB=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4B =                    1                                                  CDELT4B =                  1.0                                                  CTYPE4B = 'STOKES  '                                                            CRVAL4B =                    1 / Stokes I (total intensity)                     COMMENT                                                                         HISTORY fimgcreate 1.0b at 2009-04-22T04:28:25                                  DATE    = '2009-04-22T04:28:25' / file creation date (YYYY-MM-DDThh:mm:ss UT)   "},{"id":7678,"name":"orion-wave-4.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/spectra","text":"SIMPLE  =                    T / file does conform to FITS standard             BITPIX  =                  -32 / number of bits per data pixel                  NAXIS   =                    4 / number of data axes                            NAXIS1  =                 4096 / length of data axis 1                          NAXIS2  =                    1 / length of data axis 2                          NAXIS3  =                    1 / length of data axis 3                          NAXIS4  =                    1 / length of data axis 4                          EXTEND  =                    T / FITS dataset may contain extensions            COMMENT   FITS (Flexible Image Transport System) format is defined in 'AstronomyCOMMENT   and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H COMMENT                                                                         COMMENT This FITS file contains an example spectral WCS header constructed by   COMMENT Mark Calabretta (ATNF) and Dirk Petry (ESO) based on an observation     COMMENT of the Orion Kleinmann-Low nebula made by Andrew Walsh (JCU) and        COMMENT Sven Thorwirth (MPIfR) using the Mopra radio telescope.                 COMMENT                                                                         COMMENT The 110GHz 13CO 1-0 spectrum in this file is linear in wavelength,      COMMENT having been regridded from a linear frequency axis, as observed.        COMMENT                                                                         COMMENT The reference pixel has been placed deliberately well outside the       COMMENT the spectrum in order to test spectral-WCS-interpreting software.       COMMENT                                                                         COMMENT Spectral representations are:                                           COMMENT   F: Frequency                          ...frequency-like               COMMENT   E: Photon energy                      ...frequency-like               COMMENT   N: Wave number                        ...frequency-like               COMMENT   R: Radio velocity                     ...frequency-like               COMMENT      Wavelength (default)               ...wavelength-like              COMMENT   O: Optical velocity                   ...wavelength-like              COMMENT   Z: Redshift                           ...wavelength-like              COMMENT   V: Relativistic velocity              ...velocity-like                COMMENT   B: Relativistic beta                  ...velocity-like                COMMENT                                                                         COMMENT The Mopra radio telescope is operated by the Australia Telescope        COMMENT National Facility.                                                      COMMENT                                                                         COMMENT Author: Mark Calabretta, Australia Telescope National Facility          COMMENT http://www.atnf.csiro.au/~mcalabre/index.html                           COMMENT 2009-04-22                                                              COMMENT ----------------------------------------------------------------------  COMMENT                                                                         OBJECT  = 'Orion-KL'           / Orion Kleinmann-Low nebula                     MOLECULE= '13CO    '           / Carbon(13) monoxide                            TRANSITI= '1-0     '           / 1-0 transition                                 DATE-OBS= '2006-07-09T20:29:00' / Date of observation                           TELESCOP= 'ATNF Mopra'         / 22m mm-wave telescope                          OBSERVER= 'Walsh/Thorwirth'    / Observers                                      BUNIT   = 'K       '           / Brightness units, Kelvin                       COMMENT                                                                         COMMENT ------------------------------------------------------------ Frequency  COMMENT                                                                         CRPIX1F =              32768.0 / Pixel coordinate of reference point            CTYPE1F = 'FREQ-W2F'           / Frequency, non-linear axis                     CRVAL1F =       102.6940613E+9 / [Hz] Frequency of reference channel            CDELT1F =      -2.332330873E+5 / [Hz] Channel spacing                           CUNIT1F = 'Hz      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQF=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVF=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSF= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSF= 'TOPOCENT'           / Reference frame of observation                 VELOSYSF=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCF= 'LSRK    '           / Reference frame of source redshift             ZSOURCEF=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2F =                    1                                                  CDELT2F =                  1.0                                                  CTYPE2F = 'RA      '                                                            CRVAL2F =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2F = 'deg     '                                                            COMMENT                                                                         CRPIX3F =                    1                                                  CDELT3F =                  1.0                                                  CTYPE3F = 'DEC     '                                                            CRVAL3F =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3F = 'deg     '                                                            COMMENT                                                                         RADESYSF= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXF=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4F =                    1                                                  CDELT4F =                  1.0                                                  CTYPE4F = 'STOKES  '                                                            CRVAL4F =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT -------------------------------------------------------- Photon energy  COMMENT                                                                         CRPIX1E =              32768.0 / Pixel coordinate of reference point            CTYPE1E = 'ENER-W2F'           / Photon energy, non-linear axis                 CRVAL1E =       4.247088937E-4 / [eV] Photon energy of reference channel        CDELT1E =     -0.9645754124E-9 / [eV] Channel spacing                           CUNIT1E = 'eV      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQE=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVE=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSE= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSE= 'TOPOCENT'           / Reference frame of observation                 VELOSYSE=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCE= 'LSRK    '           / Reference frame of source redshift             ZSOURCEE=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2E =                    1                                                  CDELT2E =                  1.0                                                  CTYPE2E = 'RA      '                                                            CRVAL2E =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2E = 'deg     '                                                            COMMENT                                                                         CRPIX3E =                    1                                                  CDELT3E =                  1.0                                                  CTYPE3E = 'DEC     '                                                            CRVAL3E =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3E = 'deg     '                                                            COMMENT                                                                         RADESYSE= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXE=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4E =                    1                                                  CDELT4E =                  1.0                                                  CTYPE4E = 'STOKES  '                                                            CRVAL4E =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ---------------------------------------------------------- Wave number  COMMENT                                                                         CRPIX1N =              32768.0 / Pixel coordinate of reference point            CTYPE1N = 'WAVN-W2F'           / Wave number, non-linear axis                   CRVAL1N =       3.425505162E+2 / [/m] Wave number of reference channel          CDELT1N =      -7.779818375E-4 / [/m] Channel spacing                           CUNIT1N = '/m      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQN=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVN=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSN= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSN= 'TOPOCENT'           / Reference frame of observation                 VELOSYSN=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCN= 'LSRK    '           / Reference frame of source redshift             ZSOURCEN=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2N =                    1                                                  CDELT2N =                  1.0                                                  CTYPE2N = 'RA      '                                                            CRVAL2N =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2N = 'deg     '                                                            COMMENT                                                                         CRPIX3N =                    1                                                  CDELT3N =                  1.0                                                  CTYPE3N = 'DEC     '                                                            CRVAL3N =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3N = 'deg     '                                                            COMMENT                                                                         RADESYSN= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXN=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4N =                    1                                                  CDELT4N =                  1.0                                                  CTYPE4N = 'STOKES  '                                                            CRVAL4N =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------------- Radio velocity  COMMENT                                                                         CRPIX1R =              32768.0 / Pixel coordinate of reference point            CTYPE1R = 'VRAD-W2F'           / Radio velocity, non-linear axis                CRVAL1R =       2.042288396E+7 / [m/s] Radio velocity of reference channel      CDELT1R =       6.344887666E+2 / [m/s] Channel spacing                          CUNIT1R = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQR=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVR=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSR= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSR= 'TOPOCENT'           / Reference frame of observation                 VELOSYSR=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCR= 'LSRK    '           / Reference frame of source redshift             ZSOURCER=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2R =                    1                                                  CDELT2R =                  1.0                                                  CTYPE2R = 'RA      '                                                            CRVAL2R =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2R = 'deg     '                                                            COMMENT                                                                         CRPIX3R =                    1                                                  CDELT3R =                  1.0                                                  CTYPE3R = 'DEC     '                                                            CRVAL3R =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3R = 'deg     '                                                            COMMENT                                                                         RADESYSR= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXR=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4R =                    1                                                  CDELT4R =                  1.0                                                  CTYPE4R = 'STOKES  '                                                            CRVAL4R =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ----------------------------------------------------------- Wavelength  COMMENT                                                                         CRPIX1  =              32768.0 / Pixel coordinate of reference point            CTYPE1  = 'WAVE    '           / Wavelength in vacuuo, linear axis              CRVAL1  =       2.919277457E-3 / [m] Wavelength of reference channel            CDELT1  =       6.630101933E-9 / [m] Channel spacing                            CUNIT1  = 'm       '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQ =       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAV =        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYS = 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBS = 'TOPOCENT'           / Reference frame of observation                 VELOSYS =                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRC = 'LSRK    '           / Reference frame of source redshift             ZSOURCE =               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2  =                    1                                                  CDELT2  =                  1.0                                                  CTYPE2  = 'RA      '                                                            CRVAL2  =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2  = 'deg     '                                                            COMMENT                                                                         CRPIX3  =                    1                                                  CDELT3  =                  1.0                                                  CTYPE3  = 'DEC     '                                                            CRVAL3  =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3  = 'deg     '                                                            COMMENT                                                                         RADESYS = 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOX =               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4  =                    1                                                  CDELT4  =                  1.0                                                  CTYPE4  = 'STOKES  '                                                            CRVAL4  =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ----------------------------------------------------- Optical velocity  COMMENT                                                                         CRPIX1O =              32768.0 / Pixel coordinate of reference point            CTYPE1O = 'VOPT    '           / Optical velocity, linear axis                  CRVAL1O =       2.191586755E+7 / [m/s] Optical velocity of reference channel    CDELT1O =       7.306462036E+2 / [m/s] Channel spacing                          CUNIT1O = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQO=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVO=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSO= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSO= 'TOPOCENT'           / Reference frame of observation                 VELOSYSO=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCO= 'LSRK    '           / Reference frame of source redshift             ZSOURCEO=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2O =                    1                                                  CDELT2O =                  1.0                                                  CTYPE2O = 'RA      '                                                            CRVAL2O =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2O = 'deg     '                                                            COMMENT                                                                         CRPIX3O =                    1                                                  CDELT3O =                  1.0                                                  CTYPE3O = 'DEC     '                                                            CRVAL3O =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3O = 'deg     '                                                            COMMENT                                                                         RADESYSO= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXO=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4O =                    1                                                  CDELT4O =                  1.0                                                  CTYPE4O = 'STOKES  '                                                            CRVAL4O =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------------------- Redshift  COMMENT                                                                         CRPIX1Z =              32768.0 / Pixel coordinate of reference point            CTYPE1Z = 'ZOPT    '           / Redshift, linear axis                          CRVAL1Z =       7.310346531E-2 / [] Redshift of reference channel               CDELT1Z =       2.437173398E-6 / [] Channel spacing                             COMMENT                                                                         RESTFRQZ=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVZ=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSZ= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSZ= 'TOPOCENT'           / Reference frame of observation                 VELOSYSZ=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCZ= 'LSRK    '           / Reference frame of source redshift             ZSOURCEZ=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2Z =                    1                                                  CDELT2Z =                  1.0                                                  CTYPE2Z = 'RA      '                                                            CRVAL2Z =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2Z = 'deg     '                                                            COMMENT                                                                         CRPIX3Z =                    1                                                  CDELT3Z =                  1.0                                                  CTYPE3Z = 'DEC     '                                                            CRVAL3Z =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3Z = 'deg     '                                                            COMMENT                                                                         RADESYSZ= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXZ=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4Z =                    1                                                  CDELT4Z =                  1.0                                                  CTYPE4Z = 'STOKES  '                                                            CRVAL4Z =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------ Relativistic velocity  COMMENT                                                                         CRPIX1V =              32768.0 / Pixel coordinate of reference point            CTYPE1V = 'VELO-W2V'           / Relativistic velocity, non-linear axis         CRVAL1V =       2.111679434E+7 / [m/s] Velocity of reference channel            CDELT1V =       6.774939349E+2 / [m/s] Channel spacing                          CUNIT1V = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQV=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVV=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSV= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSV= 'TOPOCENT'           / Reference frame of observation                 VELOSYSV=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCV= 'LSRK    '           / Reference frame of source redshift             ZSOURCEV=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2V =                    1                                                  CDELT2V =                  1.0                                                  CTYPE2V = 'RA      '                                                            CRVAL2V =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2V = 'deg     '                                                            COMMENT                                                                         CRPIX3V =                    1                                                  CDELT3V =                  1.0                                                  CTYPE3V = 'DEC     '                                                            CRVAL3V =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3V = 'deg     '                                                            COMMENT                                                                         RADESYSV= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXV=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4V =                    1                                                  CDELT4V =                  1.0                                                  CTYPE4V = 'STOKES  '                                                            CRVAL4V =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ---------------------------------------------- Relativistic beta (v/c)  COMMENT                                                                         CRPIX1B =              32768.0 / Pixel coordinate of reference point            CTYPE1B = 'BETA-W2V'           / Relativistic beta (v/c), non-linear axis       CRVAL1B =       7.043804396E-2 / [] Relativistic beta of reference channel      CDELT1B =       2.259876514E-6 / [] Channel spacing                             COMMENT                                                                         RESTFRQB=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVB=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSB= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSB= 'TOPOCENT'           / Reference frame of observation                 VELOSYSB=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCB= 'LSRK    '           / Reference frame of source redshift             ZSOURCEB=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2B =                    1                                                  CDELT2B =                  1.0                                                  CTYPE2B = 'RA      '                                                            CRVAL2B =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2B = 'deg     '                                                            COMMENT                                                                         CRPIX3B =                    1                                                  CDELT3B =                  1.0                                                  CTYPE3B = 'DEC     '                                                            CRVAL3B =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3B = 'deg     '                                                            COMMENT                                                                         RADESYSB= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXB=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4B =                    1                                                  CDELT4B =                  1.0                                                  CTYPE4B = 'STOKES  '                                                            CRVAL4B =                    1 / Stokes I (total intensity)                     COMMENT                                                                         HISTORY fimgcreate 1.0b at 2009-04-22T04:28:18                                  DATE    = '2009-04-22T04:28:18' / file creation date (YYYY-MM-DDThh:mm:ss UT)   "},{"id":7679,"name":"astropy/wcs/wcsapi","nodeType":"Package"},{"fileName":"high_level_api.py","filePath":"astropy/wcs/wcsapi","id":7680,"nodeType":"File","text":"import abc\nfrom collections import defaultdict, OrderedDict\n\nimport numpy as np\n\nfrom .utils import deserialize_class\n\n__all__ = ['BaseHighLevelWCS', 'HighLevelWCSMixin']\n\n\ndef rec_getattr(obj, att):\n    for a in att.split('.'):\n        obj = getattr(obj, a)\n    return obj\n\n\ndef default_order(components):\n    order = []\n    for key, _, _ in components:\n        if key not in order:\n            order.append(key)\n    return order\n\n\ndef _toindex(value):\n    \"\"\"\n    Convert value to an int or an int array.\n    Input coordinates converted to integers\n    corresponding to the center of the pixel.\n    The convention is that the center of the pixel is\n    (0, 0), while the lower left corner is (-0.5, -0.5).\n    The outputs are used to index the mask.\n    Examples\n    --------\n    >>> _toindex(np.array([-0.5, 0.49999]))\n    array([0, 0])\n    >>> _toindex(np.array([0.5, 1.49999]))\n    array([1, 1])\n    >>> _toindex(np.array([1.5, 2.49999]))\n    array([2, 2])\n    \"\"\"\n    indx = np.asarray(np.floor(np.asarray(value) + 0.5), dtype=int)\n    return indx\n\n\nclass BaseHighLevelWCS(metaclass=abc.ABCMeta):\n    \"\"\"\n    Abstract base class for the high-level WCS interface.\n\n    This is described in `APE 14: A shared Python interface for World Coordinate\n    Systems <https://doi.org/10.5281/zenodo.1188875>`_.\n    \"\"\"\n\n    @property\n    @abc.abstractmethod\n    def low_level_wcs(self):\n        \"\"\"\n        Returns a reference to the underlying low-level WCS object.\n        \"\"\"\n\n    @abc.abstractmethod\n    def pixel_to_world(self, *pixel_arrays):\n        \"\"\"\n        Convert pixel coordinates to world coordinates (represented by\n        high-level objects).\n\n        If a single high-level object is used to represent the world coordinates\n        (i.e., if ``len(wcs.world_axis_object_classes) == 1``), it is returned\n        as-is (not in a tuple/list), otherwise a tuple of high-level objects is\n        returned. See\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values` for pixel\n        indexing and ordering conventions.\n        \"\"\"\n\n    def array_index_to_world(self, *index_arrays):\n        \"\"\"\n        Convert array indices to world coordinates (represented by Astropy\n        objects).\n\n        If a single high-level object is used to represent the world coordinates\n        (i.e., if ``len(wcs.world_axis_object_classes) == 1``), it is returned\n        as-is (not in a tuple/list), otherwise a tuple of high-level objects is\n        returned. See\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.array_index_to_world_values` for\n        pixel indexing and ordering conventions.\n        \"\"\"\n        return self.pixel_to_world(*index_arrays[::-1])\n\n    @abc.abstractmethod\n    def world_to_pixel(self, *world_objects):\n        \"\"\"\n        Convert world coordinates (represented by Astropy objects) to pixel\n        coordinates.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned. See\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_to_pixel_values` for pixel\n        indexing and ordering conventions.\n        \"\"\"\n\n    def world_to_array_index(self, *world_objects):\n        \"\"\"\n        Convert world coordinates (represented by Astropy objects) to array\n        indices.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned. See\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_to_array_index_values` for\n        pixel indexing and ordering conventions. The indices should be returned\n        as rounded integers.\n        \"\"\"\n        if self.pixel_n_dim == 1:\n            return _toindex(self.world_to_pixel(*world_objects))\n        else:\n            return tuple(_toindex(self.world_to_pixel(*world_objects)[::-1]).tolist())\n\n\ndef high_level_objects_to_values(*world_objects, low_level_wcs):\n    \"\"\"\n    Convert the input high level object to low level values.\n\n    This function uses the information in ``wcs.world_axis_object_classes`` and\n    ``wcs.world_axis_object_components`` to convert the high level objects\n    (such as `~.SkyCoord`) to low level \"values\" `~.Quantity` objects.\n\n    This is used in `.HighLevelWCSMixin.world_to_pixel`, but provided as a\n    separate function for use in other places where needed.\n\n    Parameters\n    ----------\n    *world_objects: object\n        High level coordinate objects.\n\n    low_level_wcs: `.BaseLowLevelWCS`\n        The WCS object to use to interpret the coordinates.\n    \"\"\"\n    # Cache the classes and components since this may be expensive\n    serialized_classes = low_level_wcs.world_axis_object_classes\n    components = low_level_wcs.world_axis_object_components\n\n    # Deserialize world_axis_object_classes using the default order\n    classes = OrderedDict()\n    for key in default_order(components):\n        if low_level_wcs.serialized_classes:\n            classes[key] = deserialize_class(serialized_classes[key],\n                                             construct=False)\n        else:\n            classes[key] = serialized_classes[key]\n\n    # Check that the number of classes matches the number of inputs\n    if len(world_objects) != len(classes):\n        raise ValueError(\"Number of world inputs ({}) does not match \"\n                         \"expected ({})\".format(len(world_objects), len(classes)))\n\n    # Determine whether the classes are uniquely matched, that is we check\n    # whether there is only one of each class.\n    world_by_key = {}\n    unique_match = True\n    for w in world_objects:\n        matches = []\n        for key, (klass, *_) in classes.items():\n            if isinstance(w, klass):\n                matches.append(key)\n        if len(matches) == 1:\n            world_by_key[matches[0]] = w\n        else:\n            unique_match = False\n            break\n\n    # If the match is not unique, the order of the classes needs to match,\n    # whereas if all classes are unique, we can still intelligently match\n    # them even if the order is wrong.\n\n    objects = {}\n\n    if unique_match:\n\n        for key, (klass, args, kwargs, *rest) in classes.items():\n\n            if len(rest) == 0:\n                klass_gen = klass\n            elif len(rest) == 1:\n                klass_gen = rest[0]\n            else:\n                raise ValueError(\"Tuples in world_axis_object_classes should have length 3 or 4\")\n\n            # FIXME: For now SkyCoord won't auto-convert upon initialization\n            # https://github.com/astropy/astropy/issues/7689\n            from astropy.coordinates import SkyCoord\n            if isinstance(world_by_key[key], SkyCoord):\n                if 'frame' in kwargs:\n                    objects[key] = world_by_key[key].transform_to(kwargs['frame'])\n                else:\n                    objects[key] = world_by_key[key]\n            else:\n                objects[key] = klass_gen(world_by_key[key], *args, **kwargs)\n\n    else:\n\n        for ikey, key in enumerate(classes):\n\n            klass, args, kwargs, *rest = classes[key]\n\n            if len(rest) == 0:\n                klass_gen = klass\n            elif len(rest) == 1:\n                klass_gen = rest[0]\n            else:\n                raise ValueError(\"Tuples in world_axis_object_classes should have length 3 or 4\")\n\n            w = world_objects[ikey]\n            if not isinstance(w, klass):\n                raise ValueError(\"Expected the following order of world \"\n                                 \"arguments: {}\".format(', '.join([k.__name__ for (k, _, _) in classes.values()])))\n\n            # FIXME: For now SkyCoord won't auto-convert upon initialization\n            # https://github.com/astropy/astropy/issues/7689\n            from astropy.coordinates import SkyCoord\n            if isinstance(w, SkyCoord):\n                if 'frame' in kwargs:\n                    objects[key] = w.transform_to(kwargs['frame'])\n                else:\n                    objects[key] = w\n            else:\n                objects[key] = klass_gen(w, *args, **kwargs)\n\n    # We now extract the attributes needed for the world values\n    world = []\n    for key, _, attr in components:\n        if callable(attr):\n            world.append(attr(objects[key]))\n        else:\n            world.append(rec_getattr(objects[key], attr))\n\n    return world\n\n\ndef values_to_high_level_objects(*world_values, low_level_wcs):\n    \"\"\"\n    Convert low level values into high level objects.\n\n    This function uses the information in ``wcs.world_axis_object_classes`` and\n    ``wcs.world_axis_object_components`` to convert low level \"values\"\n    `~.Quantity` objects, to high level objects (such as `~.SkyCoord).\n\n    This is used in `.HighLevelWCSMixin.pixel_to_world`, but provided as a\n    separate function for use in other places where needed.\n\n    Parameters\n    ----------\n    *world_values: object\n        Low level, \"values\" representations of the world coordinates.\n\n    low_level_wcs: `.BaseLowLevelWCS`\n        The WCS object to use to interpret the coordinates.\n    \"\"\"\n    # Cache the classes and components since this may be expensive\n    components = low_level_wcs.world_axis_object_components\n    classes = low_level_wcs.world_axis_object_classes\n\n    # Deserialize classes\n    if low_level_wcs.serialized_classes:\n        classes_new = {}\n        for key, value in classes.items():\n            classes_new[key] = deserialize_class(value, construct=False)\n        classes = classes_new\n\n    args = defaultdict(list)\n    kwargs = defaultdict(dict)\n\n    for i, (key, attr, _) in enumerate(components):\n        if isinstance(attr, str):\n            kwargs[key][attr] = world_values[i]\n        else:\n            while attr > len(args[key]) - 1:\n                args[key].append(None)\n            args[key][attr] = world_values[i]\n\n    result = []\n\n    for key in default_order(components):\n        klass, ar, kw, *rest = classes[key]\n        if len(rest) == 0:\n            klass_gen = klass\n        elif len(rest) == 1:\n            klass_gen = rest[0]\n        else:\n            raise ValueError(\"Tuples in world_axis_object_classes should have length 3 or 4\")\n        result.append(klass_gen(*args[key], *ar, **kwargs[key], **kw))\n\n    return result\n\n\nclass HighLevelWCSMixin(BaseHighLevelWCS):\n    \"\"\"\n    Mix-in class that automatically provides the high-level WCS API for the\n    low-level WCS object given by the `~HighLevelWCSMixin.low_level_wcs`\n    property.\n    \"\"\"\n\n    @property\n    def low_level_wcs(self):\n        return self\n\n    def world_to_pixel(self, *world_objects):\n\n        world_values = high_level_objects_to_values(*world_objects, low_level_wcs=self.low_level_wcs)\n\n        # Finally we convert to pixel coordinates\n        pixel_values = self.low_level_wcs.world_to_pixel_values(*world_values)\n\n        return pixel_values\n\n    def pixel_to_world(self, *pixel_arrays):\n\n        # Compute the world coordinate values\n        world_values = self.low_level_wcs.pixel_to_world_values(*pixel_arrays)\n\n        if self.world_n_dim == 1:\n            world_values = (world_values,)\n\n        pixel_values = values_to_high_level_objects(*world_values, low_level_wcs=self.low_level_wcs)\n\n        if len(pixel_values) == 1:\n            return pixel_values[0]\n        else:\n            return pixel_values\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":7681,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"col":0,"comment":"","endLoc":1,"header":"high_level_api.py#<anonymous>","id":7682,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"__all__ = ['BaseHighLevelWCS', 'HighLevelWCSMixin']"},{"id":7683,"name":"orion-wave-1.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data/spectra","text":"SIMPLE  =                    T / file does conform to FITS standard             BITPIX  =                  -32 / number of bits per data pixel                  NAXIS   =                    1 / number of data axes                            NAXIS1  =                 4096 / length of data axis 1                          EXTEND  =                    T / FITS dataset may contain extensions            COMMENT   FITS (Flexible Image Transport System) format is defined in 'AstronomyCOMMENT   and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H COMMENT                                                                         COMMENT This FITS file contains an example spectral WCS header constructed by   COMMENT Mark Calabretta (ATNF) and Dirk Petry (ESO) based on an observation     COMMENT of the Orion Kleinmann-Low nebula made by Andrew Walsh (JCU) and        COMMENT Sven Thorwirth (MPIfR) using the Mopra radio telescope.                 COMMENT                                                                         COMMENT The 110GHz 13CO 1-0 spectrum in this file is linear in wavelength,      COMMENT having been regridded from a linear frequency axis, as observed.        COMMENT                                                                         COMMENT The reference pixel has been placed deliberately well outside the       COMMENT the spectrum in order to test spectral-WCS-interpreting software.       COMMENT                                                                         COMMENT Spectral representations are:                                           COMMENT   F: Frequency                          ...frequency-like               COMMENT   E: Photon energy                      ...frequency-like               COMMENT   N: Wave number                        ...frequency-like               COMMENT   R: Radio velocity                     ...frequency-like               COMMENT      Wavelength (default)               ...wavelength-like              COMMENT   O: Optical velocity                   ...wavelength-like              COMMENT   Z: Redshift                           ...wavelength-like              COMMENT   V: Relativistic velocity              ...velocity-like                COMMENT   B: Relativistic beta                  ...velocity-like                COMMENT                                                                         COMMENT The Mopra radio telescope is operated by the Australia Telescope        COMMENT National Facility.                                                      COMMENT                                                                         COMMENT Author: Mark Calabretta, Australia Telescope National Facility          COMMENT http://www.atnf.csiro.au/~mcalabre/index.html                           COMMENT 2009-04-22                                                              COMMENT ----------------------------------------------------------------------  COMMENT                                                                         OBJECT  = 'Orion-KL'           / Orion Kleinmann-Low nebula                     MOLECULE= '13CO    '           / Carbon(13) monoxide                            TRANSITI= '1-0     '           / 1-0 transition                                 DATE-OBS= '2006-07-09T20:29:00' / Date of observation                           TELESCOP= 'ATNF Mopra'         / 22m mm-wave telescope                          OBSERVER= 'Walsh/Thorwirth'    / Observers                                      BUNIT   = 'K       '           / Brightness units, Kelvin                       COMMENT                                                                         COMMENT ------------------------------------------------------------ Frequency  COMMENT                                                                         CRPIX1F =              32768.0 / Pixel coordinate of reference point            CTYPE1F = 'FREQ-W2F'           / Frequency, non-linear axis                     CRVAL1F =       102.6940613E+9 / [Hz] Frequency of reference channel            CDELT1F =      -2.332330873E+5 / [Hz] Channel spacing                           CUNIT1F = 'Hz      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQF=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVF=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSF= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSF= 'TOPOCENT'           / Reference frame of observation                 VELOSYSF=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCF= 'LSRK    '           / Reference frame of source redshift             ZSOURCEF=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2F =                    1                                                  CDELT2F =                  1.0                                                  CTYPE2F = 'RA      '                                                            CRVAL2F =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2F = 'deg     '                                                            COMMENT                                                                         CRPIX3F =                    1                                                  CDELT3F =                  1.0                                                  CTYPE3F = 'DEC     '                                                            CRVAL3F =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3F = 'deg     '                                                            COMMENT                                                                         RADESYSF= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXF=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4F =                    1                                                  CDELT4F =                  1.0                                                  CTYPE4F = 'STOKES  '                                                            CRVAL4F =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT -------------------------------------------------------- Photon energy  COMMENT                                                                         CRPIX1E =              32768.0 / Pixel coordinate of reference point            CTYPE1E = 'ENER-W2F'           / Photon energy, non-linear axis                 CRVAL1E =       4.247088937E-4 / [eV] Photon energy of reference channel        CDELT1E =     -0.9645754124E-9 / [eV] Channel spacing                           CUNIT1E = 'eV      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQE=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVE=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSE= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSE= 'TOPOCENT'           / Reference frame of observation                 VELOSYSE=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCE= 'LSRK    '           / Reference frame of source redshift             ZSOURCEE=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2E =                    1                                                  CDELT2E =                  1.0                                                  CTYPE2E = 'RA      '                                                            CRVAL2E =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2E = 'deg     '                                                            COMMENT                                                                         CRPIX3E =                    1                                                  CDELT3E =                  1.0                                                  CTYPE3E = 'DEC     '                                                            CRVAL3E =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3E = 'deg     '                                                            COMMENT                                                                         RADESYSE= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXE=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4E =                    1                                                  CDELT4E =                  1.0                                                  CTYPE4E = 'STOKES  '                                                            CRVAL4E =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ---------------------------------------------------------- Wave number  COMMENT                                                                         CRPIX1N =              32768.0 / Pixel coordinate of reference point            CTYPE1N = 'WAVN-W2F'           / Wave number, non-linear axis                   CRVAL1N =       3.425505162E+2 / [/m] Wave number of reference channel          CDELT1N =      -7.779818375E-4 / [/m] Channel spacing                           CUNIT1N = '/m      '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQN=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVN=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSN= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSN= 'TOPOCENT'           / Reference frame of observation                 VELOSYSN=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCN= 'LSRK    '           / Reference frame of source redshift             ZSOURCEN=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2N =                    1                                                  CDELT2N =                  1.0                                                  CTYPE2N = 'RA      '                                                            CRVAL2N =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2N = 'deg     '                                                            COMMENT                                                                         CRPIX3N =                    1                                                  CDELT3N =                  1.0                                                  CTYPE3N = 'DEC     '                                                            CRVAL3N =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3N = 'deg     '                                                            COMMENT                                                                         RADESYSN= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXN=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4N =                    1                                                  CDELT4N =                  1.0                                                  CTYPE4N = 'STOKES  '                                                            CRVAL4N =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------------- Radio velocity  COMMENT                                                                         CRPIX1R =              32768.0 / Pixel coordinate of reference point            CTYPE1R = 'VRAD-W2F'           / Radio velocity, non-linear axis                CRVAL1R =       2.042288396E+7 / [m/s] Radio velocity of reference channel      CDELT1R =       6.344887666E+2 / [m/s] Channel spacing                          CUNIT1R = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQR=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVR=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSR= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSR= 'TOPOCENT'           / Reference frame of observation                 VELOSYSR=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCR= 'LSRK    '           / Reference frame of source redshift             ZSOURCER=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2R =                    1                                                  CDELT2R =                  1.0                                                  CTYPE2R = 'RA      '                                                            CRVAL2R =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2R = 'deg     '                                                            COMMENT                                                                         CRPIX3R =                    1                                                  CDELT3R =                  1.0                                                  CTYPE3R = 'DEC     '                                                            CRVAL3R =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3R = 'deg     '                                                            COMMENT                                                                         RADESYSR= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXR=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4R =                    1                                                  CDELT4R =                  1.0                                                  CTYPE4R = 'STOKES  '                                                            CRVAL4R =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ----------------------------------------------------------- Wavelength  COMMENT                                                                         CRPIX1  =              32768.0 / Pixel coordinate of reference point            CTYPE1  = 'WAVE    '           / Wavelength in vacuuo, linear axis              CRVAL1  =       2.919277457E-3 / [m] Wavelength of reference channel            CDELT1  =       6.630101933E-9 / [m] Channel spacing                            CUNIT1  = 'm       '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQ =       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAV =        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYS = 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBS = 'TOPOCENT'           / Reference frame of observation                 VELOSYS =                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRC = 'LSRK    '           / Reference frame of source redshift             ZSOURCE =               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2  =                    1                                                  CDELT2  =                  1.0                                                  CTYPE2  = 'RA      '                                                            CRVAL2  =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2  = 'deg     '                                                            COMMENT                                                                         CRPIX3  =                    1                                                  CDELT3  =                  1.0                                                  CTYPE3  = 'DEC     '                                                            CRVAL3  =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3  = 'deg     '                                                            COMMENT                                                                         RADESYS = 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOX =               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4  =                    1                                                  CDELT4  =                  1.0                                                  CTYPE4  = 'STOKES  '                                                            CRVAL4  =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ----------------------------------------------------- Optical velocity  COMMENT                                                                         CRPIX1O =              32768.0 / Pixel coordinate of reference point            CTYPE1O = 'VOPT    '           / Optical velocity, linear axis                  CRVAL1O =       2.191586755E+7 / [m/s] Optical velocity of reference channel    CDELT1O =       7.306462036E+2 / [m/s] Channel spacing                          CUNIT1O = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQO=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVO=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSO= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSO= 'TOPOCENT'           / Reference frame of observation                 VELOSYSO=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCO= 'LSRK    '           / Reference frame of source redshift             ZSOURCEO=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2O =                    1                                                  CDELT2O =                  1.0                                                  CTYPE2O = 'RA      '                                                            CRVAL2O =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2O = 'deg     '                                                            COMMENT                                                                         CRPIX3O =                    1                                                  CDELT3O =                  1.0                                                  CTYPE3O = 'DEC     '                                                            CRVAL3O =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3O = 'deg     '                                                            COMMENT                                                                         RADESYSO= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXO=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4O =                    1                                                  CDELT4O =                  1.0                                                  CTYPE4O = 'STOKES  '                                                            CRVAL4O =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------------------- Redshift  COMMENT                                                                         CRPIX1Z =              32768.0 / Pixel coordinate of reference point            CTYPE1Z = 'ZOPT    '           / Redshift, linear axis                          CRVAL1Z =       7.310346531E-2 / [] Redshift of reference channel               CDELT1Z =       2.437173398E-6 / [] Channel spacing                             COMMENT                                                                         RESTFRQZ=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVZ=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSZ= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSZ= 'TOPOCENT'           / Reference frame of observation                 VELOSYSZ=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCZ= 'LSRK    '           / Reference frame of source redshift             ZSOURCEZ=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2Z =                    1                                                  CDELT2Z =                  1.0                                                  CTYPE2Z = 'RA      '                                                            CRVAL2Z =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2Z = 'deg     '                                                            COMMENT                                                                         CRPIX3Z =                    1                                                  CDELT3Z =                  1.0                                                  CTYPE3Z = 'DEC     '                                                            CRVAL3Z =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3Z = 'deg     '                                                            COMMENT                                                                         RADESYSZ= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXZ=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4Z =                    1                                                  CDELT4Z =                  1.0                                                  CTYPE4Z = 'STOKES  '                                                            CRVAL4Z =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ------------------------------------------------ Relativistic velocity  COMMENT                                                                         CRPIX1V =              32768.0 / Pixel coordinate of reference point            CTYPE1V = 'VELO-W2V'           / Relativistic velocity, non-linear axis         CRVAL1V =       2.111679434E+7 / [m/s] Velocity of reference channel            CDELT1V =       6.774939349E+2 / [m/s] Channel spacing                          CUNIT1V = 'm/s     '           / Units of coordinate increment and value        COMMENT                                                                         RESTFRQV=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVV=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSV= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSV= 'TOPOCENT'           / Reference frame of observation                 VELOSYSV=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCV= 'LSRK    '           / Reference frame of source redshift             ZSOURCEV=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2V =                    1                                                  CDELT2V =                  1.0                                                  CTYPE2V = 'RA      '                                                            CRVAL2V =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2V = 'deg     '                                                            COMMENT                                                                         CRPIX3V =                    1                                                  CDELT3V =                  1.0                                                  CTYPE3V = 'DEC     '                                                            CRVAL3V =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3V = 'deg     '                                                            COMMENT                                                                         RADESYSV= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXV=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4V =                    1                                                  CDELT4V =                  1.0                                                  CTYPE4V = 'STOKES  '                                                            CRVAL4V =                    1 / Stokes I (total intensity)                     COMMENT                                                                         COMMENT ---------------------------------------------- Relativistic beta (v/c)  COMMENT                                                                         CRPIX1B =              32768.0 / Pixel coordinate of reference point            CTYPE1B = 'BETA-W2V'           / Relativistic beta (v/c), non-linear axis       CRVAL1B =       7.043804396E-2 / [] Relativistic beta of reference channel      CDELT1B =       2.259876514E-6 / [] Channel spacing                             COMMENT                                                                         RESTFRQB=       110201353000.0 / [Hz] 13CO line rest frequency                  RESTWAVB=        0.00272040633 / [m]  13CO line rest wavelength                 SPECSYSB= 'LSRK    '           / Reference frame of spectral coordinates        SSYSOBSB= 'TOPOCENT'           / Reference frame of observation                 VELOSYSB=                  0.0 / [m/s] Bary-topo velocity towards the source    SSYSSRCB= 'LSRK    '           / Reference frame of source redshift             ZSOURCEB=               0.0000 / Redshift of the source                         COMMENT                                                                         CRPIX2B =                    1                                                  CDELT2B =                  1.0                                                  CTYPE2B = 'RA      '                                                            CRVAL2B =             83.81042 / [deg] (05h35m14.5s)                            CUNIT2B = 'deg     '                                                            COMMENT                                                                         CRPIX3B =                    1                                                  CDELT3B =                  1.0                                                  CTYPE3B = 'DEC     '                                                            CRVAL3B =            -5.375222 / [deg] (-05:22:30.8)                            CUNIT3B = 'deg     '                                                            COMMENT                                                                         RADESYSB= 'FK5     '           / FK5 (IAU 1984) equatorial coordinates          EQUINOXB=               2000.0 / Equinox J2000.0                                COMMENT                                                                         CRPIX4B =                    1                                                  CDELT4B =                  1.0                                                  CTYPE4B = 'STOKES  '                                                            CRVAL4B =                    1 / Stokes I (total intensity)                     COMMENT                                                                         HISTORY fimgcreate 1.0b at 2009-04-22T04:28:10                                  DATE    = '2009-04-22T04:28:10' / file creation date (YYYY-MM-DDThh:mm:ss UT)   "},{"fileName":"utils.py","filePath":"astropy/wcs/wcsapi","id":7684,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport importlib\nimport numpy as np\n\n__all__ = ['deserialize_class', 'wcs_info_str']\n\n\ndef deserialize_class(tpl, construct=True):\n    \"\"\"\n    Deserialize classes recursively.\n    \"\"\"\n\n    if not isinstance(tpl, tuple) or len(tpl) != 3:\n        raise ValueError(\"Expected a tuple of three values\")\n\n    module, klass = tpl[0].rsplit('.', 1)\n    module = importlib.import_module(module)\n    klass = getattr(module, klass)\n\n    args = tuple([deserialize_class(arg) if isinstance(arg, tuple) else arg for arg in tpl[1]])\n\n    kwargs = dict((key, deserialize_class(val)) if isinstance(val, tuple) else (key, val) for (key, val) in tpl[2].items())\n\n    if construct:\n        return klass(*args, **kwargs)\n    else:\n        return klass, args, kwargs\n\n\ndef wcs_info_str(wcs):\n\n    # Overall header\n\n    s = f'{wcs.__class__.__name__} Transformation\\n\\n'\n    s += ('This transformation has {} pixel and {} world dimensions\\n\\n'\n            .format(wcs.pixel_n_dim, wcs.world_n_dim))\n    s += f'Array shape (Numpy order): {wcs.array_shape}\\n\\n'\n\n    # Pixel dimensions table\n\n    array_shape = wcs.array_shape or (0,)\n    pixel_shape = wcs.pixel_shape or (None,) * wcs.pixel_n_dim\n\n    # Find largest between header size and value length\n    pixel_dim_width = max(9, len(str(wcs.pixel_n_dim)))\n    pixel_nam_width = max(9, max(len(x) for x in wcs.pixel_axis_names))\n    pixel_siz_width = max(9, len(str(max(array_shape))))\n\n    s += (('{0:' + str(pixel_dim_width) + 's}').format('Pixel Dim') + '  ' +\n            ('{0:' + str(pixel_nam_width) + 's}').format('Axis Name') + '  ' +\n            ('{0:' + str(pixel_siz_width) + 's}').format('Data size') + '  ' +\n            'Bounds\\n')\n\n    for ipix in range(wcs.pixel_n_dim):\n        s += (('{0:' + str(pixel_dim_width) + 'g}').format(ipix) + '  ' +\n                ('{0:' + str(pixel_nam_width) + 's}').format(wcs.pixel_axis_names[ipix] or 'None') + '  ' +\n                (\" \" * 5 + str(None) if pixel_shape[ipix] is None else\n                ('{0:' + str(pixel_siz_width) + 'g}').format(pixel_shape[ipix])) + '  ' +\n                '{:s}'.format(str(None if wcs.pixel_bounds is None else wcs.pixel_bounds[ipix]) + '\\n'))\n\n    s += '\\n'\n\n    # World dimensions table\n\n    # Find largest between header size and value length\n    world_dim_width = max(9, len(str(wcs.world_n_dim)))\n    world_nam_width = max(9, max(len(x) if x is not None else 0 for x in wcs.world_axis_names))\n    world_typ_width = max(13, max(len(x) if x is not None else 0 for x in wcs.world_axis_physical_types))\n\n    s += (('{0:' + str(world_dim_width) + 's}').format('World Dim') + '  ' +\n            ('{0:' + str(world_nam_width) + 's}').format('Axis Name') + '  ' +\n            ('{0:' + str(world_typ_width) + 's}').format('Physical Type') + '  ' +\n            'Units\\n')\n\n    for iwrl in range(wcs.world_n_dim):\n\n        name = wcs.world_axis_names[iwrl] or 'None'\n        typ = wcs.world_axis_physical_types[iwrl] or 'None'\n        unit = wcs.world_axis_units[iwrl] or 'unknown'\n\n        s += (('{0:' + str(world_dim_width) + 'd}').format(iwrl) + '  ' +\n                ('{0:' + str(world_nam_width) + 's}').format(name) + '  ' +\n                ('{0:' + str(world_typ_width) + 's}').format(typ) + '  ' +\n                '{:s}'.format(unit + '\\n'))\n    s += '\\n'\n\n    # Axis correlation matrix\n\n    pixel_dim_width = max(3, len(str(wcs.world_n_dim)))\n\n    s += 'Correlation between pixel and world axes:\\n\\n'\n\n    s += (' ' * world_dim_width + '  ' +\n            ('{0:^' + str(wcs.pixel_n_dim * 5 - 2) + 's}').format('Pixel Dim') +\n            '\\n')\n\n    s += (('{0:' + str(world_dim_width) + 's}').format('World Dim') +\n            ''.join(['  ' + ('{0:' + str(pixel_dim_width) + 'd}').format(ipix)\n                    for ipix in range(wcs.pixel_n_dim)]) +\n            '\\n')\n\n    matrix = wcs.axis_correlation_matrix\n    matrix_str = np.empty(matrix.shape, dtype='U3')\n    matrix_str[matrix] = 'yes'\n    matrix_str[~matrix] = 'no'\n\n    for iwrl in range(wcs.world_n_dim):\n        s += (('{0:' + str(world_dim_width) + 'd}').format(iwrl) +\n                ''.join(['  ' + ('{0:>' + str(pixel_dim_width) + 's}').format(matrix_str[iwrl, ipix])\n                        for ipix in range(wcs.pixel_n_dim)]) +\n                '\\n')\n\n    # Make sure we get rid of the extra whitespace at the end of some lines\n    return '\\n'.join([l.rstrip() for l in s.splitlines()])\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":7685,"name":"__all__","nodeType":"Attribute","startLoc":6,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"utils.py#<anonymous>","id":7686,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['deserialize_class', 'wcs_info_str']"},{"col":4,"comment":"null","endLoc":1420,"header":"def _combine_operation(self, op, other, reverse=False)","id":7687,"name":"_combine_operation","nodeType":"Function","startLoc":1408,"text":"def _combine_operation(self, op, other, reverse=False):\n        self._raise_if_has_differentials(op.__name__)\n\n        try:\n            other_c = other.to_cartesian()\n        except Exception:\n            return NotImplemented\n\n        first, second = ((self, other_c) if not reverse else\n                         (other_c, self))\n        return self.__class__(*(op(getattr(first, component),\n                                   getattr(second, component))\n                                for component in first.components))"},{"fileName":"high_level_wcs_wrapper.py","filePath":"astropy/wcs/wcsapi","id":7688,"nodeType":"File","text":"from .high_level_api import HighLevelWCSMixin\nfrom .low_level_api import BaseLowLevelWCS\nfrom .utils import wcs_info_str\n\n__all__ = ['HighLevelWCSWrapper']\n\n\nclass HighLevelWCSWrapper(HighLevelWCSMixin):\n    \"\"\"\n    Wrapper class that can take any :class:`~astropy.wcs.wcsapi.BaseLowLevelWCS`\n    object and expose the high-level WCS API.\n    \"\"\"\n\n    def __init__(self, low_level_wcs):\n        if not isinstance(low_level_wcs, BaseLowLevelWCS):\n            raise TypeError('Input to a HighLevelWCSWrapper must be a low level WCS object')\n\n        self._low_level_wcs = low_level_wcs\n\n    @property\n    def low_level_wcs(self):\n        return self._low_level_wcs\n\n    @property\n    def pixel_n_dim(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim`\n        \"\"\"\n        return self.low_level_wcs.pixel_n_dim\n\n    @property\n    def world_n_dim(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim`\n        \"\"\"\n        return self.low_level_wcs.world_n_dim\n\n    @property\n    def world_axis_physical_types(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_physical_types`\n        \"\"\"\n        return self.low_level_wcs.world_axis_physical_types\n\n    @property\n    def world_axis_units(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_units`\n        \"\"\"\n        return self.low_level_wcs.world_axis_units\n\n    @property\n    def array_shape(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.array_shape`\n        \"\"\"\n        return self.low_level_wcs.array_shape\n\n    @property\n    def pixel_bounds(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_bounds`\n        \"\"\"\n        return self.low_level_wcs.pixel_bounds\n\n    @property\n    def axis_correlation_matrix(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.axis_correlation_matrix`\n        \"\"\"\n        return self.low_level_wcs.axis_correlation_matrix\n\n    def _as_mpl_axes(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS._as_mpl_axes`\n        \"\"\"\n        return self.low_level_wcs._as_mpl_axes()\n\n    def __str__(self):\n        return wcs_info_str(self.low_level_wcs)\n\n    def __repr__(self):\n        return f\"{object.__repr__(self)}\\n{str(self)}\"\n"},{"fileName":"low_level_api.py","filePath":"astropy/wcs/wcsapi","id":7689,"nodeType":"File","text":"import os\nimport abc\n\nimport numpy as np\n\n__all__ = ['BaseLowLevelWCS', 'validate_physical_types']\n\n\nclass BaseLowLevelWCS(metaclass=abc.ABCMeta):\n    \"\"\"\n    Abstract base class for the low-level WCS interface.\n\n    This is described in `APE 14: A shared Python interface for World Coordinate\n    Systems <https://doi.org/10.5281/zenodo.1188875>`_.\n    \"\"\"\n\n    @property\n    @abc.abstractmethod\n    def pixel_n_dim(self):\n        \"\"\"\n        The number of axes in the pixel coordinate system.\n        \"\"\"\n\n    @property\n    @abc.abstractmethod\n    def world_n_dim(self):\n        \"\"\"\n        The number of axes in the world coordinate system.\n        \"\"\"\n\n    @property\n    @abc.abstractmethod\n    def world_axis_physical_types(self):\n        \"\"\"\n        An iterable of strings describing the physical type for each world axis.\n\n        These should be names from the VO UCD1+ controlled Vocabulary\n        (http://www.ivoa.net/documents/latest/UCDlist.html). If no matching UCD\n        type exists, this can instead be ``\"custom:xxx\"``, where ``xxx`` is an\n        arbitrary string.  Alternatively, if the physical type is\n        unknown/undefined, an element can be `None`.\n        \"\"\"\n\n    @property\n    @abc.abstractmethod\n    def world_axis_units(self):\n        \"\"\"\n        An iterable of strings given the units of the world coordinates for each\n        axis.\n\n        The strings should follow the `IVOA VOUnit standard\n        <http://ivoa.net/documents/VOUnits/>`_ (though as noted in the VOUnit\n        specification document, units that do not follow this standard are still\n        allowed, but just not recommended).\n        \"\"\"\n\n    @abc.abstractmethod\n    def pixel_to_world_values(self, *pixel_arrays):\n        \"\"\"\n        Convert pixel coordinates to world coordinates.\n\n        This method takes `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` scalars or arrays as\n        input, and pixel coordinates should be zero-based. Returns\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` scalars or arrays in units given by\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_units`. Note that pixel coordinates are\n        assumed to be 0 at the center of the first pixel in each dimension. If a\n        pixel is in a region where the WCS is not defined, NaN can be returned.\n        The coordinates should be specified in the ``(x, y)`` order, where for\n        an image, ``x`` is the horizontal coordinate and ``y`` is the vertical\n        coordinate.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned.\n        \"\"\"\n\n    def array_index_to_world_values(self, *index_arrays):\n        \"\"\"\n        Convert array indices to world coordinates.\n\n        This is the same as `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values` except that\n        the indices should be given in ``(i, j)`` order, where for an image\n        ``i`` is the row and ``j`` is the column (i.e. the opposite order to\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values`).\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned.\n        \"\"\"\n        return self.pixel_to_world_values(*index_arrays[::-1])\n\n    @abc.abstractmethod\n    def world_to_pixel_values(self, *world_arrays):\n        \"\"\"\n        Convert world coordinates to pixel coordinates.\n\n        This method takes `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` scalars or arrays as\n        input in units given by `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_units`. Returns\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` scalars or arrays. Note that pixel\n        coordinates are assumed to be 0 at the center of the first pixel in each\n        dimension. If a world coordinate does not have a matching pixel\n        coordinate, NaN can be returned.  The coordinates should be returned in\n        the ``(x, y)`` order, where for an image, ``x`` is the horizontal\n        coordinate and ``y`` is the vertical coordinate.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned.\n        \"\"\"\n\n    def world_to_array_index_values(self, *world_arrays):\n        \"\"\"\n        Convert world coordinates to array indices.\n\n        This is the same as `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_to_pixel_values` except that\n        the indices should be returned in ``(i, j)`` order, where for an image\n        ``i`` is the row and ``j`` is the column (i.e. the opposite order to\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values`). The indices should be\n        returned as rounded integers.\n\n        If `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` is ``1``, this\n        method returns a single scalar or array, otherwise a tuple of scalars or\n        arrays is returned.\n        \"\"\"\n        pixel_arrays = self.world_to_pixel_values(*world_arrays)\n        if self.pixel_n_dim == 1:\n            pixel_arrays = (pixel_arrays,)\n        else:\n            pixel_arrays = pixel_arrays[::-1]\n        array_indices = tuple(np.asarray(np.floor(pixel + 0.5), dtype=np.int_) for pixel in pixel_arrays)\n        return array_indices[0] if self.pixel_n_dim == 1 else array_indices\n\n    @property\n    @abc.abstractmethod\n    def world_axis_object_components(self):\n        \"\"\"\n        A list with `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim` elements giving information\n        on constructing high-level objects for the world coordinates.\n\n        Each element of the list is a tuple with three items:\n\n        * The first is a name for the world object this world array\n          corresponds to, which *must* match the string names used in\n          `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_classes`. Note that names might\n          appear twice because two world arrays might correspond to a single\n          world object (e.g. a celestial coordinate might have both “ra” and\n          “dec” arrays, which correspond to a single sky coordinate object).\n\n        * The second element is either a string keyword argument name or a\n          positional index for the corresponding class from\n          `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_classes`.\n\n        * The third argument is a string giving the name of the property\n          to access on the corresponding class from\n          `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_classes` in\n          order to get numerical values. Alternatively, this argument can be a\n          callable Python object that takes a high-level coordinate object and\n          returns the numerical values suitable for passing to the low-level\n          WCS transformation methods.\n\n        See the document\n        `APE 14: A shared Python interface for World Coordinate Systems\n        <https://doi.org/10.5281/zenodo.1188875>`_ for examples.\n        \"\"\"\n\n    @property\n    @abc.abstractmethod\n    def world_axis_object_classes(self):\n        \"\"\"\n        A dictionary giving information on constructing high-level objects for\n        the world coordinates.\n\n        Each key of the dictionary is a string key from\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_components`, and each value is a\n        tuple with three elements or four elements:\n\n        * The first element of the tuple must be a class or a string specifying\n          the fully-qualified name of a class, which will specify the actual\n          Python object to be created.\n\n        * The second element, should be a tuple specifying the positional\n          arguments required to initialize the class. If\n          `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_components` specifies that the\n          world coordinates should be passed as a positional argument, this this\n          tuple should include `None` placeholders for the world coordinates.\n\n        * The third tuple element must be a dictionary with the keyword\n          arguments required to initialize the class.\n\n        * Optionally, for advanced use cases, the fourth element (if present)\n          should be a callable Python object that gets called instead of the\n          class and gets passed the positional and keyword arguments. It should\n          return an object of the type of the first element in the tuple.\n\n        Note that we don't require the classes to be Astropy classes since there\n        is no guarantee that Astropy will have all the classes to represent all\n        kinds of world coordinates. Furthermore, we recommend that the output be\n        kept as human-readable as possible.\n\n        The classes used here should have the ability to do conversions by\n        passing an instance as the first argument to the same class with\n        different arguments (e.g. ``Time(Time(...), scale='tai')``). This is\n        a requirement for the implementation of the high-level interface.\n\n        The second and third tuple elements for each value of this dictionary\n        can in turn contain either instances of classes, or if necessary can\n        contain serialized versions that should take the same form as the main\n        classes described above (a tuple with three elements with the fully\n        qualified name of the class, then the positional arguments and the\n        keyword arguments). For low-level API objects implemented in Python, we\n        recommend simply returning the actual objects (not the serialized form)\n        for optimal performance. Implementations should either always or never\n        use serialized classes to represent Python objects, and should indicate\n        which of these they follow using the\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.serialized_classes` attribute.\n\n        See the document\n        `APE 14: A shared Python interface for World Coordinate Systems\n        <https://doi.org/10.5281/zenodo.1188875>`_ for examples .\n        \"\"\"\n\n    # The following three properties have default fallback implementations, so\n    # they are not abstract.\n\n    @property\n    def array_shape(self):\n        \"\"\"\n        The shape of the data that the WCS applies to as a tuple of length\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` in ``(row, column)``\n        order (the convention for arrays in Python).\n\n        If the WCS is valid in the context of a dataset with a particular\n        shape, then this property can be used to store the shape of the\n        data. This can be used for example if implementing slicing of WCS\n        objects. This is an optional property, and it should return `None`\n        if a shape is not known or relevant.\n        \"\"\"\n        if self.pixel_shape is None:\n            return None\n        else:\n            return self.pixel_shape[::-1]\n\n    @property\n    def pixel_shape(self):\n        \"\"\"\n        The shape of the data that the WCS applies to as a tuple of length\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim` in ``(x, y)``\n        order (where for an image, ``x`` is the horizontal coordinate and ``y``\n        is the vertical coordinate).\n\n        If the WCS is valid in the context of a dataset with a particular\n        shape, then this property can be used to store the shape of the\n        data. This can be used for example if implementing slicing of WCS\n        objects. This is an optional property, and it should return `None`\n        if a shape is not known or relevant.\n\n        If you are interested in getting a shape that is comparable to that of\n        a Numpy array, you should use\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.array_shape` instead.\n        \"\"\"\n        return None\n\n    @property\n    def pixel_bounds(self):\n        \"\"\"\n        The bounds (in pixel coordinates) inside which the WCS is defined,\n        as a list with `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim`\n        ``(min, max)`` tuples.\n\n        The bounds should be given in ``[(xmin, xmax), (ymin, ymax)]``\n        order. WCS solutions are sometimes only guaranteed to be accurate\n        within a certain range of pixel values, for example when defining a\n        WCS that includes fitted distortions. This is an optional property,\n        and it should return `None` if a shape is not known or relevant.\n        \"\"\"\n        return None\n\n    @property\n    def pixel_axis_names(self):\n        \"\"\"\n        An iterable of strings describing the name for each pixel axis.\n\n        If an axis does not have a name, an empty string should be returned\n        (this is the default behavior for all axes if a subclass does not\n        override this property). Note that these names are just for display\n        purposes and are not standardized.\n        \"\"\"\n        return [''] * self.pixel_n_dim\n\n    @property\n    def world_axis_names(self):\n        \"\"\"\n        An iterable of strings describing the name for each world axis.\n\n        If an axis does not have a name, an empty string should be returned\n        (this is the default behavior for all axes if a subclass does not\n        override this property). Note that these names are just for display\n        purposes and are not standardized. For standardized axis types, see\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_physical_types`.\n        \"\"\"\n        return [''] * self.world_n_dim\n\n    @property\n    def axis_correlation_matrix(self):\n        \"\"\"\n        Returns an (`~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim`,\n        `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim`) matrix that\n        indicates using booleans whether a given world coordinate depends on a\n        given pixel coordinate.\n\n        This defaults to a matrix where all elements are `True` in the absence\n        of any further information. For completely independent axes, the\n        diagonal would be `True` and all other entries `False`.\n        \"\"\"\n        return np.ones((self.world_n_dim, self.pixel_n_dim), dtype=bool)\n\n    @property\n    def serialized_classes(self):\n        \"\"\"\n        Indicates whether Python objects are given in serialized form or as\n        actual Python objects.\n        \"\"\"\n        return False\n\n    def _as_mpl_axes(self):\n        \"\"\"\n        Compatibility hook for Matplotlib and WCSAxes. With this method, one can\n        do::\n\n            from astropy.wcs import WCS\n            import matplotlib.pyplot as plt\n            wcs = WCS('filename.fits')\n            fig = plt.figure()\n            ax = fig.add_axes([0.15, 0.1, 0.8, 0.8], projection=wcs)\n            ...\n\n        and this will generate a plot with the correct WCS coordinates on the\n        axes.\n        \"\"\"\n        from astropy.visualization.wcsaxes import WCSAxes\n        return WCSAxes, {'wcs': self}\n\n\nUCDS_FILE = os.path.join(os.path.dirname(__file__), 'data', 'ucds.txt')\nwith open(UCDS_FILE) as f:\n    VALID_UCDS = set([x.strip() for x in f.read().splitlines()[1:]])\n\n\ndef validate_physical_types(physical_types):\n    \"\"\"\n    Validate a list of physical types against the UCD1+ standard\n    \"\"\"\n    for physical_type in physical_types:\n        if (physical_type is not None and\n            physical_type not in VALID_UCDS and\n                not physical_type.startswith('custom:')):\n            raise ValueError(\n                f\"'{physical_type}' is not a valid IOVA UCD1+ physical type. \"\n                \"It must be a string specified in the list (http://www.ivoa.net/documents/latest/UCDlist.html) \"\n                \"or if no matching type exists it can be any string prepended with 'custom:'.\"\n            )\n"},{"col":0,"comment":"\n    Validate a list of physical types against the UCD1+ standard\n    ","endLoc":361,"header":"def validate_physical_types(physical_types)","id":7690,"name":"validate_physical_types","nodeType":"Function","startLoc":349,"text":"def validate_physical_types(physical_types):\n    \"\"\"\n    Validate a list of physical types against the UCD1+ standard\n    \"\"\"\n    for physical_type in physical_types:\n        if (physical_type is not None and\n            physical_type not in VALID_UCDS and\n                not physical_type.startswith('custom:')):\n            raise ValueError(\n                f\"'{physical_type}' is not a valid IOVA UCD1+ physical type. \"\n                \"It must be a string specified in the list (http://www.ivoa.net/documents/latest/UCDlist.html) \"\n                \"or if no matching type exists it can be any string prepended with 'custom:'.\"\n            )"},{"className":"HighLevelWCSWrapper","col":0,"comment":"\n    Wrapper class that can take any :class:`~astropy.wcs.wcsapi.BaseLowLevelWCS`\n    object and expose the high-level WCS API.\n    ","endLoc":83,"id":7691,"nodeType":"Class","startLoc":8,"text":"class HighLevelWCSWrapper(HighLevelWCSMixin):\n    \"\"\"\n    Wrapper class that can take any :class:`~astropy.wcs.wcsapi.BaseLowLevelWCS`\n    object and expose the high-level WCS API.\n    \"\"\"\n\n    def __init__(self, low_level_wcs):\n        if not isinstance(low_level_wcs, BaseLowLevelWCS):\n            raise TypeError('Input to a HighLevelWCSWrapper must be a low level WCS object')\n\n        self._low_level_wcs = low_level_wcs\n\n    @property\n    def low_level_wcs(self):\n        return self._low_level_wcs\n\n    @property\n    def pixel_n_dim(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim`\n        \"\"\"\n        return self.low_level_wcs.pixel_n_dim\n\n    @property\n    def world_n_dim(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim`\n        \"\"\"\n        return self.low_level_wcs.world_n_dim\n\n    @property\n    def world_axis_physical_types(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_physical_types`\n        \"\"\"\n        return self.low_level_wcs.world_axis_physical_types\n\n    @property\n    def world_axis_units(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_units`\n        \"\"\"\n        return self.low_level_wcs.world_axis_units\n\n    @property\n    def array_shape(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.array_shape`\n        \"\"\"\n        return self.low_level_wcs.array_shape\n\n    @property\n    def pixel_bounds(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_bounds`\n        \"\"\"\n        return self.low_level_wcs.pixel_bounds\n\n    @property\n    def axis_correlation_matrix(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.axis_correlation_matrix`\n        \"\"\"\n        return self.low_level_wcs.axis_correlation_matrix\n\n    def _as_mpl_axes(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS._as_mpl_axes`\n        \"\"\"\n        return self.low_level_wcs._as_mpl_axes()\n\n    def __str__(self):\n        return wcs_info_str(self.low_level_wcs)\n\n    def __repr__(self):\n        return f\"{object.__repr__(self)}\\n{str(self)}\""},{"col":4,"comment":"null","endLoc":18,"header":"def __init__(self, low_level_wcs)","id":7692,"name":"__init__","nodeType":"Function","startLoc":14,"text":"def __init__(self, low_level_wcs):\n        if not isinstance(low_level_wcs, BaseLowLevelWCS):\n            raise TypeError('Input to a HighLevelWCSWrapper must be a low level WCS object')\n\n        self._low_level_wcs = low_level_wcs"},{"col":4,"comment":"null","endLoc":22,"header":"@property\n    def low_level_wcs(self)","id":7693,"name":"low_level_wcs","nodeType":"Function","startLoc":20,"text":"@property\n    def low_level_wcs(self):\n        return self._low_level_wcs"},{"col":4,"comment":"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim`\n        ","endLoc":29,"header":"@property\n    def pixel_n_dim(self)","id":7694,"name":"pixel_n_dim","nodeType":"Function","startLoc":24,"text":"@property\n    def pixel_n_dim(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim`\n        \"\"\"\n        return self.low_level_wcs.pixel_n_dim"},{"col":4,"comment":"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim`\n        ","endLoc":36,"header":"@property\n    def world_n_dim(self)","id":7695,"name":"world_n_dim","nodeType":"Function","startLoc":31,"text":"@property\n    def world_n_dim(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim`\n        \"\"\"\n        return self.low_level_wcs.world_n_dim"},{"col":4,"comment":"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_physical_types`\n        ","endLoc":43,"header":"@property\n    def world_axis_physical_types(self)","id":7696,"name":"world_axis_physical_types","nodeType":"Function","startLoc":38,"text":"@property\n    def world_axis_physical_types(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_physical_types`\n        \"\"\"\n        return self.low_level_wcs.world_axis_physical_types"},{"col":4,"comment":"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_units`\n        ","endLoc":50,"header":"@property\n    def world_axis_units(self)","id":7697,"name":"world_axis_units","nodeType":"Function","startLoc":45,"text":"@property\n    def world_axis_units(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_units`\n        \"\"\"\n        return self.low_level_wcs.world_axis_units"},{"col":4,"comment":"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.array_shape`\n        ","endLoc":57,"header":"@property\n    def array_shape(self)","id":7698,"name":"array_shape","nodeType":"Function","startLoc":52,"text":"@property\n    def array_shape(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.array_shape`\n        \"\"\"\n        return self.low_level_wcs.array_shape"},{"col":4,"comment":"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_bounds`\n        ","endLoc":64,"header":"@property\n    def pixel_bounds(self)","id":7699,"name":"pixel_bounds","nodeType":"Function","startLoc":59,"text":"@property\n    def pixel_bounds(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_bounds`\n        \"\"\"\n        return self.low_level_wcs.pixel_bounds"},{"col":4,"comment":"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.axis_correlation_matrix`\n        ","endLoc":71,"header":"@property\n    def axis_correlation_matrix(self)","id":7700,"name":"axis_correlation_matrix","nodeType":"Function","startLoc":66,"text":"@property\n    def axis_correlation_matrix(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS.axis_correlation_matrix`\n        \"\"\"\n        return self.low_level_wcs.axis_correlation_matrix"},{"col":4,"comment":"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS._as_mpl_axes`\n        ","endLoc":77,"header":"def _as_mpl_axes(self)","id":7701,"name":"_as_mpl_axes","nodeType":"Function","startLoc":73,"text":"def _as_mpl_axes(self):\n        \"\"\"\n        See `~astropy.wcs.wcsapi.BaseLowLevelWCS._as_mpl_axes`\n        \"\"\"\n        return self.low_level_wcs._as_mpl_axes()"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":7702,"name":"__all__","nodeType":"Attribute","startLoc":6,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":344,"id":7703,"name":"UCDS_FILE","nodeType":"Attribute","startLoc":344,"text":"UCDS_FILE"},{"attributeType":"null","col":24,"comment":"null","endLoc":345,"id":7704,"name":"f","nodeType":"Attribute","startLoc":345,"text":"f"},{"attributeType":"null","col":4,"comment":"null","endLoc":346,"id":7705,"name":"VALID_UCDS","nodeType":"Attribute","startLoc":346,"text":"VALID_UCDS"},{"col":0,"comment":"","endLoc":1,"header":"low_level_api.py#<anonymous>","id":7706,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"__all__ = ['BaseLowLevelWCS', 'validate_physical_types']\n\nUCDS_FILE = os.path.join(os.path.dirname(__file__), 'data', 'ucds.txt')\n\nwith open(UCDS_FILE) as f:\n    VALID_UCDS = set([x.strip() for x in f.read().splitlines()[1:]])"},{"fileName":"__init__.py","filePath":"astropy/wcs/wcsapi","id":7707,"nodeType":"File","text":"from .low_level_api import *  # noqa\nfrom .high_level_api import *  # noqa\nfrom .high_level_wcs_wrapper import *  # noqa\nfrom .utils import *  # noqa\nfrom .wrappers import *  # noqa\n"},{"fileName":"sliced_low_level_wcs.py","filePath":"astropy/wcs/wcsapi","id":7708,"nodeType":"File","text":"import warnings\n\nfrom .wrappers.sliced_wcs import SlicedLowLevelWCS, sanitize_slices\nfrom astropy.utils.exceptions import AstropyDeprecationWarning\n\nwarnings.warn(\n    \"SlicedLowLevelWCS has been moved to\"\n    \" astropy.wcs.wcsapi.wrappers.sliced_wcs.SlicedLowLevelWCS, or can be\"\n    \" imported from astropy.wcs.wcsapi.\",\n    AstropyDeprecationWarning)\n"},{"col":4,"comment":" Simulates 2D data with a _spatial_ WCS that uses the ``-TAB``\n        algorithm with indexing.\n        ","endLoc":112,"header":"@property\n    def hdulist(self)","id":7709,"name":"hdulist","nodeType":"Function","startLoc":53,"text":"@property\n    def hdulist(self):\n        \"\"\" Simulates 2D data with a _spatial_ WCS that uses the ``-TAB``\n        algorithm with indexing.\n        \"\"\"\n        # coordinate array (some \"arbitrary\" numbers with a \"jump\" along x axis):\n        x = np.array([[0.0, 0.26, 0.8, 1.0], [0.0, 0.26, 0.8, 1.0]])\n        y = np.array([[-0.5, -0.5, -0.5, -0.5], [0.5, 0.5, 0.5, 0.5]])\n        c = np.dstack([x, y])\n\n        # index arrays (skip PC matrix for simplicity - assume it is an\n        # identity matrix):\n        xb = 1 + self.nx // 3\n        px = np.array([1, xb, xb, self.nx + 1])\n        py = np.array([1, self.ny + 1])\n        xi = self.crval[0] + self.cdelt[0] * (px - self.crpix[0])\n        yi = self.crval[1] + self.cdelt[1] * (py - self.crpix[1])\n\n        # structured array (data) for binary table HDU:\n        arr = np.array(\n            [(c, xi, yi)],\n            dtype=[\n                ('wavelength', np.float64, c.shape),\n                ('xi', np.double, (xi.size,)),\n                ('yi', np.double, (yi.size,))\n            ]\n        )\n\n        # create binary table HDU:\n        bt = fits.BinTableHDU(arr);\n        bt.header['EXTNAME'] = 'WCS-TABLE'\n\n        # create primary header:\n        image_data = np.ones((self.ny, self.nx), dtype=np.float32)\n        pu = fits.PrimaryHDU(image_data)\n        pu.header['ctype1'] = 'RA---TAB'\n        pu.header['ctype2'] = 'DEC--TAB'\n        pu.header['naxis1'] = self.nx\n        pu.header['naxis2'] = self.ny\n        pu.header['PS1_0'] = 'WCS-TABLE'\n        pu.header['PS2_0'] = 'WCS-TABLE'\n        pu.header['PS1_1'] = 'wavelength'\n        pu.header['PS2_1'] = 'wavelength'\n        pu.header['PV1_3'] = 1\n        pu.header['PV2_3'] = 2\n        pu.header['CUNIT1'] = 'deg'\n        pu.header['CUNIT2'] = 'deg'\n        pu.header['CDELT1'] = self.cdelt[0]\n        pu.header['CDELT2'] = self.cdelt[1]\n        pu.header['CRPIX1'] = self.crpix[0]\n        pu.header['CRPIX2'] = self.crpix[1]\n        pu.header['CRVAL1'] = self.crval[0]\n        pu.header['CRVAL2'] = self.crval[1]\n        pu.header['PS1_2'] = 'xi'\n        pu.header['PS2_2'] = 'yi'\n        for k, v in self.pc.items():\n            pu.header[k] = v\n\n        hdulist = fits.HDUList([pu, bt])\n        return hdulist"},{"col":0,"comment":"","endLoc":1,"header":"sliced_low_level_wcs.py#<anonymous>","id":7710,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"warnings.warn(\n    \"SlicedLowLevelWCS has been moved to\"\n    \" astropy.wcs.wcsapi.wrappers.sliced_wcs.SlicedLowLevelWCS, or can be\"\n    \" imported from astropy.wcs.wcsapi.\",\n    AstropyDeprecationWarning)"},{"fileName":"fitswcs.py","filePath":"astropy/wcs/wcsapi","id":7711,"nodeType":"File","text":"# This file includes the definition of a mix-in class that provides the low-\n# and high-level WCS API to the astropy.wcs.WCS object. We keep this code\n# isolated in this mix-in class to avoid making the main wcs.py file too\n# long.\n\nimport warnings\n\nimport numpy as np\n\nfrom astropy import units as u\nfrom astropy.coordinates import SpectralCoord, Galactic, ICRS\nfrom astropy.coordinates.spectral_coordinate import update_differentials_to_match, attach_zero_velocities\nfrom astropy.utils.exceptions import AstropyUserWarning\nfrom astropy.constants import c\n\nfrom .low_level_api import BaseLowLevelWCS\nfrom .high_level_api import HighLevelWCSMixin\nfrom .wrappers import SlicedLowLevelWCS\n\n__all__ = ['custom_ctype_to_ucd_mapping', 'SlicedFITSWCS', 'FITSWCSAPIMixin']\n\nC_SI = c.si.value\n\nVELOCITY_FRAMES = {\n    'GEOCENT': 'gcrs',\n    'BARYCENT': 'icrs',\n    'HELIOCENT': 'hcrs',\n    'LSRK': 'lsrk',\n    'LSRD': 'lsrd'\n}\n\n# The spectra velocity frames below are needed for FITS spectral WCS\n#  (see Greisen 06 table 12) but aren't yet defined as real\n# astropy.coordinates frames, so we instead define them here as instances\n# of existing coordinate frames with offset velocities. In future we should\n# make these real frames so that users can more easily recognize these\n# velocity frames when used in SpectralCoord.\n\n# This frame is defined as a velocity of 220 km/s in the\n# direction of l=90, b=0. The rotation velocity is defined\n# in:\n#\n#   Kerr and Lynden-Bell 1986, Review of galactic constants.\n#\n# NOTE: this may differ from the assumptions of galcen_v_sun\n# in the Galactocentric frame - the value used here is\n# the one adopted by the WCS standard for spectral\n# transformations.\n\nVELOCITY_FRAMES['GALACTOC'] = Galactic(u=0 * u.km, v=0 * u.km, w=0 * u.km,\n                                       U=0 * u.km / u.s, V=-220 * u.km / u.s, W=0 * u.km / u.s,\n                                       representation_type='cartesian',\n                                       differential_type='cartesian')\n\n# This frame is defined as a velocity of 300 km/s in the\n# direction of l=90, b=0. This is defined in:\n#\n#   Transactions of the IAU Vol. XVI B Proceedings of the\n#   16th General Assembly, Reports of Meetings of Commissions:\n#   Comptes Rendus Des Séances Des Commissions, Commission 28,\n#   p201.\n#\n# Note that these values differ from those used by CASA\n# (308 km/s towards l=105, b=-7) but we use the above values\n# since these are the ones defined in Greisen et al (2006).\n\nVELOCITY_FRAMES['LOCALGRP'] = Galactic(u=0 * u.km, v=0 * u.km, w=0 * u.km,\n                                       U=0 * u.km / u.s, V=-300 * u.km / u.s, W=0 * u.km / u.s,\n                                       representation_type='cartesian',\n                                       differential_type='cartesian')\n\n# This frame is defined as a velocity of 368 km/s in the\n# direction of l=263.85, b=48.25. This is defined in:\n#\n#   Bennett et al. (2003), First-Year Wilkinson Microwave\n#   Anisotropy Probe (WMAP) Observations: Preliminary Maps\n#   and Basic Results\n#\n# Note that in that paper, the dipole is expressed as a\n# temperature (T=3.346 +/- 0.017mK)\n\nVELOCITY_FRAMES['CMBDIPOL'] = Galactic(l=263.85 * u.deg, b=48.25 * u.deg, distance=0 * u.km,\n                                       radial_velocity=-(3.346e-3 / 2.725 * c).to(u.km/u.s))\n\n\n# Mapping from CTYPE axis name to UCD1\n\nCTYPE_TO_UCD1 = {\n\n    # Celestial coordinates\n    'RA': 'pos.eq.ra',\n    'DEC': 'pos.eq.dec',\n    'GLON': 'pos.galactic.lon',\n    'GLAT': 'pos.galactic.lat',\n    'ELON': 'pos.ecliptic.lon',\n    'ELAT': 'pos.ecliptic.lat',\n    'TLON': 'pos.bodyrc.lon',\n    'TLAT': 'pos.bodyrc.lat',\n    'HPLT': 'custom:pos.helioprojective.lat',\n    'HPLN': 'custom:pos.helioprojective.lon',\n    'HPRZ': 'custom:pos.helioprojective.z',\n    'HGLN': 'custom:pos.heliographic.stonyhurst.lon',\n    'HGLT': 'custom:pos.heliographic.stonyhurst.lat',\n    'CRLN': 'custom:pos.heliographic.carrington.lon',\n    'CRLT': 'custom:pos.heliographic.carrington.lat',\n    'SOLX': 'custom:pos.heliocentric.x',\n    'SOLY': 'custom:pos.heliocentric.y',\n    'SOLZ': 'custom:pos.heliocentric.z',\n\n    # Spectral coordinates (WCS paper 3)\n    'FREQ': 'em.freq',  # Frequency\n    'ENER': 'em.energy',  # Energy\n    'WAVN': 'em.wavenumber',  # Wavenumber\n    'WAVE': 'em.wl',  # Vacuum wavelength\n    'VRAD': 'spect.dopplerVeloc.radio',  # Radio velocity\n    'VOPT': 'spect.dopplerVeloc.opt',  # Optical velocity\n    'ZOPT': 'src.redshift',  # Redshift\n    'AWAV': 'em.wl',  # Air wavelength\n    'VELO': 'spect.dopplerVeloc',  # Apparent radial velocity\n    'BETA': 'custom:spect.doplerVeloc.beta',  # Beta factor (v/c)\n    'STOKES': 'phys.polarization.stokes',  # STOKES parameters\n\n    # Time coordinates (https://www.aanda.org/articles/aa/pdf/2015/02/aa24653-14.pdf)\n    'TIME': 'time',\n    'TAI': 'time',\n    'TT': 'time',\n    'TDT': 'time',\n    'ET': 'time',\n    'IAT': 'time',\n    'UT1': 'time',\n    'UTC': 'time',\n    'GMT': 'time',\n    'GPS': 'time',\n    'TCG': 'time',\n    'TCB': 'time',\n    'TDB': 'time',\n    'LOCAL': 'time',\n\n    # Distance coordinates\n    'DIST': 'pos.distance',\n    'DSUN': 'custom:pos.distance.sunToObserver'\n\n    # UT() and TT() are handled separately in world_axis_physical_types\n\n}\n\n# Keep a list of additional custom mappings that have been registered. This\n# is kept as a list in case nested context managers are used\nCTYPE_TO_UCD1_CUSTOM = []\n\n\nclass custom_ctype_to_ucd_mapping:\n    \"\"\"\n    A context manager that makes it possible to temporarily add new CTYPE to\n    UCD1+ mapping used by :attr:`FITSWCSAPIMixin.world_axis_physical_types`.\n\n    Parameters\n    ----------\n    mapping : dict\n        A dictionary mapping a CTYPE value to a UCD1+ value\n\n    Examples\n    --------\n\n    Consider a WCS with the following CTYPE::\n\n        >>> from astropy.wcs import WCS\n        >>> wcs = WCS(naxis=1)\n        >>> wcs.wcs.ctype = ['SPAM']\n\n    By default, :attr:`FITSWCSAPIMixin.world_axis_physical_types` returns `None`,\n    but this can be overridden::\n\n        >>> wcs.world_axis_physical_types\n        [None]\n        >>> with custom_ctype_to_ucd_mapping({'SPAM': 'food.spam'}):\n        ...     wcs.world_axis_physical_types\n        ['food.spam']\n    \"\"\"\n\n    def __init__(self, mapping):\n        CTYPE_TO_UCD1_CUSTOM.insert(0, mapping)\n        self.mapping = mapping\n\n    def __enter__(self):\n        pass\n\n    def __exit__(self, type, value, tb):\n        CTYPE_TO_UCD1_CUSTOM.remove(self.mapping)\n\n\nclass SlicedFITSWCS(SlicedLowLevelWCS, HighLevelWCSMixin):\n    pass\n\n\nclass FITSWCSAPIMixin(BaseLowLevelWCS, HighLevelWCSMixin):\n    \"\"\"\n    A mix-in class that is intended to be inherited by the\n    :class:`~astropy.wcs.WCS` class and provides the low- and high-level WCS API\n    \"\"\"\n\n    @property\n    def pixel_n_dim(self):\n        return self.naxis\n\n    @property\n    def world_n_dim(self):\n        return len(self.wcs.ctype)\n\n    @property\n    def array_shape(self):\n        if self.pixel_shape is None:\n            return None\n        else:\n            return self.pixel_shape[::-1]\n\n    @array_shape.setter\n    def array_shape(self, value):\n        if value is None:\n            self.pixel_shape = None\n        else:\n            self.pixel_shape = value[::-1]\n\n    @property\n    def pixel_shape(self):\n        if self._naxis == [0, 0]:\n            return None\n        else:\n            return tuple(self._naxis)\n\n    @pixel_shape.setter\n    def pixel_shape(self, value):\n        if value is None:\n            self._naxis = [0, 0]\n        else:\n            if len(value) != self.naxis:\n                raise ValueError(\"The number of data axes, \"\n                                 \"{}, does not equal the \"\n                                 \"shape {}.\".format(self.naxis, len(value)))\n            self._naxis = list(value)\n\n    @property\n    def pixel_bounds(self):\n        return self._pixel_bounds\n\n    @pixel_bounds.setter\n    def pixel_bounds(self, value):\n        if value is None:\n            self._pixel_bounds = value\n        else:\n            if len(value) != self.naxis:\n                raise ValueError(\"The number of data axes, \"\n                                 \"{}, does not equal the number of \"\n                                 \"pixel bounds {}.\".format(self.naxis, len(value)))\n            self._pixel_bounds = list(value)\n\n    @property\n    def world_axis_physical_types(self):\n        types = []\n        # TODO: need to support e.g. TT(TAI)\n        for ctype in self.wcs.ctype:\n            if ctype.upper().startswith(('UT(', 'TT(')):\n                types.append('time')\n            else:\n                ctype_name = ctype.split('-')[0]\n                for custom_mapping in CTYPE_TO_UCD1_CUSTOM:\n                    if ctype_name in custom_mapping:\n                        types.append(custom_mapping[ctype_name])\n                        break\n                else:\n                    types.append(CTYPE_TO_UCD1.get(ctype_name.upper(), None))\n        return types\n\n    @property\n    def world_axis_units(self):\n        units = []\n        for unit in self.wcs.cunit:\n            if unit is None:\n                unit = ''\n            elif isinstance(unit, u.Unit):\n                unit = unit.to_string(format='vounit')\n            else:\n                try:\n                    unit = u.Unit(unit).to_string(format='vounit')\n                except u.UnitsError:\n                    unit = ''\n            units.append(unit)\n        return units\n\n    @property\n    def world_axis_names(self):\n        return list(self.wcs.cname)\n\n    @property\n    def axis_correlation_matrix(self):\n\n        # If there are any distortions present, we assume that there may be\n        # correlations between all axes. Maybe if some distortions only apply\n        # to the image plane we can improve this?\n        if self.has_distortion:\n            return np.ones((self.world_n_dim, self.pixel_n_dim), dtype=bool)\n\n        # Assuming linear world coordinates along each axis, the correlation\n        # matrix would be given by whether or not the PC matrix is zero\n        matrix = self.wcs.get_pc() != 0\n\n        # We now need to check specifically for celestial coordinates since\n        # these can assume correlations because of spherical distortions. For\n        # each celestial coordinate we copy over the pixel dependencies from\n        # the other celestial coordinates.\n        celestial = (self.wcs.axis_types // 1000) % 10 == 2\n        celestial_indices = np.nonzero(celestial)[0]\n        for world1 in celestial_indices:\n            for world2 in celestial_indices:\n                if world1 != world2:\n                    matrix[world1] |= matrix[world2]\n                    matrix[world2] |= matrix[world1]\n\n        return matrix\n\n    def pixel_to_world_values(self, *pixel_arrays):\n        world = self.all_pix2world(*pixel_arrays, 0)\n        return world[0] if self.world_n_dim == 1 else tuple(world)\n\n    def world_to_pixel_values(self, *world_arrays):\n        pixel = self.all_world2pix(*world_arrays, 0)\n        return pixel[0] if self.pixel_n_dim == 1 else tuple(pixel)\n\n    @property\n    def world_axis_object_components(self):\n        return self._get_components_and_classes()[0]\n\n    @property\n    def world_axis_object_classes(self):\n        return self._get_components_and_classes()[1]\n\n    @property\n    def serialized_classes(self):\n        return False\n\n    def _get_components_and_classes(self):\n\n        # The aim of this function is to return whatever is needed for\n        # world_axis_object_components and world_axis_object_classes. It's easier\n        # to figure it out in one go and then return the values and let the\n        # properties return part of it.\n\n        # Since this method might get called quite a few times, we need to cache\n        # it. We start off by defining a hash based on the attributes of the\n        # WCS that matter here (we can't just use the WCS object as a hash since\n        # it is mutable)\n        wcs_hash = (self.naxis,\n                    list(self.wcs.ctype),\n                    list(self.wcs.cunit),\n                    self.wcs.radesys,\n                    self.wcs.specsys,\n                    self.wcs.equinox,\n                    self.wcs.dateobs,\n                    self.wcs.lng,\n                    self.wcs.lat)\n\n        # If the cache is present, we need to check that the 'hash' matches.\n        if getattr(self, '_components_and_classes_cache', None) is not None:\n            cache = self._components_and_classes_cache\n            if cache[0] == wcs_hash:\n                return cache[1]\n            else:\n                self._components_and_classes_cache = None\n\n        # Avoid circular imports by importing here\n        from astropy.wcs.utils import wcs_to_celestial_frame\n        from astropy.coordinates import SkyCoord, EarthLocation\n        from astropy.time.formats import FITS_DEPRECATED_SCALES\n        from astropy.time import Time, TimeDelta\n\n        components = [None] * self.naxis\n        classes = {}\n\n        # Let's start off by checking whether the WCS has a pair of celestial\n        # components\n\n        if self.has_celestial:\n\n            try:\n                celestial_frame = wcs_to_celestial_frame(self)\n            except ValueError:\n                # Some WCSes, e.g. solar, can be recognized by WCSLIB as being\n                # celestial but we don't necessarily have frames for them.\n                celestial_frame = None\n            else:\n\n                kwargs = {}\n                kwargs['frame'] = celestial_frame\n                kwargs['unit'] = u.deg\n\n                classes['celestial'] = (SkyCoord, (), kwargs)\n\n                components[self.wcs.lng] = ('celestial', 0, 'spherical.lon.degree')\n                components[self.wcs.lat] = ('celestial', 1, 'spherical.lat.degree')\n\n        # Next, we check for spectral components\n\n        if self.has_spectral:\n\n            # Find index of spectral coordinate\n            ispec = self.wcs.spec\n            ctype = self.wcs.ctype[ispec][:4]\n            ctype = ctype.upper()\n\n            kwargs = {}\n\n            # Determine observer location and velocity\n\n            # TODO: determine how WCS standard would deal with observer on a\n            # spacecraft far from earth. For now assume the obsgeo parameters,\n            # if present, give the geocentric observer location.\n\n            if np.isnan(self.wcs.obsgeo[0]):\n                observer = None\n            else:\n\n                earth_location = EarthLocation(*self.wcs.obsgeo[:3], unit=u.m)\n                obstime = Time(self.wcs.mjdobs, format='mjd', scale='utc',\n                               location=earth_location)\n                observer_location = SkyCoord(earth_location.get_itrs(obstime=obstime))\n\n                if self.wcs.specsys in VELOCITY_FRAMES:\n                    frame = VELOCITY_FRAMES[self.wcs.specsys]\n                    observer = observer_location.transform_to(frame)\n                    if isinstance(frame, str):\n                        observer = attach_zero_velocities(observer)\n                    else:\n                        observer = update_differentials_to_match(observer_location,\n                                                                 VELOCITY_FRAMES[self.wcs.specsys],\n                                                                 preserve_observer_frame=True)\n                elif self.wcs.specsys == 'TOPOCENT':\n                    observer = attach_zero_velocities(observer_location)\n                else:\n                    raise NotImplementedError(f'SPECSYS={self.wcs.specsys} not yet supported')\n\n            # Determine target\n\n            # This is tricker. In principle the target for each pixel is the\n            # celestial coordinates of the pixel, but we then need to be very\n            # careful about SSYSOBS which is tricky. For now, we set the\n            # target using the reference celestial coordinate in the WCS (if\n            # any).\n\n            if self.has_celestial and celestial_frame is not None:\n\n                # NOTE: celestial_frame was defined higher up\n\n                # NOTE: we set the distance explicitly to avoid warnings in SpectralCoord\n\n                target = SkyCoord(self.wcs.crval[self.wcs.lng] * self.wcs.cunit[self.wcs.lng],\n                                  self.wcs.crval[self.wcs.lat] * self.wcs.cunit[self.wcs.lat],\n                                  frame=celestial_frame,\n                                  distance=1000 * u.kpc)\n\n                target = attach_zero_velocities(target)\n\n            else:\n\n                target = None\n\n            # SpectralCoord does not work properly if either observer or target\n            # are not convertible to ICRS, so if this is the case, we (for now)\n            # drop the observer and target from the SpectralCoord and warn the\n            # user.\n\n            if observer is not None:\n                try:\n                    observer.transform_to(ICRS())\n                except Exception:\n                    warnings.warn('observer cannot be converted to ICRS, so will '\n                                  'not be set on SpectralCoord', AstropyUserWarning)\n                    observer = None\n\n            if target is not None:\n                try:\n                    target.transform_to(ICRS())\n                except Exception:\n                    warnings.warn('target cannot be converted to ICRS, so will '\n                                  'not be set on SpectralCoord', AstropyUserWarning)\n                    target = None\n\n            # NOTE: below we include Quantity in classes['spectral'] instead\n            # of SpectralCoord - this is because we want to also be able to\n            # accept plain quantities.\n\n            if ctype == 'ZOPT':\n\n                def spectralcoord_from_redshift(redshift):\n                    if isinstance(redshift, SpectralCoord):\n                        return redshift\n                    return SpectralCoord((redshift + 1) * self.wcs.restwav,\n                                         unit=u.m, observer=observer, target=target)\n\n                def redshift_from_spectralcoord(spectralcoord):\n                    # TODO: check target is consistent\n                    if observer is None:\n                        warnings.warn('No observer defined on WCS, SpectralCoord '\n                                      'will be converted without any velocity '\n                                      'frame change', AstropyUserWarning)\n                        return spectralcoord.to_value(u.m) / self.wcs.restwav - 1.\n                    else:\n                        return spectralcoord.with_observer_stationary_relative_to(observer).to_value(u.m) / self.wcs.restwav - 1.\n\n                classes['spectral'] = (u.Quantity, (), {}, spectralcoord_from_redshift)\n                components[self.wcs.spec] = ('spectral', 0, redshift_from_spectralcoord)\n\n            elif ctype == 'BETA':\n\n                def spectralcoord_from_beta(beta):\n                    if isinstance(beta, SpectralCoord):\n                        return beta\n                    return SpectralCoord(beta * C_SI,\n                                         unit=u.m / u.s,\n                                         doppler_convention='relativistic',\n                                         doppler_rest=self.wcs.restwav * u.m,\n                                         observer=observer, target=target)\n\n                def beta_from_spectralcoord(spectralcoord):\n                    # TODO: check target is consistent\n                    doppler_equiv = u.doppler_relativistic(self.wcs.restwav * u.m)\n                    if observer is None:\n                        warnings.warn('No observer defined on WCS, SpectralCoord '\n                                      'will be converted without any velocity '\n                                      'frame change', AstropyUserWarning)\n                        return spectralcoord.to_value(u.m / u.s, doppler_equiv) / C_SI\n                    else:\n                        return spectralcoord.with_observer_stationary_relative_to(observer).to_value(u.m / u.s, doppler_equiv) / C_SI\n\n                classes['spectral'] = (u.Quantity, (), {}, spectralcoord_from_beta)\n                components[self.wcs.spec] = ('spectral', 0, beta_from_spectralcoord)\n\n            else:\n\n                kwargs['unit'] = self.wcs.cunit[ispec]\n\n                if self.wcs.restfrq > 0:\n                    if ctype == 'VELO':\n                        kwargs['doppler_convention'] = 'relativistic'\n                        kwargs['doppler_rest'] = self.wcs.restfrq * u.Hz\n                    elif ctype == 'VRAD':\n                        kwargs['doppler_convention'] = 'radio'\n                        kwargs['doppler_rest'] = self.wcs.restfrq * u.Hz\n                    elif ctype == 'VOPT':\n                        kwargs['doppler_convention'] = 'optical'\n                        kwargs['doppler_rest'] = self.wcs.restwav * u.m\n\n                def spectralcoord_from_value(value):\n                    return SpectralCoord(value, observer=observer, target=target, **kwargs)\n\n                def value_from_spectralcoord(spectralcoord):\n                    # TODO: check target is consistent\n                    if observer is None:\n                        warnings.warn('No observer defined on WCS, SpectralCoord '\n                                      'will be converted without any velocity '\n                                      'frame change', AstropyUserWarning)\n                        return spectralcoord.to_value(**kwargs)\n                    else:\n                        return spectralcoord.with_observer_stationary_relative_to(observer).to_value(**kwargs)\n\n                classes['spectral'] = (u.Quantity, (), {}, spectralcoord_from_value)\n                components[self.wcs.spec] = ('spectral', 0, value_from_spectralcoord)\n\n        # We can then make sure we correctly return Time objects where appropriate\n        # (https://www.aanda.org/articles/aa/pdf/2015/02/aa24653-14.pdf)\n\n        if 'time' in self.world_axis_physical_types:\n\n            multiple_time = self.world_axis_physical_types.count('time') > 1\n\n            for i in range(self.naxis):\n\n                if self.world_axis_physical_types[i] == 'time':\n\n                    if multiple_time:\n                        name = f'time.{i}'\n                    else:\n                        name = 'time'\n\n                    # Initialize delta\n                    reference_time_delta = None\n\n                    # Extract time scale\n                    scale = self.wcs.ctype[i].lower()\n\n                    if scale == 'time':\n                        if self.wcs.timesys:\n                            scale = self.wcs.timesys.lower()\n                        else:\n                            scale = 'utc'\n\n                    # Drop sub-scales\n                    if '(' in scale:\n                        pos = scale.index('(')\n                        scale, subscale = scale[:pos], scale[pos+1:-1]\n                        warnings.warn(f'Dropping unsupported sub-scale '\n                                      f'{subscale.upper()} from scale {scale.upper()}',\n                                      UserWarning)\n\n                    # TODO: consider having GPS as a scale in Time\n                    # For now GPS is not a scale, we approximate this by TAI - 19s\n                    if scale == 'gps':\n                        reference_time_delta = TimeDelta(19, format='sec')\n                        scale = 'tai'\n\n                    elif scale.upper() in FITS_DEPRECATED_SCALES:\n                        scale = FITS_DEPRECATED_SCALES[scale.upper()]\n\n                    elif scale not in Time.SCALES:\n                        raise ValueError(f'Unrecognized time CTYPE={self.wcs.ctype[i]}')\n\n                    # Determine location\n                    trefpos = self.wcs.trefpos.lower()\n\n                    if trefpos.startswith('topocent'):\n                        # Note that some headers use TOPOCENT instead of TOPOCENTER\n                        if np.any(np.isnan(self.wcs.obsgeo[:3])):\n                            warnings.warn('Missing or incomplete observer location '\n                                          'information, setting location in Time to None',\n                                          UserWarning)\n                            location = None\n                        else:\n                            location = EarthLocation(*self.wcs.obsgeo[:3], unit=u.m)\n                    elif trefpos == 'geocenter':\n                        location = EarthLocation(0, 0, 0, unit=u.m)\n                    elif trefpos == '':\n                        location = None\n                    else:\n                        # TODO: implement support for more locations when Time supports it\n                        warnings.warn(f\"Observation location '{trefpos}' is not \"\n                                       \"supported, setting location in Time to None\", UserWarning)\n                        location = None\n\n                    reference_time = Time(np.nan_to_num(self.wcs.mjdref[0]),\n                                          np.nan_to_num(self.wcs.mjdref[1]),\n                                          format='mjd', scale=scale,\n                                          location=location)\n\n                    if reference_time_delta is not None:\n                        reference_time = reference_time + reference_time_delta\n\n                    def time_from_reference_and_offset(offset):\n                        if isinstance(offset, Time):\n                            return offset\n                        return reference_time + TimeDelta(offset, format='sec')\n\n                    def offset_from_time_and_reference(time):\n                        return (time - reference_time).sec\n\n                    classes[name] = (Time, (), {}, time_from_reference_and_offset)\n                    components[i] = (name, 0, offset_from_time_and_reference)\n\n        # Fallback: for any remaining components that haven't been identified, just\n        # return Quantity as the class to use\n\n        for i in range(self.naxis):\n            if components[i] is None:\n                name = self.wcs.ctype[i].split('-')[0].lower()\n                if name == '':\n                    name = 'world'\n                while name in classes:\n                    name += \"_\"\n                classes[name] = (u.Quantity, (), {'unit': self.wcs.cunit[i]})\n                components[i] = (name, 0, 'value')\n\n        # Keep a cached version of result\n        self._components_and_classes_cache = wcs_hash, (components, classes)\n\n        return components, classes\n"},{"col":4,"comment":"null","endLoc":80,"header":"def __str__(self)","id":7712,"name":"__str__","nodeType":"Function","startLoc":79,"text":"def __str__(self):\n        return wcs_info_str(self.low_level_wcs)"},{"col":4,"comment":"null","endLoc":83,"header":"def __repr__(self)","id":7713,"name":"__repr__","nodeType":"Function","startLoc":82,"text":"def __repr__(self):\n        return f\"{object.__repr__(self)}\\n{str(self)}\""},{"className":"Galactic","col":0,"comment":"\n    A coordinate or frame in the Galactic coordinate system.\n\n    This frame is used in a variety of Galactic contexts because it has as its\n    x-y plane the plane of the Milky Way.  The positive x direction (i.e., the\n    l=0, b=0 direction) points to the center of the Milky Way and the z-axis\n    points toward the North Galactic Pole (following the IAU's 1958 definition\n    [1]_). However, unlike the `~astropy.coordinates.Galactocentric` frame, the\n    *origin* of this frame in 3D space is the solar system barycenter, not\n    the center of the Milky Way.\n    ","endLoc":97,"id":7714,"nodeType":"Class","startLoc":46,"text":"@format_doc(base_doc, components=doc_components, footer=doc_footer)\nclass Galactic(BaseCoordinateFrame):\n    \"\"\"\n    A coordinate or frame in the Galactic coordinate system.\n\n    This frame is used in a variety of Galactic contexts because it has as its\n    x-y plane the plane of the Milky Way.  The positive x direction (i.e., the\n    l=0, b=0 direction) points to the center of the Milky Way and the z-axis\n    points toward the North Galactic Pole (following the IAU's 1958 definition\n    [1]_). However, unlike the `~astropy.coordinates.Galactocentric` frame, the\n    *origin* of this frame in 3D space is the solar system barycenter, not\n    the center of the Milky Way.\n    \"\"\"\n\n    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'l'),\n            RepresentationMapping('lat', 'b')\n        ],\n        r.CartesianRepresentation: [\n            RepresentationMapping('x', 'u'),\n            RepresentationMapping('y', 'v'),\n            RepresentationMapping('z', 'w')\n        ],\n        r.CartesianDifferential: [\n            RepresentationMapping('d_x', 'U', u.km/u.s),\n            RepresentationMapping('d_y', 'V', u.km/u.s),\n            RepresentationMapping('d_z', 'W', u.km/u.s)\n        ]\n    }\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential\n\n    # North galactic pole and zeropoint of l in FK4/FK5 coordinates. Needed for\n    # transformations to/from FK4/5\n\n    # These are from the IAU's definition of galactic coordinates\n    _ngp_B1950 = FK4NoETerms(ra=192.25*u.degree, dec=27.4*u.degree)\n    _lon0_B1950 = Angle(123, u.degree)\n\n    # These are *not* from Reid & Brunthaler 2004 - instead, they were\n    # derived by doing:\n    #\n    # >>> FK4NoETerms(ra=192.25*u.degree, dec=27.4*u.degree).transform_to(FK5())\n    #\n    # This gives better consistency with other codes than using the values\n    # from Reid & Brunthaler 2004 and the best self-consistency between FK5\n    # -> Galactic and FK5 -> FK4 -> Galactic. The lon0 angle was found by\n    # optimizing the self-consistency.\n    _ngp_J2000 = FK5(ra=192.8594812065348*u.degree, dec=27.12825118085622*u.degree)\n    _lon0_J2000 = Angle(122.9319185680026, u.degree)"},{"attributeType":"BaseLowLevelWCS","col":8,"comment":"null","endLoc":18,"id":7715,"name":"_low_level_wcs","nodeType":"Attribute","startLoc":18,"text":"self._low_level_wcs"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":7716,"name":"__all__","nodeType":"Attribute","startLoc":5,"text":"__all__"},{"col":0,"comment":"","endLoc":1,"header":"high_level_wcs_wrapper.py#<anonymous>","id":7717,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"__all__ = ['HighLevelWCSWrapper']"},{"col":4,"comment":"null","endLoc":1122,"header":"@BaseRepresentationOrDifferential.shape.setter\n    def shape(self, shape)","id":7718,"name":"shape","nodeType":"Function","startLoc":1106,"text":"@BaseRepresentationOrDifferential.shape.setter\n    def shape(self, shape):\n        orig_shape = self.shape\n\n        # See: https://stackoverflow.com/questions/3336767/ for an example\n        BaseRepresentationOrDifferential.shape.fset(self, shape)\n\n        # also try to perform shape-setting on any associated differentials\n        try:\n            for k in self.differentials:\n                self.differentials[k].shape = shape\n        except Exception:\n            BaseRepresentationOrDifferential.shape.fset(self, orig_shape)\n            for k in self.differentials:\n                self.differentials[k].shape = orig_shape\n\n            raise"},{"fileName":"conftest.py","filePath":"astropy/wcs/wcsapi","id":7719,"nodeType":"File","text":"import pytest\nimport numpy as np\n\nfrom astropy.coordinates import SkyCoord\nfrom astropy.units import Quantity\nfrom astropy.wcs import WCS\nfrom astropy.wcs.wcsapi import BaseLowLevelWCS\n\n# NOTE: This module is deprecated and is emitting warning.\ncollect_ignore = ['sliced_low_level_wcs.py']\n\n\n@pytest.fixture\ndef spectral_1d_fitswcs():\n    wcs = WCS(naxis=1)\n    wcs.wcs.ctype = 'FREQ',\n    wcs.wcs.cunit = 'Hz',\n    wcs.wcs.cdelt = 3.e9,\n    wcs.wcs.crval = 4.e9,\n    wcs.wcs.crpix = 11.,\n    wcs.wcs.cname = 'Frequency',\n    return wcs\n\n\n@pytest.fixture\ndef time_1d_fitswcs():\n    wcs = WCS(naxis=1)\n    wcs.wcs.ctype = 'TIME',\n    wcs.wcs.mjdref = (30042, 0)\n    wcs.wcs.crval = 3.,\n    wcs.wcs.crpix = 11.,\n    wcs.wcs.cname = 'Time',\n    wcs.wcs.cunit = 's'\n    return wcs\n\n\n@pytest.fixture\ndef celestial_2d_fitswcs():\n    wcs = WCS(naxis=2)\n    wcs.wcs.ctype = 'RA---CAR', 'DEC--CAR'\n    wcs.wcs.cunit = 'deg', 'deg'\n    wcs.wcs.cdelt = -2., 2.\n    wcs.wcs.crval = 4., 0.\n    wcs.wcs.crpix = 6., 7.\n    wcs.wcs.cname = 'Right Ascension', 'Declination'\n    wcs.pixel_shape = (6, 7)\n    wcs.pixel_bounds = [(-1, 5), (1, 7)]\n    return wcs\n\n\n@pytest.fixture\ndef spectral_cube_3d_fitswcs():\n    wcs = WCS(naxis=3)\n    wcs.wcs.ctype = 'RA---CAR', 'DEC--CAR', 'FREQ'\n    wcs.wcs.cunit = 'deg', 'deg', 'Hz'\n    wcs.wcs.cdelt = -2., 2., 3.e9\n    wcs.wcs.crval = 4., 0., 4.e9\n    wcs.wcs.crpix = 6., 7., 11.\n    wcs.wcs.cname = 'Right Ascension', 'Declination', 'Frequency'\n    wcs.pixel_shape = (6, 7, 3)\n    wcs.pixel_bounds = [(-1, 5), (1, 7), (1, 2.5)]\n    return wcs\n\n\n@pytest.fixture\ndef cube_4d_fitswcs():\n    wcs = WCS(naxis=4)\n    wcs.wcs.ctype = 'RA---CAR', 'DEC--CAR', 'FREQ', 'TIME'\n    wcs.wcs.cunit = 'deg', 'deg', 'Hz', 's'\n    wcs.wcs.cdelt = -2., 2., 3.e9, 1\n    wcs.wcs.crval = 4., 0., 4.e9, 3,\n    wcs.wcs.crpix = 6., 7., 11., 11.\n    wcs.wcs.cname = 'Right Ascension', 'Declination', 'Frequency', 'Time'\n    wcs.wcs.mjdref = (30042, 0)\n    return wcs\n\n\nclass Spectral1DLowLevelWCS(BaseLowLevelWCS):\n\n    @property\n    def pixel_n_dim(self):\n        return 1\n\n    @property\n    def world_n_dim(self):\n        return 1\n\n    @property\n    def world_axis_physical_types(self):\n        return 'em.freq',\n\n    @property\n    def world_axis_units(self):\n        return 'Hz',\n\n    @property\n    def world_axis_names(self):\n        return 'Frequency',\n\n    _pixel_shape = None\n\n    @property\n    def pixel_shape(self):\n        return self._pixel_shape\n\n    @pixel_shape.setter\n    def pixel_shape(self, value):\n        self._pixel_shape = value\n\n    _pixel_bounds = None\n\n    @property\n    def pixel_bounds(self):\n        return self._pixel_bounds\n\n    @pixel_bounds.setter\n    def pixel_bounds(self, value):\n        self._pixel_bounds = value\n\n    def pixel_to_world_values(self, pixel_array):\n        return np.asarray(pixel_array - 10) * 3e9 + 4e9\n\n    def world_to_pixel_values(self, world_array):\n        return np.asarray(world_array - 4e9) / 3e9 + 10\n\n    @property\n    def world_axis_object_components(self):\n        return ('test', 0, 'value'),\n\n    @property\n    def world_axis_object_classes(self):\n        return {'test': (Quantity, (), {'unit': 'Hz'})}\n\n\n@pytest.fixture\ndef spectral_1d_ape14_wcs():\n    return Spectral1DLowLevelWCS()\n\n\nclass Celestial2DLowLevelWCS(BaseLowLevelWCS):\n\n    @property\n    def pixel_n_dim(self):\n        return 2\n\n    @property\n    def world_n_dim(self):\n        return 2\n\n    @property\n    def world_axis_physical_types(self):\n        return 'pos.eq.ra', 'pos.eq.dec'\n\n    @property\n    def world_axis_units(self):\n        return 'deg', 'deg'\n\n    @property\n    def world_axis_names(self):\n        return 'Right Ascension', 'Declination'\n\n    @property\n    def pixel_shape(self):\n        return (6, 7)\n\n    @property\n    def pixel_bounds(self):\n        return (-1, 5), (1, 7)\n\n    def pixel_to_world_values(self, px, py):\n        return (-(np.asarray(px) - 5.) * 2 + 4.,\n                (np.asarray(py) - 6.) * 2)\n\n    def world_to_pixel_values(self, wx, wy):\n        return (-(np.asarray(wx) - 4.) / 2 + 5.,\n                np.asarray(wy) / 2 + 6.)\n\n    @property\n    def world_axis_object_components(self):\n        return [('test', 0, 'spherical.lon.degree'),\n                ('test', 1, 'spherical.lat.degree')]\n\n    @property\n    def world_axis_object_classes(self):\n        return {'test': (SkyCoord, (), {'unit': 'deg'})}\n\n\n@pytest.fixture\ndef celestial_2d_ape14_wcs():\n    return Celestial2DLowLevelWCS()\n"},{"col":4,"comment":"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.\n\n        Note that any associated differentials will be dropped during this\n        operation.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        ","endLoc":1141,"header":"def norm(self)","id":7720,"name":"norm","nodeType":"Function","startLoc":1124,"text":"def norm(self):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.\n\n        Note that any associated differentials will be dropped during this\n        operation.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\n        return np.sqrt(functools.reduce(\n            operator.add, (getattr(self, component)**2\n                           for component, cls in self.attr_classes.items()\n                           if not issubclass(cls, Angle))))"},{"attributeType":"null","col":4,"comment":"null","endLoc":60,"id":7721,"name":"frame_specific_representation_info","nodeType":"Attribute","startLoc":60,"text":"frame_specific_representation_info"},{"className":"Spectral1DLowLevelWCS","col":0,"comment":"null","endLoc":132,"id":7722,"nodeType":"Class","startLoc":78,"text":"class Spectral1DLowLevelWCS(BaseLowLevelWCS):\n\n    @property\n    def pixel_n_dim(self):\n        return 1\n\n    @property\n    def world_n_dim(self):\n        return 1\n\n    @property\n    def world_axis_physical_types(self):\n        return 'em.freq',\n\n    @property\n    def world_axis_units(self):\n        return 'Hz',\n\n    @property\n    def world_axis_names(self):\n        return 'Frequency',\n\n    _pixel_shape = None\n\n    @property\n    def pixel_shape(self):\n        return self._pixel_shape\n\n    @pixel_shape.setter\n    def pixel_shape(self, value):\n        self._pixel_shape = value\n\n    _pixel_bounds = None\n\n    @property\n    def pixel_bounds(self):\n        return self._pixel_bounds\n\n    @pixel_bounds.setter\n    def pixel_bounds(self, value):\n        self._pixel_bounds = value\n\n    def pixel_to_world_values(self, pixel_array):\n        return np.asarray(pixel_array - 10) * 3e9 + 4e9\n\n    def world_to_pixel_values(self, world_array):\n        return np.asarray(world_array - 4e9) / 3e9 + 10\n\n    @property\n    def world_axis_object_components(self):\n        return ('test', 0, 'value'),\n\n    @property\n    def world_axis_object_classes(self):\n        return {'test': (Quantity, (), {'unit': 'Hz'})}"},{"col":0,"comment":"null","endLoc":33,"header":"@pytest.fixture(scope='module')\ndef tab_wcsh_2di()","id":7723,"name":"tab_wcsh_2di","nodeType":"Function","startLoc":23,"text":"@pytest.fixture(scope='module')\ndef tab_wcsh_2di():\n    model = SimModelTAB(nx=150, ny=200)\n\n    # generate FITS HDU list:\n    hdulist = model.hdulist\n\n    # create WCS object:\n    w = wcs.WCS(hdulist[0].header, hdulist)\n\n    return w, hdulist"},{"col":4,"comment":"null","endLoc":82,"header":"@property\n    def pixel_n_dim(self)","id":7724,"name":"pixel_n_dim","nodeType":"Function","startLoc":80,"text":"@property\n    def pixel_n_dim(self):\n        return 1"},{"col":4,"comment":"null","endLoc":86,"header":"@property\n    def world_n_dim(self)","id":7725,"name":"world_n_dim","nodeType":"Function","startLoc":84,"text":"@property\n    def world_n_dim(self):\n        return 1"},{"col":4,"comment":"null","endLoc":90,"header":"@property\n    def world_axis_physical_types(self)","id":7726,"name":"world_axis_physical_types","nodeType":"Function","startLoc":88,"text":"@property\n    def world_axis_physical_types(self):\n        return 'em.freq',"},{"col":4,"comment":"null","endLoc":94,"header":"@property\n    def world_axis_units(self)","id":7727,"name":"world_axis_units","nodeType":"Function","startLoc":92,"text":"@property\n    def world_axis_units(self):\n        return 'Hz',"},{"col":4,"comment":"null","endLoc":98,"header":"@property\n    def world_axis_names(self)","id":7728,"name":"world_axis_names","nodeType":"Function","startLoc":96,"text":"@property\n    def world_axis_names(self):\n        return 'Frequency',"},{"col":4,"comment":"null","endLoc":104,"header":"@property\n    def pixel_shape(self)","id":7729,"name":"pixel_shape","nodeType":"Function","startLoc":102,"text":"@property\n    def pixel_shape(self):\n        return self._pixel_shape"},{"col":4,"comment":"null","endLoc":108,"header":"@pixel_shape.setter\n    def pixel_shape(self, value)","id":7730,"name":"pixel_shape","nodeType":"Function","startLoc":106,"text":"@pixel_shape.setter\n    def pixel_shape(self, value):\n        self._pixel_shape = value"},{"col":4,"comment":"null","endLoc":114,"header":"@property\n    def pixel_bounds(self)","id":7731,"name":"pixel_bounds","nodeType":"Function","startLoc":112,"text":"@property\n    def pixel_bounds(self):\n        return self._pixel_bounds"},{"col":4,"comment":"null","endLoc":118,"header":"@pixel_bounds.setter\n    def pixel_bounds(self, value)","id":7732,"name":"pixel_bounds","nodeType":"Function","startLoc":116,"text":"@pixel_bounds.setter\n    def pixel_bounds(self, value):\n        self._pixel_bounds = value"},{"col":4,"comment":"null","endLoc":121,"header":"def pixel_to_world_values(self, pixel_array)","id":7733,"name":"pixel_to_world_values","nodeType":"Function","startLoc":120,"text":"def pixel_to_world_values(self, pixel_array):\n        return np.asarray(pixel_array - 10) * 3e9 + 4e9"},{"col":4,"comment":"null","endLoc":124,"header":"def world_to_pixel_values(self, world_array)","id":7734,"name":"world_to_pixel_values","nodeType":"Function","startLoc":123,"text":"def world_to_pixel_values(self, world_array):\n        return np.asarray(world_array - 4e9) / 3e9 + 10"},{"col":4,"comment":"null","endLoc":128,"header":"@property\n    def world_axis_object_components(self)","id":7735,"name":"world_axis_object_components","nodeType":"Function","startLoc":126,"text":"@property\n    def world_axis_object_components(self):\n        return ('test', 0, 'value'),"},{"col":4,"comment":"null","endLoc":132,"header":"@property\n    def world_axis_object_classes(self)","id":7736,"name":"world_axis_object_classes","nodeType":"Function","startLoc":130,"text":"@property\n    def world_axis_object_classes(self):\n        return {'test': (Quantity, (), {'unit': 'Hz'})}"},{"attributeType":"None","col":4,"comment":"null","endLoc":100,"id":7737,"name":"_pixel_shape","nodeType":"Attribute","startLoc":100,"text":"_pixel_shape"},{"attributeType":"None","col":4,"comment":"null","endLoc":110,"id":7738,"name":"_pixel_bounds","nodeType":"Attribute","startLoc":110,"text":"_pixel_bounds"},{"col":4,"comment":"Vector mean.\n\n        Averaging is done by converting the representation to cartesian, and\n        taking the mean of the x, y, and z components. The result is converted\n        back to the same representation as the input.\n\n        Refer to `~numpy.mean` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n\n        Returns\n        -------\n        mean : `~astropy.coordinates.BaseRepresentation` subclass instance\n            Vector mean, in the same representation as that of the input.\n        ","endLoc":1160,"header":"def mean(self, *args, **kwargs)","id":7739,"name":"mean","nodeType":"Function","startLoc":1143,"text":"def mean(self, *args, **kwargs):\n        \"\"\"Vector mean.\n\n        Averaging is done by converting the representation to cartesian, and\n        taking the mean of the x, y, and z components. The result is converted\n        back to the same representation as the input.\n\n        Refer to `~numpy.mean` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n\n        Returns\n        -------\n        mean : `~astropy.coordinates.BaseRepresentation` subclass instance\n            Vector mean, in the same representation as that of the input.\n        \"\"\"\n        self._raise_if_has_differentials('mean')\n        return self.from_cartesian(self.to_cartesian().mean(*args, **kwargs))"},{"attributeType":"null","col":8,"comment":"null","endLoc":118,"id":7740,"name":"_pixel_bounds","nodeType":"Attribute","startLoc":118,"text":"self._pixel_bounds"},{"attributeType":"null","col":4,"comment":"null","endLoc":77,"id":7741,"name":"default_representation","nodeType":"Attribute","startLoc":77,"text":"default_representation"},{"attributeType":"null","col":8,"comment":"null","endLoc":108,"id":7742,"name":"_pixel_shape","nodeType":"Attribute","startLoc":108,"text":"self._pixel_shape"},{"className":"Celestial2DLowLevelWCS","col":0,"comment":"null","endLoc":185,"id":7743,"nodeType":"Class","startLoc":140,"text":"class Celestial2DLowLevelWCS(BaseLowLevelWCS):\n\n    @property\n    def pixel_n_dim(self):\n        return 2\n\n    @property\n    def world_n_dim(self):\n        return 2\n\n    @property\n    def world_axis_physical_types(self):\n        return 'pos.eq.ra', 'pos.eq.dec'\n\n    @property\n    def world_axis_units(self):\n        return 'deg', 'deg'\n\n    @property\n    def world_axis_names(self):\n        return 'Right Ascension', 'Declination'\n\n    @property\n    def pixel_shape(self):\n        return (6, 7)\n\n    @property\n    def pixel_bounds(self):\n        return (-1, 5), (1, 7)\n\n    def pixel_to_world_values(self, px, py):\n        return (-(np.asarray(px) - 5.) * 2 + 4.,\n                (np.asarray(py) - 6.) * 2)\n\n    def world_to_pixel_values(self, wx, wy):\n        return (-(np.asarray(wx) - 4.) / 2 + 5.,\n                np.asarray(wy) / 2 + 6.)\n\n    @property\n    def world_axis_object_components(self):\n        return [('test', 0, 'spherical.lon.degree'),\n                ('test', 1, 'spherical.lat.degree')]\n\n    @property\n    def world_axis_object_classes(self):\n        return {'test': (SkyCoord, (), {'unit': 'deg'})}"},{"attributeType":"null","col":4,"comment":"null","endLoc":78,"id":7744,"name":"default_differential","nodeType":"Attribute","startLoc":78,"text":"default_differential"},{"col":4,"comment":"null","endLoc":144,"header":"@property\n    def pixel_n_dim(self)","id":7745,"name":"pixel_n_dim","nodeType":"Function","startLoc":142,"text":"@property\n    def pixel_n_dim(self):\n        return 2"},{"col":4,"comment":"null","endLoc":148,"header":"@property\n    def world_n_dim(self)","id":7746,"name":"world_n_dim","nodeType":"Function","startLoc":146,"text":"@property\n    def world_n_dim(self):\n        return 2"},{"col":4,"comment":"null","endLoc":152,"header":"@property\n    def world_axis_physical_types(self)","id":7747,"name":"world_axis_physical_types","nodeType":"Function","startLoc":150,"text":"@property\n    def world_axis_physical_types(self):\n        return 'pos.eq.ra', 'pos.eq.dec'"},{"col":4,"comment":"null","endLoc":156,"header":"@property\n    def world_axis_units(self)","id":7748,"name":"world_axis_units","nodeType":"Function","startLoc":154,"text":"@property\n    def world_axis_units(self):\n        return 'deg', 'deg'"},{"col":4,"comment":"null","endLoc":160,"header":"@property\n    def world_axis_names(self)","id":7749,"name":"world_axis_names","nodeType":"Function","startLoc":158,"text":"@property\n    def world_axis_names(self):\n        return 'Right Ascension', 'Declination'"},{"col":4,"comment":"null","endLoc":164,"header":"@property\n    def pixel_shape(self)","id":7750,"name":"pixel_shape","nodeType":"Function","startLoc":162,"text":"@property\n    def pixel_shape(self):\n        return (6, 7)"},{"col":4,"comment":"null","endLoc":168,"header":"@property\n    def pixel_bounds(self)","id":7751,"name":"pixel_bounds","nodeType":"Function","startLoc":166,"text":"@property\n    def pixel_bounds(self):\n        return (-1, 5), (1, 7)"},{"col":4,"comment":"null","endLoc":172,"header":"def pixel_to_world_values(self, px, py)","id":7752,"name":"pixel_to_world_values","nodeType":"Function","startLoc":170,"text":"def pixel_to_world_values(self, px, py):\n        return (-(np.asarray(px) - 5.) * 2 + 4.,\n                (np.asarray(py) - 6.) * 2)"},{"attributeType":"null","col":4,"comment":"null","endLoc":84,"id":7753,"name":"_ngp_B1950","nodeType":"Attribute","startLoc":84,"text":"_ngp_B1950"},{"col":4,"comment":"null","endLoc":176,"header":"def world_to_pixel_values(self, wx, wy)","id":7754,"name":"world_to_pixel_values","nodeType":"Function","startLoc":174,"text":"def world_to_pixel_values(self, wx, wy):\n        return (-(np.asarray(wx) - 4.) / 2 + 5.,\n                np.asarray(wy) / 2 + 6.)"},{"attributeType":"null","col":4,"comment":"null","endLoc":85,"id":7755,"name":"_lon0_B1950","nodeType":"Attribute","startLoc":85,"text":"_lon0_B1950"},{"col":4,"comment":"null","endLoc":181,"header":"@property\n    def world_axis_object_components(self)","id":7756,"name":"world_axis_object_components","nodeType":"Function","startLoc":178,"text":"@property\n    def world_axis_object_components(self):\n        return [('test', 0, 'spherical.lon.degree'),\n                ('test', 1, 'spherical.lat.degree')]"},{"col":4,"comment":"null","endLoc":185,"header":"@property\n    def world_axis_object_classes(self)","id":7757,"name":"world_axis_object_classes","nodeType":"Function","startLoc":183,"text":"@property\n    def world_axis_object_classes(self):\n        return {'test': (SkyCoord, (), {'unit': 'deg'})}"},{"attributeType":"null","col":4,"comment":"null","endLoc":96,"id":7758,"name":"_ngp_J2000","nodeType":"Attribute","startLoc":96,"text":"_ngp_J2000"},{"col":0,"comment":"null","endLoc":22,"header":"@pytest.fixture\ndef spectral_1d_fitswcs()","id":7759,"name":"spectral_1d_fitswcs","nodeType":"Function","startLoc":13,"text":"@pytest.fixture\ndef spectral_1d_fitswcs():\n    wcs = WCS(naxis=1)\n    wcs.wcs.ctype = 'FREQ',\n    wcs.wcs.cunit = 'Hz',\n    wcs.wcs.cdelt = 3.e9,\n    wcs.wcs.crval = 4.e9,\n    wcs.wcs.crpix = 11.,\n    wcs.wcs.cname = 'Frequency',\n    return wcs"},{"attributeType":"null","col":4,"comment":"null","endLoc":97,"id":7760,"name":"_lon0_J2000","nodeType":"Attribute","startLoc":97,"text":"_lon0_J2000"},{"col":0,"comment":"null","endLoc":46,"header":"@pytest.fixture(scope='function')\ndef tab_wcs_2di_f()","id":7761,"name":"tab_wcs_2di_f","nodeType":"Function","startLoc":36,"text":"@pytest.fixture(scope='function')\ndef tab_wcs_2di_f():\n    model = SimModelTAB(nx=150, ny=200)\n\n    # generate FITS HDU list:\n    hdulist = model.hdulist\n\n    # create WCS object:\n    w = wcs.WCS(hdulist[0].header, hdulist)\n\n    return w"},{"className":"custom_ctype_to_ucd_mapping","col":0,"comment":"\n    A context manager that makes it possible to temporarily add new CTYPE to\n    UCD1+ mapping used by :attr:`FITSWCSAPIMixin.world_axis_physical_types`.\n\n    Parameters\n    ----------\n    mapping : dict\n        A dictionary mapping a CTYPE value to a UCD1+ value\n\n    Examples\n    --------\n\n    Consider a WCS with the following CTYPE::\n\n        >>> from astropy.wcs import WCS\n        >>> wcs = WCS(naxis=1)\n        >>> wcs.wcs.ctype = ['SPAM']\n\n    By default, :attr:`FITSWCSAPIMixin.world_axis_physical_types` returns `None`,\n    but this can be overridden::\n\n        >>> wcs.world_axis_physical_types\n        [None]\n        >>> with custom_ctype_to_ucd_mapping({'SPAM': 'food.spam'}):\n        ...     wcs.world_axis_physical_types\n        ['food.spam']\n    ","endLoc":189,"id":7762,"nodeType":"Class","startLoc":152,"text":"class custom_ctype_to_ucd_mapping:\n    \"\"\"\n    A context manager that makes it possible to temporarily add new CTYPE to\n    UCD1+ mapping used by :attr:`FITSWCSAPIMixin.world_axis_physical_types`.\n\n    Parameters\n    ----------\n    mapping : dict\n        A dictionary mapping a CTYPE value to a UCD1+ value\n\n    Examples\n    --------\n\n    Consider a WCS with the following CTYPE::\n\n        >>> from astropy.wcs import WCS\n        >>> wcs = WCS(naxis=1)\n        >>> wcs.wcs.ctype = ['SPAM']\n\n    By default, :attr:`FITSWCSAPIMixin.world_axis_physical_types` returns `None`,\n    but this can be overridden::\n\n        >>> wcs.world_axis_physical_types\n        [None]\n        >>> with custom_ctype_to_ucd_mapping({'SPAM': 'food.spam'}):\n        ...     wcs.world_axis_physical_types\n        ['food.spam']\n    \"\"\"\n\n    def __init__(self, mapping):\n        CTYPE_TO_UCD1_CUSTOM.insert(0, mapping)\n        self.mapping = mapping\n\n    def __enter__(self):\n        pass\n\n    def __exit__(self, type, value, tb):\n        CTYPE_TO_UCD1_CUSTOM.remove(self.mapping)"},{"col":4,"comment":"null","endLoc":183,"header":"def __init__(self, mapping)","id":7763,"name":"__init__","nodeType":"Function","startLoc":181,"text":"def __init__(self, mapping):\n        CTYPE_TO_UCD1_CUSTOM.insert(0, mapping)\n        self.mapping = mapping"},{"col":4,"comment":"null","endLoc":186,"header":"def __enter__(self)","id":7764,"name":"__enter__","nodeType":"Function","startLoc":185,"text":"def __enter__(self):\n        pass"},{"col":4,"comment":"null","endLoc":189,"header":"def __exit__(self, type, value, tb)","id":7765,"name":"__exit__","nodeType":"Function","startLoc":188,"text":"def __exit__(self, type, value, tb):\n        CTYPE_TO_UCD1_CUSTOM.remove(self.mapping)"},{"attributeType":"null","col":8,"comment":"null","endLoc":183,"id":7766,"name":"mapping","nodeType":"Attribute","startLoc":183,"text":"self.mapping"},{"col":0,"comment":"null","endLoc":54,"header":"@pytest.fixture(scope='function')\ndef prj_TAB()","id":7767,"name":"prj_TAB","nodeType":"Function","startLoc":49,"text":"@pytest.fixture(scope='function')\ndef prj_TAB():\n    prj = wcs.Prjprm()\n    prj.code = 'TAN'\n    prj.set()\n    return prj"},{"col":4,"comment":"Vector mean.\n\n        Returns a new CartesianRepresentation instance with the means of the\n        x, y, and z components.\n\n        Refer to `~numpy.mean` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n        ","endLoc":1450,"header":"def mean(self, *args, **kwargs)","id":7768,"name":"mean","nodeType":"Function","startLoc":1439,"text":"def mean(self, *args, **kwargs):\n        \"\"\"Vector mean.\n\n        Returns a new CartesianRepresentation instance with the means of the\n        x, y, and z components.\n\n        Refer to `~numpy.mean` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n        \"\"\"\n        self._raise_if_has_differentials('mean')\n        return self._apply('mean', *args, **kwargs)"},{"col":4,"comment":"Vector sum.\n\n        Adding is done by converting the representation to cartesian, and\n        summing the x, y, and z components. The result is converted back to the\n        same representation as the input.\n\n        Refer to `~numpy.sum` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n\n        Returns\n        -------\n        sum : `~astropy.coordinates.BaseRepresentation` subclass instance\n            Vector sum, in the same representation as that of the input.\n        ","endLoc":1179,"header":"def sum(self, *args, **kwargs)","id":7769,"name":"sum","nodeType":"Function","startLoc":1162,"text":"def sum(self, *args, **kwargs):\n        \"\"\"Vector sum.\n\n        Adding is done by converting the representation to cartesian, and\n        summing the x, y, and z components. The result is converted back to the\n        same representation as the input.\n\n        Refer to `~numpy.sum` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n\n        Returns\n        -------\n        sum : `~astropy.coordinates.BaseRepresentation` subclass instance\n            Vector sum, in the same representation as that of the input.\n        \"\"\"\n        self._raise_if_has_differentials('sum')\n        return self.from_cartesian(self.to_cartesian().sum(*args, **kwargs))"},{"id":7770,"name":"astropy/wcs/wcsapi/data","nodeType":"Package"},{"id":7771,"name":"ucds.txt","nodeType":"TextFile","path":"astropy/wcs/wcsapi/data","text":"# Copied from UCD1+ v1.23\narith\narith.diff\narith.factor\narith.grad\narith.rate\narith.ratio\narith.zp\nem\nem.radio\nem.radio.20-100MHz\nem.radio.100-200MHz\nem.radio.200-400MHz\nem.radio.400-750MHz\nem.radio.750-1500MHz\nem.radio.1500-3000MHz\nem.radio.3-6GHz\nem.radio.6-12GHz\nem.radio.12-30GHz\nem.mm\nem.mm.30-50GHz\nem.mm.50-100GHz\nem.mm.100-200GHz\nem.mm.200-400GHz\nem.mm.400-750GHz\nem.mm.750-1500GHz\nem.mm.1500-3000GHz\nem.IR\nem.IR.J\nem.IR.H\nem.IR.K\nem.IR.3-4um\nem.IR.4-8um\nem.IR.8-15um\nem.IR.15-30um\nem.IR.30-60um\nem.IR.60-100um\nem.IR.NIR\nem.IR.MIR\nem.IR.FIR\nem.opt\nem.opt.U\nem.opt.B\nem.opt.V\nem.opt.R\nem.opt.I\nem.UV\nem.UV.10-50nm\nem.UV.50-100nm\nem.UV.100-200nm\nem.UV.200-300nm\nem.UV.FUV\nem.X-ray\nem.X-ray.soft\nem.X-ray.medium\nem.X-ray.hard\nem.gamma\nem.gamma.soft\nem.gamma.hard\nem.line\nem.line.Brgamma\nem.line.HI\nem.line.Halpha\nem.line.Hbeta\nem.line.Hgamma\nem.line.Hdelta\nem.line.Lyalpha\nem.line.OIII\nem.line.CO\nem.bin\nem.energy\nem.freq\nem.wavenumber\nem.wl\nem.wl.central\nem.wl.effective\ninstr\ninstr.background\ninstr.bandpass\ninstr.bandwidth\ninstr.baseline\ninstr.beam\ninstr.calib\ninstr.det\ninstr.det.noise\ninstr.det.psf\ninstr.det.qe\ninstr.dispersion\ninstr.filter\ninstr.fov\ninstr.obsty\ninstr.obsty.seeing\ninstr.offset\ninstr.order\ninstr.param\ninstr.pixel\ninstr.plate\ninstr.plate.emulsion\ninstr.precision\ninstr.saturation\ninstr.scale\ninstr.sensitivity\ninstr.setup\ninstr.skyLevel\ninstr.skyTemp\ninstr.tel\ninstr.tel.focalLength\nmeta\nmeta.abstract\nmeta.bib\nmeta.bib.author\nmeta.bib.bibcode\nmeta.bib.fig\nmeta.bib.journal\nmeta.bib.page\nmeta.bib.volume\nmeta.code\nmeta.code.class\nmeta.code.error\nmeta.code.member\nmeta.code.mime\nmeta.code.multip\nmeta.code.qual\nmeta.code.status\nmeta.cryptic\nmeta.curation\nmeta.dataset\nmeta.email\nmeta.file\nmeta.fits\nmeta.id\nmeta.id.assoc\nmeta.id.CoI\nmeta.id.cross\nmeta.id.parent\nmeta.id.part\nmeta.id.PI\nmeta.main\nmeta.modelled\nmeta.note\nmeta.number\nmeta.record\nmeta.ref\nmeta.ref.ivorn\nmeta.ref.uri\nmeta.ref.url\nmeta.software\nmeta.table\nmeta.title\nmeta.ucd\nmeta.unit\nmeta.version\nobs\nobs.airMass\nobs.atmos\nobs.atmos.extinction\nobs.atmos.refractAngle\nobs.calib\nobs.calib.flat\nobs.exposure\nobs.field\nobs.image\nobs.observer\nobs.param\nobs.proposal\nobs.proposal.cycle\nobs.sequence\nphot\nphot.antennaTemp\nphot.calib\nphot.color\nphot.color.excess\nphot.color.reddFree\nphot.count\nphot.fluence\nphot.flux\nphot.flux.bol\nphot.flux.density\nphot.flux.density.sb\nphot.flux.sb\nphot.limbDark\nphot.mag\nphot.mag.bc\nphot.mag.bol\nphot.mag.distMod\nphot.mag.reddFree\nphot.mag.sb\nphys\nphys.SFR\nphys.absorption\nphys.absorption.coeff\nphys.absorption.gal\nphys.absorption.opticalDepth\nphys.abund\nphys.abund.Fe\nphys.abund.X\nphys.abund.Y\nphys.abund.Z\nphys.acceleration\nphys.albedo\nphys.angArea\nphys.angMomentum\nphys.angSize\nphys.angSize.smajAxis\nphys.angSize.sminAxis\nphys.area\nphys.atmol\nphys.atmol.branchingRatio\nphys.atmol.collStrength\nphys.atmol.collisional\nphys.atmol.configuration\nphys.atmol.crossSection\nphys.atmol.element\nphys.atmol.excitation\nphys.atmol.final\nphys.atmol.initial\nphys.atmol.ionStage\nphys.atmol.ionization\nphys.atmol.lande\nphys.atmol.level\nphys.atmol.lifetime\nphys.atmol.lineShift\nphys.atmol.number\nphys.atmol.oscStrength\nphys.atmol.parity\nphys.atmol.qn\nphys.atmol.radiationType\nphys.atmol.symmetry\nphys.atmol.sWeight\nphys.atmol.sWeight.nuclear\nphys.atmol.term\nphys.atmol.transProb\nphys.atmol.transition\nphys.atmol.wOscStrength\nphys.atmol.weight\nphys.columnDensity\nphys.composition\nphys.composition.massLightRatio\nphys.composition.yield\nphys.cosmology\nphys.damping\nphys.density\nphys.dielectric\nphys.dispMeasure\nphys.electField\nphys.electron\nphys.electron.degen\nphys.emissMeasure\nphys.emissivity\nphys.energy\nphys.energy.density\nphys.entropy\nphys.eos\nphys.excitParam\nphys.gauntFactor\nphys.gravity\nphys.ionizParam\nphys.ionizParam.coll\nphys.ionizParam.rad\nphys.luminosity\nphys.luminosity.fun\nphys.magAbs\nphys.magAbs.bol\nphys.magField\nphys.mass\nphys.mass.loss\nphys.mol\nphys.mol.dipole\nphys.mol.dipole.electric\nphys.mol.dipole.magnetic\nphys.mol.dissociation\nphys.mol.formationHeat\nphys.mol.quadrupole\nphys.mol.quadrupole.electric\nphys.mol.rotation\nphys.mol.vibration\nphys.particle.neutrino\nphys.polarization\nphys.polarization.circular\nphys.polarization.linear\nphys.polarization.rotMeasure\nphys.polarization.stokes\nphys.pressure\nphys.recombination.coeff\nphys.refractIndex\nphys.size\nphys.size.axisRatio\nphys.size.diameter\nphys.size.radius\nphys.size.smajAxis\nphys.size.sminAxis\nphys.temperature\nphys.temperature.effective\nphys.temperature.electron\nphys.transmission\nphys.veloc\nphys.veloc.ang\nphys.veloc.dispersion\nphys.veloc.escape\nphys.veloc.expansion\nphys.veloc.microTurb\nphys.veloc.orbital\nphys.veloc.pulsat\nphys.veloc.rotat\nphys.veloc.transverse\nphys.virial\npos\npos.angDistance\npos.angResolution\npos.az\npos.az.alt\npos.az.azi\npos.az.zd\npos.barycenter\npos.bodyrc\npos.bodyrc.alt\npos.bodyrc.lat\npos.bodyrc.lon\npos.cartesian\npos.cartesian.x\npos.cartesian.y\npos.cartesian.z\npos.cmb\npos.dirCos\npos.distance\npos.earth\npos.earth.altitude\npos.earth.lat\npos.earth.lon\npos.ecliptic\npos.ecliptic.lat\npos.ecliptic.lon\npos.eop\npos.eop.nutation\npos.ephem\npos.eq\npos.eq.dec\npos.eq.ha\npos.eq.ra\npos.eq.spd\npos.errorEllipse\npos.frame\npos.galactic\npos.galactic.lat\npos.galactic.lon\npos.galactocentric\npos.geocentric\npos.healpix\npos.heliocentric\npos.HTM\npos.lambert\npos.lg\npos.lsr\npos.lunar\npos.lunar.occult\npos.parallax\npos.parallax.dyn\npos.parallax.phot\npos.parallax.spect\npos.parallax.trig\npos.phaseAng\npos.pm\npos.posAng\npos.precess\npos.supergalactic\npos.supergalactic.lat\npos.supergalactic.lon\npos.wcs\npos.wcs.cdmatrix\npos.wcs.crpix\npos.wcs.crval\npos.wcs.ctype\npos.wcs.naxes\npos.wcs.naxis\npos.wcs.scale\nspect\nspect.binSize\nspect.continuum\nspect.dopplerParam\nspect.dopplerVeloc\nspect.dopplerVeloc.opt\nspect.dopplerVeloc.radio\nspect.index\nspect.line\nspect.line.asymmetry\nspect.line.broad\nspect.line.broad.Stark\nspect.line.broad.Zeeman\nspect.line.eqWidth\nspect.line.intensity\nspect.line.profile\nspect.line.strength\nspect.line.width\nspect.resolution\nsrc\nsrc.calib\nsrc.calib.guideStar\nsrc.class\nsrc.class.color\nsrc.class.distance\nsrc.class.luminosity\nsrc.class.richness\nsrc.class.starGalaxy\nsrc.class.struct\nsrc.density\nsrc.ellipticity\nsrc.impactParam\nsrc.morph\nsrc.morph.param\nsrc.morph.scLength\nsrc.morph.type\nsrc.net\nsrc.orbital\nsrc.orbital.eccentricity\nsrc.orbital.inclination\nsrc.orbital.meanAnomaly\nsrc.orbital.meanMotion\nsrc.orbital.node\nsrc.orbital.periastron\nsrc.redshift\nsrc.redshift.phot\nsrc.sample\nsrc.spType\nsrc.var\nsrc.var.amplitude\nsrc.var.index\nsrc.var.pulse\nstat\nstat.Fourier\nstat.Fourier.amplitude\nstat.correlation\nstat.covariance\nstat.error\nstat.error.sys\nstat.filling\nstat.fit\nstat.fit.chi2\nstat.fit.dof\nstat.fit.goodness\nstat.fit.omc\nstat.fit.param\nstat.fit.residual\nstat.likelihood\nstat.max\nstat.mean\nstat.median\nstat.min\nstat.param\nstat.probability\nstat.snr\nstat.stdev\nstat.uncalib\nstat.value\nstat.variance\nstat.weight\ntime\ntime.age\ntime.creation\ntime.crossing\ntime.duration\ntime.end\ntime.epoch\ntime.equinox\ntime.interval\ntime.lifetime\ntime.period\ntime.phase\ntime.processing\ntime.publiYear\ntime.relax\ntime.release\ntime.resolution\ntime.scale\ntime.start\n"},{"id":7772,"name":"astropy/wcs/wcsapi/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/wcs/wcsapi/tests","id":7773,"nodeType":"File","text":""},{"id":7774,"name":"astropy/wcs/wcsapi/wrappers","nodeType":"Package"},{"fileName":"sliced_wcs.py","filePath":"astropy/wcs/wcsapi/wrappers","id":7775,"nodeType":"File","text":"import numbers\nfrom collections import defaultdict\n\nimport numpy as np\n\nfrom astropy.utils import isiterable\nfrom astropy.utils.decorators import lazyproperty\n\nfrom ..low_level_api import BaseLowLevelWCS\nfrom .base import BaseWCSWrapper\n\n__all__ = ['sanitize_slices', 'SlicedLowLevelWCS']\n\n\ndef sanitize_slices(slices, ndim):\n    \"\"\"\n    Given a slice as input sanitise it to an easier to parse format.format\n\n    This function returns a list ``ndim`` long containing slice objects (or ints).\n    \"\"\"\n\n    if not isinstance(slices, (tuple, list)):  # We just have a single int\n        slices = (slices,)\n\n    if len(slices) > ndim:\n        raise ValueError(\n            f\"The dimensionality of the specified slice {slices} can not be greater \"\n            f\"than the dimensionality ({ndim}) of the wcs.\")\n\n    if any((isiterable(s) for s in slices)):\n        raise IndexError(\"This slice is invalid, only integer or range slices are supported.\")\n\n    slices = list(slices)\n\n    if Ellipsis in slices:\n        if slices.count(Ellipsis) > 1:\n            raise IndexError(\"an index can only have a single ellipsis ('...')\")\n\n        # Replace the Ellipsis with the correct number of slice(None)s\n        e_ind = slices.index(Ellipsis)\n        slices.remove(Ellipsis)\n        n_e = ndim - len(slices)\n        for i in range(n_e):\n            ind = e_ind + i\n            slices.insert(ind, slice(None))\n\n    for i in range(ndim):\n        if i < len(slices):\n            slc = slices[i]\n            if isinstance(slc, slice):\n                if slc.step and slc.step != 1:\n                    raise IndexError(\"Slicing WCS with a step is not supported.\")\n            elif not isinstance(slc, numbers.Integral):\n                raise IndexError(\"Only integer or range slices are accepted.\")\n        else:\n            slices.append(slice(None))\n\n    return slices\n\n\ndef combine_slices(slice1, slice2):\n    \"\"\"\n    Given two slices that can be applied to a 1-d array, find the resulting\n    slice that corresponds to the combination of both slices. We assume that\n    slice2 can be an integer, but slice1 cannot.\n    \"\"\"\n\n    if isinstance(slice1, slice) and slice1.step is not None:\n        raise ValueError('Only slices with steps of 1 are supported')\n\n    if isinstance(slice2, slice) and slice2.step is not None:\n        raise ValueError('Only slices with steps of 1 are supported')\n\n    if isinstance(slice2, numbers.Integral):\n        if slice1.start is None:\n            return slice2\n        else:\n            return slice2 + slice1.start\n\n    if slice1.start is None:\n        if slice1.stop is None:\n            return slice2\n        else:\n            if slice2.stop is None:\n                return slice(slice2.start, slice1.stop)\n            else:\n                return slice(slice2.start, min(slice1.stop, slice2.stop))\n    else:\n        if slice2.start is None:\n            start = slice1.start\n        else:\n            start = slice1.start + slice2.start\n        if slice2.stop is None:\n            stop = slice1.stop\n        else:\n            if slice1.start is None:\n                stop = slice2.stop\n            else:\n                stop = slice2.stop + slice1.start\n            if slice1.stop is not None:\n                stop = min(slice1.stop, stop)\n    return slice(start, stop)\n\n\nclass SlicedLowLevelWCS(BaseWCSWrapper):\n    \"\"\"\n    A Low Level WCS wrapper which applies an array slice to a WCS.\n\n    This class does not modify the underlying WCS object and can therefore drop\n    coupled dimensions as it stores which pixel and world dimensions have been\n    sliced out (or modified) in the underlying WCS and returns the modified\n    results on all the Low Level WCS methods.\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.wcsapi.BaseLowLevelWCS`\n        The WCS to slice.\n    slices : `slice` or `tuple` or `int`\n        A valid array slice to apply to the WCS.\n\n    \"\"\"\n    def __init__(self, wcs, slices):\n\n        slices = sanitize_slices(slices, wcs.pixel_n_dim)\n\n        if isinstance(wcs, SlicedLowLevelWCS):\n            # Here we combine the current slices with the previous slices\n            # to avoid ending up with many nested WCSes\n            self._wcs = wcs._wcs\n            slices_original = wcs._slices_array.copy()\n            for ipixel in range(wcs.pixel_n_dim):\n                ipixel_orig = wcs._wcs.pixel_n_dim - 1 - wcs._pixel_keep[ipixel]\n                ipixel_new = wcs.pixel_n_dim - 1 - ipixel\n                slices_original[ipixel_orig] = combine_slices(slices_original[ipixel_orig],\n                                                              slices[ipixel_new])\n            self._slices_array = slices_original\n        else:\n            self._wcs = wcs\n            self._slices_array = slices\n\n        self._slices_pixel = self._slices_array[::-1]\n\n        # figure out which pixel dimensions have been kept, then use axis correlation\n        # matrix to figure out which world dims are kept\n        self._pixel_keep = np.nonzero([not isinstance(self._slices_pixel[ip], numbers.Integral)\n                                       for ip in range(self._wcs.pixel_n_dim)])[0]\n\n        # axis_correlation_matrix[world, pixel]\n        self._world_keep = np.nonzero(\n            self._wcs.axis_correlation_matrix[:, self._pixel_keep].any(axis=1))[0]\n\n        if len(self._pixel_keep) == 0 or len(self._world_keep) == 0:\n            raise ValueError(\"Cannot slice WCS: the resulting WCS should have \"\n                             \"at least one pixel and one world dimension.\")\n\n    @lazyproperty\n    def dropped_world_dimensions(self):\n        \"\"\"\n        Information describing the dropped world dimensions.\n        \"\"\"\n        world_coords = self._pixel_to_world_values_all(*[0]*len(self._pixel_keep))\n        dropped_info = defaultdict(list)\n\n        for i in range(self._wcs.world_n_dim):\n\n            if i in self._world_keep:\n                continue\n\n            if \"world_axis_object_classes\" not in dropped_info:\n                dropped_info[\"world_axis_object_classes\"] = dict()\n\n            wao_classes = self._wcs.world_axis_object_classes\n            wao_components = self._wcs.world_axis_object_components\n\n            dropped_info[\"value\"].append(world_coords[i])\n            dropped_info[\"world_axis_names\"].append(self._wcs.world_axis_names[i])\n            dropped_info[\"world_axis_physical_types\"].append(self._wcs.world_axis_physical_types[i])\n            dropped_info[\"world_axis_units\"].append(self._wcs.world_axis_units[i])\n            dropped_info[\"world_axis_object_components\"].append(wao_components[i])\n            dropped_info[\"world_axis_object_classes\"].update(dict(\n                filter(\n                    lambda x: x[0] == wao_components[i][0], wao_classes.items()\n                )\n            ))\n            dropped_info[\"serialized_classes\"] = self.serialized_classes\n        return dict(dropped_info)\n\n    @property\n    def pixel_n_dim(self):\n        return len(self._pixel_keep)\n\n    @property\n    def world_n_dim(self):\n        return len(self._world_keep)\n\n    @property\n    def world_axis_physical_types(self):\n        return [self._wcs.world_axis_physical_types[i] for i in self._world_keep]\n\n    @property\n    def world_axis_units(self):\n        return [self._wcs.world_axis_units[i] for i in self._world_keep]\n\n    @property\n    def pixel_axis_names(self):\n        return [self._wcs.pixel_axis_names[i] for i in self._pixel_keep]\n\n    @property\n    def world_axis_names(self):\n        return [self._wcs.world_axis_names[i] for i in self._world_keep]\n\n    def _pixel_to_world_values_all(self, *pixel_arrays):\n        pixel_arrays = tuple(map(np.asanyarray, pixel_arrays))\n        pixel_arrays_new = []\n        ipix_curr = -1\n        for ipix in range(self._wcs.pixel_n_dim):\n            if isinstance(self._slices_pixel[ipix], numbers.Integral):\n                pixel_arrays_new.append(self._slices_pixel[ipix])\n            else:\n                ipix_curr += 1\n                if self._slices_pixel[ipix].start is not None:\n                    pixel_arrays_new.append(pixel_arrays[ipix_curr] + self._slices_pixel[ipix].start)\n                else:\n                    pixel_arrays_new.append(pixel_arrays[ipix_curr])\n\n        pixel_arrays_new = np.broadcast_arrays(*pixel_arrays_new)\n        return self._wcs.pixel_to_world_values(*pixel_arrays_new)\n\n    def pixel_to_world_values(self, *pixel_arrays):\n        world_arrays = self._pixel_to_world_values_all(*pixel_arrays)\n\n        # Detect the case of a length 0 array\n        if isinstance(world_arrays, np.ndarray) and not world_arrays.shape:\n            return world_arrays\n\n        if self._wcs.world_n_dim > 1:\n            # Select the dimensions of the original WCS we are keeping.\n            world_arrays = [world_arrays[iw] for iw in self._world_keep]\n            # If there is only one world dimension (after slicing) we shouldn't return a tuple.\n            if self.world_n_dim == 1:\n                world_arrays = world_arrays[0]\n\n        return world_arrays\n\n    def world_to_pixel_values(self, *world_arrays):\n        world_arrays = tuple(map(np.asanyarray, world_arrays))\n        world_arrays_new = []\n        iworld_curr = -1\n        for iworld in range(self._wcs.world_n_dim):\n            if iworld in self._world_keep:\n                iworld_curr += 1\n                world_arrays_new.append(world_arrays[iworld_curr])\n            else:\n                world_arrays_new.append(1.)\n\n        world_arrays_new = np.broadcast_arrays(*world_arrays_new)\n        pixel_arrays = list(self._wcs.world_to_pixel_values(*world_arrays_new))\n\n        for ipixel in range(self._wcs.pixel_n_dim):\n            if isinstance(self._slices_pixel[ipixel], slice) and self._slices_pixel[ipixel].start is not None:\n                pixel_arrays[ipixel] -= self._slices_pixel[ipixel].start\n\n        # Detect the case of a length 0 array\n        if isinstance(pixel_arrays, np.ndarray) and not pixel_arrays.shape:\n            return pixel_arrays\n        pixel = tuple(pixel_arrays[ip] for ip in self._pixel_keep)\n        if self.pixel_n_dim == 1 and self._wcs.pixel_n_dim > 1:\n            pixel = pixel[0]\n        return pixel\n\n    @property\n    def world_axis_object_components(self):\n        return [self._wcs.world_axis_object_components[idx] for idx in self._world_keep]\n\n    @property\n    def world_axis_object_classes(self):\n        keys_keep = [item[0] for item in self.world_axis_object_components]\n        return dict([item for item in self._wcs.world_axis_object_classes.items() if item[0] in keys_keep])\n\n    @property\n    def array_shape(self):\n        if self._wcs.array_shape:\n            return np.broadcast_to(0, self._wcs.array_shape)[tuple(self._slices_array)].shape\n\n    @property\n    def pixel_shape(self):\n        if self.array_shape:\n            return tuple(self.array_shape[::-1])\n\n    @property\n    def pixel_bounds(self):\n        if self._wcs.pixel_bounds is None:\n            return\n\n        bounds = []\n        for idx in self._pixel_keep:\n            if self._slices_pixel[idx].start is None:\n                bounds.append(self._wcs.pixel_bounds[idx])\n            else:\n                imin, imax = self._wcs.pixel_bounds[idx]\n                start = self._slices_pixel[idx].start\n                bounds.append((imin - start, imax - start))\n\n        return tuple(bounds)\n\n    @property\n    def axis_correlation_matrix(self):\n        return self._wcs.axis_correlation_matrix[self._world_keep][:, self._pixel_keep]\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":7776,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"col":0,"comment":"","endLoc":1,"header":"sliced_wcs.py#<anonymous>","id":7777,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"__all__ = ['sanitize_slices', 'SlicedLowLevelWCS']"},{"col":4,"comment":"Vector sum.\n\n        Returns a new CartesianRepresentation instance with the sums of the\n        x, y, and z components.\n\n        Refer to `~numpy.sum` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n        ","endLoc":1463,"header":"def sum(self, *args, **kwargs)","id":7778,"name":"sum","nodeType":"Function","startLoc":1452,"text":"def sum(self, *args, **kwargs):\n        \"\"\"Vector sum.\n\n        Returns a new CartesianRepresentation instance with the sums of the\n        x, y, and z components.\n\n        Refer to `~numpy.sum` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n        \"\"\"\n        self._raise_if_has_differentials('sum')\n        return self._apply('sum', *args, **kwargs)"},{"fileName":"__init__.py","filePath":"astropy/wcs/wcsapi/wrappers","id":7779,"nodeType":"File","text":"from .sliced_wcs import *  # noqa\nfrom .base import BaseWCSWrapper\n"},{"fileName":"base.py","filePath":"astropy/wcs/wcsapi/wrappers","id":7780,"nodeType":"File","text":"import abc\n\nfrom astropy.wcs.wcsapi import BaseLowLevelWCS, wcs_info_str\n\n\nclass BaseWCSWrapper(BaseLowLevelWCS, metaclass=abc.ABCMeta):\n    \"\"\"\n    A base wrapper class for things that modify Low Level WCSes.\n\n    This wrapper implements a transparent wrapper to many of the properties,\n    with the idea that not all of them would need to be overridden in your\n    wrapper, but some probably will.\n\n    Parameters\n    ----------\n    wcs : `astropy.wcs.wcsapi.BaseLowLevelWCS`\n        The WCS object to wrap\n    \"\"\"\n    def __init__(self, wcs, *args, **kwargs):\n        self._wcs = wcs\n\n    @property\n    def pixel_n_dim(self):\n        return self._wcs.pixel_n_dim\n\n    @property\n    def world_n_dim(self):\n        return self._wcs.world_n_dim\n\n    @property\n    def world_axis_physical_types(self):\n        return self._wcs.world_axis_physical_types\n\n    @property\n    def world_axis_units(self):\n        return self._wcs.world_axis_units\n\n    @property\n    def world_axis_object_components(self):\n        return self._wcs.world_axis_object_components\n\n    @property\n    def world_axis_object_classes(self):\n        return self._wcs.world_axis_object_classes\n\n    @property\n    def pixel_shape(self):\n        return self._wcs.pixel_shape\n\n    @property\n    def pixel_bounds(self):\n        return self._wcs.pixel_bounds\n\n    @property\n    def pixel_axis_names(self):\n        return self._wcs.pixel_axis_names\n\n    @property\n    def world_axis_names(self):\n        return self._wcs.world_axis_names\n\n    @property\n    def axis_correlation_matrix(self):\n        return self._wcs.axis_correlation_matrix\n\n    @property\n    def serialized_classes(self):\n        return self._wcs.serialized_classes\n\n    @abc.abstractmethod\n    def pixel_to_world_values(self, *pixel_arrays):\n        pass\n\n    @abc.abstractmethod\n    def world_to_pixel_values(self, *world_arrays):\n        pass\n\n    def __repr__(self):\n        return f\"{object.__repr__(self)}\\n{str(self)}\"\n\n    def __str__(self):\n        return wcs_info_str(self)\n"},{"col":4,"comment":"Dot product of two representations.\n\n        The calculation is done by converting both ``self`` and ``other``\n        to `~astropy.coordinates.CartesianRepresentation`.\n\n        Note that any associated differentials will be dropped during this\n        operation.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation`\n            The representation to take the dot product with.\n\n        Returns\n        -------\n        dot_product : `~astropy.units.Quantity`\n            The sum of the product of the x, y, and z components of the\n            cartesian representations of ``self`` and ``other``.\n        ","endLoc":1201,"header":"def dot(self, other)","id":7781,"name":"dot","nodeType":"Function","startLoc":1181,"text":"def dot(self, other):\n        \"\"\"Dot product of two representations.\n\n        The calculation is done by converting both ``self`` and ``other``\n        to `~astropy.coordinates.CartesianRepresentation`.\n\n        Note that any associated differentials will be dropped during this\n        operation.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation`\n            The representation to take the dot product with.\n\n        Returns\n        -------\n        dot_product : `~astropy.units.Quantity`\n            The sum of the product of the x, y, and z components of the\n            cartesian representations of ``self`` and ``other``.\n        \"\"\"\n        return self.to_cartesian().dot(other)"},{"id":7782,"name":"astropy/wcs/wcsapi/wrappers/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/wcs/wcsapi/wrappers/tests","id":7783,"nodeType":"File","text":""},{"id":7784,"name":"astropy/wcs/include","nodeType":"Package"},{"id":7785,"name":"astropy_wcs_api.h","nodeType":"TextFile","path":"astropy/wcs/include","text":"#error \"Since version 0.3, astropy.wcs public API should be imported as \\\"astropy_wcs/astropy_wcs_api.h\"\n"},{"col":4,"comment":"Dot product of two representations.\n\n        Note that any associated differentials will be dropped during this\n        operation.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            If not already cartesian, it is converted.\n\n        Returns\n        -------\n        dot_product : `~astropy.units.Quantity`\n            The sum of the product of the x, y, and z components of ``self``\n            and ``other``.\n        ","endLoc":1490,"header":"def dot(self, other)","id":7786,"name":"dot","nodeType":"Function","startLoc":1465,"text":"def dot(self, other):\n        \"\"\"Dot product of two representations.\n\n        Note that any associated differentials will be dropped during this\n        operation.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            If not already cartesian, it is converted.\n\n        Returns\n        -------\n        dot_product : `~astropy.units.Quantity`\n            The sum of the product of the x, y, and z components of ``self``\n            and ``other``.\n        \"\"\"\n        try:\n            other_c = other.to_cartesian()\n        except Exception as err:\n            raise TypeError(\"cannot only take dot product with another \"\n                            \"representation, not a {} instance.\"\n                            .format(type(other))) from err\n        # erfa pdp: p-vector inner (=scalar=dot) product.\n        return erfa_ufunc.pdp(self.get_xyz(xyz_axis=-1),\n                              other_c.get_xyz(xyz_axis=-1))"},{"id":7787,"name":".gitignore","nodeType":"TextFile","path":"astropy/wcs/include","text":"docstrings.h\nwcsconfig.h\n"},{"col":0,"comment":"null","endLoc":34,"header":"@pytest.fixture\ndef time_1d_fitswcs()","id":7788,"name":"time_1d_fitswcs","nodeType":"Function","startLoc":25,"text":"@pytest.fixture\ndef time_1d_fitswcs():\n    wcs = WCS(naxis=1)\n    wcs.wcs.ctype = 'TIME',\n    wcs.wcs.mjdref = (30042, 0)\n    wcs.wcs.crval = 3.,\n    wcs.wcs.crpix = 11.,\n    wcs.wcs.cname = 'Time',\n    wcs.wcs.cunit = 's'\n    return wcs"},{"id":7789,"name":"astropy/wcs/include/wcslib","nodeType":"Package"},{"id":7790,"name":".empty","nodeType":"TextFile","path":"astropy/wcs/include/wcslib","text":""},{"id":7791,"name":".gitignore","nodeType":"TextFile","path":"astropy/wcs/include/wcslib","text":"# We copy header files here from `cextern/wcslib/C`, but they should\n# be ignored by git.\n\n*.h\n"},{"id":7792,"name":"astropy/wcs/include/astropy_wcs","nodeType":"Package"},{"id":7793,"name":"astropy_wcs_api.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"#ifndef ASTROPY_WCS_API_H\n#define ASTROPY_WCS_API_H\n\n#include \"wcsconfig.h\"\n#include \"pyutil.h\"\n#include \"distortion.h\"\n#include \"pipeline.h\"\n#include \"sip.h\"\n#include \"wcs.h\"\n#include \"wcsprintf.h\"\n\n/*\nHOW TO UPDATE THE PUBLIC API\n\nThis code uses a table of function pointers to dynamically expose the\npublic API to other code that wants to use astropy.wcs from C.\n\nEach function should be:\n\n  1) Declared, as usual for C, in a .h file\n\n  2) Defined in a .c file that is compiled as part of the _wcs.so file\n\n  3) Have a macro that maps the function name to a position in the\n     function table.  That macro should go in this file\n     (astropy_wcs_api.h)\n\n  4) An entry in the function table, which lives in astropy_wcs_api.c\n\nEvery time the function signatures change, or functions are added or\nremoved from the table, the value of REVISION should be incremented.\nThis allows for a rudimentary version check upon dynamic linking to\nthe astropy._wcs module.\n */\n\n#define REVISION 4\n\n#ifdef ASTROPY_WCS_BUILD\n\nint _setup_api(PyObject* m);\n\n#else\n\n#if defined(NO_IMPORT_ASTROPY_WCS_API)\nextern void** AstropyWcs_API;\n#else\nvoid** AstropyWcs_API;\n#endif /* defined(NO_IMPORT_ASTROPY_PYWCS_API) */\n\n/* Function macros that delegate to a function pointer in the AstropyWcs_API table */\n#define AstropyWcs_GetCVersion (*(int (*)(void)) AstropyWcs_API[0])\n#define wcsprm_python2c (*(void (*)(struct wcsprm*)) AstropyWcs_API[1])\n#define wcsprm_c2python (*(void (*)(struct wcsprm*)) AstropyWcs_API[2])\n#define distortion_lookup_t_init (*(int (*)(distortion_lookup_t* lookup)) AstropyWcs_API[3])\n#define distortion_lookup_t_free (*(void (*)(distortion_lookup_t* lookup)) AstropyWcs_API[4])\n#define get_distortion_offset (*(double (*)(const distortion_lookup_t*, const double* const)) AstropyWcs_API[5])\n#define p4_pix2foc (*(int (*)(const unsigned int, const distortion_lookup_t**, const unsigned int, const double *, double *)) AstropyWcs_API[6])\n#define p4_pix2deltas (*(int (*)(const unsigned int, const distortion_lookup_t**, const unsigned int, const double *, double *)) AstropyWcs_API[7])\n#define sip_clear (*(void (*)(sip_t*) AstropyWcs_API[8]))\n#define sip_init (*(int (*)(sip_t*, unsigned int, double*, unsigned int, double*, unsigned int, double*, unsigned int, double*, double*)) AstropyWcs_API[9])\n#define sip_free (*(void (*)(sip_t*) AstropyWcs_API[10]))\n#define sip_pix2foc (*(int (*)(sip_t*, unsigned int, unsigned int, double*, double*)) AstropyWcs_API[11])\n#define sip_pix2deltas (*(int (*)(sip_t*, unsigned int, unsigned int, double*, double*)) AstropyWcs_API[12])\n#define sip_foc2pix (*(int (*)(sip_t*, unsigned int, unsigned int, double*, double*)) AstropyWcs_API[13])\n#define sip_foc2deltas (*(int (*)(sip_t*, unsigned int, unsigned int, double*, double*)) AstropyWcs_API[14])\n#define pipeline_clear (*(void (*)(pipeline_t*)) AstropyWcs_API[15])\n#define pipeline_init (*(void (*)(pipeline_t*, sip_t*, distortion_lookup_t**, struct wcsprm*)) AstropyWcs_API[16])\n#define pipeline_free (*(void (*)(pipeline_t*)) AstropyWcs_API[17])\n#define pipeline_all_pixel2world (*(int (*)(pipeline_t*, unsigned int, unsigned int, double*, double*)) AstropyWcs_API[18])\n#define pipeline_pix2foc (*(int (*)(pipeline_t*, unsigned int, unsigned int, double*, double*)) AstropyWcs_API[19])\n#define wcsp2s (*(int (*)(struct wcsprm *, int, int, const double[], double[], double[], double[], double[], int[])) AstropyWcs_API[20])\n#define wcss2p (*(int (*)(struct wcsprm *, int, int, const double[], double[], double[], double[], double[], int[])) AstropyWcs_API[21])\n#define wcsprt (*(int (*)(struct wcsprm *)) AstropyWcs_API[22])\n#define wcslib_get_error_message (*(const char* (*)(int)) AstropyWcs_API[23])\n#define wcsprintf_buf (*(const char * (*)()) AstropyWcs_API[24])\n\n#ifndef NO_IMPORT_ASTROPY_WCS_API\nint\nimport_astropy_wcs(void) {\n  PyObject *wcs_module   = NULL;\n  PyObject *c_api        = NULL;\n  int       status       = -1;\n\n  wcs_module = PyImport_ImportModule(\"astropy.wcs._wcs\");\n  if (wcs_module == NULL) goto exit;\n\n  c_api = PyObject_GetAttrString(wcs_module, \"_ASTROPY_WCS_API\");\n  if (c_api == NULL) goto exit;\n\n  AstropyWcs_API = (void **)PyCapsule_GetPointer(c_api, \"_wcs._ASTROPY_WCS_API\");\n  if (AstropyWcs_API == NULL)\n      goto exit;\n\n  /* Perform runtime check of C API version */\n  if (REVISION != AstropyWcs_GetCVersion()) {\n    PyErr_Format(\n                 PyExc_ImportError, \"module compiled against \"        \\\n                 \"ABI version '%x' but this version of astropy.wcs is '%x'\", \\\n                 (int)REVISION, (int)AstropyWcs_GetCVersion());\n    return -1;\n  }\n\n exit:\n  Py_XDECREF(wcs_module);\n  Py_XDECREF(c_api);\n\n  return status;\n}\n\n#endif /* !defined(NO_IMPORT_ASTROPY_WCS_API) */\n\n#endif /* ASTROPY_WCS_BUILD */\n\n#endif /* ASTROPY_WCS_API_H */\n"},{"id":7794,"name":"wcslib_units_wrap.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#ifndef __WCSLIB_UNITS_WRAP_H__\n#define __WCSLIB_UNITS_WRAP_H__\n\n#include \"pyutil.h\"\n#include \"wcsunits.h\"\n\nextern PyTypeObject PyUnitsType;\n\ntypedef struct {\n  PyObject_HEAD\n  char have[80];\n  char want[80];\n  double scale;\n  double offset;\n  double power;\n} PyUnits;\n\nPyUnits*\nPyUnits_cnew(\n    const char* const have,\n    const char* const want,\n    const double scale,\n    const double offset,\n    const double power);\n\nint _setup_units_type(PyObject* m);\n\n#endif\n"},{"id":7795,"name":"pipeline.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#ifndef __PIPELINE_H__\n#define __PIPELINE_H__\n\n#include \"sip.h\"\n#include \"distortion.h\"\n#include \"wcs.h\"\n\ntypedef struct {\n  distortion_lookup_t*                   det2im[2];\n  /*@shared@*/ /*@null@*/ sip_t*         sip;\n  distortion_lookup_t*                   cpdis[2];\n  /*@shared@*/ /*@null@*/ struct wcsprm* wcs;\n  struct wcserr*                         err;\n} pipeline_t;\n\n/**\nInitialize all the values in a pipeline_t to NULL.\n*/\nvoid\npipeline_clear(\n    pipeline_t* pipeline);\n\n/**\nSet all the values of a pipeline_t.\n*/\nvoid\npipeline_init(\n    pipeline_t* pipeline,\n    /*@shared@*/ distortion_lookup_t** det2im /* [2] */,\n    /*@shared@*/ sip_t* sip,\n    /*@shared@*/ distortion_lookup_t** cpdis /* [2] */,\n    /*@shared@*/ struct wcsprm* wcs);\n\n/**\nFree all the temporary buffers of a pipeline_t.  It does not free\nthe underlying sip_t, distortion_lookup_t or wcsprm objects.\n*/\nvoid\npipeline_free(\n    pipeline_t* pipeline);\n\n/**\nPerform the entire pipeline from pixel coordinates to world\ncoordinates, in the following order:\n\n    - Detector to image plane correction (optionally)\n\n    - SIP distortion correction (optionally)\n\n    - FITS WCS distortion paper correction (optionally)\n\n    - wcslib WCS transformation\n\n@param ncoord:\n\n@param nelem:\n\n@param pixcrd [in]: Array of pixel coordinates.\n\n@param world [out]: Array of world coordinates (output).\n\n@return: A wcslib error code.\n*/\nint\npipeline_all_pixel2world(\n    pipeline_t* pipeline,\n    const unsigned int ncoord,\n    const unsigned int nelem,\n    const double* const pixcrd /* [ncoord][nelem] */,\n    double* world /* [ncoord][nelem] */);\n\n/**\nPerform just the distortion correction part of the pipeline from pixel\ncoordinates to focal plane coordinates.\n\n    - Detector to image plane correction (optionally)\n\n    - SIP distortion correction (optionally)\n\n    - FITS WCS distortion paper correction (optionally)\n\n@param ncoord:\n\n@param nelem:\n\n@param pixcrd [in]: Array of pixel coordinates.\n\n@param foc [out]: Array of focal plane coordinates.\n\n@return: A wcslib error code.\n*/\nint\npipeline_pix2foc(\n    pipeline_t* pipeline,\n    const unsigned int ncoord,\n    const unsigned int nelem,\n    const double* const pixcrd /* [ncoord][nelem] */,\n    double* foc /* [ncoord][nelem] */);\n\n#endif\n"},{"id":7796,"name":"wcslib_auxprm_wrap.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"#ifndef __WCSLIB_AUXPRM_WRAP_H__\n#define __WCSLIB_AUXPRM_WRAP_H__\n\n#include \"pyutil.h\"\n#include \"wcs.h\"\n\nextern PyTypeObject PyAuxprmType;\n\ntypedef struct {\n  PyObject_HEAD\n  struct auxprm* x;\n  PyObject* owner;\n} PyAuxprm;\n\nPyAuxprm*\nPyAuxprm_cnew(PyObject* wcsprm, struct auxprm* x);\n\nint _setup_auxprm_type(PyObject* m);\n\n#endif\n"},{"col":0,"comment":"null","endLoc":48,"header":"@pytest.fixture\ndef celestial_2d_fitswcs()","id":7797,"name":"celestial_2d_fitswcs","nodeType":"Function","startLoc":37,"text":"@pytest.fixture\ndef celestial_2d_fitswcs():\n    wcs = WCS(naxis=2)\n    wcs.wcs.ctype = 'RA---CAR', 'DEC--CAR'\n    wcs.wcs.cunit = 'deg', 'deg'\n    wcs.wcs.cdelt = -2., 2.\n    wcs.wcs.crval = 4., 0.\n    wcs.wcs.crpix = 6., 7.\n    wcs.wcs.cname = 'Right Ascension', 'Declination'\n    wcs.pixel_shape = (6, 7)\n    wcs.pixel_bounds = [(-1, 5), (1, 7)]\n    return wcs"},{"id":7798,"name":"wcslib_prjprm_wrap.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"#ifndef __WCSLIB_PRJPRM_WRAP_H__\n#define __WCSLIB_PRJPRM_WRAP_H__\n\n#include \"pyutil.h\"\n#include \"wcs.h\"\n\nextern PyTypeObject PyPrjprmType;\n\ntypedef struct {\n    PyObject_HEAD\n    struct prjprm* x;\n    int* prefcount;\n    PyObject* owner;\n} PyPrjprm;\n\nPyPrjprm* PyPrjprm_cnew(PyObject* celprm, struct prjprm* x, int* prefcount);\n\nint _setup_prjprm_type(PyObject* m);\n\n#endif\n"},{"id":7799,"name":"sip_wrap.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#ifndef __SIP_WRAP_H__\n#define __SIP_WRAP_H__\n\n#include \"pyutil.h\"\n#include \"sip.h\"\n\nextern PyTypeObject PySipType;\n\ntypedef struct {\n  PyObject_HEAD\n  sip_t x;\n} PySip;\n\nint\n_setup_sip_type(\n    PyObject* m);\n\n#endif\n"},{"id":7800,"name":"str_list_proxy.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#ifndef __STR_LIST_PROXY_H__\n#define __STR_LIST_PROXY_H__\n\n#include \"pyutil.h\"\n\n/***************************************************************************\n * List-of-strings proxy object\n *\n * A Python object that looks like a list of strings, but is back by a C\n *   char * list[];\n ***************************************************************************/\n\ntypedef int (*str_verify_fn)(const char *);\n\n/*@null@*/ PyObject *\nPyStrListProxy_New(\n    PyObject* owner,\n    Py_ssize_t size,\n    Py_ssize_t maxsize,\n    char (*array)[72]\n    );\n\n/*@null@*/ PyObject*\nstr_list_proxy_repr(\n    char (*array)[72],\n    Py_ssize_t size,\n    Py_ssize_t maxsize);\n\nint\n_setup_str_list_proxy_type(\n    PyObject* m);\n\n#endif /* __STR_LIST_PROXY_H__ */\n"},{"id":7801,"name":"wcslib_wtbarr_wrap.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#ifndef __WCSLIB_WTBARR_WRAP_H__\n#define __WCSLIB_WTBARR_WRAP_H__\n\n#include \"pyutil.h\"\n#include \"wcs.h\"\n\nextern PyTypeObject PyWtbarrType;\n\ntypedef struct {\n  PyObject_HEAD\n  struct wtbarr* x;\n  PyObject* owner;\n} PyWtbarr;\n\nPyWtbarr*\nPyWtbarr_cnew(PyObject* wcsprm, struct wtbarr* x);\n\nint _setup_wtbarr_type(PyObject* m);\n\n#endif\n"},{"id":7802,"name":"wcslib_wrap.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"/*\n Author: Michael Droettboom\n*/\n\n#ifndef __WCSLIB_WRAP_H__\n#define __WCSLIB_WRAP_H__\n\n#include \"pyutil.h\"\n\nextern PyTypeObject PyWcsprmType;\n\ntypedef struct {\n  PyObject_HEAD\n  struct wcsprm x;\n} PyWcsprm;\n\nint _setup_wcsprm_type(PyObject* m);\n\nPyObject*\nPyWcsprm_find_all_wcs(\n    PyObject* self,\n    PyObject* args,\n    PyObject* kwds);\n\nint _update_wtbarr_from_hdulist(PyObject *hdulist, struct wtbarr *wtb);\n\nvoid _set_wtbarr_callback(PyObject* callback);\n\n#endif\n"},{"col":0,"comment":"null","endLoc":62,"header":"@pytest.fixture\ndef spectral_cube_3d_fitswcs()","id":7803,"name":"spectral_cube_3d_fitswcs","nodeType":"Function","startLoc":51,"text":"@pytest.fixture\ndef spectral_cube_3d_fitswcs():\n    wcs = WCS(naxis=3)\n    wcs.wcs.ctype = 'RA---CAR', 'DEC--CAR', 'FREQ'\n    wcs.wcs.cunit = 'deg', 'deg', 'Hz'\n    wcs.wcs.cdelt = -2., 2., 3.e9\n    wcs.wcs.crval = 4., 0., 4.e9\n    wcs.wcs.crpix = 6., 7., 11.\n    wcs.wcs.cname = 'Right Ascension', 'Declination', 'Frequency'\n    wcs.pixel_shape = (6, 7, 3)\n    wcs.pixel_bounds = [(-1, 5), (1, 7), (1, 2.5)]\n    return wcs"},{"id":7804,"name":"isnan.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"#ifndef __ISNAN_H__\n#define __ISNAN_H__\n\n#include \"wcsconfig.h\"\n\ntypedef unsigned WCSLIB_INT64 Int64;\n\n#if !defined(U64)\n#define U64(u) (* (Int64 *) &(u) )\n#endif /* U64 */\n\n#if !defined(isnan64)\n#if !defined(_MSC_VER)\n#define isnan64(u) \\\n  ( (( U64(u) & 0x7ff0000000000000LL)  == 0x7ff0000000000000LL)  && ((U64(u) &  0x000fffffffffffffLL) != 0)) ? 1:0\n#else\n#define isnan64(u) \\\n  ( (( U64(u) & 0x7ff0000000000000i64) == 0x7ff0000000000000i64)  && ((U64(u) & 0x000fffffffffffffi64) != 0)) ? 1:0\n#endif\n#endif /* isnan64 */\n\n#if !defined(isinf64)\n#if !defined(_MSC_VER)\n#define isinf64(u) \\\n  ( (( U64(u) & 0x7ff0000000000000LL)  == 0x7ff0000000000000LL)  && ((U64(u) &  0x000fffffffffffffLL) == 0)) ? 1:0\n#else\n#define isinf64(u) \\\n  ( (( U64(u) & 0x7ff0000000000000i64) == 0x7ff0000000000000i64)  && ((U64(u) & 0x000fffffffffffffi64) == 0)) ? 1:0\n#endif\n#endif /* isinf64 */\n\n#if !defined(isfinite64)\n#if !defined(_MSC_VER)\n#define isfinite64(u) \\\n  ( (( U64(u) & 0x7ff0000000000000LL)  != 0x7ff0000000000000LL)) ? 1:0\n#else\n#define isfinite64(u) \\\n  ( (( U64(u) & 0x7ff0000000000000i64) != 0x7ff0000000000000i64)) ? 1:0\n#endif\n#endif /* isfinite64 */\n\n#endif /* __ISNAN_H__ */\n"},{"id":7805,"name":"astropy_wcs.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#ifndef __ASTROPY_WCS_H__\n#define __ASTROPY_WCS_H__\n\n/* util.h must be imported first */\n#include \"pyutil.h\"\n#include \"pipeline.h\"\n\ntypedef struct {\n  PyObject_HEAD\n  pipeline_t x;\n  /*@shared@*/ PyObject*            py_det2im[2];\n  /*@null@*/ /*@shared@*/ PyObject* py_sip;\n  /*@shared@*/ PyObject*            py_distortion_lookup[2];\n  /*@null@*/ /*@shared@*/ PyObject* py_wcsprm;\n} Wcs;\n\n#endif /* __ASTROPY_WCS_H__ */\n"},{"col":0,"comment":"null","endLoc":75,"header":"@pytest.fixture\ndef cube_4d_fitswcs()","id":7806,"name":"cube_4d_fitswcs","nodeType":"Function","startLoc":65,"text":"@pytest.fixture\ndef cube_4d_fitswcs():\n    wcs = WCS(naxis=4)\n    wcs.wcs.ctype = 'RA---CAR', 'DEC--CAR', 'FREQ', 'TIME'\n    wcs.wcs.cunit = 'deg', 'deg', 'Hz', 's'\n    wcs.wcs.cdelt = -2., 2., 3.e9, 1\n    wcs.wcs.crval = 4., 0., 4.e9, 3,\n    wcs.wcs.crpix = 6., 7., 11., 11.\n    wcs.wcs.cname = 'Right Ascension', 'Declination', 'Frequency', 'Time'\n    wcs.wcs.mjdref = (30042, 0)\n    return wcs"},{"col":4,"comment":"Vector cross product of two representations.\n\n        The calculation is done by converting both ``self`` and ``other``\n        to `~astropy.coordinates.CartesianRepresentation`, and converting the\n        result back to the type of representation of ``self``.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The representation to take the cross product with.\n\n        Returns\n        -------\n        cross_product : `~astropy.coordinates.BaseRepresentation` subclass instance\n            With vectors perpendicular to both ``self`` and ``other``, in the\n            same type of representation as ``self``.\n        ","endLoc":1222,"header":"def cross(self, other)","id":7807,"name":"cross","nodeType":"Function","startLoc":1203,"text":"def cross(self, other):\n        \"\"\"Vector cross product of two representations.\n\n        The calculation is done by converting both ``self`` and ``other``\n        to `~astropy.coordinates.CartesianRepresentation`, and converting the\n        result back to the type of representation of ``self``.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The representation to take the cross product with.\n\n        Returns\n        -------\n        cross_product : `~astropy.coordinates.BaseRepresentation` subclass instance\n            With vectors perpendicular to both ``self`` and ``other``, in the\n            same type of representation as ``self``.\n        \"\"\"\n        self._raise_if_has_differentials('cross')\n        return self.from_cartesian(self.to_cartesian().cross(other))"},{"id":7808,"name":"wcslib_tabprm_wrap.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#ifndef __WCSLIB_TABPRM_WRAP_H__\n#define __WCSLIB_TABPRM_WRAP_H__\n\n#include \"pyutil.h\"\n#include \"wcs.h\"\n\nextern PyTypeObject PyTabprmType;\n\ntypedef struct {\n  PyObject_HEAD\n  struct tabprm* x;\n  PyObject* owner;\n} PyTabprm;\n\nPyTabprm*\nPyTabprm_cnew(PyObject* wcsprm, struct tabprm* x);\n\nint _setup_tabprm_type(PyObject* m);\n\n#endif\n"},{"col":0,"comment":"null","endLoc":137,"header":"@pytest.fixture\ndef spectral_1d_ape14_wcs()","id":7809,"name":"spectral_1d_ape14_wcs","nodeType":"Function","startLoc":135,"text":"@pytest.fixture\ndef spectral_1d_ape14_wcs():\n    return Spectral1DLowLevelWCS()"},{"col":4,"comment":"Cross product of two representations.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            If not already cartesian, it is converted.\n\n        Returns\n        -------\n        cross_product : `~astropy.coordinates.CartesianRepresentation`\n            With vectors perpendicular to both ``self`` and ``other``.\n        ","endLoc":1515,"header":"def cross(self, other)","id":7810,"name":"cross","nodeType":"Function","startLoc":1492,"text":"def cross(self, other):\n        \"\"\"Cross product of two representations.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            If not already cartesian, it is converted.\n\n        Returns\n        -------\n        cross_product : `~astropy.coordinates.CartesianRepresentation`\n            With vectors perpendicular to both ``self`` and ``other``.\n        \"\"\"\n        self._raise_if_has_differentials('cross')\n        try:\n            other_c = other.to_cartesian()\n        except Exception as err:\n            raise TypeError(\"cannot only take cross product with another \"\n                            \"representation, not a {} instance.\"\n                            .format(type(other))) from err\n        # erfa pxp: p-vector outer (=vector=cross) product.\n        sxo = erfa_ufunc.pxp(self.get_xyz(xyz_axis=-1),\n                             other_c.get_xyz(xyz_axis=-1))\n        return self.__class__(sxo, xyz_axis=-1)"},{"col":0,"comment":"null","endLoc":190,"header":"@pytest.fixture\ndef celestial_2d_ape14_wcs()","id":7811,"name":"celestial_2d_ape14_wcs","nodeType":"Function","startLoc":188,"text":"@pytest.fixture\ndef celestial_2d_ape14_wcs():\n    return Celestial2DLowLevelWCS()"},{"id":7812,"name":"pyutil.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#ifndef __PYUTIL_H__\n#define __PYUTIL_H__\n\n#include \"util.h\"\n\n#define PY_ARRAY_UNIQUE_SYMBOL astropy_wcs_numpy_api\n\n#include <Python.h>\n\n#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\n#include <numpy/arrayobject.h>\n#include <numpy/npy_math.h>\n\nPyObject*\nPyArrayProxy_New(\n    PyObject* self,\n    int nd,\n    const npy_intp* dims,\n    int typenum,\n    const void* data);\n\nPyObject*\nPyArrayReadOnlyProxy_New(\n    PyObject* self,\n    int nd,\n    const npy_intp* dims,\n    int typenum,\n    const void* data);\n\n/*@null@*/ PyObject *\nPyStrListProxy_New(\n    PyObject* owner,\n    Py_ssize_t size,\n    Py_ssize_t maxsize,\n    char (*array)[72]\n    );\n\nint\n_setup_str_list_proxy_type(\n    PyObject* m);\n\nstatic INLINE void\noffset_c_array(\n    double* value,\n    npy_intp size,\n    double offset) {\n  double* end = value + size;\n\n  for ( ; value != end; ++value) {\n    *value += offset;\n  }\n}\n\nstatic INLINE\nvoid nan2undefined(\n    double* value,\n    unsigned int nvalues) {\n\n  double* end = value + nvalues;\n\n  for ( ; value != end; ++value) {\n    if (isnan64(*value)) {\n      *value = UNDEFINED;\n    }\n  }\n}\n\nstatic INLINE\nvoid undefined2nan(\n    double* value,\n    unsigned int nvalues) {\n\n  double* end = value + nvalues;\n\n  for ( ; value != end; ++value) {\n    if (*value == UNDEFINED) {\n      *value = (double)NPY_NAN;\n    }\n  }\n}\n\nvoid\npreoffset_array(\n    PyArrayObject* array,\n    int value);\n\nvoid\nunoffset_array(\n    PyArrayObject* array,\n    int value);\n\nvoid\ncopy_array_to_c_double(\n    PyArrayObject* array,\n    double* dest);\n\nvoid\ncopy_array_to_c_int(\n    PyArrayObject* array,\n    int* dest);\n\n/**\n Returns TRUE if pointer is NULL, and sets Python exception\n*/\nint\nis_null(/*@null@*/ void *);\n\ntypedef void (*value_fixer_t)(double*, unsigned int);\n\nvoid\nwcsprm_c2python(\n    /*@null@*/ struct wcsprm* x);\n\nvoid\nwcsprm_python2c(\n    /*@null@*/ struct wcsprm* x);\n\n/***************************************************************************\n * Exceptions                                                              *\n ***************************************************************************/\n\nextern PyObject* WcsExc_SingularMatrix;\nextern PyObject* WcsExc_InconsistentAxisTypes;\nextern PyObject* WcsExc_InvalidTransform;\nextern PyObject* WcsExc_InvalidCoordinate;\nextern PyObject* WcsExc_NoSolution;\nextern PyObject* WcsExc_InvalidSubimageSpecification;\nextern PyObject* WcsExc_NonseparableSubimageCoordinateSystem;\nextern PyObject* WcsExc_NoWcsKeywordsFound;\nextern PyObject* WcsExc_InvalidTabularParameters;\nextern PyObject* WcsExc_InvalidPrjParameters;\n\n/* This is an array mapping the wcs status codes to Python exception\n * types.  The exception string is stored as part of wcslib itself in\n * wcs_errmsg.\n */\nextern PyObject** wcs_errexc[14];\n#define WCS_ERRMSG_MAX 14\n#define WCSFIX_ERRMSG_MAX 11\n\nint\n_define_exceptions(PyObject* m);\n\nconst char*\nwcslib_get_error_message(int stat);\n\nvoid\nwcserr_to_python_exc(const struct wcserr *err);\n\nvoid\nwcs_to_python_exc(const struct wcsprm *wcs);\n\nvoid\nwcshdr_err_to_python_exc(int status, const struct wcsprm *wcs);\n\nvoid\nwcserr_fix_to_python_exc(const struct wcserr *err);\n\n/***************************************************************************\n  Property helpers\n ***************************************************************************/\nstatic INLINE int\ncheck_delete(\n    const char* propname,\n    PyObject* value) {\n\n  if (value == NULL) {\n    PyErr_Format(PyExc_TypeError, \"'%s' can not be deleted\", propname);\n    return -1;\n  }\n\n  return 0;\n}\n\nstatic INLINE PyObject*\nget_string(\n    /*@unused@*/ const char* propname,\n    const char* value) {\n  return PyUnicode_FromString(value);\n}\n\nint\nset_string(\n    const char* propname,\n    PyObject* value,\n    char* dest,\n    Py_ssize_t maxlen);\n\nstatic INLINE PyObject*\nget_bool(\n    /*@unused@*/ const char* propname,\n    long value) {\n\n  return PyBool_FromLong(value);\n}\n\nint\nset_bool(\n    const char* propname,\n    PyObject* value,\n    int* dest);\n\nstatic INLINE PyObject*\nget_int(\n    /*@unused@*/ const char* propname,\n    long value) {\n\n  return PyLong_FromLong(value);\n}\n\nint\nset_int(\n    const char* propname,\n    PyObject* value,\n    int* dest);\n\nstatic INLINE PyObject*\nget_double(\n    const char* propname,\n    double value) {\n\n  return PyFloat_FromDouble(value);\n}\n\nint\nset_double(\n    const char* propname,\n    PyObject* value,\n    double* dest);\n\n/*@null@*/ static INLINE PyObject*\nget_double_array(\n    /*@unused@*/ const char* propname,\n    double* value,\n    int ndims,\n    const npy_intp* dims,\n    /*@shared@*/ PyObject* owner) {\n\n  return PyArrayProxy_New(owner, ndims, dims, NPY_DOUBLE, value);\n}\n\n/*@null@*/ static INLINE PyObject*\nget_double_array_readonly(\n    /*@unused@*/ const char* propname,\n    double* value,\n    int ndims,\n    const npy_intp* dims,\n    /*@shared@*/ PyObject* owner) {\n\n  return PyArrayReadOnlyProxy_New(owner, ndims, dims, NPY_DOUBLE, value);\n}\n\nint\nset_double_array(\n    const char* propname,\n    PyObject* value,\n    int ndims,\n    const npy_intp* dims,\n    double* dest);\n\n/*@null@*/ static INLINE PyObject*\nget_int_array(\n    /*@unused@*/ const char* propname,\n    int* value,\n    int ndims,\n    const npy_intp* dims,\n    /*@shared@*/ PyObject* owner) {\n\n  return PyArrayProxy_New(owner, ndims, dims, NPY_INT, value);\n}\n\nint\nset_int_array(\n    const char* propname,\n    PyObject* value,\n    int ndims,\n    const npy_intp* dims,\n    int* dest);\n\nstatic INLINE PyObject*\nget_str_list(\n    /*@unused@*/ const char* propname,\n    char (*array)[72],\n    Py_ssize_t len,\n    Py_ssize_t maxlen,\n    PyObject* owner) {\n\n  return PyStrListProxy_New(owner, len, maxlen, array);\n}\n\nint\nset_str_list(\n    const char* propname,\n    PyObject* value,\n    Py_ssize_t len,\n    Py_ssize_t maxlen,\n    char (*dest)[72]);\n\nPyObject*\nget_pscards(\n    const char* propname,\n    struct pscard* ps,\n    int nps);\n\nint\nset_pscards(\n    const char* propname,\n    PyObject* value,\n    struct pscard** ps,\n    int *nps,\n    int *npsmax);\n\nPyObject*\nget_pvcards(\n    const char* propname,\n    struct pvcard* pv,\n    int npv);\n\nint\nset_pvcards(\n    const char* propname,\n    PyObject* value,\n    struct pvcard** pv,\n    int *npv,\n    int *npvmax);\n\nPyObject*\nget_deepcopy(\n    PyObject* obj,\n    PyObject* memo);\n\n/***************************************************************************\n  Miscellaneous helper functions\n ***************************************************************************/\n\nint\nparse_unsafe_unit_conversion_spec(\n    const char* arg, int* ctrl);\n\n#endif /* __PYUTIL_H__ */\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":7813,"name":"collect_ignore","nodeType":"Attribute","startLoc":10,"text":"collect_ignore"},{"col":0,"comment":"","endLoc":1,"header":"conftest.py#<anonymous>","id":7814,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"collect_ignore = ['sliced_low_level_wcs.py']"},{"id":7815,"name":"util.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#ifndef __UTIL_H__\n#define __UTIL_H__\n\n#ifdef __SUNPRO_C\n#define INLINE\n#endif\n\n#ifdef _MSC_VER\n#define INLINE __inline\n#endif\n\n#ifndef INLINE\n#define INLINE inline\n#endif\n\n#include <wcs.h>\n#include <wcsmath.h>\n\n#include \"isnan.h\"\n\n#undef\tCLAMP\n#define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))\n\nvoid set_invalid_to_nan(\n    const int ncoord,\n    const int nelem,\n    double* const data,\n    const int* const stat);\n\n#endif /* __UTIL_H__ */\n"},{"id":7816,"name":"distortion_wrap.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#ifndef __DISTORTION_WRAP_H__\n#define __DISTORTION_WRAP_H__\n\n#include \"pyutil.h\"\n#include \"distortion.h\"\n\nextern PyTypeObject PyDistLookupType;\n\ntypedef struct {\n  PyObject_HEAD\n  distortion_lookup_t                    x;\n  /*@null@*/ /*@shared@*/ PyArrayObject* py_data;\n} PyDistLookup;\n\nint\n_setup_distortion_type(\n    PyObject* m);\n\n#endif\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":20,"id":7817,"name":"pc","nodeType":"Attribute","startLoc":20,"text":"self.pc"},{"id":7818,"name":"distortion.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#ifndef __DISTORTION_H__\n#define __DISTORTION_H__\n\n#include \"util.h\"\n\n/* TODO: This is all two-dimensional.  Should be made\n   multi-dimensional in the future. */\n#define NAXES 2\n\n#define MAXAXES 6\n\n/**\nA structure to contain the information for a single distortion lookup table\n */\ntypedef struct {\n  unsigned int                   naxis[NAXES]; /* size of distortion image */\n  double                         crpix[NAXES];\n  double                         crval[NAXES];\n  double                         cdelt[NAXES];\n  /* The data is not \"owned\" by this structure.  It is the user's\n     responsibility to free it. */\n  /*@shared@*/ /*@null@*/ float *data;\n} distortion_lookup_t;\n\n/**\nInitialize a lookup table to reasonable default values.\n */\nint\ndistortion_lookup_t_init(distortion_lookup_t* lookup);\n\n/**\nCleanup after a lookup table.  Currently does nothing, but may do\nsomething in the future, so please call it when you are done with\nthe lookup table.  It does not free the data pointed to be the\nlookup table -- it is the user's responsibility to free that array.\n */\nvoid\ndistortion_lookup_t_free(distortion_lookup_t* lookup);\n\n/**\nLookup the distortion offset for a particular pixel coordinate in\nthe lookup table.\n\n@param lookup A lookup table object\n\n@param A coordinate pair\n\n@return The offset as determined by binlinear interpolation in the\nlookup table\n*/\ndouble\nget_distortion_offset(\n    const distortion_lookup_t * const lookup,\n    const double * const img /* [NAXES] */);\n\n/**\nPerform just the distortion table part of the FITS WCS distortion paper.\n\n@param naxes\n\n@param lookups A pair of lookup table objects\n\n@param nelem\n\n@param pix [in]: An array of pixel coordinates\n\n@param foc [out]: An array of focal plane coordinates\n\n@return A wcslib error code\n*/\nint\np4_pix2foc(\n    const unsigned int naxes,\n    const distortion_lookup_t** lookups, /* [NAXES] */\n    const unsigned int nelem,\n    const double* pix, /* [NAXES][nelem] */\n    double *foc /* [NAXES][nelem] */);\n\n/**\nPerform just the distortion table part of the FITS WCS distortion paper, by\nadding distortion to the values already in place in foc.\n\n@param naxes\n\n@param lookups A pair of lookup table objects\n\n@param nelem\n\n@param pix [in]: An array of pixel coordinates\n\n@param foc [in/out]: An array of focal plane coordinates\n\n@return A wcslib error code\n*/\nint\np4_pix2deltas(\n    const unsigned int naxes,\n    const distortion_lookup_t** lookups, /* [NAXES] */\n    const unsigned int nelem,\n    const double* pix, /* [NAXES][nelem] */\n    double *foc /* [NAXES][nelem] */);\n\n#endif /* __DISTORTION_H__ */\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":17,"id":7819,"name":"crpix","nodeType":"Attribute","startLoc":17,"text":"self.crpix"},{"id":7820,"name":"unit_list_proxy.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#ifndef __UNIT_LIST_PROXY_H__\n#define __UNIT_LIST_PROXY_H__\n\n#include \"pyutil.h\"\n\n/***************************************************************************\n * List-of-units proxy object\n *\n * A Python object that looks like a list of units, but is back by a C\n *   char * list[];\n ***************************************************************************/\n\n/*@null@*/ PyObject *\nPyUnitListProxy_New(\n    PyObject* owner,\n    Py_ssize_t size,\n    char (*array)[72]\n    );\n\nint\n_setup_unit_list_proxy_type(\n    PyObject* m);\n\nstatic INLINE PyObject*\nget_unit_list(\n    /*@unused@*/ const char* propname,\n    char (*array)[72],\n    Py_ssize_t len,\n    PyObject* owner) {\n\n  return PyUnitListProxy_New(owner, len, array);\n}\n\nint\nset_unit_list(\n    PyObject *owner,\n    const char* propname,\n    PyObject* value,\n    Py_ssize_t len,\n    char (*dest)[72]);\n\n#endif /* __UNIT_LIST_PROXY_H__ */\n"},{"id":7821,"name":"wcslib_celprm_wrap.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"#ifndef __WCSLIB_CELPRM_WRAP_H__\n#define __WCSLIB_CELPRM_WRAP_H__\n\n#include \"pyutil.h\"\n#include \"wcs.h\"\n\nextern PyTypeObject PyCelprmType;\n\ntypedef struct {\n    PyObject_HEAD\n    struct celprm* x;\n    int* prefcount;\n    PyObject* owner;\n} PyCelprm;\n\nPyCelprm* PyCelprm_cnew(PyObject* wcsprm_obj, struct celprm* x, int* prefcount);\n\nint _setup_celprm_type(PyObject* m);\n\n#endif\n"},{"id":7822,"name":"sip.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\n*/\n\n#ifndef __SIP_H__\n#define __SIP_H__\n\n#include \"util.h\"\n\ntypedef struct {\n  unsigned int                    a_order;\n  /*@null@*/ /*@shared@*/ double* a;\n  unsigned int                    b_order;\n  /*@null@*/ /*@shared@*/ double* b;\n  unsigned int                    ap_order;\n  /*@null@*/ /*@shared@*/ double* ap;\n  unsigned int                    bp_order;\n  /*@null@*/ /*@shared@*/ double* bp;\n  double                          crpix[2];\n  /*@null@*/ double*              scratch;\n  struct wcserr*                  err;\n} sip_t;\n\n/**\nSets all the values of the sip_t structure to NULLs or zeros.\n*/\nvoid\nsip_clear(sip_t* sip);\n\n/**\nSet the values of the sip_t structure.\n\nThe values expected are all exactly as defined in the FITS SIP header\nkeywords.\n\nThe arrays/matrices are all *copied* into the SIP struct.  To free the\nmemory that sip_t allocates for itself, call sip_free.\n\n@param a_order: The order of the A_i_j matrix\n\n@param a: The A_i_j array, which must be of size [a_order+1][a_order+1]\n\n@param b_order: The order of the B_i_j matrix\n\n@param b: The B_i_j array, which must be of size [b_order+1][b_order+1]\n\n@param ap_order: The order of the AP_i_j matrix\n\n@param ap: The AP_i_j array, which must be of size [ap_order+1][ap_order+1]\n\n@param bp_order: The order of the BP_i_j matrix\n\n@param bp: The BP_i_j array, which must be of size [bp_order+1][bp_order+1]\n\n@param crpix: The position of the reference pixel\n*/\nint\nsip_init(\n    sip_t* sip,\n    const unsigned int a_order, const double* a,\n    const unsigned int b_order, const double* b,\n    const unsigned int ap_order, const double* ap,\n    const unsigned int bp_order, const double* bp,\n    const double* crpix /* [2] */);\n\n/**\nFrees the memory allocated for the sip_t struct.\n*/\nvoid\nsip_free(sip_t* sip);\n\n/**\nConverts pixel coordinates to focal plane coordinates using the SIP\npolynomial distortion convention, and the values stored in the sip_t\nstruct.\n\n@param naxes\n\n@param nelem\n\n@param pix [in]: An array of pixel coordinates\n\n@param foc [out]: An array of focal plane coordinates\n\n@return A wcslib error code\n*/\nint\nsip_pix2foc(\n    const sip_t* sip,\n    const unsigned int naxes,\n    const unsigned int nelem,\n    const double* pix /* [NAXES][nelem] */,\n    double* foc /* [NAXES][nelem] */);\n\n/**\nComputes the offset deltas necessary to convert pixel coordinates to\nfocal plane coordinates using the SIP polynomial distortion\nconvention, and the values stored in the sip_t struct.  The deltas are\nadded to the existing values in pix.\n\n@param naxes\n\n@param nelem\n\n@param pix [in]: An array of pixel coordinates\n\n@param foc [in/out]: An array of deltas, that when added to pix\nresults in focal plane coordinates.\n\n@return A wcslib error code\n*/\nint\nsip_pix2deltas(\n    const sip_t* sip,\n    const unsigned int naxes,\n    const unsigned int nelem,\n    const double* pix /* [NAXES][nelem] */,\n    double* foc /* [NAXES][nelem] */);\n\n/**\nAdds the offset deltas necessary to convert focal plane\ncoordinates to pixel coordinates using the SIP polynomial distortion\nconvention, and the values stored in the sip_t struct.  The deltas\nare added to the existing values in pix.\n\n@param naxes\n\n@param nelem\n\n@param foc [in]: An array of focal plane coordinates\n\n@param pix [in/out]: An array of pixel coordinates\n\n@return A wcslib error code\n*/\nint\nsip_foc2pix(\n    const sip_t* sip,\n    const unsigned int naxes,\n    const unsigned int nelem,\n    const double* foc /* [NAXES][nelem] */,\n    double* pix /* [NAXES][nelem] */);\n\n/**\nComputes the offset deltas necessary to convert focal plane\ncoordinates to pixel coordinates using the SIP polynomial distortion\nconvention, and the values stored in the sip_t struct.  The deltas are\nadded to the existing values in foc.\n\n@param naxes\n\n@param nelem\n\n@param foc [in]: An array of focal plane coordinates\n\n@param foc [in/out]: An array of deltas, that when added to pix\nresults in focal plane coordinates.\n\n@return A wcslib error code\n*/\nint\nsip_foc2deltas(\n    const sip_t* sip,\n    const unsigned int naxes,\n    const unsigned int nelem,\n    const double* foc /* [NAXES][nelem] */,\n    double* deltas /* [NAXES][nelem] */);\n\n#endif\n"},{"id":7823,"name":"astropy/_dev","nodeType":"Package"},{"fileName":"scm_version.py","filePath":"astropy/_dev","id":7824,"nodeType":"File","text":"# Try to use setuptools_scm to get the current version; this is only used\n# in development installations from the git repository.\nimport os.path as pth\n\ntry:\n    from setuptools_scm import get_version\n    version = get_version(root=pth.join('..', '..'), relative_to=__file__)\nexcept Exception:\n    raise ImportError('setuptools_scm broken or not installed')\n"},{"col":0,"comment":"","endLoc":3,"header":"scm_version.py#<anonymous>","id":7825,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"try:\n    from setuptools_scm import get_version\n    version = get_version(root=pth.join('..', '..'), relative_to=__file__)\nexcept Exception:\n    raise ImportError('setuptools_scm broken or not installed')"},{"fileName":"__init__.py","filePath":"astropy/_dev","id":7826,"nodeType":"File","text":"\"\"\"\nThis package contains utilities that are only used when developing astropy\nin a copy of the source repository.\n\nThese files are not installed, and should not be assumed to exist at runtime.\n\"\"\"\n"},{"col":0,"comment":"","endLoc":6,"header":"__init__.py#<anonymous>","id":7827,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nThis package contains utilities that are only used when developing astropy\nin a copy of the source repository.\n\nThese files are not installed, and should not be assumed to exist at runtime.\n\"\"\""},{"id":7828,"name":"astropy/samp","nodeType":"Package"},{"fileName":"constants.py","filePath":"astropy/samp","id":7829,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nDefines constants used in `astropy.samp`.\n\"\"\"\n\n\nfrom astropy.utils.data import get_pkg_data_filename\n\n__all__ = ['SAMP_STATUS_OK', 'SAMP_STATUS_WARNING', 'SAMP_STATUS_ERROR',\n           'SAFE_MTYPES', 'SAMP_ICON']\n\n__profile_version__ = \"1.3\"\n\n#: General constant for samp.ok status string\nSAMP_STATUS_OK = \"samp.ok\"\n#: General constant for samp.warning status string\nSAMP_STATUS_WARNING = \"samp.warning\"\n#: General constant for samp.error status string\nSAMP_STATUS_ERROR = \"samp.error\"\n\nSAFE_MTYPES = [\"samp.app.*\", \"samp.msg.progress\", \"table.*\", \"image.*\",\n               \"coord.*\", \"spectrum.*\", \"bibcode.*\", \"voresource.*\"]\n\nwith open(get_pkg_data_filename('data/astropy_icon.png'), 'rb') as f:\n    SAMP_ICON = f.read()\n"},{"fileName":"standard_profile.py","filePath":"astropy/samp","id":7830,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport sys\nimport traceback\nimport warnings\nimport socketserver\nimport xmlrpc.client as xmlrpc\nfrom xmlrpc.server import SimpleXMLRPCRequestHandler, SimpleXMLRPCServer\n\nfrom .constants import SAMP_ICON\nfrom .errors import SAMPWarning\n\n__all__ = []\n\n\nclass SAMPSimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):\n    \"\"\"\n    XMLRPC handler of Standard Profile requests.\n    \"\"\"\n\n    def do_GET(self):\n\n        if self.path == '/samp/icon':\n            self.send_response(200, 'OK')\n            self.send_header('Content-Type', 'image/png')\n            self.end_headers()\n            self.wfile.write(SAMP_ICON)\n\n    def do_POST(self):\n        \"\"\"\n        Handles the HTTP POST request.\n\n        Attempts to interpret all HTTP POST requests as XML-RPC calls,\n        which are forwarded to the server's ``_dispatch`` method for\n        handling.\n        \"\"\"\n\n        # Check that the path is legal\n        if not self.is_rpc_path_valid():\n            self.report_404()\n            return\n\n        try:\n            # Get arguments by reading body of request.\n            # We read this in chunks to avoid straining\n            # socket.read(); around the 10 or 15Mb mark, some platforms\n            # begin to have problems (bug #792570).\n            max_chunk_size = 10 * 1024 * 1024\n            size_remaining = int(self.headers[\"content-length\"])\n            L = []\n            while size_remaining:\n                chunk_size = min(size_remaining, max_chunk_size)\n                L.append(self.rfile.read(chunk_size))\n                size_remaining -= len(L[-1])\n            data = b''.join(L)\n\n            params, method = xmlrpc.loads(data)\n\n            if method == \"samp.webhub.register\":\n                params = list(params)\n                params.append(self.client_address)\n                if 'Origin' in self.headers:\n                    params.append(self.headers.get('Origin'))\n                else:\n                    params.append('unknown')\n                params = tuple(params)\n                data = xmlrpc.dumps(params, methodname=method)\n\n            elif method in ('samp.hub.notify', 'samp.hub.notifyAll',\n                            'samp.hub.call', 'samp.hub.callAll',\n                            'samp.hub.callAndWait'):\n\n                user = \"unknown\"\n\n                if method == 'samp.hub.callAndWait':\n                    params[2][\"host\"] = self.address_string()\n                    params[2][\"user\"] = user\n                else:\n                    params[-1][\"host\"] = self.address_string()\n                    params[-1][\"user\"] = user\n\n                data = xmlrpc.dumps(params, methodname=method)\n\n            data = self.decode_request_content(data)\n            if data is None:\n                return  # response has been sent\n\n            # In previous versions of SimpleXMLRPCServer, _dispatch\n            # could be overridden in this class, instead of in\n            # SimpleXMLRPCDispatcher. To maintain backwards compatibility,\n            # check to see if a subclass implements _dispatch and dispatch\n            # using that method if present.\n            response = self.server._marshaled_dispatch(\n                data, getattr(self, '_dispatch', None), self.path\n            )\n        except Exception as e:\n            # This should only happen if the module is buggy\n            # internal error, report as HTTP server error\n            self.send_response(500)\n\n            # Send information about the exception if requested\n            if hasattr(self.server, '_send_traceback_header') and \\\n               self.server._send_traceback_header:\n                self.send_header(\"X-exception\", str(e))\n                trace = traceback.format_exc()\n                trace = str(trace.encode('ASCII', 'backslashreplace'), 'ASCII')\n                self.send_header(\"X-traceback\", trace)\n\n            self.send_header(\"Content-length\", \"0\")\n            self.end_headers()\n        else:\n            # got a valid XML RPC response\n            self.send_response(200)\n            self.send_header(\"Content-type\", \"text/xml\")\n            if self.encode_threshold is not None:\n                if len(response) > self.encode_threshold:\n                    q = self.accept_encodings().get(\"gzip\", 0)\n                    if q:\n                        try:\n                            response = xmlrpc.gzip_encode(response)\n                            self.send_header(\"Content-Encoding\", \"gzip\")\n                        except NotImplementedError:\n                            pass\n            self.send_header(\"Content-length\", str(len(response)))\n            self.end_headers()\n            self.wfile.write(response)\n\n\nclass ThreadingXMLRPCServer(socketserver.ThreadingMixIn, SimpleXMLRPCServer):\n    \"\"\"\n    Asynchronous multithreaded XMLRPC server.\n    \"\"\"\n\n    def __init__(self, addr, log=None,\n                 requestHandler=SAMPSimpleXMLRPCRequestHandler,\n                 logRequests=True, allow_none=True, encoding=None):\n        self.log = log\n        SimpleXMLRPCServer.__init__(self, addr, requestHandler,\n                                    logRequests, allow_none, encoding)\n\n    def handle_error(self, request, client_address):\n        if self.log is None:\n            socketserver.BaseServer.handle_error(self, request, client_address)\n        else:\n            warnings.warn(\"Exception happened during processing of request \"\n                          \"from {}: {}\".format(client_address, sys.exc_info()[1]),\n                          SAMPWarning)\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":611,"id":7831,"name":"info","nodeType":"Attribute","startLoc":611,"text":"info"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":7832,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":7833,"name":"__profile_version__","nodeType":"Attribute","startLoc":12,"text":"__profile_version__"},{"attributeType":"null","col":8,"comment":"null","endLoc":674,"id":7834,"name":"_differentials","nodeType":"Attribute","startLoc":674,"text":"self._differentials"},{"col":4,"comment":"null","endLoc":1321,"header":"def unit_vectors(self)","id":7835,"name":"unit_vectors","nodeType":"Function","startLoc":1315,"text":"def unit_vectors(self):\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        o = np.broadcast_to(0.*u.one, self.shape, subok=True)\n        return {\n            'x': CartesianRepresentation(l, o, o, copy=False),\n            'y': CartesianRepresentation(o, l, o, copy=False),\n            'z': CartesianRepresentation(o, o, l, copy=False)}"},{"attributeType":"{__gt__}","col":8,"comment":"null","endLoc":15,"id":7836,"name":"nx","nodeType":"Attribute","startLoc":15,"text":"self.nx"},{"attributeType":"null","col":8,"comment":"null","endLoc":18,"id":7837,"name":"crval","nodeType":"Attribute","startLoc":18,"text":"self.crval"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":7838,"name":"SAMP_STATUS_OK","nodeType":"Attribute","startLoc":15,"text":"SAMP_STATUS_OK"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":7839,"name":"SAMP_STATUS_WARNING","nodeType":"Attribute","startLoc":17,"text":"SAMP_STATUS_WARNING"},{"attributeType":"null","col":4,"comment":"null","endLoc":25,"id":7840,"name":"SAMP_ICON","nodeType":"Attribute","startLoc":25,"text":"SAMP_ICON"},{"attributeType":"{__gt__}","col":8,"comment":"null","endLoc":16,"id":7841,"name":"ny","nodeType":"Attribute","startLoc":16,"text":"self.ny"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":7842,"name":"SAMP_STATUS_ERROR","nodeType":"Attribute","startLoc":19,"text":"SAMP_STATUS_ERROR"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":7843,"name":"SAFE_MTYPES","nodeType":"Attribute","startLoc":21,"text":"SAFE_MTYPES"},{"attributeType":"null","col":67,"comment":"null","endLoc":24,"id":7844,"name":"f","nodeType":"Attribute","startLoc":24,"text":"f"},{"attributeType":"null","col":8,"comment":"null","endLoc":19,"id":7845,"name":"cdelt","nodeType":"Attribute","startLoc":19,"text":"self.cdelt"},{"col":0,"comment":"","endLoc":4,"header":"constants.py#<anonymous>","id":7846,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nDefines constants used in `astropy.samp`.\n\"\"\"\n\n__all__ = ['SAMP_STATUS_OK', 'SAMP_STATUS_WARNING', 'SAMP_STATUS_ERROR',\n           'SAFE_MTYPES', 'SAMP_ICON']\n\n__profile_version__ = \"1.3\"\n\nSAMP_STATUS_OK = \"samp.ok\"\n\nSAMP_STATUS_WARNING = \"samp.warning\"\n\nSAMP_STATUS_ERROR = \"samp.error\"\n\nSAFE_MTYPES = [\"samp.app.*\", \"samp.msg.progress\", \"table.*\", \"image.*\",\n               \"coord.*\", \"spectrum.*\", \"bibcode.*\", \"voresource.*\"]\n\nwith open(get_pkg_data_filename('data/astropy_icon.png'), 'rb') as f:\n    SAMP_ICON = f.read()"},{"className":"SAMPWarning","col":0,"comment":"\n    SAMP-specific Astropy warning class\n    ","endLoc":18,"id":7847,"nodeType":"Class","startLoc":15,"text":"class SAMPWarning(AstropyUserWarning):\n    \"\"\"\n    SAMP-specific Astropy warning class\n    \"\"\""},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":7848,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"className":"SAMPSimpleXMLRPCRequestHandler","col":0,"comment":"\n    XMLRPC handler of Standard Profile requests.\n    ","endLoc":127,"id":7849,"nodeType":"Class","startLoc":17,"text":"class SAMPSimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):\n    \"\"\"\n    XMLRPC handler of Standard Profile requests.\n    \"\"\"\n\n    def do_GET(self):\n\n        if self.path == '/samp/icon':\n            self.send_response(200, 'OK')\n            self.send_header('Content-Type', 'image/png')\n            self.end_headers()\n            self.wfile.write(SAMP_ICON)\n\n    def do_POST(self):\n        \"\"\"\n        Handles the HTTP POST request.\n\n        Attempts to interpret all HTTP POST requests as XML-RPC calls,\n        which are forwarded to the server's ``_dispatch`` method for\n        handling.\n        \"\"\"\n\n        # Check that the path is legal\n        if not self.is_rpc_path_valid():\n            self.report_404()\n            return\n\n        try:\n            # Get arguments by reading body of request.\n            # We read this in chunks to avoid straining\n            # socket.read(); around the 10 or 15Mb mark, some platforms\n            # begin to have problems (bug #792570).\n            max_chunk_size = 10 * 1024 * 1024\n            size_remaining = int(self.headers[\"content-length\"])\n            L = []\n            while size_remaining:\n                chunk_size = min(size_remaining, max_chunk_size)\n                L.append(self.rfile.read(chunk_size))\n                size_remaining -= len(L[-1])\n            data = b''.join(L)\n\n            params, method = xmlrpc.loads(data)\n\n            if method == \"samp.webhub.register\":\n                params = list(params)\n                params.append(self.client_address)\n                if 'Origin' in self.headers:\n                    params.append(self.headers.get('Origin'))\n                else:\n                    params.append('unknown')\n                params = tuple(params)\n                data = xmlrpc.dumps(params, methodname=method)\n\n            elif method in ('samp.hub.notify', 'samp.hub.notifyAll',\n                            'samp.hub.call', 'samp.hub.callAll',\n                            'samp.hub.callAndWait'):\n\n                user = \"unknown\"\n\n                if method == 'samp.hub.callAndWait':\n                    params[2][\"host\"] = self.address_string()\n                    params[2][\"user\"] = user\n                else:\n                    params[-1][\"host\"] = self.address_string()\n                    params[-1][\"user\"] = user\n\n                data = xmlrpc.dumps(params, methodname=method)\n\n            data = self.decode_request_content(data)\n            if data is None:\n                return  # response has been sent\n\n            # In previous versions of SimpleXMLRPCServer, _dispatch\n            # could be overridden in this class, instead of in\n            # SimpleXMLRPCDispatcher. To maintain backwards compatibility,\n            # check to see if a subclass implements _dispatch and dispatch\n            # using that method if present.\n            response = self.server._marshaled_dispatch(\n                data, getattr(self, '_dispatch', None), self.path\n            )\n        except Exception as e:\n            # This should only happen if the module is buggy\n            # internal error, report as HTTP server error\n            self.send_response(500)\n\n            # Send information about the exception if requested\n            if hasattr(self.server, '_send_traceback_header') and \\\n               self.server._send_traceback_header:\n                self.send_header(\"X-exception\", str(e))\n                trace = traceback.format_exc()\n                trace = str(trace.encode('ASCII', 'backslashreplace'), 'ASCII')\n                self.send_header(\"X-traceback\", trace)\n\n            self.send_header(\"Content-length\", \"0\")\n            self.end_headers()\n        else:\n            # got a valid XML RPC response\n            self.send_response(200)\n            self.send_header(\"Content-type\", \"text/xml\")\n            if self.encode_threshold is not None:\n                if len(response) > self.encode_threshold:\n                    q = self.accept_encodings().get(\"gzip\", 0)\n                    if q:\n                        try:\n                            response = xmlrpc.gzip_encode(response)\n                            self.send_header(\"Content-Encoding\", \"gzip\")\n                        except NotImplementedError:\n                            pass\n            self.send_header(\"Content-length\", str(len(response)))\n            self.end_headers()\n            self.wfile.write(response)"},{"fileName":"web_profile.py","filePath":"astropy/samp","id":7850,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nfrom urllib.parse import parse_qs\nfrom urllib.request import urlopen\n\nfrom astropy.utils.data import get_pkg_data_contents\n\nfrom .standard_profile import (SAMPSimpleXMLRPCRequestHandler,\n                               ThreadingXMLRPCServer)\n\n__all__ = []\n\nCROSS_DOMAIN = get_pkg_data_contents('data/crossdomain.xml')\nCLIENT_ACCESS_POLICY = get_pkg_data_contents('data/clientaccesspolicy.xml')\n\n\nclass WebProfileRequestHandler(SAMPSimpleXMLRPCRequestHandler):\n    \"\"\"\n    Handler of XMLRPC requests performed through the Web Profile.\n    \"\"\"\n\n    def _send_CORS_header(self):\n\n        if self.headers.get('Origin') is not None:\n\n            method = self.headers.get('Access-Control-Request-Method')\n            if method and self.command == \"OPTIONS\":\n                # Preflight method\n                self.send_header('Content-Length', '0')\n                self.send_header('Access-Control-Allow-Origin',\n                                 self.headers.get('Origin'))\n                self.send_header('Access-Control-Allow-Methods', method)\n                self.send_header('Access-Control-Allow-Headers', 'Content-Type')\n                self.send_header('Access-Control-Allow-Credentials', 'true')\n            else:\n                # Simple method\n                self.send_header('Access-Control-Allow-Origin',\n                                 self.headers.get('Origin'))\n                self.send_header('Access-Control-Allow-Headers', 'Content-Type')\n                self.send_header('Access-Control-Allow-Credentials', 'true')\n\n    def end_headers(self):\n        self._send_CORS_header()\n        SAMPSimpleXMLRPCRequestHandler.end_headers(self)\n\n    def _serve_cross_domain_xml(self):\n\n        cross_domain = False\n\n        if self.path == \"/crossdomain.xml\":\n\n            # Adobe standard\n            response = CROSS_DOMAIN\n\n            self.send_response(200, 'OK')\n            self.send_header('Content-Type', 'text/x-cross-domain-policy')\n            self.send_header(\"Content-Length\", f\"{len(response)}\")\n            self.end_headers()\n            self.wfile.write(response.encode('utf-8'))\n            self.wfile.flush()\n            cross_domain = True\n\n        elif self.path == \"/clientaccesspolicy.xml\":\n\n            # Microsoft standard\n            response = CLIENT_ACCESS_POLICY\n\n            self.send_response(200, 'OK')\n            self.send_header('Content-Type', 'text/xml')\n            self.send_header(\"Content-Length\", f\"{len(response)}\")\n            self.end_headers()\n            self.wfile.write(response.encode('utf-8'))\n            self.wfile.flush()\n            cross_domain = True\n\n        return cross_domain\n\n    def do_POST(self):\n        if self._serve_cross_domain_xml():\n            return\n\n        return SAMPSimpleXMLRPCRequestHandler.do_POST(self)\n\n    def do_HEAD(self):\n\n        if not self.is_http_path_valid():\n            self.report_404()\n            return\n\n        if self._serve_cross_domain_xml():\n            return\n\n    def do_OPTIONS(self):\n\n        self.send_response(200, 'OK')\n        self.end_headers()\n\n    def do_GET(self):\n\n        if not self.is_http_path_valid():\n            self.report_404()\n            return\n\n        split_path = self.path.split('?')\n\n        if split_path[0] in [f'/translator/{clid}' for clid in self.server.clients]:\n            # Request of a file proxying\n            urlpath = parse_qs(split_path[1])\n            try:\n                proxyfile = urlopen(urlpath[\"ref\"][0])\n                self.send_response(200, 'OK')\n                self.end_headers()\n                self.wfile.write(proxyfile.read())\n                proxyfile.close()\n            except OSError:\n                self.report_404()\n                return\n\n        if self._serve_cross_domain_xml():\n            return\n\n    def is_http_path_valid(self):\n\n        valid_paths = ([\"/clientaccesspolicy.xml\", \"/crossdomain.xml\"] +\n                       [f'/translator/{clid}' for clid in self.server.clients])\n        return self.path.split('?')[0] in valid_paths\n\n\nclass WebProfileXMLRPCServer(ThreadingXMLRPCServer):\n    \"\"\"\n    XMLRPC server supporting the SAMP Web Profile.\n    \"\"\"\n\n    def __init__(self, addr, log=None, requestHandler=WebProfileRequestHandler,\n                 logRequests=True, allow_none=True, encoding=None):\n\n        self.clients = []\n        ThreadingXMLRPCServer.__init__(self, addr, log, requestHandler,\n                                       logRequests, allow_none, encoding)\n\n    def add_client(self, client_id):\n        self.clients.append(client_id)\n\n    def remove_client(self, client_id):\n        try:\n            self.clients.remove(client_id)\n        except ValueError:\n            # No warning here because this method gets called for all clients,\n            # not just web clients, and we expect it to fail for non-web\n            # clients.\n            pass\n\n\ndef web_profile_text_dialog(request, queue):\n\n    samp_name = \"unknown\"\n\n    if isinstance(request[0], str):\n        # To support the old protocol version\n        samp_name = request[0]\n    else:\n        samp_name = request[0][\"samp.name\"]\n\n    text = \\\n        f\"\"\"A Web application which declares to be\n\nName: {samp_name}\nOrigin: {request[2]}\n\nis requesting to be registered with the SAMP Hub.\nPay attention that if you permit its registration, such\napplication will acquire all current user privileges, like\nfile read/write.\n\nDo you give your consent? [yes|no]\"\"\"\n\n    print(text)\n    answer = input(\">>> \")\n    queue.put(answer.lower() in [\"yes\", \"y\"])\n"},{"col":4,"comment":"null","endLoc":28,"header":"def do_GET(self)","id":7851,"name":"do_GET","nodeType":"Function","startLoc":22,"text":"def do_GET(self):\n\n        if self.path == '/samp/icon':\n            self.send_response(200, 'OK')\n            self.send_header('Content-Type', 'image/png')\n            self.end_headers()\n            self.wfile.write(SAMP_ICON)"},{"fileName":"utils.py","filePath":"astropy/samp","id":7852,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nUtility functions and classes\n\"\"\"\n\n\nimport queue\nimport inspect\nimport traceback\nfrom io import StringIO\nimport xmlrpc.client as xmlrpc\nfrom urllib.request import urlopen\n\nfrom .constants import SAMP_STATUS_ERROR\nfrom .errors import SAMPProxyError\n\n\ndef internet_on():\n    from . import conf\n    if not conf.use_internet:\n        return False\n    else:\n        try:\n            urlopen('http://google.com', timeout=1.)\n            return True\n        except Exception:\n            return False\n\n\n__all__ = [\"SAMPMsgReplierWrapper\"]\n\n__doctest_skip__ = ['.']\n\n\ndef getattr_recursive(variable, attribute):\n    \"\"\"\n    Get attributes recursively.\n    \"\"\"\n    if '.' in attribute:\n        top, remaining = attribute.split('.', 1)\n        return getattr_recursive(getattr(variable, top), remaining)\n    else:\n        return getattr(variable, attribute)\n\n\nclass _ServerProxyPoolMethod:\n\n    # some magic to bind an XML-RPC method to an RPC server.\n    # supports \"nested\" methods (e.g. examples.getStateName)\n\n    def __init__(self, proxies, name):\n        self.__proxies = proxies\n        self.__name = name\n\n    def __getattr__(self, name):\n        return _ServerProxyPoolMethod(self.__proxies, f\"{self.__name}.{name}\")\n\n    def __call__(self, *args, **kwrds):\n        proxy = self.__proxies.get()\n        function = getattr_recursive(proxy, self.__name)\n        try:\n            response = function(*args, **kwrds)\n        except xmlrpc.Fault as exc:\n            raise SAMPProxyError(exc.faultCode, exc.faultString)\n        finally:\n            self.__proxies.put(proxy)\n        return response\n\n\nclass ServerProxyPool:\n    \"\"\"\n    A thread-safe pool of `xmlrpc.ServerProxy` objects.\n    \"\"\"\n\n    def __init__(self, size, proxy_class, *args, **keywords):\n\n        self._proxies = queue.Queue(size)\n        for i in range(size):\n            self._proxies.put(proxy_class(*args, **keywords))\n\n    def __getattr__(self, name):\n        # magic method dispatcher\n        return _ServerProxyPoolMethod(self._proxies, name)\n\n    def shutdown(self):\n        \"\"\"Shut down the proxy pool by closing all active connections.\"\"\"\n\n        while True:\n            try:\n                proxy = self._proxies.get_nowait()\n            except queue.Empty:\n                break\n            # An undocumented but apparently supported way to call methods on\n            # an ServerProxy that are not dispatched to the remote server\n            proxy('close')\n\n\nclass SAMPMsgReplierWrapper:\n    \"\"\"\n    Function decorator that allows to automatically grab errors and returned\n    maps (if any) from a function bound to a SAMP call (or notify).\n\n    Parameters\n    ----------\n    cli : :class:`~astropy.samp.SAMPIntegratedClient` or :class:`~astropy.samp.SAMPClient`\n        SAMP client instance. Decorator initialization, accepting the instance\n        of the client that receives the call or notification.\n    \"\"\"\n\n    def __init__(self, cli):\n        self.cli = cli\n\n    def __call__(self, f):\n\n        def wrapped_f(*args):\n\n            if get_num_args(f) == 5 or args[2] is None:  # notification\n\n                f(*args)\n\n            else:  # call\n\n                try:\n                    result = f(*args)\n                    if result:\n                        self.cli.hub.reply(self.cli.get_private_key(), args[2],\n                                           {\"samp.status\": SAMP_STATUS_ERROR,\n                                            \"samp.result\": result})\n                except Exception:\n                    err = StringIO()\n                    traceback.print_exc(file=err)\n                    txt = err.getvalue()\n                    self.cli.hub.reply(self.cli.get_private_key(), args[2],\n                                       {\"samp.status\": SAMP_STATUS_ERROR,\n                                        \"samp.result\": {\"txt\": txt}})\n\n        return wrapped_f\n\n\nclass _HubAsClient:\n\n    def __init__(self, handler):\n        self._handler = handler\n\n    def __getattr__(self, name):\n        # magic method dispatcher\n        return _HubAsClientMethod(self._handler, name)\n\n\nclass _HubAsClientMethod:\n\n    def __init__(self, send, name):\n        self.__send = send\n        self.__name = name\n\n    def __getattr__(self, name):\n        return _HubAsClientMethod(self.__send, f\"{self.__name}.{name}\")\n\n    def __call__(self, *args):\n        return self.__send(self.__name, args)\n\n\ndef get_num_args(f):\n    \"\"\"\n    Find the number of arguments a function or method takes (excluding ``self``).\n    \"\"\"\n    if inspect.ismethod(f):\n        return f.__func__.__code__.co_argcount - 1\n    elif inspect.isfunction(f):\n        return f.__code__.co_argcount\n    else:\n        raise TypeError(\"f should be a function or a method\")\n"},{"className":"SAMPProxyError","col":0,"comment":"\n    SAMP Proxy Hub exception\n    ","endLoc":36,"id":7853,"nodeType":"Class","startLoc":33,"text":"class SAMPProxyError(xmlrpc.Fault):\n    \"\"\"\n    SAMP Proxy Hub exception\n    \"\"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":7854,"name":"__all__","nodeType":"Attribute","startLoc":20,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":7855,"name":"C_SI","nodeType":"Attribute","startLoc":22,"text":"C_SI"},{"className":"_ServerProxyPoolMethod","col":0,"comment":"null","endLoc":67,"id":7856,"nodeType":"Class","startLoc":46,"text":"class _ServerProxyPoolMethod:\n\n    # some magic to bind an XML-RPC method to an RPC server.\n    # supports \"nested\" methods (e.g. examples.getStateName)\n\n    def __init__(self, proxies, name):\n        self.__proxies = proxies\n        self.__name = name\n\n    def __getattr__(self, name):\n        return _ServerProxyPoolMethod(self.__proxies, f\"{self.__name}.{name}\")\n\n    def __call__(self, *args, **kwrds):\n        proxy = self.__proxies.get()\n        function = getattr_recursive(proxy, self.__name)\n        try:\n            response = function(*args, **kwrds)\n        except xmlrpc.Fault as exc:\n            raise SAMPProxyError(exc.faultCode, exc.faultString)\n        finally:\n            self.__proxies.put(proxy)\n        return response"},{"col":4,"comment":"null","endLoc":53,"header":"def __init__(self, proxies, name)","id":7857,"name":"__init__","nodeType":"Function","startLoc":51,"text":"def __init__(self, proxies, name):\n        self.__proxies = proxies\n        self.__name = name"},{"col":4,"comment":"null","endLoc":56,"header":"def __getattr__(self, name)","id":7858,"name":"__getattr__","nodeType":"Function","startLoc":55,"text":"def __getattr__(self, name):\n        return _ServerProxyPoolMethod(self.__proxies, f\"{self.__name}.{name}\")"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":7859,"name":"VELOCITY_FRAMES","nodeType":"Attribute","startLoc":24,"text":"VELOCITY_FRAMES"},{"attributeType":"null","col":0,"comment":"null","endLoc":88,"id":7860,"name":"CTYPE_TO_UCD1","nodeType":"Attribute","startLoc":88,"text":"CTYPE_TO_UCD1"},{"attributeType":"null","col":0,"comment":"null","endLoc":149,"id":7861,"name":"CTYPE_TO_UCD1_CUSTOM","nodeType":"Attribute","startLoc":149,"text":"CTYPE_TO_UCD1_CUSTOM"},{"col":0,"comment":"","endLoc":6,"header":"fitswcs.py#<anonymous>","id":7862,"name":"<anonymous>","nodeType":"Function","startLoc":6,"text":"__all__ = ['custom_ctype_to_ucd_mapping', 'SlicedFITSWCS', 'FITSWCSAPIMixin']\n\nC_SI = c.si.value\n\nVELOCITY_FRAMES = {\n    'GEOCENT': 'gcrs',\n    'BARYCENT': 'icrs',\n    'HELIOCENT': 'hcrs',\n    'LSRK': 'lsrk',\n    'LSRD': 'lsrd'\n}\n\nVELOCITY_FRAMES['GALACTOC'] = Galactic(u=0 * u.km, v=0 * u.km, w=0 * u.km,\n                                       U=0 * u.km / u.s, V=-220 * u.km / u.s, W=0 * u.km / u.s,\n                                       representation_type='cartesian',\n                                       differential_type='cartesian')\n\nVELOCITY_FRAMES['LOCALGRP'] = Galactic(u=0 * u.km, v=0 * u.km, w=0 * u.km,\n                                       U=0 * u.km / u.s, V=-300 * u.km / u.s, W=0 * u.km / u.s,\n                                       representation_type='cartesian',\n                                       differential_type='cartesian')\n\nVELOCITY_FRAMES['CMBDIPOL'] = Galactic(l=263.85 * u.deg, b=48.25 * u.deg, distance=0 * u.km,\n                                       radial_velocity=-(3.346e-3 / 2.725 * c).to(u.km/u.s))\n\nCTYPE_TO_UCD1 = {\n\n    # Celestial coordinates\n    'RA': 'pos.eq.ra',\n    'DEC': 'pos.eq.dec',\n    'GLON': 'pos.galactic.lon',\n    'GLAT': 'pos.galactic.lat',\n    'ELON': 'pos.ecliptic.lon',\n    'ELAT': 'pos.ecliptic.lat',\n    'TLON': 'pos.bodyrc.lon',\n    'TLAT': 'pos.bodyrc.lat',\n    'HPLT': 'custom:pos.helioprojective.lat',\n    'HPLN': 'custom:pos.helioprojective.lon',\n    'HPRZ': 'custom:pos.helioprojective.z',\n    'HGLN': 'custom:pos.heliographic.stonyhurst.lon',\n    'HGLT': 'custom:pos.heliographic.stonyhurst.lat',\n    'CRLN': 'custom:pos.heliographic.carrington.lon',\n    'CRLT': 'custom:pos.heliographic.carrington.lat',\n    'SOLX': 'custom:pos.heliocentric.x',\n    'SOLY': 'custom:pos.heliocentric.y',\n    'SOLZ': 'custom:pos.heliocentric.z',\n\n    # Spectral coordinates (WCS paper 3)\n    'FREQ': 'em.freq',  # Frequency\n    'ENER': 'em.energy',  # Energy\n    'WAVN': 'em.wavenumber',  # Wavenumber\n    'WAVE': 'em.wl',  # Vacuum wavelength\n    'VRAD': 'spect.dopplerVeloc.radio',  # Radio velocity\n    'VOPT': 'spect.dopplerVeloc.opt',  # Optical velocity\n    'ZOPT': 'src.redshift',  # Redshift\n    'AWAV': 'em.wl',  # Air wavelength\n    'VELO': 'spect.dopplerVeloc',  # Apparent radial velocity\n    'BETA': 'custom:spect.doplerVeloc.beta',  # Beta factor (v/c)\n    'STOKES': 'phys.polarization.stokes',  # STOKES parameters\n\n    # Time coordinates (https://www.aanda.org/articles/aa/pdf/2015/02/aa24653-14.pdf)\n    'TIME': 'time',\n    'TAI': 'time',\n    'TT': 'time',\n    'TDT': 'time',\n    'ET': 'time',\n    'IAT': 'time',\n    'UT1': 'time',\n    'UTC': 'time',\n    'GMT': 'time',\n    'GPS': 'time',\n    'TCG': 'time',\n    'TCB': 'time',\n    'TDB': 'time',\n    'LOCAL': 'time',\n\n    # Distance coordinates\n    'DIST': 'pos.distance',\n    'DSUN': 'custom:pos.distance.sunToObserver'\n\n    # UT() and TT() are handled separately in world_axis_physical_types\n\n}\n\nCTYPE_TO_UCD1_CUSTOM = []"},{"col":4,"comment":"null","endLoc":1325,"header":"def scale_factors(self)","id":7863,"name":"scale_factors","nodeType":"Function","startLoc":1323,"text":"def scale_factors(self):\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return {'x': l, 'y': l, 'z': l}"},{"col":4,"comment":"null","endLoc":67,"header":"def __call__(self, *args, **kwrds)","id":7864,"name":"__call__","nodeType":"Function","startLoc":58,"text":"def __call__(self, *args, **kwrds):\n        proxy = self.__proxies.get()\n        function = getattr_recursive(proxy, self.__name)\n        try:\n            response = function(*args, **kwrds)\n        except xmlrpc.Fault as exc:\n            raise SAMPProxyError(exc.faultCode, exc.faultString)\n        finally:\n            self.__proxies.put(proxy)\n        return response"},{"col":4,"comment":"null","endLoc":1357,"header":"@classmethod\n    def from_cartesian(cls, other)","id":7865,"name":"from_cartesian","nodeType":"Function","startLoc":1355,"text":"@classmethod\n    def from_cartesian(cls, other):\n        return other"},{"col":4,"comment":"null","endLoc":1360,"header":"def to_cartesian(self)","id":7866,"name":"to_cartesian","nodeType":"Function","startLoc":1359,"text":"def to_cartesian(self):\n        return self"},{"col":4,"comment":"\n        Transform the cartesian coordinates using a 3x3 matrix.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : ndarray\n            A 3x3 transformation matrix, such as a rotation matrix.\n\n        Examples\n        --------\n\n        We can start off by creating a cartesian representation object:\n\n            >>> from astropy import units as u\n            >>> from astropy.coordinates import CartesianRepresentation\n            >>> rep = CartesianRepresentation([1, 2] * u.pc,\n            ...                               [2, 3] * u.pc,\n            ...                               [3, 4] * u.pc)\n\n        We now create a rotation matrix around the z axis:\n\n            >>> from astropy.coordinates.matrix_utilities import rotation_matrix\n            >>> rotation = rotation_matrix(30 * u.deg, axis='z')\n\n        Finally, we can apply this transformation:\n\n            >>> rep_new = rep.transform(rotation)\n            >>> rep_new.xyz  # doctest: +FLOAT_CMP\n            <Quantity [[ 1.8660254 , 3.23205081],\n                       [ 1.23205081, 1.59807621],\n                       [ 3.        , 4.        ]] pc>\n        ","endLoc":1406,"header":"def transform(self, matrix)","id":7867,"name":"transform","nodeType":"Function","startLoc":1362,"text":"def transform(self, matrix):\n        \"\"\"\n        Transform the cartesian coordinates using a 3x3 matrix.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : ndarray\n            A 3x3 transformation matrix, such as a rotation matrix.\n\n        Examples\n        --------\n\n        We can start off by creating a cartesian representation object:\n\n            >>> from astropy import units as u\n            >>> from astropy.coordinates import CartesianRepresentation\n            >>> rep = CartesianRepresentation([1, 2] * u.pc,\n            ...                               [2, 3] * u.pc,\n            ...                               [3, 4] * u.pc)\n\n        We now create a rotation matrix around the z axis:\n\n            >>> from astropy.coordinates.matrix_utilities import rotation_matrix\n            >>> rotation = rotation_matrix(30 * u.deg, axis='z')\n\n        Finally, we can apply this transformation:\n\n            >>> rep_new = rep.transform(rotation)\n            >>> rep_new.xyz  # doctest: +FLOAT_CMP\n            <Quantity [[ 1.8660254 , 3.23205081],\n                       [ 1.23205081, 1.59807621],\n                       [ 3.        , 4.        ]] pc>\n        \"\"\"\n        # erfa rxp: Multiply a p-vector by an r-matrix.\n        p = erfa_ufunc.rxp(matrix, self.get_xyz(xyz_axis=-1))\n        # transformed representation\n        rep = self.__class__(p, xyz_axis=-1, copy=False)\n        # Handle differentials attached to this representation\n        new_diffs = dict((k, d.transform(matrix, self, rep))\n                         for k, d in self.differentials.items())\n        return rep.with_differentials(new_diffs)"},{"col":0,"comment":"\n    Get attributes recursively.\n    ","endLoc":43,"header":"def getattr_recursive(variable, attribute)","id":7868,"name":"getattr_recursive","nodeType":"Function","startLoc":35,"text":"def getattr_recursive(variable, attribute):\n    \"\"\"\n    Get attributes recursively.\n    \"\"\"\n    if '.' in attribute:\n        top, remaining = attribute.split('.', 1)\n        return getattr_recursive(getattr(variable, top), remaining)\n    else:\n        return getattr(variable, attribute)"},{"col":4,"comment":"\n        Handles the HTTP POST request.\n\n        Attempts to interpret all HTTP POST requests as XML-RPC calls,\n        which are forwarded to the server's ``_dispatch`` method for\n        handling.\n        ","endLoc":127,"header":"def do_POST(self)","id":7869,"name":"do_POST","nodeType":"Function","startLoc":30,"text":"def do_POST(self):\n        \"\"\"\n        Handles the HTTP POST request.\n\n        Attempts to interpret all HTTP POST requests as XML-RPC calls,\n        which are forwarded to the server's ``_dispatch`` method for\n        handling.\n        \"\"\"\n\n        # Check that the path is legal\n        if not self.is_rpc_path_valid():\n            self.report_404()\n            return\n\n        try:\n            # Get arguments by reading body of request.\n            # We read this in chunks to avoid straining\n            # socket.read(); around the 10 or 15Mb mark, some platforms\n            # begin to have problems (bug #792570).\n            max_chunk_size = 10 * 1024 * 1024\n            size_remaining = int(self.headers[\"content-length\"])\n            L = []\n            while size_remaining:\n                chunk_size = min(size_remaining, max_chunk_size)\n                L.append(self.rfile.read(chunk_size))\n                size_remaining -= len(L[-1])\n            data = b''.join(L)\n\n            params, method = xmlrpc.loads(data)\n\n            if method == \"samp.webhub.register\":\n                params = list(params)\n                params.append(self.client_address)\n                if 'Origin' in self.headers:\n                    params.append(self.headers.get('Origin'))\n                else:\n                    params.append('unknown')\n                params = tuple(params)\n                data = xmlrpc.dumps(params, methodname=method)\n\n            elif method in ('samp.hub.notify', 'samp.hub.notifyAll',\n                            'samp.hub.call', 'samp.hub.callAll',\n                            'samp.hub.callAndWait'):\n\n                user = \"unknown\"\n\n                if method == 'samp.hub.callAndWait':\n                    params[2][\"host\"] = self.address_string()\n                    params[2][\"user\"] = user\n                else:\n                    params[-1][\"host\"] = self.address_string()\n                    params[-1][\"user\"] = user\n\n                data = xmlrpc.dumps(params, methodname=method)\n\n            data = self.decode_request_content(data)\n            if data is None:\n                return  # response has been sent\n\n            # In previous versions of SimpleXMLRPCServer, _dispatch\n            # could be overridden in this class, instead of in\n            # SimpleXMLRPCDispatcher. To maintain backwards compatibility,\n            # check to see if a subclass implements _dispatch and dispatch\n            # using that method if present.\n            response = self.server._marshaled_dispatch(\n                data, getattr(self, '_dispatch', None), self.path\n            )\n        except Exception as e:\n            # This should only happen if the module is buggy\n            # internal error, report as HTTP server error\n            self.send_response(500)\n\n            # Send information about the exception if requested\n            if hasattr(self.server, '_send_traceback_header') and \\\n               self.server._send_traceback_header:\n                self.send_header(\"X-exception\", str(e))\n                trace = traceback.format_exc()\n                trace = str(trace.encode('ASCII', 'backslashreplace'), 'ASCII')\n                self.send_header(\"X-traceback\", trace)\n\n            self.send_header(\"Content-length\", \"0\")\n            self.end_headers()\n        else:\n            # got a valid XML RPC response\n            self.send_response(200)\n            self.send_header(\"Content-type\", \"text/xml\")\n            if self.encode_threshold is not None:\n                if len(response) > self.encode_threshold:\n                    q = self.accept_encodings().get(\"gzip\", 0)\n                    if q:\n                        try:\n                            response = xmlrpc.gzip_encode(response)\n                            self.send_header(\"Content-Encoding\", \"gzip\")\n                        except NotImplementedError:\n                            pass\n            self.send_header(\"Content-length\", str(len(response)))\n            self.end_headers()\n            self.wfile.write(response)"},{"className":"ThreadingXMLRPCServer","col":0,"comment":"\n    Asynchronous multithreaded XMLRPC server.\n    ","endLoc":148,"id":7870,"nodeType":"Class","startLoc":130,"text":"class ThreadingXMLRPCServer(socketserver.ThreadingMixIn, SimpleXMLRPCServer):\n    \"\"\"\n    Asynchronous multithreaded XMLRPC server.\n    \"\"\"\n\n    def __init__(self, addr, log=None,\n                 requestHandler=SAMPSimpleXMLRPCRequestHandler,\n                 logRequests=True, allow_none=True, encoding=None):\n        self.log = log\n        SimpleXMLRPCServer.__init__(self, addr, requestHandler,\n                                    logRequests, allow_none, encoding)\n\n    def handle_error(self, request, client_address):\n        if self.log is None:\n            socketserver.BaseServer.handle_error(self, request, client_address)\n        else:\n            warnings.warn(\"Exception happened during processing of request \"\n                          \"from {}: {}\".format(client_address, sys.exc_info()[1]),\n                          SAMPWarning)"},{"col":4,"comment":"null","endLoc":140,"header":"def __init__(self, addr, log=None,\n                 requestHandler=SAMPSimpleXMLRPCRequestHandler,\n                 logRequests=True, allow_none=True, encoding=None)","id":7871,"name":"__init__","nodeType":"Function","startLoc":135,"text":"def __init__(self, addr, log=None,\n                 requestHandler=SAMPSimpleXMLRPCRequestHandler,\n                 logRequests=True, allow_none=True, encoding=None):\n        self.log = log\n        SimpleXMLRPCServer.__init__(self, addr, requestHandler,\n                                    logRequests, allow_none, encoding)"},{"col":4,"comment":"null","endLoc":2095,"header":"def parse(self, iterator, config)","id":7872,"name":"parse","nodeType":"Function","startLoc":2076,"text":"def parse(self, iterator, config):\n        tag_mapping = {\n            'FIELDref': self._add_fieldref,\n            'PARAMref': self._add_paramref,\n            'PARAM': self._add_param,\n            'GROUP': self._add_group,\n            'DESCRIPTION': self._ignore_add}\n\n        for start, tag, data, pos in iterator:\n            if start:\n                tag_mapping.get(tag, self._add_unknown_tag)(\n                    iterator, tag, data, config, pos)\n            else:\n                if tag == 'DESCRIPTION':\n                    if self.description is not None:\n                        warn_or_raise(W17, W17, 'GROUP', config, pos)\n                    self.description = data or None\n                elif tag == 'GROUP':\n                    break\n        return self"},{"col":4,"comment":"null","endLoc":2105,"header":"def to_xml(self, w, **kwargs)","id":7873,"name":"to_xml","nodeType":"Function","startLoc":2097,"text":"def to_xml(self, w, **kwargs):\n        with w.tag(\n            'GROUP',\n            attrib=w.object_attrs(\n                self, ['ID', 'name', 'ref', 'ucd', 'utype'])):\n            if self.description is not None:\n                w.element(\"DESCRIPTION\", self.description, wrap=True)\n            for entry in self.entries:\n                entry.to_xml(w, **kwargs)"},{"attributeType":"null","col":8,"comment":"null","endLoc":53,"id":7874,"name":"__name","nodeType":"Attribute","startLoc":53,"text":"self.__name"},{"attributeType":"null","col":8,"comment":"null","endLoc":52,"id":7875,"name":"__proxies","nodeType":"Attribute","startLoc":52,"text":"self.__proxies"},{"className":"ServerProxyPool","col":0,"comment":"\n    A thread-safe pool of `xmlrpc.ServerProxy` objects.\n    ","endLoc":95,"id":7876,"nodeType":"Class","startLoc":70,"text":"class ServerProxyPool:\n    \"\"\"\n    A thread-safe pool of `xmlrpc.ServerProxy` objects.\n    \"\"\"\n\n    def __init__(self, size, proxy_class, *args, **keywords):\n\n        self._proxies = queue.Queue(size)\n        for i in range(size):\n            self._proxies.put(proxy_class(*args, **keywords))\n\n    def __getattr__(self, name):\n        # magic method dispatcher\n        return _ServerProxyPoolMethod(self._proxies, name)\n\n    def shutdown(self):\n        \"\"\"Shut down the proxy pool by closing all active connections.\"\"\"\n\n        while True:\n            try:\n                proxy = self._proxies.get_nowait()\n            except queue.Empty:\n                break\n            # An undocumented but apparently supported way to call methods on\n            # an ServerProxy that are not dispatched to the remote server\n            proxy('close')"},{"col":4,"comment":"null","endLoc":79,"header":"def __init__(self, size, proxy_class, *args, **keywords)","id":7877,"name":"__init__","nodeType":"Function","startLoc":75,"text":"def __init__(self, size, proxy_class, *args, **keywords):\n\n        self._proxies = queue.Queue(size)\n        for i in range(size):\n            self._proxies.put(proxy_class(*args, **keywords))"},{"col":4,"comment":"null","endLoc":83,"header":"def __getattr__(self, name)","id":7878,"name":"__getattr__","nodeType":"Function","startLoc":81,"text":"def __getattr__(self, name):\n        # magic method dispatcher\n        return _ServerProxyPoolMethod(self._proxies, name)"},{"col":4,"comment":"null","endLoc":148,"header":"def handle_error(self, request, client_address)","id":7879,"name":"handle_error","nodeType":"Function","startLoc":142,"text":"def handle_error(self, request, client_address):\n        if self.log is None:\n            socketserver.BaseServer.handle_error(self, request, client_address)\n        else:\n            warnings.warn(\"Exception happened during processing of request \"\n                          \"from {}: {}\".format(client_address, sys.exc_info()[1]),\n                          SAMPWarning)"},{"col":4,"comment":"Shut down the proxy pool by closing all active connections.","endLoc":95,"header":"def shutdown(self)","id":7880,"name":"shutdown","nodeType":"Function","startLoc":85,"text":"def shutdown(self):\n        \"\"\"Shut down the proxy pool by closing all active connections.\"\"\"\n\n        while True:\n            try:\n                proxy = self._proxies.get_nowait()\n            except queue.Empty:\n                break\n            # An undocumented but apparently supported way to call methods on\n            # an ServerProxy that are not dispatched to the remote server\n            proxy('close')"},{"attributeType":"null","col":8,"comment":"null","endLoc":138,"id":7881,"name":"log","nodeType":"Attribute","startLoc":138,"text":"self.log"},{"col":4,"comment":"\n        Recursively iterate over all :class:`Param` elements in this\n        :class:`Group`.\n        ","endLoc":2117,"header":"def iter_fields_and_params(self)","id":7882,"name":"iter_fields_and_params","nodeType":"Function","startLoc":2107,"text":"def iter_fields_and_params(self):\n        \"\"\"\n        Recursively iterate over all :class:`Param` elements in this\n        :class:`Group`.\n        \"\"\"\n        for entry in self.entries:\n            if isinstance(entry, Param):\n                yield entry\n            elif isinstance(entry, Group):\n                for field in entry.iter_fields_and_params():\n                    yield field"},{"attributeType":"null","col":8,"comment":"null","endLoc":77,"id":7883,"name":"_proxies","nodeType":"Attribute","startLoc":77,"text":"self._proxies"},{"className":"SAMPMsgReplierWrapper","col":0,"comment":"\n    Function decorator that allows to automatically grab errors and returned\n    maps (if any) from a function bound to a SAMP call (or notify).\n\n    Parameters\n    ----------\n    cli : :class:`~astropy.samp.SAMPIntegratedClient` or :class:`~astropy.samp.SAMPClient`\n        SAMP client instance. Decorator initialization, accepting the instance\n        of the client that receives the call or notification.\n    ","endLoc":137,"id":7884,"nodeType":"Class","startLoc":98,"text":"class SAMPMsgReplierWrapper:\n    \"\"\"\n    Function decorator that allows to automatically grab errors and returned\n    maps (if any) from a function bound to a SAMP call (or notify).\n\n    Parameters\n    ----------\n    cli : :class:`~astropy.samp.SAMPIntegratedClient` or :class:`~astropy.samp.SAMPClient`\n        SAMP client instance. Decorator initialization, accepting the instance\n        of the client that receives the call or notification.\n    \"\"\"\n\n    def __init__(self, cli):\n        self.cli = cli\n\n    def __call__(self, f):\n\n        def wrapped_f(*args):\n\n            if get_num_args(f) == 5 or args[2] is None:  # notification\n\n                f(*args)\n\n            else:  # call\n\n                try:\n                    result = f(*args)\n                    if result:\n                        self.cli.hub.reply(self.cli.get_private_key(), args[2],\n                                           {\"samp.status\": SAMP_STATUS_ERROR,\n                                            \"samp.result\": result})\n                except Exception:\n                    err = StringIO()\n                    traceback.print_exc(file=err)\n                    txt = err.getvalue()\n                    self.cli.hub.reply(self.cli.get_private_key(), args[2],\n                                       {\"samp.status\": SAMP_STATUS_ERROR,\n                                        \"samp.result\": {\"txt\": txt}})\n\n        return wrapped_f"},{"className":"WebProfileRequestHandler","col":0,"comment":"\n    Handler of XMLRPC requests performed through the Web Profile.\n    ","endLoc":127,"id":7885,"nodeType":"Class","startLoc":18,"text":"class WebProfileRequestHandler(SAMPSimpleXMLRPCRequestHandler):\n    \"\"\"\n    Handler of XMLRPC requests performed through the Web Profile.\n    \"\"\"\n\n    def _send_CORS_header(self):\n\n        if self.headers.get('Origin') is not None:\n\n            method = self.headers.get('Access-Control-Request-Method')\n            if method and self.command == \"OPTIONS\":\n                # Preflight method\n                self.send_header('Content-Length', '0')\n                self.send_header('Access-Control-Allow-Origin',\n                                 self.headers.get('Origin'))\n                self.send_header('Access-Control-Allow-Methods', method)\n                self.send_header('Access-Control-Allow-Headers', 'Content-Type')\n                self.send_header('Access-Control-Allow-Credentials', 'true')\n            else:\n                # Simple method\n                self.send_header('Access-Control-Allow-Origin',\n                                 self.headers.get('Origin'))\n                self.send_header('Access-Control-Allow-Headers', 'Content-Type')\n                self.send_header('Access-Control-Allow-Credentials', 'true')\n\n    def end_headers(self):\n        self._send_CORS_header()\n        SAMPSimpleXMLRPCRequestHandler.end_headers(self)\n\n    def _serve_cross_domain_xml(self):\n\n        cross_domain = False\n\n        if self.path == \"/crossdomain.xml\":\n\n            # Adobe standard\n            response = CROSS_DOMAIN\n\n            self.send_response(200, 'OK')\n            self.send_header('Content-Type', 'text/x-cross-domain-policy')\n            self.send_header(\"Content-Length\", f\"{len(response)}\")\n            self.end_headers()\n            self.wfile.write(response.encode('utf-8'))\n            self.wfile.flush()\n            cross_domain = True\n\n        elif self.path == \"/clientaccesspolicy.xml\":\n\n            # Microsoft standard\n            response = CLIENT_ACCESS_POLICY\n\n            self.send_response(200, 'OK')\n            self.send_header('Content-Type', 'text/xml')\n            self.send_header(\"Content-Length\", f\"{len(response)}\")\n            self.end_headers()\n            self.wfile.write(response.encode('utf-8'))\n            self.wfile.flush()\n            cross_domain = True\n\n        return cross_domain\n\n    def do_POST(self):\n        if self._serve_cross_domain_xml():\n            return\n\n        return SAMPSimpleXMLRPCRequestHandler.do_POST(self)\n\n    def do_HEAD(self):\n\n        if not self.is_http_path_valid():\n            self.report_404()\n            return\n\n        if self._serve_cross_domain_xml():\n            return\n\n    def do_OPTIONS(self):\n\n        self.send_response(200, 'OK')\n        self.end_headers()\n\n    def do_GET(self):\n\n        if not self.is_http_path_valid():\n            self.report_404()\n            return\n\n        split_path = self.path.split('?')\n\n        if split_path[0] in [f'/translator/{clid}' for clid in self.server.clients]:\n            # Request of a file proxying\n            urlpath = parse_qs(split_path[1])\n            try:\n                proxyfile = urlopen(urlpath[\"ref\"][0])\n                self.send_response(200, 'OK')\n                self.end_headers()\n                self.wfile.write(proxyfile.read())\n                proxyfile.close()\n            except OSError:\n                self.report_404()\n                return\n\n        if self._serve_cross_domain_xml():\n            return\n\n    def is_http_path_valid(self):\n\n        valid_paths = ([\"/clientaccesspolicy.xml\", \"/crossdomain.xml\"] +\n                       [f'/translator/{clid}' for clid in self.server.clients])\n        return self.path.split('?')[0] in valid_paths"},{"col":4,"comment":"null","endLoc":111,"header":"def __init__(self, cli)","id":7886,"name":"__init__","nodeType":"Function","startLoc":110,"text":"def __init__(self, cli):\n        self.cli = cli"},{"col":4,"comment":"null","endLoc":137,"header":"def __call__(self, f)","id":7887,"name":"__call__","nodeType":"Function","startLoc":113,"text":"def __call__(self, f):\n\n        def wrapped_f(*args):\n\n            if get_num_args(f) == 5 or args[2] is None:  # notification\n\n                f(*args)\n\n            else:  # call\n\n                try:\n                    result = f(*args)\n                    if result:\n                        self.cli.hub.reply(self.cli.get_private_key(), args[2],\n                                           {\"samp.status\": SAMP_STATUS_ERROR,\n                                            \"samp.result\": result})\n                except Exception:\n                    err = StringIO()\n                    traceback.print_exc(file=err)\n                    txt = err.getvalue()\n                    self.cli.hub.reply(self.cli.get_private_key(), args[2],\n                                       {\"samp.status\": SAMP_STATUS_ERROR,\n                                        \"samp.result\": {\"txt\": txt}})\n\n        return wrapped_f"},{"col":0,"comment":"\n    Find the number of arguments a function or method takes (excluding ``self``).\n    ","endLoc":172,"header":"def get_num_args(f)","id":7888,"name":"get_num_args","nodeType":"Function","startLoc":163,"text":"def get_num_args(f):\n    \"\"\"\n    Find the number of arguments a function or method takes (excluding ``self``).\n    \"\"\"\n    if inspect.ismethod(f):\n        return f.__func__.__code__.co_argcount - 1\n    elif inspect.isfunction(f):\n        return f.__code__.co_argcount\n    else:\n        raise TypeError(\"f should be a function or a method\")"},{"col":4,"comment":"null","endLoc":41,"header":"def _send_CORS_header(self)","id":7889,"name":"_send_CORS_header","nodeType":"Function","startLoc":23,"text":"def _send_CORS_header(self):\n\n        if self.headers.get('Origin') is not None:\n\n            method = self.headers.get('Access-Control-Request-Method')\n            if method and self.command == \"OPTIONS\":\n                # Preflight method\n                self.send_header('Content-Length', '0')\n                self.send_header('Access-Control-Allow-Origin',\n                                 self.headers.get('Origin'))\n                self.send_header('Access-Control-Allow-Methods', method)\n                self.send_header('Access-Control-Allow-Headers', 'Content-Type')\n                self.send_header('Access-Control-Allow-Credentials', 'true')\n            else:\n                # Simple method\n                self.send_header('Access-Control-Allow-Origin',\n                                 self.headers.get('Origin'))\n                self.send_header('Access-Control-Allow-Headers', 'Content-Type')\n                self.send_header('Access-Control-Allow-Credentials', 'true')"},{"col":4,"comment":"\n        Recursively iterate over all sub-:class:`Group` instances in\n        this :class:`Group`.\n        ","endLoc":2128,"header":"def iter_groups(self)","id":7890,"name":"iter_groups","nodeType":"Function","startLoc":2119,"text":"def iter_groups(self):\n        \"\"\"\n        Recursively iterate over all sub-:class:`Group` instances in\n        this :class:`Group`.\n        \"\"\"\n        for entry in self.entries:\n            if isinstance(entry, Group):\n                yield entry\n                for group in entry.iter_groups():\n                    yield group"},{"attributeType":"null","col":8,"comment":"null","endLoc":2015,"id":7891,"name":"ref","nodeType":"Attribute","startLoc":2015,"text":"self.ref"},{"attributeType":"null","col":8,"comment":"null","endLoc":2010,"id":7892,"name":"_table","nodeType":"Attribute","startLoc":2010,"text":"self._table"},{"attributeType":"HomogeneousList","col":8,"comment":"null","endLoc":2020,"id":7893,"name":"_entries","nodeType":"Attribute","startLoc":2020,"text":"self._entries"},{"attributeType":"null","col":8,"comment":"null","endLoc":2016,"id":7894,"name":"ucd","nodeType":"Attribute","startLoc":2016,"text":"self.ucd"},{"attributeType":"null","col":4,"comment":"null","endLoc":1258,"id":7895,"name":"attr_classes","nodeType":"Attribute","startLoc":1258,"text":"attr_classes"},{"attributeType":"null","col":4,"comment":"null","endLoc":1262,"id":7896,"name":"_xyz","nodeType":"Attribute","startLoc":1262,"text":"_xyz"},{"attributeType":"null","col":8,"comment":"null","endLoc":2014,"id":7897,"name":"name","nodeType":"Attribute","startLoc":2014,"text":"self.name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1353,"id":7898,"name":"xyz","nodeType":"Attribute","startLoc":1353,"text":"xyz"},{"attributeType":"null","col":16,"comment":"null","endLoc":1281,"id":7899,"name":"_differentials","nodeType":"Attribute","startLoc":1281,"text":"self._differentials"},{"attributeType":"null","col":16,"comment":"null","endLoc":1273,"id":7900,"name":"_xyz","nodeType":"Attribute","startLoc":1273,"text":"self._xyz"},{"attributeType":"null","col":16,"comment":"null","endLoc":1280,"id":7901,"name":"_x","nodeType":"Attribute","startLoc":1280,"text":"self._x"},{"fileName":"integrated_client.py","filePath":"astropy/samp","id":7902,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nfrom .client import SAMPClient\nfrom .hub_proxy import SAMPHubProxy\n\n__all__ = ['SAMPIntegratedClient']\n\n__doctest_skip__ = ['SAMPIntegratedClient.*']\n\n\nclass SAMPIntegratedClient:\n    \"\"\"\n    A Simple SAMP client.\n\n    This class is meant to simplify the client usage providing a proxy class\n    that merges the :class:`~astropy.samp.SAMPClient` and\n    :class:`~astropy.samp.SAMPHubProxy` functionalities in a\n    simplified API.\n\n    Parameters\n    ----------\n    name : str, optional\n        Client name (corresponding to ``samp.name`` metadata keyword).\n\n    description : str, optional\n        Client description (corresponding to ``samp.description.text`` metadata\n        keyword).\n\n    metadata : dict, optional\n        Client application metadata in the standard SAMP format.\n\n    addr : str, optional\n        Listening address (or IP). This defaults to 127.0.0.1 if the internet\n        is not reachable, otherwise it defaults to the host name.\n\n    port : int, optional\n        Listening XML-RPC server socket port. If left set to 0 (the default),\n        the operating system will select a free port.\n\n    callable : bool, optional\n        Whether the client can receive calls and notifications. If set to\n        `False`, then the client can send notifications and calls, but can not\n        receive any.\n    \"\"\"\n\n    def __init__(self, name=None, description=None, metadata=None,\n                 addr=None, port=0, callable=True):\n\n        self.hub = SAMPHubProxy()\n\n        self.client_arguments = {\n            'name': name,\n            'description': description,\n            'metadata': metadata,\n            'addr': addr,\n            'port': port,\n            'callable': callable,\n        }\n        \"\"\"\n        Collected arguments that should be passed on to the SAMPClient below.\n        The SAMPClient used to be instantiated in __init__; however, this\n        caused problems with disconnecting and reconnecting to the HUB.\n        The client_arguments is used to maintain backwards compatibility.\n        \"\"\"\n\n        self.client = None\n        \"The client will be instantiated upon connect().\"\n\n    # GENERAL\n\n    @property\n    def is_connected(self):\n        \"\"\"\n        Testing method to verify the client connection with a running Hub.\n\n        Returns\n        -------\n        is_connected : bool\n            True if the client is connected to a Hub, False otherwise.\n        \"\"\"\n        return self.hub.is_connected and self.client.is_running\n\n    def connect(self, hub=None, hub_params=None, pool_size=20):\n        \"\"\"\n        Connect with the current or specified SAMP Hub, start and register the\n        client.\n\n        Parameters\n        ----------\n        hub : `~astropy.samp.SAMPHubServer`, optional\n            The hub to connect to.\n\n        hub_params : dict, optional\n            Optional dictionary containing the lock-file content of the Hub\n            with which to connect. This dictionary has the form\n            ``{<token-name>: <token-string>, ...}``.\n\n        pool_size : int, optional\n            The number of socket connections opened to communicate with the\n            Hub.\n        \"\"\"\n        self.hub.connect(hub, hub_params, pool_size)\n\n        # The client has to be instantiated here and not in __init__() because\n        # this allows disconnecting and reconnecting to the HUB. Nonetheless,\n        # the client_arguments are set in __init__() because the\n        # instantiation of the client used to happen there and this retains\n        # backwards compatibility.\n        self.client = SAMPClient(\n            self.hub,\n            **self.client_arguments\n        )\n        self.client.start()\n        self.client.register()\n\n    def disconnect(self):\n        \"\"\"\n        Unregister the client from the current SAMP Hub, stop the client and\n        disconnect from the Hub.\n        \"\"\"\n        if self.is_connected:\n            try:\n                self.client.unregister()\n            finally:\n                if self.client.is_running:\n                    self.client.stop()\n                self.hub.disconnect()\n\n    # HUB\n    def ping(self):\n        \"\"\"\n        Proxy to ``ping`` SAMP Hub method (Standard Profile only).\n        \"\"\"\n        return self.hub.ping()\n\n    def declare_metadata(self, metadata):\n        \"\"\"\n        Proxy to ``declareMetadata`` SAMP Hub method.\n        \"\"\"\n        return self.client.declare_metadata(metadata)\n\n    def get_metadata(self, client_id):\n        \"\"\"\n        Proxy to ``getMetadata`` SAMP Hub method.\n        \"\"\"\n        return self.hub.get_metadata(self.get_private_key(), client_id)\n\n    def get_subscriptions(self, client_id):\n        \"\"\"\n        Proxy to ``getSubscriptions`` SAMP Hub method.\n        \"\"\"\n        return self.hub.get_subscriptions(self.get_private_key(), client_id)\n\n    def get_registered_clients(self):\n        \"\"\"\n        Proxy to ``getRegisteredClients`` SAMP Hub method.\n\n        This returns all the registered clients, excluding the current client.\n        \"\"\"\n        return self.hub.get_registered_clients(self.get_private_key())\n\n    def get_subscribed_clients(self, mtype):\n        \"\"\"\n        Proxy to ``getSubscribedClients`` SAMP Hub method.\n        \"\"\"\n        return self.hub.get_subscribed_clients(self.get_private_key(), mtype)\n\n    def _format_easy_msg(self, mtype, params):\n\n        msg = {}\n\n        if \"extra_kws\" in params:\n            extra = params[\"extra_kws\"]\n            del(params[\"extra_kws\"])\n            msg = {\"samp.mtype\": mtype, \"samp.params\": params}\n            msg.update(extra)\n        else:\n            msg = {\"samp.mtype\": mtype, \"samp.params\": params}\n\n        return msg\n\n    def notify(self, recipient_id, message):\n        \"\"\"\n        Proxy to ``notify`` SAMP Hub method.\n        \"\"\"\n        return self.hub.notify(self.get_private_key(), recipient_id, message)\n\n    def enotify(self, recipient_id, mtype, **params):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.notify`.\n\n        This is a proxy to ``notify`` method that allows to send the\n        notification message in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        recipient_id : str\n            Recipient ID\n\n        mtype : str\n            the MType to be notified\n\n        params : dict or set of str\n            Variable keyword set which contains the list of parameters for the\n            specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> cli.enotify(\"samp.msg.progress\", msgid = \"xyz\", txt = \"initialization\",\n        ...             percent = \"10\", extra_kws = {\"my.extra.info\": \"just an example\"})\n        \"\"\"\n        return self.notify(recipient_id, self._format_easy_msg(mtype, params))\n\n    def notify_all(self, message):\n        \"\"\"\n        Proxy to ``notifyAll`` SAMP Hub method.\n        \"\"\"\n        return self.hub.notify_all(self.get_private_key(), message)\n\n    def enotify_all(self, mtype, **params):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.notify_all`.\n\n        This is a proxy to ``notifyAll`` method that allows to send the\n        notification message in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be notified.\n\n        params : dict or set of str\n            Variable keyword set which contains the list of parameters for\n            the specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> cli.enotify_all(\"samp.msg.progress\", txt = \"initialization\",\n        ...                 percent = \"10\",\n        ...                 extra_kws = {\"my.extra.info\": \"just an example\"})\n        \"\"\"\n        return self.notify_all(self._format_easy_msg(mtype, params))\n\n    def call(self, recipient_id, msg_tag, message):\n        \"\"\"\n        Proxy to ``call`` SAMP Hub method.\n        \"\"\"\n        return self.hub.call(self.get_private_key(), recipient_id, msg_tag, message)\n\n    def ecall(self, recipient_id, msg_tag, mtype, **params):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.call`.\n\n        This is a proxy to ``call`` method that allows to send a call message\n        in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        recipient_id : str\n            Recipient ID\n\n        msg_tag : str\n            Message tag to use\n\n        mtype : str\n            MType to be sent\n\n        params : dict of set of str\n            Variable keyword set which contains the list of parameters for\n            the specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> msgid = cli.ecall(\"abc\", \"xyz\", \"samp.msg.progress\",\n        ...                   txt = \"initialization\", percent = \"10\",\n        ...                   extra_kws = {\"my.extra.info\": \"just an example\"})\n        \"\"\"\n\n        return self.call(recipient_id, msg_tag, self._format_easy_msg(mtype, params))\n\n    def call_all(self, msg_tag, message):\n        \"\"\"\n        Proxy to ``callAll`` SAMP Hub method.\n        \"\"\"\n        return self.hub.call_all(self.get_private_key(), msg_tag, message)\n\n    def ecall_all(self, msg_tag, mtype, **params):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.call_all`.\n\n        This is a proxy to ``callAll`` method that allows to send the call\n        message in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        msg_tag : str\n            Message tag to use\n\n        mtype : str\n            MType to be sent\n\n        params : dict of set of str\n            Variable keyword set which contains the list of parameters for\n            the specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> msgid = cli.ecall_all(\"xyz\", \"samp.msg.progress\",\n        ...                       txt = \"initialization\", percent = \"10\",\n        ...                       extra_kws = {\"my.extra.info\": \"just an example\"})\n        \"\"\"\n        self.call_all(msg_tag, self._format_easy_msg(mtype, params))\n\n    def call_and_wait(self, recipient_id, message, timeout):\n        \"\"\"\n        Proxy to ``callAndWait`` SAMP Hub method.\n        \"\"\"\n        return self.hub.call_and_wait(self.get_private_key(), recipient_id, message, timeout)\n\n    def ecall_and_wait(self, recipient_id, mtype, timeout, **params):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.call_and_wait`.\n\n        This is a proxy to ``callAndWait`` method that allows to send the call\n        message in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        recipient_id : str\n            Recipient ID\n\n        mtype : str\n            MType to be sent\n\n        timeout : str\n            Call timeout in seconds\n\n        params : dict of set of str\n            Variable keyword set which contains the list of parameters for\n            the specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> cli.ecall_and_wait(\"xyz\", \"samp.msg.progress\", \"5\",\n        ...                    txt = \"initialization\", percent = \"10\",\n        ...                    extra_kws = {\"my.extra.info\": \"just an example\"})\n        \"\"\"\n        return self.call_and_wait(recipient_id, self._format_easy_msg(mtype, params), timeout)\n\n    def reply(self, msg_id, response):\n        \"\"\"\n        Proxy to ``reply`` SAMP Hub method.\n        \"\"\"\n        return self.hub.reply(self.get_private_key(), msg_id, response)\n\n    def _format_easy_response(self, status, result, error):\n\n        msg = {\"samp.status\": status}\n        if result is not None:\n            msg.update({\"samp.result\": result})\n        if error is not None:\n            msg.update({\"samp.error\": error})\n\n        return msg\n\n    def ereply(self, msg_id, status, result=None, error=None):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.reply`.\n\n        This is a proxy to ``reply`` method that allows to send a reply\n        message in a simplified way.\n\n        Parameters\n        ----------\n        msg_id : str\n            Message ID to which reply.\n\n        status : str\n            Content of the ``samp.status`` response keyword.\n\n        result : dict\n            Content of the ``samp.result`` response keyword.\n\n        error : dict\n            Content of the ``samp.error`` response keyword.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient, SAMP_STATUS_ERROR\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> cli.ereply(\"abd\", SAMP_STATUS_ERROR, result={},\n        ...            error={\"samp.errortxt\": \"Test error message\"})\n        \"\"\"\n        return self.reply(msg_id, self._format_easy_response(status, result, error))\n\n    # CLIENT\n\n    def receive_notification(self, private_key, sender_id, message):\n        return self.client.receive_notification(private_key, sender_id, message)\n\n    receive_notification.__doc__ = SAMPClient.receive_notification.__doc__\n\n    def receive_call(self, private_key, sender_id, msg_id, message):\n        return self.client.receive_call(private_key, sender_id, msg_id, message)\n\n    receive_call.__doc__ = SAMPClient.receive_call.__doc__\n\n    def receive_response(self, private_key, responder_id, msg_tag, response):\n        return self.client.receive_response(private_key, responder_id, msg_tag, response)\n\n    receive_response.__doc__ = SAMPClient.receive_response.__doc__\n\n    def bind_receive_message(self, mtype, function, declare=True, metadata=None):\n        self.client.bind_receive_message(mtype, function, declare=True, metadata=None)\n\n    bind_receive_message.__doc__ = SAMPClient.bind_receive_message.__doc__\n\n    def bind_receive_notification(self, mtype, function, declare=True, metadata=None):\n        self.client.bind_receive_notification(mtype, function, declare, metadata)\n\n    bind_receive_notification.__doc__ = SAMPClient.bind_receive_notification.__doc__\n\n    def bind_receive_call(self, mtype, function, declare=True, metadata=None):\n        self.client.bind_receive_call(mtype, function, declare, metadata)\n\n    bind_receive_call.__doc__ = SAMPClient.bind_receive_call.__doc__\n\n    def bind_receive_response(self, msg_tag, function):\n        self.client.bind_receive_response(msg_tag, function)\n\n    bind_receive_response.__doc__ = SAMPClient.bind_receive_response.__doc__\n\n    def unbind_receive_notification(self, mtype, declare=True):\n        self.client.unbind_receive_notification(mtype, declare)\n\n    unbind_receive_notification.__doc__ = SAMPClient.unbind_receive_notification.__doc__\n\n    def unbind_receive_call(self, mtype, declare=True):\n        self.client.unbind_receive_call(mtype, declare)\n\n    unbind_receive_call.__doc__ = SAMPClient.unbind_receive_call.__doc__\n\n    def unbind_receive_response(self, msg_tag):\n        self.client.unbind_receive_response(msg_tag)\n\n    unbind_receive_response.__doc__ = SAMPClient.unbind_receive_response.__doc__\n\n    def declare_subscriptions(self, subscriptions=None):\n        self.client.declare_subscriptions(subscriptions)\n\n    declare_subscriptions.__doc__ = SAMPClient.declare_subscriptions.__doc__\n\n    def get_private_key(self):\n        return self.client.get_private_key()\n\n    get_private_key.__doc__ = SAMPClient.get_private_key.__doc__\n\n    def get_public_id(self):\n        return self.client.get_public_id()\n\n    get_public_id.__doc__ = SAMPClient.get_public_id.__doc__\n"},{"attributeType":"null","col":20,"comment":"null","endLoc":1278,"id":7903,"name":"_xyz_axis","nodeType":"Attribute","startLoc":1278,"text":"self._xyz_axis"},{"attributeType":"null","col":25,"comment":"null","endLoc":1280,"id":7904,"name":"_y","nodeType":"Attribute","startLoc":1280,"text":"self._y"},{"col":4,"comment":"null","endLoc":45,"header":"def end_headers(self)","id":7905,"name":"end_headers","nodeType":"Function","startLoc":43,"text":"def end_headers(self):\n        self._send_CORS_header()\n        SAMPSimpleXMLRPCRequestHandler.end_headers(self)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2017,"id":7906,"name":"utype","nodeType":"Attribute","startLoc":2017,"text":"self.utype"},{"attributeType":"null","col":34,"comment":"null","endLoc":1280,"id":7907,"name":"_z","nodeType":"Attribute","startLoc":1280,"text":"self._z"},{"col":4,"comment":"null","endLoc":77,"header":"def _serve_cross_domain_xml(self)","id":7908,"name":"_serve_cross_domain_xml","nodeType":"Function","startLoc":47,"text":"def _serve_cross_domain_xml(self):\n\n        cross_domain = False\n\n        if self.path == \"/crossdomain.xml\":\n\n            # Adobe standard\n            response = CROSS_DOMAIN\n\n            self.send_response(200, 'OK')\n            self.send_header('Content-Type', 'text/x-cross-domain-policy')\n            self.send_header(\"Content-Length\", f\"{len(response)}\")\n            self.end_headers()\n            self.wfile.write(response.encode('utf-8'))\n            self.wfile.flush()\n            cross_domain = True\n\n        elif self.path == \"/clientaccesspolicy.xml\":\n\n            # Microsoft standard\n            response = CLIENT_ACCESS_POLICY\n\n            self.send_response(200, 'OK')\n            self.send_header('Content-Type', 'text/xml')\n            self.send_header(\"Content-Length\", f\"{len(response)}\")\n            self.end_headers()\n            self.wfile.write(response.encode('utf-8'))\n            self.wfile.flush()\n            cross_domain = True\n\n        return cross_domain"},{"attributeType":"null","col":8,"comment":"null","endLoc":2039,"id":7909,"name":"_ref","nodeType":"Attribute","startLoc":2039,"text":"self._ref"},{"attributeType":"null","col":24,"comment":"null","endLoc":8,"id":7910,"name":"xmlrpc","nodeType":"Attribute","startLoc":8,"text":"xmlrpc"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":7911,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"standard_profile.py#<anonymous>","id":7912,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = []"},{"className":"SphericalRepresentation","col":0,"comment":"\n    Representation of points in 3D spherical coordinates.\n\n    Parameters\n    ----------\n    lon, lat : `~astropy.units.Quantity` ['angle']\n        The longitude and latitude of the point(s), in angular units. The\n        latitude should be between -90 and 90 degrees, and the longitude will\n        be wrapped to an angle between 0 and 360 degrees. These can also be\n        instances of `~astropy.coordinates.Angle`,\n        `~astropy.coordinates.Longitude`, or `~astropy.coordinates.Latitude`.\n\n    distance : `~astropy.units.Quantity` ['length']\n        The distance to the point(s). If the distance is a length, it is\n        passed to the :class:`~astropy.coordinates.Distance` class, otherwise\n        it is passed to the :class:`~astropy.units.Quantity` class.\n\n    differentials : dict, `~astropy.coordinates.BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `~astropy.coordinates.BaseDifferential`\n        instance (see `._compatible_differentials` for valid types), or a\n        dictionary of of differential instances with keys set to a string\n        representation of the SI unit with which the differential (derivative)\n        is taken. For example, for a velocity differential on a positional\n        representation, the key would be ``'s'`` for seconds, indicating that\n        the derivative is a time derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    ","endLoc":2087,"id":7913,"nodeType":"Class","startLoc":1889,"text":"class SphericalRepresentation(BaseRepresentation):\n    \"\"\"\n    Representation of points in 3D spherical coordinates.\n\n    Parameters\n    ----------\n    lon, lat : `~astropy.units.Quantity` ['angle']\n        The longitude and latitude of the point(s), in angular units. The\n        latitude should be between -90 and 90 degrees, and the longitude will\n        be wrapped to an angle between 0 and 360 degrees. These can also be\n        instances of `~astropy.coordinates.Angle`,\n        `~astropy.coordinates.Longitude`, or `~astropy.coordinates.Latitude`.\n\n    distance : `~astropy.units.Quantity` ['length']\n        The distance to the point(s). If the distance is a length, it is\n        passed to the :class:`~astropy.coordinates.Distance` class, otherwise\n        it is passed to the :class:`~astropy.units.Quantity` class.\n\n    differentials : dict, `~astropy.coordinates.BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `~astropy.coordinates.BaseDifferential`\n        instance (see `._compatible_differentials` for valid types), or a\n        dictionary of of differential instances with keys set to a string\n        representation of the SI unit with which the differential (derivative)\n        is taken. For example, for a velocity differential on a positional\n        representation, the key would be ``'s'`` for seconds, indicating that\n        the derivative is a time derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n\n    attr_classes = {'lon': Longitude,\n                    'lat': Latitude,\n                    'distance': u.Quantity}\n    _unit_representation = UnitSphericalRepresentation\n\n    def __init__(self, lon, lat=None, distance=None, differentials=None,\n                 copy=True):\n        super().__init__(lon, lat, distance, copy=copy,\n                         differentials=differentials)\n        if (not isinstance(self._distance, Distance)\n                and self._distance.unit.physical_type == 'length'):\n            try:\n                self._distance = Distance(self._distance, copy=False)\n            except ValueError as e:\n                if e.args[0].startswith('distance must be >= 0'):\n                    raise ValueError(\"Distance must be >= 0. To allow negative \"\n                                     \"distance values, you must explicitly pass\"\n                                     \" in a `Distance` object with the the \"\n                                     \"argument 'allow_negative=True'.\") from e\n                else:\n                    raise\n\n    @classproperty\n    def _compatible_differentials(cls):\n        return [UnitSphericalDifferential, UnitSphericalCosLatDifferential,\n                SphericalDifferential, SphericalCosLatDifferential,\n                RadialDifferential]\n\n    @property\n    def lon(self):\n        \"\"\"\n        The longitude of the point(s).\n        \"\"\"\n        return self._lon\n\n    @property\n    def lat(self):\n        \"\"\"\n        The latitude of the point(s).\n        \"\"\"\n        return self._lat\n\n    @property\n    def distance(self):\n        \"\"\"\n        The distance from the origin to the point(s).\n        \"\"\"\n        return self._distance\n\n    def unit_vectors(self):\n        sinlon, coslon = np.sin(self.lon), np.cos(self.lon)\n        sinlat, coslat = np.sin(self.lat), np.cos(self.lat)\n        return {\n            'lon': CartesianRepresentation(-sinlon, coslon, 0., copy=False),\n            'lat': CartesianRepresentation(-sinlat*coslon, -sinlat*sinlon,\n                                           coslat, copy=False),\n            'distance': CartesianRepresentation(coslat*coslon, coslat*sinlon,\n                                                sinlat, copy=False)}\n\n    def scale_factors(self, omit_coslat=False):\n        sf_lat = self.distance / u.radian\n        sf_lon = sf_lat if omit_coslat else sf_lat * np.cos(self.lat)\n        sf_distance = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return {'lon': sf_lon,\n                'lat': sf_lat,\n                'distance': sf_distance}\n\n    def represent_as(self, other_class, differential_class=None):\n        # Take a short cut if the other class is a spherical representation\n\n        if inspect.isclass(other_class):\n            if issubclass(other_class, PhysicsSphericalRepresentation):\n                diffs = self._re_represent_differentials(other_class,\n                                                         differential_class)\n                return other_class(phi=self.lon, theta=90 * u.deg - self.lat,\n                                   r=self.distance, differentials=diffs,\n                                   copy=False)\n\n            elif issubclass(other_class, UnitSphericalRepresentation):\n                diffs = self._re_represent_differentials(other_class,\n                                                         differential_class)\n                return other_class(lon=self.lon, lat=self.lat,\n                                   differentials=diffs, copy=False)\n\n        return super().represent_as(other_class, differential_class)\n\n    def to_cartesian(self):\n        \"\"\"\n        Converts spherical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        \"\"\"\n\n        # We need to convert Distance to Quantity to allow negative values.\n        if isinstance(self.distance, Distance):\n            d = self.distance.view(u.Quantity)\n        else:\n            d = self.distance\n\n        # erfa s2p: Convert spherical polar coordinates to p-vector.\n        p = erfa_ufunc.s2p(self.lon, self.lat, d)\n\n        return CartesianRepresentation(p, xyz_axis=-1, copy=False)\n\n    @classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates to spherical polar\n        coordinates.\n        \"\"\"\n        p = cart.get_xyz(xyz_axis=-1)\n        # erfa p2s: P-vector to spherical polar coordinates.\n        return cls(*erfa_ufunc.p2s(p), copy=False)\n\n    def transform(self, matrix):\n        \"\"\"Transform the spherical coordinates using a 3x3 matrix.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 matrix, such as a rotation matrix (or a stack of matrices).\n\n        \"\"\"\n        xyz = erfa_ufunc.s2c(self.lon, self.lat)\n        p = erfa_ufunc.rxp(matrix, xyz)\n        lon, lat, ur = erfa_ufunc.p2s(p)\n        rep = self.__class__(lon=lon, lat=lat, distance=self.distance * ur)\n\n        # handle differentials\n        new_diffs = dict((k, d.transform(matrix, self, rep))\n                         for k, d in self.differentials.items())\n        return rep.with_differentials(new_diffs)\n\n    def norm(self):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.  For\n        spherical coordinates, this is just the absolute value of the distance.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\n        return np.abs(self.distance)\n\n    def _scale_operation(self, op, *args):\n        # TODO: expand special-casing to UnitSpherical and RadialDifferential.\n        if any(differential.base_representation is not self.__class__\n               for differential in self.differentials.values()):\n            return super()._scale_operation(op, *args)\n\n        lon_op, lat_op, distance_op = _spherical_op_funcs(op, *args)\n\n        result = self.__class__(lon_op(self.lon), lat_op(self.lat),\n                                distance_op(self.distance), copy=False)\n        for key, differential in self.differentials.items():\n            new_comps = (op(getattr(differential, comp)) for op, comp in zip(\n                (operator.pos, lat_op, distance_op),\n                differential.components))\n            result.differentials[key] = differential.__class__(*new_comps, copy=False)\n        return result"},{"col":4,"comment":"null","endLoc":1948,"header":"@classproperty\n    def _compatible_differentials(cls)","id":7914,"name":"_compatible_differentials","nodeType":"Function","startLoc":1944,"text":"@classproperty\n    def _compatible_differentials(cls):\n        return [UnitSphericalDifferential, UnitSphericalCosLatDifferential,\n                SphericalDifferential, SphericalCosLatDifferential,\n                RadialDifferential]"},{"col":4,"comment":"\n        The longitude of the point(s).\n        ","endLoc":1955,"header":"@property\n    def lon(self)","id":7915,"name":"lon","nodeType":"Function","startLoc":1950,"text":"@property\n    def lon(self):\n        \"\"\"\n        The longitude of the point(s).\n        \"\"\"\n        return self._lon"},{"col":4,"comment":"\n        The latitude of the point(s).\n        ","endLoc":1962,"header":"@property\n    def lat(self)","id":7916,"name":"lat","nodeType":"Function","startLoc":1957,"text":"@property\n    def lat(self):\n        \"\"\"\n        The latitude of the point(s).\n        \"\"\"\n        return self._lat"},{"col":4,"comment":"\n        The distance from the origin to the point(s).\n        ","endLoc":1969,"header":"@property\n    def distance(self)","id":7917,"name":"distance","nodeType":"Function","startLoc":1964,"text":"@property\n    def distance(self):\n        \"\"\"\n        The distance from the origin to the point(s).\n        \"\"\"\n        return self._distance"},{"col":4,"comment":"null","endLoc":1979,"header":"def unit_vectors(self)","id":7918,"name":"unit_vectors","nodeType":"Function","startLoc":1971,"text":"def unit_vectors(self):\n        sinlon, coslon = np.sin(self.lon), np.cos(self.lon)\n        sinlat, coslat = np.sin(self.lat), np.cos(self.lat)\n        return {\n            'lon': CartesianRepresentation(-sinlon, coslon, 0., copy=False),\n            'lat': CartesianRepresentation(-sinlat*coslon, -sinlat*sinlon,\n                                           coslat, copy=False),\n            'distance': CartesianRepresentation(coslat*coslon, coslat*sinlon,\n                                                sinlat, copy=False)}"},{"fileName":"hub.py","filePath":"astropy/samp","id":7919,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport copy\nimport os\nimport select\nimport socket\nimport threading\nimport time\nimport uuid\nimport warnings\nimport queue\nimport xmlrpc.client as xmlrpc\nfrom urllib.parse import urlunparse\n\nfrom astropy import log\n\nfrom .constants import SAMP_STATUS_OK\nfrom .constants import __profile_version__\nfrom .errors import SAMPWarning, SAMPHubError, SAMPProxyError\nfrom .utils import internet_on, ServerProxyPool, _HubAsClient\nfrom .lockfile_helpers import read_lockfile, create_lock_file\n\nfrom .standard_profile import ThreadingXMLRPCServer\nfrom .web_profile import WebProfileXMLRPCServer, web_profile_text_dialog\n\n\n__all__ = ['SAMPHubServer', 'WebProfileDialog']\n\n__doctest_skip__ = ['.', 'SAMPHubServer.*']\n\n\nclass SAMPHubServer:\n    \"\"\"\n    SAMP Hub Server.\n\n    Parameters\n    ----------\n    secret : str, optional\n        The secret code to use for the SAMP lockfile. If none is is specified,\n        the :func:`uuid.uuid1` function is used to generate one.\n\n    addr : str, optional\n        Listening address (or IP). This defaults to 127.0.0.1 if the internet\n        is not reachable, otherwise it defaults to the host name.\n\n    port : int, optional\n        Listening XML-RPC server socket port. If left set to 0 (the default),\n        the operating system will select a free port.\n\n    lockfile : str, optional\n        Custom lockfile name.\n\n    timeout : int, optional\n        Hub inactivity timeout. If ``timeout > 0`` then the Hub automatically\n        stops after an inactivity period longer than ``timeout`` seconds. By\n        default ``timeout`` is set to 0 (Hub never expires).\n\n    client_timeout : int, optional\n        Client inactivity timeout. If ``client_timeout > 0`` then the Hub\n        automatically unregisters the clients which result inactive for a\n        period longer than ``client_timeout`` seconds. By default\n        ``client_timeout`` is set to 0 (clients never expire).\n\n    mode : str, optional\n        Defines the Hub running mode. If ``mode`` is ``'single'`` then the Hub\n        runs using the standard ``.samp`` lock-file, having a single instance\n        for user desktop session. Otherwise, if ``mode`` is ``'multiple'``,\n        then the Hub runs using a non-standard lock-file, placed in\n        ``.samp-1`` directory, of the form ``samp-hub-<UUID>``, where\n        ``<UUID>`` is a unique UUID assigned to the hub.\n\n    label : str, optional\n        A string used to label the Hub with a human readable name. This string\n        is written in the lock-file assigned to the ``hub.label`` token.\n\n    web_profile : bool, optional\n        Enables or disables the Web Profile support.\n\n    web_profile_dialog : class, optional\n        Allows a class instance to be specified using ``web_profile_dialog``\n        to replace the terminal-based message with e.g. a GUI pop-up. Two\n        `queue.Queue` instances will be added to the instance as attributes\n        ``queue_request`` and ``queue_result``. When a request is received via\n        the ``queue_request`` queue, the pop-up should be displayed, and a\n        value of `True` or `False` should be added to ``queue_result``\n        depending on whether the user accepted or refused the connection.\n\n    web_port : int, optional\n        The port to use for web SAMP. This should not be changed except for\n        testing purposes, since web SAMP should always use port 21012.\n\n    pool_size : int, optional\n        The number of socket connections opened to communicate with the\n        clients.\n    \"\"\"\n\n    def __init__(self, secret=None, addr=None, port=0, lockfile=None,\n                 timeout=0, client_timeout=0, mode='single', label=\"\",\n                 web_profile=True, web_profile_dialog=None, web_port=21012,\n                 pool_size=20):\n\n        # Generate random ID for the hub\n        self._id = str(uuid.uuid1())\n\n        # General settings\n        self._is_running = False\n        self._customlockfilename = lockfile\n        self._lockfile = None\n        self._addr = addr\n        self._port = port\n        self._mode = mode\n        self._label = label\n        self._timeout = timeout\n        self._client_timeout = client_timeout\n        self._pool_size = pool_size\n\n        # Web profile specific attributes\n        self._web_profile = web_profile\n        self._web_profile_dialog = web_profile_dialog\n        self._web_port = web_port\n\n        self._web_profile_server = None\n        self._web_profile_callbacks = {}\n        self._web_profile_requests_queue = None\n        self._web_profile_requests_result = None\n        self._web_profile_requests_semaphore = None\n\n        self._host_name = \"127.0.0.1\"\n        if internet_on():\n            try:\n                self._host_name = socket.getfqdn()\n                socket.getaddrinfo(self._addr or self._host_name,\n                                   self._port or 0)\n            except socket.error:\n                self._host_name = \"127.0.0.1\"\n\n        # Threading stuff\n        self._thread_lock = threading.Lock()\n        self._thread_run = None\n        self._thread_hub_timeout = None\n        self._thread_client_timeout = None\n\n        self._launched_threads = []\n\n        # Variables for timeout testing:\n        self._last_activity_time = None\n        self._client_activity_time = {}\n\n        # Hub message id counter, used to create hub msg ids\n        self._hub_msg_id_counter = 0\n\n        # Hub secret code\n        self._hub_secret_code_customized = secret\n        self._hub_secret = self._create_secret_code()\n\n        # Hub public id (as SAMP client)\n        self._hub_public_id = \"\"\n\n        # Client ids\n        # {private_key: (public_id, timestamp)}\n        self._private_keys = {}\n\n        # Metadata per client\n        # {private_key: metadata}\n        self._metadata = {}\n\n        # List of subscribed clients per MType\n        # {mtype: private_key list}\n        self._mtype2ids = {}\n\n        # List of subscribed MTypes per client\n        # {private_key: mtype list}\n        self._id2mtypes = {}\n\n        # List of XML-RPC addresses per client\n        # {public_id: (XML-RPC address, ServerProxyPool instance)}\n        self._xmlrpc_endpoints = {}\n\n        # Synchronous message id heap\n        self._sync_msg_ids_heap = {}\n\n        # Public ids counter\n        self._client_id_counter = -1\n\n    @property\n    def id(self):\n        \"\"\"\n        The unique hub ID.\n        \"\"\"\n        return self._id\n\n    def _register_standard_api(self, server):\n        # Standard Profile only operations\n        server.register_function(self._ping, 'samp.hub.ping')\n        server.register_function(self._set_xmlrpc_callback, 'samp.hub.setXmlrpcCallback')\n\n        # Standard API operations\n        server.register_function(self._register, 'samp.hub.register')\n        server.register_function(self._unregister, 'samp.hub.unregister')\n        server.register_function(self._declare_metadata, 'samp.hub.declareMetadata')\n        server.register_function(self._get_metadata, 'samp.hub.getMetadata')\n        server.register_function(self._declare_subscriptions, 'samp.hub.declareSubscriptions')\n        server.register_function(self._get_subscriptions, 'samp.hub.getSubscriptions')\n        server.register_function(self._get_registered_clients, 'samp.hub.getRegisteredClients')\n        server.register_function(self._get_subscribed_clients, 'samp.hub.getSubscribedClients')\n        server.register_function(self._notify, 'samp.hub.notify')\n        server.register_function(self._notify_all, 'samp.hub.notifyAll')\n        server.register_function(self._call, 'samp.hub.call')\n        server.register_function(self._call_all, 'samp.hub.callAll')\n        server.register_function(self._call_and_wait, 'samp.hub.callAndWait')\n        server.register_function(self._reply, 'samp.hub.reply')\n\n    def _register_web_profile_api(self, server):\n        # Web Profile methods like Standard Profile\n        server.register_function(self._ping, 'samp.webhub.ping')\n        server.register_function(self._unregister, 'samp.webhub.unregister')\n        server.register_function(self._declare_metadata, 'samp.webhub.declareMetadata')\n        server.register_function(self._get_metadata, 'samp.webhub.getMetadata')\n        server.register_function(self._declare_subscriptions, 'samp.webhub.declareSubscriptions')\n        server.register_function(self._get_subscriptions, 'samp.webhub.getSubscriptions')\n        server.register_function(self._get_registered_clients, 'samp.webhub.getRegisteredClients')\n        server.register_function(self._get_subscribed_clients, 'samp.webhub.getSubscribedClients')\n        server.register_function(self._notify, 'samp.webhub.notify')\n        server.register_function(self._notify_all, 'samp.webhub.notifyAll')\n        server.register_function(self._call, 'samp.webhub.call')\n        server.register_function(self._call_all, 'samp.webhub.callAll')\n        server.register_function(self._call_and_wait, 'samp.webhub.callAndWait')\n        server.register_function(self._reply, 'samp.webhub.reply')\n\n        # Methods particularly for Web Profile\n        server.register_function(self._web_profile_register, 'samp.webhub.register')\n        server.register_function(self._web_profile_allowReverseCallbacks, 'samp.webhub.allowReverseCallbacks')\n        server.register_function(self._web_profile_pullCallbacks, 'samp.webhub.pullCallbacks')\n\n    def _start_standard_server(self):\n\n        self._server = ThreadingXMLRPCServer(\n                (self._addr or self._host_name, self._port or 0),\n                log, logRequests=False, allow_none=True)\n        prot = 'http'\n\n        self._port = self._server.socket.getsockname()[1]\n        addr = f\"{self._addr or self._host_name}:{self._port}\"\n        self._url = urlunparse((prot, addr, '', '', '', ''))\n        self._server.register_introspection_functions()\n        self._register_standard_api(self._server)\n\n    def _start_web_profile_server(self):\n        self._web_profile_requests_queue = queue.Queue(1)\n        self._web_profile_requests_result = queue.Queue(1)\n        self._web_profile_requests_semaphore = queue.Queue(1)\n\n        if self._web_profile_dialog is not None:\n            # TODO: Some sort of duck-typing on the web_profile_dialog object\n            self._web_profile_dialog.queue_request = \\\n                    self._web_profile_requests_queue\n            self._web_profile_dialog.queue_result = \\\n                    self._web_profile_requests_result\n\n        try:\n            self._web_profile_server = WebProfileXMLRPCServer(\n                    ('localhost', self._web_port), log, logRequests=False,\n                    allow_none=True)\n            self._web_port = self._web_profile_server.socket.getsockname()[1]\n            self._web_profile_server.register_introspection_functions()\n            self._register_web_profile_api(self._web_profile_server)\n            log.info(\"Hub set to run with Web Profile support enabled.\")\n        except socket.error:\n            log.warning(\"Port {} already in use. Impossible to run the \"\n                        \"Hub with Web Profile support.\".format(self._web_port),\n                        SAMPWarning)\n            self._web_profile = False\n            # Cleanup\n            self._web_profile_requests_queue = None\n            self._web_profile_requests_result = None\n            self._web_profile_requests_semaphore = None\n\n    def _launch_thread(self, group=None, target=None, name=None, args=None):\n\n        # Remove inactive threads\n        remove = []\n        for t in self._launched_threads:\n            if not t.is_alive():\n                remove.append(t)\n        for t in remove:\n            self._launched_threads.remove(t)\n\n        # Start new thread\n        t = threading.Thread(group=group, target=target, name=name, args=args)\n        t.start()\n\n        # Add to list of launched threads\n        self._launched_threads.append(t)\n\n    def _join_launched_threads(self, timeout=None):\n        for t in self._launched_threads:\n            t.join(timeout=timeout)\n\n    def _timeout_test_hub(self):\n\n        if self._timeout == 0:\n            return\n\n        last = time.time()\n        while self._is_running:\n            time.sleep(0.05)  # keep this small to check _is_running often\n            now = time.time()\n            if now - last > 1.:\n                with self._thread_lock:\n                    if self._last_activity_time is not None:\n                        if now - self._last_activity_time >= self._timeout:\n                            warnings.warn(\"Timeout expired, Hub is shutting down!\",\n                                          SAMPWarning)\n                            self.stop()\n                            return\n                last = now\n\n    def _timeout_test_client(self):\n\n        if self._client_timeout == 0:\n            return\n\n        last = time.time()\n        while self._is_running:\n            time.sleep(0.05)  # keep this small to check _is_running often\n            now = time.time()\n            if now - last > 1.:\n                for private_key in self._client_activity_time.keys():\n                    if (now - self._client_activity_time[private_key] > self._client_timeout\n                        and private_key != self._hub_private_key):\n                        warnings.warn(\n                            f\"Client {private_key} timeout expired!\",\n                            SAMPWarning)\n                        self._notify_disconnection(private_key)\n                        self._unregister(private_key)\n                last = now\n\n    def _hub_as_client_request_handler(self, method, args):\n        if method == 'samp.client.receiveCall':\n            return self._receive_call(*args)\n        elif method == 'samp.client.receiveNotification':\n            return self._receive_notification(*args)\n        elif method == 'samp.client.receiveResponse':\n            return self._receive_response(*args)\n        elif method == 'samp.app.ping':\n            return self._ping(*args)\n\n    def _setup_hub_as_client(self):\n\n        hub_metadata = {\"samp.name\": \"Astropy SAMP Hub\",\n                        \"samp.description.text\": self._label,\n                        \"author.name\": \"The Astropy Collaboration\",\n                        \"samp.documentation.url\": \"https://docs.astropy.org/en/stable/samp\",\n                        \"samp.icon.url\": self._url + \"/samp/icon\"}\n\n        result = self._register(self._hub_secret)\n        self._hub_public_id = result[\"samp.self-id\"]\n        self._hub_private_key = result[\"samp.private-key\"]\n        self._set_xmlrpc_callback(self._hub_private_key, self._url)\n        self._declare_metadata(self._hub_private_key, hub_metadata)\n        self._declare_subscriptions(self._hub_private_key,\n                                    {\"samp.app.ping\": {},\n                                     \"x-samp.query.by-meta\": {}})\n\n    def start(self, wait=False):\n        \"\"\"\n        Start the current SAMP Hub instance and create the lock file. Hub\n        start-up can be blocking or non blocking depending on the ``wait``\n        parameter.\n\n        Parameters\n        ----------\n        wait : bool\n            If `True` then the Hub process is joined with the caller, blocking\n            the code flow. Usually `True` option is used to run a stand-alone\n            Hub in an executable script. If `False` (default), then the Hub\n            process runs in a separated thread. `False` is usually used in a\n            Python shell.\n        \"\"\"\n\n        if self._is_running:\n            raise SAMPHubError(\"Hub is already running\")\n\n        if self._lockfile is not None:\n            raise SAMPHubError(\"Hub is not running but lockfile is set\")\n\n        if self._web_profile:\n            self._start_web_profile_server()\n\n        self._start_standard_server()\n\n        self._lockfile = create_lock_file(lockfilename=self._customlockfilename,\n                                          mode=self._mode, hub_id=self.id,\n                                          hub_params=self.params)\n\n        self._update_last_activity_time()\n        self._setup_hub_as_client()\n\n        self._start_threads()\n\n        log.info(\"Hub started\")\n\n        if wait and self._is_running:\n            self._thread_run.join()\n            self._thread_run = None\n\n    @property\n    def params(self):\n        \"\"\"\n        The hub parameters (which are written to the logfile)\n        \"\"\"\n\n        params = {}\n\n        # Keys required by standard profile\n\n        params['samp.secret'] = self._hub_secret\n        params['samp.hub.xmlrpc.url'] = self._url\n        params['samp.profile.version'] = __profile_version__\n\n        # Custom keys\n\n        params['hub.id'] = self.id\n        params['hub.label'] = self._label or f\"Hub {self.id}\"\n\n        return params\n\n    def _start_threads(self):\n        self._thread_run = threading.Thread(target=self._serve_forever)\n        self._thread_run.daemon = True\n\n        if self._timeout > 0:\n            self._thread_hub_timeout = threading.Thread(\n                    target=self._timeout_test_hub,\n                    name=\"Hub timeout test\")\n            self._thread_hub_timeout.daemon = True\n        else:\n            self._thread_hub_timeout = None\n\n        if self._client_timeout > 0:\n            self._thread_client_timeout = threading.Thread(\n                    target=self._timeout_test_client,\n                    name=\"Client timeout test\")\n            self._thread_client_timeout.daemon = True\n        else:\n            self._thread_client_timeout = None\n\n        self._is_running = True\n        self._thread_run.start()\n\n        if self._thread_hub_timeout is not None:\n            self._thread_hub_timeout.start()\n        if self._thread_client_timeout is not None:\n            self._thread_client_timeout.start()\n\n    def _create_secret_code(self):\n        if self._hub_secret_code_customized is not None:\n            return self._hub_secret_code_customized\n        else:\n            return str(uuid.uuid1())\n\n    def stop(self):\n        \"\"\"\n        Stop the current SAMP Hub instance and delete the lock file.\n        \"\"\"\n\n        if not self._is_running:\n            return\n\n        log.info(\"Hub is stopping...\")\n\n        self._notify_shutdown()\n\n        self._is_running = False\n\n        if self._lockfile and os.path.isfile(self._lockfile):\n            lockfiledict = read_lockfile(self._lockfile)\n            if lockfiledict['samp.secret'] == self._hub_secret:\n                os.remove(self._lockfile)\n        self._lockfile = None\n\n        # Reset variables\n        # TODO: What happens if not all threads are stopped after timeout?\n        self._join_all_threads(timeout=10.)\n\n        self._hub_msg_id_counter = 0\n        self._hub_secret = self._create_secret_code()\n        self._hub_public_id = \"\"\n        self._metadata = {}\n        self._private_keys = {}\n        self._mtype2ids = {}\n        self._id2mtypes = {}\n        self._xmlrpc_endpoints = {}\n        self._last_activity_time = None\n\n        log.info(\"Hub stopped.\")\n\n    def _join_all_threads(self, timeout=None):\n        # In some cases, ``stop`` may be called from some of the sub-threads,\n        # so we just need to make sure that we don't try and shut down the\n        # calling thread.\n        current_thread = threading.current_thread()\n        if self._thread_run is not current_thread:\n            self._thread_run.join(timeout=timeout)\n            if not self._thread_run.is_alive():\n                self._thread_run = None\n        if self._thread_hub_timeout is not None and self._thread_hub_timeout is not current_thread:\n            self._thread_hub_timeout.join(timeout=timeout)\n            if not self._thread_hub_timeout.is_alive():\n                self._thread_hub_timeout = None\n        if self._thread_client_timeout is not None and self._thread_client_timeout is not current_thread:\n            self._thread_client_timeout.join(timeout=timeout)\n            if not self._thread_client_timeout.is_alive():\n                self._thread_client_timeout = None\n\n        self._join_launched_threads(timeout=timeout)\n\n    @property\n    def is_running(self):\n        \"\"\"Return an information concerning the Hub running status.\n\n        Returns\n        -------\n        running : bool\n            Is the hub running?\n        \"\"\"\n        return self._is_running\n\n    def _serve_forever(self):\n\n        while self._is_running:\n\n            try:\n                read_ready = select.select([self._server.socket], [], [], 0.01)[0]\n            except OSError as exc:\n                warnings.warn(f\"Call to select() in SAMPHubServer failed: {exc}\",\n                              SAMPWarning)\n            else:\n                if read_ready:\n                    self._server.handle_request()\n\n            if self._web_profile:\n\n                # We now check if there are any connection requests from the\n                # web profile, and if so, we initialize the pop-up.\n                if self._web_profile_dialog is None:\n                    try:\n                        request = self._web_profile_requests_queue.get_nowait()\n                    except queue.Empty:\n                        pass\n                    else:\n                        web_profile_text_dialog(request, self._web_profile_requests_result)\n\n                # We now check for requests over the web profile socket, and we\n                # also update the pop-up in case there are any changes.\n                try:\n                    read_ready = select.select([self._web_profile_server.socket], [], [], 0.01)[0]\n                except OSError as exc:\n                    warnings.warn(f\"Call to select() in SAMPHubServer failed: {exc}\",\n                                  SAMPWarning)\n                else:\n                    if read_ready:\n                        self._web_profile_server.handle_request()\n\n        self._server.server_close()\n        if self._web_profile_server is not None:\n            self._web_profile_server.server_close()\n\n    def _notify_shutdown(self):\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.event.shutdown\")\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                for key in self._mtype2ids[mtype]:\n                    self._notify_(self._hub_private_key,\n                                  self._private_keys[key][0],\n                                  {\"samp.mtype\": \"samp.hub.event.shutdown\",\n                                   \"samp.params\": {}})\n\n    def _notify_register(self, private_key):\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.event.register\")\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                public_id = self._private_keys[private_key][0]\n                for key in self._mtype2ids[mtype]:\n                    # if key != private_key:\n                    self._notify(self._hub_private_key,\n                                 self._private_keys[key][0],\n                                 {\"samp.mtype\": \"samp.hub.event.register\",\n                                  \"samp.params\": {\"id\": public_id}})\n\n    def _notify_unregister(self, private_key):\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.event.unregister\")\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                public_id = self._private_keys[private_key][0]\n                for key in self._mtype2ids[mtype]:\n                    if key != private_key:\n                        self._notify(self._hub_private_key,\n                                     self._private_keys[key][0],\n                                     {\"samp.mtype\": \"samp.hub.event.unregister\",\n                                      \"samp.params\": {\"id\": public_id}})\n\n    def _notify_metadata(self, private_key):\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.event.metadata\")\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                public_id = self._private_keys[private_key][0]\n                for key in self._mtype2ids[mtype]:\n                    # if key != private_key:\n                    self._notify(self._hub_private_key,\n                                 self._private_keys[key][0],\n                                 {\"samp.mtype\": \"samp.hub.event.metadata\",\n                                  \"samp.params\": {\"id\": public_id,\n                                                  \"metadata\": self._metadata[private_key]}\n                                  })\n\n    def _notify_subscriptions(self, private_key):\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.event.subscriptions\")\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                public_id = self._private_keys[private_key][0]\n                for key in self._mtype2ids[mtype]:\n                    self._notify(self._hub_private_key,\n                                 self._private_keys[key][0],\n                                 {\"samp.mtype\": \"samp.hub.event.subscriptions\",\n                                  \"samp.params\": {\"id\": public_id,\n                                                  \"subscriptions\": self._id2mtypes[private_key]}\n                                  })\n\n    def _notify_disconnection(self, private_key):\n\n        def _xmlrpc_call_disconnect(endpoint, private_key, hub_public_id, message):\n            endpoint.samp.client.receiveNotification(private_key, hub_public_id, message)\n\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.disconnect\")\n        public_id = self._private_keys[private_key][0]\n        endpoint = self._xmlrpc_endpoints[public_id][1]\n\n        for mtype in msubs:\n            if mtype in self._mtype2ids and private_key in self._mtype2ids[mtype]:\n                log.debug(f\"notify disconnection to {public_id}\")\n                self._launch_thread(target=_xmlrpc_call_disconnect,\n                                   args=(endpoint, private_key,\n                                         self._hub_public_id,\n                                         {\"samp.mtype\": \"samp.hub.disconnect\",\n                                          \"samp.params\": {\"reason\": \"Timeout expired!\"}}))\n\n    def _ping(self):\n        self._update_last_activity_time()\n        log.debug(\"ping\")\n        return \"1\"\n\n    def _query_by_metadata(self, key, value):\n        public_id_list = []\n        for private_id in self._metadata:\n            if key in self._metadata[private_id]:\n                if self._metadata[private_id][key] == value:\n                    public_id_list.append(self._private_keys[private_id][0])\n\n        return public_id_list\n\n    def _set_xmlrpc_callback(self, private_key, xmlrpc_addr):\n        self._update_last_activity_time(private_key)\n        if private_key in self._private_keys:\n            if private_key == self._hub_private_key:\n                public_id = self._private_keys[private_key][0]\n                self._xmlrpc_endpoints[public_id] = \\\n                    (xmlrpc_addr, _HubAsClient(self._hub_as_client_request_handler))\n                return \"\"\n\n            # Dictionary stored with the public id\n\n            log.debug(f\"set_xmlrpc_callback: {private_key} {xmlrpc_addr}\")\n\n            server_proxy_pool = None\n\n            server_proxy_pool = ServerProxyPool(self._pool_size,\n                                                xmlrpc.ServerProxy,\n                                                xmlrpc_addr, allow_none=1)\n\n            public_id = self._private_keys[private_key][0]\n            self._xmlrpc_endpoints[public_id] = (xmlrpc_addr,\n                                                server_proxy_pool)\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n        return \"\"\n\n    def _perform_standard_register(self):\n\n        with self._thread_lock:\n            private_key, public_id = self._get_new_ids()\n        self._private_keys[private_key] = (public_id, time.time())\n        self._update_last_activity_time(private_key)\n        self._notify_register(private_key)\n        log.debug(f\"register: private-key = {private_key} and self-id = {public_id}\")\n        return {\"samp.self-id\": public_id,\n                \"samp.private-key\": private_key,\n                \"samp.hub-id\": self._hub_public_id}\n\n    def _register(self, secret):\n        self._update_last_activity_time()\n        if secret == self._hub_secret:\n            return self._perform_standard_register()\n        else:\n            # return {\"samp.self-id\": \"\", \"samp.private-key\": \"\", \"samp.hub-id\": \"\"}\n            raise SAMPProxyError(7, \"Bad secret code\")\n\n    def _get_new_ids(self):\n        private_key = str(uuid.uuid1())\n        self._client_id_counter += 1\n        public_id = 'cli#hub'\n        if self._client_id_counter > 0:\n            public_id = f\"cli#{self._client_id_counter}\"\n\n        return private_key, public_id\n\n    def _unregister(self, private_key):\n\n        self._update_last_activity_time()\n\n        public_key = \"\"\n\n        self._notify_unregister(private_key)\n\n        with self._thread_lock:\n\n            if private_key in self._private_keys:\n                public_key = self._private_keys[private_key][0]\n                del self._private_keys[private_key]\n            else:\n                return \"\"\n\n            if private_key in self._metadata:\n                del self._metadata[private_key]\n\n            if private_key in self._id2mtypes:\n                del self._id2mtypes[private_key]\n\n            for mtype in self._mtype2ids.keys():\n                if private_key in self._mtype2ids[mtype]:\n                    self._mtype2ids[mtype].remove(private_key)\n\n            if public_key in self._xmlrpc_endpoints:\n                del self._xmlrpc_endpoints[public_key]\n\n            if private_key in self._client_activity_time:\n                del self._client_activity_time[private_key]\n\n            if self._web_profile:\n                if private_key in self._web_profile_callbacks:\n                    del self._web_profile_callbacks[private_key]\n                self._web_profile_server.remove_client(private_key)\n\n        log.debug(f\"unregister {public_key} ({private_key})\")\n\n        return \"\"\n\n    def _declare_metadata(self, private_key, metadata):\n        self._update_last_activity_time(private_key)\n        if private_key in self._private_keys:\n            log.debug(\"declare_metadata: private-key = {} metadata = {}\"\n                      .format(private_key, str(metadata)))\n            self._metadata[private_key] = metadata\n            self._notify_metadata(private_key)\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n        return \"\"\n\n    def _get_metadata(self, private_key, client_id):\n        self._update_last_activity_time(private_key)\n        if private_key in self._private_keys:\n            client_private_key = self._public_id_to_private_key(client_id)\n            log.debug(\"get_metadata: private-key = {} client-id = {}\"\n                      .format(private_key, client_id))\n            if client_private_key is not None:\n                if client_private_key in self._metadata:\n                    log.debug(f\"--> metadata = {self._metadata[client_private_key]}\")\n                    return self._metadata[client_private_key]\n                else:\n                    return {}\n            else:\n                raise SAMPProxyError(6, \"Invalid client ID\")\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    def _declare_subscriptions(self, private_key, mtypes):\n\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n\n            log.debug(\"declare_subscriptions: private-key = {} mtypes = {}\"\n                      .format(private_key, str(mtypes)))\n\n            # remove subscription to previous mtypes\n            if private_key in self._id2mtypes:\n\n                prev_mtypes = self._id2mtypes[private_key]\n\n                for mtype in prev_mtypes:\n                    try:\n                        self._mtype2ids[mtype].remove(private_key)\n                    except ValueError:  # private_key is not in list\n                        pass\n\n            self._id2mtypes[private_key] = copy.deepcopy(mtypes)\n\n            # remove duplicated MType for wildcard overwriting\n            original_mtypes = copy.deepcopy(mtypes)\n\n            for mtype in original_mtypes:\n                if mtype.endswith(\"*\"):\n                    for mtype2 in original_mtypes:\n                        if mtype2.startswith(mtype[:-1]) and \\\n                           mtype2 != mtype:\n                            if mtype2 in mtypes:\n                                del(mtypes[mtype2])\n\n            log.debug(\"declare_subscriptions: subscriptions accepted from \"\n                      \"{} => {}\".format(private_key, str(mtypes)))\n\n            for mtype in mtypes:\n\n                if mtype in self._mtype2ids:\n                    if private_key not in self._mtype2ids[mtype]:\n                        self._mtype2ids[mtype].append(private_key)\n                else:\n                    self._mtype2ids[mtype] = [private_key]\n\n            self._notify_subscriptions(private_key)\n\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n        return \"\"\n\n    def _get_subscriptions(self, private_key, client_id):\n\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            client_private_key = self._public_id_to_private_key(client_id)\n            if client_private_key is not None:\n                if client_private_key in self._id2mtypes:\n                    log.debug(\"get_subscriptions: client-id = {} mtypes = {}\"\n                              .format(client_id,\n                                      str(self._id2mtypes[client_private_key])))\n                    return self._id2mtypes[client_private_key]\n                else:\n                    log.debug(\"get_subscriptions: client-id = {} mtypes = \"\n                              \"missing\".format(client_id))\n                    return {}\n            else:\n                raise SAMPProxyError(6, \"Invalid client ID\")\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    def _get_registered_clients(self, private_key):\n\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            reg_clients = []\n            for pkey in self._private_keys.keys():\n                if pkey != private_key:\n                    reg_clients.append(self._private_keys[pkey][0])\n            log.debug(\"get_registered_clients: private_key = {} clients = {}\"\n                      .format(private_key, reg_clients))\n            return reg_clients\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    def _get_subscribed_clients(self, private_key, mtype):\n\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            sub_clients = {}\n\n            for pkey in self._private_keys.keys():\n                if pkey != private_key and self._is_subscribed(pkey, mtype):\n                    sub_clients[self._private_keys[pkey][0]] = {}\n\n            log.debug(\"get_subscribed_clients: private_key = {} mtype = {} \"\n                      \"clients = {}\".format(private_key, mtype, sub_clients))\n            return sub_clients\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    @staticmethod\n    def get_mtype_subtypes(mtype):\n        \"\"\"\n        Return a list containing all the possible wildcarded subtypes of MType.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be parsed.\n\n        Returns\n        -------\n        types : list\n            List of subtypes\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPHubServer\n        >>> SAMPHubServer.get_mtype_subtypes(\"samp.app.ping\")\n        ['samp.app.ping', 'samp.app.*', 'samp.*', '*']\n        \"\"\"\n\n        subtypes = []\n\n        msubs = mtype.split(\".\")\n        indexes = list(range(len(msubs)))\n        indexes.reverse()\n        indexes.append(-1)\n\n        for i in indexes:\n            tmp_mtype = \".\".join(msubs[:i + 1])\n            if tmp_mtype != mtype:\n                if tmp_mtype != \"\":\n                    tmp_mtype = tmp_mtype + \".*\"\n                else:\n                    tmp_mtype = \"*\"\n            subtypes.append(tmp_mtype)\n\n        return subtypes\n\n    def _is_subscribed(self, private_key, mtype):\n\n        subscribed = False\n\n        msubs = SAMPHubServer.get_mtype_subtypes(mtype)\n\n        for msub in msubs:\n            if msub in self._mtype2ids:\n                if private_key in self._mtype2ids[msub]:\n                    subscribed = True\n\n        return subscribed\n\n    def _notify(self, private_key, recipient_id, message):\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            if self._is_subscribed(self._public_id_to_private_key(recipient_id),\n                                   message[\"samp.mtype\"]) is False:\n                raise SAMPProxyError(2, \"Client {} not subscribed to MType {}\"\n                                    .format(recipient_id, message[\"samp.mtype\"]))\n\n            self._launch_thread(target=self._notify_, args=(private_key,\n                                                            recipient_id,\n                                                            message))\n            return {}\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    def _notify_(self, sender_private_key, recipient_public_id, message):\n\n        if sender_private_key not in self._private_keys:\n            return\n\n        sender_public_id = self._private_keys[sender_private_key][0]\n\n        try:\n\n            log.debug(\"notify {} from {} to {}\".format(\n                    message[\"samp.mtype\"], sender_public_id,\n                    recipient_public_id))\n\n            recipient_private_key = self._public_id_to_private_key(recipient_public_id)\n            arg_params = (sender_public_id, message)\n            samp_method_name = \"receiveNotification\"\n\n            self._retry_method(recipient_private_key, recipient_public_id, samp_method_name, arg_params)\n\n        except Exception as exc:\n            warnings.warn(\"{} notification from client {} to client {} \"\n                          \"failed [{}]\".format(message[\"samp.mtype\"],\n                                               sender_public_id,\n                                               recipient_public_id, exc),\n                          SAMPWarning)\n\n    def _notify_all(self, private_key, message):\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            if \"samp.mtype\" not in message:\n                raise SAMPProxyError(3, \"samp.mtype keyword is missing\")\n            recipient_ids = self._notify_all_(private_key, message)\n            return recipient_ids\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    def _notify_all_(self, sender_private_key, message):\n\n        recipient_ids = []\n        msubs = SAMPHubServer.get_mtype_subtypes(message[\"samp.mtype\"])\n\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                for key in self._mtype2ids[mtype]:\n                    if key != sender_private_key:\n                        _recipient_id = self._private_keys[key][0]\n                        recipient_ids.append(_recipient_id)\n                        self._launch_thread(target=self._notify,\n                                         args=(sender_private_key,\n                                               _recipient_id, message)\n                                         )\n\n        return recipient_ids\n\n    def _call(self, private_key, recipient_id, msg_tag, message):\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            if self._is_subscribed(self._public_id_to_private_key(recipient_id),\n                                   message[\"samp.mtype\"]) is False:\n                raise SAMPProxyError(2, \"Client {} not subscribed to MType {}\"\n                                     .format(recipient_id, message[\"samp.mtype\"]))\n            public_id = self._private_keys[private_key][0]\n            msg_id = self._get_new_hub_msg_id(public_id, msg_tag)\n            self._launch_thread(target=self._call_, args=(private_key, public_id,\n                                                          recipient_id, msg_id,\n                                                          message))\n            return msg_id\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    def _call_(self, sender_private_key, sender_public_id,\n               recipient_public_id, msg_id, message):\n\n        if sender_private_key not in self._private_keys:\n            return\n\n        try:\n\n            log.debug(\"call {} from {} to {} ({})\".format(\n                    msg_id.split(\";;\")[0], sender_public_id,\n                    recipient_public_id, message[\"samp.mtype\"]))\n\n            recipient_private_key = self._public_id_to_private_key(recipient_public_id)\n            arg_params = (sender_public_id, msg_id, message)\n            samp_methodName = \"receiveCall\"\n\n            self._retry_method(recipient_private_key, recipient_public_id, samp_methodName, arg_params)\n\n        except Exception as exc:\n            warnings.warn(\"{} call {} from client {} to client {} failed \"\n                          \"[{},{}]\".format(message[\"samp.mtype\"],\n                                           msg_id.split(\";;\")[0],\n                                           sender_public_id,\n                                           recipient_public_id, type(exc), exc),\n                          SAMPWarning)\n\n    def _call_all(self, private_key, msg_tag, message):\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            if \"samp.mtype\" not in message:\n                raise SAMPProxyError(3, \"samp.mtype keyword is missing in \"\n                                        \"message tagged as {}\".format(msg_tag))\n\n            public_id = self._private_keys[private_key][0]\n            msg_id = self._call_all_(private_key, public_id, msg_tag, message)\n            return msg_id\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    def _call_all_(self, sender_private_key, sender_public_id, msg_tag,\n                   message):\n\n        msg_id = {}\n        msubs = SAMPHubServer.get_mtype_subtypes(message[\"samp.mtype\"])\n\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                for key in self._mtype2ids[mtype]:\n                    if key != sender_private_key:\n                        _msg_id = self._get_new_hub_msg_id(sender_public_id,\n                                                           msg_tag)\n                        receiver_public_id = self._private_keys[key][0]\n                        msg_id[receiver_public_id] = _msg_id\n                        self._launch_thread(target=self._call_,\n                                            args=(sender_private_key,\n                                                  sender_public_id,\n                                                  receiver_public_id, _msg_id,\n                                                  message))\n        return msg_id\n\n    def _call_and_wait(self, private_key, recipient_id, message, timeout):\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            timeout = int(timeout)\n\n            now = time.time()\n            response = {}\n\n            msg_id = self._call(private_key, recipient_id, \"samp::sync::call\",\n                                message)\n            self._sync_msg_ids_heap[msg_id] = None\n\n            while self._is_running:\n                if 0 < timeout <= time.time() - now:\n                    del(self._sync_msg_ids_heap[msg_id])\n                    raise SAMPProxyError(1, \"Timeout expired!\")\n\n                if self._sync_msg_ids_heap[msg_id] is not None:\n                    response = copy.deepcopy(self._sync_msg_ids_heap[msg_id])\n                    del(self._sync_msg_ids_heap[msg_id])\n                    break\n                time.sleep(0.01)\n\n            return response\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    def _reply(self, private_key, msg_id, response):\n        \"\"\"\n        The main method that gets called for replying. This starts up an\n        asynchronous reply thread and returns.\n        \"\"\"\n        self._update_last_activity_time(private_key)\n        if private_key in self._private_keys:\n            self._launch_thread(target=self._reply_, args=(private_key, msg_id,\n                                                           response))\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n        return {}\n\n    def _reply_(self, responder_private_key, msg_id, response):\n\n        if responder_private_key not in self._private_keys or not msg_id:\n            return\n\n        responder_public_id = self._private_keys[responder_private_key][0]\n        counter, hub_public_id, recipient_public_id, recipient_msg_tag = msg_id.split(\";;\", 3)\n\n        try:\n\n            log.debug(\"reply {} from {} to {}\".format(\n                    counter, responder_public_id, recipient_public_id))\n\n            if recipient_msg_tag == \"samp::sync::call\":\n\n                if msg_id in self._sync_msg_ids_heap.keys():\n                    self._sync_msg_ids_heap[msg_id] = response\n\n            else:\n\n                recipient_private_key = self._public_id_to_private_key(recipient_public_id)\n                arg_params = (responder_public_id, recipient_msg_tag, response)\n                samp_method_name = \"receiveResponse\"\n\n                self._retry_method(recipient_private_key, recipient_public_id, samp_method_name, arg_params)\n\n        except Exception as exc:\n            warnings.warn(\"{} reply from client {} to client {} failed [{}]\"\n                          .format(recipient_msg_tag, responder_public_id,\n                                  recipient_public_id, exc),\n                          SAMPWarning)\n\n    def _retry_method(self, recipient_private_key, recipient_public_id, samp_method_name, arg_params):\n        \"\"\"\n        This method is used to retry a SAMP call several times.\n\n        Parameters\n        ----------\n        recipient_private_key\n            The private key of the receiver of the call\n        recipient_public_key\n            The public key of the receiver of the call\n        samp_method_name : str\n            The name of the SAMP method to call\n        arg_params : tuple\n            Any additional arguments to be passed to the SAMP method\n        \"\"\"\n\n        if recipient_private_key is None:\n            raise SAMPHubError(\"Invalid client ID\")\n\n        from . import conf\n\n        for attempt in range(conf.n_retries):\n\n            if not self._is_running:\n                time.sleep(0.01)\n                continue\n\n            try:\n\n                if (self._web_profile and\n                    recipient_private_key in self._web_profile_callbacks):\n\n                    # Web Profile\n                    callback = {\"samp.methodName\": samp_method_name,\n                                \"samp.params\": arg_params}\n                    self._web_profile_callbacks[recipient_private_key].put(callback)\n\n                else:\n\n                    # Standard Profile\n                    hub = self._xmlrpc_endpoints[recipient_public_id][1]\n                    getattr(hub.samp.client, samp_method_name)(recipient_private_key, *arg_params)\n\n            except xmlrpc.Fault as exc:\n                log.debug(\"{} XML-RPC endpoint error (attempt {}): {}\"\n                          .format(recipient_public_id, attempt + 1,\n                                  exc.faultString))\n                time.sleep(0.01)\n            else:\n                return\n\n        # If we are here, then the above attempts failed\n        error_message = samp_method_name + \" failed after \" + str(conf.n_retries) + \" attempts\"\n        raise SAMPHubError(error_message)\n\n    def _public_id_to_private_key(self, public_id):\n\n        for private_key in self._private_keys.keys():\n            if self._private_keys[private_key][0] == public_id:\n                return private_key\n        return None\n\n    def _get_new_hub_msg_id(self, sender_public_id, sender_msg_id):\n        with self._thread_lock:\n            self._hub_msg_id_counter += 1\n        return \"msg#{};;{};;{};;{}\".format(self._hub_msg_id_counter,\n                                           self._hub_public_id,\n                                           sender_public_id, sender_msg_id)\n\n    def _update_last_activity_time(self, private_key=None):\n        with self._thread_lock:\n            self._last_activity_time = time.time()\n            if private_key is not None:\n                self._client_activity_time[private_key] = time.time()\n\n    def _receive_notification(self, private_key, sender_id, message):\n        return \"\"\n\n    def _receive_call(self, private_key, sender_id, msg_id, message):\n        if private_key == self._hub_private_key:\n\n            if \"samp.mtype\" in message and message[\"samp.mtype\"] == \"samp.app.ping\":\n                self._reply(self._hub_private_key, msg_id,\n                            {\"samp.status\": SAMP_STATUS_OK, \"samp.result\": {}})\n\n            elif (\"samp.mtype\" in message and\n                 (message[\"samp.mtype\"] == \"x-samp.query.by-meta\" or\n                  message[\"samp.mtype\"] == \"samp.query.by-meta\")):\n\n                ids_list = self._query_by_metadata(message[\"samp.params\"][\"key\"],\n                                                   message[\"samp.params\"][\"value\"])\n                self._reply(self._hub_private_key, msg_id,\n                            {\"samp.status\": SAMP_STATUS_OK,\n                             \"samp.result\": {\"ids\": ids_list}})\n\n            return \"\"\n        else:\n            return \"\"\n\n    def _receive_response(self, private_key, responder_id, msg_tag, response):\n        return \"\"\n\n    def _web_profile_register(self, identity_info,\n                              client_address=(\"unknown\", 0),\n                              origin=\"unknown\"):\n\n        self._update_last_activity_time()\n\n        if not client_address[0] in [\"localhost\", \"127.0.0.1\"]:\n            raise SAMPProxyError(403, \"Request of registration rejected \"\n                                      \"by the Hub.\")\n\n        if not origin:\n            origin = \"unknown\"\n\n        if isinstance(identity_info, dict):\n            # an old version of the protocol provided just a string with the app name\n            if \"samp.name\" not in identity_info:\n                raise SAMPProxyError(403, \"Request of registration rejected \"\n                                          \"by the Hub (application name not \"\n                                          \"provided).\")\n\n        # Red semaphore for the other threads\n        self._web_profile_requests_semaphore.put(\"wait\")\n        # Set the request to be displayed for the current thread\n        self._web_profile_requests_queue.put((identity_info, client_address,\n                                              origin))\n        # Get the popup dialogue response\n        response = self._web_profile_requests_result.get()\n        # OK, semaphore green\n        self._web_profile_requests_semaphore.get()\n\n        if response:\n            register_map = self._perform_standard_register()\n            translator_url = (\"http://localhost:{}/translator/{}?ref=\"\n                              .format(self._web_port, register_map[\"samp.private-key\"]))\n            register_map[\"samp.url-translator\"] = translator_url\n            self._web_profile_server.add_client(register_map[\"samp.private-key\"])\n            return register_map\n        else:\n            raise SAMPProxyError(403, \"Request of registration rejected by \"\n                                      \"the user.\")\n\n    def _web_profile_allowReverseCallbacks(self, private_key, allow):\n        self._update_last_activity_time()\n        if private_key in self._private_keys:\n            if allow == \"0\":\n                if private_key in self._web_profile_callbacks:\n                    del self._web_profile_callbacks[private_key]\n            else:\n                self._web_profile_callbacks[private_key] = queue.Queue()\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n        return \"\"\n\n    def _web_profile_pullCallbacks(self, private_key, timeout_secs):\n        self._update_last_activity_time()\n        if private_key in self._private_keys:\n            callback = []\n            callback_queue = self._web_profile_callbacks[private_key]\n            try:\n                while self._is_running:\n                    item_queued = callback_queue.get_nowait()\n                    callback.append(item_queued)\n            except queue.Empty:\n                pass\n            return callback\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n\nclass WebProfileDialog:\n    \"\"\"\n    A base class to make writing Web Profile GUI consent dialogs\n    easier.\n\n    The concrete class must:\n\n        1) Poll ``handle_queue`` periodically, using the timer services\n           of the GUI's event loop.  This function will call\n           ``self.show_dialog`` when a request requires authorization.\n           ``self.show_dialog`` will be given the arguments:\n\n              - ``samp_name``: The name of the application making the request.\n\n              - ``details``: A dictionary of details about the client\n                making the request.\n\n              - ``client``: A hostname, port pair containing the client\n                address.\n\n              - ``origin``: A string containing the origin of the\n                request.\n\n        2) Call ``consent`` or ``reject`` based on the user's response to\n           the dialog.\n    \"\"\"\n\n    def handle_queue(self):\n        try:\n            request = self.queue_request.get_nowait()\n        except queue.Empty:  # queue is set but empty\n            pass\n        except AttributeError:  # queue has not been set yet\n            pass\n        else:\n            if isinstance(request[0], str):  # To support the old protocol version\n                samp_name = request[0]\n            else:\n                samp_name = request[0][\"samp.name\"]\n\n            self.show_dialog(samp_name, request[0], request[1], request[2])\n\n    def consent(self):\n        self.queue_result.put(True)\n\n    def reject(self):\n        self.queue_result.put(False)\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":2007,"id":7920,"name":"_pos","nodeType":"Attribute","startLoc":2007,"text":"self._pos"},{"className":"SAMPClient","col":0,"comment":"\n    Utility class which provides facilities to create and manage a SAMP\n    compliant XML-RPC server that acts as SAMP callable client application.\n\n    Parameters\n    ----------\n    hub : :class:`~astropy.samp.SAMPHubProxy`\n        An instance of :class:`~astropy.samp.SAMPHubProxy` to be\n        used for messaging with the SAMP Hub.\n\n    name : str, optional\n        Client name (corresponding to ``samp.name`` metadata keyword).\n\n    description : str, optional\n        Client description (corresponding to ``samp.description.text`` metadata\n        keyword).\n\n    metadata : dict, optional\n        Client application metadata in the standard SAMP format.\n\n    addr : str, optional\n        Listening address (or IP). This defaults to 127.0.0.1 if the internet\n        is not reachable, otherwise it defaults to the host name.\n\n    port : int, optional\n        Listening XML-RPC server socket port. If left set to 0 (the default),\n        the operating system will select a free port.\n\n    callable : bool, optional\n        Whether the client can receive calls and notifications. If set to\n        `False`, then the client can send notifications and calls, but can not\n        receive any.\n    ","endLoc":718,"id":7921,"nodeType":"Class","startLoc":23,"text":"class SAMPClient:\n    \"\"\"\n    Utility class which provides facilities to create and manage a SAMP\n    compliant XML-RPC server that acts as SAMP callable client application.\n\n    Parameters\n    ----------\n    hub : :class:`~astropy.samp.SAMPHubProxy`\n        An instance of :class:`~astropy.samp.SAMPHubProxy` to be\n        used for messaging with the SAMP Hub.\n\n    name : str, optional\n        Client name (corresponding to ``samp.name`` metadata keyword).\n\n    description : str, optional\n        Client description (corresponding to ``samp.description.text`` metadata\n        keyword).\n\n    metadata : dict, optional\n        Client application metadata in the standard SAMP format.\n\n    addr : str, optional\n        Listening address (or IP). This defaults to 127.0.0.1 if the internet\n        is not reachable, otherwise it defaults to the host name.\n\n    port : int, optional\n        Listening XML-RPC server socket port. If left set to 0 (the default),\n        the operating system will select a free port.\n\n    callable : bool, optional\n        Whether the client can receive calls and notifications. If set to\n        `False`, then the client can send notifications and calls, but can not\n        receive any.\n    \"\"\"\n\n    # TODO: define what is meant by callable\n\n    def __init__(self, hub, name=None, description=None, metadata=None,\n                 addr=None, port=0, callable=True):\n\n        # GENERAL\n        self._is_running = False\n        self._is_registered = False\n\n        if metadata is None:\n            metadata = {}\n\n        if name is not None:\n            metadata[\"samp.name\"] = name\n\n        if description is not None:\n            metadata[\"samp.description.text\"] = description\n\n        self._metadata = metadata\n\n        self._addr = addr\n        self._port = port\n        self._xmlrpcAddr = None\n        self._callable = callable\n\n        # HUB INTERACTION\n        self.client = None\n        self._public_id = None\n        self._private_key = None\n        self._hub_id = None\n        self._notification_bindings = {}\n        self._call_bindings = {\"samp.app.ping\": [self._ping, {}],\n                               \"client.env.get\": [self._client_env_get, {}]}\n        self._response_bindings = {}\n\n        self._host_name = \"127.0.0.1\"\n        if internet_on():\n            try:\n                self._host_name = socket.getfqdn()\n                socket.getaddrinfo(self._addr or self._host_name, self._port or 0)\n            except socket.error:\n                self._host_name = \"127.0.0.1\"\n\n        self.hub = hub\n\n        if self._callable:\n\n            self._thread = threading.Thread(target=self._serve_forever)\n            self._thread.daemon = True\n\n            self.client = ThreadingXMLRPCServer((self._addr or self._host_name,\n                                                 self._port), logRequests=False, allow_none=True)\n\n            self.client.register_introspection_functions()\n            self.client.register_function(self.receive_notification, 'samp.client.receiveNotification')\n            self.client.register_function(self.receive_call, 'samp.client.receiveCall')\n            self.client.register_function(self.receive_response, 'samp.client.receiveResponse')\n\n            # If the port was set to zero, then the operating system has\n            # selected a free port. We now check what this port number is.\n            if self._port == 0:\n                self._port = self.client.socket.getsockname()[1]\n\n            protocol = 'http'\n\n            self._xmlrpcAddr = urlunparse((protocol,\n                                           '{}:{}'.format(self._addr or self._host_name,\n                                                            self._port),\n                                           '', '', '', ''))\n\n    def start(self):\n        \"\"\"\n        Start the client in a separate thread (non-blocking).\n\n        This only has an effect if ``callable`` was set to `True` when\n        initializing the client.\n        \"\"\"\n        if self._callable:\n            self._is_running = True\n            self._run_client()\n\n    def stop(self, timeout=10.):\n        \"\"\"\n        Stop the client.\n\n        Parameters\n        ----------\n        timeout : float\n            Timeout after which to give up if the client cannot be cleanly\n            shut down.\n        \"\"\"\n        # Setting _is_running to False causes the loop in _serve_forever to\n        # exit. The thread should then stop running. We wait for the thread to\n        # terminate until the timeout, then we continue anyway.\n        self._is_running = False\n        if self._callable and self._thread.is_alive():\n            self._thread.join(timeout)\n        if self._thread.is_alive():\n            raise SAMPClientError(\"Client was not shut down successfully \"\n                                  \"(timeout={}s)\".format(timeout))\n\n    @property\n    def is_running(self):\n        \"\"\"\n        Whether the client is currently running.\n        \"\"\"\n        return self._is_running\n\n    @property\n    def is_registered(self):\n        \"\"\"\n        Whether the client is currently registered.\n        \"\"\"\n        return self._is_registered\n\n    def _run_client(self):\n        if self._callable:\n            self._thread.start()\n\n    def _serve_forever(self):\n        while self._is_running:\n            try:\n                read_ready = select.select([self.client.socket], [], [], 0.1)[0]\n            except OSError as exc:\n                warnings.warn(f\"Call to select in SAMPClient failed: {exc}\",\n                              SAMPWarning)\n            else:\n                if read_ready:\n                    self.client.handle_request()\n\n        self.client.server_close()\n\n    def _ping(self, private_key, sender_id, msg_id, msg_mtype, msg_params,\n              message):\n\n        reply = {\"samp.status\": SAMP_STATUS_OK, \"samp.result\": {}}\n\n        self.hub.reply(private_key, msg_id, reply)\n\n    def _client_env_get(self, private_key, sender_id, msg_id, msg_mtype,\n                        msg_params, message):\n\n        if msg_params[\"name\"] in os.environ:\n            reply = {\"samp.status\": SAMP_STATUS_OK,\n                     \"samp.result\": {\"value\": os.environ[msg_params[\"name\"]]}}\n        else:\n            reply = {\"samp.status\": SAMP_STATUS_WARNING,\n                     \"samp.result\": {\"value\": \"\"},\n                     \"samp.error\": {\"samp.errortxt\":\n                                    \"Environment variable not defined.\"}}\n\n        self.hub.reply(private_key, msg_id, reply)\n\n    def _handle_notification(self, private_key, sender_id, message):\n\n        if private_key == self.get_private_key() and \"samp.mtype\" in message:\n\n            msg_mtype = message[\"samp.mtype\"]\n            del message[\"samp.mtype\"]\n            msg_params = message[\"samp.params\"]\n            del message[\"samp.params\"]\n\n            msubs = SAMPHubServer.get_mtype_subtypes(msg_mtype)\n            for mtype in msubs:\n                if mtype in self._notification_bindings:\n                    bound_func = self._notification_bindings[mtype][0]\n                    if get_num_args(bound_func) == 5:\n                        bound_func(private_key, sender_id, msg_mtype,\n                                   msg_params, message)\n                    else:\n                        bound_func(private_key, sender_id, None, msg_mtype,\n                                   msg_params, message)\n\n        return \"\"\n\n    def receive_notification(self, private_key, sender_id, message):\n        \"\"\"\n        Standard callable client ``receive_notification`` method.\n\n        This method is automatically handled when the\n        :meth:`~astropy.samp.client.SAMPClient.bind_receive_notification`\n        method is used to bind distinct operations to MTypes. In case of a\n        customized callable client implementation that inherits from the\n        :class:`~astropy.samp.SAMPClient` class this method should be\n        overwritten.\n\n        .. note:: When overwritten, this method must always return\n                  a string result (even empty).\n\n        Parameters\n        ----------\n        private_key : str\n            Client private key.\n\n        sender_id : str\n            Sender public ID.\n\n        message : dict\n            Received message.\n\n        Returns\n        -------\n        confirmation : str\n            Any confirmation string.\n        \"\"\"\n        return self._handle_notification(private_key, sender_id, message)\n\n    def _handle_call(self, private_key, sender_id, msg_id, message):\n\n        if private_key == self.get_private_key() and \"samp.mtype\" in message:\n\n            msg_mtype = message[\"samp.mtype\"]\n            del message[\"samp.mtype\"]\n            msg_params = message[\"samp.params\"]\n            del message[\"samp.params\"]\n\n            msubs = SAMPHubServer.get_mtype_subtypes(msg_mtype)\n\n            for mtype in msubs:\n                if mtype in self._call_bindings:\n                    self._call_bindings[mtype][0](private_key, sender_id,\n                                                  msg_id, msg_mtype,\n                                                  msg_params, message)\n\n        return \"\"\n\n    def receive_call(self, private_key, sender_id, msg_id, message):\n        \"\"\"\n        Standard callable client ``receive_call`` method.\n\n        This method is automatically handled when the\n        :meth:`~astropy.samp.client.SAMPClient.bind_receive_call` method is\n        used to bind distinct operations to MTypes. In case of a customized\n        callable client implementation that inherits from the\n        :class:`~astropy.samp.SAMPClient` class this method should be\n        overwritten.\n\n        .. note:: When overwritten, this method must always return\n                  a string result (even empty).\n\n        Parameters\n        ----------\n        private_key : str\n            Client private key.\n\n        sender_id : str\n            Sender public ID.\n\n        msg_id : str\n            Message ID received.\n\n        message : dict\n            Received message.\n\n        Returns\n        -------\n        confirmation : str\n            Any confirmation string.\n        \"\"\"\n        return self._handle_call(private_key, sender_id, msg_id, message)\n\n    def _handle_response(self, private_key, responder_id, msg_tag, response):\n        if (private_key == self.get_private_key() and\n            msg_tag in self._response_bindings):\n            self._response_bindings[msg_tag](private_key, responder_id,\n                                    msg_tag, response)\n        return \"\"\n\n    def receive_response(self, private_key, responder_id, msg_tag, response):\n        \"\"\"\n        Standard callable client ``receive_response`` method.\n\n        This method is automatically handled when the\n        :meth:`~astropy.samp.client.SAMPClient.bind_receive_response` method\n        is used to bind distinct operations to MTypes. In case of a customized\n        callable client implementation that inherits from the\n        :class:`~astropy.samp.SAMPClient` class this method should be\n        overwritten.\n\n        .. note:: When overwritten, this method must always return\n                  a string result (even empty).\n\n        Parameters\n        ----------\n        private_key : str\n            Client private key.\n\n        responder_id : str\n            Responder public ID.\n\n        msg_tag : str\n            Response message tag.\n\n        response : dict\n            Received response.\n\n        Returns\n        -------\n        confirmation : str\n            Any confirmation string.\n        \"\"\"\n        return self._handle_response(private_key, responder_id, msg_tag,\n                                     response)\n\n    def bind_receive_message(self, mtype, function, declare=True,\n                             metadata=None):\n        \"\"\"\n        Bind a specific MType to a function or class method, being intended for\n        a call or a notification.\n\n        The function must be of the form::\n\n            def my_function_or_method(<self,> private_key, sender_id, msg_id,\n                                      mtype, params, extra)\n\n        where ``private_key`` is the client private-key, ``sender_id`` is the\n        notification sender ID, ``msg_id`` is the Hub message-id (calls only,\n        otherwise is `None`), ``mtype`` is the message MType, ``params`` is the\n        message parameter set (content of ``\"samp.params\"``) and ``extra`` is a\n        dictionary containing any extra message map entry. The client is\n        automatically declared subscribed to the MType by default.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be caught.\n\n        function : callable\n            Application function to be used when ``mtype`` is received.\n\n        declare : bool, optional\n            Specify whether the client must be automatically declared as\n            subscribed to the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n\n        metadata : dict, optional\n            Dictionary containing additional metadata to declare associated\n            with the MType subscribed to (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        \"\"\"\n\n        self.bind_receive_call(mtype, function, declare=declare,\n                               metadata=metadata)\n\n        self.bind_receive_notification(mtype, function, declare=declare,\n                                       metadata=metadata)\n\n    def bind_receive_notification(self, mtype, function, declare=True, metadata=None):\n        \"\"\"\n        Bind a specific MType notification to a function or class method.\n\n        The function must be of the form::\n\n            def my_function_or_method(<self,> private_key, sender_id, mtype,\n                                      params, extra)\n\n        where ``private_key`` is the client private-key, ``sender_id`` is the\n        notification sender ID, ``mtype`` is the message MType, ``params`` is\n        the notified message parameter set (content of ``\"samp.params\"``) and\n        ``extra`` is a dictionary containing any extra message map entry. The\n        client is automatically declared subscribed to the MType by default.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be caught.\n\n        function : callable\n            Application function to be used when ``mtype`` is received.\n\n        declare : bool, optional\n            Specify whether the client must be automatically declared as\n            subscribed to the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n\n        metadata : dict, optional\n            Dictionary containing additional metadata to declare associated\n            with the MType subscribed to (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        \"\"\"\n        if self._callable:\n            if not metadata:\n                metadata = {}\n            self._notification_bindings[mtype] = [function, metadata]\n            if declare:\n                self._declare_subscriptions()\n        else:\n            raise SAMPClientError(\"Client not callable.\")\n\n    def bind_receive_call(self, mtype, function, declare=True, metadata=None):\n        \"\"\"\n        Bind a specific MType call to a function or class method.\n\n        The function must be of the form::\n\n            def my_function_or_method(<self,> private_key, sender_id, msg_id,\n                                      mtype, params, extra)\n\n        where ``private_key`` is the client private-key, ``sender_id`` is the\n        notification sender ID, ``msg_id`` is the Hub message-id, ``mtype`` is\n        the message MType, ``params`` is the message parameter set (content of\n        ``\"samp.params\"``) and ``extra`` is a dictionary containing any extra\n        message map entry. The client is automatically declared subscribed to\n        the MType by default.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be caught.\n\n        function : callable\n            Application function to be used when ``mtype`` is received.\n\n        declare : bool, optional\n            Specify whether the client must be automatically declared as\n            subscribed to the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n\n        metadata : dict, optional\n            Dictionary containing additional metadata to declare associated\n            with the MType subscribed to (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        \"\"\"\n        if self._callable:\n            if not metadata:\n                metadata = {}\n            self._call_bindings[mtype] = [function, metadata]\n            if declare:\n                self._declare_subscriptions()\n        else:\n            raise SAMPClientError(\"Client not callable.\")\n\n    def bind_receive_response(self, msg_tag, function):\n        \"\"\"\n        Bind a specific msg-tag response to a function or class method.\n\n        The function must be of the form::\n\n            def my_function_or_method(<self,> private_key, responder_id,\n                                      msg_tag, response)\n\n        where ``private_key`` is the client private-key, ``responder_id`` is\n        the message responder ID, ``msg_tag`` is the message-tag provided at\n        call time and ``response`` is the response received.\n\n        Parameters\n        ----------\n        msg_tag : str\n            Message-tag to be caught.\n\n        function : callable\n            Application function to be used when ``msg_tag`` is received.\n        \"\"\"\n        if self._callable:\n            self._response_bindings[msg_tag] = function\n        else:\n            raise SAMPClientError(\"Client not callable.\")\n\n    def unbind_receive_notification(self, mtype, declare=True):\n        \"\"\"\n        Remove from the notifications binding table the specified MType and\n        unsubscribe the client from it (if required).\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be removed.\n\n        declare : bool\n            Specify whether the client must be automatically declared as\n            unsubscribed from the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        \"\"\"\n        if self._callable:\n            del self._notification_bindings[mtype]\n            if declare:\n                self._declare_subscriptions()\n        else:\n            raise SAMPClientError(\"Client not callable.\")\n\n    def unbind_receive_call(self, mtype, declare=True):\n        \"\"\"\n        Remove from the calls binding table the specified MType and unsubscribe\n        the client from it (if required).\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be removed.\n\n        declare : bool\n            Specify whether the client must be automatically declared as\n            unsubscribed from the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        \"\"\"\n        if self._callable:\n            del self._call_bindings[mtype]\n            if declare:\n                self._declare_subscriptions()\n        else:\n            raise SAMPClientError(\"Client not callable.\")\n\n    def unbind_receive_response(self, msg_tag):\n        \"\"\"\n        Remove from the responses binding table the specified message-tag.\n\n        Parameters\n        ----------\n        msg_tag : str\n            Message-tag to be removed.\n        \"\"\"\n        if self._callable:\n            del self._response_bindings[msg_tag]\n        else:\n            raise SAMPClientError(\"Client not callable.\")\n\n    def declare_subscriptions(self, subscriptions=None):\n        \"\"\"\n        Declares the MTypes the client wishes to subscribe to, implicitly\n        defined with the MType binding methods\n        :meth:`~astropy.samp.client.SAMPClient.bind_receive_notification`\n        and :meth:`~astropy.samp.client.SAMPClient.bind_receive_call`.\n\n        An optional ``subscriptions`` map can be added to the final map passed\n        to the :meth:`~astropy.samp.hub_proxy.SAMPHubProxy.declare_subscriptions`\n        method.\n\n        Parameters\n        ----------\n        subscriptions : dict, optional\n            Dictionary containing the list of MTypes to subscribe to, with the\n            same format of the ``subscriptions`` map passed to the\n            :meth:`~astropy.samp.hub_proxy.SAMPHubProxy.declare_subscriptions`\n            method.\n        \"\"\"\n        if self._callable:\n            self._declare_subscriptions(subscriptions)\n        else:\n            raise SAMPClientError(\"Client not callable.\")\n\n    def register(self):\n        \"\"\"\n        Register the client to the SAMP Hub.\n        \"\"\"\n        if self.hub.is_connected:\n\n            if self._private_key is not None:\n                raise SAMPClientError(\"Client already registered\")\n\n            result = self.hub.register(self.hub.lockfile[\"samp.secret\"])\n\n            if result[\"samp.self-id\"] == \"\":\n                raise SAMPClientError(\"Registration failed - \"\n                                      \"samp.self-id was not set by the hub.\")\n\n            if result[\"samp.private-key\"] == \"\":\n                raise SAMPClientError(\"Registration failed - \"\n                                      \"samp.private-key was not set by the hub.\")\n\n            self._public_id = result[\"samp.self-id\"]\n            self._private_key = result[\"samp.private-key\"]\n            self._hub_id = result[\"samp.hub-id\"]\n\n            if self._callable:\n                self._set_xmlrpc_callback()\n                self._declare_subscriptions()\n\n            if self._metadata != {}:\n                self.declare_metadata()\n\n            self._is_registered = True\n\n        else:\n            raise SAMPClientError(\"Unable to register to the SAMP Hub. \"\n                                  \"Hub proxy not connected.\")\n\n    def unregister(self):\n        \"\"\"\n        Unregister the client from the SAMP Hub.\n        \"\"\"\n        if self.hub.is_connected:\n            self._is_registered = False\n            self.hub.unregister(self._private_key)\n            self._hub_id = None\n            self._public_id = None\n            self._private_key = None\n        else:\n            raise SAMPClientError(\"Unable to unregister from the SAMP Hub. \"\n                                  \"Hub proxy not connected.\")\n\n    def _set_xmlrpc_callback(self):\n        if self.hub.is_connected and self._private_key is not None:\n            self.hub.set_xmlrpc_callback(self._private_key,\n                                         self._xmlrpcAddr)\n\n    def _declare_subscriptions(self, subscriptions=None):\n        if self.hub.is_connected and self._private_key is not None:\n\n            mtypes_dict = {}\n            # Collect notification mtypes and metadata\n            for mtype in self._notification_bindings.keys():\n                mtypes_dict[mtype] = copy.deepcopy(self._notification_bindings[mtype][1])\n\n            # Collect notification mtypes and metadata\n            for mtype in self._call_bindings.keys():\n                mtypes_dict[mtype] = copy.deepcopy(self._call_bindings[mtype][1])\n\n            # Add optional subscription map\n            if subscriptions:\n                mtypes_dict.update(copy.deepcopy(subscriptions))\n\n            self.hub.declare_subscriptions(self._private_key, mtypes_dict)\n\n        else:\n            raise SAMPClientError(\"Unable to declare subscriptions. Hub \"\n                                  \"unreachable or not connected or client \"\n                                  \"not registered.\")\n\n    def declare_metadata(self, metadata=None):\n        \"\"\"\n        Declare the client application metadata supported.\n\n        Parameters\n        ----------\n        metadata : dict, optional\n            Dictionary containing the client application metadata as defined in\n            the SAMP definition document. If omitted, then no metadata are\n            declared.\n        \"\"\"\n        if self.hub.is_connected and self._private_key is not None:\n            if metadata is not None:\n                self._metadata.update(metadata)\n            self.hub.declare_metadata(self._private_key, self._metadata)\n        else:\n            raise SAMPClientError(\"Unable to declare metadata. Hub \"\n                                  \"unreachable or not connected or client \"\n                                  \"not registered.\")\n\n    def get_private_key(self):\n        \"\"\"\n        Return the client private key used for the Standard Profile\n        communications obtained at registration time (``samp.private-key``).\n\n        Returns\n        -------\n        key : str\n            Client private key.\n        \"\"\"\n        return self._private_key\n\n    def get_public_id(self):\n        \"\"\"\n        Return public client ID obtained at registration time\n        (``samp.self-id``).\n\n        Returns\n        -------\n        id : str\n            Client public ID.\n        \"\"\"\n        return self._public_id"},{"attributeType":"None","col":8,"comment":"null","endLoc":2018,"id":7922,"name":"description","nodeType":"Attribute","startLoc":2018,"text":"self.description"},{"col":4,"comment":"null","endLoc":1987,"header":"def scale_factors(self, omit_coslat=False)","id":7923,"name":"scale_factors","nodeType":"Function","startLoc":1981,"text":"def scale_factors(self, omit_coslat=False):\n        sf_lat = self.distance / u.radian\n        sf_lon = sf_lat if omit_coslat else sf_lat * np.cos(self.lat)\n        sf_distance = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return {'lon': sf_lon,\n                'lat': sf_lat,\n                'distance': sf_distance}"},{"col":4,"comment":"null","endLoc":2006,"header":"def represent_as(self, other_class, differential_class=None)","id":7924,"name":"represent_as","nodeType":"Function","startLoc":1989,"text":"def represent_as(self, other_class, differential_class=None):\n        # Take a short cut if the other class is a spherical representation\n\n        if inspect.isclass(other_class):\n            if issubclass(other_class, PhysicsSphericalRepresentation):\n                diffs = self._re_represent_differentials(other_class,\n                                                         differential_class)\n                return other_class(phi=self.lon, theta=90 * u.deg - self.lat,\n                                   r=self.distance, differentials=diffs,\n                                   copy=False)\n\n            elif issubclass(other_class, UnitSphericalRepresentation):\n                diffs = self._re_represent_differentials(other_class,\n                                                         differential_class)\n                return other_class(lon=self.lon, lat=self.lat,\n                                   differentials=diffs, copy=False)\n\n        return super().represent_as(other_class, differential_class)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2012,"id":7925,"name":"ID","nodeType":"Attribute","startLoc":2012,"text":"self.ID"},{"attributeType":"null","col":8,"comment":"null","endLoc":2006,"id":7926,"name":"_config","nodeType":"Attribute","startLoc":2006,"text":"self._config"},{"col":0,"comment":"\n    Creates a function useful for looking up an element by a given\n    attribute.\n\n    Parameters\n    ----------\n    attr : str\n        The attribute name\n\n    unique : bool\n        Should be `True` if the attribute is unique and therefore this\n        should return only one value.  Otherwise, returns a list of\n        values.\n\n    iterator : generator\n        A generator that iterates over some arbitrary set of elements\n\n    element_name : str\n        The XML element name of the elements being iterated over (used\n        for error messages only).\n\n    doc : str\n        A docstring to apply to the generated function.\n\n    Returns\n    -------\n    factory : function\n        A function that looks up an element by the given attribute.\n    ","endLoc":133,"header":"def _lookup_by_attr_factory(attr, unique, iterator, element_name, doc)","id":7927,"name":"_lookup_by_attr_factory","nodeType":"Function","startLoc":72,"text":"def _lookup_by_attr_factory(attr, unique, iterator, element_name, doc):\n    \"\"\"\n    Creates a function useful for looking up an element by a given\n    attribute.\n\n    Parameters\n    ----------\n    attr : str\n        The attribute name\n\n    unique : bool\n        Should be `True` if the attribute is unique and therefore this\n        should return only one value.  Otherwise, returns a list of\n        values.\n\n    iterator : generator\n        A generator that iterates over some arbitrary set of elements\n\n    element_name : str\n        The XML element name of the elements being iterated over (used\n        for error messages only).\n\n    doc : str\n        A docstring to apply to the generated function.\n\n    Returns\n    -------\n    factory : function\n        A function that looks up an element by the given attribute.\n    \"\"\"\n\n    def lookup_by_attr(self, ref, before=None):\n        \"\"\"\n        Given a string *ref*, finds the first element in the iterator\n        where the given attribute == *ref*.  If *before* is provided,\n        will stop searching at the object *before*.  This is\n        important, since \"forward references\" are not allowed in the\n        VOTABLE format.\n        \"\"\"\n        for element in getattr(self, iterator)():\n            if element is before:\n                if getattr(element, attr, None) == ref:\n                    vo_raise(\n                        f\"{element_name} references itself\",\n                        element._config, element._pos, KeyError)\n                break\n            if getattr(element, attr, None) == ref:\n                yield element\n\n    def lookup_by_attr_unique(self, ref, before=None):\n        for element in lookup_by_attr(self, ref, before=before):\n            return element\n        raise KeyError(\n            \"No {} with {} '{}' found before the referencing {}\".format(\n                element_name, attr, ref, element_name))\n\n    if unique:\n        lookup_by_attr_unique.__doc__ = doc\n        return lookup_by_attr_unique\n    else:\n        lookup_by_attr.__doc__ = doc\n        return lookup_by_attr"},{"col":4,"comment":"\n        Converts spherical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        ","endLoc":2023,"header":"def to_cartesian(self)","id":7928,"name":"to_cartesian","nodeType":"Function","startLoc":2008,"text":"def to_cartesian(self):\n        \"\"\"\n        Converts spherical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        \"\"\"\n\n        # We need to convert Distance to Quantity to allow negative values.\n        if isinstance(self.distance, Distance):\n            d = self.distance.view(u.Quantity)\n        else:\n            d = self.distance\n\n        # erfa s2p: Convert spherical polar coordinates to p-vector.\n        p = erfa_ufunc.s2p(self.lon, self.lat, d)\n\n        return CartesianRepresentation(p, xyz_axis=-1, copy=False)"},{"col":4,"comment":"\n        Converts 3D rectangular cartesian coordinates to spherical polar\n        coordinates.\n        ","endLoc":2033,"header":"@classmethod\n    def from_cartesian(cls, cart)","id":7930,"name":"from_cartesian","nodeType":"Function","startLoc":2025,"text":"@classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates to spherical polar\n        coordinates.\n        \"\"\"\n        p = cart.get_xyz(xyz_axis=-1)\n        # erfa p2s: P-vector to spherical polar coordinates.\n        return cls(*erfa_ufunc.p2s(p), copy=False)"},{"col":0,"comment":"\n    Like `_lookup_by_attr_factory`, but looks in both the \"ID\" and\n    \"name\" attributes.\n    ","endLoc":164,"header":"def _lookup_by_id_or_name_factory(iterator, element_name, doc)","id":7931,"name":"_lookup_by_id_or_name_factory","nodeType":"Function","startLoc":136,"text":"def _lookup_by_id_or_name_factory(iterator, element_name, doc):\n    \"\"\"\n    Like `_lookup_by_attr_factory`, but looks in both the \"ID\" and\n    \"name\" attributes.\n    \"\"\"\n\n    def lookup_by_id_or_name(self, ref, before=None):\n        \"\"\"\n        Given an key *ref*, finds the first element in the iterator\n        with the attribute ID == *ref* or name == *ref*.  If *before*\n        is provided, will stop searching at the object *before*.  This\n        is important, since \"forward references\" are not allowed in\n        the VOTABLE format.\n        \"\"\"\n        for element in getattr(self, iterator)():\n            if element is before:\n                if ref in (element.ID, element.name):\n                    vo_raise(\n                        f\"{element_name} references itself\",\n                        element._config, element._pos, KeyError)\n                break\n            if ref in (element.ID, element.name):\n                return element\n        raise KeyError(\n            \"No {} with ID or name '{}' found before the referencing {}\".format(\n                element_name, ref, element_name))\n\n    lookup_by_id_or_name.__doc__ = doc\n    return lookup_by_id_or_name"},{"col":4,"comment":"null","endLoc":83,"header":"def do_POST(self)","id":7932,"name":"do_POST","nodeType":"Function","startLoc":79,"text":"def do_POST(self):\n        if self._serve_cross_domain_xml():\n            return\n\n        return SAMPSimpleXMLRPCRequestHandler.do_POST(self)"},{"col":4,"comment":"Transform the spherical coordinates using a 3x3 matrix.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 matrix, such as a rotation matrix (or a stack of matrices).\n\n        ","endLoc":2056,"header":"def transform(self, matrix)","id":7933,"name":"transform","nodeType":"Function","startLoc":2035,"text":"def transform(self, matrix):\n        \"\"\"Transform the spherical coordinates using a 3x3 matrix.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 matrix, such as a rotation matrix (or a stack of matrices).\n\n        \"\"\"\n        xyz = erfa_ufunc.s2c(self.lon, self.lat)\n        p = erfa_ufunc.rxp(matrix, xyz)\n        lon, lat, ur = erfa_ufunc.p2s(p)\n        rep = self.__class__(lon=lon, lat=lat, distance=self.distance * ur)\n\n        # handle differentials\n        new_diffs = dict((k, d.transform(matrix, self, rep))\n                         for k, d in self.differentials.items())\n        return rep.with_differentials(new_diffs)"},{"col":4,"comment":"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.  For\n        spherical coordinates, this is just the absolute value of the distance.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        ","endLoc":2070,"header":"def norm(self)","id":7934,"name":"norm","nodeType":"Function","startLoc":2058,"text":"def norm(self):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.  For\n        spherical coordinates, this is just the absolute value of the distance.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\n        return np.abs(self.distance)"},{"col":4,"comment":"null","endLoc":2087,"header":"def _scale_operation(self, op, *args)","id":7935,"name":"_scale_operation","nodeType":"Function","startLoc":2072,"text":"def _scale_operation(self, op, *args):\n        # TODO: expand special-casing to UnitSpherical and RadialDifferential.\n        if any(differential.base_representation is not self.__class__\n               for differential in self.differentials.values()):\n            return super()._scale_operation(op, *args)\n\n        lon_op, lat_op, distance_op = _spherical_op_funcs(op, *args)\n\n        result = self.__class__(lon_op(self.lon), lat_op(self.lat),\n                                distance_op(self.distance), copy=False)\n        for key, differential in self.differentials.items():\n            new_comps = (op(getattr(differential, comp)) for op, comp in zip(\n                (operator.pos, lat_op, distance_op),\n                differential.components))\n            result.differentials[key] = differential.__class__(*new_comps, copy=False)\n        return result"},{"attributeType":"null","col":16,"comment":"null","endLoc":14,"id":7936,"name":"np","nodeType":"Attribute","startLoc":14,"text":"np"},{"attributeType":"null","col":35,"comment":"null","endLoc":19,"id":7937,"name":"astropy_version","nodeType":"Attribute","startLoc":19,"text":"astropy_version"},{"attributeType":"null","col":21,"comment":"null","endLoc":32,"id":7938,"name":"ucd_mod","nodeType":"Attribute","startLoc":32,"text":"ucd_mod"},{"attributeType":"null","col":4,"comment":"null","endLoc":38,"id":7939,"name":"_has_c_tabledata_writer","nodeType":"Attribute","startLoc":38,"text":"_has_c_tabledata_writer"},{"attributeType":"null","col":4,"comment":"null","endLoc":40,"id":7940,"name":"_has_c_tabledata_writer","nodeType":"Attribute","startLoc":40,"text":"_has_c_tabledata_writer"},{"attributeType":"null","col":0,"comment":"null","endLoc":43,"id":7941,"name":"__all__","nodeType":"Attribute","startLoc":43,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":52,"id":7942,"name":"DEFAULT_CHUNK_SIZE","nodeType":"Attribute","startLoc":52,"text":"DEFAULT_CHUNK_SIZE"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":7943,"name":"RESIZE_AMOUNT","nodeType":"Attribute","startLoc":53,"text":"RESIZE_AMOUNT"},{"col":0,"comment":"For given operator, return functions that adjust lon, lat, distance.","endLoc":1886,"header":"def _spherical_op_funcs(op, *args)","id":7944,"name":"_spherical_op_funcs","nodeType":"Function","startLoc":1872,"text":"def _spherical_op_funcs(op, *args):\n    \"\"\"For given operator, return functions that adjust lon, lat, distance.\"\"\"\n    if op is operator.neg:\n        return lambda x: x+180*u.deg, operator.neg, operator.pos\n\n    try:\n        scale_sign = np.sign(args[0])\n    except Exception:\n        # This should always work, even if perhaps we get a negative distance.\n        return operator.pos, operator.pos, lambda x: op(x, *args)\n\n    scale = abs(args[0])\n    return (lambda x: x + 180*u.deg*np.signbit(scale_sign),\n            lambda x: x * scale_sign,\n            lambda x: op(x, scale))"},{"col":15,"endLoc":1875,"id":7945,"nodeType":"Lambda","startLoc":1875,"text":"lambda x: x+180*u.deg"},{"col":43,"endLoc":1881,"id":7946,"nodeType":"Lambda","startLoc":1881,"text":"lambda x: op(x, *args)"},{"col":12,"endLoc":1884,"id":7947,"nodeType":"Lambda","startLoc":1884,"text":"lambda x: x + 180*u.deg*np.signbit(scale_sign)"},{"col":12,"endLoc":1885,"id":7948,"nodeType":"Lambda","startLoc":1885,"text":"lambda x: x * scale_sign"},{"col":12,"endLoc":1886,"id":7949,"nodeType":"Lambda","startLoc":1886,"text":"lambda x: op(x, scale)"},{"col":4,"comment":"null","endLoc":92,"header":"def do_HEAD(self)","id":7950,"name":"do_HEAD","nodeType":"Function","startLoc":85,"text":"def do_HEAD(self):\n\n        if not self.is_http_path_valid():\n            self.report_404()\n            return\n\n        if self._serve_cross_domain_xml():\n            return"},{"col":4,"comment":"null","endLoc":127,"header":"def is_http_path_valid(self)","id":7951,"name":"is_http_path_valid","nodeType":"Function","startLoc":123,"text":"def is_http_path_valid(self):\n\n        valid_paths = ([\"/clientaccesspolicy.xml\", \"/crossdomain.xml\"] +\n                       [f'/translator/{clid}' for clid in self.server.clients])\n        return self.path.split('?')[0] in valid_paths"},{"col":0,"comment":"","endLoc":5,"header":"tree.py#<anonymous>","id":7952,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"try:\n    from . import tablewriter\n    _has_c_tabledata_writer = True\nexcept ImportError:\n    _has_c_tabledata_writer = False\n\n__all__ = [\n    'Link', 'Info', 'Values', 'Field', 'Param', 'CooSys', 'TimeSys',\n    'FieldRef', 'ParamRef', 'Group', 'Table', 'Resource',\n    'VOTableFile', 'Element'\n    ]\n\nDEFAULT_CHUNK_SIZE = 256\n\nRESIZE_AMOUNT = 1.5"},{"attributeType":"null","col":4,"comment":"null","endLoc":1922,"id":7953,"name":"attr_classes","nodeType":"Attribute","startLoc":1922,"text":"attr_classes"},{"col":4,"comment":"null","endLoc":126,"header":"def __init__(self, hub, name=None, description=None, metadata=None,\n                 addr=None, port=0, callable=True)","id":7954,"name":"__init__","nodeType":"Function","startLoc":60,"text":"def __init__(self, hub, name=None, description=None, metadata=None,\n                 addr=None, port=0, callable=True):\n\n        # GENERAL\n        self._is_running = False\n        self._is_registered = False\n\n        if metadata is None:\n            metadata = {}\n\n        if name is not None:\n            metadata[\"samp.name\"] = name\n\n        if description is not None:\n            metadata[\"samp.description.text\"] = description\n\n        self._metadata = metadata\n\n        self._addr = addr\n        self._port = port\n        self._xmlrpcAddr = None\n        self._callable = callable\n\n        # HUB INTERACTION\n        self.client = None\n        self._public_id = None\n        self._private_key = None\n        self._hub_id = None\n        self._notification_bindings = {}\n        self._call_bindings = {\"samp.app.ping\": [self._ping, {}],\n                               \"client.env.get\": [self._client_env_get, {}]}\n        self._response_bindings = {}\n\n        self._host_name = \"127.0.0.1\"\n        if internet_on():\n            try:\n                self._host_name = socket.getfqdn()\n                socket.getaddrinfo(self._addr or self._host_name, self._port or 0)\n            except socket.error:\n                self._host_name = \"127.0.0.1\"\n\n        self.hub = hub\n\n        if self._callable:\n\n            self._thread = threading.Thread(target=self._serve_forever)\n            self._thread.daemon = True\n\n            self.client = ThreadingXMLRPCServer((self._addr or self._host_name,\n                                                 self._port), logRequests=False, allow_none=True)\n\n            self.client.register_introspection_functions()\n            self.client.register_function(self.receive_notification, 'samp.client.receiveNotification')\n            self.client.register_function(self.receive_call, 'samp.client.receiveCall')\n            self.client.register_function(self.receive_response, 'samp.client.receiveResponse')\n\n            # If the port was set to zero, then the operating system has\n            # selected a free port. We now check what this port number is.\n            if self._port == 0:\n                self._port = self.client.socket.getsockname()[1]\n\n            protocol = 'http'\n\n            self._xmlrpcAddr = urlunparse((protocol,\n                                           '{}:{}'.format(self._addr or self._host_name,\n                                                            self._port),\n                                           '', '', '', ''))"},{"attributeType":"null","col":4,"comment":"null","endLoc":1925,"id":7955,"name":"_unit_representation","nodeType":"Attribute","startLoc":1925,"text":"_unit_representation"},{"attributeType":"null","col":16,"comment":"null","endLoc":1934,"id":7956,"name":"_distance","nodeType":"Attribute","startLoc":1934,"text":"self._distance"},{"className":"ITRS","col":0,"comment":"\n    A coordinate or frame in the International Terrestrial Reference System\n    (ITRS).  This is approximately a geocentric system, although strictly it is\n    defined by a series of reference locations near the surface of the Earth.\n    For more background on the ITRS, see the references provided in the\n    :ref:`astropy:astropy-coordinates-seealso` section of the documentation.\n    ","endLoc":36,"id":7957,"nodeType":"Class","startLoc":13,"text":"@format_doc(base_doc, components=\"\", footer=\"\")\nclass ITRS(BaseCoordinateFrame):\n    \"\"\"\n    A coordinate or frame in the International Terrestrial Reference System\n    (ITRS).  This is approximately a geocentric system, although strictly it is\n    defined by a series of reference locations near the surface of the Earth.\n    For more background on the ITRS, see the references provided in the\n    :ref:`astropy:astropy-coordinates-seealso` section of the documentation.\n    \"\"\"\n\n    default_representation = CartesianRepresentation\n    default_differential = CartesianDifferential\n\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n\n    @property\n    def earth_location(self):\n        \"\"\"\n        The data in this frame as an `~astropy.coordinates.EarthLocation` class.\n        \"\"\"\n        from astropy.coordinates.earth import EarthLocation\n\n        cart = self.represent_as(CartesianRepresentation)\n        return EarthLocation(x=cart.x, y=cart.y, z=cart.z)"},{"className":"SAMPHubError","col":0,"comment":"\n    SAMP Hub exception.\n    ","endLoc":24,"id":7958,"nodeType":"Class","startLoc":21,"text":"class SAMPHubError(Exception):\n    \"\"\"\n    SAMP Hub exception.\n    \"\"\""},{"col":4,"comment":"\n        The data in this frame as an `~astropy.coordinates.EarthLocation` class.\n        ","endLoc":36,"header":"@property\n    def earth_location(self)","id":7959,"name":"earth_location","nodeType":"Function","startLoc":28,"text":"@property\n    def earth_location(self):\n        \"\"\"\n        The data in this frame as an `~astropy.coordinates.EarthLocation` class.\n        \"\"\"\n        from astropy.coordinates.earth import EarthLocation\n\n        cart = self.represent_as(CartesianRepresentation)\n        return EarthLocation(x=cart.x, y=cart.y, z=cart.z)"},{"col":0,"comment":"null","endLoc":27,"header":"def internet_on()","id":7960,"name":"internet_on","nodeType":"Function","startLoc":18,"text":"def internet_on():\n    from . import conf\n    if not conf.use_internet:\n        return False\n    else:\n        try:\n            urlopen('http://google.com', timeout=1.)\n            return True\n        except Exception:\n            return False"},{"col":4,"comment":"null","endLoc":97,"header":"def do_OPTIONS(self)","id":7961,"name":"do_OPTIONS","nodeType":"Function","startLoc":94,"text":"def do_OPTIONS(self):\n\n        self.send_response(200, 'OK')\n        self.end_headers()"},{"fileName":"setup_package.py","filePath":"astropy/samp","id":7962,"nodeType":"File","text":""},{"fileName":"lockfile_helpers.py","filePath":"astropy/samp","id":7963,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\n# TODO: this file should be refactored to use a more thread-safe and\n# race-condition-safe lockfile mechanism.\n\nimport datetime\nimport os\nimport socket\nimport stat\nimport warnings\nfrom contextlib import suppress\nfrom urllib.parse import urlparse\nimport xmlrpc.client as xmlrpc\n\nfrom astropy.config.paths import _find_home\n\n\nfrom astropy import log\n\nfrom astropy.utils.data import get_readable_fileobj\n\nfrom .errors import SAMPHubError, SAMPWarning\n\n\ndef read_lockfile(lockfilename):\n    \"\"\"\n    Read in the lockfile given by ``lockfilename`` into a dictionary.\n    \"\"\"\n    # lockfilename may be a local file or a remote URL, but\n    # get_readable_fileobj takes care of this.\n    lockfiledict = {}\n    with get_readable_fileobj(lockfilename) as f:\n        for line in f:\n            if not line.startswith(\"#\"):\n                kw, val = line.split(\"=\")\n                lockfiledict[kw.strip()] = val.strip()\n    return lockfiledict\n\n\ndef write_lockfile(lockfilename, lockfiledict):\n\n    lockfile = open(lockfilename, \"w\")\n    lockfile.close()\n    os.chmod(lockfilename, stat.S_IREAD + stat.S_IWRITE)\n\n    lockfile = open(lockfilename, \"w\")\n    now_iso = datetime.datetime.now().isoformat()\n    lockfile.write(f\"# SAMP lockfile written on {now_iso}\\n\")\n    lockfile.write(\"# Standard Profile required keys\\n\")\n    for key, value in lockfiledict.items():\n        lockfile.write(f\"{key}={value}\\n\")\n    lockfile.close()\n\n\ndef create_lock_file(lockfilename=None, mode=None, hub_id=None,\n                     hub_params=None):\n\n    # Remove lock-files of dead hubs\n    remove_garbage_lock_files()\n\n    lockfiledir = \"\"\n\n    # CHECK FOR SAMP_HUB ENVIRONMENT VARIABLE\n    if \"SAMP_HUB\" in os.environ:\n        # For the time being I assume just the std profile supported.\n        if os.environ[\"SAMP_HUB\"].startswith(\"std-lockurl:\"):\n\n            lockfilename = os.environ[\"SAMP_HUB\"][len(\"std-lockurl:\"):]\n            lockfile_parsed = urlparse(lockfilename)\n\n            if lockfile_parsed[0] != 'file':\n                warnings.warn(\"Unable to start a Hub with lockfile {}. \"\n                              \"Start-up process aborted.\".format(lockfilename),\n                              SAMPWarning)\n                return False\n            else:\n                lockfilename = lockfile_parsed[2]\n    else:\n\n        # If it is a fresh Hub instance\n        if lockfilename is None:\n\n            log.debug(\"Running mode: \" + mode)\n\n            if mode == 'single':\n                lockfilename = os.path.join(_find_home(), \".samp\")\n            else:\n\n                lockfiledir = os.path.join(_find_home(), \".samp-1\")\n\n                # If missing create .samp-1 directory\n                try:\n                    os.mkdir(lockfiledir)\n                except OSError:\n                    pass  # directory already exists\n                finally:\n                    os.chmod(lockfiledir,\n                             stat.S_IREAD + stat.S_IWRITE + stat.S_IEXEC)\n\n                lockfilename = os.path.join(lockfiledir,\n                                            f\"samp-hub-{hub_id}\")\n\n        else:\n            log.debug(\"Running mode: multiple\")\n\n    hub_is_running, lockfiledict = check_running_hub(lockfilename)\n\n    if hub_is_running:\n        warnings.warn(\"Another SAMP Hub is already running. Start-up process \"\n                      \"aborted.\", SAMPWarning)\n        return False\n\n    log.debug(\"Lock-file: \" + lockfilename)\n\n    write_lockfile(lockfilename, hub_params)\n\n    return lockfilename\n\n\ndef get_main_running_hub():\n    \"\"\"\n    Get either the hub given by the environment variable SAMP_HUB, or the one\n    given by the lockfile .samp in the user home directory.\n    \"\"\"\n    hubs = get_running_hubs()\n\n    if not hubs:\n        raise SAMPHubError(\"Unable to find a running SAMP Hub.\")\n\n    # CHECK FOR SAMP_HUB ENVIRONMENT VARIABLE\n    if \"SAMP_HUB\" in os.environ:\n        # For the time being I assume just the std profile supported.\n        if os.environ[\"SAMP_HUB\"].startswith(\"std-lockurl:\"):\n            lockfilename = os.environ[\"SAMP_HUB\"][len(\"std-lockurl:\"):]\n        else:\n            raise SAMPHubError(\"SAMP Hub profile not supported.\")\n    else:\n        lockfilename = os.path.join(_find_home(), \".samp\")\n\n    return hubs[lockfilename]\n\n\ndef get_running_hubs():\n    \"\"\"\n    Return a dictionary containing the lock-file contents of all the currently\n    running hubs (single and/or multiple mode).\n\n    The dictionary format is:\n\n    ``{<lock-file>: {<token-name>: <token-string>, ...}, ...}``\n\n    where ``{<lock-file>}`` is the lock-file name, ``{<token-name>}`` and\n    ``{<token-string>}`` are the lock-file tokens (name and content).\n\n    Returns\n    -------\n    running_hubs : dict\n        Lock-file contents of all the currently running hubs.\n    \"\"\"\n\n    hubs = {}\n    lockfilename = \"\"\n\n    # HUB SINGLE INSTANCE MODE\n\n    # CHECK FOR SAMP_HUB ENVIRONMENT VARIABLE\n    if \"SAMP_HUB\" in os.environ:\n        # For the time being I assume just the std profile supported.\n        if os.environ[\"SAMP_HUB\"].startswith(\"std-lockurl:\"):\n            lockfilename = os.environ[\"SAMP_HUB\"][len(\"std-lockurl:\"):]\n    else:\n        lockfilename = os.path.join(_find_home(), \".samp\")\n\n    hub_is_running, lockfiledict = check_running_hub(lockfilename)\n\n    if hub_is_running:\n        hubs[lockfilename] = lockfiledict\n\n    # HUB MULTIPLE INSTANCE MODE\n\n    lockfiledir = \"\"\n\n    lockfiledir = os.path.join(_find_home(), \".samp-1\")\n\n    if os.path.isdir(lockfiledir):\n        for filename in os.listdir(lockfiledir):\n            if filename.startswith('samp-hub'):\n                lockfilename = os.path.join(lockfiledir, filename)\n                hub_is_running, lockfiledict = check_running_hub(lockfilename)\n                if hub_is_running:\n                    hubs[lockfilename] = lockfiledict\n\n    return hubs\n\n\ndef check_running_hub(lockfilename):\n    \"\"\"\n    Test whether a hub identified by ``lockfilename`` is running or not.\n\n    Parameters\n    ----------\n    lockfilename : str\n        Lock-file name (path + file name) of the Hub to be tested.\n\n    Returns\n    -------\n    is_running : bool\n        Whether the hub is running\n    hub_params : dict\n        If the hub is running this contains the parameters from the lockfile\n    \"\"\"\n\n    is_running = False\n    lockfiledict = {}\n\n    # Check whether a lockfile already exists\n    try:\n        lockfiledict = read_lockfile(lockfilename)\n    except OSError:\n        return is_running, lockfiledict\n\n    if \"samp.hub.xmlrpc.url\" in lockfiledict:\n        try:\n            proxy = xmlrpc.ServerProxy(lockfiledict[\"samp.hub.xmlrpc.url\"]\n                                       .replace(\"\\\\\", \"\"), allow_none=1)\n            proxy.samp.hub.ping()\n            is_running = True\n        except xmlrpc.ProtocolError:\n            # There is a protocol error (e.g. for authentication required),\n            # but the server is alive\n            is_running = True\n        except socket.error:\n            pass\n\n    return is_running, lockfiledict\n\n\ndef remove_garbage_lock_files():\n\n    lockfilename = \"\"\n\n    # HUB SINGLE INSTANCE MODE\n\n    lockfilename = os.path.join(_find_home(), \".samp\")\n\n    hub_is_running, lockfiledict = check_running_hub(lockfilename)\n\n    if not hub_is_running:\n        # If lockfilename belongs to a dead hub, then it is deleted\n        if os.path.isfile(lockfilename):\n            with suppress(OSError):\n                os.remove(lockfilename)\n\n    # HUB MULTIPLE INSTANCE MODE\n\n    lockfiledir = os.path.join(_find_home(), \".samp-1\")\n\n    if os.path.isdir(lockfiledir):\n        for filename in os.listdir(lockfiledir):\n            if filename.startswith('samp-hub'):\n                lockfilename = os.path.join(lockfiledir, filename)\n                hub_is_running, lockfiledict = check_running_hub(lockfilename)\n                if not hub_is_running:\n                    # If lockfilename belongs to a dead hub, then it is deleted\n                    if os.path.isfile(lockfilename):\n                        with suppress(OSError):\n                            os.remove(lockfilename)\n"},{"className":"_HubAsClient","col":0,"comment":"null","endLoc":147,"id":7964,"nodeType":"Class","startLoc":140,"text":"class _HubAsClient:\n\n    def __init__(self, handler):\n        self._handler = handler\n\n    def __getattr__(self, name):\n        # magic method dispatcher\n        return _HubAsClientMethod(self._handler, name)"},{"col":4,"comment":"null","endLoc":143,"header":"def __init__(self, handler)","id":7965,"name":"__init__","nodeType":"Function","startLoc":142,"text":"def __init__(self, handler):\n        self._handler = handler"},{"col":4,"comment":"null","endLoc":147,"header":"def __getattr__(self, name)","id":7966,"name":"__getattr__","nodeType":"Function","startLoc":145,"text":"def __getattr__(self, name):\n        # magic method dispatcher\n        return _HubAsClientMethod(self._handler, name)"},{"col":4,"comment":"null","endLoc":121,"header":"def do_GET(self)","id":7967,"name":"do_GET","nodeType":"Function","startLoc":99,"text":"def do_GET(self):\n\n        if not self.is_http_path_valid():\n            self.report_404()\n            return\n\n        split_path = self.path.split('?')\n\n        if split_path[0] in [f'/translator/{clid}' for clid in self.server.clients]:\n            # Request of a file proxying\n            urlpath = parse_qs(split_path[1])\n            try:\n                proxyfile = urlopen(urlpath[\"ref\"][0])\n                self.send_response(200, 'OK')\n                self.end_headers()\n                self.wfile.write(proxyfile.read())\n                proxyfile.close()\n            except OSError:\n                self.report_404()\n                return\n\n        if self._serve_cross_domain_xml():\n            return"},{"col":4,"comment":"null","endLoc":154,"header":"def __init__(self, send, name)","id":7968,"name":"__init__","nodeType":"Function","startLoc":152,"text":"def __init__(self, send, name):\n        self.__send = send\n        self.__name = name"},{"attributeType":"null","col":8,"comment":"null","endLoc":143,"id":7969,"name":"_handler","nodeType":"Attribute","startLoc":143,"text":"self._handler"},{"attributeType":"null","col":4,"comment":"null","endLoc":23,"id":7970,"name":"default_representation","nodeType":"Attribute","startLoc":23,"text":"default_representation"},{"attributeType":"null","col":4,"comment":"null","endLoc":24,"id":7971,"name":"default_differential","nodeType":"Attribute","startLoc":24,"text":"default_differential"},{"attributeType":"null","col":4,"comment":"null","endLoc":26,"id":7972,"name":"obstime","nodeType":"Attribute","startLoc":26,"text":"obstime"},{"col":0,"comment":"\n    Given an array, return a new array that is the smallest subset of the\n    original array that can be re-broadcasted back to the original array.\n\n    See https://stackoverflow.com/questions/40845769/un-broadcasting-numpy-arrays\n    for more details.\n    ","endLoc":375,"header":"def unbroadcast(array)","id":7973,"name":"unbroadcast","nodeType":"Function","startLoc":356,"text":"def unbroadcast(array):\n    \"\"\"\n    Given an array, return a new array that is the smallest subset of the\n    original array that can be re-broadcasted back to the original array.\n\n    See https://stackoverflow.com/questions/40845769/un-broadcasting-numpy-arrays\n    for more details.\n    \"\"\"\n\n    if array.ndim == 0:\n        return array\n\n    array = array[tuple((slice(0, 1) if stride == 0 else slice(None))\n                        for stride in array.strides)]\n\n    # Remove leading ones, which are not needed in numpy broadcasting.\n    first_not_unity = next((i for (i, s) in enumerate(array.shape) if s > 1),\n                           array.ndim)\n\n    return array.reshape(array.shape[first_not_unity:])"},{"className":"custom_wcs_to_frame_mappings","col":0,"comment":"null","endLoc":165,"id":7974,"nodeType":"Class","startLoc":155,"text":"class custom_wcs_to_frame_mappings:\n    def __init__(self, mappings=[]):\n        if hasattr(mappings, '__call__'):\n            mappings = [mappings]\n        WCS_FRAME_MAPPINGS.append(mappings)\n\n    def __enter__(self):\n        pass\n\n    def __exit__(self, type, value, tb):\n        WCS_FRAME_MAPPINGS.pop()"},{"col":4,"comment":"null","endLoc":159,"header":"def __init__(self, mappings=[])","id":7975,"name":"__init__","nodeType":"Function","startLoc":156,"text":"def __init__(self, mappings=[]):\n        if hasattr(mappings, '__call__'):\n            mappings = [mappings]\n        WCS_FRAME_MAPPINGS.append(mappings)"},{"col":4,"comment":"null","endLoc":162,"header":"def __enter__(self)","id":7976,"name":"__enter__","nodeType":"Function","startLoc":161,"text":"def __enter__(self):\n        pass"},{"col":4,"comment":"null","endLoc":165,"header":"def __exit__(self, type, value, tb)","id":7977,"name":"__exit__","nodeType":"Function","startLoc":164,"text":"def __exit__(self, type, value, tb):\n        WCS_FRAME_MAPPINGS.pop()"},{"className":"custom_frame_to_wcs_mappings","col":0,"comment":"null","endLoc":182,"id":7978,"nodeType":"Class","startLoc":172,"text":"class custom_frame_to_wcs_mappings:\n    def __init__(self, mappings=[]):\n        if hasattr(mappings, '__call__'):\n            mappings = [mappings]\n        FRAME_WCS_MAPPINGS.append(mappings)\n\n    def __enter__(self):\n        pass\n\n    def __exit__(self, type, value, tb):\n        FRAME_WCS_MAPPINGS.pop()"},{"col":4,"comment":"null","endLoc":176,"header":"def __init__(self, mappings=[])","id":7979,"name":"__init__","nodeType":"Function","startLoc":173,"text":"def __init__(self, mappings=[]):\n        if hasattr(mappings, '__call__'):\n            mappings = [mappings]\n        FRAME_WCS_MAPPINGS.append(mappings)"},{"col":0,"comment":"\n    Read in the lockfile given by ``lockfilename`` into a dictionary.\n    ","endLoc":38,"header":"def read_lockfile(lockfilename)","id":7980,"name":"read_lockfile","nodeType":"Function","startLoc":26,"text":"def read_lockfile(lockfilename):\n    \"\"\"\n    Read in the lockfile given by ``lockfilename`` into a dictionary.\n    \"\"\"\n    # lockfilename may be a local file or a remote URL, but\n    # get_readable_fileobj takes care of this.\n    lockfiledict = {}\n    with get_readable_fileobj(lockfilename) as f:\n        for line in f:\n            if not line.startswith(\"#\"):\n                kw, val = line.split(\"=\")\n                lockfiledict[kw.strip()] = val.strip()\n    return lockfiledict"},{"col":0,"comment":"null","endLoc":53,"header":"def write_lockfile(lockfilename, lockfiledict)","id":7981,"name":"write_lockfile","nodeType":"Function","startLoc":41,"text":"def write_lockfile(lockfilename, lockfiledict):\n\n    lockfile = open(lockfilename, \"w\")\n    lockfile.close()\n    os.chmod(lockfilename, stat.S_IREAD + stat.S_IWRITE)\n\n    lockfile = open(lockfilename, \"w\")\n    now_iso = datetime.datetime.now().isoformat()\n    lockfile.write(f\"# SAMP lockfile written on {now_iso}\\n\")\n    lockfile.write(\"# Standard Profile required keys\\n\")\n    for key, value in lockfiledict.items():\n        lockfile.write(f\"{key}={value}\\n\")\n    lockfile.close()"},{"col":4,"comment":"null","endLoc":179,"header":"def __enter__(self)","id":7982,"name":"__enter__","nodeType":"Function","startLoc":178,"text":"def __enter__(self):\n        pass"},{"col":4,"comment":"null","endLoc":182,"header":"def __exit__(self, type, value, tb)","id":7983,"name":"__exit__","nodeType":"Function","startLoc":181,"text":"def __exit__(self, type, value, tb):\n        FRAME_WCS_MAPPINGS.pop()"},{"col":0,"comment":"\n    Add a new Stokes axis that is uncorrelated with any other axes.\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.WCS`\n        The WCS to add to\n    add_before_ind : int\n        Index of the WCS to insert the new Stokes axis in front of.\n        To add at the end, do add_before_ind = wcs.wcs.naxis\n        The beginning is at position 0.\n\n    Returns\n    -------\n    `~astropy.wcs.WCS`\n        A new `~astropy.wcs.WCS` instance with an additional axis\n    ","endLoc":49,"header":"def add_stokes_axis_to_wcs(wcs, add_before_ind)","id":7984,"name":"add_stokes_axis_to_wcs","nodeType":"Function","startLoc":25,"text":"def add_stokes_axis_to_wcs(wcs, add_before_ind):\n    \"\"\"\n    Add a new Stokes axis that is uncorrelated with any other axes.\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.WCS`\n        The WCS to add to\n    add_before_ind : int\n        Index of the WCS to insert the new Stokes axis in front of.\n        To add at the end, do add_before_ind = wcs.wcs.naxis\n        The beginning is at position 0.\n\n    Returns\n    -------\n    `~astropy.wcs.WCS`\n        A new `~astropy.wcs.WCS` instance with an additional axis\n    \"\"\"\n\n    inds = [i + 1 for i in range(wcs.wcs.naxis)]\n    inds.insert(add_before_ind, 0)\n    newwcs = wcs.sub(inds)\n    newwcs.wcs.ctype[add_before_ind] = 'STOKES'\n    newwcs.wcs.cname[add_before_ind] = 'STOKES'\n    return newwcs"},{"col":4,"comment":"null","endLoc":491,"header":"def get_private_key(self)","id":7985,"name":"get_private_key","nodeType":"Function","startLoc":490,"text":"def get_private_key(self):\n        return self.client.get_private_key()"},{"col":0,"comment":"null","endLoc":107,"header":"def _wcs_to_celestial_frame_builtin(wcs)","id":7986,"name":"_wcs_to_celestial_frame_builtin","nodeType":"Function","startLoc":52,"text":"def _wcs_to_celestial_frame_builtin(wcs):\n\n    # Import astropy.coordinates here to avoid circular imports\n    from astropy.coordinates import (FK4, FK5, ICRS, ITRS, FK4NoETerms,\n                                     Galactic, SphericalRepresentation)\n    # Import astropy.time here otherwise setup.py fails before extensions are compiled\n    from astropy.time import Time\n\n    if wcs.wcs.lng == -1 or wcs.wcs.lat == -1:\n        return None\n\n    radesys = wcs.wcs.radesys\n\n    if np.isnan(wcs.wcs.equinox):\n        equinox = None\n    else:\n        equinox = wcs.wcs.equinox\n\n    xcoord = wcs.wcs.ctype[wcs.wcs.lng][:4]\n    ycoord = wcs.wcs.ctype[wcs.wcs.lat][:4]\n\n    # Apply logic from FITS standard to determine the default radesys\n    if radesys == '' and xcoord == 'RA--' and ycoord == 'DEC-':\n        if equinox is None:\n            radesys = \"ICRS\"\n        elif equinox < 1984.:\n            radesys = \"FK4\"\n        else:\n            radesys = \"FK5\"\n\n    if radesys == 'FK4':\n        if equinox is not None:\n            equinox = Time(equinox, format='byear')\n        frame = FK4(equinox=equinox)\n    elif radesys == 'FK4-NO-E':\n        if equinox is not None:\n            equinox = Time(equinox, format='byear')\n        frame = FK4NoETerms(equinox=equinox)\n    elif radesys == 'FK5':\n        if equinox is not None:\n            equinox = Time(equinox, format='jyear')\n        frame = FK5(equinox=equinox)\n    elif radesys == 'ICRS':\n        frame = ICRS()\n    else:\n        if xcoord == 'GLON' and ycoord == 'GLAT':\n            frame = Galactic()\n        elif xcoord == 'TLON' and ycoord == 'TLAT':\n            # The default representation for ITRS is cartesian, but for WCS\n            # purposes, we need the spherical representation.\n            frame = ITRS(representation_type=SphericalRepresentation,\n                         obstime=wcs.wcs.dateobs or None)\n        else:\n            frame = None\n\n    return frame"},{"col":0,"comment":"null","endLoc":118,"header":"def create_lock_file(lockfilename=None, mode=None, hub_id=None,\n                     hub_params=None)","id":7987,"name":"create_lock_file","nodeType":"Function","startLoc":56,"text":"def create_lock_file(lockfilename=None, mode=None, hub_id=None,\n                     hub_params=None):\n\n    # Remove lock-files of dead hubs\n    remove_garbage_lock_files()\n\n    lockfiledir = \"\"\n\n    # CHECK FOR SAMP_HUB ENVIRONMENT VARIABLE\n    if \"SAMP_HUB\" in os.environ:\n        # For the time being I assume just the std profile supported.\n        if os.environ[\"SAMP_HUB\"].startswith(\"std-lockurl:\"):\n\n            lockfilename = os.environ[\"SAMP_HUB\"][len(\"std-lockurl:\"):]\n            lockfile_parsed = urlparse(lockfilename)\n\n            if lockfile_parsed[0] != 'file':\n                warnings.warn(\"Unable to start a Hub with lockfile {}. \"\n                              \"Start-up process aborted.\".format(lockfilename),\n                              SAMPWarning)\n                return False\n            else:\n                lockfilename = lockfile_parsed[2]\n    else:\n\n        # If it is a fresh Hub instance\n        if lockfilename is None:\n\n            log.debug(\"Running mode: \" + mode)\n\n            if mode == 'single':\n                lockfilename = os.path.join(_find_home(), \".samp\")\n            else:\n\n                lockfiledir = os.path.join(_find_home(), \".samp-1\")\n\n                # If missing create .samp-1 directory\n                try:\n                    os.mkdir(lockfiledir)\n                except OSError:\n                    pass  # directory already exists\n                finally:\n                    os.chmod(lockfiledir,\n                             stat.S_IREAD + stat.S_IWRITE + stat.S_IEXEC)\n\n                lockfilename = os.path.join(lockfiledir,\n                                            f\"samp-hub-{hub_id}\")\n\n        else:\n            log.debug(\"Running mode: multiple\")\n\n    hub_is_running, lockfiledict = check_running_hub(lockfilename)\n\n    if hub_is_running:\n        warnings.warn(\"Another SAMP Hub is already running. Start-up process \"\n                      \"aborted.\", SAMPWarning)\n        return False\n\n    log.debug(\"Lock-file: \" + lockfilename)\n\n    write_lockfile(lockfilename, hub_params)\n\n    return lockfilename"},{"col":0,"comment":"null","endLoc":268,"header":"def remove_garbage_lock_files()","id":7988,"name":"remove_garbage_lock_files","nodeType":"Function","startLoc":239,"text":"def remove_garbage_lock_files():\n\n    lockfilename = \"\"\n\n    # HUB SINGLE INSTANCE MODE\n\n    lockfilename = os.path.join(_find_home(), \".samp\")\n\n    hub_is_running, lockfiledict = check_running_hub(lockfilename)\n\n    if not hub_is_running:\n        # If lockfilename belongs to a dead hub, then it is deleted\n        if os.path.isfile(lockfilename):\n            with suppress(OSError):\n                os.remove(lockfilename)\n\n    # HUB MULTIPLE INSTANCE MODE\n\n    lockfiledir = os.path.join(_find_home(), \".samp-1\")\n\n    if os.path.isdir(lockfiledir):\n        for filename in os.listdir(lockfiledir):\n            if filename.startswith('samp-hub'):\n                lockfilename = os.path.join(lockfiledir, filename)\n                hub_is_running, lockfiledict = check_running_hub(lockfilename)\n                if not hub_is_running:\n                    # If lockfilename belongs to a dead hub, then it is deleted\n                    if os.path.isfile(lockfilename):\n                        with suppress(OSError):\n                            os.remove(lockfilename)"},{"col":0,"comment":"\n    Test whether a hub identified by ``lockfilename`` is running or not.\n\n    Parameters\n    ----------\n    lockfilename : str\n        Lock-file name (path + file name) of the Hub to be tested.\n\n    Returns\n    -------\n    is_running : bool\n        Whether the hub is running\n    hub_params : dict\n        If the hub is running this contains the parameters from the lockfile\n    ","endLoc":236,"header":"def check_running_hub(lockfilename)","id":7989,"name":"check_running_hub","nodeType":"Function","startLoc":197,"text":"def check_running_hub(lockfilename):\n    \"\"\"\n    Test whether a hub identified by ``lockfilename`` is running or not.\n\n    Parameters\n    ----------\n    lockfilename : str\n        Lock-file name (path + file name) of the Hub to be tested.\n\n    Returns\n    -------\n    is_running : bool\n        Whether the hub is running\n    hub_params : dict\n        If the hub is running this contains the parameters from the lockfile\n    \"\"\"\n\n    is_running = False\n    lockfiledict = {}\n\n    # Check whether a lockfile already exists\n    try:\n        lockfiledict = read_lockfile(lockfilename)\n    except OSError:\n        return is_running, lockfiledict\n\n    if \"samp.hub.xmlrpc.url\" in lockfiledict:\n        try:\n            proxy = xmlrpc.ServerProxy(lockfiledict[\"samp.hub.xmlrpc.url\"]\n                                       .replace(\"\\\\\", \"\"), allow_none=1)\n            proxy.samp.hub.ping()\n            is_running = True\n        except xmlrpc.ProtocolError:\n            # There is a protocol error (e.g. for authentication required),\n            # but the server is alive\n            is_running = True\n        except socket.error:\n            pass\n\n    return is_running, lockfiledict"},{"col":4,"comment":"\n        Start the client in a separate thread (non-blocking).\n\n        This only has an effect if ``callable`` was set to `True` when\n        initializing the client.\n        ","endLoc":137,"header":"def start(self)","id":7990,"name":"start","nodeType":"Function","startLoc":128,"text":"def start(self):\n        \"\"\"\n        Start the client in a separate thread (non-blocking).\n\n        This only has an effect if ``callable`` was set to `True` when\n        initializing the client.\n        \"\"\"\n        if self._callable:\n            self._is_running = True\n            self._run_client()"},{"col":4,"comment":"\n        Return the client private key used for the Standard Profile\n        communications obtained at registration time (``samp.private-key``).\n\n        Returns\n        -------\n        key : str\n            Client private key.\n        ","endLoc":706,"header":"def get_private_key(self)","id":7991,"name":"get_private_key","nodeType":"Function","startLoc":696,"text":"def get_private_key(self):\n        \"\"\"\n        Return the client private key used for the Standard Profile\n        communications obtained at registration time (``samp.private-key``).\n\n        Returns\n        -------\n        key : str\n            Client private key.\n        \"\"\"\n        return self._private_key"},{"col":4,"comment":"null","endLoc":175,"header":"def _run_client(self)","id":7992,"name":"_run_client","nodeType":"Function","startLoc":173,"text":"def _run_client(self):\n        if self._callable:\n            self._thread.start()"},{"className":"WebProfileXMLRPCServer","col":0,"comment":"\n    XMLRPC server supporting the SAMP Web Profile.\n    ","endLoc":152,"id":7993,"nodeType":"Class","startLoc":130,"text":"class WebProfileXMLRPCServer(ThreadingXMLRPCServer):\n    \"\"\"\n    XMLRPC server supporting the SAMP Web Profile.\n    \"\"\"\n\n    def __init__(self, addr, log=None, requestHandler=WebProfileRequestHandler,\n                 logRequests=True, allow_none=True, encoding=None):\n\n        self.clients = []\n        ThreadingXMLRPCServer.__init__(self, addr, log, requestHandler,\n                                       logRequests, allow_none, encoding)\n\n    def add_client(self, client_id):\n        self.clients.append(client_id)\n\n    def remove_client(self, client_id):\n        try:\n            self.clients.remove(client_id)\n        except ValueError:\n            # No warning here because this method gets called for all clients,\n            # not just web clients, and we expect it to fail for non-web\n            # clients.\n            pass"},{"col":4,"comment":"null","endLoc":140,"header":"def __init__(self, addr, log=None, requestHandler=WebProfileRequestHandler,\n                 logRequests=True, allow_none=True, encoding=None)","id":7994,"name":"__init__","nodeType":"Function","startLoc":135,"text":"def __init__(self, addr, log=None, requestHandler=WebProfileRequestHandler,\n                 logRequests=True, allow_none=True, encoding=None):\n\n        self.clients = []\n        ThreadingXMLRPCServer.__init__(self, addr, log, requestHandler,\n                                       logRequests, allow_none, encoding)"},{"col":4,"comment":"\n        Proxy to ``reply`` SAMP Hub method.\n        ","endLoc":200,"header":"def reply(self, private_key, msg_id, response)","id":7995,"name":"reply","nodeType":"Function","startLoc":196,"text":"def reply(self, private_key, msg_id, response):\n        \"\"\"\n        Proxy to ``reply`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.reply(private_key, msg_id, response)"},{"col":4,"comment":"null","endLoc":143,"header":"def add_client(self, client_id)","id":7996,"name":"add_client","nodeType":"Function","startLoc":142,"text":"def add_client(self, client_id):\n        self.clients.append(client_id)"},{"col":4,"comment":"\n        Stop the client.\n\n        Parameters\n        ----------\n        timeout : float\n            Timeout after which to give up if the client cannot be cleanly\n            shut down.\n        ","endLoc":157,"header":"def stop(self, timeout=10.)","id":7997,"name":"stop","nodeType":"Function","startLoc":139,"text":"def stop(self, timeout=10.):\n        \"\"\"\n        Stop the client.\n\n        Parameters\n        ----------\n        timeout : float\n            Timeout after which to give up if the client cannot be cleanly\n            shut down.\n        \"\"\"\n        # Setting _is_running to False causes the loop in _serve_forever to\n        # exit. The thread should then stop running. We wait for the thread to\n        # terminate until the timeout, then we continue anyway.\n        self._is_running = False\n        if self._callable and self._thread.is_alive():\n            self._thread.join(timeout)\n        if self._thread.is_alive():\n            raise SAMPClientError(\"Client was not shut down successfully \"\n                                  \"(timeout={}s)\".format(timeout))"},{"col":4,"comment":"null","endLoc":152,"header":"def remove_client(self, client_id)","id":7998,"name":"remove_client","nodeType":"Function","startLoc":145,"text":"def remove_client(self, client_id):\n        try:\n            self.clients.remove(client_id)\n        except ValueError:\n            # No warning here because this method gets called for all clients,\n            # not just web clients, and we expect it to fail for non-web\n            # clients.\n            pass"},{"attributeType":"null","col":8,"comment":"null","endLoc":138,"id":7999,"name":"clients","nodeType":"Attribute","startLoc":138,"text":"self.clients"},{"col":0,"comment":"null","endLoc":180,"header":"def web_profile_text_dialog(request, queue)","id":8000,"name":"web_profile_text_dialog","nodeType":"Function","startLoc":155,"text":"def web_profile_text_dialog(request, queue):\n\n    samp_name = \"unknown\"\n\n    if isinstance(request[0], str):\n        # To support the old protocol version\n        samp_name = request[0]\n    else:\n        samp_name = request[0][\"samp.name\"]\n\n    text = \\\n        f\"\"\"A Web application which declares to be\n\nName: {samp_name}\nOrigin: {request[2]}\n\nis requesting to be registered with the SAMP Hub.\nPay attention that if you permit its registration, such\napplication will acquire all current user privileges, like\nfile read/write.\n\nDo you give your consent? [yes|no]\"\"\"\n\n    print(text)\n    answer = input(\">>> \")\n    queue.put(answer.lower() in [\"yes\", \"y\"])"},{"className":"SAMPHubServer","col":0,"comment":"\n    SAMP Hub Server.\n\n    Parameters\n    ----------\n    secret : str, optional\n        The secret code to use for the SAMP lockfile. If none is is specified,\n        the :func:`uuid.uuid1` function is used to generate one.\n\n    addr : str, optional\n        Listening address (or IP). This defaults to 127.0.0.1 if the internet\n        is not reachable, otherwise it defaults to the host name.\n\n    port : int, optional\n        Listening XML-RPC server socket port. If left set to 0 (the default),\n        the operating system will select a free port.\n\n    lockfile : str, optional\n        Custom lockfile name.\n\n    timeout : int, optional\n        Hub inactivity timeout. If ``timeout > 0`` then the Hub automatically\n        stops after an inactivity period longer than ``timeout`` seconds. By\n        default ``timeout`` is set to 0 (Hub never expires).\n\n    client_timeout : int, optional\n        Client inactivity timeout. If ``client_timeout > 0`` then the Hub\n        automatically unregisters the clients which result inactive for a\n        period longer than ``client_timeout`` seconds. By default\n        ``client_timeout`` is set to 0 (clients never expire).\n\n    mode : str, optional\n        Defines the Hub running mode. If ``mode`` is ``'single'`` then the Hub\n        runs using the standard ``.samp`` lock-file, having a single instance\n        for user desktop session. Otherwise, if ``mode`` is ``'multiple'``,\n        then the Hub runs using a non-standard lock-file, placed in\n        ``.samp-1`` directory, of the form ``samp-hub-<UUID>``, where\n        ``<UUID>`` is a unique UUID assigned to the hub.\n\n    label : str, optional\n        A string used to label the Hub with a human readable name. This string\n        is written in the lock-file assigned to the ``hub.label`` token.\n\n    web_profile : bool, optional\n        Enables or disables the Web Profile support.\n\n    web_profile_dialog : class, optional\n        Allows a class instance to be specified using ``web_profile_dialog``\n        to replace the terminal-based message with e.g. a GUI pop-up. Two\n        `queue.Queue` instances will be added to the instance as attributes\n        ``queue_request`` and ``queue_result``. When a request is received via\n        the ``queue_request`` queue, the pop-up should be displayed, and a\n        value of `True` or `False` should be added to ``queue_result``\n        depending on whether the user accepted or refused the connection.\n\n    web_port : int, optional\n        The port to use for web SAMP. This should not be changed except for\n        testing purposes, since web SAMP should always use port 21012.\n\n    pool_size : int, optional\n        The number of socket connections opened to communicate with the\n        clients.\n    ","endLoc":1336,"id":8001,"nodeType":"Class","startLoc":33,"text":"class SAMPHubServer:\n    \"\"\"\n    SAMP Hub Server.\n\n    Parameters\n    ----------\n    secret : str, optional\n        The secret code to use for the SAMP lockfile. If none is is specified,\n        the :func:`uuid.uuid1` function is used to generate one.\n\n    addr : str, optional\n        Listening address (or IP). This defaults to 127.0.0.1 if the internet\n        is not reachable, otherwise it defaults to the host name.\n\n    port : int, optional\n        Listening XML-RPC server socket port. If left set to 0 (the default),\n        the operating system will select a free port.\n\n    lockfile : str, optional\n        Custom lockfile name.\n\n    timeout : int, optional\n        Hub inactivity timeout. If ``timeout > 0`` then the Hub automatically\n        stops after an inactivity period longer than ``timeout`` seconds. By\n        default ``timeout`` is set to 0 (Hub never expires).\n\n    client_timeout : int, optional\n        Client inactivity timeout. If ``client_timeout > 0`` then the Hub\n        automatically unregisters the clients which result inactive for a\n        period longer than ``client_timeout`` seconds. By default\n        ``client_timeout`` is set to 0 (clients never expire).\n\n    mode : str, optional\n        Defines the Hub running mode. If ``mode`` is ``'single'`` then the Hub\n        runs using the standard ``.samp`` lock-file, having a single instance\n        for user desktop session. Otherwise, if ``mode`` is ``'multiple'``,\n        then the Hub runs using a non-standard lock-file, placed in\n        ``.samp-1`` directory, of the form ``samp-hub-<UUID>``, where\n        ``<UUID>`` is a unique UUID assigned to the hub.\n\n    label : str, optional\n        A string used to label the Hub with a human readable name. This string\n        is written in the lock-file assigned to the ``hub.label`` token.\n\n    web_profile : bool, optional\n        Enables or disables the Web Profile support.\n\n    web_profile_dialog : class, optional\n        Allows a class instance to be specified using ``web_profile_dialog``\n        to replace the terminal-based message with e.g. a GUI pop-up. Two\n        `queue.Queue` instances will be added to the instance as attributes\n        ``queue_request`` and ``queue_result``. When a request is received via\n        the ``queue_request`` queue, the pop-up should be displayed, and a\n        value of `True` or `False` should be added to ``queue_result``\n        depending on whether the user accepted or refused the connection.\n\n    web_port : int, optional\n        The port to use for web SAMP. This should not be changed except for\n        testing purposes, since web SAMP should always use port 21012.\n\n    pool_size : int, optional\n        The number of socket connections opened to communicate with the\n        clients.\n    \"\"\"\n\n    def __init__(self, secret=None, addr=None, port=0, lockfile=None,\n                 timeout=0, client_timeout=0, mode='single', label=\"\",\n                 web_profile=True, web_profile_dialog=None, web_port=21012,\n                 pool_size=20):\n\n        # Generate random ID for the hub\n        self._id = str(uuid.uuid1())\n\n        # General settings\n        self._is_running = False\n        self._customlockfilename = lockfile\n        self._lockfile = None\n        self._addr = addr\n        self._port = port\n        self._mode = mode\n        self._label = label\n        self._timeout = timeout\n        self._client_timeout = client_timeout\n        self._pool_size = pool_size\n\n        # Web profile specific attributes\n        self._web_profile = web_profile\n        self._web_profile_dialog = web_profile_dialog\n        self._web_port = web_port\n\n        self._web_profile_server = None\n        self._web_profile_callbacks = {}\n        self._web_profile_requests_queue = None\n        self._web_profile_requests_result = None\n        self._web_profile_requests_semaphore = None\n\n        self._host_name = \"127.0.0.1\"\n        if internet_on():\n            try:\n                self._host_name = socket.getfqdn()\n                socket.getaddrinfo(self._addr or self._host_name,\n                                   self._port or 0)\n            except socket.error:\n                self._host_name = \"127.0.0.1\"\n\n        # Threading stuff\n        self._thread_lock = threading.Lock()\n        self._thread_run = None\n        self._thread_hub_timeout = None\n        self._thread_client_timeout = None\n\n        self._launched_threads = []\n\n        # Variables for timeout testing:\n        self._last_activity_time = None\n        self._client_activity_time = {}\n\n        # Hub message id counter, used to create hub msg ids\n        self._hub_msg_id_counter = 0\n\n        # Hub secret code\n        self._hub_secret_code_customized = secret\n        self._hub_secret = self._create_secret_code()\n\n        # Hub public id (as SAMP client)\n        self._hub_public_id = \"\"\n\n        # Client ids\n        # {private_key: (public_id, timestamp)}\n        self._private_keys = {}\n\n        # Metadata per client\n        # {private_key: metadata}\n        self._metadata = {}\n\n        # List of subscribed clients per MType\n        # {mtype: private_key list}\n        self._mtype2ids = {}\n\n        # List of subscribed MTypes per client\n        # {private_key: mtype list}\n        self._id2mtypes = {}\n\n        # List of XML-RPC addresses per client\n        # {public_id: (XML-RPC address, ServerProxyPool instance)}\n        self._xmlrpc_endpoints = {}\n\n        # Synchronous message id heap\n        self._sync_msg_ids_heap = {}\n\n        # Public ids counter\n        self._client_id_counter = -1\n\n    @property\n    def id(self):\n        \"\"\"\n        The unique hub ID.\n        \"\"\"\n        return self._id\n\n    def _register_standard_api(self, server):\n        # Standard Profile only operations\n        server.register_function(self._ping, 'samp.hub.ping')\n        server.register_function(self._set_xmlrpc_callback, 'samp.hub.setXmlrpcCallback')\n\n        # Standard API operations\n        server.register_function(self._register, 'samp.hub.register')\n        server.register_function(self._unregister, 'samp.hub.unregister')\n        server.register_function(self._declare_metadata, 'samp.hub.declareMetadata')\n        server.register_function(self._get_metadata, 'samp.hub.getMetadata')\n        server.register_function(self._declare_subscriptions, 'samp.hub.declareSubscriptions')\n        server.register_function(self._get_subscriptions, 'samp.hub.getSubscriptions')\n        server.register_function(self._get_registered_clients, 'samp.hub.getRegisteredClients')\n        server.register_function(self._get_subscribed_clients, 'samp.hub.getSubscribedClients')\n        server.register_function(self._notify, 'samp.hub.notify')\n        server.register_function(self._notify_all, 'samp.hub.notifyAll')\n        server.register_function(self._call, 'samp.hub.call')\n        server.register_function(self._call_all, 'samp.hub.callAll')\n        server.register_function(self._call_and_wait, 'samp.hub.callAndWait')\n        server.register_function(self._reply, 'samp.hub.reply')\n\n    def _register_web_profile_api(self, server):\n        # Web Profile methods like Standard Profile\n        server.register_function(self._ping, 'samp.webhub.ping')\n        server.register_function(self._unregister, 'samp.webhub.unregister')\n        server.register_function(self._declare_metadata, 'samp.webhub.declareMetadata')\n        server.register_function(self._get_metadata, 'samp.webhub.getMetadata')\n        server.register_function(self._declare_subscriptions, 'samp.webhub.declareSubscriptions')\n        server.register_function(self._get_subscriptions, 'samp.webhub.getSubscriptions')\n        server.register_function(self._get_registered_clients, 'samp.webhub.getRegisteredClients')\n        server.register_function(self._get_subscribed_clients, 'samp.webhub.getSubscribedClients')\n        server.register_function(self._notify, 'samp.webhub.notify')\n        server.register_function(self._notify_all, 'samp.webhub.notifyAll')\n        server.register_function(self._call, 'samp.webhub.call')\n        server.register_function(self._call_all, 'samp.webhub.callAll')\n        server.register_function(self._call_and_wait, 'samp.webhub.callAndWait')\n        server.register_function(self._reply, 'samp.webhub.reply')\n\n        # Methods particularly for Web Profile\n        server.register_function(self._web_profile_register, 'samp.webhub.register')\n        server.register_function(self._web_profile_allowReverseCallbacks, 'samp.webhub.allowReverseCallbacks')\n        server.register_function(self._web_profile_pullCallbacks, 'samp.webhub.pullCallbacks')\n\n    def _start_standard_server(self):\n\n        self._server = ThreadingXMLRPCServer(\n                (self._addr or self._host_name, self._port or 0),\n                log, logRequests=False, allow_none=True)\n        prot = 'http'\n\n        self._port = self._server.socket.getsockname()[1]\n        addr = f\"{self._addr or self._host_name}:{self._port}\"\n        self._url = urlunparse((prot, addr, '', '', '', ''))\n        self._server.register_introspection_functions()\n        self._register_standard_api(self._server)\n\n    def _start_web_profile_server(self):\n        self._web_profile_requests_queue = queue.Queue(1)\n        self._web_profile_requests_result = queue.Queue(1)\n        self._web_profile_requests_semaphore = queue.Queue(1)\n\n        if self._web_profile_dialog is not None:\n            # TODO: Some sort of duck-typing on the web_profile_dialog object\n            self._web_profile_dialog.queue_request = \\\n                    self._web_profile_requests_queue\n            self._web_profile_dialog.queue_result = \\\n                    self._web_profile_requests_result\n\n        try:\n            self._web_profile_server = WebProfileXMLRPCServer(\n                    ('localhost', self._web_port), log, logRequests=False,\n                    allow_none=True)\n            self._web_port = self._web_profile_server.socket.getsockname()[1]\n            self._web_profile_server.register_introspection_functions()\n            self._register_web_profile_api(self._web_profile_server)\n            log.info(\"Hub set to run with Web Profile support enabled.\")\n        except socket.error:\n            log.warning(\"Port {} already in use. Impossible to run the \"\n                        \"Hub with Web Profile support.\".format(self._web_port),\n                        SAMPWarning)\n            self._web_profile = False\n            # Cleanup\n            self._web_profile_requests_queue = None\n            self._web_profile_requests_result = None\n            self._web_profile_requests_semaphore = None\n\n    def _launch_thread(self, group=None, target=None, name=None, args=None):\n\n        # Remove inactive threads\n        remove = []\n        for t in self._launched_threads:\n            if not t.is_alive():\n                remove.append(t)\n        for t in remove:\n            self._launched_threads.remove(t)\n\n        # Start new thread\n        t = threading.Thread(group=group, target=target, name=name, args=args)\n        t.start()\n\n        # Add to list of launched threads\n        self._launched_threads.append(t)\n\n    def _join_launched_threads(self, timeout=None):\n        for t in self._launched_threads:\n            t.join(timeout=timeout)\n\n    def _timeout_test_hub(self):\n\n        if self._timeout == 0:\n            return\n\n        last = time.time()\n        while self._is_running:\n            time.sleep(0.05)  # keep this small to check _is_running often\n            now = time.time()\n            if now - last > 1.:\n                with self._thread_lock:\n                    if self._last_activity_time is not None:\n                        if now - self._last_activity_time >= self._timeout:\n                            warnings.warn(\"Timeout expired, Hub is shutting down!\",\n                                          SAMPWarning)\n                            self.stop()\n                            return\n                last = now\n\n    def _timeout_test_client(self):\n\n        if self._client_timeout == 0:\n            return\n\n        last = time.time()\n        while self._is_running:\n            time.sleep(0.05)  # keep this small to check _is_running often\n            now = time.time()\n            if now - last > 1.:\n                for private_key in self._client_activity_time.keys():\n                    if (now - self._client_activity_time[private_key] > self._client_timeout\n                        and private_key != self._hub_private_key):\n                        warnings.warn(\n                            f\"Client {private_key} timeout expired!\",\n                            SAMPWarning)\n                        self._notify_disconnection(private_key)\n                        self._unregister(private_key)\n                last = now\n\n    def _hub_as_client_request_handler(self, method, args):\n        if method == 'samp.client.receiveCall':\n            return self._receive_call(*args)\n        elif method == 'samp.client.receiveNotification':\n            return self._receive_notification(*args)\n        elif method == 'samp.client.receiveResponse':\n            return self._receive_response(*args)\n        elif method == 'samp.app.ping':\n            return self._ping(*args)\n\n    def _setup_hub_as_client(self):\n\n        hub_metadata = {\"samp.name\": \"Astropy SAMP Hub\",\n                        \"samp.description.text\": self._label,\n                        \"author.name\": \"The Astropy Collaboration\",\n                        \"samp.documentation.url\": \"https://docs.astropy.org/en/stable/samp\",\n                        \"samp.icon.url\": self._url + \"/samp/icon\"}\n\n        result = self._register(self._hub_secret)\n        self._hub_public_id = result[\"samp.self-id\"]\n        self._hub_private_key = result[\"samp.private-key\"]\n        self._set_xmlrpc_callback(self._hub_private_key, self._url)\n        self._declare_metadata(self._hub_private_key, hub_metadata)\n        self._declare_subscriptions(self._hub_private_key,\n                                    {\"samp.app.ping\": {},\n                                     \"x-samp.query.by-meta\": {}})\n\n    def start(self, wait=False):\n        \"\"\"\n        Start the current SAMP Hub instance and create the lock file. Hub\n        start-up can be blocking or non blocking depending on the ``wait``\n        parameter.\n\n        Parameters\n        ----------\n        wait : bool\n            If `True` then the Hub process is joined with the caller, blocking\n            the code flow. Usually `True` option is used to run a stand-alone\n            Hub in an executable script. If `False` (default), then the Hub\n            process runs in a separated thread. `False` is usually used in a\n            Python shell.\n        \"\"\"\n\n        if self._is_running:\n            raise SAMPHubError(\"Hub is already running\")\n\n        if self._lockfile is not None:\n            raise SAMPHubError(\"Hub is not running but lockfile is set\")\n\n        if self._web_profile:\n            self._start_web_profile_server()\n\n        self._start_standard_server()\n\n        self._lockfile = create_lock_file(lockfilename=self._customlockfilename,\n                                          mode=self._mode, hub_id=self.id,\n                                          hub_params=self.params)\n\n        self._update_last_activity_time()\n        self._setup_hub_as_client()\n\n        self._start_threads()\n\n        log.info(\"Hub started\")\n\n        if wait and self._is_running:\n            self._thread_run.join()\n            self._thread_run = None\n\n    @property\n    def params(self):\n        \"\"\"\n        The hub parameters (which are written to the logfile)\n        \"\"\"\n\n        params = {}\n\n        # Keys required by standard profile\n\n        params['samp.secret'] = self._hub_secret\n        params['samp.hub.xmlrpc.url'] = self._url\n        params['samp.profile.version'] = __profile_version__\n\n        # Custom keys\n\n        params['hub.id'] = self.id\n        params['hub.label'] = self._label or f\"Hub {self.id}\"\n\n        return params\n\n    def _start_threads(self):\n        self._thread_run = threading.Thread(target=self._serve_forever)\n        self._thread_run.daemon = True\n\n        if self._timeout > 0:\n            self._thread_hub_timeout = threading.Thread(\n                    target=self._timeout_test_hub,\n                    name=\"Hub timeout test\")\n            self._thread_hub_timeout.daemon = True\n        else:\n            self._thread_hub_timeout = None\n\n        if self._client_timeout > 0:\n            self._thread_client_timeout = threading.Thread(\n                    target=self._timeout_test_client,\n                    name=\"Client timeout test\")\n            self._thread_client_timeout.daemon = True\n        else:\n            self._thread_client_timeout = None\n\n        self._is_running = True\n        self._thread_run.start()\n\n        if self._thread_hub_timeout is not None:\n            self._thread_hub_timeout.start()\n        if self._thread_client_timeout is not None:\n            self._thread_client_timeout.start()\n\n    def _create_secret_code(self):\n        if self._hub_secret_code_customized is not None:\n            return self._hub_secret_code_customized\n        else:\n            return str(uuid.uuid1())\n\n    def stop(self):\n        \"\"\"\n        Stop the current SAMP Hub instance and delete the lock file.\n        \"\"\"\n\n        if not self._is_running:\n            return\n\n        log.info(\"Hub is stopping...\")\n\n        self._notify_shutdown()\n\n        self._is_running = False\n\n        if self._lockfile and os.path.isfile(self._lockfile):\n            lockfiledict = read_lockfile(self._lockfile)\n            if lockfiledict['samp.secret'] == self._hub_secret:\n                os.remove(self._lockfile)\n        self._lockfile = None\n\n        # Reset variables\n        # TODO: What happens if not all threads are stopped after timeout?\n        self._join_all_threads(timeout=10.)\n\n        self._hub_msg_id_counter = 0\n        self._hub_secret = self._create_secret_code()\n        self._hub_public_id = \"\"\n        self._metadata = {}\n        self._private_keys = {}\n        self._mtype2ids = {}\n        self._id2mtypes = {}\n        self._xmlrpc_endpoints = {}\n        self._last_activity_time = None\n\n        log.info(\"Hub stopped.\")\n\n    def _join_all_threads(self, timeout=None):\n        # In some cases, ``stop`` may be called from some of the sub-threads,\n        # so we just need to make sure that we don't try and shut down the\n        # calling thread.\n        current_thread = threading.current_thread()\n        if self._thread_run is not current_thread:\n            self._thread_run.join(timeout=timeout)\n            if not self._thread_run.is_alive():\n                self._thread_run = None\n        if self._thread_hub_timeout is not None and self._thread_hub_timeout is not current_thread:\n            self._thread_hub_timeout.join(timeout=timeout)\n            if not self._thread_hub_timeout.is_alive():\n                self._thread_hub_timeout = None\n        if self._thread_client_timeout is not None and self._thread_client_timeout is not current_thread:\n            self._thread_client_timeout.join(timeout=timeout)\n            if not self._thread_client_timeout.is_alive():\n                self._thread_client_timeout = None\n\n        self._join_launched_threads(timeout=timeout)\n\n    @property\n    def is_running(self):\n        \"\"\"Return an information concerning the Hub running status.\n\n        Returns\n        -------\n        running : bool\n            Is the hub running?\n        \"\"\"\n        return self._is_running\n\n    def _serve_forever(self):\n\n        while self._is_running:\n\n            try:\n                read_ready = select.select([self._server.socket], [], [], 0.01)[0]\n            except OSError as exc:\n                warnings.warn(f\"Call to select() in SAMPHubServer failed: {exc}\",\n                              SAMPWarning)\n            else:\n                if read_ready:\n                    self._server.handle_request()\n\n            if self._web_profile:\n\n                # We now check if there are any connection requests from the\n                # web profile, and if so, we initialize the pop-up.\n                if self._web_profile_dialog is None:\n                    try:\n                        request = self._web_profile_requests_queue.get_nowait()\n                    except queue.Empty:\n                        pass\n                    else:\n                        web_profile_text_dialog(request, self._web_profile_requests_result)\n\n                # We now check for requests over the web profile socket, and we\n                # also update the pop-up in case there are any changes.\n                try:\n                    read_ready = select.select([self._web_profile_server.socket], [], [], 0.01)[0]\n                except OSError as exc:\n                    warnings.warn(f\"Call to select() in SAMPHubServer failed: {exc}\",\n                                  SAMPWarning)\n                else:\n                    if read_ready:\n                        self._web_profile_server.handle_request()\n\n        self._server.server_close()\n        if self._web_profile_server is not None:\n            self._web_profile_server.server_close()\n\n    def _notify_shutdown(self):\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.event.shutdown\")\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                for key in self._mtype2ids[mtype]:\n                    self._notify_(self._hub_private_key,\n                                  self._private_keys[key][0],\n                                  {\"samp.mtype\": \"samp.hub.event.shutdown\",\n                                   \"samp.params\": {}})\n\n    def _notify_register(self, private_key):\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.event.register\")\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                public_id = self._private_keys[private_key][0]\n                for key in self._mtype2ids[mtype]:\n                    # if key != private_key:\n                    self._notify(self._hub_private_key,\n                                 self._private_keys[key][0],\n                                 {\"samp.mtype\": \"samp.hub.event.register\",\n                                  \"samp.params\": {\"id\": public_id}})\n\n    def _notify_unregister(self, private_key):\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.event.unregister\")\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                public_id = self._private_keys[private_key][0]\n                for key in self._mtype2ids[mtype]:\n                    if key != private_key:\n                        self._notify(self._hub_private_key,\n                                     self._private_keys[key][0],\n                                     {\"samp.mtype\": \"samp.hub.event.unregister\",\n                                      \"samp.params\": {\"id\": public_id}})\n\n    def _notify_metadata(self, private_key):\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.event.metadata\")\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                public_id = self._private_keys[private_key][0]\n                for key in self._mtype2ids[mtype]:\n                    # if key != private_key:\n                    self._notify(self._hub_private_key,\n                                 self._private_keys[key][0],\n                                 {\"samp.mtype\": \"samp.hub.event.metadata\",\n                                  \"samp.params\": {\"id\": public_id,\n                                                  \"metadata\": self._metadata[private_key]}\n                                  })\n\n    def _notify_subscriptions(self, private_key):\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.event.subscriptions\")\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                public_id = self._private_keys[private_key][0]\n                for key in self._mtype2ids[mtype]:\n                    self._notify(self._hub_private_key,\n                                 self._private_keys[key][0],\n                                 {\"samp.mtype\": \"samp.hub.event.subscriptions\",\n                                  \"samp.params\": {\"id\": public_id,\n                                                  \"subscriptions\": self._id2mtypes[private_key]}\n                                  })\n\n    def _notify_disconnection(self, private_key):\n\n        def _xmlrpc_call_disconnect(endpoint, private_key, hub_public_id, message):\n            endpoint.samp.client.receiveNotification(private_key, hub_public_id, message)\n\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.disconnect\")\n        public_id = self._private_keys[private_key][0]\n        endpoint = self._xmlrpc_endpoints[public_id][1]\n\n        for mtype in msubs:\n            if mtype in self._mtype2ids and private_key in self._mtype2ids[mtype]:\n                log.debug(f\"notify disconnection to {public_id}\")\n                self._launch_thread(target=_xmlrpc_call_disconnect,\n                                   args=(endpoint, private_key,\n                                         self._hub_public_id,\n                                         {\"samp.mtype\": \"samp.hub.disconnect\",\n                                          \"samp.params\": {\"reason\": \"Timeout expired!\"}}))\n\n    def _ping(self):\n        self._update_last_activity_time()\n        log.debug(\"ping\")\n        return \"1\"\n\n    def _query_by_metadata(self, key, value):\n        public_id_list = []\n        for private_id in self._metadata:\n            if key in self._metadata[private_id]:\n                if self._metadata[private_id][key] == value:\n                    public_id_list.append(self._private_keys[private_id][0])\n\n        return public_id_list\n\n    def _set_xmlrpc_callback(self, private_key, xmlrpc_addr):\n        self._update_last_activity_time(private_key)\n        if private_key in self._private_keys:\n            if private_key == self._hub_private_key:\n                public_id = self._private_keys[private_key][0]\n                self._xmlrpc_endpoints[public_id] = \\\n                    (xmlrpc_addr, _HubAsClient(self._hub_as_client_request_handler))\n                return \"\"\n\n            # Dictionary stored with the public id\n\n            log.debug(f\"set_xmlrpc_callback: {private_key} {xmlrpc_addr}\")\n\n            server_proxy_pool = None\n\n            server_proxy_pool = ServerProxyPool(self._pool_size,\n                                                xmlrpc.ServerProxy,\n                                                xmlrpc_addr, allow_none=1)\n\n            public_id = self._private_keys[private_key][0]\n            self._xmlrpc_endpoints[public_id] = (xmlrpc_addr,\n                                                server_proxy_pool)\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n        return \"\"\n\n    def _perform_standard_register(self):\n\n        with self._thread_lock:\n            private_key, public_id = self._get_new_ids()\n        self._private_keys[private_key] = (public_id, time.time())\n        self._update_last_activity_time(private_key)\n        self._notify_register(private_key)\n        log.debug(f\"register: private-key = {private_key} and self-id = {public_id}\")\n        return {\"samp.self-id\": public_id,\n                \"samp.private-key\": private_key,\n                \"samp.hub-id\": self._hub_public_id}\n\n    def _register(self, secret):\n        self._update_last_activity_time()\n        if secret == self._hub_secret:\n            return self._perform_standard_register()\n        else:\n            # return {\"samp.self-id\": \"\", \"samp.private-key\": \"\", \"samp.hub-id\": \"\"}\n            raise SAMPProxyError(7, \"Bad secret code\")\n\n    def _get_new_ids(self):\n        private_key = str(uuid.uuid1())\n        self._client_id_counter += 1\n        public_id = 'cli#hub'\n        if self._client_id_counter > 0:\n            public_id = f\"cli#{self._client_id_counter}\"\n\n        return private_key, public_id\n\n    def _unregister(self, private_key):\n\n        self._update_last_activity_time()\n\n        public_key = \"\"\n\n        self._notify_unregister(private_key)\n\n        with self._thread_lock:\n\n            if private_key in self._private_keys:\n                public_key = self._private_keys[private_key][0]\n                del self._private_keys[private_key]\n            else:\n                return \"\"\n\n            if private_key in self._metadata:\n                del self._metadata[private_key]\n\n            if private_key in self._id2mtypes:\n                del self._id2mtypes[private_key]\n\n            for mtype in self._mtype2ids.keys():\n                if private_key in self._mtype2ids[mtype]:\n                    self._mtype2ids[mtype].remove(private_key)\n\n            if public_key in self._xmlrpc_endpoints:\n                del self._xmlrpc_endpoints[public_key]\n\n            if private_key in self._client_activity_time:\n                del self._client_activity_time[private_key]\n\n            if self._web_profile:\n                if private_key in self._web_profile_callbacks:\n                    del self._web_profile_callbacks[private_key]\n                self._web_profile_server.remove_client(private_key)\n\n        log.debug(f\"unregister {public_key} ({private_key})\")\n\n        return \"\"\n\n    def _declare_metadata(self, private_key, metadata):\n        self._update_last_activity_time(private_key)\n        if private_key in self._private_keys:\n            log.debug(\"declare_metadata: private-key = {} metadata = {}\"\n                      .format(private_key, str(metadata)))\n            self._metadata[private_key] = metadata\n            self._notify_metadata(private_key)\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n        return \"\"\n\n    def _get_metadata(self, private_key, client_id):\n        self._update_last_activity_time(private_key)\n        if private_key in self._private_keys:\n            client_private_key = self._public_id_to_private_key(client_id)\n            log.debug(\"get_metadata: private-key = {} client-id = {}\"\n                      .format(private_key, client_id))\n            if client_private_key is not None:\n                if client_private_key in self._metadata:\n                    log.debug(f\"--> metadata = {self._metadata[client_private_key]}\")\n                    return self._metadata[client_private_key]\n                else:\n                    return {}\n            else:\n                raise SAMPProxyError(6, \"Invalid client ID\")\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    def _declare_subscriptions(self, private_key, mtypes):\n\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n\n            log.debug(\"declare_subscriptions: private-key = {} mtypes = {}\"\n                      .format(private_key, str(mtypes)))\n\n            # remove subscription to previous mtypes\n            if private_key in self._id2mtypes:\n\n                prev_mtypes = self._id2mtypes[private_key]\n\n                for mtype in prev_mtypes:\n                    try:\n                        self._mtype2ids[mtype].remove(private_key)\n                    except ValueError:  # private_key is not in list\n                        pass\n\n            self._id2mtypes[private_key] = copy.deepcopy(mtypes)\n\n            # remove duplicated MType for wildcard overwriting\n            original_mtypes = copy.deepcopy(mtypes)\n\n            for mtype in original_mtypes:\n                if mtype.endswith(\"*\"):\n                    for mtype2 in original_mtypes:\n                        if mtype2.startswith(mtype[:-1]) and \\\n                           mtype2 != mtype:\n                            if mtype2 in mtypes:\n                                del(mtypes[mtype2])\n\n            log.debug(\"declare_subscriptions: subscriptions accepted from \"\n                      \"{} => {}\".format(private_key, str(mtypes)))\n\n            for mtype in mtypes:\n\n                if mtype in self._mtype2ids:\n                    if private_key not in self._mtype2ids[mtype]:\n                        self._mtype2ids[mtype].append(private_key)\n                else:\n                    self._mtype2ids[mtype] = [private_key]\n\n            self._notify_subscriptions(private_key)\n\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n        return \"\"\n\n    def _get_subscriptions(self, private_key, client_id):\n\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            client_private_key = self._public_id_to_private_key(client_id)\n            if client_private_key is not None:\n                if client_private_key in self._id2mtypes:\n                    log.debug(\"get_subscriptions: client-id = {} mtypes = {}\"\n                              .format(client_id,\n                                      str(self._id2mtypes[client_private_key])))\n                    return self._id2mtypes[client_private_key]\n                else:\n                    log.debug(\"get_subscriptions: client-id = {} mtypes = \"\n                              \"missing\".format(client_id))\n                    return {}\n            else:\n                raise SAMPProxyError(6, \"Invalid client ID\")\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    def _get_registered_clients(self, private_key):\n\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            reg_clients = []\n            for pkey in self._private_keys.keys():\n                if pkey != private_key:\n                    reg_clients.append(self._private_keys[pkey][0])\n            log.debug(\"get_registered_clients: private_key = {} clients = {}\"\n                      .format(private_key, reg_clients))\n            return reg_clients\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    def _get_subscribed_clients(self, private_key, mtype):\n\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            sub_clients = {}\n\n            for pkey in self._private_keys.keys():\n                if pkey != private_key and self._is_subscribed(pkey, mtype):\n                    sub_clients[self._private_keys[pkey][0]] = {}\n\n            log.debug(\"get_subscribed_clients: private_key = {} mtype = {} \"\n                      \"clients = {}\".format(private_key, mtype, sub_clients))\n            return sub_clients\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    @staticmethod\n    def get_mtype_subtypes(mtype):\n        \"\"\"\n        Return a list containing all the possible wildcarded subtypes of MType.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be parsed.\n\n        Returns\n        -------\n        types : list\n            List of subtypes\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPHubServer\n        >>> SAMPHubServer.get_mtype_subtypes(\"samp.app.ping\")\n        ['samp.app.ping', 'samp.app.*', 'samp.*', '*']\n        \"\"\"\n\n        subtypes = []\n\n        msubs = mtype.split(\".\")\n        indexes = list(range(len(msubs)))\n        indexes.reverse()\n        indexes.append(-1)\n\n        for i in indexes:\n            tmp_mtype = \".\".join(msubs[:i + 1])\n            if tmp_mtype != mtype:\n                if tmp_mtype != \"\":\n                    tmp_mtype = tmp_mtype + \".*\"\n                else:\n                    tmp_mtype = \"*\"\n            subtypes.append(tmp_mtype)\n\n        return subtypes\n\n    def _is_subscribed(self, private_key, mtype):\n\n        subscribed = False\n\n        msubs = SAMPHubServer.get_mtype_subtypes(mtype)\n\n        for msub in msubs:\n            if msub in self._mtype2ids:\n                if private_key in self._mtype2ids[msub]:\n                    subscribed = True\n\n        return subscribed\n\n    def _notify(self, private_key, recipient_id, message):\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            if self._is_subscribed(self._public_id_to_private_key(recipient_id),\n                                   message[\"samp.mtype\"]) is False:\n                raise SAMPProxyError(2, \"Client {} not subscribed to MType {}\"\n                                    .format(recipient_id, message[\"samp.mtype\"]))\n\n            self._launch_thread(target=self._notify_, args=(private_key,\n                                                            recipient_id,\n                                                            message))\n            return {}\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    def _notify_(self, sender_private_key, recipient_public_id, message):\n\n        if sender_private_key not in self._private_keys:\n            return\n\n        sender_public_id = self._private_keys[sender_private_key][0]\n\n        try:\n\n            log.debug(\"notify {} from {} to {}\".format(\n                    message[\"samp.mtype\"], sender_public_id,\n                    recipient_public_id))\n\n            recipient_private_key = self._public_id_to_private_key(recipient_public_id)\n            arg_params = (sender_public_id, message)\n            samp_method_name = \"receiveNotification\"\n\n            self._retry_method(recipient_private_key, recipient_public_id, samp_method_name, arg_params)\n\n        except Exception as exc:\n            warnings.warn(\"{} notification from client {} to client {} \"\n                          \"failed [{}]\".format(message[\"samp.mtype\"],\n                                               sender_public_id,\n                                               recipient_public_id, exc),\n                          SAMPWarning)\n\n    def _notify_all(self, private_key, message):\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            if \"samp.mtype\" not in message:\n                raise SAMPProxyError(3, \"samp.mtype keyword is missing\")\n            recipient_ids = self._notify_all_(private_key, message)\n            return recipient_ids\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    def _notify_all_(self, sender_private_key, message):\n\n        recipient_ids = []\n        msubs = SAMPHubServer.get_mtype_subtypes(message[\"samp.mtype\"])\n\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                for key in self._mtype2ids[mtype]:\n                    if key != sender_private_key:\n                        _recipient_id = self._private_keys[key][0]\n                        recipient_ids.append(_recipient_id)\n                        self._launch_thread(target=self._notify,\n                                         args=(sender_private_key,\n                                               _recipient_id, message)\n                                         )\n\n        return recipient_ids\n\n    def _call(self, private_key, recipient_id, msg_tag, message):\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            if self._is_subscribed(self._public_id_to_private_key(recipient_id),\n                                   message[\"samp.mtype\"]) is False:\n                raise SAMPProxyError(2, \"Client {} not subscribed to MType {}\"\n                                     .format(recipient_id, message[\"samp.mtype\"]))\n            public_id = self._private_keys[private_key][0]\n            msg_id = self._get_new_hub_msg_id(public_id, msg_tag)\n            self._launch_thread(target=self._call_, args=(private_key, public_id,\n                                                          recipient_id, msg_id,\n                                                          message))\n            return msg_id\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    def _call_(self, sender_private_key, sender_public_id,\n               recipient_public_id, msg_id, message):\n\n        if sender_private_key not in self._private_keys:\n            return\n\n        try:\n\n            log.debug(\"call {} from {} to {} ({})\".format(\n                    msg_id.split(\";;\")[0], sender_public_id,\n                    recipient_public_id, message[\"samp.mtype\"]))\n\n            recipient_private_key = self._public_id_to_private_key(recipient_public_id)\n            arg_params = (sender_public_id, msg_id, message)\n            samp_methodName = \"receiveCall\"\n\n            self._retry_method(recipient_private_key, recipient_public_id, samp_methodName, arg_params)\n\n        except Exception as exc:\n            warnings.warn(\"{} call {} from client {} to client {} failed \"\n                          \"[{},{}]\".format(message[\"samp.mtype\"],\n                                           msg_id.split(\";;\")[0],\n                                           sender_public_id,\n                                           recipient_public_id, type(exc), exc),\n                          SAMPWarning)\n\n    def _call_all(self, private_key, msg_tag, message):\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            if \"samp.mtype\" not in message:\n                raise SAMPProxyError(3, \"samp.mtype keyword is missing in \"\n                                        \"message tagged as {}\".format(msg_tag))\n\n            public_id = self._private_keys[private_key][0]\n            msg_id = self._call_all_(private_key, public_id, msg_tag, message)\n            return msg_id\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    def _call_all_(self, sender_private_key, sender_public_id, msg_tag,\n                   message):\n\n        msg_id = {}\n        msubs = SAMPHubServer.get_mtype_subtypes(message[\"samp.mtype\"])\n\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                for key in self._mtype2ids[mtype]:\n                    if key != sender_private_key:\n                        _msg_id = self._get_new_hub_msg_id(sender_public_id,\n                                                           msg_tag)\n                        receiver_public_id = self._private_keys[key][0]\n                        msg_id[receiver_public_id] = _msg_id\n                        self._launch_thread(target=self._call_,\n                                            args=(sender_private_key,\n                                                  sender_public_id,\n                                                  receiver_public_id, _msg_id,\n                                                  message))\n        return msg_id\n\n    def _call_and_wait(self, private_key, recipient_id, message, timeout):\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            timeout = int(timeout)\n\n            now = time.time()\n            response = {}\n\n            msg_id = self._call(private_key, recipient_id, \"samp::sync::call\",\n                                message)\n            self._sync_msg_ids_heap[msg_id] = None\n\n            while self._is_running:\n                if 0 < timeout <= time.time() - now:\n                    del(self._sync_msg_ids_heap[msg_id])\n                    raise SAMPProxyError(1, \"Timeout expired!\")\n\n                if self._sync_msg_ids_heap[msg_id] is not None:\n                    response = copy.deepcopy(self._sync_msg_ids_heap[msg_id])\n                    del(self._sync_msg_ids_heap[msg_id])\n                    break\n                time.sleep(0.01)\n\n            return response\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n    def _reply(self, private_key, msg_id, response):\n        \"\"\"\n        The main method that gets called for replying. This starts up an\n        asynchronous reply thread and returns.\n        \"\"\"\n        self._update_last_activity_time(private_key)\n        if private_key in self._private_keys:\n            self._launch_thread(target=self._reply_, args=(private_key, msg_id,\n                                                           response))\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n        return {}\n\n    def _reply_(self, responder_private_key, msg_id, response):\n\n        if responder_private_key not in self._private_keys or not msg_id:\n            return\n\n        responder_public_id = self._private_keys[responder_private_key][0]\n        counter, hub_public_id, recipient_public_id, recipient_msg_tag = msg_id.split(\";;\", 3)\n\n        try:\n\n            log.debug(\"reply {} from {} to {}\".format(\n                    counter, responder_public_id, recipient_public_id))\n\n            if recipient_msg_tag == \"samp::sync::call\":\n\n                if msg_id in self._sync_msg_ids_heap.keys():\n                    self._sync_msg_ids_heap[msg_id] = response\n\n            else:\n\n                recipient_private_key = self._public_id_to_private_key(recipient_public_id)\n                arg_params = (responder_public_id, recipient_msg_tag, response)\n                samp_method_name = \"receiveResponse\"\n\n                self._retry_method(recipient_private_key, recipient_public_id, samp_method_name, arg_params)\n\n        except Exception as exc:\n            warnings.warn(\"{} reply from client {} to client {} failed [{}]\"\n                          .format(recipient_msg_tag, responder_public_id,\n                                  recipient_public_id, exc),\n                          SAMPWarning)\n\n    def _retry_method(self, recipient_private_key, recipient_public_id, samp_method_name, arg_params):\n        \"\"\"\n        This method is used to retry a SAMP call several times.\n\n        Parameters\n        ----------\n        recipient_private_key\n            The private key of the receiver of the call\n        recipient_public_key\n            The public key of the receiver of the call\n        samp_method_name : str\n            The name of the SAMP method to call\n        arg_params : tuple\n            Any additional arguments to be passed to the SAMP method\n        \"\"\"\n\n        if recipient_private_key is None:\n            raise SAMPHubError(\"Invalid client ID\")\n\n        from . import conf\n\n        for attempt in range(conf.n_retries):\n\n            if not self._is_running:\n                time.sleep(0.01)\n                continue\n\n            try:\n\n                if (self._web_profile and\n                    recipient_private_key in self._web_profile_callbacks):\n\n                    # Web Profile\n                    callback = {\"samp.methodName\": samp_method_name,\n                                \"samp.params\": arg_params}\n                    self._web_profile_callbacks[recipient_private_key].put(callback)\n\n                else:\n\n                    # Standard Profile\n                    hub = self._xmlrpc_endpoints[recipient_public_id][1]\n                    getattr(hub.samp.client, samp_method_name)(recipient_private_key, *arg_params)\n\n            except xmlrpc.Fault as exc:\n                log.debug(\"{} XML-RPC endpoint error (attempt {}): {}\"\n                          .format(recipient_public_id, attempt + 1,\n                                  exc.faultString))\n                time.sleep(0.01)\n            else:\n                return\n\n        # If we are here, then the above attempts failed\n        error_message = samp_method_name + \" failed after \" + str(conf.n_retries) + \" attempts\"\n        raise SAMPHubError(error_message)\n\n    def _public_id_to_private_key(self, public_id):\n\n        for private_key in self._private_keys.keys():\n            if self._private_keys[private_key][0] == public_id:\n                return private_key\n        return None\n\n    def _get_new_hub_msg_id(self, sender_public_id, sender_msg_id):\n        with self._thread_lock:\n            self._hub_msg_id_counter += 1\n        return \"msg#{};;{};;{};;{}\".format(self._hub_msg_id_counter,\n                                           self._hub_public_id,\n                                           sender_public_id, sender_msg_id)\n\n    def _update_last_activity_time(self, private_key=None):\n        with self._thread_lock:\n            self._last_activity_time = time.time()\n            if private_key is not None:\n                self._client_activity_time[private_key] = time.time()\n\n    def _receive_notification(self, private_key, sender_id, message):\n        return \"\"\n\n    def _receive_call(self, private_key, sender_id, msg_id, message):\n        if private_key == self._hub_private_key:\n\n            if \"samp.mtype\" in message and message[\"samp.mtype\"] == \"samp.app.ping\":\n                self._reply(self._hub_private_key, msg_id,\n                            {\"samp.status\": SAMP_STATUS_OK, \"samp.result\": {}})\n\n            elif (\"samp.mtype\" in message and\n                 (message[\"samp.mtype\"] == \"x-samp.query.by-meta\" or\n                  message[\"samp.mtype\"] == \"samp.query.by-meta\")):\n\n                ids_list = self._query_by_metadata(message[\"samp.params\"][\"key\"],\n                                                   message[\"samp.params\"][\"value\"])\n                self._reply(self._hub_private_key, msg_id,\n                            {\"samp.status\": SAMP_STATUS_OK,\n                             \"samp.result\": {\"ids\": ids_list}})\n\n            return \"\"\n        else:\n            return \"\"\n\n    def _receive_response(self, private_key, responder_id, msg_tag, response):\n        return \"\"\n\n    def _web_profile_register(self, identity_info,\n                              client_address=(\"unknown\", 0),\n                              origin=\"unknown\"):\n\n        self._update_last_activity_time()\n\n        if not client_address[0] in [\"localhost\", \"127.0.0.1\"]:\n            raise SAMPProxyError(403, \"Request of registration rejected \"\n                                      \"by the Hub.\")\n\n        if not origin:\n            origin = \"unknown\"\n\n        if isinstance(identity_info, dict):\n            # an old version of the protocol provided just a string with the app name\n            if \"samp.name\" not in identity_info:\n                raise SAMPProxyError(403, \"Request of registration rejected \"\n                                          \"by the Hub (application name not \"\n                                          \"provided).\")\n\n        # Red semaphore for the other threads\n        self._web_profile_requests_semaphore.put(\"wait\")\n        # Set the request to be displayed for the current thread\n        self._web_profile_requests_queue.put((identity_info, client_address,\n                                              origin))\n        # Get the popup dialogue response\n        response = self._web_profile_requests_result.get()\n        # OK, semaphore green\n        self._web_profile_requests_semaphore.get()\n\n        if response:\n            register_map = self._perform_standard_register()\n            translator_url = (\"http://localhost:{}/translator/{}?ref=\"\n                              .format(self._web_port, register_map[\"samp.private-key\"]))\n            register_map[\"samp.url-translator\"] = translator_url\n            self._web_profile_server.add_client(register_map[\"samp.private-key\"])\n            return register_map\n        else:\n            raise SAMPProxyError(403, \"Request of registration rejected by \"\n                                      \"the user.\")\n\n    def _web_profile_allowReverseCallbacks(self, private_key, allow):\n        self._update_last_activity_time()\n        if private_key in self._private_keys:\n            if allow == \"0\":\n                if private_key in self._web_profile_callbacks:\n                    del self._web_profile_callbacks[private_key]\n            else:\n                self._web_profile_callbacks[private_key] = queue.Queue()\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n        return \"\"\n\n    def _web_profile_pullCallbacks(self, private_key, timeout_secs):\n        self._update_last_activity_time()\n        if private_key in self._private_keys:\n            callback = []\n            callback_queue = self._web_profile_callbacks[private_key]\n            try:\n                while self._is_running:\n                    item_queued = callback_queue.get_nowait()\n                    callback.append(item_queued)\n            except queue.Empty:\n                pass\n            return callback\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":8002,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":8003,"name":"CROSS_DOMAIN","nodeType":"Attribute","startLoc":14,"text":"CROSS_DOMAIN"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":8004,"name":"CLIENT_ACCESS_POLICY","nodeType":"Attribute","startLoc":15,"text":"CLIENT_ACCESS_POLICY"},{"col":0,"comment":"","endLoc":4,"header":"web_profile.py#<anonymous>","id":8005,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = []\n\nCROSS_DOMAIN = get_pkg_data_contents('data/crossdomain.xml')\n\nCLIENT_ACCESS_POLICY = get_pkg_data_contents('data/clientaccesspolicy.xml')"},{"fileName":"__init__.py","filePath":"astropy/samp","id":8006,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis subpackage provides classes to communicate with other applications via the\n`Simple Application Messaging Protocol (SAMP)\n<http://www.ivoa.net/documents/SAMP/>`_.\n\nBefore integration into Astropy it was known as\n`SAMPy <https://pypi.org/project/sampy/>`_, and was developed by Luigi Paioro\n(INAF - Istituto Nazionale di Astrofisica).\n\"\"\"\n\nfrom .constants import *\nfrom .errors import *\nfrom .utils import *\nfrom .hub import *\nfrom .client import *\nfrom .integrated_client import *\nfrom .hub_proxy import *\n\n\nfrom astropy import config as _config\n\n\nclass Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.samp`.\n    \"\"\"\n\n    use_internet = _config.ConfigItem(\n        True,\n        \"Whether to allow `astropy.samp` to use \"\n        \"the internet, if available.\",\n        aliases=['astropy.samp.utils.use_internet'])\n\n    n_retries = _config.ConfigItem(10,\n        \"How many times to retry communications when they fail\")\n\n\nconf = Conf()\n"},{"col":4,"comment":"\n        Whether the client is currently running.\n        ","endLoc":164,"header":"@property\n    def is_running(self)","id":8007,"name":"is_running","nodeType":"Function","startLoc":159,"text":"@property\n    def is_running(self):\n        \"\"\"\n        Whether the client is currently running.\n        \"\"\"\n        return self._is_running"},{"col":4,"comment":"\n        Whether the client is currently registered.\n        ","endLoc":171,"header":"@property\n    def is_registered(self)","id":8008,"name":"is_registered","nodeType":"Function","startLoc":166,"text":"@property\n    def is_registered(self):\n        \"\"\"\n        Whether the client is currently registered.\n        \"\"\"\n        return self._is_registered"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.samp`.\n    ","endLoc":36,"id":8009,"nodeType":"Class","startLoc":24,"text":"class Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.samp`.\n    \"\"\"\n\n    use_internet = _config.ConfigItem(\n        True,\n        \"Whether to allow `astropy.samp` to use \"\n        \"the internet, if available.\",\n        aliases=['astropy.samp.utils.use_internet'])\n\n    n_retries = _config.ConfigItem(10,\n        \"How many times to retry communications when they fail\")"},{"col":4,"comment":"null","endLoc":188,"header":"def _serve_forever(self)","id":8010,"name":"_serve_forever","nodeType":"Function","startLoc":177,"text":"def _serve_forever(self):\n        while self._is_running:\n            try:\n                read_ready = select.select([self.client.socket], [], [], 0.1)[0]\n            except OSError as exc:\n                warnings.warn(f\"Call to select in SAMPClient failed: {exc}\",\n                              SAMPWarning)\n            else:\n                if read_ready:\n                    self.client.handle_request()\n\n        self.client.server_close()"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":29,"id":8011,"name":"use_internet","nodeType":"Attribute","startLoc":29,"text":"use_internet"},{"col":4,"comment":"null","endLoc":184,"header":"def __init__(self, secret=None, addr=None, port=0, lockfile=None,\n                 timeout=0, client_timeout=0, mode='single', label=\"\",\n                 web_profile=True, web_profile_dialog=None, web_port=21012,\n                 pool_size=20)","id":8012,"name":"__init__","nodeType":"Function","startLoc":98,"text":"def __init__(self, secret=None, addr=None, port=0, lockfile=None,\n                 timeout=0, client_timeout=0, mode='single', label=\"\",\n                 web_profile=True, web_profile_dialog=None, web_port=21012,\n                 pool_size=20):\n\n        # Generate random ID for the hub\n        self._id = str(uuid.uuid1())\n\n        # General settings\n        self._is_running = False\n        self._customlockfilename = lockfile\n        self._lockfile = None\n        self._addr = addr\n        self._port = port\n        self._mode = mode\n        self._label = label\n        self._timeout = timeout\n        self._client_timeout = client_timeout\n        self._pool_size = pool_size\n\n        # Web profile specific attributes\n        self._web_profile = web_profile\n        self._web_profile_dialog = web_profile_dialog\n        self._web_port = web_port\n\n        self._web_profile_server = None\n        self._web_profile_callbacks = {}\n        self._web_profile_requests_queue = None\n        self._web_profile_requests_result = None\n        self._web_profile_requests_semaphore = None\n\n        self._host_name = \"127.0.0.1\"\n        if internet_on():\n            try:\n                self._host_name = socket.getfqdn()\n                socket.getaddrinfo(self._addr or self._host_name,\n                                   self._port or 0)\n            except socket.error:\n                self._host_name = \"127.0.0.1\"\n\n        # Threading stuff\n        self._thread_lock = threading.Lock()\n        self._thread_run = None\n        self._thread_hub_timeout = None\n        self._thread_client_timeout = None\n\n        self._launched_threads = []\n\n        # Variables for timeout testing:\n        self._last_activity_time = None\n        self._client_activity_time = {}\n\n        # Hub message id counter, used to create hub msg ids\n        self._hub_msg_id_counter = 0\n\n        # Hub secret code\n        self._hub_secret_code_customized = secret\n        self._hub_secret = self._create_secret_code()\n\n        # Hub public id (as SAMP client)\n        self._hub_public_id = \"\"\n\n        # Client ids\n        # {private_key: (public_id, timestamp)}\n        self._private_keys = {}\n\n        # Metadata per client\n        # {private_key: metadata}\n        self._metadata = {}\n\n        # List of subscribed clients per MType\n        # {mtype: private_key list}\n        self._mtype2ids = {}\n\n        # List of subscribed MTypes per client\n        # {private_key: mtype list}\n        self._id2mtypes = {}\n\n        # List of XML-RPC addresses per client\n        # {public_id: (XML-RPC address, ServerProxyPool instance)}\n        self._xmlrpc_endpoints = {}\n\n        # Synchronous message id heap\n        self._sync_msg_ids_heap = {}\n\n        # Public ids counter\n        self._client_id_counter = -1"},{"col":4,"comment":"null","endLoc":195,"header":"def _ping(self, private_key, sender_id, msg_id, msg_mtype, msg_params,\n              message)","id":8013,"name":"_ping","nodeType":"Function","startLoc":190,"text":"def _ping(self, private_key, sender_id, msg_id, msg_mtype, msg_params,\n              message):\n\n        reply = {\"samp.status\": SAMP_STATUS_OK, \"samp.result\": {}}\n\n        self.hub.reply(private_key, msg_id, reply)"},{"attributeType":"SAMPIntegratedClient | SAMPClient","col":8,"comment":"null","endLoc":111,"id":8014,"name":"cli","nodeType":"Attribute","startLoc":111,"text":"self.cli"},{"className":"_HubAsClientMethod","col":0,"comment":"null","endLoc":160,"id":8015,"nodeType":"Class","startLoc":150,"text":"class _HubAsClientMethod:\n\n    def __init__(self, send, name):\n        self.__send = send\n        self.__name = name\n\n    def __getattr__(self, name):\n        return _HubAsClientMethod(self.__send, f\"{self.__name}.{name}\")\n\n    def __call__(self, *args):\n        return self.__send(self.__name, args)"},{"col":4,"comment":"null","endLoc":157,"header":"def __getattr__(self, name)","id":8016,"name":"__getattr__","nodeType":"Function","startLoc":156,"text":"def __getattr__(self, name):\n        return _HubAsClientMethod(self.__send, f\"{self.__name}.{name}\")"},{"col":4,"comment":"null","endLoc":209,"header":"def _client_env_get(self, private_key, sender_id, msg_id, msg_mtype,\n                        msg_params, message)","id":8017,"name":"_client_env_get","nodeType":"Function","startLoc":197,"text":"def _client_env_get(self, private_key, sender_id, msg_id, msg_mtype,\n                        msg_params, message):\n\n        if msg_params[\"name\"] in os.environ:\n            reply = {\"samp.status\": SAMP_STATUS_OK,\n                     \"samp.result\": {\"value\": os.environ[msg_params[\"name\"]]}}\n        else:\n            reply = {\"samp.status\": SAMP_STATUS_WARNING,\n                     \"samp.result\": {\"value\": \"\"},\n                     \"samp.error\": {\"samp.errortxt\":\n                                    \"Environment variable not defined.\"}}\n\n        self.hub.reply(private_key, msg_id, reply)"},{"col":0,"comment":"\n    Get either the hub given by the environment variable SAMP_HUB, or the one\n    given by the lockfile .samp in the user home directory.\n    ","endLoc":141,"header":"def get_main_running_hub()","id":8018,"name":"get_main_running_hub","nodeType":"Function","startLoc":121,"text":"def get_main_running_hub():\n    \"\"\"\n    Get either the hub given by the environment variable SAMP_HUB, or the one\n    given by the lockfile .samp in the user home directory.\n    \"\"\"\n    hubs = get_running_hubs()\n\n    if not hubs:\n        raise SAMPHubError(\"Unable to find a running SAMP Hub.\")\n\n    # CHECK FOR SAMP_HUB ENVIRONMENT VARIABLE\n    if \"SAMP_HUB\" in os.environ:\n        # For the time being I assume just the std profile supported.\n        if os.environ[\"SAMP_HUB\"].startswith(\"std-lockurl:\"):\n            lockfilename = os.environ[\"SAMP_HUB\"][len(\"std-lockurl:\"):]\n        else:\n            raise SAMPHubError(\"SAMP Hub profile not supported.\")\n    else:\n        lockfilename = os.path.join(_find_home(), \".samp\")\n\n    return hubs[lockfilename]"},{"col":4,"comment":"null","endLoc":231,"header":"def _handle_notification(self, private_key, sender_id, message)","id":8019,"name":"_handle_notification","nodeType":"Function","startLoc":211,"text":"def _handle_notification(self, private_key, sender_id, message):\n\n        if private_key == self.get_private_key() and \"samp.mtype\" in message:\n\n            msg_mtype = message[\"samp.mtype\"]\n            del message[\"samp.mtype\"]\n            msg_params = message[\"samp.params\"]\n            del message[\"samp.params\"]\n\n            msubs = SAMPHubServer.get_mtype_subtypes(msg_mtype)\n            for mtype in msubs:\n                if mtype in self._notification_bindings:\n                    bound_func = self._notification_bindings[mtype][0]\n                    if get_num_args(bound_func) == 5:\n                        bound_func(private_key, sender_id, msg_mtype,\n                                   msg_params, message)\n                    else:\n                        bound_func(private_key, sender_id, None, msg_mtype,\n                                   msg_params, message)\n\n        return \"\""},{"col":0,"comment":"\n    Return a dictionary containing the lock-file contents of all the currently\n    running hubs (single and/or multiple mode).\n\n    The dictionary format is:\n\n    ``{<lock-file>: {<token-name>: <token-string>, ...}, ...}``\n\n    where ``{<lock-file>}`` is the lock-file name, ``{<token-name>}`` and\n    ``{<token-string>}`` are the lock-file tokens (name and content).\n\n    Returns\n    -------\n    running_hubs : dict\n        Lock-file contents of all the currently running hubs.\n    ","endLoc":194,"header":"def get_running_hubs()","id":8020,"name":"get_running_hubs","nodeType":"Function","startLoc":144,"text":"def get_running_hubs():\n    \"\"\"\n    Return a dictionary containing the lock-file contents of all the currently\n    running hubs (single and/or multiple mode).\n\n    The dictionary format is:\n\n    ``{<lock-file>: {<token-name>: <token-string>, ...}, ...}``\n\n    where ``{<lock-file>}`` is the lock-file name, ``{<token-name>}`` and\n    ``{<token-string>}`` are the lock-file tokens (name and content).\n\n    Returns\n    -------\n    running_hubs : dict\n        Lock-file contents of all the currently running hubs.\n    \"\"\"\n\n    hubs = {}\n    lockfilename = \"\"\n\n    # HUB SINGLE INSTANCE MODE\n\n    # CHECK FOR SAMP_HUB ENVIRONMENT VARIABLE\n    if \"SAMP_HUB\" in os.environ:\n        # For the time being I assume just the std profile supported.\n        if os.environ[\"SAMP_HUB\"].startswith(\"std-lockurl:\"):\n            lockfilename = os.environ[\"SAMP_HUB\"][len(\"std-lockurl:\"):]\n    else:\n        lockfilename = os.path.join(_find_home(), \".samp\")\n\n    hub_is_running, lockfiledict = check_running_hub(lockfilename)\n\n    if hub_is_running:\n        hubs[lockfilename] = lockfiledict\n\n    # HUB MULTIPLE INSTANCE MODE\n\n    lockfiledir = \"\"\n\n    lockfiledir = os.path.join(_find_home(), \".samp-1\")\n\n    if os.path.isdir(lockfiledir):\n        for filename in os.listdir(lockfiledir):\n            if filename.startswith('samp-hub'):\n                lockfilename = os.path.join(lockfiledir, filename)\n                hub_is_running, lockfiledict = check_running_hub(lockfilename)\n                if hub_is_running:\n                    hubs[lockfilename] = lockfiledict\n\n    return hubs"},{"col":4,"comment":"null","endLoc":160,"header":"def __call__(self, *args)","id":8021,"name":"__call__","nodeType":"Function","startLoc":159,"text":"def __call__(self, *args):\n        return self.__send(self.__name, args)"},{"attributeType":"null","col":8,"comment":"null","endLoc":154,"id":8022,"name":"__name","nodeType":"Attribute","startLoc":154,"text":"self.__name"},{"attributeType":"null","col":8,"comment":"null","endLoc":153,"id":8023,"name":"__send","nodeType":"Attribute","startLoc":153,"text":"self.__send"},{"attributeType":"null","col":24,"comment":"null","endLoc":11,"id":8024,"name":"xmlrpc","nodeType":"Attribute","startLoc":11,"text":"xmlrpc"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":8025,"name":"__all__","nodeType":"Attribute","startLoc":30,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":8026,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":32,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":4,"header":"utils.py#<anonymous>","id":8027,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nUtility functions and classes\n\"\"\"\n\n__all__ = [\"SAMPMsgReplierWrapper\"]\n\n__doctest_skip__ = ['.']"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":35,"id":8028,"name":"n_retries","nodeType":"Attribute","startLoc":35,"text":"n_retries"},{"col":4,"comment":"\n        Return a list containing all the possible wildcarded subtypes of MType.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be parsed.\n\n        Returns\n        -------\n        types : list\n            List of subtypes\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPHubServer\n        >>> SAMPHubServer.get_mtype_subtypes(\"samp.app.ping\")\n        ['samp.app.ping', 'samp.app.*', 'samp.*', '*']\n        ","endLoc":930,"header":"@staticmethod\n    def get_mtype_subtypes(mtype)","id":8029,"name":"get_mtype_subtypes","nodeType":"Function","startLoc":892,"text":"@staticmethod\n    def get_mtype_subtypes(mtype):\n        \"\"\"\n        Return a list containing all the possible wildcarded subtypes of MType.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be parsed.\n\n        Returns\n        -------\n        types : list\n            List of subtypes\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPHubServer\n        >>> SAMPHubServer.get_mtype_subtypes(\"samp.app.ping\")\n        ['samp.app.ping', 'samp.app.*', 'samp.*', '*']\n        \"\"\"\n\n        subtypes = []\n\n        msubs = mtype.split(\".\")\n        indexes = list(range(len(msubs)))\n        indexes.reverse()\n        indexes.append(-1)\n\n        for i in indexes:\n            tmp_mtype = \".\".join(msubs[:i + 1])\n            if tmp_mtype != mtype:\n                if tmp_mtype != \"\":\n                    tmp_mtype = tmp_mtype + \".*\"\n                else:\n                    tmp_mtype = \"*\"\n            subtypes.append(tmp_mtype)\n\n        return subtypes"},{"fileName":"client.py","filePath":"astropy/samp","id":8030,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport copy\nimport os\nimport select\nimport socket\nimport threading\nimport warnings\nfrom urllib.parse import urlunparse\n\nfrom .constants import SAMP_STATUS_OK, SAMP_STATUS_WARNING\nfrom .hub import SAMPHubServer\nfrom .errors import SAMPClientError, SAMPWarning\nfrom .utils import internet_on, get_num_args\n\nfrom .standard_profile import ThreadingXMLRPCServer\n\n\n__all__ = ['SAMPClient']\n\n\nclass SAMPClient:\n    \"\"\"\n    Utility class which provides facilities to create and manage a SAMP\n    compliant XML-RPC server that acts as SAMP callable client application.\n\n    Parameters\n    ----------\n    hub : :class:`~astropy.samp.SAMPHubProxy`\n        An instance of :class:`~astropy.samp.SAMPHubProxy` to be\n        used for messaging with the SAMP Hub.\n\n    name : str, optional\n        Client name (corresponding to ``samp.name`` metadata keyword).\n\n    description : str, optional\n        Client description (corresponding to ``samp.description.text`` metadata\n        keyword).\n\n    metadata : dict, optional\n        Client application metadata in the standard SAMP format.\n\n    addr : str, optional\n        Listening address (or IP). This defaults to 127.0.0.1 if the internet\n        is not reachable, otherwise it defaults to the host name.\n\n    port : int, optional\n        Listening XML-RPC server socket port. If left set to 0 (the default),\n        the operating system will select a free port.\n\n    callable : bool, optional\n        Whether the client can receive calls and notifications. If set to\n        `False`, then the client can send notifications and calls, but can not\n        receive any.\n    \"\"\"\n\n    # TODO: define what is meant by callable\n\n    def __init__(self, hub, name=None, description=None, metadata=None,\n                 addr=None, port=0, callable=True):\n\n        # GENERAL\n        self._is_running = False\n        self._is_registered = False\n\n        if metadata is None:\n            metadata = {}\n\n        if name is not None:\n            metadata[\"samp.name\"] = name\n\n        if description is not None:\n            metadata[\"samp.description.text\"] = description\n\n        self._metadata = metadata\n\n        self._addr = addr\n        self._port = port\n        self._xmlrpcAddr = None\n        self._callable = callable\n\n        # HUB INTERACTION\n        self.client = None\n        self._public_id = None\n        self._private_key = None\n        self._hub_id = None\n        self._notification_bindings = {}\n        self._call_bindings = {\"samp.app.ping\": [self._ping, {}],\n                               \"client.env.get\": [self._client_env_get, {}]}\n        self._response_bindings = {}\n\n        self._host_name = \"127.0.0.1\"\n        if internet_on():\n            try:\n                self._host_name = socket.getfqdn()\n                socket.getaddrinfo(self._addr or self._host_name, self._port or 0)\n            except socket.error:\n                self._host_name = \"127.0.0.1\"\n\n        self.hub = hub\n\n        if self._callable:\n\n            self._thread = threading.Thread(target=self._serve_forever)\n            self._thread.daemon = True\n\n            self.client = ThreadingXMLRPCServer((self._addr or self._host_name,\n                                                 self._port), logRequests=False, allow_none=True)\n\n            self.client.register_introspection_functions()\n            self.client.register_function(self.receive_notification, 'samp.client.receiveNotification')\n            self.client.register_function(self.receive_call, 'samp.client.receiveCall')\n            self.client.register_function(self.receive_response, 'samp.client.receiveResponse')\n\n            # If the port was set to zero, then the operating system has\n            # selected a free port. We now check what this port number is.\n            if self._port == 0:\n                self._port = self.client.socket.getsockname()[1]\n\n            protocol = 'http'\n\n            self._xmlrpcAddr = urlunparse((protocol,\n                                           '{}:{}'.format(self._addr or self._host_name,\n                                                            self._port),\n                                           '', '', '', ''))\n\n    def start(self):\n        \"\"\"\n        Start the client in a separate thread (non-blocking).\n\n        This only has an effect if ``callable`` was set to `True` when\n        initializing the client.\n        \"\"\"\n        if self._callable:\n            self._is_running = True\n            self._run_client()\n\n    def stop(self, timeout=10.):\n        \"\"\"\n        Stop the client.\n\n        Parameters\n        ----------\n        timeout : float\n            Timeout after which to give up if the client cannot be cleanly\n            shut down.\n        \"\"\"\n        # Setting _is_running to False causes the loop in _serve_forever to\n        # exit. The thread should then stop running. We wait for the thread to\n        # terminate until the timeout, then we continue anyway.\n        self._is_running = False\n        if self._callable and self._thread.is_alive():\n            self._thread.join(timeout)\n        if self._thread.is_alive():\n            raise SAMPClientError(\"Client was not shut down successfully \"\n                                  \"(timeout={}s)\".format(timeout))\n\n    @property\n    def is_running(self):\n        \"\"\"\n        Whether the client is currently running.\n        \"\"\"\n        return self._is_running\n\n    @property\n    def is_registered(self):\n        \"\"\"\n        Whether the client is currently registered.\n        \"\"\"\n        return self._is_registered\n\n    def _run_client(self):\n        if self._callable:\n            self._thread.start()\n\n    def _serve_forever(self):\n        while self._is_running:\n            try:\n                read_ready = select.select([self.client.socket], [], [], 0.1)[0]\n            except OSError as exc:\n                warnings.warn(f\"Call to select in SAMPClient failed: {exc}\",\n                              SAMPWarning)\n            else:\n                if read_ready:\n                    self.client.handle_request()\n\n        self.client.server_close()\n\n    def _ping(self, private_key, sender_id, msg_id, msg_mtype, msg_params,\n              message):\n\n        reply = {\"samp.status\": SAMP_STATUS_OK, \"samp.result\": {}}\n\n        self.hub.reply(private_key, msg_id, reply)\n\n    def _client_env_get(self, private_key, sender_id, msg_id, msg_mtype,\n                        msg_params, message):\n\n        if msg_params[\"name\"] in os.environ:\n            reply = {\"samp.status\": SAMP_STATUS_OK,\n                     \"samp.result\": {\"value\": os.environ[msg_params[\"name\"]]}}\n        else:\n            reply = {\"samp.status\": SAMP_STATUS_WARNING,\n                     \"samp.result\": {\"value\": \"\"},\n                     \"samp.error\": {\"samp.errortxt\":\n                                    \"Environment variable not defined.\"}}\n\n        self.hub.reply(private_key, msg_id, reply)\n\n    def _handle_notification(self, private_key, sender_id, message):\n\n        if private_key == self.get_private_key() and \"samp.mtype\" in message:\n\n            msg_mtype = message[\"samp.mtype\"]\n            del message[\"samp.mtype\"]\n            msg_params = message[\"samp.params\"]\n            del message[\"samp.params\"]\n\n            msubs = SAMPHubServer.get_mtype_subtypes(msg_mtype)\n            for mtype in msubs:\n                if mtype in self._notification_bindings:\n                    bound_func = self._notification_bindings[mtype][0]\n                    if get_num_args(bound_func) == 5:\n                        bound_func(private_key, sender_id, msg_mtype,\n                                   msg_params, message)\n                    else:\n                        bound_func(private_key, sender_id, None, msg_mtype,\n                                   msg_params, message)\n\n        return \"\"\n\n    def receive_notification(self, private_key, sender_id, message):\n        \"\"\"\n        Standard callable client ``receive_notification`` method.\n\n        This method is automatically handled when the\n        :meth:`~astropy.samp.client.SAMPClient.bind_receive_notification`\n        method is used to bind distinct operations to MTypes. In case of a\n        customized callable client implementation that inherits from the\n        :class:`~astropy.samp.SAMPClient` class this method should be\n        overwritten.\n\n        .. note:: When overwritten, this method must always return\n                  a string result (even empty).\n\n        Parameters\n        ----------\n        private_key : str\n            Client private key.\n\n        sender_id : str\n            Sender public ID.\n\n        message : dict\n            Received message.\n\n        Returns\n        -------\n        confirmation : str\n            Any confirmation string.\n        \"\"\"\n        return self._handle_notification(private_key, sender_id, message)\n\n    def _handle_call(self, private_key, sender_id, msg_id, message):\n\n        if private_key == self.get_private_key() and \"samp.mtype\" in message:\n\n            msg_mtype = message[\"samp.mtype\"]\n            del message[\"samp.mtype\"]\n            msg_params = message[\"samp.params\"]\n            del message[\"samp.params\"]\n\n            msubs = SAMPHubServer.get_mtype_subtypes(msg_mtype)\n\n            for mtype in msubs:\n                if mtype in self._call_bindings:\n                    self._call_bindings[mtype][0](private_key, sender_id,\n                                                  msg_id, msg_mtype,\n                                                  msg_params, message)\n\n        return \"\"\n\n    def receive_call(self, private_key, sender_id, msg_id, message):\n        \"\"\"\n        Standard callable client ``receive_call`` method.\n\n        This method is automatically handled when the\n        :meth:`~astropy.samp.client.SAMPClient.bind_receive_call` method is\n        used to bind distinct operations to MTypes. In case of a customized\n        callable client implementation that inherits from the\n        :class:`~astropy.samp.SAMPClient` class this method should be\n        overwritten.\n\n        .. note:: When overwritten, this method must always return\n                  a string result (even empty).\n\n        Parameters\n        ----------\n        private_key : str\n            Client private key.\n\n        sender_id : str\n            Sender public ID.\n\n        msg_id : str\n            Message ID received.\n\n        message : dict\n            Received message.\n\n        Returns\n        -------\n        confirmation : str\n            Any confirmation string.\n        \"\"\"\n        return self._handle_call(private_key, sender_id, msg_id, message)\n\n    def _handle_response(self, private_key, responder_id, msg_tag, response):\n        if (private_key == self.get_private_key() and\n            msg_tag in self._response_bindings):\n            self._response_bindings[msg_tag](private_key, responder_id,\n                                    msg_tag, response)\n        return \"\"\n\n    def receive_response(self, private_key, responder_id, msg_tag, response):\n        \"\"\"\n        Standard callable client ``receive_response`` method.\n\n        This method is automatically handled when the\n        :meth:`~astropy.samp.client.SAMPClient.bind_receive_response` method\n        is used to bind distinct operations to MTypes. In case of a customized\n        callable client implementation that inherits from the\n        :class:`~astropy.samp.SAMPClient` class this method should be\n        overwritten.\n\n        .. note:: When overwritten, this method must always return\n                  a string result (even empty).\n\n        Parameters\n        ----------\n        private_key : str\n            Client private key.\n\n        responder_id : str\n            Responder public ID.\n\n        msg_tag : str\n            Response message tag.\n\n        response : dict\n            Received response.\n\n        Returns\n        -------\n        confirmation : str\n            Any confirmation string.\n        \"\"\"\n        return self._handle_response(private_key, responder_id, msg_tag,\n                                     response)\n\n    def bind_receive_message(self, mtype, function, declare=True,\n                             metadata=None):\n        \"\"\"\n        Bind a specific MType to a function or class method, being intended for\n        a call or a notification.\n\n        The function must be of the form::\n\n            def my_function_or_method(<self,> private_key, sender_id, msg_id,\n                                      mtype, params, extra)\n\n        where ``private_key`` is the client private-key, ``sender_id`` is the\n        notification sender ID, ``msg_id`` is the Hub message-id (calls only,\n        otherwise is `None`), ``mtype`` is the message MType, ``params`` is the\n        message parameter set (content of ``\"samp.params\"``) and ``extra`` is a\n        dictionary containing any extra message map entry. The client is\n        automatically declared subscribed to the MType by default.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be caught.\n\n        function : callable\n            Application function to be used when ``mtype`` is received.\n\n        declare : bool, optional\n            Specify whether the client must be automatically declared as\n            subscribed to the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n\n        metadata : dict, optional\n            Dictionary containing additional metadata to declare associated\n            with the MType subscribed to (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        \"\"\"\n\n        self.bind_receive_call(mtype, function, declare=declare,\n                               metadata=metadata)\n\n        self.bind_receive_notification(mtype, function, declare=declare,\n                                       metadata=metadata)\n\n    def bind_receive_notification(self, mtype, function, declare=True, metadata=None):\n        \"\"\"\n        Bind a specific MType notification to a function or class method.\n\n        The function must be of the form::\n\n            def my_function_or_method(<self,> private_key, sender_id, mtype,\n                                      params, extra)\n\n        where ``private_key`` is the client private-key, ``sender_id`` is the\n        notification sender ID, ``mtype`` is the message MType, ``params`` is\n        the notified message parameter set (content of ``\"samp.params\"``) and\n        ``extra`` is a dictionary containing any extra message map entry. The\n        client is automatically declared subscribed to the MType by default.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be caught.\n\n        function : callable\n            Application function to be used when ``mtype`` is received.\n\n        declare : bool, optional\n            Specify whether the client must be automatically declared as\n            subscribed to the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n\n        metadata : dict, optional\n            Dictionary containing additional metadata to declare associated\n            with the MType subscribed to (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        \"\"\"\n        if self._callable:\n            if not metadata:\n                metadata = {}\n            self._notification_bindings[mtype] = [function, metadata]\n            if declare:\n                self._declare_subscriptions()\n        else:\n            raise SAMPClientError(\"Client not callable.\")\n\n    def bind_receive_call(self, mtype, function, declare=True, metadata=None):\n        \"\"\"\n        Bind a specific MType call to a function or class method.\n\n        The function must be of the form::\n\n            def my_function_or_method(<self,> private_key, sender_id, msg_id,\n                                      mtype, params, extra)\n\n        where ``private_key`` is the client private-key, ``sender_id`` is the\n        notification sender ID, ``msg_id`` is the Hub message-id, ``mtype`` is\n        the message MType, ``params`` is the message parameter set (content of\n        ``\"samp.params\"``) and ``extra`` is a dictionary containing any extra\n        message map entry. The client is automatically declared subscribed to\n        the MType by default.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be caught.\n\n        function : callable\n            Application function to be used when ``mtype`` is received.\n\n        declare : bool, optional\n            Specify whether the client must be automatically declared as\n            subscribed to the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n\n        metadata : dict, optional\n            Dictionary containing additional metadata to declare associated\n            with the MType subscribed to (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        \"\"\"\n        if self._callable:\n            if not metadata:\n                metadata = {}\n            self._call_bindings[mtype] = [function, metadata]\n            if declare:\n                self._declare_subscriptions()\n        else:\n            raise SAMPClientError(\"Client not callable.\")\n\n    def bind_receive_response(self, msg_tag, function):\n        \"\"\"\n        Bind a specific msg-tag response to a function or class method.\n\n        The function must be of the form::\n\n            def my_function_or_method(<self,> private_key, responder_id,\n                                      msg_tag, response)\n\n        where ``private_key`` is the client private-key, ``responder_id`` is\n        the message responder ID, ``msg_tag`` is the message-tag provided at\n        call time and ``response`` is the response received.\n\n        Parameters\n        ----------\n        msg_tag : str\n            Message-tag to be caught.\n\n        function : callable\n            Application function to be used when ``msg_tag`` is received.\n        \"\"\"\n        if self._callable:\n            self._response_bindings[msg_tag] = function\n        else:\n            raise SAMPClientError(\"Client not callable.\")\n\n    def unbind_receive_notification(self, mtype, declare=True):\n        \"\"\"\n        Remove from the notifications binding table the specified MType and\n        unsubscribe the client from it (if required).\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be removed.\n\n        declare : bool\n            Specify whether the client must be automatically declared as\n            unsubscribed from the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        \"\"\"\n        if self._callable:\n            del self._notification_bindings[mtype]\n            if declare:\n                self._declare_subscriptions()\n        else:\n            raise SAMPClientError(\"Client not callable.\")\n\n    def unbind_receive_call(self, mtype, declare=True):\n        \"\"\"\n        Remove from the calls binding table the specified MType and unsubscribe\n        the client from it (if required).\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be removed.\n\n        declare : bool\n            Specify whether the client must be automatically declared as\n            unsubscribed from the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        \"\"\"\n        if self._callable:\n            del self._call_bindings[mtype]\n            if declare:\n                self._declare_subscriptions()\n        else:\n            raise SAMPClientError(\"Client not callable.\")\n\n    def unbind_receive_response(self, msg_tag):\n        \"\"\"\n        Remove from the responses binding table the specified message-tag.\n\n        Parameters\n        ----------\n        msg_tag : str\n            Message-tag to be removed.\n        \"\"\"\n        if self._callable:\n            del self._response_bindings[msg_tag]\n        else:\n            raise SAMPClientError(\"Client not callable.\")\n\n    def declare_subscriptions(self, subscriptions=None):\n        \"\"\"\n        Declares the MTypes the client wishes to subscribe to, implicitly\n        defined with the MType binding methods\n        :meth:`~astropy.samp.client.SAMPClient.bind_receive_notification`\n        and :meth:`~astropy.samp.client.SAMPClient.bind_receive_call`.\n\n        An optional ``subscriptions`` map can be added to the final map passed\n        to the :meth:`~astropy.samp.hub_proxy.SAMPHubProxy.declare_subscriptions`\n        method.\n\n        Parameters\n        ----------\n        subscriptions : dict, optional\n            Dictionary containing the list of MTypes to subscribe to, with the\n            same format of the ``subscriptions`` map passed to the\n            :meth:`~astropy.samp.hub_proxy.SAMPHubProxy.declare_subscriptions`\n            method.\n        \"\"\"\n        if self._callable:\n            self._declare_subscriptions(subscriptions)\n        else:\n            raise SAMPClientError(\"Client not callable.\")\n\n    def register(self):\n        \"\"\"\n        Register the client to the SAMP Hub.\n        \"\"\"\n        if self.hub.is_connected:\n\n            if self._private_key is not None:\n                raise SAMPClientError(\"Client already registered\")\n\n            result = self.hub.register(self.hub.lockfile[\"samp.secret\"])\n\n            if result[\"samp.self-id\"] == \"\":\n                raise SAMPClientError(\"Registration failed - \"\n                                      \"samp.self-id was not set by the hub.\")\n\n            if result[\"samp.private-key\"] == \"\":\n                raise SAMPClientError(\"Registration failed - \"\n                                      \"samp.private-key was not set by the hub.\")\n\n            self._public_id = result[\"samp.self-id\"]\n            self._private_key = result[\"samp.private-key\"]\n            self._hub_id = result[\"samp.hub-id\"]\n\n            if self._callable:\n                self._set_xmlrpc_callback()\n                self._declare_subscriptions()\n\n            if self._metadata != {}:\n                self.declare_metadata()\n\n            self._is_registered = True\n\n        else:\n            raise SAMPClientError(\"Unable to register to the SAMP Hub. \"\n                                  \"Hub proxy not connected.\")\n\n    def unregister(self):\n        \"\"\"\n        Unregister the client from the SAMP Hub.\n        \"\"\"\n        if self.hub.is_connected:\n            self._is_registered = False\n            self.hub.unregister(self._private_key)\n            self._hub_id = None\n            self._public_id = None\n            self._private_key = None\n        else:\n            raise SAMPClientError(\"Unable to unregister from the SAMP Hub. \"\n                                  \"Hub proxy not connected.\")\n\n    def _set_xmlrpc_callback(self):\n        if self.hub.is_connected and self._private_key is not None:\n            self.hub.set_xmlrpc_callback(self._private_key,\n                                         self._xmlrpcAddr)\n\n    def _declare_subscriptions(self, subscriptions=None):\n        if self.hub.is_connected and self._private_key is not None:\n\n            mtypes_dict = {}\n            # Collect notification mtypes and metadata\n            for mtype in self._notification_bindings.keys():\n                mtypes_dict[mtype] = copy.deepcopy(self._notification_bindings[mtype][1])\n\n            # Collect notification mtypes and metadata\n            for mtype in self._call_bindings.keys():\n                mtypes_dict[mtype] = copy.deepcopy(self._call_bindings[mtype][1])\n\n            # Add optional subscription map\n            if subscriptions:\n                mtypes_dict.update(copy.deepcopy(subscriptions))\n\n            self.hub.declare_subscriptions(self._private_key, mtypes_dict)\n\n        else:\n            raise SAMPClientError(\"Unable to declare subscriptions. Hub \"\n                                  \"unreachable or not connected or client \"\n                                  \"not registered.\")\n\n    def declare_metadata(self, metadata=None):\n        \"\"\"\n        Declare the client application metadata supported.\n\n        Parameters\n        ----------\n        metadata : dict, optional\n            Dictionary containing the client application metadata as defined in\n            the SAMP definition document. If omitted, then no metadata are\n            declared.\n        \"\"\"\n        if self.hub.is_connected and self._private_key is not None:\n            if metadata is not None:\n                self._metadata.update(metadata)\n            self.hub.declare_metadata(self._private_key, self._metadata)\n        else:\n            raise SAMPClientError(\"Unable to declare metadata. Hub \"\n                                  \"unreachable or not connected or client \"\n                                  \"not registered.\")\n\n    def get_private_key(self):\n        \"\"\"\n        Return the client private key used for the Standard Profile\n        communications obtained at registration time (``samp.private-key``).\n\n        Returns\n        -------\n        key : str\n            Client private key.\n        \"\"\"\n        return self._private_key\n\n    def get_public_id(self):\n        \"\"\"\n        Return public client ID obtained at registration time\n        (``samp.self-id``).\n\n        Returns\n        -------\n        id : str\n            Client public ID.\n        \"\"\"\n        return self._public_id\n"},{"attributeType":"null","col":24,"comment":"null","endLoc":14,"id":8031,"name":"xmlrpc","nodeType":"Attribute","startLoc":14,"text":"xmlrpc"},{"className":"SAMPClientError","col":0,"comment":"\n    SAMP Client exceptions.\n    ","endLoc":30,"id":8032,"nodeType":"Class","startLoc":27,"text":"class SAMPClientError(Exception):\n    \"\"\"\n    SAMP Client exceptions.\n    \"\"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":8033,"name":"__all__","nodeType":"Attribute","startLoc":20,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"client.py#<anonymous>","id":8034,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['SAMPClient']"},{"fileName":"hub_script.py","filePath":"astropy/samp","id":8035,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport copy\nimport time\nimport sys\nimport argparse\n\nfrom astropy import log, __version__\n\nfrom .hub import SAMPHubServer\n\n__all__ = ['hub_script']\n\n\ndef hub_script(timeout=0):\n    \"\"\"\n    This main function is executed by the ``samp_hub`` command line tool.\n    \"\"\"\n\n    parser = argparse.ArgumentParser(prog=\"samp_hub \" + __version__)\n\n    parser.add_argument(\"-k\", \"--secret\", dest=\"secret\", metavar=\"CODE\",\n                        help=\"custom secret code.\")\n\n    parser.add_argument(\"-d\", \"--addr\", dest=\"addr\", metavar=\"ADDR\",\n                        help=\"listening address (or IP).\")\n\n    parser.add_argument(\"-p\", \"--port\", dest=\"port\", metavar=\"PORT\", type=int,\n                        help=\"listening port number.\")\n\n    parser.add_argument(\"-f\", \"--lockfile\", dest=\"lockfile\", metavar=\"FILE\",\n                        help=\"custom lockfile.\")\n\n    parser.add_argument(\"-w\", \"--no-web-profile\", dest=\"web_profile\", action=\"store_false\",\n                        help=\"run the Hub disabling the Web Profile.\", default=True)\n\n    parser.add_argument(\"-P\", \"--pool-size\", dest=\"pool_size\", metavar=\"SIZE\", type=int,\n                        help=\"the socket connections pool size.\", default=20)\n\n    timeout_group = parser.add_argument_group(\"Timeout group\",\n                                              \"Special options to setup hub and client timeouts.\"\n                                              \"It contains a set of special options that allows to set up the Hub and \"\n                                              \"clients inactivity timeouts, that is the Hub or client inactivity time \"\n                                              \"interval after which the Hub shuts down or unregisters the client. \"\n                                              \"Notification of samp.hub.disconnect MType is sent to the clients \"\n                                              \"forcibly unregistered for timeout expiration.\")\n\n    timeout_group.add_argument(\"-t\", \"--timeout\", dest=\"timeout\", metavar=\"SECONDS\",\n                               help=\"set the Hub inactivity timeout in SECONDS. By default it \"\n                               \"is set to 0, that is the Hub never expires.\", type=int, default=0)\n\n    timeout_group.add_argument(\"-c\", \"--client-timeout\", dest=\"client_timeout\", metavar=\"SECONDS\",\n                               help=\"set the client inactivity timeout in SECONDS. By default it \"\n                               \"is set to 0, that is the client never expires.\", type=int, default=0)\n\n    parser.add_argument_group(timeout_group)\n\n    log_group = parser.add_argument_group(\"Logging options\",\n                                          \"Additional options which allow to customize the logging output. By \"\n                                          \"default the SAMP Hub uses the standard output and standard error \"\n                                          \"devices to print out INFO level logging messages. Using the options \"\n                                          \"here below it is possible to modify the logging level and also \"\n                                          \"specify the output files where redirect the logging messages.\")\n\n    log_group.add_argument(\"-L\", \"--log-level\", dest=\"loglevel\", metavar=\"LEVEL\",\n                           help=\"set the Hub instance log level (OFF, ERROR, WARNING, INFO, DEBUG).\",\n                           type=str, choices=[\"OFF\", \"ERROR\", \"WARNING\", \"INFO\", \"DEBUG\"], default='INFO')\n\n    log_group.add_argument(\"-O\", \"--log-output\", dest=\"logout\", metavar=\"FILE\",\n                           help=\"set the output file for the log messages.\", default=\"\")\n\n    parser.add_argument_group(log_group)\n\n    adv_group = parser.add_argument_group(\"Advanced group\",\n                                          \"Advanced options addressed to facilitate administrative tasks and \"\n                                          \"allow new non-standard Hub behaviors. In particular the --label \"\n                                          \"options is used to assign a value to hub.label token and is used to \"\n                                          \"assign a name to the Hub instance. \"\n                                          \"The very special --multi option allows to start a Hub in multi-instance mode. \"\n                                          \"Multi-instance mode is a non-standard Hub behavior that enables \"\n                                          \"multiple contemporaneous running Hubs. Multi-instance hubs place \"\n                                          \"their non-standard lock-files within the <home directory>/.samp-1 \"\n                                          \"directory naming them making use of the format: \"\n                                          \"samp-hub-<PID>-<ID>, where PID is the Hub process ID while ID is an \"\n                                          \"internal ID (integer).\")\n\n    adv_group.add_argument(\"-l\", \"--label\", dest=\"label\", metavar=\"LABEL\",\n                           help=\"assign a LABEL to the Hub.\", default=\"\")\n\n    adv_group.add_argument(\"-m\", \"--multi\", dest=\"mode\",\n                           help=\"run the Hub in multi-instance mode generating a custom \"\n                           \"lockfile with a random name.\",\n                           action=\"store_const\", const='multiple', default='single')\n\n    parser.add_argument_group(adv_group)\n\n    options = parser.parse_args()\n\n    try:\n\n        if options.loglevel in (\"OFF\", \"ERROR\", \"WARNING\", \"DEBUG\", \"INFO\"):\n            log.setLevel(options.loglevel)\n\n        if options.logout != \"\":\n            context = log.log_to_file(options.logout)\n        else:\n            class dummy_context:\n\n                def __enter__(self):\n                    pass\n\n                def __exit__(self, exc_type, exc_value, traceback):\n                    pass\n            context = dummy_context()\n\n        with context:\n\n            args = copy.deepcopy(options.__dict__)\n            del(args[\"loglevel\"])\n            del(args[\"logout\"])\n\n            hub = SAMPHubServer(**args)\n            hub.start(False)\n\n            if not timeout:\n                while hub.is_running:\n                    time.sleep(0.01)\n            else:\n                time.sleep(timeout)\n                hub.stop()\n\n    except KeyboardInterrupt:\n        try:\n            hub.stop()\n        except NameError:\n            pass\n    except OSError as e:\n        print(f\"[SAMP] Error: I/O error({e.errno}): {e.strerror}\")\n        sys.exit(1)\n    except SystemExit:\n        pass\n"},{"fileName":"errors.py","filePath":"astropy/samp","id":8036,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nDefines custom errors and exceptions used in `astropy.samp`.\n\"\"\"\n\n\nimport xmlrpc.client as xmlrpc\n\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n\n__all__ = ['SAMPWarning', 'SAMPHubError', 'SAMPClientError', 'SAMPProxyError']\n\n\nclass SAMPWarning(AstropyUserWarning):\n    \"\"\"\n    SAMP-specific Astropy warning class\n    \"\"\"\n\n\nclass SAMPHubError(Exception):\n    \"\"\"\n    SAMP Hub exception.\n    \"\"\"\n\n\nclass SAMPClientError(Exception):\n    \"\"\"\n    SAMP Client exceptions.\n    \"\"\"\n\n\nclass SAMPProxyError(xmlrpc.Fault):\n    \"\"\"\n    SAMP Proxy Hub exception\n    \"\"\"\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":8037,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"errors.py#<anonymous>","id":8038,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nDefines custom errors and exceptions used in `astropy.samp`.\n\"\"\"\n\n__all__ = ['SAMPWarning', 'SAMPHubError', 'SAMPClientError', 'SAMPProxyError']"},{"col":4,"comment":"\n        Standard callable client ``receive_notification`` method.\n\n        This method is automatically handled when the\n        :meth:`~astropy.samp.client.SAMPClient.bind_receive_notification`\n        method is used to bind distinct operations to MTypes. In case of a\n        customized callable client implementation that inherits from the\n        :class:`~astropy.samp.SAMPClient` class this method should be\n        overwritten.\n\n        .. note:: When overwritten, this method must always return\n                  a string result (even empty).\n\n        Parameters\n        ----------\n        private_key : str\n            Client private key.\n\n        sender_id : str\n            Sender public ID.\n\n        message : dict\n            Received message.\n\n        Returns\n        -------\n        confirmation : str\n            Any confirmation string.\n        ","endLoc":263,"header":"def receive_notification(self, private_key, sender_id, message)","id":8039,"name":"receive_notification","nodeType":"Function","startLoc":233,"text":"def receive_notification(self, private_key, sender_id, message):\n        \"\"\"\n        Standard callable client ``receive_notification`` method.\n\n        This method is automatically handled when the\n        :meth:`~astropy.samp.client.SAMPClient.bind_receive_notification`\n        method is used to bind distinct operations to MTypes. In case of a\n        customized callable client implementation that inherits from the\n        :class:`~astropy.samp.SAMPClient` class this method should be\n        overwritten.\n\n        .. note:: When overwritten, this method must always return\n                  a string result (even empty).\n\n        Parameters\n        ----------\n        private_key : str\n            Client private key.\n\n        sender_id : str\n            Sender public ID.\n\n        message : dict\n            Received message.\n\n        Returns\n        -------\n        confirmation : str\n            Any confirmation string.\n        \"\"\"\n        return self._handle_notification(private_key, sender_id, message)"},{"fileName":"hub_proxy.py","filePath":"astropy/samp","id":8040,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport copy\nimport xmlrpc.client as xmlrpc\n\nfrom .errors import SAMPHubError\nfrom .utils import ServerProxyPool\nfrom .lockfile_helpers import get_main_running_hub\n\n\n__all__ = ['SAMPHubProxy']\n\n\nclass SAMPHubProxy:\n    \"\"\"\n    Proxy class to simplify the client interaction with a SAMP hub (via the\n    standard profile).\n    \"\"\"\n\n    def __init__(self):\n        self.proxy = None\n        self._connected = False\n\n    @property\n    def is_connected(self):\n        \"\"\"\n        Whether the hub proxy is currently connected to a hub.\n        \"\"\"\n        return self._connected\n\n    def connect(self, hub=None, hub_params=None, pool_size=20):\n        \"\"\"\n        Connect to the current SAMP Hub.\n\n        Parameters\n        ----------\n        hub : `~astropy.samp.SAMPHubServer`, optional\n            The hub to connect to.\n\n        hub_params : dict, optional\n            Optional dictionary containing the lock-file content of the Hub\n            with which to connect. This dictionary has the form\n            ``{<token-name>: <token-string>, ...}``.\n\n        pool_size : int, optional\n            The number of socket connections opened to communicate with the\n            Hub.\n        \"\"\"\n\n        self._connected = False\n        self.lockfile = {}\n\n        if hub is not None and hub_params is not None:\n            raise ValueError(\"Cannot specify both hub and hub_params\")\n\n        if hub_params is None:\n\n            if hub is not None:\n                if not hub.is_running:\n                    raise SAMPHubError(\"Hub is not running\")\n                else:\n                    hub_params = hub.params\n            else:\n                hub_params = get_main_running_hub()\n\n        try:\n\n            url = hub_params[\"samp.hub.xmlrpc.url\"].replace(\"\\\\\", \"\")\n\n            self.proxy = ServerProxyPool(pool_size, xmlrpc.ServerProxy,\n                                         url, allow_none=1)\n\n            self.ping()\n\n            self.lockfile = copy.deepcopy(hub_params)\n            self._connected = True\n\n        except xmlrpc.ProtocolError as p:\n            # 401 Unauthorized\n            if p.errcode == 401:\n                raise SAMPHubError(\"Unauthorized access. Basic Authentication \"\n                                   \"required or failed.\")\n            else:\n                raise SAMPHubError(f\"Protocol Error {p.errcode}: {p.errmsg}\")\n\n    def disconnect(self):\n        \"\"\"\n        Disconnect from the current SAMP Hub.\n        \"\"\"\n        if self.proxy is not None:\n            self.proxy.shutdown()\n            self.proxy = None\n        self._connected = False\n        self.lockfile = {}\n\n    @property\n    def _samp_hub(self):\n        \"\"\"\n        Property to abstract away the path to the hub, which allows this class\n        to be used for other profiles.\n        \"\"\"\n        return self.proxy.samp.hub\n\n    def ping(self):\n        \"\"\"\n        Proxy to ``ping`` SAMP Hub method (Standard Profile only).\n        \"\"\"\n        return self._samp_hub.ping()\n\n    def set_xmlrpc_callback(self, private_key, xmlrpc_addr):\n        \"\"\"\n        Proxy to ``setXmlrpcCallback`` SAMP Hub method (Standard Profile only).\n        \"\"\"\n        return self._samp_hub.setXmlrpcCallback(private_key, xmlrpc_addr)\n\n    def register(self, secret):\n        \"\"\"\n        Proxy to ``register`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.register(secret)\n\n    def unregister(self, private_key):\n        \"\"\"\n        Proxy to ``unregister`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.unregister(private_key)\n\n    def declare_metadata(self, private_key, metadata):\n        \"\"\"\n        Proxy to ``declareMetadata`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.declareMetadata(private_key, metadata)\n\n    def get_metadata(self, private_key, client_id):\n        \"\"\"\n        Proxy to ``getMetadata`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.getMetadata(private_key, client_id)\n\n    def declare_subscriptions(self, private_key, subscriptions):\n        \"\"\"\n        Proxy to ``declareSubscriptions`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.declareSubscriptions(private_key, subscriptions)\n\n    def get_subscriptions(self, private_key, client_id):\n        \"\"\"\n        Proxy to ``getSubscriptions`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.getSubscriptions(private_key, client_id)\n\n    def get_registered_clients(self, private_key):\n        \"\"\"\n        Proxy to ``getRegisteredClients`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.getRegisteredClients(private_key)\n\n    def get_subscribed_clients(self, private_key, mtype):\n        \"\"\"\n        Proxy to ``getSubscribedClients`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.getSubscribedClients(private_key, mtype)\n\n    def notify(self, private_key, recipient_id, message):\n        \"\"\"\n        Proxy to ``notify`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.notify(private_key, recipient_id, message)\n\n    def notify_all(self, private_key, message):\n        \"\"\"\n        Proxy to ``notifyAll`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.notifyAll(private_key, message)\n\n    def call(self, private_key, recipient_id, msg_tag, message):\n        \"\"\"\n        Proxy to ``call`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.call(private_key, recipient_id, msg_tag, message)\n\n    def call_all(self, private_key, msg_tag, message):\n        \"\"\"\n        Proxy to ``callAll`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.callAll(private_key, msg_tag, message)\n\n    def call_and_wait(self, private_key, recipient_id, message, timeout):\n        \"\"\"\n        Proxy to ``callAndWait`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.callAndWait(private_key, recipient_id, message,\n                                          timeout)\n\n    def reply(self, private_key, msg_id, response):\n        \"\"\"\n        Proxy to ``reply`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.reply(private_key, msg_id, response)\n"},{"col":0,"comment":"\n    This main function is executed by the ``samp_hub`` command line tool.\n    ","endLoc":142,"header":"def hub_script(timeout=0)","id":8041,"name":"hub_script","nodeType":"Function","startLoc":16,"text":"def hub_script(timeout=0):\n    \"\"\"\n    This main function is executed by the ``samp_hub`` command line tool.\n    \"\"\"\n\n    parser = argparse.ArgumentParser(prog=\"samp_hub \" + __version__)\n\n    parser.add_argument(\"-k\", \"--secret\", dest=\"secret\", metavar=\"CODE\",\n                        help=\"custom secret code.\")\n\n    parser.add_argument(\"-d\", \"--addr\", dest=\"addr\", metavar=\"ADDR\",\n                        help=\"listening address (or IP).\")\n\n    parser.add_argument(\"-p\", \"--port\", dest=\"port\", metavar=\"PORT\", type=int,\n                        help=\"listening port number.\")\n\n    parser.add_argument(\"-f\", \"--lockfile\", dest=\"lockfile\", metavar=\"FILE\",\n                        help=\"custom lockfile.\")\n\n    parser.add_argument(\"-w\", \"--no-web-profile\", dest=\"web_profile\", action=\"store_false\",\n                        help=\"run the Hub disabling the Web Profile.\", default=True)\n\n    parser.add_argument(\"-P\", \"--pool-size\", dest=\"pool_size\", metavar=\"SIZE\", type=int,\n                        help=\"the socket connections pool size.\", default=20)\n\n    timeout_group = parser.add_argument_group(\"Timeout group\",\n                                              \"Special options to setup hub and client timeouts.\"\n                                              \"It contains a set of special options that allows to set up the Hub and \"\n                                              \"clients inactivity timeouts, that is the Hub or client inactivity time \"\n                                              \"interval after which the Hub shuts down or unregisters the client. \"\n                                              \"Notification of samp.hub.disconnect MType is sent to the clients \"\n                                              \"forcibly unregistered for timeout expiration.\")\n\n    timeout_group.add_argument(\"-t\", \"--timeout\", dest=\"timeout\", metavar=\"SECONDS\",\n                               help=\"set the Hub inactivity timeout in SECONDS. By default it \"\n                               \"is set to 0, that is the Hub never expires.\", type=int, default=0)\n\n    timeout_group.add_argument(\"-c\", \"--client-timeout\", dest=\"client_timeout\", metavar=\"SECONDS\",\n                               help=\"set the client inactivity timeout in SECONDS. By default it \"\n                               \"is set to 0, that is the client never expires.\", type=int, default=0)\n\n    parser.add_argument_group(timeout_group)\n\n    log_group = parser.add_argument_group(\"Logging options\",\n                                          \"Additional options which allow to customize the logging output. By \"\n                                          \"default the SAMP Hub uses the standard output and standard error \"\n                                          \"devices to print out INFO level logging messages. Using the options \"\n                                          \"here below it is possible to modify the logging level and also \"\n                                          \"specify the output files where redirect the logging messages.\")\n\n    log_group.add_argument(\"-L\", \"--log-level\", dest=\"loglevel\", metavar=\"LEVEL\",\n                           help=\"set the Hub instance log level (OFF, ERROR, WARNING, INFO, DEBUG).\",\n                           type=str, choices=[\"OFF\", \"ERROR\", \"WARNING\", \"INFO\", \"DEBUG\"], default='INFO')\n\n    log_group.add_argument(\"-O\", \"--log-output\", dest=\"logout\", metavar=\"FILE\",\n                           help=\"set the output file for the log messages.\", default=\"\")\n\n    parser.add_argument_group(log_group)\n\n    adv_group = parser.add_argument_group(\"Advanced group\",\n                                          \"Advanced options addressed to facilitate administrative tasks and \"\n                                          \"allow new non-standard Hub behaviors. In particular the --label \"\n                                          \"options is used to assign a value to hub.label token and is used to \"\n                                          \"assign a name to the Hub instance. \"\n                                          \"The very special --multi option allows to start a Hub in multi-instance mode. \"\n                                          \"Multi-instance mode is a non-standard Hub behavior that enables \"\n                                          \"multiple contemporaneous running Hubs. Multi-instance hubs place \"\n                                          \"their non-standard lock-files within the <home directory>/.samp-1 \"\n                                          \"directory naming them making use of the format: \"\n                                          \"samp-hub-<PID>-<ID>, where PID is the Hub process ID while ID is an \"\n                                          \"internal ID (integer).\")\n\n    adv_group.add_argument(\"-l\", \"--label\", dest=\"label\", metavar=\"LABEL\",\n                           help=\"assign a LABEL to the Hub.\", default=\"\")\n\n    adv_group.add_argument(\"-m\", \"--multi\", dest=\"mode\",\n                           help=\"run the Hub in multi-instance mode generating a custom \"\n                           \"lockfile with a random name.\",\n                           action=\"store_const\", const='multiple', default='single')\n\n    parser.add_argument_group(adv_group)\n\n    options = parser.parse_args()\n\n    try:\n\n        if options.loglevel in (\"OFF\", \"ERROR\", \"WARNING\", \"DEBUG\", \"INFO\"):\n            log.setLevel(options.loglevel)\n\n        if options.logout != \"\":\n            context = log.log_to_file(options.logout)\n        else:\n            class dummy_context:\n\n                def __enter__(self):\n                    pass\n\n                def __exit__(self, exc_type, exc_value, traceback):\n                    pass\n            context = dummy_context()\n\n        with context:\n\n            args = copy.deepcopy(options.__dict__)\n            del(args[\"loglevel\"])\n            del(args[\"logout\"])\n\n            hub = SAMPHubServer(**args)\n            hub.start(False)\n\n            if not timeout:\n                while hub.is_running:\n                    time.sleep(0.01)\n            else:\n                time.sleep(timeout)\n                hub.stop()\n\n    except KeyboardInterrupt:\n        try:\n            hub.stop()\n        except NameError:\n            pass\n    except OSError as e:\n        print(f\"[SAMP] Error: I/O error({e.errno}): {e.strerror}\")\n        sys.exit(1)\n    except SystemExit:\n        pass"},{"className":"SAMPHubProxy","col":0,"comment":"\n    Proxy class to simplify the client interaction with a SAMP hub (via the\n    standard profile).\n    ","endLoc":200,"id":8042,"nodeType":"Class","startLoc":15,"text":"class SAMPHubProxy:\n    \"\"\"\n    Proxy class to simplify the client interaction with a SAMP hub (via the\n    standard profile).\n    \"\"\"\n\n    def __init__(self):\n        self.proxy = None\n        self._connected = False\n\n    @property\n    def is_connected(self):\n        \"\"\"\n        Whether the hub proxy is currently connected to a hub.\n        \"\"\"\n        return self._connected\n\n    def connect(self, hub=None, hub_params=None, pool_size=20):\n        \"\"\"\n        Connect to the current SAMP Hub.\n\n        Parameters\n        ----------\n        hub : `~astropy.samp.SAMPHubServer`, optional\n            The hub to connect to.\n\n        hub_params : dict, optional\n            Optional dictionary containing the lock-file content of the Hub\n            with which to connect. This dictionary has the form\n            ``{<token-name>: <token-string>, ...}``.\n\n        pool_size : int, optional\n            The number of socket connections opened to communicate with the\n            Hub.\n        \"\"\"\n\n        self._connected = False\n        self.lockfile = {}\n\n        if hub is not None and hub_params is not None:\n            raise ValueError(\"Cannot specify both hub and hub_params\")\n\n        if hub_params is None:\n\n            if hub is not None:\n                if not hub.is_running:\n                    raise SAMPHubError(\"Hub is not running\")\n                else:\n                    hub_params = hub.params\n            else:\n                hub_params = get_main_running_hub()\n\n        try:\n\n            url = hub_params[\"samp.hub.xmlrpc.url\"].replace(\"\\\\\", \"\")\n\n            self.proxy = ServerProxyPool(pool_size, xmlrpc.ServerProxy,\n                                         url, allow_none=1)\n\n            self.ping()\n\n            self.lockfile = copy.deepcopy(hub_params)\n            self._connected = True\n\n        except xmlrpc.ProtocolError as p:\n            # 401 Unauthorized\n            if p.errcode == 401:\n                raise SAMPHubError(\"Unauthorized access. Basic Authentication \"\n                                   \"required or failed.\")\n            else:\n                raise SAMPHubError(f\"Protocol Error {p.errcode}: {p.errmsg}\")\n\n    def disconnect(self):\n        \"\"\"\n        Disconnect from the current SAMP Hub.\n        \"\"\"\n        if self.proxy is not None:\n            self.proxy.shutdown()\n            self.proxy = None\n        self._connected = False\n        self.lockfile = {}\n\n    @property\n    def _samp_hub(self):\n        \"\"\"\n        Property to abstract away the path to the hub, which allows this class\n        to be used for other profiles.\n        \"\"\"\n        return self.proxy.samp.hub\n\n    def ping(self):\n        \"\"\"\n        Proxy to ``ping`` SAMP Hub method (Standard Profile only).\n        \"\"\"\n        return self._samp_hub.ping()\n\n    def set_xmlrpc_callback(self, private_key, xmlrpc_addr):\n        \"\"\"\n        Proxy to ``setXmlrpcCallback`` SAMP Hub method (Standard Profile only).\n        \"\"\"\n        return self._samp_hub.setXmlrpcCallback(private_key, xmlrpc_addr)\n\n    def register(self, secret):\n        \"\"\"\n        Proxy to ``register`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.register(secret)\n\n    def unregister(self, private_key):\n        \"\"\"\n        Proxy to ``unregister`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.unregister(private_key)\n\n    def declare_metadata(self, private_key, metadata):\n        \"\"\"\n        Proxy to ``declareMetadata`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.declareMetadata(private_key, metadata)\n\n    def get_metadata(self, private_key, client_id):\n        \"\"\"\n        Proxy to ``getMetadata`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.getMetadata(private_key, client_id)\n\n    def declare_subscriptions(self, private_key, subscriptions):\n        \"\"\"\n        Proxy to ``declareSubscriptions`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.declareSubscriptions(private_key, subscriptions)\n\n    def get_subscriptions(self, private_key, client_id):\n        \"\"\"\n        Proxy to ``getSubscriptions`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.getSubscriptions(private_key, client_id)\n\n    def get_registered_clients(self, private_key):\n        \"\"\"\n        Proxy to ``getRegisteredClients`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.getRegisteredClients(private_key)\n\n    def get_subscribed_clients(self, private_key, mtype):\n        \"\"\"\n        Proxy to ``getSubscribedClients`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.getSubscribedClients(private_key, mtype)\n\n    def notify(self, private_key, recipient_id, message):\n        \"\"\"\n        Proxy to ``notify`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.notify(private_key, recipient_id, message)\n\n    def notify_all(self, private_key, message):\n        \"\"\"\n        Proxy to ``notifyAll`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.notifyAll(private_key, message)\n\n    def call(self, private_key, recipient_id, msg_tag, message):\n        \"\"\"\n        Proxy to ``call`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.call(private_key, recipient_id, msg_tag, message)\n\n    def call_all(self, private_key, msg_tag, message):\n        \"\"\"\n        Proxy to ``callAll`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.callAll(private_key, msg_tag, message)\n\n    def call_and_wait(self, private_key, recipient_id, message, timeout):\n        \"\"\"\n        Proxy to ``callAndWait`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.callAndWait(private_key, recipient_id, message,\n                                          timeout)\n\n    def reply(self, private_key, msg_id, response):\n        \"\"\"\n        Proxy to ``reply`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.reply(private_key, msg_id, response)"},{"col":4,"comment":"null","endLoc":23,"header":"def __init__(self)","id":8043,"name":"__init__","nodeType":"Function","startLoc":21,"text":"def __init__(self):\n        self.proxy = None\n        self._connected = False"},{"col":4,"comment":"null","endLoc":282,"header":"def _handle_call(self, private_key, sender_id, msg_id, message)","id":8044,"name":"_handle_call","nodeType":"Function","startLoc":265,"text":"def _handle_call(self, private_key, sender_id, msg_id, message):\n\n        if private_key == self.get_private_key() and \"samp.mtype\" in message:\n\n            msg_mtype = message[\"samp.mtype\"]\n            del message[\"samp.mtype\"]\n            msg_params = message[\"samp.params\"]\n            del message[\"samp.params\"]\n\n            msubs = SAMPHubServer.get_mtype_subtypes(msg_mtype)\n\n            for mtype in msubs:\n                if mtype in self._call_bindings:\n                    self._call_bindings[mtype][0](private_key, sender_id,\n                                                  msg_id, msg_mtype,\n                                                  msg_params, message)\n\n        return \"\""},{"col":4,"comment":"\n        Whether the hub proxy is currently connected to a hub.\n        ","endLoc":30,"header":"@property\n    def is_connected(self)","id":8045,"name":"is_connected","nodeType":"Function","startLoc":25,"text":"@property\n    def is_connected(self):\n        \"\"\"\n        Whether the hub proxy is currently connected to a hub.\n        \"\"\"\n        return self._connected"},{"col":4,"comment":"\n        Connect to the current SAMP Hub.\n\n        Parameters\n        ----------\n        hub : `~astropy.samp.SAMPHubServer`, optional\n            The hub to connect to.\n\n        hub_params : dict, optional\n            Optional dictionary containing the lock-file content of the Hub\n            with which to connect. This dictionary has the form\n            ``{<token-name>: <token-string>, ...}``.\n\n        pool_size : int, optional\n            The number of socket connections opened to communicate with the\n            Hub.\n        ","endLoc":85,"header":"def connect(self, hub=None, hub_params=None, pool_size=20)","id":8046,"name":"connect","nodeType":"Function","startLoc":32,"text":"def connect(self, hub=None, hub_params=None, pool_size=20):\n        \"\"\"\n        Connect to the current SAMP Hub.\n\n        Parameters\n        ----------\n        hub : `~astropy.samp.SAMPHubServer`, optional\n            The hub to connect to.\n\n        hub_params : dict, optional\n            Optional dictionary containing the lock-file content of the Hub\n            with which to connect. This dictionary has the form\n            ``{<token-name>: <token-string>, ...}``.\n\n        pool_size : int, optional\n            The number of socket connections opened to communicate with the\n            Hub.\n        \"\"\"\n\n        self._connected = False\n        self.lockfile = {}\n\n        if hub is not None and hub_params is not None:\n            raise ValueError(\"Cannot specify both hub and hub_params\")\n\n        if hub_params is None:\n\n            if hub is not None:\n                if not hub.is_running:\n                    raise SAMPHubError(\"Hub is not running\")\n                else:\n                    hub_params = hub.params\n            else:\n                hub_params = get_main_running_hub()\n\n        try:\n\n            url = hub_params[\"samp.hub.xmlrpc.url\"].replace(\"\\\\\", \"\")\n\n            self.proxy = ServerProxyPool(pool_size, xmlrpc.ServerProxy,\n                                         url, allow_none=1)\n\n            self.ping()\n\n            self.lockfile = copy.deepcopy(hub_params)\n            self._connected = True\n\n        except xmlrpc.ProtocolError as p:\n            # 401 Unauthorized\n            if p.errcode == 401:\n                raise SAMPHubError(\"Unauthorized access. Basic Authentication \"\n                                   \"required or failed.\")\n            else:\n                raise SAMPHubError(f\"Protocol Error {p.errcode}: {p.errmsg}\")"},{"col":4,"comment":"\n        Standard callable client ``receive_call`` method.\n\n        This method is automatically handled when the\n        :meth:`~astropy.samp.client.SAMPClient.bind_receive_call` method is\n        used to bind distinct operations to MTypes. In case of a customized\n        callable client implementation that inherits from the\n        :class:`~astropy.samp.SAMPClient` class this method should be\n        overwritten.\n\n        .. note:: When overwritten, this method must always return\n                  a string result (even empty).\n\n        Parameters\n        ----------\n        private_key : str\n            Client private key.\n\n        sender_id : str\n            Sender public ID.\n\n        msg_id : str\n            Message ID received.\n\n        message : dict\n            Received message.\n\n        Returns\n        -------\n        confirmation : str\n            Any confirmation string.\n        ","endLoc":317,"header":"def receive_call(self, private_key, sender_id, msg_id, message)","id":8047,"name":"receive_call","nodeType":"Function","startLoc":284,"text":"def receive_call(self, private_key, sender_id, msg_id, message):\n        \"\"\"\n        Standard callable client ``receive_call`` method.\n\n        This method is automatically handled when the\n        :meth:`~astropy.samp.client.SAMPClient.bind_receive_call` method is\n        used to bind distinct operations to MTypes. In case of a customized\n        callable client implementation that inherits from the\n        :class:`~astropy.samp.SAMPClient` class this method should be\n        overwritten.\n\n        .. note:: When overwritten, this method must always return\n                  a string result (even empty).\n\n        Parameters\n        ----------\n        private_key : str\n            Client private key.\n\n        sender_id : str\n            Sender public ID.\n\n        msg_id : str\n            Message ID received.\n\n        message : dict\n            Received message.\n\n        Returns\n        -------\n        confirmation : str\n            Any confirmation string.\n        \"\"\"\n        return self._handle_call(private_key, sender_id, msg_id, message)"},{"col":4,"comment":"null","endLoc":461,"header":"def _create_secret_code(self)","id":8048,"name":"_create_secret_code","nodeType":"Function","startLoc":457,"text":"def _create_secret_code(self):\n        if self._hub_secret_code_customized is not None:\n            return self._hub_secret_code_customized\n        else:\n            return str(uuid.uuid1())"},{"col":4,"comment":"\n        The unique hub ID.\n        ","endLoc":191,"header":"@property\n    def id(self)","id":8049,"name":"id","nodeType":"Function","startLoc":186,"text":"@property\n    def id(self):\n        \"\"\"\n        The unique hub ID.\n        \"\"\"\n        return self._id"},{"col":4,"comment":"null","endLoc":212,"header":"def _register_standard_api(self, server)","id":8050,"name":"_register_standard_api","nodeType":"Function","startLoc":193,"text":"def _register_standard_api(self, server):\n        # Standard Profile only operations\n        server.register_function(self._ping, 'samp.hub.ping')\n        server.register_function(self._set_xmlrpc_callback, 'samp.hub.setXmlrpcCallback')\n\n        # Standard API operations\n        server.register_function(self._register, 'samp.hub.register')\n        server.register_function(self._unregister, 'samp.hub.unregister')\n        server.register_function(self._declare_metadata, 'samp.hub.declareMetadata')\n        server.register_function(self._get_metadata, 'samp.hub.getMetadata')\n        server.register_function(self._declare_subscriptions, 'samp.hub.declareSubscriptions')\n        server.register_function(self._get_subscriptions, 'samp.hub.getSubscriptions')\n        server.register_function(self._get_registered_clients, 'samp.hub.getRegisteredClients')\n        server.register_function(self._get_subscribed_clients, 'samp.hub.getSubscribedClients')\n        server.register_function(self._notify, 'samp.hub.notify')\n        server.register_function(self._notify_all, 'samp.hub.notifyAll')\n        server.register_function(self._call, 'samp.hub.call')\n        server.register_function(self._call_all, 'samp.hub.callAll')\n        server.register_function(self._call_and_wait, 'samp.hub.callAndWait')\n        server.register_function(self._reply, 'samp.hub.reply')"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":39,"id":8051,"name":"conf","nodeType":"Attribute","startLoc":39,"text":"conf"},{"col":4,"comment":"null","endLoc":324,"header":"def _handle_response(self, private_key, responder_id, msg_tag, response)","id":8052,"name":"_handle_response","nodeType":"Function","startLoc":319,"text":"def _handle_response(self, private_key, responder_id, msg_tag, response):\n        if (private_key == self.get_private_key() and\n            msg_tag in self._response_bindings):\n            self._response_bindings[msg_tag](private_key, responder_id,\n                                    msg_tag, response)\n        return \"\""},{"col":4,"comment":"null","endLoc":234,"header":"def _register_web_profile_api(self, server)","id":8053,"name":"_register_web_profile_api","nodeType":"Function","startLoc":214,"text":"def _register_web_profile_api(self, server):\n        # Web Profile methods like Standard Profile\n        server.register_function(self._ping, 'samp.webhub.ping')\n        server.register_function(self._unregister, 'samp.webhub.unregister')\n        server.register_function(self._declare_metadata, 'samp.webhub.declareMetadata')\n        server.register_function(self._get_metadata, 'samp.webhub.getMetadata')\n        server.register_function(self._declare_subscriptions, 'samp.webhub.declareSubscriptions')\n        server.register_function(self._get_subscriptions, 'samp.webhub.getSubscriptions')\n        server.register_function(self._get_registered_clients, 'samp.webhub.getRegisteredClients')\n        server.register_function(self._get_subscribed_clients, 'samp.webhub.getSubscribedClients')\n        server.register_function(self._notify, 'samp.webhub.notify')\n        server.register_function(self._notify_all, 'samp.webhub.notifyAll')\n        server.register_function(self._call, 'samp.webhub.call')\n        server.register_function(self._call_all, 'samp.webhub.callAll')\n        server.register_function(self._call_and_wait, 'samp.webhub.callAndWait')\n        server.register_function(self._reply, 'samp.webhub.reply')\n\n        # Methods particularly for Web Profile\n        server.register_function(self._web_profile_register, 'samp.webhub.register')\n        server.register_function(self._web_profile_allowReverseCallbacks, 'samp.webhub.allowReverseCallbacks')\n        server.register_function(self._web_profile_pullCallbacks, 'samp.webhub.pullCallbacks')"},{"col":4,"comment":"\n        Proxy to ``ping`` SAMP Hub method (Standard Profile only).\n        ","endLoc":109,"header":"def ping(self)","id":8054,"name":"ping","nodeType":"Function","startLoc":105,"text":"def ping(self):\n        \"\"\"\n        Proxy to ``ping`` SAMP Hub method (Standard Profile only).\n        \"\"\"\n        return self._samp_hub.ping()"},{"col":4,"comment":"\n        Disconnect from the current SAMP Hub.\n        ","endLoc":95,"header":"def disconnect(self)","id":8055,"name":"disconnect","nodeType":"Function","startLoc":87,"text":"def disconnect(self):\n        \"\"\"\n        Disconnect from the current SAMP Hub.\n        \"\"\"\n        if self.proxy is not None:\n            self.proxy.shutdown()\n            self.proxy = None\n        self._connected = False\n        self.lockfile = {}"},{"col":4,"comment":"\n        Standard callable client ``receive_response`` method.\n\n        This method is automatically handled when the\n        :meth:`~astropy.samp.client.SAMPClient.bind_receive_response` method\n        is used to bind distinct operations to MTypes. In case of a customized\n        callable client implementation that inherits from the\n        :class:`~astropy.samp.SAMPClient` class this method should be\n        overwritten.\n\n        .. note:: When overwritten, this method must always return\n                  a string result (even empty).\n\n        Parameters\n        ----------\n        private_key : str\n            Client private key.\n\n        responder_id : str\n            Responder public ID.\n\n        msg_tag : str\n            Response message tag.\n\n        response : dict\n            Received response.\n\n        Returns\n        -------\n        confirmation : str\n            Any confirmation string.\n        ","endLoc":360,"header":"def receive_response(self, private_key, responder_id, msg_tag, response)","id":8056,"name":"receive_response","nodeType":"Function","startLoc":326,"text":"def receive_response(self, private_key, responder_id, msg_tag, response):\n        \"\"\"\n        Standard callable client ``receive_response`` method.\n\n        This method is automatically handled when the\n        :meth:`~astropy.samp.client.SAMPClient.bind_receive_response` method\n        is used to bind distinct operations to MTypes. In case of a customized\n        callable client implementation that inherits from the\n        :class:`~astropy.samp.SAMPClient` class this method should be\n        overwritten.\n\n        .. note:: When overwritten, this method must always return\n                  a string result (even empty).\n\n        Parameters\n        ----------\n        private_key : str\n            Client private key.\n\n        responder_id : str\n            Responder public ID.\n\n        msg_tag : str\n            Response message tag.\n\n        response : dict\n            Received response.\n\n        Returns\n        -------\n        confirmation : str\n            Any confirmation string.\n        \"\"\"\n        return self._handle_response(private_key, responder_id, msg_tag,\n                                     response)"},{"col":0,"comment":"","endLoc":10,"header":"__init__.py#<anonymous>","id":8057,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis subpackage provides classes to communicate with other applications via the\n`Simple Application Messaging Protocol (SAMP)\n<http://www.ivoa.net/documents/SAMP/>`_.\n\nBefore integration into Astropy it was known as\n`SAMPy <https://pypi.org/project/sampy/>`_, and was developed by Luigi Paioro\n(INAF - Istituto Nazionale di Astrofisica).\n\"\"\"\n\nconf = Conf()"},{"col":4,"comment":"\n        Property to abstract away the path to the hub, which allows this class\n        to be used for other profiles.\n        ","endLoc":103,"header":"@property\n    def _samp_hub(self)","id":8058,"name":"_samp_hub","nodeType":"Function","startLoc":97,"text":"@property\n    def _samp_hub(self):\n        \"\"\"\n        Property to abstract away the path to the hub, which allows this class\n        to be used for other profiles.\n        \"\"\"\n        return self.proxy.samp.hub"},{"col":4,"comment":"\n        Proxy to ``setXmlrpcCallback`` SAMP Hub method (Standard Profile only).\n        ","endLoc":115,"header":"def set_xmlrpc_callback(self, private_key, xmlrpc_addr)","id":8059,"name":"set_xmlrpc_callback","nodeType":"Function","startLoc":111,"text":"def set_xmlrpc_callback(self, private_key, xmlrpc_addr):\n        \"\"\"\n        Proxy to ``setXmlrpcCallback`` SAMP Hub method (Standard Profile only).\n        \"\"\"\n        return self._samp_hub.setXmlrpcCallback(private_key, xmlrpc_addr)"},{"col":4,"comment":"\n        Proxy to ``register`` SAMP Hub method.\n        ","endLoc":121,"header":"def register(self, secret)","id":8060,"name":"register","nodeType":"Function","startLoc":117,"text":"def register(self, secret):\n        \"\"\"\n        Proxy to ``register`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.register(secret)"},{"id":8061,"name":"astropy/samp/data","nodeType":"Package"},{"id":8062,"name":"crossdomain.xml","nodeType":"TextFile","path":"astropy/samp/data","text":"<?xml version='1.0'?>\n<!DOCTYPE cross-domain-policy SYSTEM \"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd\">\n<cross-domain-policy>\n  <site-control permitted-cross-domain-policies=\"all\"/>\n  <allow-access-from domain=\"*\"/>\n  <allow-http-request-headers-from domain=\"*\" headers=\"*\"/>\n</cross-domain-policy>\n"},{"col":4,"comment":"\n        Proxy to ``unregister`` SAMP Hub method.\n        ","endLoc":127,"header":"def unregister(self, private_key)","id":8063,"name":"unregister","nodeType":"Function","startLoc":123,"text":"def unregister(self, private_key):\n        \"\"\"\n        Proxy to ``unregister`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.unregister(private_key)"},{"id":8064,"name":"clientaccesspolicy.xml","nodeType":"TextFile","path":"astropy/samp/data","text":"<?xml version='1.0'?>\n<access-policy>\n  <cross-domain-access>\n    <policy>\n      <allow-from>\n        <domain uri=\"*\"/>\n      </allow-from>\n      <grant-to>\n        <resource path=\"/\" include-subpaths=\"true\"/>\n      </grant-to>\n    </policy>\n  </cross-domain-access>\n</access-policy>\n"},{"col":4,"comment":"\n        Proxy to ``declareMetadata`` SAMP Hub method.\n        ","endLoc":133,"header":"def declare_metadata(self, private_key, metadata)","id":8065,"name":"declare_metadata","nodeType":"Function","startLoc":129,"text":"def declare_metadata(self, private_key, metadata):\n        \"\"\"\n        Proxy to ``declareMetadata`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.declareMetadata(private_key, metadata)"},{"col":4,"comment":"\n        Proxy to ``getMetadata`` SAMP Hub method.\n        ","endLoc":139,"header":"def get_metadata(self, private_key, client_id)","id":8066,"name":"get_metadata","nodeType":"Function","startLoc":135,"text":"def get_metadata(self, private_key, client_id):\n        \"\"\"\n        Proxy to ``getMetadata`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.getMetadata(private_key, client_id)"},{"col":4,"comment":"\n        Bind a specific MType to a function or class method, being intended for\n        a call or a notification.\n\n        The function must be of the form::\n\n            def my_function_or_method(<self,> private_key, sender_id, msg_id,\n                                      mtype, params, extra)\n\n        where ``private_key`` is the client private-key, ``sender_id`` is the\n        notification sender ID, ``msg_id`` is the Hub message-id (calls only,\n        otherwise is `None`), ``mtype`` is the message MType, ``params`` is the\n        message parameter set (content of ``\"samp.params\"``) and ``extra`` is a\n        dictionary containing any extra message map entry. The client is\n        automatically declared subscribed to the MType by default.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be caught.\n\n        function : callable\n            Application function to be used when ``mtype`` is received.\n\n        declare : bool, optional\n            Specify whether the client must be automatically declared as\n            subscribed to the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n\n        metadata : dict, optional\n            Dictionary containing additional metadata to declare associated\n            with the MType subscribed to (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        ","endLoc":403,"header":"def bind_receive_message(self, mtype, function, declare=True,\n                             metadata=None)","id":8067,"name":"bind_receive_message","nodeType":"Function","startLoc":362,"text":"def bind_receive_message(self, mtype, function, declare=True,\n                             metadata=None):\n        \"\"\"\n        Bind a specific MType to a function or class method, being intended for\n        a call or a notification.\n\n        The function must be of the form::\n\n            def my_function_or_method(<self,> private_key, sender_id, msg_id,\n                                      mtype, params, extra)\n\n        where ``private_key`` is the client private-key, ``sender_id`` is the\n        notification sender ID, ``msg_id`` is the Hub message-id (calls only,\n        otherwise is `None`), ``mtype`` is the message MType, ``params`` is the\n        message parameter set (content of ``\"samp.params\"``) and ``extra`` is a\n        dictionary containing any extra message map entry. The client is\n        automatically declared subscribed to the MType by default.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be caught.\n\n        function : callable\n            Application function to be used when ``mtype`` is received.\n\n        declare : bool, optional\n            Specify whether the client must be automatically declared as\n            subscribed to the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n\n        metadata : dict, optional\n            Dictionary containing additional metadata to declare associated\n            with the MType subscribed to (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        \"\"\"\n\n        self.bind_receive_call(mtype, function, declare=declare,\n                               metadata=metadata)\n\n        self.bind_receive_notification(mtype, function, declare=declare,\n                                       metadata=metadata)"},{"col":4,"comment":"\n        Proxy to ``declareSubscriptions`` SAMP Hub method.\n        ","endLoc":145,"header":"def declare_subscriptions(self, private_key, subscriptions)","id":8068,"name":"declare_subscriptions","nodeType":"Function","startLoc":141,"text":"def declare_subscriptions(self, private_key, subscriptions):\n        \"\"\"\n        Proxy to ``declareSubscriptions`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.declareSubscriptions(private_key, subscriptions)"},{"col":4,"comment":"\n        Proxy to ``getSubscriptions`` SAMP Hub method.\n        ","endLoc":151,"header":"def get_subscriptions(self, private_key, client_id)","id":8069,"name":"get_subscriptions","nodeType":"Function","startLoc":147,"text":"def get_subscriptions(self, private_key, client_id):\n        \"\"\"\n        Proxy to ``getSubscriptions`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.getSubscriptions(private_key, client_id)"},{"col":4,"comment":"\n        Bind a specific MType call to a function or class method.\n\n        The function must be of the form::\n\n            def my_function_or_method(<self,> private_key, sender_id, msg_id,\n                                      mtype, params, extra)\n\n        where ``private_key`` is the client private-key, ``sender_id`` is the\n        notification sender ID, ``msg_id`` is the Hub message-id, ``mtype`` is\n        the message MType, ``params`` is the message parameter set (content of\n        ``\"samp.params\"``) and ``extra`` is a dictionary containing any extra\n        message map entry. The client is automatically declared subscribed to\n        the MType by default.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be caught.\n\n        function : callable\n            Application function to be used when ``mtype`` is received.\n\n        declare : bool, optional\n            Specify whether the client must be automatically declared as\n            subscribed to the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n\n        metadata : dict, optional\n            Dictionary containing additional metadata to declare associated\n            with the MType subscribed to (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        ","endLoc":488,"header":"def bind_receive_call(self, mtype, function, declare=True, metadata=None)","id":8070,"name":"bind_receive_call","nodeType":"Function","startLoc":447,"text":"def bind_receive_call(self, mtype, function, declare=True, metadata=None):\n        \"\"\"\n        Bind a specific MType call to a function or class method.\n\n        The function must be of the form::\n\n            def my_function_or_method(<self,> private_key, sender_id, msg_id,\n                                      mtype, params, extra)\n\n        where ``private_key`` is the client private-key, ``sender_id`` is the\n        notification sender ID, ``msg_id`` is the Hub message-id, ``mtype`` is\n        the message MType, ``params`` is the message parameter set (content of\n        ``\"samp.params\"``) and ``extra`` is a dictionary containing any extra\n        message map entry. The client is automatically declared subscribed to\n        the MType by default.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be caught.\n\n        function : callable\n            Application function to be used when ``mtype`` is received.\n\n        declare : bool, optional\n            Specify whether the client must be automatically declared as\n            subscribed to the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n\n        metadata : dict, optional\n            Dictionary containing additional metadata to declare associated\n            with the MType subscribed to (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        \"\"\"\n        if self._callable:\n            if not metadata:\n                metadata = {}\n            self._call_bindings[mtype] = [function, metadata]\n            if declare:\n                self._declare_subscriptions()\n        else:\n            raise SAMPClientError(\"Client not callable.\")"},{"col":4,"comment":"\n        Proxy to ``getRegisteredClients`` SAMP Hub method.\n        ","endLoc":157,"header":"def get_registered_clients(self, private_key)","id":8071,"name":"get_registered_clients","nodeType":"Function","startLoc":153,"text":"def get_registered_clients(self, private_key):\n        \"\"\"\n        Proxy to ``getRegisteredClients`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.getRegisteredClients(private_key)"},{"col":4,"comment":"\n        Proxy to ``getSubscribedClients`` SAMP Hub method.\n        ","endLoc":163,"header":"def get_subscribed_clients(self, private_key, mtype)","id":8072,"name":"get_subscribed_clients","nodeType":"Function","startLoc":159,"text":"def get_subscribed_clients(self, private_key, mtype):\n        \"\"\"\n        Proxy to ``getSubscribedClients`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.getSubscribedClients(private_key, mtype)"},{"col":4,"comment":"null","endLoc":674,"header":"def _declare_subscriptions(self, subscriptions=None)","id":8073,"name":"_declare_subscriptions","nodeType":"Function","startLoc":653,"text":"def _declare_subscriptions(self, subscriptions=None):\n        if self.hub.is_connected and self._private_key is not None:\n\n            mtypes_dict = {}\n            # Collect notification mtypes and metadata\n            for mtype in self._notification_bindings.keys():\n                mtypes_dict[mtype] = copy.deepcopy(self._notification_bindings[mtype][1])\n\n            # Collect notification mtypes and metadata\n            for mtype in self._call_bindings.keys():\n                mtypes_dict[mtype] = copy.deepcopy(self._call_bindings[mtype][1])\n\n            # Add optional subscription map\n            if subscriptions:\n                mtypes_dict.update(copy.deepcopy(subscriptions))\n\n            self.hub.declare_subscriptions(self._private_key, mtypes_dict)\n\n        else:\n            raise SAMPClientError(\"Unable to declare subscriptions. Hub \"\n                                  \"unreachable or not connected or client \"\n                                  \"not registered.\")"},{"id":8074,"name":"astropy/samp/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/samp/tests","id":8075,"nodeType":"File","text":""},{"fileName":"web_profile_test_helpers.py","filePath":"astropy/samp/tests","id":8076,"nodeType":"File","text":"import time\nimport threading\nimport xmlrpc.client as xmlrpc\n\nfrom astropy.samp.hub import WebProfileDialog\nfrom astropy.samp.hub_proxy import SAMPHubProxy\nfrom astropy.samp.client import SAMPClient\nfrom astropy.samp.integrated_client import SAMPIntegratedClient\nfrom astropy.samp.utils import ServerProxyPool\nfrom astropy.samp.errors import SAMPClientError, SAMPHubError\n\n\nclass AlwaysApproveWebProfileDialog(WebProfileDialog):\n\n    def __init__(self):\n        self.polling = True\n        WebProfileDialog.__init__(self)\n\n    def show_dialog(self, *args):\n        self.consent()\n\n    def poll(self):\n        while self.polling:\n            self.handle_queue()\n            time.sleep(0.1)\n\n    def stop(self):\n        self.polling = False\n\n\nclass SAMPWebHubProxy(SAMPHubProxy):\n    \"\"\"\n    Proxy class to simplify the client interaction with a SAMP hub (via the web\n    profile).\n\n    In practice web clients should run from the browser, so this is provided as\n    a means of testing a hub's support for the web profile from Python.\n    \"\"\"\n\n    def connect(self, pool_size=20, web_port=21012):\n        \"\"\"\n        Connect to the current SAMP Hub on localhost:web_port\n\n        Parameters\n        ----------\n        pool_size : int, optional\n            The number of socket connections opened to communicate with the\n            Hub.\n        \"\"\"\n\n        self._connected = False\n\n        try:\n            self.proxy = ServerProxyPool(pool_size, xmlrpc.ServerProxy,\n                                         f'http://127.0.0.1:{web_port}',\n                                         allow_none=1)\n            self.ping()\n            self._connected = True\n        except xmlrpc.ProtocolError as p:\n            raise SAMPHubError(f\"Protocol Error {p.errcode}: {p.errmsg}\")\n\n    @property\n    def _samp_hub(self):\n        \"\"\"\n        Property to abstract away the path to the hub, which allows this class\n        to be used for both the standard and the web profile.\n        \"\"\"\n        return self.proxy.samp.webhub\n\n    def set_xmlrpc_callback(self, private_key, xmlrpc_addr):\n        raise NotImplementedError(\"set_xmlrpc_callback is not defined for the \"\n                                  \"web profile\")\n\n    def register(self, identity_info):\n        \"\"\"\n        Proxy to ``register`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.register(identity_info)\n\n    def allow_reverse_callbacks(self, private_key, allow):\n        \"\"\"\n        Proxy to ``allowReverseCallbacks`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.allowReverseCallbacks(private_key, allow)\n\n    def pull_callbacks(self, private_key, timeout):\n        \"\"\"\n        Proxy to ``pullCallbacks`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.pullCallbacks(private_key, timeout)\n\n\nclass SAMPWebClient(SAMPClient):\n    \"\"\"\n    Utility class which provides facilities to create and manage a SAMP\n    compliant XML-RPC server that acts as SAMP callable web client application.\n\n    In practice web clients should run from the browser, so this is provided as\n    a means of testing a hub's support for the web profile from Python.\n\n    Parameters\n    ----------\n    hub : :class:`~astropy.samp.hub_proxy.SAMPWebHubProxy`\n        An instance of :class:`~astropy.samp.hub_proxy.SAMPWebHubProxy` to\n        be used for messaging with the SAMP Hub.\n\n    name : str, optional\n        Client name (corresponding to ``samp.name`` metadata keyword).\n\n    description : str, optional\n        Client description (corresponding to ``samp.description.text`` metadata\n        keyword).\n\n    metadata : dict, optional\n        Client application metadata in the standard SAMP format.\n\n    callable : bool, optional\n        Whether the client can receive calls and notifications. If set to\n        `False`, then the client can send notifications and calls, but can not\n        receive any.\n    \"\"\"\n\n    def __init__(self, hub, name=None, description=None, metadata=None,\n                 callable=True):\n\n        # GENERAL\n        self._is_running = False\n        self._is_registered = False\n\n        if metadata is None:\n            metadata = {}\n\n        if name is not None:\n            metadata[\"samp.name\"] = name\n\n        if description is not None:\n            metadata[\"samp.description.text\"] = description\n\n        self._metadata = metadata\n\n        self._callable = callable\n\n        # HUB INTERACTION\n        self.client = None\n        self._public_id = None\n        self._private_key = None\n        self._hub_id = None\n        self._notification_bindings = {}\n        self._call_bindings = {\"samp.app.ping\": [self._ping, {}],\n                               \"client.env.get\": [self._client_env_get, {}]}\n        self._response_bindings = {}\n\n        self.hub = hub\n\n        self._registration_lock = threading.Lock()\n        self._registered_event = threading.Event()\n        if self._callable:\n            self._thread = threading.Thread(target=self._serve_forever)\n            self._thread.daemon = True\n\n    def _serve_forever(self):\n        while self.is_running:\n            # Wait until we are actually registered before trying to do\n            # anything, to avoid busy looping\n            # Watch for callbacks here\n            self._registered_event.wait()\n            with self._registration_lock:\n                if not self._is_registered:\n                    return\n\n                results = self.hub.pull_callbacks(self.get_private_key(), 0)\n                for result in results:\n                    if result['samp.methodName'] == 'receiveNotification':\n                        self.receive_notification(self._private_key,\n                                                  *result['samp.params'])\n                    elif result['samp.methodName'] == 'receiveCall':\n                        self.receive_call(self._private_key,\n                                          *result['samp.params'])\n                    elif result['samp.methodName'] == 'receiveResponse':\n                        self.receive_response(self._private_key,\n                                              *result['samp.params'])\n\n        self.hub.disconnect()\n\n    def register(self):\n        \"\"\"\n        Register the client to the SAMP Hub.\n        \"\"\"\n        if self.hub.is_connected:\n\n            if self._private_key is not None:\n                raise SAMPClientError(\"Client already registered\")\n\n            result = self.hub.register(\"Astropy SAMP Web Client\")\n\n            if result[\"samp.self-id\"] == \"\":\n                raise SAMPClientError(\"Registation failed - samp.self-id \"\n                                      \"was not set by the hub.\")\n\n            if result[\"samp.private-key\"] == \"\":\n                raise SAMPClientError(\"Registation failed - samp.private-key \"\n                                      \"was not set by the hub.\")\n\n            self._public_id = result[\"samp.self-id\"]\n            self._private_key = result[\"samp.private-key\"]\n            self._hub_id = result[\"samp.hub-id\"]\n\n            if self._callable:\n                self._declare_subscriptions()\n                self.hub.allow_reverse_callbacks(self._private_key, True)\n\n            if self._metadata != {}:\n                self.declare_metadata()\n\n            self._is_registered = True\n            # Let the client thread proceed\n            self._registered_event.set()\n\n        else:\n            raise SAMPClientError(\"Unable to register to the SAMP Hub. Hub \"\n                                  \"proxy not connected.\")\n\n    def unregister(self):\n        # We have to hold the registration lock if the client is callable\n        # to avoid a race condition where the client queries the hub for\n        # pushCallbacks after it has already been unregistered from the hub\n        with self._registration_lock:\n            super().unregister()\n\n\nclass SAMPIntegratedWebClient(SAMPIntegratedClient):\n    \"\"\"\n    A Simple SAMP web client.\n\n    In practice web clients should run from the browser, so this is provided as\n    a means of testing a hub's support for the web profile from Python.\n\n    This class is meant to simplify the client usage providing a proxy class\n    that merges the :class:`~astropy.samp.client.SAMPWebClient` and\n    :class:`~astropy.samp.hub_proxy.SAMPWebHubProxy` functionalities in a\n    simplified API.\n\n    Parameters\n    ----------\n    name : str, optional\n        Client name (corresponding to ``samp.name`` metadata keyword).\n\n    description : str, optional\n        Client description (corresponding to ``samp.description.text`` metadata\n        keyword).\n\n    metadata : dict, optional\n        Client application metadata in the standard SAMP format.\n\n    callable : bool, optional\n        Whether the client can receive calls and notifications. If set to\n        `False`, then the client can send notifications and calls, but can not\n        receive any.\n    \"\"\"\n\n    def __init__(self, name=None, description=None, metadata=None,\n                 callable=True):\n\n        self.hub = SAMPWebHubProxy()\n\n        self.client = SAMPWebClient(self.hub, name, description, metadata,\n                                    callable)\n\n    def connect(self, pool_size=20, web_port=21012):\n        \"\"\"\n        Connect with the current or specified SAMP Hub, start and register the\n        client.\n\n        Parameters\n        ----------\n        pool_size : int, optional\n            The number of socket connections opened to communicate with the\n            Hub.\n        \"\"\"\n        self.hub.connect(pool_size, web_port=web_port)\n        self.client.start()\n        self.client.register()\n"},{"col":4,"comment":"\n        Proxy to ``notify`` SAMP Hub method.\n        ","endLoc":169,"header":"def notify(self, private_key, recipient_id, message)","id":8077,"name":"notify","nodeType":"Function","startLoc":165,"text":"def notify(self, private_key, recipient_id, message):\n        \"\"\"\n        Proxy to ``notify`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.notify(private_key, recipient_id, message)"},{"col":4,"comment":"\n        Proxy to ``notifyAll`` SAMP Hub method.\n        ","endLoc":175,"header":"def notify_all(self, private_key, message)","id":8078,"name":"notify_all","nodeType":"Function","startLoc":171,"text":"def notify_all(self, private_key, message):\n        \"\"\"\n        Proxy to ``notifyAll`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.notifyAll(private_key, message)"},{"col":4,"comment":"\n        Proxy to ``call`` SAMP Hub method.\n        ","endLoc":181,"header":"def call(self, private_key, recipient_id, msg_tag, message)","id":8079,"name":"call","nodeType":"Function","startLoc":177,"text":"def call(self, private_key, recipient_id, msg_tag, message):\n        \"\"\"\n        Proxy to ``call`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.call(private_key, recipient_id, msg_tag, message)"},{"className":"WebProfileDialog","col":0,"comment":"\n    A base class to make writing Web Profile GUI consent dialogs\n    easier.\n\n    The concrete class must:\n\n        1) Poll ``handle_queue`` periodically, using the timer services\n           of the GUI's event loop.  This function will call\n           ``self.show_dialog`` when a request requires authorization.\n           ``self.show_dialog`` will be given the arguments:\n\n              - ``samp_name``: The name of the application making the request.\n\n              - ``details``: A dictionary of details about the client\n                making the request.\n\n              - ``client``: A hostname, port pair containing the client\n                address.\n\n              - ``origin``: A string containing the origin of the\n                request.\n\n        2) Call ``consent`` or ``reject`` based on the user's response to\n           the dialog.\n    ","endLoc":1385,"id":8080,"nodeType":"Class","startLoc":1339,"text":"class WebProfileDialog:\n    \"\"\"\n    A base class to make writing Web Profile GUI consent dialogs\n    easier.\n\n    The concrete class must:\n\n        1) Poll ``handle_queue`` periodically, using the timer services\n           of the GUI's event loop.  This function will call\n           ``self.show_dialog`` when a request requires authorization.\n           ``self.show_dialog`` will be given the arguments:\n\n              - ``samp_name``: The name of the application making the request.\n\n              - ``details``: A dictionary of details about the client\n                making the request.\n\n              - ``client``: A hostname, port pair containing the client\n                address.\n\n              - ``origin``: A string containing the origin of the\n                request.\n\n        2) Call ``consent`` or ``reject`` based on the user's response to\n           the dialog.\n    \"\"\"\n\n    def handle_queue(self):\n        try:\n            request = self.queue_request.get_nowait()\n        except queue.Empty:  # queue is set but empty\n            pass\n        except AttributeError:  # queue has not been set yet\n            pass\n        else:\n            if isinstance(request[0], str):  # To support the old protocol version\n                samp_name = request[0]\n            else:\n                samp_name = request[0][\"samp.name\"]\n\n            self.show_dialog(samp_name, request[0], request[1], request[2])\n\n    def consent(self):\n        self.queue_result.put(True)\n\n    def reject(self):\n        self.queue_result.put(False)"},{"col":4,"comment":"null","endLoc":1379,"header":"def handle_queue(self)","id":8081,"name":"handle_queue","nodeType":"Function","startLoc":1366,"text":"def handle_queue(self):\n        try:\n            request = self.queue_request.get_nowait()\n        except queue.Empty:  # queue is set but empty\n            pass\n        except AttributeError:  # queue has not been set yet\n            pass\n        else:\n            if isinstance(request[0], str):  # To support the old protocol version\n                samp_name = request[0]\n            else:\n                samp_name = request[0][\"samp.name\"]\n\n            self.show_dialog(samp_name, request[0], request[1], request[2])"},{"col":4,"comment":"\n        Proxy to ``callAll`` SAMP Hub method.\n        ","endLoc":187,"header":"def call_all(self, private_key, msg_tag, message)","id":8082,"name":"call_all","nodeType":"Function","startLoc":183,"text":"def call_all(self, private_key, msg_tag, message):\n        \"\"\"\n        Proxy to ``callAll`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.callAll(private_key, msg_tag, message)"},{"col":4,"comment":"\n        Bind a specific MType notification to a function or class method.\n\n        The function must be of the form::\n\n            def my_function_or_method(<self,> private_key, sender_id, mtype,\n                                      params, extra)\n\n        where ``private_key`` is the client private-key, ``sender_id`` is the\n        notification sender ID, ``mtype`` is the message MType, ``params`` is\n        the notified message parameter set (content of ``\"samp.params\"``) and\n        ``extra`` is a dictionary containing any extra message map entry. The\n        client is automatically declared subscribed to the MType by default.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be caught.\n\n        function : callable\n            Application function to be used when ``mtype`` is received.\n\n        declare : bool, optional\n            Specify whether the client must be automatically declared as\n            subscribed to the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n\n        metadata : dict, optional\n            Dictionary containing additional metadata to declare associated\n            with the MType subscribed to (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        ","endLoc":445,"header":"def bind_receive_notification(self, mtype, function, declare=True, metadata=None)","id":8083,"name":"bind_receive_notification","nodeType":"Function","startLoc":405,"text":"def bind_receive_notification(self, mtype, function, declare=True, metadata=None):\n        \"\"\"\n        Bind a specific MType notification to a function or class method.\n\n        The function must be of the form::\n\n            def my_function_or_method(<self,> private_key, sender_id, mtype,\n                                      params, extra)\n\n        where ``private_key`` is the client private-key, ``sender_id`` is the\n        notification sender ID, ``mtype`` is the message MType, ``params`` is\n        the notified message parameter set (content of ``\"samp.params\"``) and\n        ``extra`` is a dictionary containing any extra message map entry. The\n        client is automatically declared subscribed to the MType by default.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be caught.\n\n        function : callable\n            Application function to be used when ``mtype`` is received.\n\n        declare : bool, optional\n            Specify whether the client must be automatically declared as\n            subscribed to the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n\n        metadata : dict, optional\n            Dictionary containing additional metadata to declare associated\n            with the MType subscribed to (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        \"\"\"\n        if self._callable:\n            if not metadata:\n                metadata = {}\n            self._notification_bindings[mtype] = [function, metadata]\n            if declare:\n                self._declare_subscriptions()\n        else:\n            raise SAMPClientError(\"Client not callable.\")"},{"col":4,"comment":"\n        Proxy to ``callAndWait`` SAMP Hub method.\n        ","endLoc":194,"header":"def call_and_wait(self, private_key, recipient_id, message, timeout)","id":8084,"name":"call_and_wait","nodeType":"Function","startLoc":189,"text":"def call_and_wait(self, private_key, recipient_id, message, timeout):\n        \"\"\"\n        Proxy to ``callAndWait`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.callAndWait(private_key, recipient_id, message,\n                                          timeout)"},{"attributeType":"null","col":8,"comment":"null","endLoc":23,"id":8085,"name":"_connected","nodeType":"Attribute","startLoc":23,"text":"self._connected"},{"col":4,"comment":"\n        Bind a specific msg-tag response to a function or class method.\n\n        The function must be of the form::\n\n            def my_function_or_method(<self,> private_key, responder_id,\n                                      msg_tag, response)\n\n        where ``private_key`` is the client private-key, ``responder_id`` is\n        the message responder ID, ``msg_tag`` is the message-tag provided at\n        call time and ``response`` is the response received.\n\n        Parameters\n        ----------\n        msg_tag : str\n            Message-tag to be caught.\n\n        function : callable\n            Application function to be used when ``msg_tag`` is received.\n        ","endLoc":514,"header":"def bind_receive_response(self, msg_tag, function)","id":8086,"name":"bind_receive_response","nodeType":"Function","startLoc":490,"text":"def bind_receive_response(self, msg_tag, function):\n        \"\"\"\n        Bind a specific msg-tag response to a function or class method.\n\n        The function must be of the form::\n\n            def my_function_or_method(<self,> private_key, responder_id,\n                                      msg_tag, response)\n\n        where ``private_key`` is the client private-key, ``responder_id`` is\n        the message responder ID, ``msg_tag`` is the message-tag provided at\n        call time and ``response`` is the response received.\n\n        Parameters\n        ----------\n        msg_tag : str\n            Message-tag to be caught.\n\n        function : callable\n            Application function to be used when ``msg_tag`` is received.\n        \"\"\"\n        if self._callable:\n            self._response_bindings[msg_tag] = function\n        else:\n            raise SAMPClientError(\"Client not callable.\")"},{"attributeType":"None","col":8,"comment":"null","endLoc":22,"id":8087,"name":"proxy","nodeType":"Attribute","startLoc":22,"text":"self.proxy"},{"attributeType":"null","col":8,"comment":"null","endLoc":52,"id":8088,"name":"lockfile","nodeType":"Attribute","startLoc":52,"text":"self.lockfile"},{"col":4,"comment":"\n        Remove from the notifications binding table the specified MType and\n        unsubscribe the client from it (if required).\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be removed.\n\n        declare : bool\n            Specify whether the client must be automatically declared as\n            unsubscribed from the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        ","endLoc":536,"header":"def unbind_receive_notification(self, mtype, declare=True)","id":8089,"name":"unbind_receive_notification","nodeType":"Function","startLoc":516,"text":"def unbind_receive_notification(self, mtype, declare=True):\n        \"\"\"\n        Remove from the notifications binding table the specified MType and\n        unsubscribe the client from it (if required).\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be removed.\n\n        declare : bool\n            Specify whether the client must be automatically declared as\n            unsubscribed from the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        \"\"\"\n        if self._callable:\n            del self._notification_bindings[mtype]\n            if declare:\n                self._declare_subscriptions()\n        else:\n            raise SAMPClientError(\"Client not callable.\")"},{"col":4,"comment":"null","endLoc":1382,"header":"def consent(self)","id":8090,"name":"consent","nodeType":"Function","startLoc":1381,"text":"def consent(self):\n        self.queue_result.put(True)"},{"col":4,"comment":"null","endLoc":1385,"header":"def reject(self)","id":8091,"name":"reject","nodeType":"Function","startLoc":1384,"text":"def reject(self):\n        self.queue_result.put(False)"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":8092,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"col":4,"comment":"\n        Remove from the calls binding table the specified MType and unsubscribe\n        the client from it (if required).\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be removed.\n\n        declare : bool\n            Specify whether the client must be automatically declared as\n            unsubscribed from the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        ","endLoc":558,"header":"def unbind_receive_call(self, mtype, declare=True)","id":8093,"name":"unbind_receive_call","nodeType":"Function","startLoc":538,"text":"def unbind_receive_call(self, mtype, declare=True):\n        \"\"\"\n        Remove from the calls binding table the specified MType and unsubscribe\n        the client from it (if required).\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be removed.\n\n        declare : bool\n            Specify whether the client must be automatically declared as\n            unsubscribed from the MType (see also\n            :meth:`~astropy.samp.client.SAMPClient.declare_subscriptions`).\n        \"\"\"\n        if self._callable:\n            del self._call_bindings[mtype]\n            if declare:\n                self._declare_subscriptions()\n        else:\n            raise SAMPClientError(\"Client not callable.\")"},{"col":4,"comment":"null","endLoc":247,"header":"def _start_standard_server(self)","id":8094,"name":"_start_standard_server","nodeType":"Function","startLoc":236,"text":"def _start_standard_server(self):\n\n        self._server = ThreadingXMLRPCServer(\n                (self._addr or self._host_name, self._port or 0),\n                log, logRequests=False, allow_none=True)\n        prot = 'http'\n\n        self._port = self._server.socket.getsockname()[1]\n        addr = f\"{self._addr or self._host_name}:{self._port}\"\n        self._url = urlunparse((prot, addr, '', '', '', ''))\n        self._server.register_introspection_functions()\n        self._register_standard_api(self._server)"},{"col":0,"comment":"","endLoc":4,"header":"hub_proxy.py#<anonymous>","id":8095,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['SAMPHubProxy']"},{"className":"SAMPIntegratedClient","col":0,"comment":"\n    A Simple SAMP client.\n\n    This class is meant to simplify the client usage providing a proxy class\n    that merges the :class:`~astropy.samp.SAMPClient` and\n    :class:`~astropy.samp.SAMPHubProxy` functionalities in a\n    simplified API.\n\n    Parameters\n    ----------\n    name : str, optional\n        Client name (corresponding to ``samp.name`` metadata keyword).\n\n    description : str, optional\n        Client description (corresponding to ``samp.description.text`` metadata\n        keyword).\n\n    metadata : dict, optional\n        Client application metadata in the standard SAMP format.\n\n    addr : str, optional\n        Listening address (or IP). This defaults to 127.0.0.1 if the internet\n        is not reachable, otherwise it defaults to the host name.\n\n    port : int, optional\n        Listening XML-RPC server socket port. If left set to 0 (the default),\n        the operating system will select a free port.\n\n    callable : bool, optional\n        Whether the client can receive calls and notifications. If set to\n        `False`, then the client can send notifications and calls, but can not\n        receive any.\n    ","endLoc":498,"id":8096,"nodeType":"Class","startLoc":12,"text":"class SAMPIntegratedClient:\n    \"\"\"\n    A Simple SAMP client.\n\n    This class is meant to simplify the client usage providing a proxy class\n    that merges the :class:`~astropy.samp.SAMPClient` and\n    :class:`~astropy.samp.SAMPHubProxy` functionalities in a\n    simplified API.\n\n    Parameters\n    ----------\n    name : str, optional\n        Client name (corresponding to ``samp.name`` metadata keyword).\n\n    description : str, optional\n        Client description (corresponding to ``samp.description.text`` metadata\n        keyword).\n\n    metadata : dict, optional\n        Client application metadata in the standard SAMP format.\n\n    addr : str, optional\n        Listening address (or IP). This defaults to 127.0.0.1 if the internet\n        is not reachable, otherwise it defaults to the host name.\n\n    port : int, optional\n        Listening XML-RPC server socket port. If left set to 0 (the default),\n        the operating system will select a free port.\n\n    callable : bool, optional\n        Whether the client can receive calls and notifications. If set to\n        `False`, then the client can send notifications and calls, but can not\n        receive any.\n    \"\"\"\n\n    def __init__(self, name=None, description=None, metadata=None,\n                 addr=None, port=0, callable=True):\n\n        self.hub = SAMPHubProxy()\n\n        self.client_arguments = {\n            'name': name,\n            'description': description,\n            'metadata': metadata,\n            'addr': addr,\n            'port': port,\n            'callable': callable,\n        }\n        \"\"\"\n        Collected arguments that should be passed on to the SAMPClient below.\n        The SAMPClient used to be instantiated in __init__; however, this\n        caused problems with disconnecting and reconnecting to the HUB.\n        The client_arguments is used to maintain backwards compatibility.\n        \"\"\"\n\n        self.client = None\n        \"The client will be instantiated upon connect().\"\n\n    # GENERAL\n\n    @property\n    def is_connected(self):\n        \"\"\"\n        Testing method to verify the client connection with a running Hub.\n\n        Returns\n        -------\n        is_connected : bool\n            True if the client is connected to a Hub, False otherwise.\n        \"\"\"\n        return self.hub.is_connected and self.client.is_running\n\n    def connect(self, hub=None, hub_params=None, pool_size=20):\n        \"\"\"\n        Connect with the current or specified SAMP Hub, start and register the\n        client.\n\n        Parameters\n        ----------\n        hub : `~astropy.samp.SAMPHubServer`, optional\n            The hub to connect to.\n\n        hub_params : dict, optional\n            Optional dictionary containing the lock-file content of the Hub\n            with which to connect. This dictionary has the form\n            ``{<token-name>: <token-string>, ...}``.\n\n        pool_size : int, optional\n            The number of socket connections opened to communicate with the\n            Hub.\n        \"\"\"\n        self.hub.connect(hub, hub_params, pool_size)\n\n        # The client has to be instantiated here and not in __init__() because\n        # this allows disconnecting and reconnecting to the HUB. Nonetheless,\n        # the client_arguments are set in __init__() because the\n        # instantiation of the client used to happen there and this retains\n        # backwards compatibility.\n        self.client = SAMPClient(\n            self.hub,\n            **self.client_arguments\n        )\n        self.client.start()\n        self.client.register()\n\n    def disconnect(self):\n        \"\"\"\n        Unregister the client from the current SAMP Hub, stop the client and\n        disconnect from the Hub.\n        \"\"\"\n        if self.is_connected:\n            try:\n                self.client.unregister()\n            finally:\n                if self.client.is_running:\n                    self.client.stop()\n                self.hub.disconnect()\n\n    # HUB\n    def ping(self):\n        \"\"\"\n        Proxy to ``ping`` SAMP Hub method (Standard Profile only).\n        \"\"\"\n        return self.hub.ping()\n\n    def declare_metadata(self, metadata):\n        \"\"\"\n        Proxy to ``declareMetadata`` SAMP Hub method.\n        \"\"\"\n        return self.client.declare_metadata(metadata)\n\n    def get_metadata(self, client_id):\n        \"\"\"\n        Proxy to ``getMetadata`` SAMP Hub method.\n        \"\"\"\n        return self.hub.get_metadata(self.get_private_key(), client_id)\n\n    def get_subscriptions(self, client_id):\n        \"\"\"\n        Proxy to ``getSubscriptions`` SAMP Hub method.\n        \"\"\"\n        return self.hub.get_subscriptions(self.get_private_key(), client_id)\n\n    def get_registered_clients(self):\n        \"\"\"\n        Proxy to ``getRegisteredClients`` SAMP Hub method.\n\n        This returns all the registered clients, excluding the current client.\n        \"\"\"\n        return self.hub.get_registered_clients(self.get_private_key())\n\n    def get_subscribed_clients(self, mtype):\n        \"\"\"\n        Proxy to ``getSubscribedClients`` SAMP Hub method.\n        \"\"\"\n        return self.hub.get_subscribed_clients(self.get_private_key(), mtype)\n\n    def _format_easy_msg(self, mtype, params):\n\n        msg = {}\n\n        if \"extra_kws\" in params:\n            extra = params[\"extra_kws\"]\n            del(params[\"extra_kws\"])\n            msg = {\"samp.mtype\": mtype, \"samp.params\": params}\n            msg.update(extra)\n        else:\n            msg = {\"samp.mtype\": mtype, \"samp.params\": params}\n\n        return msg\n\n    def notify(self, recipient_id, message):\n        \"\"\"\n        Proxy to ``notify`` SAMP Hub method.\n        \"\"\"\n        return self.hub.notify(self.get_private_key(), recipient_id, message)\n\n    def enotify(self, recipient_id, mtype, **params):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.notify`.\n\n        This is a proxy to ``notify`` method that allows to send the\n        notification message in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        recipient_id : str\n            Recipient ID\n\n        mtype : str\n            the MType to be notified\n\n        params : dict or set of str\n            Variable keyword set which contains the list of parameters for the\n            specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> cli.enotify(\"samp.msg.progress\", msgid = \"xyz\", txt = \"initialization\",\n        ...             percent = \"10\", extra_kws = {\"my.extra.info\": \"just an example\"})\n        \"\"\"\n        return self.notify(recipient_id, self._format_easy_msg(mtype, params))\n\n    def notify_all(self, message):\n        \"\"\"\n        Proxy to ``notifyAll`` SAMP Hub method.\n        \"\"\"\n        return self.hub.notify_all(self.get_private_key(), message)\n\n    def enotify_all(self, mtype, **params):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.notify_all`.\n\n        This is a proxy to ``notifyAll`` method that allows to send the\n        notification message in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be notified.\n\n        params : dict or set of str\n            Variable keyword set which contains the list of parameters for\n            the specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> cli.enotify_all(\"samp.msg.progress\", txt = \"initialization\",\n        ...                 percent = \"10\",\n        ...                 extra_kws = {\"my.extra.info\": \"just an example\"})\n        \"\"\"\n        return self.notify_all(self._format_easy_msg(mtype, params))\n\n    def call(self, recipient_id, msg_tag, message):\n        \"\"\"\n        Proxy to ``call`` SAMP Hub method.\n        \"\"\"\n        return self.hub.call(self.get_private_key(), recipient_id, msg_tag, message)\n\n    def ecall(self, recipient_id, msg_tag, mtype, **params):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.call`.\n\n        This is a proxy to ``call`` method that allows to send a call message\n        in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        recipient_id : str\n            Recipient ID\n\n        msg_tag : str\n            Message tag to use\n\n        mtype : str\n            MType to be sent\n\n        params : dict of set of str\n            Variable keyword set which contains the list of parameters for\n            the specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> msgid = cli.ecall(\"abc\", \"xyz\", \"samp.msg.progress\",\n        ...                   txt = \"initialization\", percent = \"10\",\n        ...                   extra_kws = {\"my.extra.info\": \"just an example\"})\n        \"\"\"\n\n        return self.call(recipient_id, msg_tag, self._format_easy_msg(mtype, params))\n\n    def call_all(self, msg_tag, message):\n        \"\"\"\n        Proxy to ``callAll`` SAMP Hub method.\n        \"\"\"\n        return self.hub.call_all(self.get_private_key(), msg_tag, message)\n\n    def ecall_all(self, msg_tag, mtype, **params):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.call_all`.\n\n        This is a proxy to ``callAll`` method that allows to send the call\n        message in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        msg_tag : str\n            Message tag to use\n\n        mtype : str\n            MType to be sent\n\n        params : dict of set of str\n            Variable keyword set which contains the list of parameters for\n            the specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> msgid = cli.ecall_all(\"xyz\", \"samp.msg.progress\",\n        ...                       txt = \"initialization\", percent = \"10\",\n        ...                       extra_kws = {\"my.extra.info\": \"just an example\"})\n        \"\"\"\n        self.call_all(msg_tag, self._format_easy_msg(mtype, params))\n\n    def call_and_wait(self, recipient_id, message, timeout):\n        \"\"\"\n        Proxy to ``callAndWait`` SAMP Hub method.\n        \"\"\"\n        return self.hub.call_and_wait(self.get_private_key(), recipient_id, message, timeout)\n\n    def ecall_and_wait(self, recipient_id, mtype, timeout, **params):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.call_and_wait`.\n\n        This is a proxy to ``callAndWait`` method that allows to send the call\n        message in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        recipient_id : str\n            Recipient ID\n\n        mtype : str\n            MType to be sent\n\n        timeout : str\n            Call timeout in seconds\n\n        params : dict of set of str\n            Variable keyword set which contains the list of parameters for\n            the specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> cli.ecall_and_wait(\"xyz\", \"samp.msg.progress\", \"5\",\n        ...                    txt = \"initialization\", percent = \"10\",\n        ...                    extra_kws = {\"my.extra.info\": \"just an example\"})\n        \"\"\"\n        return self.call_and_wait(recipient_id, self._format_easy_msg(mtype, params), timeout)\n\n    def reply(self, msg_id, response):\n        \"\"\"\n        Proxy to ``reply`` SAMP Hub method.\n        \"\"\"\n        return self.hub.reply(self.get_private_key(), msg_id, response)\n\n    def _format_easy_response(self, status, result, error):\n\n        msg = {\"samp.status\": status}\n        if result is not None:\n            msg.update({\"samp.result\": result})\n        if error is not None:\n            msg.update({\"samp.error\": error})\n\n        return msg\n\n    def ereply(self, msg_id, status, result=None, error=None):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.reply`.\n\n        This is a proxy to ``reply`` method that allows to send a reply\n        message in a simplified way.\n\n        Parameters\n        ----------\n        msg_id : str\n            Message ID to which reply.\n\n        status : str\n            Content of the ``samp.status`` response keyword.\n\n        result : dict\n            Content of the ``samp.result`` response keyword.\n\n        error : dict\n            Content of the ``samp.error`` response keyword.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient, SAMP_STATUS_ERROR\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> cli.ereply(\"abd\", SAMP_STATUS_ERROR, result={},\n        ...            error={\"samp.errortxt\": \"Test error message\"})\n        \"\"\"\n        return self.reply(msg_id, self._format_easy_response(status, result, error))\n\n    # CLIENT\n\n    def receive_notification(self, private_key, sender_id, message):\n        return self.client.receive_notification(private_key, sender_id, message)\n\n    receive_notification.__doc__ = SAMPClient.receive_notification.__doc__\n\n    def receive_call(self, private_key, sender_id, msg_id, message):\n        return self.client.receive_call(private_key, sender_id, msg_id, message)\n\n    receive_call.__doc__ = SAMPClient.receive_call.__doc__\n\n    def receive_response(self, private_key, responder_id, msg_tag, response):\n        return self.client.receive_response(private_key, responder_id, msg_tag, response)\n\n    receive_response.__doc__ = SAMPClient.receive_response.__doc__\n\n    def bind_receive_message(self, mtype, function, declare=True, metadata=None):\n        self.client.bind_receive_message(mtype, function, declare=True, metadata=None)\n\n    bind_receive_message.__doc__ = SAMPClient.bind_receive_message.__doc__\n\n    def bind_receive_notification(self, mtype, function, declare=True, metadata=None):\n        self.client.bind_receive_notification(mtype, function, declare, metadata)\n\n    bind_receive_notification.__doc__ = SAMPClient.bind_receive_notification.__doc__\n\n    def bind_receive_call(self, mtype, function, declare=True, metadata=None):\n        self.client.bind_receive_call(mtype, function, declare, metadata)\n\n    bind_receive_call.__doc__ = SAMPClient.bind_receive_call.__doc__\n\n    def bind_receive_response(self, msg_tag, function):\n        self.client.bind_receive_response(msg_tag, function)\n\n    bind_receive_response.__doc__ = SAMPClient.bind_receive_response.__doc__\n\n    def unbind_receive_notification(self, mtype, declare=True):\n        self.client.unbind_receive_notification(mtype, declare)\n\n    unbind_receive_notification.__doc__ = SAMPClient.unbind_receive_notification.__doc__\n\n    def unbind_receive_call(self, mtype, declare=True):\n        self.client.unbind_receive_call(mtype, declare)\n\n    unbind_receive_call.__doc__ = SAMPClient.unbind_receive_call.__doc__\n\n    def unbind_receive_response(self, msg_tag):\n        self.client.unbind_receive_response(msg_tag)\n\n    unbind_receive_response.__doc__ = SAMPClient.unbind_receive_response.__doc__\n\n    def declare_subscriptions(self, subscriptions=None):\n        self.client.declare_subscriptions(subscriptions)\n\n    declare_subscriptions.__doc__ = SAMPClient.declare_subscriptions.__doc__\n\n    def get_private_key(self):\n        return self.client.get_private_key()\n\n    get_private_key.__doc__ = SAMPClient.get_private_key.__doc__\n\n    def get_public_id(self):\n        return self.client.get_public_id()\n\n    get_public_id.__doc__ = SAMPClient.get_public_id.__doc__"},{"col":4,"comment":"\n        Remove from the responses binding table the specified message-tag.\n\n        Parameters\n        ----------\n        msg_tag : str\n            Message-tag to be removed.\n        ","endLoc":572,"header":"def unbind_receive_response(self, msg_tag)","id":8097,"name":"unbind_receive_response","nodeType":"Function","startLoc":560,"text":"def unbind_receive_response(self, msg_tag):\n        \"\"\"\n        Remove from the responses binding table the specified message-tag.\n\n        Parameters\n        ----------\n        msg_tag : str\n            Message-tag to be removed.\n        \"\"\"\n        if self._callable:\n            del self._response_bindings[msg_tag]\n        else:\n            raise SAMPClientError(\"Client not callable.\")"},{"col":4,"comment":"null","endLoc":68,"header":"def __init__(self, name=None, description=None, metadata=None,\n                 addr=None, port=0, callable=True)","id":8098,"name":"__init__","nodeType":"Function","startLoc":47,"text":"def __init__(self, name=None, description=None, metadata=None,\n                 addr=None, port=0, callable=True):\n\n        self.hub = SAMPHubProxy()\n\n        self.client_arguments = {\n            'name': name,\n            'description': description,\n            'metadata': metadata,\n            'addr': addr,\n            'port': port,\n            'callable': callable,\n        }\n        \"\"\"\n        Collected arguments that should be passed on to the SAMPClient below.\n        The SAMPClient used to be instantiated in __init__; however, this\n        caused problems with disconnecting and reconnecting to the HUB.\n        The client_arguments is used to maintain backwards compatibility.\n        \"\"\"\n\n        self.client = None\n        \"The client will be instantiated upon connect().\""},{"col":4,"comment":"\n        Declares the MTypes the client wishes to subscribe to, implicitly\n        defined with the MType binding methods\n        :meth:`~astropy.samp.client.SAMPClient.bind_receive_notification`\n        and :meth:`~astropy.samp.client.SAMPClient.bind_receive_call`.\n\n        An optional ``subscriptions`` map can be added to the final map passed\n        to the :meth:`~astropy.samp.hub_proxy.SAMPHubProxy.declare_subscriptions`\n        method.\n\n        Parameters\n        ----------\n        subscriptions : dict, optional\n            Dictionary containing the list of MTypes to subscribe to, with the\n            same format of the ``subscriptions`` map passed to the\n            :meth:`~astropy.samp.hub_proxy.SAMPHubProxy.declare_subscriptions`\n            method.\n        ","endLoc":596,"header":"def declare_subscriptions(self, subscriptions=None)","id":8099,"name":"declare_subscriptions","nodeType":"Function","startLoc":574,"text":"def declare_subscriptions(self, subscriptions=None):\n        \"\"\"\n        Declares the MTypes the client wishes to subscribe to, implicitly\n        defined with the MType binding methods\n        :meth:`~astropy.samp.client.SAMPClient.bind_receive_notification`\n        and :meth:`~astropy.samp.client.SAMPClient.bind_receive_call`.\n\n        An optional ``subscriptions`` map can be added to the final map passed\n        to the :meth:`~astropy.samp.hub_proxy.SAMPHubProxy.declare_subscriptions`\n        method.\n\n        Parameters\n        ----------\n        subscriptions : dict, optional\n            Dictionary containing the list of MTypes to subscribe to, with the\n            same format of the ``subscriptions`` map passed to the\n            :meth:`~astropy.samp.hub_proxy.SAMPHubProxy.declare_subscriptions`\n            method.\n        \"\"\"\n        if self._callable:\n            self._declare_subscriptions(subscriptions)\n        else:\n            raise SAMPClientError(\"Client not callable.\")"},{"col":4,"comment":"\n        Testing method to verify the client connection with a running Hub.\n\n        Returns\n        -------\n        is_connected : bool\n            True if the client is connected to a Hub, False otherwise.\n        ","endLoc":82,"header":"@property\n    def is_connected(self)","id":8100,"name":"is_connected","nodeType":"Function","startLoc":72,"text":"@property\n    def is_connected(self):\n        \"\"\"\n        Testing method to verify the client connection with a running Hub.\n\n        Returns\n        -------\n        is_connected : bool\n            True if the client is connected to a Hub, False otherwise.\n        \"\"\"\n        return self.hub.is_connected and self.client.is_running"},{"col":4,"comment":"\n        Connect with the current or specified SAMP Hub, start and register the\n        client.\n\n        Parameters\n        ----------\n        hub : `~astropy.samp.SAMPHubServer`, optional\n            The hub to connect to.\n\n        hub_params : dict, optional\n            Optional dictionary containing the lock-file content of the Hub\n            with which to connect. This dictionary has the form\n            ``{<token-name>: <token-string>, ...}``.\n\n        pool_size : int, optional\n            The number of socket connections opened to communicate with the\n            Hub.\n        ","endLoc":115,"header":"def connect(self, hub=None, hub_params=None, pool_size=20)","id":8101,"name":"connect","nodeType":"Function","startLoc":84,"text":"def connect(self, hub=None, hub_params=None, pool_size=20):\n        \"\"\"\n        Connect with the current or specified SAMP Hub, start and register the\n        client.\n\n        Parameters\n        ----------\n        hub : `~astropy.samp.SAMPHubServer`, optional\n            The hub to connect to.\n\n        hub_params : dict, optional\n            Optional dictionary containing the lock-file content of the Hub\n            with which to connect. This dictionary has the form\n            ``{<token-name>: <token-string>, ...}``.\n\n        pool_size : int, optional\n            The number of socket connections opened to communicate with the\n            Hub.\n        \"\"\"\n        self.hub.connect(hub, hub_params, pool_size)\n\n        # The client has to be instantiated here and not in __init__() because\n        # this allows disconnecting and reconnecting to the HUB. Nonetheless,\n        # the client_arguments are set in __init__() because the\n        # instantiation of the client used to happen there and this retains\n        # backwards compatibility.\n        self.client = SAMPClient(\n            self.hub,\n            **self.client_arguments\n        )\n        self.client.start()\n        self.client.register()"},{"col":4,"comment":"\n        Register the client to the SAMP Hub.\n        ","endLoc":632,"header":"def register(self)","id":8102,"name":"register","nodeType":"Function","startLoc":598,"text":"def register(self):\n        \"\"\"\n        Register the client to the SAMP Hub.\n        \"\"\"\n        if self.hub.is_connected:\n\n            if self._private_key is not None:\n                raise SAMPClientError(\"Client already registered\")\n\n            result = self.hub.register(self.hub.lockfile[\"samp.secret\"])\n\n            if result[\"samp.self-id\"] == \"\":\n                raise SAMPClientError(\"Registration failed - \"\n                                      \"samp.self-id was not set by the hub.\")\n\n            if result[\"samp.private-key\"] == \"\":\n                raise SAMPClientError(\"Registration failed - \"\n                                      \"samp.private-key was not set by the hub.\")\n\n            self._public_id = result[\"samp.self-id\"]\n            self._private_key = result[\"samp.private-key\"]\n            self._hub_id = result[\"samp.hub-id\"]\n\n            if self._callable:\n                self._set_xmlrpc_callback()\n                self._declare_subscriptions()\n\n            if self._metadata != {}:\n                self.declare_metadata()\n\n            self._is_registered = True\n\n        else:\n            raise SAMPClientError(\"Unable to register to the SAMP Hub. \"\n                                  \"Hub proxy not connected.\")"},{"col":4,"comment":"\n        Start the current SAMP Hub instance and create the lock file. Hub\n        start-up can be blocking or non blocking depending on the ``wait``\n        parameter.\n\n        Parameters\n        ----------\n        wait : bool\n            If `True` then the Hub process is joined with the caller, blocking\n            the code flow. Usually `True` option is used to run a stand-alone\n            Hub in an executable script. If `False` (default), then the Hub\n            process runs in a separated thread. `False` is usually used in a\n            Python shell.\n        ","endLoc":406,"header":"def start(self, wait=False)","id":8103,"name":"start","nodeType":"Function","startLoc":366,"text":"def start(self, wait=False):\n        \"\"\"\n        Start the current SAMP Hub instance and create the lock file. Hub\n        start-up can be blocking or non blocking depending on the ``wait``\n        parameter.\n\n        Parameters\n        ----------\n        wait : bool\n            If `True` then the Hub process is joined with the caller, blocking\n            the code flow. Usually `True` option is used to run a stand-alone\n            Hub in an executable script. If `False` (default), then the Hub\n            process runs in a separated thread. `False` is usually used in a\n            Python shell.\n        \"\"\"\n\n        if self._is_running:\n            raise SAMPHubError(\"Hub is already running\")\n\n        if self._lockfile is not None:\n            raise SAMPHubError(\"Hub is not running but lockfile is set\")\n\n        if self._web_profile:\n            self._start_web_profile_server()\n\n        self._start_standard_server()\n\n        self._lockfile = create_lock_file(lockfilename=self._customlockfilename,\n                                          mode=self._mode, hub_id=self.id,\n                                          hub_params=self.params)\n\n        self._update_last_activity_time()\n        self._setup_hub_as_client()\n\n        self._start_threads()\n\n        log.info(\"Hub started\")\n\n        if wait and self._is_running:\n            self._thread_run.join()\n            self._thread_run = None"},{"col":4,"comment":"null","endLoc":277,"header":"def _start_web_profile_server(self)","id":8104,"name":"_start_web_profile_server","nodeType":"Function","startLoc":249,"text":"def _start_web_profile_server(self):\n        self._web_profile_requests_queue = queue.Queue(1)\n        self._web_profile_requests_result = queue.Queue(1)\n        self._web_profile_requests_semaphore = queue.Queue(1)\n\n        if self._web_profile_dialog is not None:\n            # TODO: Some sort of duck-typing on the web_profile_dialog object\n            self._web_profile_dialog.queue_request = \\\n                    self._web_profile_requests_queue\n            self._web_profile_dialog.queue_result = \\\n                    self._web_profile_requests_result\n\n        try:\n            self._web_profile_server = WebProfileXMLRPCServer(\n                    ('localhost', self._web_port), log, logRequests=False,\n                    allow_none=True)\n            self._web_port = self._web_profile_server.socket.getsockname()[1]\n            self._web_profile_server.register_introspection_functions()\n            self._register_web_profile_api(self._web_profile_server)\n            log.info(\"Hub set to run with Web Profile support enabled.\")\n        except socket.error:\n            log.warning(\"Port {} already in use. Impossible to run the \"\n                        \"Hub with Web Profile support.\".format(self._web_port),\n                        SAMPWarning)\n            self._web_profile = False\n            # Cleanup\n            self._web_profile_requests_queue = None\n            self._web_profile_requests_result = None\n            self._web_profile_requests_semaphore = None"},{"col":4,"comment":"null","endLoc":294,"header":"def _launch_thread(self, group=None, target=None, name=None, args=None)","id":8105,"name":"_launch_thread","nodeType":"Function","startLoc":279,"text":"def _launch_thread(self, group=None, target=None, name=None, args=None):\n\n        # Remove inactive threads\n        remove = []\n        for t in self._launched_threads:\n            if not t.is_alive():\n                remove.append(t)\n        for t in remove:\n            self._launched_threads.remove(t)\n\n        # Start new thread\n        t = threading.Thread(group=group, target=target, name=name, args=args)\n        t.start()\n\n        # Add to list of launched threads\n        self._launched_threads.append(t)"},{"col":4,"comment":"\n        Unregister the client from the current SAMP Hub, stop the client and\n        disconnect from the Hub.\n        ","endLoc":128,"header":"def disconnect(self)","id":8106,"name":"disconnect","nodeType":"Function","startLoc":117,"text":"def disconnect(self):\n        \"\"\"\n        Unregister the client from the current SAMP Hub, stop the client and\n        disconnect from the Hub.\n        \"\"\"\n        if self.is_connected:\n            try:\n                self.client.unregister()\n            finally:\n                if self.client.is_running:\n                    self.client.stop()\n                self.hub.disconnect()"},{"col":4,"comment":"null","endLoc":298,"header":"def _join_launched_threads(self, timeout=None)","id":8107,"name":"_join_launched_threads","nodeType":"Function","startLoc":296,"text":"def _join_launched_threads(self, timeout=None):\n        for t in self._launched_threads:\n            t.join(timeout=timeout)"},{"id":8108,"name":"astropy/time","nodeType":"Package"},{"fileName":"setup_package.py","filePath":"astropy/time","id":8109,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# Copied from astropy/convolution/setup_package.py\n\nimport os\nfrom setuptools import Extension\n\nimport numpy\n\nC_TIME_PKGDIR = os.path.relpath(os.path.dirname(__file__))\n\nSRC_FILES = [os.path.join(C_TIME_PKGDIR, filename)\n             for filename in ['src/parse_times.c']]\n\n\ndef get_extensions():\n    # Add '-Rpass-missed=.*' to ``extra_compile_args`` when compiling with clang\n    # to report missed optimizations\n    _time_ext = Extension(name='astropy.time._parse_times',\n                          sources=SRC_FILES,\n                          include_dirs=[numpy.get_include()],\n                          language='c')\n\n    return [_time_ext]\n"},{"col":4,"comment":"null","endLoc":651,"header":"def _set_xmlrpc_callback(self)","id":8110,"name":"_set_xmlrpc_callback","nodeType":"Function","startLoc":648,"text":"def _set_xmlrpc_callback(self):\n        if self.hub.is_connected and self._private_key is not None:\n            self.hub.set_xmlrpc_callback(self._private_key,\n                                         self._xmlrpcAddr)"},{"col":4,"comment":"null","endLoc":317,"header":"def _timeout_test_hub(self)","id":8111,"name":"_timeout_test_hub","nodeType":"Function","startLoc":300,"text":"def _timeout_test_hub(self):\n\n        if self._timeout == 0:\n            return\n\n        last = time.time()\n        while self._is_running:\n            time.sleep(0.05)  # keep this small to check _is_running often\n            now = time.time()\n            if now - last > 1.:\n                with self._thread_lock:\n                    if self._last_activity_time is not None:\n                        if now - self._last_activity_time >= self._timeout:\n                            warnings.warn(\"Timeout expired, Hub is shutting down!\",\n                                          SAMPWarning)\n                            self.stop()\n                            return\n                last = now"},{"col":0,"comment":"null","endLoc":24,"header":"def get_extensions()","id":8112,"name":"get_extensions","nodeType":"Function","startLoc":16,"text":"def get_extensions():\n    # Add '-Rpass-missed=.*' to ``extra_compile_args`` when compiling with clang\n    # to report missed optimizations\n    _time_ext = Extension(name='astropy.time._parse_times',\n                          sources=SRC_FILES,\n                          include_dirs=[numpy.get_include()],\n                          language='c')\n\n    return [_time_ext]"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":8113,"name":"C_TIME_PKGDIR","nodeType":"Attribute","startLoc":10,"text":"C_TIME_PKGDIR"},{"col":4,"comment":"\n        Proxy to ``ping`` SAMP Hub method (Standard Profile only).\n        ","endLoc":135,"header":"def ping(self)","id":8114,"name":"ping","nodeType":"Function","startLoc":131,"text":"def ping(self):\n        \"\"\"\n        Proxy to ``ping`` SAMP Hub method (Standard Profile only).\n        \"\"\"\n        return self.hub.ping()"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":8115,"name":"SRC_FILES","nodeType":"Attribute","startLoc":12,"text":"SRC_FILES"},{"attributeType":"null","col":17,"comment":"null","endLoc":13,"id":8116,"name":"filename","nodeType":"Attribute","startLoc":13,"text":"filename"},{"col":0,"comment":"","endLoc":5,"header":"setup_package.py#<anonymous>","id":8117,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"C_TIME_PKGDIR = os.path.relpath(os.path.dirname(__file__))\n\nSRC_FILES = [os.path.join(C_TIME_PKGDIR, filename)\n             for filename in ['src/parse_times.c']]"},{"col":4,"comment":"\n        Proxy to ``declareMetadata`` SAMP Hub method.\n        ","endLoc":141,"header":"def declare_metadata(self, metadata)","id":8118,"name":"declare_metadata","nodeType":"Function","startLoc":137,"text":"def declare_metadata(self, metadata):\n        \"\"\"\n        Proxy to ``declareMetadata`` SAMP Hub method.\n        \"\"\"\n        return self.client.declare_metadata(metadata)"},{"col":4,"comment":"\n        Proxy to ``getMetadata`` SAMP Hub method.\n        ","endLoc":147,"header":"def get_metadata(self, client_id)","id":8119,"name":"get_metadata","nodeType":"Function","startLoc":143,"text":"def get_metadata(self, client_id):\n        \"\"\"\n        Proxy to ``getMetadata`` SAMP Hub method.\n        \"\"\"\n        return self.hub.get_metadata(self.get_private_key(), client_id)"},{"fileName":"__init__.py","filePath":"astropy/time","id":8120,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom astropy import config as _config\n\nclass Conf(_config.ConfigNamespace):  # noqa\n    \"\"\"\n    Configuration parameters for `astropy.table`.\n    \"\"\"\n\n    use_fast_parser = _config.ConfigItem(\n        ['True', 'False', 'force'],\n        \"Use fast C parser for supported time strings formats, including ISO, \"\n        \"ISOT, and YearDayTime. Allowed values are the 'False' (use Python parser),\"\n        \"'True' (use C parser and fall through to Python parser if fails), and \"\n        \"'force' (use C parser and raise exception if it fails). Note that the\"\n        \"options are all strings.\")\n\nconf = Conf()  # noqa\n\nfrom .formats import *  # noqa\nfrom .core import *  # noqa\n"},{"col":4,"comment":"null","endLoc":1241,"header":"def _update_last_activity_time(self, private_key=None)","id":8121,"name":"_update_last_activity_time","nodeType":"Function","startLoc":1237,"text":"def _update_last_activity_time(self, private_key=None):\n        with self._thread_lock:\n            self._last_activity_time = time.time()\n            if private_key is not None:\n                self._client_activity_time[private_key] = time.time()"},{"col":4,"comment":"\n        Proxy to ``getSubscriptions`` SAMP Hub method.\n        ","endLoc":153,"header":"def get_subscriptions(self, client_id)","id":8122,"name":"get_subscriptions","nodeType":"Function","startLoc":149,"text":"def get_subscriptions(self, client_id):\n        \"\"\"\n        Proxy to ``getSubscriptions`` SAMP Hub method.\n        \"\"\"\n        return self.hub.get_subscriptions(self.get_private_key(), client_id)"},{"col":4,"comment":"null","endLoc":364,"header":"def _setup_hub_as_client(self)","id":8123,"name":"_setup_hub_as_client","nodeType":"Function","startLoc":349,"text":"def _setup_hub_as_client(self):\n\n        hub_metadata = {\"samp.name\": \"Astropy SAMP Hub\",\n                        \"samp.description.text\": self._label,\n                        \"author.name\": \"The Astropy Collaboration\",\n                        \"samp.documentation.url\": \"https://docs.astropy.org/en/stable/samp\",\n                        \"samp.icon.url\": self._url + \"/samp/icon\"}\n\n        result = self._register(self._hub_secret)\n        self._hub_public_id = result[\"samp.self-id\"]\n        self._hub_private_key = result[\"samp.private-key\"]\n        self._set_xmlrpc_callback(self._hub_private_key, self._url)\n        self._declare_metadata(self._hub_private_key, hub_metadata)\n        self._declare_subscriptions(self._hub_private_key,\n                                    {\"samp.app.ping\": {},\n                                     \"x-samp.query.by-meta\": {}})"},{"col":0,"comment":"null","endLoc":148,"header":"def _celestial_frame_to_wcs_builtin(frame, projection='TAN')","id":8124,"name":"_celestial_frame_to_wcs_builtin","nodeType":"Function","startLoc":110,"text":"def _celestial_frame_to_wcs_builtin(frame, projection='TAN'):\n\n    # Import astropy.coordinates here to avoid circular imports\n    from astropy.coordinates import FK4, FK5, ICRS, ITRS, BaseRADecFrame, FK4NoETerms, Galactic\n\n    # Create a 2-dimensional WCS\n    wcs = WCS(naxis=2)\n\n    if isinstance(frame, BaseRADecFrame):\n\n        xcoord = 'RA--'\n        ycoord = 'DEC-'\n        if isinstance(frame, ICRS):\n            wcs.wcs.radesys = 'ICRS'\n        elif isinstance(frame, FK4NoETerms):\n            wcs.wcs.radesys = 'FK4-NO-E'\n            wcs.wcs.equinox = frame.equinox.byear\n        elif isinstance(frame, FK4):\n            wcs.wcs.radesys = 'FK4'\n            wcs.wcs.equinox = frame.equinox.byear\n        elif isinstance(frame, FK5):\n            wcs.wcs.radesys = 'FK5'\n            wcs.wcs.equinox = frame.equinox.jyear\n        else:\n            return None\n    elif isinstance(frame, Galactic):\n        xcoord = 'GLON'\n        ycoord = 'GLAT'\n    elif isinstance(frame, ITRS):\n        xcoord = 'TLON'\n        ycoord = 'TLAT'\n        wcs.wcs.radesys = 'ITRS'\n        wcs.wcs.dateobs = frame.obstime.utc.isot\n    else:\n        return None\n\n    wcs.wcs.ctype = [xcoord + '-' + projection, ycoord + '-' + projection]\n\n    return wcs"},{"col":4,"comment":"null","endLoc":708,"header":"def _register(self, secret)","id":8125,"name":"_register","nodeType":"Function","startLoc":702,"text":"def _register(self, secret):\n        self._update_last_activity_time()\n        if secret == self._hub_secret:\n            return self._perform_standard_register()\n        else:\n            # return {\"samp.self-id\": \"\", \"samp.private-key\": \"\", \"samp.hub-id\": \"\"}\n            raise SAMPProxyError(7, \"Bad secret code\")"},{"col":4,"comment":"\n        Proxy to ``getRegisteredClients`` SAMP Hub method.\n\n        This returns all the registered clients, excluding the current client.\n        ","endLoc":161,"header":"def get_registered_clients(self)","id":8126,"name":"get_registered_clients","nodeType":"Function","startLoc":155,"text":"def get_registered_clients(self):\n        \"\"\"\n        Proxy to ``getRegisteredClients`` SAMP Hub method.\n\n        This returns all the registered clients, excluding the current client.\n        \"\"\"\n        return self.hub.get_registered_clients(self.get_private_key())"},{"col":4,"comment":"\n        Declare the client application metadata supported.\n\n        Parameters\n        ----------\n        metadata : dict, optional\n            Dictionary containing the client application metadata as defined in\n            the SAMP definition document. If omitted, then no metadata are\n            declared.\n        ","endLoc":694,"header":"def declare_metadata(self, metadata=None)","id":8127,"name":"declare_metadata","nodeType":"Function","startLoc":676,"text":"def declare_metadata(self, metadata=None):\n        \"\"\"\n        Declare the client application metadata supported.\n\n        Parameters\n        ----------\n        metadata : dict, optional\n            Dictionary containing the client application metadata as defined in\n            the SAMP definition document. If omitted, then no metadata are\n            declared.\n        \"\"\"\n        if self.hub.is_connected and self._private_key is not None:\n            if metadata is not None:\n                self._metadata.update(metadata)\n            self.hub.declare_metadata(self._private_key, self._metadata)\n        else:\n            raise SAMPClientError(\"Unable to declare metadata. Hub \"\n                                  \"unreachable or not connected or client \"\n                                  \"not registered.\")"},{"col":4,"comment":"\n        Proxy to ``getSubscribedClients`` SAMP Hub method.\n        ","endLoc":167,"header":"def get_subscribed_clients(self, mtype)","id":8128,"name":"get_subscribed_clients","nodeType":"Function","startLoc":163,"text":"def get_subscribed_clients(self, mtype):\n        \"\"\"\n        Proxy to ``getSubscribedClients`` SAMP Hub method.\n        \"\"\"\n        return self.hub.get_subscribed_clients(self.get_private_key(), mtype)"},{"col":4,"comment":"null","endLoc":181,"header":"def _format_easy_msg(self, mtype, params)","id":8129,"name":"_format_easy_msg","nodeType":"Function","startLoc":169,"text":"def _format_easy_msg(self, mtype, params):\n\n        msg = {}\n\n        if \"extra_kws\" in params:\n            extra = params[\"extra_kws\"]\n            del(params[\"extra_kws\"])\n            msg = {\"samp.mtype\": mtype, \"samp.params\": params}\n            msg.update(extra)\n        else:\n            msg = {\"samp.mtype\": mtype, \"samp.params\": params}\n\n        return msg"},{"col":4,"comment":"null","endLoc":700,"header":"def _perform_standard_register(self)","id":8130,"name":"_perform_standard_register","nodeType":"Function","startLoc":690,"text":"def _perform_standard_register(self):\n\n        with self._thread_lock:\n            private_key, public_id = self._get_new_ids()\n        self._private_keys[private_key] = (public_id, time.time())\n        self._update_last_activity_time(private_key)\n        self._notify_register(private_key)\n        log.debug(f\"register: private-key = {private_key} and self-id = {public_id}\")\n        return {\"samp.self-id\": public_id,\n                \"samp.private-key\": private_key,\n                \"samp.hub-id\": self._hub_public_id}"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.table`.\n    ","endLoc":15,"id":8131,"nodeType":"Class","startLoc":4,"text":"class Conf(_config.ConfigNamespace):  # noqa\n    \"\"\"\n    Configuration parameters for `astropy.table`.\n    \"\"\"\n\n    use_fast_parser = _config.ConfigItem(\n        ['True', 'False', 'force'],\n        \"Use fast C parser for supported time strings formats, including ISO, \"\n        \"ISOT, and YearDayTime. Allowed values are the 'False' (use Python parser),\"\n        \"'True' (use C parser and fall through to Python parser if fails), and \"\n        \"'force' (use C parser and raise exception if it fails). Note that the\"\n        \"options are all strings.\")"},{"col":4,"comment":"\n        Proxy to ``notify`` SAMP Hub method.\n        ","endLoc":187,"header":"def notify(self, recipient_id, message)","id":8132,"name":"notify","nodeType":"Function","startLoc":183,"text":"def notify(self, recipient_id, message):\n        \"\"\"\n        Proxy to ``notify`` SAMP Hub method.\n        \"\"\"\n        return self.hub.notify(self.get_private_key(), recipient_id, message)"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":9,"id":8133,"name":"use_fast_parser","nodeType":"Attribute","startLoc":9,"text":"use_fast_parser"},{"col":4,"comment":"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.notify`.\n\n        This is a proxy to ``notify`` method that allows to send the\n        notification message in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        recipient_id : str\n            Recipient ID\n\n        mtype : str\n            the MType to be notified\n\n        params : dict or set of str\n            Variable keyword set which contains the list of parameters for the\n            specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> cli.enotify(\"samp.msg.progress\", msgid = \"xyz\", txt = \"initialization\",\n        ...             percent = \"10\", extra_kws = {\"my.extra.info\": \"just an example\"})\n        ","endLoc":220,"header":"def enotify(self, recipient_id, mtype, **params)","id":8134,"name":"enotify","nodeType":"Function","startLoc":189,"text":"def enotify(self, recipient_id, mtype, **params):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.notify`.\n\n        This is a proxy to ``notify`` method that allows to send the\n        notification message in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        recipient_id : str\n            Recipient ID\n\n        mtype : str\n            the MType to be notified\n\n        params : dict or set of str\n            Variable keyword set which contains the list of parameters for the\n            specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> cli.enotify(\"samp.msg.progress\", msgid = \"xyz\", txt = \"initialization\",\n        ...             percent = \"10\", extra_kws = {\"my.extra.info\": \"just an example\"})\n        \"\"\"\n        return self.notify(recipient_id, self._format_easy_msg(mtype, params))"},{"col":4,"comment":"null","endLoc":717,"header":"def _get_new_ids(self)","id":8135,"name":"_get_new_ids","nodeType":"Function","startLoc":710,"text":"def _get_new_ids(self):\n        private_key = str(uuid.uuid1())\n        self._client_id_counter += 1\n        public_id = 'cli#hub'\n        if self._client_id_counter > 0:\n            public_id = f\"cli#{self._client_id_counter}\"\n\n        return private_key, public_id"},{"col":4,"comment":"\n        Proxy to ``notifyAll`` SAMP Hub method.\n        ","endLoc":226,"header":"def notify_all(self, message)","id":8136,"name":"notify_all","nodeType":"Function","startLoc":222,"text":"def notify_all(self, message):\n        \"\"\"\n        Proxy to ``notifyAll`` SAMP Hub method.\n        \"\"\"\n        return self.hub.notify_all(self.get_private_key(), message)"},{"col":4,"comment":"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.notify_all`.\n\n        This is a proxy to ``notifyAll`` method that allows to send the\n        notification message in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be notified.\n\n        params : dict or set of str\n            Variable keyword set which contains the list of parameters for\n            the specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> cli.enotify_all(\"samp.msg.progress\", txt = \"initialization\",\n        ...                 percent = \"10\",\n        ...                 extra_kws = {\"my.extra.info\": \"just an example\"})\n        ","endLoc":257,"header":"def enotify_all(self, mtype, **params)","id":8137,"name":"enotify_all","nodeType":"Function","startLoc":228,"text":"def enotify_all(self, mtype, **params):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.notify_all`.\n\n        This is a proxy to ``notifyAll`` method that allows to send the\n        notification message in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        mtype : str\n            MType to be notified.\n\n        params : dict or set of str\n            Variable keyword set which contains the list of parameters for\n            the specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> cli.enotify_all(\"samp.msg.progress\", txt = \"initialization\",\n        ...                 percent = \"10\",\n        ...                 extra_kws = {\"my.extra.info\": \"just an example\"})\n        \"\"\"\n        return self.notify_all(self._format_easy_msg(mtype, params))"},{"col":4,"comment":"null","endLoc":590,"header":"def _notify_register(self, private_key)","id":8138,"name":"_notify_register","nodeType":"Function","startLoc":580,"text":"def _notify_register(self, private_key):\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.event.register\")\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                public_id = self._private_keys[private_key][0]\n                for key in self._mtype2ids[mtype]:\n                    # if key != private_key:\n                    self._notify(self._hub_private_key,\n                                 self._private_keys[key][0],\n                                 {\"samp.mtype\": \"samp.hub.event.register\",\n                                  \"samp.params\": {\"id\": public_id}})"},{"col":4,"comment":"\n        Proxy to ``call`` SAMP Hub method.\n        ","endLoc":263,"header":"def call(self, recipient_id, msg_tag, message)","id":8139,"name":"call","nodeType":"Function","startLoc":259,"text":"def call(self, recipient_id, msg_tag, message):\n        \"\"\"\n        Proxy to ``call`` SAMP Hub method.\n        \"\"\"\n        return self.hub.call(self.get_private_key(), recipient_id, msg_tag, message)"},{"col":4,"comment":"\n        Stop the current SAMP Hub instance and delete the lock file.\n        ","endLoc":497,"header":"def stop(self)","id":8140,"name":"stop","nodeType":"Function","startLoc":463,"text":"def stop(self):\n        \"\"\"\n        Stop the current SAMP Hub instance and delete the lock file.\n        \"\"\"\n\n        if not self._is_running:\n            return\n\n        log.info(\"Hub is stopping...\")\n\n        self._notify_shutdown()\n\n        self._is_running = False\n\n        if self._lockfile and os.path.isfile(self._lockfile):\n            lockfiledict = read_lockfile(self._lockfile)\n            if lockfiledict['samp.secret'] == self._hub_secret:\n                os.remove(self._lockfile)\n        self._lockfile = None\n\n        # Reset variables\n        # TODO: What happens if not all threads are stopped after timeout?\n        self._join_all_threads(timeout=10.)\n\n        self._hub_msg_id_counter = 0\n        self._hub_secret = self._create_secret_code()\n        self._hub_public_id = \"\"\n        self._metadata = {}\n        self._private_keys = {}\n        self._mtype2ids = {}\n        self._id2mtypes = {}\n        self._xmlrpc_endpoints = {}\n        self._last_activity_time = None\n\n        log.info(\"Hub stopped.\")"},{"col":4,"comment":"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.call`.\n\n        This is a proxy to ``call`` method that allows to send a call message\n        in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        recipient_id : str\n            Recipient ID\n\n        msg_tag : str\n            Message tag to use\n\n        mtype : str\n            MType to be sent\n\n        params : dict of set of str\n            Variable keyword set which contains the list of parameters for\n            the specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> msgid = cli.ecall(\"abc\", \"xyz\", \"samp.msg.progress\",\n        ...                   txt = \"initialization\", percent = \"10\",\n        ...                   extra_kws = {\"my.extra.info\": \"just an example\"})\n        ","endLoc":301,"header":"def ecall(self, recipient_id, msg_tag, mtype, **params)","id":8141,"name":"ecall","nodeType":"Function","startLoc":265,"text":"def ecall(self, recipient_id, msg_tag, mtype, **params):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.call`.\n\n        This is a proxy to ``call`` method that allows to send a call message\n        in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        recipient_id : str\n            Recipient ID\n\n        msg_tag : str\n            Message tag to use\n\n        mtype : str\n            MType to be sent\n\n        params : dict of set of str\n            Variable keyword set which contains the list of parameters for\n            the specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> msgid = cli.ecall(\"abc\", \"xyz\", \"samp.msg.progress\",\n        ...                   txt = \"initialization\", percent = \"10\",\n        ...                   extra_kws = {\"my.extra.info\": \"just an example\"})\n        \"\"\"\n\n        return self.call(recipient_id, msg_tag, self._format_easy_msg(mtype, params))"},{"col":4,"comment":"null","endLoc":959,"header":"def _notify(self, private_key, recipient_id, message)","id":8142,"name":"_notify","nodeType":"Function","startLoc":945,"text":"def _notify(self, private_key, recipient_id, message):\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            if self._is_subscribed(self._public_id_to_private_key(recipient_id),\n                                   message[\"samp.mtype\"]) is False:\n                raise SAMPProxyError(2, \"Client {} not subscribed to MType {}\"\n                                    .format(recipient_id, message[\"samp.mtype\"]))\n\n            self._launch_thread(target=self._notify_, args=(private_key,\n                                                            recipient_id,\n                                                            message))\n            return {}\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")"},{"col":4,"comment":"null","endLoc":578,"header":"def _notify_shutdown(self)","id":8143,"name":"_notify_shutdown","nodeType":"Function","startLoc":570,"text":"def _notify_shutdown(self):\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.event.shutdown\")\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                for key in self._mtype2ids[mtype]:\n                    self._notify_(self._hub_private_key,\n                                  self._private_keys[key][0],\n                                  {\"samp.mtype\": \"samp.hub.event.shutdown\",\n                                   \"samp.params\": {}})"},{"col":4,"comment":"\n        Proxy to ``callAll`` SAMP Hub method.\n        ","endLoc":307,"header":"def call_all(self, msg_tag, message)","id":8144,"name":"call_all","nodeType":"Function","startLoc":303,"text":"def call_all(self, msg_tag, message):\n        \"\"\"\n        Proxy to ``callAll`` SAMP Hub method.\n        \"\"\"\n        return self.hub.call_all(self.get_private_key(), msg_tag, message)"},{"col":4,"comment":"null","endLoc":1228,"header":"def _public_id_to_private_key(self, public_id)","id":8145,"name":"_public_id_to_private_key","nodeType":"Function","startLoc":1223,"text":"def _public_id_to_private_key(self, public_id):\n\n        for private_key in self._private_keys.keys():\n            if self._private_keys[private_key][0] == public_id:\n                return private_key\n        return None"},{"col":4,"comment":"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.call_all`.\n\n        This is a proxy to ``callAll`` method that allows to send the call\n        message in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        msg_tag : str\n            Message tag to use\n\n        mtype : str\n            MType to be sent\n\n        params : dict of set of str\n            Variable keyword set which contains the list of parameters for\n            the specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> msgid = cli.ecall_all(\"xyz\", \"samp.msg.progress\",\n        ...                       txt = \"initialization\", percent = \"10\",\n        ...                       extra_kws = {\"my.extra.info\": \"just an example\"})\n        ","endLoc":341,"header":"def ecall_all(self, msg_tag, mtype, **params)","id":8146,"name":"ecall_all","nodeType":"Function","startLoc":309,"text":"def ecall_all(self, msg_tag, mtype, **params):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.call_all`.\n\n        This is a proxy to ``callAll`` method that allows to send the call\n        message in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        msg_tag : str\n            Message tag to use\n\n        mtype : str\n            MType to be sent\n\n        params : dict of set of str\n            Variable keyword set which contains the list of parameters for\n            the specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> msgid = cli.ecall_all(\"xyz\", \"samp.msg.progress\",\n        ...                       txt = \"initialization\", percent = \"10\",\n        ...                       extra_kws = {\"my.extra.info\": \"just an example\"})\n        \"\"\"\n        self.call_all(msg_tag, self._format_easy_msg(mtype, params))"},{"col":4,"comment":"null","endLoc":943,"header":"def _is_subscribed(self, private_key, mtype)","id":8147,"name":"_is_subscribed","nodeType":"Function","startLoc":932,"text":"def _is_subscribed(self, private_key, mtype):\n\n        subscribed = False\n\n        msubs = SAMPHubServer.get_mtype_subtypes(mtype)\n\n        for msub in msubs:\n            if msub in self._mtype2ids:\n                if private_key in self._mtype2ids[msub]:\n                    subscribed = True\n\n        return subscribed"},{"col":4,"comment":"\n        Proxy to ``callAndWait`` SAMP Hub method.\n        ","endLoc":347,"header":"def call_and_wait(self, recipient_id, message, timeout)","id":8148,"name":"call_and_wait","nodeType":"Function","startLoc":343,"text":"def call_and_wait(self, recipient_id, message, timeout):\n        \"\"\"\n        Proxy to ``callAndWait`` SAMP Hub method.\n        \"\"\"\n        return self.hub.call_and_wait(self.get_private_key(), recipient_id, message, timeout)"},{"col":4,"comment":"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.call_and_wait`.\n\n        This is a proxy to ``callAndWait`` method that allows to send the call\n        message in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        recipient_id : str\n            Recipient ID\n\n        mtype : str\n            MType to be sent\n\n        timeout : str\n            Call timeout in seconds\n\n        params : dict of set of str\n            Variable keyword set which contains the list of parameters for\n            the specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> cli.ecall_and_wait(\"xyz\", \"samp.msg.progress\", \"5\",\n        ...                    txt = \"initialization\", percent = \"10\",\n        ...                    extra_kws = {\"my.extra.info\": \"just an example\"})\n        ","endLoc":384,"header":"def ecall_and_wait(self, recipient_id, mtype, timeout, **params)","id":8149,"name":"ecall_and_wait","nodeType":"Function","startLoc":349,"text":"def ecall_and_wait(self, recipient_id, mtype, timeout, **params):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.call_and_wait`.\n\n        This is a proxy to ``callAndWait`` method that allows to send the call\n        message in a simplified way.\n\n        Note that reserved ``extra_kws`` keyword is a dictionary with the\n        special meaning of being used to add extra keywords, in addition to\n        the standard ``samp.mtype`` and ``samp.params``, to the message sent.\n\n        Parameters\n        ----------\n        recipient_id : str\n            Recipient ID\n\n        mtype : str\n            MType to be sent\n\n        timeout : str\n            Call timeout in seconds\n\n        params : dict of set of str\n            Variable keyword set which contains the list of parameters for\n            the specified MType.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> cli.ecall_and_wait(\"xyz\", \"samp.msg.progress\", \"5\",\n        ...                    txt = \"initialization\", percent = \"10\",\n        ...                    extra_kws = {\"my.extra.info\": \"just an example\"})\n        \"\"\"\n        return self.call_and_wait(recipient_id, self._format_easy_msg(mtype, params), timeout)"},{"col":4,"comment":"null","endLoc":688,"header":"def _set_xmlrpc_callback(self, private_key, xmlrpc_addr)","id":8150,"name":"_set_xmlrpc_callback","nodeType":"Function","startLoc":663,"text":"def _set_xmlrpc_callback(self, private_key, xmlrpc_addr):\n        self._update_last_activity_time(private_key)\n        if private_key in self._private_keys:\n            if private_key == self._hub_private_key:\n                public_id = self._private_keys[private_key][0]\n                self._xmlrpc_endpoints[public_id] = \\\n                    (xmlrpc_addr, _HubAsClient(self._hub_as_client_request_handler))\n                return \"\"\n\n            # Dictionary stored with the public id\n\n            log.debug(f\"set_xmlrpc_callback: {private_key} {xmlrpc_addr}\")\n\n            server_proxy_pool = None\n\n            server_proxy_pool = ServerProxyPool(self._pool_size,\n                                                xmlrpc.ServerProxy,\n                                                xmlrpc_addr, allow_none=1)\n\n            public_id = self._private_keys[private_key][0]\n            self._xmlrpc_endpoints[public_id] = (xmlrpc_addr,\n                                                server_proxy_pool)\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n        return \"\""},{"col":4,"comment":"\n        Proxy to ``reply`` SAMP Hub method.\n        ","endLoc":390,"header":"def reply(self, msg_id, response)","id":8151,"name":"reply","nodeType":"Function","startLoc":386,"text":"def reply(self, msg_id, response):\n        \"\"\"\n        Proxy to ``reply`` SAMP Hub method.\n        \"\"\"\n        return self.hub.reply(self.get_private_key(), msg_id, response)"},{"col":4,"comment":"\n        Unregister the client from the SAMP Hub.\n        ","endLoc":646,"header":"def unregister(self)","id":8152,"name":"unregister","nodeType":"Function","startLoc":634,"text":"def unregister(self):\n        \"\"\"\n        Unregister the client from the SAMP Hub.\n        \"\"\"\n        if self.hub.is_connected:\n            self._is_registered = False\n            self.hub.unregister(self._private_key)\n            self._hub_id = None\n            self._public_id = None\n            self._private_key = None\n        else:\n            raise SAMPClientError(\"Unable to unregister from the SAMP Hub. \"\n                                  \"Hub proxy not connected.\")"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":17,"id":8153,"name":"conf","nodeType":"Attribute","startLoc":17,"text":"conf"},{"col":4,"comment":"\n        Return public client ID obtained at registration time\n        (``samp.self-id``).\n\n        Returns\n        -------\n        id : str\n            Client public ID.\n        ","endLoc":718,"header":"def get_public_id(self)","id":8154,"name":"get_public_id","nodeType":"Function","startLoc":708,"text":"def get_public_id(self):\n        \"\"\"\n        Return public client ID obtained at registration time\n        (``samp.self-id``).\n\n        Returns\n        -------\n        id : str\n            Client public ID.\n        \"\"\"\n        return self._public_id"},{"attributeType":"null","col":8,"comment":"null","endLoc":87,"id":8155,"name":"_hub_id","nodeType":"Attribute","startLoc":87,"text":"self._hub_id"},{"col":0,"comment":"","endLoc":2,"header":"__init__.py#<anonymous>","id":8156,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"conf = Conf()  # noqa"},{"attributeType":"null","col":8,"comment":"null","endLoc":85,"id":8157,"name":"_public_id","nodeType":"Attribute","startLoc":85,"text":"self._public_id"},{"fileName":"core.py","filePath":"astropy/time","id":8158,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThe astropy.time package provides functionality for manipulating times and\ndates. Specific emphasis is placed on supporting time scales (e.g. UTC, TAI,\nUT1) and time representations (e.g. JD, MJD, ISO 8601) that are used in\nastronomy.\n\"\"\"\n\nimport os\nimport copy\nimport enum\nimport operator\nimport threading\nfrom datetime import datetime, date, timedelta\nfrom time import strftime\nfrom warnings import warn\n\nimport numpy as np\nimport erfa\n\nfrom astropy import units as u, constants as const\nfrom astropy.units import UnitConversionError\nfrom astropy.utils import ShapedLikeNDArray\nfrom astropy.utils.compat.misc import override__dir__\nfrom astropy.utils.data_info import MixinInfo, data_info_factory\nfrom astropy.utils.exceptions import AstropyDeprecationWarning, AstropyWarning\nfrom .utils import day_frac\nfrom .formats import (TIME_FORMATS, TIME_DELTA_FORMATS,\n                      TimeJD, TimeUnique, TimeAstropyTime, TimeDatetime)\n# Import TimeFromEpoch to avoid breaking code that followed the old example of\n# making a custom timescale in the documentation.\nfrom .formats import TimeFromEpoch  # noqa\n\nfrom astropy.extern import _strptime\n\n__all__ = ['TimeBase', 'Time', 'TimeDelta', 'TimeInfo', 'update_leap_seconds',\n           'TIME_SCALES', 'STANDARD_TIME_SCALES', 'TIME_DELTA_SCALES',\n           'ScaleValueError', 'OperandTypeError', 'TimeDeltaMissingUnitWarning']\n\n\nSTANDARD_TIME_SCALES = ('tai', 'tcb', 'tcg', 'tdb', 'tt', 'ut1', 'utc')\nLOCAL_SCALES = ('local',)\nTIME_TYPES = dict((scale, scales) for scales in (STANDARD_TIME_SCALES, LOCAL_SCALES)\n                  for scale in scales)\nTIME_SCALES = STANDARD_TIME_SCALES + LOCAL_SCALES\nMULTI_HOPS = {('tai', 'tcb'): ('tt', 'tdb'),\n              ('tai', 'tcg'): ('tt',),\n              ('tai', 'ut1'): ('utc',),\n              ('tai', 'tdb'): ('tt',),\n              ('tcb', 'tcg'): ('tdb', 'tt'),\n              ('tcb', 'tt'): ('tdb',),\n              ('tcb', 'ut1'): ('tdb', 'tt', 'tai', 'utc'),\n              ('tcb', 'utc'): ('tdb', 'tt', 'tai'),\n              ('tcg', 'tdb'): ('tt',),\n              ('tcg', 'ut1'): ('tt', 'tai', 'utc'),\n              ('tcg', 'utc'): ('tt', 'tai'),\n              ('tdb', 'ut1'): ('tt', 'tai', 'utc'),\n              ('tdb', 'utc'): ('tt', 'tai'),\n              ('tt', 'ut1'): ('tai', 'utc'),\n              ('tt', 'utc'): ('tai',),\n              }\nGEOCENTRIC_SCALES = ('tai', 'tt', 'tcg')\nBARYCENTRIC_SCALES = ('tcb', 'tdb')\nROTATIONAL_SCALES = ('ut1',)\nTIME_DELTA_TYPES = dict((scale, scales)\n                        for scales in (GEOCENTRIC_SCALES, BARYCENTRIC_SCALES,\n                                       ROTATIONAL_SCALES, LOCAL_SCALES) for scale in scales)\nTIME_DELTA_SCALES = GEOCENTRIC_SCALES + BARYCENTRIC_SCALES + ROTATIONAL_SCALES + LOCAL_SCALES\n# For time scale changes, we need L_G and L_B, which are stored in erfam.h as\n#   /* L_G = 1 - d(TT)/d(TCG) */\n#   define ERFA_ELG (6.969290134e-10)\n#   /* L_B = 1 - d(TDB)/d(TCB), and TDB (s) at TAI 1977/1/1.0 */\n#   define ERFA_ELB (1.550519768e-8)\n# These are exposed in erfa as erfa.ELG and erfa.ELB.\n# Implied: d(TT)/d(TCG) = 1-L_G\n# and      d(TCG)/d(TT) = 1/(1-L_G) = 1 + (1-(1-L_G))/(1-L_G) = 1 + L_G/(1-L_G)\n# scale offsets as second = first + first * scale_offset[(first,second)]\nSCALE_OFFSETS = {('tt', 'tai'): None,\n                 ('tai', 'tt'): None,\n                 ('tcg', 'tt'): -erfa.ELG,\n                 ('tt', 'tcg'): erfa.ELG / (1. - erfa.ELG),\n                 ('tcg', 'tai'): -erfa.ELG,\n                 ('tai', 'tcg'): erfa.ELG / (1. - erfa.ELG),\n                 ('tcb', 'tdb'): -erfa.ELB,\n                 ('tdb', 'tcb'): erfa.ELB / (1. - erfa.ELB)}\n\n# triple-level dictionary, yay!\nSIDEREAL_TIME_MODELS = {\n    'mean': {\n        'IAU2006': {'function': erfa.gmst06, 'scales': ('ut1', 'tt')},\n        'IAU2000': {'function': erfa.gmst00, 'scales': ('ut1', 'tt')},\n        'IAU1982': {'function': erfa.gmst82, 'scales': ('ut1',), 'include_tio': False}\n    },\n    'apparent': {\n        'IAU2006A': {'function': erfa.gst06a, 'scales': ('ut1', 'tt')},\n        'IAU2000A': {'function': erfa.gst00a, 'scales': ('ut1', 'tt')},\n        'IAU2000B': {'function': erfa.gst00b, 'scales': ('ut1',)},\n        'IAU1994': {'function': erfa.gst94, 'scales': ('ut1',), 'include_tio': False}\n    }}\n\n\nclass _LeapSecondsCheck(enum.Enum):\n    NOT_STARTED = 0     # No thread has reached the check\n    RUNNING = 1         # A thread is running update_leap_seconds (_LEAP_SECONDS_LOCK is held)\n    DONE = 2            # update_leap_seconds has completed\n\n\n_LEAP_SECONDS_CHECK = _LeapSecondsCheck.NOT_STARTED\n_LEAP_SECONDS_LOCK = threading.RLock()\n\n\nclass TimeInfo(MixinInfo):\n    \"\"\"\n    Container for meta information like name, description, format.  This is\n    required when the object is used as a mixin column within a table, but can\n    be used as a general way to store meta information.\n    \"\"\"\n    attr_names = MixinInfo.attr_names | {'serialize_method'}\n    _supports_indexing = True\n\n    # The usual tuple of attributes needed for serialization is replaced\n    # by a property, since Time can be serialized different ways.\n    _represent_as_dict_extra_attrs = ('format', 'scale', 'precision',\n                                      'in_subfmt', 'out_subfmt', 'location',\n                                      '_delta_ut1_utc', '_delta_tdb_tt')\n\n    # When serializing, write out the `value` attribute using the column name.\n    _represent_as_dict_primary_data = 'value'\n\n    mask_val = np.ma.masked\n\n    @property\n    def _represent_as_dict_attrs(self):\n        method = self.serialize_method[self._serialize_context]\n        if method == 'formatted_value':\n            out = ('value',)\n        elif method == 'jd1_jd2':\n            out = ('jd1', 'jd2')\n        else:\n            raise ValueError(\"serialize method must be 'formatted_value' or 'jd1_jd2'\")\n\n        return out + self._represent_as_dict_extra_attrs\n\n    def __init__(self, bound=False):\n        super().__init__(bound)\n\n        # If bound to a data object instance then create the dict of attributes\n        # which stores the info attribute values.\n        if bound:\n            # Specify how to serialize this object depending on context.\n            # If ``True`` for a context, then use formatted ``value`` attribute\n            # (e.g. the ISO time string).  If ``False`` then use float jd1 and jd2.\n            self.serialize_method = {'fits': 'jd1_jd2',\n                                     'ecsv': 'formatted_value',\n                                     'hdf5': 'jd1_jd2',\n                                     'yaml': 'jd1_jd2',\n                                     'parquet': 'jd1_jd2',\n                                     None: 'jd1_jd2'}\n\n    def get_sortable_arrays(self):\n        \"\"\"\n        Return a list of arrays which can be lexically sorted to represent\n        the order of the parent column.\n\n        Returns\n        -------\n        arrays : list of ndarray\n        \"\"\"\n        parent = self._parent\n        jd_approx = parent.jd\n        jd_remainder = (parent - parent.__class__(jd_approx, format='jd')).jd\n        return [jd_approx, jd_remainder]\n\n    @property\n    def unit(self):\n        return None\n\n    info_summary_stats = staticmethod(\n        data_info_factory(names=MixinInfo._stats,\n                          funcs=[getattr(np, stat) for stat in MixinInfo._stats]))\n    # When Time has mean, std, min, max methods:\n    # funcs = [lambda x: getattr(x, stat)() for stat_name in MixinInfo._stats])\n\n    def _construct_from_dict_base(self, map):\n        if 'jd1' in map and 'jd2' in map:\n            # Initialize as JD but revert to desired format and out_subfmt (if needed)\n            format = map.pop('format')\n            out_subfmt = map.pop('out_subfmt', None)\n            map['format'] = 'jd'\n            map['val'] = map.pop('jd1')\n            map['val2'] = map.pop('jd2')\n            out = self._parent_cls(**map)\n            out.format = format\n            if out_subfmt is not None:\n                out.out_subfmt = out_subfmt\n\n        else:\n            map['val'] = map.pop('value')\n            out = self._parent_cls(**map)\n\n        return out\n\n    def _construct_from_dict(self, map):\n        delta_ut1_utc = map.pop('_delta_ut1_utc', None)\n        delta_tdb_tt = map.pop('_delta_tdb_tt', None)\n\n        out = self._construct_from_dict_base(map)\n\n        if delta_ut1_utc is not None:\n            out._delta_ut1_utc = delta_ut1_utc\n        if delta_tdb_tt is not None:\n            out._delta_tdb_tt = delta_tdb_tt\n\n        return out\n\n    def new_like(self, cols, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new Time instance which is consistent with the input Time objects\n        ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty Time instance whose elements can\n        be set in-place for table operations like join or vstack.  It checks\n        that the input locations and attributes are consistent.  This is used\n        when a Time object is used as a mixin column in an astropy Table.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns (Time objects)\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : Time (or subclass)\n            Empty instance of this class consistent with ``cols``\n\n        \"\"\"\n        # Get merged info attributes like shape, dtype, format, description, etc.\n        attrs = self.merge_cols_attributes(cols, metadata_conflicts, name,\n                                           ('meta', 'description'))\n        attrs.pop('dtype')  # Not relevant for Time\n        col0 = cols[0]\n\n        # Check that location is consistent for all Time objects\n        for col in cols[1:]:\n            # This is the method used by __setitem__ to ensure that the right side\n            # has a consistent location (and coerce data if necessary, but that does\n            # not happen in this case since `col` is already a Time object).  If this\n            # passes then any subsequent table operations via setitem will work.\n            try:\n                col0._make_value_equivalent(slice(None), col)\n            except ValueError:\n                raise ValueError('input columns have inconsistent locations')\n\n        # Make a new Time object with the desired shape and attributes\n        shape = (length,) + attrs.pop('shape')\n        jd2000 = 2451544.5  # Arbitrary JD value J2000.0 that will work with ERFA\n        jd1 = np.full(shape, jd2000, dtype='f8')\n        jd2 = np.zeros(shape, dtype='f8')\n        tm_attrs = {attr: getattr(col0, attr)\n                    for attr in ('scale', 'location',\n                                 'precision', 'in_subfmt', 'out_subfmt')}\n        out = self._parent_cls(jd1, jd2, format='jd', **tm_attrs)\n        out.format = col0.format\n\n        # Set remaining info attributes\n        for attr, value in attrs.items():\n            setattr(out.info, attr, value)\n\n        return out\n\n\nclass TimeDeltaInfo(TimeInfo):\n    _represent_as_dict_extra_attrs = ('format', 'scale')\n\n    def _construct_from_dict(self, map):\n        return self._construct_from_dict_base(map)\n\n    def new_like(self, cols, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new TimeDelta instance which is consistent with the input Time objects\n        ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty Time instance whose elements can\n        be set in-place for table operations like join or vstack.  It checks\n        that the input locations and attributes are consistent.  This is used\n        when a Time object is used as a mixin column in an astropy Table.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns (Time objects)\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : Time (or subclass)\n            Empty instance of this class consistent with ``cols``\n\n        \"\"\"\n        # Get merged info attributes like shape, dtype, format, description, etc.\n        attrs = self.merge_cols_attributes(cols, metadata_conflicts, name,\n                                           ('meta', 'description'))\n        attrs.pop('dtype')  # Not relevant for Time\n        col0 = cols[0]\n\n        # Make a new Time object with the desired shape and attributes\n        shape = (length,) + attrs.pop('shape')\n        jd1 = np.zeros(shape, dtype='f8')\n        jd2 = np.zeros(shape, dtype='f8')\n        out = self._parent_cls(jd1, jd2, format='jd', scale=col0.scale)\n        out.format = col0.format\n\n        # Set remaining info attributes\n        for attr, value in attrs.items():\n            setattr(out.info, attr, value)\n\n        return out\n\n\nclass TimeBase(ShapedLikeNDArray):\n    \"\"\"Base time class from which Time and TimeDelta inherit.\"\"\"\n\n    # Make sure that reverse arithmetic (e.g., TimeDelta.__rmul__)\n    # gets called over the __mul__ of Numpy arrays.\n    __array_priority__ = 20000\n\n    # Declare that Time can be used as a Table column by defining the\n    # attribute where column attributes will be stored.\n    _astropy_column_attrs = None\n\n    def __getnewargs__(self):\n        return (self._time,)\n\n    def _init_from_vals(self, val, val2, format, scale, copy,\n                        precision=None, in_subfmt=None, out_subfmt=None):\n        \"\"\"\n        Set the internal _format, scale, and _time attrs from user\n        inputs.  This handles coercion into the correct shapes and\n        some basic input validation.\n        \"\"\"\n        if precision is None:\n            precision = 3\n        if in_subfmt is None:\n            in_subfmt = '*'\n        if out_subfmt is None:\n            out_subfmt = '*'\n\n        # Coerce val into an array\n        val = _make_array(val, copy)\n\n        # If val2 is not None, ensure consistency\n        if val2 is not None:\n            val2 = _make_array(val2, copy)\n            try:\n                np.broadcast(val, val2)\n            except ValueError:\n                raise ValueError('Input val and val2 have inconsistent shape; '\n                                 'they cannot be broadcast together.')\n\n        if scale is not None:\n            if not (isinstance(scale, str)\n                    and scale.lower() in self.SCALES):\n                raise ScaleValueError(\"Scale {!r} is not in the allowed scales \"\n                                      \"{}\".format(scale,\n                                                  sorted(self.SCALES)))\n\n        # If either of the input val, val2 are masked arrays then\n        # find the masked elements and fill them.\n        mask, val, val2 = _check_for_masked_and_fill(val, val2)\n\n        # Parse / convert input values into internal jd1, jd2 based on format\n        self._time = self._get_time_fmt(val, val2, format, scale,\n                                        precision, in_subfmt, out_subfmt)\n        self._format = self._time.name\n\n        # Hack from #9969 to allow passing the location value that has been\n        # collected by the TimeAstropyTime format class up to the Time level.\n        # TODO: find a nicer way.\n        if hasattr(self._time, '_location'):\n            self.location = self._time._location\n            del self._time._location\n\n        # If any inputs were masked then masked jd2 accordingly.  From above\n        # routine ``mask`` must be either Python bool False or an bool ndarray\n        # with shape broadcastable to jd2.\n        if mask is not False:\n            mask = np.broadcast_to(mask, self._time.jd2.shape)\n            self._time.jd1[mask] = 2451544.5  # Set to JD for 2000-01-01\n            self._time.jd2[mask] = np.nan\n\n    def _get_time_fmt(self, val, val2, format, scale,\n                      precision, in_subfmt, out_subfmt):\n        \"\"\"\n        Given the supplied val, val2, format and scale try to instantiate\n        the corresponding TimeFormat class to convert the input values into\n        the internal jd1 and jd2.\n\n        If format is `None` and the input is a string-type or object array then\n        guess available formats and stop when one matches.\n        \"\"\"\n\n        if (format is None\n                and (val.dtype.kind in ('S', 'U', 'O', 'M') or val.dtype.names)):\n            # Input is a string, object, datetime, or a table-like ndarray\n            # (structured array, recarray). These input types can be\n            # uniquely identified by the format classes.\n            formats = [(name, cls) for name, cls in self.FORMATS.items()\n                       if issubclass(cls, TimeUnique)]\n\n            # AstropyTime is a pseudo-format that isn't in the TIME_FORMATS registry,\n            # but try to guess it at the end.\n            formats.append(('astropy_time', TimeAstropyTime))\n\n        elif not (isinstance(format, str)\n                  and format.lower() in self.FORMATS):\n            if format is None:\n                raise ValueError(\"No time format was given, and the input is \"\n                                 \"not unique\")\n            else:\n                raise ValueError(\"Format {!r} is not one of the allowed \"\n                                 \"formats {}\".format(format,\n                                                     sorted(self.FORMATS)))\n        else:\n            formats = [(format, self.FORMATS[format])]\n\n        assert formats\n        problems = {}\n        for name, cls in formats:\n            try:\n                return cls(val, val2, scale, precision, in_subfmt, out_subfmt)\n            except UnitConversionError:\n                raise\n            except (ValueError, TypeError) as err:\n                # If ``format`` specified then there is only one possibility, so raise\n                # immediately and include the upstream exception message to make it\n                # easier for user to see what is wrong.\n                if len(formats) == 1:\n                    raise ValueError(\n                        f'Input values did not match the format class {format}:'\n                        + os.linesep\n                        + f'{err.__class__.__name__}: {err}'\n                    ) from err\n                else:\n                    problems[name] = err\n        else:\n            raise ValueError(f'Input values did not match any of the formats '\n                             f'where the format keyword is optional: '\n                             f'{problems}') from problems[formats[0][0]]\n\n    @property\n    def writeable(self):\n        return self._time.jd1.flags.writeable & self._time.jd2.flags.writeable\n\n    @writeable.setter\n    def writeable(self, value):\n        self._time.jd1.flags.writeable = value\n        self._time.jd2.flags.writeable = value\n\n    @property\n    def format(self):\n        \"\"\"\n        Get or set time format.\n\n        The format defines the way times are represented when accessed via the\n        ``.value`` attribute.  By default it is the same as the format used for\n        initializing the `Time` instance, but it can be set to any other value\n        that could be used for initialization.  These can be listed with::\n\n          >>> list(Time.FORMATS)\n          ['jd', 'mjd', 'decimalyear', 'unix', 'unix_tai', 'cxcsec', 'gps', 'plot_date',\n           'stardate', 'datetime', 'ymdhms', 'iso', 'isot', 'yday', 'datetime64',\n           'fits', 'byear', 'jyear', 'byear_str', 'jyear_str']\n        \"\"\"\n        return self._format\n\n    @format.setter\n    def format(self, format):\n        \"\"\"Set time format\"\"\"\n        if format not in self.FORMATS:\n            raise ValueError(f'format must be one of {list(self.FORMATS)}')\n        format_cls = self.FORMATS[format]\n\n        # Get the new TimeFormat object to contain time in new format.  Possibly\n        # coerce in/out_subfmt to '*' (default) if existing subfmt values are\n        # not valid in the new format.\n        self._time = format_cls(\n            self._time.jd1, self._time.jd2,\n            self._time._scale, self.precision,\n            in_subfmt=format_cls._get_allowed_subfmt(self.in_subfmt),\n            out_subfmt=format_cls._get_allowed_subfmt(self.out_subfmt),\n            from_jd=True)\n\n        self._format = format\n\n    def __repr__(self):\n        return (\"<{} object: scale='{}' format='{}' value={}>\"\n                .format(self.__class__.__name__, self.scale, self.format,\n                        getattr(self, self.format)))\n\n    def __str__(self):\n        return str(getattr(self, self.format))\n\n    def __hash__(self):\n\n        try:\n            loc = getattr(self, 'location', None)\n            if loc is not None:\n                loc = loc.x.to_value(u.m), loc.y.to_value(u.m), loc.z.to_value(u.m)\n\n            return hash((self.jd1, self.jd2, self.scale, loc))\n\n        except TypeError:\n            if self.ndim != 0:\n                reason = '(must be scalar)'\n            elif self.masked:\n                reason = '(value is masked)'\n            else:\n                raise\n\n            raise TypeError(f\"unhashable type: '{self.__class__.__name__}' {reason}\")\n\n    @property\n    def scale(self):\n        \"\"\"Time scale\"\"\"\n        return self._time.scale\n\n    def _set_scale(self, scale):\n        \"\"\"\n        This is the key routine that actually does time scale conversions.\n        This is not public and not connected to the read-only scale property.\n        \"\"\"\n\n        if scale == self.scale:\n            return\n        if scale not in self.SCALES:\n            raise ValueError(\"Scale {!r} is not in the allowed scales {}\"\n                             .format(scale, sorted(self.SCALES)))\n\n        if scale == 'utc' or self.scale == 'utc':\n            # If doing a transform involving UTC then check that the leap\n            # seconds table is up to date.\n            _check_leapsec()\n\n        # Determine the chain of scale transformations to get from the current\n        # scale to the new scale.  MULTI_HOPS contains a dict of all\n        # transformations (xforms) that require intermediate xforms.\n        # The MULTI_HOPS dict is keyed by (sys1, sys2) in alphabetical order.\n        xform = (self.scale, scale)\n        xform_sort = tuple(sorted(xform))\n        multi = MULTI_HOPS.get(xform_sort, ())\n        xforms = xform_sort[:1] + multi + xform_sort[-1:]\n        # If we made the reverse xform then reverse it now.\n        if xform_sort != xform:\n            xforms = tuple(reversed(xforms))\n\n        # Transform the jd1,2 pairs through the chain of scale xforms.\n        jd1, jd2 = self._time.jd1, self._time.jd2_filled\n        for sys1, sys2 in zip(xforms[:-1], xforms[1:]):\n            # Some xforms require an additional delta_ argument that is\n            # provided through Time methods.  These values may be supplied by\n            # the user or computed based on available approximations.  The\n            # get_delta_ methods are available for only one combination of\n            # sys1, sys2 though the property applies for both xform directions.\n            args = [jd1, jd2]\n            for sys12 in ((sys1, sys2), (sys2, sys1)):\n                dt_method = '_get_delta_{}_{}'.format(*sys12)\n                try:\n                    get_dt = getattr(self, dt_method)\n                except AttributeError:\n                    pass\n                else:\n                    args.append(get_dt(jd1, jd2))\n                    break\n\n            conv_func = getattr(erfa, sys1 + sys2)\n            jd1, jd2 = conv_func(*args)\n\n        jd1, jd2 = day_frac(jd1, jd2)\n        if self.masked:\n            jd2[self.mask] = np.nan\n\n        self._time = self.FORMATS[self.format](jd1, jd2, scale, self.precision,\n                                               self.in_subfmt, self.out_subfmt,\n                                               from_jd=True)\n\n    @property\n    def precision(self):\n        \"\"\"\n        Decimal precision when outputting seconds as floating point (int\n        value between 0 and 9 inclusive).\n        \"\"\"\n        return self._time.precision\n\n    @precision.setter\n    def precision(self, val):\n        del self.cache\n        if not isinstance(val, int) or val < 0 or val > 9:\n            raise ValueError('precision attribute must be an int between '\n                             '0 and 9')\n        self._time.precision = val\n\n    @property\n    def in_subfmt(self):\n        \"\"\"\n        Unix wildcard pattern to select subformats for parsing string input\n        times.\n        \"\"\"\n        return self._time.in_subfmt\n\n    @in_subfmt.setter\n    def in_subfmt(self, val):\n        self._time.in_subfmt = val\n        del self.cache\n\n    @property\n    def out_subfmt(self):\n        \"\"\"\n        Unix wildcard pattern to select subformats for outputting times.\n        \"\"\"\n        return self._time.out_subfmt\n\n    @out_subfmt.setter\n    def out_subfmt(self, val):\n        # Setting the out_subfmt property here does validation of ``val``\n        self._time.out_subfmt = val\n        del self.cache\n\n    @property\n    def shape(self):\n        \"\"\"The shape of the time instances.\n\n        Like `~numpy.ndarray.shape`, can be set to a new shape by assigning a\n        tuple.  Note that if different instances share some but not all\n        underlying data, setting the shape of one instance can make the other\n        instance unusable.  Hence, it is strongly recommended to get new,\n        reshaped instances with the ``reshape`` method.\n\n        Raises\n        ------\n        ValueError\n            If the new shape has the wrong total number of elements.\n        AttributeError\n            If the shape of the ``jd1``, ``jd2``, ``location``,\n            ``delta_ut1_utc``, or ``delta_tdb_tt`` attributes cannot be changed\n            without the arrays being copied.  For these cases, use the\n            `Time.reshape` method (which copies any arrays that cannot be\n            reshaped in-place).\n        \"\"\"\n        return self._time.jd1.shape\n\n    @shape.setter\n    def shape(self, shape):\n        del self.cache\n\n        # We have to keep track of arrays that were already reshaped,\n        # since we may have to return those to their original shape if a later\n        # shape-setting fails.\n        reshaped = []\n        oldshape = self.shape\n\n        # In-place reshape of data/attributes.  Need to access _time.jd1/2 not\n        # self.jd1/2 because the latter are not guaranteed to be the actual\n        # data, and in fact should not be directly changeable from the public\n        # API.\n        for obj, attr in ((self._time, 'jd1'),\n                          (self._time, 'jd2'),\n                          (self, '_delta_ut1_utc'),\n                          (self, '_delta_tdb_tt'),\n                          (self, 'location')):\n            val = getattr(obj, attr, None)\n            if val is not None and val.size > 1:\n                try:\n                    val.shape = shape\n                except Exception:\n                    for val2 in reshaped:\n                        val2.shape = oldshape\n                    raise\n                else:\n                    reshaped.append(val)\n\n    def _shaped_like_input(self, value):\n        if self._time.jd1.shape:\n            if isinstance(value, np.ndarray):\n                return value\n            else:\n                raise TypeError(\n                    f\"JD is an array ({self._time.jd1!r}) but value \"\n                    f\"is not ({value!r})\")\n        else:\n            # zero-dimensional array, is it safe to unbox?\n            if (isinstance(value, np.ndarray)\n                    and not value.shape\n                    and not np.ma.is_masked(value)):\n                if value.dtype.kind == 'M':\n                    # existing test doesn't want datetime64 converted\n                    return value[()]\n                elif value.dtype.fields:\n                    # Unpack but keep field names; .item() doesn't\n                    # Still don't get python types in the fields\n                    return value[()]\n                else:\n                    return value.item()\n            else:\n                return value\n\n    @property\n    def jd1(self):\n        \"\"\"\n        First of the two doubles that internally store time value(s) in JD.\n        \"\"\"\n        jd1 = self._time.mask_if_needed(self._time.jd1)\n        return self._shaped_like_input(jd1)\n\n    @property\n    def jd2(self):\n        \"\"\"\n        Second of the two doubles that internally store time value(s) in JD.\n        \"\"\"\n        jd2 = self._time.mask_if_needed(self._time.jd2)\n        return self._shaped_like_input(jd2)\n\n    def to_value(self, format, subfmt='*'):\n        \"\"\"Get time values expressed in specified output format.\n\n        This method allows representing the ``Time`` object in the desired\n        output ``format`` and optional sub-format ``subfmt``.  Available\n        built-in formats include ``jd``, ``mjd``, ``iso``, and so forth. Each\n        format can have its own sub-formats\n\n        For built-in numerical formats like ``jd`` or ``unix``, ``subfmt`` can\n        be one of 'float', 'long', 'decimal', 'str', or 'bytes'.  Here, 'long'\n        uses ``numpy.longdouble`` for somewhat enhanced precision (with\n        the enhancement depending on platform), and 'decimal'\n        :class:`decimal.Decimal` for full precision.  For 'str' and 'bytes', the\n        number of digits is also chosen such that time values are represented\n        accurately.\n\n        For built-in date-like string formats, one of 'date_hms', 'date_hm', or\n        'date' (or 'longdate_hms', etc., for 5-digit years in\n        `~astropy.time.TimeFITS`).  For sub-formats including seconds, the\n        number of digits used for the fractional seconds is as set by\n        `~astropy.time.Time.precision`.\n\n        Parameters\n        ----------\n        format : str\n            The format in which one wants the time values. Default: the current\n            format.\n        subfmt : str or None, optional\n            Value or wildcard pattern to select the sub-format in which the\n            values should be given.  The default of '*' picks the first\n            available for a given format, i.e., 'float' or 'date_hms'.\n            If `None`, use the instance's ``out_subfmt``.\n\n        \"\"\"\n        # TODO: add a precision argument (but ensure it is keyword argument\n        # only, to make life easier for TimeDelta.to_value()).\n        if format not in self.FORMATS:\n            raise ValueError(f'format must be one of {list(self.FORMATS)}')\n\n        cache = self.cache['format']\n        # Try to keep cache behaviour like it was in astropy < 4.0.\n        key = format if subfmt is None else (format, subfmt)\n        if key not in cache:\n            if format == self.format:\n                tm = self\n            else:\n                tm = self.replicate(format=format)\n\n            # Some TimeFormat subclasses may not be able to handle being passes\n            # on a out_subfmt. This includes some core classes like\n            # TimeBesselianEpochString that do not have any allowed subfmts. But\n            # those do deal with `self.out_subfmt` internally, so if subfmt is\n            # the same, we do not pass it on.\n            kwargs = {}\n            if subfmt is not None and subfmt != tm.out_subfmt:\n                kwargs['out_subfmt'] = subfmt\n            try:\n                value = tm._time.to_value(parent=tm, **kwargs)\n            except TypeError as exc:\n                # Try validating subfmt, e.g. for formats like 'jyear_str' that\n                # do not implement out_subfmt in to_value() (because there are\n                # no allowed subformats).  If subfmt is not valid this gives the\n                # same exception as would have occurred if the call to\n                # `to_value()` had succeeded.\n                tm._time._select_subfmts(subfmt)\n\n                # Subfmt was valid, so fall back to the original exception to see\n                # if it was lack of support for out_subfmt as a call arg.\n                if \"unexpected keyword argument 'out_subfmt'\" in str(exc):\n                    raise ValueError(\n                        f\"to_value() method for format {format!r} does not \"\n                        f\"support passing a 'subfmt' argument\") from None\n                else:\n                    # Some unforeseen exception so raise.\n                    raise\n\n            value = tm._shaped_like_input(value)\n            cache[key] = value\n        return cache[key]\n\n    @property\n    def value(self):\n        \"\"\"Time value(s) in current format\"\"\"\n        return self.to_value(self.format, None)\n\n    @property\n    def masked(self):\n        return self._time.masked\n\n    @property\n    def mask(self):\n        return self._time.mask\n\n    def insert(self, obj, values, axis=0):\n        \"\"\"\n        Insert values before the given indices in the column and return\n        a new `~astropy.time.Time` or  `~astropy.time.TimeDelta` object.\n\n        The values to be inserted must conform to the rules for in-place setting\n        of ``Time`` objects (see ``Get and set values`` in the ``Time``\n        documentation).\n\n        The API signature matches the ``np.insert`` API, but is more limited.\n        The specification of insert index ``obj`` must be a single integer,\n        and the ``axis`` must be ``0`` for simple row insertion before the\n        index.\n\n        Parameters\n        ----------\n        obj : int\n            Integer index before which ``values`` is inserted.\n        values : array-like\n            Value(s) to insert.  If the type of ``values`` is different\n            from that of quantity, ``values`` is converted to the matching type.\n        axis : int, optional\n            Axis along which to insert ``values``.  Default is 0, which is the\n            only allowed value and will insert a row.\n\n        Returns\n        -------\n        out : `~astropy.time.Time` subclass\n            New time object with inserted value(s)\n\n        \"\"\"\n        # Validate inputs: obj arg is integer, axis=0, self is not a scalar, and\n        # input index is in bounds.\n        try:\n            idx0 = operator.index(obj)\n        except TypeError:\n            raise TypeError('obj arg must be an integer')\n\n        if axis != 0:\n            raise ValueError('axis must be 0')\n\n        if not self.shape:\n            raise TypeError('cannot insert into scalar {} object'\n                            .format(self.__class__.__name__))\n\n        if abs(idx0) > len(self):\n            raise IndexError('index {} is out of bounds for axis 0 with size {}'\n                             .format(idx0, len(self)))\n\n        # Turn negative index into positive\n        if idx0 < 0:\n            idx0 = len(self) + idx0\n\n        # For non-Time object, use numpy to help figure out the length.  (Note annoying\n        # case of a string input that has a length which is not the length we want).\n        if not isinstance(values, self.__class__):\n            values = np.asarray(values)\n        n_values = len(values) if values.shape else 1\n\n        # Finally make the new object with the correct length and set values for the\n        # three sections, before insert, the insert, and after the insert.\n        out = self.__class__.info.new_like([self], len(self) + n_values, name=self.info.name)\n\n        out._time.jd1[:idx0] = self._time.jd1[:idx0]\n        out._time.jd2[:idx0] = self._time.jd2[:idx0]\n\n        # This uses the Time setting machinery to coerce and validate as necessary.\n        out[idx0:idx0 + n_values] = values\n\n        out._time.jd1[idx0 + n_values:] = self._time.jd1[idx0:]\n        out._time.jd2[idx0 + n_values:] = self._time.jd2[idx0:]\n\n        return out\n\n    def __setitem__(self, item, value):\n        if not self.writeable:\n            if self.shape:\n                raise ValueError('{} object is read-only. Make a '\n                                 'copy() or set \"writeable\" attribute to True.'\n                                 .format(self.__class__.__name__))\n            else:\n                raise ValueError('scalar {} object is read-only.'\n                                 .format(self.__class__.__name__))\n\n        # Any use of setitem results in immediate cache invalidation\n        del self.cache\n\n        # Setting invalidates transform deltas\n        for attr in ('_delta_tdb_tt', '_delta_ut1_utc'):\n            if hasattr(self, attr):\n                delattr(self, attr)\n\n        if value is np.ma.masked or value is np.nan:\n            self._time.jd2[item] = np.nan\n            return\n\n        value = self._make_value_equivalent(item, value)\n\n        # Finally directly set the jd1/2 values.  Locations are known to match.\n        if self.scale is not None:\n            value = getattr(value, self.scale)\n        self._time.jd1[item] = value._time.jd1\n        self._time.jd2[item] = value._time.jd2\n\n    def isclose(self, other, atol=None):\n        \"\"\"Returns a boolean or boolean array where two Time objects are\n        element-wise equal within a time tolerance.\n\n        This evaluates the expression below::\n\n          abs(self - other) <= atol\n\n        Parameters\n        ----------\n        other : `~astropy.time.Time`\n            Time object for comparison.\n        atol : `~astropy.units.Quantity` or `~astropy.time.TimeDelta`\n            Absolute tolerance for equality with units of time (e.g. ``u.s`` or\n            ``u.day``). Default is two bits in the 128-bit JD time representation,\n            equivalent to about 40 picosecs.\n        \"\"\"\n        if atol is None:\n            # Note: use 2 bits instead of 1 bit based on experience in precision\n            # tests, since taking the difference with a UTC time means one has\n            # to do a scale change.\n            atol = 2 * np.finfo(float).eps * u.day\n\n        if not isinstance(atol, (u.Quantity, TimeDelta)):\n            raise TypeError(\"'atol' argument must be a Quantity or TimeDelta instance, got \"\n                            f'{atol.__class__.__name__} instead')\n\n        try:\n            # Separate these out so user sees where the problem is\n            dt = self - other\n            dt = abs(dt)\n            out = dt <= atol\n        except Exception as err:\n            raise TypeError(\"'other' argument must support subtraction with Time \"\n                            f\"and return a value that supports comparison with \"\n                            f\"{atol.__class__.__name__}: {err}\")\n\n        return out\n\n    def copy(self, format=None):\n        \"\"\"\n        Return a fully independent copy the Time object, optionally changing\n        the format.\n\n        If ``format`` is supplied then the time format of the returned Time\n        object will be set accordingly, otherwise it will be unchanged from the\n        original.\n\n        In this method a full copy of the internal time arrays will be made.\n        The internal time arrays are normally not changeable by the user so in\n        most cases the ``replicate()`` method should be used.\n\n        Parameters\n        ----------\n        format : str, optional\n            Time format of the copy.\n\n        Returns\n        -------\n        tm : Time object\n            Copy of this object\n        \"\"\"\n        return self._apply('copy', format=format)\n\n    def replicate(self, format=None, copy=False, cls=None):\n        \"\"\"\n        Return a replica of the Time object, optionally changing the format.\n\n        If ``format`` is supplied then the time format of the returned Time\n        object will be set accordingly, otherwise it will be unchanged from the\n        original.\n\n        If ``copy`` is set to `True` then a full copy of the internal time arrays\n        will be made.  By default the replica will use a reference to the\n        original arrays when possible to save memory.  The internal time arrays\n        are normally not changeable by the user so in most cases it should not\n        be necessary to set ``copy`` to `True`.\n\n        The convenience method copy() is available in which ``copy`` is `True`\n        by default.\n\n        Parameters\n        ----------\n        format : str, optional\n            Time format of the replica.\n        copy : bool, optional\n            Return a true copy instead of using references where possible.\n\n        Returns\n        -------\n        tm : Time object\n            Replica of this object\n        \"\"\"\n        return self._apply('copy' if copy else 'replicate', format=format, cls=cls)\n\n    def _apply(self, method, *args, format=None, cls=None, **kwargs):\n        \"\"\"Create a new time object, possibly applying a method to the arrays.\n\n        Parameters\n        ----------\n        method : str or callable\n            If string, can be 'replicate'  or the name of a relevant\n            `~numpy.ndarray` method. In the former case, a new time instance\n            with unchanged internal data is created, while in the latter the\n            method is applied to the internal ``jd1`` and ``jd2`` arrays, as\n            well as to possible ``location``, ``_delta_ut1_utc``, and\n            ``_delta_tdb_tt`` arrays.\n            If a callable, it is directly applied to the above arrays.\n            Examples: 'copy', '__getitem__', 'reshape', `~numpy.broadcast_to`.\n        args : tuple\n            Any positional arguments for ``method``.\n        kwargs : dict\n            Any keyword arguments for ``method``.  If the ``format`` keyword\n            argument is present, this will be used as the Time format of the\n            replica.\n\n        Examples\n        --------\n        Some ways this is used internally::\n\n            copy : ``_apply('copy')``\n            replicate : ``_apply('replicate')``\n            reshape : ``_apply('reshape', new_shape)``\n            index or slice : ``_apply('__getitem__', item)``\n            broadcast : ``_apply(np.broadcast, shape=new_shape)``\n        \"\"\"\n        new_format = self.format if format is None else format\n\n        if callable(method):\n            apply_method = lambda array: method(array, *args, **kwargs)\n\n        else:\n            if method == 'replicate':\n                apply_method = None\n            else:\n                apply_method = operator.methodcaller(method, *args, **kwargs)\n\n        jd1, jd2 = self._time.jd1, self._time.jd2\n        if apply_method:\n            jd1 = apply_method(jd1)\n            jd2 = apply_method(jd2)\n\n        # Get a new instance of our class and set its attributes directly.\n        tm = super().__new__(cls or self.__class__)\n        tm._time = TimeJD(jd1, jd2, self.scale, precision=0,\n                          in_subfmt='*', out_subfmt='*', from_jd=True)\n\n        # Optional ndarray attributes.\n        for attr in ('_delta_ut1_utc', '_delta_tdb_tt', 'location'):\n            try:\n                val = getattr(self, attr)\n            except AttributeError:\n                continue\n\n            if apply_method:\n                # Apply the method to any value arrays (though skip if there is\n                # only an array scalar and the method would return a view,\n                # since in that case nothing would change).\n                if getattr(val, 'shape', ()):\n                    val = apply_method(val)\n                elif method == 'copy' or method == 'flatten':\n                    # flatten should copy also for a single element array, but\n                    # we cannot use it directly for array scalars, since it\n                    # always returns a one-dimensional array. So, just copy.\n                    val = copy.copy(val)\n\n            setattr(tm, attr, val)\n\n        # Copy other 'info' attr only if it has actually been defined and the\n        # time object is not a scalar (issue #10688).\n        # See PR #3898 for further explanation and justification, along\n        # with Quantity.__array_finalize__\n        if 'info' in self.__dict__:\n            tm.info = self.info\n\n        # Make the new internal _time object corresponding to the format\n        # in the copy.  If the format is unchanged this process is lightweight\n        # and does not create any new arrays.\n        if new_format not in tm.FORMATS:\n            raise ValueError(f'format must be one of {list(tm.FORMATS)}')\n\n        NewFormat = tm.FORMATS[new_format]\n\n        tm._time = NewFormat(\n            tm._time.jd1, tm._time.jd2,\n            tm._time._scale,\n            precision=self.precision,\n            in_subfmt=NewFormat._get_allowed_subfmt(self.in_subfmt),\n            out_subfmt=NewFormat._get_allowed_subfmt(self.out_subfmt),\n            from_jd=True)\n        tm._format = new_format\n        tm.SCALES = self.SCALES\n\n        return tm\n\n    def __copy__(self):\n        \"\"\"\n        Overrides the default behavior of the `copy.copy` function in\n        the python stdlib to behave like `Time.copy`. Does *not* make a\n        copy of the JD arrays - only copies by reference.\n        \"\"\"\n        return self.replicate()\n\n    def __deepcopy__(self, memo):\n        \"\"\"\n        Overrides the default behavior of the `copy.deepcopy` function\n        in the python stdlib to behave like `Time.copy`. Does make a\n        copy of the JD arrays.\n        \"\"\"\n        return self.copy()\n\n    def _advanced_index(self, indices, axis=None, keepdims=False):\n        \"\"\"Turn argmin, argmax output into an advanced index.\n\n        Argmin, argmax output contains indices along a given axis in an array\n        shaped like the other dimensions.  To use this to get values at the\n        correct location, a list is constructed in which the other axes are\n        indexed sequentially.  For ``keepdims`` is ``True``, the net result is\n        the same as constructing an index grid with ``np.ogrid`` and then\n        replacing the ``axis`` item with ``indices`` with its shaped expanded\n        at ``axis``. For ``keepdims`` is ``False``, the result is the same but\n        with the ``axis`` dimension removed from all list entries.\n\n        For ``axis`` is ``None``, this calls :func:`~numpy.unravel_index`.\n\n        Parameters\n        ----------\n        indices : array\n            Output of argmin or argmax.\n        axis : int or None\n            axis along which argmin or argmax was used.\n        keepdims : bool\n            Whether to construct indices that keep or remove the axis along\n            which argmin or argmax was used.  Default: ``False``.\n\n        Returns\n        -------\n        advanced_index : list of arrays\n            Suitable for use as an advanced index.\n        \"\"\"\n        if axis is None:\n            return np.unravel_index(indices, self.shape)\n\n        ndim = self.ndim\n        if axis < 0:\n            axis = axis + ndim\n\n        if keepdims and indices.ndim < self.ndim:\n            indices = np.expand_dims(indices, axis)\n\n        index = [indices\n                 if i == axis\n                 else np.arange(s).reshape(\n                     (1,) * (i if keepdims or i < axis else i - 1)\n                     + (s,)\n                     + (1,) * (ndim - i - (1 if keepdims or i > axis else 2))\n                 )\n                 for i, s in enumerate(self.shape)]\n\n        return tuple(index)\n\n    def argmin(self, axis=None, out=None):\n        \"\"\"Return indices of the minimum values along the given axis.\n\n        This is similar to :meth:`~numpy.ndarray.argmin`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used.  See :func:`~numpy.argmin` for detailed documentation.\n        \"\"\"\n        # First get the minimum at normal precision.\n        jd1, jd2 = self.jd1, self.jd2\n        approx = np.min(jd1 + jd2, axis, keepdims=True)\n\n        # Approx is very close to the true minimum, and by subtracting it at\n        # full precision, all numbers near 0 can be represented correctly,\n        # so we can be sure we get the true minimum.\n        # The below is effectively what would be done for\n        # dt = (self - self.__class__(approx, format='jd')).jd\n        # which translates to:\n        # approx_jd1, approx_jd2 = day_frac(approx, 0.)\n        # dt = (self.jd1 - approx_jd1) + (self.jd2 - approx_jd2)\n        dt = (jd1 - approx) + jd2\n\n        return dt.argmin(axis, out)\n\n    def argmax(self, axis=None, out=None):\n        \"\"\"Return indices of the maximum values along the given axis.\n\n        This is similar to :meth:`~numpy.ndarray.argmax`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used.  See :func:`~numpy.argmax` for detailed documentation.\n        \"\"\"\n        # For procedure, see comment on argmin.\n        jd1, jd2 = self.jd1, self.jd2\n        approx = np.max(jd1 + jd2, axis, keepdims=True)\n\n        dt = (jd1 - approx) + jd2\n\n        return dt.argmax(axis, out)\n\n    def argsort(self, axis=-1):\n        \"\"\"Returns the indices that would sort the time array.\n\n        This is similar to :meth:`~numpy.ndarray.argsort`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used, and that corresponding attributes are copied.  Internally,\n        it uses :func:`~numpy.lexsort`, and hence no sort method can be chosen.\n        \"\"\"\n        # For procedure, see comment on argmin.\n        jd1, jd2 = self.jd1, self.jd2\n        approx = jd1 + jd2\n        remainder = (jd1 - approx) + jd2\n\n        if axis is None:\n            return np.lexsort((remainder.ravel(), approx.ravel()))\n        else:\n            return np.lexsort(keys=(remainder, approx), axis=axis)\n\n    def min(self, axis=None, out=None, keepdims=False):\n        \"\"\"Minimum along a given axis.\n\n        This is similar to :meth:`~numpy.ndarray.min`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used, and that corresponding attributes are copied.\n\n        Note that the ``out`` argument is present only for compatibility with\n        ``np.min``; since `Time` instances are immutable, it is not possible\n        to have an actual ``out`` to store the result in.\n        \"\"\"\n        if out is not None:\n            raise ValueError(\"Since `Time` instances are immutable, ``out`` \"\n                             \"cannot be set to anything but ``None``.\")\n        return self[self._advanced_index(self.argmin(axis), axis, keepdims)]\n\n    def max(self, axis=None, out=None, keepdims=False):\n        \"\"\"Maximum along a given axis.\n\n        This is similar to :meth:`~numpy.ndarray.max`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used, and that corresponding attributes are copied.\n\n        Note that the ``out`` argument is present only for compatibility with\n        ``np.max``; since `Time` instances are immutable, it is not possible\n        to have an actual ``out`` to store the result in.\n        \"\"\"\n        if out is not None:\n            raise ValueError(\"Since `Time` instances are immutable, ``out`` \"\n                             \"cannot be set to anything but ``None``.\")\n        return self[self._advanced_index(self.argmax(axis), axis, keepdims)]\n\n    def ptp(self, axis=None, out=None, keepdims=False):\n        \"\"\"Peak to peak (maximum - minimum) along a given axis.\n\n        This is similar to :meth:`~numpy.ndarray.ptp`, but adapted to ensure\n        that the full precision given by the two doubles ``jd1`` and ``jd2``\n        is used.\n\n        Note that the ``out`` argument is present only for compatibility with\n        `~numpy.ptp`; since `Time` instances are immutable, it is not possible\n        to have an actual ``out`` to store the result in.\n        \"\"\"\n        if out is not None:\n            raise ValueError(\"Since `Time` instances are immutable, ``out`` \"\n                             \"cannot be set to anything but ``None``.\")\n        return (self.max(axis, keepdims=keepdims)\n                - self.min(axis, keepdims=keepdims))\n\n    def sort(self, axis=-1):\n        \"\"\"Return a copy sorted along the specified axis.\n\n        This is similar to :meth:`~numpy.ndarray.sort`, but internally uses\n        indexing with :func:`~numpy.lexsort` to ensure that the full precision\n        given by the two doubles ``jd1`` and ``jd2`` is kept, and that\n        corresponding attributes are properly sorted and copied as well.\n\n        Parameters\n        ----------\n        axis : int or None\n            Axis to be sorted.  If ``None``, the flattened array is sorted.\n            By default, sort over the last axis.\n        \"\"\"\n        return self[self._advanced_index(self.argsort(axis), axis,\n                                         keepdims=True)]\n\n    @property\n    def cache(self):\n        \"\"\"\n        Return the cache associated with this instance.\n        \"\"\"\n        return self._time.cache\n\n    @cache.deleter\n    def cache(self):\n        del self._time.cache\n\n    def __getattr__(self, attr):\n        \"\"\"\n        Get dynamic attributes to output format or do timescale conversion.\n        \"\"\"\n        if attr in self.SCALES and self.scale is not None:\n            cache = self.cache['scale']\n            if attr not in cache:\n                if attr == self.scale:\n                    tm = self\n                else:\n                    tm = self.replicate()\n                    tm._set_scale(attr)\n                    if tm.shape:\n                        # Prevent future modification of cached array-like object\n                        tm.writeable = False\n                cache[attr] = tm\n            return cache[attr]\n\n        elif attr in self.FORMATS:\n            return self.to_value(attr, subfmt=None)\n\n        elif attr in TIME_SCALES:  # allowed ones done above (self.SCALES)\n            if self.scale is None:\n                raise ScaleValueError(\"Cannot convert TimeDelta with \"\n                                      \"undefined scale to any defined scale.\")\n            else:\n                raise ScaleValueError(\"Cannot convert {} with scale \"\n                                      \"'{}' to scale '{}'\"\n                                      .format(self.__class__.__name__,\n                                              self.scale, attr))\n\n        else:\n            # Should raise AttributeError\n            return self.__getattribute__(attr)\n\n    @override__dir__\n    def __dir__(self):\n        result = set(self.SCALES)\n        result.update(self.FORMATS)\n        return result\n\n    def _match_shape(self, val):\n        \"\"\"\n        Ensure that `val` is matched to length of self.  If val has length 1\n        then broadcast, otherwise cast to double and make sure shape matches.\n        \"\"\"\n        val = _make_array(val, copy=True)  # be conservative and copy\n        if val.size > 1 and val.shape != self.shape:\n            try:\n                # check the value can be broadcast to the shape of self.\n                val = np.broadcast_to(val, self.shape, subok=True)\n            except Exception:\n                raise ValueError('Attribute shape must match or be '\n                                 'broadcastable to that of Time object. '\n                                 'Typically, give either a single value or '\n                                 'one for each time.')\n\n        return val\n\n    def _time_comparison(self, other, op):\n        \"\"\"If other is of same class as self, compare difference in self.scale.\n        Otherwise, return NotImplemented\n        \"\"\"\n        if other.__class__ is not self.__class__:\n            try:\n                other = self.__class__(other, scale=self.scale)\n            except Exception:\n                # Let other have a go.\n                return NotImplemented\n\n        if(self.scale is not None and self.scale not in other.SCALES\n           or other.scale is not None and other.scale not in self.SCALES):\n            # Other will also not be able to do it, so raise a TypeError\n            # immediately, allowing us to explain why it doesn't work.\n            raise TypeError(\"Cannot compare {} instances with scales \"\n                            \"'{}' and '{}'\".format(self.__class__.__name__,\n                                                   self.scale, other.scale))\n\n        if self.scale is not None and other.scale is not None:\n            other = getattr(other, self.scale)\n\n        return op((self.jd1 - other.jd1) + (self.jd2 - other.jd2), 0.)\n\n    def __lt__(self, other):\n        return self._time_comparison(other, operator.lt)\n\n    def __le__(self, other):\n        return self._time_comparison(other, operator.le)\n\n    def __eq__(self, other):\n        \"\"\"\n        If other is an incompatible object for comparison, return `False`.\n        Otherwise, return `True` if the time difference between self and\n        other is zero.\n        \"\"\"\n        return self._time_comparison(other, operator.eq)\n\n    def __ne__(self, other):\n        \"\"\"\n        If other is an incompatible object for comparison, return `True`.\n        Otherwise, return `False` if the time difference between self and\n        other is zero.\n        \"\"\"\n        return self._time_comparison(other, operator.ne)\n\n    def __gt__(self, other):\n        return self._time_comparison(other, operator.gt)\n\n    def __ge__(self, other):\n        return self._time_comparison(other, operator.ge)\n\n\nclass Time(TimeBase):\n    \"\"\"\n    Represent and manipulate times and dates for astronomy.\n\n    A `Time` object is initialized with one or more times in the ``val``\n    argument.  The input times in ``val`` must conform to the specified\n    ``format`` and must correspond to the specified time ``scale``.  The\n    optional ``val2`` time input should be supplied only for numeric input\n    formats (e.g. JD) where very high precision (better than 64-bit precision)\n    is required.\n\n    The allowed values for ``format`` can be listed with::\n\n      >>> list(Time.FORMATS)\n      ['jd', 'mjd', 'decimalyear', 'unix', 'unix_tai', 'cxcsec', 'gps', 'plot_date',\n       'stardate', 'datetime', 'ymdhms', 'iso', 'isot', 'yday', 'datetime64',\n       'fits', 'byear', 'jyear', 'byear_str', 'jyear_str']\n\n    See also: http://docs.astropy.org/en/stable/time/\n\n    Parameters\n    ----------\n    val : sequence, ndarray, number, str, bytes, or `~astropy.time.Time` object\n        Value(s) to initialize the time or times.  Bytes are decoded as ascii.\n    val2 : sequence, ndarray, or number; optional\n        Value(s) to initialize the time or times.  Only used for numerical\n        input, to help preserve precision.\n    format : str, optional\n        Format of input value(s)\n    scale : str, optional\n        Time scale of input value(s), must be one of the following:\n        ('tai', 'tcb', 'tcg', 'tdb', 'tt', 'ut1', 'utc')\n    precision : int, optional\n        Digits of precision in string representation of time\n    in_subfmt : str, optional\n        Unix glob to select subformats for parsing input times\n    out_subfmt : str, optional\n        Unix glob to select subformat for outputting times\n    location : `~astropy.coordinates.EarthLocation` or tuple, optional\n        If given as an tuple, it should be able to initialize an\n        an EarthLocation instance, i.e., either contain 3 items with units of\n        length for geocentric coordinates, or contain a longitude, latitude,\n        and an optional height for geodetic coordinates.\n        Can be a single location, or one for each input time.\n        If not given, assumed to be the center of the Earth for time scale\n        transformations to and from the solar-system barycenter.\n    copy : bool, optional\n        Make a copy of the input values\n    \"\"\"\n    SCALES = TIME_SCALES\n    \"\"\"List of time scales\"\"\"\n\n    FORMATS = TIME_FORMATS\n    \"\"\"Dict of time formats\"\"\"\n\n    def __new__(cls, val, val2=None, format=None, scale=None,\n                precision=None, in_subfmt=None, out_subfmt=None,\n                location=None, copy=False):\n\n        if isinstance(val, Time):\n            self = val.replicate(format=format, copy=copy, cls=cls)\n        else:\n            self = super().__new__(cls)\n\n        return self\n\n    def __init__(self, val, val2=None, format=None, scale=None,\n                 precision=None, in_subfmt=None, out_subfmt=None,\n                 location=None, copy=False):\n\n        if location is not None:\n            from astropy.coordinates import EarthLocation\n            if isinstance(location, EarthLocation):\n                self.location = location\n            else:\n                self.location = EarthLocation(*location)\n            if self.location.size == 1:\n                self.location = self.location.squeeze()\n        else:\n            if not hasattr(self, 'location'):\n                self.location = None\n\n        if isinstance(val, Time):\n            # Update _time formatting parameters if explicitly specified\n            if precision is not None:\n                self._time.precision = precision\n            if in_subfmt is not None:\n                self._time.in_subfmt = in_subfmt\n            if out_subfmt is not None:\n                self._time.out_subfmt = out_subfmt\n            self.SCALES = TIME_TYPES[self.scale]\n            if scale is not None:\n                self._set_scale(scale)\n        else:\n            self._init_from_vals(val, val2, format, scale, copy,\n                                 precision, in_subfmt, out_subfmt)\n            self.SCALES = TIME_TYPES[self.scale]\n\n        if self.location is not None and (self.location.size > 1\n                                          and self.location.shape != self.shape):\n            try:\n                # check the location can be broadcast to self's shape.\n                self.location = np.broadcast_to(self.location, self.shape,\n                                                subok=True)\n            except Exception as err:\n                raise ValueError('The location with shape {} cannot be '\n                                 'broadcast against time with shape {}. '\n                                 'Typically, either give a single location or '\n                                 'one for each time.'\n                                 .format(self.location.shape, self.shape)) from err\n\n    def _make_value_equivalent(self, item, value):\n        \"\"\"Coerce setitem value into an equivalent Time object\"\"\"\n\n        # If there is a vector location then broadcast to the Time shape\n        # and then select with ``item``\n        if self.location is not None and self.location.shape:\n            self_location = np.broadcast_to(self.location, self.shape, subok=True)[item]\n        else:\n            self_location = self.location\n\n        if isinstance(value, Time):\n            # Make sure locations are compatible.  Location can be either None or\n            # a Location object.\n            if self_location is None and value.location is None:\n                match = True\n            elif ((self_location is None and value.location is not None)\n                  or (self_location is not None and value.location is None)):\n                match = False\n            else:\n                match = np.all(self_location == value.location)\n            if not match:\n                raise ValueError('cannot set to Time with different location: '\n                                 'expected location={} and '\n                                 'got location={}'\n                                 .format(self_location, value.location))\n        else:\n            try:\n                value = self.__class__(value, scale=self.scale, location=self_location)\n            except Exception:\n                try:\n                    value = self.__class__(value, scale=self.scale, format=self.format,\n                                           location=self_location)\n                except Exception as err:\n                    raise ValueError('cannot convert value to a compatible Time object: {}'\n                                     .format(err))\n        return value\n\n    @classmethod\n    def now(cls):\n        \"\"\"\n        Creates a new object corresponding to the instant in time this\n        method is called.\n\n        .. note::\n            \"Now\" is determined using the `~datetime.datetime.utcnow`\n            function, so its accuracy and precision is determined by that\n            function.  Generally that means it is set by the accuracy of\n            your system clock.\n\n        Returns\n        -------\n        nowtime : :class:`~astropy.time.Time`\n            A new `Time` object (or a subclass of `Time` if this is called from\n            such a subclass) at the current time.\n        \"\"\"\n        # call `utcnow` immediately to be sure it's ASAP\n        dtnow = datetime.utcnow()\n        return cls(val=dtnow, format='datetime', scale='utc')\n\n    info = TimeInfo()\n\n    @classmethod\n    def strptime(cls, time_string, format_string, **kwargs):\n        \"\"\"\n        Parse a string to a Time according to a format specification.\n        See `time.strptime` documentation for format specification.\n\n        >>> Time.strptime('2012-Jun-30 23:59:60', '%Y-%b-%d %H:%M:%S')\n        <Time object: scale='utc' format='isot' value=2012-06-30T23:59:60.000>\n\n        Parameters\n        ----------\n        time_string : str, sequence, or ndarray\n            Objects containing time data of type string\n        format_string : str\n            String specifying format of time_string.\n        kwargs : dict\n            Any keyword arguments for ``Time``.  If the ``format`` keyword\n            argument is present, this will be used as the Time format.\n\n        Returns\n        -------\n        time_obj : `~astropy.time.Time`\n            A new `~astropy.time.Time` object corresponding to the input\n            ``time_string``.\n\n        \"\"\"\n        time_array = np.asarray(time_string)\n\n        if time_array.dtype.kind not in ('U', 'S'):\n            err = \"Expected type is string, a bytes-like object or a sequence\"\\\n                  \" of these. Got dtype '{}'\".format(time_array.dtype.kind)\n            raise TypeError(err)\n\n        to_string = (str if time_array.dtype.kind == 'U' else\n                     lambda x: str(x.item(), encoding='ascii'))\n        iterator = np.nditer([time_array, None],\n                             op_dtypes=[time_array.dtype, 'U30'])\n\n        for time, formatted in iterator:\n            tt, fraction = _strptime._strptime(to_string(time), format_string)\n            time_tuple = tt[:6] + (fraction,)\n            formatted[...] = '{:04}-{:02}-{:02}T{:02}:{:02}:{:02}.{:06}'\\\n                .format(*time_tuple)\n\n        format = kwargs.pop('format', None)\n        out = cls(*iterator.operands[1:], format='isot', **kwargs)\n        if format is not None:\n            out.format = format\n\n        return out\n\n    def strftime(self, format_spec):\n        \"\"\"\n        Convert Time to a string or a numpy.array of strings according to a\n        format specification.\n        See `time.strftime` documentation for format specification.\n\n        Parameters\n        ----------\n        format_spec : str\n            Format definition of return string.\n\n        Returns\n        -------\n        formatted : str or numpy.array\n            String or numpy.array of strings formatted according to the given\n            format string.\n\n        \"\"\"\n        formatted_strings = []\n        for sk in self.replicate('iso')._time.str_kwargs():\n            date_tuple = date(sk['year'], sk['mon'], sk['day']).timetuple()\n            datetime_tuple = (sk['year'], sk['mon'], sk['day'],\n                              sk['hour'], sk['min'], sk['sec'],\n                              date_tuple[6], date_tuple[7], -1)\n            fmtd_str = format_spec\n            if '%f' in fmtd_str:\n                fmtd_str = fmtd_str.replace('%f', '{frac:0{precision}}'.format(\n                    frac=sk['fracsec'], precision=self.precision))\n            fmtd_str = strftime(fmtd_str, datetime_tuple)\n            formatted_strings.append(fmtd_str)\n\n        if self.isscalar:\n            return formatted_strings[0]\n        else:\n            return np.array(formatted_strings).reshape(self.shape)\n\n    def light_travel_time(self, skycoord, kind='barycentric', location=None, ephemeris=None):\n        \"\"\"Light travel time correction to the barycentre or heliocentre.\n\n        The frame transformations used to calculate the location of the solar\n        system barycentre and the heliocentre rely on the erfa routine epv00,\n        which is consistent with the JPL DE405 ephemeris to an accuracy of\n        11.2 km, corresponding to a light travel time of 4 microseconds.\n\n        The routine assumes the source(s) are at large distance, i.e., neglects\n        finite-distance effects.\n\n        Parameters\n        ----------\n        skycoord : `~astropy.coordinates.SkyCoord`\n            The sky location to calculate the correction for.\n        kind : str, optional\n            ``'barycentric'`` (default) or ``'heliocentric'``\n        location : `~astropy.coordinates.EarthLocation`, optional\n            The location of the observatory to calculate the correction for.\n            If no location is given, the ``location`` attribute of the Time\n            object is used\n        ephemeris : str, optional\n            Solar system ephemeris to use (e.g., 'builtin', 'jpl'). By default,\n            use the one set with ``astropy.coordinates.solar_system_ephemeris.set``.\n            For more information, see `~astropy.coordinates.solar_system_ephemeris`.\n\n        Returns\n        -------\n        time_offset : `~astropy.time.TimeDelta`\n            The time offset between the barycentre or Heliocentre and Earth,\n            in TDB seconds.  Should be added to the original time to get the\n            time in the Solar system barycentre or the Heliocentre.\n            Also, the time conversion to BJD will then include the relativistic correction as well.\n        \"\"\"\n\n        if kind.lower() not in ('barycentric', 'heliocentric'):\n            raise ValueError(\"'kind' parameter must be one of 'heliocentric' \"\n                             \"or 'barycentric'\")\n\n        if location is None:\n            if self.location is None:\n                raise ValueError('An EarthLocation needs to be set or passed '\n                                 'in to calculate bary- or heliocentric '\n                                 'corrections')\n            location = self.location\n\n        from astropy.coordinates import (UnitSphericalRepresentation, CartesianRepresentation,\n                                         HCRS, ICRS, GCRS, solar_system_ephemeris)\n\n        # ensure sky location is ICRS compatible\n        if not skycoord.is_transformable_to(ICRS()):\n            raise ValueError(\"Given skycoord is not transformable to the ICRS\")\n\n        # get location of observatory in ITRS coordinates at this Time\n        try:\n            itrs = location.get_itrs(obstime=self)\n        except Exception:\n            raise ValueError(\"Supplied location does not have a valid `get_itrs` method\")\n\n        with solar_system_ephemeris.set(ephemeris):\n            if kind.lower() == 'heliocentric':\n                # convert to heliocentric coordinates, aligned with ICRS\n                cpos = itrs.transform_to(HCRS(obstime=self)).cartesian.xyz\n            else:\n                # first we need to convert to GCRS coordinates with the correct\n                # obstime, since ICRS coordinates have no frame time\n                gcrs_coo = itrs.transform_to(GCRS(obstime=self))\n                # convert to barycentric (BCRS) coordinates, aligned with ICRS\n                cpos = gcrs_coo.transform_to(ICRS()).cartesian.xyz\n\n        # get unit ICRS vector to star\n        spos = (skycoord.icrs.represent_as(UnitSphericalRepresentation).\n                represent_as(CartesianRepresentation).xyz)\n\n        # Move X,Y,Z to last dimension, to enable possible broadcasting below.\n        cpos = np.rollaxis(cpos, 0, cpos.ndim)\n        spos = np.rollaxis(spos, 0, spos.ndim)\n\n        # calculate light travel time correction\n        tcor_val = (spos * cpos).sum(axis=-1) / const.c\n        return TimeDelta(tcor_val, scale='tdb')\n\n    def earth_rotation_angle(self, longitude=None):\n        \"\"\"Calculate local Earth rotation angle.\n\n        Parameters\n        ----------\n        longitude : `~astropy.units.Quantity`, `~astropy.coordinates.EarthLocation`, str, or None; optional\n            The longitude on the Earth at which to compute the Earth rotation\n            angle (taken from a location as needed).  If `None` (default), taken\n            from the ``location`` attribute of the Time instance. If the special\n            string 'tio', the result will be relative to the Terrestrial\n            Intermediate Origin (TIO) (i.e., the output of `~erfa.era00`).\n\n        Returns\n        -------\n        `~astropy.coordinates.Longitude`\n            Local Earth rotation angle with units of hourangle.\n\n        See Also\n        --------\n        astropy.time.Time.sidereal_time\n\n        References\n        ----------\n        IAU 2006 NFA Glossary\n        (currently located at: https://syrte.obspm.fr/iauWGnfa/NFA_Glossary.html)\n\n        Notes\n        -----\n        The difference between apparent sidereal time and Earth rotation angle\n        is the equation of the origins, which is the angle between the Celestial\n        Intermediate Origin (CIO) and the equinox. Applying apparent sidereal\n        time to the hour angle yields the true apparent Right Ascension with\n        respect to the equinox, while applying the Earth rotation angle yields\n        the intermediate (CIRS) Right Ascension with respect to the CIO.\n\n        The result includes the TIO locator (s'), which positions the Terrestrial\n        Intermediate Origin on the equator of the Celestial Intermediate Pole (CIP)\n        and is rigorously corrected for polar motion.\n        (except when ``longitude='tio'``).\n\n        \"\"\"\n        if isinstance(longitude, str) and longitude == 'tio':\n            longitude = 0\n            include_tio = False\n        else:\n            include_tio = True\n\n        return self._sid_time_or_earth_rot_ang(longitude=longitude,\n                                               function=erfa.era00, scales=('ut1',),\n                                               include_tio=include_tio)\n\n    def sidereal_time(self, kind, longitude=None, model=None):\n        \"\"\"Calculate sidereal time.\n\n        Parameters\n        ----------\n        kind : str\n            ``'mean'`` or ``'apparent'``, i.e., accounting for precession\n            only, or also for nutation.\n        longitude : `~astropy.units.Quantity`, `~astropy.coordinates.EarthLocation`, str, or None; optional\n            The longitude on the Earth at which to compute the Earth rotation\n            angle (taken from a location as needed).  If `None` (default), taken\n            from the ``location`` attribute of the Time instance. If the special\n            string  'greenwich' or 'tio', the result will be relative to longitude\n            0 for models before 2000, and relative to the Terrestrial Intermediate\n            Origin (TIO) for later ones (i.e., the output of the relevant ERFA\n            function that calculates greenwich sidereal time).\n        model : str or None; optional\n            Precession (and nutation) model to use.  The available ones are:\n            - {0}: {1}\n            - {2}: {3}\n            If `None` (default), the last (most recent) one from the appropriate\n            list above is used.\n\n        Returns\n        -------\n        `~astropy.coordinates.Longitude`\n            Local sidereal time, with units of hourangle.\n\n        See Also\n        --------\n        astropy.time.Time.earth_rotation_angle\n\n        References\n        ----------\n        IAU 2006 NFA Glossary\n        (currently located at: https://syrte.obspm.fr/iauWGnfa/NFA_Glossary.html)\n\n        Notes\n        -----\n        The difference between apparent sidereal time and Earth rotation angle\n        is the equation of the origins, which is the angle between the Celestial\n        Intermediate Origin (CIO) and the equinox. Applying apparent sidereal\n        time to the hour angle yields the true apparent Right Ascension with\n        respect to the equinox, while applying the Earth rotation angle yields\n        the intermediate (CIRS) Right Ascension with respect to the CIO.\n\n        For the IAU precession models from 2000 onwards, the result includes the\n        TIO locator (s'), which positions the Terrestrial Intermediate Origin on\n        the equator of the Celestial Intermediate Pole (CIP) and is rigorously\n        corrected for polar motion (except when ``longitude='tio'`` or ``'greenwich'``).\n\n        \"\"\"  # docstring is formatted below\n\n        if kind.lower() not in SIDEREAL_TIME_MODELS.keys():\n            raise ValueError('The kind of sidereal time has to be {}'.format(\n                ' or '.join(sorted(SIDEREAL_TIME_MODELS.keys()))))\n\n        available_models = SIDEREAL_TIME_MODELS[kind.lower()]\n\n        if model is None:\n            model = sorted(available_models.keys())[-1]\n        elif model.upper() not in available_models:\n            raise ValueError(\n                'Model {} not implemented for {} sidereal time; '\n                'available models are {}'\n                .format(model, kind, sorted(available_models.keys())))\n\n        model_kwargs = available_models[model.upper()]\n\n        if isinstance(longitude, str) and longitude in ('tio', 'greenwich'):\n            longitude = 0\n            model_kwargs = model_kwargs.copy()\n            model_kwargs['include_tio'] = False\n\n        return self._sid_time_or_earth_rot_ang(longitude=longitude, **model_kwargs)\n\n    if isinstance(sidereal_time.__doc__, str):\n        sidereal_time.__doc__ = sidereal_time.__doc__.format(\n            'apparent', sorted(SIDEREAL_TIME_MODELS['apparent'].keys()),\n            'mean', sorted(SIDEREAL_TIME_MODELS['mean'].keys()))\n\n    def _sid_time_or_earth_rot_ang(self, longitude, function, scales, include_tio=True):\n        \"\"\"Calculate a local sidereal time or Earth rotation angle.\n\n        Parameters\n        ----------\n        longitude : `~astropy.units.Quantity`, `~astropy.coordinates.EarthLocation`, str, or None; optional\n            The longitude on the Earth at which to compute the Earth rotation\n            angle (taken from a location as needed).  If `None` (default), taken\n            from the ``location`` attribute of the Time instance.\n        function : callable\n            The ERFA function to use.\n        scales : tuple of str\n            The time scales that the function requires on input.\n        include_tio : bool, optional\n            Whether to includes the TIO locator corrected for polar motion.\n            Should be `False` for pre-2000 IAU models.  Default: `True`.\n\n        Returns\n        -------\n        `~astropy.coordinates.Longitude`\n            Local sidereal time or Earth rotation angle, with units of hourangle.\n\n        \"\"\"\n        from astropy.coordinates import Longitude, EarthLocation\n        from astropy.coordinates.builtin_frames.utils import get_polar_motion\n        from astropy.coordinates.matrix_utilities import rotation_matrix\n\n        if longitude is None:\n            if self.location is None:\n                raise ValueError('No longitude is given but the location for '\n                                 'the Time object is not set.')\n            longitude = self.location.lon\n        elif isinstance(longitude, EarthLocation):\n            longitude = longitude.lon\n        else:\n            # Sanity check on input; default unit is degree.\n            longitude = Longitude(longitude, u.degree, copy=False)\n\n        theta = self._call_erfa(function, scales)\n\n        if include_tio:\n            # TODO: this duplicates part of coordinates.erfa_astrom.ErfaAstrom.apio;\n            # maybe posisble to factor out to one or the other.\n            sp = self._call_erfa(erfa.sp00, ('tt',))\n            xp, yp = get_polar_motion(self)\n            # Form the rotation matrix, CIRS to apparent [HA,Dec].\n            r = (rotation_matrix(longitude, 'z')\n                 @ rotation_matrix(-yp, 'x', unit=u.radian)\n                 @ rotation_matrix(-xp, 'y', unit=u.radian)\n                 @ rotation_matrix(theta+sp, 'z', unit=u.radian))\n            # Solve for angle.\n            angle = np.arctan2(r[..., 0, 1], r[..., 0, 0]) << u.radian\n\n        else:\n            angle = longitude + (theta << u.radian)\n\n        return Longitude(angle, u.hourangle)\n\n    def _call_erfa(self, function, scales):\n        # TODO: allow erfa functions to be used on Time with __array_ufunc__.\n        erfa_parameters = [getattr(getattr(self, scale)._time, jd_part)\n                           for scale in scales\n                           for jd_part in ('jd1', 'jd2_filled')]\n\n        result = function(*erfa_parameters)\n\n        if self.masked:\n            result[self.mask] = np.nan\n\n        return result\n\n    def get_delta_ut1_utc(self, iers_table=None, return_status=False):\n        \"\"\"Find UT1 - UTC differences by interpolating in IERS Table.\n\n        Parameters\n        ----------\n        iers_table : `~astropy.utils.iers.IERS`, optional\n            Table containing UT1-UTC differences from IERS Bulletins A\n            and/or B.  Default: `~astropy.utils.iers.earth_orientation_table`\n            (which in turn defaults to the combined version provided by\n            `~astropy.utils.iers.IERS_Auto`).\n        return_status : bool\n            Whether to return status values.  If `False` (default), iers\n            raises `IndexError` if any time is out of the range\n            covered by the IERS table.\n\n        Returns\n        -------\n        ut1_utc : float or float array\n            UT1-UTC, interpolated in IERS Table\n        status : int or int array\n            Status values (if ``return_status=`True```)::\n            ``astropy.utils.iers.FROM_IERS_B``\n            ``astropy.utils.iers.FROM_IERS_A``\n            ``astropy.utils.iers.FROM_IERS_A_PREDICTION``\n            ``astropy.utils.iers.TIME_BEFORE_IERS_RANGE``\n            ``astropy.utils.iers.TIME_BEYOND_IERS_RANGE``\n\n        Notes\n        -----\n        In normal usage, UT1-UTC differences are calculated automatically\n        on the first instance ut1 is needed.\n\n        Examples\n        --------\n        To check in code whether any times are before the IERS table range::\n\n            >>> from astropy.utils.iers import TIME_BEFORE_IERS_RANGE\n            >>> t = Time(['1961-01-01', '2000-01-01'], scale='utc')\n            >>> delta, status = t.get_delta_ut1_utc(return_status=True)  # doctest: +REMOTE_DATA\n            >>> status == TIME_BEFORE_IERS_RANGE  # doctest: +REMOTE_DATA\n            array([ True, False]...)\n        \"\"\"\n        if iers_table is None:\n            from astropy.utils.iers import earth_orientation_table\n            iers_table = earth_orientation_table.get()\n\n        return iers_table.ut1_utc(self.utc, return_status=return_status)\n\n    # Property for ERFA DUT arg = UT1 - UTC\n    def _get_delta_ut1_utc(self, jd1=None, jd2=None):\n        \"\"\"\n        Get ERFA DUT arg = UT1 - UTC.  This getter takes optional jd1 and\n        jd2 args because it gets called that way when converting time scales.\n        If delta_ut1_utc is not yet set, this will interpolate them from the\n        the IERS table.\n        \"\"\"\n        # Sec. 4.3.1: the arg DUT is the quantity delta_UT1 = UT1 - UTC in\n        # seconds. It is obtained from tables published by the IERS.\n        if not hasattr(self, '_delta_ut1_utc'):\n            from astropy.utils.iers import earth_orientation_table\n            iers_table = earth_orientation_table.get()\n            # jd1, jd2 are normally set (see above), except if delta_ut1_utc\n            # is access directly; ensure we behave as expected for that case\n            if jd1 is None:\n                self_utc = self.utc\n                jd1, jd2 = self_utc._time.jd1, self_utc._time.jd2_filled\n                scale = 'utc'\n            else:\n                scale = self.scale\n            # interpolate UT1-UTC in IERS table\n            delta = iers_table.ut1_utc(jd1, jd2)\n            # if we interpolated using UT1 jds, we may be off by one\n            # second near leap seconds (and very slightly off elsewhere)\n            if scale == 'ut1':\n                # calculate UTC using the offset we got; the ERFA routine\n                # is tolerant of leap seconds, so will do this right\n                jd1_utc, jd2_utc = erfa.ut1utc(jd1, jd2, delta.to_value(u.s))\n                # calculate a better estimate using the nearly correct UTC\n                delta = iers_table.ut1_utc(jd1_utc, jd2_utc)\n\n            self._set_delta_ut1_utc(delta)\n\n        return self._delta_ut1_utc\n\n    def _set_delta_ut1_utc(self, val):\n        del self.cache\n        if hasattr(val, 'to'):  # Matches Quantity but also TimeDelta.\n            val = val.to(u.second).value\n        val = self._match_shape(val)\n        self._delta_ut1_utc = val\n\n    # Note can't use @property because _get_delta_tdb_tt is explicitly\n    # called with the optional jd1 and jd2 args.\n    delta_ut1_utc = property(_get_delta_ut1_utc, _set_delta_ut1_utc)\n    \"\"\"UT1 - UTC time scale offset\"\"\"\n\n    # Property for ERFA DTR arg = TDB - TT\n    def _get_delta_tdb_tt(self, jd1=None, jd2=None):\n        if not hasattr(self, '_delta_tdb_tt'):\n            # If jd1 and jd2 are not provided (which is the case for property\n            # attribute access) then require that the time scale is TT or TDB.\n            # Otherwise the computations here are not correct.\n            if jd1 is None or jd2 is None:\n                if self.scale not in ('tt', 'tdb'):\n                    raise ValueError('Accessing the delta_tdb_tt attribute '\n                                     'is only possible for TT or TDB time '\n                                     'scales')\n                else:\n                    jd1 = self._time.jd1\n                    jd2 = self._time.jd2_filled\n\n            # First go from the current input time (which is either\n            # TDB or TT) to an approximate UT1.  Since TT and TDB are\n            # pretty close (few msec?), assume TT.  Similarly, since the\n            # UT1 terms are very small, use UTC instead of UT1.\n            njd1, njd2 = erfa.tttai(jd1, jd2)\n            njd1, njd2 = erfa.taiutc(njd1, njd2)\n            # subtract 0.5, so UT is fraction of the day from midnight\n            ut = day_frac(njd1 - 0.5, njd2)[1]\n\n            if self.location is None:\n                # Assume geocentric.\n                self._delta_tdb_tt = erfa.dtdb(jd1, jd2, ut, 0., 0., 0.)\n            else:\n                location = self.location\n                # Geodetic params needed for d_tdb_tt()\n                lon = location.lon\n                rxy = np.hypot(location.x, location.y)\n                z = location.z\n                self._delta_tdb_tt = erfa.dtdb(\n                    jd1, jd2, ut, lon.to_value(u.radian),\n                    rxy.to_value(u.km), z.to_value(u.km))\n\n        return self._delta_tdb_tt\n\n    def _set_delta_tdb_tt(self, val):\n        del self.cache\n        if hasattr(val, 'to'):  # Matches Quantity but also TimeDelta.\n            val = val.to(u.second).value\n        val = self._match_shape(val)\n        self._delta_tdb_tt = val\n\n    # Note can't use @property because _get_delta_tdb_tt is explicitly\n    # called with the optional jd1 and jd2 args.\n    delta_tdb_tt = property(_get_delta_tdb_tt, _set_delta_tdb_tt)\n    \"\"\"TDB - TT time scale offset\"\"\"\n\n    def __sub__(self, other):\n        # T      - Tdelta = T\n        # T      - T      = Tdelta\n        other_is_delta = not isinstance(other, Time)\n        if other_is_delta:  # T - Tdelta\n            # Check other is really a TimeDelta or something that can initialize.\n            if not isinstance(other, TimeDelta):\n                try:\n                    other = TimeDelta(other)\n                except Exception:\n                    return NotImplemented\n\n            # we need a constant scale to calculate, which is guaranteed for\n            # TimeDelta, but not for Time (which can be UTC)\n            out = self.replicate()\n            if self.scale in other.SCALES:\n                if other.scale not in (out.scale, None):\n                    other = getattr(other, out.scale)\n            else:\n                if other.scale is None:\n                    out._set_scale('tai')\n                else:\n                    if self.scale not in TIME_TYPES[other.scale]:\n                        raise TypeError(\"Cannot subtract Time and TimeDelta instances \"\n                                        \"with scales '{}' and '{}'\"\n                                        .format(self.scale, other.scale))\n                    out._set_scale(other.scale)\n            # remove attributes that are invalidated by changing time\n            for attr in ('_delta_ut1_utc', '_delta_tdb_tt'):\n                if hasattr(out, attr):\n                    delattr(out, attr)\n\n        else:  # T - T\n            # the scales should be compatible (e.g., cannot convert TDB to LOCAL)\n            if other.scale not in self.SCALES:\n                raise TypeError(\"Cannot subtract Time instances \"\n                                \"with scales '{}' and '{}'\"\n                                .format(self.scale, other.scale))\n            self_time = (self._time if self.scale in TIME_DELTA_SCALES\n                         else self.tai._time)\n            # set up TimeDelta, subtraction to be done shortly\n            out = TimeDelta(self_time.jd1, self_time.jd2, format='jd',\n                            scale=self_time.scale)\n\n            if other.scale != out.scale:\n                other = getattr(other, out.scale)\n\n        jd1 = out._time.jd1 - other._time.jd1\n        jd2 = out._time.jd2 - other._time.jd2\n\n        out._time.jd1, out._time.jd2 = day_frac(jd1, jd2)\n\n        if other_is_delta:\n            # Go back to left-side scale if needed\n            out._set_scale(self.scale)\n\n        return out\n\n    def __add__(self, other):\n        # T      + Tdelta = T\n        # T      + T      = error\n        if isinstance(other, Time):\n            raise OperandTypeError(self, other, '+')\n\n        # Check other is really a TimeDelta or something that can initialize.\n        if not isinstance(other, TimeDelta):\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                return NotImplemented\n\n        # ideally, we calculate in the scale of the Time item, since that is\n        # what we want the output in, but this may not be possible, since\n        # TimeDelta cannot be converted arbitrarily\n        out = self.replicate()\n        if self.scale in other.SCALES:\n            if other.scale not in (out.scale, None):\n                other = getattr(other, out.scale)\n        else:\n            if other.scale is None:\n                out._set_scale('tai')\n            else:\n                if self.scale not in TIME_TYPES[other.scale]:\n                    raise TypeError(\"Cannot add Time and TimeDelta instances \"\n                                    \"with scales '{}' and '{}'\"\n                                    .format(self.scale, other.scale))\n                out._set_scale(other.scale)\n        # remove attributes that are invalidated by changing time\n        for attr in ('_delta_ut1_utc', '_delta_tdb_tt'):\n            if hasattr(out, attr):\n                delattr(out, attr)\n\n        jd1 = out._time.jd1 + other._time.jd1\n        jd2 = out._time.jd2 + other._time.jd2\n\n        out._time.jd1, out._time.jd2 = day_frac(jd1, jd2)\n\n        # Go back to left-side scale if needed\n        out._set_scale(self.scale)\n\n        return out\n\n    # Reverse addition is possible: <something-Tdelta-ish> + T\n    # but there is no case of <something> - T, so no __rsub__.\n    def __radd__(self, other):\n        return self.__add__(other)\n\n    def to_datetime(self, timezone=None):\n        # TODO: this could likely go through to_value, as long as that\n        # had an **kwargs part that was just passed on to _time.\n        tm = self.replicate(format='datetime')\n        return tm._shaped_like_input(tm._time.to_value(timezone))\n\n    to_datetime.__doc__ = TimeDatetime.to_value.__doc__\n\n\nclass TimeDeltaMissingUnitWarning(AstropyDeprecationWarning):\n    \"\"\"Warning for missing unit or format in TimeDelta\"\"\"\n    pass\n\n\nclass TimeDelta(TimeBase):\n    \"\"\"\n    Represent the time difference between two times.\n\n    A TimeDelta object is initialized with one or more times in the ``val``\n    argument.  The input times in ``val`` must conform to the specified\n    ``format``.  The optional ``val2`` time input should be supplied only for\n    numeric input formats (e.g. JD) where very high precision (better than\n    64-bit precision) is required.\n\n    The allowed values for ``format`` can be listed with::\n\n      >>> list(TimeDelta.FORMATS)\n      ['sec', 'jd', 'datetime']\n\n    Note that for time differences, the scale can be among three groups:\n    geocentric ('tai', 'tt', 'tcg'), barycentric ('tcb', 'tdb'), and rotational\n    ('ut1'). Within each of these, the scales for time differences are the\n    same. Conversion between geocentric and barycentric is possible, as there\n    is only a scale factor change, but one cannot convert to or from 'ut1', as\n    this requires knowledge of the actual times, not just their difference. For\n    a similar reason, 'utc' is not a valid scale for a time difference: a UTC\n    day is not always 86400 seconds.\n\n    See also:\n\n    - https://docs.astropy.org/en/stable/time/\n    - https://docs.astropy.org/en/stable/time/index.html#time-deltas\n\n    Parameters\n    ----------\n    val : sequence, ndarray, number, `~astropy.units.Quantity` or `~astropy.time.TimeDelta` object\n        Value(s) to initialize the time difference(s). Any quantities will\n        be converted appropriately (with care taken to avoid rounding\n        errors for regular time units).\n    val2 : sequence, ndarray, number, or `~astropy.units.Quantity`; optional\n        Additional values, as needed to preserve precision.\n    format : str, optional\n        Format of input value(s). For numerical inputs without units,\n        \"jd\" is assumed and values are interpreted as days.\n        A deprecation warning is raised in this case. To avoid the warning,\n        either specify the format or add units to the input values.\n    scale : str, optional\n        Time scale of input value(s), must be one of the following values:\n        ('tdb', 'tt', 'ut1', 'tcg', 'tcb', 'tai'). If not given (or\n        ``None``), the scale is arbitrary; when added or subtracted from a\n        ``Time`` instance, it will be used without conversion.\n    copy : bool, optional\n        Make a copy of the input values\n    \"\"\"\n    SCALES = TIME_DELTA_SCALES\n    \"\"\"List of time delta scales.\"\"\"\n\n    FORMATS = TIME_DELTA_FORMATS\n    \"\"\"Dict of time delta formats.\"\"\"\n\n    info = TimeDeltaInfo()\n\n    def __new__(cls, val, val2=None, format=None, scale=None,\n                precision=None, in_subfmt=None, out_subfmt=None,\n                location=None, copy=False):\n\n        if isinstance(val, TimeDelta):\n            self = val.replicate(format=format, copy=copy, cls=cls)\n        else:\n            self = super().__new__(cls)\n\n        return self\n\n    def __init__(self, val, val2=None, format=None, scale=None, copy=False):\n        if isinstance(val, TimeDelta):\n            if scale is not None:\n                self._set_scale(scale)\n        else:\n            format = format or self._get_format(val)\n            self._init_from_vals(val, val2, format, scale, copy)\n\n            if scale is not None:\n                self.SCALES = TIME_DELTA_TYPES[scale]\n\n    @staticmethod\n    def _get_format(val):\n        if isinstance(val, timedelta):\n            return 'datetime'\n\n        if getattr(val, 'unit', None) is None:\n            warn('Numerical value without unit or explicit format passed to'\n                 ' TimeDelta, assuming days', TimeDeltaMissingUnitWarning)\n\n        return 'jd'\n\n    def replicate(self, *args, **kwargs):\n        out = super().replicate(*args, **kwargs)\n        out.SCALES = self.SCALES\n        return out\n\n    def to_datetime(self):\n        \"\"\"\n        Convert to ``datetime.timedelta`` object.\n        \"\"\"\n        tm = self.replicate(format='datetime')\n        return tm._shaped_like_input(tm._time.value)\n\n    def _set_scale(self, scale):\n        \"\"\"\n        This is the key routine that actually does time scale conversions.\n        This is not public and not connected to the read-only scale property.\n        \"\"\"\n\n        if scale == self.scale:\n            return\n        if scale not in self.SCALES:\n            raise ValueError(\"Scale {!r} is not in the allowed scales {}\"\n                             .format(scale, sorted(self.SCALES)))\n\n        # For TimeDelta, there can only be a change in scale factor,\n        # which is written as time2 - time1 = scale_offset * time1\n        scale_offset = SCALE_OFFSETS[(self.scale, scale)]\n        if scale_offset is None:\n            self._time.scale = scale\n        else:\n            jd1, jd2 = self._time.jd1, self._time.jd2\n            offset1, offset2 = day_frac(jd1, jd2, factor=scale_offset)\n            self._time = self.FORMATS[self.format](\n                jd1 + offset1, jd2 + offset2, scale,\n                self.precision, self.in_subfmt,\n                self.out_subfmt, from_jd=True)\n\n    def _add_sub(self, other, op):\n        \"\"\"Perform common elements of addition / subtraction for two delta times\"\"\"\n        # If not a TimeDelta then see if it can be turned into a TimeDelta.\n        if not isinstance(other, TimeDelta):\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                return NotImplemented\n\n        # the scales should be compatible (e.g., cannot convert TDB to TAI)\n        if(self.scale is not None and self.scale not in other.SCALES\n           or other.scale is not None and other.scale not in self.SCALES):\n            raise TypeError(\"Cannot add TimeDelta instances with scales \"\n                            \"'{}' and '{}'\".format(self.scale, other.scale))\n\n        # adjust the scale of other if the scale of self is set (or no scales)\n        if self.scale is not None or other.scale is None:\n            out = self.replicate()\n            if other.scale is not None:\n                other = getattr(other, self.scale)\n        else:\n            out = other.replicate()\n\n        jd1 = op(self._time.jd1, other._time.jd1)\n        jd2 = op(self._time.jd2, other._time.jd2)\n\n        out._time.jd1, out._time.jd2 = day_frac(jd1, jd2)\n\n        return out\n\n    def __add__(self, other):\n        # If other is a Time then use Time.__add__ to do the calculation.\n        if isinstance(other, Time):\n            return other.__add__(self)\n\n        return self._add_sub(other, operator.add)\n\n    def __sub__(self, other):\n        # TimeDelta - Time is an error\n        if isinstance(other, Time):\n            raise OperandTypeError(self, other, '-')\n\n        return self._add_sub(other, operator.sub)\n\n    def __radd__(self, other):\n        return self.__add__(other)\n\n    def __rsub__(self, other):\n        out = self.__sub__(other)\n        return -out\n\n    def __neg__(self):\n        \"\"\"Negation of a `TimeDelta` object.\"\"\"\n        new = self.copy()\n        new._time.jd1 = -self._time.jd1\n        new._time.jd2 = -self._time.jd2\n        return new\n\n    def __abs__(self):\n        \"\"\"Absolute value of a `TimeDelta` object.\"\"\"\n        jd1, jd2 = self._time.jd1, self._time.jd2\n        negative = jd1 + jd2 < 0\n        new = self.copy()\n        new._time.jd1 = np.where(negative, -jd1, jd1)\n        new._time.jd2 = np.where(negative, -jd2, jd2)\n        return new\n\n    def __mul__(self, other):\n        \"\"\"Multiplication of `TimeDelta` objects by numbers/arrays.\"\"\"\n        # Check needed since otherwise the self.jd1 * other multiplication\n        # would enter here again (via __rmul__)\n        if isinstance(other, Time):\n            raise OperandTypeError(self, other, '*')\n        elif ((isinstance(other, u.UnitBase)\n               and other == u.dimensionless_unscaled)\n                or (isinstance(other, str) and other == '')):\n            return self.copy()\n\n        # If other is something consistent with a dimensionless quantity\n        # (could just be a float or an array), then we can just multiple in.\n        try:\n            other = u.Quantity(other, u.dimensionless_unscaled, copy=False)\n        except Exception:\n            # If not consistent with a dimensionless quantity, try downgrading\n            # self to a quantity and see if things work.\n            try:\n                return self.to(u.day) * other\n            except Exception:\n                # The various ways we could multiply all failed;\n                # returning NotImplemented to give other a final chance.\n                return NotImplemented\n\n        jd1, jd2 = day_frac(self.jd1, self.jd2, factor=other.value)\n        out = TimeDelta(jd1, jd2, format='jd', scale=self.scale)\n\n        if self.format != 'jd':\n            out = out.replicate(format=self.format)\n        return out\n\n    def __rmul__(self, other):\n        \"\"\"Multiplication of numbers/arrays with `TimeDelta` objects.\"\"\"\n        return self.__mul__(other)\n\n    def __truediv__(self, other):\n        \"\"\"Division of `TimeDelta` objects by numbers/arrays.\"\"\"\n        # Cannot do __mul__(1./other) as that looses precision\n        if ((isinstance(other, u.UnitBase)\n             and other == u.dimensionless_unscaled)\n                or (isinstance(other, str) and other == '')):\n            return self.copy()\n\n        # If other is something consistent with a dimensionless quantity\n        # (could just be a float or an array), then we can just divide in.\n        try:\n            other = u.Quantity(other, u.dimensionless_unscaled, copy=False)\n        except Exception:\n            # If not consistent with a dimensionless quantity, try downgrading\n            # self to a quantity and see if things work.\n            try:\n                return self.to(u.day) / other\n            except Exception:\n                # The various ways we could divide all failed;\n                # returning NotImplemented to give other a final chance.\n                return NotImplemented\n\n        jd1, jd2 = day_frac(self.jd1, self.jd2, divisor=other.value)\n        out = TimeDelta(jd1, jd2, format='jd', scale=self.scale)\n\n        if self.format != 'jd':\n            out = out.replicate(format=self.format)\n        return out\n\n    def __rtruediv__(self, other):\n        \"\"\"Division by `TimeDelta` objects of numbers/arrays.\"\"\"\n        # Here, we do not have to worry about returning NotImplemented,\n        # since other has already had a chance to look at us.\n        return other / self.to(u.day)\n\n    def to(self, unit, equivalencies=[]):\n        \"\"\"\n        Convert to a quantity in the specified unit.\n\n        Parameters\n        ----------\n        unit : unit-like\n            The unit to convert to.\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not directly\n            convertible (see :ref:`astropy:unit_equivalencies`). If `None`, no\n            equivalencies will be applied at all, not even any set globallyq\n            or within a context.\n\n        Returns\n        -------\n        quantity : `~astropy.units.Quantity`\n            The quantity in the units specified.\n\n        See also\n        --------\n        to_value : get the numerical value in a given unit.\n        \"\"\"\n        return u.Quantity(self._time.jd1 + self._time.jd2,\n                          u.day).to(unit, equivalencies=equivalencies)\n\n    def to_value(self, *args, **kwargs):\n        \"\"\"Get time delta values expressed in specified output format or unit.\n\n        This method is flexible and handles both conversion to a specified\n        ``TimeDelta`` format / sub-format AND conversion to a specified unit.\n        If positional argument(s) are provided then the first one is checked\n        to see if it is a valid ``TimeDelta`` format, and next it is checked\n        to see if it is a valid unit or unit string.\n\n        To convert to a ``TimeDelta`` format and optional sub-format the options\n        are::\n\n          tm = TimeDelta(1.0 * u.s)\n          tm.to_value('jd')  # equivalent of tm.jd\n          tm.to_value('jd', 'decimal')  # convert to 'jd' as a Decimal object\n          tm.to_value('jd', subfmt='decimal')\n          tm.to_value(format='jd', subfmt='decimal')\n\n        To convert to a unit with optional equivalencies, the options are::\n\n          tm.to_value('hr')  # convert to u.hr (hours)\n          tm.to_value('hr', [])  # specify equivalencies as a positional arg\n          tm.to_value('hr', equivalencies=[])\n          tm.to_value(unit='hr', equivalencies=[])\n\n        The built-in `~astropy.time.TimeDelta` options for ``format`` are:\n        {'jd', 'sec', 'datetime'}.\n\n        For the two numerical formats 'jd' and 'sec', the available ``subfmt``\n        options are: {'float', 'long', 'decimal', 'str', 'bytes'}. Here, 'long'\n        uses ``numpy.longdouble`` for somewhat enhanced precision (with the\n        enhancement depending on platform), and 'decimal' instances of\n        :class:`decimal.Decimal` for full precision.  For the 'str' and 'bytes'\n        sub-formats, the number of digits is also chosen such that time values\n        are represented accurately.  Default: as set by ``out_subfmt`` (which by\n        default picks the first available for a given format, i.e., 'float').\n\n        Parameters\n        ----------\n        format : str, optional\n            The format in which one wants the `~astropy.time.TimeDelta` values.\n            Default: the current format.\n        subfmt : str, optional\n            Possible sub-format in which the values should be given. Default: as\n            set by ``out_subfmt`` (which by default picks the first available\n            for a given format, i.e., 'float' or 'date_hms').\n        unit : `~astropy.units.UnitBase` instance or str, optional\n            The unit in which the value should be given.\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not directly\n            convertible (see :ref:`astropy:unit_equivalencies`). If `None`, no\n            equivalencies will be applied at all, not even any set globally or\n            within a context.\n\n        Returns\n        -------\n        value : ndarray or scalar\n            The value in the format or units specified.\n\n        See also\n        --------\n        to : Convert to a `~astropy.units.Quantity` instance in a given unit.\n        value : The time value in the current format.\n\n        \"\"\"\n        if not (args or kwargs):\n            raise TypeError('to_value() missing required format or unit argument')\n\n        # TODO: maybe allow 'subfmt' also for units, keeping full precision\n        # (effectively, by doing the reverse of quantity_day_frac)?\n        # This way, only equivalencies could lead to possible precision loss.\n        if ('format' in kwargs\n                or (args != () and (args[0] is None or args[0] in self.FORMATS))):\n            # Super-class will error with duplicate arguments, etc.\n            return super().to_value(*args, **kwargs)\n\n        # With positional arguments, we try parsing the first one as a unit,\n        # so that on failure we can give a more informative exception.\n        if args:\n            try:\n                unit = u.Unit(args[0])\n            except ValueError as exc:\n                raise ValueError(\"first argument is not one of the known \"\n                                 \"formats ({}) and failed to parse as a unit.\"\n                                 .format(list(self.FORMATS))) from exc\n            args = (unit,) + args[1:]\n\n        return u.Quantity(self._time.jd1 + self._time.jd2,\n                          u.day).to_value(*args, **kwargs)\n\n    def _make_value_equivalent(self, item, value):\n        \"\"\"Coerce setitem value into an equivalent TimeDelta object\"\"\"\n        if not isinstance(value, TimeDelta):\n            try:\n                value = self.__class__(value, scale=self.scale, format=self.format)\n            except Exception as err:\n                raise ValueError('cannot convert value to a compatible TimeDelta '\n                                 'object: {}'.format(err))\n        return value\n\n    def isclose(self, other, atol=None, rtol=0.0):\n        \"\"\"Returns a boolean or boolean array where two TimeDelta objects are\n        element-wise equal within a time tolerance.\n\n        This effectively evaluates the expression below::\n\n          abs(self - other) <= atol + rtol * abs(other)\n\n        Parameters\n        ----------\n        other : `~astropy.units.Quantity` or `~astropy.time.TimeDelta`\n            Quantity or TimeDelta object for comparison.\n        atol : `~astropy.units.Quantity` or `~astropy.time.TimeDelta`\n            Absolute tolerance for equality with units of time (e.g. ``u.s`` or\n            ``u.day``). Default is one bit in the 128-bit JD time representation,\n            equivalent to about 20 picosecs.\n        rtol : float\n            Relative tolerance for equality\n        \"\"\"\n        try:\n            other_day = other.to_value(u.day)\n        except Exception as err:\n            raise TypeError(f\"'other' argument must support conversion to days: {err}\")\n\n        if atol is None:\n            atol = np.finfo(float).eps * u.day\n\n        if not isinstance(atol, (u.Quantity, TimeDelta)):\n            raise TypeError(\"'atol' argument must be a Quantity or TimeDelta instance, got \"\n                            f'{atol.__class__.__name__} instead')\n\n        return np.isclose(self.to_value(u.day), other_day,\n                          rtol=rtol, atol=atol.to_value(u.day))\n\n\nclass ScaleValueError(Exception):\n    pass\n\n\ndef _make_array(val, copy=False):\n    \"\"\"\n    Take ``val`` and convert/reshape to an array.  If ``copy`` is `True`\n    then copy input values.\n\n    Returns\n    -------\n    val : ndarray\n        Array version of ``val``.\n    \"\"\"\n    if isinstance(val, (tuple, list)) and len(val) > 0 and isinstance(val[0], Time):\n        dtype = object\n    else:\n        dtype = None\n\n    val = np.array(val, copy=copy, subok=True, dtype=dtype)\n\n    # Allow only float64, string or object arrays as input\n    # (object is for datetime, maybe add more specific test later?)\n    # This also ensures the right byteorder for float64 (closes #2942).\n    if val.dtype.kind == \"f\" and val.dtype.itemsize >= np.dtype(np.float64).itemsize:\n        pass\n    elif val.dtype.kind in 'OSUMaV':\n        pass\n    else:\n        val = np.asanyarray(val, dtype=np.float64)\n\n    return val\n\n\ndef _check_for_masked_and_fill(val, val2):\n    \"\"\"\n    If ``val`` or ``val2`` are masked arrays then fill them and cast\n    to ndarray.\n\n    Returns a mask corresponding to the logical-or of masked elements\n    in ``val`` and ``val2``.  If neither is masked then the return ``mask``\n    is ``None``.\n\n    If either ``val`` or ``val2`` are masked then they are replaced\n    with filled versions of themselves.\n\n    Parameters\n    ----------\n    val : ndarray or MaskedArray\n        Input val\n    val2 : ndarray or MaskedArray\n        Input val2\n\n    Returns\n    -------\n    mask, val, val2: ndarray or None\n        Mask: (None or bool ndarray), val, val2: ndarray\n    \"\"\"\n    def get_as_filled_ndarray(mask, val):\n        \"\"\"\n        Fill the given MaskedArray ``val`` from the first non-masked\n        element in the array.  This ensures that upstream Time initialization\n        will succeed.\n\n        Note that nothing happens if there are no masked elements.\n        \"\"\"\n        fill_value = None\n\n        if np.any(val.mask):\n            # Final mask is the logical-or of inputs\n            mask = mask | val.mask\n\n            # First unmasked element.  If all elements are masked then\n            # use fill_value=None from above which will use val.fill_value.\n            # As long as the user has set this appropriately then all will\n            # be fine.\n            val_unmasked = val.compressed()  # 1-d ndarray of unmasked values\n            if len(val_unmasked) > 0:\n                fill_value = val_unmasked[0]\n\n        # Fill the input ``val``.  If fill_value is None then this just returns\n        # an ndarray view of val (no copy).\n        val = val.filled(fill_value)\n\n        return mask, val\n\n    mask = False\n    if isinstance(val, np.ma.MaskedArray):\n        mask, val = get_as_filled_ndarray(mask, val)\n    if isinstance(val2, np.ma.MaskedArray):\n        mask, val2 = get_as_filled_ndarray(mask, val2)\n\n    return mask, val, val2\n\n\nclass OperandTypeError(TypeError):\n    def __init__(self, left, right, op=None):\n        op_string = '' if op is None else f' for {op}'\n        super().__init__(\n            \"Unsupported operand type(s){}: \"\n            \"'{}' and '{}'\".format(op_string,\n                                   left.__class__.__name__,\n                                   right.__class__.__name__))\n\n\ndef _check_leapsec():\n    global _LEAP_SECONDS_CHECK\n    if _LEAP_SECONDS_CHECK != _LeapSecondsCheck.DONE:\n        from astropy.utils import iers\n        with _LEAP_SECONDS_LOCK:\n            # There are three ways we can get here:\n            # 1. First call (NOT_STARTED).\n            # 2. Re-entrant call (RUNNING). We skip the initialisation\n            #    and don't worry about leap second errors.\n            # 3. Another thread which raced with the first call\n            #    (RUNNING). The first thread has relinquished the\n            #    lock to us, so initialization is complete.\n            if _LEAP_SECONDS_CHECK == _LeapSecondsCheck.NOT_STARTED:\n                _LEAP_SECONDS_CHECK = _LeapSecondsCheck.RUNNING\n                update_leap_seconds()\n                _LEAP_SECONDS_CHECK = _LeapSecondsCheck.DONE\n\n\ndef update_leap_seconds(files=None):\n    \"\"\"If the current ERFA leap second table is out of date, try to update it.\n\n    Uses `astropy.utils.iers.LeapSeconds.auto_open` to try to find an\n    up-to-date table.  See that routine for the definition of \"out of date\".\n\n    In order to make it safe to call this any time, all exceptions are turned\n    into warnings,\n\n    Parameters\n    ----------\n    files : list of path-like, optional\n        List of files/URLs to attempt to open.  By default, uses defined by\n        `astropy.utils.iers.LeapSeconds.auto_open`, which includes the table\n        used by ERFA itself, so if that is up to date, nothing will happen.\n\n    Returns\n    -------\n    n_update : int\n        Number of items updated.\n\n    \"\"\"\n    try:\n        from astropy.utils import iers\n\n        table = iers.LeapSeconds.auto_open(files)\n        return erfa.leap_seconds.update(table)\n\n    except Exception as exc:\n        warn(\"leap-second auto-update failed due to the following \"\n             f\"exception: {exc!r}\", AstropyWarning)\n        return 0\n"},{"className":"UnitConversionError","col":0,"comment":"\n    Used specifically for errors related to converting between units or\n    interpreting units in terms of other units.\n    ","endLoc":603,"id":8159,"nodeType":"Class","startLoc":599,"text":"class UnitConversionError(UnitsError, ValueError):\n    \"\"\"\n    Used specifically for errors related to converting between units or\n    interpreting units in terms of other units.\n    \"\"\""},{"attributeType":"null","col":16,"comment":"null","endLoc":119,"id":8160,"name":"_port","nodeType":"Attribute","startLoc":119,"text":"self._port"},{"className":"UnitsError","col":0,"comment":"\n    The base class for unit-specific exceptions.\n    ","endLoc":588,"id":8161,"nodeType":"Class","startLoc":585,"text":"class UnitsError(Exception):\n    \"\"\"\n    The base class for unit-specific exceptions.\n    \"\"\""},{"col":0,"comment":"\n    When overriding a __dir__ method on an object, you often want to\n    include the \"standard\" members on the object as well.  This\n    decorator takes care of that automatically, and all the wrapped\n    function needs to do is return a list of the \"special\" members\n    that wouldn't be found by the normal Python means.\n\n    Example\n    -------\n\n    Your class could define __dir__ as follows::\n\n        @override__dir__\n        def __dir__(self):\n            return ['special_method1', 'special_method2']\n    ","endLoc":63,"header":"def override__dir__(f)","id":8162,"name":"override__dir__","nodeType":"Function","startLoc":38,"text":"def override__dir__(f):\n    \"\"\"\n    When overriding a __dir__ method on an object, you often want to\n    include the \"standard\" members on the object as well.  This\n    decorator takes care of that automatically, and all the wrapped\n    function needs to do is return a list of the \"special\" members\n    that wouldn't be found by the normal Python means.\n\n    Example\n    -------\n\n    Your class could define __dir__ as follows::\n\n        @override__dir__\n        def __dir__(self):\n            return ['special_method1', 'special_method2']\n    \"\"\"\n    # http://bugs.python.org/issue12166\n\n    @functools.wraps(f)\n    def override__dir__wrapper(self):\n        members = set(object.__dir__(self))\n        members.update(f(self))\n        return sorted(members)\n\n    return override__dir__wrapper"},{"attributeType":"null","col":8,"comment":"null","endLoc":86,"id":8163,"name":"_private_key","nodeType":"Attribute","startLoc":86,"text":"self._private_key"},{"attributeType":"null","col":8,"comment":"null","endLoc":64,"id":8164,"name":"_is_running","nodeType":"Attribute","startLoc":64,"text":"self._is_running"},{"attributeType":"null","col":8,"comment":"null","endLoc":88,"id":8165,"name":"_notification_bindings","nodeType":"Attribute","startLoc":88,"text":"self._notification_bindings"},{"attributeType":"SAMPHubProxy","col":8,"comment":"null","endLoc":101,"id":8166,"name":"hub","nodeType":"Attribute","startLoc":101,"text":"self.hub"},{"attributeType":"null","col":8,"comment":"null","endLoc":81,"id":8167,"name":"_callable","nodeType":"Attribute","startLoc":81,"text":"self._callable"},{"className":"MixinInfo","col":0,"comment":"null","endLoc":753,"id":8168,"nodeType":"Class","startLoc":738,"text":"class MixinInfo(BaseColumnInfo):\n\n    @property\n    def name(self):\n        return self._attrs.get('name')\n\n    @name.setter\n    def name(self, name):\n        # For mixin columns that live within a table, rename the column in the\n        # table when setting the name attribute.  This mirrors the same\n        # functionality in the BaseColumn class.\n        if self.parent_table is not None:\n            new_name = None if name is None else str(name)\n            self.parent_table.columns._rename_column(self.name, new_name)\n\n        self._attrs['name'] = name"},{"className":"BaseColumnInfo","col":0,"comment":"\n    Base info class for anything that can be a column in an astropy\n    Table.  There are at least two classes that inherit from this:\n\n      ColumnInfo: for native astropy Column / MaskedColumn objects\n      MixinInfo: for mixin column objects\n\n    Note that this class is defined here so that mixins can use it\n    without importing the table package.\n    ","endLoc":735,"id":8169,"nodeType":"Class","startLoc":503,"text":"class BaseColumnInfo(DataInfo):\n    \"\"\"\n    Base info class for anything that can be a column in an astropy\n    Table.  There are at least two classes that inherit from this:\n\n      ColumnInfo: for native astropy Column / MaskedColumn objects\n      MixinInfo: for mixin column objects\n\n    Note that this class is defined here so that mixins can use it\n    without importing the table package.\n    \"\"\"\n    attr_names = DataInfo.attr_names.union(['parent_table', 'indices'])\n    _attrs_no_copy = set(['parent_table', 'indices'])\n\n    # Context for serialization.  This can be set temporarily via\n    # ``serialize_context_as(context)`` context manager to allow downstream\n    # code to understand the context in which a column is being serialized.\n    # Typical values are 'fits', 'hdf5', 'parquet', 'ecsv', 'yaml'.  Objects\n    # like Time or SkyCoord will have different default serialization\n    # representations depending on context.\n    _serialize_context = None\n    __slots__ = ['_format_funcs', '_copy_indices']\n\n    @property\n    def parent_table(self):\n        value = self._attrs.get('parent_table')\n        if callable(value):\n            value = value()\n        return value\n\n    @parent_table.setter\n    def parent_table(self, parent_table):\n        if parent_table is None:\n            self._attrs.pop('parent_table', None)\n        else:\n            parent_table = weakref.ref(parent_table)\n            self._attrs['parent_table'] = parent_table\n\n    def __init__(self, bound=False):\n        super().__init__(bound=bound)\n\n        # If bound to a data object instance then add a _format_funcs dict\n        # for caching functions for print formatting.\n        if bound:\n            self._format_funcs = {}\n\n    def __set__(self, instance, value):\n        # For Table columns do not set `info` when the instance is a scalar.\n        try:\n            if not instance.shape:\n                return\n        except AttributeError:\n            pass\n\n        super().__set__(instance, value)\n\n    def iter_str_vals(self):\n        \"\"\"\n        This is a mixin-safe version of Column.iter_str_vals.\n        \"\"\"\n        col = self._parent\n        if self.parent_table is None:\n            from astropy.table.column import FORMATTER as formatter\n        else:\n            formatter = self.parent_table.formatter\n\n        _pformat_col_iter = formatter._pformat_col_iter\n        for str_val in _pformat_col_iter(col, -1, False, False, {}):\n            yield str_val\n\n    @property\n    def indices(self):\n        # Implementation note: the auto-generation as an InfoAttribute cannot\n        # be used here, since on access, one should not just return the\n        # default (empty list is this case), but set _attrs['indices'] so that\n        # if the list is appended to, it is registered here.\n        return self._attrs.setdefault('indices', [])\n\n    @indices.setter\n    def indices(self, indices):\n        self._attrs['indices'] = indices\n\n    def adjust_indices(self, index, value, col_len):\n        '''\n        Adjust info indices after column modification.\n\n        Parameters\n        ----------\n        index : slice, int, list, or ndarray\n            Element(s) of column to modify. This parameter can\n            be a single row number, a list of row numbers, an\n            ndarray of row numbers, a boolean ndarray (a mask),\n            or a column slice.\n        value : int, list, or ndarray\n            New value(s) to insert\n        col_len : int\n            Length of the column\n        '''\n        if not self.indices:\n            return\n\n        if isinstance(index, slice):\n            # run through each key in slice\n            t = index.indices(col_len)\n            keys = list(range(*t))\n        elif isinstance(index, np.ndarray) and index.dtype.kind == 'b':\n            # boolean mask\n            keys = np.where(index)[0]\n        else:  # single int\n            keys = [index]\n\n        value = np.atleast_1d(value)  # turn array(x) into array([x])\n        if value.size == 1:\n            # repeat single value\n            value = list(value) * len(keys)\n\n        for key, val in zip(keys, value):\n            for col_index in self.indices:\n                col_index.replace(key, self.name, val)\n\n    def slice_indices(self, col_slice, item, col_len):\n        '''\n        Given a sliced object, modify its indices\n        to correctly represent the slice.\n\n        Parameters\n        ----------\n        col_slice : `~astropy.table.Column` or mixin\n            Sliced object. If not a column, it must be a valid mixin, see\n            https://docs.astropy.org/en/stable/table/mixin_columns.html\n        item : slice, list, or ndarray\n            Slice used to create col_slice\n        col_len : int\n            Length of original object\n        '''\n        from astropy.table.sorted_array import SortedArray\n        if not getattr(self, '_copy_indices', True):\n            # Necessary because MaskedArray will perform a shallow copy\n            col_slice.info.indices = []\n            return col_slice\n        elif isinstance(item, slice):\n            col_slice.info.indices = [x[item] for x in self.indices]\n        elif self.indices:\n            if isinstance(item, np.ndarray) and item.dtype.kind == 'b':\n                # boolean mask\n                item = np.where(item)[0]\n            # Empirical testing suggests that recreating a BST/RBT index is\n            # more effective than relabelling when less than ~60% of\n            # the total number of rows are involved, and is in general\n            # more effective for SortedArray.\n            small = len(item) <= 0.6 * col_len\n            col_slice.info.indices = []\n            for index in self.indices:\n                if small or isinstance(index, SortedArray):\n                    new_index = index.get_slice(col_slice, item)\n                else:\n                    new_index = deepcopy(index)\n                    new_index.replace_rows(item)\n                col_slice.info.indices.append(new_index)\n\n        return col_slice\n\n    @staticmethod\n    def merge_cols_attributes(cols, metadata_conflicts, name, attrs):\n        \"\"\"\n        Utility method to merge and validate the attributes ``attrs`` for the\n        input table columns ``cols``.\n\n        Note that ``dtype`` and ``shape`` attributes are handled specially.\n        These should not be passed in ``attrs`` but will always be in the\n        returned dict of merged attributes.\n\n        Parameters\n        ----------\n        cols : list\n            List of input Table column objects\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n        attrs : list\n            List of attribute names to be merged\n\n        Returns\n        -------\n        attrs : dict\n            Of merged attributes.\n\n        \"\"\"\n        from astropy.table.np_utils import TableMergeError\n\n        def warn_str_func(key, left, right):\n            out = (\"In merged column '{}' the '{}' attribute does not match \"\n                   \"({} != {}).  Using {} for merged output\"\n                   .format(name, key, left, right, right))\n            return out\n\n        def getattrs(col):\n            return {attr: getattr(col.info, attr) for attr in attrs\n                    if getattr(col.info, attr, None) is not None}\n\n        out = getattrs(cols[0])\n        for col in cols[1:]:\n            out = metadata.merge(out, getattrs(col), metadata_conflicts=metadata_conflicts,\n                                 warn_str_func=warn_str_func)\n\n        # Output dtype is the superset of all dtypes in in_cols\n        out['dtype'] = metadata.common_dtype(cols)\n\n        # Make sure all input shapes are the same\n        uniq_shapes = set(col.shape[1:] for col in cols)\n        if len(uniq_shapes) != 1:\n            raise TableMergeError('columns have different shapes')\n        out['shape'] = uniq_shapes.pop()\n\n        # \"Merged\" output name is the supplied name\n        if name is not None:\n            out['name'] = name\n\n        return out\n\n    def get_sortable_arrays(self):\n        \"\"\"\n        Return a list of arrays which can be lexically sorted to represent\n        the order of the parent column.\n\n        The base method raises NotImplementedError and must be overridden.\n\n        Returns\n        -------\n        arrays : list of ndarray\n        \"\"\"\n        raise NotImplementedError(f'column {self.name} is not sortable')"},{"attributeType":"null","col":8,"comment":"null","endLoc":78,"id":8170,"name":"_addr","nodeType":"Attribute","startLoc":78,"text":"self._addr"},{"className":"DataInfo","col":0,"comment":"\n    Descriptor that data classes use to add an ``info`` attribute for storing\n    data attributes in a uniform and portable way.  Note that it *must* be\n    called ``info`` so that the DataInfo() object can be stored in the\n    ``instance`` using the ``info`` key.  Because owner_cls.x is a descriptor,\n    Python doesn't use __dict__['x'] normally, and the descriptor can safely\n    store stuff there.  Thanks to\n    https://nbviewer.jupyter.org/urls/gist.github.com/ChrisBeaumont/5758381/raw/descriptor_writeup.ipynb\n    for this trick that works for non-hashable classes.\n\n    Parameters\n    ----------\n    bound : bool\n        If True this is a descriptor attribute in a class definition, else it\n        is a DataInfo() object that is bound to a data object instance. Default is False.\n    ","endLoc":500,"id":8171,"nodeType":"Class","startLoc":255,"text":"class DataInfo(metaclass=DataInfoMeta):\n    \"\"\"\n    Descriptor that data classes use to add an ``info`` attribute for storing\n    data attributes in a uniform and portable way.  Note that it *must* be\n    called ``info`` so that the DataInfo() object can be stored in the\n    ``instance`` using the ``info`` key.  Because owner_cls.x is a descriptor,\n    Python doesn't use __dict__['x'] normally, and the descriptor can safely\n    store stuff there.  Thanks to\n    https://nbviewer.jupyter.org/urls/gist.github.com/ChrisBeaumont/5758381/raw/descriptor_writeup.ipynb\n    for this trick that works for non-hashable classes.\n\n    Parameters\n    ----------\n    bound : bool\n        If True this is a descriptor attribute in a class definition, else it\n        is a DataInfo() object that is bound to a data object instance. Default is False.\n    \"\"\"\n    _stats = ['mean', 'std', 'min', 'max']\n    attrs_from_parent = set()\n    attr_names = set(['name', 'unit', 'dtype', 'format', 'description', 'meta'])\n    _attr_defaults = {'dtype': np.dtype('O')}\n    _attrs_no_copy = set()\n    _info_summary_attrs = ('dtype', 'shape', 'unit', 'format', 'description', 'class')\n    __slots__ = ['_parent_cls', '_parent_ref', '_attrs']\n    # This specifies the list of object attributes which must be stored in\n    # order to re-create the object after serialization.  This is independent\n    # of normal `info` attributes like name or description.  Subclasses will\n    # generally either define this statically (QuantityInfo) or dynamically\n    # (SkyCoordInfo).  These attributes may be scalars or arrays.  If arrays\n    # that match the object length they will be serialized as an independent\n    # column.\n    _represent_as_dict_attrs = ()\n\n    # This specifies attributes which are to be provided to the class\n    # initializer as ordered args instead of keyword args.  This is needed\n    # for Quantity subclasses where the keyword for data varies (e.g.\n    # between Quantity and Angle).\n    _construct_from_dict_args = ()\n\n    # This specifies the name of an attribute which is the \"primary\" data.\n    # Then when representing as columns\n    # (table.serialize._represent_mixin_as_column) the output for this\n    # attribute will be written with the just name of the mixin instead of the\n    # usual \"<name>.<attr>\".\n    _represent_as_dict_primary_data = None\n\n    def __init__(self, bound=False):\n        # If bound to a data object instance then create the dict of attributes\n        # which stores the info attribute values. Default of None for \"unset\"\n        # except for dtype where the default is object.\n        if bound:\n            self._attrs = {}\n\n    @property\n    def _parent(self):\n        try:\n            parent = self._parent_ref()\n        except AttributeError:\n            return None\n\n        if parent is None:\n            raise AttributeError(\"\"\"\\\nfailed to access \"info\" attribute on a temporary object.\n\nIt looks like you have done something like ``col[3:5].info`` or\n``col.quantity.info``, i.e.  you accessed ``info`` from a temporary slice\nobject that only exists momentarily.  This has failed because the reference to\nthat temporary object is now lost.  Instead force a permanent reference (e.g.\n``c = col[3:5]`` followed by ``c.info``).\"\"\")\n\n        return parent\n\n    def __get__(self, instance, owner_cls):\n        if instance is None:\n            # This is an unbound descriptor on the class\n            self._parent_cls = owner_cls\n            return self\n\n        info = instance.__dict__.get('info')\n        if info is None:\n            info = instance.__dict__['info'] = self.__class__(bound=True)\n        # We set _parent_ref on every call, since if one makes copies of\n        # instances, 'info' will be copied as well, which will lose the\n        # reference.\n        info._parent_ref = weakref.ref(instance)\n        return info\n\n    def __set__(self, instance, value):\n        if instance is None:\n            # This is an unbound descriptor on the class\n            raise ValueError('cannot set unbound descriptor')\n\n        if isinstance(value, DataInfo):\n            info = instance.__dict__['info'] = self.__class__(bound=True)\n            attr_names = info.attr_names\n            if value.__class__ is self.__class__:\n                # For same class, attributes are guaranteed to be stored in\n                # _attrs, so speed matters up by not accessing defaults.\n                # Doing this before difference in for loop helps speed.\n                attr_names = attr_names & set(value._attrs)  # NOT in-place!\n            else:\n                # For different classes, copy over the attributes in common.\n                attr_names = attr_names & (value.attr_names - value._attrs_no_copy)\n\n            for attr in attr_names - info.attrs_from_parent - info._attrs_no_copy:\n                info._attrs[attr] = deepcopy(getattr(value, attr))\n\n        else:\n            raise TypeError('info must be set with a DataInfo instance')\n\n    def __getstate__(self):\n        return self._attrs\n\n    def __setstate__(self, state):\n        self._attrs = state\n\n    def _represent_as_dict(self, attrs=None):\n        \"\"\"Get the values for the parent ``attrs`` and return as a dict.\n\n        By default, uses '_represent_as_dict_attrs'.\n        \"\"\"\n        if attrs is None:\n            attrs = self._represent_as_dict_attrs\n        return _get_obj_attrs_map(self._parent, attrs)\n\n    def _construct_from_dict(self, map):\n        args = [map.pop(attr) for attr in self._construct_from_dict_args]\n        return self._parent_cls(*args, **map)\n\n    info_summary_attributes = staticmethod(\n        data_info_factory(names=_info_summary_attrs,\n                          funcs=[partial(_get_data_attribute, attr=attr)\n                                 for attr in _info_summary_attrs]))\n\n    # No nan* methods in numpy < 1.8\n    info_summary_stats = staticmethod(\n        data_info_factory(names=_stats,\n                          funcs=[getattr(np, 'nan' + stat)\n                                 for stat in _stats]))\n\n    def __call__(self, option='attributes', out=''):\n        \"\"\"\n        Write summary information about data object to the ``out`` filehandle.\n        By default this prints to standard output via sys.stdout.\n\n        The ``option`` argument specifies what type of information\n        to include.  This can be a string, a function, or a list of\n        strings or functions.  Built-in options are:\n\n        - ``attributes``: data object attributes like ``dtype`` and ``format``\n        - ``stats``: basic statistics: min, mean, and max\n\n        If a function is specified then that function will be called with the\n        data object as its single argument.  The function must return an\n        OrderedDict containing the information attributes.\n\n        If a list is provided then the information attributes will be\n        appended for each of the options, in order.\n\n        Examples\n        --------\n\n        >>> from astropy.table import Column\n        >>> c = Column([1, 2], unit='m', dtype='int32')\n        >>> c.info()\n        dtype = int32\n        unit = m\n        class = Column\n        n_bad = 0\n        length = 2\n\n        >>> c.info(['attributes', 'stats'])\n        dtype = int32\n        unit = m\n        class = Column\n        mean = 1.5\n        std = 0.5\n        min = 1\n        max = 2\n        n_bad = 0\n        length = 2\n\n        Parameters\n        ----------\n        option : str, callable, list of (str or callable)\n            Info option, defaults to 'attributes'.\n        out : file-like, None\n            Output destination, defaults to sys.stdout.  If None then the\n            OrderedDict with information attributes is returned\n\n        Returns\n        -------\n        info : `~collections.OrderedDict` or None\n            `~collections.OrderedDict` if out==None else None\n        \"\"\"\n        if out == '':\n            out = sys.stdout\n\n        dat = self._parent\n        info = OrderedDict()\n        name = dat.info.name\n        if name is not None:\n            info['name'] = name\n\n        options = option if isinstance(option, (list, tuple)) else [option]\n        for option in options:\n            if isinstance(option, str):\n                if hasattr(self, 'info_summary_' + option):\n                    option = getattr(self, 'info_summary_' + option)\n                else:\n                    raise ValueError('option={} is not an allowed information type'\n                                     .format(option))\n\n            with warnings.catch_warnings():\n                for ignore_kwargs in IGNORE_WARNINGS:\n                    warnings.filterwarnings('ignore', **ignore_kwargs)\n                info.update(option(dat))\n\n        if hasattr(dat, 'mask'):\n            n_bad = np.count_nonzero(dat.mask)\n        else:\n            try:\n                n_bad = np.count_nonzero(np.isinf(dat) | np.isnan(dat))\n            except Exception:\n                n_bad = 0\n        info['n_bad'] = n_bad\n\n        try:\n            info['length'] = len(dat)\n        except (TypeError, IndexError):\n            pass\n\n        if out is None:\n            return info\n\n        for key, val in info.items():\n            if val != '':\n                out.write(f'{key} = {val}' + os.linesep)\n\n    def __repr__(self):\n        if self._parent is None:\n            return super().__repr__()\n\n        out = StringIO()\n        self.__call__(out=out)\n        return out.getvalue()"},{"col":4,"comment":"null","endLoc":306,"header":"def __init__(self, bound=False)","id":8172,"name":"__init__","nodeType":"Function","startLoc":301,"text":"def __init__(self, bound=False):\n        # If bound to a data object instance then create the dict of attributes\n        # which stores the info attribute values. Default of None for \"unset\"\n        # except for dtype where the default is object.\n        if bound:\n            self._attrs = {}"},{"col":4,"comment":"null","endLoc":325,"header":"@property\n    def _parent(self)","id":8173,"name":"_parent","nodeType":"Function","startLoc":308,"text":"@property\n    def _parent(self):\n        try:\n            parent = self._parent_ref()\n        except AttributeError:\n            return None\n\n        if parent is None:\n            raise AttributeError(\"\"\"\\\nfailed to access \"info\" attribute on a temporary object.\n\nIt looks like you have done something like ``col[3:5].info`` or\n``col.quantity.info``, i.e.  you accessed ``info`` from a temporary slice\nobject that only exists momentarily.  This has failed because the reference to\nthat temporary object is now lost.  Instead force a permanent reference (e.g.\n``c = col[3:5]`` followed by ``c.info``).\"\"\")\n\n        return parent"},{"attributeType":"null","col":12,"comment":"null","endLoc":105,"id":8174,"name":"_thread","nodeType":"Attribute","startLoc":105,"text":"self._thread"},{"attributeType":"null","col":12,"comment":"null","endLoc":108,"id":8175,"name":"client","nodeType":"Attribute","startLoc":108,"text":"self.client"},{"attributeType":"null","col":8,"comment":"null","endLoc":65,"id":8176,"name":"_is_registered","nodeType":"Attribute","startLoc":65,"text":"self._is_registered"},{"attributeType":"null","col":12,"comment":"null","endLoc":123,"id":8177,"name":"_xmlrpcAddr","nodeType":"Attribute","startLoc":123,"text":"self._xmlrpcAddr"},{"attributeType":"null","col":8,"comment":"null","endLoc":91,"id":8178,"name":"_response_bindings","nodeType":"Attribute","startLoc":91,"text":"self._response_bindings"},{"attributeType":"null","col":8,"comment":"null","endLoc":76,"id":8179,"name":"_metadata","nodeType":"Attribute","startLoc":76,"text":"self._metadata"},{"attributeType":"null","col":8,"comment":"null","endLoc":89,"id":8180,"name":"_call_bindings","nodeType":"Attribute","startLoc":89,"text":"self._call_bindings"},{"attributeType":"null","col":16,"comment":"null","endLoc":99,"id":8181,"name":"_host_name","nodeType":"Attribute","startLoc":99,"text":"self._host_name"},{"col":4,"comment":"null","endLoc":400,"header":"def _format_easy_response(self, status, result, error)","id":8182,"name":"_format_easy_response","nodeType":"Function","startLoc":392,"text":"def _format_easy_response(self, status, result, error):\n\n        msg = {\"samp.status\": status}\n        if result is not None:\n            msg.update({\"samp.result\": result})\n        if error is not None:\n            msg.update({\"samp.error\": error})\n\n        return msg"},{"col":4,"comment":"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.reply`.\n\n        This is a proxy to ``reply`` method that allows to send a reply\n        message in a simplified way.\n\n        Parameters\n        ----------\n        msg_id : str\n            Message ID to which reply.\n\n        status : str\n            Content of the ``samp.status`` response keyword.\n\n        result : dict\n            Content of the ``samp.result`` response keyword.\n\n        error : dict\n            Content of the ``samp.error`` response keyword.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient, SAMP_STATUS_ERROR\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> cli.ereply(\"abd\", SAMP_STATUS_ERROR, result={},\n        ...            error={\"samp.errortxt\": \"Test error message\"})\n        ","endLoc":431,"header":"def ereply(self, msg_id, status, result=None, error=None)","id":8183,"name":"ereply","nodeType":"Function","startLoc":402,"text":"def ereply(self, msg_id, status, result=None, error=None):\n        \"\"\"\n        Easy to use version of :meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.reply`.\n\n        This is a proxy to ``reply`` method that allows to send a reply\n        message in a simplified way.\n\n        Parameters\n        ----------\n        msg_id : str\n            Message ID to which reply.\n\n        status : str\n            Content of the ``samp.status`` response keyword.\n\n        result : dict\n            Content of the ``samp.result`` response keyword.\n\n        error : dict\n            Content of the ``samp.error`` response keyword.\n\n        Examples\n        --------\n        >>> from astropy.samp import SAMPIntegratedClient, SAMP_STATUS_ERROR\n        >>> cli = SAMPIntegratedClient()\n        >>> ...\n        >>> cli.ereply(\"abd\", SAMP_STATUS_ERROR, result={},\n        ...            error={\"samp.errortxt\": \"Test error message\"})\n        \"\"\"\n        return self.reply(msg_id, self._format_easy_response(status, result, error))"},{"col":4,"comment":"null","endLoc":436,"header":"def receive_notification(self, private_key, sender_id, message)","id":8184,"name":"receive_notification","nodeType":"Function","startLoc":435,"text":"def receive_notification(self, private_key, sender_id, message):\n        return self.client.receive_notification(private_key, sender_id, message)"},{"col":4,"comment":"null","endLoc":441,"header":"def receive_call(self, private_key, sender_id, msg_id, message)","id":8185,"name":"receive_call","nodeType":"Function","startLoc":440,"text":"def receive_call(self, private_key, sender_id, msg_id, message):\n        return self.client.receive_call(private_key, sender_id, msg_id, message)"},{"col":4,"comment":"null","endLoc":446,"header":"def receive_response(self, private_key, responder_id, msg_tag, response)","id":8186,"name":"receive_response","nodeType":"Function","startLoc":445,"text":"def receive_response(self, private_key, responder_id, msg_tag, response):\n        return self.client.receive_response(private_key, responder_id, msg_tag, response)"},{"col":4,"comment":"null","endLoc":451,"header":"def bind_receive_message(self, mtype, function, declare=True, metadata=None)","id":8187,"name":"bind_receive_message","nodeType":"Function","startLoc":450,"text":"def bind_receive_message(self, mtype, function, declare=True, metadata=None):\n        self.client.bind_receive_message(mtype, function, declare=True, metadata=None)"},{"col":4,"comment":"null","endLoc":456,"header":"def bind_receive_notification(self, mtype, function, declare=True, metadata=None)","id":8188,"name":"bind_receive_notification","nodeType":"Function","startLoc":455,"text":"def bind_receive_notification(self, mtype, function, declare=True, metadata=None):\n        self.client.bind_receive_notification(mtype, function, declare, metadata)"},{"col":4,"comment":"null","endLoc":461,"header":"def bind_receive_call(self, mtype, function, declare=True, metadata=None)","id":8189,"name":"bind_receive_call","nodeType":"Function","startLoc":460,"text":"def bind_receive_call(self, mtype, function, declare=True, metadata=None):\n        self.client.bind_receive_call(mtype, function, declare, metadata)"},{"col":4,"comment":"null","endLoc":466,"header":"def bind_receive_response(self, msg_tag, function)","id":8190,"name":"bind_receive_response","nodeType":"Function","startLoc":465,"text":"def bind_receive_response(self, msg_tag, function):\n        self.client.bind_receive_response(msg_tag, function)"},{"col":4,"comment":"null","endLoc":471,"header":"def unbind_receive_notification(self, mtype, declare=True)","id":8191,"name":"unbind_receive_notification","nodeType":"Function","startLoc":470,"text":"def unbind_receive_notification(self, mtype, declare=True):\n        self.client.unbind_receive_notification(mtype, declare)"},{"col":4,"comment":"null","endLoc":476,"header":"def unbind_receive_call(self, mtype, declare=True)","id":8192,"name":"unbind_receive_call","nodeType":"Function","startLoc":475,"text":"def unbind_receive_call(self, mtype, declare=True):\n        self.client.unbind_receive_call(mtype, declare)"},{"col":4,"comment":"null","endLoc":481,"header":"def unbind_receive_response(self, msg_tag)","id":8193,"name":"unbind_receive_response","nodeType":"Function","startLoc":480,"text":"def unbind_receive_response(self, msg_tag):\n        self.client.unbind_receive_response(msg_tag)"},{"col":4,"comment":"null","endLoc":486,"header":"def declare_subscriptions(self, subscriptions=None)","id":8194,"name":"declare_subscriptions","nodeType":"Function","startLoc":485,"text":"def declare_subscriptions(self, subscriptions=None):\n        self.client.declare_subscriptions(subscriptions)"},{"col":4,"comment":"null","endLoc":496,"header":"def get_public_id(self)","id":8195,"name":"get_public_id","nodeType":"Function","startLoc":495,"text":"def get_public_id(self):\n        return self.client.get_public_id()"},{"attributeType":"null","col":4,"comment":"null","endLoc":438,"id":8196,"name":"__doc__","nodeType":"Attribute","startLoc":438,"text":"receive_notification.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":443,"id":8197,"name":"__doc__","nodeType":"Attribute","startLoc":443,"text":"receive_call.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":448,"id":8198,"name":"__doc__","nodeType":"Attribute","startLoc":448,"text":"receive_response.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":453,"id":8199,"name":"__doc__","nodeType":"Attribute","startLoc":453,"text":"bind_receive_message.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":458,"id":8200,"name":"__doc__","nodeType":"Attribute","startLoc":458,"text":"bind_receive_notification.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":463,"id":8201,"name":"__doc__","nodeType":"Attribute","startLoc":463,"text":"bind_receive_call.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":468,"id":8202,"name":"__doc__","nodeType":"Attribute","startLoc":468,"text":"bind_receive_response.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":473,"id":8203,"name":"__doc__","nodeType":"Attribute","startLoc":473,"text":"unbind_receive_notification.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":478,"id":8204,"name":"__doc__","nodeType":"Attribute","startLoc":478,"text":"unbind_receive_call.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":483,"id":8205,"name":"__doc__","nodeType":"Attribute","startLoc":483,"text":"unbind_receive_response.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":488,"id":8206,"name":"__doc__","nodeType":"Attribute","startLoc":488,"text":"declare_subscriptions.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":493,"id":8207,"name":"__doc__","nodeType":"Attribute","startLoc":493,"text":"get_private_key.__doc__"},{"col":0,"comment":"\n    For a given coordinate frame, return the corresponding WCS object.\n\n    Note that the returned WCS object has only the elements corresponding to\n    coordinate frames set (e.g. ctype, equinox, radesys).\n\n    Parameters\n    ----------\n    frame : :class:`~astropy.coordinates.baseframe.BaseCoordinateFrame` subclass instance\n        An instance of a :class:`~astropy.coordinates.baseframe.BaseCoordinateFrame`\n        subclass instance for which to find the WCS\n    projection : str\n        Projection code to use in ctype, if applicable\n\n    Returns\n    -------\n    wcs : :class:`~astropy.wcs.WCS` instance\n        The corresponding WCS object\n\n    Examples\n    --------\n\n    ::\n\n        >>> from astropy.wcs.utils import celestial_frame_to_wcs\n        >>> from astropy.coordinates import FK5\n        >>> frame = FK5(equinox='J2010')\n        >>> wcs = celestial_frame_to_wcs(frame)\n        >>> wcs.to_header()\n        WCSAXES =                    2 / Number of coordinate axes\n        CRPIX1  =                  0.0 / Pixel coordinate of reference point\n        CRPIX2  =                  0.0 / Pixel coordinate of reference point\n        CDELT1  =                  1.0 / [deg] Coordinate increment at reference point\n        CDELT2  =                  1.0 / [deg] Coordinate increment at reference point\n        CUNIT1  = 'deg'                / Units of coordinate increment and value\n        CUNIT2  = 'deg'                / Units of coordinate increment and value\n        CTYPE1  = 'RA---TAN'           / Right ascension, gnomonic projection\n        CTYPE2  = 'DEC--TAN'           / Declination, gnomonic projection\n        CRVAL1  =                  0.0 / [deg] Coordinate value at reference point\n        CRVAL2  =                  0.0 / [deg] Coordinate value at reference point\n        LONPOLE =                180.0 / [deg] Native longitude of celestial pole\n        LATPOLE =                  0.0 / [deg] Native latitude of celestial pole\n        RADESYS = 'FK5'                / Equatorial coordinate system\n        EQUINOX =               2010.0 / [yr] Equinox of equatorial coordinates\n\n\n    Notes\n    -----\n\n    To extend this function to frames not defined in astropy.coordinates, you\n    can write your own function which should take a\n    :class:`~astropy.coordinates.baseframe.BaseCoordinateFrame` subclass\n    instance and a projection (given as a string) and should return either a WCS\n    instance, or `None` if the WCS could not be determined. You can register\n    this function temporarily with::\n\n        >>> from astropy.wcs.utils import celestial_frame_to_wcs, custom_frame_to_wcs_mappings\n        >>> with custom_frame_to_wcs_mappings(my_function):\n        ...     celestial_frame_to_wcs(...)\n\n    ","endLoc":291,"header":"def celestial_frame_to_wcs(frame, projection='TAN')","id":8208,"name":"celestial_frame_to_wcs","nodeType":"Function","startLoc":223,"text":"def celestial_frame_to_wcs(frame, projection='TAN'):\n    \"\"\"\n    For a given coordinate frame, return the corresponding WCS object.\n\n    Note that the returned WCS object has only the elements corresponding to\n    coordinate frames set (e.g. ctype, equinox, radesys).\n\n    Parameters\n    ----------\n    frame : :class:`~astropy.coordinates.baseframe.BaseCoordinateFrame` subclass instance\n        An instance of a :class:`~astropy.coordinates.baseframe.BaseCoordinateFrame`\n        subclass instance for which to find the WCS\n    projection : str\n        Projection code to use in ctype, if applicable\n\n    Returns\n    -------\n    wcs : :class:`~astropy.wcs.WCS` instance\n        The corresponding WCS object\n\n    Examples\n    --------\n\n    ::\n\n        >>> from astropy.wcs.utils import celestial_frame_to_wcs\n        >>> from astropy.coordinates import FK5\n        >>> frame = FK5(equinox='J2010')\n        >>> wcs = celestial_frame_to_wcs(frame)\n        >>> wcs.to_header()\n        WCSAXES =                    2 / Number of coordinate axes\n        CRPIX1  =                  0.0 / Pixel coordinate of reference point\n        CRPIX2  =                  0.0 / Pixel coordinate of reference point\n        CDELT1  =                  1.0 / [deg] Coordinate increment at reference point\n        CDELT2  =                  1.0 / [deg] Coordinate increment at reference point\n        CUNIT1  = 'deg'                / Units of coordinate increment and value\n        CUNIT2  = 'deg'                / Units of coordinate increment and value\n        CTYPE1  = 'RA---TAN'           / Right ascension, gnomonic projection\n        CTYPE2  = 'DEC--TAN'           / Declination, gnomonic projection\n        CRVAL1  =                  0.0 / [deg] Coordinate value at reference point\n        CRVAL2  =                  0.0 / [deg] Coordinate value at reference point\n        LONPOLE =                180.0 / [deg] Native longitude of celestial pole\n        LATPOLE =                  0.0 / [deg] Native latitude of celestial pole\n        RADESYS = 'FK5'                / Equatorial coordinate system\n        EQUINOX =               2010.0 / [yr] Equinox of equatorial coordinates\n\n\n    Notes\n    -----\n\n    To extend this function to frames not defined in astropy.coordinates, you\n    can write your own function which should take a\n    :class:`~astropy.coordinates.baseframe.BaseCoordinateFrame` subclass\n    instance and a projection (given as a string) and should return either a WCS\n    instance, or `None` if the WCS could not be determined. You can register\n    this function temporarily with::\n\n        >>> from astropy.wcs.utils import celestial_frame_to_wcs, custom_frame_to_wcs_mappings\n        >>> with custom_frame_to_wcs_mappings(my_function):\n        ...     celestial_frame_to_wcs(...)\n\n    \"\"\"\n    for mapping_set in FRAME_WCS_MAPPINGS:\n        for func in mapping_set:\n            wcs = func(frame, projection=projection)\n            if wcs is not None:\n                return wcs\n    raise ValueError(\"Could not determine WCS corresponding to the specified \"\n                     \"coordinate frame.\")"},{"attributeType":"null","col":4,"comment":"null","endLoc":498,"id":8209,"name":"__doc__","nodeType":"Attribute","startLoc":498,"text":"get_public_id.__doc__"},{"attributeType":"null","col":8,"comment":"null","endLoc":50,"id":8210,"name":"hub","nodeType":"Attribute","startLoc":50,"text":"self.hub"},{"attributeType":"null","col":8,"comment":"\n        Collected arguments that should be passed on to the SAMPClient below.\n        The SAMPClient used to be instantiated in __init__; however, this\n        caused problems with disconnecting and reconnecting to the HUB.\n        The client_arguments is used to maintain backwards compatibility.\n        ","endLoc":52,"id":8211,"name":"client_arguments","nodeType":"Attribute","startLoc":52,"text":"self.client_arguments"},{"col":0,"comment":"\n    For a WCS returns `False` if square image (detector) pixels stay square\n    when projected onto the \"plane of intermediate world coordinates\"\n    as defined in\n    `Greisen & Calabretta 2002, A&A, 395, 1061 <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1061G>`_.\n    It will return `True` if transformation from image (detector) coordinates\n    to the focal plane coordinates is non-orthogonal or if WCS contains\n    non-linear (e.g., SIP) distortions.\n\n    .. note::\n        Since this function is concerned **only** about the transformation\n        \"image plane\"->\"focal plane\" and **not** about the transformation\n        \"celestial sphere\"->\"focal plane\"->\"image plane\",\n        this function ignores distortions arising due to non-linear nature\n        of most projections.\n\n    Let's denote by *C* either the original or the reconstructed\n    (from ``PC`` and ``CDELT``) CD matrix. `is_proj_plane_distorted`\n    verifies that the transformation from image (detector) coordinates\n    to the focal plane coordinates is orthogonal using the following\n    check:\n\n    .. math::\n        \\left \\| \\frac{C \\cdot C^{\\mathrm{T}}}\n        {| det(C)|} - I \\right \\|_{\\mathrm{max}} < \\epsilon .\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.WCS`\n        World coordinate system object\n\n    maxerr : float, optional\n        Accuracy to which the CD matrix, **normalized** such\n        that :math:`|det(CD)|=1`, should be close to being an\n        orthogonal matrix as described in the above equation\n        (see :math:`\\epsilon`).\n\n    Returns\n    -------\n    distorted : bool\n        Returns `True` if focal (projection) plane is distorted and `False`\n        otherwise.\n\n    ","endLoc":446,"header":"def is_proj_plane_distorted(wcs, maxerr=1.0e-5)","id":8212,"name":"is_proj_plane_distorted","nodeType":"Function","startLoc":399,"text":"def is_proj_plane_distorted(wcs, maxerr=1.0e-5):\n    r\"\"\"\n    For a WCS returns `False` if square image (detector) pixels stay square\n    when projected onto the \"plane of intermediate world coordinates\"\n    as defined in\n    `Greisen & Calabretta 2002, A&A, 395, 1061 <https://ui.adsabs.harvard.edu/abs/2002A%26A...395.1061G>`_.\n    It will return `True` if transformation from image (detector) coordinates\n    to the focal plane coordinates is non-orthogonal or if WCS contains\n    non-linear (e.g., SIP) distortions.\n\n    .. note::\n        Since this function is concerned **only** about the transformation\n        \"image plane\"->\"focal plane\" and **not** about the transformation\n        \"celestial sphere\"->\"focal plane\"->\"image plane\",\n        this function ignores distortions arising due to non-linear nature\n        of most projections.\n\n    Let's denote by *C* either the original or the reconstructed\n    (from ``PC`` and ``CDELT``) CD matrix. `is_proj_plane_distorted`\n    verifies that the transformation from image (detector) coordinates\n    to the focal plane coordinates is orthogonal using the following\n    check:\n\n    .. math::\n        \\left \\| \\frac{C \\cdot C^{\\mathrm{T}}}\n        {| det(C)|} - I \\right \\|_{\\mathrm{max}} < \\epsilon .\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.WCS`\n        World coordinate system object\n\n    maxerr : float, optional\n        Accuracy to which the CD matrix, **normalized** such\n        that :math:`|det(CD)|=1`, should be close to being an\n        orthogonal matrix as described in the above equation\n        (see :math:`\\epsilon`).\n\n    Returns\n    -------\n    distorted : bool\n        Returns `True` if focal (projection) plane is distorted and `False`\n        otherwise.\n\n    \"\"\"\n    cwcs = wcs.celestial\n    return (not _is_cd_orthogonal(cwcs.pixel_scale_matrix, maxerr) or\n            _has_distortion(cwcs))"},{"attributeType":"null","col":8,"comment":"The client will be instantiated upon connect().","endLoc":67,"id":8213,"name":"client","nodeType":"Attribute","startLoc":67,"text":"self.client"},{"className":"AlwaysApproveWebProfileDialog","col":0,"comment":"null","endLoc":28,"id":8214,"nodeType":"Class","startLoc":13,"text":"class AlwaysApproveWebProfileDialog(WebProfileDialog):\n\n    def __init__(self):\n        self.polling = True\n        WebProfileDialog.__init__(self)\n\n    def show_dialog(self, *args):\n        self.consent()\n\n    def poll(self):\n        while self.polling:\n            self.handle_queue()\n            time.sleep(0.1)\n\n    def stop(self):\n        self.polling = False"},{"col":0,"comment":"null","endLoc":463,"header":"def _is_cd_orthogonal(cd, maxerr)","id":8215,"name":"_is_cd_orthogonal","nodeType":"Function","startLoc":449,"text":"def _is_cd_orthogonal(cd, maxerr):\n    shape = cd.shape\n    if not (len(shape) == 2 and shape[0] == shape[1]):\n        raise ValueError(\"CD (or PC) matrix must be a 2D square matrix.\")\n\n    pixarea = np.abs(np.linalg.det(cd))\n    if (pixarea == 0.0):\n        raise ValueError(\"CD (or PC) matrix is singular.\")\n\n    # NOTE: Technically, below we should use np.dot(cd, np.conjugate(cd.T))\n    # However, I am not aware of complex CD/PC matrices...\n    I = np.dot(cd, cd.T) / pixarea\n    cd_unitary_err = np.amax(np.abs(I - np.eye(shape[0])))\n\n    return (cd_unitary_err < maxerr)"},{"col":4,"comment":"null","endLoc":17,"header":"def __init__(self)","id":8216,"name":"__init__","nodeType":"Function","startLoc":15,"text":"def __init__(self):\n        self.polling = True\n        WebProfileDialog.__init__(self)"},{"col":4,"comment":"null","endLoc":769,"header":"def _declare_metadata(self, private_key, metadata)","id":8217,"name":"_declare_metadata","nodeType":"Function","startLoc":760,"text":"def _declare_metadata(self, private_key, metadata):\n        self._update_last_activity_time(private_key)\n        if private_key in self._private_keys:\n            log.debug(\"declare_metadata: private-key = {} metadata = {}\"\n                      .format(private_key, str(metadata)))\n            self._metadata[private_key] = metadata\n            self._notify_metadata(private_key)\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n        return \"\""},{"col":4,"comment":"null","endLoc":20,"header":"def show_dialog(self, *args)","id":8218,"name":"show_dialog","nodeType":"Function","startLoc":19,"text":"def show_dialog(self, *args):\n        self.consent()"},{"col":4,"comment":"null","endLoc":340,"header":"def __get__(self, instance, owner_cls)","id":8219,"name":"__get__","nodeType":"Function","startLoc":327,"text":"def __get__(self, instance, owner_cls):\n        if instance is None:\n            # This is an unbound descriptor on the class\n            self._parent_cls = owner_cls\n            return self\n\n        info = instance.__dict__.get('info')\n        if info is None:\n            info = instance.__dict__['info'] = self.__class__(bound=True)\n        # We set _parent_ref on every call, since if one makes copies of\n        # instances, 'info' will be copied as well, which will lose the\n        # reference.\n        info._parent_ref = weakref.ref(instance)\n        return info"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":8220,"name":"__all__","nodeType":"Attribute","startLoc":7,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":8221,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":9,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":4,"header":"integrated_client.py#<anonymous>","id":8222,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['SAMPIntegratedClient']\n\n__doctest_skip__ = ['SAMPIntegratedClient.*']"},{"col":4,"comment":"null","endLoc":616,"header":"def _notify_metadata(self, private_key)","id":8223,"name":"_notify_metadata","nodeType":"Function","startLoc":604,"text":"def _notify_metadata(self, private_key):\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.event.metadata\")\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                public_id = self._private_keys[private_key][0]\n                for key in self._mtype2ids[mtype]:\n                    # if key != private_key:\n                    self._notify(self._hub_private_key,\n                                 self._private_keys[key][0],\n                                 {\"samp.mtype\": \"samp.hub.event.metadata\",\n                                  \"samp.params\": {\"id\": public_id,\n                                                  \"metadata\": self._metadata[private_key]}\n                                  })"},{"fileName":"utils.py","filePath":"astropy/time","id":8224,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"Time utilities.\n\nIn particular, routines to do basic arithmetic on numbers represented by two\ndoubles, using the procedure of Shewchuk, 1997, Discrete & Computational\nGeometry 18(3):305-363 -- http://www.cs.berkeley.edu/~jrs/papers/robustr.pdf\n\nFurthermore, some helper routines to turn strings and other types of\nobjects into two values, and vice versa.\n\"\"\"\nimport decimal\n\nimport numpy as np\nimport astropy.units as u\n\n\ndef day_frac(val1, val2, factor=None, divisor=None):\n    \"\"\"Return the sum of ``val1`` and ``val2`` as two float64s.\n\n    The returned floats are an integer part and the fractional remainder,\n    with the latter guaranteed to be within -0.5 and 0.5 (inclusive on\n    either side, as the integer is rounded to even).\n\n    The arithmetic is all done with exact floating point operations so no\n    precision is lost to rounding error.  It is assumed the sum is less\n    than about 1e16, otherwise the remainder will be greater than 1.0.\n\n    Parameters\n    ----------\n    val1, val2 : array of float\n        Values to be summed.\n    factor : float, optional\n        If given, multiply the sum by it.\n    divisor : float, optional\n        If given, divide the sum by it.\n\n    Returns\n    -------\n    day, frac : float64\n        Integer and fractional part of val1 + val2.\n    \"\"\"\n    # Add val1 and val2 exactly, returning the result as two float64s.\n    # The first is the approximate sum (with some floating point error)\n    # and the second is the error of the float64 sum.\n    sum12, err12 = two_sum(val1, val2)\n\n    if factor is not None:\n        sum12, carry = two_product(sum12, factor)\n        carry += err12 * factor\n        sum12, err12 = two_sum(sum12, carry)\n\n    if divisor is not None:\n        q1 = sum12 / divisor\n        p1, p2 = two_product(q1, divisor)\n        d1, d2 = two_sum(sum12, -p1)\n        d2 += err12\n        d2 -= p2\n        q2 = (d1 + d2) / divisor  # 3-part float fine here; nothing can be lost\n        sum12, err12 = two_sum(q1, q2)\n\n    # get integer fraction\n    day = np.round(sum12)\n    extra, frac = two_sum(sum12, -day)\n    frac += extra + err12\n    # Our fraction can now have gotten >0.5 or <-0.5, which means we would\n    # loose one bit of precision. So, correct for that.\n    excess = np.round(frac)\n    day += excess\n    extra, frac = two_sum(sum12, -day)\n    frac += extra + err12\n    return day, frac\n\n\ndef quantity_day_frac(val1, val2=None):\n    \"\"\"Like ``day_frac``, but for quantities with units of time.\n\n    The quantities are separately converted to days. Here, we need to take\n    care with the conversion since while the routines here can do accurate\n    multiplication, the conversion factor itself may not be accurate.  For\n    instance, if the quantity is in seconds, the conversion factor is\n    1./86400., which is not exactly representable as a float.\n\n    To work around this, for conversion factors less than unity, rather than\n    multiply by that possibly inaccurate factor, the value is divided by the\n    conversion factor of a day to that unit (i.e., by 86400. for seconds).  For\n    conversion factors larger than 1, such as 365.25 for years, we do just\n    multiply.  With this scheme, one has precise conversion factors for all\n    regular time units that astropy defines.  Note, however, that it does not\n    necessarily work for all custom time units, and cannot work when conversion\n    to time is via an equivalency.  For those cases, one remains limited by the\n    fact that Quantity calculations are done in double precision, not in\n    quadruple precision as for time.\n    \"\"\"\n    if val2 is not None:\n        res11, res12 = quantity_day_frac(val1)\n        res21, res22 = quantity_day_frac(val2)\n        # This summation is can at most lose 1 ULP in the second number.\n        return res11 + res21, res12 + res22\n\n    try:\n        factor = val1.unit.to(u.day)\n    except Exception:\n        # Not a simple scaling, so cannot do the full-precision one.\n        # But at least try normal conversion, since equivalencies may be set.\n        return val1.to_value(u.day), 0.\n\n    if factor == 1.:\n        return day_frac(val1.value, 0.)\n\n    if factor > 1:\n        return day_frac(val1.value, 0., factor=factor)\n    else:\n        divisor = u.day.to(val1.unit)\n        return day_frac(val1.value, 0., divisor=divisor)\n\n\ndef two_sum(a, b):\n    \"\"\"\n    Add ``a`` and ``b`` exactly, returning the result as two float64s.\n    The first is the approximate sum (with some floating point error)\n    and the second is the error of the float64 sum.\n\n    Using the procedure of Shewchuk, 1997,\n    Discrete & Computational Geometry 18(3):305-363\n    http://www.cs.berkeley.edu/~jrs/papers/robustr.pdf\n\n    Returns\n    -------\n    sum, err : float64\n        Approximate sum of a + b and the exact floating point error\n    \"\"\"\n    x = a + b\n    eb = x - a  # bvirtual in Shewchuk\n    ea = x - eb  # avirtual in Shewchuk\n    eb = b - eb  # broundoff in Shewchuk\n    ea = a - ea  # aroundoff in Shewchuk\n    return x, ea + eb\n\n\ndef two_product(a, b):\n    \"\"\"\n    Multiple ``a`` and ``b`` exactly, returning the result as two float64s.\n    The first is the approximate product (with some floating point error)\n    and the second is the error of the float64 product.\n\n    Uses the procedure of Shewchuk, 1997,\n    Discrete & Computational Geometry 18(3):305-363\n    http://www.cs.berkeley.edu/~jrs/papers/robustr.pdf\n\n    Returns\n    -------\n    prod, err : float64\n        Approximate product a * b and the exact floating point error\n    \"\"\"\n    x = a * b\n    ah, al = split(a)\n    bh, bl = split(b)\n    y1 = ah * bh\n    y = x - y1\n    y2 = al * bh\n    y -= y2\n    y3 = ah * bl\n    y -= y3\n    y4 = al * bl\n    y = y4 - y\n    return x, y\n\n\ndef split(a):\n    \"\"\"\n    Split float64 in two aligned parts.\n\n    Uses the procedure of Shewchuk, 1997,\n    Discrete & Computational Geometry 18(3):305-363\n    http://www.cs.berkeley.edu/~jrs/papers/robustr.pdf\n\n    \"\"\"\n    c = 134217729. * a  # 2**27+1.\n    abig = c - a\n    ah = c - abig\n    al = a - ah\n    return ah, al\n\n\n_enough_decimal_places = 34  # to represent two doubles\n\n\ndef longdouble_to_twoval(val1, val2=None):\n    if val2 is None:\n        val2 = val1.dtype.type(0.)\n    else:\n        best_type = np.result_type(val1.dtype, val2.dtype)\n        val1 = val1.astype(best_type, copy=False)\n        val2 = val2.astype(best_type, copy=False)\n\n    # day_frac is independent of dtype, as long as the dtype\n    # are the same and no factor or divisor is given.\n    i, f = day_frac(val1, val2)\n    return i.astype(float, copy=False), f.astype(float, copy=False)\n\n\ndef decimal_to_twoval1(val1, val2=None):\n    with decimal.localcontext() as ctx:\n        ctx.prec = _enough_decimal_places\n        d = decimal.Decimal(val1)\n        i = round(d)\n        f = d - i\n    return float(i), float(f)\n\n\ndef bytes_to_twoval1(val1, val2=None):\n    return decimal_to_twoval1(val1.decode('ascii'))\n\n\ndef twoval_to_longdouble(val1, val2):\n    return val1.astype(np.longdouble) + val2.astype(np.longdouble)\n\n\ndef twoval_to_decimal1(val1, val2):\n    with decimal.localcontext() as ctx:\n        ctx.prec = _enough_decimal_places\n        return decimal.Decimal(val1) + decimal.Decimal(val2)\n\n\ndef twoval_to_string1(val1, val2, fmt):\n    if val2 == 0.:\n        # For some formats, only a single float is really used.\n        # For those, let numpy take care of correct number of digits.\n        return str(val1)\n\n    result = format(twoval_to_decimal1(val1, val2), fmt).strip('0')\n    if result[-1] == '.':\n        result += '0'\n    return result\n\n\ndef twoval_to_bytes1(val1, val2, fmt):\n    return twoval_to_string1(val1, val2, fmt).encode('ascii')\n\n\ndecimal_to_twoval = np.vectorize(decimal_to_twoval1)\nbytes_to_twoval = np.vectorize(bytes_to_twoval1)\ntwoval_to_decimal = np.vectorize(twoval_to_decimal1)\ntwoval_to_string = np.vectorize(twoval_to_string1, excluded='fmt')\ntwoval_to_bytes = np.vectorize(twoval_to_bytes1, excluded='fmt')\n"},{"col":0,"comment":"null","endLoc":200,"header":"def longdouble_to_twoval(val1, val2=None)","id":8225,"name":"longdouble_to_twoval","nodeType":"Function","startLoc":189,"text":"def longdouble_to_twoval(val1, val2=None):\n    if val2 is None:\n        val2 = val1.dtype.type(0.)\n    else:\n        best_type = np.result_type(val1.dtype, val2.dtype)\n        val1 = val1.astype(best_type, copy=False)\n        val2 = val2.astype(best_type, copy=False)\n\n    # day_frac is independent of dtype, as long as the dtype\n    # are the same and no factor or divisor is given.\n    i, f = day_frac(val1, val2)\n    return i.astype(float, copy=False), f.astype(float, copy=False)"},{"col":4,"comment":"null","endLoc":363,"header":"def __set__(self, instance, value)","id":8226,"name":"__set__","nodeType":"Function","startLoc":342,"text":"def __set__(self, instance, value):\n        if instance is None:\n            # This is an unbound descriptor on the class\n            raise ValueError('cannot set unbound descriptor')\n\n        if isinstance(value, DataInfo):\n            info = instance.__dict__['info'] = self.__class__(bound=True)\n            attr_names = info.attr_names\n            if value.__class__ is self.__class__:\n                # For same class, attributes are guaranteed to be stored in\n                # _attrs, so speed matters up by not accessing defaults.\n                # Doing this before difference in for loop helps speed.\n                attr_names = attr_names & set(value._attrs)  # NOT in-place!\n            else:\n                # For different classes, copy over the attributes in common.\n                attr_names = attr_names & (value.attr_names - value._attrs_no_copy)\n\n            for attr in attr_names - info.attrs_from_parent - info._attrs_no_copy:\n                info._attrs[attr] = deepcopy(getattr(value, attr))\n\n        else:\n            raise TypeError('info must be set with a DataInfo instance')"},{"col":4,"comment":"null","endLoc":837,"header":"def _declare_subscriptions(self, private_key, mtypes)","id":8227,"name":"_declare_subscriptions","nodeType":"Function","startLoc":788,"text":"def _declare_subscriptions(self, private_key, mtypes):\n\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n\n            log.debug(\"declare_subscriptions: private-key = {} mtypes = {}\"\n                      .format(private_key, str(mtypes)))\n\n            # remove subscription to previous mtypes\n            if private_key in self._id2mtypes:\n\n                prev_mtypes = self._id2mtypes[private_key]\n\n                for mtype in prev_mtypes:\n                    try:\n                        self._mtype2ids[mtype].remove(private_key)\n                    except ValueError:  # private_key is not in list\n                        pass\n\n            self._id2mtypes[private_key] = copy.deepcopy(mtypes)\n\n            # remove duplicated MType for wildcard overwriting\n            original_mtypes = copy.deepcopy(mtypes)\n\n            for mtype in original_mtypes:\n                if mtype.endswith(\"*\"):\n                    for mtype2 in original_mtypes:\n                        if mtype2.startswith(mtype[:-1]) and \\\n                           mtype2 != mtype:\n                            if mtype2 in mtypes:\n                                del(mtypes[mtype2])\n\n            log.debug(\"declare_subscriptions: subscriptions accepted from \"\n                      \"{} => {}\".format(private_key, str(mtypes)))\n\n            for mtype in mtypes:\n\n                if mtype in self._mtype2ids:\n                    if private_key not in self._mtype2ids[mtype]:\n                        self._mtype2ids[mtype].append(private_key)\n                else:\n                    self._mtype2ids[mtype] = [private_key]\n\n            self._notify_subscriptions(private_key)\n\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n        return \"\""},{"col":4,"comment":"null","endLoc":366,"header":"def __getstate__(self)","id":8228,"name":"__getstate__","nodeType":"Function","startLoc":365,"text":"def __getstate__(self):\n        return self._attrs"},{"col":4,"comment":"null","endLoc":369,"header":"def __setstate__(self, state)","id":8229,"name":"__setstate__","nodeType":"Function","startLoc":368,"text":"def __setstate__(self, state):\n        self._attrs = state"},{"col":4,"comment":"Get the values for the parent ``attrs`` and return as a dict.\n\n        By default, uses '_represent_as_dict_attrs'.\n        ","endLoc":378,"header":"def _represent_as_dict(self, attrs=None)","id":8230,"name":"_represent_as_dict","nodeType":"Function","startLoc":371,"text":"def _represent_as_dict(self, attrs=None):\n        \"\"\"Get the values for the parent ``attrs`` and return as a dict.\n\n        By default, uses '_represent_as_dict_attrs'.\n        \"\"\"\n        if attrs is None:\n            attrs = self._represent_as_dict_attrs\n        return _get_obj_attrs_map(self._parent, attrs)"},{"col":0,"comment":"\n    Get the values for object ``attrs`` and return as a dict.  This\n    ignores any attributes that are None.  In the context of serializing\n    the supported core astropy classes this conversion will succeed and\n    results in more succinct and less python-specific YAML.\n    ","endLoc":165,"header":"def _get_obj_attrs_map(obj, attrs)","id":8231,"name":"_get_obj_attrs_map","nodeType":"Function","startLoc":152,"text":"def _get_obj_attrs_map(obj, attrs):\n    \"\"\"\n    Get the values for object ``attrs`` and return as a dict.  This\n    ignores any attributes that are None.  In the context of serializing\n    the supported core astropy classes this conversion will succeed and\n    results in more succinct and less python-specific YAML.\n    \"\"\"\n    out = {}\n    for attr in attrs:\n        val = getattr(obj, attr, None)\n\n        if val is not None:\n            out[attr] = val\n    return out"},{"col":4,"comment":"null","endLoc":382,"header":"def _construct_from_dict(self, map)","id":8232,"name":"_construct_from_dict","nodeType":"Function","startLoc":380,"text":"def _construct_from_dict(self, map):\n        args = [map.pop(attr) for attr in self._construct_from_dict_args]\n        return self._parent_cls(*args, **map)"},{"col":4,"comment":"\n        Write summary information about data object to the ``out`` filehandle.\n        By default this prints to standard output via sys.stdout.\n\n        The ``option`` argument specifies what type of information\n        to include.  This can be a string, a function, or a list of\n        strings or functions.  Built-in options are:\n\n        - ``attributes``: data object attributes like ``dtype`` and ``format``\n        - ``stats``: basic statistics: min, mean, and max\n\n        If a function is specified then that function will be called with the\n        data object as its single argument.  The function must return an\n        OrderedDict containing the information attributes.\n\n        If a list is provided then the information attributes will be\n        appended for each of the options, in order.\n\n        Examples\n        --------\n\n        >>> from astropy.table import Column\n        >>> c = Column([1, 2], unit='m', dtype='int32')\n        >>> c.info()\n        dtype = int32\n        unit = m\n        class = Column\n        n_bad = 0\n        length = 2\n\n        >>> c.info(['attributes', 'stats'])\n        dtype = int32\n        unit = m\n        class = Column\n        mean = 1.5\n        std = 0.5\n        min = 1\n        max = 2\n        n_bad = 0\n        length = 2\n\n        Parameters\n        ----------\n        option : str, callable, list of (str or callable)\n            Info option, defaults to 'attributes'.\n        out : file-like, None\n            Output destination, defaults to sys.stdout.  If None then the\n            OrderedDict with information attributes is returned\n\n        Returns\n        -------\n        info : `~collections.OrderedDict` or None\n            `~collections.OrderedDict` if out==None else None\n        ","endLoc":492,"header":"def __call__(self, option='attributes', out='')","id":8233,"name":"__call__","nodeType":"Function","startLoc":395,"text":"def __call__(self, option='attributes', out=''):\n        \"\"\"\n        Write summary information about data object to the ``out`` filehandle.\n        By default this prints to standard output via sys.stdout.\n\n        The ``option`` argument specifies what type of information\n        to include.  This can be a string, a function, or a list of\n        strings or functions.  Built-in options are:\n\n        - ``attributes``: data object attributes like ``dtype`` and ``format``\n        - ``stats``: basic statistics: min, mean, and max\n\n        If a function is specified then that function will be called with the\n        data object as its single argument.  The function must return an\n        OrderedDict containing the information attributes.\n\n        If a list is provided then the information attributes will be\n        appended for each of the options, in order.\n\n        Examples\n        --------\n\n        >>> from astropy.table import Column\n        >>> c = Column([1, 2], unit='m', dtype='int32')\n        >>> c.info()\n        dtype = int32\n        unit = m\n        class = Column\n        n_bad = 0\n        length = 2\n\n        >>> c.info(['attributes', 'stats'])\n        dtype = int32\n        unit = m\n        class = Column\n        mean = 1.5\n        std = 0.5\n        min = 1\n        max = 2\n        n_bad = 0\n        length = 2\n\n        Parameters\n        ----------\n        option : str, callable, list of (str or callable)\n            Info option, defaults to 'attributes'.\n        out : file-like, None\n            Output destination, defaults to sys.stdout.  If None then the\n            OrderedDict with information attributes is returned\n\n        Returns\n        -------\n        info : `~collections.OrderedDict` or None\n            `~collections.OrderedDict` if out==None else None\n        \"\"\"\n        if out == '':\n            out = sys.stdout\n\n        dat = self._parent\n        info = OrderedDict()\n        name = dat.info.name\n        if name is not None:\n            info['name'] = name\n\n        options = option if isinstance(option, (list, tuple)) else [option]\n        for option in options:\n            if isinstance(option, str):\n                if hasattr(self, 'info_summary_' + option):\n                    option = getattr(self, 'info_summary_' + option)\n                else:\n                    raise ValueError('option={} is not an allowed information type'\n                                     .format(option))\n\n            with warnings.catch_warnings():\n                for ignore_kwargs in IGNORE_WARNINGS:\n                    warnings.filterwarnings('ignore', **ignore_kwargs)\n                info.update(option(dat))\n\n        if hasattr(dat, 'mask'):\n            n_bad = np.count_nonzero(dat.mask)\n        else:\n            try:\n                n_bad = np.count_nonzero(np.isinf(dat) | np.isnan(dat))\n            except Exception:\n                n_bad = 0\n        info['n_bad'] = n_bad\n\n        try:\n            info['length'] = len(dat)\n        except (TypeError, IndexError):\n            pass\n\n        if out is None:\n            return info\n\n        for key, val in info.items():\n            if val != '':\n                out.write(f'{key} = {val}' + os.linesep)"},{"col":4,"comment":"null","endLoc":985,"header":"def _notify_(self, sender_private_key, recipient_public_id, message)","id":8234,"name":"_notify_","nodeType":"Function","startLoc":961,"text":"def _notify_(self, sender_private_key, recipient_public_id, message):\n\n        if sender_private_key not in self._private_keys:\n            return\n\n        sender_public_id = self._private_keys[sender_private_key][0]\n\n        try:\n\n            log.debug(\"notify {} from {} to {}\".format(\n                    message[\"samp.mtype\"], sender_public_id,\n                    recipient_public_id))\n\n            recipient_private_key = self._public_id_to_private_key(recipient_public_id)\n            arg_params = (sender_public_id, message)\n            samp_method_name = \"receiveNotification\"\n\n            self._retry_method(recipient_private_key, recipient_public_id, samp_method_name, arg_params)\n\n        except Exception as exc:\n            warnings.warn(\"{} notification from client {} to client {} \"\n                          \"failed [{}]\".format(message[\"samp.mtype\"],\n                                               sender_public_id,\n                                               recipient_public_id, exc),\n                          SAMPWarning)"},{"col":4,"comment":"\n        This method is used to retry a SAMP call several times.\n\n        Parameters\n        ----------\n        recipient_private_key\n            The private key of the receiver of the call\n        recipient_public_key\n            The public key of the receiver of the call\n        samp_method_name : str\n            The name of the SAMP method to call\n        arg_params : tuple\n            Any additional arguments to be passed to the SAMP method\n        ","endLoc":1221,"header":"def _retry_method(self, recipient_private_key, recipient_public_id, samp_method_name, arg_params)","id":8235,"name":"_retry_method","nodeType":"Function","startLoc":1168,"text":"def _retry_method(self, recipient_private_key, recipient_public_id, samp_method_name, arg_params):\n        \"\"\"\n        This method is used to retry a SAMP call several times.\n\n        Parameters\n        ----------\n        recipient_private_key\n            The private key of the receiver of the call\n        recipient_public_key\n            The public key of the receiver of the call\n        samp_method_name : str\n            The name of the SAMP method to call\n        arg_params : tuple\n            Any additional arguments to be passed to the SAMP method\n        \"\"\"\n\n        if recipient_private_key is None:\n            raise SAMPHubError(\"Invalid client ID\")\n\n        from . import conf\n\n        for attempt in range(conf.n_retries):\n\n            if not self._is_running:\n                time.sleep(0.01)\n                continue\n\n            try:\n\n                if (self._web_profile and\n                    recipient_private_key in self._web_profile_callbacks):\n\n                    # Web Profile\n                    callback = {\"samp.methodName\": samp_method_name,\n                                \"samp.params\": arg_params}\n                    self._web_profile_callbacks[recipient_private_key].put(callback)\n\n                else:\n\n                    # Standard Profile\n                    hub = self._xmlrpc_endpoints[recipient_public_id][1]\n                    getattr(hub.samp.client, samp_method_name)(recipient_private_key, *arg_params)\n\n            except xmlrpc.Fault as exc:\n                log.debug(\"{} XML-RPC endpoint error (attempt {}): {}\"\n                          .format(recipient_public_id, attempt + 1,\n                                  exc.faultString))\n                time.sleep(0.01)\n            else:\n                return\n\n        # If we are here, then the above attempts failed\n        error_message = samp_method_name + \" failed after \" + str(conf.n_retries) + \" attempts\"\n        raise SAMPHubError(error_message)"},{"col":0,"comment":"null","endLoc":209,"header":"def decimal_to_twoval1(val1, val2=None)","id":8236,"name":"decimal_to_twoval1","nodeType":"Function","startLoc":203,"text":"def decimal_to_twoval1(val1, val2=None):\n    with decimal.localcontext() as ctx:\n        ctx.prec = _enough_decimal_places\n        d = decimal.Decimal(val1)\n        i = round(d)\n        f = d - i\n    return float(i), float(f)"},{"col":0,"comment":"null","endLoc":213,"header":"def bytes_to_twoval1(val1, val2=None)","id":8237,"name":"bytes_to_twoval1","nodeType":"Function","startLoc":212,"text":"def bytes_to_twoval1(val1, val2=None):\n    return decimal_to_twoval1(val1.decode('ascii'))"},{"col":4,"comment":"null","endLoc":629,"header":"def _notify_subscriptions(self, private_key)","id":8238,"name":"_notify_subscriptions","nodeType":"Function","startLoc":618,"text":"def _notify_subscriptions(self, private_key):\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.event.subscriptions\")\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                public_id = self._private_keys[private_key][0]\n                for key in self._mtype2ids[mtype]:\n                    self._notify(self._hub_private_key,\n                                 self._private_keys[key][0],\n                                 {\"samp.mtype\": \"samp.hub.event.subscriptions\",\n                                  \"samp.params\": {\"id\": public_id,\n                                                  \"subscriptions\": self._id2mtypes[private_key]}\n                                  })"},{"col":0,"comment":"null","endLoc":217,"header":"def twoval_to_longdouble(val1, val2)","id":8239,"name":"twoval_to_longdouble","nodeType":"Function","startLoc":216,"text":"def twoval_to_longdouble(val1, val2):\n    return val1.astype(np.longdouble) + val2.astype(np.longdouble)"},{"col":0,"comment":"null","endLoc":223,"header":"def twoval_to_decimal1(val1, val2)","id":8240,"name":"twoval_to_decimal1","nodeType":"Function","startLoc":220,"text":"def twoval_to_decimal1(val1, val2):\n    with decimal.localcontext() as ctx:\n        ctx.prec = _enough_decimal_places\n        return decimal.Decimal(val1) + decimal.Decimal(val2)"},{"col":0,"comment":"null","endLoc":235,"header":"def twoval_to_string1(val1, val2, fmt)","id":8241,"name":"twoval_to_string1","nodeType":"Function","startLoc":226,"text":"def twoval_to_string1(val1, val2, fmt):\n    if val2 == 0.:\n        # For some formats, only a single float is really used.\n        # For those, let numpy take care of correct number of digits.\n        return str(val1)\n\n    result = format(twoval_to_decimal1(val1, val2), fmt).strip('0')\n    if result[-1] == '.':\n        result += '0'\n    return result"},{"col":0,"comment":"null","endLoc":239,"header":"def twoval_to_bytes1(val1, val2, fmt)","id":8242,"name":"twoval_to_bytes1","nodeType":"Function","startLoc":238,"text":"def twoval_to_bytes1(val1, val2, fmt):\n    return twoval_to_string1(val1, val2, fmt).encode('ascii')"},{"col":4,"comment":"null","endLoc":455,"header":"def _start_threads(self)","id":8243,"name":"_start_threads","nodeType":"Function","startLoc":429,"text":"def _start_threads(self):\n        self._thread_run = threading.Thread(target=self._serve_forever)\n        self._thread_run.daemon = True\n\n        if self._timeout > 0:\n            self._thread_hub_timeout = threading.Thread(\n                    target=self._timeout_test_hub,\n                    name=\"Hub timeout test\")\n            self._thread_hub_timeout.daemon = True\n        else:\n            self._thread_hub_timeout = None\n\n        if self._client_timeout > 0:\n            self._thread_client_timeout = threading.Thread(\n                    target=self._timeout_test_client,\n                    name=\"Client timeout test\")\n            self._thread_client_timeout.daemon = True\n        else:\n            self._thread_client_timeout = None\n\n        self._is_running = True\n        self._thread_run.start()\n\n        if self._thread_hub_timeout is not None:\n            self._thread_hub_timeout.start()\n        if self._thread_client_timeout is not None:\n            self._thread_client_timeout.start()"},{"col":4,"comment":"null","endLoc":500,"header":"def __repr__(self)","id":8244,"name":"__repr__","nodeType":"Function","startLoc":494,"text":"def __repr__(self):\n        if self._parent is None:\n            return super().__repr__()\n\n        out = StringIO()\n        self.__call__(out=out)\n        return out.getvalue()"},{"attributeType":"null","col":4,"comment":"null","endLoc":272,"id":8245,"name":"_stats","nodeType":"Attribute","startLoc":272,"text":"_stats"},{"attributeType":"null","col":0,"comment":"null","endLoc":186,"id":8246,"name":"_enough_decimal_places","nodeType":"Attribute","startLoc":186,"text":"_enough_decimal_places"},{"attributeType":"null","col":0,"comment":"null","endLoc":242,"id":8247,"name":"decimal_to_twoval","nodeType":"Attribute","startLoc":242,"text":"decimal_to_twoval"},{"attributeType":"null","col":4,"comment":"null","endLoc":273,"id":8248,"name":"attrs_from_parent","nodeType":"Attribute","startLoc":273,"text":"attrs_from_parent"},{"attributeType":"null","col":4,"comment":"null","endLoc":274,"id":8249,"name":"attr_names","nodeType":"Attribute","startLoc":274,"text":"attr_names"},{"attributeType":"null","col":0,"comment":"null","endLoc":243,"id":8250,"name":"bytes_to_twoval","nodeType":"Attribute","startLoc":243,"text":"bytes_to_twoval"},{"attributeType":"null","col":4,"comment":"null","endLoc":275,"id":8251,"name":"_attr_defaults","nodeType":"Attribute","startLoc":275,"text":"_attr_defaults"},{"attributeType":"null","col":0,"comment":"null","endLoc":244,"id":8252,"name":"twoval_to_decimal","nodeType":"Attribute","startLoc":244,"text":"twoval_to_decimal"},{"attributeType":"null","col":4,"comment":"null","endLoc":276,"id":8253,"name":"_attrs_no_copy","nodeType":"Attribute","startLoc":276,"text":"_attrs_no_copy"},{"attributeType":"null","col":0,"comment":"null","endLoc":245,"id":8254,"name":"twoval_to_string","nodeType":"Attribute","startLoc":245,"text":"twoval_to_string"},{"attributeType":"null","col":4,"comment":"null","endLoc":277,"id":8255,"name":"_info_summary_attrs","nodeType":"Attribute","startLoc":277,"text":"_info_summary_attrs"},{"attributeType":"null","col":0,"comment":"null","endLoc":246,"id":8256,"name":"twoval_to_bytes","nodeType":"Attribute","startLoc":246,"text":"twoval_to_bytes"},{"attributeType":"null","col":4,"comment":"null","endLoc":278,"id":8257,"name":"__slots__","nodeType":"Attribute","startLoc":278,"text":"__slots__"},{"col":0,"comment":"","endLoc":11,"header":"utils.py#<anonymous>","id":8258,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"Time utilities.\n\nIn particular, routines to do basic arithmetic on numbers represented by two\ndoubles, using the procedure of Shewchuk, 1997, Discrete & Computational\nGeometry 18(3):305-363 -- http://www.cs.berkeley.edu/~jrs/papers/robustr.pdf\n\nFurthermore, some helper routines to turn strings and other types of\nobjects into two values, and vice versa.\n\"\"\"\n\n_enough_decimal_places = 34  # to represent two doubles\n\ndecimal_to_twoval = np.vectorize(decimal_to_twoval1)\n\nbytes_to_twoval = np.vectorize(bytes_to_twoval1)\n\ntwoval_to_decimal = np.vectorize(twoval_to_decimal1)\n\ntwoval_to_string = np.vectorize(twoval_to_string1, excluded='fmt')\n\ntwoval_to_bytes = np.vectorize(twoval_to_bytes1, excluded='fmt')"},{"fileName":"formats.py","filePath":"astropy/time","id":8259,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport fnmatch\nimport time\nimport re\nimport datetime\nimport warnings\nfrom decimal import Decimal\nfrom collections import OrderedDict, defaultdict\n\nimport numpy as np\nimport erfa\n\nfrom astropy.utils.decorators import lazyproperty, classproperty\nfrom astropy.utils.exceptions import AstropyDeprecationWarning\nimport astropy.units as u\n\nfrom . import _parse_times\nfrom . import utils\nfrom .utils import day_frac, quantity_day_frac, two_sum, two_product\nfrom . import conf\n\n__all__ = ['TimeFormat', 'TimeJD', 'TimeMJD', 'TimeFromEpoch', 'TimeUnix',\n           'TimeUnixTai', 'TimeCxcSec', 'TimeGPS', 'TimeDecimalYear',\n           'TimePlotDate', 'TimeUnique', 'TimeDatetime', 'TimeString',\n           'TimeISO', 'TimeISOT', 'TimeFITS', 'TimeYearDayTime',\n           'TimeEpochDate', 'TimeBesselianEpoch', 'TimeJulianEpoch',\n           'TimeDeltaFormat', 'TimeDeltaSec', 'TimeDeltaJD',\n           'TimeEpochDateString', 'TimeBesselianEpochString',\n           'TimeJulianEpochString', 'TIME_FORMATS', 'TIME_DELTA_FORMATS',\n           'TimezoneInfo', 'TimeDeltaDatetime', 'TimeDatetime64', 'TimeYMDHMS',\n           'TimeNumeric', 'TimeDeltaNumeric']\n\n__doctest_skip__ = ['TimePlotDate']\n\n# These both get filled in at end after TimeFormat subclasses defined.\n# Use an OrderedDict to fix the order in which formats are tried.\n# This ensures, e.g., that 'isot' gets tried before 'fits'.\nTIME_FORMATS = OrderedDict()\nTIME_DELTA_FORMATS = OrderedDict()\n\n# Translations between deprecated FITS timescales defined by\n# Rots et al. 2015, A&A 574:A36, and timescales used here.\nFITS_DEPRECATED_SCALES = {'TDT': 'tt', 'ET': 'tt',\n                          'GMT': 'utc', 'UT': 'utc', 'IAT': 'tai'}\n\n\ndef _regexify_subfmts(subfmts):\n    \"\"\"\n    Iterate through each of the sub-formats and try substituting simple\n    regular expressions for the strptime codes for year, month, day-of-month,\n    hour, minute, second.  If no % characters remain then turn the final string\n    into a compiled regex.  This assumes time formats do not have a % in them.\n\n    This is done both to speed up parsing of strings and to allow mixed formats\n    where strptime does not quite work well enough.\n    \"\"\"\n    new_subfmts = []\n    for subfmt_tuple in subfmts:\n        subfmt_in = subfmt_tuple[1]\n        if isinstance(subfmt_in, str):\n            for strptime_code, regex in (('%Y', r'(?P<year>\\d\\d\\d\\d)'),\n                                         ('%m', r'(?P<mon>\\d{1,2})'),\n                                         ('%d', r'(?P<mday>\\d{1,2})'),\n                                         ('%H', r'(?P<hour>\\d{1,2})'),\n                                         ('%M', r'(?P<min>\\d{1,2})'),\n                                         ('%S', r'(?P<sec>\\d{1,2})')):\n                subfmt_in = subfmt_in.replace(strptime_code, regex)\n\n            if '%' not in subfmt_in:\n                subfmt_tuple = (subfmt_tuple[0],\n                                re.compile(subfmt_in + '$'),\n                                subfmt_tuple[2])\n        new_subfmts.append(subfmt_tuple)\n\n    return tuple(new_subfmts)\n\n\nclass TimeFormat:\n    \"\"\"\n    Base class for time representations.\n\n    Parameters\n    ----------\n    val1 : numpy ndarray, list, number, str, or bytes\n        Values to initialize the time or times.  Bytes are decoded as ascii.\n    val2 : numpy ndarray, list, or number; optional\n        Value(s) to initialize the time or times.  Only used for numerical\n        input, to help preserve precision.\n    scale : str\n        Time scale of input value(s)\n    precision : int\n        Precision for seconds as floating point\n    in_subfmt : str\n        Select subformat for inputting string times\n    out_subfmt : str\n        Select subformat for outputting string times\n    from_jd : bool\n        If true then val1, val2 are jd1, jd2\n    \"\"\"\n\n    _default_scale = 'utc'  # As of astropy 0.4\n    subfmts = ()\n    _registry = TIME_FORMATS\n\n    def __init__(self, val1, val2, scale, precision,\n                 in_subfmt, out_subfmt, from_jd=False):\n        self.scale = scale  # validation of scale done later with _check_scale\n        self.precision = precision\n        self.in_subfmt = in_subfmt\n        self.out_subfmt = out_subfmt\n\n        self._jd1, self._jd2 = None, None\n\n        if from_jd:\n            self.jd1 = val1\n            self.jd2 = val2\n        else:\n            val1, val2 = self._check_val_type(val1, val2)\n            self.set_jds(val1, val2)\n\n    def __init_subclass__(cls, **kwargs):\n        # Register time formats that define a name, but leave out astropy_time since\n        # it is not a user-accessible format and is only used for initialization into\n        # a different format.\n        if 'name' in cls.__dict__ and cls.name != 'astropy_time':\n            # FIXME: check here that we're not introducing a collision with\n            # an existing method or attribute; problem is it could be either\n            # astropy.time.Time or astropy.time.TimeDelta, and at the point\n            # where this is run neither of those classes have necessarily been\n            # constructed yet.\n            if 'value' in cls.__dict__ and not hasattr(cls.value, \"fget\"):\n                raise ValueError(\"If defined, 'value' must be a property\")\n\n            cls._registry[cls.name] = cls\n\n        # If this class defines its own subfmts, preprocess the definitions.\n        if 'subfmts' in cls.__dict__:\n            cls.subfmts = _regexify_subfmts(cls.subfmts)\n\n        return super().__init_subclass__(**kwargs)\n\n    @classmethod\n    def _get_allowed_subfmt(cls, subfmt):\n        \"\"\"Get an allowed subfmt for this class, either the input ``subfmt``\n        if this is valid or '*' as a default.  This method gets used in situations\n        where the format of an existing Time object is changing and so the\n        out_ or in_subfmt may need to be coerced to the default '*' if that\n        ``subfmt`` is no longer valid.\n        \"\"\"\n        try:\n            cls._select_subfmts(subfmt)\n        except ValueError:\n            subfmt = '*'\n        return subfmt\n\n    @property\n    def in_subfmt(self):\n        return self._in_subfmt\n\n    @in_subfmt.setter\n    def in_subfmt(self, subfmt):\n        # Validate subfmt value for this class, raises ValueError if not.\n        self._select_subfmts(subfmt)\n        self._in_subfmt = subfmt\n\n    @property\n    def out_subfmt(self):\n        return self._out_subfmt\n\n    @out_subfmt.setter\n    def out_subfmt(self, subfmt):\n        # Validate subfmt value for this class, raises ValueError if not.\n        self._select_subfmts(subfmt)\n        self._out_subfmt = subfmt\n\n    @property\n    def jd1(self):\n        return self._jd1\n\n    @jd1.setter\n    def jd1(self, jd1):\n        self._jd1 = _validate_jd_for_storage(jd1)\n        if self._jd2 is not None:\n            self._jd1, self._jd2 = _broadcast_writeable(self._jd1, self._jd2)\n\n    @property\n    def jd2(self):\n        return self._jd2\n\n    @jd2.setter\n    def jd2(self, jd2):\n        self._jd2 = _validate_jd_for_storage(jd2)\n        if self._jd1 is not None:\n            self._jd1, self._jd2 = _broadcast_writeable(self._jd1, self._jd2)\n\n    def __len__(self):\n        return len(self.jd1)\n\n    @property\n    def scale(self):\n        \"\"\"Time scale\"\"\"\n        self._scale = self._check_scale(self._scale)\n        return self._scale\n\n    @scale.setter\n    def scale(self, val):\n        self._scale = val\n\n    def mask_if_needed(self, value):\n        if self.masked:\n            value = np.ma.array(value, mask=self.mask, copy=False)\n        return value\n\n    @property\n    def mask(self):\n        if 'mask' not in self.cache:\n            self.cache['mask'] = np.isnan(self.jd2)\n            if self.cache['mask'].shape:\n                self.cache['mask'].flags.writeable = False\n        return self.cache['mask']\n\n    @property\n    def masked(self):\n        if 'masked' not in self.cache:\n            self.cache['masked'] = bool(np.any(self.mask))\n        return self.cache['masked']\n\n    @property\n    def jd2_filled(self):\n        return np.nan_to_num(self.jd2) if self.masked else self.jd2\n\n    @lazyproperty\n    def cache(self):\n        \"\"\"\n        Return the cache associated with this instance.\n        \"\"\"\n        return defaultdict(dict)\n\n    def _check_val_type(self, val1, val2):\n        \"\"\"Input value validation, typically overridden by derived classes\"\"\"\n        # val1 cannot contain nan, but val2 can contain nan\n        isfinite1 = np.isfinite(val1)\n        if val1.size > 1:  # Calling .all() on a scalar is surprisingly slow\n            isfinite1 = isfinite1.all()  # Note: arr.all() about 3x faster than np.all(arr)\n        elif val1.size == 0:\n            isfinite1 = False\n        ok1 = (val1.dtype.kind == 'f' and val1.dtype.itemsize >= 8\n               and isfinite1 or val1.size == 0)\n        ok2 = val2 is None or (\n            val2.dtype.kind == 'f' and val2.dtype.itemsize >= 8\n            and not np.any(np.isinf(val2))) or val2.size == 0\n        if not (ok1 and ok2):\n            raise TypeError('Input values for {} class must be finite doubles'\n                            .format(self.name))\n\n        if getattr(val1, 'unit', None) is not None:\n            # Convert any quantity-likes to days first, attempting to be\n            # careful with the conversion, so that, e.g., large numbers of\n            # seconds get converted without losing precision because\n            # 1/86400 is not exactly representable as a float.\n            val1 = u.Quantity(val1, copy=False)\n            if val2 is not None:\n                val2 = u.Quantity(val2, copy=False)\n\n            try:\n                val1, val2 = quantity_day_frac(val1, val2)\n            except u.UnitsError:\n                raise u.UnitConversionError(\n                    \"only quantities with time units can be \"\n                    \"used to instantiate Time instances.\")\n            # We now have days, but the format may expect another unit.\n            # On purpose, multiply with 1./day_unit because typically it is\n            # 1./erfa.DAYSEC, and inverting it recovers the integer.\n            # (This conversion will get undone in format's set_jds, hence\n            # there may be room for optimizing this.)\n            factor = 1. / getattr(self, 'unit', 1.)\n            if factor != 1.:\n                val1, carry = two_product(val1, factor)\n                carry += val2 * factor\n                val1, val2 = two_sum(val1, carry)\n\n        elif getattr(val2, 'unit', None) is not None:\n            raise TypeError('Cannot mix float and Quantity inputs')\n\n        if val2 is None:\n            val2 = np.array(0, dtype=val1.dtype)\n\n        def asarray_or_scalar(val):\n            \"\"\"\n            Remove ndarray subclasses since for jd1/jd2 we want a pure ndarray\n            or a Python or numpy scalar.\n            \"\"\"\n            return np.asarray(val) if isinstance(val, np.ndarray) else val\n\n        return asarray_or_scalar(val1), asarray_or_scalar(val2)\n\n    def _check_scale(self, scale):\n        \"\"\"\n        Return a validated scale value.\n\n        If there is a class attribute 'scale' then that defines the default /\n        required time scale for this format.  In this case if a scale value was\n        provided that needs to match the class default, otherwise return\n        the class default.\n\n        Otherwise just make sure that scale is in the allowed list of\n        scales.  Provide a different error message if `None` (no value) was\n        supplied.\n        \"\"\"\n        if scale is None:\n            scale = self._default_scale\n\n        if scale not in TIME_SCALES:\n            raise ScaleValueError(\"Scale value '{}' not in \"\n                                  \"allowed values {}\"\n                                  .format(scale, TIME_SCALES))\n\n        return scale\n\n    def set_jds(self, val1, val2):\n        \"\"\"\n        Set internal jd1 and jd2 from val1 and val2.  Must be provided\n        by derived classes.\n        \"\"\"\n        raise NotImplementedError\n\n    def to_value(self, parent=None, out_subfmt=None):\n        \"\"\"\n        Return time representation from internal jd1 and jd2 in specified\n        ``out_subfmt``.\n\n        This is the base method that ignores ``parent`` and uses the ``value``\n        property to compute the output. This is done by temporarily setting\n        ``self.out_subfmt`` and calling ``self.value``. This is required for\n        legacy Format subclasses prior to astropy 4.0  New code should instead\n        implement the value functionality in ``to_value()`` and then make the\n        ``value`` property be a simple call to ``self.to_value()``.\n\n        Parameters\n        ----------\n        parent : object\n            Parent `~astropy.time.Time` object associated with this\n            `~astropy.time.TimeFormat` object\n        out_subfmt : str or None\n            Output subformt (use existing self.out_subfmt if `None`)\n\n        Returns\n        -------\n        value : numpy.array, numpy.ma.array\n            Array or masked array of formatted time representation values\n        \"\"\"\n        # Get value via ``value`` property, overriding out_subfmt temporarily if needed.\n        if out_subfmt is not None:\n            out_subfmt_orig = self.out_subfmt\n            try:\n                self.out_subfmt = out_subfmt\n                value = self.value\n            finally:\n                self.out_subfmt = out_subfmt_orig\n        else:\n            value = self.value\n\n        return self.mask_if_needed(value)\n\n    @property\n    def value(self):\n        raise NotImplementedError\n\n    @classmethod\n    def _select_subfmts(cls, pattern):\n        \"\"\"\n        Return a list of subformats where name matches ``pattern`` using\n        fnmatch.\n\n        If no subformat matches pattern then a ValueError is raised.  A special\n        case is a format with no allowed subformats, i.e. subfmts=(), and\n        pattern='*'.  This is OK and happens when this method is used for\n        validation of an out_subfmt.\n        \"\"\"\n        if not isinstance(pattern, str):\n            raise ValueError('subfmt attribute must be a string')\n        elif pattern == '*':\n            return cls.subfmts\n\n        subfmts = [x for x in cls.subfmts if fnmatch.fnmatchcase(x[0], pattern)]\n        if len(subfmts) == 0:\n            if len(cls.subfmts) == 0:\n                raise ValueError(f'subformat not allowed for format {cls.name}')\n            else:\n                subfmt_names = [x[0] for x in cls.subfmts]\n                raise ValueError(f'subformat {pattern!r} must match one of '\n                                 f'{subfmt_names} for format {cls.name}')\n\n        return subfmts\n\n\nclass TimeNumeric(TimeFormat):\n    subfmts = (\n        ('float', np.float64, None, np.add),\n        ('long', np.longdouble, utils.longdouble_to_twoval,\n         utils.twoval_to_longdouble),\n        ('decimal', np.object_, utils.decimal_to_twoval,\n         utils.twoval_to_decimal),\n        ('str', np.str_, utils.decimal_to_twoval, utils.twoval_to_string),\n        ('bytes', np.bytes_, utils.bytes_to_twoval, utils.twoval_to_bytes),\n    )\n\n    def _check_val_type(self, val1, val2):\n        \"\"\"Input value validation, typically overridden by derived classes\"\"\"\n        # Save original state of val2 because the super()._check_val_type below\n        # may change val2 from None to np.array(0). The value is saved in order\n        # to prevent a useless and slow call to np.result_type() below in the\n        # most common use-case of providing only val1.\n        orig_val2_is_none = val2 is None\n\n        if val1.dtype.kind == 'f':\n            val1, val2 = super()._check_val_type(val1, val2)\n        elif (not orig_val2_is_none\n              or not (val1.dtype.kind in 'US'\n                      or (val1.dtype.kind == 'O'\n                          and all(isinstance(v, Decimal) for v in val1.flat)))):\n            raise TypeError(\n                'for {} class, input should be doubles, string, or Decimal, '\n                'and second values are only allowed for doubles.'\n                .format(self.name))\n\n        val_dtype = (val1.dtype if orig_val2_is_none else\n                     np.result_type(val1.dtype, val2.dtype))\n        subfmts = self._select_subfmts(self.in_subfmt)\n        for subfmt, dtype, convert, _ in subfmts:\n            if np.issubdtype(val_dtype, dtype):\n                break\n        else:\n            raise ValueError('input type not among selected sub-formats.')\n\n        if convert is not None:\n            try:\n                val1, val2 = convert(val1, val2)\n            except Exception:\n                raise TypeError(\n                    'for {} class, input should be (long) doubles, string, '\n                    'or Decimal, and second values are only allowed for '\n                    '(long) doubles.'.format(self.name))\n\n        return val1, val2\n\n    def to_value(self, jd1=None, jd2=None, parent=None, out_subfmt=None):\n        \"\"\"\n        Return time representation from internal jd1 and jd2.\n        Subclasses that require ``parent`` or to adjust the jds should\n        override this method.\n        \"\"\"\n        # TODO: do this in __init_subclass__?\n        if self.__class__.value.fget is not self.__class__.to_value:\n            return self.value\n\n        if jd1 is None:\n            jd1 = self.jd1\n        if jd2 is None:\n            jd2 = self.jd2\n        if out_subfmt is None:\n            out_subfmt = self.out_subfmt\n        subfmt = self._select_subfmts(out_subfmt)[0]\n        kwargs = {}\n        if subfmt[0] in ('str', 'bytes'):\n            unit = getattr(self, 'unit', 1)\n            digits = int(np.ceil(np.log10(unit / np.finfo(float).eps)))\n            # TODO: allow a way to override the format.\n            kwargs['fmt'] = f'.{digits}f'\n        value = subfmt[3](jd1, jd2, **kwargs)\n        return self.mask_if_needed(value)\n\n    value = property(to_value)\n\n\nclass TimeJD(TimeNumeric):\n    \"\"\"\n    Julian Date time format.\n    This represents the number of days since the beginning of\n    the Julian Period.\n    For example, 2451544.5 in JD is midnight on January 1, 2000.\n    \"\"\"\n    name = 'jd'\n\n    def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # Validate scale.\n        self.jd1, self.jd2 = day_frac(val1, val2)\n\n\nclass TimeMJD(TimeNumeric):\n    \"\"\"\n    Modified Julian Date time format.\n    This represents the number of days since midnight on November 17, 1858.\n    For example, 51544.0 in MJD is midnight on January 1, 2000.\n    \"\"\"\n    name = 'mjd'\n\n    def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # Validate scale.\n        jd1, jd2 = day_frac(val1, val2)\n        jd1 += erfa.DJM0  # erfa.DJM0=2400000.5 (from erfam.h).\n        self.jd1, self.jd2 = day_frac(jd1, jd2)\n\n    def to_value(self, **kwargs):\n        jd1 = self.jd1 - erfa.DJM0  # This cannot lose precision.\n        jd2 = self.jd2\n        return super().to_value(jd1=jd1, jd2=jd2, **kwargs)\n\n    value = property(to_value)\n\n\nclass TimeDecimalYear(TimeNumeric):\n    \"\"\"\n    Time as a decimal year, with integer values corresponding to midnight\n    of the first day of each year.  For example 2000.5 corresponds to the\n    ISO time '2000-07-02 00:00:00'.\n    \"\"\"\n    name = 'decimalyear'\n\n    def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # Validate scale.\n\n        sum12, err12 = two_sum(val1, val2)\n        iy_start = np.trunc(sum12).astype(int)\n        extra, y_frac = two_sum(sum12, -iy_start)\n        y_frac += extra + err12\n\n        val = (val1 + val2).astype(np.double)\n        iy_start = np.trunc(val).astype(int)\n\n        imon = np.ones_like(iy_start)\n        iday = np.ones_like(iy_start)\n        ihr = np.zeros_like(iy_start)\n        imin = np.zeros_like(iy_start)\n        isec = np.zeros_like(y_frac)\n\n        # Possible enhancement: use np.unique to only compute start, stop\n        # for unique values of iy_start.\n        scale = self.scale.upper().encode('ascii')\n        jd1_start, jd2_start = erfa.dtf2d(scale, iy_start, imon, iday,\n                                          ihr, imin, isec)\n        jd1_end, jd2_end = erfa.dtf2d(scale, iy_start + 1, imon, iday,\n                                      ihr, imin, isec)\n\n        t_start = Time(jd1_start, jd2_start, scale=self.scale, format='jd')\n        t_end = Time(jd1_end, jd2_end, scale=self.scale, format='jd')\n        t_frac = t_start + (t_end - t_start) * y_frac\n\n        self.jd1, self.jd2 = day_frac(t_frac.jd1, t_frac.jd2)\n\n    def to_value(self, **kwargs):\n        scale = self.scale.upper().encode('ascii')\n        iy_start, ims, ids, ihmsfs = erfa.d2dtf(scale, 0,  # precision=0\n                                                self.jd1, self.jd2_filled)\n        imon = np.ones_like(iy_start)\n        iday = np.ones_like(iy_start)\n        ihr = np.zeros_like(iy_start)\n        imin = np.zeros_like(iy_start)\n        isec = np.zeros_like(self.jd1)\n\n        # Possible enhancement: use np.unique to only compute start, stop\n        # for unique values of iy_start.\n        scale = self.scale.upper().encode('ascii')\n        jd1_start, jd2_start = erfa.dtf2d(scale, iy_start, imon, iday,\n                                          ihr, imin, isec)\n        jd1_end, jd2_end = erfa.dtf2d(scale, iy_start + 1, imon, iday,\n                                      ihr, imin, isec)\n        # Trying to be precise, but more than float64 not useful.\n        dt = (self.jd1 - jd1_start) + (self.jd2 - jd2_start)\n        dt_end = (jd1_end - jd1_start) + (jd2_end - jd2_start)\n        decimalyear = iy_start + dt / dt_end\n\n        return super().to_value(jd1=decimalyear, jd2=np.float64(0.0), **kwargs)\n\n    value = property(to_value)\n\n\nclass TimeFromEpoch(TimeNumeric):\n    \"\"\"\n    Base class for times that represent the interval from a particular\n    epoch as a floating point multiple of a unit time interval (e.g. seconds\n    or days).\n    \"\"\"\n\n    @classproperty(lazy=True)\n    def _epoch(cls):\n        # Ideally we would use `def epoch(cls)` here and not have the instance\n        # property below. However, this breaks the sphinx API docs generation\n        # in a way that was not resolved. See #10406 for details.\n        return Time(cls.epoch_val, cls.epoch_val2, scale=cls.epoch_scale,\n                    format=cls.epoch_format)\n\n    @property\n    def epoch(self):\n        \"\"\"Reference epoch time from which the time interval is measured\"\"\"\n        return self._epoch\n\n    def set_jds(self, val1, val2):\n        \"\"\"\n        Initialize the internal jd1 and jd2 attributes given val1 and val2.\n        For an TimeFromEpoch subclass like TimeUnix these will be floats giving\n        the effective seconds since an epoch time (e.g. 1970-01-01 00:00:00).\n        \"\"\"\n        # Form new JDs based on epoch time + time from epoch (converted to JD).\n        # One subtlety that might not be obvious is that 1.000 Julian days in\n        # UTC can be 86400 or 86401 seconds.  For the TimeUnix format the\n        # assumption is that every day is exactly 86400 seconds, so this is, in\n        # principle, doing the math incorrectly, *except* that it matches the\n        # definition of Unix time which does not include leap seconds.\n\n        # note: use divisor=1./self.unit, since this is either 1 or 1/86400,\n        # and 1/86400 is not exactly representable as a float64, so multiplying\n        # by that will cause rounding errors. (But inverting it as a float64\n        # recovers the exact number)\n        day, frac = day_frac(val1, val2, divisor=1. / self.unit)\n\n        jd1 = self.epoch.jd1 + day\n        jd2 = self.epoch.jd2 + frac\n\n        # For the usual case that scale is the same as epoch_scale, we only need\n        # to ensure that abs(jd2) <= 0.5. Since abs(self.epoch.jd2) <= 0.5 and\n        # abs(frac) <= 0.5, we can do simple (fast) checks and arithmetic here\n        # without another call to day_frac(). Note also that `round(jd2.item())`\n        # is about 10x faster than `np.round(jd2)`` for a scalar.\n        if self.epoch.scale == self.scale:\n            jd1_extra = np.round(jd2) if jd2.shape else round(jd2.item())\n            jd1 += jd1_extra\n            jd2 -= jd1_extra\n\n            self.jd1, self.jd2 = jd1, jd2\n            return\n\n        # Create a temporary Time object corresponding to the new (jd1, jd2) in\n        # the epoch scale (e.g. UTC for TimeUnix) then convert that to the\n        # desired time scale for this object.\n        #\n        # A known limitation is that the transform from self.epoch_scale to\n        # self.scale cannot involve any metadata like lat or lon.\n        try:\n            tm = getattr(Time(jd1, jd2, scale=self.epoch_scale,\n                              format='jd'), self.scale)\n        except Exception as err:\n            raise ScaleValueError(\"Cannot convert from '{}' epoch scale '{}'\"\n                                  \"to specified scale '{}', got error:\\n{}\"\n                                  .format(self.name, self.epoch_scale,\n                                          self.scale, err)) from err\n\n        self.jd1, self.jd2 = day_frac(tm._time.jd1, tm._time.jd2)\n\n    def to_value(self, parent=None, **kwargs):\n        # Make sure that scale is the same as epoch scale so we can just\n        # subtract the epoch and convert\n        if self.scale != self.epoch_scale:\n            if parent is None:\n                raise ValueError('cannot compute value without parent Time object')\n            try:\n                tm = getattr(parent, self.epoch_scale)\n            except Exception as err:\n                raise ScaleValueError(\"Cannot convert from '{}' epoch scale '{}'\"\n                                      \"to specified scale '{}', got error:\\n{}\"\n                                      .format(self.name, self.epoch_scale,\n                                              self.scale, err)) from err\n\n            jd1, jd2 = tm._time.jd1, tm._time.jd2\n        else:\n            jd1, jd2 = self.jd1, self.jd2\n\n        # This factor is guaranteed to be exactly representable, which\n        # means time_from_epoch1 is calculated exactly.\n        factor = 1. / self.unit\n        time_from_epoch1 = (jd1 - self.epoch.jd1) * factor\n        time_from_epoch2 = (jd2 - self.epoch.jd2) * factor\n\n        return super().to_value(jd1=time_from_epoch1, jd2=time_from_epoch2, **kwargs)\n\n    value = property(to_value)\n\n    @property\n    def _default_scale(self):\n        return self.epoch_scale\n\n\nclass TimeUnix(TimeFromEpoch):\n    \"\"\"\n    Unix time (UTC): seconds from 1970-01-01 00:00:00 UTC, ignoring leap seconds.\n\n    For example, 946684800.0 in Unix time is midnight on January 1, 2000.\n\n    NOTE: this quantity is not exactly unix time and differs from the strict\n    POSIX definition by up to 1 second on days with a leap second.  POSIX\n    unix time actually jumps backward by 1 second at midnight on leap second\n    days while this class value is monotonically increasing at 86400 seconds\n    per UTC day.\n    \"\"\"\n    name = 'unix'\n    unit = 1.0 / erfa.DAYSEC  # in days (1 day == 86400 seconds)\n    epoch_val = '1970-01-01 00:00:00'\n    epoch_val2 = None\n    epoch_scale = 'utc'\n    epoch_format = 'iso'\n\n\nclass TimeUnixTai(TimeUnix):\n    \"\"\"\n    Unix time (TAI): SI seconds elapsed since 1970-01-01 00:00:00 TAI (see caveats).\n\n    This will generally differ from standard (UTC) Unix time by the cumulative\n    integral number of leap seconds introduced into UTC since 1972-01-01 UTC\n    plus the initial offset of 10 seconds at that date.\n\n    This convention matches the definition of linux CLOCK_TAI\n    (https://www.cl.cam.ac.uk/~mgk25/posix-clocks.html),\n    and the Precision Time Protocol\n    (https://en.wikipedia.org/wiki/Precision_Time_Protocol), which\n    is also used by the White Rabbit protocol in High Energy Physics:\n    https://white-rabbit.web.cern.ch.\n\n    Caveats:\n\n    - Before 1972, fractional adjustments to UTC were made, so the difference\n      between ``unix`` and ``unix_tai`` time is no longer an integer.\n    - Because of the fractional adjustments, to be very precise, ``unix_tai``\n      is the number of seconds since ``1970-01-01 00:00:00 TAI`` or equivalently\n      ``1969-12-31 23:59:51.999918 UTC``.  The difference between TAI and UTC\n      at that epoch was 8.000082 sec.\n    - On the day of a positive leap second the difference between ``unix`` and\n      ``unix_tai`` times increases linearly through the day by 1.0. See also the\n      documentation for the `~astropy.time.TimeUnix` class.\n    - Negative leap seconds are possible, though none have been needed to date.\n\n    Examples\n    --------\n\n      >>> # get the current offset between TAI and UTC\n      >>> from astropy.time import Time\n      >>> t = Time('2020-01-01', scale='utc')\n      >>> t.unix_tai - t.unix\n      37.0\n\n      >>> # Before 1972, the offset between TAI and UTC was not integer\n      >>> t = Time('1970-01-01', scale='utc')\n      >>> t.unix_tai - t.unix  # doctest: +FLOAT_CMP\n      8.000082\n\n      >>> # Initial offset of 10 seconds in 1972\n      >>> t = Time('1972-01-01', scale='utc')\n      >>> t.unix_tai - t.unix\n      10.0\n    \"\"\"\n    name = 'unix_tai'\n    epoch_val = '1970-01-01 00:00:00'\n    epoch_scale = 'tai'\n\n\nclass TimeCxcSec(TimeFromEpoch):\n    \"\"\"\n    Chandra X-ray Center seconds from 1998-01-01 00:00:00 TT.\n    For example, 63072064.184 is midnight on January 1, 2000.\n    \"\"\"\n    name = 'cxcsec'\n    unit = 1.0 / erfa.DAYSEC  # in days (1 day == 86400 seconds)\n    epoch_val = '1998-01-01 00:00:00'\n    epoch_val2 = None\n    epoch_scale = 'tt'\n    epoch_format = 'iso'\n\n\nclass TimeGPS(TimeFromEpoch):\n    \"\"\"GPS time: seconds from 1980-01-06 00:00:00 UTC\n    For example, 630720013.0 is midnight on January 1, 2000.\n\n    Notes\n    =====\n    This implementation is strictly a representation of the number of seconds\n    (including leap seconds) since midnight UTC on 1980-01-06.  GPS can also be\n    considered as a time scale which is ahead of TAI by a fixed offset\n    (to within about 100 nanoseconds).\n\n    For details, see https://www.usno.navy.mil/USNO/time/gps/usno-gps-time-transfer\n    \"\"\"\n    name = 'gps'\n    unit = 1.0 / erfa.DAYSEC  # in days (1 day == 86400 seconds)\n    epoch_val = '1980-01-06 00:00:19'\n    # above epoch is the same as Time('1980-01-06 00:00:00', scale='utc').tai\n    epoch_val2 = None\n    epoch_scale = 'tai'\n    epoch_format = 'iso'\n\n\nclass TimePlotDate(TimeFromEpoch):\n    \"\"\"\n    Matplotlib `~matplotlib.pyplot.plot_date` input:\n    1 + number of days from 0001-01-01 00:00:00 UTC\n\n    This can be used directly in the matplotlib `~matplotlib.pyplot.plot_date`\n    function::\n\n      >>> import matplotlib.pyplot as plt\n      >>> jyear = np.linspace(2000, 2001, 20)\n      >>> t = Time(jyear, format='jyear', scale='utc')\n      >>> plt.plot_date(t.plot_date, jyear)\n      >>> plt.gcf().autofmt_xdate()  # orient date labels at a slant\n      >>> plt.draw()\n\n    For example, 730120.0003703703 is midnight on January 1, 2000.\n    \"\"\"\n    # This corresponds to the zero reference time for matplotlib plot_date().\n    # Note that TAI and UTC are equivalent at the reference time.\n    name = 'plot_date'\n    unit = 1.0\n    epoch_val = 1721424.5  # Time('0001-01-01 00:00:00', scale='tai').jd - 1\n    epoch_val2 = None\n    epoch_scale = 'utc'\n    epoch_format = 'jd'\n\n    @lazyproperty\n    def epoch(self):\n        \"\"\"Reference epoch time from which the time interval is measured\"\"\"\n        try:\n            # Matplotlib >= 3.3 has a get_epoch() function\n            from matplotlib.dates import get_epoch\n        except ImportError:\n            # If no get_epoch() then the epoch is '0001-01-01'\n            _epoch = self._epoch\n        else:\n            # Get the matplotlib date epoch as an ISOT string in UTC\n            epoch_utc = get_epoch()\n            from erfa import ErfaWarning\n            with warnings.catch_warnings():\n                # Catch possible dubious year warnings from erfa\n                warnings.filterwarnings('ignore', category=ErfaWarning)\n                _epoch = Time(epoch_utc, scale='utc', format='isot')\n            _epoch.format = 'jd'\n\n        return _epoch\n\n\nclass TimeStardate(TimeFromEpoch):\n    \"\"\"\n    Stardate: date units from 2318-07-05 12:00:00 UTC.\n    For example, stardate 41153.7 is 00:52 on April 30, 2363.\n    See http://trekguide.com/Stardates.htm#TNG for calculations and reference points\n    \"\"\"\n    name = 'stardate'\n    unit = 0.397766856  # Stardate units per day\n    epoch_val = '2318-07-05 11:00:00'  # Date and time of stardate 00000.00\n    epoch_val2 = None\n    epoch_scale = 'tai'\n    epoch_format = 'iso'\n\n\nclass TimeUnique(TimeFormat):\n    \"\"\"\n    Base class for time formats that can uniquely create a time object\n    without requiring an explicit format specifier.  This class does\n    nothing but provide inheritance to identify a class as unique.\n    \"\"\"\n\n\nclass TimeAstropyTime(TimeUnique):\n    \"\"\"\n    Instantiate date from an Astropy Time object (or list thereof).\n\n    This is purely for instantiating from a Time object.  The output\n    format is the same as the first time instance.\n    \"\"\"\n    name = 'astropy_time'\n\n    def __new__(cls, val1, val2, scale, precision,\n                in_subfmt, out_subfmt, from_jd=False):\n        \"\"\"\n        Use __new__ instead of __init__ to output a class instance that\n        is the same as the class of the first Time object in the list.\n        \"\"\"\n        val1_0 = val1.flat[0]\n        if not (isinstance(val1_0, Time) and all(type(val) is type(val1_0)\n                                                 for val in val1.flat)):\n            raise TypeError('Input values for {} class must all be same '\n                            'astropy Time type.'.format(cls.name))\n\n        if scale is None:\n            scale = val1_0.scale\n\n        if val1.shape:\n            vals = [getattr(val, scale)._time for val in val1]\n            jd1 = np.concatenate([np.atleast_1d(val.jd1) for val in vals])\n            jd2 = np.concatenate([np.atleast_1d(val.jd2) for val in vals])\n\n            # Collect individual location values and merge into a single location.\n            if any(tm.location is not None for tm in val1):\n                if any(tm.location is None for tm in val1):\n                    raise ValueError('cannot concatenate times unless all locations '\n                                     'are set or no locations are set')\n                locations = []\n                for tm in val1:\n                    location = np.broadcast_to(tm.location, tm._time.jd1.shape,\n                                               subok=True)\n                    locations.append(np.atleast_1d(location))\n\n                location = np.concatenate(locations)\n\n            else:\n                location = None\n        else:\n            val = getattr(val1_0, scale)._time\n            jd1, jd2 = val.jd1, val.jd2\n            location = val1_0.location\n\n        OutTimeFormat = val1_0._time.__class__\n        self = OutTimeFormat(jd1, jd2, scale, precision, in_subfmt, out_subfmt,\n                             from_jd=True)\n\n        # Make a temporary hidden attribute to transfer location back to the\n        # parent Time object where it needs to live.\n        self._location = location\n\n        return self\n\n\nclass TimeDatetime(TimeUnique):\n    \"\"\"\n    Represent date as Python standard library `~datetime.datetime` object\n\n    Example::\n\n      >>> from astropy.time import Time\n      >>> from datetime import datetime\n      >>> t = Time(datetime(2000, 1, 2, 12, 0, 0), scale='utc')\n      >>> t.iso\n      '2000-01-02 12:00:00.000'\n      >>> t.tt.datetime\n      datetime.datetime(2000, 1, 2, 12, 1, 4, 184000)\n    \"\"\"\n    name = 'datetime'\n\n    def _check_val_type(self, val1, val2):\n        if not all(isinstance(val, datetime.datetime) for val in val1.flat):\n            raise TypeError('Input values for {} class must be '\n                            'datetime objects'.format(self.name))\n        if val2 is not None:\n            raise ValueError(\n                f'{self.name} objects do not accept a val2 but you provided {val2}')\n        return val1, None\n\n    def set_jds(self, val1, val2):\n        \"\"\"Convert datetime object contained in val1 to jd1, jd2\"\"\"\n        # Iterate through the datetime objects, getting year, month, etc.\n        iterator = np.nditer([val1, None, None, None, None, None, None],\n                             flags=['refs_ok', 'zerosize_ok'],\n                             op_dtypes=[None] + 5*[np.intc] + [np.double])\n        for val, iy, im, id, ihr, imin, dsec in iterator:\n            dt = val.item()\n\n            if dt.tzinfo is not None:\n                dt = (dt - dt.utcoffset()).replace(tzinfo=None)\n\n            iy[...] = dt.year\n            im[...] = dt.month\n            id[...] = dt.day\n            ihr[...] = dt.hour\n            imin[...] = dt.minute\n            dsec[...] = dt.second + dt.microsecond / 1e6\n\n        jd1, jd2 = erfa.dtf2d(self.scale.upper().encode('ascii'),\n                              *iterator.operands[1:])\n        self.jd1, self.jd2 = day_frac(jd1, jd2)\n\n    def to_value(self, timezone=None, parent=None, out_subfmt=None):\n        \"\"\"\n        Convert to (potentially timezone-aware) `~datetime.datetime` object.\n\n        If ``timezone`` is not ``None``, return a timezone-aware datetime\n        object.\n\n        Parameters\n        ----------\n        timezone : {`~datetime.tzinfo`, None}, optional\n            If not `None`, return timezone-aware datetime.\n\n        Returns\n        -------\n        `~datetime.datetime`\n            If ``timezone`` is not ``None``, output will be timezone-aware.\n        \"\"\"\n        if out_subfmt is not None:\n            # Out_subfmt not allowed for this format, so raise the standard\n            # exception by trying to validate the value.\n            self._select_subfmts(out_subfmt)\n\n        if timezone is not None:\n            if self._scale != 'utc':\n                raise ScaleValueError(\"scale is {}, must be 'utc' when timezone \"\n                                      \"is supplied.\".format(self._scale))\n\n        # Rather than define a value property directly, we have a function,\n        # since we want to be able to pass in timezone information.\n        scale = self.scale.upper().encode('ascii')\n        iys, ims, ids, ihmsfs = erfa.d2dtf(scale, 6,  # 6 for microsec\n                                           self.jd1, self.jd2_filled)\n        ihrs = ihmsfs['h']\n        imins = ihmsfs['m']\n        isecs = ihmsfs['s']\n        ifracs = ihmsfs['f']\n        iterator = np.nditer([iys, ims, ids, ihrs, imins, isecs, ifracs, None],\n                             flags=['refs_ok', 'zerosize_ok'],\n                             op_dtypes=7*[None] + [object])\n\n        for iy, im, id, ihr, imin, isec, ifracsec, out in iterator:\n            if isec >= 60:\n                raise ValueError('Time {} is within a leap second but datetime '\n                                 'does not support leap seconds'\n                                 .format((iy, im, id, ihr, imin, isec, ifracsec)))\n            if timezone is not None:\n                out[...] = datetime.datetime(iy, im, id, ihr, imin, isec, ifracsec,\n                                             tzinfo=TimezoneInfo()).astimezone(timezone)\n            else:\n                out[...] = datetime.datetime(iy, im, id, ihr, imin, isec, ifracsec)\n\n        return self.mask_if_needed(iterator.operands[-1])\n\n    value = property(to_value)\n\n\nclass TimeYMDHMS(TimeUnique):\n    \"\"\"\n    ymdhms: A Time format to represent Time as year, month, day, hour,\n    minute, second (thus the name ymdhms).\n\n    Acceptable inputs must have keys or column names in the \"YMDHMS\" set of\n    ``year``, ``month``, ``day`` ``hour``, ``minute``, ``second``:\n\n    - Dict with keys in the YMDHMS set\n    - NumPy structured array, record array or astropy Table, or single row\n      of those types, with column names in the YMDHMS set\n\n    One can supply a subset of the YMDHMS values, for instance only 'year',\n    'month', and 'day'.  Inputs have the following defaults::\n\n      'month': 1, 'day': 1, 'hour': 0, 'minute': 0, 'second': 0\n\n    When the input is supplied as a ``dict`` then each value can be either a\n    scalar value or an array.  The values will be broadcast to a common shape.\n\n    Example::\n\n      >>> from astropy.time import Time\n      >>> t = Time({'year': 2015, 'month': 2, 'day': 3,\n      ...           'hour': 12, 'minute': 13, 'second': 14.567},\n      ...           scale='utc')\n      >>> t.iso\n      '2015-02-03 12:13:14.567'\n      >>> t.ymdhms.year\n      2015\n    \"\"\"\n    name = 'ymdhms'\n\n    def _check_val_type(self, val1, val2):\n        \"\"\"\n        This checks inputs for the YMDHMS format.\n\n        It is bit more complex than most format checkers because of the flexible\n        input that is allowed.  Also, it actually coerces ``val1`` into an appropriate\n        dict of ndarrays that can be used easily by ``set_jds()``.  This is useful\n        because it makes it easy to get default values in that routine.\n\n        Parameters\n        ----------\n        val1 : ndarray or None\n        val2 : ndarray or None\n\n        Returns\n        -------\n        val1_as_dict, val2 : val1 as dict or None, val2 is always None\n\n        \"\"\"\n        if val2 is not None:\n            raise ValueError('val2 must be None for ymdhms format')\n\n        ymdhms = ['year', 'month', 'day', 'hour', 'minute', 'second']\n\n        if val1.dtype.names:\n            # Convert to a dict of ndarray\n            val1_as_dict = {name: val1[name] for name in val1.dtype.names}\n\n        elif val1.shape == (0,):\n            # Input was empty list [], so set to None and set_jds will handle this\n            return None, None\n\n        elif (val1.dtype.kind == 'O'\n              and val1.shape == ()\n              and isinstance(val1.item(), dict)):\n            # Code gets here for input as a dict.  The dict input\n            # can be either scalar values or N-d arrays.\n\n            # Extract the item (which is a dict) and broadcast values to the\n            # same shape here.\n            names = val1.item().keys()\n            values = val1.item().values()\n            val1_as_dict = {name: value for name, value\n                            in zip(names, np.broadcast_arrays(*values))}\n\n        else:\n            raise ValueError('input must be dict or table-like')\n\n        # Check that the key names now are good.\n        names = val1_as_dict.keys()\n        required_names = ymdhms[:len(names)]\n\n        def comma_repr(vals):\n            return ', '.join(repr(val) for val in vals)\n\n        bad_names = set(names) - set(ymdhms)\n        if bad_names:\n            raise ValueError(f'{comma_repr(bad_names)} not allowed as YMDHMS key name(s)')\n\n        if set(names) != set(required_names):\n            raise ValueError(f'for {len(names)} input key names '\n                             f'you must supply {comma_repr(required_names)}')\n\n        return val1_as_dict, val2\n\n    def set_jds(self, val1, val2):\n        if val1 is None:\n            # Input was empty list []\n            jd1 = np.array([], dtype=np.float64)\n            jd2 = np.array([], dtype=np.float64)\n\n        else:\n            jd1, jd2 = erfa.dtf2d(self.scale.upper().encode('ascii'),\n                                  val1['year'],\n                                  val1.get('month', 1),\n                                  val1.get('day', 1),\n                                  val1.get('hour', 0),\n                                  val1.get('minute', 0),\n                                  val1.get('second', 0))\n\n        self.jd1, self.jd2 = day_frac(jd1, jd2)\n\n    @property\n    def value(self):\n        scale = self.scale.upper().encode('ascii')\n        iys, ims, ids, ihmsfs = erfa.d2dtf(scale, 9,\n                                           self.jd1, self.jd2_filled)\n\n        out = np.empty(self.jd1.shape, dtype=[('year', 'i4'),\n                                              ('month', 'i4'),\n                                              ('day', 'i4'),\n                                              ('hour', 'i4'),\n                                              ('minute', 'i4'),\n                                              ('second', 'f8')])\n        out['year'] = iys\n        out['month'] = ims\n        out['day'] = ids\n        out['hour'] = ihmsfs['h']\n        out['minute'] = ihmsfs['m']\n        out['second'] = ihmsfs['s'] + ihmsfs['f'] * 10**(-9)\n        out = out.view(np.recarray)\n\n        return self.mask_if_needed(out)\n\n\nclass TimezoneInfo(datetime.tzinfo):\n    \"\"\"\n    Subclass of the `~datetime.tzinfo` object, used in the\n    to_datetime method to specify timezones.\n\n    It may be safer in most cases to use a timezone database package like\n    pytz rather than defining your own timezones - this class is mainly\n    a workaround for users without pytz.\n    \"\"\"\n    @u.quantity_input(utc_offset=u.day, dst=u.day)\n    def __init__(self, utc_offset=0 * u.day, dst=0 * u.day, tzname=None):\n        \"\"\"\n        Parameters\n        ----------\n        utc_offset : `~astropy.units.Quantity`, optional\n            Offset from UTC in days. Defaults to zero.\n        dst : `~astropy.units.Quantity`, optional\n            Daylight Savings Time offset in days. Defaults to zero\n            (no daylight savings).\n        tzname : str or None, optional\n            Name of timezone\n\n        Examples\n        --------\n        >>> from datetime import datetime\n        >>> from astropy.time import TimezoneInfo  # Specifies a timezone\n        >>> import astropy.units as u\n        >>> utc = TimezoneInfo()    # Defaults to UTC\n        >>> utc_plus_one_hour = TimezoneInfo(utc_offset=1*u.hour)  # UTC+1\n        >>> dt_aware = datetime(2000, 1, 1, 0, 0, 0, tzinfo=utc_plus_one_hour)\n        >>> print(dt_aware)\n        2000-01-01 00:00:00+01:00\n        >>> print(dt_aware.astimezone(utc))\n        1999-12-31 23:00:00+00:00\n        \"\"\"\n        if utc_offset == 0 and dst == 0 and tzname is None:\n            tzname = 'UTC'\n        self._utcoffset = datetime.timedelta(utc_offset.to_value(u.day))\n        self._tzname = tzname\n        self._dst = datetime.timedelta(dst.to_value(u.day))\n\n    def utcoffset(self, dt):\n        return self._utcoffset\n\n    def tzname(self, dt):\n        return str(self._tzname)\n\n    def dst(self, dt):\n        return self._dst\n\n\nclass TimeString(TimeUnique):\n    \"\"\"\n    Base class for string-like time representations.\n\n    This class assumes that anything following the last decimal point to the\n    right is a fraction of a second.\n\n    **Fast C-based parser**\n\n    Time format classes can take advantage of a fast C-based parser if the times\n    are represented as fixed-format strings with year, month, day-of-month,\n    hour, minute, second, OR year, day-of-year, hour, minute, second. This can\n    be a factor of 20 or more faster than the pure Python parser.\n\n    Fixed format means that the components always have the same number of\n    characters. The Python parser will accept ``2001-9-2`` as a date, but the C\n    parser would require ``2001-09-02``.\n\n    A subclass in this case must define a class attribute ``fast_parser_pars``\n    which is a `dict` with all of the keys below. An inherited attribute is not\n    checked, only an attribute in the class ``__dict__``.\n\n    - ``delims`` (tuple of int): ASCII code for character at corresponding\n      ``starts`` position (0 => no character)\n\n    - ``starts`` (tuple of int): position where component starts (including\n      delimiter if present). Use -1 for the month component for format that use\n      day of year.\n\n    - ``stops`` (tuple of int): position where component ends. Use -1 to\n      continue to end of string, or for the month component for formats that use\n      day of year.\n\n    - ``break_allowed`` (tuple of int): if true (1) then the time string can\n          legally end just before the corresponding component (e.g. \"2000-01-01\"\n          is a valid time but \"2000-01-01 12\" is not).\n\n    - ``has_day_of_year`` (int): 0 if dates have year, month, day; 1 if year,\n      day-of-year\n    \"\"\"\n\n    def __init_subclass__(cls, **kwargs):\n        if 'fast_parser_pars' in cls.__dict__:\n            fpp = cls.fast_parser_pars\n            fpp = np.array(list(zip(map(chr, fpp['delims']),\n                                    fpp['starts'],\n                                    fpp['stops'],\n                                    fpp['break_allowed'])),\n                           _parse_times.dt_pars)\n            if cls.fast_parser_pars['has_day_of_year']:\n                fpp['start'][1] = fpp['stop'][1] = -1\n            cls._fast_parser = _parse_times.create_parser(fpp)\n\n        super().__init_subclass__(**kwargs)\n\n    def _check_val_type(self, val1, val2):\n        if val1.dtype.kind not in ('S', 'U') and val1.size:\n            raise TypeError(f'Input values for {self.name} class must be strings')\n        if val2 is not None:\n            raise ValueError(\n                f'{self.name} objects do not accept a val2 but you provided {val2}')\n        return val1, None\n\n    def parse_string(self, timestr, subfmts):\n        \"\"\"Read time from a single string, using a set of possible formats.\"\"\"\n        # Datetime components required for conversion to JD by ERFA, along\n        # with the default values.\n        components = ('year', 'mon', 'mday', 'hour', 'min', 'sec')\n        defaults = (None, 1, 1, 0, 0, 0)\n        # Assume that anything following \".\" on the right side is a\n        # floating fraction of a second.\n        try:\n            idot = timestr.rindex('.')\n        except Exception:\n            fracsec = 0.0\n        else:\n            timestr, fracsec = timestr[:idot], timestr[idot:]\n            fracsec = float(fracsec)\n\n        for _, strptime_fmt_or_regex, _ in subfmts:\n            if isinstance(strptime_fmt_or_regex, str):\n                try:\n                    tm = time.strptime(timestr, strptime_fmt_or_regex)\n                except ValueError:\n                    continue\n                else:\n                    vals = [getattr(tm, 'tm_' + component)\n                            for component in components]\n\n            else:\n                tm = re.match(strptime_fmt_or_regex, timestr)\n                if tm is None:\n                    continue\n                tm = tm.groupdict()\n                vals = [int(tm.get(component, default)) for component, default\n                        in zip(components, defaults)]\n\n            # Add fractional seconds\n            vals[-1] = vals[-1] + fracsec\n            return vals\n        else:\n            raise ValueError(f'Time {timestr} does not match {self.name} format')\n\n    def set_jds(self, val1, val2):\n        \"\"\"Parse the time strings contained in val1 and set jd1, jd2\"\"\"\n        # If specific input subformat is required then use the Python parser.\n        # Also do this if Time format class does not define `use_fast_parser` or\n        # if the fast parser is entirely disabled. Note that `use_fast_parser`\n        # is ignored for format classes that don't have a fast parser.\n        if (self.in_subfmt != '*'\n                or '_fast_parser' not in self.__class__.__dict__\n                or conf.use_fast_parser == 'False'):\n            jd1, jd2 = self.get_jds_python(val1, val2)\n        else:\n            try:\n                jd1, jd2 = self.get_jds_fast(val1, val2)\n            except Exception:\n                # Fall through to the Python parser unless fast is forced.\n                if conf.use_fast_parser == 'force':\n                    raise\n                else:\n                    jd1, jd2 = self.get_jds_python(val1, val2)\n\n        self.jd1 = jd1\n        self.jd2 = jd2\n\n    def get_jds_python(self, val1, val2):\n        \"\"\"Parse the time strings contained in val1 and get jd1, jd2\"\"\"\n        # Select subformats based on current self.in_subfmt\n        subfmts = self._select_subfmts(self.in_subfmt)\n        # Be liberal in what we accept: convert bytes to ascii.\n        # Here .item() is needed for arrays with entries of unequal length,\n        # to strip trailing 0 bytes.\n        to_string = (str if val1.dtype.kind == 'U' else\n                     lambda x: str(x.item(), encoding='ascii'))\n        iterator = np.nditer([val1, None, None, None, None, None, None],\n                             flags=['zerosize_ok'],\n                             op_dtypes=[None] + 5 * [np.intc] + [np.double])\n        for val, iy, im, id, ihr, imin, dsec in iterator:\n            val = to_string(val)\n            iy[...], im[...], id[...], ihr[...], imin[...], dsec[...] = (\n                self.parse_string(val, subfmts))\n\n        jd1, jd2 = erfa.dtf2d(self.scale.upper().encode('ascii'),\n                              *iterator.operands[1:])\n        jd1, jd2 = day_frac(jd1, jd2)\n\n        return jd1, jd2\n\n    def get_jds_fast(self, val1, val2):\n        \"\"\"Use fast C parser to parse time strings in val1 and get jd1, jd2\"\"\"\n        # Handle bytes or str input and convert to uint8.  We need to the\n        # dtype _parse_times.dt_u1 instead of uint8, since otherwise it is\n        # not possible to create a gufunc with structured dtype output.\n        # See note about ufunc type resolver in pyerfa/erfa/ufunc.c.templ.\n        if val1.dtype.kind == 'U':\n            # Note: val1.astype('S') is *very* slow, so we check ourselves\n            # that the input is pure ASCII.\n            val1_uint32 = val1.view((np.uint32, val1.dtype.itemsize // 4))\n            if np.any(val1_uint32 > 127):\n                raise ValueError('input is not pure ASCII')\n\n            # It might be possible to avoid making a copy via astype with\n            # cleverness in parse_times.c but leave that for another day.\n            chars = val1_uint32.astype(_parse_times.dt_u1)\n\n        else:\n            chars = val1.view((_parse_times.dt_u1, val1.dtype.itemsize))\n\n        # Call the fast parsing ufunc.\n        time_struct = self._fast_parser(chars)\n        jd1, jd2 = erfa.dtf2d(self.scale.upper().encode('ascii'),\n                              time_struct['year'],\n                              time_struct['month'],\n                              time_struct['day'],\n                              time_struct['hour'],\n                              time_struct['minute'],\n                              time_struct['second'])\n        return day_frac(jd1, jd2)\n\n    def str_kwargs(self):\n        \"\"\"\n        Generator that yields a dict of values corresponding to the\n        calendar date and time for the internal JD values.\n        \"\"\"\n        scale = self.scale.upper().encode('ascii'),\n        iys, ims, ids, ihmsfs = erfa.d2dtf(scale, self.precision,\n                                           self.jd1, self.jd2_filled)\n\n        # Get the str_fmt element of the first allowed output subformat\n        _, _, str_fmt = self._select_subfmts(self.out_subfmt)[0]\n\n        yday = None\n        has_yday = '{yday:' in str_fmt\n\n        ihrs = ihmsfs['h']\n        imins = ihmsfs['m']\n        isecs = ihmsfs['s']\n        ifracs = ihmsfs['f']\n        for iy, im, id, ihr, imin, isec, ifracsec in np.nditer(\n                [iys, ims, ids, ihrs, imins, isecs, ifracs],\n                flags=['zerosize_ok']):\n            if has_yday:\n                yday = datetime.datetime(iy, im, id).timetuple().tm_yday\n\n            yield {'year': int(iy), 'mon': int(im), 'day': int(id),\n                   'hour': int(ihr), 'min': int(imin), 'sec': int(isec),\n                   'fracsec': int(ifracsec), 'yday': yday}\n\n    def format_string(self, str_fmt, **kwargs):\n        \"\"\"Write time to a string using a given format.\n\n        By default, just interprets str_fmt as a format string,\n        but subclasses can add to this.\n        \"\"\"\n        return str_fmt.format(**kwargs)\n\n    @property\n    def value(self):\n        # Select the first available subformat based on current\n        # self.out_subfmt\n        subfmts = self._select_subfmts(self.out_subfmt)\n        _, _, str_fmt = subfmts[0]\n\n        # TODO: fix this ugly hack\n        if self.precision > 0 and str_fmt.endswith('{sec:02d}'):\n            str_fmt += '.{fracsec:0' + str(self.precision) + 'd}'\n\n        # Try to optimize this later.  Can't pre-allocate because length of\n        # output could change, e.g. year rolls from 999 to 1000.\n        outs = []\n        for kwargs in self.str_kwargs():\n            outs.append(str(self.format_string(str_fmt, **kwargs)))\n\n        return np.array(outs).reshape(self.jd1.shape)\n\n\nclass TimeISO(TimeString):\n    \"\"\"\n    ISO 8601 compliant date-time format \"YYYY-MM-DD HH:MM:SS.sss...\".\n    For example, 2000-01-01 00:00:00.000 is midnight on January 1, 2000.\n\n    The allowed subformats are:\n\n    - 'date_hms': date + hours, mins, secs (and optional fractional secs)\n    - 'date_hm': date + hours, mins\n    - 'date': date\n    \"\"\"\n\n    name = 'iso'\n    subfmts = (('date_hms',\n                '%Y-%m-%d %H:%M:%S',\n                # XXX To Do - use strftime for output ??\n                '{year:d}-{mon:02d}-{day:02d} {hour:02d}:{min:02d}:{sec:02d}'),\n               ('date_hm',\n                '%Y-%m-%d %H:%M',\n                '{year:d}-{mon:02d}-{day:02d} {hour:02d}:{min:02d}'),\n               ('date',\n                '%Y-%m-%d',\n                '{year:d}-{mon:02d}-{day:02d}'))\n\n    # Define positions and starting delimiter for year, month, day, hour,\n    # minute, seconds components of an ISO time. This is used by the fast\n    # C-parser parse_ymdhms_times()\n    #\n    #  \"2000-01-12 13:14:15.678\"\n    #   01234567890123456789012\n    #   yyyy-mm-dd hh:mm:ss.fff\n    # Parsed as ('yyyy', '-mm', '-dd', ' hh', ':mm', ':ss', '.fff')\n    fast_parser_pars = dict(\n        delims=(0, ord('-'), ord('-'), ord(' '), ord(':'), ord(':'), ord('.')),\n        starts=(0, 4, 7, 10, 13, 16, 19),\n        stops=(3, 6, 9, 12, 15, 18, -1),\n        # Break allowed *before*\n        #              y  m  d  h  m  s  f\n        break_allowed=(0, 0, 0, 1, 0, 1, 1),\n        has_day_of_year=0)\n\n    def parse_string(self, timestr, subfmts):\n        # Handle trailing 'Z' for UTC time\n        if timestr.endswith('Z'):\n            if self.scale != 'utc':\n                raise ValueError(\"Time input terminating in 'Z' must have \"\n                                 \"scale='UTC'\")\n            timestr = timestr[:-1]\n        return super().parse_string(timestr, subfmts)\n\n\nclass TimeISOT(TimeISO):\n    \"\"\"\n    ISO 8601 compliant date-time format \"YYYY-MM-DDTHH:MM:SS.sss...\".\n    This is the same as TimeISO except for a \"T\" instead of space between\n    the date and time.\n    For example, 2000-01-01T00:00:00.000 is midnight on January 1, 2000.\n\n    The allowed subformats are:\n\n    - 'date_hms': date + hours, mins, secs (and optional fractional secs)\n    - 'date_hm': date + hours, mins\n    - 'date': date\n    \"\"\"\n\n    name = 'isot'\n    subfmts = (('date_hms',\n                '%Y-%m-%dT%H:%M:%S',\n                '{year:d}-{mon:02d}-{day:02d}T{hour:02d}:{min:02d}:{sec:02d}'),\n               ('date_hm',\n                '%Y-%m-%dT%H:%M',\n                '{year:d}-{mon:02d}-{day:02d}T{hour:02d}:{min:02d}'),\n               ('date',\n                '%Y-%m-%d',\n                '{year:d}-{mon:02d}-{day:02d}'))\n\n    # See TimeISO for explanation\n    fast_parser_pars = dict(\n        delims=(0, ord('-'), ord('-'), ord('T'), ord(':'), ord(':'), ord('.')),\n        starts=(0, 4, 7, 10, 13, 16, 19),\n        stops=(3, 6, 9, 12, 15, 18, -1),\n        # Break allowed *before*\n        #              y  m  d  h  m  s  f\n        break_allowed=(0, 0, 0, 1, 0, 1, 1),\n        has_day_of_year=0)\n\n\nclass TimeYearDayTime(TimeISO):\n    \"\"\"\n    Year, day-of-year and time as \"YYYY:DOY:HH:MM:SS.sss...\".\n    The day-of-year (DOY) goes from 001 to 365 (366 in leap years).\n    For example, 2000:001:00:00:00.000 is midnight on January 1, 2000.\n\n    The allowed subformats are:\n\n    - 'date_hms': date + hours, mins, secs (and optional fractional secs)\n    - 'date_hm': date + hours, mins\n    - 'date': date\n    \"\"\"\n\n    name = 'yday'\n    subfmts = (('date_hms',\n                '%Y:%j:%H:%M:%S',\n                '{year:d}:{yday:03d}:{hour:02d}:{min:02d}:{sec:02d}'),\n               ('date_hm',\n                '%Y:%j:%H:%M',\n                '{year:d}:{yday:03d}:{hour:02d}:{min:02d}'),\n               ('date',\n                '%Y:%j',\n                '{year:d}:{yday:03d}'))\n\n    # Define positions and starting delimiter for year, month, day, hour,\n    # minute, seconds components of an ISO time. This is used by the fast\n    # C-parser parse_ymdhms_times()\n    #\n    #  \"2000:123:13:14:15.678\"\n    #   012345678901234567890\n    #   yyyy:ddd:hh:mm:ss.fff\n    # Parsed as ('yyyy', ':ddd', ':hh', ':mm', ':ss', '.fff')\n    #\n    # delims: character at corresponding `starts` position (0 => no character)\n    # starts: position where component starts (including delimiter if present)\n    # stops: position where component ends (-1 => continue to end of string)\n\n    fast_parser_pars = dict(\n        delims=(0, 0, ord(':'), ord(':'), ord(':'), ord(':'), ord('.')),\n        starts=(0, -1, 4, 8, 11, 14, 17),\n        stops=(3, -1, 7, 10, 13, 16, -1),\n        # Break allowed before:\n        #              y  m  d  h  m  s  f\n        break_allowed=(0, 0, 0, 1, 0, 1, 1),\n        has_day_of_year=1)\n\n\nclass TimeDatetime64(TimeISOT):\n    name = 'datetime64'\n\n    def _check_val_type(self, val1, val2):\n        if not val1.dtype.kind == 'M':\n            if val1.size > 0:\n                raise TypeError('Input values for {} class must be '\n                                'datetime64 objects'.format(self.name))\n            else:\n                val1 = np.array([], 'datetime64[D]')\n        if val2 is not None:\n            raise ValueError(\n                f'{self.name} objects do not accept a val2 but you provided {val2}')\n\n        return val1, None\n\n    def set_jds(self, val1, val2):\n        # If there are any masked values in the ``val1`` datetime64 array\n        # ('NaT') then stub them with a valid date so downstream parse_string\n        # will work.  The value under the mask is arbitrary but a \"modern\" date\n        # is good.\n        mask = np.isnat(val1)\n        masked = np.any(mask)\n        if masked:\n            val1 = val1.copy()\n            val1[mask] = '2000'\n\n        # Make sure M(onth) and Y(ear) dates will parse and convert to bytestring\n        if val1.dtype.name in ['datetime64[M]', 'datetime64[Y]']:\n            val1 = val1.astype('datetime64[D]')\n        val1 = val1.astype('S')\n\n        # Standard ISO string parsing now\n        super().set_jds(val1, val2)\n\n        # Finally apply mask if necessary\n        if masked:\n            self.jd2[mask] = np.nan\n\n    @property\n    def value(self):\n        precision = self.precision\n        self.precision = 9\n        ret = super().value\n        self.precision = precision\n        return ret.astype('datetime64')\n\n\nclass TimeFITS(TimeString):\n    \"\"\"\n    FITS format: \"[±Y]YYYY-MM-DD[THH:MM:SS[.sss]]\".\n\n    ISOT but can give signed five-digit year (mostly for negative years);\n\n    The allowed subformats are:\n\n    - 'date_hms': date + hours, mins, secs (and optional fractional secs)\n    - 'date': date\n    - 'longdate_hms': as 'date_hms', but with signed 5-digit year\n    - 'longdate': as 'date', but with signed 5-digit year\n\n    See Rots et al., 2015, A&A 574:A36 (arXiv:1409.7583).\n    \"\"\"\n    name = 'fits'\n    subfmts = (\n        ('date_hms',\n         (r'(?P<year>\\d{4})-(?P<mon>\\d\\d)-(?P<mday>\\d\\d)T'\n          r'(?P<hour>\\d\\d):(?P<min>\\d\\d):(?P<sec>\\d\\d(\\.\\d*)?)'),\n         '{year:04d}-{mon:02d}-{day:02d}T{hour:02d}:{min:02d}:{sec:02d}'),\n        ('date',\n         r'(?P<year>\\d{4})-(?P<mon>\\d\\d)-(?P<mday>\\d\\d)',\n         '{year:04d}-{mon:02d}-{day:02d}'),\n        ('longdate_hms',\n         (r'(?P<year>[+-]\\d{5})-(?P<mon>\\d\\d)-(?P<mday>\\d\\d)T'\n          r'(?P<hour>\\d\\d):(?P<min>\\d\\d):(?P<sec>\\d\\d(\\.\\d*)?)'),\n         '{year:+06d}-{mon:02d}-{day:02d}T{hour:02d}:{min:02d}:{sec:02d}'),\n        ('longdate',\n         r'(?P<year>[+-]\\d{5})-(?P<mon>\\d\\d)-(?P<mday>\\d\\d)',\n         '{year:+06d}-{mon:02d}-{day:02d}'))\n    # Add the regex that parses the scale and possible realization.\n    # Support for this is deprecated.  Read old style but no longer write\n    # in this style.\n    subfmts = tuple(\n        (subfmt[0],\n         subfmt[1] + r'(\\((?P<scale>\\w+)(\\((?P<realization>\\w+)\\))?\\))?',\n         subfmt[2]) for subfmt in subfmts)\n\n    def parse_string(self, timestr, subfmts):\n        \"\"\"Read time and deprecated scale if present\"\"\"\n        # Try parsing with any of the allowed sub-formats.\n        for _, regex, _ in subfmts:\n            tm = re.match(regex, timestr)\n            if tm:\n                break\n        else:\n            raise ValueError(f'Time {timestr} does not match {self.name} format')\n        tm = tm.groupdict()\n        # Scale and realization are deprecated and strings in this form\n        # are no longer created.  We issue a warning but still use the value.\n        if tm['scale'] is not None:\n            warnings.warn(\"FITS time strings should no longer have embedded time scale.\",\n                          AstropyDeprecationWarning)\n            # If a scale was given, translate from a possible deprecated\n            # timescale identifier to the scale used by Time.\n            fits_scale = tm['scale'].upper()\n            scale = FITS_DEPRECATED_SCALES.get(fits_scale, fits_scale.lower())\n            if scale not in TIME_SCALES:\n                raise ValueError(\"Scale {!r} is not in the allowed scales {}\"\n                                 .format(scale, sorted(TIME_SCALES)))\n            # If no scale was given in the initialiser, set the scale to\n            # that given in the string.  Realization is ignored\n            # and is only supported to allow old-style strings to be\n            # parsed.\n            if self._scale is None:\n                self._scale = scale\n            if scale != self.scale:\n                raise ValueError(\"Input strings for {} class must all \"\n                                 \"have consistent time scales.\"\n                                 .format(self.name))\n        return [int(tm['year']), int(tm['mon']), int(tm['mday']),\n                int(tm.get('hour', 0)), int(tm.get('min', 0)),\n                float(tm.get('sec', 0.))]\n\n    @property\n    def value(self):\n        \"\"\"Convert times to strings, using signed 5 digit if necessary.\"\"\"\n        if 'long' not in self.out_subfmt:\n            # If we have times before year 0 or after year 9999, we can\n            # output only in a \"long\" format, using signed 5-digit years.\n            jd = self.jd1 + self.jd2\n            if jd.size and (jd.min() < 1721425.5 or jd.max() >= 5373484.5):\n                self.out_subfmt = 'long' + self.out_subfmt\n        return super().value\n\n\nclass TimeEpochDate(TimeNumeric):\n    \"\"\"\n    Base class for support floating point Besselian and Julian epoch dates\n    \"\"\"\n    _default_scale = 'tt'  # As of astropy 3.2, this is no longer 'utc'.\n\n    def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # validate scale.\n        epoch_to_jd = getattr(erfa, self.epoch_to_jd)\n        jd1, jd2 = epoch_to_jd(val1 + val2)\n        self.jd1, self.jd2 = day_frac(jd1, jd2)\n\n    def to_value(self, **kwargs):\n        jd_to_epoch = getattr(erfa, self.jd_to_epoch)\n        value = jd_to_epoch(self.jd1, self.jd2)\n        return super().to_value(jd1=value, jd2=np.float64(0.0), **kwargs)\n\n    value = property(to_value)\n\n\nclass TimeBesselianEpoch(TimeEpochDate):\n    \"\"\"Besselian Epoch year as floating point value(s) like 1950.0\"\"\"\n    name = 'byear'\n    epoch_to_jd = 'epb2jd'\n    jd_to_epoch = 'epb'\n\n    def _check_val_type(self, val1, val2):\n        \"\"\"Input value validation, typically overridden by derived classes\"\"\"\n        if hasattr(val1, 'to') and hasattr(val1, 'unit'):\n            raise ValueError(\"Cannot use Quantities for 'byear' format, \"\n                             \"as the interpretation would be ambiguous. \"\n                             \"Use float with Besselian year instead. \")\n        # FIXME: is val2 really okay here?\n        return super()._check_val_type(val1, val2)\n\n\nclass TimeJulianEpoch(TimeEpochDate):\n    \"\"\"Julian Epoch year as floating point value(s) like 2000.0\"\"\"\n    name = 'jyear'\n    unit = erfa.DJY  # 365.25, the Julian year, for conversion to quantities\n    epoch_to_jd = 'epj2jd'\n    jd_to_epoch = 'epj'\n\n\nclass TimeEpochDateString(TimeString):\n    \"\"\"\n    Base class to support string Besselian and Julian epoch dates\n    such as 'B1950.0' or 'J2000.0' respectively.\n    \"\"\"\n    _default_scale = 'tt'  # As of astropy 3.2, this is no longer 'utc'.\n\n    def set_jds(self, val1, val2):\n        epoch_prefix = self.epoch_prefix\n        # Be liberal in what we accept: convert bytes to ascii.\n        to_string = (str if val1.dtype.kind == 'U' else\n                     lambda x: str(x.item(), encoding='ascii'))\n        iterator = np.nditer([val1, None], op_dtypes=[val1.dtype, np.double],\n                             flags=['zerosize_ok'])\n        for val, years in iterator:\n            try:\n                time_str = to_string(val)\n                epoch_type, year_str = time_str[0], time_str[1:]\n                year = float(year_str)\n                if epoch_type.upper() != epoch_prefix:\n                    raise ValueError\n            except (IndexError, ValueError, UnicodeEncodeError):\n                raise ValueError(f'Time {val} does not match {self.name} format')\n            else:\n                years[...] = year\n\n        self._check_scale(self._scale)  # validate scale.\n        epoch_to_jd = getattr(erfa, self.epoch_to_jd)\n        jd1, jd2 = epoch_to_jd(iterator.operands[-1])\n        self.jd1, self.jd2 = day_frac(jd1, jd2)\n\n    @property\n    def value(self):\n        jd_to_epoch = getattr(erfa, self.jd_to_epoch)\n        years = jd_to_epoch(self.jd1, self.jd2)\n        # Use old-style format since it is a factor of 2 faster\n        str_fmt = self.epoch_prefix + '%.' + str(self.precision) + 'f'\n        outs = [str_fmt % year for year in years.flat]\n        return np.array(outs).reshape(self.jd1.shape)\n\n\nclass TimeBesselianEpochString(TimeEpochDateString):\n    \"\"\"Besselian Epoch year as string value(s) like 'B1950.0'\"\"\"\n    name = 'byear_str'\n    epoch_to_jd = 'epb2jd'\n    jd_to_epoch = 'epb'\n    epoch_prefix = 'B'\n\n\nclass TimeJulianEpochString(TimeEpochDateString):\n    \"\"\"Julian Epoch year as string value(s) like 'J2000.0'\"\"\"\n    name = 'jyear_str'\n    epoch_to_jd = 'epj2jd'\n    jd_to_epoch = 'epj'\n    epoch_prefix = 'J'\n\n\nclass TimeDeltaFormat(TimeFormat):\n    \"\"\"Base class for time delta representations\"\"\"\n\n    _registry = TIME_DELTA_FORMATS\n\n    def _check_scale(self, scale):\n        \"\"\"\n        Check that the scale is in the allowed list of scales, or is `None`\n        \"\"\"\n        if scale is not None and scale not in TIME_DELTA_SCALES:\n            raise ScaleValueError(\"Scale value '{}' not in \"\n                                  \"allowed values {}\"\n                                  .format(scale, TIME_DELTA_SCALES))\n\n        return scale\n\n\nclass TimeDeltaNumeric(TimeDeltaFormat, TimeNumeric):\n\n    def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # Validate scale.\n        self.jd1, self.jd2 = day_frac(val1, val2, divisor=1. / self.unit)\n\n    def to_value(self, **kwargs):\n        # Note that 1/unit is always exactly representable, so the\n        # following multiplications are exact.\n        factor = 1. / self.unit\n        jd1 = self.jd1 * factor\n        jd2 = self.jd2 * factor\n        return super().to_value(jd1=jd1, jd2=jd2, **kwargs)\n\n    value = property(to_value)\n\n\nclass TimeDeltaSec(TimeDeltaNumeric):\n    \"\"\"Time delta in SI seconds\"\"\"\n    name = 'sec'\n    unit = 1. / erfa.DAYSEC  # for quantity input\n\n\nclass TimeDeltaJD(TimeDeltaNumeric):\n    \"\"\"Time delta in Julian days (86400 SI seconds)\"\"\"\n    name = 'jd'\n    unit = 1.\n\n\nclass TimeDeltaDatetime(TimeDeltaFormat, TimeUnique):\n    \"\"\"Time delta in datetime.timedelta\"\"\"\n    name = 'datetime'\n\n    def _check_val_type(self, val1, val2):\n        if not all(isinstance(val, datetime.timedelta) for val in val1.flat):\n            raise TypeError('Input values for {} class must be '\n                            'datetime.timedelta objects'.format(self.name))\n        if val2 is not None:\n            raise ValueError(\n                f'{self.name} objects do not accept a val2 but you provided {val2}')\n        return val1, None\n\n    def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # Validate scale.\n        iterator = np.nditer([val1, None, None],\n                             flags=['refs_ok', 'zerosize_ok'],\n                             op_dtypes=[None, np.double, np.double])\n\n        day = datetime.timedelta(days=1)\n        for val, jd1, jd2 in iterator:\n            jd1[...], other = divmod(val.item(), day)\n            jd2[...] = other / day\n\n        self.jd1, self.jd2 = day_frac(iterator.operands[-2],\n                                      iterator.operands[-1])\n\n    @property\n    def value(self):\n        iterator = np.nditer([self.jd1, self.jd2, None],\n                             flags=['refs_ok', 'zerosize_ok'],\n                             op_dtypes=[None, None, object])\n\n        for jd1, jd2, out in iterator:\n            jd1_, jd2_ = day_frac(jd1, jd2)\n            out[...] = datetime.timedelta(days=jd1_,\n                                          microseconds=jd2_ * 86400 * 1e6)\n\n        return self.mask_if_needed(iterator.operands[-1])\n\n\ndef _validate_jd_for_storage(jd):\n    if isinstance(jd, (float, int)):\n        return np.array(jd, dtype=np.float_)\n    if (isinstance(jd, np.generic)\n        and (jd.dtype.kind == 'f' and jd.dtype.itemsize <= 8\n             or jd.dtype.kind in 'iu')):\n        return np.array(jd, dtype=np.float_)\n    elif (isinstance(jd, np.ndarray)\n          and jd.dtype.kind == 'f'\n          and jd.dtype.itemsize == 8):\n        return jd\n    else:\n        raise TypeError(\n            f\"JD values must be arrays (possibly zero-dimensional) \"\n            f\"of floats but we got {jd!r} of type {type(jd)}\")\n\n\ndef _broadcast_writeable(jd1, jd2):\n    if jd1.shape == jd2.shape:\n        return jd1, jd2\n    # When using broadcast_arrays, *both* are flagged with\n    # warn-on-write, even the one that wasn't modified, and\n    # require \"C\" only clears the flag if it actually copied\n    # anything.\n    shape = np.broadcast(jd1, jd2).shape\n    if jd1.shape == shape:\n        s_jd1 = jd1\n    else:\n        s_jd1 = np.require(np.broadcast_to(jd1, shape),\n                           requirements=[\"C\", \"W\"])\n    if jd2.shape == shape:\n        s_jd2 = jd2\n    else:\n        s_jd2 = np.require(np.broadcast_to(jd2, shape),\n                           requirements=[\"C\", \"W\"])\n    return s_jd1, s_jd2\n\n\n# Import symbols from core.py that are used in this module. This succeeds\n# because __init__.py imports format.py just before core.py.\nfrom .core import Time, TIME_SCALES, TIME_DELTA_SCALES, ScaleValueError  # noqa\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":286,"id":8260,"name":"_represent_as_dict_attrs","nodeType":"Attribute","startLoc":286,"text":"_represent_as_dict_attrs"},{"attributeType":"null","col":0,"comment":"null","endLoc":46,"id":8261,"name":"TIME_SCALES","nodeType":"Attribute","startLoc":46,"text":"TIME_SCALES"},{"attributeType":"null","col":4,"comment":"null","endLoc":292,"id":8262,"name":"_construct_from_dict_args","nodeType":"Attribute","startLoc":292,"text":"_construct_from_dict_args"},{"attributeType":"null","col":0,"comment":"null","endLoc":69,"id":8263,"name":"TIME_DELTA_SCALES","nodeType":"Attribute","startLoc":69,"text":"TIME_DELTA_SCALES"},{"attributeType":"null","col":4,"comment":"null","endLoc":299,"id":8264,"name":"_represent_as_dict_primary_data","nodeType":"Attribute","startLoc":299,"text":"_represent_as_dict_primary_data"},{"className":"ScaleValueError","col":0,"comment":"null","endLoc":2677,"id":8265,"nodeType":"Class","startLoc":2676,"text":"class ScaleValueError(Exception):\n    pass"},{"attributeType":"null","col":4,"comment":"null","endLoc":384,"id":8266,"name":"info_summary_attributes","nodeType":"Attribute","startLoc":384,"text":"info_summary_attributes"},{"className":"TimeFormat","col":0,"comment":"\n    Base class for time representations.\n\n    Parameters\n    ----------\n    val1 : numpy ndarray, list, number, str, or bytes\n        Values to initialize the time or times.  Bytes are decoded as ascii.\n    val2 : numpy ndarray, list, or number; optional\n        Value(s) to initialize the time or times.  Only used for numerical\n        input, to help preserve precision.\n    scale : str\n        Time scale of input value(s)\n    precision : int\n        Precision for seconds as floating point\n    in_subfmt : str\n        Select subformat for inputting string times\n    out_subfmt : str\n        Select subformat for outputting string times\n    from_jd : bool\n        If true then val1, val2 are jd1, jd2\n    ","endLoc":395,"id":8267,"nodeType":"Class","startLoc":79,"text":"class TimeFormat:\n    \"\"\"\n    Base class for time representations.\n\n    Parameters\n    ----------\n    val1 : numpy ndarray, list, number, str, or bytes\n        Values to initialize the time or times.  Bytes are decoded as ascii.\n    val2 : numpy ndarray, list, or number; optional\n        Value(s) to initialize the time or times.  Only used for numerical\n        input, to help preserve precision.\n    scale : str\n        Time scale of input value(s)\n    precision : int\n        Precision for seconds as floating point\n    in_subfmt : str\n        Select subformat for inputting string times\n    out_subfmt : str\n        Select subformat for outputting string times\n    from_jd : bool\n        If true then val1, val2 are jd1, jd2\n    \"\"\"\n\n    _default_scale = 'utc'  # As of astropy 0.4\n    subfmts = ()\n    _registry = TIME_FORMATS\n\n    def __init__(self, val1, val2, scale, precision,\n                 in_subfmt, out_subfmt, from_jd=False):\n        self.scale = scale  # validation of scale done later with _check_scale\n        self.precision = precision\n        self.in_subfmt = in_subfmt\n        self.out_subfmt = out_subfmt\n\n        self._jd1, self._jd2 = None, None\n\n        if from_jd:\n            self.jd1 = val1\n            self.jd2 = val2\n        else:\n            val1, val2 = self._check_val_type(val1, val2)\n            self.set_jds(val1, val2)\n\n    def __init_subclass__(cls, **kwargs):\n        # Register time formats that define a name, but leave out astropy_time since\n        # it is not a user-accessible format and is only used for initialization into\n        # a different format.\n        if 'name' in cls.__dict__ and cls.name != 'astropy_time':\n            # FIXME: check here that we're not introducing a collision with\n            # an existing method or attribute; problem is it could be either\n            # astropy.time.Time or astropy.time.TimeDelta, and at the point\n            # where this is run neither of those classes have necessarily been\n            # constructed yet.\n            if 'value' in cls.__dict__ and not hasattr(cls.value, \"fget\"):\n                raise ValueError(\"If defined, 'value' must be a property\")\n\n            cls._registry[cls.name] = cls\n\n        # If this class defines its own subfmts, preprocess the definitions.\n        if 'subfmts' in cls.__dict__:\n            cls.subfmts = _regexify_subfmts(cls.subfmts)\n\n        return super().__init_subclass__(**kwargs)\n\n    @classmethod\n    def _get_allowed_subfmt(cls, subfmt):\n        \"\"\"Get an allowed subfmt for this class, either the input ``subfmt``\n        if this is valid or '*' as a default.  This method gets used in situations\n        where the format of an existing Time object is changing and so the\n        out_ or in_subfmt may need to be coerced to the default '*' if that\n        ``subfmt`` is no longer valid.\n        \"\"\"\n        try:\n            cls._select_subfmts(subfmt)\n        except ValueError:\n            subfmt = '*'\n        return subfmt\n\n    @property\n    def in_subfmt(self):\n        return self._in_subfmt\n\n    @in_subfmt.setter\n    def in_subfmt(self, subfmt):\n        # Validate subfmt value for this class, raises ValueError if not.\n        self._select_subfmts(subfmt)\n        self._in_subfmt = subfmt\n\n    @property\n    def out_subfmt(self):\n        return self._out_subfmt\n\n    @out_subfmt.setter\n    def out_subfmt(self, subfmt):\n        # Validate subfmt value for this class, raises ValueError if not.\n        self._select_subfmts(subfmt)\n        self._out_subfmt = subfmt\n\n    @property\n    def jd1(self):\n        return self._jd1\n\n    @jd1.setter\n    def jd1(self, jd1):\n        self._jd1 = _validate_jd_for_storage(jd1)\n        if self._jd2 is not None:\n            self._jd1, self._jd2 = _broadcast_writeable(self._jd1, self._jd2)\n\n    @property\n    def jd2(self):\n        return self._jd2\n\n    @jd2.setter\n    def jd2(self, jd2):\n        self._jd2 = _validate_jd_for_storage(jd2)\n        if self._jd1 is not None:\n            self._jd1, self._jd2 = _broadcast_writeable(self._jd1, self._jd2)\n\n    def __len__(self):\n        return len(self.jd1)\n\n    @property\n    def scale(self):\n        \"\"\"Time scale\"\"\"\n        self._scale = self._check_scale(self._scale)\n        return self._scale\n\n    @scale.setter\n    def scale(self, val):\n        self._scale = val\n\n    def mask_if_needed(self, value):\n        if self.masked:\n            value = np.ma.array(value, mask=self.mask, copy=False)\n        return value\n\n    @property\n    def mask(self):\n        if 'mask' not in self.cache:\n            self.cache['mask'] = np.isnan(self.jd2)\n            if self.cache['mask'].shape:\n                self.cache['mask'].flags.writeable = False\n        return self.cache['mask']\n\n    @property\n    def masked(self):\n        if 'masked' not in self.cache:\n            self.cache['masked'] = bool(np.any(self.mask))\n        return self.cache['masked']\n\n    @property\n    def jd2_filled(self):\n        return np.nan_to_num(self.jd2) if self.masked else self.jd2\n\n    @lazyproperty\n    def cache(self):\n        \"\"\"\n        Return the cache associated with this instance.\n        \"\"\"\n        return defaultdict(dict)\n\n    def _check_val_type(self, val1, val2):\n        \"\"\"Input value validation, typically overridden by derived classes\"\"\"\n        # val1 cannot contain nan, but val2 can contain nan\n        isfinite1 = np.isfinite(val1)\n        if val1.size > 1:  # Calling .all() on a scalar is surprisingly slow\n            isfinite1 = isfinite1.all()  # Note: arr.all() about 3x faster than np.all(arr)\n        elif val1.size == 0:\n            isfinite1 = False\n        ok1 = (val1.dtype.kind == 'f' and val1.dtype.itemsize >= 8\n               and isfinite1 or val1.size == 0)\n        ok2 = val2 is None or (\n            val2.dtype.kind == 'f' and val2.dtype.itemsize >= 8\n            and not np.any(np.isinf(val2))) or val2.size == 0\n        if not (ok1 and ok2):\n            raise TypeError('Input values for {} class must be finite doubles'\n                            .format(self.name))\n\n        if getattr(val1, 'unit', None) is not None:\n            # Convert any quantity-likes to days first, attempting to be\n            # careful with the conversion, so that, e.g., large numbers of\n            # seconds get converted without losing precision because\n            # 1/86400 is not exactly representable as a float.\n            val1 = u.Quantity(val1, copy=False)\n            if val2 is not None:\n                val2 = u.Quantity(val2, copy=False)\n\n            try:\n                val1, val2 = quantity_day_frac(val1, val2)\n            except u.UnitsError:\n                raise u.UnitConversionError(\n                    \"only quantities with time units can be \"\n                    \"used to instantiate Time instances.\")\n            # We now have days, but the format may expect another unit.\n            # On purpose, multiply with 1./day_unit because typically it is\n            # 1./erfa.DAYSEC, and inverting it recovers the integer.\n            # (This conversion will get undone in format's set_jds, hence\n            # there may be room for optimizing this.)\n            factor = 1. / getattr(self, 'unit', 1.)\n            if factor != 1.:\n                val1, carry = two_product(val1, factor)\n                carry += val2 * factor\n                val1, val2 = two_sum(val1, carry)\n\n        elif getattr(val2, 'unit', None) is not None:\n            raise TypeError('Cannot mix float and Quantity inputs')\n\n        if val2 is None:\n            val2 = np.array(0, dtype=val1.dtype)\n\n        def asarray_or_scalar(val):\n            \"\"\"\n            Remove ndarray subclasses since for jd1/jd2 we want a pure ndarray\n            or a Python or numpy scalar.\n            \"\"\"\n            return np.asarray(val) if isinstance(val, np.ndarray) else val\n\n        return asarray_or_scalar(val1), asarray_or_scalar(val2)\n\n    def _check_scale(self, scale):\n        \"\"\"\n        Return a validated scale value.\n\n        If there is a class attribute 'scale' then that defines the default /\n        required time scale for this format.  In this case if a scale value was\n        provided that needs to match the class default, otherwise return\n        the class default.\n\n        Otherwise just make sure that scale is in the allowed list of\n        scales.  Provide a different error message if `None` (no value) was\n        supplied.\n        \"\"\"\n        if scale is None:\n            scale = self._default_scale\n\n        if scale not in TIME_SCALES:\n            raise ScaleValueError(\"Scale value '{}' not in \"\n                                  \"allowed values {}\"\n                                  .format(scale, TIME_SCALES))\n\n        return scale\n\n    def set_jds(self, val1, val2):\n        \"\"\"\n        Set internal jd1 and jd2 from val1 and val2.  Must be provided\n        by derived classes.\n        \"\"\"\n        raise NotImplementedError\n\n    def to_value(self, parent=None, out_subfmt=None):\n        \"\"\"\n        Return time representation from internal jd1 and jd2 in specified\n        ``out_subfmt``.\n\n        This is the base method that ignores ``parent`` and uses the ``value``\n        property to compute the output. This is done by temporarily setting\n        ``self.out_subfmt`` and calling ``self.value``. This is required for\n        legacy Format subclasses prior to astropy 4.0  New code should instead\n        implement the value functionality in ``to_value()`` and then make the\n        ``value`` property be a simple call to ``self.to_value()``.\n\n        Parameters\n        ----------\n        parent : object\n            Parent `~astropy.time.Time` object associated with this\n            `~astropy.time.TimeFormat` object\n        out_subfmt : str or None\n            Output subformt (use existing self.out_subfmt if `None`)\n\n        Returns\n        -------\n        value : numpy.array, numpy.ma.array\n            Array or masked array of formatted time representation values\n        \"\"\"\n        # Get value via ``value`` property, overriding out_subfmt temporarily if needed.\n        if out_subfmt is not None:\n            out_subfmt_orig = self.out_subfmt\n            try:\n                self.out_subfmt = out_subfmt\n                value = self.value\n            finally:\n                self.out_subfmt = out_subfmt_orig\n        else:\n            value = self.value\n\n        return self.mask_if_needed(value)\n\n    @property\n    def value(self):\n        raise NotImplementedError\n\n    @classmethod\n    def _select_subfmts(cls, pattern):\n        \"\"\"\n        Return a list of subformats where name matches ``pattern`` using\n        fnmatch.\n\n        If no subformat matches pattern then a ValueError is raised.  A special\n        case is a format with no allowed subformats, i.e. subfmts=(), and\n        pattern='*'.  This is OK and happens when this method is used for\n        validation of an out_subfmt.\n        \"\"\"\n        if not isinstance(pattern, str):\n            raise ValueError('subfmt attribute must be a string')\n        elif pattern == '*':\n            return cls.subfmts\n\n        subfmts = [x for x in cls.subfmts if fnmatch.fnmatchcase(x[0], pattern)]\n        if len(subfmts) == 0:\n            if len(cls.subfmts) == 0:\n                raise ValueError(f'subformat not allowed for format {cls.name}')\n            else:\n                subfmt_names = [x[0] for x in cls.subfmts]\n                raise ValueError(f'subformat {pattern!r} must match one of '\n                                 f'{subfmt_names} for format {cls.name}')\n\n        return subfmts"},{"attributeType":"null","col":4,"comment":"null","endLoc":390,"id":8268,"name":"info_summary_stats","nodeType":"Attribute","startLoc":390,"text":"info_summary_stats"},{"col":4,"comment":"null","endLoc":141,"header":"def __init_subclass__(cls, **kwargs)","id":8269,"name":"__init_subclass__","nodeType":"Function","startLoc":122,"text":"def __init_subclass__(cls, **kwargs):\n        # Register time formats that define a name, but leave out astropy_time since\n        # it is not a user-accessible format and is only used for initialization into\n        # a different format.\n        if 'name' in cls.__dict__ and cls.name != 'astropy_time':\n            # FIXME: check here that we're not introducing a collision with\n            # an existing method or attribute; problem is it could be either\n            # astropy.time.Time or astropy.time.TimeDelta, and at the point\n            # where this is run neither of those classes have necessarily been\n            # constructed yet.\n            if 'value' in cls.__dict__ and not hasattr(cls.value, \"fget\"):\n                raise ValueError(\"If defined, 'value' must be a property\")\n\n            cls._registry[cls.name] = cls\n\n        # If this class defines its own subfmts, preprocess the definitions.\n        if 'subfmts' in cls.__dict__:\n            cls.subfmts = _regexify_subfmts(cls.subfmts)\n\n        return super().__init_subclass__(**kwargs)"},{"attributeType":"null","col":12,"comment":"null","endLoc":330,"id":8270,"name":"_parent_cls","nodeType":"Attribute","startLoc":330,"text":"self._parent_cls"},{"attributeType":"null","col":12,"comment":"null","endLoc":306,"id":8271,"name":"_attrs","nodeType":"Attribute","startLoc":306,"text":"self._attrs"},{"col":4,"comment":"null","endLoc":531,"header":"@property\n    def parent_table(self)","id":8272,"name":"parent_table","nodeType":"Function","startLoc":526,"text":"@property\n    def parent_table(self):\n        value = self._attrs.get('parent_table')\n        if callable(value):\n            value = value()\n        return value"},{"col":0,"comment":"\n    Iterate through each of the sub-formats and try substituting simple\n    regular expressions for the strptime codes for year, month, day-of-month,\n    hour, minute, second.  If no % characters remain then turn the final string\n    into a compiled regex.  This assumes time formats do not have a % in them.\n\n    This is done both to speed up parsing of strings and to allow mixed formats\n    where strptime does not quite work well enough.\n    ","endLoc":76,"header":"def _regexify_subfmts(subfmts)","id":8273,"name":"_regexify_subfmts","nodeType":"Function","startLoc":48,"text":"def _regexify_subfmts(subfmts):\n    \"\"\"\n    Iterate through each of the sub-formats and try substituting simple\n    regular expressions for the strptime codes for year, month, day-of-month,\n    hour, minute, second.  If no % characters remain then turn the final string\n    into a compiled regex.  This assumes time formats do not have a % in them.\n\n    This is done both to speed up parsing of strings and to allow mixed formats\n    where strptime does not quite work well enough.\n    \"\"\"\n    new_subfmts = []\n    for subfmt_tuple in subfmts:\n        subfmt_in = subfmt_tuple[1]\n        if isinstance(subfmt_in, str):\n            for strptime_code, regex in (('%Y', r'(?P<year>\\d\\d\\d\\d)'),\n                                         ('%m', r'(?P<mon>\\d{1,2})'),\n                                         ('%d', r'(?P<mday>\\d{1,2})'),\n                                         ('%H', r'(?P<hour>\\d{1,2})'),\n                                         ('%M', r'(?P<min>\\d{1,2})'),\n                                         ('%S', r'(?P<sec>\\d{1,2})')):\n                subfmt_in = subfmt_in.replace(strptime_code, regex)\n\n            if '%' not in subfmt_in:\n                subfmt_tuple = (subfmt_tuple[0],\n                                re.compile(subfmt_in + '$'),\n                                subfmt_tuple[2])\n        new_subfmts.append(subfmt_tuple)\n\n    return tuple(new_subfmts)"},{"col":0,"comment":"\n    Calculate the pixel scale along each axis of a non-celestial WCS,\n    for example one with mixed spectral and spatial axes.\n\n    Parameters\n    ----------\n    inwcs : `~astropy.wcs.WCS`\n        The world coordinate system object.\n\n    Returns\n    -------\n    scale : `numpy.ndarray`\n        The pixel scale along each axis.\n    ","endLoc":490,"header":"def non_celestial_pixel_scales(inwcs)","id":8274,"name":"non_celestial_pixel_scales","nodeType":"Function","startLoc":466,"text":"def non_celestial_pixel_scales(inwcs):\n    \"\"\"\n    Calculate the pixel scale along each axis of a non-celestial WCS,\n    for example one with mixed spectral and spatial axes.\n\n    Parameters\n    ----------\n    inwcs : `~astropy.wcs.WCS`\n        The world coordinate system object.\n\n    Returns\n    -------\n    scale : `numpy.ndarray`\n        The pixel scale along each axis.\n    \"\"\"\n\n    if inwcs.is_celestial:\n        raise ValueError(\"WCS is celestial, use celestial_pixel_scales instead\")\n\n    pccd = inwcs.pixel_scale_matrix\n\n    if np.allclose(np.extract(1-np.eye(*pccd.shape), pccd), 0):\n        return np.abs(np.diagonal(pccd))*u.deg\n    else:\n        raise ValueError(\"WCS is rotated, cannot determine consistent pixel scales\")"},{"col":0,"comment":"\n    Return a list of unique items in the list provided, preserving the order\n    in which they are found.\n    ","endLoc":656,"header":"def _unique_with_order_preserved(items)","id":8275,"name":"_unique_with_order_preserved","nodeType":"Function","startLoc":647,"text":"def _unique_with_order_preserved(items):\n    \"\"\"\n    Return a list of unique items in the list provided, preserving the order\n    in which they are found.\n    \"\"\"\n    new_items = []\n    for item in items:\n        if item not in new_items:\n            new_items.append(item)\n    return new_items"},{"col":4,"comment":"null","endLoc":539,"header":"@parent_table.setter\n    def parent_table(self, parent_table)","id":8276,"name":"parent_table","nodeType":"Function","startLoc":533,"text":"@parent_table.setter\n    def parent_table(self, parent_table):\n        if parent_table is None:\n            self._attrs.pop('parent_table', None)\n        else:\n            parent_table = weakref.ref(parent_table)\n            self._attrs['parent_table'] = parent_table"},{"col":0,"comment":"\n    Return a correlation matrix between the pixel coordinates and the\n    high level world coordinates, along with the list of high level world\n    coordinate classes.\n\n    The shape of the matrix is ``(n_world, n_pix)``, where ``n_world`` is the\n    number of high level world coordinates.\n    ","endLoc":687,"header":"def _pixel_to_world_correlation_matrix(wcs)","id":8277,"name":"_pixel_to_world_correlation_matrix","nodeType":"Function","startLoc":659,"text":"def _pixel_to_world_correlation_matrix(wcs):\n    \"\"\"\n    Return a correlation matrix between the pixel coordinates and the\n    high level world coordinates, along with the list of high level world\n    coordinate classes.\n\n    The shape of the matrix is ``(n_world, n_pix)``, where ``n_world`` is the\n    number of high level world coordinates.\n    \"\"\"\n\n    # We basically want to collapse the world dimensions together that are\n    # combined into the same high-level objects.\n\n    # Get the following in advance as getting these properties can be expensive\n    all_components = wcs.low_level_wcs.world_axis_object_components\n    all_classes = wcs.low_level_wcs.world_axis_object_classes\n    axis_correlation_matrix = wcs.low_level_wcs.axis_correlation_matrix\n\n    components = _unique_with_order_preserved([c[0] for c in all_components])\n\n    matrix = np.zeros((len(components), wcs.pixel_n_dim), dtype=bool)\n\n    for iworld in range(wcs.world_n_dim):\n        iworld_unique = components.index(all_components[iworld][0])\n        matrix[iworld_unique] |= axis_correlation_matrix[iworld]\n\n    classes = [all_classes[component][0] for component in components]\n\n    return matrix, classes"},{"col":4,"comment":"null","endLoc":547,"header":"def __init__(self, bound=False)","id":8278,"name":"__init__","nodeType":"Function","startLoc":541,"text":"def __init__(self, bound=False):\n        super().__init__(bound=bound)\n\n        # If bound to a data object instance then add a _format_funcs dict\n        # for caching functions for print formatting.\n        if bound:\n            self._format_funcs = {}"},{"col":0,"comment":"\n    Correlation matrix between the input and output pixel coordinates for a\n    pixel -> world -> pixel transformation specified by two WCS instances.\n\n    The first WCS specified is the one used for the pixel -> world\n    transformation and the second WCS specified is the one used for the world ->\n    pixel transformation. The shape of the matrix is\n    ``(n_pixel_out, n_pixel_in)``.\n    ","endLoc":732,"header":"def _pixel_to_pixel_correlation_matrix(wcs_in, wcs_out)","id":8279,"name":"_pixel_to_pixel_correlation_matrix","nodeType":"Function","startLoc":690,"text":"def _pixel_to_pixel_correlation_matrix(wcs_in, wcs_out):\n    \"\"\"\n    Correlation matrix between the input and output pixel coordinates for a\n    pixel -> world -> pixel transformation specified by two WCS instances.\n\n    The first WCS specified is the one used for the pixel -> world\n    transformation and the second WCS specified is the one used for the world ->\n    pixel transformation. The shape of the matrix is\n    ``(n_pixel_out, n_pixel_in)``.\n    \"\"\"\n\n    matrix1, classes1 = _pixel_to_world_correlation_matrix(wcs_in)\n    matrix2, classes2 = _pixel_to_world_correlation_matrix(wcs_out)\n\n    if len(classes1) != len(classes2):\n        raise ValueError(\"The two WCS return a different number of world coordinates\")\n\n    # Check if classes match uniquely\n    unique_match = True\n    mapping = []\n    for class1 in classes1:\n        matches = classes2.count(class1)\n        if matches == 0:\n            raise ValueError(\"The world coordinate types of the two WCS do not match\")\n        elif matches > 1:\n            unique_match = False\n            break\n        else:\n            mapping.append(classes2.index(class1))\n\n    if unique_match:\n\n        # Classes are unique, so we need to re-order matrix2 along the world\n        # axis using the mapping we found above.\n        matrix2 = matrix2[mapping]\n\n    elif classes1 != classes2:\n\n        raise ValueError(\"World coordinate order doesn't match and automatic matching is ambiguous\")\n\n    matrix = np.matmul(matrix2.T, matrix1)\n\n    return matrix"},{"col":4,"comment":"null","endLoc":557,"header":"def __set__(self, instance, value)","id":8280,"name":"__set__","nodeType":"Function","startLoc":549,"text":"def __set__(self, instance, value):\n        # For Table columns do not set `info` when the instance is a scalar.\n        try:\n            if not instance.shape:\n                return\n        except AttributeError:\n            pass\n\n        super().__set__(instance, value)"},{"col":4,"comment":"\n        This is a mixin-safe version of Column.iter_str_vals.\n        ","endLoc":571,"header":"def iter_str_vals(self)","id":8281,"name":"iter_str_vals","nodeType":"Function","startLoc":559,"text":"def iter_str_vals(self):\n        \"\"\"\n        This is a mixin-safe version of Column.iter_str_vals.\n        \"\"\"\n        col = self._parent\n        if self.parent_table is None:\n            from astropy.table.column import FORMATTER as formatter\n        else:\n            formatter = self.parent_table.formatter\n\n        _pformat_col_iter = formatter._pformat_col_iter\n        for str_val in _pformat_col_iter(col, -1, False, False, {}):\n            yield str_val"},{"col":4,"comment":"null","endLoc":579,"header":"@property\n    def indices(self)","id":8282,"name":"indices","nodeType":"Function","startLoc":573,"text":"@property\n    def indices(self):\n        # Implementation note: the auto-generation as an InfoAttribute cannot\n        # be used here, since on access, one should not just return the\n        # default (empty list is this case), but set _attrs['indices'] so that\n        # if the list is appended to, it is registered here.\n        return self._attrs.setdefault('indices', [])"},{"col":4,"comment":"null","endLoc":583,"header":"@indices.setter\n    def indices(self, indices)","id":8283,"name":"indices","nodeType":"Function","startLoc":581,"text":"@indices.setter\n    def indices(self, indices):\n        self._attrs['indices'] = indices"},{"col":4,"comment":"\n        Adjust info indices after column modification.\n\n        Parameters\n        ----------\n        index : slice, int, list, or ndarray\n            Element(s) of column to modify. This parameter can\n            be a single row number, a list of row numbers, an\n            ndarray of row numbers, a boolean ndarray (a mask),\n            or a column slice.\n        value : int, list, or ndarray\n            New value(s) to insert\n        col_len : int\n            Length of the column\n        ","endLoc":621,"header":"def adjust_indices(self, index, value, col_len)","id":8284,"name":"adjust_indices","nodeType":"Function","startLoc":585,"text":"def adjust_indices(self, index, value, col_len):\n        '''\n        Adjust info indices after column modification.\n\n        Parameters\n        ----------\n        index : slice, int, list, or ndarray\n            Element(s) of column to modify. This parameter can\n            be a single row number, a list of row numbers, an\n            ndarray of row numbers, a boolean ndarray (a mask),\n            or a column slice.\n        value : int, list, or ndarray\n            New value(s) to insert\n        col_len : int\n            Length of the column\n        '''\n        if not self.indices:\n            return\n\n        if isinstance(index, slice):\n            # run through each key in slice\n            t = index.indices(col_len)\n            keys = list(range(*t))\n        elif isinstance(index, np.ndarray) and index.dtype.kind == 'b':\n            # boolean mask\n            keys = np.where(index)[0]\n        else:  # single int\n            keys = [index]\n\n        value = np.atleast_1d(value)  # turn array(x) into array([x])\n        if value.size == 1:\n            # repeat single value\n            value = list(value) * len(keys)\n\n        for key, val in zip(keys, value):\n            for col_index in self.indices:\n                col_index.replace(key, self.name, val)"},{"col":4,"comment":"\n        Given a sliced object, modify its indices\n        to correctly represent the slice.\n\n        Parameters\n        ----------\n        col_slice : `~astropy.table.Column` or mixin\n            Sliced object. If not a column, it must be a valid mixin, see\n            https://docs.astropy.org/en/stable/table/mixin_columns.html\n        item : slice, list, or ndarray\n            Slice used to create col_slice\n        col_len : int\n            Length of original object\n        ","endLoc":663,"header":"def slice_indices(self, col_slice, item, col_len)","id":8285,"name":"slice_indices","nodeType":"Function","startLoc":623,"text":"def slice_indices(self, col_slice, item, col_len):\n        '''\n        Given a sliced object, modify its indices\n        to correctly represent the slice.\n\n        Parameters\n        ----------\n        col_slice : `~astropy.table.Column` or mixin\n            Sliced object. If not a column, it must be a valid mixin, see\n            https://docs.astropy.org/en/stable/table/mixin_columns.html\n        item : slice, list, or ndarray\n            Slice used to create col_slice\n        col_len : int\n            Length of original object\n        '''\n        from astropy.table.sorted_array import SortedArray\n        if not getattr(self, '_copy_indices', True):\n            # Necessary because MaskedArray will perform a shallow copy\n            col_slice.info.indices = []\n            return col_slice\n        elif isinstance(item, slice):\n            col_slice.info.indices = [x[item] for x in self.indices]\n        elif self.indices:\n            if isinstance(item, np.ndarray) and item.dtype.kind == 'b':\n                # boolean mask\n                item = np.where(item)[0]\n            # Empirical testing suggests that recreating a BST/RBT index is\n            # more effective than relabelling when less than ~60% of\n            # the total number of rows are involved, and is in general\n            # more effective for SortedArray.\n            small = len(item) <= 0.6 * col_len\n            col_slice.info.indices = []\n            for index in self.indices:\n                if small or isinstance(index, SortedArray):\n                    new_index = index.get_slice(col_slice, item)\n                else:\n                    new_index = deepcopy(index)\n                    new_index.replace_rows(item)\n                col_slice.info.indices.append(new_index)\n\n        return col_slice"},{"col":0,"comment":"\n    Given an axis correlation matrix from a WCS object, return information about\n    the individual WCS that can be split out.\n\n    The output is a list of tuples, where each tuple contains a list of\n    pixel dimensions and a list of world dimensions that can be extracted to\n    form a new WCS. For example, in the case of a spectral cube with the first\n    two world coordinates being the celestial coordinates and the third\n    coordinate being an uncorrelated spectral axis, the matrix would look like::\n\n        array([[ True,  True, False],\n               [ True,  True, False],\n               [False, False,  True]])\n\n    and this function will return ``[([0, 1], [0, 1]), ([2], [2])]``.\n    ","endLoc":772,"header":"def _split_matrix(matrix)","id":8286,"name":"_split_matrix","nodeType":"Function","startLoc":735,"text":"def _split_matrix(matrix):\n    \"\"\"\n    Given an axis correlation matrix from a WCS object, return information about\n    the individual WCS that can be split out.\n\n    The output is a list of tuples, where each tuple contains a list of\n    pixel dimensions and a list of world dimensions that can be extracted to\n    form a new WCS. For example, in the case of a spectral cube with the first\n    two world coordinates being the celestial coordinates and the third\n    coordinate being an uncorrelated spectral axis, the matrix would look like::\n\n        array([[ True,  True, False],\n               [ True,  True, False],\n               [False, False,  True]])\n\n    and this function will return ``[([0, 1], [0, 1]), ([2], [2])]``.\n    \"\"\"\n\n    pixel_used = []\n\n    split_info = []\n\n    for ipix in range(matrix.shape[1]):\n        if ipix in pixel_used:\n            continue\n        pixel_include = np.zeros(matrix.shape[1], dtype=bool)\n        pixel_include[ipix] = True\n        n_pix_prev, n_pix = 0, 1\n        while n_pix > n_pix_prev:\n            world_include = matrix[:, pixel_include].any(axis=1)\n            pixel_include = matrix[world_include, :].any(axis=0)\n            n_pix_prev, n_pix = n_pix, np.sum(pixel_include)\n        pixel_indices = list(np.nonzero(pixel_include)[0])\n        world_indices = list(np.nonzero(world_include)[0])\n        pixel_used.extend(pixel_indices)\n        split_info.append((pixel_indices, world_indices))\n\n    return split_info"},{"col":4,"comment":"null","endLoc":25,"header":"def poll(self)","id":8287,"name":"poll","nodeType":"Function","startLoc":22,"text":"def poll(self):\n        while self.polling:\n            self.handle_queue()\n            time.sleep(0.1)"},{"col":4,"comment":"\n        Utility method to merge and validate the attributes ``attrs`` for the\n        input table columns ``cols``.\n\n        Note that ``dtype`` and ``shape`` attributes are handled specially.\n        These should not be passed in ``attrs`` but will always be in the\n        returned dict of merged attributes.\n\n        Parameters\n        ----------\n        cols : list\n            List of input Table column objects\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n        attrs : list\n            List of attribute names to be merged\n\n        Returns\n        -------\n        attrs : dict\n            Of merged attributes.\n\n        ","endLoc":722,"header":"@staticmethod\n    def merge_cols_attributes(cols, metadata_conflicts, name, attrs)","id":8288,"name":"merge_cols_attributes","nodeType":"Function","startLoc":665,"text":"@staticmethod\n    def merge_cols_attributes(cols, metadata_conflicts, name, attrs):\n        \"\"\"\n        Utility method to merge and validate the attributes ``attrs`` for the\n        input table columns ``cols``.\n\n        Note that ``dtype`` and ``shape`` attributes are handled specially.\n        These should not be passed in ``attrs`` but will always be in the\n        returned dict of merged attributes.\n\n        Parameters\n        ----------\n        cols : list\n            List of input Table column objects\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n        attrs : list\n            List of attribute names to be merged\n\n        Returns\n        -------\n        attrs : dict\n            Of merged attributes.\n\n        \"\"\"\n        from astropy.table.np_utils import TableMergeError\n\n        def warn_str_func(key, left, right):\n            out = (\"In merged column '{}' the '{}' attribute does not match \"\n                   \"({} != {}).  Using {} for merged output\"\n                   .format(name, key, left, right, right))\n            return out\n\n        def getattrs(col):\n            return {attr: getattr(col.info, attr) for attr in attrs\n                    if getattr(col.info, attr, None) is not None}\n\n        out = getattrs(cols[0])\n        for col in cols[1:]:\n            out = metadata.merge(out, getattrs(col), metadata_conflicts=metadata_conflicts,\n                                 warn_str_func=warn_str_func)\n\n        # Output dtype is the superset of all dtypes in in_cols\n        out['dtype'] = metadata.common_dtype(cols)\n\n        # Make sure all input shapes are the same\n        uniq_shapes = set(col.shape[1:] for col in cols)\n        if len(uniq_shapes) != 1:\n            raise TableMergeError('columns have different shapes')\n        out['shape'] = uniq_shapes.pop()\n\n        # \"Merged\" output name is the supplied name\n        if name is not None:\n            out['name'] = name\n\n        return out"},{"col":4,"comment":"null","endLoc":28,"header":"def stop(self)","id":8289,"name":"stop","nodeType":"Function","startLoc":27,"text":"def stop(self):\n        self.polling = False"},{"attributeType":"null","col":8,"comment":"null","endLoc":16,"id":8290,"name":"polling","nodeType":"Attribute","startLoc":16,"text":"self.polling"},{"className":"SAMPWebHubProxy","col":0,"comment":"\n    Proxy class to simplify the client interaction with a SAMP hub (via the web\n    profile).\n\n    In practice web clients should run from the browser, so this is provided as\n    a means of testing a hub's support for the web profile from Python.\n    ","endLoc":90,"id":8291,"nodeType":"Class","startLoc":31,"text":"class SAMPWebHubProxy(SAMPHubProxy):\n    \"\"\"\n    Proxy class to simplify the client interaction with a SAMP hub (via the web\n    profile).\n\n    In practice web clients should run from the browser, so this is provided as\n    a means of testing a hub's support for the web profile from Python.\n    \"\"\"\n\n    def connect(self, pool_size=20, web_port=21012):\n        \"\"\"\n        Connect to the current SAMP Hub on localhost:web_port\n\n        Parameters\n        ----------\n        pool_size : int, optional\n            The number of socket connections opened to communicate with the\n            Hub.\n        \"\"\"\n\n        self._connected = False\n\n        try:\n            self.proxy = ServerProxyPool(pool_size, xmlrpc.ServerProxy,\n                                         f'http://127.0.0.1:{web_port}',\n                                         allow_none=1)\n            self.ping()\n            self._connected = True\n        except xmlrpc.ProtocolError as p:\n            raise SAMPHubError(f\"Protocol Error {p.errcode}: {p.errmsg}\")\n\n    @property\n    def _samp_hub(self):\n        \"\"\"\n        Property to abstract away the path to the hub, which allows this class\n        to be used for both the standard and the web profile.\n        \"\"\"\n        return self.proxy.samp.webhub\n\n    def set_xmlrpc_callback(self, private_key, xmlrpc_addr):\n        raise NotImplementedError(\"set_xmlrpc_callback is not defined for the \"\n                                  \"web profile\")\n\n    def register(self, identity_info):\n        \"\"\"\n        Proxy to ``register`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.register(identity_info)\n\n    def allow_reverse_callbacks(self, private_key, allow):\n        \"\"\"\n        Proxy to ``allowReverseCallbacks`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.allowReverseCallbacks(private_key, allow)\n\n    def pull_callbacks(self, private_key, timeout):\n        \"\"\"\n        Proxy to ``pullCallbacks`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.pullCallbacks(private_key, timeout)"},{"col":4,"comment":"\n        Connect to the current SAMP Hub on localhost:web_port\n\n        Parameters\n        ----------\n        pool_size : int, optional\n            The number of socket connections opened to communicate with the\n            Hub.\n        ","endLoc":60,"header":"def connect(self, pool_size=20, web_port=21012)","id":8292,"name":"connect","nodeType":"Function","startLoc":40,"text":"def connect(self, pool_size=20, web_port=21012):\n        \"\"\"\n        Connect to the current SAMP Hub on localhost:web_port\n\n        Parameters\n        ----------\n        pool_size : int, optional\n            The number of socket connections opened to communicate with the\n            Hub.\n        \"\"\"\n\n        self._connected = False\n\n        try:\n            self.proxy = ServerProxyPool(pool_size, xmlrpc.ServerProxy,\n                                         f'http://127.0.0.1:{web_port}',\n                                         allow_none=1)\n            self.ping()\n            self._connected = True\n        except xmlrpc.ProtocolError as p:\n            raise SAMPHubError(f\"Protocol Error {p.errcode}: {p.errmsg}\")"},{"col":0,"comment":"\n    Use numpy to find the common dtype for a list of ndarrays.\n\n    Only allow arrays within the following fundamental numpy data types:\n    ``np.bool_``, ``np.object_``, ``np.number``, ``np.character``, ``np.void``\n\n    Parameters\n    ----------\n    arrs : list of ndarray\n        Arrays for which to find the common dtype\n\n    Returns\n    -------\n    dtype_str : str\n        String representation of dytpe (dtype ``str`` attribute)\n    ","endLoc":76,"header":"def common_dtype(arrs)","id":8294,"name":"common_dtype","nodeType":"Function","startLoc":36,"text":"def common_dtype(arrs):\n    \"\"\"\n    Use numpy to find the common dtype for a list of ndarrays.\n\n    Only allow arrays within the following fundamental numpy data types:\n    ``np.bool_``, ``np.object_``, ``np.number``, ``np.character``, ``np.void``\n\n    Parameters\n    ----------\n    arrs : list of ndarray\n        Arrays for which to find the common dtype\n\n    Returns\n    -------\n    dtype_str : str\n        String representation of dytpe (dtype ``str`` attribute)\n    \"\"\"\n    def dtype(arr):\n        return getattr(arr, 'dtype', np.dtype('O'))\n\n    np_types = (np.bool_, np.object_, np.number, np.character, np.void)\n    uniq_types = set(tuple(issubclass(dtype(arr).type, np_type) for np_type in np_types)\n                     for arr in arrs)\n    if len(uniq_types) > 1:\n        # Embed into the exception the actual list of incompatible types.\n        incompat_types = [dtype(arr).name for arr in arrs]\n        tme = MergeConflictError(f'Arrays have incompatible types {incompat_types}')\n        tme._incompat_types = incompat_types\n        raise tme\n\n    arrs = [np.empty(1, dtype=dtype(arr)) for arr in arrs]\n\n    # For string-type arrays need to explicitly fill in non-zero\n    # values or the final arr_common = .. step is unpredictable.\n    for i, arr in enumerate(arrs):\n        if arr.dtype.kind in ('S', 'U'):\n            arrs[i] = [('0' if arr.dtype.kind == 'U' else b'0') *\n                       dtype_bytes_or_chars(arr.dtype)]\n\n    arr_common = np.array([arr[0] for arr in arrs])\n    return arr_common.dtype.str"},{"col":4,"comment":"\n        Property to abstract away the path to the hub, which allows this class\n        to be used for both the standard and the web profile.\n        ","endLoc":68,"header":"@property\n    def _samp_hub(self)","id":8296,"name":"_samp_hub","nodeType":"Function","startLoc":62,"text":"@property\n    def _samp_hub(self):\n        \"\"\"\n        Property to abstract away the path to the hub, which allows this class\n        to be used for both the standard and the web profile.\n        \"\"\"\n        return self.proxy.samp.webhub"},{"col":4,"comment":"null","endLoc":72,"header":"def set_xmlrpc_callback(self, private_key, xmlrpc_addr)","id":8297,"name":"set_xmlrpc_callback","nodeType":"Function","startLoc":70,"text":"def set_xmlrpc_callback(self, private_key, xmlrpc_addr):\n        raise NotImplementedError(\"set_xmlrpc_callback is not defined for the \"\n                                  \"web profile\")"},{"col":4,"comment":"\n        Proxy to ``register`` SAMP Hub method.\n        ","endLoc":78,"header":"def register(self, identity_info)","id":8298,"name":"register","nodeType":"Function","startLoc":74,"text":"def register(self, identity_info):\n        \"\"\"\n        Proxy to ``register`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.register(identity_info)"},{"col":4,"comment":"\n        Proxy to ``allowReverseCallbacks`` SAMP Hub method.\n        ","endLoc":84,"header":"def allow_reverse_callbacks(self, private_key, allow)","id":8299,"name":"allow_reverse_callbacks","nodeType":"Function","startLoc":80,"text":"def allow_reverse_callbacks(self, private_key, allow):\n        \"\"\"\n        Proxy to ``allowReverseCallbacks`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.allowReverseCallbacks(private_key, allow)"},{"col":4,"comment":"\n        Proxy to ``pullCallbacks`` SAMP Hub method.\n        ","endLoc":90,"header":"def pull_callbacks(self, private_key, timeout)","id":8300,"name":"pull_callbacks","nodeType":"Function","startLoc":86,"text":"def pull_callbacks(self, private_key, timeout):\n        \"\"\"\n        Proxy to ``pullCallbacks`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.pullCallbacks(private_key, timeout)"},{"attributeType":"null","col":8,"comment":"null","endLoc":51,"id":8301,"name":"_connected","nodeType":"Attribute","startLoc":51,"text":"self._connected"},{"attributeType":"ServerProxyPool","col":12,"comment":"null","endLoc":54,"id":8302,"name":"proxy","nodeType":"Attribute","startLoc":54,"text":"self.proxy"},{"className":"SAMPWebClient","col":0,"comment":"\n    Utility class which provides facilities to create and manage a SAMP\n    compliant XML-RPC server that acts as SAMP callable web client application.\n\n    In practice web clients should run from the browser, so this is provided as\n    a means of testing a hub's support for the web profile from Python.\n\n    Parameters\n    ----------\n    hub : :class:`~astropy.samp.hub_proxy.SAMPWebHubProxy`\n        An instance of :class:`~astropy.samp.hub_proxy.SAMPWebHubProxy` to\n        be used for messaging with the SAMP Hub.\n\n    name : str, optional\n        Client name (corresponding to ``samp.name`` metadata keyword).\n\n    description : str, optional\n        Client description (corresponding to ``samp.description.text`` metadata\n        keyword).\n\n    metadata : dict, optional\n        Client application metadata in the standard SAMP format.\n\n    callable : bool, optional\n        Whether the client can receive calls and notifications. If set to\n        `False`, then the client can send notifications and calls, but can not\n        receive any.\n    ","endLoc":228,"id":8303,"nodeType":"Class","startLoc":93,"text":"class SAMPWebClient(SAMPClient):\n    \"\"\"\n    Utility class which provides facilities to create and manage a SAMP\n    compliant XML-RPC server that acts as SAMP callable web client application.\n\n    In practice web clients should run from the browser, so this is provided as\n    a means of testing a hub's support for the web profile from Python.\n\n    Parameters\n    ----------\n    hub : :class:`~astropy.samp.hub_proxy.SAMPWebHubProxy`\n        An instance of :class:`~astropy.samp.hub_proxy.SAMPWebHubProxy` to\n        be used for messaging with the SAMP Hub.\n\n    name : str, optional\n        Client name (corresponding to ``samp.name`` metadata keyword).\n\n    description : str, optional\n        Client description (corresponding to ``samp.description.text`` metadata\n        keyword).\n\n    metadata : dict, optional\n        Client application metadata in the standard SAMP format.\n\n    callable : bool, optional\n        Whether the client can receive calls and notifications. If set to\n        `False`, then the client can send notifications and calls, but can not\n        receive any.\n    \"\"\"\n\n    def __init__(self, hub, name=None, description=None, metadata=None,\n                 callable=True):\n\n        # GENERAL\n        self._is_running = False\n        self._is_registered = False\n\n        if metadata is None:\n            metadata = {}\n\n        if name is not None:\n            metadata[\"samp.name\"] = name\n\n        if description is not None:\n            metadata[\"samp.description.text\"] = description\n\n        self._metadata = metadata\n\n        self._callable = callable\n\n        # HUB INTERACTION\n        self.client = None\n        self._public_id = None\n        self._private_key = None\n        self._hub_id = None\n        self._notification_bindings = {}\n        self._call_bindings = {\"samp.app.ping\": [self._ping, {}],\n                               \"client.env.get\": [self._client_env_get, {}]}\n        self._response_bindings = {}\n\n        self.hub = hub\n\n        self._registration_lock = threading.Lock()\n        self._registered_event = threading.Event()\n        if self._callable:\n            self._thread = threading.Thread(target=self._serve_forever)\n            self._thread.daemon = True\n\n    def _serve_forever(self):\n        while self.is_running:\n            # Wait until we are actually registered before trying to do\n            # anything, to avoid busy looping\n            # Watch for callbacks here\n            self._registered_event.wait()\n            with self._registration_lock:\n                if not self._is_registered:\n                    return\n\n                results = self.hub.pull_callbacks(self.get_private_key(), 0)\n                for result in results:\n                    if result['samp.methodName'] == 'receiveNotification':\n                        self.receive_notification(self._private_key,\n                                                  *result['samp.params'])\n                    elif result['samp.methodName'] == 'receiveCall':\n                        self.receive_call(self._private_key,\n                                          *result['samp.params'])\n                    elif result['samp.methodName'] == 'receiveResponse':\n                        self.receive_response(self._private_key,\n                                              *result['samp.params'])\n\n        self.hub.disconnect()\n\n    def register(self):\n        \"\"\"\n        Register the client to the SAMP Hub.\n        \"\"\"\n        if self.hub.is_connected:\n\n            if self._private_key is not None:\n                raise SAMPClientError(\"Client already registered\")\n\n            result = self.hub.register(\"Astropy SAMP Web Client\")\n\n            if result[\"samp.self-id\"] == \"\":\n                raise SAMPClientError(\"Registation failed - samp.self-id \"\n                                      \"was not set by the hub.\")\n\n            if result[\"samp.private-key\"] == \"\":\n                raise SAMPClientError(\"Registation failed - samp.private-key \"\n                                      \"was not set by the hub.\")\n\n            self._public_id = result[\"samp.self-id\"]\n            self._private_key = result[\"samp.private-key\"]\n            self._hub_id = result[\"samp.hub-id\"]\n\n            if self._callable:\n                self._declare_subscriptions()\n                self.hub.allow_reverse_callbacks(self._private_key, True)\n\n            if self._metadata != {}:\n                self.declare_metadata()\n\n            self._is_registered = True\n            # Let the client thread proceed\n            self._registered_event.set()\n\n        else:\n            raise SAMPClientError(\"Unable to register to the SAMP Hub. Hub \"\n                                  \"proxy not connected.\")\n\n    def unregister(self):\n        # We have to hold the registration lock if the client is callable\n        # to avoid a race condition where the client queries the hub for\n        # pushCallbacks after it has already been unregistered from the hub\n        with self._registration_lock:\n            super().unregister()"},{"col":4,"comment":"null","endLoc":159,"header":"def __init__(self, hub, name=None, description=None, metadata=None,\n                 callable=True)","id":8304,"name":"__init__","nodeType":"Function","startLoc":123,"text":"def __init__(self, hub, name=None, description=None, metadata=None,\n                 callable=True):\n\n        # GENERAL\n        self._is_running = False\n        self._is_registered = False\n\n        if metadata is None:\n            metadata = {}\n\n        if name is not None:\n            metadata[\"samp.name\"] = name\n\n        if description is not None:\n            metadata[\"samp.description.text\"] = description\n\n        self._metadata = metadata\n\n        self._callable = callable\n\n        # HUB INTERACTION\n        self.client = None\n        self._public_id = None\n        self._private_key = None\n        self._hub_id = None\n        self._notification_bindings = {}\n        self._call_bindings = {\"samp.app.ping\": [self._ping, {}],\n                               \"client.env.get\": [self._client_env_get, {}]}\n        self._response_bindings = {}\n\n        self.hub = hub\n\n        self._registration_lock = threading.Lock()\n        self._registered_event = threading.Event()\n        if self._callable:\n            self._thread = threading.Thread(target=self._serve_forever)\n            self._thread.daemon = True"},{"col":4,"comment":"\n        Return a list of arrays which can be lexically sorted to represent\n        the order of the parent column.\n\n        The base method raises NotImplementedError and must be overridden.\n\n        Returns\n        -------\n        arrays : list of ndarray\n        ","endLoc":735,"header":"def get_sortable_arrays(self)","id":8305,"name":"get_sortable_arrays","nodeType":"Function","startLoc":724,"text":"def get_sortable_arrays(self):\n        \"\"\"\n        Return a list of arrays which can be lexically sorted to represent\n        the order of the parent column.\n\n        The base method raises NotImplementedError and must be overridden.\n\n        Returns\n        -------\n        arrays : list of ndarray\n        \"\"\"\n        raise NotImplementedError(f'column {self.name} is not sortable')"},{"attributeType":"null","col":4,"comment":"null","endLoc":514,"id":8306,"name":"attr_names","nodeType":"Attribute","startLoc":514,"text":"attr_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":515,"id":8307,"name":"_attrs_no_copy","nodeType":"Attribute","startLoc":515,"text":"_attrs_no_copy"},{"attributeType":"null","col":4,"comment":"null","endLoc":523,"id":8308,"name":"_serialize_context","nodeType":"Attribute","startLoc":523,"text":"_serialize_context"},{"attributeType":"null","col":4,"comment":"null","endLoc":524,"id":8309,"name":"__slots__","nodeType":"Attribute","startLoc":524,"text":"__slots__"},{"attributeType":"null","col":12,"comment":"null","endLoc":547,"id":8310,"name":"_format_funcs","nodeType":"Attribute","startLoc":547,"text":"self._format_funcs"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":8311,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"hub_script.py#<anonymous>","id":8312,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['hub_script']"},{"col":4,"comment":"null","endLoc":742,"header":"@property\n    def name(self)","id":8313,"name":"name","nodeType":"Function","startLoc":740,"text":"@property\n    def name(self):\n        return self._attrs.get('name')"},{"col":4,"comment":"null","endLoc":753,"header":"@name.setter\n    def name(self, name)","id":8314,"name":"name","nodeType":"Function","startLoc":744,"text":"@name.setter\n    def name(self, name):\n        # For mixin columns that live within a table, rename the column in the\n        # table when setting the name attribute.  This mirrors the same\n        # functionality in the BaseColumn class.\n        if self.parent_table is not None:\n            new_name = None if name is None else str(name)\n            self.parent_table.columns._rename_column(self.name, new_name)\n\n        self._attrs['name'] = name"},{"id":8315,"name":"astropy/time/src","nodeType":"Package"},{"id":8316,"name":"parse_times.c","nodeType":"TextFile","path":"astropy/time/src","text":"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\n#include \"Python.h\"\n#include \"numpy/arrayobject.h\"\n#include \"numpy/ufuncobject.h\"\n#include <stdio.h>\n#include <string.h>\n\n#define MODULE_DOCSTRING \\\n    \"Fast time parsers.\\n\\n\" \\\n    \"This module allows one to create gufuncs that vectorize the parsing of\\n\" \\\n    \"standard time strings.\"\n#define CREATE_PARSER_DOCSTRING \\\n    \"create_parser()\\n\\n\" \\\n    \"Create a gufunc that helps parse strings according to the given parameters.\\n\\n\" \\\n    \"Parameters\\n\" \\\n    \"----------\\n\" \\\n    \"pars : ~numpy.ndarray\\n\" \\\n    \"    Should be structured array with delim, start, stop, break_allowed for each\\n\" \\\n    \"    of year, month, day, hour, minute, integer second, fractional second.\\n\\n\" \\\n    \"Returns\\n\" \\\n    \"-------\\n\" \\\n    \"parser : `~numpy.ufunc`\\n\" \\\n    \"    Suitable for use by `~astropy.time.TimeString` formats.\"\n\n\n// ASCII codes for '0' and '9'\nconst char char_zero = 48;\nconst char char_nine = 57;\n\nint parse_int_from_char_array(char *chars, int str_len,\n                              char delim, int idx0, int idx1,\n                              int *val)\n// Parse integer from positions idx0:idx1 (inclusive) within chars, optionally\n// starting with a delimiter.\n//\n// Example: \"2020-01-24\"\n//                  ^^^\n//           0123456789\n//\n// int day, status;\n// status = parse_int_from_char_array(\"2020-01-24\", 10, '-', 7, 9, &day);\n//\n// Inputs:\n//  char *chars: time string\n//  int str_len: length of *chars string\n//  char delim: optional character at position idx0 when delim > 0\n//  int idx0: start index for parsing integer\n//  int idx1: stop index (inclusive) for parsing integer\n//\n// Output:\n//  int *val: output value\n//\n// Returns:\n//  int status:\n//    0: OK\n//    1: String ends at the beginning of requested value\n//    2: String ends in the middle of requested value\n//    3: Required delimiter character not found\n//    4: Non-digit found where digit (0-9) required\n{\n    int mult = 1;\n    char digit;\n    char ch;\n    int ii;\n\n    // Check if string ends (has 0x00) before str_len. Require that this segment\n    // of the string is entirely contained in the string (idx1 < str_len),\n    // remembering that idx1 is inclusive and counts from 0.\n    if (idx1 < str_len) {\n        for (ii = idx0; ii <= idx1; ii++) {\n            if (chars[ii] == 0) {\n                str_len = ii;\n                break;\n            }\n        }\n    }\n    // String ends before the beginning of requested value,\n    // e.g. \"2000-01\" (str_len=7) for day (idx0=7). This is OK in some\n    // cases, e.g. before hour (2000-01-01).\n    if (idx0 >= str_len) {\n        return 1;\n    }\n\n    // String ends in the middle of requested value. This implies a badly\n    // formatted time.\n    if (idx1 >= str_len) {\n        return 2;\n    }\n\n    // Look for optional delimiter character, e.g. ':' before minute. If delim == 0\n    // then no character is required.\n    if (delim > 0) {\n        // Required start character not found.\n        if (chars[idx0] != delim) {\n            return 3;\n        }\n        idx0 += 1;\n    }\n\n    // Build up the value using reversed digits\n    *val = 0;\n    for (ii = idx1; ii >= idx0; ii--)\n    {\n        ch = chars[ii];\n        if (ch < char_zero || ch > char_nine) {\n            // Not a digit, implying badly formatted time.\n            return 4;\n        }\n        digit = ch - char_zero;\n        *val += digit * mult;\n        mult *= 10;\n    }\n\n    return 0;\n}\n\nint parse_frac_from_char_array(char *chars, int str_len, char delim, int idx0,\n                               double *val)\n// Parse trailing fraction starting from position idx0 in chars.\n//\n// Example: \"2020-01-24T12:13:14.5556\"\n//                              ^^^^^\n//           012345678901234567890123\n//\n// int status;\n// float frac;\n// status = parse_frac_from_char_array(\"2020-01-24T12:13:14.5556\", 24, '.', 19, &frac);\n//\n// Inputs:\n//  char *chars: time string\n//  int str_len: length of *chars string\n//  char delim: optional character at position idx0 when delim > 0\n//  int idx0: start index for parsing integer\n//\n// Output:\n//  double *val: output value\n//\n// Returns:\n//  int status:\n//    0: OK\n//    1: String ends at the beginning of requested value\n//    3: Required delimiter character not found\n//    4: Non-digit found where digit (0-9) required\n{\n    double mult = 0.1;\n    char digit;\n    char ch;\n    int ii;\n\n    *val = 0.0;\n\n    // String ends at exactly before the beginning of requested fraction.\n    // e.g. \"2000-01-01 12:13:14\". Fraction value is zero.\n    if (idx0 == str_len) {\n        return 1;\n    }\n\n    // Look for optional delimiter character, e.g. '.' before fraction. If delim == 0\n    // then no character is required. This can happen for unusual formats like\n    // Chandra GRETA time yyyyddd.hhmmssfff.\n    if (delim > 0) {\n        // Required start character not found.\n        if (chars[idx0] != delim) {\n            return 3;\n        }\n        idx0 += 1;\n    }\n\n    for (ii = idx0; ii < str_len; ii++)\n    {\n        ch = chars[ii];\n        if (ch < char_zero || ch > char_nine) {\n            // Not a digit, implying badly formatted time.\n            return 4;\n        }\n        digit = ch - char_zero;\n        *val += digit * mult;\n        mult /= 10.0;\n    }\n    return 0;\n}\n\nstatic inline int is_leap_year (int year)\n// Determine if year is a leap year.\n// Inspired by from https://stackoverflow.com/questions/17634282\n{\n  return ((year & 3) == 0)\n          && ((year % 100 != 0)\n              || (((year / 100) & 3) == 0));\n}\n\nint convert_day_of_year_to_month_day(int year, int day_of_year, int *month, int *day_of_month)\n// Convert year and day_of_year into month, day_of_month\n// Inspired by from https://stackoverflow.com/questions/17634282, determine\n{\n    int leap_year = is_leap_year(year) ? 1 : 0;\n    int days_in_year = leap_year ? 366 : 365;\n    const unsigned short int _mon_yday_normal[13] =\n        { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };\n    const unsigned short int _mon_yday_leap[13] =\n        { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 };\n    const unsigned short int *mon_yday = leap_year ? _mon_yday_leap :_mon_yday_normal;\n    int mon;\n\n    if (day_of_year < 1 || day_of_year > days_in_year) {\n        // Error in day_of_year\n        return 5;\n    }\n\n    for (mon = 1; mon <= 12; mon++) {\n        if (day_of_year <= mon_yday[mon]) {\n            *month = mon;\n            *day_of_month = day_of_year - mon_yday[mon - 1];\n            break;\n        }\n    }\n\n    return 0;\n}\n\n\nstatic void\nparser_loop(char **args, const npy_intp *dimensions, const npy_intp *steps, void *data)\n{\n    // Interpret gufunc loop arguments.\n    // Number of input strings to convert.\n    npy_intp n = dimensions[0];\n    // Maximum number of characters (from gufunc signature '(max_str_len)->()').\n    npy_intp max_str_len = dimensions[1];\n    // Pointer to start of input array (always char, as needed in this case).\n    char *time = args[0];\n    // Pointer to start of output array (as char, recast to time_struct_t later).\n    char *tm_ptr = args[1];\n    // Step size for input (max_str_len if contiguous).\n    npy_intp i_time = steps[0];\n    // Step size for output (sizeof(time_struct_t) if contiguous).\n    npy_intp i_tm = steps[1];\n    // Parser information: a 7-element struct with for each of year, month,\n    // day, hour, minute, second_int, and second_frac, the delimiter (if any)\n    // that starts it, start and stop index of the relevant part of the\n    // string, and whether a break is allowed before this item.\n    // E.g., for ISO times \"2000-01-12 13:14:15.678\"\n    //                      01234567890123456789012\n    // the fourth entry for minutes will have pars[4].delim = ':',\n    // pars[4].start=13, pars[4].stop=15, and pars[4].break_allowed = True.\n    struct pars_struct_t {\n        char delim;\n        int start;\n        int stop;\n        npy_bool break_allowed;\n    };\n    struct pars_struct_t *fast_parser_pars = (struct pars_struct_t *)data;\n    npy_bool has_day_of_year = fast_parser_pars[1].start < 0;\n\n    // Output time information, in a struct that matches the output dtype.\n    // The results of parsing each of the pieces will be stored here,\n    // except that integer and fraction of seconds are added together.\n    struct time_struct_t {\n        int year;\n        int month;\n        int day;\n        int hour;\n        int minute;\n        double second;\n    };\n\n    static char *msgs[5] = {\n        \"time string ends at beginning of component where break is not allowed\",\n        \"time string ends in middle of component\",\n        \"required delimiter character not found\",\n        \"non-digit found where digit (0-9) required\",\n        \"bad day of year (1 <= doy <= 365 or 366 for leap year\"};\n\n    npy_intp ii;\n    int status;\n\n    // Loop over strings, updating pointers to next input and output element.\n    for (ii = 0; ii < n; ii++, time+=i_time, tm_ptr+=i_tm)\n    {\n        // Cast pointer to current output from char to the actual pointer\n        // type, of time struct.\n        struct time_struct_t *tm = (struct time_struct_t *)tm_ptr;\n        int second_int = 0;\n        double second_frac = 0.;\n\n        // Copy pointer so we can increment as we go.\n        struct pars_struct_t *pars = fast_parser_pars;\n        int i, str_len;\n\n        // Initialize default values.\n        tm->month = 1;\n        tm->day = 1;\n        tm->hour = 0;\n        tm->minute = 0;\n        tm->second = 0.0;\n\n        // Check for null termination before max_str_len.\n        str_len = max_str_len;\n        for (i = 0; i < max_str_len; i++) {\n            if (time[i] == 0) {\n                str_len = i;\n                break;\n            }\n        }\n\n        // Get each time component: year, month, day, hour, minute, isec, frac\n        status = parse_int_from_char_array(time, str_len, pars->delim, pars->start, pars->stop, &tm->year);\n        if (status) {\n            if (status == 1 && pars->break_allowed) { continue; }\n            else { goto error; }\n        }\n\n        pars++;\n        // Optionally parse month\n        if (!has_day_of_year) {\n            status = parse_int_from_char_array(time, str_len, pars->delim, pars->start, pars->stop, &tm->month);\n            if (status) {\n                if (status == 1 && pars->break_allowed) { continue; }\n                else { goto error; }\n            }\n        }\n\n        pars++;\n        // This might be day-of-month or day-of-year\n        status = parse_int_from_char_array(time, str_len, pars->delim, pars->start, pars->stop, &tm->day);\n        if (status) {\n            if (status == 1 && pars->break_allowed) { continue; }\n            else { goto error; }\n        }\n\n        if (has_day_of_year) {\n            // day contains day of year at this point, but convert it to day of month\n            status = convert_day_of_year_to_month_day(tm->year, tm->day, &tm->month, &tm->day);\n            if (status) { goto error; }\n        }\n\n        pars++;\n        status = parse_int_from_char_array(time, str_len, pars->delim, pars->start, pars->stop, &tm->hour);\n        if (status) {\n            if (status == 1 && pars->break_allowed) { continue; }\n            else { goto error; }\n        }\n\n        pars++;\n        status = parse_int_from_char_array(time, str_len, pars->delim, pars->start, pars->stop, &tm->minute);\n        if (status) {\n            if (status == 1 && pars->break_allowed) { continue; }\n            else { goto error; }\n        }\n\n        pars++;\n        // second comes in integer and fractional part.\n        status = parse_int_from_char_array(time, str_len, pars->delim, pars->start, pars->stop, &second_int);\n        if (status) {\n            if (status == 1 && pars->break_allowed) { continue; }\n            else { goto error; }\n        }\n\n        pars++;\n        status = parse_frac_from_char_array(time, str_len, pars->delim, pars->start, &second_frac);\n        if (status && (status != 1 || !pars->break_allowed)) {\n            goto error;\n        }\n        tm->second = (double)second_int + second_frac;\n\n    }\n    return;\n\n  error:\n    PyErr_Format(PyExc_ValueError,\n                 \"fast C time string parser failed: %s\", msgs[status-1]);\n    return;\n}\n\n\n/* Create a gufunc parser */\n\nstatic PyArray_Descr *dt_pars = NULL;   /* Set in PyInit_ufunc */\nstatic PyArray_Descr *gufunc_dtypes[2];\n\n\nstatic PyObject *\ncreate_parser(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds)\n{\n    /* Input arguments */\n    char *kw_list[] = {\"pars\", \"name\", \"doc\", NULL};\n    PyObject *pars;\n    char *name=NULL, *doc=NULL;\n    /* Output */\n    PyUFuncObject *gufunc=NULL;\n\n    PyArrayObject *pars_array;\n    int status;\n\n    if (!PyArg_ParseTupleAndKeywords(args, kwds, \"O|ss\", kw_list,\n                                     &pars, &name, &doc)) {\n        return NULL;\n    }\n    if (name == NULL) {\n        name = \"fast_parser\";\n    }\n    Py_INCREF(dt_pars);\n    pars_array = (PyArrayObject *)PyArray_FromAny(pars, dt_pars, 1, 1,\n                     (NPY_ARRAY_CARRAY | NPY_ARRAY_ENSURECOPY), NULL);\n    if (pars_array == NULL) {\n        return NULL;\n    }\n    if (PyArray_SIZE(pars_array) != 7) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"Parameter array must have 7 entries\"\n                        \"(year, month, day, hour, minute, integer second, fraction)\");\n    }\n\n    gufunc = (PyUFuncObject *)PyUFunc_FromFuncAndDataAndSignature(\n        NULL, NULL, NULL, 0, 1, 1, PyUFunc_None, name, doc, 0, \"(n)->()\");\n    if (gufunc == NULL) {\n        goto fail;\n    }\n    status = PyUFunc_RegisterLoopForDescr(\n        gufunc, gufunc_dtypes[0], parser_loop, gufunc_dtypes, PyArray_DATA(pars_array));\n    if (status != 0) {\n        goto fail;\n    }\n    /*\n     * We need to keep array around, as this has the required information, but\n     * it should be deallocated when the ufunc is deleted. Use ->obj for this\n     * (also used in frompyfunc).\n     */\n    gufunc->obj = (PyObject *)pars_array;\n    return (PyObject *)gufunc;\n\n  fail:\n    Py_XDECREF(pars_array);\n    Py_XDECREF(gufunc);\n    return NULL;\n}\n\n\nstatic PyMethodDef parse_times_methods[] = {\n    {\"create_parser\", (PyCFunction)create_parser,\n         METH_VARARGS | METH_KEYWORDS, CREATE_PARSER_DOCSTRING},\n    {NULL, NULL, 0, NULL}        /* Sentinel */\n};\n\nstatic struct PyModuleDef moduledef = {\n        PyModuleDef_HEAD_INIT,\n        \"parse_times\",\n        MODULE_DOCSTRING,\n        -1,\n        parse_times_methods,\n        NULL,\n        NULL,\n        NULL,\n        NULL\n};\n\n/* Initialization function for the module */\nPyMODINIT_FUNC PyInit__parse_times(void) {\n    PyObject *m;\n    PyObject *d;\n    PyObject *dtype_def;\n    PyArray_Descr *dt_u1 = NULL, *dt_ymdhms = NULL;\n\n    m = PyModule_Create(&moduledef);\n    if (m == NULL) {\n        return NULL;\n    }\n    import_array();\n    import_ufunc();\n\n    d = PyModule_GetDict(m);\n\n    /* parameter and output dtypes */\n    dtype_def = Py_BuildValue(\n        \"[(s, s), (s, s), (s, s), (s, s)]\",\n        \"delim\", \"S1\",\n        \"start\", \"i4\",\n        \"stop\", \"i4\",\n        \"break_allowed\", \"?\");\n    PyArray_DescrAlignConverter(dtype_def, &dt_pars);\n    Py_DECREF(dtype_def);\n\n    dtype_def = Py_BuildValue(\"[(s, s)]\", \"byte\", \"u1\");\n    PyArray_DescrAlignConverter(dtype_def, &dt_u1);\n    Py_DECREF(dtype_def);\n\n    dtype_def = Py_BuildValue(\n        \"[(s, s), (s, s), (s, s), (s, s), (s, s), (s, s)]\",\n        \"year\", \"i4\",\n        \"month\", \"i4\",\n        \"day\", \"i4\",\n        \"hour\", \"i4\",\n        \"minute\", \"i4\",\n        \"second\", \"f8\");\n    PyArray_DescrAlignConverter(dtype_def, &dt_ymdhms);\n    Py_DECREF(dtype_def);\n    if (dt_pars == NULL || dt_u1 == NULL || dt_ymdhms == NULL) {\n        goto fail;\n    }\n    PyDict_SetItemString(d, \"dt_pars\", (PyObject *)dt_pars);\n    PyDict_SetItemString(d, \"dt_u1\", (PyObject *)dt_u1);\n    PyDict_SetItemString(d, \"dt_ymdhms\", (PyObject *)dt_ymdhms);\n\n    gufunc_dtypes[0] = dt_u1;\n    gufunc_dtypes[1] = dt_ymdhms;\n\n    goto decref;\n\n  fail:\n    Py_XDECREF(m);\n    m = NULL;\n\n  decref:\n    Py_XDECREF(dt_pars);\n    Py_XDECREF(dt_u1);\n    Py_XDECREF(dt_ymdhms);\n    return m;\n}\n"},{"col":4,"comment":"null","endLoc":183,"header":"def _serve_forever(self)","id":8317,"name":"_serve_forever","nodeType":"Function","startLoc":161,"text":"def _serve_forever(self):\n        while self.is_running:\n            # Wait until we are actually registered before trying to do\n            # anything, to avoid busy looping\n            # Watch for callbacks here\n            self._registered_event.wait()\n            with self._registration_lock:\n                if not self._is_registered:\n                    return\n\n                results = self.hub.pull_callbacks(self.get_private_key(), 0)\n                for result in results:\n                    if result['samp.methodName'] == 'receiveNotification':\n                        self.receive_notification(self._private_key,\n                                                  *result['samp.params'])\n                    elif result['samp.methodName'] == 'receiveCall':\n                        self.receive_call(self._private_key,\n                                          *result['samp.params'])\n                    elif result['samp.methodName'] == 'receiveResponse':\n                        self.receive_response(self._private_key,\n                                              *result['samp.params'])\n\n        self.hub.disconnect()"},{"col":0,"comment":"\n    Factory to create a function that can be used as an ``option``\n    for outputting data object summary information.\n\n    Examples\n    --------\n    >>> from astropy.utils.data_info import data_info_factory\n    >>> from astropy.table import Column\n    >>> c = Column([4., 3., 2., 1.])\n    >>> mystats = data_info_factory(names=['min', 'median', 'max'],\n    ...                             funcs=[np.min, np.median, np.max])\n    >>> c.info(option=mystats)\n    min = 1\n    median = 2.5\n    max = 4\n    n_bad = 0\n    length = 4\n\n    Parameters\n    ----------\n    names : list\n        List of information attribute names\n    funcs : list\n        List of functions that compute the corresponding information attribute\n\n    Returns\n    -------\n    func : function\n        Function that can be used as a data info option\n    ","endLoc":149,"header":"def data_info_factory(names, funcs)","id":8318,"name":"data_info_factory","nodeType":"Function","startLoc":101,"text":"def data_info_factory(names, funcs):\n    \"\"\"\n    Factory to create a function that can be used as an ``option``\n    for outputting data object summary information.\n\n    Examples\n    --------\n    >>> from astropy.utils.data_info import data_info_factory\n    >>> from astropy.table import Column\n    >>> c = Column([4., 3., 2., 1.])\n    >>> mystats = data_info_factory(names=['min', 'median', 'max'],\n    ...                             funcs=[np.min, np.median, np.max])\n    >>> c.info(option=mystats)\n    min = 1\n    median = 2.5\n    max = 4\n    n_bad = 0\n    length = 4\n\n    Parameters\n    ----------\n    names : list\n        List of information attribute names\n    funcs : list\n        List of functions that compute the corresponding information attribute\n\n    Returns\n    -------\n    func : function\n        Function that can be used as a data info option\n    \"\"\"\n    def func(dat):\n        outs = []\n        for name, func in zip(names, funcs):\n            try:\n                if isinstance(func, str):\n                    out = getattr(dat, func)()\n                else:\n                    out = func(dat)\n            except Exception:\n                outs.append('--')\n            else:\n                try:\n                    outs.append(f'{out:g}')\n                except (TypeError, ValueError):\n                    outs.append(str(out))\n\n        return OrderedDict(zip(names, outs))\n    return func"},{"id":8319,"name":"astropy/time/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/time/tests","id":8320,"nodeType":"File","text":""},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":8321,"name":"TIME_FORMATS","nodeType":"Attribute","startLoc":39,"text":"TIME_FORMATS"},{"attributeType":"null","col":0,"comment":"null","endLoc":40,"id":8322,"name":"TIME_DELTA_FORMATS","nodeType":"Attribute","startLoc":40,"text":"TIME_DELTA_FORMATS"},{"className":"TimeJD","col":0,"comment":"\n    Julian Date time format.\n    This represents the number of days since the beginning of\n    the Julian Period.\n    For example, 2451544.5 in JD is midnight on January 1, 2000.\n    ","endLoc":488,"id":8323,"nodeType":"Class","startLoc":477,"text":"class TimeJD(TimeNumeric):\n    \"\"\"\n    Julian Date time format.\n    This represents the number of days since the beginning of\n    the Julian Period.\n    For example, 2451544.5 in JD is midnight on January 1, 2000.\n    \"\"\"\n    name = 'jd'\n\n    def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # Validate scale.\n        self.jd1, self.jd2 = day_frac(val1, val2)"},{"className":"TimeNumeric","col":0,"comment":"null","endLoc":474,"id":8324,"nodeType":"Class","startLoc":398,"text":"class TimeNumeric(TimeFormat):\n    subfmts = (\n        ('float', np.float64, None, np.add),\n        ('long', np.longdouble, utils.longdouble_to_twoval,\n         utils.twoval_to_longdouble),\n        ('decimal', np.object_, utils.decimal_to_twoval,\n         utils.twoval_to_decimal),\n        ('str', np.str_, utils.decimal_to_twoval, utils.twoval_to_string),\n        ('bytes', np.bytes_, utils.bytes_to_twoval, utils.twoval_to_bytes),\n    )\n\n    def _check_val_type(self, val1, val2):\n        \"\"\"Input value validation, typically overridden by derived classes\"\"\"\n        # Save original state of val2 because the super()._check_val_type below\n        # may change val2 from None to np.array(0). The value is saved in order\n        # to prevent a useless and slow call to np.result_type() below in the\n        # most common use-case of providing only val1.\n        orig_val2_is_none = val2 is None\n\n        if val1.dtype.kind == 'f':\n            val1, val2 = super()._check_val_type(val1, val2)\n        elif (not orig_val2_is_none\n              or not (val1.dtype.kind in 'US'\n                      or (val1.dtype.kind == 'O'\n                          and all(isinstance(v, Decimal) for v in val1.flat)))):\n            raise TypeError(\n                'for {} class, input should be doubles, string, or Decimal, '\n                'and second values are only allowed for doubles.'\n                .format(self.name))\n\n        val_dtype = (val1.dtype if orig_val2_is_none else\n                     np.result_type(val1.dtype, val2.dtype))\n        subfmts = self._select_subfmts(self.in_subfmt)\n        for subfmt, dtype, convert, _ in subfmts:\n            if np.issubdtype(val_dtype, dtype):\n                break\n        else:\n            raise ValueError('input type not among selected sub-formats.')\n\n        if convert is not None:\n            try:\n                val1, val2 = convert(val1, val2)\n            except Exception:\n                raise TypeError(\n                    'for {} class, input should be (long) doubles, string, '\n                    'or Decimal, and second values are only allowed for '\n                    '(long) doubles.'.format(self.name))\n\n        return val1, val2\n\n    def to_value(self, jd1=None, jd2=None, parent=None, out_subfmt=None):\n        \"\"\"\n        Return time representation from internal jd1 and jd2.\n        Subclasses that require ``parent`` or to adjust the jds should\n        override this method.\n        \"\"\"\n        # TODO: do this in __init_subclass__?\n        if self.__class__.value.fget is not self.__class__.to_value:\n            return self.value\n\n        if jd1 is None:\n            jd1 = self.jd1\n        if jd2 is None:\n            jd2 = self.jd2\n        if out_subfmt is None:\n            out_subfmt = self.out_subfmt\n        subfmt = self._select_subfmts(out_subfmt)[0]\n        kwargs = {}\n        if subfmt[0] in ('str', 'bytes'):\n            unit = getattr(self, 'unit', 1)\n            digits = int(np.ceil(np.log10(unit / np.finfo(float).eps)))\n            # TODO: allow a way to override the format.\n            kwargs['fmt'] = f'.{digits}f'\n        value = subfmt[3](jd1, jd2, **kwargs)\n        return self.mask_if_needed(value)\n\n    value = property(to_value)"},{"col":4,"comment":"Input value validation, typically overridden by derived classes","endLoc":446,"header":"def _check_val_type(self, val1, val2)","id":8325,"name":"_check_val_type","nodeType":"Function","startLoc":409,"text":"def _check_val_type(self, val1, val2):\n        \"\"\"Input value validation, typically overridden by derived classes\"\"\"\n        # Save original state of val2 because the super()._check_val_type below\n        # may change val2 from None to np.array(0). The value is saved in order\n        # to prevent a useless and slow call to np.result_type() below in the\n        # most common use-case of providing only val1.\n        orig_val2_is_none = val2 is None\n\n        if val1.dtype.kind == 'f':\n            val1, val2 = super()._check_val_type(val1, val2)\n        elif (not orig_val2_is_none\n              or not (val1.dtype.kind in 'US'\n                      or (val1.dtype.kind == 'O'\n                          and all(isinstance(v, Decimal) for v in val1.flat)))):\n            raise TypeError(\n                'for {} class, input should be doubles, string, or Decimal, '\n                'and second values are only allowed for doubles.'\n                .format(self.name))\n\n        val_dtype = (val1.dtype if orig_val2_is_none else\n                     np.result_type(val1.dtype, val2.dtype))\n        subfmts = self._select_subfmts(self.in_subfmt)\n        for subfmt, dtype, convert, _ in subfmts:\n            if np.issubdtype(val_dtype, dtype):\n                break\n        else:\n            raise ValueError('input type not among selected sub-formats.')\n\n        if convert is not None:\n            try:\n                val1, val2 = convert(val1, val2)\n            except Exception:\n                raise TypeError(\n                    'for {} class, input should be (long) doubles, string, '\n                    'or Decimal, and second values are only allowed for '\n                    '(long) doubles.'.format(self.name))\n\n        return val1, val2"},{"id":8326,"name":"astropy/_erfa","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/_erfa","id":8327,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport warnings\n\nfrom erfa import core, helpers, ufunc  # noqa\nfrom erfa.core import *  # noqa\nfrom erfa.helpers import leap_seconds  # noqa\nfrom erfa.ufunc import (dt_dmsf, dt_eraASTROM, dt_eraLDBODY,  # noqa\n                        dt_eraLEAPSECOND, dt_hmsf, dt_pv, dt_sign, dt_type, dt_ymdf)\n\nfrom astropy.utils.exceptions import AstropyDeprecationWarning\n\nwarnings.warn('The private astropy._erfa module has been made into its '\n              'own package, pyerfa, which is a dependency of '\n              'astropy and can be imported directly using \"import erfa\"',\n              AstropyDeprecationWarning)\n"},{"col":0,"comment":"","endLoc":2,"header":"__init__.py#<anonymous>","id":8328,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"warnings.warn('The private astropy._erfa module has been made into its '\n              'own package, pyerfa, which is a dependency of '\n              'astropy and can be imported directly using \"import erfa\"',\n              AstropyDeprecationWarning)"},{"id":8329,"name":"astropy/stats","nodeType":"Package"},{"fileName":"jackknife.py","filePath":"astropy/stats","id":8330,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport numpy as np\n\n__all__ = ['jackknife_resampling', 'jackknife_stats']\n__doctest_requires__ = {'jackknife_stats': ['scipy']}\n\n\ndef jackknife_resampling(data):\n    \"\"\"Performs jackknife resampling on numpy arrays.\n\n    Jackknife resampling is a technique to generate 'n' deterministic samples\n    of size 'n-1' from a measured sample of size 'n'. Basically, the i-th\n    sample, (1<=i<=n), is generated by means of removing the i-th measurement\n    of the original sample. Like the bootstrap resampling, this statistical\n    technique finds applications in estimating variance, bias, and confidence\n    intervals.\n\n    Parameters\n    ----------\n    data : ndarray\n        Original sample (1-D array) from which the jackknife resamples will be\n        generated.\n\n    Returns\n    -------\n    resamples : ndarray\n        The i-th row is the i-th jackknife sample, i.e., the original sample\n        with the i-th measurement deleted.\n\n    References\n    ----------\n    .. [1] McIntosh, Avery. \"The Jackknife Estimation Method\".\n        <https://arxiv.org/abs/1606.00497>\n\n    .. [2] Efron, Bradley. \"The Jackknife, the Bootstrap, and other\n        Resampling Plans\". Technical Report No. 63, Division of Biostatistics,\n        Stanford University, December, 1980.\n\n    .. [3] Jackknife resampling <https://en.wikipedia.org/wiki/Jackknife_resampling>\n    \"\"\"  # noqa\n\n    n = data.shape[0]\n    if n <= 0:\n        raise ValueError(\"data must contain at least one measurement.\")\n\n    resamples = np.empty([n, n-1])\n\n    for i in range(n):\n        resamples[i] = np.delete(data, i)\n\n    return resamples\n\n\ndef jackknife_stats(data, statistic, confidence_level=0.95):\n    \"\"\"Performs jackknife estimation on the basis of jackknife resamples.\n\n    This function requires `SciPy <https://www.scipy.org/>`_ to be installed.\n\n    Parameters\n    ----------\n    data : ndarray\n        Original sample (1-D array).\n    statistic : function\n        Any function (or vector of functions) on the basis of the measured\n        data, e.g, sample mean, sample variance, etc. The jackknife estimate of\n        this statistic will be returned.\n    confidence_level : float, optional\n        Confidence level for the confidence interval of the Jackknife estimate.\n        Must be a real-valued number in (0,1). Default value is 0.95.\n\n    Returns\n    -------\n    estimate : float or `~numpy.ndarray`\n        The i-th element is the bias-corrected \"jackknifed\" estimate.\n\n    bias : float or `~numpy.ndarray`\n        The i-th element is the jackknife bias.\n\n    std_err : float or `~numpy.ndarray`\n        The i-th element is the jackknife standard error.\n\n    conf_interval : ndarray\n        If ``statistic`` is single-valued, the first and second elements are\n        the lower and upper bounds, respectively. If ``statistic`` is\n        vector-valued, each column corresponds to the confidence interval for\n        each component of ``statistic``. The first and second rows contain the\n        lower and upper bounds, respectively.\n\n    Examples\n    --------\n    1. Obtain Jackknife resamples:\n\n    >>> import numpy as np\n    >>> from astropy.stats import jackknife_resampling\n    >>> from astropy.stats import jackknife_stats\n    >>> data = np.array([1,2,3,4,5,6,7,8,9,0])\n    >>> resamples = jackknife_resampling(data)\n    >>> resamples\n    array([[2., 3., 4., 5., 6., 7., 8., 9., 0.],\n           [1., 3., 4., 5., 6., 7., 8., 9., 0.],\n           [1., 2., 4., 5., 6., 7., 8., 9., 0.],\n           [1., 2., 3., 5., 6., 7., 8., 9., 0.],\n           [1., 2., 3., 4., 6., 7., 8., 9., 0.],\n           [1., 2., 3., 4., 5., 7., 8., 9., 0.],\n           [1., 2., 3., 4., 5., 6., 8., 9., 0.],\n           [1., 2., 3., 4., 5., 6., 7., 9., 0.],\n           [1., 2., 3., 4., 5., 6., 7., 8., 0.],\n           [1., 2., 3., 4., 5., 6., 7., 8., 9.]])\n    >>> resamples.shape\n    (10, 9)\n\n    2. Obtain Jackknife estimate for the mean, its bias, its standard error,\n    and its 95% confidence interval:\n\n    >>> test_statistic = np.mean\n    >>> estimate, bias, stderr, conf_interval = jackknife_stats(\n    ...     data, test_statistic, 0.95)\n    >>> estimate\n    4.5\n    >>> bias\n    0.0\n    >>> stderr  # doctest: +FLOAT_CMP\n    0.95742710775633832\n    >>> conf_interval\n    array([2.62347735,  6.37652265])\n\n    3. Example for two estimates\n\n    >>> test_statistic = lambda x: (np.mean(x), np.var(x))\n    >>> estimate, bias, stderr, conf_interval = jackknife_stats(\n    ...     data, test_statistic, 0.95)\n    >>> estimate\n    array([4.5       ,  9.16666667])\n    >>> bias\n    array([ 0.        , -0.91666667])\n    >>> stderr\n    array([0.95742711,  2.69124476])\n    >>> conf_interval\n    array([[ 2.62347735,   3.89192387],\n           [ 6.37652265,  14.44140947]])\n\n    IMPORTANT: Note that confidence intervals are given as columns\n    \"\"\"\n    # jackknife confidence interval\n    if not (0 < confidence_level < 1):\n        raise ValueError(\"confidence level must be in (0, 1).\")\n\n    # make sure original data is proper\n    n = data.shape[0]\n    if n <= 0:\n        raise ValueError(\"data must contain at least one measurement.\")\n\n    # Only import scipy if inputs are valid\n    from scipy.special import erfinv\n\n    resamples = jackknife_resampling(data)\n\n    stat_data = statistic(data)\n    jack_stat = np.apply_along_axis(statistic, 1, resamples)\n    mean_jack_stat = np.mean(jack_stat, axis=0)\n\n    # jackknife bias\n    bias = (n-1)*(mean_jack_stat - stat_data)\n\n    # jackknife standard error\n    std_err = np.sqrt((n-1)*np.mean((jack_stat - mean_jack_stat)*(jack_stat -\n                                    mean_jack_stat), axis=0))\n\n    # bias-corrected \"jackknifed estimate\"\n    estimate = stat_data - bias\n\n    z_score = np.sqrt(2.0)*erfinv(confidence_level)\n    conf_interval = estimate + z_score*np.array((-std_err, std_err))\n\n    return estimate, bias, std_err, conf_interval\n"},{"col":4,"comment":"\n        Return a list of subformats where name matches ``pattern`` using\n        fnmatch.\n\n        If no subformat matches pattern then a ValueError is raised.  A special\n        case is a format with no allowed subformats, i.e. subfmts=(), and\n        pattern='*'.  This is OK and happens when this method is used for\n        validation of an out_subfmt.\n        ","endLoc":395,"header":"@classmethod\n    def _select_subfmts(cls, pattern)","id":8331,"name":"_select_subfmts","nodeType":"Function","startLoc":370,"text":"@classmethod\n    def _select_subfmts(cls, pattern):\n        \"\"\"\n        Return a list of subformats where name matches ``pattern`` using\n        fnmatch.\n\n        If no subformat matches pattern then a ValueError is raised.  A special\n        case is a format with no allowed subformats, i.e. subfmts=(), and\n        pattern='*'.  This is OK and happens when this method is used for\n        validation of an out_subfmt.\n        \"\"\"\n        if not isinstance(pattern, str):\n            raise ValueError('subfmt attribute must be a string')\n        elif pattern == '*':\n            return cls.subfmts\n\n        subfmts = [x for x in cls.subfmts if fnmatch.fnmatchcase(x[0], pattern)]\n        if len(subfmts) == 0:\n            if len(cls.subfmts) == 0:\n                raise ValueError(f'subformat not allowed for format {cls.name}')\n            else:\n                subfmt_names = [x[0] for x in cls.subfmts]\n                raise ValueError(f'subformat {pattern!r} must match one of '\n                                 f'{subfmt_names} for format {cls.name}')\n\n        return subfmts"},{"col":0,"comment":"Performs jackknife resampling on numpy arrays.\n\n    Jackknife resampling is a technique to generate 'n' deterministic samples\n    of size 'n-1' from a measured sample of size 'n'. Basically, the i-th\n    sample, (1<=i<=n), is generated by means of removing the i-th measurement\n    of the original sample. Like the bootstrap resampling, this statistical\n    technique finds applications in estimating variance, bias, and confidence\n    intervals.\n\n    Parameters\n    ----------\n    data : ndarray\n        Original sample (1-D array) from which the jackknife resamples will be\n        generated.\n\n    Returns\n    -------\n    resamples : ndarray\n        The i-th row is the i-th jackknife sample, i.e., the original sample\n        with the i-th measurement deleted.\n\n    References\n    ----------\n    .. [1] McIntosh, Avery. \"The Jackknife Estimation Method\".\n        <https://arxiv.org/abs/1606.00497>\n\n    .. [2] Efron, Bradley. \"The Jackknife, the Bootstrap, and other\n        Resampling Plans\". Technical Report No. 63, Division of Biostatistics,\n        Stanford University, December, 1980.\n\n    .. [3] Jackknife resampling <https://en.wikipedia.org/wiki/Jackknife_resampling>\n    ","endLoc":52,"header":"def jackknife_resampling(data)","id":8332,"name":"jackknife_resampling","nodeType":"Function","startLoc":9,"text":"def jackknife_resampling(data):\n    \"\"\"Performs jackknife resampling on numpy arrays.\n\n    Jackknife resampling is a technique to generate 'n' deterministic samples\n    of size 'n-1' from a measured sample of size 'n'. Basically, the i-th\n    sample, (1<=i<=n), is generated by means of removing the i-th measurement\n    of the original sample. Like the bootstrap resampling, this statistical\n    technique finds applications in estimating variance, bias, and confidence\n    intervals.\n\n    Parameters\n    ----------\n    data : ndarray\n        Original sample (1-D array) from which the jackknife resamples will be\n        generated.\n\n    Returns\n    -------\n    resamples : ndarray\n        The i-th row is the i-th jackknife sample, i.e., the original sample\n        with the i-th measurement deleted.\n\n    References\n    ----------\n    .. [1] McIntosh, Avery. \"The Jackknife Estimation Method\".\n        <https://arxiv.org/abs/1606.00497>\n\n    .. [2] Efron, Bradley. \"The Jackknife, the Bootstrap, and other\n        Resampling Plans\". Technical Report No. 63, Division of Biostatistics,\n        Stanford University, December, 1980.\n\n    .. [3] Jackknife resampling <https://en.wikipedia.org/wiki/Jackknife_resampling>\n    \"\"\"  # noqa\n\n    n = data.shape[0]\n    if n <= 0:\n        raise ValueError(\"data must contain at least one measurement.\")\n\n    resamples = np.empty([n, n-1])\n\n    for i in range(n):\n        resamples[i] = np.delete(data, i)\n\n    return resamples"},{"col":0,"comment":"Performs jackknife estimation on the basis of jackknife resamples.\n\n    This function requires `SciPy <https://www.scipy.org/>`_ to be installed.\n\n    Parameters\n    ----------\n    data : ndarray\n        Original sample (1-D array).\n    statistic : function\n        Any function (or vector of functions) on the basis of the measured\n        data, e.g, sample mean, sample variance, etc. The jackknife estimate of\n        this statistic will be returned.\n    confidence_level : float, optional\n        Confidence level for the confidence interval of the Jackknife estimate.\n        Must be a real-valued number in (0,1). Default value is 0.95.\n\n    Returns\n    -------\n    estimate : float or `~numpy.ndarray`\n        The i-th element is the bias-corrected \"jackknifed\" estimate.\n\n    bias : float or `~numpy.ndarray`\n        The i-th element is the jackknife bias.\n\n    std_err : float or `~numpy.ndarray`\n        The i-th element is the jackknife standard error.\n\n    conf_interval : ndarray\n        If ``statistic`` is single-valued, the first and second elements are\n        the lower and upper bounds, respectively. If ``statistic`` is\n        vector-valued, each column corresponds to the confidence interval for\n        each component of ``statistic``. The first and second rows contain the\n        lower and upper bounds, respectively.\n\n    Examples\n    --------\n    1. Obtain Jackknife resamples:\n\n    >>> import numpy as np\n    >>> from astropy.stats import jackknife_resampling\n    >>> from astropy.stats import jackknife_stats\n    >>> data = np.array([1,2,3,4,5,6,7,8,9,0])\n    >>> resamples = jackknife_resampling(data)\n    >>> resamples\n    array([[2., 3., 4., 5., 6., 7., 8., 9., 0.],\n           [1., 3., 4., 5., 6., 7., 8., 9., 0.],\n           [1., 2., 4., 5., 6., 7., 8., 9., 0.],\n           [1., 2., 3., 5., 6., 7., 8., 9., 0.],\n           [1., 2., 3., 4., 6., 7., 8., 9., 0.],\n           [1., 2., 3., 4., 5., 7., 8., 9., 0.],\n           [1., 2., 3., 4., 5., 6., 8., 9., 0.],\n           [1., 2., 3., 4., 5., 6., 7., 9., 0.],\n           [1., 2., 3., 4., 5., 6., 7., 8., 0.],\n           [1., 2., 3., 4., 5., 6., 7., 8., 9.]])\n    >>> resamples.shape\n    (10, 9)\n\n    2. Obtain Jackknife estimate for the mean, its bias, its standard error,\n    and its 95% confidence interval:\n\n    >>> test_statistic = np.mean\n    >>> estimate, bias, stderr, conf_interval = jackknife_stats(\n    ...     data, test_statistic, 0.95)\n    >>> estimate\n    4.5\n    >>> bias\n    0.0\n    >>> stderr  # doctest: +FLOAT_CMP\n    0.95742710775633832\n    >>> conf_interval\n    array([2.62347735,  6.37652265])\n\n    3. Example for two estimates\n\n    >>> test_statistic = lambda x: (np.mean(x), np.var(x))\n    >>> estimate, bias, stderr, conf_interval = jackknife_stats(\n    ...     data, test_statistic, 0.95)\n    >>> estimate\n    array([4.5       ,  9.16666667])\n    >>> bias\n    array([ 0.        , -0.91666667])\n    >>> stderr\n    array([0.95742711,  2.69124476])\n    >>> conf_interval\n    array([[ 2.62347735,   3.89192387],\n           [ 6.37652265,  14.44140947]])\n\n    IMPORTANT: Note that confidence intervals are given as columns\n    ","endLoc":176,"header":"def jackknife_stats(data, statistic, confidence_level=0.95)","id":8333,"name":"jackknife_stats","nodeType":"Function","startLoc":55,"text":"def jackknife_stats(data, statistic, confidence_level=0.95):\n    \"\"\"Performs jackknife estimation on the basis of jackknife resamples.\n\n    This function requires `SciPy <https://www.scipy.org/>`_ to be installed.\n\n    Parameters\n    ----------\n    data : ndarray\n        Original sample (1-D array).\n    statistic : function\n        Any function (or vector of functions) on the basis of the measured\n        data, e.g, sample mean, sample variance, etc. The jackknife estimate of\n        this statistic will be returned.\n    confidence_level : float, optional\n        Confidence level for the confidence interval of the Jackknife estimate.\n        Must be a real-valued number in (0,1). Default value is 0.95.\n\n    Returns\n    -------\n    estimate : float or `~numpy.ndarray`\n        The i-th element is the bias-corrected \"jackknifed\" estimate.\n\n    bias : float or `~numpy.ndarray`\n        The i-th element is the jackknife bias.\n\n    std_err : float or `~numpy.ndarray`\n        The i-th element is the jackknife standard error.\n\n    conf_interval : ndarray\n        If ``statistic`` is single-valued, the first and second elements are\n        the lower and upper bounds, respectively. If ``statistic`` is\n        vector-valued, each column corresponds to the confidence interval for\n        each component of ``statistic``. The first and second rows contain the\n        lower and upper bounds, respectively.\n\n    Examples\n    --------\n    1. Obtain Jackknife resamples:\n\n    >>> import numpy as np\n    >>> from astropy.stats import jackknife_resampling\n    >>> from astropy.stats import jackknife_stats\n    >>> data = np.array([1,2,3,4,5,6,7,8,9,0])\n    >>> resamples = jackknife_resampling(data)\n    >>> resamples\n    array([[2., 3., 4., 5., 6., 7., 8., 9., 0.],\n           [1., 3., 4., 5., 6., 7., 8., 9., 0.],\n           [1., 2., 4., 5., 6., 7., 8., 9., 0.],\n           [1., 2., 3., 5., 6., 7., 8., 9., 0.],\n           [1., 2., 3., 4., 6., 7., 8., 9., 0.],\n           [1., 2., 3., 4., 5., 7., 8., 9., 0.],\n           [1., 2., 3., 4., 5., 6., 8., 9., 0.],\n           [1., 2., 3., 4., 5., 6., 7., 9., 0.],\n           [1., 2., 3., 4., 5., 6., 7., 8., 0.],\n           [1., 2., 3., 4., 5., 6., 7., 8., 9.]])\n    >>> resamples.shape\n    (10, 9)\n\n    2. Obtain Jackknife estimate for the mean, its bias, its standard error,\n    and its 95% confidence interval:\n\n    >>> test_statistic = np.mean\n    >>> estimate, bias, stderr, conf_interval = jackknife_stats(\n    ...     data, test_statistic, 0.95)\n    >>> estimate\n    4.5\n    >>> bias\n    0.0\n    >>> stderr  # doctest: +FLOAT_CMP\n    0.95742710775633832\n    >>> conf_interval\n    array([2.62347735,  6.37652265])\n\n    3. Example for two estimates\n\n    >>> test_statistic = lambda x: (np.mean(x), np.var(x))\n    >>> estimate, bias, stderr, conf_interval = jackknife_stats(\n    ...     data, test_statistic, 0.95)\n    >>> estimate\n    array([4.5       ,  9.16666667])\n    >>> bias\n    array([ 0.        , -0.91666667])\n    >>> stderr\n    array([0.95742711,  2.69124476])\n    >>> conf_interval\n    array([[ 2.62347735,   3.89192387],\n           [ 6.37652265,  14.44140947]])\n\n    IMPORTANT: Note that confidence intervals are given as columns\n    \"\"\"\n    # jackknife confidence interval\n    if not (0 < confidence_level < 1):\n        raise ValueError(\"confidence level must be in (0, 1).\")\n\n    # make sure original data is proper\n    n = data.shape[0]\n    if n <= 0:\n        raise ValueError(\"data must contain at least one measurement.\")\n\n    # Only import scipy if inputs are valid\n    from scipy.special import erfinv\n\n    resamples = jackknife_resampling(data)\n\n    stat_data = statistic(data)\n    jack_stat = np.apply_along_axis(statistic, 1, resamples)\n    mean_jack_stat = np.mean(jack_stat, axis=0)\n\n    # jackknife bias\n    bias = (n-1)*(mean_jack_stat - stat_data)\n\n    # jackknife standard error\n    std_err = np.sqrt((n-1)*np.mean((jack_stat - mean_jack_stat)*(jack_stat -\n                                    mean_jack_stat), axis=0))\n\n    # bias-corrected \"jackknifed estimate\"\n    estimate = stat_data - bias\n\n    z_score = np.sqrt(2.0)*erfinv(confidence_level)\n    conf_interval = estimate + z_score*np.array((-std_err, std_err))\n\n    return estimate, bias, std_err, conf_interval"},{"col":4,"comment":"\n        Register the client to the SAMP Hub.\n        ","endLoc":221,"header":"def register(self)","id":8334,"name":"register","nodeType":"Function","startLoc":185,"text":"def register(self):\n        \"\"\"\n        Register the client to the SAMP Hub.\n        \"\"\"\n        if self.hub.is_connected:\n\n            if self._private_key is not None:\n                raise SAMPClientError(\"Client already registered\")\n\n            result = self.hub.register(\"Astropy SAMP Web Client\")\n\n            if result[\"samp.self-id\"] == \"\":\n                raise SAMPClientError(\"Registation failed - samp.self-id \"\n                                      \"was not set by the hub.\")\n\n            if result[\"samp.private-key\"] == \"\":\n                raise SAMPClientError(\"Registation failed - samp.private-key \"\n                                      \"was not set by the hub.\")\n\n            self._public_id = result[\"samp.self-id\"]\n            self._private_key = result[\"samp.private-key\"]\n            self._hub_id = result[\"samp.hub-id\"]\n\n            if self._callable:\n                self._declare_subscriptions()\n                self.hub.allow_reverse_callbacks(self._private_key, True)\n\n            if self._metadata != {}:\n                self.declare_metadata()\n\n            self._is_registered = True\n            # Let the client thread proceed\n            self._registered_event.set()\n\n        else:\n            raise SAMPClientError(\"Unable to register to the SAMP Hub. Hub \"\n                                  \"proxy not connected.\")"},{"col":4,"comment":"\n        Return time representation from internal jd1 and jd2.\n        Subclasses that require ``parent`` or to adjust the jds should\n        override this method.\n        ","endLoc":472,"header":"def to_value(self, jd1=None, jd2=None, parent=None, out_subfmt=None)","id":8335,"name":"to_value","nodeType":"Function","startLoc":448,"text":"def to_value(self, jd1=None, jd2=None, parent=None, out_subfmt=None):\n        \"\"\"\n        Return time representation from internal jd1 and jd2.\n        Subclasses that require ``parent`` or to adjust the jds should\n        override this method.\n        \"\"\"\n        # TODO: do this in __init_subclass__?\n        if self.__class__.value.fget is not self.__class__.to_value:\n            return self.value\n\n        if jd1 is None:\n            jd1 = self.jd1\n        if jd2 is None:\n            jd2 = self.jd2\n        if out_subfmt is None:\n            out_subfmt = self.out_subfmt\n        subfmt = self._select_subfmts(out_subfmt)[0]\n        kwargs = {}\n        if subfmt[0] in ('str', 'bytes'):\n            unit = getattr(self, 'unit', 1)\n            digits = int(np.ceil(np.log10(unit / np.finfo(float).eps)))\n            # TODO: allow a way to override the format.\n            kwargs['fmt'] = f'.{digits}f'\n        value = subfmt[3](jd1, jd2, **kwargs)\n        return self.mask_if_needed(value)"},{"col":4,"comment":"Get an allowed subfmt for this class, either the input ``subfmt``\n        if this is valid or '*' as a default.  This method gets used in situations\n        where the format of an existing Time object is changing and so the\n        out_ or in_subfmt may need to be coerced to the default '*' if that\n        ``subfmt`` is no longer valid.\n        ","endLoc":155,"header":"@classmethod\n    def _get_allowed_subfmt(cls, subfmt)","id":8336,"name":"_get_allowed_subfmt","nodeType":"Function","startLoc":143,"text":"@classmethod\n    def _get_allowed_subfmt(cls, subfmt):\n        \"\"\"Get an allowed subfmt for this class, either the input ``subfmt``\n        if this is valid or '*' as a default.  This method gets used in situations\n        where the format of an existing Time object is changing and so the\n        out_ or in_subfmt may need to be coerced to the default '*' if that\n        ``subfmt`` is no longer valid.\n        \"\"\"\n        try:\n            cls._select_subfmts(subfmt)\n        except ValueError:\n            subfmt = '*'\n        return subfmt"},{"col":4,"comment":"null","endLoc":213,"header":"def mask_if_needed(self, value)","id":8337,"name":"mask_if_needed","nodeType":"Function","startLoc":210,"text":"def mask_if_needed(self, value):\n        if self.masked:\n            value = np.ma.array(value, mask=self.mask, copy=False)\n        return value"},{"attributeType":"null","col":4,"comment":"null","endLoc":399,"id":8338,"name":"subfmts","nodeType":"Attribute","startLoc":399,"text":"subfmts"},{"attributeType":"null","col":16,"comment":"null","endLoc":3,"id":8339,"name":"np","nodeType":"Attribute","startLoc":3,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":8340,"name":"__all__","nodeType":"Attribute","startLoc":5,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":8341,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":6,"text":"__doctest_requires__"},{"attributeType":"null","col":4,"comment":"null","endLoc":474,"id":8342,"name":"value","nodeType":"Attribute","startLoc":474,"text":"value"},{"col":0,"comment":"","endLoc":3,"header":"jackknife.py#<anonymous>","id":8343,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['jackknife_resampling', 'jackknife_stats']\n\n__doctest_requires__ = {'jackknife_stats': ['scipy']}"},{"col":4,"comment":"null","endLoc":488,"header":"def set_jds(self, val1, val2)","id":8344,"name":"set_jds","nodeType":"Function","startLoc":486,"text":"def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # Validate scale.\n        self.jd1, self.jd2 = day_frac(val1, val2)"},{"col":4,"comment":"\n        Return a validated scale value.\n\n        If there is a class attribute 'scale' then that defines the default /\n        required time scale for this format.  In this case if a scale value was\n        provided that needs to match the class default, otherwise return\n        the class default.\n\n        Otherwise just make sure that scale is in the allowed list of\n        scales.  Provide a different error message if `None` (no value) was\n        supplied.\n        ","endLoc":319,"header":"def _check_scale(self, scale)","id":8345,"name":"_check_scale","nodeType":"Function","startLoc":298,"text":"def _check_scale(self, scale):\n        \"\"\"\n        Return a validated scale value.\n\n        If there is a class attribute 'scale' then that defines the default /\n        required time scale for this format.  In this case if a scale value was\n        provided that needs to match the class default, otherwise return\n        the class default.\n\n        Otherwise just make sure that scale is in the allowed list of\n        scales.  Provide a different error message if `None` (no value) was\n        supplied.\n        \"\"\"\n        if scale is None:\n            scale = self._default_scale\n\n        if scale not in TIME_SCALES:\n            raise ScaleValueError(\"Scale value '{}' not in \"\n                                  \"allowed values {}\"\n                                  .format(scale, TIME_SCALES))\n\n        return scale"},{"fileName":"funcs.py","filePath":"astropy/stats","id":8346,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module contains simple statistical algorithms that are\nstraightforwardly implemented as a single python function (or family of\nfunctions).\n\nThis module should generally not be used directly.  Everything in\n`__all__` is imported into `astropy.stats`, and hence that package\nshould be used for access.\n\"\"\"\n\nimport math\n\nimport numpy as np\n\nimport astropy.units as u\nfrom . import _stats\n\n__all__ = ['gaussian_fwhm_to_sigma', 'gaussian_sigma_to_fwhm',\n           'binom_conf_interval', 'binned_binom_proportion',\n           'poisson_conf_interval', 'median_absolute_deviation', 'mad_std',\n           'signal_to_noise_oir_ccd', 'bootstrap', 'kuiper', 'kuiper_two',\n           'kuiper_false_positive_probability', 'cdf_from_intervals',\n           'interval_overlap_length', 'histogram_intervals', 'fold_intervals']\n\n__doctest_skip__ = ['binned_binom_proportion']\n__doctest_requires__ = {'binom_conf_interval': ['scipy'],\n                        'poisson_conf_interval': ['scipy']}\n\n\ngaussian_sigma_to_fwhm = 2.0 * math.sqrt(2.0 * math.log(2.0))\n\"\"\"\nFactor with which to multiply Gaussian 1-sigma standard deviation to\nconvert it to full width at half maximum (FWHM).\n\"\"\"\n\ngaussian_fwhm_to_sigma = 1. / gaussian_sigma_to_fwhm\n\"\"\"\nFactor with which to multiply Gaussian full width at half maximum (FWHM)\nto convert it to 1-sigma standard deviation.\n\"\"\"\n\n\n# NUMPY_LT_1_18\ndef _expand_dims(data, axis):\n    \"\"\"\n    Expand the shape of an array.\n\n    Insert a new axis that will appear at the `axis` position in the\n    expanded array shape.\n\n    This function allows for tuple axis arguments.\n    ``numpy.expand_dims`` currently does not allow that, but it will in\n    numpy v1.18 (https://github.com/numpy/numpy/pull/14051).\n    ``_expand_dims`` can be replaced with ``numpy.expand_dims`` when the\n    minimum support numpy version is v1.18.\n\n    Parameters\n    ----------\n    data : array-like\n        Input array.\n    axis : int or tuple of int\n        Position in the expanded axes where the new axis (or axes) is\n        placed.  A tuple of axes is now supported.  Out of range axes as\n        described above are now forbidden and raise an `AxisError`.\n\n    Returns\n    -------\n    result : ndarray\n        View of ``data`` with the number of dimensions increased.\n    \"\"\"\n\n    if isinstance(data, np.matrix):\n        data = np.asarray(data)\n    else:\n        data = np.asanyarray(data)\n\n    if not isinstance(axis, (tuple, list)):\n        axis = (axis,)\n\n    out_ndim = len(axis) + data.ndim\n    axis = np.core.numeric.normalize_axis_tuple(axis, out_ndim)\n\n    shape_it = iter(data.shape)\n    shape = [1 if ax in axis else next(shape_it) for ax in range(out_ndim)]\n\n    return data.reshape(shape)\n\n\ndef binom_conf_interval(k, n, confidence_level=0.68269, interval='wilson'):\n    r\"\"\"Binomial proportion confidence interval given k successes,\n    n trials.\n\n    Parameters\n    ----------\n    k : int or numpy.ndarray\n        Number of successes (0 <= ``k`` <= ``n``).\n    n : int or numpy.ndarray\n        Number of trials (``n`` > 0).  If both ``k`` and ``n`` are arrays,\n        they must have the same shape.\n    confidence_level : float, optional\n        Desired probability content of interval. Default is 0.68269,\n        corresponding to 1 sigma in a 1-dimensional Gaussian distribution.\n        Confidence level must be in range [0, 1].\n    interval : {'wilson', 'jeffreys', 'flat', 'wald'}, optional\n        Formula used for confidence interval. See notes for details.  The\n        ``'wilson'`` and ``'jeffreys'`` intervals generally give similar\n        results, while 'flat' is somewhat different, especially for small\n        values of ``n``.  ``'wilson'`` should be somewhat faster than\n        ``'flat'`` or ``'jeffreys'``.  The 'wald' interval is generally not\n        recommended.  It is provided for comparison purposes.  Default is\n        ``'wilson'``.\n\n    Returns\n    -------\n    conf_interval : ndarray\n        ``conf_interval[0]`` and ``conf_interval[1]`` correspond to the lower\n        and upper limits, respectively, for each element in ``k``, ``n``.\n\n    Notes\n    -----\n    In situations where a probability of success is not known, it can\n    be estimated from a number of trials (n) and number of\n    observed successes (k). For example, this is done in Monte\n    Carlo experiments designed to estimate a detection efficiency. It\n    is simple to take the sample proportion of successes (k/n)\n    as a reasonable best estimate of the true probability\n    :math:`\\epsilon`. However, deriving an accurate confidence\n    interval on :math:`\\epsilon` is non-trivial. There are several\n    formulas for this interval (see [1]_). Four intervals are implemented\n    here:\n\n    **1. The Wilson Interval.** This interval, attributed to Wilson [2]_,\n    is given by\n\n    .. math::\n\n        CI_{\\rm Wilson} = \\frac{k + \\kappa^2/2}{n + \\kappa^2}\n        \\pm \\frac{\\kappa n^{1/2}}{n + \\kappa^2}\n        ((\\hat{\\epsilon}(1 - \\hat{\\epsilon}) + \\kappa^2/(4n))^{1/2}\n\n    where :math:`\\hat{\\epsilon} = k / n` and :math:`\\kappa` is the\n    number of standard deviations corresponding to the desired\n    confidence interval for a *normal* distribution (for example,\n    1.0 for a confidence interval of 68.269%). For a\n    confidence interval of 100(1 - :math:`\\alpha`)%,\n\n    .. math::\n\n        \\kappa = \\Phi^{-1}(1-\\alpha/2) = \\sqrt{2}{\\rm erf}^{-1}(1-\\alpha).\n\n    **2. The Jeffreys Interval.** This interval is derived by applying\n    Bayes' theorem to the binomial distribution with the\n    noninformative Jeffreys prior [3]_, [4]_. The noninformative Jeffreys\n    prior is the Beta distribution, Beta(1/2, 1/2), which has the density\n    function\n\n    .. math::\n\n        f(\\epsilon) = \\pi^{-1} \\epsilon^{-1/2}(1-\\epsilon)^{-1/2}.\n\n    The justification for this prior is that it is invariant under\n    reparameterizations of the binomial proportion.\n    The posterior density function is also a Beta distribution: Beta(k\n    + 1/2, n - k + 1/2). The interval is then chosen so that it is\n    *equal-tailed*: Each tail (outside the interval) contains\n    :math:`\\alpha`/2 of the posterior probability, and the interval\n    itself contains 1 - :math:`\\alpha`. This interval must be\n    calculated numerically. Additionally, when k = 0 the lower limit\n    is set to 0 and when k = n the upper limit is set to 1, so that in\n    these cases, there is only one tail containing :math:`\\alpha`/2\n    and the interval itself contains 1 - :math:`\\alpha`/2 rather than\n    the nominal 1 - :math:`\\alpha`.\n\n    **3. A Flat prior.** This is similar to the Jeffreys interval,\n    but uses a flat (uniform) prior on the binomial proportion\n    over the range 0 to 1 rather than the reparametrization-invariant\n    Jeffreys prior.  The posterior density function is a Beta distribution:\n    Beta(k + 1, n - k + 1).  The same comments about the nature of the\n    interval (equal-tailed, etc.) also apply to this option.\n\n    **4. The Wald Interval.** This interval is given by\n\n    .. math::\n\n       CI_{\\rm Wald} = \\hat{\\epsilon} \\pm\n       \\kappa \\sqrt{\\frac{\\hat{\\epsilon}(1-\\hat{\\epsilon})}{n}}\n\n    The Wald interval gives acceptable results in some limiting\n    cases. Particularly, when n is very large, and the true proportion\n    :math:`\\epsilon` is not \"too close\" to 0 or 1. However, as the\n    later is not verifiable when trying to estimate :math:`\\epsilon`,\n    this is not very helpful. Its use is not recommended, but it is\n    provided here for comparison purposes due to its prevalence in\n    everyday practical statistics.\n\n    This function requires ``scipy`` for all interval types.\n\n    References\n    ----------\n    .. [1] Brown, Lawrence D.; Cai, T. Tony; DasGupta, Anirban (2001).\n       \"Interval Estimation for a Binomial Proportion\". Statistical\n       Science 16 (2): 101-133. doi:10.1214/ss/1009213286\n\n    .. [2] Wilson, E. B. (1927). \"Probable inference, the law of\n       succession, and statistical inference\". Journal of the American\n       Statistical Association 22: 209-212.\n\n    .. [3] Jeffreys, Harold (1946). \"An Invariant Form for the Prior\n       Probability in Estimation Problems\". Proc. R. Soc. Lond.. A 24 186\n       (1007): 453-461. doi:10.1098/rspa.1946.0056\n\n    .. [4] Jeffreys, Harold (1998). Theory of Probability. Oxford\n       University Press, 3rd edition. ISBN 978-0198503682\n\n    Examples\n    --------\n    Integer inputs return an array with shape (2,):\n\n    >>> binom_conf_interval(4, 5, interval='wilson')  # doctest: +FLOAT_CMP\n    array([0.57921724, 0.92078259])\n\n    Arrays of arbitrary dimension are supported. The Wilson and Jeffreys\n    intervals give similar results, even for small k, n:\n\n    >>> binom_conf_interval([1, 2], 5, interval='wilson')  # doctest: +FLOAT_CMP\n    array([[0.07921741, 0.21597328],\n           [0.42078276, 0.61736012]])\n\n    >>> binom_conf_interval([1, 2,], 5, interval='jeffreys')  # doctest: +FLOAT_CMP\n    array([[0.0842525 , 0.21789949],\n           [0.42218001, 0.61753691]])\n\n    >>> binom_conf_interval([1, 2], 5, interval='flat')  # doctest: +FLOAT_CMP\n    array([[0.12139799, 0.24309021],\n           [0.45401727, 0.61535699]])\n\n    In contrast, the Wald interval gives poor results for small k, n.\n    For k = 0 or k = n, the interval always has zero length.\n\n    >>> binom_conf_interval([1, 2], 5, interval='wald')  # doctest: +FLOAT_CMP\n    array([[0.02111437, 0.18091075],\n           [0.37888563, 0.61908925]])\n\n    For confidence intervals approaching 1, the Wald interval for\n    0 < k < n can give intervals that extend outside [0, 1]:\n\n    >>> binom_conf_interval([1, 2], 5, interval='wald', confidence_level=0.99)  # doctest: +FLOAT_CMP\n    array([[-0.26077835, -0.16433593],\n           [ 0.66077835,  0.96433593]])\n\n    \"\"\"  # noqa\n    if confidence_level < 0. or confidence_level > 1.:\n        raise ValueError('confidence_level must be between 0. and 1.')\n    alpha = 1. - confidence_level\n\n    k = np.asarray(k).astype(int)\n    n = np.asarray(n).astype(int)\n\n    if (n <= 0).any():\n        raise ValueError('n must be positive')\n    if (k < 0).any() or (k > n).any():\n        raise ValueError('k must be in {0, 1, .., n}')\n\n    if interval == 'wilson' or interval == 'wald':\n        from scipy.special import erfinv\n        kappa = np.sqrt(2.) * min(erfinv(confidence_level), 1.e10)  # Avoid overflows.\n        k = k.astype(float)\n        n = n.astype(float)\n        p = k / n\n\n        if interval == 'wilson':\n            midpoint = (k + kappa ** 2 / 2.) / (n + kappa ** 2)\n            halflength = (kappa * np.sqrt(n)) / (n + kappa ** 2) * \\\n                np.sqrt(p * (1 - p) + kappa ** 2 / (4 * n))\n            conf_interval = np.array([midpoint - halflength,\n                                      midpoint + halflength])\n\n            # Correct intervals out of range due to floating point errors.\n            conf_interval[conf_interval < 0.] = 0.\n            conf_interval[conf_interval > 1.] = 1.\n        else:\n            midpoint = p\n            halflength = kappa * np.sqrt(p * (1. - p) / n)\n            conf_interval = np.array([midpoint - halflength,\n                                      midpoint + halflength])\n\n    elif interval == 'jeffreys' or interval == 'flat':\n        from scipy.special import betaincinv\n\n        if interval == 'jeffreys':\n            lowerbound = betaincinv(k + 0.5, n - k + 0.5, 0.5 * alpha)\n            upperbound = betaincinv(k + 0.5, n - k + 0.5, 1. - 0.5 * alpha)\n        else:\n            lowerbound = betaincinv(k + 1, n - k + 1, 0.5 * alpha)\n            upperbound = betaincinv(k + 1, n - k + 1, 1. - 0.5 * alpha)\n\n        # Set lower or upper bound to k/n when k/n = 0 or 1\n        #  We have to treat the special case of k/n being scalars,\n        #  which is an ugly kludge\n        if lowerbound.ndim == 0:\n            if k == 0:\n                lowerbound = 0.\n            elif k == n:\n                upperbound = 1.\n        else:\n            lowerbound[k == 0] = 0\n            upperbound[k == n] = 1\n\n        conf_interval = np.array([lowerbound, upperbound])\n    else:\n        raise ValueError(f'Unrecognized interval: {interval:s}')\n\n    return conf_interval\n\n\ndef binned_binom_proportion(x, success, bins=10, range=None,\n                            confidence_level=0.68269, interval='wilson'):\n    \"\"\"Binomial proportion and confidence interval in bins of a continuous\n    variable ``x``.\n\n    Given a set of datapoint pairs where the ``x`` values are\n    continuously distributed and the ``success`` values are binomial\n    (\"success / failure\" or \"true / false\"), place the pairs into\n    bins according to ``x`` value and calculate the binomial proportion\n    (fraction of successes) and confidence interval in each bin.\n\n    Parameters\n    ----------\n    x : sequence\n        Values.\n    success : sequence of bool\n        Success (`True`) or failure (`False`) corresponding to each value\n        in ``x``.  Must be same length as ``x``.\n    bins : int or sequence of scalar, optional\n        If bins is an int, it defines the number of equal-width bins\n        in the given range (10, by default). If bins is a sequence, it\n        defines the bin edges, including the rightmost edge, allowing\n        for non-uniform bin widths (in this case, 'range' is ignored).\n    range : (float, float), optional\n        The lower and upper range of the bins. If `None` (default),\n        the range is set to ``(x.min(), x.max())``. Values outside the\n        range are ignored.\n    confidence_level : float, optional\n        Must be in range [0, 1].\n        Desired probability content in the confidence\n        interval ``(p - perr[0], p + perr[1])`` in each bin. Default is\n        0.68269.\n    interval : {'wilson', 'jeffreys', 'flat', 'wald'}, optional\n        Formula used to calculate confidence interval on the\n        binomial proportion in each bin. See `binom_conf_interval` for\n        definition of the intervals.  The 'wilson', 'jeffreys',\n        and 'flat' intervals generally give similar results.  'wilson'\n        should be somewhat faster, while 'jeffreys' and 'flat' are\n        marginally superior, but differ in the assumed prior.\n        The 'wald' interval is generally not recommended.\n        It is provided for comparison purposes. Default is 'wilson'.\n\n    Returns\n    -------\n    bin_ctr : ndarray\n        Central value of bins. Bins without any entries are not returned.\n    bin_halfwidth : ndarray\n        Half-width of each bin such that ``bin_ctr - bin_halfwidth`` and\n        ``bin_ctr + bins_halfwidth`` give the left and right side of each bin,\n        respectively.\n    p : ndarray\n        Efficiency in each bin.\n    perr : ndarray\n        2-d array of shape (2, len(p)) representing the upper and lower\n        uncertainty on p in each bin.\n\n    Notes\n    -----\n    This function requires ``scipy`` for all interval types.\n\n    See Also\n    --------\n    binom_conf_interval : Function used to estimate confidence interval in\n                          each bin.\n\n    Examples\n    --------\n    Suppose we wish to estimate the efficiency of a survey in\n    detecting astronomical sources as a function of magnitude (i.e.,\n    the probability of detecting a source given its magnitude). In a\n    realistic case, we might prepare a large number of sources with\n    randomly selected magnitudes, inject them into simulated images,\n    and then record which were detected at the end of the reduction\n    pipeline. As a toy example, we generate 100 data points with\n    randomly selected magnitudes between 20 and 30 and \"observe\" them\n    with a known detection function (here, the error function, with\n    50% detection probability at magnitude 25):\n\n    >>> from scipy.special import erf\n    >>> from scipy.stats.distributions import binom\n    >>> def true_efficiency(x):\n    ...     return 0.5 - 0.5 * erf((x - 25.) / 2.)\n    >>> mag = 20. + 10. * np.random.rand(100)\n    >>> detected = binom.rvs(1, true_efficiency(mag))\n    >>> bins, binshw, p, perr = binned_binom_proportion(mag, detected, bins=20)\n    >>> plt.errorbar(bins, p, xerr=binshw, yerr=perr, ls='none', marker='o',\n    ...              label='estimate')\n\n    .. plot::\n\n       import numpy as np\n       from scipy.special import erf\n       from scipy.stats.distributions import binom\n       import matplotlib.pyplot as plt\n       from astropy.stats import binned_binom_proportion\n       def true_efficiency(x):\n           return 0.5 - 0.5 * erf((x - 25.) / 2.)\n       np.random.seed(400)\n       mag = 20. + 10. * np.random.rand(100)\n       np.random.seed(600)\n       detected = binom.rvs(1, true_efficiency(mag))\n       bins, binshw, p, perr = binned_binom_proportion(mag, detected, bins=20)\n       plt.errorbar(bins, p, xerr=binshw, yerr=perr, ls='none', marker='o',\n                    label='estimate')\n       X = np.linspace(20., 30., 1000)\n       plt.plot(X, true_efficiency(X), label='true efficiency')\n       plt.ylim(0., 1.)\n       plt.title('Detection efficiency vs magnitude')\n       plt.xlabel('Magnitude')\n       plt.ylabel('Detection efficiency')\n       plt.legend()\n       plt.show()\n\n    The above example uses the Wilson confidence interval to calculate\n    the uncertainty ``perr`` in each bin (see the definition of various\n    confidence intervals in `binom_conf_interval`). A commonly used\n    alternative is the Wald interval. However, the Wald interval can\n    give nonsensical uncertainties when the efficiency is near 0 or 1,\n    and is therefore **not** recommended. As an illustration, the\n    following example shows the same data as above but uses the Wald\n    interval rather than the Wilson interval to calculate ``perr``:\n\n    >>> bins, binshw, p, perr = binned_binom_proportion(mag, detected, bins=20,\n    ...                                                 interval='wald')\n    >>> plt.errorbar(bins, p, xerr=binshw, yerr=perr, ls='none', marker='o',\n    ...              label='estimate')\n\n    .. plot::\n\n       import numpy as np\n       from scipy.special import erf\n       from scipy.stats.distributions import binom\n       import matplotlib.pyplot as plt\n       from astropy.stats import binned_binom_proportion\n       def true_efficiency(x):\n           return 0.5 - 0.5 * erf((x - 25.) / 2.)\n       np.random.seed(400)\n       mag = 20. + 10. * np.random.rand(100)\n       np.random.seed(600)\n       detected = binom.rvs(1, true_efficiency(mag))\n       bins, binshw, p, perr = binned_binom_proportion(mag, detected, bins=20,\n                                                       interval='wald')\n       plt.errorbar(bins, p, xerr=binshw, yerr=perr, ls='none', marker='o',\n                    label='estimate')\n       X = np.linspace(20., 30., 1000)\n       plt.plot(X, true_efficiency(X), label='true efficiency')\n       plt.ylim(0., 1.)\n       plt.title('The Wald interval can give nonsensical uncertainties')\n       plt.xlabel('Magnitude')\n       plt.ylabel('Detection efficiency')\n       plt.legend()\n       plt.show()\n\n    \"\"\"\n    x = np.ravel(x)\n    success = np.ravel(success).astype(bool)\n    if x.shape != success.shape:\n        raise ValueError('sizes of x and success must match')\n\n    # Put values into a histogram (`n`). Put \"successful\" values\n    # into a second histogram (`k`) with identical binning.\n    n, bin_edges = np.histogram(x, bins=bins, range=range)\n    k, bin_edges = np.histogram(x[success], bins=bin_edges)\n    bin_ctr = (bin_edges[:-1] + bin_edges[1:]) / 2.\n    bin_halfwidth = bin_ctr - bin_edges[:-1]\n\n    # Remove bins with zero entries.\n    valid = n > 0\n    bin_ctr = bin_ctr[valid]\n    bin_halfwidth = bin_halfwidth[valid]\n    n = n[valid]\n    k = k[valid]\n\n    p = k / n\n    bounds = binom_conf_interval(k, n, confidence_level=confidence_level, interval=interval)\n    perr = np.abs(bounds - p)\n\n    return bin_ctr, bin_halfwidth, p, perr\n\n\ndef _check_poisson_conf_inputs(sigma, background, confidence_level, name):\n    if sigma != 1:\n        raise ValueError(f\"Only sigma=1 supported for interval {name}\")\n    if background != 0:\n        raise ValueError(f\"background not supported for interval {name}\")\n    if confidence_level is not None:\n        raise ValueError(f\"confidence_level not supported for interval {name}\")\n\n\ndef poisson_conf_interval(n, interval='root-n', sigma=1, background=0,\n                          confidence_level=None):\n    r\"\"\"Poisson parameter confidence interval given observed counts\n\n    Parameters\n    ----------\n    n : int or numpy.ndarray\n        Number of counts (0 <= ``n``).\n    interval : {'root-n','root-n-0','pearson','sherpagehrels','frequentist-confidence', 'kraft-burrows-nousek'}, optional\n        Formula used for confidence interval. See notes for details.\n        Default is ``'root-n'``.\n    sigma : float, optional\n        Number of sigma for confidence interval; only supported for\n        the 'frequentist-confidence' mode.\n    background : float, optional\n        Number of counts expected from the background; only supported for\n        the 'kraft-burrows-nousek' mode. This number is assumed to be determined\n        from a large region so that the uncertainty on its value is negligible.\n    confidence_level : float, optional\n        Confidence level between 0 and 1; only supported for the\n        'kraft-burrows-nousek' mode.\n\n    Returns\n    -------\n    conf_interval : ndarray\n        ``conf_interval[0]`` and ``conf_interval[1]`` correspond to the lower\n        and upper limits, respectively, for each element in ``n``.\n\n    Notes\n    -----\n\n    The \"right\" confidence interval to use for Poisson data is a\n    matter of debate. The CDF working group `recommends\n    <https://web.archive.org/web/20210222093249/https://www-cdf.fnal.gov/physics/statistics/notes/pois_eb.txt>`_\n    using root-n throughout, largely in the interest of\n    comprehensibility, but discusses other possibilities. The ATLAS\n    group also `discusses\n    <http://www.pp.rhul.ac.uk/~cowan/atlas/ErrorBars.pdf>`_  several\n    possibilities but concludes that no single representation is\n    suitable for all cases.  The suggestion has also been `floated\n    <https://ui.adsabs.harvard.edu/abs/2012EPJP..127...24A>`_ that error\n    bars should be attached to theoretical predictions instead of\n    observed data, which this function will not help with (but it's\n    easy; then you really should use the square root of the theoretical\n    prediction).\n\n    The intervals implemented here are:\n\n    **1. 'root-n'** This is a very widely used standard rule derived\n    from the maximum-likelihood estimator for the mean of the Poisson\n    process. While it produces questionable results for small n and\n    outright wrong results for n=0, it is standard enough that people are\n    (supposedly) used to interpreting these wonky values. The interval is\n\n    .. math::\n\n        CI = (n-\\sqrt{n}, n+\\sqrt{n})\n\n    **2. 'root-n-0'** This is identical to the above except that where\n    n is zero the interval returned is (0,1).\n\n    **3. 'pearson'** This is an only-slightly-more-complicated rule\n    based on Pearson's chi-squared rule (as `explained\n    <https://web.archive.org/web/20210222093249/https://www-cdf.fnal.gov/physics/statistics/notes/pois_eb.txt>`_ by\n    the CDF working group). It also has the nice feature that if your\n    theory curve touches an endpoint of the interval, then your data\n    point is indeed one sigma away. The interval is\n\n    .. math::\n\n        CI = (n+0.5-\\sqrt{n+0.25}, n+0.5+\\sqrt{n+0.25})\n\n    **4. 'sherpagehrels'** This rule is used by default in the fitting\n    package 'sherpa'. The `documentation\n    <https://cxc.harvard.edu/sherpa4.4/statistics/#chigehrels>`_ claims\n    it is based on a numerical approximation published in `Gehrels\n    (1986) <https://ui.adsabs.harvard.edu/abs/1986ApJ...303..336G>`_ but it\n    does not actually appear there.  It is symmetrical, and while the\n    upper limits are within about 1% of those given by\n    'frequentist-confidence', the lower limits can be badly wrong. The\n    interval is\n\n    .. math::\n\n        CI = (n-1-\\sqrt{n+0.75}, n+1+\\sqrt{n+0.75})\n\n    **5. 'frequentist-confidence'** These are frequentist central\n    confidence intervals:\n\n    .. math::\n\n        CI = (0.5 F_{\\chi^2}^{-1}(\\alpha;2n),\n              0.5 F_{\\chi^2}^{-1}(1-\\alpha;2(n+1)))\n\n    where :math:`F_{\\chi^2}^{-1}` is the quantile of the chi-square\n    distribution with the indicated number of degrees of freedom and\n    :math:`\\alpha` is the one-tailed probability of the normal\n    distribution (at the point given by the parameter 'sigma'). See\n    `Maxwell (2011)\n    <https://ui.adsabs.harvard.edu/abs/2011arXiv1102.0822M>`_ for further\n    details.\n\n    **6. 'kraft-burrows-nousek'** This is a Bayesian approach which allows\n    for the presence of a known background :math:`B` in the source signal\n    :math:`N`.\n    For a given confidence level :math:`CL` the confidence interval\n    :math:`[S_\\mathrm{min}, S_\\mathrm{max}]` is given by:\n\n    .. math::\n\n       CL = \\int^{S_\\mathrm{max}}_{S_\\mathrm{min}} f_{N,B}(S)dS\n\n    where the function :math:`f_{N,B}` is:\n\n    .. math::\n\n       f_{N,B}(S) = C \\frac{e^{-(S+B)}(S+B)^N}{N!}\n\n    and the normalization constant :math:`C`:\n\n    .. math::\n\n       C = \\left[ \\int_0^\\infty \\frac{e^{-(S+B)}(S+B)^N}{N!} dS \\right] ^{-1}\n       = \\left( \\sum^N_{n=0} \\frac{e^{-B}B^n}{n!}  \\right)^{-1}\n\n    See `Kraft, Burrows, and Nousek (1991)\n    <https://ui.adsabs.harvard.edu/abs/1991ApJ...374..344K>`_ for further\n    details.\n\n    These formulas implement a positive, uniform prior.\n    `Kraft, Burrows, and Nousek (1991)\n    <https://ui.adsabs.harvard.edu/abs/1991ApJ...374..344K>`_ discuss this\n    choice in more detail and show that the problem is relatively\n    insensitive to the choice of prior.\n\n    This function has an optional dependency: Either `Scipy\n    <https://www.scipy.org/>`_ or `mpmath <http://mpmath.org/>`_  need\n    to be available (Scipy works only for N < 100).\n    This code is very intense numerically, which makes it much slower than\n    the other methods, in particular for large count numbers (above 1000\n    even with ``mpmath``). Fortunately, some of the other methods or a\n    Gaussian approximation usually work well in this regime.\n\n    Examples\n    --------\n    >>> poisson_conf_interval(np.arange(10), interval='root-n').T\n    array([[  0.        ,   0.        ],\n           [  0.        ,   2.        ],\n           [  0.58578644,   3.41421356],\n           [  1.26794919,   4.73205081],\n           [  2.        ,   6.        ],\n           [  2.76393202,   7.23606798],\n           [  3.55051026,   8.44948974],\n           [  4.35424869,   9.64575131],\n           [  5.17157288,  10.82842712],\n           [  6.        ,  12.        ]])\n\n    >>> poisson_conf_interval(np.arange(10), interval='root-n-0').T\n    array([[  0.        ,   1.        ],\n           [  0.        ,   2.        ],\n           [  0.58578644,   3.41421356],\n           [  1.26794919,   4.73205081],\n           [  2.        ,   6.        ],\n           [  2.76393202,   7.23606798],\n           [  3.55051026,   8.44948974],\n           [  4.35424869,   9.64575131],\n           [  5.17157288,  10.82842712],\n           [  6.        ,  12.        ]])\n\n    >>> poisson_conf_interval(np.arange(10), interval='pearson').T\n    array([[  0.        ,   1.        ],\n           [  0.38196601,   2.61803399],\n           [  1.        ,   4.        ],\n           [  1.69722436,   5.30277564],\n           [  2.43844719,   6.56155281],\n           [  3.20871215,   7.79128785],\n           [  4.        ,   9.        ],\n           [  4.8074176 ,  10.1925824 ],\n           [  5.62771868,  11.37228132],\n           [  6.45861873,  12.54138127]])\n\n    >>> poisson_conf_interval(\n    ...     np.arange(10), interval='frequentist-confidence').T\n    array([[  0.        ,   1.84102165],\n           [  0.17275378,   3.29952656],\n           [  0.70818544,   4.63785962],\n           [  1.36729531,   5.91818583],\n           [  2.08566081,   7.16275317],\n           [  2.84030886,   8.38247265],\n           [  3.62006862,   9.58364155],\n           [  4.41852954,  10.77028072],\n           [  5.23161394,  11.94514152],\n           [  6.05653896,  13.11020414]])\n\n    >>> poisson_conf_interval(\n    ...     7, interval='frequentist-confidence').T\n    array([  4.41852954,  10.77028072])\n\n    >>> poisson_conf_interval(\n    ...     10, background=1.5, confidence_level=0.95,\n    ...     interval='kraft-burrows-nousek').T  # doctest: +FLOAT_CMP\n    array([[ 3.47894005, 16.113329533]])\n\n    \"\"\"  # noqa\n\n    if not np.isscalar(n):\n        n = np.asanyarray(n)\n\n    if interval == 'root-n':\n        _check_poisson_conf_inputs(sigma, background, confidence_level, interval)\n        conf_interval = np.array([n - np.sqrt(n),\n                                  n + np.sqrt(n)])\n    elif interval == 'root-n-0':\n        _check_poisson_conf_inputs(sigma, background, confidence_level, interval)\n        conf_interval = np.array([n - np.sqrt(n),\n                                  n + np.sqrt(n)])\n        if np.isscalar(n):\n            if n == 0:\n                conf_interval[1] = 1\n        else:\n            conf_interval[1, n == 0] = 1\n    elif interval == 'pearson':\n        _check_poisson_conf_inputs(sigma, background, confidence_level, interval)\n        conf_interval = np.array([n + 0.5 - np.sqrt(n + 0.25),\n                                  n + 0.5 + np.sqrt(n + 0.25)])\n    elif interval == 'sherpagehrels':\n        _check_poisson_conf_inputs(sigma, background, confidence_level, interval)\n        conf_interval = np.array([n - 1 - np.sqrt(n + 0.75),\n                                  n + 1 + np.sqrt(n + 0.75)])\n    elif interval == 'frequentist-confidence':\n        _check_poisson_conf_inputs(1., background, confidence_level, interval)\n        import scipy.stats\n        alpha = scipy.stats.norm.sf(sigma)\n        conf_interval = np.array([0.5 * scipy.stats.chi2(2 * n).ppf(alpha),\n                                  0.5 * scipy.stats.chi2(2 * n + 2).isf(alpha)])\n        if np.isscalar(n):\n            if n == 0:\n                conf_interval[0] = 0\n        else:\n            conf_interval[0, n == 0] = 0\n    elif interval == 'kraft-burrows-nousek':\n        # Deprecation warning in Python 3.9 when N is float, so we force int,\n        # see https://github.com/astropy/astropy/issues/10832\n        if np.isscalar(n):\n            if not isinstance(n, int):\n                raise TypeError('Number of counts must be integer.')\n        elif not issubclass(n.dtype.type, np.integer):\n            raise TypeError('Number of counts must be integer.')\n\n        if confidence_level is None:\n            raise ValueError('Set confidence_level for method {}. (sigma is '\n                             'ignored.)'.format(interval))\n        confidence_level = np.asanyarray(confidence_level)\n        if np.any(confidence_level <= 0) or np.any(confidence_level >= 1):\n            raise ValueError('confidence_level must be a number between 0 and 1.')\n        background = np.asanyarray(background)\n        if np.any(background < 0):\n            raise ValueError('Background must be >= 0.')\n        conf_interval = np.vectorize(_kraft_burrows_nousek,\n                                     cache=True)(n, background, confidence_level)\n        conf_interval = np.vstack(conf_interval)\n    else:\n        raise ValueError(f\"Invalid method for Poisson confidence intervals: {interval}\")\n    return conf_interval\n\n\ndef median_absolute_deviation(data, axis=None, func=None, ignore_nan=False):\n    \"\"\"\n    Calculate the median absolute deviation (MAD).\n\n    The MAD is defined as ``median(abs(a - median(a)))``.\n\n    Parameters\n    ----------\n    data : array-like\n        Input array or object that can be converted to an array.\n    axis : None, int, or tuple of int, optional\n        The axis or axes along which the MADs are computed.  The default\n        (`None`) is to compute the MAD of the flattened array.\n    func : callable, optional\n        The function used to compute the median. Defaults to `numpy.ma.median`\n        for masked arrays, otherwise to `numpy.median`.\n    ignore_nan : bool\n        Ignore NaN values (treat them as if they are not in the array) when\n        computing the median.  This will use `numpy.ma.median` if ``axis`` is\n        specified, or `numpy.nanmedian` if ``axis==None`` and numpy's version\n        is >1.10 because nanmedian is slightly faster in this case.\n\n    Returns\n    -------\n    mad : float or `~numpy.ndarray`\n        The median absolute deviation of the input array.  If ``axis``\n        is `None` then a scalar will be returned, otherwise a\n        `~numpy.ndarray` will be returned.\n\n    Examples\n    --------\n    Generate random variates from a Gaussian distribution and return the\n    median absolute deviation for that distribution::\n\n        >>> import numpy as np\n        >>> from astropy.stats import median_absolute_deviation\n        >>> rand = np.random.default_rng(12345)\n        >>> from numpy.random import randn\n        >>> mad = median_absolute_deviation(rand.standard_normal(1000))\n        >>> print(mad)    # doctest: +FLOAT_CMP\n        0.6829504282771885\n\n    See Also\n    --------\n    mad_std\n    \"\"\"\n\n    if func is None:\n        # Check if the array has a mask and if so use np.ma.median\n        # See https://github.com/numpy/numpy/issues/7330 why using np.ma.median\n        # for normal arrays should not be done (summary: np.ma.median always\n        # returns an masked array even if the result should be scalar). (#4658)\n        if isinstance(data, np.ma.MaskedArray):\n            is_masked = True\n            func = np.ma.median\n            if ignore_nan:\n                data = np.ma.masked_where(np.isnan(data), data, copy=True)\n        elif ignore_nan:\n            is_masked = False\n            func = np.nanmedian\n        else:\n            is_masked = False\n            func = np.median  # drops units if result is NaN\n    else:\n        is_masked = None\n\n    data = np.asanyarray(data)\n    # np.nanmedian has `keepdims`, which is a good option if we're not allowing\n    # user-passed functions here\n    data_median = func(data, axis=axis)\n    # this conditional can be removed after this PR is merged:\n    # https://github.com/astropy/astropy/issues/12165\n    if (isinstance(data, u.Quantity) and func is np.median\n            and data_median.ndim == 0 and np.isnan(data_median)):\n        data_median = data.__array_wrap__(data_median)\n\n    # broadcast the median array before subtraction\n    if axis is not None:\n        data_median = _expand_dims(data_median, axis=axis)  # NUMPY_LT_1_18\n\n    result = func(np.abs(data - data_median), axis=axis, overwrite_input=True)\n    # this conditional can be removed after this PR is merged:\n    # https://github.com/astropy/astropy/issues/12165\n    if (isinstance(data, u.Quantity) and func is np.median\n            and result.ndim == 0 and np.isnan(result)):\n        result = data.__array_wrap__(result)\n\n    if axis is None and np.ma.isMaskedArray(result):\n        # return scalar version\n        result = result.item()\n    elif np.ma.isMaskedArray(result) and not is_masked:\n        # if the input array was not a masked array, we don't want to return a\n        # masked array\n        result = result.filled(fill_value=np.nan)\n\n    return result\n\n\ndef mad_std(data, axis=None, func=None, ignore_nan=False):\n    r\"\"\"\n    Calculate a robust standard deviation using the `median absolute\n    deviation (MAD)\n    <https://en.wikipedia.org/wiki/Median_absolute_deviation>`_.\n\n    The standard deviation estimator is given by:\n\n    .. math::\n\n        \\sigma \\approx \\frac{\\textrm{MAD}}{\\Phi^{-1}(3/4)}\n            \\approx 1.4826 \\ \\textrm{MAD}\n\n    where :math:`\\Phi^{-1}(P)` is the normal inverse cumulative\n    distribution function evaluated at probability :math:`P = 3/4`.\n\n    Parameters\n    ----------\n    data : array-like\n        Data array or object that can be converted to an array.\n    axis : None, int, or tuple of int, optional\n        The axis or axes along which the robust standard deviations are\n        computed.  The default (`None`) is to compute the robust\n        standard deviation of the flattened array.\n    func : callable, optional\n        The function used to compute the median. Defaults to `numpy.ma.median`\n        for masked arrays, otherwise to `numpy.median`.\n    ignore_nan : bool\n        Ignore NaN values (treat them as if they are not in the array) when\n        computing the median.  This will use `numpy.ma.median` if ``axis`` is\n        specified, or `numpy.nanmedian` if ``axis=None`` and numpy's version is\n        >1.10 because nanmedian is slightly faster in this case.\n\n    Returns\n    -------\n    mad_std : float or `~numpy.ndarray`\n        The robust standard deviation of the input data.  If ``axis`` is\n        `None` then a scalar will be returned, otherwise a\n        `~numpy.ndarray` will be returned.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import mad_std\n    >>> rand = np.random.default_rng(12345)\n    >>> madstd = mad_std(rand.normal(5, 2, (100, 100)))\n    >>> print(madstd)    # doctest: +FLOAT_CMP\n    1.984147963351707\n\n    See Also\n    --------\n    biweight_midvariance, biweight_midcovariance, median_absolute_deviation\n    \"\"\"\n\n    # NOTE: 1. / scipy.stats.norm.ppf(0.75) = 1.482602218505602\n    MAD = median_absolute_deviation(\n        data, axis=axis, func=func, ignore_nan=ignore_nan)\n    return MAD * 1.482602218505602\n\n\ndef signal_to_noise_oir_ccd(t, source_eps, sky_eps, dark_eps, rd, npix,\n                            gain=1.0):\n    \"\"\"Computes the signal to noise ratio for source being observed in the\n    optical/IR using a CCD.\n\n    Parameters\n    ----------\n    t : float or numpy.ndarray\n        CCD integration time in seconds\n    source_eps : float\n        Number of electrons (photons) or DN per second in the aperture from the\n        source. Note that this should already have been scaled by the filter\n        transmission and the quantum efficiency of the CCD. If the input is in\n        DN, then be sure to set the gain to the proper value for the CCD.\n        If the input is in electrons per second, then keep the gain as its\n        default of 1.0.\n    sky_eps : float\n        Number of electrons (photons) or DN per second per pixel from the sky\n        background. Should already be scaled by filter transmission and QE.\n        This must be in the same units as source_eps for the calculation to\n        make sense.\n    dark_eps : float\n        Number of thermal electrons per second per pixel. If this is given in\n        DN or ADU, then multiply by the gain to get the value in electrons.\n    rd : float\n        Read noise of the CCD in electrons. If this is given in\n        DN or ADU, then multiply by the gain to get the value in electrons.\n    npix : float\n        Size of the aperture in pixels\n    gain : float, optional\n        Gain of the CCD. In units of electrons per DN.\n\n    Returns\n    -------\n    SNR : float or numpy.ndarray\n        Signal to noise ratio calculated from the inputs\n    \"\"\"\n    signal = t * source_eps * gain\n    noise = np.sqrt(t * (source_eps * gain + npix *\n                         (sky_eps * gain + dark_eps)) + npix * rd ** 2)\n    return signal / noise\n\n\ndef bootstrap(data, bootnum=100, samples=None, bootfunc=None):\n    \"\"\"Performs bootstrap resampling on numpy arrays.\n\n    Bootstrap resampling is used to understand confidence intervals of sample\n    estimates. This function returns versions of the dataset resampled with\n    replacement (\"case bootstrapping\"). These can all be run through a function\n    or statistic to produce a distribution of values which can then be used to\n    find the confidence intervals.\n\n    Parameters\n    ----------\n    data : ndarray\n        N-D array. The bootstrap resampling will be performed on the first\n        index, so the first index should access the relevant information\n        to be bootstrapped.\n    bootnum : int, optional\n        Number of bootstrap resamples\n    samples : int, optional\n        Number of samples in each resample. The default `None` sets samples to\n        the number of datapoints\n    bootfunc : function, optional\n        Function to reduce the resampled data. Each bootstrap resample will\n        be put through this function and the results returned. If `None`, the\n        bootstrapped data will be returned\n\n    Returns\n    -------\n    boot : ndarray\n\n        If bootfunc is None, then each row is a bootstrap resample of the data.\n        If bootfunc is specified, then the columns will correspond to the\n        outputs of bootfunc.\n\n    Examples\n    --------\n    Obtain a twice resampled array:\n\n    >>> from astropy.stats import bootstrap\n    >>> import numpy as np\n    >>> from astropy.utils import NumpyRNGContext\n    >>> bootarr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])\n    >>> with NumpyRNGContext(1):\n    ...     bootresult = bootstrap(bootarr, 2)\n    ...\n    >>> bootresult  # doctest: +FLOAT_CMP\n    array([[6., 9., 0., 6., 1., 1., 2., 8., 7., 0.],\n           [3., 5., 6., 3., 5., 3., 5., 8., 8., 0.]])\n    >>> bootresult.shape\n    (2, 10)\n\n    Obtain a statistic on the array\n\n    >>> with NumpyRNGContext(1):\n    ...     bootresult = bootstrap(bootarr, 2, bootfunc=np.mean)\n    ...\n    >>> bootresult  # doctest: +FLOAT_CMP\n    array([4. , 4.6])\n\n    Obtain a statistic with two outputs on the array\n\n    >>> test_statistic = lambda x: (np.sum(x), np.mean(x))\n    >>> with NumpyRNGContext(1):\n    ...     bootresult = bootstrap(bootarr, 3, bootfunc=test_statistic)\n    >>> bootresult  # doctest: +FLOAT_CMP\n    array([[40. ,  4. ],\n           [46. ,  4.6],\n           [35. ,  3.5]])\n    >>> bootresult.shape\n    (3, 2)\n\n    Obtain a statistic with two outputs on the array, keeping only the first\n    output\n\n    >>> bootfunc = lambda x:test_statistic(x)[0]\n    >>> with NumpyRNGContext(1):\n    ...     bootresult = bootstrap(bootarr, 3, bootfunc=bootfunc)\n    ...\n    >>> bootresult  # doctest: +FLOAT_CMP\n    array([40., 46., 35.])\n    >>> bootresult.shape\n    (3,)\n\n    \"\"\"\n    if samples is None:\n        samples = data.shape[0]\n\n    # make sure the input is sane\n    if samples < 1 or bootnum < 1:\n        raise ValueError(\"neither 'samples' nor 'bootnum' can be less than 1.\")\n\n    if bootfunc is None:\n        resultdims = (bootnum,) + (samples,) + data.shape[1:]\n    else:\n        # test number of outputs from bootfunc, avoid single outputs which are\n        # array-like\n        try:\n            resultdims = (bootnum, len(bootfunc(data)))\n        except TypeError:\n            resultdims = (bootnum,)\n\n    # create empty boot array\n    boot = np.empty(resultdims)\n\n    for i in range(bootnum):\n        bootarr = np.random.randint(low=0, high=data.shape[0], size=samples)\n        if bootfunc is None:\n            boot[i] = data[bootarr]\n        else:\n            boot[i] = bootfunc(data[bootarr])\n\n    return boot\n\n\ndef _scipy_kraft_burrows_nousek(N, B, CL):\n    '''Upper limit on a poisson count rate\n\n    The implementation is based on Kraft, Burrows and Nousek\n    `ApJ 374, 344 (1991) <https://ui.adsabs.harvard.edu/abs/1991ApJ...374..344K>`_.\n    The XMM-Newton upper limit server uses the same formalism.\n\n    Parameters\n    ----------\n    N : int or np.int32/np.int64\n        Total observed count number\n    B : float or np.float32/np.float64\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float or np.float32/np.float64\n       Confidence level (number between 0 and 1)\n\n    Returns\n    -------\n    S : source count limit\n\n    Notes\n    -----\n    Requires :mod:`~scipy`. This implementation will cause Overflow Errors for\n    about N > 100 (the exact limit depends on details of how scipy was\n    compiled). See `~astropy.stats.mpmath_poisson_upper_limit` for an\n    implementation that is slower, but can deal with arbitrarily high numbers\n    since it is based on the `mpmath <http://mpmath.org/>`_ library.\n    '''\n\n    from scipy.optimize import brentq\n    from scipy.integrate import quad\n    from scipy.special import factorial\n\n    from math import exp\n\n    def eqn8(N, B):\n        n = np.arange(N + 1, dtype=np.float64)\n        return 1. / (exp(-B) * np.sum(np.power(B, n) / factorial(n)))\n\n    # The parameters of eqn8 do not vary between calls so we can calculate the\n    # result once and reuse it. The same is True for the factorial of N.\n    # eqn7 is called hundred times so \"caching\" these values yields a\n    # significant speedup (factor 10).\n    eqn8_res = eqn8(N, B)\n    factorial_N = float(math.factorial(N))\n\n    def eqn7(S, N, B):\n        SpB = S + B\n        return eqn8_res * (exp(-SpB) * SpB**N / factorial_N)\n\n    def eqn9_left(S_min, S_max, N, B):\n        return quad(eqn7, S_min, S_max, args=(N, B), limit=500)\n\n    def find_s_min(S_max, N, B):\n        '''\n        Kraft, Burrows and Nousek suggest to integrate from N-B in both\n        directions at once, so that S_min and S_max move similarly (see\n        the article for details). Here, this is implemented differently:\n        Treat S_max as the optimization parameters in func and then\n        calculate the matching s_min that has has eqn7(S_max) =\n        eqn7(S_min) here.\n        '''\n        y_S_max = eqn7(S_max, N, B)\n        if eqn7(0, N, B) >= y_S_max:\n            return 0.\n        else:\n            return brentq(lambda x: eqn7(x, N, B) - y_S_max, 0, N - B)\n\n    def func(s):\n        s_min = find_s_min(s, N, B)\n        out = eqn9_left(s_min, s, N, B)\n        return out[0] - CL\n\n    S_max = brentq(func, N - B, 100)\n    S_min = find_s_min(S_max, N, B)\n    return S_min, S_max\n\n\ndef _mpmath_kraft_burrows_nousek(N, B, CL):\n    '''Upper limit on a poisson count rate\n\n    The implementation is based on Kraft, Burrows and Nousek in\n    `ApJ 374, 344 (1991) <https://ui.adsabs.harvard.edu/abs/1991ApJ...374..344K>`_.\n    The XMM-Newton upper limit server used the same formalism.\n\n    Parameters\n    ----------\n    N : int or np.int32/np.int64\n        Total observed count number\n    B : float or np.float32/np.float64\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float or np.float32/np.float64\n       Confidence level (number between 0 and 1)\n\n    Returns\n    -------\n    S : source count limit\n\n    Notes\n    -----\n    Requires the `mpmath <http://mpmath.org/>`_ library.  See\n    `~astropy.stats.scipy_poisson_upper_limit` for an implementation\n    that is based on scipy and evaluates faster, but runs only to about\n    N = 100.\n    '''\n    from mpmath import mpf, factorial, findroot, fsum, power, exp, quad\n\n    # We convert these values to float. Because for some reason,\n    # mpmath.mpf cannot convert from numpy.int64\n    N = mpf(float(N))\n    B = mpf(float(B))\n    CL = mpf(float(CL))\n    tol = 1e-4\n\n    def eqn8(N, B):\n        sumterms = [power(B, n) / factorial(n) for n in range(int(N) + 1)]\n        return 1. / (exp(-B) * fsum(sumterms))\n\n    eqn8_res = eqn8(N, B)\n    factorial_N = factorial(N)\n\n    def eqn7(S, N, B):\n        SpB = S + B\n        return eqn8_res * (exp(-SpB) * SpB**N / factorial_N)\n\n    def eqn9_left(S_min, S_max, N, B):\n        def eqn7NB(S):\n            return eqn7(S, N, B)\n        return quad(eqn7NB, [S_min, S_max])\n\n    def find_s_min(S_max, N, B):\n        '''\n        Kraft, Burrows and Nousek suggest to integrate from N-B in both\n        directions at once, so that S_min and S_max move similarly (see\n        the article for details). Here, this is implemented differently:\n        Treat S_max as the optimization parameters in func and then\n        calculate the matching s_min that has has eqn7(S_max) =\n        eqn7(S_min) here.\n        '''\n        y_S_max = eqn7(S_max, N, B)\n        # If B > N, then N-B, the \"most probable\" values is < 0\n        # and thus s_min is certainly 0.\n        # Note: For small N, s_max is also close to 0 and root finding\n        # might find the wrong root, thus it is important to handle this\n        # case here and return the analytical answer (s_min = 0).\n        if (B >= N) or (eqn7(0, N, B) >= y_S_max):\n            return 0.\n        else:\n            def eqn7ysmax(x):\n                return eqn7(x, N, B) - y_S_max\n            return findroot(eqn7ysmax, [0., N - B], solver='ridder',\n                            tol=tol)\n\n    def func(s):\n        s_min = find_s_min(s, N, B)\n        out = eqn9_left(s_min, s, N, B)\n        return out - CL\n\n    # Several numerical problems were found prevent the solvers from finding\n    # the roots unless the starting values are very close to the final values.\n    # Thus, this primitive, time-wasting, brute-force stepping here to get\n    # an interval that can be fed into the ridder solver.\n    s_max_guess = max(N - B, 1.)\n    while func(s_max_guess) < 0:\n        s_max_guess += 1\n    S_max = findroot(func, [s_max_guess - 1, s_max_guess], solver='ridder',\n                     tol=tol)\n    S_min = find_s_min(S_max, N, B)\n    return float(S_min), float(S_max)\n\n\ndef _kraft_burrows_nousek(N, B, CL):\n    '''Upper limit on a poisson count rate\n\n    The implementation is based on Kraft, Burrows and Nousek in\n    `ApJ 374, 344 (1991) <https://ui.adsabs.harvard.edu/abs/1991ApJ...374..344K>`_.\n    The XMM-Newton upper limit server used the same formalism.\n\n    Parameters\n    ----------\n    N : int or np.int32/np.int64\n        Total observed count number\n    B : float or np.float32/np.float64\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float or np.float32/np.float64\n       Confidence level (number between 0 and 1)\n\n    Returns\n    -------\n    S : source count limit\n\n    Notes\n    -----\n    This functions has an optional dependency: Either :mod:`scipy` or `mpmath\n    <http://mpmath.org/>`_  need to be available. (Scipy only works for\n    N < 100).\n    '''\n    from astropy.utils.compat.optional_deps import HAS_SCIPY, HAS_MPMATH\n\n    if HAS_SCIPY and N <= 100:\n        try:\n            return _scipy_kraft_burrows_nousek(N, B, CL)\n        except OverflowError:\n            if not HAS_MPMATH:\n                raise ValueError('Need mpmath package for input numbers this '\n                                 'large.')\n    if HAS_MPMATH:\n        return _mpmath_kraft_burrows_nousek(N, B, CL)\n\n    raise ImportError('Either scipy or mpmath are required.')\n\n\ndef kuiper_false_positive_probability(D, N):\n    \"\"\"Compute the false positive probability for the Kuiper statistic.\n\n    Uses the set of four formulas described in Paltani 2004; they report\n    the resulting function never underestimates the false positive\n    probability but can be a bit high in the N=40..50 range.\n    (They quote a factor 1.5 at the 1e-7 level.)\n\n    Parameters\n    ----------\n    D : float\n        The Kuiper test score.\n    N : float\n        The effective sample size.\n\n    Returns\n    -------\n    fpp : float\n        The probability of a score this large arising from the null hypothesis.\n\n    Notes\n    -----\n    Eq 7 of Paltani 2004 appears to incorrectly quote the original formula\n    (Stephens 1965). This function implements the original formula, as it\n    produces a result closer to Monte Carlo simulations.\n\n    References\n    ----------\n\n    .. [1] Paltani, S., \"Searching for periods in X-ray observations using\n           Kuiper's test. Application to the ROSAT PSPC archive\",\n           Astronomy and Astrophysics, v.240, p.789-790, 2004.\n\n    .. [2] Stephens, M. A., \"The goodness-of-fit statistic VN: distribution\n           and significance points\", Biometrika, v.52, p.309, 1965.\n\n    \"\"\"\n    try:\n        from scipy.special import factorial, comb\n    except ImportError:\n        # Retained for backwards compatibility with older versions of scipy\n        # (factorial appears to have moved here in 0.14)\n        from scipy.misc import factorial, comb\n\n    if D < 0. or D > 2.:\n        raise ValueError(\"Must have 0<=D<=2 by definition of the Kuiper test\")\n\n    if D < 2. / N:\n        return 1. - factorial(N) * (D - 1. / N)**(N - 1)\n    elif D < 3. / N:\n        k = -(N * D - 1.) / 2.\n        r = np.sqrt(k**2 - (N * D - 2.)**2 / 2.)\n        a, b = -k + r, -k - r\n        return 1 - (factorial(N - 1) * (b**(N - 1) * (1 - a) - a**(N - 1) * (1 - b))\n                    / N**(N - 2) / (b - a))\n    elif (D > 0.5 and N % 2 == 0) or (D > (N - 1.) / (2. * N) and N % 2 == 1):\n        # NOTE: the upper limit of this sum is taken from Stephens 1965\n        t = np.arange(np.floor(N * (1 - D)) + 1)\n        y = D + t / N\n        Tt = y**(t - 3) * (y**3 * N\n                           - y**2 * t * (3 - 2 / N)\n                           + y * t * (t - 1) * (3 - 2 / N) / N\n                           - t * (t - 1) * (t - 2) / N**2)\n        term1 = comb(N, t)\n        term2 = (1 - D - t / N)**(N - t - 1)\n        # term1 is formally finite, but is approximated by numpy as np.inf for\n        # large values, so we set them to zero manually when they would be\n        # multiplied by zero anyway\n        term1[(term1 == np.inf) & (term2 == 0)] = 0.\n        final_term = Tt * term1 * term2\n        return final_term.sum()\n    else:\n        z = D * np.sqrt(N)\n        # When m*z>18.82 (sqrt(-log(finfo(double))/2)), exp(-2m**2z**2)\n        # underflows.  Cutting off just before avoids triggering a (pointless)\n        # underflow warning if `under=\"warn\"`.\n        ms = np.arange(1, 18.82 / z)\n        S1 = (2 * (4 * ms**2 * z**2 - 1) * np.exp(-2 * ms**2 * z**2)).sum()\n        S2 = (ms**2 * (4 * ms**2 * z**2 - 3) * np.exp(-2 * ms**2 * z**2)).sum()\n        return S1 - 8 * D / 3 * S2\n\n\ndef kuiper(data, cdf=lambda x: x, args=()):\n    \"\"\"Compute the Kuiper statistic.\n\n    Use the Kuiper statistic version of the Kolmogorov-Smirnov test to\n    find the probability that a sample like ``data`` was drawn from the\n    distribution whose CDF is given as ``cdf``.\n\n    .. warning::\n        This will not work correctly for distributions that are actually\n        discrete (Poisson, for example).\n\n    Parameters\n    ----------\n    data : array-like\n        The data values.\n    cdf : callable\n        A callable to evaluate the CDF of the distribution being tested\n        against. Will be called with a vector of all values at once.\n        The default is a uniform distribution.\n    args : list-like, optional\n        Additional arguments to be supplied to cdf.\n\n    Returns\n    -------\n    D : float\n        The raw statistic.\n    fpp : float\n        The probability of a D this large arising with a sample drawn from\n        the distribution whose CDF is cdf.\n\n    Notes\n    -----\n    The Kuiper statistic resembles the Kolmogorov-Smirnov test in that\n    it is nonparametric and invariant under reparameterizations of the data.\n    The Kuiper statistic, in addition, is equally sensitive throughout\n    the domain, and it is also invariant under cyclic permutations (making\n    it particularly appropriate for analyzing circular data).\n\n    Returns (D, fpp), where D is the Kuiper D number and fpp is the\n    probability that a value as large as D would occur if data was\n    drawn from cdf.\n\n    .. warning::\n        The fpp is calculated only approximately, and it can be\n        as much as 1.5 times the true value.\n\n    Stephens 1970 claims this is more effective than the KS at detecting\n    changes in the variance of a distribution; the KS is (he claims) more\n    sensitive at detecting changes in the mean.\n\n    If cdf was obtained from data by fitting, then fpp is not correct and\n    it will be necessary to do Monte Carlo simulations to interpret D.\n    D should normally be independent of the shape of CDF.\n\n    References\n    ----------\n\n    .. [1] Stephens, M. A., \"Use of the Kolmogorov-Smirnov, Cramer-Von Mises\n           and Related Statistics Without Extensive Tables\", Journal of the\n           Royal Statistical Society. Series B (Methodological), Vol. 32,\n           No. 1. (1970), pp. 115-122.\n\n\n    \"\"\"\n\n    data = np.sort(data)\n    cdfv = cdf(data, *args)\n    N = len(data)\n    D = (np.amax(cdfv - np.arange(N) / float(N)) +\n         np.amax((np.arange(N) + 1) / float(N) - cdfv))\n\n    return D, kuiper_false_positive_probability(D, N)\n\n\ndef kuiper_two(data1, data2):\n    \"\"\"Compute the Kuiper statistic to compare two samples.\n\n    Parameters\n    ----------\n    data1 : array-like\n        The first set of data values.\n    data2 : array-like\n        The second set of data values.\n\n    Returns\n    -------\n    D : float\n        The raw test statistic.\n    fpp : float\n        The probability of obtaining two samples this different from\n        the same distribution.\n\n    .. warning::\n        The fpp is quite approximate, especially for small samples.\n\n    \"\"\"\n    data1 = np.sort(data1)\n    data2 = np.sort(data2)\n    n1, = data1.shape\n    n2, = data2.shape\n    common_type = np.find_common_type([], [data1.dtype, data2.dtype])\n    if not (np.issubdtype(common_type, np.number)\n            and not np.issubdtype(common_type, np.complexfloating)):\n        raise ValueError('kuiper_two only accepts real inputs')\n    # nans, if any, are at the end after sorting.\n    if np.isnan(data1[-1]) or np.isnan(data2[-1]):\n        raise ValueError('kuiper_two only accepts non-nan inputs')\n    D = _stats.ks_2samp(np.asarray(data1, common_type),\n                        np.asarray(data2, common_type))\n    Ne = len(data1) * len(data2) / float(len(data1) + len(data2))\n    return D, kuiper_false_positive_probability(D, Ne)\n\n\ndef fold_intervals(intervals):\n    \"\"\"Fold the weighted intervals to the interval (0,1).\n\n    Convert a list of intervals (ai, bi, wi) to a list of non-overlapping\n    intervals covering (0,1). Each output interval has a weight equal\n    to the sum of the wis of all the intervals that include it. All intervals\n    are interpreted modulo 1, and weights are accumulated counting\n    multiplicity. This is appropriate, for example, if you have one or more\n    blocks of observation and you want to determine how much observation\n    time was spent on different parts of a system's orbit (the blocks\n    should be converted to units of the orbital period first).\n\n    Parameters\n    ----------\n    intervals : list of (3,) tuple\n        For each tuple (ai,bi,wi); ai and bi are the limits of the interval,\n        and wi is the weight to apply to the interval.\n\n    Returns\n    -------\n    breaks : (N,) array of float\n        The endpoints of a set of intervals covering [0,1]; breaks[0]=0 and\n        breaks[-1] = 1\n    weights : (N-1,) array of float\n        The ith element is the sum of number of times the interval\n        breaks[i],breaks[i+1] is included in each interval times the weight\n        associated with that interval.\n\n    \"\"\"\n    r = []\n    breaks = set()\n    tot = 0\n    for (a, b, wt) in intervals:\n        tot += (np.ceil(b) - np.floor(a)) * wt\n        fa = a % 1\n        breaks.add(fa)\n        r.append((0, fa, -wt))\n        fb = b % 1\n        breaks.add(fb)\n        r.append((fb, 1, -wt))\n\n    breaks.add(0.)\n    breaks.add(1.)\n    breaks = sorted(breaks)\n    breaks_map = dict([(f, i) for (i, f) in enumerate(breaks)])\n    totals = np.zeros(len(breaks) - 1)\n    totals += tot\n    for (a, b, wt) in r:\n        totals[breaks_map[a]:breaks_map[b]] += wt\n    return np.array(breaks), totals\n\n\ndef cdf_from_intervals(breaks, totals):\n    \"\"\"Construct a callable piecewise-linear CDF from a pair of arrays.\n\n    Take a pair of arrays in the format returned by fold_intervals and\n    make a callable cumulative distribution function on the interval\n    (0,1).\n\n    Parameters\n    ----------\n    breaks : (N,) array of float\n        The boundaries of successive intervals.\n    totals : (N-1,) array of float\n        The weight for each interval.\n\n    Returns\n    -------\n    f : callable\n        A cumulative distribution function corresponding to the\n        piecewise-constant probability distribution given by breaks, weights\n\n    \"\"\"\n    if breaks[0] != 0 or breaks[-1] != 1:\n        raise ValueError(\"Intervals must be restricted to [0,1]\")\n    if np.any(np.diff(breaks) <= 0):\n        raise ValueError(\"Breaks must be strictly increasing\")\n    if np.any(totals < 0):\n        raise ValueError(\n            \"Total weights in each subinterval must be nonnegative\")\n    if np.all(totals == 0):\n        raise ValueError(\"At least one interval must have positive exposure\")\n    b = breaks.copy()\n    c = np.concatenate(((0,), np.cumsum(totals * np.diff(b))))\n    c /= c[-1]\n    return lambda x: np.interp(x, b, c, 0, 1)\n\n\ndef interval_overlap_length(i1, i2):\n    \"\"\"Compute the length of overlap of two intervals.\n\n    Parameters\n    ----------\n    i1, i2 : (float, float)\n        The two intervals, (interval 1, interval 2).\n\n    Returns\n    -------\n    l : float\n        The length of the overlap between the two intervals.\n\n    \"\"\"\n    (a, b) = i1\n    (c, d) = i2\n    if a < c:\n        if b < c:\n            return 0.\n        elif b < d:\n            return b - c\n        else:\n            return d - c\n    elif a < d:\n        if b < d:\n            return b - a\n        else:\n            return d - a\n    else:\n        return 0\n\n\ndef histogram_intervals(n, breaks, totals):\n    \"\"\"Histogram of a piecewise-constant weight function.\n\n    This function takes a piecewise-constant weight function and\n    computes the average weight in each histogram bin.\n\n    Parameters\n    ----------\n    n : int\n        The number of bins\n    breaks : (N,) array of float\n        Endpoints of the intervals in the PDF\n    totals : (N-1,) array of float\n        Probability densities in each bin\n\n    Returns\n    -------\n    h : array of float\n        The average weight for each bin\n\n    \"\"\"\n    h = np.zeros(n)\n    start = breaks[0]\n    for i in range(len(totals)):\n        end = breaks[i + 1]\n        for j in range(n):\n            ol = interval_overlap_length((float(j) / n,\n                                          float(j + 1) / n), (start, end))\n            h[j] += ol / (1. / n) * totals[i]\n        start = end\n\n    return h\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":484,"id":8347,"name":"name","nodeType":"Attribute","startLoc":484,"text":"name"},{"attributeType":"null","col":8,"comment":"null","endLoc":488,"id":8348,"name":"jd1","nodeType":"Attribute","startLoc":488,"text":"self.jd1"},{"col":0,"comment":"\n    Transform pixel coordinates in a dataset with a WCS to pixel coordinates\n    in another dataset with a different WCS.\n\n    This function is designed to efficiently deal with input pixel arrays that\n    are broadcasted views of smaller arrays, and is compatible with any\n    APE14-compliant WCS.\n\n    Parameters\n    ----------\n    wcs_in : `~astropy.wcs.wcsapi.BaseHighLevelWCS`\n        A WCS object for the original dataset which complies with the\n        high-level shared APE 14 WCS API.\n    wcs_out : `~astropy.wcs.wcsapi.BaseHighLevelWCS`\n        A WCS object for the target dataset which complies with the\n        high-level shared APE 14 WCS API.\n    *inputs :\n        Scalars or arrays giving the pixel coordinates to transform.\n    ","endLoc":836,"header":"def pixel_to_pixel(wcs_in, wcs_out, *inputs)","id":8349,"name":"pixel_to_pixel","nodeType":"Function","startLoc":775,"text":"def pixel_to_pixel(wcs_in, wcs_out, *inputs):\n    \"\"\"\n    Transform pixel coordinates in a dataset with a WCS to pixel coordinates\n    in another dataset with a different WCS.\n\n    This function is designed to efficiently deal with input pixel arrays that\n    are broadcasted views of smaller arrays, and is compatible with any\n    APE14-compliant WCS.\n\n    Parameters\n    ----------\n    wcs_in : `~astropy.wcs.wcsapi.BaseHighLevelWCS`\n        A WCS object for the original dataset which complies with the\n        high-level shared APE 14 WCS API.\n    wcs_out : `~astropy.wcs.wcsapi.BaseHighLevelWCS`\n        A WCS object for the target dataset which complies with the\n        high-level shared APE 14 WCS API.\n    *inputs :\n        Scalars or arrays giving the pixel coordinates to transform.\n    \"\"\"\n\n    # Shortcut for scalars\n    if np.isscalar(inputs[0]):\n        world_outputs = wcs_in.pixel_to_world(*inputs)\n        if not isinstance(world_outputs, (tuple, list)):\n            world_outputs = (world_outputs,)\n        return wcs_out.world_to_pixel(*world_outputs)\n\n    # Remember original shape\n    original_shape = inputs[0].shape\n\n    matrix = _pixel_to_pixel_correlation_matrix(wcs_in, wcs_out)\n    split_info = _split_matrix(matrix)\n\n    outputs = [None] * wcs_out.pixel_n_dim\n\n    for (pixel_in_indices, pixel_out_indices) in split_info:\n\n        pixel_inputs = []\n        for ipix in range(wcs_in.pixel_n_dim):\n            if ipix in pixel_in_indices:\n                pixel_inputs.append(unbroadcast(inputs[ipix]))\n            else:\n                pixel_inputs.append(inputs[ipix].flat[0])\n\n        pixel_inputs = np.broadcast_arrays(*pixel_inputs)\n\n        world_outputs = wcs_in.pixel_to_world(*pixel_inputs)\n\n        if not isinstance(world_outputs, (tuple, list)):\n            world_outputs = (world_outputs,)\n\n        pixel_outputs = wcs_out.world_to_pixel(*world_outputs)\n\n        if wcs_out.pixel_n_dim == 1:\n            pixel_outputs = (pixel_outputs,)\n\n        for ipix in range(wcs_out.pixel_n_dim):\n            if ipix in pixel_out_indices:\n                outputs[ipix] = np.broadcast_to(pixel_outputs[ipix], original_shape)\n\n    return outputs[0] if wcs_out.pixel_n_dim == 1 else outputs"},{"attributeType":"null","col":18,"comment":"null","endLoc":488,"id":8350,"name":"jd2","nodeType":"Attribute","startLoc":488,"text":"self.jd2"},{"className":"TimeUnique","col":0,"comment":"\n    Base class for time formats that can uniquely create a time object\n    without requiring an explicit format specifier.  This class does\n    nothing but provide inheritance to identify a class as unique.\n    ","endLoc":858,"id":8351,"nodeType":"Class","startLoc":853,"text":"class TimeUnique(TimeFormat):\n    \"\"\"\n    Base class for time formats that can uniquely create a time object\n    without requiring an explicit format specifier.  This class does\n    nothing but provide inheritance to identify a class as unique.\n    \"\"\""},{"className":"TimeAstropyTime","col":0,"comment":"\n    Instantiate date from an Astropy Time object (or list thereof).\n\n    This is purely for instantiating from a Time object.  The output\n    format is the same as the first time instance.\n    ","endLoc":918,"id":8352,"nodeType":"Class","startLoc":861,"text":"class TimeAstropyTime(TimeUnique):\n    \"\"\"\n    Instantiate date from an Astropy Time object (or list thereof).\n\n    This is purely for instantiating from a Time object.  The output\n    format is the same as the first time instance.\n    \"\"\"\n    name = 'astropy_time'\n\n    def __new__(cls, val1, val2, scale, precision,\n                in_subfmt, out_subfmt, from_jd=False):\n        \"\"\"\n        Use __new__ instead of __init__ to output a class instance that\n        is the same as the class of the first Time object in the list.\n        \"\"\"\n        val1_0 = val1.flat[0]\n        if not (isinstance(val1_0, Time) and all(type(val) is type(val1_0)\n                                                 for val in val1.flat)):\n            raise TypeError('Input values for {} class must all be same '\n                            'astropy Time type.'.format(cls.name))\n\n        if scale is None:\n            scale = val1_0.scale\n\n        if val1.shape:\n            vals = [getattr(val, scale)._time for val in val1]\n            jd1 = np.concatenate([np.atleast_1d(val.jd1) for val in vals])\n            jd2 = np.concatenate([np.atleast_1d(val.jd2) for val in vals])\n\n            # Collect individual location values and merge into a single location.\n            if any(tm.location is not None for tm in val1):\n                if any(tm.location is None for tm in val1):\n                    raise ValueError('cannot concatenate times unless all locations '\n                                     'are set or no locations are set')\n                locations = []\n                for tm in val1:\n                    location = np.broadcast_to(tm.location, tm._time.jd1.shape,\n                                               subok=True)\n                    locations.append(np.atleast_1d(location))\n\n                location = np.concatenate(locations)\n\n            else:\n                location = None\n        else:\n            val = getattr(val1_0, scale)._time\n            jd1, jd2 = val.jd1, val.jd2\n            location = val1_0.location\n\n        OutTimeFormat = val1_0._time.__class__\n        self = OutTimeFormat(jd1, jd2, scale, precision, in_subfmt, out_subfmt,\n                             from_jd=True)\n\n        # Make a temporary hidden attribute to transfer location back to the\n        # parent Time object where it needs to live.\n        self._location = location\n\n        return self"},{"col":4,"comment":"\n        Use __new__ instead of __init__ to output a class instance that\n        is the same as the class of the first Time object in the list.\n        ","endLoc":918,"header":"def __new__(cls, val1, val2, scale, precision,\n                in_subfmt, out_subfmt, from_jd=False)","id":8353,"name":"__new__","nodeType":"Function","startLoc":870,"text":"def __new__(cls, val1, val2, scale, precision,\n                in_subfmt, out_subfmt, from_jd=False):\n        \"\"\"\n        Use __new__ instead of __init__ to output a class instance that\n        is the same as the class of the first Time object in the list.\n        \"\"\"\n        val1_0 = val1.flat[0]\n        if not (isinstance(val1_0, Time) and all(type(val) is type(val1_0)\n                                                 for val in val1.flat)):\n            raise TypeError('Input values for {} class must all be same '\n                            'astropy Time type.'.format(cls.name))\n\n        if scale is None:\n            scale = val1_0.scale\n\n        if val1.shape:\n            vals = [getattr(val, scale)._time for val in val1]\n            jd1 = np.concatenate([np.atleast_1d(val.jd1) for val in vals])\n            jd2 = np.concatenate([np.atleast_1d(val.jd2) for val in vals])\n\n            # Collect individual location values and merge into a single location.\n            if any(tm.location is not None for tm in val1):\n                if any(tm.location is None for tm in val1):\n                    raise ValueError('cannot concatenate times unless all locations '\n                                     'are set or no locations are set')\n                locations = []\n                for tm in val1:\n                    location = np.broadcast_to(tm.location, tm._time.jd1.shape,\n                                               subok=True)\n                    locations.append(np.atleast_1d(location))\n\n                location = np.concatenate(locations)\n\n            else:\n                location = None\n        else:\n            val = getattr(val1_0, scale)._time\n            jd1, jd2 = val.jd1, val.jd2\n            location = val1_0.location\n\n        OutTimeFormat = val1_0._time.__class__\n        self = OutTimeFormat(jd1, jd2, scale, precision, in_subfmt, out_subfmt,\n                             from_jd=True)\n\n        # Make a temporary hidden attribute to transfer location back to the\n        # parent Time object where it needs to live.\n        self._location = location\n\n        return self"},{"col":4,"comment":"null","endLoc":228,"header":"def unregister(self)","id":8354,"name":"unregister","nodeType":"Function","startLoc":223,"text":"def unregister(self):\n        # We have to hold the registration lock if the client is callable\n        # to avoid a race condition where the client queries the hub for\n        # pushCallbacks after it has already been unregistered from the hub\n        with self._registration_lock:\n            super().unregister()"},{"attributeType":"None","col":8,"comment":"null","endLoc":147,"id":8355,"name":"_hub_id","nodeType":"Attribute","startLoc":147,"text":"self._hub_id"},{"attributeType":"None","col":8,"comment":"null","endLoc":145,"id":8356,"name":"_public_id","nodeType":"Attribute","startLoc":145,"text":"self._public_id"},{"attributeType":"null","col":8,"comment":"null","endLoc":156,"id":8357,"name":"_registered_event","nodeType":"Attribute","startLoc":156,"text":"self._registered_event"},{"attributeType":"None","col":8,"comment":"null","endLoc":146,"id":8358,"name":"_private_key","nodeType":"Attribute","startLoc":146,"text":"self._private_key"},{"col":4,"comment":"null","endLoc":159,"header":"@property\n    def in_subfmt(self)","id":8359,"name":"in_subfmt","nodeType":"Function","startLoc":157,"text":"@property\n    def in_subfmt(self):\n        return self._in_subfmt"},{"col":4,"comment":"null","endLoc":165,"header":"@in_subfmt.setter\n    def in_subfmt(self, subfmt)","id":8360,"name":"in_subfmt","nodeType":"Function","startLoc":161,"text":"@in_subfmt.setter\n    def in_subfmt(self, subfmt):\n        # Validate subfmt value for this class, raises ValueError if not.\n        self._select_subfmts(subfmt)\n        self._in_subfmt = subfmt"},{"col":4,"comment":"null","endLoc":169,"header":"@property\n    def out_subfmt(self)","id":8361,"name":"out_subfmt","nodeType":"Function","startLoc":167,"text":"@property\n    def out_subfmt(self):\n        return self._out_subfmt"},{"col":4,"comment":"null","endLoc":175,"header":"@out_subfmt.setter\n    def out_subfmt(self, subfmt)","id":8362,"name":"out_subfmt","nodeType":"Function","startLoc":171,"text":"@out_subfmt.setter\n    def out_subfmt(self, subfmt):\n        # Validate subfmt value for this class, raises ValueError if not.\n        self._select_subfmts(subfmt)\n        self._out_subfmt = subfmt"},{"col":4,"comment":"null","endLoc":179,"header":"@property\n    def jd1(self)","id":8363,"name":"jd1","nodeType":"Function","startLoc":177,"text":"@property\n    def jd1(self):\n        return self._jd1"},{"col":4,"comment":"null","endLoc":185,"header":"@jd1.setter\n    def jd1(self, jd1)","id":8364,"name":"jd1","nodeType":"Function","startLoc":181,"text":"@jd1.setter\n    def jd1(self, jd1):\n        self._jd1 = _validate_jd_for_storage(jd1)\n        if self._jd2 is not None:\n            self._jd1, self._jd2 = _broadcast_writeable(self._jd1, self._jd2)"},{"col":0,"comment":"null","endLoc":1922,"header":"def _validate_jd_for_storage(jd)","id":8365,"name":"_validate_jd_for_storage","nodeType":"Function","startLoc":1908,"text":"def _validate_jd_for_storage(jd):\n    if isinstance(jd, (float, int)):\n        return np.array(jd, dtype=np.float_)\n    if (isinstance(jd, np.generic)\n        and (jd.dtype.kind == 'f' and jd.dtype.itemsize <= 8\n             or jd.dtype.kind in 'iu')):\n        return np.array(jd, dtype=np.float_)\n    elif (isinstance(jd, np.ndarray)\n          and jd.dtype.kind == 'f'\n          and jd.dtype.itemsize == 8):\n        return jd\n    else:\n        raise TypeError(\n            f\"JD values must be arrays (possibly zero-dimensional) \"\n            f\"of floats but we got {jd!r} of type {type(jd)}\")"},{"col":4,"comment":"null","endLoc":517,"header":"def _join_all_threads(self, timeout=None)","id":8366,"name":"_join_all_threads","nodeType":"Function","startLoc":499,"text":"def _join_all_threads(self, timeout=None):\n        # In some cases, ``stop`` may be called from some of the sub-threads,\n        # so we just need to make sure that we don't try and shut down the\n        # calling thread.\n        current_thread = threading.current_thread()\n        if self._thread_run is not current_thread:\n            self._thread_run.join(timeout=timeout)\n            if not self._thread_run.is_alive():\n                self._thread_run = None\n        if self._thread_hub_timeout is not None and self._thread_hub_timeout is not current_thread:\n            self._thread_hub_timeout.join(timeout=timeout)\n            if not self._thread_hub_timeout.is_alive():\n                self._thread_hub_timeout = None\n        if self._thread_client_timeout is not None and self._thread_client_timeout is not current_thread:\n            self._thread_client_timeout.join(timeout=timeout)\n            if not self._thread_client_timeout.is_alive():\n                self._thread_client_timeout = None\n\n        self._join_launched_threads(timeout=timeout)"},{"col":4,"comment":"null","endLoc":337,"header":"def _timeout_test_client(self)","id":8367,"name":"_timeout_test_client","nodeType":"Function","startLoc":319,"text":"def _timeout_test_client(self):\n\n        if self._client_timeout == 0:\n            return\n\n        last = time.time()\n        while self._is_running:\n            time.sleep(0.05)  # keep this small to check _is_running often\n            now = time.time()\n            if now - last > 1.:\n                for private_key in self._client_activity_time.keys():\n                    if (now - self._client_activity_time[private_key] > self._client_timeout\n                        and private_key != self._hub_private_key):\n                        warnings.warn(\n                            f\"Client {private_key} timeout expired!\",\n                            SAMPWarning)\n                        self._notify_disconnection(private_key)\n                        self._unregister(private_key)\n                last = now"},{"col":0,"comment":"null","endLoc":1943,"header":"def _broadcast_writeable(jd1, jd2)","id":8368,"name":"_broadcast_writeable","nodeType":"Function","startLoc":1925,"text":"def _broadcast_writeable(jd1, jd2):\n    if jd1.shape == jd2.shape:\n        return jd1, jd2\n    # When using broadcast_arrays, *both* are flagged with\n    # warn-on-write, even the one that wasn't modified, and\n    # require \"C\" only clears the flag if it actually copied\n    # anything.\n    shape = np.broadcast(jd1, jd2).shape\n    if jd1.shape == shape:\n        s_jd1 = jd1\n    else:\n        s_jd1 = np.require(np.broadcast_to(jd1, shape),\n                           requirements=[\"C\", \"W\"])\n    if jd2.shape == shape:\n        s_jd2 = jd2\n    else:\n        s_jd2 = np.require(np.broadcast_to(jd2, shape),\n                           requirements=[\"C\", \"W\"])\n    return s_jd1, s_jd2"},{"col":4,"comment":"null","endLoc":189,"header":"@property\n    def jd2(self)","id":8369,"name":"jd2","nodeType":"Function","startLoc":187,"text":"@property\n    def jd2(self):\n        return self._jd2"},{"col":4,"comment":"null","endLoc":195,"header":"@jd2.setter\n    def jd2(self, jd2)","id":8370,"name":"jd2","nodeType":"Function","startLoc":191,"text":"@jd2.setter\n    def jd2(self, jd2):\n        self._jd2 = _validate_jd_for_storage(jd2)\n        if self._jd1 is not None:\n            self._jd1, self._jd2 = _broadcast_writeable(self._jd1, self._jd2)"},{"col":4,"comment":"null","endLoc":198,"header":"def __len__(self)","id":8371,"name":"__len__","nodeType":"Function","startLoc":197,"text":"def __len__(self):\n        return len(self.jd1)"},{"col":4,"comment":"Time scale","endLoc":204,"header":"@property\n    def scale(self)","id":8372,"name":"scale","nodeType":"Function","startLoc":200,"text":"@property\n    def scale(self):\n        \"\"\"Time scale\"\"\"\n        self._scale = self._check_scale(self._scale)\n        return self._scale"},{"attributeType":"null","col":8,"comment":"null","endLoc":127,"id":8373,"name":"_is_running","nodeType":"Attribute","startLoc":127,"text":"self._is_running"},{"attributeType":"null","col":8,"comment":"null","endLoc":148,"id":8374,"name":"_notification_bindings","nodeType":"Attribute","startLoc":148,"text":"self._notification_bindings"},{"col":4,"comment":"null","endLoc":208,"header":"@scale.setter\n    def scale(self, val)","id":8375,"name":"scale","nodeType":"Function","startLoc":206,"text":"@scale.setter\n    def scale(self, val):\n        self._scale = val"},{"col":4,"comment":"null","endLoc":221,"header":"@property\n    def mask(self)","id":8376,"name":"mask","nodeType":"Function","startLoc":215,"text":"@property\n    def mask(self):\n        if 'mask' not in self.cache:\n            self.cache['mask'] = np.isnan(self.jd2)\n            if self.cache['mask'].shape:\n                self.cache['mask'].flags.writeable = False\n        return self.cache['mask']"},{"col":0,"comment":"\n    Return a matrix of shape ``(world_n_dim, pixel_n_dim)`` where each entry\n    ``[i, j]`` is the partial derivative d(world_i)/d(pixel_j) at the requested\n    pixel position.\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.WCS`\n        The WCS transformation to evaluate the derivatives for.\n    *pixel : float\n        The scalar pixel coordinates at which to evaluate the derivatives.\n    normalize_by_world : bool\n        If `True`, the matrix is normalized so that for each world entry\n        the derivatives add up to 1.\n    ","endLoc":872,"header":"def local_partial_pixel_derivatives(wcs, *pixel, normalize_by_world=False)","id":8377,"name":"local_partial_pixel_derivatives","nodeType":"Function","startLoc":839,"text":"def local_partial_pixel_derivatives(wcs, *pixel, normalize_by_world=False):\n    \"\"\"\n    Return a matrix of shape ``(world_n_dim, pixel_n_dim)`` where each entry\n    ``[i, j]`` is the partial derivative d(world_i)/d(pixel_j) at the requested\n    pixel position.\n\n    Parameters\n    ----------\n    wcs : `~astropy.wcs.WCS`\n        The WCS transformation to evaluate the derivatives for.\n    *pixel : float\n        The scalar pixel coordinates at which to evaluate the derivatives.\n    normalize_by_world : bool\n        If `True`, the matrix is normalized so that for each world entry\n        the derivatives add up to 1.\n    \"\"\"\n\n    # Find the world coordinates at the requested pixel\n    pixel_ref = np.array(pixel)\n    world_ref = np.array(wcs.pixel_to_world_values(*pixel_ref))\n\n    # Set up the derivative matrix\n    derivatives = np.zeros((wcs.world_n_dim, wcs.pixel_n_dim))\n\n    for i in range(wcs.pixel_n_dim):\n        pixel_off = pixel_ref.copy()\n        pixel_off[i] += 1\n        world_off = np.array(wcs.pixel_to_world_values(*pixel_off))\n        derivatives[:, i] = world_off - world_ref\n\n    if normalize_by_world:\n        derivatives /= derivatives.sum(axis=0)[:, np.newaxis]\n\n    return derivatives"},{"attributeType":"null","col":8,"comment":"null","endLoc":153,"id":8378,"name":"hub","nodeType":"Attribute","startLoc":153,"text":"self.hub"},{"attributeType":"null","col":8,"comment":"null","endLoc":141,"id":8379,"name":"_callable","nodeType":"Attribute","startLoc":141,"text":"self._callable"},{"attributeType":"null","col":12,"comment":"null","endLoc":158,"id":8380,"name":"_thread","nodeType":"Attribute","startLoc":158,"text":"self._thread"},{"col":4,"comment":"null","endLoc":227,"header":"@property\n    def masked(self)","id":8381,"name":"masked","nodeType":"Function","startLoc":223,"text":"@property\n    def masked(self):\n        if 'masked' not in self.cache:\n            self.cache['masked'] = bool(np.any(self.mask))\n        return self.cache['masked']"},{"col":4,"comment":"null","endLoc":231,"header":"@property\n    def jd2_filled(self)","id":8382,"name":"jd2_filled","nodeType":"Function","startLoc":229,"text":"@property\n    def jd2_filled(self):\n        return np.nan_to_num(self.jd2) if self.masked else self.jd2"},{"col":4,"comment":"\n        Return the cache associated with this instance.\n        ","endLoc":238,"header":"@lazyproperty\n    def cache(self)","id":8383,"name":"cache","nodeType":"Function","startLoc":233,"text":"@lazyproperty\n    def cache(self):\n        \"\"\"\n        Return the cache associated with this instance.\n        \"\"\"\n        return defaultdict(dict)"},{"col":4,"comment":"\n        Return time representation from internal jd1 and jd2 in specified\n        ``out_subfmt``.\n\n        This is the base method that ignores ``parent`` and uses the ``value``\n        property to compute the output. This is done by temporarily setting\n        ``self.out_subfmt`` and calling ``self.value``. This is required for\n        legacy Format subclasses prior to astropy 4.0  New code should instead\n        implement the value functionality in ``to_value()`` and then make the\n        ``value`` property be a simple call to ``self.to_value()``.\n\n        Parameters\n        ----------\n        parent : object\n            Parent `~astropy.time.Time` object associated with this\n            `~astropy.time.TimeFormat` object\n        out_subfmt : str or None\n            Output subformt (use existing self.out_subfmt if `None`)\n\n        Returns\n        -------\n        value : numpy.array, numpy.ma.array\n            Array or masked array of formatted time representation values\n        ","endLoc":364,"header":"def to_value(self, parent=None, out_subfmt=None)","id":8384,"name":"to_value","nodeType":"Function","startLoc":328,"text":"def to_value(self, parent=None, out_subfmt=None):\n        \"\"\"\n        Return time representation from internal jd1 and jd2 in specified\n        ``out_subfmt``.\n\n        This is the base method that ignores ``parent`` and uses the ``value``\n        property to compute the output. This is done by temporarily setting\n        ``self.out_subfmt`` and calling ``self.value``. This is required for\n        legacy Format subclasses prior to astropy 4.0  New code should instead\n        implement the value functionality in ``to_value()`` and then make the\n        ``value`` property be a simple call to ``self.to_value()``.\n\n        Parameters\n        ----------\n        parent : object\n            Parent `~astropy.time.Time` object associated with this\n            `~astropy.time.TimeFormat` object\n        out_subfmt : str or None\n            Output subformt (use existing self.out_subfmt if `None`)\n\n        Returns\n        -------\n        value : numpy.array, numpy.ma.array\n            Array or masked array of formatted time representation values\n        \"\"\"\n        # Get value via ``value`` property, overriding out_subfmt temporarily if needed.\n        if out_subfmt is not None:\n            out_subfmt_orig = self.out_subfmt\n            try:\n                self.out_subfmt = out_subfmt\n                value = self.value\n            finally:\n                self.out_subfmt = out_subfmt_orig\n        else:\n            value = self.value\n\n        return self.mask_if_needed(value)"},{"attributeType":"None","col":8,"comment":"null","endLoc":144,"id":8385,"name":"client","nodeType":"Attribute","startLoc":144,"text":"self.client"},{"attributeType":"null","col":8,"comment":"null","endLoc":128,"id":8386,"name":"_is_registered","nodeType":"Attribute","startLoc":128,"text":"self._is_registered"},{"attributeType":"null","col":4,"comment":"null","endLoc":868,"id":8387,"name":"name","nodeType":"Attribute","startLoc":868,"text":"name"},{"attributeType":"null","col":8,"comment":"null","endLoc":151,"id":8388,"name":"_response_bindings","nodeType":"Attribute","startLoc":151,"text":"self._response_bindings"},{"attributeType":"null","col":12,"comment":"null","endLoc":906,"id":8389,"name":"val","nodeType":"Attribute","startLoc":906,"text":"val"},{"attributeType":"null","col":8,"comment":"null","endLoc":916,"id":8390,"name":"_location","nodeType":"Attribute","startLoc":916,"text":"self._location"},{"attributeType":"null","col":8,"comment":"null","endLoc":876,"id":8391,"name":"val1_0","nodeType":"Attribute","startLoc":876,"text":"val1_0"},{"attributeType":"null","col":12,"comment":"null","endLoc":886,"id":8392,"name":"vals","nodeType":"Attribute","startLoc":886,"text":"vals"},{"attributeType":"null","col":12,"comment":"null","endLoc":907,"id":8393,"name":"jd1","nodeType":"Attribute","startLoc":907,"text":"jd1"},{"attributeType":"null","col":8,"comment":"null","endLoc":139,"id":8394,"name":"_metadata","nodeType":"Attribute","startLoc":139,"text":"self._metadata"},{"attributeType":"null","col":8,"comment":"null","endLoc":155,"id":8395,"name":"_registration_lock","nodeType":"Attribute","startLoc":155,"text":"self._registration_lock"},{"attributeType":"null","col":8,"comment":"null","endLoc":910,"id":8396,"name":"OutTimeFormat","nodeType":"Attribute","startLoc":910,"text":"OutTimeFormat"},{"attributeType":"null","col":12,"comment":"null","endLoc":883,"id":8397,"name":"scale","nodeType":"Attribute","startLoc":883,"text":"scale"},{"attributeType":"null","col":17,"comment":"null","endLoc":907,"id":8398,"name":"jd2","nodeType":"Attribute","startLoc":907,"text":"jd2"},{"attributeType":"null","col":8,"comment":"null","endLoc":911,"id":8399,"name":"self","nodeType":"Attribute","startLoc":911,"text":"self"},{"attributeType":"null","col":16,"comment":"null","endLoc":895,"id":8400,"name":"locations","nodeType":"Attribute","startLoc":895,"text":"locations"},{"attributeType":"null","col":12,"comment":"null","endLoc":908,"id":8401,"name":"location","nodeType":"Attribute","startLoc":908,"text":"location"},{"className":"TimeDatetime","col":0,"comment":"\n    Represent date as Python standard library `~datetime.datetime` object\n\n    Example::\n\n      >>> from astropy.time import Time\n      >>> from datetime import datetime\n      >>> t = Time(datetime(2000, 1, 2, 12, 0, 0), scale='utc')\n      >>> t.iso\n      '2000-01-02 12:00:00.000'\n      >>> t.tt.datetime\n      datetime.datetime(2000, 1, 2, 12, 1, 4, 184000)\n    ","endLoc":1022,"id":8402,"nodeType":"Class","startLoc":921,"text":"class TimeDatetime(TimeUnique):\n    \"\"\"\n    Represent date as Python standard library `~datetime.datetime` object\n\n    Example::\n\n      >>> from astropy.time import Time\n      >>> from datetime import datetime\n      >>> t = Time(datetime(2000, 1, 2, 12, 0, 0), scale='utc')\n      >>> t.iso\n      '2000-01-02 12:00:00.000'\n      >>> t.tt.datetime\n      datetime.datetime(2000, 1, 2, 12, 1, 4, 184000)\n    \"\"\"\n    name = 'datetime'\n\n    def _check_val_type(self, val1, val2):\n        if not all(isinstance(val, datetime.datetime) for val in val1.flat):\n            raise TypeError('Input values for {} class must be '\n                            'datetime objects'.format(self.name))\n        if val2 is not None:\n            raise ValueError(\n                f'{self.name} objects do not accept a val2 but you provided {val2}')\n        return val1, None\n\n    def set_jds(self, val1, val2):\n        \"\"\"Convert datetime object contained in val1 to jd1, jd2\"\"\"\n        # Iterate through the datetime objects, getting year, month, etc.\n        iterator = np.nditer([val1, None, None, None, None, None, None],\n                             flags=['refs_ok', 'zerosize_ok'],\n                             op_dtypes=[None] + 5*[np.intc] + [np.double])\n        for val, iy, im, id, ihr, imin, dsec in iterator:\n            dt = val.item()\n\n            if dt.tzinfo is not None:\n                dt = (dt - dt.utcoffset()).replace(tzinfo=None)\n\n            iy[...] = dt.year\n            im[...] = dt.month\n            id[...] = dt.day\n            ihr[...] = dt.hour\n            imin[...] = dt.minute\n            dsec[...] = dt.second + dt.microsecond / 1e6\n\n        jd1, jd2 = erfa.dtf2d(self.scale.upper().encode('ascii'),\n                              *iterator.operands[1:])\n        self.jd1, self.jd2 = day_frac(jd1, jd2)\n\n    def to_value(self, timezone=None, parent=None, out_subfmt=None):\n        \"\"\"\n        Convert to (potentially timezone-aware) `~datetime.datetime` object.\n\n        If ``timezone`` is not ``None``, return a timezone-aware datetime\n        object.\n\n        Parameters\n        ----------\n        timezone : {`~datetime.tzinfo`, None}, optional\n            If not `None`, return timezone-aware datetime.\n\n        Returns\n        -------\n        `~datetime.datetime`\n            If ``timezone`` is not ``None``, output will be timezone-aware.\n        \"\"\"\n        if out_subfmt is not None:\n            # Out_subfmt not allowed for this format, so raise the standard\n            # exception by trying to validate the value.\n            self._select_subfmts(out_subfmt)\n\n        if timezone is not None:\n            if self._scale != 'utc':\n                raise ScaleValueError(\"scale is {}, must be 'utc' when timezone \"\n                                      \"is supplied.\".format(self._scale))\n\n        # Rather than define a value property directly, we have a function,\n        # since we want to be able to pass in timezone information.\n        scale = self.scale.upper().encode('ascii')\n        iys, ims, ids, ihmsfs = erfa.d2dtf(scale, 6,  # 6 for microsec\n                                           self.jd1, self.jd2_filled)\n        ihrs = ihmsfs['h']\n        imins = ihmsfs['m']\n        isecs = ihmsfs['s']\n        ifracs = ihmsfs['f']\n        iterator = np.nditer([iys, ims, ids, ihrs, imins, isecs, ifracs, None],\n                             flags=['refs_ok', 'zerosize_ok'],\n                             op_dtypes=7*[None] + [object])\n\n        for iy, im, id, ihr, imin, isec, ifracsec, out in iterator:\n            if isec >= 60:\n                raise ValueError('Time {} is within a leap second but datetime '\n                                 'does not support leap seconds'\n                                 .format((iy, im, id, ihr, imin, isec, ifracsec)))\n            if timezone is not None:\n                out[...] = datetime.datetime(iy, im, id, ihr, imin, isec, ifracsec,\n                                             tzinfo=TimezoneInfo()).astimezone(timezone)\n            else:\n                out[...] = datetime.datetime(iy, im, id, ihr, imin, isec, ifracsec)\n\n        return self.mask_if_needed(iterator.operands[-1])\n\n    value = property(to_value)"},{"attributeType":"null","col":8,"comment":"null","endLoc":149,"id":8403,"name":"_call_bindings","nodeType":"Attribute","startLoc":149,"text":"self._call_bindings"},{"col":4,"comment":"null","endLoc":944,"header":"def _check_val_type(self, val1, val2)","id":8404,"name":"_check_val_type","nodeType":"Function","startLoc":937,"text":"def _check_val_type(self, val1, val2):\n        if not all(isinstance(val, datetime.datetime) for val in val1.flat):\n            raise TypeError('Input values for {} class must be '\n                            'datetime objects'.format(self.name))\n        if val2 is not None:\n            raise ValueError(\n                f'{self.name} objects do not accept a val2 but you provided {val2}')\n        return val1, None"},{"col":4,"comment":"Convert datetime object contained in val1 to jd1, jd2","endLoc":967,"header":"def set_jds(self, val1, val2)","id":8405,"name":"set_jds","nodeType":"Function","startLoc":946,"text":"def set_jds(self, val1, val2):\n        \"\"\"Convert datetime object contained in val1 to jd1, jd2\"\"\"\n        # Iterate through the datetime objects, getting year, month, etc.\n        iterator = np.nditer([val1, None, None, None, None, None, None],\n                             flags=['refs_ok', 'zerosize_ok'],\n                             op_dtypes=[None] + 5*[np.intc] + [np.double])\n        for val, iy, im, id, ihr, imin, dsec in iterator:\n            dt = val.item()\n\n            if dt.tzinfo is not None:\n                dt = (dt - dt.utcoffset()).replace(tzinfo=None)\n\n            iy[...] = dt.year\n            im[...] = dt.month\n            id[...] = dt.day\n            ihr[...] = dt.hour\n            imin[...] = dt.minute\n            dsec[...] = dt.second + dt.microsecond / 1e6\n\n        jd1, jd2 = erfa.dtf2d(self.scale.upper().encode('ascii'),\n                              *iterator.operands[1:])\n        self.jd1, self.jd2 = day_frac(jd1, jd2)"},{"className":"SAMPIntegratedWebClient","col":0,"comment":"\n    A Simple SAMP web client.\n\n    In practice web clients should run from the browser, so this is provided as\n    a means of testing a hub's support for the web profile from Python.\n\n    This class is meant to simplify the client usage providing a proxy class\n    that merges the :class:`~astropy.samp.client.SAMPWebClient` and\n    :class:`~astropy.samp.hub_proxy.SAMPWebHubProxy` functionalities in a\n    simplified API.\n\n    Parameters\n    ----------\n    name : str, optional\n        Client name (corresponding to ``samp.name`` metadata keyword).\n\n    description : str, optional\n        Client description (corresponding to ``samp.description.text`` metadata\n        keyword).\n\n    metadata : dict, optional\n        Client application metadata in the standard SAMP format.\n\n    callable : bool, optional\n        Whether the client can receive calls and notifications. If set to\n        `False`, then the client can send notifications and calls, but can not\n        receive any.\n    ","endLoc":282,"id":8406,"nodeType":"Class","startLoc":231,"text":"class SAMPIntegratedWebClient(SAMPIntegratedClient):\n    \"\"\"\n    A Simple SAMP web client.\n\n    In practice web clients should run from the browser, so this is provided as\n    a means of testing a hub's support for the web profile from Python.\n\n    This class is meant to simplify the client usage providing a proxy class\n    that merges the :class:`~astropy.samp.client.SAMPWebClient` and\n    :class:`~astropy.samp.hub_proxy.SAMPWebHubProxy` functionalities in a\n    simplified API.\n\n    Parameters\n    ----------\n    name : str, optional\n        Client name (corresponding to ``samp.name`` metadata keyword).\n\n    description : str, optional\n        Client description (corresponding to ``samp.description.text`` metadata\n        keyword).\n\n    metadata : dict, optional\n        Client application metadata in the standard SAMP format.\n\n    callable : bool, optional\n        Whether the client can receive calls and notifications. If set to\n        `False`, then the client can send notifications and calls, but can not\n        receive any.\n    \"\"\"\n\n    def __init__(self, name=None, description=None, metadata=None,\n                 callable=True):\n\n        self.hub = SAMPWebHubProxy()\n\n        self.client = SAMPWebClient(self.hub, name, description, metadata,\n                                    callable)\n\n    def connect(self, pool_size=20, web_port=21012):\n        \"\"\"\n        Connect with the current or specified SAMP Hub, start and register the\n        client.\n\n        Parameters\n        ----------\n        pool_size : int, optional\n            The number of socket connections opened to communicate with the\n            Hub.\n        \"\"\"\n        self.hub.connect(pool_size, web_port=web_port)\n        self.client.start()\n        self.client.register()"},{"col":0,"comment":"\n    Objective function for fitting linear terms.\n\n    Parameters\n    ----------\n    params : array\n        6 element array. First 4 elements are PC matrix, last 2 are CRPIX.\n    lon, lat: array\n        Sky coordinates.\n    x, y: array\n        Pixel coordinates\n    w_obj: `~astropy.wcs.WCS`\n        WCS object\n        ","endLoc":904,"header":"def _linear_wcs_fit(params, lon, lat, x, y, w_obj)","id":8407,"name":"_linear_wcs_fit","nodeType":"Function","startLoc":875,"text":"def _linear_wcs_fit(params, lon, lat, x, y, w_obj):\n    \"\"\"\n    Objective function for fitting linear terms.\n\n    Parameters\n    ----------\n    params : array\n        6 element array. First 4 elements are PC matrix, last 2 are CRPIX.\n    lon, lat: array\n        Sky coordinates.\n    x, y: array\n        Pixel coordinates\n    w_obj: `~astropy.wcs.WCS`\n        WCS object\n        \"\"\"\n    cd = params[0:4]\n    crpix = params[4:6]\n\n    w_obj.wcs.cd = ((cd[0], cd[1]), (cd[2], cd[3]))\n    w_obj.wcs.crpix = crpix\n    lon2, lat2 = w_obj.wcs_pix2world(x, y, 0)\n\n    lat_resids = lat - lat2\n    lon_resids = lon - lon2\n    # In case the longitude has wrapped around\n    lon_resids = np.mod(lon_resids - 180.0, 360.0) - 180.0\n\n    resids = np.concatenate((lon_resids * np.cos(np.radians(lat)), lat_resids))\n\n    return resids"},{"col":4,"comment":"null","endLoc":267,"header":"def __init__(self, name=None, description=None, metadata=None,\n                 callable=True)","id":8408,"name":"__init__","nodeType":"Function","startLoc":261,"text":"def __init__(self, name=None, description=None, metadata=None,\n                 callable=True):\n\n        self.hub = SAMPWebHubProxy()\n\n        self.client = SAMPWebClient(self.hub, name, description, metadata,\n                                    callable)"},{"col":0,"comment":"\n    Expand the shape of an array.\n\n    Insert a new axis that will appear at the `axis` position in the\n    expanded array shape.\n\n    This function allows for tuple axis arguments.\n    ``numpy.expand_dims`` currently does not allow that, but it will in\n    numpy v1.18 (https://github.com/numpy/numpy/pull/14051).\n    ``_expand_dims`` can be replaced with ``numpy.expand_dims`` when the\n    minimum support numpy version is v1.18.\n\n    Parameters\n    ----------\n    data : array-like\n        Input array.\n    axis : int or tuple of int\n        Position in the expanded axes where the new axis (or axes) is\n        placed.  A tuple of axes is now supported.  Out of range axes as\n        described above are now forbidden and raise an `AxisError`.\n\n    Returns\n    -------\n    result : ndarray\n        View of ``data`` with the number of dimensions increased.\n    ","endLoc":87,"header":"def _expand_dims(data, axis)","id":8409,"name":"_expand_dims","nodeType":"Function","startLoc":45,"text":"def _expand_dims(data, axis):\n    \"\"\"\n    Expand the shape of an array.\n\n    Insert a new axis that will appear at the `axis` position in the\n    expanded array shape.\n\n    This function allows for tuple axis arguments.\n    ``numpy.expand_dims`` currently does not allow that, but it will in\n    numpy v1.18 (https://github.com/numpy/numpy/pull/14051).\n    ``_expand_dims`` can be replaced with ``numpy.expand_dims`` when the\n    minimum support numpy version is v1.18.\n\n    Parameters\n    ----------\n    data : array-like\n        Input array.\n    axis : int or tuple of int\n        Position in the expanded axes where the new axis (or axes) is\n        placed.  A tuple of axes is now supported.  Out of range axes as\n        described above are now forbidden and raise an `AxisError`.\n\n    Returns\n    -------\n    result : ndarray\n        View of ``data`` with the number of dimensions increased.\n    \"\"\"\n\n    if isinstance(data, np.matrix):\n        data = np.asarray(data)\n    else:\n        data = np.asanyarray(data)\n\n    if not isinstance(axis, (tuple, list)):\n        axis = (axis,)\n\n    out_ndim = len(axis) + data.ndim\n    axis = np.core.numeric.normalize_axis_tuple(axis, out_ndim)\n\n    shape_it = iter(data.shape)\n    shape = [1 if ax in axis else next(shape_it) for ax in range(out_ndim)]\n\n    return data.reshape(shape)"},{"col":0,"comment":" Objective function for fitting SIP.\n\n    Parameters\n    ----------\n    params : array\n        Fittable parameters. First 4 elements are PC matrix, last 2 are CRPIX.\n    lon, lat: array\n        Sky coordinates.\n    u, v: array\n        Pixel coordinates\n    w_obj: `~astropy.wcs.WCS`\n        WCS object\n    ","endLoc":952,"header":"def _sip_fit(params, lon, lat, u, v, w_obj, order, coeff_names)","id":8410,"name":"_sip_fit","nodeType":"Function","startLoc":907,"text":"def _sip_fit(params, lon, lat, u, v, w_obj, order, coeff_names):\n\n    \"\"\" Objective function for fitting SIP.\n\n    Parameters\n    ----------\n    params : array\n        Fittable parameters. First 4 elements are PC matrix, last 2 are CRPIX.\n    lon, lat: array\n        Sky coordinates.\n    u, v: array\n        Pixel coordinates\n    w_obj: `~astropy.wcs.WCS`\n        WCS object\n    \"\"\"\n\n    from ..modeling.models import SIP  # here to avoid circular import\n\n    # unpack params\n    crpix = params[0:2]\n    cdx = params[2:6].reshape((2, 2))\n    a_params = params[6:6+len(coeff_names)]\n    b_params = params[6+len(coeff_names):]\n\n    # assign to wcs, used for transfomations in this function\n    w_obj.wcs.cd = cdx\n    w_obj.wcs.crpix = crpix\n\n    a_coeff, b_coeff = {}, {}\n    for i in range(len(coeff_names)):\n        a_coeff['A_' + coeff_names[i]] = a_params[i]\n        b_coeff['B_' + coeff_names[i]] = b_params[i]\n\n    sip = SIP(crpix=crpix, a_order=order, b_order=order,\n              a_coeff=a_coeff, b_coeff=b_coeff)\n    fuv, guv = sip(u, v)\n\n    xo, yo = np.dot(cdx, np.array([u+fuv-crpix[0], v+guv-crpix[1]]))\n\n    # use all pix2world in case `projection` contains distortion table\n    x, y = w_obj.all_world2pix(lon, lat, 0)\n    x, y = np.dot(w_obj.wcs.cd, (x-w_obj.wcs.crpix[0], y-w_obj.wcs.crpix[1]))\n\n    resids = np.concatenate((x-xo, y-yo))\n\n    return resids"},{"col":4,"comment":"\n        Connect with the current or specified SAMP Hub, start and register the\n        client.\n\n        Parameters\n        ----------\n        pool_size : int, optional\n            The number of socket connections opened to communicate with the\n            Hub.\n        ","endLoc":282,"header":"def connect(self, pool_size=20, web_port=21012)","id":8411,"name":"connect","nodeType":"Function","startLoc":269,"text":"def connect(self, pool_size=20, web_port=21012):\n        \"\"\"\n        Connect with the current or specified SAMP Hub, start and register the\n        client.\n\n        Parameters\n        ----------\n        pool_size : int, optional\n            The number of socket connections opened to communicate with the\n            Hub.\n        \"\"\"\n        self.hub.connect(pool_size, web_port=web_port)\n        self.client.start()\n        self.client.register()"},{"col":4,"comment":"\n        Convert to (potentially timezone-aware) `~datetime.datetime` object.\n\n        If ``timezone`` is not ``None``, return a timezone-aware datetime\n        object.\n\n        Parameters\n        ----------\n        timezone : {`~datetime.tzinfo`, None}, optional\n            If not `None`, return timezone-aware datetime.\n\n        Returns\n        -------\n        `~datetime.datetime`\n            If ``timezone`` is not ``None``, output will be timezone-aware.\n        ","endLoc":1020,"header":"def to_value(self, timezone=None, parent=None, out_subfmt=None)","id":8412,"name":"to_value","nodeType":"Function","startLoc":969,"text":"def to_value(self, timezone=None, parent=None, out_subfmt=None):\n        \"\"\"\n        Convert to (potentially timezone-aware) `~datetime.datetime` object.\n\n        If ``timezone`` is not ``None``, return a timezone-aware datetime\n        object.\n\n        Parameters\n        ----------\n        timezone : {`~datetime.tzinfo`, None}, optional\n            If not `None`, return timezone-aware datetime.\n\n        Returns\n        -------\n        `~datetime.datetime`\n            If ``timezone`` is not ``None``, output will be timezone-aware.\n        \"\"\"\n        if out_subfmt is not None:\n            # Out_subfmt not allowed for this format, so raise the standard\n            # exception by trying to validate the value.\n            self._select_subfmts(out_subfmt)\n\n        if timezone is not None:\n            if self._scale != 'utc':\n                raise ScaleValueError(\"scale is {}, must be 'utc' when timezone \"\n                                      \"is supplied.\".format(self._scale))\n\n        # Rather than define a value property directly, we have a function,\n        # since we want to be able to pass in timezone information.\n        scale = self.scale.upper().encode('ascii')\n        iys, ims, ids, ihmsfs = erfa.d2dtf(scale, 6,  # 6 for microsec\n                                           self.jd1, self.jd2_filled)\n        ihrs = ihmsfs['h']\n        imins = ihmsfs['m']\n        isecs = ihmsfs['s']\n        ifracs = ihmsfs['f']\n        iterator = np.nditer([iys, ims, ids, ihrs, imins, isecs, ifracs, None],\n                             flags=['refs_ok', 'zerosize_ok'],\n                             op_dtypes=7*[None] + [object])\n\n        for iy, im, id, ihr, imin, isec, ifracsec, out in iterator:\n            if isec >= 60:\n                raise ValueError('Time {} is within a leap second but datetime '\n                                 'does not support leap seconds'\n                                 .format((iy, im, id, ihr, imin, isec, ifracsec)))\n            if timezone is not None:\n                out[...] = datetime.datetime(iy, im, id, ihr, imin, isec, ifracsec,\n                                             tzinfo=TimezoneInfo()).astimezone(timezone)\n            else:\n                out[...] = datetime.datetime(iy, im, id, ihr, imin, isec, ifracsec)\n\n        return self.mask_if_needed(iterator.operands[-1])"},{"col":4,"comment":"null","endLoc":368,"header":"@property\n    def value(self)","id":8413,"name":"value","nodeType":"Function","startLoc":366,"text":"@property\n    def value(self):\n        raise NotImplementedError"},{"attributeType":"null","col":4,"comment":"null","endLoc":102,"id":8414,"name":"_default_scale","nodeType":"Attribute","startLoc":102,"text":"_default_scale"},{"attributeType":"null","col":4,"comment":"null","endLoc":103,"id":8415,"name":"subfmts","nodeType":"Attribute","startLoc":103,"text":"subfmts"},{"attributeType":"null","col":4,"comment":"null","endLoc":104,"id":8416,"name":"_registry","nodeType":"Attribute","startLoc":104,"text":"_registry"},{"attributeType":"null","col":8,"comment":"null","endLoc":113,"id":8417,"name":"_jd1","nodeType":"Attribute","startLoc":113,"text":"self._jd1"},{"col":4,"comment":"\n        Parameters\n        ----------\n        utc_offset : `~astropy.units.Quantity`, optional\n            Offset from UTC in days. Defaults to zero.\n        dst : `~astropy.units.Quantity`, optional\n            Daylight Savings Time offset in days. Defaults to zero\n            (no daylight savings).\n        tzname : str or None, optional\n            Name of timezone\n\n        Examples\n        --------\n        >>> from datetime import datetime\n        >>> from astropy.time import TimezoneInfo  # Specifies a timezone\n        >>> import astropy.units as u\n        >>> utc = TimezoneInfo()    # Defaults to UTC\n        >>> utc_plus_one_hour = TimezoneInfo(utc_offset=1*u.hour)  # UTC+1\n        >>> dt_aware = datetime(2000, 1, 1, 0, 0, 0, tzinfo=utc_plus_one_hour)\n        >>> print(dt_aware)\n        2000-01-01 00:00:00+01:00\n        >>> print(dt_aware.astimezone(utc))\n        1999-12-31 23:00:00+00:00\n        ","endLoc":1202,"header":"@u.quantity_input(utc_offset=u.day, dst=u.day)\n    def __init__(self, utc_offset=0 * u.day, dst=0 * u.day, tzname=None)","id":8418,"name":"__init__","nodeType":"Function","startLoc":1172,"text":"@u.quantity_input(utc_offset=u.day, dst=u.day)\n    def __init__(self, utc_offset=0 * u.day, dst=0 * u.day, tzname=None):\n        \"\"\"\n        Parameters\n        ----------\n        utc_offset : `~astropy.units.Quantity`, optional\n            Offset from UTC in days. Defaults to zero.\n        dst : `~astropy.units.Quantity`, optional\n            Daylight Savings Time offset in days. Defaults to zero\n            (no daylight savings).\n        tzname : str or None, optional\n            Name of timezone\n\n        Examples\n        --------\n        >>> from datetime import datetime\n        >>> from astropy.time import TimezoneInfo  # Specifies a timezone\n        >>> import astropy.units as u\n        >>> utc = TimezoneInfo()    # Defaults to UTC\n        >>> utc_plus_one_hour = TimezoneInfo(utc_offset=1*u.hour)  # UTC+1\n        >>> dt_aware = datetime(2000, 1, 1, 0, 0, 0, tzinfo=utc_plus_one_hour)\n        >>> print(dt_aware)\n        2000-01-01 00:00:00+01:00\n        >>> print(dt_aware.astimezone(utc))\n        1999-12-31 23:00:00+00:00\n        \"\"\"\n        if utc_offset == 0 and dst == 0 and tzname is None:\n            tzname = 'UTC'\n        self._utcoffset = datetime.timedelta(utc_offset.to_value(u.day))\n        self._tzname = tzname\n        self._dst = datetime.timedelta(dst.to_value(u.day))"},{"attributeType":"SAMPWebHubProxy","col":8,"comment":"null","endLoc":264,"id":8419,"name":"hub","nodeType":"Attribute","startLoc":264,"text":"self.hub"},{"attributeType":"SAMPWebClient","col":8,"comment":"null","endLoc":266,"id":8420,"name":"client","nodeType":"Attribute","startLoc":266,"text":"self.client"},{"attributeType":"null","col":24,"comment":"null","endLoc":3,"id":8421,"name":"xmlrpc","nodeType":"Attribute","startLoc":3,"text":"xmlrpc"},{"col":4,"comment":"null","endLoc":647,"header":"def _notify_disconnection(self, private_key)","id":8422,"name":"_notify_disconnection","nodeType":"Function","startLoc":631,"text":"def _notify_disconnection(self, private_key):\n\n        def _xmlrpc_call_disconnect(endpoint, private_key, hub_public_id, message):\n            endpoint.samp.client.receiveNotification(private_key, hub_public_id, message)\n\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.disconnect\")\n        public_id = self._private_keys[private_key][0]\n        endpoint = self._xmlrpc_endpoints[public_id][1]\n\n        for mtype in msubs:\n            if mtype in self._mtype2ids and private_key in self._mtype2ids[mtype]:\n                log.debug(f\"notify disconnection to {public_id}\")\n                self._launch_thread(target=_xmlrpc_call_disconnect,\n                                   args=(endpoint, private_key,\n                                         self._hub_public_id,\n                                         {\"samp.mtype\": \"samp.hub.disconnect\",\n                                          \"samp.params\": {\"reason\": \"Timeout expired!\"}}))"},{"attributeType":"null","col":8,"comment":"null","endLoc":203,"id":8423,"name":"_scale","nodeType":"Attribute","startLoc":203,"text":"self._scale"},{"col":0,"comment":"Binomial proportion confidence interval given k successes,\n    n trials.\n\n    Parameters\n    ----------\n    k : int or numpy.ndarray\n        Number of successes (0 <= ``k`` <= ``n``).\n    n : int or numpy.ndarray\n        Number of trials (``n`` > 0).  If both ``k`` and ``n`` are arrays,\n        they must have the same shape.\n    confidence_level : float, optional\n        Desired probability content of interval. Default is 0.68269,\n        corresponding to 1 sigma in a 1-dimensional Gaussian distribution.\n        Confidence level must be in range [0, 1].\n    interval : {'wilson', 'jeffreys', 'flat', 'wald'}, optional\n        Formula used for confidence interval. See notes for details.  The\n        ``'wilson'`` and ``'jeffreys'`` intervals generally give similar\n        results, while 'flat' is somewhat different, especially for small\n        values of ``n``.  ``'wilson'`` should be somewhat faster than\n        ``'flat'`` or ``'jeffreys'``.  The 'wald' interval is generally not\n        recommended.  It is provided for comparison purposes.  Default is\n        ``'wilson'``.\n\n    Returns\n    -------\n    conf_interval : ndarray\n        ``conf_interval[0]`` and ``conf_interval[1]`` correspond to the lower\n        and upper limits, respectively, for each element in ``k``, ``n``.\n\n    Notes\n    -----\n    In situations where a probability of success is not known, it can\n    be estimated from a number of trials (n) and number of\n    observed successes (k). For example, this is done in Monte\n    Carlo experiments designed to estimate a detection efficiency. It\n    is simple to take the sample proportion of successes (k/n)\n    as a reasonable best estimate of the true probability\n    :math:`\\epsilon`. However, deriving an accurate confidence\n    interval on :math:`\\epsilon` is non-trivial. There are several\n    formulas for this interval (see [1]_). Four intervals are implemented\n    here:\n\n    **1. The Wilson Interval.** This interval, attributed to Wilson [2]_,\n    is given by\n\n    .. math::\n\n        CI_{\\rm Wilson} = \\frac{k + \\kappa^2/2}{n + \\kappa^2}\n        \\pm \\frac{\\kappa n^{1/2}}{n + \\kappa^2}\n        ((\\hat{\\epsilon}(1 - \\hat{\\epsilon}) + \\kappa^2/(4n))^{1/2}\n\n    where :math:`\\hat{\\epsilon} = k / n` and :math:`\\kappa` is the\n    number of standard deviations corresponding to the desired\n    confidence interval for a *normal* distribution (for example,\n    1.0 for a confidence interval of 68.269%). For a\n    confidence interval of 100(1 - :math:`\\alpha`)%,\n\n    .. math::\n\n        \\kappa = \\Phi^{-1}(1-\\alpha/2) = \\sqrt{2}{\\rm erf}^{-1}(1-\\alpha).\n\n    **2. The Jeffreys Interval.** This interval is derived by applying\n    Bayes' theorem to the binomial distribution with the\n    noninformative Jeffreys prior [3]_, [4]_. The noninformative Jeffreys\n    prior is the Beta distribution, Beta(1/2, 1/2), which has the density\n    function\n\n    .. math::\n\n        f(\\epsilon) = \\pi^{-1} \\epsilon^{-1/2}(1-\\epsilon)^{-1/2}.\n\n    The justification for this prior is that it is invariant under\n    reparameterizations of the binomial proportion.\n    The posterior density function is also a Beta distribution: Beta(k\n    + 1/2, n - k + 1/2). The interval is then chosen so that it is\n    *equal-tailed*: Each tail (outside the interval) contains\n    :math:`\\alpha`/2 of the posterior probability, and the interval\n    itself contains 1 - :math:`\\alpha`. This interval must be\n    calculated numerically. Additionally, when k = 0 the lower limit\n    is set to 0 and when k = n the upper limit is set to 1, so that in\n    these cases, there is only one tail containing :math:`\\alpha`/2\n    and the interval itself contains 1 - :math:`\\alpha`/2 rather than\n    the nominal 1 - :math:`\\alpha`.\n\n    **3. A Flat prior.** This is similar to the Jeffreys interval,\n    but uses a flat (uniform) prior on the binomial proportion\n    over the range 0 to 1 rather than the reparametrization-invariant\n    Jeffreys prior.  The posterior density function is a Beta distribution:\n    Beta(k + 1, n - k + 1).  The same comments about the nature of the\n    interval (equal-tailed, etc.) also apply to this option.\n\n    **4. The Wald Interval.** This interval is given by\n\n    .. math::\n\n       CI_{\\rm Wald} = \\hat{\\epsilon} \\pm\n       \\kappa \\sqrt{\\frac{\\hat{\\epsilon}(1-\\hat{\\epsilon})}{n}}\n\n    The Wald interval gives acceptable results in some limiting\n    cases. Particularly, when n is very large, and the true proportion\n    :math:`\\epsilon` is not \"too close\" to 0 or 1. However, as the\n    later is not verifiable when trying to estimate :math:`\\epsilon`,\n    this is not very helpful. Its use is not recommended, but it is\n    provided here for comparison purposes due to its prevalence in\n    everyday practical statistics.\n\n    This function requires ``scipy`` for all interval types.\n\n    References\n    ----------\n    .. [1] Brown, Lawrence D.; Cai, T. Tony; DasGupta, Anirban (2001).\n       \"Interval Estimation for a Binomial Proportion\". Statistical\n       Science 16 (2): 101-133. doi:10.1214/ss/1009213286\n\n    .. [2] Wilson, E. B. (1927). \"Probable inference, the law of\n       succession, and statistical inference\". Journal of the American\n       Statistical Association 22: 209-212.\n\n    .. [3] Jeffreys, Harold (1946). \"An Invariant Form for the Prior\n       Probability in Estimation Problems\". Proc. R. Soc. Lond.. A 24 186\n       (1007): 453-461. doi:10.1098/rspa.1946.0056\n\n    .. [4] Jeffreys, Harold (1998). Theory of Probability. Oxford\n       University Press, 3rd edition. ISBN 978-0198503682\n\n    Examples\n    --------\n    Integer inputs return an array with shape (2,):\n\n    >>> binom_conf_interval(4, 5, interval='wilson')  # doctest: +FLOAT_CMP\n    array([0.57921724, 0.92078259])\n\n    Arrays of arbitrary dimension are supported. The Wilson and Jeffreys\n    intervals give similar results, even for small k, n:\n\n    >>> binom_conf_interval([1, 2], 5, interval='wilson')  # doctest: +FLOAT_CMP\n    array([[0.07921741, 0.21597328],\n           [0.42078276, 0.61736012]])\n\n    >>> binom_conf_interval([1, 2,], 5, interval='jeffreys')  # doctest: +FLOAT_CMP\n    array([[0.0842525 , 0.21789949],\n           [0.42218001, 0.61753691]])\n\n    >>> binom_conf_interval([1, 2], 5, interval='flat')  # doctest: +FLOAT_CMP\n    array([[0.12139799, 0.24309021],\n           [0.45401727, 0.61535699]])\n\n    In contrast, the Wald interval gives poor results for small k, n.\n    For k = 0 or k = n, the interval always has zero length.\n\n    >>> binom_conf_interval([1, 2], 5, interval='wald')  # doctest: +FLOAT_CMP\n    array([[0.02111437, 0.18091075],\n           [0.37888563, 0.61908925]])\n\n    For confidence intervals approaching 1, the Wald interval for\n    0 < k < n can give intervals that extend outside [0, 1]:\n\n    >>> binom_conf_interval([1, 2], 5, interval='wald', confidence_level=0.99)  # doctest: +FLOAT_CMP\n    array([[-0.26077835, -0.16433593],\n           [ 0.66077835,  0.96433593]])\n\n    ","endLoc":314,"header":"def binom_conf_interval(k, n, confidence_level=0.68269, interval='wilson')","id":8424,"name":"binom_conf_interval","nodeType":"Function","startLoc":90,"text":"def binom_conf_interval(k, n, confidence_level=0.68269, interval='wilson'):\n    r\"\"\"Binomial proportion confidence interval given k successes,\n    n trials.\n\n    Parameters\n    ----------\n    k : int or numpy.ndarray\n        Number of successes (0 <= ``k`` <= ``n``).\n    n : int or numpy.ndarray\n        Number of trials (``n`` > 0).  If both ``k`` and ``n`` are arrays,\n        they must have the same shape.\n    confidence_level : float, optional\n        Desired probability content of interval. Default is 0.68269,\n        corresponding to 1 sigma in a 1-dimensional Gaussian distribution.\n        Confidence level must be in range [0, 1].\n    interval : {'wilson', 'jeffreys', 'flat', 'wald'}, optional\n        Formula used for confidence interval. See notes for details.  The\n        ``'wilson'`` and ``'jeffreys'`` intervals generally give similar\n        results, while 'flat' is somewhat different, especially for small\n        values of ``n``.  ``'wilson'`` should be somewhat faster than\n        ``'flat'`` or ``'jeffreys'``.  The 'wald' interval is generally not\n        recommended.  It is provided for comparison purposes.  Default is\n        ``'wilson'``.\n\n    Returns\n    -------\n    conf_interval : ndarray\n        ``conf_interval[0]`` and ``conf_interval[1]`` correspond to the lower\n        and upper limits, respectively, for each element in ``k``, ``n``.\n\n    Notes\n    -----\n    In situations where a probability of success is not known, it can\n    be estimated from a number of trials (n) and number of\n    observed successes (k). For example, this is done in Monte\n    Carlo experiments designed to estimate a detection efficiency. It\n    is simple to take the sample proportion of successes (k/n)\n    as a reasonable best estimate of the true probability\n    :math:`\\epsilon`. However, deriving an accurate confidence\n    interval on :math:`\\epsilon` is non-trivial. There are several\n    formulas for this interval (see [1]_). Four intervals are implemented\n    here:\n\n    **1. The Wilson Interval.** This interval, attributed to Wilson [2]_,\n    is given by\n\n    .. math::\n\n        CI_{\\rm Wilson} = \\frac{k + \\kappa^2/2}{n + \\kappa^2}\n        \\pm \\frac{\\kappa n^{1/2}}{n + \\kappa^2}\n        ((\\hat{\\epsilon}(1 - \\hat{\\epsilon}) + \\kappa^2/(4n))^{1/2}\n\n    where :math:`\\hat{\\epsilon} = k / n` and :math:`\\kappa` is the\n    number of standard deviations corresponding to the desired\n    confidence interval for a *normal* distribution (for example,\n    1.0 for a confidence interval of 68.269%). For a\n    confidence interval of 100(1 - :math:`\\alpha`)%,\n\n    .. math::\n\n        \\kappa = \\Phi^{-1}(1-\\alpha/2) = \\sqrt{2}{\\rm erf}^{-1}(1-\\alpha).\n\n    **2. The Jeffreys Interval.** This interval is derived by applying\n    Bayes' theorem to the binomial distribution with the\n    noninformative Jeffreys prior [3]_, [4]_. The noninformative Jeffreys\n    prior is the Beta distribution, Beta(1/2, 1/2), which has the density\n    function\n\n    .. math::\n\n        f(\\epsilon) = \\pi^{-1} \\epsilon^{-1/2}(1-\\epsilon)^{-1/2}.\n\n    The justification for this prior is that it is invariant under\n    reparameterizations of the binomial proportion.\n    The posterior density function is also a Beta distribution: Beta(k\n    + 1/2, n - k + 1/2). The interval is then chosen so that it is\n    *equal-tailed*: Each tail (outside the interval) contains\n    :math:`\\alpha`/2 of the posterior probability, and the interval\n    itself contains 1 - :math:`\\alpha`. This interval must be\n    calculated numerically. Additionally, when k = 0 the lower limit\n    is set to 0 and when k = n the upper limit is set to 1, so that in\n    these cases, there is only one tail containing :math:`\\alpha`/2\n    and the interval itself contains 1 - :math:`\\alpha`/2 rather than\n    the nominal 1 - :math:`\\alpha`.\n\n    **3. A Flat prior.** This is similar to the Jeffreys interval,\n    but uses a flat (uniform) prior on the binomial proportion\n    over the range 0 to 1 rather than the reparametrization-invariant\n    Jeffreys prior.  The posterior density function is a Beta distribution:\n    Beta(k + 1, n - k + 1).  The same comments about the nature of the\n    interval (equal-tailed, etc.) also apply to this option.\n\n    **4. The Wald Interval.** This interval is given by\n\n    .. math::\n\n       CI_{\\rm Wald} = \\hat{\\epsilon} \\pm\n       \\kappa \\sqrt{\\frac{\\hat{\\epsilon}(1-\\hat{\\epsilon})}{n}}\n\n    The Wald interval gives acceptable results in some limiting\n    cases. Particularly, when n is very large, and the true proportion\n    :math:`\\epsilon` is not \"too close\" to 0 or 1. However, as the\n    later is not verifiable when trying to estimate :math:`\\epsilon`,\n    this is not very helpful. Its use is not recommended, but it is\n    provided here for comparison purposes due to its prevalence in\n    everyday practical statistics.\n\n    This function requires ``scipy`` for all interval types.\n\n    References\n    ----------\n    .. [1] Brown, Lawrence D.; Cai, T. Tony; DasGupta, Anirban (2001).\n       \"Interval Estimation for a Binomial Proportion\". Statistical\n       Science 16 (2): 101-133. doi:10.1214/ss/1009213286\n\n    .. [2] Wilson, E. B. (1927). \"Probable inference, the law of\n       succession, and statistical inference\". Journal of the American\n       Statistical Association 22: 209-212.\n\n    .. [3] Jeffreys, Harold (1946). \"An Invariant Form for the Prior\n       Probability in Estimation Problems\". Proc. R. Soc. Lond.. A 24 186\n       (1007): 453-461. doi:10.1098/rspa.1946.0056\n\n    .. [4] Jeffreys, Harold (1998). Theory of Probability. Oxford\n       University Press, 3rd edition. ISBN 978-0198503682\n\n    Examples\n    --------\n    Integer inputs return an array with shape (2,):\n\n    >>> binom_conf_interval(4, 5, interval='wilson')  # doctest: +FLOAT_CMP\n    array([0.57921724, 0.92078259])\n\n    Arrays of arbitrary dimension are supported. The Wilson and Jeffreys\n    intervals give similar results, even for small k, n:\n\n    >>> binom_conf_interval([1, 2], 5, interval='wilson')  # doctest: +FLOAT_CMP\n    array([[0.07921741, 0.21597328],\n           [0.42078276, 0.61736012]])\n\n    >>> binom_conf_interval([1, 2,], 5, interval='jeffreys')  # doctest: +FLOAT_CMP\n    array([[0.0842525 , 0.21789949],\n           [0.42218001, 0.61753691]])\n\n    >>> binom_conf_interval([1, 2], 5, interval='flat')  # doctest: +FLOAT_CMP\n    array([[0.12139799, 0.24309021],\n           [0.45401727, 0.61535699]])\n\n    In contrast, the Wald interval gives poor results for small k, n.\n    For k = 0 or k = n, the interval always has zero length.\n\n    >>> binom_conf_interval([1, 2], 5, interval='wald')  # doctest: +FLOAT_CMP\n    array([[0.02111437, 0.18091075],\n           [0.37888563, 0.61908925]])\n\n    For confidence intervals approaching 1, the Wald interval for\n    0 < k < n can give intervals that extend outside [0, 1]:\n\n    >>> binom_conf_interval([1, 2], 5, interval='wald', confidence_level=0.99)  # doctest: +FLOAT_CMP\n    array([[-0.26077835, -0.16433593],\n           [ 0.66077835,  0.96433593]])\n\n    \"\"\"  # noqa\n    if confidence_level < 0. or confidence_level > 1.:\n        raise ValueError('confidence_level must be between 0. and 1.')\n    alpha = 1. - confidence_level\n\n    k = np.asarray(k).astype(int)\n    n = np.asarray(n).astype(int)\n\n    if (n <= 0).any():\n        raise ValueError('n must be positive')\n    if (k < 0).any() or (k > n).any():\n        raise ValueError('k must be in {0, 1, .., n}')\n\n    if interval == 'wilson' or interval == 'wald':\n        from scipy.special import erfinv\n        kappa = np.sqrt(2.) * min(erfinv(confidence_level), 1.e10)  # Avoid overflows.\n        k = k.astype(float)\n        n = n.astype(float)\n        p = k / n\n\n        if interval == 'wilson':\n            midpoint = (k + kappa ** 2 / 2.) / (n + kappa ** 2)\n            halflength = (kappa * np.sqrt(n)) / (n + kappa ** 2) * \\\n                np.sqrt(p * (1 - p) + kappa ** 2 / (4 * n))\n            conf_interval = np.array([midpoint - halflength,\n                                      midpoint + halflength])\n\n            # Correct intervals out of range due to floating point errors.\n            conf_interval[conf_interval < 0.] = 0.\n            conf_interval[conf_interval > 1.] = 1.\n        else:\n            midpoint = p\n            halflength = kappa * np.sqrt(p * (1. - p) / n)\n            conf_interval = np.array([midpoint - halflength,\n                                      midpoint + halflength])\n\n    elif interval == 'jeffreys' or interval == 'flat':\n        from scipy.special import betaincinv\n\n        if interval == 'jeffreys':\n            lowerbound = betaincinv(k + 0.5, n - k + 0.5, 0.5 * alpha)\n            upperbound = betaincinv(k + 0.5, n - k + 0.5, 1. - 0.5 * alpha)\n        else:\n            lowerbound = betaincinv(k + 1, n - k + 1, 0.5 * alpha)\n            upperbound = betaincinv(k + 1, n - k + 1, 1. - 0.5 * alpha)\n\n        # Set lower or upper bound to k/n when k/n = 0 or 1\n        #  We have to treat the special case of k/n being scalars,\n        #  which is an ugly kludge\n        if lowerbound.ndim == 0:\n            if k == 0:\n                lowerbound = 0.\n            elif k == n:\n                upperbound = 1.\n        else:\n            lowerbound[k == 0] = 0\n            upperbound[k == n] = 1\n\n        conf_interval = np.array([lowerbound, upperbound])\n    else:\n        raise ValueError(f'Unrecognized interval: {interval:s}')\n\n    return conf_interval"},{"col":4,"comment":"null","endLoc":758,"header":"def _unregister(self, private_key)","id":8425,"name":"_unregister","nodeType":"Function","startLoc":719,"text":"def _unregister(self, private_key):\n\n        self._update_last_activity_time()\n\n        public_key = \"\"\n\n        self._notify_unregister(private_key)\n\n        with self._thread_lock:\n\n            if private_key in self._private_keys:\n                public_key = self._private_keys[private_key][0]\n                del self._private_keys[private_key]\n            else:\n                return \"\"\n\n            if private_key in self._metadata:\n                del self._metadata[private_key]\n\n            if private_key in self._id2mtypes:\n                del self._id2mtypes[private_key]\n\n            for mtype in self._mtype2ids.keys():\n                if private_key in self._mtype2ids[mtype]:\n                    self._mtype2ids[mtype].remove(private_key)\n\n            if public_key in self._xmlrpc_endpoints:\n                del self._xmlrpc_endpoints[public_key]\n\n            if private_key in self._client_activity_time:\n                del self._client_activity_time[private_key]\n\n            if self._web_profile:\n                if private_key in self._web_profile_callbacks:\n                    del self._web_profile_callbacks[private_key]\n                self._web_profile_server.remove_client(private_key)\n\n        log.debug(f\"unregister {public_key} ({private_key})\")\n\n        return \"\""},{"col":4,"comment":"null","endLoc":602,"header":"def _notify_unregister(self, private_key)","id":8426,"name":"_notify_unregister","nodeType":"Function","startLoc":592,"text":"def _notify_unregister(self, private_key):\n        msubs = SAMPHubServer.get_mtype_subtypes(\"samp.hub.event.unregister\")\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                public_id = self._private_keys[private_key][0]\n                for key in self._mtype2ids[mtype]:\n                    if key != private_key:\n                        self._notify(self._hub_private_key,\n                                     self._private_keys[key][0],\n                                     {\"samp.mtype\": \"samp.hub.event.unregister\",\n                                      \"samp.params\": {\"id\": public_id}})"},{"fileName":"spatial.py","filePath":"astropy/stats","id":8427,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module implements functions and classes for spatial statistics.\n\"\"\"\n\n\nimport numpy as np\nimport math\n\n\n__all__ = ['RipleysKEstimator']\n\n\nclass RipleysKEstimator:\n    \"\"\"\n    Estimators for Ripley's K function for two-dimensional spatial data.\n    See [1]_, [2]_, [3]_, [4]_, [5]_ for detailed mathematical and\n    practical aspects of those estimators.\n\n    Parameters\n    ----------\n    area : float\n        Area of study from which the points where observed.\n    x_max, y_max : float, float, optional\n        Maximum rectangular coordinates of the area of study.\n        Required if ``mode == 'translation'`` or ``mode == ohser``.\n    x_min, y_min : float, float, optional\n        Minimum rectangular coordinates of the area of study.\n        Required if ``mode == 'variable-width'`` or ``mode == ohser``.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from matplotlib import pyplot as plt # doctest: +SKIP\n    >>> from astropy.stats import RipleysKEstimator\n    >>> z = np.random.uniform(low=5, high=10, size=(100, 2))\n    >>> Kest = RipleysKEstimator(area=25, x_max=10, y_max=10,\n    ... x_min=5, y_min=5)\n    >>> r = np.linspace(0, 2.5, 100)\n    >>> plt.plot(r, Kest.poisson(r)) # doctest: +SKIP\n    >>> plt.plot(r, Kest(data=z, radii=r, mode='none')) # doctest: +SKIP\n    >>> plt.plot(r, Kest(data=z, radii=r, mode='translation')) # doctest: +SKIP\n    >>> plt.plot(r, Kest(data=z, radii=r, mode='ohser')) # doctest: +SKIP\n    >>> plt.plot(r, Kest(data=z, radii=r, mode='var-width')) # doctest: +SKIP\n    >>> plt.plot(r, Kest(data=z, radii=r, mode='ripley')) # doctest: +SKIP\n\n    References\n    ----------\n    .. [1] Peebles, P.J.E. *The large scale structure of the universe*.\n       <https://ui.adsabs.harvard.edu/abs/1980lssu.book.....P>\n    .. [2] Spatial descriptive statistics.\n       <https://en.wikipedia.org/wiki/Spatial_descriptive_statistics>\n    .. [3] Package spatstat.\n       <https://cran.r-project.org/web/packages/spatstat/spatstat.pdf>\n    .. [4] Cressie, N.A.C. (1991). Statistics for Spatial Data,\n       Wiley, New York.\n    .. [5] Stoyan, D., Stoyan, H. (1992). Fractals, Random Shapes and\n       Point Fields, Akademie Verlag GmbH, Chichester.\n    \"\"\"\n\n    def __init__(self, area, x_max=None, y_max=None, x_min=None, y_min=None):\n        self.area = area\n        self.x_max = x_max\n        self.y_max = y_max\n        self.x_min = x_min\n        self.y_min = y_min\n\n    @property\n    def area(self):\n        return self._area\n\n    @area.setter\n    def area(self, value):\n        if isinstance(value, (float, int)) and value > 0:\n            self._area = value\n        else:\n            raise ValueError(f'area is expected to be a positive number. Got {value}.')\n\n    @property\n    def y_max(self):\n        return self._y_max\n\n    @y_max.setter\n    def y_max(self, value):\n        if value is None or isinstance(value, (float, int)):\n            self._y_max = value\n        else:\n            raise ValueError('y_max is expected to be a real number '\n                             'or None. Got {}.'.format(value))\n\n    @property\n    def x_max(self):\n        return self._x_max\n\n    @x_max.setter\n    def x_max(self, value):\n        if value is None or isinstance(value, (float, int)):\n            self._x_max = value\n        else:\n            raise ValueError('x_max is expected to be a real number '\n                             'or None. Got {}.'.format(value))\n\n    @property\n    def y_min(self):\n        return self._y_min\n\n    @y_min.setter\n    def y_min(self, value):\n        if value is None or isinstance(value, (float, int)):\n            self._y_min = value\n        else:\n            raise ValueError(f'y_min is expected to be a real number. Got {value}.')\n\n    @property\n    def x_min(self):\n        return self._x_min\n\n    @x_min.setter\n    def x_min(self, value):\n        if value is None or isinstance(value, (float, int)):\n            self._x_min = value\n        else:\n            raise ValueError(f'x_min is expected to be a real number. Got {value}.')\n\n    def __call__(self, data, radii, mode='none'):\n        return self.evaluate(data=data, radii=radii, mode=mode)\n\n    def _pairwise_diffs(self, data):\n        npts = len(data)\n        diff = np.zeros(shape=(npts * (npts - 1) // 2, 2), dtype=np.double)\n        k = 0\n        for i in range(npts - 1):\n            size = npts - i - 1\n            diff[k:k + size] = abs(data[i] - data[i+1:])\n            k += size\n\n        return diff\n\n    def poisson(self, radii):\n        \"\"\"\n        Evaluates the Ripley K function for the homogeneous Poisson process,\n        also known as Complete State of Randomness (CSR).\n\n        Parameters\n        ----------\n        radii : 1D array\n            Set of distances in which Ripley's K function will be evaluated.\n\n        Returns\n        -------\n        output : 1D array\n            Ripley's K function evaluated at ``radii``.\n        \"\"\"\n\n        return np.pi * radii * radii\n\n    def Lfunction(self, data, radii, mode='none'):\n        \"\"\"\n        Evaluates the L function at ``radii``. For parameter description\n        see ``evaluate`` method.\n        \"\"\"\n\n        return np.sqrt(self.evaluate(data, radii, mode=mode) / np.pi)\n\n    def Hfunction(self, data, radii, mode='none'):\n        \"\"\"\n        Evaluates the H function at ``radii``. For parameter description\n        see ``evaluate`` method.\n        \"\"\"\n\n        return self.Lfunction(data, radii, mode=mode) - radii\n\n    def evaluate(self, data, radii, mode='none'):\n        \"\"\"\n        Evaluates the Ripley K estimator for a given set of values ``radii``.\n\n        Parameters\n        ----------\n        data : 2D array\n            Set of observed points in as a n by 2 array which will be used to\n            estimate Ripley's K function.\n        radii : 1D array\n            Set of distances in which Ripley's K estimator will be evaluated.\n            Usually, it's common to consider max(radii) < (area/2)**0.5.\n        mode : str\n            Keyword which indicates the method for edge effects correction.\n            Available methods are 'none', 'translation', 'ohser', 'var-width',\n            and 'ripley'.\n\n            * 'none'\n                this method does not take into account any edge effects\n                whatsoever.\n            * 'translation'\n                computes the intersection of rectangular areas centered at\n                the given points provided the upper bounds of the\n                dimensions of the rectangular area of study. It assumes that\n                all the points lie in a bounded rectangular region satisfying\n                x_min < x_i < x_max; y_min < y_i < y_max. A detailed\n                description of this method can be found on ref [4].\n            * 'ohser'\n                this method uses the isotropized set covariance function of\n                the window of study as a weight to correct for\n                edge-effects. A detailed description of this method can be\n                found on ref [4].\n            * 'var-width'\n                this method considers the distance of each observed point to\n                the nearest boundary of the study window as a factor to\n                account for edge-effects. See [3] for a brief description of\n                this method.\n            * 'ripley'\n                this method is known as Ripley's edge-corrected estimator.\n                The weight for edge-correction is a function of the\n                proportions of circumferences centered at each data point\n                which crosses another data point of interest. See [3] for\n                a detailed description of this method.\n\n        Returns\n        -------\n        ripley : 1D array\n            Ripley's K function estimator evaluated at ``radii``.\n        \"\"\"\n\n        data = np.asarray(data)\n\n        if not data.shape[1] == 2:\n            raise ValueError('data must be an n by 2 array, where n is the '\n                             'number of observed points.')\n\n        npts = len(data)\n        ripley = np.zeros(len(radii))\n\n        if mode == 'none':\n            diff = self._pairwise_diffs(data)\n            distances = np.hypot(diff[:, 0], diff[:, 1])\n            for r in range(len(radii)):\n                ripley[r] = (distances < radii[r]).sum()\n\n            ripley = self.area * 2. * ripley / (npts * (npts - 1))\n        # eq. 15.11 Stoyan book page 283\n        elif mode == 'translation':\n            diff = self._pairwise_diffs(data)\n            distances = np.hypot(diff[:, 0], diff[:, 1])\n            intersec_area = (((self.x_max - self.x_min) - diff[:, 0]) *\n                             ((self.y_max - self.y_min) - diff[:, 1]))\n\n            for r in range(len(radii)):\n                dist_indicator = distances < radii[r]\n                ripley[r] = ((1 / intersec_area) * dist_indicator).sum()\n\n            ripley = (self.area**2 / (npts * (npts - 1))) * 2 * ripley\n        # Stoyan book page 123 and eq 15.13\n        elif mode == 'ohser':\n            diff = self._pairwise_diffs(data)\n            distances = np.hypot(diff[:, 0], diff[:, 1])\n            a = self.area\n            b = max((self.y_max - self.y_min) / (self.x_max - self.x_min),\n                    (self.x_max - self.x_min) / (self.y_max - self.y_min))\n            x = distances / math.sqrt(a / b)\n            u = np.sqrt((x * x - 1) * (x > 1))\n            v = np.sqrt((x * x - b ** 2) * (x < math.sqrt(b ** 2 + 1)) * (x > b))\n            c1 = np.pi - 2 * x * (1 + 1 / b) + x * x / b\n            c2 = 2 * np.arcsin((1 / x) * (x > 1)) - 1 / b - 2 * (x - u)\n            c3 = (2 * np.arcsin(((b - u * v) / (x * x))\n                                * (x > b) * (x < math.sqrt(b ** 2 + 1)))\n                  + 2 * u + 2 * v / b - b - (1 + x * x) / b)\n\n            cov_func = ((a / np.pi) * (c1 * (x >= 0) * (x <= 1)\n                        + c2 * (x > 1) * (x <= b)\n                        + c3 * (b < x) * (x < math.sqrt(b ** 2 + 1))))\n\n            for r in range(len(radii)):\n                dist_indicator = distances < radii[r]\n                ripley[r] = ((1 / cov_func) * dist_indicator).sum()\n\n            ripley = (self.area**2 / (npts * (npts - 1))) * 2 * ripley\n        # Cressie book eq 8.2.20 page 616\n        elif mode == 'var-width':\n            lt_dist = np.minimum(np.minimum(self.x_max - data[:, 0], self.y_max - data[:, 1]),\n                                 np.minimum(data[:, 0] - self.x_min, data[:, 1] - self.y_min))\n\n            for r in range(len(radii)):\n                for i in range(npts):\n                    for j in range(npts):\n                        if i != j:\n                            diff = abs(data[i] - data[j])\n                            dist = math.sqrt((diff * diff).sum())\n                            if dist < radii[r] < lt_dist[i]:\n                                ripley[r] = ripley[r] + 1\n                lt_dist_sum = (lt_dist > radii[r]).sum()\n                if not lt_dist_sum == 0:\n                    ripley[r] = ripley[r] / lt_dist_sum\n\n            ripley = self.area * ripley / npts\n        # Cressie book eq 8.4.22 page 640\n        elif mode == 'ripley':\n            hor_dist = np.zeros(shape=(npts * (npts - 1)) // 2,\n                                dtype=np.double)\n            ver_dist = np.zeros(shape=(npts * (npts - 1)) // 2,\n                                dtype=np.double)\n\n            for k in range(npts - 1):\n                min_hor_dist = min(self.x_max - data[k][0],\n                                   data[k][0] - self.x_min)\n                min_ver_dist = min(self.y_max - data[k][1],\n                                   data[k][1] - self.y_min)\n                start = (k * (2 * (npts - 1) - (k - 1))) // 2\n                end = ((k + 1) * (2 * (npts - 1) - k)) // 2\n                hor_dist[start: end] = min_hor_dist * np.ones(npts - 1 - k)\n                ver_dist[start: end] = min_ver_dist * np.ones(npts - 1 - k)\n\n            diff = self._pairwise_diffs(data)\n            dist = np.hypot(diff[:, 0], diff[:, 1])\n            dist_ind = dist <= np.hypot(hor_dist, ver_dist)\n\n            w1 = (1 - (np.arccos(np.minimum(ver_dist, dist) / dist) +\n                       np.arccos(np.minimum(hor_dist, dist) / dist)) / np.pi)\n            w2 = (3 / 4 - 0.5 * (\n                np.arccos(ver_dist / dist * ~dist_ind) +\n                np.arccos(hor_dist / dist * ~dist_ind)) / np.pi)\n\n            weight = dist_ind * w1 + ~dist_ind * w2\n\n            for r in range(len(radii)):\n                ripley[r] = ((dist < radii[r]) / weight).sum()\n\n            ripley = self.area * 2. * ripley / (npts * (npts - 1))\n        else:\n            raise ValueError(f'mode {mode} is not implemented.')\n\n        return ripley\n"},{"col":4,"comment":"null","endLoc":1633,"header":"def __init__(self, crpix, a_order, b_order, a_coeff={}, b_coeff={},\n                 ap_order=None, bp_order=None, ap_coeff={}, bp_coeff={},\n                 n_models=None, model_set_axis=None, name=None, meta=None)","id":8428,"name":"__init__","nodeType":"Function","startLoc":1612,"text":"def __init__(self, crpix, a_order, b_order, a_coeff={}, b_coeff={},\n                 ap_order=None, bp_order=None, ap_coeff={}, bp_coeff={},\n                 n_models=None, model_set_axis=None, name=None, meta=None):\n        self._crpix = crpix\n        self._a_order = a_order\n        self._b_order = b_order\n        self._a_coeff = a_coeff\n        self._b_coeff = b_coeff\n        self._ap_order = ap_order\n        self._bp_order = bp_order\n        self._ap_coeff = ap_coeff\n        self._bp_coeff = bp_coeff\n        self.shift_a = Shift(-crpix[0])\n        self.shift_b = Shift(-crpix[1])\n        self.sip1d_a = _SIP1D(a_order, coeff_prefix='A', n_models=n_models,\n                              model_set_axis=model_set_axis, **a_coeff)\n        self.sip1d_b = _SIP1D(b_order, coeff_prefix='B', n_models=n_models,\n                              model_set_axis=model_set_axis, **b_coeff)\n        super().__init__(n_models=n_models, model_set_axis=model_set_axis,\n                         name=name, meta=meta)\n        self._inputs = (\"u\", \"v\")\n        self._outputs = (\"x\", \"y\")"},{"attributeType":"null","col":19,"comment":"null","endLoc":113,"id":8429,"name":"_jd2","nodeType":"Attribute","startLoc":113,"text":"self._jd2"},{"attributeType":"null","col":4,"comment":"null","endLoc":935,"id":8430,"name":"name","nodeType":"Attribute","startLoc":935,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1022,"id":8431,"name":"value","nodeType":"Attribute","startLoc":1022,"text":"value"},{"attributeType":"null","col":12,"comment":"null","endLoc":116,"id":8432,"name":"jd1","nodeType":"Attribute","startLoc":116,"text":"self.jd1"},{"attributeType":"null","col":8,"comment":"null","endLoc":967,"id":8433,"name":"jd1","nodeType":"Attribute","startLoc":967,"text":"self.jd1"},{"col":4,"comment":"null","endLoc":347,"header":"def _hub_as_client_request_handler(self, method, args)","id":8434,"name":"_hub_as_client_request_handler","nodeType":"Function","startLoc":339,"text":"def _hub_as_client_request_handler(self, method, args):\n        if method == 'samp.client.receiveCall':\n            return self._receive_call(*args)\n        elif method == 'samp.client.receiveNotification':\n            return self._receive_notification(*args)\n        elif method == 'samp.client.receiveResponse':\n            return self._receive_response(*args)\n        elif method == 'samp.app.ping':\n            return self._ping(*args)"},{"attributeType":"null","col":18,"comment":"null","endLoc":967,"id":8435,"name":"jd2","nodeType":"Attribute","startLoc":967,"text":"self.jd2"},{"col":0,"comment":"Binomial proportion and confidence interval in bins of a continuous\n    variable ``x``.\n\n    Given a set of datapoint pairs where the ``x`` values are\n    continuously distributed and the ``success`` values are binomial\n    (\"success / failure\" or \"true / false\"), place the pairs into\n    bins according to ``x`` value and calculate the binomial proportion\n    (fraction of successes) and confidence interval in each bin.\n\n    Parameters\n    ----------\n    x : sequence\n        Values.\n    success : sequence of bool\n        Success (`True`) or failure (`False`) corresponding to each value\n        in ``x``.  Must be same length as ``x``.\n    bins : int or sequence of scalar, optional\n        If bins is an int, it defines the number of equal-width bins\n        in the given range (10, by default). If bins is a sequence, it\n        defines the bin edges, including the rightmost edge, allowing\n        for non-uniform bin widths (in this case, 'range' is ignored).\n    range : (float, float), optional\n        The lower and upper range of the bins. If `None` (default),\n        the range is set to ``(x.min(), x.max())``. Values outside the\n        range are ignored.\n    confidence_level : float, optional\n        Must be in range [0, 1].\n        Desired probability content in the confidence\n        interval ``(p - perr[0], p + perr[1])`` in each bin. Default is\n        0.68269.\n    interval : {'wilson', 'jeffreys', 'flat', 'wald'}, optional\n        Formula used to calculate confidence interval on the\n        binomial proportion in each bin. See `binom_conf_interval` for\n        definition of the intervals.  The 'wilson', 'jeffreys',\n        and 'flat' intervals generally give similar results.  'wilson'\n        should be somewhat faster, while 'jeffreys' and 'flat' are\n        marginally superior, but differ in the assumed prior.\n        The 'wald' interval is generally not recommended.\n        It is provided for comparison purposes. Default is 'wilson'.\n\n    Returns\n    -------\n    bin_ctr : ndarray\n        Central value of bins. Bins without any entries are not returned.\n    bin_halfwidth : ndarray\n        Half-width of each bin such that ``bin_ctr - bin_halfwidth`` and\n        ``bin_ctr + bins_halfwidth`` give the left and right side of each bin,\n        respectively.\n    p : ndarray\n        Efficiency in each bin.\n    perr : ndarray\n        2-d array of shape (2, len(p)) representing the upper and lower\n        uncertainty on p in each bin.\n\n    Notes\n    -----\n    This function requires ``scipy`` for all interval types.\n\n    See Also\n    --------\n    binom_conf_interval : Function used to estimate confidence interval in\n                          each bin.\n\n    Examples\n    --------\n    Suppose we wish to estimate the efficiency of a survey in\n    detecting astronomical sources as a function of magnitude (i.e.,\n    the probability of detecting a source given its magnitude). In a\n    realistic case, we might prepare a large number of sources with\n    randomly selected magnitudes, inject them into simulated images,\n    and then record which were detected at the end of the reduction\n    pipeline. As a toy example, we generate 100 data points with\n    randomly selected magnitudes between 20 and 30 and \"observe\" them\n    with a known detection function (here, the error function, with\n    50% detection probability at magnitude 25):\n\n    >>> from scipy.special import erf\n    >>> from scipy.stats.distributions import binom\n    >>> def true_efficiency(x):\n    ...     return 0.5 - 0.5 * erf((x - 25.) / 2.)\n    >>> mag = 20. + 10. * np.random.rand(100)\n    >>> detected = binom.rvs(1, true_efficiency(mag))\n    >>> bins, binshw, p, perr = binned_binom_proportion(mag, detected, bins=20)\n    >>> plt.errorbar(bins, p, xerr=binshw, yerr=perr, ls='none', marker='o',\n    ...              label='estimate')\n\n    .. plot::\n\n       import numpy as np\n       from scipy.special import erf\n       from scipy.stats.distributions import binom\n       import matplotlib.pyplot as plt\n       from astropy.stats import binned_binom_proportion\n       def true_efficiency(x):\n           return 0.5 - 0.5 * erf((x - 25.) / 2.)\n       np.random.seed(400)\n       mag = 20. + 10. * np.random.rand(100)\n       np.random.seed(600)\n       detected = binom.rvs(1, true_efficiency(mag))\n       bins, binshw, p, perr = binned_binom_proportion(mag, detected, bins=20)\n       plt.errorbar(bins, p, xerr=binshw, yerr=perr, ls='none', marker='o',\n                    label='estimate')\n       X = np.linspace(20., 30., 1000)\n       plt.plot(X, true_efficiency(X), label='true efficiency')\n       plt.ylim(0., 1.)\n       plt.title('Detection efficiency vs magnitude')\n       plt.xlabel('Magnitude')\n       plt.ylabel('Detection efficiency')\n       plt.legend()\n       plt.show()\n\n    The above example uses the Wilson confidence interval to calculate\n    the uncertainty ``perr`` in each bin (see the definition of various\n    confidence intervals in `binom_conf_interval`). A commonly used\n    alternative is the Wald interval. However, the Wald interval can\n    give nonsensical uncertainties when the efficiency is near 0 or 1,\n    and is therefore **not** recommended. As an illustration, the\n    following example shows the same data as above but uses the Wald\n    interval rather than the Wilson interval to calculate ``perr``:\n\n    >>> bins, binshw, p, perr = binned_binom_proportion(mag, detected, bins=20,\n    ...                                                 interval='wald')\n    >>> plt.errorbar(bins, p, xerr=binshw, yerr=perr, ls='none', marker='o',\n    ...              label='estimate')\n\n    .. plot::\n\n       import numpy as np\n       from scipy.special import erf\n       from scipy.stats.distributions import binom\n       import matplotlib.pyplot as plt\n       from astropy.stats import binned_binom_proportion\n       def true_efficiency(x):\n           return 0.5 - 0.5 * erf((x - 25.) / 2.)\n       np.random.seed(400)\n       mag = 20. + 10. * np.random.rand(100)\n       np.random.seed(600)\n       detected = binom.rvs(1, true_efficiency(mag))\n       bins, binshw, p, perr = binned_binom_proportion(mag, detected, bins=20,\n                                                       interval='wald')\n       plt.errorbar(bins, p, xerr=binshw, yerr=perr, ls='none', marker='o',\n                    label='estimate')\n       X = np.linspace(20., 30., 1000)\n       plt.plot(X, true_efficiency(X), label='true efficiency')\n       plt.ylim(0., 1.)\n       plt.title('The Wald interval can give nonsensical uncertainties')\n       plt.xlabel('Magnitude')\n       plt.ylabel('Detection efficiency')\n       plt.legend()\n       plt.show()\n\n    ","endLoc":494,"header":"def binned_binom_proportion(x, success, bins=10, range=None,\n                            confidence_level=0.68269, interval='wilson')","id":8436,"name":"binned_binom_proportion","nodeType":"Function","startLoc":317,"text":"def binned_binom_proportion(x, success, bins=10, range=None,\n                            confidence_level=0.68269, interval='wilson'):\n    \"\"\"Binomial proportion and confidence interval in bins of a continuous\n    variable ``x``.\n\n    Given a set of datapoint pairs where the ``x`` values are\n    continuously distributed and the ``success`` values are binomial\n    (\"success / failure\" or \"true / false\"), place the pairs into\n    bins according to ``x`` value and calculate the binomial proportion\n    (fraction of successes) and confidence interval in each bin.\n\n    Parameters\n    ----------\n    x : sequence\n        Values.\n    success : sequence of bool\n        Success (`True`) or failure (`False`) corresponding to each value\n        in ``x``.  Must be same length as ``x``.\n    bins : int or sequence of scalar, optional\n        If bins is an int, it defines the number of equal-width bins\n        in the given range (10, by default). If bins is a sequence, it\n        defines the bin edges, including the rightmost edge, allowing\n        for non-uniform bin widths (in this case, 'range' is ignored).\n    range : (float, float), optional\n        The lower and upper range of the bins. If `None` (default),\n        the range is set to ``(x.min(), x.max())``. Values outside the\n        range are ignored.\n    confidence_level : float, optional\n        Must be in range [0, 1].\n        Desired probability content in the confidence\n        interval ``(p - perr[0], p + perr[1])`` in each bin. Default is\n        0.68269.\n    interval : {'wilson', 'jeffreys', 'flat', 'wald'}, optional\n        Formula used to calculate confidence interval on the\n        binomial proportion in each bin. See `binom_conf_interval` for\n        definition of the intervals.  The 'wilson', 'jeffreys',\n        and 'flat' intervals generally give similar results.  'wilson'\n        should be somewhat faster, while 'jeffreys' and 'flat' are\n        marginally superior, but differ in the assumed prior.\n        The 'wald' interval is generally not recommended.\n        It is provided for comparison purposes. Default is 'wilson'.\n\n    Returns\n    -------\n    bin_ctr : ndarray\n        Central value of bins. Bins without any entries are not returned.\n    bin_halfwidth : ndarray\n        Half-width of each bin such that ``bin_ctr - bin_halfwidth`` and\n        ``bin_ctr + bins_halfwidth`` give the left and right side of each bin,\n        respectively.\n    p : ndarray\n        Efficiency in each bin.\n    perr : ndarray\n        2-d array of shape (2, len(p)) representing the upper and lower\n        uncertainty on p in each bin.\n\n    Notes\n    -----\n    This function requires ``scipy`` for all interval types.\n\n    See Also\n    --------\n    binom_conf_interval : Function used to estimate confidence interval in\n                          each bin.\n\n    Examples\n    --------\n    Suppose we wish to estimate the efficiency of a survey in\n    detecting astronomical sources as a function of magnitude (i.e.,\n    the probability of detecting a source given its magnitude). In a\n    realistic case, we might prepare a large number of sources with\n    randomly selected magnitudes, inject them into simulated images,\n    and then record which were detected at the end of the reduction\n    pipeline. As a toy example, we generate 100 data points with\n    randomly selected magnitudes between 20 and 30 and \"observe\" them\n    with a known detection function (here, the error function, with\n    50% detection probability at magnitude 25):\n\n    >>> from scipy.special import erf\n    >>> from scipy.stats.distributions import binom\n    >>> def true_efficiency(x):\n    ...     return 0.5 - 0.5 * erf((x - 25.) / 2.)\n    >>> mag = 20. + 10. * np.random.rand(100)\n    >>> detected = binom.rvs(1, true_efficiency(mag))\n    >>> bins, binshw, p, perr = binned_binom_proportion(mag, detected, bins=20)\n    >>> plt.errorbar(bins, p, xerr=binshw, yerr=perr, ls='none', marker='o',\n    ...              label='estimate')\n\n    .. plot::\n\n       import numpy as np\n       from scipy.special import erf\n       from scipy.stats.distributions import binom\n       import matplotlib.pyplot as plt\n       from astropy.stats import binned_binom_proportion\n       def true_efficiency(x):\n           return 0.5 - 0.5 * erf((x - 25.) / 2.)\n       np.random.seed(400)\n       mag = 20. + 10. * np.random.rand(100)\n       np.random.seed(600)\n       detected = binom.rvs(1, true_efficiency(mag))\n       bins, binshw, p, perr = binned_binom_proportion(mag, detected, bins=20)\n       plt.errorbar(bins, p, xerr=binshw, yerr=perr, ls='none', marker='o',\n                    label='estimate')\n       X = np.linspace(20., 30., 1000)\n       plt.plot(X, true_efficiency(X), label='true efficiency')\n       plt.ylim(0., 1.)\n       plt.title('Detection efficiency vs magnitude')\n       plt.xlabel('Magnitude')\n       plt.ylabel('Detection efficiency')\n       plt.legend()\n       plt.show()\n\n    The above example uses the Wilson confidence interval to calculate\n    the uncertainty ``perr`` in each bin (see the definition of various\n    confidence intervals in `binom_conf_interval`). A commonly used\n    alternative is the Wald interval. However, the Wald interval can\n    give nonsensical uncertainties when the efficiency is near 0 or 1,\n    and is therefore **not** recommended. As an illustration, the\n    following example shows the same data as above but uses the Wald\n    interval rather than the Wilson interval to calculate ``perr``:\n\n    >>> bins, binshw, p, perr = binned_binom_proportion(mag, detected, bins=20,\n    ...                                                 interval='wald')\n    >>> plt.errorbar(bins, p, xerr=binshw, yerr=perr, ls='none', marker='o',\n    ...              label='estimate')\n\n    .. plot::\n\n       import numpy as np\n       from scipy.special import erf\n       from scipy.stats.distributions import binom\n       import matplotlib.pyplot as plt\n       from astropy.stats import binned_binom_proportion\n       def true_efficiency(x):\n           return 0.5 - 0.5 * erf((x - 25.) / 2.)\n       np.random.seed(400)\n       mag = 20. + 10. * np.random.rand(100)\n       np.random.seed(600)\n       detected = binom.rvs(1, true_efficiency(mag))\n       bins, binshw, p, perr = binned_binom_proportion(mag, detected, bins=20,\n                                                       interval='wald')\n       plt.errorbar(bins, p, xerr=binshw, yerr=perr, ls='none', marker='o',\n                    label='estimate')\n       X = np.linspace(20., 30., 1000)\n       plt.plot(X, true_efficiency(X), label='true efficiency')\n       plt.ylim(0., 1.)\n       plt.title('The Wald interval can give nonsensical uncertainties')\n       plt.xlabel('Magnitude')\n       plt.ylabel('Detection efficiency')\n       plt.legend()\n       plt.show()\n\n    \"\"\"\n    x = np.ravel(x)\n    success = np.ravel(success).astype(bool)\n    if x.shape != success.shape:\n        raise ValueError('sizes of x and success must match')\n\n    # Put values into a histogram (`n`). Put \"successful\" values\n    # into a second histogram (`k`) with identical binning.\n    n, bin_edges = np.histogram(x, bins=bins, range=range)\n    k, bin_edges = np.histogram(x[success], bins=bin_edges)\n    bin_ctr = (bin_edges[:-1] + bin_edges[1:]) / 2.\n    bin_halfwidth = bin_ctr - bin_edges[:-1]\n\n    # Remove bins with zero entries.\n    valid = n > 0\n    bin_ctr = bin_ctr[valid]\n    bin_halfwidth = bin_halfwidth[valid]\n    n = n[valid]\n    k = k[valid]\n\n    p = k / n\n    bounds = binom_conf_interval(k, n, confidence_level=confidence_level, interval=interval)\n    perr = np.abs(bounds - p)\n\n    return bin_ctr, bin_halfwidth, p, perr"},{"attributeType":"null","col":8,"comment":"null","endLoc":109,"id":8437,"name":"precision","nodeType":"Attribute","startLoc":109,"text":"self.precision"},{"className":"TimeFromEpoch","col":0,"comment":"\n    Base class for times that represent the interval from a particular\n    epoch as a floating point multiple of a unit time interval (e.g. seconds\n    or days).\n    ","endLoc":681,"id":8438,"nodeType":"Class","startLoc":579,"text":"class TimeFromEpoch(TimeNumeric):\n    \"\"\"\n    Base class for times that represent the interval from a particular\n    epoch as a floating point multiple of a unit time interval (e.g. seconds\n    or days).\n    \"\"\"\n\n    @classproperty(lazy=True)\n    def _epoch(cls):\n        # Ideally we would use `def epoch(cls)` here and not have the instance\n        # property below. However, this breaks the sphinx API docs generation\n        # in a way that was not resolved. See #10406 for details.\n        return Time(cls.epoch_val, cls.epoch_val2, scale=cls.epoch_scale,\n                    format=cls.epoch_format)\n\n    @property\n    def epoch(self):\n        \"\"\"Reference epoch time from which the time interval is measured\"\"\"\n        return self._epoch\n\n    def set_jds(self, val1, val2):\n        \"\"\"\n        Initialize the internal jd1 and jd2 attributes given val1 and val2.\n        For an TimeFromEpoch subclass like TimeUnix these will be floats giving\n        the effective seconds since an epoch time (e.g. 1970-01-01 00:00:00).\n        \"\"\"\n        # Form new JDs based on epoch time + time from epoch (converted to JD).\n        # One subtlety that might not be obvious is that 1.000 Julian days in\n        # UTC can be 86400 or 86401 seconds.  For the TimeUnix format the\n        # assumption is that every day is exactly 86400 seconds, so this is, in\n        # principle, doing the math incorrectly, *except* that it matches the\n        # definition of Unix time which does not include leap seconds.\n\n        # note: use divisor=1./self.unit, since this is either 1 or 1/86400,\n        # and 1/86400 is not exactly representable as a float64, so multiplying\n        # by that will cause rounding errors. (But inverting it as a float64\n        # recovers the exact number)\n        day, frac = day_frac(val1, val2, divisor=1. / self.unit)\n\n        jd1 = self.epoch.jd1 + day\n        jd2 = self.epoch.jd2 + frac\n\n        # For the usual case that scale is the same as epoch_scale, we only need\n        # to ensure that abs(jd2) <= 0.5. Since abs(self.epoch.jd2) <= 0.5 and\n        # abs(frac) <= 0.5, we can do simple (fast) checks and arithmetic here\n        # without another call to day_frac(). Note also that `round(jd2.item())`\n        # is about 10x faster than `np.round(jd2)`` for a scalar.\n        if self.epoch.scale == self.scale:\n            jd1_extra = np.round(jd2) if jd2.shape else round(jd2.item())\n            jd1 += jd1_extra\n            jd2 -= jd1_extra\n\n            self.jd1, self.jd2 = jd1, jd2\n            return\n\n        # Create a temporary Time object corresponding to the new (jd1, jd2) in\n        # the epoch scale (e.g. UTC for TimeUnix) then convert that to the\n        # desired time scale for this object.\n        #\n        # A known limitation is that the transform from self.epoch_scale to\n        # self.scale cannot involve any metadata like lat or lon.\n        try:\n            tm = getattr(Time(jd1, jd2, scale=self.epoch_scale,\n                              format='jd'), self.scale)\n        except Exception as err:\n            raise ScaleValueError(\"Cannot convert from '{}' epoch scale '{}'\"\n                                  \"to specified scale '{}', got error:\\n{}\"\n                                  .format(self.name, self.epoch_scale,\n                                          self.scale, err)) from err\n\n        self.jd1, self.jd2 = day_frac(tm._time.jd1, tm._time.jd2)\n\n    def to_value(self, parent=None, **kwargs):\n        # Make sure that scale is the same as epoch scale so we can just\n        # subtract the epoch and convert\n        if self.scale != self.epoch_scale:\n            if parent is None:\n                raise ValueError('cannot compute value without parent Time object')\n            try:\n                tm = getattr(parent, self.epoch_scale)\n            except Exception as err:\n                raise ScaleValueError(\"Cannot convert from '{}' epoch scale '{}'\"\n                                      \"to specified scale '{}', got error:\\n{}\"\n                                      .format(self.name, self.epoch_scale,\n                                              self.scale, err)) from err\n\n            jd1, jd2 = tm._time.jd1, tm._time.jd2\n        else:\n            jd1, jd2 = self.jd1, self.jd2\n\n        # This factor is guaranteed to be exactly representable, which\n        # means time_from_epoch1 is calculated exactly.\n        factor = 1. / self.unit\n        time_from_epoch1 = (jd1 - self.epoch.jd1) * factor\n        time_from_epoch2 = (jd2 - self.epoch.jd2) * factor\n\n        return super().to_value(jd1=time_from_epoch1, jd2=time_from_epoch2, **kwargs)\n\n    value = property(to_value)\n\n    @property\n    def _default_scale(self):\n        return self.epoch_scale"},{"col":4,"comment":"null","endLoc":592,"header":"@classproperty(lazy=True)\n    def _epoch(cls)","id":8439,"name":"_epoch","nodeType":"Function","startLoc":586,"text":"@classproperty(lazy=True)\n    def _epoch(cls):\n        # Ideally we would use `def epoch(cls)` here and not have the instance\n        # property below. However, this breaks the sphinx API docs generation\n        # in a way that was not resolved. See #10406 for details.\n        return Time(cls.epoch_val, cls.epoch_val2, scale=cls.epoch_scale,\n                    format=cls.epoch_format)"},{"attributeType":"{__eq__}","col":8,"comment":"null","endLoc":165,"id":8440,"name":"_in_subfmt","nodeType":"Attribute","startLoc":165,"text":"self._in_subfmt"},{"col":0,"comment":"null","endLoc":503,"header":"def _check_poisson_conf_inputs(sigma, background, confidence_level, name)","id":8441,"name":"_check_poisson_conf_inputs","nodeType":"Function","startLoc":497,"text":"def _check_poisson_conf_inputs(sigma, background, confidence_level, name):\n    if sigma != 1:\n        raise ValueError(f\"Only sigma=1 supported for interval {name}\")\n    if background != 0:\n        raise ValueError(f\"background not supported for interval {name}\")\n    if confidence_level is not None:\n        raise ValueError(f\"confidence_level not supported for interval {name}\")"},{"col":0,"comment":"Poisson parameter confidence interval given observed counts\n\n    Parameters\n    ----------\n    n : int or numpy.ndarray\n        Number of counts (0 <= ``n``).\n    interval : {'root-n','root-n-0','pearson','sherpagehrels','frequentist-confidence', 'kraft-burrows-nousek'}, optional\n        Formula used for confidence interval. See notes for details.\n        Default is ``'root-n'``.\n    sigma : float, optional\n        Number of sigma for confidence interval; only supported for\n        the 'frequentist-confidence' mode.\n    background : float, optional\n        Number of counts expected from the background; only supported for\n        the 'kraft-burrows-nousek' mode. This number is assumed to be determined\n        from a large region so that the uncertainty on its value is negligible.\n    confidence_level : float, optional\n        Confidence level between 0 and 1; only supported for the\n        'kraft-burrows-nousek' mode.\n\n    Returns\n    -------\n    conf_interval : ndarray\n        ``conf_interval[0]`` and ``conf_interval[1]`` correspond to the lower\n        and upper limits, respectively, for each element in ``n``.\n\n    Notes\n    -----\n\n    The \"right\" confidence interval to use for Poisson data is a\n    matter of debate. The CDF working group `recommends\n    <https://web.archive.org/web/20210222093249/https://www-cdf.fnal.gov/physics/statistics/notes/pois_eb.txt>`_\n    using root-n throughout, largely in the interest of\n    comprehensibility, but discusses other possibilities. The ATLAS\n    group also `discusses\n    <http://www.pp.rhul.ac.uk/~cowan/atlas/ErrorBars.pdf>`_  several\n    possibilities but concludes that no single representation is\n    suitable for all cases.  The suggestion has also been `floated\n    <https://ui.adsabs.harvard.edu/abs/2012EPJP..127...24A>`_ that error\n    bars should be attached to theoretical predictions instead of\n    observed data, which this function will not help with (but it's\n    easy; then you really should use the square root of the theoretical\n    prediction).\n\n    The intervals implemented here are:\n\n    **1. 'root-n'** This is a very widely used standard rule derived\n    from the maximum-likelihood estimator for the mean of the Poisson\n    process. While it produces questionable results for small n and\n    outright wrong results for n=0, it is standard enough that people are\n    (supposedly) used to interpreting these wonky values. The interval is\n\n    .. math::\n\n        CI = (n-\\sqrt{n}, n+\\sqrt{n})\n\n    **2. 'root-n-0'** This is identical to the above except that where\n    n is zero the interval returned is (0,1).\n\n    **3. 'pearson'** This is an only-slightly-more-complicated rule\n    based on Pearson's chi-squared rule (as `explained\n    <https://web.archive.org/web/20210222093249/https://www-cdf.fnal.gov/physics/statistics/notes/pois_eb.txt>`_ by\n    the CDF working group). It also has the nice feature that if your\n    theory curve touches an endpoint of the interval, then your data\n    point is indeed one sigma away. The interval is\n\n    .. math::\n\n        CI = (n+0.5-\\sqrt{n+0.25}, n+0.5+\\sqrt{n+0.25})\n\n    **4. 'sherpagehrels'** This rule is used by default in the fitting\n    package 'sherpa'. The `documentation\n    <https://cxc.harvard.edu/sherpa4.4/statistics/#chigehrels>`_ claims\n    it is based on a numerical approximation published in `Gehrels\n    (1986) <https://ui.adsabs.harvard.edu/abs/1986ApJ...303..336G>`_ but it\n    does not actually appear there.  It is symmetrical, and while the\n    upper limits are within about 1% of those given by\n    'frequentist-confidence', the lower limits can be badly wrong. The\n    interval is\n\n    .. math::\n\n        CI = (n-1-\\sqrt{n+0.75}, n+1+\\sqrt{n+0.75})\n\n    **5. 'frequentist-confidence'** These are frequentist central\n    confidence intervals:\n\n    .. math::\n\n        CI = (0.5 F_{\\chi^2}^{-1}(\\alpha;2n),\n              0.5 F_{\\chi^2}^{-1}(1-\\alpha;2(n+1)))\n\n    where :math:`F_{\\chi^2}^{-1}` is the quantile of the chi-square\n    distribution with the indicated number of degrees of freedom and\n    :math:`\\alpha` is the one-tailed probability of the normal\n    distribution (at the point given by the parameter 'sigma'). See\n    `Maxwell (2011)\n    <https://ui.adsabs.harvard.edu/abs/2011arXiv1102.0822M>`_ for further\n    details.\n\n    **6. 'kraft-burrows-nousek'** This is a Bayesian approach which allows\n    for the presence of a known background :math:`B` in the source signal\n    :math:`N`.\n    For a given confidence level :math:`CL` the confidence interval\n    :math:`[S_\\mathrm{min}, S_\\mathrm{max}]` is given by:\n\n    .. math::\n\n       CL = \\int^{S_\\mathrm{max}}_{S_\\mathrm{min}} f_{N,B}(S)dS\n\n    where the function :math:`f_{N,B}` is:\n\n    .. math::\n\n       f_{N,B}(S) = C \\frac{e^{-(S+B)}(S+B)^N}{N!}\n\n    and the normalization constant :math:`C`:\n\n    .. math::\n\n       C = \\left[ \\int_0^\\infty \\frac{e^{-(S+B)}(S+B)^N}{N!} dS \\right] ^{-1}\n       = \\left( \\sum^N_{n=0} \\frac{e^{-B}B^n}{n!}  \\right)^{-1}\n\n    See `Kraft, Burrows, and Nousek (1991)\n    <https://ui.adsabs.harvard.edu/abs/1991ApJ...374..344K>`_ for further\n    details.\n\n    These formulas implement a positive, uniform prior.\n    `Kraft, Burrows, and Nousek (1991)\n    <https://ui.adsabs.harvard.edu/abs/1991ApJ...374..344K>`_ discuss this\n    choice in more detail and show that the problem is relatively\n    insensitive to the choice of prior.\n\n    This function has an optional dependency: Either `Scipy\n    <https://www.scipy.org/>`_ or `mpmath <http://mpmath.org/>`_  need\n    to be available (Scipy works only for N < 100).\n    This code is very intense numerically, which makes it much slower than\n    the other methods, in particular for large count numbers (above 1000\n    even with ``mpmath``). Fortunately, some of the other methods or a\n    Gaussian approximation usually work well in this regime.\n\n    Examples\n    --------\n    >>> poisson_conf_interval(np.arange(10), interval='root-n').T\n    array([[  0.        ,   0.        ],\n           [  0.        ,   2.        ],\n           [  0.58578644,   3.41421356],\n           [  1.26794919,   4.73205081],\n           [  2.        ,   6.        ],\n           [  2.76393202,   7.23606798],\n           [  3.55051026,   8.44948974],\n           [  4.35424869,   9.64575131],\n           [  5.17157288,  10.82842712],\n           [  6.        ,  12.        ]])\n\n    >>> poisson_conf_interval(np.arange(10), interval='root-n-0').T\n    array([[  0.        ,   1.        ],\n           [  0.        ,   2.        ],\n           [  0.58578644,   3.41421356],\n           [  1.26794919,   4.73205081],\n           [  2.        ,   6.        ],\n           [  2.76393202,   7.23606798],\n           [  3.55051026,   8.44948974],\n           [  4.35424869,   9.64575131],\n           [  5.17157288,  10.82842712],\n           [  6.        ,  12.        ]])\n\n    >>> poisson_conf_interval(np.arange(10), interval='pearson').T\n    array([[  0.        ,   1.        ],\n           [  0.38196601,   2.61803399],\n           [  1.        ,   4.        ],\n           [  1.69722436,   5.30277564],\n           [  2.43844719,   6.56155281],\n           [  3.20871215,   7.79128785],\n           [  4.        ,   9.        ],\n           [  4.8074176 ,  10.1925824 ],\n           [  5.62771868,  11.37228132],\n           [  6.45861873,  12.54138127]])\n\n    >>> poisson_conf_interval(\n    ...     np.arange(10), interval='frequentist-confidence').T\n    array([[  0.        ,   1.84102165],\n           [  0.17275378,   3.29952656],\n           [  0.70818544,   4.63785962],\n           [  1.36729531,   5.91818583],\n           [  2.08566081,   7.16275317],\n           [  2.84030886,   8.38247265],\n           [  3.62006862,   9.58364155],\n           [  4.41852954,  10.77028072],\n           [  5.23161394,  11.94514152],\n           [  6.05653896,  13.11020414]])\n\n    >>> poisson_conf_interval(\n    ...     7, interval='frequentist-confidence').T\n    array([  4.41852954,  10.77028072])\n\n    >>> poisson_conf_interval(\n    ...     10, background=1.5, confidence_level=0.95,\n    ...     interval='kraft-burrows-nousek').T  # doctest: +FLOAT_CMP\n    array([[ 3.47894005, 16.113329533]])\n\n    ","endLoc":769,"header":"def poisson_conf_interval(n, interval='root-n', sigma=1, background=0,\n                          confidence_level=None)","id":8442,"name":"poisson_conf_interval","nodeType":"Function","startLoc":506,"text":"def poisson_conf_interval(n, interval='root-n', sigma=1, background=0,\n                          confidence_level=None):\n    r\"\"\"Poisson parameter confidence interval given observed counts\n\n    Parameters\n    ----------\n    n : int or numpy.ndarray\n        Number of counts (0 <= ``n``).\n    interval : {'root-n','root-n-0','pearson','sherpagehrels','frequentist-confidence', 'kraft-burrows-nousek'}, optional\n        Formula used for confidence interval. See notes for details.\n        Default is ``'root-n'``.\n    sigma : float, optional\n        Number of sigma for confidence interval; only supported for\n        the 'frequentist-confidence' mode.\n    background : float, optional\n        Number of counts expected from the background; only supported for\n        the 'kraft-burrows-nousek' mode. This number is assumed to be determined\n        from a large region so that the uncertainty on its value is negligible.\n    confidence_level : float, optional\n        Confidence level between 0 and 1; only supported for the\n        'kraft-burrows-nousek' mode.\n\n    Returns\n    -------\n    conf_interval : ndarray\n        ``conf_interval[0]`` and ``conf_interval[1]`` correspond to the lower\n        and upper limits, respectively, for each element in ``n``.\n\n    Notes\n    -----\n\n    The \"right\" confidence interval to use for Poisson data is a\n    matter of debate. The CDF working group `recommends\n    <https://web.archive.org/web/20210222093249/https://www-cdf.fnal.gov/physics/statistics/notes/pois_eb.txt>`_\n    using root-n throughout, largely in the interest of\n    comprehensibility, but discusses other possibilities. The ATLAS\n    group also `discusses\n    <http://www.pp.rhul.ac.uk/~cowan/atlas/ErrorBars.pdf>`_  several\n    possibilities but concludes that no single representation is\n    suitable for all cases.  The suggestion has also been `floated\n    <https://ui.adsabs.harvard.edu/abs/2012EPJP..127...24A>`_ that error\n    bars should be attached to theoretical predictions instead of\n    observed data, which this function will not help with (but it's\n    easy; then you really should use the square root of the theoretical\n    prediction).\n\n    The intervals implemented here are:\n\n    **1. 'root-n'** This is a very widely used standard rule derived\n    from the maximum-likelihood estimator for the mean of the Poisson\n    process. While it produces questionable results for small n and\n    outright wrong results for n=0, it is standard enough that people are\n    (supposedly) used to interpreting these wonky values. The interval is\n\n    .. math::\n\n        CI = (n-\\sqrt{n}, n+\\sqrt{n})\n\n    **2. 'root-n-0'** This is identical to the above except that where\n    n is zero the interval returned is (0,1).\n\n    **3. 'pearson'** This is an only-slightly-more-complicated rule\n    based on Pearson's chi-squared rule (as `explained\n    <https://web.archive.org/web/20210222093249/https://www-cdf.fnal.gov/physics/statistics/notes/pois_eb.txt>`_ by\n    the CDF working group). It also has the nice feature that if your\n    theory curve touches an endpoint of the interval, then your data\n    point is indeed one sigma away. The interval is\n\n    .. math::\n\n        CI = (n+0.5-\\sqrt{n+0.25}, n+0.5+\\sqrt{n+0.25})\n\n    **4. 'sherpagehrels'** This rule is used by default in the fitting\n    package 'sherpa'. The `documentation\n    <https://cxc.harvard.edu/sherpa4.4/statistics/#chigehrels>`_ claims\n    it is based on a numerical approximation published in `Gehrels\n    (1986) <https://ui.adsabs.harvard.edu/abs/1986ApJ...303..336G>`_ but it\n    does not actually appear there.  It is symmetrical, and while the\n    upper limits are within about 1% of those given by\n    'frequentist-confidence', the lower limits can be badly wrong. The\n    interval is\n\n    .. math::\n\n        CI = (n-1-\\sqrt{n+0.75}, n+1+\\sqrt{n+0.75})\n\n    **5. 'frequentist-confidence'** These are frequentist central\n    confidence intervals:\n\n    .. math::\n\n        CI = (0.5 F_{\\chi^2}^{-1}(\\alpha;2n),\n              0.5 F_{\\chi^2}^{-1}(1-\\alpha;2(n+1)))\n\n    where :math:`F_{\\chi^2}^{-1}` is the quantile of the chi-square\n    distribution with the indicated number of degrees of freedom and\n    :math:`\\alpha` is the one-tailed probability of the normal\n    distribution (at the point given by the parameter 'sigma'). See\n    `Maxwell (2011)\n    <https://ui.adsabs.harvard.edu/abs/2011arXiv1102.0822M>`_ for further\n    details.\n\n    **6. 'kraft-burrows-nousek'** This is a Bayesian approach which allows\n    for the presence of a known background :math:`B` in the source signal\n    :math:`N`.\n    For a given confidence level :math:`CL` the confidence interval\n    :math:`[S_\\mathrm{min}, S_\\mathrm{max}]` is given by:\n\n    .. math::\n\n       CL = \\int^{S_\\mathrm{max}}_{S_\\mathrm{min}} f_{N,B}(S)dS\n\n    where the function :math:`f_{N,B}` is:\n\n    .. math::\n\n       f_{N,B}(S) = C \\frac{e^{-(S+B)}(S+B)^N}{N!}\n\n    and the normalization constant :math:`C`:\n\n    .. math::\n\n       C = \\left[ \\int_0^\\infty \\frac{e^{-(S+B)}(S+B)^N}{N!} dS \\right] ^{-1}\n       = \\left( \\sum^N_{n=0} \\frac{e^{-B}B^n}{n!}  \\right)^{-1}\n\n    See `Kraft, Burrows, and Nousek (1991)\n    <https://ui.adsabs.harvard.edu/abs/1991ApJ...374..344K>`_ for further\n    details.\n\n    These formulas implement a positive, uniform prior.\n    `Kraft, Burrows, and Nousek (1991)\n    <https://ui.adsabs.harvard.edu/abs/1991ApJ...374..344K>`_ discuss this\n    choice in more detail and show that the problem is relatively\n    insensitive to the choice of prior.\n\n    This function has an optional dependency: Either `Scipy\n    <https://www.scipy.org/>`_ or `mpmath <http://mpmath.org/>`_  need\n    to be available (Scipy works only for N < 100).\n    This code is very intense numerically, which makes it much slower than\n    the other methods, in particular for large count numbers (above 1000\n    even with ``mpmath``). Fortunately, some of the other methods or a\n    Gaussian approximation usually work well in this regime.\n\n    Examples\n    --------\n    >>> poisson_conf_interval(np.arange(10), interval='root-n').T\n    array([[  0.        ,   0.        ],\n           [  0.        ,   2.        ],\n           [  0.58578644,   3.41421356],\n           [  1.26794919,   4.73205081],\n           [  2.        ,   6.        ],\n           [  2.76393202,   7.23606798],\n           [  3.55051026,   8.44948974],\n           [  4.35424869,   9.64575131],\n           [  5.17157288,  10.82842712],\n           [  6.        ,  12.        ]])\n\n    >>> poisson_conf_interval(np.arange(10), interval='root-n-0').T\n    array([[  0.        ,   1.        ],\n           [  0.        ,   2.        ],\n           [  0.58578644,   3.41421356],\n           [  1.26794919,   4.73205081],\n           [  2.        ,   6.        ],\n           [  2.76393202,   7.23606798],\n           [  3.55051026,   8.44948974],\n           [  4.35424869,   9.64575131],\n           [  5.17157288,  10.82842712],\n           [  6.        ,  12.        ]])\n\n    >>> poisson_conf_interval(np.arange(10), interval='pearson').T\n    array([[  0.        ,   1.        ],\n           [  0.38196601,   2.61803399],\n           [  1.        ,   4.        ],\n           [  1.69722436,   5.30277564],\n           [  2.43844719,   6.56155281],\n           [  3.20871215,   7.79128785],\n           [  4.        ,   9.        ],\n           [  4.8074176 ,  10.1925824 ],\n           [  5.62771868,  11.37228132],\n           [  6.45861873,  12.54138127]])\n\n    >>> poisson_conf_interval(\n    ...     np.arange(10), interval='frequentist-confidence').T\n    array([[  0.        ,   1.84102165],\n           [  0.17275378,   3.29952656],\n           [  0.70818544,   4.63785962],\n           [  1.36729531,   5.91818583],\n           [  2.08566081,   7.16275317],\n           [  2.84030886,   8.38247265],\n           [  3.62006862,   9.58364155],\n           [  4.41852954,  10.77028072],\n           [  5.23161394,  11.94514152],\n           [  6.05653896,  13.11020414]])\n\n    >>> poisson_conf_interval(\n    ...     7, interval='frequentist-confidence').T\n    array([  4.41852954,  10.77028072])\n\n    >>> poisson_conf_interval(\n    ...     10, background=1.5, confidence_level=0.95,\n    ...     interval='kraft-burrows-nousek').T  # doctest: +FLOAT_CMP\n    array([[ 3.47894005, 16.113329533]])\n\n    \"\"\"  # noqa\n\n    if not np.isscalar(n):\n        n = np.asanyarray(n)\n\n    if interval == 'root-n':\n        _check_poisson_conf_inputs(sigma, background, confidence_level, interval)\n        conf_interval = np.array([n - np.sqrt(n),\n                                  n + np.sqrt(n)])\n    elif interval == 'root-n-0':\n        _check_poisson_conf_inputs(sigma, background, confidence_level, interval)\n        conf_interval = np.array([n - np.sqrt(n),\n                                  n + np.sqrt(n)])\n        if np.isscalar(n):\n            if n == 0:\n                conf_interval[1] = 1\n        else:\n            conf_interval[1, n == 0] = 1\n    elif interval == 'pearson':\n        _check_poisson_conf_inputs(sigma, background, confidence_level, interval)\n        conf_interval = np.array([n + 0.5 - np.sqrt(n + 0.25),\n                                  n + 0.5 + np.sqrt(n + 0.25)])\n    elif interval == 'sherpagehrels':\n        _check_poisson_conf_inputs(sigma, background, confidence_level, interval)\n        conf_interval = np.array([n - 1 - np.sqrt(n + 0.75),\n                                  n + 1 + np.sqrt(n + 0.75)])\n    elif interval == 'frequentist-confidence':\n        _check_poisson_conf_inputs(1., background, confidence_level, interval)\n        import scipy.stats\n        alpha = scipy.stats.norm.sf(sigma)\n        conf_interval = np.array([0.5 * scipy.stats.chi2(2 * n).ppf(alpha),\n                                  0.5 * scipy.stats.chi2(2 * n + 2).isf(alpha)])\n        if np.isscalar(n):\n            if n == 0:\n                conf_interval[0] = 0\n        else:\n            conf_interval[0, n == 0] = 0\n    elif interval == 'kraft-burrows-nousek':\n        # Deprecation warning in Python 3.9 when N is float, so we force int,\n        # see https://github.com/astropy/astropy/issues/10832\n        if np.isscalar(n):\n            if not isinstance(n, int):\n                raise TypeError('Number of counts must be integer.')\n        elif not issubclass(n.dtype.type, np.integer):\n            raise TypeError('Number of counts must be integer.')\n\n        if confidence_level is None:\n            raise ValueError('Set confidence_level for method {}. (sigma is '\n                             'ignored.)'.format(interval))\n        confidence_level = np.asanyarray(confidence_level)\n        if np.any(confidence_level <= 0) or np.any(confidence_level >= 1):\n            raise ValueError('confidence_level must be a number between 0 and 1.')\n        background = np.asanyarray(background)\n        if np.any(background < 0):\n            raise ValueError('Background must be >= 0.')\n        conf_interval = np.vectorize(_kraft_burrows_nousek,\n                                     cache=True)(n, background, confidence_level)\n        conf_interval = np.vstack(conf_interval)\n    else:\n        raise ValueError(f\"Invalid method for Poisson confidence intervals: {interval}\")\n    return conf_interval"},{"attributeType":"null","col":8,"comment":"null","endLoc":108,"id":8443,"name":"scale","nodeType":"Attribute","startLoc":108,"text":"self.scale"},{"col":4,"comment":"null","endLoc":1265,"header":"def _receive_call(self, private_key, sender_id, msg_id, message)","id":8444,"name":"_receive_call","nodeType":"Function","startLoc":1246,"text":"def _receive_call(self, private_key, sender_id, msg_id, message):\n        if private_key == self._hub_private_key:\n\n            if \"samp.mtype\" in message and message[\"samp.mtype\"] == \"samp.app.ping\":\n                self._reply(self._hub_private_key, msg_id,\n                            {\"samp.status\": SAMP_STATUS_OK, \"samp.result\": {}})\n\n            elif (\"samp.mtype\" in message and\n                 (message[\"samp.mtype\"] == \"x-samp.query.by-meta\" or\n                  message[\"samp.mtype\"] == \"samp.query.by-meta\")):\n\n                ids_list = self._query_by_metadata(message[\"samp.params\"][\"key\"],\n                                                   message[\"samp.params\"][\"value\"])\n                self._reply(self._hub_private_key, msg_id,\n                            {\"samp.status\": SAMP_STATUS_OK,\n                             \"samp.result\": {\"ids\": ids_list}})\n\n            return \"\"\n        else:\n            return \"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":110,"id":8445,"name":"in_subfmt","nodeType":"Attribute","startLoc":110,"text":"self.in_subfmt"},{"attributeType":"null","col":12,"comment":"null","endLoc":117,"id":8446,"name":"jd2","nodeType":"Attribute","startLoc":117,"text":"self.jd2"},{"className":"RipleysKEstimator","col":0,"comment":"\n    Estimators for Ripley's K function for two-dimensional spatial data.\n    See [1]_, [2]_, [3]_, [4]_, [5]_ for detailed mathematical and\n    practical aspects of those estimators.\n\n    Parameters\n    ----------\n    area : float\n        Area of study from which the points where observed.\n    x_max, y_max : float, float, optional\n        Maximum rectangular coordinates of the area of study.\n        Required if ``mode == 'translation'`` or ``mode == ohser``.\n    x_min, y_min : float, float, optional\n        Minimum rectangular coordinates of the area of study.\n        Required if ``mode == 'variable-width'`` or ``mode == ohser``.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from matplotlib import pyplot as plt # doctest: +SKIP\n    >>> from astropy.stats import RipleysKEstimator\n    >>> z = np.random.uniform(low=5, high=10, size=(100, 2))\n    >>> Kest = RipleysKEstimator(area=25, x_max=10, y_max=10,\n    ... x_min=5, y_min=5)\n    >>> r = np.linspace(0, 2.5, 100)\n    >>> plt.plot(r, Kest.poisson(r)) # doctest: +SKIP\n    >>> plt.plot(r, Kest(data=z, radii=r, mode='none')) # doctest: +SKIP\n    >>> plt.plot(r, Kest(data=z, radii=r, mode='translation')) # doctest: +SKIP\n    >>> plt.plot(r, Kest(data=z, radii=r, mode='ohser')) # doctest: +SKIP\n    >>> plt.plot(r, Kest(data=z, radii=r, mode='var-width')) # doctest: +SKIP\n    >>> plt.plot(r, Kest(data=z, radii=r, mode='ripley')) # doctest: +SKIP\n\n    References\n    ----------\n    .. [1] Peebles, P.J.E. *The large scale structure of the universe*.\n       <https://ui.adsabs.harvard.edu/abs/1980lssu.book.....P>\n    .. [2] Spatial descriptive statistics.\n       <https://en.wikipedia.org/wiki/Spatial_descriptive_statistics>\n    .. [3] Package spatstat.\n       <https://cran.r-project.org/web/packages/spatstat/spatstat.pdf>\n    .. [4] Cressie, N.A.C. (1991). Statistics for Spatial Data,\n       Wiley, New York.\n    .. [5] Stoyan, D., Stoyan, H. (1992). Fractals, Random Shapes and\n       Point Fields, Akademie Verlag GmbH, Chichester.\n    ","endLoc":330,"id":8447,"nodeType":"Class","startLoc":14,"text":"class RipleysKEstimator:\n    \"\"\"\n    Estimators for Ripley's K function for two-dimensional spatial data.\n    See [1]_, [2]_, [3]_, [4]_, [5]_ for detailed mathematical and\n    practical aspects of those estimators.\n\n    Parameters\n    ----------\n    area : float\n        Area of study from which the points where observed.\n    x_max, y_max : float, float, optional\n        Maximum rectangular coordinates of the area of study.\n        Required if ``mode == 'translation'`` or ``mode == ohser``.\n    x_min, y_min : float, float, optional\n        Minimum rectangular coordinates of the area of study.\n        Required if ``mode == 'variable-width'`` or ``mode == ohser``.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from matplotlib import pyplot as plt # doctest: +SKIP\n    >>> from astropy.stats import RipleysKEstimator\n    >>> z = np.random.uniform(low=5, high=10, size=(100, 2))\n    >>> Kest = RipleysKEstimator(area=25, x_max=10, y_max=10,\n    ... x_min=5, y_min=5)\n    >>> r = np.linspace(0, 2.5, 100)\n    >>> plt.plot(r, Kest.poisson(r)) # doctest: +SKIP\n    >>> plt.plot(r, Kest(data=z, radii=r, mode='none')) # doctest: +SKIP\n    >>> plt.plot(r, Kest(data=z, radii=r, mode='translation')) # doctest: +SKIP\n    >>> plt.plot(r, Kest(data=z, radii=r, mode='ohser')) # doctest: +SKIP\n    >>> plt.plot(r, Kest(data=z, radii=r, mode='var-width')) # doctest: +SKIP\n    >>> plt.plot(r, Kest(data=z, radii=r, mode='ripley')) # doctest: +SKIP\n\n    References\n    ----------\n    .. [1] Peebles, P.J.E. *The large scale structure of the universe*.\n       <https://ui.adsabs.harvard.edu/abs/1980lssu.book.....P>\n    .. [2] Spatial descriptive statistics.\n       <https://en.wikipedia.org/wiki/Spatial_descriptive_statistics>\n    .. [3] Package spatstat.\n       <https://cran.r-project.org/web/packages/spatstat/spatstat.pdf>\n    .. [4] Cressie, N.A.C. (1991). Statistics for Spatial Data,\n       Wiley, New York.\n    .. [5] Stoyan, D., Stoyan, H. (1992). Fractals, Random Shapes and\n       Point Fields, Akademie Verlag GmbH, Chichester.\n    \"\"\"\n\n    def __init__(self, area, x_max=None, y_max=None, x_min=None, y_min=None):\n        self.area = area\n        self.x_max = x_max\n        self.y_max = y_max\n        self.x_min = x_min\n        self.y_min = y_min\n\n    @property\n    def area(self):\n        return self._area\n\n    @area.setter\n    def area(self, value):\n        if isinstance(value, (float, int)) and value > 0:\n            self._area = value\n        else:\n            raise ValueError(f'area is expected to be a positive number. Got {value}.')\n\n    @property\n    def y_max(self):\n        return self._y_max\n\n    @y_max.setter\n    def y_max(self, value):\n        if value is None or isinstance(value, (float, int)):\n            self._y_max = value\n        else:\n            raise ValueError('y_max is expected to be a real number '\n                             'or None. Got {}.'.format(value))\n\n    @property\n    def x_max(self):\n        return self._x_max\n\n    @x_max.setter\n    def x_max(self, value):\n        if value is None or isinstance(value, (float, int)):\n            self._x_max = value\n        else:\n            raise ValueError('x_max is expected to be a real number '\n                             'or None. Got {}.'.format(value))\n\n    @property\n    def y_min(self):\n        return self._y_min\n\n    @y_min.setter\n    def y_min(self, value):\n        if value is None or isinstance(value, (float, int)):\n            self._y_min = value\n        else:\n            raise ValueError(f'y_min is expected to be a real number. Got {value}.')\n\n    @property\n    def x_min(self):\n        return self._x_min\n\n    @x_min.setter\n    def x_min(self, value):\n        if value is None or isinstance(value, (float, int)):\n            self._x_min = value\n        else:\n            raise ValueError(f'x_min is expected to be a real number. Got {value}.')\n\n    def __call__(self, data, radii, mode='none'):\n        return self.evaluate(data=data, radii=radii, mode=mode)\n\n    def _pairwise_diffs(self, data):\n        npts = len(data)\n        diff = np.zeros(shape=(npts * (npts - 1) // 2, 2), dtype=np.double)\n        k = 0\n        for i in range(npts - 1):\n            size = npts - i - 1\n            diff[k:k + size] = abs(data[i] - data[i+1:])\n            k += size\n\n        return diff\n\n    def poisson(self, radii):\n        \"\"\"\n        Evaluates the Ripley K function for the homogeneous Poisson process,\n        also known as Complete State of Randomness (CSR).\n\n        Parameters\n        ----------\n        radii : 1D array\n            Set of distances in which Ripley's K function will be evaluated.\n\n        Returns\n        -------\n        output : 1D array\n            Ripley's K function evaluated at ``radii``.\n        \"\"\"\n\n        return np.pi * radii * radii\n\n    def Lfunction(self, data, radii, mode='none'):\n        \"\"\"\n        Evaluates the L function at ``radii``. For parameter description\n        see ``evaluate`` method.\n        \"\"\"\n\n        return np.sqrt(self.evaluate(data, radii, mode=mode) / np.pi)\n\n    def Hfunction(self, data, radii, mode='none'):\n        \"\"\"\n        Evaluates the H function at ``radii``. For parameter description\n        see ``evaluate`` method.\n        \"\"\"\n\n        return self.Lfunction(data, radii, mode=mode) - radii\n\n    def evaluate(self, data, radii, mode='none'):\n        \"\"\"\n        Evaluates the Ripley K estimator for a given set of values ``radii``.\n\n        Parameters\n        ----------\n        data : 2D array\n            Set of observed points in as a n by 2 array which will be used to\n            estimate Ripley's K function.\n        radii : 1D array\n            Set of distances in which Ripley's K estimator will be evaluated.\n            Usually, it's common to consider max(radii) < (area/2)**0.5.\n        mode : str\n            Keyword which indicates the method for edge effects correction.\n            Available methods are 'none', 'translation', 'ohser', 'var-width',\n            and 'ripley'.\n\n            * 'none'\n                this method does not take into account any edge effects\n                whatsoever.\n            * 'translation'\n                computes the intersection of rectangular areas centered at\n                the given points provided the upper bounds of the\n                dimensions of the rectangular area of study. It assumes that\n                all the points lie in a bounded rectangular region satisfying\n                x_min < x_i < x_max; y_min < y_i < y_max. A detailed\n                description of this method can be found on ref [4].\n            * 'ohser'\n                this method uses the isotropized set covariance function of\n                the window of study as a weight to correct for\n                edge-effects. A detailed description of this method can be\n                found on ref [4].\n            * 'var-width'\n                this method considers the distance of each observed point to\n                the nearest boundary of the study window as a factor to\n                account for edge-effects. See [3] for a brief description of\n                this method.\n            * 'ripley'\n                this method is known as Ripley's edge-corrected estimator.\n                The weight for edge-correction is a function of the\n                proportions of circumferences centered at each data point\n                which crosses another data point of interest. See [3] for\n                a detailed description of this method.\n\n        Returns\n        -------\n        ripley : 1D array\n            Ripley's K function estimator evaluated at ``radii``.\n        \"\"\"\n\n        data = np.asarray(data)\n\n        if not data.shape[1] == 2:\n            raise ValueError('data must be an n by 2 array, where n is the '\n                             'number of observed points.')\n\n        npts = len(data)\n        ripley = np.zeros(len(radii))\n\n        if mode == 'none':\n            diff = self._pairwise_diffs(data)\n            distances = np.hypot(diff[:, 0], diff[:, 1])\n            for r in range(len(radii)):\n                ripley[r] = (distances < radii[r]).sum()\n\n            ripley = self.area * 2. * ripley / (npts * (npts - 1))\n        # eq. 15.11 Stoyan book page 283\n        elif mode == 'translation':\n            diff = self._pairwise_diffs(data)\n            distances = np.hypot(diff[:, 0], diff[:, 1])\n            intersec_area = (((self.x_max - self.x_min) - diff[:, 0]) *\n                             ((self.y_max - self.y_min) - diff[:, 1]))\n\n            for r in range(len(radii)):\n                dist_indicator = distances < radii[r]\n                ripley[r] = ((1 / intersec_area) * dist_indicator).sum()\n\n            ripley = (self.area**2 / (npts * (npts - 1))) * 2 * ripley\n        # Stoyan book page 123 and eq 15.13\n        elif mode == 'ohser':\n            diff = self._pairwise_diffs(data)\n            distances = np.hypot(diff[:, 0], diff[:, 1])\n            a = self.area\n            b = max((self.y_max - self.y_min) / (self.x_max - self.x_min),\n                    (self.x_max - self.x_min) / (self.y_max - self.y_min))\n            x = distances / math.sqrt(a / b)\n            u = np.sqrt((x * x - 1) * (x > 1))\n            v = np.sqrt((x * x - b ** 2) * (x < math.sqrt(b ** 2 + 1)) * (x > b))\n            c1 = np.pi - 2 * x * (1 + 1 / b) + x * x / b\n            c2 = 2 * np.arcsin((1 / x) * (x > 1)) - 1 / b - 2 * (x - u)\n            c3 = (2 * np.arcsin(((b - u * v) / (x * x))\n                                * (x > b) * (x < math.sqrt(b ** 2 + 1)))\n                  + 2 * u + 2 * v / b - b - (1 + x * x) / b)\n\n            cov_func = ((a / np.pi) * (c1 * (x >= 0) * (x <= 1)\n                        + c2 * (x > 1) * (x <= b)\n                        + c3 * (b < x) * (x < math.sqrt(b ** 2 + 1))))\n\n            for r in range(len(radii)):\n                dist_indicator = distances < radii[r]\n                ripley[r] = ((1 / cov_func) * dist_indicator).sum()\n\n            ripley = (self.area**2 / (npts * (npts - 1))) * 2 * ripley\n        # Cressie book eq 8.2.20 page 616\n        elif mode == 'var-width':\n            lt_dist = np.minimum(np.minimum(self.x_max - data[:, 0], self.y_max - data[:, 1]),\n                                 np.minimum(data[:, 0] - self.x_min, data[:, 1] - self.y_min))\n\n            for r in range(len(radii)):\n                for i in range(npts):\n                    for j in range(npts):\n                        if i != j:\n                            diff = abs(data[i] - data[j])\n                            dist = math.sqrt((diff * diff).sum())\n                            if dist < radii[r] < lt_dist[i]:\n                                ripley[r] = ripley[r] + 1\n                lt_dist_sum = (lt_dist > radii[r]).sum()\n                if not lt_dist_sum == 0:\n                    ripley[r] = ripley[r] / lt_dist_sum\n\n            ripley = self.area * ripley / npts\n        # Cressie book eq 8.4.22 page 640\n        elif mode == 'ripley':\n            hor_dist = np.zeros(shape=(npts * (npts - 1)) // 2,\n                                dtype=np.double)\n            ver_dist = np.zeros(shape=(npts * (npts - 1)) // 2,\n                                dtype=np.double)\n\n            for k in range(npts - 1):\n                min_hor_dist = min(self.x_max - data[k][0],\n                                   data[k][0] - self.x_min)\n                min_ver_dist = min(self.y_max - data[k][1],\n                                   data[k][1] - self.y_min)\n                start = (k * (2 * (npts - 1) - (k - 1))) // 2\n                end = ((k + 1) * (2 * (npts - 1) - k)) // 2\n                hor_dist[start: end] = min_hor_dist * np.ones(npts - 1 - k)\n                ver_dist[start: end] = min_ver_dist * np.ones(npts - 1 - k)\n\n            diff = self._pairwise_diffs(data)\n            dist = np.hypot(diff[:, 0], diff[:, 1])\n            dist_ind = dist <= np.hypot(hor_dist, ver_dist)\n\n            w1 = (1 - (np.arccos(np.minimum(ver_dist, dist) / dist) +\n                       np.arccos(np.minimum(hor_dist, dist) / dist)) / np.pi)\n            w2 = (3 / 4 - 0.5 * (\n                np.arccos(ver_dist / dist * ~dist_ind) +\n                np.arccos(hor_dist / dist * ~dist_ind)) / np.pi)\n\n            weight = dist_ind * w1 + ~dist_ind * w2\n\n            for r in range(len(radii)):\n                ripley[r] = ((dist < radii[r]) / weight).sum()\n\n            ripley = self.area * 2. * ripley / (npts * (npts - 1))\n        else:\n            raise ValueError(f'mode {mode} is not implemented.')\n\n        return ripley"},{"col":4,"comment":"null","endLoc":66,"header":"def __init__(self, area, x_max=None, y_max=None, x_min=None, y_min=None)","id":8448,"name":"__init__","nodeType":"Function","startLoc":61,"text":"def __init__(self, area, x_max=None, y_max=None, x_min=None, y_min=None):\n        self.area = area\n        self.x_max = x_max\n        self.y_max = y_max\n        self.x_min = x_min\n        self.y_min = y_min"},{"col":4,"comment":"null","endLoc":70,"header":"@property\n    def area(self)","id":8449,"name":"area","nodeType":"Function","startLoc":68,"text":"@property\n    def area(self):\n        return self._area"},{"col":4,"comment":"null","endLoc":77,"header":"@area.setter\n    def area(self, value)","id":8450,"name":"area","nodeType":"Function","startLoc":72,"text":"@area.setter\n    def area(self, value):\n        if isinstance(value, (float, int)) and value > 0:\n            self._area = value\n        else:\n            raise ValueError(f'area is expected to be a positive number. Got {value}.')"},{"attributeType":"{__eq__}","col":8,"comment":"null","endLoc":175,"id":8451,"name":"_out_subfmt","nodeType":"Attribute","startLoc":175,"text":"self._out_subfmt"},{"attributeType":"null","col":8,"comment":"null","endLoc":111,"id":8452,"name":"out_subfmt","nodeType":"Attribute","startLoc":111,"text":"self.out_subfmt"},{"attributeType":"null","col":12,"comment":"null","endLoc":139,"id":8453,"name":"subfmts","nodeType":"Attribute","startLoc":139,"text":"cls.subfmts"},{"col":4,"comment":"null","endLoc":81,"header":"@property\n    def y_max(self)","id":8454,"name":"y_max","nodeType":"Function","startLoc":79,"text":"@property\n    def y_max(self):\n        return self._y_max"},{"col":4,"comment":"null","endLoc":89,"header":"@y_max.setter\n    def y_max(self, value)","id":8455,"name":"y_max","nodeType":"Function","startLoc":83,"text":"@y_max.setter\n    def y_max(self, value):\n        if value is None or isinstance(value, (float, int)):\n            self._y_max = value\n        else:\n            raise ValueError('y_max is expected to be a real number '\n                             'or None. Got {}.'.format(value))"},{"col":4,"comment":"\n        The main method that gets called for replying. This starts up an\n        asynchronous reply thread and returns.\n        ","endLoc":1134,"header":"def _reply(self, private_key, msg_id, response)","id":8456,"name":"_reply","nodeType":"Function","startLoc":1122,"text":"def _reply(self, private_key, msg_id, response):\n        \"\"\"\n        The main method that gets called for replying. This starts up an\n        asynchronous reply thread and returns.\n        \"\"\"\n        self._update_last_activity_time(private_key)\n        if private_key in self._private_keys:\n            self._launch_thread(target=self._reply_, args=(private_key, msg_id,\n                                                           response))\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n\n        return {}"},{"col":4,"comment":"null","endLoc":93,"header":"@property\n    def x_max(self)","id":8457,"name":"x_max","nodeType":"Function","startLoc":91,"text":"@property\n    def x_max(self):\n        return self._x_max"},{"col":4,"comment":"null","endLoc":101,"header":"@x_max.setter\n    def x_max(self, value)","id":8458,"name":"x_max","nodeType":"Function","startLoc":95,"text":"@x_max.setter\n    def x_max(self, value):\n        if value is None or isinstance(value, (float, int)):\n            self._x_max = value\n        else:\n            raise ValueError('x_max is expected to be a real number '\n                             'or None. Got {}.'.format(value))"},{"col":4,"comment":"null","endLoc":105,"header":"@property\n    def y_min(self)","id":8459,"name":"y_min","nodeType":"Function","startLoc":103,"text":"@property\n    def y_min(self):\n        return self._y_min"},{"col":4,"comment":"null","endLoc":112,"header":"@y_min.setter\n    def y_min(self, value)","id":8460,"name":"y_min","nodeType":"Function","startLoc":107,"text":"@y_min.setter\n    def y_min(self, value):\n        if value is None or isinstance(value, (float, int)):\n            self._y_min = value\n        else:\n            raise ValueError(f'y_min is expected to be a real number. Got {value}.')"},{"col":4,"comment":"null","endLoc":116,"header":"@property\n    def x_min(self)","id":8461,"name":"x_min","nodeType":"Function","startLoc":114,"text":"@property\n    def x_min(self):\n        return self._x_min"},{"col":4,"comment":"null","endLoc":123,"header":"@x_min.setter\n    def x_min(self, value)","id":8462,"name":"x_min","nodeType":"Function","startLoc":118,"text":"@x_min.setter\n    def x_min(self, value):\n        if value is None or isinstance(value, (float, int)):\n            self._x_min = value\n        else:\n            raise ValueError(f'x_min is expected to be a real number. Got {value}.')"},{"className":"TimeMJD","col":0,"comment":"\n    Modified Julian Date time format.\n    This represents the number of days since midnight on November 17, 1858.\n    For example, 51544.0 in MJD is midnight on January 1, 2000.\n    ","endLoc":510,"id":8463,"nodeType":"Class","startLoc":491,"text":"class TimeMJD(TimeNumeric):\n    \"\"\"\n    Modified Julian Date time format.\n    This represents the number of days since midnight on November 17, 1858.\n    For example, 51544.0 in MJD is midnight on January 1, 2000.\n    \"\"\"\n    name = 'mjd'\n\n    def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # Validate scale.\n        jd1, jd2 = day_frac(val1, val2)\n        jd1 += erfa.DJM0  # erfa.DJM0=2400000.5 (from erfam.h).\n        self.jd1, self.jd2 = day_frac(jd1, jd2)\n\n    def to_value(self, **kwargs):\n        jd1 = self.jd1 - erfa.DJM0  # This cannot lose precision.\n        jd2 = self.jd2\n        return super().to_value(jd1=jd1, jd2=jd2, **kwargs)\n\n    value = property(to_value)"},{"col":4,"comment":"null","endLoc":126,"header":"def __call__(self, data, radii, mode='none')","id":8464,"name":"__call__","nodeType":"Function","startLoc":125,"text":"def __call__(self, data, radii, mode='none'):\n        return self.evaluate(data=data, radii=radii, mode=mode)"},{"col":4,"comment":"null","endLoc":503,"header":"def set_jds(self, val1, val2)","id":8465,"name":"set_jds","nodeType":"Function","startLoc":499,"text":"def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # Validate scale.\n        jd1, jd2 = day_frac(val1, val2)\n        jd1 += erfa.DJM0  # erfa.DJM0=2400000.5 (from erfam.h).\n        self.jd1, self.jd2 = day_frac(jd1, jd2)"},{"col":4,"comment":"null","endLoc":508,"header":"def to_value(self, **kwargs)","id":8466,"name":"to_value","nodeType":"Function","startLoc":505,"text":"def to_value(self, **kwargs):\n        jd1 = self.jd1 - erfa.DJM0  # This cannot lose precision.\n        jd2 = self.jd2\n        return super().to_value(jd1=jd1, jd2=jd2, **kwargs)"},{"col":4,"comment":"\n        Evaluates the Ripley K estimator for a given set of values ``radii``.\n\n        Parameters\n        ----------\n        data : 2D array\n            Set of observed points in as a n by 2 array which will be used to\n            estimate Ripley's K function.\n        radii : 1D array\n            Set of distances in which Ripley's K estimator will be evaluated.\n            Usually, it's common to consider max(radii) < (area/2)**0.5.\n        mode : str\n            Keyword which indicates the method for edge effects correction.\n            Available methods are 'none', 'translation', 'ohser', 'var-width',\n            and 'ripley'.\n\n            * 'none'\n                this method does not take into account any edge effects\n                whatsoever.\n            * 'translation'\n                computes the intersection of rectangular areas centered at\n                the given points provided the upper bounds of the\n                dimensions of the rectangular area of study. It assumes that\n                all the points lie in a bounded rectangular region satisfying\n                x_min < x_i < x_max; y_min < y_i < y_max. A detailed\n                description of this method can be found on ref [4].\n            * 'ohser'\n                this method uses the isotropized set covariance function of\n                the window of study as a weight to correct for\n                edge-effects. A detailed description of this method can be\n                found on ref [4].\n            * 'var-width'\n                this method considers the distance of each observed point to\n                the nearest boundary of the study window as a factor to\n                account for edge-effects. See [3] for a brief description of\n                this method.\n            * 'ripley'\n                this method is known as Ripley's edge-corrected estimator.\n                The weight for edge-correction is a function of the\n                proportions of circumferences centered at each data point\n                which crosses another data point of interest. See [3] for\n                a detailed description of this method.\n\n        Returns\n        -------\n        ripley : 1D array\n            Ripley's K function estimator evaluated at ``radii``.\n        ","endLoc":330,"header":"def evaluate(self, data, radii, mode='none')","id":8467,"name":"evaluate","nodeType":"Function","startLoc":173,"text":"def evaluate(self, data, radii, mode='none'):\n        \"\"\"\n        Evaluates the Ripley K estimator for a given set of values ``radii``.\n\n        Parameters\n        ----------\n        data : 2D array\n            Set of observed points in as a n by 2 array which will be used to\n            estimate Ripley's K function.\n        radii : 1D array\n            Set of distances in which Ripley's K estimator will be evaluated.\n            Usually, it's common to consider max(radii) < (area/2)**0.5.\n        mode : str\n            Keyword which indicates the method for edge effects correction.\n            Available methods are 'none', 'translation', 'ohser', 'var-width',\n            and 'ripley'.\n\n            * 'none'\n                this method does not take into account any edge effects\n                whatsoever.\n            * 'translation'\n                computes the intersection of rectangular areas centered at\n                the given points provided the upper bounds of the\n                dimensions of the rectangular area of study. It assumes that\n                all the points lie in a bounded rectangular region satisfying\n                x_min < x_i < x_max; y_min < y_i < y_max. A detailed\n                description of this method can be found on ref [4].\n            * 'ohser'\n                this method uses the isotropized set covariance function of\n                the window of study as a weight to correct for\n                edge-effects. A detailed description of this method can be\n                found on ref [4].\n            * 'var-width'\n                this method considers the distance of each observed point to\n                the nearest boundary of the study window as a factor to\n                account for edge-effects. See [3] for a brief description of\n                this method.\n            * 'ripley'\n                this method is known as Ripley's edge-corrected estimator.\n                The weight for edge-correction is a function of the\n                proportions of circumferences centered at each data point\n                which crosses another data point of interest. See [3] for\n                a detailed description of this method.\n\n        Returns\n        -------\n        ripley : 1D array\n            Ripley's K function estimator evaluated at ``radii``.\n        \"\"\"\n\n        data = np.asarray(data)\n\n        if not data.shape[1] == 2:\n            raise ValueError('data must be an n by 2 array, where n is the '\n                             'number of observed points.')\n\n        npts = len(data)\n        ripley = np.zeros(len(radii))\n\n        if mode == 'none':\n            diff = self._pairwise_diffs(data)\n            distances = np.hypot(diff[:, 0], diff[:, 1])\n            for r in range(len(radii)):\n                ripley[r] = (distances < radii[r]).sum()\n\n            ripley = self.area * 2. * ripley / (npts * (npts - 1))\n        # eq. 15.11 Stoyan book page 283\n        elif mode == 'translation':\n            diff = self._pairwise_diffs(data)\n            distances = np.hypot(diff[:, 0], diff[:, 1])\n            intersec_area = (((self.x_max - self.x_min) - diff[:, 0]) *\n                             ((self.y_max - self.y_min) - diff[:, 1]))\n\n            for r in range(len(radii)):\n                dist_indicator = distances < radii[r]\n                ripley[r] = ((1 / intersec_area) * dist_indicator).sum()\n\n            ripley = (self.area**2 / (npts * (npts - 1))) * 2 * ripley\n        # Stoyan book page 123 and eq 15.13\n        elif mode == 'ohser':\n            diff = self._pairwise_diffs(data)\n            distances = np.hypot(diff[:, 0], diff[:, 1])\n            a = self.area\n            b = max((self.y_max - self.y_min) / (self.x_max - self.x_min),\n                    (self.x_max - self.x_min) / (self.y_max - self.y_min))\n            x = distances / math.sqrt(a / b)\n            u = np.sqrt((x * x - 1) * (x > 1))\n            v = np.sqrt((x * x - b ** 2) * (x < math.sqrt(b ** 2 + 1)) * (x > b))\n            c1 = np.pi - 2 * x * (1 + 1 / b) + x * x / b\n            c2 = 2 * np.arcsin((1 / x) * (x > 1)) - 1 / b - 2 * (x - u)\n            c3 = (2 * np.arcsin(((b - u * v) / (x * x))\n                                * (x > b) * (x < math.sqrt(b ** 2 + 1)))\n                  + 2 * u + 2 * v / b - b - (1 + x * x) / b)\n\n            cov_func = ((a / np.pi) * (c1 * (x >= 0) * (x <= 1)\n                        + c2 * (x > 1) * (x <= b)\n                        + c3 * (b < x) * (x < math.sqrt(b ** 2 + 1))))\n\n            for r in range(len(radii)):\n                dist_indicator = distances < radii[r]\n                ripley[r] = ((1 / cov_func) * dist_indicator).sum()\n\n            ripley = (self.area**2 / (npts * (npts - 1))) * 2 * ripley\n        # Cressie book eq 8.2.20 page 616\n        elif mode == 'var-width':\n            lt_dist = np.minimum(np.minimum(self.x_max - data[:, 0], self.y_max - data[:, 1]),\n                                 np.minimum(data[:, 0] - self.x_min, data[:, 1] - self.y_min))\n\n            for r in range(len(radii)):\n                for i in range(npts):\n                    for j in range(npts):\n                        if i != j:\n                            diff = abs(data[i] - data[j])\n                            dist = math.sqrt((diff * diff).sum())\n                            if dist < radii[r] < lt_dist[i]:\n                                ripley[r] = ripley[r] + 1\n                lt_dist_sum = (lt_dist > radii[r]).sum()\n                if not lt_dist_sum == 0:\n                    ripley[r] = ripley[r] / lt_dist_sum\n\n            ripley = self.area * ripley / npts\n        # Cressie book eq 8.4.22 page 640\n        elif mode == 'ripley':\n            hor_dist = np.zeros(shape=(npts * (npts - 1)) // 2,\n                                dtype=np.double)\n            ver_dist = np.zeros(shape=(npts * (npts - 1)) // 2,\n                                dtype=np.double)\n\n            for k in range(npts - 1):\n                min_hor_dist = min(self.x_max - data[k][0],\n                                   data[k][0] - self.x_min)\n                min_ver_dist = min(self.y_max - data[k][1],\n                                   data[k][1] - self.y_min)\n                start = (k * (2 * (npts - 1) - (k - 1))) // 2\n                end = ((k + 1) * (2 * (npts - 1) - k)) // 2\n                hor_dist[start: end] = min_hor_dist * np.ones(npts - 1 - k)\n                ver_dist[start: end] = min_ver_dist * np.ones(npts - 1 - k)\n\n            diff = self._pairwise_diffs(data)\n            dist = np.hypot(diff[:, 0], diff[:, 1])\n            dist_ind = dist <= np.hypot(hor_dist, ver_dist)\n\n            w1 = (1 - (np.arccos(np.minimum(ver_dist, dist) / dist) +\n                       np.arccos(np.minimum(hor_dist, dist) / dist)) / np.pi)\n            w2 = (3 / 4 - 0.5 * (\n                np.arccos(ver_dist / dist * ~dist_ind) +\n                np.arccos(hor_dist / dist * ~dist_ind)) / np.pi)\n\n            weight = dist_ind * w1 + ~dist_ind * w2\n\n            for r in range(len(radii)):\n                ripley[r] = ((dist < radii[r]) / weight).sum()\n\n            ripley = self.area * 2. * ripley / (npts * (npts - 1))\n        else:\n            raise ValueError(f'mode {mode} is not implemented.')\n\n        return ripley"},{"col":4,"comment":"null","endLoc":661,"header":"def _query_by_metadata(self, key, value)","id":8468,"name":"_query_by_metadata","nodeType":"Function","startLoc":654,"text":"def _query_by_metadata(self, key, value):\n        public_id_list = []\n        for private_id in self._metadata:\n            if key in self._metadata[private_id]:\n                if self._metadata[private_id][key] == value:\n                    public_id_list.append(self._private_keys[private_id][0])\n\n        return public_id_list"},{"col":4,"comment":"null","endLoc":1503,"header":"def __init__(self, order, coeff_prefix, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":8469,"name":"__init__","nodeType":"Function","startLoc":1487,"text":"def __init__(self, order, coeff_prefix, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.order = order\n        self.coeff_prefix = coeff_prefix\n        self._param_names = self._generate_coeff_names(coeff_prefix)\n\n        if n_models:\n            if model_set_axis is None:\n                model_set_axis = 0\n            minshape = (1,) * model_set_axis + (n_models,)\n        else:\n            minshape = ()\n        for param_name in self._param_names:\n            self._parameters_[param_name] = \\\n                Parameter(param_name, default=np.zeros(minshape))\n        super().__init__(n_models=n_models, model_set_axis=model_set_axis,\n                         name=name, meta=meta, **params)"},{"col":4,"comment":"null","endLoc":1244,"header":"def _receive_notification(self, private_key, sender_id, message)","id":8470,"name":"_receive_notification","nodeType":"Function","startLoc":1243,"text":"def _receive_notification(self, private_key, sender_id, message):\n        return \"\""},{"col":4,"comment":"null","endLoc":1268,"header":"def _receive_response(self, private_key, responder_id, msg_tag, response)","id":8471,"name":"_receive_response","nodeType":"Function","startLoc":1267,"text":"def _receive_response(self, private_key, responder_id, msg_tag, response):\n        return \"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":497,"id":8472,"name":"name","nodeType":"Attribute","startLoc":497,"text":"name"},{"col":4,"comment":"null","endLoc":652,"header":"def _ping(self)","id":8473,"name":"_ping","nodeType":"Function","startLoc":649,"text":"def _ping(self):\n        self._update_last_activity_time()\n        log.debug(\"ping\")\n        return \"1\""},{"attributeType":"null","col":4,"comment":"null","endLoc":510,"id":8474,"name":"value","nodeType":"Attribute","startLoc":510,"text":"value"},{"attributeType":"null","col":8,"comment":"null","endLoc":503,"id":8475,"name":"jd1","nodeType":"Attribute","startLoc":503,"text":"self.jd1"},{"col":4,"comment":"\n        The hub parameters (which are written to the logfile)\n        ","endLoc":427,"header":"@property\n    def params(self)","id":8476,"name":"params","nodeType":"Function","startLoc":408,"text":"@property\n    def params(self):\n        \"\"\"\n        The hub parameters (which are written to the logfile)\n        \"\"\"\n\n        params = {}\n\n        # Keys required by standard profile\n\n        params['samp.secret'] = self._hub_secret\n        params['samp.hub.xmlrpc.url'] = self._url\n        params['samp.profile.version'] = __profile_version__\n\n        # Custom keys\n\n        params['hub.id'] = self.id\n        params['hub.label'] = self._label or f\"Hub {self.id}\"\n\n        return params"},{"col":4,"comment":"null","endLoc":1542,"header":"def _generate_coeff_names(self, coeff_prefix)","id":8477,"name":"_generate_coeff_names","nodeType":"Function","startLoc":1532,"text":"def _generate_coeff_names(self, coeff_prefix):\n        names = []\n        for i in range(2, self.order + 1):\n            names.append(f'{coeff_prefix}_{i}_{0}')\n        for i in range(2, self.order + 1):\n            names.append(f'{coeff_prefix}_{0}_{i}')\n        for i in range(1, self.order):\n            for j in range(1, self.order):\n                if i + j < self.order + 1:\n                    names.append(f'{coeff_prefix}_{i}_{j}')\n        return tuple(names)"},{"col":4,"comment":"Return an information concerning the Hub running status.\n\n        Returns\n        -------\n        running : bool\n            Is the hub running?\n        ","endLoc":528,"header":"@property\n    def is_running(self)","id":8478,"name":"is_running","nodeType":"Function","startLoc":519,"text":"@property\n    def is_running(self):\n        \"\"\"Return an information concerning the Hub running status.\n\n        Returns\n        -------\n        running : bool\n            Is the hub running?\n        \"\"\"\n        return self._is_running"},{"col":4,"comment":"null","endLoc":568,"header":"def _serve_forever(self)","id":8479,"name":"_serve_forever","nodeType":"Function","startLoc":530,"text":"def _serve_forever(self):\n\n        while self._is_running:\n\n            try:\n                read_ready = select.select([self._server.socket], [], [], 0.01)[0]\n            except OSError as exc:\n                warnings.warn(f\"Call to select() in SAMPHubServer failed: {exc}\",\n                              SAMPWarning)\n            else:\n                if read_ready:\n                    self._server.handle_request()\n\n            if self._web_profile:\n\n                # We now check if there are any connection requests from the\n                # web profile, and if so, we initialize the pop-up.\n                if self._web_profile_dialog is None:\n                    try:\n                        request = self._web_profile_requests_queue.get_nowait()\n                    except queue.Empty:\n                        pass\n                    else:\n                        web_profile_text_dialog(request, self._web_profile_requests_result)\n\n                # We now check for requests over the web profile socket, and we\n                # also update the pop-up in case there are any changes.\n                try:\n                    read_ready = select.select([self._web_profile_server.socket], [], [], 0.01)[0]\n                except OSError as exc:\n                    warnings.warn(f\"Call to select() in SAMPHubServer failed: {exc}\",\n                                  SAMPWarning)\n                else:\n                    if read_ready:\n                        self._web_profile_server.handle_request()\n\n        self._server.server_close()\n        if self._web_profile_server is not None:\n            self._web_profile_server.server_close()"},{"attributeType":"null","col":18,"comment":"null","endLoc":503,"id":8480,"name":"jd2","nodeType":"Attribute","startLoc":503,"text":"self.jd2"},{"className":"TimeDecimalYear","col":0,"comment":"\n    Time as a decimal year, with integer values corresponding to midnight\n    of the first day of each year.  For example 2000.5 corresponds to the\n    ISO time '2000-07-02 00:00:00'.\n    ","endLoc":576,"id":8481,"nodeType":"Class","startLoc":513,"text":"class TimeDecimalYear(TimeNumeric):\n    \"\"\"\n    Time as a decimal year, with integer values corresponding to midnight\n    of the first day of each year.  For example 2000.5 corresponds to the\n    ISO time '2000-07-02 00:00:00'.\n    \"\"\"\n    name = 'decimalyear'\n\n    def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # Validate scale.\n\n        sum12, err12 = two_sum(val1, val2)\n        iy_start = np.trunc(sum12).astype(int)\n        extra, y_frac = two_sum(sum12, -iy_start)\n        y_frac += extra + err12\n\n        val = (val1 + val2).astype(np.double)\n        iy_start = np.trunc(val).astype(int)\n\n        imon = np.ones_like(iy_start)\n        iday = np.ones_like(iy_start)\n        ihr = np.zeros_like(iy_start)\n        imin = np.zeros_like(iy_start)\n        isec = np.zeros_like(y_frac)\n\n        # Possible enhancement: use np.unique to only compute start, stop\n        # for unique values of iy_start.\n        scale = self.scale.upper().encode('ascii')\n        jd1_start, jd2_start = erfa.dtf2d(scale, iy_start, imon, iday,\n                                          ihr, imin, isec)\n        jd1_end, jd2_end = erfa.dtf2d(scale, iy_start + 1, imon, iday,\n                                      ihr, imin, isec)\n\n        t_start = Time(jd1_start, jd2_start, scale=self.scale, format='jd')\n        t_end = Time(jd1_end, jd2_end, scale=self.scale, format='jd')\n        t_frac = t_start + (t_end - t_start) * y_frac\n\n        self.jd1, self.jd2 = day_frac(t_frac.jd1, t_frac.jd2)\n\n    def to_value(self, **kwargs):\n        scale = self.scale.upper().encode('ascii')\n        iy_start, ims, ids, ihmsfs = erfa.d2dtf(scale, 0,  # precision=0\n                                                self.jd1, self.jd2_filled)\n        imon = np.ones_like(iy_start)\n        iday = np.ones_like(iy_start)\n        ihr = np.zeros_like(iy_start)\n        imin = np.zeros_like(iy_start)\n        isec = np.zeros_like(self.jd1)\n\n        # Possible enhancement: use np.unique to only compute start, stop\n        # for unique values of iy_start.\n        scale = self.scale.upper().encode('ascii')\n        jd1_start, jd2_start = erfa.dtf2d(scale, iy_start, imon, iday,\n                                          ihr, imin, isec)\n        jd1_end, jd2_end = erfa.dtf2d(scale, iy_start + 1, imon, iday,\n                                      ihr, imin, isec)\n        # Trying to be precise, but more than float64 not useful.\n        dt = (self.jd1 - jd1_start) + (self.jd2 - jd2_start)\n        dt_end = (jd1_end - jd1_start) + (jd2_end - jd2_start)\n        decimalyear = iy_start + dt / dt_end\n\n        return super().to_value(jd1=decimalyear, jd2=np.float64(0.0), **kwargs)\n\n    value = property(to_value)"},{"col":4,"comment":"null","endLoc":550,"header":"def set_jds(self, val1, val2)","id":8482,"name":"set_jds","nodeType":"Function","startLoc":521,"text":"def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # Validate scale.\n\n        sum12, err12 = two_sum(val1, val2)\n        iy_start = np.trunc(sum12).astype(int)\n        extra, y_frac = two_sum(sum12, -iy_start)\n        y_frac += extra + err12\n\n        val = (val1 + val2).astype(np.double)\n        iy_start = np.trunc(val).astype(int)\n\n        imon = np.ones_like(iy_start)\n        iday = np.ones_like(iy_start)\n        ihr = np.zeros_like(iy_start)\n        imin = np.zeros_like(iy_start)\n        isec = np.zeros_like(y_frac)\n\n        # Possible enhancement: use np.unique to only compute start, stop\n        # for unique values of iy_start.\n        scale = self.scale.upper().encode('ascii')\n        jd1_start, jd2_start = erfa.dtf2d(scale, iy_start, imon, iday,\n                                          ihr, imin, isec)\n        jd1_end, jd2_end = erfa.dtf2d(scale, iy_start + 1, imon, iday,\n                                      ihr, imin, isec)\n\n        t_start = Time(jd1_start, jd2_start, scale=self.scale, format='jd')\n        t_end = Time(jd1_end, jd2_end, scale=self.scale, format='jd')\n        t_frac = t_start + (t_end - t_start) * y_frac\n\n        self.jd1, self.jd2 = day_frac(t_frac.jd1, t_frac.jd2)"},{"col":4,"comment":"Reference epoch time from which the time interval is measured","endLoc":597,"header":"@property\n    def epoch(self)","id":8483,"name":"epoch","nodeType":"Function","startLoc":594,"text":"@property\n    def epoch(self):\n        \"\"\"Reference epoch time from which the time interval is measured\"\"\"\n        return self._epoch"},{"col":4,"comment":"\n        Initialize the internal jd1 and jd2 attributes given val1 and val2.\n        For an TimeFromEpoch subclass like TimeUnix these will be floats giving\n        the effective seconds since an epoch time (e.g. 1970-01-01 00:00:00).\n        ","endLoc":649,"header":"def set_jds(self, val1, val2)","id":8484,"name":"set_jds","nodeType":"Function","startLoc":599,"text":"def set_jds(self, val1, val2):\n        \"\"\"\n        Initialize the internal jd1 and jd2 attributes given val1 and val2.\n        For an TimeFromEpoch subclass like TimeUnix these will be floats giving\n        the effective seconds since an epoch time (e.g. 1970-01-01 00:00:00).\n        \"\"\"\n        # Form new JDs based on epoch time + time from epoch (converted to JD).\n        # One subtlety that might not be obvious is that 1.000 Julian days in\n        # UTC can be 86400 or 86401 seconds.  For the TimeUnix format the\n        # assumption is that every day is exactly 86400 seconds, so this is, in\n        # principle, doing the math incorrectly, *except* that it matches the\n        # definition of Unix time which does not include leap seconds.\n\n        # note: use divisor=1./self.unit, since this is either 1 or 1/86400,\n        # and 1/86400 is not exactly representable as a float64, so multiplying\n        # by that will cause rounding errors. (But inverting it as a float64\n        # recovers the exact number)\n        day, frac = day_frac(val1, val2, divisor=1. / self.unit)\n\n        jd1 = self.epoch.jd1 + day\n        jd2 = self.epoch.jd2 + frac\n\n        # For the usual case that scale is the same as epoch_scale, we only need\n        # to ensure that abs(jd2) <= 0.5. Since abs(self.epoch.jd2) <= 0.5 and\n        # abs(frac) <= 0.5, we can do simple (fast) checks and arithmetic here\n        # without another call to day_frac(). Note also that `round(jd2.item())`\n        # is about 10x faster than `np.round(jd2)`` for a scalar.\n        if self.epoch.scale == self.scale:\n            jd1_extra = np.round(jd2) if jd2.shape else round(jd2.item())\n            jd1 += jd1_extra\n            jd2 -= jd1_extra\n\n            self.jd1, self.jd2 = jd1, jd2\n            return\n\n        # Create a temporary Time object corresponding to the new (jd1, jd2) in\n        # the epoch scale (e.g. UTC for TimeUnix) then convert that to the\n        # desired time scale for this object.\n        #\n        # A known limitation is that the transform from self.epoch_scale to\n        # self.scale cannot involve any metadata like lat or lon.\n        try:\n            tm = getattr(Time(jd1, jd2, scale=self.epoch_scale,\n                              format='jd'), self.scale)\n        except Exception as err:\n            raise ScaleValueError(\"Cannot convert from '{}' epoch scale '{}'\"\n                                  \"to specified scale '{}', got error:\\n{}\"\n                                  .format(self.name, self.epoch_scale,\n                                          self.scale, err)) from err\n\n        self.jd1, self.jd2 = day_frac(tm._time.jd1, tm._time.jd2)"},{"col":4,"comment":"null","endLoc":137,"header":"def _pairwise_diffs(self, data)","id":8485,"name":"_pairwise_diffs","nodeType":"Function","startLoc":128,"text":"def _pairwise_diffs(self, data):\n        npts = len(data)\n        diff = np.zeros(shape=(npts * (npts - 1) // 2, 2), dtype=np.double)\n        k = 0\n        for i in range(npts - 1):\n            size = npts - i - 1\n            diff[k:k + size] = abs(data[i] - data[i+1:])\n            k += size\n\n        return diff"},{"col":4,"comment":"null","endLoc":786,"header":"def _get_metadata(self, private_key, client_id)","id":8486,"name":"_get_metadata","nodeType":"Function","startLoc":771,"text":"def _get_metadata(self, private_key, client_id):\n        self._update_last_activity_time(private_key)\n        if private_key in self._private_keys:\n            client_private_key = self._public_id_to_private_key(client_id)\n            log.debug(\"get_metadata: private-key = {} client-id = {}\"\n                      .format(private_key, client_id))\n            if client_private_key is not None:\n                if client_private_key in self._metadata:\n                    log.debug(f\"--> metadata = {self._metadata[client_private_key]}\")\n                    return self._metadata[client_private_key]\n                else:\n                    return {}\n            else:\n                raise SAMPProxyError(6, \"Invalid client ID\")\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")"},{"col":4,"comment":"null","endLoc":675,"header":"def to_value(self, parent=None, **kwargs)","id":8487,"name":"to_value","nodeType":"Function","startLoc":651,"text":"def to_value(self, parent=None, **kwargs):\n        # Make sure that scale is the same as epoch scale so we can just\n        # subtract the epoch and convert\n        if self.scale != self.epoch_scale:\n            if parent is None:\n                raise ValueError('cannot compute value without parent Time object')\n            try:\n                tm = getattr(parent, self.epoch_scale)\n            except Exception as err:\n                raise ScaleValueError(\"Cannot convert from '{}' epoch scale '{}'\"\n                                      \"to specified scale '{}', got error:\\n{}\"\n                                      .format(self.name, self.epoch_scale,\n                                              self.scale, err)) from err\n\n            jd1, jd2 = tm._time.jd1, tm._time.jd2\n        else:\n            jd1, jd2 = self.jd1, self.jd2\n\n        # This factor is guaranteed to be exactly representable, which\n        # means time_from_epoch1 is calculated exactly.\n        factor = 1. / self.unit\n        time_from_epoch1 = (jd1 - self.epoch.jd1) * factor\n        time_from_epoch2 = (jd2 - self.epoch.jd2) * factor\n\n        return super().to_value(jd1=time_from_epoch1, jd2=time_from_epoch2, **kwargs)"},{"col":4,"comment":"null","endLoc":681,"header":"@property\n    def _default_scale(self)","id":8488,"name":"_default_scale","nodeType":"Function","startLoc":679,"text":"@property\n    def _default_scale(self):\n        return self.epoch_scale"},{"attributeType":"null","col":4,"comment":"null","endLoc":677,"id":8489,"name":"value","nodeType":"Attribute","startLoc":677,"text":"value"},{"attributeType":"null","col":12,"comment":"null","endLoc":631,"id":8490,"name":"jd1","nodeType":"Attribute","startLoc":631,"text":"self.jd1"},{"col":4,"comment":"null","endLoc":858,"header":"def _get_subscriptions(self, private_key, client_id)","id":8491,"name":"_get_subscriptions","nodeType":"Function","startLoc":839,"text":"def _get_subscriptions(self, private_key, client_id):\n\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            client_private_key = self._public_id_to_private_key(client_id)\n            if client_private_key is not None:\n                if client_private_key in self._id2mtypes:\n                    log.debug(\"get_subscriptions: client-id = {} mtypes = {}\"\n                              .format(client_id,\n                                      str(self._id2mtypes[client_private_key])))\n                    return self._id2mtypes[client_private_key]\n                else:\n                    log.debug(\"get_subscriptions: client-id = {} mtypes = \"\n                              \"missing\".format(client_id))\n                    return {}\n            else:\n                raise SAMPProxyError(6, \"Invalid client ID\")\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")"},{"attributeType":"null","col":22,"comment":"null","endLoc":631,"id":8492,"name":"jd2","nodeType":"Attribute","startLoc":631,"text":"self.jd2"},{"className":"_LeapSecondsCheck","col":0,"comment":"null","endLoc":106,"id":8493,"nodeType":"Class","startLoc":103,"text":"class _LeapSecondsCheck(enum.Enum):\n    NOT_STARTED = 0     # No thread has reached the check\n    RUNNING = 1         # A thread is running update_leap_seconds (_LEAP_SECONDS_LOCK is held)\n    DONE = 2            # update_leap_seconds has completed"},{"attributeType":"null","col":4,"comment":"null","endLoc":104,"id":8494,"name":"NOT_STARTED","nodeType":"Attribute","startLoc":104,"text":"NOT_STARTED"},{"col":4,"comment":"null","endLoc":873,"header":"def _get_registered_clients(self, private_key)","id":8495,"name":"_get_registered_clients","nodeType":"Function","startLoc":860,"text":"def _get_registered_clients(self, private_key):\n\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            reg_clients = []\n            for pkey in self._private_keys.keys():\n                if pkey != private_key:\n                    reg_clients.append(self._private_keys[pkey][0])\n            log.debug(\"get_registered_clients: private_key = {} clients = {}\"\n                      .format(private_key, reg_clients))\n            return reg_clients\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")"},{"attributeType":"null","col":4,"comment":"null","endLoc":105,"id":8496,"name":"RUNNING","nodeType":"Attribute","startLoc":105,"text":"RUNNING"},{"attributeType":"null","col":4,"comment":"null","endLoc":106,"id":8497,"name":"DONE","nodeType":"Attribute","startLoc":106,"text":"DONE"},{"className":"TimeInfo","col":0,"comment":"\n    Container for meta information like name, description, format.  This is\n    required when the object is used as a mixin column within a table, but can\n    be used as a general way to store meta information.\n    ","endLoc":276,"id":8498,"nodeType":"Class","startLoc":113,"text":"class TimeInfo(MixinInfo):\n    \"\"\"\n    Container for meta information like name, description, format.  This is\n    required when the object is used as a mixin column within a table, but can\n    be used as a general way to store meta information.\n    \"\"\"\n    attr_names = MixinInfo.attr_names | {'serialize_method'}\n    _supports_indexing = True\n\n    # The usual tuple of attributes needed for serialization is replaced\n    # by a property, since Time can be serialized different ways.\n    _represent_as_dict_extra_attrs = ('format', 'scale', 'precision',\n                                      'in_subfmt', 'out_subfmt', 'location',\n                                      '_delta_ut1_utc', '_delta_tdb_tt')\n\n    # When serializing, write out the `value` attribute using the column name.\n    _represent_as_dict_primary_data = 'value'\n\n    mask_val = np.ma.masked\n\n    @property\n    def _represent_as_dict_attrs(self):\n        method = self.serialize_method[self._serialize_context]\n        if method == 'formatted_value':\n            out = ('value',)\n        elif method == 'jd1_jd2':\n            out = ('jd1', 'jd2')\n        else:\n            raise ValueError(\"serialize method must be 'formatted_value' or 'jd1_jd2'\")\n\n        return out + self._represent_as_dict_extra_attrs\n\n    def __init__(self, bound=False):\n        super().__init__(bound)\n\n        # If bound to a data object instance then create the dict of attributes\n        # which stores the info attribute values.\n        if bound:\n            # Specify how to serialize this object depending on context.\n            # If ``True`` for a context, then use formatted ``value`` attribute\n            # (e.g. the ISO time string).  If ``False`` then use float jd1 and jd2.\n            self.serialize_method = {'fits': 'jd1_jd2',\n                                     'ecsv': 'formatted_value',\n                                     'hdf5': 'jd1_jd2',\n                                     'yaml': 'jd1_jd2',\n                                     'parquet': 'jd1_jd2',\n                                     None: 'jd1_jd2'}\n\n    def get_sortable_arrays(self):\n        \"\"\"\n        Return a list of arrays which can be lexically sorted to represent\n        the order of the parent column.\n\n        Returns\n        -------\n        arrays : list of ndarray\n        \"\"\"\n        parent = self._parent\n        jd_approx = parent.jd\n        jd_remainder = (parent - parent.__class__(jd_approx, format='jd')).jd\n        return [jd_approx, jd_remainder]\n\n    @property\n    def unit(self):\n        return None\n\n    info_summary_stats = staticmethod(\n        data_info_factory(names=MixinInfo._stats,\n                          funcs=[getattr(np, stat) for stat in MixinInfo._stats]))\n    # When Time has mean, std, min, max methods:\n    # funcs = [lambda x: getattr(x, stat)() for stat_name in MixinInfo._stats])\n\n    def _construct_from_dict_base(self, map):\n        if 'jd1' in map and 'jd2' in map:\n            # Initialize as JD but revert to desired format and out_subfmt (if needed)\n            format = map.pop('format')\n            out_subfmt = map.pop('out_subfmt', None)\n            map['format'] = 'jd'\n            map['val'] = map.pop('jd1')\n            map['val2'] = map.pop('jd2')\n            out = self._parent_cls(**map)\n            out.format = format\n            if out_subfmt is not None:\n                out.out_subfmt = out_subfmt\n\n        else:\n            map['val'] = map.pop('value')\n            out = self._parent_cls(**map)\n\n        return out\n\n    def _construct_from_dict(self, map):\n        delta_ut1_utc = map.pop('_delta_ut1_utc', None)\n        delta_tdb_tt = map.pop('_delta_tdb_tt', None)\n\n        out = self._construct_from_dict_base(map)\n\n        if delta_ut1_utc is not None:\n            out._delta_ut1_utc = delta_ut1_utc\n        if delta_tdb_tt is not None:\n            out._delta_tdb_tt = delta_tdb_tt\n\n        return out\n\n    def new_like(self, cols, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new Time instance which is consistent with the input Time objects\n        ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty Time instance whose elements can\n        be set in-place for table operations like join or vstack.  It checks\n        that the input locations and attributes are consistent.  This is used\n        when a Time object is used as a mixin column in an astropy Table.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns (Time objects)\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : Time (or subclass)\n            Empty instance of this class consistent with ``cols``\n\n        \"\"\"\n        # Get merged info attributes like shape, dtype, format, description, etc.\n        attrs = self.merge_cols_attributes(cols, metadata_conflicts, name,\n                                           ('meta', 'description'))\n        attrs.pop('dtype')  # Not relevant for Time\n        col0 = cols[0]\n\n        # Check that location is consistent for all Time objects\n        for col in cols[1:]:\n            # This is the method used by __setitem__ to ensure that the right side\n            # has a consistent location (and coerce data if necessary, but that does\n            # not happen in this case since `col` is already a Time object).  If this\n            # passes then any subsequent table operations via setitem will work.\n            try:\n                col0._make_value_equivalent(slice(None), col)\n            except ValueError:\n                raise ValueError('input columns have inconsistent locations')\n\n        # Make a new Time object with the desired shape and attributes\n        shape = (length,) + attrs.pop('shape')\n        jd2000 = 2451544.5  # Arbitrary JD value J2000.0 that will work with ERFA\n        jd1 = np.full(shape, jd2000, dtype='f8')\n        jd2 = np.zeros(shape, dtype='f8')\n        tm_attrs = {attr: getattr(col0, attr)\n                    for attr in ('scale', 'location',\n                                 'precision', 'in_subfmt', 'out_subfmt')}\n        out = self._parent_cls(jd1, jd2, format='jd', **tm_attrs)\n        out.format = col0.format\n\n        # Set remaining info attributes\n        for attr, value in attrs.items():\n            setattr(out.info, attr, value)\n\n        return out"},{"col":4,"comment":"null","endLoc":143,"header":"@property\n    def _represent_as_dict_attrs(self)","id":8499,"name":"_represent_as_dict_attrs","nodeType":"Function","startLoc":133,"text":"@property\n    def _represent_as_dict_attrs(self):\n        method = self.serialize_method[self._serialize_context]\n        if method == 'formatted_value':\n            out = ('value',)\n        elif method == 'jd1_jd2':\n            out = ('jd1', 'jd2')\n        else:\n            raise ValueError(\"serialize method must be 'formatted_value' or 'jd1_jd2'\")\n\n        return out + self._represent_as_dict_extra_attrs"},{"col":0,"comment":"\n    Given two matching sets of coordinates on detector and sky,\n    compute the WCS.\n\n    Fits a WCS object to matched set of input detector and sky coordinates.\n    Optionally, a SIP can be fit to account for geometric\n    distortion. Returns an `~astropy.wcs.WCS` object with the best fit\n    parameters for mapping between input pixel and sky coordinates.\n\n    The projection type (default 'TAN') can passed in as a string, one of\n    the valid three-letter projection codes - or as a WCS object with\n    projection keywords already set. Note that if an input WCS has any\n    non-polynomial distortion, this will be applied and reflected in the\n    fit terms and coefficients. Passing in a WCS object in this way essentially\n    allows it to be refit based on the matched input coordinates and projection\n    point, but take care when using this option as non-projection related\n    keywords in the input might cause unexpected behavior.\n\n    Notes\n    -----\n    - The fiducial point for the spherical projection can be set to 'center'\n      to use the mean position of input sky coordinates, or as an\n      `~astropy.coordinates.SkyCoord` object.\n    - Units in all output WCS objects will always be in degrees.\n    - If the coordinate frame differs between `~astropy.coordinates.SkyCoord`\n      objects passed in for ``world_coords`` and ``proj_point``, the frame for\n      ``world_coords``  will override as the frame for the output WCS.\n    - If a WCS object is passed in to ``projection`` the CD/PC matrix will\n      be used as an initial guess for the fit. If this is known to be\n      significantly off and may throw off the fit, set to the identity matrix\n      (for example, by doing wcs.wcs.pc = [(1., 0.,), (0., 1.)])\n\n    Parameters\n    ----------\n    xy : (`numpy.ndarray`, `numpy.ndarray`) tuple\n        x & y pixel coordinates.\n    world_coords : `~astropy.coordinates.SkyCoord`\n        Skycoord object with world coordinates.\n    proj_point : 'center' or ~astropy.coordinates.SkyCoord`\n        Defaults to 'center', in which the geometric center of input world\n        coordinates will be used as the projection point. To specify an exact\n        point for the projection, a Skycoord object with a coordinate pair can\n        be passed in. For consistency, the units and frame of these coordinates\n        will be transformed to match ``world_coords`` if they don't.\n    projection : str or `~astropy.wcs.WCS`\n        Three letter projection code, of any of standard projections defined\n        in the FITS WCS standard. Optionally, a WCS object with projection\n        keywords set may be passed in.\n    sip_degree : None or int\n        If set to a non-zero integer value, will fit SIP of degree\n        ``sip_degree`` to model geometric distortion. Defaults to None, meaning\n        no distortion corrections will be fit.\n\n    Returns\n    -------\n    wcs : `~astropy.wcs.WCS`\n        The best-fit WCS to the points given.\n    ","endLoc":1143,"header":"def fit_wcs_from_points(xy, world_coords, proj_point='center',\n                        projection='TAN', sip_degree=None)","id":8500,"name":"fit_wcs_from_points","nodeType":"Function","startLoc":955,"text":"def fit_wcs_from_points(xy, world_coords, proj_point='center',\n                        projection='TAN', sip_degree=None):\n    \"\"\"\n    Given two matching sets of coordinates on detector and sky,\n    compute the WCS.\n\n    Fits a WCS object to matched set of input detector and sky coordinates.\n    Optionally, a SIP can be fit to account for geometric\n    distortion. Returns an `~astropy.wcs.WCS` object with the best fit\n    parameters for mapping between input pixel and sky coordinates.\n\n    The projection type (default 'TAN') can passed in as a string, one of\n    the valid three-letter projection codes - or as a WCS object with\n    projection keywords already set. Note that if an input WCS has any\n    non-polynomial distortion, this will be applied and reflected in the\n    fit terms and coefficients. Passing in a WCS object in this way essentially\n    allows it to be refit based on the matched input coordinates and projection\n    point, but take care when using this option as non-projection related\n    keywords in the input might cause unexpected behavior.\n\n    Notes\n    -----\n    - The fiducial point for the spherical projection can be set to 'center'\n      to use the mean position of input sky coordinates, or as an\n      `~astropy.coordinates.SkyCoord` object.\n    - Units in all output WCS objects will always be in degrees.\n    - If the coordinate frame differs between `~astropy.coordinates.SkyCoord`\n      objects passed in for ``world_coords`` and ``proj_point``, the frame for\n      ``world_coords``  will override as the frame for the output WCS.\n    - If a WCS object is passed in to ``projection`` the CD/PC matrix will\n      be used as an initial guess for the fit. If this is known to be\n      significantly off and may throw off the fit, set to the identity matrix\n      (for example, by doing wcs.wcs.pc = [(1., 0.,), (0., 1.)])\n\n    Parameters\n    ----------\n    xy : (`numpy.ndarray`, `numpy.ndarray`) tuple\n        x & y pixel coordinates.\n    world_coords : `~astropy.coordinates.SkyCoord`\n        Skycoord object with world coordinates.\n    proj_point : 'center' or ~astropy.coordinates.SkyCoord`\n        Defaults to 'center', in which the geometric center of input world\n        coordinates will be used as the projection point. To specify an exact\n        point for the projection, a Skycoord object with a coordinate pair can\n        be passed in. For consistency, the units and frame of these coordinates\n        will be transformed to match ``world_coords`` if they don't.\n    projection : str or `~astropy.wcs.WCS`\n        Three letter projection code, of any of standard projections defined\n        in the FITS WCS standard. Optionally, a WCS object with projection\n        keywords set may be passed in.\n    sip_degree : None or int\n        If set to a non-zero integer value, will fit SIP of degree\n        ``sip_degree`` to model geometric distortion. Defaults to None, meaning\n        no distortion corrections will be fit.\n\n    Returns\n    -------\n    wcs : `~astropy.wcs.WCS`\n        The best-fit WCS to the points given.\n    \"\"\"\n\n    from scipy.optimize import least_squares\n\n    import astropy.units as u\n    from astropy.coordinates import SkyCoord  # here to avoid circular import\n\n    from .wcs import Sip\n\n    xp, yp = xy\n    try:\n        lon, lat = world_coords.data.lon.deg, world_coords.data.lat.deg\n    except AttributeError:\n        unit_sph =  world_coords.unit_spherical\n        lon, lat = unit_sph.lon.deg, unit_sph.lat.deg\n\n    # verify input\n    if (type(proj_point) != type(world_coords)) and (proj_point != 'center'):\n        raise ValueError(\"proj_point must be set to 'center', or an\" +\n                         \"`~astropy.coordinates.SkyCoord` object with \" +\n                         \"a pair of points.\")\n\n    use_center_as_proj_point = (str(proj_point) == 'center')\n\n    if not use_center_as_proj_point:\n        assert proj_point.size == 1\n\n    proj_codes = [\n        'AZP', 'SZP', 'TAN', 'STG', 'SIN', 'ARC', 'ZEA', 'AIR', 'CYP',\n        'CEA', 'CAR', 'MER', 'SFL', 'PAR', 'MOL', 'AIT', 'COP', 'COE',\n        'COD', 'COO', 'BON', 'PCO', 'TSC', 'CSC', 'QSC', 'HPX', 'XPH'\n    ]\n    if type(projection) == str:\n        if projection not in proj_codes:\n            raise ValueError(\"Must specify valid projection code from list of \"\n                             + \"supported types: \", ', '.join(proj_codes))\n        # empty wcs to fill in with fit values\n        wcs = celestial_frame_to_wcs(frame=world_coords.frame,\n                                     projection=projection)\n    else: #if projection is not string, should be wcs object. use as template.\n        wcs = copy.deepcopy(projection)\n        wcs.cdelt = (1., 1.) # make sure cdelt is 1\n        wcs.sip = None\n\n    # Change PC to CD, since cdelt will be set to 1\n    if wcs.wcs.has_pc():\n        wcs.wcs.cd = wcs.wcs.pc\n        wcs.wcs.__delattr__('pc')\n\n    if (type(sip_degree) != type(None)) and (type(sip_degree) != int):\n        raise ValueError(\"sip_degree must be None, or integer.\")\n\n    # compute bounding box for sources in image coordinates:\n    xpmin, xpmax, ypmin, ypmax = xp.min(), xp.max(), yp.min(), yp.max()\n\n    # set pixel_shape to span of input points\n    wcs.pixel_shape = (1 if xpmax <= 0.0 else int(np.ceil(xpmax)),\n                       1 if ypmax <= 0.0 else int(np.ceil(ypmax)))\n\n    # determine CRVAL from input\n    close = lambda l, p: p[np.argmin(np.abs(l))]\n    if use_center_as_proj_point:  # use center of input points\n        sc1 = SkyCoord(lon.min()*u.deg, lat.max()*u.deg)\n        sc2 = SkyCoord(lon.max()*u.deg, lat.min()*u.deg)\n        pa = sc1.position_angle(sc2)\n        sep = sc1.separation(sc2)\n        midpoint_sc = sc1.directional_offset_by(pa, sep/2)\n        wcs.wcs.crval = ((midpoint_sc.data.lon.deg, midpoint_sc.data.lat.deg))\n        wcs.wcs.crpix = ((xpmax + xpmin) / 2., (ypmax + ypmin) / 2.)\n    else:  # convert units, initial guess for crpix\n        proj_point.transform_to(world_coords)\n        wcs.wcs.crval = (proj_point.data.lon.deg, proj_point.data.lat.deg)\n        wcs.wcs.crpix = (close(lon - wcs.wcs.crval[0], xp + 1),\n                         close(lon - wcs.wcs.crval[1], yp + 1))\n\n    # fit linear terms, assign to wcs\n    # use (1, 0, 0, 1) as initial guess, in case input wcs was passed in\n    # and cd terms are way off.\n    # Use bounds to require that the fit center pixel is on the input image\n    if xpmin == xpmax:\n        xpmin, xpmax = xpmin - 0.5, xpmax + 0.5\n    if ypmin == ypmax:\n        ypmin, ypmax = ypmin - 0.5, ypmax + 0.5\n\n    p0 = np.concatenate([wcs.wcs.cd.flatten(), wcs.wcs.crpix.flatten()])\n    fit = least_squares(\n        _linear_wcs_fit, p0,\n        args=(lon, lat, xp, yp, wcs),\n        bounds=[[-np.inf, -np.inf, -np.inf, -np.inf, xpmin + 1, ypmin + 1],\n                [np.inf, np.inf, np.inf, np.inf, xpmax + 1, ypmax + 1]]\n    )\n    wcs.wcs.crpix = np.array(fit.x[4:6])\n    wcs.wcs.cd = np.array(fit.x[0:4].reshape((2, 2)))\n\n    # fit SIP, if specified. Only fit forward coefficients\n    if sip_degree:\n        degree = sip_degree\n        if '-SIP' not in wcs.wcs.ctype[0]:\n            wcs.wcs.ctype = [x + '-SIP' for x in wcs.wcs.ctype]\n\n        coef_names = [f'{i}_{j}' for i in range(degree+1)\n                      for j in range(degree+1) if (i+j) < (degree+1) and\n                      (i+j) > 1]\n        p0 = np.concatenate((np.array(wcs.wcs.crpix), wcs.wcs.cd.flatten(),\n                             np.zeros(2*len(coef_names))))\n\n        fit = least_squares(\n            _sip_fit, p0,\n            args=(lon, lat, xp, yp, wcs, degree, coef_names),\n            bounds=[[xpmin + 1, ypmin + 1] + [-np.inf]*(4 + 2*len(coef_names)),\n                    [xpmax + 1, ypmax + 1] + [np.inf]*(4 + 2*len(coef_names))]\n        )\n        coef_fit = (list(fit.x[6:6+len(coef_names)]),\n                    list(fit.x[6+len(coef_names):]))\n\n        # put fit values in wcs\n        wcs.wcs.cd = fit.x[2:6].reshape((2, 2))\n        wcs.wcs.crpix = fit.x[0:2]\n\n        a_vals = np.zeros((degree+1, degree+1))\n        b_vals = np.zeros((degree+1, degree+1))\n\n        for coef_name in coef_names:\n            a_vals[int(coef_name[0])][int(coef_name[2])] = coef_fit[0].pop(0)\n            b_vals[int(coef_name[0])][int(coef_name[2])] = coef_fit[1].pop(0)\n\n        wcs.sip = Sip(a_vals, b_vals, np.zeros((degree+1, degree+1)),\n                      np.zeros((degree+1, degree+1)), wcs.wcs.crpix)\n\n    return wcs"},{"col":4,"comment":"null","endLoc":159,"header":"def __init__(self, bound=False)","id":8501,"name":"__init__","nodeType":"Function","startLoc":145,"text":"def __init__(self, bound=False):\n        super().__init__(bound)\n\n        # If bound to a data object instance then create the dict of attributes\n        # which stores the info attribute values.\n        if bound:\n            # Specify how to serialize this object depending on context.\n            # If ``True`` for a context, then use formatted ``value`` attribute\n            # (e.g. the ISO time string).  If ``False`` then use float jd1 and jd2.\n            self.serialize_method = {'fits': 'jd1_jd2',\n                                     'ecsv': 'formatted_value',\n                                     'hdf5': 'jd1_jd2',\n                                     'yaml': 'jd1_jd2',\n                                     'parquet': 'jd1_jd2',\n                                     None: 'jd1_jd2'}"},{"col":4,"comment":"null","endLoc":890,"header":"def _get_subscribed_clients(self, private_key, mtype)","id":8502,"name":"_get_subscribed_clients","nodeType":"Function","startLoc":875,"text":"def _get_subscribed_clients(self, private_key, mtype):\n\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            sub_clients = {}\n\n            for pkey in self._private_keys.keys():\n                if pkey != private_key and self._is_subscribed(pkey, mtype):\n                    sub_clients[self._private_keys[pkey][0]] = {}\n\n            log.debug(\"get_subscribed_clients: private_key = {} mtype = {} \"\n                      \"clients = {}\".format(private_key, mtype, sub_clients))\n            return sub_clients\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")"},{"col":4,"comment":"null","endLoc":574,"header":"def to_value(self, **kwargs)","id":8503,"name":"to_value","nodeType":"Function","startLoc":552,"text":"def to_value(self, **kwargs):\n        scale = self.scale.upper().encode('ascii')\n        iy_start, ims, ids, ihmsfs = erfa.d2dtf(scale, 0,  # precision=0\n                                                self.jd1, self.jd2_filled)\n        imon = np.ones_like(iy_start)\n        iday = np.ones_like(iy_start)\n        ihr = np.zeros_like(iy_start)\n        imin = np.zeros_like(iy_start)\n        isec = np.zeros_like(self.jd1)\n\n        # Possible enhancement: use np.unique to only compute start, stop\n        # for unique values of iy_start.\n        scale = self.scale.upper().encode('ascii')\n        jd1_start, jd2_start = erfa.dtf2d(scale, iy_start, imon, iday,\n                                          ihr, imin, isec)\n        jd1_end, jd2_end = erfa.dtf2d(scale, iy_start + 1, imon, iday,\n                                      ihr, imin, isec)\n        # Trying to be precise, but more than float64 not useful.\n        dt = (self.jd1 - jd1_start) + (self.jd2 - jd2_start)\n        dt_end = (jd1_end - jd1_start) + (jd2_end - jd2_start)\n        decimalyear = iy_start + dt / dt_end\n\n        return super().to_value(jd1=decimalyear, jd2=np.float64(0.0), **kwargs)"},{"col":4,"comment":"\n        Return a list of arrays which can be lexically sorted to represent\n        the order of the parent column.\n\n        Returns\n        -------\n        arrays : list of ndarray\n        ","endLoc":173,"header":"def get_sortable_arrays(self)","id":8504,"name":"get_sortable_arrays","nodeType":"Function","startLoc":161,"text":"def get_sortable_arrays(self):\n        \"\"\"\n        Return a list of arrays which can be lexically sorted to represent\n        the order of the parent column.\n\n        Returns\n        -------\n        arrays : list of ndarray\n        \"\"\"\n        parent = self._parent\n        jd_approx = parent.jd\n        jd_remainder = (parent - parent.__class__(jd_approx, format='jd')).jd\n        return [jd_approx, jd_remainder]"},{"col":4,"comment":"null","endLoc":996,"header":"def _notify_all(self, private_key, message)","id":8505,"name":"_notify_all","nodeType":"Function","startLoc":987,"text":"def _notify_all(self, private_key, message):\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            if \"samp.mtype\" not in message:\n                raise SAMPProxyError(3, \"samp.mtype keyword is missing\")\n            recipient_ids = self._notify_all_(private_key, message)\n            return recipient_ids\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")"},{"col":0,"comment":"\n    Calculate the median absolute deviation (MAD).\n\n    The MAD is defined as ``median(abs(a - median(a)))``.\n\n    Parameters\n    ----------\n    data : array-like\n        Input array or object that can be converted to an array.\n    axis : None, int, or tuple of int, optional\n        The axis or axes along which the MADs are computed.  The default\n        (`None`) is to compute the MAD of the flattened array.\n    func : callable, optional\n        The function used to compute the median. Defaults to `numpy.ma.median`\n        for masked arrays, otherwise to `numpy.median`.\n    ignore_nan : bool\n        Ignore NaN values (treat them as if they are not in the array) when\n        computing the median.  This will use `numpy.ma.median` if ``axis`` is\n        specified, or `numpy.nanmedian` if ``axis==None`` and numpy's version\n        is >1.10 because nanmedian is slightly faster in this case.\n\n    Returns\n    -------\n    mad : float or `~numpy.ndarray`\n        The median absolute deviation of the input array.  If ``axis``\n        is `None` then a scalar will be returned, otherwise a\n        `~numpy.ndarray` will be returned.\n\n    Examples\n    --------\n    Generate random variates from a Gaussian distribution and return the\n    median absolute deviation for that distribution::\n\n        >>> import numpy as np\n        >>> from astropy.stats import median_absolute_deviation\n        >>> rand = np.random.default_rng(12345)\n        >>> from numpy.random import randn\n        >>> mad = median_absolute_deviation(rand.standard_normal(1000))\n        >>> print(mad)    # doctest: +FLOAT_CMP\n        0.6829504282771885\n\n    See Also\n    --------\n    mad_std\n    ","endLoc":867,"header":"def median_absolute_deviation(data, axis=None, func=None, ignore_nan=False)","id":8506,"name":"median_absolute_deviation","nodeType":"Function","startLoc":772,"text":"def median_absolute_deviation(data, axis=None, func=None, ignore_nan=False):\n    \"\"\"\n    Calculate the median absolute deviation (MAD).\n\n    The MAD is defined as ``median(abs(a - median(a)))``.\n\n    Parameters\n    ----------\n    data : array-like\n        Input array or object that can be converted to an array.\n    axis : None, int, or tuple of int, optional\n        The axis or axes along which the MADs are computed.  The default\n        (`None`) is to compute the MAD of the flattened array.\n    func : callable, optional\n        The function used to compute the median. Defaults to `numpy.ma.median`\n        for masked arrays, otherwise to `numpy.median`.\n    ignore_nan : bool\n        Ignore NaN values (treat them as if they are not in the array) when\n        computing the median.  This will use `numpy.ma.median` if ``axis`` is\n        specified, or `numpy.nanmedian` if ``axis==None`` and numpy's version\n        is >1.10 because nanmedian is slightly faster in this case.\n\n    Returns\n    -------\n    mad : float or `~numpy.ndarray`\n        The median absolute deviation of the input array.  If ``axis``\n        is `None` then a scalar will be returned, otherwise a\n        `~numpy.ndarray` will be returned.\n\n    Examples\n    --------\n    Generate random variates from a Gaussian distribution and return the\n    median absolute deviation for that distribution::\n\n        >>> import numpy as np\n        >>> from astropy.stats import median_absolute_deviation\n        >>> rand = np.random.default_rng(12345)\n        >>> from numpy.random import randn\n        >>> mad = median_absolute_deviation(rand.standard_normal(1000))\n        >>> print(mad)    # doctest: +FLOAT_CMP\n        0.6829504282771885\n\n    See Also\n    --------\n    mad_std\n    \"\"\"\n\n    if func is None:\n        # Check if the array has a mask and if so use np.ma.median\n        # See https://github.com/numpy/numpy/issues/7330 why using np.ma.median\n        # for normal arrays should not be done (summary: np.ma.median always\n        # returns an masked array even if the result should be scalar). (#4658)\n        if isinstance(data, np.ma.MaskedArray):\n            is_masked = True\n            func = np.ma.median\n            if ignore_nan:\n                data = np.ma.masked_where(np.isnan(data), data, copy=True)\n        elif ignore_nan:\n            is_masked = False\n            func = np.nanmedian\n        else:\n            is_masked = False\n            func = np.median  # drops units if result is NaN\n    else:\n        is_masked = None\n\n    data = np.asanyarray(data)\n    # np.nanmedian has `keepdims`, which is a good option if we're not allowing\n    # user-passed functions here\n    data_median = func(data, axis=axis)\n    # this conditional can be removed after this PR is merged:\n    # https://github.com/astropy/astropy/issues/12165\n    if (isinstance(data, u.Quantity) and func is np.median\n            and data_median.ndim == 0 and np.isnan(data_median)):\n        data_median = data.__array_wrap__(data_median)\n\n    # broadcast the median array before subtraction\n    if axis is not None:\n        data_median = _expand_dims(data_median, axis=axis)  # NUMPY_LT_1_18\n\n    result = func(np.abs(data - data_median), axis=axis, overwrite_input=True)\n    # this conditional can be removed after this PR is merged:\n    # https://github.com/astropy/astropy/issues/12165\n    if (isinstance(data, u.Quantity) and func is np.median\n            and result.ndim == 0 and np.isnan(result)):\n        result = data.__array_wrap__(result)\n\n    if axis is None and np.ma.isMaskedArray(result):\n        # return scalar version\n        result = result.item()\n    elif np.ma.isMaskedArray(result) and not is_masked:\n        # if the input array was not a masked array, we don't want to return a\n        # masked array\n        result = result.filled(fill_value=np.nan)\n\n    return result"},{"attributeType":"null","col":4,"comment":"null","endLoc":519,"id":8507,"name":"name","nodeType":"Attribute","startLoc":519,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":576,"id":8508,"name":"value","nodeType":"Attribute","startLoc":576,"text":"value"},{"attributeType":"null","col":8,"comment":"null","endLoc":550,"id":8509,"name":"jd1","nodeType":"Attribute","startLoc":550,"text":"self.jd1"},{"col":4,"comment":"null","endLoc":177,"header":"@property\n    def unit(self)","id":8510,"name":"unit","nodeType":"Function","startLoc":175,"text":"@property\n    def unit(self):\n        return None"},{"col":4,"comment":"null","endLoc":202,"header":"def _construct_from_dict_base(self, map)","id":8511,"name":"_construct_from_dict_base","nodeType":"Function","startLoc":185,"text":"def _construct_from_dict_base(self, map):\n        if 'jd1' in map and 'jd2' in map:\n            # Initialize as JD but revert to desired format and out_subfmt (if needed)\n            format = map.pop('format')\n            out_subfmt = map.pop('out_subfmt', None)\n            map['format'] = 'jd'\n            map['val'] = map.pop('jd1')\n            map['val2'] = map.pop('jd2')\n            out = self._parent_cls(**map)\n            out.format = format\n            if out_subfmt is not None:\n                out.out_subfmt = out_subfmt\n\n        else:\n            map['val'] = map.pop('value')\n            out = self._parent_cls(**map)\n\n        return out"},{"attributeType":"null","col":18,"comment":"null","endLoc":550,"id":8512,"name":"jd2","nodeType":"Attribute","startLoc":550,"text":"self.jd2"},{"col":4,"comment":"null","endLoc":1014,"header":"def _notify_all_(self, sender_private_key, message)","id":8513,"name":"_notify_all_","nodeType":"Function","startLoc":998,"text":"def _notify_all_(self, sender_private_key, message):\n\n        recipient_ids = []\n        msubs = SAMPHubServer.get_mtype_subtypes(message[\"samp.mtype\"])\n\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                for key in self._mtype2ids[mtype]:\n                    if key != sender_private_key:\n                        _recipient_id = self._private_keys[key][0]\n                        recipient_ids.append(_recipient_id)\n                        self._launch_thread(target=self._notify,\n                                         args=(sender_private_key,\n                                               _recipient_id, message)\n                                         )\n\n        return recipient_ids"},{"col":4,"comment":"null","endLoc":1031,"header":"def _call(self, private_key, recipient_id, msg_tag, message)","id":8514,"name":"_call","nodeType":"Function","startLoc":1016,"text":"def _call(self, private_key, recipient_id, msg_tag, message):\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            if self._is_subscribed(self._public_id_to_private_key(recipient_id),\n                                   message[\"samp.mtype\"]) is False:\n                raise SAMPProxyError(2, \"Client {} not subscribed to MType {}\"\n                                     .format(recipient_id, message[\"samp.mtype\"]))\n            public_id = self._private_keys[private_key][0]\n            msg_id = self._get_new_hub_msg_id(public_id, msg_tag)\n            self._launch_thread(target=self._call_, args=(private_key, public_id,\n                                                          recipient_id, msg_id,\n                                                          message))\n            return msg_id\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")"},{"className":"TimeUnix","col":0,"comment":"\n    Unix time (UTC): seconds from 1970-01-01 00:00:00 UTC, ignoring leap seconds.\n\n    For example, 946684800.0 in Unix time is midnight on January 1, 2000.\n\n    NOTE: this quantity is not exactly unix time and differs from the strict\n    POSIX definition by up to 1 second on days with a leap second.  POSIX\n    unix time actually jumps backward by 1 second at midnight on leap second\n    days while this class value is monotonically increasing at 86400 seconds\n    per UTC day.\n    ","endLoc":701,"id":8515,"nodeType":"Class","startLoc":684,"text":"class TimeUnix(TimeFromEpoch):\n    \"\"\"\n    Unix time (UTC): seconds from 1970-01-01 00:00:00 UTC, ignoring leap seconds.\n\n    For example, 946684800.0 in Unix time is midnight on January 1, 2000.\n\n    NOTE: this quantity is not exactly unix time and differs from the strict\n    POSIX definition by up to 1 second on days with a leap second.  POSIX\n    unix time actually jumps backward by 1 second at midnight on leap second\n    days while this class value is monotonically increasing at 86400 seconds\n    per UTC day.\n    \"\"\"\n    name = 'unix'\n    unit = 1.0 / erfa.DAYSEC  # in days (1 day == 86400 seconds)\n    epoch_val = '1970-01-01 00:00:00'\n    epoch_val2 = None\n    epoch_scale = 'utc'\n    epoch_format = 'iso'"},{"attributeType":"null","col":4,"comment":"null","endLoc":696,"id":8516,"name":"name","nodeType":"Attribute","startLoc":696,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":697,"id":8517,"name":"unit","nodeType":"Attribute","startLoc":697,"text":"unit"},{"col":4,"comment":"null","endLoc":215,"header":"def _construct_from_dict(self, map)","id":8518,"name":"_construct_from_dict","nodeType":"Function","startLoc":204,"text":"def _construct_from_dict(self, map):\n        delta_ut1_utc = map.pop('_delta_ut1_utc', None)\n        delta_tdb_tt = map.pop('_delta_tdb_tt', None)\n\n        out = self._construct_from_dict_base(map)\n\n        if delta_ut1_utc is not None:\n            out._delta_ut1_utc = delta_ut1_utc\n        if delta_tdb_tt is not None:\n            out._delta_tdb_tt = delta_tdb_tt\n\n        return out"},{"attributeType":"null","col":4,"comment":"null","endLoc":698,"id":8519,"name":"epoch_val","nodeType":"Attribute","startLoc":698,"text":"epoch_val"},{"attributeType":"None","col":4,"comment":"null","endLoc":699,"id":8520,"name":"epoch_val2","nodeType":"Attribute","startLoc":699,"text":"epoch_val2"},{"attributeType":"null","col":4,"comment":"null","endLoc":700,"id":8521,"name":"epoch_scale","nodeType":"Attribute","startLoc":700,"text":"epoch_scale"},{"attributeType":"null","col":4,"comment":"null","endLoc":701,"id":8522,"name":"epoch_format","nodeType":"Attribute","startLoc":701,"text":"epoch_format"},{"className":"TimeUnixTai","col":0,"comment":"\n    Unix time (TAI): SI seconds elapsed since 1970-01-01 00:00:00 TAI (see caveats).\n\n    This will generally differ from standard (UTC) Unix time by the cumulative\n    integral number of leap seconds introduced into UTC since 1972-01-01 UTC\n    plus the initial offset of 10 seconds at that date.\n\n    This convention matches the definition of linux CLOCK_TAI\n    (https://www.cl.cam.ac.uk/~mgk25/posix-clocks.html),\n    and the Precision Time Protocol\n    (https://en.wikipedia.org/wiki/Precision_Time_Protocol), which\n    is also used by the White Rabbit protocol in High Energy Physics:\n    https://white-rabbit.web.cern.ch.\n\n    Caveats:\n\n    - Before 1972, fractional adjustments to UTC were made, so the difference\n      between ``unix`` and ``unix_tai`` time is no longer an integer.\n    - Because of the fractional adjustments, to be very precise, ``unix_tai``\n      is the number of seconds since ``1970-01-01 00:00:00 TAI`` or equivalently\n      ``1969-12-31 23:59:51.999918 UTC``.  The difference between TAI and UTC\n      at that epoch was 8.000082 sec.\n    - On the day of a positive leap second the difference between ``unix`` and\n      ``unix_tai`` times increases linearly through the day by 1.0. See also the\n      documentation for the `~astropy.time.TimeUnix` class.\n    - Negative leap seconds are possible, though none have been needed to date.\n\n    Examples\n    --------\n\n      >>> # get the current offset between TAI and UTC\n      >>> from astropy.time import Time\n      >>> t = Time('2020-01-01', scale='utc')\n      >>> t.unix_tai - t.unix\n      37.0\n\n      >>> # Before 1972, the offset between TAI and UTC was not integer\n      >>> t = Time('1970-01-01', scale='utc')\n      >>> t.unix_tai - t.unix  # doctest: +FLOAT_CMP\n      8.000082\n\n      >>> # Initial offset of 10 seconds in 1972\n      >>> t = Time('1972-01-01', scale='utc')\n      >>> t.unix_tai - t.unix\n      10.0\n    ","endLoc":753,"id":8523,"nodeType":"Class","startLoc":704,"text":"class TimeUnixTai(TimeUnix):\n    \"\"\"\n    Unix time (TAI): SI seconds elapsed since 1970-01-01 00:00:00 TAI (see caveats).\n\n    This will generally differ from standard (UTC) Unix time by the cumulative\n    integral number of leap seconds introduced into UTC since 1972-01-01 UTC\n    plus the initial offset of 10 seconds at that date.\n\n    This convention matches the definition of linux CLOCK_TAI\n    (https://www.cl.cam.ac.uk/~mgk25/posix-clocks.html),\n    and the Precision Time Protocol\n    (https://en.wikipedia.org/wiki/Precision_Time_Protocol), which\n    is also used by the White Rabbit protocol in High Energy Physics:\n    https://white-rabbit.web.cern.ch.\n\n    Caveats:\n\n    - Before 1972, fractional adjustments to UTC were made, so the difference\n      between ``unix`` and ``unix_tai`` time is no longer an integer.\n    - Because of the fractional adjustments, to be very precise, ``unix_tai``\n      is the number of seconds since ``1970-01-01 00:00:00 TAI`` or equivalently\n      ``1969-12-31 23:59:51.999918 UTC``.  The difference between TAI and UTC\n      at that epoch was 8.000082 sec.\n    - On the day of a positive leap second the difference between ``unix`` and\n      ``unix_tai`` times increases linearly through the day by 1.0. See also the\n      documentation for the `~astropy.time.TimeUnix` class.\n    - Negative leap seconds are possible, though none have been needed to date.\n\n    Examples\n    --------\n\n      >>> # get the current offset between TAI and UTC\n      >>> from astropy.time import Time\n      >>> t = Time('2020-01-01', scale='utc')\n      >>> t.unix_tai - t.unix\n      37.0\n\n      >>> # Before 1972, the offset between TAI and UTC was not integer\n      >>> t = Time('1970-01-01', scale='utc')\n      >>> t.unix_tai - t.unix  # doctest: +FLOAT_CMP\n      8.000082\n\n      >>> # Initial offset of 10 seconds in 1972\n      >>> t = Time('1972-01-01', scale='utc')\n      >>> t.unix_tai - t.unix\n      10.0\n    \"\"\"\n    name = 'unix_tai'\n    epoch_val = '1970-01-01 00:00:00'\n    epoch_scale = 'tai'"},{"attributeType":"null","col":4,"comment":"null","endLoc":751,"id":8524,"name":"name","nodeType":"Attribute","startLoc":751,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":752,"id":8525,"name":"epoch_val","nodeType":"Attribute","startLoc":752,"text":"epoch_val"},{"attributeType":"null","col":4,"comment":"null","endLoc":753,"id":8526,"name":"epoch_scale","nodeType":"Attribute","startLoc":753,"text":"epoch_scale"},{"className":"TimeCxcSec","col":0,"comment":"\n    Chandra X-ray Center seconds from 1998-01-01 00:00:00 TT.\n    For example, 63072064.184 is midnight on January 1, 2000.\n    ","endLoc":766,"id":8527,"nodeType":"Class","startLoc":756,"text":"class TimeCxcSec(TimeFromEpoch):\n    \"\"\"\n    Chandra X-ray Center seconds from 1998-01-01 00:00:00 TT.\n    For example, 63072064.184 is midnight on January 1, 2000.\n    \"\"\"\n    name = 'cxcsec'\n    unit = 1.0 / erfa.DAYSEC  # in days (1 day == 86400 seconds)\n    epoch_val = '1998-01-01 00:00:00'\n    epoch_val2 = None\n    epoch_scale = 'tt'\n    epoch_format = 'iso'"},{"attributeType":"null","col":4,"comment":"null","endLoc":761,"id":8528,"name":"name","nodeType":"Attribute","startLoc":761,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":762,"id":8529,"name":"unit","nodeType":"Attribute","startLoc":762,"text":"unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":763,"id":8530,"name":"epoch_val","nodeType":"Attribute","startLoc":763,"text":"epoch_val"},{"attributeType":"None","col":4,"comment":"null","endLoc":764,"id":8531,"name":"epoch_val2","nodeType":"Attribute","startLoc":764,"text":"epoch_val2"},{"attributeType":"null","col":4,"comment":"null","endLoc":765,"id":8532,"name":"epoch_scale","nodeType":"Attribute","startLoc":765,"text":"epoch_scale"},{"attributeType":"null","col":4,"comment":"null","endLoc":766,"id":8533,"name":"epoch_format","nodeType":"Attribute","startLoc":766,"text":"epoch_format"},{"className":"TimeGPS","col":0,"comment":"GPS time: seconds from 1980-01-06 00:00:00 UTC\n    For example, 630720013.0 is midnight on January 1, 2000.\n\n    Notes\n    =====\n    This implementation is strictly a representation of the number of seconds\n    (including leap seconds) since midnight UTC on 1980-01-06.  GPS can also be\n    considered as a time scale which is ahead of TAI by a fixed offset\n    (to within about 100 nanoseconds).\n\n    For details, see https://www.usno.navy.mil/USNO/time/gps/usno-gps-time-transfer\n    ","endLoc":788,"id":8534,"nodeType":"Class","startLoc":769,"text":"class TimeGPS(TimeFromEpoch):\n    \"\"\"GPS time: seconds from 1980-01-06 00:00:00 UTC\n    For example, 630720013.0 is midnight on January 1, 2000.\n\n    Notes\n    =====\n    This implementation is strictly a representation of the number of seconds\n    (including leap seconds) since midnight UTC on 1980-01-06.  GPS can also be\n    considered as a time scale which is ahead of TAI by a fixed offset\n    (to within about 100 nanoseconds).\n\n    For details, see https://www.usno.navy.mil/USNO/time/gps/usno-gps-time-transfer\n    \"\"\"\n    name = 'gps'\n    unit = 1.0 / erfa.DAYSEC  # in days (1 day == 86400 seconds)\n    epoch_val = '1980-01-06 00:00:19'\n    # above epoch is the same as Time('1980-01-06 00:00:00', scale='utc').tai\n    epoch_val2 = None\n    epoch_scale = 'tai'\n    epoch_format = 'iso'"},{"attributeType":"null","col":4,"comment":"null","endLoc":782,"id":8535,"name":"name","nodeType":"Attribute","startLoc":782,"text":"name"},{"col":12,"endLoc":1074,"id":8536,"nodeType":"Lambda","startLoc":1074,"text":"lambda l, p: p[np.argmin(np.abs(l))]"},{"attributeType":"null","col":4,"comment":"null","endLoc":783,"id":8537,"name":"unit","nodeType":"Attribute","startLoc":783,"text":"unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":784,"id":8538,"name":"epoch_val","nodeType":"Attribute","startLoc":784,"text":"epoch_val"},{"attributeType":"None","col":4,"comment":"null","endLoc":786,"id":8539,"name":"epoch_val2","nodeType":"Attribute","startLoc":786,"text":"epoch_val2"},{"attributeType":"null","col":4,"comment":"null","endLoc":787,"id":8540,"name":"epoch_scale","nodeType":"Attribute","startLoc":787,"text":"epoch_scale"},{"attributeType":"null","col":4,"comment":"null","endLoc":788,"id":8541,"name":"epoch_format","nodeType":"Attribute","startLoc":788,"text":"epoch_format"},{"col":4,"comment":"null","endLoc":1235,"header":"def _get_new_hub_msg_id(self, sender_public_id, sender_msg_id)","id":8542,"name":"_get_new_hub_msg_id","nodeType":"Function","startLoc":1230,"text":"def _get_new_hub_msg_id(self, sender_public_id, sender_msg_id):\n        with self._thread_lock:\n            self._hub_msg_id_counter += 1\n        return \"msg#{};;{};;{};;{}\".format(self._hub_msg_id_counter,\n                                           self._hub_public_id,\n                                           sender_public_id, sender_msg_id)"},{"className":"TimePlotDate","col":0,"comment":"\n    Matplotlib `~matplotlib.pyplot.plot_date` input:\n    1 + number of days from 0001-01-01 00:00:00 UTC\n\n    This can be used directly in the matplotlib `~matplotlib.pyplot.plot_date`\n    function::\n\n      >>> import matplotlib.pyplot as plt\n      >>> jyear = np.linspace(2000, 2001, 20)\n      >>> t = Time(jyear, format='jyear', scale='utc')\n      >>> plt.plot_date(t.plot_date, jyear)\n      >>> plt.gcf().autofmt_xdate()  # orient date labels at a slant\n      >>> plt.draw()\n\n    For example, 730120.0003703703 is midnight on January 1, 2000.\n    ","endLoc":836,"id":8543,"nodeType":"Class","startLoc":791,"text":"class TimePlotDate(TimeFromEpoch):\n    \"\"\"\n    Matplotlib `~matplotlib.pyplot.plot_date` input:\n    1 + number of days from 0001-01-01 00:00:00 UTC\n\n    This can be used directly in the matplotlib `~matplotlib.pyplot.plot_date`\n    function::\n\n      >>> import matplotlib.pyplot as plt\n      >>> jyear = np.linspace(2000, 2001, 20)\n      >>> t = Time(jyear, format='jyear', scale='utc')\n      >>> plt.plot_date(t.plot_date, jyear)\n      >>> plt.gcf().autofmt_xdate()  # orient date labels at a slant\n      >>> plt.draw()\n\n    For example, 730120.0003703703 is midnight on January 1, 2000.\n    \"\"\"\n    # This corresponds to the zero reference time for matplotlib plot_date().\n    # Note that TAI and UTC are equivalent at the reference time.\n    name = 'plot_date'\n    unit = 1.0\n    epoch_val = 1721424.5  # Time('0001-01-01 00:00:00', scale='tai').jd - 1\n    epoch_val2 = None\n    epoch_scale = 'utc'\n    epoch_format = 'jd'\n\n    @lazyproperty\n    def epoch(self):\n        \"\"\"Reference epoch time from which the time interval is measured\"\"\"\n        try:\n            # Matplotlib >= 3.3 has a get_epoch() function\n            from matplotlib.dates import get_epoch\n        except ImportError:\n            # If no get_epoch() then the epoch is '0001-01-01'\n            _epoch = self._epoch\n        else:\n            # Get the matplotlib date epoch as an ISOT string in UTC\n            epoch_utc = get_epoch()\n            from erfa import ErfaWarning\n            with warnings.catch_warnings():\n                # Catch possible dubious year warnings from erfa\n                warnings.filterwarnings('ignore', category=ErfaWarning)\n                _epoch = Time(epoch_utc, scale='utc', format='isot')\n            _epoch.format = 'jd'\n\n        return _epoch"},{"col":4,"comment":"\n        Return a new Time instance which is consistent with the input Time objects\n        ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty Time instance whose elements can\n        be set in-place for table operations like join or vstack.  It checks\n        that the input locations and attributes are consistent.  This is used\n        when a Time object is used as a mixin column in an astropy Table.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns (Time objects)\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : Time (or subclass)\n            Empty instance of this class consistent with ``cols``\n\n        ","endLoc":276,"header":"def new_like(self, cols, length, metadata_conflicts='warn', name=None)","id":8544,"name":"new_like","nodeType":"Function","startLoc":217,"text":"def new_like(self, cols, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new Time instance which is consistent with the input Time objects\n        ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty Time instance whose elements can\n        be set in-place for table operations like join or vstack.  It checks\n        that the input locations and attributes are consistent.  This is used\n        when a Time object is used as a mixin column in an astropy Table.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns (Time objects)\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : Time (or subclass)\n            Empty instance of this class consistent with ``cols``\n\n        \"\"\"\n        # Get merged info attributes like shape, dtype, format, description, etc.\n        attrs = self.merge_cols_attributes(cols, metadata_conflicts, name,\n                                           ('meta', 'description'))\n        attrs.pop('dtype')  # Not relevant for Time\n        col0 = cols[0]\n\n        # Check that location is consistent for all Time objects\n        for col in cols[1:]:\n            # This is the method used by __setitem__ to ensure that the right side\n            # has a consistent location (and coerce data if necessary, but that does\n            # not happen in this case since `col` is already a Time object).  If this\n            # passes then any subsequent table operations via setitem will work.\n            try:\n                col0._make_value_equivalent(slice(None), col)\n            except ValueError:\n                raise ValueError('input columns have inconsistent locations')\n\n        # Make a new Time object with the desired shape and attributes\n        shape = (length,) + attrs.pop('shape')\n        jd2000 = 2451544.5  # Arbitrary JD value J2000.0 that will work with ERFA\n        jd1 = np.full(shape, jd2000, dtype='f8')\n        jd2 = np.zeros(shape, dtype='f8')\n        tm_attrs = {attr: getattr(col0, attr)\n                    for attr in ('scale', 'location',\n                                 'precision', 'in_subfmt', 'out_subfmt')}\n        out = self._parent_cls(jd1, jd2, format='jd', **tm_attrs)\n        out.format = col0.format\n\n        # Set remaining info attributes\n        for attr, value in attrs.items():\n            setattr(out.info, attr, value)\n\n        return out"},{"col":4,"comment":"Reference epoch time from which the time interval is measured","endLoc":836,"header":"@lazyproperty\n    def epoch(self)","id":8545,"name":"epoch","nodeType":"Function","startLoc":817,"text":"@lazyproperty\n    def epoch(self):\n        \"\"\"Reference epoch time from which the time interval is measured\"\"\"\n        try:\n            # Matplotlib >= 3.3 has a get_epoch() function\n            from matplotlib.dates import get_epoch\n        except ImportError:\n            # If no get_epoch() then the epoch is '0001-01-01'\n            _epoch = self._epoch\n        else:\n            # Get the matplotlib date epoch as an ISOT string in UTC\n            epoch_utc = get_epoch()\n            from erfa import ErfaWarning\n            with warnings.catch_warnings():\n                # Catch possible dubious year warnings from erfa\n                warnings.filterwarnings('ignore', category=ErfaWarning)\n                _epoch = Time(epoch_utc, scale='utc', format='isot')\n            _epoch.format = 'jd'\n\n        return _epoch"},{"col":4,"comment":"null","endLoc":1057,"header":"def _call_(self, sender_private_key, sender_public_id,\n               recipient_public_id, msg_id, message)","id":8546,"name":"_call_","nodeType":"Function","startLoc":1033,"text":"def _call_(self, sender_private_key, sender_public_id,\n               recipient_public_id, msg_id, message):\n\n        if sender_private_key not in self._private_keys:\n            return\n\n        try:\n\n            log.debug(\"call {} from {} to {} ({})\".format(\n                    msg_id.split(\";;\")[0], sender_public_id,\n                    recipient_public_id, message[\"samp.mtype\"]))\n\n            recipient_private_key = self._public_id_to_private_key(recipient_public_id)\n            arg_params = (sender_public_id, msg_id, message)\n            samp_methodName = \"receiveCall\"\n\n            self._retry_method(recipient_private_key, recipient_public_id, samp_methodName, arg_params)\n\n        except Exception as exc:\n            warnings.warn(\"{} call {} from client {} to client {} failed \"\n                          \"[{},{}]\".format(message[\"samp.mtype\"],\n                                           msg_id.split(\";;\")[0],\n                                           sender_public_id,\n                                           recipient_public_id, type(exc), exc),\n                          SAMPWarning)"},{"attributeType":"null","col":4,"comment":"null","endLoc":810,"id":8547,"name":"name","nodeType":"Attribute","startLoc":810,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":811,"id":8548,"name":"unit","nodeType":"Attribute","startLoc":811,"text":"unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":812,"id":8549,"name":"epoch_val","nodeType":"Attribute","startLoc":812,"text":"epoch_val"},{"attributeType":"None","col":4,"comment":"null","endLoc":813,"id":8550,"name":"epoch_val2","nodeType":"Attribute","startLoc":813,"text":"epoch_val2"},{"attributeType":"null","col":4,"comment":"null","endLoc":814,"id":8551,"name":"epoch_scale","nodeType":"Attribute","startLoc":814,"text":"epoch_scale"},{"attributeType":"null","col":4,"comment":"null","endLoc":815,"id":8552,"name":"epoch_format","nodeType":"Attribute","startLoc":815,"text":"epoch_format"},{"className":"TimeStardate","col":0,"comment":"\n    Stardate: date units from 2318-07-05 12:00:00 UTC.\n    For example, stardate 41153.7 is 00:52 on April 30, 2363.\n    See http://trekguide.com/Stardates.htm#TNG for calculations and reference points\n    ","endLoc":850,"id":8553,"nodeType":"Class","startLoc":839,"text":"class TimeStardate(TimeFromEpoch):\n    \"\"\"\n    Stardate: date units from 2318-07-05 12:00:00 UTC.\n    For example, stardate 41153.7 is 00:52 on April 30, 2363.\n    See http://trekguide.com/Stardates.htm#TNG for calculations and reference points\n    \"\"\"\n    name = 'stardate'\n    unit = 0.397766856  # Stardate units per day\n    epoch_val = '2318-07-05 11:00:00'  # Date and time of stardate 00000.00\n    epoch_val2 = None\n    epoch_scale = 'tai'\n    epoch_format = 'iso'"},{"attributeType":"null","col":4,"comment":"null","endLoc":845,"id":8554,"name":"name","nodeType":"Attribute","startLoc":845,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":846,"id":8555,"name":"unit","nodeType":"Attribute","startLoc":846,"text":"unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":847,"id":8556,"name":"epoch_val","nodeType":"Attribute","startLoc":847,"text":"epoch_val"},{"attributeType":"None","col":4,"comment":"null","endLoc":848,"id":8557,"name":"epoch_val2","nodeType":"Attribute","startLoc":848,"text":"epoch_val2"},{"attributeType":"null","col":4,"comment":"null","endLoc":849,"id":8558,"name":"epoch_scale","nodeType":"Attribute","startLoc":849,"text":"epoch_scale"},{"attributeType":"null","col":4,"comment":"null","endLoc":850,"id":8559,"name":"epoch_format","nodeType":"Attribute","startLoc":850,"text":"epoch_format"},{"className":"TimeYMDHMS","col":0,"comment":"\n    ymdhms: A Time format to represent Time as year, month, day, hour,\n    minute, second (thus the name ymdhms).\n\n    Acceptable inputs must have keys or column names in the \"YMDHMS\" set of\n    ``year``, ``month``, ``day`` ``hour``, ``minute``, ``second``:\n\n    - Dict with keys in the YMDHMS set\n    - NumPy structured array, record array or astropy Table, or single row\n      of those types, with column names in the YMDHMS set\n\n    One can supply a subset of the YMDHMS values, for instance only 'year',\n    'month', and 'day'.  Inputs have the following defaults::\n\n      'month': 1, 'day': 1, 'hour': 0, 'minute': 0, 'second': 0\n\n    When the input is supplied as a ``dict`` then each value can be either a\n    scalar value or an array.  The values will be broadcast to a common shape.\n\n    Example::\n\n      >>> from astropy.time import Time\n      >>> t = Time({'year': 2015, 'month': 2, 'day': 3,\n      ...           'hour': 12, 'minute': 13, 'second': 14.567},\n      ...           scale='utc')\n      >>> t.iso\n      '2015-02-03 12:13:14.567'\n      >>> t.ymdhms.year\n      2015\n    ","endLoc":1160,"id":8560,"nodeType":"Class","startLoc":1025,"text":"class TimeYMDHMS(TimeUnique):\n    \"\"\"\n    ymdhms: A Time format to represent Time as year, month, day, hour,\n    minute, second (thus the name ymdhms).\n\n    Acceptable inputs must have keys or column names in the \"YMDHMS\" set of\n    ``year``, ``month``, ``day`` ``hour``, ``minute``, ``second``:\n\n    - Dict with keys in the YMDHMS set\n    - NumPy structured array, record array or astropy Table, or single row\n      of those types, with column names in the YMDHMS set\n\n    One can supply a subset of the YMDHMS values, for instance only 'year',\n    'month', and 'day'.  Inputs have the following defaults::\n\n      'month': 1, 'day': 1, 'hour': 0, 'minute': 0, 'second': 0\n\n    When the input is supplied as a ``dict`` then each value can be either a\n    scalar value or an array.  The values will be broadcast to a common shape.\n\n    Example::\n\n      >>> from astropy.time import Time\n      >>> t = Time({'year': 2015, 'month': 2, 'day': 3,\n      ...           'hour': 12, 'minute': 13, 'second': 14.567},\n      ...           scale='utc')\n      >>> t.iso\n      '2015-02-03 12:13:14.567'\n      >>> t.ymdhms.year\n      2015\n    \"\"\"\n    name = 'ymdhms'\n\n    def _check_val_type(self, val1, val2):\n        \"\"\"\n        This checks inputs for the YMDHMS format.\n\n        It is bit more complex than most format checkers because of the flexible\n        input that is allowed.  Also, it actually coerces ``val1`` into an appropriate\n        dict of ndarrays that can be used easily by ``set_jds()``.  This is useful\n        because it makes it easy to get default values in that routine.\n\n        Parameters\n        ----------\n        val1 : ndarray or None\n        val2 : ndarray or None\n\n        Returns\n        -------\n        val1_as_dict, val2 : val1 as dict or None, val2 is always None\n\n        \"\"\"\n        if val2 is not None:\n            raise ValueError('val2 must be None for ymdhms format')\n\n        ymdhms = ['year', 'month', 'day', 'hour', 'minute', 'second']\n\n        if val1.dtype.names:\n            # Convert to a dict of ndarray\n            val1_as_dict = {name: val1[name] for name in val1.dtype.names}\n\n        elif val1.shape == (0,):\n            # Input was empty list [], so set to None and set_jds will handle this\n            return None, None\n\n        elif (val1.dtype.kind == 'O'\n              and val1.shape == ()\n              and isinstance(val1.item(), dict)):\n            # Code gets here for input as a dict.  The dict input\n            # can be either scalar values or N-d arrays.\n\n            # Extract the item (which is a dict) and broadcast values to the\n            # same shape here.\n            names = val1.item().keys()\n            values = val1.item().values()\n            val1_as_dict = {name: value for name, value\n                            in zip(names, np.broadcast_arrays(*values))}\n\n        else:\n            raise ValueError('input must be dict or table-like')\n\n        # Check that the key names now are good.\n        names = val1_as_dict.keys()\n        required_names = ymdhms[:len(names)]\n\n        def comma_repr(vals):\n            return ', '.join(repr(val) for val in vals)\n\n        bad_names = set(names) - set(ymdhms)\n        if bad_names:\n            raise ValueError(f'{comma_repr(bad_names)} not allowed as YMDHMS key name(s)')\n\n        if set(names) != set(required_names):\n            raise ValueError(f'for {len(names)} input key names '\n                             f'you must supply {comma_repr(required_names)}')\n\n        return val1_as_dict, val2\n\n    def set_jds(self, val1, val2):\n        if val1 is None:\n            # Input was empty list []\n            jd1 = np.array([], dtype=np.float64)\n            jd2 = np.array([], dtype=np.float64)\n\n        else:\n            jd1, jd2 = erfa.dtf2d(self.scale.upper().encode('ascii'),\n                                  val1['year'],\n                                  val1.get('month', 1),\n                                  val1.get('day', 1),\n                                  val1.get('hour', 0),\n                                  val1.get('minute', 0),\n                                  val1.get('second', 0))\n\n        self.jd1, self.jd2 = day_frac(jd1, jd2)\n\n    @property\n    def value(self):\n        scale = self.scale.upper().encode('ascii')\n        iys, ims, ids, ihmsfs = erfa.d2dtf(scale, 9,\n                                           self.jd1, self.jd2_filled)\n\n        out = np.empty(self.jd1.shape, dtype=[('year', 'i4'),\n                                              ('month', 'i4'),\n                                              ('day', 'i4'),\n                                              ('hour', 'i4'),\n                                              ('minute', 'i4'),\n                                              ('second', 'f8')])\n        out['year'] = iys\n        out['month'] = ims\n        out['day'] = ids\n        out['hour'] = ihmsfs['h']\n        out['minute'] = ihmsfs['m']\n        out['second'] = ihmsfs['s'] + ihmsfs['f'] * 10**(-9)\n        out = out.view(np.recarray)\n\n        return self.mask_if_needed(out)"},{"col":4,"comment":"\n        This checks inputs for the YMDHMS format.\n\n        It is bit more complex than most format checkers because of the flexible\n        input that is allowed.  Also, it actually coerces ``val1`` into an appropriate\n        dict of ndarrays that can be used easily by ``set_jds()``.  This is useful\n        because it makes it easy to get default values in that routine.\n\n        Parameters\n        ----------\n        val1 : ndarray or None\n        val2 : ndarray or None\n\n        Returns\n        -------\n        val1_as_dict, val2 : val1 as dict or None, val2 is always None\n\n        ","endLoc":1121,"header":"def _check_val_type(self, val1, val2)","id":8561,"name":"_check_val_type","nodeType":"Function","startLoc":1058,"text":"def _check_val_type(self, val1, val2):\n        \"\"\"\n        This checks inputs for the YMDHMS format.\n\n        It is bit more complex than most format checkers because of the flexible\n        input that is allowed.  Also, it actually coerces ``val1`` into an appropriate\n        dict of ndarrays that can be used easily by ``set_jds()``.  This is useful\n        because it makes it easy to get default values in that routine.\n\n        Parameters\n        ----------\n        val1 : ndarray or None\n        val2 : ndarray or None\n\n        Returns\n        -------\n        val1_as_dict, val2 : val1 as dict or None, val2 is always None\n\n        \"\"\"\n        if val2 is not None:\n            raise ValueError('val2 must be None for ymdhms format')\n\n        ymdhms = ['year', 'month', 'day', 'hour', 'minute', 'second']\n\n        if val1.dtype.names:\n            # Convert to a dict of ndarray\n            val1_as_dict = {name: val1[name] for name in val1.dtype.names}\n\n        elif val1.shape == (0,):\n            # Input was empty list [], so set to None and set_jds will handle this\n            return None, None\n\n        elif (val1.dtype.kind == 'O'\n              and val1.shape == ()\n              and isinstance(val1.item(), dict)):\n            # Code gets here for input as a dict.  The dict input\n            # can be either scalar values or N-d arrays.\n\n            # Extract the item (which is a dict) and broadcast values to the\n            # same shape here.\n            names = val1.item().keys()\n            values = val1.item().values()\n            val1_as_dict = {name: value for name, value\n                            in zip(names, np.broadcast_arrays(*values))}\n\n        else:\n            raise ValueError('input must be dict or table-like')\n\n        # Check that the key names now are good.\n        names = val1_as_dict.keys()\n        required_names = ymdhms[:len(names)]\n\n        def comma_repr(vals):\n            return ', '.join(repr(val) for val in vals)\n\n        bad_names = set(names) - set(ymdhms)\n        if bad_names:\n            raise ValueError(f'{comma_repr(bad_names)} not allowed as YMDHMS key name(s)')\n\n        if set(names) != set(required_names):\n            raise ValueError(f'for {len(names)} input key names '\n                             f'you must supply {comma_repr(required_names)}')\n\n        return val1_as_dict, val2"},{"col":4,"comment":"null","endLoc":1071,"header":"def _call_all(self, private_key, msg_tag, message)","id":8562,"name":"_call_all","nodeType":"Function","startLoc":1059,"text":"def _call_all(self, private_key, msg_tag, message):\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            if \"samp.mtype\" not in message:\n                raise SAMPProxyError(3, \"samp.mtype keyword is missing in \"\n                                        \"message tagged as {}\".format(msg_tag))\n\n            public_id = self._private_keys[private_key][0]\n            msg_id = self._call_all_(private_key, public_id, msg_tag, message)\n            return msg_id\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")"},{"col":4,"comment":"null","endLoc":1138,"header":"def set_jds(self, val1, val2)","id":8564,"name":"set_jds","nodeType":"Function","startLoc":1123,"text":"def set_jds(self, val1, val2):\n        if val1 is None:\n            # Input was empty list []\n            jd1 = np.array([], dtype=np.float64)\n            jd2 = np.array([], dtype=np.float64)\n\n        else:\n            jd1, jd2 = erfa.dtf2d(self.scale.upper().encode('ascii'),\n                                  val1['year'],\n                                  val1.get('month', 1),\n                                  val1.get('day', 1),\n                                  val1.get('hour', 0),\n                                  val1.get('minute', 0),\n                                  val1.get('second', 0))\n\n        self.jd1, self.jd2 = day_frac(jd1, jd2)"},{"col":0,"comment":"\n    Calculate a robust standard deviation using the `median absolute\n    deviation (MAD)\n    <https://en.wikipedia.org/wiki/Median_absolute_deviation>`_.\n\n    The standard deviation estimator is given by:\n\n    .. math::\n\n        \\sigma \\approx \\frac{\\textrm{MAD}}{\\Phi^{-1}(3/4)}\n            \\approx 1.4826 \\ \\textrm{MAD}\n\n    where :math:`\\Phi^{-1}(P)` is the normal inverse cumulative\n    distribution function evaluated at probability :math:`P = 3/4`.\n\n    Parameters\n    ----------\n    data : array-like\n        Data array or object that can be converted to an array.\n    axis : None, int, or tuple of int, optional\n        The axis or axes along which the robust standard deviations are\n        computed.  The default (`None`) is to compute the robust\n        standard deviation of the flattened array.\n    func : callable, optional\n        The function used to compute the median. Defaults to `numpy.ma.median`\n        for masked arrays, otherwise to `numpy.median`.\n    ignore_nan : bool\n        Ignore NaN values (treat them as if they are not in the array) when\n        computing the median.  This will use `numpy.ma.median` if ``axis`` is\n        specified, or `numpy.nanmedian` if ``axis=None`` and numpy's version is\n        >1.10 because nanmedian is slightly faster in this case.\n\n    Returns\n    -------\n    mad_std : float or `~numpy.ndarray`\n        The robust standard deviation of the input data.  If ``axis`` is\n        `None` then a scalar will be returned, otherwise a\n        `~numpy.ndarray` will be returned.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import mad_std\n    >>> rand = np.random.default_rng(12345)\n    >>> madstd = mad_std(rand.normal(5, 2, (100, 100)))\n    >>> print(madstd)    # doctest: +FLOAT_CMP\n    1.984147963351707\n\n    See Also\n    --------\n    biweight_midvariance, biweight_midcovariance, median_absolute_deviation\n    ","endLoc":927,"header":"def mad_std(data, axis=None, func=None, ignore_nan=False)","id":8565,"name":"mad_std","nodeType":"Function","startLoc":870,"text":"def mad_std(data, axis=None, func=None, ignore_nan=False):\n    r\"\"\"\n    Calculate a robust standard deviation using the `median absolute\n    deviation (MAD)\n    <https://en.wikipedia.org/wiki/Median_absolute_deviation>`_.\n\n    The standard deviation estimator is given by:\n\n    .. math::\n\n        \\sigma \\approx \\frac{\\textrm{MAD}}{\\Phi^{-1}(3/4)}\n            \\approx 1.4826 \\ \\textrm{MAD}\n\n    where :math:`\\Phi^{-1}(P)` is the normal inverse cumulative\n    distribution function evaluated at probability :math:`P = 3/4`.\n\n    Parameters\n    ----------\n    data : array-like\n        Data array or object that can be converted to an array.\n    axis : None, int, or tuple of int, optional\n        The axis or axes along which the robust standard deviations are\n        computed.  The default (`None`) is to compute the robust\n        standard deviation of the flattened array.\n    func : callable, optional\n        The function used to compute the median. Defaults to `numpy.ma.median`\n        for masked arrays, otherwise to `numpy.median`.\n    ignore_nan : bool\n        Ignore NaN values (treat them as if they are not in the array) when\n        computing the median.  This will use `numpy.ma.median` if ``axis`` is\n        specified, or `numpy.nanmedian` if ``axis=None`` and numpy's version is\n        >1.10 because nanmedian is slightly faster in this case.\n\n    Returns\n    -------\n    mad_std : float or `~numpy.ndarray`\n        The robust standard deviation of the input data.  If ``axis`` is\n        `None` then a scalar will be returned, otherwise a\n        `~numpy.ndarray` will be returned.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import mad_std\n    >>> rand = np.random.default_rng(12345)\n    >>> madstd = mad_std(rand.normal(5, 2, (100, 100)))\n    >>> print(madstd)    # doctest: +FLOAT_CMP\n    1.984147963351707\n\n    See Also\n    --------\n    biweight_midvariance, biweight_midcovariance, median_absolute_deviation\n    \"\"\"\n\n    # NOTE: 1. / scipy.stats.norm.ppf(0.75) = 1.482602218505602\n    MAD = median_absolute_deviation(\n        data, axis=axis, func=func, ignore_nan=ignore_nan)\n    return MAD * 1.482602218505602"},{"col":0,"comment":"Computes the signal to noise ratio for source being observed in the\n    optical/IR using a CCD.\n\n    Parameters\n    ----------\n    t : float or numpy.ndarray\n        CCD integration time in seconds\n    source_eps : float\n        Number of electrons (photons) or DN per second in the aperture from the\n        source. Note that this should already have been scaled by the filter\n        transmission and the quantum efficiency of the CCD. If the input is in\n        DN, then be sure to set the gain to the proper value for the CCD.\n        If the input is in electrons per second, then keep the gain as its\n        default of 1.0.\n    sky_eps : float\n        Number of electrons (photons) or DN per second per pixel from the sky\n        background. Should already be scaled by filter transmission and QE.\n        This must be in the same units as source_eps for the calculation to\n        make sense.\n    dark_eps : float\n        Number of thermal electrons per second per pixel. If this is given in\n        DN or ADU, then multiply by the gain to get the value in electrons.\n    rd : float\n        Read noise of the CCD in electrons. If this is given in\n        DN or ADU, then multiply by the gain to get the value in electrons.\n    npix : float\n        Size of the aperture in pixels\n    gain : float, optional\n        Gain of the CCD. In units of electrons per DN.\n\n    Returns\n    -------\n    SNR : float or numpy.ndarray\n        Signal to noise ratio calculated from the inputs\n    ","endLoc":970,"header":"def signal_to_noise_oir_ccd(t, source_eps, sky_eps, dark_eps, rd, npix,\n                            gain=1.0)","id":8566,"name":"signal_to_noise_oir_ccd","nodeType":"Function","startLoc":930,"text":"def signal_to_noise_oir_ccd(t, source_eps, sky_eps, dark_eps, rd, npix,\n                            gain=1.0):\n    \"\"\"Computes the signal to noise ratio for source being observed in the\n    optical/IR using a CCD.\n\n    Parameters\n    ----------\n    t : float or numpy.ndarray\n        CCD integration time in seconds\n    source_eps : float\n        Number of electrons (photons) or DN per second in the aperture from the\n        source. Note that this should already have been scaled by the filter\n        transmission and the quantum efficiency of the CCD. If the input is in\n        DN, then be sure to set the gain to the proper value for the CCD.\n        If the input is in electrons per second, then keep the gain as its\n        default of 1.0.\n    sky_eps : float\n        Number of electrons (photons) or DN per second per pixel from the sky\n        background. Should already be scaled by filter transmission and QE.\n        This must be in the same units as source_eps for the calculation to\n        make sense.\n    dark_eps : float\n        Number of thermal electrons per second per pixel. If this is given in\n        DN or ADU, then multiply by the gain to get the value in electrons.\n    rd : float\n        Read noise of the CCD in electrons. If this is given in\n        DN or ADU, then multiply by the gain to get the value in electrons.\n    npix : float\n        Size of the aperture in pixels\n    gain : float, optional\n        Gain of the CCD. In units of electrons per DN.\n\n    Returns\n    -------\n    SNR : float or numpy.ndarray\n        Signal to noise ratio calculated from the inputs\n    \"\"\"\n    signal = t * source_eps * gain\n    noise = np.sqrt(t * (source_eps * gain + npix *\n                         (sky_eps * gain + dark_eps)) + npix * rd ** 2)\n    return signal / noise"},{"col":4,"comment":"null","endLoc":1092,"header":"def _call_all_(self, sender_private_key, sender_public_id, msg_tag,\n                   message)","id":8567,"name":"_call_all_","nodeType":"Function","startLoc":1073,"text":"def _call_all_(self, sender_private_key, sender_public_id, msg_tag,\n                   message):\n\n        msg_id = {}\n        msubs = SAMPHubServer.get_mtype_subtypes(message[\"samp.mtype\"])\n\n        for mtype in msubs:\n            if mtype in self._mtype2ids:\n                for key in self._mtype2ids[mtype]:\n                    if key != sender_private_key:\n                        _msg_id = self._get_new_hub_msg_id(sender_public_id,\n                                                           msg_tag)\n                        receiver_public_id = self._private_keys[key][0]\n                        msg_id[receiver_public_id] = _msg_id\n                        self._launch_thread(target=self._call_,\n                                            args=(sender_private_key,\n                                                  sender_public_id,\n                                                  receiver_public_id, _msg_id,\n                                                  message))\n        return msg_id"},{"col":0,"comment":"Performs bootstrap resampling on numpy arrays.\n\n    Bootstrap resampling is used to understand confidence intervals of sample\n    estimates. This function returns versions of the dataset resampled with\n    replacement (\"case bootstrapping\"). These can all be run through a function\n    or statistic to produce a distribution of values which can then be used to\n    find the confidence intervals.\n\n    Parameters\n    ----------\n    data : ndarray\n        N-D array. The bootstrap resampling will be performed on the first\n        index, so the first index should access the relevant information\n        to be bootstrapped.\n    bootnum : int, optional\n        Number of bootstrap resamples\n    samples : int, optional\n        Number of samples in each resample. The default `None` sets samples to\n        the number of datapoints\n    bootfunc : function, optional\n        Function to reduce the resampled data. Each bootstrap resample will\n        be put through this function and the results returned. If `None`, the\n        bootstrapped data will be returned\n\n    Returns\n    -------\n    boot : ndarray\n\n        If bootfunc is None, then each row is a bootstrap resample of the data.\n        If bootfunc is specified, then the columns will correspond to the\n        outputs of bootfunc.\n\n    Examples\n    --------\n    Obtain a twice resampled array:\n\n    >>> from astropy.stats import bootstrap\n    >>> import numpy as np\n    >>> from astropy.utils import NumpyRNGContext\n    >>> bootarr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])\n    >>> with NumpyRNGContext(1):\n    ...     bootresult = bootstrap(bootarr, 2)\n    ...\n    >>> bootresult  # doctest: +FLOAT_CMP\n    array([[6., 9., 0., 6., 1., 1., 2., 8., 7., 0.],\n           [3., 5., 6., 3., 5., 3., 5., 8., 8., 0.]])\n    >>> bootresult.shape\n    (2, 10)\n\n    Obtain a statistic on the array\n\n    >>> with NumpyRNGContext(1):\n    ...     bootresult = bootstrap(bootarr, 2, bootfunc=np.mean)\n    ...\n    >>> bootresult  # doctest: +FLOAT_CMP\n    array([4. , 4.6])\n\n    Obtain a statistic with two outputs on the array\n\n    >>> test_statistic = lambda x: (np.sum(x), np.mean(x))\n    >>> with NumpyRNGContext(1):\n    ...     bootresult = bootstrap(bootarr, 3, bootfunc=test_statistic)\n    >>> bootresult  # doctest: +FLOAT_CMP\n    array([[40. ,  4. ],\n           [46. ,  4.6],\n           [35. ,  3.5]])\n    >>> bootresult.shape\n    (3, 2)\n\n    Obtain a statistic with two outputs on the array, keeping only the first\n    output\n\n    >>> bootfunc = lambda x:test_statistic(x)[0]\n    >>> with NumpyRNGContext(1):\n    ...     bootresult = bootstrap(bootarr, 3, bootfunc=bootfunc)\n    ...\n    >>> bootresult  # doctest: +FLOAT_CMP\n    array([40., 46., 35.])\n    >>> bootresult.shape\n    (3,)\n\n    ","endLoc":1083,"header":"def bootstrap(data, bootnum=100, samples=None, bootfunc=None)","id":8568,"name":"bootstrap","nodeType":"Function","startLoc":973,"text":"def bootstrap(data, bootnum=100, samples=None, bootfunc=None):\n    \"\"\"Performs bootstrap resampling on numpy arrays.\n\n    Bootstrap resampling is used to understand confidence intervals of sample\n    estimates. This function returns versions of the dataset resampled with\n    replacement (\"case bootstrapping\"). These can all be run through a function\n    or statistic to produce a distribution of values which can then be used to\n    find the confidence intervals.\n\n    Parameters\n    ----------\n    data : ndarray\n        N-D array. The bootstrap resampling will be performed on the first\n        index, so the first index should access the relevant information\n        to be bootstrapped.\n    bootnum : int, optional\n        Number of bootstrap resamples\n    samples : int, optional\n        Number of samples in each resample. The default `None` sets samples to\n        the number of datapoints\n    bootfunc : function, optional\n        Function to reduce the resampled data. Each bootstrap resample will\n        be put through this function and the results returned. If `None`, the\n        bootstrapped data will be returned\n\n    Returns\n    -------\n    boot : ndarray\n\n        If bootfunc is None, then each row is a bootstrap resample of the data.\n        If bootfunc is specified, then the columns will correspond to the\n        outputs of bootfunc.\n\n    Examples\n    --------\n    Obtain a twice resampled array:\n\n    >>> from astropy.stats import bootstrap\n    >>> import numpy as np\n    >>> from astropy.utils import NumpyRNGContext\n    >>> bootarr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])\n    >>> with NumpyRNGContext(1):\n    ...     bootresult = bootstrap(bootarr, 2)\n    ...\n    >>> bootresult  # doctest: +FLOAT_CMP\n    array([[6., 9., 0., 6., 1., 1., 2., 8., 7., 0.],\n           [3., 5., 6., 3., 5., 3., 5., 8., 8., 0.]])\n    >>> bootresult.shape\n    (2, 10)\n\n    Obtain a statistic on the array\n\n    >>> with NumpyRNGContext(1):\n    ...     bootresult = bootstrap(bootarr, 2, bootfunc=np.mean)\n    ...\n    >>> bootresult  # doctest: +FLOAT_CMP\n    array([4. , 4.6])\n\n    Obtain a statistic with two outputs on the array\n\n    >>> test_statistic = lambda x: (np.sum(x), np.mean(x))\n    >>> with NumpyRNGContext(1):\n    ...     bootresult = bootstrap(bootarr, 3, bootfunc=test_statistic)\n    >>> bootresult  # doctest: +FLOAT_CMP\n    array([[40. ,  4. ],\n           [46. ,  4.6],\n           [35. ,  3.5]])\n    >>> bootresult.shape\n    (3, 2)\n\n    Obtain a statistic with two outputs on the array, keeping only the first\n    output\n\n    >>> bootfunc = lambda x:test_statistic(x)[0]\n    >>> with NumpyRNGContext(1):\n    ...     bootresult = bootstrap(bootarr, 3, bootfunc=bootfunc)\n    ...\n    >>> bootresult  # doctest: +FLOAT_CMP\n    array([40., 46., 35.])\n    >>> bootresult.shape\n    (3,)\n\n    \"\"\"\n    if samples is None:\n        samples = data.shape[0]\n\n    # make sure the input is sane\n    if samples < 1 or bootnum < 1:\n        raise ValueError(\"neither 'samples' nor 'bootnum' can be less than 1.\")\n\n    if bootfunc is None:\n        resultdims = (bootnum,) + (samples,) + data.shape[1:]\n    else:\n        # test number of outputs from bootfunc, avoid single outputs which are\n        # array-like\n        try:\n            resultdims = (bootnum, len(bootfunc(data)))\n        except TypeError:\n            resultdims = (bootnum,)\n\n    # create empty boot array\n    boot = np.empty(resultdims)\n\n    for i in range(bootnum):\n        bootarr = np.random.randint(low=0, high=data.shape[0], size=samples)\n        if bootfunc is None:\n            boot[i] = data[bootarr]\n        else:\n            boot[i] = bootfunc(data[bootarr])\n\n    return boot"},{"col":4,"comment":"null","endLoc":1120,"header":"def _call_and_wait(self, private_key, recipient_id, message, timeout)","id":8569,"name":"_call_and_wait","nodeType":"Function","startLoc":1094,"text":"def _call_and_wait(self, private_key, recipient_id, message, timeout):\n        self._update_last_activity_time(private_key)\n\n        if private_key in self._private_keys:\n            timeout = int(timeout)\n\n            now = time.time()\n            response = {}\n\n            msg_id = self._call(private_key, recipient_id, \"samp::sync::call\",\n                                message)\n            self._sync_msg_ids_heap[msg_id] = None\n\n            while self._is_running:\n                if 0 < timeout <= time.time() - now:\n                    del(self._sync_msg_ids_heap[msg_id])\n                    raise SAMPProxyError(1, \"Timeout expired!\")\n\n                if self._sync_msg_ids_heap[msg_id] is not None:\n                    response = copy.deepcopy(self._sync_msg_ids_heap[msg_id])\n                    del(self._sync_msg_ids_heap[msg_id])\n                    break\n                time.sleep(0.01)\n\n            return response\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")"},{"col":4,"comment":"null","endLoc":1160,"header":"@property\n    def value(self)","id":8570,"name":"value","nodeType":"Function","startLoc":1140,"text":"@property\n    def value(self):\n        scale = self.scale.upper().encode('ascii')\n        iys, ims, ids, ihmsfs = erfa.d2dtf(scale, 9,\n                                           self.jd1, self.jd2_filled)\n\n        out = np.empty(self.jd1.shape, dtype=[('year', 'i4'),\n                                              ('month', 'i4'),\n                                              ('day', 'i4'),\n                                              ('hour', 'i4'),\n                                              ('minute', 'i4'),\n                                              ('second', 'f8')])\n        out['year'] = iys\n        out['month'] = ims\n        out['day'] = ids\n        out['hour'] = ihmsfs['h']\n        out['minute'] = ihmsfs['m']\n        out['second'] = ihmsfs['s'] + ihmsfs['f'] * 10**(-9)\n        out = out.view(np.recarray)\n\n        return self.mask_if_needed(out)"},{"attributeType":"null","col":4,"comment":"null","endLoc":119,"id":8571,"name":"attr_names","nodeType":"Attribute","startLoc":119,"text":"attr_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":120,"id":8572,"name":"_supports_indexing","nodeType":"Attribute","startLoc":120,"text":"_supports_indexing"},{"attributeType":"null","col":4,"comment":"null","endLoc":124,"id":8573,"name":"_represent_as_dict_extra_attrs","nodeType":"Attribute","startLoc":124,"text":"_represent_as_dict_extra_attrs"},{"attributeType":"null","col":4,"comment":"null","endLoc":129,"id":8574,"name":"_represent_as_dict_primary_data","nodeType":"Attribute","startLoc":129,"text":"_represent_as_dict_primary_data"},{"attributeType":"null","col":4,"comment":"null","endLoc":131,"id":8575,"name":"mask_val","nodeType":"Attribute","startLoc":131,"text":"mask_val"},{"col":0,"comment":"Upper limit on a poisson count rate\n\n    The implementation is based on Kraft, Burrows and Nousek\n    `ApJ 374, 344 (1991) <https://ui.adsabs.harvard.edu/abs/1991ApJ...374..344K>`_.\n    The XMM-Newton upper limit server uses the same formalism.\n\n    Parameters\n    ----------\n    N : int or np.int32/np.int64\n        Total observed count number\n    B : float or np.float32/np.float64\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float or np.float32/np.float64\n       Confidence level (number between 0 and 1)\n\n    Returns\n    -------\n    S : source count limit\n\n    Notes\n    -----\n    Requires :mod:`~scipy`. This implementation will cause Overflow Errors for\n    about N > 100 (the exact limit depends on details of how scipy was\n    compiled). See `~astropy.stats.mpmath_poisson_upper_limit` for an\n    implementation that is slower, but can deal with arbitrarily high numbers\n    since it is based on the `mpmath <http://mpmath.org/>`_ library.\n    ","endLoc":1162,"header":"def _scipy_kraft_burrows_nousek(N, B, CL)","id":8576,"name":"_scipy_kraft_burrows_nousek","nodeType":"Function","startLoc":1086,"text":"def _scipy_kraft_burrows_nousek(N, B, CL):\n    '''Upper limit on a poisson count rate\n\n    The implementation is based on Kraft, Burrows and Nousek\n    `ApJ 374, 344 (1991) <https://ui.adsabs.harvard.edu/abs/1991ApJ...374..344K>`_.\n    The XMM-Newton upper limit server uses the same formalism.\n\n    Parameters\n    ----------\n    N : int or np.int32/np.int64\n        Total observed count number\n    B : float or np.float32/np.float64\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float or np.float32/np.float64\n       Confidence level (number between 0 and 1)\n\n    Returns\n    -------\n    S : source count limit\n\n    Notes\n    -----\n    Requires :mod:`~scipy`. This implementation will cause Overflow Errors for\n    about N > 100 (the exact limit depends on details of how scipy was\n    compiled). See `~astropy.stats.mpmath_poisson_upper_limit` for an\n    implementation that is slower, but can deal with arbitrarily high numbers\n    since it is based on the `mpmath <http://mpmath.org/>`_ library.\n    '''\n\n    from scipy.optimize import brentq\n    from scipy.integrate import quad\n    from scipy.special import factorial\n\n    from math import exp\n\n    def eqn8(N, B):\n        n = np.arange(N + 1, dtype=np.float64)\n        return 1. / (exp(-B) * np.sum(np.power(B, n) / factorial(n)))\n\n    # The parameters of eqn8 do not vary between calls so we can calculate the\n    # result once and reuse it. The same is True for the factorial of N.\n    # eqn7 is called hundred times so \"caching\" these values yields a\n    # significant speedup (factor 10).\n    eqn8_res = eqn8(N, B)\n    factorial_N = float(math.factorial(N))\n\n    def eqn7(S, N, B):\n        SpB = S + B\n        return eqn8_res * (exp(-SpB) * SpB**N / factorial_N)\n\n    def eqn9_left(S_min, S_max, N, B):\n        return quad(eqn7, S_min, S_max, args=(N, B), limit=500)\n\n    def find_s_min(S_max, N, B):\n        '''\n        Kraft, Burrows and Nousek suggest to integrate from N-B in both\n        directions at once, so that S_min and S_max move similarly (see\n        the article for details). Here, this is implemented differently:\n        Treat S_max as the optimization parameters in func and then\n        calculate the matching s_min that has has eqn7(S_max) =\n        eqn7(S_min) here.\n        '''\n        y_S_max = eqn7(S_max, N, B)\n        if eqn7(0, N, B) >= y_S_max:\n            return 0.\n        else:\n            return brentq(lambda x: eqn7(x, N, B) - y_S_max, 0, N - B)\n\n    def func(s):\n        s_min = find_s_min(s, N, B)\n        out = eqn9_left(s_min, s, N, B)\n        return out[0] - CL\n\n    S_max = brentq(func, N - B, 100)\n    S_min = find_s_min(S_max, N, B)\n    return S_min, S_max"},{"attributeType":"null","col":4,"comment":"null","endLoc":179,"id":8577,"name":"info_summary_stats","nodeType":"Attribute","startLoc":179,"text":"info_summary_stats"},{"attributeType":"null","col":12,"comment":"null","endLoc":154,"id":8578,"name":"serialize_method","nodeType":"Attribute","startLoc":154,"text":"self.serialize_method"},{"className":"TimeDeltaInfo","col":0,"comment":"null","endLoc":329,"id":8579,"nodeType":"Class","startLoc":279,"text":"class TimeDeltaInfo(TimeInfo):\n    _represent_as_dict_extra_attrs = ('format', 'scale')\n\n    def _construct_from_dict(self, map):\n        return self._construct_from_dict_base(map)\n\n    def new_like(self, cols, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new TimeDelta instance which is consistent with the input Time objects\n        ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty Time instance whose elements can\n        be set in-place for table operations like join or vstack.  It checks\n        that the input locations and attributes are consistent.  This is used\n        when a Time object is used as a mixin column in an astropy Table.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns (Time objects)\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : Time (or subclass)\n            Empty instance of this class consistent with ``cols``\n\n        \"\"\"\n        # Get merged info attributes like shape, dtype, format, description, etc.\n        attrs = self.merge_cols_attributes(cols, metadata_conflicts, name,\n                                           ('meta', 'description'))\n        attrs.pop('dtype')  # Not relevant for Time\n        col0 = cols[0]\n\n        # Make a new Time object with the desired shape and attributes\n        shape = (length,) + attrs.pop('shape')\n        jd1 = np.zeros(shape, dtype='f8')\n        jd2 = np.zeros(shape, dtype='f8')\n        out = self._parent_cls(jd1, jd2, format='jd', scale=col0.scale)\n        out.format = col0.format\n\n        # Set remaining info attributes\n        for attr, value in attrs.items():\n            setattr(out.info, attr, value)\n\n        return out"},{"attributeType":"null","col":4,"comment":"null","endLoc":1056,"id":8580,"name":"name","nodeType":"Attribute","startLoc":1056,"text":"name"},{"col":4,"comment":"null","endLoc":283,"header":"def _construct_from_dict(self, map)","id":8581,"name":"_construct_from_dict","nodeType":"Function","startLoc":282,"text":"def _construct_from_dict(self, map):\n        return self._construct_from_dict_base(map)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1138,"id":8583,"name":"jd1","nodeType":"Attribute","startLoc":1138,"text":"self.jd1"},{"col":4,"comment":"null","endLoc":1166,"header":"def _reply_(self, responder_private_key, msg_id, response)","id":8584,"name":"_reply_","nodeType":"Function","startLoc":1136,"text":"def _reply_(self, responder_private_key, msg_id, response):\n\n        if responder_private_key not in self._private_keys or not msg_id:\n            return\n\n        responder_public_id = self._private_keys[responder_private_key][0]\n        counter, hub_public_id, recipient_public_id, recipient_msg_tag = msg_id.split(\";;\", 3)\n\n        try:\n\n            log.debug(\"reply {} from {} to {}\".format(\n                    counter, responder_public_id, recipient_public_id))\n\n            if recipient_msg_tag == \"samp::sync::call\":\n\n                if msg_id in self._sync_msg_ids_heap.keys():\n                    self._sync_msg_ids_heap[msg_id] = response\n\n            else:\n\n                recipient_private_key = self._public_id_to_private_key(recipient_public_id)\n                arg_params = (responder_public_id, recipient_msg_tag, response)\n                samp_method_name = \"receiveResponse\"\n\n                self._retry_method(recipient_private_key, recipient_public_id, samp_method_name, arg_params)\n\n        except Exception as exc:\n            warnings.warn(\"{} reply from client {} to client {} failed [{}]\"\n                          .format(recipient_msg_tag, responder_public_id,\n                                  recipient_public_id, exc),\n                          SAMPWarning)"},{"col":26,"endLoc":1153,"id":8586,"nodeType":"Lambda","startLoc":1153,"text":"lambda x: eqn7(x, N, B) - y_S_max"},{"col":4,"comment":"\n        Return a new TimeDelta instance which is consistent with the input Time objects\n        ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty Time instance whose elements can\n        be set in-place for table operations like join or vstack.  It checks\n        that the input locations and attributes are consistent.  This is used\n        when a Time object is used as a mixin column in an astropy Table.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns (Time objects)\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : Time (or subclass)\n            Empty instance of this class consistent with ``cols``\n\n        ","endLoc":329,"header":"def new_like(self, cols, length, metadata_conflicts='warn', name=None)","id":8587,"name":"new_like","nodeType":"Function","startLoc":285,"text":"def new_like(self, cols, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new TimeDelta instance which is consistent with the input Time objects\n        ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty Time instance whose elements can\n        be set in-place for table operations like join or vstack.  It checks\n        that the input locations and attributes are consistent.  This is used\n        when a Time object is used as a mixin column in an astropy Table.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns (Time objects)\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : Time (or subclass)\n            Empty instance of this class consistent with ``cols``\n\n        \"\"\"\n        # Get merged info attributes like shape, dtype, format, description, etc.\n        attrs = self.merge_cols_attributes(cols, metadata_conflicts, name,\n                                           ('meta', 'description'))\n        attrs.pop('dtype')  # Not relevant for Time\n        col0 = cols[0]\n\n        # Make a new Time object with the desired shape and attributes\n        shape = (length,) + attrs.pop('shape')\n        jd1 = np.zeros(shape, dtype='f8')\n        jd2 = np.zeros(shape, dtype='f8')\n        out = self._parent_cls(jd1, jd2, format='jd', scale=col0.scale)\n        out.format = col0.format\n\n        # Set remaining info attributes\n        for attr, value in attrs.items():\n            setattr(out.info, attr, value)\n\n        return out"},{"attributeType":"null","col":18,"comment":"null","endLoc":1138,"id":8589,"name":"jd2","nodeType":"Attribute","startLoc":1138,"text":"self.jd2"},{"col":0,"comment":"Upper limit on a poisson count rate\n\n    The implementation is based on Kraft, Burrows and Nousek in\n    `ApJ 374, 344 (1991) <https://ui.adsabs.harvard.edu/abs/1991ApJ...374..344K>`_.\n    The XMM-Newton upper limit server used the same formalism.\n\n    Parameters\n    ----------\n    N : int or np.int32/np.int64\n        Total observed count number\n    B : float or np.float32/np.float64\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float or np.float32/np.float64\n       Confidence level (number between 0 and 1)\n\n    Returns\n    -------\n    S : source count limit\n\n    Notes\n    -----\n    Requires the `mpmath <http://mpmath.org/>`_ library.  See\n    `~astropy.stats.scipy_poisson_upper_limit` for an implementation\n    that is based on scipy and evaluates faster, but runs only to about\n    N = 100.\n    ","endLoc":1256,"header":"def _mpmath_kraft_burrows_nousek(N, B, CL)","id":8591,"name":"_mpmath_kraft_burrows_nousek","nodeType":"Function","startLoc":1165,"text":"def _mpmath_kraft_burrows_nousek(N, B, CL):\n    '''Upper limit on a poisson count rate\n\n    The implementation is based on Kraft, Burrows and Nousek in\n    `ApJ 374, 344 (1991) <https://ui.adsabs.harvard.edu/abs/1991ApJ...374..344K>`_.\n    The XMM-Newton upper limit server used the same formalism.\n\n    Parameters\n    ----------\n    N : int or np.int32/np.int64\n        Total observed count number\n    B : float or np.float32/np.float64\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float or np.float32/np.float64\n       Confidence level (number between 0 and 1)\n\n    Returns\n    -------\n    S : source count limit\n\n    Notes\n    -----\n    Requires the `mpmath <http://mpmath.org/>`_ library.  See\n    `~astropy.stats.scipy_poisson_upper_limit` for an implementation\n    that is based on scipy and evaluates faster, but runs only to about\n    N = 100.\n    '''\n    from mpmath import mpf, factorial, findroot, fsum, power, exp, quad\n\n    # We convert these values to float. Because for some reason,\n    # mpmath.mpf cannot convert from numpy.int64\n    N = mpf(float(N))\n    B = mpf(float(B))\n    CL = mpf(float(CL))\n    tol = 1e-4\n\n    def eqn8(N, B):\n        sumterms = [power(B, n) / factorial(n) for n in range(int(N) + 1)]\n        return 1. / (exp(-B) * fsum(sumterms))\n\n    eqn8_res = eqn8(N, B)\n    factorial_N = factorial(N)\n\n    def eqn7(S, N, B):\n        SpB = S + B\n        return eqn8_res * (exp(-SpB) * SpB**N / factorial_N)\n\n    def eqn9_left(S_min, S_max, N, B):\n        def eqn7NB(S):\n            return eqn7(S, N, B)\n        return quad(eqn7NB, [S_min, S_max])\n\n    def find_s_min(S_max, N, B):\n        '''\n        Kraft, Burrows and Nousek suggest to integrate from N-B in both\n        directions at once, so that S_min and S_max move similarly (see\n        the article for details). Here, this is implemented differently:\n        Treat S_max as the optimization parameters in func and then\n        calculate the matching s_min that has has eqn7(S_max) =\n        eqn7(S_min) here.\n        '''\n        y_S_max = eqn7(S_max, N, B)\n        # If B > N, then N-B, the \"most probable\" values is < 0\n        # and thus s_min is certainly 0.\n        # Note: For small N, s_max is also close to 0 and root finding\n        # might find the wrong root, thus it is important to handle this\n        # case here and return the analytical answer (s_min = 0).\n        if (B >= N) or (eqn7(0, N, B) >= y_S_max):\n            return 0.\n        else:\n            def eqn7ysmax(x):\n                return eqn7(x, N, B) - y_S_max\n            return findroot(eqn7ysmax, [0., N - B], solver='ridder',\n                            tol=tol)\n\n    def func(s):\n        s_min = find_s_min(s, N, B)\n        out = eqn9_left(s_min, s, N, B)\n        return out - CL\n\n    # Several numerical problems were found prevent the solvers from finding\n    # the roots unless the starting values are very close to the final values.\n    # Thus, this primitive, time-wasting, brute-force stepping here to get\n    # an interval that can be fed into the ridder solver.\n    s_max_guess = max(N - B, 1.)\n    while func(s_max_guess) < 0:\n        s_max_guess += 1\n    S_max = findroot(func, [s_max_guess - 1, s_max_guess], solver='ridder',\n                     tol=tol)\n    S_min = find_s_min(S_max, N, B)\n    return float(S_min), float(S_max)"},{"className":"TimezoneInfo","col":0,"comment":"\n    Subclass of the `~datetime.tzinfo` object, used in the\n    to_datetime method to specify timezones.\n\n    It may be safer in most cases to use a timezone database package like\n    pytz rather than defining your own timezones - this class is mainly\n    a workaround for users without pytz.\n    ","endLoc":1211,"id":8594,"nodeType":"Class","startLoc":1163,"text":"class TimezoneInfo(datetime.tzinfo):\n    \"\"\"\n    Subclass of the `~datetime.tzinfo` object, used in the\n    to_datetime method to specify timezones.\n\n    It may be safer in most cases to use a timezone database package like\n    pytz rather than defining your own timezones - this class is mainly\n    a workaround for users without pytz.\n    \"\"\"\n    @u.quantity_input(utc_offset=u.day, dst=u.day)\n    def __init__(self, utc_offset=0 * u.day, dst=0 * u.day, tzname=None):\n        \"\"\"\n        Parameters\n        ----------\n        utc_offset : `~astropy.units.Quantity`, optional\n            Offset from UTC in days. Defaults to zero.\n        dst : `~astropy.units.Quantity`, optional\n            Daylight Savings Time offset in days. Defaults to zero\n            (no daylight savings).\n        tzname : str or None, optional\n            Name of timezone\n\n        Examples\n        --------\n        >>> from datetime import datetime\n        >>> from astropy.time import TimezoneInfo  # Specifies a timezone\n        >>> import astropy.units as u\n        >>> utc = TimezoneInfo()    # Defaults to UTC\n        >>> utc_plus_one_hour = TimezoneInfo(utc_offset=1*u.hour)  # UTC+1\n        >>> dt_aware = datetime(2000, 1, 1, 0, 0, 0, tzinfo=utc_plus_one_hour)\n        >>> print(dt_aware)\n        2000-01-01 00:00:00+01:00\n        >>> print(dt_aware.astimezone(utc))\n        1999-12-31 23:00:00+00:00\n        \"\"\"\n        if utc_offset == 0 and dst == 0 and tzname is None:\n            tzname = 'UTC'\n        self._utcoffset = datetime.timedelta(utc_offset.to_value(u.day))\n        self._tzname = tzname\n        self._dst = datetime.timedelta(dst.to_value(u.day))\n\n    def utcoffset(self, dt):\n        return self._utcoffset\n\n    def tzname(self, dt):\n        return str(self._tzname)\n\n    def dst(self, dt):\n        return self._dst"},{"col":4,"comment":"null","endLoc":1205,"header":"def utcoffset(self, dt)","id":8595,"name":"utcoffset","nodeType":"Function","startLoc":1204,"text":"def utcoffset(self, dt):\n        return self._utcoffset"},{"col":4,"comment":"null","endLoc":1208,"header":"def tzname(self, dt)","id":8596,"name":"tzname","nodeType":"Function","startLoc":1207,"text":"def tzname(self, dt):\n        return str(self._tzname)"},{"col":4,"comment":"\n        Evaluates the Ripley K function for the homogeneous Poisson process,\n        also known as Complete State of Randomness (CSR).\n\n        Parameters\n        ----------\n        radii : 1D array\n            Set of distances in which Ripley's K function will be evaluated.\n\n        Returns\n        -------\n        output : 1D array\n            Ripley's K function evaluated at ``radii``.\n        ","endLoc":155,"header":"def poisson(self, radii)","id":8597,"name":"poisson","nodeType":"Function","startLoc":139,"text":"def poisson(self, radii):\n        \"\"\"\n        Evaluates the Ripley K function for the homogeneous Poisson process,\n        also known as Complete State of Randomness (CSR).\n\n        Parameters\n        ----------\n        radii : 1D array\n            Set of distances in which Ripley's K function will be evaluated.\n\n        Returns\n        -------\n        output : 1D array\n            Ripley's K function evaluated at ``radii``.\n        \"\"\"\n\n        return np.pi * radii * radii"},{"attributeType":"null","col":4,"comment":"null","endLoc":280,"id":8598,"name":"_represent_as_dict_extra_attrs","nodeType":"Attribute","startLoc":280,"text":"_represent_as_dict_extra_attrs"},{"col":4,"comment":"\n        Evaluates the L function at ``radii``. For parameter description\n        see ``evaluate`` method.\n        ","endLoc":163,"header":"def Lfunction(self, data, radii, mode='none')","id":8599,"name":"Lfunction","nodeType":"Function","startLoc":157,"text":"def Lfunction(self, data, radii, mode='none'):\n        \"\"\"\n        Evaluates the L function at ``radii``. For parameter description\n        see ``evaluate`` method.\n        \"\"\"\n\n        return np.sqrt(self.evaluate(data, radii, mode=mode) / np.pi)"},{"className":"TimeDeltaMissingUnitWarning","col":0,"comment":"Warning for missing unit or format in TimeDelta","endLoc":2246,"id":8600,"nodeType":"Class","startLoc":2244,"text":"class TimeDeltaMissingUnitWarning(AstropyDeprecationWarning):\n    \"\"\"Warning for missing unit or format in TimeDelta\"\"\"\n    pass"},{"className":"OperandTypeError","col":0,"comment":"null","endLoc":2778,"id":8602,"nodeType":"Class","startLoc":2771,"text":"class OperandTypeError(TypeError):\n    def __init__(self, left, right, op=None):\n        op_string = '' if op is None else f' for {op}'\n        super().__init__(\n            \"Unsupported operand type(s){}: \"\n            \"'{}' and '{}'\".format(op_string,\n                                   left.__class__.__name__,\n                                   right.__class__.__name__))"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":8603,"name":"__all__","nodeType":"Attribute","startLoc":37,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":42,"id":8604,"name":"STANDARD_TIME_SCALES","nodeType":"Attribute","startLoc":42,"text":"STANDARD_TIME_SCALES"},{"attributeType":"null","col":0,"comment":"null","endLoc":43,"id":8606,"name":"LOCAL_SCALES","nodeType":"Attribute","startLoc":43,"text":"LOCAL_SCALES"},{"attributeType":"null","col":0,"comment":"null","endLoc":44,"id":8607,"name":"TIME_TYPES","nodeType":"Attribute","startLoc":44,"text":"TIME_TYPES"},{"attributeType":"null","col":0,"comment":"null","endLoc":47,"id":8609,"name":"MULTI_HOPS","nodeType":"Attribute","startLoc":47,"text":"MULTI_HOPS"},{"attributeType":"null","col":0,"comment":"null","endLoc":63,"id":8610,"name":"GEOCENTRIC_SCALES","nodeType":"Attribute","startLoc":63,"text":"GEOCENTRIC_SCALES"},{"col":4,"comment":"null","endLoc":1211,"header":"def dst(self, dt)","id":8611,"name":"dst","nodeType":"Function","startLoc":1210,"text":"def dst(self, dt):\n        return self._dst"},{"attributeType":"null","col":0,"comment":"null","endLoc":65,"id":8612,"name":"ROTATIONAL_SCALES","nodeType":"Attribute","startLoc":65,"text":"ROTATIONAL_SCALES"},{"attributeType":"null","col":0,"comment":"null","endLoc":66,"id":8613,"name":"TIME_DELTA_TYPES","nodeType":"Attribute","startLoc":66,"text":"TIME_DELTA_TYPES"},{"attributeType":"null","col":8,"comment":"null","endLoc":1200,"id":8614,"name":"_utcoffset","nodeType":"Attribute","startLoc":1200,"text":"self._utcoffset"},{"attributeType":"null","col":0,"comment":"null","endLoc":79,"id":8615,"name":"SCALE_OFFSETS","nodeType":"Attribute","startLoc":79,"text":"SCALE_OFFSETS"},{"attributeType":"null","col":0,"comment":"null","endLoc":89,"id":8616,"name":"SIDEREAL_TIME_MODELS","nodeType":"Attribute","startLoc":89,"text":"SIDEREAL_TIME_MODELS"},{"attributeType":"null","col":0,"comment":"null","endLoc":109,"id":8617,"name":"_LEAP_SECONDS_CHECK","nodeType":"Attribute","startLoc":109,"text":"_LEAP_SECONDS_CHECK"},{"attributeType":"null","col":0,"comment":"null","endLoc":110,"id":8618,"name":"_LEAP_SECONDS_LOCK","nodeType":"Attribute","startLoc":110,"text":"_LEAP_SECONDS_LOCK"},{"col":0,"comment":"Upper limit on a poisson count rate\n\n    The implementation is based on Kraft, Burrows and Nousek in\n    `ApJ 374, 344 (1991) <https://ui.adsabs.harvard.edu/abs/1991ApJ...374..344K>`_.\n    The XMM-Newton upper limit server used the same formalism.\n\n    Parameters\n    ----------\n    N : int or np.int32/np.int64\n        Total observed count number\n    B : float or np.float32/np.float64\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float or np.float32/np.float64\n       Confidence level (number between 0 and 1)\n\n    Returns\n    -------\n    S : source count limit\n\n    Notes\n    -----\n    This functions has an optional dependency: Either :mod:`scipy` or `mpmath\n    <http://mpmath.org/>`_  need to be available. (Scipy only works for\n    N < 100).\n    ","endLoc":1298,"header":"def _kraft_burrows_nousek(N, B, CL)","id":8619,"name":"_kraft_burrows_nousek","nodeType":"Function","startLoc":1259,"text":"def _kraft_burrows_nousek(N, B, CL):\n    '''Upper limit on a poisson count rate\n\n    The implementation is based on Kraft, Burrows and Nousek in\n    `ApJ 374, 344 (1991) <https://ui.adsabs.harvard.edu/abs/1991ApJ...374..344K>`_.\n    The XMM-Newton upper limit server used the same formalism.\n\n    Parameters\n    ----------\n    N : int or np.int32/np.int64\n        Total observed count number\n    B : float or np.float32/np.float64\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float or np.float32/np.float64\n       Confidence level (number between 0 and 1)\n\n    Returns\n    -------\n    S : source count limit\n\n    Notes\n    -----\n    This functions has an optional dependency: Either :mod:`scipy` or `mpmath\n    <http://mpmath.org/>`_  need to be available. (Scipy only works for\n    N < 100).\n    '''\n    from astropy.utils.compat.optional_deps import HAS_SCIPY, HAS_MPMATH\n\n    if HAS_SCIPY and N <= 100:\n        try:\n            return _scipy_kraft_burrows_nousek(N, B, CL)\n        except OverflowError:\n            if not HAS_MPMATH:\n                raise ValueError('Need mpmath package for input numbers this '\n                                 'large.')\n    if HAS_MPMATH:\n        return _mpmath_kraft_burrows_nousek(N, B, CL)\n\n    raise ImportError('Either scipy or mpmath are required.')"},{"col":4,"comment":"\n        Evaluates the H function at ``radii``. For parameter description\n        see ``evaluate`` method.\n        ","endLoc":171,"header":"def Hfunction(self, data, radii, mode='none')","id":8620,"name":"Hfunction","nodeType":"Function","startLoc":165,"text":"def Hfunction(self, data, radii, mode='none'):\n        \"\"\"\n        Evaluates the H function at ``radii``. For parameter description\n        see ``evaluate`` method.\n        \"\"\"\n\n        return self.Lfunction(data, radii, mode=mode) - radii"},{"col":0,"comment":"","endLoc":8,"header":"core.py#<anonymous>","id":8621,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThe astropy.time package provides functionality for manipulating times and\ndates. Specific emphasis is placed on supporting time scales (e.g. UTC, TAI,\nUT1) and time representations (e.g. JD, MJD, ISO 8601) that are used in\nastronomy.\n\"\"\"\n\n__all__ = ['TimeBase', 'Time', 'TimeDelta', 'TimeInfo', 'update_leap_seconds',\n           'TIME_SCALES', 'STANDARD_TIME_SCALES', 'TIME_DELTA_SCALES',\n           'ScaleValueError', 'OperandTypeError', 'TimeDeltaMissingUnitWarning']\n\nSTANDARD_TIME_SCALES = ('tai', 'tcb', 'tcg', 'tdb', 'tt', 'ut1', 'utc')\n\nLOCAL_SCALES = ('local',)\n\nTIME_TYPES = dict((scale, scales) for scales in (STANDARD_TIME_SCALES, LOCAL_SCALES)\n                  for scale in scales)\n\nTIME_SCALES = STANDARD_TIME_SCALES + LOCAL_SCALES\n\nMULTI_HOPS = {('tai', 'tcb'): ('tt', 'tdb'),\n              ('tai', 'tcg'): ('tt',),\n              ('tai', 'ut1'): ('utc',),\n              ('tai', 'tdb'): ('tt',),\n              ('tcb', 'tcg'): ('tdb', 'tt'),\n              ('tcb', 'tt'): ('tdb',),\n              ('tcb', 'ut1'): ('tdb', 'tt', 'tai', 'utc'),\n              ('tcb', 'utc'): ('tdb', 'tt', 'tai'),\n              ('tcg', 'tdb'): ('tt',),\n              ('tcg', 'ut1'): ('tt', 'tai', 'utc'),\n              ('tcg', 'utc'): ('tt', 'tai'),\n              ('tdb', 'ut1'): ('tt', 'tai', 'utc'),\n              ('tdb', 'utc'): ('tt', 'tai'),\n              ('tt', 'ut1'): ('tai', 'utc'),\n              ('tt', 'utc'): ('tai',),\n              }\n\nGEOCENTRIC_SCALES = ('tai', 'tt', 'tcg')\n\nBARYCENTRIC_SCALES = ('tcb', 'tdb')\n\nROTATIONAL_SCALES = ('ut1',)\n\nTIME_DELTA_TYPES = dict((scale, scales)\n                        for scales in (GEOCENTRIC_SCALES, BARYCENTRIC_SCALES,\n                                       ROTATIONAL_SCALES, LOCAL_SCALES) for scale in scales)\n\nTIME_DELTA_SCALES = GEOCENTRIC_SCALES + BARYCENTRIC_SCALES + ROTATIONAL_SCALES + LOCAL_SCALES\n\nSCALE_OFFSETS = {('tt', 'tai'): None,\n                 ('tai', 'tt'): None,\n                 ('tcg', 'tt'): -erfa.ELG,\n                 ('tt', 'tcg'): erfa.ELG / (1. - erfa.ELG),\n                 ('tcg', 'tai'): -erfa.ELG,\n                 ('tai', 'tcg'): erfa.ELG / (1. - erfa.ELG),\n                 ('tcb', 'tdb'): -erfa.ELB,\n                 ('tdb', 'tcb'): erfa.ELB / (1. - erfa.ELB)}\n\nSIDEREAL_TIME_MODELS = {\n    'mean': {\n        'IAU2006': {'function': erfa.gmst06, 'scales': ('ut1', 'tt')},\n        'IAU2000': {'function': erfa.gmst00, 'scales': ('ut1', 'tt')},\n        'IAU1982': {'function': erfa.gmst82, 'scales': ('ut1',), 'include_tio': False}\n    },\n    'apparent': {\n        'IAU2006A': {'function': erfa.gst06a, 'scales': ('ut1', 'tt')},\n        'IAU2000A': {'function': erfa.gst00a, 'scales': ('ut1', 'tt')},\n        'IAU2000B': {'function': erfa.gst00b, 'scales': ('ut1',)},\n        'IAU1994': {'function': erfa.gst94, 'scales': ('ut1',), 'include_tio': False}\n    }}\n\n_LEAP_SECONDS_CHECK = _LeapSecondsCheck.NOT_STARTED\n\n_LEAP_SECONDS_LOCK = threading.RLock()"},{"col":4,"comment":"null","endLoc":1309,"header":"def _web_profile_register(self, identity_info,\n                              client_address=(\"unknown\", 0),\n                              origin=\"unknown\")","id":8622,"name":"_web_profile_register","nodeType":"Function","startLoc":1270,"text":"def _web_profile_register(self, identity_info,\n                              client_address=(\"unknown\", 0),\n                              origin=\"unknown\"):\n\n        self._update_last_activity_time()\n\n        if not client_address[0] in [\"localhost\", \"127.0.0.1\"]:\n            raise SAMPProxyError(403, \"Request of registration rejected \"\n                                      \"by the Hub.\")\n\n        if not origin:\n            origin = \"unknown\"\n\n        if isinstance(identity_info, dict):\n            # an old version of the protocol provided just a string with the app name\n            if \"samp.name\" not in identity_info:\n                raise SAMPProxyError(403, \"Request of registration rejected \"\n                                          \"by the Hub (application name not \"\n                                          \"provided).\")\n\n        # Red semaphore for the other threads\n        self._web_profile_requests_semaphore.put(\"wait\")\n        # Set the request to be displayed for the current thread\n        self._web_profile_requests_queue.put((identity_info, client_address,\n                                              origin))\n        # Get the popup dialogue response\n        response = self._web_profile_requests_result.get()\n        # OK, semaphore green\n        self._web_profile_requests_semaphore.get()\n\n        if response:\n            register_map = self._perform_standard_register()\n            translator_url = (\"http://localhost:{}/translator/{}?ref=\"\n                              .format(self._web_port, register_map[\"samp.private-key\"]))\n            register_map[\"samp.url-translator\"] = translator_url\n            self._web_profile_server.add_client(register_map[\"samp.private-key\"])\n            return register_map\n        else:\n            raise SAMPProxyError(403, \"Request of registration rejected by \"\n                                      \"the user.\")"},{"col":0,"comment":"Compute the false positive probability for the Kuiper statistic.\n\n    Uses the set of four formulas described in Paltani 2004; they report\n    the resulting function never underestimates the false positive\n    probability but can be a bit high in the N=40..50 range.\n    (They quote a factor 1.5 at the 1e-7 level.)\n\n    Parameters\n    ----------\n    D : float\n        The Kuiper test score.\n    N : float\n        The effective sample size.\n\n    Returns\n    -------\n    fpp : float\n        The probability of a score this large arising from the null hypothesis.\n\n    Notes\n    -----\n    Eq 7 of Paltani 2004 appears to incorrectly quote the original formula\n    (Stephens 1965). This function implements the original formula, as it\n    produces a result closer to Monte Carlo simulations.\n\n    References\n    ----------\n\n    .. [1] Paltani, S., \"Searching for periods in X-ray observations using\n           Kuiper's test. Application to the ROSAT PSPC archive\",\n           Astronomy and Astrophysics, v.240, p.789-790, 2004.\n\n    .. [2] Stephens, M. A., \"The goodness-of-fit statistic VN: distribution\n           and significance points\", Biometrika, v.52, p.309, 1965.\n\n    ","endLoc":1380,"header":"def kuiper_false_positive_probability(D, N)","id":8623,"name":"kuiper_false_positive_probability","nodeType":"Function","startLoc":1301,"text":"def kuiper_false_positive_probability(D, N):\n    \"\"\"Compute the false positive probability for the Kuiper statistic.\n\n    Uses the set of four formulas described in Paltani 2004; they report\n    the resulting function never underestimates the false positive\n    probability but can be a bit high in the N=40..50 range.\n    (They quote a factor 1.5 at the 1e-7 level.)\n\n    Parameters\n    ----------\n    D : float\n        The Kuiper test score.\n    N : float\n        The effective sample size.\n\n    Returns\n    -------\n    fpp : float\n        The probability of a score this large arising from the null hypothesis.\n\n    Notes\n    -----\n    Eq 7 of Paltani 2004 appears to incorrectly quote the original formula\n    (Stephens 1965). This function implements the original formula, as it\n    produces a result closer to Monte Carlo simulations.\n\n    References\n    ----------\n\n    .. [1] Paltani, S., \"Searching for periods in X-ray observations using\n           Kuiper's test. Application to the ROSAT PSPC archive\",\n           Astronomy and Astrophysics, v.240, p.789-790, 2004.\n\n    .. [2] Stephens, M. A., \"The goodness-of-fit statistic VN: distribution\n           and significance points\", Biometrika, v.52, p.309, 1965.\n\n    \"\"\"\n    try:\n        from scipy.special import factorial, comb\n    except ImportError:\n        # Retained for backwards compatibility with older versions of scipy\n        # (factorial appears to have moved here in 0.14)\n        from scipy.misc import factorial, comb\n\n    if D < 0. or D > 2.:\n        raise ValueError(\"Must have 0<=D<=2 by definition of the Kuiper test\")\n\n    if D < 2. / N:\n        return 1. - factorial(N) * (D - 1. / N)**(N - 1)\n    elif D < 3. / N:\n        k = -(N * D - 1.) / 2.\n        r = np.sqrt(k**2 - (N * D - 2.)**2 / 2.)\n        a, b = -k + r, -k - r\n        return 1 - (factorial(N - 1) * (b**(N - 1) * (1 - a) - a**(N - 1) * (1 - b))\n                    / N**(N - 2) / (b - a))\n    elif (D > 0.5 and N % 2 == 0) or (D > (N - 1.) / (2. * N) and N % 2 == 1):\n        # NOTE: the upper limit of this sum is taken from Stephens 1965\n        t = np.arange(np.floor(N * (1 - D)) + 1)\n        y = D + t / N\n        Tt = y**(t - 3) * (y**3 * N\n                           - y**2 * t * (3 - 2 / N)\n                           + y * t * (t - 1) * (3 - 2 / N) / N\n                           - t * (t - 1) * (t - 2) / N**2)\n        term1 = comb(N, t)\n        term2 = (1 - D - t / N)**(N - t - 1)\n        # term1 is formally finite, but is approximated by numpy as np.inf for\n        # large values, so we set them to zero manually when they would be\n        # multiplied by zero anyway\n        term1[(term1 == np.inf) & (term2 == 0)] = 0.\n        final_term = Tt * term1 * term2\n        return final_term.sum()\n    else:\n        z = D * np.sqrt(N)\n        # When m*z>18.82 (sqrt(-log(finfo(double))/2)), exp(-2m**2z**2)\n        # underflows.  Cutting off just before avoids triggering a (pointless)\n        # underflow warning if `under=\"warn\"`.\n        ms = np.arange(1, 18.82 / z)\n        S1 = (2 * (4 * ms**2 * z**2 - 1) * np.exp(-2 * ms**2 * z**2)).sum()\n        S2 = (ms**2 * (4 * ms**2 * z**2 - 3) * np.exp(-2 * ms**2 * z**2)).sum()\n        return S1 - 8 * D / 3 * S2"},{"attributeType":"null","col":8,"comment":"null","endLoc":62,"id":8624,"name":"area","nodeType":"Attribute","startLoc":62,"text":"self.area"},{"attributeType":"{__gt__}","col":12,"comment":"null","endLoc":75,"id":8625,"name":"_area","nodeType":"Attribute","startLoc":75,"text":"self._area"},{"attributeType":"null","col":12,"comment":"null","endLoc":121,"id":8626,"name":"_x_min","nodeType":"Attribute","startLoc":121,"text":"self._x_min"},{"attributeType":"null","col":8,"comment":"null","endLoc":66,"id":8627,"name":"y_min","nodeType":"Attribute","startLoc":66,"text":"self.y_min"},{"attributeType":"null","col":8,"comment":"null","endLoc":63,"id":8628,"name":"x_max","nodeType":"Attribute","startLoc":63,"text":"self.x_max"},{"attributeType":"null","col":12,"comment":"null","endLoc":98,"id":8629,"name":"_x_max","nodeType":"Attribute","startLoc":98,"text":"self._x_max"},{"attributeType":"null","col":8,"comment":"null","endLoc":64,"id":8630,"name":"y_max","nodeType":"Attribute","startLoc":64,"text":"self.y_max"},{"fileName":"biweight.py","filePath":"astropy/stats","id":8631,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module contains functions for computing robust statistics using\nTukey's biweight function.\n\"\"\"\n\nimport numpy as np\n\nfrom .funcs import _expand_dims, median_absolute_deviation\n\n__all__ = ['biweight_location', 'biweight_scale', 'biweight_midvariance',\n           'biweight_midcovariance', 'biweight_midcorrelation']\n\n\ndef _stat_functions(data, ignore_nan=False):\n    if isinstance(data, np.ma.MaskedArray):\n        median_func = np.ma.median\n        sum_func = np.ma.sum\n    elif ignore_nan:\n        median_func = np.nanmedian\n        sum_func = np.nansum\n    else:\n        median_func = np.median\n        sum_func = np.sum\n\n    return median_func, sum_func\n\n\ndef biweight_location(data, c=6.0, M=None, axis=None, *, ignore_nan=False):\n    r\"\"\"\n    Compute the biweight location.\n\n    The biweight location is a robust statistic for determining the\n    central location of a distribution.  It is given by:\n\n    .. math::\n\n        \\zeta_{biloc}= M + \\frac{\\sum_{|u_i|<1} \\ (x_i - M) (1 - u_i^2)^2}\n            {\\sum_{|u_i|<1} \\ (1 - u_i^2)^2}\n\n    where :math:`x` is the input data, :math:`M` is the sample median\n    (or the input initial location guess) and :math:`u_i` is given by:\n\n    .. math::\n\n        u_{i} = \\frac{(x_i - M)}{c * MAD}\n\n    where :math:`c` is the tuning constant and :math:`MAD` is the\n    `median absolute deviation\n    <https://en.wikipedia.org/wiki/Median_absolute_deviation>`_.  The\n    biweight location tuning constant ``c`` is typically 6.0 (the\n    default).\n\n    If :math:`MAD` is zero, then the median will be returned.\n\n    Parameters\n    ----------\n    data : array-like\n        Input array or object that can be converted to an array.\n        ``data`` can be a `~numpy.ma.MaskedArray`.\n    c : float, optional\n        Tuning constant for the biweight estimator (default = 6.0).\n    M : float or array-like, optional\n        Initial guess for the location.  If ``M`` is a scalar value,\n        then its value will be used for the entire array (or along each\n        ``axis``, if specified).  If ``M`` is an array, then its must be\n        an array containing the initial location estimate along each\n        ``axis`` of the input array.  If `None` (default), then the\n        median of the input array will be used (or along each ``axis``,\n        if specified).\n    axis : None, int, or tuple of int, optional\n        The axis or axes along which the biweight locations are\n        computed.  If `None` (default), then the biweight location of\n        the flattened input array will be computed.\n    ignore_nan : bool, optional\n        Whether to ignore NaN values in the input ``data``.\n\n    Returns\n    -------\n    biweight_location : float or `~numpy.ndarray`\n        The biweight location of the input data.  If ``axis`` is `None`\n        then a scalar will be returned, otherwise a `~numpy.ndarray`\n        will be returned.\n\n    See Also\n    --------\n    biweight_scale, biweight_midvariance, biweight_midcovariance\n\n    References\n    ----------\n    .. [1] Beers, Flynn, and Gebhardt (1990; AJ 100, 32) (https://ui.adsabs.harvard.edu/abs/1990AJ....100...32B)\n\n    .. [2] https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/biwloc.htm\n\n    Examples\n    --------\n    Generate random variates from a Gaussian distribution and return the\n    biweight location of the distribution:\n\n    >>> import numpy as np\n    >>> from astropy.stats import biweight_location\n    >>> rand = np.random.default_rng(12345)\n    >>> biloc = biweight_location(rand.standard_normal(1000))\n    >>> print(biloc)    # doctest: +FLOAT_CMP\n    0.01535330525461019\n    \"\"\"\n\n    median_func, sum_func = _stat_functions(data, ignore_nan=ignore_nan)\n\n    if isinstance(data, np.ma.MaskedArray) and ignore_nan:\n        data = np.ma.masked_where(np.isnan(data), data, copy=True)\n\n    data = np.asanyarray(data).astype(np.float64)\n\n    if M is None:\n        M = median_func(data, axis=axis)\n    if axis is not None:\n        M = _expand_dims(M, axis=axis)  # NUMPY_LT_1_18\n\n    # set up the differences\n    d = data - M\n\n    # set up the weighting\n    mad = median_absolute_deviation(data, axis=axis, ignore_nan=ignore_nan)\n\n    # mad = 0 means data is constant or mostly constant\n    # mad = np.nan means data contains NaNs and ignore_nan=False\n    if axis is None and (mad == 0. or np.isnan(mad)):\n        return M\n\n    if axis is not None:\n        mad = _expand_dims(mad, axis=axis)  # NUMPY_LT_1_18\n\n    with np.errstate(divide='ignore', invalid='ignore'):\n        u = d / (c * mad)\n\n    # now remove the outlier points\n    # ignore RuntimeWarnings for comparisons with NaN data values\n    with np.errstate(invalid='ignore'):\n        mask = np.abs(u) >= 1\n    u = (1 - u ** 2) ** 2\n    u[mask] = 0\n\n    # If mad == 0 along the specified ``axis`` in the input data, return\n    # the median value along that axis.\n    # Ignore RuntimeWarnings for divide by zero\n    with np.errstate(divide='ignore', invalid='ignore'):\n        value = M.squeeze() + (sum_func(d * u, axis=axis) /\n                               sum_func(u, axis=axis))\n        if np.isscalar(value):\n            return value\n\n        where_func = np.where\n        if isinstance(data, np.ma.MaskedArray):\n            where_func = np.ma.where  # return MaskedArray\n        return where_func(mad.squeeze() == 0, M.squeeze(), value)\n\n\ndef biweight_scale(data, c=9.0, M=None, axis=None, modify_sample_size=False,\n                   *, ignore_nan=False):\n    r\"\"\"\n    Compute the biweight scale.\n\n    The biweight scale is a robust statistic for determining the\n    standard deviation of a distribution.  It is the square root of the\n    `biweight midvariance\n    <https://en.wikipedia.org/wiki/Robust_measures_of_scale#The_biweight_midvariance>`_.\n    It is given by:\n\n    .. math::\n\n        \\zeta_{biscl} = \\sqrt{n} \\ \\frac{\\sqrt{\\sum_{|u_i| < 1} \\\n            (x_i - M)^2 (1 - u_i^2)^4}} {|(\\sum_{|u_i| < 1} \\\n            (1 - u_i^2) (1 - 5u_i^2))|}\n\n    where :math:`x` is the input data, :math:`M` is the sample median\n    (or the input location) and :math:`u_i` is given by:\n\n    .. math::\n\n        u_{i} = \\frac{(x_i - M)}{c * MAD}\n\n    where :math:`c` is the tuning constant and :math:`MAD` is the\n    `median absolute deviation\n    <https://en.wikipedia.org/wiki/Median_absolute_deviation>`_.  The\n    biweight midvariance tuning constant ``c`` is typically 9.0 (the\n    default).\n\n    If :math:`MAD` is zero, then zero will be returned.\n\n    For the standard definition of biweight scale, :math:`n` is the\n    total number of points in the array (or along the input ``axis``, if\n    specified).  That definition is used if ``modify_sample_size`` is\n    `False`, which is the default.\n\n    However, if ``modify_sample_size = True``, then :math:`n` is the\n    number of points for which :math:`|u_i| < 1` (i.e. the total number\n    of non-rejected values), i.e.\n\n    .. math::\n\n        n = \\sum_{|u_i| < 1} \\ 1\n\n    which results in a value closer to the true standard deviation for\n    small sample sizes or for a large number of rejected values.\n\n    Parameters\n    ----------\n    data : array-like\n        Input array or object that can be converted to an array.\n        ``data`` can be a `~numpy.ma.MaskedArray`.\n    c : float, optional\n        Tuning constant for the biweight estimator (default = 9.0).\n    M : float or array-like, optional\n        The location estimate.  If ``M`` is a scalar value, then its\n        value will be used for the entire array (or along each ``axis``,\n        if specified).  If ``M`` is an array, then its must be an array\n        containing the location estimate along each ``axis`` of the\n        input array.  If `None` (default), then the median of the input\n        array will be used (or along each ``axis``, if specified).\n    axis : None, int, or tuple of int, optional\n        The axis or axes along which the biweight scales are computed.\n        If `None` (default), then the biweight scale of the flattened\n        input array will be computed.\n    modify_sample_size : bool, optional\n        If `False` (default), then the sample size used is the total\n        number of elements in the array (or along the input ``axis``, if\n        specified), which follows the standard definition of biweight\n        scale.  If `True`, then the sample size is reduced to correct\n        for any rejected values (i.e. the sample size used includes only\n        the non-rejected values), which results in a value closer to the\n        true standard deviation for small sample sizes or for a large\n        number of rejected values.\n    ignore_nan : bool, optional\n        Whether to ignore NaN values in the input ``data``.\n\n    Returns\n    -------\n    biweight_scale : float or `~numpy.ndarray`\n        The biweight scale of the input data.  If ``axis`` is `None`\n        then a scalar will be returned, otherwise a `~numpy.ndarray`\n        will be returned.\n\n    See Also\n    --------\n    biweight_midvariance, biweight_midcovariance, biweight_location, astropy.stats.mad_std, astropy.stats.median_absolute_deviation\n\n    References\n    ----------\n    .. [1] Beers, Flynn, and Gebhardt (1990; AJ 100, 32) (https://ui.adsabs.harvard.edu/abs/1990AJ....100...32B)\n\n    .. [2] https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/biwscale.htm\n\n    Examples\n    --------\n    Generate random variates from a Gaussian distribution and return the\n    biweight scale of the distribution:\n\n    >>> import numpy as np\n    >>> from astropy.stats import biweight_scale\n    >>> rand = np.random.default_rng(12345)\n    >>> biscl = biweight_scale(rand.standard_normal(1000))\n    >>> print(biscl)    # doctest: +FLOAT_CMP\n    1.0239311812635818\n    \"\"\"\n\n    return np.sqrt(\n        biweight_midvariance(data, c=c, M=M, axis=axis,\n                             modify_sample_size=modify_sample_size,\n                             ignore_nan=ignore_nan))\n\n\ndef biweight_midvariance(data, c=9.0, M=None, axis=None,\n                         modify_sample_size=False, *, ignore_nan=False):\n    r\"\"\"\n    Compute the biweight midvariance.\n\n    The biweight midvariance is a robust statistic for determining the\n    variance of a distribution.  Its square root is a robust estimator\n    of scale (i.e. standard deviation).  It is given by:\n\n    .. math::\n\n        \\zeta_{bivar} = n \\ \\frac{\\sum_{|u_i| < 1} \\\n            (x_i - M)^2 (1 - u_i^2)^4} {(\\sum_{|u_i| < 1} \\\n            (1 - u_i^2) (1 - 5u_i^2))^2}\n\n    where :math:`x` is the input data, :math:`M` is the sample median\n    (or the input location) and :math:`u_i` is given by:\n\n    .. math::\n\n        u_{i} = \\frac{(x_i - M)}{c * MAD}\n\n    where :math:`c` is the tuning constant and :math:`MAD` is the\n    `median absolute deviation\n    <https://en.wikipedia.org/wiki/Median_absolute_deviation>`_.  The\n    biweight midvariance tuning constant ``c`` is typically 9.0 (the\n    default).\n\n    If :math:`MAD` is zero, then zero will be returned.\n\n    For the standard definition of `biweight midvariance\n    <https://en.wikipedia.org/wiki/Robust_measures_of_scale#The_biweight_midvariance>`_,\n    :math:`n` is the total number of points in the array (or along the\n    input ``axis``, if specified).  That definition is used if\n    ``modify_sample_size`` is `False`, which is the default.\n\n    However, if ``modify_sample_size = True``, then :math:`n` is the\n    number of points for which :math:`|u_i| < 1` (i.e. the total number\n    of non-rejected values), i.e.\n\n    .. math::\n\n        n = \\sum_{|u_i| < 1} \\ 1\n\n    which results in a value closer to the true variance for small\n    sample sizes or for a large number of rejected values.\n\n    Parameters\n    ----------\n    data : array-like\n        Input array or object that can be converted to an array.\n        ``data`` can be a `~numpy.ma.MaskedArray`.\n    c : float, optional\n        Tuning constant for the biweight estimator (default = 9.0).\n    M : float or array-like, optional\n        The location estimate.  If ``M`` is a scalar value, then its\n        value will be used for the entire array (or along each ``axis``,\n        if specified).  If ``M`` is an array, then its must be an array\n        containing the location estimate along each ``axis`` of the\n        input array.  If `None` (default), then the median of the input\n        array will be used (or along each ``axis``, if specified).\n    axis : None, int, or tuple of int, optional\n        The axis or axes along which the biweight midvariances are\n        computed.  If `None` (default), then the biweight midvariance of\n        the flattened input array will be computed.\n    modify_sample_size : bool, optional\n        If `False` (default), then the sample size used is the total\n        number of elements in the array (or along the input ``axis``, if\n        specified), which follows the standard definition of biweight\n        midvariance.  If `True`, then the sample size is reduced to\n        correct for any rejected values (i.e. the sample size used\n        includes only the non-rejected values), which results in a value\n        closer to the true variance for small sample sizes or for a\n        large number of rejected values.\n    ignore_nan : bool, optional\n        Whether to ignore NaN values in the input ``data``.\n\n    Returns\n    -------\n    biweight_midvariance : float or `~numpy.ndarray`\n        The biweight midvariance of the input data.  If ``axis`` is\n        `None` then a scalar will be returned, otherwise a\n        `~numpy.ndarray` will be returned.\n\n    See Also\n    --------\n    biweight_midcovariance, biweight_midcorrelation, astropy.stats.mad_std, astropy.stats.median_absolute_deviation\n\n    References\n    ----------\n    .. [1] https://en.wikipedia.org/wiki/Robust_measures_of_scale#The_biweight_midvariance\n\n    .. [2] Beers, Flynn, and Gebhardt (1990; AJ 100, 32) (https://ui.adsabs.harvard.edu/abs/1990AJ....100...32B)\n\n    Examples\n    --------\n    Generate random variates from a Gaussian distribution and return the\n    biweight midvariance of the distribution:\n\n    >>> import numpy as np\n    >>> from astropy.stats import biweight_midvariance\n    >>> rand = np.random.default_rng(12345)\n    >>> bivar = biweight_midvariance(rand.standard_normal(1000))\n    >>> print(bivar)    # doctest: +FLOAT_CMP\n    1.0484350639638342\n    \"\"\"\n    median_func, sum_func = _stat_functions(data, ignore_nan=ignore_nan)\n\n    if isinstance(data, np.ma.MaskedArray) and ignore_nan:\n        data = np.ma.masked_where(np.isnan(data), data, copy=True)\n\n    data = np.asanyarray(data).astype(np.float64)\n\n    if M is None:\n        M = median_func(data, axis=axis)\n    if axis is not None:\n        M = _expand_dims(M, axis=axis)  # NUMPY_LT_1_18\n\n    # set up the differences\n    d = data - M\n\n    # set up the weighting\n    mad = median_absolute_deviation(data, axis=axis, ignore_nan=ignore_nan)\n\n    if axis is None:\n        # data is constant or mostly constant OR\n        # data contains NaNs and ignore_nan=False\n        if mad == 0. or np.isnan(mad):\n            return mad ** 2  # variance units\n    else:\n        mad = _expand_dims(mad, axis=axis)  # NUMPY_LT_1_18\n\n    with np.errstate(divide='ignore', invalid='ignore'):\n        u = d / (c * mad)\n\n    # now remove the outlier points\n    # ignore RuntimeWarnings for comparisons with NaN data values\n    with np.errstate(invalid='ignore'):\n        mask = np.abs(u) < 1\n    if isinstance(mask, np.ma.MaskedArray):\n        mask = mask.filled(fill_value=False)  # exclude masked data values\n\n    u = u ** 2\n\n    if modify_sample_size:\n        n = sum_func(mask, axis=axis)\n    else:\n        # set good values to 1, bad values to 0\n        include_mask = np.ones(data.shape)\n        if isinstance(data, np.ma.MaskedArray):\n            include_mask[data.mask] = 0\n        if ignore_nan:\n            include_mask[np.isnan(data)] = 0\n        n = np.sum(include_mask, axis=axis)\n\n    f1 = d * d * (1. - u)**4\n    f1[~mask] = 0.\n    f1 = sum_func(f1, axis=axis)\n    f2 = (1. - u) * (1. - 5.*u)\n    f2[~mask] = 0.\n    f2 = np.abs(np.sum(f2, axis=axis))**2\n\n    # If mad == 0 along the specified ``axis`` in the input data, return\n    # 0.0 along that axis.\n    # Ignore RuntimeWarnings for divide by zero.\n    with np.errstate(divide='ignore', invalid='ignore'):\n        value = n * f1 / f2\n        if np.isscalar(value):\n            return value\n\n        where_func = np.where\n        if isinstance(data, np.ma.MaskedArray):\n            where_func = np.ma.where  # return MaskedArray\n        return where_func(mad.squeeze() == 0, 0., value)\n\n\ndef biweight_midcovariance(data, c=9.0, M=None, modify_sample_size=False):\n    r\"\"\"\n    Compute the biweight midcovariance between pairs of multiple\n    variables.\n\n    The biweight midcovariance is a robust and resistant estimator of\n    the covariance between two variables.\n\n    This function computes the biweight midcovariance between all pairs\n    of the input variables (rows) in the input data.  The output array\n    will have a shape of (N_variables, N_variables).  The diagonal\n    elements will be the biweight midvariances of each input variable\n    (see :func:`biweight_midvariance`).  The off-diagonal elements will\n    be the biweight midcovariances between each pair of input variables.\n\n    For example, if the input array ``data`` contains three variables\n    (rows) ``x``, ``y``, and ``z``, the output `~numpy.ndarray`\n    midcovariance matrix will be:\n\n    .. math::\n\n         \\begin{pmatrix}\n         \\zeta_{xx}  & \\zeta_{xy}  & \\zeta_{xz} \\\\\n         \\zeta_{yx}  & \\zeta_{yy}  & \\zeta_{yz} \\\\\n         \\zeta_{zx}  & \\zeta_{zy}  & \\zeta_{zz}\n         \\end{pmatrix}\n\n    where :math:`\\zeta_{xx}`, :math:`\\zeta_{yy}`, and :math:`\\zeta_{zz}`\n    are the biweight midvariances of each variable.  The biweight\n    midcovariance between :math:`x` and :math:`y` is :math:`\\zeta_{xy}`\n    (:math:`= \\zeta_{yx}`).  The biweight midcovariance between\n    :math:`x` and :math:`z` is :math:`\\zeta_{xz}` (:math:`=\n    \\zeta_{zx}`).  The biweight midcovariance between :math:`y` and\n    :math:`z` is :math:`\\zeta_{yz}` (:math:`= \\zeta_{zy}`).\n\n    The biweight midcovariance between two variables :math:`x` and\n    :math:`y` is given by:\n\n    .. math::\n\n        \\zeta_{xy} = n_{xy} \\ \\frac{\\sum_{|u_i| < 1, \\ |v_i| < 1} \\\n            (x_i - M_x) (1 - u_i^2)^2 (y_i - M_y) (1 - v_i^2)^2}\n            {(\\sum_{|u_i| < 1} \\ (1 - u_i^2) (1 - 5u_i^2))\n            (\\sum_{|v_i| < 1} \\ (1 - v_i^2) (1 - 5v_i^2))}\n\n    where :math:`M_x` and :math:`M_y` are the medians (or the input\n    locations) of the two variables and :math:`u_i` and :math:`v_i` are\n    given by:\n\n    .. math::\n\n        u_{i} = \\frac{(x_i - M_x)}{c * MAD_x}\n\n        v_{i} = \\frac{(y_i - M_y)}{c * MAD_y}\n\n    where :math:`c` is the biweight tuning constant and :math:`MAD_x`\n    and :math:`MAD_y` are the `median absolute deviation\n    <https://en.wikipedia.org/wiki/Median_absolute_deviation>`_ of the\n    :math:`x` and :math:`y` variables.  The biweight midvariance tuning\n    constant ``c`` is typically 9.0 (the default).\n\n    If :math:`MAD_x` or :math:`MAD_y` are zero, then zero will be\n    returned for that element.\n\n    For the standard definition of biweight midcovariance,\n    :math:`n_{xy}` is the total number of observations of each variable.\n    That definition is used if ``modify_sample_size`` is `False`, which\n    is the default.\n\n    However, if ``modify_sample_size = True``, then :math:`n_{xy}` is the\n    number of observations for which :math:`|u_i| < 1` and/or :math:`|v_i|\n    < 1`, i.e.\n\n    .. math::\n\n        n_{xx} = \\sum_{|u_i| < 1} \\ 1\n\n    .. math::\n\n        n_{xy} = n_{yx} = \\sum_{|u_i| < 1, \\ |v_i| < 1} \\ 1\n\n    .. math::\n\n        n_{yy} = \\sum_{|v_i| < 1} \\ 1\n\n    which results in a value closer to the true variance for small\n    sample sizes or for a large number of rejected values.\n\n    Parameters\n    ----------\n    data : 2D or 1D array-like\n        Input data either as a 2D or 1D array.  For a 2D array, it\n        should have a shape (N_variables, N_observations).  A 1D array\n        may be input for observations of a single variable, in which\n        case the biweight midvariance will be calculated (no\n        covariance).  Each row of ``data`` represents a variable, and\n        each column a single observation of all those variables (same as\n        the `numpy.cov` convention).\n\n    c : float, optional\n        Tuning constant for the biweight estimator (default = 9.0).\n\n    M : float or 1D array-like, optional\n        The location estimate of each variable, either as a scalar or\n        array.  If ``M`` is an array, then its must be a 1D array\n        containing the location estimate of each row (i.e. ``a.ndim``\n        elements).  If ``M`` is a scalar value, then its value will be\n        used for each variable (row).  If `None` (default), then the\n        median of each variable (row) will be used.\n\n    modify_sample_size : bool, optional\n        If `False` (default), then the sample size used is the total\n        number of observations of each variable, which follows the\n        standard definition of biweight midcovariance.  If `True`, then\n        the sample size is reduced to correct for any rejected values\n        (see formula above), which results in a value closer to the true\n        covariance for small sample sizes or for a large number of\n        rejected values.\n\n    Returns\n    -------\n    biweight_midcovariance : ndarray\n        A 2D array representing the biweight midcovariances between each\n        pair of the variables (rows) in the input array.  The output\n        array will have a shape of (N_variables, N_variables).  The\n        diagonal elements will be the biweight midvariances of each\n        input variable.  The off-diagonal elements will be the biweight\n        midcovariances between each pair of input variables.\n\n    See Also\n    --------\n    biweight_midvariance, biweight_midcorrelation, biweight_scale, biweight_location\n\n    References\n    ----------\n    .. [1] https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/biwmidc.htm\n\n    Examples\n    --------\n    Compute the biweight midcovariance between two random variables:\n\n    >>> import numpy as np\n    >>> from astropy.stats import biweight_midcovariance\n    >>> # Generate two random variables x and y\n    >>> rng = np.random.default_rng(1)\n    >>> x = rng.normal(0, 1, 200)\n    >>> y = rng.normal(0, 3, 200)\n    >>> # Introduce an obvious outlier\n    >>> x[0] = 30.0\n    >>> # Calculate the biweight midcovariances between x and y\n    >>> bicov = biweight_midcovariance([x, y])\n    >>> print(bicov)  # doctest: +FLOAT_CMP\n    [[0.83435568 0.02379316]\n     [0.02379316 7.15665769]]\n    >>> # Print standard deviation estimates\n    >>> print(np.sqrt(bicov.diagonal()))  # doctest: +FLOAT_CMP\n    [0.91343072 2.67519302]\n    \"\"\"\n\n    data = np.asanyarray(data).astype(np.float64)\n\n    # ensure data is 2D\n    if data.ndim == 1:\n        data = data[np.newaxis, :]\n    if data.ndim != 2:\n        raise ValueError('The input array must be 2D or 1D.')\n\n    # estimate location if not given\n    if M is None:\n        M = np.median(data, axis=1)\n    M = np.asanyarray(M)\n    if M.ndim > 1:\n        raise ValueError('M must be a scalar or 1D array.')\n\n    # set up the differences\n    d = (data.T - M).T\n\n    # set up the weighting\n    mad = median_absolute_deviation(data, axis=1)\n\n    with np.errstate(divide='ignore', invalid='ignore'):\n        u = (d.T / (c * mad)).T\n\n    # now remove the outlier points\n    # ignore RuntimeWarnings for comparisons with NaN data values\n    with np.errstate(invalid='ignore'):\n        mask = np.abs(u) < 1\n    u = u ** 2\n\n    if modify_sample_size:\n        maskf = mask.astype(float)\n        n = np.inner(maskf, maskf)\n    else:\n        n = data[0].size\n\n    usub1 = (1. - u)\n    usub5 = (1. - 5. * u)\n    usub1[~mask] = 0.\n\n    with np.errstate(divide='ignore', invalid='ignore'):\n        numerator = d * usub1 ** 2\n        denominator = (usub1 * usub5).sum(axis=1)[:, np.newaxis]\n        numerator_matrix = np.dot(numerator, numerator.T)\n        denominator_matrix = np.dot(denominator, denominator.T)\n\n        value = n * (numerator_matrix / denominator_matrix)\n        idx = np.where(mad == 0)[0]\n        value[idx, :] = 0\n        value[:, idx] = 0\n        return value\n\n\ndef biweight_midcorrelation(x, y, c=9.0, M=None, modify_sample_size=False):\n    r\"\"\"\n    Compute the biweight midcorrelation between two variables.\n\n    The `biweight midcorrelation\n    <https://en.wikipedia.org/wiki/Biweight_midcorrelation>`_ is a\n    measure of similarity between samples.  It is given by:\n\n    .. math::\n\n        r_{bicorr} = \\frac{\\zeta_{xy}}{\\sqrt{\\zeta_{xx} \\ \\zeta_{yy}}}\n\n    where :math:`\\zeta_{xx}` is the biweight midvariance of :math:`x`,\n    :math:`\\zeta_{yy}` is the biweight midvariance of :math:`y`, and\n    :math:`\\zeta_{xy}` is the biweight midcovariance of :math:`x` and\n    :math:`y`.\n\n    Parameters\n    ----------\n    x, y : 1D array-like\n        Input arrays for the two variables.  ``x`` and ``y`` must be 1D\n        arrays and have the same number of elements.\n    c : float, optional\n        Tuning constant for the biweight estimator (default = 9.0).  See\n        `biweight_midcovariance` for more details.\n    M : float or array-like, optional\n        The location estimate.  If ``M`` is a scalar value, then its\n        value will be used for the entire array (or along each ``axis``,\n        if specified).  If ``M`` is an array, then its must be an array\n        containing the location estimate along each ``axis`` of the\n        input array.  If `None` (default), then the median of the input\n        array will be used (or along each ``axis``, if specified).  See\n        `biweight_midcovariance` for more details.\n    modify_sample_size : bool, optional\n        If `False` (default), then the sample size used is the total\n        number of elements in the array (or along the input ``axis``, if\n        specified), which follows the standard definition of biweight\n        midcovariance.  If `True`, then the sample size is reduced to\n        correct for any rejected values (i.e. the sample size used\n        includes only the non-rejected values), which results in a value\n        closer to the true midcovariance for small sample sizes or for a\n        large number of rejected values.  See `biweight_midcovariance`\n        for more details.\n\n    Returns\n    -------\n    biweight_midcorrelation : float\n        The biweight midcorrelation between ``x`` and ``y``.\n\n    See Also\n    --------\n    biweight_scale, biweight_midvariance, biweight_midcovariance, biweight_location\n\n    References\n    ----------\n    .. [1] https://en.wikipedia.org/wiki/Biweight_midcorrelation\n\n    Examples\n    --------\n    Calculate the biweight midcorrelation between two variables:\n\n    >>> import numpy as np\n    >>> from astropy.stats import biweight_midcorrelation\n    >>> rng = np.random.default_rng(12345)\n    >>> x = rng.normal(0, 1, 200)\n    >>> y = rng.normal(0, 3, 200)\n    >>> # Introduce an obvious outlier\n    >>> x[0] = 30.0\n    >>> bicorr = biweight_midcorrelation(x, y)\n    >>> print(bicorr)  # doctest: +FLOAT_CMP\n    -0.09203238319481295\n    \"\"\"\n\n    x = np.asanyarray(x)\n    y = np.asanyarray(y)\n    if x.ndim != 1:\n        raise ValueError('x must be a 1D array.')\n    if y.ndim != 1:\n        raise ValueError('y must be a 1D array.')\n    if x.shape != y.shape:\n        raise ValueError('x and y must have the same shape.')\n\n    bicorr = biweight_midcovariance([x, y], c=c, M=M,\n                                    modify_sample_size=modify_sample_size)\n\n    return bicorr[0, 1] / (np.sqrt(bicorr[0, 0] * bicorr[1, 1]))\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":65,"id":8632,"name":"x_min","nodeType":"Attribute","startLoc":65,"text":"self.x_min"},{"col":0,"comment":"null","endLoc":26,"header":"def _stat_functions(data, ignore_nan=False)","id":8633,"name":"_stat_functions","nodeType":"Function","startLoc":15,"text":"def _stat_functions(data, ignore_nan=False):\n    if isinstance(data, np.ma.MaskedArray):\n        median_func = np.ma.median\n        sum_func = np.ma.sum\n    elif ignore_nan:\n        median_func = np.nanmedian\n        sum_func = np.nansum\n    else:\n        median_func = np.median\n        sum_func = np.sum\n\n    return median_func, sum_func"},{"attributeType":"null","col":12,"comment":"null","endLoc":86,"id":8634,"name":"_y_max","nodeType":"Attribute","startLoc":86,"text":"self._y_max"},{"col":0,"comment":"\n    Compute the biweight location.\n\n    The biweight location is a robust statistic for determining the\n    central location of a distribution.  It is given by:\n\n    .. math::\n\n        \\zeta_{biloc}= M + \\frac{\\sum_{|u_i|<1} \\ (x_i - M) (1 - u_i^2)^2}\n            {\\sum_{|u_i|<1} \\ (1 - u_i^2)^2}\n\n    where :math:`x` is the input data, :math:`M` is the sample median\n    (or the input initial location guess) and :math:`u_i` is given by:\n\n    .. math::\n\n        u_{i} = \\frac{(x_i - M)}{c * MAD}\n\n    where :math:`c` is the tuning constant and :math:`MAD` is the\n    `median absolute deviation\n    <https://en.wikipedia.org/wiki/Median_absolute_deviation>`_.  The\n    biweight location tuning constant ``c`` is typically 6.0 (the\n    default).\n\n    If :math:`MAD` is zero, then the median will be returned.\n\n    Parameters\n    ----------\n    data : array-like\n        Input array or object that can be converted to an array.\n        ``data`` can be a `~numpy.ma.MaskedArray`.\n    c : float, optional\n        Tuning constant for the biweight estimator (default = 6.0).\n    M : float or array-like, optional\n        Initial guess for the location.  If ``M`` is a scalar value,\n        then its value will be used for the entire array (or along each\n        ``axis``, if specified).  If ``M`` is an array, then its must be\n        an array containing the initial location estimate along each\n        ``axis`` of the input array.  If `None` (default), then the\n        median of the input array will be used (or along each ``axis``,\n        if specified).\n    axis : None, int, or tuple of int, optional\n        The axis or axes along which the biweight locations are\n        computed.  If `None` (default), then the biweight location of\n        the flattened input array will be computed.\n    ignore_nan : bool, optional\n        Whether to ignore NaN values in the input ``data``.\n\n    Returns\n    -------\n    biweight_location : float or `~numpy.ndarray`\n        The biweight location of the input data.  If ``axis`` is `None`\n        then a scalar will be returned, otherwise a `~numpy.ndarray`\n        will be returned.\n\n    See Also\n    --------\n    biweight_scale, biweight_midvariance, biweight_midcovariance\n\n    References\n    ----------\n    .. [1] Beers, Flynn, and Gebhardt (1990; AJ 100, 32) (https://ui.adsabs.harvard.edu/abs/1990AJ....100...32B)\n\n    .. [2] https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/biwloc.htm\n\n    Examples\n    --------\n    Generate random variates from a Gaussian distribution and return the\n    biweight location of the distribution:\n\n    >>> import numpy as np\n    >>> from astropy.stats import biweight_location\n    >>> rand = np.random.default_rng(12345)\n    >>> biloc = biweight_location(rand.standard_normal(1000))\n    >>> print(biloc)    # doctest: +FLOAT_CMP\n    0.01535330525461019\n    ","endLoc":156,"header":"def biweight_location(data, c=6.0, M=None, axis=None, *, ignore_nan=False)","id":8635,"name":"biweight_location","nodeType":"Function","startLoc":29,"text":"def biweight_location(data, c=6.0, M=None, axis=None, *, ignore_nan=False):\n    r\"\"\"\n    Compute the biweight location.\n\n    The biweight location is a robust statistic for determining the\n    central location of a distribution.  It is given by:\n\n    .. math::\n\n        \\zeta_{biloc}= M + \\frac{\\sum_{|u_i|<1} \\ (x_i - M) (1 - u_i^2)^2}\n            {\\sum_{|u_i|<1} \\ (1 - u_i^2)^2}\n\n    where :math:`x` is the input data, :math:`M` is the sample median\n    (or the input initial location guess) and :math:`u_i` is given by:\n\n    .. math::\n\n        u_{i} = \\frac{(x_i - M)}{c * MAD}\n\n    where :math:`c` is the tuning constant and :math:`MAD` is the\n    `median absolute deviation\n    <https://en.wikipedia.org/wiki/Median_absolute_deviation>`_.  The\n    biweight location tuning constant ``c`` is typically 6.0 (the\n    default).\n\n    If :math:`MAD` is zero, then the median will be returned.\n\n    Parameters\n    ----------\n    data : array-like\n        Input array or object that can be converted to an array.\n        ``data`` can be a `~numpy.ma.MaskedArray`.\n    c : float, optional\n        Tuning constant for the biweight estimator (default = 6.0).\n    M : float or array-like, optional\n        Initial guess for the location.  If ``M`` is a scalar value,\n        then its value will be used for the entire array (or along each\n        ``axis``, if specified).  If ``M`` is an array, then its must be\n        an array containing the initial location estimate along each\n        ``axis`` of the input array.  If `None` (default), then the\n        median of the input array will be used (or along each ``axis``,\n        if specified).\n    axis : None, int, or tuple of int, optional\n        The axis or axes along which the biweight locations are\n        computed.  If `None` (default), then the biweight location of\n        the flattened input array will be computed.\n    ignore_nan : bool, optional\n        Whether to ignore NaN values in the input ``data``.\n\n    Returns\n    -------\n    biweight_location : float or `~numpy.ndarray`\n        The biweight location of the input data.  If ``axis`` is `None`\n        then a scalar will be returned, otherwise a `~numpy.ndarray`\n        will be returned.\n\n    See Also\n    --------\n    biweight_scale, biweight_midvariance, biweight_midcovariance\n\n    References\n    ----------\n    .. [1] Beers, Flynn, and Gebhardt (1990; AJ 100, 32) (https://ui.adsabs.harvard.edu/abs/1990AJ....100...32B)\n\n    .. [2] https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/biwloc.htm\n\n    Examples\n    --------\n    Generate random variates from a Gaussian distribution and return the\n    biweight location of the distribution:\n\n    >>> import numpy as np\n    >>> from astropy.stats import biweight_location\n    >>> rand = np.random.default_rng(12345)\n    >>> biloc = biweight_location(rand.standard_normal(1000))\n    >>> print(biloc)    # doctest: +FLOAT_CMP\n    0.01535330525461019\n    \"\"\"\n\n    median_func, sum_func = _stat_functions(data, ignore_nan=ignore_nan)\n\n    if isinstance(data, np.ma.MaskedArray) and ignore_nan:\n        data = np.ma.masked_where(np.isnan(data), data, copy=True)\n\n    data = np.asanyarray(data).astype(np.float64)\n\n    if M is None:\n        M = median_func(data, axis=axis)\n    if axis is not None:\n        M = _expand_dims(M, axis=axis)  # NUMPY_LT_1_18\n\n    # set up the differences\n    d = data - M\n\n    # set up the weighting\n    mad = median_absolute_deviation(data, axis=axis, ignore_nan=ignore_nan)\n\n    # mad = 0 means data is constant or mostly constant\n    # mad = np.nan means data contains NaNs and ignore_nan=False\n    if axis is None and (mad == 0. or np.isnan(mad)):\n        return M\n\n    if axis is not None:\n        mad = _expand_dims(mad, axis=axis)  # NUMPY_LT_1_18\n\n    with np.errstate(divide='ignore', invalid='ignore'):\n        u = d / (c * mad)\n\n    # now remove the outlier points\n    # ignore RuntimeWarnings for comparisons with NaN data values\n    with np.errstate(invalid='ignore'):\n        mask = np.abs(u) >= 1\n    u = (1 - u ** 2) ** 2\n    u[mask] = 0\n\n    # If mad == 0 along the specified ``axis`` in the input data, return\n    # the median value along that axis.\n    # Ignore RuntimeWarnings for divide by zero\n    with np.errstate(divide='ignore', invalid='ignore'):\n        value = M.squeeze() + (sum_func(d * u, axis=axis) /\n                               sum_func(u, axis=axis))\n        if np.isscalar(value):\n            return value\n\n        where_func = np.where\n        if isinstance(data, np.ma.MaskedArray):\n            where_func = np.ma.where  # return MaskedArray\n        return where_func(mad.squeeze() == 0, M.squeeze(), value)"},{"attributeType":"null","col":12,"comment":"null","endLoc":110,"id":8636,"name":"_y_min","nodeType":"Attribute","startLoc":110,"text":"self._y_min"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":8637,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"spatial.py#<anonymous>","id":8638,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module implements functions and classes for spatial statistics.\n\"\"\"\n\n__all__ = ['RipleysKEstimator']"},{"attributeType":"null","col":8,"comment":"null","endLoc":1202,"id":8639,"name":"_dst","nodeType":"Attribute","startLoc":1202,"text":"self._dst"},{"attributeType":"null","col":8,"comment":"null","endLoc":1201,"id":8640,"name":"_tzname","nodeType":"Attribute","startLoc":1201,"text":"self._tzname"},{"col":0,"comment":"Compute the Kuiper statistic.\n\n    Use the Kuiper statistic version of the Kolmogorov-Smirnov test to\n    find the probability that a sample like ``data`` was drawn from the\n    distribution whose CDF is given as ``cdf``.\n\n    .. warning::\n        This will not work correctly for distributions that are actually\n        discrete (Poisson, for example).\n\n    Parameters\n    ----------\n    data : array-like\n        The data values.\n    cdf : callable\n        A callable to evaluate the CDF of the distribution being tested\n        against. Will be called with a vector of all values at once.\n        The default is a uniform distribution.\n    args : list-like, optional\n        Additional arguments to be supplied to cdf.\n\n    Returns\n    -------\n    D : float\n        The raw statistic.\n    fpp : float\n        The probability of a D this large arising with a sample drawn from\n        the distribution whose CDF is cdf.\n\n    Notes\n    -----\n    The Kuiper statistic resembles the Kolmogorov-Smirnov test in that\n    it is nonparametric and invariant under reparameterizations of the data.\n    The Kuiper statistic, in addition, is equally sensitive throughout\n    the domain, and it is also invariant under cyclic permutations (making\n    it particularly appropriate for analyzing circular data).\n\n    Returns (D, fpp), where D is the Kuiper D number and fpp is the\n    probability that a value as large as D would occur if data was\n    drawn from cdf.\n\n    .. warning::\n        The fpp is calculated only approximately, and it can be\n        as much as 1.5 times the true value.\n\n    Stephens 1970 claims this is more effective than the KS at detecting\n    changes in the variance of a distribution; the KS is (he claims) more\n    sensitive at detecting changes in the mean.\n\n    If cdf was obtained from data by fitting, then fpp is not correct and\n    it will be necessary to do Monte Carlo simulations to interpret D.\n    D should normally be independent of the shape of CDF.\n\n    References\n    ----------\n\n    .. [1] Stephens, M. A., \"Use of the Kolmogorov-Smirnov, Cramer-Von Mises\n           and Related Statistics Without Extensive Tables\", Journal of the\n           Royal Statistical Society. Series B (Methodological), Vol. 32,\n           No. 1. (1970), pp. 115-122.\n\n\n    ","endLoc":1454,"header":"def kuiper(data, cdf=lambda x: x, args=())","id":8641,"name":"kuiper","nodeType":"Function","startLoc":1383,"text":"def kuiper(data, cdf=lambda x: x, args=()):\n    \"\"\"Compute the Kuiper statistic.\n\n    Use the Kuiper statistic version of the Kolmogorov-Smirnov test to\n    find the probability that a sample like ``data`` was drawn from the\n    distribution whose CDF is given as ``cdf``.\n\n    .. warning::\n        This will not work correctly for distributions that are actually\n        discrete (Poisson, for example).\n\n    Parameters\n    ----------\n    data : array-like\n        The data values.\n    cdf : callable\n        A callable to evaluate the CDF of the distribution being tested\n        against. Will be called with a vector of all values at once.\n        The default is a uniform distribution.\n    args : list-like, optional\n        Additional arguments to be supplied to cdf.\n\n    Returns\n    -------\n    D : float\n        The raw statistic.\n    fpp : float\n        The probability of a D this large arising with a sample drawn from\n        the distribution whose CDF is cdf.\n\n    Notes\n    -----\n    The Kuiper statistic resembles the Kolmogorov-Smirnov test in that\n    it is nonparametric and invariant under reparameterizations of the data.\n    The Kuiper statistic, in addition, is equally sensitive throughout\n    the domain, and it is also invariant under cyclic permutations (making\n    it particularly appropriate for analyzing circular data).\n\n    Returns (D, fpp), where D is the Kuiper D number and fpp is the\n    probability that a value as large as D would occur if data was\n    drawn from cdf.\n\n    .. warning::\n        The fpp is calculated only approximately, and it can be\n        as much as 1.5 times the true value.\n\n    Stephens 1970 claims this is more effective than the KS at detecting\n    changes in the variance of a distribution; the KS is (he claims) more\n    sensitive at detecting changes in the mean.\n\n    If cdf was obtained from data by fitting, then fpp is not correct and\n    it will be necessary to do Monte Carlo simulations to interpret D.\n    D should normally be independent of the shape of CDF.\n\n    References\n    ----------\n\n    .. [1] Stephens, M. A., \"Use of the Kolmogorov-Smirnov, Cramer-Von Mises\n           and Related Statistics Without Extensive Tables\", Journal of the\n           Royal Statistical Society. Series B (Methodological), Vol. 32,\n           No. 1. (1970), pp. 115-122.\n\n\n    \"\"\"\n\n    data = np.sort(data)\n    cdfv = cdf(data, *args)\n    N = len(data)\n    D = (np.amax(cdfv - np.arange(N) / float(N)) +\n         np.amax((np.arange(N) + 1) / float(N) - cdfv))\n\n    return D, kuiper_false_positive_probability(D, N)"},{"col":21,"endLoc":1383,"id":8642,"nodeType":"Lambda","startLoc":1383,"text":"lambda x: x"},{"className":"TimeString","col":0,"comment":"\n    Base class for string-like time representations.\n\n    This class assumes that anything following the last decimal point to the\n    right is a fraction of a second.\n\n    **Fast C-based parser**\n\n    Time format classes can take advantage of a fast C-based parser if the times\n    are represented as fixed-format strings with year, month, day-of-month,\n    hour, minute, second, OR year, day-of-year, hour, minute, second. This can\n    be a factor of 20 or more faster than the pure Python parser.\n\n    Fixed format means that the components always have the same number of\n    characters. The Python parser will accept ``2001-9-2`` as a date, but the C\n    parser would require ``2001-09-02``.\n\n    A subclass in this case must define a class attribute ``fast_parser_pars``\n    which is a `dict` with all of the keys below. An inherited attribute is not\n    checked, only an attribute in the class ``__dict__``.\n\n    - ``delims`` (tuple of int): ASCII code for character at corresponding\n      ``starts`` position (0 => no character)\n\n    - ``starts`` (tuple of int): position where component starts (including\n      delimiter if present). Use -1 for the month component for format that use\n      day of year.\n\n    - ``stops`` (tuple of int): position where component ends. Use -1 to\n      continue to end of string, or for the month component for formats that use\n      day of year.\n\n    - ``break_allowed`` (tuple of int): if true (1) then the time string can\n          legally end just before the corresponding component (e.g. \"2000-01-01\"\n          is a valid time but \"2000-01-01 12\" is not).\n\n    - ``has_day_of_year`` (int): 0 if dates have year, month, day; 1 if year,\n      day-of-year\n    ","endLoc":1448,"id":8643,"nodeType":"Class","startLoc":1214,"text":"class TimeString(TimeUnique):\n    \"\"\"\n    Base class for string-like time representations.\n\n    This class assumes that anything following the last decimal point to the\n    right is a fraction of a second.\n\n    **Fast C-based parser**\n\n    Time format classes can take advantage of a fast C-based parser if the times\n    are represented as fixed-format strings with year, month, day-of-month,\n    hour, minute, second, OR year, day-of-year, hour, minute, second. This can\n    be a factor of 20 or more faster than the pure Python parser.\n\n    Fixed format means that the components always have the same number of\n    characters. The Python parser will accept ``2001-9-2`` as a date, but the C\n    parser would require ``2001-09-02``.\n\n    A subclass in this case must define a class attribute ``fast_parser_pars``\n    which is a `dict` with all of the keys below. An inherited attribute is not\n    checked, only an attribute in the class ``__dict__``.\n\n    - ``delims`` (tuple of int): ASCII code for character at corresponding\n      ``starts`` position (0 => no character)\n\n    - ``starts`` (tuple of int): position where component starts (including\n      delimiter if present). Use -1 for the month component for format that use\n      day of year.\n\n    - ``stops`` (tuple of int): position where component ends. Use -1 to\n      continue to end of string, or for the month component for formats that use\n      day of year.\n\n    - ``break_allowed`` (tuple of int): if true (1) then the time string can\n          legally end just before the corresponding component (e.g. \"2000-01-01\"\n          is a valid time but \"2000-01-01 12\" is not).\n\n    - ``has_day_of_year`` (int): 0 if dates have year, month, day; 1 if year,\n      day-of-year\n    \"\"\"\n\n    def __init_subclass__(cls, **kwargs):\n        if 'fast_parser_pars' in cls.__dict__:\n            fpp = cls.fast_parser_pars\n            fpp = np.array(list(zip(map(chr, fpp['delims']),\n                                    fpp['starts'],\n                                    fpp['stops'],\n                                    fpp['break_allowed'])),\n                           _parse_times.dt_pars)\n            if cls.fast_parser_pars['has_day_of_year']:\n                fpp['start'][1] = fpp['stop'][1] = -1\n            cls._fast_parser = _parse_times.create_parser(fpp)\n\n        super().__init_subclass__(**kwargs)\n\n    def _check_val_type(self, val1, val2):\n        if val1.dtype.kind not in ('S', 'U') and val1.size:\n            raise TypeError(f'Input values for {self.name} class must be strings')\n        if val2 is not None:\n            raise ValueError(\n                f'{self.name} objects do not accept a val2 but you provided {val2}')\n        return val1, None\n\n    def parse_string(self, timestr, subfmts):\n        \"\"\"Read time from a single string, using a set of possible formats.\"\"\"\n        # Datetime components required for conversion to JD by ERFA, along\n        # with the default values.\n        components = ('year', 'mon', 'mday', 'hour', 'min', 'sec')\n        defaults = (None, 1, 1, 0, 0, 0)\n        # Assume that anything following \".\" on the right side is a\n        # floating fraction of a second.\n        try:\n            idot = timestr.rindex('.')\n        except Exception:\n            fracsec = 0.0\n        else:\n            timestr, fracsec = timestr[:idot], timestr[idot:]\n            fracsec = float(fracsec)\n\n        for _, strptime_fmt_or_regex, _ in subfmts:\n            if isinstance(strptime_fmt_or_regex, str):\n                try:\n                    tm = time.strptime(timestr, strptime_fmt_or_regex)\n                except ValueError:\n                    continue\n                else:\n                    vals = [getattr(tm, 'tm_' + component)\n                            for component in components]\n\n            else:\n                tm = re.match(strptime_fmt_or_regex, timestr)\n                if tm is None:\n                    continue\n                tm = tm.groupdict()\n                vals = [int(tm.get(component, default)) for component, default\n                        in zip(components, defaults)]\n\n            # Add fractional seconds\n            vals[-1] = vals[-1] + fracsec\n            return vals\n        else:\n            raise ValueError(f'Time {timestr} does not match {self.name} format')\n\n    def set_jds(self, val1, val2):\n        \"\"\"Parse the time strings contained in val1 and set jd1, jd2\"\"\"\n        # If specific input subformat is required then use the Python parser.\n        # Also do this if Time format class does not define `use_fast_parser` or\n        # if the fast parser is entirely disabled. Note that `use_fast_parser`\n        # is ignored for format classes that don't have a fast parser.\n        if (self.in_subfmt != '*'\n                or '_fast_parser' not in self.__class__.__dict__\n                or conf.use_fast_parser == 'False'):\n            jd1, jd2 = self.get_jds_python(val1, val2)\n        else:\n            try:\n                jd1, jd2 = self.get_jds_fast(val1, val2)\n            except Exception:\n                # Fall through to the Python parser unless fast is forced.\n                if conf.use_fast_parser == 'force':\n                    raise\n                else:\n                    jd1, jd2 = self.get_jds_python(val1, val2)\n\n        self.jd1 = jd1\n        self.jd2 = jd2\n\n    def get_jds_python(self, val1, val2):\n        \"\"\"Parse the time strings contained in val1 and get jd1, jd2\"\"\"\n        # Select subformats based on current self.in_subfmt\n        subfmts = self._select_subfmts(self.in_subfmt)\n        # Be liberal in what we accept: convert bytes to ascii.\n        # Here .item() is needed for arrays with entries of unequal length,\n        # to strip trailing 0 bytes.\n        to_string = (str if val1.dtype.kind == 'U' else\n                     lambda x: str(x.item(), encoding='ascii'))\n        iterator = np.nditer([val1, None, None, None, None, None, None],\n                             flags=['zerosize_ok'],\n                             op_dtypes=[None] + 5 * [np.intc] + [np.double])\n        for val, iy, im, id, ihr, imin, dsec in iterator:\n            val = to_string(val)\n            iy[...], im[...], id[...], ihr[...], imin[...], dsec[...] = (\n                self.parse_string(val, subfmts))\n\n        jd1, jd2 = erfa.dtf2d(self.scale.upper().encode('ascii'),\n                              *iterator.operands[1:])\n        jd1, jd2 = day_frac(jd1, jd2)\n\n        return jd1, jd2\n\n    def get_jds_fast(self, val1, val2):\n        \"\"\"Use fast C parser to parse time strings in val1 and get jd1, jd2\"\"\"\n        # Handle bytes or str input and convert to uint8.  We need to the\n        # dtype _parse_times.dt_u1 instead of uint8, since otherwise it is\n        # not possible to create a gufunc with structured dtype output.\n        # See note about ufunc type resolver in pyerfa/erfa/ufunc.c.templ.\n        if val1.dtype.kind == 'U':\n            # Note: val1.astype('S') is *very* slow, so we check ourselves\n            # that the input is pure ASCII.\n            val1_uint32 = val1.view((np.uint32, val1.dtype.itemsize // 4))\n            if np.any(val1_uint32 > 127):\n                raise ValueError('input is not pure ASCII')\n\n            # It might be possible to avoid making a copy via astype with\n            # cleverness in parse_times.c but leave that for another day.\n            chars = val1_uint32.astype(_parse_times.dt_u1)\n\n        else:\n            chars = val1.view((_parse_times.dt_u1, val1.dtype.itemsize))\n\n        # Call the fast parsing ufunc.\n        time_struct = self._fast_parser(chars)\n        jd1, jd2 = erfa.dtf2d(self.scale.upper().encode('ascii'),\n                              time_struct['year'],\n                              time_struct['month'],\n                              time_struct['day'],\n                              time_struct['hour'],\n                              time_struct['minute'],\n                              time_struct['second'])\n        return day_frac(jd1, jd2)\n\n    def str_kwargs(self):\n        \"\"\"\n        Generator that yields a dict of values corresponding to the\n        calendar date and time for the internal JD values.\n        \"\"\"\n        scale = self.scale.upper().encode('ascii'),\n        iys, ims, ids, ihmsfs = erfa.d2dtf(scale, self.precision,\n                                           self.jd1, self.jd2_filled)\n\n        # Get the str_fmt element of the first allowed output subformat\n        _, _, str_fmt = self._select_subfmts(self.out_subfmt)[0]\n\n        yday = None\n        has_yday = '{yday:' in str_fmt\n\n        ihrs = ihmsfs['h']\n        imins = ihmsfs['m']\n        isecs = ihmsfs['s']\n        ifracs = ihmsfs['f']\n        for iy, im, id, ihr, imin, isec, ifracsec in np.nditer(\n                [iys, ims, ids, ihrs, imins, isecs, ifracs],\n                flags=['zerosize_ok']):\n            if has_yday:\n                yday = datetime.datetime(iy, im, id).timetuple().tm_yday\n\n            yield {'year': int(iy), 'mon': int(im), 'day': int(id),\n                   'hour': int(ihr), 'min': int(imin), 'sec': int(isec),\n                   'fracsec': int(ifracsec), 'yday': yday}\n\n    def format_string(self, str_fmt, **kwargs):\n        \"\"\"Write time to a string using a given format.\n\n        By default, just interprets str_fmt as a format string,\n        but subclasses can add to this.\n        \"\"\"\n        return str_fmt.format(**kwargs)\n\n    @property\n    def value(self):\n        # Select the first available subformat based on current\n        # self.out_subfmt\n        subfmts = self._select_subfmts(self.out_subfmt)\n        _, _, str_fmt = subfmts[0]\n\n        # TODO: fix this ugly hack\n        if self.precision > 0 and str_fmt.endswith('{sec:02d}'):\n            str_fmt += '.{fracsec:0' + str(self.precision) + 'd}'\n\n        # Try to optimize this later.  Can't pre-allocate because length of\n        # output could change, e.g. year rolls from 999 to 1000.\n        outs = []\n        for kwargs in self.str_kwargs():\n            outs.append(str(self.format_string(str_fmt, **kwargs)))\n\n        return np.array(outs).reshape(self.jd1.shape)"},{"col":0,"comment":"Compute the Kuiper statistic to compare two samples.\n\n    Parameters\n    ----------\n    data1 : array-like\n        The first set of data values.\n    data2 : array-like\n        The second set of data values.\n\n    Returns\n    -------\n    D : float\n        The raw test statistic.\n    fpp : float\n        The probability of obtaining two samples this different from\n        the same distribution.\n\n    .. warning::\n        The fpp is quite approximate, especially for small samples.\n\n    ","endLoc":1493,"header":"def kuiper_two(data1, data2)","id":8644,"name":"kuiper_two","nodeType":"Function","startLoc":1457,"text":"def kuiper_two(data1, data2):\n    \"\"\"Compute the Kuiper statistic to compare two samples.\n\n    Parameters\n    ----------\n    data1 : array-like\n        The first set of data values.\n    data2 : array-like\n        The second set of data values.\n\n    Returns\n    -------\n    D : float\n        The raw test statistic.\n    fpp : float\n        The probability of obtaining two samples this different from\n        the same distribution.\n\n    .. warning::\n        The fpp is quite approximate, especially for small samples.\n\n    \"\"\"\n    data1 = np.sort(data1)\n    data2 = np.sort(data2)\n    n1, = data1.shape\n    n2, = data2.shape\n    common_type = np.find_common_type([], [data1.dtype, data2.dtype])\n    if not (np.issubdtype(common_type, np.number)\n            and not np.issubdtype(common_type, np.complexfloating)):\n        raise ValueError('kuiper_two only accepts real inputs')\n    # nans, if any, are at the end after sorting.\n    if np.isnan(data1[-1]) or np.isnan(data2[-1]):\n        raise ValueError('kuiper_two only accepts non-nan inputs')\n    D = _stats.ks_2samp(np.asarray(data1, common_type),\n                        np.asarray(data2, common_type))\n    Ne = len(data1) * len(data2) / float(len(data1) + len(data2))\n    return D, kuiper_false_positive_probability(D, Ne)"},{"col":4,"comment":"null","endLoc":1267,"header":"def __init_subclass__(cls, **kwargs)","id":8645,"name":"__init_subclass__","nodeType":"Function","startLoc":1255,"text":"def __init_subclass__(cls, **kwargs):\n        if 'fast_parser_pars' in cls.__dict__:\n            fpp = cls.fast_parser_pars\n            fpp = np.array(list(zip(map(chr, fpp['delims']),\n                                    fpp['starts'],\n                                    fpp['stops'],\n                                    fpp['break_allowed'])),\n                           _parse_times.dt_pars)\n            if cls.fast_parser_pars['has_day_of_year']:\n                fpp['start'][1] = fpp['stop'][1] = -1\n            cls._fast_parser = _parse_times.create_parser(fpp)\n\n        super().__init_subclass__(**kwargs)"},{"col":0,"comment":"Fold the weighted intervals to the interval (0,1).\n\n    Convert a list of intervals (ai, bi, wi) to a list of non-overlapping\n    intervals covering (0,1). Each output interval has a weight equal\n    to the sum of the wis of all the intervals that include it. All intervals\n    are interpreted modulo 1, and weights are accumulated counting\n    multiplicity. This is appropriate, for example, if you have one or more\n    blocks of observation and you want to determine how much observation\n    time was spent on different parts of a system's orbit (the blocks\n    should be converted to units of the orbital period first).\n\n    Parameters\n    ----------\n    intervals : list of (3,) tuple\n        For each tuple (ai,bi,wi); ai and bi are the limits of the interval,\n        and wi is the weight to apply to the interval.\n\n    Returns\n    -------\n    breaks : (N,) array of float\n        The endpoints of a set of intervals covering [0,1]; breaks[0]=0 and\n        breaks[-1] = 1\n    weights : (N-1,) array of float\n        The ith element is the sum of number of times the interval\n        breaks[i],breaks[i+1] is included in each interval times the weight\n        associated with that interval.\n\n    ","endLoc":1545,"header":"def fold_intervals(intervals)","id":8646,"name":"fold_intervals","nodeType":"Function","startLoc":1496,"text":"def fold_intervals(intervals):\n    \"\"\"Fold the weighted intervals to the interval (0,1).\n\n    Convert a list of intervals (ai, bi, wi) to a list of non-overlapping\n    intervals covering (0,1). Each output interval has a weight equal\n    to the sum of the wis of all the intervals that include it. All intervals\n    are interpreted modulo 1, and weights are accumulated counting\n    multiplicity. This is appropriate, for example, if you have one or more\n    blocks of observation and you want to determine how much observation\n    time was spent on different parts of a system's orbit (the blocks\n    should be converted to units of the orbital period first).\n\n    Parameters\n    ----------\n    intervals : list of (3,) tuple\n        For each tuple (ai,bi,wi); ai and bi are the limits of the interval,\n        and wi is the weight to apply to the interval.\n\n    Returns\n    -------\n    breaks : (N,) array of float\n        The endpoints of a set of intervals covering [0,1]; breaks[0]=0 and\n        breaks[-1] = 1\n    weights : (N-1,) array of float\n        The ith element is the sum of number of times the interval\n        breaks[i],breaks[i+1] is included in each interval times the weight\n        associated with that interval.\n\n    \"\"\"\n    r = []\n    breaks = set()\n    tot = 0\n    for (a, b, wt) in intervals:\n        tot += (np.ceil(b) - np.floor(a)) * wt\n        fa = a % 1\n        breaks.add(fa)\n        r.append((0, fa, -wt))\n        fb = b % 1\n        breaks.add(fb)\n        r.append((fb, 1, -wt))\n\n    breaks.add(0.)\n    breaks.add(1.)\n    breaks = sorted(breaks)\n    breaks_map = dict([(f, i) for (i, f) in enumerate(breaks)])\n    totals = np.zeros(len(breaks) - 1)\n    totals += tot\n    for (a, b, wt) in r:\n        totals[breaks_map[a]:breaks_map[b]] += wt\n    return np.array(breaks), totals"},{"fileName":"bayesian_blocks.py","filePath":"astropy/stats","id":8647,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nBayesian Blocks for Time Series Analysis\n========================================\n\nDynamic programming algorithm for solving a piecewise-constant model for\nvarious datasets. This is based on the algorithm presented in Scargle\net al 2013 [1]_. This code was ported from the astroML project [2]_.\n\nApplications include:\n\n- finding an optimal histogram with adaptive bin widths\n- finding optimal segmentation of time series data\n- detecting inflection points in the rate of event data\n\nThe primary interface to these routines is the :func:`bayesian_blocks`\nfunction. This module provides fitness functions suitable for three types\nof data:\n\n- Irregularly-spaced event data via the :class:`Events` class\n- Regularly-spaced event data via the :class:`RegularEvents` class\n- Irregularly-spaced point measurements via the :class:`PointMeasures` class\n\nFor more fine-tuned control over the fitness functions used, it is possible\nto define custom :class:`FitnessFunc` classes directly and use them with\nthe :func:`bayesian_blocks` routine.\n\nOne common application of the Bayesian Blocks algorithm is the determination\nof optimal adaptive-width histogram bins. This uses the same fitness function\nas for irregularly-spaced time series events. The easiest interface for\ncreating Bayesian Blocks histograms is the :func:`astropy.stats.histogram`\nfunction.\n\nReferences\n----------\n.. [1] https://ui.adsabs.harvard.edu/abs/2013ApJ...764..167S\n.. [2] https://www.astroml.org/ https://github.com//astroML/astroML/\n.. [3] Bellman, R.E., Dreyfus, S.E., 1962. Applied Dynamic\n   Programming. Princeton University Press, Princeton.\n   https://press.princeton.edu/books/hardcover/9780691651873/applied-dynamic-programming\n.. [4] Bellman, R., Roth, R., 1969. Curve fitting by segmented\n   straight lines. J. Amer. Statist. Assoc. 64, 1079–1084.\n   https://www.tandfonline.com/doi/abs/10.1080/01621459.1969.10501038\n\"\"\"\nimport warnings\n\nimport numpy as np\n\nfrom inspect import signature\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n# TODO: implement other fitness functions from appendix C of Scargle 2013\n\n__all__ = ['FitnessFunc', 'Events', 'RegularEvents', 'PointMeasures',\n           'bayesian_blocks']\n\n\ndef bayesian_blocks(t, x=None, sigma=None,\n                    fitness='events', **kwargs):\n    r\"\"\"Compute optimal segmentation of data with Scargle's Bayesian Blocks\n\n    This is a flexible implementation of the Bayesian Blocks algorithm\n    described in Scargle 2013 [1]_.\n\n    Parameters\n    ----------\n    t : array-like\n        data times (one dimensional, length N)\n    x : array-like, optional\n        data values\n    sigma : array-like or float, optional\n        data errors\n    fitness : str or object\n        the fitness function to use for the model.\n        If a string, the following options are supported:\n\n        - 'events' : binned or unbinned event data.  Arguments are ``gamma``,\n          which gives the slope of the prior on the number of bins, or\n          ``ncp_prior``, which is :math:`-\\ln({\\tt gamma})`.\n        - 'regular_events' : non-overlapping events measured at multiples of a\n          fundamental tick rate, ``dt``, which must be specified as an\n          additional argument.  Extra arguments are ``p0``, which gives the\n          false alarm probability to compute the prior, or ``gamma``, which\n          gives the slope of the prior on the number of bins, or ``ncp_prior``,\n          which is :math:`-\\ln({\\tt gamma})`.\n        - 'measures' : fitness for a measured sequence with Gaussian errors.\n          Extra arguments are ``p0``, which gives the false alarm probability\n          to compute the prior, or ``gamma``, which gives the slope of the\n          prior on the number of bins, or ``ncp_prior``, which is\n          :math:`-\\ln({\\tt gamma})`.\n\n        In all three cases, if more than one of ``p0``, ``gamma``, and\n        ``ncp_prior`` is chosen, ``ncp_prior`` takes precedence over ``gamma``\n        which takes precedence over ``p0``.\n\n        Alternatively, the fitness parameter can be an instance of\n        :class:`FitnessFunc` or a subclass thereof.\n\n    **kwargs :\n        any additional keyword arguments will be passed to the specified\n        :class:`FitnessFunc` derived class.\n\n    Returns\n    -------\n    edges : ndarray\n        array containing the (N+1) edges defining the N bins\n\n    Examples\n    --------\n\n    .. testsetup::\n\n        >>> np.random.seed(12345)\n\n    Event data:\n\n    >>> t = np.random.normal(size=100)\n    >>> edges = bayesian_blocks(t, fitness='events', p0=0.01)\n\n    Event data with repeats:\n\n    >>> t = np.random.normal(size=100)\n    >>> t[80:] = t[:20]\n    >>> edges = bayesian_blocks(t, fitness='events', p0=0.01)\n\n    Regular event data:\n\n    >>> dt = 0.05\n    >>> t = dt * np.arange(1000)\n    >>> x = np.zeros(len(t))\n    >>> x[np.random.randint(0, len(t), len(t) // 10)] = 1\n    >>> edges = bayesian_blocks(t, x, fitness='regular_events', dt=dt)\n\n    Measured point data with errors:\n\n    >>> t = 100 * np.random.random(100)\n    >>> x = np.exp(-0.5 * (t - 50) ** 2)\n    >>> sigma = 0.1\n    >>> x_obs = np.random.normal(x, sigma)\n    >>> edges = bayesian_blocks(t, x_obs, sigma, fitness='measures')\n\n    References\n    ----------\n    .. [1] Scargle, J et al. (2013)\n       https://ui.adsabs.harvard.edu/abs/2013ApJ...764..167S\n\n    .. [2] Bellman, R.E., Dreyfus, S.E., 1962. Applied Dynamic\n       Programming. Princeton University Press, Princeton.\n       https://press.princeton.edu/books/hardcover/9780691651873/applied-dynamic-programming\n\n    .. [3] Bellman, R., Roth, R., 1969. Curve fitting by segmented\n       straight lines. J. Amer. Statist. Assoc. 64, 1079–1084.\n       https://www.tandfonline.com/doi/abs/10.1080/01621459.1969.10501038\n\n    See Also\n    --------\n    astropy.stats.histogram : compute a histogram using bayesian blocks\n    \"\"\"\n    FITNESS_DICT = {'events': Events,\n                    'regular_events': RegularEvents,\n                    'measures': PointMeasures}\n    fitness = FITNESS_DICT.get(fitness, fitness)\n\n    if type(fitness) is type and issubclass(fitness, FitnessFunc):\n        fitfunc = fitness(**kwargs)\n    elif isinstance(fitness, FitnessFunc):\n        fitfunc = fitness\n    else:\n        raise ValueError(\"fitness parameter not understood\")\n\n    return fitfunc.fit(t, x, sigma)\n\n\nclass FitnessFunc:\n    \"\"\"Base class for bayesian blocks fitness functions\n\n    Derived classes should overload the following method:\n\n    ``fitness(self, **kwargs)``:\n      Compute the fitness given a set of named arguments.\n      Arguments accepted by fitness must be among ``[T_k, N_k, a_k, b_k, c_k]``\n      (See [1]_ for details on the meaning of these parameters).\n\n    Additionally, other methods may be overloaded as well:\n\n    ``__init__(self, **kwargs)``:\n      Initialize the fitness function with any parameters beyond the normal\n      ``p0`` and ``gamma``.\n\n    ``validate_input(self, t, x, sigma)``:\n      Enable specific checks of the input data (``t``, ``x``, ``sigma``)\n      to be performed prior to the fit.\n\n    ``compute_ncp_prior(self, N)``: If ``ncp_prior`` is not defined explicitly,\n      this function is called in order to define it before fitting. This may be\n      calculated from ``gamma``, ``p0``, or whatever method you choose.\n\n    ``p0_prior(self, N)``:\n      Specify the form of the prior given the false-alarm probability ``p0``\n      (See [1]_ for details).\n\n    For examples of implemented fitness functions, see :class:`Events`,\n    :class:`RegularEvents`, and :class:`PointMeasures`.\n\n    References\n    ----------\n    .. [1] Scargle, J et al. (2013)\n       https://ui.adsabs.harvard.edu/abs/2013ApJ...764..167S\n    \"\"\"\n    def __init__(self, p0=0.05, gamma=None, ncp_prior=None):\n        self.p0 = p0\n        self.gamma = gamma\n        self.ncp_prior = ncp_prior\n\n    def validate_input(self, t, x=None, sigma=None):\n        \"\"\"Validate inputs to the model.\n\n        Parameters\n        ----------\n        t : array-like\n            times of observations\n        x : array-like, optional\n            values observed at each time\n        sigma : float or array-like, optional\n            errors in values x\n\n        Returns\n        -------\n        t, x, sigma : array-like, float or None\n            validated and perhaps modified versions of inputs\n        \"\"\"\n        # validate array input\n        t = np.asarray(t, dtype=float)\n\n        # find unique values of t\n        t = np.array(t)\n        if t.ndim != 1:\n            raise ValueError(\"t must be a one-dimensional array\")\n        unq_t, unq_ind, unq_inv = np.unique(t, return_index=True,\n                                            return_inverse=True)\n\n        # if x is not specified, x will be counts at each time\n        if x is None:\n            if sigma is not None:\n                raise ValueError(\"If sigma is specified, x must be specified\")\n            else:\n                sigma = 1\n\n            if len(unq_t) == len(t):\n                x = np.ones_like(t)\n            else:\n                x = np.bincount(unq_inv)\n\n            t = unq_t\n\n        # if x is specified, then we need to simultaneously sort t and x\n        else:\n            # TODO: allow broadcasted x?\n            x = np.asarray(x, dtype=float)\n\n            if x.shape not in [(), (1,), (t.size,)]:\n                raise ValueError(\"x does not match shape of t\")\n            x += np.zeros_like(t)\n\n            if len(unq_t) != len(t):\n                raise ValueError(\"Repeated values in t not supported when \"\n                                 \"x is specified\")\n            t = unq_t\n            x = x[unq_ind]\n\n        # verify the given sigma value\n        if sigma is None:\n            sigma = 1\n        else:\n            sigma = np.asarray(sigma, dtype=float)\n            if sigma.shape not in [(), (1,), (t.size,)]:\n                raise ValueError('sigma does not match the shape of x')\n\n        return t, x, sigma\n\n    def fitness(self, **kwargs):\n        raise NotImplementedError()\n\n    def p0_prior(self, N):\n        \"\"\"\n        Empirical prior, parametrized by the false alarm probability ``p0``\n        See  eq. 21 in Scargle (2013)\n\n        Note that there was an error in this equation in the original Scargle\n        paper (the \"log\" was missing). The following corrected form is taken\n        from https://arxiv.org/abs/1304.2818\n        \"\"\"\n        return 4 - np.log(73.53 * self.p0 * (N ** -0.478))\n\n    # the fitness_args property will return the list of arguments accepted by\n    # the method fitness().  This allows more efficient computation below.\n    @property\n    def _fitness_args(self):\n        return signature(self.fitness).parameters.keys()\n\n    def compute_ncp_prior(self, N):\n        \"\"\"\n        If ``ncp_prior`` is not explicitly defined, compute it from ``gamma``\n        or ``p0``.\n        \"\"\"\n\n        if self.gamma is not None:\n            return -np.log(self.gamma)\n        elif self.p0 is not None:\n            return self.p0_prior(N)\n        else:\n            raise ValueError(\"``ncp_prior`` cannot be computed as neither \"\n                             \"``gamma`` nor ``p0`` is defined.\")\n\n    def fit(self, t, x=None, sigma=None):\n        \"\"\"Fit the Bayesian Blocks model given the specified fitness function.\n\n        Parameters\n        ----------\n        t : array-like\n            data times (one dimensional, length N)\n        x : array-like, optional\n            data values\n        sigma : array-like or float, optional\n            data errors\n\n        Returns\n        -------\n        edges : ndarray\n            array containing the (M+1) edges defining the M optimal bins\n        \"\"\"\n        t, x, sigma = self.validate_input(t, x, sigma)\n\n        # compute values needed for computation, below\n        if 'a_k' in self._fitness_args:\n            ak_raw = np.ones_like(x) / sigma ** 2\n        if 'b_k' in self._fitness_args:\n            bk_raw = x / sigma ** 2\n        if 'c_k' in self._fitness_args:\n            ck_raw = x * x / sigma ** 2\n\n        # create length-(N + 1) array of cell edges\n        edges = np.concatenate([t[:1],\n                                0.5 * (t[1:] + t[:-1]),\n                                t[-1:]])\n        block_length = t[-1] - edges\n\n        # arrays to store the best configuration\n        N = len(t)\n        best = np.zeros(N, dtype=float)\n        last = np.zeros(N, dtype=int)\n\n        # Compute ncp_prior if not defined\n        if self.ncp_prior is None:\n            ncp_prior = self.compute_ncp_prior(N)\n        else:\n            ncp_prior = self.ncp_prior\n\n        # ----------------------------------------------------------------\n        # Start with first data cell; add one cell at each iteration\n        # ----------------------------------------------------------------\n        for R in range(N):\n            # Compute fit_vec : fitness of putative last block (end at R)\n            kwds = {}\n\n            # T_k: width/duration of each block\n            if 'T_k' in self._fitness_args:\n                kwds['T_k'] = block_length[:R + 1] - block_length[R + 1]\n\n            # N_k: number of elements in each block\n            if 'N_k' in self._fitness_args:\n                kwds['N_k'] = np.cumsum(x[:R + 1][::-1])[::-1]\n\n            # a_k: eq. 31\n            if 'a_k' in self._fitness_args:\n                kwds['a_k'] = 0.5 * np.cumsum(ak_raw[:R + 1][::-1])[::-1]\n\n            # b_k: eq. 32\n            if 'b_k' in self._fitness_args:\n                kwds['b_k'] = - np.cumsum(bk_raw[:R + 1][::-1])[::-1]\n\n            # c_k: eq. 33\n            if 'c_k' in self._fitness_args:\n                kwds['c_k'] = 0.5 * np.cumsum(ck_raw[:R + 1][::-1])[::-1]\n\n            # evaluate fitness function\n            fit_vec = self.fitness(**kwds)\n\n            A_R = fit_vec - ncp_prior\n            A_R[1:] += best[:R]\n\n            i_max = np.argmax(A_R)\n            last[R] = i_max\n            best[R] = A_R[i_max]\n\n        # ----------------------------------------------------------------\n        # Now find changepoints by iteratively peeling off the last block\n        # ----------------------------------------------------------------\n        change_points = np.zeros(N, dtype=int)\n        i_cp = N\n        ind = N\n        while i_cp > 0:\n            i_cp -= 1\n            change_points[i_cp] = ind\n            if ind == 0:\n                break\n            ind = last[ind - 1]\n        if i_cp == 0:\n            change_points[i_cp] = 0\n        change_points = change_points[i_cp:]\n\n        return edges[change_points]\n\n\nclass Events(FitnessFunc):\n    r\"\"\"Bayesian blocks fitness for binned or unbinned events\n\n    Parameters\n    ----------\n    p0 : float, optional\n        False alarm probability, used to compute the prior on\n        :math:`N_{\\rm blocks}` (see eq. 21 of Scargle 2013). For the Events\n        type data, ``p0`` does not seem to be an accurate representation of the\n        actual false alarm probability. If you are using this fitness function\n        for a triggering type condition, it is recommended that you run\n        statistical trials on signal-free noise to determine an appropriate\n        value of ``gamma`` or ``ncp_prior`` to use for a desired false alarm\n        rate.\n    gamma : float, optional\n        If specified, then use this gamma to compute the general prior form,\n        :math:`p \\sim {\\tt gamma}^{N_{\\rm blocks}}`.  If gamma is specified, p0\n        is ignored.\n    ncp_prior : float, optional\n        If specified, use the value of ``ncp_prior`` to compute the prior as\n        above, using the definition :math:`{\\tt ncp\\_prior} = -\\ln({\\tt\n        gamma})`.\n        If ``ncp_prior`` is specified, ``gamma`` and ``p0`` is ignored.\n    \"\"\"\n\n    def fitness(self, N_k, T_k):\n        # eq. 19 from Scargle 2013\n        return N_k * (np.log(N_k / T_k))\n\n    def validate_input(self, t, x, sigma):\n        t, x, sigma = super().validate_input(t, x, sigma)\n        if x is not None and np.any(x % 1 > 0):\n            raise ValueError(\"x must be integer counts for fitness='events'\")\n        return t, x, sigma\n\n\nclass RegularEvents(FitnessFunc):\n    r\"\"\"Bayesian blocks fitness for regular events\n\n    This is for data which has a fundamental \"tick\" length, so that all\n    measured values are multiples of this tick length.  In each tick, there\n    are either zero or one counts.\n\n    Parameters\n    ----------\n    dt : float\n        tick rate for data\n    p0 : float, optional\n        False alarm probability, used to compute the prior on :math:`N_{\\rm\n        blocks}` (see eq. 21 of Scargle 2013). If gamma is specified, p0 is\n        ignored.\n    ncp_prior : float, optional\n        If specified, use the value of ``ncp_prior`` to compute the prior as\n        above, using the definition :math:`{\\tt ncp\\_prior} = -\\ln({\\tt\n        gamma})`.  If ``ncp_prior`` is specified, ``gamma`` and ``p0`` are\n        ignored.\n    \"\"\"\n    def __init__(self, dt, p0=0.05, gamma=None, ncp_prior=None):\n        self.dt = dt\n        super().__init__(p0, gamma, ncp_prior)\n\n    def validate_input(self, t, x, sigma):\n        t, x, sigma = super().validate_input(t, x, sigma)\n        if not np.all((x == 0) | (x == 1)):\n            raise ValueError(\"Regular events must have only 0 and 1 in x\")\n        return t, x, sigma\n\n    def fitness(self, T_k, N_k):\n        # Eq. C23 of Scargle 2013\n        M_k = T_k / self.dt\n        N_over_M = N_k / M_k\n\n        eps = 1E-8\n        if np.any(N_over_M > 1 + eps):\n            warnings.warn('regular events: N/M > 1.  '\n                          'Is the time step correct?', AstropyUserWarning)\n\n        one_m_NM = 1 - N_over_M\n        N_over_M[N_over_M <= 0] = 1\n        one_m_NM[one_m_NM <= 0] = 1\n\n        return N_k * np.log(N_over_M) + (M_k - N_k) * np.log(one_m_NM)\n\n\nclass PointMeasures(FitnessFunc):\n    r\"\"\"Bayesian blocks fitness for point measures\n\n    Parameters\n    ----------\n    p0 : float, optional\n        False alarm probability, used to compute the prior on :math:`N_{\\rm\n        blocks}` (see eq. 21 of Scargle 2013). If gamma is specified, p0 is\n        ignored.\n    ncp_prior : float, optional\n        If specified, use the value of ``ncp_prior`` to compute the prior as\n        above, using the definition :math:`{\\tt ncp\\_prior} = -\\ln({\\tt\n        gamma})`.  If ``ncp_prior`` is specified, ``gamma`` and ``p0`` are\n        ignored.\n    \"\"\"\n    def __init__(self, p0=0.05, gamma=None, ncp_prior=None):\n        super().__init__(p0, gamma, ncp_prior)\n\n    def fitness(self, a_k, b_k):\n        # eq. 41 from Scargle 2013\n        return (b_k * b_k) / (4 * a_k)\n\n    def validate_input(self, t, x, sigma):\n        if x is None:\n            raise ValueError(\"x must be specified for point measures\")\n        return super().validate_input(t, x, sigma)\n"},{"col":4,"comment":"null","endLoc":1275,"header":"def _check_val_type(self, val1, val2)","id":8648,"name":"_check_val_type","nodeType":"Function","startLoc":1269,"text":"def _check_val_type(self, val1, val2):\n        if val1.dtype.kind not in ('S', 'U') and val1.size:\n            raise TypeError(f'Input values for {self.name} class must be strings')\n        if val2 is not None:\n            raise ValueError(\n                f'{self.name} objects do not accept a val2 but you provided {val2}')\n        return val1, None"},{"col":0,"comment":"\n    Convert a WCS obsgeo property into an `~.builtin_frames.ITRS` coordinate frame.\n\n    Parameters\n    ----------\n    obsgeo : array-like\n        A shape ``(6, )`` array representing ``OBSGEO-[XYZ], OBSGEO-[BLH]`` as\n        returned by ``WCS.wcs.obsgeo``.\n\n    obstime : time-like\n        The time associated with the coordinate, will be passed to\n        `~.builtin_frames.ITRS` as the obstime keyword.\n\n    Returns\n    -------\n    `~.builtin_frames.ITRS`\n        An `~.builtin_frames.ITRS` coordinate frame\n        representing the coordinates.\n\n    Notes\n    -----\n\n    The obsgeo array as accessed on a `.WCS` object is a length 6 numpy array\n    where the first three elements are the coordinate in a cartesian\n    representation and the second 3 are the coordinate in a spherical\n    representation.\n\n    This function priorities reading the cartesian coordinates, and will only\n    read the spherical coordinates if the cartesian coordinates are either all\n    zero or any of the cartesian coordinates are non-finite.\n\n    In the case where both the spherical and cartesian coordinates have some\n    non-finite values the spherical coordinates will be returned with the\n    non-finite values included.\n\n    ","endLoc":1199,"header":"def obsgeo_to_frame(obsgeo, obstime)","id":8649,"name":"obsgeo_to_frame","nodeType":"Function","startLoc":1146,"text":"def obsgeo_to_frame(obsgeo, obstime):\n    \"\"\"\n    Convert a WCS obsgeo property into an `~.builtin_frames.ITRS` coordinate frame.\n\n    Parameters\n    ----------\n    obsgeo : array-like\n        A shape ``(6, )`` array representing ``OBSGEO-[XYZ], OBSGEO-[BLH]`` as\n        returned by ``WCS.wcs.obsgeo``.\n\n    obstime : time-like\n        The time associated with the coordinate, will be passed to\n        `~.builtin_frames.ITRS` as the obstime keyword.\n\n    Returns\n    -------\n    `~.builtin_frames.ITRS`\n        An `~.builtin_frames.ITRS` coordinate frame\n        representing the coordinates.\n\n    Notes\n    -----\n\n    The obsgeo array as accessed on a `.WCS` object is a length 6 numpy array\n    where the first three elements are the coordinate in a cartesian\n    representation and the second 3 are the coordinate in a spherical\n    representation.\n\n    This function priorities reading the cartesian coordinates, and will only\n    read the spherical coordinates if the cartesian coordinates are either all\n    zero or any of the cartesian coordinates are non-finite.\n\n    In the case where both the spherical and cartesian coordinates have some\n    non-finite values the spherical coordinates will be returned with the\n    non-finite values included.\n\n    \"\"\"\n    if (obsgeo is None\n        or len(obsgeo) != 6\n        or np.all(np.array(obsgeo) == 0)\n        or np.all(~np.isfinite(obsgeo))\n    ):\n        raise ValueError(f\"Can not parse the 'obsgeo' location ({obsgeo}). \"\n                         \"obsgeo should be a length 6 non-zero, finite numpy array\")\n\n    # If the cartesian coords are zero or have NaNs in them use the spherical ones\n    if np.all(obsgeo[:3] == 0) or np.any(~np.isfinite(obsgeo[:3])):\n        data = SphericalRepresentation(*(obsgeo[3:] * (u.deg, u.deg, u.m)))\n\n    # Otherwise we assume the cartesian ones are valid\n    else:\n        data = CartesianRepresentation(*obsgeo[:3] * u.m)\n\n    return ITRS(data, obstime=obstime)"},{"col":4,"comment":"Read time from a single string, using a set of possible formats.","endLoc":1315,"header":"def parse_string(self, timestr, subfmts)","id":8650,"name":"parse_string","nodeType":"Function","startLoc":1277,"text":"def parse_string(self, timestr, subfmts):\n        \"\"\"Read time from a single string, using a set of possible formats.\"\"\"\n        # Datetime components required for conversion to JD by ERFA, along\n        # with the default values.\n        components = ('year', 'mon', 'mday', 'hour', 'min', 'sec')\n        defaults = (None, 1, 1, 0, 0, 0)\n        # Assume that anything following \".\" on the right side is a\n        # floating fraction of a second.\n        try:\n            idot = timestr.rindex('.')\n        except Exception:\n            fracsec = 0.0\n        else:\n            timestr, fracsec = timestr[:idot], timestr[idot:]\n            fracsec = float(fracsec)\n\n        for _, strptime_fmt_or_regex, _ in subfmts:\n            if isinstance(strptime_fmt_or_regex, str):\n                try:\n                    tm = time.strptime(timestr, strptime_fmt_or_regex)\n                except ValueError:\n                    continue\n                else:\n                    vals = [getattr(tm, 'tm_' + component)\n                            for component in components]\n\n            else:\n                tm = re.match(strptime_fmt_or_regex, timestr)\n                if tm is None:\n                    continue\n                tm = tm.groupdict()\n                vals = [int(tm.get(component, default)) for component, default\n                        in zip(components, defaults)]\n\n            # Add fractional seconds\n            vals[-1] = vals[-1] + fracsec\n            return vals\n        else:\n            raise ValueError(f'Time {timestr} does not match {self.name} format')"},{"col":0,"comment":"\n    Compute the biweight scale.\n\n    The biweight scale is a robust statistic for determining the\n    standard deviation of a distribution.  It is the square root of the\n    `biweight midvariance\n    <https://en.wikipedia.org/wiki/Robust_measures_of_scale#The_biweight_midvariance>`_.\n    It is given by:\n\n    .. math::\n\n        \\zeta_{biscl} = \\sqrt{n} \\ \\frac{\\sqrt{\\sum_{|u_i| < 1} \\\n            (x_i - M)^2 (1 - u_i^2)^4}} {|(\\sum_{|u_i| < 1} \\\n            (1 - u_i^2) (1 - 5u_i^2))|}\n\n    where :math:`x` is the input data, :math:`M` is the sample median\n    (or the input location) and :math:`u_i` is given by:\n\n    .. math::\n\n        u_{i} = \\frac{(x_i - M)}{c * MAD}\n\n    where :math:`c` is the tuning constant and :math:`MAD` is the\n    `median absolute deviation\n    <https://en.wikipedia.org/wiki/Median_absolute_deviation>`_.  The\n    biweight midvariance tuning constant ``c`` is typically 9.0 (the\n    default).\n\n    If :math:`MAD` is zero, then zero will be returned.\n\n    For the standard definition of biweight scale, :math:`n` is the\n    total number of points in the array (or along the input ``axis``, if\n    specified).  That definition is used if ``modify_sample_size`` is\n    `False`, which is the default.\n\n    However, if ``modify_sample_size = True``, then :math:`n` is the\n    number of points for which :math:`|u_i| < 1` (i.e. the total number\n    of non-rejected values), i.e.\n\n    .. math::\n\n        n = \\sum_{|u_i| < 1} \\ 1\n\n    which results in a value closer to the true standard deviation for\n    small sample sizes or for a large number of rejected values.\n\n    Parameters\n    ----------\n    data : array-like\n        Input array or object that can be converted to an array.\n        ``data`` can be a `~numpy.ma.MaskedArray`.\n    c : float, optional\n        Tuning constant for the biweight estimator (default = 9.0).\n    M : float or array-like, optional\n        The location estimate.  If ``M`` is a scalar value, then its\n        value will be used for the entire array (or along each ``axis``,\n        if specified).  If ``M`` is an array, then its must be an array\n        containing the location estimate along each ``axis`` of the\n        input array.  If `None` (default), then the median of the input\n        array will be used (or along each ``axis``, if specified).\n    axis : None, int, or tuple of int, optional\n        The axis or axes along which the biweight scales are computed.\n        If `None` (default), then the biweight scale of the flattened\n        input array will be computed.\n    modify_sample_size : bool, optional\n        If `False` (default), then the sample size used is the total\n        number of elements in the array (or along the input ``axis``, if\n        specified), which follows the standard definition of biweight\n        scale.  If `True`, then the sample size is reduced to correct\n        for any rejected values (i.e. the sample size used includes only\n        the non-rejected values), which results in a value closer to the\n        true standard deviation for small sample sizes or for a large\n        number of rejected values.\n    ignore_nan : bool, optional\n        Whether to ignore NaN values in the input ``data``.\n\n    Returns\n    -------\n    biweight_scale : float or `~numpy.ndarray`\n        The biweight scale of the input data.  If ``axis`` is `None`\n        then a scalar will be returned, otherwise a `~numpy.ndarray`\n        will be returned.\n\n    See Also\n    --------\n    biweight_midvariance, biweight_midcovariance, biweight_location, astropy.stats.mad_std, astropy.stats.median_absolute_deviation\n\n    References\n    ----------\n    .. [1] Beers, Flynn, and Gebhardt (1990; AJ 100, 32) (https://ui.adsabs.harvard.edu/abs/1990AJ....100...32B)\n\n    .. [2] https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/biwscale.htm\n\n    Examples\n    --------\n    Generate random variates from a Gaussian distribution and return the\n    biweight scale of the distribution:\n\n    >>> import numpy as np\n    >>> from astropy.stats import biweight_scale\n    >>> rand = np.random.default_rng(12345)\n    >>> biscl = biweight_scale(rand.standard_normal(1000))\n    >>> print(biscl)    # doctest: +FLOAT_CMP\n    1.0239311812635818\n    ","endLoc":270,"header":"def biweight_scale(data, c=9.0, M=None, axis=None, modify_sample_size=False,\n                   *, ignore_nan=False)","id":8651,"name":"biweight_scale","nodeType":"Function","startLoc":159,"text":"def biweight_scale(data, c=9.0, M=None, axis=None, modify_sample_size=False,\n                   *, ignore_nan=False):\n    r\"\"\"\n    Compute the biweight scale.\n\n    The biweight scale is a robust statistic for determining the\n    standard deviation of a distribution.  It is the square root of the\n    `biweight midvariance\n    <https://en.wikipedia.org/wiki/Robust_measures_of_scale#The_biweight_midvariance>`_.\n    It is given by:\n\n    .. math::\n\n        \\zeta_{biscl} = \\sqrt{n} \\ \\frac{\\sqrt{\\sum_{|u_i| < 1} \\\n            (x_i - M)^2 (1 - u_i^2)^4}} {|(\\sum_{|u_i| < 1} \\\n            (1 - u_i^2) (1 - 5u_i^2))|}\n\n    where :math:`x` is the input data, :math:`M` is the sample median\n    (or the input location) and :math:`u_i` is given by:\n\n    .. math::\n\n        u_{i} = \\frac{(x_i - M)}{c * MAD}\n\n    where :math:`c` is the tuning constant and :math:`MAD` is the\n    `median absolute deviation\n    <https://en.wikipedia.org/wiki/Median_absolute_deviation>`_.  The\n    biweight midvariance tuning constant ``c`` is typically 9.0 (the\n    default).\n\n    If :math:`MAD` is zero, then zero will be returned.\n\n    For the standard definition of biweight scale, :math:`n` is the\n    total number of points in the array (or along the input ``axis``, if\n    specified).  That definition is used if ``modify_sample_size`` is\n    `False`, which is the default.\n\n    However, if ``modify_sample_size = True``, then :math:`n` is the\n    number of points for which :math:`|u_i| < 1` (i.e. the total number\n    of non-rejected values), i.e.\n\n    .. math::\n\n        n = \\sum_{|u_i| < 1} \\ 1\n\n    which results in a value closer to the true standard deviation for\n    small sample sizes or for a large number of rejected values.\n\n    Parameters\n    ----------\n    data : array-like\n        Input array or object that can be converted to an array.\n        ``data`` can be a `~numpy.ma.MaskedArray`.\n    c : float, optional\n        Tuning constant for the biweight estimator (default = 9.0).\n    M : float or array-like, optional\n        The location estimate.  If ``M`` is a scalar value, then its\n        value will be used for the entire array (or along each ``axis``,\n        if specified).  If ``M`` is an array, then its must be an array\n        containing the location estimate along each ``axis`` of the\n        input array.  If `None` (default), then the median of the input\n        array will be used (or along each ``axis``, if specified).\n    axis : None, int, or tuple of int, optional\n        The axis or axes along which the biweight scales are computed.\n        If `None` (default), then the biweight scale of the flattened\n        input array will be computed.\n    modify_sample_size : bool, optional\n        If `False` (default), then the sample size used is the total\n        number of elements in the array (or along the input ``axis``, if\n        specified), which follows the standard definition of biweight\n        scale.  If `True`, then the sample size is reduced to correct\n        for any rejected values (i.e. the sample size used includes only\n        the non-rejected values), which results in a value closer to the\n        true standard deviation for small sample sizes or for a large\n        number of rejected values.\n    ignore_nan : bool, optional\n        Whether to ignore NaN values in the input ``data``.\n\n    Returns\n    -------\n    biweight_scale : float or `~numpy.ndarray`\n        The biweight scale of the input data.  If ``axis`` is `None`\n        then a scalar will be returned, otherwise a `~numpy.ndarray`\n        will be returned.\n\n    See Also\n    --------\n    biweight_midvariance, biweight_midcovariance, biweight_location, astropy.stats.mad_std, astropy.stats.median_absolute_deviation\n\n    References\n    ----------\n    .. [1] Beers, Flynn, and Gebhardt (1990; AJ 100, 32) (https://ui.adsabs.harvard.edu/abs/1990AJ....100...32B)\n\n    .. [2] https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/biwscale.htm\n\n    Examples\n    --------\n    Generate random variates from a Gaussian distribution and return the\n    biweight scale of the distribution:\n\n    >>> import numpy as np\n    >>> from astropy.stats import biweight_scale\n    >>> rand = np.random.default_rng(12345)\n    >>> biscl = biweight_scale(rand.standard_normal(1000))\n    >>> print(biscl)    # doctest: +FLOAT_CMP\n    1.0239311812635818\n    \"\"\"\n\n    return np.sqrt(\n        biweight_midvariance(data, c=c, M=M, axis=axis,\n                             modify_sample_size=modify_sample_size,\n                             ignore_nan=ignore_nan))"},{"col":0,"comment":"\n    Compute the biweight midvariance.\n\n    The biweight midvariance is a robust statistic for determining the\n    variance of a distribution.  Its square root is a robust estimator\n    of scale (i.e. standard deviation).  It is given by:\n\n    .. math::\n\n        \\zeta_{bivar} = n \\ \\frac{\\sum_{|u_i| < 1} \\\n            (x_i - M)^2 (1 - u_i^2)^4} {(\\sum_{|u_i| < 1} \\\n            (1 - u_i^2) (1 - 5u_i^2))^2}\n\n    where :math:`x` is the input data, :math:`M` is the sample median\n    (or the input location) and :math:`u_i` is given by:\n\n    .. math::\n\n        u_{i} = \\frac{(x_i - M)}{c * MAD}\n\n    where :math:`c` is the tuning constant and :math:`MAD` is the\n    `median absolute deviation\n    <https://en.wikipedia.org/wiki/Median_absolute_deviation>`_.  The\n    biweight midvariance tuning constant ``c`` is typically 9.0 (the\n    default).\n\n    If :math:`MAD` is zero, then zero will be returned.\n\n    For the standard definition of `biweight midvariance\n    <https://en.wikipedia.org/wiki/Robust_measures_of_scale#The_biweight_midvariance>`_,\n    :math:`n` is the total number of points in the array (or along the\n    input ``axis``, if specified).  That definition is used if\n    ``modify_sample_size`` is `False`, which is the default.\n\n    However, if ``modify_sample_size = True``, then :math:`n` is the\n    number of points for which :math:`|u_i| < 1` (i.e. the total number\n    of non-rejected values), i.e.\n\n    .. math::\n\n        n = \\sum_{|u_i| < 1} \\ 1\n\n    which results in a value closer to the true variance for small\n    sample sizes or for a large number of rejected values.\n\n    Parameters\n    ----------\n    data : array-like\n        Input array or object that can be converted to an array.\n        ``data`` can be a `~numpy.ma.MaskedArray`.\n    c : float, optional\n        Tuning constant for the biweight estimator (default = 9.0).\n    M : float or array-like, optional\n        The location estimate.  If ``M`` is a scalar value, then its\n        value will be used for the entire array (or along each ``axis``,\n        if specified).  If ``M`` is an array, then its must be an array\n        containing the location estimate along each ``axis`` of the\n        input array.  If `None` (default), then the median of the input\n        array will be used (or along each ``axis``, if specified).\n    axis : None, int, or tuple of int, optional\n        The axis or axes along which the biweight midvariances are\n        computed.  If `None` (default), then the biweight midvariance of\n        the flattened input array will be computed.\n    modify_sample_size : bool, optional\n        If `False` (default), then the sample size used is the total\n        number of elements in the array (or along the input ``axis``, if\n        specified), which follows the standard definition of biweight\n        midvariance.  If `True`, then the sample size is reduced to\n        correct for any rejected values (i.e. the sample size used\n        includes only the non-rejected values), which results in a value\n        closer to the true variance for small sample sizes or for a\n        large number of rejected values.\n    ignore_nan : bool, optional\n        Whether to ignore NaN values in the input ``data``.\n\n    Returns\n    -------\n    biweight_midvariance : float or `~numpy.ndarray`\n        The biweight midvariance of the input data.  If ``axis`` is\n        `None` then a scalar will be returned, otherwise a\n        `~numpy.ndarray` will be returned.\n\n    See Also\n    --------\n    biweight_midcovariance, biweight_midcorrelation, astropy.stats.mad_std, astropy.stats.median_absolute_deviation\n\n    References\n    ----------\n    .. [1] https://en.wikipedia.org/wiki/Robust_measures_of_scale#The_biweight_midvariance\n\n    .. [2] Beers, Flynn, and Gebhardt (1990; AJ 100, 32) (https://ui.adsabs.harvard.edu/abs/1990AJ....100...32B)\n\n    Examples\n    --------\n    Generate random variates from a Gaussian distribution and return the\n    biweight midvariance of the distribution:\n\n    >>> import numpy as np\n    >>> from astropy.stats import biweight_midvariance\n    >>> rand = np.random.default_rng(12345)\n    >>> bivar = biweight_midvariance(rand.standard_normal(1000))\n    >>> print(bivar)    # doctest: +FLOAT_CMP\n    1.0484350639638342\n    ","endLoc":446,"header":"def biweight_midvariance(data, c=9.0, M=None, axis=None,\n                         modify_sample_size=False, *, ignore_nan=False)","id":8652,"name":"biweight_midvariance","nodeType":"Function","startLoc":273,"text":"def biweight_midvariance(data, c=9.0, M=None, axis=None,\n                         modify_sample_size=False, *, ignore_nan=False):\n    r\"\"\"\n    Compute the biweight midvariance.\n\n    The biweight midvariance is a robust statistic for determining the\n    variance of a distribution.  Its square root is a robust estimator\n    of scale (i.e. standard deviation).  It is given by:\n\n    .. math::\n\n        \\zeta_{bivar} = n \\ \\frac{\\sum_{|u_i| < 1} \\\n            (x_i - M)^2 (1 - u_i^2)^4} {(\\sum_{|u_i| < 1} \\\n            (1 - u_i^2) (1 - 5u_i^2))^2}\n\n    where :math:`x` is the input data, :math:`M` is the sample median\n    (or the input location) and :math:`u_i` is given by:\n\n    .. math::\n\n        u_{i} = \\frac{(x_i - M)}{c * MAD}\n\n    where :math:`c` is the tuning constant and :math:`MAD` is the\n    `median absolute deviation\n    <https://en.wikipedia.org/wiki/Median_absolute_deviation>`_.  The\n    biweight midvariance tuning constant ``c`` is typically 9.0 (the\n    default).\n\n    If :math:`MAD` is zero, then zero will be returned.\n\n    For the standard definition of `biweight midvariance\n    <https://en.wikipedia.org/wiki/Robust_measures_of_scale#The_biweight_midvariance>`_,\n    :math:`n` is the total number of points in the array (or along the\n    input ``axis``, if specified).  That definition is used if\n    ``modify_sample_size`` is `False`, which is the default.\n\n    However, if ``modify_sample_size = True``, then :math:`n` is the\n    number of points for which :math:`|u_i| < 1` (i.e. the total number\n    of non-rejected values), i.e.\n\n    .. math::\n\n        n = \\sum_{|u_i| < 1} \\ 1\n\n    which results in a value closer to the true variance for small\n    sample sizes or for a large number of rejected values.\n\n    Parameters\n    ----------\n    data : array-like\n        Input array or object that can be converted to an array.\n        ``data`` can be a `~numpy.ma.MaskedArray`.\n    c : float, optional\n        Tuning constant for the biweight estimator (default = 9.0).\n    M : float or array-like, optional\n        The location estimate.  If ``M`` is a scalar value, then its\n        value will be used for the entire array (or along each ``axis``,\n        if specified).  If ``M`` is an array, then its must be an array\n        containing the location estimate along each ``axis`` of the\n        input array.  If `None` (default), then the median of the input\n        array will be used (or along each ``axis``, if specified).\n    axis : None, int, or tuple of int, optional\n        The axis or axes along which the biweight midvariances are\n        computed.  If `None` (default), then the biweight midvariance of\n        the flattened input array will be computed.\n    modify_sample_size : bool, optional\n        If `False` (default), then the sample size used is the total\n        number of elements in the array (or along the input ``axis``, if\n        specified), which follows the standard definition of biweight\n        midvariance.  If `True`, then the sample size is reduced to\n        correct for any rejected values (i.e. the sample size used\n        includes only the non-rejected values), which results in a value\n        closer to the true variance for small sample sizes or for a\n        large number of rejected values.\n    ignore_nan : bool, optional\n        Whether to ignore NaN values in the input ``data``.\n\n    Returns\n    -------\n    biweight_midvariance : float or `~numpy.ndarray`\n        The biweight midvariance of the input data.  If ``axis`` is\n        `None` then a scalar will be returned, otherwise a\n        `~numpy.ndarray` will be returned.\n\n    See Also\n    --------\n    biweight_midcovariance, biweight_midcorrelation, astropy.stats.mad_std, astropy.stats.median_absolute_deviation\n\n    References\n    ----------\n    .. [1] https://en.wikipedia.org/wiki/Robust_measures_of_scale#The_biweight_midvariance\n\n    .. [2] Beers, Flynn, and Gebhardt (1990; AJ 100, 32) (https://ui.adsabs.harvard.edu/abs/1990AJ....100...32B)\n\n    Examples\n    --------\n    Generate random variates from a Gaussian distribution and return the\n    biweight midvariance of the distribution:\n\n    >>> import numpy as np\n    >>> from astropy.stats import biweight_midvariance\n    >>> rand = np.random.default_rng(12345)\n    >>> bivar = biweight_midvariance(rand.standard_normal(1000))\n    >>> print(bivar)    # doctest: +FLOAT_CMP\n    1.0484350639638342\n    \"\"\"\n    median_func, sum_func = _stat_functions(data, ignore_nan=ignore_nan)\n\n    if isinstance(data, np.ma.MaskedArray) and ignore_nan:\n        data = np.ma.masked_where(np.isnan(data), data, copy=True)\n\n    data = np.asanyarray(data).astype(np.float64)\n\n    if M is None:\n        M = median_func(data, axis=axis)\n    if axis is not None:\n        M = _expand_dims(M, axis=axis)  # NUMPY_LT_1_18\n\n    # set up the differences\n    d = data - M\n\n    # set up the weighting\n    mad = median_absolute_deviation(data, axis=axis, ignore_nan=ignore_nan)\n\n    if axis is None:\n        # data is constant or mostly constant OR\n        # data contains NaNs and ignore_nan=False\n        if mad == 0. or np.isnan(mad):\n            return mad ** 2  # variance units\n    else:\n        mad = _expand_dims(mad, axis=axis)  # NUMPY_LT_1_18\n\n    with np.errstate(divide='ignore', invalid='ignore'):\n        u = d / (c * mad)\n\n    # now remove the outlier points\n    # ignore RuntimeWarnings for comparisons with NaN data values\n    with np.errstate(invalid='ignore'):\n        mask = np.abs(u) < 1\n    if isinstance(mask, np.ma.MaskedArray):\n        mask = mask.filled(fill_value=False)  # exclude masked data values\n\n    u = u ** 2\n\n    if modify_sample_size:\n        n = sum_func(mask, axis=axis)\n    else:\n        # set good values to 1, bad values to 0\n        include_mask = np.ones(data.shape)\n        if isinstance(data, np.ma.MaskedArray):\n            include_mask[data.mask] = 0\n        if ignore_nan:\n            include_mask[np.isnan(data)] = 0\n        n = np.sum(include_mask, axis=axis)\n\n    f1 = d * d * (1. - u)**4\n    f1[~mask] = 0.\n    f1 = sum_func(f1, axis=axis)\n    f2 = (1. - u) * (1. - 5.*u)\n    f2[~mask] = 0.\n    f2 = np.abs(np.sum(f2, axis=axis))**2\n\n    # If mad == 0 along the specified ``axis`` in the input data, return\n    # 0.0 along that axis.\n    # Ignore RuntimeWarnings for divide by zero.\n    with np.errstate(divide='ignore', invalid='ignore'):\n        value = n * f1 / f2\n        if np.isscalar(value):\n            return value\n\n        where_func = np.where\n        if isinstance(data, np.ma.MaskedArray):\n            where_func = np.ma.where  # return MaskedArray\n        return where_func(mad.squeeze() == 0, 0., value)"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":8653,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":13,"text":"__doctest_skip__"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":8654,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":151,"id":8655,"name":"WCS_FRAME_MAPPINGS","nodeType":"Attribute","startLoc":151,"text":"WCS_FRAME_MAPPINGS"},{"attributeType":"null","col":0,"comment":"null","endLoc":152,"id":8656,"name":"FRAME_WCS_MAPPINGS","nodeType":"Attribute","startLoc":152,"text":"FRAME_WCS_MAPPINGS"},{"attributeType":"custom_wcs_to_frame_mappings","col":0,"comment":"null","endLoc":169,"id":8657,"name":"custom_frame_mappings","nodeType":"Attribute","startLoc":169,"text":"custom_frame_mappings"},{"col":0,"comment":"","endLoc":3,"header":"utils.py#<anonymous>","id":8658,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__doctest_skip__ = ['wcs_to_celestial_frame', 'celestial_frame_to_wcs']\n\n__all__ = ['obsgeo_to_frame', 'add_stokes_axis_to_wcs',\n           'celestial_frame_to_wcs', 'wcs_to_celestial_frame',\n           'proj_plane_pixel_scales', 'proj_plane_pixel_area',\n           'is_proj_plane_distorted', 'non_celestial_pixel_scales',\n           'skycoord_to_pixel', 'pixel_to_skycoord',\n           'custom_wcs_to_frame_mappings', 'custom_frame_to_wcs_mappings',\n           'pixel_to_pixel', 'local_partial_pixel_derivatives',\n           'fit_wcs_from_points']\n\nWCS_FRAME_MAPPINGS = [[_wcs_to_celestial_frame_builtin]]\n\nFRAME_WCS_MAPPINGS = [[_celestial_frame_to_wcs_builtin]]\n\ncustom_frame_mappings = custom_wcs_to_frame_mappings"},{"fileName":"info_theory.py","filePath":"astropy/stats","id":8659,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module contains simple functions for model selection.\n\"\"\"\n\nimport numpy as np\n\n__all__ = ['bayesian_info_criterion', 'bayesian_info_criterion_lsq',\n           'akaike_info_criterion', 'akaike_info_criterion_lsq']\n\n__doctest_requires__ = {'bayesian_info_criterion_lsq': ['scipy'],\n                        'akaike_info_criterion_lsq': ['scipy']}\n\n\ndef bayesian_info_criterion(log_likelihood, n_params, n_samples):\n    r\"\"\" Computes the Bayesian Information Criterion (BIC) given the log of the\n    likelihood function evaluated at the estimated (or analytically derived)\n    parameters, the number of parameters, and the number of samples.\n\n    The BIC is usually applied to decide whether increasing the number of free\n    parameters (hence, increasing the model complexity) yields significantly\n    better fittings. The decision is in favor of the model with the lowest\n    BIC.\n\n    BIC is given as\n\n    .. math::\n\n        \\mathrm{BIC} = k \\ln(n) - 2L,\n\n    in which :math:`n` is the sample size, :math:`k` is the number of free\n    parameters, and :math:`L` is the log likelihood function of the model\n    evaluated at the maximum likelihood estimate (i. e., the parameters for\n    which L is maximized).\n\n    When comparing two models define\n    :math:`\\Delta \\mathrm{BIC} = \\mathrm{BIC}_h - \\mathrm{BIC}_l`, in which\n    :math:`\\mathrm{BIC}_h` is the higher BIC, and :math:`\\mathrm{BIC}_l` is\n    the lower BIC. The higher is :math:`\\Delta \\mathrm{BIC}` the stronger is\n    the evidence against the model with higher BIC.\n\n    The general rule of thumb is:\n\n    :math:`0 < \\Delta\\mathrm{BIC} \\leq 2`: weak evidence that model low is\n    better\n\n    :math:`2 < \\Delta\\mathrm{BIC} \\leq 6`: moderate evidence that model low is\n    better\n\n    :math:`6 < \\Delta\\mathrm{BIC} \\leq 10`: strong evidence that model low is\n    better\n\n    :math:`\\Delta\\mathrm{BIC} > 10`: very strong evidence that model low is\n    better\n\n    For a detailed explanation, see [1]_ - [5]_.\n\n    Parameters\n    ----------\n    log_likelihood : float\n        Logarithm of the likelihood function of the model evaluated at the\n        point of maxima (with respect to the parameter space).\n    n_params : int\n        Number of free parameters of the model, i.e., dimension of the\n        parameter space.\n    n_samples : int\n        Number of observations.\n\n    Returns\n    -------\n    bic : float\n        Bayesian Information Criterion.\n\n    Examples\n    --------\n    The following example was originally presented in [1]_. Consider a\n    Gaussian model (mu, sigma) and a t-Student model (mu, sigma, delta).\n    In addition, assume that the t model has presented a higher likelihood.\n    The question that the BIC is proposed to answer is: \"Is the increase in\n    likelihood due to larger number of parameters?\"\n\n    >>> from astropy.stats.info_theory import bayesian_info_criterion\n    >>> lnL_g = -176.4\n    >>> lnL_t = -173.0\n    >>> n_params_g = 2\n    >>> n_params_t = 3\n    >>> n_samples = 100\n    >>> bic_g = bayesian_info_criterion(lnL_g, n_params_g, n_samples)\n    >>> bic_t = bayesian_info_criterion(lnL_t, n_params_t, n_samples)\n    >>> bic_g - bic_t # doctest: +FLOAT_CMP\n    2.1948298140119391\n\n    Therefore, there exist a moderate evidence that the increasing in\n    likelihood for t-Student model is due to the larger number of parameters.\n\n    References\n    ----------\n    .. [1] Richards, D. Maximum Likelihood Estimation and the Bayesian\n       Information Criterion.\n       <https://hea-www.harvard.edu/astrostat/Stat310_0910/dr_20100323_mle.pdf>\n    .. [2] Wikipedia. Bayesian Information Criterion.\n       <https://en.wikipedia.org/wiki/Bayesian_information_criterion>\n    .. [3] Origin Lab. Comparing Two Fitting Functions.\n       <https://www.originlab.com/doc/Origin-Help/PostFit-CompareFitFunc>\n    .. [4] Liddle, A. R. Information Criteria for Astrophysical Model\n       Selection. 2008. <https://arxiv.org/pdf/astro-ph/0701113v2.pdf>\n    .. [5] Liddle, A. R. How many cosmological parameters? 2008.\n       <https://arxiv.org/pdf/astro-ph/0401198v3.pdf>\n    \"\"\"\n\n    return n_params*np.log(n_samples) - 2.0*log_likelihood\n\n\n# NOTE: bic_t - bic_g doctest is skipped because it produced slightly\n# different result in arm64 and big-endian s390x CI jobs.\ndef bayesian_info_criterion_lsq(ssr, n_params, n_samples):\n    r\"\"\"\n    Computes the Bayesian Information Criterion (BIC) assuming that the\n    observations come from a Gaussian distribution.\n\n    In this case, BIC is given as\n\n    .. math::\n\n        \\mathrm{BIC} = n\\ln\\left(\\dfrac{\\mathrm{SSR}}{n}\\right) + k\\ln(n)\n\n    in which :math:`n` is the sample size, :math:`k` is the number of free\n    parameters and :math:`\\mathrm{SSR}` stands for the sum of squared residuals\n    between model and data.\n\n    This is applicable, for instance, when the parameters of a model are\n    estimated using the least squares statistic. See [1]_ and [2]_.\n\n    Parameters\n    ----------\n    ssr : float\n        Sum of squared residuals (SSR) between model and data.\n    n_params : int\n        Number of free parameters of the model, i.e., dimension of the\n        parameter space.\n    n_samples : int\n        Number of observations.\n\n    Returns\n    -------\n    bic : float\n\n    Examples\n    --------\n    Consider the simple 1-D fitting example presented in the Astropy\n    modeling webpage [3]_. There, two models (Box and Gaussian) were fitted to\n    a source flux using the least squares statistic. However, the fittings\n    themselves do not tell much about which model better represents this\n    hypothetical source. Therefore, we are going to apply to BIC in order to\n    decide in favor of a model.\n\n    >>> import numpy as np\n    >>> from astropy.modeling import models, fitting\n    >>> from astropy.stats.info_theory import bayesian_info_criterion_lsq\n    >>> # Generate fake data\n    >>> np.random.seed(0)\n    >>> x = np.linspace(-5., 5., 200)\n    >>> y = 3 * np.exp(-0.5 * (x - 1.3)**2 / 0.8**2)\n    >>> y += np.random.normal(0., 0.2, x.shape)\n    >>> # Fit the data using a Box model.\n    >>> # Bounds are not really needed but included here to demonstrate usage.\n    >>> t_init = models.Trapezoid1D(amplitude=1., x_0=0., width=1., slope=0.5,\n    ...                             bounds={\"x_0\": (-5., 5.)})\n    >>> fit_t = fitting.LevMarLSQFitter()\n    >>> t = fit_t(t_init, x, y)\n    >>> # Fit the data using a Gaussian\n    >>> g_init = models.Gaussian1D(amplitude=1., mean=0, stddev=1.)\n    >>> fit_g = fitting.LevMarLSQFitter()\n    >>> g = fit_g(g_init, x, y)\n    >>> # Compute the mean squared errors\n    >>> ssr_t = np.sum((t(x) - y)*(t(x) - y))\n    >>> ssr_g = np.sum((g(x) - y)*(g(x) - y))\n    >>> # Compute the bics\n    >>> bic_t = bayesian_info_criterion_lsq(ssr_t, 4, x.shape[0])\n    >>> bic_g = bayesian_info_criterion_lsq(ssr_g, 3, x.shape[0])\n    >>> bic_t - bic_g  # doctest: +SKIP\n    30.644474706065466\n\n    Hence, there is a very strong evidence that the Gaussian model has a\n    significantly better representation of the data than the Box model. This\n    is, obviously, expected since the true model is Gaussian.\n\n    References\n    ----------\n    .. [1] Wikipedia. Bayesian Information Criterion.\n       <https://en.wikipedia.org/wiki/Bayesian_information_criterion>\n    .. [2] Origin Lab. Comparing Two Fitting Functions.\n       <https://www.originlab.com/doc/Origin-Help/PostFit-CompareFitFunc>\n    .. [3] Astropy Models and Fitting\n        <https://docs.astropy.org/en/stable/modeling>\n    \"\"\"\n\n    return bayesian_info_criterion(-0.5 * n_samples * np.log(ssr / n_samples),\n                                   n_params, n_samples)\n\n\ndef akaike_info_criterion(log_likelihood, n_params, n_samples):\n    r\"\"\"\n    Computes the Akaike Information Criterion (AIC).\n\n    Like the Bayesian Information Criterion, the AIC is a measure of\n    relative fitting quality which is used for fitting evaluation and model\n    selection. The decision is in favor of the model with the lowest AIC.\n\n    AIC is given as\n\n    .. math::\n\n        \\mathrm{AIC} = 2(k - L)\n\n    in which :math:`n` is the sample size, :math:`k` is the number of free\n    parameters, and :math:`L` is the log likelihood function of the model\n    evaluated at the maximum likelihood estimate (i. e., the parameters for\n    which L is maximized).\n\n    In case that the sample size is not \"large enough\" a correction is\n    applied, i.e.\n\n    .. math::\n\n        \\mathrm{AIC} = 2(k - L) + \\dfrac{2k(k+1)}{n - k - 1}\n\n    Rule of thumb [1]_:\n\n    :math:`\\Delta\\mathrm{AIC}_i = \\mathrm{AIC}_i - \\mathrm{AIC}_{min}`\n\n    :math:`\\Delta\\mathrm{AIC}_i < 2`: substantial support for model i\n\n    :math:`3 < \\Delta\\mathrm{AIC}_i < 7`: considerably less support for model i\n\n    :math:`\\Delta\\mathrm{AIC}_i > 10`: essentially none support for model i\n\n    in which :math:`\\mathrm{AIC}_{min}` stands for the lower AIC among the\n    models which are being compared.\n\n    For detailed explanations see [1]_-[6]_.\n\n    Parameters\n    ----------\n    log_likelihood : float\n        Logarithm of the likelihood function of the model evaluated at the\n        point of maxima (with respect to the parameter space).\n    n_params : int\n        Number of free parameters of the model, i.e., dimension of the\n        parameter space.\n    n_samples : int\n        Number of observations.\n\n    Returns\n    -------\n    aic : float\n        Akaike Information Criterion.\n\n    Examples\n    --------\n    The following example was originally presented in [2]_. Basically, two\n    models are being compared. One with six parameters (model 1) and another\n    with five parameters (model 2). Despite of the fact that model 2 has a\n    lower AIC, we could decide in favor of model 1 since the difference (in\n    AIC)  between them is only about 1.0.\n\n    >>> n_samples = 121\n    >>> lnL1 = -3.54\n    >>> n1_params = 6\n    >>> lnL2 = -4.17\n    >>> n2_params = 5\n    >>> aic1 = akaike_info_criterion(lnL1, n1_params, n_samples)\n    >>> aic2 = akaike_info_criterion(lnL2, n2_params, n_samples)\n    >>> aic1 - aic2 # doctest: +FLOAT_CMP\n    0.9551029748283746\n\n    Therefore, we can strongly support the model 1 with the advantage that\n    it has more free parameters.\n\n    References\n    ----------\n    .. [1] Cavanaugh, J. E.  Model Selection Lecture II: The Akaike\n       Information Criterion.\n       <http://machinelearning102.pbworks.com/w/file/fetch/47699383/ms_lec_2_ho.pdf>\n    .. [2] Mazerolle, M. J. Making sense out of Akaike's Information\n       Criterion (AIC): its use and interpretation in model selection and\n       inference from ecological data.\n       <https://corpus.ulaval.ca/jspui/handle/20.500.11794/17461>\n    .. [3] Wikipedia. Akaike Information Criterion.\n       <https://en.wikipedia.org/wiki/Akaike_information_criterion>\n    .. [4] Origin Lab. Comparing Two Fitting Functions.\n       <https://www.originlab.com/doc/Origin-Help/PostFit-CompareFitFunc>\n    .. [5] Liddle, A. R. Information Criteria for Astrophysical Model\n       Selection. 2008. <https://arxiv.org/pdf/astro-ph/0701113v2.pdf>\n    .. [6] Liddle, A. R. How many cosmological parameters? 2008.\n       <https://arxiv.org/pdf/astro-ph/0401198v3.pdf>\n    \"\"\"\n    # Correction in case of small number of observations\n    if n_samples/float(n_params) >= 40.0:\n        aic = 2.0 * (n_params - log_likelihood)\n    else:\n        aic = (2.0 * (n_params - log_likelihood) +\n               2.0 * n_params * (n_params + 1.0) /\n               (n_samples - n_params - 1.0))\n    return aic\n\n\ndef akaike_info_criterion_lsq(ssr, n_params, n_samples):\n    r\"\"\"\n    Computes the Akaike Information Criterion assuming that the observations\n    are Gaussian distributed.\n\n    In this case, AIC is given as\n\n    .. math::\n\n        \\mathrm{AIC} = n\\ln\\left(\\dfrac{\\mathrm{SSR}}{n}\\right) + 2k\n\n    In case that the sample size is not \"large enough\", a correction is\n    applied, i.e.\n\n    .. math::\n\n        \\mathrm{AIC} = n\\ln\\left(\\dfrac{\\mathrm{SSR}}{n}\\right) + 2k +\n                       \\dfrac{2k(k+1)}{n-k-1}\n\n\n    in which :math:`n` is the sample size, :math:`k` is the number of free\n    parameters and :math:`\\mathrm{SSR}` stands for the sum of squared residuals\n    between model and data.\n\n    This is applicable, for instance, when the parameters of a model are\n    estimated using the least squares statistic.\n\n    Parameters\n    ----------\n    ssr : float\n        Sum of squared residuals (SSR) between model and data.\n    n_params : int\n        Number of free parameters of the model, i.e.,  the dimension of the\n        parameter space.\n    n_samples : int\n        Number of observations.\n\n    Returns\n    -------\n    aic : float\n        Akaike Information Criterion.\n\n    Examples\n    --------\n    This example is based on Astropy Modeling webpage, Compound models\n    section.\n\n    >>> import numpy as np\n    >>> from astropy.modeling import models, fitting\n    >>> from astropy.stats.info_theory import akaike_info_criterion_lsq\n    >>> np.random.seed(42)\n    >>> # Generate fake data\n    >>> g1 = models.Gaussian1D(.1, 0, 0.2) # changed this to noise level\n    >>> g2 = models.Gaussian1D(.1, 0.3, 0.2) # and added another Gaussian\n    >>> g3 = models.Gaussian1D(2.5, 0.5, 0.1)\n    >>> x = np.linspace(-1, 1, 200)\n    >>> y = g1(x) + g2(x) + g3(x) + np.random.normal(0., 0.2, x.shape)\n    >>> # Fit with three Gaussians\n    >>> g3_init = (models.Gaussian1D(.1, 0, 0.1)\n    ...            + models.Gaussian1D(.1, 0.2, 0.15)\n    ...            + models.Gaussian1D(2.4, .4, 0.1))\n    >>> fitter = fitting.LevMarLSQFitter()\n    >>> g3_fit = fitter(g3_init, x, y)\n    >>> # Fit with two Gaussians\n    >>> g2_init = (models.Gaussian1D(.1, 0, 0.1) +\n    ...            models.Gaussian1D(2, 0.5, 0.1))\n    >>> g2_fit = fitter(g2_init, x, y)\n    >>> # Fit with only one Gaussian\n    >>> g1_init = models.Gaussian1D(amplitude=2., mean=0.3, stddev=.5)\n    >>> g1_fit = fitter(g1_init, x, y)\n    >>> # Compute the mean squared errors\n    >>> ssr_g3 = np.sum((g3_fit(x) - y)**2.0)\n    >>> ssr_g2 = np.sum((g2_fit(x) - y)**2.0)\n    >>> ssr_g1 = np.sum((g1_fit(x) - y)**2.0)\n    >>> akaike_info_criterion_lsq(ssr_g3, 9, x.shape[0]) # doctest: +FLOAT_CMP\n    -634.5257517810961\n    >>> akaike_info_criterion_lsq(ssr_g2, 6, x.shape[0]) # doctest: +FLOAT_CMP\n    -662.83834510232043\n    >>> akaike_info_criterion_lsq(ssr_g1, 3, x.shape[0]) # doctest: +FLOAT_CMP\n    -647.47312032659499\n\n    Hence, from the AIC values, we would prefer to choose the model g2_fit.\n    However, we can considerably support the model g3_fit, since the\n    difference in AIC is about 2.4. We should reject the model g1_fit.\n\n    References\n    ----------\n    .. [1] Akaike Information Criterion.\n       <https://en.wikipedia.org/wiki/Akaike_information_criterion>\n    .. [2] Origin Lab. Comparing Two Fitting Functions.\n       <https://www.originlab.com/doc/Origin-Help/PostFit-CompareFitFunc>\n    \"\"\"\n\n    return akaike_info_criterion(-0.5 * n_samples * np.log(ssr / n_samples),\n                                 n_params, n_samples)\n"},{"col":4,"comment":"Parse the time strings contained in val1 and set jd1, jd2","endLoc":1338,"header":"def set_jds(self, val1, val2)","id":8660,"name":"set_jds","nodeType":"Function","startLoc":1317,"text":"def set_jds(self, val1, val2):\n        \"\"\"Parse the time strings contained in val1 and set jd1, jd2\"\"\"\n        # If specific input subformat is required then use the Python parser.\n        # Also do this if Time format class does not define `use_fast_parser` or\n        # if the fast parser is entirely disabled. Note that `use_fast_parser`\n        # is ignored for format classes that don't have a fast parser.\n        if (self.in_subfmt != '*'\n                or '_fast_parser' not in self.__class__.__dict__\n                or conf.use_fast_parser == 'False'):\n            jd1, jd2 = self.get_jds_python(val1, val2)\n        else:\n            try:\n                jd1, jd2 = self.get_jds_fast(val1, val2)\n            except Exception:\n                # Fall through to the Python parser unless fast is forced.\n                if conf.use_fast_parser == 'force':\n                    raise\n                else:\n                    jd1, jd2 = self.get_jds_python(val1, val2)\n\n        self.jd1 = jd1\n        self.jd2 = jd2"},{"col":0,"comment":" Computes the Bayesian Information Criterion (BIC) given the log of the\n    likelihood function evaluated at the estimated (or analytically derived)\n    parameters, the number of parameters, and the number of samples.\n\n    The BIC is usually applied to decide whether increasing the number of free\n    parameters (hence, increasing the model complexity) yields significantly\n    better fittings. The decision is in favor of the model with the lowest\n    BIC.\n\n    BIC is given as\n\n    .. math::\n\n        \\mathrm{BIC} = k \\ln(n) - 2L,\n\n    in which :math:`n` is the sample size, :math:`k` is the number of free\n    parameters, and :math:`L` is the log likelihood function of the model\n    evaluated at the maximum likelihood estimate (i. e., the parameters for\n    which L is maximized).\n\n    When comparing two models define\n    :math:`\\Delta \\mathrm{BIC} = \\mathrm{BIC}_h - \\mathrm{BIC}_l`, in which\n    :math:`\\mathrm{BIC}_h` is the higher BIC, and :math:`\\mathrm{BIC}_l` is\n    the lower BIC. The higher is :math:`\\Delta \\mathrm{BIC}` the stronger is\n    the evidence against the model with higher BIC.\n\n    The general rule of thumb is:\n\n    :math:`0 < \\Delta\\mathrm{BIC} \\leq 2`: weak evidence that model low is\n    better\n\n    :math:`2 < \\Delta\\mathrm{BIC} \\leq 6`: moderate evidence that model low is\n    better\n\n    :math:`6 < \\Delta\\mathrm{BIC} \\leq 10`: strong evidence that model low is\n    better\n\n    :math:`\\Delta\\mathrm{BIC} > 10`: very strong evidence that model low is\n    better\n\n    For a detailed explanation, see [1]_ - [5]_.\n\n    Parameters\n    ----------\n    log_likelihood : float\n        Logarithm of the likelihood function of the model evaluated at the\n        point of maxima (with respect to the parameter space).\n    n_params : int\n        Number of free parameters of the model, i.e., dimension of the\n        parameter space.\n    n_samples : int\n        Number of observations.\n\n    Returns\n    -------\n    bic : float\n        Bayesian Information Criterion.\n\n    Examples\n    --------\n    The following example was originally presented in [1]_. Consider a\n    Gaussian model (mu, sigma) and a t-Student model (mu, sigma, delta).\n    In addition, assume that the t model has presented a higher likelihood.\n    The question that the BIC is proposed to answer is: \"Is the increase in\n    likelihood due to larger number of parameters?\"\n\n    >>> from astropy.stats.info_theory import bayesian_info_criterion\n    >>> lnL_g = -176.4\n    >>> lnL_t = -173.0\n    >>> n_params_g = 2\n    >>> n_params_t = 3\n    >>> n_samples = 100\n    >>> bic_g = bayesian_info_criterion(lnL_g, n_params_g, n_samples)\n    >>> bic_t = bayesian_info_criterion(lnL_t, n_params_t, n_samples)\n    >>> bic_g - bic_t # doctest: +FLOAT_CMP\n    2.1948298140119391\n\n    Therefore, there exist a moderate evidence that the increasing in\n    likelihood for t-Student model is due to the larger number of parameters.\n\n    References\n    ----------\n    .. [1] Richards, D. Maximum Likelihood Estimation and the Bayesian\n       Information Criterion.\n       <https://hea-www.harvard.edu/astrostat/Stat310_0910/dr_20100323_mle.pdf>\n    .. [2] Wikipedia. Bayesian Information Criterion.\n       <https://en.wikipedia.org/wiki/Bayesian_information_criterion>\n    .. [3] Origin Lab. Comparing Two Fitting Functions.\n       <https://www.originlab.com/doc/Origin-Help/PostFit-CompareFitFunc>\n    .. [4] Liddle, A. R. Information Criteria for Astrophysical Model\n       Selection. 2008. <https://arxiv.org/pdf/astro-ph/0701113v2.pdf>\n    .. [5] Liddle, A. R. How many cosmological parameters? 2008.\n       <https://arxiv.org/pdf/astro-ph/0401198v3.pdf>\n    ","endLoc":112,"header":"def bayesian_info_criterion(log_likelihood, n_params, n_samples)","id":8661,"name":"bayesian_info_criterion","nodeType":"Function","startLoc":16,"text":"def bayesian_info_criterion(log_likelihood, n_params, n_samples):\n    r\"\"\" Computes the Bayesian Information Criterion (BIC) given the log of the\n    likelihood function evaluated at the estimated (or analytically derived)\n    parameters, the number of parameters, and the number of samples.\n\n    The BIC is usually applied to decide whether increasing the number of free\n    parameters (hence, increasing the model complexity) yields significantly\n    better fittings. The decision is in favor of the model with the lowest\n    BIC.\n\n    BIC is given as\n\n    .. math::\n\n        \\mathrm{BIC} = k \\ln(n) - 2L,\n\n    in which :math:`n` is the sample size, :math:`k` is the number of free\n    parameters, and :math:`L` is the log likelihood function of the model\n    evaluated at the maximum likelihood estimate (i. e., the parameters for\n    which L is maximized).\n\n    When comparing two models define\n    :math:`\\Delta \\mathrm{BIC} = \\mathrm{BIC}_h - \\mathrm{BIC}_l`, in which\n    :math:`\\mathrm{BIC}_h` is the higher BIC, and :math:`\\mathrm{BIC}_l` is\n    the lower BIC. The higher is :math:`\\Delta \\mathrm{BIC}` the stronger is\n    the evidence against the model with higher BIC.\n\n    The general rule of thumb is:\n\n    :math:`0 < \\Delta\\mathrm{BIC} \\leq 2`: weak evidence that model low is\n    better\n\n    :math:`2 < \\Delta\\mathrm{BIC} \\leq 6`: moderate evidence that model low is\n    better\n\n    :math:`6 < \\Delta\\mathrm{BIC} \\leq 10`: strong evidence that model low is\n    better\n\n    :math:`\\Delta\\mathrm{BIC} > 10`: very strong evidence that model low is\n    better\n\n    For a detailed explanation, see [1]_ - [5]_.\n\n    Parameters\n    ----------\n    log_likelihood : float\n        Logarithm of the likelihood function of the model evaluated at the\n        point of maxima (with respect to the parameter space).\n    n_params : int\n        Number of free parameters of the model, i.e., dimension of the\n        parameter space.\n    n_samples : int\n        Number of observations.\n\n    Returns\n    -------\n    bic : float\n        Bayesian Information Criterion.\n\n    Examples\n    --------\n    The following example was originally presented in [1]_. Consider a\n    Gaussian model (mu, sigma) and a t-Student model (mu, sigma, delta).\n    In addition, assume that the t model has presented a higher likelihood.\n    The question that the BIC is proposed to answer is: \"Is the increase in\n    likelihood due to larger number of parameters?\"\n\n    >>> from astropy.stats.info_theory import bayesian_info_criterion\n    >>> lnL_g = -176.4\n    >>> lnL_t = -173.0\n    >>> n_params_g = 2\n    >>> n_params_t = 3\n    >>> n_samples = 100\n    >>> bic_g = bayesian_info_criterion(lnL_g, n_params_g, n_samples)\n    >>> bic_t = bayesian_info_criterion(lnL_t, n_params_t, n_samples)\n    >>> bic_g - bic_t # doctest: +FLOAT_CMP\n    2.1948298140119391\n\n    Therefore, there exist a moderate evidence that the increasing in\n    likelihood for t-Student model is due to the larger number of parameters.\n\n    References\n    ----------\n    .. [1] Richards, D. Maximum Likelihood Estimation and the Bayesian\n       Information Criterion.\n       <https://hea-www.harvard.edu/astrostat/Stat310_0910/dr_20100323_mle.pdf>\n    .. [2] Wikipedia. Bayesian Information Criterion.\n       <https://en.wikipedia.org/wiki/Bayesian_information_criterion>\n    .. [3] Origin Lab. Comparing Two Fitting Functions.\n       <https://www.originlab.com/doc/Origin-Help/PostFit-CompareFitFunc>\n    .. [4] Liddle, A. R. Information Criteria for Astrophysical Model\n       Selection. 2008. <https://arxiv.org/pdf/astro-ph/0701113v2.pdf>\n    .. [5] Liddle, A. R. How many cosmological parameters? 2008.\n       <https://arxiv.org/pdf/astro-ph/0401198v3.pdf>\n    \"\"\"\n\n    return n_params*np.log(n_samples) - 2.0*log_likelihood"},{"col":0,"comment":"\n    Computes the Bayesian Information Criterion (BIC) assuming that the\n    observations come from a Gaussian distribution.\n\n    In this case, BIC is given as\n\n    .. math::\n\n        \\mathrm{BIC} = n\\ln\\left(\\dfrac{\\mathrm{SSR}}{n}\\right) + k\\ln(n)\n\n    in which :math:`n` is the sample size, :math:`k` is the number of free\n    parameters and :math:`\\mathrm{SSR}` stands for the sum of squared residuals\n    between model and data.\n\n    This is applicable, for instance, when the parameters of a model are\n    estimated using the least squares statistic. See [1]_ and [2]_.\n\n    Parameters\n    ----------\n    ssr : float\n        Sum of squared residuals (SSR) between model and data.\n    n_params : int\n        Number of free parameters of the model, i.e., dimension of the\n        parameter space.\n    n_samples : int\n        Number of observations.\n\n    Returns\n    -------\n    bic : float\n\n    Examples\n    --------\n    Consider the simple 1-D fitting example presented in the Astropy\n    modeling webpage [3]_. There, two models (Box and Gaussian) were fitted to\n    a source flux using the least squares statistic. However, the fittings\n    themselves do not tell much about which model better represents this\n    hypothetical source. Therefore, we are going to apply to BIC in order to\n    decide in favor of a model.\n\n    >>> import numpy as np\n    >>> from astropy.modeling import models, fitting\n    >>> from astropy.stats.info_theory import bayesian_info_criterion_lsq\n    >>> # Generate fake data\n    >>> np.random.seed(0)\n    >>> x = np.linspace(-5., 5., 200)\n    >>> y = 3 * np.exp(-0.5 * (x - 1.3)**2 / 0.8**2)\n    >>> y += np.random.normal(0., 0.2, x.shape)\n    >>> # Fit the data using a Box model.\n    >>> # Bounds are not really needed but included here to demonstrate usage.\n    >>> t_init = models.Trapezoid1D(amplitude=1., x_0=0., width=1., slope=0.5,\n    ...                             bounds={\"x_0\": (-5., 5.)})\n    >>> fit_t = fitting.LevMarLSQFitter()\n    >>> t = fit_t(t_init, x, y)\n    >>> # Fit the data using a Gaussian\n    >>> g_init = models.Gaussian1D(amplitude=1., mean=0, stddev=1.)\n    >>> fit_g = fitting.LevMarLSQFitter()\n    >>> g = fit_g(g_init, x, y)\n    >>> # Compute the mean squared errors\n    >>> ssr_t = np.sum((t(x) - y)*(t(x) - y))\n    >>> ssr_g = np.sum((g(x) - y)*(g(x) - y))\n    >>> # Compute the bics\n    >>> bic_t = bayesian_info_criterion_lsq(ssr_t, 4, x.shape[0])\n    >>> bic_g = bayesian_info_criterion_lsq(ssr_g, 3, x.shape[0])\n    >>> bic_t - bic_g  # doctest: +SKIP\n    30.644474706065466\n\n    Hence, there is a very strong evidence that the Gaussian model has a\n    significantly better representation of the data than the Box model. This\n    is, obviously, expected since the true model is Gaussian.\n\n    References\n    ----------\n    .. [1] Wikipedia. Bayesian Information Criterion.\n       <https://en.wikipedia.org/wiki/Bayesian_information_criterion>\n    .. [2] Origin Lab. Comparing Two Fitting Functions.\n       <https://www.originlab.com/doc/Origin-Help/PostFit-CompareFitFunc>\n    .. [3] Astropy Models and Fitting\n        <https://docs.astropy.org/en/stable/modeling>\n    ","endLoc":200,"header":"def bayesian_info_criterion_lsq(ssr, n_params, n_samples)","id":8662,"name":"bayesian_info_criterion_lsq","nodeType":"Function","startLoc":117,"text":"def bayesian_info_criterion_lsq(ssr, n_params, n_samples):\n    r\"\"\"\n    Computes the Bayesian Information Criterion (BIC) assuming that the\n    observations come from a Gaussian distribution.\n\n    In this case, BIC is given as\n\n    .. math::\n\n        \\mathrm{BIC} = n\\ln\\left(\\dfrac{\\mathrm{SSR}}{n}\\right) + k\\ln(n)\n\n    in which :math:`n` is the sample size, :math:`k` is the number of free\n    parameters and :math:`\\mathrm{SSR}` stands for the sum of squared residuals\n    between model and data.\n\n    This is applicable, for instance, when the parameters of a model are\n    estimated using the least squares statistic. See [1]_ and [2]_.\n\n    Parameters\n    ----------\n    ssr : float\n        Sum of squared residuals (SSR) between model and data.\n    n_params : int\n        Number of free parameters of the model, i.e., dimension of the\n        parameter space.\n    n_samples : int\n        Number of observations.\n\n    Returns\n    -------\n    bic : float\n\n    Examples\n    --------\n    Consider the simple 1-D fitting example presented in the Astropy\n    modeling webpage [3]_. There, two models (Box and Gaussian) were fitted to\n    a source flux using the least squares statistic. However, the fittings\n    themselves do not tell much about which model better represents this\n    hypothetical source. Therefore, we are going to apply to BIC in order to\n    decide in favor of a model.\n\n    >>> import numpy as np\n    >>> from astropy.modeling import models, fitting\n    >>> from astropy.stats.info_theory import bayesian_info_criterion_lsq\n    >>> # Generate fake data\n    >>> np.random.seed(0)\n    >>> x = np.linspace(-5., 5., 200)\n    >>> y = 3 * np.exp(-0.5 * (x - 1.3)**2 / 0.8**2)\n    >>> y += np.random.normal(0., 0.2, x.shape)\n    >>> # Fit the data using a Box model.\n    >>> # Bounds are not really needed but included here to demonstrate usage.\n    >>> t_init = models.Trapezoid1D(amplitude=1., x_0=0., width=1., slope=0.5,\n    ...                             bounds={\"x_0\": (-5., 5.)})\n    >>> fit_t = fitting.LevMarLSQFitter()\n    >>> t = fit_t(t_init, x, y)\n    >>> # Fit the data using a Gaussian\n    >>> g_init = models.Gaussian1D(amplitude=1., mean=0, stddev=1.)\n    >>> fit_g = fitting.LevMarLSQFitter()\n    >>> g = fit_g(g_init, x, y)\n    >>> # Compute the mean squared errors\n    >>> ssr_t = np.sum((t(x) - y)*(t(x) - y))\n    >>> ssr_g = np.sum((g(x) - y)*(g(x) - y))\n    >>> # Compute the bics\n    >>> bic_t = bayesian_info_criterion_lsq(ssr_t, 4, x.shape[0])\n    >>> bic_g = bayesian_info_criterion_lsq(ssr_g, 3, x.shape[0])\n    >>> bic_t - bic_g  # doctest: +SKIP\n    30.644474706065466\n\n    Hence, there is a very strong evidence that the Gaussian model has a\n    significantly better representation of the data than the Box model. This\n    is, obviously, expected since the true model is Gaussian.\n\n    References\n    ----------\n    .. [1] Wikipedia. Bayesian Information Criterion.\n       <https://en.wikipedia.org/wiki/Bayesian_information_criterion>\n    .. [2] Origin Lab. Comparing Two Fitting Functions.\n       <https://www.originlab.com/doc/Origin-Help/PostFit-CompareFitFunc>\n    .. [3] Astropy Models and Fitting\n        <https://docs.astropy.org/en/stable/modeling>\n    \"\"\"\n\n    return bayesian_info_criterion(-0.5 * n_samples * np.log(ssr / n_samples),\n                                   n_params, n_samples)"},{"col":0,"comment":"\n    Computes the Akaike Information Criterion (AIC).\n\n    Like the Bayesian Information Criterion, the AIC is a measure of\n    relative fitting quality which is used for fitting evaluation and model\n    selection. The decision is in favor of the model with the lowest AIC.\n\n    AIC is given as\n\n    .. math::\n\n        \\mathrm{AIC} = 2(k - L)\n\n    in which :math:`n` is the sample size, :math:`k` is the number of free\n    parameters, and :math:`L` is the log likelihood function of the model\n    evaluated at the maximum likelihood estimate (i. e., the parameters for\n    which L is maximized).\n\n    In case that the sample size is not \"large enough\" a correction is\n    applied, i.e.\n\n    .. math::\n\n        \\mathrm{AIC} = 2(k - L) + \\dfrac{2k(k+1)}{n - k - 1}\n\n    Rule of thumb [1]_:\n\n    :math:`\\Delta\\mathrm{AIC}_i = \\mathrm{AIC}_i - \\mathrm{AIC}_{min}`\n\n    :math:`\\Delta\\mathrm{AIC}_i < 2`: substantial support for model i\n\n    :math:`3 < \\Delta\\mathrm{AIC}_i < 7`: considerably less support for model i\n\n    :math:`\\Delta\\mathrm{AIC}_i > 10`: essentially none support for model i\n\n    in which :math:`\\mathrm{AIC}_{min}` stands for the lower AIC among the\n    models which are being compared.\n\n    For detailed explanations see [1]_-[6]_.\n\n    Parameters\n    ----------\n    log_likelihood : float\n        Logarithm of the likelihood function of the model evaluated at the\n        point of maxima (with respect to the parameter space).\n    n_params : int\n        Number of free parameters of the model, i.e., dimension of the\n        parameter space.\n    n_samples : int\n        Number of observations.\n\n    Returns\n    -------\n    aic : float\n        Akaike Information Criterion.\n\n    Examples\n    --------\n    The following example was originally presented in [2]_. Basically, two\n    models are being compared. One with six parameters (model 1) and another\n    with five parameters (model 2). Despite of the fact that model 2 has a\n    lower AIC, we could decide in favor of model 1 since the difference (in\n    AIC)  between them is only about 1.0.\n\n    >>> n_samples = 121\n    >>> lnL1 = -3.54\n    >>> n1_params = 6\n    >>> lnL2 = -4.17\n    >>> n2_params = 5\n    >>> aic1 = akaike_info_criterion(lnL1, n1_params, n_samples)\n    >>> aic2 = akaike_info_criterion(lnL2, n2_params, n_samples)\n    >>> aic1 - aic2 # doctest: +FLOAT_CMP\n    0.9551029748283746\n\n    Therefore, we can strongly support the model 1 with the advantage that\n    it has more free parameters.\n\n    References\n    ----------\n    .. [1] Cavanaugh, J. E.  Model Selection Lecture II: The Akaike\n       Information Criterion.\n       <http://machinelearning102.pbworks.com/w/file/fetch/47699383/ms_lec_2_ho.pdf>\n    .. [2] Mazerolle, M. J. Making sense out of Akaike's Information\n       Criterion (AIC): its use and interpretation in model selection and\n       inference from ecological data.\n       <https://corpus.ulaval.ca/jspui/handle/20.500.11794/17461>\n    .. [3] Wikipedia. Akaike Information Criterion.\n       <https://en.wikipedia.org/wiki/Akaike_information_criterion>\n    .. [4] Origin Lab. Comparing Two Fitting Functions.\n       <https://www.originlab.com/doc/Origin-Help/PostFit-CompareFitFunc>\n    .. [5] Liddle, A. R. Information Criteria for Astrophysical Model\n       Selection. 2008. <https://arxiv.org/pdf/astro-ph/0701113v2.pdf>\n    .. [6] Liddle, A. R. How many cosmological parameters? 2008.\n       <https://arxiv.org/pdf/astro-ph/0401198v3.pdf>\n    ","endLoc":306,"header":"def akaike_info_criterion(log_likelihood, n_params, n_samples)","id":8663,"name":"akaike_info_criterion","nodeType":"Function","startLoc":203,"text":"def akaike_info_criterion(log_likelihood, n_params, n_samples):\n    r\"\"\"\n    Computes the Akaike Information Criterion (AIC).\n\n    Like the Bayesian Information Criterion, the AIC is a measure of\n    relative fitting quality which is used for fitting evaluation and model\n    selection. The decision is in favor of the model with the lowest AIC.\n\n    AIC is given as\n\n    .. math::\n\n        \\mathrm{AIC} = 2(k - L)\n\n    in which :math:`n` is the sample size, :math:`k` is the number of free\n    parameters, and :math:`L` is the log likelihood function of the model\n    evaluated at the maximum likelihood estimate (i. e., the parameters for\n    which L is maximized).\n\n    In case that the sample size is not \"large enough\" a correction is\n    applied, i.e.\n\n    .. math::\n\n        \\mathrm{AIC} = 2(k - L) + \\dfrac{2k(k+1)}{n - k - 1}\n\n    Rule of thumb [1]_:\n\n    :math:`\\Delta\\mathrm{AIC}_i = \\mathrm{AIC}_i - \\mathrm{AIC}_{min}`\n\n    :math:`\\Delta\\mathrm{AIC}_i < 2`: substantial support for model i\n\n    :math:`3 < \\Delta\\mathrm{AIC}_i < 7`: considerably less support for model i\n\n    :math:`\\Delta\\mathrm{AIC}_i > 10`: essentially none support for model i\n\n    in which :math:`\\mathrm{AIC}_{min}` stands for the lower AIC among the\n    models which are being compared.\n\n    For detailed explanations see [1]_-[6]_.\n\n    Parameters\n    ----------\n    log_likelihood : float\n        Logarithm of the likelihood function of the model evaluated at the\n        point of maxima (with respect to the parameter space).\n    n_params : int\n        Number of free parameters of the model, i.e., dimension of the\n        parameter space.\n    n_samples : int\n        Number of observations.\n\n    Returns\n    -------\n    aic : float\n        Akaike Information Criterion.\n\n    Examples\n    --------\n    The following example was originally presented in [2]_. Basically, two\n    models are being compared. One with six parameters (model 1) and another\n    with five parameters (model 2). Despite of the fact that model 2 has a\n    lower AIC, we could decide in favor of model 1 since the difference (in\n    AIC)  between them is only about 1.0.\n\n    >>> n_samples = 121\n    >>> lnL1 = -3.54\n    >>> n1_params = 6\n    >>> lnL2 = -4.17\n    >>> n2_params = 5\n    >>> aic1 = akaike_info_criterion(lnL1, n1_params, n_samples)\n    >>> aic2 = akaike_info_criterion(lnL2, n2_params, n_samples)\n    >>> aic1 - aic2 # doctest: +FLOAT_CMP\n    0.9551029748283746\n\n    Therefore, we can strongly support the model 1 with the advantage that\n    it has more free parameters.\n\n    References\n    ----------\n    .. [1] Cavanaugh, J. E.  Model Selection Lecture II: The Akaike\n       Information Criterion.\n       <http://machinelearning102.pbworks.com/w/file/fetch/47699383/ms_lec_2_ho.pdf>\n    .. [2] Mazerolle, M. J. Making sense out of Akaike's Information\n       Criterion (AIC): its use and interpretation in model selection and\n       inference from ecological data.\n       <https://corpus.ulaval.ca/jspui/handle/20.500.11794/17461>\n    .. [3] Wikipedia. Akaike Information Criterion.\n       <https://en.wikipedia.org/wiki/Akaike_information_criterion>\n    .. [4] Origin Lab. Comparing Two Fitting Functions.\n       <https://www.originlab.com/doc/Origin-Help/PostFit-CompareFitFunc>\n    .. [5] Liddle, A. R. Information Criteria for Astrophysical Model\n       Selection. 2008. <https://arxiv.org/pdf/astro-ph/0701113v2.pdf>\n    .. [6] Liddle, A. R. How many cosmological parameters? 2008.\n       <https://arxiv.org/pdf/astro-ph/0401198v3.pdf>\n    \"\"\"\n    # Correction in case of small number of observations\n    if n_samples/float(n_params) >= 40.0:\n        aic = 2.0 * (n_params - log_likelihood)\n    else:\n        aic = (2.0 * (n_params - log_likelihood) +\n               2.0 * n_params * (n_params + 1.0) /\n               (n_samples - n_params - 1.0))\n    return aic"},{"col":0,"comment":"\n    Computes the Akaike Information Criterion assuming that the observations\n    are Gaussian distributed.\n\n    In this case, AIC is given as\n\n    .. math::\n\n        \\mathrm{AIC} = n\\ln\\left(\\dfrac{\\mathrm{SSR}}{n}\\right) + 2k\n\n    In case that the sample size is not \"large enough\", a correction is\n    applied, i.e.\n\n    .. math::\n\n        \\mathrm{AIC} = n\\ln\\left(\\dfrac{\\mathrm{SSR}}{n}\\right) + 2k +\n                       \\dfrac{2k(k+1)}{n-k-1}\n\n\n    in which :math:`n` is the sample size, :math:`k` is the number of free\n    parameters and :math:`\\mathrm{SSR}` stands for the sum of squared residuals\n    between model and data.\n\n    This is applicable, for instance, when the parameters of a model are\n    estimated using the least squares statistic.\n\n    Parameters\n    ----------\n    ssr : float\n        Sum of squared residuals (SSR) between model and data.\n    n_params : int\n        Number of free parameters of the model, i.e.,  the dimension of the\n        parameter space.\n    n_samples : int\n        Number of observations.\n\n    Returns\n    -------\n    aic : float\n        Akaike Information Criterion.\n\n    Examples\n    --------\n    This example is based on Astropy Modeling webpage, Compound models\n    section.\n\n    >>> import numpy as np\n    >>> from astropy.modeling import models, fitting\n    >>> from astropy.stats.info_theory import akaike_info_criterion_lsq\n    >>> np.random.seed(42)\n    >>> # Generate fake data\n    >>> g1 = models.Gaussian1D(.1, 0, 0.2) # changed this to noise level\n    >>> g2 = models.Gaussian1D(.1, 0.3, 0.2) # and added another Gaussian\n    >>> g3 = models.Gaussian1D(2.5, 0.5, 0.1)\n    >>> x = np.linspace(-1, 1, 200)\n    >>> y = g1(x) + g2(x) + g3(x) + np.random.normal(0., 0.2, x.shape)\n    >>> # Fit with three Gaussians\n    >>> g3_init = (models.Gaussian1D(.1, 0, 0.1)\n    ...            + models.Gaussian1D(.1, 0.2, 0.15)\n    ...            + models.Gaussian1D(2.4, .4, 0.1))\n    >>> fitter = fitting.LevMarLSQFitter()\n    >>> g3_fit = fitter(g3_init, x, y)\n    >>> # Fit with two Gaussians\n    >>> g2_init = (models.Gaussian1D(.1, 0, 0.1) +\n    ...            models.Gaussian1D(2, 0.5, 0.1))\n    >>> g2_fit = fitter(g2_init, x, y)\n    >>> # Fit with only one Gaussian\n    >>> g1_init = models.Gaussian1D(amplitude=2., mean=0.3, stddev=.5)\n    >>> g1_fit = fitter(g1_init, x, y)\n    >>> # Compute the mean squared errors\n    >>> ssr_g3 = np.sum((g3_fit(x) - y)**2.0)\n    >>> ssr_g2 = np.sum((g2_fit(x) - y)**2.0)\n    >>> ssr_g1 = np.sum((g1_fit(x) - y)**2.0)\n    >>> akaike_info_criterion_lsq(ssr_g3, 9, x.shape[0]) # doctest: +FLOAT_CMP\n    -634.5257517810961\n    >>> akaike_info_criterion_lsq(ssr_g2, 6, x.shape[0]) # doctest: +FLOAT_CMP\n    -662.83834510232043\n    >>> akaike_info_criterion_lsq(ssr_g1, 3, x.shape[0]) # doctest: +FLOAT_CMP\n    -647.47312032659499\n\n    Hence, from the AIC values, we would prefer to choose the model g2_fit.\n    However, we can considerably support the model g3_fit, since the\n    difference in AIC is about 2.4. We should reject the model g1_fit.\n\n    References\n    ----------\n    .. [1] Akaike Information Criterion.\n       <https://en.wikipedia.org/wiki/Akaike_information_criterion>\n    .. [2] Origin Lab. Comparing Two Fitting Functions.\n       <https://www.originlab.com/doc/Origin-Help/PostFit-CompareFitFunc>\n    ","endLoc":403,"header":"def akaike_info_criterion_lsq(ssr, n_params, n_samples)","id":8664,"name":"akaike_info_criterion_lsq","nodeType":"Function","startLoc":309,"text":"def akaike_info_criterion_lsq(ssr, n_params, n_samples):\n    r\"\"\"\n    Computes the Akaike Information Criterion assuming that the observations\n    are Gaussian distributed.\n\n    In this case, AIC is given as\n\n    .. math::\n\n        \\mathrm{AIC} = n\\ln\\left(\\dfrac{\\mathrm{SSR}}{n}\\right) + 2k\n\n    In case that the sample size is not \"large enough\", a correction is\n    applied, i.e.\n\n    .. math::\n\n        \\mathrm{AIC} = n\\ln\\left(\\dfrac{\\mathrm{SSR}}{n}\\right) + 2k +\n                       \\dfrac{2k(k+1)}{n-k-1}\n\n\n    in which :math:`n` is the sample size, :math:`k` is the number of free\n    parameters and :math:`\\mathrm{SSR}` stands for the sum of squared residuals\n    between model and data.\n\n    This is applicable, for instance, when the parameters of a model are\n    estimated using the least squares statistic.\n\n    Parameters\n    ----------\n    ssr : float\n        Sum of squared residuals (SSR) between model and data.\n    n_params : int\n        Number of free parameters of the model, i.e.,  the dimension of the\n        parameter space.\n    n_samples : int\n        Number of observations.\n\n    Returns\n    -------\n    aic : float\n        Akaike Information Criterion.\n\n    Examples\n    --------\n    This example is based on Astropy Modeling webpage, Compound models\n    section.\n\n    >>> import numpy as np\n    >>> from astropy.modeling import models, fitting\n    >>> from astropy.stats.info_theory import akaike_info_criterion_lsq\n    >>> np.random.seed(42)\n    >>> # Generate fake data\n    >>> g1 = models.Gaussian1D(.1, 0, 0.2) # changed this to noise level\n    >>> g2 = models.Gaussian1D(.1, 0.3, 0.2) # and added another Gaussian\n    >>> g3 = models.Gaussian1D(2.5, 0.5, 0.1)\n    >>> x = np.linspace(-1, 1, 200)\n    >>> y = g1(x) + g2(x) + g3(x) + np.random.normal(0., 0.2, x.shape)\n    >>> # Fit with three Gaussians\n    >>> g3_init = (models.Gaussian1D(.1, 0, 0.1)\n    ...            + models.Gaussian1D(.1, 0.2, 0.15)\n    ...            + models.Gaussian1D(2.4, .4, 0.1))\n    >>> fitter = fitting.LevMarLSQFitter()\n    >>> g3_fit = fitter(g3_init, x, y)\n    >>> # Fit with two Gaussians\n    >>> g2_init = (models.Gaussian1D(.1, 0, 0.1) +\n    ...            models.Gaussian1D(2, 0.5, 0.1))\n    >>> g2_fit = fitter(g2_init, x, y)\n    >>> # Fit with only one Gaussian\n    >>> g1_init = models.Gaussian1D(amplitude=2., mean=0.3, stddev=.5)\n    >>> g1_fit = fitter(g1_init, x, y)\n    >>> # Compute the mean squared errors\n    >>> ssr_g3 = np.sum((g3_fit(x) - y)**2.0)\n    >>> ssr_g2 = np.sum((g2_fit(x) - y)**2.0)\n    >>> ssr_g1 = np.sum((g1_fit(x) - y)**2.0)\n    >>> akaike_info_criterion_lsq(ssr_g3, 9, x.shape[0]) # doctest: +FLOAT_CMP\n    -634.5257517810961\n    >>> akaike_info_criterion_lsq(ssr_g2, 6, x.shape[0]) # doctest: +FLOAT_CMP\n    -662.83834510232043\n    >>> akaike_info_criterion_lsq(ssr_g1, 3, x.shape[0]) # doctest: +FLOAT_CMP\n    -647.47312032659499\n\n    Hence, from the AIC values, we would prefer to choose the model g2_fit.\n    However, we can considerably support the model g3_fit, since the\n    difference in AIC is about 2.4. We should reject the model g1_fit.\n\n    References\n    ----------\n    .. [1] Akaike Information Criterion.\n       <https://en.wikipedia.org/wiki/Akaike_information_criterion>\n    .. [2] Origin Lab. Comparing Two Fitting Functions.\n       <https://www.originlab.com/doc/Origin-Help/PostFit-CompareFitFunc>\n    \"\"\"\n\n    return akaike_info_criterion(-0.5 * n_samples * np.log(ssr / n_samples),\n                                 n_params, n_samples)"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":8665,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":8666,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":12,"text":"__doctest_requires__"},{"col":0,"comment":"","endLoc":5,"header":"info_theory.py#<anonymous>","id":8667,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module contains simple functions for model selection.\n\"\"\"\n\n__all__ = ['bayesian_info_criterion', 'bayesian_info_criterion_lsq',\n           'akaike_info_criterion', 'akaike_info_criterion_lsq']\n\n__doctest_requires__ = {'bayesian_info_criterion_lsq': ['scipy'],\n                        'akaike_info_criterion_lsq': ['scipy']}"},{"fileName":"setup_package.py","filePath":"astropy/stats","id":8668,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\nfrom setuptools import Extension\n\nimport numpy\n\nSRCDIR = os.path.join(os.path.relpath(os.path.dirname(__file__)), 'src')\n\nSRCFILES = ['wirth_select.c', 'compute_bounds.c', 'fast_sigma_clip.c']\n\nSRCFILES = [os.path.join(SRCDIR, srcfile) for srcfile in SRCFILES]\n\n\ndef get_extensions():\n    _sigma_clip_ext = Extension(name='astropy.stats._fast_sigma_clip', sources=SRCFILES,\n                                include_dirs=[numpy.get_include()],\n                                language='c')\n\n    return [_sigma_clip_ext]\n"},{"col":0,"comment":"null","endLoc":20,"header":"def get_extensions()","id":8669,"name":"get_extensions","nodeType":"Function","startLoc":15,"text":"def get_extensions():\n    _sigma_clip_ext = Extension(name='astropy.stats._fast_sigma_clip', sources=SRCFILES,\n                                include_dirs=[numpy.get_include()],\n                                language='c')\n\n    return [_sigma_clip_ext]"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":8670,"name":"SRCDIR","nodeType":"Attribute","startLoc":8,"text":"SRCDIR"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":8671,"name":"SRCFILES","nodeType":"Attribute","startLoc":10,"text":"SRCFILES"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":8672,"name":"SRCFILES","nodeType":"Attribute","startLoc":12,"text":"SRCFILES"},{"attributeType":"null","col":46,"comment":"null","endLoc":12,"id":8673,"name":"srcfile","nodeType":"Attribute","startLoc":12,"text":"srcfile"},{"col":0,"comment":"","endLoc":3,"header":"setup_package.py#<anonymous>","id":8674,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"SRCDIR = os.path.join(os.path.relpath(os.path.dirname(__file__)), 'src')\n\nSRCFILES = ['wirth_select.c', 'compute_bounds.c', 'fast_sigma_clip.c']\n\nSRCFILES = [os.path.join(SRCDIR, srcfile) for srcfile in SRCFILES]"},{"col":4,"comment":"null","endLoc":1321,"header":"def _web_profile_allowReverseCallbacks(self, private_key, allow)","id":8675,"name":"_web_profile_allowReverseCallbacks","nodeType":"Function","startLoc":1311,"text":"def _web_profile_allowReverseCallbacks(self, private_key, allow):\n        self._update_last_activity_time()\n        if private_key in self._private_keys:\n            if allow == \"0\":\n                if private_key in self._web_profile_callbacks:\n                    del self._web_profile_callbacks[private_key]\n            else:\n                self._web_profile_callbacks[private_key] = queue.Queue()\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")\n        return \"\""},{"fileName":"sigma_clipping.py","filePath":"astropy/stats","id":8676,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport warnings\n\nimport numpy as np\nfrom numpy.core.multiarray import normalize_axis_index\n\nfrom astropy.units import Quantity\nfrom astropy.utils import isiterable\nfrom astropy.utils.exceptions import AstropyUserWarning\nfrom astropy.stats._fast_sigma_clip import _sigma_clip_fast\nfrom astropy.stats.funcs import mad_std\nfrom astropy.utils.compat.optional_deps import HAS_BOTTLENECK\n\nif HAS_BOTTLENECK:\n    import bottleneck\n\n\n__all__ = ['SigmaClip', 'sigma_clip', 'sigma_clipped_stats']\n\n\ndef _move_tuple_axes_first(array, axis):\n    \"\"\"\n    Bottleneck can only take integer axis, not tuple, so this function\n    takes all the axes to be operated on and combines them into the\n    first dimension of the array so that we can then use axis=0.\n    \"\"\"\n    # Figure out how many axes we are operating over\n    naxis = len(axis)\n\n    # Add remaining axes to the axis tuple\n    axis += tuple(i for i in range(array.ndim) if i not in axis)\n\n    # The new position of each axis is just in order\n    destination = tuple(range(array.ndim))\n\n    # Reorder the array so that the axes being operated on are at the\n    # beginning\n    array_new = np.moveaxis(array, axis, destination)\n\n    # Collapse the dimensions being operated on into a single dimension\n    # so that we can then use axis=0 with the bottleneck functions\n    array_new = array_new.reshape((-1,) + array_new.shape[naxis:])\n\n    return array_new\n\n\ndef _nanmean(array, axis=None):\n    \"\"\"Bottleneck nanmean function that handle tuple axis.\"\"\"\n\n    if isinstance(axis, tuple):\n        array = _move_tuple_axes_first(array, axis=axis)\n        axis = 0\n\n    if isinstance(array, Quantity):\n        return array.__array_wrap__(bottleneck.nanmean(array, axis=axis))\n    else:\n        return bottleneck.nanmean(array, axis=axis)\n\n\ndef _nanmedian(array, axis=None):\n    \"\"\"Bottleneck nanmedian function that handle tuple axis.\"\"\"\n\n    if isinstance(axis, tuple):\n        array = _move_tuple_axes_first(array, axis=axis)\n        axis = 0\n\n    if isinstance(array, Quantity):\n        return array.__array_wrap__(bottleneck.nanmedian(array, axis=axis))\n    else:\n        return bottleneck.nanmedian(array, axis=axis)\n\n\ndef _nanstd(array, axis=None, ddof=0):\n    \"\"\"Bottleneck nanstd function that handle tuple axis.\"\"\"\n\n    if isinstance(axis, tuple):\n        array = _move_tuple_axes_first(array, axis=axis)\n        axis = 0\n\n    if isinstance(array, Quantity):\n        return array.__array_wrap__(bottleneck.nanstd(array, axis=axis,\n                                                      ddof=ddof))\n    else:\n        return bottleneck.nanstd(array, axis=axis, ddof=ddof)\n\n\ndef _nanmadstd(array, axis=None):\n    \"\"\"mad_std function that ignores NaNs by default.\"\"\"\n    return mad_std(array, axis=axis, ignore_nan=True)\n\n\nclass SigmaClip:\n    \"\"\"\n    Class to perform sigma clipping.\n\n    The data will be iterated over, each time rejecting values that are\n    less or more than a specified number of standard deviations from a\n    center value.\n\n    Clipped (rejected) pixels are those where::\n\n        data < center - (sigma_lower * std)\n        data > center + (sigma_upper * std)\n\n    where::\n\n        center = cenfunc(data [, axis=])\n        std = stdfunc(data [, axis=])\n\n    Invalid data values (i.e., NaN or inf) are automatically clipped.\n\n    For a functional interface to sigma clipping, see\n    :func:`sigma_clip`.\n\n    .. note::\n        `scipy.stats.sigmaclip` provides a subset of the functionality\n        in this class. Also, its input data cannot be a masked array\n        and it does not handle data that contains invalid values (i.e.,\n        NaN or inf). Also note that it uses the mean as the centering\n        function. The equivalent settings to `scipy.stats.sigmaclip`\n        are::\n\n            sigclip = SigmaClip(sigma=4., cenfunc='mean', maxiters=None)\n            sigclip(data, axis=None, masked=False, return_bounds=True)\n\n    Parameters\n    ----------\n    sigma : float, optional\n        The number of standard deviations to use for both the lower\n        and upper clipping limit. These limits are overridden by\n        ``sigma_lower`` and ``sigma_upper``, if input. The default is 3.\n\n    sigma_lower : float or None, optional\n        The number of standard deviations to use as the lower bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    sigma_upper : float or None, optional\n        The number of standard deviations to use as the upper bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    maxiters : int or None, optional\n        The maximum number of sigma-clipping iterations to perform or\n        `None` to clip until convergence is achieved (i.e., iterate\n        until the last iteration clips nothing). If convergence is\n        achieved prior to ``maxiters`` iterations, the clipping\n        iterations will stop. The default is 5.\n\n    cenfunc : {'median', 'mean'} or callable, optional\n        The statistic or callable function/object used to compute\n        the center value for the clipping. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanmean`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'median'``.\n\n    stdfunc : {'std', 'mad_std'} or callable, optional\n        The statistic or callable function/object used to compute the\n        standard deviation about the center value. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanstd`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'std'``.\n\n    grow : float or `False`, optional\n        Radius within which to mask the neighbouring pixels of those\n        that fall outwith the clipping limits (only applied along\n        ``axis``, if specified). As an example, for a 2D image a value\n        of 1 will mask the nearest pixels in a cross pattern around each\n        deviant pixel, while 1.5 will also reject the nearest diagonal\n        neighbours and so on.\n\n    See Also\n    --------\n    sigma_clip, sigma_clipped_stats\n\n    Notes\n    -----\n    The best performance will typically be obtained by setting\n    ``cenfunc`` and ``stdfunc`` to one of the built-in functions\n    specified as as string. If one of the options is set to a string\n    while the other has a custom callable, you may in some cases see\n    better performance if you have the `bottleneck`_ package installed.\n\n    .. _bottleneck:  https://github.com/pydata/bottleneck\n\n    Examples\n    --------\n    This example uses a data array of random variates from a Gaussian\n    distribution. We clip all points that are more than 2 sample\n    standard deviations from the median. The result is a masked array,\n    where the mask is `True` for clipped data::\n\n        >>> from astropy.stats import SigmaClip\n        >>> from numpy.random import randn\n        >>> randvar = randn(10000)\n        >>> sigclip = SigmaClip(sigma=2, maxiters=5)\n        >>> filtered_data = sigclip(randvar)\n\n    This example clips all points that are more than 3 sigma relative\n    to the sample *mean*, clips until convergence, returns an unmasked\n    `~numpy.ndarray`, and modifies the data in-place::\n\n        >>> from astropy.stats import SigmaClip\n        >>> from numpy.random import randn\n        >>> from numpy import mean\n        >>> randvar = randn(10000)\n        >>> sigclip = SigmaClip(sigma=3, maxiters=None, cenfunc='mean')\n        >>> filtered_data = sigclip(randvar, masked=False, copy=False)\n\n    This example sigma clips along one axis::\n\n        >>> from astropy.stats import SigmaClip\n        >>> from numpy.random import normal\n        >>> from numpy import arange, diag, ones\n        >>> data = arange(5) + normal(0., 0.05, (5, 5)) + diag(ones(5))\n        >>> sigclip = SigmaClip(sigma=2.3)\n        >>> filtered_data = sigclip(data, axis=0)\n\n    Note that along the other axis, no points would be clipped, as the\n    standard deviation is higher.\n    \"\"\"\n\n    def __init__(self, sigma=3., sigma_lower=None, sigma_upper=None,\n                 maxiters=5, cenfunc='median', stdfunc='std', grow=False):\n        self.sigma = sigma\n        self.sigma_lower = sigma_lower or sigma\n        self.sigma_upper = sigma_upper or sigma\n        self.maxiters = maxiters or np.inf\n        self.cenfunc = cenfunc\n        self.stdfunc = stdfunc\n        self._cenfunc_parsed = self._parse_cenfunc(cenfunc)\n        self._stdfunc_parsed = self._parse_stdfunc(stdfunc)\n        self._min_value = np.nan\n        self._max_value = np.nan\n        self._niterations = 0\n        self.grow = grow\n\n        # This just checks that SciPy is available, to avoid failing\n        # later than necessary if __call__ needs it:\n        if self.grow:\n            from scipy.ndimage import binary_dilation\n            self._binary_dilation = binary_dilation\n\n    def __repr__(self):\n        return ('SigmaClip(sigma={}, sigma_lower={}, sigma_upper={}, '\n                'maxiters={}, cenfunc={}, stdfunc={}, grow={})'\n                .format(self.sigma, self.sigma_lower, self.sigma_upper,\n                        self.maxiters, repr(self.cenfunc), repr(self.stdfunc),\n                        self.grow))\n\n    def __str__(self):\n        lines = ['<' + self.__class__.__name__ + '>']\n        attrs = ['sigma', 'sigma_lower', 'sigma_upper', 'maxiters', 'cenfunc',\n                 'stdfunc', 'grow']\n        for attr in attrs:\n            lines.append(f'    {attr}: {repr(getattr(self, attr))}')\n        return '\\n'.join(lines)\n\n    @staticmethod\n    def _parse_cenfunc(cenfunc):\n        if isinstance(cenfunc, str):\n            if cenfunc == 'median':\n                if HAS_BOTTLENECK:\n                    cenfunc = _nanmedian\n                else:\n                    cenfunc = np.nanmedian  # pragma: no cover\n\n            elif cenfunc == 'mean':\n                if HAS_BOTTLENECK:\n                    cenfunc = _nanmean\n                else:\n                    cenfunc = np.nanmean  # pragma: no cover\n\n            else:\n                raise ValueError(f'{cenfunc} is an invalid cenfunc.')\n\n        return cenfunc\n\n    @staticmethod\n    def _parse_stdfunc(stdfunc):\n        if isinstance(stdfunc, str):\n            if stdfunc == 'std':\n                if HAS_BOTTLENECK:\n                    stdfunc = _nanstd\n                else:\n                    stdfunc = np.nanstd  # pragma: no cover\n            elif stdfunc == 'mad_std':\n                stdfunc = _nanmadstd\n            else:\n                raise ValueError(f'{stdfunc} is an invalid stdfunc.')\n\n        return stdfunc\n\n    def _compute_bounds(self, data, axis=None):\n        # ignore RuntimeWarning if the array (or along an axis) has only\n        # NaNs\n        with warnings.catch_warnings():\n            warnings.simplefilter(\"ignore\", category=RuntimeWarning)\n            self._max_value = self._cenfunc_parsed(data, axis=axis)\n            std = self._stdfunc_parsed(data, axis=axis)\n            self._min_value = self._max_value - (std * self.sigma_lower)\n            self._max_value += std * self.sigma_upper\n\n    def _sigmaclip_fast(self, data, axis=None,\n                        masked=True, return_bounds=False,\n                        copy=True):\n        \"\"\"\n        Fast C implementation for simple use cases.\n        \"\"\"\n        if isinstance(data, Quantity):\n            data, unit = data.value, data.unit\n        else:\n            unit = None\n\n        if copy is False and masked is False and data.dtype.kind != 'f':\n            raise Exception(\"cannot mask non-floating-point array with NaN \"\n                            \"values, set copy=True or masked=True to avoid \"\n                            \"this.\")\n\n        if axis is None:\n            axis = -1 if data.ndim == 1 else tuple(range(data.ndim))\n\n        if not isiterable(axis):\n            axis = normalize_axis_index(axis, data.ndim)\n            data_reshaped = data\n            transposed_shape = None\n        else:\n            # The gufunc implementation does not handle non-scalar axis\n            # so we combine the dimensions together as the last\n            # dimension and set axis=-1\n            axis = tuple(normalize_axis_index(ax, data.ndim) for ax in axis)\n            transposed_axes = tuple(ax for ax in range(data.ndim)\n                                    if ax not in axis) + axis\n            data_transposed = data.transpose(transposed_axes)\n            transposed_shape = data_transposed.shape\n            data_reshaped = data_transposed.reshape(\n                transposed_shape[:data.ndim - len(axis)] + (-1,))\n            axis = -1\n\n        if data_reshaped.dtype.kind != 'f' or data_reshaped.dtype.itemsize > 8:\n            data_reshaped = data_reshaped.astype(float)\n\n        mask = ~np.isfinite(data_reshaped)\n        if np.any(mask):\n            warnings.warn('Input data contains invalid values (NaNs or '\n                          'infs), which were automatically clipped.',\n                          AstropyUserWarning)\n\n        if isinstance(data_reshaped, np.ma.MaskedArray):\n            mask |= data_reshaped.mask\n            data = data.view(np.ndarray)\n            data_reshaped = data_reshaped.view(np.ndarray)\n            mask = np.broadcast_to(mask, data_reshaped.shape).copy()\n\n        bound_lo, bound_hi = _sigma_clip_fast(\n            data_reshaped, mask, self.cenfunc == 'median',\n            self.stdfunc == 'mad_std',\n            -1 if np.isinf(self.maxiters) else self.maxiters,\n            self.sigma_lower, self.sigma_upper, axis=axis)\n\n        with np.errstate(invalid='ignore'):\n            mask |= data_reshaped < np.expand_dims(bound_lo, axis)\n            mask |= data_reshaped > np.expand_dims(bound_hi, axis)\n\n        if transposed_shape is not None:\n            # Get mask in shape of data.\n            mask = mask.reshape(transposed_shape)\n            mask = mask.transpose(tuple(transposed_axes.index(ax)\n                                        for ax in range(data.ndim)))\n\n        if masked:\n            result = np.ma.array(data, mask=mask, copy=copy)\n        else:\n            if copy:\n                result = data.astype(float, copy=True)\n            else:\n                result = data\n            result[mask] = np.nan\n\n        if unit is not None:\n            result = result << unit\n            bound_lo = bound_lo << unit\n            bound_hi = bound_hi << unit\n\n        if return_bounds:\n            return result, bound_lo, bound_hi\n        else:\n            return result\n\n    def _sigmaclip_noaxis(self, data, masked=True, return_bounds=False,\n                          copy=True):\n        \"\"\"\n        Sigma clip when ``axis`` is None and ``grow`` is not >0.\n\n        In this simple case, we remove clipped elements from the\n        flattened array during each iteration.\n        \"\"\"\n        filtered_data = data.ravel()\n\n        # remove masked values and convert to ndarray\n        if isinstance(filtered_data, np.ma.MaskedArray):\n            filtered_data = filtered_data.data[~filtered_data.mask]\n\n        # remove invalid values\n        good_mask = np.isfinite(filtered_data)\n        if np.any(~good_mask):\n            filtered_data = filtered_data[good_mask]\n            warnings.warn('Input data contains invalid values (NaNs or '\n                          'infs), which were automatically clipped.',\n                          AstropyUserWarning)\n\n        nchanged = 1\n        iteration = 0\n        while nchanged != 0 and (iteration < self.maxiters):\n            iteration += 1\n            size = filtered_data.size\n            self._compute_bounds(filtered_data, axis=None)\n            filtered_data = filtered_data[\n                (filtered_data >= self._min_value)\n                & (filtered_data <= self._max_value)]\n            nchanged = size - filtered_data.size\n\n        self._niterations = iteration\n\n        if masked:\n            # return a masked array and optional bounds\n            filtered_data = np.ma.masked_invalid(data, copy=copy)\n\n            # update the mask in place, ignoring RuntimeWarnings for\n            # comparisons with NaN data values\n            with np.errstate(invalid='ignore'):\n                filtered_data.mask |= np.logical_or(data < self._min_value,\n                                                    data > self._max_value)\n\n        if return_bounds:\n            return filtered_data, self._min_value, self._max_value\n        else:\n            return filtered_data\n\n    def _sigmaclip_withaxis(self, data, axis=None, masked=True,\n                            return_bounds=False, copy=True):\n        \"\"\"\n        Sigma clip the data when ``axis`` or ``grow`` is specified.\n\n        In this case, we replace clipped values with NaNs as placeholder\n        values.\n        \"\"\"\n        # float array type is needed to insert nans into the array\n        filtered_data = data.astype(float)    # also makes a copy\n\n        # remove invalid values\n        bad_mask = ~np.isfinite(filtered_data)\n        if np.any(bad_mask):\n            filtered_data[bad_mask] = np.nan\n            warnings.warn('Input data contains invalid values (NaNs or '\n                          'infs), which were automatically clipped.',\n                          AstropyUserWarning)\n\n        # remove masked values and convert to plain ndarray\n        if isinstance(filtered_data, np.ma.MaskedArray):\n            filtered_data = np.ma.masked_invalid(filtered_data).astype(float)\n            filtered_data = filtered_data.filled(np.nan)\n\n        if axis is not None:\n            # convert negative axis/axes\n            if not isiterable(axis):\n                axis = (axis,)\n            axis = tuple(filtered_data.ndim + n if n < 0 else n for n in axis)\n\n            # define the shape of min/max arrays so that they can be broadcast\n            # with the data\n            mshape = tuple(1 if dim in axis else size\n                           for dim, size in enumerate(filtered_data.shape))\n\n        if self.grow:\n            # Construct a growth kernel from the specified radius in\n            # pixels (consider caching this for re-use by subsequent\n            # calls?):\n            cenidx = int(self.grow)\n            size = 2 * cenidx + 1\n            indices = np.mgrid[(slice(0, size),) * data.ndim]\n            if axis is not None:\n                for n, dim in enumerate(indices):\n                    # For any axes that we're not clipping over, set\n                    # their indices outside the growth radius, so masked\n                    # points won't \"grow\" in that dimension:\n                    if n not in axis:\n                        dim[dim != cenidx] = size\n            kernel = (sum(((idx - cenidx)**2 for idx in indices))\n                      <= self.grow**2)\n            del indices\n\n        nchanged = 1\n        iteration = 0\n        while nchanged != 0 and (iteration < self.maxiters):\n            iteration += 1\n            self._compute_bounds(filtered_data, axis=axis)\n            if not np.isscalar(self._min_value):\n                self._min_value = self._min_value.reshape(mshape)\n                self._max_value = self._max_value.reshape(mshape)\n\n            with np.errstate(invalid='ignore'):\n                # Since these comparisons are always False for NaNs, the\n                # resulting mask contains only newly-rejected pixels and\n                # we can dilate it without growing masked pixels more\n                # than once.\n                new_mask = ((filtered_data < self._min_value)\n                            | (filtered_data > self._max_value))\n            if self.grow:\n                new_mask = self._binary_dilation(new_mask, kernel)\n            filtered_data[new_mask] = np.nan\n            nchanged = np.count_nonzero(new_mask)\n            del new_mask\n\n        self._niterations = iteration\n\n        if masked:\n            # create an output masked array\n            if copy:\n                filtered_data = np.ma.MaskedArray(data,\n                                                  ~np.isfinite(filtered_data),\n                                                  copy=True)\n            else:\n                # ignore RuntimeWarnings for comparisons with NaN data values\n                with np.errstate(invalid='ignore'):\n                    out = np.ma.masked_invalid(data, copy=False)\n\n                    filtered_data = np.ma.masked_where(np.logical_or(\n                        out < self._min_value, out > self._max_value),\n                        out, copy=False)\n\n        if return_bounds:\n            return filtered_data, self._min_value, self._max_value\n        else:\n            return filtered_data\n\n    def __call__(self, data, axis=None, masked=True, return_bounds=False,\n                 copy=True):\n        \"\"\"\n        Perform sigma clipping on the provided data.\n\n        Parameters\n        ----------\n        data : array-like or `~numpy.ma.MaskedArray`\n            The data to be sigma clipped.\n\n        axis : None or int or tuple of int, optional\n            The axis or axes along which to sigma clip the data. If\n            `None`, then the flattened data will be used. ``axis`` is\n            passed to the ``cenfunc`` and ``stdfunc``. The default is\n            `None`.\n\n        masked : bool, optional\n            If `True`, then a `~numpy.ma.MaskedArray` is returned, where\n            the mask is `True` for clipped values. If `False`, then a\n            `~numpy.ndarray` is returned. The default is `True`.\n\n        return_bounds : bool, optional\n            If `True`, then the minimum and maximum clipping bounds are\n            also returned.\n\n        copy : bool, optional\n            If `True`, then the ``data`` array will be copied. If\n            `False` and ``masked=True``, then the returned masked array\n            data will contain the same array as the input ``data`` (if\n            ``data`` is a `~numpy.ndarray` or `~numpy.ma.MaskedArray`).\n            If `False` and ``masked=False``, the input data is modified\n            in-place. The default is `True`.\n\n        Returns\n        -------\n        result : array-like\n            If ``masked=True``, then a `~numpy.ma.MaskedArray` is\n            returned, where the mask is `True` for clipped values and\n            where the input mask was `True`.\n\n            If ``masked=False``, then a `~numpy.ndarray` is returned.\n\n            If ``return_bounds=True``, then in addition to the masked\n            array or array above, the minimum and maximum clipping\n            bounds are returned.\n\n            If ``masked=False`` and ``axis=None``, then the output\n            array is a flattened 1D `~numpy.ndarray` where the clipped\n            values have been removed. If ``return_bounds=True`` then the\n            returned minimum and maximum thresholds are scalars.\n\n            If ``masked=False`` and ``axis`` is specified, then the\n            output `~numpy.ndarray` will have the same shape as the\n            input ``data`` and contain ``np.nan`` where values were\n            clipped. If the input ``data`` was a masked array, then the\n            output `~numpy.ndarray` will also contain ``np.nan`` where\n            the input mask was `True`. If ``return_bounds=True`` then\n            the returned minimum and maximum clipping thresholds will be\n            be `~numpy.ndarray`\\\\s.\n        \"\"\"\n        data = np.asanyarray(data)\n\n        if data.size == 0:\n            if masked:\n                result = np.ma.MaskedArray(data)\n            else:\n                result = data\n\n            if return_bounds:\n                return result, self._min_value, self._max_value\n            else:\n                return result\n\n        if isinstance(data, np.ma.MaskedArray) and data.mask.all():\n            if masked:\n                result = data\n            else:\n                result = np.full(data.shape, np.nan)\n\n            if return_bounds:\n                return result, self._min_value, self._max_value\n            else:\n                return result\n\n        # Shortcut for common cases where a fast C implementation can be\n        # used.\n        if (self.cenfunc in ('mean', 'median')\n                and self.stdfunc in ('std', 'mad_std')\n                and axis is not None and not self.grow):\n            return self._sigmaclip_fast(data, axis=axis, masked=masked,\n                                        return_bounds=return_bounds,\n                                        copy=copy)\n\n        # These two cases are treated separately because when\n        # ``axis=None`` we can simply remove clipped values from the\n        # array. This is not possible when ``axis`` or ``grow`` is\n        # specified.\n        if axis is None and not self.grow:\n            return self._sigmaclip_noaxis(data, masked=masked,\n                                          return_bounds=return_bounds,\n                                          copy=copy)\n        else:\n            return self._sigmaclip_withaxis(data, axis=axis, masked=masked,\n                                            return_bounds=return_bounds,\n                                            copy=copy)\n\n\ndef sigma_clip(data, sigma=3, sigma_lower=None, sigma_upper=None, maxiters=5,\n               cenfunc='median', stdfunc='std', axis=None, masked=True,\n               return_bounds=False, copy=True, grow=False):\n    \"\"\"\n    Perform sigma-clipping on the provided data.\n\n    The data will be iterated over, each time rejecting values that are\n    less or more than a specified number of standard deviations from a\n    center value.\n\n    Clipped (rejected) pixels are those where::\n\n        data < center - (sigma_lower * std)\n        data > center + (sigma_upper * std)\n\n    where::\n\n        center = cenfunc(data [, axis=])\n        std = stdfunc(data [, axis=])\n\n    Invalid data values (i.e., NaN or inf) are automatically clipped.\n\n    For an object-oriented interface to sigma clipping, see\n    :class:`SigmaClip`.\n\n    .. note::\n        `scipy.stats.sigmaclip` provides a subset of the functionality\n        in this class. Also, its input data cannot be a masked array\n        and it does not handle data that contains invalid values (i.e.,\n        NaN or inf). Also note that it uses the mean as the centering\n        function. The equivalent settings to `scipy.stats.sigmaclip`\n        are::\n\n            sigma_clip(sigma=4., cenfunc='mean', maxiters=None, axis=None,\n            ...        masked=False, return_bounds=True)\n\n    Parameters\n    ----------\n    data : array-like or `~numpy.ma.MaskedArray`\n        The data to be sigma clipped.\n\n    sigma : float, optional\n        The number of standard deviations to use for both the lower\n        and upper clipping limit. These limits are overridden by\n        ``sigma_lower`` and ``sigma_upper``, if input. The default is 3.\n\n    sigma_lower : float or None, optional\n        The number of standard deviations to use as the lower bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    sigma_upper : float or None, optional\n        The number of standard deviations to use as the upper bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    maxiters : int or None, optional\n        The maximum number of sigma-clipping iterations to perform or\n        `None` to clip until convergence is achieved (i.e., iterate\n        until the last iteration clips nothing). If convergence is\n        achieved prior to ``maxiters`` iterations, the clipping\n        iterations will stop. The default is 5.\n\n    cenfunc : {'median', 'mean'} or callable, optional\n        The statistic or callable function/object used to compute\n        the center value for the clipping. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanmean`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'median'``.\n\n    stdfunc : {'std', 'mad_std'} or callable, optional\n        The statistic or callable function/object used to compute the\n        standard deviation about the center value. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanstd`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'std'``.\n\n    axis : None or int or tuple of int, optional\n        The axis or axes along which to sigma clip the data. If `None`,\n        then the flattened data will be used. ``axis`` is passed to the\n        ``cenfunc`` and ``stdfunc``. The default is `None`.\n\n    masked : bool, optional\n        If `True`, then a `~numpy.ma.MaskedArray` is returned, where\n        the mask is `True` for clipped values. If `False`, then a\n        `~numpy.ndarray` and the minimum and maximum clipping thresholds\n        are returned. The default is `True`.\n\n    return_bounds : bool, optional\n        If `True`, then the minimum and maximum clipping bounds are also\n        returned.\n\n    copy : bool, optional\n        If `True`, then the ``data`` array will be copied. If `False`\n        and ``masked=True``, then the returned masked array data will\n        contain the same array as the input ``data`` (if ``data`` is a\n        `~numpy.ndarray` or `~numpy.ma.MaskedArray`). If `False` and\n        ``masked=False``, the input data is modified in-place. The\n        default is `True`.\n\n    grow : float or `False`, optional\n        Radius within which to mask the neighbouring pixels of those\n        that fall outwith the clipping limits (only applied along\n        ``axis``, if specified). As an example, for a 2D image a value\n        of 1 will mask the nearest pixels in a cross pattern around each\n        deviant pixel, while 1.5 will also reject the nearest diagonal\n        neighbours and so on.\n\n    Returns\n    -------\n    result : array-like\n        If ``masked=True``, then a `~numpy.ma.MaskedArray` is returned,\n        where the mask is `True` for clipped values and where the input\n        mask was `True`.\n\n        If ``masked=False``, then a `~numpy.ndarray` is returned.\n\n        If ``return_bounds=True``, then in addition to the masked array\n        or array above, the minimum and maximum clipping bounds are\n        returned.\n\n        If ``masked=False`` and ``axis=None``, then the output array\n        is a flattened 1D `~numpy.ndarray` where the clipped values\n        have been removed. If ``return_bounds=True`` then the returned\n        minimum and maximum thresholds are scalars.\n\n        If ``masked=False`` and ``axis`` is specified, then the output\n        `~numpy.ndarray` will have the same shape as the input ``data``\n        and contain ``np.nan`` where values were clipped. If the input\n        ``data`` was a masked array, then the output `~numpy.ndarray`\n        will also contain ``np.nan`` where the input mask was `True`.\n        If ``return_bounds=True`` then the returned minimum and maximum\n        clipping thresholds will be be `~numpy.ndarray`\\\\s.\n\n    See Also\n    --------\n    SigmaClip, sigma_clipped_stats\n\n    Notes\n    -----\n    The best performance will typically be obtained by setting\n    ``cenfunc`` and ``stdfunc`` to one of the built-in functions\n    specified as as string. If one of the options is set to a string\n    while the other has a custom callable, you may in some cases see\n    better performance if you have the `bottleneck`_ package installed.\n\n    .. _bottleneck:  https://github.com/pydata/bottleneck\n\n    Examples\n    --------\n    This example uses a data array of random variates from a Gaussian\n    distribution. We clip all points that are more than 2 sample\n    standard deviations from the median. The result is a masked array,\n    where the mask is `True` for clipped data::\n\n        >>> from astropy.stats import sigma_clip\n        >>> from numpy.random import randn\n        >>> randvar = randn(10000)\n        >>> filtered_data = sigma_clip(randvar, sigma=2, maxiters=5)\n\n    This example clips all points that are more than 3 sigma relative\n    to the sample *mean*, clips until convergence, returns an unmasked\n    `~numpy.ndarray`, and does not copy the data::\n\n        >>> from astropy.stats import sigma_clip\n        >>> from numpy.random import randn\n        >>> from numpy import mean\n        >>> randvar = randn(10000)\n        >>> filtered_data = sigma_clip(randvar, sigma=3, maxiters=None,\n        ...                            cenfunc=mean, masked=False, copy=False)\n\n    This example sigma clips along one axis::\n\n        >>> from astropy.stats import sigma_clip\n        >>> from numpy.random import normal\n        >>> from numpy import arange, diag, ones\n        >>> data = arange(5) + normal(0., 0.05, (5, 5)) + diag(ones(5))\n        >>> filtered_data = sigma_clip(data, sigma=2.3, axis=0)\n\n    Note that along the other axis, no points would be clipped, as the\n    standard deviation is higher.\n    \"\"\"\n    sigclip = SigmaClip(sigma=sigma, sigma_lower=sigma_lower,\n                        sigma_upper=sigma_upper, maxiters=maxiters,\n                        cenfunc=cenfunc, stdfunc=stdfunc, grow=grow)\n\n    return sigclip(data, axis=axis, masked=masked,\n                   return_bounds=return_bounds, copy=copy)\n\n\ndef sigma_clipped_stats(data, mask=None, mask_value=None, sigma=3.0,\n                        sigma_lower=None, sigma_upper=None, maxiters=5,\n                        cenfunc='median', stdfunc='std', std_ddof=0,\n                        axis=None, grow=False):\n    \"\"\"\n    Calculate sigma-clipped statistics on the provided data.\n\n    Parameters\n    ----------\n    data : array-like or `~numpy.ma.MaskedArray`\n        Data array or object that can be converted to an array.\n\n    mask : `numpy.ndarray` (bool), optional\n        A boolean mask with the same shape as ``data``, where a `True`\n        value indicates the corresponding element of ``data`` is masked.\n        Masked pixels are excluded when computing the statistics.\n\n    mask_value : float, optional\n        A data value (e.g., ``0.0``) that is ignored when computing the\n        statistics. ``mask_value`` will be masked in addition to any\n        input ``mask``.\n\n    sigma : float, optional\n        The number of standard deviations to use for both the lower\n        and upper clipping limit. These limits are overridden by\n        ``sigma_lower`` and ``sigma_upper``, if input. The default is 3.\n\n    sigma_lower : float or None, optional\n        The number of standard deviations to use as the lower bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    sigma_upper : float or None, optional\n        The number of standard deviations to use as the upper bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    maxiters : int or None, optional\n        The maximum number of sigma-clipping iterations to perform or\n        `None` to clip until convergence is achieved (i.e., iterate\n        until the last iteration clips nothing). If convergence is\n        achieved prior to ``maxiters`` iterations, the clipping\n        iterations will stop. The default is 5.\n\n    cenfunc : {'median', 'mean'} or callable, optional\n        The statistic or callable function/object used to compute\n        the center value for the clipping. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanmean`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'median'``.\n\n    stdfunc : {'std', 'mad_std'} or callable, optional\n        The statistic or callable function/object used to compute the\n        standard deviation about the center value. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanstd`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'std'``.\n\n    std_ddof : int, optional\n        The delta degrees of freedom for the standard deviation\n        calculation. The divisor used in the calculation is ``N -\n        std_ddof``, where ``N`` represents the number of elements. The\n        default is 0.\n\n    axis : None or int or tuple of int, optional\n        The axis or axes along which to sigma clip the data. If `None`,\n        then the flattened data will be used. ``axis`` is passed to the\n        ``cenfunc`` and ``stdfunc``. The default is `None`.\n\n    grow : float or `False`, optional\n        Radius within which to mask the neighbouring pixels of those\n        that fall outwith the clipping limits (only applied along\n        ``axis``, if specified). As an example, for a 2D image a value\n        of 1 will mask the nearest pixels in a cross pattern around each\n        deviant pixel, while 1.5 will also reject the nearest diagonal\n        neighbours and so on.\n\n    Notes\n    -----\n    The best performance will typically be obtained by setting\n    ``cenfunc`` and ``stdfunc`` to one of the built-in functions\n    specified as as string. If one of the options is set to a string\n    while the other has a custom callable, you may in some cases see\n    better performance if you have the `bottleneck`_ package installed.\n\n    .. _bottleneck:  https://github.com/pydata/bottleneck\n\n    Returns\n    -------\n    mean, median, stddev : float\n        The mean, median, and standard deviation of the sigma-clipped\n        data.\n\n    See Also\n    --------\n    SigmaClip, sigma_clip\n    \"\"\"\n    if mask is not None:\n        data = np.ma.MaskedArray(data, mask)\n    if mask_value is not None:\n        data = np.ma.masked_values(data, mask_value)\n\n    if isinstance(data, np.ma.MaskedArray) and data.mask.all():\n        return np.ma.masked, np.ma.masked, np.ma.masked\n\n    sigclip = SigmaClip(sigma=sigma, sigma_lower=sigma_lower,\n                        sigma_upper=sigma_upper, maxiters=maxiters,\n                        cenfunc=cenfunc, stdfunc=stdfunc, grow=grow)\n    data_clipped = sigclip(data, axis=axis, masked=False, return_bounds=False,\n                           copy=True)\n\n    if HAS_BOTTLENECK:\n        mean = _nanmean(data_clipped, axis=axis)\n        median = _nanmedian(data_clipped, axis=axis)\n        std = _nanstd(data_clipped, ddof=std_ddof, axis=axis)\n    else:  # pragma: no cover\n        mean = np.nanmean(data_clipped, axis=axis)\n        median = np.nanmedian(data_clipped, axis=axis)\n        std = np.nanstd(data_clipped, ddof=std_ddof, axis=axis)\n\n    return mean, median, std\n"},{"className":"FitnessFunc","col":0,"comment":"Base class for bayesian blocks fitness functions\n\n    Derived classes should overload the following method:\n\n    ``fitness(self, **kwargs)``:\n      Compute the fitness given a set of named arguments.\n      Arguments accepted by fitness must be among ``[T_k, N_k, a_k, b_k, c_k]``\n      (See [1]_ for details on the meaning of these parameters).\n\n    Additionally, other methods may be overloaded as well:\n\n    ``__init__(self, **kwargs)``:\n      Initialize the fitness function with any parameters beyond the normal\n      ``p0`` and ``gamma``.\n\n    ``validate_input(self, t, x, sigma)``:\n      Enable specific checks of the input data (``t``, ``x``, ``sigma``)\n      to be performed prior to the fit.\n\n    ``compute_ncp_prior(self, N)``: If ``ncp_prior`` is not defined explicitly,\n      this function is called in order to define it before fitting. This may be\n      calculated from ``gamma``, ``p0``, or whatever method you choose.\n\n    ``p0_prior(self, N)``:\n      Specify the form of the prior given the false-alarm probability ``p0``\n      (See [1]_ for details).\n\n    For examples of implemented fitness functions, see :class:`Events`,\n    :class:`RegularEvents`, and :class:`PointMeasures`.\n\n    References\n    ----------\n    .. [1] Scargle, J et al. (2013)\n       https://ui.adsabs.harvard.edu/abs/2013ApJ...764..167S\n    ","endLoc":413,"id":8677,"nodeType":"Class","startLoc":175,"text":"class FitnessFunc:\n    \"\"\"Base class for bayesian blocks fitness functions\n\n    Derived classes should overload the following method:\n\n    ``fitness(self, **kwargs)``:\n      Compute the fitness given a set of named arguments.\n      Arguments accepted by fitness must be among ``[T_k, N_k, a_k, b_k, c_k]``\n      (See [1]_ for details on the meaning of these parameters).\n\n    Additionally, other methods may be overloaded as well:\n\n    ``__init__(self, **kwargs)``:\n      Initialize the fitness function with any parameters beyond the normal\n      ``p0`` and ``gamma``.\n\n    ``validate_input(self, t, x, sigma)``:\n      Enable specific checks of the input data (``t``, ``x``, ``sigma``)\n      to be performed prior to the fit.\n\n    ``compute_ncp_prior(self, N)``: If ``ncp_prior`` is not defined explicitly,\n      this function is called in order to define it before fitting. This may be\n      calculated from ``gamma``, ``p0``, or whatever method you choose.\n\n    ``p0_prior(self, N)``:\n      Specify the form of the prior given the false-alarm probability ``p0``\n      (See [1]_ for details).\n\n    For examples of implemented fitness functions, see :class:`Events`,\n    :class:`RegularEvents`, and :class:`PointMeasures`.\n\n    References\n    ----------\n    .. [1] Scargle, J et al. (2013)\n       https://ui.adsabs.harvard.edu/abs/2013ApJ...764..167S\n    \"\"\"\n    def __init__(self, p0=0.05, gamma=None, ncp_prior=None):\n        self.p0 = p0\n        self.gamma = gamma\n        self.ncp_prior = ncp_prior\n\n    def validate_input(self, t, x=None, sigma=None):\n        \"\"\"Validate inputs to the model.\n\n        Parameters\n        ----------\n        t : array-like\n            times of observations\n        x : array-like, optional\n            values observed at each time\n        sigma : float or array-like, optional\n            errors in values x\n\n        Returns\n        -------\n        t, x, sigma : array-like, float or None\n            validated and perhaps modified versions of inputs\n        \"\"\"\n        # validate array input\n        t = np.asarray(t, dtype=float)\n\n        # find unique values of t\n        t = np.array(t)\n        if t.ndim != 1:\n            raise ValueError(\"t must be a one-dimensional array\")\n        unq_t, unq_ind, unq_inv = np.unique(t, return_index=True,\n                                            return_inverse=True)\n\n        # if x is not specified, x will be counts at each time\n        if x is None:\n            if sigma is not None:\n                raise ValueError(\"If sigma is specified, x must be specified\")\n            else:\n                sigma = 1\n\n            if len(unq_t) == len(t):\n                x = np.ones_like(t)\n            else:\n                x = np.bincount(unq_inv)\n\n            t = unq_t\n\n        # if x is specified, then we need to simultaneously sort t and x\n        else:\n            # TODO: allow broadcasted x?\n            x = np.asarray(x, dtype=float)\n\n            if x.shape not in [(), (1,), (t.size,)]:\n                raise ValueError(\"x does not match shape of t\")\n            x += np.zeros_like(t)\n\n            if len(unq_t) != len(t):\n                raise ValueError(\"Repeated values in t not supported when \"\n                                 \"x is specified\")\n            t = unq_t\n            x = x[unq_ind]\n\n        # verify the given sigma value\n        if sigma is None:\n            sigma = 1\n        else:\n            sigma = np.asarray(sigma, dtype=float)\n            if sigma.shape not in [(), (1,), (t.size,)]:\n                raise ValueError('sigma does not match the shape of x')\n\n        return t, x, sigma\n\n    def fitness(self, **kwargs):\n        raise NotImplementedError()\n\n    def p0_prior(self, N):\n        \"\"\"\n        Empirical prior, parametrized by the false alarm probability ``p0``\n        See  eq. 21 in Scargle (2013)\n\n        Note that there was an error in this equation in the original Scargle\n        paper (the \"log\" was missing). The following corrected form is taken\n        from https://arxiv.org/abs/1304.2818\n        \"\"\"\n        return 4 - np.log(73.53 * self.p0 * (N ** -0.478))\n\n    # the fitness_args property will return the list of arguments accepted by\n    # the method fitness().  This allows more efficient computation below.\n    @property\n    def _fitness_args(self):\n        return signature(self.fitness).parameters.keys()\n\n    def compute_ncp_prior(self, N):\n        \"\"\"\n        If ``ncp_prior`` is not explicitly defined, compute it from ``gamma``\n        or ``p0``.\n        \"\"\"\n\n        if self.gamma is not None:\n            return -np.log(self.gamma)\n        elif self.p0 is not None:\n            return self.p0_prior(N)\n        else:\n            raise ValueError(\"``ncp_prior`` cannot be computed as neither \"\n                             \"``gamma`` nor ``p0`` is defined.\")\n\n    def fit(self, t, x=None, sigma=None):\n        \"\"\"Fit the Bayesian Blocks model given the specified fitness function.\n\n        Parameters\n        ----------\n        t : array-like\n            data times (one dimensional, length N)\n        x : array-like, optional\n            data values\n        sigma : array-like or float, optional\n            data errors\n\n        Returns\n        -------\n        edges : ndarray\n            array containing the (M+1) edges defining the M optimal bins\n        \"\"\"\n        t, x, sigma = self.validate_input(t, x, sigma)\n\n        # compute values needed for computation, below\n        if 'a_k' in self._fitness_args:\n            ak_raw = np.ones_like(x) / sigma ** 2\n        if 'b_k' in self._fitness_args:\n            bk_raw = x / sigma ** 2\n        if 'c_k' in self._fitness_args:\n            ck_raw = x * x / sigma ** 2\n\n        # create length-(N + 1) array of cell edges\n        edges = np.concatenate([t[:1],\n                                0.5 * (t[1:] + t[:-1]),\n                                t[-1:]])\n        block_length = t[-1] - edges\n\n        # arrays to store the best configuration\n        N = len(t)\n        best = np.zeros(N, dtype=float)\n        last = np.zeros(N, dtype=int)\n\n        # Compute ncp_prior if not defined\n        if self.ncp_prior is None:\n            ncp_prior = self.compute_ncp_prior(N)\n        else:\n            ncp_prior = self.ncp_prior\n\n        # ----------------------------------------------------------------\n        # Start with first data cell; add one cell at each iteration\n        # ----------------------------------------------------------------\n        for R in range(N):\n            # Compute fit_vec : fitness of putative last block (end at R)\n            kwds = {}\n\n            # T_k: width/duration of each block\n            if 'T_k' in self._fitness_args:\n                kwds['T_k'] = block_length[:R + 1] - block_length[R + 1]\n\n            # N_k: number of elements in each block\n            if 'N_k' in self._fitness_args:\n                kwds['N_k'] = np.cumsum(x[:R + 1][::-1])[::-1]\n\n            # a_k: eq. 31\n            if 'a_k' in self._fitness_args:\n                kwds['a_k'] = 0.5 * np.cumsum(ak_raw[:R + 1][::-1])[::-1]\n\n            # b_k: eq. 32\n            if 'b_k' in self._fitness_args:\n                kwds['b_k'] = - np.cumsum(bk_raw[:R + 1][::-1])[::-1]\n\n            # c_k: eq. 33\n            if 'c_k' in self._fitness_args:\n                kwds['c_k'] = 0.5 * np.cumsum(ck_raw[:R + 1][::-1])[::-1]\n\n            # evaluate fitness function\n            fit_vec = self.fitness(**kwds)\n\n            A_R = fit_vec - ncp_prior\n            A_R[1:] += best[:R]\n\n            i_max = np.argmax(A_R)\n            last[R] = i_max\n            best[R] = A_R[i_max]\n\n        # ----------------------------------------------------------------\n        # Now find changepoints by iteratively peeling off the last block\n        # ----------------------------------------------------------------\n        change_points = np.zeros(N, dtype=int)\n        i_cp = N\n        ind = N\n        while i_cp > 0:\n            i_cp -= 1\n            change_points[i_cp] = ind\n            if ind == 0:\n                break\n            ind = last[ind - 1]\n        if i_cp == 0:\n            change_points[i_cp] = 0\n        change_points = change_points[i_cp:]\n\n        return edges[change_points]"},{"col":4,"comment":"null","endLoc":214,"header":"def __init__(self, p0=0.05, gamma=None, ncp_prior=None)","id":8678,"name":"__init__","nodeType":"Function","startLoc":211,"text":"def __init__(self, p0=0.05, gamma=None, ncp_prior=None):\n        self.p0 = p0\n        self.gamma = gamma\n        self.ncp_prior = ncp_prior"},{"col":4,"comment":"Validate inputs to the model.\n\n        Parameters\n        ----------\n        t : array-like\n            times of observations\n        x : array-like, optional\n            values observed at each time\n        sigma : float or array-like, optional\n            errors in values x\n\n        Returns\n        -------\n        t, x, sigma : array-like, float or None\n            validated and perhaps modified versions of inputs\n        ","endLoc":280,"header":"def validate_input(self, t, x=None, sigma=None)","id":8679,"name":"validate_input","nodeType":"Function","startLoc":216,"text":"def validate_input(self, t, x=None, sigma=None):\n        \"\"\"Validate inputs to the model.\n\n        Parameters\n        ----------\n        t : array-like\n            times of observations\n        x : array-like, optional\n            values observed at each time\n        sigma : float or array-like, optional\n            errors in values x\n\n        Returns\n        -------\n        t, x, sigma : array-like, float or None\n            validated and perhaps modified versions of inputs\n        \"\"\"\n        # validate array input\n        t = np.asarray(t, dtype=float)\n\n        # find unique values of t\n        t = np.array(t)\n        if t.ndim != 1:\n            raise ValueError(\"t must be a one-dimensional array\")\n        unq_t, unq_ind, unq_inv = np.unique(t, return_index=True,\n                                            return_inverse=True)\n\n        # if x is not specified, x will be counts at each time\n        if x is None:\n            if sigma is not None:\n                raise ValueError(\"If sigma is specified, x must be specified\")\n            else:\n                sigma = 1\n\n            if len(unq_t) == len(t):\n                x = np.ones_like(t)\n            else:\n                x = np.bincount(unq_inv)\n\n            t = unq_t\n\n        # if x is specified, then we need to simultaneously sort t and x\n        else:\n            # TODO: allow broadcasted x?\n            x = np.asarray(x, dtype=float)\n\n            if x.shape not in [(), (1,), (t.size,)]:\n                raise ValueError(\"x does not match shape of t\")\n            x += np.zeros_like(t)\n\n            if len(unq_t) != len(t):\n                raise ValueError(\"Repeated values in t not supported when \"\n                                 \"x is specified\")\n            t = unq_t\n            x = x[unq_ind]\n\n        # verify the given sigma value\n        if sigma is None:\n            sigma = 1\n        else:\n            sigma = np.asarray(sigma, dtype=float)\n            if sigma.shape not in [(), (1,), (t.size,)]:\n                raise ValueError('sigma does not match the shape of x')\n\n        return t, x, sigma"},{"col":4,"comment":"null","endLoc":1336,"header":"def _web_profile_pullCallbacks(self, private_key, timeout_secs)","id":8680,"name":"_web_profile_pullCallbacks","nodeType":"Function","startLoc":1323,"text":"def _web_profile_pullCallbacks(self, private_key, timeout_secs):\n        self._update_last_activity_time()\n        if private_key in self._private_keys:\n            callback = []\n            callback_queue = self._web_profile_callbacks[private_key]\n            try:\n                while self._is_running:\n                    item_queued = callback_queue.get_nowait()\n                    callback.append(item_queued)\n            except queue.Empty:\n                pass\n            return callback\n        else:\n            raise SAMPProxyError(5, f\"Private-key {private_key} expired or invalid.\")"},{"col":4,"comment":"Parse the time strings contained in val1 and get jd1, jd2","endLoc":1361,"header":"def get_jds_python(self, val1, val2)","id":8681,"name":"get_jds_python","nodeType":"Function","startLoc":1340,"text":"def get_jds_python(self, val1, val2):\n        \"\"\"Parse the time strings contained in val1 and get jd1, jd2\"\"\"\n        # Select subformats based on current self.in_subfmt\n        subfmts = self._select_subfmts(self.in_subfmt)\n        # Be liberal in what we accept: convert bytes to ascii.\n        # Here .item() is needed for arrays with entries of unequal length,\n        # to strip trailing 0 bytes.\n        to_string = (str if val1.dtype.kind == 'U' else\n                     lambda x: str(x.item(), encoding='ascii'))\n        iterator = np.nditer([val1, None, None, None, None, None, None],\n                             flags=['zerosize_ok'],\n                             op_dtypes=[None] + 5 * [np.intc] + [np.double])\n        for val, iy, im, id, ihr, imin, dsec in iterator:\n            val = to_string(val)\n            iy[...], im[...], id[...], ihr[...], imin[...], dsec[...] = (\n                self.parse_string(val, subfmts))\n\n        jd1, jd2 = erfa.dtf2d(self.scale.upper().encode('ascii'),\n                              *iterator.operands[1:])\n        jd1, jd2 = day_frac(jd1, jd2)\n\n        return jd1, jd2"},{"col":21,"endLoc":1348,"id":8682,"nodeType":"Lambda","startLoc":1348,"text":"lambda x: str(x.item(), encoding='ascii')"},{"col":4,"comment":"Use fast C parser to parse time strings in val1 and get jd1, jd2","endLoc":1392,"header":"def get_jds_fast(self, val1, val2)","id":8683,"name":"get_jds_fast","nodeType":"Function","startLoc":1363,"text":"def get_jds_fast(self, val1, val2):\n        \"\"\"Use fast C parser to parse time strings in val1 and get jd1, jd2\"\"\"\n        # Handle bytes or str input and convert to uint8.  We need to the\n        # dtype _parse_times.dt_u1 instead of uint8, since otherwise it is\n        # not possible to create a gufunc with structured dtype output.\n        # See note about ufunc type resolver in pyerfa/erfa/ufunc.c.templ.\n        if val1.dtype.kind == 'U':\n            # Note: val1.astype('S') is *very* slow, so we check ourselves\n            # that the input is pure ASCII.\n            val1_uint32 = val1.view((np.uint32, val1.dtype.itemsize // 4))\n            if np.any(val1_uint32 > 127):\n                raise ValueError('input is not pure ASCII')\n\n            # It might be possible to avoid making a copy via astype with\n            # cleverness in parse_times.c but leave that for another day.\n            chars = val1_uint32.astype(_parse_times.dt_u1)\n\n        else:\n            chars = val1.view((_parse_times.dt_u1, val1.dtype.itemsize))\n\n        # Call the fast parsing ufunc.\n        time_struct = self._fast_parser(chars)\n        jd1, jd2 = erfa.dtf2d(self.scale.upper().encode('ascii'),\n                              time_struct['year'],\n                              time_struct['month'],\n                              time_struct['day'],\n                              time_struct['hour'],\n                              time_struct['minute'],\n                              time_struct['second'])\n        return day_frac(jd1, jd2)"},{"attributeType":"null","col":8,"comment":"null","endLoc":155,"id":8684,"name":"_hub_secret","nodeType":"Attribute","startLoc":155,"text":"self._hub_secret"},{"attributeType":"null","col":8,"comment":"null","endLoc":139,"id":8685,"name":"_thread_lock","nodeType":"Attribute","startLoc":139,"text":"self._thread_lock"},{"col":4,"comment":"null","endLoc":283,"header":"def fitness(self, **kwargs)","id":8686,"name":"fitness","nodeType":"Function","startLoc":282,"text":"def fitness(self, **kwargs):\n        raise NotImplementedError()"},{"col":4,"comment":"\n        Empirical prior, parametrized by the false alarm probability ``p0``\n        See  eq. 21 in Scargle (2013)\n\n        Note that there was an error in this equation in the original Scargle\n        paper (the \"log\" was missing). The following corrected form is taken\n        from https://arxiv.org/abs/1304.2818\n        ","endLoc":294,"header":"def p0_prior(self, N)","id":8687,"name":"p0_prior","nodeType":"Function","startLoc":285,"text":"def p0_prior(self, N):\n        \"\"\"\n        Empirical prior, parametrized by the false alarm probability ``p0``\n        See  eq. 21 in Scargle (2013)\n\n        Note that there was an error in this equation in the original Scargle\n        paper (the \"log\" was missing). The following corrected form is taken\n        from https://arxiv.org/abs/1304.2818\n        \"\"\"\n        return 4 - np.log(73.53 * self.p0 * (N ** -0.478))"},{"attributeType":"null","col":8,"comment":"null","endLoc":184,"id":8688,"name":"_client_id_counter","nodeType":"Attribute","startLoc":184,"text":"self._client_id_counter"},{"col":4,"comment":"\n        Generator that yields a dict of values corresponding to the\n        calendar date and time for the internal JD values.\n        ","endLoc":1421,"header":"def str_kwargs(self)","id":8689,"name":"str_kwargs","nodeType":"Function","startLoc":1394,"text":"def str_kwargs(self):\n        \"\"\"\n        Generator that yields a dict of values corresponding to the\n        calendar date and time for the internal JD values.\n        \"\"\"\n        scale = self.scale.upper().encode('ascii'),\n        iys, ims, ids, ihmsfs = erfa.d2dtf(scale, self.precision,\n                                           self.jd1, self.jd2_filled)\n\n        # Get the str_fmt element of the first allowed output subformat\n        _, _, str_fmt = self._select_subfmts(self.out_subfmt)[0]\n\n        yday = None\n        has_yday = '{yday:' in str_fmt\n\n        ihrs = ihmsfs['h']\n        imins = ihmsfs['m']\n        isecs = ihmsfs['s']\n        ifracs = ihmsfs['f']\n        for iy, im, id, ihr, imin, isec, ifracsec in np.nditer(\n                [iys, ims, ids, ihrs, imins, isecs, ifracs],\n                flags=['zerosize_ok']):\n            if has_yday:\n                yday = datetime.datetime(iy, im, id).timetuple().tm_yday\n\n            yield {'year': int(iy), 'mon': int(im), 'day': int(id),\n                   'hour': int(ihr), 'min': int(imin), 'sec': int(isec),\n                   'fracsec': int(ifracsec), 'yday': yday}"},{"col":4,"comment":"null","endLoc":300,"header":"@property\n    def _fitness_args(self)","id":8690,"name":"_fitness_args","nodeType":"Function","startLoc":298,"text":"@property\n    def _fitness_args(self):\n        return signature(self.fitness).parameters.keys()"},{"col":4,"comment":"\n        If ``ncp_prior`` is not explicitly defined, compute it from ``gamma``\n        or ``p0``.\n        ","endLoc":314,"header":"def compute_ncp_prior(self, N)","id":8691,"name":"compute_ncp_prior","nodeType":"Function","startLoc":302,"text":"def compute_ncp_prior(self, N):\n        \"\"\"\n        If ``ncp_prior`` is not explicitly defined, compute it from ``gamma``\n        or ``p0``.\n        \"\"\"\n\n        if self.gamma is not None:\n            return -np.log(self.gamma)\n        elif self.p0 is not None:\n            return self.p0_prior(N)\n        else:\n            raise ValueError(\"``ncp_prior`` cannot be computed as neither \"\n                             \"``gamma`` nor ``p0`` is defined.\")"},{"attributeType":"null","col":8,"comment":"null","endLoc":162,"id":8692,"name":"_private_keys","nodeType":"Attribute","startLoc":162,"text":"self._private_keys"},{"attributeType":"null","col":8,"comment":"null","endLoc":178,"id":8693,"name":"_xmlrpc_endpoints","nodeType":"Attribute","startLoc":178,"text":"self._xmlrpc_endpoints"},{"attributeType":"null","col":8,"comment":"null","endLoc":154,"id":8694,"name":"_hub_secret_code_customized","nodeType":"Attribute","startLoc":154,"text":"self._hub_secret_code_customized"},{"attributeType":"null","col":8,"comment":"null","endLoc":113,"id":8695,"name":"_label","nodeType":"Attribute","startLoc":113,"text":"self._label"},{"col":4,"comment":"Write time to a string using a given format.\n\n        By default, just interprets str_fmt as a format string,\n        but subclasses can add to this.\n        ","endLoc":1429,"header":"def format_string(self, str_fmt, **kwargs)","id":8696,"name":"format_string","nodeType":"Function","startLoc":1423,"text":"def format_string(self, str_fmt, **kwargs):\n        \"\"\"Write time to a string using a given format.\n\n        By default, just interprets str_fmt as a format string,\n        but subclasses can add to this.\n        \"\"\"\n        return str_fmt.format(**kwargs)"},{"col":4,"comment":"null","endLoc":1448,"header":"@property\n    def value(self)","id":8697,"name":"value","nodeType":"Function","startLoc":1431,"text":"@property\n    def value(self):\n        # Select the first available subformat based on current\n        # self.out_subfmt\n        subfmts = self._select_subfmts(self.out_subfmt)\n        _, _, str_fmt = subfmts[0]\n\n        # TODO: fix this ugly hack\n        if self.precision > 0 and str_fmt.endswith('{sec:02d}'):\n            str_fmt += '.{fracsec:0' + str(self.precision) + 'd}'\n\n        # Try to optimize this later.  Can't pre-allocate because length of\n        # output could change, e.g. year rolls from 999 to 1000.\n        outs = []\n        for kwargs in self.str_kwargs():\n            outs.append(str(self.format_string(str_fmt, **kwargs)))\n\n        return np.array(outs).reshape(self.jd1.shape)"},{"attributeType":"null","col":8,"comment":"null","endLoc":111,"id":8698,"name":"_port","nodeType":"Attribute","startLoc":111,"text":"self._port"},{"attributeType":"None","col":8,"comment":"null","endLoc":142,"id":8699,"name":"_thread_client_timeout","nodeType":"Attribute","startLoc":142,"text":"self._thread_client_timeout"},{"attributeType":"ThreadingXMLRPCServer","col":8,"comment":"null","endLoc":238,"id":8700,"name":"_server","nodeType":"Attribute","startLoc":238,"text":"self._server"},{"attributeType":"null","col":8,"comment":"null","endLoc":148,"id":8701,"name":"_client_activity_time","nodeType":"Attribute","startLoc":148,"text":"self._client_activity_time"},{"attributeType":"None","col":8,"comment":"null","endLoc":147,"id":8702,"name":"_last_activity_time","nodeType":"Attribute","startLoc":147,"text":"self._last_activity_time"},{"attributeType":"null","col":8,"comment":"null","endLoc":115,"id":8703,"name":"_client_timeout","nodeType":"Attribute","startLoc":115,"text":"self._client_timeout"},{"attributeType":"null","col":8,"comment":"null","endLoc":144,"id":8704,"name":"_launched_threads","nodeType":"Attribute","startLoc":144,"text":"self._launched_threads"},{"attributeType":"null","col":8,"comment":"null","endLoc":114,"id":8705,"name":"_timeout","nodeType":"Attribute","startLoc":114,"text":"self._timeout"},{"attributeType":"null","col":8,"comment":"null","endLoc":166,"id":8706,"name":"_metadata","nodeType":"Attribute","startLoc":166,"text":"self._metadata"},{"attributeType":"null","col":8,"comment":"null","endLoc":245,"id":8707,"name":"_url","nodeType":"Attribute","startLoc":245,"text":"self._url"},{"attributeType":"null","col":8,"comment":"null","endLoc":181,"id":8708,"name":"_sync_msg_ids_heap","nodeType":"Attribute","startLoc":181,"text":"self._sync_msg_ids_heap"},{"attributeType":"None","col":8,"comment":"null","endLoc":123,"id":8709,"name":"_web_profile_server","nodeType":"Attribute","startLoc":123,"text":"self._web_profile_server"},{"attributeType":"null","col":8,"comment":"null","endLoc":124,"id":8710,"name":"_web_profile_callbacks","nodeType":"Attribute","startLoc":124,"text":"self._web_profile_callbacks"},{"attributeType":"null","col":8,"comment":"null","endLoc":359,"id":8711,"name":"_hub_private_key","nodeType":"Attribute","startLoc":359,"text":"self._hub_private_key"},{"attributeType":"null","col":8,"comment":"null","endLoc":116,"id":8712,"name":"_pool_size","nodeType":"Attribute","startLoc":116,"text":"self._pool_size"},{"className":"SigmaClip","col":0,"comment":"\n    Class to perform sigma clipping.\n\n    The data will be iterated over, each time rejecting values that are\n    less or more than a specified number of standard deviations from a\n    center value.\n\n    Clipped (rejected) pixels are those where::\n\n        data < center - (sigma_lower * std)\n        data > center + (sigma_upper * std)\n\n    where::\n\n        center = cenfunc(data [, axis=])\n        std = stdfunc(data [, axis=])\n\n    Invalid data values (i.e., NaN or inf) are automatically clipped.\n\n    For a functional interface to sigma clipping, see\n    :func:`sigma_clip`.\n\n    .. note::\n        `scipy.stats.sigmaclip` provides a subset of the functionality\n        in this class. Also, its input data cannot be a masked array\n        and it does not handle data that contains invalid values (i.e.,\n        NaN or inf). Also note that it uses the mean as the centering\n        function. The equivalent settings to `scipy.stats.sigmaclip`\n        are::\n\n            sigclip = SigmaClip(sigma=4., cenfunc='mean', maxiters=None)\n            sigclip(data, axis=None, masked=False, return_bounds=True)\n\n    Parameters\n    ----------\n    sigma : float, optional\n        The number of standard deviations to use for both the lower\n        and upper clipping limit. These limits are overridden by\n        ``sigma_lower`` and ``sigma_upper``, if input. The default is 3.\n\n    sigma_lower : float or None, optional\n        The number of standard deviations to use as the lower bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    sigma_upper : float or None, optional\n        The number of standard deviations to use as the upper bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    maxiters : int or None, optional\n        The maximum number of sigma-clipping iterations to perform or\n        `None` to clip until convergence is achieved (i.e., iterate\n        until the last iteration clips nothing). If convergence is\n        achieved prior to ``maxiters`` iterations, the clipping\n        iterations will stop. The default is 5.\n\n    cenfunc : {'median', 'mean'} or callable, optional\n        The statistic or callable function/object used to compute\n        the center value for the clipping. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanmean`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'median'``.\n\n    stdfunc : {'std', 'mad_std'} or callable, optional\n        The statistic or callable function/object used to compute the\n        standard deviation about the center value. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanstd`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'std'``.\n\n    grow : float or `False`, optional\n        Radius within which to mask the neighbouring pixels of those\n        that fall outwith the clipping limits (only applied along\n        ``axis``, if specified). As an example, for a 2D image a value\n        of 1 will mask the nearest pixels in a cross pattern around each\n        deviant pixel, while 1.5 will also reject the nearest diagonal\n        neighbours and so on.\n\n    See Also\n    --------\n    sigma_clip, sigma_clipped_stats\n\n    Notes\n    -----\n    The best performance will typically be obtained by setting\n    ``cenfunc`` and ``stdfunc`` to one of the built-in functions\n    specified as as string. If one of the options is set to a string\n    while the other has a custom callable, you may in some cases see\n    better performance if you have the `bottleneck`_ package installed.\n\n    .. _bottleneck:  https://github.com/pydata/bottleneck\n\n    Examples\n    --------\n    This example uses a data array of random variates from a Gaussian\n    distribution. We clip all points that are more than 2 sample\n    standard deviations from the median. The result is a masked array,\n    where the mask is `True` for clipped data::\n\n        >>> from astropy.stats import SigmaClip\n        >>> from numpy.random import randn\n        >>> randvar = randn(10000)\n        >>> sigclip = SigmaClip(sigma=2, maxiters=5)\n        >>> filtered_data = sigclip(randvar)\n\n    This example clips all points that are more than 3 sigma relative\n    to the sample *mean*, clips until convergence, returns an unmasked\n    `~numpy.ndarray`, and modifies the data in-place::\n\n        >>> from astropy.stats import SigmaClip\n        >>> from numpy.random import randn\n        >>> from numpy import mean\n        >>> randvar = randn(10000)\n        >>> sigclip = SigmaClip(sigma=3, maxiters=None, cenfunc='mean')\n        >>> filtered_data = sigclip(randvar, masked=False, copy=False)\n\n    This example sigma clips along one axis::\n\n        >>> from astropy.stats import SigmaClip\n        >>> from numpy.random import normal\n        >>> from numpy import arange, diag, ones\n        >>> data = arange(5) + normal(0., 0.05, (5, 5)) + diag(ones(5))\n        >>> sigclip = SigmaClip(sigma=2.3)\n        >>> filtered_data = sigclip(data, axis=0)\n\n    Note that along the other axis, no points would be clipped, as the\n    standard deviation is higher.\n    ","endLoc":644,"id":8713,"nodeType":"Class","startLoc":93,"text":"class SigmaClip:\n    \"\"\"\n    Class to perform sigma clipping.\n\n    The data will be iterated over, each time rejecting values that are\n    less or more than a specified number of standard deviations from a\n    center value.\n\n    Clipped (rejected) pixels are those where::\n\n        data < center - (sigma_lower * std)\n        data > center + (sigma_upper * std)\n\n    where::\n\n        center = cenfunc(data [, axis=])\n        std = stdfunc(data [, axis=])\n\n    Invalid data values (i.e., NaN or inf) are automatically clipped.\n\n    For a functional interface to sigma clipping, see\n    :func:`sigma_clip`.\n\n    .. note::\n        `scipy.stats.sigmaclip` provides a subset of the functionality\n        in this class. Also, its input data cannot be a masked array\n        and it does not handle data that contains invalid values (i.e.,\n        NaN or inf). Also note that it uses the mean as the centering\n        function. The equivalent settings to `scipy.stats.sigmaclip`\n        are::\n\n            sigclip = SigmaClip(sigma=4., cenfunc='mean', maxiters=None)\n            sigclip(data, axis=None, masked=False, return_bounds=True)\n\n    Parameters\n    ----------\n    sigma : float, optional\n        The number of standard deviations to use for both the lower\n        and upper clipping limit. These limits are overridden by\n        ``sigma_lower`` and ``sigma_upper``, if input. The default is 3.\n\n    sigma_lower : float or None, optional\n        The number of standard deviations to use as the lower bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    sigma_upper : float or None, optional\n        The number of standard deviations to use as the upper bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    maxiters : int or None, optional\n        The maximum number of sigma-clipping iterations to perform or\n        `None` to clip until convergence is achieved (i.e., iterate\n        until the last iteration clips nothing). If convergence is\n        achieved prior to ``maxiters`` iterations, the clipping\n        iterations will stop. The default is 5.\n\n    cenfunc : {'median', 'mean'} or callable, optional\n        The statistic or callable function/object used to compute\n        the center value for the clipping. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanmean`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'median'``.\n\n    stdfunc : {'std', 'mad_std'} or callable, optional\n        The statistic or callable function/object used to compute the\n        standard deviation about the center value. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanstd`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'std'``.\n\n    grow : float or `False`, optional\n        Radius within which to mask the neighbouring pixels of those\n        that fall outwith the clipping limits (only applied along\n        ``axis``, if specified). As an example, for a 2D image a value\n        of 1 will mask the nearest pixels in a cross pattern around each\n        deviant pixel, while 1.5 will also reject the nearest diagonal\n        neighbours and so on.\n\n    See Also\n    --------\n    sigma_clip, sigma_clipped_stats\n\n    Notes\n    -----\n    The best performance will typically be obtained by setting\n    ``cenfunc`` and ``stdfunc`` to one of the built-in functions\n    specified as as string. If one of the options is set to a string\n    while the other has a custom callable, you may in some cases see\n    better performance if you have the `bottleneck`_ package installed.\n\n    .. _bottleneck:  https://github.com/pydata/bottleneck\n\n    Examples\n    --------\n    This example uses a data array of random variates from a Gaussian\n    distribution. We clip all points that are more than 2 sample\n    standard deviations from the median. The result is a masked array,\n    where the mask is `True` for clipped data::\n\n        >>> from astropy.stats import SigmaClip\n        >>> from numpy.random import randn\n        >>> randvar = randn(10000)\n        >>> sigclip = SigmaClip(sigma=2, maxiters=5)\n        >>> filtered_data = sigclip(randvar)\n\n    This example clips all points that are more than 3 sigma relative\n    to the sample *mean*, clips until convergence, returns an unmasked\n    `~numpy.ndarray`, and modifies the data in-place::\n\n        >>> from astropy.stats import SigmaClip\n        >>> from numpy.random import randn\n        >>> from numpy import mean\n        >>> randvar = randn(10000)\n        >>> sigclip = SigmaClip(sigma=3, maxiters=None, cenfunc='mean')\n        >>> filtered_data = sigclip(randvar, masked=False, copy=False)\n\n    This example sigma clips along one axis::\n\n        >>> from astropy.stats import SigmaClip\n        >>> from numpy.random import normal\n        >>> from numpy import arange, diag, ones\n        >>> data = arange(5) + normal(0., 0.05, (5, 5)) + diag(ones(5))\n        >>> sigclip = SigmaClip(sigma=2.3)\n        >>> filtered_data = sigclip(data, axis=0)\n\n    Note that along the other axis, no points would be clipped, as the\n    standard deviation is higher.\n    \"\"\"\n\n    def __init__(self, sigma=3., sigma_lower=None, sigma_upper=None,\n                 maxiters=5, cenfunc='median', stdfunc='std', grow=False):\n        self.sigma = sigma\n        self.sigma_lower = sigma_lower or sigma\n        self.sigma_upper = sigma_upper or sigma\n        self.maxiters = maxiters or np.inf\n        self.cenfunc = cenfunc\n        self.stdfunc = stdfunc\n        self._cenfunc_parsed = self._parse_cenfunc(cenfunc)\n        self._stdfunc_parsed = self._parse_stdfunc(stdfunc)\n        self._min_value = np.nan\n        self._max_value = np.nan\n        self._niterations = 0\n        self.grow = grow\n\n        # This just checks that SciPy is available, to avoid failing\n        # later than necessary if __call__ needs it:\n        if self.grow:\n            from scipy.ndimage import binary_dilation\n            self._binary_dilation = binary_dilation\n\n    def __repr__(self):\n        return ('SigmaClip(sigma={}, sigma_lower={}, sigma_upper={}, '\n                'maxiters={}, cenfunc={}, stdfunc={}, grow={})'\n                .format(self.sigma, self.sigma_lower, self.sigma_upper,\n                        self.maxiters, repr(self.cenfunc), repr(self.stdfunc),\n                        self.grow))\n\n    def __str__(self):\n        lines = ['<' + self.__class__.__name__ + '>']\n        attrs = ['sigma', 'sigma_lower', 'sigma_upper', 'maxiters', 'cenfunc',\n                 'stdfunc', 'grow']\n        for attr in attrs:\n            lines.append(f'    {attr}: {repr(getattr(self, attr))}')\n        return '\\n'.join(lines)\n\n    @staticmethod\n    def _parse_cenfunc(cenfunc):\n        if isinstance(cenfunc, str):\n            if cenfunc == 'median':\n                if HAS_BOTTLENECK:\n                    cenfunc = _nanmedian\n                else:\n                    cenfunc = np.nanmedian  # pragma: no cover\n\n            elif cenfunc == 'mean':\n                if HAS_BOTTLENECK:\n                    cenfunc = _nanmean\n                else:\n                    cenfunc = np.nanmean  # pragma: no cover\n\n            else:\n                raise ValueError(f'{cenfunc} is an invalid cenfunc.')\n\n        return cenfunc\n\n    @staticmethod\n    def _parse_stdfunc(stdfunc):\n        if isinstance(stdfunc, str):\n            if stdfunc == 'std':\n                if HAS_BOTTLENECK:\n                    stdfunc = _nanstd\n                else:\n                    stdfunc = np.nanstd  # pragma: no cover\n            elif stdfunc == 'mad_std':\n                stdfunc = _nanmadstd\n            else:\n                raise ValueError(f'{stdfunc} is an invalid stdfunc.')\n\n        return stdfunc\n\n    def _compute_bounds(self, data, axis=None):\n        # ignore RuntimeWarning if the array (or along an axis) has only\n        # NaNs\n        with warnings.catch_warnings():\n            warnings.simplefilter(\"ignore\", category=RuntimeWarning)\n            self._max_value = self._cenfunc_parsed(data, axis=axis)\n            std = self._stdfunc_parsed(data, axis=axis)\n            self._min_value = self._max_value - (std * self.sigma_lower)\n            self._max_value += std * self.sigma_upper\n\n    def _sigmaclip_fast(self, data, axis=None,\n                        masked=True, return_bounds=False,\n                        copy=True):\n        \"\"\"\n        Fast C implementation for simple use cases.\n        \"\"\"\n        if isinstance(data, Quantity):\n            data, unit = data.value, data.unit\n        else:\n            unit = None\n\n        if copy is False and masked is False and data.dtype.kind != 'f':\n            raise Exception(\"cannot mask non-floating-point array with NaN \"\n                            \"values, set copy=True or masked=True to avoid \"\n                            \"this.\")\n\n        if axis is None:\n            axis = -1 if data.ndim == 1 else tuple(range(data.ndim))\n\n        if not isiterable(axis):\n            axis = normalize_axis_index(axis, data.ndim)\n            data_reshaped = data\n            transposed_shape = None\n        else:\n            # The gufunc implementation does not handle non-scalar axis\n            # so we combine the dimensions together as the last\n            # dimension and set axis=-1\n            axis = tuple(normalize_axis_index(ax, data.ndim) for ax in axis)\n            transposed_axes = tuple(ax for ax in range(data.ndim)\n                                    if ax not in axis) + axis\n            data_transposed = data.transpose(transposed_axes)\n            transposed_shape = data_transposed.shape\n            data_reshaped = data_transposed.reshape(\n                transposed_shape[:data.ndim - len(axis)] + (-1,))\n            axis = -1\n\n        if data_reshaped.dtype.kind != 'f' or data_reshaped.dtype.itemsize > 8:\n            data_reshaped = data_reshaped.astype(float)\n\n        mask = ~np.isfinite(data_reshaped)\n        if np.any(mask):\n            warnings.warn('Input data contains invalid values (NaNs or '\n                          'infs), which were automatically clipped.',\n                          AstropyUserWarning)\n\n        if isinstance(data_reshaped, np.ma.MaskedArray):\n            mask |= data_reshaped.mask\n            data = data.view(np.ndarray)\n            data_reshaped = data_reshaped.view(np.ndarray)\n            mask = np.broadcast_to(mask, data_reshaped.shape).copy()\n\n        bound_lo, bound_hi = _sigma_clip_fast(\n            data_reshaped, mask, self.cenfunc == 'median',\n            self.stdfunc == 'mad_std',\n            -1 if np.isinf(self.maxiters) else self.maxiters,\n            self.sigma_lower, self.sigma_upper, axis=axis)\n\n        with np.errstate(invalid='ignore'):\n            mask |= data_reshaped < np.expand_dims(bound_lo, axis)\n            mask |= data_reshaped > np.expand_dims(bound_hi, axis)\n\n        if transposed_shape is not None:\n            # Get mask in shape of data.\n            mask = mask.reshape(transposed_shape)\n            mask = mask.transpose(tuple(transposed_axes.index(ax)\n                                        for ax in range(data.ndim)))\n\n        if masked:\n            result = np.ma.array(data, mask=mask, copy=copy)\n        else:\n            if copy:\n                result = data.astype(float, copy=True)\n            else:\n                result = data\n            result[mask] = np.nan\n\n        if unit is not None:\n            result = result << unit\n            bound_lo = bound_lo << unit\n            bound_hi = bound_hi << unit\n\n        if return_bounds:\n            return result, bound_lo, bound_hi\n        else:\n            return result\n\n    def _sigmaclip_noaxis(self, data, masked=True, return_bounds=False,\n                          copy=True):\n        \"\"\"\n        Sigma clip when ``axis`` is None and ``grow`` is not >0.\n\n        In this simple case, we remove clipped elements from the\n        flattened array during each iteration.\n        \"\"\"\n        filtered_data = data.ravel()\n\n        # remove masked values and convert to ndarray\n        if isinstance(filtered_data, np.ma.MaskedArray):\n            filtered_data = filtered_data.data[~filtered_data.mask]\n\n        # remove invalid values\n        good_mask = np.isfinite(filtered_data)\n        if np.any(~good_mask):\n            filtered_data = filtered_data[good_mask]\n            warnings.warn('Input data contains invalid values (NaNs or '\n                          'infs), which were automatically clipped.',\n                          AstropyUserWarning)\n\n        nchanged = 1\n        iteration = 0\n        while nchanged != 0 and (iteration < self.maxiters):\n            iteration += 1\n            size = filtered_data.size\n            self._compute_bounds(filtered_data, axis=None)\n            filtered_data = filtered_data[\n                (filtered_data >= self._min_value)\n                & (filtered_data <= self._max_value)]\n            nchanged = size - filtered_data.size\n\n        self._niterations = iteration\n\n        if masked:\n            # return a masked array and optional bounds\n            filtered_data = np.ma.masked_invalid(data, copy=copy)\n\n            # update the mask in place, ignoring RuntimeWarnings for\n            # comparisons with NaN data values\n            with np.errstate(invalid='ignore'):\n                filtered_data.mask |= np.logical_or(data < self._min_value,\n                                                    data > self._max_value)\n\n        if return_bounds:\n            return filtered_data, self._min_value, self._max_value\n        else:\n            return filtered_data\n\n    def _sigmaclip_withaxis(self, data, axis=None, masked=True,\n                            return_bounds=False, copy=True):\n        \"\"\"\n        Sigma clip the data when ``axis`` or ``grow`` is specified.\n\n        In this case, we replace clipped values with NaNs as placeholder\n        values.\n        \"\"\"\n        # float array type is needed to insert nans into the array\n        filtered_data = data.astype(float)    # also makes a copy\n\n        # remove invalid values\n        bad_mask = ~np.isfinite(filtered_data)\n        if np.any(bad_mask):\n            filtered_data[bad_mask] = np.nan\n            warnings.warn('Input data contains invalid values (NaNs or '\n                          'infs), which were automatically clipped.',\n                          AstropyUserWarning)\n\n        # remove masked values and convert to plain ndarray\n        if isinstance(filtered_data, np.ma.MaskedArray):\n            filtered_data = np.ma.masked_invalid(filtered_data).astype(float)\n            filtered_data = filtered_data.filled(np.nan)\n\n        if axis is not None:\n            # convert negative axis/axes\n            if not isiterable(axis):\n                axis = (axis,)\n            axis = tuple(filtered_data.ndim + n if n < 0 else n for n in axis)\n\n            # define the shape of min/max arrays so that they can be broadcast\n            # with the data\n            mshape = tuple(1 if dim in axis else size\n                           for dim, size in enumerate(filtered_data.shape))\n\n        if self.grow:\n            # Construct a growth kernel from the specified radius in\n            # pixels (consider caching this for re-use by subsequent\n            # calls?):\n            cenidx = int(self.grow)\n            size = 2 * cenidx + 1\n            indices = np.mgrid[(slice(0, size),) * data.ndim]\n            if axis is not None:\n                for n, dim in enumerate(indices):\n                    # For any axes that we're not clipping over, set\n                    # their indices outside the growth radius, so masked\n                    # points won't \"grow\" in that dimension:\n                    if n not in axis:\n                        dim[dim != cenidx] = size\n            kernel = (sum(((idx - cenidx)**2 for idx in indices))\n                      <= self.grow**2)\n            del indices\n\n        nchanged = 1\n        iteration = 0\n        while nchanged != 0 and (iteration < self.maxiters):\n            iteration += 1\n            self._compute_bounds(filtered_data, axis=axis)\n            if not np.isscalar(self._min_value):\n                self._min_value = self._min_value.reshape(mshape)\n                self._max_value = self._max_value.reshape(mshape)\n\n            with np.errstate(invalid='ignore'):\n                # Since these comparisons are always False for NaNs, the\n                # resulting mask contains only newly-rejected pixels and\n                # we can dilate it without growing masked pixels more\n                # than once.\n                new_mask = ((filtered_data < self._min_value)\n                            | (filtered_data > self._max_value))\n            if self.grow:\n                new_mask = self._binary_dilation(new_mask, kernel)\n            filtered_data[new_mask] = np.nan\n            nchanged = np.count_nonzero(new_mask)\n            del new_mask\n\n        self._niterations = iteration\n\n        if masked:\n            # create an output masked array\n            if copy:\n                filtered_data = np.ma.MaskedArray(data,\n                                                  ~np.isfinite(filtered_data),\n                                                  copy=True)\n            else:\n                # ignore RuntimeWarnings for comparisons with NaN data values\n                with np.errstate(invalid='ignore'):\n                    out = np.ma.masked_invalid(data, copy=False)\n\n                    filtered_data = np.ma.masked_where(np.logical_or(\n                        out < self._min_value, out > self._max_value),\n                        out, copy=False)\n\n        if return_bounds:\n            return filtered_data, self._min_value, self._max_value\n        else:\n            return filtered_data\n\n    def __call__(self, data, axis=None, masked=True, return_bounds=False,\n                 copy=True):\n        \"\"\"\n        Perform sigma clipping on the provided data.\n\n        Parameters\n        ----------\n        data : array-like or `~numpy.ma.MaskedArray`\n            The data to be sigma clipped.\n\n        axis : None or int or tuple of int, optional\n            The axis or axes along which to sigma clip the data. If\n            `None`, then the flattened data will be used. ``axis`` is\n            passed to the ``cenfunc`` and ``stdfunc``. The default is\n            `None`.\n\n        masked : bool, optional\n            If `True`, then a `~numpy.ma.MaskedArray` is returned, where\n            the mask is `True` for clipped values. If `False`, then a\n            `~numpy.ndarray` is returned. The default is `True`.\n\n        return_bounds : bool, optional\n            If `True`, then the minimum and maximum clipping bounds are\n            also returned.\n\n        copy : bool, optional\n            If `True`, then the ``data`` array will be copied. If\n            `False` and ``masked=True``, then the returned masked array\n            data will contain the same array as the input ``data`` (if\n            ``data`` is a `~numpy.ndarray` or `~numpy.ma.MaskedArray`).\n            If `False` and ``masked=False``, the input data is modified\n            in-place. The default is `True`.\n\n        Returns\n        -------\n        result : array-like\n            If ``masked=True``, then a `~numpy.ma.MaskedArray` is\n            returned, where the mask is `True` for clipped values and\n            where the input mask was `True`.\n\n            If ``masked=False``, then a `~numpy.ndarray` is returned.\n\n            If ``return_bounds=True``, then in addition to the masked\n            array or array above, the minimum and maximum clipping\n            bounds are returned.\n\n            If ``masked=False`` and ``axis=None``, then the output\n            array is a flattened 1D `~numpy.ndarray` where the clipped\n            values have been removed. If ``return_bounds=True`` then the\n            returned minimum and maximum thresholds are scalars.\n\n            If ``masked=False`` and ``axis`` is specified, then the\n            output `~numpy.ndarray` will have the same shape as the\n            input ``data`` and contain ``np.nan`` where values were\n            clipped. If the input ``data`` was a masked array, then the\n            output `~numpy.ndarray` will also contain ``np.nan`` where\n            the input mask was `True`. If ``return_bounds=True`` then\n            the returned minimum and maximum clipping thresholds will be\n            be `~numpy.ndarray`\\\\s.\n        \"\"\"\n        data = np.asanyarray(data)\n\n        if data.size == 0:\n            if masked:\n                result = np.ma.MaskedArray(data)\n            else:\n                result = data\n\n            if return_bounds:\n                return result, self._min_value, self._max_value\n            else:\n                return result\n\n        if isinstance(data, np.ma.MaskedArray) and data.mask.all():\n            if masked:\n                result = data\n            else:\n                result = np.full(data.shape, np.nan)\n\n            if return_bounds:\n                return result, self._min_value, self._max_value\n            else:\n                return result\n\n        # Shortcut for common cases where a fast C implementation can be\n        # used.\n        if (self.cenfunc in ('mean', 'median')\n                and self.stdfunc in ('std', 'mad_std')\n                and axis is not None and not self.grow):\n            return self._sigmaclip_fast(data, axis=axis, masked=masked,\n                                        return_bounds=return_bounds,\n                                        copy=copy)\n\n        # These two cases are treated separately because when\n        # ``axis=None`` we can simply remove clipped values from the\n        # array. This is not possible when ``axis`` or ``grow`` is\n        # specified.\n        if axis is None and not self.grow:\n            return self._sigmaclip_noaxis(data, masked=masked,\n                                          return_bounds=return_bounds,\n                                          copy=copy)\n        else:\n            return self._sigmaclip_withaxis(data, axis=axis, masked=masked,\n                                            return_bounds=return_bounds,\n                                            copy=copy)"},{"col":0,"comment":"Construct a callable piecewise-linear CDF from a pair of arrays.\n\n    Take a pair of arrays in the format returned by fold_intervals and\n    make a callable cumulative distribution function on the interval\n    (0,1).\n\n    Parameters\n    ----------\n    breaks : (N,) array of float\n        The boundaries of successive intervals.\n    totals : (N-1,) array of float\n        The weight for each interval.\n\n    Returns\n    -------\n    f : callable\n        A cumulative distribution function corresponding to the\n        piecewise-constant probability distribution given by breaks, weights\n\n    ","endLoc":1581,"header":"def cdf_from_intervals(breaks, totals)","id":8714,"name":"cdf_from_intervals","nodeType":"Function","startLoc":1548,"text":"def cdf_from_intervals(breaks, totals):\n    \"\"\"Construct a callable piecewise-linear CDF from a pair of arrays.\n\n    Take a pair of arrays in the format returned by fold_intervals and\n    make a callable cumulative distribution function on the interval\n    (0,1).\n\n    Parameters\n    ----------\n    breaks : (N,) array of float\n        The boundaries of successive intervals.\n    totals : (N-1,) array of float\n        The weight for each interval.\n\n    Returns\n    -------\n    f : callable\n        A cumulative distribution function corresponding to the\n        piecewise-constant probability distribution given by breaks, weights\n\n    \"\"\"\n    if breaks[0] != 0 or breaks[-1] != 1:\n        raise ValueError(\"Intervals must be restricted to [0,1]\")\n    if np.any(np.diff(breaks) <= 0):\n        raise ValueError(\"Breaks must be strictly increasing\")\n    if np.any(totals < 0):\n        raise ValueError(\n            \"Total weights in each subinterval must be nonnegative\")\n    if np.all(totals == 0):\n        raise ValueError(\"At least one interval must have positive exposure\")\n    b = breaks.copy()\n    c = np.concatenate(((0,), np.cumsum(totals * np.diff(b))))\n    c /= c[-1]\n    return lambda x: np.interp(x, b, c, 0, 1)"},{"col":4,"comment":"null","endLoc":245,"header":"def __init__(self, sigma=3., sigma_lower=None, sigma_upper=None,\n                 maxiters=5, cenfunc='median', stdfunc='std', grow=False)","id":8715,"name":"__init__","nodeType":"Function","startLoc":226,"text":"def __init__(self, sigma=3., sigma_lower=None, sigma_upper=None,\n                 maxiters=5, cenfunc='median', stdfunc='std', grow=False):\n        self.sigma = sigma\n        self.sigma_lower = sigma_lower or sigma\n        self.sigma_upper = sigma_upper or sigma\n        self.maxiters = maxiters or np.inf\n        self.cenfunc = cenfunc\n        self.stdfunc = stdfunc\n        self._cenfunc_parsed = self._parse_cenfunc(cenfunc)\n        self._stdfunc_parsed = self._parse_stdfunc(stdfunc)\n        self._min_value = np.nan\n        self._max_value = np.nan\n        self._niterations = 0\n        self.grow = grow\n\n        # This just checks that SciPy is available, to avoid failing\n        # later than necessary if __call__ needs it:\n        if self.grow:\n            from scipy.ndimage import binary_dilation\n            self._binary_dilation = binary_dilation"},{"attributeType":"None","col":8,"comment":"null","endLoc":141,"id":8716,"name":"_thread_hub_timeout","nodeType":"Attribute","startLoc":141,"text":"self._thread_hub_timeout"},{"attributeType":"null","col":8,"comment":"null","endLoc":170,"id":8717,"name":"_mtype2ids","nodeType":"Attribute","startLoc":170,"text":"self._mtype2ids"},{"attributeType":"null","col":8,"comment":"null","endLoc":158,"id":8718,"name":"_hub_public_id","nodeType":"Attribute","startLoc":158,"text":"self._hub_public_id"},{"attributeType":"null","col":8,"comment":"null","endLoc":112,"id":8719,"name":"_mode","nodeType":"Attribute","startLoc":112,"text":"self._mode"},{"col":4,"comment":"Fit the Bayesian Blocks model given the specified fitness function.\n\n        Parameters\n        ----------\n        t : array-like\n            data times (one dimensional, length N)\n        x : array-like, optional\n            data values\n        sigma : array-like or float, optional\n            data errors\n\n        Returns\n        -------\n        edges : ndarray\n            array containing the (M+1) edges defining the M optimal bins\n        ","endLoc":413,"header":"def fit(self, t, x=None, sigma=None)","id":8720,"name":"fit","nodeType":"Function","startLoc":316,"text":"def fit(self, t, x=None, sigma=None):\n        \"\"\"Fit the Bayesian Blocks model given the specified fitness function.\n\n        Parameters\n        ----------\n        t : array-like\n            data times (one dimensional, length N)\n        x : array-like, optional\n            data values\n        sigma : array-like or float, optional\n            data errors\n\n        Returns\n        -------\n        edges : ndarray\n            array containing the (M+1) edges defining the M optimal bins\n        \"\"\"\n        t, x, sigma = self.validate_input(t, x, sigma)\n\n        # compute values needed for computation, below\n        if 'a_k' in self._fitness_args:\n            ak_raw = np.ones_like(x) / sigma ** 2\n        if 'b_k' in self._fitness_args:\n            bk_raw = x / sigma ** 2\n        if 'c_k' in self._fitness_args:\n            ck_raw = x * x / sigma ** 2\n\n        # create length-(N + 1) array of cell edges\n        edges = np.concatenate([t[:1],\n                                0.5 * (t[1:] + t[:-1]),\n                                t[-1:]])\n        block_length = t[-1] - edges\n\n        # arrays to store the best configuration\n        N = len(t)\n        best = np.zeros(N, dtype=float)\n        last = np.zeros(N, dtype=int)\n\n        # Compute ncp_prior if not defined\n        if self.ncp_prior is None:\n            ncp_prior = self.compute_ncp_prior(N)\n        else:\n            ncp_prior = self.ncp_prior\n\n        # ----------------------------------------------------------------\n        # Start with first data cell; add one cell at each iteration\n        # ----------------------------------------------------------------\n        for R in range(N):\n            # Compute fit_vec : fitness of putative last block (end at R)\n            kwds = {}\n\n            # T_k: width/duration of each block\n            if 'T_k' in self._fitness_args:\n                kwds['T_k'] = block_length[:R + 1] - block_length[R + 1]\n\n            # N_k: number of elements in each block\n            if 'N_k' in self._fitness_args:\n                kwds['N_k'] = np.cumsum(x[:R + 1][::-1])[::-1]\n\n            # a_k: eq. 31\n            if 'a_k' in self._fitness_args:\n                kwds['a_k'] = 0.5 * np.cumsum(ak_raw[:R + 1][::-1])[::-1]\n\n            # b_k: eq. 32\n            if 'b_k' in self._fitness_args:\n                kwds['b_k'] = - np.cumsum(bk_raw[:R + 1][::-1])[::-1]\n\n            # c_k: eq. 33\n            if 'c_k' in self._fitness_args:\n                kwds['c_k'] = 0.5 * np.cumsum(ck_raw[:R + 1][::-1])[::-1]\n\n            # evaluate fitness function\n            fit_vec = self.fitness(**kwds)\n\n            A_R = fit_vec - ncp_prior\n            A_R[1:] += best[:R]\n\n            i_max = np.argmax(A_R)\n            last[R] = i_max\n            best[R] = A_R[i_max]\n\n        # ----------------------------------------------------------------\n        # Now find changepoints by iteratively peeling off the last block\n        # ----------------------------------------------------------------\n        change_points = np.zeros(N, dtype=int)\n        i_cp = N\n        ind = N\n        while i_cp > 0:\n            i_cp -= 1\n            change_points[i_cp] = ind\n            if ind == 0:\n                break\n            ind = last[ind - 1]\n        if i_cp == 0:\n            change_points[i_cp] = 0\n        change_points = change_points[i_cp:]\n\n        return edges[change_points]"},{"col":11,"endLoc":1581,"id":8721,"nodeType":"Lambda","startLoc":1581,"text":"lambda x: np.interp(x, b, c, 0, 1)"},{"col":0,"comment":"Compute the length of overlap of two intervals.\n\n    Parameters\n    ----------\n    i1, i2 : (float, float)\n        The two intervals, (interval 1, interval 2).\n\n    Returns\n    -------\n    l : float\n        The length of the overlap between the two intervals.\n\n    ","endLoc":1613,"header":"def interval_overlap_length(i1, i2)","id":8722,"name":"interval_overlap_length","nodeType":"Function","startLoc":1584,"text":"def interval_overlap_length(i1, i2):\n    \"\"\"Compute the length of overlap of two intervals.\n\n    Parameters\n    ----------\n    i1, i2 : (float, float)\n        The two intervals, (interval 1, interval 2).\n\n    Returns\n    -------\n    l : float\n        The length of the overlap between the two intervals.\n\n    \"\"\"\n    (a, b) = i1\n    (c, d) = i2\n    if a < c:\n        if b < c:\n            return 0.\n        elif b < d:\n            return b - c\n        else:\n            return d - c\n    elif a < d:\n        if b < d:\n            return b - a\n        else:\n            return d - a\n    else:\n        return 0"},{"col":0,"comment":"Histogram of a piecewise-constant weight function.\n\n    This function takes a piecewise-constant weight function and\n    computes the average weight in each histogram bin.\n\n    Parameters\n    ----------\n    n : int\n        The number of bins\n    breaks : (N,) array of float\n        Endpoints of the intervals in the PDF\n    totals : (N-1,) array of float\n        Probability densities in each bin\n\n    Returns\n    -------\n    h : array of float\n        The average weight for each bin\n\n    ","endLoc":1647,"header":"def histogram_intervals(n, breaks, totals)","id":8723,"name":"histogram_intervals","nodeType":"Function","startLoc":1616,"text":"def histogram_intervals(n, breaks, totals):\n    \"\"\"Histogram of a piecewise-constant weight function.\n\n    This function takes a piecewise-constant weight function and\n    computes the average weight in each histogram bin.\n\n    Parameters\n    ----------\n    n : int\n        The number of bins\n    breaks : (N,) array of float\n        Endpoints of the intervals in the PDF\n    totals : (N-1,) array of float\n        Probability densities in each bin\n\n    Returns\n    -------\n    h : array of float\n        The average weight for each bin\n\n    \"\"\"\n    h = np.zeros(n)\n    start = breaks[0]\n    for i in range(len(totals)):\n        end = breaks[i + 1]\n        for j in range(n):\n            ol = interval_overlap_length((float(j) / n,\n                                          float(j + 1) / n), (start, end))\n            h[j] += ol / (1. / n) * totals[i]\n        start = end\n\n    return h"},{"attributeType":"null","col":12,"comment":"null","endLoc":1265,"id":8724,"name":"_fast_parser","nodeType":"Attribute","startLoc":1265,"text":"cls._fast_parser"},{"attributeType":"null","col":8,"comment":"null","endLoc":1337,"id":8725,"name":"jd1","nodeType":"Attribute","startLoc":1337,"text":"self.jd1"},{"attributeType":"null","col":16,"comment":"null","endLoc":14,"id":8726,"name":"np","nodeType":"Attribute","startLoc":14,"text":"np"},{"attributeType":"null","col":24,"comment":"null","endLoc":16,"id":8727,"name":"u","nodeType":"Attribute","startLoc":16,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":8728,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":8729,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":26,"text":"__doctest_skip__"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":8730,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":27,"text":"__doctest_requires__"},{"attributeType":"null","col":0,"comment":"\nFactor with which to multiply Gaussian 1-sigma standard deviation to\nconvert it to full width at half maximum (FWHM).\n","endLoc":31,"id":8731,"name":"gaussian_sigma_to_fwhm","nodeType":"Attribute","startLoc":31,"text":"gaussian_sigma_to_fwhm"},{"attributeType":"null","col":8,"comment":"null","endLoc":120,"id":8732,"name":"_web_profile_dialog","nodeType":"Attribute","startLoc":120,"text":"self._web_profile_dialog"},{"attributeType":"null","col":0,"comment":"\nFactor with which to multiply Gaussian full width at half maximum (FWHM)\nto convert it to 1-sigma standard deviation.\n","endLoc":37,"id":8733,"name":"gaussian_fwhm_to_sigma","nodeType":"Attribute","startLoc":37,"text":"gaussian_fwhm_to_sigma"},{"col":0,"comment":"","endLoc":10,"header":"funcs.py#<anonymous>","id":8734,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module contains simple statistical algorithms that are\nstraightforwardly implemented as a single python function (or family of\nfunctions).\n\nThis module should generally not be used directly.  Everything in\n`__all__` is imported into `astropy.stats`, and hence that package\nshould be used for access.\n\"\"\"\n\n__all__ = ['gaussian_fwhm_to_sigma', 'gaussian_sigma_to_fwhm',\n           'binom_conf_interval', 'binned_binom_proportion',\n           'poisson_conf_interval', 'median_absolute_deviation', 'mad_std',\n           'signal_to_noise_oir_ccd', 'bootstrap', 'kuiper', 'kuiper_two',\n           'kuiper_false_positive_probability', 'cdf_from_intervals',\n           'interval_overlap_length', 'histogram_intervals', 'fold_intervals']\n\n__doctest_skip__ = ['binned_binom_proportion']\n\n__doctest_requires__ = {'binom_conf_interval': ['scipy'],\n                        'poisson_conf_interval': ['scipy']}\n\ngaussian_sigma_to_fwhm = 2.0 * math.sqrt(2.0 * math.log(2.0))\n\n\"\"\"\nFactor with which to multiply Gaussian 1-sigma standard deviation to\nconvert it to full width at half maximum (FWHM).\n\"\"\"\n\ngaussian_fwhm_to_sigma = 1. / gaussian_sigma_to_fwhm\n\n\"\"\"\nFactor with which to multiply Gaussian full width at half maximum (FWHM)\nto convert it to 1-sigma standard deviation.\n\"\"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":1338,"id":8735,"name":"jd2","nodeType":"Attribute","startLoc":1338,"text":"self.jd2"},{"fileName":"__init__.py","filePath":"astropy/stats","id":8736,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis subpackage contains statistical tools provided for or used by Astropy.\n\nWhile the `scipy.stats` package contains a wide range of statistical\ntools, it is a general-purpose package, and is missing some that are\nparticularly useful to astronomy or are used in an atypical way in\nastronomy. This package is intended to provide such functionality, but\n*not* to replace `scipy.stats` if its implementation satisfies\nastronomers' needs.\n\n\"\"\"\n\nfrom . import funcs\nfrom .funcs import *  # noqa\nfrom . import biweight\nfrom .biweight import *  # noqa\nfrom . import sigma_clipping\nfrom .sigma_clipping import *  # noqa\nfrom . import jackknife\nfrom .jackknife import *  # noqa\nfrom . import circstats\nfrom .circstats import *  # noqa\nfrom . import bayesian_blocks as _bb\nfrom .bayesian_blocks import *  # noqa\nfrom . import histogram as _hist\nfrom .histogram import *  # noqa\nfrom . import info_theory\nfrom .info_theory import *  # noqa\nfrom . import spatial\nfrom .spatial import *  # noqa\nfrom .lombscargle import *  # noqa\nfrom .bls import *  # noqa\n\n# This is to avoid importing deprecated modules in subpackage star import\n__all__ = []\n__all__.extend(funcs.__all__)\n__all__.extend(biweight.__all__)\n__all__.extend(sigma_clipping.__all__)\n__all__.extend(jackknife.__all__)\n__all__.extend(circstats.__all__)\n__all__.extend(_bb.__all__)\n__all__.extend(_hist.__all__)\n__all__.extend(info_theory.__all__)\n__all__.extend(spatial.__all__)\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":212,"id":8737,"name":"p0","nodeType":"Attribute","startLoc":212,"text":"self.p0"},{"attributeType":"null","col":8,"comment":"null","endLoc":214,"id":8738,"name":"ncp_prior","nodeType":"Attribute","startLoc":214,"text":"self.ncp_prior"},{"attributeType":"null","col":8,"comment":"null","endLoc":107,"id":8739,"name":"_is_running","nodeType":"Attribute","startLoc":107,"text":"self._is_running"},{"attributeType":"None","col":8,"comment":"null","endLoc":126,"id":8740,"name":"_web_profile_requests_result","nodeType":"Attribute","startLoc":126,"text":"self._web_profile_requests_result"},{"attributeType":"None","col":8,"comment":"null","endLoc":127,"id":8741,"name":"_web_profile_requests_semaphore","nodeType":"Attribute","startLoc":127,"text":"self._web_profile_requests_semaphore"},{"attributeType":"None","col":8,"comment":"null","endLoc":140,"id":8742,"name":"_thread_run","nodeType":"Attribute","startLoc":140,"text":"self._thread_run"},{"attributeType":"null","col":8,"comment":"null","endLoc":151,"id":8743,"name":"_hub_msg_id_counter","nodeType":"Attribute","startLoc":151,"text":"self._hub_msg_id_counter"},{"className":"TimeISO","col":0,"comment":"\n    ISO 8601 compliant date-time format \"YYYY-MM-DD HH:MM:SS.sss...\".\n    For example, 2000-01-01 00:00:00.000 is midnight on January 1, 2000.\n\n    The allowed subformats are:\n\n    - 'date_hms': date + hours, mins, secs (and optional fractional secs)\n    - 'date_hm': date + hours, mins\n    - 'date': date\n    ","endLoc":1499,"id":8744,"nodeType":"Class","startLoc":1451,"text":"class TimeISO(TimeString):\n    \"\"\"\n    ISO 8601 compliant date-time format \"YYYY-MM-DD HH:MM:SS.sss...\".\n    For example, 2000-01-01 00:00:00.000 is midnight on January 1, 2000.\n\n    The allowed subformats are:\n\n    - 'date_hms': date + hours, mins, secs (and optional fractional secs)\n    - 'date_hm': date + hours, mins\n    - 'date': date\n    \"\"\"\n\n    name = 'iso'\n    subfmts = (('date_hms',\n                '%Y-%m-%d %H:%M:%S',\n                # XXX To Do - use strftime for output ??\n                '{year:d}-{mon:02d}-{day:02d} {hour:02d}:{min:02d}:{sec:02d}'),\n               ('date_hm',\n                '%Y-%m-%d %H:%M',\n                '{year:d}-{mon:02d}-{day:02d} {hour:02d}:{min:02d}'),\n               ('date',\n                '%Y-%m-%d',\n                '{year:d}-{mon:02d}-{day:02d}'))\n\n    # Define positions and starting delimiter for year, month, day, hour,\n    # minute, seconds components of an ISO time. This is used by the fast\n    # C-parser parse_ymdhms_times()\n    #\n    #  \"2000-01-12 13:14:15.678\"\n    #   01234567890123456789012\n    #   yyyy-mm-dd hh:mm:ss.fff\n    # Parsed as ('yyyy', '-mm', '-dd', ' hh', ':mm', ':ss', '.fff')\n    fast_parser_pars = dict(\n        delims=(0, ord('-'), ord('-'), ord(' '), ord(':'), ord(':'), ord('.')),\n        starts=(0, 4, 7, 10, 13, 16, 19),\n        stops=(3, 6, 9, 12, 15, 18, -1),\n        # Break allowed *before*\n        #              y  m  d  h  m  s  f\n        break_allowed=(0, 0, 0, 1, 0, 1, 1),\n        has_day_of_year=0)\n\n    def parse_string(self, timestr, subfmts):\n        # Handle trailing 'Z' for UTC time\n        if timestr.endswith('Z'):\n            if self.scale != 'utc':\n                raise ValueError(\"Time input terminating in 'Z' must have \"\n                                 \"scale='UTC'\")\n            timestr = timestr[:-1]\n        return super().parse_string(timestr, subfmts)"},{"attributeType":"null","col":8,"comment":"null","endLoc":110,"id":8745,"name":"_addr","nodeType":"Attribute","startLoc":110,"text":"self._addr"},{"attributeType":"null","col":8,"comment":"null","endLoc":119,"id":8746,"name":"_web_profile","nodeType":"Attribute","startLoc":119,"text":"self._web_profile"},{"attributeType":"null","col":8,"comment":"null","endLoc":104,"id":8747,"name":"_id","nodeType":"Attribute","startLoc":104,"text":"self._id"},{"attributeType":"null","col":8,"comment":"null","endLoc":121,"id":8748,"name":"_web_port","nodeType":"Attribute","startLoc":121,"text":"self._web_port"},{"col":4,"comment":"null","endLoc":1499,"header":"def parse_string(self, timestr, subfmts)","id":8749,"name":"parse_string","nodeType":"Function","startLoc":1492,"text":"def parse_string(self, timestr, subfmts):\n        # Handle trailing 'Z' for UTC time\n        if timestr.endswith('Z'):\n            if self.scale != 'utc':\n                raise ValueError(\"Time input terminating in 'Z' must have \"\n                                 \"scale='UTC'\")\n            timestr = timestr[:-1]\n        return super().parse_string(timestr, subfmts)"},{"attributeType":"None","col":8,"comment":"null","endLoc":125,"id":8750,"name":"_web_profile_requests_queue","nodeType":"Attribute","startLoc":125,"text":"self._web_profile_requests_queue"},{"attributeType":"null","col":8,"comment":"null","endLoc":108,"id":8751,"name":"_customlockfilename","nodeType":"Attribute","startLoc":108,"text":"self._customlockfilename"},{"attributeType":"null","col":4,"comment":"null","endLoc":1463,"id":8752,"name":"name","nodeType":"Attribute","startLoc":1463,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1464,"id":8753,"name":"subfmts","nodeType":"Attribute","startLoc":1464,"text":"subfmts"},{"attributeType":"null","col":4,"comment":"null","endLoc":1483,"id":8754,"name":"fast_parser_pars","nodeType":"Attribute","startLoc":1483,"text":"fast_parser_pars"},{"attributeType":"None","col":8,"comment":"null","endLoc":109,"id":8755,"name":"_lockfile","nodeType":"Attribute","startLoc":109,"text":"self._lockfile"},{"className":"TimeISOT","col":0,"comment":"\n    ISO 8601 compliant date-time format \"YYYY-MM-DDTHH:MM:SS.sss...\".\n    This is the same as TimeISO except for a \"T\" instead of space between\n    the date and time.\n    For example, 2000-01-01T00:00:00.000 is midnight on January 1, 2000.\n\n    The allowed subformats are:\n\n    - 'date_hms': date + hours, mins, secs (and optional fractional secs)\n    - 'date_hm': date + hours, mins\n    - 'date': date\n    ","endLoc":1535,"id":8756,"nodeType":"Class","startLoc":1502,"text":"class TimeISOT(TimeISO):\n    \"\"\"\n    ISO 8601 compliant date-time format \"YYYY-MM-DDTHH:MM:SS.sss...\".\n    This is the same as TimeISO except for a \"T\" instead of space between\n    the date and time.\n    For example, 2000-01-01T00:00:00.000 is midnight on January 1, 2000.\n\n    The allowed subformats are:\n\n    - 'date_hms': date + hours, mins, secs (and optional fractional secs)\n    - 'date_hm': date + hours, mins\n    - 'date': date\n    \"\"\"\n\n    name = 'isot'\n    subfmts = (('date_hms',\n                '%Y-%m-%dT%H:%M:%S',\n                '{year:d}-{mon:02d}-{day:02d}T{hour:02d}:{min:02d}:{sec:02d}'),\n               ('date_hm',\n                '%Y-%m-%dT%H:%M',\n                '{year:d}-{mon:02d}-{day:02d}T{hour:02d}:{min:02d}'),\n               ('date',\n                '%Y-%m-%d',\n                '{year:d}-{mon:02d}-{day:02d}'))\n\n    # See TimeISO for explanation\n    fast_parser_pars = dict(\n        delims=(0, ord('-'), ord('-'), ord('T'), ord(':'), ord(':'), ord('.')),\n        starts=(0, 4, 7, 10, 13, 16, 19),\n        stops=(3, 6, 9, 12, 15, 18, -1),\n        # Break allowed *before*\n        #              y  m  d  h  m  s  f\n        break_allowed=(0, 0, 0, 1, 0, 1, 1),\n        has_day_of_year=0)"},{"attributeType":"null","col":16,"comment":"null","endLoc":136,"id":8757,"name":"_host_name","nodeType":"Attribute","startLoc":136,"text":"self._host_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":174,"id":8758,"name":"_id2mtypes","nodeType":"Attribute","startLoc":174,"text":"self._id2mtypes"},{"attributeType":"null","col":4,"comment":"null","endLoc":1516,"id":8759,"name":"name","nodeType":"Attribute","startLoc":1516,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1517,"id":8760,"name":"subfmts","nodeType":"Attribute","startLoc":1517,"text":"subfmts"},{"attributeType":"null","col":4,"comment":"null","endLoc":1528,"id":8761,"name":"fast_parser_pars","nodeType":"Attribute","startLoc":1528,"text":"fast_parser_pars"},{"attributeType":"null","col":24,"comment":"null","endLoc":13,"id":8762,"name":"xmlrpc","nodeType":"Attribute","startLoc":13,"text":"xmlrpc"},{"className":"TimeYearDayTime","col":0,"comment":"\n    Year, day-of-year and time as \"YYYY:DOY:HH:MM:SS.sss...\".\n    The day-of-year (DOY) goes from 001 to 365 (366 in leap years).\n    For example, 2000:001:00:00:00.000 is midnight on January 1, 2000.\n\n    The allowed subformats are:\n\n    - 'date_hms': date + hours, mins, secs (and optional fractional secs)\n    - 'date_hm': date + hours, mins\n    - 'date': date\n    ","endLoc":1582,"id":8763,"nodeType":"Class","startLoc":1538,"text":"class TimeYearDayTime(TimeISO):\n    \"\"\"\n    Year, day-of-year and time as \"YYYY:DOY:HH:MM:SS.sss...\".\n    The day-of-year (DOY) goes from 001 to 365 (366 in leap years).\n    For example, 2000:001:00:00:00.000 is midnight on January 1, 2000.\n\n    The allowed subformats are:\n\n    - 'date_hms': date + hours, mins, secs (and optional fractional secs)\n    - 'date_hm': date + hours, mins\n    - 'date': date\n    \"\"\"\n\n    name = 'yday'\n    subfmts = (('date_hms',\n                '%Y:%j:%H:%M:%S',\n                '{year:d}:{yday:03d}:{hour:02d}:{min:02d}:{sec:02d}'),\n               ('date_hm',\n                '%Y:%j:%H:%M',\n                '{year:d}:{yday:03d}:{hour:02d}:{min:02d}'),\n               ('date',\n                '%Y:%j',\n                '{year:d}:{yday:03d}'))\n\n    # Define positions and starting delimiter for year, month, day, hour,\n    # minute, seconds components of an ISO time. This is used by the fast\n    # C-parser parse_ymdhms_times()\n    #\n    #  \"2000:123:13:14:15.678\"\n    #   012345678901234567890\n    #   yyyy:ddd:hh:mm:ss.fff\n    # Parsed as ('yyyy', ':ddd', ':hh', ':mm', ':ss', '.fff')\n    #\n    # delims: character at corresponding `starts` position (0 => no character)\n    # starts: position where component starts (including delimiter if present)\n    # stops: position where component ends (-1 => continue to end of string)\n\n    fast_parser_pars = dict(\n        delims=(0, 0, ord(':'), ord(':'), ord(':'), ord(':'), ord('.')),\n        starts=(0, -1, 4, 8, 11, 14, 17),\n        stops=(3, -1, 7, 10, 13, 16, -1),\n        # Break allowed before:\n        #              y  m  d  h  m  s  f\n        break_allowed=(0, 0, 0, 1, 0, 1, 1),\n        has_day_of_year=1)"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":8764,"name":"__all__","nodeType":"Attribute","startLoc":28,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":8765,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":30,"text":"__doctest_skip__"},{"attributeType":"null","col":0,"comment":"null","endLoc":36,"id":8766,"name":"__all__","nodeType":"Attribute","startLoc":36,"text":"__all__"},{"col":0,"comment":"","endLoc":12,"header":"__init__.py#<anonymous>","id":8767,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis subpackage contains statistical tools provided for or used by Astropy.\n\nWhile the `scipy.stats` package contains a wide range of statistical\ntools, it is a general-purpose package, and is missing some that are\nparticularly useful to astronomy or are used in an atypical way in\nastronomy. This package is intended to provide such functionality, but\n*not* to replace `scipy.stats` if its implementation satisfies\nastronomers' needs.\n\n\"\"\"\n\n__all__ = []\n\n__all__.extend(funcs.__all__)\n\n__all__.extend(biweight.__all__)\n\n__all__.extend(sigma_clipping.__all__)\n\n__all__.extend(jackknife.__all__)\n\n__all__.extend(circstats.__all__)\n\n__all__.extend(_bb.__all__)\n\n__all__.extend(_hist.__all__)\n\n__all__.extend(info_theory.__all__)\n\n__all__.extend(spatial.__all__)"},{"col":0,"comment":"","endLoc":4,"header":"hub.py#<anonymous>","id":8768,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['SAMPHubServer', 'WebProfileDialog']\n\n__doctest_skip__ = ['.', 'SAMPHubServer.*']"},{"attributeType":"null","col":4,"comment":"null","endLoc":1551,"id":8769,"name":"name","nodeType":"Attribute","startLoc":1551,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1552,"id":8770,"name":"subfmts","nodeType":"Attribute","startLoc":1552,"text":"subfmts"},{"attributeType":"null","col":4,"comment":"null","endLoc":1575,"id":8771,"name":"fast_parser_pars","nodeType":"Attribute","startLoc":1575,"text":"fast_parser_pars"},{"id":8772,"name":"_stats.pyx","nodeType":"TextFile","path":"astropy/stats","text":"#cython: language_level=3\nfrom libc cimport math\ncimport cython\ncimport numpy as np\n\n\nctypedef fused dtype:\n    np.uint8_t\n    np.uint16_t\n    np.uint32_t\n    np.uint64_t\n    np.int8_t\n    np.int16_t\n    np.int32_t\n    np.int64_t\n    np.float32_t\n    np.float64_t\n    np.longdouble_t\n\n\n@cython.boundscheck(False)\n@cython.nonecheck(False)\n@cython.wraparound(False)\n@cython.cdivision(True)\ncpdef double ks_2samp(dtype[:] data1, dtype[:] data2):\n    cdef:\n        size_t i = 0, j = 0, n1 = data1.shape[0], n2 = data2.shape[0]\n        dtype d1i, d2j\n        double d = 0, mind = 0, maxd = 0, inv_n1 = 1. / n1, inv_n2 = 1. / n2\n    while i < n1 and j < n2:\n        d1i = data1[i]\n        d2j = data2[j]\n        if d1i <= d2j:\n            while i < n1 and data1[i] == d1i:\n                d += inv_n1\n                i += 1\n        if d1i >= d2j:\n            while j < n2 and data2[j] == d2j:\n                d -= inv_n2\n                j += 1\n        mind = min(mind, d)\n        maxd = max(maxd, d)\n    return maxd - mind\n"},{"className":"TimeDatetime64","col":0,"comment":"null","endLoc":1630,"id":8773,"nodeType":"Class","startLoc":1585,"text":"class TimeDatetime64(TimeISOT):\n    name = 'datetime64'\n\n    def _check_val_type(self, val1, val2):\n        if not val1.dtype.kind == 'M':\n            if val1.size > 0:\n                raise TypeError('Input values for {} class must be '\n                                'datetime64 objects'.format(self.name))\n            else:\n                val1 = np.array([], 'datetime64[D]')\n        if val2 is not None:\n            raise ValueError(\n                f'{self.name} objects do not accept a val2 but you provided {val2}')\n\n        return val1, None\n\n    def set_jds(self, val1, val2):\n        # If there are any masked values in the ``val1`` datetime64 array\n        # ('NaT') then stub them with a valid date so downstream parse_string\n        # will work.  The value under the mask is arbitrary but a \"modern\" date\n        # is good.\n        mask = np.isnat(val1)\n        masked = np.any(mask)\n        if masked:\n            val1 = val1.copy()\n            val1[mask] = '2000'\n\n        # Make sure M(onth) and Y(ear) dates will parse and convert to bytestring\n        if val1.dtype.name in ['datetime64[M]', 'datetime64[Y]']:\n            val1 = val1.astype('datetime64[D]')\n        val1 = val1.astype('S')\n\n        # Standard ISO string parsing now\n        super().set_jds(val1, val2)\n\n        # Finally apply mask if necessary\n        if masked:\n            self.jd2[mask] = np.nan\n\n    @property\n    def value(self):\n        precision = self.precision\n        self.precision = 9\n        ret = super().value\n        self.precision = precision\n        return ret.astype('datetime64')"},{"fileName":"circstats.py","filePath":"astropy/stats","id":8774,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module contains simple functions for dealing with circular statistics, for\ninstance, mean, variance, standard deviation, correlation coefficient, and so\non. This module also cover tests of uniformity, e.g., the Rayleigh and V tests.\nThe Maximum Likelihood Estimator for the Von Mises distribution along with the\nCramer-Rao Lower Bounds are also implemented. Almost all of the implementations\nare based on reference [1]_, which is also the basis for the R package\n'CircStats' [2]_.\n\"\"\"\n\nimport numpy as np\nfrom astropy.units import Quantity\n\n__all__ = ['circmean', 'circstd', 'circvar', 'circmoment', 'circcorrcoef',\n           'rayleightest', 'vtest', 'vonmisesmle']\n__doctest_requires__ = {'vtest': ['scipy']}\n\n\ndef _components(data, p=1, phi=0.0, axis=None, weights=None):\n    # Utility function for computing the generalized rectangular components\n    # of the circular data.\n    if weights is None:\n        weights = np.ones((1,))\n    try:\n        weights = np.broadcast_to(weights, data.shape)\n    except ValueError:\n        raise ValueError('Weights and data have inconsistent shape.')\n\n    C = np.sum(weights * np.cos(p * (data - phi)), axis)/np.sum(weights, axis)\n    S = np.sum(weights * np.sin(p * (data - phi)), axis)/np.sum(weights, axis)\n\n    return C, S\n\n\ndef _angle(data, p=1, phi=0.0, axis=None, weights=None):\n    # Utility function for computing the generalized sample mean angle\n    C, S = _components(data, p, phi, axis, weights)\n\n    # theta will be an angle in the interval [-np.pi, np.pi)\n    # [-180, 180)*u.deg in case data is a Quantity\n    theta = np.arctan2(S, C)\n\n    if isinstance(data, Quantity):\n        theta = theta.to(data.unit)\n\n    return theta\n\n\ndef _length(data, p=1, phi=0.0, axis=None, weights=None):\n    # Utility function for computing the generalized sample length\n    C, S = _components(data, p, phi, axis, weights)\n    return np.hypot(S, C)\n\n\ndef circmean(data, axis=None, weights=None):\n    \"\"\" Computes the circular mean angle of an array of circular data.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    axis : int, optional\n        Axis along which circular means are computed. The default is to compute\n        the mean of the flattened array.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``sum(weights, axis)``\n        equals the number of observations. See [1]_, remark 1.4, page 22, for\n        detailed explanation.\n\n    Returns\n    -------\n    circmean : ndarray or `~astropy.units.Quantity`\n        Circular mean.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import circmean\n    >>> from astropy import units as u\n    >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg\n    >>> circmean(data) # doctest: +FLOAT_CMP\n    <Quantity 48.62718088722989 deg>\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    \"\"\"\n    return _angle(data, 1, 0.0, axis, weights)\n\n\ndef circvar(data, axis=None, weights=None):\n    \"\"\" Computes the circular variance of an array of circular data.\n\n    There are some concepts for defining measures of dispersion for circular\n    data. The variance implemented here is based on the definition given by\n    [1]_, which is also the same used by the R package 'CircStats' [2]_.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n        Dimensionless, if Quantity.\n    axis : int, optional\n        Axis along which circular variances are computed. The default is to\n        compute the variance of the flattened array.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``sum(weights, axis)``\n        equals the number of observations. See [1]_, remark 1.4, page 22,\n        for detailed explanation.\n\n    Returns\n    -------\n    circvar : ndarray or `~astropy.units.Quantity` ['dimensionless']\n        Circular variance.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import circvar\n    >>> from astropy import units as u\n    >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg\n    >>> circvar(data) # doctest: +FLOAT_CMP\n    <Quantity 0.16356352748437508>\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n\n    Notes\n    -----\n    The definition used here differs from the one in scipy.stats.circvar.\n    Precisely, Scipy circvar uses an approximation based on the limit of small\n    angles which approaches the linear variance.\n    \"\"\"\n\n    return 1.0 - _length(data, 1, 0.0, axis, weights)\n\n\ndef circstd(data, axis=None, weights=None, method='angular'):\n    \"\"\" Computes the circular standard deviation of an array of circular data.\n\n    The standard deviation implemented here is based on the definitions given\n    by [1]_, which is also the same used by the R package 'CirStat' [2]_.\n\n    Two methods are implemented: 'angular' and 'circular'. The former is\n    defined as sqrt(2 * (1 - R)) and it is bounded in [0, 2*Pi]. The\n    latter is defined as sqrt(-2 * ln(R)) and it is bounded in [0, inf].\n\n    Following 'CircStat' the default method used to obtain the standard\n    deviation is 'angular'.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n        If quantity, must be dimensionless.\n    axis : int, optional\n        Axis along which circular variances are computed. The default is to\n        compute the variance of the flattened array.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``sum(weights, axis)``\n        equals the number of observations. See [3]_, remark 1.4, page 22,\n        for detailed explanation.\n    method : str, optional\n        The method used to estimate the standard deviation:\n\n        - 'angular' : obtains the angular deviation\n\n        - 'circular' : obtains the circular deviation\n\n\n    Returns\n    -------\n    circstd : ndarray or `~astropy.units.Quantity` ['dimensionless']\n        Angular or circular standard deviation.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import circstd\n    >>> from astropy import units as u\n    >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg\n    >>> circstd(data) # doctest: +FLOAT_CMP\n    <Quantity 0.57195022>\n\n    Alternatively, using the 'circular' method:\n\n    >>> import numpy as np\n    >>> from astropy.stats import circstd\n    >>> from astropy import units as u\n    >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg\n    >>> circstd(data, method='circular') # doctest: +FLOAT_CMP\n    <Quantity 0.59766999>\n\n    References\n    ----------\n    .. [1] P. Berens. \"CircStat: A MATLAB Toolbox for Circular Statistics\".\n       Journal of Statistical Software, vol 31, issue 10, 2009.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    .. [3] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n\n    \"\"\"\n    if method not in ('angular', 'circular'):\n        raise ValueError(\"method should be either 'angular' or 'circular'\")\n\n    if method == 'angular':\n        return np.sqrt(2. * (1. - _length(data, 1, 0.0, axis, weights)))\n    else:\n        return np.sqrt(-2. * np.log(_length(data, 1, 0.0, axis, weights)))\n\n\ndef circmoment(data, p=1.0, centered=False, axis=None, weights=None):\n    \"\"\" Computes the ``p``-th trigonometric circular moment for an array\n    of circular data.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    p : float, optional\n        Order of the circular moment.\n    centered : bool, optional\n        If ``True``, central circular moments are computed. Default value is\n        ``False``.\n    axis : int, optional\n        Axis along which circular moments are computed. The default is to\n        compute the circular moment of the flattened array.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``sum(weights, axis)``\n        equals the number of observations. See [1]_, remark 1.4, page 22,\n        for detailed explanation.\n\n    Returns\n    -------\n    circmoment : ndarray or `~astropy.units.Quantity`\n        The first and second elements correspond to the direction and length of\n        the ``p``-th circular moment, respectively.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import circmoment\n    >>> from astropy import units as u\n    >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg\n    >>> circmoment(data, p=2) # doctest: +FLOAT_CMP\n    (<Quantity 90.99263082432564 deg>, <Quantity 0.48004283892950717>)\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    \"\"\"\n    if centered:\n        phi = circmean(data, axis, weights)\n    else:\n        phi = 0.0\n\n    return _angle(data, p, phi, axis, weights), _length(data, p, phi, axis,\n                                                        weights)\n\n\ndef circcorrcoef(alpha, beta, axis=None, weights_alpha=None,\n                 weights_beta=None):\n    \"\"\" Computes the circular correlation coefficient between two array of\n    circular data.\n\n    Parameters\n    ----------\n    alpha : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    beta : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    axis : int, optional\n        Axis along which circular correlation coefficients are computed.\n        The default is the compute the circular correlation coefficient of the\n        flattened array.\n    weights_alpha : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights_alpha``\n        represents a weighting factor for each group such that\n        ``sum(weights_alpha, axis)`` equals the number of observations.\n        See [1]_, remark 1.4, page 22, for detailed explanation.\n    weights_beta : numpy.ndarray, optional\n        See description of ``weights_alpha``.\n\n    Returns\n    -------\n    rho : ndarray or `~astropy.units.Quantity` ['dimensionless']\n        Circular correlation coefficient.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import circcorrcoef\n    >>> from astropy import units as u\n    >>> alpha = np.array([356, 97, 211, 232, 343, 292, 157, 302, 335, 302,\n    ...                   324, 85, 324, 340, 157, 238, 254, 146, 232, 122,\n    ...                   329])*u.deg\n    >>> beta = np.array([119, 162, 221, 259, 270, 29, 97, 292, 40, 313, 94,\n    ...                  45, 47, 108, 221, 270, 119, 248, 270, 45, 23])*u.deg\n    >>> circcorrcoef(alpha, beta) # doctest: +FLOAT_CMP\n    <Quantity 0.2704648826748831>\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    \"\"\"\n    if(np.size(alpha, axis) != np.size(beta, axis)):\n        raise ValueError(\"alpha and beta must be arrays of the same size\")\n\n    mu_a = circmean(alpha, axis, weights_alpha)\n    mu_b = circmean(beta, axis, weights_beta)\n\n    sin_a = np.sin(alpha - mu_a)\n    sin_b = np.sin(beta - mu_b)\n    rho = np.sum(sin_a*sin_b)/np.sqrt(np.sum(sin_a*sin_a)*np.sum(sin_b*sin_b))\n\n    return rho\n\n\ndef rayleightest(data, axis=None, weights=None):\n    \"\"\" Performs the Rayleigh test of uniformity.\n\n    This test is  used to identify a non-uniform distribution, i.e. it is\n    designed for detecting an unimodal deviation from uniformity. More\n    precisely, it assumes the following hypotheses:\n    - H0 (null hypothesis): The population is distributed uniformly around the\n    circle.\n    - H1 (alternative hypothesis): The population is not distributed uniformly\n    around the circle.\n    Small p-values suggest to reject the null hypothesis.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    axis : int, optional\n        Axis along which the Rayleigh test will be performed.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``np.sum(weights, axis)``\n        equals the number of observations.\n        See [1]_, remark 1.4, page 22, for detailed explanation.\n\n    Returns\n    -------\n    p-value : float or `~astropy.units.Quantity` ['dimensionless']\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import rayleightest\n    >>> from astropy import units as u\n    >>> data = np.array([130, 90, 0, 145])*u.deg\n    >>> rayleightest(data) # doctest: +FLOAT_CMP\n    <Quantity 0.2563487733797317>\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    .. [3] M. Chirstman., C. Miller. \"Testing a Sample of Directions for\n       Uniformity.\" Lecture Notes, STA 6934/5805. University of Florida, 2007.\n    .. [4] D. Wilkie. \"Rayleigh Test for Randomness of Circular Data\". Applied\n       Statistics. 1983.\n       <http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.211.4762>\n    \"\"\"\n    n = np.size(data, axis=axis)\n    Rbar = _length(data, 1, 0.0, axis, weights)\n    z = n*Rbar*Rbar\n\n    # see [3] and [4] for the formulae below\n    tmp = 1.0\n    if(n < 50):\n        tmp = 1.0 + (2.0*z - z*z)/(4.0*n) - (24.0*z - 132.0*z**2.0 +\n                                             76.0*z**3.0 - 9.0*z**4.0)/(288.0 *\n                                                                        n * n)\n\n    p_value = np.exp(-z)*tmp\n    return p_value\n\n\ndef vtest(data, mu=0.0, axis=None, weights=None):\n    \"\"\" Performs the Rayleigh test of uniformity where the alternative\n    hypothesis H1 is assumed to have a known mean angle ``mu``.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    mu : float or `~astropy.units.Quantity` ['angle'], optional\n        Mean angle. Assumed to be known.\n    axis : int, optional\n        Axis along which the V test will be performed.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``sum(weights, axis)``\n        equals the number of observations. See [1]_, remark 1.4, page 22,\n        for detailed explanation.\n\n    Returns\n    -------\n    p-value : float or `~astropy.units.Quantity` ['dimensionless']\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import vtest\n    >>> from astropy import units as u\n    >>> data = np.array([130, 90, 0, 145])*u.deg\n    >>> vtest(data) # doctest: +FLOAT_CMP\n    <Quantity 0.6223678199713766>\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    .. [3] M. Chirstman., C. Miller. \"Testing a Sample of Directions for\n       Uniformity.\" Lecture Notes, STA 6934/5805. University of Florida, 2007.\n    \"\"\"\n    from scipy.stats import norm\n\n    if weights is None:\n        weights = np.ones((1,))\n    try:\n        weights = np.broadcast_to(weights, data.shape)\n    except ValueError:\n        raise ValueError('Weights and data have inconsistent shape.')\n\n    n = np.size(data, axis=axis)\n    R0bar = np.sum(weights * np.cos(data - mu), axis)/np.sum(weights, axis)\n    z = np.sqrt(2.0 * n) * R0bar\n    pz = norm.cdf(z)\n    fz = norm.pdf(z)\n    # see reference [3]\n    p_value = 1 - pz + fz*((3*z - z**3)/(16.0*n) +\n                           (15*z + 305*z**3 - 125*z**5 + 9*z**7)/(4608.0*n*n))\n    return p_value\n\n\ndef _A1inv(x):\n    # Approximation for _A1inv(x) according R Package 'CircStats'\n    # See http://www.scienceasia.org/2012.38.n1/scias38_118.pdf, equation (4)\n    if 0 <= x < 0.53:\n        return 2.0*x + x*x*x + (5.0*x**5)/6.0\n    elif x < 0.85:\n        return -0.4 + 1.39*x + 0.43/(1.0 - x)\n    else:\n        return 1.0/(x*x*x - 4.0*x*x + 3.0*x)\n\n\ndef vonmisesmle(data, axis=None):\n    \"\"\" Computes the Maximum Likelihood Estimator (MLE) for the parameters of\n    the von Mises distribution.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    axis : int, optional\n        Axis along which the mle will be computed.\n\n    Returns\n    -------\n    mu : float or `~astropy.units.Quantity`\n        The mean (aka location parameter).\n    kappa : float or `~astropy.units.Quantity` ['dimensionless']\n        The concentration parameter.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import vonmisesmle\n    >>> from astropy import units as u\n    >>> data = np.array([130, 90, 0, 145])*u.deg\n    >>> vonmisesmle(data) # doctest: +FLOAT_CMP\n    (<Quantity 101.16894320013179 deg>, <Quantity 1.49358958737054>)\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    \"\"\"\n    mu = circmean(data, axis=None)\n\n    kappa = _A1inv(np.mean(np.cos(data - mu), axis))\n    return mu, kappa\n"},{"col":4,"comment":"null","endLoc":1599,"header":"def _check_val_type(self, val1, val2)","id":8775,"name":"_check_val_type","nodeType":"Function","startLoc":1588,"text":"def _check_val_type(self, val1, val2):\n        if not val1.dtype.kind == 'M':\n            if val1.size > 0:\n                raise TypeError('Input values for {} class must be '\n                                'datetime64 objects'.format(self.name))\n            else:\n                val1 = np.array([], 'datetime64[D]')\n        if val2 is not None:\n            raise ValueError(\n                f'{self.name} objects do not accept a val2 but you provided {val2}')\n\n        return val1, None"},{"attributeType":"null","col":8,"comment":"null","endLoc":213,"id":8776,"name":"gamma","nodeType":"Attribute","startLoc":213,"text":"self.gamma"},{"col":4,"comment":"null","endLoc":1622,"header":"def set_jds(self, val1, val2)","id":8777,"name":"set_jds","nodeType":"Function","startLoc":1601,"text":"def set_jds(self, val1, val2):\n        # If there are any masked values in the ``val1`` datetime64 array\n        # ('NaT') then stub them with a valid date so downstream parse_string\n        # will work.  The value under the mask is arbitrary but a \"modern\" date\n        # is good.\n        mask = np.isnat(val1)\n        masked = np.any(mask)\n        if masked:\n            val1 = val1.copy()\n            val1[mask] = '2000'\n\n        # Make sure M(onth) and Y(ear) dates will parse and convert to bytestring\n        if val1.dtype.name in ['datetime64[M]', 'datetime64[Y]']:\n            val1 = val1.astype('datetime64[D]')\n        val1 = val1.astype('S')\n\n        # Standard ISO string parsing now\n        super().set_jds(val1, val2)\n\n        # Finally apply mask if necessary\n        if masked:\n            self.jd2[mask] = np.nan"},{"fileName":"histogram.py","filePath":"astropy/stats","id":8778,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nMethods for selecting the bin width of histograms\n\nPorted from the astroML project: https://www.astroml.org/\n\"\"\"\n\nimport numpy as np\nfrom . import bayesian_blocks\n\n__all__ = ['histogram', 'scott_bin_width', 'freedman_bin_width',\n           'knuth_bin_width', 'calculate_bin_edges']\n\n\ndef calculate_bin_edges(a, bins=10, range=None, weights=None):\n    \"\"\"\n    Calculate histogram bin edges like ``numpy.histogram_bin_edges``.\n\n    Parameters\n    ----------\n\n    a : array-like\n        Input data. The bin edges are calculated over the flattened array.\n\n    bins : int, list, or str, optional\n        If ``bins`` is an int, it is the number of bins. If it is a list\n        it is taken to be the bin edges. If it is a string, it must be one\n        of  'blocks', 'knuth', 'scott' or 'freedman'. See\n        `~astropy.stats.histogram` for a description of each method.\n\n    range : tuple or None, optional\n        The minimum and maximum range for the histogram.  If not specified,\n        it will be (a.min(), a.max()). However, if bins is a list it is\n        returned unmodified regardless of the range argument.\n\n    weights : array-like, optional\n        An array the same shape as ``a``. If given, the histogram accumulates\n        the value of the weight corresponding to ``a`` instead of returning the\n        count of values. This argument does not affect determination of bin\n        edges, though they may be used in the future as new methods are added.\n    \"\"\"\n    # if range is specified, we need to truncate the data for\n    # the bin-finding routines\n    if range is not None:\n        a = a[(a >= range[0]) & (a <= range[1])]\n\n    # if bins is a string, first compute bin edges with the desired heuristic\n    if isinstance(bins, str):\n        a = np.asarray(a).ravel()\n\n        # TODO: if weights is specified, we need to modify things.\n        #       e.g. we could use point measures fitness for Bayesian blocks\n        if weights is not None:\n            raise NotImplementedError(\"weights are not yet supported \"\n                                      \"for the enhanced histogram\")\n\n        if bins == 'blocks':\n            bins = bayesian_blocks(a)\n        elif bins == 'knuth':\n            da, bins = knuth_bin_width(a, True)\n        elif bins == 'scott':\n            da, bins = scott_bin_width(a, True)\n        elif bins == 'freedman':\n            da, bins = freedman_bin_width(a, True)\n        else:\n            raise ValueError(f\"unrecognized bin code: '{bins}'\")\n\n        if range:\n            # Check that the upper and lower edges are what was requested.\n            # The current implementation of the bin width estimators does not\n            # guarantee this, it only ensures that data outside the range is\n            # excluded from calculation of the bin widths.\n            if bins[0] != range[0]:\n                bins[0] = range[0]\n            if bins[-1] != range[1]:\n                bins[-1] = range[1]\n\n    elif np.ndim(bins) == 0:\n        # Number of bins was given\n        bins = np.histogram_bin_edges(a, bins, range=range, weights=weights)\n\n    return bins\n\n\ndef histogram(a, bins=10, range=None, weights=None, **kwargs):\n    \"\"\"Enhanced histogram function, providing adaptive binnings\n\n    This is a histogram function that enables the use of more sophisticated\n    algorithms for determining bins.  Aside from the ``bins`` argument allowing\n    a string specified how bins are computed, the parameters are the same\n    as ``numpy.histogram()``.\n\n    Parameters\n    ----------\n    a : array-like\n        array of data to be histogrammed\n\n    bins : int, list, or str, optional\n        If bins is a string, then it must be one of:\n\n        - 'blocks' : use bayesian blocks for dynamic bin widths\n\n        - 'knuth' : use Knuth's rule to determine bins\n\n        - 'scott' : use Scott's rule to determine bins\n\n        - 'freedman' : use the Freedman-Diaconis rule to determine bins\n\n    range : tuple or None, optional\n        the minimum and maximum range for the histogram.  If not specified,\n        it will be (x.min(), x.max())\n\n    weights : array-like, optional\n        An array the same shape as ``a``. If given, the histogram accumulates\n        the value of the weight corresponding to ``a`` instead of returning the\n        count of values. This argument does not affect determination of bin\n        edges.\n\n    other keyword arguments are described in numpy.histogram().\n\n    Returns\n    -------\n    hist : array\n        The values of the histogram. See ``density`` and ``weights`` for a\n        description of the possible semantics.\n    bin_edges : array of dtype float\n        Return the bin edges ``(length(hist)+1)``.\n\n    See Also\n    --------\n    numpy.histogram\n    \"\"\"\n\n    bins = calculate_bin_edges(a, bins=bins, range=range, weights=weights)\n    # Now we call numpy's histogram with the resulting bin edges\n    return np.histogram(a, bins=bins, range=range, weights=weights, **kwargs)\n\n\ndef scott_bin_width(data, return_bins=False):\n    r\"\"\"Return the optimal histogram bin width using Scott's rule\n\n    Scott's rule is a normal reference rule: it minimizes the integrated\n    mean squared error in the bin approximation under the assumption that the\n    data is approximately Gaussian.\n\n    Parameters\n    ----------\n    data : array-like, ndim=1\n        observed (one-dimensional) data\n    return_bins : bool, optional\n        if True, then return the bin edges\n\n    Returns\n    -------\n    width : float\n        optimal bin width using Scott's rule\n    bins : ndarray\n        bin edges: returned if ``return_bins`` is True\n\n    Notes\n    -----\n    The optimal bin width is\n\n    .. math::\n        \\Delta_b = \\frac{3.5\\sigma}{n^{1/3}}\n\n    where :math:`\\sigma` is the standard deviation of the data, and\n    :math:`n` is the number of data points [1]_.\n\n    References\n    ----------\n    .. [1] Scott, David W. (1979). \"On optimal and data-based histograms\".\n       Biometricka 66 (3): 605-610\n\n    See Also\n    --------\n    knuth_bin_width\n    freedman_bin_width\n    bayesian_blocks\n    histogram\n    \"\"\"\n    data = np.asarray(data)\n    if data.ndim != 1:\n        raise ValueError(\"data should be one-dimensional\")\n\n    n = data.size\n    sigma = np.std(data)\n\n    dx = 3.5 * sigma / (n ** (1 / 3))\n\n    if return_bins:\n        Nbins = np.ceil((data.max() - data.min()) / dx)\n        Nbins = max(1, Nbins)\n        bins = data.min() + dx * np.arange(Nbins + 1)\n        return dx, bins\n    else:\n        return dx\n\n\ndef freedman_bin_width(data, return_bins=False):\n    r\"\"\"Return the optimal histogram bin width using the Freedman-Diaconis rule\n\n    The Freedman-Diaconis rule is a normal reference rule like Scott's\n    rule, but uses rank-based statistics for results which are more robust\n    to deviations from a normal distribution.\n\n    Parameters\n    ----------\n    data : array-like, ndim=1\n        observed (one-dimensional) data\n    return_bins : bool, optional\n        if True, then return the bin edges\n\n    Returns\n    -------\n    width : float\n        optimal bin width using the Freedman-Diaconis rule\n    bins : ndarray\n        bin edges: returned if ``return_bins`` is True\n\n    Notes\n    -----\n    The optimal bin width is\n\n    .. math::\n        \\Delta_b = \\frac{2(q_{75} - q_{25})}{n^{1/3}}\n\n    where :math:`q_{N}` is the :math:`N` percent quartile of the data, and\n    :math:`n` is the number of data points [1]_.\n\n    References\n    ----------\n    .. [1] D. Freedman & P. Diaconis (1981)\n       \"On the histogram as a density estimator: L2 theory\".\n       Probability Theory and Related Fields 57 (4): 453-476\n\n    See Also\n    --------\n    knuth_bin_width\n    scott_bin_width\n    bayesian_blocks\n    histogram\n    \"\"\"\n    data = np.asarray(data)\n    if data.ndim != 1:\n        raise ValueError(\"data should be one-dimensional\")\n\n    n = data.size\n    if n < 4:\n        raise ValueError(\"data should have more than three entries\")\n\n    v25, v75 = np.percentile(data, [25, 75])\n    dx = 2 * (v75 - v25) / (n ** (1 / 3))\n\n    if return_bins:\n        dmin, dmax = data.min(), data.max()\n        Nbins = max(1, np.ceil((dmax - dmin) / dx))\n        try:\n            bins = dmin + dx * np.arange(Nbins + 1)\n        except ValueError as e:\n            if 'Maximum allowed size exceeded' in str(e):\n                raise ValueError(\n                    'The inter-quartile range of the data is too small: '\n                    'failed to construct histogram with {} bins. '\n                    'Please use another bin method, such as '\n                    'bins=\"scott\"'.format(Nbins + 1))\n            else:  # Something else  # pragma: no cover\n                raise\n        return dx, bins\n    else:\n        return dx\n\n\ndef knuth_bin_width(data, return_bins=False, quiet=True):\n    r\"\"\"Return the optimal histogram bin width using Knuth's rule.\n\n    Knuth's rule is a fixed-width, Bayesian approach to determining\n    the optimal bin width of a histogram.\n\n    Parameters\n    ----------\n    data : array-like, ndim=1\n        observed (one-dimensional) data\n    return_bins : bool, optional\n        if True, then return the bin edges\n    quiet : bool, optional\n        if True (default) then suppress stdout output from scipy.optimize\n\n    Returns\n    -------\n    dx : float\n        optimal bin width. Bins are measured starting at the first data point.\n    bins : ndarray\n        bin edges: returned if ``return_bins`` is True\n\n    Notes\n    -----\n    The optimal number of bins is the value M which maximizes the function\n\n    .. math::\n        F(M|x,I) = n\\log(M) + \\log\\Gamma(\\frac{M}{2})\n        - M\\log\\Gamma(\\frac{1}{2})\n        - \\log\\Gamma(\\frac{2n+M}{2})\n        + \\sum_{k=1}^M \\log\\Gamma(n_k + \\frac{1}{2})\n\n    where :math:`\\Gamma` is the Gamma function, :math:`n` is the number of\n    data points, :math:`n_k` is the number of measurements in bin :math:`k`\n    [1]_.\n\n    References\n    ----------\n    .. [1] Knuth, K.H. \"Optimal Data-Based Binning for Histograms\".\n       arXiv:0605197, 2006\n\n    See Also\n    --------\n    freedman_bin_width\n    scott_bin_width\n    bayesian_blocks\n    histogram\n    \"\"\"\n    # import here because of optional scipy dependency\n    from scipy import optimize\n\n    knuthF = _KnuthF(data)\n    dx0, bins0 = freedman_bin_width(data, True)\n    M = optimize.fmin(knuthF, len(bins0), disp=not quiet)[0]\n    bins = knuthF.bins(M)\n    dx = bins[1] - bins[0]\n\n    if return_bins:\n        return dx, bins\n    else:\n        return dx\n\n\nclass _KnuthF:\n    r\"\"\"Class which implements the function minimized by knuth_bin_width\n\n    Parameters\n    ----------\n    data : array-like, one dimension\n        data to be histogrammed\n\n    Notes\n    -----\n    the function F is given by\n\n    .. math::\n        F(M|x,I) = n\\log(M) + \\log\\Gamma(\\frac{M}{2})\n        - M\\log\\Gamma(\\frac{1}{2})\n        - \\log\\Gamma(\\frac{2n+M}{2})\n        + \\sum_{k=1}^M \\log\\Gamma(n_k + \\frac{1}{2})\n\n    where :math:`\\Gamma` is the Gamma function, :math:`n` is the number of\n    data points, :math:`n_k` is the number of measurements in bin :math:`k`.\n\n    See Also\n    --------\n    knuth_bin_width\n    \"\"\"\n    def __init__(self, data):\n        self.data = np.array(data, copy=True)\n        if self.data.ndim != 1:\n            raise ValueError(\"data should be 1-dimensional\")\n        self.data.sort()\n        self.n = self.data.size\n\n        # import here rather than globally: scipy is an optional dependency.\n        # Note that scipy is imported in the function which calls this,\n        # so there shouldn't be any issue importing here.\n        from scipy import special\n\n        # create a reference to gammaln to use in self.eval()\n        self.gammaln = special.gammaln\n\n    def bins(self, M):\n        \"\"\"Return the bin edges given M number of bins\"\"\"\n        return np.linspace(self.data[0], self.data[-1], int(M) + 1)\n\n    def __call__(self, M):\n        return self.eval(M)\n\n    def eval(self, M):\n        \"\"\"Evaluate the Knuth function\n\n        Parameters\n        ----------\n        M : int\n            Number of bins\n\n        Returns\n        -------\n        F : float\n            evaluation of the negative Knuth loglikelihood function:\n            smaller values indicate a better fit.\n        \"\"\"\n        M = int(M)\n\n        if M <= 0:\n            return np.inf\n\n        bins = self.bins(M)\n        nk, bins = np.histogram(self.data, bins)\n\n        return -(self.n * np.log(M) +\n                 self.gammaln(0.5 * M) -\n                 M * self.gammaln(0.5) -\n                 self.gammaln(self.n + 0.5 * M) +\n                 np.sum(self.gammaln(nk + 0.5)))\n"},{"col":4,"comment":"null","endLoc":280,"header":"@staticmethod\n    def _parse_cenfunc(cenfunc)","id":8779,"name":"_parse_cenfunc","nodeType":"Function","startLoc":262,"text":"@staticmethod\n    def _parse_cenfunc(cenfunc):\n        if isinstance(cenfunc, str):\n            if cenfunc == 'median':\n                if HAS_BOTTLENECK:\n                    cenfunc = _nanmedian\n                else:\n                    cenfunc = np.nanmedian  # pragma: no cover\n\n            elif cenfunc == 'mean':\n                if HAS_BOTTLENECK:\n                    cenfunc = _nanmean\n                else:\n                    cenfunc = np.nanmean  # pragma: no cover\n\n            else:\n                raise ValueError(f'{cenfunc} is an invalid cenfunc.')\n\n        return cenfunc"},{"col":0,"comment":"\n    Compute the biweight midcovariance between pairs of multiple\n    variables.\n\n    The biweight midcovariance is a robust and resistant estimator of\n    the covariance between two variables.\n\n    This function computes the biweight midcovariance between all pairs\n    of the input variables (rows) in the input data.  The output array\n    will have a shape of (N_variables, N_variables).  The diagonal\n    elements will be the biweight midvariances of each input variable\n    (see :func:`biweight_midvariance`).  The off-diagonal elements will\n    be the biweight midcovariances between each pair of input variables.\n\n    For example, if the input array ``data`` contains three variables\n    (rows) ``x``, ``y``, and ``z``, the output `~numpy.ndarray`\n    midcovariance matrix will be:\n\n    .. math::\n\n         \\begin{pmatrix}\n         \\zeta_{xx}  & \\zeta_{xy}  & \\zeta_{xz} \\\\\n         \\zeta_{yx}  & \\zeta_{yy}  & \\zeta_{yz} \\\\\n         \\zeta_{zx}  & \\zeta_{zy}  & \\zeta_{zz}\n         \\end{pmatrix}\n\n    where :math:`\\zeta_{xx}`, :math:`\\zeta_{yy}`, and :math:`\\zeta_{zz}`\n    are the biweight midvariances of each variable.  The biweight\n    midcovariance between :math:`x` and :math:`y` is :math:`\\zeta_{xy}`\n    (:math:`= \\zeta_{yx}`).  The biweight midcovariance between\n    :math:`x` and :math:`z` is :math:`\\zeta_{xz}` (:math:`=\n    \\zeta_{zx}`).  The biweight midcovariance between :math:`y` and\n    :math:`z` is :math:`\\zeta_{yz}` (:math:`= \\zeta_{zy}`).\n\n    The biweight midcovariance between two variables :math:`x` and\n    :math:`y` is given by:\n\n    .. math::\n\n        \\zeta_{xy} = n_{xy} \\ \\frac{\\sum_{|u_i| < 1, \\ |v_i| < 1} \\\n            (x_i - M_x) (1 - u_i^2)^2 (y_i - M_y) (1 - v_i^2)^2}\n            {(\\sum_{|u_i| < 1} \\ (1 - u_i^2) (1 - 5u_i^2))\n            (\\sum_{|v_i| < 1} \\ (1 - v_i^2) (1 - 5v_i^2))}\n\n    where :math:`M_x` and :math:`M_y` are the medians (or the input\n    locations) of the two variables and :math:`u_i` and :math:`v_i` are\n    given by:\n\n    .. math::\n\n        u_{i} = \\frac{(x_i - M_x)}{c * MAD_x}\n\n        v_{i} = \\frac{(y_i - M_y)}{c * MAD_y}\n\n    where :math:`c` is the biweight tuning constant and :math:`MAD_x`\n    and :math:`MAD_y` are the `median absolute deviation\n    <https://en.wikipedia.org/wiki/Median_absolute_deviation>`_ of the\n    :math:`x` and :math:`y` variables.  The biweight midvariance tuning\n    constant ``c`` is typically 9.0 (the default).\n\n    If :math:`MAD_x` or :math:`MAD_y` are zero, then zero will be\n    returned for that element.\n\n    For the standard definition of biweight midcovariance,\n    :math:`n_{xy}` is the total number of observations of each variable.\n    That definition is used if ``modify_sample_size`` is `False`, which\n    is the default.\n\n    However, if ``modify_sample_size = True``, then :math:`n_{xy}` is the\n    number of observations for which :math:`|u_i| < 1` and/or :math:`|v_i|\n    < 1`, i.e.\n\n    .. math::\n\n        n_{xx} = \\sum_{|u_i| < 1} \\ 1\n\n    .. math::\n\n        n_{xy} = n_{yx} = \\sum_{|u_i| < 1, \\ |v_i| < 1} \\ 1\n\n    .. math::\n\n        n_{yy} = \\sum_{|v_i| < 1} \\ 1\n\n    which results in a value closer to the true variance for small\n    sample sizes or for a large number of rejected values.\n\n    Parameters\n    ----------\n    data : 2D or 1D array-like\n        Input data either as a 2D or 1D array.  For a 2D array, it\n        should have a shape (N_variables, N_observations).  A 1D array\n        may be input for observations of a single variable, in which\n        case the biweight midvariance will be calculated (no\n        covariance).  Each row of ``data`` represents a variable, and\n        each column a single observation of all those variables (same as\n        the `numpy.cov` convention).\n\n    c : float, optional\n        Tuning constant for the biweight estimator (default = 9.0).\n\n    M : float or 1D array-like, optional\n        The location estimate of each variable, either as a scalar or\n        array.  If ``M`` is an array, then its must be a 1D array\n        containing the location estimate of each row (i.e. ``a.ndim``\n        elements).  If ``M`` is a scalar value, then its value will be\n        used for each variable (row).  If `None` (default), then the\n        median of each variable (row) will be used.\n\n    modify_sample_size : bool, optional\n        If `False` (default), then the sample size used is the total\n        number of observations of each variable, which follows the\n        standard definition of biweight midcovariance.  If `True`, then\n        the sample size is reduced to correct for any rejected values\n        (see formula above), which results in a value closer to the true\n        covariance for small sample sizes or for a large number of\n        rejected values.\n\n    Returns\n    -------\n    biweight_midcovariance : ndarray\n        A 2D array representing the biweight midcovariances between each\n        pair of the variables (rows) in the input array.  The output\n        array will have a shape of (N_variables, N_variables).  The\n        diagonal elements will be the biweight midvariances of each\n        input variable.  The off-diagonal elements will be the biweight\n        midcovariances between each pair of input variables.\n\n    See Also\n    --------\n    biweight_midvariance, biweight_midcorrelation, biweight_scale, biweight_location\n\n    References\n    ----------\n    .. [1] https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/biwmidc.htm\n\n    Examples\n    --------\n    Compute the biweight midcovariance between two random variables:\n\n    >>> import numpy as np\n    >>> from astropy.stats import biweight_midcovariance\n    >>> # Generate two random variables x and y\n    >>> rng = np.random.default_rng(1)\n    >>> x = rng.normal(0, 1, 200)\n    >>> y = rng.normal(0, 3, 200)\n    >>> # Introduce an obvious outlier\n    >>> x[0] = 30.0\n    >>> # Calculate the biweight midcovariances between x and y\n    >>> bicov = biweight_midcovariance([x, y])\n    >>> print(bicov)  # doctest: +FLOAT_CMP\n    [[0.83435568 0.02379316]\n     [0.02379316 7.15665769]]\n    >>> # Print standard deviation estimates\n    >>> print(np.sqrt(bicov.diagonal()))  # doctest: +FLOAT_CMP\n    [0.91343072 2.67519302]\n    ","endLoc":658,"header":"def biweight_midcovariance(data, c=9.0, M=None, modify_sample_size=False)","id":8780,"name":"biweight_midcovariance","nodeType":"Function","startLoc":449,"text":"def biweight_midcovariance(data, c=9.0, M=None, modify_sample_size=False):\n    r\"\"\"\n    Compute the biweight midcovariance between pairs of multiple\n    variables.\n\n    The biweight midcovariance is a robust and resistant estimator of\n    the covariance between two variables.\n\n    This function computes the biweight midcovariance between all pairs\n    of the input variables (rows) in the input data.  The output array\n    will have a shape of (N_variables, N_variables).  The diagonal\n    elements will be the biweight midvariances of each input variable\n    (see :func:`biweight_midvariance`).  The off-diagonal elements will\n    be the biweight midcovariances between each pair of input variables.\n\n    For example, if the input array ``data`` contains three variables\n    (rows) ``x``, ``y``, and ``z``, the output `~numpy.ndarray`\n    midcovariance matrix will be:\n\n    .. math::\n\n         \\begin{pmatrix}\n         \\zeta_{xx}  & \\zeta_{xy}  & \\zeta_{xz} \\\\\n         \\zeta_{yx}  & \\zeta_{yy}  & \\zeta_{yz} \\\\\n         \\zeta_{zx}  & \\zeta_{zy}  & \\zeta_{zz}\n         \\end{pmatrix}\n\n    where :math:`\\zeta_{xx}`, :math:`\\zeta_{yy}`, and :math:`\\zeta_{zz}`\n    are the biweight midvariances of each variable.  The biweight\n    midcovariance between :math:`x` and :math:`y` is :math:`\\zeta_{xy}`\n    (:math:`= \\zeta_{yx}`).  The biweight midcovariance between\n    :math:`x` and :math:`z` is :math:`\\zeta_{xz}` (:math:`=\n    \\zeta_{zx}`).  The biweight midcovariance between :math:`y` and\n    :math:`z` is :math:`\\zeta_{yz}` (:math:`= \\zeta_{zy}`).\n\n    The biweight midcovariance between two variables :math:`x` and\n    :math:`y` is given by:\n\n    .. math::\n\n        \\zeta_{xy} = n_{xy} \\ \\frac{\\sum_{|u_i| < 1, \\ |v_i| < 1} \\\n            (x_i - M_x) (1 - u_i^2)^2 (y_i - M_y) (1 - v_i^2)^2}\n            {(\\sum_{|u_i| < 1} \\ (1 - u_i^2) (1 - 5u_i^2))\n            (\\sum_{|v_i| < 1} \\ (1 - v_i^2) (1 - 5v_i^2))}\n\n    where :math:`M_x` and :math:`M_y` are the medians (or the input\n    locations) of the two variables and :math:`u_i` and :math:`v_i` are\n    given by:\n\n    .. math::\n\n        u_{i} = \\frac{(x_i - M_x)}{c * MAD_x}\n\n        v_{i} = \\frac{(y_i - M_y)}{c * MAD_y}\n\n    where :math:`c` is the biweight tuning constant and :math:`MAD_x`\n    and :math:`MAD_y` are the `median absolute deviation\n    <https://en.wikipedia.org/wiki/Median_absolute_deviation>`_ of the\n    :math:`x` and :math:`y` variables.  The biweight midvariance tuning\n    constant ``c`` is typically 9.0 (the default).\n\n    If :math:`MAD_x` or :math:`MAD_y` are zero, then zero will be\n    returned for that element.\n\n    For the standard definition of biweight midcovariance,\n    :math:`n_{xy}` is the total number of observations of each variable.\n    That definition is used if ``modify_sample_size`` is `False`, which\n    is the default.\n\n    However, if ``modify_sample_size = True``, then :math:`n_{xy}` is the\n    number of observations for which :math:`|u_i| < 1` and/or :math:`|v_i|\n    < 1`, i.e.\n\n    .. math::\n\n        n_{xx} = \\sum_{|u_i| < 1} \\ 1\n\n    .. math::\n\n        n_{xy} = n_{yx} = \\sum_{|u_i| < 1, \\ |v_i| < 1} \\ 1\n\n    .. math::\n\n        n_{yy} = \\sum_{|v_i| < 1} \\ 1\n\n    which results in a value closer to the true variance for small\n    sample sizes or for a large number of rejected values.\n\n    Parameters\n    ----------\n    data : 2D or 1D array-like\n        Input data either as a 2D or 1D array.  For a 2D array, it\n        should have a shape (N_variables, N_observations).  A 1D array\n        may be input for observations of a single variable, in which\n        case the biweight midvariance will be calculated (no\n        covariance).  Each row of ``data`` represents a variable, and\n        each column a single observation of all those variables (same as\n        the `numpy.cov` convention).\n\n    c : float, optional\n        Tuning constant for the biweight estimator (default = 9.0).\n\n    M : float or 1D array-like, optional\n        The location estimate of each variable, either as a scalar or\n        array.  If ``M`` is an array, then its must be a 1D array\n        containing the location estimate of each row (i.e. ``a.ndim``\n        elements).  If ``M`` is a scalar value, then its value will be\n        used for each variable (row).  If `None` (default), then the\n        median of each variable (row) will be used.\n\n    modify_sample_size : bool, optional\n        If `False` (default), then the sample size used is the total\n        number of observations of each variable, which follows the\n        standard definition of biweight midcovariance.  If `True`, then\n        the sample size is reduced to correct for any rejected values\n        (see formula above), which results in a value closer to the true\n        covariance for small sample sizes or for a large number of\n        rejected values.\n\n    Returns\n    -------\n    biweight_midcovariance : ndarray\n        A 2D array representing the biweight midcovariances between each\n        pair of the variables (rows) in the input array.  The output\n        array will have a shape of (N_variables, N_variables).  The\n        diagonal elements will be the biweight midvariances of each\n        input variable.  The off-diagonal elements will be the biweight\n        midcovariances between each pair of input variables.\n\n    See Also\n    --------\n    biweight_midvariance, biweight_midcorrelation, biweight_scale, biweight_location\n\n    References\n    ----------\n    .. [1] https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/biwmidc.htm\n\n    Examples\n    --------\n    Compute the biweight midcovariance between two random variables:\n\n    >>> import numpy as np\n    >>> from astropy.stats import biweight_midcovariance\n    >>> # Generate two random variables x and y\n    >>> rng = np.random.default_rng(1)\n    >>> x = rng.normal(0, 1, 200)\n    >>> y = rng.normal(0, 3, 200)\n    >>> # Introduce an obvious outlier\n    >>> x[0] = 30.0\n    >>> # Calculate the biweight midcovariances between x and y\n    >>> bicov = biweight_midcovariance([x, y])\n    >>> print(bicov)  # doctest: +FLOAT_CMP\n    [[0.83435568 0.02379316]\n     [0.02379316 7.15665769]]\n    >>> # Print standard deviation estimates\n    >>> print(np.sqrt(bicov.diagonal()))  # doctest: +FLOAT_CMP\n    [0.91343072 2.67519302]\n    \"\"\"\n\n    data = np.asanyarray(data).astype(np.float64)\n\n    # ensure data is 2D\n    if data.ndim == 1:\n        data = data[np.newaxis, :]\n    if data.ndim != 2:\n        raise ValueError('The input array must be 2D or 1D.')\n\n    # estimate location if not given\n    if M is None:\n        M = np.median(data, axis=1)\n    M = np.asanyarray(M)\n    if M.ndim > 1:\n        raise ValueError('M must be a scalar or 1D array.')\n\n    # set up the differences\n    d = (data.T - M).T\n\n    # set up the weighting\n    mad = median_absolute_deviation(data, axis=1)\n\n    with np.errstate(divide='ignore', invalid='ignore'):\n        u = (d.T / (c * mad)).T\n\n    # now remove the outlier points\n    # ignore RuntimeWarnings for comparisons with NaN data values\n    with np.errstate(invalid='ignore'):\n        mask = np.abs(u) < 1\n    u = u ** 2\n\n    if modify_sample_size:\n        maskf = mask.astype(float)\n        n = np.inner(maskf, maskf)\n    else:\n        n = data[0].size\n\n    usub1 = (1. - u)\n    usub5 = (1. - 5. * u)\n    usub1[~mask] = 0.\n\n    with np.errstate(divide='ignore', invalid='ignore'):\n        numerator = d * usub1 ** 2\n        denominator = (usub1 * usub5).sum(axis=1)[:, np.newaxis]\n        numerator_matrix = np.dot(numerator, numerator.T)\n        denominator_matrix = np.dot(denominator, denominator.T)\n\n        value = n * (numerator_matrix / denominator_matrix)\n        idx = np.where(mad == 0)[0]\n        value[idx, :] = 0\n        value[:, idx] = 0\n        return value"},{"className":"Events","col":0,"comment":"Bayesian blocks fitness for binned or unbinned events\n\n    Parameters\n    ----------\n    p0 : float, optional\n        False alarm probability, used to compute the prior on\n        :math:`N_{\\rm blocks}` (see eq. 21 of Scargle 2013). For the Events\n        type data, ``p0`` does not seem to be an accurate representation of the\n        actual false alarm probability. If you are using this fitness function\n        for a triggering type condition, it is recommended that you run\n        statistical trials on signal-free noise to determine an appropriate\n        value of ``gamma`` or ``ncp_prior`` to use for a desired false alarm\n        rate.\n    gamma : float, optional\n        If specified, then use this gamma to compute the general prior form,\n        :math:`p \\sim {\\tt gamma}^{N_{\\rm blocks}}`.  If gamma is specified, p0\n        is ignored.\n    ncp_prior : float, optional\n        If specified, use the value of ``ncp_prior`` to compute the prior as\n        above, using the definition :math:`{\\tt ncp\\_prior} = -\\ln({\\tt\n        gamma})`.\n        If ``ncp_prior`` is specified, ``gamma`` and ``p0`` is ignored.\n    ","endLoc":449,"id":8781,"nodeType":"Class","startLoc":416,"text":"class Events(FitnessFunc):\n    r\"\"\"Bayesian blocks fitness for binned or unbinned events\n\n    Parameters\n    ----------\n    p0 : float, optional\n        False alarm probability, used to compute the prior on\n        :math:`N_{\\rm blocks}` (see eq. 21 of Scargle 2013). For the Events\n        type data, ``p0`` does not seem to be an accurate representation of the\n        actual false alarm probability. If you are using this fitness function\n        for a triggering type condition, it is recommended that you run\n        statistical trials on signal-free noise to determine an appropriate\n        value of ``gamma`` or ``ncp_prior`` to use for a desired false alarm\n        rate.\n    gamma : float, optional\n        If specified, then use this gamma to compute the general prior form,\n        :math:`p \\sim {\\tt gamma}^{N_{\\rm blocks}}`.  If gamma is specified, p0\n        is ignored.\n    ncp_prior : float, optional\n        If specified, use the value of ``ncp_prior`` to compute the prior as\n        above, using the definition :math:`{\\tt ncp\\_prior} = -\\ln({\\tt\n        gamma})`.\n        If ``ncp_prior`` is specified, ``gamma`` and ``p0`` is ignored.\n    \"\"\"\n\n    def fitness(self, N_k, T_k):\n        # eq. 19 from Scargle 2013\n        return N_k * (np.log(N_k / T_k))\n\n    def validate_input(self, t, x, sigma):\n        t, x, sigma = super().validate_input(t, x, sigma)\n        if x is not None and np.any(x % 1 > 0):\n            raise ValueError(\"x must be integer counts for fitness='events'\")\n        return t, x, sigma"},{"col":4,"comment":"null","endLoc":443,"header":"def fitness(self, N_k, T_k)","id":8782,"name":"fitness","nodeType":"Function","startLoc":441,"text":"def fitness(self, N_k, T_k):\n        # eq. 19 from Scargle 2013\n        return N_k * (np.log(N_k / T_k))"},{"col":4,"comment":"null","endLoc":449,"header":"def validate_input(self, t, x, sigma)","id":8783,"name":"validate_input","nodeType":"Function","startLoc":445,"text":"def validate_input(self, t, x, sigma):\n        t, x, sigma = super().validate_input(t, x, sigma)\n        if x is not None and np.any(x % 1 > 0):\n            raise ValueError(\"x must be integer counts for fitness='events'\")\n        return t, x, sigma"},{"className":"RegularEvents","col":0,"comment":"Bayesian blocks fitness for regular events\n\n    This is for data which has a fundamental \"tick\" length, so that all\n    measured values are multiples of this tick length.  In each tick, there\n    are either zero or one counts.\n\n    Parameters\n    ----------\n    dt : float\n        tick rate for data\n    p0 : float, optional\n        False alarm probability, used to compute the prior on :math:`N_{\\rm\n        blocks}` (see eq. 21 of Scargle 2013). If gamma is specified, p0 is\n        ignored.\n    ncp_prior : float, optional\n        If specified, use the value of ``ncp_prior`` to compute the prior as\n        above, using the definition :math:`{\\tt ncp\\_prior} = -\\ln({\\tt\n        gamma})`.  If ``ncp_prior`` is specified, ``gamma`` and ``p0`` are\n        ignored.\n    ","endLoc":497,"id":8784,"nodeType":"Class","startLoc":452,"text":"class RegularEvents(FitnessFunc):\n    r\"\"\"Bayesian blocks fitness for regular events\n\n    This is for data which has a fundamental \"tick\" length, so that all\n    measured values are multiples of this tick length.  In each tick, there\n    are either zero or one counts.\n\n    Parameters\n    ----------\n    dt : float\n        tick rate for data\n    p0 : float, optional\n        False alarm probability, used to compute the prior on :math:`N_{\\rm\n        blocks}` (see eq. 21 of Scargle 2013). If gamma is specified, p0 is\n        ignored.\n    ncp_prior : float, optional\n        If specified, use the value of ``ncp_prior`` to compute the prior as\n        above, using the definition :math:`{\\tt ncp\\_prior} = -\\ln({\\tt\n        gamma})`.  If ``ncp_prior`` is specified, ``gamma`` and ``p0`` are\n        ignored.\n    \"\"\"\n    def __init__(self, dt, p0=0.05, gamma=None, ncp_prior=None):\n        self.dt = dt\n        super().__init__(p0, gamma, ncp_prior)\n\n    def validate_input(self, t, x, sigma):\n        t, x, sigma = super().validate_input(t, x, sigma)\n        if not np.all((x == 0) | (x == 1)):\n            raise ValueError(\"Regular events must have only 0 and 1 in x\")\n        return t, x, sigma\n\n    def fitness(self, T_k, N_k):\n        # Eq. C23 of Scargle 2013\n        M_k = T_k / self.dt\n        N_over_M = N_k / M_k\n\n        eps = 1E-8\n        if np.any(N_over_M > 1 + eps):\n            warnings.warn('regular events: N/M > 1.  '\n                          'Is the time step correct?', AstropyUserWarning)\n\n        one_m_NM = 1 - N_over_M\n        N_over_M[N_over_M <= 0] = 1\n        one_m_NM[one_m_NM <= 0] = 1\n\n        return N_k * np.log(N_over_M) + (M_k - N_k) * np.log(one_m_NM)"},{"col":0,"comment":"Compute optimal segmentation of data with Scargle's Bayesian Blocks\n\n    This is a flexible implementation of the Bayesian Blocks algorithm\n    described in Scargle 2013 [1]_.\n\n    Parameters\n    ----------\n    t : array-like\n        data times (one dimensional, length N)\n    x : array-like, optional\n        data values\n    sigma : array-like or float, optional\n        data errors\n    fitness : str or object\n        the fitness function to use for the model.\n        If a string, the following options are supported:\n\n        - 'events' : binned or unbinned event data.  Arguments are ``gamma``,\n          which gives the slope of the prior on the number of bins, or\n          ``ncp_prior``, which is :math:`-\\ln({\\tt gamma})`.\n        - 'regular_events' : non-overlapping events measured at multiples of a\n          fundamental tick rate, ``dt``, which must be specified as an\n          additional argument.  Extra arguments are ``p0``, which gives the\n          false alarm probability to compute the prior, or ``gamma``, which\n          gives the slope of the prior on the number of bins, or ``ncp_prior``,\n          which is :math:`-\\ln({\\tt gamma})`.\n        - 'measures' : fitness for a measured sequence with Gaussian errors.\n          Extra arguments are ``p0``, which gives the false alarm probability\n          to compute the prior, or ``gamma``, which gives the slope of the\n          prior on the number of bins, or ``ncp_prior``, which is\n          :math:`-\\ln({\\tt gamma})`.\n\n        In all three cases, if more than one of ``p0``, ``gamma``, and\n        ``ncp_prior`` is chosen, ``ncp_prior`` takes precedence over ``gamma``\n        which takes precedence over ``p0``.\n\n        Alternatively, the fitness parameter can be an instance of\n        :class:`FitnessFunc` or a subclass thereof.\n\n    **kwargs :\n        any additional keyword arguments will be passed to the specified\n        :class:`FitnessFunc` derived class.\n\n    Returns\n    -------\n    edges : ndarray\n        array containing the (N+1) edges defining the N bins\n\n    Examples\n    --------\n\n    .. testsetup::\n\n        >>> np.random.seed(12345)\n\n    Event data:\n\n    >>> t = np.random.normal(size=100)\n    >>> edges = bayesian_blocks(t, fitness='events', p0=0.01)\n\n    Event data with repeats:\n\n    >>> t = np.random.normal(size=100)\n    >>> t[80:] = t[:20]\n    >>> edges = bayesian_blocks(t, fitness='events', p0=0.01)\n\n    Regular event data:\n\n    >>> dt = 0.05\n    >>> t = dt * np.arange(1000)\n    >>> x = np.zeros(len(t))\n    >>> x[np.random.randint(0, len(t), len(t) // 10)] = 1\n    >>> edges = bayesian_blocks(t, x, fitness='regular_events', dt=dt)\n\n    Measured point data with errors:\n\n    >>> t = 100 * np.random.random(100)\n    >>> x = np.exp(-0.5 * (t - 50) ** 2)\n    >>> sigma = 0.1\n    >>> x_obs = np.random.normal(x, sigma)\n    >>> edges = bayesian_blocks(t, x_obs, sigma, fitness='measures')\n\n    References\n    ----------\n    .. [1] Scargle, J et al. (2013)\n       https://ui.adsabs.harvard.edu/abs/2013ApJ...764..167S\n\n    .. [2] Bellman, R.E., Dreyfus, S.E., 1962. Applied Dynamic\n       Programming. Princeton University Press, Princeton.\n       https://press.princeton.edu/books/hardcover/9780691651873/applied-dynamic-programming\n\n    .. [3] Bellman, R., Roth, R., 1969. Curve fitting by segmented\n       straight lines. J. Amer. Statist. Assoc. 64, 1079–1084.\n       https://www.tandfonline.com/doi/abs/10.1080/01621459.1969.10501038\n\n    See Also\n    --------\n    astropy.stats.histogram : compute a histogram using bayesian blocks\n    ","endLoc":172,"header":"def bayesian_blocks(t, x=None, sigma=None,\n                    fitness='events', **kwargs)","id":8785,"name":"bayesian_blocks","nodeType":"Function","startLoc":59,"text":"def bayesian_blocks(t, x=None, sigma=None,\n                    fitness='events', **kwargs):\n    r\"\"\"Compute optimal segmentation of data with Scargle's Bayesian Blocks\n\n    This is a flexible implementation of the Bayesian Blocks algorithm\n    described in Scargle 2013 [1]_.\n\n    Parameters\n    ----------\n    t : array-like\n        data times (one dimensional, length N)\n    x : array-like, optional\n        data values\n    sigma : array-like or float, optional\n        data errors\n    fitness : str or object\n        the fitness function to use for the model.\n        If a string, the following options are supported:\n\n        - 'events' : binned or unbinned event data.  Arguments are ``gamma``,\n          which gives the slope of the prior on the number of bins, or\n          ``ncp_prior``, which is :math:`-\\ln({\\tt gamma})`.\n        - 'regular_events' : non-overlapping events measured at multiples of a\n          fundamental tick rate, ``dt``, which must be specified as an\n          additional argument.  Extra arguments are ``p0``, which gives the\n          false alarm probability to compute the prior, or ``gamma``, which\n          gives the slope of the prior on the number of bins, or ``ncp_prior``,\n          which is :math:`-\\ln({\\tt gamma})`.\n        - 'measures' : fitness for a measured sequence with Gaussian errors.\n          Extra arguments are ``p0``, which gives the false alarm probability\n          to compute the prior, or ``gamma``, which gives the slope of the\n          prior on the number of bins, or ``ncp_prior``, which is\n          :math:`-\\ln({\\tt gamma})`.\n\n        In all three cases, if more than one of ``p0``, ``gamma``, and\n        ``ncp_prior`` is chosen, ``ncp_prior`` takes precedence over ``gamma``\n        which takes precedence over ``p0``.\n\n        Alternatively, the fitness parameter can be an instance of\n        :class:`FitnessFunc` or a subclass thereof.\n\n    **kwargs :\n        any additional keyword arguments will be passed to the specified\n        :class:`FitnessFunc` derived class.\n\n    Returns\n    -------\n    edges : ndarray\n        array containing the (N+1) edges defining the N bins\n\n    Examples\n    --------\n\n    .. testsetup::\n\n        >>> np.random.seed(12345)\n\n    Event data:\n\n    >>> t = np.random.normal(size=100)\n    >>> edges = bayesian_blocks(t, fitness='events', p0=0.01)\n\n    Event data with repeats:\n\n    >>> t = np.random.normal(size=100)\n    >>> t[80:] = t[:20]\n    >>> edges = bayesian_blocks(t, fitness='events', p0=0.01)\n\n    Regular event data:\n\n    >>> dt = 0.05\n    >>> t = dt * np.arange(1000)\n    >>> x = np.zeros(len(t))\n    >>> x[np.random.randint(0, len(t), len(t) // 10)] = 1\n    >>> edges = bayesian_blocks(t, x, fitness='regular_events', dt=dt)\n\n    Measured point data with errors:\n\n    >>> t = 100 * np.random.random(100)\n    >>> x = np.exp(-0.5 * (t - 50) ** 2)\n    >>> sigma = 0.1\n    >>> x_obs = np.random.normal(x, sigma)\n    >>> edges = bayesian_blocks(t, x_obs, sigma, fitness='measures')\n\n    References\n    ----------\n    .. [1] Scargle, J et al. (2013)\n       https://ui.adsabs.harvard.edu/abs/2013ApJ...764..167S\n\n    .. [2] Bellman, R.E., Dreyfus, S.E., 1962. Applied Dynamic\n       Programming. Princeton University Press, Princeton.\n       https://press.princeton.edu/books/hardcover/9780691651873/applied-dynamic-programming\n\n    .. [3] Bellman, R., Roth, R., 1969. Curve fitting by segmented\n       straight lines. J. Amer. Statist. Assoc. 64, 1079–1084.\n       https://www.tandfonline.com/doi/abs/10.1080/01621459.1969.10501038\n\n    See Also\n    --------\n    astropy.stats.histogram : compute a histogram using bayesian blocks\n    \"\"\"\n    FITNESS_DICT = {'events': Events,\n                    'regular_events': RegularEvents,\n                    'measures': PointMeasures}\n    fitness = FITNESS_DICT.get(fitness, fitness)\n\n    if type(fitness) is type and issubclass(fitness, FitnessFunc):\n        fitfunc = fitness(**kwargs)\n    elif isinstance(fitness, FitnessFunc):\n        fitfunc = fitness\n    else:\n        raise ValueError(\"fitness parameter not understood\")\n\n    return fitfunc.fit(t, x, sigma)"},{"col":4,"comment":"null","endLoc":475,"header":"def __init__(self, dt, p0=0.05, gamma=None, ncp_prior=None)","id":8786,"name":"__init__","nodeType":"Function","startLoc":473,"text":"def __init__(self, dt, p0=0.05, gamma=None, ncp_prior=None):\n        self.dt = dt\n        super().__init__(p0, gamma, ncp_prior)"},{"col":0,"comment":"null","endLoc":34,"header":"def _components(data, p=1, phi=0.0, axis=None, weights=None)","id":8787,"name":"_components","nodeType":"Function","startLoc":21,"text":"def _components(data, p=1, phi=0.0, axis=None, weights=None):\n    # Utility function for computing the generalized rectangular components\n    # of the circular data.\n    if weights is None:\n        weights = np.ones((1,))\n    try:\n        weights = np.broadcast_to(weights, data.shape)\n    except ValueError:\n        raise ValueError('Weights and data have inconsistent shape.')\n\n    C = np.sum(weights * np.cos(p * (data - phi)), axis)/np.sum(weights, axis)\n    S = np.sum(weights * np.sin(p * (data - phi)), axis)/np.sum(weights, axis)\n\n    return C, S"},{"col":4,"comment":"null","endLoc":481,"header":"def validate_input(self, t, x, sigma)","id":8788,"name":"validate_input","nodeType":"Function","startLoc":477,"text":"def validate_input(self, t, x, sigma):\n        t, x, sigma = super().validate_input(t, x, sigma)\n        if not np.all((x == 0) | (x == 1)):\n            raise ValueError(\"Regular events must have only 0 and 1 in x\")\n        return t, x, sigma"},{"className":"_KnuthF","col":0,"comment":"Class which implements the function minimized by knuth_bin_width\n\n    Parameters\n    ----------\n    data : array-like, one dimension\n        data to be histogrammed\n\n    Notes\n    -----\n    the function F is given by\n\n    .. math::\n        F(M|x,I) = n\\log(M) + \\log\\Gamma(\\frac{M}{2})\n        - M\\log\\Gamma(\\frac{1}{2})\n        - \\log\\Gamma(\\frac{2n+M}{2})\n        + \\sum_{k=1}^M \\log\\Gamma(n_k + \\frac{1}{2})\n\n    where :math:`\\Gamma` is the Gamma function, :math:`n` is the number of\n    data points, :math:`n_k` is the number of measurements in bin :math:`k`.\n\n    See Also\n    --------\n    knuth_bin_width\n    ","endLoc":411,"id":8789,"nodeType":"Class","startLoc":338,"text":"class _KnuthF:\n    r\"\"\"Class which implements the function minimized by knuth_bin_width\n\n    Parameters\n    ----------\n    data : array-like, one dimension\n        data to be histogrammed\n\n    Notes\n    -----\n    the function F is given by\n\n    .. math::\n        F(M|x,I) = n\\log(M) + \\log\\Gamma(\\frac{M}{2})\n        - M\\log\\Gamma(\\frac{1}{2})\n        - \\log\\Gamma(\\frac{2n+M}{2})\n        + \\sum_{k=1}^M \\log\\Gamma(n_k + \\frac{1}{2})\n\n    where :math:`\\Gamma` is the Gamma function, :math:`n` is the number of\n    data points, :math:`n_k` is the number of measurements in bin :math:`k`.\n\n    See Also\n    --------\n    knuth_bin_width\n    \"\"\"\n    def __init__(self, data):\n        self.data = np.array(data, copy=True)\n        if self.data.ndim != 1:\n            raise ValueError(\"data should be 1-dimensional\")\n        self.data.sort()\n        self.n = self.data.size\n\n        # import here rather than globally: scipy is an optional dependency.\n        # Note that scipy is imported in the function which calls this,\n        # so there shouldn't be any issue importing here.\n        from scipy import special\n\n        # create a reference to gammaln to use in self.eval()\n        self.gammaln = special.gammaln\n\n    def bins(self, M):\n        \"\"\"Return the bin edges given M number of bins\"\"\"\n        return np.linspace(self.data[0], self.data[-1], int(M) + 1)\n\n    def __call__(self, M):\n        return self.eval(M)\n\n    def eval(self, M):\n        \"\"\"Evaluate the Knuth function\n\n        Parameters\n        ----------\n        M : int\n            Number of bins\n\n        Returns\n        -------\n        F : float\n            evaluation of the negative Knuth loglikelihood function:\n            smaller values indicate a better fit.\n        \"\"\"\n        M = int(M)\n\n        if M <= 0:\n            return np.inf\n\n        bins = self.bins(M)\n        nk, bins = np.histogram(self.data, bins)\n\n        return -(self.n * np.log(M) +\n                 self.gammaln(0.5 * M) -\n                 M * self.gammaln(0.5) -\n                 self.gammaln(self.n + 0.5 * M) +\n                 np.sum(self.gammaln(nk + 0.5)))"},{"col":4,"comment":"null","endLoc":376,"header":"def __init__(self, data)","id":8790,"name":"__init__","nodeType":"Function","startLoc":363,"text":"def __init__(self, data):\n        self.data = np.array(data, copy=True)\n        if self.data.ndim != 1:\n            raise ValueError(\"data should be 1-dimensional\")\n        self.data.sort()\n        self.n = self.data.size\n\n        # import here rather than globally: scipy is an optional dependency.\n        # Note that scipy is imported in the function which calls this,\n        # so there shouldn't be any issue importing here.\n        from scipy import special\n\n        # create a reference to gammaln to use in self.eval()\n        self.gammaln = special.gammaln"},{"col":4,"comment":"null","endLoc":497,"header":"def fitness(self, T_k, N_k)","id":8791,"name":"fitness","nodeType":"Function","startLoc":483,"text":"def fitness(self, T_k, N_k):\n        # Eq. C23 of Scargle 2013\n        M_k = T_k / self.dt\n        N_over_M = N_k / M_k\n\n        eps = 1E-8\n        if np.any(N_over_M > 1 + eps):\n            warnings.warn('regular events: N/M > 1.  '\n                          'Is the time step correct?', AstropyUserWarning)\n\n        one_m_NM = 1 - N_over_M\n        N_over_M[N_over_M <= 0] = 1\n        one_m_NM[one_m_NM <= 0] = 1\n\n        return N_k * np.log(N_over_M) + (M_k - N_k) * np.log(one_m_NM)"},{"col":0,"comment":"\n    Compute the biweight midcorrelation between two variables.\n\n    The `biweight midcorrelation\n    <https://en.wikipedia.org/wiki/Biweight_midcorrelation>`_ is a\n    measure of similarity between samples.  It is given by:\n\n    .. math::\n\n        r_{bicorr} = \\frac{\\zeta_{xy}}{\\sqrt{\\zeta_{xx} \\ \\zeta_{yy}}}\n\n    where :math:`\\zeta_{xx}` is the biweight midvariance of :math:`x`,\n    :math:`\\zeta_{yy}` is the biweight midvariance of :math:`y`, and\n    :math:`\\zeta_{xy}` is the biweight midcovariance of :math:`x` and\n    :math:`y`.\n\n    Parameters\n    ----------\n    x, y : 1D array-like\n        Input arrays for the two variables.  ``x`` and ``y`` must be 1D\n        arrays and have the same number of elements.\n    c : float, optional\n        Tuning constant for the biweight estimator (default = 9.0).  See\n        `biweight_midcovariance` for more details.\n    M : float or array-like, optional\n        The location estimate.  If ``M`` is a scalar value, then its\n        value will be used for the entire array (or along each ``axis``,\n        if specified).  If ``M`` is an array, then its must be an array\n        containing the location estimate along each ``axis`` of the\n        input array.  If `None` (default), then the median of the input\n        array will be used (or along each ``axis``, if specified).  See\n        `biweight_midcovariance` for more details.\n    modify_sample_size : bool, optional\n        If `False` (default), then the sample size used is the total\n        number of elements in the array (or along the input ``axis``, if\n        specified), which follows the standard definition of biweight\n        midcovariance.  If `True`, then the sample size is reduced to\n        correct for any rejected values (i.e. the sample size used\n        includes only the non-rejected values), which results in a value\n        closer to the true midcovariance for small sample sizes or for a\n        large number of rejected values.  See `biweight_midcovariance`\n        for more details.\n\n    Returns\n    -------\n    biweight_midcorrelation : float\n        The biweight midcorrelation between ``x`` and ``y``.\n\n    See Also\n    --------\n    biweight_scale, biweight_midvariance, biweight_midcovariance, biweight_location\n\n    References\n    ----------\n    .. [1] https://en.wikipedia.org/wiki/Biweight_midcorrelation\n\n    Examples\n    --------\n    Calculate the biweight midcorrelation between two variables:\n\n    >>> import numpy as np\n    >>> from astropy.stats import biweight_midcorrelation\n    >>> rng = np.random.default_rng(12345)\n    >>> x = rng.normal(0, 1, 200)\n    >>> y = rng.normal(0, 3, 200)\n    >>> # Introduce an obvious outlier\n    >>> x[0] = 30.0\n    >>> bicorr = biweight_midcorrelation(x, y)\n    >>> print(bicorr)  # doctest: +FLOAT_CMP\n    -0.09203238319481295\n    ","endLoc":746,"header":"def biweight_midcorrelation(x, y, c=9.0, M=None, modify_sample_size=False)","id":8792,"name":"biweight_midcorrelation","nodeType":"Function","startLoc":661,"text":"def biweight_midcorrelation(x, y, c=9.0, M=None, modify_sample_size=False):\n    r\"\"\"\n    Compute the biweight midcorrelation between two variables.\n\n    The `biweight midcorrelation\n    <https://en.wikipedia.org/wiki/Biweight_midcorrelation>`_ is a\n    measure of similarity between samples.  It is given by:\n\n    .. math::\n\n        r_{bicorr} = \\frac{\\zeta_{xy}}{\\sqrt{\\zeta_{xx} \\ \\zeta_{yy}}}\n\n    where :math:`\\zeta_{xx}` is the biweight midvariance of :math:`x`,\n    :math:`\\zeta_{yy}` is the biweight midvariance of :math:`y`, and\n    :math:`\\zeta_{xy}` is the biweight midcovariance of :math:`x` and\n    :math:`y`.\n\n    Parameters\n    ----------\n    x, y : 1D array-like\n        Input arrays for the two variables.  ``x`` and ``y`` must be 1D\n        arrays and have the same number of elements.\n    c : float, optional\n        Tuning constant for the biweight estimator (default = 9.0).  See\n        `biweight_midcovariance` for more details.\n    M : float or array-like, optional\n        The location estimate.  If ``M`` is a scalar value, then its\n        value will be used for the entire array (or along each ``axis``,\n        if specified).  If ``M`` is an array, then its must be an array\n        containing the location estimate along each ``axis`` of the\n        input array.  If `None` (default), then the median of the input\n        array will be used (or along each ``axis``, if specified).  See\n        `biweight_midcovariance` for more details.\n    modify_sample_size : bool, optional\n        If `False` (default), then the sample size used is the total\n        number of elements in the array (or along the input ``axis``, if\n        specified), which follows the standard definition of biweight\n        midcovariance.  If `True`, then the sample size is reduced to\n        correct for any rejected values (i.e. the sample size used\n        includes only the non-rejected values), which results in a value\n        closer to the true midcovariance for small sample sizes or for a\n        large number of rejected values.  See `biweight_midcovariance`\n        for more details.\n\n    Returns\n    -------\n    biweight_midcorrelation : float\n        The biweight midcorrelation between ``x`` and ``y``.\n\n    See Also\n    --------\n    biweight_scale, biweight_midvariance, biweight_midcovariance, biweight_location\n\n    References\n    ----------\n    .. [1] https://en.wikipedia.org/wiki/Biweight_midcorrelation\n\n    Examples\n    --------\n    Calculate the biweight midcorrelation between two variables:\n\n    >>> import numpy as np\n    >>> from astropy.stats import biweight_midcorrelation\n    >>> rng = np.random.default_rng(12345)\n    >>> x = rng.normal(0, 1, 200)\n    >>> y = rng.normal(0, 3, 200)\n    >>> # Introduce an obvious outlier\n    >>> x[0] = 30.0\n    >>> bicorr = biweight_midcorrelation(x, y)\n    >>> print(bicorr)  # doctest: +FLOAT_CMP\n    -0.09203238319481295\n    \"\"\"\n\n    x = np.asanyarray(x)\n    y = np.asanyarray(y)\n    if x.ndim != 1:\n        raise ValueError('x must be a 1D array.')\n    if y.ndim != 1:\n        raise ValueError('y must be a 1D array.')\n    if x.shape != y.shape:\n        raise ValueError('x and y must have the same shape.')\n\n    bicorr = biweight_midcovariance([x, y], c=c, M=M,\n                                    modify_sample_size=modify_sample_size)\n\n    return bicorr[0, 1] / (np.sqrt(bicorr[0, 0] * bicorr[1, 1]))"},{"col":0,"comment":"null","endLoc":48,"header":"def _angle(data, p=1, phi=0.0, axis=None, weights=None)","id":8793,"name":"_angle","nodeType":"Function","startLoc":37,"text":"def _angle(data, p=1, phi=0.0, axis=None, weights=None):\n    # Utility function for computing the generalized sample mean angle\n    C, S = _components(data, p, phi, axis, weights)\n\n    # theta will be an angle in the interval [-np.pi, np.pi)\n    # [-180, 180)*u.deg in case data is a Quantity\n    theta = np.arctan2(S, C)\n\n    if isinstance(data, Quantity):\n        theta = theta.to(data.unit)\n\n    return theta"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":8794,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"biweight.py#<anonymous>","id":8795,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module contains functions for computing robust statistics using\nTukey's biweight function.\n\"\"\"\n\n__all__ = ['biweight_location', 'biweight_scale', 'biweight_midvariance',\n           'biweight_midcovariance', 'biweight_midcorrelation']"},{"id":8796,"name":"astropy/stats/bls","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/stats/bls","id":8797,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# The BoxLeastSquares periodogram functionality has been moved to\n# astropy.timeseries.periodograms.bls. The purpose of this file is to provide backward-\n# compatibility during a transition phase. We can't emit a deprecation warning\n# simply on import of this module, since the classes are imported into the\n# top-level astropy.stats, so instead we wrap the main class and emit a\n# warning during initialization.\n\nimport warnings\n\nfrom astropy.timeseries.periodograms.bls import (BoxLeastSquares as TimeseriesBoxLeastSquares,\n                                                 BoxLeastSquaresResults as TimeseriesBoxLeastSquaresResults)\nfrom astropy.utils.exceptions import AstropyDeprecationWarning\n\n__all__ = ['BoxLeastSquares', 'BoxLeastSquaresResults']\n\n\nclass BoxLeastSquares(TimeseriesBoxLeastSquares):\n    \"\"\"\n    Compute the box least squares periodogram.\n\n    This class has been deprecated and will be removed in a future version.\n    Use `astropy.timeseries.BoxLeastSquares` instead.\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n        warnings.warn('Importing BoxLeastSquares from astropy.stats has been '\n                      'deprecated and will no longer be supported in future. '\n                      'Please import this class from the astropy.timeseries '\n                      'module instead', AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)\n\n\nclass BoxLeastSquaresResults(TimeseriesBoxLeastSquaresResults):\n    \"\"\"\n    The results of a BoxLeastSquares search.\n\n    This class has been deprecated and will be removed in a future version.\n    Use `astropy.timeseries.BoxLeastSquaresResults` instead.\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n        warnings.warn('Importing BoxLeastSquaresResults from astropy.stats has been '\n                      'deprecated and will no longer be supported in future. '\n                      'Please import this class from the astropy.timeseries '\n                      'module instead', AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)\n"},{"col":0,"comment":"null","endLoc":54,"header":"def _length(data, p=1, phi=0.0, axis=None, weights=None)","id":8798,"name":"_length","nodeType":"Function","startLoc":51,"text":"def _length(data, p=1, phi=0.0, axis=None, weights=None):\n    # Utility function for computing the generalized sample length\n    C, S = _components(data, p, phi, axis, weights)\n    return np.hypot(S, C)"},{"col":4,"comment":"null","endLoc":1630,"header":"@property\n    def value(self)","id":8799,"name":"value","nodeType":"Function","startLoc":1624,"text":"@property\n    def value(self):\n        precision = self.precision\n        self.precision = 9\n        ret = super().value\n        self.precision = precision\n        return ret.astype('datetime64')"},{"col":0,"comment":" Computes the circular mean angle of an array of circular data.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    axis : int, optional\n        Axis along which circular means are computed. The default is to compute\n        the mean of the flattened array.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``sum(weights, axis)``\n        equals the number of observations. See [1]_, remark 1.4, page 22, for\n        detailed explanation.\n\n    Returns\n    -------\n    circmean : ndarray or `~astropy.units.Quantity`\n        Circular mean.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import circmean\n    >>> from astropy import units as u\n    >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg\n    >>> circmean(data) # doctest: +FLOAT_CMP\n    <Quantity 48.62718088722989 deg>\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    ","endLoc":96,"header":"def circmean(data, axis=None, weights=None)","id":8800,"name":"circmean","nodeType":"Function","startLoc":57,"text":"def circmean(data, axis=None, weights=None):\n    \"\"\" Computes the circular mean angle of an array of circular data.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    axis : int, optional\n        Axis along which circular means are computed. The default is to compute\n        the mean of the flattened array.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``sum(weights, axis)``\n        equals the number of observations. See [1]_, remark 1.4, page 22, for\n        detailed explanation.\n\n    Returns\n    -------\n    circmean : ndarray or `~astropy.units.Quantity`\n        Circular mean.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import circmean\n    >>> from astropy import units as u\n    >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg\n    >>> circmean(data) # doctest: +FLOAT_CMP\n    <Quantity 48.62718088722989 deg>\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    \"\"\"\n    return _angle(data, 1, 0.0, axis, weights)"},{"col":0,"comment":" Computes the circular variance of an array of circular data.\n\n    There are some concepts for defining measures of dispersion for circular\n    data. The variance implemented here is based on the definition given by\n    [1]_, which is also the same used by the R package 'CircStats' [2]_.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n        Dimensionless, if Quantity.\n    axis : int, optional\n        Axis along which circular variances are computed. The default is to\n        compute the variance of the flattened array.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``sum(weights, axis)``\n        equals the number of observations. See [1]_, remark 1.4, page 22,\n        for detailed explanation.\n\n    Returns\n    -------\n    circvar : ndarray or `~astropy.units.Quantity` ['dimensionless']\n        Circular variance.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import circvar\n    >>> from astropy import units as u\n    >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg\n    >>> circvar(data) # doctest: +FLOAT_CMP\n    <Quantity 0.16356352748437508>\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n\n    Notes\n    -----\n    The definition used here differs from the one in scipy.stats.circvar.\n    Precisely, Scipy circvar uses an approximation based on the limit of small\n    angles which approaches the linear variance.\n    ","endLoc":150,"header":"def circvar(data, axis=None, weights=None)","id":8801,"name":"circvar","nodeType":"Function","startLoc":99,"text":"def circvar(data, axis=None, weights=None):\n    \"\"\" Computes the circular variance of an array of circular data.\n\n    There are some concepts for defining measures of dispersion for circular\n    data. The variance implemented here is based on the definition given by\n    [1]_, which is also the same used by the R package 'CircStats' [2]_.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n        Dimensionless, if Quantity.\n    axis : int, optional\n        Axis along which circular variances are computed. The default is to\n        compute the variance of the flattened array.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``sum(weights, axis)``\n        equals the number of observations. See [1]_, remark 1.4, page 22,\n        for detailed explanation.\n\n    Returns\n    -------\n    circvar : ndarray or `~astropy.units.Quantity` ['dimensionless']\n        Circular variance.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import circvar\n    >>> from astropy import units as u\n    >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg\n    >>> circvar(data) # doctest: +FLOAT_CMP\n    <Quantity 0.16356352748437508>\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n\n    Notes\n    -----\n    The definition used here differs from the one in scipy.stats.circvar.\n    Precisely, Scipy circvar uses an approximation based on the limit of small\n    angles which approaches the linear variance.\n    \"\"\"\n\n    return 1.0 - _length(data, 1, 0.0, axis, weights)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1586,"id":8802,"name":"name","nodeType":"Attribute","startLoc":1586,"text":"name"},{"col":0,"comment":" Computes the circular standard deviation of an array of circular data.\n\n    The standard deviation implemented here is based on the definitions given\n    by [1]_, which is also the same used by the R package 'CirStat' [2]_.\n\n    Two methods are implemented: 'angular' and 'circular'. The former is\n    defined as sqrt(2 * (1 - R)) and it is bounded in [0, 2*Pi]. The\n    latter is defined as sqrt(-2 * ln(R)) and it is bounded in [0, inf].\n\n    Following 'CircStat' the default method used to obtain the standard\n    deviation is 'angular'.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n        If quantity, must be dimensionless.\n    axis : int, optional\n        Axis along which circular variances are computed. The default is to\n        compute the variance of the flattened array.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``sum(weights, axis)``\n        equals the number of observations. See [3]_, remark 1.4, page 22,\n        for detailed explanation.\n    method : str, optional\n        The method used to estimate the standard deviation:\n\n        - 'angular' : obtains the angular deviation\n\n        - 'circular' : obtains the circular deviation\n\n\n    Returns\n    -------\n    circstd : ndarray or `~astropy.units.Quantity` ['dimensionless']\n        Angular or circular standard deviation.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import circstd\n    >>> from astropy import units as u\n    >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg\n    >>> circstd(data) # doctest: +FLOAT_CMP\n    <Quantity 0.57195022>\n\n    Alternatively, using the 'circular' method:\n\n    >>> import numpy as np\n    >>> from astropy.stats import circstd\n    >>> from astropy import units as u\n    >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg\n    >>> circstd(data, method='circular') # doctest: +FLOAT_CMP\n    <Quantity 0.59766999>\n\n    References\n    ----------\n    .. [1] P. Berens. \"CircStat: A MATLAB Toolbox for Circular Statistics\".\n       Journal of Statistical Software, vol 31, issue 10, 2009.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    .. [3] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n\n    ","endLoc":228,"header":"def circstd(data, axis=None, weights=None, method='angular')","id":8803,"name":"circstd","nodeType":"Function","startLoc":153,"text":"def circstd(data, axis=None, weights=None, method='angular'):\n    \"\"\" Computes the circular standard deviation of an array of circular data.\n\n    The standard deviation implemented here is based on the definitions given\n    by [1]_, which is also the same used by the R package 'CirStat' [2]_.\n\n    Two methods are implemented: 'angular' and 'circular'. The former is\n    defined as sqrt(2 * (1 - R)) and it is bounded in [0, 2*Pi]. The\n    latter is defined as sqrt(-2 * ln(R)) and it is bounded in [0, inf].\n\n    Following 'CircStat' the default method used to obtain the standard\n    deviation is 'angular'.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n        If quantity, must be dimensionless.\n    axis : int, optional\n        Axis along which circular variances are computed. The default is to\n        compute the variance of the flattened array.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``sum(weights, axis)``\n        equals the number of observations. See [3]_, remark 1.4, page 22,\n        for detailed explanation.\n    method : str, optional\n        The method used to estimate the standard deviation:\n\n        - 'angular' : obtains the angular deviation\n\n        - 'circular' : obtains the circular deviation\n\n\n    Returns\n    -------\n    circstd : ndarray or `~astropy.units.Quantity` ['dimensionless']\n        Angular or circular standard deviation.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import circstd\n    >>> from astropy import units as u\n    >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg\n    >>> circstd(data) # doctest: +FLOAT_CMP\n    <Quantity 0.57195022>\n\n    Alternatively, using the 'circular' method:\n\n    >>> import numpy as np\n    >>> from astropy.stats import circstd\n    >>> from astropy import units as u\n    >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg\n    >>> circstd(data, method='circular') # doctest: +FLOAT_CMP\n    <Quantity 0.59766999>\n\n    References\n    ----------\n    .. [1] P. Berens. \"CircStat: A MATLAB Toolbox for Circular Statistics\".\n       Journal of Statistical Software, vol 31, issue 10, 2009.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    .. [3] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n\n    \"\"\"\n    if method not in ('angular', 'circular'):\n        raise ValueError(\"method should be either 'angular' or 'circular'\")\n\n    if method == 'angular':\n        return np.sqrt(2. * (1. - _length(data, 1, 0.0, axis, weights)))\n    else:\n        return np.sqrt(-2. * np.log(_length(data, 1, 0.0, axis, weights)))"},{"attributeType":"null","col":8,"comment":"null","endLoc":1627,"id":8804,"name":"precision","nodeType":"Attribute","startLoc":1627,"text":"self.precision"},{"className":"TimeFITS","col":0,"comment":"\n    FITS format: \"[±Y]YYYY-MM-DD[THH:MM:SS[.sss]]\".\n\n    ISOT but can give signed five-digit year (mostly for negative years);\n\n    The allowed subformats are:\n\n    - 'date_hms': date + hours, mins, secs (and optional fractional secs)\n    - 'date': date\n    - 'longdate_hms': as 'date_hms', but with signed 5-digit year\n    - 'longdate': as 'date', but with signed 5-digit year\n\n    See Rots et al., 2015, A&A 574:A36 (arXiv:1409.7583).\n    ","endLoc":1717,"id":8805,"nodeType":"Class","startLoc":1633,"text":"class TimeFITS(TimeString):\n    \"\"\"\n    FITS format: \"[±Y]YYYY-MM-DD[THH:MM:SS[.sss]]\".\n\n    ISOT but can give signed five-digit year (mostly for negative years);\n\n    The allowed subformats are:\n\n    - 'date_hms': date + hours, mins, secs (and optional fractional secs)\n    - 'date': date\n    - 'longdate_hms': as 'date_hms', but with signed 5-digit year\n    - 'longdate': as 'date', but with signed 5-digit year\n\n    See Rots et al., 2015, A&A 574:A36 (arXiv:1409.7583).\n    \"\"\"\n    name = 'fits'\n    subfmts = (\n        ('date_hms',\n         (r'(?P<year>\\d{4})-(?P<mon>\\d\\d)-(?P<mday>\\d\\d)T'\n          r'(?P<hour>\\d\\d):(?P<min>\\d\\d):(?P<sec>\\d\\d(\\.\\d*)?)'),\n         '{year:04d}-{mon:02d}-{day:02d}T{hour:02d}:{min:02d}:{sec:02d}'),\n        ('date',\n         r'(?P<year>\\d{4})-(?P<mon>\\d\\d)-(?P<mday>\\d\\d)',\n         '{year:04d}-{mon:02d}-{day:02d}'),\n        ('longdate_hms',\n         (r'(?P<year>[+-]\\d{5})-(?P<mon>\\d\\d)-(?P<mday>\\d\\d)T'\n          r'(?P<hour>\\d\\d):(?P<min>\\d\\d):(?P<sec>\\d\\d(\\.\\d*)?)'),\n         '{year:+06d}-{mon:02d}-{day:02d}T{hour:02d}:{min:02d}:{sec:02d}'),\n        ('longdate',\n         r'(?P<year>[+-]\\d{5})-(?P<mon>\\d\\d)-(?P<mday>\\d\\d)',\n         '{year:+06d}-{mon:02d}-{day:02d}'))\n    # Add the regex that parses the scale and possible realization.\n    # Support for this is deprecated.  Read old style but no longer write\n    # in this style.\n    subfmts = tuple(\n        (subfmt[0],\n         subfmt[1] + r'(\\((?P<scale>\\w+)(\\((?P<realization>\\w+)\\))?\\))?',\n         subfmt[2]) for subfmt in subfmts)\n\n    def parse_string(self, timestr, subfmts):\n        \"\"\"Read time and deprecated scale if present\"\"\"\n        # Try parsing with any of the allowed sub-formats.\n        for _, regex, _ in subfmts:\n            tm = re.match(regex, timestr)\n            if tm:\n                break\n        else:\n            raise ValueError(f'Time {timestr} does not match {self.name} format')\n        tm = tm.groupdict()\n        # Scale and realization are deprecated and strings in this form\n        # are no longer created.  We issue a warning but still use the value.\n        if tm['scale'] is not None:\n            warnings.warn(\"FITS time strings should no longer have embedded time scale.\",\n                          AstropyDeprecationWarning)\n            # If a scale was given, translate from a possible deprecated\n            # timescale identifier to the scale used by Time.\n            fits_scale = tm['scale'].upper()\n            scale = FITS_DEPRECATED_SCALES.get(fits_scale, fits_scale.lower())\n            if scale not in TIME_SCALES:\n                raise ValueError(\"Scale {!r} is not in the allowed scales {}\"\n                                 .format(scale, sorted(TIME_SCALES)))\n            # If no scale was given in the initialiser, set the scale to\n            # that given in the string.  Realization is ignored\n            # and is only supported to allow old-style strings to be\n            # parsed.\n            if self._scale is None:\n                self._scale = scale\n            if scale != self.scale:\n                raise ValueError(\"Input strings for {} class must all \"\n                                 \"have consistent time scales.\"\n                                 .format(self.name))\n        return [int(tm['year']), int(tm['mon']), int(tm['mday']),\n                int(tm.get('hour', 0)), int(tm.get('min', 0)),\n                float(tm.get('sec', 0.))]\n\n    @property\n    def value(self):\n        \"\"\"Convert times to strings, using signed 5 digit if necessary.\"\"\"\n        if 'long' not in self.out_subfmt:\n            # If we have times before year 0 or after year 9999, we can\n            # output only in a \"long\" format, using signed 5-digit years.\n            jd = self.jd1 + self.jd2\n            if jd.size and (jd.min() < 1721425.5 or jd.max() >= 5373484.5):\n                self.out_subfmt = 'long' + self.out_subfmt\n        return super().value"},{"col":4,"comment":"Read time and deprecated scale if present","endLoc":1706,"header":"def parse_string(self, timestr, subfmts)","id":8806,"name":"parse_string","nodeType":"Function","startLoc":1672,"text":"def parse_string(self, timestr, subfmts):\n        \"\"\"Read time and deprecated scale if present\"\"\"\n        # Try parsing with any of the allowed sub-formats.\n        for _, regex, _ in subfmts:\n            tm = re.match(regex, timestr)\n            if tm:\n                break\n        else:\n            raise ValueError(f'Time {timestr} does not match {self.name} format')\n        tm = tm.groupdict()\n        # Scale and realization are deprecated and strings in this form\n        # are no longer created.  We issue a warning but still use the value.\n        if tm['scale'] is not None:\n            warnings.warn(\"FITS time strings should no longer have embedded time scale.\",\n                          AstropyDeprecationWarning)\n            # If a scale was given, translate from a possible deprecated\n            # timescale identifier to the scale used by Time.\n            fits_scale = tm['scale'].upper()\n            scale = FITS_DEPRECATED_SCALES.get(fits_scale, fits_scale.lower())\n            if scale not in TIME_SCALES:\n                raise ValueError(\"Scale {!r} is not in the allowed scales {}\"\n                                 .format(scale, sorted(TIME_SCALES)))\n            # If no scale was given in the initialiser, set the scale to\n            # that given in the string.  Realization is ignored\n            # and is only supported to allow old-style strings to be\n            # parsed.\n            if self._scale is None:\n                self._scale = scale\n            if scale != self.scale:\n                raise ValueError(\"Input strings for {} class must all \"\n                                 \"have consistent time scales.\"\n                                 .format(self.name))\n        return [int(tm['year']), int(tm['mon']), int(tm['mday']),\n                int(tm.get('hour', 0)), int(tm.get('min', 0)),\n                float(tm.get('sec', 0.))]"},{"className":"BoxLeastSquares","col":0,"comment":"Compute the box least squares periodogram\n\n    This method is a commonly used tool for discovering transiting exoplanets\n    or eclipsing binaries in photometric time series datasets. This\n    implementation is based on the \"box least squares (BLS)\" method described\n    in [1]_ and [2]_.\n\n    Parameters\n    ----------\n    t : array-like, `~astropy.units.Quantity`, `~astropy.time.Time`, or `~astropy.time.TimeDelta`\n        Sequence of observation times.\n    y : array-like or `~astropy.units.Quantity`\n        Sequence of observations associated with times ``t``.\n    dy : float, array-like, or `~astropy.units.Quantity`, optional\n        Error or sequence of observational errors associated with times ``t``.\n\n    Examples\n    --------\n    Generate noisy data with a transit:\n\n    >>> rand = np.random.default_rng(42)\n    >>> t = rand.uniform(0, 10, 500)\n    >>> y = np.ones_like(t)\n    >>> y[np.abs((t + 1.0)%2.0-1)<0.08] = 1.0 - 0.1\n    >>> y += 0.01 * rand.standard_normal(len(t))\n\n    Compute the transit periodogram on a heuristically determined period grid\n    and find the period with maximum power:\n\n    >>> model = BoxLeastSquares(t, y)\n    >>> results = model.autopower(0.16)\n    >>> results.period[np.argmax(results.power)]  # doctest: +FLOAT_CMP\n    2.000412388152837\n\n    Compute the periodogram on a user-specified period grid:\n\n    >>> periods = np.linspace(1.9, 2.1, 5)\n    >>> results = model.power(periods, 0.16)\n    >>> results.power  # doctest: +FLOAT_CMP\n    array([0.01723948, 0.0643028 , 0.1338783 , 0.09428816, 0.03577543])\n\n    If the inputs are AstroPy Quantities with units, the units will be\n    validated and the outputs will also be Quantities with appropriate units:\n\n    >>> from astropy import units as u\n    >>> t = t * u.day\n    >>> y = y * u.dimensionless_unscaled\n    >>> model = BoxLeastSquares(t, y)\n    >>> results = model.autopower(0.16 * u.day)\n    >>> results.period.unit\n    Unit(\"d\")\n    >>> results.power.unit\n    Unit(dimensionless)\n\n    References\n    ----------\n    .. [1] Kovacs, Zucker, & Mazeh (2002), A&A, 391, 369\n        (arXiv:astro-ph/0206099)\n    .. [2] Hartman & Bakos (2016), Astronomy & Computing, 17, 1\n        (arXiv:1605.06811)\n\n    ","endLoc":757,"id":8807,"nodeType":"Class","startLoc":26,"text":"class BoxLeastSquares(BasePeriodogram):\n    \"\"\"Compute the box least squares periodogram\n\n    This method is a commonly used tool for discovering transiting exoplanets\n    or eclipsing binaries in photometric time series datasets. This\n    implementation is based on the \"box least squares (BLS)\" method described\n    in [1]_ and [2]_.\n\n    Parameters\n    ----------\n    t : array-like, `~astropy.units.Quantity`, `~astropy.time.Time`, or `~astropy.time.TimeDelta`\n        Sequence of observation times.\n    y : array-like or `~astropy.units.Quantity`\n        Sequence of observations associated with times ``t``.\n    dy : float, array-like, or `~astropy.units.Quantity`, optional\n        Error or sequence of observational errors associated with times ``t``.\n\n    Examples\n    --------\n    Generate noisy data with a transit:\n\n    >>> rand = np.random.default_rng(42)\n    >>> t = rand.uniform(0, 10, 500)\n    >>> y = np.ones_like(t)\n    >>> y[np.abs((t + 1.0)%2.0-1)<0.08] = 1.0 - 0.1\n    >>> y += 0.01 * rand.standard_normal(len(t))\n\n    Compute the transit periodogram on a heuristically determined period grid\n    and find the period with maximum power:\n\n    >>> model = BoxLeastSquares(t, y)\n    >>> results = model.autopower(0.16)\n    >>> results.period[np.argmax(results.power)]  # doctest: +FLOAT_CMP\n    2.000412388152837\n\n    Compute the periodogram on a user-specified period grid:\n\n    >>> periods = np.linspace(1.9, 2.1, 5)\n    >>> results = model.power(periods, 0.16)\n    >>> results.power  # doctest: +FLOAT_CMP\n    array([0.01723948, 0.0643028 , 0.1338783 , 0.09428816, 0.03577543])\n\n    If the inputs are AstroPy Quantities with units, the units will be\n    validated and the outputs will also be Quantities with appropriate units:\n\n    >>> from astropy import units as u\n    >>> t = t * u.day\n    >>> y = y * u.dimensionless_unscaled\n    >>> model = BoxLeastSquares(t, y)\n    >>> results = model.autopower(0.16 * u.day)\n    >>> results.period.unit\n    Unit(\"d\")\n    >>> results.power.unit\n    Unit(dimensionless)\n\n    References\n    ----------\n    .. [1] Kovacs, Zucker, & Mazeh (2002), A&A, 391, 369\n        (arXiv:astro-ph/0206099)\n    .. [2] Hartman & Bakos (2016), Astronomy & Computing, 17, 1\n        (arXiv:1605.06811)\n\n    \"\"\"\n\n    def __init__(self, t, y, dy=None):\n\n        # If t is a TimeDelta, convert it to a quantity. The units we convert\n        # to don't really matter since the user gets a Quantity back at the end\n        # so can convert to any units they like.\n        if isinstance(t, TimeDelta):\n            t = t.to('day')\n\n        # We want to expose self.t as being the times the user passed in, but\n        # if the times are absolute, we need to convert them to relative times\n        # internally, so we use self._trel and self._tstart for this.\n\n        self.t = t\n\n        if isinstance(self.t, (Time, TimeDelta)):\n            self._tstart = self.t[0]\n            trel = (self.t - self._tstart).to(u.day)\n        else:\n            self._tstart = None\n            trel = self.t\n\n        self._trel, self.y, self.dy = self._validate_inputs(trel, y, dy)\n\n    def autoperiod(self, duration,\n                   minimum_period=None, maximum_period=None,\n                   minimum_n_transit=3, frequency_factor=1.0):\n        \"\"\"Determine a suitable grid of periods\n\n        This method uses a set of heuristics to select a conservative period\n        grid that is uniform in frequency. This grid might be too fine for\n        some user's needs depending on the precision requirements or the\n        sampling of the data. The grid can be made coarser by increasing\n        ``frequency_factor``.\n\n        Parameters\n        ----------\n        duration : float, array-like, or `~astropy.units.Quantity` ['time']\n            The set of durations that will be considered.\n        minimum_period, maximum_period : float or `~astropy.units.Quantity` ['time'], optional\n            The minimum/maximum periods to search. If not provided, these will\n            be computed as described in the notes below.\n        minimum_n_transits : int, optional\n            If ``maximum_period`` is not provided, this is used to compute the\n            maximum period to search by asserting that any systems with at\n            least ``minimum_n_transits`` will be within the range of searched\n            periods. Note that this is not the same as requiring that\n            ``minimum_n_transits`` be required for detection. The default\n            value is ``3``.\n        frequency_factor : float, optional\n            A factor to control the frequency spacing as described in the\n            notes below. The default value is ``1.0``.\n\n        Returns\n        -------\n        period : array-like or `~astropy.units.Quantity` ['time']\n            The set of periods computed using these heuristics with the same\n            units as ``t``.\n\n        Notes\n        -----\n        The default minimum period is chosen to be twice the maximum duration\n        because there won't be much sensitivity to periods shorter than that.\n\n        The default maximum period is computed as\n\n        .. code-block:: python\n\n            maximum_period = (max(t) - min(t)) / minimum_n_transits\n\n        ensuring that any systems with at least ``minimum_n_transits`` are\n        within the range of searched periods.\n\n        The frequency spacing is given by\n\n        .. code-block:: python\n\n            df = frequency_factor * min(duration) / (max(t) - min(t))**2\n\n        so the grid can be made finer by decreasing ``frequency_factor`` or\n        coarser by increasing ``frequency_factor``.\n\n        \"\"\"\n\n        duration = self._validate_duration(duration)\n        baseline = strip_units(self._trel.max() - self._trel.min())\n        min_duration = strip_units(np.min(duration))\n\n        # Estimate the required frequency spacing\n        # Because of the sparsity of a transit, this must be much finer than\n        # the frequency resolution for a sinusoidal fit. For a sinusoidal fit,\n        # df would be 1/baseline (see LombScargle), but here this should be\n        # scaled proportionally to the duration in units of baseline.\n        df = frequency_factor * min_duration / baseline**2\n\n        # If a minimum period is not provided, choose one that is twice the\n        # maximum duration because we won't be sensitive to any periods\n        # shorter than that.\n        if minimum_period is None:\n            minimum_period = 2.0 * strip_units(np.max(duration))\n        else:\n            minimum_period = validate_unit_consistency(self._trel, minimum_period)\n            minimum_period = strip_units(minimum_period)\n\n        # If no maximum period is provided, choose one by requiring that\n        # all signals with at least minimum_n_transit should be detectable.\n        if maximum_period is None:\n            if minimum_n_transit <= 1:\n                raise ValueError(\"minimum_n_transit must be greater than 1\")\n            maximum_period = baseline / (minimum_n_transit-1)\n        else:\n            maximum_period = validate_unit_consistency(self._trel, maximum_period)\n            maximum_period = strip_units(maximum_period)\n\n        if maximum_period < minimum_period:\n            minimum_period, maximum_period = maximum_period, minimum_period\n        if minimum_period <= 0.0:\n            raise ValueError(\"minimum_period must be positive\")\n\n        # Convert bounds to frequency\n        minimum_frequency = 1.0/strip_units(maximum_period)\n        maximum_frequency = 1.0/strip_units(minimum_period)\n\n        # Compute the number of frequencies and the frequency grid\n        nf = 1 + int(np.round((maximum_frequency - minimum_frequency)/df))\n        return 1.0/(maximum_frequency-df*np.arange(nf)) * self._t_unit()\n\n    def autopower(self, duration, objective=None, method=None, oversample=10,\n                  minimum_n_transit=3, minimum_period=None,\n                  maximum_period=None, frequency_factor=1.0):\n        \"\"\"Compute the periodogram at set of heuristically determined periods\n\n        This method calls :func:`BoxLeastSquares.autoperiod` to determine\n        the period grid and then :func:`BoxLeastSquares.power` to compute\n        the periodogram. See those methods for documentation of the arguments.\n\n        \"\"\"\n        period = self.autoperiod(duration,\n                                 minimum_n_transit=minimum_n_transit,\n                                 minimum_period=minimum_period,\n                                 maximum_period=maximum_period,\n                                 frequency_factor=frequency_factor)\n        return self.power(period, duration, objective=objective, method=method,\n                          oversample=oversample)\n\n    def power(self, period, duration, objective=None, method=None,\n              oversample=10):\n        \"\"\"Compute the periodogram for a set of periods\n\n        Parameters\n        ----------\n        period : array-like or `~astropy.units.Quantity` ['time']\n            The periods where the power should be computed\n        duration : float, array-like, or `~astropy.units.Quantity` ['time']\n            The set of durations to test\n        objective : {'likelihood', 'snr'}, optional\n            The scalar that should be optimized to find the best fit phase,\n            duration, and depth. This can be either ``'likelihood'`` (default)\n            to optimize the log-likelihood of the model, or ``'snr'`` to\n            optimize the signal-to-noise with which the transit depth is\n            measured.\n        method : {'fast', 'slow'}, optional\n            The computational method used to compute the periodogram. This is\n            mainly included for the purposes of testing and most users will\n            want to use the optimized ``'fast'`` method (default) that is\n            implemented in Cython.  ``'slow'`` is a brute-force method that is\n            used to test the results of the ``'fast'`` method.\n        oversample : int, optional\n            The number of bins per duration that should be used. This sets the\n            time resolution of the phase fit with larger values of\n            ``oversample`` yielding a finer grid and higher computational cost.\n\n        Returns\n        -------\n        results : BoxLeastSquaresResults\n            The periodogram results as a :class:`BoxLeastSquaresResults`\n            object.\n\n        Raises\n        ------\n        ValueError\n            If ``oversample`` is not an integer greater than 0 or if\n            ``objective`` or ``method`` are not valid.\n\n        \"\"\"\n        period, duration = self._validate_period_and_duration(period, duration)\n\n        # Check for absurdities in the ``oversample`` choice\n        try:\n            oversample = int(oversample)\n        except TypeError:\n            raise ValueError(f\"oversample must be an int, got {oversample}\")\n        if oversample < 1:\n            raise ValueError(\"oversample must be greater than or equal to 1\")\n\n        # Select the periodogram objective\n        if objective is None:\n            objective = \"likelihood\"\n        allowed_objectives = [\"snr\", \"likelihood\"]\n        if objective not in allowed_objectives:\n            raise ValueError((\"Unrecognized method '{0}'\\n\"\n                              \"allowed methods are: {1}\")\n                             .format(objective, allowed_objectives))\n        use_likelihood = (objective == \"likelihood\")\n\n        # Select the computational method\n        if method is None:\n            method = \"fast\"\n        allowed_methods = [\"fast\", \"slow\"]\n        if method not in allowed_methods:\n            raise ValueError((\"Unrecognized method '{0}'\\n\"\n                              \"allowed methods are: {1}\")\n                             .format(method, allowed_methods))\n\n        # Format and check the input arrays\n        t = np.ascontiguousarray(strip_units(self._trel), dtype=np.float64)\n        t_ref = np.min(t)\n        y = np.ascontiguousarray(strip_units(self.y), dtype=np.float64)\n        if self.dy is None:\n            ivar = np.ones_like(y)\n        else:\n            ivar = 1.0 / np.ascontiguousarray(strip_units(self.dy),\n                                              dtype=np.float64)**2\n\n        # Make sure that the period and duration arrays are C-order\n        period_fmt = np.ascontiguousarray(strip_units(period),\n                                          dtype=np.float64)\n        duration = np.ascontiguousarray(strip_units(duration),\n                                        dtype=np.float64)\n\n        # Select the correct implementation for the chosen method\n        if method == \"fast\":\n            bls = methods.bls_fast\n        else:\n            bls = methods.bls_slow\n\n        # Run the implementation\n        results = bls(\n            t - t_ref, y - np.median(y), ivar, period_fmt, duration,\n            oversample, use_likelihood)\n\n        return self._format_results(t_ref, objective, period, results)\n\n    def _as_relative_time(self, name, times):\n        \"\"\"\n        Convert the provided times (if absolute) to relative times using the\n        current _tstart value. If the times provided are relative, they are\n        returned without conversion (though we still do some checks).\n        \"\"\"\n\n        if isinstance(times, TimeDelta):\n            times = times.to('day')\n\n        if self._tstart is None:\n            if isinstance(times, Time):\n                raise TypeError('{} was provided as an absolute time but '\n                                'the BoxLeastSquares class was initialized '\n                                'with relative times.'.format(name))\n        else:\n            if isinstance(times, Time):\n                times = (times - self._tstart).to(u.day)\n            else:\n                raise TypeError('{} was provided as a relative time but '\n                                'the BoxLeastSquares class was initialized '\n                                'with absolute times.'.format(name))\n\n        times = validate_unit_consistency(self._trel, times)\n\n        return times\n\n    def _as_absolute_time_if_needed(self, name, times):\n        \"\"\"\n        Convert the provided times to absolute times using the current _tstart\n        value, if needed.\n        \"\"\"\n        if self._tstart is not None:\n            # Some time formats/scales can't represent dates/times too far\n            # off from the present, so we need to mask values offset by\n            # more than 100,000 yr (the periodogram algorithm can return\n            # transit times of e.g 1e300 for some periods).\n            reset = np.abs(times.to_value(u.year)) > 100000\n            times[reset] = 0\n            times = self._tstart + times\n            times[reset] = np.nan\n        return times\n\n    def model(self, t_model, period, duration, transit_time):\n        \"\"\"Compute the transit model at the given period, duration, and phase\n\n        Parameters\n        ----------\n        t_model : array-like, `~astropy.units.Quantity`, or `~astropy.time.Time`\n            Times at which to compute the model.\n        period : float or `~astropy.units.Quantity` ['time']\n            The period of the transits.\n        duration : float or `~astropy.units.Quantity` ['time']\n            The duration of the transit.\n        transit_time : float or `~astropy.units.Quantity` or `~astropy.time.Time`\n            The mid-transit time of a reference transit.\n\n        Returns\n        -------\n        y_model : array-like or `~astropy.units.Quantity`\n            The model evaluated at the times ``t_model`` with units of ``y``.\n\n        \"\"\"\n\n        period, duration = self._validate_period_and_duration(period, duration)\n\n        transit_time = self._as_relative_time('transit_time', transit_time)\n        t_model = strip_units(self._as_relative_time('t_model', t_model))\n\n        period = float(strip_units(period))\n        duration = float(strip_units(duration))\n        transit_time = float(strip_units(transit_time))\n\n        t = np.ascontiguousarray(strip_units(self._trel), dtype=np.float64)\n        y = np.ascontiguousarray(strip_units(self.y), dtype=np.float64)\n        if self.dy is None:\n            ivar = np.ones_like(y)\n        else:\n            ivar = 1.0 / np.ascontiguousarray(strip_units(self.dy),\n                                              dtype=np.float64)**2\n\n        # Compute the depth\n        hp = 0.5*period\n        m_in = np.abs((t-transit_time+hp) % period - hp) < 0.5*duration\n        m_out = ~m_in\n        y_in = np.sum(y[m_in] * ivar[m_in]) / np.sum(ivar[m_in])\n        y_out = np.sum(y[m_out] * ivar[m_out]) / np.sum(ivar[m_out])\n\n        # Evaluate the model\n        y_model = y_out + np.zeros_like(t_model)\n        m_model = np.abs((t_model-transit_time+hp) % period-hp) < 0.5*duration\n        y_model[m_model] = y_in\n\n        return y_model * self._y_unit()\n\n    def compute_stats(self, period, duration, transit_time):\n        \"\"\"Compute descriptive statistics for a given transit model\n\n        These statistics are commonly used for vetting of transit candidates.\n\n        Parameters\n        ----------\n        period : float or `~astropy.units.Quantity` ['time']\n            The period of the transits.\n        duration : float or `~astropy.units.Quantity` ['time']\n            The duration of the transit.\n        transit_time : float or `~astropy.units.Quantity` or `~astropy.time.Time`\n            The mid-transit time of a reference transit.\n\n        Returns\n        -------\n        stats : dict\n            A dictionary containing several descriptive statistics:\n\n            - ``depth``: The depth and uncertainty (as a tuple with two\n                values) on the depth for the fiducial model.\n            - ``depth_odd``: The depth and uncertainty on the depth for a\n                model where the period is twice the fiducial period.\n            - ``depth_even``: The depth and uncertainty on the depth for a\n                model where the period is twice the fiducial period and the\n                phase is offset by one orbital period.\n            - ``depth_half``: The depth and uncertainty for a model with a\n                period of half the fiducial period.\n            - ``depth_phased``: The depth and uncertainty for a model with the\n                fiducial period and the phase offset by half a period.\n            - ``harmonic_amplitude``: The amplitude of the best fit sinusoidal\n                model.\n            - ``harmonic_delta_log_likelihood``: The difference in log\n                likelihood between a sinusoidal model and the transit model.\n                If ``harmonic_delta_log_likelihood`` is greater than zero, the\n                sinusoidal model is preferred.\n            - ``transit_times``: The mid-transit time for each transit in the\n                baseline.\n            - ``per_transit_count``: An array with a count of the number of\n                data points in each unique transit included in the baseline.\n            - ``per_transit_log_likelihood``: An array with the value of the\n                log likelihood for each unique transit included in the\n                baseline.\n\n        \"\"\"\n\n        period, duration = self._validate_period_and_duration(period, duration)\n        transit_time = self._as_relative_time('transit_time', transit_time)\n\n        period = float(strip_units(period))\n        duration = float(strip_units(duration))\n        transit_time = float(strip_units(transit_time))\n\n        t = np.ascontiguousarray(strip_units(self._trel), dtype=np.float64)\n        y = np.ascontiguousarray(strip_units(self.y), dtype=np.float64)\n        if self.dy is None:\n            ivar = np.ones_like(y)\n        else:\n            ivar = 1.0 / np.ascontiguousarray(strip_units(self.dy),\n                                              dtype=np.float64)**2\n\n        # This a helper function that will compute the depth for several\n        # different hypothesized transit models with different parameters\n        def _compute_depth(m, y_out=None, var_out=None):\n            if np.any(m) and (var_out is None or np.isfinite(var_out)):\n                var_m = 1.0 / np.sum(ivar[m])\n                y_m = np.sum(y[m] * ivar[m]) * var_m\n                if y_out is None:\n                    return y_m, var_m\n                return y_out - y_m, np.sqrt(var_m + var_out)\n            return 0.0, np.inf\n\n        # Compute the depth of the fiducial model and the two models at twice\n        # the period\n        hp = 0.5*period\n        m_in = np.abs((t-transit_time+hp) % period - hp) < 0.5*duration\n        m_out = ~m_in\n        m_odd = np.abs((t-transit_time) % (2*period) - period) \\\n            < 0.5*duration\n        m_even = np.abs((t-transit_time+period) % (2*period) - period) \\\n            < 0.5*duration\n\n        y_out, var_out = _compute_depth(m_out)\n        depth = _compute_depth(m_in, y_out, var_out)\n        depth_odd = _compute_depth(m_odd, y_out, var_out)\n        depth_even = _compute_depth(m_even, y_out, var_out)\n        y_in = y_out - depth[0]\n\n        # Compute the depth of the model at a phase of 0.5*period\n        m_phase = np.abs((t-transit_time) % period - hp) < 0.5*duration\n        depth_phase = _compute_depth(m_phase,\n                                     *_compute_depth((~m_phase) & m_out))\n\n        # Compute the depth of a model with a period of 0.5*period\n        m_half = np.abs((t-transit_time+0.25*period) % (0.5*period)\n                        - 0.25*period) < 0.5*duration\n        depth_half = _compute_depth(m_half, *_compute_depth(~m_half))\n\n        # Compute the number of points in each transit\n        transit_id = np.round((t[m_in]-transit_time) / period).astype(int)\n        transit_times = period * np.arange(transit_id.min(),\n                                           transit_id.max()+1) + transit_time\n        unique_ids, unique_counts = np.unique(transit_id,\n                                              return_counts=True)\n        unique_ids -= np.min(transit_id)\n        transit_id -= np.min(transit_id)\n        counts = np.zeros(np.max(transit_id) + 1, dtype=int)\n        counts[unique_ids] = unique_counts\n\n        # Compute the per-transit log likelihood\n        ll = -0.5 * ivar[m_in] * ((y[m_in] - y_in)**2 - (y[m_in] - y_out)**2)\n        lls = np.zeros(len(counts))\n        for i in unique_ids:\n            lls[i] = np.sum(ll[transit_id == i])\n        full_ll = -0.5*np.sum(ivar[m_in] * (y[m_in] - y_in)**2)\n        full_ll -= 0.5*np.sum(ivar[m_out] * (y[m_out] - y_out)**2)\n\n        # Compute the log likelihood of a sine model\n        A = np.vstack((\n            np.sin(2*np.pi*t/period), np.cos(2*np.pi*t/period),\n            np.ones_like(t)\n        )).T\n        w = np.linalg.solve(np.dot(A.T, A * ivar[:, None]),\n                            np.dot(A.T, y * ivar))\n        mod = np.dot(A, w)\n        sin_ll = -0.5*np.sum((y-mod)**2*ivar)\n\n        # Format the results\n        y_unit = self._y_unit()\n        ll_unit = 1\n        if self.dy is None:\n            ll_unit = y_unit * y_unit\n        return dict(\n            transit_times=self._as_absolute_time_if_needed('transit_times', transit_times * self._t_unit()),\n            per_transit_count=counts,\n            per_transit_log_likelihood=lls * ll_unit,\n            depth=(depth[0] * y_unit, depth[1] * y_unit),\n            depth_phased=(depth_phase[0] * y_unit, depth_phase[1] * y_unit),\n            depth_half=(depth_half[0] * y_unit, depth_half[1] * y_unit),\n            depth_odd=(depth_odd[0] * y_unit, depth_odd[1] * y_unit),\n            depth_even=(depth_even[0] * y_unit, depth_even[1] * y_unit),\n            harmonic_amplitude=np.sqrt(np.sum(w[:2]**2)) * y_unit,\n            harmonic_delta_log_likelihood=(sin_ll - full_ll) * ll_unit,\n        )\n\n    def transit_mask(self, t, period, duration, transit_time):\n        \"\"\"Compute which data points are in transit for a given parameter set\n\n        Parameters\n        ----------\n        t_model : array-like or `~astropy.units.Quantity` ['time']\n            Times where the mask should be evaluated.\n        period : float or `~astropy.units.Quantity` ['time']\n            The period of the transits.\n        duration : float or `~astropy.units.Quantity` ['time']\n            The duration of the transit.\n        transit_time : float or `~astropy.units.Quantity` or `~astropy.time.Time`\n            The mid-transit time of a reference transit.\n\n        Returns\n        -------\n        transit_mask : array-like\n            A boolean array where ``True`` indicates and in transit point and\n            ``False`` indicates and out-of-transit point.\n\n        \"\"\"\n\n        period, duration = self._validate_period_and_duration(period, duration)\n        transit_time = self._as_relative_time('transit_time', transit_time)\n        t = strip_units(self._as_relative_time('t', t))\n\n        period = float(strip_units(period))\n        duration = float(strip_units(duration))\n        transit_time = float(strip_units(transit_time))\n\n        hp = 0.5*period\n        return np.abs((t-transit_time+hp) % period - hp) < 0.5*duration\n\n    def _validate_inputs(self, t, y, dy):\n        \"\"\"Private method used to check the consistency of the inputs\n\n        Parameters\n        ----------\n        t : array-like, `~astropy.units.Quantity`, `~astropy.time.Time`, or `~astropy.time.TimeDelta`\n            Sequence of observation times.\n        y : array-like or `~astropy.units.Quantity`\n            Sequence of observations associated with times t.\n        dy : float, array-like, or `~astropy.units.Quantity`\n            Error or sequence of observational errors associated with times t.\n\n        Returns\n        -------\n        t, y, dy : array-like, `~astropy.units.Quantity`, or `~astropy.time.Time`\n            The inputs with consistent shapes and units.\n\n        Raises\n        ------\n        ValueError\n            If the dimensions are incompatible or if the units of dy cannot be\n            converted to the units of y.\n\n        \"\"\"\n\n        # Validate shapes of inputs\n        if dy is None:\n            t, y = np.broadcast_arrays(t, y, subok=True)\n        else:\n            t, y, dy = np.broadcast_arrays(t, y, dy, subok=True)\n        if t.ndim != 1:\n            raise ValueError(\"Inputs (t, y, dy) must be 1-dimensional\")\n\n        # validate units of inputs if any is a Quantity\n        if dy is not None:\n            dy = validate_unit_consistency(y, dy)\n\n        return t, y, dy\n\n    def _validate_duration(self, duration):\n        \"\"\"Private method used to check a set of test durations\n\n        Parameters\n        ----------\n        duration : float, array-like, or `~astropy.units.Quantity`\n            The set of durations that will be considered.\n\n        Returns\n        -------\n        duration : array-like or `~astropy.units.Quantity`\n            The input reformatted with the correct shape and units.\n\n        Raises\n        ------\n        ValueError\n            If the units of duration cannot be converted to the units of t.\n\n        \"\"\"\n        duration = np.atleast_1d(np.abs(duration))\n        if duration.ndim != 1 or duration.size == 0:\n            raise ValueError(\"duration must be 1-dimensional\")\n        return validate_unit_consistency(self._trel, duration)\n\n    def _validate_period_and_duration(self, period, duration):\n        \"\"\"Private method used to check a set of periods and durations\n\n        Parameters\n        ----------\n        period : float, array-like, or `~astropy.units.Quantity` ['time']\n            The set of test periods.\n        duration : float, array-like, or `~astropy.units.Quantity` ['time']\n            The set of durations that will be considered.\n\n        Returns\n        -------\n        period, duration : array-like or `~astropy.units.Quantity` ['time']\n            The inputs reformatted with the correct shapes and units.\n\n        Raises\n        ------\n        ValueError\n            If the units of period or duration cannot be converted to the\n            units of t.\n\n        \"\"\"\n        duration = self._validate_duration(duration)\n        period = np.atleast_1d(np.abs(period))\n        if period.ndim != 1 or period.size == 0:\n            raise ValueError(\"period must be 1-dimensional\")\n        period = validate_unit_consistency(self._trel, period)\n\n        if not np.min(period) > np.max(duration):\n            raise ValueError(\"The maximum transit duration must be shorter \"\n                             \"than the minimum period\")\n\n        return period, duration\n\n    def _format_results(self, t_ref, objective, period, results):\n        \"\"\"A private method used to wrap and add units to the periodogram\n\n        Parameters\n        ----------\n        t_ref : float\n            The minimum time in the time series (a reference time).\n        objective : str\n            The name of the objective used in the optimization.\n        period : array-like or `~astropy.units.Quantity` ['time']\n            The set of trial periods.\n        results : tuple\n            The output of one of the periodogram implementations.\n\n        \"\"\"\n        (power, depth, depth_err, duration, transit_time, depth_snr,\n         log_likelihood) = results\n        transit_time += t_ref\n\n        if has_units(self._trel):\n            transit_time = units.Quantity(transit_time, unit=self._trel.unit)\n            transit_time = self._as_absolute_time_if_needed('transit_time', transit_time)\n            duration = units.Quantity(duration, unit=self._trel.unit)\n\n        if has_units(self.y):\n            depth = units.Quantity(depth, unit=self.y.unit)\n            depth_err = units.Quantity(depth_err, unit=self.y.unit)\n\n            depth_snr = units.Quantity(depth_snr, unit=units.one)\n\n            if self.dy is None:\n                if objective == \"likelihood\":\n                    power = units.Quantity(power, unit=self.y.unit**2)\n                else:\n                    power = units.Quantity(power, unit=units.one)\n                log_likelihood = units.Quantity(log_likelihood,\n                                                unit=self.y.unit**2)\n            else:\n                power = units.Quantity(power, unit=units.one)\n                log_likelihood = units.Quantity(log_likelihood, unit=units.one)\n\n        return BoxLeastSquaresResults(\n            objective, period, power, depth, depth_err, duration, transit_time,\n            depth_snr, log_likelihood)\n\n    def _t_unit(self):\n        if has_units(self._trel):\n            return self._trel.unit\n        else:\n            return 1\n\n    def _y_unit(self):\n        if has_units(self.y):\n            return self.y.unit\n        else:\n            return 1"},{"col":0,"comment":" Computes the ``p``-th trigonometric circular moment for an array\n    of circular data.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    p : float, optional\n        Order of the circular moment.\n    centered : bool, optional\n        If ``True``, central circular moments are computed. Default value is\n        ``False``.\n    axis : int, optional\n        Axis along which circular moments are computed. The default is to\n        compute the circular moment of the flattened array.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``sum(weights, axis)``\n        equals the number of observations. See [1]_, remark 1.4, page 22,\n        for detailed explanation.\n\n    Returns\n    -------\n    circmoment : ndarray or `~astropy.units.Quantity`\n        The first and second elements correspond to the direction and length of\n        the ``p``-th circular moment, respectively.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import circmoment\n    >>> from astropy import units as u\n    >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg\n    >>> circmoment(data, p=2) # doctest: +FLOAT_CMP\n    (<Quantity 90.99263082432564 deg>, <Quantity 0.48004283892950717>)\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    ","endLoc":283,"header":"def circmoment(data, p=1.0, centered=False, axis=None, weights=None)","id":8808,"name":"circmoment","nodeType":"Function","startLoc":231,"text":"def circmoment(data, p=1.0, centered=False, axis=None, weights=None):\n    \"\"\" Computes the ``p``-th trigonometric circular moment for an array\n    of circular data.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    p : float, optional\n        Order of the circular moment.\n    centered : bool, optional\n        If ``True``, central circular moments are computed. Default value is\n        ``False``.\n    axis : int, optional\n        Axis along which circular moments are computed. The default is to\n        compute the circular moment of the flattened array.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``sum(weights, axis)``\n        equals the number of observations. See [1]_, remark 1.4, page 22,\n        for detailed explanation.\n\n    Returns\n    -------\n    circmoment : ndarray or `~astropy.units.Quantity`\n        The first and second elements correspond to the direction and length of\n        the ``p``-th circular moment, respectively.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import circmoment\n    >>> from astropy import units as u\n    >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg\n    >>> circmoment(data, p=2) # doctest: +FLOAT_CMP\n    (<Quantity 90.99263082432564 deg>, <Quantity 0.48004283892950717>)\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    \"\"\"\n    if centered:\n        phi = circmean(data, axis, weights)\n    else:\n        phi = 0.0\n\n    return _angle(data, p, phi, axis, weights), _length(data, p, phi, axis,\n                                                        weights)"},{"col":0,"comment":" Computes the circular correlation coefficient between two array of\n    circular data.\n\n    Parameters\n    ----------\n    alpha : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    beta : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    axis : int, optional\n        Axis along which circular correlation coefficients are computed.\n        The default is the compute the circular correlation coefficient of the\n        flattened array.\n    weights_alpha : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights_alpha``\n        represents a weighting factor for each group such that\n        ``sum(weights_alpha, axis)`` equals the number of observations.\n        See [1]_, remark 1.4, page 22, for detailed explanation.\n    weights_beta : numpy.ndarray, optional\n        See description of ``weights_alpha``.\n\n    Returns\n    -------\n    rho : ndarray or `~astropy.units.Quantity` ['dimensionless']\n        Circular correlation coefficient.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import circcorrcoef\n    >>> from astropy import units as u\n    >>> alpha = np.array([356, 97, 211, 232, 343, 292, 157, 302, 335, 302,\n    ...                   324, 85, 324, 340, 157, 238, 254, 146, 232, 122,\n    ...                   329])*u.deg\n    >>> beta = np.array([119, 162, 221, 259, 270, 29, 97, 292, 40, 313, 94,\n    ...                  45, 47, 108, 221, 270, 119, 248, 270, 45, 23])*u.deg\n    >>> circcorrcoef(alpha, beta) # doctest: +FLOAT_CMP\n    <Quantity 0.2704648826748831>\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    ","endLoc":347,"header":"def circcorrcoef(alpha, beta, axis=None, weights_alpha=None,\n                 weights_beta=None)","id":8809,"name":"circcorrcoef","nodeType":"Function","startLoc":286,"text":"def circcorrcoef(alpha, beta, axis=None, weights_alpha=None,\n                 weights_beta=None):\n    \"\"\" Computes the circular correlation coefficient between two array of\n    circular data.\n\n    Parameters\n    ----------\n    alpha : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    beta : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    axis : int, optional\n        Axis along which circular correlation coefficients are computed.\n        The default is the compute the circular correlation coefficient of the\n        flattened array.\n    weights_alpha : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights_alpha``\n        represents a weighting factor for each group such that\n        ``sum(weights_alpha, axis)`` equals the number of observations.\n        See [1]_, remark 1.4, page 22, for detailed explanation.\n    weights_beta : numpy.ndarray, optional\n        See description of ``weights_alpha``.\n\n    Returns\n    -------\n    rho : ndarray or `~astropy.units.Quantity` ['dimensionless']\n        Circular correlation coefficient.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import circcorrcoef\n    >>> from astropy import units as u\n    >>> alpha = np.array([356, 97, 211, 232, 343, 292, 157, 302, 335, 302,\n    ...                   324, 85, 324, 340, 157, 238, 254, 146, 232, 122,\n    ...                   329])*u.deg\n    >>> beta = np.array([119, 162, 221, 259, 270, 29, 97, 292, 40, 313, 94,\n    ...                  45, 47, 108, 221, 270, 119, 248, 270, 45, 23])*u.deg\n    >>> circcorrcoef(alpha, beta) # doctest: +FLOAT_CMP\n    <Quantity 0.2704648826748831>\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    \"\"\"\n    if(np.size(alpha, axis) != np.size(beta, axis)):\n        raise ValueError(\"alpha and beta must be arrays of the same size\")\n\n    mu_a = circmean(alpha, axis, weights_alpha)\n    mu_b = circmean(beta, axis, weights_beta)\n\n    sin_a = np.sin(alpha - mu_a)\n    sin_b = np.sin(beta - mu_b)\n    rho = np.sum(sin_a*sin_b)/np.sqrt(np.sum(sin_a*sin_a)*np.sum(sin_b*sin_b))\n\n    return rho"},{"attributeType":"null","col":8,"comment":"null","endLoc":474,"id":8810,"name":"dt","nodeType":"Attribute","startLoc":474,"text":"self.dt"},{"col":0,"comment":" Performs the Rayleigh test of uniformity.\n\n    This test is  used to identify a non-uniform distribution, i.e. it is\n    designed for detecting an unimodal deviation from uniformity. More\n    precisely, it assumes the following hypotheses:\n    - H0 (null hypothesis): The population is distributed uniformly around the\n    circle.\n    - H1 (alternative hypothesis): The population is not distributed uniformly\n    around the circle.\n    Small p-values suggest to reject the null hypothesis.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    axis : int, optional\n        Axis along which the Rayleigh test will be performed.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``np.sum(weights, axis)``\n        equals the number of observations.\n        See [1]_, remark 1.4, page 22, for detailed explanation.\n\n    Returns\n    -------\n    p-value : float or `~astropy.units.Quantity` ['dimensionless']\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import rayleightest\n    >>> from astropy import units as u\n    >>> data = np.array([130, 90, 0, 145])*u.deg\n    >>> rayleightest(data) # doctest: +FLOAT_CMP\n    <Quantity 0.2563487733797317>\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    .. [3] M. Chirstman., C. Miller. \"Testing a Sample of Directions for\n       Uniformity.\" Lecture Notes, STA 6934/5805. University of Florida, 2007.\n    .. [4] D. Wilkie. \"Rayleigh Test for Randomness of Circular Data\". Applied\n       Statistics. 1983.\n       <http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.211.4762>\n    ","endLoc":413,"header":"def rayleightest(data, axis=None, weights=None)","id":8811,"name":"rayleightest","nodeType":"Function","startLoc":350,"text":"def rayleightest(data, axis=None, weights=None):\n    \"\"\" Performs the Rayleigh test of uniformity.\n\n    This test is  used to identify a non-uniform distribution, i.e. it is\n    designed for detecting an unimodal deviation from uniformity. More\n    precisely, it assumes the following hypotheses:\n    - H0 (null hypothesis): The population is distributed uniformly around the\n    circle.\n    - H1 (alternative hypothesis): The population is not distributed uniformly\n    around the circle.\n    Small p-values suggest to reject the null hypothesis.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    axis : int, optional\n        Axis along which the Rayleigh test will be performed.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``np.sum(weights, axis)``\n        equals the number of observations.\n        See [1]_, remark 1.4, page 22, for detailed explanation.\n\n    Returns\n    -------\n    p-value : float or `~astropy.units.Quantity` ['dimensionless']\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import rayleightest\n    >>> from astropy import units as u\n    >>> data = np.array([130, 90, 0, 145])*u.deg\n    >>> rayleightest(data) # doctest: +FLOAT_CMP\n    <Quantity 0.2563487733797317>\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    .. [3] M. Chirstman., C. Miller. \"Testing a Sample of Directions for\n       Uniformity.\" Lecture Notes, STA 6934/5805. University of Florida, 2007.\n    .. [4] D. Wilkie. \"Rayleigh Test for Randomness of Circular Data\". Applied\n       Statistics. 1983.\n       <http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.211.4762>\n    \"\"\"\n    n = np.size(data, axis=axis)\n    Rbar = _length(data, 1, 0.0, axis, weights)\n    z = n*Rbar*Rbar\n\n    # see [3] and [4] for the formulae below\n    tmp = 1.0\n    if(n < 50):\n        tmp = 1.0 + (2.0*z - z*z)/(4.0*n) - (24.0*z - 132.0*z**2.0 +\n                                             76.0*z**3.0 - 9.0*z**4.0)/(288.0 *\n                                                                        n * n)\n\n    p_value = np.exp(-z)*tmp\n    return p_value"},{"className":"PointMeasures","col":0,"comment":"Bayesian blocks fitness for point measures\n\n    Parameters\n    ----------\n    p0 : float, optional\n        False alarm probability, used to compute the prior on :math:`N_{\\rm\n        blocks}` (see eq. 21 of Scargle 2013). If gamma is specified, p0 is\n        ignored.\n    ncp_prior : float, optional\n        If specified, use the value of ``ncp_prior`` to compute the prior as\n        above, using the definition :math:`{\\tt ncp\\_prior} = -\\ln({\\tt\n        gamma})`.  If ``ncp_prior`` is specified, ``gamma`` and ``p0`` are\n        ignored.\n    ","endLoc":525,"id":8812,"nodeType":"Class","startLoc":500,"text":"class PointMeasures(FitnessFunc):\n    r\"\"\"Bayesian blocks fitness for point measures\n\n    Parameters\n    ----------\n    p0 : float, optional\n        False alarm probability, used to compute the prior on :math:`N_{\\rm\n        blocks}` (see eq. 21 of Scargle 2013). If gamma is specified, p0 is\n        ignored.\n    ncp_prior : float, optional\n        If specified, use the value of ``ncp_prior`` to compute the prior as\n        above, using the definition :math:`{\\tt ncp\\_prior} = -\\ln({\\tt\n        gamma})`.  If ``ncp_prior`` is specified, ``gamma`` and ``p0`` are\n        ignored.\n    \"\"\"\n    def __init__(self, p0=0.05, gamma=None, ncp_prior=None):\n        super().__init__(p0, gamma, ncp_prior)\n\n    def fitness(self, a_k, b_k):\n        # eq. 41 from Scargle 2013\n        return (b_k * b_k) / (4 * a_k)\n\n    def validate_input(self, t, x, sigma):\n        if x is None:\n            raise ValueError(\"x must be specified for point measures\")\n        return super().validate_input(t, x, sigma)"},{"col":4,"comment":"null","endLoc":516,"header":"def __init__(self, p0=0.05, gamma=None, ncp_prior=None)","id":8813,"name":"__init__","nodeType":"Function","startLoc":515,"text":"def __init__(self, p0=0.05, gamma=None, ncp_prior=None):\n        super().__init__(p0, gamma, ncp_prior)"},{"col":4,"comment":"Convert times to strings, using signed 5 digit if necessary.","endLoc":1717,"header":"@property\n    def value(self)","id":8814,"name":"value","nodeType":"Function","startLoc":1708,"text":"@property\n    def value(self):\n        \"\"\"Convert times to strings, using signed 5 digit if necessary.\"\"\"\n        if 'long' not in self.out_subfmt:\n            # If we have times before year 0 or after year 9999, we can\n            # output only in a \"long\" format, using signed 5-digit years.\n            jd = self.jd1 + self.jd2\n            if jd.size and (jd.min() < 1721425.5 or jd.max() >= 5373484.5):\n                self.out_subfmt = 'long' + self.out_subfmt\n        return super().value"},{"col":4,"comment":"null","endLoc":520,"header":"def fitness(self, a_k, b_k)","id":8815,"name":"fitness","nodeType":"Function","startLoc":518,"text":"def fitness(self, a_k, b_k):\n        # eq. 41 from Scargle 2013\n        return (b_k * b_k) / (4 * a_k)"},{"col":4,"comment":"null","endLoc":525,"header":"def validate_input(self, t, x, sigma)","id":8816,"name":"validate_input","nodeType":"Function","startLoc":522,"text":"def validate_input(self, t, x, sigma):\n        if x is None:\n            raise ValueError(\"x must be specified for point measures\")\n        return super().validate_input(t, x, sigma)"},{"col":0,"comment":" Performs the Rayleigh test of uniformity where the alternative\n    hypothesis H1 is assumed to have a known mean angle ``mu``.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    mu : float or `~astropy.units.Quantity` ['angle'], optional\n        Mean angle. Assumed to be known.\n    axis : int, optional\n        Axis along which the V test will be performed.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``sum(weights, axis)``\n        equals the number of observations. See [1]_, remark 1.4, page 22,\n        for detailed explanation.\n\n    Returns\n    -------\n    p-value : float or `~astropy.units.Quantity` ['dimensionless']\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import vtest\n    >>> from astropy import units as u\n    >>> data = np.array([130, 90, 0, 145])*u.deg\n    >>> vtest(data) # doctest: +FLOAT_CMP\n    <Quantity 0.6223678199713766>\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    .. [3] M. Chirstman., C. Miller. \"Testing a Sample of Directions for\n       Uniformity.\" Lecture Notes, STA 6934/5805. University of Florida, 2007.\n    ","endLoc":475,"header":"def vtest(data, mu=0.0, axis=None, weights=None)","id":8817,"name":"vtest","nodeType":"Function","startLoc":416,"text":"def vtest(data, mu=0.0, axis=None, weights=None):\n    \"\"\" Performs the Rayleigh test of uniformity where the alternative\n    hypothesis H1 is assumed to have a known mean angle ``mu``.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    mu : float or `~astropy.units.Quantity` ['angle'], optional\n        Mean angle. Assumed to be known.\n    axis : int, optional\n        Axis along which the V test will be performed.\n    weights : numpy.ndarray, optional\n        In case of grouped data, the i-th element of ``weights`` represents a\n        weighting factor for each group such that ``sum(weights, axis)``\n        equals the number of observations. See [1]_, remark 1.4, page 22,\n        for detailed explanation.\n\n    Returns\n    -------\n    p-value : float or `~astropy.units.Quantity` ['dimensionless']\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import vtest\n    >>> from astropy import units as u\n    >>> data = np.array([130, 90, 0, 145])*u.deg\n    >>> vtest(data) # doctest: +FLOAT_CMP\n    <Quantity 0.6223678199713766>\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    .. [3] M. Chirstman., C. Miller. \"Testing a Sample of Directions for\n       Uniformity.\" Lecture Notes, STA 6934/5805. University of Florida, 2007.\n    \"\"\"\n    from scipy.stats import norm\n\n    if weights is None:\n        weights = np.ones((1,))\n    try:\n        weights = np.broadcast_to(weights, data.shape)\n    except ValueError:\n        raise ValueError('Weights and data have inconsistent shape.')\n\n    n = np.size(data, axis=axis)\n    R0bar = np.sum(weights * np.cos(data - mu), axis)/np.sum(weights, axis)\n    z = np.sqrt(2.0 * n) * R0bar\n    pz = norm.cdf(z)\n    fz = norm.pdf(z)\n    # see reference [3]\n    p_value = 1 - pz + fz*((3*z - z**3)/(16.0*n) +\n                           (15*z + 305*z**3 - 125*z**5 + 9*z**7)/(4608.0*n*n))\n    return p_value"},{"attributeType":"null","col":0,"comment":"null","endLoc":55,"id":8818,"name":"__all__","nodeType":"Attribute","startLoc":55,"text":"__all__"},{"col":0,"comment":"","endLoc":45,"header":"bayesian_blocks.py#<anonymous>","id":8819,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nBayesian Blocks for Time Series Analysis\n========================================\n\nDynamic programming algorithm for solving a piecewise-constant model for\nvarious datasets. This is based on the algorithm presented in Scargle\net al 2013 [1]_. This code was ported from the astroML project [2]_.\n\nApplications include:\n\n- finding an optimal histogram with adaptive bin widths\n- finding optimal segmentation of time series data\n- detecting inflection points in the rate of event data\n\nThe primary interface to these routines is the :func:`bayesian_blocks`\nfunction. This module provides fitness functions suitable for three types\nof data:\n\n- Irregularly-spaced event data via the :class:`Events` class\n- Regularly-spaced event data via the :class:`RegularEvents` class\n- Irregularly-spaced point measurements via the :class:`PointMeasures` class\n\nFor more fine-tuned control over the fitness functions used, it is possible\nto define custom :class:`FitnessFunc` classes directly and use them with\nthe :func:`bayesian_blocks` routine.\n\nOne common application of the Bayesian Blocks algorithm is the determination\nof optimal adaptive-width histogram bins. This uses the same fitness function\nas for irregularly-spaced time series events. The easiest interface for\ncreating Bayesian Blocks histograms is the :func:`astropy.stats.histogram`\nfunction.\n\nReferences\n----------\n.. [1] https://ui.adsabs.harvard.edu/abs/2013ApJ...764..167S\n.. [2] https://www.astroml.org/ https://github.com//astroML/astroML/\n.. [3] Bellman, R.E., Dreyfus, S.E., 1962. Applied Dynamic\n   Programming. Princeton University Press, Princeton.\n   https://press.princeton.edu/books/hardcover/9780691651873/applied-dynamic-programming\n.. [4] Bellman, R., Roth, R., 1969. Curve fitting by segmented\n   straight lines. J. Amer. Statist. Assoc. 64, 1079–1084.\n   https://www.tandfonline.com/doi/abs/10.1080/01621459.1969.10501038\n\"\"\"\n\n__all__ = ['FitnessFunc', 'Events', 'RegularEvents', 'PointMeasures',\n           'bayesian_blocks']"},{"id":8820,"name":"astropy/stats/src","nodeType":"Package"},{"id":8821,"name":"wirth_select.h","nodeType":"TextFile","path":"astropy/stats/src","text":"#ifndef __WIRTH_SELECT_H__\n#define __WIRTH_SELECT_H__\n\ndouble wirth_median(double a[], int n);\n\n#endif\n"},{"id":8822,"name":"compute_bounds.c","nodeType":"TextFile","path":"astropy/stats/src","text":"#include \"wirth_select.h\"\n#include <math.h>\n#include <stdlib.h>\n\nvoid compute_sigma_clipped_bounds(double data_buffer[], int count, int use_median,\n                                  int use_mad_std, int maxiters, double sigma_lower,\n                                  double sigma_upper, double *lower_bound,\n                                  double *upper_bound, double  mad_buffer[]) {\n\n  double mean, std, median, cen;\n  int i, new_count, iteration = 0;\n\n  while (1) {\n\n    if (use_median || use_mad_std) {\n      median = wirth_median(data_buffer, count);\n    }\n\n    // Note that we don't use an else clause here, because the mean\n    // might be needed even if use_median is used, but use_mad_std is not.\n    if (!use_median || !use_mad_std) {\n      mean = 0;\n      for (i = 0; i < count; i++) {\n        mean += data_buffer[i];\n      }\n      mean /= count;\n    }\n\n    if (use_median) {\n      cen = median;\n    } else {\n      cen = mean;\n    }\n\n    if (use_mad_std) {\n\n      for (i = 0; i < count; i++) {\n        mad_buffer[i] = fabs(data_buffer[i] - median);\n      }\n      std = wirth_median(mad_buffer, count) * 1.482602218505602;\n\n    } else {\n\n      std = 0;\n      for (i = 0; i < count; i++) {\n        std += pow(mean - data_buffer[i], 2);\n      }\n      std = sqrt(std / count);\n\n    }\n\n    *lower_bound = cen - sigma_lower * std;\n    *upper_bound = cen + sigma_upper * std;\n\n    // We now exclude values from the buffer using these\n    // limits and shift values so that we end up with a\n    // packed array of 'valid' values\n    new_count = 0;\n    for (i = 0; i < count; i++) {\n      if (data_buffer[i] >= *lower_bound && data_buffer[i] <= *upper_bound) {\n        data_buffer[new_count] = data_buffer[i];\n        new_count += 1;\n      }\n    }\n\n    if (new_count == count)\n      return;\n\n    count = new_count;\n\n    iteration += 1;\n\n    if (maxiters != -1 && iteration >= maxiters)\n      return;\n  }\n}\n"},{"col":0,"comment":"null","endLoc":486,"header":"def _A1inv(x)","id":8823,"name":"_A1inv","nodeType":"Function","startLoc":478,"text":"def _A1inv(x):\n    # Approximation for _A1inv(x) according R Package 'CircStats'\n    # See http://www.scienceasia.org/2012.38.n1/scias38_118.pdf, equation (4)\n    if 0 <= x < 0.53:\n        return 2.0*x + x*x*x + (5.0*x**5)/6.0\n    elif x < 0.85:\n        return -0.4 + 1.39*x + 0.43/(1.0 - x)\n    else:\n        return 1.0/(x*x*x - 4.0*x*x + 3.0*x)"},{"col":0,"comment":" Computes the Maximum Likelihood Estimator (MLE) for the parameters of\n    the von Mises distribution.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    axis : int, optional\n        Axis along which the mle will be computed.\n\n    Returns\n    -------\n    mu : float or `~astropy.units.Quantity`\n        The mean (aka location parameter).\n    kappa : float or `~astropy.units.Quantity` ['dimensionless']\n        The concentration parameter.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import vonmisesmle\n    >>> from astropy import units as u\n    >>> data = np.array([130, 90, 0, 145])*u.deg\n    >>> vonmisesmle(data) # doctest: +FLOAT_CMP\n    (<Quantity 101.16894320013179 deg>, <Quantity 1.49358958737054>)\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    ","endLoc":528,"header":"def vonmisesmle(data, axis=None)","id":8824,"name":"vonmisesmle","nodeType":"Function","startLoc":489,"text":"def vonmisesmle(data, axis=None):\n    \"\"\" Computes the Maximum Likelihood Estimator (MLE) for the parameters of\n    the von Mises distribution.\n\n    Parameters\n    ----------\n    data : ndarray or `~astropy.units.Quantity`\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    axis : int, optional\n        Axis along which the mle will be computed.\n\n    Returns\n    -------\n    mu : float or `~astropy.units.Quantity`\n        The mean (aka location parameter).\n    kappa : float or `~astropy.units.Quantity` ['dimensionless']\n        The concentration parameter.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.stats import vonmisesmle\n    >>> from astropy import units as u\n    >>> data = np.array([130, 90, 0, 145])*u.deg\n    >>> vonmisesmle(data) # doctest: +FLOAT_CMP\n    (<Quantity 101.16894320013179 deg>, <Quantity 1.49358958737054>)\n\n    References\n    ----------\n    .. [1] S. R. Jammalamadaka, A. SenGupta. \"Topics in Circular Statistics\".\n       Series on Multivariate Analysis, Vol. 5, 2001.\n    .. [2] C. Agostinelli, U. Lund. \"Circular Statistics from 'Topics in\n       Circular Statistics (2001)'\". 2015.\n       <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>\n    \"\"\"\n    mu = circmean(data, axis=None)\n\n    kappa = _A1inv(np.mean(np.cos(data - mu), axis))\n    return mu, kappa"},{"id":8825,"name":"wirth_select.c","nodeType":"TextFile","path":"astropy/stats/src","text":"\n/*\n * Algorithm from N. Wirth's book, implementation by N. Devillard.\n * This code in public domain.\n */\n\n#define ELEM_SWAP(a, b)                                                        \\\n  {                                                                            \\\n    register double t = (a);                                                   \\\n    (a) = (b);                                                                 \\\n    (b) = t;                                                                   \\\n  }\n\n/*---------------------------------------------------------------------------\n   Function :   kth_smallest()\n   In       :   array of elements, # of elements in the array, rank k\n   Out      :   one element\n   Job      :   find the kth smallest element in the array\n   Notice   :   use the median() macro defined below to get the median.\n\n                Reference:\n\n                  Author: Wirth, Niklaus\n                   Title: Algorithms + data structures = programs\n               Publisher: Englewood Cliffs: Prentice-Hall, 1976\n    Physical description: 366 p.\n                  Series: Prentice-Hall Series in Automatic Computation\n\n ---------------------------------------------------------------------------*/\n\ndouble kth_smallest(double a[], int n, int k) {\n  register int i, j, l, m;\n  register double x;\n\n  l = 0;\n  m = n - 1;\n  while (l < m) {\n    x = a[k];\n    i = l;\n    j = m;\n    do {\n      while (a[i] < x)\n        i++;\n      while (x < a[j])\n        j--;\n      if (i <= j) {\n        ELEM_SWAP(a[i], a[j]);\n        i++;\n        j--;\n      }\n    } while (i <= j);\n    if (j < k)\n      l = i;\n    if (k < i)\n      m = j;\n  }\n  return a[k];\n}\n\ndouble wirth_median(double a[], int n) {\n  if (n % 2 == 0) {\n    return 0.5 * (kth_smallest(a, n, n / 2) + kth_smallest(a, n, n / 2 - 1));\n  } else {\n    return kth_smallest(a, n, (n - 1) / 2);\n  }\n}\n"},{"id":8826,"name":"fast_sigma_clip.c","nodeType":"TextFile","path":"astropy/stats/src","text":"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\n\n#include <Python.h>\n#include <numpy/arrayobject.h>\n#include \"numpy/ufuncobject.h\"\n#include \"compute_bounds.h\"\n\n/* Define docstrings */\nstatic char module_docstring[] = \"Fast sigma clipping\";\nstatic char _sigma_clip_fast_docstring[] = \"Compute sigma clipping\";\n\n/* Declare the C functions here. */\nstatic void _sigma_clip_fast(\n    char **args, npy_intp *dimensions, npy_intp* steps, void* data);\n\n/* Define the methods that will be available on the module. */\nstatic PyMethodDef module_methods[] = {{NULL, NULL, 0, NULL}};\n\n/* This is the function that is called on import. */\n\n#define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void)\n#define MOD_DEF(ob, name, doc, methods)                                        \\\n  static struct PyModuleDef moduledef = {                                      \\\n      PyModuleDef_HEAD_INIT, name, doc, -1, methods,                           \\\n      NULL, NULL, NULL, NULL                                                   \\\n  };                                                                           \\\n  ob = PyModule_Create(&moduledef);\n\nMOD_INIT(_fast_sigma_clip) {\n    PyObject *m, *d;\n    PyUFuncObject *ufunc;\n    static char types[9] = {\n        NPY_DOUBLE, /* data array */\n        NPY_BOOL, /* mask array */\n        NPY_BOOL, /* use median */\n        NPY_BOOL, /* use mad_std */\n        NPY_INT, /* max iter */\n        NPY_DOUBLE, /* sigma low */\n        NPY_DOUBLE, /* sigma high */\n        NPY_DOUBLE, /* output: lower bound */\n        NPY_DOUBLE /* output: upper bound */\n    };\n    /* In principle, can have multiple functions for multiple input types */\n    static PyUFuncGenericFunction funcs[1] = { &_sigma_clip_fast };\n    static void *data[1] = {NULL};\n    MOD_DEF(m, \"_fast_sigma_clip\", module_docstring, module_methods);\n    if (m == NULL) {\n        goto fail;\n    }\n    d = PyModule_GetDict(m); /* borrowed ref. */\n    if (d == NULL) {\n        goto fail;\n    }\n    import_array();\n    import_umath();\n\n    ufunc = (PyUFuncObject *)PyUFunc_FromFuncAndDataAndSignature(\n        funcs, data, types, 1, 7, 2, PyUFunc_None, \"_sigma_clip_fast\",\n        _sigma_clip_fast_docstring, 0, \"(n),(n),(),(),(),(),()->(),()\");\n    if (ufunc == NULL) {\n        goto fail;\n    }\n    PyDict_SetItemString(d, \"_sigma_clip_fast\", (PyObject *)ufunc);\n    Py_DECREF(ufunc);\n    return m;\n\n  fail:\n    Py_XDECREF(m);\n    Py_XDECREF(d);\n    return NULL;\n}\n\n\nstatic void _sigma_clip_fast(\n    char **args, npy_intp *dimensions, npy_intp* steps, void* data)\n{\n    npy_intp i_o, i;\n    int count;\n    /* dimensions, pointers and step sizes for outer loop */\n    npy_intp n_o = *dimensions++;\n    char *array = *args++;\n    npy_intp s_array = *steps++;\n    char *mask = *args++;\n    npy_intp s_mask = *steps++;\n    char *use_median = *args++;\n    npy_intp s_use_median = *steps++;\n    char *use_mad_std = *args++;\n    npy_intp s_use_mad_std = *steps++;\n    char *max_iter = *args++;\n    npy_intp s_max_iter = *steps++;\n    char *sigma_low = *args++;\n    npy_intp s_sigma_low = *steps++;\n    char *sigma_high = *args++;\n    npy_intp s_sigma_high = *steps++;\n    char *bound_low = *args++;\n    npy_intp s_bound_low = *steps++;\n    char *bound_high = *args++;\n    npy_intp s_bound_high = *steps++;\n    /* dimension and step sizes for inner loop */\n    npy_intp n_i = dimensions[0];\n    char *in_array, *in_mask;\n    npy_intp is_array = *steps++;\n    npy_intp is_mask = *steps++;\n\n    double *data_buffer = NULL;\n    double *mad_buffer = NULL;\n\n    // data_buffer is used to store the current values being sigma clipped\n    data_buffer = (double *)PyArray_malloc(n_i * sizeof(double));\n    if (data_buffer == NULL) {\n        PyErr_NoMemory();\n        return;\n    }\n\n    for (i_o = 0; i_o < n_o;\n         i_o++, array += s_array,\n                mask += s_mask,\n                use_median += s_use_median, use_mad_std += s_use_mad_std,\n                max_iter += s_max_iter,\n                sigma_low += s_sigma_low, sigma_high += s_sigma_high,\n                bound_low += s_bound_low, bound_high += s_bound_high) {\n        /* copy to buffer */\n        in_array = array;\n        in_mask = mask;\n        count = 0;\n        for (i = 0; i < n_i; i++, in_array += is_array, in_mask += is_mask) {\n            if (*(uint8_t *)in_mask == 0) {\n                data_buffer[count] = *(double *)in_array;\n                count += 1;\n            }\n        }\n        if (count > 0) {\n\n            // If we are using mad_std, we need to prepare an additional buffer\n            // that is used in the calculation. We just need to allocate this once\n            // and can use it in any future loop iteration that needs it.\n            if (((npy_bool *)use_mad_std) && mad_buffer == NULL) {\n                mad_buffer = (double *)PyArray_malloc(n_i * sizeof(double));\n                if (mad_buffer == NULL) {\n                    PyErr_NoMemory();\n                    return;\n                }\n            }\n\n            compute_sigma_clipped_bounds(\n                data_buffer, count,\n                (int)(*(npy_bool *)use_median), (int)(*(npy_bool *)use_mad_std),\n                *(int *)max_iter,\n                *(double *)sigma_low, *(double *)sigma_high,\n                (double *)bound_low, (double *)bound_high, mad_buffer);\n        }\n        else {\n            *(double *)bound_low = NPY_NAN;\n            *(double *)bound_high = NPY_NAN;\n        }\n    }\n    PyArray_free((void *)data_buffer);\n    if (mad_buffer != NULL) {\n        PyArray_free((void *)mad_buffer);\n    }\n}\n"},{"id":8827,"name":"compute_bounds.h","nodeType":"TextFile","path":"astropy/stats/src","text":"#ifndef __COMPUTE_BOUNDS_H__\n#define __COMPUTE_BOUNDS_H__\n\nvoid compute_sigma_clipped_bounds(double data_buffer[], int count, int use_median, int use_mad_std,\n                                  int maxiters, double sigma_lower, double sigma_upper,\n                                  double *lower_bound, double *upper_bound, double mad_buffer[]);\n\n#endif\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":8828,"name":"__all__","nodeType":"Attribute","startLoc":16,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":8829,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":18,"text":"__doctest_requires__"},{"attributeType":"null","col":4,"comment":"null","endLoc":1648,"id":8830,"name":"name","nodeType":"Attribute","startLoc":1648,"text":"name"},{"col":0,"comment":"","endLoc":11,"header":"circstats.py#<anonymous>","id":8831,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module contains simple functions for dealing with circular statistics, for\ninstance, mean, variance, standard deviation, correlation coefficient, and so\non. This module also cover tests of uniformity, e.g., the Rayleigh and V tests.\nThe Maximum Likelihood Estimator for the Von Mises distribution along with the\nCramer-Rao Lower Bounds are also implemented. Almost all of the implementations\nare based on reference [1]_, which is also the basis for the R package\n'CircStats' [2]_.\n\"\"\"\n\n__all__ = ['circmean', 'circstd', 'circvar', 'circmoment', 'circcorrcoef',\n           'rayleightest', 'vtest', 'vonmisesmle']\n\n__doctest_requires__ = {'vtest': ['scipy']}"},{"attributeType":"null","col":4,"comment":"null","endLoc":1649,"id":8832,"name":"subfmts","nodeType":"Attribute","startLoc":1649,"text":"subfmts"},{"id":8833,"name":"astropy/stats/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/stats/tests","id":8834,"nodeType":"File","text":""},{"attributeType":"null","col":4,"comment":"null","endLoc":1667,"id":8835,"name":"subfmts","nodeType":"Attribute","startLoc":1667,"text":"subfmts"},{"id":8836,"name":"astropy/stats/lombscargle","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/stats/lombscargle","id":8837,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# The LombScargle periodogram functionality has been moved to\n# astropy.timeseries.periodograms.bls. The purpose of this file is to provide backward-\n# compatibility during a transition phase. We can't emit a deprecation warning\n# simply on import of this module, since the classes are imported into the\n# top-level astropy.stats, so instead we wrap the main class and emit a\n# warning during initialization.\n\nimport warnings\n\nfrom astropy.timeseries.periodograms.lombscargle import LombScargle as TimeseriesLombScargle\nfrom astropy.utils.exceptions import AstropyDeprecationWarning\n\n__all__ = ['LombScargle']\n\n\nclass LombScargle(TimeseriesLombScargle):\n    \"\"\"\n    Compute the Lomb-Scargle Periodogram.\n\n    This class has been deprecated and will be removed in a future version.\n    Use `astropy.timeseries.LombScargle` instead.\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n        warnings.warn('Importing LombScargle from astropy.stats has been '\n                      'deprecated and will no longer be supported in future. '\n                      'Please import this class from the astropy.timeseries '\n                      'module instead', AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)\n"},{"id":8838,"name":"astropy/table","nodeType":"Package"},{"fileName":"jsviewer.py","filePath":"astropy/table","id":8839,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom os.path import abspath, dirname, join\n\nfrom .table import Table\n\nimport astropy.io.registry as io_registry\nimport astropy.config as _config\nfrom astropy import extern\n\n\nclass Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.table.jsviewer`.\n    \"\"\"\n\n    jquery_url = _config.ConfigItem(\n        'https://code.jquery.com/jquery-3.1.1.min.js',\n        'The URL to the jquery library.')\n\n    datatables_url = _config.ConfigItem(\n        'https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js',\n        'The URL to the jquery datatables library.')\n\n    css_urls = _config.ConfigItem(\n        ['https://cdn.datatables.net/1.10.12/css/jquery.dataTables.css'],\n        'The URLs to the css file(s) to include.', cfgtype='string_list')\n\n\nconf = Conf()\n\n\nEXTERN_JS_DIR = abspath(join(dirname(extern.__file__), 'jquery', 'data', 'js'))\nEXTERN_CSS_DIR = abspath(join(dirname(extern.__file__), 'jquery', 'data', 'css'))\n\n_SORTING_SCRIPT_PART_1 = \"\"\"\nvar astropy_sort_num = function(a, b) {{\n    var a_num = parseFloat(a);\n    var b_num = parseFloat(b);\n\n    if (isNaN(a_num) && isNaN(b_num))\n        return ((a < b) ? -1 : ((a > b) ? 1 : 0));\n    else if (!isNaN(a_num) && !isNaN(b_num))\n        return ((a_num < b_num) ? -1 : ((a_num > b_num) ? 1 : 0));\n    else\n        return isNaN(a_num) ? -1 : 1;\n}}\n\"\"\"\n\n_SORTING_SCRIPT_PART_2 = \"\"\"\njQuery.extend( jQuery.fn.dataTableExt.oSort, {{\n    \"optionalnum-asc\": astropy_sort_num,\n    \"optionalnum-desc\": function (a,b) {{ return -astropy_sort_num(a, b); }}\n}});\n\"\"\"\n\nIPYNB_JS_SCRIPT = \"\"\"\n<script>\n%(sorting_script1)s\nrequire.config({{paths: {{\n    datatables: '{datatables_url}'\n}}}});\nrequire([\"datatables\"], function(){{\n    console.log(\"$('#{tid}').dataTable()\");\n    %(sorting_script2)s\n    $('#{tid}').dataTable({{\n        order: [],\n        pageLength: {display_length},\n        lengthMenu: {display_length_menu},\n        pagingType: \"full_numbers\",\n        columnDefs: [{{targets: {sort_columns}, type: \"optionalnum\"}}]\n    }});\n}});\n</script>\n\"\"\" % dict(sorting_script1=_SORTING_SCRIPT_PART_1,\n           sorting_script2=_SORTING_SCRIPT_PART_2)\n\nHTML_JS_SCRIPT = _SORTING_SCRIPT_PART_1 + _SORTING_SCRIPT_PART_2 + \"\"\"\n$(document).ready(function() {{\n    $('#{tid}').dataTable({{\n        order: [],\n        pageLength: {display_length},\n        lengthMenu: {display_length_menu},\n        pagingType: \"full_numbers\",\n        columnDefs: [{{targets: {sort_columns}, type: \"optionalnum\"}}]\n    }});\n}} );\n\"\"\"\n\n\n# Default CSS for the JSViewer writer\nDEFAULT_CSS = \"\"\"\\\nbody {font-family: sans-serif;}\ntable.dataTable {width: auto !important; margin: 0 !important;}\n.dataTables_filter, .dataTables_paginate {float: left !important; margin-left:1em}\n\"\"\"\n\n\n# Default CSS used when rendering a table in the IPython notebook\nDEFAULT_CSS_NB = \"\"\"\\\ntable.dataTable {clear: both; width: auto !important; margin: 0 !important;}\n.dataTables_info, .dataTables_length, .dataTables_filter, .dataTables_paginate{\ndisplay: inline-block; margin-right: 1em; }\n.paginate_button { margin-right: 5px; }\n\"\"\"\n\n\nclass JSViewer:\n    \"\"\"Provides an interactive HTML export of a Table.\n\n    This class provides an interface to the `DataTables\n    <https://datatables.net/>`_ library, which allow to visualize interactively\n    an HTML table. It is used by the `~astropy.table.Table.show_in_browser`\n    method.\n\n    Parameters\n    ----------\n    use_local_files : bool, optional\n        Use local files or a CDN for JavaScript libraries. Default False.\n    display_length : int, optional\n        Number or rows to show. Default to 50.\n\n    \"\"\"\n\n    def __init__(self, use_local_files=False, display_length=50):\n        self._use_local_files = use_local_files\n        self.display_length_menu = [[10, 25, 50, 100, 500, 1000, -1],\n                                    [10, 25, 50, 100, 500, 1000, \"All\"]]\n        self.display_length = display_length\n        for L in self.display_length_menu:\n            if display_length not in L:\n                L.insert(0, display_length)\n\n    @property\n    def jquery_urls(self):\n        if self._use_local_files:\n            return ['file://' + join(EXTERN_JS_DIR, 'jquery-3.1.1.min.js'),\n                    'file://' + join(EXTERN_JS_DIR, 'jquery.dataTables.min.js')]\n        else:\n            return [conf.jquery_url, conf.datatables_url]\n\n    @property\n    def css_urls(self):\n        if self._use_local_files:\n            return ['file://' + join(EXTERN_CSS_DIR,\n                                     'jquery.dataTables.css')]\n        else:\n            return conf.css_urls\n\n    def _jstable_file(self):\n        if self._use_local_files:\n            return 'file://' + join(EXTERN_JS_DIR, 'jquery.dataTables.min')\n        else:\n            return conf.datatables_url[:-3]\n\n    def ipynb(self, table_id, css=None, sort_columns='[]'):\n        html = f'<style>{css if css is not None else DEFAULT_CSS_NB}</style>'\n        html += IPYNB_JS_SCRIPT.format(\n            display_length=self.display_length,\n            display_length_menu=self.display_length_menu,\n            datatables_url=self._jstable_file(),\n            tid=table_id, sort_columns=sort_columns)\n        return html\n\n    def html_js(self, table_id='table0', sort_columns='[]'):\n        return HTML_JS_SCRIPT.format(\n            display_length=self.display_length,\n            display_length_menu=self.display_length_menu,\n            tid=table_id, sort_columns=sort_columns).strip()\n\n\ndef write_table_jsviewer(table, filename, table_id=None, max_lines=5000,\n                         table_class=\"display compact\", jskwargs=None,\n                         css=DEFAULT_CSS, htmldict=None, overwrite=False):\n    if table_id is None:\n        table_id = f'table{id(table)}'\n\n    jskwargs = jskwargs or {}\n    jsv = JSViewer(**jskwargs)\n\n    sortable_columns = [i for i, col in enumerate(table.columns.values())\n                        if col.info.dtype.kind in 'iufc']\n    html_options = {\n        'table_id': table_id,\n        'table_class': table_class,\n        'css': css,\n        'cssfiles': jsv.css_urls,\n        'jsfiles': jsv.jquery_urls,\n        'js': jsv.html_js(table_id=table_id, sort_columns=sortable_columns)\n    }\n    if htmldict:\n        html_options.update(htmldict)\n\n    if max_lines < len(table):\n        table = table[:max_lines]\n    table.write(filename, format='html', htmldict=html_options,\n                overwrite=overwrite)\n\n\nio_registry.register_writer('jsviewer', Table, write_table_jsviewer)\n"},{"attributeType":"null","col":16,"comment":"null","endLoc":1699,"id":8840,"name":"_scale","nodeType":"Attribute","startLoc":1699,"text":"self._scale"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.table.jsviewer`.\n    ","endLoc":27,"id":8841,"nodeType":"Class","startLoc":12,"text":"class Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.table.jsviewer`.\n    \"\"\"\n\n    jquery_url = _config.ConfigItem(\n        'https://code.jquery.com/jquery-3.1.1.min.js',\n        'The URL to the jquery library.')\n\n    datatables_url = _config.ConfigItem(\n        'https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js',\n        'The URL to the jquery datatables library.')\n\n    css_urls = _config.ConfigItem(\n        ['https://cdn.datatables.net/1.10.12/css/jquery.dataTables.css'],\n        'The URLs to the css file(s) to include.', cfgtype='string_list')"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":17,"id":8842,"name":"jquery_url","nodeType":"Attribute","startLoc":17,"text":"jquery_url"},{"col":4,"comment":"null","endLoc":295,"header":"@staticmethod\n    def _parse_stdfunc(stdfunc)","id":8843,"name":"_parse_stdfunc","nodeType":"Function","startLoc":282,"text":"@staticmethod\n    def _parse_stdfunc(stdfunc):\n        if isinstance(stdfunc, str):\n            if stdfunc == 'std':\n                if HAS_BOTTLENECK:\n                    stdfunc = _nanstd\n                else:\n                    stdfunc = np.nanstd  # pragma: no cover\n            elif stdfunc == 'mad_std':\n                stdfunc = _nanmadstd\n            else:\n                raise ValueError(f'{stdfunc} is an invalid stdfunc.')\n\n        return stdfunc"},{"col":4,"comment":"null","endLoc":252,"header":"def __repr__(self)","id":8844,"name":"__repr__","nodeType":"Function","startLoc":247,"text":"def __repr__(self):\n        return ('SigmaClip(sigma={}, sigma_lower={}, sigma_upper={}, '\n                'maxiters={}, cenfunc={}, stdfunc={}, grow={})'\n                .format(self.sigma, self.sigma_lower, self.sigma_upper,\n                        self.maxiters, repr(self.cenfunc), repr(self.stdfunc),\n                        self.grow))"},{"col":4,"comment":"null","endLoc":260,"header":"def __str__(self)","id":8845,"name":"__str__","nodeType":"Function","startLoc":254,"text":"def __str__(self):\n        lines = ['<' + self.__class__.__name__ + '>']\n        attrs = ['sigma', 'sigma_lower', 'sigma_upper', 'maxiters', 'cenfunc',\n                 'stdfunc', 'grow']\n        for attr in attrs:\n            lines.append(f'    {attr}: {repr(getattr(self, attr))}')\n        return '\\n'.join(lines)"},{"attributeType":"null","col":16,"comment":"null","endLoc":1716,"id":8846,"name":"out_subfmt","nodeType":"Attribute","startLoc":1716,"text":"self.out_subfmt"},{"col":4,"comment":"null","endLoc":305,"header":"def _compute_bounds(self, data, axis=None)","id":8847,"name":"_compute_bounds","nodeType":"Function","startLoc":297,"text":"def _compute_bounds(self, data, axis=None):\n        # ignore RuntimeWarning if the array (or along an axis) has only\n        # NaNs\n        with warnings.catch_warnings():\n            warnings.simplefilter(\"ignore\", category=RuntimeWarning)\n            self._max_value = self._cenfunc_parsed(data, axis=axis)\n            std = self._stdfunc_parsed(data, axis=axis)\n            self._min_value = self._max_value - (std * self.sigma_lower)\n            self._max_value += std * self.sigma_upper"},{"className":"LombScargle","col":0,"comment":"Compute the Lomb-Scargle Periodogram.\n\n    This implementations here are based on code presented in [1]_ and [2]_;\n    if you use this functionality in an academic application, citation of\n    those works would be appreciated.\n\n    Parameters\n    ----------\n    t : array-like or `~astropy.units.Quantity` ['time']\n        sequence of observation times\n    y : array-like or `~astropy.units.Quantity`\n        sequence of observations associated with times t\n    dy : float, array-like, or `~astropy.units.Quantity`, optional\n        error or sequence of observational errors associated with times t\n    fit_mean : bool, optional\n        if True, include a constant offset as part of the model at each\n        frequency. This can lead to more accurate results, especially in the\n        case of incomplete phase coverage.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data. This is especially important if fit_mean = False\n    nterms : int, optional\n        number of terms to use in the Fourier fit\n    normalization : {'standard', 'model', 'log', 'psd'}, optional\n        Normalization to use for the periodogram.\n\n    Examples\n    --------\n    Generate noisy periodic data:\n\n    >>> rand = np.random.default_rng(42)\n    >>> t = 100 * rand.random(100)\n    >>> y = np.sin(2 * np.pi * t) + rand.standard_normal(100)\n\n    Compute the Lomb-Scargle periodogram on an automatically-determined\n    frequency grid & find the frequency of max power:\n\n    >>> frequency, power = LombScargle(t, y).autopower()\n    >>> frequency[np.argmax(power)]  # doctest: +FLOAT_CMP\n    1.0007641728995051\n\n    Compute the Lomb-Scargle periodogram at a user-specified frequency grid:\n\n    >>> freq = np.arange(0.8, 1.3, 0.1)\n    >>> LombScargle(t, y).power(freq)  # doctest: +FLOAT_CMP\n    array([0.0792948 , 0.01778874, 0.25328167, 0.01064157, 0.01471387])\n\n    If the inputs are astropy Quantities with units, the units will be\n    validated and the outputs will also be Quantities with appropriate units:\n\n    >>> from astropy import units as u\n    >>> t = t * u.s\n    >>> y = y * u.mag\n    >>> frequency, power = LombScargle(t, y).autopower()\n    >>> frequency.unit\n    Unit(\"1 / s\")\n    >>> power.unit\n    Unit(dimensionless)\n\n    Note here that the Lomb-Scargle power is always a unitless quantity,\n    because it is related to the :math:`\\chi^2` of the best-fit periodic\n    model at each frequency.\n\n    References\n    ----------\n    .. [1] Vanderplas, J., Connolly, A. Ivezic, Z. & Gray, A. *Introduction to\n        astroML: Machine learning for astrophysics*. Proceedings of the\n        Conference on Intelligent Data Understanding (2012)\n    .. [2] VanderPlas, J. & Ivezic, Z. *Periodograms for Multiband Astronomical\n        Time Series*. ApJ 812.1:18 (2015)\n    ","endLoc":704,"id":8848,"nodeType":"Class","startLoc":30,"text":"class LombScargle(BasePeriodogram):\n    \"\"\"Compute the Lomb-Scargle Periodogram.\n\n    This implementations here are based on code presented in [1]_ and [2]_;\n    if you use this functionality in an academic application, citation of\n    those works would be appreciated.\n\n    Parameters\n    ----------\n    t : array-like or `~astropy.units.Quantity` ['time']\n        sequence of observation times\n    y : array-like or `~astropy.units.Quantity`\n        sequence of observations associated with times t\n    dy : float, array-like, or `~astropy.units.Quantity`, optional\n        error or sequence of observational errors associated with times t\n    fit_mean : bool, optional\n        if True, include a constant offset as part of the model at each\n        frequency. This can lead to more accurate results, especially in the\n        case of incomplete phase coverage.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data. This is especially important if fit_mean = False\n    nterms : int, optional\n        number of terms to use in the Fourier fit\n    normalization : {'standard', 'model', 'log', 'psd'}, optional\n        Normalization to use for the periodogram.\n\n    Examples\n    --------\n    Generate noisy periodic data:\n\n    >>> rand = np.random.default_rng(42)\n    >>> t = 100 * rand.random(100)\n    >>> y = np.sin(2 * np.pi * t) + rand.standard_normal(100)\n\n    Compute the Lomb-Scargle periodogram on an automatically-determined\n    frequency grid & find the frequency of max power:\n\n    >>> frequency, power = LombScargle(t, y).autopower()\n    >>> frequency[np.argmax(power)]  # doctest: +FLOAT_CMP\n    1.0007641728995051\n\n    Compute the Lomb-Scargle periodogram at a user-specified frequency grid:\n\n    >>> freq = np.arange(0.8, 1.3, 0.1)\n    >>> LombScargle(t, y).power(freq)  # doctest: +FLOAT_CMP\n    array([0.0792948 , 0.01778874, 0.25328167, 0.01064157, 0.01471387])\n\n    If the inputs are astropy Quantities with units, the units will be\n    validated and the outputs will also be Quantities with appropriate units:\n\n    >>> from astropy import units as u\n    >>> t = t * u.s\n    >>> y = y * u.mag\n    >>> frequency, power = LombScargle(t, y).autopower()\n    >>> frequency.unit\n    Unit(\"1 / s\")\n    >>> power.unit\n    Unit(dimensionless)\n\n    Note here that the Lomb-Scargle power is always a unitless quantity,\n    because it is related to the :math:`\\\\chi^2` of the best-fit periodic\n    model at each frequency.\n\n    References\n    ----------\n    .. [1] Vanderplas, J., Connolly, A. Ivezic, Z. & Gray, A. *Introduction to\n        astroML: Machine learning for astrophysics*. Proceedings of the\n        Conference on Intelligent Data Understanding (2012)\n    .. [2] VanderPlas, J. & Ivezic, Z. *Periodograms for Multiband Astronomical\n        Time Series*. ApJ 812.1:18 (2015)\n    \"\"\"\n    available_methods = available_methods()\n\n    def __init__(self, t, y, dy=None, fit_mean=True, center_data=True,\n                 nterms=1, normalization='standard'):\n\n        # If t is a TimeDelta, convert it to a quantity. The units we convert\n        # to don't really matter since the user gets a Quantity back at the end\n        # so can convert to any units they like.\n        if isinstance(t, TimeDelta):\n            t = t.to('day')\n\n        # We want to expose self.t as being the times the user passed in, but\n        # if the times are absolute, we need to convert them to relative times\n        # internally, so we use self._trel and self._tstart for this.\n\n        self.t = t\n\n        if isinstance(self.t, Time):\n            self._tstart = self.t[0]\n            trel = (self.t - self._tstart).to(u.day)\n        else:\n            self._tstart = None\n            trel = self.t\n\n        self._trel, self.y, self.dy = self._validate_inputs(trel, y, dy)\n\n        self.fit_mean = fit_mean\n        self.center_data = center_data\n        self.nterms = nterms\n        self.normalization = normalization\n\n    def _validate_inputs(self, t, y, dy):\n        # Validate shapes of inputs\n        if dy is None:\n            t, y = np.broadcast_arrays(t, y, subok=True)\n        else:\n            t, y, dy = np.broadcast_arrays(t, y, dy, subok=True)\n        if t.ndim != 1:\n            raise ValueError(\"Inputs (t, y, dy) must be 1-dimensional\")\n\n        # validate units of inputs if any is a Quantity\n        if any(has_units(arr) for arr in (t, y, dy)):\n            t, y = map(units.Quantity, (t, y))\n            if dy is not None:\n                dy = units.Quantity(dy)\n                try:\n                    dy = units.Quantity(dy, unit=y.unit)\n                except units.UnitConversionError:\n                    raise ValueError(\"Units of dy not equivalent \"\n                                     \"to units of y\")\n        return t, y, dy\n\n    def _validate_frequency(self, frequency):\n        frequency = np.asanyarray(frequency)\n\n        if has_units(self._trel):\n            frequency = units.Quantity(frequency)\n            try:\n                frequency = units.Quantity(frequency, unit=1./self._trel.unit)\n            except units.UnitConversionError:\n                raise ValueError(\"Units of frequency not equivalent to \"\n                                 \"units of 1/t\")\n        else:\n            if has_units(frequency):\n                raise ValueError(\"frequency have units while 1/t doesn't.\")\n        return frequency\n\n    def _validate_t(self, t):\n        t = np.asanyarray(t)\n\n        if has_units(self._trel):\n            t = units.Quantity(t)\n            try:\n                t = units.Quantity(t, unit=self._trel.unit)\n            except units.UnitConversionError:\n                raise ValueError(\"Units of t not equivalent to \"\n                                 \"units of input self.t\")\n        return t\n\n    def _power_unit(self, norm):\n        if has_units(self.y):\n            if self.dy is None and norm == 'psd':\n                return self.y.unit ** 2\n            else:\n                return units.dimensionless_unscaled\n        else:\n            return 1\n\n    def autofrequency(self, samples_per_peak=5, nyquist_factor=5,\n                      minimum_frequency=None, maximum_frequency=None,\n                      return_freq_limits=False):\n        \"\"\"Determine a suitable frequency grid for data.\n\n        Note that this assumes the peak width is driven by the observational\n        baseline, which is generally a good assumption when the baseline is\n        much larger than the oscillation period.\n        If you are searching for periods longer than the baseline of your\n        observations, this may not perform well.\n\n        Even with a large baseline, be aware that the maximum frequency\n        returned is based on the concept of \"average Nyquist frequency\", which\n        may not be useful for irregularly-sampled data. The maximum frequency\n        can be adjusted via the nyquist_factor argument, or through the\n        maximum_frequency argument.\n\n        Parameters\n        ----------\n        samples_per_peak : float, optional\n            The approximate number of desired samples across the typical peak\n        nyquist_factor : float, optional\n            The multiple of the average nyquist frequency used to choose the\n            maximum frequency if maximum_frequency is not provided.\n        minimum_frequency : float, optional\n            If specified, then use this minimum frequency rather than one\n            chosen based on the size of the baseline.\n        maximum_frequency : float, optional\n            If specified, then use this maximum frequency rather than one\n            chosen based on the average nyquist frequency.\n        return_freq_limits : bool, optional\n            if True, return only the frequency limits rather than the full\n            frequency grid.\n\n        Returns\n        -------\n        frequency : ndarray or `~astropy.units.Quantity` ['frequency']\n            The heuristically-determined optimal frequency bin\n        \"\"\"\n        baseline = self._trel.max() - self._trel.min()\n        n_samples = self._trel.size\n\n        df = 1.0 / baseline / samples_per_peak\n\n        if minimum_frequency is None:\n            minimum_frequency = 0.5 * df\n\n        if maximum_frequency is None:\n            avg_nyquist = 0.5 * n_samples / baseline\n            maximum_frequency = nyquist_factor * avg_nyquist\n\n        Nf = 1 + int(np.round((maximum_frequency - minimum_frequency) / df))\n\n        if return_freq_limits:\n            return minimum_frequency, minimum_frequency + df * (Nf - 1)\n        else:\n            return minimum_frequency + df * np.arange(Nf)\n\n    def autopower(self, method='auto', method_kwds=None,\n                  normalization=None, samples_per_peak=5,\n                  nyquist_factor=5, minimum_frequency=None,\n                  maximum_frequency=None):\n        \"\"\"Compute Lomb-Scargle power at automatically-determined frequencies.\n\n        Parameters\n        ----------\n        method : str, optional\n            specify the lomb scargle implementation to use. Options are:\n\n            - 'auto': choose the best method based on the input\n            - 'fast': use the O[N log N] fast method. Note that this requires\n              evenly-spaced frequencies: by default this will be checked unless\n              ``assume_regular_frequency`` is set to True.\n            - 'slow': use the O[N^2] pure-python implementation\n            - 'cython': use the O[N^2] cython implementation. This is slightly\n              faster than method='slow', but much more memory efficient.\n            - 'chi2': use the O[N^2] chi2/linear-fitting implementation\n            - 'fastchi2': use the O[N log N] chi2 implementation. Note that this\n              requires evenly-spaced frequencies: by default this will be checked\n              unless ``assume_regular_frequency`` is set to True.\n            - 'scipy': use ``scipy.signal.lombscargle``, which is an O[N^2]\n              implementation written in C. Note that this does not support\n              heteroskedastic errors.\n\n        method_kwds : dict, optional\n            additional keywords to pass to the lomb-scargle method\n        normalization : {'standard', 'model', 'log', 'psd'}, optional\n            If specified, override the normalization specified at instantiation.\n        samples_per_peak : float, optional\n            The approximate number of desired samples across the typical peak\n        nyquist_factor : float, optional\n            The multiple of the average nyquist frequency used to choose the\n            maximum frequency if maximum_frequency is not provided.\n        minimum_frequency : float or `~astropy.units.Quantity` ['frequency'], optional\n            If specified, then use this minimum frequency rather than one\n            chosen based on the size of the baseline. Should be `~astropy.units.Quantity`\n            if inputs to LombScargle are `~astropy.units.Quantity`.\n        maximum_frequency : float or `~astropy.units.Quantity` ['frequency'], optional\n            If specified, then use this maximum frequency rather than one\n            chosen based on the average nyquist frequency. Should be `~astropy.units.Quantity`\n            if inputs to LombScargle are `~astropy.units.Quantity`.\n\n        Returns\n        -------\n        frequency, power : ndarray\n            The frequency and Lomb-Scargle power\n        \"\"\"\n        frequency = self.autofrequency(samples_per_peak=samples_per_peak,\n                                       nyquist_factor=nyquist_factor,\n                                       minimum_frequency=minimum_frequency,\n                                       maximum_frequency=maximum_frequency)\n        power = self.power(frequency,\n                           normalization=normalization,\n                           method=method, method_kwds=method_kwds,\n                           assume_regular_frequency=True)\n        return frequency, power\n\n    def power(self, frequency, normalization=None, method='auto',\n              assume_regular_frequency=False, method_kwds=None):\n        \"\"\"Compute the Lomb-Scargle power at the given frequencies.\n\n        Parameters\n        ----------\n        frequency : array-like or `~astropy.units.Quantity` ['frequency']\n            frequencies (not angular frequencies) at which to evaluate the\n            periodogram. Note that in order to use method='fast', frequencies\n            must be regularly-spaced.\n        method : str, optional\n            specify the lomb scargle implementation to use. Options are:\n\n            - 'auto': choose the best method based on the input\n            - 'fast': use the O[N log N] fast method. Note that this requires\n              evenly-spaced frequencies: by default this will be checked unless\n              ``assume_regular_frequency`` is set to True.\n            - 'slow': use the O[N^2] pure-python implementation\n            - 'cython': use the O[N^2] cython implementation. This is slightly\n              faster than method='slow', but much more memory efficient.\n            - 'chi2': use the O[N^2] chi2/linear-fitting implementation\n            - 'fastchi2': use the O[N log N] chi2 implementation. Note that this\n              requires evenly-spaced frequencies: by default this will be checked\n              unless ``assume_regular_frequency`` is set to True.\n            - 'scipy': use ``scipy.signal.lombscargle``, which is an O[N^2]\n              implementation written in C. Note that this does not support\n              heteroskedastic errors.\n\n        assume_regular_frequency : bool, optional\n            if True, assume that the input frequency is of the form\n            freq = f0 + df * np.arange(N). Only referenced if method is 'auto'\n            or 'fast'.\n        normalization : {'standard', 'model', 'log', 'psd'}, optional\n            If specified, override the normalization specified at instantiation.\n        fit_mean : bool, optional\n            If True, include a constant offset as part of the model at each\n            frequency. This can lead to more accurate results, especially in\n            the case of incomplete phase coverage.\n        center_data : bool, optional\n            If True, pre-center the data by subtracting the weighted mean of\n            the input data. This is especially important if fit_mean = False.\n        method_kwds : dict, optional\n            additional keywords to pass to the lomb-scargle method\n\n        Returns\n        -------\n        power : ndarray\n            The Lomb-Scargle power at the specified frequency\n        \"\"\"\n        if normalization is None:\n            normalization = self.normalization\n        frequency = self._validate_frequency(frequency)\n        power = lombscargle(*strip_units(self._trel, self.y, self.dy),\n                            frequency=strip_units(frequency),\n                            center_data=self.center_data,\n                            fit_mean=self.fit_mean,\n                            nterms=self.nterms,\n                            normalization=normalization,\n                            method=method, method_kwds=method_kwds,\n                            assume_regular_frequency=assume_regular_frequency)\n        return power * self._power_unit(normalization)\n\n    def _as_relative_time(self, name, times):\n        \"\"\"\n        Convert the provided times (if absolute) to relative times using the\n        current _tstart value. If the times provided are relative, they are\n        returned without conversion (though we still do some checks).\n        \"\"\"\n\n        if isinstance(times, TimeDelta):\n            times = times.to('day')\n\n        if self._tstart is None:\n            if isinstance(times, Time):\n                raise TypeError('{} was provided as an absolute time but '\n                                'the LombScargle class was initialized '\n                                'with relative times.'.format(name))\n        else:\n            if isinstance(times, Time):\n                times = (times - self._tstart).to(u.day)\n            else:\n                raise TypeError('{} was provided as a relative time but '\n                                'the LombScargle class was initialized '\n                                'with absolute times.'.format(name))\n\n        return times\n\n    def model(self, t, frequency):\n        \"\"\"Compute the Lomb-Scargle model at the given frequency.\n\n        The model at a particular frequency is a linear model:\n        model = offset + dot(design_matrix, model_parameters)\n\n        Parameters\n        ----------\n        t : array-like or `~astropy.units.Quantity` ['time']\n            Times (length ``n_samples``) at which to compute the model.\n        frequency : float\n            the frequency for the model\n\n        Returns\n        -------\n        y : np.ndarray\n            The model fit corresponding to the input times\n            (will have length ``n_samples``).\n\n        See Also\n        --------\n        design_matrix\n        offset\n        model_parameters\n        \"\"\"\n        frequency = self._validate_frequency(frequency)\n        t = self._validate_t(self._as_relative_time('t', t))\n        y_fit = periodic_fit(*strip_units(self._trel, self.y, self.dy),\n                             frequency=strip_units(frequency),\n                             t_fit=strip_units(t),\n                             center_data=self.center_data,\n                             fit_mean=self.fit_mean,\n                             nterms=self.nterms)\n        return y_fit * get_unit(self.y)\n\n    def offset(self):\n        \"\"\"Return the offset of the model\n\n        The offset of the model is the (weighted) mean of the y values.\n        Note that if self.center_data is False, the offset is 0 by definition.\n\n        Returns\n        -------\n        offset : scalar\n\n        See Also\n        --------\n        design_matrix\n        model\n        model_parameters\n        \"\"\"\n        y, dy = strip_units(self.y, self.dy)\n        if dy is None:\n            dy = 1\n        dy = np.broadcast_to(dy, y.shape)\n        if self.center_data:\n            w = dy ** -2.0\n            y_mean = np.dot(y, w) / w.sum()\n        else:\n            y_mean = 0\n        return y_mean * get_unit(self.y)\n\n    def model_parameters(self, frequency, units=True):\n        r\"\"\"Compute the best-fit model parameters at the given frequency.\n\n        The model described by these parameters is:\n\n        .. math::\n\n            y(t; f, \\vec{\\theta}) = \\theta_0 + \\sum_{n=1}^{\\tt nterms} [\\theta_{2n-1}\\sin(2\\pi n f t) + \\theta_{2n}\\cos(2\\pi n f t)]\n\n        where :math:`\\vec{\\theta}` is the array of parameters returned by this function.\n\n        Parameters\n        ----------\n        frequency : float\n            the frequency for the model\n        units : bool\n            If True (default), return design matrix with data units.\n\n        Returns\n        -------\n        theta : np.ndarray (n_parameters,)\n            The best-fit model parameters at the given frequency.\n\n        See Also\n        --------\n        design_matrix\n        model\n        offset\n        \"\"\"\n        frequency = self._validate_frequency(frequency)\n        t, y, dy = strip_units(self._trel, self.y, self.dy)\n\n        if self.center_data:\n            y = y - strip_units(self.offset())\n\n        dy = np.ones_like(y) if dy is None else np.asarray(dy)\n        X = self.design_matrix(frequency)\n        parameters = np.linalg.solve(np.dot(X.T, X),\n                                     np.dot(X.T, y / dy))\n        if units:\n            parameters = get_unit(self.y) * parameters\n        return parameters\n\n    def design_matrix(self, frequency, t=None):\n        \"\"\"Compute the design matrix for a given frequency\n\n        Parameters\n        ----------\n        frequency : float\n            the frequency for the model\n        t : array-like, `~astropy.units.Quantity`, or `~astropy.time.Time` (optional)\n            Times (length ``n_samples``) at which to compute the model.\n            If not specified, then the times and uncertainties of the input\n            data are used.\n\n        Returns\n        -------\n        X : array\n            The design matrix for the model at the given frequency.\n            This should have a shape of (``len(t)``, ``n_parameters``).\n\n        See Also\n        --------\n        model\n        model_parameters\n        offset\n        \"\"\"\n        if t is None:\n            t, dy = strip_units(self._trel, self.dy)\n        else:\n            t, dy = strip_units(self._validate_t(self._as_relative_time('t', t)), None)\n        return design_matrix(t, frequency, dy,\n                             nterms=self.nterms,\n                             bias=self.fit_mean)\n\n    def distribution(self, power, cumulative=False):\n        \"\"\"Expected periodogram distribution under the null hypothesis.\n\n        This computes the expected probability distribution or cumulative\n        probability distribution of periodogram power, under the null\n        hypothesis of a non-varying signal with Gaussian noise. Note that\n        this is not the same as the expected distribution of peak values;\n        for that see the ``false_alarm_probability()`` method.\n\n        Parameters\n        ----------\n        power : array-like\n            The periodogram power at which to compute the distribution.\n        cumulative : bool, optional\n            If True, then return the cumulative distribution.\n\n        See Also\n        --------\n        false_alarm_probability\n        false_alarm_level\n\n        Returns\n        -------\n        dist : np.ndarray\n            The probability density or cumulative probability associated with\n            the provided powers.\n        \"\"\"\n        dH = 1 if self.fit_mean or self.center_data else 0\n        dK = dH + 2 * self.nterms\n        dist = _statistics.cdf_single if cumulative else _statistics.pdf_single\n        return dist(power, len(self._trel), self.normalization, dH=dH, dK=dK)\n\n    def false_alarm_probability(self, power, method='baluev',\n                                samples_per_peak=5, nyquist_factor=5,\n                                minimum_frequency=None, maximum_frequency=None,\n                                method_kwds=None):\n        \"\"\"False alarm probability of periodogram maxima under the null hypothesis.\n\n        This gives an estimate of the false alarm probability given the height\n        of the largest peak in the periodogram, based on the null hypothesis\n        of non-varying data with Gaussian noise.\n\n        Parameters\n        ----------\n        power : array-like\n            The periodogram value.\n        method : {'baluev', 'davies', 'naive', 'bootstrap'}, optional\n            The approximation method to use.\n        maximum_frequency : float\n            The maximum frequency of the periodogram.\n        method_kwds : dict, optional\n            Additional method-specific keywords.\n\n        Returns\n        -------\n        false_alarm_probability : np.ndarray\n            The false alarm probability\n\n        Notes\n        -----\n        The true probability distribution for the largest peak cannot be\n        determined analytically, so each method here provides an approximation\n        to the value. The available methods are:\n\n        - \"baluev\" (default): the upper-limit to the alias-free probability,\n          using the approach of Baluev (2008) [1]_.\n        - \"davies\" : the Davies upper bound from Baluev (2008) [1]_.\n        - \"naive\" : the approximate probability based on an estimated\n          effective number of independent frequencies.\n        - \"bootstrap\" : the approximate probability based on bootstrap\n          resamplings of the input data.\n\n        Note also that for normalization='psd', the distribution can only be\n        computed for periodograms constructed with errors specified.\n\n        See Also\n        --------\n        distribution\n        false_alarm_level\n\n        References\n        ----------\n        .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n        \"\"\"\n        if self.nterms != 1:\n            raise NotImplementedError(\"false alarm probability is not \"\n                                      \"implemented for multiterm periodograms.\")\n        if not (self.fit_mean or self.center_data):\n            raise NotImplementedError(\"false alarm probability is implemented \"\n                                      \"only for periodograms of centered data.\")\n\n        fmin, fmax = self.autofrequency(samples_per_peak=samples_per_peak,\n                                        nyquist_factor=nyquist_factor,\n                                        minimum_frequency=minimum_frequency,\n                                        maximum_frequency=maximum_frequency,\n                                        return_freq_limits=True)\n        return _statistics.false_alarm_probability(power,\n                                                   fmax=fmax,\n                                                   t=self._trel, y=self.y, dy=self.dy,\n                                                   normalization=self.normalization,\n                                                   method=method,\n                                                   method_kwds=method_kwds)\n\n    def false_alarm_level(self, false_alarm_probability, method='baluev',\n                          samples_per_peak=5, nyquist_factor=5,\n                          minimum_frequency=None, maximum_frequency=None,\n                          method_kwds=None):\n        \"\"\"Level of maximum at a given false alarm probability.\n\n        This gives an estimate of the periodogram level corresponding to a\n        specified false alarm probability for the largest peak, assuming a\n        null hypothesis of non-varying data with Gaussian noise.\n\n        Parameters\n        ----------\n        false_alarm_probability : array-like\n            The false alarm probability (0 < fap < 1).\n        maximum_frequency : float\n            The maximum frequency of the periodogram.\n        method : {'baluev', 'davies', 'naive', 'bootstrap'}, optional\n            The approximation method to use; default='baluev'.\n        method_kwds : dict, optional\n            Additional method-specific keywords.\n\n        Returns\n        -------\n        power : np.ndarray\n            The periodogram peak height corresponding to the specified\n            false alarm probability.\n\n        Notes\n        -----\n        The true probability distribution for the largest peak cannot be\n        determined analytically, so each method here provides an approximation\n        to the value. The available methods are:\n\n        - \"baluev\" (default): the upper-limit to the alias-free probability,\n          using the approach of Baluev (2008) [1]_.\n        - \"davies\" : the Davies upper bound from Baluev (2008) [1]_.\n        - \"naive\" : the approximate probability based on an estimated\n          effective number of independent frequencies.\n        - \"bootstrap\" : the approximate probability based on bootstrap\n          resamplings of the input data.\n\n        Note also that for normalization='psd', the distribution can only be\n        computed for periodograms constructed with errors specified.\n\n        See Also\n        --------\n        distribution\n        false_alarm_probability\n\n        References\n        ----------\n        .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n        \"\"\"\n        if self.nterms != 1:\n            raise NotImplementedError(\"false alarm probability is not \"\n                                      \"implemented for multiterm periodograms.\")\n        if not (self.fit_mean or self.center_data):\n            raise NotImplementedError(\"false alarm probability is implemented \"\n                                      \"only for periodograms of centered data.\")\n\n        fmin, fmax = self.autofrequency(samples_per_peak=samples_per_peak,\n                                        nyquist_factor=nyquist_factor,\n                                        minimum_frequency=minimum_frequency,\n                                        maximum_frequency=maximum_frequency,\n                                        return_freq_limits=True)\n        return _statistics.false_alarm_level(false_alarm_probability,\n                                             fmax=fmax,\n                                             t=self._trel, y=self.y, dy=self.dy,\n                                             normalization=self.normalization,\n                                             method=method,\n                                             method_kwds=method_kwds)"},{"className":"TimeEpochDate","col":0,"comment":"\n    Base class for support floating point Besselian and Julian epoch dates\n    ","endLoc":1737,"id":8849,"nodeType":"Class","startLoc":1720,"text":"class TimeEpochDate(TimeNumeric):\n    \"\"\"\n    Base class for support floating point Besselian and Julian epoch dates\n    \"\"\"\n    _default_scale = 'tt'  # As of astropy 3.2, this is no longer 'utc'.\n\n    def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # validate scale.\n        epoch_to_jd = getattr(erfa, self.epoch_to_jd)\n        jd1, jd2 = epoch_to_jd(val1 + val2)\n        self.jd1, self.jd2 = day_frac(jd1, jd2)\n\n    def to_value(self, **kwargs):\n        jd_to_epoch = getattr(erfa, self.jd_to_epoch)\n        value = jd_to_epoch(self.jd1, self.jd2)\n        return super().to_value(jd1=value, jd2=np.float64(0.0), **kwargs)\n\n    value = property(to_value)"},{"col":4,"comment":"null","endLoc":1730,"header":"def set_jds(self, val1, val2)","id":8850,"name":"set_jds","nodeType":"Function","startLoc":1726,"text":"def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # validate scale.\n        epoch_to_jd = getattr(erfa, self.epoch_to_jd)\n        jd1, jd2 = epoch_to_jd(val1 + val2)\n        self.jd1, self.jd2 = day_frac(jd1, jd2)"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":21,"id":8851,"name":"datatables_url","nodeType":"Attribute","startLoc":21,"text":"datatables_url"},{"col":0,"comment":"Bottleneck nanmean function that handle tuple axis.","endLoc":58,"header":"def _nanmean(array, axis=None)","id":8852,"name":"_nanmean","nodeType":"Function","startLoc":48,"text":"def _nanmean(array, axis=None):\n    \"\"\"Bottleneck nanmean function that handle tuple axis.\"\"\"\n\n    if isinstance(axis, tuple):\n        array = _move_tuple_axes_first(array, axis=axis)\n        axis = 0\n\n    if isinstance(array, Quantity):\n        return array.__array_wrap__(bottleneck.nanmean(array, axis=axis))\n    else:\n        return bottleneck.nanmean(array, axis=axis)"},{"col":0,"comment":"\n    Bottleneck can only take integer axis, not tuple, so this function\n    takes all the axes to be operated on and combines them into the\n    first dimension of the array so that we can then use axis=0.\n    ","endLoc":45,"header":"def _move_tuple_axes_first(array, axis)","id":8853,"name":"_move_tuple_axes_first","nodeType":"Function","startLoc":22,"text":"def _move_tuple_axes_first(array, axis):\n    \"\"\"\n    Bottleneck can only take integer axis, not tuple, so this function\n    takes all the axes to be operated on and combines them into the\n    first dimension of the array so that we can then use axis=0.\n    \"\"\"\n    # Figure out how many axes we are operating over\n    naxis = len(axis)\n\n    # Add remaining axes to the axis tuple\n    axis += tuple(i for i in range(array.ndim) if i not in axis)\n\n    # The new position of each axis is just in order\n    destination = tuple(range(array.ndim))\n\n    # Reorder the array so that the axes being operated on are at the\n    # beginning\n    array_new = np.moveaxis(array, axis, destination)\n\n    # Collapse the dimensions being operated on into a single dimension\n    # so that we can then use axis=0 with the bottleneck functions\n    array_new = array_new.reshape((-1,) + array_new.shape[naxis:])\n\n    return array_new"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":25,"id":8854,"name":"css_urls","nodeType":"Attribute","startLoc":25,"text":"css_urls"},{"col":4,"comment":"Return the bin edges given M number of bins","endLoc":380,"header":"def bins(self, M)","id":8855,"name":"bins","nodeType":"Function","startLoc":378,"text":"def bins(self, M):\n        \"\"\"Return the bin edges given M number of bins\"\"\"\n        return np.linspace(self.data[0], self.data[-1], int(M) + 1)"},{"col":0,"comment":"Bottleneck nanmedian function that handle tuple axis.","endLoc":71,"header":"def _nanmedian(array, axis=None)","id":8856,"name":"_nanmedian","nodeType":"Function","startLoc":61,"text":"def _nanmedian(array, axis=None):\n    \"\"\"Bottleneck nanmedian function that handle tuple axis.\"\"\"\n\n    if isinstance(axis, tuple):\n        array = _move_tuple_axes_first(array, axis=axis)\n        axis = 0\n\n    if isinstance(array, Quantity):\n        return array.__array_wrap__(bottleneck.nanmedian(array, axis=axis))\n    else:\n        return bottleneck.nanmedian(array, axis=axis)"},{"col":4,"comment":"null","endLoc":383,"header":"def __call__(self, M)","id":8857,"name":"__call__","nodeType":"Function","startLoc":382,"text":"def __call__(self, M):\n        return self.eval(M)"},{"col":4,"comment":"Evaluate the Knuth function\n\n        Parameters\n        ----------\n        M : int\n            Number of bins\n\n        Returns\n        -------\n        F : float\n            evaluation of the negative Knuth loglikelihood function:\n            smaller values indicate a better fit.\n        ","endLoc":411,"header":"def eval(self, M)","id":8858,"name":"eval","nodeType":"Function","startLoc":385,"text":"def eval(self, M):\n        \"\"\"Evaluate the Knuth function\n\n        Parameters\n        ----------\n        M : int\n            Number of bins\n\n        Returns\n        -------\n        F : float\n            evaluation of the negative Knuth loglikelihood function:\n            smaller values indicate a better fit.\n        \"\"\"\n        M = int(M)\n\n        if M <= 0:\n            return np.inf\n\n        bins = self.bins(M)\n        nk, bins = np.histogram(self.data, bins)\n\n        return -(self.n * np.log(M) +\n                 self.gammaln(0.5 * M) -\n                 M * self.gammaln(0.5) -\n                 self.gammaln(self.n + 0.5 * M) +\n                 np.sum(self.gammaln(nk + 0.5)))"},{"className":"JSViewer","col":0,"comment":"Provides an interactive HTML export of a Table.\n\n    This class provides an interface to the `DataTables\n    <https://datatables.net/>`_ library, which allow to visualize interactively\n    an HTML table. It is used by the `~astropy.table.Table.show_in_browser`\n    method.\n\n    Parameters\n    ----------\n    use_local_files : bool, optional\n        Use local files or a CDN for JavaScript libraries. Default False.\n    display_length : int, optional\n        Number or rows to show. Default to 50.\n\n    ","endLoc":169,"id":8859,"nodeType":"Class","startLoc":108,"text":"class JSViewer:\n    \"\"\"Provides an interactive HTML export of a Table.\n\n    This class provides an interface to the `DataTables\n    <https://datatables.net/>`_ library, which allow to visualize interactively\n    an HTML table. It is used by the `~astropy.table.Table.show_in_browser`\n    method.\n\n    Parameters\n    ----------\n    use_local_files : bool, optional\n        Use local files or a CDN for JavaScript libraries. Default False.\n    display_length : int, optional\n        Number or rows to show. Default to 50.\n\n    \"\"\"\n\n    def __init__(self, use_local_files=False, display_length=50):\n        self._use_local_files = use_local_files\n        self.display_length_menu = [[10, 25, 50, 100, 500, 1000, -1],\n                                    [10, 25, 50, 100, 500, 1000, \"All\"]]\n        self.display_length = display_length\n        for L in self.display_length_menu:\n            if display_length not in L:\n                L.insert(0, display_length)\n\n    @property\n    def jquery_urls(self):\n        if self._use_local_files:\n            return ['file://' + join(EXTERN_JS_DIR, 'jquery-3.1.1.min.js'),\n                    'file://' + join(EXTERN_JS_DIR, 'jquery.dataTables.min.js')]\n        else:\n            return [conf.jquery_url, conf.datatables_url]\n\n    @property\n    def css_urls(self):\n        if self._use_local_files:\n            return ['file://' + join(EXTERN_CSS_DIR,\n                                     'jquery.dataTables.css')]\n        else:\n            return conf.css_urls\n\n    def _jstable_file(self):\n        if self._use_local_files:\n            return 'file://' + join(EXTERN_JS_DIR, 'jquery.dataTables.min')\n        else:\n            return conf.datatables_url[:-3]\n\n    def ipynb(self, table_id, css=None, sort_columns='[]'):\n        html = f'<style>{css if css is not None else DEFAULT_CSS_NB}</style>'\n        html += IPYNB_JS_SCRIPT.format(\n            display_length=self.display_length,\n            display_length_menu=self.display_length_menu,\n            datatables_url=self._jstable_file(),\n            tid=table_id, sort_columns=sort_columns)\n        return html\n\n    def html_js(self, table_id='table0', sort_columns='[]'):\n        return HTML_JS_SCRIPT.format(\n            display_length=self.display_length,\n            display_length_menu=self.display_length_menu,\n            tid=table_id, sort_columns=sort_columns).strip()"},{"col":4,"comment":"null","endLoc":140,"header":"@property\n    def jquery_urls(self)","id":8860,"name":"jquery_urls","nodeType":"Function","startLoc":134,"text":"@property\n    def jquery_urls(self):\n        if self._use_local_files:\n            return ['file://' + join(EXTERN_JS_DIR, 'jquery-3.1.1.min.js'),\n                    'file://' + join(EXTERN_JS_DIR, 'jquery.dataTables.min.js')]\n        else:\n            return [conf.jquery_url, conf.datatables_url]"},{"col":4,"comment":"null","endLoc":1735,"header":"def to_value(self, **kwargs)","id":8861,"name":"to_value","nodeType":"Function","startLoc":1732,"text":"def to_value(self, **kwargs):\n        jd_to_epoch = getattr(erfa, self.jd_to_epoch)\n        value = jd_to_epoch(self.jd1, self.jd2)\n        return super().to_value(jd1=value, jd2=np.float64(0.0), **kwargs)"},{"col":4,"comment":"null","endLoc":148,"header":"@property\n    def css_urls(self)","id":8862,"name":"css_urls","nodeType":"Function","startLoc":142,"text":"@property\n    def css_urls(self):\n        if self._use_local_files:\n            return ['file://' + join(EXTERN_CSS_DIR,\n                                     'jquery.dataTables.css')]\n        else:\n            return conf.css_urls"},{"col":4,"comment":"null","endLoc":154,"header":"def _jstable_file(self)","id":8863,"name":"_jstable_file","nodeType":"Function","startLoc":150,"text":"def _jstable_file(self):\n        if self._use_local_files:\n            return 'file://' + join(EXTERN_JS_DIR, 'jquery.dataTables.min')\n        else:\n            return conf.datatables_url[:-3]"},{"col":4,"comment":"null","endLoc":163,"header":"def ipynb(self, table_id, css=None, sort_columns='[]')","id":8864,"name":"ipynb","nodeType":"Function","startLoc":156,"text":"def ipynb(self, table_id, css=None, sort_columns='[]'):\n        html = f'<style>{css if css is not None else DEFAULT_CSS_NB}</style>'\n        html += IPYNB_JS_SCRIPT.format(\n            display_length=self.display_length,\n            display_length_menu=self.display_length_menu,\n            datatables_url=self._jstable_file(),\n            tid=table_id, sort_columns=sort_columns)\n        return html"},{"attributeType":"null","col":4,"comment":"null","endLoc":1724,"id":8865,"name":"_default_scale","nodeType":"Attribute","startLoc":1724,"text":"_default_scale"},{"attributeType":"null","col":4,"comment":"null","endLoc":1737,"id":8866,"name":"value","nodeType":"Attribute","startLoc":1737,"text":"value"},{"attributeType":"null","col":8,"comment":"null","endLoc":1730,"id":8867,"name":"jd1","nodeType":"Attribute","startLoc":1730,"text":"self.jd1"},{"col":0,"comment":"mad_std function that ignores NaNs by default.","endLoc":90,"header":"def _nanmadstd(array, axis=None)","id":8868,"name":"_nanmadstd","nodeType":"Function","startLoc":88,"text":"def _nanmadstd(array, axis=None):\n    \"\"\"mad_std function that ignores NaNs by default.\"\"\"\n    return mad_std(array, axis=axis, ignore_nan=True)"},{"col":0,"comment":"Bottleneck nanstd function that handle tuple axis.","endLoc":85,"header":"def _nanstd(array, axis=None, ddof=0)","id":8869,"name":"_nanstd","nodeType":"Function","startLoc":74,"text":"def _nanstd(array, axis=None, ddof=0):\n    \"\"\"Bottleneck nanstd function that handle tuple axis.\"\"\"\n\n    if isinstance(axis, tuple):\n        array = _move_tuple_axes_first(array, axis=axis)\n        axis = 0\n\n    if isinstance(array, Quantity):\n        return array.__array_wrap__(bottleneck.nanstd(array, axis=axis,\n                                                      ddof=ddof))\n    else:\n        return bottleneck.nanstd(array, axis=axis, ddof=ddof)"},{"col":4,"comment":"\n        Fast C implementation for simple use cases.\n        ","endLoc":391,"header":"def _sigmaclip_fast(self, data, axis=None,\n                        masked=True, return_bounds=False,\n                        copy=True)","id":8870,"name":"_sigmaclip_fast","nodeType":"Function","startLoc":307,"text":"def _sigmaclip_fast(self, data, axis=None,\n                        masked=True, return_bounds=False,\n                        copy=True):\n        \"\"\"\n        Fast C implementation for simple use cases.\n        \"\"\"\n        if isinstance(data, Quantity):\n            data, unit = data.value, data.unit\n        else:\n            unit = None\n\n        if copy is False and masked is False and data.dtype.kind != 'f':\n            raise Exception(\"cannot mask non-floating-point array with NaN \"\n                            \"values, set copy=True or masked=True to avoid \"\n                            \"this.\")\n\n        if axis is None:\n            axis = -1 if data.ndim == 1 else tuple(range(data.ndim))\n\n        if not isiterable(axis):\n            axis = normalize_axis_index(axis, data.ndim)\n            data_reshaped = data\n            transposed_shape = None\n        else:\n            # The gufunc implementation does not handle non-scalar axis\n            # so we combine the dimensions together as the last\n            # dimension and set axis=-1\n            axis = tuple(normalize_axis_index(ax, data.ndim) for ax in axis)\n            transposed_axes = tuple(ax for ax in range(data.ndim)\n                                    if ax not in axis) + axis\n            data_transposed = data.transpose(transposed_axes)\n            transposed_shape = data_transposed.shape\n            data_reshaped = data_transposed.reshape(\n                transposed_shape[:data.ndim - len(axis)] + (-1,))\n            axis = -1\n\n        if data_reshaped.dtype.kind != 'f' or data_reshaped.dtype.itemsize > 8:\n            data_reshaped = data_reshaped.astype(float)\n\n        mask = ~np.isfinite(data_reshaped)\n        if np.any(mask):\n            warnings.warn('Input data contains invalid values (NaNs or '\n                          'infs), which were automatically clipped.',\n                          AstropyUserWarning)\n\n        if isinstance(data_reshaped, np.ma.MaskedArray):\n            mask |= data_reshaped.mask\n            data = data.view(np.ndarray)\n            data_reshaped = data_reshaped.view(np.ndarray)\n            mask = np.broadcast_to(mask, data_reshaped.shape).copy()\n\n        bound_lo, bound_hi = _sigma_clip_fast(\n            data_reshaped, mask, self.cenfunc == 'median',\n            self.stdfunc == 'mad_std',\n            -1 if np.isinf(self.maxiters) else self.maxiters,\n            self.sigma_lower, self.sigma_upper, axis=axis)\n\n        with np.errstate(invalid='ignore'):\n            mask |= data_reshaped < np.expand_dims(bound_lo, axis)\n            mask |= data_reshaped > np.expand_dims(bound_hi, axis)\n\n        if transposed_shape is not None:\n            # Get mask in shape of data.\n            mask = mask.reshape(transposed_shape)\n            mask = mask.transpose(tuple(transposed_axes.index(ax)\n                                        for ax in range(data.ndim)))\n\n        if masked:\n            result = np.ma.array(data, mask=mask, copy=copy)\n        else:\n            if copy:\n                result = data.astype(float, copy=True)\n            else:\n                result = data\n            result[mask] = np.nan\n\n        if unit is not None:\n            result = result << unit\n            bound_lo = bound_lo << unit\n            bound_hi = bound_hi << unit\n\n        if return_bounds:\n            return result, bound_lo, bound_hi\n        else:\n            return result"},{"attributeType":"null","col":18,"comment":"null","endLoc":1730,"id":8871,"name":"jd2","nodeType":"Attribute","startLoc":1730,"text":"self.jd2"},{"className":"BasePeriodogram","col":0,"comment":"null","endLoc":56,"id":8872,"nodeType":"Class","startLoc":8,"text":"class BasePeriodogram:\n\n    @abc.abstractmethod\n    def __init__(self, t, y, dy=None):\n        pass\n\n    @classmethod\n    def from_timeseries(cls, timeseries, signal_column_name=None, uncertainty=None, **kwargs):\n        \"\"\"\n        Initialize a periodogram from a time series object.\n\n        If a binned time series is passed, the time at the center of the bins is\n        used. Also note that this method automatically gets rid of NaN/undefined\n        values when initializing the periodogram.\n\n        Parameters\n        ----------\n        signal_column_name : str\n            The name of the column containing the signal values to use.\n        uncertainty : str or float or `~astropy.units.Quantity`, optional\n            The name of the column containing the errors on the signal, or the\n            value to use for the error, if a scalar.\n        **kwargs\n            Additional keyword arguments are passed to the initializer for this\n            periodogram class.\n        \"\"\"\n\n        if signal_column_name is None:\n            raise ValueError('signal_column_name should be set to a valid column name')\n\n        y = timeseries[signal_column_name]\n        keep = ~np.isnan(y)\n\n        if isinstance(uncertainty, str):\n            dy = timeseries[uncertainty]\n            keep &= ~np.isnan(dy)\n            dy = dy[keep]\n        else:\n            dy = uncertainty\n\n        if isinstance(timeseries, TimeSeries):\n            time = timeseries.time\n        elif isinstance(timeseries, BinnedTimeSeries):\n            time = timeseries.time_bin_center\n        else:\n            raise TypeError('Input time series should be an instance of '\n                            'TimeSeries or BinnedTimeSeries')\n\n        return cls(time[keep], y[keep], dy=dy, **kwargs)"},{"className":"TimeBesselianEpoch","col":0,"comment":"Besselian Epoch year as floating point value(s) like 1950.0","endLoc":1753,"id":8873,"nodeType":"Class","startLoc":1740,"text":"class TimeBesselianEpoch(TimeEpochDate):\n    \"\"\"Besselian Epoch year as floating point value(s) like 1950.0\"\"\"\n    name = 'byear'\n    epoch_to_jd = 'epb2jd'\n    jd_to_epoch = 'epb'\n\n    def _check_val_type(self, val1, val2):\n        \"\"\"Input value validation, typically overridden by derived classes\"\"\"\n        if hasattr(val1, 'to') and hasattr(val1, 'unit'):\n            raise ValueError(\"Cannot use Quantities for 'byear' format, \"\n                             \"as the interpretation would be ambiguous. \"\n                             \"Use float with Besselian year instead. \")\n        # FIXME: is val2 really okay here?\n        return super()._check_val_type(val1, val2)"},{"col":4,"comment":"null","endLoc":12,"header":"@abc.abstractmethod\n    def __init__(self, t, y, dy=None)","id":8874,"name":"__init__","nodeType":"Function","startLoc":10,"text":"@abc.abstractmethod\n    def __init__(self, t, y, dy=None):\n        pass"},{"col":4,"comment":"\n        Initialize a periodogram from a time series object.\n\n        If a binned time series is passed, the time at the center of the bins is\n        used. Also note that this method automatically gets rid of NaN/undefined\n        values when initializing the periodogram.\n\n        Parameters\n        ----------\n        signal_column_name : str\n            The name of the column containing the signal values to use.\n        uncertainty : str or float or `~astropy.units.Quantity`, optional\n            The name of the column containing the errors on the signal, or the\n            value to use for the error, if a scalar.\n        **kwargs\n            Additional keyword arguments are passed to the initializer for this\n            periodogram class.\n        ","endLoc":56,"header":"@classmethod\n    def from_timeseries(cls, timeseries, signal_column_name=None, uncertainty=None, **kwargs)","id":8875,"name":"from_timeseries","nodeType":"Function","startLoc":14,"text":"@classmethod\n    def from_timeseries(cls, timeseries, signal_column_name=None, uncertainty=None, **kwargs):\n        \"\"\"\n        Initialize a periodogram from a time series object.\n\n        If a binned time series is passed, the time at the center of the bins is\n        used. Also note that this method automatically gets rid of NaN/undefined\n        values when initializing the periodogram.\n\n        Parameters\n        ----------\n        signal_column_name : str\n            The name of the column containing the signal values to use.\n        uncertainty : str or float or `~astropy.units.Quantity`, optional\n            The name of the column containing the errors on the signal, or the\n            value to use for the error, if a scalar.\n        **kwargs\n            Additional keyword arguments are passed to the initializer for this\n            periodogram class.\n        \"\"\"\n\n        if signal_column_name is None:\n            raise ValueError('signal_column_name should be set to a valid column name')\n\n        y = timeseries[signal_column_name]\n        keep = ~np.isnan(y)\n\n        if isinstance(uncertainty, str):\n            dy = timeseries[uncertainty]\n            keep &= ~np.isnan(dy)\n            dy = dy[keep]\n        else:\n            dy = uncertainty\n\n        if isinstance(timeseries, TimeSeries):\n            time = timeseries.time\n        elif isinstance(timeseries, BinnedTimeSeries):\n            time = timeseries.time_bin_center\n        else:\n            raise TypeError('Input time series should be an instance of '\n                            'TimeSeries or BinnedTimeSeries')\n\n        return cls(time[keep], y[keep], dy=dy, **kwargs)"},{"col":4,"comment":"Input value validation, typically overridden by derived classes","endLoc":1753,"header":"def _check_val_type(self, val1, val2)","id":8876,"name":"_check_val_type","nodeType":"Function","startLoc":1746,"text":"def _check_val_type(self, val1, val2):\n        \"\"\"Input value validation, typically overridden by derived classes\"\"\"\n        if hasattr(val1, 'to') and hasattr(val1, 'unit'):\n            raise ValueError(\"Cannot use Quantities for 'byear' format, \"\n                             \"as the interpretation would be ambiguous. \"\n                             \"Use float with Besselian year instead. \")\n        # FIXME: is val2 really okay here?\n        return super()._check_val_type(val1, val2)"},{"attributeType":"null","col":8,"comment":"null","endLoc":376,"id":8877,"name":"gammaln","nodeType":"Attribute","startLoc":376,"text":"self.gammaln"},{"attributeType":"null","col":8,"comment":"null","endLoc":364,"id":8878,"name":"data","nodeType":"Attribute","startLoc":364,"text":"self.data"},{"attributeType":"null","col":8,"comment":"null","endLoc":368,"id":8879,"name":"n","nodeType":"Attribute","startLoc":368,"text":"self.n"},{"col":4,"comment":"null","endLoc":169,"header":"def html_js(self, table_id='table0', sort_columns='[]')","id":8880,"name":"html_js","nodeType":"Function","startLoc":165,"text":"def html_js(self, table_id='table0', sort_columns='[]'):\n        return HTML_JS_SCRIPT.format(\n            display_length=self.display_length,\n            display_length_menu=self.display_length_menu,\n            tid=table_id, sort_columns=sort_columns).strip()"},{"col":0,"comment":"\n    Calculate histogram bin edges like ``numpy.histogram_bin_edges``.\n\n    Parameters\n    ----------\n\n    a : array-like\n        Input data. The bin edges are calculated over the flattened array.\n\n    bins : int, list, or str, optional\n        If ``bins`` is an int, it is the number of bins. If it is a list\n        it is taken to be the bin edges. If it is a string, it must be one\n        of  'blocks', 'knuth', 'scott' or 'freedman'. See\n        `~astropy.stats.histogram` for a description of each method.\n\n    range : tuple or None, optional\n        The minimum and maximum range for the histogram.  If not specified,\n        it will be (a.min(), a.max()). However, if bins is a list it is\n        returned unmodified regardless of the range argument.\n\n    weights : array-like, optional\n        An array the same shape as ``a``. If given, the histogram accumulates\n        the value of the weight corresponding to ``a`` instead of returning the\n        count of values. This argument does not affect determination of bin\n        edges, though they may be used in the future as new methods are added.\n    ","endLoc":83,"header":"def calculate_bin_edges(a, bins=10, range=None, weights=None)","id":8881,"name":"calculate_bin_edges","nodeType":"Function","startLoc":16,"text":"def calculate_bin_edges(a, bins=10, range=None, weights=None):\n    \"\"\"\n    Calculate histogram bin edges like ``numpy.histogram_bin_edges``.\n\n    Parameters\n    ----------\n\n    a : array-like\n        Input data. The bin edges are calculated over the flattened array.\n\n    bins : int, list, or str, optional\n        If ``bins`` is an int, it is the number of bins. If it is a list\n        it is taken to be the bin edges. If it is a string, it must be one\n        of  'blocks', 'knuth', 'scott' or 'freedman'. See\n        `~astropy.stats.histogram` for a description of each method.\n\n    range : tuple or None, optional\n        The minimum and maximum range for the histogram.  If not specified,\n        it will be (a.min(), a.max()). However, if bins is a list it is\n        returned unmodified regardless of the range argument.\n\n    weights : array-like, optional\n        An array the same shape as ``a``. If given, the histogram accumulates\n        the value of the weight corresponding to ``a`` instead of returning the\n        count of values. This argument does not affect determination of bin\n        edges, though they may be used in the future as new methods are added.\n    \"\"\"\n    # if range is specified, we need to truncate the data for\n    # the bin-finding routines\n    if range is not None:\n        a = a[(a >= range[0]) & (a <= range[1])]\n\n    # if bins is a string, first compute bin edges with the desired heuristic\n    if isinstance(bins, str):\n        a = np.asarray(a).ravel()\n\n        # TODO: if weights is specified, we need to modify things.\n        #       e.g. we could use point measures fitness for Bayesian blocks\n        if weights is not None:\n            raise NotImplementedError(\"weights are not yet supported \"\n                                      \"for the enhanced histogram\")\n\n        if bins == 'blocks':\n            bins = bayesian_blocks(a)\n        elif bins == 'knuth':\n            da, bins = knuth_bin_width(a, True)\n        elif bins == 'scott':\n            da, bins = scott_bin_width(a, True)\n        elif bins == 'freedman':\n            da, bins = freedman_bin_width(a, True)\n        else:\n            raise ValueError(f\"unrecognized bin code: '{bins}'\")\n\n        if range:\n            # Check that the upper and lower edges are what was requested.\n            # The current implementation of the bin width estimators does not\n            # guarantee this, it only ensures that data outside the range is\n            # excluded from calculation of the bin widths.\n            if bins[0] != range[0]:\n                bins[0] = range[0]\n            if bins[-1] != range[1]:\n                bins[-1] = range[1]\n\n    elif np.ndim(bins) == 0:\n        # Number of bins was given\n        bins = np.histogram_bin_edges(a, bins, range=range, weights=weights)\n\n    return bins"},{"attributeType":"null","col":8,"comment":"null","endLoc":129,"id":8882,"name":"display_length","nodeType":"Attribute","startLoc":129,"text":"self.display_length"},{"col":4,"comment":"null","endLoc":131,"header":"def __init__(self, t, y, dy=None, fit_mean=True, center_data=True,\n                 nterms=1, normalization='standard')","id":8883,"name":"__init__","nodeType":"Function","startLoc":104,"text":"def __init__(self, t, y, dy=None, fit_mean=True, center_data=True,\n                 nterms=1, normalization='standard'):\n\n        # If t is a TimeDelta, convert it to a quantity. The units we convert\n        # to don't really matter since the user gets a Quantity back at the end\n        # so can convert to any units they like.\n        if isinstance(t, TimeDelta):\n            t = t.to('day')\n\n        # We want to expose self.t as being the times the user passed in, but\n        # if the times are absolute, we need to convert them to relative times\n        # internally, so we use self._trel and self._tstart for this.\n\n        self.t = t\n\n        if isinstance(self.t, Time):\n            self._tstart = self.t[0]\n            trel = (self.t - self._tstart).to(u.day)\n        else:\n            self._tstart = None\n            trel = self.t\n\n        self._trel, self.y, self.dy = self._validate_inputs(trel, y, dy)\n\n        self.fit_mean = fit_mean\n        self.center_data = center_data\n        self.nterms = nterms\n        self.normalization = normalization"},{"attributeType":"null","col":8,"comment":"null","endLoc":126,"id":8884,"name":"_use_local_files","nodeType":"Attribute","startLoc":126,"text":"self._use_local_files"},{"attributeType":"null","col":8,"comment":"null","endLoc":127,"id":8885,"name":"display_length_menu","nodeType":"Attribute","startLoc":127,"text":"self.display_length_menu"},{"col":0,"comment":"null","endLoc":197,"header":"def write_table_jsviewer(table, filename, table_id=None, max_lines=5000,\n                         table_class=\"display compact\", jskwargs=None,\n                         css=DEFAULT_CSS, htmldict=None, overwrite=False)","id":8886,"name":"write_table_jsviewer","nodeType":"Function","startLoc":172,"text":"def write_table_jsviewer(table, filename, table_id=None, max_lines=5000,\n                         table_class=\"display compact\", jskwargs=None,\n                         css=DEFAULT_CSS, htmldict=None, overwrite=False):\n    if table_id is None:\n        table_id = f'table{id(table)}'\n\n    jskwargs = jskwargs or {}\n    jsv = JSViewer(**jskwargs)\n\n    sortable_columns = [i for i, col in enumerate(table.columns.values())\n                        if col.info.dtype.kind in 'iufc']\n    html_options = {\n        'table_id': table_id,\n        'table_class': table_class,\n        'css': css,\n        'cssfiles': jsv.css_urls,\n        'jsfiles': jsv.jquery_urls,\n        'js': jsv.html_js(table_id=table_id, sort_columns=sortable_columns)\n    }\n    if htmldict:\n        html_options.update(htmldict)\n\n    if max_lines < len(table):\n        table = table[:max_lines]\n    table.write(filename, format='html', htmldict=html_options,\n                overwrite=overwrite)"},{"col":0,"comment":"Return the optimal histogram bin width using Knuth's rule.\n\n    Knuth's rule is a fixed-width, Bayesian approach to determining\n    the optimal bin width of a histogram.\n\n    Parameters\n    ----------\n    data : array-like, ndim=1\n        observed (one-dimensional) data\n    return_bins : bool, optional\n        if True, then return the bin edges\n    quiet : bool, optional\n        if True (default) then suppress stdout output from scipy.optimize\n\n    Returns\n    -------\n    dx : float\n        optimal bin width. Bins are measured starting at the first data point.\n    bins : ndarray\n        bin edges: returned if ``return_bins`` is True\n\n    Notes\n    -----\n    The optimal number of bins is the value M which maximizes the function\n\n    .. math::\n        F(M|x,I) = n\\log(M) + \\log\\Gamma(\\frac{M}{2})\n        - M\\log\\Gamma(\\frac{1}{2})\n        - \\log\\Gamma(\\frac{2n+M}{2})\n        + \\sum_{k=1}^M \\log\\Gamma(n_k + \\frac{1}{2})\n\n    where :math:`\\Gamma` is the Gamma function, :math:`n` is the number of\n    data points, :math:`n_k` is the number of measurements in bin :math:`k`\n    [1]_.\n\n    References\n    ----------\n    .. [1] Knuth, K.H. \"Optimal Data-Based Binning for Histograms\".\n       arXiv:0605197, 2006\n\n    See Also\n    --------\n    freedman_bin_width\n    scott_bin_width\n    bayesian_blocks\n    histogram\n    ","endLoc":335,"header":"def knuth_bin_width(data, return_bins=False, quiet=True)","id":8887,"name":"knuth_bin_width","nodeType":"Function","startLoc":275,"text":"def knuth_bin_width(data, return_bins=False, quiet=True):\n    r\"\"\"Return the optimal histogram bin width using Knuth's rule.\n\n    Knuth's rule is a fixed-width, Bayesian approach to determining\n    the optimal bin width of a histogram.\n\n    Parameters\n    ----------\n    data : array-like, ndim=1\n        observed (one-dimensional) data\n    return_bins : bool, optional\n        if True, then return the bin edges\n    quiet : bool, optional\n        if True (default) then suppress stdout output from scipy.optimize\n\n    Returns\n    -------\n    dx : float\n        optimal bin width. Bins are measured starting at the first data point.\n    bins : ndarray\n        bin edges: returned if ``return_bins`` is True\n\n    Notes\n    -----\n    The optimal number of bins is the value M which maximizes the function\n\n    .. math::\n        F(M|x,I) = n\\log(M) + \\log\\Gamma(\\frac{M}{2})\n        - M\\log\\Gamma(\\frac{1}{2})\n        - \\log\\Gamma(\\frac{2n+M}{2})\n        + \\sum_{k=1}^M \\log\\Gamma(n_k + \\frac{1}{2})\n\n    where :math:`\\Gamma` is the Gamma function, :math:`n` is the number of\n    data points, :math:`n_k` is the number of measurements in bin :math:`k`\n    [1]_.\n\n    References\n    ----------\n    .. [1] Knuth, K.H. \"Optimal Data-Based Binning for Histograms\".\n       arXiv:0605197, 2006\n\n    See Also\n    --------\n    freedman_bin_width\n    scott_bin_width\n    bayesian_blocks\n    histogram\n    \"\"\"\n    # import here because of optional scipy dependency\n    from scipy import optimize\n\n    knuthF = _KnuthF(data)\n    dx0, bins0 = freedman_bin_width(data, True)\n    M = optimize.fmin(knuthF, len(bins0), disp=not quiet)[0]\n    bins = knuthF.bins(M)\n    dx = bins[1] - bins[0]\n\n    if return_bins:\n        return dx, bins\n    else:\n        return dx"},{"col":4,"comment":"null","endLoc":111,"header":"def __init__(self, t, y, dy=None)","id":8888,"name":"__init__","nodeType":"Function","startLoc":90,"text":"def __init__(self, t, y, dy=None):\n\n        # If t is a TimeDelta, convert it to a quantity. The units we convert\n        # to don't really matter since the user gets a Quantity back at the end\n        # so can convert to any units they like.\n        if isinstance(t, TimeDelta):\n            t = t.to('day')\n\n        # We want to expose self.t as being the times the user passed in, but\n        # if the times are absolute, we need to convert them to relative times\n        # internally, so we use self._trel and self._tstart for this.\n\n        self.t = t\n\n        if isinstance(self.t, (Time, TimeDelta)):\n            self._tstart = self.t[0]\n            trel = (self.t - self._tstart).to(u.day)\n        else:\n            self._tstart = None\n            trel = self.t\n\n        self._trel, self.y, self.dy = self._validate_inputs(trel, y, dy)"},{"col":0,"comment":"Return the optimal histogram bin width using the Freedman-Diaconis rule\n\n    The Freedman-Diaconis rule is a normal reference rule like Scott's\n    rule, but uses rank-based statistics for results which are more robust\n    to deviations from a normal distribution.\n\n    Parameters\n    ----------\n    data : array-like, ndim=1\n        observed (one-dimensional) data\n    return_bins : bool, optional\n        if True, then return the bin edges\n\n    Returns\n    -------\n    width : float\n        optimal bin width using the Freedman-Diaconis rule\n    bins : ndarray\n        bin edges: returned if ``return_bins`` is True\n\n    Notes\n    -----\n    The optimal bin width is\n\n    .. math::\n        \\Delta_b = \\frac{2(q_{75} - q_{25})}{n^{1/3}}\n\n    where :math:`q_{N}` is the :math:`N` percent quartile of the data, and\n    :math:`n` is the number of data points [1]_.\n\n    References\n    ----------\n    .. [1] D. Freedman & P. Diaconis (1981)\n       \"On the histogram as a density estimator: L2 theory\".\n       Probability Theory and Related Fields 57 (4): 453-476\n\n    See Also\n    --------\n    knuth_bin_width\n    scott_bin_width\n    bayesian_blocks\n    histogram\n    ","endLoc":272,"header":"def freedman_bin_width(data, return_bins=False)","id":8889,"name":"freedman_bin_width","nodeType":"Function","startLoc":201,"text":"def freedman_bin_width(data, return_bins=False):\n    r\"\"\"Return the optimal histogram bin width using the Freedman-Diaconis rule\n\n    The Freedman-Diaconis rule is a normal reference rule like Scott's\n    rule, but uses rank-based statistics for results which are more robust\n    to deviations from a normal distribution.\n\n    Parameters\n    ----------\n    data : array-like, ndim=1\n        observed (one-dimensional) data\n    return_bins : bool, optional\n        if True, then return the bin edges\n\n    Returns\n    -------\n    width : float\n        optimal bin width using the Freedman-Diaconis rule\n    bins : ndarray\n        bin edges: returned if ``return_bins`` is True\n\n    Notes\n    -----\n    The optimal bin width is\n\n    .. math::\n        \\Delta_b = \\frac{2(q_{75} - q_{25})}{n^{1/3}}\n\n    where :math:`q_{N}` is the :math:`N` percent quartile of the data, and\n    :math:`n` is the number of data points [1]_.\n\n    References\n    ----------\n    .. [1] D. Freedman & P. Diaconis (1981)\n       \"On the histogram as a density estimator: L2 theory\".\n       Probability Theory and Related Fields 57 (4): 453-476\n\n    See Also\n    --------\n    knuth_bin_width\n    scott_bin_width\n    bayesian_blocks\n    histogram\n    \"\"\"\n    data = np.asarray(data)\n    if data.ndim != 1:\n        raise ValueError(\"data should be one-dimensional\")\n\n    n = data.size\n    if n < 4:\n        raise ValueError(\"data should have more than three entries\")\n\n    v25, v75 = np.percentile(data, [25, 75])\n    dx = 2 * (v75 - v25) / (n ** (1 / 3))\n\n    if return_bins:\n        dmin, dmax = data.min(), data.max()\n        Nbins = max(1, np.ceil((dmax - dmin) / dx))\n        try:\n            bins = dmin + dx * np.arange(Nbins + 1)\n        except ValueError as e:\n            if 'Maximum allowed size exceeded' in str(e):\n                raise ValueError(\n                    'The inter-quartile range of the data is too small: '\n                    'failed to construct histogram with {} bins. '\n                    'Please use another bin method, such as '\n                    'bins=\"scott\"'.format(Nbins + 1))\n            else:  # Something else  # pragma: no cover\n                raise\n        return dx, bins\n    else:\n        return dx"},{"col":4,"comment":"null","endLoc":152,"header":"def _validate_inputs(self, t, y, dy)","id":8890,"name":"_validate_inputs","nodeType":"Function","startLoc":133,"text":"def _validate_inputs(self, t, y, dy):\n        # Validate shapes of inputs\n        if dy is None:\n            t, y = np.broadcast_arrays(t, y, subok=True)\n        else:\n            t, y, dy = np.broadcast_arrays(t, y, dy, subok=True)\n        if t.ndim != 1:\n            raise ValueError(\"Inputs (t, y, dy) must be 1-dimensional\")\n\n        # validate units of inputs if any is a Quantity\n        if any(has_units(arr) for arr in (t, y, dy)):\n            t, y = map(units.Quantity, (t, y))\n            if dy is not None:\n                dy = units.Quantity(dy)\n                try:\n                    dy = units.Quantity(dy, unit=y.unit)\n                except units.UnitConversionError:\n                    raise ValueError(\"Units of dy not equivalent \"\n                                     \"to units of y\")\n        return t, y, dy"},{"col":4,"comment":"Private method used to check the consistency of the inputs\n\n        Parameters\n        ----------\n        t : array-like, `~astropy.units.Quantity`, `~astropy.time.Time`, or `~astropy.time.TimeDelta`\n            Sequence of observation times.\n        y : array-like or `~astropy.units.Quantity`\n            Sequence of observations associated with times t.\n        dy : float, array-like, or `~astropy.units.Quantity`\n            Error or sequence of observational errors associated with times t.\n\n        Returns\n        -------\n        t, y, dy : array-like, `~astropy.units.Quantity`, or `~astropy.time.Time`\n            The inputs with consistent shapes and units.\n\n        Raises\n        ------\n        ValueError\n            If the dimensions are incompatible or if the units of dy cannot be\n            converted to the units of y.\n\n        ","endLoc":642,"header":"def _validate_inputs(self, t, y, dy)","id":8891,"name":"_validate_inputs","nodeType":"Function","startLoc":605,"text":"def _validate_inputs(self, t, y, dy):\n        \"\"\"Private method used to check the consistency of the inputs\n\n        Parameters\n        ----------\n        t : array-like, `~astropy.units.Quantity`, `~astropy.time.Time`, or `~astropy.time.TimeDelta`\n            Sequence of observation times.\n        y : array-like or `~astropy.units.Quantity`\n            Sequence of observations associated with times t.\n        dy : float, array-like, or `~astropy.units.Quantity`\n            Error or sequence of observational errors associated with times t.\n\n        Returns\n        -------\n        t, y, dy : array-like, `~astropy.units.Quantity`, or `~astropy.time.Time`\n            The inputs with consistent shapes and units.\n\n        Raises\n        ------\n        ValueError\n            If the dimensions are incompatible or if the units of dy cannot be\n            converted to the units of y.\n\n        \"\"\"\n\n        # Validate shapes of inputs\n        if dy is None:\n            t, y = np.broadcast_arrays(t, y, subok=True)\n        else:\n            t, y, dy = np.broadcast_arrays(t, y, dy, subok=True)\n        if t.ndim != 1:\n            raise ValueError(\"Inputs (t, y, dy) must be 1-dimensional\")\n\n        # validate units of inputs if any is a Quantity\n        if dy is not None:\n            dy = validate_unit_consistency(y, dy)\n\n        return t, y, dy"},{"col":0,"comment":"null","endLoc":15,"header":"def has_units(obj)","id":8892,"name":"has_units","nodeType":"Function","startLoc":14,"text":"def has_units(obj):\n    return hasattr(obj, 'unit')"},{"col":0,"comment":"null","endLoc":23,"header":"def validate_unit_consistency(reference_object, input_object)","id":8893,"name":"validate_unit_consistency","nodeType":"Function","startLoc":16,"text":"def validate_unit_consistency(reference_object, input_object):\n    if has_units(reference_object):\n        input_object = units.Quantity(input_object, unit=reference_object.unit)\n    else:\n        if has_units(input_object):\n            input_object = units.Quantity(input_object, unit=units.one)\n            input_object = input_object.value\n    return input_object"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":30,"id":8894,"name":"conf","nodeType":"Attribute","startLoc":30,"text":"conf"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":8895,"name":"EXTERN_JS_DIR","nodeType":"Attribute","startLoc":33,"text":"EXTERN_JS_DIR"},{"attributeType":"null","col":0,"comment":"null","endLoc":34,"id":8896,"name":"EXTERN_CSS_DIR","nodeType":"Attribute","startLoc":34,"text":"EXTERN_CSS_DIR"},{"attributeType":"null","col":0,"comment":"null","endLoc":36,"id":8897,"name":"_SORTING_SCRIPT_PART_1","nodeType":"Attribute","startLoc":36,"text":"_SORTING_SCRIPT_PART_1"},{"attributeType":"null","col":0,"comment":"null","endLoc":50,"id":8898,"name":"_SORTING_SCRIPT_PART_2","nodeType":"Attribute","startLoc":50,"text":"_SORTING_SCRIPT_PART_2"},{"attributeType":"null","col":0,"comment":"null","endLoc":57,"id":8899,"name":"IPYNB_JS_SCRIPT","nodeType":"Attribute","startLoc":57,"text":"IPYNB_JS_SCRIPT"},{"attributeType":"null","col":0,"comment":"null","endLoc":78,"id":8900,"name":"HTML_JS_SCRIPT","nodeType":"Attribute","startLoc":78,"text":"HTML_JS_SCRIPT"},{"attributeType":"null","col":0,"comment":"null","endLoc":92,"id":8901,"name":"DEFAULT_CSS","nodeType":"Attribute","startLoc":92,"text":"DEFAULT_CSS"},{"attributeType":"null","col":0,"comment":"null","endLoc":100,"id":8902,"name":"DEFAULT_CSS_NB","nodeType":"Attribute","startLoc":100,"text":"DEFAULT_CSS_NB"},{"col":0,"comment":"","endLoc":3,"header":"jsviewer.py#<anonymous>","id":8903,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"conf = Conf()\n\nEXTERN_JS_DIR = abspath(join(dirname(extern.__file__), 'jquery', 'data', 'js'))\n\nEXTERN_CSS_DIR = abspath(join(dirname(extern.__file__), 'jquery', 'data', 'css'))\n\n_SORTING_SCRIPT_PART_1 = \"\"\"\nvar astropy_sort_num = function(a, b) {{\n    var a_num = parseFloat(a);\n    var b_num = parseFloat(b);\n\n    if (isNaN(a_num) && isNaN(b_num))\n        return ((a < b) ? -1 : ((a > b) ? 1 : 0));\n    else if (!isNaN(a_num) && !isNaN(b_num))\n        return ((a_num < b_num) ? -1 : ((a_num > b_num) ? 1 : 0));\n    else\n        return isNaN(a_num) ? -1 : 1;\n}}\n\"\"\"\n\n_SORTING_SCRIPT_PART_2 = \"\"\"\njQuery.extend( jQuery.fn.dataTableExt.oSort, {{\n    \"optionalnum-asc\": astropy_sort_num,\n    \"optionalnum-desc\": function (a,b) {{ return -astropy_sort_num(a, b); }}\n}});\n\"\"\"\n\nIPYNB_JS_SCRIPT = \"\"\"\n<script>\n%(sorting_script1)s\nrequire.config({{paths: {{\n    datatables: '{datatables_url}'\n}}}});\nrequire([\"datatables\"], function(){{\n    console.log(\"$('#{tid}').dataTable()\");\n    %(sorting_script2)s\n    $('#{tid}').dataTable({{\n        order: [],\n        pageLength: {display_length},\n        lengthMenu: {display_length_menu},\n        pagingType: \"full_numbers\",\n        columnDefs: [{{targets: {sort_columns}, type: \"optionalnum\"}}]\n    }});\n}});\n</script>\n\"\"\" % dict(sorting_script1=_SORTING_SCRIPT_PART_1,\n           sorting_script2=_SORTING_SCRIPT_PART_2)\n\nHTML_JS_SCRIPT = _SORTING_SCRIPT_PART_1 + _SORTING_SCRIPT_PART_2 + \"\"\"\n$(document).ready(function() {{\n    $('#{tid}').dataTable({{\n        order: [],\n        pageLength: {display_length},\n        lengthMenu: {display_length_menu},\n        pagingType: \"full_numbers\",\n        columnDefs: [{{targets: {sort_columns}, type: \"optionalnum\"}}]\n    }});\n}} );\n\"\"\"\n\nDEFAULT_CSS = \"\"\"\\\nbody {font-family: sans-serif;}\ntable.dataTable {width: auto !important; margin: 0 !important;}\n.dataTables_filter, .dataTables_paginate {float: left !important; margin-left:1em}\n\"\"\"\n\nDEFAULT_CSS_NB = \"\"\"\\\ntable.dataTable {clear: both; width: auto !important; margin: 0 !important;}\n.dataTables_info, .dataTables_length, .dataTables_filter, .dataTables_paginate{\ndisplay: inline-block; margin-right: 1em; }\n.paginate_button { margin-right: 5px; }\n\"\"\"\n\nio_registry.register_writer('jsviewer', Table, write_table_jsviewer)"},{"col":4,"comment":"Determine a suitable grid of periods\n\n        This method uses a set of heuristics to select a conservative period\n        grid that is uniform in frequency. This grid might be too fine for\n        some user's needs depending on the precision requirements or the\n        sampling of the data. The grid can be made coarser by increasing\n        ``frequency_factor``.\n\n        Parameters\n        ----------\n        duration : float, array-like, or `~astropy.units.Quantity` ['time']\n            The set of durations that will be considered.\n        minimum_period, maximum_period : float or `~astropy.units.Quantity` ['time'], optional\n            The minimum/maximum periods to search. If not provided, these will\n            be computed as described in the notes below.\n        minimum_n_transits : int, optional\n            If ``maximum_period`` is not provided, this is used to compute the\n            maximum period to search by asserting that any systems with at\n            least ``minimum_n_transits`` will be within the range of searched\n            periods. Note that this is not the same as requiring that\n            ``minimum_n_transits`` be required for detection. The default\n            value is ``3``.\n        frequency_factor : float, optional\n            A factor to control the frequency spacing as described in the\n            notes below. The default value is ``1.0``.\n\n        Returns\n        -------\n        period : array-like or `~astropy.units.Quantity` ['time']\n            The set of periods computed using these heuristics with the same\n            units as ``t``.\n\n        Notes\n        -----\n        The default minimum period is chosen to be twice the maximum duration\n        because there won't be much sensitivity to periods shorter than that.\n\n        The default maximum period is computed as\n\n        .. code-block:: python\n\n            maximum_period = (max(t) - min(t)) / minimum_n_transits\n\n        ensuring that any systems with at least ``minimum_n_transits`` are\n        within the range of searched periods.\n\n        The frequency spacing is given by\n\n        .. code-block:: python\n\n            df = frequency_factor * min(duration) / (max(t) - min(t))**2\n\n        so the grid can be made finer by decreasing ``frequency_factor`` or\n        coarser by increasing ``frequency_factor``.\n\n        ","endLoc":214,"header":"def autoperiod(self, duration,\n                   minimum_period=None, maximum_period=None,\n                   minimum_n_transit=3, frequency_factor=1.0)","id":8904,"name":"autoperiod","nodeType":"Function","startLoc":113,"text":"def autoperiod(self, duration,\n                   minimum_period=None, maximum_period=None,\n                   minimum_n_transit=3, frequency_factor=1.0):\n        \"\"\"Determine a suitable grid of periods\n\n        This method uses a set of heuristics to select a conservative period\n        grid that is uniform in frequency. This grid might be too fine for\n        some user's needs depending on the precision requirements or the\n        sampling of the data. The grid can be made coarser by increasing\n        ``frequency_factor``.\n\n        Parameters\n        ----------\n        duration : float, array-like, or `~astropy.units.Quantity` ['time']\n            The set of durations that will be considered.\n        minimum_period, maximum_period : float or `~astropy.units.Quantity` ['time'], optional\n            The minimum/maximum periods to search. If not provided, these will\n            be computed as described in the notes below.\n        minimum_n_transits : int, optional\n            If ``maximum_period`` is not provided, this is used to compute the\n            maximum period to search by asserting that any systems with at\n            least ``minimum_n_transits`` will be within the range of searched\n            periods. Note that this is not the same as requiring that\n            ``minimum_n_transits`` be required for detection. The default\n            value is ``3``.\n        frequency_factor : float, optional\n            A factor to control the frequency spacing as described in the\n            notes below. The default value is ``1.0``.\n\n        Returns\n        -------\n        period : array-like or `~astropy.units.Quantity` ['time']\n            The set of periods computed using these heuristics with the same\n            units as ``t``.\n\n        Notes\n        -----\n        The default minimum period is chosen to be twice the maximum duration\n        because there won't be much sensitivity to periods shorter than that.\n\n        The default maximum period is computed as\n\n        .. code-block:: python\n\n            maximum_period = (max(t) - min(t)) / minimum_n_transits\n\n        ensuring that any systems with at least ``minimum_n_transits`` are\n        within the range of searched periods.\n\n        The frequency spacing is given by\n\n        .. code-block:: python\n\n            df = frequency_factor * min(duration) / (max(t) - min(t))**2\n\n        so the grid can be made finer by decreasing ``frequency_factor`` or\n        coarser by increasing ``frequency_factor``.\n\n        \"\"\"\n\n        duration = self._validate_duration(duration)\n        baseline = strip_units(self._trel.max() - self._trel.min())\n        min_duration = strip_units(np.min(duration))\n\n        # Estimate the required frequency spacing\n        # Because of the sparsity of a transit, this must be much finer than\n        # the frequency resolution for a sinusoidal fit. For a sinusoidal fit,\n        # df would be 1/baseline (see LombScargle), but here this should be\n        # scaled proportionally to the duration in units of baseline.\n        df = frequency_factor * min_duration / baseline**2\n\n        # If a minimum period is not provided, choose one that is twice the\n        # maximum duration because we won't be sensitive to any periods\n        # shorter than that.\n        if minimum_period is None:\n            minimum_period = 2.0 * strip_units(np.max(duration))\n        else:\n            minimum_period = validate_unit_consistency(self._trel, minimum_period)\n            minimum_period = strip_units(minimum_period)\n\n        # If no maximum period is provided, choose one by requiring that\n        # all signals with at least minimum_n_transit should be detectable.\n        if maximum_period is None:\n            if minimum_n_transit <= 1:\n                raise ValueError(\"minimum_n_transit must be greater than 1\")\n            maximum_period = baseline / (minimum_n_transit-1)\n        else:\n            maximum_period = validate_unit_consistency(self._trel, maximum_period)\n            maximum_period = strip_units(maximum_period)\n\n        if maximum_period < minimum_period:\n            minimum_period, maximum_period = maximum_period, minimum_period\n        if minimum_period <= 0.0:\n            raise ValueError(\"minimum_period must be positive\")\n\n        # Convert bounds to frequency\n        minimum_frequency = 1.0/strip_units(maximum_period)\n        maximum_frequency = 1.0/strip_units(minimum_period)\n\n        # Compute the number of frequencies and the frequency grid\n        nf = 1 + int(np.round((maximum_frequency - minimum_frequency)/df))\n        return 1.0/(maximum_frequency-df*np.arange(nf)) * self._t_unit()"},{"col":4,"comment":"Private method used to check a set of test durations\n\n        Parameters\n        ----------\n        duration : float, array-like, or `~astropy.units.Quantity`\n            The set of durations that will be considered.\n\n        Returns\n        -------\n        duration : array-like or `~astropy.units.Quantity`\n            The input reformatted with the correct shape and units.\n\n        Raises\n        ------\n        ValueError\n            If the units of duration cannot be converted to the units of t.\n\n        ","endLoc":666,"header":"def _validate_duration(self, duration)","id":8905,"name":"_validate_duration","nodeType":"Function","startLoc":644,"text":"def _validate_duration(self, duration):\n        \"\"\"Private method used to check a set of test durations\n\n        Parameters\n        ----------\n        duration : float, array-like, or `~astropy.units.Quantity`\n            The set of durations that will be considered.\n\n        Returns\n        -------\n        duration : array-like or `~astropy.units.Quantity`\n            The input reformatted with the correct shape and units.\n\n        Raises\n        ------\n        ValueError\n            If the units of duration cannot be converted to the units of t.\n\n        \"\"\"\n        duration = np.atleast_1d(np.abs(duration))\n        if duration.ndim != 1 or duration.size == 0:\n            raise ValueError(\"duration must be 1-dimensional\")\n        return validate_unit_consistency(self._trel, duration)"},{"fileName":"operations.py","filePath":"astropy/table","id":8906,"nodeType":"File","text":"\"\"\"\nHigh-level table operations:\n\n- join()\n- setdiff()\n- hstack()\n- vstack()\n- dstack()\n\"\"\"\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom copy import deepcopy\nimport collections\nimport itertools\nfrom collections import OrderedDict, Counter\nfrom collections.abc import Mapping, Sequence\n\nimport numpy as np\n\nfrom astropy.utils import metadata\nfrom astropy.utils.masked import Masked\nfrom .table import Table, QTable, Row, Column, MaskedColumn\nfrom astropy.units import Quantity\n\nfrom . import _np_utils\nfrom .np_utils import TableMergeError\n\n__all__ = ['join', 'setdiff', 'hstack', 'vstack', 'unique',\n           'join_skycoord', 'join_distance']\n\n__doctest_requires__ = {'join_skycoord': ['scipy'], 'join_distance': ['scipy']}\n\n\ndef _merge_table_meta(out, tables, metadata_conflicts='warn'):\n    out_meta = deepcopy(tables[0].meta)\n    for table in tables[1:]:\n        out_meta = metadata.merge(out_meta, table.meta, metadata_conflicts=metadata_conflicts)\n    out.meta.update(out_meta)\n\n\ndef _get_list_of_tables(tables):\n    \"\"\"\n    Check that tables is a Table or sequence of Tables.  Returns the\n    corresponding list of Tables.\n    \"\"\"\n\n    # Make sure we have a list of things\n    if not isinstance(tables, Sequence):\n        tables = [tables]\n\n    # Make sure there is something to stack\n    if len(tables) == 0:\n        raise ValueError('no values provided to stack.')\n\n    # Convert inputs (Table, Row, or anything column-like) to Tables.\n    # Special case that Quantity converts to a QTable.\n    for ii, val in enumerate(tables):\n        if isinstance(val, Table):\n            pass\n        elif isinstance(val, Row):\n            tables[ii] = Table(val)\n        elif isinstance(val, Quantity):\n            tables[ii] = QTable([val])\n        else:\n            try:\n                tables[ii] = Table([val])\n            except (ValueError, TypeError) as err:\n                raise TypeError(f'Cannot convert {val} to table column.') from err\n\n    return tables\n\n\ndef _get_out_class(objs):\n    \"\"\"\n    From a list of input objects ``objs`` get merged output object class.\n\n    This is just taken as the deepest subclass. This doesn't handle complicated\n    inheritance schemes, but as a special case, classes which share ``info``\n    are taken to be compatible.\n    \"\"\"\n    out_class = objs[0].__class__\n    for obj in objs[1:]:\n        if issubclass(obj.__class__, out_class):\n            out_class = obj.__class__\n\n    if any(not (issubclass(out_class, obj.__class__)\n                or out_class.info is obj.__class__.info) for obj in objs):\n        raise ValueError('unmergeable object classes {}'\n                         .format([obj.__class__.__name__ for obj in objs]))\n\n    return out_class\n\n\ndef join_skycoord(distance, distance_func='search_around_sky'):\n    \"\"\"Helper function to join on SkyCoord columns using distance matching.\n\n    This function is intended for use in ``table.join()`` to allow performing a\n    table join where the key columns are both ``SkyCoord`` objects, matched by\n    computing the distance between points and accepting values below\n    ``distance``.\n\n    The distance cross-matching is done using either\n    `~astropy.coordinates.search_around_sky` or\n    `~astropy.coordinates.search_around_3d`, depending on the value of\n    ``distance_func``.  The default is ``'search_around_sky'``.\n\n    One can also provide a function object for ``distance_func``, in which case\n    it must be a function that follows the same input and output API as\n    `~astropy.coordinates.search_around_sky`. In this case the function will\n    be called with ``(skycoord1, skycoord2, distance)`` as arguments.\n\n    Parameters\n    ----------\n    distance : `~astropy.units.Quantity` ['angle', 'length']\n        Maximum distance between points to be considered a join match.\n        Must have angular or distance units.\n    distance_func : str or function\n        Specifies the function for performing the cross-match based on\n        ``distance``. If supplied as a string this specifies the name of a\n        function in `astropy.coordinates`. If supplied as a function then that\n        function is called directly.\n\n    Returns\n    -------\n    join_func : function\n        Function that accepts two ``SkyCoord`` columns (col1, col2) and returns\n        the tuple (ids1, ids2) of pair-matched unique identifiers.\n\n    Examples\n    --------\n    This example shows an inner join of two ``SkyCoord`` columns, taking any\n    sources within 0.2 deg to be a match.  Note the new ``sc_id`` column which\n    is added and provides a unique source identifier for the matches.\n\n      >>> from astropy.coordinates import SkyCoord\n      >>> import astropy.units as u\n      >>> from astropy.table import Table, join_skycoord\n      >>> from astropy import table\n\n      >>> sc1 = SkyCoord([0, 1, 1.1, 2], [0, 0, 0, 0], unit='deg')\n      >>> sc2 = SkyCoord([0.5, 1.05, 2.1], [0, 0, 0], unit='deg')\n\n      >>> join_func = join_skycoord(0.2 * u.deg)\n      >>> join_func(sc1, sc2)  # Associate each coordinate with unique source ID\n      (array([3, 1, 1, 2]), array([4, 1, 2]))\n\n      >>> t1 = Table([sc1], names=['sc'])\n      >>> t2 = Table([sc2], names=['sc'])\n      >>> t12 = table.join(t1, t2, join_funcs={'sc': join_skycoord(0.2 * u.deg)})\n      >>> print(t12)  # Note new `sc_id` column with the IDs from join_func()\n      sc_id   sc_1    sc_2\n            deg,deg deg,deg\n      ----- ------- --------\n          1 1.0,0.0 1.05,0.0\n          1 1.1,0.0 1.05,0.0\n          2 2.0,0.0  2.1,0.0\n\n    \"\"\"\n    if isinstance(distance_func, str):\n        import astropy.coordinates as coords\n        try:\n            distance_func = getattr(coords, distance_func)\n        except AttributeError as err:\n            raise ValueError('distance_func must be a function in astropy.coordinates') from err\n    else:\n        from inspect import isfunction\n        if not isfunction(distance_func):\n            raise ValueError('distance_func must be a str or function')\n\n    def join_func(sc1, sc2):\n\n        # Call the appropriate SkyCoord method to find pairs within distance\n        idxs1, idxs2, d2d, d3d = distance_func(sc1, sc2, distance)\n\n        # Now convert that into unique identifiers for each near-pair. This is\n        # taken to be transitive, so that if points 1 and 2 are \"near\" and points\n        # 1 and 3 are \"near\", then 1, 2, and 3 are all given the same identifier.\n        # This identifier will then be used in the table join matching.\n\n        # Identifiers for each column, initialized to all zero.\n        ids1 = np.zeros(len(sc1), dtype=int)\n        ids2 = np.zeros(len(sc2), dtype=int)\n\n        # Start the identifier count at 1\n        id_ = 1\n        for idx1, idx2 in zip(idxs1, idxs2):\n            # If this col1 point is previously identified then set corresponding\n            # col2 point to same identifier.  Likewise for col2 and col1.\n            if ids1[idx1] > 0:\n                ids2[idx2] = ids1[idx1]\n            elif ids2[idx2] > 0:\n                ids1[idx1] = ids2[idx2]\n            else:\n                # Not yet seen so set identifier for col1 and col2\n                ids1[idx1] = id_\n                ids2[idx2] = id_\n                id_ += 1\n\n        # Fill in unique identifiers for points with no near neighbor\n        for ids in (ids1, ids2):\n            for idx in np.flatnonzero(ids == 0):\n                ids[idx] = id_\n                id_ += 1\n\n        # End of enclosure join_func()\n        return ids1, ids2\n\n    return join_func\n\n\ndef join_distance(distance, kdtree_args=None, query_args=None):\n    \"\"\"Helper function to join table columns using distance matching.\n\n    This function is intended for use in ``table.join()`` to allow performing\n    a table join where the key columns are matched by computing the distance\n    between points and accepting values below ``distance``. This numerical\n    \"fuzzy\" match can apply to 1-D or 2-D columns, where in the latter case\n    the distance is a vector distance.\n\n    The distance cross-matching is done using `scipy.spatial.cKDTree`. If\n    necessary you can tweak the default behavior by providing ``dict`` values\n    for the ``kdtree_args`` or ``query_args``.\n\n    Parameters\n    ----------\n    distance : float or `~astropy.units.Quantity` ['length']\n        Maximum distance between points to be considered a join match\n    kdtree_args : dict, None\n        Optional extra args for `~scipy.spatial.cKDTree`\n    query_args : dict, None\n        Optional extra args for `~scipy.spatial.cKDTree.query_ball_tree`\n\n    Returns\n    -------\n    join_func : function\n        Function that accepts (skycoord1, skycoord2) and returns the tuple\n        (ids1, ids2) of pair-matched unique identifiers.\n\n    Examples\n    --------\n\n      >>> from astropy.table import Table, join_distance\n      >>> from astropy import table\n\n      >>> c1 = [0, 1, 1.1, 2]\n      >>> c2 = [0.5, 1.05, 2.1]\n\n      >>> t1 = Table([c1], names=['col'])\n      >>> t2 = Table([c2], names=['col'])\n      >>> t12 = table.join(t1, t2, join_type='outer', join_funcs={'col': join_distance(0.2)})\n      >>> print(t12)\n      col_id col_1 col_2\n      ------ ----- -----\n           1   1.0  1.05\n           1   1.1  1.05\n           2   2.0   2.1\n           3   0.0    --\n           4    --   0.5\n\n    \"\"\"\n    try:\n        from scipy.spatial import cKDTree\n    except ImportError as exc:\n        raise ImportError('scipy is required to use join_distance()') from exc\n\n    if kdtree_args is None:\n        kdtree_args = {}\n    if query_args is None:\n        query_args = {}\n\n    def join_func(col1, col2):\n        if col1.ndim > 2 or col2.ndim > 2:\n            raise ValueError('columns for isclose_join must be 1- or 2-dimensional')\n\n        if isinstance(distance, Quantity):\n            # Convert to np.array with common unit\n            col1 = col1.to_value(distance.unit)\n            col2 = col2.to_value(distance.unit)\n            dist = distance.value\n        else:\n            # Convert to np.array to allow later in-place shape changing\n            col1 = np.asarray(col1)\n            col2 = np.asarray(col2)\n            dist = distance\n\n        # Ensure columns are pure np.array and are 2-D for use with KDTree\n        if col1.ndim == 1:\n            col1.shape = col1.shape + (1,)\n        if col2.ndim == 1:\n            col2.shape = col2.shape + (1,)\n\n        # Cross-match col1 and col2 within dist using KDTree\n        kd1 = cKDTree(col1, **kdtree_args)\n        kd2 = cKDTree(col2, **kdtree_args)\n        nears = kd1.query_ball_tree(kd2, r=dist, **query_args)\n\n        # Output of above is nears which is a list of lists, where the outer\n        # list corresponds to each item in col1, and where the inner lists are\n        # indexes into col2 of elements within the distance tolerance.  This\n        # identifies col1 / col2 near pairs.\n\n        # Now convert that into unique identifiers for each near-pair. This is\n        # taken to be transitive, so that if points 1 and 2 are \"near\" and points\n        # 1 and 3 are \"near\", then 1, 2, and 3 are all given the same identifier.\n        # This identifier will then be used in the table join matching.\n\n        # Identifiers for each column, initialized to all zero.\n        ids1 = np.zeros(len(col1), dtype=int)\n        ids2 = np.zeros(len(col2), dtype=int)\n\n        # Start the identifier count at 1\n        id_ = 1\n        for idx1, idxs2 in enumerate(nears):\n            for idx2 in idxs2:\n                # If this col1 point is previously identified then set corresponding\n                # col2 point to same identifier.  Likewise for col2 and col1.\n                if ids1[idx1] > 0:\n                    ids2[idx2] = ids1[idx1]\n                elif ids2[idx2] > 0:\n                    ids1[idx1] = ids2[idx2]\n                else:\n                    # Not yet seen so set identifier for col1 and col2\n                    ids1[idx1] = id_\n                    ids2[idx2] = id_\n                    id_ += 1\n\n        # Fill in unique identifiers for points with no near neighbor\n        for ids in (ids1, ids2):\n            for idx in np.flatnonzero(ids == 0):\n                ids[idx] = id_\n                id_ += 1\n\n        # End of enclosure join_func()\n        return ids1, ids2\n\n    return join_func\n\n\ndef join(left, right, keys=None, join_type='inner', *,\n         keys_left=None, keys_right=None,\n         uniq_col_name='{col_name}_{table_name}',\n         table_names=['1', '2'], metadata_conflicts='warn',\n         join_funcs=None):\n    \"\"\"\n    Perform a join of the left table with the right table on specified keys.\n\n    Parameters\n    ----------\n    left : `~astropy.table.Table`-like object\n        Left side table in the join. If not a Table, will call ``Table(left)``\n    right : `~astropy.table.Table`-like object\n        Right side table in the join. If not a Table, will call ``Table(right)``\n    keys : str or list of str\n        Name(s) of column(s) used to match rows of left and right tables.\n        Default is to use all columns which are common to both tables.\n    join_type : str\n        Join type ('inner' | 'outer' | 'left' | 'right' | 'cartesian'), default is 'inner'\n    keys_left : str or list of str or list of column-like, optional\n        Left column(s) used to match rows instead of ``keys`` arg. This can be\n        be a single left table column name or list of column names, or a list of\n        column-like values with the same lengths as the left table.\n    keys_right : str or list of str or list of column-like, optional\n        Same as ``keys_left``, but for the right side of the join.\n    uniq_col_name : str or None\n        String generate a unique output column name in case of a conflict.\n        The default is '{col_name}_{table_name}'.\n    table_names : list of str or None\n        Two-element list of table names used when generating unique output\n        column names.  The default is ['1', '2'].\n    metadata_conflicts : str\n        How to proceed with metadata conflicts. This should be one of:\n            * ``'silent'``: silently pick the last conflicting meta-data value\n            * ``'warn'``: pick the last conflicting meta-data value, but emit a warning (default)\n            * ``'error'``: raise an exception.\n    join_funcs : dict, None\n        Dict of functions to use for matching the corresponding key column(s).\n        See `~astropy.table.join_skycoord` for an example and details.\n\n    Returns\n    -------\n    joined_table : `~astropy.table.Table` object\n        New table containing the result of the join operation.\n    \"\"\"\n\n    # Try converting inputs to Table as needed\n    if not isinstance(left, Table):\n        left = Table(left)\n    if not isinstance(right, Table):\n        right = Table(right)\n\n    col_name_map = OrderedDict()\n    out = _join(left, right, keys, join_type,\n                uniq_col_name, table_names, col_name_map, metadata_conflicts,\n                join_funcs,\n                keys_left=keys_left, keys_right=keys_right)\n\n    # Merge the column and table meta data. Table subclasses might override\n    # these methods for custom merge behavior.\n    _merge_table_meta(out, [left, right], metadata_conflicts=metadata_conflicts)\n\n    return out\n\n\ndef setdiff(table1, table2, keys=None):\n    \"\"\"\n    Take a set difference of table rows.\n\n    The row set difference will contain all rows in ``table1`` that are not\n    present in ``table2``. If the keys parameter is not defined, all columns in\n    ``table1`` will be included in the output table.\n\n    Parameters\n    ----------\n    table1 : `~astropy.table.Table`\n        ``table1`` is on the left side of the set difference.\n    table2 : `~astropy.table.Table`\n        ``table2`` is on the right side of the set difference.\n    keys : str or list of str\n        Name(s) of column(s) used to match rows of left and right tables.\n        Default is to use all columns in ``table1``.\n\n    Returns\n    -------\n    diff_table : `~astropy.table.Table`\n        New table containing the set difference between tables. If the set\n        difference is none, an empty table will be returned.\n\n    Examples\n    --------\n    To get a set difference between two tables::\n\n      >>> from astropy.table import setdiff, Table\n      >>> t1 = Table({'a': [1, 4, 9], 'b': ['c', 'd', 'f']}, names=('a', 'b'))\n      >>> t2 = Table({'a': [1, 5, 9], 'b': ['c', 'b', 'f']}, names=('a', 'b'))\n      >>> print(t1)\n       a   b\n      --- ---\n        1   c\n        4   d\n        9   f\n      >>> print(t2)\n       a   b\n      --- ---\n        1   c\n        5   b\n        9   f\n      >>> print(setdiff(t1, t2))\n       a   b\n      --- ---\n        4   d\n\n      >>> print(setdiff(t2, t1))\n       a   b\n      --- ---\n        5   b\n    \"\"\"\n    if keys is None:\n        keys = table1.colnames\n\n    # Check that all keys are in table1 and table2\n    for tbl, tbl_str in ((table1, 'table1'), (table2, 'table2')):\n        diff_keys = np.setdiff1d(keys, tbl.colnames)\n        if len(diff_keys) != 0:\n            raise ValueError(\"The {} columns are missing from {}, cannot take \"\n                             \"a set difference.\".format(diff_keys, tbl_str))\n\n    # Make a light internal copy of both tables\n    t1 = table1.copy(copy_data=False)\n    t1.meta = {}\n    t1.keep_columns(keys)\n    t1['__index1__'] = np.arange(len(table1))  # Keep track of rows indices\n\n    # Make a light internal copy to avoid touching table2\n    t2 = table2.copy(copy_data=False)\n    t2.meta = {}\n    t2.keep_columns(keys)\n    # Dummy column to recover rows after join\n    t2['__index2__'] = np.zeros(len(t2), dtype=np.uint8)  # dummy column\n\n    t12 = _join(t1, t2, join_type='left', keys=keys,\n                metadata_conflicts='silent')\n\n    # If t12 index2 is masked then that means some rows were in table1 but not table2.\n    if hasattr(t12['__index2__'], 'mask'):\n        # Define bool mask of table1 rows not in table2\n        diff = t12['__index2__'].mask\n        # Get the row indices of table1 for those rows\n        idx = t12['__index1__'][diff]\n        # Select corresponding table1 rows straight from table1 to ensure\n        # correct table and column types.\n        t12_diff = table1[idx]\n    else:\n        t12_diff = table1[[]]\n\n    return t12_diff\n\n\ndef dstack(tables, join_type='outer', metadata_conflicts='warn'):\n    \"\"\"\n    Stack columns within tables depth-wise\n\n    A ``join_type`` of 'exact' means that the tables must all have exactly\n    the same column names (though the order can vary).  If ``join_type``\n    is 'inner' then the intersection of common columns will be the output.\n    A value of 'outer' (default) means the output will have the union of\n    all columns, with table values being masked where no common values are\n    available.\n\n    Parameters\n    ----------\n    tables : `~astropy.table.Table` or `~astropy.table.Row` or list thereof\n        Table(s) to stack along depth-wise with the current table\n        Table columns should have same shape and name for depth-wise stacking\n    join_type : str\n        Join type ('inner' | 'exact' | 'outer'), default is 'outer'\n    metadata_conflicts : str\n        How to proceed with metadata conflicts. This should be one of:\n            * ``'silent'``: silently pick the last conflicting meta-data value\n            * ``'warn'``: pick the last conflicting meta-data value, but emit a warning (default)\n            * ``'error'``: raise an exception.\n\n    Returns\n    -------\n    stacked_table : `~astropy.table.Table` object\n        New table containing the stacked data from the input tables.\n\n    Examples\n    --------\n    To stack two tables along rows do::\n\n      >>> from astropy.table import vstack, Table\n      >>> t1 = Table({'a': [1, 2], 'b': [3, 4]}, names=('a', 'b'))\n      >>> t2 = Table({'a': [5, 6], 'b': [7, 8]}, names=('a', 'b'))\n      >>> print(t1)\n       a   b\n      --- ---\n        1   3\n        2   4\n      >>> print(t2)\n       a   b\n      --- ---\n        5   7\n        6   8\n      >>> print(dstack([t1, t2]))\n      a [2]  b [2]\n      ------ ------\n      1 .. 5 3 .. 7\n      2 .. 6 4 .. 8\n    \"\"\"\n    _check_join_type(join_type, 'dstack')\n\n    tables = _get_list_of_tables(tables)\n    if len(tables) == 1:\n        return tables[0]  # no point in stacking a single table\n\n    n_rows = set(len(table) for table in tables)\n    if len(n_rows) != 1:\n        raise ValueError('Table lengths must all match for dstack')\n    n_row = n_rows.pop()\n\n    out = vstack(tables, join_type, metadata_conflicts)\n\n    for name, col in out.columns.items():\n        col = out[name]\n\n        # Reshape to so each original column is now in a row.\n        # If entries are not 0-dim then those additional shape dims\n        # are just carried along.\n        # [x x x y y y] => [[x x x],\n        #                   [y y y]]\n        new_shape = (len(tables), n_row) + col.shape[1:]\n        try:\n            col.shape = (len(tables), n_row) + col.shape[1:]\n        except AttributeError:\n            col = col.reshape(new_shape)\n\n        # Transpose the table and row axes to get to\n        # [[x, y],\n        #  [x, y]\n        #  [x, y]]\n        axes = np.arange(len(col.shape))\n        axes[:2] = [1, 0]\n\n        # This temporarily makes `out` be corrupted (columns of different\n        # length) but it all works out in the end.\n        out.columns.__setitem__(name, col.transpose(axes), validated=True)\n\n    return out\n\n\ndef vstack(tables, join_type='outer', metadata_conflicts='warn'):\n    \"\"\"\n    Stack tables vertically (along rows)\n\n    A ``join_type`` of 'exact' means that the tables must all have exactly\n    the same column names (though the order can vary).  If ``join_type``\n    is 'inner' then the intersection of common columns will be the output.\n    A value of 'outer' (default) means the output will have the union of\n    all columns, with table values being masked where no common values are\n    available.\n\n    Parameters\n    ----------\n    tables : `~astropy.table.Table` or `~astropy.table.Row` or list thereof\n        Table(s) to stack along rows (vertically) with the current table\n    join_type : str\n        Join type ('inner' | 'exact' | 'outer'), default is 'outer'\n    metadata_conflicts : str\n        How to proceed with metadata conflicts. This should be one of:\n            * ``'silent'``: silently pick the last conflicting meta-data value\n            * ``'warn'``: pick the last conflicting meta-data value, but emit a warning (default)\n            * ``'error'``: raise an exception.\n\n    Returns\n    -------\n    stacked_table : `~astropy.table.Table` object\n        New table containing the stacked data from the input tables.\n\n    Examples\n    --------\n    To stack two tables along rows do::\n\n      >>> from astropy.table import vstack, Table\n      >>> t1 = Table({'a': [1, 2], 'b': [3, 4]}, names=('a', 'b'))\n      >>> t2 = Table({'a': [5, 6], 'b': [7, 8]}, names=('a', 'b'))\n      >>> print(t1)\n       a   b\n      --- ---\n        1   3\n        2   4\n      >>> print(t2)\n       a   b\n      --- ---\n        5   7\n        6   8\n      >>> print(vstack([t1, t2]))\n       a   b\n      --- ---\n        1   3\n        2   4\n        5   7\n        6   8\n    \"\"\"\n    _check_join_type(join_type, 'vstack')\n\n    tables = _get_list_of_tables(tables)  # validates input\n    if len(tables) == 1:\n        return tables[0]  # no point in stacking a single table\n    col_name_map = OrderedDict()\n\n    out = _vstack(tables, join_type, col_name_map, metadata_conflicts)\n\n    # Merge table metadata\n    _merge_table_meta(out, tables, metadata_conflicts=metadata_conflicts)\n\n    return out\n\n\ndef hstack(tables, join_type='outer',\n           uniq_col_name='{col_name}_{table_name}', table_names=None,\n           metadata_conflicts='warn'):\n    \"\"\"\n    Stack tables along columns (horizontally)\n\n    A ``join_type`` of 'exact' means that the tables must all\n    have exactly the same number of rows.  If ``join_type`` is 'inner' then\n    the intersection of rows will be the output.  A value of 'outer' (default)\n    means the output will have the union of all rows, with table values being\n    masked where no common values are available.\n\n    Parameters\n    ----------\n    tables : `~astropy.table.Table` or `~astropy.table.Row` or list thereof\n        Tables to stack along columns (horizontally) with the current table\n    join_type : str\n        Join type ('inner' | 'exact' | 'outer'), default is 'outer'\n    uniq_col_name : str or None\n        String generate a unique output column name in case of a conflict.\n        The default is '{col_name}_{table_name}'.\n    table_names : list of str or None\n        Two-element list of table names used when generating unique output\n        column names.  The default is ['1', '2', ..].\n    metadata_conflicts : str\n        How to proceed with metadata conflicts. This should be one of:\n            * ``'silent'``: silently pick the last conflicting meta-data value\n            * ``'warn'``: pick the last conflicting meta-data value,\n              but emit a warning (default)\n            * ``'error'``: raise an exception.\n\n    Returns\n    -------\n    stacked_table : `~astropy.table.Table` object\n        New table containing the stacked data from the input tables.\n\n    See Also\n    --------\n    Table.add_columns, Table.replace_column, Table.update\n\n    Examples\n    --------\n    To stack two tables horizontally (along columns) do::\n\n      >>> from astropy.table import Table, hstack\n      >>> t1 = Table({'a': [1, 2], 'b': [3, 4]}, names=('a', 'b'))\n      >>> t2 = Table({'c': [5, 6], 'd': [7, 8]}, names=('c', 'd'))\n      >>> print(t1)\n       a   b\n      --- ---\n        1   3\n        2   4\n      >>> print(t2)\n       c   d\n      --- ---\n        5   7\n        6   8\n      >>> print(hstack([t1, t2]))\n       a   b   c   d\n      --- --- --- ---\n        1   3   5   7\n        2   4   6   8\n    \"\"\"\n    _check_join_type(join_type, 'hstack')\n\n    tables = _get_list_of_tables(tables)  # validates input\n    if len(tables) == 1:\n        return tables[0]  # no point in stacking a single table\n    col_name_map = OrderedDict()\n\n    out = _hstack(tables, join_type, uniq_col_name, table_names,\n                  col_name_map)\n\n    _merge_table_meta(out, tables, metadata_conflicts=metadata_conflicts)\n\n    return out\n\n\ndef unique(input_table, keys=None, silent=False, keep='first'):\n    \"\"\"\n    Returns the unique rows of a table.\n\n    Parameters\n    ----------\n    input_table : table-like\n    keys : str or list of str\n        Name(s) of column(s) used to create unique rows.\n        Default is to use all columns.\n    keep : {'first', 'last', 'none'}\n        Whether to keep the first or last row for each set of\n        duplicates. If 'none', all rows that are duplicate are\n        removed, leaving only rows that are already unique in\n        the input.\n        Default is 'first'.\n    silent : bool\n        If `True`, masked value column(s) are silently removed from\n        ``keys``. If `False`, an exception is raised when ``keys``\n        contains masked value column(s).\n        Default is `False`.\n\n    Returns\n    -------\n    unique_table : `~astropy.table.Table` object\n        New table containing only the unique rows of ``input_table``.\n\n    Examples\n    --------\n    >>> from astropy.table import unique, Table\n    >>> import numpy as np\n    >>> table = Table(data=[[1,2,3,2,3,3],\n    ... [2,3,4,5,4,6],\n    ... [3,4,5,6,7,8]],\n    ... names=['col1', 'col2', 'col3'],\n    ... dtype=[np.int32, np.int32, np.int32])\n    >>> table\n    <Table length=6>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n        2     3     4\n        3     4     5\n        2     5     6\n        3     4     7\n        3     6     8\n    >>> unique(table, keys='col1')\n    <Table length=3>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n        2     3     4\n        3     4     5\n    >>> unique(table, keys=['col1'], keep='last')\n    <Table length=3>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n        2     5     6\n        3     6     8\n    >>> unique(table, keys=['col1', 'col2'])\n    <Table length=5>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n        2     3     4\n        2     5     6\n        3     4     5\n        3     6     8\n    >>> unique(table, keys=['col1', 'col2'], keep='none')\n    <Table length=4>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n        2     3     4\n        2     5     6\n        3     6     8\n    >>> unique(table, keys=['col1'], keep='none')\n    <Table length=1>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n\n    \"\"\"\n\n    if keep not in ('first', 'last', 'none'):\n        raise ValueError(\"'keep' should be one of 'first', 'last', 'none'\")\n\n    if isinstance(keys, str):\n        keys = [keys]\n    if keys is None:\n        keys = input_table.colnames\n    else:\n        if len(set(keys)) != len(keys):\n            raise ValueError(\"duplicate key names\")\n\n    # Check for columns with masked values\n    for key in keys[:]:\n        col = input_table[key]\n        if hasattr(col, 'mask') and np.any(col.mask):\n            if not silent:\n                raise ValueError(\n                    \"cannot use columns with masked values as keys; \"\n                    \"remove column '{}' from keys and rerun \"\n                    \"unique()\".format(key))\n            del keys[keys.index(key)]\n    if len(keys) == 0:\n        raise ValueError(\"no column remained in ``keys``; \"\n                         \"unique() cannot work with masked value \"\n                         \"key columns\")\n\n    grouped_table = input_table.group_by(keys)\n    indices = grouped_table.groups.indices\n    if keep == 'first':\n        indices = indices[:-1]\n    elif keep == 'last':\n        indices = indices[1:] - 1\n    else:\n        indices = indices[:-1][np.diff(indices) == 1]\n\n    return grouped_table[indices]\n\n\ndef get_col_name_map(arrays, common_names, uniq_col_name='{col_name}_{table_name}',\n                     table_names=None):\n    \"\"\"\n    Find the column names mapping when merging the list of tables\n    ``arrays``.  It is assumed that col names in ``common_names`` are to be\n    merged into a single column while the rest will be uniquely represented\n    in the output.  The args ``uniq_col_name`` and ``table_names`` specify\n    how to rename columns in case of conflicts.\n\n    Returns a dict mapping each output column name to the input(s).  This takes the form\n    {outname : (col_name_0, col_name_1, ...), ... }.  For key columns all of input names\n    will be present, while for the other non-key columns the value will be (col_name_0,\n    None, ..) or (None, col_name_1, ..) etc.\n    \"\"\"\n\n    col_name_map = collections.defaultdict(lambda: [None] * len(arrays))\n    col_name_list = []\n\n    if table_names is None:\n        table_names = [str(ii + 1) for ii in range(len(arrays))]\n\n    for idx, array in enumerate(arrays):\n        table_name = table_names[idx]\n        for name in array.colnames:\n            out_name = name\n\n            if name in common_names:\n                # If name is in the list of common_names then insert into\n                # the column name list, but just once.\n                if name not in col_name_list:\n                    col_name_list.append(name)\n            else:\n                # If name is not one of the common column outputs, and it collides\n                # with the names in one of the other arrays, then rename\n                others = list(arrays)\n                others.pop(idx)\n                if any(name in other.colnames for other in others):\n                    out_name = uniq_col_name.format(table_name=table_name, col_name=name)\n                col_name_list.append(out_name)\n\n            col_name_map[out_name][idx] = name\n\n    # Check for duplicate output column names\n    col_name_count = Counter(col_name_list)\n    repeated_names = [name for name, count in col_name_count.items() if count > 1]\n    if repeated_names:\n        raise TableMergeError('Merging column names resulted in duplicates: {}.  '\n                              'Change uniq_col_name or table_names args to fix this.'\n                              .format(repeated_names))\n\n    # Convert col_name_map to a regular dict with tuple (immutable) values\n    col_name_map = OrderedDict((name, col_name_map[name]) for name in col_name_list)\n\n    return col_name_map\n\n\ndef get_descrs(arrays, col_name_map):\n    \"\"\"\n    Find the dtypes descrs resulting from merging the list of arrays' dtypes,\n    using the column name mapping ``col_name_map``.\n\n    Return a list of descrs for the output.\n    \"\"\"\n\n    out_descrs = []\n\n    for out_name, in_names in col_name_map.items():\n        # List of input arrays that contribute to this output column\n        in_cols = [arr[name] for arr, name in zip(arrays, in_names) if name is not None]\n\n        # List of names of the columns that contribute to this output column.\n        names = [name for name in in_names if name is not None]\n\n        # Output dtype is the superset of all dtypes in in_arrays\n        try:\n            dtype = common_dtype(in_cols)\n        except TableMergeError as tme:\n            # Beautify the error message when we are trying to merge columns with incompatible\n            # types by including the name of the columns that originated the error.\n            raise TableMergeError(\"The '{}' columns have incompatible types: {}\"\n                                  .format(names[0], tme._incompat_types)) from tme\n\n        # Make sure all input shapes are the same\n        uniq_shapes = set(col.shape[1:] for col in in_cols)\n        if len(uniq_shapes) != 1:\n            raise TableMergeError(f'Key columns {names!r} have different shape')\n        shape = uniq_shapes.pop()\n\n        if out_name is not None:\n            out_name = str(out_name)\n        out_descrs.append((out_name, dtype, shape))\n\n    return out_descrs\n\n\ndef common_dtype(cols):\n    \"\"\"\n    Use numpy to find the common dtype for a list of columns.\n\n    Only allow columns within the following fundamental numpy data types:\n    np.bool_, np.object_, np.number, np.character, np.void\n    \"\"\"\n    try:\n        return metadata.common_dtype(cols)\n    except metadata.MergeConflictError as err:\n        tme = TableMergeError(f'Columns have incompatible types {err._incompat_types}')\n        tme._incompat_types = err._incompat_types\n        raise tme from err\n\n\ndef _get_join_sort_idxs(keys, left, right):\n    # Go through each of the key columns in order and make columns for\n    # a new structured array that represents the lexical ordering of those\n    # key columns. This structured array is then argsort'ed. The trick here\n    # is that some columns (e.g. Time) may need to be expanded into multiple\n    # columns for ordering here.\n\n    ii = 0  # Index for uniquely naming the sort columns\n    sort_keys_dtypes = []  # sortable_table dtypes as list of (name, dtype_str, shape) tuples\n    sort_keys = []  # sortable_table (structured ndarray) column names\n    sort_left = {}  # sortable ndarrays from left table\n    sort_right = {}  # sortable ndarray from right table\n\n    for key in keys:\n        # get_sortable_arrays() returns a list of ndarrays that can be lexically\n        # sorted to represent the order of the column. In most cases this is just\n        # a single element of the column itself.\n        left_sort_cols = left[key].info.get_sortable_arrays()\n        right_sort_cols = right[key].info.get_sortable_arrays()\n\n        if len(left_sort_cols) != len(right_sort_cols):\n            # Should never happen because cols are screened beforehand for compatibility\n            raise RuntimeError('mismatch in sort cols lengths')\n\n        for left_sort_col, right_sort_col in zip(left_sort_cols, right_sort_cols):\n            # Check for consistency of shapes. Mismatch should never happen.\n            shape = left_sort_col.shape[1:]\n            if shape != right_sort_col.shape[1:]:\n                raise RuntimeError('mismatch in shape of left vs. right sort array')\n\n            if shape != ():\n                raise ValueError(f'sort key column {key!r} must be 1-d')\n\n            sort_key = str(ii)\n            sort_keys.append(sort_key)\n            sort_left[sort_key] = left_sort_col\n            sort_right[sort_key] = right_sort_col\n\n            # Build up dtypes for the structured array that gets sorted.\n            dtype_str = common_dtype([left_sort_col, right_sort_col])\n            sort_keys_dtypes.append((sort_key, dtype_str))\n            ii += 1\n\n    # Make the empty sortable table and fill it\n    len_left = len(left)\n    sortable_table = np.empty(len_left + len(right), dtype=sort_keys_dtypes)\n    for key in sort_keys:\n        sortable_table[key][:len_left] = sort_left[key]\n        sortable_table[key][len_left:] = sort_right[key]\n\n    # Finally do the (lexical) argsort and make a new sorted version\n    idx_sort = sortable_table.argsort(order=sort_keys)\n    sorted_table = sortable_table[idx_sort]\n\n    # Get indexes of unique elements (i.e. the group boundaries)\n    diffs = np.concatenate(([True], sorted_table[1:] != sorted_table[:-1], [True]))\n    idxs = np.flatnonzero(diffs)\n\n    return idxs, idx_sort\n\n\ndef _apply_join_funcs(left, right, keys, join_funcs):\n    \"\"\"Apply join_funcs\n    \"\"\"\n    # Make light copies of left and right, then add new index columns.\n    left = left.copy(copy_data=False)\n    right = right.copy(copy_data=False)\n    for key, join_func in join_funcs.items():\n        ids1, ids2 = join_func(left[key], right[key])\n        # Define a unique id_key name, and keep adding underscores until we have\n        # a name not yet present.\n        id_key = key + '_id'\n        while id_key in left.columns or id_key in right.columns:\n            id_key = id_key[:-2] + '_id'\n\n        keys = tuple(id_key if orig_key == key else orig_key for orig_key in keys)\n        left.add_column(ids1, index=0, name=id_key)  # [id_key] = ids1\n        right.add_column(ids2, index=0, name=id_key)  # [id_key] = ids2\n\n    return left, right, keys\n\n\ndef _join(left, right, keys=None, join_type='inner',\n          uniq_col_name='{col_name}_{table_name}',\n          table_names=['1', '2'],\n          col_name_map=None, metadata_conflicts='warn',\n          join_funcs=None,\n          keys_left=None, keys_right=None):\n    \"\"\"\n    Perform a join of the left and right Tables on specified keys.\n\n    Parameters\n    ----------\n    left : Table\n        Left side table in the join\n    right : Table\n        Right side table in the join\n    keys : str or list of str\n        Name(s) of column(s) used to match rows of left and right tables.\n        Default is to use all columns which are common to both tables.\n    join_type : str\n        Join type ('inner' | 'outer' | 'left' | 'right' | 'cartesian'), default is 'inner'\n    uniq_col_name : str or None\n        String generate a unique output column name in case of a conflict.\n        The default is '{col_name}_{table_name}'.\n    table_names : list of str or None\n        Two-element list of table names used when generating unique output\n        column names.  The default is ['1', '2'].\n    col_name_map : empty dict or None\n        If passed as a dict then it will be updated in-place with the\n        mapping of output to input column names.\n    metadata_conflicts : str\n        How to proceed with metadata conflicts. This should be one of:\n            * ``'silent'``: silently pick the last conflicting meta-data value\n            * ``'warn'``: pick the last conflicting meta-data value, but emit a warning (default)\n            * ``'error'``: raise an exception.\n    join_funcs : dict, None\n        Dict of functions to use for matching the corresponding key column(s).\n        See `~astropy.table.join_skycoord` for an example and details.\n\n    Returns\n    -------\n    joined_table : `~astropy.table.Table` object\n        New table containing the result of the join operation.\n    \"\"\"\n    # Store user-provided col_name_map until the end\n    _col_name_map = col_name_map\n\n    # Special column name for cartesian join, should never collide with real column\n    cartesian_index_name = '__table_cartesian_join_temp_index__'\n\n    if join_type not in ('inner', 'outer', 'left', 'right', 'cartesian'):\n        raise ValueError(\"The 'join_type' argument should be in 'inner', \"\n                         \"'outer', 'left', 'right', or 'cartesian' \"\n                         \"(got '{}' instead)\".\n                         format(join_type))\n\n    if join_type == 'cartesian':\n        if keys:\n            raise ValueError('cannot supply keys for a cartesian join')\n\n        if join_funcs:\n            raise ValueError('cannot supply join_funcs for a cartesian join')\n\n        # Make light copies of left and right, then add temporary index columns\n        # with all the same value so later an outer join turns into a cartesian join.\n        left = left.copy(copy_data=False)\n        right = right.copy(copy_data=False)\n        left[cartesian_index_name] = np.uint8(0)\n        right[cartesian_index_name] = np.uint8(0)\n        keys = (cartesian_index_name, )\n\n    # Handle the case of join key columns that are different between left and\n    # right via keys_left/keys_right args. This is done by saving the original\n    # input tables and making new left and right tables that contain only the\n    # key cols but with common column names ['0', '1', etc]. This sets `keys` to\n    # those fake key names in the left and right tables\n    if keys_left is not None or keys_right is not None:\n        left_orig = left\n        right_orig = right\n        left, right, keys = _join_keys_left_right(\n            left, right, keys, keys_left, keys_right, join_funcs)\n\n    if keys is None:\n        keys = tuple(name for name in left.colnames if name in right.colnames)\n        if len(keys) == 0:\n            raise TableMergeError('No keys in common between left and right tables')\n    elif isinstance(keys, str):\n        # If we have a single key, put it in a tuple\n        keys = (keys,)\n\n    # Check the key columns\n    for arr, arr_label in ((left, 'Left'), (right, 'Right')):\n        for name in keys:\n            if name not in arr.colnames:\n                raise TableMergeError('{} table does not have key column {!r}'\n                                      .format(arr_label, name))\n            if hasattr(arr[name], 'mask') and np.any(arr[name].mask):\n                raise TableMergeError('{} key column {!r} has missing values'\n                                      .format(arr_label, name))\n\n    if join_funcs is not None:\n        if not all(key in keys for key in join_funcs):\n            raise ValueError(f'join_funcs keys {join_funcs.keys()} must be a '\n                             f'subset of join keys {keys}')\n        left, right, keys = _apply_join_funcs(left, right, keys, join_funcs)\n\n    len_left, len_right = len(left), len(right)\n\n    if len_left == 0 or len_right == 0:\n        raise ValueError('input tables for join must both have at least one row')\n\n    try:\n        idxs, idx_sort = _get_join_sort_idxs(keys, left, right)\n    except NotImplementedError:\n        raise TypeError('one or more key columns are not sortable')\n\n    # Now that we have idxs and idx_sort, revert to the original table args to\n    # carry on with making the output joined table. `keys` is set to to an empty\n    # list so that all original left and right columns are included in the\n    # output table.\n    if keys_left is not None or keys_right is not None:\n        keys = []\n        left = left_orig\n        right = right_orig\n\n    # Joined array dtype as a list of descr (name, type_str, shape) tuples\n    col_name_map = get_col_name_map([left, right], keys, uniq_col_name, table_names)\n    out_descrs = get_descrs([left, right], col_name_map)\n\n    # Main inner loop in Cython to compute the cartesian product\n    # indices for the given join type\n    int_join_type = {'inner': 0, 'outer': 1, 'left': 2, 'right': 3,\n                     'cartesian': 1}[join_type]\n    masked, n_out, left_out, left_mask, right_out, right_mask = \\\n        _np_utils.join_inner(idxs, idx_sort, len_left, int_join_type)\n\n    out = _get_out_class([left, right])()\n\n    for out_name, dtype, shape in out_descrs:\n        if out_name == cartesian_index_name:\n            continue\n\n        left_name, right_name = col_name_map[out_name]\n        if left_name and right_name:  # this is a key which comes from left and right\n            cols = [left[left_name], right[right_name]]\n\n            col_cls = _get_out_class(cols)\n            if not hasattr(col_cls.info, 'new_like'):\n                raise NotImplementedError('join unavailable for mixin column type(s): {}'\n                                          .format(col_cls.__name__))\n\n            out[out_name] = col_cls.info.new_like(cols, n_out, metadata_conflicts, out_name)\n            out[out_name][:] = np.where(right_mask,\n                                        left[left_name].take(left_out),\n                                        right[right_name].take(right_out))\n            continue\n        elif left_name:  # out_name came from the left table\n            name, array, array_out, array_mask = left_name, left, left_out, left_mask\n        elif right_name:\n            name, array, array_out, array_mask = right_name, right, right_out, right_mask\n        else:\n            raise TableMergeError('Unexpected column names (maybe one is \"\"?)')\n\n        # Select the correct elements from the original table\n        col = array[name][array_out]\n\n        # If the output column is masked then set the output column masking\n        # accordingly.  Check for columns that don't support a mask attribute.\n        if masked and np.any(array_mask):\n            # If col is a Column but not MaskedColumn then upgrade at this point\n            # because masking is required.\n            if isinstance(col, Column) and not isinstance(col, MaskedColumn):\n                col = out.MaskedColumn(col, copy=False)\n\n            if isinstance(col, Quantity) and not isinstance(col, Masked):\n                col = Masked(col, copy=False)\n\n            # array_mask is 1-d corresponding to length of output column.  We need\n            # make it have the correct shape for broadcasting, i.e. (length, 1, 1, ..).\n            # Mixin columns might not have ndim attribute so use len(col.shape).\n            array_mask.shape = (col.shape[0],) + (1,) * (len(col.shape) - 1)\n\n            # Now broadcast to the correct final shape\n            array_mask = np.broadcast_to(array_mask, col.shape)\n\n            try:\n                col[array_mask] = col.info.mask_val\n            except Exception as err:  # Not clear how different classes will fail here\n                raise NotImplementedError(\n                    \"join requires masking column '{}' but column\"\n                    \" type {} does not support masking\"\n                    .format(out_name, col.__class__.__name__)) from err\n\n        # Set the output table column to the new joined column\n        out[out_name] = col\n\n    # If col_name_map supplied as a dict input, then update.\n    if isinstance(_col_name_map, Mapping):\n        _col_name_map.update(col_name_map)\n\n    return out\n\n\ndef _join_keys_left_right(left, right, keys, keys_left, keys_right, join_funcs):\n    \"\"\"Do processing to handle keys_left / keys_right args for join.\n\n    This takes the keys_left/right inputs and turns them into a list of left/right\n    columns corresponding to those inputs (which can be column names or column\n    data values). It also generates the list of fake key column names (strings\n    of \"1\", \"2\", etc.) that correspond to the input keys.\n    \"\"\"\n    def _keys_to_cols(keys, table, label):\n        # Process input `keys`, which is a str or list of str column names in\n        # `table` or a list of column-like objects. The `label` is just for\n        # error reporting.\n        if isinstance(keys, str):\n            keys = [keys]\n        cols = []\n        for key in keys:\n            if isinstance(key, str):\n                try:\n                    cols.append(table[key])\n                except KeyError:\n                    raise ValueError(f'{label} table does not have key column {key!r}')\n            else:\n                if len(key) != len(table):\n                    raise ValueError(f'{label} table has different length from key {key}')\n                cols.append(key)\n        return cols\n\n    if join_funcs is not None:\n        raise ValueError('cannot supply join_funcs arg and keys_left / keys_right')\n\n    if keys_left is None or keys_right is None:\n        raise ValueError('keys_left and keys_right must both be provided')\n\n    if keys is not None:\n        raise ValueError('keys arg must be None if keys_left and keys_right are supplied')\n\n    cols_left = _keys_to_cols(keys_left, left, 'left')\n    cols_right = _keys_to_cols(keys_right, right, 'right')\n\n    if len(cols_left) != len(cols_right):\n        raise ValueError('keys_left and keys_right args must have same length')\n\n    # Make two new temp tables for the join with only the join columns and\n    # key columns in common.\n    keys = [f'{ii}' for ii in range(len(cols_left))]\n\n    left = left.__class__(cols_left, names=keys, copy=False)\n    right = right.__class__(cols_right, names=keys, copy=False)\n\n    return left, right, keys\n\n\ndef _check_join_type(join_type, func_name):\n    \"\"\"Check join_type arg in hstack and vstack.\n\n    This specifically checks for the common mistake of call vstack(t1, t2)\n    instead of vstack([t1, t2]). The subsequent check of\n    ``join_type in ('inner', ..)`` does not raise in this case.\n    \"\"\"\n    if not isinstance(join_type, str):\n        msg = '`join_type` arg must be a string'\n        if isinstance(join_type, Table):\n            msg += ('. Did you accidentally '\n                    f'call {func_name}(t1, t2, ..) instead of '\n                    f'{func_name}([t1, t2], ..)?')\n        raise TypeError(msg)\n\n    if join_type not in ('inner', 'exact', 'outer'):\n        raise ValueError(\"`join_type` arg must be one of 'inner', 'exact' or 'outer'\")\n\n\ndef _vstack(arrays, join_type='outer', col_name_map=None, metadata_conflicts='warn'):\n    \"\"\"\n    Stack Tables vertically (by rows)\n\n    A ``join_type`` of 'exact' (default) means that the arrays must all\n    have exactly the same column names (though the order can vary).  If\n    ``join_type`` is 'inner' then the intersection of common columns will\n    be the output.  A value of 'outer' means the output will have the union of\n    all columns, with array values being masked where no common values are\n    available.\n\n    Parameters\n    ----------\n    arrays : list of Tables\n        Tables to stack by rows (vertically)\n    join_type : str\n        Join type ('inner' | 'exact' | 'outer'), default is 'outer'\n    col_name_map : empty dict or None\n        If passed as a dict then it will be updated in-place with the\n        mapping of output to input column names.\n\n    Returns\n    -------\n    stacked_table : `~astropy.table.Table` object\n        New table containing the stacked data from the input tables.\n    \"\"\"\n    # Store user-provided col_name_map until the end\n    _col_name_map = col_name_map\n\n    # Trivial case of one input array\n    if len(arrays) == 1:\n        return arrays[0]\n\n    # Start by assuming an outer match where all names go to output\n    names = set(itertools.chain(*[arr.colnames for arr in arrays]))\n    col_name_map = get_col_name_map(arrays, names)\n\n    # If require_match is True then the output must have exactly the same\n    # number of columns as each input array\n    if join_type == 'exact':\n        for names in col_name_map.values():\n            if any(x is None for x in names):\n                raise TableMergeError('Inconsistent columns in input arrays '\n                                      \"(use 'inner' or 'outer' join_type to \"\n                                      \"allow non-matching columns)\")\n        join_type = 'outer'\n\n    # For an inner join, keep only columns where all input arrays have that column\n    if join_type == 'inner':\n        col_name_map = OrderedDict((name, in_names) for name, in_names in col_name_map.items()\n                                   if all(x is not None for x in in_names))\n        if len(col_name_map) == 0:\n            raise TableMergeError('Input arrays have no columns in common')\n\n    lens = [len(arr) for arr in arrays]\n    n_rows = sum(lens)\n    out = _get_out_class(arrays)()\n\n    for out_name, in_names in col_name_map.items():\n        # List of input arrays that contribute to this output column\n        cols = [arr[name] for arr, name in zip(arrays, in_names) if name is not None]\n\n        col_cls = _get_out_class(cols)\n        if not hasattr(col_cls.info, 'new_like'):\n            raise NotImplementedError('vstack unavailable for mixin column type(s): {}'\n                                      .format(col_cls.__name__))\n        try:\n            col = col_cls.info.new_like(cols, n_rows, metadata_conflicts, out_name)\n        except metadata.MergeConflictError as err:\n            # Beautify the error message when we are trying to merge columns with incompatible\n            # types by including the name of the columns that originated the error.\n            raise TableMergeError(\"The '{}' columns have incompatible types: {}\"\n                                  .format(out_name, err._incompat_types)) from err\n\n        idx0 = 0\n        for name, array in zip(in_names, arrays):\n            idx1 = idx0 + len(array)\n            if name in array.colnames:\n                col[idx0:idx1] = array[name]\n            else:\n                # If col is a Column but not MaskedColumn then upgrade at this point\n                # because masking is required.\n                if isinstance(col, Column) and not isinstance(col, MaskedColumn):\n                    col = out.MaskedColumn(col, copy=False)\n\n                if isinstance(col, Quantity) and not isinstance(col, Masked):\n                    col = Masked(col, copy=False)\n\n                try:\n                    col[idx0:idx1] = col.info.mask_val\n                except Exception as err:\n                    raise NotImplementedError(\n                        \"vstack requires masking column '{}' but column\"\n                        \" type {} does not support masking\"\n                        .format(out_name, col.__class__.__name__)) from err\n            idx0 = idx1\n\n        out[out_name] = col\n\n    # If col_name_map supplied as a dict input, then update.\n    if isinstance(_col_name_map, Mapping):\n        _col_name_map.update(col_name_map)\n\n    return out\n\n\ndef _hstack(arrays, join_type='outer', uniq_col_name='{col_name}_{table_name}',\n            table_names=None, col_name_map=None):\n    \"\"\"\n    Stack tables horizontally (by columns)\n\n    A ``join_type`` of 'exact' (default) means that the arrays must all\n    have exactly the same number of rows.  If ``join_type`` is 'inner' then\n    the intersection of rows will be the output.  A value of 'outer' means\n    the output will have the union of all rows, with array values being\n    masked where no common values are available.\n\n    Parameters\n    ----------\n    arrays : List of tables\n        Tables to stack by columns (horizontally)\n    join_type : str\n        Join type ('inner' | 'exact' | 'outer'), default is 'outer'\n    uniq_col_name : str or None\n        String generate a unique output column name in case of a conflict.\n        The default is '{col_name}_{table_name}'.\n    table_names : list of str or None\n        Two-element list of table names used when generating unique output\n        column names.  The default is ['1', '2', ..].\n\n    Returns\n    -------\n    stacked_table : `~astropy.table.Table` object\n        New table containing the stacked data from the input tables.\n    \"\"\"\n\n    # Store user-provided col_name_map until the end\n    _col_name_map = col_name_map\n\n    if table_names is None:\n        table_names = [f'{ii + 1}' for ii in range(len(arrays))]\n    if len(arrays) != len(table_names):\n        raise ValueError('Number of arrays must match number of table_names')\n\n    # Trivial case of one input arrays\n    if len(arrays) == 1:\n        return arrays[0]\n\n    col_name_map = get_col_name_map(arrays, [], uniq_col_name, table_names)\n\n    # If require_match is True then all input arrays must have the same length\n    arr_lens = [len(arr) for arr in arrays]\n    if join_type == 'exact':\n        if len(set(arr_lens)) > 1:\n            raise TableMergeError(\"Inconsistent number of rows in input arrays \"\n                                  \"(use 'inner' or 'outer' join_type to allow \"\n                                  \"non-matching rows)\")\n        join_type = 'outer'\n\n    # For an inner join, keep only the common rows\n    if join_type == 'inner':\n        min_arr_len = min(arr_lens)\n        if len(set(arr_lens)) > 1:\n            arrays = [arr[:min_arr_len] for arr in arrays]\n        arr_lens = [min_arr_len for arr in arrays]\n\n    # If there are any output rows where one or more input arrays are missing\n    # then the output must be masked.  If any input arrays are masked then\n    # output is masked.\n\n    n_rows = max(arr_lens)\n    out = _get_out_class(arrays)()\n\n    for out_name, in_names in col_name_map.items():\n        for name, array, arr_len in zip(in_names, arrays, arr_lens):\n            if name is None:\n                continue\n\n            if n_rows > arr_len:\n                indices = np.arange(n_rows)\n                indices[arr_len:] = 0\n                col = array[name][indices]\n\n                # If col is a Column but not MaskedColumn then upgrade at this point\n                # because masking is required.\n                if isinstance(col, Column) and not isinstance(col, MaskedColumn):\n                    col = out.MaskedColumn(col, copy=False)\n\n                if isinstance(col, Quantity) and not isinstance(col, Masked):\n                    col = Masked(col, copy=False)\n\n                try:\n                    col[arr_len:] = col.info.mask_val\n                except Exception as err:\n                    raise NotImplementedError(\n                        \"hstack requires masking column '{}' but column\"\n                        \" type {} does not support masking\"\n                        .format(out_name, col.__class__.__name__)) from err\n            else:\n                col = array[name][:n_rows]\n\n            out[out_name] = col\n\n    # If col_name_map supplied as a dict input, then update.\n    if isinstance(_col_name_map, Mapping):\n        _col_name_map.update(col_name_map)\n\n    return out\n"},{"className":"Masked","col":0,"comment":"A scalar value or array of values with associated mask.\n\n    The resulting instance will take its exact type from whatever the\n    contents are, with the type generated on the fly as needed.\n\n    Parameters\n    ----------\n    data : array-like\n        The data for which a mask is to be added.  The result will be a\n        a subclass of the type of ``data``.\n    mask : array-like of bool, optional\n        The initial mask to assign.  If not given, taken from the data.\n    copy : bool\n        Whether the data and mask should be copied. Default: `False`.\n\n    ","endLoc":290,"id":8907,"nodeType":"Class","startLoc":42,"text":"class Masked(NDArrayShapeMethods):\n    \"\"\"A scalar value or array of values with associated mask.\n\n    The resulting instance will take its exact type from whatever the\n    contents are, with the type generated on the fly as needed.\n\n    Parameters\n    ----------\n    data : array-like\n        The data for which a mask is to be added.  The result will be a\n        a subclass of the type of ``data``.\n    mask : array-like of bool, optional\n        The initial mask to assign.  If not given, taken from the data.\n    copy : bool\n        Whether the data and mask should be copied. Default: `False`.\n\n    \"\"\"\n\n    _base_classes = {}\n    \"\"\"Explicitly defined masked classes keyed by their unmasked counterparts.\n\n    For subclasses of these unmasked classes, masked counterparts can be generated.\n    \"\"\"\n\n    _masked_classes = {}\n    \"\"\"Masked classes keyed by their unmasked data counterparts.\"\"\"\n\n    def __new__(cls, *args, **kwargs):\n        if cls is Masked:\n            # Initializing with Masked itself means we're in \"factory mode\".\n            if not kwargs and len(args) == 1 and isinstance(args[0], type):\n                # Create a new masked class.\n                return cls._get_masked_cls(args[0])\n            else:\n                return cls._get_masked_instance(*args, **kwargs)\n        else:\n            # Otherwise we're a subclass and should just pass information on.\n            return super().__new__(cls, *args, **kwargs)\n\n    def __init_subclass__(cls, base_cls=None, data_cls=None, **kwargs):\n        \"\"\"Register a Masked subclass.\n\n        Parameters\n        ----------\n        base_cls : type, optional\n            If given, it is taken to mean that ``cls`` can be used as\n            a base for masked versions of all subclasses of ``base_cls``,\n            so it is registered as such in ``_base_classes``.\n        data_cls : type, optional\n            If given, ``cls`` should will be registered as the masked version of\n            ``data_cls``.  Will set the private ``cls._data_cls`` attribute,\n            and auto-generate a docstring if not present already.\n        **kwargs\n            Passed on for possible further initialization by superclasses.\n\n        \"\"\"\n        if base_cls is not None:\n            Masked._base_classes[base_cls] = cls\n\n        if data_cls is not None:\n            cls._data_cls = data_cls\n            cls._masked_classes[data_cls] = cls\n            if cls.__doc__ is None:\n                cls.__doc__ = get__doc__(data_cls)\n\n        super().__init_subclass__(**kwargs)\n\n    # This base implementation just uses the class initializer.\n    # Subclasses can override this in case the class does not work\n    # with this signature, or to provide a faster implementation.\n    @classmethod\n    def from_unmasked(cls, data, mask=None, copy=False):\n        \"\"\"Create an instance from unmasked data and a mask.\"\"\"\n        return cls(data, mask=mask, copy=copy)\n\n    @classmethod\n    def _get_masked_instance(cls, data, mask=None, copy=False):\n        data, data_mask = cls._get_data_and_mask(data)\n        if mask is None:\n            mask = False if data_mask is None else data_mask\n\n        masked_cls = cls._get_masked_cls(data.__class__)\n        return masked_cls.from_unmasked(data, mask, copy)\n\n    @classmethod\n    def _get_masked_cls(cls, data_cls):\n        \"\"\"Get the masked wrapper for a given data class.\n\n        If the data class does not exist yet but is a subclass of any of the\n        registered base data classes, it is automatically generated\n        (except we skip `~numpy.ma.MaskedArray` subclasses, since then the\n        masking mechanisms would interfere).\n        \"\"\"\n        if issubclass(data_cls, (Masked, np.ma.MaskedArray)):\n            return data_cls\n\n        masked_cls = cls._masked_classes.get(data_cls)\n        if masked_cls is None:\n            # Walk through MRO and find closest base data class.\n            # Note: right now, will basically always be ndarray, but\n            # one could imagine needing some special care for one subclass,\n            # which would then get its own entry.  E.g., if MaskedAngle\n            # defined something special, then MaskedLongitude should depend\n            # on it.\n            for mro_item in data_cls.__mro__:\n                base_cls = cls._base_classes.get(mro_item)\n                if base_cls is not None:\n                    break\n            else:\n                # Just hope that MaskedNDArray can handle it.\n                # TODO: this covers the case where a user puts in a list or so,\n                # but for those one could just explicitly do something like\n                # _masked_classes[list] = MaskedNDArray.\n                return MaskedNDArray\n\n            # Create (and therefore register) new Masked subclass for the\n            # given data_cls.\n            masked_cls = type('Masked' + data_cls.__name__,\n                              (data_cls, base_cls), {}, data_cls=data_cls)\n\n        return masked_cls\n\n    @classmethod\n    def _get_data_and_mask(cls, data, allow_ma_masked=False):\n        \"\"\"Split data into unmasked and mask, if present.\n\n        Parameters\n        ----------\n        data : array-like\n            Possibly masked item, judged by whether it has a ``mask`` attribute.\n            If so, checks for being an instance of `~astropy.utils.masked.Masked`\n            or `~numpy.ma.MaskedArray`, and gets unmasked data appropriately.\n        allow_ma_masked : bool, optional\n            Whether or not to process `~numpy.ma.masked`, i.e., an item that\n            implies no data but the presence of a mask.\n\n        Returns\n        -------\n        unmasked, mask : array-like\n            Unmasked will be `None` for `~numpy.ma.masked`.\n\n        Raises\n        ------\n        ValueError\n            If `~numpy.ma.masked` is passed in and ``allow_ma_masked`` is not set.\n\n        \"\"\"\n        mask = getattr(data, 'mask', None)\n        if mask is not None:\n            try:\n                data = data.unmasked\n            except AttributeError:\n                if not isinstance(data, np.ma.MaskedArray):\n                    raise\n                if data is np.ma.masked:\n                    if allow_ma_masked:\n                        data = None\n                    else:\n                        raise ValueError('cannot handle np.ma.masked here.') from None\n                else:\n                    data = data.data\n\n        return data, mask\n\n    @classmethod\n    def _get_data_and_masks(cls, *args):\n        data_masks = [cls._get_data_and_mask(arg) for arg in args]\n        return (tuple(data for data, _ in data_masks),\n                tuple(mask for _, mask in data_masks))\n\n    def _get_mask(self):\n        \"\"\"The mask.\n\n        If set, replace the original mask, with whatever it is set with,\n        using a view if no broadcasting or type conversion is required.\n        \"\"\"\n        return self._mask\n\n    def _set_mask(self, mask, copy=False):\n        self_dtype = getattr(self, 'dtype', None)\n        mask_dtype = (np.ma.make_mask_descr(self_dtype)\n                      if self_dtype and self_dtype.names else np.dtype('?'))\n        ma = np.asanyarray(mask, dtype=mask_dtype)\n        if ma.shape != self.shape:\n            # This will fail (correctly) if not broadcastable.\n            self._mask = np.empty(self.shape, dtype=mask_dtype)\n            self._mask[...] = ma\n        elif ma is mask:\n            # Even if not copying use a view so that shape setting\n            # does not propagate.\n            self._mask = mask.copy() if copy else mask.view()\n        else:\n            self._mask = ma\n\n    mask = property(_get_mask, _set_mask)\n\n    # Note: subclass should generally override the unmasked property.\n    # This one assumes the unmasked data is stored in a private attribute.\n    @property\n    def unmasked(self):\n        \"\"\"The unmasked values.\n\n        See Also\n        --------\n        astropy.utils.masked.Masked.filled\n        \"\"\"\n        return self._unmasked\n\n    def filled(self, fill_value):\n        \"\"\"Get a copy of the underlying data, with masked values filled in.\n\n        Parameters\n        ----------\n        fill_value : object\n            Value to replace masked values with.\n\n        See Also\n        --------\n        astropy.utils.masked.Masked.unmasked\n        \"\"\"\n        unmasked = self.unmasked.copy()\n        if self.mask.dtype.names:\n            np.ma.core._recursive_filled(unmasked, self.mask, fill_value)\n        else:\n            unmasked[self.mask] = fill_value\n\n        return unmasked\n\n    def _apply(self, method, *args, **kwargs):\n        # Required method for NDArrayShapeMethods, to help provide __getitem__\n        # and shape-changing methods.\n        if callable(method):\n            data = method(self.unmasked, *args, **kwargs)\n            mask = method(self.mask, *args, **kwargs)\n        else:\n            data = getattr(self.unmasked, method)(*args, **kwargs)\n            mask = getattr(self.mask, method)(*args, **kwargs)\n\n        result = self.from_unmasked(data, mask, copy=False)\n        if 'info' in self.__dict__:\n            result.info = self.info\n\n        return result\n\n    def __setitem__(self, item, value):\n        value, mask = self._get_data_and_mask(value, allow_ma_masked=True)\n        if value is not None:\n            self.unmasked[item] = value\n        self.mask[item] = mask"},{"col":4,"comment":"Register a Masked subclass.\n\n        Parameters\n        ----------\n        base_cls : type, optional\n            If given, it is taken to mean that ``cls`` can be used as\n            a base for masked versions of all subclasses of ``base_cls``,\n            so it is registered as such in ``_base_classes``.\n        data_cls : type, optional\n            If given, ``cls`` should will be registered as the masked version of\n            ``data_cls``.  Will set the private ``cls._data_cls`` attribute,\n            and auto-generate a docstring if not present already.\n        **kwargs\n            Passed on for possible further initialization by superclasses.\n\n        ","endLoc":107,"header":"def __init_subclass__(cls, base_cls=None, data_cls=None, **kwargs)","id":8908,"name":"__init_subclass__","nodeType":"Function","startLoc":81,"text":"def __init_subclass__(cls, base_cls=None, data_cls=None, **kwargs):\n        \"\"\"Register a Masked subclass.\n\n        Parameters\n        ----------\n        base_cls : type, optional\n            If given, it is taken to mean that ``cls`` can be used as\n            a base for masked versions of all subclasses of ``base_cls``,\n            so it is registered as such in ``_base_classes``.\n        data_cls : type, optional\n            If given, ``cls`` should will be registered as the masked version of\n            ``data_cls``.  Will set the private ``cls._data_cls`` attribute,\n            and auto-generate a docstring if not present already.\n        **kwargs\n            Passed on for possible further initialization by superclasses.\n\n        \"\"\"\n        if base_cls is not None:\n            Masked._base_classes[base_cls] = cls\n\n        if data_cls is not None:\n            cls._data_cls = data_cls\n            cls._masked_classes[data_cls] = cls\n            if cls.__doc__ is None:\n                cls.__doc__ = get__doc__(data_cls)\n\n        super().__init_subclass__(**kwargs)"},{"col":4,"comment":"null","endLoc":167,"header":"def _validate_frequency(self, frequency)","id":8909,"name":"_validate_frequency","nodeType":"Function","startLoc":154,"text":"def _validate_frequency(self, frequency):\n        frequency = np.asanyarray(frequency)\n\n        if has_units(self._trel):\n            frequency = units.Quantity(frequency)\n            try:\n                frequency = units.Quantity(frequency, unit=1./self._trel.unit)\n            except units.UnitConversionError:\n                raise ValueError(\"Units of frequency not equivalent to \"\n                                 \"units of 1/t\")\n        else:\n            if has_units(frequency):\n                raise ValueError(\"frequency have units while 1/t doesn't.\")\n        return frequency"},{"col":0,"comment":"null","endLoc":27,"header":"def strip_units(*arrs)","id":8910,"name":"strip_units","nodeType":"Function","startLoc":22,"text":"def strip_units(*arrs):\n    strip = lambda a: None if a is None else np.asarray(a)\n    if len(arrs) == 1:\n        return strip(arrs[0])\n    else:\n        return map(strip, arrs)"},{"col":12,"endLoc":23,"id":8911,"nodeType":"Lambda","startLoc":23,"text":"lambda a: None if a is None else np.asarray(a)"},{"col":4,"comment":"null","endLoc":179,"header":"def _validate_t(self, t)","id":8912,"name":"_validate_t","nodeType":"Function","startLoc":169,"text":"def _validate_t(self, t):\n        t = np.asanyarray(t)\n\n        if has_units(self._trel):\n            t = units.Quantity(t)\n            try:\n                t = units.Quantity(t, unit=self._trel.unit)\n            except units.UnitConversionError:\n                raise ValueError(\"Units of t not equivalent to \"\n                                 \"units of input self.t\")\n        return t"},{"col":4,"comment":"Create an instance from unmasked data and a mask.","endLoc":115,"header":"@classmethod\n    def from_unmasked(cls, data, mask=None, copy=False)","id":8913,"name":"from_unmasked","nodeType":"Function","startLoc":112,"text":"@classmethod\n    def from_unmasked(cls, data, mask=None, copy=False):\n        \"\"\"Create an instance from unmasked data and a mask.\"\"\"\n        return cls(data, mask=mask, copy=copy)"},{"col":4,"comment":"null","endLoc":210,"header":"@classmethod\n    def _get_data_and_masks(cls, *args)","id":8914,"name":"_get_data_and_masks","nodeType":"Function","startLoc":206,"text":"@classmethod\n    def _get_data_and_masks(cls, *args):\n        data_masks = [cls._get_data_and_mask(arg) for arg in args]\n        return (tuple(data for data, _ in data_masks),\n                tuple(mask for _, mask in data_masks))"},{"col":4,"comment":"null","endLoc":188,"header":"def _power_unit(self, norm)","id":8915,"name":"_power_unit","nodeType":"Function","startLoc":181,"text":"def _power_unit(self, norm):\n        if has_units(self.y):\n            if self.dy is None and norm == 'psd':\n                return self.y.unit ** 2\n            else:\n                return units.dimensionless_unscaled\n        else:\n            return 1"},{"col":4,"comment":"The mask.\n\n        If set, replace the original mask, with whatever it is set with,\n        using a view if no broadcasting or type conversion is required.\n        ","endLoc":218,"header":"def _get_mask(self)","id":8916,"name":"_get_mask","nodeType":"Function","startLoc":212,"text":"def _get_mask(self):\n        \"\"\"The mask.\n\n        If set, replace the original mask, with whatever it is set with,\n        using a view if no broadcasting or type conversion is required.\n        \"\"\"\n        return self._mask"},{"col":4,"comment":"Determine a suitable frequency grid for data.\n\n        Note that this assumes the peak width is driven by the observational\n        baseline, which is generally a good assumption when the baseline is\n        much larger than the oscillation period.\n        If you are searching for periods longer than the baseline of your\n        observations, this may not perform well.\n\n        Even with a large baseline, be aware that the maximum frequency\n        returned is based on the concept of \"average Nyquist frequency\", which\n        may not be useful for irregularly-sampled data. The maximum frequency\n        can be adjusted via the nyquist_factor argument, or through the\n        maximum_frequency argument.\n\n        Parameters\n        ----------\n        samples_per_peak : float, optional\n            The approximate number of desired samples across the typical peak\n        nyquist_factor : float, optional\n            The multiple of the average nyquist frequency used to choose the\n            maximum frequency if maximum_frequency is not provided.\n        minimum_frequency : float, optional\n            If specified, then use this minimum frequency rather than one\n            chosen based on the size of the baseline.\n        maximum_frequency : float, optional\n            If specified, then use this maximum frequency rather than one\n            chosen based on the average nyquist frequency.\n        return_freq_limits : bool, optional\n            if True, return only the frequency limits rather than the full\n            frequency grid.\n\n        Returns\n        -------\n        frequency : ndarray or `~astropy.units.Quantity` ['frequency']\n            The heuristically-determined optimal frequency bin\n        ","endLoc":246,"header":"def autofrequency(self, samples_per_peak=5, nyquist_factor=5,\n                      minimum_frequency=None, maximum_frequency=None,\n                      return_freq_limits=False)","id":8917,"name":"autofrequency","nodeType":"Function","startLoc":190,"text":"def autofrequency(self, samples_per_peak=5, nyquist_factor=5,\n                      minimum_frequency=None, maximum_frequency=None,\n                      return_freq_limits=False):\n        \"\"\"Determine a suitable frequency grid for data.\n\n        Note that this assumes the peak width is driven by the observational\n        baseline, which is generally a good assumption when the baseline is\n        much larger than the oscillation period.\n        If you are searching for periods longer than the baseline of your\n        observations, this may not perform well.\n\n        Even with a large baseline, be aware that the maximum frequency\n        returned is based on the concept of \"average Nyquist frequency\", which\n        may not be useful for irregularly-sampled data. The maximum frequency\n        can be adjusted via the nyquist_factor argument, or through the\n        maximum_frequency argument.\n\n        Parameters\n        ----------\n        samples_per_peak : float, optional\n            The approximate number of desired samples across the typical peak\n        nyquist_factor : float, optional\n            The multiple of the average nyquist frequency used to choose the\n            maximum frequency if maximum_frequency is not provided.\n        minimum_frequency : float, optional\n            If specified, then use this minimum frequency rather than one\n            chosen based on the size of the baseline.\n        maximum_frequency : float, optional\n            If specified, then use this maximum frequency rather than one\n            chosen based on the average nyquist frequency.\n        return_freq_limits : bool, optional\n            if True, return only the frequency limits rather than the full\n            frequency grid.\n\n        Returns\n        -------\n        frequency : ndarray or `~astropy.units.Quantity` ['frequency']\n            The heuristically-determined optimal frequency bin\n        \"\"\"\n        baseline = self._trel.max() - self._trel.min()\n        n_samples = self._trel.size\n\n        df = 1.0 / baseline / samples_per_peak\n\n        if minimum_frequency is None:\n            minimum_frequency = 0.5 * df\n\n        if maximum_frequency is None:\n            avg_nyquist = 0.5 * n_samples / baseline\n            maximum_frequency = nyquist_factor * avg_nyquist\n\n        Nf = 1 + int(np.round((maximum_frequency - minimum_frequency) / df))\n\n        if return_freq_limits:\n            return minimum_frequency, minimum_frequency + df * (Nf - 1)\n        else:\n            return minimum_frequency + df * np.arange(Nf)"},{"col":4,"comment":"null","endLoc":234,"header":"def _set_mask(self, mask, copy=False)","id":8918,"name":"_set_mask","nodeType":"Function","startLoc":220,"text":"def _set_mask(self, mask, copy=False):\n        self_dtype = getattr(self, 'dtype', None)\n        mask_dtype = (np.ma.make_mask_descr(self_dtype)\n                      if self_dtype and self_dtype.names else np.dtype('?'))\n        ma = np.asanyarray(mask, dtype=mask_dtype)\n        if ma.shape != self.shape:\n            # This will fail (correctly) if not broadcastable.\n            self._mask = np.empty(self.shape, dtype=mask_dtype)\n            self._mask[...] = ma\n        elif ma is mask:\n            # Even if not copying use a view so that shape setting\n            # does not propagate.\n            self._mask = mask.copy() if copy else mask.view()\n        else:\n            self._mask = ma"},{"col":4,"comment":"null","endLoc":751,"header":"def _t_unit(self)","id":8919,"name":"_t_unit","nodeType":"Function","startLoc":747,"text":"def _t_unit(self):\n        if has_units(self._trel):\n            return self._trel.unit\n        else:\n            return 1"},{"col":4,"comment":"Compute the periodogram at set of heuristically determined periods\n\n        This method calls :func:`BoxLeastSquares.autoperiod` to determine\n        the period grid and then :func:`BoxLeastSquares.power` to compute\n        the periodogram. See those methods for documentation of the arguments.\n\n        ","endLoc":232,"header":"def autopower(self, duration, objective=None, method=None, oversample=10,\n                  minimum_n_transit=3, minimum_period=None,\n                  maximum_period=None, frequency_factor=1.0)","id":8920,"name":"autopower","nodeType":"Function","startLoc":216,"text":"def autopower(self, duration, objective=None, method=None, oversample=10,\n                  minimum_n_transit=3, minimum_period=None,\n                  maximum_period=None, frequency_factor=1.0):\n        \"\"\"Compute the periodogram at set of heuristically determined periods\n\n        This method calls :func:`BoxLeastSquares.autoperiod` to determine\n        the period grid and then :func:`BoxLeastSquares.power` to compute\n        the periodogram. See those methods for documentation of the arguments.\n\n        \"\"\"\n        period = self.autoperiod(duration,\n                                 minimum_n_transit=minimum_n_transit,\n                                 minimum_period=minimum_period,\n                                 maximum_period=maximum_period,\n                                 frequency_factor=frequency_factor)\n        return self.power(period, duration, objective=objective, method=method,\n                          oversample=oversample)"},{"col":4,"comment":"The unmasked values.\n\n        See Also\n        --------\n        astropy.utils.masked.Masked.filled\n        ","endLoc":248,"header":"@property\n    def unmasked(self)","id":8921,"name":"unmasked","nodeType":"Function","startLoc":240,"text":"@property\n    def unmasked(self):\n        \"\"\"The unmasked values.\n\n        See Also\n        --------\n        astropy.utils.masked.Masked.filled\n        \"\"\"\n        return self._unmasked"},{"col":4,"comment":"Get a copy of the underlying data, with masked values filled in.\n\n        Parameters\n        ----------\n        fill_value : object\n            Value to replace masked values with.\n\n        See Also\n        --------\n        astropy.utils.masked.Masked.unmasked\n        ","endLoc":268,"header":"def filled(self, fill_value)","id":8922,"name":"filled","nodeType":"Function","startLoc":250,"text":"def filled(self, fill_value):\n        \"\"\"Get a copy of the underlying data, with masked values filled in.\n\n        Parameters\n        ----------\n        fill_value : object\n            Value to replace masked values with.\n\n        See Also\n        --------\n        astropy.utils.masked.Masked.unmasked\n        \"\"\"\n        unmasked = self.unmasked.copy()\n        if self.mask.dtype.names:\n            np.ma.core._recursive_filled(unmasked, self.mask, fill_value)\n        else:\n            unmasked[self.mask] = fill_value\n\n        return unmasked"},{"col":4,"comment":"Compute Lomb-Scargle power at automatically-determined frequencies.\n\n        Parameters\n        ----------\n        method : str, optional\n            specify the lomb scargle implementation to use. Options are:\n\n            - 'auto': choose the best method based on the input\n            - 'fast': use the O[N log N] fast method. Note that this requires\n              evenly-spaced frequencies: by default this will be checked unless\n              ``assume_regular_frequency`` is set to True.\n            - 'slow': use the O[N^2] pure-python implementation\n            - 'cython': use the O[N^2] cython implementation. This is slightly\n              faster than method='slow', but much more memory efficient.\n            - 'chi2': use the O[N^2] chi2/linear-fitting implementation\n            - 'fastchi2': use the O[N log N] chi2 implementation. Note that this\n              requires evenly-spaced frequencies: by default this will be checked\n              unless ``assume_regular_frequency`` is set to True.\n            - 'scipy': use ``scipy.signal.lombscargle``, which is an O[N^2]\n              implementation written in C. Note that this does not support\n              heteroskedastic errors.\n\n        method_kwds : dict, optional\n            additional keywords to pass to the lomb-scargle method\n        normalization : {'standard', 'model', 'log', 'psd'}, optional\n            If specified, override the normalization specified at instantiation.\n        samples_per_peak : float, optional\n            The approximate number of desired samples across the typical peak\n        nyquist_factor : float, optional\n            The multiple of the average nyquist frequency used to choose the\n            maximum frequency if maximum_frequency is not provided.\n        minimum_frequency : float or `~astropy.units.Quantity` ['frequency'], optional\n            If specified, then use this minimum frequency rather than one\n            chosen based on the size of the baseline. Should be `~astropy.units.Quantity`\n            if inputs to LombScargle are `~astropy.units.Quantity`.\n        maximum_frequency : float or `~astropy.units.Quantity` ['frequency'], optional\n            If specified, then use this maximum frequency rather than one\n            chosen based on the average nyquist frequency. Should be `~astropy.units.Quantity`\n            if inputs to LombScargle are `~astropy.units.Quantity`.\n\n        Returns\n        -------\n        frequency, power : ndarray\n            The frequency and Lomb-Scargle power\n        ","endLoc":305,"header":"def autopower(self, method='auto', method_kwds=None,\n                  normalization=None, samples_per_peak=5,\n                  nyquist_factor=5, minimum_frequency=None,\n                  maximum_frequency=None)","id":8923,"name":"autopower","nodeType":"Function","startLoc":248,"text":"def autopower(self, method='auto', method_kwds=None,\n                  normalization=None, samples_per_peak=5,\n                  nyquist_factor=5, minimum_frequency=None,\n                  maximum_frequency=None):\n        \"\"\"Compute Lomb-Scargle power at automatically-determined frequencies.\n\n        Parameters\n        ----------\n        method : str, optional\n            specify the lomb scargle implementation to use. Options are:\n\n            - 'auto': choose the best method based on the input\n            - 'fast': use the O[N log N] fast method. Note that this requires\n              evenly-spaced frequencies: by default this will be checked unless\n              ``assume_regular_frequency`` is set to True.\n            - 'slow': use the O[N^2] pure-python implementation\n            - 'cython': use the O[N^2] cython implementation. This is slightly\n              faster than method='slow', but much more memory efficient.\n            - 'chi2': use the O[N^2] chi2/linear-fitting implementation\n            - 'fastchi2': use the O[N log N] chi2 implementation. Note that this\n              requires evenly-spaced frequencies: by default this will be checked\n              unless ``assume_regular_frequency`` is set to True.\n            - 'scipy': use ``scipy.signal.lombscargle``, which is an O[N^2]\n              implementation written in C. Note that this does not support\n              heteroskedastic errors.\n\n        method_kwds : dict, optional\n            additional keywords to pass to the lomb-scargle method\n        normalization : {'standard', 'model', 'log', 'psd'}, optional\n            If specified, override the normalization specified at instantiation.\n        samples_per_peak : float, optional\n            The approximate number of desired samples across the typical peak\n        nyquist_factor : float, optional\n            The multiple of the average nyquist frequency used to choose the\n            maximum frequency if maximum_frequency is not provided.\n        minimum_frequency : float or `~astropy.units.Quantity` ['frequency'], optional\n            If specified, then use this minimum frequency rather than one\n            chosen based on the size of the baseline. Should be `~astropy.units.Quantity`\n            if inputs to LombScargle are `~astropy.units.Quantity`.\n        maximum_frequency : float or `~astropy.units.Quantity` ['frequency'], optional\n            If specified, then use this maximum frequency rather than one\n            chosen based on the average nyquist frequency. Should be `~astropy.units.Quantity`\n            if inputs to LombScargle are `~astropy.units.Quantity`.\n\n        Returns\n        -------\n        frequency, power : ndarray\n            The frequency and Lomb-Scargle power\n        \"\"\"\n        frequency = self.autofrequency(samples_per_peak=samples_per_peak,\n                                       nyquist_factor=nyquist_factor,\n                                       minimum_frequency=minimum_frequency,\n                                       maximum_frequency=maximum_frequency)\n        power = self.power(frequency,\n                           normalization=normalization,\n                           method=method, method_kwds=method_kwds,\n                           assume_regular_frequency=True)\n        return frequency, power"},{"col":4,"comment":"null","endLoc":284,"header":"def _apply(self, method, *args, **kwargs)","id":8924,"name":"_apply","nodeType":"Function","startLoc":270,"text":"def _apply(self, method, *args, **kwargs):\n        # Required method for NDArrayShapeMethods, to help provide __getitem__\n        # and shape-changing methods.\n        if callable(method):\n            data = method(self.unmasked, *args, **kwargs)\n            mask = method(self.mask, *args, **kwargs)\n        else:\n            data = getattr(self.unmasked, method)(*args, **kwargs)\n            mask = getattr(self.mask, method)(*args, **kwargs)\n\n        result = self.from_unmasked(data, mask, copy=False)\n        if 'info' in self.__dict__:\n            result.info = self.info\n\n        return result"},{"col":4,"comment":"Compute the periodogram for a set of periods\n\n        Parameters\n        ----------\n        period : array-like or `~astropy.units.Quantity` ['time']\n            The periods where the power should be computed\n        duration : float, array-like, or `~astropy.units.Quantity` ['time']\n            The set of durations to test\n        objective : {'likelihood', 'snr'}, optional\n            The scalar that should be optimized to find the best fit phase,\n            duration, and depth. This can be either ``'likelihood'`` (default)\n            to optimize the log-likelihood of the model, or ``'snr'`` to\n            optimize the signal-to-noise with which the transit depth is\n            measured.\n        method : {'fast', 'slow'}, optional\n            The computational method used to compute the periodogram. This is\n            mainly included for the purposes of testing and most users will\n            want to use the optimized ``'fast'`` method (default) that is\n            implemented in Cython.  ``'slow'`` is a brute-force method that is\n            used to test the results of the ``'fast'`` method.\n        oversample : int, optional\n            The number of bins per duration that should be used. This sets the\n            time resolution of the phase fit with larger values of\n            ``oversample`` yielding a finer grid and higher computational cost.\n\n        Returns\n        -------\n        results : BoxLeastSquaresResults\n            The periodogram results as a :class:`BoxLeastSquaresResults`\n            object.\n\n        Raises\n        ------\n        ValueError\n            If ``oversample`` is not an integer greater than 0 or if\n            ``objective`` or ``method`` are not valid.\n\n        ","endLoc":330,"header":"def power(self, period, duration, objective=None, method=None,\n              oversample=10)","id":8925,"name":"power","nodeType":"Function","startLoc":234,"text":"def power(self, period, duration, objective=None, method=None,\n              oversample=10):\n        \"\"\"Compute the periodogram for a set of periods\n\n        Parameters\n        ----------\n        period : array-like or `~astropy.units.Quantity` ['time']\n            The periods where the power should be computed\n        duration : float, array-like, or `~astropy.units.Quantity` ['time']\n            The set of durations to test\n        objective : {'likelihood', 'snr'}, optional\n            The scalar that should be optimized to find the best fit phase,\n            duration, and depth. This can be either ``'likelihood'`` (default)\n            to optimize the log-likelihood of the model, or ``'snr'`` to\n            optimize the signal-to-noise with which the transit depth is\n            measured.\n        method : {'fast', 'slow'}, optional\n            The computational method used to compute the periodogram. This is\n            mainly included for the purposes of testing and most users will\n            want to use the optimized ``'fast'`` method (default) that is\n            implemented in Cython.  ``'slow'`` is a brute-force method that is\n            used to test the results of the ``'fast'`` method.\n        oversample : int, optional\n            The number of bins per duration that should be used. This sets the\n            time resolution of the phase fit with larger values of\n            ``oversample`` yielding a finer grid and higher computational cost.\n\n        Returns\n        -------\n        results : BoxLeastSquaresResults\n            The periodogram results as a :class:`BoxLeastSquaresResults`\n            object.\n\n        Raises\n        ------\n        ValueError\n            If ``oversample`` is not an integer greater than 0 or if\n            ``objective`` or ``method`` are not valid.\n\n        \"\"\"\n        period, duration = self._validate_period_and_duration(period, duration)\n\n        # Check for absurdities in the ``oversample`` choice\n        try:\n            oversample = int(oversample)\n        except TypeError:\n            raise ValueError(f\"oversample must be an int, got {oversample}\")\n        if oversample < 1:\n            raise ValueError(\"oversample must be greater than or equal to 1\")\n\n        # Select the periodogram objective\n        if objective is None:\n            objective = \"likelihood\"\n        allowed_objectives = [\"snr\", \"likelihood\"]\n        if objective not in allowed_objectives:\n            raise ValueError((\"Unrecognized method '{0}'\\n\"\n                              \"allowed methods are: {1}\")\n                             .format(objective, allowed_objectives))\n        use_likelihood = (objective == \"likelihood\")\n\n        # Select the computational method\n        if method is None:\n            method = \"fast\"\n        allowed_methods = [\"fast\", \"slow\"]\n        if method not in allowed_methods:\n            raise ValueError((\"Unrecognized method '{0}'\\n\"\n                              \"allowed methods are: {1}\")\n                             .format(method, allowed_methods))\n\n        # Format and check the input arrays\n        t = np.ascontiguousarray(strip_units(self._trel), dtype=np.float64)\n        t_ref = np.min(t)\n        y = np.ascontiguousarray(strip_units(self.y), dtype=np.float64)\n        if self.dy is None:\n            ivar = np.ones_like(y)\n        else:\n            ivar = 1.0 / np.ascontiguousarray(strip_units(self.dy),\n                                              dtype=np.float64)**2\n\n        # Make sure that the period and duration arrays are C-order\n        period_fmt = np.ascontiguousarray(strip_units(period),\n                                          dtype=np.float64)\n        duration = np.ascontiguousarray(strip_units(duration),\n                                        dtype=np.float64)\n\n        # Select the correct implementation for the chosen method\n        if method == \"fast\":\n            bls = methods.bls_fast\n        else:\n            bls = methods.bls_slow\n\n        # Run the implementation\n        results = bls(\n            t - t_ref, y - np.median(y), ivar, period_fmt, duration,\n            oversample, use_likelihood)\n\n        return self._format_results(t_ref, objective, period, results)"},{"col":4,"comment":"Compute the Lomb-Scargle power at the given frequencies.\n\n        Parameters\n        ----------\n        frequency : array-like or `~astropy.units.Quantity` ['frequency']\n            frequencies (not angular frequencies) at which to evaluate the\n            periodogram. Note that in order to use method='fast', frequencies\n            must be regularly-spaced.\n        method : str, optional\n            specify the lomb scargle implementation to use. Options are:\n\n            - 'auto': choose the best method based on the input\n            - 'fast': use the O[N log N] fast method. Note that this requires\n              evenly-spaced frequencies: by default this will be checked unless\n              ``assume_regular_frequency`` is set to True.\n            - 'slow': use the O[N^2] pure-python implementation\n            - 'cython': use the O[N^2] cython implementation. This is slightly\n              faster than method='slow', but much more memory efficient.\n            - 'chi2': use the O[N^2] chi2/linear-fitting implementation\n            - 'fastchi2': use the O[N log N] chi2 implementation. Note that this\n              requires evenly-spaced frequencies: by default this will be checked\n              unless ``assume_regular_frequency`` is set to True.\n            - 'scipy': use ``scipy.signal.lombscargle``, which is an O[N^2]\n              implementation written in C. Note that this does not support\n              heteroskedastic errors.\n\n        assume_regular_frequency : bool, optional\n            if True, assume that the input frequency is of the form\n            freq = f0 + df * np.arange(N). Only referenced if method is 'auto'\n            or 'fast'.\n        normalization : {'standard', 'model', 'log', 'psd'}, optional\n            If specified, override the normalization specified at instantiation.\n        fit_mean : bool, optional\n            If True, include a constant offset as part of the model at each\n            frequency. This can lead to more accurate results, especially in\n            the case of incomplete phase coverage.\n        center_data : bool, optional\n            If True, pre-center the data by subtracting the weighted mean of\n            the input data. This is especially important if fit_mean = False.\n        method_kwds : dict, optional\n            additional keywords to pass to the lomb-scargle method\n\n        Returns\n        -------\n        power : ndarray\n            The Lomb-Scargle power at the specified frequency\n        ","endLoc":367,"header":"def power(self, frequency, normalization=None, method='auto',\n              assume_regular_frequency=False, method_kwds=None)","id":8926,"name":"power","nodeType":"Function","startLoc":307,"text":"def power(self, frequency, normalization=None, method='auto',\n              assume_regular_frequency=False, method_kwds=None):\n        \"\"\"Compute the Lomb-Scargle power at the given frequencies.\n\n        Parameters\n        ----------\n        frequency : array-like or `~astropy.units.Quantity` ['frequency']\n            frequencies (not angular frequencies) at which to evaluate the\n            periodogram. Note that in order to use method='fast', frequencies\n            must be regularly-spaced.\n        method : str, optional\n            specify the lomb scargle implementation to use. Options are:\n\n            - 'auto': choose the best method based on the input\n            - 'fast': use the O[N log N] fast method. Note that this requires\n              evenly-spaced frequencies: by default this will be checked unless\n              ``assume_regular_frequency`` is set to True.\n            - 'slow': use the O[N^2] pure-python implementation\n            - 'cython': use the O[N^2] cython implementation. This is slightly\n              faster than method='slow', but much more memory efficient.\n            - 'chi2': use the O[N^2] chi2/linear-fitting implementation\n            - 'fastchi2': use the O[N log N] chi2 implementation. Note that this\n              requires evenly-spaced frequencies: by default this will be checked\n              unless ``assume_regular_frequency`` is set to True.\n            - 'scipy': use ``scipy.signal.lombscargle``, which is an O[N^2]\n              implementation written in C. Note that this does not support\n              heteroskedastic errors.\n\n        assume_regular_frequency : bool, optional\n            if True, assume that the input frequency is of the form\n            freq = f0 + df * np.arange(N). Only referenced if method is 'auto'\n            or 'fast'.\n        normalization : {'standard', 'model', 'log', 'psd'}, optional\n            If specified, override the normalization specified at instantiation.\n        fit_mean : bool, optional\n            If True, include a constant offset as part of the model at each\n            frequency. This can lead to more accurate results, especially in\n            the case of incomplete phase coverage.\n        center_data : bool, optional\n            If True, pre-center the data by subtracting the weighted mean of\n            the input data. This is especially important if fit_mean = False.\n        method_kwds : dict, optional\n            additional keywords to pass to the lomb-scargle method\n\n        Returns\n        -------\n        power : ndarray\n            The Lomb-Scargle power at the specified frequency\n        \"\"\"\n        if normalization is None:\n            normalization = self.normalization\n        frequency = self._validate_frequency(frequency)\n        power = lombscargle(*strip_units(self._trel, self.y, self.dy),\n                            frequency=strip_units(frequency),\n                            center_data=self.center_data,\n                            fit_mean=self.fit_mean,\n                            nterms=self.nterms,\n                            normalization=normalization,\n                            method=method, method_kwds=method_kwds,\n                            assume_regular_frequency=assume_regular_frequency)\n        return power * self._power_unit(normalization)"},{"col":4,"comment":"null","endLoc":290,"header":"def __setitem__(self, item, value)","id":8927,"name":"__setitem__","nodeType":"Function","startLoc":286,"text":"def __setitem__(self, item, value):\n        value, mask = self._get_data_and_mask(value, allow_ma_masked=True)\n        if value is not None:\n            self.unmasked[item] = value\n        self.mask[item] = mask"},{"col":4,"comment":"Private method used to check a set of periods and durations\n\n        Parameters\n        ----------\n        period : float, array-like, or `~astropy.units.Quantity` ['time']\n            The set of test periods.\n        duration : float, array-like, or `~astropy.units.Quantity` ['time']\n            The set of durations that will be considered.\n\n        Returns\n        -------\n        period, duration : array-like or `~astropy.units.Quantity` ['time']\n            The inputs reformatted with the correct shapes and units.\n\n        Raises\n        ------\n        ValueError\n            If the units of period or duration cannot be converted to the\n            units of t.\n\n        ","endLoc":700,"header":"def _validate_period_and_duration(self, period, duration)","id":8928,"name":"_validate_period_and_duration","nodeType":"Function","startLoc":668,"text":"def _validate_period_and_duration(self, period, duration):\n        \"\"\"Private method used to check a set of periods and durations\n\n        Parameters\n        ----------\n        period : float, array-like, or `~astropy.units.Quantity` ['time']\n            The set of test periods.\n        duration : float, array-like, or `~astropy.units.Quantity` ['time']\n            The set of durations that will be considered.\n\n        Returns\n        -------\n        period, duration : array-like or `~astropy.units.Quantity` ['time']\n            The inputs reformatted with the correct shapes and units.\n\n        Raises\n        ------\n        ValueError\n            If the units of period or duration cannot be converted to the\n            units of t.\n\n        \"\"\"\n        duration = self._validate_duration(duration)\n        period = np.atleast_1d(np.abs(period))\n        if period.ndim != 1 or period.size == 0:\n            raise ValueError(\"period must be 1-dimensional\")\n        period = validate_unit_consistency(self._trel, period)\n\n        if not np.min(period) > np.max(duration):\n            raise ValueError(\"The maximum transit duration must be shorter \"\n                             \"than the minimum period\")\n\n        return period, duration"},{"attributeType":"null","col":4,"comment":"Explicitly defined masked classes keyed by their unmasked counterparts.\n\n    For subclasses of these unmasked classes, masked counterparts can be generated.\n    ","endLoc":60,"id":8929,"name":"_base_classes","nodeType":"Attribute","startLoc":60,"text":"_base_classes"},{"attributeType":"null","col":4,"comment":"Masked classes keyed by their unmasked data counterparts.","endLoc":66,"id":8930,"name":"_masked_classes","nodeType":"Attribute","startLoc":66,"text":"_masked_classes"},{"attributeType":"null","col":4,"comment":"null","endLoc":236,"id":8931,"name":"mask","nodeType":"Attribute","startLoc":236,"text":"mask"},{"attributeType":"null","col":12,"comment":"null","endLoc":227,"id":8932,"name":"_mask","nodeType":"Attribute","startLoc":227,"text":"self._mask"},{"attributeType":"null","col":12,"comment":"null","endLoc":102,"id":8933,"name":"_data_cls","nodeType":"Attribute","startLoc":102,"text":"cls._data_cls"},{"col":0,"comment":"\n    Compute the Lomb-scargle Periodogram with a given method.\n\n    Parameters\n    ----------\n    t : array-like\n        sequence of observation times\n    y : array-like\n        sequence of observations associated with times t\n    dy : float or array-like, optional\n        error or sequence of observational errors associated with times t\n    frequency : array-like\n        frequencies (not angular frequencies) at which to evaluate the\n        periodogram. If not specified, optimal frequencies will be chosen using\n        a heuristic which will attempt to provide sufficient frequency range\n        and sampling so that peaks will not be missed. Note that in order to\n        use method='fast', frequencies must be regularly spaced.\n    method : str, optional\n        specify the lomb scargle implementation to use. Options are:\n\n        - 'auto': choose the best method based on the input\n        - 'fast': use the O[N log N] fast method. Note that this requires\n          evenly-spaced frequencies: by default this will be checked unless\n          ``assume_regular_frequency`` is set to True.\n        - `slow`: use the O[N^2] pure-python implementation\n        - `chi2`: use the O[N^2] chi2/linear-fitting implementation\n        - `fastchi2`: use the O[N log N] chi2 implementation. Note that this\n          requires evenly-spaced frequencies: by default this will be checked\n          unless `assume_regular_frequency` is set to True.\n        - `scipy`: use ``scipy.signal.lombscargle``, which is an O[N^2]\n          implementation written in C. Note that this does not support\n          heteroskedastic errors.\n\n    assume_regular_frequency : bool, optional\n        if True, assume that the input frequency is of the form\n        freq = f0 + df * np.arange(N). Only referenced if method is 'auto'\n        or 'fast'.\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard' or 'psd'.\n    fit_mean : bool, optional\n        if True, include a constant offset as part of the model at each\n        frequency. This can lead to more accurate results, especially in the\n        case of incomplete phase coverage.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data. This is especially important if `fit_mean = False`\n    method_kwds : dict, optional\n        additional keywords to pass to the lomb-scargle method\n    nterms : int, optional\n        number of Fourier terms to use in the periodogram.\n        Not supported with every method.\n\n    Returns\n    -------\n    PLS : array-like\n        Lomb-Scargle power associated with each frequency omega\n    ","endLoc":217,"header":"def lombscargle(t, y, dy=None,\n                frequency=None,\n                method='auto',\n                assume_regular_frequency=False,\n                normalization='standard',\n                fit_mean=True, center_data=True,\n                method_kwds=None, nterms=1)","id":8934,"name":"lombscargle","nodeType":"Function","startLoc":111,"text":"def lombscargle(t, y, dy=None,\n                frequency=None,\n                method='auto',\n                assume_regular_frequency=False,\n                normalization='standard',\n                fit_mean=True, center_data=True,\n                method_kwds=None, nterms=1):\n    \"\"\"\n    Compute the Lomb-scargle Periodogram with a given method.\n\n    Parameters\n    ----------\n    t : array-like\n        sequence of observation times\n    y : array-like\n        sequence of observations associated with times t\n    dy : float or array-like, optional\n        error or sequence of observational errors associated with times t\n    frequency : array-like\n        frequencies (not angular frequencies) at which to evaluate the\n        periodogram. If not specified, optimal frequencies will be chosen using\n        a heuristic which will attempt to provide sufficient frequency range\n        and sampling so that peaks will not be missed. Note that in order to\n        use method='fast', frequencies must be regularly spaced.\n    method : str, optional\n        specify the lomb scargle implementation to use. Options are:\n\n        - 'auto': choose the best method based on the input\n        - 'fast': use the O[N log N] fast method. Note that this requires\n          evenly-spaced frequencies: by default this will be checked unless\n          ``assume_regular_frequency`` is set to True.\n        - `slow`: use the O[N^2] pure-python implementation\n        - `chi2`: use the O[N^2] chi2/linear-fitting implementation\n        - `fastchi2`: use the O[N log N] chi2 implementation. Note that this\n          requires evenly-spaced frequencies: by default this will be checked\n          unless `assume_regular_frequency` is set to True.\n        - `scipy`: use ``scipy.signal.lombscargle``, which is an O[N^2]\n          implementation written in C. Note that this does not support\n          heteroskedastic errors.\n\n    assume_regular_frequency : bool, optional\n        if True, assume that the input frequency is of the form\n        freq = f0 + df * np.arange(N). Only referenced if method is 'auto'\n        or 'fast'.\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard' or 'psd'.\n    fit_mean : bool, optional\n        if True, include a constant offset as part of the model at each\n        frequency. This can lead to more accurate results, especially in the\n        case of incomplete phase coverage.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data. This is especially important if `fit_mean = False`\n    method_kwds : dict, optional\n        additional keywords to pass to the lomb-scargle method\n    nterms : int, optional\n        number of Fourier terms to use in the periodogram.\n        Not supported with every method.\n\n    Returns\n    -------\n    PLS : array-like\n        Lomb-Scargle power associated with each frequency omega\n    \"\"\"\n    # frequencies should be one-dimensional arrays\n    output_shape = frequency.shape\n    frequency = frequency.ravel()\n\n    # we'll need to adjust args and kwds for each method\n    args = (t, y, dy)\n    kwds = dict(frequency=frequency,\n                center_data=center_data,\n                fit_mean=fit_mean,\n                normalization=normalization,\n                nterms=nterms,\n                **(method_kwds or {}))\n\n    method = validate_method(method, dy=dy, fit_mean=fit_mean, nterms=nterms,\n                             frequency=frequency,\n                             assume_regular_frequency=assume_regular_frequency)\n\n    # scipy doesn't support dy or fit_mean=True\n    if method == 'scipy':\n        if kwds.pop('fit_mean'):\n            raise ValueError(\"scipy method does not support fit_mean=True\")\n        if dy is not None:\n            dy = np.ravel(np.asarray(dy))\n            if not np.allclose(dy[0], dy):\n                raise ValueError(\"scipy method only supports \"\n                                 \"uniform uncertainties dy\")\n        args = (t, y)\n\n    # fast methods require frequency expressed as a grid\n    if method.startswith('fast'):\n        f0, df, Nf = _get_frequency_grid(kwds.pop('frequency'),\n                                         assume_regular_frequency)\n        kwds.update(f0=f0, df=df, Nf=Nf)\n\n    # only chi2 methods support nterms\n    if not method.endswith('chi2'):\n        if kwds.pop('nterms') != 1:\n            raise ValueError(\"nterms != 1 only supported with 'chi2' \"\n                             \"or 'fastchi2' methods\")\n\n    PLS = METHODS[method](*args, **kwds)\n    return PLS.reshape(output_shape)"},{"attributeType":"null","col":16,"comment":"null","endLoc":105,"id":8935,"name":"__doc__","nodeType":"Attribute","startLoc":105,"text":"cls.__doc__"},{"col":4,"comment":"A private method used to wrap and add units to the periodogram\n\n        Parameters\n        ----------\n        t_ref : float\n            The minimum time in the time series (a reference time).\n        objective : str\n            The name of the objective used in the optimization.\n        period : array-like or `~astropy.units.Quantity` ['time']\n            The set of trial periods.\n        results : tuple\n            The output of one of the periodogram implementations.\n\n        ","endLoc":745,"header":"def _format_results(self, t_ref, objective, period, results)","id":8936,"name":"_format_results","nodeType":"Function","startLoc":702,"text":"def _format_results(self, t_ref, objective, period, results):\n        \"\"\"A private method used to wrap and add units to the periodogram\n\n        Parameters\n        ----------\n        t_ref : float\n            The minimum time in the time series (a reference time).\n        objective : str\n            The name of the objective used in the optimization.\n        period : array-like or `~astropy.units.Quantity` ['time']\n            The set of trial periods.\n        results : tuple\n            The output of one of the periodogram implementations.\n\n        \"\"\"\n        (power, depth, depth_err, duration, transit_time, depth_snr,\n         log_likelihood) = results\n        transit_time += t_ref\n\n        if has_units(self._trel):\n            transit_time = units.Quantity(transit_time, unit=self._trel.unit)\n            transit_time = self._as_absolute_time_if_needed('transit_time', transit_time)\n            duration = units.Quantity(duration, unit=self._trel.unit)\n\n        if has_units(self.y):\n            depth = units.Quantity(depth, unit=self.y.unit)\n            depth_err = units.Quantity(depth_err, unit=self.y.unit)\n\n            depth_snr = units.Quantity(depth_snr, unit=units.one)\n\n            if self.dy is None:\n                if objective == \"likelihood\":\n                    power = units.Quantity(power, unit=self.y.unit**2)\n                else:\n                    power = units.Quantity(power, unit=units.one)\n                log_likelihood = units.Quantity(log_likelihood,\n                                                unit=self.y.unit**2)\n            else:\n                power = units.Quantity(power, unit=units.one)\n                log_likelihood = units.Quantity(log_likelihood, unit=units.one)\n\n        return BoxLeastSquaresResults(\n            objective, period, power, depth, depth_err, duration, transit_time,\n            depth_snr, log_likelihood)"},{"className":"QTable","col":0,"comment":"A class to represent tables of heterogeneous data.\n\n    `~astropy.table.QTable` provides a class for heterogeneous tabular data\n    which can be easily modified, for instance adding columns or new rows.\n\n    The `~astropy.table.QTable` class is identical to `~astropy.table.Table`\n    except that columns with an associated ``unit`` attribute are converted to\n    `~astropy.units.Quantity` objects.\n\n    See also:\n\n    - https://docs.astropy.org/en/stable/table/\n    - https://docs.astropy.org/en/stable/table/mixin_columns.html\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, table-like object, optional\n        Data to initialize table.\n    masked : bool, optional\n        Specify whether the table is masked.\n    names : list, optional\n        Specify column names.\n    dtype : list, optional\n        Specify column data types.\n    meta : dict, optional\n        Metadata associated with the table.\n    copy : bool, optional\n        Copy the input data. Default is True.\n    rows : numpy ndarray, list of list, optional\n        Row-oriented data for table instead of ``data`` argument.\n    copy_indices : bool, optional\n        Copy any indices in the input data. Default is True.\n    **kwargs : dict, optional\n        Additional keyword args when converting table-like object.\n\n    ","endLoc":3972,"id":8937,"nodeType":"Class","startLoc":3908,"text":"class QTable(Table):\n    \"\"\"A class to represent tables of heterogeneous data.\n\n    `~astropy.table.QTable` provides a class for heterogeneous tabular data\n    which can be easily modified, for instance adding columns or new rows.\n\n    The `~astropy.table.QTable` class is identical to `~astropy.table.Table`\n    except that columns with an associated ``unit`` attribute are converted to\n    `~astropy.units.Quantity` objects.\n\n    See also:\n\n    - https://docs.astropy.org/en/stable/table/\n    - https://docs.astropy.org/en/stable/table/mixin_columns.html\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, table-like object, optional\n        Data to initialize table.\n    masked : bool, optional\n        Specify whether the table is masked.\n    names : list, optional\n        Specify column names.\n    dtype : list, optional\n        Specify column data types.\n    meta : dict, optional\n        Metadata associated with the table.\n    copy : bool, optional\n        Copy the input data. Default is True.\n    rows : numpy ndarray, list of list, optional\n        Row-oriented data for table instead of ``data`` argument.\n    copy_indices : bool, optional\n        Copy any indices in the input data. Default is True.\n    **kwargs : dict, optional\n        Additional keyword args when converting table-like object.\n\n    \"\"\"\n\n    def _is_mixin_for_table(self, col):\n        \"\"\"\n        Determine if ``col`` should be added to the table directly as\n        a mixin column.\n        \"\"\"\n        return has_info_class(col, MixinInfo)\n\n    def _convert_col_for_table(self, col):\n        if isinstance(col, Column) and getattr(col, 'unit', None) is not None:\n            # We need to turn the column into a quantity; use subok=True to allow\n            # Quantity subclasses identified in the unit (such as u.mag()).\n            q_cls = Masked(Quantity) if isinstance(col, MaskedColumn) else Quantity\n            try:\n                qcol = q_cls(col.data, col.unit, copy=False, subok=True)\n            except Exception as exc:\n                warnings.warn(f\"column {col.info.name} has a unit but is kept as \"\n                              f\"a {col.__class__.__name__} as an attempt to \"\n                              f\"convert it to Quantity failed with:\\n{exc!r}\",\n                              AstropyUserWarning)\n            else:\n                qcol.info = col.info\n                qcol.info.indices = col.info.indices\n                col = qcol\n        else:\n            col = super()._convert_col_for_table(col)\n\n        return col"},{"col":4,"comment":"\n        Determine if ``col`` should be added to the table directly as\n        a mixin column.\n        ","endLoc":3951,"header":"def _is_mixin_for_table(self, col)","id":8938,"name":"_is_mixin_for_table","nodeType":"Function","startLoc":3946,"text":"def _is_mixin_for_table(self, col):\n        \"\"\"\n        Determine if ``col`` should be added to the table directly as\n        a mixin column.\n        \"\"\"\n        return has_info_class(col, MixinInfo)"},{"col":4,"comment":"null","endLoc":3972,"header":"def _convert_col_for_table(self, col)","id":8939,"name":"_convert_col_for_table","nodeType":"Function","startLoc":3953,"text":"def _convert_col_for_table(self, col):\n        if isinstance(col, Column) and getattr(col, 'unit', None) is not None:\n            # We need to turn the column into a quantity; use subok=True to allow\n            # Quantity subclasses identified in the unit (such as u.mag()).\n            q_cls = Masked(Quantity) if isinstance(col, MaskedColumn) else Quantity\n            try:\n                qcol = q_cls(col.data, col.unit, copy=False, subok=True)\n            except Exception as exc:\n                warnings.warn(f\"column {col.info.name} has a unit but is kept as \"\n                              f\"a {col.__class__.__name__} as an attempt to \"\n                              f\"convert it to Quantity failed with:\\n{exc!r}\",\n                              AstropyUserWarning)\n            else:\n                qcol.info = col.info\n                qcol.info.indices = col.info.indices\n                col = qcol\n        else:\n            col = super()._convert_col_for_table(col)\n\n        return col"},{"col":0,"comment":"Return the optimal histogram bin width using Scott's rule\n\n    Scott's rule is a normal reference rule: it minimizes the integrated\n    mean squared error in the bin approximation under the assumption that the\n    data is approximately Gaussian.\n\n    Parameters\n    ----------\n    data : array-like, ndim=1\n        observed (one-dimensional) data\n    return_bins : bool, optional\n        if True, then return the bin edges\n\n    Returns\n    -------\n    width : float\n        optimal bin width using Scott's rule\n    bins : ndarray\n        bin edges: returned if ``return_bins`` is True\n\n    Notes\n    -----\n    The optimal bin width is\n\n    .. math::\n        \\Delta_b = \\frac{3.5\\sigma}{n^{1/3}}\n\n    where :math:`\\sigma` is the standard deviation of the data, and\n    :math:`n` is the number of data points [1]_.\n\n    References\n    ----------\n    .. [1] Scott, David W. (1979). \"On optimal and data-based histograms\".\n       Biometricka 66 (3): 605-610\n\n    See Also\n    --------\n    knuth_bin_width\n    freedman_bin_width\n    bayesian_blocks\n    histogram\n    ","endLoc":198,"header":"def scott_bin_width(data, return_bins=False)","id":8940,"name":"scott_bin_width","nodeType":"Function","startLoc":140,"text":"def scott_bin_width(data, return_bins=False):\n    r\"\"\"Return the optimal histogram bin width using Scott's rule\n\n    Scott's rule is a normal reference rule: it minimizes the integrated\n    mean squared error in the bin approximation under the assumption that the\n    data is approximately Gaussian.\n\n    Parameters\n    ----------\n    data : array-like, ndim=1\n        observed (one-dimensional) data\n    return_bins : bool, optional\n        if True, then return the bin edges\n\n    Returns\n    -------\n    width : float\n        optimal bin width using Scott's rule\n    bins : ndarray\n        bin edges: returned if ``return_bins`` is True\n\n    Notes\n    -----\n    The optimal bin width is\n\n    .. math::\n        \\Delta_b = \\frac{3.5\\sigma}{n^{1/3}}\n\n    where :math:`\\sigma` is the standard deviation of the data, and\n    :math:`n` is the number of data points [1]_.\n\n    References\n    ----------\n    .. [1] Scott, David W. (1979). \"On optimal and data-based histograms\".\n       Biometricka 66 (3): 605-610\n\n    See Also\n    --------\n    knuth_bin_width\n    freedman_bin_width\n    bayesian_blocks\n    histogram\n    \"\"\"\n    data = np.asarray(data)\n    if data.ndim != 1:\n        raise ValueError(\"data should be one-dimensional\")\n\n    n = data.size\n    sigma = np.std(data)\n\n    dx = 3.5 * sigma / (n ** (1 / 3))\n\n    if return_bins:\n        Nbins = np.ceil((data.max() - data.min()) / dx)\n        Nbins = max(1, Nbins)\n        bins = data.min() + dx * np.arange(Nbins + 1)\n        return dx, bins\n    else:\n        return dx"},{"col":0,"comment":"\n    Validate the method argument, and if method='auto'\n    choose the appropriate method\n    ","endLoc":108,"header":"def validate_method(method, dy, fit_mean, nterms,\n                    frequency, assume_regular_frequency)","id":8941,"name":"validate_method","nodeType":"Function","startLoc":79,"text":"def validate_method(method, dy, fit_mean, nterms,\n                    frequency, assume_regular_frequency):\n    \"\"\"\n    Validate the method argument, and if method='auto'\n    choose the appropriate method\n    \"\"\"\n    methods = available_methods()\n    prefer_fast = (len(frequency) > 200\n                   and (assume_regular_frequency or _is_regular(frequency)))\n    prefer_scipy = 'scipy' in methods and dy is None and not fit_mean\n\n    # automatically choose the appropriate method\n    if method == 'auto':\n\n        if nterms != 1:\n            if prefer_fast:\n                method = 'fastchi2'\n            else:\n                method = 'chi2'\n        elif prefer_fast:\n            method = 'fast'\n        elif prefer_scipy:\n            method = 'scipy'\n        else:\n            method = 'cython'\n\n    if method not in METHODS:\n        raise ValueError(f\"invalid method: {method}\")\n\n    return method"},{"col":0,"comment":"null","endLoc":38,"header":"def available_methods()","id":8942,"name":"available_methods","nodeType":"Function","startLoc":28,"text":"def available_methods():\n    methods = ['auto', 'slow', 'chi2', 'cython', 'fast', 'fastchi2']\n\n    # Scipy required for scipy algorithm (obviously)\n    try:\n        import scipy\n    except ImportError:\n        pass\n    else:\n        methods.append('scipy')\n    return methods"},{"col":0,"comment":"null","endLoc":50,"header":"def _is_regular(frequency)","id":8943,"name":"_is_regular","nodeType":"Function","startLoc":41,"text":"def _is_regular(frequency):\n    frequency = np.asarray(frequency)\n\n    if frequency.ndim != 1:\n        return False\n    elif len(frequency) == 1:\n        return True\n    else:\n        diff = np.diff(frequency)\n        return np.allclose(diff[0], diff)"},{"col":4,"comment":"\n        Convert the provided times to absolute times using the current _tstart\n        value, if needed.\n        ","endLoc":373,"header":"def _as_absolute_time_if_needed(self, name, times)","id":8944,"name":"_as_absolute_time_if_needed","nodeType":"Function","startLoc":359,"text":"def _as_absolute_time_if_needed(self, name, times):\n        \"\"\"\n        Convert the provided times to absolute times using the current _tstart\n        value, if needed.\n        \"\"\"\n        if self._tstart is not None:\n            # Some time formats/scales can't represent dates/times too far\n            # off from the present, so we need to mask values offset by\n            # more than 100,000 yr (the periodogram algorithm can return\n            # transit times of e.g 1e300 for some periods).\n            reset = np.abs(times.to_value(u.year)) > 100000\n            times[reset] = 0\n            times = self._tstart + times\n            times[reset] = np.nan\n        return times"},{"col":0,"comment":"Enhanced histogram function, providing adaptive binnings\n\n    This is a histogram function that enables the use of more sophisticated\n    algorithms for determining bins.  Aside from the ``bins`` argument allowing\n    a string specified how bins are computed, the parameters are the same\n    as ``numpy.histogram()``.\n\n    Parameters\n    ----------\n    a : array-like\n        array of data to be histogrammed\n\n    bins : int, list, or str, optional\n        If bins is a string, then it must be one of:\n\n        - 'blocks' : use bayesian blocks for dynamic bin widths\n\n        - 'knuth' : use Knuth's rule to determine bins\n\n        - 'scott' : use Scott's rule to determine bins\n\n        - 'freedman' : use the Freedman-Diaconis rule to determine bins\n\n    range : tuple or None, optional\n        the minimum and maximum range for the histogram.  If not specified,\n        it will be (x.min(), x.max())\n\n    weights : array-like, optional\n        An array the same shape as ``a``. If given, the histogram accumulates\n        the value of the weight corresponding to ``a`` instead of returning the\n        count of values. This argument does not affect determination of bin\n        edges.\n\n    other keyword arguments are described in numpy.histogram().\n\n    Returns\n    -------\n    hist : array\n        The values of the histogram. See ``density`` and ``weights`` for a\n        description of the possible semantics.\n    bin_edges : array of dtype float\n        Return the bin edges ``(length(hist)+1)``.\n\n    See Also\n    --------\n    numpy.histogram\n    ","endLoc":137,"header":"def histogram(a, bins=10, range=None, weights=None, **kwargs)","id":8945,"name":"histogram","nodeType":"Function","startLoc":86,"text":"def histogram(a, bins=10, range=None, weights=None, **kwargs):\n    \"\"\"Enhanced histogram function, providing adaptive binnings\n\n    This is a histogram function that enables the use of more sophisticated\n    algorithms for determining bins.  Aside from the ``bins`` argument allowing\n    a string specified how bins are computed, the parameters are the same\n    as ``numpy.histogram()``.\n\n    Parameters\n    ----------\n    a : array-like\n        array of data to be histogrammed\n\n    bins : int, list, or str, optional\n        If bins is a string, then it must be one of:\n\n        - 'blocks' : use bayesian blocks for dynamic bin widths\n\n        - 'knuth' : use Knuth's rule to determine bins\n\n        - 'scott' : use Scott's rule to determine bins\n\n        - 'freedman' : use the Freedman-Diaconis rule to determine bins\n\n    range : tuple or None, optional\n        the minimum and maximum range for the histogram.  If not specified,\n        it will be (x.min(), x.max())\n\n    weights : array-like, optional\n        An array the same shape as ``a``. If given, the histogram accumulates\n        the value of the weight corresponding to ``a`` instead of returning the\n        count of values. This argument does not affect determination of bin\n        edges.\n\n    other keyword arguments are described in numpy.histogram().\n\n    Returns\n    -------\n    hist : array\n        The values of the histogram. See ``density`` and ``weights`` for a\n        description of the possible semantics.\n    bin_edges : array of dtype float\n        Return the bin edges ``(length(hist)+1)``.\n\n    See Also\n    --------\n    numpy.histogram\n    \"\"\"\n\n    bins = calculate_bin_edges(a, bins=bins, range=range, weights=weights)\n    # Now we call numpy's histogram with the resulting bin edges\n    return np.histogram(a, bins=bins, range=range, weights=weights, **kwargs)"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":8946,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"col":0,"comment":"","endLoc":7,"header":"histogram.py#<anonymous>","id":8947,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nMethods for selecting the bin width of histograms\n\nPorted from the astroML project: https://www.astroml.org/\n\"\"\"\n\n__all__ = ['histogram', 'scott_bin_width', 'freedman_bin_width',\n           'knuth_bin_width', 'calculate_bin_edges']"},{"fileName":"bst.py","filePath":"astropy/table","id":8948,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport operator\n\n__all__ = ['BST']\n\n\nclass MaxValue:\n    '''\n    Represents an infinite value for purposes\n    of tuple comparison.\n    '''\n\n    def __gt__(self, other):\n        return True\n\n    def __ge__(self, other):\n        return True\n\n    def __lt__(self, other):\n        return False\n\n    def __le__(self, other):\n        return False\n\n    def __repr__(self):\n        return \"MAX\"\n\n    __str__ = __repr__\n\n\nclass MinValue:\n    '''\n    The opposite of MaxValue, i.e. a representation of\n    negative infinity.\n    '''\n\n    def __lt__(self, other):\n        return True\n\n    def __le__(self, other):\n        return True\n\n    def __gt__(self, other):\n        return False\n\n    def __ge__(self, other):\n        return False\n\n    def __repr__(self):\n        return \"MIN\"\n\n    __str__ = __repr__\n\n\nclass Epsilon:\n    '''\n    Represents the \"next largest\" version of a given value,\n    so that for all valid comparisons we have\n    x < y < Epsilon(y) < z whenever x < y < z and x, z are\n    not Epsilon objects.\n\n    Parameters\n    ----------\n    val : object\n        Original value\n    '''\n    __slots__ = ('val',)\n\n    def __init__(self, val):\n        self.val = val\n\n    def __lt__(self, other):\n        if self.val == other:\n            return False\n        return self.val < other\n\n    def __gt__(self, other):\n        if self.val == other:\n            return True\n        return self.val > other\n\n    def __eq__(self, other):\n        return False\n\n    def __repr__(self):\n        return repr(self.val) + \" + epsilon\"\n\n\nclass Node:\n    '''\n    An element in a binary search tree, containing\n    a key, data, and references to children nodes and\n    a parent node.\n\n    Parameters\n    ----------\n    key : tuple\n        Node key\n    data : list or int\n        Node data\n    '''\n    __lt__ = lambda x, y: x.key < y.key\n    __le__ = lambda x, y: x.key <= y.key\n    __eq__ = lambda x, y: x.key == y.key\n    __ge__ = lambda x, y: x.key >= y.key\n    __gt__ = lambda x, y: x.key > y.key\n    __ne__ = lambda x, y: x.key != y.key\n    __slots__ = ('key', 'data', 'left', 'right')\n\n    # each node has a key and data list\n    def __init__(self, key, data):\n        self.key = key\n        self.data = data if isinstance(data, list) else [data]\n        self.left = None\n        self.right = None\n\n    def replace(self, child, new_child):\n        '''\n        Replace this node's child with a new child.\n        '''\n        if self.left is not None and self.left == child:\n            self.left = new_child\n        elif self.right is not None and self.right == child:\n            self.right = new_child\n        else:\n            raise ValueError(\"Cannot call replace() on non-child\")\n\n    def remove(self, child):\n        '''\n        Remove the given child.\n        '''\n        self.replace(child, None)\n\n    def set(self, other):\n        '''\n        Copy the given node.\n        '''\n        self.key = other.key\n        self.data = other.data[:]\n\n    def __str__(self):\n        return str((self.key, self.data))\n\n    def __repr__(self):\n        return str(self)\n\n\nclass BST:\n    '''\n    A basic binary search tree in pure Python, used\n    as an engine for indexing.\n\n    Parameters\n    ----------\n    data : Table\n        Sorted columns of the original table\n    row_index : Column object\n        Row numbers corresponding to data columns\n    unique : bool\n        Whether the values of the index must be unique.\n        Defaults to False.\n    '''\n    NodeClass = Node\n\n    def __init__(self, data, row_index, unique=False):\n        self.root = None\n        self.size = 0\n        self.unique = unique\n        for key, row in zip(data, row_index):\n            self.add(tuple(key), row)\n\n    def add(self, key, data=None):\n        '''\n        Add a key, data pair.\n        '''\n        if data is None:\n            data = key\n\n        self.size += 1\n        node = self.NodeClass(key, data)\n        curr_node = self.root\n        if curr_node is None:\n            self.root = node\n            return\n        while True:\n            if node < curr_node:\n                if curr_node.left is None:\n                    curr_node.left = node\n                    break\n                curr_node = curr_node.left\n            elif node > curr_node:\n                if curr_node.right is None:\n                    curr_node.right = node\n                    break\n                curr_node = curr_node.right\n            elif self.unique:\n                raise ValueError(\"Cannot insert non-unique value\")\n            else:  # add data to node\n                curr_node.data.extend(node.data)\n                curr_node.data = sorted(curr_node.data)\n                return\n\n    def find(self, key):\n        '''\n        Return all data values corresponding to a given key.\n\n        Parameters\n        ----------\n        key : tuple\n            Input key\n\n        Returns\n        -------\n        data_vals : list\n            List of rows corresponding to the input key\n        '''\n        node, parent = self.find_node(key)\n        return node.data if node is not None else []\n\n    def find_node(self, key):\n        '''\n        Find the node associated with the given key.\n        '''\n        if self.root is None:\n            return (None, None)\n        return self._find_recursive(key, self.root, None)\n\n    def shift_left(self, row):\n        '''\n        Decrement all rows larger than the given row.\n        '''\n        for node in self.traverse():\n            node.data = [x - 1 if x > row else x for x in node.data]\n\n    def shift_right(self, row):\n        '''\n        Increment all rows greater than or equal to the given row.\n        '''\n        for node in self.traverse():\n            node.data = [x + 1 if x >= row else x for x in node.data]\n\n    def _find_recursive(self, key, node, parent):\n        try:\n            if key == node.key:\n                return (node, parent)\n            elif key > node.key:\n                if node.right is None:\n                    return (None, None)\n                return self._find_recursive(key, node.right, node)\n            else:\n                if node.left is None:\n                    return (None, None)\n                return self._find_recursive(key, node.left, node)\n        except TypeError:  # wrong key type\n            return (None, None)\n\n    def traverse(self, order='inorder'):\n        '''\n        Return nodes of the BST in the given order.\n\n        Parameters\n        ----------\n        order : str\n            The order in which to recursively search the BST.\n            Possible values are:\n            \"preorder\": current node, left subtree, right subtree\n            \"inorder\": left subtree, current node, right subtree\n            \"postorder\": left subtree, right subtree, current node\n        '''\n        if order == 'preorder':\n            return self._preorder(self.root, [])\n        elif order == 'inorder':\n            return self._inorder(self.root, [])\n        elif order == 'postorder':\n            return self._postorder(self.root, [])\n        raise ValueError(f\"Invalid traversal method: \\\"{order}\\\"\")\n\n    def items(self):\n        '''\n        Return BST items in order as (key, data) pairs.\n        '''\n        return [(x.key, x.data) for x in self.traverse()]\n\n    def sort(self):\n        '''\n        Make row order align with key order.\n        '''\n        i = 0\n        for node in self.traverse():\n            num_rows = len(node.data)\n            node.data = [x for x in range(i, i + num_rows)]\n            i += num_rows\n\n    def sorted_data(self):\n        '''\n        Return BST rows sorted by key values.\n        '''\n        return [x for node in self.traverse() for x in node.data]\n\n    def _preorder(self, node, lst):\n        if node is None:\n            return lst\n        lst.append(node)\n        self._preorder(node.left, lst)\n        self._preorder(node.right, lst)\n        return lst\n\n    def _inorder(self, node, lst):\n        if node is None:\n            return lst\n        self._inorder(node.left, lst)\n        lst.append(node)\n        self._inorder(node.right, lst)\n        return lst\n\n    def _postorder(self, node, lst):\n        if node is None:\n            return lst\n        self._postorder(node.left, lst)\n        self._postorder(node.right, lst)\n        lst.append(node)\n        return lst\n\n    def _substitute(self, node, parent, new_node):\n        if node is self.root:\n            self.root = new_node\n        else:\n            parent.replace(node, new_node)\n\n    def remove(self, key, data=None):\n        '''\n        Remove data corresponding to the given key.\n\n        Parameters\n        ----------\n        key : tuple\n            The key to remove\n        data : int or None\n            If None, remove the node corresponding to the given key.\n            If not None, remove only the given data value from the node.\n\n        Returns\n        -------\n        successful : bool\n            True if removal was successful, false otherwise\n        '''\n        node, parent = self.find_node(key)\n        if node is None:\n            return False\n        if data is not None:\n            if data not in node.data:\n                raise ValueError(\"Data does not belong to correct node\")\n            elif len(node.data) > 1:\n                node.data.remove(data)\n                return True\n        if node.left is None and node.right is None:\n            self._substitute(node, parent, None)\n        elif node.left is None and node.right is not None:\n            self._substitute(node, parent, node.right)\n        elif node.right is None and node.left is not None:\n            self._substitute(node, parent, node.left)\n        else:\n            # find largest element of left subtree\n            curr_node = node.left\n            parent = node\n            while curr_node.right is not None:\n                parent = curr_node\n                curr_node = curr_node.right\n            self._substitute(curr_node, parent, curr_node.left)\n            node.set(curr_node)\n        self.size -= 1\n        return True\n\n    def is_valid(self):\n        '''\n        Returns whether this is a valid BST.\n        '''\n        return self._is_valid(self.root)\n\n    def _is_valid(self, node):\n        if node is None:\n            return True\n        return (node.left is None or node.left <= node) and \\\n            (node.right is None or node.right >= node) and \\\n            self._is_valid(node.left) and self._is_valid(node.right)\n\n    def range(self, lower, upper, bounds=(True, True)):\n        '''\n        Return all nodes with keys in the given range.\n\n        Parameters\n        ----------\n        lower : tuple\n            Lower bound\n        upper : tuple\n            Upper bound\n        bounds : (2,) tuple of bool\n            Indicates whether the search should be inclusive or\n            exclusive with respect to the endpoints. The first\n            argument corresponds to an inclusive lower bound,\n            and the second argument to an inclusive upper bound.\n        '''\n        nodes = self.range_nodes(lower, upper, bounds)\n        return [x for node in nodes for x in node.data]\n\n    def range_nodes(self, lower, upper, bounds=(True, True)):\n        '''\n        Return nodes in the given range.\n        '''\n        if self.root is None:\n            return []\n        # op1 is <= or <, op2 is >= or >\n        op1 = operator.le if bounds[0] else operator.lt\n        op2 = operator.ge if bounds[1] else operator.gt\n        return self._range(lower, upper, op1, op2, self.root, [])\n\n    def same_prefix(self, val):\n        '''\n        Assuming the given value has smaller length than keys, return\n        nodes whose keys have this value as a prefix.\n        '''\n        if self.root is None:\n            return []\n        nodes = self._same_prefix(val, self.root, [])\n        return [x for node in nodes for x in node.data]\n\n    def _range(self, lower, upper, op1, op2, node, lst):\n        if op1(lower, node.key) and op2(upper, node.key):\n            lst.append(node)\n        if upper > node.key and node.right is not None:\n            self._range(lower, upper, op1, op2, node.right, lst)\n        if lower < node.key and node.left is not None:\n            self._range(lower, upper, op1, op2, node.left, lst)\n        return lst\n\n    def _same_prefix(self, val, node, lst):\n        prefix = node.key[:len(val)]\n        if prefix == val:\n            lst.append(node)\n        if prefix <= val and node.right is not None:\n            self._same_prefix(val, node.right, lst)\n        if prefix >= val and node.left is not None:\n            self._same_prefix(val, node.left, lst)\n        return lst\n\n    def __repr__(self):\n        return f'<{self.__class__.__name__}>'\n\n    def _print(self, node, level):\n        line = '\\t' * level + str(node) + '\\n'\n        if node.left is not None:\n            line += self._print(node.left, level + 1)\n        if node.right is not None:\n            line += self._print(node.right, level + 1)\n        return line\n\n    @property\n    def height(self):\n        '''\n        Return the BST height.\n        '''\n        return self._height(self.root)\n\n    def _height(self, node):\n        if node is None:\n            return -1\n        return max(self._height(node.left),\n                   self._height(node.right)) + 1\n\n    def replace_rows(self, row_map):\n        '''\n        Replace all rows with the values they map to in the\n        given dictionary. Any rows not present as keys in\n        the dictionary will have their nodes deleted.\n\n        Parameters\n        ----------\n        row_map : dict\n            Mapping of row numbers to new row numbers\n        '''\n        for key, data in self.items():\n            data[:] = [row_map[x] for x in data if x in row_map]\n"},{"className":"Row","col":0,"comment":"A class to represent one row of a Table object.\n\n    A Row object is returned when a Table object is indexed with an integer\n    or when iterating over a table::\n\n      >>> from astropy.table import Table\n      >>> table = Table([(1, 2), (3, 4)], names=('a', 'b'),\n      ...               dtype=('int32', 'int32'))\n      >>> row = table[1]\n      >>> row\n      <Row index=1>\n        a     b\n      int32 int32\n      ----- -----\n          2     4\n      >>> row['a']\n      2\n      >>> row[1]\n      4\n    ","endLoc":183,"id":8949,"nodeType":"Class","startLoc":10,"text":"class Row:\n    \"\"\"A class to represent one row of a Table object.\n\n    A Row object is returned when a Table object is indexed with an integer\n    or when iterating over a table::\n\n      >>> from astropy.table import Table\n      >>> table = Table([(1, 2), (3, 4)], names=('a', 'b'),\n      ...               dtype=('int32', 'int32'))\n      >>> row = table[1]\n      >>> row\n      <Row index=1>\n        a     b\n      int32 int32\n      ----- -----\n          2     4\n      >>> row['a']\n      2\n      >>> row[1]\n      4\n    \"\"\"\n\n    def __init__(self, table, index):\n        # Ensure that the row index is a valid index (int)\n        index = operator_index(index)\n\n        n = len(table)\n\n        if index < -n or index >= n:\n            raise IndexError('index {} out of range for table with length {}'\n                             .format(index, len(table)))\n\n        # Finally, ensure the index is positive [#8422] and set Row attributes\n        self._index = index % n\n        self._table = table\n\n    def __getitem__(self, item):\n        try:\n            # Try the most common use case of accessing a single column in the Row.\n            # Bypass the TableColumns __getitem__ since that does more testing\n            # and allows a list of tuple or str, which is not the right thing here.\n            out = OrderedDict.__getitem__(self._table.columns, item)[self._index]\n        except (KeyError, TypeError):\n            if self._table._is_list_or_tuple_of_str(item):\n                cols = [self._table[name] for name in item]\n                out = self._table.__class__(cols, copy=False)[self._index]\n            else:\n                # This is only to raise an exception\n                out = self._table.columns[item][self._index]\n        return out\n\n    def __setitem__(self, item, val):\n        if self._table._is_list_or_tuple_of_str(item):\n            self._table._set_row(self._index, colnames=item, vals=val)\n        else:\n            self._table.columns[item][self._index] = val\n\n    def _ipython_key_completions_(self):\n        return self.colnames\n\n    def __eq__(self, other):\n        if self._table.masked:\n            # Sent bug report to numpy-discussion group on 2012-Oct-21, subject:\n            # \"Comparing rows in a structured masked array raises exception\"\n            # No response, so this is still unresolved.\n            raise ValueError('Unable to compare rows for masked table due to numpy.ma bug')\n        return self.as_void() == other\n\n    def __ne__(self, other):\n        if self._table.masked:\n            raise ValueError('Unable to compare rows for masked table due to numpy.ma bug')\n        return self.as_void() != other\n\n    def __array__(self, dtype=None):\n        \"\"\"Support converting Row to np.array via np.array(table).\n\n        Coercion to a different dtype via np.array(table, dtype) is not\n        supported and will raise a ValueError.\n\n        If the parent table is masked then the mask information is dropped.\n        \"\"\"\n        if dtype is not None:\n            raise ValueError('Datatype coercion is not allowed')\n\n        return np.asarray(self.as_void())\n\n    def __len__(self):\n        return len(self._table.columns)\n\n    def __iter__(self):\n        index = self._index\n        for col in self._table.columns.values():\n            yield col[index]\n\n    def keys(self):\n        return self._table.columns.keys()\n\n    def values(self):\n        return self.__iter__()\n\n    @property\n    def table(self):\n        return self._table\n\n    @property\n    def index(self):\n        return self._index\n\n    def as_void(self):\n        \"\"\"\n        Returns a *read-only* copy of the row values in the form of np.void or\n        np.ma.mvoid objects.  This corresponds to the object types returned for\n        row indexing of a pure numpy structured array or masked array. This\n        method is slow and its use is discouraged when possible.\n\n        Returns\n        -------\n        void_row : ``numpy.void`` or ``numpy.ma.mvoid``\n            Copy of row values.\n            ``numpy.void`` if unmasked, ``numpy.ma.mvoid`` else.\n        \"\"\"\n        index = self._index\n        cols = self._table.columns.values()\n        vals = tuple(np.asarray(col)[index] for col in cols)\n        if self._table.masked:\n            mask = tuple(col.mask[index] if hasattr(col, 'mask') else False\n                         for col in cols)\n            void_row = np.ma.array([vals], mask=[mask], dtype=self.dtype)[0]\n        else:\n            void_row = np.array([vals], dtype=self.dtype)[0]\n        return void_row\n\n    @property\n    def meta(self):\n        return self._table.meta\n\n    @property\n    def columns(self):\n        return self._table.columns\n\n    @property\n    def colnames(self):\n        return self._table.colnames\n\n    @property\n    def dtype(self):\n        return self._table.dtype\n\n    def _base_repr_(self, html=False):\n        \"\"\"\n        Display row as a single-line table but with appropriate header line.\n        \"\"\"\n        index = self.index if (self.index >= 0) else self.index + len(self._table)\n        table = self._table[index:index + 1]\n        descr_vals = [self.__class__.__name__,\n                      f'index={self.index}']\n        if table.masked:\n            descr_vals.append('masked=True')\n\n        return table._base_repr_(html, descr_vals, max_width=-1,\n                                 tableid=f'table{id(self._table)}')\n\n    def _repr_html_(self):\n        return self._base_repr_(html=True)\n\n    def __repr__(self):\n        return self._base_repr_(html=False)\n\n    def __str__(self):\n        index = self.index if (self.index >= 0) else self.index + len(self._table)\n        return '\\n'.join(self.table[index:index + 1].pformat(max_width=-1))\n\n    def __bytes__(self):\n        return str(self).encode('utf-8')"},{"className":"MaxValue","col":0,"comment":"\n    Represents an infinite value for purposes\n    of tuple comparison.\n    ","endLoc":28,"id":8950,"nodeType":"Class","startLoc":7,"text":"class MaxValue:\n    '''\n    Represents an infinite value for purposes\n    of tuple comparison.\n    '''\n\n    def __gt__(self, other):\n        return True\n\n    def __ge__(self, other):\n        return True\n\n    def __lt__(self, other):\n        return False\n\n    def __le__(self, other):\n        return False\n\n    def __repr__(self):\n        return \"MAX\"\n\n    __str__ = __repr__"},{"col":4,"comment":"null","endLoc":14,"header":"def __gt__(self, other)","id":8951,"name":"__gt__","nodeType":"Function","startLoc":13,"text":"def __gt__(self, other):\n        return True"},{"col":4,"comment":"null","endLoc":17,"header":"def __ge__(self, other)","id":8952,"name":"__ge__","nodeType":"Function","startLoc":16,"text":"def __ge__(self, other):\n        return True"},{"col":4,"comment":"null","endLoc":20,"header":"def __lt__(self, other)","id":8953,"name":"__lt__","nodeType":"Function","startLoc":19,"text":"def __lt__(self, other):\n        return False"},{"col":4,"comment":"null","endLoc":23,"header":"def __le__(self, other)","id":8954,"name":"__le__","nodeType":"Function","startLoc":22,"text":"def __le__(self, other):\n        return False"},{"col":4,"comment":"null","endLoc":26,"header":"def __repr__(self)","id":8955,"name":"__repr__","nodeType":"Function","startLoc":25,"text":"def __repr__(self):\n        return \"MAX\""},{"attributeType":"function","col":4,"comment":"null","endLoc":28,"id":8956,"name":"__str__","nodeType":"Attribute","startLoc":28,"text":"__str__"},{"className":"MinValue","col":0,"comment":"\n    The opposite of MaxValue, i.e. a representation of\n    negative infinity.\n    ","endLoc":52,"id":8957,"nodeType":"Class","startLoc":31,"text":"class MinValue:\n    '''\n    The opposite of MaxValue, i.e. a representation of\n    negative infinity.\n    '''\n\n    def __lt__(self, other):\n        return True\n\n    def __le__(self, other):\n        return True\n\n    def __gt__(self, other):\n        return False\n\n    def __ge__(self, other):\n        return False\n\n    def __repr__(self):\n        return \"MIN\"\n\n    __str__ = __repr__"},{"col":4,"comment":"null","endLoc":38,"header":"def __lt__(self, other)","id":8958,"name":"__lt__","nodeType":"Function","startLoc":37,"text":"def __lt__(self, other):\n        return True"},{"col":4,"comment":"null","endLoc":41,"header":"def __le__(self, other)","id":8959,"name":"__le__","nodeType":"Function","startLoc":40,"text":"def __le__(self, other):\n        return True"},{"col":4,"comment":"null","endLoc":44,"header":"def __gt__(self, other)","id":8960,"name":"__gt__","nodeType":"Function","startLoc":43,"text":"def __gt__(self, other):\n        return False"},{"col":4,"comment":"null","endLoc":47,"header":"def __ge__(self, other)","id":8961,"name":"__ge__","nodeType":"Function","startLoc":46,"text":"def __ge__(self, other):\n        return False"},{"col":4,"comment":"null","endLoc":50,"header":"def __repr__(self)","id":8962,"name":"__repr__","nodeType":"Function","startLoc":49,"text":"def __repr__(self):\n        return \"MIN\""},{"attributeType":"function","col":4,"comment":"null","endLoc":52,"id":8963,"name":"__str__","nodeType":"Attribute","startLoc":52,"text":"__str__"},{"col":0,"comment":"Utility to get grid parameters from a frequency array\n\n    Parameters\n    ----------\n    frequency : array-like or `~astropy.units.Quantity` ['frequency']\n        input frequency grid\n    assume_regular_frequency : bool (default = False)\n        if True, then do not check whether frequency is a regular grid\n\n    Returns\n    -------\n    f0, df, N : scalar\n        Parameters such that all(frequency == f0 + df * np.arange(N))\n    ","endLoc":76,"header":"def _get_frequency_grid(frequency, assume_regular_frequency=False)","id":8964,"name":"_get_frequency_grid","nodeType":"Function","startLoc":53,"text":"def _get_frequency_grid(frequency, assume_regular_frequency=False):\n    \"\"\"Utility to get grid parameters from a frequency array\n\n    Parameters\n    ----------\n    frequency : array-like or `~astropy.units.Quantity` ['frequency']\n        input frequency grid\n    assume_regular_frequency : bool (default = False)\n        if True, then do not check whether frequency is a regular grid\n\n    Returns\n    -------\n    f0, df, N : scalar\n        Parameters such that all(frequency == f0 + df * np.arange(N))\n    \"\"\"\n    frequency = np.asarray(frequency)\n    if frequency.ndim != 1:\n        raise ValueError(\"frequency grid must be 1 dimensional\")\n    elif len(frequency) == 1:\n        return frequency[0], frequency[0], 1\n    elif not (assume_regular_frequency or _is_regular(frequency)):\n        raise ValueError(\"frequency must be a regular grid\")\n\n    return frequency[0], frequency[1] - frequency[0], len(frequency)"},{"className":"Epsilon","col":0,"comment":"\n    Represents the \"next largest\" version of a given value,\n    so that for all valid comparisons we have\n    x < y < Epsilon(y) < z whenever x < y < z and x, z are\n    not Epsilon objects.\n\n    Parameters\n    ----------\n    val : object\n        Original value\n    ","endLoc":86,"id":8965,"nodeType":"Class","startLoc":55,"text":"class Epsilon:\n    '''\n    Represents the \"next largest\" version of a given value,\n    so that for all valid comparisons we have\n    x < y < Epsilon(y) < z whenever x < y < z and x, z are\n    not Epsilon objects.\n\n    Parameters\n    ----------\n    val : object\n        Original value\n    '''\n    __slots__ = ('val',)\n\n    def __init__(self, val):\n        self.val = val\n\n    def __lt__(self, other):\n        if self.val == other:\n            return False\n        return self.val < other\n\n    def __gt__(self, other):\n        if self.val == other:\n            return True\n        return self.val > other\n\n    def __eq__(self, other):\n        return False\n\n    def __repr__(self):\n        return repr(self.val) + \" + epsilon\""},{"col":4,"comment":"null","endLoc":70,"header":"def __init__(self, val)","id":8966,"name":"__init__","nodeType":"Function","startLoc":69,"text":"def __init__(self, val):\n        self.val = val"},{"col":4,"comment":"null","endLoc":75,"header":"def __lt__(self, other)","id":8967,"name":"__lt__","nodeType":"Function","startLoc":72,"text":"def __lt__(self, other):\n        if self.val == other:\n            return False\n        return self.val < other"},{"col":4,"comment":"null","endLoc":80,"header":"def __gt__(self, other)","id":8968,"name":"__gt__","nodeType":"Function","startLoc":77,"text":"def __gt__(self, other):\n        if self.val == other:\n            return True\n        return self.val > other"},{"col":4,"comment":"null","endLoc":83,"header":"def __eq__(self, other)","id":8969,"name":"__eq__","nodeType":"Function","startLoc":82,"text":"def __eq__(self, other):\n        return False"},{"col":4,"comment":"null","endLoc":86,"header":"def __repr__(self)","id":8970,"name":"__repr__","nodeType":"Function","startLoc":85,"text":"def __repr__(self):\n        return repr(self.val) + \" + epsilon\""},{"attributeType":"null","col":4,"comment":"null","endLoc":67,"id":8971,"name":"__slots__","nodeType":"Attribute","startLoc":67,"text":"__slots__"},{"attributeType":"null","col":8,"comment":"null","endLoc":70,"id":8972,"name":"val","nodeType":"Attribute","startLoc":70,"text":"self.val"},{"col":4,"comment":"\n        Convert the provided times (if absolute) to relative times using the\n        current _tstart value. If the times provided are relative, they are\n        returned without conversion (though we still do some checks).\n        ","endLoc":392,"header":"def _as_relative_time(self, name, times)","id":8973,"name":"_as_relative_time","nodeType":"Function","startLoc":369,"text":"def _as_relative_time(self, name, times):\n        \"\"\"\n        Convert the provided times (if absolute) to relative times using the\n        current _tstart value. If the times provided are relative, they are\n        returned without conversion (though we still do some checks).\n        \"\"\"\n\n        if isinstance(times, TimeDelta):\n            times = times.to('day')\n\n        if self._tstart is None:\n            if isinstance(times, Time):\n                raise TypeError('{} was provided as an absolute time but '\n                                'the LombScargle class was initialized '\n                                'with relative times.'.format(name))\n        else:\n            if isinstance(times, Time):\n                times = (times - self._tstart).to(u.day)\n            else:\n                raise TypeError('{} was provided as a relative time but '\n                                'the LombScargle class was initialized '\n                                'with absolute times.'.format(name))\n\n        return times"},{"col":4,"comment":"null","endLoc":44,"header":"def __init__(self, table, index)","id":8974,"name":"__init__","nodeType":"Function","startLoc":32,"text":"def __init__(self, table, index):\n        # Ensure that the row index is a valid index (int)\n        index = operator_index(index)\n\n        n = len(table)\n\n        if index < -n or index >= n:\n            raise IndexError('index {} out of range for table with length {}'\n                             .format(index, len(table)))\n\n        # Finally, ensure the index is positive [#8422] and set Row attributes\n        self._index = index % n\n        self._table = table"},{"className":"Node","col":0,"comment":"\n    An element in a binary search tree, containing\n    a key, data, and references to children nodes and\n    a parent node.\n\n    Parameters\n    ----------\n    key : tuple\n        Node key\n    data : list or int\n        Node data\n    ","endLoc":145,"id":8975,"nodeType":"Class","startLoc":89,"text":"class Node:\n    '''\n    An element in a binary search tree, containing\n    a key, data, and references to children nodes and\n    a parent node.\n\n    Parameters\n    ----------\n    key : tuple\n        Node key\n    data : list or int\n        Node data\n    '''\n    __lt__ = lambda x, y: x.key < y.key\n    __le__ = lambda x, y: x.key <= y.key\n    __eq__ = lambda x, y: x.key == y.key\n    __ge__ = lambda x, y: x.key >= y.key\n    __gt__ = lambda x, y: x.key > y.key\n    __ne__ = lambda x, y: x.key != y.key\n    __slots__ = ('key', 'data', 'left', 'right')\n\n    # each node has a key and data list\n    def __init__(self, key, data):\n        self.key = key\n        self.data = data if isinstance(data, list) else [data]\n        self.left = None\n        self.right = None\n\n    def replace(self, child, new_child):\n        '''\n        Replace this node's child with a new child.\n        '''\n        if self.left is not None and self.left == child:\n            self.left = new_child\n        elif self.right is not None and self.right == child:\n            self.right = new_child\n        else:\n            raise ValueError(\"Cannot call replace() on non-child\")\n\n    def remove(self, child):\n        '''\n        Remove the given child.\n        '''\n        self.replace(child, None)\n\n    def set(self, other):\n        '''\n        Copy the given node.\n        '''\n        self.key = other.key\n        self.data = other.data[:]\n\n    def __str__(self):\n        return str((self.key, self.data))\n\n    def __repr__(self):\n        return str(self)"},{"col":4,"comment":"null","endLoc":115,"header":"def __init__(self, key, data)","id":8976,"name":"__init__","nodeType":"Function","startLoc":111,"text":"def __init__(self, key, data):\n        self.key = key\n        self.data = data if isinstance(data, list) else [data]\n        self.left = None\n        self.right = None"},{"col":4,"comment":"\n        Replace this node's child with a new child.\n        ","endLoc":126,"header":"def replace(self, child, new_child)","id":8977,"name":"replace","nodeType":"Function","startLoc":117,"text":"def replace(self, child, new_child):\n        '''\n        Replace this node's child with a new child.\n        '''\n        if self.left is not None and self.left == child:\n            self.left = new_child\n        elif self.right is not None and self.right == child:\n            self.right = new_child\n        else:\n            raise ValueError(\"Cannot call replace() on non-child\")"},{"col":4,"comment":"\n        Remove the given child.\n        ","endLoc":132,"header":"def remove(self, child)","id":8978,"name":"remove","nodeType":"Function","startLoc":128,"text":"def remove(self, child):\n        '''\n        Remove the given child.\n        '''\n        self.replace(child, None)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1742,"id":8979,"name":"name","nodeType":"Attribute","startLoc":1742,"text":"name"},{"col":4,"comment":"\n        Copy the given node.\n        ","endLoc":139,"header":"def set(self, other)","id":8980,"name":"set","nodeType":"Function","startLoc":134,"text":"def set(self, other):\n        '''\n        Copy the given node.\n        '''\n        self.key = other.key\n        self.data = other.data[:]"},{"col":4,"comment":"null","endLoc":142,"header":"def __str__(self)","id":8981,"name":"__str__","nodeType":"Function","startLoc":141,"text":"def __str__(self):\n        return str((self.key, self.data))"},{"col":4,"comment":"null","endLoc":145,"header":"def __repr__(self)","id":8982,"name":"__repr__","nodeType":"Function","startLoc":144,"text":"def __repr__(self):\n        return str(self)"},{"attributeType":"function","col":4,"comment":"null","endLoc":102,"id":8983,"name":"__lt__","nodeType":"Attribute","startLoc":102,"text":"__lt__"},{"attributeType":"function","col":4,"comment":"null","endLoc":103,"id":8984,"name":"__le__","nodeType":"Attribute","startLoc":103,"text":"__le__"},{"attributeType":"null","col":4,"comment":"null","endLoc":1743,"id":8985,"name":"epoch_to_jd","nodeType":"Attribute","startLoc":1743,"text":"epoch_to_jd"},{"attributeType":"function","col":4,"comment":"null","endLoc":104,"id":8986,"name":"__eq__","nodeType":"Attribute","startLoc":104,"text":"__eq__"},{"col":4,"comment":"\n        Sigma clip when ``axis`` is None and ``grow`` is not >0.\n\n        In this simple case, we remove clipped elements from the\n        flattened array during each iteration.\n        ","endLoc":441,"header":"def _sigmaclip_noaxis(self, data, masked=True, return_bounds=False,\n                          copy=True)","id":8987,"name":"_sigmaclip_noaxis","nodeType":"Function","startLoc":393,"text":"def _sigmaclip_noaxis(self, data, masked=True, return_bounds=False,\n                          copy=True):\n        \"\"\"\n        Sigma clip when ``axis`` is None and ``grow`` is not >0.\n\n        In this simple case, we remove clipped elements from the\n        flattened array during each iteration.\n        \"\"\"\n        filtered_data = data.ravel()\n\n        # remove masked values and convert to ndarray\n        if isinstance(filtered_data, np.ma.MaskedArray):\n            filtered_data = filtered_data.data[~filtered_data.mask]\n\n        # remove invalid values\n        good_mask = np.isfinite(filtered_data)\n        if np.any(~good_mask):\n            filtered_data = filtered_data[good_mask]\n            warnings.warn('Input data contains invalid values (NaNs or '\n                          'infs), which were automatically clipped.',\n                          AstropyUserWarning)\n\n        nchanged = 1\n        iteration = 0\n        while nchanged != 0 and (iteration < self.maxiters):\n            iteration += 1\n            size = filtered_data.size\n            self._compute_bounds(filtered_data, axis=None)\n            filtered_data = filtered_data[\n                (filtered_data >= self._min_value)\n                & (filtered_data <= self._max_value)]\n            nchanged = size - filtered_data.size\n\n        self._niterations = iteration\n\n        if masked:\n            # return a masked array and optional bounds\n            filtered_data = np.ma.masked_invalid(data, copy=copy)\n\n            # update the mask in place, ignoring RuntimeWarnings for\n            # comparisons with NaN data values\n            with np.errstate(invalid='ignore'):\n                filtered_data.mask |= np.logical_or(data < self._min_value,\n                                                    data > self._max_value)\n\n        if return_bounds:\n            return filtered_data, self._min_value, self._max_value\n        else:\n            return filtered_data"},{"attributeType":"function","col":4,"comment":"null","endLoc":105,"id":8988,"name":"__ge__","nodeType":"Attribute","startLoc":105,"text":"__ge__"},{"attributeType":"function","col":4,"comment":"null","endLoc":106,"id":8989,"name":"__gt__","nodeType":"Attribute","startLoc":106,"text":"__gt__"},{"attributeType":"function","col":4,"comment":"null","endLoc":107,"id":8990,"name":"__ne__","nodeType":"Attribute","startLoc":107,"text":"__ne__"},{"attributeType":"null","col":4,"comment":"null","endLoc":108,"id":8991,"name":"__slots__","nodeType":"Attribute","startLoc":108,"text":"__slots__"},{"attributeType":"null","col":4,"comment":"null","endLoc":1744,"id":8992,"name":"jd_to_epoch","nodeType":"Attribute","startLoc":1744,"text":"jd_to_epoch"},{"attributeType":"null","col":8,"comment":"null","endLoc":113,"id":8993,"name":"data","nodeType":"Attribute","startLoc":113,"text":"self.data"},{"className":"TimeJulianEpoch","col":0,"comment":"Julian Epoch year as floating point value(s) like 2000.0","endLoc":1761,"id":8994,"nodeType":"Class","startLoc":1756,"text":"class TimeJulianEpoch(TimeEpochDate):\n    \"\"\"Julian Epoch year as floating point value(s) like 2000.0\"\"\"\n    name = 'jyear'\n    unit = erfa.DJY  # 365.25, the Julian year, for conversion to quantities\n    epoch_to_jd = 'epj2jd'\n    jd_to_epoch = 'epj'"},{"attributeType":"null","col":4,"comment":"null","endLoc":1758,"id":8995,"name":"name","nodeType":"Attribute","startLoc":1758,"text":"name"},{"attributeType":"None","col":8,"comment":"null","endLoc":114,"id":8996,"name":"left","nodeType":"Attribute","startLoc":114,"text":"self.left"},{"attributeType":"null","col":4,"comment":"null","endLoc":1759,"id":8997,"name":"unit","nodeType":"Attribute","startLoc":1759,"text":"unit"},{"col":4,"comment":"Compute the Lomb-Scargle model at the given frequency.\n\n        The model at a particular frequency is a linear model:\n        model = offset + dot(design_matrix, model_parameters)\n\n        Parameters\n        ----------\n        t : array-like or `~astropy.units.Quantity` ['time']\n            Times (length ``n_samples``) at which to compute the model.\n        frequency : float\n            the frequency for the model\n\n        Returns\n        -------\n        y : np.ndarray\n            The model fit corresponding to the input times\n            (will have length ``n_samples``).\n\n        See Also\n        --------\n        design_matrix\n        offset\n        model_parameters\n        ","endLoc":427,"header":"def model(self, t, frequency)","id":8998,"name":"model","nodeType":"Function","startLoc":394,"text":"def model(self, t, frequency):\n        \"\"\"Compute the Lomb-Scargle model at the given frequency.\n\n        The model at a particular frequency is a linear model:\n        model = offset + dot(design_matrix, model_parameters)\n\n        Parameters\n        ----------\n        t : array-like or `~astropy.units.Quantity` ['time']\n            Times (length ``n_samples``) at which to compute the model.\n        frequency : float\n            the frequency for the model\n\n        Returns\n        -------\n        y : np.ndarray\n            The model fit corresponding to the input times\n            (will have length ``n_samples``).\n\n        See Also\n        --------\n        design_matrix\n        offset\n        model_parameters\n        \"\"\"\n        frequency = self._validate_frequency(frequency)\n        t = self._validate_t(self._as_relative_time('t', t))\n        y_fit = periodic_fit(*strip_units(self._trel, self.y, self.dy),\n                             frequency=strip_units(frequency),\n                             t_fit=strip_units(t),\n                             center_data=self.center_data,\n                             fit_mean=self.fit_mean,\n                             nterms=self.nterms)\n        return y_fit * get_unit(self.y)"},{"attributeType":"None","col":8,"comment":"null","endLoc":115,"id":8999,"name":"right","nodeType":"Attribute","startLoc":115,"text":"self.right"},{"attributeType":"null","col":8,"comment":"null","endLoc":112,"id":9000,"name":"key","nodeType":"Attribute","startLoc":112,"text":"self.key"},{"attributeType":"null","col":4,"comment":"null","endLoc":1760,"id":9001,"name":"epoch_to_jd","nodeType":"Attribute","startLoc":1760,"text":"epoch_to_jd"},{"className":"BST","col":0,"comment":"\n    A basic binary search tree in pure Python, used\n    as an engine for indexing.\n\n    Parameters\n    ----------\n    data : Table\n        Sorted columns of the original table\n    row_index : Column object\n        Row numbers corresponding to data columns\n    unique : bool\n        Whether the values of the index must be unique.\n        Defaults to False.\n    ","endLoc":482,"id":9002,"nodeType":"Class","startLoc":148,"text":"class BST:\n    '''\n    A basic binary search tree in pure Python, used\n    as an engine for indexing.\n\n    Parameters\n    ----------\n    data : Table\n        Sorted columns of the original table\n    row_index : Column object\n        Row numbers corresponding to data columns\n    unique : bool\n        Whether the values of the index must be unique.\n        Defaults to False.\n    '''\n    NodeClass = Node\n\n    def __init__(self, data, row_index, unique=False):\n        self.root = None\n        self.size = 0\n        self.unique = unique\n        for key, row in zip(data, row_index):\n            self.add(tuple(key), row)\n\n    def add(self, key, data=None):\n        '''\n        Add a key, data pair.\n        '''\n        if data is None:\n            data = key\n\n        self.size += 1\n        node = self.NodeClass(key, data)\n        curr_node = self.root\n        if curr_node is None:\n            self.root = node\n            return\n        while True:\n            if node < curr_node:\n                if curr_node.left is None:\n                    curr_node.left = node\n                    break\n                curr_node = curr_node.left\n            elif node > curr_node:\n                if curr_node.right is None:\n                    curr_node.right = node\n                    break\n                curr_node = curr_node.right\n            elif self.unique:\n                raise ValueError(\"Cannot insert non-unique value\")\n            else:  # add data to node\n                curr_node.data.extend(node.data)\n                curr_node.data = sorted(curr_node.data)\n                return\n\n    def find(self, key):\n        '''\n        Return all data values corresponding to a given key.\n\n        Parameters\n        ----------\n        key : tuple\n            Input key\n\n        Returns\n        -------\n        data_vals : list\n            List of rows corresponding to the input key\n        '''\n        node, parent = self.find_node(key)\n        return node.data if node is not None else []\n\n    def find_node(self, key):\n        '''\n        Find the node associated with the given key.\n        '''\n        if self.root is None:\n            return (None, None)\n        return self._find_recursive(key, self.root, None)\n\n    def shift_left(self, row):\n        '''\n        Decrement all rows larger than the given row.\n        '''\n        for node in self.traverse():\n            node.data = [x - 1 if x > row else x for x in node.data]\n\n    def shift_right(self, row):\n        '''\n        Increment all rows greater than or equal to the given row.\n        '''\n        for node in self.traverse():\n            node.data = [x + 1 if x >= row else x for x in node.data]\n\n    def _find_recursive(self, key, node, parent):\n        try:\n            if key == node.key:\n                return (node, parent)\n            elif key > node.key:\n                if node.right is None:\n                    return (None, None)\n                return self._find_recursive(key, node.right, node)\n            else:\n                if node.left is None:\n                    return (None, None)\n                return self._find_recursive(key, node.left, node)\n        except TypeError:  # wrong key type\n            return (None, None)\n\n    def traverse(self, order='inorder'):\n        '''\n        Return nodes of the BST in the given order.\n\n        Parameters\n        ----------\n        order : str\n            The order in which to recursively search the BST.\n            Possible values are:\n            \"preorder\": current node, left subtree, right subtree\n            \"inorder\": left subtree, current node, right subtree\n            \"postorder\": left subtree, right subtree, current node\n        '''\n        if order == 'preorder':\n            return self._preorder(self.root, [])\n        elif order == 'inorder':\n            return self._inorder(self.root, [])\n        elif order == 'postorder':\n            return self._postorder(self.root, [])\n        raise ValueError(f\"Invalid traversal method: \\\"{order}\\\"\")\n\n    def items(self):\n        '''\n        Return BST items in order as (key, data) pairs.\n        '''\n        return [(x.key, x.data) for x in self.traverse()]\n\n    def sort(self):\n        '''\n        Make row order align with key order.\n        '''\n        i = 0\n        for node in self.traverse():\n            num_rows = len(node.data)\n            node.data = [x for x in range(i, i + num_rows)]\n            i += num_rows\n\n    def sorted_data(self):\n        '''\n        Return BST rows sorted by key values.\n        '''\n        return [x for node in self.traverse() for x in node.data]\n\n    def _preorder(self, node, lst):\n        if node is None:\n            return lst\n        lst.append(node)\n        self._preorder(node.left, lst)\n        self._preorder(node.right, lst)\n        return lst\n\n    def _inorder(self, node, lst):\n        if node is None:\n            return lst\n        self._inorder(node.left, lst)\n        lst.append(node)\n        self._inorder(node.right, lst)\n        return lst\n\n    def _postorder(self, node, lst):\n        if node is None:\n            return lst\n        self._postorder(node.left, lst)\n        self._postorder(node.right, lst)\n        lst.append(node)\n        return lst\n\n    def _substitute(self, node, parent, new_node):\n        if node is self.root:\n            self.root = new_node\n        else:\n            parent.replace(node, new_node)\n\n    def remove(self, key, data=None):\n        '''\n        Remove data corresponding to the given key.\n\n        Parameters\n        ----------\n        key : tuple\n            The key to remove\n        data : int or None\n            If None, remove the node corresponding to the given key.\n            If not None, remove only the given data value from the node.\n\n        Returns\n        -------\n        successful : bool\n            True if removal was successful, false otherwise\n        '''\n        node, parent = self.find_node(key)\n        if node is None:\n            return False\n        if data is not None:\n            if data not in node.data:\n                raise ValueError(\"Data does not belong to correct node\")\n            elif len(node.data) > 1:\n                node.data.remove(data)\n                return True\n        if node.left is None and node.right is None:\n            self._substitute(node, parent, None)\n        elif node.left is None and node.right is not None:\n            self._substitute(node, parent, node.right)\n        elif node.right is None and node.left is not None:\n            self._substitute(node, parent, node.left)\n        else:\n            # find largest element of left subtree\n            curr_node = node.left\n            parent = node\n            while curr_node.right is not None:\n                parent = curr_node\n                curr_node = curr_node.right\n            self._substitute(curr_node, parent, curr_node.left)\n            node.set(curr_node)\n        self.size -= 1\n        return True\n\n    def is_valid(self):\n        '''\n        Returns whether this is a valid BST.\n        '''\n        return self._is_valid(self.root)\n\n    def _is_valid(self, node):\n        if node is None:\n            return True\n        return (node.left is None or node.left <= node) and \\\n            (node.right is None or node.right >= node) and \\\n            self._is_valid(node.left) and self._is_valid(node.right)\n\n    def range(self, lower, upper, bounds=(True, True)):\n        '''\n        Return all nodes with keys in the given range.\n\n        Parameters\n        ----------\n        lower : tuple\n            Lower bound\n        upper : tuple\n            Upper bound\n        bounds : (2,) tuple of bool\n            Indicates whether the search should be inclusive or\n            exclusive with respect to the endpoints. The first\n            argument corresponds to an inclusive lower bound,\n            and the second argument to an inclusive upper bound.\n        '''\n        nodes = self.range_nodes(lower, upper, bounds)\n        return [x for node in nodes for x in node.data]\n\n    def range_nodes(self, lower, upper, bounds=(True, True)):\n        '''\n        Return nodes in the given range.\n        '''\n        if self.root is None:\n            return []\n        # op1 is <= or <, op2 is >= or >\n        op1 = operator.le if bounds[0] else operator.lt\n        op2 = operator.ge if bounds[1] else operator.gt\n        return self._range(lower, upper, op1, op2, self.root, [])\n\n    def same_prefix(self, val):\n        '''\n        Assuming the given value has smaller length than keys, return\n        nodes whose keys have this value as a prefix.\n        '''\n        if self.root is None:\n            return []\n        nodes = self._same_prefix(val, self.root, [])\n        return [x for node in nodes for x in node.data]\n\n    def _range(self, lower, upper, op1, op2, node, lst):\n        if op1(lower, node.key) and op2(upper, node.key):\n            lst.append(node)\n        if upper > node.key and node.right is not None:\n            self._range(lower, upper, op1, op2, node.right, lst)\n        if lower < node.key and node.left is not None:\n            self._range(lower, upper, op1, op2, node.left, lst)\n        return lst\n\n    def _same_prefix(self, val, node, lst):\n        prefix = node.key[:len(val)]\n        if prefix == val:\n            lst.append(node)\n        if prefix <= val and node.right is not None:\n            self._same_prefix(val, node.right, lst)\n        if prefix >= val and node.left is not None:\n            self._same_prefix(val, node.left, lst)\n        return lst\n\n    def __repr__(self):\n        return f'<{self.__class__.__name__}>'\n\n    def _print(self, node, level):\n        line = '\\t' * level + str(node) + '\\n'\n        if node.left is not None:\n            line += self._print(node.left, level + 1)\n        if node.right is not None:\n            line += self._print(node.right, level + 1)\n        return line\n\n    @property\n    def height(self):\n        '''\n        Return the BST height.\n        '''\n        return self._height(self.root)\n\n    def _height(self, node):\n        if node is None:\n            return -1\n        return max(self._height(node.left),\n                   self._height(node.right)) + 1\n\n    def replace_rows(self, row_map):\n        '''\n        Replace all rows with the values they map to in the\n        given dictionary. Any rows not present as keys in\n        the dictionary will have their nodes deleted.\n\n        Parameters\n        ----------\n        row_map : dict\n            Mapping of row numbers to new row numbers\n        '''\n        for key, data in self.items():\n            data[:] = [row_map[x] for x in data if x in row_map]"},{"attributeType":"null","col":4,"comment":"null","endLoc":1761,"id":9003,"name":"jd_to_epoch","nodeType":"Attribute","startLoc":1761,"text":"jd_to_epoch"},{"className":"TimeEpochDateString","col":0,"comment":"\n    Base class to support string Besselian and Julian epoch dates\n    such as 'B1950.0' or 'J2000.0' respectively.\n    ","endLoc":1802,"id":9004,"nodeType":"Class","startLoc":1764,"text":"class TimeEpochDateString(TimeString):\n    \"\"\"\n    Base class to support string Besselian and Julian epoch dates\n    such as 'B1950.0' or 'J2000.0' respectively.\n    \"\"\"\n    _default_scale = 'tt'  # As of astropy 3.2, this is no longer 'utc'.\n\n    def set_jds(self, val1, val2):\n        epoch_prefix = self.epoch_prefix\n        # Be liberal in what we accept: convert bytes to ascii.\n        to_string = (str if val1.dtype.kind == 'U' else\n                     lambda x: str(x.item(), encoding='ascii'))\n        iterator = np.nditer([val1, None], op_dtypes=[val1.dtype, np.double],\n                             flags=['zerosize_ok'])\n        for val, years in iterator:\n            try:\n                time_str = to_string(val)\n                epoch_type, year_str = time_str[0], time_str[1:]\n                year = float(year_str)\n                if epoch_type.upper() != epoch_prefix:\n                    raise ValueError\n            except (IndexError, ValueError, UnicodeEncodeError):\n                raise ValueError(f'Time {val} does not match {self.name} format')\n            else:\n                years[...] = year\n\n        self._check_scale(self._scale)  # validate scale.\n        epoch_to_jd = getattr(erfa, self.epoch_to_jd)\n        jd1, jd2 = epoch_to_jd(iterator.operands[-1])\n        self.jd1, self.jd2 = day_frac(jd1, jd2)\n\n    @property\n    def value(self):\n        jd_to_epoch = getattr(erfa, self.jd_to_epoch)\n        years = jd_to_epoch(self.jd1, self.jd2)\n        # Use old-style format since it is a factor of 2 faster\n        str_fmt = self.epoch_prefix + '%.' + str(self.precision) + 'f'\n        outs = [str_fmt % year for year in years.flat]\n        return np.array(outs).reshape(self.jd1.shape)"},{"col":4,"comment":"null","endLoc":170,"header":"def __init__(self, data, row_index, unique=False)","id":9005,"name":"__init__","nodeType":"Function","startLoc":165,"text":"def __init__(self, data, row_index, unique=False):\n        self.root = None\n        self.size = 0\n        self.unique = unique\n        for key, row in zip(data, row_index):\n            self.add(tuple(key), row)"},{"col":4,"comment":"null","endLoc":1793,"header":"def set_jds(self, val1, val2)","id":9006,"name":"set_jds","nodeType":"Function","startLoc":1771,"text":"def set_jds(self, val1, val2):\n        epoch_prefix = self.epoch_prefix\n        # Be liberal in what we accept: convert bytes to ascii.\n        to_string = (str if val1.dtype.kind == 'U' else\n                     lambda x: str(x.item(), encoding='ascii'))\n        iterator = np.nditer([val1, None], op_dtypes=[val1.dtype, np.double],\n                             flags=['zerosize_ok'])\n        for val, years in iterator:\n            try:\n                time_str = to_string(val)\n                epoch_type, year_str = time_str[0], time_str[1:]\n                year = float(year_str)\n                if epoch_type.upper() != epoch_prefix:\n                    raise ValueError\n            except (IndexError, ValueError, UnicodeEncodeError):\n                raise ValueError(f'Time {val} does not match {self.name} format')\n            else:\n                years[...] = year\n\n        self._check_scale(self._scale)  # validate scale.\n        epoch_to_jd = getattr(erfa, self.epoch_to_jd)\n        jd1, jd2 = epoch_to_jd(iterator.operands[-1])\n        self.jd1, self.jd2 = day_frac(jd1, jd2)"},{"col":21,"endLoc":1775,"id":9007,"nodeType":"Lambda","startLoc":1775,"text":"lambda x: str(x.item(), encoding='ascii')"},{"col":4,"comment":"null","endLoc":59,"header":"def __getitem__(self, item)","id":9008,"name":"__getitem__","nodeType":"Function","startLoc":46,"text":"def __getitem__(self, item):\n        try:\n            # Try the most common use case of accessing a single column in the Row.\n            # Bypass the TableColumns __getitem__ since that does more testing\n            # and allows a list of tuple or str, which is not the right thing here.\n            out = OrderedDict.__getitem__(self._table.columns, item)[self._index]\n        except (KeyError, TypeError):\n            if self._table._is_list_or_tuple_of_str(item):\n                cols = [self._table[name] for name in item]\n                out = self._table.__class__(cols, copy=False)[self._index]\n            else:\n                # This is only to raise an exception\n                out = self._table.columns[item][self._index]\n        return out"},{"col":0,"comment":"Compute the Lomb-Scargle model fit at a given frequency\n\n    Parameters\n    ----------\n    t, y, dy : float or array-like\n        The times, observations, and uncertainties to fit\n    frequency : float\n        The frequency at which to compute the model\n    t_fit : float or array-like\n        The times at which the fit should be computed\n    center_data : bool (default=True)\n        If True, center the input data before applying the fit\n    fit_mean : bool (default=True)\n        If True, include the bias as part of the model\n    nterms : int (default=1)\n        The number of Fourier terms to include in the fit\n\n    Returns\n    -------\n    y_fit : ndarray\n        The model fit evaluated at each value of t_fit\n    ","endLoc":108,"header":"def periodic_fit(t, y, dy, frequency, t_fit,\n                 center_data=True, fit_mean=True, nterms=1)","id":9009,"name":"periodic_fit","nodeType":"Function","startLoc":56,"text":"def periodic_fit(t, y, dy, frequency, t_fit,\n                 center_data=True, fit_mean=True, nterms=1):\n    \"\"\"Compute the Lomb-Scargle model fit at a given frequency\n\n    Parameters\n    ----------\n    t, y, dy : float or array-like\n        The times, observations, and uncertainties to fit\n    frequency : float\n        The frequency at which to compute the model\n    t_fit : float or array-like\n        The times at which the fit should be computed\n    center_data : bool (default=True)\n        If True, center the input data before applying the fit\n    fit_mean : bool (default=True)\n        If True, include the bias as part of the model\n    nterms : int (default=1)\n        The number of Fourier terms to include in the fit\n\n    Returns\n    -------\n    y_fit : ndarray\n        The model fit evaluated at each value of t_fit\n    \"\"\"\n    t, y, frequency = map(np.asarray, (t, y, frequency))\n    if dy is None:\n        dy = np.ones_like(y)\n    else:\n        dy = np.asarray(dy)\n\n    t_fit = np.asarray(t_fit)\n\n    if t.ndim != 1:\n        raise ValueError(\"t, y, dy should be one dimensional\")\n    if t_fit.ndim != 1:\n        raise ValueError(\"t_fit should be one dimensional\")\n    if frequency.ndim != 0:\n        raise ValueError(\"frequency should be a scalar\")\n\n    if center_data:\n        w = dy ** -2.0\n        y_mean = np.dot(y, w) / w.sum()\n        y = (y - y_mean)\n    else:\n        y_mean = 0\n\n    X = design_matrix(t, frequency, dy=dy, bias=fit_mean, nterms=nterms)\n    theta_MLE = np.linalg.solve(np.dot(X.T, X),\n                                np.dot(X.T, y / dy))\n\n    X_fit = design_matrix(t_fit, frequency, bias=fit_mean, nterms=nterms)\n\n    return y_mean + np.dot(X_fit, theta_MLE)"},{"col":4,"comment":"null","endLoc":1802,"header":"@property\n    def value(self)","id":9010,"name":"value","nodeType":"Function","startLoc":1795,"text":"@property\n    def value(self):\n        jd_to_epoch = getattr(erfa, self.jd_to_epoch)\n        years = jd_to_epoch(self.jd1, self.jd2)\n        # Use old-style format since it is a factor of 2 faster\n        str_fmt = self.epoch_prefix + '%.' + str(self.precision) + 'f'\n        outs = [str_fmt % year for year in years.flat]\n        return np.array(outs).reshape(self.jd1.shape)"},{"col":4,"comment":"\n        Add a key, data pair.\n        ","endLoc":201,"header":"def add(self, key, data=None)","id":9011,"name":"add","nodeType":"Function","startLoc":172,"text":"def add(self, key, data=None):\n        '''\n        Add a key, data pair.\n        '''\n        if data is None:\n            data = key\n\n        self.size += 1\n        node = self.NodeClass(key, data)\n        curr_node = self.root\n        if curr_node is None:\n            self.root = node\n            return\n        while True:\n            if node < curr_node:\n                if curr_node.left is None:\n                    curr_node.left = node\n                    break\n                curr_node = curr_node.left\n            elif node > curr_node:\n                if curr_node.right is None:\n                    curr_node.right = node\n                    break\n                curr_node = curr_node.right\n            elif self.unique:\n                raise ValueError(\"Cannot insert non-unique value\")\n            else:  # add data to node\n                curr_node.data.extend(node.data)\n                curr_node.data = sorted(curr_node.data)\n                return"},{"attributeType":"null","col":4,"comment":"null","endLoc":1769,"id":9012,"name":"_default_scale","nodeType":"Attribute","startLoc":1769,"text":"_default_scale"},{"attributeType":"null","col":8,"comment":"null","endLoc":1793,"id":9013,"name":"jd1","nodeType":"Attribute","startLoc":1793,"text":"self.jd1"},{"attributeType":"null","col":18,"comment":"null","endLoc":1793,"id":9014,"name":"jd2","nodeType":"Attribute","startLoc":1793,"text":"self.jd2"},{"className":"TimeBesselianEpochString","col":0,"comment":"Besselian Epoch year as string value(s) like 'B1950.0'","endLoc":1810,"id":9015,"nodeType":"Class","startLoc":1805,"text":"class TimeBesselianEpochString(TimeEpochDateString):\n    \"\"\"Besselian Epoch year as string value(s) like 'B1950.0'\"\"\"\n    name = 'byear_str'\n    epoch_to_jd = 'epb2jd'\n    jd_to_epoch = 'epb'\n    epoch_prefix = 'B'"},{"attributeType":"null","col":4,"comment":"null","endLoc":1807,"id":9016,"name":"name","nodeType":"Attribute","startLoc":1807,"text":"name"},{"col":0,"comment":"Compute the Lomb-Scargle design matrix at the given frequency\n\n    This is the matrix X such that the periodic model at the given frequency\n    can be expressed :math:`\\hat{y} = X \\theta`.\n\n    Parameters\n    ----------\n    t : array-like, shape=(n_times,)\n        times at which to compute the design matrix\n    frequency : float\n        frequency for the design matrix\n    dy : float or array-like, optional\n        data uncertainties: should be broadcastable with `t`\n    bias : bool (default=True)\n        If true, include a bias column in the matrix\n    nterms : int (default=1)\n        Number of Fourier terms to include in the model\n\n    Returns\n    -------\n    X : ndarray, shape=(n_times, n_parameters)\n        The design matrix, where n_parameters = bool(bias) + 2 * nterms\n    ","endLoc":53,"header":"def design_matrix(t, frequency, dy=None, bias=True, nterms=1)","id":9017,"name":"design_matrix","nodeType":"Function","startLoc":5,"text":"def design_matrix(t, frequency, dy=None, bias=True, nterms=1):\n    \"\"\"Compute the Lomb-Scargle design matrix at the given frequency\n\n    This is the matrix X such that the periodic model at the given frequency\n    can be expressed :math:`\\\\hat{y} = X \\\\theta`.\n\n    Parameters\n    ----------\n    t : array-like, shape=(n_times,)\n        times at which to compute the design matrix\n    frequency : float\n        frequency for the design matrix\n    dy : float or array-like, optional\n        data uncertainties: should be broadcastable with `t`\n    bias : bool (default=True)\n        If true, include a bias column in the matrix\n    nterms : int (default=1)\n        Number of Fourier terms to include in the model\n\n    Returns\n    -------\n    X : ndarray, shape=(n_times, n_parameters)\n        The design matrix, where n_parameters = bool(bias) + 2 * nterms\n    \"\"\"\n    t = np.asarray(t)\n    frequency = np.asarray(frequency)\n\n    if t.ndim != 1:\n        raise ValueError(\"t should be one dimensional\")\n    if frequency.ndim != 0:\n        raise ValueError(\"frequency must be a scalar\")\n\n    if nterms == 0 and not bias:\n        raise ValueError(\"cannot have nterms=0 and no bias\")\n\n    if bias:\n        cols = [np.ones_like(t)]\n    else:\n        cols = []\n\n    for i in range(1, nterms + 1):\n        cols.append(np.sin(2 * np.pi * i * frequency * t))\n        cols.append(np.cos(2 * np.pi * i * frequency * t))\n    XT = np.vstack(cols)\n\n    if dy is not None:\n        XT /= dy\n\n    return np.transpose(XT)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1808,"id":9018,"name":"epoch_to_jd","nodeType":"Attribute","startLoc":1808,"text":"epoch_to_jd"},{"attributeType":"null","col":4,"comment":"null","endLoc":1809,"id":9019,"name":"jd_to_epoch","nodeType":"Attribute","startLoc":1809,"text":"jd_to_epoch"},{"attributeType":"null","col":4,"comment":"null","endLoc":1810,"id":9020,"name":"epoch_prefix","nodeType":"Attribute","startLoc":1810,"text":"epoch_prefix"},{"className":"TimeJulianEpochString","col":0,"comment":"Julian Epoch year as string value(s) like 'J2000.0'","endLoc":1818,"id":9021,"nodeType":"Class","startLoc":1813,"text":"class TimeJulianEpochString(TimeEpochDateString):\n    \"\"\"Julian Epoch year as string value(s) like 'J2000.0'\"\"\"\n    name = 'jyear_str'\n    epoch_to_jd = 'epj2jd'\n    jd_to_epoch = 'epj'\n    epoch_prefix = 'J'"},{"attributeType":"null","col":4,"comment":"null","endLoc":1815,"id":9022,"name":"name","nodeType":"Attribute","startLoc":1815,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1816,"id":9023,"name":"epoch_to_jd","nodeType":"Attribute","startLoc":1816,"text":"epoch_to_jd"},{"attributeType":"null","col":4,"comment":"null","endLoc":1817,"id":9024,"name":"jd_to_epoch","nodeType":"Attribute","startLoc":1817,"text":"jd_to_epoch"},{"attributeType":"null","col":4,"comment":"null","endLoc":1818,"id":9025,"name":"epoch_prefix","nodeType":"Attribute","startLoc":1818,"text":"epoch_prefix"},{"col":4,"comment":"\n        Sigma clip the data when ``axis`` or ``grow`` is specified.\n\n        In this case, we replace clipped values with NaNs as placeholder\n        values.\n        ","endLoc":538,"header":"def _sigmaclip_withaxis(self, data, axis=None, masked=True,\n                            return_bounds=False, copy=True)","id":9026,"name":"_sigmaclip_withaxis","nodeType":"Function","startLoc":443,"text":"def _sigmaclip_withaxis(self, data, axis=None, masked=True,\n                            return_bounds=False, copy=True):\n        \"\"\"\n        Sigma clip the data when ``axis`` or ``grow`` is specified.\n\n        In this case, we replace clipped values with NaNs as placeholder\n        values.\n        \"\"\"\n        # float array type is needed to insert nans into the array\n        filtered_data = data.astype(float)    # also makes a copy\n\n        # remove invalid values\n        bad_mask = ~np.isfinite(filtered_data)\n        if np.any(bad_mask):\n            filtered_data[bad_mask] = np.nan\n            warnings.warn('Input data contains invalid values (NaNs or '\n                          'infs), which were automatically clipped.',\n                          AstropyUserWarning)\n\n        # remove masked values and convert to plain ndarray\n        if isinstance(filtered_data, np.ma.MaskedArray):\n            filtered_data = np.ma.masked_invalid(filtered_data).astype(float)\n            filtered_data = filtered_data.filled(np.nan)\n\n        if axis is not None:\n            # convert negative axis/axes\n            if not isiterable(axis):\n                axis = (axis,)\n            axis = tuple(filtered_data.ndim + n if n < 0 else n for n in axis)\n\n            # define the shape of min/max arrays so that they can be broadcast\n            # with the data\n            mshape = tuple(1 if dim in axis else size\n                           for dim, size in enumerate(filtered_data.shape))\n\n        if self.grow:\n            # Construct a growth kernel from the specified radius in\n            # pixels (consider caching this for re-use by subsequent\n            # calls?):\n            cenidx = int(self.grow)\n            size = 2 * cenidx + 1\n            indices = np.mgrid[(slice(0, size),) * data.ndim]\n            if axis is not None:\n                for n, dim in enumerate(indices):\n                    # For any axes that we're not clipping over, set\n                    # their indices outside the growth radius, so masked\n                    # points won't \"grow\" in that dimension:\n                    if n not in axis:\n                        dim[dim != cenidx] = size\n            kernel = (sum(((idx - cenidx)**2 for idx in indices))\n                      <= self.grow**2)\n            del indices\n\n        nchanged = 1\n        iteration = 0\n        while nchanged != 0 and (iteration < self.maxiters):\n            iteration += 1\n            self._compute_bounds(filtered_data, axis=axis)\n            if not np.isscalar(self._min_value):\n                self._min_value = self._min_value.reshape(mshape)\n                self._max_value = self._max_value.reshape(mshape)\n\n            with np.errstate(invalid='ignore'):\n                # Since these comparisons are always False for NaNs, the\n                # resulting mask contains only newly-rejected pixels and\n                # we can dilate it without growing masked pixels more\n                # than once.\n                new_mask = ((filtered_data < self._min_value)\n                            | (filtered_data > self._max_value))\n            if self.grow:\n                new_mask = self._binary_dilation(new_mask, kernel)\n            filtered_data[new_mask] = np.nan\n            nchanged = np.count_nonzero(new_mask)\n            del new_mask\n\n        self._niterations = iteration\n\n        if masked:\n            # create an output masked array\n            if copy:\n                filtered_data = np.ma.MaskedArray(data,\n                                                  ~np.isfinite(filtered_data),\n                                                  copy=True)\n            else:\n                # ignore RuntimeWarnings for comparisons with NaN data values\n                with np.errstate(invalid='ignore'):\n                    out = np.ma.masked_invalid(data, copy=False)\n\n                    filtered_data = np.ma.masked_where(np.logical_or(\n                        out < self._min_value, out > self._max_value),\n                        out, copy=False)\n\n        if return_bounds:\n            return filtered_data, self._min_value, self._max_value\n        else:\n            return filtered_data"},{"className":"TimeDeltaFormat","col":0,"comment":"Base class for time delta representations","endLoc":1835,"id":9027,"nodeType":"Class","startLoc":1821,"text":"class TimeDeltaFormat(TimeFormat):\n    \"\"\"Base class for time delta representations\"\"\"\n\n    _registry = TIME_DELTA_FORMATS\n\n    def _check_scale(self, scale):\n        \"\"\"\n        Check that the scale is in the allowed list of scales, or is `None`\n        \"\"\"\n        if scale is not None and scale not in TIME_DELTA_SCALES:\n            raise ScaleValueError(\"Scale value '{}' not in \"\n                                  \"allowed values {}\"\n                                  .format(scale, TIME_DELTA_SCALES))\n\n        return scale"},{"col":4,"comment":"\n        Check that the scale is in the allowed list of scales, or is `None`\n        ","endLoc":1835,"header":"def _check_scale(self, scale)","id":9028,"name":"_check_scale","nodeType":"Function","startLoc":1826,"text":"def _check_scale(self, scale):\n        \"\"\"\n        Check that the scale is in the allowed list of scales, or is `None`\n        \"\"\"\n        if scale is not None and scale not in TIME_DELTA_SCALES:\n            raise ScaleValueError(\"Scale value '{}' not in \"\n                                  \"allowed values {}\"\n                                  .format(scale, TIME_DELTA_SCALES))\n\n        return scale"},{"col":4,"comment":"null","endLoc":801,"header":"def __init__(self, *args)","id":9029,"name":"__init__","nodeType":"Function","startLoc":796,"text":"def __init__(self, *args):\n        super().__init__(zip(\n            (\"objective\", \"period\", \"power\", \"depth\", \"depth_err\",\n             \"duration\", \"transit_time\", \"depth_snr\", \"log_likelihood\"),\n            args\n        ))"},{"col":4,"comment":"\n        Convert the provided times (if absolute) to relative times using the\n        current _tstart value. If the times provided are relative, they are\n        returned without conversion (though we still do some checks).\n        ","endLoc":357,"header":"def _as_relative_time(self, name, times)","id":9030,"name":"_as_relative_time","nodeType":"Function","startLoc":332,"text":"def _as_relative_time(self, name, times):\n        \"\"\"\n        Convert the provided times (if absolute) to relative times using the\n        current _tstart value. If the times provided are relative, they are\n        returned without conversion (though we still do some checks).\n        \"\"\"\n\n        if isinstance(times, TimeDelta):\n            times = times.to('day')\n\n        if self._tstart is None:\n            if isinstance(times, Time):\n                raise TypeError('{} was provided as an absolute time but '\n                                'the BoxLeastSquares class was initialized '\n                                'with relative times.'.format(name))\n        else:\n            if isinstance(times, Time):\n                times = (times - self._tstart).to(u.day)\n            else:\n                raise TypeError('{} was provided as a relative time but '\n                                'the BoxLeastSquares class was initialized '\n                                'with absolute times.'.format(name))\n\n        times = validate_unit_consistency(self._trel, times)\n\n        return times"},{"col":4,"comment":"null","endLoc":65,"header":"def __setitem__(self, item, val)","id":9031,"name":"__setitem__","nodeType":"Function","startLoc":61,"text":"def __setitem__(self, item, val):\n        if self._table._is_list_or_tuple_of_str(item):\n            self._table._set_row(self._index, colnames=item, vals=val)\n        else:\n            self._table.columns[item][self._index] = val"},{"attributeType":"null","col":4,"comment":"null","endLoc":1824,"id":9032,"name":"_registry","nodeType":"Attribute","startLoc":1824,"text":"_registry"},{"col":0,"comment":"null","endLoc":19,"header":"def get_unit(obj)","id":9033,"name":"get_unit","nodeType":"Function","startLoc":18,"text":"def get_unit(obj):\n    return getattr(obj, 'unit', 1)"},{"col":4,"comment":"Return the offset of the model\n\n        The offset of the model is the (weighted) mean of the y values.\n        Note that if self.center_data is False, the offset is 0 by definition.\n\n        Returns\n        -------\n        offset : scalar\n\n        See Also\n        --------\n        design_matrix\n        model\n        model_parameters\n        ","endLoc":454,"header":"def offset(self)","id":9034,"name":"offset","nodeType":"Function","startLoc":429,"text":"def offset(self):\n        \"\"\"Return the offset of the model\n\n        The offset of the model is the (weighted) mean of the y values.\n        Note that if self.center_data is False, the offset is 0 by definition.\n\n        Returns\n        -------\n        offset : scalar\n\n        See Also\n        --------\n        design_matrix\n        model\n        model_parameters\n        \"\"\"\n        y, dy = strip_units(self.y, self.dy)\n        if dy is None:\n            dy = 1\n        dy = np.broadcast_to(dy, y.shape)\n        if self.center_data:\n            w = dy ** -2.0\n            y_mean = np.dot(y, w) / w.sum()\n        else:\n            y_mean = 0\n        return y_mean * get_unit(self.y)"},{"className":"TimeDeltaNumeric","col":0,"comment":"null","endLoc":1852,"id":9035,"nodeType":"Class","startLoc":1838,"text":"class TimeDeltaNumeric(TimeDeltaFormat, TimeNumeric):\n\n    def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # Validate scale.\n        self.jd1, self.jd2 = day_frac(val1, val2, divisor=1. / self.unit)\n\n    def to_value(self, **kwargs):\n        # Note that 1/unit is always exactly representable, so the\n        # following multiplications are exact.\n        factor = 1. / self.unit\n        jd1 = self.jd1 * factor\n        jd2 = self.jd2 * factor\n        return super().to_value(jd1=jd1, jd2=jd2, **kwargs)\n\n    value = property(to_value)"},{"col":4,"comment":"null","endLoc":1842,"header":"def set_jds(self, val1, val2)","id":9036,"name":"set_jds","nodeType":"Function","startLoc":1840,"text":"def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # Validate scale.\n        self.jd1, self.jd2 = day_frac(val1, val2, divisor=1. / self.unit)"},{"col":4,"comment":"Compute the transit model at the given period, duration, and phase\n\n        Parameters\n        ----------\n        t_model : array-like, `~astropy.units.Quantity`, or `~astropy.time.Time`\n            Times at which to compute the model.\n        period : float or `~astropy.units.Quantity` ['time']\n            The period of the transits.\n        duration : float or `~astropy.units.Quantity` ['time']\n            The duration of the transit.\n        transit_time : float or `~astropy.units.Quantity` or `~astropy.time.Time`\n            The mid-transit time of a reference transit.\n\n        Returns\n        -------\n        y_model : array-like or `~astropy.units.Quantity`\n            The model evaluated at the times ``t_model`` with units of ``y``.\n\n        ","endLoc":425,"header":"def model(self, t_model, period, duration, transit_time)","id":9037,"name":"model","nodeType":"Function","startLoc":375,"text":"def model(self, t_model, period, duration, transit_time):\n        \"\"\"Compute the transit model at the given period, duration, and phase\n\n        Parameters\n        ----------\n        t_model : array-like, `~astropy.units.Quantity`, or `~astropy.time.Time`\n            Times at which to compute the model.\n        period : float or `~astropy.units.Quantity` ['time']\n            The period of the transits.\n        duration : float or `~astropy.units.Quantity` ['time']\n            The duration of the transit.\n        transit_time : float or `~astropy.units.Quantity` or `~astropy.time.Time`\n            The mid-transit time of a reference transit.\n\n        Returns\n        -------\n        y_model : array-like or `~astropy.units.Quantity`\n            The model evaluated at the times ``t_model`` with units of ``y``.\n\n        \"\"\"\n\n        period, duration = self._validate_period_and_duration(period, duration)\n\n        transit_time = self._as_relative_time('transit_time', transit_time)\n        t_model = strip_units(self._as_relative_time('t_model', t_model))\n\n        period = float(strip_units(period))\n        duration = float(strip_units(duration))\n        transit_time = float(strip_units(transit_time))\n\n        t = np.ascontiguousarray(strip_units(self._trel), dtype=np.float64)\n        y = np.ascontiguousarray(strip_units(self.y), dtype=np.float64)\n        if self.dy is None:\n            ivar = np.ones_like(y)\n        else:\n            ivar = 1.0 / np.ascontiguousarray(strip_units(self.dy),\n                                              dtype=np.float64)**2\n\n        # Compute the depth\n        hp = 0.5*period\n        m_in = np.abs((t-transit_time+hp) % period - hp) < 0.5*duration\n        m_out = ~m_in\n        y_in = np.sum(y[m_in] * ivar[m_in]) / np.sum(ivar[m_in])\n        y_out = np.sum(y[m_out] * ivar[m_out]) / np.sum(ivar[m_out])\n\n        # Evaluate the model\n        y_model = y_out + np.zeros_like(t_model)\n        m_model = np.abs((t_model-transit_time+hp) % period-hp) < 0.5*duration\n        y_model[m_model] = y_in\n\n        return y_model * self._y_unit()"},{"col":4,"comment":"Compute the best-fit model parameters at the given frequency.\n\n        The model described by these parameters is:\n\n        .. math::\n\n            y(t; f, \\vec{\\theta}) = \\theta_0 + \\sum_{n=1}^{\\tt nterms} [\\theta_{2n-1}\\sin(2\\pi n f t) + \\theta_{2n}\\cos(2\\pi n f t)]\n\n        where :math:`\\vec{\\theta}` is the array of parameters returned by this function.\n\n        Parameters\n        ----------\n        frequency : float\n            the frequency for the model\n        units : bool\n            If True (default), return design matrix with data units.\n\n        Returns\n        -------\n        theta : np.ndarray (n_parameters,)\n            The best-fit model parameters at the given frequency.\n\n        See Also\n        --------\n        design_matrix\n        model\n        offset\n        ","endLoc":497,"header":"def model_parameters(self, frequency, units=True)","id":9038,"name":"model_parameters","nodeType":"Function","startLoc":456,"text":"def model_parameters(self, frequency, units=True):\n        r\"\"\"Compute the best-fit model parameters at the given frequency.\n\n        The model described by these parameters is:\n\n        .. math::\n\n            y(t; f, \\vec{\\theta}) = \\theta_0 + \\sum_{n=1}^{\\tt nterms} [\\theta_{2n-1}\\sin(2\\pi n f t) + \\theta_{2n}\\cos(2\\pi n f t)]\n\n        where :math:`\\vec{\\theta}` is the array of parameters returned by this function.\n\n        Parameters\n        ----------\n        frequency : float\n            the frequency for the model\n        units : bool\n            If True (default), return design matrix with data units.\n\n        Returns\n        -------\n        theta : np.ndarray (n_parameters,)\n            The best-fit model parameters at the given frequency.\n\n        See Also\n        --------\n        design_matrix\n        model\n        offset\n        \"\"\"\n        frequency = self._validate_frequency(frequency)\n        t, y, dy = strip_units(self._trel, self.y, self.dy)\n\n        if self.center_data:\n            y = y - strip_units(self.offset())\n\n        dy = np.ones_like(y) if dy is None else np.asarray(dy)\n        X = self.design_matrix(frequency)\n        parameters = np.linalg.solve(np.dot(X.T, X),\n                                     np.dot(X.T, y / dy))\n        if units:\n            parameters = get_unit(self.y) * parameters\n        return parameters"},{"col":4,"comment":"null","endLoc":68,"header":"def _ipython_key_completions_(self)","id":9039,"name":"_ipython_key_completions_","nodeType":"Function","startLoc":67,"text":"def _ipython_key_completions_(self):\n        return self.colnames"},{"col":4,"comment":"null","endLoc":76,"header":"def __eq__(self, other)","id":9040,"name":"__eq__","nodeType":"Function","startLoc":70,"text":"def __eq__(self, other):\n        if self._table.masked:\n            # Sent bug report to numpy-discussion group on 2012-Oct-21, subject:\n            # \"Comparing rows in a structured masked array raises exception\"\n            # No response, so this is still unresolved.\n            raise ValueError('Unable to compare rows for masked table due to numpy.ma bug')\n        return self.as_void() == other"},{"col":4,"comment":"\n        Returns a *read-only* copy of the row values in the form of np.void or\n        np.ma.mvoid objects.  This corresponds to the object types returned for\n        row indexing of a pure numpy structured array or masked array. This\n        method is slow and its use is discouraged when possible.\n\n        Returns\n        -------\n        void_row : ``numpy.void`` or ``numpy.ma.mvoid``\n            Copy of row values.\n            ``numpy.void`` if unmasked, ``numpy.ma.mvoid`` else.\n        ","endLoc":140,"header":"def as_void(self)","id":9041,"name":"as_void","nodeType":"Function","startLoc":118,"text":"def as_void(self):\n        \"\"\"\n        Returns a *read-only* copy of the row values in the form of np.void or\n        np.ma.mvoid objects.  This corresponds to the object types returned for\n        row indexing of a pure numpy structured array or masked array. This\n        method is slow and its use is discouraged when possible.\n\n        Returns\n        -------\n        void_row : ``numpy.void`` or ``numpy.ma.mvoid``\n            Copy of row values.\n            ``numpy.void`` if unmasked, ``numpy.ma.mvoid`` else.\n        \"\"\"\n        index = self._index\n        cols = self._table.columns.values()\n        vals = tuple(np.asarray(col)[index] for col in cols)\n        if self._table.masked:\n            mask = tuple(col.mask[index] if hasattr(col, 'mask') else False\n                         for col in cols)\n            void_row = np.ma.array([vals], mask=[mask], dtype=self.dtype)[0]\n        else:\n            void_row = np.array([vals], dtype=self.dtype)[0]\n        return void_row"},{"col":4,"comment":"Compute the design matrix for a given frequency\n\n        Parameters\n        ----------\n        frequency : float\n            the frequency for the model\n        t : array-like, `~astropy.units.Quantity`, or `~astropy.time.Time` (optional)\n            Times (length ``n_samples``) at which to compute the model.\n            If not specified, then the times and uncertainties of the input\n            data are used.\n\n        Returns\n        -------\n        X : array\n            The design matrix for the model at the given frequency.\n            This should have a shape of (``len(t)``, ``n_parameters``).\n\n        See Also\n        --------\n        model\n        model_parameters\n        offset\n        ","endLoc":529,"header":"def design_matrix(self, frequency, t=None)","id":9042,"name":"design_matrix","nodeType":"Function","startLoc":499,"text":"def design_matrix(self, frequency, t=None):\n        \"\"\"Compute the design matrix for a given frequency\n\n        Parameters\n        ----------\n        frequency : float\n            the frequency for the model\n        t : array-like, `~astropy.units.Quantity`, or `~astropy.time.Time` (optional)\n            Times (length ``n_samples``) at which to compute the model.\n            If not specified, then the times and uncertainties of the input\n            data are used.\n\n        Returns\n        -------\n        X : array\n            The design matrix for the model at the given frequency.\n            This should have a shape of (``len(t)``, ``n_parameters``).\n\n        See Also\n        --------\n        model\n        model_parameters\n        offset\n        \"\"\"\n        if t is None:\n            t, dy = strip_units(self._trel, self.dy)\n        else:\n            t, dy = strip_units(self._validate_t(self._as_relative_time('t', t)), None)\n        return design_matrix(t, frequency, dy,\n                             nterms=self.nterms,\n                             bias=self.fit_mean)"},{"col":4,"comment":"null","endLoc":1850,"header":"def to_value(self, **kwargs)","id":9043,"name":"to_value","nodeType":"Function","startLoc":1844,"text":"def to_value(self, **kwargs):\n        # Note that 1/unit is always exactly representable, so the\n        # following multiplications are exact.\n        factor = 1. / self.unit\n        jd1 = self.jd1 * factor\n        jd2 = self.jd2 * factor\n        return super().to_value(jd1=jd1, jd2=jd2, **kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1852,"id":9044,"name":"value","nodeType":"Attribute","startLoc":1852,"text":"value"},{"attributeType":"null","col":8,"comment":"null","endLoc":1842,"id":9045,"name":"jd1","nodeType":"Attribute","startLoc":1842,"text":"self.jd1"},{"col":4,"comment":"null","endLoc":757,"header":"def _y_unit(self)","id":9046,"name":"_y_unit","nodeType":"Function","startLoc":753,"text":"def _y_unit(self):\n        if has_units(self.y):\n            return self.y.unit\n        else:\n            return 1"},{"col":4,"comment":"Compute descriptive statistics for a given transit model\n\n        These statistics are commonly used for vetting of transit candidates.\n\n        Parameters\n        ----------\n        period : float or `~astropy.units.Quantity` ['time']\n            The period of the transits.\n        duration : float or `~astropy.units.Quantity` ['time']\n            The duration of the transit.\n        transit_time : float or `~astropy.units.Quantity` or `~astropy.time.Time`\n            The mid-transit time of a reference transit.\n\n        Returns\n        -------\n        stats : dict\n            A dictionary containing several descriptive statistics:\n\n            - ``depth``: The depth and uncertainty (as a tuple with two\n                values) on the depth for the fiducial model.\n            - ``depth_odd``: The depth and uncertainty on the depth for a\n                model where the period is twice the fiducial period.\n            - ``depth_even``: The depth and uncertainty on the depth for a\n                model where the period is twice the fiducial period and the\n                phase is offset by one orbital period.\n            - ``depth_half``: The depth and uncertainty for a model with a\n                period of half the fiducial period.\n            - ``depth_phased``: The depth and uncertainty for a model with the\n                fiducial period and the phase offset by half a period.\n            - ``harmonic_amplitude``: The amplitude of the best fit sinusoidal\n                model.\n            - ``harmonic_delta_log_likelihood``: The difference in log\n                likelihood between a sinusoidal model and the transit model.\n                If ``harmonic_delta_log_likelihood`` is greater than zero, the\n                sinusoidal model is preferred.\n            - ``transit_times``: The mid-transit time for each transit in the\n                baseline.\n            - ``per_transit_count``: An array with a count of the number of\n                data points in each unique transit included in the baseline.\n            - ``per_transit_log_likelihood``: An array with the value of the\n                log likelihood for each unique transit included in the\n                baseline.\n\n        ","endLoc":570,"header":"def compute_stats(self, period, duration, transit_time)","id":9047,"name":"compute_stats","nodeType":"Function","startLoc":427,"text":"def compute_stats(self, period, duration, transit_time):\n        \"\"\"Compute descriptive statistics for a given transit model\n\n        These statistics are commonly used for vetting of transit candidates.\n\n        Parameters\n        ----------\n        period : float or `~astropy.units.Quantity` ['time']\n            The period of the transits.\n        duration : float or `~astropy.units.Quantity` ['time']\n            The duration of the transit.\n        transit_time : float or `~astropy.units.Quantity` or `~astropy.time.Time`\n            The mid-transit time of a reference transit.\n\n        Returns\n        -------\n        stats : dict\n            A dictionary containing several descriptive statistics:\n\n            - ``depth``: The depth and uncertainty (as a tuple with two\n                values) on the depth for the fiducial model.\n            - ``depth_odd``: The depth and uncertainty on the depth for a\n                model where the period is twice the fiducial period.\n            - ``depth_even``: The depth and uncertainty on the depth for a\n                model where the period is twice the fiducial period and the\n                phase is offset by one orbital period.\n            - ``depth_half``: The depth and uncertainty for a model with a\n                period of half the fiducial period.\n            - ``depth_phased``: The depth and uncertainty for a model with the\n                fiducial period and the phase offset by half a period.\n            - ``harmonic_amplitude``: The amplitude of the best fit sinusoidal\n                model.\n            - ``harmonic_delta_log_likelihood``: The difference in log\n                likelihood between a sinusoidal model and the transit model.\n                If ``harmonic_delta_log_likelihood`` is greater than zero, the\n                sinusoidal model is preferred.\n            - ``transit_times``: The mid-transit time for each transit in the\n                baseline.\n            - ``per_transit_count``: An array with a count of the number of\n                data points in each unique transit included in the baseline.\n            - ``per_transit_log_likelihood``: An array with the value of the\n                log likelihood for each unique transit included in the\n                baseline.\n\n        \"\"\"\n\n        period, duration = self._validate_period_and_duration(period, duration)\n        transit_time = self._as_relative_time('transit_time', transit_time)\n\n        period = float(strip_units(period))\n        duration = float(strip_units(duration))\n        transit_time = float(strip_units(transit_time))\n\n        t = np.ascontiguousarray(strip_units(self._trel), dtype=np.float64)\n        y = np.ascontiguousarray(strip_units(self.y), dtype=np.float64)\n        if self.dy is None:\n            ivar = np.ones_like(y)\n        else:\n            ivar = 1.0 / np.ascontiguousarray(strip_units(self.dy),\n                                              dtype=np.float64)**2\n\n        # This a helper function that will compute the depth for several\n        # different hypothesized transit models with different parameters\n        def _compute_depth(m, y_out=None, var_out=None):\n            if np.any(m) and (var_out is None or np.isfinite(var_out)):\n                var_m = 1.0 / np.sum(ivar[m])\n                y_m = np.sum(y[m] * ivar[m]) * var_m\n                if y_out is None:\n                    return y_m, var_m\n                return y_out - y_m, np.sqrt(var_m + var_out)\n            return 0.0, np.inf\n\n        # Compute the depth of the fiducial model and the two models at twice\n        # the period\n        hp = 0.5*period\n        m_in = np.abs((t-transit_time+hp) % period - hp) < 0.5*duration\n        m_out = ~m_in\n        m_odd = np.abs((t-transit_time) % (2*period) - period) \\\n            < 0.5*duration\n        m_even = np.abs((t-transit_time+period) % (2*period) - period) \\\n            < 0.5*duration\n\n        y_out, var_out = _compute_depth(m_out)\n        depth = _compute_depth(m_in, y_out, var_out)\n        depth_odd = _compute_depth(m_odd, y_out, var_out)\n        depth_even = _compute_depth(m_even, y_out, var_out)\n        y_in = y_out - depth[0]\n\n        # Compute the depth of the model at a phase of 0.5*period\n        m_phase = np.abs((t-transit_time) % period - hp) < 0.5*duration\n        depth_phase = _compute_depth(m_phase,\n                                     *_compute_depth((~m_phase) & m_out))\n\n        # Compute the depth of a model with a period of 0.5*period\n        m_half = np.abs((t-transit_time+0.25*period) % (0.5*period)\n                        - 0.25*period) < 0.5*duration\n        depth_half = _compute_depth(m_half, *_compute_depth(~m_half))\n\n        # Compute the number of points in each transit\n        transit_id = np.round((t[m_in]-transit_time) / period).astype(int)\n        transit_times = period * np.arange(transit_id.min(),\n                                           transit_id.max()+1) + transit_time\n        unique_ids, unique_counts = np.unique(transit_id,\n                                              return_counts=True)\n        unique_ids -= np.min(transit_id)\n        transit_id -= np.min(transit_id)\n        counts = np.zeros(np.max(transit_id) + 1, dtype=int)\n        counts[unique_ids] = unique_counts\n\n        # Compute the per-transit log likelihood\n        ll = -0.5 * ivar[m_in] * ((y[m_in] - y_in)**2 - (y[m_in] - y_out)**2)\n        lls = np.zeros(len(counts))\n        for i in unique_ids:\n            lls[i] = np.sum(ll[transit_id == i])\n        full_ll = -0.5*np.sum(ivar[m_in] * (y[m_in] - y_in)**2)\n        full_ll -= 0.5*np.sum(ivar[m_out] * (y[m_out] - y_out)**2)\n\n        # Compute the log likelihood of a sine model\n        A = np.vstack((\n            np.sin(2*np.pi*t/period), np.cos(2*np.pi*t/period),\n            np.ones_like(t)\n        )).T\n        w = np.linalg.solve(np.dot(A.T, A * ivar[:, None]),\n                            np.dot(A.T, y * ivar))\n        mod = np.dot(A, w)\n        sin_ll = -0.5*np.sum((y-mod)**2*ivar)\n\n        # Format the results\n        y_unit = self._y_unit()\n        ll_unit = 1\n        if self.dy is None:\n            ll_unit = y_unit * y_unit\n        return dict(\n            transit_times=self._as_absolute_time_if_needed('transit_times', transit_times * self._t_unit()),\n            per_transit_count=counts,\n            per_transit_log_likelihood=lls * ll_unit,\n            depth=(depth[0] * y_unit, depth[1] * y_unit),\n            depth_phased=(depth_phase[0] * y_unit, depth_phase[1] * y_unit),\n            depth_half=(depth_half[0] * y_unit, depth_half[1] * y_unit),\n            depth_odd=(depth_odd[0] * y_unit, depth_odd[1] * y_unit),\n            depth_even=(depth_even[0] * y_unit, depth_even[1] * y_unit),\n            harmonic_amplitude=np.sqrt(np.sum(w[:2]**2)) * y_unit,\n            harmonic_delta_log_likelihood=(sin_ll - full_ll) * ll_unit,\n        )"},{"attributeType":"null","col":18,"comment":"null","endLoc":1842,"id":9048,"name":"jd2","nodeType":"Attribute","startLoc":1842,"text":"self.jd2"},{"className":"TimeDeltaSec","col":0,"comment":"Time delta in SI seconds","endLoc":1858,"id":9049,"nodeType":"Class","startLoc":1855,"text":"class TimeDeltaSec(TimeDeltaNumeric):\n    \"\"\"Time delta in SI seconds\"\"\"\n    name = 'sec'\n    unit = 1. / erfa.DAYSEC  # for quantity input"},{"attributeType":"null","col":4,"comment":"null","endLoc":1857,"id":9050,"name":"name","nodeType":"Attribute","startLoc":1857,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1858,"id":9051,"name":"unit","nodeType":"Attribute","startLoc":1858,"text":"unit"},{"col":4,"comment":"null","endLoc":81,"header":"def __ne__(self, other)","id":9052,"name":"__ne__","nodeType":"Function","startLoc":78,"text":"def __ne__(self, other):\n        if self._table.masked:\n            raise ValueError('Unable to compare rows for masked table due to numpy.ma bug')\n        return self.as_void() != other"},{"className":"TimeDeltaJD","col":0,"comment":"Time delta in Julian days (86400 SI seconds)","endLoc":1864,"id":9053,"nodeType":"Class","startLoc":1861,"text":"class TimeDeltaJD(TimeDeltaNumeric):\n    \"\"\"Time delta in Julian days (86400 SI seconds)\"\"\"\n    name = 'jd'\n    unit = 1."},{"col":4,"comment":"Expected periodogram distribution under the null hypothesis.\n\n        This computes the expected probability distribution or cumulative\n        probability distribution of periodogram power, under the null\n        hypothesis of a non-varying signal with Gaussian noise. Note that\n        this is not the same as the expected distribution of peak values;\n        for that see the ``false_alarm_probability()`` method.\n\n        Parameters\n        ----------\n        power : array-like\n            The periodogram power at which to compute the distribution.\n        cumulative : bool, optional\n            If True, then return the cumulative distribution.\n\n        See Also\n        --------\n        false_alarm_probability\n        false_alarm_level\n\n        Returns\n        -------\n        dist : np.ndarray\n            The probability density or cumulative probability associated with\n            the provided powers.\n        ","endLoc":561,"header":"def distribution(self, power, cumulative=False)","id":9054,"name":"distribution","nodeType":"Function","startLoc":531,"text":"def distribution(self, power, cumulative=False):\n        \"\"\"Expected periodogram distribution under the null hypothesis.\n\n        This computes the expected probability distribution or cumulative\n        probability distribution of periodogram power, under the null\n        hypothesis of a non-varying signal with Gaussian noise. Note that\n        this is not the same as the expected distribution of peak values;\n        for that see the ``false_alarm_probability()`` method.\n\n        Parameters\n        ----------\n        power : array-like\n            The periodogram power at which to compute the distribution.\n        cumulative : bool, optional\n            If True, then return the cumulative distribution.\n\n        See Also\n        --------\n        false_alarm_probability\n        false_alarm_level\n\n        Returns\n        -------\n        dist : np.ndarray\n            The probability density or cumulative probability associated with\n            the provided powers.\n        \"\"\"\n        dH = 1 if self.fit_mean or self.center_data else 0\n        dK = dH + 2 * self.nterms\n        dist = _statistics.cdf_single if cumulative else _statistics.pdf_single\n        return dist(power, len(self._trel), self.normalization, dH=dH, dK=dK)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1863,"id":9055,"name":"name","nodeType":"Attribute","startLoc":1863,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1864,"id":9056,"name":"unit","nodeType":"Attribute","startLoc":1864,"text":"unit"},{"className":"TimeDeltaDatetime","col":0,"comment":"Time delta in datetime.timedelta","endLoc":1905,"id":9057,"nodeType":"Class","startLoc":1867,"text":"class TimeDeltaDatetime(TimeDeltaFormat, TimeUnique):\n    \"\"\"Time delta in datetime.timedelta\"\"\"\n    name = 'datetime'\n\n    def _check_val_type(self, val1, val2):\n        if not all(isinstance(val, datetime.timedelta) for val in val1.flat):\n            raise TypeError('Input values for {} class must be '\n                            'datetime.timedelta objects'.format(self.name))\n        if val2 is not None:\n            raise ValueError(\n                f'{self.name} objects do not accept a val2 but you provided {val2}')\n        return val1, None\n\n    def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # Validate scale.\n        iterator = np.nditer([val1, None, None],\n                             flags=['refs_ok', 'zerosize_ok'],\n                             op_dtypes=[None, np.double, np.double])\n\n        day = datetime.timedelta(days=1)\n        for val, jd1, jd2 in iterator:\n            jd1[...], other = divmod(val.item(), day)\n            jd2[...] = other / day\n\n        self.jd1, self.jd2 = day_frac(iterator.operands[-2],\n                                      iterator.operands[-1])\n\n    @property\n    def value(self):\n        iterator = np.nditer([self.jd1, self.jd2, None],\n                             flags=['refs_ok', 'zerosize_ok'],\n                             op_dtypes=[None, None, object])\n\n        for jd1, jd2, out in iterator:\n            jd1_, jd2_ = day_frac(jd1, jd2)\n            out[...] = datetime.timedelta(days=jd1_,\n                                          microseconds=jd2_ * 86400 * 1e6)\n\n        return self.mask_if_needed(iterator.operands[-1])"},{"col":4,"comment":"Support converting Row to np.array via np.array(table).\n\n        Coercion to a different dtype via np.array(table, dtype) is not\n        supported and will raise a ValueError.\n\n        If the parent table is masked then the mask information is dropped.\n        ","endLoc":94,"header":"def __array__(self, dtype=None)","id":9058,"name":"__array__","nodeType":"Function","startLoc":83,"text":"def __array__(self, dtype=None):\n        \"\"\"Support converting Row to np.array via np.array(table).\n\n        Coercion to a different dtype via np.array(table, dtype) is not\n        supported and will raise a ValueError.\n\n        If the parent table is masked then the mask information is dropped.\n        \"\"\"\n        if dtype is not None:\n            raise ValueError('Datatype coercion is not allowed')\n\n        return np.asarray(self.as_void())"},{"col":4,"comment":"null","endLoc":1878,"header":"def _check_val_type(self, val1, val2)","id":9059,"name":"_check_val_type","nodeType":"Function","startLoc":1871,"text":"def _check_val_type(self, val1, val2):\n        if not all(isinstance(val, datetime.timedelta) for val in val1.flat):\n            raise TypeError('Input values for {} class must be '\n                            'datetime.timedelta objects'.format(self.name))\n        if val2 is not None:\n            raise ValueError(\n                f'{self.name} objects do not accept a val2 but you provided {val2}')\n        return val1, None"},{"col":4,"comment":"False alarm probability of periodogram maxima under the null hypothesis.\n\n        This gives an estimate of the false alarm probability given the height\n        of the largest peak in the periodogram, based on the null hypothesis\n        of non-varying data with Gaussian noise.\n\n        Parameters\n        ----------\n        power : array-like\n            The periodogram value.\n        method : {'baluev', 'davies', 'naive', 'bootstrap'}, optional\n            The approximation method to use.\n        maximum_frequency : float\n            The maximum frequency of the periodogram.\n        method_kwds : dict, optional\n            Additional method-specific keywords.\n\n        Returns\n        -------\n        false_alarm_probability : np.ndarray\n            The false alarm probability\n\n        Notes\n        -----\n        The true probability distribution for the largest peak cannot be\n        determined analytically, so each method here provides an approximation\n        to the value. The available methods are:\n\n        - \"baluev\" (default): the upper-limit to the alias-free probability,\n          using the approach of Baluev (2008) [1]_.\n        - \"davies\" : the Davies upper bound from Baluev (2008) [1]_.\n        - \"naive\" : the approximate probability based on an estimated\n          effective number of independent frequencies.\n        - \"bootstrap\" : the approximate probability based on bootstrap\n          resamplings of the input data.\n\n        Note also that for normalization='psd', the distribution can only be\n        computed for periodograms constructed with errors specified.\n\n        See Also\n        --------\n        distribution\n        false_alarm_level\n\n        References\n        ----------\n        .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n        ","endLoc":632,"header":"def false_alarm_probability(self, power, method='baluev',\n                                samples_per_peak=5, nyquist_factor=5,\n                                minimum_frequency=None, maximum_frequency=None,\n                                method_kwds=None)","id":9060,"name":"false_alarm_probability","nodeType":"Function","startLoc":563,"text":"def false_alarm_probability(self, power, method='baluev',\n                                samples_per_peak=5, nyquist_factor=5,\n                                minimum_frequency=None, maximum_frequency=None,\n                                method_kwds=None):\n        \"\"\"False alarm probability of periodogram maxima under the null hypothesis.\n\n        This gives an estimate of the false alarm probability given the height\n        of the largest peak in the periodogram, based on the null hypothesis\n        of non-varying data with Gaussian noise.\n\n        Parameters\n        ----------\n        power : array-like\n            The periodogram value.\n        method : {'baluev', 'davies', 'naive', 'bootstrap'}, optional\n            The approximation method to use.\n        maximum_frequency : float\n            The maximum frequency of the periodogram.\n        method_kwds : dict, optional\n            Additional method-specific keywords.\n\n        Returns\n        -------\n        false_alarm_probability : np.ndarray\n            The false alarm probability\n\n        Notes\n        -----\n        The true probability distribution for the largest peak cannot be\n        determined analytically, so each method here provides an approximation\n        to the value. The available methods are:\n\n        - \"baluev\" (default): the upper-limit to the alias-free probability,\n          using the approach of Baluev (2008) [1]_.\n        - \"davies\" : the Davies upper bound from Baluev (2008) [1]_.\n        - \"naive\" : the approximate probability based on an estimated\n          effective number of independent frequencies.\n        - \"bootstrap\" : the approximate probability based on bootstrap\n          resamplings of the input data.\n\n        Note also that for normalization='psd', the distribution can only be\n        computed for periodograms constructed with errors specified.\n\n        See Also\n        --------\n        distribution\n        false_alarm_level\n\n        References\n        ----------\n        .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n        \"\"\"\n        if self.nterms != 1:\n            raise NotImplementedError(\"false alarm probability is not \"\n                                      \"implemented for multiterm periodograms.\")\n        if not (self.fit_mean or self.center_data):\n            raise NotImplementedError(\"false alarm probability is implemented \"\n                                      \"only for periodograms of centered data.\")\n\n        fmin, fmax = self.autofrequency(samples_per_peak=samples_per_peak,\n                                        nyquist_factor=nyquist_factor,\n                                        minimum_frequency=minimum_frequency,\n                                        maximum_frequency=maximum_frequency,\n                                        return_freq_limits=True)\n        return _statistics.false_alarm_probability(power,\n                                                   fmax=fmax,\n                                                   t=self._trel, y=self.y, dy=self.dy,\n                                                   normalization=self.normalization,\n                                                   method=method,\n                                                   method_kwds=method_kwds)"},{"col":4,"comment":"null","endLoc":1892,"header":"def set_jds(self, val1, val2)","id":9061,"name":"set_jds","nodeType":"Function","startLoc":1880,"text":"def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # Validate scale.\n        iterator = np.nditer([val1, None, None],\n                             flags=['refs_ok', 'zerosize_ok'],\n                             op_dtypes=[None, np.double, np.double])\n\n        day = datetime.timedelta(days=1)\n        for val, jd1, jd2 in iterator:\n            jd1[...], other = divmod(val.item(), day)\n            jd2[...] = other / day\n\n        self.jd1, self.jd2 = day_frac(iterator.operands[-2],\n                                      iterator.operands[-1])"},{"col":4,"comment":"null","endLoc":97,"header":"def __len__(self)","id":9062,"name":"__len__","nodeType":"Function","startLoc":96,"text":"def __len__(self):\n        return len(self._table.columns)"},{"col":4,"comment":"null","endLoc":102,"header":"def __iter__(self)","id":9063,"name":"__iter__","nodeType":"Function","startLoc":99,"text":"def __iter__(self):\n        index = self._index\n        for col in self._table.columns.values():\n            yield col[index]"},{"col":4,"comment":"null","endLoc":105,"header":"def keys(self)","id":9064,"name":"keys","nodeType":"Function","startLoc":104,"text":"def keys(self):\n        return self._table.columns.keys()"},{"col":0,"comment":"Compute the approximate false alarm probability for periodogram peaks Z\n\n    This gives an estimate of the false alarm probability for the largest value\n    in a periodogram, based on the null hypothesis of non-varying data with\n    Gaussian noise. The true probability cannot be computed analytically, so\n    each method available here is an approximation to the true value.\n\n    Parameters\n    ----------\n    Z : array-like\n        The periodogram value.\n    fmax : float\n        The maximum frequency of the periodogram.\n    t, y, dy : array-like\n        The data times, values, and errors.\n    normalization : {'standard', 'model', 'log', 'psd'}, optional\n        The periodogram normalization.\n    method : {'baluev', 'davies', 'naive', 'bootstrap'}, optional\n        The approximation method to use.\n    method_kwds : dict, optional\n        Additional method-specific keywords.\n\n    Returns\n    -------\n    false_alarm_probability : np.ndarray\n        The false alarm probability.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n\n    See Also\n    --------\n    false_alarm_level : compute the periodogram level for a particular fap\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    ","endLoc":433,"header":"def false_alarm_probability(Z, fmax, t, y, dy, normalization='standard',\n                            method='baluev', method_kwds=None)","id":9065,"name":"false_alarm_probability","nodeType":"Function","startLoc":384,"text":"def false_alarm_probability(Z, fmax, t, y, dy, normalization='standard',\n                            method='baluev', method_kwds=None):\n    \"\"\"Compute the approximate false alarm probability for periodogram peaks Z\n\n    This gives an estimate of the false alarm probability for the largest value\n    in a periodogram, based on the null hypothesis of non-varying data with\n    Gaussian noise. The true probability cannot be computed analytically, so\n    each method available here is an approximation to the true value.\n\n    Parameters\n    ----------\n    Z : array-like\n        The periodogram value.\n    fmax : float\n        The maximum frequency of the periodogram.\n    t, y, dy : array-like\n        The data times, values, and errors.\n    normalization : {'standard', 'model', 'log', 'psd'}, optional\n        The periodogram normalization.\n    method : {'baluev', 'davies', 'naive', 'bootstrap'}, optional\n        The approximation method to use.\n    method_kwds : dict, optional\n        Additional method-specific keywords.\n\n    Returns\n    -------\n    false_alarm_probability : np.ndarray\n        The false alarm probability.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n\n    See Also\n    --------\n    false_alarm_level : compute the periodogram level for a particular fap\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    \"\"\"\n    if method == 'single':\n        return fap_single(Z, len(t), normalization)\n    elif method not in METHODS:\n        raise ValueError(f\"Unrecognized method: {method}\")\n    method = METHODS[method]\n    method_kwds = method_kwds or {}\n\n    return method(Z, fmax, t, y, dy, normalization, **method_kwds)"},{"col":4,"comment":"null","endLoc":1905,"header":"@property\n    def value(self)","id":9066,"name":"value","nodeType":"Function","startLoc":1894,"text":"@property\n    def value(self):\n        iterator = np.nditer([self.jd1, self.jd2, None],\n                             flags=['refs_ok', 'zerosize_ok'],\n                             op_dtypes=[None, None, object])\n\n        for jd1, jd2, out in iterator:\n            jd1_, jd2_ = day_frac(jd1, jd2)\n            out[...] = datetime.timedelta(days=jd1_,\n                                          microseconds=jd2_ * 86400 * 1e6)\n\n        return self.mask_if_needed(iterator.operands[-1])"},{"col":4,"comment":"\n        Return all data values corresponding to a given key.\n\n        Parameters\n        ----------\n        key : tuple\n            Input key\n\n        Returns\n        -------\n        data_vals : list\n            List of rows corresponding to the input key\n        ","endLoc":218,"header":"def find(self, key)","id":9067,"name":"find","nodeType":"Function","startLoc":203,"text":"def find(self, key):\n        '''\n        Return all data values corresponding to a given key.\n\n        Parameters\n        ----------\n        key : tuple\n            Input key\n\n        Returns\n        -------\n        data_vals : list\n            List of rows corresponding to the input key\n        '''\n        node, parent = self.find_node(key)\n        return node.data if node is not None else []"},{"col":4,"comment":"null","endLoc":108,"header":"def values(self)","id":9068,"name":"values","nodeType":"Function","startLoc":107,"text":"def values(self):\n        return self.__iter__()"},{"col":4,"comment":"null","endLoc":112,"header":"@property\n    def table(self)","id":9069,"name":"table","nodeType":"Function","startLoc":110,"text":"@property\n    def table(self):\n        return self._table"},{"col":4,"comment":"null","endLoc":116,"header":"@property\n    def index(self)","id":9070,"name":"index","nodeType":"Function","startLoc":114,"text":"@property\n    def index(self):\n        return self._index"},{"col":4,"comment":"null","endLoc":144,"header":"@property\n    def meta(self)","id":9071,"name":"meta","nodeType":"Function","startLoc":142,"text":"@property\n    def meta(self):\n        return self._table.meta"},{"col":4,"comment":"null","endLoc":148,"header":"@property\n    def columns(self)","id":9072,"name":"columns","nodeType":"Function","startLoc":146,"text":"@property\n    def columns(self):\n        return self._table.columns"},{"col":4,"comment":"null","endLoc":152,"header":"@property\n    def colnames(self)","id":9073,"name":"colnames","nodeType":"Function","startLoc":150,"text":"@property\n    def colnames(self):\n        return self._table.colnames"},{"col":4,"comment":"null","endLoc":156,"header":"@property\n    def dtype(self)","id":9074,"name":"dtype","nodeType":"Function","startLoc":154,"text":"@property\n    def dtype(self):\n        return self._table.dtype"},{"col":4,"comment":"\n        Display row as a single-line table but with appropriate header line.\n        ","endLoc":170,"header":"def _base_repr_(self, html=False)","id":9075,"name":"_base_repr_","nodeType":"Function","startLoc":158,"text":"def _base_repr_(self, html=False):\n        \"\"\"\n        Display row as a single-line table but with appropriate header line.\n        \"\"\"\n        index = self.index if (self.index >= 0) else self.index + len(self._table)\n        table = self._table[index:index + 1]\n        descr_vals = [self.__class__.__name__,\n                      f'index={self.index}']\n        if table.masked:\n            descr_vals.append('masked=True')\n\n        return table._base_repr_(html, descr_vals, max_width=-1,\n                                 tableid=f'table{id(self._table)}')"},{"attributeType":"null","col":4,"comment":"null","endLoc":1869,"id":9076,"name":"name","nodeType":"Attribute","startLoc":1869,"text":"name"},{"attributeType":"null","col":8,"comment":"null","endLoc":1891,"id":9077,"name":"jd1","nodeType":"Attribute","startLoc":1891,"text":"self.jd1"},{"col":4,"comment":"null","endLoc":173,"header":"def _repr_html_(self)","id":9078,"name":"_repr_html_","nodeType":"Function","startLoc":172,"text":"def _repr_html_(self):\n        return self._base_repr_(html=True)"},{"attributeType":"null","col":18,"comment":"null","endLoc":1891,"id":9079,"name":"jd2","nodeType":"Attribute","startLoc":1891,"text":"self.jd2"},{"col":4,"comment":"null","endLoc":176,"header":"def __repr__(self)","id":9080,"name":"__repr__","nodeType":"Function","startLoc":175,"text":"def __repr__(self):\n        return self._base_repr_(html=False)"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":9081,"name":"__all__","nodeType":"Attribute","startLoc":23,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":34,"id":9082,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":34,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":3,"header":"formats.py#<anonymous>","id":9083,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['TimeFormat', 'TimeJD', 'TimeMJD', 'TimeFromEpoch', 'TimeUnix',\n           'TimeUnixTai', 'TimeCxcSec', 'TimeGPS', 'TimeDecimalYear',\n           'TimePlotDate', 'TimeUnique', 'TimeDatetime', 'TimeString',\n           'TimeISO', 'TimeISOT', 'TimeFITS', 'TimeYearDayTime',\n           'TimeEpochDate', 'TimeBesselianEpoch', 'TimeJulianEpoch',\n           'TimeDeltaFormat', 'TimeDeltaSec', 'TimeDeltaJD',\n           'TimeEpochDateString', 'TimeBesselianEpochString',\n           'TimeJulianEpochString', 'TIME_FORMATS', 'TIME_DELTA_FORMATS',\n           'TimezoneInfo', 'TimeDeltaDatetime', 'TimeDatetime64', 'TimeYMDHMS',\n           'TimeNumeric', 'TimeDeltaNumeric']\n\n__doctest_skip__ = ['TimePlotDate']\n\nTIME_FORMATS = OrderedDict()\n\nTIME_DELTA_FORMATS = OrderedDict()\n\nFITS_DEPRECATED_SCALES = {'TDT': 'tt', 'ET': 'tt',\n                          'GMT': 'utc', 'UT': 'utc', 'IAT': 'tai'}"},{"col":4,"comment":"null","endLoc":180,"header":"def __str__(self)","id":9084,"name":"__str__","nodeType":"Function","startLoc":178,"text":"def __str__(self):\n        index = self.index if (self.index >= 0) else self.index + len(self._table)\n        return '\\n'.join(self.table[index:index + 1].pformat(max_width=-1))"},{"col":4,"comment":"null","endLoc":183,"header":"def __bytes__(self)","id":9085,"name":"__bytes__","nodeType":"Function","startLoc":182,"text":"def __bytes__(self):\n        return str(self).encode('utf-8')"},{"attributeType":"null","col":8,"comment":"null","endLoc":44,"id":9086,"name":"_table","nodeType":"Attribute","startLoc":44,"text":"self._table"},{"attributeType":"null","col":8,"comment":"null","endLoc":43,"id":9087,"name":"_index","nodeType":"Attribute","startLoc":43,"text":"self._index"},{"col":0,"comment":"Single-frequency false alarm probability for the Lomb-Scargle periodogram\n\n    This is equal to 1 - cdf, where cdf is the cumulative distribution.\n    The single-frequency false alarm probability should not be confused with\n    the false alarm probability for the largest peak.\n\n    Parameters\n    ----------\n    z : array-like\n        The periodogram value.\n    N : int\n        The number of data points from which the periodogram was computed.\n    normalization : {'standard', 'model', 'log', 'psd'}\n        The periodogram normalization.\n    dH, dK : int, optional\n        The number of parameters in the null hypothesis and the model.\n\n    Returns\n    -------\n    false_alarm_probability : np.ndarray\n        The single-frequency false alarm probability.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n    All expressions used here are adapted from Table 1 of Baluev 2008 [1]_.\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    ","endLoc":145,"header":"def fap_single(z, N, normalization, dH=1, dK=3)","id":9088,"name":"fap_single","nodeType":"Function","startLoc":98,"text":"def fap_single(z, N, normalization, dH=1, dK=3):\n    \"\"\"Single-frequency false alarm probability for the Lomb-Scargle periodogram\n\n    This is equal to 1 - cdf, where cdf is the cumulative distribution.\n    The single-frequency false alarm probability should not be confused with\n    the false alarm probability for the largest peak.\n\n    Parameters\n    ----------\n    z : array-like\n        The periodogram value.\n    N : int\n        The number of data points from which the periodogram was computed.\n    normalization : {'standard', 'model', 'log', 'psd'}\n        The periodogram normalization.\n    dH, dK : int, optional\n        The number of parameters in the null hypothesis and the model.\n\n    Returns\n    -------\n    false_alarm_probability : np.ndarray\n        The single-frequency false alarm probability.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n    All expressions used here are adapted from Table 1 of Baluev 2008 [1]_.\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    \"\"\"\n    z = np.asarray(z)\n    if dK - dH != 2:\n        raise NotImplementedError(\"Degrees of freedom != 2\")\n    Nk = N - dK\n\n    if normalization == 'psd':\n        return np.exp(-z)\n    elif normalization == 'standard':\n        return (1 - z) ** (0.5 * Nk)\n    elif normalization == 'model':\n        return (1 + z) ** (-0.5 * Nk)\n    elif normalization == 'log':\n        return np.exp(-0.5 * Nk * z)\n    else:\n        raise ValueError(f\"normalization='{normalization}' is not recognized\")"},{"className":"TableMergeError","col":0,"comment":"null","endLoc":18,"id":9089,"nodeType":"Class","startLoc":17,"text":"class TableMergeError(ValueError):\n    pass"},{"fileName":"table.py","filePath":"astropy/table","id":9090,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom .index import SlicedIndex, TableIndices, TableLoc, TableILoc, TableLocIndices\n\nimport sys\nfrom collections import OrderedDict, defaultdict\nfrom collections.abc import Mapping\nimport warnings\nfrom copy import deepcopy\nimport types\nimport itertools\nimport weakref\n\nimport numpy as np\nfrom numpy import ma\n\nfrom astropy import log\nfrom astropy.units import Quantity, QuantityInfo\nfrom astropy.utils import isiterable, ShapedLikeNDArray\nfrom astropy.utils.console import color_print\nfrom astropy.utils.exceptions import AstropyUserWarning\nfrom astropy.utils.masked import Masked\nfrom astropy.utils.metadata import MetaData, MetaAttribute\nfrom astropy.utils.data_info import BaseColumnInfo, MixinInfo, DataInfo\nfrom astropy.utils.decorators import format_doc\nfrom astropy.io.registry import UnifiedReadWriteMethod\n\nfrom . import groups\nfrom .pprint import TableFormatter\nfrom .column import (BaseColumn, Column, MaskedColumn, _auto_names, FalseArray,\n                     col_copy, _convert_sequence_data_to_array)\nfrom .row import Row\nfrom .info import TableInfo\nfrom .index import Index, _IndexModeContext, get_index\nfrom .connect import TableRead, TableWrite\nfrom .ndarray_mixin import NdarrayMixin\nfrom .mixins.registry import get_mixin_handler\nfrom . import conf\n\n\n_implementation_notes = \"\"\"\nThis string has informal notes concerning Table implementation for developers.\n\nThings to remember:\n\n- Table has customizable attributes ColumnClass, Column, MaskedColumn.\n  Table.Column is normally just column.Column (same w/ MaskedColumn)\n  but in theory they can be different.  Table.ColumnClass is the default\n  class used to create new non-mixin columns, and this is a function of\n  the Table.masked attribute.  Column creation / manipulation in a Table\n  needs to respect these.\n\n- Column objects that get inserted into the Table.columns attribute must\n  have the info.parent_table attribute set correctly.  Beware just dropping\n  an object into the columns dict since an existing column may\n  be part of another Table and have parent_table set to point at that\n  table.  Dropping that column into `columns` of this Table will cause\n  a problem for the old one so the column object needs to be copied (but\n  not necessarily the data).\n\n  Currently replace_column is always making a copy of both object and\n  data if parent_table is set.  This could be improved but requires a\n  generic way to copy a mixin object but not the data.\n\n- Be aware of column objects that have indices set.\n\n- `cls.ColumnClass` is a property that effectively uses the `masked` attribute\n  to choose either `cls.Column` or `cls.MaskedColumn`.\n\"\"\"\n\n__doctest_skip__ = ['Table.read', 'Table.write', 'Table._read',\n                    'Table.convert_bytestring_to_unicode',\n                    'Table.convert_unicode_to_bytestring',\n                    ]\n\n__doctest_requires__ = {'*pandas': ['pandas>=1.1']}\n\n_pprint_docs = \"\"\"\n    {__doc__}\n\n    Parameters\n    ----------\n    max_lines : int or None\n        Maximum number of lines in table output.\n\n    max_width : int or None\n        Maximum character width of output.\n\n    show_name : bool\n        Include a header row for column names. Default is True.\n\n    show_unit : bool\n        Include a header row for unit.  Default is to show a row\n        for units only if one or more columns has a defined value\n        for the unit.\n\n    show_dtype : bool\n        Include a header row for column dtypes. Default is True.\n\n    align : str or list or tuple or None\n        Left/right alignment of columns. Default is right (None) for all\n        columns. Other allowed values are '>', '<', '^', and '0=' for\n        right, left, centered, and 0-padded, respectively. A list of\n        strings can be provided for alignment of tables with multiple\n        columns.\n    \"\"\"\n\n_pformat_docs = \"\"\"\n    {__doc__}\n\n    Parameters\n    ----------\n    max_lines : int or None\n        Maximum number of rows to output\n\n    max_width : int or None\n        Maximum character width of output\n\n    show_name : bool\n        Include a header row for column names. Default is True.\n\n    show_unit : bool\n        Include a header row for unit.  Default is to show a row\n        for units only if one or more columns has a defined value\n        for the unit.\n\n    show_dtype : bool\n        Include a header row for column dtypes. Default is True.\n\n    html : bool\n        Format the output as an HTML table. Default is False.\n\n    tableid : str or None\n        An ID tag for the table; only used if html is set.  Default is\n        \"table{id}\", where id is the unique integer id of the table object,\n        id(self)\n\n    align : str or list or tuple or None\n        Left/right alignment of columns. Default is right (None) for all\n        columns. Other allowed values are '>', '<', '^', and '0=' for\n        right, left, centered, and 0-padded, respectively. A list of\n        strings can be provided for alignment of tables with multiple\n        columns.\n\n    tableclass : str or list of str or None\n        CSS classes for the table; only used if html is set.  Default is\n        None.\n\n    Returns\n    -------\n    lines : list\n        Formatted table as a list of strings.\n    \"\"\"\n\n\nclass TableReplaceWarning(UserWarning):\n    \"\"\"\n    Warning class for cases when a table column is replaced via the\n    Table.__setitem__ syntax e.g. t['a'] = val.\n\n    This does not inherit from AstropyWarning because we want to use\n    stacklevel=3 to show the user where the issue occurred in their code.\n    \"\"\"\n    pass\n\n\ndef descr(col):\n    \"\"\"Array-interface compliant full description of a column.\n\n    This returns a 3-tuple (name, type, shape) that can always be\n    used in a structured array dtype definition.\n    \"\"\"\n    col_dtype = 'O' if (col.info.dtype is None) else col.info.dtype\n    col_shape = col.shape[1:] if hasattr(col, 'shape') else ()\n    return (col.info.name, col_dtype, col_shape)\n\n\ndef has_info_class(obj, cls):\n    \"\"\"Check if the object's info is an instance of cls.\"\"\"\n    # We check info on the class of the instance, since on the instance\n    # itself accessing 'info' has side effects in that it sets\n    # obj.__dict__['info'] if it does not exist already.\n    return isinstance(getattr(obj.__class__, 'info', None), cls)\n\n\ndef _get_names_from_list_of_dict(rows):\n    \"\"\"Return list of column names if ``rows`` is a list of dict that\n    defines table data.\n\n    If rows is not a list of dict then return None.\n    \"\"\"\n    if rows is None:\n        return None\n\n    names = set()\n    for row in rows:\n        if not isinstance(row, Mapping):\n            return None\n        names.update(row)\n    return list(names)\n\n\n# Note to future maintainers: when transitioning this to dict\n# be sure to change the OrderedDict ref(s) in Row and in __len__().\n\nclass TableColumns(OrderedDict):\n    \"\"\"OrderedDict subclass for a set of columns.\n\n    This class enhances item access to provide convenient access to columns\n    by name or index, including slice access.  It also handles renaming\n    of columns.\n\n    The initialization argument ``cols`` can be a list of ``Column`` objects\n    or any structure that is valid for initializing a Python dict.  This\n    includes a dict, list of (key, val) tuples or [key, val] lists, etc.\n\n    Parameters\n    ----------\n    cols : dict, list, tuple; optional\n        Column objects as data structure that can init dict (see above)\n    \"\"\"\n\n    def __init__(self, cols={}):\n        if isinstance(cols, (list, tuple)):\n            # `cols` should be a list of two-tuples, but it is allowed to have\n            # columns (BaseColumn or mixins) in the list.\n            newcols = []\n            for col in cols:\n                if has_info_class(col, BaseColumnInfo):\n                    newcols.append((col.info.name, col))\n                else:\n                    newcols.append(col)\n            cols = newcols\n        super().__init__(cols)\n\n    def __getitem__(self, item):\n        \"\"\"Get items from a TableColumns object.\n        ::\n\n          tc = TableColumns(cols=[Column(name='a'), Column(name='b'), Column(name='c')])\n          tc['a']  # Column('a')\n          tc[1] # Column('b')\n          tc['a', 'b'] # <TableColumns names=('a', 'b')>\n          tc[1:3] # <TableColumns names=('b', 'c')>\n        \"\"\"\n        if isinstance(item, str):\n            return OrderedDict.__getitem__(self, item)\n        elif isinstance(item, (int, np.integer)):\n            return list(self.values())[item]\n        elif (isinstance(item, np.ndarray) and item.shape == () and item.dtype.kind == 'i'):\n            return list(self.values())[item.item()]\n        elif isinstance(item, tuple):\n            return self.__class__([self[x] for x in item])\n        elif isinstance(item, slice):\n            return self.__class__([self[x] for x in list(self)[item]])\n        else:\n            raise IndexError('Illegal key or index value for {} object'\n                             .format(self.__class__.__name__))\n\n    def __setitem__(self, item, value, validated=False):\n        \"\"\"\n        Set item in this dict instance, but do not allow directly replacing an\n        existing column unless it is already validated (and thus is certain to\n        not corrupt the table).\n\n        NOTE: it is easily possible to corrupt a table by directly *adding* a new\n        key to the TableColumns attribute of a Table, e.g.\n        ``t.columns['jane'] = 'doe'``.\n\n        \"\"\"\n        if item in self and not validated:\n            raise ValueError(\"Cannot replace column '{}'.  Use Table.replace_column() instead.\"\n                             .format(item))\n        super().__setitem__(item, value)\n\n    def __repr__(self):\n        names = (f\"'{x}'\" for x in self.keys())\n        return f\"<{self.__class__.__name__} names=({','.join(names)})>\"\n\n    def _rename_column(self, name, new_name):\n        if name == new_name:\n            return\n\n        if new_name in self:\n            raise KeyError(f\"Column {new_name} already exists\")\n\n        # Rename column names in pprint include/exclude attributes as needed\n        parent_table = self[name].info.parent_table\n        if parent_table is not None:\n            parent_table.pprint_exclude_names._rename(name, new_name)\n            parent_table.pprint_include_names._rename(name, new_name)\n\n        mapper = {name: new_name}\n        new_names = [mapper.get(name, name) for name in self]\n        cols = list(self.values())\n        self.clear()\n        self.update(list(zip(new_names, cols)))\n\n    def __delitem__(self, name):\n        # Remove column names from pprint include/exclude attributes as needed.\n        # __delitem__ also gets called for pop() and popitem().\n        parent_table = self[name].info.parent_table\n        if parent_table is not None:\n            # _remove() method does not require that `name` is in the attribute\n            parent_table.pprint_exclude_names._remove(name)\n            parent_table.pprint_include_names._remove(name)\n        return super().__delitem__(name)\n\n    def isinstance(self, cls):\n        \"\"\"\n        Return a list of columns which are instances of the specified classes.\n\n        Parameters\n        ----------\n        cls : class or tuple thereof\n            Column class (including mixin) or tuple of Column classes.\n\n        Returns\n        -------\n        col_list : list of `Column`\n            List of Column objects which are instances of given classes.\n        \"\"\"\n        cols = [col for col in self.values() if isinstance(col, cls)]\n        return cols\n\n    def not_isinstance(self, cls):\n        \"\"\"\n        Return a list of columns which are not instances of the specified classes.\n\n        Parameters\n        ----------\n        cls : class or tuple thereof\n            Column class (including mixin) or tuple of Column classes.\n\n        Returns\n        -------\n        col_list : list of `Column`\n            List of Column objects which are not instances of given classes.\n        \"\"\"\n        cols = [col for col in self.values() if not isinstance(col, cls)]\n        return cols\n\n\nclass TableAttribute(MetaAttribute):\n    \"\"\"\n    Descriptor to define a custom attribute for a Table subclass.\n\n    The value of the ``TableAttribute`` will be stored in a dict named\n    ``__attributes__`` that is stored in the table ``meta``.  The attribute\n    can be accessed and set in the usual way, and it can be provided when\n    creating the object.\n\n    Defining an attribute by this mechanism ensures that it will persist if\n    the table is sliced or serialized, for example as a pickle or ECSV file.\n\n    See the `~astropy.utils.metadata.MetaAttribute` documentation for additional\n    details.\n\n    Parameters\n    ----------\n    default : object\n        Default value for attribute\n\n    Examples\n    --------\n      >>> from astropy.table import Table, TableAttribute\n      >>> class MyTable(Table):\n      ...     identifier = TableAttribute(default=1)\n      >>> t = MyTable(identifier=10)\n      >>> t.identifier\n      10\n      >>> t.meta\n      OrderedDict([('__attributes__', {'identifier': 10})])\n    \"\"\"\n\n\nclass PprintIncludeExclude(TableAttribute):\n    \"\"\"Maintain tuple that controls table column visibility for print output.\n\n    This is a descriptor that inherits from MetaAttribute so that the attribute\n    value is stored in the table meta['__attributes__'].\n\n    This gets used for the ``pprint_include_names`` and ``pprint_exclude_names`` Table\n    attributes.\n    \"\"\"\n    def __get__(self, instance, owner_cls):\n        \"\"\"Get the attribute.\n\n        This normally returns an instance of this class which is stored on the\n        owner object.\n        \"\"\"\n        # For getting from class not an instance\n        if instance is None:\n            return self\n\n        # If not already stored on `instance`, make a copy of the class\n        # descriptor object and put it onto the instance.\n        value = instance.__dict__.get(self.name)\n        if value is None:\n            value = deepcopy(self)\n            instance.__dict__[self.name] = value\n\n        # We set _instance_ref on every call, since if one makes copies of\n        # instances, this attribute will be copied as well, which will lose the\n        # reference.\n        value._instance_ref = weakref.ref(instance)\n        return value\n\n    def __set__(self, instance, names):\n        \"\"\"Set value of ``instance`` attribute to ``names``.\n\n        Parameters\n        ----------\n        instance : object\n            Instance that owns the attribute\n        names : None, str, list, tuple\n            Column name(s) to store, or None to clear\n        \"\"\"\n        if isinstance(names, str):\n            names = [names]\n        if names is None:\n            # Remove attribute value from the meta['__attributes__'] dict.\n            # Subsequent access will just return None.\n            delattr(instance, self.name)\n        else:\n            # This stores names into instance.meta['__attributes__'] as tuple\n            return super().__set__(instance, tuple(names))\n\n    def __call__(self):\n        \"\"\"Get the value of the attribute.\n\n        Returns\n        -------\n        names : None, tuple\n            Include/exclude names\n        \"\"\"\n        # Get the value from instance.meta['__attributes__']\n        instance = self._instance_ref()\n        return super().__get__(instance, instance.__class__)\n\n    def __repr__(self):\n        if hasattr(self, '_instance_ref'):\n            out = f'<{self.__class__.__name__} name={self.name} value={self()}>'\n        else:\n            out = super().__repr__()\n        return out\n\n    def _add_remove_setup(self, names):\n        \"\"\"Common setup for add and remove.\n\n        - Coerce attribute value to a list\n        - Coerce names into a list\n        - Get the parent table instance\n        \"\"\"\n        names = [names] if isinstance(names, str) else list(names)\n        # Get the value. This is the same as self() but we need `instance` here.\n        instance = self._instance_ref()\n        value = super().__get__(instance, instance.__class__)\n        value = [] if value is None else list(value)\n        return instance, names, value\n\n    def add(self, names):\n        \"\"\"Add ``names`` to the include/exclude attribute.\n\n        Parameters\n        ----------\n        names : str, list, tuple\n            Column name(s) to add\n        \"\"\"\n        instance, names, value = self._add_remove_setup(names)\n        value.extend(name for name in names if name not in value)\n        super().__set__(instance, tuple(value))\n\n    def remove(self, names):\n        \"\"\"Remove ``names`` from the include/exclude attribute.\n\n        Parameters\n        ----------\n        names : str, list, tuple\n            Column name(s) to remove\n        \"\"\"\n        self._remove(names, raise_exc=True)\n\n    def _remove(self, names, raise_exc=False):\n        \"\"\"Remove ``names`` with optional checking if they exist\"\"\"\n        instance, names, value = self._add_remove_setup(names)\n\n        # Return now if there are no attributes and thus no action to be taken.\n        if not raise_exc and '__attributes__' not in instance.meta:\n            return\n\n        # Remove one by one, optionally raising an exception if name is missing.\n        for name in names:\n            if name in value:\n                value.remove(name)  # Using the list.remove method\n            elif raise_exc:\n                raise ValueError(f'{name} not in {self.name}')\n\n        # Change to either None or a tuple for storing back to attribute\n        value = None if value == [] else tuple(value)\n        self.__set__(instance, value)\n\n    def _rename(self, name, new_name):\n        \"\"\"Rename ``name`` to ``new_name`` if ``name`` is in the list\"\"\"\n        names = self() or ()\n        if name in names:\n            new_names = list(names)\n            new_names[new_names.index(name)] = new_name\n            self.set(new_names)\n\n    def set(self, names):\n        \"\"\"Set value of include/exclude attribute to ``names``.\n\n        Parameters\n        ----------\n        names : None, str, list, tuple\n            Column name(s) to store, or None to clear\n        \"\"\"\n        class _Context:\n            def __init__(self, descriptor_self):\n                self.descriptor_self = descriptor_self\n                self.names_orig = descriptor_self()\n\n            def __enter__(self):\n                pass\n\n            def __exit__(self, type, value, tb):\n                descriptor_self = self.descriptor_self\n                instance = descriptor_self._instance_ref()\n                descriptor_self.__set__(instance, self.names_orig)\n\n            def __repr__(self):\n                return repr(self.descriptor_self)\n\n        ctx = _Context(descriptor_self=self)\n\n        instance = self._instance_ref()\n        self.__set__(instance, names)\n\n        return ctx\n\n\nclass Table:\n    \"\"\"A class to represent tables of heterogeneous data.\n\n    `~astropy.table.Table` provides a class for heterogeneous tabular data.\n    A key enhancement provided by the `~astropy.table.Table` class over\n    e.g. a `numpy` structured array is the ability to easily modify the\n    structure of the table by adding or removing columns, or adding new\n    rows of data.  In addition table and column metadata are fully supported.\n\n    `~astropy.table.Table` differs from `~astropy.nddata.NDData` by the\n    assumption that the input data consists of columns of homogeneous data,\n    where each column has a unique identifier and may contain additional\n    metadata such as the data unit, format, and description.\n\n    See also: https://docs.astropy.org/en/stable/table/\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, table-like object, optional\n        Data to initialize table.\n    masked : bool, optional\n        Specify whether the table is masked.\n    names : list, optional\n        Specify column names.\n    dtype : list, optional\n        Specify column data types.\n    meta : dict, optional\n        Metadata associated with the table.\n    copy : bool, optional\n        Copy the input data. If the input is a Table the ``meta`` is always\n        copied regardless of the ``copy`` parameter.\n        Default is True.\n    rows : numpy ndarray, list of list, optional\n        Row-oriented data for table instead of ``data`` argument.\n    copy_indices : bool, optional\n        Copy any indices in the input data. Default is True.\n    units : list, dict, optional\n        List or dict of units to apply to columns.\n    descriptions : list, dict, optional\n        List or dict of descriptions to apply to columns.\n    **kwargs : dict, optional\n        Additional keyword args when converting table-like object.\n    \"\"\"\n\n    meta = MetaData(copy=False)\n\n    # Define class attributes for core container objects to allow for subclass\n    # customization.\n    Row = Row\n    Column = Column\n    MaskedColumn = MaskedColumn\n    TableColumns = TableColumns\n    TableFormatter = TableFormatter\n\n    # Unified I/O read and write methods from .connect\n    read = UnifiedReadWriteMethod(TableRead)\n    write = UnifiedReadWriteMethod(TableWrite)\n\n    pprint_exclude_names = PprintIncludeExclude()\n    pprint_include_names = PprintIncludeExclude()\n\n    def as_array(self, keep_byteorder=False, names=None):\n        \"\"\"\n        Return a new copy of the table in the form of a structured np.ndarray or\n        np.ma.MaskedArray object (as appropriate).\n\n        Parameters\n        ----------\n        keep_byteorder : bool, optional\n            By default the returned array has all columns in native byte\n            order.  However, if this option is `True` this preserves the\n            byte order of all columns (if any are non-native).\n\n        names : list, optional:\n            List of column names to include for returned structured array.\n            Default is to include all table columns.\n\n        Returns\n        -------\n        table_array : array or `~numpy.ma.MaskedArray`\n            Copy of table as a numpy structured array.\n            ndarray for unmasked or `~numpy.ma.MaskedArray` for masked.\n        \"\"\"\n        masked = self.masked or self.has_masked_columns or self.has_masked_values\n        empty_init = ma.empty if masked else np.empty\n        if len(self.columns) == 0:\n            return empty_init(0, dtype=None)\n\n        dtype = []\n\n        cols = self.columns.values()\n\n        if names is not None:\n            cols = [col for col in cols if col.info.name in names]\n\n        for col in cols:\n            col_descr = descr(col)\n\n            if not (col.info.dtype.isnative or keep_byteorder):\n                new_dt = np.dtype(col_descr[1]).newbyteorder('=')\n                col_descr = (col_descr[0], new_dt, col_descr[2])\n\n            dtype.append(col_descr)\n\n        data = empty_init(len(self), dtype=dtype)\n        for col in cols:\n            # When assigning from one array into a field of a structured array,\n            # Numpy will automatically swap those columns to their destination\n            # byte order where applicable\n            data[col.info.name] = col\n\n            # For masked out, masked mixin columns need to set output mask attribute.\n            if masked and has_info_class(col, MixinInfo) and hasattr(col, 'mask'):\n                data[col.info.name].mask = col.mask\n\n        return data\n\n    def __init__(self, data=None, masked=False, names=None, dtype=None,\n                 meta=None, copy=True, rows=None, copy_indices=True,\n                 units=None, descriptions=None,\n                 **kwargs):\n\n        # Set up a placeholder empty table\n        self._set_masked(masked)\n        self.columns = self.TableColumns()\n        self.formatter = self.TableFormatter()\n        self._copy_indices = True  # copy indices from this Table by default\n        self._init_indices = copy_indices  # whether to copy indices in init\n        self.primary_key = None\n\n        # Must copy if dtype are changing\n        if not copy and dtype is not None:\n            raise ValueError('Cannot specify dtype when copy=False')\n\n        # Specifies list of names found for the case of initializing table with\n        # a list of dict. If data are not list of dict then this is None.\n        names_from_list_of_dict = None\n\n        # Row-oriented input, e.g. list of lists or list of tuples, list of\n        # dict, Row instance.  Set data to something that the subsequent code\n        # will parse correctly.\n        if rows is not None:\n            if data is not None:\n                raise ValueError('Cannot supply both `data` and `rows` values')\n            if isinstance(rows, types.GeneratorType):\n                # Without this then the all(..) test below uses up the generator\n                rows = list(rows)\n\n            # Get column names if `rows` is a list of dict, otherwise this is None\n            names_from_list_of_dict = _get_names_from_list_of_dict(rows)\n            if names_from_list_of_dict:\n                data = rows\n            elif isinstance(rows, self.Row):\n                data = rows\n            else:\n                data = list(zip(*rows))\n\n        # Infer the type of the input data and set up the initialization\n        # function, number of columns, and potentially the default col names\n\n        default_names = None\n\n        # Handle custom (subclass) table attributes that are stored in meta.\n        # These are defined as class attributes using the TableAttribute\n        # descriptor.  Any such attributes get removed from kwargs here and\n        # stored for use after the table is otherwise initialized. Any values\n        # provided via kwargs will have precedence over existing values from\n        # meta (e.g. from data as a Table or meta via kwargs).\n        meta_table_attrs = {}\n        if kwargs:\n            for attr in list(kwargs):\n                descr = getattr(self.__class__, attr, None)\n                if isinstance(descr, TableAttribute):\n                    meta_table_attrs[attr] = kwargs.pop(attr)\n\n        if hasattr(data, '__astropy_table__'):\n            # Data object implements the __astropy_table__ interface method.\n            # Calling that method returns an appropriate instance of\n            # self.__class__ and respects the `copy` arg.  The returned\n            # Table object should NOT then be copied.\n            data = data.__astropy_table__(self.__class__, copy, **kwargs)\n            copy = False\n        elif kwargs:\n            raise TypeError('__init__() got unexpected keyword argument {!r}'\n                            .format(list(kwargs.keys())[0]))\n\n        if (isinstance(data, np.ndarray)\n                and data.shape == (0,)\n                and not data.dtype.names):\n            data = None\n\n        if isinstance(data, self.Row):\n            data = data._table[data._index:data._index + 1]\n\n        if isinstance(data, (list, tuple)):\n            # Get column names from `data` if it is a list of dict, otherwise this is None.\n            # This might be previously defined if `rows` was supplied as an init arg.\n            names_from_list_of_dict = (names_from_list_of_dict\n                                       or _get_names_from_list_of_dict(data))\n            if names_from_list_of_dict:\n                init_func = self._init_from_list_of_dicts\n                n_cols = len(names_from_list_of_dict)\n            else:\n                init_func = self._init_from_list\n                n_cols = len(data)\n\n        elif isinstance(data, np.ndarray):\n            if data.dtype.names:\n                init_func = self._init_from_ndarray  # _struct\n                n_cols = len(data.dtype.names)\n                default_names = data.dtype.names\n            else:\n                init_func = self._init_from_ndarray  # _homog\n                if data.shape == ():\n                    raise ValueError('Can not initialize a Table with a scalar')\n                elif len(data.shape) == 1:\n                    data = data[np.newaxis, :]\n                n_cols = data.shape[1]\n\n        elif isinstance(data, Mapping):\n            init_func = self._init_from_dict\n            default_names = list(data)\n            n_cols = len(default_names)\n\n        elif isinstance(data, Table):\n            # If user-input meta is None then use data.meta (if non-trivial)\n            if meta is None and data.meta:\n                # At this point do NOT deepcopy data.meta as this will happen after\n                # table init_func() is called.  But for table input the table meta\n                # gets a key copy here if copy=False because later a direct object ref\n                # is used.\n                meta = data.meta if copy else data.meta.copy()\n\n            # Handle indices on input table. Copy primary key and don't copy indices\n            # if the input Table is in non-copy mode.\n            self.primary_key = data.primary_key\n            self._init_indices = self._init_indices and data._copy_indices\n\n            # Extract default names, n_cols, and then overwrite ``data`` to be the\n            # table columns so we can use _init_from_list.\n            default_names = data.colnames\n            n_cols = len(default_names)\n            data = list(data.columns.values())\n\n            init_func = self._init_from_list\n\n        elif data is None:\n            if names is None:\n                if dtype is None:\n                    # Table was initialized as `t = Table()`. Set up for empty\n                    # table with names=[], data=[], and n_cols=0.\n                    # self._init_from_list() will simply return, giving the\n                    # expected empty table.\n                    names = []\n                else:\n                    try:\n                        # No data nor names but dtype is available.  This must be\n                        # valid to initialize a structured array.\n                        dtype = np.dtype(dtype)\n                        names = dtype.names\n                        dtype = [dtype[name] for name in names]\n                    except Exception:\n                        raise ValueError('dtype was specified but could not be '\n                                         'parsed for column names')\n            # names is guaranteed to be set at this point\n            init_func = self._init_from_list\n            n_cols = len(names)\n            data = [[]] * n_cols\n\n        else:\n            raise ValueError(f'Data type {type(data)} not allowed to init Table')\n\n        # Set up defaults if names and/or dtype are not specified.\n        # A value of None means the actual value will be inferred\n        # within the appropriate initialization routine, either from\n        # existing specification or auto-generated.\n\n        if dtype is None:\n            dtype = [None] * n_cols\n        elif isinstance(dtype, np.dtype):\n            if default_names is None:\n                default_names = dtype.names\n            # Convert a numpy dtype input to a list of dtypes for later use.\n            dtype = [dtype[name] for name in dtype.names]\n\n        if names is None:\n            names = default_names or [None] * n_cols\n\n        names = [None if name is None else str(name) for name in names]\n\n        self._check_names_dtype(names, dtype, n_cols)\n\n        # Finally do the real initialization\n        init_func(data, names, dtype, n_cols, copy)\n\n        # Set table meta.  If copy=True then deepcopy meta otherwise use the\n        # user-supplied meta directly.\n        if meta is not None:\n            self.meta = deepcopy(meta) if copy else meta\n\n        # Update meta with TableAttributes supplied as kwargs in Table init.\n        # This takes precedence over previously-defined meta.\n        if meta_table_attrs:\n            for attr, value in meta_table_attrs.items():\n                setattr(self, attr, value)\n\n        # Whatever happens above, the masked property should be set to a boolean\n        if self.masked not in (None, True, False):\n            raise TypeError(\"masked property must be None, True or False\")\n\n        self._set_column_attribute('unit', units)\n        self._set_column_attribute('description', descriptions)\n\n    def _set_column_attribute(self, attr, values):\n        \"\"\"Set ``attr`` for columns to ``values``, which can be either a dict (keyed by column\n        name) or a dict of name: value pairs.  This is used for handling the ``units`` and\n        ``descriptions`` kwargs to ``__init__``.\n        \"\"\"\n        if not values:\n            return\n\n        if isinstance(values, Row):\n            # For a Row object transform to an equivalent dict.\n            values = {name: values[name] for name in values.colnames}\n\n        if not isinstance(values, Mapping):\n            # If not a dict map, assume iterable and map to dict if the right length\n            if len(values) != len(self.columns):\n                raise ValueError(f'sequence of {attr} values must match number of columns')\n            values = dict(zip(self.colnames, values))\n\n        for name, value in values.items():\n            if name not in self.columns:\n                raise ValueError(f'invalid column name {name} for setting {attr} attribute')\n\n            # Special case: ignore unit if it is an empty or blank string\n            if attr == 'unit' and isinstance(value, str):\n                if value.strip() == '':\n                    value = None\n\n            if value not in (np.ma.masked, None):\n                setattr(self[name].info, attr, value)\n\n    def __getstate__(self):\n        columns = OrderedDict((key, col if isinstance(col, BaseColumn) else col_copy(col))\n                              for key, col in self.columns.items())\n        return (columns, self.meta)\n\n    def __setstate__(self, state):\n        columns, meta = state\n        self.__init__(columns, meta=meta)\n\n    @property\n    def mask(self):\n        # Dynamic view of available masks\n        if self.masked or self.has_masked_columns or self.has_masked_values:\n            mask_table = Table([getattr(col, 'mask', FalseArray(col.shape))\n                                for col in self.itercols()],\n                               names=self.colnames, copy=False)\n\n            # Set hidden attribute to force inplace setitem so that code like\n            # t.mask['a'] = [1, 0, 1] will correctly set the underlying mask.\n            # See #5556 for discussion.\n            mask_table._setitem_inplace = True\n        else:\n            mask_table = None\n\n        return mask_table\n\n    @mask.setter\n    def mask(self, val):\n        self.mask[:] = val\n\n    @property\n    def _mask(self):\n        \"\"\"This is needed so that comparison of a masked Table and a\n        MaskedArray works.  The requirement comes from numpy.ma.core\n        so don't remove this property.\"\"\"\n        return self.as_array().mask\n\n    def filled(self, fill_value=None):\n        \"\"\"Return copy of self, with masked values filled.\n\n        If input ``fill_value`` supplied then that value is used for all\n        masked entries in the table.  Otherwise the individual\n        ``fill_value`` defined for each table column is used.\n\n        Parameters\n        ----------\n        fill_value : str\n            If supplied, this ``fill_value`` is used for all masked entries\n            in the entire table.\n\n        Returns\n        -------\n        filled_table : `~astropy.table.Table`\n            New table with masked values filled\n        \"\"\"\n        if self.masked or self.has_masked_columns or self.has_masked_values:\n            # Get new columns with masked values filled, then create Table with those\n            # new cols (copy=False) but deepcopy the meta.\n            data = [col.filled(fill_value) if hasattr(col, 'filled') else col\n                    for col in self.itercols()]\n            return self.__class__(data, meta=deepcopy(self.meta), copy=False)\n        else:\n            # Return copy of the original object.\n            return self.copy()\n\n    @property\n    def indices(self):\n        '''\n        Return the indices associated with columns of the table\n        as a TableIndices object.\n        '''\n        lst = []\n        for column in self.columns.values():\n            for index in column.info.indices:\n                if sum([index is x for x in lst]) == 0:  # ensure uniqueness\n                    lst.append(index)\n        return TableIndices(lst)\n\n    @property\n    def loc(self):\n        '''\n        Return a TableLoc object that can be used for retrieving\n        rows by index in a given data range. Note that both loc\n        and iloc work only with single-column indices.\n        '''\n        return TableLoc(self)\n\n    @property\n    def loc_indices(self):\n        \"\"\"\n        Return a TableLocIndices object that can be used for retrieving\n        the row indices corresponding to given table index key value or values.\n        \"\"\"\n        return TableLocIndices(self)\n\n    @property\n    def iloc(self):\n        '''\n        Return a TableILoc object that can be used for retrieving\n        indexed rows in the order they appear in the index.\n        '''\n        return TableILoc(self)\n\n    def add_index(self, colnames, engine=None, unique=False):\n        '''\n        Insert a new index among one or more columns.\n        If there are no indices, make this index the\n        primary table index.\n\n        Parameters\n        ----------\n        colnames : str or list\n            List of column names (or a single column name) to index\n        engine : type or None\n            Indexing engine class to use, from among SortedArray, BST,\n            and SCEngine. If the supplied argument is None\n            (by default), use SortedArray.\n        unique : bool\n            Whether the values of the index must be unique. Default is False.\n        '''\n        if isinstance(colnames, str):\n            colnames = (colnames,)\n        columns = self.columns[tuple(colnames)].values()\n\n        # make sure all columns support indexing\n        for col in columns:\n            if not getattr(col.info, '_supports_indexing', False):\n                raise ValueError('Cannot create an index on column \"{}\", of '\n                                 'type \"{}\"'.format(col.info.name, type(col)))\n\n        is_primary = not self.indices\n        index = Index(columns, engine=engine, unique=unique)\n        sliced_index = SlicedIndex(index, slice(0, 0, None), original=True)\n        if is_primary:\n            self.primary_key = colnames\n        for col in columns:\n            col.info.indices.append(sliced_index)\n\n    def remove_indices(self, colname):\n        '''\n        Remove all indices involving the given column.\n        If the primary index is removed, the new primary\n        index will be the most recently added remaining\n        index.\n\n        Parameters\n        ----------\n        colname : str\n            Name of column\n        '''\n        col = self.columns[colname]\n        for index in self.indices:\n            try:\n                index.col_position(col.info.name)\n            except ValueError:\n                pass\n            else:\n                for c in index.columns:\n                    c.info.indices.remove(index)\n\n    def index_mode(self, mode):\n        '''\n        Return a context manager for an indexing mode.\n\n        Parameters\n        ----------\n        mode : str\n            Either 'freeze', 'copy_on_getitem', or 'discard_on_copy'.\n            In 'discard_on_copy' mode,\n            indices are not copied whenever columns or tables are copied.\n            In 'freeze' mode, indices are not modified whenever columns are\n            modified; at the exit of the context, indices refresh themselves\n            based on column values. This mode is intended for scenarios in\n            which one intends to make many additions or modifications in an\n            indexed column.\n            In 'copy_on_getitem' mode, indices are copied when taking column\n            slices as well as table slices, so col[i0:i1] will preserve\n            indices.\n        '''\n        return _IndexModeContext(self, mode)\n\n    def __array__(self, dtype=None):\n        \"\"\"Support converting Table to np.array via np.array(table).\n\n        Coercion to a different dtype via np.array(table, dtype) is not\n        supported and will raise a ValueError.\n        \"\"\"\n        if dtype is not None:\n            raise ValueError('Datatype coercion is not allowed')\n\n        # This limitation is because of the following unexpected result that\n        # should have made a table copy while changing the column names.\n        #\n        # >>> d = astropy.table.Table([[1,2],[3,4]])\n        # >>> np.array(d, dtype=[('a', 'i8'), ('b', 'i8')])\n        # array([(0, 0), (0, 0)],\n        #       dtype=[('a', '<i8'), ('b', '<i8')])\n\n        out = self.as_array()\n        return out.data if isinstance(out, np.ma.MaskedArray) else out\n\n    def _check_names_dtype(self, names, dtype, n_cols):\n        \"\"\"Make sure that names and dtype are both iterable and have\n        the same length as data.\n        \"\"\"\n        for inp_list, inp_str in ((dtype, 'dtype'), (names, 'names')):\n            if not isiterable(inp_list):\n                raise ValueError(f'{inp_str} must be a list or None')\n\n        if len(names) != n_cols or len(dtype) != n_cols:\n            raise ValueError(\n                'Arguments \"names\" and \"dtype\" must match number of columns')\n\n    def _init_from_list_of_dicts(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from a list of dictionaries representing rows.\"\"\"\n        # Define placeholder for missing values as a unique object that cannot\n        # every occur in user data.\n        MISSING = object()\n\n        # Gather column names that exist in the input `data`.\n        names_from_data = set()\n        for row in data:\n            names_from_data.update(row)\n\n        if set(data[0].keys()) == names_from_data:\n            names_from_data = list(data[0].keys())\n        else:\n            names_from_data = sorted(names_from_data)\n\n        # Note: if set(data[0].keys()) != names_from_data, this will give an\n        # exception later, so NO need to catch here.\n\n        # Convert list of dict into dict of list (cols), keep track of missing\n        # indexes and put in MISSING placeholders in the `cols` lists.\n        cols = {}\n        missing_indexes = defaultdict(list)\n        for name in names_from_data:\n            cols[name] = []\n            for ii, row in enumerate(data):\n                try:\n                    val = row[name]\n                except KeyError:\n                    missing_indexes[name].append(ii)\n                    val = MISSING\n                cols[name].append(val)\n\n        # Fill the missing entries with first values\n        if missing_indexes:\n            for name, indexes in missing_indexes.items():\n                col = cols[name]\n                first_val = next(val for val in col if val is not MISSING)\n                for index in indexes:\n                    col[index] = first_val\n\n        # prepare initialization\n        if all(name is None for name in names):\n            names = names_from_data\n\n        self._init_from_dict(cols, names, dtype, n_cols, copy)\n\n        # Mask the missing values if necessary, converting columns to MaskedColumn\n        # as needed.\n        if missing_indexes:\n            for name, indexes in missing_indexes.items():\n                col = self[name]\n                # Ensure that any Column subclasses with MISSING values can support\n                # setting masked values. As of astropy 4.0 the test condition below is\n                # always True since _init_from_dict cannot result in mixin columns.\n                if isinstance(col, Column) and not isinstance(col, MaskedColumn):\n                    self[name] = self.MaskedColumn(col, copy=False)\n\n                # Finally do the masking in a mixin-safe way.\n                self[name][indexes] = np.ma.masked\n        return\n\n    def _init_from_list(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from a list of column data.  A column can be a\n        Column object, np.ndarray, mixin, or any other iterable object.\n        \"\"\"\n        # Special case of initializing an empty table like `t = Table()`. No\n        # action required at this point.\n        if n_cols == 0:\n            return\n\n        cols = []\n        default_names = _auto_names(n_cols)\n\n        for col, name, default_name, dtype in zip(data, names, default_names, dtype):\n            col = self._convert_data_to_col(col, copy, default_name, dtype, name)\n\n            cols.append(col)\n\n        self._init_from_cols(cols)\n\n    def _convert_data_to_col(self, data, copy=True, default_name=None, dtype=None, name=None):\n        \"\"\"\n        Convert any allowed sequence data ``col`` to a column object that can be used\n        directly in the self.columns dict.  This could be a Column, MaskedColumn,\n        or mixin column.\n\n        The final column name is determined by::\n\n            name or data.info.name or def_name\n\n        If ``data`` has no ``info`` then ``name = name or def_name``.\n\n        The behavior of ``copy`` for Column objects is:\n        - copy=True: new class instance with a copy of data and deep copy of meta\n        - copy=False: new class instance with same data and a key-only copy of meta\n\n        For mixin columns:\n        - copy=True: new class instance with copy of data and deep copy of meta\n        - copy=False: original instance (no copy at all)\n\n        Parameters\n        ----------\n        data : object (column-like sequence)\n            Input column data\n        copy : bool\n            Make a copy\n        default_name : str\n            Default name\n        dtype : np.dtype or None\n            Data dtype\n        name : str or None\n            Column name\n\n        Returns\n        -------\n        col : Column, MaskedColumn, mixin-column type\n            Object that can be used as a column in self\n        \"\"\"\n\n        data_is_mixin = self._is_mixin_for_table(data)\n        masked_col_cls = (self.ColumnClass\n                          if issubclass(self.ColumnClass, self.MaskedColumn)\n                          else self.MaskedColumn)\n\n        try:\n            data0_is_mixin = self._is_mixin_for_table(data[0])\n        except Exception:\n            # Need broad exception, cannot predict what data[0] raises for arbitrary data\n            data0_is_mixin = False\n\n        # If the data is not an instance of Column or a mixin class, we can\n        # check the registry of mixin 'handlers' to see if the column can be\n        # converted to a mixin class\n        if (handler := get_mixin_handler(data)) is not None:\n            original_data = data\n            data = handler(data)\n            if not (data_is_mixin := self._is_mixin_for_table(data)):\n                fully_qualified_name = (original_data.__class__.__module__ + '.'\n                                        + original_data.__class__.__name__)\n                raise TypeError('Mixin handler for object of type '\n                                f'{fully_qualified_name} '\n                                'did not return a valid mixin column')\n\n        # Structured ndarray gets viewed as a mixin unless already a valid\n        # mixin class\n        if (not isinstance(data, Column) and not data_is_mixin\n                and isinstance(data, np.ndarray) and len(data.dtype) > 1):\n            data = data.view(NdarrayMixin)\n            data_is_mixin = True\n\n        # Get the final column name using precedence.  Some objects may not\n        # have an info attribute. Also avoid creating info as a side effect.\n        if not name:\n            if isinstance(data, Column):\n                name = data.name or default_name\n            elif 'info' in getattr(data, '__dict__', ()):\n                name = data.info.name or default_name\n            else:\n                name = default_name\n\n        if isinstance(data, Column):\n            # If self.ColumnClass is a subclass of col, then \"upgrade\" to ColumnClass,\n            # otherwise just use the original class.  The most common case is a\n            # table with masked=True and ColumnClass=MaskedColumn.  Then a Column\n            # gets upgraded to MaskedColumn, but the converse (pre-4.0) behavior\n            # of downgrading from MaskedColumn to Column (for non-masked table)\n            # does not happen.\n            col_cls = self._get_col_cls_for_table(data)\n\n        elif data_is_mixin:\n            # Copy the mixin column attributes if they exist since the copy below\n            # may not get this attribute.\n            col = col_copy(data, copy_indices=self._init_indices) if copy else data\n            col.info.name = name\n            return col\n\n        elif data0_is_mixin:\n            # Handle case of a sequence of a mixin, e.g. [1*u.m, 2*u.m].\n            try:\n                col = data[0].__class__(data)\n                col.info.name = name\n                return col\n            except Exception:\n                # If that didn't work for some reason, just turn it into np.array of object\n                data = np.array(data, dtype=object)\n                col_cls = self.ColumnClass\n\n        elif isinstance(data, (np.ma.MaskedArray, Masked)):\n            # Require that col_cls be a subclass of MaskedColumn, remembering\n            # that ColumnClass could be a user-defined subclass (though more-likely\n            # could be MaskedColumn).\n            col_cls = masked_col_cls\n\n        elif data is None:\n            # Special case for data passed as the None object (for broadcasting\n            # to an object column). Need to turn data into numpy `None` scalar\n            # object, otherwise `Column` interprets data=None as no data instead\n            # of a object column of `None`.\n            data = np.array(None)\n            col_cls = self.ColumnClass\n\n        elif not hasattr(data, 'dtype'):\n            # `data` is none of the above, convert to numpy array or MaskedArray\n            # assuming only that it is a scalar or sequence or N-d nested\n            # sequence. This function is relatively intricate and tries to\n            # maintain performance for common cases while handling things like\n            # list input with embedded np.ma.masked entries. If `data` is a\n            # scalar then it gets returned unchanged so the original object gets\n            # passed to `Column` later.\n            data = _convert_sequence_data_to_array(data, dtype)\n            copy = False  # Already made a copy above\n            col_cls = masked_col_cls if isinstance(data, np.ma.MaskedArray) else self.ColumnClass\n\n        else:\n            col_cls = self.ColumnClass\n\n        try:\n            col = col_cls(name=name, data=data, dtype=dtype,\n                          copy=copy, copy_indices=self._init_indices)\n        except Exception:\n            # Broad exception class since we don't know what might go wrong\n            raise ValueError('unable to convert data to Column for Table')\n\n        col = self._convert_col_for_table(col)\n\n        return col\n\n    def _init_from_ndarray(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from an ndarray structured array\"\"\"\n\n        data_names = data.dtype.names or _auto_names(n_cols)\n        struct = data.dtype.names is not None\n        names = [name or data_names[i] for i, name in enumerate(names)]\n\n        cols = ([data[name] for name in data_names] if struct else\n                [data[:, i] for i in range(n_cols)])\n\n        self._init_from_list(cols, names, dtype, n_cols, copy)\n\n    def _init_from_dict(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from a dictionary of columns\"\"\"\n\n        data_list = [data[name] for name in names]\n        self._init_from_list(data_list, names, dtype, n_cols, copy)\n\n    def _get_col_cls_for_table(self, col):\n        \"\"\"Get the correct column class to use for upgrading any Column-like object.\n\n        For a masked table, ensure any Column-like object is a subclass\n        of the table MaskedColumn.\n\n        For unmasked table, ensure any MaskedColumn-like object is a subclass\n        of the table MaskedColumn.  If not a MaskedColumn, then ensure that any\n        Column-like object is a subclass of the table Column.\n        \"\"\"\n\n        col_cls = col.__class__\n\n        if self.masked:\n            if isinstance(col, Column) and not isinstance(col, self.MaskedColumn):\n                col_cls = self.MaskedColumn\n        else:\n            if isinstance(col, MaskedColumn):\n                if not isinstance(col, self.MaskedColumn):\n                    col_cls = self.MaskedColumn\n            elif isinstance(col, Column) and not isinstance(col, self.Column):\n                col_cls = self.Column\n\n        return col_cls\n\n    def _convert_col_for_table(self, col):\n        \"\"\"\n        Make sure that all Column objects have correct base class for this type of\n        Table.  For a base Table this most commonly means setting to\n        MaskedColumn if the table is masked.  Table subclasses like QTable\n        override this method.\n        \"\"\"\n        if isinstance(col, Column) and not isinstance(col, self.ColumnClass):\n            col_cls = self._get_col_cls_for_table(col)\n            if col_cls is not col.__class__:\n                col = col_cls(col, copy=False)\n\n        return col\n\n    def _init_from_cols(self, cols):\n        \"\"\"Initialize table from a list of Column or mixin objects\"\"\"\n\n        lengths = set(len(col) for col in cols)\n        if len(lengths) > 1:\n            raise ValueError(f'Inconsistent data column lengths: {lengths}')\n\n        # Make sure that all Column-based objects have correct class.  For\n        # plain Table this is self.ColumnClass, but for instance QTable will\n        # convert columns with units to a Quantity mixin.\n        newcols = [self._convert_col_for_table(col) for col in cols]\n        self._make_table_from_cols(self, newcols)\n\n        # Deduplicate indices.  It may happen that after pickling or when\n        # initing from an existing table that column indices which had been\n        # references to a single index object got *copied* into an independent\n        # object.  This results in duplicates which will cause downstream problems.\n        index_dict = {}\n        for col in self.itercols():\n            for i, index in enumerate(col.info.indices or []):\n                names = tuple(ind_col.info.name for ind_col in index.columns)\n                if names in index_dict:\n                    col.info.indices[i] = index_dict[names]\n                else:\n                    index_dict[names] = index\n\n    def _new_from_slice(self, slice_):\n        \"\"\"Create a new table as a referenced slice from self.\"\"\"\n\n        table = self.__class__(masked=self.masked)\n        if self.meta:\n            table.meta = self.meta.copy()  # Shallow copy for slice\n        table.primary_key = self.primary_key\n\n        newcols = []\n        for col in self.columns.values():\n            newcol = col[slice_]\n\n            # Note in line below, use direct attribute access to col.indices for Column\n            # instances instead of the generic col.info.indices.  This saves about 4 usec\n            # per column.\n            if (col if isinstance(col, Column) else col.info).indices:\n                # TODO : as far as I can tell the only purpose of setting _copy_indices\n                # here is to communicate that to the initial test in `slice_indices`.\n                # Why isn't that just sent as an arg to the function?\n                col.info._copy_indices = self._copy_indices\n                newcol = col.info.slice_indices(newcol, slice_, len(col))\n\n                # Don't understand why this is forcing a value on the original column.\n                # Normally col.info does not even have a _copy_indices attribute.  Tests\n                # still pass if this line is deleted.  (Each col.info attribute access\n                # is expensive).\n                col.info._copy_indices = True\n\n            newcols.append(newcol)\n\n        self._make_table_from_cols(table, newcols, verify=False, names=self.columns.keys())\n        return table\n\n    @staticmethod\n    def _make_table_from_cols(table, cols, verify=True, names=None):\n        \"\"\"\n        Make ``table`` in-place so that it represents the given list of ``cols``.\n        \"\"\"\n        if names is None:\n            names = [col.info.name for col in cols]\n\n        # Note: we do not test for len(names) == len(cols) if names is not None.  In that\n        # case the function is being called by from \"trusted\" source (e.g. right above here)\n        # that is assumed to provide valid inputs.  In that case verify=False.\n\n        if verify:\n            if None in names:\n                raise TypeError('Cannot have None for column name')\n            if len(set(names)) != len(names):\n                raise ValueError('Duplicate column names')\n\n        table.columns = table.TableColumns((name, col) for name, col in zip(names, cols))\n\n        for col in cols:\n            table._set_col_parent_table_and_mask(col)\n\n    def _set_col_parent_table_and_mask(self, col):\n        \"\"\"\n        Set ``col.parent_table = self`` and force ``col`` to have ``mask``\n        attribute if the table is masked and ``col.mask`` does not exist.\n        \"\"\"\n        # For Column instances it is much faster to do direct attribute access\n        # instead of going through .info\n        col_info = col if isinstance(col, Column) else col.info\n        col_info.parent_table = self\n\n        # Legacy behavior for masked table\n        if self.masked and not hasattr(col, 'mask'):\n            col.mask = FalseArray(col.shape)\n\n    def itercols(self):\n        \"\"\"\n        Iterate over the columns of this table.\n\n        Examples\n        --------\n\n        To iterate over the columns of a table::\n\n            >>> t = Table([[1], [2]])\n            >>> for col in t.itercols():\n            ...     print(col)\n            col0\n            ----\n               1\n            col1\n            ----\n               2\n\n        Using ``itercols()`` is similar to  ``for col in t.columns.values()``\n        but is syntactically preferred.\n        \"\"\"\n        for colname in self.columns:\n            yield self[colname]\n\n    def _base_repr_(self, html=False, descr_vals=None, max_width=None,\n                    tableid=None, show_dtype=True, max_lines=None,\n                    tableclass=None):\n        if descr_vals is None:\n            descr_vals = [self.__class__.__name__]\n            if self.masked:\n                descr_vals.append('masked=True')\n            descr_vals.append(f'length={len(self)}')\n\n        descr = ' '.join(descr_vals)\n        if html:\n            from astropy.utils.xml.writer import xml_escape\n            descr = f'<i>{xml_escape(descr)}</i>\\n'\n        else:\n            descr = f'<{descr}>\\n'\n\n        if tableid is None:\n            tableid = f'table{id(self)}'\n\n        data_lines, outs = self.formatter._pformat_table(\n            self, tableid=tableid, html=html, max_width=max_width,\n            show_name=True, show_unit=None, show_dtype=show_dtype,\n            max_lines=max_lines, tableclass=tableclass)\n\n        out = descr + '\\n'.join(data_lines)\n\n        return out\n\n    def _repr_html_(self):\n        out = self._base_repr_(html=True, max_width=-1,\n                               tableclass=conf.default_notebook_table_class)\n        # Wrap <table> in <div>. This follows the pattern in pandas and allows\n        # table to be scrollable horizontally in VS Code notebook display.\n        out = f'<div>{out}</div>'\n        return out\n\n    def __repr__(self):\n        return self._base_repr_(html=False, max_width=None)\n\n    def __str__(self):\n        return '\\n'.join(self.pformat())\n\n    def __bytes__(self):\n        return str(self).encode('utf-8')\n\n    @property\n    def has_mixin_columns(self):\n        \"\"\"\n        True if table has any mixin columns (defined as columns that are not Column\n        subclasses).\n        \"\"\"\n        return any(has_info_class(col, MixinInfo) for col in self.columns.values())\n\n    @property\n    def has_masked_columns(self):\n        \"\"\"True if table has any ``MaskedColumn`` columns.\n\n        This does not check for mixin columns that may have masked values, use the\n        ``has_masked_values`` property in that case.\n\n        \"\"\"\n        return any(isinstance(col, MaskedColumn) for col in self.itercols())\n\n    @property\n    def has_masked_values(self):\n        \"\"\"True if column in the table has values which are masked.\n\n        This may be relatively slow for large tables as it requires checking the mask\n        values of each column.\n        \"\"\"\n        for col in self.itercols():\n            if hasattr(col, 'mask') and np.any(col.mask):\n                return True\n        else:\n            return False\n\n    def _is_mixin_for_table(self, col):\n        \"\"\"\n        Determine if ``col`` should be added to the table directly as\n        a mixin column.\n        \"\"\"\n        if isinstance(col, BaseColumn):\n            return False\n\n        # Is it a mixin but not [Masked]Quantity (which gets converted to\n        # [Masked]Column with unit set).\n        return has_info_class(col, MixinInfo) and not has_info_class(col, QuantityInfo)\n\n    @format_doc(_pprint_docs)\n    def pprint(self, max_lines=None, max_width=None, show_name=True,\n               show_unit=None, show_dtype=False, align=None):\n        \"\"\"Print a formatted string representation of the table.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default is taken from the\n        configuration item ``astropy.conf.max_lines``.  If a negative\n        value of ``max_lines`` is supplied then there is no line limit\n        applied.\n\n        The same applies for max_width except the configuration item is\n        ``astropy.conf.max_width``.\n\n        \"\"\"\n        lines, outs = self.formatter._pformat_table(self, max_lines, max_width,\n                                                    show_name=show_name, show_unit=show_unit,\n                                                    show_dtype=show_dtype, align=align)\n        if outs['show_length']:\n            lines.append(f'Length = {len(self)} rows')\n\n        n_header = outs['n_header']\n\n        for i, line in enumerate(lines):\n            if i < n_header:\n                color_print(line, 'red')\n            else:\n                print(line)\n\n    @format_doc(_pprint_docs)\n    def pprint_all(self, max_lines=-1, max_width=-1, show_name=True,\n                   show_unit=None, show_dtype=False, align=None):\n        \"\"\"Print a formatted string representation of the entire table.\n\n        This method is the same as `astropy.table.Table.pprint` except that\n        the default ``max_lines`` and ``max_width`` are both -1 so that by\n        default the entire table is printed instead of restricting to the size\n        of the screen terminal.\n\n        \"\"\"\n        return self.pprint(max_lines, max_width, show_name,\n                           show_unit, show_dtype, align)\n\n    def _make_index_row_display_table(self, index_row_name):\n        if index_row_name not in self.columns:\n            idx_col = self.ColumnClass(name=index_row_name, data=np.arange(len(self)))\n            return self.__class__([idx_col] + list(self.columns.values()),\n                                  copy=False)\n        else:\n            return self\n\n    def show_in_notebook(self, tableid=None, css=None, display_length=50,\n                         table_class='astropy-default', show_row_index='idx'):\n        \"\"\"Render the table in HTML and show it in the IPython notebook.\n\n        Parameters\n        ----------\n        tableid : str or None\n            An html ID tag for the table.  Default is ``table{id}-XXX``, where\n            id is the unique integer id of the table object, id(self), and XXX\n            is a random number to avoid conflicts when printing the same table\n            multiple times.\n        table_class : str or None\n            A string with a list of HTML classes used to style the table.\n            The special default string ('astropy-default') means that the string\n            will be retrieved from the configuration item\n            ``astropy.table.default_notebook_table_class``. Note that these\n            table classes may make use of bootstrap, as this is loaded with the\n            notebook.  See `this page <https://getbootstrap.com/css/#tables>`_\n            for the list of classes.\n        css : str\n            A valid CSS string declaring the formatting for the table. Defaults\n            to ``astropy.table.jsviewer.DEFAULT_CSS_NB``.\n        display_length : int, optional\n            Number or rows to show. Defaults to 50.\n        show_row_index : str or False\n            If this does not evaluate to False, a column with the given name\n            will be added to the version of the table that gets displayed.\n            This new column shows the index of the row in the table itself,\n            even when the displayed table is re-sorted by another column. Note\n            that if a column with this name already exists, this option will be\n            ignored. Defaults to \"idx\".\n\n        Notes\n        -----\n        Currently, unlike `show_in_browser` (with ``jsviewer=True``), this\n        method needs to access online javascript code repositories.  This is due\n        to modern browsers' limitations on accessing local files.  Hence, if you\n        call this method while offline (and don't have a cached version of\n        jquery and jquery.dataTables), you will not get the jsviewer features.\n        \"\"\"\n\n        from .jsviewer import JSViewer\n        from IPython.display import HTML\n\n        if tableid is None:\n            tableid = f'table{id(self)}-{np.random.randint(1, 1e6)}'\n\n        jsv = JSViewer(display_length=display_length)\n        if show_row_index:\n            display_table = self._make_index_row_display_table(show_row_index)\n        else:\n            display_table = self\n        if table_class == 'astropy-default':\n            table_class = conf.default_notebook_table_class\n        html = display_table._base_repr_(html=True, max_width=-1, tableid=tableid,\n                                         max_lines=-1, show_dtype=False,\n                                         tableclass=table_class)\n\n        columns = display_table.columns.values()\n        sortable_columns = [i for i, col in enumerate(columns)\n                            if col.info.dtype.kind in 'iufc']\n        html += jsv.ipynb(tableid, css=css, sort_columns=sortable_columns)\n        return HTML(html)\n\n    def show_in_browser(self, max_lines=5000, jsviewer=False,\n                        browser='default', jskwargs={'use_local_files': True},\n                        tableid=None, table_class=\"display compact\",\n                        css=None, show_row_index='idx'):\n        \"\"\"Render the table in HTML and show it in a web browser.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum number of rows to export to the table (set low by default\n            to avoid memory issues, since the browser view requires duplicating\n            the table in memory).  A negative value of ``max_lines`` indicates\n            no row limit.\n        jsviewer : bool\n            If `True`, prepends some javascript headers so that the table is\n            rendered as a `DataTables <https://datatables.net>`_ data table.\n            This allows in-browser searching & sorting.\n        browser : str\n            Any legal browser name, e.g. ``'firefox'``, ``'chrome'``,\n            ``'safari'`` (for mac, you may need to use ``'open -a\n            \"/Applications/Google Chrome.app\" {}'`` for Chrome).  If\n            ``'default'``, will use the system default browser.\n        jskwargs : dict\n            Passed to the `astropy.table.JSViewer` init. Defaults to\n            ``{'use_local_files': True}`` which means that the JavaScript\n            libraries will be served from local copies.\n        tableid : str or None\n            An html ID tag for the table.  Default is ``table{id}``, where id\n            is the unique integer id of the table object, id(self).\n        table_class : str or None\n            A string with a list of HTML classes used to style the table.\n            Default is \"display compact\", and other possible values can be\n            found in https://www.datatables.net/manual/styling/classes\n        css : str\n            A valid CSS string declaring the formatting for the table. Defaults\n            to ``astropy.table.jsviewer.DEFAULT_CSS``.\n        show_row_index : str or False\n            If this does not evaluate to False, a column with the given name\n            will be added to the version of the table that gets displayed.\n            This new column shows the index of the row in the table itself,\n            even when the displayed table is re-sorted by another column. Note\n            that if a column with this name already exists, this option will be\n            ignored. Defaults to \"idx\".\n        \"\"\"\n\n        import os\n        import webbrowser\n        import tempfile\n        from .jsviewer import DEFAULT_CSS\n        from urllib.parse import urljoin\n        from urllib.request import pathname2url\n\n        if css is None:\n            css = DEFAULT_CSS\n\n        # We can't use NamedTemporaryFile here because it gets deleted as\n        # soon as it gets garbage collected.\n        tmpdir = tempfile.mkdtemp()\n        path = os.path.join(tmpdir, 'table.html')\n\n        with open(path, 'w') as tmp:\n            if jsviewer:\n                if show_row_index:\n                    display_table = self._make_index_row_display_table(show_row_index)\n                else:\n                    display_table = self\n                display_table.write(tmp, format='jsviewer', css=css,\n                                    max_lines=max_lines, jskwargs=jskwargs,\n                                    table_id=tableid, table_class=table_class)\n            else:\n                self.write(tmp, format='html')\n\n        try:\n            br = webbrowser.get(None if browser == 'default' else browser)\n        except webbrowser.Error:\n            log.error(f\"Browser '{browser}' not found.\")\n        else:\n            br.open(urljoin('file:', pathname2url(path)))\n\n    @format_doc(_pformat_docs, id=\"{id}\")\n    def pformat(self, max_lines=None, max_width=None, show_name=True,\n                show_unit=None, show_dtype=False, html=False, tableid=None,\n                align=None, tableclass=None):\n        \"\"\"Return a list of lines for the formatted string representation of\n        the table.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default is taken from the\n        configuration item ``astropy.conf.max_lines``.  If a negative\n        value of ``max_lines`` is supplied then there is no line limit\n        applied.\n\n        The same applies for ``max_width`` except the configuration item  is\n        ``astropy.conf.max_width``.\n\n        \"\"\"\n\n        lines, outs = self.formatter._pformat_table(\n            self, max_lines, max_width, show_name=show_name,\n            show_unit=show_unit, show_dtype=show_dtype, html=html,\n            tableid=tableid, tableclass=tableclass, align=align)\n\n        if outs['show_length']:\n            lines.append(f'Length = {len(self)} rows')\n\n        return lines\n\n    @format_doc(_pformat_docs, id=\"{id}\")\n    def pformat_all(self, max_lines=-1, max_width=-1, show_name=True,\n                    show_unit=None, show_dtype=False, html=False, tableid=None,\n                    align=None, tableclass=None):\n        \"\"\"Return a list of lines for the formatted string representation of\n        the entire table.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default is taken from the\n        configuration item ``astropy.conf.max_lines``.  If a negative\n        value of ``max_lines`` is supplied then there is no line limit\n        applied.\n\n        The same applies for ``max_width`` except the configuration item  is\n        ``astropy.conf.max_width``.\n\n        \"\"\"\n\n        return self.pformat(max_lines, max_width, show_name,\n                            show_unit, show_dtype, html, tableid,\n                            align, tableclass)\n\n    def more(self, max_lines=None, max_width=None, show_name=True,\n             show_unit=None, show_dtype=False):\n        \"\"\"Interactively browse table with a paging interface.\n\n        Supported keys::\n\n          f, <space> : forward one page\n          b : back one page\n          r : refresh same page\n          n : next row\n          p : previous row\n          < : go to beginning\n          > : go to end\n          q : quit browsing\n          h : print this help\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum number of lines in table output\n\n        max_width : int or None\n            Maximum character width of output\n\n        show_name : bool\n            Include a header row for column names. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        show_dtype : bool\n            Include a header row for column dtypes. Default is True.\n        \"\"\"\n        self.formatter._more_tabcol(self, max_lines, max_width, show_name=show_name,\n                                    show_unit=show_unit, show_dtype=show_dtype)\n\n    def __getitem__(self, item):\n        if isinstance(item, str):\n            return self.columns[item]\n        elif isinstance(item, (int, np.integer)):\n            return self.Row(self, item)\n        elif (isinstance(item, np.ndarray) and item.shape == () and item.dtype.kind == 'i'):\n            return self.Row(self, item.item())\n        elif self._is_list_or_tuple_of_str(item):\n            out = self.__class__([self[x] for x in item],\n                                 copy_indices=self._copy_indices)\n            out._groups = groups.TableGroups(out, indices=self.groups._indices,\n                                             keys=self.groups._keys)\n            out.meta = self.meta.copy()  # Shallow copy for meta\n            return out\n        elif ((isinstance(item, np.ndarray) and item.size == 0)\n              or (isinstance(item, (tuple, list)) and not item)):\n            # If item is an empty array/list/tuple then return the table with no rows\n            return self._new_from_slice([])\n        elif (isinstance(item, slice)\n              or isinstance(item, np.ndarray)\n              or isinstance(item, list)\n              or isinstance(item, tuple) and all(isinstance(x, np.ndarray)\n                                                 for x in item)):\n            # here for the many ways to give a slice; a tuple of ndarray\n            # is produced by np.where, as in t[np.where(t['a'] > 2)]\n            # For all, a new table is constructed with slice of all columns\n            return self._new_from_slice(item)\n        else:\n            raise ValueError(f'Illegal type {type(item)} for table item access')\n\n    def __setitem__(self, item, value):\n        # If the item is a string then it must be the name of a column.\n        # If that column doesn't already exist then create it now.\n        if isinstance(item, str) and item not in self.colnames:\n            self.add_column(value, name=item, copy=True)\n\n        else:\n            n_cols = len(self.columns)\n\n            if isinstance(item, str):\n                # Set an existing column by first trying to replace, and if\n                # this fails do an in-place update.  See definition of mask\n                # property for discussion of the _setitem_inplace attribute.\n                if (not getattr(self, '_setitem_inplace', False)\n                        and not conf.replace_inplace):\n                    try:\n                        self._replace_column_warnings(item, value)\n                        return\n                    except Exception:\n                        pass\n                self.columns[item][:] = value\n\n            elif isinstance(item, (int, np.integer)):\n                self._set_row(idx=item, colnames=self.colnames, vals=value)\n\n            elif (isinstance(item, slice)\n                  or isinstance(item, np.ndarray)\n                  or isinstance(item, list)\n                  or (isinstance(item, tuple)  # output from np.where\n                      and all(isinstance(x, np.ndarray) for x in item))):\n\n                if isinstance(value, Table):\n                    vals = (col for col in value.columns.values())\n\n                elif isinstance(value, np.ndarray) and value.dtype.names:\n                    vals = (value[name] for name in value.dtype.names)\n\n                elif np.isscalar(value):\n                    vals = itertools.repeat(value, n_cols)\n\n                else:  # Assume this is an iterable that will work\n                    if len(value) != n_cols:\n                        raise ValueError('Right side value needs {} elements (one for each column)'\n                                         .format(n_cols))\n                    vals = value\n\n                for col, val in zip(self.columns.values(), vals):\n                    col[item] = val\n\n            else:\n                raise ValueError(f'Illegal type {type(item)} for table item access')\n\n    def __delitem__(self, item):\n        if isinstance(item, str):\n            self.remove_column(item)\n        elif isinstance(item, (int, np.integer)):\n            self.remove_row(item)\n        elif (isinstance(item, (list, tuple, np.ndarray))\n              and all(isinstance(x, str) for x in item)):\n            self.remove_columns(item)\n        elif (isinstance(item, (list, np.ndarray))\n              and np.asarray(item).dtype.kind == 'i'):\n            self.remove_rows(item)\n        elif isinstance(item, slice):\n            self.remove_rows(item)\n        else:\n            raise IndexError('illegal key or index value')\n\n    def _ipython_key_completions_(self):\n        return self.colnames\n\n    def field(self, item):\n        \"\"\"Return column[item] for recarray compatibility.\"\"\"\n        return self.columns[item]\n\n    @property\n    def masked(self):\n        return self._masked\n\n    @masked.setter\n    def masked(self, masked):\n        raise Exception('Masked attribute is read-only (use t = Table(t, masked=True)'\n                        ' to convert to a masked table)')\n\n    def _set_masked(self, masked):\n        \"\"\"\n        Set the table masked property.\n\n        Parameters\n        ----------\n        masked : bool\n            State of table masking (`True` or `False`)\n        \"\"\"\n        if masked in [True, False, None]:\n            self._masked = masked\n        else:\n            raise ValueError(\"masked should be one of True, False, None\")\n\n        self._column_class = self.MaskedColumn if self._masked else self.Column\n\n    @property\n    def ColumnClass(self):\n        if self._column_class is None:\n            return self.Column\n        else:\n            return self._column_class\n\n    @property\n    def dtype(self):\n        return np.dtype([descr(col) for col in self.columns.values()])\n\n    @property\n    def colnames(self):\n        return list(self.columns.keys())\n\n    @staticmethod\n    def _is_list_or_tuple_of_str(names):\n        \"\"\"Check that ``names`` is a tuple or list of strings\"\"\"\n        return (isinstance(names, (tuple, list)) and names\n                and all(isinstance(x, str) for x in names))\n\n    def keys(self):\n        return list(self.columns.keys())\n\n    def values(self):\n        return self.columns.values()\n\n    def items(self):\n        return self.columns.items()\n\n    def __len__(self):\n        # For performance reasons (esp. in Row) cache the first column name\n        # and use that subsequently for the table length.  If might not be\n        # available yet or the column might be gone now, in which case\n        # try again in the except block.\n        try:\n            return len(OrderedDict.__getitem__(self.columns, self._first_colname))\n        except (AttributeError, KeyError):\n            if len(self.columns) == 0:\n                return 0\n\n            # Get the first column name\n            self._first_colname = next(iter(self.columns))\n            return len(self.columns[self._first_colname])\n\n    def index_column(self, name):\n        \"\"\"\n        Return the positional index of column ``name``.\n\n        Parameters\n        ----------\n        name : str\n            column name\n\n        Returns\n        -------\n        index : int\n            Positional index of column ``name``.\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Get index of column 'b' of the table::\n\n            >>> t.index_column('b')\n            1\n        \"\"\"\n        try:\n            return self.colnames.index(name)\n        except ValueError:\n            raise ValueError(f\"Column {name} does not exist\")\n\n    def add_column(self, col, index=None, name=None, rename_duplicate=False, copy=True,\n                   default_name=None):\n        \"\"\"\n        Add a new column to the table using ``col`` as input.  If ``index``\n        is supplied then insert column before ``index`` position\n        in the list of columns, otherwise append column to the end\n        of the list.\n\n        The ``col`` input can be any data object which is acceptable as a\n        `~astropy.table.Table` column object or can be converted.  This includes\n        mixin columns and scalar or length=1 objects which get broadcast to match\n        the table length.\n\n        To add several columns at once use ``add_columns()`` or simply call\n        ``add_column()`` for each one.  There is very little performance difference\n        in the two approaches.\n\n        Parameters\n        ----------\n        col : object\n            Data object for the new column\n        index : int or None\n            Insert column before this position or at end (default).\n        name : str\n            Column name\n        rename_duplicate : bool\n            Uniquify column name if it already exist. Default is False.\n        copy : bool\n            Make a copy of the new column. Default is True.\n        default_name : str or None\n            Name to use if both ``name`` and ``col.info.name`` are not available.\n            Defaults to ``col{number_of_columns}``.\n\n        Examples\n        --------\n        Create a table with two columns 'a' and 'b', then create a third column 'c'\n        and append it to the end of the table::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> col_c = Column(name='c', data=['x', 'y'])\n            >>> t.add_column(col_c)\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n\n        Add column 'd' at position 1. Note that the column is inserted\n        before the given index::\n\n            >>> t.add_column(['a', 'b'], name='d', index=1)\n            >>> print(t)\n             a   d   b   c\n            --- --- --- ---\n              1   a 0.1   x\n              2   b 0.2   y\n\n        Add second column named 'b' with rename_duplicate::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> t.add_column(1.1, name='b', rename_duplicate=True)\n            >>> print(t)\n             a   b  b_1\n            --- --- ---\n              1 0.1 1.1\n              2 0.2 1.1\n\n        Add an unnamed column or mixin object in the table using a default name\n        or by specifying an explicit name with ``name``. Name can also be overridden::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> t.add_column(['a', 'b'])\n            >>> t.add_column(col_c, name='d')\n            >>> print(t)\n             a   b  col2  d\n            --- --- ---- ---\n              1 0.1    a   x\n              2 0.2    b   y\n        \"\"\"\n        if default_name is None:\n            default_name = f'col{len(self.columns)}'\n\n        # Convert col data to acceptable object for insertion into self.columns.\n        # Note that along with the lines above and below, this allows broadcasting\n        # of scalars to the correct shape for adding to table.\n        col = self._convert_data_to_col(col, name=name, copy=copy,\n                                        default_name=default_name)\n\n        # Assigning a scalar column to an empty table should result in an\n        # exception (see #3811).\n        if col.shape == () and len(self) == 0:\n            raise TypeError('Empty table cannot have column set to scalar value')\n        # Make col data shape correct for scalars.  The second test is to allow\n        # broadcasting an N-d element to a column, e.g. t['new'] = [[1, 2]].\n        elif (col.shape == () or col.shape[0] == 1) and len(self) > 0:\n            new_shape = (len(self),) + getattr(col, 'shape', ())[1:]\n            if isinstance(col, np.ndarray):\n                col = np.broadcast_to(col, shape=new_shape,\n                                      subok=True)\n            elif isinstance(col, ShapedLikeNDArray):\n                col = col._apply(np.broadcast_to, shape=new_shape,\n                                 subok=True)\n\n            # broadcast_to() results in a read-only array.  Apparently it only changes\n            # the view to look like the broadcasted array.  So copy.\n            col = col_copy(col)\n\n        name = col.info.name\n\n        # Ensure that new column is the right length\n        if len(self.columns) > 0 and len(col) != len(self):\n            raise ValueError('Inconsistent data column lengths')\n\n        if rename_duplicate:\n            orig_name = name\n            i = 1\n            while name in self.columns:\n                # Iterate until a unique name is found\n                name = orig_name + '_' + str(i)\n                i += 1\n            col.info.name = name\n\n        # Set col parent_table weakref and ensure col has mask attribute if table.masked\n        self._set_col_parent_table_and_mask(col)\n\n        # Add new column as last column\n        self.columns[name] = col\n\n        if index is not None:\n            # Move the other cols to the right of the new one\n            move_names = self.colnames[index:-1]\n            for move_name in move_names:\n                self.columns.move_to_end(move_name, last=True)\n\n    def add_columns(self, cols, indexes=None, names=None, copy=True, rename_duplicate=False):\n        \"\"\"\n        Add a list of new columns the table using ``cols`` data objects.  If a\n        corresponding list of ``indexes`` is supplied then insert column\n        before each ``index`` position in the *original* list of columns,\n        otherwise append columns to the end of the list.\n\n        The ``cols`` input can include any data objects which are acceptable as\n        `~astropy.table.Table` column objects or can be converted.  This includes\n        mixin columns and scalar or length=1 objects which get broadcast to match\n        the table length.\n\n        From a performance perspective there is little difference between calling\n        this method once or looping over the new columns and calling ``add_column()``\n        for each column.\n\n        Parameters\n        ----------\n        cols : list of object\n            List of data objects for the new columns\n        indexes : list of int or None\n            Insert column before this position or at end (default).\n        names : list of str\n            Column names\n        copy : bool\n            Make a copy of the new columns. Default is True.\n        rename_duplicate : bool\n            Uniquify new column names if they duplicate the existing ones.\n            Default is False.\n\n        See Also\n        --------\n        astropy.table.hstack, update, replace_column\n\n        Examples\n        --------\n        Create a table with two columns 'a' and 'b', then create columns 'c' and 'd'\n        and append them to the end of the table::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> col_c = Column(name='c', data=['x', 'y'])\n            >>> col_d = Column(name='d', data=['u', 'v'])\n            >>> t.add_columns([col_c, col_d])\n            >>> print(t)\n             a   b   c   d\n            --- --- --- ---\n              1 0.1   x   u\n              2 0.2   y   v\n\n        Add column 'c' at position 0 and column 'd' at position 1. Note that\n        the columns are inserted before the given position::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> t.add_columns([['x', 'y'], ['u', 'v']], names=['c', 'd'],\n            ...               indexes=[0, 1])\n            >>> print(t)\n             c   a   d   b\n            --- --- --- ---\n              x   1   u 0.1\n              y   2   v 0.2\n\n        Add second column 'b' and column 'c' with ``rename_duplicate``::\n\n            >>> t = Table([[1, 2], [0.1, 0.2]], names=('a', 'b'))\n            >>> t.add_columns([[1.1, 1.2], ['x', 'y']], names=('b', 'c'),\n            ...               rename_duplicate=True)\n            >>> print(t)\n             a   b  b_1  c\n            --- --- --- ---\n              1 0.1 1.1  x\n              2 0.2 1.2  y\n\n        Add unnamed columns or mixin objects in the table using default names\n        or by specifying explicit names with ``names``. Names can also be overridden::\n\n            >>> t = Table()\n            >>> col_b = Column(name='b', data=['u', 'v'])\n            >>> t.add_columns([[1, 2], col_b])\n            >>> t.add_columns([[3, 4], col_b], names=['c', 'd'])\n            >>> print(t)\n            col0  b   c   d\n            ---- --- --- ---\n               1   u   3   u\n               2   v   4   v\n        \"\"\"\n        if indexes is None:\n            indexes = [len(self.columns)] * len(cols)\n        elif len(indexes) != len(cols):\n            raise ValueError('Number of indexes must match number of cols')\n\n        if names is None:\n            names = (None,) * len(cols)\n        elif len(names) != len(cols):\n            raise ValueError('Number of names must match number of cols')\n\n        default_names = [f'col{ii + len(self.columns)}'\n                         for ii in range(len(cols))]\n\n        for ii in reversed(np.argsort(indexes)):\n            self.add_column(cols[ii], index=indexes[ii], name=names[ii],\n                            default_name=default_names[ii],\n                            rename_duplicate=rename_duplicate, copy=copy)\n\n    def _replace_column_warnings(self, name, col):\n        \"\"\"\n        Same as replace_column but issues warnings under various circumstances.\n        \"\"\"\n        warns = conf.replace_warnings\n        refcount = None\n        old_col = None\n\n        if 'refcount' in warns and name in self.colnames:\n            refcount = sys.getrefcount(self[name])\n\n        if name in self.colnames:\n            old_col = self[name]\n\n        # This may raise an exception (e.g. t['a'] = 1) in which case none of\n        # the downstream code runs.\n        self.replace_column(name, col)\n\n        if 'always' in warns:\n            warnings.warn(f\"replaced column '{name}'\",\n                          TableReplaceWarning, stacklevel=3)\n\n        if 'slice' in warns:\n            try:\n                # Check for ndarray-subclass slice.  An unsliced instance\n                # has an ndarray for the base while sliced has the same class\n                # as parent.\n                if isinstance(old_col.base, old_col.__class__):\n                    msg = (\"replaced column '{}' which looks like an array slice. \"\n                           \"The new column no longer shares memory with the \"\n                           \"original array.\".format(name))\n                    warnings.warn(msg, TableReplaceWarning, stacklevel=3)\n            except AttributeError:\n                pass\n\n        if 'refcount' in warns:\n            # Did reference count change?\n            new_refcount = sys.getrefcount(self[name])\n            if refcount != new_refcount:\n                msg = (\"replaced column '{}' and the number of references \"\n                       \"to the column changed.\".format(name))\n                warnings.warn(msg, TableReplaceWarning, stacklevel=3)\n\n        if 'attributes' in warns:\n            # Any of the standard column attributes changed?\n            changed_attrs = []\n            new_col = self[name]\n            # Check base DataInfo attributes that any column will have\n            for attr in DataInfo.attr_names:\n                if getattr(old_col.info, attr) != getattr(new_col.info, attr):\n                    changed_attrs.append(attr)\n\n            if changed_attrs:\n                msg = (\"replaced column '{}' and column attributes {} changed.\"\n                       .format(name, changed_attrs))\n                warnings.warn(msg, TableReplaceWarning, stacklevel=3)\n\n    def replace_column(self, name, col, copy=True):\n        \"\"\"\n        Replace column ``name`` with the new ``col`` object.\n\n        The behavior of ``copy`` for Column objects is:\n        - copy=True: new class instance with a copy of data and deep copy of meta\n        - copy=False: new class instance with same data and a key-only copy of meta\n\n        For mixin columns:\n        - copy=True: new class instance with copy of data and deep copy of meta\n        - copy=False: original instance (no copy at all)\n\n        Parameters\n        ----------\n        name : str\n            Name of column to replace\n        col : `~astropy.table.Column` or `~numpy.ndarray` or sequence\n            New column object to replace the existing column.\n        copy : bool\n            Make copy of the input ``col``, default=True\n\n        See Also\n        --------\n        add_columns, astropy.table.hstack, update\n\n        Examples\n        --------\n        Replace column 'a' with a float version of itself::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> float_a = t['a'].astype(float)\n            >>> t.replace_column('a', float_a)\n        \"\"\"\n        if name not in self.colnames:\n            raise ValueError(f'column name {name} is not in the table')\n\n        if self[name].info.indices:\n            raise ValueError('cannot replace a table index column')\n\n        col = self._convert_data_to_col(col, name=name, copy=copy)\n        self._set_col_parent_table_and_mask(col)\n\n        # Ensure that new column is the right length, unless it is the only column\n        # in which case re-sizing is allowed.\n        if len(self.columns) > 1 and len(col) != len(self[name]):\n            raise ValueError('length of new column must match table length')\n\n        self.columns.__setitem__(name, col, validated=True)\n\n    def remove_row(self, index):\n        \"\"\"\n        Remove a row from the table.\n\n        Parameters\n        ----------\n        index : int\n            Index of row to remove\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Remove row 1 from the table::\n\n            >>> t.remove_row(1)\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              3 0.3   z\n\n        To remove several rows at the same time use remove_rows.\n        \"\"\"\n        # check the index against the types that work with np.delete\n        if not isinstance(index, (int, np.integer)):\n            raise TypeError(\"Row index must be an integer\")\n        self.remove_rows(index)\n\n    def remove_rows(self, row_specifier):\n        \"\"\"\n        Remove rows from the table.\n\n        Parameters\n        ----------\n        row_specifier : slice or int or array of int\n            Specification for rows to remove\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Remove rows 0 and 2 from the table::\n\n            >>> t.remove_rows([0, 2])\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              2 0.2   y\n\n\n        Note that there are no warnings if the slice operator extends\n        outside the data::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> t.remove_rows(slice(10, 20, 1))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n        \"\"\"\n        # Update indices\n        for index in self.indices:\n            index.remove_rows(row_specifier)\n\n        keep_mask = np.ones(len(self), dtype=bool)\n        keep_mask[row_specifier] = False\n\n        columns = self.TableColumns()\n        for name, col in self.columns.items():\n            newcol = col[keep_mask]\n            newcol.info.parent_table = self\n            columns[name] = newcol\n\n        self._replace_cols(columns)\n\n        # Revert groups to default (ungrouped) state\n        if hasattr(self, '_groups'):\n            del self._groups\n\n    def iterrows(self, *names):\n        \"\"\"\n        Iterate over rows of table returning a tuple of values for each row.\n\n        This method is especially useful when only a subset of columns are needed.\n\n        The ``iterrows`` method can be substantially faster than using the standard\n        Table row iteration (e.g. ``for row in tbl:``), since that returns a new\n        ``~astropy.table.Row`` object for each row and accessing a column in that\n        row (e.g. ``row['col0']``) is slower than tuple access.\n\n        Parameters\n        ----------\n        names : list\n            List of column names (default to all columns if no names provided)\n\n        Returns\n        -------\n        rows : iterable\n            Iterator returns tuples of row values\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table({'a': [1, 2, 3],\n            ...            'b': [1.0, 2.5, 3.0],\n            ...            'c': ['x', 'y', 'z']})\n\n        To iterate row-wise using column names::\n\n            >>> for a, c in t.iterrows('a', 'c'):\n            ...     print(a, c)\n            1 x\n            2 y\n            3 z\n\n        \"\"\"\n        if len(names) == 0:\n            names = self.colnames\n        else:\n            for name in names:\n                if name not in self.colnames:\n                    raise ValueError(f'{name} is not a valid column name')\n\n        cols = (self[name] for name in names)\n        out = zip(*cols)\n        return out\n\n    def _set_of_names_in_colnames(self, names):\n        \"\"\"Return ``names`` as a set if valid, or raise a `KeyError`.\n\n        ``names`` is valid if all elements in it are in ``self.colnames``.\n        If ``names`` is a string then it is interpreted as a single column\n        name.\n        \"\"\"\n        names = {names} if isinstance(names, str) else set(names)\n        invalid_names = names.difference(self.colnames)\n        if len(invalid_names) == 1:\n            raise KeyError(f'column \"{invalid_names.pop()}\" does not exist')\n        elif len(invalid_names) > 1:\n            raise KeyError(f'columns {invalid_names} do not exist')\n        return names\n\n    def remove_column(self, name):\n        \"\"\"\n        Remove a column from the table.\n\n        This can also be done with::\n\n          del table[name]\n\n        Parameters\n        ----------\n        name : str\n            Name of column to remove\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Remove column 'b' from the table::\n\n            >>> t.remove_column('b')\n            >>> print(t)\n             a   c\n            --- ---\n              1   x\n              2   y\n              3   z\n\n        To remove several columns at the same time use remove_columns.\n        \"\"\"\n\n        self.remove_columns([name])\n\n    def remove_columns(self, names):\n        '''\n        Remove several columns from the table.\n\n        Parameters\n        ----------\n        names : str or iterable of str\n            Names of the columns to remove\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...     names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Remove columns 'b' and 'c' from the table::\n\n            >>> t.remove_columns(['b', 'c'])\n            >>> print(t)\n             a\n            ---\n              1\n              2\n              3\n\n        Specifying only a single column also works. Remove column 'b' from the table::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']],\n            ...     names=('a', 'b', 'c'))\n            >>> t.remove_columns('b')\n            >>> print(t)\n             a   c\n            --- ---\n              1   x\n              2   y\n              3   z\n\n        This gives the same as using remove_column.\n        '''\n        for name in self._set_of_names_in_colnames(names):\n            self.columns.pop(name)\n\n    def _convert_string_dtype(self, in_kind, out_kind, encode_decode_func):\n        \"\"\"\n        Convert string-like columns to/from bytestring and unicode (internal only).\n\n        Parameters\n        ----------\n        in_kind : str\n            Input dtype.kind\n        out_kind : str\n            Output dtype.kind\n        \"\"\"\n\n        for col in self.itercols():\n            if col.dtype.kind == in_kind:\n                try:\n                    # This requires ASCII and is faster by a factor of up to ~8, so\n                    # try that first.\n                    newcol = col.__class__(col, dtype=out_kind)\n                except (UnicodeEncodeError, UnicodeDecodeError):\n                    newcol = col.__class__(encode_decode_func(col, 'utf-8'))\n\n                    # Quasi-manually copy info attributes.  Unfortunately\n                    # DataInfo.__set__ does not do the right thing in this case\n                    # so newcol.info = col.info does not get the old info attributes.\n                    for attr in col.info.attr_names - col.info._attrs_no_copy - set(['dtype']):\n                        value = deepcopy(getattr(col.info, attr))\n                        setattr(newcol.info, attr, value)\n\n                self[col.name] = newcol\n\n    def convert_bytestring_to_unicode(self):\n        \"\"\"\n        Convert bytestring columns (dtype.kind='S') to unicode (dtype.kind='U')\n        using UTF-8 encoding.\n\n        Internally this changes string columns to represent each character\n        in the string with a 4-byte UCS-4 equivalent, so it is inefficient\n        for memory but allows scripts to manipulate string arrays with\n        natural syntax.\n        \"\"\"\n        self._convert_string_dtype('S', 'U', np.char.decode)\n\n    def convert_unicode_to_bytestring(self):\n        \"\"\"\n        Convert unicode columns (dtype.kind='U') to bytestring (dtype.kind='S')\n        using UTF-8 encoding.\n\n        When exporting a unicode string array to a file, it may be desirable\n        to encode unicode columns as bytestrings.\n        \"\"\"\n        self._convert_string_dtype('U', 'S', np.char.encode)\n\n    def keep_columns(self, names):\n        '''\n        Keep only the columns specified (remove the others).\n\n        Parameters\n        ----------\n        names : str or iterable of str\n            The columns to keep. All other columns will be removed.\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1, 2, 3],[0.1, 0.2, 0.3],['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1 0.1   x\n              2 0.2   y\n              3 0.3   z\n\n        Keep only column 'a' of the table::\n\n            >>> t.keep_columns('a')\n            >>> print(t)\n             a\n            ---\n              1\n              2\n              3\n\n        Keep columns 'a' and 'c' of the table::\n\n            >>> t = Table([[1, 2, 3],[0.1, 0.2, 0.3],['x', 'y', 'z']],\n            ...           names=('a', 'b', 'c'))\n            >>> t.keep_columns(['a', 'c'])\n            >>> print(t)\n             a   c\n            --- ---\n              1   x\n              2   y\n              3   z\n        '''\n        names = self._set_of_names_in_colnames(names)\n        for colname in self.colnames:\n            if colname not in names:\n                self.columns.pop(colname)\n\n    def rename_column(self, name, new_name):\n        '''\n        Rename a column.\n\n        This can also be done directly with by setting the ``name`` attribute\n        for a column::\n\n          table[name].name = new_name\n\n        TODO: this won't work for mixins\n\n        Parameters\n        ----------\n        name : str\n            The current name of the column.\n        new_name : str\n            The new name for the column\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n            >>> t = Table([[1,2],[3,4],[5,6]], names=('a','b','c'))\n            >>> print(t)\n             a   b   c\n            --- --- ---\n              1   3   5\n              2   4   6\n\n        Renaming column 'a' to 'aa'::\n\n            >>> t.rename_column('a' , 'aa')\n            >>> print(t)\n             aa  b   c\n            --- --- ---\n              1   3   5\n              2   4   6\n        '''\n\n        if name not in self.keys():\n            raise KeyError(f\"Column {name} does not exist\")\n\n        self.columns[name].info.name = new_name\n\n    def rename_columns(self, names, new_names):\n        '''\n        Rename multiple columns.\n\n        Parameters\n        ----------\n        names : list, tuple\n            A list or tuple of existing column names.\n        new_names : list, tuple\n            A list or tuple of new column names.\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b', 'c'::\n\n            >>> t = Table([[1,2],[3,4],[5,6]], names=('a','b','c'))\n            >>> print(t)\n              a   b   c\n             --- --- ---\n              1   3   5\n              2   4   6\n\n        Renaming columns 'a' to 'aa' and 'b' to 'bb'::\n\n            >>> names = ('a','b')\n            >>> new_names = ('aa','bb')\n            >>> t.rename_columns(names, new_names)\n            >>> print(t)\n             aa  bb   c\n            --- --- ---\n              1   3   5\n              2   4   6\n        '''\n\n        if not self._is_list_or_tuple_of_str(names):\n            raise TypeError(\"input 'names' must be a tuple or a list of column names\")\n\n        if not self._is_list_or_tuple_of_str(new_names):\n            raise TypeError(\"input 'new_names' must be a tuple or a list of column names\")\n\n        if len(names) != len(new_names):\n            raise ValueError(\"input 'names' and 'new_names' list arguments must be the same length\")\n\n        for name, new_name in zip(names, new_names):\n            self.rename_column(name, new_name)\n\n    def _set_row(self, idx, colnames, vals):\n        try:\n            assert len(vals) == len(colnames)\n        except Exception:\n            raise ValueError('right hand side must be a sequence of values with '\n                             'the same length as the number of selected columns')\n\n        # Keep track of original values before setting each column so that\n        # setting row can be transactional.\n        orig_vals = []\n        cols = self.columns\n        try:\n            for name, val in zip(colnames, vals):\n                orig_vals.append(cols[name][idx])\n                cols[name][idx] = val\n        except Exception:\n            # If anything went wrong first revert the row update then raise\n            for name, val in zip(colnames, orig_vals[:-1]):\n                cols[name][idx] = val\n            raise\n\n    def add_row(self, vals=None, mask=None):\n        \"\"\"Add a new row to the end of the table.\n\n        The ``vals`` argument can be:\n\n        sequence (e.g. tuple or list)\n            Column values in the same order as table columns.\n        mapping (e.g. dict)\n            Keys corresponding to column names.  Missing values will be\n            filled with np.zeros for the column dtype.\n        `None`\n            All values filled with np.zeros for the column dtype.\n\n        This method requires that the Table object \"owns\" the underlying array\n        data.  In particular one cannot add a row to a Table that was\n        initialized with copy=False from an existing array.\n\n        The ``mask`` attribute should give (if desired) the mask for the\n        values. The type of the mask should match that of the values, i.e. if\n        ``vals`` is an iterable, then ``mask`` should also be an iterable\n        with the same length, and if ``vals`` is a mapping, then ``mask``\n        should be a dictionary.\n\n        Parameters\n        ----------\n        vals : tuple, list, dict or None\n            Use the specified values in the new row\n        mask : tuple, list, dict or None\n            Use the specified mask values in the new row\n\n        Examples\n        --------\n        Create a table with three columns 'a', 'b' and 'c'::\n\n           >>> t = Table([[1,2],[4,5],[7,8]], names=('a','b','c'))\n           >>> print(t)\n            a   b   c\n           --- --- ---\n             1   4   7\n             2   5   8\n\n        Adding a new row with entries '3' in 'a', '6' in 'b' and '9' in 'c'::\n\n           >>> t.add_row([3,6,9])\n           >>> print(t)\n             a   b   c\n             --- --- ---\n             1   4   7\n             2   5   8\n             3   6   9\n        \"\"\"\n        self.insert_row(len(self), vals, mask)\n\n    def insert_row(self, index, vals=None, mask=None):\n        \"\"\"Add a new row before the given ``index`` position in the table.\n\n        The ``vals`` argument can be:\n\n        sequence (e.g. tuple or list)\n            Column values in the same order as table columns.\n        mapping (e.g. dict)\n            Keys corresponding to column names.  Missing values will be\n            filled with np.zeros for the column dtype.\n        `None`\n            All values filled with np.zeros for the column dtype.\n\n        The ``mask`` attribute should give (if desired) the mask for the\n        values. The type of the mask should match that of the values, i.e. if\n        ``vals`` is an iterable, then ``mask`` should also be an iterable\n        with the same length, and if ``vals`` is a mapping, then ``mask``\n        should be a dictionary.\n\n        Parameters\n        ----------\n        vals : tuple, list, dict or None\n            Use the specified values in the new row\n        mask : tuple, list, dict or None\n            Use the specified mask values in the new row\n        \"\"\"\n        colnames = self.colnames\n\n        N = len(self)\n        if index < -N or index > N:\n            raise IndexError(\"Index {} is out of bounds for table with length {}\"\n                             .format(index, N))\n        if index < 0:\n            index += N\n\n        if isinstance(vals, Mapping) or vals is None:\n            # From the vals and/or mask mappings create the corresponding lists\n            # that have entries for each table column.\n            if mask is not None and not isinstance(mask, Mapping):\n                raise TypeError(\"Mismatch between type of vals and mask\")\n\n            # Now check that the mask is specified for the same keys as the\n            # values, otherwise things get really confusing.\n            if mask is not None and set(vals.keys()) != set(mask.keys()):\n                raise ValueError('keys in mask should match keys in vals')\n\n            if vals and any(name not in colnames for name in vals):\n                raise ValueError('Keys in vals must all be valid column names')\n\n            vals_list = []\n            mask_list = []\n\n            for name in colnames:\n                if vals and name in vals:\n                    vals_list.append(vals[name])\n                    mask_list.append(False if mask is None else mask[name])\n                else:\n                    col = self[name]\n                    if hasattr(col, 'dtype'):\n                        # Make a placeholder zero element of the right type which is masked.\n                        # This assumes the appropriate insert() method will broadcast a\n                        # numpy scalar to the right shape.\n                        vals_list.append(np.zeros(shape=(), dtype=col.dtype))\n\n                        # For masked table any unsupplied values are masked by default.\n                        mask_list.append(self.masked and vals is not None)\n                    else:\n                        raise ValueError(f\"Value must be supplied for column '{name}'\")\n\n            vals = vals_list\n            mask = mask_list\n\n        if isiterable(vals):\n            if mask is not None and (not isiterable(mask) or isinstance(mask, Mapping)):\n                raise TypeError(\"Mismatch between type of vals and mask\")\n\n            if len(self.columns) != len(vals):\n                raise ValueError('Mismatch between number of vals and columns')\n\n            if mask is not None:\n                if len(self.columns) != len(mask):\n                    raise ValueError('Mismatch between number of masks and columns')\n            else:\n                mask = [False] * len(self.columns)\n\n        else:\n            raise TypeError('Vals must be an iterable or mapping or None')\n\n        # Insert val at index for each column\n        columns = self.TableColumns()\n        for name, col, val, mask_ in zip(colnames, self.columns.values(), vals, mask):\n            try:\n                # If new val is masked and the existing column does not support masking\n                # then upgrade the column to a mask-enabled type: either the table-level\n                # default ColumnClass or else MaskedColumn.\n                if mask_ and isinstance(col, Column) and not isinstance(col, MaskedColumn):\n                    col_cls = (self.ColumnClass\n                               if issubclass(self.ColumnClass, self.MaskedColumn)\n                               else self.MaskedColumn)\n                    col = col_cls(col, copy=False)\n\n                newcol = col.insert(index, val, axis=0)\n\n                if len(newcol) != N + 1:\n                    raise ValueError('Incorrect length for column {} after inserting {}'\n                                     ' (expected {}, got {})'\n                                     .format(name, val, len(newcol), N + 1))\n                newcol.info.parent_table = self\n\n                # Set mask if needed and possible\n                if mask_:\n                    if hasattr(newcol, 'mask'):\n                        newcol[index] = np.ma.masked\n                    else:\n                        raise TypeError(\"mask was supplied for column '{}' but it does not \"\n                                        \"support masked values\".format(col.info.name))\n\n                columns[name] = newcol\n\n            except Exception as err:\n                raise ValueError(\"Unable to insert row because of exception in column '{}':\\n{}\"\n                                 .format(name, err)) from err\n\n        for table_index in self.indices:\n            table_index.insert_row(index, vals, self.columns.values())\n\n        self._replace_cols(columns)\n\n        # Revert groups to default (ungrouped) state\n        if hasattr(self, '_groups'):\n            del self._groups\n\n    def _replace_cols(self, columns):\n        for col, new_col in zip(self.columns.values(), columns.values()):\n            new_col.info.indices = []\n            for index in col.info.indices:\n                index.columns[index.col_position(col.info.name)] = new_col\n                new_col.info.indices.append(index)\n\n        self.columns = columns\n\n    def update(self, other, copy=True):\n        \"\"\"\n        Perform a dictionary-style update and merge metadata.\n\n        The argument ``other`` must be a |Table|, or something that can be used\n        to initialize a table. Columns from (possibly converted) ``other`` are\n        added to this table. In case of matching column names the column from\n        this table is replaced with the one from ``other``.\n\n        Parameters\n        ----------\n        other : table-like\n            Data to update this table with.\n        copy : bool\n            Whether the updated columns should be copies of or references to\n            the originals.\n\n        See Also\n        --------\n        add_columns, astropy.table.hstack, replace_column\n\n        Examples\n        --------\n        Update a table with another table::\n\n            >>> t1 = Table({'a': ['foo', 'bar'], 'b': [0., 0.]}, meta={'i': 0})\n            >>> t2 = Table({'b': [1., 2.], 'c': [7., 11.]}, meta={'n': 2})\n            >>> t1.update(t2)\n            >>> t1\n            <Table length=2>\n             a      b       c\n            str3 float64 float64\n            ---- ------- -------\n             foo     1.0     7.0\n             bar     2.0    11.0\n            >>> t1.meta\n            {'i': 0, 'n': 2}\n\n        Update a table with a dictionary::\n\n            >>> t = Table({'a': ['foo', 'bar'], 'b': [0., 0.]})\n            >>> t.update({'b': [1., 2.]})\n            >>> t\n            <Table length=2>\n             a      b\n            str3 float64\n            ---- -------\n             foo     1.0\n             bar     2.0\n        \"\"\"\n        from .operations import _merge_table_meta\n        if not isinstance(other, Table):\n            other = self.__class__(other, copy=copy)\n        common_cols = set(self.colnames).intersection(other.colnames)\n        for name, col in other.items():\n            if name in common_cols:\n                self.replace_column(name, col, copy=copy)\n            else:\n                self.add_column(col, name=name, copy=copy)\n        _merge_table_meta(self, [self, other], metadata_conflicts='silent')\n\n    def argsort(self, keys=None, kind=None, reverse=False):\n        \"\"\"\n        Return the indices which would sort the table according to one or\n        more key columns.  This simply calls the `numpy.argsort` function on\n        the table with the ``order`` parameter set to ``keys``.\n\n        Parameters\n        ----------\n        keys : str or list of str\n            The column name(s) to order the table by\n        kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional\n            Sorting algorithm used by ``numpy.argsort``.\n        reverse : bool\n            Sort in reverse order (default=False)\n\n        Returns\n        -------\n        index_array : ndarray, int\n            Array of indices that sorts the table by the specified key\n            column(s).\n        \"\"\"\n        if isinstance(keys, str):\n            keys = [keys]\n\n        # use index sorted order if possible\n        if keys is not None:\n            index = get_index(self, names=keys)\n            if index is not None:\n                idx = np.asarray(index.sorted_data())\n                return idx[::-1] if reverse else idx\n\n        kwargs = {}\n        if keys:\n            # For multiple keys return a structured array which gets sorted,\n            # while for a single key return a single ndarray.  Sorting a\n            # one-column structured array is slower than ndarray (e.g. a\n            # factor of ~6 for a 10 million long random array), and much slower\n            # for in principle sortable columns like Time, which get stored as\n            # object arrays.\n            if len(keys) > 1:\n                kwargs['order'] = keys\n                data = self.as_array(names=keys)\n            else:\n                data = self[keys[0]]\n        else:\n            # No keys provided so sort on all columns.\n            data = self.as_array()\n\n        if kind:\n            kwargs['kind'] = kind\n\n        # np.argsort will look for a possible .argsort method (e.g., for Time),\n        # and if that fails cast to an array and try sorting that way.\n        idx = np.argsort(data, **kwargs)\n\n        return idx[::-1] if reverse else idx\n\n    def sort(self, keys=None, *, kind=None, reverse=False):\n        '''\n        Sort the table according to one or more keys. This operates\n        on the existing table and does not return a new table.\n\n        Parameters\n        ----------\n        keys : str or list of str\n            The key(s) to order the table by. If None, use the\n            primary index of the Table.\n        kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional\n            Sorting algorithm used by ``numpy.argsort``.\n        reverse : bool\n            Sort in reverse order (default=False)\n\n        Examples\n        --------\n        Create a table with 3 columns::\n\n            >>> t = Table([['Max', 'Jo', 'John'], ['Miller', 'Miller', 'Jackson'],\n            ...            [12, 15, 18]], names=('firstname', 'name', 'tel'))\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                  Max  Miller  12\n                   Jo  Miller  15\n                 John Jackson  18\n\n        Sorting according to standard sorting rules, first 'name' then 'firstname'::\n\n            >>> t.sort(['name', 'firstname'])\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                 John Jackson  18\n                   Jo  Miller  15\n                  Max  Miller  12\n\n        Sorting according to standard sorting rules, first 'firstname' then 'tel',\n        in reverse order::\n\n            >>> t.sort(['firstname', 'tel'], reverse=True)\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                  Max  Miller  12\n                 John Jackson  18\n                   Jo  Miller  15\n        '''\n        if keys is None:\n            if not self.indices:\n                raise ValueError(\"Table sort requires input keys or a table index\")\n            keys = [x.info.name for x in self.indices[0].columns]\n\n        if isinstance(keys, str):\n            keys = [keys]\n\n        indexes = self.argsort(keys, kind=kind, reverse=reverse)\n\n        with self.index_mode('freeze'):\n            for name, col in self.columns.items():\n                # Make a new sorted column.  This requires that take() also copies\n                # relevant info attributes for mixin columns.\n                new_col = col.take(indexes, axis=0)\n\n                # First statement in try: will succeed if the column supports an in-place\n                # update, and matches the legacy behavior of astropy Table.  However,\n                # some mixin classes may not support this, so in that case just drop\n                # in the entire new column. See #9553 and #9536 for discussion.\n                try:\n                    col[:] = new_col\n                except Exception:\n                    # In-place update failed for some reason, exception class not\n                    # predictable for arbitrary mixin.\n                    self[col.info.name] = new_col\n\n    def reverse(self):\n        '''\n        Reverse the row order of table rows.  The table is reversed\n        in place and there are no function arguments.\n\n        Examples\n        --------\n        Create a table with three columns::\n\n            >>> t = Table([['Max', 'Jo', 'John'], ['Miller','Miller','Jackson'],\n            ...         [12,15,18]], names=('firstname','name','tel'))\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                  Max  Miller  12\n                   Jo  Miller  15\n                 John Jackson  18\n\n        Reversing order::\n\n            >>> t.reverse()\n            >>> print(t)\n            firstname   name  tel\n            --------- ------- ---\n                 John Jackson  18\n                   Jo  Miller  15\n                  Max  Miller  12\n        '''\n        for col in self.columns.values():\n            # First statement in try: will succeed if the column supports an in-place\n            # update, and matches the legacy behavior of astropy Table.  However,\n            # some mixin classes may not support this, so in that case just drop\n            # in the entire new column. See #9836, #9553, and #9536 for discussion.\n            new_col = col[::-1]\n            try:\n                col[:] = new_col\n            except Exception:\n                # In-place update failed for some reason, exception class not\n                # predictable for arbitrary mixin.\n                self[col.info.name] = new_col\n\n        for index in self.indices:\n            index.reverse()\n\n    def round(self, decimals=0):\n        '''\n        Round numeric columns in-place to the specified number of decimals.\n        Non-numeric columns will be ignored.\n\n        Examples\n        --------\n        Create three columns with different types:\n\n            >>> t = Table([[1, 4, 5], [-25.55, 12.123, 85],\n            ...     ['a', 'b', 'c']], names=('a', 'b', 'c'))\n            >>> print(t)\n             a    b     c\n            --- ------ ---\n              1 -25.55   a\n              4 12.123   b\n              5   85.0   c\n\n        Round them all to 0:\n\n            >>> t.round(0)\n            >>> print(t)\n             a    b    c\n            --- ----- ---\n              1 -26.0   a\n              4  12.0   b\n              5  85.0   c\n\n        Round column 'a' to -1 decimal:\n\n            >>> t.round({'a':-1})\n            >>> print(t)\n             a    b    c\n            --- ----- ---\n              0 -26.0   a\n              0  12.0   b\n              0  85.0   c\n\n        Parameters\n        ----------\n        decimals: int, dict\n            Number of decimals to round the columns to. If a dict is given,\n            the columns will be rounded to the number specified as the value.\n            If a certain column is not in the dict given, it will remain the\n            same.\n        '''\n        if isinstance(decimals, Mapping):\n            decimal_values = decimals.values()\n            column_names = decimals.keys()\n        elif isinstance(decimals, int):\n            decimal_values = itertools.repeat(decimals)\n            column_names = self.colnames\n        else:\n            raise ValueError(\"'decimals' argument must be an int or a dict\")\n\n        for colname, decimal in zip(column_names, decimal_values):\n            col = self.columns[colname]\n            if np.issubdtype(col.info.dtype, np.number):\n                try:\n                    np.around(col, decimals=decimal, out=col)\n                except TypeError:\n                    # Bug in numpy see https://github.com/numpy/numpy/issues/15438\n                    col[()] = np.around(col, decimals=decimal)\n\n    def copy(self, copy_data=True):\n        '''\n        Return a copy of the table.\n\n        Parameters\n        ----------\n        copy_data : bool\n            If `True` (the default), copy the underlying data array.\n            Otherwise, use the same data array. The ``meta`` is always\n            deepcopied regardless of the value for ``copy_data``.\n        '''\n        out = self.__class__(self, copy=copy_data)\n\n        # If the current table is grouped then do the same in the copy\n        if hasattr(self, '_groups'):\n            out._groups = groups.TableGroups(out, indices=self._groups._indices,\n                                             keys=self._groups._keys)\n        return out\n\n    def __deepcopy__(self, memo=None):\n        return self.copy(True)\n\n    def __copy__(self):\n        return self.copy(False)\n\n    def __lt__(self, other):\n        return super().__lt__(other)\n\n    def __gt__(self, other):\n        return super().__gt__(other)\n\n    def __le__(self, other):\n        return super().__le__(other)\n\n    def __ge__(self, other):\n        return super().__ge__(other)\n\n    def __eq__(self, other):\n        return self._rows_equal(other)\n\n    def __ne__(self, other):\n        return ~self.__eq__(other)\n\n    def _rows_equal(self, other):\n        \"\"\"\n        Row-wise comparison of table with any other object.\n\n        This is actual implementation for __eq__.\n\n        Returns a 1-D boolean numpy array showing result of row-wise comparison.\n        This is the same as the ``==`` comparison for tables.\n\n        Parameters\n        ----------\n        other : Table or DataFrame or ndarray\n             An object to compare with table\n\n        Examples\n        --------\n        Comparing one Table with other::\n\n            >>> t1 = Table([[1,2],[4,5],[7,8]], names=('a','b','c'))\n            >>> t2 = Table([[1,2],[4,5],[7,8]], names=('a','b','c'))\n            >>> t1._rows_equal(t2)\n            array([ True,  True])\n\n        \"\"\"\n\n        if isinstance(other, Table):\n            other = other.as_array()\n\n        if self.has_masked_columns:\n            if isinstance(other, np.ma.MaskedArray):\n                result = self.as_array() == other\n            else:\n                # If mask is True, then by definition the row doesn't match\n                # because the other array is not masked.\n                false_mask = np.zeros(1, dtype=[(n, bool) for n in self.dtype.names])\n                result = (self.as_array().data == other) & (self.mask == false_mask)\n        else:\n            if isinstance(other, np.ma.MaskedArray):\n                # If mask is True, then by definition the row doesn't match\n                # because the other array is not masked.\n                false_mask = np.zeros(1, dtype=[(n, bool) for n in other.dtype.names])\n                result = (self.as_array() == other.data) & (other.mask == false_mask)\n            else:\n                result = self.as_array() == other\n\n        return result\n\n    def values_equal(self, other):\n        \"\"\"\n        Element-wise comparison of table with another table, list, or scalar.\n\n        Returns a ``Table`` with the same columns containing boolean values\n        showing result of comparison.\n\n        Parameters\n        ----------\n        other : table-like object or list or scalar\n             Object to compare with table\n\n        Examples\n        --------\n        Compare one Table with other::\n\n          >>> t1 = Table([[1, 2], [4, 5], [-7, 8]], names=('a', 'b', 'c'))\n          >>> t2 = Table([[1, 2], [-4, 5], [7, 8]], names=('a', 'b', 'c'))\n          >>> t1.values_equal(t2)\n          <Table length=2>\n           a     b     c\n          bool  bool  bool\n          ---- ----- -----\n          True False False\n          True  True  True\n\n        \"\"\"\n        if isinstance(other, Table):\n            names = other.colnames\n        else:\n            try:\n                other = Table(other, copy=False)\n                names = other.colnames\n            except Exception:\n                # Broadcast other into a dict, so e.g. other = 2 will turn into\n                # other = {'a': 2, 'b': 2} and then equality does a\n                # column-by-column broadcasting.\n                names = self.colnames\n                other = {name: other for name in names}\n\n        # Require column names match but do not require same column order\n        if set(self.colnames) != set(names):\n            raise ValueError('cannot compare tables with different column names')\n\n        eqs = []\n        for name in names:\n            try:\n                np.broadcast(self[name], other[name])  # Check if broadcast-able\n                # Catch the numpy FutureWarning related to equality checking,\n                # \"elementwise comparison failed; returning scalar instead, but\n                #  in the future will perform elementwise comparison\".  Turn this\n                # into an exception since the scalar answer is not what we want.\n                with warnings.catch_warnings(record=True) as warns:\n                    warnings.simplefilter('always')\n                    eq = self[name] == other[name]\n                    if (warns and issubclass(warns[-1].category, FutureWarning)\n                            and 'elementwise comparison failed' in str(warns[-1].message)):\n                        raise FutureWarning(warns[-1].message)\n            except Exception as err:\n                raise ValueError(f'unable to compare column {name}') from err\n\n            # Be strict about the result from the comparison. E.g. SkyCoord __eq__ is just\n            # broken and completely ignores that it should return an array.\n            if not (isinstance(eq, np.ndarray)\n                    and eq.dtype is np.dtype('bool')\n                    and len(eq) == len(self)):\n                raise TypeError(f'comparison for column {name} returned {eq} '\n                                f'instead of the expected boolean ndarray')\n\n            eqs.append(eq)\n\n        out = Table(eqs, names=names)\n\n        return out\n\n    @property\n    def groups(self):\n        if not hasattr(self, '_groups'):\n            self._groups = groups.TableGroups(self)\n        return self._groups\n\n    def group_by(self, keys):\n        \"\"\"\n        Group this table by the specified ``keys``\n\n        This effectively splits the table into groups which correspond to unique\n        values of the ``keys`` grouping object.  The output is a new\n        `~astropy.table.TableGroups` which contains a copy of this table but\n        sorted by row according to ``keys``.\n\n        The ``keys`` input to `group_by` can be specified in different ways:\n\n          - String or list of strings corresponding to table column name(s)\n          - Numpy array (homogeneous or structured) with same length as this table\n          - `~astropy.table.Table` with same length as this table\n\n        Parameters\n        ----------\n        keys : str, list of str, numpy array, or `~astropy.table.Table`\n            Key grouping object\n\n        Returns\n        -------\n        out : `~astropy.table.Table`\n            New table with groups set\n        \"\"\"\n        return groups.table_group_by(self, keys)\n\n    def to_pandas(self, index=None, use_nullable_int=True):\n        \"\"\"\n        Return a :class:`pandas.DataFrame` instance\n\n        The index of the created DataFrame is controlled by the ``index``\n        argument.  For ``index=True`` or the default ``None``, an index will be\n        specified for the DataFrame if there is a primary key index on the\n        Table *and* if it corresponds to a single column.  If ``index=False``\n        then no DataFrame index will be specified.  If ``index`` is the name of\n        a column in the table then that will be the DataFrame index.\n\n        In addition to vanilla columns or masked columns, this supports Table\n        mixin columns like Quantity, Time, or SkyCoord.  In many cases these\n        objects have no analog in pandas and will be converted to a \"encoded\"\n        representation using only Column or MaskedColumn.  The exception is\n        Time or TimeDelta columns, which will be converted to the corresponding\n        representation in pandas using ``np.datetime64`` or ``np.timedelta64``.\n        See the example below.\n\n        Parameters\n        ----------\n        index : None, bool, str\n            Specify DataFrame index mode\n        use_nullable_int : bool, default=True\n            Convert integer MaskedColumn to pandas nullable integer type.\n            If ``use_nullable_int=False`` or the pandas version does not support\n            nullable integer types (version < 0.24), then the column is converted\n            to float with NaN for missing elements and a warning is issued.\n\n        Returns\n        -------\n        dataframe : :class:`pandas.DataFrame`\n            A pandas :class:`pandas.DataFrame` instance\n\n        Raises\n        ------\n        ImportError\n            If pandas is not installed\n        ValueError\n            If the Table has multi-dimensional columns\n\n        Examples\n        --------\n        Here we convert a table with a few mixins to a\n        :class:`pandas.DataFrame` instance.\n\n          >>> import pandas as pd\n          >>> from astropy.table import QTable\n          >>> import astropy.units as u\n          >>> from astropy.time import Time, TimeDelta\n          >>> from astropy.coordinates import SkyCoord\n\n          >>> q = [1, 2] * u.m\n          >>> tm = Time([1998, 2002], format='jyear')\n          >>> sc = SkyCoord([5, 6], [7, 8], unit='deg')\n          >>> dt = TimeDelta([3, 200] * u.s)\n\n          >>> t = QTable([q, tm, sc, dt], names=['q', 'tm', 'sc', 'dt'])\n\n          >>> df = t.to_pandas(index='tm')\n          >>> with pd.option_context('display.max_columns', 20):\n          ...     print(df)\n                        q  sc.ra  sc.dec              dt\n          tm\n          1998-01-01  1.0    5.0     7.0 0 days 00:00:03\n          2002-01-01  2.0    6.0     8.0 0 days 00:03:20\n\n        \"\"\"\n        from pandas import DataFrame, Series\n\n        if index is not False:\n            if index in (None, True):\n                # Default is to use the table primary key if available and a single column\n                if self.primary_key and len(self.primary_key) == 1:\n                    index = self.primary_key[0]\n                else:\n                    index = False\n            else:\n                if index not in self.colnames:\n                    raise ValueError('index must be None, False, True or a table '\n                                     'column name')\n\n        def _encode_mixins(tbl):\n            \"\"\"Encode a Table ``tbl`` that may have mixin columns to a Table with only\n            astropy Columns + appropriate meta-data to allow subsequent decoding.\n            \"\"\"\n            from . import serialize\n            from astropy.time import TimeBase, TimeDelta\n\n            # Convert any Time or TimeDelta columns and pay attention to masking\n            time_cols = [col for col in tbl.itercols() if isinstance(col, TimeBase)]\n            if time_cols:\n\n                # Make a light copy of table and clear any indices\n                new_cols = []\n                for col in tbl.itercols():\n                    new_col = col_copy(col, copy_indices=False) if col.info.indices else col\n                    new_cols.append(new_col)\n                tbl = tbl.__class__(new_cols, copy=False)\n\n                # Certain subclasses (e.g. TimeSeries) may generate new indices on\n                # table creation, so make sure there are no indices on the table.\n                for col in tbl.itercols():\n                    col.info.indices.clear()\n\n                for col in time_cols:\n                    if isinstance(col, TimeDelta):\n                        # Convert to nanoseconds (matches astropy datetime64 support)\n                        new_col = (col.sec * 1e9).astype('timedelta64[ns]')\n                        nat = np.timedelta64('NaT')\n                    else:\n                        new_col = col.datetime64.copy()\n                        nat = np.datetime64('NaT')\n                    if col.masked:\n                        new_col[col.mask] = nat\n                    tbl[col.info.name] = new_col\n\n            # Convert the table to one with no mixins, only Column objects.\n            encode_tbl = serialize.represent_mixins_as_columns(tbl)\n            return encode_tbl\n\n        tbl = _encode_mixins(self)\n\n        badcols = [name for name, col in self.columns.items() if len(col.shape) > 1]\n        if badcols:\n            raise ValueError(\n                f'Cannot convert a table with multidimensional columns to a '\n                f'pandas DataFrame. Offending columns are: {badcols}\\n'\n                f'One can filter out such columns using:\\n'\n                f'names = [name for name in tbl.colnames if len(tbl[name].shape) <= 1]\\n'\n                f'tbl[names].to_pandas(...)')\n\n        out = OrderedDict()\n\n        for name, column in tbl.columns.items():\n            if getattr(column.dtype, 'isnative', True):\n                out[name] = column\n            else:\n                out[name] = column.data.byteswap().newbyteorder('=')\n\n            if isinstance(column, MaskedColumn) and np.any(column.mask):\n                if column.dtype.kind in ['i', 'u']:\n                    pd_dtype = column.dtype.name\n                    if use_nullable_int:\n                        # Convert int64 to Int64, uint32 to UInt32, etc for nullable types\n                        pd_dtype = pd_dtype.replace('i', 'I').replace('u', 'U')\n                    out[name] = Series(out[name], dtype=pd_dtype)\n\n                    # If pandas is older than 0.24 the type may have turned to float\n                    if column.dtype.kind != out[name].dtype.kind:\n                        warnings.warn(\n                            f\"converted column '{name}' from {column.dtype} to {out[name].dtype}\",\n                            TableReplaceWarning, stacklevel=3)\n                elif column.dtype.kind not in ['f', 'c']:\n                    out[name] = column.astype(object).filled(np.nan)\n\n        kwargs = {}\n\n        if index:\n            idx = out.pop(index)\n\n            kwargs['index'] = idx\n\n            # We add the table index to Series inputs (MaskedColumn with int values) to override\n            # its default RangeIndex, see #11432\n            for v in out.values():\n                if isinstance(v, Series):\n                    v.index = idx\n\n        df = DataFrame(out, **kwargs)\n        if index:\n            # Explicitly set the pandas DataFrame index to the original table\n            # index name.\n            df.index.name = idx.info.name\n\n        return df\n\n    @classmethod\n    def from_pandas(cls, dataframe, index=False, units=None):\n        \"\"\"\n        Create a `~astropy.table.Table` from a :class:`pandas.DataFrame` instance\n\n        In addition to converting generic numeric or string columns, this supports\n        conversion of pandas Date and Time delta columns to `~astropy.time.Time`\n        and `~astropy.time.TimeDelta` columns, respectively.\n\n        Parameters\n        ----------\n        dataframe : :class:`pandas.DataFrame`\n            A pandas :class:`pandas.DataFrame` instance\n        index : bool\n            Include the index column in the returned table (default=False)\n        units: dict\n            A dict mapping column names to to a `~astropy.units.Unit`.\n            The columns will have the specified unit in the Table.\n\n        Returns\n        -------\n        table : `~astropy.table.Table`\n            A `~astropy.table.Table` (or subclass) instance\n\n        Raises\n        ------\n        ImportError\n            If pandas is not installed\n\n        Examples\n        --------\n        Here we convert a :class:`pandas.DataFrame` instance\n        to a `~astropy.table.QTable`.\n\n          >>> import numpy as np\n          >>> import pandas as pd\n          >>> from astropy.table import QTable\n\n          >>> time = pd.Series(['1998-01-01', '2002-01-01'], dtype='datetime64[ns]')\n          >>> dt = pd.Series(np.array([1, 300], dtype='timedelta64[s]'))\n          >>> df = pd.DataFrame({'time': time})\n          >>> df['dt'] = dt\n          >>> df['x'] = [3., 4.]\n          >>> with pd.option_context('display.max_columns', 20):\n          ...     print(df)\n                  time              dt    x\n          0 1998-01-01 0 days 00:00:01  3.0\n          1 2002-01-01 0 days 00:05:00  4.0\n\n          >>> QTable.from_pandas(df)\n          <QTable length=2>\n                    time              dt       x\n                    Time          TimeDelta float64\n          ----------------------- --------- -------\n          1998-01-01T00:00:00.000       1.0     3.0\n          2002-01-01T00:00:00.000     300.0     4.0\n\n        \"\"\"\n\n        out = OrderedDict()\n\n        names = list(dataframe.columns)\n        columns = [dataframe[name] for name in names]\n        datas = [np.array(column) for column in columns]\n        masks = [np.array(column.isnull()) for column in columns]\n\n        if index:\n            index_name = dataframe.index.name or 'index'\n            while index_name in names:\n                index_name = '_' + index_name + '_'\n            names.insert(0, index_name)\n            columns.insert(0, dataframe.index)\n            datas.insert(0, np.array(dataframe.index))\n            masks.insert(0, np.zeros(len(dataframe), dtype=bool))\n\n        if units is None:\n            units = [None] * len(names)\n        else:\n            if not isinstance(units, Mapping):\n                raise TypeError('Expected a Mapping \"column-name\" -> \"unit\"')\n\n            not_found = set(units.keys()) - set(names)\n            if not_found:\n                warnings.warn(f'`units` contains additional columns: {not_found}')\n\n            units = [units.get(name) for name in names]\n\n        for name, column, data, mask, unit in zip(names, columns, datas, masks, units):\n\n            if column.dtype.kind in ['u', 'i'] and np.any(mask):\n                # Special-case support for pandas nullable int\n                np_dtype = str(column.dtype).lower()\n                data = np.zeros(shape=column.shape, dtype=np_dtype)\n                data[~mask] = column[~mask]\n                out[name] = MaskedColumn(data=data, name=name, mask=mask, unit=unit, copy=False)\n                continue\n\n            if data.dtype.kind == 'O':\n                # If all elements of an object array are string-like or np.nan\n                # then coerce back to a native numpy str/unicode array.\n                string_types = (str, bytes)\n                nan = np.nan\n                if all(isinstance(x, string_types) or x is nan for x in data):\n                    # Force any missing (null) values to b''.  Numpy will\n                    # upcast to str/unicode as needed.\n                    data[mask] = b''\n\n                    # When the numpy object array is represented as a list then\n                    # numpy initializes to the correct string or unicode type.\n                    data = np.array([x for x in data])\n\n            # Numpy datetime64\n            if data.dtype.kind == 'M':\n                from astropy.time import Time\n                out[name] = Time(data, format='datetime64')\n                if np.any(mask):\n                    out[name][mask] = np.ma.masked\n                out[name].format = 'isot'\n\n            # Numpy timedelta64\n            elif data.dtype.kind == 'm':\n                from astropy.time import TimeDelta\n                data_sec = data.astype('timedelta64[ns]').astype(np.float64) / 1e9\n                out[name] = TimeDelta(data_sec, format='sec')\n                if np.any(mask):\n                    out[name][mask] = np.ma.masked\n\n            else:\n                if np.any(mask):\n                    out[name] = MaskedColumn(data=data, name=name, mask=mask, unit=unit)\n                else:\n                    out[name] = Column(data=data, name=name, unit=unit)\n\n        return cls(out)\n\n    info = TableInfo()\n\n\nclass QTable(Table):\n    \"\"\"A class to represent tables of heterogeneous data.\n\n    `~astropy.table.QTable` provides a class for heterogeneous tabular data\n    which can be easily modified, for instance adding columns or new rows.\n\n    The `~astropy.table.QTable` class is identical to `~astropy.table.Table`\n    except that columns with an associated ``unit`` attribute are converted to\n    `~astropy.units.Quantity` objects.\n\n    See also:\n\n    - https://docs.astropy.org/en/stable/table/\n    - https://docs.astropy.org/en/stable/table/mixin_columns.html\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, table-like object, optional\n        Data to initialize table.\n    masked : bool, optional\n        Specify whether the table is masked.\n    names : list, optional\n        Specify column names.\n    dtype : list, optional\n        Specify column data types.\n    meta : dict, optional\n        Metadata associated with the table.\n    copy : bool, optional\n        Copy the input data. Default is True.\n    rows : numpy ndarray, list of list, optional\n        Row-oriented data for table instead of ``data`` argument.\n    copy_indices : bool, optional\n        Copy any indices in the input data. Default is True.\n    **kwargs : dict, optional\n        Additional keyword args when converting table-like object.\n\n    \"\"\"\n\n    def _is_mixin_for_table(self, col):\n        \"\"\"\n        Determine if ``col`` should be added to the table directly as\n        a mixin column.\n        \"\"\"\n        return has_info_class(col, MixinInfo)\n\n    def _convert_col_for_table(self, col):\n        if isinstance(col, Column) and getattr(col, 'unit', None) is not None:\n            # We need to turn the column into a quantity; use subok=True to allow\n            # Quantity subclasses identified in the unit (such as u.mag()).\n            q_cls = Masked(Quantity) if isinstance(col, MaskedColumn) else Quantity\n            try:\n                qcol = q_cls(col.data, col.unit, copy=False, subok=True)\n            except Exception as exc:\n                warnings.warn(f\"column {col.info.name} has a unit but is kept as \"\n                              f\"a {col.__class__.__name__} as an attempt to \"\n                              f\"convert it to Quantity failed with:\\n{exc!r}\",\n                              AstropyUserWarning)\n            else:\n                qcol.info = col.info\n                qcol.info.indices = col.info.indices\n                col = qcol\n        else:\n            col = super()._convert_col_for_table(col)\n\n        return col\n"},{"className":"SlicedIndex","col":0,"comment":"\n    This class provides a wrapper around an actual Index object\n    to make index slicing function correctly. Since numpy expects\n    array slices to provide an actual data view, a SlicedIndex should\n    retrieve data directly from the original index and then adapt\n    it to the sliced coordinate system as appropriate.\n\n    Parameters\n    ----------\n    index : Index\n        The original Index reference\n    index_slice : tuple, slice\n        The slice to which this SlicedIndex corresponds\n    original : bool\n        Whether this SlicedIndex represents the original index itself.\n        For the most part this is similar to index[:] but certain\n        copying operations are avoided, and the slice retains the\n        length of the actual index despite modification.\n    ","endLoc":595,"id":9091,"nodeType":"Class","startLoc":399,"text":"class SlicedIndex:\n    '''\n    This class provides a wrapper around an actual Index object\n    to make index slicing function correctly. Since numpy expects\n    array slices to provide an actual data view, a SlicedIndex should\n    retrieve data directly from the original index and then adapt\n    it to the sliced coordinate system as appropriate.\n\n    Parameters\n    ----------\n    index : Index\n        The original Index reference\n    index_slice : tuple, slice\n        The slice to which this SlicedIndex corresponds\n    original : bool\n        Whether this SlicedIndex represents the original index itself.\n        For the most part this is similar to index[:] but certain\n        copying operations are avoided, and the slice retains the\n        length of the actual index despite modification.\n    '''\n\n    def __init__(self, index, index_slice, original=False):\n        self.index = index\n        self.original = original\n        self._frozen = False\n\n        if isinstance(index_slice, tuple):\n            self.start, self._stop, self.step = index_slice\n        elif isinstance(index_slice, slice):  # index_slice is an actual slice\n            num_rows = len(index.columns[0])\n            self.start, self._stop, self.step = index_slice.indices(num_rows)\n        else:\n            raise TypeError('index_slice must be tuple or slice')\n\n    @property\n    def length(self):\n        return 1 + (self.stop - self.start - 1) // self.step\n\n    @property\n    def stop(self):\n        '''\n        The stopping position of the slice, or the end of the\n        index if this is an original slice.\n        '''\n        return len(self.index) if self.original else self._stop\n\n    def __getitem__(self, item):\n        '''\n        Returns another slice of this Index slice.\n\n        Parameters\n        ----------\n        item : slice\n            Index slice\n        '''\n        if self.length <= 0:\n            # empty slice\n            return SlicedIndex(self.index, slice(1, 0))\n        start, stop, step = item.indices(self.length)\n        new_start = self.orig_coords(start)\n        new_stop = self.orig_coords(stop)\n        new_step = self.step * step\n        return SlicedIndex(self.index, (new_start, new_stop, new_step))\n\n    def sliced_coords(self, rows):\n        '''\n        Convert the input rows to the sliced coordinate system.\n\n        Parameters\n        ----------\n        rows : list\n            Rows in the original coordinate system\n\n        Returns\n        -------\n        sliced_rows : list\n            Rows in the sliced coordinate system\n        '''\n        if self.original:\n            return rows\n        else:\n            rows = np.array(rows)\n            row0 = rows - self.start\n            if self.step != 1:\n                correct_mod = np.mod(row0, self.step) == 0\n                row0 = row0[correct_mod]\n            if self.step > 0:\n                ok = (row0 >= 0) & (row0 < self.stop - self.start)\n            else:\n                ok = (row0 <= 0) & (row0 > self.stop - self.start)\n            return row0[ok] // self.step\n\n    def orig_coords(self, row):\n        '''\n        Convert the input row from sliced coordinates back\n        to original coordinates.\n\n        Parameters\n        ----------\n        row : int\n            Row in the sliced coordinate system\n\n        Returns\n        -------\n        orig_row : int\n            Row in the original coordinate system\n        '''\n        return row if self.original else self.start + row * self.step\n\n    def find(self, key):\n        return self.sliced_coords(self.index.find(key))\n\n    def where(self, col_map):\n        return self.sliced_coords(self.index.where(col_map))\n\n    def range(self, lower, upper):\n        return self.sliced_coords(self.index.range(lower, upper))\n\n    def same_prefix(self, key):\n        return self.sliced_coords(self.index.same_prefix(key))\n\n    def sorted_data(self):\n        return self.sliced_coords(self.index.sorted_data())\n\n    def replace(self, row, col, val):\n        if not self._frozen:\n            self.index.replace(self.orig_coords(row), col, val)\n\n    def get_index_or_copy(self):\n        if not self.original:\n            # replace self.index with a new object reference\n            self.index = deepcopy(self.index)\n        return self.index\n\n    def insert_row(self, pos, vals, columns):\n        if not self._frozen:\n            self.get_index_or_copy().insert_row(self.orig_coords(pos), vals, columns)\n\n    def get_row_specifier(self, row_specifier):\n        return [self.orig_coords(x) for x in\n                self.index.get_row_specifier(row_specifier)]\n\n    def remove_rows(self, row_specifier):\n        if not self._frozen:\n            self.get_index_or_copy().remove_rows(row_specifier)\n\n    def replace_rows(self, col_slice):\n        if not self._frozen:\n            self.index.replace_rows([self.orig_coords(x) for x in col_slice])\n\n    def sort(self):\n        if not self._frozen:\n            self.get_index_or_copy().sort()\n\n    def __repr__(self):\n        slice_str = '' if self.original else f' slice={self.start}:{self.stop}:{self.step}'\n        return (f'<{self.__class__.__name__} original={self.original}{slice_str}'\n                f' index={self.index}>')\n\n    def replace_col(self, prev_col, new_col):\n        self.index.replace_col(prev_col, new_col)\n\n    def reload(self):\n        self.index.reload()\n\n    def col_position(self, col_name):\n        return self.index.col_position(col_name)\n\n    def get_slice(self, col_slice, item):\n        '''\n        Return a newly created index from the given slice.\n\n        Parameters\n        ----------\n        col_slice : Column object\n            Already existing slice of a single column\n        item : list or ndarray\n            Slice for retrieval\n        '''\n        from .table import Table\n        if len(self.columns) == 1:\n            index = Index([col_slice], engine=self.data.__class__)\n            return self.__class__(index, slice(0, 0, None), original=True)\n\n        t = Table(self.columns, copy_indices=False)\n        with t.index_mode('discard_on_copy'):\n            new_cols = t[item].columns.values()\n        index = Index(new_cols, engine=self.data.__class__)\n        return self.__class__(index, slice(0, 0, None), original=True)\n\n    @property\n    def columns(self):\n        return self.index.columns\n\n    @property\n    def data(self):\n        return self.index.data"},{"col":4,"comment":"null","endLoc":435,"header":"@property\n    def length(self)","id":9092,"name":"length","nodeType":"Function","startLoc":433,"text":"@property\n    def length(self):\n        return 1 + (self.stop - self.start - 1) // self.step"},{"col":4,"comment":"\n        The stopping position of the slice, or the end of the\n        index if this is an original slice.\n        ","endLoc":443,"header":"@property\n    def stop(self)","id":9093,"name":"stop","nodeType":"Function","startLoc":437,"text":"@property\n    def stop(self):\n        '''\n        The stopping position of the slice, or the end of the\n        index if this is an original slice.\n        '''\n        return len(self.index) if self.original else self._stop"},{"col":4,"comment":"Level of maximum at a given false alarm probability.\n\n        This gives an estimate of the periodogram level corresponding to a\n        specified false alarm probability for the largest peak, assuming a\n        null hypothesis of non-varying data with Gaussian noise.\n\n        Parameters\n        ----------\n        false_alarm_probability : array-like\n            The false alarm probability (0 < fap < 1).\n        maximum_frequency : float\n            The maximum frequency of the periodogram.\n        method : {'baluev', 'davies', 'naive', 'bootstrap'}, optional\n            The approximation method to use; default='baluev'.\n        method_kwds : dict, optional\n            Additional method-specific keywords.\n\n        Returns\n        -------\n        power : np.ndarray\n            The periodogram peak height corresponding to the specified\n            false alarm probability.\n\n        Notes\n        -----\n        The true probability distribution for the largest peak cannot be\n        determined analytically, so each method here provides an approximation\n        to the value. The available methods are:\n\n        - \"baluev\" (default): the upper-limit to the alias-free probability,\n          using the approach of Baluev (2008) [1]_.\n        - \"davies\" : the Davies upper bound from Baluev (2008) [1]_.\n        - \"naive\" : the approximate probability based on an estimated\n          effective number of independent frequencies.\n        - \"bootstrap\" : the approximate probability based on bootstrap\n          resamplings of the input data.\n\n        Note also that for normalization='psd', the distribution can only be\n        computed for periodograms constructed with errors specified.\n\n        See Also\n        --------\n        distribution\n        false_alarm_probability\n\n        References\n        ----------\n        .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n        ","endLoc":704,"header":"def false_alarm_level(self, false_alarm_probability, method='baluev',\n                          samples_per_peak=5, nyquist_factor=5,\n                          minimum_frequency=None, maximum_frequency=None,\n                          method_kwds=None)","id":9094,"name":"false_alarm_level","nodeType":"Function","startLoc":634,"text":"def false_alarm_level(self, false_alarm_probability, method='baluev',\n                          samples_per_peak=5, nyquist_factor=5,\n                          minimum_frequency=None, maximum_frequency=None,\n                          method_kwds=None):\n        \"\"\"Level of maximum at a given false alarm probability.\n\n        This gives an estimate of the periodogram level corresponding to a\n        specified false alarm probability for the largest peak, assuming a\n        null hypothesis of non-varying data with Gaussian noise.\n\n        Parameters\n        ----------\n        false_alarm_probability : array-like\n            The false alarm probability (0 < fap < 1).\n        maximum_frequency : float\n            The maximum frequency of the periodogram.\n        method : {'baluev', 'davies', 'naive', 'bootstrap'}, optional\n            The approximation method to use; default='baluev'.\n        method_kwds : dict, optional\n            Additional method-specific keywords.\n\n        Returns\n        -------\n        power : np.ndarray\n            The periodogram peak height corresponding to the specified\n            false alarm probability.\n\n        Notes\n        -----\n        The true probability distribution for the largest peak cannot be\n        determined analytically, so each method here provides an approximation\n        to the value. The available methods are:\n\n        - \"baluev\" (default): the upper-limit to the alias-free probability,\n          using the approach of Baluev (2008) [1]_.\n        - \"davies\" : the Davies upper bound from Baluev (2008) [1]_.\n        - \"naive\" : the approximate probability based on an estimated\n          effective number of independent frequencies.\n        - \"bootstrap\" : the approximate probability based on bootstrap\n          resamplings of the input data.\n\n        Note also that for normalization='psd', the distribution can only be\n        computed for periodograms constructed with errors specified.\n\n        See Also\n        --------\n        distribution\n        false_alarm_probability\n\n        References\n        ----------\n        .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n        \"\"\"\n        if self.nterms != 1:\n            raise NotImplementedError(\"false alarm probability is not \"\n                                      \"implemented for multiterm periodograms.\")\n        if not (self.fit_mean or self.center_data):\n            raise NotImplementedError(\"false alarm probability is implemented \"\n                                      \"only for periodograms of centered data.\")\n\n        fmin, fmax = self.autofrequency(samples_per_peak=samples_per_peak,\n                                        nyquist_factor=nyquist_factor,\n                                        minimum_frequency=minimum_frequency,\n                                        maximum_frequency=maximum_frequency,\n                                        return_freq_limits=True)\n        return _statistics.false_alarm_level(false_alarm_probability,\n                                             fmax=fmax,\n                                             t=self._trel, y=self.y, dy=self.dy,\n                                             normalization=self.normalization,\n                                             method=method,\n                                             method_kwds=method_kwds)"},{"col":4,"comment":"\n        Returns another slice of this Index slice.\n\n        Parameters\n        ----------\n        item : slice\n            Index slice\n        ","endLoc":461,"header":"def __getitem__(self, item)","id":9095,"name":"__getitem__","nodeType":"Function","startLoc":445,"text":"def __getitem__(self, item):\n        '''\n        Returns another slice of this Index slice.\n\n        Parameters\n        ----------\n        item : slice\n            Index slice\n        '''\n        if self.length <= 0:\n            # empty slice\n            return SlicedIndex(self.index, slice(1, 0))\n        start, stop, step = item.indices(self.length)\n        new_start = self.orig_coords(start)\n        new_stop = self.orig_coords(stop)\n        new_step = self.step * step\n        return SlicedIndex(self.index, (new_start, new_stop, new_step))"},{"col":0,"comment":"Compute the approximate periodogram level given a false alarm probability\n\n    This gives an estimate of the periodogram level corresponding to a specified\n    false alarm probability for the largest peak, assuming a null hypothesis\n    of non-varying data with Gaussian noise. The true level cannot be computed\n    analytically, so each method available here is an approximation to the true\n    value.\n\n    Parameters\n    ----------\n    p : array-like\n        The false alarm probability (0 < p < 1).\n    fmax : float\n        The maximum frequency of the periodogram.\n    t, y, dy : arrays\n        The data times, values, and errors.\n    normalization : {'standard', 'model', 'log', 'psd'}, optional\n        The periodogram normalization.\n    method : {'baluev', 'davies', 'naive', 'bootstrap'}, optional\n        The approximation method to use.\n    method_kwds : dict, optional\n        Additional method-specific keywords.\n\n    Returns\n    -------\n    z : np.ndarray\n        The periodogram level.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n\n    See Also\n    --------\n    false_alarm_probability : compute the fap for a given periodogram level\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    ","endLoc":493,"header":"def false_alarm_level(p, fmax, t, y, dy, normalization,\n                      method='baluev', method_kwds=None)","id":9096,"name":"false_alarm_level","nodeType":"Function","startLoc":443,"text":"def false_alarm_level(p, fmax, t, y, dy, normalization,\n                      method='baluev', method_kwds=None):\n    \"\"\"Compute the approximate periodogram level given a false alarm probability\n\n    This gives an estimate of the periodogram level corresponding to a specified\n    false alarm probability for the largest peak, assuming a null hypothesis\n    of non-varying data with Gaussian noise. The true level cannot be computed\n    analytically, so each method available here is an approximation to the true\n    value.\n\n    Parameters\n    ----------\n    p : array-like\n        The false alarm probability (0 < p < 1).\n    fmax : float\n        The maximum frequency of the periodogram.\n    t, y, dy : arrays\n        The data times, values, and errors.\n    normalization : {'standard', 'model', 'log', 'psd'}, optional\n        The periodogram normalization.\n    method : {'baluev', 'davies', 'naive', 'bootstrap'}, optional\n        The approximation method to use.\n    method_kwds : dict, optional\n        Additional method-specific keywords.\n\n    Returns\n    -------\n    z : np.ndarray\n        The periodogram level.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n\n    See Also\n    --------\n    false_alarm_probability : compute the fap for a given periodogram level\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    \"\"\"\n    if method == 'single':\n        return inv_fap_single(p, len(t), normalization)\n    elif method not in INV_METHODS:\n        raise ValueError(f\"Unrecognized method: {method}\")\n    method = INV_METHODS[method]\n    method_kwds = method_kwds or {}\n\n    return method(p, fmax, t, y, dy, normalization, **method_kwds)"},{"col":0,"comment":"Helper function to join on SkyCoord columns using distance matching.\n\n    This function is intended for use in ``table.join()`` to allow performing a\n    table join where the key columns are both ``SkyCoord`` objects, matched by\n    computing the distance between points and accepting values below\n    ``distance``.\n\n    The distance cross-matching is done using either\n    `~astropy.coordinates.search_around_sky` or\n    `~astropy.coordinates.search_around_3d`, depending on the value of\n    ``distance_func``.  The default is ``'search_around_sky'``.\n\n    One can also provide a function object for ``distance_func``, in which case\n    it must be a function that follows the same input and output API as\n    `~astropy.coordinates.search_around_sky`. In this case the function will\n    be called with ``(skycoord1, skycoord2, distance)`` as arguments.\n\n    Parameters\n    ----------\n    distance : `~astropy.units.Quantity` ['angle', 'length']\n        Maximum distance between points to be considered a join match.\n        Must have angular or distance units.\n    distance_func : str or function\n        Specifies the function for performing the cross-match based on\n        ``distance``. If supplied as a string this specifies the name of a\n        function in `astropy.coordinates`. If supplied as a function then that\n        function is called directly.\n\n    Returns\n    -------\n    join_func : function\n        Function that accepts two ``SkyCoord`` columns (col1, col2) and returns\n        the tuple (ids1, ids2) of pair-matched unique identifiers.\n\n    Examples\n    --------\n    This example shows an inner join of two ``SkyCoord`` columns, taking any\n    sources within 0.2 deg to be a match.  Note the new ``sc_id`` column which\n    is added and provides a unique source identifier for the matches.\n\n      >>> from astropy.coordinates import SkyCoord\n      >>> import astropy.units as u\n      >>> from astropy.table import Table, join_skycoord\n      >>> from astropy import table\n\n      >>> sc1 = SkyCoord([0, 1, 1.1, 2], [0, 0, 0, 0], unit='deg')\n      >>> sc2 = SkyCoord([0.5, 1.05, 2.1], [0, 0, 0], unit='deg')\n\n      >>> join_func = join_skycoord(0.2 * u.deg)\n      >>> join_func(sc1, sc2)  # Associate each coordinate with unique source ID\n      (array([3, 1, 1, 2]), array([4, 1, 2]))\n\n      >>> t1 = Table([sc1], names=['sc'])\n      >>> t2 = Table([sc2], names=['sc'])\n      >>> t12 = table.join(t1, t2, join_funcs={'sc': join_skycoord(0.2 * u.deg)})\n      >>> print(t12)  # Note new `sc_id` column with the IDs from join_func()\n      sc_id   sc_1    sc_2\n            deg,deg deg,deg\n      ----- ------- --------\n          1 1.0,0.0 1.05,0.0\n          1 1.1,0.0 1.05,0.0\n          2 2.0,0.0  2.1,0.0\n\n    ","endLoc":208,"header":"def join_skycoord(distance, distance_func='search_around_sky')","id":9097,"name":"join_skycoord","nodeType":"Function","startLoc":94,"text":"def join_skycoord(distance, distance_func='search_around_sky'):\n    \"\"\"Helper function to join on SkyCoord columns using distance matching.\n\n    This function is intended for use in ``table.join()`` to allow performing a\n    table join where the key columns are both ``SkyCoord`` objects, matched by\n    computing the distance between points and accepting values below\n    ``distance``.\n\n    The distance cross-matching is done using either\n    `~astropy.coordinates.search_around_sky` or\n    `~astropy.coordinates.search_around_3d`, depending on the value of\n    ``distance_func``.  The default is ``'search_around_sky'``.\n\n    One can also provide a function object for ``distance_func``, in which case\n    it must be a function that follows the same input and output API as\n    `~astropy.coordinates.search_around_sky`. In this case the function will\n    be called with ``(skycoord1, skycoord2, distance)`` as arguments.\n\n    Parameters\n    ----------\n    distance : `~astropy.units.Quantity` ['angle', 'length']\n        Maximum distance between points to be considered a join match.\n        Must have angular or distance units.\n    distance_func : str or function\n        Specifies the function for performing the cross-match based on\n        ``distance``. If supplied as a string this specifies the name of a\n        function in `astropy.coordinates`. If supplied as a function then that\n        function is called directly.\n\n    Returns\n    -------\n    join_func : function\n        Function that accepts two ``SkyCoord`` columns (col1, col2) and returns\n        the tuple (ids1, ids2) of pair-matched unique identifiers.\n\n    Examples\n    --------\n    This example shows an inner join of two ``SkyCoord`` columns, taking any\n    sources within 0.2 deg to be a match.  Note the new ``sc_id`` column which\n    is added and provides a unique source identifier for the matches.\n\n      >>> from astropy.coordinates import SkyCoord\n      >>> import astropy.units as u\n      >>> from astropy.table import Table, join_skycoord\n      >>> from astropy import table\n\n      >>> sc1 = SkyCoord([0, 1, 1.1, 2], [0, 0, 0, 0], unit='deg')\n      >>> sc2 = SkyCoord([0.5, 1.05, 2.1], [0, 0, 0], unit='deg')\n\n      >>> join_func = join_skycoord(0.2 * u.deg)\n      >>> join_func(sc1, sc2)  # Associate each coordinate with unique source ID\n      (array([3, 1, 1, 2]), array([4, 1, 2]))\n\n      >>> t1 = Table([sc1], names=['sc'])\n      >>> t2 = Table([sc2], names=['sc'])\n      >>> t12 = table.join(t1, t2, join_funcs={'sc': join_skycoord(0.2 * u.deg)})\n      >>> print(t12)  # Note new `sc_id` column with the IDs from join_func()\n      sc_id   sc_1    sc_2\n            deg,deg deg,deg\n      ----- ------- --------\n          1 1.0,0.0 1.05,0.0\n          1 1.1,0.0 1.05,0.0\n          2 2.0,0.0  2.1,0.0\n\n    \"\"\"\n    if isinstance(distance_func, str):\n        import astropy.coordinates as coords\n        try:\n            distance_func = getattr(coords, distance_func)\n        except AttributeError as err:\n            raise ValueError('distance_func must be a function in astropy.coordinates') from err\n    else:\n        from inspect import isfunction\n        if not isfunction(distance_func):\n            raise ValueError('distance_func must be a str or function')\n\n    def join_func(sc1, sc2):\n\n        # Call the appropriate SkyCoord method to find pairs within distance\n        idxs1, idxs2, d2d, d3d = distance_func(sc1, sc2, distance)\n\n        # Now convert that into unique identifiers for each near-pair. This is\n        # taken to be transitive, so that if points 1 and 2 are \"near\" and points\n        # 1 and 3 are \"near\", then 1, 2, and 3 are all given the same identifier.\n        # This identifier will then be used in the table join matching.\n\n        # Identifiers for each column, initialized to all zero.\n        ids1 = np.zeros(len(sc1), dtype=int)\n        ids2 = np.zeros(len(sc2), dtype=int)\n\n        # Start the identifier count at 1\n        id_ = 1\n        for idx1, idx2 in zip(idxs1, idxs2):\n            # If this col1 point is previously identified then set corresponding\n            # col2 point to same identifier.  Likewise for col2 and col1.\n            if ids1[idx1] > 0:\n                ids2[idx2] = ids1[idx1]\n            elif ids2[idx2] > 0:\n                ids1[idx1] = ids2[idx2]\n            else:\n                # Not yet seen so set identifier for col1 and col2\n                ids1[idx1] = id_\n                ids2[idx2] = id_\n                id_ += 1\n\n        # Fill in unique identifiers for points with no near neighbor\n        for ids in (ids1, ids2):\n            for idx in np.flatnonzero(ids == 0):\n                ids[idx] = id_\n                id_ += 1\n\n        # End of enclosure join_func()\n        return ids1, ids2\n\n    return join_func"},{"col":0,"comment":"Single-frequency inverse false alarm probability\n\n    This function computes the periodogram value associated with the specified\n    single-frequency false alarm probability. This should not be confused with\n    the false alarm level of the largest peak.\n\n    Parameters\n    ----------\n    fap : array-like\n        The false alarm probability.\n    N : int\n        The number of data points from which the periodogram was computed.\n    normalization : {'standard', 'model', 'log', 'psd'}\n        The periodogram normalization.\n    dH, dK : int, optional\n        The number of parameters in the null hypothesis and the model.\n\n    Returns\n    -------\n    z : np.ndarray\n        The periodogram power corresponding to the single-peak false alarm\n        probability.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n    All expressions used here are adapted from Table 1 of Baluev 2008 [1]_.\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    ","endLoc":198,"header":"def inv_fap_single(fap, N, normalization, dH=1, dK=3)","id":9098,"name":"inv_fap_single","nodeType":"Function","startLoc":148,"text":"def inv_fap_single(fap, N, normalization, dH=1, dK=3):\n    \"\"\"Single-frequency inverse false alarm probability\n\n    This function computes the periodogram value associated with the specified\n    single-frequency false alarm probability. This should not be confused with\n    the false alarm level of the largest peak.\n\n    Parameters\n    ----------\n    fap : array-like\n        The false alarm probability.\n    N : int\n        The number of data points from which the periodogram was computed.\n    normalization : {'standard', 'model', 'log', 'psd'}\n        The periodogram normalization.\n    dH, dK : int, optional\n        The number of parameters in the null hypothesis and the model.\n\n    Returns\n    -------\n    z : np.ndarray\n        The periodogram power corresponding to the single-peak false alarm\n        probability.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n    All expressions used here are adapted from Table 1 of Baluev 2008 [1]_.\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    \"\"\"\n    fap = np.asarray(fap)\n    if dK - dH != 2:\n        raise NotImplementedError(\"Degrees of freedom != 2\")\n    Nk = N - dK\n\n    # No warnings for fap = 0; rather, just let it give the right infinity.\n    with np.errstate(divide='ignore'):\n        if normalization == 'psd':\n            return -np.log(fap)\n        elif normalization == 'standard':\n            return 1 - fap ** (2 / Nk)\n        elif normalization == 'model':\n            return -1 + fap ** (-2 / Nk)\n        elif normalization == 'log':\n            return -2 / Nk * np.log(fap)\n        else:\n            raise ValueError(f\"normalization='{normalization}' is not recognized\")"},{"col":4,"comment":"\n        Find the node associated with the given key.\n        ","endLoc":226,"header":"def find_node(self, key)","id":9099,"name":"find_node","nodeType":"Function","startLoc":220,"text":"def find_node(self, key):\n        '''\n        Find the node associated with the given key.\n        '''\n        if self.root is None:\n            return (None, None)\n        return self._find_recursive(key, self.root, None)"},{"col":4,"comment":"null","endLoc":255,"header":"def _find_recursive(self, key, node, parent)","id":9100,"name":"_find_recursive","nodeType":"Function","startLoc":242,"text":"def _find_recursive(self, key, node, parent):\n        try:\n            if key == node.key:\n                return (node, parent)\n            elif key > node.key:\n                if node.right is None:\n                    return (None, None)\n                return self._find_recursive(key, node.right, node)\n            else:\n                if node.left is None:\n                    return (None, None)\n                return self._find_recursive(key, node.left, node)\n        except TypeError:  # wrong key type\n            return (None, None)"},{"col":4,"comment":"\n        Decrement all rows larger than the given row.\n        ","endLoc":233,"header":"def shift_left(self, row)","id":9101,"name":"shift_left","nodeType":"Function","startLoc":228,"text":"def shift_left(self, row):\n        '''\n        Decrement all rows larger than the given row.\n        '''\n        for node in self.traverse():\n            node.data = [x - 1 if x > row else x for x in node.data]"},{"attributeType":"null","col":4,"comment":"null","endLoc":102,"id":9102,"name":"available_methods","nodeType":"Attribute","startLoc":102,"text":"available_methods"},{"attributeType":"null","col":12,"comment":"null","endLoc":123,"id":9103,"name":"_tstart","nodeType":"Attribute","startLoc":123,"text":"self._tstart"},{"attributeType":"null","col":8,"comment":"null","endLoc":117,"id":9104,"name":"t","nodeType":"Attribute","startLoc":117,"text":"self.t"},{"attributeType":"null","col":8,"comment":"null","endLoc":126,"id":9105,"name":"_trel","nodeType":"Attribute","startLoc":126,"text":"self._trel"},{"attributeType":"null","col":28,"comment":"null","endLoc":126,"id":9106,"name":"dy","nodeType":"Attribute","startLoc":126,"text":"self.dy"},{"col":0,"comment":"Helper function to join table columns using distance matching.\n\n    This function is intended for use in ``table.join()`` to allow performing\n    a table join where the key columns are matched by computing the distance\n    between points and accepting values below ``distance``. This numerical\n    \"fuzzy\" match can apply to 1-D or 2-D columns, where in the latter case\n    the distance is a vector distance.\n\n    The distance cross-matching is done using `scipy.spatial.cKDTree`. If\n    necessary you can tweak the default behavior by providing ``dict`` values\n    for the ``kdtree_args`` or ``query_args``.\n\n    Parameters\n    ----------\n    distance : float or `~astropy.units.Quantity` ['length']\n        Maximum distance between points to be considered a join match\n    kdtree_args : dict, None\n        Optional extra args for `~scipy.spatial.cKDTree`\n    query_args : dict, None\n        Optional extra args for `~scipy.spatial.cKDTree.query_ball_tree`\n\n    Returns\n    -------\n    join_func : function\n        Function that accepts (skycoord1, skycoord2) and returns the tuple\n        (ids1, ids2) of pair-matched unique identifiers.\n\n    Examples\n    --------\n\n      >>> from astropy.table import Table, join_distance\n      >>> from astropy import table\n\n      >>> c1 = [0, 1, 1.1, 2]\n      >>> c2 = [0.5, 1.05, 2.1]\n\n      >>> t1 = Table([c1], names=['col'])\n      >>> t2 = Table([c2], names=['col'])\n      >>> t12 = table.join(t1, t2, join_type='outer', join_funcs={'col': join_distance(0.2)})\n      >>> print(t12)\n      col_id col_1 col_2\n      ------ ----- -----\n           1   1.0  1.05\n           1   1.1  1.05\n           2   2.0   2.1\n           3   0.0    --\n           4    --   0.5\n\n    ","endLoc":336,"header":"def join_distance(distance, kdtree_args=None, query_args=None)","id":9107,"name":"join_distance","nodeType":"Function","startLoc":211,"text":"def join_distance(distance, kdtree_args=None, query_args=None):\n    \"\"\"Helper function to join table columns using distance matching.\n\n    This function is intended for use in ``table.join()`` to allow performing\n    a table join where the key columns are matched by computing the distance\n    between points and accepting values below ``distance``. This numerical\n    \"fuzzy\" match can apply to 1-D or 2-D columns, where in the latter case\n    the distance is a vector distance.\n\n    The distance cross-matching is done using `scipy.spatial.cKDTree`. If\n    necessary you can tweak the default behavior by providing ``dict`` values\n    for the ``kdtree_args`` or ``query_args``.\n\n    Parameters\n    ----------\n    distance : float or `~astropy.units.Quantity` ['length']\n        Maximum distance between points to be considered a join match\n    kdtree_args : dict, None\n        Optional extra args for `~scipy.spatial.cKDTree`\n    query_args : dict, None\n        Optional extra args for `~scipy.spatial.cKDTree.query_ball_tree`\n\n    Returns\n    -------\n    join_func : function\n        Function that accepts (skycoord1, skycoord2) and returns the tuple\n        (ids1, ids2) of pair-matched unique identifiers.\n\n    Examples\n    --------\n\n      >>> from astropy.table import Table, join_distance\n      >>> from astropy import table\n\n      >>> c1 = [0, 1, 1.1, 2]\n      >>> c2 = [0.5, 1.05, 2.1]\n\n      >>> t1 = Table([c1], names=['col'])\n      >>> t2 = Table([c2], names=['col'])\n      >>> t12 = table.join(t1, t2, join_type='outer', join_funcs={'col': join_distance(0.2)})\n      >>> print(t12)\n      col_id col_1 col_2\n      ------ ----- -----\n           1   1.0  1.05\n           1   1.1  1.05\n           2   2.0   2.1\n           3   0.0    --\n           4    --   0.5\n\n    \"\"\"\n    try:\n        from scipy.spatial import cKDTree\n    except ImportError as exc:\n        raise ImportError('scipy is required to use join_distance()') from exc\n\n    if kdtree_args is None:\n        kdtree_args = {}\n    if query_args is None:\n        query_args = {}\n\n    def join_func(col1, col2):\n        if col1.ndim > 2 or col2.ndim > 2:\n            raise ValueError('columns for isclose_join must be 1- or 2-dimensional')\n\n        if isinstance(distance, Quantity):\n            # Convert to np.array with common unit\n            col1 = col1.to_value(distance.unit)\n            col2 = col2.to_value(distance.unit)\n            dist = distance.value\n        else:\n            # Convert to np.array to allow later in-place shape changing\n            col1 = np.asarray(col1)\n            col2 = np.asarray(col2)\n            dist = distance\n\n        # Ensure columns are pure np.array and are 2-D for use with KDTree\n        if col1.ndim == 1:\n            col1.shape = col1.shape + (1,)\n        if col2.ndim == 1:\n            col2.shape = col2.shape + (1,)\n\n        # Cross-match col1 and col2 within dist using KDTree\n        kd1 = cKDTree(col1, **kdtree_args)\n        kd2 = cKDTree(col2, **kdtree_args)\n        nears = kd1.query_ball_tree(kd2, r=dist, **query_args)\n\n        # Output of above is nears which is a list of lists, where the outer\n        # list corresponds to each item in col1, and where the inner lists are\n        # indexes into col2 of elements within the distance tolerance.  This\n        # identifies col1 / col2 near pairs.\n\n        # Now convert that into unique identifiers for each near-pair. This is\n        # taken to be transitive, so that if points 1 and 2 are \"near\" and points\n        # 1 and 3 are \"near\", then 1, 2, and 3 are all given the same identifier.\n        # This identifier will then be used in the table join matching.\n\n        # Identifiers for each column, initialized to all zero.\n        ids1 = np.zeros(len(col1), dtype=int)\n        ids2 = np.zeros(len(col2), dtype=int)\n\n        # Start the identifier count at 1\n        id_ = 1\n        for idx1, idxs2 in enumerate(nears):\n            for idx2 in idxs2:\n                # If this col1 point is previously identified then set corresponding\n                # col2 point to same identifier.  Likewise for col2 and col1.\n                if ids1[idx1] > 0:\n                    ids2[idx2] = ids1[idx1]\n                elif ids2[idx2] > 0:\n                    ids1[idx1] = ids2[idx2]\n                else:\n                    # Not yet seen so set identifier for col1 and col2\n                    ids1[idx1] = id_\n                    ids2[idx2] = id_\n                    id_ += 1\n\n        # Fill in unique identifiers for points with no near neighbor\n        for ids in (ids1, ids2):\n            for idx in np.flatnonzero(ids == 0):\n                ids[idx] = id_\n                id_ += 1\n\n        # End of enclosure join_func()\n        return ids1, ids2\n\n    return join_func"},{"col":4,"comment":"\n        Convert the input row from sliced coordinates back\n        to original coordinates.\n\n        Parameters\n        ----------\n        row : int\n            Row in the sliced coordinate system\n\n        Returns\n        -------\n        orig_row : int\n            Row in the original coordinate system\n        ","endLoc":506,"header":"def orig_coords(self, row)","id":9108,"name":"orig_coords","nodeType":"Function","startLoc":491,"text":"def orig_coords(self, row):\n        '''\n        Convert the input row from sliced coordinates back\n        to original coordinates.\n\n        Parameters\n        ----------\n        row : int\n            Row in the sliced coordinate system\n\n        Returns\n        -------\n        orig_row : int\n            Row in the original coordinate system\n        '''\n        return row if self.original else self.start + row * self.step"},{"col":4,"comment":"\n        Convert the input rows to the sliced coordinate system.\n\n        Parameters\n        ----------\n        rows : list\n            Rows in the original coordinate system\n\n        Returns\n        -------\n        sliced_rows : list\n            Rows in the sliced coordinate system\n        ","endLoc":489,"header":"def sliced_coords(self, rows)","id":9110,"name":"sliced_coords","nodeType":"Function","startLoc":463,"text":"def sliced_coords(self, rows):\n        '''\n        Convert the input rows to the sliced coordinate system.\n\n        Parameters\n        ----------\n        rows : list\n            Rows in the original coordinate system\n\n        Returns\n        -------\n        sliced_rows : list\n            Rows in the sliced coordinate system\n        '''\n        if self.original:\n            return rows\n        else:\n            rows = np.array(rows)\n            row0 = rows - self.start\n            if self.step != 1:\n                correct_mod = np.mod(row0, self.step) == 0\n                row0 = row0[correct_mod]\n            if self.step > 0:\n                ok = (row0 >= 0) & (row0 < self.stop - self.start)\n            else:\n                ok = (row0 <= 0) & (row0 > self.stop - self.start)\n            return row0[ok] // self.step"},{"col":4,"comment":"null","endLoc":509,"header":"def find(self, key)","id":9111,"name":"find","nodeType":"Function","startLoc":508,"text":"def find(self, key):\n        return self.sliced_coords(self.index.find(key))"},{"attributeType":"null","col":8,"comment":"null","endLoc":128,"id":9112,"name":"fit_mean","nodeType":"Attribute","startLoc":128,"text":"self.fit_mean"},{"col":0,"comment":"\n    Perform a join of the left table with the right table on specified keys.\n\n    Parameters\n    ----------\n    left : `~astropy.table.Table`-like object\n        Left side table in the join. If not a Table, will call ``Table(left)``\n    right : `~astropy.table.Table`-like object\n        Right side table in the join. If not a Table, will call ``Table(right)``\n    keys : str or list of str\n        Name(s) of column(s) used to match rows of left and right tables.\n        Default is to use all columns which are common to both tables.\n    join_type : str\n        Join type ('inner' | 'outer' | 'left' | 'right' | 'cartesian'), default is 'inner'\n    keys_left : str or list of str or list of column-like, optional\n        Left column(s) used to match rows instead of ``keys`` arg. This can be\n        be a single left table column name or list of column names, or a list of\n        column-like values with the same lengths as the left table.\n    keys_right : str or list of str or list of column-like, optional\n        Same as ``keys_left``, but for the right side of the join.\n    uniq_col_name : str or None\n        String generate a unique output column name in case of a conflict.\n        The default is '{col_name}_{table_name}'.\n    table_names : list of str or None\n        Two-element list of table names used when generating unique output\n        column names.  The default is ['1', '2'].\n    metadata_conflicts : str\n        How to proceed with metadata conflicts. This should be one of:\n            * ``'silent'``: silently pick the last conflicting meta-data value\n            * ``'warn'``: pick the last conflicting meta-data value, but emit a warning (default)\n            * ``'error'``: raise an exception.\n    join_funcs : dict, None\n        Dict of functions to use for matching the corresponding key column(s).\n        See `~astropy.table.join_skycoord` for an example and details.\n\n    Returns\n    -------\n    joined_table : `~astropy.table.Table` object\n        New table containing the result of the join operation.\n    ","endLoc":401,"header":"def join(left, right, keys=None, join_type='inner', *,\n         keys_left=None, keys_right=None,\n         uniq_col_name='{col_name}_{table_name}',\n         table_names=['1', '2'], metadata_conflicts='warn',\n         join_funcs=None)","id":9113,"name":"join","nodeType":"Function","startLoc":339,"text":"def join(left, right, keys=None, join_type='inner', *,\n         keys_left=None, keys_right=None,\n         uniq_col_name='{col_name}_{table_name}',\n         table_names=['1', '2'], metadata_conflicts='warn',\n         join_funcs=None):\n    \"\"\"\n    Perform a join of the left table with the right table on specified keys.\n\n    Parameters\n    ----------\n    left : `~astropy.table.Table`-like object\n        Left side table in the join. If not a Table, will call ``Table(left)``\n    right : `~astropy.table.Table`-like object\n        Right side table in the join. If not a Table, will call ``Table(right)``\n    keys : str or list of str\n        Name(s) of column(s) used to match rows of left and right tables.\n        Default is to use all columns which are common to both tables.\n    join_type : str\n        Join type ('inner' | 'outer' | 'left' | 'right' | 'cartesian'), default is 'inner'\n    keys_left : str or list of str or list of column-like, optional\n        Left column(s) used to match rows instead of ``keys`` arg. This can be\n        be a single left table column name or list of column names, or a list of\n        column-like values with the same lengths as the left table.\n    keys_right : str or list of str or list of column-like, optional\n        Same as ``keys_left``, but for the right side of the join.\n    uniq_col_name : str or None\n        String generate a unique output column name in case of a conflict.\n        The default is '{col_name}_{table_name}'.\n    table_names : list of str or None\n        Two-element list of table names used when generating unique output\n        column names.  The default is ['1', '2'].\n    metadata_conflicts : str\n        How to proceed with metadata conflicts. This should be one of:\n            * ``'silent'``: silently pick the last conflicting meta-data value\n            * ``'warn'``: pick the last conflicting meta-data value, but emit a warning (default)\n            * ``'error'``: raise an exception.\n    join_funcs : dict, None\n        Dict of functions to use for matching the corresponding key column(s).\n        See `~astropy.table.join_skycoord` for an example and details.\n\n    Returns\n    -------\n    joined_table : `~astropy.table.Table` object\n        New table containing the result of the join operation.\n    \"\"\"\n\n    # Try converting inputs to Table as needed\n    if not isinstance(left, Table):\n        left = Table(left)\n    if not isinstance(right, Table):\n        right = Table(right)\n\n    col_name_map = OrderedDict()\n    out = _join(left, right, keys, join_type,\n                uniq_col_name, table_names, col_name_map, metadata_conflicts,\n                join_funcs,\n                keys_left=keys_left, keys_right=keys_right)\n\n    # Merge the column and table meta data. Table subclasses might override\n    # these methods for custom merge behavior.\n    _merge_table_meta(out, [left, right], metadata_conflicts=metadata_conflicts)\n\n    return out"},{"col":4,"comment":"\n        Return the row values corresponding to key, in sorted order.\n\n        Parameters\n        ----------\n        key : tuple\n            Values to search for in each column\n        ","endLoc":252,"header":"def find(self, key)","id":9114,"name":"find","nodeType":"Function","startLoc":243,"text":"def find(self, key):\n        '''\n        Return the row values corresponding to key, in sorted order.\n\n        Parameters\n        ----------\n        key : tuple\n            Values to search for in each column\n        '''\n        return self.data.find(key)"},{"attributeType":"null","col":8,"comment":"null","endLoc":131,"id":9115,"name":"normalization","nodeType":"Attribute","startLoc":131,"text":"self.normalization"},{"col":4,"comment":"\n        Return nodes of the BST in the given order.\n\n        Parameters\n        ----------\n        order : str\n            The order in which to recursively search the BST.\n            Possible values are:\n            \"preorder\": current node, left subtree, right subtree\n            \"inorder\": left subtree, current node, right subtree\n            \"postorder\": left subtree, right subtree, current node\n        ","endLoc":276,"header":"def traverse(self, order='inorder')","id":9116,"name":"traverse","nodeType":"Function","startLoc":257,"text":"def traverse(self, order='inorder'):\n        '''\n        Return nodes of the BST in the given order.\n\n        Parameters\n        ----------\n        order : str\n            The order in which to recursively search the BST.\n            Possible values are:\n            \"preorder\": current node, left subtree, right subtree\n            \"inorder\": left subtree, current node, right subtree\n            \"postorder\": left subtree, right subtree, current node\n        '''\n        if order == 'preorder':\n            return self._preorder(self.root, [])\n        elif order == 'inorder':\n            return self._inorder(self.root, [])\n        elif order == 'postorder':\n            return self._postorder(self.root, [])\n        raise ValueError(f\"Invalid traversal method: \\\"{order}\\\"\")"},{"col":4,"comment":"null","endLoc":306,"header":"def _preorder(self, node, lst)","id":9117,"name":"_preorder","nodeType":"Function","startLoc":300,"text":"def _preorder(self, node, lst):\n        if node is None:\n            return lst\n        lst.append(node)\n        self._preorder(node.left, lst)\n        self._preorder(node.right, lst)\n        return lst"},{"col":4,"comment":"null","endLoc":314,"header":"def _inorder(self, node, lst)","id":9118,"name":"_inorder","nodeType":"Function","startLoc":308,"text":"def _inorder(self, node, lst):\n        if node is None:\n            return lst\n        self._inorder(node.left, lst)\n        lst.append(node)\n        self._inorder(node.right, lst)\n        return lst"},{"col":4,"comment":"null","endLoc":322,"header":"def _postorder(self, node, lst)","id":9119,"name":"_postorder","nodeType":"Function","startLoc":316,"text":"def _postorder(self, node, lst):\n        if node is None:\n            return lst\n        self._postorder(node.left, lst)\n        self._postorder(node.right, lst)\n        lst.append(node)\n        return lst"},{"col":4,"comment":"\n        Increment all rows greater than or equal to the given row.\n        ","endLoc":240,"header":"def shift_right(self, row)","id":9120,"name":"shift_right","nodeType":"Function","startLoc":235,"text":"def shift_right(self, row):\n        '''\n        Increment all rows greater than or equal to the given row.\n        '''\n        for node in self.traverse():\n            node.data = [x + 1 if x >= row else x for x in node.data]"},{"col":4,"comment":"null","endLoc":512,"header":"def where(self, col_map)","id":9121,"name":"where","nodeType":"Function","startLoc":511,"text":"def where(self, col_map):\n        return self.sliced_coords(self.index.where(col_map))"},{"col":4,"comment":"\n        Return BST items in order as (key, data) pairs.\n        ","endLoc":282,"header":"def items(self)","id":9122,"name":"items","nodeType":"Function","startLoc":278,"text":"def items(self):\n        '''\n        Return BST items in order as (key, data) pairs.\n        '''\n        return [(x.key, x.data) for x in self.traverse()]"},{"attributeType":"null","col":8,"comment":"null","endLoc":129,"id":9123,"name":"center_data","nodeType":"Attribute","startLoc":129,"text":"self.center_data"},{"col":4,"comment":"null","endLoc":515,"header":"def range(self, lower, upper)","id":9124,"name":"range","nodeType":"Function","startLoc":514,"text":"def range(self, lower, upper):\n        return self.sliced_coords(self.index.range(lower, upper))"},{"col":4,"comment":"\n        Make row order align with key order.\n        ","endLoc":292,"header":"def sort(self)","id":9125,"name":"sort","nodeType":"Function","startLoc":284,"text":"def sort(self):\n        '''\n        Make row order align with key order.\n        '''\n        i = 0\n        for node in self.traverse():\n            num_rows = len(node.data)\n            node.data = [x for x in range(i, i + num_rows)]\n            i += num_rows"},{"col":0,"comment":"\n    Perform a join of the left and right Tables on specified keys.\n\n    Parameters\n    ----------\n    left : Table\n        Left side table in the join\n    right : Table\n        Right side table in the join\n    keys : str or list of str\n        Name(s) of column(s) used to match rows of left and right tables.\n        Default is to use all columns which are common to both tables.\n    join_type : str\n        Join type ('inner' | 'outer' | 'left' | 'right' | 'cartesian'), default is 'inner'\n    uniq_col_name : str or None\n        String generate a unique output column name in case of a conflict.\n        The default is '{col_name}_{table_name}'.\n    table_names : list of str or None\n        Two-element list of table names used when generating unique output\n        column names.  The default is ['1', '2'].\n    col_name_map : empty dict or None\n        If passed as a dict then it will be updated in-place with the\n        mapping of output to input column names.\n    metadata_conflicts : str\n        How to proceed with metadata conflicts. This should be one of:\n            * ``'silent'``: silently pick the last conflicting meta-data value\n            * ``'warn'``: pick the last conflicting meta-data value, but emit a warning (default)\n            * ``'error'``: raise an exception.\n    join_funcs : dict, None\n        Dict of functions to use for matching the corresponding key column(s).\n        See `~astropy.table.join_skycoord` for an example and details.\n\n    Returns\n    -------\n    joined_table : `~astropy.table.Table` object\n        New table containing the result of the join operation.\n    ","endLoc":1257,"header":"def _join(left, right, keys=None, join_type='inner',\n          uniq_col_name='{col_name}_{table_name}',\n          table_names=['1', '2'],\n          col_name_map=None, metadata_conflicts='warn',\n          join_funcs=None,\n          keys_left=None, keys_right=None)","id":9126,"name":"_join","nodeType":"Function","startLoc":1058,"text":"def _join(left, right, keys=None, join_type='inner',\n          uniq_col_name='{col_name}_{table_name}',\n          table_names=['1', '2'],\n          col_name_map=None, metadata_conflicts='warn',\n          join_funcs=None,\n          keys_left=None, keys_right=None):\n    \"\"\"\n    Perform a join of the left and right Tables on specified keys.\n\n    Parameters\n    ----------\n    left : Table\n        Left side table in the join\n    right : Table\n        Right side table in the join\n    keys : str or list of str\n        Name(s) of column(s) used to match rows of left and right tables.\n        Default is to use all columns which are common to both tables.\n    join_type : str\n        Join type ('inner' | 'outer' | 'left' | 'right' | 'cartesian'), default is 'inner'\n    uniq_col_name : str or None\n        String generate a unique output column name in case of a conflict.\n        The default is '{col_name}_{table_name}'.\n    table_names : list of str or None\n        Two-element list of table names used when generating unique output\n        column names.  The default is ['1', '2'].\n    col_name_map : empty dict or None\n        If passed as a dict then it will be updated in-place with the\n        mapping of output to input column names.\n    metadata_conflicts : str\n        How to proceed with metadata conflicts. This should be one of:\n            * ``'silent'``: silently pick the last conflicting meta-data value\n            * ``'warn'``: pick the last conflicting meta-data value, but emit a warning (default)\n            * ``'error'``: raise an exception.\n    join_funcs : dict, None\n        Dict of functions to use for matching the corresponding key column(s).\n        See `~astropy.table.join_skycoord` for an example and details.\n\n    Returns\n    -------\n    joined_table : `~astropy.table.Table` object\n        New table containing the result of the join operation.\n    \"\"\"\n    # Store user-provided col_name_map until the end\n    _col_name_map = col_name_map\n\n    # Special column name for cartesian join, should never collide with real column\n    cartesian_index_name = '__table_cartesian_join_temp_index__'\n\n    if join_type not in ('inner', 'outer', 'left', 'right', 'cartesian'):\n        raise ValueError(\"The 'join_type' argument should be in 'inner', \"\n                         \"'outer', 'left', 'right', or 'cartesian' \"\n                         \"(got '{}' instead)\".\n                         format(join_type))\n\n    if join_type == 'cartesian':\n        if keys:\n            raise ValueError('cannot supply keys for a cartesian join')\n\n        if join_funcs:\n            raise ValueError('cannot supply join_funcs for a cartesian join')\n\n        # Make light copies of left and right, then add temporary index columns\n        # with all the same value so later an outer join turns into a cartesian join.\n        left = left.copy(copy_data=False)\n        right = right.copy(copy_data=False)\n        left[cartesian_index_name] = np.uint8(0)\n        right[cartesian_index_name] = np.uint8(0)\n        keys = (cartesian_index_name, )\n\n    # Handle the case of join key columns that are different between left and\n    # right via keys_left/keys_right args. This is done by saving the original\n    # input tables and making new left and right tables that contain only the\n    # key cols but with common column names ['0', '1', etc]. This sets `keys` to\n    # those fake key names in the left and right tables\n    if keys_left is not None or keys_right is not None:\n        left_orig = left\n        right_orig = right\n        left, right, keys = _join_keys_left_right(\n            left, right, keys, keys_left, keys_right, join_funcs)\n\n    if keys is None:\n        keys = tuple(name for name in left.colnames if name in right.colnames)\n        if len(keys) == 0:\n            raise TableMergeError('No keys in common between left and right tables')\n    elif isinstance(keys, str):\n        # If we have a single key, put it in a tuple\n        keys = (keys,)\n\n    # Check the key columns\n    for arr, arr_label in ((left, 'Left'), (right, 'Right')):\n        for name in keys:\n            if name not in arr.colnames:\n                raise TableMergeError('{} table does not have key column {!r}'\n                                      .format(arr_label, name))\n            if hasattr(arr[name], 'mask') and np.any(arr[name].mask):\n                raise TableMergeError('{} key column {!r} has missing values'\n                                      .format(arr_label, name))\n\n    if join_funcs is not None:\n        if not all(key in keys for key in join_funcs):\n            raise ValueError(f'join_funcs keys {join_funcs.keys()} must be a '\n                             f'subset of join keys {keys}')\n        left, right, keys = _apply_join_funcs(left, right, keys, join_funcs)\n\n    len_left, len_right = len(left), len(right)\n\n    if len_left == 0 or len_right == 0:\n        raise ValueError('input tables for join must both have at least one row')\n\n    try:\n        idxs, idx_sort = _get_join_sort_idxs(keys, left, right)\n    except NotImplementedError:\n        raise TypeError('one or more key columns are not sortable')\n\n    # Now that we have idxs and idx_sort, revert to the original table args to\n    # carry on with making the output joined table. `keys` is set to to an empty\n    # list so that all original left and right columns are included in the\n    # output table.\n    if keys_left is not None or keys_right is not None:\n        keys = []\n        left = left_orig\n        right = right_orig\n\n    # Joined array dtype as a list of descr (name, type_str, shape) tuples\n    col_name_map = get_col_name_map([left, right], keys, uniq_col_name, table_names)\n    out_descrs = get_descrs([left, right], col_name_map)\n\n    # Main inner loop in Cython to compute the cartesian product\n    # indices for the given join type\n    int_join_type = {'inner': 0, 'outer': 1, 'left': 2, 'right': 3,\n                     'cartesian': 1}[join_type]\n    masked, n_out, left_out, left_mask, right_out, right_mask = \\\n        _np_utils.join_inner(idxs, idx_sort, len_left, int_join_type)\n\n    out = _get_out_class([left, right])()\n\n    for out_name, dtype, shape in out_descrs:\n        if out_name == cartesian_index_name:\n            continue\n\n        left_name, right_name = col_name_map[out_name]\n        if left_name and right_name:  # this is a key which comes from left and right\n            cols = [left[left_name], right[right_name]]\n\n            col_cls = _get_out_class(cols)\n            if not hasattr(col_cls.info, 'new_like'):\n                raise NotImplementedError('join unavailable for mixin column type(s): {}'\n                                          .format(col_cls.__name__))\n\n            out[out_name] = col_cls.info.new_like(cols, n_out, metadata_conflicts, out_name)\n            out[out_name][:] = np.where(right_mask,\n                                        left[left_name].take(left_out),\n                                        right[right_name].take(right_out))\n            continue\n        elif left_name:  # out_name came from the left table\n            name, array, array_out, array_mask = left_name, left, left_out, left_mask\n        elif right_name:\n            name, array, array_out, array_mask = right_name, right, right_out, right_mask\n        else:\n            raise TableMergeError('Unexpected column names (maybe one is \"\"?)')\n\n        # Select the correct elements from the original table\n        col = array[name][array_out]\n\n        # If the output column is masked then set the output column masking\n        # accordingly.  Check for columns that don't support a mask attribute.\n        if masked and np.any(array_mask):\n            # If col is a Column but not MaskedColumn then upgrade at this point\n            # because masking is required.\n            if isinstance(col, Column) and not isinstance(col, MaskedColumn):\n                col = out.MaskedColumn(col, copy=False)\n\n            if isinstance(col, Quantity) and not isinstance(col, Masked):\n                col = Masked(col, copy=False)\n\n            # array_mask is 1-d corresponding to length of output column.  We need\n            # make it have the correct shape for broadcasting, i.e. (length, 1, 1, ..).\n            # Mixin columns might not have ndim attribute so use len(col.shape).\n            array_mask.shape = (col.shape[0],) + (1,) * (len(col.shape) - 1)\n\n            # Now broadcast to the correct final shape\n            array_mask = np.broadcast_to(array_mask, col.shape)\n\n            try:\n                col[array_mask] = col.info.mask_val\n            except Exception as err:  # Not clear how different classes will fail here\n                raise NotImplementedError(\n                    \"join requires masking column '{}' but column\"\n                    \" type {} does not support masking\"\n                    .format(out_name, col.__class__.__name__)) from err\n\n        # Set the output table column to the new joined column\n        out[out_name] = col\n\n    # If col_name_map supplied as a dict input, then update.\n    if isinstance(_col_name_map, Mapping):\n        _col_name_map.update(col_name_map)\n\n    return out"},{"attributeType":"null","col":20,"comment":"null","endLoc":126,"id":9127,"name":"y","nodeType":"Attribute","startLoc":126,"text":"self.y"},{"col":4,"comment":"\n        Return BST rows sorted by key values.\n        ","endLoc":298,"header":"def sorted_data(self)","id":9128,"name":"sorted_data","nodeType":"Function","startLoc":294,"text":"def sorted_data(self):\n        '''\n        Return BST rows sorted by key values.\n        '''\n        return [x for node in self.traverse() for x in node.data]"},{"col":4,"comment":"\n        Return rows within the given range.\n\n        Parameters\n        ----------\n        lower : tuple\n            Lower prefix bound\n        upper : tuple\n            Upper prefix bound\n        bounds : tuple (x, y) of bools\n            Indicates whether the search should be inclusive or\n            exclusive with respect to the endpoints. The first\n            argument x corresponds to an inclusive lower bound,\n            and the second argument y to an inclusive upper bound.\n        ","endLoc":307,"header":"def range(self, lower, upper, bounds=(True, True))","id":9129,"name":"range","nodeType":"Function","startLoc":291,"text":"def range(self, lower, upper, bounds=(True, True)):\n        '''\n        Return rows within the given range.\n\n        Parameters\n        ----------\n        lower : tuple\n            Lower prefix bound\n        upper : tuple\n            Upper prefix bound\n        bounds : tuple (x, y) of bools\n            Indicates whether the search should be inclusive or\n            exclusive with respect to the endpoints. The first\n            argument x corresponds to an inclusive lower bound,\n            and the second argument y to an inclusive upper bound.\n        '''\n        return self.data.range(lower, upper, bounds)"},{"col":4,"comment":"null","endLoc":328,"header":"def _substitute(self, node, parent, new_node)","id":9130,"name":"_substitute","nodeType":"Function","startLoc":324,"text":"def _substitute(self, node, parent, new_node):\n        if node is self.root:\n            self.root = new_node\n        else:\n            parent.replace(node, new_node)"},{"col":4,"comment":"\n        Remove data corresponding to the given key.\n\n        Parameters\n        ----------\n        key : tuple\n            The key to remove\n        data : int or None\n            If None, remove the node corresponding to the given key.\n            If not None, remove only the given data value from the node.\n\n        Returns\n        -------\n        successful : bool\n            True if removal was successful, false otherwise\n        ","endLoc":372,"header":"def remove(self, key, data=None)","id":9131,"name":"remove","nodeType":"Function","startLoc":330,"text":"def remove(self, key, data=None):\n        '''\n        Remove data corresponding to the given key.\n\n        Parameters\n        ----------\n        key : tuple\n            The key to remove\n        data : int or None\n            If None, remove the node corresponding to the given key.\n            If not None, remove only the given data value from the node.\n\n        Returns\n        -------\n        successful : bool\n            True if removal was successful, false otherwise\n        '''\n        node, parent = self.find_node(key)\n        if node is None:\n            return False\n        if data is not None:\n            if data not in node.data:\n                raise ValueError(\"Data does not belong to correct node\")\n            elif len(node.data) > 1:\n                node.data.remove(data)\n                return True\n        if node.left is None and node.right is None:\n            self._substitute(node, parent, None)\n        elif node.left is None and node.right is not None:\n            self._substitute(node, parent, node.right)\n        elif node.right is None and node.left is not None:\n            self._substitute(node, parent, node.left)\n        else:\n            # find largest element of left subtree\n            curr_node = node.left\n            parent = node\n            while curr_node.right is not None:\n                parent = curr_node\n                curr_node = curr_node.right\n            self._substitute(curr_node, parent, curr_node.left)\n            node.set(curr_node)\n        self.size -= 1\n        return True"},{"attributeType":"null","col":8,"comment":"null","endLoc":130,"id":9132,"name":"nterms","nodeType":"Attribute","startLoc":130,"text":"self.nterms"},{"col":4,"comment":"null","endLoc":518,"header":"def same_prefix(self, key)","id":9133,"name":"same_prefix","nodeType":"Function","startLoc":517,"text":"def same_prefix(self, key):\n        return self.sliced_coords(self.index.same_prefix(key))"},{"col":4,"comment":"\n        Returns whether this is a valid BST.\n        ","endLoc":378,"header":"def is_valid(self)","id":9134,"name":"is_valid","nodeType":"Function","startLoc":374,"text":"def is_valid(self):\n        '''\n        Returns whether this is a valid BST.\n        '''\n        return self._is_valid(self.root)"},{"className":"LombScargle","col":0,"comment":"\n    Compute the Lomb-Scargle Periodogram.\n\n    This class has been deprecated and will be removed in a future version.\n    Use `astropy.timeseries.LombScargle` instead.\n    ","endLoc":31,"id":9135,"nodeType":"Class","startLoc":18,"text":"class LombScargle(TimeseriesLombScargle):\n    \"\"\"\n    Compute the Lomb-Scargle Periodogram.\n\n    This class has been deprecated and will be removed in a future version.\n    Use `astropy.timeseries.LombScargle` instead.\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n        warnings.warn('Importing LombScargle from astropy.stats has been '\n                      'deprecated and will no longer be supported in future. '\n                      'Please import this class from the astropy.timeseries '\n                      'module instead', AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)"},{"col":4,"comment":"null","endLoc":31,"header":"def __init__(self, *args, **kwargs)","id":9136,"name":"__init__","nodeType":"Function","startLoc":26,"text":"def __init__(self, *args, **kwargs):\n        warnings.warn('Importing LombScargle from astropy.stats has been '\n                      'deprecated and will no longer be supported in future. '\n                      'Please import this class from the astropy.timeseries '\n                      'module instead', AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)"},{"col":4,"comment":"\n        Return rows whose keys contain the supplied key as a prefix.\n\n        Parameters\n        ----------\n        key : tuple\n            Prefix for which to search\n        ","endLoc":263,"header":"def same_prefix(self, key)","id":9137,"name":"same_prefix","nodeType":"Function","startLoc":254,"text":"def same_prefix(self, key):\n        '''\n        Return rows whose keys contain the supplied key as a prefix.\n\n        Parameters\n        ----------\n        key : tuple\n            Prefix for which to search\n        '''\n        return self.same_prefix_range(key, key, (True, True))"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":9138,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"col":0,"comment":"","endLoc":10,"header":"__init__.py#<anonymous>","id":9139,"name":"<anonymous>","nodeType":"Function","startLoc":10,"text":"__all__ = ['LombScargle']"},{"col":4,"comment":"\n        Return rows whose keys have a prefix in the given range.\n\n        Parameters\n        ----------\n        lower : tuple\n            Lower prefix bound\n        upper : tuple\n            Upper prefix bound\n        bounds : tuple (x, y) of bools\n            Indicates whether the search should be inclusive or\n            exclusive with respect to the endpoints. The first\n            argument x corresponds to an inclusive lower bound,\n            and the second argument y to an inclusive upper bound.\n        ","endLoc":289,"header":"def same_prefix_range(self, lower, upper, bounds=(True, True))","id":9140,"name":"same_prefix_range","nodeType":"Function","startLoc":265,"text":"def same_prefix_range(self, lower, upper, bounds=(True, True)):\n        '''\n        Return rows whose keys have a prefix in the given range.\n\n        Parameters\n        ----------\n        lower : tuple\n            Lower prefix bound\n        upper : tuple\n            Upper prefix bound\n        bounds : tuple (x, y) of bools\n            Indicates whether the search should be inclusive or\n            exclusive with respect to the endpoints. The first\n            argument x corresponds to an inclusive lower bound,\n            and the second argument y to an inclusive upper bound.\n        '''\n        n = len(lower)\n        ncols = len(self.columns)\n        a = MinValue() if bounds[0] else MaxValue()\n        b = MaxValue() if bounds[1] else MinValue()\n        # [x, y] search corresponds to [(x, min), (y, max)]\n        # (x, y) search corresponds to ((x, max), (x, min))\n        lower = lower + tuple((ncols - n) * [a])\n        upper = upper + tuple((ncols - n) * [b])\n        return self.data.range(lower, upper, bounds)"},{"fileName":"soco.py","filePath":"astropy/table","id":9141,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThe SCEngine class uses the ``sortedcontainers`` package to implement an\nIndex engine for Tables.\n\"\"\"\n\nfrom collections import OrderedDict\nfrom itertools import starmap\nfrom astropy.utils.compat.optional_deps import HAS_SORTEDCONTAINERS\n\nif HAS_SORTEDCONTAINERS:\n    from sortedcontainers import SortedList\n\n\nclass Node(object):\n    __slots__ = ('key', 'value')\n\n    def __init__(self, key, value):\n        self.key = key\n        self.value = value\n\n    def __lt__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) < (other.key, other.value)\n        return self.key < other\n\n    def __le__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) <= (other.key, other.value)\n        return self.key <= other\n\n    def __eq__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) == (other.key, other.value)\n        return self.key == other\n\n    def __ne__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) != (other.key, other.value)\n        return self.key != other\n\n    def __gt__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) > (other.key, other.value)\n        return self.key > other\n\n    def __ge__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) >= (other.key, other.value)\n        return self.key >= other\n\n    __hash__ = None\n\n    def __repr__(self):\n        return f'Node({self.key!r}, {self.value!r})'\n\n\nclass SCEngine:\n    '''\n    Fast tree-based implementation for indexing, using the\n    ``sortedcontainers`` package.\n\n    Parameters\n    ----------\n    data : Table\n        Sorted columns of the original table\n    row_index : Column object\n        Row numbers corresponding to data columns\n    unique : bool\n        Whether the values of the index must be unique.\n        Defaults to False.\n    '''\n\n    def __init__(self, data, row_index, unique=False):\n        node_keys = map(tuple, data)\n        self._nodes = SortedList(starmap(Node, zip(node_keys, row_index)))\n        self._unique = unique\n\n    def add(self, key, value):\n        '''\n        Add a key, value pair.\n        '''\n        if self._unique and (key in self._nodes):\n            message = f'duplicate {key!r} in unique index'\n            raise ValueError(message)\n        self._nodes.add(Node(key, value))\n\n    def find(self, key):\n        '''\n        Find rows corresponding to the given key.\n        '''\n        return [node.value for node in self._nodes.irange(key, key)]\n\n    def remove(self, key, data=None):\n        '''\n        Remove data from the given key.\n        '''\n        if data is not None:\n            item = Node(key, data)\n            try:\n                self._nodes.remove(item)\n            except ValueError:\n                return False\n            return True\n        items = list(self._nodes.irange(key, key))\n        for item in items:\n            self._nodes.remove(item)\n        return bool(items)\n\n    def shift_left(self, row):\n        '''\n        Decrement rows larger than the given row.\n        '''\n        for node in self._nodes:\n            if node.value > row:\n                node.value -= 1\n\n    def shift_right(self, row):\n        '''\n        Increment rows greater than or equal to the given row.\n        '''\n        for node in self._nodes:\n            if node.value >= row:\n                node.value += 1\n\n    def items(self):\n        '''\n        Return a list of key, data tuples.\n        '''\n        result = OrderedDict()\n        for node in self._nodes:\n            if node.key in result:\n                result[node.key].append(node.value)\n            else:\n                result[node.key] = [node.value]\n        return result.items()\n\n    def sort(self):\n        '''\n        Make row order align with key order.\n        '''\n        for index, node in enumerate(self._nodes):\n            node.value = index\n\n    def sorted_data(self):\n        '''\n        Return a list of rows in order sorted by key.\n        '''\n        return [node.value for node in self._nodes]\n\n    def range(self, lower, upper, bounds=(True, True)):\n        '''\n        Return row values in the given range.\n        '''\n        iterator = self._nodes.irange(lower, upper, bounds)\n        return [node.value for node in iterator]\n\n    def replace_rows(self, row_map):\n        '''\n        Replace rows with the values in row_map.\n        '''\n        nodes = [node for node in self._nodes if node.value in row_map]\n        for node in nodes:\n            node.value = row_map[node.value]\n        self._nodes.clear()\n        self._nodes.update(nodes)\n\n    def __repr__(self):\n        if len(self._nodes) > 6:\n            nodes = list(self._nodes[:3]) + ['...'] + list(self._nodes[-3:])\n        else:\n            nodes = self._nodes\n        nodes_str = ', '.join(str(node) for node in nodes)\n        return f'<{self.__class__.__name__} nodes={nodes_str}>'\n"},{"col":4,"comment":"\n        Perform sigma clipping on the provided data.\n\n        Parameters\n        ----------\n        data : array-like or `~numpy.ma.MaskedArray`\n            The data to be sigma clipped.\n\n        axis : None or int or tuple of int, optional\n            The axis or axes along which to sigma clip the data. If\n            `None`, then the flattened data will be used. ``axis`` is\n            passed to the ``cenfunc`` and ``stdfunc``. The default is\n            `None`.\n\n        masked : bool, optional\n            If `True`, then a `~numpy.ma.MaskedArray` is returned, where\n            the mask is `True` for clipped values. If `False`, then a\n            `~numpy.ndarray` is returned. The default is `True`.\n\n        return_bounds : bool, optional\n            If `True`, then the minimum and maximum clipping bounds are\n            also returned.\n\n        copy : bool, optional\n            If `True`, then the ``data`` array will be copied. If\n            `False` and ``masked=True``, then the returned masked array\n            data will contain the same array as the input ``data`` (if\n            ``data`` is a `~numpy.ndarray` or `~numpy.ma.MaskedArray`).\n            If `False` and ``masked=False``, the input data is modified\n            in-place. The default is `True`.\n\n        Returns\n        -------\n        result : array-like\n            If ``masked=True``, then a `~numpy.ma.MaskedArray` is\n            returned, where the mask is `True` for clipped values and\n            where the input mask was `True`.\n\n            If ``masked=False``, then a `~numpy.ndarray` is returned.\n\n            If ``return_bounds=True``, then in addition to the masked\n            array or array above, the minimum and maximum clipping\n            bounds are returned.\n\n            If ``masked=False`` and ``axis=None``, then the output\n            array is a flattened 1D `~numpy.ndarray` where the clipped\n            values have been removed. If ``return_bounds=True`` then the\n            returned minimum and maximum thresholds are scalars.\n\n            If ``masked=False`` and ``axis`` is specified, then the\n            output `~numpy.ndarray` will have the same shape as the\n            input ``data`` and contain ``np.nan`` where values were\n            clipped. If the input ``data`` was a masked array, then the\n            output `~numpy.ndarray` will also contain ``np.nan`` where\n            the input mask was `True`. If ``return_bounds=True`` then\n            the returned minimum and maximum clipping thresholds will be\n            be `~numpy.ndarray`\\s.\n        ","endLoc":644,"header":"def __call__(self, data, axis=None, masked=True, return_bounds=False,\n                 copy=True)","id":9142,"name":"__call__","nodeType":"Function","startLoc":540,"text":"def __call__(self, data, axis=None, masked=True, return_bounds=False,\n                 copy=True):\n        \"\"\"\n        Perform sigma clipping on the provided data.\n\n        Parameters\n        ----------\n        data : array-like or `~numpy.ma.MaskedArray`\n            The data to be sigma clipped.\n\n        axis : None or int or tuple of int, optional\n            The axis or axes along which to sigma clip the data. If\n            `None`, then the flattened data will be used. ``axis`` is\n            passed to the ``cenfunc`` and ``stdfunc``. The default is\n            `None`.\n\n        masked : bool, optional\n            If `True`, then a `~numpy.ma.MaskedArray` is returned, where\n            the mask is `True` for clipped values. If `False`, then a\n            `~numpy.ndarray` is returned. The default is `True`.\n\n        return_bounds : bool, optional\n            If `True`, then the minimum and maximum clipping bounds are\n            also returned.\n\n        copy : bool, optional\n            If `True`, then the ``data`` array will be copied. If\n            `False` and ``masked=True``, then the returned masked array\n            data will contain the same array as the input ``data`` (if\n            ``data`` is a `~numpy.ndarray` or `~numpy.ma.MaskedArray`).\n            If `False` and ``masked=False``, the input data is modified\n            in-place. The default is `True`.\n\n        Returns\n        -------\n        result : array-like\n            If ``masked=True``, then a `~numpy.ma.MaskedArray` is\n            returned, where the mask is `True` for clipped values and\n            where the input mask was `True`.\n\n            If ``masked=False``, then a `~numpy.ndarray` is returned.\n\n            If ``return_bounds=True``, then in addition to the masked\n            array or array above, the minimum and maximum clipping\n            bounds are returned.\n\n            If ``masked=False`` and ``axis=None``, then the output\n            array is a flattened 1D `~numpy.ndarray` where the clipped\n            values have been removed. If ``return_bounds=True`` then the\n            returned minimum and maximum thresholds are scalars.\n\n            If ``masked=False`` and ``axis`` is specified, then the\n            output `~numpy.ndarray` will have the same shape as the\n            input ``data`` and contain ``np.nan`` where values were\n            clipped. If the input ``data`` was a masked array, then the\n            output `~numpy.ndarray` will also contain ``np.nan`` where\n            the input mask was `True`. If ``return_bounds=True`` then\n            the returned minimum and maximum clipping thresholds will be\n            be `~numpy.ndarray`\\\\s.\n        \"\"\"\n        data = np.asanyarray(data)\n\n        if data.size == 0:\n            if masked:\n                result = np.ma.MaskedArray(data)\n            else:\n                result = data\n\n            if return_bounds:\n                return result, self._min_value, self._max_value\n            else:\n                return result\n\n        if isinstance(data, np.ma.MaskedArray) and data.mask.all():\n            if masked:\n                result = data\n            else:\n                result = np.full(data.shape, np.nan)\n\n            if return_bounds:\n                return result, self._min_value, self._max_value\n            else:\n                return result\n\n        # Shortcut for common cases where a fast C implementation can be\n        # used.\n        if (self.cenfunc in ('mean', 'median')\n                and self.stdfunc in ('std', 'mad_std')\n                and axis is not None and not self.grow):\n            return self._sigmaclip_fast(data, axis=axis, masked=masked,\n                                        return_bounds=return_bounds,\n                                        copy=copy)\n\n        # These two cases are treated separately because when\n        # ``axis=None`` we can simply remove clipped values from the\n        # array. This is not possible when ``axis`` or ``grow`` is\n        # specified.\n        if axis is None and not self.grow:\n            return self._sigmaclip_noaxis(data, masked=masked,\n                                          return_bounds=return_bounds,\n                                          copy=copy)\n        else:\n            return self._sigmaclip_withaxis(data, axis=axis, masked=masked,\n                                            return_bounds=return_bounds,\n                                            copy=copy)"},{"col":4,"comment":"null","endLoc":385,"header":"def _is_valid(self, node)","id":9143,"name":"_is_valid","nodeType":"Function","startLoc":380,"text":"def _is_valid(self, node):\n        if node is None:\n            return True\n        return (node.left is None or node.left <= node) and \\\n            (node.right is None or node.right >= node) and \\\n            self._is_valid(node.left) and self._is_valid(node.right)"},{"col":4,"comment":"\n        Return all nodes with keys in the given range.\n\n        Parameters\n        ----------\n        lower : tuple\n            Lower bound\n        upper : tuple\n            Upper bound\n        bounds : (2,) tuple of bool\n            Indicates whether the search should be inclusive or\n            exclusive with respect to the endpoints. The first\n            argument corresponds to an inclusive lower bound,\n            and the second argument to an inclusive upper bound.\n        ","endLoc":404,"header":"def range(self, lower, upper, bounds=(True, True))","id":9144,"name":"range","nodeType":"Function","startLoc":387,"text":"def range(self, lower, upper, bounds=(True, True)):\n        '''\n        Return all nodes with keys in the given range.\n\n        Parameters\n        ----------\n        lower : tuple\n            Lower bound\n        upper : tuple\n            Upper bound\n        bounds : (2,) tuple of bool\n            Indicates whether the search should be inclusive or\n            exclusive with respect to the endpoints. The first\n            argument corresponds to an inclusive lower bound,\n            and the second argument to an inclusive upper bound.\n        '''\n        nodes = self.range_nodes(lower, upper, bounds)\n        return [x for node in nodes for x in node.data]"},{"className":"Node","col":0,"comment":"null","endLoc":56,"id":9145,"nodeType":"Class","startLoc":16,"text":"class Node(object):\n    __slots__ = ('key', 'value')\n\n    def __init__(self, key, value):\n        self.key = key\n        self.value = value\n\n    def __lt__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) < (other.key, other.value)\n        return self.key < other\n\n    def __le__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) <= (other.key, other.value)\n        return self.key <= other\n\n    def __eq__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) == (other.key, other.value)\n        return self.key == other\n\n    def __ne__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) != (other.key, other.value)\n        return self.key != other\n\n    def __gt__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) > (other.key, other.value)\n        return self.key > other\n\n    def __ge__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) >= (other.key, other.value)\n        return self.key >= other\n\n    __hash__ = None\n\n    def __repr__(self):\n        return f'Node({self.key!r}, {self.value!r})'"},{"col":4,"comment":"null","endLoc":21,"header":"def __init__(self, key, value)","id":9146,"name":"__init__","nodeType":"Function","startLoc":19,"text":"def __init__(self, key, value):\n        self.key = key\n        self.value = value"},{"col":0,"comment":"Do processing to handle keys_left / keys_right args for join.\n\n    This takes the keys_left/right inputs and turns them into a list of left/right\n    columns corresponding to those inputs (which can be column names or column\n    data values). It also generates the list of fake key column names (strings\n    of \"1\", \"2\", etc.) that correspond to the input keys.\n    ","endLoc":1309,"header":"def _join_keys_left_right(left, right, keys, keys_left, keys_right, join_funcs)","id":9147,"name":"_join_keys_left_right","nodeType":"Function","startLoc":1260,"text":"def _join_keys_left_right(left, right, keys, keys_left, keys_right, join_funcs):\n    \"\"\"Do processing to handle keys_left / keys_right args for join.\n\n    This takes the keys_left/right inputs and turns them into a list of left/right\n    columns corresponding to those inputs (which can be column names or column\n    data values). It also generates the list of fake key column names (strings\n    of \"1\", \"2\", etc.) that correspond to the input keys.\n    \"\"\"\n    def _keys_to_cols(keys, table, label):\n        # Process input `keys`, which is a str or list of str column names in\n        # `table` or a list of column-like objects. The `label` is just for\n        # error reporting.\n        if isinstance(keys, str):\n            keys = [keys]\n        cols = []\n        for key in keys:\n            if isinstance(key, str):\n                try:\n                    cols.append(table[key])\n                except KeyError:\n                    raise ValueError(f'{label} table does not have key column {key!r}')\n            else:\n                if len(key) != len(table):\n                    raise ValueError(f'{label} table has different length from key {key}')\n                cols.append(key)\n        return cols\n\n    if join_funcs is not None:\n        raise ValueError('cannot supply join_funcs arg and keys_left / keys_right')\n\n    if keys_left is None or keys_right is None:\n        raise ValueError('keys_left and keys_right must both be provided')\n\n    if keys is not None:\n        raise ValueError('keys arg must be None if keys_left and keys_right are supplied')\n\n    cols_left = _keys_to_cols(keys_left, left, 'left')\n    cols_right = _keys_to_cols(keys_right, right, 'right')\n\n    if len(cols_left) != len(cols_right):\n        raise ValueError('keys_left and keys_right args must have same length')\n\n    # Make two new temp tables for the join with only the join columns and\n    # key columns in common.\n    keys = [f'{ii}' for ii in range(len(cols_left))]\n\n    left = left.__class__(cols_left, names=keys, copy=False)\n    right = right.__class__(cols_right, names=keys, copy=False)\n\n    return left, right, keys"},{"col":4,"comment":"null","endLoc":26,"header":"def __lt__(self, other)","id":9148,"name":"__lt__","nodeType":"Function","startLoc":23,"text":"def __lt__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) < (other.key, other.value)\n        return self.key < other"},{"col":4,"comment":"null","endLoc":31,"header":"def __le__(self, other)","id":9149,"name":"__le__","nodeType":"Function","startLoc":28,"text":"def __le__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) <= (other.key, other.value)\n        return self.key <= other"},{"col":4,"comment":"null","endLoc":36,"header":"def __eq__(self, other)","id":9150,"name":"__eq__","nodeType":"Function","startLoc":33,"text":"def __eq__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) == (other.key, other.value)\n        return self.key == other"},{"col":4,"comment":"null","endLoc":41,"header":"def __ne__(self, other)","id":9151,"name":"__ne__","nodeType":"Function","startLoc":38,"text":"def __ne__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) != (other.key, other.value)\n        return self.key != other"},{"col":4,"comment":"null","endLoc":46,"header":"def __gt__(self, other)","id":9152,"name":"__gt__","nodeType":"Function","startLoc":43,"text":"def __gt__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) > (other.key, other.value)\n        return self.key > other"},{"col":4,"comment":"null","endLoc":51,"header":"def __ge__(self, other)","id":9153,"name":"__ge__","nodeType":"Function","startLoc":48,"text":"def __ge__(self, other):\n        if other.__class__ is Node:\n            return (self.key, self.value) >= (other.key, other.value)\n        return self.key >= other"},{"col":4,"comment":"null","endLoc":56,"header":"def __repr__(self)","id":9154,"name":"__repr__","nodeType":"Function","startLoc":55,"text":"def __repr__(self):\n        return f'Node({self.key!r}, {self.value!r})'"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":9155,"name":"__slots__","nodeType":"Attribute","startLoc":17,"text":"__slots__"},{"col":4,"comment":"null","endLoc":521,"header":"def sorted_data(self)","id":9156,"name":"sorted_data","nodeType":"Function","startLoc":520,"text":"def sorted_data(self):\n        return self.sliced_coords(self.index.sorted_data())"},{"col":4,"comment":"\n        Returns a list of rows in sorted order based on keys;\n        essentially acts as an argsort() on columns.\n        ","endLoc":355,"header":"def sorted_data(self)","id":9157,"name":"sorted_data","nodeType":"Function","startLoc":350,"text":"def sorted_data(self):\n        '''\n        Returns a list of rows in sorted order based on keys;\n        essentially acts as an argsort() on columns.\n        '''\n        return self.data.sorted_data()"},{"col":4,"comment":"null","endLoc":525,"header":"def replace(self, row, col, val)","id":9159,"name":"replace","nodeType":"Function","startLoc":523,"text":"def replace(self, row, col, val):\n        if not self._frozen:\n            self.index.replace(self.orig_coords(row), col, val)"},{"col":4,"comment":"Compute which data points are in transit for a given parameter set\n\n        Parameters\n        ----------\n        t_model : array-like or `~astropy.units.Quantity` ['time']\n            Times where the mask should be evaluated.\n        period : float or `~astropy.units.Quantity` ['time']\n            The period of the transits.\n        duration : float or `~astropy.units.Quantity` ['time']\n            The duration of the transit.\n        transit_time : float or `~astropy.units.Quantity` or `~astropy.time.Time`\n            The mid-transit time of a reference transit.\n\n        Returns\n        -------\n        transit_mask : array-like\n            A boolean array where ``True`` indicates and in transit point and\n            ``False`` indicates and out-of-transit point.\n\n        ","endLoc":603,"header":"def transit_mask(self, t, period, duration, transit_time)","id":9160,"name":"transit_mask","nodeType":"Function","startLoc":572,"text":"def transit_mask(self, t, period, duration, transit_time):\n        \"\"\"Compute which data points are in transit for a given parameter set\n\n        Parameters\n        ----------\n        t_model : array-like or `~astropy.units.Quantity` ['time']\n            Times where the mask should be evaluated.\n        period : float or `~astropy.units.Quantity` ['time']\n            The period of the transits.\n        duration : float or `~astropy.units.Quantity` ['time']\n            The duration of the transit.\n        transit_time : float or `~astropy.units.Quantity` or `~astropy.time.Time`\n            The mid-transit time of a reference transit.\n\n        Returns\n        -------\n        transit_mask : array-like\n            A boolean array where ``True`` indicates and in transit point and\n            ``False`` indicates and out-of-transit point.\n\n        \"\"\"\n\n        period, duration = self._validate_period_and_duration(period, duration)\n        transit_time = self._as_relative_time('transit_time', transit_time)\n        t = strip_units(self._as_relative_time('t', t))\n\n        period = float(strip_units(period))\n        duration = float(strip_units(duration))\n        transit_time = float(strip_units(transit_time))\n\n        hp = 0.5*period\n        return np.abs((t-transit_time+hp) % period - hp) < 0.5*duration"},{"attributeType":"None","col":4,"comment":"null","endLoc":53,"id":9161,"name":"__hash__","nodeType":"Attribute","startLoc":53,"text":"__hash__"},{"col":4,"comment":"\n        Replace the value of a column at a given position.\n\n        Parameters\n        ----------\n        row : int\n            Row number to modify\n        col_name : str\n            Name of the Column to modify\n        val : col.info.dtype\n            Value to insert at specified row of col\n        ","endLoc":325,"header":"def replace(self, row, col_name, val)","id":9162,"name":"replace","nodeType":"Function","startLoc":309,"text":"def replace(self, row, col_name, val):\n        '''\n        Replace the value of a column at a given position.\n\n        Parameters\n        ----------\n        row : int\n            Row number to modify\n        col_name : str\n            Name of the Column to modify\n        val : col.info.dtype\n            Value to insert at specified row of col\n        '''\n        self.remove_row(row, reorder=False)\n        key = [c[row] for c in self.columns]\n        key[self.col_position(col_name)] = val\n        self.data.add(tuple(key), row)"},{"col":4,"comment":"\n        Remove the given row from the index.\n\n        Parameters\n        ----------\n        row : int\n            Position of row to remove\n        reorder : bool\n            Whether to reorder indices after removal\n        ","endLoc":241,"header":"def remove_row(self, row, reorder=True)","id":9163,"name":"remove_row","nodeType":"Function","startLoc":225,"text":"def remove_row(self, row, reorder=True):\n        '''\n        Remove the given row from the index.\n\n        Parameters\n        ----------\n        row : int\n            Position of row to remove\n        reorder : bool\n            Whether to reorder indices after removal\n        '''\n        # for removal, form a key consisting of column values in this row\n        if not self.data.remove(tuple([col[row] for col in self.columns]), row):\n            raise ValueError(f\"Could not remove row {row} from index\")\n        # decrement the row number of all later rows\n        if reorder:\n            self.data.shift_left(row)"},{"col":4,"comment":"\n        Return the position of col_name in self.columns.\n\n        Parameters\n        ----------\n        col_name : str\n            Name of column to look up\n        ","endLoc":157,"header":"def col_position(self, col_name)","id":9164,"name":"col_position","nodeType":"Function","startLoc":145,"text":"def col_position(self, col_name):\n        '''\n        Return the position of col_name in self.columns.\n\n        Parameters\n        ----------\n        col_name : str\n            Name of column to look up\n        '''\n        for i, c in enumerate(self.columns):\n            if c.info.name == col_name:\n                return i\n        raise ValueError(f\"Column does not belong to index: {col_name}\")"},{"attributeType":"null","col":12,"comment":"null","endLoc":108,"id":9165,"name":"_tstart","nodeType":"Attribute","startLoc":108,"text":"self._tstart"},{"attributeType":"null","col":8,"comment":"null","endLoc":102,"id":9166,"name":"t","nodeType":"Attribute","startLoc":102,"text":"self.t"},{"attributeType":"null","col":8,"comment":"null","endLoc":111,"id":9167,"name":"_trel","nodeType":"Attribute","startLoc":111,"text":"self._trel"},{"attributeType":"null","col":28,"comment":"null","endLoc":111,"id":9168,"name":"dy","nodeType":"Attribute","startLoc":111,"text":"self.dy"},{"col":4,"comment":"null","endLoc":531,"header":"def get_index_or_copy(self)","id":9169,"name":"get_index_or_copy","nodeType":"Function","startLoc":527,"text":"def get_index_or_copy(self):\n        if not self.original:\n            # replace self.index with a new object reference\n            self.index = deepcopy(self.index)\n        return self.index"},{"col":4,"comment":"null","endLoc":535,"header":"def insert_row(self, pos, vals, columns)","id":9170,"name":"insert_row","nodeType":"Function","startLoc":533,"text":"def insert_row(self, pos, vals, columns):\n        if not self._frozen:\n            self.get_index_or_copy().insert_row(self.orig_coords(pos), vals, columns)"},{"attributeType":"null","col":8,"comment":"null","endLoc":21,"id":9171,"name":"value","nodeType":"Attribute","startLoc":21,"text":"self.value"},{"attributeType":"null","col":20,"comment":"null","endLoc":111,"id":9172,"name":"y","nodeType":"Attribute","startLoc":111,"text":"self.y"},{"col":4,"comment":"null","endLoc":539,"header":"def get_row_specifier(self, row_specifier)","id":9173,"name":"get_row_specifier","nodeType":"Function","startLoc":537,"text":"def get_row_specifier(self, row_specifier):\n        return [self.orig_coords(x) for x in\n                self.index.get_row_specifier(row_specifier)]"},{"attributeType":"null","col":8,"comment":"null","endLoc":20,"id":9174,"name":"key","nodeType":"Attribute","startLoc":20,"text":"self.key"},{"col":4,"comment":"\n        Return an iterable corresponding to the\n        input row specifier.\n\n        Parameters\n        ----------\n        row_specifier : int, list, ndarray, or slice\n        ","endLoc":202,"header":"def get_row_specifier(self, row_specifier)","id":9175,"name":"get_row_specifier","nodeType":"Function","startLoc":184,"text":"def get_row_specifier(self, row_specifier):\n        '''\n        Return an iterable corresponding to the\n        input row specifier.\n\n        Parameters\n        ----------\n        row_specifier : int, list, ndarray, or slice\n        '''\n        if isinstance(row_specifier, (int, np.integer)):\n            # single row\n            return (row_specifier,)\n        elif isinstance(row_specifier, (list, np.ndarray)):\n            return row_specifier\n        elif isinstance(row_specifier, slice):\n            col_len = len(self.columns[0])\n            return range(*row_specifier.indices(col_len))\n        raise ValueError(\"Expected int, array of ints, or slice but \"\n                         \"got {} in remove_rows\".format(row_specifier))"},{"className":"BoxLeastSquaresResults","col":0,"comment":"The results of a BoxLeastSquares search\n\n    Attributes\n    ----------\n    objective : str\n        The scalar used to optimize to find the best fit phase, duration, and\n        depth. See :func:`BoxLeastSquares.power` for more information.\n    period : array-like or `~astropy.units.Quantity` ['time']\n        The set of test periods.\n    power : array-like or `~astropy.units.Quantity`\n        The periodogram evaluated at the periods in ``period``. If\n        ``objective`` is:\n\n        * ``'likelihood'``: the values of ``power`` are the\n          log likelihood maximized over phase, depth, and duration, or\n        * ``'snr'``: the values of ``power`` are the signal-to-noise with\n          which the depth is measured maximized over phase, depth, and\n          duration.\n\n    depth : array-like or `~astropy.units.Quantity`\n        The estimated depth of the maximum power model at each period.\n    depth_err : array-like or `~astropy.units.Quantity`\n        The 1-sigma uncertainty on ``depth``.\n    duration : array-like or `~astropy.units.Quantity` ['time']\n        The maximum power duration at each period.\n    transit_time : array-like, `~astropy.units.Quantity`, or `~astropy.time.Time`\n        The maximum power phase of the transit in units of time. This\n        indicates the mid-transit time and it will always be in the range\n        (0, period).\n    depth_snr : array-like or `~astropy.units.Quantity`\n        The signal-to-noise with which the depth is measured at maximum power.\n    log_likelihood : array-like or `~astropy.units.Quantity`\n        The log likelihood of the maximum power model.\n\n    ","endLoc":821,"id":9176,"nodeType":"Class","startLoc":760,"text":"class BoxLeastSquaresResults(dict):\n    \"\"\"The results of a BoxLeastSquares search\n\n    Attributes\n    ----------\n    objective : str\n        The scalar used to optimize to find the best fit phase, duration, and\n        depth. See :func:`BoxLeastSquares.power` for more information.\n    period : array-like or `~astropy.units.Quantity` ['time']\n        The set of test periods.\n    power : array-like or `~astropy.units.Quantity`\n        The periodogram evaluated at the periods in ``period``. If\n        ``objective`` is:\n\n        * ``'likelihood'``: the values of ``power`` are the\n          log likelihood maximized over phase, depth, and duration, or\n        * ``'snr'``: the values of ``power`` are the signal-to-noise with\n          which the depth is measured maximized over phase, depth, and\n          duration.\n\n    depth : array-like or `~astropy.units.Quantity`\n        The estimated depth of the maximum power model at each period.\n    depth_err : array-like or `~astropy.units.Quantity`\n        The 1-sigma uncertainty on ``depth``.\n    duration : array-like or `~astropy.units.Quantity` ['time']\n        The maximum power duration at each period.\n    transit_time : array-like, `~astropy.units.Quantity`, or `~astropy.time.Time`\n        The maximum power phase of the transit in units of time. This\n        indicates the mid-transit time and it will always be in the range\n        (0, period).\n    depth_snr : array-like or `~astropy.units.Quantity`\n        The signal-to-noise with which the depth is measured at maximum power.\n    log_likelihood : array-like or `~astropy.units.Quantity`\n        The log likelihood of the maximum power model.\n\n    \"\"\"\n    def __init__(self, *args):\n        super().__init__(zip(\n            (\"objective\", \"period\", \"power\", \"depth\", \"depth_err\",\n             \"duration\", \"transit_time\", \"depth_snr\", \"log_likelihood\"),\n            args\n        ))\n\n    def __getattr__(self, name):\n        try:\n            return self[name]\n        except KeyError:\n            raise AttributeError(name)\n\n    __setattr__ = dict.__setitem__\n    __delattr__ = dict.__delitem__\n\n    def __repr__(self):\n        if self.keys():\n            m = max(map(len, list(self.keys()))) + 1\n            return '\\n'.join([k.rjust(m) + ': ' + repr(v)\n                              for k, v in sorted(self.items())])\n        else:\n            return self.__class__.__name__ + \"()\"\n\n    def __dir__(self):\n        return list(self.keys())"},{"col":4,"comment":"null","endLoc":807,"header":"def __getattr__(self, name)","id":9177,"name":"__getattr__","nodeType":"Function","startLoc":803,"text":"def __getattr__(self, name):\n        try:\n            return self[name]\n        except KeyError:\n            raise AttributeError(name)"},{"col":4,"comment":"null","endLoc":818,"header":"def __repr__(self)","id":9178,"name":"__repr__","nodeType":"Function","startLoc":812,"text":"def __repr__(self):\n        if self.keys():\n            m = max(map(len, list(self.keys()))) + 1\n            return '\\n'.join([k.rjust(m) + ': ' + repr(v)\n                              for k, v in sorted(self.items())])\n        else:\n            return self.__class__.__name__ + \"()\""},{"className":"SCEngine","col":0,"comment":"\n    Fast tree-based implementation for indexing, using the\n    ``sortedcontainers`` package.\n\n    Parameters\n    ----------\n    data : Table\n        Sorted columns of the original table\n    row_index : Column object\n        Row numbers corresponding to data columns\n    unique : bool\n        Whether the values of the index must be unique.\n        Defaults to False.\n    ","endLoc":175,"id":9179,"nodeType":"Class","startLoc":59,"text":"class SCEngine:\n    '''\n    Fast tree-based implementation for indexing, using the\n    ``sortedcontainers`` package.\n\n    Parameters\n    ----------\n    data : Table\n        Sorted columns of the original table\n    row_index : Column object\n        Row numbers corresponding to data columns\n    unique : bool\n        Whether the values of the index must be unique.\n        Defaults to False.\n    '''\n\n    def __init__(self, data, row_index, unique=False):\n        node_keys = map(tuple, data)\n        self._nodes = SortedList(starmap(Node, zip(node_keys, row_index)))\n        self._unique = unique\n\n    def add(self, key, value):\n        '''\n        Add a key, value pair.\n        '''\n        if self._unique and (key in self._nodes):\n            message = f'duplicate {key!r} in unique index'\n            raise ValueError(message)\n        self._nodes.add(Node(key, value))\n\n    def find(self, key):\n        '''\n        Find rows corresponding to the given key.\n        '''\n        return [node.value for node in self._nodes.irange(key, key)]\n\n    def remove(self, key, data=None):\n        '''\n        Remove data from the given key.\n        '''\n        if data is not None:\n            item = Node(key, data)\n            try:\n                self._nodes.remove(item)\n            except ValueError:\n                return False\n            return True\n        items = list(self._nodes.irange(key, key))\n        for item in items:\n            self._nodes.remove(item)\n        return bool(items)\n\n    def shift_left(self, row):\n        '''\n        Decrement rows larger than the given row.\n        '''\n        for node in self._nodes:\n            if node.value > row:\n                node.value -= 1\n\n    def shift_right(self, row):\n        '''\n        Increment rows greater than or equal to the given row.\n        '''\n        for node in self._nodes:\n            if node.value >= row:\n                node.value += 1\n\n    def items(self):\n        '''\n        Return a list of key, data tuples.\n        '''\n        result = OrderedDict()\n        for node in self._nodes:\n            if node.key in result:\n                result[node.key].append(node.value)\n            else:\n                result[node.key] = [node.value]\n        return result.items()\n\n    def sort(self):\n        '''\n        Make row order align with key order.\n        '''\n        for index, node in enumerate(self._nodes):\n            node.value = index\n\n    def sorted_data(self):\n        '''\n        Return a list of rows in order sorted by key.\n        '''\n        return [node.value for node in self._nodes]\n\n    def range(self, lower, upper, bounds=(True, True)):\n        '''\n        Return row values in the given range.\n        '''\n        iterator = self._nodes.irange(lower, upper, bounds)\n        return [node.value for node in iterator]\n\n    def replace_rows(self, row_map):\n        '''\n        Replace rows with the values in row_map.\n        '''\n        nodes = [node for node in self._nodes if node.value in row_map]\n        for node in nodes:\n            node.value = row_map[node.value]\n        self._nodes.clear()\n        self._nodes.update(nodes)\n\n    def __repr__(self):\n        if len(self._nodes) > 6:\n            nodes = list(self._nodes[:3]) + ['...'] + list(self._nodes[-3:])\n        else:\n            nodes = self._nodes\n        nodes_str = ', '.join(str(node) for node in nodes)\n        return f'<{self.__class__.__name__} nodes={nodes_str}>'"},{"col":4,"comment":"null","endLoc":543,"header":"def remove_rows(self, row_specifier)","id":9180,"name":"remove_rows","nodeType":"Function","startLoc":541,"text":"def remove_rows(self, row_specifier):\n        if not self._frozen:\n            self.get_index_or_copy().remove_rows(row_specifier)"},{"col":4,"comment":"null","endLoc":78,"header":"def __init__(self, data, row_index, unique=False)","id":9181,"name":"__init__","nodeType":"Function","startLoc":75,"text":"def __init__(self, data, row_index, unique=False):\n        node_keys = map(tuple, data)\n        self._nodes = SortedList(starmap(Node, zip(node_keys, row_index)))\n        self._unique = unique"},{"col":4,"comment":"null","endLoc":547,"header":"def replace_rows(self, col_slice)","id":9182,"name":"replace_rows","nodeType":"Function","startLoc":545,"text":"def replace_rows(self, col_slice):\n        if not self._frozen:\n            self.index.replace_rows([self.orig_coords(x) for x in col_slice])"},{"col":0,"comment":"Apply join_funcs\n    ","endLoc":1055,"header":"def _apply_join_funcs(left, right, keys, join_funcs)","id":9183,"name":"_apply_join_funcs","nodeType":"Function","startLoc":1037,"text":"def _apply_join_funcs(left, right, keys, join_funcs):\n    \"\"\"Apply join_funcs\n    \"\"\"\n    # Make light copies of left and right, then add new index columns.\n    left = left.copy(copy_data=False)\n    right = right.copy(copy_data=False)\n    for key, join_func in join_funcs.items():\n        ids1, ids2 = join_func(left[key], right[key])\n        # Define a unique id_key name, and keep adding underscores until we have\n        # a name not yet present.\n        id_key = key + '_id'\n        while id_key in left.columns or id_key in right.columns:\n            id_key = id_key[:-2] + '_id'\n\n        keys = tuple(id_key if orig_key == key else orig_key for orig_key in keys)\n        left.add_column(ids1, index=0, name=id_key)  # [id_key] = ids1\n        right.add_column(ids2, index=0, name=id_key)  # [id_key] = ids2\n\n    return left, right, keys"},{"col":4,"comment":"\n        Modify rows in this index to agree with the specified\n        slice. For example, given an index\n        {'5': 1, '2': 0, '3': 2} on a column ['2', '5', '3'],\n        an input col_slice of [2, 0] will result in the relabeling\n        {'3': 0, '2': 1} on the sliced column ['3', '2'].\n\n        Parameters\n        ----------\n        col_slice : list\n            Indices to slice\n        ","endLoc":341,"header":"def replace_rows(self, col_slice)","id":9184,"name":"replace_rows","nodeType":"Function","startLoc":327,"text":"def replace_rows(self, col_slice):\n        '''\n        Modify rows in this index to agree with the specified\n        slice. For example, given an index\n        {'5': 1, '2': 0, '3': 2} on a column ['2', '5', '3'],\n        an input col_slice of [2, 0] will result in the relabeling\n        {'3': 0, '2': 1} on the sliced column ['3', '2'].\n\n        Parameters\n        ----------\n        col_slice : list\n            Indices to slice\n        '''\n        row_map = dict((row, i) for i, row in enumerate(col_slice))\n        self.data.replace_rows(row_map)"},{"col":4,"comment":"\n        Add a key, value pair.\n        ","endLoc":87,"header":"def add(self, key, value)","id":9185,"name":"add","nodeType":"Function","startLoc":80,"text":"def add(self, key, value):\n        '''\n        Add a key, value pair.\n        '''\n        if self._unique and (key in self._nodes):\n            message = f'duplicate {key!r} in unique index'\n            raise ValueError(message)\n        self._nodes.add(Node(key, value))"},{"col":4,"comment":"null","endLoc":821,"header":"def __dir__(self)","id":9186,"name":"__dir__","nodeType":"Function","startLoc":820,"text":"def __dir__(self):\n        return list(self.keys())"},{"col":4,"comment":"null","endLoc":551,"header":"def sort(self)","id":9187,"name":"sort","nodeType":"Function","startLoc":549,"text":"def sort(self):\n        if not self._frozen:\n            self.get_index_or_copy().sort()"},{"attributeType":"null","col":4,"comment":"null","endLoc":809,"id":9188,"name":"__setattr__","nodeType":"Attribute","startLoc":809,"text":"__setattr__"},{"col":4,"comment":"null","endLoc":556,"header":"def __repr__(self)","id":9189,"name":"__repr__","nodeType":"Function","startLoc":553,"text":"def __repr__(self):\n        slice_str = '' if self.original else f' slice={self.start}:{self.stop}:{self.step}'\n        return (f'<{self.__class__.__name__} original={self.original}{slice_str}'\n                f' index={self.index}>')"},{"attributeType":"null","col":4,"comment":"null","endLoc":810,"id":9190,"name":"__delattr__","nodeType":"Attribute","startLoc":810,"text":"__delattr__"},{"col":4,"comment":"null","endLoc":559,"header":"def replace_col(self, prev_col, new_col)","id":9191,"name":"replace_col","nodeType":"Function","startLoc":558,"text":"def replace_col(self, prev_col, new_col):\n        self.index.replace_col(prev_col, new_col)"},{"className":"BoxLeastSquares","col":0,"comment":"\n    Compute the box least squares periodogram.\n\n    This class has been deprecated and will be removed in a future version.\n    Use `astropy.timeseries.BoxLeastSquares` instead.\n    ","endLoc":32,"id":9192,"nodeType":"Class","startLoc":19,"text":"class BoxLeastSquares(TimeseriesBoxLeastSquares):\n    \"\"\"\n    Compute the box least squares periodogram.\n\n    This class has been deprecated and will be removed in a future version.\n    Use `astropy.timeseries.BoxLeastSquares` instead.\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n        warnings.warn('Importing BoxLeastSquares from astropy.stats has been '\n                      'deprecated and will no longer be supported in future. '\n                      'Please import this class from the astropy.timeseries '\n                      'module instead', AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)"},{"col":4,"comment":"\n        Replace an indexed column with an updated reference.\n\n        Parameters\n        ----------\n        prev_col : Column\n            Column reference to replace\n        new_col : Column\n            New column reference\n        ","endLoc":137,"header":"def replace_col(self, prev_col, new_col)","id":9193,"name":"replace_col","nodeType":"Function","startLoc":126,"text":"def replace_col(self, prev_col, new_col):\n        '''\n        Replace an indexed column with an updated reference.\n\n        Parameters\n        ----------\n        prev_col : Column\n            Column reference to replace\n        new_col : Column\n            New column reference\n        '''\n        self.columns[self.col_position(prev_col.info.name)] = new_col"},{"col":4,"comment":"null","endLoc":32,"header":"def __init__(self, *args, **kwargs)","id":9194,"name":"__init__","nodeType":"Function","startLoc":27,"text":"def __init__(self, *args, **kwargs):\n        warnings.warn('Importing BoxLeastSquares from astropy.stats has been '\n                      'deprecated and will no longer be supported in future. '\n                      'Please import this class from the astropy.timeseries '\n                      'module instead', AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)"},{"col":4,"comment":"null","endLoc":562,"header":"def reload(self)","id":9195,"name":"reload","nodeType":"Function","startLoc":561,"text":"def reload(self):\n        self.index.reload()"},{"col":4,"comment":"\n        Return nodes in the given range.\n        ","endLoc":415,"header":"def range_nodes(self, lower, upper, bounds=(True, True))","id":9196,"name":"range_nodes","nodeType":"Function","startLoc":406,"text":"def range_nodes(self, lower, upper, bounds=(True, True)):\n        '''\n        Return nodes in the given range.\n        '''\n        if self.root is None:\n            return []\n        # op1 is <= or <, op2 is >= or >\n        op1 = operator.le if bounds[0] else operator.lt\n        op2 = operator.ge if bounds[1] else operator.gt\n        return self._range(lower, upper, op1, op2, self.root, [])"},{"col":4,"comment":"null","endLoc":434,"header":"def _range(self, lower, upper, op1, op2, node, lst)","id":9197,"name":"_range","nodeType":"Function","startLoc":427,"text":"def _range(self, lower, upper, op1, op2, node, lst):\n        if op1(lower, node.key) and op2(upper, node.key):\n            lst.append(node)\n        if upper > node.key and node.right is not None:\n            self._range(lower, upper, op1, op2, node.right, lst)\n        if lower < node.key and node.left is not None:\n            self._range(lower, upper, op1, op2, node.left, lst)\n        return lst"},{"col":4,"comment":"\n        Recreate the index based on data in self.columns.\n        ","endLoc":143,"header":"def reload(self)","id":9198,"name":"reload","nodeType":"Function","startLoc":139,"text":"def reload(self):\n        '''\n        Recreate the index based on data in self.columns.\n        '''\n        self.__init__(self.columns, engine=self.engine)"},{"col":4,"comment":"\n        Assuming the given value has smaller length than keys, return\n        nodes whose keys have this value as a prefix.\n        ","endLoc":425,"header":"def same_prefix(self, val)","id":9199,"name":"same_prefix","nodeType":"Function","startLoc":417,"text":"def same_prefix(self, val):\n        '''\n        Assuming the given value has smaller length than keys, return\n        nodes whose keys have this value as a prefix.\n        '''\n        if self.root is None:\n            return []\n        nodes = self._same_prefix(val, self.root, [])\n        return [x for node in nodes for x in node.data]"},{"className":"BoxLeastSquaresResults","col":0,"comment":"\n    The results of a BoxLeastSquares search.\n\n    This class has been deprecated and will be removed in a future version.\n    Use `astropy.timeseries.BoxLeastSquaresResults` instead.\n    ","endLoc":48,"id":9200,"nodeType":"Class","startLoc":35,"text":"class BoxLeastSquaresResults(TimeseriesBoxLeastSquaresResults):\n    \"\"\"\n    The results of a BoxLeastSquares search.\n\n    This class has been deprecated and will be removed in a future version.\n    Use `astropy.timeseries.BoxLeastSquaresResults` instead.\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n        warnings.warn('Importing BoxLeastSquaresResults from astropy.stats has been '\n                      'deprecated and will no longer be supported in future. '\n                      'Please import this class from the astropy.timeseries '\n                      'module instead', AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)"},{"col":4,"comment":"null","endLoc":48,"header":"def __init__(self, *args, **kwargs)","id":9201,"name":"__init__","nodeType":"Function","startLoc":43,"text":"def __init__(self, *args, **kwargs):\n        warnings.warn('Importing BoxLeastSquaresResults from astropy.stats has been '\n                      'deprecated and will no longer be supported in future. '\n                      'Please import this class from the astropy.timeseries '\n                      'module instead', AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)"},{"col":4,"comment":"null","endLoc":565,"header":"def col_position(self, col_name)","id":9202,"name":"col_position","nodeType":"Function","startLoc":564,"text":"def col_position(self, col_name):\n        return self.index.col_position(col_name)"},{"col":4,"comment":"\n        Find rows corresponding to the given key.\n        ","endLoc":93,"header":"def find(self, key)","id":9203,"name":"find","nodeType":"Function","startLoc":89,"text":"def find(self, key):\n        '''\n        Find rows corresponding to the given key.\n        '''\n        return [node.value for node in self._nodes.irange(key, key)]"},{"col":4,"comment":"\n        Remove data from the given key.\n        ","endLoc":109,"header":"def remove(self, key, data=None)","id":9204,"name":"remove","nodeType":"Function","startLoc":95,"text":"def remove(self, key, data=None):\n        '''\n        Remove data from the given key.\n        '''\n        if data is not None:\n            item = Node(key, data)\n            try:\n                self._nodes.remove(item)\n            except ValueError:\n                return False\n            return True\n        items = list(self._nodes.irange(key, key))\n        for item in items:\n            self._nodes.remove(item)\n        return bool(items)"},{"col":4,"comment":"\n        Return a newly created index from the given slice.\n\n        Parameters\n        ----------\n        col_slice : Column object\n            Already existing slice of a single column\n        item : list or ndarray\n            Slice for retrieval\n        ","endLoc":587,"header":"def get_slice(self, col_slice, item)","id":9205,"name":"get_slice","nodeType":"Function","startLoc":567,"text":"def get_slice(self, col_slice, item):\n        '''\n        Return a newly created index from the given slice.\n\n        Parameters\n        ----------\n        col_slice : Column object\n            Already existing slice of a single column\n        item : list or ndarray\n            Slice for retrieval\n        '''\n        from .table import Table\n        if len(self.columns) == 1:\n            index = Index([col_slice], engine=self.data.__class__)\n            return self.__class__(index, slice(0, 0, None), original=True)\n\n        t = Table(self.columns, copy_indices=False)\n        with t.index_mode('discard_on_copy'):\n            new_cols = t[item].columns.values()\n        index = Index(new_cols, engine=self.data.__class__)\n        return self.__class__(index, slice(0, 0, None), original=True)"},{"col":0,"comment":"null","endLoc":1034,"header":"def _get_join_sort_idxs(keys, left, right)","id":9206,"name":"_get_join_sort_idxs","nodeType":"Function","startLoc":976,"text":"def _get_join_sort_idxs(keys, left, right):\n    # Go through each of the key columns in order and make columns for\n    # a new structured array that represents the lexical ordering of those\n    # key columns. This structured array is then argsort'ed. The trick here\n    # is that some columns (e.g. Time) may need to be expanded into multiple\n    # columns for ordering here.\n\n    ii = 0  # Index for uniquely naming the sort columns\n    sort_keys_dtypes = []  # sortable_table dtypes as list of (name, dtype_str, shape) tuples\n    sort_keys = []  # sortable_table (structured ndarray) column names\n    sort_left = {}  # sortable ndarrays from left table\n    sort_right = {}  # sortable ndarray from right table\n\n    for key in keys:\n        # get_sortable_arrays() returns a list of ndarrays that can be lexically\n        # sorted to represent the order of the column. In most cases this is just\n        # a single element of the column itself.\n        left_sort_cols = left[key].info.get_sortable_arrays()\n        right_sort_cols = right[key].info.get_sortable_arrays()\n\n        if len(left_sort_cols) != len(right_sort_cols):\n            # Should never happen because cols are screened beforehand for compatibility\n            raise RuntimeError('mismatch in sort cols lengths')\n\n        for left_sort_col, right_sort_col in zip(left_sort_cols, right_sort_cols):\n            # Check for consistency of shapes. Mismatch should never happen.\n            shape = left_sort_col.shape[1:]\n            if shape != right_sort_col.shape[1:]:\n                raise RuntimeError('mismatch in shape of left vs. right sort array')\n\n            if shape != ():\n                raise ValueError(f'sort key column {key!r} must be 1-d')\n\n            sort_key = str(ii)\n            sort_keys.append(sort_key)\n            sort_left[sort_key] = left_sort_col\n            sort_right[sort_key] = right_sort_col\n\n            # Build up dtypes for the structured array that gets sorted.\n            dtype_str = common_dtype([left_sort_col, right_sort_col])\n            sort_keys_dtypes.append((sort_key, dtype_str))\n            ii += 1\n\n    # Make the empty sortable table and fill it\n    len_left = len(left)\n    sortable_table = np.empty(len_left + len(right), dtype=sort_keys_dtypes)\n    for key in sort_keys:\n        sortable_table[key][:len_left] = sort_left[key]\n        sortable_table[key][len_left:] = sort_right[key]\n\n    # Finally do the (lexical) argsort and make a new sorted version\n    idx_sort = sortable_table.argsort(order=sort_keys)\n    sorted_table = sortable_table[idx_sort]\n\n    # Get indexes of unique elements (i.e. the group boundaries)\n    diffs = np.concatenate(([True], sorted_table[1:] != sorted_table[:-1], [True]))\n    idxs = np.flatnonzero(diffs)\n\n    return idxs, idx_sort"},{"col":4,"comment":"\n        Decrement rows larger than the given row.\n        ","endLoc":117,"header":"def shift_left(self, row)","id":9207,"name":"shift_left","nodeType":"Function","startLoc":111,"text":"def shift_left(self, row):\n        '''\n        Decrement rows larger than the given row.\n        '''\n        for node in self._nodes:\n            if node.value > row:\n                node.value -= 1"},{"col":4,"comment":"\n        Increment rows greater than or equal to the given row.\n        ","endLoc":125,"header":"def shift_right(self, row)","id":9208,"name":"shift_right","nodeType":"Function","startLoc":119,"text":"def shift_right(self, row):\n        '''\n        Increment rows greater than or equal to the given row.\n        '''\n        for node in self._nodes:\n            if node.value >= row:\n                node.value += 1"},{"col":4,"comment":"\n        Return a list of key, data tuples.\n        ","endLoc":137,"header":"def items(self)","id":9209,"name":"items","nodeType":"Function","startLoc":127,"text":"def items(self):\n        '''\n        Return a list of key, data tuples.\n        '''\n        result = OrderedDict()\n        for node in self._nodes:\n            if node.key in result:\n                result[node.key].append(node.value)\n            else:\n                result[node.key] = [node.value]\n        return result.items()"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":9210,"name":"__all__","nodeType":"Attribute","startLoc":16,"text":"__all__"},{"col":0,"comment":"","endLoc":10,"header":"__init__.py#<anonymous>","id":9211,"name":"<anonymous>","nodeType":"Function","startLoc":10,"text":"__all__ = ['BoxLeastSquares', 'BoxLeastSquaresResults']"},{"col":4,"comment":"\n        Make row order align with key order.\n        ","endLoc":144,"header":"def sort(self)","id":9212,"name":"sort","nodeType":"Function","startLoc":139,"text":"def sort(self):\n        '''\n        Make row order align with key order.\n        '''\n        for index, node in enumerate(self._nodes):\n            node.value = index"},{"col":4,"comment":"\n        Return a list of rows in order sorted by key.\n        ","endLoc":150,"header":"def sorted_data(self)","id":9213,"name":"sorted_data","nodeType":"Function","startLoc":146,"text":"def sorted_data(self):\n        '''\n        Return a list of rows in order sorted by key.\n        '''\n        return [node.value for node in self._nodes]"},{"col":4,"comment":"\n        Return row values in the given range.\n        ","endLoc":157,"header":"def range(self, lower, upper, bounds=(True, True))","id":9214,"name":"range","nodeType":"Function","startLoc":152,"text":"def range(self, lower, upper, bounds=(True, True)):\n        '''\n        Return row values in the given range.\n        '''\n        iterator = self._nodes.irange(lower, upper, bounds)\n        return [node.value for node in iterator]"},{"col":4,"comment":"\n        Replace rows with the values in row_map.\n        ","endLoc":167,"header":"def replace_rows(self, row_map)","id":9215,"name":"replace_rows","nodeType":"Function","startLoc":159,"text":"def replace_rows(self, row_map):\n        '''\n        Replace rows with the values in row_map.\n        '''\n        nodes = [node for node in self._nodes if node.value in row_map]\n        for node in nodes:\n            node.value = row_map[node.value]\n        self._nodes.clear()\n        self._nodes.update(nodes)"},{"col":4,"comment":"null","endLoc":175,"header":"def __repr__(self)","id":9216,"name":"__repr__","nodeType":"Function","startLoc":169,"text":"def __repr__(self):\n        if len(self._nodes) > 6:\n            nodes = list(self._nodes[:3]) + ['...'] + list(self._nodes[-3:])\n        else:\n            nodes = self._nodes\n        nodes_str = ', '.join(str(node) for node in nodes)\n        return f'<{self.__class__.__name__} nodes={nodes_str}>'"},{"attributeType":"null","col":8,"comment":"null","endLoc":78,"id":9217,"name":"_unique","nodeType":"Attribute","startLoc":78,"text":"self._unique"},{"attributeType":"null","col":8,"comment":"null","endLoc":77,"id":9218,"name":"_nodes","nodeType":"Attribute","startLoc":77,"text":"self._nodes"},{"col":0,"comment":"","endLoc":6,"header":"soco.py#<anonymous>","id":9219,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThe SCEngine class uses the ``sortedcontainers`` package to implement an\nIndex engine for Tables.\n\"\"\"\n\nif HAS_SORTEDCONTAINERS:\n    from sortedcontainers import SortedList"},{"fileName":"pprint.py","filePath":"astropy/table","id":9220,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\nimport sys\nimport re\nimport fnmatch\n\nimport numpy as np\n\nfrom astropy import log\nfrom astropy.utils.console import Getch, color_print, terminal_size, conf\nfrom astropy.utils.data_info import dtype_info_name\n\n__all__ = []\n\n\ndef default_format_func(format_, val):\n    if isinstance(val, bytes):\n        return val.decode('utf-8', errors='replace')\n    else:\n        return str(val)\n\n\n# The first three functions are helpers for _auto_format_func\n\ndef _use_str_for_masked_values(format_func):\n    \"\"\"Wrap format function to trap masked values.\n\n    String format functions and most user functions will not be able to deal\n    with masked values, so we wrap them to ensure they are passed to str().\n    \"\"\"\n    return lambda format_, val: (str(val) if val is np.ma.masked\n                                 else format_func(format_, val))\n\n\ndef _possible_string_format_functions(format_):\n    \"\"\"Iterate through possible string-derived format functions.\n\n    A string can either be a format specifier for the format built-in,\n    a new-style format string, or an old-style format string.\n    \"\"\"\n    yield lambda format_, val: format(val, format_)\n    yield lambda format_, val: format_.format(val)\n    yield lambda format_, val: format_ % val\n\n\ndef get_auto_format_func(\n        col=None,\n        possible_string_format_functions=_possible_string_format_functions):\n    \"\"\"\n    Return a wrapped ``auto_format_func`` function which is used in\n    formatting table columns.  This is primarily an internal function but\n    gets used directly in other parts of astropy, e.g. `astropy.io.ascii`.\n\n    Parameters\n    ----------\n    col_name : object, optional\n        Hashable object to identify column like id or name. Default is None.\n\n    possible_string_format_functions : func, optional\n        Function that yields possible string formatting functions\n        (defaults to internal function to do this).\n\n    Returns\n    -------\n    Wrapped ``auto_format_func`` function\n    \"\"\"\n\n    def _auto_format_func(format_, val):\n        \"\"\"Format ``val`` according to ``format_`` for a plain format specifier,\n        old- or new-style format strings, or using a user supplied function.\n        More importantly, determine and cache (in _format_funcs) a function\n        that will do this subsequently.  In this way this complicated logic is\n        only done for the first value.\n\n        Returns the formatted value.\n        \"\"\"\n        if format_ is None:\n            return default_format_func(format_, val)\n\n        if format_ in col.info._format_funcs:\n            return col.info._format_funcs[format_](format_, val)\n\n        if callable(format_):\n            format_func = lambda format_, val: format_(val)  # noqa\n            try:\n                out = format_func(format_, val)\n                if not isinstance(out, str):\n                    raise ValueError('Format function for value {} returned {} '\n                                     'instead of string type'\n                                     .format(val, type(val)))\n            except Exception as err:\n                # For a masked element, the format function call likely failed\n                # to handle it.  Just return the string representation for now,\n                # and retry when a non-masked value comes along.\n                if val is np.ma.masked:\n                    return str(val)\n\n                raise ValueError(f'Format function for value {val} failed.') from err\n            # If the user-supplied function handles formatting masked elements, use\n            # it directly.  Otherwise, wrap it in a function that traps them.\n            try:\n                format_func(format_, np.ma.masked)\n            except Exception:\n                format_func = _use_str_for_masked_values(format_func)\n        else:\n            # For a masked element, we cannot set string-based format functions yet,\n            # as all tests below will fail.  Just return the string representation\n            # of masked for now, and retry when a non-masked value comes along.\n            if val is np.ma.masked:\n                return str(val)\n\n            for format_func in possible_string_format_functions(format_):\n                try:\n                    # Does this string format method work?\n                    out = format_func(format_, val)\n                    # Require that the format statement actually did something.\n                    if out == format_:\n                        raise ValueError('the format passed in did nothing.')\n                except Exception:\n                    continue\n                else:\n                    break\n            else:\n                # None of the possible string functions passed muster.\n                raise ValueError('unable to parse format string {} for its '\n                                 'column.'.format(format_))\n\n            # String-based format functions will fail on masked elements;\n            # wrap them in a function that traps them.\n            format_func = _use_str_for_masked_values(format_func)\n\n        col.info._format_funcs[format_] = format_func\n        return out\n\n    return _auto_format_func\n\n\ndef _get_pprint_include_names(table):\n    \"\"\"Get the set of names to show in pprint from the table pprint_include_names\n    and pprint_exclude_names attributes.\n\n    These may be fnmatch unix-style globs.\n    \"\"\"\n    def get_matches(name_globs, default):\n        match_names = set()\n        if name_globs:  # For None or () use the default\n            for name in table.colnames:\n                for name_glob in name_globs:\n                    if fnmatch.fnmatch(name, name_glob):\n                        match_names.add(name)\n                        break\n        else:\n            match_names.update(default)\n        return match_names\n\n    include_names = get_matches(table.pprint_include_names(), table.colnames)\n    exclude_names = get_matches(table.pprint_exclude_names(), [])\n\n    return include_names - exclude_names\n\n\nclass TableFormatter:\n    @staticmethod\n    def _get_pprint_size(max_lines=None, max_width=None):\n        \"\"\"Get the output size (number of lines and character width) for Column and\n        Table pformat/pprint methods.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default will be determined\n        using the ``astropy.table.conf.max_lines`` configuration item. If a\n        negative value of ``max_lines`` is supplied then there is no line\n        limit applied.\n\n        The same applies for max_width except the configuration item is\n        ``astropy.table.conf.max_width``.\n\n        Parameters\n        ----------\n        max_lines : int or None\n            Maximum lines of output (header + data rows)\n\n        max_width : int or None\n            Maximum width (characters) output\n\n        Returns\n        -------\n        max_lines, max_width : int\n\n        \"\"\"\n        # Declare to keep static type checker happy.\n        lines = None\n        width = None\n\n        if max_lines is None:\n            max_lines = conf.max_lines\n\n        if max_width is None:\n            max_width = conf.max_width\n\n        if max_lines is None or max_width is None:\n            lines, width = terminal_size()\n\n        if max_lines is None:\n            max_lines = lines\n        elif max_lines < 0:\n            max_lines = sys.maxsize\n        if max_lines < 8:\n            max_lines = 8\n\n        if max_width is None:\n            max_width = width\n        elif max_width < 0:\n            max_width = sys.maxsize\n        if max_width < 10:\n            max_width = 10\n\n        return max_lines, max_width\n\n    def _pformat_col(self, col, max_lines=None, show_name=True, show_unit=None,\n                     show_dtype=False, show_length=None, html=False, align=None):\n        \"\"\"Return a list of formatted string representation of column values.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum lines of output (header + data rows)\n\n        show_name : bool\n            Include column name. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        show_dtype : bool\n            Include column dtype. Default is False.\n\n        show_length : bool\n            Include column length at end.  Default is to show this only\n            if the column is not shown completely.\n\n        html : bool\n            Output column as HTML\n\n        align : str\n            Left/right alignment of columns. Default is '>' (right) for all\n            columns. Other allowed values are '<', '^', and '0=' for left,\n            centered, and 0-padded, respectively.\n\n        Returns\n        -------\n        lines : list\n            List of lines with formatted column values\n\n        outs : dict\n            Dict which is used to pass back additional values\n            defined within the iterator.\n\n        \"\"\"\n        if show_unit is None:\n            show_unit = col.info.unit is not None\n\n        outs = {}  # Some values from _pformat_col_iter iterator that are needed here\n        col_strs_iter = self._pformat_col_iter(col, max_lines, show_name=show_name,\n                                               show_unit=show_unit,\n                                               show_dtype=show_dtype,\n                                               show_length=show_length,\n                                               outs=outs)\n\n        # Replace tab and newline with text representations so they display nicely.\n        # Newline in particular is a problem in a multicolumn table.\n        col_strs = [val.replace('\\t', '\\\\t').replace('\\n', '\\\\n') for val in col_strs_iter]\n        if len(col_strs) > 0:\n            col_width = max(len(x) for x in col_strs)\n\n        if html:\n            from astropy.utils.xml.writer import xml_escape\n            n_header = outs['n_header']\n            for i, col_str in enumerate(col_strs):\n                # _pformat_col output has a header line '----' which is not needed here\n                if i == n_header - 1:\n                    continue\n                td = 'th' if i < n_header else 'td'\n                val = f'<{td}>{xml_escape(col_str.strip())}</{td}>'\n                row = ('<tr>' + val + '</tr>')\n                if i < n_header:\n                    row = ('<thead>' + row + '</thead>')\n                col_strs[i] = row\n\n            if n_header > 0:\n                # Get rid of '---' header line\n                col_strs.pop(n_header - 1)\n            col_strs.insert(0, '<table>')\n            col_strs.append('</table>')\n\n        # Now bring all the column string values to the same fixed width\n        else:\n            col_width = max(len(x) for x in col_strs) if col_strs else 1\n\n            # Center line header content and generate dashed headerline\n            for i in outs['i_centers']:\n                col_strs[i] = col_strs[i].center(col_width)\n            if outs['i_dashes'] is not None:\n                col_strs[outs['i_dashes']] = '-' * col_width\n\n            # Format columns according to alignment.  `align` arg has precedent, otherwise\n            # use `col.format` if it starts as a legal alignment string.  If neither applies\n            # then right justify.\n            re_fill_align = re.compile(r'(?P<fill>.?)(?P<align>[<^>=])')\n            match = None\n            if align:\n                # If there is an align specified then it must match\n                match = re_fill_align.match(align)\n                if not match:\n                    raise ValueError(\"column align must be one of '<', '^', '>', or '='\")\n            elif isinstance(col.info.format, str):\n                # col.info.format need not match, in which case rjust gets used\n                match = re_fill_align.match(col.info.format)\n\n            if match:\n                fill_char = match.group('fill')\n                align_char = match.group('align')\n                if align_char == '=':\n                    if fill_char != '0':\n                        raise ValueError(\"fill character must be '0' for '=' align\")\n                    fill_char = ''  # str.zfill gets used which does not take fill char arg\n            else:\n                fill_char = ''\n                align_char = '>'\n\n            justify_methods = {'<': 'ljust', '^': 'center', '>': 'rjust', '=': 'zfill'}\n            justify_method = justify_methods[align_char]\n            justify_args = (col_width, fill_char) if fill_char else (col_width,)\n\n            for i, col_str in enumerate(col_strs):\n                col_strs[i] = getattr(col_str, justify_method)(*justify_args)\n\n        if outs['show_length']:\n            col_strs.append(f'Length = {len(col)} rows')\n\n        return col_strs, outs\n\n    def _pformat_col_iter(self, col, max_lines, show_name, show_unit, outs,\n                          show_dtype=False, show_length=None):\n        \"\"\"Iterator which yields formatted string representation of column values.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum lines of output (header + data rows)\n\n        show_name : bool\n            Include column name. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        outs : dict\n            Must be a dict which is used to pass back additional values\n            defined within the iterator.\n\n        show_dtype : bool\n            Include column dtype. Default is False.\n\n        show_length : bool\n            Include column length at end.  Default is to show this only\n            if the column is not shown completely.\n        \"\"\"\n        max_lines, _ = self._get_pprint_size(max_lines, -1)\n\n        multidims = getattr(col, 'shape', [0])[1:]\n        if multidims:\n            multidim0 = tuple(0 for n in multidims)\n            multidim1 = tuple(n - 1 for n in multidims)\n            trivial_multidims = np.prod(multidims) == 1\n\n        i_dashes = None\n        i_centers = []  # Line indexes where content should be centered\n        n_header = 0\n        if show_name:\n            i_centers.append(n_header)\n            # Get column name (or 'None' if not set)\n            col_name = str(col.info.name)\n            if multidims:\n                col_name += f\" [{','.join(str(n) for n in multidims)}]\"\n            n_header += 1\n            yield col_name\n        if show_unit:\n            i_centers.append(n_header)\n            n_header += 1\n            yield str(col.info.unit or '')\n        if show_dtype:\n            i_centers.append(n_header)\n            n_header += 1\n            try:\n                dtype = dtype_info_name(col.dtype)\n            except AttributeError:\n                dtype = col.__class__.__qualname__ or 'object'\n            yield str(dtype)\n        if show_unit or show_name or show_dtype:\n            i_dashes = n_header\n            n_header += 1\n            yield '---'\n\n        max_lines -= n_header\n        n_print2 = max_lines // 2\n        n_rows = len(col)\n\n        # This block of code is responsible for producing the function that\n        # will format values for this column.  The ``format_func`` function\n        # takes two args (col_format, val) and returns the string-formatted\n        # version.  Some points to understand:\n        #\n        # - col_format could itself be the formatting function, so it will\n        #    actually end up being called with itself as the first arg.  In\n        #    this case the function is expected to ignore its first arg.\n        #\n        # - auto_format_func is a function that gets called on the first\n        #    column value that is being formatted.  It then determines an\n        #    appropriate formatting function given the actual value to be\n        #    formatted.  This might be deterministic or it might involve\n        #    try/except.  The latter allows for different string formatting\n        #    options like %f or {:5.3f}.  When auto_format_func is called it:\n\n        #    1. Caches the function in the _format_funcs dict so for subsequent\n        #       values the right function is called right away.\n        #    2. Returns the formatted value.\n        #\n        # - possible_string_format_functions is a function that yields a\n        #    succession of functions that might successfully format the\n        #    value.  There is a default, but Mixin methods can override this.\n        #    See Quantity for an example.\n        #\n        # - get_auto_format_func() returns a wrapped version of auto_format_func\n        #    with the column id and possible_string_format_functions as\n        #    enclosed variables.\n        col_format = col.info.format or getattr(col.info, 'default_format',\n                                                None)\n        pssf = (getattr(col.info, 'possible_string_format_functions', None)\n                or _possible_string_format_functions)\n        auto_format_func = get_auto_format_func(col, pssf)\n        format_func = col.info._format_funcs.get(col_format, auto_format_func)\n\n        if len(col) > max_lines:\n            if show_length is None:\n                show_length = True\n            i0 = n_print2 - (1 if show_length else 0)\n            i1 = n_rows - n_print2 - max_lines % 2\n            indices = np.concatenate([np.arange(0, i0 + 1),\n                                      np.arange(i1 + 1, len(col))])\n        else:\n            i0 = -1\n            indices = np.arange(len(col))\n\n        def format_col_str(idx):\n            if multidims:\n                # Prevents columns like Column(data=[[(1,)],[(2,)]], name='a')\n                # with shape (n,1,...,1) from being printed as if there was\n                # more than one element in a row\n                if trivial_multidims:\n                    return format_func(col_format, col[(idx,) + multidim0])\n                else:\n                    left = format_func(col_format, col[(idx,) + multidim0])\n                    right = format_func(col_format, col[(idx,) + multidim1])\n                    return f'{left} .. {right}'\n            else:\n                return format_func(col_format, col[idx])\n\n        # Add formatted values if within bounds allowed by max_lines\n        for idx in indices:\n            if idx == i0:\n                yield '...'\n            else:\n                try:\n                    yield format_col_str(idx)\n                except ValueError:\n                    raise ValueError(\n                        'Unable to parse format string \"{}\" for entry \"{}\" '\n                        'in column \"{}\"'.format(col_format, col[idx],\n                                                col.info.name))\n\n        outs['show_length'] = show_length\n        outs['n_header'] = n_header\n        outs['i_centers'] = i_centers\n        outs['i_dashes'] = i_dashes\n\n    def _pformat_table(self, table, max_lines=None, max_width=None,\n                       show_name=True, show_unit=None, show_dtype=False,\n                       html=False, tableid=None, tableclass=None, align=None):\n        \"\"\"Return a list of lines for the formatted string representation of\n        the table.\n\n        Parameters\n        ----------\n        max_lines : int or None\n            Maximum number of rows to output\n\n        max_width : int or None\n            Maximum character width of output\n\n        show_name : bool\n            Include a header row for column names. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        show_dtype : bool\n            Include a header row for column dtypes. Default is False.\n\n        html : bool\n            Format the output as an HTML table. Default is False.\n\n        tableid : str or None\n            An ID tag for the table; only used if html is set.  Default is\n            \"table{id}\", where id is the unique integer id of the table object,\n            id(table)\n\n        tableclass : str or list of str or None\n            CSS classes for the table; only used if html is set.  Default is\n            none\n\n        align : str or list or tuple\n            Left/right alignment of columns. Default is '>' (right) for all\n            columns. Other allowed values are '<', '^', and '0=' for left,\n            centered, and 0-padded, respectively. A list of strings can be\n            provided for alignment of tables with multiple columns.\n\n        Returns\n        -------\n        rows : list\n            Formatted table as a list of strings\n\n        outs : dict\n            Dict which is used to pass back additional values\n            defined within the iterator.\n\n        \"\"\"\n        # \"Print\" all the values into temporary lists by column for subsequent\n        # use and to determine the width\n        max_lines, max_width = self._get_pprint_size(max_lines, max_width)\n\n        if show_unit is None:\n            show_unit = any(col.info.unit for col in table.columns.values())\n\n        # Coerce align into a correctly-sized list of alignments (if possible)\n        n_cols = len(table.columns)\n        if align is None or isinstance(align, str):\n            align = [align] * n_cols\n\n        elif isinstance(align, (list, tuple)):\n            if len(align) != n_cols:\n                raise ValueError('got {} alignment values instead of '\n                                 'the number of columns ({})'\n                                 .format(len(align), n_cols))\n        else:\n            raise TypeError('align keyword must be str or list or tuple (got {})'\n                            .format(type(align)))\n\n        # Process column visibility from table pprint_include_names and\n        # pprint_exclude_names attributes and get the set of columns to show.\n        pprint_include_names = _get_pprint_include_names(table)\n\n        cols = []\n        outs = None  # Initialize so static type checker is happy\n        for align_, col in zip(align, table.columns.values()):\n            if col.info.name not in pprint_include_names:\n                continue\n\n            lines, outs = self._pformat_col(col, max_lines, show_name=show_name,\n                                            show_unit=show_unit, show_dtype=show_dtype,\n                                            align=align_)\n            if outs['show_length']:\n                lines = lines[:-1]\n            cols.append(lines)\n\n        if not cols:\n            return ['<No columns>'], {'show_length': False}\n\n        # Use the values for the last column since they are all the same\n        n_header = outs['n_header']\n\n        n_rows = len(cols[0])\n\n        def outwidth(cols):\n            return sum(len(c[0]) for c in cols) + len(cols) - 1\n\n        dots_col = ['...'] * n_rows\n        middle = len(cols) // 2\n        while outwidth(cols) > max_width:\n            if len(cols) == 1:\n                break\n            if len(cols) == 2:\n                cols[1] = dots_col\n                break\n            if cols[middle] is dots_col:\n                cols.pop(middle)\n                middle = len(cols) // 2\n            cols[middle] = dots_col\n\n        # Now \"print\" the (already-stringified) column values into a\n        # row-oriented list.\n        rows = []\n        if html:\n            from astropy.utils.xml.writer import xml_escape\n\n            if tableid is None:\n                tableid = f'table{id(table)}'\n\n            if tableclass is not None:\n                if isinstance(tableclass, list):\n                    tableclass = ' '.join(tableclass)\n                rows.append(f'<table id=\"{tableid}\" class=\"{tableclass}\">')\n            else:\n                rows.append(f'<table id=\"{tableid}\">')\n\n            for i in range(n_rows):\n                # _pformat_col output has a header line '----' which is not needed here\n                if i == n_header - 1:\n                    continue\n                td = 'th' if i < n_header else 'td'\n                vals = (f'<{td}>{xml_escape(col[i].strip())}</{td}>'\n                        for col in cols)\n                row = ('<tr>' + ''.join(vals) + '</tr>')\n                if i < n_header:\n                    row = ('<thead>' + row + '</thead>')\n                rows.append(row)\n            rows.append('</table>')\n        else:\n            for i in range(n_rows):\n                row = ' '.join(col[i] for col in cols)\n                rows.append(row)\n\n        return rows, outs\n\n    def _more_tabcol(self, tabcol, max_lines=None, max_width=None,\n                     show_name=True, show_unit=None, show_dtype=False):\n        \"\"\"Interactive \"more\" of a table or column.\n\n        Parameters\n        ----------\n        max_lines : int or None\n            Maximum number of rows to output\n\n        max_width : int or None\n            Maximum character width of output\n\n        show_name : bool\n            Include a header row for column names. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        show_dtype : bool\n            Include a header row for column dtypes. Default is False.\n        \"\"\"\n        allowed_keys = 'f br<>qhpn'\n\n        # Count the header lines\n        n_header = 0\n        if show_name:\n            n_header += 1\n        if show_unit:\n            n_header += 1\n        if show_dtype:\n            n_header += 1\n        if show_name or show_unit or show_dtype:\n            n_header += 1\n\n        # Set up kwargs for pformat call.  Only Table gets max_width.\n        kwargs = dict(max_lines=-1, show_name=show_name, show_unit=show_unit,\n                      show_dtype=show_dtype)\n        if hasattr(tabcol, 'columns'):  # tabcol is a table\n            kwargs['max_width'] = max_width\n\n        # If max_lines is None (=> query screen size) then increase by 2.\n        # This is because get_pprint_size leaves 6 extra lines so that in\n        # ipython you normally see the last input line.\n        max_lines1, max_width = self._get_pprint_size(max_lines, max_width)\n        if max_lines is None:\n            max_lines1 += 2\n        delta_lines = max_lines1 - n_header\n\n        # Set up a function to get a single character on any platform\n        inkey = Getch()\n\n        i0 = 0  # First table/column row to show\n        showlines = True\n        while True:\n            i1 = i0 + delta_lines  # Last table/col row to show\n            if showlines:  # Don't always show the table (e.g. after help)\n                try:\n                    os.system('cls' if os.name == 'nt' else 'clear')\n                except Exception:\n                    pass  # No worries if clear screen call fails\n                lines = tabcol[i0:i1].pformat(**kwargs)\n                colors = ('red' if i < n_header else 'default'\n                          for i in range(len(lines)))\n                for color, line in zip(colors, lines):\n                    color_print(line, color)\n            showlines = True\n            print()\n            print(\"-- f, <space>, b, r, p, n, <, >, q h (help) --\", end=' ')\n            # Get a valid key\n            while True:\n                try:\n                    key = inkey().lower()\n                except Exception:\n                    print(\"\\n\")\n                    log.error('Console does not support getting a character'\n                              ' as required by more().  Use pprint() instead.')\n                    return\n                if key in allowed_keys:\n                    break\n            print(key)\n\n            if key.lower() == 'q':\n                break\n            elif key == ' ' or key == 'f':\n                i0 += delta_lines\n            elif key == 'b':\n                i0 = i0 - delta_lines\n            elif key == 'r':\n                pass\n            elif key == '<':\n                i0 = 0\n            elif key == '>':\n                i0 = len(tabcol)\n            elif key == 'p':\n                i0 -= 1\n            elif key == 'n':\n                i0 += 1\n            elif key == 'h':\n                showlines = False\n                print(\"\"\"\n    Browsing keys:\n       f, <space> : forward one page\n       b : back one page\n       r : refresh same page\n       n : next row\n       p : previous row\n       < : go to beginning\n       > : go to end\n       q : quit browsing\n       h : print this help\"\"\", end=' ')\n            if i0 < 0:\n                i0 = 0\n            if i0 >= len(tabcol) - delta_lines:\n                i0 = len(tabcol) - delta_lines\n            print(\"\\n\")\n"},{"fileName":"ndarray_mixin.py","filePath":"astropy/table","id":9221,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport numpy as np\n\nfrom astropy.utils.data_info import ParentDtypeInfo\n\n\nclass NdarrayMixinInfo(ParentDtypeInfo):\n    _represent_as_dict_primary_data = 'data'\n\n    def _represent_as_dict(self):\n        \"\"\"Represent Column as a dict that can be serialized.\"\"\"\n        col = self._parent\n        out = {'data': col.view(np.ndarray)}\n        return out\n\n    def _construct_from_dict(self, map):\n        \"\"\"Construct Column from ``map``.\"\"\"\n        data = map.pop('data')\n        out = self._parent_cls(data, **map)\n        return out\n\n\nclass NdarrayMixin(np.ndarray):\n    \"\"\"\n    Mixin column class to allow storage of arbitrary numpy\n    ndarrays within a Table.  This is a subclass of numpy.ndarray\n    and has the same initialization options as ``np.array()``.\n    \"\"\"\n    info = NdarrayMixinInfo()\n\n    def __new__(cls, obj, *args, **kwargs):\n        self = np.array(obj, *args, **kwargs).view(cls)\n        if 'info' in getattr(obj, '__dict__', ()):\n            self.info = obj.info\n        return self\n\n    def __array_finalize__(self, obj):\n        if obj is None:\n            return\n\n        if callable(super().__array_finalize__):\n            super().__array_finalize__(obj)\n\n        # Self was created from template (e.g. obj[slice] or (obj * 2))\n        # or viewcast e.g. obj.view(Column).  In either case we want to\n        # init Column attributes for self from obj if possible.\n        if 'info' in getattr(obj, '__dict__', ()):\n            self.info = obj.info\n\n    def __reduce__(self):\n        # patch to pickle NdArrayMixin objects (ndarray subclasses), see\n        # http://www.mail-archive.com/numpy-discussion@scipy.org/msg02446.html\n\n        object_state = list(super().__reduce__())\n        object_state[2] = (object_state[2], self.__dict__)\n        return tuple(object_state)\n\n    def __setstate__(self, state):\n        # patch to unpickle NdarrayMixin objects (ndarray subclasses), see\n        # http://www.mail-archive.com/numpy-discussion@scipy.org/msg02446.html\n\n        nd_state, own_state = state\n        super().__setstate__(nd_state)\n        self.__dict__.update(own_state)\n"},{"className":"ParentDtypeInfo","col":0,"comment":"Mixin that gets info.dtype from parent","endLoc":759,"id":9222,"nodeType":"Class","startLoc":756,"text":"class ParentDtypeInfo(MixinInfo):\n    \"\"\"Mixin that gets info.dtype from parent\"\"\"\n\n    attrs_from_parent = set(['dtype'])  # dtype and unit taken from parent"},{"attributeType":"null","col":4,"comment":"null","endLoc":759,"id":9223,"name":"attrs_from_parent","nodeType":"Attribute","startLoc":759,"text":"attrs_from_parent"},{"className":"NdarrayMixinInfo","col":0,"comment":"null","endLoc":21,"id":9224,"nodeType":"Class","startLoc":8,"text":"class NdarrayMixinInfo(ParentDtypeInfo):\n    _represent_as_dict_primary_data = 'data'\n\n    def _represent_as_dict(self):\n        \"\"\"Represent Column as a dict that can be serialized.\"\"\"\n        col = self._parent\n        out = {'data': col.view(np.ndarray)}\n        return out\n\n    def _construct_from_dict(self, map):\n        \"\"\"Construct Column from ``map``.\"\"\"\n        data = map.pop('data')\n        out = self._parent_cls(data, **map)\n        return out"},{"col":4,"comment":"Represent Column as a dict that can be serialized.","endLoc":15,"header":"def _represent_as_dict(self)","id":9225,"name":"_represent_as_dict","nodeType":"Function","startLoc":11,"text":"def _represent_as_dict(self):\n        \"\"\"Represent Column as a dict that can be serialized.\"\"\"\n        col = self._parent\n        out = {'data': col.view(np.ndarray)}\n        return out"},{"className":"Getch","col":0,"comment":"Get a single character from standard input without screen echo.\n\n    Returns\n    -------\n    char : str (one character)\n    ","endLoc":1133,"id":9226,"nodeType":"Class","startLoc":1115,"text":"class Getch:\n    \"\"\"Get a single character from standard input without screen echo.\n\n    Returns\n    -------\n    char : str (one character)\n    \"\"\"\n\n    def __init__(self):\n        try:\n            self.impl = _GetchWindows()\n        except ImportError:\n            try:\n                self.impl = _GetchMacCarbon()\n            except (ImportError, AttributeError):\n                self.impl = _GetchUnix()\n\n    def __call__(self):\n        return self.impl()"},{"col":4,"comment":"null","endLoc":1130,"header":"def __init__(self)","id":9227,"name":"__init__","nodeType":"Function","startLoc":1123,"text":"def __init__(self):\n        try:\n            self.impl = _GetchWindows()\n        except ImportError:\n            try:\n                self.impl = _GetchMacCarbon()\n            except (ImportError, AttributeError):\n                self.impl = _GetchUnix()"},{"col":4,"comment":"null","endLoc":444,"header":"def _same_prefix(self, val, node, lst)","id":9228,"name":"_same_prefix","nodeType":"Function","startLoc":436,"text":"def _same_prefix(self, val, node, lst):\n        prefix = node.key[:len(val)]\n        if prefix == val:\n            lst.append(node)\n        if prefix <= val and node.right is not None:\n            self._same_prefix(val, node.right, lst)\n        if prefix >= val and node.left is not None:\n            self._same_prefix(val, node.left, lst)\n        return lst"},{"col":4,"comment":"null","endLoc":447,"header":"def __repr__(self)","id":9229,"name":"__repr__","nodeType":"Function","startLoc":446,"text":"def __repr__(self):\n        return f'<{self.__class__.__name__}>'"},{"col":4,"comment":"null","endLoc":455,"header":"def _print(self, node, level)","id":9230,"name":"_print","nodeType":"Function","startLoc":449,"text":"def _print(self, node, level):\n        line = '\\t' * level + str(node) + '\\n'\n        if node.left is not None:\n            line += self._print(node.left, level + 1)\n        if node.right is not None:\n            line += self._print(node.right, level + 1)\n        return line"},{"col":4,"comment":"Construct Column from ``map``.","endLoc":21,"header":"def _construct_from_dict(self, map)","id":9231,"name":"_construct_from_dict","nodeType":"Function","startLoc":17,"text":"def _construct_from_dict(self, map):\n        \"\"\"Construct Column from ``map``.\"\"\"\n        data = map.pop('data')\n        out = self._parent_cls(data, **map)\n        return out"},{"col":4,"comment":"null","endLoc":1161,"header":"def __init__(self)","id":9232,"name":"__init__","nodeType":"Function","startLoc":1160,"text":"def __init__(self):\n        import msvcrt  # pylint: disable=W0611"},{"col":0,"comment":"\n    Use numpy to find the common dtype for a list of columns.\n\n    Only allow columns within the following fundamental numpy data types:\n    np.bool_, np.object_, np.number, np.character, np.void\n    ","endLoc":973,"header":"def common_dtype(cols)","id":9233,"name":"common_dtype","nodeType":"Function","startLoc":961,"text":"def common_dtype(cols):\n    \"\"\"\n    Use numpy to find the common dtype for a list of columns.\n\n    Only allow columns within the following fundamental numpy data types:\n    np.bool_, np.object_, np.number, np.character, np.void\n    \"\"\"\n    try:\n        return metadata.common_dtype(cols)\n    except metadata.MergeConflictError as err:\n        tme = TableMergeError(f'Columns have incompatible types {err._incompat_types}')\n        tme._incompat_types = err._incompat_types\n        raise tme from err"},{"attributeType":"null","col":4,"comment":"null","endLoc":9,"id":9234,"name":"_represent_as_dict_primary_data","nodeType":"Attribute","startLoc":9,"text":"_represent_as_dict_primary_data"},{"className":"NdarrayMixin","col":0,"comment":"\n    Mixin column class to allow storage of arbitrary numpy\n    ndarrays within a Table.  This is a subclass of numpy.ndarray\n    and has the same initialization options as ``np.array()``.\n    ","endLoc":65,"id":9235,"nodeType":"Class","startLoc":24,"text":"class NdarrayMixin(np.ndarray):\n    \"\"\"\n    Mixin column class to allow storage of arbitrary numpy\n    ndarrays within a Table.  This is a subclass of numpy.ndarray\n    and has the same initialization options as ``np.array()``.\n    \"\"\"\n    info = NdarrayMixinInfo()\n\n    def __new__(cls, obj, *args, **kwargs):\n        self = np.array(obj, *args, **kwargs).view(cls)\n        if 'info' in getattr(obj, '__dict__', ()):\n            self.info = obj.info\n        return self\n\n    def __array_finalize__(self, obj):\n        if obj is None:\n            return\n\n        if callable(super().__array_finalize__):\n            super().__array_finalize__(obj)\n\n        # Self was created from template (e.g. obj[slice] or (obj * 2))\n        # or viewcast e.g. obj.view(Column).  In either case we want to\n        # init Column attributes for self from obj if possible.\n        if 'info' in getattr(obj, '__dict__', ()):\n            self.info = obj.info\n\n    def __reduce__(self):\n        # patch to pickle NdArrayMixin objects (ndarray subclasses), see\n        # http://www.mail-archive.com/numpy-discussion@scipy.org/msg02446.html\n\n        object_state = list(super().__reduce__())\n        object_state[2] = (object_state[2], self.__dict__)\n        return tuple(object_state)\n\n    def __setstate__(self, state):\n        # patch to unpickle NdarrayMixin objects (ndarray subclasses), see\n        # http://www.mail-archive.com/numpy-discussion@scipy.org/msg02446.html\n\n        nd_state, own_state = state\n        super().__setstate__(nd_state)\n        self.__dict__.update(own_state)"},{"col":4,"comment":"null","endLoc":1178,"header":"def __init__(self)","id":9236,"name":"__init__","nodeType":"Function","startLoc":1176,"text":"def __init__(self):\n        import Carbon\n        Carbon.Evt  # see if it has this (in Unix, it doesn't)"},{"col":4,"comment":"null","endLoc":49,"header":"def __array_finalize__(self, obj)","id":9237,"name":"__array_finalize__","nodeType":"Function","startLoc":38,"text":"def __array_finalize__(self, obj):\n        if obj is None:\n            return\n\n        if callable(super().__array_finalize__):\n            super().__array_finalize__(obj)\n\n        # Self was created from template (e.g. obj[slice] or (obj * 2))\n        # or viewcast e.g. obj.view(Column).  In either case we want to\n        # init Column attributes for self from obj if possible.\n        if 'info' in getattr(obj, '__dict__', ()):\n            self.info = obj.info"},{"col":4,"comment":"null","endLoc":57,"header":"def __reduce__(self)","id":9238,"name":"__reduce__","nodeType":"Function","startLoc":51,"text":"def __reduce__(self):\n        # patch to pickle NdArrayMixin objects (ndarray subclasses), see\n        # http://www.mail-archive.com/numpy-discussion@scipy.org/msg02446.html\n\n        object_state = list(super().__reduce__())\n        object_state[2] = (object_state[2], self.__dict__)\n        return tuple(object_state)"},{"col":4,"comment":"null","endLoc":65,"header":"def __setstate__(self, state)","id":9239,"name":"__setstate__","nodeType":"Function","startLoc":59,"text":"def __setstate__(self, state):\n        # patch to unpickle NdarrayMixin objects (ndarray subclasses), see\n        # http://www.mail-archive.com/numpy-discussion@scipy.org/msg02446.html\n\n        nd_state, own_state = state\n        super().__setstate__(nd_state)\n        self.__dict__.update(own_state)"},{"col":4,"comment":"null","endLoc":1143,"header":"def __init__(self)","id":9240,"name":"__init__","nodeType":"Function","startLoc":1137,"text":"def __init__(self):\n        import tty  # pylint: disable=W0611\n        import sys  # pylint: disable=W0611\n\n        # import termios now or else you'll get the Unix\n        # version on the Mac\n        import termios  # pylint: disable=W0611"},{"col":4,"comment":"null","endLoc":1133,"header":"def __call__(self)","id":9241,"name":"__call__","nodeType":"Function","startLoc":1132,"text":"def __call__(self):\n        return self.impl()"},{"attributeType":"null","col":16,"comment":"null","endLoc":1130,"id":9242,"name":"impl","nodeType":"Attribute","startLoc":1130,"text":"self.impl"},{"col":4,"comment":"\n        Return the BST height.\n        ","endLoc":462,"header":"@property\n    def height(self)","id":9243,"name":"height","nodeType":"Function","startLoc":457,"text":"@property\n    def height(self):\n        '''\n        Return the BST height.\n        '''\n        return self._height(self.root)"},{"attributeType":"NdarrayMixinInfo","col":4,"comment":"null","endLoc":30,"id":9244,"name":"info","nodeType":"Attribute","startLoc":30,"text":"info"},{"col":4,"comment":"null","endLoc":468,"header":"def _height(self, node)","id":9245,"name":"_height","nodeType":"Function","startLoc":464,"text":"def _height(self, node):\n        if node is None:\n            return -1\n        return max(self._height(node.left),\n                   self._height(node.right)) + 1"},{"col":4,"comment":"\n        Replace all rows with the values they map to in the\n        given dictionary. Any rows not present as keys in\n        the dictionary will have their nodes deleted.\n\n        Parameters\n        ----------\n        row_map : dict\n            Mapping of row numbers to new row numbers\n        ","endLoc":482,"header":"def replace_rows(self, row_map)","id":9246,"name":"replace_rows","nodeType":"Function","startLoc":470,"text":"def replace_rows(self, row_map):\n        '''\n        Replace all rows with the values they map to in the\n        given dictionary. Any rows not present as keys in\n        the dictionary will have their nodes deleted.\n\n        Parameters\n        ----------\n        row_map : dict\n            Mapping of row numbers to new row numbers\n        '''\n        for key, data in self.items():\n            data[:] = [row_map[x] for x in data if x in row_map]"},{"attributeType":"Node","col":4,"comment":"null","endLoc":163,"id":9247,"name":"NodeClass","nodeType":"Attribute","startLoc":163,"text":"NodeClass"},{"attributeType":"null","col":8,"comment":"null","endLoc":167,"id":9248,"name":"size","nodeType":"Attribute","startLoc":167,"text":"self.size"},{"className":"TableFormatter","col":0,"comment":"null","endLoc":758,"id":9249,"nodeType":"Class","startLoc":163,"text":"class TableFormatter:\n    @staticmethod\n    def _get_pprint_size(max_lines=None, max_width=None):\n        \"\"\"Get the output size (number of lines and character width) for Column and\n        Table pformat/pprint methods.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default will be determined\n        using the ``astropy.table.conf.max_lines`` configuration item. If a\n        negative value of ``max_lines`` is supplied then there is no line\n        limit applied.\n\n        The same applies for max_width except the configuration item is\n        ``astropy.table.conf.max_width``.\n\n        Parameters\n        ----------\n        max_lines : int or None\n            Maximum lines of output (header + data rows)\n\n        max_width : int or None\n            Maximum width (characters) output\n\n        Returns\n        -------\n        max_lines, max_width : int\n\n        \"\"\"\n        # Declare to keep static type checker happy.\n        lines = None\n        width = None\n\n        if max_lines is None:\n            max_lines = conf.max_lines\n\n        if max_width is None:\n            max_width = conf.max_width\n\n        if max_lines is None or max_width is None:\n            lines, width = terminal_size()\n\n        if max_lines is None:\n            max_lines = lines\n        elif max_lines < 0:\n            max_lines = sys.maxsize\n        if max_lines < 8:\n            max_lines = 8\n\n        if max_width is None:\n            max_width = width\n        elif max_width < 0:\n            max_width = sys.maxsize\n        if max_width < 10:\n            max_width = 10\n\n        return max_lines, max_width\n\n    def _pformat_col(self, col, max_lines=None, show_name=True, show_unit=None,\n                     show_dtype=False, show_length=None, html=False, align=None):\n        \"\"\"Return a list of formatted string representation of column values.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum lines of output (header + data rows)\n\n        show_name : bool\n            Include column name. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        show_dtype : bool\n            Include column dtype. Default is False.\n\n        show_length : bool\n            Include column length at end.  Default is to show this only\n            if the column is not shown completely.\n\n        html : bool\n            Output column as HTML\n\n        align : str\n            Left/right alignment of columns. Default is '>' (right) for all\n            columns. Other allowed values are '<', '^', and '0=' for left,\n            centered, and 0-padded, respectively.\n\n        Returns\n        -------\n        lines : list\n            List of lines with formatted column values\n\n        outs : dict\n            Dict which is used to pass back additional values\n            defined within the iterator.\n\n        \"\"\"\n        if show_unit is None:\n            show_unit = col.info.unit is not None\n\n        outs = {}  # Some values from _pformat_col_iter iterator that are needed here\n        col_strs_iter = self._pformat_col_iter(col, max_lines, show_name=show_name,\n                                               show_unit=show_unit,\n                                               show_dtype=show_dtype,\n                                               show_length=show_length,\n                                               outs=outs)\n\n        # Replace tab and newline with text representations so they display nicely.\n        # Newline in particular is a problem in a multicolumn table.\n        col_strs = [val.replace('\\t', '\\\\t').replace('\\n', '\\\\n') for val in col_strs_iter]\n        if len(col_strs) > 0:\n            col_width = max(len(x) for x in col_strs)\n\n        if html:\n            from astropy.utils.xml.writer import xml_escape\n            n_header = outs['n_header']\n            for i, col_str in enumerate(col_strs):\n                # _pformat_col output has a header line '----' which is not needed here\n                if i == n_header - 1:\n                    continue\n                td = 'th' if i < n_header else 'td'\n                val = f'<{td}>{xml_escape(col_str.strip())}</{td}>'\n                row = ('<tr>' + val + '</tr>')\n                if i < n_header:\n                    row = ('<thead>' + row + '</thead>')\n                col_strs[i] = row\n\n            if n_header > 0:\n                # Get rid of '---' header line\n                col_strs.pop(n_header - 1)\n            col_strs.insert(0, '<table>')\n            col_strs.append('</table>')\n\n        # Now bring all the column string values to the same fixed width\n        else:\n            col_width = max(len(x) for x in col_strs) if col_strs else 1\n\n            # Center line header content and generate dashed headerline\n            for i in outs['i_centers']:\n                col_strs[i] = col_strs[i].center(col_width)\n            if outs['i_dashes'] is not None:\n                col_strs[outs['i_dashes']] = '-' * col_width\n\n            # Format columns according to alignment.  `align` arg has precedent, otherwise\n            # use `col.format` if it starts as a legal alignment string.  If neither applies\n            # then right justify.\n            re_fill_align = re.compile(r'(?P<fill>.?)(?P<align>[<^>=])')\n            match = None\n            if align:\n                # If there is an align specified then it must match\n                match = re_fill_align.match(align)\n                if not match:\n                    raise ValueError(\"column align must be one of '<', '^', '>', or '='\")\n            elif isinstance(col.info.format, str):\n                # col.info.format need not match, in which case rjust gets used\n                match = re_fill_align.match(col.info.format)\n\n            if match:\n                fill_char = match.group('fill')\n                align_char = match.group('align')\n                if align_char == '=':\n                    if fill_char != '0':\n                        raise ValueError(\"fill character must be '0' for '=' align\")\n                    fill_char = ''  # str.zfill gets used which does not take fill char arg\n            else:\n                fill_char = ''\n                align_char = '>'\n\n            justify_methods = {'<': 'ljust', '^': 'center', '>': 'rjust', '=': 'zfill'}\n            justify_method = justify_methods[align_char]\n            justify_args = (col_width, fill_char) if fill_char else (col_width,)\n\n            for i, col_str in enumerate(col_strs):\n                col_strs[i] = getattr(col_str, justify_method)(*justify_args)\n\n        if outs['show_length']:\n            col_strs.append(f'Length = {len(col)} rows')\n\n        return col_strs, outs\n\n    def _pformat_col_iter(self, col, max_lines, show_name, show_unit, outs,\n                          show_dtype=False, show_length=None):\n        \"\"\"Iterator which yields formatted string representation of column values.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum lines of output (header + data rows)\n\n        show_name : bool\n            Include column name. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        outs : dict\n            Must be a dict which is used to pass back additional values\n            defined within the iterator.\n\n        show_dtype : bool\n            Include column dtype. Default is False.\n\n        show_length : bool\n            Include column length at end.  Default is to show this only\n            if the column is not shown completely.\n        \"\"\"\n        max_lines, _ = self._get_pprint_size(max_lines, -1)\n\n        multidims = getattr(col, 'shape', [0])[1:]\n        if multidims:\n            multidim0 = tuple(0 for n in multidims)\n            multidim1 = tuple(n - 1 for n in multidims)\n            trivial_multidims = np.prod(multidims) == 1\n\n        i_dashes = None\n        i_centers = []  # Line indexes where content should be centered\n        n_header = 0\n        if show_name:\n            i_centers.append(n_header)\n            # Get column name (or 'None' if not set)\n            col_name = str(col.info.name)\n            if multidims:\n                col_name += f\" [{','.join(str(n) for n in multidims)}]\"\n            n_header += 1\n            yield col_name\n        if show_unit:\n            i_centers.append(n_header)\n            n_header += 1\n            yield str(col.info.unit or '')\n        if show_dtype:\n            i_centers.append(n_header)\n            n_header += 1\n            try:\n                dtype = dtype_info_name(col.dtype)\n            except AttributeError:\n                dtype = col.__class__.__qualname__ or 'object'\n            yield str(dtype)\n        if show_unit or show_name or show_dtype:\n            i_dashes = n_header\n            n_header += 1\n            yield '---'\n\n        max_lines -= n_header\n        n_print2 = max_lines // 2\n        n_rows = len(col)\n\n        # This block of code is responsible for producing the function that\n        # will format values for this column.  The ``format_func`` function\n        # takes two args (col_format, val) and returns the string-formatted\n        # version.  Some points to understand:\n        #\n        # - col_format could itself be the formatting function, so it will\n        #    actually end up being called with itself as the first arg.  In\n        #    this case the function is expected to ignore its first arg.\n        #\n        # - auto_format_func is a function that gets called on the first\n        #    column value that is being formatted.  It then determines an\n        #    appropriate formatting function given the actual value to be\n        #    formatted.  This might be deterministic or it might involve\n        #    try/except.  The latter allows for different string formatting\n        #    options like %f or {:5.3f}.  When auto_format_func is called it:\n\n        #    1. Caches the function in the _format_funcs dict so for subsequent\n        #       values the right function is called right away.\n        #    2. Returns the formatted value.\n        #\n        # - possible_string_format_functions is a function that yields a\n        #    succession of functions that might successfully format the\n        #    value.  There is a default, but Mixin methods can override this.\n        #    See Quantity for an example.\n        #\n        # - get_auto_format_func() returns a wrapped version of auto_format_func\n        #    with the column id and possible_string_format_functions as\n        #    enclosed variables.\n        col_format = col.info.format or getattr(col.info, 'default_format',\n                                                None)\n        pssf = (getattr(col.info, 'possible_string_format_functions', None)\n                or _possible_string_format_functions)\n        auto_format_func = get_auto_format_func(col, pssf)\n        format_func = col.info._format_funcs.get(col_format, auto_format_func)\n\n        if len(col) > max_lines:\n            if show_length is None:\n                show_length = True\n            i0 = n_print2 - (1 if show_length else 0)\n            i1 = n_rows - n_print2 - max_lines % 2\n            indices = np.concatenate([np.arange(0, i0 + 1),\n                                      np.arange(i1 + 1, len(col))])\n        else:\n            i0 = -1\n            indices = np.arange(len(col))\n\n        def format_col_str(idx):\n            if multidims:\n                # Prevents columns like Column(data=[[(1,)],[(2,)]], name='a')\n                # with shape (n,1,...,1) from being printed as if there was\n                # more than one element in a row\n                if trivial_multidims:\n                    return format_func(col_format, col[(idx,) + multidim0])\n                else:\n                    left = format_func(col_format, col[(idx,) + multidim0])\n                    right = format_func(col_format, col[(idx,) + multidim1])\n                    return f'{left} .. {right}'\n            else:\n                return format_func(col_format, col[idx])\n\n        # Add formatted values if within bounds allowed by max_lines\n        for idx in indices:\n            if idx == i0:\n                yield '...'\n            else:\n                try:\n                    yield format_col_str(idx)\n                except ValueError:\n                    raise ValueError(\n                        'Unable to parse format string \"{}\" for entry \"{}\" '\n                        'in column \"{}\"'.format(col_format, col[idx],\n                                                col.info.name))\n\n        outs['show_length'] = show_length\n        outs['n_header'] = n_header\n        outs['i_centers'] = i_centers\n        outs['i_dashes'] = i_dashes\n\n    def _pformat_table(self, table, max_lines=None, max_width=None,\n                       show_name=True, show_unit=None, show_dtype=False,\n                       html=False, tableid=None, tableclass=None, align=None):\n        \"\"\"Return a list of lines for the formatted string representation of\n        the table.\n\n        Parameters\n        ----------\n        max_lines : int or None\n            Maximum number of rows to output\n\n        max_width : int or None\n            Maximum character width of output\n\n        show_name : bool\n            Include a header row for column names. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        show_dtype : bool\n            Include a header row for column dtypes. Default is False.\n\n        html : bool\n            Format the output as an HTML table. Default is False.\n\n        tableid : str or None\n            An ID tag for the table; only used if html is set.  Default is\n            \"table{id}\", where id is the unique integer id of the table object,\n            id(table)\n\n        tableclass : str or list of str or None\n            CSS classes for the table; only used if html is set.  Default is\n            none\n\n        align : str or list or tuple\n            Left/right alignment of columns. Default is '>' (right) for all\n            columns. Other allowed values are '<', '^', and '0=' for left,\n            centered, and 0-padded, respectively. A list of strings can be\n            provided for alignment of tables with multiple columns.\n\n        Returns\n        -------\n        rows : list\n            Formatted table as a list of strings\n\n        outs : dict\n            Dict which is used to pass back additional values\n            defined within the iterator.\n\n        \"\"\"\n        # \"Print\" all the values into temporary lists by column for subsequent\n        # use and to determine the width\n        max_lines, max_width = self._get_pprint_size(max_lines, max_width)\n\n        if show_unit is None:\n            show_unit = any(col.info.unit for col in table.columns.values())\n\n        # Coerce align into a correctly-sized list of alignments (if possible)\n        n_cols = len(table.columns)\n        if align is None or isinstance(align, str):\n            align = [align] * n_cols\n\n        elif isinstance(align, (list, tuple)):\n            if len(align) != n_cols:\n                raise ValueError('got {} alignment values instead of '\n                                 'the number of columns ({})'\n                                 .format(len(align), n_cols))\n        else:\n            raise TypeError('align keyword must be str or list or tuple (got {})'\n                            .format(type(align)))\n\n        # Process column visibility from table pprint_include_names and\n        # pprint_exclude_names attributes and get the set of columns to show.\n        pprint_include_names = _get_pprint_include_names(table)\n\n        cols = []\n        outs = None  # Initialize so static type checker is happy\n        for align_, col in zip(align, table.columns.values()):\n            if col.info.name not in pprint_include_names:\n                continue\n\n            lines, outs = self._pformat_col(col, max_lines, show_name=show_name,\n                                            show_unit=show_unit, show_dtype=show_dtype,\n                                            align=align_)\n            if outs['show_length']:\n                lines = lines[:-1]\n            cols.append(lines)\n\n        if not cols:\n            return ['<No columns>'], {'show_length': False}\n\n        # Use the values for the last column since they are all the same\n        n_header = outs['n_header']\n\n        n_rows = len(cols[0])\n\n        def outwidth(cols):\n            return sum(len(c[0]) for c in cols) + len(cols) - 1\n\n        dots_col = ['...'] * n_rows\n        middle = len(cols) // 2\n        while outwidth(cols) > max_width:\n            if len(cols) == 1:\n                break\n            if len(cols) == 2:\n                cols[1] = dots_col\n                break\n            if cols[middle] is dots_col:\n                cols.pop(middle)\n                middle = len(cols) // 2\n            cols[middle] = dots_col\n\n        # Now \"print\" the (already-stringified) column values into a\n        # row-oriented list.\n        rows = []\n        if html:\n            from astropy.utils.xml.writer import xml_escape\n\n            if tableid is None:\n                tableid = f'table{id(table)}'\n\n            if tableclass is not None:\n                if isinstance(tableclass, list):\n                    tableclass = ' '.join(tableclass)\n                rows.append(f'<table id=\"{tableid}\" class=\"{tableclass}\">')\n            else:\n                rows.append(f'<table id=\"{tableid}\">')\n\n            for i in range(n_rows):\n                # _pformat_col output has a header line '----' which is not needed here\n                if i == n_header - 1:\n                    continue\n                td = 'th' if i < n_header else 'td'\n                vals = (f'<{td}>{xml_escape(col[i].strip())}</{td}>'\n                        for col in cols)\n                row = ('<tr>' + ''.join(vals) + '</tr>')\n                if i < n_header:\n                    row = ('<thead>' + row + '</thead>')\n                rows.append(row)\n            rows.append('</table>')\n        else:\n            for i in range(n_rows):\n                row = ' '.join(col[i] for col in cols)\n                rows.append(row)\n\n        return rows, outs\n\n    def _more_tabcol(self, tabcol, max_lines=None, max_width=None,\n                     show_name=True, show_unit=None, show_dtype=False):\n        \"\"\"Interactive \"more\" of a table or column.\n\n        Parameters\n        ----------\n        max_lines : int or None\n            Maximum number of rows to output\n\n        max_width : int or None\n            Maximum character width of output\n\n        show_name : bool\n            Include a header row for column names. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        show_dtype : bool\n            Include a header row for column dtypes. Default is False.\n        \"\"\"\n        allowed_keys = 'f br<>qhpn'\n\n        # Count the header lines\n        n_header = 0\n        if show_name:\n            n_header += 1\n        if show_unit:\n            n_header += 1\n        if show_dtype:\n            n_header += 1\n        if show_name or show_unit or show_dtype:\n            n_header += 1\n\n        # Set up kwargs for pformat call.  Only Table gets max_width.\n        kwargs = dict(max_lines=-1, show_name=show_name, show_unit=show_unit,\n                      show_dtype=show_dtype)\n        if hasattr(tabcol, 'columns'):  # tabcol is a table\n            kwargs['max_width'] = max_width\n\n        # If max_lines is None (=> query screen size) then increase by 2.\n        # This is because get_pprint_size leaves 6 extra lines so that in\n        # ipython you normally see the last input line.\n        max_lines1, max_width = self._get_pprint_size(max_lines, max_width)\n        if max_lines is None:\n            max_lines1 += 2\n        delta_lines = max_lines1 - n_header\n\n        # Set up a function to get a single character on any platform\n        inkey = Getch()\n\n        i0 = 0  # First table/column row to show\n        showlines = True\n        while True:\n            i1 = i0 + delta_lines  # Last table/col row to show\n            if showlines:  # Don't always show the table (e.g. after help)\n                try:\n                    os.system('cls' if os.name == 'nt' else 'clear')\n                except Exception:\n                    pass  # No worries if clear screen call fails\n                lines = tabcol[i0:i1].pformat(**kwargs)\n                colors = ('red' if i < n_header else 'default'\n                          for i in range(len(lines)))\n                for color, line in zip(colors, lines):\n                    color_print(line, color)\n            showlines = True\n            print()\n            print(\"-- f, <space>, b, r, p, n, <, >, q h (help) --\", end=' ')\n            # Get a valid key\n            while True:\n                try:\n                    key = inkey().lower()\n                except Exception:\n                    print(\"\\n\")\n                    log.error('Console does not support getting a character'\n                              ' as required by more().  Use pprint() instead.')\n                    return\n                if key in allowed_keys:\n                    break\n            print(key)\n\n            if key.lower() == 'q':\n                break\n            elif key == ' ' or key == 'f':\n                i0 += delta_lines\n            elif key == 'b':\n                i0 = i0 - delta_lines\n            elif key == 'r':\n                pass\n            elif key == '<':\n                i0 = 0\n            elif key == '>':\n                i0 = len(tabcol)\n            elif key == 'p':\n                i0 -= 1\n            elif key == 'n':\n                i0 += 1\n            elif key == 'h':\n                showlines = False\n                print(\"\"\"\n    Browsing keys:\n       f, <space> : forward one page\n       b : back one page\n       r : refresh same page\n       n : next row\n       p : previous row\n       < : go to beginning\n       > : go to end\n       q : quit browsing\n       h : print this help\"\"\", end=' ')\n            if i0 < 0:\n                i0 = 0\n            if i0 >= len(tabcol) - delta_lines:\n                i0 = len(tabcol) - delta_lines\n            print(\"\\n\")"},{"attributeType":"None","col":8,"comment":"null","endLoc":166,"id":9250,"name":"root","nodeType":"Attribute","startLoc":166,"text":"self.root"},{"attributeType":"null","col":8,"comment":"null","endLoc":168,"id":9251,"name":"unique","nodeType":"Attribute","startLoc":168,"text":"self.unique"},{"attributeType":"null","col":0,"comment":"null","endLoc":4,"id":9252,"name":"__all__","nodeType":"Attribute","startLoc":4,"text":"__all__"},{"col":0,"comment":"","endLoc":2,"header":"bst.py#<anonymous>","id":9253,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"__all__ = ['BST']"},{"col":4,"comment":"Get the output size (number of lines and character width) for Column and\n        Table pformat/pprint methods.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default will be determined\n        using the ``astropy.table.conf.max_lines`` configuration item. If a\n        negative value of ``max_lines`` is supplied then there is no line\n        limit applied.\n\n        The same applies for max_width except the configuration item is\n        ``astropy.table.conf.max_width``.\n\n        Parameters\n        ----------\n        max_lines : int or None\n            Maximum lines of output (header + data rows)\n\n        max_width : int or None\n            Maximum width (characters) output\n\n        Returns\n        -------\n        max_lines, max_width : int\n\n        ","endLoc":219,"header":"@staticmethod\n    def _get_pprint_size(max_lines=None, max_width=None)","id":9254,"name":"_get_pprint_size","nodeType":"Function","startLoc":164,"text":"@staticmethod\n    def _get_pprint_size(max_lines=None, max_width=None):\n        \"\"\"Get the output size (number of lines and character width) for Column and\n        Table pformat/pprint methods.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default will be determined\n        using the ``astropy.table.conf.max_lines`` configuration item. If a\n        negative value of ``max_lines`` is supplied then there is no line\n        limit applied.\n\n        The same applies for max_width except the configuration item is\n        ``astropy.table.conf.max_width``.\n\n        Parameters\n        ----------\n        max_lines : int or None\n            Maximum lines of output (header + data rows)\n\n        max_width : int or None\n            Maximum width (characters) output\n\n        Returns\n        -------\n        max_lines, max_width : int\n\n        \"\"\"\n        # Declare to keep static type checker happy.\n        lines = None\n        width = None\n\n        if max_lines is None:\n            max_lines = conf.max_lines\n\n        if max_width is None:\n            max_width = conf.max_width\n\n        if max_lines is None or max_width is None:\n            lines, width = terminal_size()\n\n        if max_lines is None:\n            max_lines = lines\n        elif max_lines < 0:\n            max_lines = sys.maxsize\n        if max_lines < 8:\n            max_lines = 8\n\n        if max_width is None:\n            max_width = width\n        elif max_width < 0:\n            max_width = sys.maxsize\n        if max_width < 10:\n            max_width = 10\n\n        return max_lines, max_width"},{"col":4,"comment":"null","endLoc":591,"header":"@property\n    def columns(self)","id":9255,"name":"columns","nodeType":"Function","startLoc":589,"text":"@property\n    def columns(self):\n        return self.index.columns"},{"col":4,"comment":"null","endLoc":595,"header":"@property\n    def data(self)","id":9256,"name":"data","nodeType":"Function","startLoc":593,"text":"@property\n    def data(self):\n        return self.index.data"},{"attributeType":"null","col":24,"comment":"null","endLoc":429,"id":9257,"name":"_stop","nodeType":"Attribute","startLoc":429,"text":"self._stop"},{"col":4,"comment":"Return a list of formatted string representation of column values.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum lines of output (header + data rows)\n\n        show_name : bool\n            Include column name. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        show_dtype : bool\n            Include column dtype. Default is False.\n\n        show_length : bool\n            Include column length at end.  Default is to show this only\n            if the column is not shown completely.\n\n        html : bool\n            Output column as HTML\n\n        align : str\n            Left/right alignment of columns. Default is '>' (right) for all\n            columns. Other allowed values are '<', '^', and '0=' for left,\n            centered, and 0-padded, respectively.\n\n        Returns\n        -------\n        lines : list\n            List of lines with formatted column values\n\n        outs : dict\n            Dict which is used to pass back additional values\n            defined within the iterator.\n\n        ","endLoc":344,"header":"def _pformat_col(self, col, max_lines=None, show_name=True, show_unit=None,\n                     show_dtype=False, show_length=None, html=False, align=None)","id":9258,"name":"_pformat_col","nodeType":"Function","startLoc":221,"text":"def _pformat_col(self, col, max_lines=None, show_name=True, show_unit=None,\n                     show_dtype=False, show_length=None, html=False, align=None):\n        \"\"\"Return a list of formatted string representation of column values.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum lines of output (header + data rows)\n\n        show_name : bool\n            Include column name. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        show_dtype : bool\n            Include column dtype. Default is False.\n\n        show_length : bool\n            Include column length at end.  Default is to show this only\n            if the column is not shown completely.\n\n        html : bool\n            Output column as HTML\n\n        align : str\n            Left/right alignment of columns. Default is '>' (right) for all\n            columns. Other allowed values are '<', '^', and '0=' for left,\n            centered, and 0-padded, respectively.\n\n        Returns\n        -------\n        lines : list\n            List of lines with formatted column values\n\n        outs : dict\n            Dict which is used to pass back additional values\n            defined within the iterator.\n\n        \"\"\"\n        if show_unit is None:\n            show_unit = col.info.unit is not None\n\n        outs = {}  # Some values from _pformat_col_iter iterator that are needed here\n        col_strs_iter = self._pformat_col_iter(col, max_lines, show_name=show_name,\n                                               show_unit=show_unit,\n                                               show_dtype=show_dtype,\n                                               show_length=show_length,\n                                               outs=outs)\n\n        # Replace tab and newline with text representations so they display nicely.\n        # Newline in particular is a problem in a multicolumn table.\n        col_strs = [val.replace('\\t', '\\\\t').replace('\\n', '\\\\n') for val in col_strs_iter]\n        if len(col_strs) > 0:\n            col_width = max(len(x) for x in col_strs)\n\n        if html:\n            from astropy.utils.xml.writer import xml_escape\n            n_header = outs['n_header']\n            for i, col_str in enumerate(col_strs):\n                # _pformat_col output has a header line '----' which is not needed here\n                if i == n_header - 1:\n                    continue\n                td = 'th' if i < n_header else 'td'\n                val = f'<{td}>{xml_escape(col_str.strip())}</{td}>'\n                row = ('<tr>' + val + '</tr>')\n                if i < n_header:\n                    row = ('<thead>' + row + '</thead>')\n                col_strs[i] = row\n\n            if n_header > 0:\n                # Get rid of '---' header line\n                col_strs.pop(n_header - 1)\n            col_strs.insert(0, '<table>')\n            col_strs.append('</table>')\n\n        # Now bring all the column string values to the same fixed width\n        else:\n            col_width = max(len(x) for x in col_strs) if col_strs else 1\n\n            # Center line header content and generate dashed headerline\n            for i in outs['i_centers']:\n                col_strs[i] = col_strs[i].center(col_width)\n            if outs['i_dashes'] is not None:\n                col_strs[outs['i_dashes']] = '-' * col_width\n\n            # Format columns according to alignment.  `align` arg has precedent, otherwise\n            # use `col.format` if it starts as a legal alignment string.  If neither applies\n            # then right justify.\n            re_fill_align = re.compile(r'(?P<fill>.?)(?P<align>[<^>=])')\n            match = None\n            if align:\n                # If there is an align specified then it must match\n                match = re_fill_align.match(align)\n                if not match:\n                    raise ValueError(\"column align must be one of '<', '^', '>', or '='\")\n            elif isinstance(col.info.format, str):\n                # col.info.format need not match, in which case rjust gets used\n                match = re_fill_align.match(col.info.format)\n\n            if match:\n                fill_char = match.group('fill')\n                align_char = match.group('align')\n                if align_char == '=':\n                    if fill_char != '0':\n                        raise ValueError(\"fill character must be '0' for '=' align\")\n                    fill_char = ''  # str.zfill gets used which does not take fill char arg\n            else:\n                fill_char = ''\n                align_char = '>'\n\n            justify_methods = {'<': 'ljust', '^': 'center', '>': 'rjust', '=': 'zfill'}\n            justify_method = justify_methods[align_char]\n            justify_args = (col_width, fill_char) if fill_char else (col_width,)\n\n            for i, col_str in enumerate(col_strs):\n                col_strs[i] = getattr(col_str, justify_method)(*justify_args)\n\n        if outs['show_length']:\n            col_strs.append(f'Length = {len(col)} rows')\n\n        return col_strs, outs"},{"col":0,"comment":"\n    Find the dtypes descrs resulting from merging the list of arrays' dtypes,\n    using the column name mapping ``col_name_map``.\n\n    Return a list of descrs for the output.\n    ","endLoc":958,"header":"def get_descrs(arrays, col_name_map)","id":9259,"name":"get_descrs","nodeType":"Function","startLoc":922,"text":"def get_descrs(arrays, col_name_map):\n    \"\"\"\n    Find the dtypes descrs resulting from merging the list of arrays' dtypes,\n    using the column name mapping ``col_name_map``.\n\n    Return a list of descrs for the output.\n    \"\"\"\n\n    out_descrs = []\n\n    for out_name, in_names in col_name_map.items():\n        # List of input arrays that contribute to this output column\n        in_cols = [arr[name] for arr, name in zip(arrays, in_names) if name is not None]\n\n        # List of names of the columns that contribute to this output column.\n        names = [name for name in in_names if name is not None]\n\n        # Output dtype is the superset of all dtypes in in_arrays\n        try:\n            dtype = common_dtype(in_cols)\n        except TableMergeError as tme:\n            # Beautify the error message when we are trying to merge columns with incompatible\n            # types by including the name of the columns that originated the error.\n            raise TableMergeError(\"The '{}' columns have incompatible types: {}\"\n                                  .format(names[0], tme._incompat_types)) from tme\n\n        # Make sure all input shapes are the same\n        uniq_shapes = set(col.shape[1:] for col in in_cols)\n        if len(uniq_shapes) != 1:\n            raise TableMergeError(f'Key columns {names!r} have different shape')\n        shape = uniq_shapes.pop()\n\n        if out_name is not None:\n            out_name = str(out_name)\n        out_descrs.append((out_name, dtype, shape))\n\n    return out_descrs"},{"fileName":"groups.py","filePath":"astropy/table","id":9260,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport platform\nimport warnings\n\nimport numpy as np\nfrom .index import get_index_by_names\n\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n\n__all__ = ['TableGroups', 'ColumnGroups']\n\n\ndef table_group_by(table, keys):\n    # index copies are unnecessary and slow down _table_group_by\n    with table.index_mode('discard_on_copy'):\n        return _table_group_by(table, keys)\n\n\ndef _table_group_by(table, keys):\n    \"\"\"\n    Get groups for ``table`` on specified ``keys``.\n\n    Parameters\n    ----------\n    table : `Table`\n        Table to group\n    keys : str, list of str, `Table`, or Numpy array\n        Grouping key specifier\n\n    Returns\n    -------\n    grouped_table : Table object with groups attr set accordingly\n    \"\"\"\n    from .table import Table\n    from .serialize import represent_mixins_as_columns\n\n    # Pre-convert string to tuple of strings, or Table to the underlying structured array\n    if isinstance(keys, str):\n        keys = (keys,)\n\n    if isinstance(keys, (list, tuple)):\n        for name in keys:\n            if name not in table.colnames:\n                raise ValueError(f'Table does not have key column {name!r}')\n            if table.masked and np.any(table[name].mask):\n                raise ValueError(f'Missing values in key column {name!r} are not allowed')\n\n        # Make a column slice of the table without copying\n        table_keys = table.__class__([table[key] for key in keys], copy=False)\n\n        # If available get a pre-existing index for these columns\n        table_index = get_index_by_names(table, keys)\n        grouped_by_table_cols = True\n\n    elif isinstance(keys, (np.ndarray, Table)):\n        table_keys = keys\n        if len(table_keys) != len(table):\n            raise ValueError('Input keys array length {} does not match table length {}'\n                             .format(len(table_keys), len(table)))\n        table_index = None\n        grouped_by_table_cols = False\n\n    else:\n        raise TypeError('Keys input must be string, list, tuple, Table or numpy array, but got {}'\n                        .format(type(keys)))\n\n    # If there is not already an available index and table_keys is a Table then ensure\n    # that all cols (including mixins) are in a form that can sorted with the code below.\n    if not table_index and isinstance(table_keys, Table):\n        table_keys = represent_mixins_as_columns(table_keys)\n\n    # Get the argsort index `idx_sort`, accounting for particulars\n    try:\n        # take advantage of index internal sort if possible\n        if table_index is not None:\n            idx_sort = table_index.sorted_data()\n        else:\n            idx_sort = table_keys.argsort(kind='mergesort')\n        stable_sort = True\n    except TypeError:\n        # Some versions (likely 1.6 and earlier) of numpy don't support\n        # 'mergesort' for all data types.  MacOSX (Darwin) doesn't have a stable\n        # sort by default, nor does Windows, while Linux does (or appears to).\n        idx_sort = table_keys.argsort()\n        stable_sort = platform.system() not in ('Darwin', 'Windows')\n\n    # Finally do the actual sort of table_keys values\n    table_keys = table_keys[idx_sort]\n\n    # Get all keys\n    diffs = np.concatenate(([True], table_keys[1:] != table_keys[:-1], [True]))\n    indices = np.flatnonzero(diffs)\n\n    # If the sort is not stable (preserves original table order) then sort idx_sort in\n    # place within each group.\n    if not stable_sort:\n        for i0, i1 in zip(indices[:-1], indices[1:]):\n            idx_sort[i0:i1].sort()\n\n    # Make a new table and set the _groups to the appropriate TableGroups object.\n    # Take the subset of the original keys at the indices values (group boundaries).\n    out = table.__class__(table[idx_sort])\n    out_keys = table_keys[indices[:-1]]\n    if isinstance(out_keys, Table):\n        out_keys.meta['grouped_by_table_cols'] = grouped_by_table_cols\n    out._groups = TableGroups(out, indices=indices, keys=out_keys)\n\n    return out\n\n\ndef column_group_by(column, keys):\n    \"\"\"\n    Get groups for ``column`` on specified ``keys``\n\n    Parameters\n    ----------\n    column : Column object\n        Column to group\n    keys : Table or Numpy array of same length as col\n        Grouping key specifier\n\n    Returns\n    -------\n    grouped_column : Column object with groups attr set accordingly\n    \"\"\"\n    from .table import Table\n    from .serialize import represent_mixins_as_columns\n\n    if isinstance(keys, Table):\n        keys = represent_mixins_as_columns(keys)\n        keys = keys.as_array()\n\n    if not isinstance(keys, np.ndarray):\n        raise TypeError(f'Keys input must be numpy array, but got {type(keys)}')\n\n    if len(keys) != len(column):\n        raise ValueError('Input keys array length {} does not match column length {}'\n                         .format(len(keys), len(column)))\n\n    idx_sort = keys.argsort()\n    keys = keys[idx_sort]\n\n    # Get all keys\n    diffs = np.concatenate(([True], keys[1:] != keys[:-1], [True]))\n    indices = np.flatnonzero(diffs)\n\n    # Make a new column and set the _groups to the appropriate ColumnGroups object.\n    # Take the subset of the original keys at the indices values (group boundaries).\n    out = column.__class__(column[idx_sort])\n    out._groups = ColumnGroups(out, indices=indices, keys=keys[indices[:-1]])\n\n    return out\n\n\nclass BaseGroups:\n    \"\"\"\n    A class to represent groups within a table of heterogeneous data.\n\n      - ``keys``: key values corresponding to each group\n      - ``indices``: index values in parent table or column corresponding to group boundaries\n      - ``aggregate()``: method to create new table by aggregating within groups\n    \"\"\"\n    @property\n    def parent(self):\n        return self.parent_column if isinstance(self, ColumnGroups) else self.parent_table\n\n    def __iter__(self):\n        self._iter_index = 0\n        return self\n\n    def next(self):\n        ii = self._iter_index\n        if ii < len(self.indices) - 1:\n            i0, i1 = self.indices[ii], self.indices[ii + 1]\n            self._iter_index += 1\n            return self.parent[i0:i1]\n        else:\n            raise StopIteration\n    __next__ = next\n\n    def __getitem__(self, item):\n        parent = self.parent\n\n        if isinstance(item, (int, np.integer)):\n            i0, i1 = self.indices[item], self.indices[item + 1]\n            out = parent[i0:i1]\n            out.groups._keys = parent.groups.keys[item]\n        else:\n            indices0, indices1 = self.indices[:-1], self.indices[1:]\n            try:\n                i0s, i1s = indices0[item], indices1[item]\n            except Exception as err:\n                raise TypeError('Index item for groups attribute must be a slice, '\n                                'numpy mask or int array') from err\n            mask = np.zeros(len(parent), dtype=bool)\n            # Is there a way to vectorize this in numpy?\n            for i0, i1 in zip(i0s, i1s):\n                mask[i0:i1] = True\n            out = parent[mask]\n            out.groups._keys = parent.groups.keys[item]\n            out.groups._indices = np.concatenate([[0], np.cumsum(i1s - i0s)])\n\n        return out\n\n    def __repr__(self):\n        return f'<{self.__class__.__name__} indices={self.indices}>'\n\n    def __len__(self):\n        return len(self.indices) - 1\n\n\nclass ColumnGroups(BaseGroups):\n    def __init__(self, parent_column, indices=None, keys=None):\n        self.parent_column = parent_column  # parent Column\n        self.parent_table = parent_column.parent_table\n        self._indices = indices\n        self._keys = keys\n\n    @property\n    def indices(self):\n        # If the parent column is in a table then use group indices from table\n        if self.parent_table:\n            return self.parent_table.groups.indices\n        else:\n            if self._indices is None:\n                return np.array([0, len(self.parent_column)])\n            else:\n                return self._indices\n\n    @property\n    def keys(self):\n        # If the parent column is in a table then use group indices from table\n        if self.parent_table:\n            return self.parent_table.groups.keys\n        else:\n            return self._keys\n\n    def aggregate(self, func):\n        from .column import MaskedColumn\n\n        i0s, i1s = self.indices[:-1], self.indices[1:]\n        par_col = self.parent_column\n        masked = isinstance(par_col, MaskedColumn)\n        reduceat = hasattr(func, 'reduceat')\n        sum_case = func is np.sum\n        mean_case = func is np.mean\n        try:\n            if not masked and (reduceat or sum_case or mean_case):\n                if mean_case:\n                    vals = np.add.reduceat(par_col, i0s) / np.diff(self.indices)\n                else:\n                    if sum_case:\n                        func = np.add\n                    vals = func.reduceat(par_col, i0s)\n            else:\n                vals = np.array([func(par_col[i0: i1]) for i0, i1 in zip(i0s, i1s)])\n        except Exception as err:\n            raise TypeError(\"Cannot aggregate column '{}' with type '{}'\"\n                            .format(par_col.info.name,\n                                    par_col.info.dtype)) from err\n\n        out = par_col.__class__(data=vals,\n                                name=par_col.info.name,\n                                description=par_col.info.description,\n                                unit=par_col.info.unit,\n                                format=par_col.info.format,\n                                meta=par_col.info.meta)\n        return out\n\n    def filter(self, func):\n        \"\"\"\n        Filter groups in the Column based on evaluating function ``func`` on each\n        group sub-table.\n\n        The function which is passed to this method must accept one argument:\n\n        - ``column`` : `Column` object\n\n        It must then return either `True` or `False`.  As an example, the following\n        will select all column groups with only positive values::\n\n          def all_positive(column):\n              if np.any(column < 0):\n                  return False\n              return True\n\n        Parameters\n        ----------\n        func : function\n            Filter function\n\n        Returns\n        -------\n        out : Column\n            New column with the aggregated rows.\n        \"\"\"\n        mask = np.empty(len(self), dtype=bool)\n        for i, group_column in enumerate(self):\n            mask[i] = func(group_column)\n\n        return self[mask]\n\n\nclass TableGroups(BaseGroups):\n    def __init__(self, parent_table, indices=None, keys=None):\n        self.parent_table = parent_table  # parent Table\n        self._indices = indices\n        self._keys = keys\n\n    @property\n    def key_colnames(self):\n        \"\"\"\n        Return the names of columns in the parent table that were used for grouping.\n        \"\"\"\n        # If the table was grouped by key columns *in* the table then treat those columns\n        # differently in aggregation.  In this case keys will be a Table with\n        # keys.meta['grouped_by_table_cols'] == True.  Keys might not be a Table so we\n        # need to handle this.\n        grouped_by_table_cols = getattr(self.keys, 'meta', {}).get('grouped_by_table_cols', False)\n        return self.keys.colnames if grouped_by_table_cols else ()\n\n    @property\n    def indices(self):\n        if self._indices is None:\n            return np.array([0, len(self.parent_table)])\n        else:\n            return self._indices\n\n    def aggregate(self, func):\n        \"\"\"\n        Aggregate each group in the Table into a single row by applying the reduction\n        function ``func`` to group values in each column.\n\n        Parameters\n        ----------\n        func : function\n            Function that reduces an array of values to a single value\n\n        Returns\n        -------\n        out : Table\n            New table with the aggregated rows.\n        \"\"\"\n\n        i0s = self.indices[:-1]\n        out_cols = []\n        parent_table = self.parent_table\n\n        for col in parent_table.columns.values():\n            # For key columns just pick off first in each group since they are identical\n            if col.info.name in self.key_colnames:\n                new_col = col.take(i0s)\n            else:\n                try:\n                    new_col = col.groups.aggregate(func)\n                except TypeError as err:\n                    warnings.warn(str(err), AstropyUserWarning)\n                    continue\n\n            out_cols.append(new_col)\n\n        return parent_table.__class__(out_cols, meta=parent_table.meta)\n\n    def filter(self, func):\n        \"\"\"\n        Filter groups in the Table based on evaluating function ``func`` on each\n        group sub-table.\n\n        The function which is passed to this method must accept two arguments:\n\n        - ``table`` : `Table` object\n        - ``key_colnames`` : tuple of column names in ``table`` used as keys for grouping\n\n        It must then return either `True` or `False`.  As an example, the following\n        will select all table groups with only positive values in the non-key columns::\n\n          def all_positive(table, key_colnames):\n              colnames = [name for name in table.colnames if name not in key_colnames]\n              for colname in colnames:\n                  if np.any(table[colname] < 0):\n                      return False\n              return True\n\n        Parameters\n        ----------\n        func : function\n            Filter function\n\n        Returns\n        -------\n        out : Table\n            New table with the aggregated rows.\n        \"\"\"\n        mask = np.empty(len(self), dtype=bool)\n        key_colnames = self.key_colnames\n        for i, group_table in enumerate(self):\n            mask[i] = func(group_table, key_colnames)\n\n        return self[mask]\n\n    @property\n    def keys(self):\n        return self._keys\n"},{"className":"BaseGroups","col":0,"comment":"\n    A class to represent groups within a table of heterogeneous data.\n\n      - ``keys``: key values corresponding to each group\n      - ``indices``: index values in parent table or column corresponding to group boundaries\n      - ``aggregate()``: method to create new table by aggregating within groups\n    ","endLoc":211,"id":9261,"nodeType":"Class","startLoc":157,"text":"class BaseGroups:\n    \"\"\"\n    A class to represent groups within a table of heterogeneous data.\n\n      - ``keys``: key values corresponding to each group\n      - ``indices``: index values in parent table or column corresponding to group boundaries\n      - ``aggregate()``: method to create new table by aggregating within groups\n    \"\"\"\n    @property\n    def parent(self):\n        return self.parent_column if isinstance(self, ColumnGroups) else self.parent_table\n\n    def __iter__(self):\n        self._iter_index = 0\n        return self\n\n    def next(self):\n        ii = self._iter_index\n        if ii < len(self.indices) - 1:\n            i0, i1 = self.indices[ii], self.indices[ii + 1]\n            self._iter_index += 1\n            return self.parent[i0:i1]\n        else:\n            raise StopIteration\n    __next__ = next\n\n    def __getitem__(self, item):\n        parent = self.parent\n\n        if isinstance(item, (int, np.integer)):\n            i0, i1 = self.indices[item], self.indices[item + 1]\n            out = parent[i0:i1]\n            out.groups._keys = parent.groups.keys[item]\n        else:\n            indices0, indices1 = self.indices[:-1], self.indices[1:]\n            try:\n                i0s, i1s = indices0[item], indices1[item]\n            except Exception as err:\n                raise TypeError('Index item for groups attribute must be a slice, '\n                                'numpy mask or int array') from err\n            mask = np.zeros(len(parent), dtype=bool)\n            # Is there a way to vectorize this in numpy?\n            for i0, i1 in zip(i0s, i1s):\n                mask[i0:i1] = True\n            out = parent[mask]\n            out.groups._keys = parent.groups.keys[item]\n            out.groups._indices = np.concatenate([[0], np.cumsum(i1s - i0s)])\n\n        return out\n\n    def __repr__(self):\n        return f'<{self.__class__.__name__} indices={self.indices}>'\n\n    def __len__(self):\n        return len(self.indices) - 1"},{"col":4,"comment":"null","endLoc":167,"header":"@property\n    def parent(self)","id":9262,"name":"parent","nodeType":"Function","startLoc":165,"text":"@property\n    def parent(self):\n        return self.parent_column if isinstance(self, ColumnGroups) else self.parent_table"},{"col":4,"comment":"null","endLoc":171,"header":"def __iter__(self)","id":9263,"name":"__iter__","nodeType":"Function","startLoc":169,"text":"def __iter__(self):\n        self._iter_index = 0\n        return self"},{"col":4,"comment":"null","endLoc":180,"header":"def next(self)","id":9264,"name":"next","nodeType":"Function","startLoc":173,"text":"def next(self):\n        ii = self._iter_index\n        if ii < len(self.indices) - 1:\n            i0, i1 = self.indices[ii], self.indices[ii + 1]\n            self._iter_index += 1\n            return self.parent[i0:i1]\n        else:\n            raise StopIteration"},{"col":4,"comment":"null","endLoc":205,"header":"def __getitem__(self, item)","id":9265,"name":"__getitem__","nodeType":"Function","startLoc":183,"text":"def __getitem__(self, item):\n        parent = self.parent\n\n        if isinstance(item, (int, np.integer)):\n            i0, i1 = self.indices[item], self.indices[item + 1]\n            out = parent[i0:i1]\n            out.groups._keys = parent.groups.keys[item]\n        else:\n            indices0, indices1 = self.indices[:-1], self.indices[1:]\n            try:\n                i0s, i1s = indices0[item], indices1[item]\n            except Exception as err:\n                raise TypeError('Index item for groups attribute must be a slice, '\n                                'numpy mask or int array') from err\n            mask = np.zeros(len(parent), dtype=bool)\n            # Is there a way to vectorize this in numpy?\n            for i0, i1 in zip(i0s, i1s):\n                mask[i0:i1] = True\n            out = parent[mask]\n            out.groups._keys = parent.groups.keys[item]\n            out.groups._indices = np.concatenate([[0], np.cumsum(i1s - i0s)])\n\n        return out"},{"attributeType":"null","col":8,"comment":"null","endLoc":33,"id":9266,"name":"self","nodeType":"Attribute","startLoc":33,"text":"self"},{"attributeType":"null","col":12,"comment":"null","endLoc":35,"id":9267,"name":"info","nodeType":"Attribute","startLoc":35,"text":"self.info"},{"col":4,"comment":"null","endLoc":208,"header":"def __repr__(self)","id":9268,"name":"__repr__","nodeType":"Function","startLoc":207,"text":"def __repr__(self):\n        return f'<{self.__class__.__name__} indices={self.indices}>'"},{"col":4,"comment":"null","endLoc":211,"header":"def __len__(self)","id":9269,"name":"__len__","nodeType":"Function","startLoc":210,"text":"def __len__(self):\n        return len(self.indices) - 1"},{"attributeType":"function","col":4,"comment":"null","endLoc":181,"id":9270,"name":"__next__","nodeType":"Attribute","startLoc":181,"text":"__next__"},{"fileName":"connect.py","filePath":"astropy/table","id":9271,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom astropy.io import registry\n\nfrom .info import serialize_method_as\n\n__all__ = ['TableRead', 'TableWrite']\n__doctest_skip__ = ['TableRead', 'TableWrite']\n\n\nclass TableRead(registry.UnifiedReadWrite):\n    \"\"\"Read and parse a data table and return as a Table.\n\n    This function provides the Table interface to the astropy unified I/O\n    layer.  This allows easily reading a file in many supported data formats\n    using syntax such as::\n\n      >>> from astropy.table import Table\n      >>> dat = Table.read('table.dat', format='ascii')\n      >>> events = Table.read('events.fits', format='fits')\n\n    Get help on the available readers for ``Table`` using the``help()`` method::\n\n      >>> Table.read.help()  # Get help reading Table and list supported formats\n      >>> Table.read.help('fits')  # Get detailed help on Table FITS reader\n      >>> Table.read.list_formats()  # Print list of available formats\n\n    See also: https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    *args : tuple, optional\n        Positional arguments passed through to data reader. If supplied the\n        first argument is typically the input filename.\n    format : str\n        File format specifier.\n    units : list, dict, optional\n        List or dict of units to apply to columns\n    descriptions : list, dict, optional\n        List or dict of descriptions to apply to columns\n    **kwargs : dict, optional\n        Keyword arguments passed through to data reader.\n\n    Returns\n    -------\n    out : `~astropy.table.Table`\n        Table corresponding to file contents\n\n    Notes\n    -----\n    \"\"\"\n\n    def __init__(self, instance, cls):\n        super().__init__(instance, cls, 'read', registry=None)\n        # uses default global registry\n\n    def __call__(self, *args, **kwargs):\n        cls = self._cls\n        units = kwargs.pop('units', None)\n        descriptions = kwargs.pop('descriptions', None)\n\n        out = self.registry.read(cls, *args, **kwargs)\n\n        # For some readers (e.g., ascii.ecsv), the returned `out` class is not\n        # guaranteed to be the same as the desired output `cls`.  If so,\n        # try coercing to desired class without copying (io.registry.read\n        # would normally do a copy).  The normal case here is swapping\n        # Table <=> QTable.\n        if cls is not out.__class__:\n            try:\n                out = cls(out, copy=False)\n            except Exception:\n                raise TypeError('could not convert reader output to {} '\n                                'class.'.format(cls.__name__))\n\n        out._set_column_attribute('unit', units)\n        out._set_column_attribute('description', descriptions)\n\n        return out\n\n\nclass TableWrite(registry.UnifiedReadWrite):\n    \"\"\"\n    Write this Table object out in the specified format.\n\n    This function provides the Table interface to the astropy unified I/O\n    layer.  This allows easily writing a file in many supported data formats\n    using syntax such as::\n\n      >>> from astropy.table import Table\n      >>> dat = Table([[1, 2], [3, 4]], names=('a', 'b'))\n      >>> dat.write('table.dat', format='ascii')\n\n    Get help on the available writers for ``Table`` using the``help()`` method::\n\n      >>> Table.write.help()  # Get help writing Table and list supported formats\n      >>> Table.write.help('fits')  # Get detailed help on Table FITS writer\n      >>> Table.write.list_formats()  # Print list of available formats\n\n    The ``serialize_method`` argument is explained in the section on\n    `Table serialization methods\n    <https://docs.astropy.org/en/latest/io/unified.html#table-serialization-methods>`_.\n\n    See also: https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    *args : tuple, optional\n        Positional arguments passed through to data writer. If supplied the\n        first argument is the output filename.\n    format : str\n        File format specifier.\n    serialize_method : str, dict, optional\n        Serialization method specifier for columns.\n    **kwargs : dict, optional\n        Keyword arguments passed through to data writer.\n\n    Notes\n    -----\n    \"\"\"\n\n    def __init__(self, instance, cls):\n        super().__init__(instance, cls, 'write', registry=None)\n        # uses default global registry\n\n    def __call__(self, *args, serialize_method=None, **kwargs):\n        instance = self._instance\n        with serialize_method_as(instance, serialize_method):\n            self.registry.write(instance, *args, **kwargs)\n"},{"col":0,"comment":"Context manager to temporarily override individual\n    column info.serialize_method dict values.  The serialize_method\n    attribute is an optional dict which might look like ``{'fits':\n    'jd1_jd2', 'ecsv': 'formatted_value', ..}``.\n\n    ``serialize_method`` is a str or dict.  If str then it the the value\n    is the ``serialize_method`` that will be used for all formats.\n    If dict then the key values can be either:\n\n    - Column name.  This has higher precedence than the second option of\n      matching class.\n    - Class (matches any column which is an instance of the class)\n\n    This context manager is expected to be used only within ``Table.write``.\n    It could have been a private method on Table but prefer not to add\n    clutter to that class.\n\n    Parameters\n    ----------\n    tbl : Table object\n        Input table\n    serialize_method : dict, str\n        Dict with key values of column names or types, or str\n\n    Returns\n    -------\n    None (context manager)\n    ","endLoc":213,"header":"@contextmanager\ndef serialize_method_as(tbl, serialize_method)","id":9272,"name":"serialize_method_as","nodeType":"Function","startLoc":126,"text":"@contextmanager\ndef serialize_method_as(tbl, serialize_method):\n    \"\"\"Context manager to temporarily override individual\n    column info.serialize_method dict values.  The serialize_method\n    attribute is an optional dict which might look like ``{'fits':\n    'jd1_jd2', 'ecsv': 'formatted_value', ..}``.\n\n    ``serialize_method`` is a str or dict.  If str then it the the value\n    is the ``serialize_method`` that will be used for all formats.\n    If dict then the key values can be either:\n\n    - Column name.  This has higher precedence than the second option of\n      matching class.\n    - Class (matches any column which is an instance of the class)\n\n    This context manager is expected to be used only within ``Table.write``.\n    It could have been a private method on Table but prefer not to add\n    clutter to that class.\n\n    Parameters\n    ----------\n    tbl : Table object\n        Input table\n    serialize_method : dict, str\n        Dict with key values of column names or types, or str\n\n    Returns\n    -------\n    None (context manager)\n    \"\"\"\n    def get_override_sm(col):\n        \"\"\"\n        Determine if the ``serialize_method`` str or dict specifies an\n        override of column presets for ``col``.  Returns the matching\n        serialize_method value or ``None``.\n        \"\"\"\n        # If a string then all columns match\n        if isinstance(serialize_method, str):\n            return serialize_method\n\n        # If column name then return that serialize_method\n        if col.info.name in serialize_method:\n            return serialize_method[col.info.name]\n\n        # Otherwise look for subclass matches\n        for key in serialize_method:\n            if isclass(key) and isinstance(col, key):\n                return serialize_method[key]\n\n        return None\n\n    # Setup for the context block.  Set individual column.info.serialize_method\n    # values as appropriate and keep a backup copy.  If ``serialize_method``\n    # is None or empty then don't do anything.\n\n    # Original serialize_method dict, keyed by column name.  This only\n    # gets used and set if there is an override.\n    original_sms = {}\n\n    if serialize_method:\n        # Go through every column and if it has a serialize_method info\n        # attribute then potentially update it for the duration of the write.\n        for col in tbl.itercols():\n            if hasattr(col.info, 'serialize_method'):\n                override_sm = get_override_sm(col)\n                if override_sm:\n                    # Make a reference copy of the column serialize_method\n                    # dict which maps format (e.g. 'fits') to the\n                    # appropriate method (e.g. 'data_mask').\n                    original_sms[col.info.name] = col.info.serialize_method\n\n                    # Set serialize method for *every* available format.  This is\n                    # brute force, but at this point the format ('fits', 'ecsv', etc)\n                    # is not actually known (this gets determined by the write function\n                    # in registry.py).  Note this creates a new temporary dict object\n                    # so that the restored version is the same original object.\n                    col.info.serialize_method = {fmt: override_sm\n                                                 for fmt in col.info.serialize_method}\n\n    # Finally yield for the context block\n    try:\n        yield\n    finally:\n        # Teardown (restore) for the context block.  Be sure to do this even\n        # if an exception occurred.\n        if serialize_method:\n            for name, original_sm in original_sms.items():\n                tbl[name].info.serialize_method = original_sm"},{"attributeType":"null","col":8,"comment":"null","endLoc":422,"id":9273,"name":"original","nodeType":"Attribute","startLoc":422,"text":"self.original"},{"attributeType":"null","col":8,"comment":"null","endLoc":170,"id":9274,"name":"_iter_index","nodeType":"Attribute","startLoc":170,"text":"self._iter_index"},{"className":"ColumnGroups","col":0,"comment":"null","endLoc":303,"id":9275,"nodeType":"Class","startLoc":214,"text":"class ColumnGroups(BaseGroups):\n    def __init__(self, parent_column, indices=None, keys=None):\n        self.parent_column = parent_column  # parent Column\n        self.parent_table = parent_column.parent_table\n        self._indices = indices\n        self._keys = keys\n\n    @property\n    def indices(self):\n        # If the parent column is in a table then use group indices from table\n        if self.parent_table:\n            return self.parent_table.groups.indices\n        else:\n            if self._indices is None:\n                return np.array([0, len(self.parent_column)])\n            else:\n                return self._indices\n\n    @property\n    def keys(self):\n        # If the parent column is in a table then use group indices from table\n        if self.parent_table:\n            return self.parent_table.groups.keys\n        else:\n            return self._keys\n\n    def aggregate(self, func):\n        from .column import MaskedColumn\n\n        i0s, i1s = self.indices[:-1], self.indices[1:]\n        par_col = self.parent_column\n        masked = isinstance(par_col, MaskedColumn)\n        reduceat = hasattr(func, 'reduceat')\n        sum_case = func is np.sum\n        mean_case = func is np.mean\n        try:\n            if not masked and (reduceat or sum_case or mean_case):\n                if mean_case:\n                    vals = np.add.reduceat(par_col, i0s) / np.diff(self.indices)\n                else:\n                    if sum_case:\n                        func = np.add\n                    vals = func.reduceat(par_col, i0s)\n            else:\n                vals = np.array([func(par_col[i0: i1]) for i0, i1 in zip(i0s, i1s)])\n        except Exception as err:\n            raise TypeError(\"Cannot aggregate column '{}' with type '{}'\"\n                            .format(par_col.info.name,\n                                    par_col.info.dtype)) from err\n\n        out = par_col.__class__(data=vals,\n                                name=par_col.info.name,\n                                description=par_col.info.description,\n                                unit=par_col.info.unit,\n                                format=par_col.info.format,\n                                meta=par_col.info.meta)\n        return out\n\n    def filter(self, func):\n        \"\"\"\n        Filter groups in the Column based on evaluating function ``func`` on each\n        group sub-table.\n\n        The function which is passed to this method must accept one argument:\n\n        - ``column`` : `Column` object\n\n        It must then return either `True` or `False`.  As an example, the following\n        will select all column groups with only positive values::\n\n          def all_positive(column):\n              if np.any(column < 0):\n                  return False\n              return True\n\n        Parameters\n        ----------\n        func : function\n            Filter function\n\n        Returns\n        -------\n        out : Column\n            New column with the aggregated rows.\n        \"\"\"\n        mask = np.empty(len(self), dtype=bool)\n        for i, group_column in enumerate(self):\n            mask[i] = func(group_column)\n\n        return self[mask]"},{"attributeType":"null","col":8,"comment":"null","endLoc":423,"id":9276,"name":"_frozen","nodeType":"Attribute","startLoc":423,"text":"self._frozen"},{"col":4,"comment":"null","endLoc":230,"header":"@property\n    def indices(self)","id":9277,"name":"indices","nodeType":"Function","startLoc":221,"text":"@property\n    def indices(self):\n        # If the parent column is in a table then use group indices from table\n        if self.parent_table:\n            return self.parent_table.groups.indices\n        else:\n            if self._indices is None:\n                return np.array([0, len(self.parent_column)])\n            else:\n                return self._indices"},{"attributeType":"null","col":12,"comment":"null","endLoc":429,"id":9278,"name":"start","nodeType":"Attribute","startLoc":429,"text":"self.start"},{"attributeType":"Index","col":8,"comment":"null","endLoc":421,"id":9279,"name":"index","nodeType":"Attribute","startLoc":421,"text":"self.index"},{"attributeType":"null","col":36,"comment":"null","endLoc":429,"id":9280,"name":"step","nodeType":"Attribute","startLoc":429,"text":"self.step"},{"className":"TableIndices","col":0,"comment":"\n    A special list of table indices allowing\n    for retrieval by column name(s).\n\n    Parameters\n    ----------\n    lst : list\n        List of indices\n    ","endLoc":796,"id":9281,"nodeType":"Class","startLoc":758,"text":"class TableIndices(list):\n    '''\n    A special list of table indices allowing\n    for retrieval by column name(s).\n\n    Parameters\n    ----------\n    lst : list\n        List of indices\n    '''\n\n    def __init__(self, lst):\n        super().__init__(lst)\n\n    def __getitem__(self, item):\n        '''\n        Retrieve an item from the list of indices.\n\n        Parameters\n        ----------\n        item : int, str, tuple, or list\n            Position in list or name(s) of indexed column(s)\n        '''\n        if isinstance(item, str):\n            item = [item]\n        if isinstance(item, (list, tuple)):\n            item = list(item)\n            for index in self:\n                try:\n                    for name in item:\n                        index.col_position(name)\n                    if len(index.columns) == len(item):\n                        return index\n                except ValueError:\n                    pass\n            # index search failed\n            raise IndexError(f\"No index found for {item}\")\n\n        return super().__getitem__(item)"},{"col":4,"comment":"\n        Retrieve an item from the list of indices.\n\n        Parameters\n        ----------\n        item : int, str, tuple, or list\n            Position in list or name(s) of indexed column(s)\n        ","endLoc":796,"header":"def __getitem__(self, item)","id":9282,"name":"__getitem__","nodeType":"Function","startLoc":772,"text":"def __getitem__(self, item):\n        '''\n        Retrieve an item from the list of indices.\n\n        Parameters\n        ----------\n        item : int, str, tuple, or list\n            Position in list or name(s) of indexed column(s)\n        '''\n        if isinstance(item, str):\n            item = [item]\n        if isinstance(item, (list, tuple)):\n            item = list(item)\n            for index in self:\n                try:\n                    for name in item:\n                        index.col_position(name)\n                    if len(index.columns) == len(item):\n                        return index\n                except ValueError:\n                    pass\n            # index search failed\n            raise IndexError(f\"No index found for {item}\")\n\n        return super().__getitem__(item)"},{"className":"TableLoc","col":0,"comment":"\n    A pseudo-list of Table rows allowing for retrieval\n    of rows by indexed column values.\n\n    Parameters\n    ----------\n    table : Table\n        Indexed table to use\n    ","endLoc":895,"id":9283,"nodeType":"Class","startLoc":799,"text":"class TableLoc:\n    \"\"\"\n    A pseudo-list of Table rows allowing for retrieval\n    of rows by indexed column values.\n\n    Parameters\n    ----------\n    table : Table\n        Indexed table to use\n    \"\"\"\n\n    def __init__(self, table):\n        self.table = table\n        self.indices = table.indices\n        if len(self.indices) == 0:\n            raise ValueError(\"Cannot create TableLoc object with no indices\")\n\n    def _get_rows(self, item):\n        \"\"\"\n        Retrieve Table rows indexes by value slice.\n        \"\"\"\n\n        if isinstance(item, tuple):\n            key, item = item\n        else:\n            key = self.table.primary_key\n\n        index = self.indices[key]\n        if len(index.columns) > 1:\n            raise ValueError(\"Cannot use .loc on multi-column indices\")\n\n        if isinstance(item, slice):\n            # None signifies no upper/lower bound\n            start = MinValue() if item.start is None else item.start\n            stop = MaxValue() if item.stop is None else item.stop\n            rows = index.range((start,), (stop,))\n        else:\n            if not isinstance(item, (list, np.ndarray)):  # single element\n                item = [item]\n            # item should be a list or ndarray of values\n            rows = []\n            for key in item:\n                p = index.find((key,))\n                if len(p) == 0:\n                    raise KeyError(f'No matches found for key {key}')\n                else:\n                    rows.extend(p)\n        return rows\n\n    def __getitem__(self, item):\n        \"\"\"\n        Retrieve Table rows by value slice.\n\n        Parameters\n        ----------\n        item : column element, list, ndarray, slice or tuple\n            Can be a value of the table primary index, a list/ndarray\n            of such values, or a value slice (both endpoints are included).\n            If a tuple is provided, the first element must be\n            an index to use instead of the primary key, and the\n            second element must be as above.\n        \"\"\"\n        rows = self._get_rows(item)\n\n        if len(rows) == 0:  # no matches found\n            raise KeyError(f'No matches found for key {item}')\n        elif len(rows) == 1:  # single row\n            return self.table[rows[0]]\n        return self.table[rows]\n\n    def __setitem__(self, key, value):\n        \"\"\"\n        Assign Table row's by value slice.\n\n        Parameters\n        ----------\n        key : column element, list, ndarray, slice or tuple\n              Can be a value of the table primary index, a list/ndarray\n              of such values, or a value slice (both endpoints are included).\n              If a tuple is provided, the first element must be\n              an index to use instead of the primary key, and the\n              second element must be as above.\n\n        value : New values of the row elements.\n                Can be a list of tuples/lists to update the row.\n        \"\"\"\n        rows = self._get_rows(key)\n        if len(rows) == 0:  # no matches found\n            raise KeyError(f'No matches found for key {key}')\n        elif len(rows) == 1:  # single row\n            self.table[rows[0]] = value\n        else:  # multiple rows\n            if len(rows) == len(value):\n                for row, val in zip(rows, value):\n                    self.table[row] = val\n            else:\n                raise ValueError(f'Right side should contain {len(rows)} values')"},{"col":4,"comment":"\n        Retrieve Table rows indexes by value slice.\n        ","endLoc":846,"header":"def _get_rows(self, item)","id":9284,"name":"_get_rows","nodeType":"Function","startLoc":816,"text":"def _get_rows(self, item):\n        \"\"\"\n        Retrieve Table rows indexes by value slice.\n        \"\"\"\n\n        if isinstance(item, tuple):\n            key, item = item\n        else:\n            key = self.table.primary_key\n\n        index = self.indices[key]\n        if len(index.columns) > 1:\n            raise ValueError(\"Cannot use .loc on multi-column indices\")\n\n        if isinstance(item, slice):\n            # None signifies no upper/lower bound\n            start = MinValue() if item.start is None else item.start\n            stop = MaxValue() if item.stop is None else item.stop\n            rows = index.range((start,), (stop,))\n        else:\n            if not isinstance(item, (list, np.ndarray)):  # single element\n                item = [item]\n            # item should be a list or ndarray of values\n            rows = []\n            for key in item:\n                p = index.find((key,))\n                if len(p) == 0:\n                    raise KeyError(f'No matches found for key {key}')\n                else:\n                    rows.extend(p)\n        return rows"},{"col":4,"comment":"null","endLoc":238,"header":"@property\n    def keys(self)","id":9286,"name":"keys","nodeType":"Function","startLoc":232,"text":"@property\n    def keys(self):\n        # If the parent column is in a table then use group indices from table\n        if self.parent_table:\n            return self.parent_table.groups.keys\n        else:\n            return self._keys"},{"col":4,"comment":"null","endLoc":270,"header":"def aggregate(self, func)","id":9287,"name":"aggregate","nodeType":"Function","startLoc":240,"text":"def aggregate(self, func):\n        from .column import MaskedColumn\n\n        i0s, i1s = self.indices[:-1], self.indices[1:]\n        par_col = self.parent_column\n        masked = isinstance(par_col, MaskedColumn)\n        reduceat = hasattr(func, 'reduceat')\n        sum_case = func is np.sum\n        mean_case = func is np.mean\n        try:\n            if not masked and (reduceat or sum_case or mean_case):\n                if mean_case:\n                    vals = np.add.reduceat(par_col, i0s) / np.diff(self.indices)\n                else:\n                    if sum_case:\n                        func = np.add\n                    vals = func.reduceat(par_col, i0s)\n            else:\n                vals = np.array([func(par_col[i0: i1]) for i0, i1 in zip(i0s, i1s)])\n        except Exception as err:\n            raise TypeError(\"Cannot aggregate column '{}' with type '{}'\"\n                            .format(par_col.info.name,\n                                    par_col.info.dtype)) from err\n\n        out = par_col.__class__(data=vals,\n                                name=par_col.info.name,\n                                description=par_col.info.description,\n                                unit=par_col.info.unit,\n                                format=par_col.info.format,\n                                meta=par_col.info.meta)\n        return out"},{"className":"TableRead","col":0,"comment":"Read and parse a data table and return as a Table.\n\n    This function provides the Table interface to the astropy unified I/O\n    layer.  This allows easily reading a file in many supported data formats\n    using syntax such as::\n\n      >>> from astropy.table import Table\n      >>> dat = Table.read('table.dat', format='ascii')\n      >>> events = Table.read('events.fits', format='fits')\n\n    Get help on the available readers for ``Table`` using the``help()`` method::\n\n      >>> Table.read.help()  # Get help reading Table and list supported formats\n      >>> Table.read.help('fits')  # Get detailed help on Table FITS reader\n      >>> Table.read.list_formats()  # Print list of available formats\n\n    See also: https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    *args : tuple, optional\n        Positional arguments passed through to data reader. If supplied the\n        first argument is typically the input filename.\n    format : str\n        File format specifier.\n    units : list, dict, optional\n        List or dict of units to apply to columns\n    descriptions : list, dict, optional\n        List or dict of descriptions to apply to columns\n    **kwargs : dict, optional\n        Keyword arguments passed through to data reader.\n\n    Returns\n    -------\n    out : `~astropy.table.Table`\n        Table corresponding to file contents\n\n    Notes\n    -----\n    ","endLoc":79,"id":9288,"nodeType":"Class","startLoc":11,"text":"class TableRead(registry.UnifiedReadWrite):\n    \"\"\"Read and parse a data table and return as a Table.\n\n    This function provides the Table interface to the astropy unified I/O\n    layer.  This allows easily reading a file in many supported data formats\n    using syntax such as::\n\n      >>> from astropy.table import Table\n      >>> dat = Table.read('table.dat', format='ascii')\n      >>> events = Table.read('events.fits', format='fits')\n\n    Get help on the available readers for ``Table`` using the``help()`` method::\n\n      >>> Table.read.help()  # Get help reading Table and list supported formats\n      >>> Table.read.help('fits')  # Get detailed help on Table FITS reader\n      >>> Table.read.list_formats()  # Print list of available formats\n\n    See also: https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    *args : tuple, optional\n        Positional arguments passed through to data reader. If supplied the\n        first argument is typically the input filename.\n    format : str\n        File format specifier.\n    units : list, dict, optional\n        List or dict of units to apply to columns\n    descriptions : list, dict, optional\n        List or dict of descriptions to apply to columns\n    **kwargs : dict, optional\n        Keyword arguments passed through to data reader.\n\n    Returns\n    -------\n    out : `~astropy.table.Table`\n        Table corresponding to file contents\n\n    Notes\n    -----\n    \"\"\"\n\n    def __init__(self, instance, cls):\n        super().__init__(instance, cls, 'read', registry=None)\n        # uses default global registry\n\n    def __call__(self, *args, **kwargs):\n        cls = self._cls\n        units = kwargs.pop('units', None)\n        descriptions = kwargs.pop('descriptions', None)\n\n        out = self.registry.read(cls, *args, **kwargs)\n\n        # For some readers (e.g., ascii.ecsv), the returned `out` class is not\n        # guaranteed to be the same as the desired output `cls`.  If so,\n        # try coercing to desired class without copying (io.registry.read\n        # would normally do a copy).  The normal case here is swapping\n        # Table <=> QTable.\n        if cls is not out.__class__:\n            try:\n                out = cls(out, copy=False)\n            except Exception:\n                raise TypeError('could not convert reader output to {} '\n                                'class.'.format(cls.__name__))\n\n        out._set_column_attribute('unit', units)\n        out._set_column_attribute('description', descriptions)\n\n        return out"},{"col":4,"comment":"\n        Retrieve Table rows by value slice.\n\n        Parameters\n        ----------\n        item : column element, list, ndarray, slice or tuple\n            Can be a value of the table primary index, a list/ndarray\n            of such values, or a value slice (both endpoints are included).\n            If a tuple is provided, the first element must be\n            an index to use instead of the primary key, and the\n            second element must be as above.\n        ","endLoc":867,"header":"def __getitem__(self, item)","id":9289,"name":"__getitem__","nodeType":"Function","startLoc":848,"text":"def __getitem__(self, item):\n        \"\"\"\n        Retrieve Table rows by value slice.\n\n        Parameters\n        ----------\n        item : column element, list, ndarray, slice or tuple\n            Can be a value of the table primary index, a list/ndarray\n            of such values, or a value slice (both endpoints are included).\n            If a tuple is provided, the first element must be\n            an index to use instead of the primary key, and the\n            second element must be as above.\n        \"\"\"\n        rows = self._get_rows(item)\n\n        if len(rows) == 0:  # no matches found\n            raise KeyError(f'No matches found for key {item}')\n        elif len(rows) == 1:  # single row\n            return self.table[rows[0]]\n        return self.table[rows]"},{"col":4,"comment":"null","endLoc":55,"header":"def __init__(self, instance, cls)","id":9290,"name":"__init__","nodeType":"Function","startLoc":53,"text":"def __init__(self, instance, cls):\n        super().__init__(instance, cls, 'read', registry=None)\n        # uses default global registry"},{"col":4,"comment":"\n        Assign Table row's by value slice.\n\n        Parameters\n        ----------\n        key : column element, list, ndarray, slice or tuple\n              Can be a value of the table primary index, a list/ndarray\n              of such values, or a value slice (both endpoints are included).\n              If a tuple is provided, the first element must be\n              an index to use instead of the primary key, and the\n              second element must be as above.\n\n        value : New values of the row elements.\n                Can be a list of tuples/lists to update the row.\n        ","endLoc":895,"header":"def __setitem__(self, key, value)","id":9291,"name":"__setitem__","nodeType":"Function","startLoc":869,"text":"def __setitem__(self, key, value):\n        \"\"\"\n        Assign Table row's by value slice.\n\n        Parameters\n        ----------\n        key : column element, list, ndarray, slice or tuple\n              Can be a value of the table primary index, a list/ndarray\n              of such values, or a value slice (both endpoints are included).\n              If a tuple is provided, the first element must be\n              an index to use instead of the primary key, and the\n              second element must be as above.\n\n        value : New values of the row elements.\n                Can be a list of tuples/lists to update the row.\n        \"\"\"\n        rows = self._get_rows(key)\n        if len(rows) == 0:  # no matches found\n            raise KeyError(f'No matches found for key {key}')\n        elif len(rows) == 1:  # single row\n            self.table[rows[0]] = value\n        else:  # multiple rows\n            if len(rows) == len(value):\n                for row, val in zip(rows, value):\n                    self.table[row] = val\n            else:\n                raise ValueError(f'Right side should contain {len(rows)} values')"},{"col":4,"comment":"null","endLoc":79,"header":"def __call__(self, *args, **kwargs)","id":9292,"name":"__call__","nodeType":"Function","startLoc":57,"text":"def __call__(self, *args, **kwargs):\n        cls = self._cls\n        units = kwargs.pop('units', None)\n        descriptions = kwargs.pop('descriptions', None)\n\n        out = self.registry.read(cls, *args, **kwargs)\n\n        # For some readers (e.g., ascii.ecsv), the returned `out` class is not\n        # guaranteed to be the same as the desired output `cls`.  If so,\n        # try coercing to desired class without copying (io.registry.read\n        # would normally do a copy).  The normal case here is swapping\n        # Table <=> QTable.\n        if cls is not out.__class__:\n            try:\n                out = cls(out, copy=False)\n            except Exception:\n                raise TypeError('could not convert reader output to {} '\n                                'class.'.format(cls.__name__))\n\n        out._set_column_attribute('unit', units)\n        out._set_column_attribute('description', descriptions)\n\n        return out"},{"attributeType":"null","col":8,"comment":"null","endLoc":812,"id":9293,"name":"indices","nodeType":"Attribute","startLoc":812,"text":"self.indices"},{"attributeType":"null","col":8,"comment":"null","endLoc":811,"id":9294,"name":"table","nodeType":"Attribute","startLoc":811,"text":"self.table"},{"className":"TableILoc","col":0,"comment":"\n    A variant of TableLoc allowing for row retrieval by\n    indexed order rather than data values.\n\n    Parameters\n    ----------\n    table : Table\n        Indexed table to use\n    ","endLoc":947,"id":9295,"nodeType":"Class","startLoc":921,"text":"class TableILoc(TableLoc):\n    '''\n    A variant of TableLoc allowing for row retrieval by\n    indexed order rather than data values.\n\n    Parameters\n    ----------\n    table : Table\n        Indexed table to use\n    '''\n\n    def __init__(self, table):\n        super().__init__(table)\n\n    def __getitem__(self, item):\n        if isinstance(item, tuple):\n            key, item = item\n        else:\n            key = self.table.primary_key\n        index = self.indices[key]\n        rows = index.sorted_data()[item]\n        table_slice = self.table[rows]\n\n        if len(table_slice) == 0:  # no matches found\n            raise IndexError(f'Invalid index for iloc: {item}')\n\n        return table_slice"},{"col":4,"comment":"null","endLoc":947,"header":"def __getitem__(self, item)","id":9296,"name":"__getitem__","nodeType":"Function","startLoc":935,"text":"def __getitem__(self, item):\n        if isinstance(item, tuple):\n            key, item = item\n        else:\n            key = self.table.primary_key\n        index = self.indices[key]\n        rows = index.sorted_data()[item]\n        table_slice = self.table[rows]\n\n        if len(table_slice) == 0:  # no matches found\n            raise IndexError(f'Invalid index for iloc: {item}')\n\n        return table_slice"},{"className":"TableLocIndices","col":0,"comment":"null","endLoc":918,"id":9297,"nodeType":"Class","startLoc":898,"text":"class TableLocIndices(TableLoc):\n\n    def __getitem__(self, item):\n        \"\"\"\n        Retrieve Table row's indices by value slice.\n\n        Parameters\n        ----------\n        item : column element, list, ndarray, slice or tuple\n               Can be a value of the table primary index, a list/ndarray\n               of such values, or a value slice (both endpoints are included).\n               If a tuple is provided, the first element must be\n               an index to use instead of the primary key, and the\n               second element must be as above.\n        \"\"\"\n        rows = self._get_rows(item)\n        if len(rows) == 0:  # no matches found\n            raise KeyError(f'No matches found for key {item}')\n        elif len(rows) == 1:  # single row\n            return rows[0]\n        return rows"},{"col":4,"comment":"\n        Retrieve Table row's indices by value slice.\n\n        Parameters\n        ----------\n        item : column element, list, ndarray, slice or tuple\n               Can be a value of the table primary index, a list/ndarray\n               of such values, or a value slice (both endpoints are included).\n               If a tuple is provided, the first element must be\n               an index to use instead of the primary key, and the\n               second element must be as above.\n        ","endLoc":918,"header":"def __getitem__(self, item)","id":9298,"name":"__getitem__","nodeType":"Function","startLoc":900,"text":"def __getitem__(self, item):\n        \"\"\"\n        Retrieve Table row's indices by value slice.\n\n        Parameters\n        ----------\n        item : column element, list, ndarray, slice or tuple\n               Can be a value of the table primary index, a list/ndarray\n               of such values, or a value slice (both endpoints are included).\n               If a tuple is provided, the first element must be\n               an index to use instead of the primary key, and the\n               second element must be as above.\n        \"\"\"\n        rows = self._get_rows(item)\n        if len(rows) == 0:  # no matches found\n            raise KeyError(f'No matches found for key {item}')\n        elif len(rows) == 1:  # single row\n            return rows[0]\n        return rows"},{"className":"QuantityInfo","col":0,"comment":"\n    Container for meta information like name, description, format.  This is\n    required when the object is used as a mixin column within a table, but can\n    be used as a general way to store meta information.\n    ","endLoc":236,"id":9299,"nodeType":"Class","startLoc":166,"text":"class QuantityInfo(QuantityInfoBase):\n    \"\"\"\n    Container for meta information like name, description, format.  This is\n    required when the object is used as a mixin column within a table, but can\n    be used as a general way to store meta information.\n    \"\"\"\n    _represent_as_dict_attrs = ('value', 'unit')\n    _construct_from_dict_args = ['value']\n    _represent_as_dict_primary_data = 'value'\n\n    def new_like(self, cols, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new Quantity instance which is consistent with the\n        input ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty column object whose elements can\n        be set in-place for table operations like join or vstack.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : `~astropy.units.Quantity` (or subclass)\n            Empty instance of this class consistent with ``cols``\n\n        \"\"\"\n\n        # Get merged info attributes like shape, dtype, format, description, etc.\n        attrs = self.merge_cols_attributes(cols, metadata_conflicts, name,\n                                           ('meta', 'format', 'description'))\n\n        # Make an empty quantity using the unit of the last one.\n        shape = (length,) + attrs.pop('shape')\n        dtype = attrs.pop('dtype')\n        # Use zeros so we do not get problems for Quantity subclasses such\n        # as Longitude and Latitude, which cannot take arbitrary values.\n        data = np.zeros(shape=shape, dtype=dtype)\n        # Get arguments needed to reconstruct class\n        map = {key: (data if key == 'value' else getattr(cols[-1], key))\n               for key in self._represent_as_dict_attrs}\n        map['copy'] = False\n        out = self._construct_from_dict(map)\n\n        # Set remaining info attributes\n        for attr, value in attrs.items():\n            setattr(out.info, attr, value)\n\n        return out\n\n    def get_sortable_arrays(self):\n        \"\"\"\n        Return a list of arrays which can be lexically sorted to represent\n        the order of the parent column.\n\n        For Quantity this is just the quantity itself.\n\n\n        Returns\n        -------\n        arrays : list of ndarray\n        \"\"\"\n        return [self._parent]"},{"col":4,"comment":"Iterator which yields formatted string representation of column values.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum lines of output (header + data rows)\n\n        show_name : bool\n            Include column name. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        outs : dict\n            Must be a dict which is used to pass back additional values\n            defined within the iterator.\n\n        show_dtype : bool\n            Include column dtype. Default is False.\n\n        show_length : bool\n            Include column length at end.  Default is to show this only\n            if the column is not shown completely.\n        ","endLoc":490,"header":"def _pformat_col_iter(self, col, max_lines, show_name, show_unit, outs,\n                          show_dtype=False, show_length=None)","id":9300,"name":"_pformat_col_iter","nodeType":"Function","startLoc":346,"text":"def _pformat_col_iter(self, col, max_lines, show_name, show_unit, outs,\n                          show_dtype=False, show_length=None):\n        \"\"\"Iterator which yields formatted string representation of column values.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum lines of output (header + data rows)\n\n        show_name : bool\n            Include column name. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        outs : dict\n            Must be a dict which is used to pass back additional values\n            defined within the iterator.\n\n        show_dtype : bool\n            Include column dtype. Default is False.\n\n        show_length : bool\n            Include column length at end.  Default is to show this only\n            if the column is not shown completely.\n        \"\"\"\n        max_lines, _ = self._get_pprint_size(max_lines, -1)\n\n        multidims = getattr(col, 'shape', [0])[1:]\n        if multidims:\n            multidim0 = tuple(0 for n in multidims)\n            multidim1 = tuple(n - 1 for n in multidims)\n            trivial_multidims = np.prod(multidims) == 1\n\n        i_dashes = None\n        i_centers = []  # Line indexes where content should be centered\n        n_header = 0\n        if show_name:\n            i_centers.append(n_header)\n            # Get column name (or 'None' if not set)\n            col_name = str(col.info.name)\n            if multidims:\n                col_name += f\" [{','.join(str(n) for n in multidims)}]\"\n            n_header += 1\n            yield col_name\n        if show_unit:\n            i_centers.append(n_header)\n            n_header += 1\n            yield str(col.info.unit or '')\n        if show_dtype:\n            i_centers.append(n_header)\n            n_header += 1\n            try:\n                dtype = dtype_info_name(col.dtype)\n            except AttributeError:\n                dtype = col.__class__.__qualname__ or 'object'\n            yield str(dtype)\n        if show_unit or show_name or show_dtype:\n            i_dashes = n_header\n            n_header += 1\n            yield '---'\n\n        max_lines -= n_header\n        n_print2 = max_lines // 2\n        n_rows = len(col)\n\n        # This block of code is responsible for producing the function that\n        # will format values for this column.  The ``format_func`` function\n        # takes two args (col_format, val) and returns the string-formatted\n        # version.  Some points to understand:\n        #\n        # - col_format could itself be the formatting function, so it will\n        #    actually end up being called with itself as the first arg.  In\n        #    this case the function is expected to ignore its first arg.\n        #\n        # - auto_format_func is a function that gets called on the first\n        #    column value that is being formatted.  It then determines an\n        #    appropriate formatting function given the actual value to be\n        #    formatted.  This might be deterministic or it might involve\n        #    try/except.  The latter allows for different string formatting\n        #    options like %f or {:5.3f}.  When auto_format_func is called it:\n\n        #    1. Caches the function in the _format_funcs dict so for subsequent\n        #       values the right function is called right away.\n        #    2. Returns the formatted value.\n        #\n        # - possible_string_format_functions is a function that yields a\n        #    succession of functions that might successfully format the\n        #    value.  There is a default, but Mixin methods can override this.\n        #    See Quantity for an example.\n        #\n        # - get_auto_format_func() returns a wrapped version of auto_format_func\n        #    with the column id and possible_string_format_functions as\n        #    enclosed variables.\n        col_format = col.info.format or getattr(col.info, 'default_format',\n                                                None)\n        pssf = (getattr(col.info, 'possible_string_format_functions', None)\n                or _possible_string_format_functions)\n        auto_format_func = get_auto_format_func(col, pssf)\n        format_func = col.info._format_funcs.get(col_format, auto_format_func)\n\n        if len(col) > max_lines:\n            if show_length is None:\n                show_length = True\n            i0 = n_print2 - (1 if show_length else 0)\n            i1 = n_rows - n_print2 - max_lines % 2\n            indices = np.concatenate([np.arange(0, i0 + 1),\n                                      np.arange(i1 + 1, len(col))])\n        else:\n            i0 = -1\n            indices = np.arange(len(col))\n\n        def format_col_str(idx):\n            if multidims:\n                # Prevents columns like Column(data=[[(1,)],[(2,)]], name='a')\n                # with shape (n,1,...,1) from being printed as if there was\n                # more than one element in a row\n                if trivial_multidims:\n                    return format_func(col_format, col[(idx,) + multidim0])\n                else:\n                    left = format_func(col_format, col[(idx,) + multidim0])\n                    right = format_func(col_format, col[(idx,) + multidim1])\n                    return f'{left} .. {right}'\n            else:\n                return format_func(col_format, col[idx])\n\n        # Add formatted values if within bounds allowed by max_lines\n        for idx in indices:\n            if idx == i0:\n                yield '...'\n            else:\n                try:\n                    yield format_col_str(idx)\n                except ValueError:\n                    raise ValueError(\n                        'Unable to parse format string \"{}\" for entry \"{}\" '\n                        'in column \"{}\"'.format(col_format, col[idx],\n                                                col.info.name))\n\n        outs['show_length'] = show_length\n        outs['n_header'] = n_header\n        outs['i_centers'] = i_centers\n        outs['i_dashes'] = i_dashes"},{"className":"QuantityInfoBase","col":0,"comment":"null","endLoc":163,"id":9301,"nodeType":"Class","startLoc":140,"text":"class QuantityInfoBase(ParentDtypeInfo):\n    # This is on a base class rather than QuantityInfo directly, so that\n    # it can be used for EarthLocationInfo yet make clear that that class\n    # should not be considered a typical Quantity subclass by Table.\n    attrs_from_parent = {'dtype', 'unit'}  # dtype and unit taken from parent\n    _supports_indexing = True\n\n    @staticmethod\n    def default_format(val):\n        return f'{val.value}'\n\n    @staticmethod\n    def possible_string_format_functions(format_):\n        \"\"\"Iterate through possible string-derived format functions.\n\n        A string can either be a format specifier for the format built-in,\n        a new-style format string, or an old-style format string.\n\n        This method is overridden in order to suppress printing the unit\n        in each row since it is already at the top in the column header.\n        \"\"\"\n        yield lambda format_, val: format(val.value, format_)\n        yield lambda format_, val: format_.format(val.value)\n        yield lambda format_, val: format_ % val.value"},{"col":4,"comment":"null","endLoc":149,"header":"@staticmethod\n    def default_format(val)","id":9302,"name":"default_format","nodeType":"Function","startLoc":147,"text":"@staticmethod\n    def default_format(val):\n        return f'{val.value}'"},{"col":4,"comment":"Iterate through possible string-derived format functions.\n\n        A string can either be a format specifier for the format built-in,\n        a new-style format string, or an old-style format string.\n\n        This method is overridden in order to suppress printing the unit\n        in each row since it is already at the top in the column header.\n        ","endLoc":163,"header":"@staticmethod\n    def possible_string_format_functions(format_)","id":9303,"name":"possible_string_format_functions","nodeType":"Function","startLoc":151,"text":"@staticmethod\n    def possible_string_format_functions(format_):\n        \"\"\"Iterate through possible string-derived format functions.\n\n        A string can either be a format specifier for the format built-in,\n        a new-style format string, or an old-style format string.\n\n        This method is overridden in order to suppress printing the unit\n        in each row since it is already at the top in the column header.\n        \"\"\"\n        yield lambda format_, val: format(val.value, format_)\n        yield lambda format_, val: format_.format(val.value)\n        yield lambda format_, val: format_ % val.value"},{"col":14,"endLoc":161,"id":9304,"nodeType":"Lambda","startLoc":161,"text":"lambda format_, val: format(val.value, format_)"},{"col":14,"endLoc":162,"id":9305,"nodeType":"Lambda","startLoc":162,"text":"lambda format_, val: format_.format(val.value)"},{"col":14,"endLoc":163,"id":9306,"nodeType":"Lambda","startLoc":163,"text":"lambda format_, val: format_ % val.value"},{"className":"TableWrite","col":0,"comment":"\n    Write this Table object out in the specified format.\n\n    This function provides the Table interface to the astropy unified I/O\n    layer.  This allows easily writing a file in many supported data formats\n    using syntax such as::\n\n      >>> from astropy.table import Table\n      >>> dat = Table([[1, 2], [3, 4]], names=('a', 'b'))\n      >>> dat.write('table.dat', format='ascii')\n\n    Get help on the available writers for ``Table`` using the``help()`` method::\n\n      >>> Table.write.help()  # Get help writing Table and list supported formats\n      >>> Table.write.help('fits')  # Get detailed help on Table FITS writer\n      >>> Table.write.list_formats()  # Print list of available formats\n\n    The ``serialize_method`` argument is explained in the section on\n    `Table serialization methods\n    <https://docs.astropy.org/en/latest/io/unified.html#table-serialization-methods>`_.\n\n    See also: https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    *args : tuple, optional\n        Positional arguments passed through to data writer. If supplied the\n        first argument is the output filename.\n    format : str\n        File format specifier.\n    serialize_method : str, dict, optional\n        Serialization method specifier for columns.\n    **kwargs : dict, optional\n        Keyword arguments passed through to data writer.\n\n    Notes\n    -----\n    ","endLoc":129,"id":9307,"nodeType":"Class","startLoc":82,"text":"class TableWrite(registry.UnifiedReadWrite):\n    \"\"\"\n    Write this Table object out in the specified format.\n\n    This function provides the Table interface to the astropy unified I/O\n    layer.  This allows easily writing a file in many supported data formats\n    using syntax such as::\n\n      >>> from astropy.table import Table\n      >>> dat = Table([[1, 2], [3, 4]], names=('a', 'b'))\n      >>> dat.write('table.dat', format='ascii')\n\n    Get help on the available writers for ``Table`` using the``help()`` method::\n\n      >>> Table.write.help()  # Get help writing Table and list supported formats\n      >>> Table.write.help('fits')  # Get detailed help on Table FITS writer\n      >>> Table.write.list_formats()  # Print list of available formats\n\n    The ``serialize_method`` argument is explained in the section on\n    `Table serialization methods\n    <https://docs.astropy.org/en/latest/io/unified.html#table-serialization-methods>`_.\n\n    See also: https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    *args : tuple, optional\n        Positional arguments passed through to data writer. If supplied the\n        first argument is the output filename.\n    format : str\n        File format specifier.\n    serialize_method : str, dict, optional\n        Serialization method specifier for columns.\n    **kwargs : dict, optional\n        Keyword arguments passed through to data writer.\n\n    Notes\n    -----\n    \"\"\"\n\n    def __init__(self, instance, cls):\n        super().__init__(instance, cls, 'write', registry=None)\n        # uses default global registry\n\n    def __call__(self, *args, serialize_method=None, **kwargs):\n        instance = self._instance\n        with serialize_method_as(instance, serialize_method):\n            self.registry.write(instance, *args, **kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":144,"id":9308,"name":"attrs_from_parent","nodeType":"Attribute","startLoc":144,"text":"attrs_from_parent"},{"col":4,"comment":"null","endLoc":124,"header":"def __init__(self, instance, cls)","id":9309,"name":"__init__","nodeType":"Function","startLoc":122,"text":"def __init__(self, instance, cls):\n        super().__init__(instance, cls, 'write', registry=None)\n        # uses default global registry"},{"col":4,"comment":"null","endLoc":129,"header":"def __call__(self, *args, serialize_method=None, **kwargs)","id":9310,"name":"__call__","nodeType":"Function","startLoc":126,"text":"def __call__(self, *args, serialize_method=None, **kwargs):\n        instance = self._instance\n        with serialize_method_as(instance, serialize_method):\n            self.registry.write(instance, *args, **kwargs)"},{"col":4,"comment":"\n        Filter groups in the Column based on evaluating function ``func`` on each\n        group sub-table.\n\n        The function which is passed to this method must accept one argument:\n\n        - ``column`` : `Column` object\n\n        It must then return either `True` or `False`.  As an example, the following\n        will select all column groups with only positive values::\n\n          def all_positive(column):\n              if np.any(column < 0):\n                  return False\n              return True\n\n        Parameters\n        ----------\n        func : function\n            Filter function\n\n        Returns\n        -------\n        out : Column\n            New column with the aggregated rows.\n        ","endLoc":303,"header":"def filter(self, func)","id":9311,"name":"filter","nodeType":"Function","startLoc":272,"text":"def filter(self, func):\n        \"\"\"\n        Filter groups in the Column based on evaluating function ``func`` on each\n        group sub-table.\n\n        The function which is passed to this method must accept one argument:\n\n        - ``column`` : `Column` object\n\n        It must then return either `True` or `False`.  As an example, the following\n        will select all column groups with only positive values::\n\n          def all_positive(column):\n              if np.any(column < 0):\n                  return False\n              return True\n\n        Parameters\n        ----------\n        func : function\n            Filter function\n\n        Returns\n        -------\n        out : Column\n            New column with the aggregated rows.\n        \"\"\"\n        mask = np.empty(len(self), dtype=bool)\n        for i, group_column in enumerate(self):\n            mask[i] = func(group_column)\n\n        return self[mask]"},{"attributeType":"{parent_table}","col":8,"comment":"null","endLoc":216,"id":9312,"name":"parent_column","nodeType":"Attribute","startLoc":216,"text":"self.parent_column"},{"attributeType":"null","col":8,"comment":"null","endLoc":217,"id":9313,"name":"parent_table","nodeType":"Attribute","startLoc":217,"text":"self.parent_table"},{"attributeType":"null","col":8,"comment":"null","endLoc":218,"id":9314,"name":"_indices","nodeType":"Attribute","startLoc":218,"text":"self._indices"},{"attributeType":"null","col":4,"comment":"null","endLoc":145,"id":9315,"name":"_supports_indexing","nodeType":"Attribute","startLoc":145,"text":"_supports_indexing"},{"col":4,"comment":"\n        Return a new Quantity instance which is consistent with the\n        input ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty column object whose elements can\n        be set in-place for table operations like join or vstack.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : `~astropy.units.Quantity` (or subclass)\n            Empty instance of this class consistent with ``cols``\n\n        ","endLoc":222,"header":"def new_like(self, cols, length, metadata_conflicts='warn', name=None)","id":9316,"name":"new_like","nodeType":"Function","startLoc":176,"text":"def new_like(self, cols, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new Quantity instance which is consistent with the\n        input ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty column object whose elements can\n        be set in-place for table operations like join or vstack.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : `~astropy.units.Quantity` (or subclass)\n            Empty instance of this class consistent with ``cols``\n\n        \"\"\"\n\n        # Get merged info attributes like shape, dtype, format, description, etc.\n        attrs = self.merge_cols_attributes(cols, metadata_conflicts, name,\n                                           ('meta', 'format', 'description'))\n\n        # Make an empty quantity using the unit of the last one.\n        shape = (length,) + attrs.pop('shape')\n        dtype = attrs.pop('dtype')\n        # Use zeros so we do not get problems for Quantity subclasses such\n        # as Longitude and Latitude, which cannot take arbitrary values.\n        data = np.zeros(shape=shape, dtype=dtype)\n        # Get arguments needed to reconstruct class\n        map = {key: (data if key == 'value' else getattr(cols[-1], key))\n               for key in self._represent_as_dict_attrs}\n        map['copy'] = False\n        out = self._construct_from_dict(map)\n\n        # Set remaining info attributes\n        for attr, value in attrs.items():\n            setattr(out.info, attr, value)\n\n        return out"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":9317,"name":"__all__","nodeType":"Attribute","startLoc":7,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":9318,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":8,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":3,"header":"connect.py#<anonymous>","id":9319,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['TableRead', 'TableWrite']\n\n__doctest_skip__ = ['TableRead', 'TableWrite']"},{"attributeType":"null","col":8,"comment":"null","endLoc":219,"id":9320,"name":"_keys","nodeType":"Attribute","startLoc":219,"text":"self._keys"},{"fileName":"sorted_array.py","filePath":"astropy/table","id":9321,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport numpy as np\n\n\ndef _searchsorted(array, val, side='left'):\n    '''\n    Call np.searchsorted or use a custom binary\n    search if necessary.\n    '''\n    if hasattr(array, 'searchsorted'):\n        return array.searchsorted(val, side=side)\n    # Python binary search\n    begin = 0\n    end = len(array)\n    while begin < end:\n        mid = (begin + end) // 2\n        if val > array[mid]:\n            begin = mid + 1\n        elif val < array[mid]:\n            end = mid\n        elif side == 'right':\n            begin = mid + 1\n        else:\n            end = mid\n    return begin\n\n\nclass SortedArray:\n    '''\n    Implements a sorted array container using\n    a list of numpy arrays.\n\n    Parameters\n    ----------\n    data : Table\n        Sorted columns of the original table\n    row_index : Column object\n        Row numbers corresponding to data columns\n    unique : bool\n        Whether the values of the index must be unique.\n        Defaults to False.\n    '''\n\n    def __init__(self, data, row_index, unique=False):\n        self.data = data\n        self.row_index = row_index\n        self.num_cols = len(getattr(data, 'colnames', []))\n        self.unique = unique\n\n    @property\n    def cols(self):\n        return list(self.data.columns.values())\n\n    def add(self, key, row):\n        '''\n        Add a new entry to the sorted array.\n\n        Parameters\n        ----------\n        key : tuple\n            Column values at the given row\n        row : int\n            Row number\n        '''\n        pos = self.find_pos(key, row)  # first >= key\n\n        if self.unique and 0 <= pos < len(self.row_index) and \\\n           all(self.data[pos][i] == key[i] for i in range(len(key))):\n            # already exists\n            raise ValueError(f'Cannot add duplicate value \"{key}\" in a unique index')\n        self.data.insert_row(pos, key)\n        self.row_index = self.row_index.insert(pos, row)\n\n    def _get_key_slice(self, i, begin, end):\n        '''\n        Retrieve the ith slice of the sorted array\n        from begin to end.\n        '''\n        if i < self.num_cols:\n            return self.cols[i][begin:end]\n        else:\n            return self.row_index[begin:end]\n\n    def find_pos(self, key, data, exact=False):\n        '''\n        Return the index of the largest key in data greater than or\n        equal to the given key, data pair.\n\n        Parameters\n        ----------\n        key : tuple\n            Column key\n        data : int\n            Row number\n        exact : bool\n            If True, return the index of the given key in data\n            or -1 if the key is not present.\n        '''\n        begin = 0\n        end = len(self.row_index)\n        num_cols = self.num_cols\n        if not self.unique:\n            # consider the row value as well\n            key = key + (data,)\n            num_cols += 1\n\n        # search through keys in lexicographic order\n        for i in range(num_cols):\n            key_slice = self._get_key_slice(i, begin, end)\n            t = _searchsorted(key_slice, key[i])\n            # t is the smallest index >= key[i]\n            if exact and (t == len(key_slice) or key_slice[t] != key[i]):\n                # no match\n                return -1\n            elif t == len(key_slice) or (t == 0 and len(key_slice) > 0\n                                         and key[i] < key_slice[0]):\n                # too small or too large\n                return begin + t\n            end = begin + _searchsorted(key_slice, key[i], side='right')\n            begin += t\n            if begin >= len(self.row_index):  # greater than all keys\n                return begin\n\n        return begin\n\n    def find(self, key):\n        '''\n        Find all rows matching the given key.\n\n        Parameters\n        ----------\n        key : tuple\n            Column values\n\n        Returns\n        -------\n        matching_rows : list\n            List of rows matching the input key\n        '''\n        begin = 0\n        end = len(self.row_index)\n\n        # search through keys in lexicographic order\n        for i in range(self.num_cols):\n            key_slice = self._get_key_slice(i, begin, end)\n            t = _searchsorted(key_slice, key[i])\n            # t is the smallest index >= key[i]\n            if t == len(key_slice) or key_slice[t] != key[i]:\n                # no match\n                return []\n            elif t == 0 and len(key_slice) > 0 and key[i] < key_slice[0]:\n                # too small or too large\n                return []\n            end = begin + _searchsorted(key_slice, key[i], side='right')\n            begin += t\n            if begin >= len(self.row_index):  # greater than all keys\n                return []\n\n        return self.row_index[begin:end]\n\n    def range(self, lower, upper, bounds):\n        '''\n        Find values in the given range.\n\n        Parameters\n        ----------\n        lower : tuple\n            Lower search bound\n        upper : tuple\n            Upper search bound\n        bounds : (2,) tuple of bool\n            Indicates whether the search should be inclusive or\n            exclusive with respect to the endpoints. The first\n            argument corresponds to an inclusive lower bound,\n            and the second argument to an inclusive upper bound.\n        '''\n        lower_pos = self.find_pos(lower, 0)\n        upper_pos = self.find_pos(upper, 0)\n        if lower_pos == len(self.row_index):\n            return []\n\n        lower_bound = tuple([col[lower_pos] for col in self.cols])\n        if not bounds[0] and lower_bound == lower:\n            lower_pos += 1  # data[lower_pos] > lower\n\n        # data[lower_pos] >= lower\n        # data[upper_pos] >= upper\n        if upper_pos < len(self.row_index):\n            upper_bound = tuple([col[upper_pos] for col in self.cols])\n            if not bounds[1] and upper_bound == upper:\n                upper_pos -= 1  # data[upper_pos] < upper\n            elif upper_bound > upper:\n                upper_pos -= 1  # data[upper_pos] <= upper\n        return self.row_index[lower_pos:upper_pos + 1]\n\n    def remove(self, key, data):\n        '''\n        Remove the given entry from the sorted array.\n\n        Parameters\n        ----------\n        key : tuple\n            Column values\n        data : int\n            Row number\n\n        Returns\n        -------\n        successful : bool\n            Whether the entry was successfully removed\n        '''\n        pos = self.find_pos(key, data, exact=True)\n        if pos == -1:  # key not found\n            return False\n\n        self.data.remove_row(pos)\n        keep_mask = np.ones(len(self.row_index), dtype=bool)\n        keep_mask[pos] = False\n        self.row_index = self.row_index[keep_mask]\n        return True\n\n    def shift_left(self, row):\n        '''\n        Decrement all row numbers greater than the input row.\n\n        Parameters\n        ----------\n        row : int\n            Input row number\n        '''\n        self.row_index[self.row_index > row] -= 1\n\n    def shift_right(self, row):\n        '''\n        Increment all row numbers greater than or equal to the input row.\n\n        Parameters\n        ----------\n        row : int\n            Input row number\n        '''\n        self.row_index[self.row_index >= row] += 1\n\n    def replace_rows(self, row_map):\n        '''\n        Replace all rows with the values they map to in the\n        given dictionary. Any rows not present as keys in\n        the dictionary will have their entries deleted.\n\n        Parameters\n        ----------\n        row_map : dict\n            Mapping of row numbers to new row numbers\n        '''\n        num_rows = len(row_map)\n        keep_rows = np.zeros(len(self.row_index), dtype=bool)\n        tagged = 0\n        for i, row in enumerate(self.row_index):\n            if row in row_map:\n                keep_rows[i] = True\n                tagged += 1\n                if tagged == num_rows:\n                    break\n\n        self.data = self.data[keep_rows]\n        self.row_index = np.array(\n            [row_map[x] for x in self.row_index[keep_rows]])\n\n    def items(self):\n        '''\n        Retrieve all array items as a list of pairs of the form\n        [(key, [row 1, row 2, ...]), ...]\n        '''\n        array = []\n        last_key = None\n        for i, key in enumerate(zip(*self.data.columns.values())):\n            row = self.row_index[i]\n            if key == last_key:\n                array[-1][1].append(row)\n            else:\n                last_key = key\n                array.append((key, [row]))\n        return array\n\n    def sort(self):\n        '''\n        Make row order align with key order.\n        '''\n        self.row_index = np.arange(len(self.row_index))\n\n    def sorted_data(self):\n        '''\n        Return rows in sorted order.\n        '''\n        return self.row_index\n\n    def __getitem__(self, item):\n        '''\n        Return a sliced reference to this sorted array.\n\n        Parameters\n        ----------\n        item : slice\n            Slice to use for referencing\n        '''\n        return SortedArray(self.data[item], self.row_index[item])\n\n    def __repr__(self):\n        t = self.data.copy()\n        t['rows'] = self.row_index\n        return f'<{self.__class__.__name__} length={len(t)}>\\n{t}'\n"},{"className":"TableGroups","col":0,"comment":"null","endLoc":405,"id":9322,"nodeType":"Class","startLoc":306,"text":"class TableGroups(BaseGroups):\n    def __init__(self, parent_table, indices=None, keys=None):\n        self.parent_table = parent_table  # parent Table\n        self._indices = indices\n        self._keys = keys\n\n    @property\n    def key_colnames(self):\n        \"\"\"\n        Return the names of columns in the parent table that were used for grouping.\n        \"\"\"\n        # If the table was grouped by key columns *in* the table then treat those columns\n        # differently in aggregation.  In this case keys will be a Table with\n        # keys.meta['grouped_by_table_cols'] == True.  Keys might not be a Table so we\n        # need to handle this.\n        grouped_by_table_cols = getattr(self.keys, 'meta', {}).get('grouped_by_table_cols', False)\n        return self.keys.colnames if grouped_by_table_cols else ()\n\n    @property\n    def indices(self):\n        if self._indices is None:\n            return np.array([0, len(self.parent_table)])\n        else:\n            return self._indices\n\n    def aggregate(self, func):\n        \"\"\"\n        Aggregate each group in the Table into a single row by applying the reduction\n        function ``func`` to group values in each column.\n\n        Parameters\n        ----------\n        func : function\n            Function that reduces an array of values to a single value\n\n        Returns\n        -------\n        out : Table\n            New table with the aggregated rows.\n        \"\"\"\n\n        i0s = self.indices[:-1]\n        out_cols = []\n        parent_table = self.parent_table\n\n        for col in parent_table.columns.values():\n            # For key columns just pick off first in each group since they are identical\n            if col.info.name in self.key_colnames:\n                new_col = col.take(i0s)\n            else:\n                try:\n                    new_col = col.groups.aggregate(func)\n                except TypeError as err:\n                    warnings.warn(str(err), AstropyUserWarning)\n                    continue\n\n            out_cols.append(new_col)\n\n        return parent_table.__class__(out_cols, meta=parent_table.meta)\n\n    def filter(self, func):\n        \"\"\"\n        Filter groups in the Table based on evaluating function ``func`` on each\n        group sub-table.\n\n        The function which is passed to this method must accept two arguments:\n\n        - ``table`` : `Table` object\n        - ``key_colnames`` : tuple of column names in ``table`` used as keys for grouping\n\n        It must then return either `True` or `False`.  As an example, the following\n        will select all table groups with only positive values in the non-key columns::\n\n          def all_positive(table, key_colnames):\n              colnames = [name for name in table.colnames if name not in key_colnames]\n              for colname in colnames:\n                  if np.any(table[colname] < 0):\n                      return False\n              return True\n\n        Parameters\n        ----------\n        func : function\n            Filter function\n\n        Returns\n        -------\n        out : Table\n            New table with the aggregated rows.\n        \"\"\"\n        mask = np.empty(len(self), dtype=bool)\n        key_colnames = self.key_colnames\n        for i, group_table in enumerate(self):\n            mask[i] = func(group_table, key_colnames)\n\n        return self[mask]\n\n    @property\n    def keys(self):\n        return self._keys"},{"col":4,"comment":"\n        Return the names of columns in the parent table that were used for grouping.\n        ","endLoc":322,"header":"@property\n    def key_colnames(self)","id":9323,"name":"key_colnames","nodeType":"Function","startLoc":312,"text":"@property\n    def key_colnames(self):\n        \"\"\"\n        Return the names of columns in the parent table that were used for grouping.\n        \"\"\"\n        # If the table was grouped by key columns *in* the table then treat those columns\n        # differently in aggregation.  In this case keys will be a Table with\n        # keys.meta['grouped_by_table_cols'] == True.  Keys might not be a Table so we\n        # need to handle this.\n        grouped_by_table_cols = getattr(self.keys, 'meta', {}).get('grouped_by_table_cols', False)\n        return self.keys.colnames if grouped_by_table_cols else ()"},{"col":4,"comment":"null","endLoc":329,"header":"@property\n    def indices(self)","id":9324,"name":"indices","nodeType":"Function","startLoc":324,"text":"@property\n    def indices(self):\n        if self._indices is None:\n            return np.array([0, len(self.parent_table)])\n        else:\n            return self._indices"},{"className":"SortedArray","col":0,"comment":"\n    Implements a sorted array container using\n    a list of numpy arrays.\n\n    Parameters\n    ----------\n    data : Table\n        Sorted columns of the original table\n    row_index : Column object\n        Row numbers corresponding to data columns\n    unique : bool\n        Whether the values of the index must be unique.\n        Defaults to False.\n    ","endLoc":311,"id":9325,"nodeType":"Class","startLoc":28,"text":"class SortedArray:\n    '''\n    Implements a sorted array container using\n    a list of numpy arrays.\n\n    Parameters\n    ----------\n    data : Table\n        Sorted columns of the original table\n    row_index : Column object\n        Row numbers corresponding to data columns\n    unique : bool\n        Whether the values of the index must be unique.\n        Defaults to False.\n    '''\n\n    def __init__(self, data, row_index, unique=False):\n        self.data = data\n        self.row_index = row_index\n        self.num_cols = len(getattr(data, 'colnames', []))\n        self.unique = unique\n\n    @property\n    def cols(self):\n        return list(self.data.columns.values())\n\n    def add(self, key, row):\n        '''\n        Add a new entry to the sorted array.\n\n        Parameters\n        ----------\n        key : tuple\n            Column values at the given row\n        row : int\n            Row number\n        '''\n        pos = self.find_pos(key, row)  # first >= key\n\n        if self.unique and 0 <= pos < len(self.row_index) and \\\n           all(self.data[pos][i] == key[i] for i in range(len(key))):\n            # already exists\n            raise ValueError(f'Cannot add duplicate value \"{key}\" in a unique index')\n        self.data.insert_row(pos, key)\n        self.row_index = self.row_index.insert(pos, row)\n\n    def _get_key_slice(self, i, begin, end):\n        '''\n        Retrieve the ith slice of the sorted array\n        from begin to end.\n        '''\n        if i < self.num_cols:\n            return self.cols[i][begin:end]\n        else:\n            return self.row_index[begin:end]\n\n    def find_pos(self, key, data, exact=False):\n        '''\n        Return the index of the largest key in data greater than or\n        equal to the given key, data pair.\n\n        Parameters\n        ----------\n        key : tuple\n            Column key\n        data : int\n            Row number\n        exact : bool\n            If True, return the index of the given key in data\n            or -1 if the key is not present.\n        '''\n        begin = 0\n        end = len(self.row_index)\n        num_cols = self.num_cols\n        if not self.unique:\n            # consider the row value as well\n            key = key + (data,)\n            num_cols += 1\n\n        # search through keys in lexicographic order\n        for i in range(num_cols):\n            key_slice = self._get_key_slice(i, begin, end)\n            t = _searchsorted(key_slice, key[i])\n            # t is the smallest index >= key[i]\n            if exact and (t == len(key_slice) or key_slice[t] != key[i]):\n                # no match\n                return -1\n            elif t == len(key_slice) or (t == 0 and len(key_slice) > 0\n                                         and key[i] < key_slice[0]):\n                # too small or too large\n                return begin + t\n            end = begin + _searchsorted(key_slice, key[i], side='right')\n            begin += t\n            if begin >= len(self.row_index):  # greater than all keys\n                return begin\n\n        return begin\n\n    def find(self, key):\n        '''\n        Find all rows matching the given key.\n\n        Parameters\n        ----------\n        key : tuple\n            Column values\n\n        Returns\n        -------\n        matching_rows : list\n            List of rows matching the input key\n        '''\n        begin = 0\n        end = len(self.row_index)\n\n        # search through keys in lexicographic order\n        for i in range(self.num_cols):\n            key_slice = self._get_key_slice(i, begin, end)\n            t = _searchsorted(key_slice, key[i])\n            # t is the smallest index >= key[i]\n            if t == len(key_slice) or key_slice[t] != key[i]:\n                # no match\n                return []\n            elif t == 0 and len(key_slice) > 0 and key[i] < key_slice[0]:\n                # too small or too large\n                return []\n            end = begin + _searchsorted(key_slice, key[i], side='right')\n            begin += t\n            if begin >= len(self.row_index):  # greater than all keys\n                return []\n\n        return self.row_index[begin:end]\n\n    def range(self, lower, upper, bounds):\n        '''\n        Find values in the given range.\n\n        Parameters\n        ----------\n        lower : tuple\n            Lower search bound\n        upper : tuple\n            Upper search bound\n        bounds : (2,) tuple of bool\n            Indicates whether the search should be inclusive or\n            exclusive with respect to the endpoints. The first\n            argument corresponds to an inclusive lower bound,\n            and the second argument to an inclusive upper bound.\n        '''\n        lower_pos = self.find_pos(lower, 0)\n        upper_pos = self.find_pos(upper, 0)\n        if lower_pos == len(self.row_index):\n            return []\n\n        lower_bound = tuple([col[lower_pos] for col in self.cols])\n        if not bounds[0] and lower_bound == lower:\n            lower_pos += 1  # data[lower_pos] > lower\n\n        # data[lower_pos] >= lower\n        # data[upper_pos] >= upper\n        if upper_pos < len(self.row_index):\n            upper_bound = tuple([col[upper_pos] for col in self.cols])\n            if not bounds[1] and upper_bound == upper:\n                upper_pos -= 1  # data[upper_pos] < upper\n            elif upper_bound > upper:\n                upper_pos -= 1  # data[upper_pos] <= upper\n        return self.row_index[lower_pos:upper_pos + 1]\n\n    def remove(self, key, data):\n        '''\n        Remove the given entry from the sorted array.\n\n        Parameters\n        ----------\n        key : tuple\n            Column values\n        data : int\n            Row number\n\n        Returns\n        -------\n        successful : bool\n            Whether the entry was successfully removed\n        '''\n        pos = self.find_pos(key, data, exact=True)\n        if pos == -1:  # key not found\n            return False\n\n        self.data.remove_row(pos)\n        keep_mask = np.ones(len(self.row_index), dtype=bool)\n        keep_mask[pos] = False\n        self.row_index = self.row_index[keep_mask]\n        return True\n\n    def shift_left(self, row):\n        '''\n        Decrement all row numbers greater than the input row.\n\n        Parameters\n        ----------\n        row : int\n            Input row number\n        '''\n        self.row_index[self.row_index > row] -= 1\n\n    def shift_right(self, row):\n        '''\n        Increment all row numbers greater than or equal to the input row.\n\n        Parameters\n        ----------\n        row : int\n            Input row number\n        '''\n        self.row_index[self.row_index >= row] += 1\n\n    def replace_rows(self, row_map):\n        '''\n        Replace all rows with the values they map to in the\n        given dictionary. Any rows not present as keys in\n        the dictionary will have their entries deleted.\n\n        Parameters\n        ----------\n        row_map : dict\n            Mapping of row numbers to new row numbers\n        '''\n        num_rows = len(row_map)\n        keep_rows = np.zeros(len(self.row_index), dtype=bool)\n        tagged = 0\n        for i, row in enumerate(self.row_index):\n            if row in row_map:\n                keep_rows[i] = True\n                tagged += 1\n                if tagged == num_rows:\n                    break\n\n        self.data = self.data[keep_rows]\n        self.row_index = np.array(\n            [row_map[x] for x in self.row_index[keep_rows]])\n\n    def items(self):\n        '''\n        Retrieve all array items as a list of pairs of the form\n        [(key, [row 1, row 2, ...]), ...]\n        '''\n        array = []\n        last_key = None\n        for i, key in enumerate(zip(*self.data.columns.values())):\n            row = self.row_index[i]\n            if key == last_key:\n                array[-1][1].append(row)\n            else:\n                last_key = key\n                array.append((key, [row]))\n        return array\n\n    def sort(self):\n        '''\n        Make row order align with key order.\n        '''\n        self.row_index = np.arange(len(self.row_index))\n\n    def sorted_data(self):\n        '''\n        Return rows in sorted order.\n        '''\n        return self.row_index\n\n    def __getitem__(self, item):\n        '''\n        Return a sliced reference to this sorted array.\n\n        Parameters\n        ----------\n        item : slice\n            Slice to use for referencing\n        '''\n        return SortedArray(self.data[item], self.row_index[item])\n\n    def __repr__(self):\n        t = self.data.copy()\n        t['rows'] = self.row_index\n        return f'<{self.__class__.__name__} length={len(t)}>\\n{t}'"},{"col":4,"comment":"\n        Aggregate each group in the Table into a single row by applying the reduction\n        function ``func`` to group values in each column.\n\n        Parameters\n        ----------\n        func : function\n            Function that reduces an array of values to a single value\n\n        Returns\n        -------\n        out : Table\n            New table with the aggregated rows.\n        ","endLoc":364,"header":"def aggregate(self, func)","id":9326,"name":"aggregate","nodeType":"Function","startLoc":331,"text":"def aggregate(self, func):\n        \"\"\"\n        Aggregate each group in the Table into a single row by applying the reduction\n        function ``func`` to group values in each column.\n\n        Parameters\n        ----------\n        func : function\n            Function that reduces an array of values to a single value\n\n        Returns\n        -------\n        out : Table\n            New table with the aggregated rows.\n        \"\"\"\n\n        i0s = self.indices[:-1]\n        out_cols = []\n        parent_table = self.parent_table\n\n        for col in parent_table.columns.values():\n            # For key columns just pick off first in each group since they are identical\n            if col.info.name in self.key_colnames:\n                new_col = col.take(i0s)\n            else:\n                try:\n                    new_col = col.groups.aggregate(func)\n                except TypeError as err:\n                    warnings.warn(str(err), AstropyUserWarning)\n                    continue\n\n            out_cols.append(new_col)\n\n        return parent_table.__class__(out_cols, meta=parent_table.meta)"},{"col":4,"comment":"null","endLoc":48,"header":"def __init__(self, data, row_index, unique=False)","id":9327,"name":"__init__","nodeType":"Function","startLoc":44,"text":"def __init__(self, data, row_index, unique=False):\n        self.data = data\n        self.row_index = row_index\n        self.num_cols = len(getattr(data, 'colnames', []))\n        self.unique = unique"},{"col":4,"comment":"null","endLoc":52,"header":"@property\n    def cols(self)","id":9328,"name":"cols","nodeType":"Function","startLoc":50,"text":"@property\n    def cols(self):\n        return list(self.data.columns.values())"},{"col":4,"comment":"\n        Return a list of arrays which can be lexically sorted to represent\n        the order of the parent column.\n\n        For Quantity this is just the quantity itself.\n\n\n        Returns\n        -------\n        arrays : list of ndarray\n        ","endLoc":236,"header":"def get_sortable_arrays(self)","id":9330,"name":"get_sortable_arrays","nodeType":"Function","startLoc":224,"text":"def get_sortable_arrays(self):\n        \"\"\"\n        Return a list of arrays which can be lexically sorted to represent\n        the order of the parent column.\n\n        For Quantity this is just the quantity itself.\n\n\n        Returns\n        -------\n        arrays : list of ndarray\n        \"\"\"\n        return [self._parent]"},{"attributeType":"null","col":4,"comment":"null","endLoc":172,"id":9331,"name":"_represent_as_dict_attrs","nodeType":"Attribute","startLoc":172,"text":"_represent_as_dict_attrs"},{"attributeType":"null","col":4,"comment":"null","endLoc":173,"id":9332,"name":"_construct_from_dict_args","nodeType":"Attribute","startLoc":173,"text":"_construct_from_dict_args"},{"attributeType":"null","col":4,"comment":"null","endLoc":174,"id":9333,"name":"_represent_as_dict_primary_data","nodeType":"Attribute","startLoc":174,"text":"_represent_as_dict_primary_data"},{"className":"MetaData","col":0,"comment":"\n    A descriptor for classes that have a ``meta`` property.\n\n    This can be set to any valid `~collections.abc.Mapping`.\n\n    Parameters\n    ----------\n    doc : `str`, optional\n        Documentation for the attribute of the class.\n        Default is ``\"\"``.\n\n        .. versionadded:: 1.2\n\n    copy : `bool`, optional\n        If ``True`` the the value is deepcopied before setting, otherwise it\n        is saved as reference.\n        Default is ``True``.\n\n        .. versionadded:: 1.2\n    ","endLoc":414,"id":9334,"nodeType":"Class","startLoc":371,"text":"class MetaData:\n    \"\"\"\n    A descriptor for classes that have a ``meta`` property.\n\n    This can be set to any valid `~collections.abc.Mapping`.\n\n    Parameters\n    ----------\n    doc : `str`, optional\n        Documentation for the attribute of the class.\n        Default is ``\"\"``.\n\n        .. versionadded:: 1.2\n\n    copy : `bool`, optional\n        If ``True`` the the value is deepcopied before setting, otherwise it\n        is saved as reference.\n        Default is ``True``.\n\n        .. versionadded:: 1.2\n    \"\"\"\n\n    def __init__(self, doc=\"\", copy=True):\n        self.__doc__ = doc\n        self.copy = copy\n\n    def __get__(self, instance, owner):\n        if instance is None:\n            return self\n        if not hasattr(instance, '_meta'):\n            instance._meta = OrderedDict()\n        return instance._meta\n\n    def __set__(self, instance, value):\n        if value is None:\n            instance._meta = OrderedDict()\n        else:\n            if isinstance(value, Mapping):\n                if self.copy:\n                    instance._meta = deepcopy(value)\n                else:\n                    instance._meta = value\n            else:\n                raise TypeError(\"meta attribute must be dict-like\")"},{"col":4,"comment":"null","endLoc":395,"header":"def __init__(self, doc=\"\", copy=True)","id":9335,"name":"__init__","nodeType":"Function","startLoc":393,"text":"def __init__(self, doc=\"\", copy=True):\n        self.__doc__ = doc\n        self.copy = copy"},{"col":4,"comment":"null","endLoc":402,"header":"def __get__(self, instance, owner)","id":9336,"name":"__get__","nodeType":"Function","startLoc":397,"text":"def __get__(self, instance, owner):\n        if instance is None:\n            return self\n        if not hasattr(instance, '_meta'):\n            instance._meta = OrderedDict()\n        return instance._meta"},{"col":4,"comment":"null","endLoc":414,"header":"def __set__(self, instance, value)","id":9337,"name":"__set__","nodeType":"Function","startLoc":404,"text":"def __set__(self, instance, value):\n        if value is None:\n            instance._meta = OrderedDict()\n        else:\n            if isinstance(value, Mapping):\n                if self.copy:\n                    instance._meta = deepcopy(value)\n                else:\n                    instance._meta = value\n            else:\n                raise TypeError(\"meta attribute must be dict-like\")"},{"attributeType":"null","col":8,"comment":"null","endLoc":394,"id":9338,"name":"__doc__","nodeType":"Attribute","startLoc":394,"text":"self.__doc__"},{"attributeType":"null","col":8,"comment":"null","endLoc":395,"id":9339,"name":"copy","nodeType":"Attribute","startLoc":395,"text":"self.copy"},{"className":"MetaAttribute","col":0,"comment":"\n    Descriptor to define custom attribute which gets stored in the object\n    ``meta`` dict and can have a defined default.\n\n    This descriptor is intended to provide a convenient way to add attributes\n    to a subclass of a complex class such as ``Table`` or ``NDData``.\n\n    This requires that the object has an attribute ``meta`` which is a\n    dict-like object.  The value of the MetaAttribute will be stored in a\n    new dict meta['__attributes__'] that is created when required.\n\n    Classes that define MetaAttributes are encouraged to support initializing\n    the attributes via the class ``__init__``.  For example::\n\n        for attr in list(kwargs):\n            descr = getattr(self.__class__, attr, None)\n            if isinstance(descr, MetaAttribute):\n                setattr(self, attr, kwargs.pop(attr))\n\n    The name of a ``MetaAttribute`` cannot be the same as any of the following:\n\n    - Keyword argument in the owner class ``__init__``\n    - Method or attribute of the \"parent class\", where the parent class is\n      taken to be ``owner.__mro__[1]``.\n\n    :param default: default value\n\n    ","endLoc":502,"id":9340,"nodeType":"Class","startLoc":417,"text":"class MetaAttribute:\n    \"\"\"\n    Descriptor to define custom attribute which gets stored in the object\n    ``meta`` dict and can have a defined default.\n\n    This descriptor is intended to provide a convenient way to add attributes\n    to a subclass of a complex class such as ``Table`` or ``NDData``.\n\n    This requires that the object has an attribute ``meta`` which is a\n    dict-like object.  The value of the MetaAttribute will be stored in a\n    new dict meta['__attributes__'] that is created when required.\n\n    Classes that define MetaAttributes are encouraged to support initializing\n    the attributes via the class ``__init__``.  For example::\n\n        for attr in list(kwargs):\n            descr = getattr(self.__class__, attr, None)\n            if isinstance(descr, MetaAttribute):\n                setattr(self, attr, kwargs.pop(attr))\n\n    The name of a ``MetaAttribute`` cannot be the same as any of the following:\n\n    - Keyword argument in the owner class ``__init__``\n    - Method or attribute of the \"parent class\", where the parent class is\n      taken to be ``owner.__mro__[1]``.\n\n    :param default: default value\n\n    \"\"\"\n    def __init__(self, default=None):\n        self.default = default\n\n    def __get__(self, instance, owner):\n        # When called without an instance, return self to allow access\n        # to descriptor attributes.\n        if instance is None:\n            return self\n\n        # If default is None and value has not been set already then return None\n        # without doing touching meta['__attributes__'] at all. This helps e.g.\n        # with the Table._hidden_columns attribute so it doesn't auto-create\n        # meta['__attributes__'] always.\n        if (self.default is None\n                and self.name not in instance.meta.get('__attributes__', {})):\n            return None\n\n        # Get the __attributes__ dict and create if not there already.\n        attributes = instance.meta.setdefault('__attributes__', {})\n        try:\n            value = attributes[self.name]\n        except KeyError:\n            if self.default is not None:\n                attributes[self.name] = deepcopy(self.default)\n            # Return either specified default or None\n            value = attributes.get(self.name)\n        return value\n\n    def __set__(self, instance, value):\n        # Get the __attributes__ dict and create if not there already.\n        attributes = instance.meta.setdefault('__attributes__', {})\n        attributes[self.name] = value\n\n    def __delete__(self, instance):\n        # Remove this attribute from meta['__attributes__'] if it exists.\n        if '__attributes__' in instance.meta:\n            attrs = instance.meta['__attributes__']\n            if self.name in attrs:\n                del attrs[self.name]\n            # If this was the last attribute then remove the meta key as well\n            if not attrs:\n                del instance.meta['__attributes__']\n\n    def __set_name__(self, owner, name):\n        import inspect\n        params = [param.name for param in inspect.signature(owner).parameters.values()\n                  if param.kind not in (inspect.Parameter.VAR_KEYWORD,\n                                        inspect.Parameter.VAR_POSITIONAL)]\n\n        # Reject names from existing params or best guess at parent class\n        if name in params or hasattr(owner.__mro__[1], name):\n            raise ValueError(f'{name} not allowed as {self.__class__.__name__}')\n\n        self.name = name\n\n    def __repr__(self):\n        return f'<{self.__class__.__name__} name={self.name} default={self.default}>'"},{"col":4,"comment":"null","endLoc":447,"header":"def __init__(self, default=None)","id":9341,"name":"__init__","nodeType":"Function","startLoc":446,"text":"def __init__(self, default=None):\n        self.default = default"},{"col":4,"comment":"null","endLoc":472,"header":"def __get__(self, instance, owner)","id":9342,"name":"__get__","nodeType":"Function","startLoc":449,"text":"def __get__(self, instance, owner):\n        # When called without an instance, return self to allow access\n        # to descriptor attributes.\n        if instance is None:\n            return self\n\n        # If default is None and value has not been set already then return None\n        # without doing touching meta['__attributes__'] at all. This helps e.g.\n        # with the Table._hidden_columns attribute so it doesn't auto-create\n        # meta['__attributes__'] always.\n        if (self.default is None\n                and self.name not in instance.meta.get('__attributes__', {})):\n            return None\n\n        # Get the __attributes__ dict and create if not there already.\n        attributes = instance.meta.setdefault('__attributes__', {})\n        try:\n            value = attributes[self.name]\n        except KeyError:\n            if self.default is not None:\n                attributes[self.name] = deepcopy(self.default)\n            # Return either specified default or None\n            value = attributes.get(self.name)\n        return value"},{"col":4,"comment":"\n        Add a new entry to the sorted array.\n\n        Parameters\n        ----------\n        key : tuple\n            Column values at the given row\n        row : int\n            Row number\n        ","endLoc":72,"header":"def add(self, key, row)","id":9343,"name":"add","nodeType":"Function","startLoc":54,"text":"def add(self, key, row):\n        '''\n        Add a new entry to the sorted array.\n\n        Parameters\n        ----------\n        key : tuple\n            Column values at the given row\n        row : int\n            Row number\n        '''\n        pos = self.find_pos(key, row)  # first >= key\n\n        if self.unique and 0 <= pos < len(self.row_index) and \\\n           all(self.data[pos][i] == key[i] for i in range(len(key))):\n            # already exists\n            raise ValueError(f'Cannot add duplicate value \"{key}\" in a unique index')\n        self.data.insert_row(pos, key)\n        self.row_index = self.row_index.insert(pos, row)"},{"col":4,"comment":"null","endLoc":477,"header":"def __set__(self, instance, value)","id":9344,"name":"__set__","nodeType":"Function","startLoc":474,"text":"def __set__(self, instance, value):\n        # Get the __attributes__ dict and create if not there already.\n        attributes = instance.meta.setdefault('__attributes__', {})\n        attributes[self.name] = value"},{"col":4,"comment":"null","endLoc":487,"header":"def __delete__(self, instance)","id":9345,"name":"__delete__","nodeType":"Function","startLoc":479,"text":"def __delete__(self, instance):\n        # Remove this attribute from meta['__attributes__'] if it exists.\n        if '__attributes__' in instance.meta:\n            attrs = instance.meta['__attributes__']\n            if self.name in attrs:\n                del attrs[self.name]\n            # If this was the last attribute then remove the meta key as well\n            if not attrs:\n                del instance.meta['__attributes__']"},{"col":4,"comment":"null","endLoc":499,"header":"def __set_name__(self, owner, name)","id":9346,"name":"__set_name__","nodeType":"Function","startLoc":489,"text":"def __set_name__(self, owner, name):\n        import inspect\n        params = [param.name for param in inspect.signature(owner).parameters.values()\n                  if param.kind not in (inspect.Parameter.VAR_KEYWORD,\n                                        inspect.Parameter.VAR_POSITIONAL)]\n\n        # Reject names from existing params or best guess at parent class\n        if name in params or hasattr(owner.__mro__[1], name):\n            raise ValueError(f'{name} not allowed as {self.__class__.__name__}')\n\n        self.name = name"},{"col":4,"comment":"null","endLoc":502,"header":"def __repr__(self)","id":9347,"name":"__repr__","nodeType":"Function","startLoc":501,"text":"def __repr__(self):\n        return f'<{self.__class__.__name__} name={self.name} default={self.default}>'"},{"attributeType":"null","col":8,"comment":"null","endLoc":447,"id":9348,"name":"default","nodeType":"Attribute","startLoc":447,"text":"self.default"},{"attributeType":"null","col":8,"comment":"null","endLoc":499,"id":9349,"name":"name","nodeType":"Attribute","startLoc":499,"text":"self.name"},{"className":"FalseArray","col":0,"comment":"\n    Boolean mask array that is always False.\n\n    This is used to create a stub ``mask`` property which is a boolean array of\n    ``False`` used by default for mixin columns and corresponding to the mixin\n    column data shape.  The ``mask`` looks like a normal numpy array but an\n    exception will be raised if ``True`` is assigned to any element.  The\n    consequences of the limitation are most obvious in the high-level table\n    operations.\n\n    Parameters\n    ----------\n    shape : tuple\n        Data shape\n    ","endLoc":114,"id":9350,"nodeType":"Class","startLoc":90,"text":"class FalseArray(np.ndarray):\n    \"\"\"\n    Boolean mask array that is always False.\n\n    This is used to create a stub ``mask`` property which is a boolean array of\n    ``False`` used by default for mixin columns and corresponding to the mixin\n    column data shape.  The ``mask`` looks like a normal numpy array but an\n    exception will be raised if ``True`` is assigned to any element.  The\n    consequences of the limitation are most obvious in the high-level table\n    operations.\n\n    Parameters\n    ----------\n    shape : tuple\n        Data shape\n    \"\"\"\n    def __new__(cls, shape):\n        obj = np.zeros(shape, dtype=bool).view(cls)\n        return obj\n\n    def __setitem__(self, item, val):\n        val = np.asarray(val)\n        if np.any(val):\n            raise ValueError('Cannot set any element of {} class to True'\n                             .format(self.__class__.__name__))"},{"col":4,"comment":"null","endLoc":114,"header":"def __setitem__(self, item, val)","id":9351,"name":"__setitem__","nodeType":"Function","startLoc":110,"text":"def __setitem__(self, item, val):\n        val = np.asarray(val)\n        if np.any(val):\n            raise ValueError('Cannot set any element of {} class to True'\n                             .format(self.__class__.__name__))"},{"col":4,"comment":"\n        Filter groups in the Table based on evaluating function ``func`` on each\n        group sub-table.\n\n        The function which is passed to this method must accept two arguments:\n\n        - ``table`` : `Table` object\n        - ``key_colnames`` : tuple of column names in ``table`` used as keys for grouping\n\n        It must then return either `True` or `False`.  As an example, the following\n        will select all table groups with only positive values in the non-key columns::\n\n          def all_positive(table, key_colnames):\n              colnames = [name for name in table.colnames if name not in key_colnames]\n              for colname in colnames:\n                  if np.any(table[colname] < 0):\n                      return False\n              return True\n\n        Parameters\n        ----------\n        func : function\n            Filter function\n\n        Returns\n        -------\n        out : Table\n            New table with the aggregated rows.\n        ","endLoc":401,"header":"def filter(self, func)","id":9352,"name":"filter","nodeType":"Function","startLoc":366,"text":"def filter(self, func):\n        \"\"\"\n        Filter groups in the Table based on evaluating function ``func`` on each\n        group sub-table.\n\n        The function which is passed to this method must accept two arguments:\n\n        - ``table`` : `Table` object\n        - ``key_colnames`` : tuple of column names in ``table`` used as keys for grouping\n\n        It must then return either `True` or `False`.  As an example, the following\n        will select all table groups with only positive values in the non-key columns::\n\n          def all_positive(table, key_colnames):\n              colnames = [name for name in table.colnames if name not in key_colnames]\n              for colname in colnames:\n                  if np.any(table[colname] < 0):\n                      return False\n              return True\n\n        Parameters\n        ----------\n        func : function\n            Filter function\n\n        Returns\n        -------\n        out : Table\n            New table with the aggregated rows.\n        \"\"\"\n        mask = np.empty(len(self), dtype=bool)\n        key_colnames = self.key_colnames\n        for i, group_table in enumerate(self):\n            mask[i] = func(group_table, key_colnames)\n\n        return self[mask]"},{"attributeType":"null","col":8,"comment":"null","endLoc":107,"id":9353,"name":"obj","nodeType":"Attribute","startLoc":107,"text":"obj"},{"className":"TableInfo","col":0,"comment":"null","endLoc":123,"id":9354,"nodeType":"Class","startLoc":119,"text":"class TableInfo(DataInfo):\n    def __call__(self, option='attributes', out=''):\n        return table_info(self._parent, option, out)\n\n    __call__.__doc__ = table_info.__doc__"},{"col":4,"comment":"null","endLoc":121,"header":"def __call__(self, option='attributes', out='')","id":9355,"name":"__call__","nodeType":"Function","startLoc":120,"text":"def __call__(self, option='attributes', out=''):\n        return table_info(self._parent, option, out)"},{"col":4,"comment":"null","endLoc":405,"header":"@property\n    def keys(self)","id":9356,"name":"keys","nodeType":"Function","startLoc":403,"text":"@property\n    def keys(self):\n        return self._keys"},{"attributeType":"null","col":8,"comment":"null","endLoc":308,"id":9357,"name":"parent_table","nodeType":"Attribute","startLoc":308,"text":"self.parent_table"},{"attributeType":"null","col":8,"comment":"null","endLoc":309,"id":9358,"name":"_indices","nodeType":"Attribute","startLoc":309,"text":"self._indices"},{"attributeType":"null","col":8,"comment":"null","endLoc":310,"id":9359,"name":"_keys","nodeType":"Attribute","startLoc":310,"text":"self._keys"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":9360,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"groups.py#<anonymous>","id":9361,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['TableGroups', 'ColumnGroups']"},{"fileName":"index.py","filePath":"astropy/table","id":9362,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThe Index class can use several implementations as its\nengine. Any implementation should implement the following:\n\n__init__(data, row_index) : initialize index based on key/row list pairs\nadd(key, row) -> None : add (key, row) to existing data\nremove(key, data=None) -> boolean : remove data from self[key], or all of\n                                    self[key] if data is None\nshift_left(row) -> None : decrement row numbers after row\nshift_right(row) -> None : increase row numbers >= row\nfind(key) -> list : list of rows corresponding to key\nrange(lower, upper, bounds) -> list : rows in self[k] where k is between\n                               lower and upper (<= or < based on bounds)\nsort() -> None : make row order align with key order\nsorted_data() -> list of rows in sorted order (by key)\nreplace_rows(row_map) -> None : replace row numbers based on slice\nitems() -> list of tuples of the form (key, data)\n\nNotes\n-----\n    When a Table is initialized from another Table, indices are\n    (deep) copied and their columns are set to the columns of the new Table.\n\n    Column creation:\n    Column(c) -> deep copy of indices\n    c[[1, 2]] -> deep copy and reordering of indices\n    c[1:2] -> reference\n    array.view(Column) -> no indices\n\"\"\"\n\nfrom copy import deepcopy\nimport numpy as np\n\nfrom .bst import MinValue, MaxValue\nfrom .sorted_array import SortedArray\n\n\nclass QueryError(ValueError):\n    '''\n    Indicates that a given index cannot handle the supplied query.\n    '''\n    pass\n\n\nclass Index:\n    '''\n    The Index class makes it possible to maintain indices\n    on columns of a Table, so that column values can be queried\n    quickly and efficiently. Column values are stored in lexicographic\n    sorted order, which allows for binary searching in O(log n).\n\n    Parameters\n    ----------\n    columns : list or None\n        List of columns on which to create an index. If None,\n        create an empty index for purposes of deep copying.\n    engine : type, instance, or None\n        Indexing engine class to use (from among SortedArray, BST,\n        and SCEngine) or actual engine instance.\n        If the supplied argument is None (by default), use SortedArray.\n    unique : bool (defaults to False)\n        Whether the values of the index must be unique\n    '''\n    def __init__(self, columns, engine=None, unique=False):\n        # Local imports to avoid import problems.\n        from .table import Table, Column\n        from astropy.time import Time\n\n        if columns is not None:\n            columns = list(columns)\n\n        if engine is not None and not isinstance(engine, type):\n            # create from data\n            self.engine = engine.__class__\n            self.data = engine\n            self.columns = columns\n            return\n\n        # by default, use SortedArray\n        self.engine = engine or SortedArray\n\n        if columns is None:  # this creates a special exception for deep copying\n            columns = []\n            data = []\n            row_index = []\n        elif len(columns) == 0:\n            raise ValueError(\"Cannot create index without at least one column\")\n        elif len(columns) == 1:\n            col = columns[0]\n            row_index = Column(col.argsort())\n            data = Table([col[row_index]])\n        else:\n            num_rows = len(columns[0])\n\n            # replace Time columns with approximate form and remainder\n            new_columns = []\n            for col in columns:\n                if isinstance(col, Time):\n                    new_columns.append(col.jd)\n                    remainder = col - col.__class__(col.jd, format='jd', scale=col.scale)\n                    new_columns.append(remainder.jd)\n                else:\n                    new_columns.append(col)\n\n            # sort the table lexicographically and keep row numbers\n            table = Table(columns + [np.arange(num_rows)], copy_indices=False)\n            sort_columns = new_columns[::-1]\n            try:\n                lines = table[np.lexsort(sort_columns)]\n            except TypeError:  # arbitrary mixins might not work with lexsort\n                lines = table[table.argsort()]\n            data = lines[lines.colnames[:-1]]\n            row_index = lines[lines.colnames[-1]]\n\n        self.data = self.engine(data, row_index, unique=unique)\n        self.columns = columns\n\n    def __len__(self):\n        '''\n        Number of rows in index.\n        '''\n        return len(self.columns[0])\n\n    def replace_col(self, prev_col, new_col):\n        '''\n        Replace an indexed column with an updated reference.\n\n        Parameters\n        ----------\n        prev_col : Column\n            Column reference to replace\n        new_col : Column\n            New column reference\n        '''\n        self.columns[self.col_position(prev_col.info.name)] = new_col\n\n    def reload(self):\n        '''\n        Recreate the index based on data in self.columns.\n        '''\n        self.__init__(self.columns, engine=self.engine)\n\n    def col_position(self, col_name):\n        '''\n        Return the position of col_name in self.columns.\n\n        Parameters\n        ----------\n        col_name : str\n            Name of column to look up\n        '''\n        for i, c in enumerate(self.columns):\n            if c.info.name == col_name:\n                return i\n        raise ValueError(f\"Column does not belong to index: {col_name}\")\n\n    def insert_row(self, pos, vals, columns):\n        '''\n        Insert a new row from the given values.\n\n        Parameters\n        ----------\n        pos : int\n            Position at which to insert row\n        vals : list or tuple\n            List of values to insert into a new row\n        columns : list\n            Table column references\n        '''\n        key = [None] * len(self.columns)\n        for i, col in enumerate(columns):\n            try:\n                key[self.col_position(col.info.name)] = vals[i]\n            except ValueError:  # not a member of index\n                continue\n        num_rows = len(self.columns[0])\n        if pos < num_rows:\n            # shift all rows >= pos to the right\n            self.data.shift_right(pos)\n        self.data.add(tuple(key), pos)\n\n    def get_row_specifier(self, row_specifier):\n        '''\n        Return an iterable corresponding to the\n        input row specifier.\n\n        Parameters\n        ----------\n        row_specifier : int, list, ndarray, or slice\n        '''\n        if isinstance(row_specifier, (int, np.integer)):\n            # single row\n            return (row_specifier,)\n        elif isinstance(row_specifier, (list, np.ndarray)):\n            return row_specifier\n        elif isinstance(row_specifier, slice):\n            col_len = len(self.columns[0])\n            return range(*row_specifier.indices(col_len))\n        raise ValueError(\"Expected int, array of ints, or slice but \"\n                         \"got {} in remove_rows\".format(row_specifier))\n\n    def remove_rows(self, row_specifier):\n        '''\n        Remove the given rows from the index.\n\n        Parameters\n        ----------\n        row_specifier : int, list, ndarray, or slice\n            Indicates which row(s) to remove\n        '''\n        rows = []\n\n        # To maintain the correct row order, we loop twice,\n        # deleting rows first and then reordering the remaining rows\n        for row in self.get_row_specifier(row_specifier):\n            self.remove_row(row, reorder=False)\n            rows.append(row)\n        # second pass - row order is reversed to maintain\n        # correct row numbers\n        for row in reversed(sorted(rows)):\n            self.data.shift_left(row)\n\n    def remove_row(self, row, reorder=True):\n        '''\n        Remove the given row from the index.\n\n        Parameters\n        ----------\n        row : int\n            Position of row to remove\n        reorder : bool\n            Whether to reorder indices after removal\n        '''\n        # for removal, form a key consisting of column values in this row\n        if not self.data.remove(tuple([col[row] for col in self.columns]), row):\n            raise ValueError(f\"Could not remove row {row} from index\")\n        # decrement the row number of all later rows\n        if reorder:\n            self.data.shift_left(row)\n\n    def find(self, key):\n        '''\n        Return the row values corresponding to key, in sorted order.\n\n        Parameters\n        ----------\n        key : tuple\n            Values to search for in each column\n        '''\n        return self.data.find(key)\n\n    def same_prefix(self, key):\n        '''\n        Return rows whose keys contain the supplied key as a prefix.\n\n        Parameters\n        ----------\n        key : tuple\n            Prefix for which to search\n        '''\n        return self.same_prefix_range(key, key, (True, True))\n\n    def same_prefix_range(self, lower, upper, bounds=(True, True)):\n        '''\n        Return rows whose keys have a prefix in the given range.\n\n        Parameters\n        ----------\n        lower : tuple\n            Lower prefix bound\n        upper : tuple\n            Upper prefix bound\n        bounds : tuple (x, y) of bools\n            Indicates whether the search should be inclusive or\n            exclusive with respect to the endpoints. The first\n            argument x corresponds to an inclusive lower bound,\n            and the second argument y to an inclusive upper bound.\n        '''\n        n = len(lower)\n        ncols = len(self.columns)\n        a = MinValue() if bounds[0] else MaxValue()\n        b = MaxValue() if bounds[1] else MinValue()\n        # [x, y] search corresponds to [(x, min), (y, max)]\n        # (x, y) search corresponds to ((x, max), (x, min))\n        lower = lower + tuple((ncols - n) * [a])\n        upper = upper + tuple((ncols - n) * [b])\n        return self.data.range(lower, upper, bounds)\n\n    def range(self, lower, upper, bounds=(True, True)):\n        '''\n        Return rows within the given range.\n\n        Parameters\n        ----------\n        lower : tuple\n            Lower prefix bound\n        upper : tuple\n            Upper prefix bound\n        bounds : tuple (x, y) of bools\n            Indicates whether the search should be inclusive or\n            exclusive with respect to the endpoints. The first\n            argument x corresponds to an inclusive lower bound,\n            and the second argument y to an inclusive upper bound.\n        '''\n        return self.data.range(lower, upper, bounds)\n\n    def replace(self, row, col_name, val):\n        '''\n        Replace the value of a column at a given position.\n\n        Parameters\n        ----------\n        row : int\n            Row number to modify\n        col_name : str\n            Name of the Column to modify\n        val : col.info.dtype\n            Value to insert at specified row of col\n        '''\n        self.remove_row(row, reorder=False)\n        key = [c[row] for c in self.columns]\n        key[self.col_position(col_name)] = val\n        self.data.add(tuple(key), row)\n\n    def replace_rows(self, col_slice):\n        '''\n        Modify rows in this index to agree with the specified\n        slice. For example, given an index\n        {'5': 1, '2': 0, '3': 2} on a column ['2', '5', '3'],\n        an input col_slice of [2, 0] will result in the relabeling\n        {'3': 0, '2': 1} on the sliced column ['3', '2'].\n\n        Parameters\n        ----------\n        col_slice : list\n            Indices to slice\n        '''\n        row_map = dict((row, i) for i, row in enumerate(col_slice))\n        self.data.replace_rows(row_map)\n\n    def sort(self):\n        '''\n        Make row numbers follow the same sort order as the keys\n        of the index.\n        '''\n        self.data.sort()\n\n    def sorted_data(self):\n        '''\n        Returns a list of rows in sorted order based on keys;\n        essentially acts as an argsort() on columns.\n        '''\n        return self.data.sorted_data()\n\n    def __getitem__(self, item):\n        '''\n        Returns a sliced version of this index.\n\n        Parameters\n        ----------\n        item : slice\n            Input slice\n\n        Returns\n        -------\n        SlicedIndex\n            A sliced reference to this index.\n        '''\n        return SlicedIndex(self, item)\n\n    def __repr__(self):\n        col_names = tuple(col.info.name for col in self.columns)\n        return f'<{self.__class__.__name__} columns={col_names} data={self.data}>'\n\n    def __deepcopy__(self, memo):\n        '''\n        Return a deep copy of this index.\n\n        Notes\n        -----\n        The default deep copy must be overridden to perform\n        a shallow copy of the index columns, avoiding infinite recursion.\n\n        Parameters\n        ----------\n        memo : dict\n        '''\n        # Bypass Index.__new__ to create an actual Index, not a SlicedIndex.\n        index = super().__new__(self.__class__)\n        index.__init__(None, engine=self.engine)\n        index.data = deepcopy(self.data, memo)\n        index.columns = self.columns[:]  # new list, same columns\n        memo[id(self)] = index\n        return index\n\n\nclass SlicedIndex:\n    '''\n    This class provides a wrapper around an actual Index object\n    to make index slicing function correctly. Since numpy expects\n    array slices to provide an actual data view, a SlicedIndex should\n    retrieve data directly from the original index and then adapt\n    it to the sliced coordinate system as appropriate.\n\n    Parameters\n    ----------\n    index : Index\n        The original Index reference\n    index_slice : tuple, slice\n        The slice to which this SlicedIndex corresponds\n    original : bool\n        Whether this SlicedIndex represents the original index itself.\n        For the most part this is similar to index[:] but certain\n        copying operations are avoided, and the slice retains the\n        length of the actual index despite modification.\n    '''\n\n    def __init__(self, index, index_slice, original=False):\n        self.index = index\n        self.original = original\n        self._frozen = False\n\n        if isinstance(index_slice, tuple):\n            self.start, self._stop, self.step = index_slice\n        elif isinstance(index_slice, slice):  # index_slice is an actual slice\n            num_rows = len(index.columns[0])\n            self.start, self._stop, self.step = index_slice.indices(num_rows)\n        else:\n            raise TypeError('index_slice must be tuple or slice')\n\n    @property\n    def length(self):\n        return 1 + (self.stop - self.start - 1) // self.step\n\n    @property\n    def stop(self):\n        '''\n        The stopping position of the slice, or the end of the\n        index if this is an original slice.\n        '''\n        return len(self.index) if self.original else self._stop\n\n    def __getitem__(self, item):\n        '''\n        Returns another slice of this Index slice.\n\n        Parameters\n        ----------\n        item : slice\n            Index slice\n        '''\n        if self.length <= 0:\n            # empty slice\n            return SlicedIndex(self.index, slice(1, 0))\n        start, stop, step = item.indices(self.length)\n        new_start = self.orig_coords(start)\n        new_stop = self.orig_coords(stop)\n        new_step = self.step * step\n        return SlicedIndex(self.index, (new_start, new_stop, new_step))\n\n    def sliced_coords(self, rows):\n        '''\n        Convert the input rows to the sliced coordinate system.\n\n        Parameters\n        ----------\n        rows : list\n            Rows in the original coordinate system\n\n        Returns\n        -------\n        sliced_rows : list\n            Rows in the sliced coordinate system\n        '''\n        if self.original:\n            return rows\n        else:\n            rows = np.array(rows)\n            row0 = rows - self.start\n            if self.step != 1:\n                correct_mod = np.mod(row0, self.step) == 0\n                row0 = row0[correct_mod]\n            if self.step > 0:\n                ok = (row0 >= 0) & (row0 < self.stop - self.start)\n            else:\n                ok = (row0 <= 0) & (row0 > self.stop - self.start)\n            return row0[ok] // self.step\n\n    def orig_coords(self, row):\n        '''\n        Convert the input row from sliced coordinates back\n        to original coordinates.\n\n        Parameters\n        ----------\n        row : int\n            Row in the sliced coordinate system\n\n        Returns\n        -------\n        orig_row : int\n            Row in the original coordinate system\n        '''\n        return row if self.original else self.start + row * self.step\n\n    def find(self, key):\n        return self.sliced_coords(self.index.find(key))\n\n    def where(self, col_map):\n        return self.sliced_coords(self.index.where(col_map))\n\n    def range(self, lower, upper):\n        return self.sliced_coords(self.index.range(lower, upper))\n\n    def same_prefix(self, key):\n        return self.sliced_coords(self.index.same_prefix(key))\n\n    def sorted_data(self):\n        return self.sliced_coords(self.index.sorted_data())\n\n    def replace(self, row, col, val):\n        if not self._frozen:\n            self.index.replace(self.orig_coords(row), col, val)\n\n    def get_index_or_copy(self):\n        if not self.original:\n            # replace self.index with a new object reference\n            self.index = deepcopy(self.index)\n        return self.index\n\n    def insert_row(self, pos, vals, columns):\n        if not self._frozen:\n            self.get_index_or_copy().insert_row(self.orig_coords(pos), vals, columns)\n\n    def get_row_specifier(self, row_specifier):\n        return [self.orig_coords(x) for x in\n                self.index.get_row_specifier(row_specifier)]\n\n    def remove_rows(self, row_specifier):\n        if not self._frozen:\n            self.get_index_or_copy().remove_rows(row_specifier)\n\n    def replace_rows(self, col_slice):\n        if not self._frozen:\n            self.index.replace_rows([self.orig_coords(x) for x in col_slice])\n\n    def sort(self):\n        if not self._frozen:\n            self.get_index_or_copy().sort()\n\n    def __repr__(self):\n        slice_str = '' if self.original else f' slice={self.start}:{self.stop}:{self.step}'\n        return (f'<{self.__class__.__name__} original={self.original}{slice_str}'\n                f' index={self.index}>')\n\n    def replace_col(self, prev_col, new_col):\n        self.index.replace_col(prev_col, new_col)\n\n    def reload(self):\n        self.index.reload()\n\n    def col_position(self, col_name):\n        return self.index.col_position(col_name)\n\n    def get_slice(self, col_slice, item):\n        '''\n        Return a newly created index from the given slice.\n\n        Parameters\n        ----------\n        col_slice : Column object\n            Already existing slice of a single column\n        item : list or ndarray\n            Slice for retrieval\n        '''\n        from .table import Table\n        if len(self.columns) == 1:\n            index = Index([col_slice], engine=self.data.__class__)\n            return self.__class__(index, slice(0, 0, None), original=True)\n\n        t = Table(self.columns, copy_indices=False)\n        with t.index_mode('discard_on_copy'):\n            new_cols = t[item].columns.values()\n        index = Index(new_cols, engine=self.data.__class__)\n        return self.__class__(index, slice(0, 0, None), original=True)\n\n    @property\n    def columns(self):\n        return self.index.columns\n\n    @property\n    def data(self):\n        return self.index.data\n\n\ndef get_index(table, table_copy=None, names=None):\n    \"\"\"\n    Inputs a table and some subset of its columns as table_copy.\n    List or tuple containing names of columns as names,and returns an index\n    corresponding to this subset or list or None if no such index exists.\n\n    Parameters\n    ----------\n    table : `Table`\n        Input table\n    table_copy : `Table`, optional\n        Subset of the columns in the ``table`` argument\n    names : list, tuple, optional\n        Subset of column names in the ``table`` argument\n\n    Returns\n    -------\n    Index of columns or None\n\n    \"\"\"\n    if names is not None and table_copy is not None:\n        raise ValueError('one and only one argument from \"table_copy\" or'\n                         ' \"names\" is required')\n\n    if names is None and table_copy is None:\n        raise ValueError('one and only one argument from \"table_copy\" or'\n                         ' \"names\" is required')\n\n    if names is not None:\n        names = set(names)\n    else:\n        names = set(table_copy.colnames)\n\n    if not names <= set(table.colnames):\n        raise ValueError(f'{names} is not a subset of table columns')\n\n    for name in names:\n        for index in table[name].info.indices:\n            if set([col.info.name for col in index.columns]) == names:\n                return index\n\n    return None\n\n\ndef get_index_by_names(table, names):\n    '''\n    Returns an index in ``table`` corresponding to the ``names`` columns or None\n    if no such index exists.\n\n    Parameters\n    ----------\n    table : `Table`\n        Input table\n    nmaes : tuple, list\n        Column names\n    '''\n    names = list(names)\n    for index in table.indices:\n        index_names = [col.info.name for col in index.columns]\n        if index_names == names:\n            return index\n    else:\n        return None\n\n\nclass _IndexModeContext:\n    '''\n    A context manager that allows for special indexing modes, which\n    are intended to improve performance. Currently the allowed modes\n    are \"freeze\", in which indices are not modified upon column modification,\n    \"copy_on_getitem\", in which indices are copied upon column slicing,\n    and \"discard_on_copy\", in which indices are discarded upon table\n    copying/slicing.\n    '''\n\n    _col_subclasses = {}\n\n    def __init__(self, table, mode):\n        '''\n        Parameters\n        ----------\n        table : Table\n            The table to which the mode should be applied\n        mode : str\n            Either 'freeze', 'copy_on_getitem', or 'discard_on_copy'.\n            In 'discard_on_copy' mode,\n            indices are not copied whenever columns or tables are copied.\n            In 'freeze' mode, indices are not modified whenever columns are\n            modified; at the exit of the context, indices refresh themselves\n            based on column values. This mode is intended for scenarios in\n            which one intends to make many additions or modifications on an\n            indexed column.\n            In 'copy_on_getitem' mode, indices are copied when taking column\n            slices as well as table slices, so col[i0:i1] will preserve\n            indices.\n        '''\n        self.table = table\n        self.mode = mode\n        # Used by copy_on_getitem\n        self._orig_classes = []\n        if mode not in ('freeze', 'discard_on_copy', 'copy_on_getitem'):\n            raise ValueError(\"Expected a mode of either 'freeze', \"\n                             \"'discard_on_copy', or 'copy_on_getitem', got \"\n                             \"'{}'\".format(mode))\n\n    def __enter__(self):\n        if self.mode == 'discard_on_copy':\n            self.table._copy_indices = False\n        elif self.mode == 'copy_on_getitem':\n            for col in self.table.columns.values():\n                self._orig_classes.append(col.__class__)\n                col.__class__ = self._get_copy_on_getitem_shim(col.__class__)\n        else:\n            for index in self.table.indices:\n                index._frozen = True\n\n    def __exit__(self, exc_type, exc_value, traceback):\n        if self.mode == 'discard_on_copy':\n            self.table._copy_indices = True\n        elif self.mode == 'copy_on_getitem':\n            for col in reversed(self.table.columns.values()):\n                col.__class__ = self._orig_classes.pop()\n        else:\n            for index in self.table.indices:\n                index._frozen = False\n                index.reload()\n\n    def _get_copy_on_getitem_shim(self, cls):\n        \"\"\"\n        This creates a subclass of the column's class which overrides that\n        class's ``__getitem__``, such that when returning a slice of the\n        column, the relevant indices are also copied over to the slice.\n\n        Ideally, rather than shimming in a new ``__class__`` we would be able\n        to just flip a flag that is checked by the base class's\n        ``__getitem__``.  Unfortunately, since the flag needs to be a Python\n        variable, this slows down ``__getitem__`` too much in the more common\n        case where a copy of the indices is not needed.  See the docstring for\n        ``astropy.table._column_mixins`` for more information on that.\n        \"\"\"\n\n        if cls in self._col_subclasses:\n            return self._col_subclasses[cls]\n\n        def __getitem__(self, item):\n            value = cls.__getitem__(self, item)\n            if type(value) is type(self):\n                value = self.info.slice_indices(value, item, len(self))\n\n            return value\n\n        clsname = f'_{cls.__name__}WithIndexCopy'\n\n        new_cls = type(str(clsname), (cls,), {'__getitem__': __getitem__})\n\n        self._col_subclasses[cls] = new_cls\n\n        return new_cls\n\n\nclass TableIndices(list):\n    '''\n    A special list of table indices allowing\n    for retrieval by column name(s).\n\n    Parameters\n    ----------\n    lst : list\n        List of indices\n    '''\n\n    def __init__(self, lst):\n        super().__init__(lst)\n\n    def __getitem__(self, item):\n        '''\n        Retrieve an item from the list of indices.\n\n        Parameters\n        ----------\n        item : int, str, tuple, or list\n            Position in list or name(s) of indexed column(s)\n        '''\n        if isinstance(item, str):\n            item = [item]\n        if isinstance(item, (list, tuple)):\n            item = list(item)\n            for index in self:\n                try:\n                    for name in item:\n                        index.col_position(name)\n                    if len(index.columns) == len(item):\n                        return index\n                except ValueError:\n                    pass\n            # index search failed\n            raise IndexError(f\"No index found for {item}\")\n\n        return super().__getitem__(item)\n\n\nclass TableLoc:\n    \"\"\"\n    A pseudo-list of Table rows allowing for retrieval\n    of rows by indexed column values.\n\n    Parameters\n    ----------\n    table : Table\n        Indexed table to use\n    \"\"\"\n\n    def __init__(self, table):\n        self.table = table\n        self.indices = table.indices\n        if len(self.indices) == 0:\n            raise ValueError(\"Cannot create TableLoc object with no indices\")\n\n    def _get_rows(self, item):\n        \"\"\"\n        Retrieve Table rows indexes by value slice.\n        \"\"\"\n\n        if isinstance(item, tuple):\n            key, item = item\n        else:\n            key = self.table.primary_key\n\n        index = self.indices[key]\n        if len(index.columns) > 1:\n            raise ValueError(\"Cannot use .loc on multi-column indices\")\n\n        if isinstance(item, slice):\n            # None signifies no upper/lower bound\n            start = MinValue() if item.start is None else item.start\n            stop = MaxValue() if item.stop is None else item.stop\n            rows = index.range((start,), (stop,))\n        else:\n            if not isinstance(item, (list, np.ndarray)):  # single element\n                item = [item]\n            # item should be a list or ndarray of values\n            rows = []\n            for key in item:\n                p = index.find((key,))\n                if len(p) == 0:\n                    raise KeyError(f'No matches found for key {key}')\n                else:\n                    rows.extend(p)\n        return rows\n\n    def __getitem__(self, item):\n        \"\"\"\n        Retrieve Table rows by value slice.\n\n        Parameters\n        ----------\n        item : column element, list, ndarray, slice or tuple\n            Can be a value of the table primary index, a list/ndarray\n            of such values, or a value slice (both endpoints are included).\n            If a tuple is provided, the first element must be\n            an index to use instead of the primary key, and the\n            second element must be as above.\n        \"\"\"\n        rows = self._get_rows(item)\n\n        if len(rows) == 0:  # no matches found\n            raise KeyError(f'No matches found for key {item}')\n        elif len(rows) == 1:  # single row\n            return self.table[rows[0]]\n        return self.table[rows]\n\n    def __setitem__(self, key, value):\n        \"\"\"\n        Assign Table row's by value slice.\n\n        Parameters\n        ----------\n        key : column element, list, ndarray, slice or tuple\n              Can be a value of the table primary index, a list/ndarray\n              of such values, or a value slice (both endpoints are included).\n              If a tuple is provided, the first element must be\n              an index to use instead of the primary key, and the\n              second element must be as above.\n\n        value : New values of the row elements.\n                Can be a list of tuples/lists to update the row.\n        \"\"\"\n        rows = self._get_rows(key)\n        if len(rows) == 0:  # no matches found\n            raise KeyError(f'No matches found for key {key}')\n        elif len(rows) == 1:  # single row\n            self.table[rows[0]] = value\n        else:  # multiple rows\n            if len(rows) == len(value):\n                for row, val in zip(rows, value):\n                    self.table[row] = val\n            else:\n                raise ValueError(f'Right side should contain {len(rows)} values')\n\n\nclass TableLocIndices(TableLoc):\n\n    def __getitem__(self, item):\n        \"\"\"\n        Retrieve Table row's indices by value slice.\n\n        Parameters\n        ----------\n        item : column element, list, ndarray, slice or tuple\n               Can be a value of the table primary index, a list/ndarray\n               of such values, or a value slice (both endpoints are included).\n               If a tuple is provided, the first element must be\n               an index to use instead of the primary key, and the\n               second element must be as above.\n        \"\"\"\n        rows = self._get_rows(item)\n        if len(rows) == 0:  # no matches found\n            raise KeyError(f'No matches found for key {item}')\n        elif len(rows) == 1:  # single row\n            return rows[0]\n        return rows\n\n\nclass TableILoc(TableLoc):\n    '''\n    A variant of TableLoc allowing for row retrieval by\n    indexed order rather than data values.\n\n    Parameters\n    ----------\n    table : Table\n        Indexed table to use\n    '''\n\n    def __init__(self, table):\n        super().__init__(table)\n\n    def __getitem__(self, item):\n        if isinstance(item, tuple):\n            key, item = item\n        else:\n            key = self.table.primary_key\n        index = self.indices[key]\n        rows = index.sorted_data()[item]\n        table_slice = self.table[rows]\n\n        if len(table_slice) == 0:  # no matches found\n            raise IndexError(f'Invalid index for iloc: {item}')\n\n        return table_slice\n"},{"col":0,"comment":"\n    Write summary information about column to the ``out`` filehandle.\n    By default this prints to standard output via sys.stdout.\n\n    The ``option`` argument specifies what type of information\n    to include.  This can be a string, a function, or a list of\n    strings or functions.  Built-in options are:\n\n    - ``attributes``: basic column meta data like ``dtype`` or ``format``\n    - ``stats``: basic statistics: minimum, mean, and maximum\n\n    If a function is specified then that function will be called with the\n    column as its single argument.  The function must return an OrderedDict\n    containing the information attributes.\n\n    If a list is provided then the information attributes will be\n    appended for each of the options, in order.\n\n    Examples\n    --------\n    >>> from astropy.table.table_helpers import simple_table\n    >>> t = simple_table(size=2, kinds='if')\n    >>> t['a'].unit = 'm'\n    >>> t.info()\n    <Table length=2>\n    name  dtype  unit\n    ---- ------- ----\n       a   int64    m\n       b float64\n\n    >>> t.info('stats')\n    <Table length=2>\n    name mean std min max\n    ---- ---- --- --- ---\n       a  1.5 0.5   1   2\n       b  1.5 0.5   1   2\n\n    Parameters\n    ----------\n    option : str, callable, list of (str or callable)\n        Info option, defaults to 'attributes'.\n    out : file-like, None\n        Output destination, default is sys.stdout.  If None then a\n        Table with information attributes is returned\n\n    Returns\n    -------\n    info : `~astropy.table.Table` if out==None else None\n    ","endLoc":116,"header":"def table_info(tbl, option='attributes', out='')","id":9363,"name":"table_info","nodeType":"Function","startLoc":16,"text":"def table_info(tbl, option='attributes', out=''):\n    \"\"\"\n    Write summary information about column to the ``out`` filehandle.\n    By default this prints to standard output via sys.stdout.\n\n    The ``option`` argument specifies what type of information\n    to include.  This can be a string, a function, or a list of\n    strings or functions.  Built-in options are:\n\n    - ``attributes``: basic column meta data like ``dtype`` or ``format``\n    - ``stats``: basic statistics: minimum, mean, and maximum\n\n    If a function is specified then that function will be called with the\n    column as its single argument.  The function must return an OrderedDict\n    containing the information attributes.\n\n    If a list is provided then the information attributes will be\n    appended for each of the options, in order.\n\n    Examples\n    --------\n    >>> from astropy.table.table_helpers import simple_table\n    >>> t = simple_table(size=2, kinds='if')\n    >>> t['a'].unit = 'm'\n    >>> t.info()\n    <Table length=2>\n    name  dtype  unit\n    ---- ------- ----\n       a   int64    m\n       b float64\n\n    >>> t.info('stats')\n    <Table length=2>\n    name mean std min max\n    ---- ---- --- --- ---\n       a  1.5 0.5   1   2\n       b  1.5 0.5   1   2\n\n    Parameters\n    ----------\n    option : str, callable, list of (str or callable)\n        Info option, defaults to 'attributes'.\n    out : file-like, None\n        Output destination, default is sys.stdout.  If None then a\n        Table with information attributes is returned\n\n    Returns\n    -------\n    info : `~astropy.table.Table` if out==None else None\n    \"\"\"\n    from .table import Table\n\n    if out == '':\n        out = sys.stdout\n\n    descr_vals = [tbl.__class__.__name__]\n    if tbl.masked:\n        descr_vals.append('masked=True')\n    descr_vals.append(f'length={len(tbl)}')\n\n    outlines = ['<' + ' '.join(descr_vals) + '>']\n\n    cols = list(tbl.columns.values())\n    if tbl.colnames:\n        infos = []\n        for col in cols:\n            infos.append(col.info(option, out=None))\n\n        info = Table(infos, names=list(infos[0]))\n    else:\n        info = Table()\n\n    if out is None:\n        return info\n\n    # Since info is going to a filehandle for viewing then remove uninteresting\n    # columns.\n    if 'class' in info.colnames:\n        # Remove 'class' info column if all table columns are the same class\n        # and they are the default column class for that table.\n        uniq_types = set(type(col) for col in cols)\n        if len(uniq_types) == 1 and isinstance(cols[0], tbl.ColumnClass):\n            del info['class']\n\n    if 'n_bad' in info.colnames and np.all(info['n_bad'] == 0):\n        del info['n_bad']\n\n    # Standard attributes has 'length' but this is typically redundant\n    if 'length' in info.colnames and np.all(info['length'] == len(tbl)):\n        del info['length']\n\n    for name in info.colnames:\n        if info[name].dtype.kind in 'SU' and np.all(info[name] == ''):\n            del info[name]\n\n    if tbl.colnames:\n        outlines.extend(info.pformat(max_width=-1, max_lines=-1, show_unit=False))\n    else:\n        outlines.append('<No columns>')\n\n    out.writelines(outline + os.linesep for outline in outlines)"},{"className":"QueryError","col":0,"comment":"\n    Indicates that a given index cannot handle the supplied query.\n    ","endLoc":44,"id":9364,"nodeType":"Class","startLoc":40,"text":"class QueryError(ValueError):\n    '''\n    Indicates that a given index cannot handle the supplied query.\n    '''\n    pass"},{"className":"Index","col":0,"comment":"\n    The Index class makes it possible to maintain indices\n    on columns of a Table, so that column values can be queried\n    quickly and efficiently. Column values are stored in lexicographic\n    sorted order, which allows for binary searching in O(log n).\n\n    Parameters\n    ----------\n    columns : list or None\n        List of columns on which to create an index. If None,\n        create an empty index for purposes of deep copying.\n    engine : type, instance, or None\n        Indexing engine class to use (from among SortedArray, BST,\n        and SCEngine) or actual engine instance.\n        If the supplied argument is None (by default), use SortedArray.\n    unique : bool (defaults to False)\n        Whether the values of the index must be unique\n    ","endLoc":396,"id":9365,"nodeType":"Class","startLoc":47,"text":"class Index:\n    '''\n    The Index class makes it possible to maintain indices\n    on columns of a Table, so that column values can be queried\n    quickly and efficiently. Column values are stored in lexicographic\n    sorted order, which allows for binary searching in O(log n).\n\n    Parameters\n    ----------\n    columns : list or None\n        List of columns on which to create an index. If None,\n        create an empty index for purposes of deep copying.\n    engine : type, instance, or None\n        Indexing engine class to use (from among SortedArray, BST,\n        and SCEngine) or actual engine instance.\n        If the supplied argument is None (by default), use SortedArray.\n    unique : bool (defaults to False)\n        Whether the values of the index must be unique\n    '''\n    def __init__(self, columns, engine=None, unique=False):\n        # Local imports to avoid import problems.\n        from .table import Table, Column\n        from astropy.time import Time\n\n        if columns is not None:\n            columns = list(columns)\n\n        if engine is not None and not isinstance(engine, type):\n            # create from data\n            self.engine = engine.__class__\n            self.data = engine\n            self.columns = columns\n            return\n\n        # by default, use SortedArray\n        self.engine = engine or SortedArray\n\n        if columns is None:  # this creates a special exception for deep copying\n            columns = []\n            data = []\n            row_index = []\n        elif len(columns) == 0:\n            raise ValueError(\"Cannot create index without at least one column\")\n        elif len(columns) == 1:\n            col = columns[0]\n            row_index = Column(col.argsort())\n            data = Table([col[row_index]])\n        else:\n            num_rows = len(columns[0])\n\n            # replace Time columns with approximate form and remainder\n            new_columns = []\n            for col in columns:\n                if isinstance(col, Time):\n                    new_columns.append(col.jd)\n                    remainder = col - col.__class__(col.jd, format='jd', scale=col.scale)\n                    new_columns.append(remainder.jd)\n                else:\n                    new_columns.append(col)\n\n            # sort the table lexicographically and keep row numbers\n            table = Table(columns + [np.arange(num_rows)], copy_indices=False)\n            sort_columns = new_columns[::-1]\n            try:\n                lines = table[np.lexsort(sort_columns)]\n            except TypeError:  # arbitrary mixins might not work with lexsort\n                lines = table[table.argsort()]\n            data = lines[lines.colnames[:-1]]\n            row_index = lines[lines.colnames[-1]]\n\n        self.data = self.engine(data, row_index, unique=unique)\n        self.columns = columns\n\n    def __len__(self):\n        '''\n        Number of rows in index.\n        '''\n        return len(self.columns[0])\n\n    def replace_col(self, prev_col, new_col):\n        '''\n        Replace an indexed column with an updated reference.\n\n        Parameters\n        ----------\n        prev_col : Column\n            Column reference to replace\n        new_col : Column\n            New column reference\n        '''\n        self.columns[self.col_position(prev_col.info.name)] = new_col\n\n    def reload(self):\n        '''\n        Recreate the index based on data in self.columns.\n        '''\n        self.__init__(self.columns, engine=self.engine)\n\n    def col_position(self, col_name):\n        '''\n        Return the position of col_name in self.columns.\n\n        Parameters\n        ----------\n        col_name : str\n            Name of column to look up\n        '''\n        for i, c in enumerate(self.columns):\n            if c.info.name == col_name:\n                return i\n        raise ValueError(f\"Column does not belong to index: {col_name}\")\n\n    def insert_row(self, pos, vals, columns):\n        '''\n        Insert a new row from the given values.\n\n        Parameters\n        ----------\n        pos : int\n            Position at which to insert row\n        vals : list or tuple\n            List of values to insert into a new row\n        columns : list\n            Table column references\n        '''\n        key = [None] * len(self.columns)\n        for i, col in enumerate(columns):\n            try:\n                key[self.col_position(col.info.name)] = vals[i]\n            except ValueError:  # not a member of index\n                continue\n        num_rows = len(self.columns[0])\n        if pos < num_rows:\n            # shift all rows >= pos to the right\n            self.data.shift_right(pos)\n        self.data.add(tuple(key), pos)\n\n    def get_row_specifier(self, row_specifier):\n        '''\n        Return an iterable corresponding to the\n        input row specifier.\n\n        Parameters\n        ----------\n        row_specifier : int, list, ndarray, or slice\n        '''\n        if isinstance(row_specifier, (int, np.integer)):\n            # single row\n            return (row_specifier,)\n        elif isinstance(row_specifier, (list, np.ndarray)):\n            return row_specifier\n        elif isinstance(row_specifier, slice):\n            col_len = len(self.columns[0])\n            return range(*row_specifier.indices(col_len))\n        raise ValueError(\"Expected int, array of ints, or slice but \"\n                         \"got {} in remove_rows\".format(row_specifier))\n\n    def remove_rows(self, row_specifier):\n        '''\n        Remove the given rows from the index.\n\n        Parameters\n        ----------\n        row_specifier : int, list, ndarray, or slice\n            Indicates which row(s) to remove\n        '''\n        rows = []\n\n        # To maintain the correct row order, we loop twice,\n        # deleting rows first and then reordering the remaining rows\n        for row in self.get_row_specifier(row_specifier):\n            self.remove_row(row, reorder=False)\n            rows.append(row)\n        # second pass - row order is reversed to maintain\n        # correct row numbers\n        for row in reversed(sorted(rows)):\n            self.data.shift_left(row)\n\n    def remove_row(self, row, reorder=True):\n        '''\n        Remove the given row from the index.\n\n        Parameters\n        ----------\n        row : int\n            Position of row to remove\n        reorder : bool\n            Whether to reorder indices after removal\n        '''\n        # for removal, form a key consisting of column values in this row\n        if not self.data.remove(tuple([col[row] for col in self.columns]), row):\n            raise ValueError(f\"Could not remove row {row} from index\")\n        # decrement the row number of all later rows\n        if reorder:\n            self.data.shift_left(row)\n\n    def find(self, key):\n        '''\n        Return the row values corresponding to key, in sorted order.\n\n        Parameters\n        ----------\n        key : tuple\n            Values to search for in each column\n        '''\n        return self.data.find(key)\n\n    def same_prefix(self, key):\n        '''\n        Return rows whose keys contain the supplied key as a prefix.\n\n        Parameters\n        ----------\n        key : tuple\n            Prefix for which to search\n        '''\n        return self.same_prefix_range(key, key, (True, True))\n\n    def same_prefix_range(self, lower, upper, bounds=(True, True)):\n        '''\n        Return rows whose keys have a prefix in the given range.\n\n        Parameters\n        ----------\n        lower : tuple\n            Lower prefix bound\n        upper : tuple\n            Upper prefix bound\n        bounds : tuple (x, y) of bools\n            Indicates whether the search should be inclusive or\n            exclusive with respect to the endpoints. The first\n            argument x corresponds to an inclusive lower bound,\n            and the second argument y to an inclusive upper bound.\n        '''\n        n = len(lower)\n        ncols = len(self.columns)\n        a = MinValue() if bounds[0] else MaxValue()\n        b = MaxValue() if bounds[1] else MinValue()\n        # [x, y] search corresponds to [(x, min), (y, max)]\n        # (x, y) search corresponds to ((x, max), (x, min))\n        lower = lower + tuple((ncols - n) * [a])\n        upper = upper + tuple((ncols - n) * [b])\n        return self.data.range(lower, upper, bounds)\n\n    def range(self, lower, upper, bounds=(True, True)):\n        '''\n        Return rows within the given range.\n\n        Parameters\n        ----------\n        lower : tuple\n            Lower prefix bound\n        upper : tuple\n            Upper prefix bound\n        bounds : tuple (x, y) of bools\n            Indicates whether the search should be inclusive or\n            exclusive with respect to the endpoints. The first\n            argument x corresponds to an inclusive lower bound,\n            and the second argument y to an inclusive upper bound.\n        '''\n        return self.data.range(lower, upper, bounds)\n\n    def replace(self, row, col_name, val):\n        '''\n        Replace the value of a column at a given position.\n\n        Parameters\n        ----------\n        row : int\n            Row number to modify\n        col_name : str\n            Name of the Column to modify\n        val : col.info.dtype\n            Value to insert at specified row of col\n        '''\n        self.remove_row(row, reorder=False)\n        key = [c[row] for c in self.columns]\n        key[self.col_position(col_name)] = val\n        self.data.add(tuple(key), row)\n\n    def replace_rows(self, col_slice):\n        '''\n        Modify rows in this index to agree with the specified\n        slice. For example, given an index\n        {'5': 1, '2': 0, '3': 2} on a column ['2', '5', '3'],\n        an input col_slice of [2, 0] will result in the relabeling\n        {'3': 0, '2': 1} on the sliced column ['3', '2'].\n\n        Parameters\n        ----------\n        col_slice : list\n            Indices to slice\n        '''\n        row_map = dict((row, i) for i, row in enumerate(col_slice))\n        self.data.replace_rows(row_map)\n\n    def sort(self):\n        '''\n        Make row numbers follow the same sort order as the keys\n        of the index.\n        '''\n        self.data.sort()\n\n    def sorted_data(self):\n        '''\n        Returns a list of rows in sorted order based on keys;\n        essentially acts as an argsort() on columns.\n        '''\n        return self.data.sorted_data()\n\n    def __getitem__(self, item):\n        '''\n        Returns a sliced version of this index.\n\n        Parameters\n        ----------\n        item : slice\n            Input slice\n\n        Returns\n        -------\n        SlicedIndex\n            A sliced reference to this index.\n        '''\n        return SlicedIndex(self, item)\n\n    def __repr__(self):\n        col_names = tuple(col.info.name for col in self.columns)\n        return f'<{self.__class__.__name__} columns={col_names} data={self.data}>'\n\n    def __deepcopy__(self, memo):\n        '''\n        Return a deep copy of this index.\n\n        Notes\n        -----\n        The default deep copy must be overridden to perform\n        a shallow copy of the index columns, avoiding infinite recursion.\n\n        Parameters\n        ----------\n        memo : dict\n        '''\n        # Bypass Index.__new__ to create an actual Index, not a SlicedIndex.\n        index = super().__new__(self.__class__)\n        index.__init__(None, engine=self.engine)\n        index.data = deepcopy(self.data, memo)\n        index.columns = self.columns[:]  # new list, same columns\n        memo[id(self)] = index\n        return index"},{"col":4,"comment":"\n        Number of rows in index.\n        ","endLoc":124,"header":"def __len__(self)","id":9366,"name":"__len__","nodeType":"Function","startLoc":120,"text":"def __len__(self):\n        '''\n        Number of rows in index.\n        '''\n        return len(self.columns[0])"},{"col":4,"comment":"\n        Insert a new row from the given values.\n\n        Parameters\n        ----------\n        pos : int\n            Position at which to insert row\n        vals : list or tuple\n            List of values to insert into a new row\n        columns : list\n            Table column references\n        ","endLoc":182,"header":"def insert_row(self, pos, vals, columns)","id":9367,"name":"insert_row","nodeType":"Function","startLoc":159,"text":"def insert_row(self, pos, vals, columns):\n        '''\n        Insert a new row from the given values.\n\n        Parameters\n        ----------\n        pos : int\n            Position at which to insert row\n        vals : list or tuple\n            List of values to insert into a new row\n        columns : list\n            Table column references\n        '''\n        key = [None] * len(self.columns)\n        for i, col in enumerate(columns):\n            try:\n                key[self.col_position(col.info.name)] = vals[i]\n            except ValueError:  # not a member of index\n                continue\n        num_rows = len(self.columns[0])\n        if pos < num_rows:\n            # shift all rows >= pos to the right\n            self.data.shift_right(pos)\n        self.data.add(tuple(key), pos)"},{"col":4,"comment":"\n        Return the index of the largest key in data greater than or\n        equal to the given key, data pair.\n\n        Parameters\n        ----------\n        key : tuple\n            Column key\n        data : int\n            Row number\n        exact : bool\n            If True, return the index of the given key in data\n            or -1 if the key is not present.\n        ","endLoc":124,"header":"def find_pos(self, key, data, exact=False)","id":9368,"name":"find_pos","nodeType":"Function","startLoc":84,"text":"def find_pos(self, key, data, exact=False):\n        '''\n        Return the index of the largest key in data greater than or\n        equal to the given key, data pair.\n\n        Parameters\n        ----------\n        key : tuple\n            Column key\n        data : int\n            Row number\n        exact : bool\n            If True, return the index of the given key in data\n            or -1 if the key is not present.\n        '''\n        begin = 0\n        end = len(self.row_index)\n        num_cols = self.num_cols\n        if not self.unique:\n            # consider the row value as well\n            key = key + (data,)\n            num_cols += 1\n\n        # search through keys in lexicographic order\n        for i in range(num_cols):\n            key_slice = self._get_key_slice(i, begin, end)\n            t = _searchsorted(key_slice, key[i])\n            # t is the smallest index >= key[i]\n            if exact and (t == len(key_slice) or key_slice[t] != key[i]):\n                # no match\n                return -1\n            elif t == len(key_slice) or (t == 0 and len(key_slice) > 0\n                                         and key[i] < key_slice[0]):\n                # too small or too large\n                return begin + t\n            end = begin + _searchsorted(key_slice, key[i], side='right')\n            begin += t\n            if begin >= len(self.row_index):  # greater than all keys\n                return begin\n\n        return begin"},{"col":4,"comment":"\n        Retrieve the ith slice of the sorted array\n        from begin to end.\n        ","endLoc":82,"header":"def _get_key_slice(self, i, begin, end)","id":9369,"name":"_get_key_slice","nodeType":"Function","startLoc":74,"text":"def _get_key_slice(self, i, begin, end):\n        '''\n        Retrieve the ith slice of the sorted array\n        from begin to end.\n        '''\n        if i < self.num_cols:\n            return self.cols[i][begin:end]\n        else:\n            return self.row_index[begin:end]"},{"col":0,"comment":"\n    Call np.searchsorted or use a custom binary\n    search if necessary.\n    ","endLoc":25,"header":"def _searchsorted(array, val, side='left')","id":9370,"name":"_searchsorted","nodeType":"Function","startLoc":5,"text":"def _searchsorted(array, val, side='left'):\n    '''\n    Call np.searchsorted or use a custom binary\n    search if necessary.\n    '''\n    if hasattr(array, 'searchsorted'):\n        return array.searchsorted(val, side=side)\n    # Python binary search\n    begin = 0\n    end = len(array)\n    while begin < end:\n        mid = (begin + end) // 2\n        if val > array[mid]:\n            begin = mid + 1\n        elif val < array[mid]:\n            end = mid\n        elif side == 'right':\n            begin = mid + 1\n        else:\n            end = mid\n    return begin"},{"col":4,"comment":"Return a list of lines for the formatted string representation of\n        the table.\n\n        Parameters\n        ----------\n        max_lines : int or None\n            Maximum number of rows to output\n\n        max_width : int or None\n            Maximum character width of output\n\n        show_name : bool\n            Include a header row for column names. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        show_dtype : bool\n            Include a header row for column dtypes. Default is False.\n\n        html : bool\n            Format the output as an HTML table. Default is False.\n\n        tableid : str or None\n            An ID tag for the table; only used if html is set.  Default is\n            \"table{id}\", where id is the unique integer id of the table object,\n            id(table)\n\n        tableclass : str or list of str or None\n            CSS classes for the table; only used if html is set.  Default is\n            none\n\n        align : str or list or tuple\n            Left/right alignment of columns. Default is '>' (right) for all\n            columns. Other allowed values are '<', '^', and '0=' for left,\n            centered, and 0-padded, respectively. A list of strings can be\n            provided for alignment of tables with multiple columns.\n\n        Returns\n        -------\n        rows : list\n            Formatted table as a list of strings\n\n        outs : dict\n            Dict which is used to pass back additional values\n            defined within the iterator.\n\n        ","endLoc":640,"header":"def _pformat_table(self, table, max_lines=None, max_width=None,\n                       show_name=True, show_unit=None, show_dtype=False,\n                       html=False, tableid=None, tableclass=None, align=None)","id":9371,"name":"_pformat_table","nodeType":"Function","startLoc":492,"text":"def _pformat_table(self, table, max_lines=None, max_width=None,\n                       show_name=True, show_unit=None, show_dtype=False,\n                       html=False, tableid=None, tableclass=None, align=None):\n        \"\"\"Return a list of lines for the formatted string representation of\n        the table.\n\n        Parameters\n        ----------\n        max_lines : int or None\n            Maximum number of rows to output\n\n        max_width : int or None\n            Maximum character width of output\n\n        show_name : bool\n            Include a header row for column names. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        show_dtype : bool\n            Include a header row for column dtypes. Default is False.\n\n        html : bool\n            Format the output as an HTML table. Default is False.\n\n        tableid : str or None\n            An ID tag for the table; only used if html is set.  Default is\n            \"table{id}\", where id is the unique integer id of the table object,\n            id(table)\n\n        tableclass : str or list of str or None\n            CSS classes for the table; only used if html is set.  Default is\n            none\n\n        align : str or list or tuple\n            Left/right alignment of columns. Default is '>' (right) for all\n            columns. Other allowed values are '<', '^', and '0=' for left,\n            centered, and 0-padded, respectively. A list of strings can be\n            provided for alignment of tables with multiple columns.\n\n        Returns\n        -------\n        rows : list\n            Formatted table as a list of strings\n\n        outs : dict\n            Dict which is used to pass back additional values\n            defined within the iterator.\n\n        \"\"\"\n        # \"Print\" all the values into temporary lists by column for subsequent\n        # use and to determine the width\n        max_lines, max_width = self._get_pprint_size(max_lines, max_width)\n\n        if show_unit is None:\n            show_unit = any(col.info.unit for col in table.columns.values())\n\n        # Coerce align into a correctly-sized list of alignments (if possible)\n        n_cols = len(table.columns)\n        if align is None or isinstance(align, str):\n            align = [align] * n_cols\n\n        elif isinstance(align, (list, tuple)):\n            if len(align) != n_cols:\n                raise ValueError('got {} alignment values instead of '\n                                 'the number of columns ({})'\n                                 .format(len(align), n_cols))\n        else:\n            raise TypeError('align keyword must be str or list or tuple (got {})'\n                            .format(type(align)))\n\n        # Process column visibility from table pprint_include_names and\n        # pprint_exclude_names attributes and get the set of columns to show.\n        pprint_include_names = _get_pprint_include_names(table)\n\n        cols = []\n        outs = None  # Initialize so static type checker is happy\n        for align_, col in zip(align, table.columns.values()):\n            if col.info.name not in pprint_include_names:\n                continue\n\n            lines, outs = self._pformat_col(col, max_lines, show_name=show_name,\n                                            show_unit=show_unit, show_dtype=show_dtype,\n                                            align=align_)\n            if outs['show_length']:\n                lines = lines[:-1]\n            cols.append(lines)\n\n        if not cols:\n            return ['<No columns>'], {'show_length': False}\n\n        # Use the values for the last column since they are all the same\n        n_header = outs['n_header']\n\n        n_rows = len(cols[0])\n\n        def outwidth(cols):\n            return sum(len(c[0]) for c in cols) + len(cols) - 1\n\n        dots_col = ['...'] * n_rows\n        middle = len(cols) // 2\n        while outwidth(cols) > max_width:\n            if len(cols) == 1:\n                break\n            if len(cols) == 2:\n                cols[1] = dots_col\n                break\n            if cols[middle] is dots_col:\n                cols.pop(middle)\n                middle = len(cols) // 2\n            cols[middle] = dots_col\n\n        # Now \"print\" the (already-stringified) column values into a\n        # row-oriented list.\n        rows = []\n        if html:\n            from astropy.utils.xml.writer import xml_escape\n\n            if tableid is None:\n                tableid = f'table{id(table)}'\n\n            if tableclass is not None:\n                if isinstance(tableclass, list):\n                    tableclass = ' '.join(tableclass)\n                rows.append(f'<table id=\"{tableid}\" class=\"{tableclass}\">')\n            else:\n                rows.append(f'<table id=\"{tableid}\">')\n\n            for i in range(n_rows):\n                # _pformat_col output has a header line '----' which is not needed here\n                if i == n_header - 1:\n                    continue\n                td = 'th' if i < n_header else 'td'\n                vals = (f'<{td}>{xml_escape(col[i].strip())}</{td}>'\n                        for col in cols)\n                row = ('<tr>' + ''.join(vals) + '</tr>')\n                if i < n_header:\n                    row = ('<thead>' + row + '</thead>')\n                rows.append(row)\n            rows.append('</table>')\n        else:\n            for i in range(n_rows):\n                row = ' '.join(col[i] for col in cols)\n                rows.append(row)\n\n        return rows, outs"},{"col":4,"comment":"\n        Find all rows matching the given key.\n\n        Parameters\n        ----------\n        key : tuple\n            Column values\n\n        Returns\n        -------\n        matching_rows : list\n            List of rows matching the input key\n        ","endLoc":159,"header":"def find(self, key)","id":9372,"name":"find","nodeType":"Function","startLoc":126,"text":"def find(self, key):\n        '''\n        Find all rows matching the given key.\n\n        Parameters\n        ----------\n        key : tuple\n            Column values\n\n        Returns\n        -------\n        matching_rows : list\n            List of rows matching the input key\n        '''\n        begin = 0\n        end = len(self.row_index)\n\n        # search through keys in lexicographic order\n        for i in range(self.num_cols):\n            key_slice = self._get_key_slice(i, begin, end)\n            t = _searchsorted(key_slice, key[i])\n            # t is the smallest index >= key[i]\n            if t == len(key_slice) or key_slice[t] != key[i]:\n                # no match\n                return []\n            elif t == 0 and len(key_slice) > 0 and key[i] < key_slice[0]:\n                # too small or too large\n                return []\n            end = begin + _searchsorted(key_slice, key[i], side='right')\n            begin += t\n            if begin >= len(self.row_index):  # greater than all keys\n                return []\n\n        return self.row_index[begin:end]"},{"col":0,"comment":"\n    Take a set difference of table rows.\n\n    The row set difference will contain all rows in ``table1`` that are not\n    present in ``table2``. If the keys parameter is not defined, all columns in\n    ``table1`` will be included in the output table.\n\n    Parameters\n    ----------\n    table1 : `~astropy.table.Table`\n        ``table1`` is on the left side of the set difference.\n    table2 : `~astropy.table.Table`\n        ``table2`` is on the right side of the set difference.\n    keys : str or list of str\n        Name(s) of column(s) used to match rows of left and right tables.\n        Default is to use all columns in ``table1``.\n\n    Returns\n    -------\n    diff_table : `~astropy.table.Table`\n        New table containing the set difference between tables. If the set\n        difference is none, an empty table will be returned.\n\n    Examples\n    --------\n    To get a set difference between two tables::\n\n      >>> from astropy.table import setdiff, Table\n      >>> t1 = Table({'a': [1, 4, 9], 'b': ['c', 'd', 'f']}, names=('a', 'b'))\n      >>> t2 = Table({'a': [1, 5, 9], 'b': ['c', 'b', 'f']}, names=('a', 'b'))\n      >>> print(t1)\n       a   b\n      --- ---\n        1   c\n        4   d\n        9   f\n      >>> print(t2)\n       a   b\n      --- ---\n        1   c\n        5   b\n        9   f\n      >>> print(setdiff(t1, t2))\n       a   b\n      --- ---\n        4   d\n\n      >>> print(setdiff(t2, t1))\n       a   b\n      --- ---\n        5   b\n    ","endLoc":495,"header":"def setdiff(table1, table2, keys=None)","id":9373,"name":"setdiff","nodeType":"Function","startLoc":404,"text":"def setdiff(table1, table2, keys=None):\n    \"\"\"\n    Take a set difference of table rows.\n\n    The row set difference will contain all rows in ``table1`` that are not\n    present in ``table2``. If the keys parameter is not defined, all columns in\n    ``table1`` will be included in the output table.\n\n    Parameters\n    ----------\n    table1 : `~astropy.table.Table`\n        ``table1`` is on the left side of the set difference.\n    table2 : `~astropy.table.Table`\n        ``table2`` is on the right side of the set difference.\n    keys : str or list of str\n        Name(s) of column(s) used to match rows of left and right tables.\n        Default is to use all columns in ``table1``.\n\n    Returns\n    -------\n    diff_table : `~astropy.table.Table`\n        New table containing the set difference between tables. If the set\n        difference is none, an empty table will be returned.\n\n    Examples\n    --------\n    To get a set difference between two tables::\n\n      >>> from astropy.table import setdiff, Table\n      >>> t1 = Table({'a': [1, 4, 9], 'b': ['c', 'd', 'f']}, names=('a', 'b'))\n      >>> t2 = Table({'a': [1, 5, 9], 'b': ['c', 'b', 'f']}, names=('a', 'b'))\n      >>> print(t1)\n       a   b\n      --- ---\n        1   c\n        4   d\n        9   f\n      >>> print(t2)\n       a   b\n      --- ---\n        1   c\n        5   b\n        9   f\n      >>> print(setdiff(t1, t2))\n       a   b\n      --- ---\n        4   d\n\n      >>> print(setdiff(t2, t1))\n       a   b\n      --- ---\n        5   b\n    \"\"\"\n    if keys is None:\n        keys = table1.colnames\n\n    # Check that all keys are in table1 and table2\n    for tbl, tbl_str in ((table1, 'table1'), (table2, 'table2')):\n        diff_keys = np.setdiff1d(keys, tbl.colnames)\n        if len(diff_keys) != 0:\n            raise ValueError(\"The {} columns are missing from {}, cannot take \"\n                             \"a set difference.\".format(diff_keys, tbl_str))\n\n    # Make a light internal copy of both tables\n    t1 = table1.copy(copy_data=False)\n    t1.meta = {}\n    t1.keep_columns(keys)\n    t1['__index1__'] = np.arange(len(table1))  # Keep track of rows indices\n\n    # Make a light internal copy to avoid touching table2\n    t2 = table2.copy(copy_data=False)\n    t2.meta = {}\n    t2.keep_columns(keys)\n    # Dummy column to recover rows after join\n    t2['__index2__'] = np.zeros(len(t2), dtype=np.uint8)  # dummy column\n\n    t12 = _join(t1, t2, join_type='left', keys=keys,\n                metadata_conflicts='silent')\n\n    # If t12 index2 is masked then that means some rows were in table1 but not table2.\n    if hasattr(t12['__index2__'], 'mask'):\n        # Define bool mask of table1 rows not in table2\n        diff = t12['__index2__'].mask\n        # Get the row indices of table1 for those rows\n        idx = t12['__index1__'][diff]\n        # Select corresponding table1 rows straight from table1 to ensure\n        # correct table and column types.\n        t12_diff = table1[idx]\n    else:\n        t12_diff = table1[[]]\n\n    return t12_diff"},{"col":4,"comment":"\n        Find values in the given range.\n\n        Parameters\n        ----------\n        lower : tuple\n            Lower search bound\n        upper : tuple\n            Upper search bound\n        bounds : (2,) tuple of bool\n            Indicates whether the search should be inclusive or\n            exclusive with respect to the endpoints. The first\n            argument corresponds to an inclusive lower bound,\n            and the second argument to an inclusive upper bound.\n        ","endLoc":194,"header":"def range(self, lower, upper, bounds)","id":9374,"name":"range","nodeType":"Function","startLoc":161,"text":"def range(self, lower, upper, bounds):\n        '''\n        Find values in the given range.\n\n        Parameters\n        ----------\n        lower : tuple\n            Lower search bound\n        upper : tuple\n            Upper search bound\n        bounds : (2,) tuple of bool\n            Indicates whether the search should be inclusive or\n            exclusive with respect to the endpoints. The first\n            argument corresponds to an inclusive lower bound,\n            and the second argument to an inclusive upper bound.\n        '''\n        lower_pos = self.find_pos(lower, 0)\n        upper_pos = self.find_pos(upper, 0)\n        if lower_pos == len(self.row_index):\n            return []\n\n        lower_bound = tuple([col[lower_pos] for col in self.cols])\n        if not bounds[0] and lower_bound == lower:\n            lower_pos += 1  # data[lower_pos] > lower\n\n        # data[lower_pos] >= lower\n        # data[upper_pos] >= upper\n        if upper_pos < len(self.row_index):\n            upper_bound = tuple([col[upper_pos] for col in self.cols])\n            if not bounds[1] and upper_bound == upper:\n                upper_pos -= 1  # data[upper_pos] < upper\n            elif upper_bound > upper:\n                upper_pos -= 1  # data[upper_pos] <= upper\n        return self.row_index[lower_pos:upper_pos + 1]"},{"attributeType":"null","col":4,"comment":"null","endLoc":123,"id":9375,"name":"__doc__","nodeType":"Attribute","startLoc":123,"text":"__call__.__doc__"},{"className":"_IndexModeContext","col":0,"comment":"\n    A context manager that allows for special indexing modes, which\n    are intended to improve performance. Currently the allowed modes\n    are \"freeze\", in which indices are not modified upon column modification,\n    \"copy_on_getitem\", in which indices are copied upon column slicing,\n    and \"discard_on_copy\", in which indices are discarded upon table\n    copying/slicing.\n    ","endLoc":755,"id":9376,"nodeType":"Class","startLoc":663,"text":"class _IndexModeContext:\n    '''\n    A context manager that allows for special indexing modes, which\n    are intended to improve performance. Currently the allowed modes\n    are \"freeze\", in which indices are not modified upon column modification,\n    \"copy_on_getitem\", in which indices are copied upon column slicing,\n    and \"discard_on_copy\", in which indices are discarded upon table\n    copying/slicing.\n    '''\n\n    _col_subclasses = {}\n\n    def __init__(self, table, mode):\n        '''\n        Parameters\n        ----------\n        table : Table\n            The table to which the mode should be applied\n        mode : str\n            Either 'freeze', 'copy_on_getitem', or 'discard_on_copy'.\n            In 'discard_on_copy' mode,\n            indices are not copied whenever columns or tables are copied.\n            In 'freeze' mode, indices are not modified whenever columns are\n            modified; at the exit of the context, indices refresh themselves\n            based on column values. This mode is intended for scenarios in\n            which one intends to make many additions or modifications on an\n            indexed column.\n            In 'copy_on_getitem' mode, indices are copied when taking column\n            slices as well as table slices, so col[i0:i1] will preserve\n            indices.\n        '''\n        self.table = table\n        self.mode = mode\n        # Used by copy_on_getitem\n        self._orig_classes = []\n        if mode not in ('freeze', 'discard_on_copy', 'copy_on_getitem'):\n            raise ValueError(\"Expected a mode of either 'freeze', \"\n                             \"'discard_on_copy', or 'copy_on_getitem', got \"\n                             \"'{}'\".format(mode))\n\n    def __enter__(self):\n        if self.mode == 'discard_on_copy':\n            self.table._copy_indices = False\n        elif self.mode == 'copy_on_getitem':\n            for col in self.table.columns.values():\n                self._orig_classes.append(col.__class__)\n                col.__class__ = self._get_copy_on_getitem_shim(col.__class__)\n        else:\n            for index in self.table.indices:\n                index._frozen = True\n\n    def __exit__(self, exc_type, exc_value, traceback):\n        if self.mode == 'discard_on_copy':\n            self.table._copy_indices = True\n        elif self.mode == 'copy_on_getitem':\n            for col in reversed(self.table.columns.values()):\n                col.__class__ = self._orig_classes.pop()\n        else:\n            for index in self.table.indices:\n                index._frozen = False\n                index.reload()\n\n    def _get_copy_on_getitem_shim(self, cls):\n        \"\"\"\n        This creates a subclass of the column's class which overrides that\n        class's ``__getitem__``, such that when returning a slice of the\n        column, the relevant indices are also copied over to the slice.\n\n        Ideally, rather than shimming in a new ``__class__`` we would be able\n        to just flip a flag that is checked by the base class's\n        ``__getitem__``.  Unfortunately, since the flag needs to be a Python\n        variable, this slows down ``__getitem__`` too much in the more common\n        case where a copy of the indices is not needed.  See the docstring for\n        ``astropy.table._column_mixins`` for more information on that.\n        \"\"\"\n\n        if cls in self._col_subclasses:\n            return self._col_subclasses[cls]\n\n        def __getitem__(self, item):\n            value = cls.__getitem__(self, item)\n            if type(value) is type(self):\n                value = self.info.slice_indices(value, item, len(self))\n\n            return value\n\n        clsname = f'_{cls.__name__}WithIndexCopy'\n\n        new_cls = type(str(clsname), (cls,), {'__getitem__': __getitem__})\n\n        self._col_subclasses[cls] = new_cls\n\n        return new_cls"},{"col":4,"comment":"null","endLoc":712,"header":"def __enter__(self)","id":9377,"name":"__enter__","nodeType":"Function","startLoc":703,"text":"def __enter__(self):\n        if self.mode == 'discard_on_copy':\n            self.table._copy_indices = False\n        elif self.mode == 'copy_on_getitem':\n            for col in self.table.columns.values():\n                self._orig_classes.append(col.__class__)\n                col.__class__ = self._get_copy_on_getitem_shim(col.__class__)\n        else:\n            for index in self.table.indices:\n                index._frozen = True"},{"col":4,"comment":"\n        Remove the given entry from the sorted array.\n\n        Parameters\n        ----------\n        key : tuple\n            Column values\n        data : int\n            Row number\n\n        Returns\n        -------\n        successful : bool\n            Whether the entry was successfully removed\n        ","endLoc":220,"header":"def remove(self, key, data)","id":9378,"name":"remove","nodeType":"Function","startLoc":196,"text":"def remove(self, key, data):\n        '''\n        Remove the given entry from the sorted array.\n\n        Parameters\n        ----------\n        key : tuple\n            Column values\n        data : int\n            Row number\n\n        Returns\n        -------\n        successful : bool\n            Whether the entry was successfully removed\n        '''\n        pos = self.find_pos(key, data, exact=True)\n        if pos == -1:  # key not found\n            return False\n\n        self.data.remove_row(pos)\n        keep_mask = np.ones(len(self.row_index), dtype=bool)\n        keep_mask[pos] = False\n        self.row_index = self.row_index[keep_mask]\n        return True"},{"col":0,"comment":"Get the set of names to show in pprint from the table pprint_include_names\n    and pprint_exclude_names attributes.\n\n    These may be fnmatch unix-style globs.\n    ","endLoc":160,"header":"def _get_pprint_include_names(table)","id":9379,"name":"_get_pprint_include_names","nodeType":"Function","startLoc":139,"text":"def _get_pprint_include_names(table):\n    \"\"\"Get the set of names to show in pprint from the table pprint_include_names\n    and pprint_exclude_names attributes.\n\n    These may be fnmatch unix-style globs.\n    \"\"\"\n    def get_matches(name_globs, default):\n        match_names = set()\n        if name_globs:  # For None or () use the default\n            for name in table.colnames:\n                for name_glob in name_globs:\n                    if fnmatch.fnmatch(name, name_glob):\n                        match_names.add(name)\n                        break\n        else:\n            match_names.update(default)\n        return match_names\n\n    include_names = get_matches(table.pprint_include_names(), table.colnames)\n    exclude_names = get_matches(table.pprint_exclude_names(), [])\n\n    return include_names - exclude_names"},{"col":0,"comment":"\n    Stack columns within tables depth-wise\n\n    A ``join_type`` of 'exact' means that the tables must all have exactly\n    the same column names (though the order can vary).  If ``join_type``\n    is 'inner' then the intersection of common columns will be the output.\n    A value of 'outer' (default) means the output will have the union of\n    all columns, with table values being masked where no common values are\n    available.\n\n    Parameters\n    ----------\n    tables : `~astropy.table.Table` or `~astropy.table.Row` or list thereof\n        Table(s) to stack along depth-wise with the current table\n        Table columns should have same shape and name for depth-wise stacking\n    join_type : str\n        Join type ('inner' | 'exact' | 'outer'), default is 'outer'\n    metadata_conflicts : str\n        How to proceed with metadata conflicts. This should be one of:\n            * ``'silent'``: silently pick the last conflicting meta-data value\n            * ``'warn'``: pick the last conflicting meta-data value, but emit a warning (default)\n            * ``'error'``: raise an exception.\n\n    Returns\n    -------\n    stacked_table : `~astropy.table.Table` object\n        New table containing the stacked data from the input tables.\n\n    Examples\n    --------\n    To stack two tables along rows do::\n\n      >>> from astropy.table import vstack, Table\n      >>> t1 = Table({'a': [1, 2], 'b': [3, 4]}, names=('a', 'b'))\n      >>> t2 = Table({'a': [5, 6], 'b': [7, 8]}, names=('a', 'b'))\n      >>> print(t1)\n       a   b\n      --- ---\n        1   3\n        2   4\n      >>> print(t2)\n       a   b\n      --- ---\n        5   7\n        6   8\n      >>> print(dstack([t1, t2]))\n      a [2]  b [2]\n      ------ ------\n      1 .. 5 3 .. 7\n      2 .. 6 4 .. 8\n    ","endLoc":588,"header":"def dstack(tables, join_type='outer', metadata_conflicts='warn')","id":9380,"name":"dstack","nodeType":"Function","startLoc":498,"text":"def dstack(tables, join_type='outer', metadata_conflicts='warn'):\n    \"\"\"\n    Stack columns within tables depth-wise\n\n    A ``join_type`` of 'exact' means that the tables must all have exactly\n    the same column names (though the order can vary).  If ``join_type``\n    is 'inner' then the intersection of common columns will be the output.\n    A value of 'outer' (default) means the output will have the union of\n    all columns, with table values being masked where no common values are\n    available.\n\n    Parameters\n    ----------\n    tables : `~astropy.table.Table` or `~astropy.table.Row` or list thereof\n        Table(s) to stack along depth-wise with the current table\n        Table columns should have same shape and name for depth-wise stacking\n    join_type : str\n        Join type ('inner' | 'exact' | 'outer'), default is 'outer'\n    metadata_conflicts : str\n        How to proceed with metadata conflicts. This should be one of:\n            * ``'silent'``: silently pick the last conflicting meta-data value\n            * ``'warn'``: pick the last conflicting meta-data value, but emit a warning (default)\n            * ``'error'``: raise an exception.\n\n    Returns\n    -------\n    stacked_table : `~astropy.table.Table` object\n        New table containing the stacked data from the input tables.\n\n    Examples\n    --------\n    To stack two tables along rows do::\n\n      >>> from astropy.table import vstack, Table\n      >>> t1 = Table({'a': [1, 2], 'b': [3, 4]}, names=('a', 'b'))\n      >>> t2 = Table({'a': [5, 6], 'b': [7, 8]}, names=('a', 'b'))\n      >>> print(t1)\n       a   b\n      --- ---\n        1   3\n        2   4\n      >>> print(t2)\n       a   b\n      --- ---\n        5   7\n        6   8\n      >>> print(dstack([t1, t2]))\n      a [2]  b [2]\n      ------ ------\n      1 .. 5 3 .. 7\n      2 .. 6 4 .. 8\n    \"\"\"\n    _check_join_type(join_type, 'dstack')\n\n    tables = _get_list_of_tables(tables)\n    if len(tables) == 1:\n        return tables[0]  # no point in stacking a single table\n\n    n_rows = set(len(table) for table in tables)\n    if len(n_rows) != 1:\n        raise ValueError('Table lengths must all match for dstack')\n    n_row = n_rows.pop()\n\n    out = vstack(tables, join_type, metadata_conflicts)\n\n    for name, col in out.columns.items():\n        col = out[name]\n\n        # Reshape to so each original column is now in a row.\n        # If entries are not 0-dim then those additional shape dims\n        # are just carried along.\n        # [x x x y y y] => [[x x x],\n        #                   [y y y]]\n        new_shape = (len(tables), n_row) + col.shape[1:]\n        try:\n            col.shape = (len(tables), n_row) + col.shape[1:]\n        except AttributeError:\n            col = col.reshape(new_shape)\n\n        # Transpose the table and row axes to get to\n        # [[x, y],\n        #  [x, y]\n        #  [x, y]]\n        axes = np.arange(len(col.shape))\n        axes[:2] = [1, 0]\n\n        # This temporarily makes `out` be corrupted (columns of different\n        # length) but it all works out in the end.\n        out.columns.__setitem__(name, col.transpose(axes), validated=True)\n\n    return out"},{"col":4,"comment":"\n        This creates a subclass of the column's class which overrides that\n        class's ``__getitem__``, such that when returning a slice of the\n        column, the relevant indices are also copied over to the slice.\n\n        Ideally, rather than shimming in a new ``__class__`` we would be able\n        to just flip a flag that is checked by the base class's\n        ``__getitem__``.  Unfortunately, since the flag needs to be a Python\n        variable, this slows down ``__getitem__`` too much in the more common\n        case where a copy of the indices is not needed.  See the docstring for\n        ``astropy.table._column_mixins`` for more information on that.\n        ","endLoc":755,"header":"def _get_copy_on_getitem_shim(self, cls)","id":9382,"name":"_get_copy_on_getitem_shim","nodeType":"Function","startLoc":725,"text":"def _get_copy_on_getitem_shim(self, cls):\n        \"\"\"\n        This creates a subclass of the column's class which overrides that\n        class's ``__getitem__``, such that when returning a slice of the\n        column, the relevant indices are also copied over to the slice.\n\n        Ideally, rather than shimming in a new ``__class__`` we would be able\n        to just flip a flag that is checked by the base class's\n        ``__getitem__``.  Unfortunately, since the flag needs to be a Python\n        variable, this slows down ``__getitem__`` too much in the more common\n        case where a copy of the indices is not needed.  See the docstring for\n        ``astropy.table._column_mixins`` for more information on that.\n        \"\"\"\n\n        if cls in self._col_subclasses:\n            return self._col_subclasses[cls]\n\n        def __getitem__(self, item):\n            value = cls.__getitem__(self, item)\n            if type(value) is type(self):\n                value = self.info.slice_indices(value, item, len(self))\n\n            return value\n\n        clsname = f'_{cls.__name__}WithIndexCopy'\n\n        new_cls = type(str(clsname), (cls,), {'__getitem__': __getitem__})\n\n        self._col_subclasses[cls] = new_cls\n\n        return new_cls"},{"col":4,"comment":"null","endLoc":723,"header":"def __exit__(self, exc_type, exc_value, traceback)","id":9383,"name":"__exit__","nodeType":"Function","startLoc":714,"text":"def __exit__(self, exc_type, exc_value, traceback):\n        if self.mode == 'discard_on_copy':\n            self.table._copy_indices = True\n        elif self.mode == 'copy_on_getitem':\n            for col in reversed(self.table.columns.values()):\n                col.__class__ = self._orig_classes.pop()\n        else:\n            for index in self.table.indices:\n                index._frozen = False\n                index.reload()"},{"attributeType":"null","col":4,"comment":"null","endLoc":673,"id":9384,"name":"_col_subclasses","nodeType":"Attribute","startLoc":673,"text":"_col_subclasses"},{"attributeType":"null","col":8,"comment":"null","endLoc":695,"id":9385,"name":"mode","nodeType":"Attribute","startLoc":695,"text":"self.mode"},{"attributeType":"null","col":8,"comment":"null","endLoc":697,"id":9386,"name":"_orig_classes","nodeType":"Attribute","startLoc":697,"text":"self._orig_classes"},{"attributeType":"null","col":8,"comment":"null","endLoc":694,"id":9387,"name":"table","nodeType":"Attribute","startLoc":694,"text":"self.table"},{"attributeType":"null","col":0,"comment":"null","endLoc":46,"id":9388,"name":"conf","nodeType":"Attribute","startLoc":46,"text":"conf"},{"col":4,"comment":"\n        Decrement all row numbers greater than the input row.\n\n        Parameters\n        ----------\n        row : int\n            Input row number\n        ","endLoc":231,"header":"def shift_left(self, row)","id":9389,"name":"shift_left","nodeType":"Function","startLoc":222,"text":"def shift_left(self, row):\n        '''\n        Decrement all row numbers greater than the input row.\n\n        Parameters\n        ----------\n        row : int\n            Input row number\n        '''\n        self.row_index[self.row_index > row] -= 1"},{"col":4,"comment":"\n        Increment all row numbers greater than or equal to the input row.\n\n        Parameters\n        ----------\n        row : int\n            Input row number\n        ","endLoc":242,"header":"def shift_right(self, row)","id":9390,"name":"shift_right","nodeType":"Function","startLoc":233,"text":"def shift_right(self, row):\n        '''\n        Increment all row numbers greater than or equal to the input row.\n\n        Parameters\n        ----------\n        row : int\n            Input row number\n        '''\n        self.row_index[self.row_index >= row] += 1"},{"col":0,"comment":"\n    Stack tables along columns (horizontally)\n\n    A ``join_type`` of 'exact' means that the tables must all\n    have exactly the same number of rows.  If ``join_type`` is 'inner' then\n    the intersection of rows will be the output.  A value of 'outer' (default)\n    means the output will have the union of all rows, with table values being\n    masked where no common values are available.\n\n    Parameters\n    ----------\n    tables : `~astropy.table.Table` or `~astropy.table.Row` or list thereof\n        Tables to stack along columns (horizontally) with the current table\n    join_type : str\n        Join type ('inner' | 'exact' | 'outer'), default is 'outer'\n    uniq_col_name : str or None\n        String generate a unique output column name in case of a conflict.\n        The default is '{col_name}_{table_name}'.\n    table_names : list of str or None\n        Two-element list of table names used when generating unique output\n        column names.  The default is ['1', '2', ..].\n    metadata_conflicts : str\n        How to proceed with metadata conflicts. This should be one of:\n            * ``'silent'``: silently pick the last conflicting meta-data value\n            * ``'warn'``: pick the last conflicting meta-data value,\n              but emit a warning (default)\n            * ``'error'``: raise an exception.\n\n    Returns\n    -------\n    stacked_table : `~astropy.table.Table` object\n        New table containing the stacked data from the input tables.\n\n    See Also\n    --------\n    Table.add_columns, Table.replace_column, Table.update\n\n    Examples\n    --------\n    To stack two tables horizontally (along columns) do::\n\n      >>> from astropy.table import Table, hstack\n      >>> t1 = Table({'a': [1, 2], 'b': [3, 4]}, names=('a', 'b'))\n      >>> t2 = Table({'c': [5, 6], 'd': [7, 8]}, names=('c', 'd'))\n      >>> print(t1)\n       a   b\n      --- ---\n        1   3\n        2   4\n      >>> print(t2)\n       c   d\n      --- ---\n        5   7\n        6   8\n      >>> print(hstack([t1, t2]))\n       a   b   c   d\n      --- --- --- ---\n        1   3   5   7\n        2   4   6   8\n    ","endLoc":734,"header":"def hstack(tables, join_type='outer',\n           uniq_col_name='{col_name}_{table_name}', table_names=None,\n           metadata_conflicts='warn')","id":9391,"name":"hstack","nodeType":"Function","startLoc":659,"text":"def hstack(tables, join_type='outer',\n           uniq_col_name='{col_name}_{table_name}', table_names=None,\n           metadata_conflicts='warn'):\n    \"\"\"\n    Stack tables along columns (horizontally)\n\n    A ``join_type`` of 'exact' means that the tables must all\n    have exactly the same number of rows.  If ``join_type`` is 'inner' then\n    the intersection of rows will be the output.  A value of 'outer' (default)\n    means the output will have the union of all rows, with table values being\n    masked where no common values are available.\n\n    Parameters\n    ----------\n    tables : `~astropy.table.Table` or `~astropy.table.Row` or list thereof\n        Tables to stack along columns (horizontally) with the current table\n    join_type : str\n        Join type ('inner' | 'exact' | 'outer'), default is 'outer'\n    uniq_col_name : str or None\n        String generate a unique output column name in case of a conflict.\n        The default is '{col_name}_{table_name}'.\n    table_names : list of str or None\n        Two-element list of table names used when generating unique output\n        column names.  The default is ['1', '2', ..].\n    metadata_conflicts : str\n        How to proceed with metadata conflicts. This should be one of:\n            * ``'silent'``: silently pick the last conflicting meta-data value\n            * ``'warn'``: pick the last conflicting meta-data value,\n              but emit a warning (default)\n            * ``'error'``: raise an exception.\n\n    Returns\n    -------\n    stacked_table : `~astropy.table.Table` object\n        New table containing the stacked data from the input tables.\n\n    See Also\n    --------\n    Table.add_columns, Table.replace_column, Table.update\n\n    Examples\n    --------\n    To stack two tables horizontally (along columns) do::\n\n      >>> from astropy.table import Table, hstack\n      >>> t1 = Table({'a': [1, 2], 'b': [3, 4]}, names=('a', 'b'))\n      >>> t2 = Table({'c': [5, 6], 'd': [7, 8]}, names=('c', 'd'))\n      >>> print(t1)\n       a   b\n      --- ---\n        1   3\n        2   4\n      >>> print(t2)\n       c   d\n      --- ---\n        5   7\n        6   8\n      >>> print(hstack([t1, t2]))\n       a   b   c   d\n      --- --- --- ---\n        1   3   5   7\n        2   4   6   8\n    \"\"\"\n    _check_join_type(join_type, 'hstack')\n\n    tables = _get_list_of_tables(tables)  # validates input\n    if len(tables) == 1:\n        return tables[0]  # no point in stacking a single table\n    col_name_map = OrderedDict()\n\n    out = _hstack(tables, join_type, uniq_col_name, table_names,\n                  col_name_map)\n\n    _merge_table_meta(out, tables, metadata_conflicts=metadata_conflicts)\n\n    return out"},{"col":4,"comment":"\n        Replace all rows with the values they map to in the\n        given dictionary. Any rows not present as keys in\n        the dictionary will have their entries deleted.\n\n        Parameters\n        ----------\n        row_map : dict\n            Mapping of row numbers to new row numbers\n        ","endLoc":267,"header":"def replace_rows(self, row_map)","id":9392,"name":"replace_rows","nodeType":"Function","startLoc":244,"text":"def replace_rows(self, row_map):\n        '''\n        Replace all rows with the values they map to in the\n        given dictionary. Any rows not present as keys in\n        the dictionary will have their entries deleted.\n\n        Parameters\n        ----------\n        row_map : dict\n            Mapping of row numbers to new row numbers\n        '''\n        num_rows = len(row_map)\n        keep_rows = np.zeros(len(self.row_index), dtype=bool)\n        tagged = 0\n        for i, row in enumerate(self.row_index):\n            if row in row_map:\n                keep_rows[i] = True\n                tagged += 1\n                if tagged == num_rows:\n                    break\n\n        self.data = self.data[keep_rows]\n        self.row_index = np.array(\n            [row_map[x] for x in self.row_index[keep_rows]])"},{"col":4,"comment":"\n        Retrieve all array items as a list of pairs of the form\n        [(key, [row 1, row 2, ...]), ...]\n        ","endLoc":283,"header":"def items(self)","id":9393,"name":"items","nodeType":"Function","startLoc":269,"text":"def items(self):\n        '''\n        Retrieve all array items as a list of pairs of the form\n        [(key, [row 1, row 2, ...]), ...]\n        '''\n        array = []\n        last_key = None\n        for i, key in enumerate(zip(*self.data.columns.values())):\n            row = self.row_index[i]\n            if key == last_key:\n                array[-1][1].append(row)\n            else:\n                last_key = key\n                array.append((key, [row]))\n        return array"},{"col":0,"comment":"\n    Stack tables horizontally (by columns)\n\n    A ``join_type`` of 'exact' (default) means that the arrays must all\n    have exactly the same number of rows.  If ``join_type`` is 'inner' then\n    the intersection of rows will be the output.  A value of 'outer' means\n    the output will have the union of all rows, with array values being\n    masked where no common values are available.\n\n    Parameters\n    ----------\n    arrays : List of tables\n        Tables to stack by columns (horizontally)\n    join_type : str\n        Join type ('inner' | 'exact' | 'outer'), default is 'outer'\n    uniq_col_name : str or None\n        String generate a unique output column name in case of a conflict.\n        The default is '{col_name}_{table_name}'.\n    table_names : list of str or None\n        Two-element list of table names used when generating unique output\n        column names.  The default is ['1', '2', ..].\n\n    Returns\n    -------\n    stacked_table : `~astropy.table.Table` object\n        New table containing the stacked data from the input tables.\n    ","endLoc":1538,"header":"def _hstack(arrays, join_type='outer', uniq_col_name='{col_name}_{table_name}',\n            table_names=None, col_name_map=None)","id":9394,"name":"_hstack","nodeType":"Function","startLoc":1437,"text":"def _hstack(arrays, join_type='outer', uniq_col_name='{col_name}_{table_name}',\n            table_names=None, col_name_map=None):\n    \"\"\"\n    Stack tables horizontally (by columns)\n\n    A ``join_type`` of 'exact' (default) means that the arrays must all\n    have exactly the same number of rows.  If ``join_type`` is 'inner' then\n    the intersection of rows will be the output.  A value of 'outer' means\n    the output will have the union of all rows, with array values being\n    masked where no common values are available.\n\n    Parameters\n    ----------\n    arrays : List of tables\n        Tables to stack by columns (horizontally)\n    join_type : str\n        Join type ('inner' | 'exact' | 'outer'), default is 'outer'\n    uniq_col_name : str or None\n        String generate a unique output column name in case of a conflict.\n        The default is '{col_name}_{table_name}'.\n    table_names : list of str or None\n        Two-element list of table names used when generating unique output\n        column names.  The default is ['1', '2', ..].\n\n    Returns\n    -------\n    stacked_table : `~astropy.table.Table` object\n        New table containing the stacked data from the input tables.\n    \"\"\"\n\n    # Store user-provided col_name_map until the end\n    _col_name_map = col_name_map\n\n    if table_names is None:\n        table_names = [f'{ii + 1}' for ii in range(len(arrays))]\n    if len(arrays) != len(table_names):\n        raise ValueError('Number of arrays must match number of table_names')\n\n    # Trivial case of one input arrays\n    if len(arrays) == 1:\n        return arrays[0]\n\n    col_name_map = get_col_name_map(arrays, [], uniq_col_name, table_names)\n\n    # If require_match is True then all input arrays must have the same length\n    arr_lens = [len(arr) for arr in arrays]\n    if join_type == 'exact':\n        if len(set(arr_lens)) > 1:\n            raise TableMergeError(\"Inconsistent number of rows in input arrays \"\n                                  \"(use 'inner' or 'outer' join_type to allow \"\n                                  \"non-matching rows)\")\n        join_type = 'outer'\n\n    # For an inner join, keep only the common rows\n    if join_type == 'inner':\n        min_arr_len = min(arr_lens)\n        if len(set(arr_lens)) > 1:\n            arrays = [arr[:min_arr_len] for arr in arrays]\n        arr_lens = [min_arr_len for arr in arrays]\n\n    # If there are any output rows where one or more input arrays are missing\n    # then the output must be masked.  If any input arrays are masked then\n    # output is masked.\n\n    n_rows = max(arr_lens)\n    out = _get_out_class(arrays)()\n\n    for out_name, in_names in col_name_map.items():\n        for name, array, arr_len in zip(in_names, arrays, arr_lens):\n            if name is None:\n                continue\n\n            if n_rows > arr_len:\n                indices = np.arange(n_rows)\n                indices[arr_len:] = 0\n                col = array[name][indices]\n\n                # If col is a Column but not MaskedColumn then upgrade at this point\n                # because masking is required.\n                if isinstance(col, Column) and not isinstance(col, MaskedColumn):\n                    col = out.MaskedColumn(col, copy=False)\n\n                if isinstance(col, Quantity) and not isinstance(col, Masked):\n                    col = Masked(col, copy=False)\n\n                try:\n                    col[arr_len:] = col.info.mask_val\n                except Exception as err:\n                    raise NotImplementedError(\n                        \"hstack requires masking column '{}' but column\"\n                        \" type {} does not support masking\"\n                        .format(out_name, col.__class__.__name__)) from err\n            else:\n                col = array[name][:n_rows]\n\n            out[out_name] = col\n\n    # If col_name_map supplied as a dict input, then update.\n    if isinstance(_col_name_map, Mapping):\n        _col_name_map.update(col_name_map)\n\n    return out"},{"col":4,"comment":"\n        Make row order align with key order.\n        ","endLoc":289,"header":"def sort(self)","id":9395,"name":"sort","nodeType":"Function","startLoc":285,"text":"def sort(self):\n        '''\n        Make row order align with key order.\n        '''\n        self.row_index = np.arange(len(self.row_index))"},{"col":4,"comment":"\n        Return rows in sorted order.\n        ","endLoc":295,"header":"def sorted_data(self)","id":9396,"name":"sorted_data","nodeType":"Function","startLoc":291,"text":"def sorted_data(self):\n        '''\n        Return rows in sorted order.\n        '''\n        return self.row_index"},{"col":4,"comment":"\n        Return a sliced reference to this sorted array.\n\n        Parameters\n        ----------\n        item : slice\n            Slice to use for referencing\n        ","endLoc":306,"header":"def __getitem__(self, item)","id":9397,"name":"__getitem__","nodeType":"Function","startLoc":297,"text":"def __getitem__(self, item):\n        '''\n        Return a sliced reference to this sorted array.\n\n        Parameters\n        ----------\n        item : slice\n            Slice to use for referencing\n        '''\n        return SortedArray(self.data[item], self.row_index[item])"},{"className":"TableReplaceWarning","col":0,"comment":"\n    Warning class for cases when a table column is replaced via the\n    Table.__setitem__ syntax e.g. t['a'] = val.\n\n    This does not inherit from AstropyWarning because we want to use\n    stacklevel=3 to show the user where the issue occurred in their code.\n    ","endLoc":163,"id":9399,"nodeType":"Class","startLoc":155,"text":"class TableReplaceWarning(UserWarning):\n    \"\"\"\n    Warning class for cases when a table column is replaced via the\n    Table.__setitem__ syntax e.g. t['a'] = val.\n\n    This does not inherit from AstropyWarning because we want to use\n    stacklevel=3 to show the user where the issue occurred in their code.\n    \"\"\"\n    pass"},{"className":"TableColumns","col":0,"comment":"OrderedDict subclass for a set of columns.\n\n    This class enhances item access to provide convenient access to columns\n    by name or index, including slice access.  It also handles renaming\n    of columns.\n\n    The initialization argument ``cols`` can be a list of ``Column`` objects\n    or any structure that is valid for initializing a Python dict.  This\n    includes a dict, list of (key, val) tuples or [key, val] lists, etc.\n\n    Parameters\n    ----------\n    cols : dict, list, tuple; optional\n        Column objects as data structure that can init dict (see above)\n    ","endLoc":340,"id":9400,"nodeType":"Class","startLoc":205,"text":"class TableColumns(OrderedDict):\n    \"\"\"OrderedDict subclass for a set of columns.\n\n    This class enhances item access to provide convenient access to columns\n    by name or index, including slice access.  It also handles renaming\n    of columns.\n\n    The initialization argument ``cols`` can be a list of ``Column`` objects\n    or any structure that is valid for initializing a Python dict.  This\n    includes a dict, list of (key, val) tuples or [key, val] lists, etc.\n\n    Parameters\n    ----------\n    cols : dict, list, tuple; optional\n        Column objects as data structure that can init dict (see above)\n    \"\"\"\n\n    def __init__(self, cols={}):\n        if isinstance(cols, (list, tuple)):\n            # `cols` should be a list of two-tuples, but it is allowed to have\n            # columns (BaseColumn or mixins) in the list.\n            newcols = []\n            for col in cols:\n                if has_info_class(col, BaseColumnInfo):\n                    newcols.append((col.info.name, col))\n                else:\n                    newcols.append(col)\n            cols = newcols\n        super().__init__(cols)\n\n    def __getitem__(self, item):\n        \"\"\"Get items from a TableColumns object.\n        ::\n\n          tc = TableColumns(cols=[Column(name='a'), Column(name='b'), Column(name='c')])\n          tc['a']  # Column('a')\n          tc[1] # Column('b')\n          tc['a', 'b'] # <TableColumns names=('a', 'b')>\n          tc[1:3] # <TableColumns names=('b', 'c')>\n        \"\"\"\n        if isinstance(item, str):\n            return OrderedDict.__getitem__(self, item)\n        elif isinstance(item, (int, np.integer)):\n            return list(self.values())[item]\n        elif (isinstance(item, np.ndarray) and item.shape == () and item.dtype.kind == 'i'):\n            return list(self.values())[item.item()]\n        elif isinstance(item, tuple):\n            return self.__class__([self[x] for x in item])\n        elif isinstance(item, slice):\n            return self.__class__([self[x] for x in list(self)[item]])\n        else:\n            raise IndexError('Illegal key or index value for {} object'\n                             .format(self.__class__.__name__))\n\n    def __setitem__(self, item, value, validated=False):\n        \"\"\"\n        Set item in this dict instance, but do not allow directly replacing an\n        existing column unless it is already validated (and thus is certain to\n        not corrupt the table).\n\n        NOTE: it is easily possible to corrupt a table by directly *adding* a new\n        key to the TableColumns attribute of a Table, e.g.\n        ``t.columns['jane'] = 'doe'``.\n\n        \"\"\"\n        if item in self and not validated:\n            raise ValueError(\"Cannot replace column '{}'.  Use Table.replace_column() instead.\"\n                             .format(item))\n        super().__setitem__(item, value)\n\n    def __repr__(self):\n        names = (f\"'{x}'\" for x in self.keys())\n        return f\"<{self.__class__.__name__} names=({','.join(names)})>\"\n\n    def _rename_column(self, name, new_name):\n        if name == new_name:\n            return\n\n        if new_name in self:\n            raise KeyError(f\"Column {new_name} already exists\")\n\n        # Rename column names in pprint include/exclude attributes as needed\n        parent_table = self[name].info.parent_table\n        if parent_table is not None:\n            parent_table.pprint_exclude_names._rename(name, new_name)\n            parent_table.pprint_include_names._rename(name, new_name)\n\n        mapper = {name: new_name}\n        new_names = [mapper.get(name, name) for name in self]\n        cols = list(self.values())\n        self.clear()\n        self.update(list(zip(new_names, cols)))\n\n    def __delitem__(self, name):\n        # Remove column names from pprint include/exclude attributes as needed.\n        # __delitem__ also gets called for pop() and popitem().\n        parent_table = self[name].info.parent_table\n        if parent_table is not None:\n            # _remove() method does not require that `name` is in the attribute\n            parent_table.pprint_exclude_names._remove(name)\n            parent_table.pprint_include_names._remove(name)\n        return super().__delitem__(name)\n\n    def isinstance(self, cls):\n        \"\"\"\n        Return a list of columns which are instances of the specified classes.\n\n        Parameters\n        ----------\n        cls : class or tuple thereof\n            Column class (including mixin) or tuple of Column classes.\n\n        Returns\n        -------\n        col_list : list of `Column`\n            List of Column objects which are instances of given classes.\n        \"\"\"\n        cols = [col for col in self.values() if isinstance(col, cls)]\n        return cols\n\n    def not_isinstance(self, cls):\n        \"\"\"\n        Return a list of columns which are not instances of the specified classes.\n\n        Parameters\n        ----------\n        cls : class or tuple thereof\n            Column class (including mixin) or tuple of Column classes.\n\n        Returns\n        -------\n        col_list : list of `Column`\n            List of Column objects which are not instances of given classes.\n        \"\"\"\n        cols = [col for col in self.values() if not isinstance(col, cls)]\n        return cols"},{"col":4,"comment":"null","endLoc":233,"header":"def __init__(self, cols={})","id":9401,"name":"__init__","nodeType":"Function","startLoc":222,"text":"def __init__(self, cols={}):\n        if isinstance(cols, (list, tuple)):\n            # `cols` should be a list of two-tuples, but it is allowed to have\n            # columns (BaseColumn or mixins) in the list.\n            newcols = []\n            for col in cols:\n                if has_info_class(col, BaseColumnInfo):\n                    newcols.append((col.info.name, col))\n                else:\n                    newcols.append(col)\n            cols = newcols\n        super().__init__(cols)"},{"col":4,"comment":"Get items from a TableColumns object.\n        ::\n\n          tc = TableColumns(cols=[Column(name='a'), Column(name='b'), Column(name='c')])\n          tc['a']  # Column('a')\n          tc[1] # Column('b')\n          tc['a', 'b'] # <TableColumns names=('a', 'b')>\n          tc[1:3] # <TableColumns names=('b', 'c')>\n        ","endLoc":257,"header":"def __getitem__(self, item)","id":9402,"name":"__getitem__","nodeType":"Function","startLoc":235,"text":"def __getitem__(self, item):\n        \"\"\"Get items from a TableColumns object.\n        ::\n\n          tc = TableColumns(cols=[Column(name='a'), Column(name='b'), Column(name='c')])\n          tc['a']  # Column('a')\n          tc[1] # Column('b')\n          tc['a', 'b'] # <TableColumns names=('a', 'b')>\n          tc[1:3] # <TableColumns names=('b', 'c')>\n        \"\"\"\n        if isinstance(item, str):\n            return OrderedDict.__getitem__(self, item)\n        elif isinstance(item, (int, np.integer)):\n            return list(self.values())[item]\n        elif (isinstance(item, np.ndarray) and item.shape == () and item.dtype.kind == 'i'):\n            return list(self.values())[item.item()]\n        elif isinstance(item, tuple):\n            return self.__class__([self[x] for x in item])\n        elif isinstance(item, slice):\n            return self.__class__([self[x] for x in list(self)[item]])\n        else:\n            raise IndexError('Illegal key or index value for {} object'\n                             .format(self.__class__.__name__))"},{"col":4,"comment":"null","endLoc":311,"header":"def __repr__(self)","id":9403,"name":"__repr__","nodeType":"Function","startLoc":308,"text":"def __repr__(self):\n        t = self.data.copy()\n        t['rows'] = self.row_index\n        return f'<{self.__class__.__name__} length={len(t)}>\\n{t}'"},{"attributeType":"null","col":8,"comment":"null","endLoc":45,"id":9404,"name":"data","nodeType":"Attribute","startLoc":45,"text":"self.data"},{"attributeType":"null","col":8,"comment":"null","endLoc":46,"id":9405,"name":"row_index","nodeType":"Attribute","startLoc":46,"text":"self.row_index"},{"attributeType":"null","col":8,"comment":"null","endLoc":48,"id":9406,"name":"unique","nodeType":"Attribute","startLoc":48,"text":"self.unique"},{"attributeType":"null","col":8,"comment":"null","endLoc":47,"id":9407,"name":"num_cols","nodeType":"Attribute","startLoc":47,"text":"self.num_cols"},{"attributeType":"null","col":16,"comment":"null","endLoc":2,"id":9408,"name":"np","nodeType":"Attribute","startLoc":2,"text":"np"},{"fileName":"pandas.py","filePath":"astropy/table","id":9409,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n\nascii_coded = ('Ò♙♙♙♙♙♙♙♙♌♐♐♌♙♙♙♙♙♙♌♌♙♙Ò♙♙♙♙♙♙♙♘♐♐♐♈♙♙♙♙♙♌♐♐♐♔Ò♙♙♌♈♙♙♌♐♈♈♙♙♙♙♙♙♙♙♈♐♐♙Ò♙♐♙♙♙♐♐♙♙♙'\n               '♙♙♙♙♙♙♙♙♙♙♙♙Ò♐♔♙♙♘♐♐♙♙♌♐♐♔♙♙♌♌♌♙♙♙♌Ò♐♐♙♙♘♐♐♌♙♈♐♈♙♙♙♈♐♐♙♙♘♔Ò♐♐♌♙♘♐♐♐♌♌♙♙♌♌♌♙♈♈♙♌♐'\n               '♐Ò♘♐♐♐♌♐♐♐♐♐♐♌♙♈♙♌♐♐♐♐♐♔Ò♘♐♐♐♐♐♐♐♐♐♐♐♐♈♈♐♐♐♐♐♐♙Ò♙♘♐♐♐♐♈♐♐♐♐♐♐♙♙♐♐♐♐♐♙♙Ò♙♙♙♈♈♈♙♙♐'\n               '♐♐♐♐♔♙♐♐♐♐♈♙♙Ò♙♙♙♙♙♙♙♙♙♈♈♐♐♐♙♈♈♈♙♙♙♙Ò')\nascii_uncoded = ''.join([chr(ord(c) - 200) for c in ascii_coded])\nurl = 'https://media.giphy.com/media/e24Q8FKE2mxRS/giphy.gif'\nmessage_coded = 'ĘĩĶĬĩĻ÷ĜĩĪĴĭèıĶļĭĺĩīļıķĶ'\nmessage_uncoded = ''.join([chr(ord(c) - 200) for c in message_coded])\n\ntry:\n    from IPython import display\n\n    html = display.Image(url=url)._repr_html_()\n\n    class HTMLWithBackup(display.HTML):\n        def __init__(self, data, backup_text):\n            super().__init__(data)\n            self.backup_text = backup_text\n\n        def __repr__(self):\n            if self.backup_text is None:\n                return super().__repr__()\n            else:\n                return self.backup_text\n\n    dhtml = HTMLWithBackup(html, ascii_uncoded)\n    display.display(dhtml)\nexcept ImportError:\n    print(ascii_uncoded)\nexcept (UnicodeEncodeError, SyntaxError):\n    pass\n"},{"className":"HTMLWithBackup","col":4,"comment":"null","endLoc":26,"id":9410,"nodeType":"Class","startLoc":17,"text":"class HTMLWithBackup(display.HTML):\n        def __init__(self, data, backup_text):\n            super().__init__(data)\n            self.backup_text = backup_text\n\n        def __repr__(self):\n            if self.backup_text is None:\n                return super().__repr__()\n            else:\n                return self.backup_text"},{"col":8,"comment":"null","endLoc":20,"header":"def __init__(self, data, backup_text)","id":9411,"name":"__init__","nodeType":"Function","startLoc":18,"text":"def __init__(self, data, backup_text):\n            super().__init__(data)\n            self.backup_text = backup_text"},{"col":8,"comment":"null","endLoc":26,"header":"def __repr__(self)","id":9412,"name":"__repr__","nodeType":"Function","startLoc":22,"text":"def __repr__(self):\n            if self.backup_text is None:\n                return super().__repr__()\n            else:\n                return self.backup_text"},{"attributeType":"null","col":12,"comment":"null","endLoc":20,"id":9413,"name":"backup_text","nodeType":"Attribute","startLoc":20,"text":"self.backup_text"},{"attributeType":"null","col":0,"comment":"null","endLoc":3,"id":9414,"name":"ascii_coded","nodeType":"Attribute","startLoc":3,"text":"ascii_coded"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":9415,"name":"ascii_uncoded","nodeType":"Attribute","startLoc":7,"text":"ascii_uncoded"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":9416,"name":"url","nodeType":"Attribute","startLoc":8,"text":"url"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":9417,"name":"message_coded","nodeType":"Attribute","startLoc":9,"text":"message_coded"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":9418,"name":"message_uncoded","nodeType":"Attribute","startLoc":10,"text":"message_uncoded"},{"attributeType":"null","col":4,"comment":"null","endLoc":15,"id":9419,"name":"html","nodeType":"Attribute","startLoc":15,"text":"html"},{"attributeType":"HTMLWithBackup","col":4,"comment":"null","endLoc":28,"id":9420,"name":"dhtml","nodeType":"Attribute","startLoc":28,"text":"dhtml"},{"col":0,"comment":"","endLoc":6,"header":"pandas.py#<anonymous>","id":9421,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"ascii_coded = ('Ò♙♙♙♙♙♙♙♙♌♐♐♌♙♙♙♙♙♙♌♌♙♙Ò♙♙♙♙♙♙♙♘♐♐♐♈♙♙♙♙♙♌♐♐♐♔Ò♙♙♌♈♙♙♌♐♈♈♙♙♙♙♙♙♙♙♈♐♐♙Ò♙♐♙♙♙♐♐♙♙♙'\n               '♙♙♙♙♙♙♙♙♙♙♙♙Ò♐♔♙♙♘♐♐♙♙♌♐♐♔♙♙♌♌♌♙♙♙♌Ò♐♐♙♙♘♐♐♌♙♈♐♈♙♙♙♈♐♐♙♙♘♔Ò♐♐♌♙♘♐♐♐♌♌♙♙♌♌♌♙♈♈♙♌♐'\n               '♐Ò♘♐♐♐♌♐♐♐♐♐♐♌♙♈♙♌♐♐♐♐♐♔Ò♘♐♐♐♐♐♐♐♐♐♐♐♐♈♈♐♐♐♐♐♐♙Ò♙♘♐♐♐♐♈♐♐♐♐♐♐♙♙♐♐♐♐♐♙♙Ò♙♙♙♈♈♈♙♙♐'\n               '♐♐♐♐♔♙♐♐♐♐♈♙♙Ò♙♙♙♙♙♙♙♙♙♈♈♐♐♐♙♈♈♈♙♙♙♙Ò')\n\nascii_uncoded = ''.join([chr(ord(c) - 200) for c in ascii_coded])\n\nurl = 'https://media.giphy.com/media/e24Q8FKE2mxRS/giphy.gif'\n\nmessage_coded = 'ĘĩĶĬĩĻ÷ĜĩĪĴĭèıĶļĭĺĩīļıķĶ'\n\nmessage_uncoded = ''.join([chr(ord(c) - 200) for c in message_coded])\n\ntry:\n    from IPython import display\n\n    html = display.Image(url=url)._repr_html_()\n\n    class HTMLWithBackup(display.HTML):\n        def __init__(self, data, backup_text):\n            super().__init__(data)\n            self.backup_text = backup_text\n\n        def __repr__(self):\n            if self.backup_text is None:\n                return super().__repr__()\n            else:\n                return self.backup_text\n\n    dhtml = HTMLWithBackup(html, ascii_uncoded)\n    display.display(dhtml)\nexcept ImportError:\n    print(ascii_uncoded)\nexcept (UnicodeEncodeError, SyntaxError):\n    pass"},{"col":4,"comment":"\n        Set item in this dict instance, but do not allow directly replacing an\n        existing column unless it is already validated (and thus is certain to\n        not corrupt the table).\n\n        NOTE: it is easily possible to corrupt a table by directly *adding* a new\n        key to the TableColumns attribute of a Table, e.g.\n        ``t.columns['jane'] = 'doe'``.\n\n        ","endLoc":273,"header":"def __setitem__(self, item, value, validated=False)","id":9422,"name":"__setitem__","nodeType":"Function","startLoc":259,"text":"def __setitem__(self, item, value, validated=False):\n        \"\"\"\n        Set item in this dict instance, but do not allow directly replacing an\n        existing column unless it is already validated (and thus is certain to\n        not corrupt the table).\n\n        NOTE: it is easily possible to corrupt a table by directly *adding* a new\n        key to the TableColumns attribute of a Table, e.g.\n        ``t.columns['jane'] = 'doe'``.\n\n        \"\"\"\n        if item in self and not validated:\n            raise ValueError(\"Cannot replace column '{}'.  Use Table.replace_column() instead.\"\n                             .format(item))\n        super().__setitem__(item, value)"},{"attributeType":"null","col":8,"comment":"null","endLoc":228,"id":9423,"name":"sigma","nodeType":"Attribute","startLoc":228,"text":"self.sigma"},{"col":4,"comment":"null","endLoc":277,"header":"def __repr__(self)","id":9424,"name":"__repr__","nodeType":"Function","startLoc":275,"text":"def __repr__(self):\n        names = (f\"'{x}'\" for x in self.keys())\n        return f\"<{self.__class__.__name__} names=({','.join(names)})>\""},{"id":9425,"name":"_column_mixins.pyx","nodeType":"TextFile","path":"astropy/table","text":"#cython: language_level=3\n\"\"\"\nThis module provides mixin bases classes for the Column and MaskedColumn\nclasses to provide those classes with their custom __getitem__ implementations.\n\nThe reason for this is that implementing a __getitem__ in pure Python actually\nsignificantly slows down the array subscript operation, especially if it needs\nto call the subclass's __getitem__ (i.e. ndarray.__getitem__ in this case).  By\nproviding __getitem__ through a base type implemented in C, the __getitem__\nimplementation will go straight into the class's tp_as_mapping->mp_subscript\nslot, rather than going through a class __dict__ and calling a pure Python\nmethod.  Furthermore, the C implementation of __getitem__ can easily directly\ncall the base class's implementation (as seen in _ColumnGetitemShim, which\ndirectly calls to ndarray->tp_as_mapping->mp_subscript).\n\nThe main reason for overriding __getitem__ in the Column class is for\nreturning elements out of a multi-dimensional column.  That is, if the\nelements of a Column are themselves arrays, the default ndarray.__getitem__\napplies the subclass to those arrays, so they are returned as Column instances\n(when really they're just an array that was in a Column).  This overrides that\nbehavior in the case where the element returned from a single row of the\nColumn is itself an array.\n\"\"\"\n\nimport sys\nimport numpy as np\n\ncdef tuple INTEGER_TYPES = (int, np.integer)\n\n\n# Annoying boilerplate that we shouldn't have to write; Cython should\n# have this built in (some versions do, but the ctypedefs are still lacking,\n# or what is available is Cython version dependent)\nctypedef object (*binaryfunc)(object, object)\n\n\ncdef extern from \"Python.h\":\n    ctypedef struct PyMappingMethods:\n        binaryfunc mp_subscript\n\n    ctypedef struct PyTypeObject:\n        PyMappingMethods* tp_as_mapping\n\n\ncdef extern from \"numpy/arrayobject.h\":\n    ctypedef class numpy.ndarray [object PyArrayObject]:\n        cdef int ndim \"nd\"\n\n\nctypedef object (*item_getter)(object, object)\n\n\ncdef inline object base_getitem(object self, object item, item_getter getitem):\n    if (<ndarray>self).ndim > 1 and isinstance(item, INTEGER_TYPES):\n        return self.data[item]\n\n    value = getitem(self, item)\n\n    try:\n        if value.dtype.char == 'S' and not value.shape:\n            value = value.decode('utf-8', errors='replace')\n    except AttributeError:\n        pass\n\n    return value\n\n\ncdef inline object column_getitem(object self, object item):\n    return (<PyTypeObject *>ndarray).tp_as_mapping.mp_subscript(self, item)\n\n\ncdef class _ColumnGetitemShim:\n    def __getitem__(self, item):\n        return base_getitem(self, item, column_getitem)\n\n\nMaskedArray = np.ma.MaskedArray\n\n\ncdef inline object masked_column_getitem(object self, object item):\n    value = MaskedArray.__getitem__(self, item)\n    return self._copy_attrs_slice(value)\n\n\ncdef class _MaskedColumnGetitemShim(_ColumnGetitemShim):\n    def __getitem__(self, item):\n        return base_getitem(self, item, masked_column_getitem)\n"},{"attributeType":"function | function","col":8,"comment":"null","endLoc":234,"id":9426,"name":"_cenfunc_parsed","nodeType":"Attribute","startLoc":234,"text":"self._cenfunc_parsed"},{"attributeType":"null","col":8,"comment":"null","endLoc":239,"id":9427,"name":"grow","nodeType":"Attribute","startLoc":239,"text":"self.grow"},{"attributeType":"null","col":8,"comment":"null","endLoc":229,"id":9428,"name":"sigma_lower","nodeType":"Attribute","startLoc":229,"text":"self.sigma_lower"},{"col":4,"comment":"null","endLoc":296,"header":"def _rename_column(self, name, new_name)","id":9429,"name":"_rename_column","nodeType":"Function","startLoc":279,"text":"def _rename_column(self, name, new_name):\n        if name == new_name:\n            return\n\n        if new_name in self:\n            raise KeyError(f\"Column {new_name} already exists\")\n\n        # Rename column names in pprint include/exclude attributes as needed\n        parent_table = self[name].info.parent_table\n        if parent_table is not None:\n            parent_table.pprint_exclude_names._rename(name, new_name)\n            parent_table.pprint_include_names._rename(name, new_name)\n\n        mapper = {name: new_name}\n        new_names = [mapper.get(name, name) for name in self]\n        cols = list(self.values())\n        self.clear()\n        self.update(list(zip(new_names, cols)))"},{"id":9430,"name":"_np_utils.pyx","nodeType":"TextFile","path":"astropy/table","text":"#cython: language_level=3\n\"\"\"\nCython utilities for numpy structured arrays.\n\njoin_inner():  Do the inner-loop cartesian product for operations.join() processing.\n               (The \"inner\" is about the inner loop, not inner join).\n\"\"\"\n\nimport numpy as np\nimport numpy.ma as ma\nfrom numpy.lib.recfunctions import drop_fields\n\ncimport cython\ncimport numpy as np\nDTYPE = int\nctypedef np.intp_t DTYPE_t\n\n@cython.wraparound(False)\n@cython.boundscheck(False)\ndef join_inner(np.ndarray[DTYPE_t, ndim=1] idxs,\n               np.ndarray[DTYPE_t, ndim=1] idx_sort,\n               int len_left,\n               int jointype):\n    \"\"\"\n    Do the inner-loop cartesian product for np_utils.join() processing.\n    (The \"inner\" is about the inner loop, not inner join).\n    \"\"\"\n    cdef int n_out = 0\n    cdef int max_key_idxs = 0\n    cdef DTYPE_t ii, key_idxs, n_left, n_right, idx0, idx1, idx, i\n    cdef DTYPE_t i_left, i_right, i_out\n    cdef int masked\n\n    # First count the final number of rows and max number of indexes\n    # for a single key\n    masked = 0\n    for ii in range(idxs.shape[0] - 1):\n        idx0 = idxs[ii]\n        idx1 = idxs[ii + 1]\n\n        # Number of indexes for this key\n        key_idxs = idx1 - idx0\n        if key_idxs > max_key_idxs:\n            max_key_idxs = key_idxs\n\n        # Number of rows for this key\n        n_left = 0\n        n_right = 0\n        for idx in range(idx0, idx1):\n            i = idx_sort[idx]\n            if i < len_left:\n                n_left += 1\n            else:\n                n_right += 1\n\n        # Fix n_left and n_right for different join types\n        if jointype == 0:\n            pass\n        elif jointype == 1:\n            if n_left == 0:\n                masked = 1\n                n_left = 1\n            if n_right == 0:\n                masked = 1\n                n_right = 1\n        elif jointype == 2:\n            if n_right == 0:\n                masked = 1\n                n_right = 1\n        elif jointype == 3:\n            if n_left == 0:\n                masked = 1\n                n_left = 1\n\n        n_out += n_left * n_right\n\n    cdef np.ndarray left_out = np.empty(n_out, dtype=DTYPE)\n    cdef np.ndarray right_out = np.empty(n_out, dtype=DTYPE)\n    cdef np.ndarray left_mask = np.zeros(n_out, dtype=np.bool_)\n    cdef np.ndarray right_mask = np.zeros(n_out, dtype=np.bool_)\n    cdef np.ndarray left_idxs = np.empty(max_key_idxs, dtype=DTYPE)\n    cdef np.ndarray right_idxs = np.empty(max_key_idxs, dtype=DTYPE)\n\n    i_out = 0\n    for ii in range(idxs.shape[0] - 1):\n        idx0 = idxs[ii]\n        idx1 = idxs[ii + 1]\n\n        # Number of rows for this key\n        n_left = 0\n        n_right = 0\n        for idx in range(idx0, idx1):\n            i = idx_sort[idx]\n            if i < len_left:\n                left_idxs[n_left] = i\n                n_left += 1\n            else:\n                right_idxs[n_right] = i - len_left\n                n_right += 1\n\n        if jointype == 0:\n            pass\n        elif jointype == 1:\n            if n_left == 0:\n                left_idxs[0] = -1\n                n_left = 1\n            if n_right == 0:\n                right_idxs[0] = -1\n                n_right = 1\n        elif jointype == 2:\n            if n_right == 0:\n                right_idxs[0] = -1\n                n_right = 1\n        elif jointype == 3:\n            if n_left == 0:\n                left_idxs[0] = -1\n                n_left = 1\n\n        for i_left in range(n_left):\n            for i_right in range(n_right):\n                idx = left_idxs[i_left]\n                if idx < 0:\n                    idx = 0\n                    left_mask[i_out] = 1\n                left_out[i_out] = idx\n\n                idx = right_idxs[i_right]\n                if idx < 0:\n                    idx = 0\n                    right_mask[i_out] = 1\n                right_out[i_out] = idx\n\n                i_out += 1\n\n    return masked, n_out, left_out, left_mask, right_out, right_mask\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":230,"id":9431,"name":"sigma_upper","nodeType":"Attribute","startLoc":230,"text":"self.sigma_upper"},{"fileName":"serialize.py","filePath":"astropy/table","id":9432,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom importlib import import_module\nimport re\nfrom copy import deepcopy\nfrom collections import OrderedDict\n\nimport numpy as np\n\nfrom astropy.utils.data_info import MixinInfo\nfrom .column import Column, MaskedColumn\nfrom .table import Table, QTable, has_info_class\nfrom astropy.units.quantity import QuantityInfo\n\n\n# TODO: some of this might be better done programmatically, through\n# code like\n# __construct_mixin_classes += tuple(\n#        f'astropy.coordinates.representation.{cls.__name__}'\n#        for cls in (list(coorep.REPRESENTATION_CLASSES.values())\n#                    + list(coorep.DIFFERENTIAL_CLASSES.values()))\n#        if cls.__name__ in coorep.__all__)\n# However, to avoid very hard to track import issues, the definition\n# should then be done at the point where it is actually needed,\n# using local imports.  See also\n# https://github.com/astropy/astropy/pull/10210#discussion_r419087286\n__construct_mixin_classes = (\n    'astropy.time.core.Time',\n    'astropy.time.core.TimeDelta',\n    'astropy.units.quantity.Quantity',\n    'astropy.units.function.logarithmic.Magnitude',\n    'astropy.units.function.logarithmic.Decibel',\n    'astropy.units.function.logarithmic.Dex',\n    'astropy.coordinates.angles.Latitude',\n    'astropy.coordinates.angles.Longitude',\n    'astropy.coordinates.angles.Angle',\n    'astropy.coordinates.distances.Distance',\n    'astropy.coordinates.earth.EarthLocation',\n    'astropy.coordinates.sky_coordinate.SkyCoord',\n    'astropy.table.ndarray_mixin.NdarrayMixin',\n    'astropy.table.table_helpers.ArrayWrapper',\n    'astropy.table.column.MaskedColumn',\n    'astropy.coordinates.representation.CartesianRepresentation',\n    'astropy.coordinates.representation.UnitSphericalRepresentation',\n    'astropy.coordinates.representation.RadialRepresentation',\n    'astropy.coordinates.representation.SphericalRepresentation',\n    'astropy.coordinates.representation.PhysicsSphericalRepresentation',\n    'astropy.coordinates.representation.CylindricalRepresentation',\n    'astropy.coordinates.representation.CartesianDifferential',\n    'astropy.coordinates.representation.UnitSphericalDifferential',\n    'astropy.coordinates.representation.SphericalDifferential',\n    'astropy.coordinates.representation.UnitSphericalCosLatDifferential',\n    'astropy.coordinates.representation.SphericalCosLatDifferential',\n    'astropy.coordinates.representation.RadialDifferential',\n    'astropy.coordinates.representation.PhysicsSphericalDifferential',\n    'astropy.coordinates.representation.CylindricalDifferential',\n    'astropy.utils.masked.core.MaskedNDArray',\n)\n\n\nclass SerializedColumn(dict):\n    \"\"\"\n    Subclass of dict that is a used in the representation to contain the name\n    (and possible other info) for a mixin attribute (either primary data or an\n    array-like attribute) that is serialized as a column in the table.\n\n    Normally contains the single key ``name`` with the name of the column in the\n    table.\n    \"\"\"\n    pass\n\n\ndef _represent_mixin_as_column(col, name, new_cols, mixin_cols,\n                               exclude_classes=()):\n    \"\"\"Carry out processing needed to serialize ``col`` in an output table\n    consisting purely of plain ``Column`` or ``MaskedColumn`` columns.  This\n    relies on the object determine if any transformation is required and may\n    depend on the ``serialize_method`` and ``serialize_context`` context\n    variables.  For instance a ``MaskedColumn`` may be stored directly to\n    FITS, but can also be serialized as separate data and mask columns.\n\n    This function builds up a list of plain columns in the ``new_cols`` arg (which\n    is passed as a persistent list).  This includes both plain columns from the\n    original table and plain columns that represent data from serialized columns\n    (e.g. ``jd1`` and ``jd2`` arrays from a ``Time`` column).\n\n    For serialized columns the ``mixin_cols`` dict is updated with required\n    attributes and information to subsequently reconstruct the table.\n\n    Table mixin columns are always serialized and get represented by one\n    or more data columns.  In earlier versions of the code *only* mixin\n    columns were serialized, hence the use within this code of \"mixin\"\n    to imply serialization.  Starting with version 3.1, the non-mixin\n    ``MaskedColumn`` can also be serialized.\n    \"\"\"\n    obj_attrs = col.info._represent_as_dict()\n\n    # If serialization is not required (see function docstring above)\n    # or explicitly specified as excluded, then treat as a normal column.\n    if not obj_attrs or col.__class__ in exclude_classes:\n        new_cols.append(col)\n        return\n\n    # Subtlety here is handling mixin info attributes.  The basic list of such\n    # attributes is: 'name', 'unit', 'dtype', 'format', 'description', 'meta'.\n    # - name: handled directly [DON'T store]\n    # - unit: DON'T store if this is a parent attribute\n    # - dtype: captured in plain Column if relevant [DON'T store]\n    # - format: possibly irrelevant but settable post-object creation [DO store]\n    # - description: DO store\n    # - meta: DO store\n    info = {}\n    for attr, nontrivial in (('unit', lambda x: x is not None and x != ''),\n                             ('format', lambda x: x is not None),\n                             ('description', lambda x: x is not None),\n                             ('meta', lambda x: x)):\n        col_attr = getattr(col.info, attr)\n        if nontrivial(col_attr):\n            info[attr] = col_attr\n\n    # Find column attributes that have the same length as the column itself.\n    # These will be stored in the table as new columns (aka \"data attributes\").\n    # Examples include SkyCoord.ra (what is typically considered the data and is\n    # always an array) and Skycoord.obs_time (which can be a scalar or an\n    # array).\n    data_attrs = [key for key, value in obj_attrs.items() if\n                  getattr(value, 'shape', ())[:1] == col.shape[:1]]\n\n    for data_attr in data_attrs:\n        data = obj_attrs[data_attr]\n\n        # New column name combines the old name and attribute\n        # (e.g. skycoord.ra, skycoord.dec).unless it is the primary data\n        # attribute for the column (e.g. value for Quantity or data for\n        # MaskedColumn).  For primary data, we attempt to store any info on\n        # the format, etc., on the column, but not for ancillary data (e.g.,\n        # no sense to use a float format for a mask).\n        is_primary = data_attr == col.info._represent_as_dict_primary_data\n        if is_primary:\n            new_name = name\n            new_info = info\n        else:\n            new_name = name + '.' + data_attr\n            new_info = {}\n\n        if not has_info_class(data, MixinInfo):\n            col_cls = MaskedColumn if (hasattr(data, 'mask')\n                                       and np.any(data.mask)) else Column\n            new_cols.append(col_cls(data, name=new_name, **new_info))\n            obj_attrs[data_attr] = SerializedColumn({'name': new_name})\n            if is_primary:\n                # Don't store info in the __serialized_columns__ dict for this column\n                # since this is redundant with info stored on the new column.\n                info = {}\n        else:\n            # recurse. This will define obj_attrs[new_name].\n            _represent_mixin_as_column(data, new_name, new_cols, obj_attrs)\n            obj_attrs[data_attr] = SerializedColumn(obj_attrs.pop(new_name))\n\n    # Strip out from info any attributes defined by the parent,\n    # and store whatever remains.\n    for attr in col.info.attrs_from_parent:\n        if attr in info:\n            del info[attr]\n    if info:\n        obj_attrs['__info__'] = info\n\n    # Store the fully qualified class name\n    obj_attrs.setdefault('__class__',\n                         col.__module__ + '.' + col.__class__.__name__)\n\n    mixin_cols[name] = obj_attrs\n\n\ndef represent_mixins_as_columns(tbl, exclude_classes=()):\n    \"\"\"Represent input Table ``tbl`` using only `~astropy.table.Column`\n    or  `~astropy.table.MaskedColumn` objects.\n\n    This function represents any mixin columns like `~astropy.time.Time` in\n    ``tbl`` to one or more plain ``~astropy.table.Column`` objects and returns\n    a new Table.  A single mixin column may be split into multiple column\n    components as needed for fully representing the column.  This includes the\n    possibility of recursive splitting, as shown in the example below.  The\n    new column names are formed as ``<column_name>.<component>``, e.g.\n    ``sc.ra`` for a `~astropy.coordinates.SkyCoord` column named ``sc``.\n\n    In addition to splitting columns, this function updates the table ``meta``\n    dictionary to include a dict named ``__serialized_columns__`` which provides\n    additional information needed to construct the original mixin columns from\n    the split columns.\n\n    This function is used by astropy I/O when writing tables to ECSV, FITS,\n    HDF5 formats.\n\n    Note that if the table does not include any mixin columns then the original\n    table is returned with no update to ``meta``.\n\n    Parameters\n    ----------\n    tbl : `~astropy.table.Table` or subclass\n        Table to represent mixins as Columns\n    exclude_classes : tuple of class\n        Exclude any mixin columns which are instannces of any classes in the tuple\n\n    Returns\n    -------\n    tbl : `~astropy.table.Table`\n        New Table with updated columns, or else the original input ``tbl``\n\n    Examples\n    --------\n    >>> from astropy.table import Table, represent_mixins_as_columns\n    >>> from astropy.time import Time\n    >>> from astropy.coordinates import SkyCoord\n\n    >>> x = [100.0, 200.0]\n    >>> obstime = Time([1999.0, 2000.0], format='jyear')\n    >>> sc = SkyCoord([1, 2], [3, 4], unit='deg', obstime=obstime)\n    >>> tbl = Table([sc, x], names=['sc', 'x'])\n    >>> represent_mixins_as_columns(tbl)\n    <Table length=2>\n     sc.ra   sc.dec sc.obstime.jd1 sc.obstime.jd2    x\n      deg     deg\n    float64 float64    float64        float64     float64\n    ------- ------- -------------- -------------- -------\n        1.0     3.0      2451180.0          -0.25   100.0\n        2.0     4.0      2451545.0            0.0   200.0\n\n    \"\"\"\n    # Dict of metadata for serializing each column, keyed by column name.\n    # Gets filled in place by _represent_mixin_as_column().\n    mixin_cols = {}\n\n    # List of columns for the output table.  For plain Column objects\n    # this will just be the original column object.\n    new_cols = []\n\n    # Go through table columns and represent each column as one or more\n    # plain Column objects (in new_cols) + metadata (in mixin_cols).\n    for col in tbl.itercols():\n        _represent_mixin_as_column(col, col.info.name, new_cols, mixin_cols,\n                                   exclude_classes=exclude_classes)\n\n    # If no metadata was created then just return the original table.\n    if mixin_cols:\n        meta = deepcopy(tbl.meta)\n        meta['__serialized_columns__'] = mixin_cols\n        out = Table(new_cols, meta=meta, copy=False)\n    else:\n        out = tbl\n\n    for col in out.itercols():\n        if not isinstance(col, Column) and col.__class__ not in exclude_classes:\n            # This catches columns for which info has not been set up right and\n            # therefore were not converted. See the corresponding test in\n            # test_mixin.py for an example.\n            raise TypeError(\n                'failed to represent column '\n                f'{col.info.name!r} ({col.__class__.__name__}) as one '\n                'or more Column subclasses. This looks like a mixin class '\n                'that does not have the correct _represent_as_dict() method '\n                'in the class `info` attribute.')\n\n    return out\n\n\ndef _construct_mixin_from_obj_attrs_and_info(obj_attrs, info):\n    cls_full_name = obj_attrs.pop('__class__')\n\n    # If this is a supported class then import the class and run\n    # the _construct_from_col method.  Prevent accidentally running\n    # untrusted code by only importing known astropy classes.\n    if cls_full_name not in __construct_mixin_classes:\n        raise ValueError(f'unsupported class for construct {cls_full_name}')\n\n    mod_name, cls_name = re.match(r'(.+)\\.(\\w+)', cls_full_name).groups()\n    module = import_module(mod_name)\n    cls = getattr(module, cls_name)\n    for attr, value in info.items():\n        if attr in cls.info.attrs_from_parent:\n            obj_attrs[attr] = value\n    mixin = cls.info._construct_from_dict(obj_attrs)\n    for attr, value in info.items():\n        if attr not in obj_attrs:\n            setattr(mixin.info, attr, value)\n    return mixin\n\n\nclass _TableLite(OrderedDict):\n    \"\"\"\n    Minimal table-like object for _construct_mixin_from_columns.  This allows\n    manipulating the object like a Table but without the actual overhead\n    for a full Table.\n\n    More pressing, there is an issue with constructing MaskedColumn, where the\n    encoded Column components (data, mask) are turned into a MaskedColumn.\n    When this happens in a real table then all other columns are immediately\n    Masked and a warning is issued. This is not desirable.\n    \"\"\"\n\n    def add_column(self, col, index=0):\n        colnames = self.colnames\n        self[col.info.name] = col\n        for ii, name in enumerate(colnames):\n            if ii >= index:\n                self.move_to_end(name)\n\n    @property\n    def colnames(self):\n        return list(self.keys())\n\n    def itercols(self):\n        return self.values()\n\n\ndef _construct_mixin_from_columns(new_name, obj_attrs, out):\n    data_attrs_map = {}\n    for name, val in obj_attrs.items():\n        if isinstance(val, SerializedColumn):\n            if 'name' in val:\n                data_attrs_map[val['name']] = name\n            else:\n                out_name = f'{new_name}.{name}'\n                _construct_mixin_from_columns(out_name, val, out)\n                data_attrs_map[out_name] = name\n\n    for name in data_attrs_map.values():\n        del obj_attrs[name]\n\n    # Get the index where to add new column\n    idx = min(out.colnames.index(name) for name in data_attrs_map)\n\n    # Name is the column name in the table (e.g. \"coord.ra\") and\n    # data_attr is the object attribute name  (e.g. \"ra\").  A different\n    # example would be a formatted time object that would have (e.g.)\n    # \"time_col\" and \"value\", respectively.\n    for name, data_attr in data_attrs_map.items():\n        obj_attrs[data_attr] = out[name]\n        del out[name]\n\n    info = obj_attrs.pop('__info__', {})\n    if len(data_attrs_map) == 1:\n        # col is the first and only serialized column; in that case, use info\n        # stored on the column. First step is to get that first column which\n        # has been moved from `out` to `obj_attrs` above.\n        data_attr = next(iter(data_attrs_map.values()))\n        col = obj_attrs[data_attr]\n\n        # Now copy the relevant attributes\n        for attr, nontrivial in (('unit', lambda x: x not in (None, '')),\n                                 ('format', lambda x: x is not None),\n                                 ('description', lambda x: x is not None),\n                                 ('meta', lambda x: x)):\n            col_attr = getattr(col.info, attr)\n            if nontrivial(col_attr):\n                info[attr] = col_attr\n\n    info['name'] = new_name\n    col = _construct_mixin_from_obj_attrs_and_info(obj_attrs, info)\n    out.add_column(col, index=idx)\n\n\ndef _construct_mixins_from_columns(tbl):\n    if '__serialized_columns__' not in tbl.meta:\n        return tbl\n\n    meta = tbl.meta.copy()\n    mixin_cols = meta.pop('__serialized_columns__')\n\n    out = _TableLite(tbl.columns)\n\n    for new_name, obj_attrs in mixin_cols.items():\n        _construct_mixin_from_columns(new_name, obj_attrs, out)\n\n    # If no quantity subclasses are in the output then output as Table.\n    # For instance ascii.read(file, format='ecsv') doesn't specify an\n    # output class and should return the minimal table class that\n    # represents the table file.\n    has_quantities = any(isinstance(col.info, QuantityInfo)\n                         for col in out.itercols())\n    out_cls = QTable if has_quantities else Table\n\n    return out_cls(list(out.values()), names=out.colnames, copy=False, meta=meta)\n"},{"attributeType":"null","col":12,"comment":"null","endLoc":245,"id":9433,"name":"_binary_dilation","nodeType":"Attribute","startLoc":245,"text":"self._binary_dilation"},{"className":"_TableLite","col":0,"comment":"\n    Minimal table-like object for _construct_mixin_from_columns.  This allows\n    manipulating the object like a Table but without the actual overhead\n    for a full Table.\n\n    More pressing, there is an issue with constructing MaskedColumn, where the\n    encoded Column components (data, mask) are turned into a MaskedColumn.\n    When this happens in a real table then all other columns are immediately\n    Masked and a warning is issued. This is not desirable.\n    ","endLoc":312,"id":9434,"nodeType":"Class","startLoc":288,"text":"class _TableLite(OrderedDict):\n    \"\"\"\n    Minimal table-like object for _construct_mixin_from_columns.  This allows\n    manipulating the object like a Table but without the actual overhead\n    for a full Table.\n\n    More pressing, there is an issue with constructing MaskedColumn, where the\n    encoded Column components (data, mask) are turned into a MaskedColumn.\n    When this happens in a real table then all other columns are immediately\n    Masked and a warning is issued. This is not desirable.\n    \"\"\"\n\n    def add_column(self, col, index=0):\n        colnames = self.colnames\n        self[col.info.name] = col\n        for ii, name in enumerate(colnames):\n            if ii >= index:\n                self.move_to_end(name)\n\n    @property\n    def colnames(self):\n        return list(self.keys())\n\n    def itercols(self):\n        return self.values()"},{"attributeType":"null","col":8,"comment":"null","endLoc":238,"id":9435,"name":"_niterations","nodeType":"Attribute","startLoc":238,"text":"self._niterations"},{"col":4,"comment":"null","endLoc":305,"header":"def add_column(self, col, index=0)","id":9436,"name":"add_column","nodeType":"Function","startLoc":300,"text":"def add_column(self, col, index=0):\n        colnames = self.colnames\n        self[col.info.name] = col\n        for ii, name in enumerate(colnames):\n            if ii >= index:\n                self.move_to_end(name)"},{"col":4,"comment":"Interactive \"more\" of a table or column.\n\n        Parameters\n        ----------\n        max_lines : int or None\n            Maximum number of rows to output\n\n        max_width : int or None\n            Maximum character width of output\n\n        show_name : bool\n            Include a header row for column names. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        show_dtype : bool\n            Include a header row for column dtypes. Default is False.\n        ","endLoc":758,"header":"def _more_tabcol(self, tabcol, max_lines=None, max_width=None,\n                     show_name=True, show_unit=None, show_dtype=False)","id":9437,"name":"_more_tabcol","nodeType":"Function","startLoc":642,"text":"def _more_tabcol(self, tabcol, max_lines=None, max_width=None,\n                     show_name=True, show_unit=None, show_dtype=False):\n        \"\"\"Interactive \"more\" of a table or column.\n\n        Parameters\n        ----------\n        max_lines : int or None\n            Maximum number of rows to output\n\n        max_width : int or None\n            Maximum character width of output\n\n        show_name : bool\n            Include a header row for column names. Default is True.\n\n        show_unit : bool\n            Include a header row for unit.  Default is to show a row\n            for units only if one or more columns has a defined value\n            for the unit.\n\n        show_dtype : bool\n            Include a header row for column dtypes. Default is False.\n        \"\"\"\n        allowed_keys = 'f br<>qhpn'\n\n        # Count the header lines\n        n_header = 0\n        if show_name:\n            n_header += 1\n        if show_unit:\n            n_header += 1\n        if show_dtype:\n            n_header += 1\n        if show_name or show_unit or show_dtype:\n            n_header += 1\n\n        # Set up kwargs for pformat call.  Only Table gets max_width.\n        kwargs = dict(max_lines=-1, show_name=show_name, show_unit=show_unit,\n                      show_dtype=show_dtype)\n        if hasattr(tabcol, 'columns'):  # tabcol is a table\n            kwargs['max_width'] = max_width\n\n        # If max_lines is None (=> query screen size) then increase by 2.\n        # This is because get_pprint_size leaves 6 extra lines so that in\n        # ipython you normally see the last input line.\n        max_lines1, max_width = self._get_pprint_size(max_lines, max_width)\n        if max_lines is None:\n            max_lines1 += 2\n        delta_lines = max_lines1 - n_header\n\n        # Set up a function to get a single character on any platform\n        inkey = Getch()\n\n        i0 = 0  # First table/column row to show\n        showlines = True\n        while True:\n            i1 = i0 + delta_lines  # Last table/col row to show\n            if showlines:  # Don't always show the table (e.g. after help)\n                try:\n                    os.system('cls' if os.name == 'nt' else 'clear')\n                except Exception:\n                    pass  # No worries if clear screen call fails\n                lines = tabcol[i0:i1].pformat(**kwargs)\n                colors = ('red' if i < n_header else 'default'\n                          for i in range(len(lines)))\n                for color, line in zip(colors, lines):\n                    color_print(line, color)\n            showlines = True\n            print()\n            print(\"-- f, <space>, b, r, p, n, <, >, q h (help) --\", end=' ')\n            # Get a valid key\n            while True:\n                try:\n                    key = inkey().lower()\n                except Exception:\n                    print(\"\\n\")\n                    log.error('Console does not support getting a character'\n                              ' as required by more().  Use pprint() instead.')\n                    return\n                if key in allowed_keys:\n                    break\n            print(key)\n\n            if key.lower() == 'q':\n                break\n            elif key == ' ' or key == 'f':\n                i0 += delta_lines\n            elif key == 'b':\n                i0 = i0 - delta_lines\n            elif key == 'r':\n                pass\n            elif key == '<':\n                i0 = 0\n            elif key == '>':\n                i0 = len(tabcol)\n            elif key == 'p':\n                i0 -= 1\n            elif key == 'n':\n                i0 += 1\n            elif key == 'h':\n                showlines = False\n                print(\"\"\"\n    Browsing keys:\n       f, <space> : forward one page\n       b : back one page\n       r : refresh same page\n       n : next row\n       p : previous row\n       < : go to beginning\n       > : go to end\n       q : quit browsing\n       h : print this help\"\"\", end=' ')\n            if i0 < 0:\n                i0 = 0\n            if i0 >= len(tabcol) - delta_lines:\n                i0 = len(tabcol) - delta_lines\n            print(\"\\n\")"},{"attributeType":"null","col":8,"comment":"null","endLoc":232,"id":9438,"name":"cenfunc","nodeType":"Attribute","startLoc":232,"text":"self.cenfunc"},{"attributeType":"function | function","col":8,"comment":"null","endLoc":235,"id":9439,"name":"_stdfunc_parsed","nodeType":"Attribute","startLoc":235,"text":"self._stdfunc_parsed"},{"attributeType":"null","col":8,"comment":"null","endLoc":236,"id":9440,"name":"_min_value","nodeType":"Attribute","startLoc":236,"text":"self._min_value"},{"attributeType":"null","col":8,"comment":"null","endLoc":231,"id":9441,"name":"maxiters","nodeType":"Attribute","startLoc":231,"text":"self.maxiters"},{"attributeType":"null","col":8,"comment":"null","endLoc":233,"id":9442,"name":"stdfunc","nodeType":"Attribute","startLoc":233,"text":"self.stdfunc"},{"col":4,"comment":"null","endLoc":306,"header":"def __delitem__(self, name)","id":9443,"name":"__delitem__","nodeType":"Function","startLoc":298,"text":"def __delitem__(self, name):\n        # Remove column names from pprint include/exclude attributes as needed.\n        # __delitem__ also gets called for pop() and popitem().\n        parent_table = self[name].info.parent_table\n        if parent_table is not None:\n            # _remove() method does not require that `name` is in the attribute\n            parent_table.pprint_exclude_names._remove(name)\n            parent_table.pprint_include_names._remove(name)\n        return super().__delitem__(name)"},{"attributeType":"null","col":8,"comment":"null","endLoc":237,"id":9444,"name":"_max_value","nodeType":"Attribute","startLoc":237,"text":"self._max_value"},{"col":0,"comment":"\n    Perform sigma-clipping on the provided data.\n\n    The data will be iterated over, each time rejecting values that are\n    less or more than a specified number of standard deviations from a\n    center value.\n\n    Clipped (rejected) pixels are those where::\n\n        data < center - (sigma_lower * std)\n        data > center + (sigma_upper * std)\n\n    where::\n\n        center = cenfunc(data [, axis=])\n        std = stdfunc(data [, axis=])\n\n    Invalid data values (i.e., NaN or inf) are automatically clipped.\n\n    For an object-oriented interface to sigma clipping, see\n    :class:`SigmaClip`.\n\n    .. note::\n        `scipy.stats.sigmaclip` provides a subset of the functionality\n        in this class. Also, its input data cannot be a masked array\n        and it does not handle data that contains invalid values (i.e.,\n        NaN or inf). Also note that it uses the mean as the centering\n        function. The equivalent settings to `scipy.stats.sigmaclip`\n        are::\n\n            sigma_clip(sigma=4., cenfunc='mean', maxiters=None, axis=None,\n            ...        masked=False, return_bounds=True)\n\n    Parameters\n    ----------\n    data : array-like or `~numpy.ma.MaskedArray`\n        The data to be sigma clipped.\n\n    sigma : float, optional\n        The number of standard deviations to use for both the lower\n        and upper clipping limit. These limits are overridden by\n        ``sigma_lower`` and ``sigma_upper``, if input. The default is 3.\n\n    sigma_lower : float or None, optional\n        The number of standard deviations to use as the lower bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    sigma_upper : float or None, optional\n        The number of standard deviations to use as the upper bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    maxiters : int or None, optional\n        The maximum number of sigma-clipping iterations to perform or\n        `None` to clip until convergence is achieved (i.e., iterate\n        until the last iteration clips nothing). If convergence is\n        achieved prior to ``maxiters`` iterations, the clipping\n        iterations will stop. The default is 5.\n\n    cenfunc : {'median', 'mean'} or callable, optional\n        The statistic or callable function/object used to compute\n        the center value for the clipping. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanmean`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'median'``.\n\n    stdfunc : {'std', 'mad_std'} or callable, optional\n        The statistic or callable function/object used to compute the\n        standard deviation about the center value. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanstd`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'std'``.\n\n    axis : None or int or tuple of int, optional\n        The axis or axes along which to sigma clip the data. If `None`,\n        then the flattened data will be used. ``axis`` is passed to the\n        ``cenfunc`` and ``stdfunc``. The default is `None`.\n\n    masked : bool, optional\n        If `True`, then a `~numpy.ma.MaskedArray` is returned, where\n        the mask is `True` for clipped values. If `False`, then a\n        `~numpy.ndarray` and the minimum and maximum clipping thresholds\n        are returned. The default is `True`.\n\n    return_bounds : bool, optional\n        If `True`, then the minimum and maximum clipping bounds are also\n        returned.\n\n    copy : bool, optional\n        If `True`, then the ``data`` array will be copied. If `False`\n        and ``masked=True``, then the returned masked array data will\n        contain the same array as the input ``data`` (if ``data`` is a\n        `~numpy.ndarray` or `~numpy.ma.MaskedArray`). If `False` and\n        ``masked=False``, the input data is modified in-place. The\n        default is `True`.\n\n    grow : float or `False`, optional\n        Radius within which to mask the neighbouring pixels of those\n        that fall outwith the clipping limits (only applied along\n        ``axis``, if specified). As an example, for a 2D image a value\n        of 1 will mask the nearest pixels in a cross pattern around each\n        deviant pixel, while 1.5 will also reject the nearest diagonal\n        neighbours and so on.\n\n    Returns\n    -------\n    result : array-like\n        If ``masked=True``, then a `~numpy.ma.MaskedArray` is returned,\n        where the mask is `True` for clipped values and where the input\n        mask was `True`.\n\n        If ``masked=False``, then a `~numpy.ndarray` is returned.\n\n        If ``return_bounds=True``, then in addition to the masked array\n        or array above, the minimum and maximum clipping bounds are\n        returned.\n\n        If ``masked=False`` and ``axis=None``, then the output array\n        is a flattened 1D `~numpy.ndarray` where the clipped values\n        have been removed. If ``return_bounds=True`` then the returned\n        minimum and maximum thresholds are scalars.\n\n        If ``masked=False`` and ``axis`` is specified, then the output\n        `~numpy.ndarray` will have the same shape as the input ``data``\n        and contain ``np.nan`` where values were clipped. If the input\n        ``data`` was a masked array, then the output `~numpy.ndarray`\n        will also contain ``np.nan`` where the input mask was `True`.\n        If ``return_bounds=True`` then the returned minimum and maximum\n        clipping thresholds will be be `~numpy.ndarray`\\s.\n\n    See Also\n    --------\n    SigmaClip, sigma_clipped_stats\n\n    Notes\n    -----\n    The best performance will typically be obtained by setting\n    ``cenfunc`` and ``stdfunc`` to one of the built-in functions\n    specified as as string. If one of the options is set to a string\n    while the other has a custom callable, you may in some cases see\n    better performance if you have the `bottleneck`_ package installed.\n\n    .. _bottleneck:  https://github.com/pydata/bottleneck\n\n    Examples\n    --------\n    This example uses a data array of random variates from a Gaussian\n    distribution. We clip all points that are more than 2 sample\n    standard deviations from the median. The result is a masked array,\n    where the mask is `True` for clipped data::\n\n        >>> from astropy.stats import sigma_clip\n        >>> from numpy.random import randn\n        >>> randvar = randn(10000)\n        >>> filtered_data = sigma_clip(randvar, sigma=2, maxiters=5)\n\n    This example clips all points that are more than 3 sigma relative\n    to the sample *mean*, clips until convergence, returns an unmasked\n    `~numpy.ndarray`, and does not copy the data::\n\n        >>> from astropy.stats import sigma_clip\n        >>> from numpy.random import randn\n        >>> from numpy import mean\n        >>> randvar = randn(10000)\n        >>> filtered_data = sigma_clip(randvar, sigma=3, maxiters=None,\n        ...                            cenfunc=mean, masked=False, copy=False)\n\n    This example sigma clips along one axis::\n\n        >>> from astropy.stats import sigma_clip\n        >>> from numpy.random import normal\n        >>> from numpy import arange, diag, ones\n        >>> data = arange(5) + normal(0., 0.05, (5, 5)) + diag(ones(5))\n        >>> filtered_data = sigma_clip(data, sigma=2.3, axis=0)\n\n    Note that along the other axis, no points would be clipped, as the\n    standard deviation is higher.\n    ","endLoc":836,"header":"def sigma_clip(data, sigma=3, sigma_lower=None, sigma_upper=None, maxiters=5,\n               cenfunc='median', stdfunc='std', axis=None, masked=True,\n               return_bounds=False, copy=True, grow=False)","id":9445,"name":"sigma_clip","nodeType":"Function","startLoc":647,"text":"def sigma_clip(data, sigma=3, sigma_lower=None, sigma_upper=None, maxiters=5,\n               cenfunc='median', stdfunc='std', axis=None, masked=True,\n               return_bounds=False, copy=True, grow=False):\n    \"\"\"\n    Perform sigma-clipping on the provided data.\n\n    The data will be iterated over, each time rejecting values that are\n    less or more than a specified number of standard deviations from a\n    center value.\n\n    Clipped (rejected) pixels are those where::\n\n        data < center - (sigma_lower * std)\n        data > center + (sigma_upper * std)\n\n    where::\n\n        center = cenfunc(data [, axis=])\n        std = stdfunc(data [, axis=])\n\n    Invalid data values (i.e., NaN or inf) are automatically clipped.\n\n    For an object-oriented interface to sigma clipping, see\n    :class:`SigmaClip`.\n\n    .. note::\n        `scipy.stats.sigmaclip` provides a subset of the functionality\n        in this class. Also, its input data cannot be a masked array\n        and it does not handle data that contains invalid values (i.e.,\n        NaN or inf). Also note that it uses the mean as the centering\n        function. The equivalent settings to `scipy.stats.sigmaclip`\n        are::\n\n            sigma_clip(sigma=4., cenfunc='mean', maxiters=None, axis=None,\n            ...        masked=False, return_bounds=True)\n\n    Parameters\n    ----------\n    data : array-like or `~numpy.ma.MaskedArray`\n        The data to be sigma clipped.\n\n    sigma : float, optional\n        The number of standard deviations to use for both the lower\n        and upper clipping limit. These limits are overridden by\n        ``sigma_lower`` and ``sigma_upper``, if input. The default is 3.\n\n    sigma_lower : float or None, optional\n        The number of standard deviations to use as the lower bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    sigma_upper : float or None, optional\n        The number of standard deviations to use as the upper bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    maxiters : int or None, optional\n        The maximum number of sigma-clipping iterations to perform or\n        `None` to clip until convergence is achieved (i.e., iterate\n        until the last iteration clips nothing). If convergence is\n        achieved prior to ``maxiters`` iterations, the clipping\n        iterations will stop. The default is 5.\n\n    cenfunc : {'median', 'mean'} or callable, optional\n        The statistic or callable function/object used to compute\n        the center value for the clipping. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanmean`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'median'``.\n\n    stdfunc : {'std', 'mad_std'} or callable, optional\n        The statistic or callable function/object used to compute the\n        standard deviation about the center value. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanstd`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'std'``.\n\n    axis : None or int or tuple of int, optional\n        The axis or axes along which to sigma clip the data. If `None`,\n        then the flattened data will be used. ``axis`` is passed to the\n        ``cenfunc`` and ``stdfunc``. The default is `None`.\n\n    masked : bool, optional\n        If `True`, then a `~numpy.ma.MaskedArray` is returned, where\n        the mask is `True` for clipped values. If `False`, then a\n        `~numpy.ndarray` and the minimum and maximum clipping thresholds\n        are returned. The default is `True`.\n\n    return_bounds : bool, optional\n        If `True`, then the minimum and maximum clipping bounds are also\n        returned.\n\n    copy : bool, optional\n        If `True`, then the ``data`` array will be copied. If `False`\n        and ``masked=True``, then the returned masked array data will\n        contain the same array as the input ``data`` (if ``data`` is a\n        `~numpy.ndarray` or `~numpy.ma.MaskedArray`). If `False` and\n        ``masked=False``, the input data is modified in-place. The\n        default is `True`.\n\n    grow : float or `False`, optional\n        Radius within which to mask the neighbouring pixels of those\n        that fall outwith the clipping limits (only applied along\n        ``axis``, if specified). As an example, for a 2D image a value\n        of 1 will mask the nearest pixels in a cross pattern around each\n        deviant pixel, while 1.5 will also reject the nearest diagonal\n        neighbours and so on.\n\n    Returns\n    -------\n    result : array-like\n        If ``masked=True``, then a `~numpy.ma.MaskedArray` is returned,\n        where the mask is `True` for clipped values and where the input\n        mask was `True`.\n\n        If ``masked=False``, then a `~numpy.ndarray` is returned.\n\n        If ``return_bounds=True``, then in addition to the masked array\n        or array above, the minimum and maximum clipping bounds are\n        returned.\n\n        If ``masked=False`` and ``axis=None``, then the output array\n        is a flattened 1D `~numpy.ndarray` where the clipped values\n        have been removed. If ``return_bounds=True`` then the returned\n        minimum and maximum thresholds are scalars.\n\n        If ``masked=False`` and ``axis`` is specified, then the output\n        `~numpy.ndarray` will have the same shape as the input ``data``\n        and contain ``np.nan`` where values were clipped. If the input\n        ``data`` was a masked array, then the output `~numpy.ndarray`\n        will also contain ``np.nan`` where the input mask was `True`.\n        If ``return_bounds=True`` then the returned minimum and maximum\n        clipping thresholds will be be `~numpy.ndarray`\\\\s.\n\n    See Also\n    --------\n    SigmaClip, sigma_clipped_stats\n\n    Notes\n    -----\n    The best performance will typically be obtained by setting\n    ``cenfunc`` and ``stdfunc`` to one of the built-in functions\n    specified as as string. If one of the options is set to a string\n    while the other has a custom callable, you may in some cases see\n    better performance if you have the `bottleneck`_ package installed.\n\n    .. _bottleneck:  https://github.com/pydata/bottleneck\n\n    Examples\n    --------\n    This example uses a data array of random variates from a Gaussian\n    distribution. We clip all points that are more than 2 sample\n    standard deviations from the median. The result is a masked array,\n    where the mask is `True` for clipped data::\n\n        >>> from astropy.stats import sigma_clip\n        >>> from numpy.random import randn\n        >>> randvar = randn(10000)\n        >>> filtered_data = sigma_clip(randvar, sigma=2, maxiters=5)\n\n    This example clips all points that are more than 3 sigma relative\n    to the sample *mean*, clips until convergence, returns an unmasked\n    `~numpy.ndarray`, and does not copy the data::\n\n        >>> from astropy.stats import sigma_clip\n        >>> from numpy.random import randn\n        >>> from numpy import mean\n        >>> randvar = randn(10000)\n        >>> filtered_data = sigma_clip(randvar, sigma=3, maxiters=None,\n        ...                            cenfunc=mean, masked=False, copy=False)\n\n    This example sigma clips along one axis::\n\n        >>> from astropy.stats import sigma_clip\n        >>> from numpy.random import normal\n        >>> from numpy import arange, diag, ones\n        >>> data = arange(5) + normal(0., 0.05, (5, 5)) + diag(ones(5))\n        >>> filtered_data = sigma_clip(data, sigma=2.3, axis=0)\n\n    Note that along the other axis, no points would be clipped, as the\n    standard deviation is higher.\n    \"\"\"\n    sigclip = SigmaClip(sigma=sigma, sigma_lower=sigma_lower,\n                        sigma_upper=sigma_upper, maxiters=maxiters,\n                        cenfunc=cenfunc, stdfunc=stdfunc, grow=grow)\n\n    return sigclip(data, axis=axis, masked=masked,\n                   return_bounds=return_bounds, copy=copy)"},{"col":0,"comment":"\n    Returns the unique rows of a table.\n\n    Parameters\n    ----------\n    input_table : table-like\n    keys : str or list of str\n        Name(s) of column(s) used to create unique rows.\n        Default is to use all columns.\n    keep : {'first', 'last', 'none'}\n        Whether to keep the first or last row for each set of\n        duplicates. If 'none', all rows that are duplicate are\n        removed, leaving only rows that are already unique in\n        the input.\n        Default is 'first'.\n    silent : bool\n        If `True`, masked value column(s) are silently removed from\n        ``keys``. If `False`, an exception is raised when ``keys``\n        contains masked value column(s).\n        Default is `False`.\n\n    Returns\n    -------\n    unique_table : `~astropy.table.Table` object\n        New table containing only the unique rows of ``input_table``.\n\n    Examples\n    --------\n    >>> from astropy.table import unique, Table\n    >>> import numpy as np\n    >>> table = Table(data=[[1,2,3,2,3,3],\n    ... [2,3,4,5,4,6],\n    ... [3,4,5,6,7,8]],\n    ... names=['col1', 'col2', 'col3'],\n    ... dtype=[np.int32, np.int32, np.int32])\n    >>> table\n    <Table length=6>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n        2     3     4\n        3     4     5\n        2     5     6\n        3     4     7\n        3     6     8\n    >>> unique(table, keys='col1')\n    <Table length=3>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n        2     3     4\n        3     4     5\n    >>> unique(table, keys=['col1'], keep='last')\n    <Table length=3>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n        2     5     6\n        3     6     8\n    >>> unique(table, keys=['col1', 'col2'])\n    <Table length=5>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n        2     3     4\n        2     5     6\n        3     4     5\n        3     6     8\n    >>> unique(table, keys=['col1', 'col2'], keep='none')\n    <Table length=4>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n        2     3     4\n        2     5     6\n        3     6     8\n    >>> unique(table, keys=['col1'], keep='none')\n    <Table length=1>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n\n    ","endLoc":863,"header":"def unique(input_table, keys=None, silent=False, keep='first')","id":9446,"name":"unique","nodeType":"Function","startLoc":737,"text":"def unique(input_table, keys=None, silent=False, keep='first'):\n    \"\"\"\n    Returns the unique rows of a table.\n\n    Parameters\n    ----------\n    input_table : table-like\n    keys : str or list of str\n        Name(s) of column(s) used to create unique rows.\n        Default is to use all columns.\n    keep : {'first', 'last', 'none'}\n        Whether to keep the first or last row for each set of\n        duplicates. If 'none', all rows that are duplicate are\n        removed, leaving only rows that are already unique in\n        the input.\n        Default is 'first'.\n    silent : bool\n        If `True`, masked value column(s) are silently removed from\n        ``keys``. If `False`, an exception is raised when ``keys``\n        contains masked value column(s).\n        Default is `False`.\n\n    Returns\n    -------\n    unique_table : `~astropy.table.Table` object\n        New table containing only the unique rows of ``input_table``.\n\n    Examples\n    --------\n    >>> from astropy.table import unique, Table\n    >>> import numpy as np\n    >>> table = Table(data=[[1,2,3,2,3,3],\n    ... [2,3,4,5,4,6],\n    ... [3,4,5,6,7,8]],\n    ... names=['col1', 'col2', 'col3'],\n    ... dtype=[np.int32, np.int32, np.int32])\n    >>> table\n    <Table length=6>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n        2     3     4\n        3     4     5\n        2     5     6\n        3     4     7\n        3     6     8\n    >>> unique(table, keys='col1')\n    <Table length=3>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n        2     3     4\n        3     4     5\n    >>> unique(table, keys=['col1'], keep='last')\n    <Table length=3>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n        2     5     6\n        3     6     8\n    >>> unique(table, keys=['col1', 'col2'])\n    <Table length=5>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n        2     3     4\n        2     5     6\n        3     4     5\n        3     6     8\n    >>> unique(table, keys=['col1', 'col2'], keep='none')\n    <Table length=4>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n        2     3     4\n        2     5     6\n        3     6     8\n    >>> unique(table, keys=['col1'], keep='none')\n    <Table length=1>\n     col1  col2  col3\n    int32 int32 int32\n    ----- ----- -----\n        1     2     3\n\n    \"\"\"\n\n    if keep not in ('first', 'last', 'none'):\n        raise ValueError(\"'keep' should be one of 'first', 'last', 'none'\")\n\n    if isinstance(keys, str):\n        keys = [keys]\n    if keys is None:\n        keys = input_table.colnames\n    else:\n        if len(set(keys)) != len(keys):\n            raise ValueError(\"duplicate key names\")\n\n    # Check for columns with masked values\n    for key in keys[:]:\n        col = input_table[key]\n        if hasattr(col, 'mask') and np.any(col.mask):\n            if not silent:\n                raise ValueError(\n                    \"cannot use columns with masked values as keys; \"\n                    \"remove column '{}' from keys and rerun \"\n                    \"unique()\".format(key))\n            del keys[keys.index(key)]\n    if len(keys) == 0:\n        raise ValueError(\"no column remained in ``keys``; \"\n                         \"unique() cannot work with masked value \"\n                         \"key columns\")\n\n    grouped_table = input_table.group_by(keys)\n    indices = grouped_table.groups.indices\n    if keep == 'first':\n        indices = indices[:-1]\n    elif keep == 'last':\n        indices = indices[1:] - 1\n    else:\n        indices = indices[:-1][np.diff(indices) == 1]\n\n    return grouped_table[indices]"},{"col":4,"comment":"\n        Return a list of columns which are instances of the specified classes.\n\n        Parameters\n        ----------\n        cls : class or tuple thereof\n            Column class (including mixin) or tuple of Column classes.\n\n        Returns\n        -------\n        col_list : list of `Column`\n            List of Column objects which are instances of given classes.\n        ","endLoc":323,"header":"def isinstance(self, cls)","id":9447,"name":"isinstance","nodeType":"Function","startLoc":308,"text":"def isinstance(self, cls):\n        \"\"\"\n        Return a list of columns which are instances of the specified classes.\n\n        Parameters\n        ----------\n        cls : class or tuple thereof\n            Column class (including mixin) or tuple of Column classes.\n\n        Returns\n        -------\n        col_list : list of `Column`\n            List of Column objects which are instances of given classes.\n        \"\"\"\n        cols = [col for col in self.values() if isinstance(col, cls)]\n        return cols"},{"col":4,"comment":"\n        Return a list of columns which are not instances of the specified classes.\n\n        Parameters\n        ----------\n        cls : class or tuple thereof\n            Column class (including mixin) or tuple of Column classes.\n\n        Returns\n        -------\n        col_list : list of `Column`\n            List of Column objects which are not instances of given classes.\n        ","endLoc":340,"header":"def not_isinstance(self, cls)","id":9448,"name":"not_isinstance","nodeType":"Function","startLoc":325,"text":"def not_isinstance(self, cls):\n        \"\"\"\n        Return a list of columns which are not instances of the specified classes.\n\n        Parameters\n        ----------\n        cls : class or tuple thereof\n            Column class (including mixin) or tuple of Column classes.\n\n        Returns\n        -------\n        col_list : list of `Column`\n            List of Column objects which are not instances of given classes.\n        \"\"\"\n        cols = [col for col in self.values() if not isinstance(col, cls)]\n        return cols"},{"col":0,"comment":"\n    Calculate sigma-clipped statistics on the provided data.\n\n    Parameters\n    ----------\n    data : array-like or `~numpy.ma.MaskedArray`\n        Data array or object that can be converted to an array.\n\n    mask : `numpy.ndarray` (bool), optional\n        A boolean mask with the same shape as ``data``, where a `True`\n        value indicates the corresponding element of ``data`` is masked.\n        Masked pixels are excluded when computing the statistics.\n\n    mask_value : float, optional\n        A data value (e.g., ``0.0``) that is ignored when computing the\n        statistics. ``mask_value`` will be masked in addition to any\n        input ``mask``.\n\n    sigma : float, optional\n        The number of standard deviations to use for both the lower\n        and upper clipping limit. These limits are overridden by\n        ``sigma_lower`` and ``sigma_upper``, if input. The default is 3.\n\n    sigma_lower : float or None, optional\n        The number of standard deviations to use as the lower bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    sigma_upper : float or None, optional\n        The number of standard deviations to use as the upper bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    maxiters : int or None, optional\n        The maximum number of sigma-clipping iterations to perform or\n        `None` to clip until convergence is achieved (i.e., iterate\n        until the last iteration clips nothing). If convergence is\n        achieved prior to ``maxiters`` iterations, the clipping\n        iterations will stop. The default is 5.\n\n    cenfunc : {'median', 'mean'} or callable, optional\n        The statistic or callable function/object used to compute\n        the center value for the clipping. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanmean`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'median'``.\n\n    stdfunc : {'std', 'mad_std'} or callable, optional\n        The statistic or callable function/object used to compute the\n        standard deviation about the center value. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanstd`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'std'``.\n\n    std_ddof : int, optional\n        The delta degrees of freedom for the standard deviation\n        calculation. The divisor used in the calculation is ``N -\n        std_ddof``, where ``N`` represents the number of elements. The\n        default is 0.\n\n    axis : None or int or tuple of int, optional\n        The axis or axes along which to sigma clip the data. If `None`,\n        then the flattened data will be used. ``axis`` is passed to the\n        ``cenfunc`` and ``stdfunc``. The default is `None`.\n\n    grow : float or `False`, optional\n        Radius within which to mask the neighbouring pixels of those\n        that fall outwith the clipping limits (only applied along\n        ``axis``, if specified). As an example, for a 2D image a value\n        of 1 will mask the nearest pixels in a cross pattern around each\n        deviant pixel, while 1.5 will also reject the nearest diagonal\n        neighbours and so on.\n\n    Notes\n    -----\n    The best performance will typically be obtained by setting\n    ``cenfunc`` and ``stdfunc`` to one of the built-in functions\n    specified as as string. If one of the options is set to a string\n    while the other has a custom callable, you may in some cases see\n    better performance if you have the `bottleneck`_ package installed.\n\n    .. _bottleneck:  https://github.com/pydata/bottleneck\n\n    Returns\n    -------\n    mean, median, stddev : float\n        The mean, median, and standard deviation of the sigma-clipped\n        data.\n\n    See Also\n    --------\n    SigmaClip, sigma_clip\n    ","endLoc":961,"header":"def sigma_clipped_stats(data, mask=None, mask_value=None, sigma=3.0,\n                        sigma_lower=None, sigma_upper=None, maxiters=5,\n                        cenfunc='median', stdfunc='std', std_ddof=0,\n                        axis=None, grow=False)","id":9449,"name":"sigma_clipped_stats","nodeType":"Function","startLoc":839,"text":"def sigma_clipped_stats(data, mask=None, mask_value=None, sigma=3.0,\n                        sigma_lower=None, sigma_upper=None, maxiters=5,\n                        cenfunc='median', stdfunc='std', std_ddof=0,\n                        axis=None, grow=False):\n    \"\"\"\n    Calculate sigma-clipped statistics on the provided data.\n\n    Parameters\n    ----------\n    data : array-like or `~numpy.ma.MaskedArray`\n        Data array or object that can be converted to an array.\n\n    mask : `numpy.ndarray` (bool), optional\n        A boolean mask with the same shape as ``data``, where a `True`\n        value indicates the corresponding element of ``data`` is masked.\n        Masked pixels are excluded when computing the statistics.\n\n    mask_value : float, optional\n        A data value (e.g., ``0.0``) that is ignored when computing the\n        statistics. ``mask_value`` will be masked in addition to any\n        input ``mask``.\n\n    sigma : float, optional\n        The number of standard deviations to use for both the lower\n        and upper clipping limit. These limits are overridden by\n        ``sigma_lower`` and ``sigma_upper``, if input. The default is 3.\n\n    sigma_lower : float or None, optional\n        The number of standard deviations to use as the lower bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    sigma_upper : float or None, optional\n        The number of standard deviations to use as the upper bound for\n        the clipping limit. If `None` then the value of ``sigma`` is\n        used. The default is `None`.\n\n    maxiters : int or None, optional\n        The maximum number of sigma-clipping iterations to perform or\n        `None` to clip until convergence is achieved (i.e., iterate\n        until the last iteration clips nothing). If convergence is\n        achieved prior to ``maxiters`` iterations, the clipping\n        iterations will stop. The default is 5.\n\n    cenfunc : {'median', 'mean'} or callable, optional\n        The statistic or callable function/object used to compute\n        the center value for the clipping. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanmean`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'median'``.\n\n    stdfunc : {'std', 'mad_std'} or callable, optional\n        The statistic or callable function/object used to compute the\n        standard deviation about the center value. If using a callable\n        function/object and the ``axis`` keyword is used, then it must\n        be able to ignore NaNs (e.g., `numpy.nanstd`) and it must have\n        an ``axis`` keyword to return an array with axis dimension(s)\n        removed. The default is ``'std'``.\n\n    std_ddof : int, optional\n        The delta degrees of freedom for the standard deviation\n        calculation. The divisor used in the calculation is ``N -\n        std_ddof``, where ``N`` represents the number of elements. The\n        default is 0.\n\n    axis : None or int or tuple of int, optional\n        The axis or axes along which to sigma clip the data. If `None`,\n        then the flattened data will be used. ``axis`` is passed to the\n        ``cenfunc`` and ``stdfunc``. The default is `None`.\n\n    grow : float or `False`, optional\n        Radius within which to mask the neighbouring pixels of those\n        that fall outwith the clipping limits (only applied along\n        ``axis``, if specified). As an example, for a 2D image a value\n        of 1 will mask the nearest pixels in a cross pattern around each\n        deviant pixel, while 1.5 will also reject the nearest diagonal\n        neighbours and so on.\n\n    Notes\n    -----\n    The best performance will typically be obtained by setting\n    ``cenfunc`` and ``stdfunc`` to one of the built-in functions\n    specified as as string. If one of the options is set to a string\n    while the other has a custom callable, you may in some cases see\n    better performance if you have the `bottleneck`_ package installed.\n\n    .. _bottleneck:  https://github.com/pydata/bottleneck\n\n    Returns\n    -------\n    mean, median, stddev : float\n        The mean, median, and standard deviation of the sigma-clipped\n        data.\n\n    See Also\n    --------\n    SigmaClip, sigma_clip\n    \"\"\"\n    if mask is not None:\n        data = np.ma.MaskedArray(data, mask)\n    if mask_value is not None:\n        data = np.ma.masked_values(data, mask_value)\n\n    if isinstance(data, np.ma.MaskedArray) and data.mask.all():\n        return np.ma.masked, np.ma.masked, np.ma.masked\n\n    sigclip = SigmaClip(sigma=sigma, sigma_lower=sigma_lower,\n                        sigma_upper=sigma_upper, maxiters=maxiters,\n                        cenfunc=cenfunc, stdfunc=stdfunc, grow=grow)\n    data_clipped = sigclip(data, axis=axis, masked=False, return_bounds=False,\n                           copy=True)\n\n    if HAS_BOTTLENECK:\n        mean = _nanmean(data_clipped, axis=axis)\n        median = _nanmedian(data_clipped, axis=axis)\n        std = _nanstd(data_clipped, ddof=std_ddof, axis=axis)\n    else:  # pragma: no cover\n        mean = np.nanmean(data_clipped, axis=axis)\n        median = np.nanmedian(data_clipped, axis=axis)\n        std = np.nanstd(data_clipped, ddof=std_ddof, axis=axis)\n\n    return mean, median, std"},{"className":"TableAttribute","col":0,"comment":"\n    Descriptor to define a custom attribute for a Table subclass.\n\n    The value of the ``TableAttribute`` will be stored in a dict named\n    ``__attributes__`` that is stored in the table ``meta``.  The attribute\n    can be accessed and set in the usual way, and it can be provided when\n    creating the object.\n\n    Defining an attribute by this mechanism ensures that it will persist if\n    the table is sliced or serialized, for example as a pickle or ECSV file.\n\n    See the `~astropy.utils.metadata.MetaAttribute` documentation for additional\n    details.\n\n    Parameters\n    ----------\n    default : object\n        Default value for attribute\n\n    Examples\n    --------\n      >>> from astropy.table import Table, TableAttribute\n      >>> class MyTable(Table):\n      ...     identifier = TableAttribute(default=1)\n      >>> t = MyTable(identifier=10)\n      >>> t.identifier\n      10\n      >>> t.meta\n      OrderedDict([('__attributes__', {'identifier': 10})])\n    ","endLoc":373,"id":9450,"nodeType":"Class","startLoc":343,"text":"class TableAttribute(MetaAttribute):\n    \"\"\"\n    Descriptor to define a custom attribute for a Table subclass.\n\n    The value of the ``TableAttribute`` will be stored in a dict named\n    ``__attributes__`` that is stored in the table ``meta``.  The attribute\n    can be accessed and set in the usual way, and it can be provided when\n    creating the object.\n\n    Defining an attribute by this mechanism ensures that it will persist if\n    the table is sliced or serialized, for example as a pickle or ECSV file.\n\n    See the `~astropy.utils.metadata.MetaAttribute` documentation for additional\n    details.\n\n    Parameters\n    ----------\n    default : object\n        Default value for attribute\n\n    Examples\n    --------\n      >>> from astropy.table import Table, TableAttribute\n      >>> class MyTable(Table):\n      ...     identifier = TableAttribute(default=1)\n      >>> t = MyTable(identifier=10)\n      >>> t.identifier\n      10\n      >>> t.meta\n      OrderedDict([('__attributes__', {'identifier': 10})])\n    \"\"\""},{"className":"PprintIncludeExclude","col":0,"comment":"Maintain tuple that controls table column visibility for print output.\n\n    This is a descriptor that inherits from MetaAttribute so that the attribute\n    value is stored in the table meta['__attributes__'].\n\n    This gets used for the ``pprint_include_names`` and ``pprint_exclude_names`` Table\n    attributes.\n    ","endLoc":539,"id":9451,"nodeType":"Class","startLoc":376,"text":"class PprintIncludeExclude(TableAttribute):\n    \"\"\"Maintain tuple that controls table column visibility for print output.\n\n    This is a descriptor that inherits from MetaAttribute so that the attribute\n    value is stored in the table meta['__attributes__'].\n\n    This gets used for the ``pprint_include_names`` and ``pprint_exclude_names`` Table\n    attributes.\n    \"\"\"\n    def __get__(self, instance, owner_cls):\n        \"\"\"Get the attribute.\n\n        This normally returns an instance of this class which is stored on the\n        owner object.\n        \"\"\"\n        # For getting from class not an instance\n        if instance is None:\n            return self\n\n        # If not already stored on `instance`, make a copy of the class\n        # descriptor object and put it onto the instance.\n        value = instance.__dict__.get(self.name)\n        if value is None:\n            value = deepcopy(self)\n            instance.__dict__[self.name] = value\n\n        # We set _instance_ref on every call, since if one makes copies of\n        # instances, this attribute will be copied as well, which will lose the\n        # reference.\n        value._instance_ref = weakref.ref(instance)\n        return value\n\n    def __set__(self, instance, names):\n        \"\"\"Set value of ``instance`` attribute to ``names``.\n\n        Parameters\n        ----------\n        instance : object\n            Instance that owns the attribute\n        names : None, str, list, tuple\n            Column name(s) to store, or None to clear\n        \"\"\"\n        if isinstance(names, str):\n            names = [names]\n        if names is None:\n            # Remove attribute value from the meta['__attributes__'] dict.\n            # Subsequent access will just return None.\n            delattr(instance, self.name)\n        else:\n            # This stores names into instance.meta['__attributes__'] as tuple\n            return super().__set__(instance, tuple(names))\n\n    def __call__(self):\n        \"\"\"Get the value of the attribute.\n\n        Returns\n        -------\n        names : None, tuple\n            Include/exclude names\n        \"\"\"\n        # Get the value from instance.meta['__attributes__']\n        instance = self._instance_ref()\n        return super().__get__(instance, instance.__class__)\n\n    def __repr__(self):\n        if hasattr(self, '_instance_ref'):\n            out = f'<{self.__class__.__name__} name={self.name} value={self()}>'\n        else:\n            out = super().__repr__()\n        return out\n\n    def _add_remove_setup(self, names):\n        \"\"\"Common setup for add and remove.\n\n        - Coerce attribute value to a list\n        - Coerce names into a list\n        - Get the parent table instance\n        \"\"\"\n        names = [names] if isinstance(names, str) else list(names)\n        # Get the value. This is the same as self() but we need `instance` here.\n        instance = self._instance_ref()\n        value = super().__get__(instance, instance.__class__)\n        value = [] if value is None else list(value)\n        return instance, names, value\n\n    def add(self, names):\n        \"\"\"Add ``names`` to the include/exclude attribute.\n\n        Parameters\n        ----------\n        names : str, list, tuple\n            Column name(s) to add\n        \"\"\"\n        instance, names, value = self._add_remove_setup(names)\n        value.extend(name for name in names if name not in value)\n        super().__set__(instance, tuple(value))\n\n    def remove(self, names):\n        \"\"\"Remove ``names`` from the include/exclude attribute.\n\n        Parameters\n        ----------\n        names : str, list, tuple\n            Column name(s) to remove\n        \"\"\"\n        self._remove(names, raise_exc=True)\n\n    def _remove(self, names, raise_exc=False):\n        \"\"\"Remove ``names`` with optional checking if they exist\"\"\"\n        instance, names, value = self._add_remove_setup(names)\n\n        # Return now if there are no attributes and thus no action to be taken.\n        if not raise_exc and '__attributes__' not in instance.meta:\n            return\n\n        # Remove one by one, optionally raising an exception if name is missing.\n        for name in names:\n            if name in value:\n                value.remove(name)  # Using the list.remove method\n            elif raise_exc:\n                raise ValueError(f'{name} not in {self.name}')\n\n        # Change to either None or a tuple for storing back to attribute\n        value = None if value == [] else tuple(value)\n        self.__set__(instance, value)\n\n    def _rename(self, name, new_name):\n        \"\"\"Rename ``name`` to ``new_name`` if ``name`` is in the list\"\"\"\n        names = self() or ()\n        if name in names:\n            new_names = list(names)\n            new_names[new_names.index(name)] = new_name\n            self.set(new_names)\n\n    def set(self, names):\n        \"\"\"Set value of include/exclude attribute to ``names``.\n\n        Parameters\n        ----------\n        names : None, str, list, tuple\n            Column name(s) to store, or None to clear\n        \"\"\"\n        class _Context:\n            def __init__(self, descriptor_self):\n                self.descriptor_self = descriptor_self\n                self.names_orig = descriptor_self()\n\n            def __enter__(self):\n                pass\n\n            def __exit__(self, type, value, tb):\n                descriptor_self = self.descriptor_self\n                instance = descriptor_self._instance_ref()\n                descriptor_self.__set__(instance, self.names_orig)\n\n            def __repr__(self):\n                return repr(self.descriptor_self)\n\n        ctx = _Context(descriptor_self=self)\n\n        instance = self._instance_ref()\n        self.__set__(instance, names)\n\n        return ctx"},{"col":4,"comment":"Get the attribute.\n\n        This normally returns an instance of this class which is stored on the\n        owner object.\n        ","endLoc":406,"header":"def __get__(self, instance, owner_cls)","id":9452,"name":"__get__","nodeType":"Function","startLoc":385,"text":"def __get__(self, instance, owner_cls):\n        \"\"\"Get the attribute.\n\n        This normally returns an instance of this class which is stored on the\n        owner object.\n        \"\"\"\n        # For getting from class not an instance\n        if instance is None:\n            return self\n\n        # If not already stored on `instance`, make a copy of the class\n        # descriptor object and put it onto the instance.\n        value = instance.__dict__.get(self.name)\n        if value is None:\n            value = deepcopy(self)\n            instance.__dict__[self.name] = value\n\n        # We set _instance_ref on every call, since if one makes copies of\n        # instances, this attribute will be copied as well, which will lose the\n        # reference.\n        value._instance_ref = weakref.ref(instance)\n        return value"},{"col":4,"comment":"null","endLoc":309,"header":"@property\n    def colnames(self)","id":9453,"name":"colnames","nodeType":"Function","startLoc":307,"text":"@property\n    def colnames(self):\n        return list(self.keys())"},{"col":4,"comment":"null","endLoc":312,"header":"def itercols(self)","id":9454,"name":"itercols","nodeType":"Function","startLoc":311,"text":"def itercols(self):\n        return self.values()"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":9455,"name":"__all__","nodeType":"Attribute","startLoc":28,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":9456,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":31,"text":"__doctest_requires__"},{"col":0,"comment":"","endLoc":9,"header":"operations.py#<anonymous>","id":9457,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nHigh-level table operations:\n\n- join()\n- setdiff()\n- hstack()\n- vstack()\n- dstack()\n\"\"\"\n\n__all__ = ['join', 'setdiff', 'hstack', 'vstack', 'unique',\n           'join_skycoord', 'join_distance']\n\n__doctest_requires__ = {'join_skycoord': ['scipy'], 'join_distance': ['scipy']}"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":9458,"name":"__construct_mixin_classes","nodeType":"Attribute","startLoc":26,"text":"__construct_mixin_classes"},{"col":0,"comment":"","endLoc":2,"header":"serialize.py#<anonymous>","id":9459,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"__construct_mixin_classes = (\n    'astropy.time.core.Time',\n    'astropy.time.core.TimeDelta',\n    'astropy.units.quantity.Quantity',\n    'astropy.units.function.logarithmic.Magnitude',\n    'astropy.units.function.logarithmic.Decibel',\n    'astropy.units.function.logarithmic.Dex',\n    'astropy.coordinates.angles.Latitude',\n    'astropy.coordinates.angles.Longitude',\n    'astropy.coordinates.angles.Angle',\n    'astropy.coordinates.distances.Distance',\n    'astropy.coordinates.earth.EarthLocation',\n    'astropy.coordinates.sky_coordinate.SkyCoord',\n    'astropy.table.ndarray_mixin.NdarrayMixin',\n    'astropy.table.table_helpers.ArrayWrapper',\n    'astropy.table.column.MaskedColumn',\n    'astropy.coordinates.representation.CartesianRepresentation',\n    'astropy.coordinates.representation.UnitSphericalRepresentation',\n    'astropy.coordinates.representation.RadialRepresentation',\n    'astropy.coordinates.representation.SphericalRepresentation',\n    'astropy.coordinates.representation.PhysicsSphericalRepresentation',\n    'astropy.coordinates.representation.CylindricalRepresentation',\n    'astropy.coordinates.representation.CartesianDifferential',\n    'astropy.coordinates.representation.UnitSphericalDifferential',\n    'astropy.coordinates.representation.SphericalDifferential',\n    'astropy.coordinates.representation.UnitSphericalCosLatDifferential',\n    'astropy.coordinates.representation.SphericalCosLatDifferential',\n    'astropy.coordinates.representation.RadialDifferential',\n    'astropy.coordinates.representation.PhysicsSphericalDifferential',\n    'astropy.coordinates.representation.CylindricalDifferential',\n    'astropy.utils.masked.core.MaskedNDArray',\n)"},{"fileName":"info.py","filePath":"astropy/table","id":9460,"nodeType":"File","text":"\"\"\"\nTable property for providing information about table.\n\"\"\"\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport sys\nimport os\nfrom contextlib import contextmanager\nfrom inspect import isclass\n\nimport numpy as np\nfrom astropy.utils.data_info import DataInfo\n\n__all__ = ['table_info', 'TableInfo', 'serialize_method_as']\n\n\ndef table_info(tbl, option='attributes', out=''):\n    \"\"\"\n    Write summary information about column to the ``out`` filehandle.\n    By default this prints to standard output via sys.stdout.\n\n    The ``option`` argument specifies what type of information\n    to include.  This can be a string, a function, or a list of\n    strings or functions.  Built-in options are:\n\n    - ``attributes``: basic column meta data like ``dtype`` or ``format``\n    - ``stats``: basic statistics: minimum, mean, and maximum\n\n    If a function is specified then that function will be called with the\n    column as its single argument.  The function must return an OrderedDict\n    containing the information attributes.\n\n    If a list is provided then the information attributes will be\n    appended for each of the options, in order.\n\n    Examples\n    --------\n    >>> from astropy.table.table_helpers import simple_table\n    >>> t = simple_table(size=2, kinds='if')\n    >>> t['a'].unit = 'm'\n    >>> t.info()\n    <Table length=2>\n    name  dtype  unit\n    ---- ------- ----\n       a   int64    m\n       b float64\n\n    >>> t.info('stats')\n    <Table length=2>\n    name mean std min max\n    ---- ---- --- --- ---\n       a  1.5 0.5   1   2\n       b  1.5 0.5   1   2\n\n    Parameters\n    ----------\n    option : str, callable, list of (str or callable)\n        Info option, defaults to 'attributes'.\n    out : file-like, None\n        Output destination, default is sys.stdout.  If None then a\n        Table with information attributes is returned\n\n    Returns\n    -------\n    info : `~astropy.table.Table` if out==None else None\n    \"\"\"\n    from .table import Table\n\n    if out == '':\n        out = sys.stdout\n\n    descr_vals = [tbl.__class__.__name__]\n    if tbl.masked:\n        descr_vals.append('masked=True')\n    descr_vals.append(f'length={len(tbl)}')\n\n    outlines = ['<' + ' '.join(descr_vals) + '>']\n\n    cols = list(tbl.columns.values())\n    if tbl.colnames:\n        infos = []\n        for col in cols:\n            infos.append(col.info(option, out=None))\n\n        info = Table(infos, names=list(infos[0]))\n    else:\n        info = Table()\n\n    if out is None:\n        return info\n\n    # Since info is going to a filehandle for viewing then remove uninteresting\n    # columns.\n    if 'class' in info.colnames:\n        # Remove 'class' info column if all table columns are the same class\n        # and they are the default column class for that table.\n        uniq_types = set(type(col) for col in cols)\n        if len(uniq_types) == 1 and isinstance(cols[0], tbl.ColumnClass):\n            del info['class']\n\n    if 'n_bad' in info.colnames and np.all(info['n_bad'] == 0):\n        del info['n_bad']\n\n    # Standard attributes has 'length' but this is typically redundant\n    if 'length' in info.colnames and np.all(info['length'] == len(tbl)):\n        del info['length']\n\n    for name in info.colnames:\n        if info[name].dtype.kind in 'SU' and np.all(info[name] == ''):\n            del info[name]\n\n    if tbl.colnames:\n        outlines.extend(info.pformat(max_width=-1, max_lines=-1, show_unit=False))\n    else:\n        outlines.append('<No columns>')\n\n    out.writelines(outline + os.linesep for outline in outlines)\n\n\nclass TableInfo(DataInfo):\n    def __call__(self, option='attributes', out=''):\n        return table_info(self._parent, option, out)\n\n    __call__.__doc__ = table_info.__doc__\n\n\n@contextmanager\ndef serialize_method_as(tbl, serialize_method):\n    \"\"\"Context manager to temporarily override individual\n    column info.serialize_method dict values.  The serialize_method\n    attribute is an optional dict which might look like ``{'fits':\n    'jd1_jd2', 'ecsv': 'formatted_value', ..}``.\n\n    ``serialize_method`` is a str or dict.  If str then it the the value\n    is the ``serialize_method`` that will be used for all formats.\n    If dict then the key values can be either:\n\n    - Column name.  This has higher precedence than the second option of\n      matching class.\n    - Class (matches any column which is an instance of the class)\n\n    This context manager is expected to be used only within ``Table.write``.\n    It could have been a private method on Table but prefer not to add\n    clutter to that class.\n\n    Parameters\n    ----------\n    tbl : Table object\n        Input table\n    serialize_method : dict, str\n        Dict with key values of column names or types, or str\n\n    Returns\n    -------\n    None (context manager)\n    \"\"\"\n    def get_override_sm(col):\n        \"\"\"\n        Determine if the ``serialize_method`` str or dict specifies an\n        override of column presets for ``col``.  Returns the matching\n        serialize_method value or ``None``.\n        \"\"\"\n        # If a string then all columns match\n        if isinstance(serialize_method, str):\n            return serialize_method\n\n        # If column name then return that serialize_method\n        if col.info.name in serialize_method:\n            return serialize_method[col.info.name]\n\n        # Otherwise look for subclass matches\n        for key in serialize_method:\n            if isclass(key) and isinstance(col, key):\n                return serialize_method[key]\n\n        return None\n\n    # Setup for the context block.  Set individual column.info.serialize_method\n    # values as appropriate and keep a backup copy.  If ``serialize_method``\n    # is None or empty then don't do anything.\n\n    # Original serialize_method dict, keyed by column name.  This only\n    # gets used and set if there is an override.\n    original_sms = {}\n\n    if serialize_method:\n        # Go through every column and if it has a serialize_method info\n        # attribute then potentially update it for the duration of the write.\n        for col in tbl.itercols():\n            if hasattr(col.info, 'serialize_method'):\n                override_sm = get_override_sm(col)\n                if override_sm:\n                    # Make a reference copy of the column serialize_method\n                    # dict which maps format (e.g. 'fits') to the\n                    # appropriate method (e.g. 'data_mask').\n                    original_sms[col.info.name] = col.info.serialize_method\n\n                    # Set serialize method for *every* available format.  This is\n                    # brute force, but at this point the format ('fits', 'ecsv', etc)\n                    # is not actually known (this gets determined by the write function\n                    # in registry.py).  Note this creates a new temporary dict object\n                    # so that the restored version is the same original object.\n                    col.info.serialize_method = {fmt: override_sm\n                                                 for fmt in col.info.serialize_method}\n\n    # Finally yield for the context block\n    try:\n        yield\n    finally:\n        # Teardown (restore) for the context block.  Be sure to do this even\n        # if an exception occurred.\n        if serialize_method:\n            for name, original_sm in original_sms.items():\n                tbl[name].info.serialize_method = original_sm\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":9461,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"sigma_clipping.py#<anonymous>","id":9462,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"if HAS_BOTTLENECK:\n    import bottleneck\n\n__all__ = ['SigmaClip', 'sigma_clip', 'sigma_clipped_stats']"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":9463,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"info.py#<anonymous>","id":9464,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nTable property for providing information about table.\n\"\"\"\n\n__all__ = ['table_info', 'TableInfo', 'serialize_method_as']"},{"col":4,"comment":"Set value of ``instance`` attribute to ``names``.\n\n        Parameters\n        ----------\n        instance : object\n            Instance that owns the attribute\n        names : None, str, list, tuple\n            Column name(s) to store, or None to clear\n        ","endLoc":426,"header":"def __set__(self, instance, names)","id":9465,"name":"__set__","nodeType":"Function","startLoc":408,"text":"def __set__(self, instance, names):\n        \"\"\"Set value of ``instance`` attribute to ``names``.\n\n        Parameters\n        ----------\n        instance : object\n            Instance that owns the attribute\n        names : None, str, list, tuple\n            Column name(s) to store, or None to clear\n        \"\"\"\n        if isinstance(names, str):\n            names = [names]\n        if names is None:\n            # Remove attribute value from the meta['__attributes__'] dict.\n            # Subsequent access will just return None.\n            delattr(instance, self.name)\n        else:\n            # This stores names into instance.meta['__attributes__'] as tuple\n            return super().__set__(instance, tuple(names))"},{"fileName":"column.py","filePath":"astropy/table","id":9466,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport itertools\nimport warnings\nimport weakref\n\nfrom copy import deepcopy\n\nimport numpy as np\nfrom numpy import ma\n\nfrom astropy.units import Unit, Quantity\nfrom astropy.utils.console import color_print\nfrom astropy.utils.metadata import MetaData\nfrom astropy.utils.data_info import BaseColumnInfo, dtype_info_name\nfrom astropy.utils.misc import dtype_bytes_or_chars\nfrom . import groups\nfrom . import pprint\n\n# These \"shims\" provide __getitem__ implementations for Column and MaskedColumn\nfrom ._column_mixins import _ColumnGetitemShim, _MaskedColumnGetitemShim\n\n# Create a generic TableFormatter object for use by bare columns with no\n# parent table.\nFORMATTER = pprint.TableFormatter()\n\n\nclass StringTruncateWarning(UserWarning):\n    \"\"\"\n    Warning class for when a string column is assigned a value\n    that gets truncated because the base (numpy) string length\n    is too short.\n\n    This does not inherit from AstropyWarning because we want to use\n    stacklevel=2 to show the user where the issue occurred in their code.\n    \"\"\"\n    pass\n\n\n# Always emit this warning, not just the first instance\nwarnings.simplefilter('always', StringTruncateWarning)\n\n\ndef _auto_names(n_cols):\n    from . import conf\n    return [str(conf.auto_colname).format(i) for i in range(n_cols)]\n\n\n# list of one and two-dimensional comparison functions, which sometimes return\n# a Column class and sometimes a plain array. Used in __array_wrap__ to ensure\n# they only return plain (masked) arrays (see #1446 and #1685)\n_comparison_functions = set(\n    [np.greater, np.greater_equal, np.less, np.less_equal,\n     np.not_equal, np.equal,\n     np.isfinite, np.isinf, np.isnan, np.sign, np.signbit])\n\n\ndef col_copy(col, copy_indices=True):\n    \"\"\"\n    Mixin-safe version of Column.copy() (with copy_data=True).\n\n    Parameters\n    ----------\n    col : Column or mixin column\n        Input column\n    copy_indices : bool\n        Copy the column ``indices`` attribute\n\n    Returns\n    -------\n    col : Copy of input column\n    \"\"\"\n    if isinstance(col, BaseColumn):\n        return col.copy()\n\n    newcol = col.copy() if hasattr(col, 'copy') else deepcopy(col)\n    # If the column has info defined, we copy it and adjust any indices\n    # to point to the copied column.  By guarding with the if statement,\n    # we avoid side effects (of creating the default info instance).\n    if 'info' in col.__dict__:\n        newcol.info = col.info\n        if copy_indices and col.info.indices:\n            newcol.info.indices = deepcopy(col.info.indices)\n            for index in newcol.info.indices:\n                index.replace_col(col, newcol)\n\n    return newcol\n\n\nclass FalseArray(np.ndarray):\n    \"\"\"\n    Boolean mask array that is always False.\n\n    This is used to create a stub ``mask`` property which is a boolean array of\n    ``False`` used by default for mixin columns and corresponding to the mixin\n    column data shape.  The ``mask`` looks like a normal numpy array but an\n    exception will be raised if ``True`` is assigned to any element.  The\n    consequences of the limitation are most obvious in the high-level table\n    operations.\n\n    Parameters\n    ----------\n    shape : tuple\n        Data shape\n    \"\"\"\n    def __new__(cls, shape):\n        obj = np.zeros(shape, dtype=bool).view(cls)\n        return obj\n\n    def __setitem__(self, item, val):\n        val = np.asarray(val)\n        if np.any(val):\n            raise ValueError('Cannot set any element of {} class to True'\n                             .format(self.__class__.__name__))\n\n\ndef _expand_string_array_for_values(arr, values):\n    \"\"\"\n    For string-dtype return a version of ``arr`` that is wide enough for ``values``.\n    If ``arr`` is not string-dtype or does not need expansion then return ``arr``.\n\n    Parameters\n    ----------\n    arr : np.ndarray\n        Input array\n    values : scalar or array-like\n        Values for width comparison for string arrays\n\n    Returns\n    -------\n    arr_expanded : np.ndarray\n\n    \"\"\"\n    if arr.dtype.kind in ('U', 'S') and values is not np.ma.masked:\n        # Find the length of the longest string in the new values.\n        values_str_len = np.char.str_len(values).max()\n\n        # Determine character repeat count of arr.dtype.  Returns a positive\n        # int or None (something like 'U0' is not possible in numpy).  If new values\n        # are longer than current then make a new (wider) version of arr.\n        arr_str_len = dtype_bytes_or_chars(arr.dtype)\n        if arr_str_len and values_str_len > arr_str_len:\n            arr_dtype = arr.dtype.byteorder + arr.dtype.kind + str(values_str_len)\n            arr = arr.astype(arr_dtype)\n\n    return arr\n\n\ndef _convert_sequence_data_to_array(data, dtype=None):\n    \"\"\"Convert N-d sequence-like data to ndarray or MaskedArray.\n\n    This is the core function for converting Python lists or list of lists to a\n    numpy array. This handles embedded np.ma.masked constants in ``data`` along\n    with the special case of an homogeneous list of MaskedArray elements.\n\n    Considerations:\n\n    - np.ma.array is about 50 times slower than np.array for list input. This\n      function avoids using np.ma.array on list input.\n    - np.array emits a UserWarning for embedded np.ma.masked, but only for int\n      or float inputs. For those it converts to np.nan and forces float dtype.\n      For other types np.array is inconsistent, for instance converting\n      np.ma.masked to \"0.0\" for str types.\n    - Searching in pure Python for np.ma.masked in ``data`` is comparable in\n      speed to calling ``np.array(data)``.\n    - This function may end up making two additional copies of input ``data``.\n\n    Parameters\n    ----------\n    data : N-d sequence\n        Input data, typically list or list of lists\n    dtype : None or dtype-like\n        Output datatype (None lets np.array choose)\n\n    Returns\n    -------\n    np_data : np.ndarray or np.ma.MaskedArray\n\n    \"\"\"\n    np_ma_masked = np.ma.masked  # Avoid repeated lookups of this object\n\n    # Special case of an homogeneous list of MaskedArray elements (see #8977).\n    # np.ma.masked is an instance of MaskedArray, so exclude those values.\n    if (hasattr(data, '__len__')\n        and len(data) > 0\n        and all(isinstance(val, np.ma.MaskedArray)\n                and val is not np_ma_masked for val in data)):\n        np_data = np.ma.array(data, dtype=dtype)\n        return np_data\n\n    # First convert data to a plain ndarray. If there are instances of np.ma.masked\n    # in the data this will issue a warning for int and float.\n    with warnings.catch_warnings(record=True) as warns:\n        # Ensure this warning from numpy is always enabled and that it is not\n        # converted to an error (which can happen during pytest).\n        warnings.filterwarnings('always', category=UserWarning,\n                                message='.*converting a masked element.*')\n        # FutureWarning in numpy 1.21. See https://github.com/astropy/astropy/issues/11291\n        # and https://github.com/numpy/numpy/issues/18425.\n        warnings.filterwarnings('always', category=FutureWarning,\n                                message='.*Promotion of numbers and bools to strings.*')\n        try:\n            np_data = np.array(data, dtype=dtype)\n        except np.ma.MaskError:\n            # Catches case of dtype=int with masked values, instead let it\n            # convert to float\n            np_data = np.array(data)\n        except Exception:\n            # Conversion failed for some reason, e.g. [2, 1*u.m] gives TypeError in Quantity.\n            # First try to interpret the data as Quantity. If that still fails then fall\n            # through to object\n            try:\n                np_data = Quantity(data, dtype)\n            except Exception:\n                dtype = object\n                np_data = np.array(data, dtype=dtype)\n\n    if np_data.ndim == 0 or (np_data.ndim > 0 and len(np_data) == 0):\n        # Implies input was a scalar or an empty list (e.g. initializing an\n        # empty table with pre-declared names and dtypes but no data).  Here we\n        # need to fall through to initializing with the original data=[].\n        return data\n\n    # If there were no warnings and the data are int or float, then we are done.\n    # Other dtypes like string or complex can have masked values and the\n    # np.array() conversion gives the wrong answer (e.g. converting np.ma.masked\n    # to the string \"0.0\").\n    if len(warns) == 0 and np_data.dtype.kind in ('i', 'f'):\n        return np_data\n\n    # Now we need to determine if there is an np.ma.masked anywhere in input data.\n\n    # Make a statement like below to look for np.ma.masked in a nested sequence.\n    # Because np.array(data) succeeded we know that `data` has a regular N-d\n    # structure. Find ma_masked:\n    #   any(any(any(d2 is ma_masked for d2 in d1) for d1 in d0) for d0 in data)\n    # Using this eval avoids creating a copy of `data` in the more-usual case of\n    # no masked elements.\n    any_statement = 'd0 is ma_masked'\n    for ii in reversed(range(np_data.ndim)):\n        if ii == 0:\n            any_statement = f'any({any_statement} for d0 in data)'\n        elif ii == np_data.ndim - 1:\n            any_statement = f'any(d{ii} is ma_masked for d{ii} in d{ii-1})'\n        else:\n            any_statement = f'any({any_statement} for d{ii} in d{ii-1})'\n    context = {'ma_masked': np.ma.masked, 'data': data}\n    has_masked = eval(any_statement, context)\n\n    # If there are any masks then explicitly change each one to a fill value and\n    # set a mask boolean array. If not has_masked then we're done.\n    if has_masked:\n        mask = np.zeros(np_data.shape, dtype=bool)\n        data_filled = np.array(data, dtype=object)\n\n        # Make type-appropriate fill value based on initial conversion.\n        if np_data.dtype.kind == 'U':\n            fill = ''\n        elif np_data.dtype.kind == 'S':\n            fill = b''\n        else:\n            # Zero works for every numeric type.\n            fill = 0\n\n        ranges = [range(dim) for dim in np_data.shape]\n        for idxs in itertools.product(*ranges):\n            val = data_filled[idxs]\n            if val is np_ma_masked:\n                data_filled[idxs] = fill\n                mask[idxs] = True\n            elif isinstance(val, bool) and dtype is None:\n                # If we see a bool and dtype not specified then assume bool for\n                # the entire array. Not perfect but in most practical cases OK.\n                # Unfortunately numpy types [False, 0] as int, not bool (and\n                # [False, np.ma.masked] => array([0.0, np.nan])).\n                dtype = bool\n\n        # If no dtype is provided then need to convert back to list so np.array\n        # does type autodetection.\n        if dtype is None:\n            data_filled = data_filled.tolist()\n\n        # Use np.array first to convert `data` to ndarray (fast) and then make\n        # masked array from an ndarray with mask (fast) instead of from `data`.\n        np_data = np.ma.array(np.array(data_filled, dtype=dtype), mask=mask)\n\n    return np_data\n\n\ndef _make_compare(oper):\n    \"\"\"\n    Make Column comparison methods which encode the ``other`` object to utf-8\n    in the case of a bytestring dtype for Py3+.\n\n    Parameters\n    ----------\n    oper : str\n        Operator name\n    \"\"\"\n    swapped_oper = {'__eq__': '__eq__',\n                    '__ne__': '__ne__',\n                    '__gt__': '__lt__',\n                    '__lt__': '__gt__',\n                    '__ge__': '__le__',\n                    '__le__': '__ge__'}[oper]\n\n    def _compare(self, other):\n        op = oper  # copy enclosed ref to allow swap below\n\n        # Special case to work around #6838.  Other combinations work OK,\n        # see tests.test_column.test_unicode_sandwich_compare().  In this\n        # case just swap self and other.\n        #\n        # This is related to an issue in numpy that was addressed in np 1.13.\n        # However that fix does not make this problem go away, but maybe\n        # future numpy versions will do so.  NUMPY_LT_1_13 to get the\n        # attention of future maintainers to check (by deleting or versioning\n        # the if block below).  See #6899 discussion.\n        # 2019-06-21: still needed with numpy 1.16.\n        if (isinstance(self, MaskedColumn) and self.dtype.kind == 'U'\n                and isinstance(other, MaskedColumn) and other.dtype.kind == 'S'):\n            self, other = other, self\n            op = swapped_oper\n\n        if self.dtype.char == 'S':\n            other = self._encode_str(other)\n\n        # Now just let the regular ndarray.__eq__, etc., take over.\n        result = getattr(super(Column, self), op)(other)\n        # But we should not return Column instances for this case.\n        return result.data if isinstance(result, Column) else result\n\n    return _compare\n\n\nclass ColumnInfo(BaseColumnInfo):\n    \"\"\"\n    Container for meta information like name, description, format.\n\n    This is required when the object is used as a mixin column within a table,\n    but can be used as a general way to store meta information.\n    \"\"\"\n    attrs_from_parent = BaseColumnInfo.attr_names\n    _supports_indexing = True\n\n    def new_like(self, cols, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new Column instance which is consistent with the\n        input ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty column object whose elements can\n        be set in-place for table operations like join or vstack.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : Column (or subclass)\n            New instance of this class consistent with ``cols``\n\n        \"\"\"\n        attrs = self.merge_cols_attributes(cols, metadata_conflicts, name,\n                                           ('meta', 'unit', 'format', 'description'))\n\n        return self._parent_cls(length=length, **attrs)\n\n    def get_sortable_arrays(self):\n        \"\"\"\n        Return a list of arrays which can be lexically sorted to represent\n        the order of the parent column.\n\n        For Column this is just the column itself.\n\n        Returns\n        -------\n        arrays : list of ndarray\n        \"\"\"\n        return [self._parent]\n\n\nclass BaseColumn(_ColumnGetitemShim, np.ndarray):\n\n    meta = MetaData()\n\n    def __new__(cls, data=None, name=None,\n                dtype=None, shape=(), length=0,\n                description=None, unit=None, format=None, meta=None,\n                copy=False, copy_indices=True):\n        if data is None:\n            self_data = np.zeros((length,)+shape, dtype=dtype)\n        elif isinstance(data, BaseColumn) and hasattr(data, '_name'):\n            # When unpickling a MaskedColumn, ``data`` will be a bare\n            # BaseColumn with none of the expected attributes.  In this case\n            # do NOT execute this block which initializes from ``data``\n            # attributes.\n            self_data = np.array(data.data, dtype=dtype, copy=copy)\n            if description is None:\n                description = data.description\n            if unit is None:\n                unit = unit or data.unit\n            if format is None:\n                format = data.format\n            if meta is None:\n                meta = data.meta\n            if name is None:\n                name = data.name\n        elif isinstance(data, Quantity):\n            if unit is None:\n                self_data = np.array(data, dtype=dtype, copy=copy)\n                unit = data.unit\n            else:\n                self_data = Quantity(data, unit, dtype=dtype, copy=copy).value\n            # If 'info' has been defined, copy basic properties (if needed).\n            if 'info' in data.__dict__:\n                if description is None:\n                    description = data.info.description\n                if format is None:\n                    format = data.info.format\n                if meta is None:\n                    meta = data.info.meta\n\n        else:\n            if np.dtype(dtype).char == 'S':\n                data = cls._encode_str(data)\n            self_data = np.array(data, dtype=dtype, copy=copy)\n\n        self = self_data.view(cls)\n        self._name = None if name is None else str(name)\n        self._parent_table = None\n        self.unit = unit\n        self._format = format\n        self.description = description\n        self.meta = meta\n        self.indices = deepcopy(getattr(data, 'indices', [])) if copy_indices else []\n        for index in self.indices:\n            index.replace_col(data, self)\n\n        return self\n\n    @property\n    def data(self):\n        return self.view(np.ndarray)\n\n    @property\n    def value(self):\n        return self.data\n\n    @property\n    def parent_table(self):\n        # Note: It seems there are some cases where _parent_table is not set,\n        # such after restoring from a pickled Column.  Perhaps that should be\n        # fixed, but this is also okay for now.\n        if getattr(self, '_parent_table', None) is None:\n            return None\n        else:\n            return self._parent_table()\n\n    @parent_table.setter\n    def parent_table(self, table):\n        if table is None:\n            self._parent_table = None\n        else:\n            self._parent_table = weakref.ref(table)\n\n    info = ColumnInfo()\n\n    def copy(self, order='C', data=None, copy_data=True):\n        \"\"\"\n        Return a copy of the current instance.\n\n        If ``data`` is supplied then a view (reference) of ``data`` is used,\n        and ``copy_data`` is ignored.\n\n        Parameters\n        ----------\n        order : {'C', 'F', 'A', 'K'}, optional\n            Controls the memory layout of the copy. 'C' means C-order,\n            'F' means F-order, 'A' means 'F' if ``a`` is Fortran contiguous,\n            'C' otherwise. 'K' means match the layout of ``a`` as closely\n            as possible. (Note that this function and :func:numpy.copy are very\n            similar, but have different default values for their order=\n            arguments.)  Default is 'C'.\n        data : array, optional\n            If supplied then use a view of ``data`` instead of the instance\n            data.  This allows copying the instance attributes and meta.\n        copy_data : bool, optional\n            Make a copy of the internal numpy array instead of using a\n            reference.  Default is True.\n\n        Returns\n        -------\n        col : Column or MaskedColumn\n            Copy of the current column (same type as original)\n        \"\"\"\n        if data is None:\n            data = self.data\n            if copy_data:\n                data = data.copy(order)\n\n        out = data.view(self.__class__)\n        out.__array_finalize__(self)\n\n        # If there is meta on the original column then deepcopy (since \"copy\" of column\n        # implies complete independence from original).  __array_finalize__ will have already\n        # made a light copy.  I'm not sure how to avoid that initial light copy.\n        if self.meta is not None:\n            out.meta = self.meta  # MetaData descriptor does a deepcopy here\n\n        # for MaskedColumn, MaskedArray.__array_finalize__ also copies mask\n        # from self, which is not the idea here, so undo\n        if isinstance(self, MaskedColumn):\n            out._mask = data._mask\n\n        self._copy_groups(out)\n\n        return out\n\n    def __setstate__(self, state):\n        \"\"\"\n        Restore the internal state of the Column/MaskedColumn for pickling\n        purposes.  This requires that the last element of ``state`` is a\n        5-tuple that has Column-specific state values.\n        \"\"\"\n        # Get the Column attributes\n        names = ('_name', '_unit', '_format', 'description', 'meta', 'indices')\n        attrs = {name: val for name, val in zip(names, state[-1])}\n\n        state = state[:-1]\n\n        # Using super().__setstate__(state) gives\n        # \"TypeError 'int' object is not iterable\", raised in\n        # astropy.table._column_mixins._ColumnGetitemShim.__setstate_cython__()\n        # Previously, it seems to have given an infinite recursion.\n        # Hence, manually call the right super class to actually set up\n        # the array object.\n        super_class = ma.MaskedArray if isinstance(self, ma.MaskedArray) else np.ndarray\n        super_class.__setstate__(self, state)\n\n        # Set the Column attributes\n        for name, val in attrs.items():\n            setattr(self, name, val)\n        self._parent_table = None\n\n    def __reduce__(self):\n        \"\"\"\n        Return a 3-tuple for pickling a Column.  Use the super-class\n        functionality but then add in a 5-tuple of Column-specific values\n        that get used in __setstate__.\n        \"\"\"\n        super_class = ma.MaskedArray if isinstance(self, ma.MaskedArray) else np.ndarray\n        reconstruct_func, reconstruct_func_args, state = super_class.__reduce__(self)\n\n        # Define Column-specific attrs and meta that gets added to state.\n        column_state = (self.name, self.unit, self.format, self.description,\n                        self.meta, self.indices)\n        state = state + (column_state,)\n\n        return reconstruct_func, reconstruct_func_args, state\n\n    def __array_finalize__(self, obj):\n        # Obj will be none for direct call to Column() creator\n        if obj is None:\n            return\n\n        if callable(super().__array_finalize__):\n            super().__array_finalize__(obj)\n\n        # Self was created from template (e.g. obj[slice] or (obj * 2))\n        # or viewcast e.g. obj.view(Column).  In either case we want to\n        # init Column attributes for self from obj if possible.\n        self.parent_table = None\n        if not hasattr(self, 'indices'):  # may have been copied in __new__\n            self.indices = []\n        self._copy_attrs(obj)\n        if 'info' in getattr(obj, '__dict__', {}):\n            self.info = obj.info\n\n    def __array_wrap__(self, out_arr, context=None):\n        \"\"\"\n        __array_wrap__ is called at the end of every ufunc.\n\n        Normally, we want a Column object back and do not have to do anything\n        special. But there are two exceptions:\n\n        1) If the output shape is different (e.g. for reduction ufuncs\n           like sum() or mean()), a Column still linking to a parent_table\n           makes little sense, so we return the output viewed as the\n           column content (ndarray or MaskedArray).\n           For this case, we use \"[()]\" to select everything, and to ensure we\n           convert a zero rank array to a scalar. (For some reason np.sum()\n           returns a zero rank scalar array while np.mean() returns a scalar;\n           So the [()] is needed for this case.\n\n        2) When the output is created by any function that returns a boolean\n           we also want to consistently return an array rather than a column\n           (see #1446 and #1685)\n        \"\"\"\n        out_arr = super().__array_wrap__(out_arr, context)\n        if (self.shape != out_arr.shape\n            or (isinstance(out_arr, BaseColumn)\n                and (context is not None\n                     and context[0] in _comparison_functions))):\n            return out_arr.data[()]\n        else:\n            return out_arr\n\n    @property\n    def name(self):\n        \"\"\"\n        The name of this column.\n        \"\"\"\n        return self._name\n\n    @name.setter\n    def name(self, val):\n        if val is not None:\n            val = str(val)\n\n        if self.parent_table is not None:\n            table = self.parent_table\n            table.columns._rename_column(self.name, val)\n\n        self._name = val\n\n    @property\n    def format(self):\n        \"\"\"\n        Format string for displaying values in this column.\n        \"\"\"\n\n        return self._format\n\n    @format.setter\n    def format(self, format_string):\n\n        prev_format = getattr(self, '_format', None)\n\n        self._format = format_string  # set new format string\n\n        try:\n            # test whether it formats without error exemplarily\n            self.pformat(max_lines=1)\n        except Exception as err:\n            # revert to restore previous format if there was one\n            self._format = prev_format\n            raise ValueError(\n                \"Invalid format for column '{}': could not display \"\n                \"values in this column using this format\".format(\n                    self.name)) from err\n\n    @property\n    def descr(self):\n        \"\"\"Array-interface compliant full description of the column.\n\n        This returns a 3-tuple (name, type, shape) that can always be\n        used in a structured array dtype definition.\n        \"\"\"\n        return (self.name, self.dtype.str, self.shape[1:])\n\n    def iter_str_vals(self):\n        \"\"\"\n        Return an iterator that yields the string-formatted values of this\n        column.\n\n        Returns\n        -------\n        str_vals : iterator\n            Column values formatted as strings\n        \"\"\"\n        # Iterate over formatted values with no max number of lines, no column\n        # name, no unit, and ignoring the returned header info in outs.\n        _pformat_col_iter = self._formatter._pformat_col_iter\n        for str_val in _pformat_col_iter(self, -1, show_name=False, show_unit=False,\n                                         show_dtype=False, outs={}):\n            yield str_val\n\n    def attrs_equal(self, col):\n        \"\"\"Compare the column attributes of ``col`` to this object.\n\n        The comparison attributes are: ``name``, ``unit``, ``dtype``,\n        ``format``, ``description``, and ``meta``.\n\n        Parameters\n        ----------\n        col : Column\n            Comparison column\n\n        Returns\n        -------\n        equal : bool\n            True if all attributes are equal\n        \"\"\"\n        if not isinstance(col, BaseColumn):\n            raise ValueError('Comparison `col` must be a Column or '\n                             'MaskedColumn object')\n\n        attrs = ('name', 'unit', 'dtype', 'format', 'description', 'meta')\n        equal = all(getattr(self, x) == getattr(col, x) for x in attrs)\n\n        return equal\n\n    @property\n    def _formatter(self):\n        return FORMATTER if (self.parent_table is None) else self.parent_table.formatter\n\n    def pformat(self, max_lines=None, show_name=True, show_unit=False, show_dtype=False,\n                html=False):\n        \"\"\"Return a list of formatted string representation of column values.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default will be\n        determined using the ``astropy.conf.max_lines`` configuration\n        item. If a negative value of ``max_lines`` is supplied then\n        there is no line limit applied.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum lines of output (header + data rows)\n\n        show_name : bool\n            Include column name. Default is True.\n\n        show_unit : bool\n            Include a header row for unit. Default is False.\n\n        show_dtype : bool\n            Include column dtype. Default is False.\n\n        html : bool\n            Format the output as an HTML table. Default is False.\n\n        Returns\n        -------\n        lines : list\n            List of lines with header and formatted column values\n\n        \"\"\"\n        _pformat_col = self._formatter._pformat_col\n        lines, outs = _pformat_col(self, max_lines, show_name=show_name,\n                                   show_unit=show_unit, show_dtype=show_dtype,\n                                   html=html)\n        return lines\n\n    def pprint(self, max_lines=None, show_name=True, show_unit=False, show_dtype=False):\n        \"\"\"Print a formatted string representation of column values.\n\n        If no value of ``max_lines`` is supplied then the height of the\n        screen terminal is used to set ``max_lines``.  If the terminal\n        height cannot be determined then the default will be\n        determined using the ``astropy.conf.max_lines`` configuration\n        item. If a negative value of ``max_lines`` is supplied then\n        there is no line limit applied.\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum number of values in output\n\n        show_name : bool\n            Include column name. Default is True.\n\n        show_unit : bool\n            Include a header row for unit. Default is False.\n\n        show_dtype : bool\n            Include column dtype. Default is True.\n        \"\"\"\n        _pformat_col = self._formatter._pformat_col\n        lines, outs = _pformat_col(self, max_lines, show_name=show_name, show_unit=show_unit,\n                                   show_dtype=show_dtype)\n\n        n_header = outs['n_header']\n        for i, line in enumerate(lines):\n            if i < n_header:\n                color_print(line, 'red')\n            else:\n                print(line)\n\n    def more(self, max_lines=None, show_name=True, show_unit=False):\n        \"\"\"Interactively browse column with a paging interface.\n\n        Supported keys::\n\n          f, <space> : forward one page\n          b : back one page\n          r : refresh same page\n          n : next row\n          p : previous row\n          < : go to beginning\n          > : go to end\n          q : quit browsing\n          h : print this help\n\n        Parameters\n        ----------\n        max_lines : int\n            Maximum number of lines in table output.\n\n        show_name : bool\n            Include a header row for column names. Default is True.\n\n        show_unit : bool\n            Include a header row for unit. Default is False.\n\n        \"\"\"\n        _more_tabcol = self._formatter._more_tabcol\n        _more_tabcol(self, max_lines=max_lines, show_name=show_name,\n                     show_unit=show_unit)\n\n    @property\n    def unit(self):\n        \"\"\"\n        The unit associated with this column.  May be a string or a\n        `astropy.units.UnitBase` instance.\n\n        Setting the ``unit`` property does not change the values of the\n        data.  To perform a unit conversion, use ``convert_unit_to``.\n        \"\"\"\n        return self._unit\n\n    @unit.setter\n    def unit(self, unit):\n        if unit is None:\n            self._unit = None\n        else:\n            self._unit = Unit(unit, parse_strict='silent')\n\n    @unit.deleter\n    def unit(self):\n        self._unit = None\n\n    def searchsorted(self, v, side='left', sorter=None):\n        # For bytes type data, encode the `v` value as UTF-8 (if necessary) before\n        # calling searchsorted. This prevents a factor of 1000 slowdown in\n        # searchsorted in this case.\n        a = self.data\n        if a.dtype.kind == 'S' and not isinstance(v, bytes):\n            v = np.asarray(v)\n            if v.dtype.kind == 'U':\n                v = np.char.encode(v, 'utf-8')\n        return np.searchsorted(a, v, side=side, sorter=sorter)\n    searchsorted.__doc__ = np.ndarray.searchsorted.__doc__\n\n    def convert_unit_to(self, new_unit, equivalencies=[]):\n        \"\"\"\n        Converts the values of the column in-place from the current\n        unit to the given unit.\n\n        To change the unit associated with this column without\n        actually changing the data values, simply set the ``unit``\n        property.\n\n        Parameters\n        ----------\n        new_unit : str or `astropy.units.UnitBase` instance\n            The unit to convert to.\n\n        equivalencies : list of tuple\n           A list of equivalence pairs to try if the unit are not\n           directly convertible.  See :ref:`astropy:unit_equivalencies`.\n\n        Raises\n        ------\n        astropy.units.UnitsError\n            If units are inconsistent\n        \"\"\"\n        if self.unit is None:\n            raise ValueError(\"No unit set on column\")\n        self.data[:] = self.unit.to(\n            new_unit, self.data, equivalencies=equivalencies)\n        self.unit = new_unit\n\n    @property\n    def groups(self):\n        if not hasattr(self, '_groups'):\n            self._groups = groups.ColumnGroups(self)\n        return self._groups\n\n    def group_by(self, keys):\n        \"\"\"\n        Group this column by the specified ``keys``\n\n        This effectively splits the column into groups which correspond to\n        unique values of the ``keys`` grouping object.  The output is a new\n        `Column` or `MaskedColumn` which contains a copy of this column but\n        sorted by row according to ``keys``.\n\n        The ``keys`` input to ``group_by`` must be a numpy array with the\n        same length as this column.\n\n        Parameters\n        ----------\n        keys : numpy array\n            Key grouping object\n\n        Returns\n        -------\n        out : Column\n            New column with groups attribute set accordingly\n        \"\"\"\n        return groups.column_group_by(self, keys)\n\n    def _copy_groups(self, out):\n        \"\"\"\n        Copy current groups into a copy of self ``out``\n        \"\"\"\n        if self.parent_table:\n            if hasattr(self.parent_table, '_groups'):\n                out._groups = groups.ColumnGroups(out, indices=self.parent_table._groups._indices)\n        elif hasattr(self, '_groups'):\n            out._groups = groups.ColumnGroups(out, indices=self._groups._indices)\n\n    # Strip off the BaseColumn-ness for repr and str so that\n    # MaskedColumn.data __repr__ does not include masked_BaseColumn(data =\n    # [1 2], ...).\n    def __repr__(self):\n        return np.asarray(self).__repr__()\n\n    @property\n    def quantity(self):\n        \"\"\"\n        A view of this table column as a `~astropy.units.Quantity` object with\n        units given by the Column's `unit` parameter.\n        \"\"\"\n        # the Quantity initializer is used here because it correctly fails\n        # if the column's values are non-numeric (like strings), while .view\n        # will happily return a quantity with gibberish for numerical values\n        return Quantity(self, self.unit, copy=False, dtype=self.dtype, order='A', subok=True)\n\n    def to(self, unit, equivalencies=[], **kwargs):\n        \"\"\"\n        Converts this table column to a `~astropy.units.Quantity` object with\n        the requested units.\n\n        Parameters\n        ----------\n        unit : unit-like\n            The unit to convert to (i.e., a valid argument to the\n            :meth:`astropy.units.Quantity.to` method).\n        equivalencies : list of tuple\n            Equivalencies to use for this conversion.  See\n            :meth:`astropy.units.Quantity.to` for more details.\n\n        Returns\n        -------\n        quantity : `~astropy.units.Quantity`\n            A quantity object with the contents of this column in the units\n            ``unit``.\n        \"\"\"\n        return self.quantity.to(unit, equivalencies)\n\n    def _copy_attrs(self, obj):\n        \"\"\"\n        Copy key column attributes from ``obj`` to self\n        \"\"\"\n        for attr in ('name', 'unit', '_format', 'description'):\n            val = getattr(obj, attr, None)\n            setattr(self, attr, val)\n\n        # Light copy of meta if it is not empty\n        obj_meta = getattr(obj, 'meta', None)\n        if obj_meta:\n            self.meta = obj_meta.copy()\n\n    @staticmethod\n    def _encode_str(value):\n        \"\"\"\n        Encode anything that is unicode-ish as utf-8.  This method is only\n        called for Py3+.\n        \"\"\"\n        if isinstance(value, str):\n            value = value.encode('utf-8')\n        elif isinstance(value, bytes) or value is np.ma.masked:\n            pass\n        else:\n            arr = np.asarray(value)\n            if arr.dtype.char == 'U':\n                arr = np.char.encode(arr, encoding='utf-8')\n                if isinstance(value, np.ma.MaskedArray):\n                    arr = np.ma.array(arr, mask=value.mask, copy=False)\n            value = arr\n\n        return value\n\n    def tolist(self):\n        if self.dtype.kind == 'S':\n            return np.chararray.decode(self, encoding='utf-8').tolist()\n        else:\n            return super().tolist()\n\n\nclass Column(BaseColumn):\n    \"\"\"Define a data column for use in a Table object.\n\n    Parameters\n    ----------\n    data : list, ndarray, or None\n        Column data values\n    name : str\n        Column name and key for reference within Table\n    dtype : `~numpy.dtype`-like\n        Data type for column\n    shape : tuple or ()\n        Dimensions of a single row element in the column data\n    length : int or 0\n        Number of row elements in column data\n    description : str or None\n        Full description of column\n    unit : str or None\n        Physical unit\n    format : str, None, or callable\n        Format string for outputting column values.  This can be an\n        \"old-style\" (``format % value``) or \"new-style\" (`str.format`)\n        format specification string or a function or any callable object that\n        accepts a single value and returns a string.\n    meta : dict-like or None\n        Meta-data associated with the column\n\n    Examples\n    --------\n    A Column can be created in two different ways:\n\n    - Provide a ``data`` value but not ``shape`` or ``length`` (which are\n      inferred from the data).\n\n      Examples::\n\n        col = Column(data=[1, 2], name='name')  # shape=(2,)\n        col = Column(data=[[1, 2], [3, 4]], name='name')  # shape=(2, 2)\n        col = Column(data=[1, 2], name='name', dtype=float)\n        col = Column(data=np.array([1, 2]), name='name')\n        col = Column(data=['hello', 'world'], name='name')\n\n      The ``dtype`` argument can be any value which is an acceptable\n      fixed-size data-type initializer for the numpy.dtype() method.  See\n      `<https://numpy.org/doc/stable/reference/arrays.dtypes.html>`_.\n      Examples include:\n\n      - Python non-string type (float, int, bool)\n      - Numpy non-string type (e.g. np.float32, np.int64, np.bool\\\\_)\n      - Numpy.dtype array-protocol type strings (e.g. 'i4', 'f8', 'S15')\n\n      If no ``dtype`` value is provide then the type is inferred using\n      ``np.array(data)``.\n\n    - Provide ``length`` and optionally ``shape``, but not ``data``\n\n      Examples::\n\n        col = Column(name='name', length=5)\n        col = Column(name='name', dtype=int, length=10, shape=(3,4))\n\n      The default ``dtype`` is ``np.float64``.  The ``shape`` argument is the\n      array shape of a single cell in the column.\n    \"\"\"\n\n    def __new__(cls, data=None, name=None,\n                dtype=None, shape=(), length=0,\n                description=None, unit=None, format=None, meta=None,\n                copy=False, copy_indices=True):\n\n        if isinstance(data, MaskedColumn) and np.any(data.mask):\n            raise TypeError(\"Cannot convert a MaskedColumn with masked value to a Column\")\n\n        self = super().__new__(\n            cls, data=data, name=name, dtype=dtype, shape=shape, length=length,\n            description=description, unit=unit, format=format, meta=meta,\n            copy=copy, copy_indices=copy_indices)\n        return self\n\n    def __setattr__(self, item, value):\n        if not isinstance(self, MaskedColumn) and item == \"mask\":\n            raise AttributeError(\"cannot set mask value to a column in non-masked Table\")\n        super().__setattr__(item, value)\n\n        if item == 'unit' and issubclass(self.dtype.type, np.number):\n            try:\n                converted = self.parent_table._convert_col_for_table(self)\n            except AttributeError:  # Either no parent table or parent table is None\n                pass\n            else:\n                if converted is not self:\n                    self.parent_table.replace_column(self.name, converted)\n\n    def _base_repr_(self, html=False):\n        # If scalar then just convert to correct numpy type and use numpy repr\n        if self.ndim == 0:\n            return repr(self.item())\n\n        descr_vals = [self.__class__.__name__]\n        unit = None if self.unit is None else str(self.unit)\n        shape = None if self.ndim <= 1 else self.shape[1:]\n        for attr, val in (('name', self.name),\n                          ('dtype', dtype_info_name(self.dtype)),\n                          ('shape', shape),\n                          ('unit', unit),\n                          ('format', self.format),\n                          ('description', self.description),\n                          ('length', len(self))):\n\n            if val is not None:\n                descr_vals.append(f'{attr}={val!r}')\n\n        descr = '<' + ' '.join(descr_vals) + '>\\n'\n\n        if html:\n            from astropy.utils.xml.writer import xml_escape\n            descr = xml_escape(descr)\n\n        data_lines, outs = self._formatter._pformat_col(\n            self, show_name=False, show_unit=False, show_length=False, html=html)\n\n        out = descr + '\\n'.join(data_lines)\n\n        return out\n\n    def _repr_html_(self):\n        return self._base_repr_(html=True)\n\n    def __repr__(self):\n        return self._base_repr_(html=False)\n\n    def __str__(self):\n        # If scalar then just convert to correct numpy type and use numpy repr\n        if self.ndim == 0:\n            return str(self.item())\n\n        lines, outs = self._formatter._pformat_col(self)\n        return '\\n'.join(lines)\n\n    def __bytes__(self):\n        return str(self).encode('utf-8')\n\n    def _check_string_truncate(self, value):\n        \"\"\"\n        Emit a warning if any elements of ``value`` will be truncated when\n        ``value`` is assigned to self.\n        \"\"\"\n        # Convert input ``value`` to the string dtype of this column and\n        # find the length of the longest string in the array.\n        value = np.asanyarray(value, dtype=self.dtype.type)\n        if value.size == 0:\n            return\n        value_str_len = np.char.str_len(value).max()\n\n        # Parse the array-protocol typestring (e.g. '|U15') of self.dtype which\n        # has the character repeat count on the right side.\n        self_str_len = dtype_bytes_or_chars(self.dtype)\n\n        if value_str_len > self_str_len:\n            warnings.warn('truncated right side string(s) longer than {} '\n                          'character(s) during assignment'\n                          .format(self_str_len),\n                          StringTruncateWarning,\n                          stacklevel=3)\n\n    def __setitem__(self, index, value):\n        if self.dtype.char == 'S':\n            value = self._encode_str(value)\n\n        # Issue warning for string assignment that truncates ``value``\n        if issubclass(self.dtype.type, np.character):\n            self._check_string_truncate(value)\n\n        # update indices\n        self.info.adjust_indices(index, value, len(self))\n\n        # Set items using a view of the underlying data, as it gives an\n        # order-of-magnitude speed-up. [#2994]\n        self.data[index] = value\n\n    __eq__ = _make_compare('__eq__')\n    __ne__ = _make_compare('__ne__')\n    __gt__ = _make_compare('__gt__')\n    __lt__ = _make_compare('__lt__')\n    __ge__ = _make_compare('__ge__')\n    __le__ = _make_compare('__le__')\n\n    def insert(self, obj, values, axis=0):\n        \"\"\"\n        Insert values before the given indices in the column and return\n        a new `~astropy.table.Column` object.\n\n        Parameters\n        ----------\n        obj : int, slice or sequence of int\n            Object that defines the index or indices before which ``values`` is\n            inserted.\n        values : array-like\n            Value(s) to insert.  If the type of ``values`` is different from\n            that of the column, ``values`` is converted to the matching type.\n            ``values`` should be shaped so that it can be broadcast appropriately.\n        axis : int, optional\n            Axis along which to insert ``values``.  If ``axis`` is None then\n            the column array is flattened before insertion.  Default is 0,\n            which will insert a row.\n\n        Returns\n        -------\n        out : `~astropy.table.Column`\n            A copy of column with ``values`` and ``mask`` inserted.  Note that the\n            insertion does not occur in-place: a new column is returned.\n        \"\"\"\n        if self.dtype.kind == 'O':\n            # Even if values is array-like (e.g. [1,2,3]), insert as a single\n            # object.  Numpy.insert instead inserts each element in an array-like\n            # input individually.\n            data = np.insert(self, obj, None, axis=axis)\n            data[obj] = values\n        else:\n            self_for_insert = _expand_string_array_for_values(self, values)\n            data = np.insert(self_for_insert, obj, values, axis=axis)\n\n        out = data.view(self.__class__)\n        out.__array_finalize__(self)\n        return out\n\n    # We do this to make the methods show up in the API docs\n    name = BaseColumn.name\n    unit = BaseColumn.unit\n    copy = BaseColumn.copy\n    more = BaseColumn.more\n    pprint = BaseColumn.pprint\n    pformat = BaseColumn.pformat\n    convert_unit_to = BaseColumn.convert_unit_to\n    quantity = BaseColumn.quantity\n    to = BaseColumn.to\n\n\nclass MaskedColumnInfo(ColumnInfo):\n    \"\"\"\n    Container for meta information like name, description, format.\n\n    This is required when the object is used as a mixin column within a table,\n    but can be used as a general way to store meta information.  In this case\n    it just adds the ``mask_val`` attribute.\n    \"\"\"\n    # Add `serialize_method` attribute to the attrs that MaskedColumnInfo knows\n    # about.  This allows customization of the way that MaskedColumn objects\n    # get written to file depending on format.  The default is to use whatever\n    # the writer would normally do, which in the case of FITS or ECSV is to use\n    # a NULL value within the data itself.  If serialize_method is 'data_mask'\n    # then the mask is explicitly written out as a separate column if there\n    # are any masked values.  See also code below.\n    attr_names = ColumnInfo.attr_names | {'serialize_method'}\n\n    # When `serialize_method` is 'data_mask', and data and mask are being written\n    # as separate columns, use column names <name> and <name>.mask (instead\n    # of default encoding as <name>.data and <name>.mask).\n    _represent_as_dict_primary_data = 'data'\n\n    mask_val = np.ma.masked\n\n    def __init__(self, bound=False):\n        super().__init__(bound)\n\n        # If bound to a data object instance then create the dict of attributes\n        # which stores the info attribute values.\n        if bound:\n            # Specify how to serialize this object depending on context.\n            self.serialize_method = {'fits': 'null_value',\n                                     'ecsv': 'null_value',\n                                     'hdf5': 'data_mask',\n                                     'parquet': 'data_mask',\n                                     None: 'null_value'}\n\n    def _represent_as_dict(self):\n        out = super()._represent_as_dict()\n\n        col = self._parent\n\n        # If the serialize method for this context (e.g. 'fits' or 'ecsv') is\n        # 'data_mask', that means to serialize using an explicit mask column.\n        method = self.serialize_method[self._serialize_context]\n\n        if method == 'data_mask':\n            # Note: a driver here is a performance issue in #8443 where repr() of a\n            # np.ma.MaskedArray value is up to 10 times slower than repr of a normal array\n            # value.  So regardless of whether there are masked elements it is useful to\n            # explicitly define this as a serialized column and use col.data.data (ndarray)\n            # instead of letting it fall through to the \"standard\" serialization machinery.\n            out['data'] = col.data.data\n\n            if np.any(col.mask):\n                # Only if there are actually masked elements do we add the ``mask`` column\n                out['mask'] = col.mask\n\n        elif method == 'null_value':\n            pass\n\n        else:\n            raise ValueError('serialize method must be either \"data_mask\" or \"null_value\"')\n\n        return out\n\n\nclass MaskedColumn(Column, _MaskedColumnGetitemShim, ma.MaskedArray):\n    \"\"\"Define a masked data column for use in a Table object.\n\n    Parameters\n    ----------\n    data : list, ndarray, or None\n        Column data values\n    name : str\n        Column name and key for reference within Table\n    mask : list, ndarray or None\n        Boolean mask for which True indicates missing or invalid data\n    fill_value : float, int, str, or None\n        Value used when filling masked column elements\n    dtype : `~numpy.dtype`-like\n        Data type for column\n    shape : tuple or ()\n        Dimensions of a single row element in the column data\n    length : int or 0\n        Number of row elements in column data\n    description : str or None\n        Full description of column\n    unit : str or None\n        Physical unit\n    format : str, None, or callable\n        Format string for outputting column values.  This can be an\n        \"old-style\" (``format % value``) or \"new-style\" (`str.format`)\n        format specification string or a function or any callable object that\n        accepts a single value and returns a string.\n    meta : dict-like or None\n        Meta-data associated with the column\n\n    Examples\n    --------\n    A MaskedColumn is similar to a Column except that it includes ``mask`` and\n    ``fill_value`` attributes.  It can be created in two different ways:\n\n    - Provide a ``data`` value but not ``shape`` or ``length`` (which are\n      inferred from the data).\n\n      Examples::\n\n        col = MaskedColumn(data=[1, 2], name='name')\n        col = MaskedColumn(data=[1, 2], name='name', mask=[True, False])\n        col = MaskedColumn(data=[1, 2], name='name', dtype=float, fill_value=99)\n\n      The ``mask`` argument will be cast as a boolean array and specifies\n      which elements are considered to be missing or invalid.\n\n      The ``dtype`` argument can be any value which is an acceptable\n      fixed-size data-type initializer for the numpy.dtype() method.  See\n      `<https://numpy.org/doc/stable/reference/arrays.dtypes.html>`_.\n      Examples include:\n\n      - Python non-string type (float, int, bool)\n      - Numpy non-string type (e.g. np.float32, np.int64, np.bool\\\\_)\n      - Numpy.dtype array-protocol type strings (e.g. 'i4', 'f8', 'S15')\n\n      If no ``dtype`` value is provide then the type is inferred using\n      ``np.array(data)``.  When ``data`` is provided then the ``shape``\n      and ``length`` arguments are ignored.\n\n    - Provide ``length`` and optionally ``shape``, but not ``data``\n\n      Examples::\n\n        col = MaskedColumn(name='name', length=5)\n        col = MaskedColumn(name='name', dtype=int, length=10, shape=(3,4))\n\n      The default ``dtype`` is ``np.float64``.  The ``shape`` argument is the\n      array shape of a single cell in the column.\n    \"\"\"\n    info = MaskedColumnInfo()\n\n    def __new__(cls, data=None, name=None, mask=None, fill_value=None,\n                dtype=None, shape=(), length=0,\n                description=None, unit=None, format=None, meta=None,\n                copy=False, copy_indices=True):\n\n        if mask is None:\n            # If mask is None then we need to determine the mask (if any) from the data.\n            # The naive method is looking for a mask attribute on data, but this can fail,\n            # see #8816.  Instead use ``MaskedArray`` to do the work.\n            mask = ma.MaskedArray(data).mask\n            if mask is np.ma.nomask:\n                # Handle odd-ball issue with np.ma.nomask (numpy #13758), and see below.\n                mask = False\n            elif copy:\n                mask = mask.copy()\n\n        elif mask is np.ma.nomask:\n            # Force the creation of a full mask array as nomask is tricky to\n            # use and will fail in an unexpected manner when setting a value\n            # to the mask.\n            mask = False\n        else:\n            mask = deepcopy(mask)\n\n        # Create self using MaskedArray as a wrapper class, following the example of\n        # class MSubArray in\n        # https://github.com/numpy/numpy/blob/maintenance/1.8.x/numpy/ma/tests/test_subclassing.py\n        # This pattern makes it so that __array_finalize__ is called as expected (e.g. #1471 and\n        # https://github.com/astropy/astropy/commit/ff6039e8)\n\n        # First just pass through all args and kwargs to BaseColumn, then wrap that object\n        # with MaskedArray.\n        self_data = BaseColumn(data, dtype=dtype, shape=shape, length=length, name=name,\n                               unit=unit, format=format, description=description,\n                               meta=meta, copy=copy, copy_indices=copy_indices)\n        self = ma.MaskedArray.__new__(cls, data=self_data, mask=mask)\n        # The above process preserves info relevant for Column, but this does\n        # not include serialize_method (and possibly other future attributes)\n        # relevant for MaskedColumn, so we set info explicitly.\n        if 'info' in getattr(data, '__dict__', {}):\n            self.info = data.info\n\n        # Note: do not set fill_value in the MaskedArray constructor because this does not\n        # go through the fill_value workarounds.\n        if fill_value is None and getattr(data, 'fill_value', None) is not None:\n            # Coerce the fill_value to the correct type since `data` may be a\n            # different dtype than self.\n            fill_value = np.array(data.fill_value, self.dtype)[()]\n        self.fill_value = fill_value\n\n        self.parent_table = None\n\n        # needs to be done here since self doesn't come from BaseColumn.__new__\n        for index in self.indices:\n            index.replace_col(self_data, self)\n\n        return self\n\n    @property\n    def fill_value(self):\n        return self.get_fill_value()  # defer to native ma.MaskedArray method\n\n    @fill_value.setter\n    def fill_value(self, val):\n        \"\"\"Set fill value both in the masked column view and in the parent table\n        if it exists.  Setting one or the other alone doesn't work.\"\"\"\n\n        # another ma bug workaround: If the value of fill_value for a string array is\n        # requested but not yet set then it gets created as 'N/A'.  From this point onward\n        # any new fill_values are truncated to 3 characters.  Note that this does not\n        # occur if the masked array is a structured array (as in the previous block that\n        # deals with the parent table).\n        #\n        # >>> x = ma.array(['xxxx'])\n        # >>> x.fill_value  # fill_value now gets represented as an 'S3' array\n        # 'N/A'\n        # >>> x.fill_value='yyyy'\n        # >>> x.fill_value\n        # 'yyy'\n        #\n        # To handle this we are forced to reset a private variable first:\n        self._fill_value = None\n\n        self.set_fill_value(val)  # defer to native ma.MaskedArray method\n\n    @property\n    def data(self):\n        \"\"\"The plain MaskedArray data held by this column.\"\"\"\n        out = self.view(np.ma.MaskedArray)\n        # By default, a MaskedArray view will set the _baseclass to be the\n        # same as that of our own class, i.e., BaseColumn.  Since we want\n        # to return a plain MaskedArray, we reset the baseclass accordingly.\n        out._baseclass = np.ndarray\n        return out\n\n    def filled(self, fill_value=None):\n        \"\"\"Return a copy of self, with masked values filled with a given value.\n\n        Parameters\n        ----------\n        fill_value : scalar; optional\n            The value to use for invalid entries (`None` by default).  If\n            `None`, the ``fill_value`` attribute of the array is used\n            instead.\n\n        Returns\n        -------\n        filled_column : Column\n            A copy of ``self`` with masked entries replaced by `fill_value`\n            (be it the function argument or the attribute of ``self``).\n        \"\"\"\n        if fill_value is None:\n            fill_value = self.fill_value\n\n        data = super().filled(fill_value)\n        # Use parent table definition of Column if available\n        column_cls = self.parent_table.Column if (self.parent_table is not None) else Column\n\n        out = column_cls(name=self.name, data=data, unit=self.unit,\n                         format=self.format, description=self.description,\n                         meta=deepcopy(self.meta))\n        return out\n\n    def insert(self, obj, values, mask=None, axis=0):\n        \"\"\"\n        Insert values along the given axis before the given indices and return\n        a new `~astropy.table.MaskedColumn` object.\n\n        Parameters\n        ----------\n        obj : int, slice or sequence of int\n            Object that defines the index or indices before which ``values`` is\n            inserted.\n        values : array-like\n            Value(s) to insert.  If the type of ``values`` is different from\n            that of the column, ``values`` is converted to the matching type.\n            ``values`` should be shaped so that it can be broadcast appropriately.\n        mask : bool or array-like\n            Mask value(s) to insert.  If not supplied, and values does not have\n            a mask either, then False is used.\n        axis : int, optional\n            Axis along which to insert ``values``.  If ``axis`` is None then\n            the column array is flattened before insertion.  Default is 0,\n            which will insert a row.\n\n        Returns\n        -------\n        out : `~astropy.table.MaskedColumn`\n            A copy of column with ``values`` and ``mask`` inserted.  Note that the\n            insertion does not occur in-place: a new masked column is returned.\n        \"\"\"\n        self_ma = self.data  # self viewed as MaskedArray\n\n        if self.dtype.kind == 'O':\n            # Even if values is array-like (e.g. [1,2,3]), insert as a single\n            # object.  Numpy.insert instead inserts each element in an array-like\n            # input individually.\n            new_data = np.insert(self_ma.data, obj, None, axis=axis)\n            new_data[obj] = values\n        else:\n            self_ma = _expand_string_array_for_values(self_ma, values)\n            new_data = np.insert(self_ma.data, obj, values, axis=axis)\n\n        if mask is None:\n            mask = getattr(values, 'mask', np.ma.nomask)\n            if mask is np.ma.nomask:\n                if self.dtype.kind == 'O':\n                    mask = False\n                else:\n                    mask = np.zeros(np.shape(values), dtype=bool)\n\n        new_mask = np.insert(self_ma.mask, obj, mask, axis=axis)\n        new_ma = np.ma.array(new_data, mask=new_mask, copy=False)\n\n        out = new_ma.view(self.__class__)\n        out.parent_table = None\n        out.indices = []\n        out._copy_attrs(self)\n        out.fill_value = self.fill_value\n\n        return out\n\n    def _copy_attrs_slice(self, out):\n        # Fixes issue #3023: when calling getitem with a MaskedArray subclass\n        # the original object attributes are not copied.\n        if out.__class__ is self.__class__:\n            # TODO: this part is essentially the same as what is done in\n            # __array_finalize__ and could probably be called directly in our\n            # override of __getitem__ in _columns_mixins.pyx). Refactor?\n            if 'info' in self.__dict__:\n                out.info = self.info\n            out.parent_table = None\n            # we need this because __getitem__ does a shallow copy of indices\n            if out.indices is self.indices:\n                out.indices = []\n            out._copy_attrs(self)\n        return out\n\n    def __setitem__(self, index, value):\n        # Issue warning for string assignment that truncates ``value``\n        if self.dtype.char == 'S':\n            value = self._encode_str(value)\n\n        if issubclass(self.dtype.type, np.character):\n            # Account for a bug in np.ma.MaskedArray setitem.\n            # https://github.com/numpy/numpy/issues/8624\n            value = np.ma.asanyarray(value, dtype=self.dtype.type)\n\n            # Check for string truncation after filling masked items with\n            # empty (zero-length) string.  Note that filled() does not make\n            # a copy if there are no masked items.\n            self._check_string_truncate(value.filled(''))\n\n        # update indices\n        self.info.adjust_indices(index, value, len(self))\n\n        ma.MaskedArray.__setitem__(self, index, value)\n\n    # We do this to make the methods show up in the API docs\n    name = BaseColumn.name\n    copy = BaseColumn.copy\n    more = BaseColumn.more\n    pprint = BaseColumn.pprint\n    pformat = BaseColumn.pformat\n    convert_unit_to = BaseColumn.convert_unit_to\n"},{"fileName":"setup_package.py","filePath":"astropy/table","id":9467,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\nfrom setuptools import Extension\n\nimport numpy\n\nROOT = os.path.relpath(os.path.dirname(__file__))\n\n\ndef get_extensions():\n    sources = [\"_np_utils.pyx\", \"_column_mixins.pyx\"]\n    include_dirs = [numpy.get_include()]\n\n    exts = [\n        Extension(name='astropy.table.' + os.path.splitext(source)[0],\n                  sources=[os.path.join(ROOT, source)],\n                  include_dirs=include_dirs)\n        for source in sources\n    ]\n\n    return exts\n"},{"col":0,"comment":"null","endLoc":22,"header":"def get_extensions()","id":9468,"name":"get_extensions","nodeType":"Function","startLoc":11,"text":"def get_extensions():\n    sources = [\"_np_utils.pyx\", \"_column_mixins.pyx\"]\n    include_dirs = [numpy.get_include()]\n\n    exts = [\n        Extension(name='astropy.table.' + os.path.splitext(source)[0],\n                  sources=[os.path.join(ROOT, source)],\n                  include_dirs=include_dirs)\n        for source in sources\n    ]\n\n    return exts"},{"className":"StringTruncateWarning","col":0,"comment":"\n    Warning class for when a string column is assigned a value\n    that gets truncated because the base (numpy) string length\n    is too short.\n\n    This does not inherit from AstropyWarning because we want to use\n    stacklevel=2 to show the user where the issue occurred in their code.\n    ","endLoc":37,"id":9469,"nodeType":"Class","startLoc":28,"text":"class StringTruncateWarning(UserWarning):\n    \"\"\"\n    Warning class for when a string column is assigned a value\n    that gets truncated because the base (numpy) string length\n    is too short.\n\n    This does not inherit from AstropyWarning because we want to use\n    stacklevel=2 to show the user where the issue occurred in their code.\n    \"\"\"\n    pass"},{"className":"ColumnInfo","col":0,"comment":"\n    Container for meta information like name, description, format.\n\n    This is required when the object is used as a mixin column within a table,\n    but can be used as a general way to store meta information.\n    ","endLoc":387,"id":9470,"nodeType":"Class","startLoc":336,"text":"class ColumnInfo(BaseColumnInfo):\n    \"\"\"\n    Container for meta information like name, description, format.\n\n    This is required when the object is used as a mixin column within a table,\n    but can be used as a general way to store meta information.\n    \"\"\"\n    attrs_from_parent = BaseColumnInfo.attr_names\n    _supports_indexing = True\n\n    def new_like(self, cols, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new Column instance which is consistent with the\n        input ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty column object whose elements can\n        be set in-place for table operations like join or vstack.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : Column (or subclass)\n            New instance of this class consistent with ``cols``\n\n        \"\"\"\n        attrs = self.merge_cols_attributes(cols, metadata_conflicts, name,\n                                           ('meta', 'unit', 'format', 'description'))\n\n        return self._parent_cls(length=length, **attrs)\n\n    def get_sortable_arrays(self):\n        \"\"\"\n        Return a list of arrays which can be lexically sorted to represent\n        the order of the parent column.\n\n        For Column this is just the column itself.\n\n        Returns\n        -------\n        arrays : list of ndarray\n        \"\"\"\n        return [self._parent]"},{"col":4,"comment":"\n        Return a new Column instance which is consistent with the\n        input ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty column object whose elements can\n        be set in-place for table operations like join or vstack.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : Column (or subclass)\n            New instance of this class consistent with ``cols``\n\n        ","endLoc":374,"header":"def new_like(self, cols, length, metadata_conflicts='warn', name=None)","id":9471,"name":"new_like","nodeType":"Function","startLoc":346,"text":"def new_like(self, cols, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new Column instance which is consistent with the\n        input ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty column object whose elements can\n        be set in-place for table operations like join or vstack.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : Column (or subclass)\n            New instance of this class consistent with ``cols``\n\n        \"\"\"\n        attrs = self.merge_cols_attributes(cols, metadata_conflicts, name,\n                                           ('meta', 'unit', 'format', 'description'))\n\n        return self._parent_cls(length=length, **attrs)"},{"fileName":"__init__.py","filePath":"astropy/table","id":9472,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport astropy.config as _config\nfrom .column import Column, MaskedColumn, StringTruncateWarning, ColumnInfo\n\n__all__ = ['BST', 'Column', 'ColumnGroups', 'ColumnInfo', 'Conf',\n           'JSViewer', 'MaskedColumn', 'NdarrayMixin', 'QTable', 'Row',\n           'SCEngine', 'SerializedColumn', 'SortedArray', 'StringTruncateWarning',\n           'Table', 'TableAttribute', 'TableColumns', 'TableFormatter',\n           'TableGroups', 'TableMergeError', 'TableReplaceWarning', 'conf',\n           'connect', 'hstack', 'join', 'registry', 'represent_mixins_as_columns',\n           'setdiff', 'unique', 'vstack', 'dstack', 'conf', 'join_skycoord',\n           'join_distance', 'PprintIncludeExclude']\n\n\nclass Conf(_config.ConfigNamespace):  # noqa\n    \"\"\"\n    Configuration parameters for `astropy.table`.\n    \"\"\"\n\n    auto_colname = _config.ConfigItem(\n        'col{0}',\n        'The template that determines the name of a column if it cannot be '\n        'determined. Uses new-style (format method) string formatting.',\n        aliases=['astropy.table.column.auto_colname'])\n    default_notebook_table_class = _config.ConfigItem(\n        'table-striped table-bordered table-condensed',\n        'The table class to be used in Jupyter notebooks when displaying '\n        'tables (and not overridden). See <https://getbootstrap.com/css/#tables '\n        'for a list of useful bootstrap classes.')\n    replace_warnings = _config.ConfigItem(\n        [],\n        'List of conditions for issuing a warning when replacing a table '\n        \"column using setitem, e.g. t['a'] = value.  Allowed options are \"\n        \"'always', 'slice', 'refcount', 'attributes'.\",\n        'string_list')\n    replace_inplace = _config.ConfigItem(\n        False,\n        'Always use in-place update of a table column when using setitem, '\n        \"e.g. t['a'] = value.  This overrides the default behavior of \"\n        \"replacing the column entirely with the new value when possible. \"\n        \"This configuration option will be deprecated and then removed in \"\n        \"subsequent major releases.\")\n\n\nconf = Conf()  # noqa\n\nfrom . import connect  # noqa: E402\nfrom .groups import TableGroups, ColumnGroups  # noqa: E402\nfrom .table import (Table, QTable, TableColumns, Row, TableFormatter,\n                    NdarrayMixin, TableReplaceWarning, TableAttribute,\n                    PprintIncludeExclude)  # noqa: E402\nfrom .operations import (join, setdiff, hstack, dstack, vstack, unique,  # noqa: E402\n                         TableMergeError, join_skycoord, join_distance)  # noqa: E402\nfrom .bst import BST  # noqa: E402\nfrom .sorted_array import SortedArray  # noqa: E402\nfrom .soco import SCEngine  # noqa: E402\nfrom .serialize import SerializedColumn, represent_mixins_as_columns  # noqa: E402\n\n# Finally import the formats for the read and write method but delay building\n# the documentation until all are loaded. (#5275)\nfrom astropy.io import registry  # noqa: E402\n\nwith registry.delay_doc_updates(Table):\n    # Import routines that connect readers/writers to astropy.table\n    from .jsviewer import JSViewer\n    import astropy.io.ascii.connect\n    import astropy.io.fits.connect\n    import astropy.io.misc.connect\n    import astropy.io.votable.connect\n    import astropy.io.misc.asdf.connect\n    import astropy.io.misc.pandas.connect  # noqa: F401\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":9473,"name":"ROOT","nodeType":"Attribute","startLoc":8,"text":"ROOT"},{"col":0,"comment":"","endLoc":3,"header":"setup_package.py#<anonymous>","id":9474,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"ROOT = os.path.relpath(os.path.dirname(__file__))"},{"col":4,"comment":"Get the value of the attribute.\n\n        Returns\n        -------\n        names : None, tuple\n            Include/exclude names\n        ","endLoc":438,"header":"def __call__(self)","id":9475,"name":"__call__","nodeType":"Function","startLoc":428,"text":"def __call__(self):\n        \"\"\"Get the value of the attribute.\n\n        Returns\n        -------\n        names : None, tuple\n            Include/exclude names\n        \"\"\"\n        # Get the value from instance.meta['__attributes__']\n        instance = self._instance_ref()\n        return super().__get__(instance, instance.__class__)"},{"fileName":"meta.py","filePath":"astropy/table","id":9476,"nodeType":"File","text":"import json\nimport textwrap\nimport copy\nfrom collections import OrderedDict\n\nimport numpy as np\nimport yaml\n\n__all__ = ['get_header_from_yaml', 'get_yaml_from_header', 'get_yaml_from_table']\n\n\nclass ColumnOrderList(list):\n    \"\"\"\n    List of tuples that sorts in a specific order that makes sense for\n    astropy table column attributes.\n    \"\"\"\n\n    def sort(self, *args, **kwargs):\n        super().sort()\n\n        column_keys = ['name', 'unit', 'datatype', 'format', 'description', 'meta']\n        in_dict = dict(self)\n        out_list = []\n\n        for key in column_keys:\n            if key in in_dict:\n                out_list.append((key, in_dict[key]))\n        for key, val in self:\n            if key not in column_keys:\n                out_list.append((key, val))\n\n        # Clear list in-place\n        del self[:]\n\n        self.extend(out_list)\n\n\nclass ColumnDict(dict):\n    \"\"\"\n    Specialized dict subclass to represent attributes of a Column\n    and return items() in a preferred order.  This is only for use\n    in generating a YAML map representation that has a fixed order.\n    \"\"\"\n\n    def items(self):\n        \"\"\"\n        Return items as a ColumnOrderList, which sorts in the preferred\n        way for column attributes.\n        \"\"\"\n        return ColumnOrderList(super().items())\n\n\ndef _construct_odict(load, node):\n    \"\"\"\n    Construct OrderedDict from !!omap in yaml safe load.\n\n    Source: https://gist.github.com/weaver/317164\n    License: Unspecified\n\n    This is the same as SafeConstructor.construct_yaml_omap(),\n    except the data type is changed to OrderedDict() and setitem is\n    used instead of append in the loop\n\n    Examples\n    --------\n    ::\n\n      >>> yaml.load('''  # doctest: +SKIP\n      ... !!omap\n      ... - foo: bar\n      ... - mumble: quux\n      ... - baz: gorp\n      ... ''')\n      OrderedDict([('foo', 'bar'), ('mumble', 'quux'), ('baz', 'gorp')])\n\n      >>> yaml.load('''!!omap [ foo: bar, mumble: quux, baz : gorp ]''')  # doctest: +SKIP\n      OrderedDict([('foo', 'bar'), ('mumble', 'quux'), ('baz', 'gorp')])\n    \"\"\"\n    omap = OrderedDict()\n    yield omap\n    if not isinstance(node, yaml.SequenceNode):\n        raise yaml.constructor.ConstructorError(\n            \"while constructing an ordered map\", node.start_mark,\n            f\"expected a sequence, but found {node.id}\", node.start_mark)\n\n    for subnode in node.value:\n        if not isinstance(subnode, yaml.MappingNode):\n            raise yaml.constructor.ConstructorError(\n                \"while constructing an ordered map\", node.start_mark,\n                f\"expected a mapping of length 1, but found {subnode.id}\",\n                subnode.start_mark)\n\n        if len(subnode.value) != 1:\n            raise yaml.constructor.ConstructorError(\n                \"while constructing an ordered map\", node.start_mark,\n                f\"expected a single mapping item, but found {len(subnode.value)} items\",\n                subnode.start_mark)\n\n        key_node, value_node = subnode.value[0]\n        key = load.construct_object(key_node)\n        value = load.construct_object(value_node)\n        omap[key] = value\n\n\ndef _repr_pairs(dump, tag, sequence, flow_style=None):\n    \"\"\"\n    This is the same code as BaseRepresenter.represent_sequence(),\n    but the value passed to dump.represent_data() in the loop is a\n    dictionary instead of a tuple.\n\n    Source: https://gist.github.com/weaver/317164\n    License: Unspecified\n    \"\"\"\n    value = []\n    node = yaml.SequenceNode(tag, value, flow_style=flow_style)\n    if dump.alias_key is not None:\n        dump.represented_objects[dump.alias_key] = node\n    best_style = True\n    for (key, val) in sequence:\n        item = dump.represent_data({key: val})\n        if not (isinstance(item, yaml.ScalarNode) and not item.style):\n            best_style = False\n        value.append(item)\n    if flow_style is None:\n        if dump.default_flow_style is not None:\n            node.flow_style = dump.default_flow_style\n        else:\n            node.flow_style = best_style\n    return node\n\n\ndef _repr_odict(dumper, data):\n    \"\"\"\n    Represent OrderedDict in yaml dump.\n\n    Source: https://gist.github.com/weaver/317164\n    License: Unspecified\n\n    >>> data = OrderedDict([('foo', 'bar'), ('mumble', 'quux'), ('baz', 'gorp')])\n    >>> yaml.dump(data, default_flow_style=False)  # doctest: +SKIP\n    '!!omap\\\\n- foo: bar\\\\n- mumble: quux\\\\n- baz: gorp\\\\n'\n    >>> yaml.dump(data, default_flow_style=True)  # doctest: +SKIP\n    '!!omap [foo: bar, mumble: quux, baz: gorp]\\\\n'\n    \"\"\"\n    return _repr_pairs(dumper, 'tag:yaml.org,2002:omap', data.items())\n\n\ndef _repr_column_dict(dumper, data):\n    \"\"\"\n    Represent ColumnDict in yaml dump.\n\n    This is the same as an ordinary mapping except that the keys\n    are written in a fixed order that makes sense for astropy table\n    columns.\n    \"\"\"\n    return dumper.represent_mapping('tag:yaml.org,2002:map', data)\n\n\ndef _get_variable_length_array_shape(col):\n    \"\"\"Check if object-type ``col`` is really a variable length list.\n\n    That is true if the object consists purely of list of nested lists, where\n    the shape of every item can be represented as (m, n, ..., *) where the (m,\n    n, ...) are constant and only the lists in the last axis have variable\n    shape. If so the returned value of shape will be a tuple in the form (m, n,\n    ..., None).\n\n    If ``col`` is a variable length array then the return ``dtype`` corresponds\n    to the type found by numpy for all the individual values. Otherwise it will\n    be ``np.dtype(object)``.\n\n    Parameters\n    ==========\n    col : column-like\n        Input table column, assumed to be object-type\n\n    Returns\n    =======\n    shape : tuple\n        Inferred variable length shape or None\n    dtype : np.dtype\n        Numpy dtype that applies to col\n    \"\"\"\n    class ConvertError(ValueError):\n        \"\"\"Local conversion error used below\"\"\"\n\n    # Numpy types supported as variable-length arrays\n    np_classes = (np.floating, np.integer, np.bool_, np.unicode_)\n\n    try:\n        if len(col) == 0 or not all(isinstance(val, np.ndarray) for val in col):\n            raise ConvertError\n        dtype = col[0].dtype\n        shape = col[0].shape[:-1]\n        for val in col:\n            if not issubclass(val.dtype.type, np_classes) or val.shape[:-1] != shape:\n                raise ConvertError\n            dtype = np.promote_types(dtype, val.dtype)\n        shape = shape + (None,)\n\n    except ConvertError:\n        # `col` is not a variable length array, return shape and dtype to\n        #  the original. Note that this function is only called if\n        #  col.shape[1:] was () and col.info.dtype is object.\n        dtype = col.info.dtype\n        shape = ()\n\n    return shape, dtype\n\n\ndef _get_datatype_from_dtype(dtype):\n    \"\"\"Return string version of ``dtype`` for writing to ECSV ``datatype``\"\"\"\n    datatype = dtype.name\n    if datatype.startswith(('bytes', 'str')):\n        datatype = 'string'\n    if datatype.endswith('_'):\n        datatype = datatype[:-1]  # string_ and bool_ lose the final _ for ECSV\n    return datatype\n\n\ndef _get_col_attributes(col):\n    \"\"\"\n    Extract information from a column (apart from the values) that is required\n    to fully serialize the column.\n\n    Parameters\n    ----------\n    col : column-like\n        Input Table column\n\n    Returns\n    -------\n    attrs : dict\n        Dict of ECSV attributes for ``col``\n    \"\"\"\n    dtype = col.info.dtype  # Type of column values that get written\n    subtype = None  # Type of data for object columns serialized with JSON\n    shape = col.shape[1:]  # Shape of multidim / variable length columns\n\n    if dtype.name == 'object':\n        if shape == ():\n            # 1-d object type column might be a variable length array\n            dtype = np.dtype(str)\n            shape, subtype = _get_variable_length_array_shape(col)\n        else:\n            # N-d object column is subtype object but serialized as JSON string\n            dtype = np.dtype(str)\n            subtype = np.dtype(object)\n    elif shape:\n        # N-d column which is not object is serialized as JSON string\n        dtype = np.dtype(str)\n        subtype = col.info.dtype\n\n    datatype = _get_datatype_from_dtype(dtype)\n\n    # Set the output attributes\n    attrs = ColumnDict()\n    attrs['name'] = col.info.name\n    attrs['datatype'] = datatype\n    for attr, nontrivial, xform in (('unit', lambda x: x is not None, str),\n                                    ('format', lambda x: x is not None, None),\n                                    ('description', lambda x: x is not None, None),\n                                    ('meta', lambda x: x, None)):\n        col_attr = getattr(col.info, attr)\n        if nontrivial(col_attr):\n            attrs[attr] = xform(col_attr) if xform else col_attr\n\n    if subtype:\n        attrs['subtype'] = _get_datatype_from_dtype(subtype)\n        # Numpy 'object' maps to 'subtype' of 'json' in ECSV\n        if attrs['subtype'] == 'object':\n            attrs['subtype'] = 'json'\n    if shape:\n        attrs['subtype'] += json.dumps(list(shape), separators=(',', ':'))\n\n    return attrs\n\n\ndef get_yaml_from_table(table):\n    \"\"\"\n    Return lines with a YAML representation of header content from the ``table``.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table` object\n        Table for which header content is output\n\n    Returns\n    -------\n    lines : list\n        List of text lines with YAML header content\n    \"\"\"\n\n    header = {'cols': list(table.columns.values())}\n    if table.meta:\n        header['meta'] = table.meta\n\n    return get_yaml_from_header(header)\n\n\ndef get_yaml_from_header(header):\n    \"\"\"\n    Return lines with a YAML representation of header content from a Table.\n\n    The ``header`` dict must contain these keys:\n\n    - 'cols' : list of table column objects (required)\n    - 'meta' : table 'meta' attribute (optional)\n\n    Other keys included in ``header`` will be serialized in the output YAML\n    representation.\n\n    Parameters\n    ----------\n    header : dict\n        Table header content\n\n    Returns\n    -------\n    lines : list\n        List of text lines with YAML header content\n    \"\"\"\n    from astropy.io.misc.yaml import AstropyDumper\n\n    class TableDumper(AstropyDumper):\n        \"\"\"\n        Custom Dumper that represents OrderedDict as an !!omap object.\n        \"\"\"\n\n        def represent_mapping(self, tag, mapping, flow_style=None):\n            \"\"\"\n            This is a combination of the Python 2 and 3 versions of this method\n            in the PyYAML library to allow the required key ordering via the\n            ColumnOrderList object.  The Python 3 version insists on turning the\n            items() mapping into a list object and sorting, which results in\n            alphabetical order for the column keys.\n            \"\"\"\n            value = []\n            node = yaml.MappingNode(tag, value, flow_style=flow_style)\n            if self.alias_key is not None:\n                self.represented_objects[self.alias_key] = node\n            best_style = True\n            if hasattr(mapping, 'items'):\n                mapping = mapping.items()\n                if hasattr(mapping, 'sort'):\n                    mapping.sort()\n                else:\n                    mapping = list(mapping)\n                    try:\n                        mapping = sorted(mapping)\n                    except TypeError:\n                        pass\n\n            for item_key, item_value in mapping:\n                node_key = self.represent_data(item_key)\n                node_value = self.represent_data(item_value)\n                if not (isinstance(node_key, yaml.ScalarNode) and not node_key.style):\n                    best_style = False\n                if not (isinstance(node_value, yaml.ScalarNode) and not node_value.style):\n                    best_style = False\n                value.append((node_key, node_value))\n            if flow_style is None:\n                if self.default_flow_style is not None:\n                    node.flow_style = self.default_flow_style\n                else:\n                    node.flow_style = best_style\n            return node\n\n    TableDumper.add_representer(OrderedDict, _repr_odict)\n    TableDumper.add_representer(ColumnDict, _repr_column_dict)\n\n    header = copy.copy(header)  # Don't overwrite original\n    header['datatype'] = [_get_col_attributes(col) for col in header['cols']]\n    del header['cols']\n\n    lines = yaml.dump(header, default_flow_style=None,\n                      Dumper=TableDumper, width=130).splitlines()\n    return lines\n\n\nclass YamlParseError(Exception):\n    pass\n\n\ndef get_header_from_yaml(lines):\n    \"\"\"\n    Get a header dict from input ``lines`` which should be valid YAML.  This\n    input will typically be created by get_yaml_from_header.  The output is a\n    dictionary which describes all the table and column meta.\n\n    The get_cols() method in the io/ascii/ecsv.py file should be used as a\n    guide to using the information when constructing a table using this\n    header dict information.\n\n    Parameters\n    ----------\n    lines : list\n        List of text lines with YAML header content\n\n    Returns\n    -------\n    header : dict\n        Dictionary describing table and column meta\n\n    \"\"\"\n    from astropy.io.misc.yaml import AstropyLoader\n\n    class TableLoader(AstropyLoader):\n        \"\"\"\n        Custom Loader that constructs OrderedDict from an !!omap object.\n        This does nothing but provide a namespace for adding the\n        custom odict constructor.\n        \"\"\"\n\n    TableLoader.add_constructor('tag:yaml.org,2002:omap', _construct_odict)\n    # Now actually load the YAML data structure into `meta`\n    header_yaml = textwrap.dedent('\\n'.join(lines))\n    try:\n        header = yaml.load(header_yaml, Loader=TableLoader)\n    except Exception as err:\n        raise YamlParseError() from err\n\n    return header\n"},{"className":"ColumnOrderList","col":0,"comment":"\n    List of tuples that sorts in a specific order that makes sense for\n    astropy table column attributes.\n    ","endLoc":35,"id":9477,"nodeType":"Class","startLoc":12,"text":"class ColumnOrderList(list):\n    \"\"\"\n    List of tuples that sorts in a specific order that makes sense for\n    astropy table column attributes.\n    \"\"\"\n\n    def sort(self, *args, **kwargs):\n        super().sort()\n\n        column_keys = ['name', 'unit', 'datatype', 'format', 'description', 'meta']\n        in_dict = dict(self)\n        out_list = []\n\n        for key in column_keys:\n            if key in in_dict:\n                out_list.append((key, in_dict[key]))\n        for key, val in self:\n            if key not in column_keys:\n                out_list.append((key, val))\n\n        # Clear list in-place\n        del self[:]\n\n        self.extend(out_list)"},{"col":4,"comment":"null","endLoc":35,"header":"def sort(self, *args, **kwargs)","id":9478,"name":"sort","nodeType":"Function","startLoc":18,"text":"def sort(self, *args, **kwargs):\n        super().sort()\n\n        column_keys = ['name', 'unit', 'datatype', 'format', 'description', 'meta']\n        in_dict = dict(self)\n        out_list = []\n\n        for key in column_keys:\n            if key in in_dict:\n                out_list.append((key, in_dict[key]))\n        for key, val in self:\n            if key not in column_keys:\n                out_list.append((key, val))\n\n        # Clear list in-place\n        del self[:]\n\n        self.extend(out_list)"},{"col":4,"comment":"\n        Return a list of arrays which can be lexically sorted to represent\n        the order of the parent column.\n\n        For Column this is just the column itself.\n\n        Returns\n        -------\n        arrays : list of ndarray\n        ","endLoc":387,"header":"def get_sortable_arrays(self)","id":9479,"name":"get_sortable_arrays","nodeType":"Function","startLoc":376,"text":"def get_sortable_arrays(self):\n        \"\"\"\n        Return a list of arrays which can be lexically sorted to represent\n        the order of the parent column.\n\n        For Column this is just the column itself.\n\n        Returns\n        -------\n        arrays : list of ndarray\n        \"\"\"\n        return [self._parent]"},{"attributeType":"null","col":4,"comment":"null","endLoc":343,"id":9480,"name":"attrs_from_parent","nodeType":"Attribute","startLoc":343,"text":"attrs_from_parent"},{"className":"ColumnDict","col":0,"comment":"\n    Specialized dict subclass to represent attributes of a Column\n    and return items() in a preferred order.  This is only for use\n    in generating a YAML map representation that has a fixed order.\n    ","endLoc":50,"id":9481,"nodeType":"Class","startLoc":38,"text":"class ColumnDict(dict):\n    \"\"\"\n    Specialized dict subclass to represent attributes of a Column\n    and return items() in a preferred order.  This is only for use\n    in generating a YAML map representation that has a fixed order.\n    \"\"\"\n\n    def items(self):\n        \"\"\"\n        Return items as a ColumnOrderList, which sorts in the preferred\n        way for column attributes.\n        \"\"\"\n        return ColumnOrderList(super().items())"},{"col":4,"comment":"\n        Return items as a ColumnOrderList, which sorts in the preferred\n        way for column attributes.\n        ","endLoc":50,"header":"def items(self)","id":9482,"name":"items","nodeType":"Function","startLoc":45,"text":"def items(self):\n        \"\"\"\n        Return items as a ColumnOrderList, which sorts in the preferred\n        way for column attributes.\n        \"\"\"\n        return ColumnOrderList(super().items())"},{"attributeType":"null","col":4,"comment":"null","endLoc":344,"id":9483,"name":"_supports_indexing","nodeType":"Attribute","startLoc":344,"text":"_supports_indexing"},{"className":"MaskedColumnInfo","col":0,"comment":"\n    Container for meta information like name, description, format.\n\n    This is required when the object is used as a mixin column within a table,\n    but can be used as a general way to store meta information.  In this case\n    it just adds the ``mask_val`` attribute.\n    ","endLoc":1305,"id":9484,"nodeType":"Class","startLoc":1241,"text":"class MaskedColumnInfo(ColumnInfo):\n    \"\"\"\n    Container for meta information like name, description, format.\n\n    This is required when the object is used as a mixin column within a table,\n    but can be used as a general way to store meta information.  In this case\n    it just adds the ``mask_val`` attribute.\n    \"\"\"\n    # Add `serialize_method` attribute to the attrs that MaskedColumnInfo knows\n    # about.  This allows customization of the way that MaskedColumn objects\n    # get written to file depending on format.  The default is to use whatever\n    # the writer would normally do, which in the case of FITS or ECSV is to use\n    # a NULL value within the data itself.  If serialize_method is 'data_mask'\n    # then the mask is explicitly written out as a separate column if there\n    # are any masked values.  See also code below.\n    attr_names = ColumnInfo.attr_names | {'serialize_method'}\n\n    # When `serialize_method` is 'data_mask', and data and mask are being written\n    # as separate columns, use column names <name> and <name>.mask (instead\n    # of default encoding as <name>.data and <name>.mask).\n    _represent_as_dict_primary_data = 'data'\n\n    mask_val = np.ma.masked\n\n    def __init__(self, bound=False):\n        super().__init__(bound)\n\n        # If bound to a data object instance then create the dict of attributes\n        # which stores the info attribute values.\n        if bound:\n            # Specify how to serialize this object depending on context.\n            self.serialize_method = {'fits': 'null_value',\n                                     'ecsv': 'null_value',\n                                     'hdf5': 'data_mask',\n                                     'parquet': 'data_mask',\n                                     None: 'null_value'}\n\n    def _represent_as_dict(self):\n        out = super()._represent_as_dict()\n\n        col = self._parent\n\n        # If the serialize method for this context (e.g. 'fits' or 'ecsv') is\n        # 'data_mask', that means to serialize using an explicit mask column.\n        method = self.serialize_method[self._serialize_context]\n\n        if method == 'data_mask':\n            # Note: a driver here is a performance issue in #8443 where repr() of a\n            # np.ma.MaskedArray value is up to 10 times slower than repr of a normal array\n            # value.  So regardless of whether there are masked elements it is useful to\n            # explicitly define this as a serialized column and use col.data.data (ndarray)\n            # instead of letting it fall through to the \"standard\" serialization machinery.\n            out['data'] = col.data.data\n\n            if np.any(col.mask):\n                # Only if there are actually masked elements do we add the ``mask`` column\n                out['mask'] = col.mask\n\n        elif method == 'null_value':\n            pass\n\n        else:\n            raise ValueError('serialize method must be either \"data_mask\" or \"null_value\"')\n\n        return out"},{"col":4,"comment":"null","endLoc":1276,"header":"def __init__(self, bound=False)","id":9485,"name":"__init__","nodeType":"Function","startLoc":1265,"text":"def __init__(self, bound=False):\n        super().__init__(bound)\n\n        # If bound to a data object instance then create the dict of attributes\n        # which stores the info attribute values.\n        if bound:\n            # Specify how to serialize this object depending on context.\n            self.serialize_method = {'fits': 'null_value',\n                                     'ecsv': 'null_value',\n                                     'hdf5': 'data_mask',\n                                     'parquet': 'data_mask',\n                                     None: 'null_value'}"},{"className":"YamlParseError","col":0,"comment":"null","endLoc":382,"id":9486,"nodeType":"Class","startLoc":381,"text":"class YamlParseError(Exception):\n    pass"},{"col":0,"comment":"\n    Construct OrderedDict from !!omap in yaml safe load.\n\n    Source: https://gist.github.com/weaver/317164\n    License: Unspecified\n\n    This is the same as SafeConstructor.construct_yaml_omap(),\n    except the data type is changed to OrderedDict() and setitem is\n    used instead of append in the loop\n\n    Examples\n    --------\n    ::\n\n      >>> yaml.load('''  # doctest: +SKIP\n      ... !!omap\n      ... - foo: bar\n      ... - mumble: quux\n      ... - baz: gorp\n      ... ''')\n      OrderedDict([('foo', 'bar'), ('mumble', 'quux'), ('baz', 'gorp')])\n\n      >>> yaml.load('''!!omap [ foo: bar, mumble: quux, baz : gorp ]''')  # doctest: +SKIP\n      OrderedDict([('foo', 'bar'), ('mumble', 'quux'), ('baz', 'gorp')])\n    ","endLoc":102,"header":"def _construct_odict(load, node)","id":9487,"name":"_construct_odict","nodeType":"Function","startLoc":53,"text":"def _construct_odict(load, node):\n    \"\"\"\n    Construct OrderedDict from !!omap in yaml safe load.\n\n    Source: https://gist.github.com/weaver/317164\n    License: Unspecified\n\n    This is the same as SafeConstructor.construct_yaml_omap(),\n    except the data type is changed to OrderedDict() and setitem is\n    used instead of append in the loop\n\n    Examples\n    --------\n    ::\n\n      >>> yaml.load('''  # doctest: +SKIP\n      ... !!omap\n      ... - foo: bar\n      ... - mumble: quux\n      ... - baz: gorp\n      ... ''')\n      OrderedDict([('foo', 'bar'), ('mumble', 'quux'), ('baz', 'gorp')])\n\n      >>> yaml.load('''!!omap [ foo: bar, mumble: quux, baz : gorp ]''')  # doctest: +SKIP\n      OrderedDict([('foo', 'bar'), ('mumble', 'quux'), ('baz', 'gorp')])\n    \"\"\"\n    omap = OrderedDict()\n    yield omap\n    if not isinstance(node, yaml.SequenceNode):\n        raise yaml.constructor.ConstructorError(\n            \"while constructing an ordered map\", node.start_mark,\n            f\"expected a sequence, but found {node.id}\", node.start_mark)\n\n    for subnode in node.value:\n        if not isinstance(subnode, yaml.MappingNode):\n            raise yaml.constructor.ConstructorError(\n                \"while constructing an ordered map\", node.start_mark,\n                f\"expected a mapping of length 1, but found {subnode.id}\",\n                subnode.start_mark)\n\n        if len(subnode.value) != 1:\n            raise yaml.constructor.ConstructorError(\n                \"while constructing an ordered map\", node.start_mark,\n                f\"expected a single mapping item, but found {len(subnode.value)} items\",\n                subnode.start_mark)\n\n        key_node, value_node = subnode.value[0]\n        key = load.construct_object(key_node)\n        value = load.construct_object(value_node)\n        omap[key] = value"},{"col":4,"comment":"null","endLoc":445,"header":"def __repr__(self)","id":9488,"name":"__repr__","nodeType":"Function","startLoc":440,"text":"def __repr__(self):\n        if hasattr(self, '_instance_ref'):\n            out = f'<{self.__class__.__name__} name={self.name} value={self()}>'\n        else:\n            out = super().__repr__()\n        return out"},{"col":4,"comment":"null","endLoc":1305,"header":"def _represent_as_dict(self)","id":9489,"name":"_represent_as_dict","nodeType":"Function","startLoc":1278,"text":"def _represent_as_dict(self):\n        out = super()._represent_as_dict()\n\n        col = self._parent\n\n        # If the serialize method for this context (e.g. 'fits' or 'ecsv') is\n        # 'data_mask', that means to serialize using an explicit mask column.\n        method = self.serialize_method[self._serialize_context]\n\n        if method == 'data_mask':\n            # Note: a driver here is a performance issue in #8443 where repr() of a\n            # np.ma.MaskedArray value is up to 10 times slower than repr of a normal array\n            # value.  So regardless of whether there are masked elements it is useful to\n            # explicitly define this as a serialized column and use col.data.data (ndarray)\n            # instead of letting it fall through to the \"standard\" serialization machinery.\n            out['data'] = col.data.data\n\n            if np.any(col.mask):\n                # Only if there are actually masked elements do we add the ``mask`` column\n                out['mask'] = col.mask\n\n        elif method == 'null_value':\n            pass\n\n        else:\n            raise ValueError('serialize method must be either \"data_mask\" or \"null_value\"')\n\n        return out"},{"col":4,"comment":"\n        Remove the given rows from the index.\n\n        Parameters\n        ----------\n        row_specifier : int, list, ndarray, or slice\n            Indicates which row(s) to remove\n        ","endLoc":223,"header":"def remove_rows(self, row_specifier)","id":9490,"name":"remove_rows","nodeType":"Function","startLoc":204,"text":"def remove_rows(self, row_specifier):\n        '''\n        Remove the given rows from the index.\n\n        Parameters\n        ----------\n        row_specifier : int, list, ndarray, or slice\n            Indicates which row(s) to remove\n        '''\n        rows = []\n\n        # To maintain the correct row order, we loop twice,\n        # deleting rows first and then reordering the remaining rows\n        for row in self.get_row_specifier(row_specifier):\n            self.remove_row(row, reorder=False)\n            rows.append(row)\n        # second pass - row order is reversed to maintain\n        # correct row numbers\n        for row in reversed(sorted(rows)):\n            self.data.shift_left(row)"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.table`.\n    ","endLoc":43,"id":9491,"nodeType":"Class","startLoc":16,"text":"class Conf(_config.ConfigNamespace):  # noqa\n    \"\"\"\n    Configuration parameters for `astropy.table`.\n    \"\"\"\n\n    auto_colname = _config.ConfigItem(\n        'col{0}',\n        'The template that determines the name of a column if it cannot be '\n        'determined. Uses new-style (format method) string formatting.',\n        aliases=['astropy.table.column.auto_colname'])\n    default_notebook_table_class = _config.ConfigItem(\n        'table-striped table-bordered table-condensed',\n        'The table class to be used in Jupyter notebooks when displaying '\n        'tables (and not overridden). See <https://getbootstrap.com/css/#tables '\n        'for a list of useful bootstrap classes.')\n    replace_warnings = _config.ConfigItem(\n        [],\n        'List of conditions for issuing a warning when replacing a table '\n        \"column using setitem, e.g. t['a'] = value.  Allowed options are \"\n        \"'always', 'slice', 'refcount', 'attributes'.\",\n        'string_list')\n    replace_inplace = _config.ConfigItem(\n        False,\n        'Always use in-place update of a table column when using setitem, '\n        \"e.g. t['a'] = value.  This overrides the default behavior of \"\n        \"replacing the column entirely with the new value when possible. \"\n        \"This configuration option will be deprecated and then removed in \"\n        \"subsequent major releases.\")"},{"col":0,"comment":"\n    This is the same code as BaseRepresenter.represent_sequence(),\n    but the value passed to dump.represent_data() in the loop is a\n    dictionary instead of a tuple.\n\n    Source: https://gist.github.com/weaver/317164\n    License: Unspecified\n    ","endLoc":129,"header":"def _repr_pairs(dump, tag, sequence, flow_style=None)","id":9492,"name":"_repr_pairs","nodeType":"Function","startLoc":105,"text":"def _repr_pairs(dump, tag, sequence, flow_style=None):\n    \"\"\"\n    This is the same code as BaseRepresenter.represent_sequence(),\n    but the value passed to dump.represent_data() in the loop is a\n    dictionary instead of a tuple.\n\n    Source: https://gist.github.com/weaver/317164\n    License: Unspecified\n    \"\"\"\n    value = []\n    node = yaml.SequenceNode(tag, value, flow_style=flow_style)\n    if dump.alias_key is not None:\n        dump.represented_objects[dump.alias_key] = node\n    best_style = True\n    for (key, val) in sequence:\n        item = dump.represent_data({key: val})\n        if not (isinstance(item, yaml.ScalarNode) and not item.style):\n            best_style = False\n        value.append(item)\n    if flow_style is None:\n        if dump.default_flow_style is not None:\n            node.flow_style = dump.default_flow_style\n        else:\n            node.flow_style = best_style\n    return node"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":21,"id":9493,"name":"auto_colname","nodeType":"Attribute","startLoc":21,"text":"auto_colname"},{"attributeType":"null","col":4,"comment":"null","endLoc":1256,"id":9494,"name":"attr_names","nodeType":"Attribute","startLoc":1256,"text":"attr_names"},{"col":0,"comment":"\n    Represent OrderedDict in yaml dump.\n\n    Source: https://gist.github.com/weaver/317164\n    License: Unspecified\n\n    >>> data = OrderedDict([('foo', 'bar'), ('mumble', 'quux'), ('baz', 'gorp')])\n    >>> yaml.dump(data, default_flow_style=False)  # doctest: +SKIP\n    '!!omap\\n- foo: bar\\n- mumble: quux\\n- baz: gorp\\n'\n    >>> yaml.dump(data, default_flow_style=True)  # doctest: +SKIP\n    '!!omap [foo: bar, mumble: quux, baz: gorp]\\n'\n    ","endLoc":145,"header":"def _repr_odict(dumper, data)","id":9495,"name":"_repr_odict","nodeType":"Function","startLoc":132,"text":"def _repr_odict(dumper, data):\n    \"\"\"\n    Represent OrderedDict in yaml dump.\n\n    Source: https://gist.github.com/weaver/317164\n    License: Unspecified\n\n    >>> data = OrderedDict([('foo', 'bar'), ('mumble', 'quux'), ('baz', 'gorp')])\n    >>> yaml.dump(data, default_flow_style=False)  # doctest: +SKIP\n    '!!omap\\\\n- foo: bar\\\\n- mumble: quux\\\\n- baz: gorp\\\\n'\n    >>> yaml.dump(data, default_flow_style=True)  # doctest: +SKIP\n    '!!omap [foo: bar, mumble: quux, baz: gorp]\\\\n'\n    \"\"\"\n    return _repr_pairs(dumper, 'tag:yaml.org,2002:omap', data.items())"},{"col":4,"comment":"Common setup for add and remove.\n\n        - Coerce attribute value to a list\n        - Coerce names into a list\n        - Get the parent table instance\n        ","endLoc":459,"header":"def _add_remove_setup(self, names)","id":9496,"name":"_add_remove_setup","nodeType":"Function","startLoc":447,"text":"def _add_remove_setup(self, names):\n        \"\"\"Common setup for add and remove.\n\n        - Coerce attribute value to a list\n        - Coerce names into a list\n        - Get the parent table instance\n        \"\"\"\n        names = [names] if isinstance(names, str) else list(names)\n        # Get the value. This is the same as self() but we need `instance` here.\n        instance = self._instance_ref()\n        value = super().__get__(instance, instance.__class__)\n        value = [] if value is None else list(value)\n        return instance, names, value"},{"attributeType":"null","col":4,"comment":"null","endLoc":1261,"id":9497,"name":"_represent_as_dict_primary_data","nodeType":"Attribute","startLoc":1261,"text":"_represent_as_dict_primary_data"},{"col":0,"comment":"\n    Represent ColumnDict in yaml dump.\n\n    This is the same as an ordinary mapping except that the keys\n    are written in a fixed order that makes sense for astropy table\n    columns.\n    ","endLoc":156,"header":"def _repr_column_dict(dumper, data)","id":9498,"name":"_repr_column_dict","nodeType":"Function","startLoc":148,"text":"def _repr_column_dict(dumper, data):\n    \"\"\"\n    Represent ColumnDict in yaml dump.\n\n    This is the same as an ordinary mapping except that the keys\n    are written in a fixed order that makes sense for astropy table\n    columns.\n    \"\"\"\n    return dumper.represent_mapping('tag:yaml.org,2002:map', data)"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":9499,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"col":0,"comment":"","endLoc":1,"header":"meta.py#<anonymous>","id":9500,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"__all__ = ['get_header_from_yaml', 'get_yaml_from_header', 'get_yaml_from_table']"},{"attributeType":"null","col":4,"comment":"null","endLoc":1263,"id":9501,"name":"mask_val","nodeType":"Attribute","startLoc":1263,"text":"mask_val"},{"attributeType":"null","col":12,"comment":"null","endLoc":1272,"id":9502,"name":"serialize_method","nodeType":"Attribute","startLoc":1272,"text":"self.serialize_method"},{"fileName":"np_utils.py","filePath":"astropy/table","id":9503,"nodeType":"File","text":"\"\"\"\nHigh-level operations for numpy structured arrays.\n\nSome code and inspiration taken from numpy.lib.recfunctions.join_by().\nRedistribution license restrictions apply.\n\"\"\"\n\nimport collections\nfrom collections import OrderedDict, Counter\nfrom collections.abc import Sequence\n\nimport numpy as np\n\n__all__ = ['TableMergeError']\n\n\nclass TableMergeError(ValueError):\n    pass\n\n\ndef get_col_name_map(arrays, common_names, uniq_col_name='{col_name}_{table_name}',\n                     table_names=None):\n    \"\"\"\n    Find the column names mapping when merging the list of structured ndarrays\n    ``arrays``.  It is assumed that col names in ``common_names`` are to be\n    merged into a single column while the rest will be uniquely represented\n    in the output.  The args ``uniq_col_name`` and ``table_names`` specify\n    how to rename columns in case of conflicts.\n\n    Returns a dict mapping each output column name to the input(s).  This takes the form\n    {outname : (col_name_0, col_name_1, ...), ... }.  For key columns all of input names\n    will be present, while for the other non-key columns the value will be (col_name_0,\n    None, ..) or (None, col_name_1, ..) etc.\n    \"\"\"\n\n    col_name_map = collections.defaultdict(lambda: [None] * len(arrays))\n    col_name_list = []\n\n    if table_names is None:\n        table_names = [str(ii + 1) for ii in range(len(arrays))]\n\n    for idx, array in enumerate(arrays):\n        table_name = table_names[idx]\n        for name in array.dtype.names:\n            out_name = name\n\n            if name in common_names:\n                # If name is in the list of common_names then insert into\n                # the column name list, but just once.\n                if name not in col_name_list:\n                    col_name_list.append(name)\n            else:\n                # If name is not one of the common column outputs, and it collides\n                # with the names in one of the other arrays, then rename\n                others = list(arrays)\n                others.pop(idx)\n                if any(name in other.dtype.names for other in others):\n                    out_name = uniq_col_name.format(table_name=table_name, col_name=name)\n                col_name_list.append(out_name)\n\n            col_name_map[out_name][idx] = name\n\n    # Check for duplicate output column names\n    col_name_count = Counter(col_name_list)\n    repeated_names = [name for name, count in col_name_count.items() if count > 1]\n    if repeated_names:\n        raise TableMergeError('Merging column names resulted in duplicates: {}.  '\n                              'Change uniq_col_name or table_names args to fix this.'\n                              .format(repeated_names))\n\n    # Convert col_name_map to a regular dict with tuple (immutable) values\n    col_name_map = OrderedDict((name, col_name_map[name]) for name in col_name_list)\n\n    return col_name_map\n\n\ndef get_descrs(arrays, col_name_map):\n    \"\"\"\n    Find the dtypes descrs resulting from merging the list of arrays' dtypes,\n    using the column name mapping ``col_name_map``.\n\n    Return a list of descrs for the output.\n    \"\"\"\n\n    out_descrs = []\n\n    for out_name, in_names in col_name_map.items():\n        # List of input arrays that contribute to this output column\n        in_cols = [arr[name] for arr, name in zip(arrays, in_names) if name is not None]\n\n        # List of names of the columns that contribute to this output column.\n        names = [name for name in in_names if name is not None]\n\n        # Output dtype is the superset of all dtypes in in_arrays\n        try:\n            dtype = common_dtype(in_cols)\n        except TableMergeError as tme:\n            # Beautify the error message when we are trying to merge columns with incompatible\n            # types by including the name of the columns that originated the error.\n            raise TableMergeError(\"The '{}' columns have incompatible types: {}\"\n                                  .format(names[0], tme._incompat_types)) from tme\n\n        # Make sure all input shapes are the same\n        uniq_shapes = set(col.shape[1:] for col in in_cols)\n        if len(uniq_shapes) != 1:\n            raise TableMergeError('Key columns have different shape')\n        shape = uniq_shapes.pop()\n\n        if out_name is not None:\n            out_name = str(out_name)\n        out_descrs.append((out_name, dtype, shape))\n\n    return out_descrs\n\n\ndef common_dtype(cols):\n    \"\"\"\n    Use numpy to find the common dtype for a list of structured ndarray columns.\n\n    Only allow columns within the following fundamental numpy data types:\n    np.bool_, np.object_, np.number, np.character, np.void\n    \"\"\"\n    np_types = (np.bool_, np.object_, np.number, np.character, np.void)\n    uniq_types = set(tuple(issubclass(col.dtype.type, np_type) for np_type in np_types)\n                     for col in cols)\n    if len(uniq_types) > 1:\n        # Embed into the exception the actual list of incompatible types.\n        incompat_types = [col.dtype.name for col in cols]\n        tme = TableMergeError(f'Columns have incompatible types {incompat_types}')\n        tme._incompat_types = incompat_types\n        raise tme\n\n    arrs = [np.empty(1, dtype=col.dtype) for col in cols]\n\n    # For string-type arrays need to explicitly fill in non-zero\n    # values or the final arr_common = .. step is unpredictable.\n    for arr in arrs:\n        if arr.dtype.kind in ('S', 'U'):\n            arr[0] = '0' * arr.itemsize\n\n    arr_common = np.array([arr[0] for arr in arrs])\n    return arr_common.dtype.str\n\n\ndef _check_for_sequence_of_structured_arrays(arrays):\n    err = '`arrays` arg must be a sequence (e.g. list) of structured arrays'\n    if not isinstance(arrays, Sequence):\n        raise TypeError(err)\n    for array in arrays:\n        # Must be structured array\n        if not isinstance(array, np.ndarray) or array.dtype.names is None:\n            raise TypeError(err)\n    if len(arrays) == 0:\n        raise ValueError('`arrays` arg must include at least one array')\n"},{"col":0,"comment":"\n    Make Column comparison methods which encode the ``other`` object to utf-8\n    in the case of a bytestring dtype for Py3+.\n\n    Parameters\n    ----------\n    oper : str\n        Operator name\n    ","endLoc":333,"header":"def _make_compare(oper)","id":9504,"name":"_make_compare","nodeType":"Function","startLoc":290,"text":"def _make_compare(oper):\n    \"\"\"\n    Make Column comparison methods which encode the ``other`` object to utf-8\n    in the case of a bytestring dtype for Py3+.\n\n    Parameters\n    ----------\n    oper : str\n        Operator name\n    \"\"\"\n    swapped_oper = {'__eq__': '__eq__',\n                    '__ne__': '__ne__',\n                    '__gt__': '__lt__',\n                    '__lt__': '__gt__',\n                    '__ge__': '__le__',\n                    '__le__': '__ge__'}[oper]\n\n    def _compare(self, other):\n        op = oper  # copy enclosed ref to allow swap below\n\n        # Special case to work around #6838.  Other combinations work OK,\n        # see tests.test_column.test_unicode_sandwich_compare().  In this\n        # case just swap self and other.\n        #\n        # This is related to an issue in numpy that was addressed in np 1.13.\n        # However that fix does not make this problem go away, but maybe\n        # future numpy versions will do so.  NUMPY_LT_1_13 to get the\n        # attention of future maintainers to check (by deleting or versioning\n        # the if block below).  See #6899 discussion.\n        # 2019-06-21: still needed with numpy 1.16.\n        if (isinstance(self, MaskedColumn) and self.dtype.kind == 'U'\n                and isinstance(other, MaskedColumn) and other.dtype.kind == 'S'):\n            self, other = other, self\n            op = swapped_oper\n\n        if self.dtype.char == 'S':\n            other = self._encode_str(other)\n\n        # Now just let the regular ndarray.__eq__, etc., take over.\n        result = getattr(super(Column, self), op)(other)\n        # But we should not return Column instances for this case.\n        return result.data if isinstance(result, Column) else result\n\n    return _compare"},{"col":0,"comment":"\n    Find the column names mapping when merging the list of structured ndarrays\n    ``arrays``.  It is assumed that col names in ``common_names`` are to be\n    merged into a single column while the rest will be uniquely represented\n    in the output.  The args ``uniq_col_name`` and ``table_names`` specify\n    how to rename columns in case of conflicts.\n\n    Returns a dict mapping each output column name to the input(s).  This takes the form\n    {outname : (col_name_0, col_name_1, ...), ... }.  For key columns all of input names\n    will be present, while for the other non-key columns the value will be (col_name_0,\n    None, ..) or (None, col_name_1, ..) etc.\n    ","endLoc":74,"header":"def get_col_name_map(arrays, common_names, uniq_col_name='{col_name}_{table_name}',\n                     table_names=None)","id":9505,"name":"get_col_name_map","nodeType":"Function","startLoc":21,"text":"def get_col_name_map(arrays, common_names, uniq_col_name='{col_name}_{table_name}',\n                     table_names=None):\n    \"\"\"\n    Find the column names mapping when merging the list of structured ndarrays\n    ``arrays``.  It is assumed that col names in ``common_names`` are to be\n    merged into a single column while the rest will be uniquely represented\n    in the output.  The args ``uniq_col_name`` and ``table_names`` specify\n    how to rename columns in case of conflicts.\n\n    Returns a dict mapping each output column name to the input(s).  This takes the form\n    {outname : (col_name_0, col_name_1, ...), ... }.  For key columns all of input names\n    will be present, while for the other non-key columns the value will be (col_name_0,\n    None, ..) or (None, col_name_1, ..) etc.\n    \"\"\"\n\n    col_name_map = collections.defaultdict(lambda: [None] * len(arrays))\n    col_name_list = []\n\n    if table_names is None:\n        table_names = [str(ii + 1) for ii in range(len(arrays))]\n\n    for idx, array in enumerate(arrays):\n        table_name = table_names[idx]\n        for name in array.dtype.names:\n            out_name = name\n\n            if name in common_names:\n                # If name is in the list of common_names then insert into\n                # the column name list, but just once.\n                if name not in col_name_list:\n                    col_name_list.append(name)\n            else:\n                # If name is not one of the common column outputs, and it collides\n                # with the names in one of the other arrays, then rename\n                others = list(arrays)\n                others.pop(idx)\n                if any(name in other.dtype.names for other in others):\n                    out_name = uniq_col_name.format(table_name=table_name, col_name=name)\n                col_name_list.append(out_name)\n\n            col_name_map[out_name][idx] = name\n\n    # Check for duplicate output column names\n    col_name_count = Counter(col_name_list)\n    repeated_names = [name for name, count in col_name_count.items() if count > 1]\n    if repeated_names:\n        raise TableMergeError('Merging column names resulted in duplicates: {}.  '\n                              'Change uniq_col_name or table_names args to fix this.'\n                              .format(repeated_names))\n\n    # Convert col_name_map to a regular dict with tuple (immutable) values\n    col_name_map = OrderedDict((name, col_name_map[name]) for name in col_name_list)\n\n    return col_name_map"},{"col":43,"endLoc":36,"id":9506,"nodeType":"Lambda","startLoc":36,"text":"lambda: [None] * len(arrays)"},{"col":4,"comment":"Add ``names`` to the include/exclude attribute.\n\n        Parameters\n        ----------\n        names : str, list, tuple\n            Column name(s) to add\n        ","endLoc":471,"header":"def add(self, names)","id":9507,"name":"add","nodeType":"Function","startLoc":461,"text":"def add(self, names):\n        \"\"\"Add ``names`` to the include/exclude attribute.\n\n        Parameters\n        ----------\n        names : str, list, tuple\n            Column name(s) to add\n        \"\"\"\n        instance, names, value = self._add_remove_setup(names)\n        value.extend(name for name in names if name not in value)\n        super().__set__(instance, tuple(value))"},{"col":0,"comment":"\n    Find the dtypes descrs resulting from merging the list of arrays' dtypes,\n    using the column name mapping ``col_name_map``.\n\n    Return a list of descrs for the output.\n    ","endLoc":113,"header":"def get_descrs(arrays, col_name_map)","id":9508,"name":"get_descrs","nodeType":"Function","startLoc":77,"text":"def get_descrs(arrays, col_name_map):\n    \"\"\"\n    Find the dtypes descrs resulting from merging the list of arrays' dtypes,\n    using the column name mapping ``col_name_map``.\n\n    Return a list of descrs for the output.\n    \"\"\"\n\n    out_descrs = []\n\n    for out_name, in_names in col_name_map.items():\n        # List of input arrays that contribute to this output column\n        in_cols = [arr[name] for arr, name in zip(arrays, in_names) if name is not None]\n\n        # List of names of the columns that contribute to this output column.\n        names = [name for name in in_names if name is not None]\n\n        # Output dtype is the superset of all dtypes in in_arrays\n        try:\n            dtype = common_dtype(in_cols)\n        except TableMergeError as tme:\n            # Beautify the error message when we are trying to merge columns with incompatible\n            # types by including the name of the columns that originated the error.\n            raise TableMergeError(\"The '{}' columns have incompatible types: {}\"\n                                  .format(names[0], tme._incompat_types)) from tme\n\n        # Make sure all input shapes are the same\n        uniq_shapes = set(col.shape[1:] for col in in_cols)\n        if len(uniq_shapes) != 1:\n            raise TableMergeError('Key columns have different shape')\n        shape = uniq_shapes.pop()\n\n        if out_name is not None:\n            out_name = str(out_name)\n        out_descrs.append((out_name, dtype, shape))\n\n    return out_descrs"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":26,"id":9509,"name":"default_notebook_table_class","nodeType":"Attribute","startLoc":26,"text":"default_notebook_table_class"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":31,"id":9510,"name":"replace_warnings","nodeType":"Attribute","startLoc":31,"text":"replace_warnings"},{"col":4,"comment":"\n        Make row numbers follow the same sort order as the keys\n        of the index.\n        ","endLoc":348,"header":"def sort(self)","id":9511,"name":"sort","nodeType":"Function","startLoc":343,"text":"def sort(self):\n        '''\n        Make row numbers follow the same sort order as the keys\n        of the index.\n        '''\n        self.data.sort()"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":37,"id":9512,"name":"replace_inplace","nodeType":"Attribute","startLoc":37,"text":"replace_inplace"},{"col":4,"comment":"\n        Returns a sliced version of this index.\n\n        Parameters\n        ----------\n        item : slice\n            Input slice\n\n        Returns\n        -------\n        SlicedIndex\n            A sliced reference to this index.\n        ","endLoc":371,"header":"def __getitem__(self, item)","id":9513,"name":"__getitem__","nodeType":"Function","startLoc":357,"text":"def __getitem__(self, item):\n        '''\n        Returns a sliced version of this index.\n\n        Parameters\n        ----------\n        item : slice\n            Input slice\n\n        Returns\n        -------\n        SlicedIndex\n            A sliced reference to this index.\n        '''\n        return SlicedIndex(self, item)"},{"attributeType":"TableFormatter","col":0,"comment":"null","endLoc":25,"id":9514,"name":"FORMATTER","nodeType":"Attribute","startLoc":25,"text":"FORMATTER"},{"attributeType":"null","col":0,"comment":"null","endLoc":52,"id":9515,"name":"_comparison_functions","nodeType":"Attribute","startLoc":52,"text":"_comparison_functions"},{"col":0,"comment":"","endLoc":3,"header":"column.py#<anonymous>","id":9516,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"FORMATTER = pprint.TableFormatter()\n\nwarnings.simplefilter('always', StringTruncateWarning)\n\n_comparison_functions = set(\n    [np.greater, np.greater_equal, np.less, np.less_equal,\n     np.not_equal, np.equal,\n     np.isfinite, np.isinf, np.isnan, np.sign, np.signbit])"},{"col":4,"comment":"null","endLoc":375,"header":"def __repr__(self)","id":9517,"name":"__repr__","nodeType":"Function","startLoc":373,"text":"def __repr__(self):\n        col_names = tuple(col.info.name for col in self.columns)\n        return f'<{self.__class__.__name__} columns={col_names} data={self.data}>'"},{"col":4,"comment":"\n        Return a deep copy of this index.\n\n        Notes\n        -----\n        The default deep copy must be overridden to perform\n        a shallow copy of the index columns, avoiding infinite recursion.\n\n        Parameters\n        ----------\n        memo : dict\n        ","endLoc":396,"header":"def __deepcopy__(self, memo)","id":9518,"name":"__deepcopy__","nodeType":"Function","startLoc":377,"text":"def __deepcopy__(self, memo):\n        '''\n        Return a deep copy of this index.\n\n        Notes\n        -----\n        The default deep copy must be overridden to perform\n        a shallow copy of the index columns, avoiding infinite recursion.\n\n        Parameters\n        ----------\n        memo : dict\n        '''\n        # Bypass Index.__new__ to create an actual Index, not a SlicedIndex.\n        index = super().__new__(self.__class__)\n        index.__init__(None, engine=self.engine)\n        index.data = deepcopy(self.data, memo)\n        index.columns = self.columns[:]  # new list, same columns\n        memo[id(self)] = index\n        return index"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":9519,"name":"__all__","nodeType":"Attribute","startLoc":6,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"__init__.py#<anonymous>","id":9520,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['BST', 'Column', 'ColumnGroups', 'ColumnInfo', 'Conf',\n           'JSViewer', 'MaskedColumn', 'NdarrayMixin', 'QTable', 'Row',\n           'SCEngine', 'SerializedColumn', 'SortedArray', 'StringTruncateWarning',\n           'Table', 'TableAttribute', 'TableColumns', 'TableFormatter',\n           'TableGroups', 'TableMergeError', 'TableReplaceWarning', 'conf',\n           'connect', 'hstack', 'join', 'registry', 'represent_mixins_as_columns',\n           'setdiff', 'unique', 'vstack', 'dstack', 'conf', 'join_skycoord',\n           'join_distance', 'PprintIncludeExclude']\n\nconf = Conf()  # noqa\n\nwith registry.delay_doc_updates(Table):\n    # Import routines that connect readers/writers to astropy.table\n    from .jsviewer import JSViewer\n    import astropy.io.ascii.connect\n    import astropy.io.fits.connect\n    import astropy.io.misc.connect\n    import astropy.io.votable.connect\n    import astropy.io.misc.asdf.connect\n    import astropy.io.misc.pandas.connect  # noqa: F401"},{"attributeType":"SortedArray","col":8,"comment":"null","endLoc":117,"id":9521,"name":"data","nodeType":"Attribute","startLoc":117,"text":"self.data"},{"attributeType":"SortedArray","col":8,"comment":"null","endLoc":82,"id":9522,"name":"engine","nodeType":"Attribute","startLoc":82,"text":"self.engine"},{"attributeType":"None","col":8,"comment":"null","endLoc":118,"id":9523,"name":"columns","nodeType":"Attribute","startLoc":118,"text":"self.columns"},{"col":0,"comment":"Iterate through possible string-derived format functions.\n\n    A string can either be a format specifier for the format built-in,\n    a new-style format string, or an old-style format string.\n    ","endLoc":44,"header":"def _possible_string_format_functions(format_)","id":9524,"name":"_possible_string_format_functions","nodeType":"Function","startLoc":36,"text":"def _possible_string_format_functions(format_):\n    \"\"\"Iterate through possible string-derived format functions.\n\n    A string can either be a format specifier for the format built-in,\n    a new-style format string, or an old-style format string.\n    \"\"\"\n    yield lambda format_, val: format(val, format_)\n    yield lambda format_, val: format_.format(val)\n    yield lambda format_, val: format_ % val"},{"col":4,"comment":"Remove ``names`` from the include/exclude attribute.\n\n        Parameters\n        ----------\n        names : str, list, tuple\n            Column name(s) to remove\n        ","endLoc":481,"header":"def remove(self, names)","id":9525,"name":"remove","nodeType":"Function","startLoc":473,"text":"def remove(self, names):\n        \"\"\"Remove ``names`` from the include/exclude attribute.\n\n        Parameters\n        ----------\n        names : str, list, tuple\n            Column name(s) to remove\n        \"\"\"\n        self._remove(names, raise_exc=True)"},{"col":10,"endLoc":42,"id":9526,"nodeType":"Lambda","startLoc":42,"text":"lambda format_, val: format(val, format_)"},{"col":10,"endLoc":43,"id":9527,"nodeType":"Lambda","startLoc":43,"text":"lambda format_, val: format_.format(val)"},{"col":10,"endLoc":44,"id":9528,"nodeType":"Lambda","startLoc":44,"text":"lambda format_, val: format_ % val"},{"fileName":"table_helpers.py","filePath":"astropy/table","id":9529,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nHelper functions for table development, mostly creating useful\ntables for testing.\n\"\"\"\n\n\nfrom itertools import cycle\nimport string\nimport numpy as np\n\nfrom .table import Table, Column\nfrom astropy.utils.data_info import ParentDtypeInfo\n\n\nclass TimingTables:\n    \"\"\"\n    Object which contains two tables and various other attributes that\n    are useful for timing and other API tests.\n    \"\"\"\n\n    def __init__(self, size=1000, masked=False):\n        self.masked = masked\n\n        # Initialize table\n        self.table = Table(masked=self.masked)\n\n        # Create column with mixed types\n        np.random.seed(12345)\n        self.table['i'] = np.arange(size)\n        self.table['a'] = np.random.random(size)  # float\n        self.table['b'] = np.random.random(size) > 0.5  # bool\n        self.table['c'] = np.random.random((size, 10))  # 2d column\n        self.table['d'] = np.random.choice(np.array(list(string.ascii_letters)), size)\n\n        self.extra_row = {'a': 1.2, 'b': True, 'c': np.repeat(1, 10), 'd': 'Z'}\n        self.extra_column = np.random.randint(0, 100, size)\n        self.row_indices = np.where(self.table['a'] > 0.9)[0]\n        self.table_grouped = self.table.group_by('d')\n\n        # Another table for testing joining\n        self.other_table = Table(masked=self.masked)\n        self.other_table['i'] = np.arange(1, size, 3)\n        self.other_table['f'] = np.random.random()\n        self.other_table.sort('f')\n\n        # Another table for testing hstack\n        self.other_table_2 = Table(masked=self.masked)\n        self.other_table_2['g'] = np.random.random(size)\n        self.other_table_2['h'] = np.random.random((size, 10))\n\n        self.bool_mask = self.table['a'] > 0.6\n\n\ndef simple_table(size=3, cols=None, kinds='ifS', masked=False):\n    \"\"\"\n    Return a simple table for testing.\n\n    Example\n    --------\n    ::\n\n      >>> from astropy.table.table_helpers import simple_table\n      >>> print(simple_table(3, 6, masked=True, kinds='ifOS'))\n       a   b     c      d   e   f\n      --- --- -------- --- --- ---\n       -- 1.0 {'c': 2}  --   5 5.0\n        2 2.0       --   e   6  --\n        3  -- {'e': 4}   f  -- 7.0\n\n    Parameters\n    ----------\n    size : int\n        Number of table rows\n    cols : int, optional\n        Number of table columns. Defaults to number of kinds.\n    kinds : str\n        String consisting of the column dtype.kinds.  This string\n        will be cycled through to generate the column dtype.\n        The allowed values are 'i', 'f', 'S', 'O'.\n\n    Returns\n    -------\n    out : `Table`\n        New table with appropriate characteristics\n    \"\"\"\n    if cols is None:\n        cols = len(kinds)\n    if cols > 26:\n        raise ValueError(\"Max 26 columns in SimpleTable\")\n\n    columns = []\n    names = [chr(ord('a') + ii) for ii in range(cols)]\n    letters = np.array([c for c in string.ascii_letters])\n    for jj, kind in zip(range(cols), cycle(kinds)):\n        if kind == 'i':\n            data = np.arange(1, size + 1, dtype=np.int64) + jj\n        elif kind == 'f':\n            data = np.arange(size, dtype=np.float64) + jj\n        elif kind == 'S':\n            indices = (np.arange(size) + jj) % len(letters)\n            data = letters[indices]\n        elif kind == 'O':\n            indices = (np.arange(size) + jj) % len(letters)\n            vals = letters[indices]\n            data = [{val: index} for val, index in zip(vals, indices)]\n        else:\n            raise ValueError('Unknown data kind')\n        columns.append(Column(data))\n\n    table = Table(columns, names=names, masked=masked)\n    if masked:\n        for ii, col in enumerate(table.columns.values()):\n            mask = np.array((np.arange(size) + ii) % 3, dtype=bool)\n            col.mask = ~mask\n\n    return table\n\n\ndef complex_table():\n    \"\"\"\n    Return a masked table from the io.votable test set that has a wide variety\n    of stressing types.\n    \"\"\"\n    from astropy.utils.data import get_pkg_data_filename\n    from astropy.io.votable.table import parse\n    import warnings\n\n    with warnings.catch_warnings():\n        warnings.simplefilter(\"ignore\")\n        votable = parse(get_pkg_data_filename('../io/votable/tests/data/regression.xml'),\n                        pedantic=False)\n    first_table = votable.get_first_table()\n    table = first_table.to_table()\n\n    return table\n\n\nclass ArrayWrapperInfo(ParentDtypeInfo):\n    _represent_as_dict_primary_data = 'data'\n\n    def _represent_as_dict(self):\n        \"\"\"Represent Column as a dict that can be serialized.\"\"\"\n        col = self._parent\n        out = {'data': col.data}\n        return out\n\n    def _construct_from_dict(self, map):\n        \"\"\"Construct Column from ``map``.\"\"\"\n        data = map.pop('data')\n        out = self._parent_cls(data, **map)\n        return out\n\n\nclass ArrayWrapper:\n    \"\"\"\n    Minimal mixin using a simple wrapper around a numpy array\n\n    TODO: think about the future of this class as it is mostly for demonstration\n    purposes (of the mixin protocol). Consider taking it out of core and putting\n    it into a tutorial. One advantage of having this in core is that it is\n    getting tested in the mixin testing though it doesn't work for multidim\n    data.\n    \"\"\"\n    info = ArrayWrapperInfo()\n\n    def __init__(self, data):\n        self.data = np.array(data)\n        if 'info' in getattr(data, '__dict__', ()):\n            self.info = data.info\n\n    def __getitem__(self, item):\n        if isinstance(item, (int, np.integer)):\n            out = self.data[item]\n        else:\n            out = self.__class__(self.data[item])\n            if 'info' in self.__dict__:\n                out.info = self.info\n        return out\n\n    def __setitem__(self, item, value):\n        self.data[item] = value\n\n    def __len__(self):\n        return len(self.data)\n\n    def __eq__(self, other):\n        \"\"\"Minimal equality testing, mostly for mixin unit tests\"\"\"\n        if isinstance(other, ArrayWrapper):\n            return self.data == other.data\n        else:\n            return self.data == other\n\n    @property\n    def dtype(self):\n        return self.data.dtype\n\n    @property\n    def shape(self):\n        return self.data.shape\n\n    def __repr__(self):\n        return f\"<{self.__class__.__name__} name='{self.info.name}' data={self.data}>\"\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":9530,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"pprint.py#<anonymous>","id":9531,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = []"},{"className":"TimingTables","col":0,"comment":"\n    Object which contains two tables and various other attributes that\n    are useful for timing and other API tests.\n    ","endLoc":53,"id":9532,"nodeType":"Class","startLoc":17,"text":"class TimingTables:\n    \"\"\"\n    Object which contains two tables and various other attributes that\n    are useful for timing and other API tests.\n    \"\"\"\n\n    def __init__(self, size=1000, masked=False):\n        self.masked = masked\n\n        # Initialize table\n        self.table = Table(masked=self.masked)\n\n        # Create column with mixed types\n        np.random.seed(12345)\n        self.table['i'] = np.arange(size)\n        self.table['a'] = np.random.random(size)  # float\n        self.table['b'] = np.random.random(size) > 0.5  # bool\n        self.table['c'] = np.random.random((size, 10))  # 2d column\n        self.table['d'] = np.random.choice(np.array(list(string.ascii_letters)), size)\n\n        self.extra_row = {'a': 1.2, 'b': True, 'c': np.repeat(1, 10), 'd': 'Z'}\n        self.extra_column = np.random.randint(0, 100, size)\n        self.row_indices = np.where(self.table['a'] > 0.9)[0]\n        self.table_grouped = self.table.group_by('d')\n\n        # Another table for testing joining\n        self.other_table = Table(masked=self.masked)\n        self.other_table['i'] = np.arange(1, size, 3)\n        self.other_table['f'] = np.random.random()\n        self.other_table.sort('f')\n\n        # Another table for testing hstack\n        self.other_table_2 = Table(masked=self.masked)\n        self.other_table_2['g'] = np.random.random(size)\n        self.other_table_2['h'] = np.random.random((size, 10))\n\n        self.bool_mask = self.table['a'] > 0.6"},{"col":4,"comment":"null","endLoc":53,"header":"def __init__(self, size=1000, masked=False)","id":9533,"name":"__init__","nodeType":"Function","startLoc":23,"text":"def __init__(self, size=1000, masked=False):\n        self.masked = masked\n\n        # Initialize table\n        self.table = Table(masked=self.masked)\n\n        # Create column with mixed types\n        np.random.seed(12345)\n        self.table['i'] = np.arange(size)\n        self.table['a'] = np.random.random(size)  # float\n        self.table['b'] = np.random.random(size) > 0.5  # bool\n        self.table['c'] = np.random.random((size, 10))  # 2d column\n        self.table['d'] = np.random.choice(np.array(list(string.ascii_letters)), size)\n\n        self.extra_row = {'a': 1.2, 'b': True, 'c': np.repeat(1, 10), 'd': 'Z'}\n        self.extra_column = np.random.randint(0, 100, size)\n        self.row_indices = np.where(self.table['a'] > 0.9)[0]\n        self.table_grouped = self.table.group_by('d')\n\n        # Another table for testing joining\n        self.other_table = Table(masked=self.masked)\n        self.other_table['i'] = np.arange(1, size, 3)\n        self.other_table['f'] = np.random.random()\n        self.other_table.sort('f')\n\n        # Another table for testing hstack\n        self.other_table_2 = Table(masked=self.masked)\n        self.other_table_2['g'] = np.random.random(size)\n        self.other_table_2['h'] = np.random.random((size, 10))\n\n        self.bool_mask = self.table['a'] > 0.6"},{"fileName":"row.py","filePath":"astropy/table","id":9534,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport collections\nfrom collections import OrderedDict\nfrom operator import index as operator_index\n\nimport numpy as np\n\n\nclass Row:\n    \"\"\"A class to represent one row of a Table object.\n\n    A Row object is returned when a Table object is indexed with an integer\n    or when iterating over a table::\n\n      >>> from astropy.table import Table\n      >>> table = Table([(1, 2), (3, 4)], names=('a', 'b'),\n      ...               dtype=('int32', 'int32'))\n      >>> row = table[1]\n      >>> row\n      <Row index=1>\n        a     b\n      int32 int32\n      ----- -----\n          2     4\n      >>> row['a']\n      2\n      >>> row[1]\n      4\n    \"\"\"\n\n    def __init__(self, table, index):\n        # Ensure that the row index is a valid index (int)\n        index = operator_index(index)\n\n        n = len(table)\n\n        if index < -n or index >= n:\n            raise IndexError('index {} out of range for table with length {}'\n                             .format(index, len(table)))\n\n        # Finally, ensure the index is positive [#8422] and set Row attributes\n        self._index = index % n\n        self._table = table\n\n    def __getitem__(self, item):\n        try:\n            # Try the most common use case of accessing a single column in the Row.\n            # Bypass the TableColumns __getitem__ since that does more testing\n            # and allows a list of tuple or str, which is not the right thing here.\n            out = OrderedDict.__getitem__(self._table.columns, item)[self._index]\n        except (KeyError, TypeError):\n            if self._table._is_list_or_tuple_of_str(item):\n                cols = [self._table[name] for name in item]\n                out = self._table.__class__(cols, copy=False)[self._index]\n            else:\n                # This is only to raise an exception\n                out = self._table.columns[item][self._index]\n        return out\n\n    def __setitem__(self, item, val):\n        if self._table._is_list_or_tuple_of_str(item):\n            self._table._set_row(self._index, colnames=item, vals=val)\n        else:\n            self._table.columns[item][self._index] = val\n\n    def _ipython_key_completions_(self):\n        return self.colnames\n\n    def __eq__(self, other):\n        if self._table.masked:\n            # Sent bug report to numpy-discussion group on 2012-Oct-21, subject:\n            # \"Comparing rows in a structured masked array raises exception\"\n            # No response, so this is still unresolved.\n            raise ValueError('Unable to compare rows for masked table due to numpy.ma bug')\n        return self.as_void() == other\n\n    def __ne__(self, other):\n        if self._table.masked:\n            raise ValueError('Unable to compare rows for masked table due to numpy.ma bug')\n        return self.as_void() != other\n\n    def __array__(self, dtype=None):\n        \"\"\"Support converting Row to np.array via np.array(table).\n\n        Coercion to a different dtype via np.array(table, dtype) is not\n        supported and will raise a ValueError.\n\n        If the parent table is masked then the mask information is dropped.\n        \"\"\"\n        if dtype is not None:\n            raise ValueError('Datatype coercion is not allowed')\n\n        return np.asarray(self.as_void())\n\n    def __len__(self):\n        return len(self._table.columns)\n\n    def __iter__(self):\n        index = self._index\n        for col in self._table.columns.values():\n            yield col[index]\n\n    def keys(self):\n        return self._table.columns.keys()\n\n    def values(self):\n        return self.__iter__()\n\n    @property\n    def table(self):\n        return self._table\n\n    @property\n    def index(self):\n        return self._index\n\n    def as_void(self):\n        \"\"\"\n        Returns a *read-only* copy of the row values in the form of np.void or\n        np.ma.mvoid objects.  This corresponds to the object types returned for\n        row indexing of a pure numpy structured array or masked array. This\n        method is slow and its use is discouraged when possible.\n\n        Returns\n        -------\n        void_row : ``numpy.void`` or ``numpy.ma.mvoid``\n            Copy of row values.\n            ``numpy.void`` if unmasked, ``numpy.ma.mvoid`` else.\n        \"\"\"\n        index = self._index\n        cols = self._table.columns.values()\n        vals = tuple(np.asarray(col)[index] for col in cols)\n        if self._table.masked:\n            mask = tuple(col.mask[index] if hasattr(col, 'mask') else False\n                         for col in cols)\n            void_row = np.ma.array([vals], mask=[mask], dtype=self.dtype)[0]\n        else:\n            void_row = np.array([vals], dtype=self.dtype)[0]\n        return void_row\n\n    @property\n    def meta(self):\n        return self._table.meta\n\n    @property\n    def columns(self):\n        return self._table.columns\n\n    @property\n    def colnames(self):\n        return self._table.colnames\n\n    @property\n    def dtype(self):\n        return self._table.dtype\n\n    def _base_repr_(self, html=False):\n        \"\"\"\n        Display row as a single-line table but with appropriate header line.\n        \"\"\"\n        index = self.index if (self.index >= 0) else self.index + len(self._table)\n        table = self._table[index:index + 1]\n        descr_vals = [self.__class__.__name__,\n                      f'index={self.index}']\n        if table.masked:\n            descr_vals.append('masked=True')\n\n        return table._base_repr_(html, descr_vals, max_width=-1,\n                                 tableid=f'table{id(self._table)}')\n\n    def _repr_html_(self):\n        return self._base_repr_(html=True)\n\n    def __repr__(self):\n        return self._base_repr_(html=False)\n\n    def __str__(self):\n        index = self.index if (self.index >= 0) else self.index + len(self._table)\n        return '\\n'.join(self.table[index:index + 1].pformat(max_width=-1))\n\n    def __bytes__(self):\n        return str(self).encode('utf-8')\n\n\ncollections.abc.Sequence.register(Row)\n"},{"col":0,"comment":"","endLoc":3,"header":"row.py#<anonymous>","id":9535,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"collections.abc.Sequence.register(Row)"},{"col":4,"comment":"Remove ``names`` with optional checking if they exist","endLoc":500,"header":"def _remove(self, names, raise_exc=False)","id":9536,"name":"_remove","nodeType":"Function","startLoc":483,"text":"def _remove(self, names, raise_exc=False):\n        \"\"\"Remove ``names`` with optional checking if they exist\"\"\"\n        instance, names, value = self._add_remove_setup(names)\n\n        # Return now if there are no attributes and thus no action to be taken.\n        if not raise_exc and '__attributes__' not in instance.meta:\n            return\n\n        # Remove one by one, optionally raising an exception if name is missing.\n        for name in names:\n            if name in value:\n                value.remove(name)  # Using the list.remove method\n            elif raise_exc:\n                raise ValueError(f'{name} not in {self.name}')\n\n        # Change to either None or a tuple for storing back to attribute\n        value = None if value == [] else tuple(value)\n        self.__set__(instance, value)"},{"col":0,"comment":"","endLoc":31,"header":"index.py#<anonymous>","id":9537,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThe Index class can use several implementations as its\nengine. Any implementation should implement the following:\n\n__init__(data, row_index) : initialize index based on key/row list pairs\nadd(key, row) -> None : add (key, row) to existing data\nremove(key, data=None) -> boolean : remove data from self[key], or all of\n                                    self[key] if data is None\nshift_left(row) -> None : decrement row numbers after row\nshift_right(row) -> None : increase row numbers >= row\nfind(key) -> list : list of rows corresponding to key\nrange(lower, upper, bounds) -> list : rows in self[k] where k is between\n                               lower and upper (<= or < based on bounds)\nsort() -> None : make row order align with key order\nsorted_data() -> list of rows in sorted order (by key)\nreplace_rows(row_map) -> None : replace row numbers based on slice\nitems() -> list of tuples of the form (key, data)\n\nNotes\n-----\n    When a Table is initialized from another Table, indices are\n    (deep) copied and their columns are set to the columns of the new Table.\n\n    Column creation:\n    Column(c) -> deep copy of indices\n    c[[1, 2]] -> deep copy and reordering of indices\n    c[1:2] -> reference\n    array.view(Column) -> no indices\n\"\"\""},{"col":4,"comment":"Rename ``name`` to ``new_name`` if ``name`` is in the list","endLoc":508,"header":"def _rename(self, name, new_name)","id":9538,"name":"_rename","nodeType":"Function","startLoc":502,"text":"def _rename(self, name, new_name):\n        \"\"\"Rename ``name`` to ``new_name`` if ``name`` is in the list\"\"\"\n        names = self() or ()\n        if name in names:\n            new_names = list(names)\n            new_names[new_names.index(name)] = new_name\n            self.set(new_names)"},{"id":9539,"name":"astropy/table/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/table/tests","id":9540,"nodeType":"File","text":""},{"fileName":"conftest.py","filePath":"astropy/table/tests","id":9541,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nAll of the pytest fixtures used by astropy.table are defined here.\n\n`conftest.py` is a \"special\" module name for pytest that is always\nimported, but is not looked in for tests, and it is the recommended\nplace to put fixtures that are shared between modules.  These fixtures\ncan not be defined in a module by a different name and still be shared\nbetween modules.\n\"\"\"\n\nfrom copy import deepcopy\nfrom collections import OrderedDict\nimport pickle\n\nimport pytest\nimport numpy as np\n\nfrom astropy import table\nfrom astropy.table import Table, QTable\nfrom astropy.table.table_helpers import ArrayWrapper\nfrom astropy import time\nfrom astropy import units as u\nfrom astropy import coordinates\nfrom astropy.table import pprint\n\n\n@pytest.fixture(params=[table.Column, table.MaskedColumn])\ndef Column(request):\n    # Fixture to run all the Column tests for both an unmasked (ndarray)\n    # and masked (MaskedArray) column.\n    return request.param\n\n\nclass MaskedTable(table.Table):\n    def __init__(self, *args, **kwargs):\n        kwargs['masked'] = True\n        table.Table.__init__(self, *args, **kwargs)\n\n\nclass MyRow(table.Row):\n    pass\n\n\nclass MyColumn(table.Column):\n    pass\n\n\nclass MyMaskedColumn(table.MaskedColumn):\n    pass\n\n\nclass MyTableColumns(table.TableColumns):\n    pass\n\n\nclass MyTableFormatter(pprint.TableFormatter):\n    pass\n\n\nclass MyTable(table.Table):\n    Row = MyRow\n    Column = MyColumn\n    MaskedColumn = MyMaskedColumn\n    TableColumns = MyTableColumns\n    TableFormatter = MyTableFormatter\n\n# Fixture to run all the Column tests for both an unmasked (ndarray)\n# and masked (MaskedArray) column.\n\n\n@pytest.fixture(params=['unmasked', 'masked', 'subclass'])\ndef table_types(request):\n    class TableTypes:\n        def __init__(self, request):\n            if request.param == 'unmasked':\n                self.Table = table.Table\n                self.Column = table.Column\n            elif request.param == 'masked':\n                self.Table = MaskedTable\n                self.Column = table.MaskedColumn\n            elif request.param == 'subclass':\n                self.Table = MyTable\n                self.Column = MyColumn\n    return TableTypes(request)\n\n\n# Fixture to run all the Column tests for both an unmasked (ndarray)\n# and masked (MaskedArray) column.\n@pytest.fixture(params=[False, True])\ndef table_data(request):\n    class TableData:\n        def __init__(self, request):\n            self.Table = MaskedTable if request.param else table.Table\n            self.Column = table.MaskedColumn if request.param else table.Column\n            self.COLS = [\n                self.Column(name='a', data=[1, 2, 3], description='da',\n                            format='%i', meta={'ma': 1}, unit='ua'),\n                self.Column(name='b', data=[4, 5, 6], description='db',\n                            format='%d', meta={'mb': 1}, unit='ub'),\n                self.Column(name='c', data=[7, 8, 9], description='dc',\n                            format='%f', meta={'mc': 1}, unit='ub')]\n            self.DATA = self.Table(self.COLS)\n    return TableData(request)\n\n\nclass SubclassTable(table.Table):\n    pass\n\n\n@pytest.fixture(params=[True, False])\ndef tableclass(request):\n    return table.Table if request.param else SubclassTable\n\n\n@pytest.fixture(params=list(range(0, pickle.HIGHEST_PROTOCOL + 1)))\ndef protocol(request):\n    \"\"\"\n    Fixture to run all the tests for all available pickle protocols.\n    \"\"\"\n    return request.param\n\n\n# Fixture to run all tests for both an unmasked (ndarray) and masked\n# (MaskedArray) column.\n@pytest.fixture(params=[False, True])\ndef table_type(request):\n    return MaskedTable if request.param else table.Table\n\n\n# Stuff for testing mixin columns\n\nMIXIN_COLS = {'quantity': [0, 1, 2, 3] * u.m,\n              'longitude': coordinates.Longitude([0., 1., 5., 6.] * u.deg,\n                                                 wrap_angle=180. * u.deg),\n              'latitude': coordinates.Latitude([5., 6., 10., 11.] * u.deg),\n              'time': time.Time([2000, 2001, 2002, 2003], format='jyear'),\n              'timedelta': time.TimeDelta([1, 2, 3, 4], format='jd'),\n              'skycoord': coordinates.SkyCoord(ra=[0, 1, 2, 3] * u.deg,\n                                               dec=[0, 1, 2, 3] * u.deg),\n              'sphericalrep': coordinates.SphericalRepresentation(\n                  [0, 1, 2, 3]*u.deg, [0, 1, 2, 3]*u.deg, 1*u.kpc),\n              'cartesianrep': coordinates.CartesianRepresentation(\n                  [0, 1, 2, 3]*u.pc, [4, 5, 6, 7]*u.pc, [9, 8, 8, 6]*u.pc),\n              'sphericaldiff': coordinates.SphericalCosLatDifferential(\n                  [0, 1, 2, 3]*u.mas/u.yr, [0, 1, 2, 3]*u.mas/u.yr,\n                  10*u.km/u.s),\n              'arraywrap': ArrayWrapper([0, 1, 2, 3]),\n              'arrayswap': ArrayWrapper(np.arange(4, dtype='i').byteswap().newbyteorder()),\n              'ndarraylil': np.array([(7, 'a'), (8, 'b'), (9, 'c'), (9, 'c')],\n                                  dtype='<i4,|S1').view(table.NdarrayMixin),\n              'ndarraybig': np.array([(7, 'a'), (8, 'b'), (9, 'c'), (9, 'c')],\n                                  dtype='>i4,|S1').view(table.NdarrayMixin),\n              }\nMIXIN_COLS['earthlocation'] = coordinates.EarthLocation(\n    lon=MIXIN_COLS['longitude'], lat=MIXIN_COLS['latitude'],\n    height=MIXIN_COLS['quantity'])\nMIXIN_COLS['sphericalrepdiff'] = coordinates.SphericalRepresentation(\n    MIXIN_COLS['sphericalrep'], differentials=MIXIN_COLS['sphericaldiff'])\n\n\n@pytest.fixture(params=sorted(MIXIN_COLS))\ndef mixin_cols(request):\n    \"\"\"\n    Fixture to return a set of columns for mixin testing which includes\n    an index column 'i', two string cols 'a', 'b' (for joins etc), and\n    one of the available mixin column types.\n    \"\"\"\n    cols = OrderedDict()\n    mixin_cols = deepcopy(MIXIN_COLS)\n    cols['i'] = table.Column([0, 1, 2, 3], name='i')\n    cols['a'] = table.Column(['a', 'b', 'b', 'c'], name='a')\n    cols['b'] = table.Column(['b', 'c', 'a', 'd'], name='b')\n    cols['m'] = mixin_cols[request.param]\n\n    return cols\n\n\n@pytest.fixture(params=[False, True])\ndef T1(request):\n    T = Table.read([' a b c d',\n                    ' 2 c 7.0 0',\n                    ' 2 b 5.0 1',\n                    ' 2 b 6.0 2',\n                    ' 2 a 4.0 3',\n                    ' 0 a 0.0 4',\n                    ' 1 b 3.0 5',\n                    ' 1 a 2.0 6',\n                    ' 1 a 1.0 7',\n                    ], format='ascii')\n    T.meta.update({'ta': 1})\n    T['c'].meta.update({'a': 1})\n    T['c'].description = 'column c'\n    if request.param:\n        T.add_index('a')\n    return T\n\n\n@pytest.fixture(params=[Table, QTable])\ndef operation_table_type(request):\n    return request.param\n"},{"id":9542,"name":"astropy/table/mixins","nodeType":"Package"},{"fileName":"dask.py","filePath":"astropy/table/mixins","id":9543,"nodeType":"File","text":"import dask.array as da\n\nfrom astropy.utils.data_info import ParentDtypeInfo\n\n__all__ = ['as_dask_column']\n\n\nclass DaskInfo(ParentDtypeInfo):\n    @staticmethod\n    def default_format(val):\n        return f'{val.compute()}'\n\n\nclass DaskColumn(da.Array):\n\n    info = DaskInfo()\n\n    def copy(self):\n        # Array hard-codes the resulting copied array as Array, so need to\n        # overload this since Table tries to copy the array.\n        return as_dask_column(self, info=self.info)\n\n    def __getitem__(self, item):\n        result = super().__getitem__(item)\n        if isinstance(item, int):\n            return result\n        else:\n            return as_dask_column(result, info=self.info)\n\n    def insert(self, obj, values, axis=0):\n        return as_dask_column(da.insert(self, obj, values, axis=axis),\n                              info=self.info)\n\n\ndef as_dask_column(array, info=None):\n    result = DaskColumn(array.dask, array.name, array.chunks, meta=array)\n    if info is not None:\n        result.info = info\n    return result\n"},{"fileName":"registry.py","filePath":"astropy/table/mixins","id":9544,"nodeType":"File","text":"# This module handles the definition of mixin 'handlers' which are functions\n# that given an arbitrary object (e.g. a dask array) will return an object that\n# can be used as a mixin column. This is useful because it means that users can\n# then add objects to tables that are not formally mixin columns and where\n# adding an info attribute is beyond our control.\n\n__all__ = ['MixinRegistryError', 'register_mixin_handler', 'get_mixin_handler']\n\n# The internal dictionary of handlers maps fully qualified names of classes\n# to a function that can take an object and return a mixin-compatible object.\n_handlers = {}\n\n\nclass MixinRegistryError(Exception):\n    pass\n\n\ndef register_mixin_handler(fully_qualified_name, handler, force=False):\n    \"\"\"\n    Register a mixin column 'handler'.\n\n    A mixin column handler is a function that given an arbitrary Python object,\n    will return an object with the .info attribute that can then be used as a\n    mixin column (this can be e.g. a copy of the object with a new attribute,\n    a subclass instance, or a wrapper class - this is left up to the handler).\n\n    The handler will be used on classes that have an exactly matching fully\n    qualified name.\n\n    Parameters\n    ----------\n    fully_qualified_name : str\n        The fully qualified name of the class that the handler can operate on,\n        such as e.g. ``dask.array.core.Array``.\n    handler : func\n        The handler function.\n    force : bool, optional\n        Whether to overwrite any previous handler if there is already one for\n        the same fully qualified name.\n    \"\"\"\n    if fully_qualified_name not in _handlers or force:\n        _handlers[fully_qualified_name] = handler\n    else:\n        raise MixinRegistryError(f\"Handler for class {fully_qualified_name} is already defined\")\n\n\ndef get_mixin_handler(obj):\n    \"\"\"\n    Given an arbitrary object, return the matching mixin handler (if any).\n\n    Parameters\n    ----------\n    obj : object or str\n        The object to find a mixin handler for, or a fully qualified name.\n\n    Returns\n    -------\n    handler : None or func\n        Then matching handler, if found, or `None`\n    \"\"\"\n    if isinstance(obj, str):\n        return _handlers.get(obj, None)\n    else:\n        return _handlers.get(obj.__class__.__module__ + '.' + obj.__class__.__name__, None)\n\n\n# Add built-in handlers to registry. Note that any third-party package imports\n# required by the handlers should go inside the handler function to delay\n# the imports until they are actually needed.\n\ndef dask_handler(arr):\n    from astropy.table.mixins.dask import as_dask_column\n    return as_dask_column(arr)\n\n\nregister_mixin_handler('dask.array.core.Array', dask_handler)\n"},{"className":"MixinRegistryError","col":0,"comment":"null","endLoc":15,"id":9545,"nodeType":"Class","startLoc":14,"text":"class MixinRegistryError(Exception):\n    pass"},{"col":0,"comment":"\n    Register a mixin column 'handler'.\n\n    A mixin column handler is a function that given an arbitrary Python object,\n    will return an object with the .info attribute that can then be used as a\n    mixin column (this can be e.g. a copy of the object with a new attribute,\n    a subclass instance, or a wrapper class - this is left up to the handler).\n\n    The handler will be used on classes that have an exactly matching fully\n    qualified name.\n\n    Parameters\n    ----------\n    fully_qualified_name : str\n        The fully qualified name of the class that the handler can operate on,\n        such as e.g. ``dask.array.core.Array``.\n    handler : func\n        The handler function.\n    force : bool, optional\n        Whether to overwrite any previous handler if there is already one for\n        the same fully qualified name.\n    ","endLoc":44,"header":"def register_mixin_handler(fully_qualified_name, handler, force=False)","id":9546,"name":"register_mixin_handler","nodeType":"Function","startLoc":18,"text":"def register_mixin_handler(fully_qualified_name, handler, force=False):\n    \"\"\"\n    Register a mixin column 'handler'.\n\n    A mixin column handler is a function that given an arbitrary Python object,\n    will return an object with the .info attribute that can then be used as a\n    mixin column (this can be e.g. a copy of the object with a new attribute,\n    a subclass instance, or a wrapper class - this is left up to the handler).\n\n    The handler will be used on classes that have an exactly matching fully\n    qualified name.\n\n    Parameters\n    ----------\n    fully_qualified_name : str\n        The fully qualified name of the class that the handler can operate on,\n        such as e.g. ``dask.array.core.Array``.\n    handler : func\n        The handler function.\n    force : bool, optional\n        Whether to overwrite any previous handler if there is already one for\n        the same fully qualified name.\n    \"\"\"\n    if fully_qualified_name not in _handlers or force:\n        _handlers[fully_qualified_name] = handler\n    else:\n        raise MixinRegistryError(f\"Handler for class {fully_qualified_name} is already defined\")"},{"className":"DaskInfo","col":0,"comment":"null","endLoc":11,"id":9547,"nodeType":"Class","startLoc":8,"text":"class DaskInfo(ParentDtypeInfo):\n    @staticmethod\n    def default_format(val):\n        return f'{val.compute()}'"},{"col":4,"comment":"null","endLoc":11,"header":"@staticmethod\n    def default_format(val)","id":9548,"name":"default_format","nodeType":"Function","startLoc":9,"text":"@staticmethod\n    def default_format(val):\n        return f'{val.compute()}'"},{"col":0,"comment":"null","endLoc":73,"header":"def dask_handler(arr)","id":9549,"name":"dask_handler","nodeType":"Function","startLoc":71,"text":"def dask_handler(arr):\n    from astropy.table.mixins.dask import as_dask_column\n    return as_dask_column(arr)"},{"col":0,"comment":"null","endLoc":39,"header":"def as_dask_column(array, info=None)","id":9550,"name":"as_dask_column","nodeType":"Function","startLoc":35,"text":"def as_dask_column(array, info=None):\n    result = DaskColumn(array.dask, array.name, array.chunks, meta=array)\n    if info is not None:\n        result.info = info\n    return result"},{"col":4,"comment":"Set value of include/exclude attribute to ``names``.\n\n        Parameters\n        ----------\n        names : None, str, list, tuple\n            Column name(s) to store, or None to clear\n        ","endLoc":539,"header":"def set(self, names)","id":9551,"name":"set","nodeType":"Function","startLoc":510,"text":"def set(self, names):\n        \"\"\"Set value of include/exclude attribute to ``names``.\n\n        Parameters\n        ----------\n        names : None, str, list, tuple\n            Column name(s) to store, or None to clear\n        \"\"\"\n        class _Context:\n            def __init__(self, descriptor_self):\n                self.descriptor_self = descriptor_self\n                self.names_orig = descriptor_self()\n\n            def __enter__(self):\n                pass\n\n            def __exit__(self, type, value, tb):\n                descriptor_self = self.descriptor_self\n                instance = descriptor_self._instance_ref()\n                descriptor_self.__set__(instance, self.names_orig)\n\n            def __repr__(self):\n                return repr(self.descriptor_self)\n\n        ctx = _Context(descriptor_self=self)\n\n        instance = self._instance_ref()\n        self.__set__(instance, names)\n\n        return ctx"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":9552,"name":"__all__","nodeType":"Attribute","startLoc":7,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":9553,"name":"_handlers","nodeType":"Attribute","startLoc":11,"text":"_handlers"},{"col":0,"comment":"","endLoc":7,"header":"registry.py#<anonymous>","id":9554,"name":"<anonymous>","nodeType":"Function","startLoc":7,"text":"__all__ = ['MixinRegistryError', 'register_mixin_handler', 'get_mixin_handler']\n\n_handlers = {}\n\nregister_mixin_handler('dask.array.core.Array', dask_handler)"},{"attributeType":"null","col":8,"comment":"null","endLoc":37,"id":9555,"name":"extra_row","nodeType":"Attribute","startLoc":37,"text":"self.extra_row"},{"fileName":"__init__.py","filePath":"astropy/table/mixins","id":9556,"nodeType":"File","text":""},{"attributeType":"null","col":8,"comment":"null","endLoc":53,"id":9557,"name":"bool_mask","nodeType":"Attribute","startLoc":53,"text":"self.bool_mask"},{"id":9558,"name":"astropy/table/mixins/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/table/mixins/tests","id":9559,"nodeType":"File","text":""},{"id":9560,"name":"astropy/table/scripts","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/table/scripts","id":9561,"nodeType":"File","text":""},{"className":"ArrayWrapper","col":0,"comment":"\n    Minimal mixin using a simple wrapper around a numpy array\n\n    TODO: think about the future of this class as it is mostly for demonstration\n    purposes (of the mixin protocol). Consider taking it out of core and putting\n    it into a tutorial. One advantage of having this in core is that it is\n    getting tested in the mixin testing though it doesn't work for multidim\n    data.\n    ","endLoc":204,"id":9562,"nodeType":"Class","startLoc":156,"text":"class ArrayWrapper:\n    \"\"\"\n    Minimal mixin using a simple wrapper around a numpy array\n\n    TODO: think about the future of this class as it is mostly for demonstration\n    purposes (of the mixin protocol). Consider taking it out of core and putting\n    it into a tutorial. One advantage of having this in core is that it is\n    getting tested in the mixin testing though it doesn't work for multidim\n    data.\n    \"\"\"\n    info = ArrayWrapperInfo()\n\n    def __init__(self, data):\n        self.data = np.array(data)\n        if 'info' in getattr(data, '__dict__', ()):\n            self.info = data.info\n\n    def __getitem__(self, item):\n        if isinstance(item, (int, np.integer)):\n            out = self.data[item]\n        else:\n            out = self.__class__(self.data[item])\n            if 'info' in self.__dict__:\n                out.info = self.info\n        return out\n\n    def __setitem__(self, item, value):\n        self.data[item] = value\n\n    def __len__(self):\n        return len(self.data)\n\n    def __eq__(self, other):\n        \"\"\"Minimal equality testing, mostly for mixin unit tests\"\"\"\n        if isinstance(other, ArrayWrapper):\n            return self.data == other.data\n        else:\n            return self.data == other\n\n    @property\n    def dtype(self):\n        return self.data.dtype\n\n    @property\n    def shape(self):\n        return self.data.shape\n\n    def __repr__(self):\n        return f\"<{self.__class__.__name__} name='{self.info.name}' data={self.data}>\""},{"col":4,"comment":"null","endLoc":171,"header":"def __init__(self, data)","id":9563,"name":"__init__","nodeType":"Function","startLoc":168,"text":"def __init__(self, data):\n        self.data = np.array(data)\n        if 'info' in getattr(data, '__dict__', ()):\n            self.info = data.info"},{"fileName":"showtable.py","filePath":"astropy/table/scripts","id":9564,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\n``showtable`` is a command-line script based on ``astropy.io`` and\n``astropy.table`` for printing ASCII, FITS, HDF5 or VOTable files(s) to the\nstandard output.\n\nExample usage of ``showtable``:\n\n1. FITS::\n\n    $ showtable astropy/io/fits/tests/data/table.fits\n\n     target V_mag\n    ------- -----\n    NGC1001  11.1\n    NGC1002  12.3\n    NGC1003  15.2\n\n2. ASCII::\n\n    $ showtable astropy/io/ascii/tests/t/simple_csv.csv\n\n     a   b   c\n    --- --- ---\n      1   2   3\n      4   5   6\n\n3. XML::\n\n    $ showtable astropy/io/votable/tests/data/names.xml --max-width 70\n\n               col1             col2     col3  ... col15 col16 col17\n               ---              deg      deg   ...  mag   mag   ---\n    ------------------------- -------- ------- ... ----- ----- -----\n    SSTGLMC G000.0000+00.1611   0.0000  0.1611 ...    --    --    AA\n\n\n\n4. Print all the FITS tables in the current directory::\n\n    $ showtable *.fits\n\n\"\"\"\n\nimport argparse\nimport textwrap\nimport warnings\nfrom astropy import log\nfrom astropy.table import Table\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n\ndef showtable(filename, args):\n    \"\"\"\n    Read a table and print to the standard output.\n\n    Parameters\n    ----------\n    filename : str\n        The path to a FITS file.\n\n    \"\"\"\n    if args.info and args.stats:\n        warnings.warn('--info and --stats cannot be used together',\n                      AstropyUserWarning)\n    if (any((args.max_lines, args.max_width, args.hide_unit, args.show_dtype))\n            and (args.info or args.stats)):\n        warnings.warn('print parameters are ignored if --info or --stats is '\n                      'used', AstropyUserWarning)\n\n    # these parameters are passed to Table.read if they are specified in the\n    # command-line\n    read_kwargs = ('hdu', 'format', 'table_id', 'delimiter')\n    kwargs = {k: v for k, v in vars(args).items()\n              if k in read_kwargs and v is not None}\n    try:\n        table = Table.read(filename, **kwargs)\n        if args.info:\n            table.info('attributes')\n        elif args.stats:\n            table.info('stats')\n        else:\n            formatter = table.more if args.more else table.pprint\n            formatter(max_lines=args.max_lines, max_width=args.max_width,\n                      show_unit=(False if args.hide_unit else None),\n                      show_dtype=args.show_dtype)\n    except IOError as e:\n        log.error(str(e))\n\n\ndef main(args=None):\n    \"\"\"The main function called by the `showtable` script.\"\"\"\n    parser = argparse.ArgumentParser(\n        description=textwrap.dedent(\"\"\"\n            Print tables from ASCII, FITS, HDF5, VOTable file(s).  The tables\n            are read with 'astropy.table.Table.read' and are printed with\n            'astropy.table.Table.pprint'. The default behavior is to make the\n            table output fit onto a single screen page.  For a long and wide\n            table this will mean cutting out inner rows and columns.  To print\n            **all** the rows or columns use ``--max-lines=-1`` or\n            ``max-width=-1``, respectively. The complete list of supported\n            formats can be found at\n            http://astropy.readthedocs.io/en/latest/io/unified.html#built-in-table-readers-writers\n        \"\"\"))\n\n    addarg = parser.add_argument\n    addarg('filename', nargs='+', help='path to one or more files')\n\n    addarg('--format', help='input table format, should be specified if it '\n           'cannot be automatically detected')\n    addarg('--more', action='store_true',\n           help='use the pager mode from Table.more')\n    addarg('--info', action='store_true',\n           help='show information about the table columns')\n    addarg('--stats', action='store_true',\n           help='show statistics about the table columns')\n\n    # pprint arguments\n    pprint_args = parser.add_argument_group('pprint arguments')\n    addarg = pprint_args.add_argument\n    addarg('--max-lines', type=int,\n           help='maximum number of lines in table output (default=screen '\n           'length, -1 for no limit)')\n    addarg('--max-width', type=int,\n           help='maximum width in table output (default=screen width, '\n           '-1 for no limit)')\n    addarg('--hide-unit', action='store_true',\n           help='hide the header row for unit (which is shown '\n           'only if one or more columns has a unit)')\n    addarg('--show-dtype', action='store_true',\n           help='include a header row for column dtypes')\n\n    # ASCII-specific arguments\n    ascii_args = parser.add_argument_group('ASCII arguments')\n    addarg = ascii_args.add_argument\n    addarg('--delimiter', help='column delimiter string')\n\n    # FITS-specific arguments\n    fits_args = parser.add_argument_group('FITS arguments')\n    addarg = fits_args.add_argument\n    addarg('--hdu', help='name of the HDU to show')\n\n    # HDF5-specific arguments\n    hdf5_args = parser.add_argument_group('HDF5 arguments')\n    addarg = hdf5_args.add_argument\n    addarg('--path', help='the path from which to read the table')\n\n    # VOTable-specific arguments\n    votable_args = parser.add_argument_group('VOTable arguments')\n    addarg = votable_args.add_argument\n    addarg('--table-id', help='the table to read in')\n\n    args = parser.parse_args(args)\n\n    for idx, filename in enumerate(args.filename):\n        if idx > 0:\n            print()\n        showtable(filename, args)\n"},{"col":4,"comment":"null","endLoc":180,"header":"def __getitem__(self, item)","id":9565,"name":"__getitem__","nodeType":"Function","startLoc":173,"text":"def __getitem__(self, item):\n        if isinstance(item, (int, np.integer)):\n            out = self.data[item]\n        else:\n            out = self.__class__(self.data[item])\n            if 'info' in self.__dict__:\n                out.info = self.info\n        return out"},{"attributeType":"null","col":8,"comment":"null","endLoc":24,"id":9566,"name":"masked","nodeType":"Attribute","startLoc":24,"text":"self.masked"},{"col":0,"comment":"\n    Read a table and print to the standard output.\n\n    Parameters\n    ----------\n    filename : str\n        The path to a FITS file.\n\n    ","endLoc":88,"header":"def showtable(filename, args)","id":9567,"name":"showtable","nodeType":"Function","startLoc":53,"text":"def showtable(filename, args):\n    \"\"\"\n    Read a table and print to the standard output.\n\n    Parameters\n    ----------\n    filename : str\n        The path to a FITS file.\n\n    \"\"\"\n    if args.info and args.stats:\n        warnings.warn('--info and --stats cannot be used together',\n                      AstropyUserWarning)\n    if (any((args.max_lines, args.max_width, args.hide_unit, args.show_dtype))\n            and (args.info or args.stats)):\n        warnings.warn('print parameters are ignored if --info or --stats is '\n                      'used', AstropyUserWarning)\n\n    # these parameters are passed to Table.read if they are specified in the\n    # command-line\n    read_kwargs = ('hdu', 'format', 'table_id', 'delimiter')\n    kwargs = {k: v for k, v in vars(args).items()\n              if k in read_kwargs and v is not None}\n    try:\n        table = Table.read(filename, **kwargs)\n        if args.info:\n            table.info('attributes')\n        elif args.stats:\n            table.info('stats')\n        else:\n            formatter = table.more if args.more else table.pprint\n            formatter(max_lines=args.max_lines, max_width=args.max_width,\n                      show_unit=(False if args.hide_unit else None),\n                      show_dtype=args.show_dtype)\n    except IOError as e:\n        log.error(str(e))"},{"attributeType":"null","col":8,"comment":"null","endLoc":39,"id":9568,"name":"row_indices","nodeType":"Attribute","startLoc":39,"text":"self.row_indices"},{"attributeType":"null","col":0,"comment":"null","endLoc":40,"id":9570,"name":"_implementation_notes","nodeType":"Attribute","startLoc":40,"text":"_implementation_notes"},{"attributeType":"null","col":0,"comment":"null","endLoc":70,"id":9571,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":70,"text":"__doctest_skip__"},{"attributeType":"null","col":0,"comment":"null","endLoc":75,"id":9572,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":75,"text":"__doctest_requires__"},{"attributeType":"Table","col":8,"comment":"null","endLoc":43,"id":9573,"name":"other_table","nodeType":"Attribute","startLoc":43,"text":"self.other_table"},{"attributeType":"Table","col":8,"comment":"null","endLoc":49,"id":9574,"name":"other_table_2","nodeType":"Attribute","startLoc":49,"text":"self.other_table_2"},{"attributeType":"null","col":0,"comment":"null","endLoc":77,"id":9575,"name":"_pprint_docs","nodeType":"Attribute","startLoc":77,"text":"_pprint_docs"},{"attributeType":"null","col":0,"comment":"null","endLoc":107,"id":9576,"name":"_pformat_docs","nodeType":"Attribute","startLoc":107,"text":"_pformat_docs"},{"attributeType":"Table","col":8,"comment":"null","endLoc":27,"id":9577,"name":"table","nodeType":"Attribute","startLoc":27,"text":"self.table"},{"attributeType":"null","col":8,"comment":"null","endLoc":38,"id":9578,"name":"extra_column","nodeType":"Attribute","startLoc":38,"text":"self.extra_column"},{"col":0,"comment":"","endLoc":2,"header":"table.py#<anonymous>","id":9579,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"_implementation_notes = \"\"\"\nThis string has informal notes concerning Table implementation for developers.\n\nThings to remember:\n\n- Table has customizable attributes ColumnClass, Column, MaskedColumn.\n  Table.Column is normally just column.Column (same w/ MaskedColumn)\n  but in theory they can be different.  Table.ColumnClass is the default\n  class used to create new non-mixin columns, and this is a function of\n  the Table.masked attribute.  Column creation / manipulation in a Table\n  needs to respect these.\n\n- Column objects that get inserted into the Table.columns attribute must\n  have the info.parent_table attribute set correctly.  Beware just dropping\n  an object into the columns dict since an existing column may\n  be part of another Table and have parent_table set to point at that\n  table.  Dropping that column into `columns` of this Table will cause\n  a problem for the old one so the column object needs to be copied (but\n  not necessarily the data).\n\n  Currently replace_column is always making a copy of both object and\n  data if parent_table is set.  This could be improved but requires a\n  generic way to copy a mixin object but not the data.\n\n- Be aware of column objects that have indices set.\n\n- `cls.ColumnClass` is a property that effectively uses the `masked` attribute\n  to choose either `cls.Column` or `cls.MaskedColumn`.\n\"\"\"\n\n__doctest_skip__ = ['Table.read', 'Table.write', 'Table._read',\n                    'Table.convert_bytestring_to_unicode',\n                    'Table.convert_unicode_to_bytestring',\n                    ]\n\n__doctest_requires__ = {'*pandas': ['pandas>=1.1']}\n\n_pprint_docs = \"\"\"\n    {__doc__}\n\n    Parameters\n    ----------\n    max_lines : int or None\n        Maximum number of lines in table output.\n\n    max_width : int or None\n        Maximum character width of output.\n\n    show_name : bool\n        Include a header row for column names. Default is True.\n\n    show_unit : bool\n        Include a header row for unit.  Default is to show a row\n        for units only if one or more columns has a defined value\n        for the unit.\n\n    show_dtype : bool\n        Include a header row for column dtypes. Default is True.\n\n    align : str or list or tuple or None\n        Left/right alignment of columns. Default is right (None) for all\n        columns. Other allowed values are '>', '<', '^', and '0=' for\n        right, left, centered, and 0-padded, respectively. A list of\n        strings can be provided for alignment of tables with multiple\n        columns.\n    \"\"\"\n\n_pformat_docs = \"\"\"\n    {__doc__}\n\n    Parameters\n    ----------\n    max_lines : int or None\n        Maximum number of rows to output\n\n    max_width : int or None\n        Maximum character width of output\n\n    show_name : bool\n        Include a header row for column names. Default is True.\n\n    show_unit : bool\n        Include a header row for unit.  Default is to show a row\n        for units only if one or more columns has a defined value\n        for the unit.\n\n    show_dtype : bool\n        Include a header row for column dtypes. Default is True.\n\n    html : bool\n        Format the output as an HTML table. Default is False.\n\n    tableid : str or None\n        An ID tag for the table; only used if html is set.  Default is\n        \"table{id}\", where id is the unique integer id of the table object,\n        id(self)\n\n    align : str or list or tuple or None\n        Left/right alignment of columns. Default is right (None) for all\n        columns. Other allowed values are '>', '<', '^', and '0=' for\n        right, left, centered, and 0-padded, respectively. A list of\n        strings can be provided for alignment of tables with multiple\n        columns.\n\n    tableclass : str or list of str or None\n        CSS classes for the table; only used if html is set.  Default is\n        None.\n\n    Returns\n    -------\n    lines : list\n        Formatted table as a list of strings.\n    \"\"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":40,"id":9580,"name":"table_grouped","nodeType":"Attribute","startLoc":40,"text":"self.table_grouped"},{"className":"ArrayWrapperInfo","col":0,"comment":"null","endLoc":153,"id":9581,"nodeType":"Class","startLoc":140,"text":"class ArrayWrapperInfo(ParentDtypeInfo):\n    _represent_as_dict_primary_data = 'data'\n\n    def _represent_as_dict(self):\n        \"\"\"Represent Column as a dict that can be serialized.\"\"\"\n        col = self._parent\n        out = {'data': col.data}\n        return out\n\n    def _construct_from_dict(self, map):\n        \"\"\"Construct Column from ``map``.\"\"\"\n        data = map.pop('data')\n        out = self._parent_cls(data, **map)\n        return out"},{"col":4,"comment":"Represent Column as a dict that can be serialized.","endLoc":147,"header":"def _represent_as_dict(self)","id":9582,"name":"_represent_as_dict","nodeType":"Function","startLoc":143,"text":"def _represent_as_dict(self):\n        \"\"\"Represent Column as a dict that can be serialized.\"\"\"\n        col = self._parent\n        out = {'data': col.data}\n        return out"},{"col":4,"comment":"Construct Column from ``map``.","endLoc":153,"header":"def _construct_from_dict(self, map)","id":9583,"name":"_construct_from_dict","nodeType":"Function","startLoc":149,"text":"def _construct_from_dict(self, map):\n        \"\"\"Construct Column from ``map``.\"\"\"\n        data = map.pop('data')\n        out = self._parent_cls(data, **map)\n        return out"},{"col":4,"comment":"null","endLoc":183,"header":"def __setitem__(self, item, value)","id":9584,"name":"__setitem__","nodeType":"Function","startLoc":182,"text":"def __setitem__(self, item, value):\n        self.data[item] = value"},{"col":4,"comment":"null","endLoc":186,"header":"def __len__(self)","id":9585,"name":"__len__","nodeType":"Function","startLoc":185,"text":"def __len__(self):\n        return len(self.data)"},{"col":4,"comment":"Minimal equality testing, mostly for mixin unit tests","endLoc":193,"header":"def __eq__(self, other)","id":9586,"name":"__eq__","nodeType":"Function","startLoc":188,"text":"def __eq__(self, other):\n        \"\"\"Minimal equality testing, mostly for mixin unit tests\"\"\"\n        if isinstance(other, ArrayWrapper):\n            return self.data == other.data\n        else:\n            return self.data == other"},{"col":4,"comment":"null","endLoc":197,"header":"@property\n    def dtype(self)","id":9587,"name":"dtype","nodeType":"Function","startLoc":195,"text":"@property\n    def dtype(self):\n        return self.data.dtype"},{"col":4,"comment":"null","endLoc":201,"header":"@property\n    def shape(self)","id":9588,"name":"shape","nodeType":"Function","startLoc":199,"text":"@property\n    def shape(self):\n        return self.data.shape"},{"col":4,"comment":"null","endLoc":204,"header":"def __repr__(self)","id":9589,"name":"__repr__","nodeType":"Function","startLoc":203,"text":"def __repr__(self):\n        return f\"<{self.__class__.__name__} name='{self.info.name}' data={self.data}>\""},{"attributeType":"null","col":4,"comment":"null","endLoc":166,"id":9590,"name":"info","nodeType":"Attribute","startLoc":166,"text":"info"},{"attributeType":"null","col":8,"comment":"null","endLoc":169,"id":9591,"name":"data","nodeType":"Attribute","startLoc":169,"text":"self.data"},{"className":"DaskColumn","col":0,"comment":"null","endLoc":32,"id":9592,"nodeType":"Class","startLoc":14,"text":"class DaskColumn(da.Array):\n\n    info = DaskInfo()\n\n    def copy(self):\n        # Array hard-codes the resulting copied array as Array, so need to\n        # overload this since Table tries to copy the array.\n        return as_dask_column(self, info=self.info)\n\n    def __getitem__(self, item):\n        result = super().__getitem__(item)\n        if isinstance(item, int):\n            return result\n        else:\n            return as_dask_column(result, info=self.info)\n\n    def insert(self, obj, values, axis=0):\n        return as_dask_column(da.insert(self, obj, values, axis=axis),\n                              info=self.info)"},{"col":4,"comment":"null","endLoc":21,"header":"def copy(self)","id":9593,"name":"copy","nodeType":"Function","startLoc":18,"text":"def copy(self):\n        # Array hard-codes the resulting copied array as Array, so need to\n        # overload this since Table tries to copy the array.\n        return as_dask_column(self, info=self.info)"},{"attributeType":"null","col":12,"comment":"null","endLoc":171,"id":9594,"name":"info","nodeType":"Attribute","startLoc":171,"text":"self.info"},{"col":4,"comment":"null","endLoc":28,"header":"def __getitem__(self, item)","id":9595,"name":"__getitem__","nodeType":"Function","startLoc":23,"text":"def __getitem__(self, item):\n        result = super().__getitem__(item)\n        if isinstance(item, int):\n            return result\n        else:\n            return as_dask_column(result, info=self.info)"},{"className":"MaskedTable","col":0,"comment":"null","endLoc":38,"id":9596,"nodeType":"Class","startLoc":35,"text":"class MaskedTable(table.Table):\n    def __init__(self, *args, **kwargs):\n        kwargs['masked'] = True\n        table.Table.__init__(self, *args, **kwargs)"},{"id":9597,"name":"astropy/tests","nodeType":"Package"},{"fileName":"helper.py","filePath":"astropy/tests","id":9598,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module provides the tools used to internally run the astropy test suite\nfrom the installed astropy.  It makes use of the `pytest`_ testing framework.\n\"\"\"\nimport os\nimport sys\nimport pickle\nimport warnings\nimport functools\n\nimport pytest\n\nfrom astropy.units import allclose as quantity_allclose  # noqa: F401\nfrom astropy.utils.decorators import deprecated\nfrom astropy.utils.exceptions import (AstropyDeprecationWarning,\n                                      AstropyPendingDeprecationWarning)\n\n\n# For backward-compatibility with affiliated packages\nfrom .runner import TestRunner  # pylint: disable=W0611  # noqa\n\n__all__ = ['assert_follows_unicode_guidelines',\n           'assert_quantity_allclose', 'check_pickling_recovery',\n           'pickle_protocol', 'generic_recursive_equality_test']\n\n\ndef _save_coverage(cov, result, rootdir, testing_path):\n    \"\"\"\n    This method is called after the tests have been run in coverage mode\n    to cleanup and then save the coverage data and report.\n    \"\"\"\n    from astropy.utils.console import color_print\n\n    if result != 0:\n        return\n\n    # The coverage report includes the full path to the temporary\n    # directory, so we replace all the paths with the true source\n    # path. Note that this will not work properly for packages that still\n    # rely on 2to3.\n    try:\n        # Coverage 4.0: _harvest_data has been renamed to get_data, the\n        # lines dict is private\n        cov.get_data()\n    except AttributeError:\n        # Coverage < 4.0\n        cov._harvest_data()\n        lines = cov.data.lines\n    else:\n        lines = cov.data._lines\n\n    for key in list(lines.keys()):\n        new_path = os.path.relpath(\n            os.path.realpath(key),\n            os.path.realpath(testing_path))\n        new_path = os.path.abspath(\n            os.path.join(rootdir, new_path))\n        lines[new_path] = lines.pop(key)\n\n    color_print('Saving coverage data in .coverage...', 'green')\n    cov.save()\n\n    color_print('Saving HTML coverage report in htmlcov...', 'green')\n    cov.html_report(directory=os.path.join(rootdir, 'htmlcov'))\n\n\n@deprecated('5.1', alternative='pytest.raises')\nclass raises:\n    \"\"\"\n    A decorator to mark that a test should raise a given exception.\n    Use as follows::\n\n        @raises(ZeroDivisionError)\n        def test_foo():\n            x = 1/0\n\n    This can also be used a context manager, in which case it is just\n    an alias for the ``pytest.raises`` context manager (because the\n    two have the same name this help avoid confusion by being\n    flexible).\n\n    .. note:: Usage of ``pytest.raises`` is preferred.\n\n    \"\"\"\n\n    # pep-8 naming exception -- this is a decorator class\n    def __init__(self, exc):\n        self._exc = exc\n        self._ctx = None\n\n    def __call__(self, func):\n        @functools.wraps(func)\n        def run_raises_test(*args, **kwargs):\n            pytest.raises(self._exc, func, *args, **kwargs)\n        return run_raises_test\n\n    def __enter__(self):\n        self._ctx = pytest.raises(self._exc)\n        return self._ctx.__enter__()\n\n    def __exit__(self, *exc_info):\n        return self._ctx.__exit__(*exc_info)\n\n\n# TODO: Remove these when deprecation period of things deprecated in PR 12633 are removed.\n_deprecations_as_exceptions = False\n_include_astropy_deprecations = True\n_modules_to_ignore_on_import = set([\n    r'compiler',  # A deprecated stdlib module used by pytest\n    r'scipy',\n    r'pygments',\n    r'ipykernel',\n    r'IPython',   # deprecation warnings for async and await\n    r'setuptools'])\n_warnings_to_ignore_entire_module = set([])\n_warnings_to_ignore_by_pyver = {\n    None: set([  # Python version agnostic\n        # https://github.com/astropy/astropy/pull/7372\n        (r\"Importing from numpy\\.testing\\.decorators is deprecated, \"\n         r\"import from numpy\\.testing instead\\.\", DeprecationWarning),\n        # inspect raises this slightly different warning on Python 3.7.\n        # Keeping it since e.g. lxml as of 3.8.0 is still calling getargspec()\n        (r\"inspect\\.getargspec\\(\\) is deprecated, use \"\n         r\"inspect\\.signature\\(\\) or inspect\\.getfullargspec\\(\\)\",\n         DeprecationWarning),\n        # https://github.com/astropy/pytest-doctestplus/issues/29\n        (r\"split\\(\\) requires a non-empty pattern match\", FutureWarning),\n        # Package resolution warning that we can do nothing about\n        (r\"can't resolve package from __spec__ or __package__, \"\n         r\"falling back on __name__ and __path__\", ImportWarning)]),\n    (3, 7): set([\n        # Deprecation warning for collections.abc, fixed in Astropy but still\n        # used in lxml, and maybe others\n        (r\"Using or importing the ABCs from 'collections'\",\n         DeprecationWarning)])\n}\n\n\n@deprecated('5.1', alternative='https://docs.pytest.org/en/stable/warnings.html')\ndef enable_deprecations_as_exceptions(include_astropy_deprecations=True,\n                                      modules_to_ignore_on_import=[],\n                                      warnings_to_ignore_entire_module=[],\n                                      warnings_to_ignore_by_pyver={}):\n    \"\"\"\n    Turn on the feature that turns deprecations into exceptions.\n\n    Parameters\n    ----------\n    include_astropy_deprecations : bool\n        If set to `True`, ``AstropyDeprecationWarning`` and\n        ``AstropyPendingDeprecationWarning`` are also turned into exceptions.\n\n    modules_to_ignore_on_import : list of str\n        List of additional modules that generate deprecation warnings\n        on import, which are to be ignored. By default, these are already\n        included: ``compiler``, ``scipy``, ``pygments``, ``ipykernel``, and\n        ``setuptools``.\n\n    warnings_to_ignore_entire_module : list of str\n        List of modules with deprecation warnings to ignore completely,\n        not just during import. If ``include_astropy_deprecations=True``\n        is given, ``AstropyDeprecationWarning`` and\n        ``AstropyPendingDeprecationWarning`` are also ignored for the modules.\n\n    warnings_to_ignore_by_pyver : dict\n        Dictionary mapping tuple of ``(major, minor)`` Python version to\n        a list of ``(warning_message, warning_class)`` to ignore.\n        Python version-agnostic warnings should be mapped to `None` key.\n        This is in addition of those already ignored by default\n        (see ``_warnings_to_ignore_by_pyver`` values).\n\n    \"\"\"\n    global _deprecations_as_exceptions\n    _deprecations_as_exceptions = True\n\n    global _include_astropy_deprecations\n    _include_astropy_deprecations = include_astropy_deprecations\n\n    global _modules_to_ignore_on_import\n    _modules_to_ignore_on_import.update(modules_to_ignore_on_import)\n\n    global _warnings_to_ignore_entire_module\n    _warnings_to_ignore_entire_module.update(warnings_to_ignore_entire_module)\n\n    global _warnings_to_ignore_by_pyver\n    for key, val in warnings_to_ignore_by_pyver.items():\n        if key in _warnings_to_ignore_by_pyver:\n            _warnings_to_ignore_by_pyver[key].update(val)\n        else:\n            _warnings_to_ignore_by_pyver[key] = set(val)\n\n\n@deprecated('5.1', alternative='https://docs.pytest.org/en/stable/warnings.html')\ndef treat_deprecations_as_exceptions():\n    \"\"\"\n    Turn all DeprecationWarnings (which indicate deprecated uses of\n    Python itself or Numpy, but not within Astropy, where we use our\n    own deprecation warning class) into exceptions so that we find\n    out about them early.\n\n    This completely resets the warning filters and any \"already seen\"\n    warning state.\n    \"\"\"\n    # First, totally reset the warning state. The modules may change during\n    # this iteration thus we copy the original state to a list to iterate\n    # on. See https://github.com/astropy/astropy/pull/5513.\n    for module in list(sys.modules.values()):\n        try:\n            del module.__warningregistry__\n        except Exception:\n            pass\n\n    if not _deprecations_as_exceptions:\n        return\n\n    warnings.resetwarnings()\n\n    # Hide the next couple of DeprecationWarnings\n    warnings.simplefilter('ignore', DeprecationWarning)\n    # Here's the wrinkle: a couple of our third-party dependencies\n    # (pytest and scipy) are still using deprecated features\n    # themselves, and we'd like to ignore those.  Fortunately, those\n    # show up only at import time, so if we import those things *now*,\n    # before we turn the warnings into exceptions, we're golden.\n    for m in _modules_to_ignore_on_import:\n        try:\n            __import__(m)\n        except ImportError:\n            pass\n\n    # Now, start over again with the warning filters\n    warnings.resetwarnings()\n    # Now, turn these warnings into exceptions\n    _all_warns = [DeprecationWarning, FutureWarning, ImportWarning]\n\n    # Only turn astropy deprecation warnings into exceptions if requested\n    if _include_astropy_deprecations:\n        _all_warns += [AstropyDeprecationWarning,\n                       AstropyPendingDeprecationWarning]\n\n    for w in _all_warns:\n        warnings.filterwarnings(\"error\", \".*\", w)\n\n    # This ignores all specified warnings from given module(s),\n    # not just on import, for use of Astropy affiliated packages.\n    for m in _warnings_to_ignore_entire_module:\n        for w in _all_warns:\n            warnings.filterwarnings('ignore', category=w, module=m)\n\n    # This ignores only specified warnings by Python version, if applicable.\n    for v in _warnings_to_ignore_by_pyver:\n        if v is None or sys.version_info[:2] == v:\n            for s in _warnings_to_ignore_by_pyver[v]:\n                warnings.filterwarnings(\"ignore\", s[0], s[1])\n\n\n@deprecated('5.1', alternative='pytest.warns')\nclass catch_warnings(warnings.catch_warnings):\n    \"\"\"\n    A high-powered version of warnings.catch_warnings to use for testing\n    and to make sure that there is no dependence on the order in which\n    the tests are run.\n\n    This completely blitzes any memory of any warnings that have\n    appeared before so that all warnings will be caught and displayed.\n\n    ``*args`` is a set of warning classes to collect.  If no arguments are\n    provided, all warnings are collected.\n\n    Use as follows::\n\n        with catch_warnings(MyCustomWarning) as w:\n            do.something.bad()\n        assert len(w) > 0\n\n    .. note:: Usage of :ref:`pytest.warns <pytest:warns>` is preferred.\n\n    \"\"\"\n\n    def __init__(self, *classes):\n        super().__init__(record=True)\n        self.classes = classes\n\n    def __enter__(self):\n        warning_list = super().__enter__()\n        treat_deprecations_as_exceptions()\n        if len(self.classes) == 0:\n            warnings.simplefilter('always')\n        else:\n            warnings.simplefilter('ignore')\n            for cls in self.classes:\n                warnings.simplefilter('always', cls)\n        return warning_list\n\n    def __exit__(self, type, value, traceback):\n        treat_deprecations_as_exceptions()\n\n\n@deprecated('5.1', alternative='pytest.mark.filterwarnings')\nclass ignore_warnings(catch_warnings):\n    \"\"\"\n    This can be used either as a context manager or function decorator to\n    ignore all warnings that occur within a function or block of code.\n\n    An optional category option can be supplied to only ignore warnings of a\n    certain category or categories (if a list is provided).\n    \"\"\"\n\n    def __init__(self, category=None):\n        super().__init__()\n\n        if isinstance(category, type) and issubclass(category, Warning):\n            self.category = [category]\n        else:\n            self.category = category\n\n    def __call__(self, func):\n        @functools.wraps(func)\n        def wrapper(*args, **kwargs):\n            # Originally this just reused self, but that doesn't work if the\n            # function is called more than once so we need to make a new\n            # context manager instance for each call\n            with self.__class__(category=self.category):\n                return func(*args, **kwargs)\n\n        return wrapper\n\n    def __enter__(self):\n        retval = super().__enter__()\n        if self.category is not None:\n            for category in self.category:\n                warnings.simplefilter('ignore', category)\n        else:\n            warnings.simplefilter('ignore')\n        return retval\n\n\ndef assert_follows_unicode_guidelines(\n        x, roundtrip=None):\n    \"\"\"\n    Test that an object follows our Unicode policy.  See\n    \"Unicode guidelines\" in the coding guidelines.\n\n    Parameters\n    ----------\n    x : object\n        The instance to test\n\n    roundtrip : module, optional\n        When provided, this namespace will be used to evaluate\n        ``repr(x)`` and ensure that it roundtrips.  It will also\n        ensure that ``__bytes__(x)`` roundtrip.\n        If not provided, no roundtrip testing will be performed.\n    \"\"\"\n    from astropy import conf\n\n    with conf.set_temp('unicode_output', False):\n        bytes_x = bytes(x)\n        unicode_x = str(x)\n        repr_x = repr(x)\n\n        assert isinstance(bytes_x, bytes)\n        bytes_x.decode('ascii')\n        assert isinstance(unicode_x, str)\n        unicode_x.encode('ascii')\n        assert isinstance(repr_x, str)\n        if isinstance(repr_x, bytes):\n            repr_x.decode('ascii')\n        else:\n            repr_x.encode('ascii')\n\n        if roundtrip is not None:\n            assert x.__class__(bytes_x) == x\n            assert x.__class__(unicode_x) == x\n            assert eval(repr_x, roundtrip) == x\n\n    with conf.set_temp('unicode_output', True):\n        bytes_x = bytes(x)\n        unicode_x = str(x)\n        repr_x = repr(x)\n\n        assert isinstance(bytes_x, bytes)\n        bytes_x.decode('ascii')\n        assert isinstance(unicode_x, str)\n        assert isinstance(repr_x, str)\n        if isinstance(repr_x, bytes):\n            repr_x.decode('ascii')\n        else:\n            repr_x.encode('ascii')\n\n        if roundtrip is not None:\n            assert x.__class__(bytes_x) == x\n            assert x.__class__(unicode_x) == x\n            assert eval(repr_x, roundtrip) == x\n\n\n@pytest.fixture(params=[0, 1, -1])\ndef pickle_protocol(request):\n    \"\"\"\n    Fixture to run all the tests for protocols 0 and 1, and -1 (most advanced).\n    (Originally from astropy.table.tests.test_pickle)\n    \"\"\"\n    return request.param\n\n\ndef generic_recursive_equality_test(a, b, class_history):\n    \"\"\"\n    Check if the attributes of a and b are equal. Then,\n    check if the attributes of the attributes are equal.\n    \"\"\"\n    dict_a = a.__getstate__() if hasattr(a, '__getstate__') else a.__dict__\n    dict_b = b.__dict__\n    for key in dict_a:\n        assert key in dict_b,\\\n          f\"Did not pickle {key}\"\n        if hasattr(dict_a[key], '__eq__'):\n            eq = (dict_a[key] == dict_b[key])\n            if '__iter__' in dir(eq):\n                eq = (False not in eq)\n            assert eq, f\"Value of {key} changed by pickling\"\n\n        if hasattr(dict_a[key], '__dict__'):\n            if dict_a[key].__class__ in class_history:\n                # attempt to prevent infinite recursion\n                pass\n            else:\n                new_class_history = [dict_a[key].__class__]\n                new_class_history.extend(class_history)\n                generic_recursive_equality_test(dict_a[key],\n                                                dict_b[key],\n                                                new_class_history)\n\n\ndef check_pickling_recovery(original, protocol):\n    \"\"\"\n    Try to pickle an object. If successful, make sure\n    the object's attributes survived pickling and unpickling.\n    \"\"\"\n    f = pickle.dumps(original, protocol=protocol)\n    unpickled = pickle.loads(f)\n    class_history = [original.__class__]\n    generic_recursive_equality_test(original, unpickled,\n                                    class_history)\n\n\ndef assert_quantity_allclose(actual, desired, rtol=1.e-7, atol=None,\n                             **kwargs):\n    \"\"\"\n    Raise an assertion if two objects are not equal up to desired tolerance.\n\n    This is a :class:`~astropy.units.Quantity`-aware version of\n    :func:`numpy.testing.assert_allclose`.\n    \"\"\"\n    import numpy as np\n    from astropy.units.quantity import _unquantify_allclose_arguments\n    np.testing.assert_allclose(*_unquantify_allclose_arguments(\n        actual, desired, rtol, atol), **kwargs)\n"},{"col":0,"comment":"The main function called by the `showtable` script.","endLoc":158,"header":"def main(args=None)","id":9599,"name":"main","nodeType":"Function","startLoc":91,"text":"def main(args=None):\n    \"\"\"The main function called by the `showtable` script.\"\"\"\n    parser = argparse.ArgumentParser(\n        description=textwrap.dedent(\"\"\"\n            Print tables from ASCII, FITS, HDF5, VOTable file(s).  The tables\n            are read with 'astropy.table.Table.read' and are printed with\n            'astropy.table.Table.pprint'. The default behavior is to make the\n            table output fit onto a single screen page.  For a long and wide\n            table this will mean cutting out inner rows and columns.  To print\n            **all** the rows or columns use ``--max-lines=-1`` or\n            ``max-width=-1``, respectively. The complete list of supported\n            formats can be found at\n            http://astropy.readthedocs.io/en/latest/io/unified.html#built-in-table-readers-writers\n        \"\"\"))\n\n    addarg = parser.add_argument\n    addarg('filename', nargs='+', help='path to one or more files')\n\n    addarg('--format', help='input table format, should be specified if it '\n           'cannot be automatically detected')\n    addarg('--more', action='store_true',\n           help='use the pager mode from Table.more')\n    addarg('--info', action='store_true',\n           help='show information about the table columns')\n    addarg('--stats', action='store_true',\n           help='show statistics about the table columns')\n\n    # pprint arguments\n    pprint_args = parser.add_argument_group('pprint arguments')\n    addarg = pprint_args.add_argument\n    addarg('--max-lines', type=int,\n           help='maximum number of lines in table output (default=screen '\n           'length, -1 for no limit)')\n    addarg('--max-width', type=int,\n           help='maximum width in table output (default=screen width, '\n           '-1 for no limit)')\n    addarg('--hide-unit', action='store_true',\n           help='hide the header row for unit (which is shown '\n           'only if one or more columns has a unit)')\n    addarg('--show-dtype', action='store_true',\n           help='include a header row for column dtypes')\n\n    # ASCII-specific arguments\n    ascii_args = parser.add_argument_group('ASCII arguments')\n    addarg = ascii_args.add_argument\n    addarg('--delimiter', help='column delimiter string')\n\n    # FITS-specific arguments\n    fits_args = parser.add_argument_group('FITS arguments')\n    addarg = fits_args.add_argument\n    addarg('--hdu', help='name of the HDU to show')\n\n    # HDF5-specific arguments\n    hdf5_args = parser.add_argument_group('HDF5 arguments')\n    addarg = hdf5_args.add_argument\n    addarg('--path', help='the path from which to read the table')\n\n    # VOTable-specific arguments\n    votable_args = parser.add_argument_group('VOTable arguments')\n    addarg = votable_args.add_argument\n    addarg('--table-id', help='the table to read in')\n\n    args = parser.parse_args(args)\n\n    for idx, filename in enumerate(args.filename):\n        if idx > 0:\n            print()\n        showtable(filename, args)"},{"col":4,"comment":"null","endLoc":32,"header":"def insert(self, obj, values, axis=0)","id":9600,"name":"insert","nodeType":"Function","startLoc":30,"text":"def insert(self, obj, values, axis=0):\n        return as_dask_column(da.insert(self, obj, values, axis=axis),\n                              info=self.info)"},{"attributeType":"DaskInfo","col":4,"comment":"null","endLoc":16,"id":9601,"name":"info","nodeType":"Attribute","startLoc":16,"text":"info"},{"col":4,"comment":"null","endLoc":38,"header":"def __init__(self, *args, **kwargs)","id":9602,"name":"__init__","nodeType":"Function","startLoc":36,"text":"def __init__(self, *args, **kwargs):\n        kwargs['masked'] = True\n        table.Table.__init__(self, *args, **kwargs)"},{"attributeType":"null","col":21,"comment":"null","endLoc":1,"id":9603,"name":"da","nodeType":"Attribute","startLoc":1,"text":"da"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":9604,"name":"__all__","nodeType":"Attribute","startLoc":5,"text":"__all__"},{"col":0,"comment":"","endLoc":1,"header":"dask.py#<anonymous>","id":9605,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"__all__ = ['as_dask_column']"},{"col":0,"comment":"","endLoc":43,"header":"showtable.py#<anonymous>","id":9606,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n``showtable`` is a command-line script based on ``astropy.io`` and\n``astropy.table`` for printing ASCII, FITS, HDF5 or VOTable files(s) to the\nstandard output.\n\nExample usage of ``showtable``:\n\n1. FITS::\n\n    $ showtable astropy/io/fits/tests/data/table.fits\n\n     target V_mag\n    ------- -----\n    NGC1001  11.1\n    NGC1002  12.3\n    NGC1003  15.2\n\n2. ASCII::\n\n    $ showtable astropy/io/ascii/tests/t/simple_csv.csv\n\n     a   b   c\n    --- --- ---\n      1   2   3\n      4   5   6\n\n3. XML::\n\n    $ showtable astropy/io/votable/tests/data/names.xml --max-width 70\n\n               col1             col2     col3  ... col15 col16 col17\n               ---              deg      deg   ...  mag   mag   ---\n    ------------------------- -------- ------- ... ----- ----- -----\n    SSTGLMC G000.0000+00.1611   0.0000  0.1611 ...    --    --    AA\n\n\n\n4. Print all the FITS tables in the current directory::\n\n    $ showtable *.fits\n\n\"\"\""},{"fileName":"command.py","filePath":"astropy/tests","id":9607,"nodeType":"File","text":"\"\"\"Implements the wrapper for the Astropy test runner.\n\nThis is for backward-compatibility for other downstream packages and can be removed\nonce astropy-helpers has reached end-of-life.\n\n\"\"\"\nimport os\nimport stat\nimport shutil\nimport subprocess\nimport sys\nimport tempfile\nfrom contextlib import contextmanager\n\nfrom setuptools import Command\nfrom astropy.logger import log\n\n\n@contextmanager\ndef _suppress_stdout():\n    '''\n    A context manager to temporarily disable stdout.\n\n    Used later when installing a temporary copy of astropy to avoid a\n    very verbose output.\n    '''\n    with open(os.devnull, \"w\") as devnull:\n        old_stdout = sys.stdout\n        sys.stdout = devnull\n        try:\n            yield\n        finally:\n            sys.stdout = old_stdout\n\n\nclass FixRemoteDataOption(type):\n    \"\"\"\n    This metaclass is used to catch cases where the user is running the tests\n    with --remote-data. We've now changed the --remote-data option so that it\n    takes arguments, but we still want --remote-data to work as before and to\n    enable all remote tests. With this metaclass, we can modify sys.argv\n    before setuptools try to parse the command-line options.\n    \"\"\"\n    def __init__(cls, name, bases, dct):\n\n        try:\n            idx = sys.argv.index('--remote-data')\n        except ValueError:\n            pass\n        else:\n            sys.argv[idx] = '--remote-data=any'\n\n        try:\n            idx = sys.argv.index('-R')\n        except ValueError:\n            pass\n        else:\n            sys.argv[idx] = '-R=any'\n\n        return super().__init__(name, bases, dct)\n\n\nclass AstropyTest(Command, metaclass=FixRemoteDataOption):\n    description = 'Run the tests for this package'\n\n    user_options = [\n        ('package=', 'P',\n         \"The name of a specific package to test, e.g. 'io.fits' or 'utils'. \"\n         \"Accepts comma separated string to specify multiple packages. \"\n         \"If nothing is specified, all default tests are run.\"),\n        ('test-path=', 't',\n         'Specify a test location by path.  If a relative path to a  .py file, '\n         'it is relative to the built package, so e.g., a  leading \"astropy/\" '\n         'is necessary.  If a relative  path to a .rst file, it is relative to '\n         'the directory *below* the --docs-path directory, so a leading '\n         '\"docs/\" is usually necessary.  May also be an absolute path.'),\n        ('verbose-results', 'V',\n         'Turn on verbose output from pytest.'),\n        ('plugins=', 'p',\n         'Plugins to enable when running pytest.'),\n        ('pastebin=', 'b',\n         \"Enable pytest pastebin output. Either 'all' or 'failed'.\"),\n        ('args=', 'a',\n         'Additional arguments to be passed to pytest.'),\n        ('remote-data=', 'R', 'Run tests that download remote data. Should be '\n         'one of none/astropy/any (defaults to none).'),\n        ('pep8', '8',\n         'Enable PEP8 checking and disable regular tests. '\n         'Requires the pytest-pep8 plugin.'),\n        ('pdb', 'd',\n         'Start the interactive Python debugger on errors.'),\n        ('coverage', 'c',\n         'Create a coverage report. Requires the coverage package.'),\n        ('open-files', 'o', 'Fail if any tests leave files open.  Requires the '\n         'psutil package.'),\n        ('parallel=', 'j',\n         'Run the tests in parallel on the specified number of '\n         'CPUs.  If \"auto\", all the cores on the machine will be '\n         'used.  Requires the pytest-xdist plugin.'),\n        ('docs-path=', None,\n         'The path to the documentation .rst files.  If not provided, and '\n         'the current directory contains a directory called \"docs\", that '\n         'will be used.'),\n        ('skip-docs', None,\n         \"Don't test the documentation .rst files.\"),\n        ('repeat=', None,\n         'How many times to repeat each test (can be used to check for '\n         'sporadic failures).'),\n        ('temp-root=', None,\n         'The root directory in which to create the temporary testing files. '\n         'If unspecified the system default is used (e.g. /tmp) as explained '\n         'in the documentation for tempfile.mkstemp.'),\n        ('verbose-install', None,\n         'Turn on terminal output from the installation of astropy in a '\n         'temporary folder.'),\n        ('readonly', None,\n         'Make the temporary installation being tested read-only.')\n    ]\n\n    package_name = ''\n\n    def initialize_options(self):\n        self.package = None\n        self.test_path = None\n        self.verbose_results = False\n        self.plugins = None\n        self.pastebin = None\n        self.args = None\n        self.remote_data = 'none'\n        self.pep8 = False\n        self.pdb = False\n        self.coverage = False\n        self.open_files = False\n        self.parallel = 0\n        self.docs_path = None\n        self.skip_docs = False\n        self.repeat = None\n        self.temp_root = None\n        self.verbose_install = False\n        self.readonly = False\n\n    def finalize_options(self):\n        # Normally we would validate the options here, but that's handled in\n        # run_tests\n        pass\n\n    def generate_testing_command(self):\n        \"\"\"\n        Build a Python script to run the tests.\n        \"\"\"\n\n        cmd_pre = ''  # Commands to run before the test function\n        cmd_post = ''  # Commands to run after the test function\n\n        if self.coverage:\n            pre, post = self._generate_coverage_commands()\n            cmd_pre += pre\n            cmd_post += post\n\n        set_flag = \"import builtins; builtins._ASTROPY_TEST_ = True\"\n\n        cmd = ('{cmd_pre}{0}; import {1.package_name}, sys; result = ('\n               '{1.package_name}.test('\n               'package={1.package!r}, '\n               'test_path={1.test_path!r}, '\n               'args={1.args!r}, '\n               'plugins={1.plugins!r}, '\n               'verbose={1.verbose_results!r}, '\n               'pastebin={1.pastebin!r}, '\n               'remote_data={1.remote_data!r}, '\n               'pep8={1.pep8!r}, '\n               'pdb={1.pdb!r}, '\n               'open_files={1.open_files!r}, '\n               'parallel={1.parallel!r}, '\n               'docs_path={1.docs_path!r}, '\n               'skip_docs={1.skip_docs!r}, '\n               'add_local_eggs_to_path=True, '  # see _build_temp_install below\n               'repeat={1.repeat!r})); '\n               '{cmd_post}'\n               'sys.exit(result)')\n        return cmd.format(set_flag, self, cmd_pre=cmd_pre, cmd_post=cmd_post)\n\n    def run(self):\n        \"\"\"\n        Run the tests!\n        \"\"\"\n\n        # Install the runtime dependencies.\n        if self.distribution.install_requires:\n            self.distribution.fetch_build_eggs(self.distribution.install_requires)\n\n        # Ensure there is a doc path\n        if self.docs_path is None:\n            cfg_docs_dir = self.distribution.get_option_dict('build_docs').get('source_dir', None)\n\n            # Some affiliated packages use this.\n            # See astropy/package-template#157\n            if cfg_docs_dir is not None and os.path.exists(cfg_docs_dir[1]):\n                self.docs_path = os.path.abspath(cfg_docs_dir[1])\n\n            # fall back on a default path of \"docs\"\n            elif os.path.exists('docs'):  # pragma: no cover\n                self.docs_path = os.path.abspath('docs')\n\n        # Build a testing install of the package\n        self._build_temp_install()\n\n        # Install the test dependencies\n        # NOTE: we do this here after _build_temp_install because there is\n        # a weird but which occurs if psutil is installed in this way before\n        # astropy is built, Cython can have segmentation fault. Strange, eh?\n        if self.distribution.tests_require:\n            self.distribution.fetch_build_eggs(self.distribution.tests_require)\n\n        # Copy any additional dependencies that may have been installed via\n        # tests_requires or install_requires. We then pass the\n        # add_local_eggs_to_path=True option to package.test() to make sure the\n        # eggs get included in the path.\n        if os.path.exists('.eggs'):\n            shutil.copytree('.eggs', os.path.join(self.testing_path, '.eggs'))\n\n        # This option exists so that we can make sure that the tests don't\n        # write to an installed location.\n        if self.readonly:\n            log.info('changing permissions of temporary installation to read-only')\n            self._change_permissions_testing_path(writable=False)\n\n        # Run everything in a try: finally: so that the tmp dir gets deleted.\n        try:\n            # Construct this modules testing command\n            cmd = self.generate_testing_command()\n\n            # Run the tests in a subprocess--this is necessary since\n            # new extension modules may have appeared, and this is the\n            # easiest way to set up a new environment\n\n            testproc = subprocess.Popen(\n                [sys.executable, '-c', cmd],\n                cwd=self.testing_path, close_fds=False)\n            retcode = testproc.wait()\n        except KeyboardInterrupt:\n            import signal\n            # If a keyboard interrupt is handled, pass it to the test\n            # subprocess to prompt pytest to initiate its teardown\n            testproc.send_signal(signal.SIGINT)\n            retcode = testproc.wait()\n        finally:\n            # Remove temporary directory\n            if self.readonly:\n                self._change_permissions_testing_path(writable=True)\n            shutil.rmtree(self.tmp_dir)\n\n        raise SystemExit(retcode)\n\n    def _build_temp_install(self):\n        \"\"\"\n        Install the package and to a temporary directory for the purposes of\n        testing. This allows us to test the install command, include the\n        entry points, and also avoids creating pyc and __pycache__ directories\n        inside the build directory\n        \"\"\"\n\n        # On OSX the default path for temp files is under /var, but in most\n        # cases on OSX /var is actually a symlink to /private/var; ensure we\n        # dereference that link, because pytest is very sensitive to relative\n        # paths...\n\n        tmp_dir = tempfile.mkdtemp(prefix=self.package_name + '-test-',\n                                   dir=self.temp_root)\n        self.tmp_dir = os.path.realpath(tmp_dir)\n\n        log.info(f'installing to temporary directory: {self.tmp_dir}')\n\n        # We now install the package to the temporary directory. We do this\n        # rather than build and copy because this will ensure that e.g. entry\n        # points work.\n        self.reinitialize_command('install')\n        install_cmd = self.distribution.get_command_obj('install')\n        install_cmd.prefix = self.tmp_dir\n        if self.verbose_install:\n            self.run_command('install')\n        else:\n            with _suppress_stdout():\n                self.run_command('install')\n\n        # We now get the path to the site-packages directory that was created\n        # inside self.tmp_dir\n        install_cmd = self.get_finalized_command('install')\n        self.testing_path = install_cmd.install_lib\n\n        # Ideally, docs_path is set properly in run(), but if it is still\n        # not set here, do not pretend it is, otherwise bad things happen.\n        # See astropy/package-template#157\n        if self.docs_path is not None:\n            new_docs_path = os.path.join(self.testing_path,\n                                         os.path.basename(self.docs_path))\n            shutil.copytree(self.docs_path, new_docs_path)\n            self.docs_path = new_docs_path\n\n        shutil.copy('setup.cfg', self.testing_path)\n\n    def _change_permissions_testing_path(self, writable=False):\n        if writable:\n            basic_flags = stat.S_IRUSR | stat.S_IWUSR\n        else:\n            basic_flags = stat.S_IRUSR\n        for root, dirs, files in os.walk(self.testing_path):\n            for dirname in dirs:\n                os.chmod(os.path.join(root, dirname), basic_flags | stat.S_IXUSR)\n            for filename in files:\n                os.chmod(os.path.join(root, filename), basic_flags)\n\n    def _generate_coverage_commands(self):\n        \"\"\"\n        This method creates the post and pre commands if coverage is to be\n        generated\n        \"\"\"\n        if self.parallel != 0:\n            raise ValueError(\n                \"--coverage can not be used with --parallel\")\n\n        try:\n            import coverage  # pylint: disable=W0611\n        except ImportError:\n            raise ImportError(\n                \"--coverage requires that the coverage package is \"\n                \"installed.\")\n\n        # Don't use get_pkg_data_filename here, because it\n        # requires importing astropy.config and thus screwing\n        # up coverage results for those packages.\n        coveragerc = os.path.join(\n            self.testing_path, self.package_name.replace('.', '/'),\n            'tests', 'coveragerc')\n\n        with open(coveragerc, 'r') as fd:\n            coveragerc_content = fd.read()\n\n        coveragerc_content = coveragerc_content.replace(\n            \"{packagename}\", self.package_name.replace('.', '/'))\n        tmp_coveragerc = os.path.join(self.tmp_dir, 'coveragerc')\n        with open(tmp_coveragerc, 'wb') as tmp:\n            tmp.write(coveragerc_content.encode('utf-8'))\n\n        cmd_pre = (\n            'import coverage; '\n            'cov = coverage.coverage(data_file=r\"{}\", config_file=r\"{}\"); '\n            'cov.start();'.format(\n                os.path.abspath(\".coverage\"), os.path.abspath(tmp_coveragerc)))\n        cmd_post = (\n            'cov.stop(); '\n            'from astropy.tests.helper import _save_coverage; '\n            '_save_coverage(cov, result, r\"{}\", r\"{}\");'.format(\n                os.path.abspath('.'), os.path.abspath(self.testing_path)))\n\n        return cmd_pre, cmd_post\n"},{"fileName":"__init__.py","filePath":"astropy/tests","id":9608,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis package contains utilities to run the astropy test suite, tools\nfor writing tests, and general tests that are not associated with a\nparticular package.\n\"\"\"\n"},{"className":"AstropyPendingDeprecationWarning","col":0,"comment":"\n    A warning class to indicate a soon-to-be deprecated feature.\n    ","endLoc":49,"id":9609,"nodeType":"Class","startLoc":46,"text":"class AstropyPendingDeprecationWarning(PendingDeprecationWarning, AstropyWarning):\n    \"\"\"\n    A warning class to indicate a soon-to-be deprecated feature.\n    \"\"\""},{"col":0,"comment":"","endLoc":6,"header":"__init__.py#<anonymous>","id":9610,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis package contains utilities to run the astropy test suite, tools\nfor writing tests, and general tests that are not associated with a\nparticular package.\n\"\"\""},{"fileName":"image_tests.py","filePath":"astropy/tests","id":9611,"nodeType":"File","text":"try:\n    import matplotlib\n    from matplotlib import pyplot as plt  # noqa\nexcept ImportError:\n    MPL_VERSION = ''\n    ROOT = ''\n    IMAGE_REFERENCE_DIR = ''\nelse:\n    MPL_VERSION = matplotlib.__version__\n\n    # The developer versions of the form 3.2.x+... contain changes that will only\n    # be included in the 3.3.x release, so we update this here.\n    if MPL_VERSION[:3] == '3.2' and '+' in MPL_VERSION:\n        MPL_VERSION = '3.3'\n\n    ROOT = \"http://{server}/testing/astropy/2021-08-25T18:18:36.000000/{mpl_version}/\"\n    IMAGE_REFERENCE_DIR = (\n        ROOT.format(server='data.astropy.org', mpl_version=MPL_VERSION[:3] + '.x') + ',' +\n        ROOT.format(server='www.astropy.org/astropy-data', mpl_version=MPL_VERSION[:3] + '.x'))\n"},{"attributeType":"null","col":37,"comment":"null","endLoc":3,"id":9612,"name":"plt","nodeType":"Attribute","startLoc":3,"text":"plt"},{"className":"raises","col":0,"comment":"\n    A decorator to mark that a test should raise a given exception.\n    Use as follows::\n\n        @raises(ZeroDivisionError)\n        def test_foo():\n            x = 1/0\n\n    This can also be used a context manager, in which case it is just\n    an alias for the ``pytest.raises`` context manager (because the\n    two have the same name this help avoid confusion by being\n    flexible).\n\n    .. note:: Usage of ``pytest.raises`` is preferred.\n\n    ","endLoc":103,"id":9613,"nodeType":"Class","startLoc":68,"text":"@deprecated('5.1', alternative='pytest.raises')\nclass raises:\n    \"\"\"\n    A decorator to mark that a test should raise a given exception.\n    Use as follows::\n\n        @raises(ZeroDivisionError)\n        def test_foo():\n            x = 1/0\n\n    This can also be used a context manager, in which case it is just\n    an alias for the ``pytest.raises`` context manager (because the\n    two have the same name this help avoid confusion by being\n    flexible).\n\n    .. note:: Usage of ``pytest.raises`` is preferred.\n\n    \"\"\"\n\n    # pep-8 naming exception -- this is a decorator class\n    def __init__(self, exc):\n        self._exc = exc\n        self._ctx = None\n\n    def __call__(self, func):\n        @functools.wraps(func)\n        def run_raises_test(*args, **kwargs):\n            pytest.raises(self._exc, func, *args, **kwargs)\n        return run_raises_test\n\n    def __enter__(self):\n        self._ctx = pytest.raises(self._exc)\n        return self._ctx.__enter__()\n\n    def __exit__(self, *exc_info):\n        return self._ctx.__exit__(*exc_info)"},{"attributeType":"null","col":4,"comment":"null","endLoc":5,"id":9614,"name":"MPL_VERSION","nodeType":"Attribute","startLoc":5,"text":"MPL_VERSION"},{"col":4,"comment":"null","endLoc":90,"header":"def __init__(self, exc)","id":9615,"name":"__init__","nodeType":"Function","startLoc":88,"text":"def __init__(self, exc):\n        self._exc = exc\n        self._ctx = None"},{"col":4,"comment":"null","endLoc":96,"header":"def __call__(self, func)","id":9616,"name":"__call__","nodeType":"Function","startLoc":92,"text":"def __call__(self, func):\n        @functools.wraps(func)\n        def run_raises_test(*args, **kwargs):\n            pytest.raises(self._exc, func, *args, **kwargs)\n        return run_raises_test"},{"attributeType":"null","col":4,"comment":"null","endLoc":6,"id":9617,"name":"ROOT","nodeType":"Attribute","startLoc":6,"text":"ROOT"},{"attributeType":"null","col":4,"comment":"null","endLoc":7,"id":9618,"name":"IMAGE_REFERENCE_DIR","nodeType":"Attribute","startLoc":7,"text":"IMAGE_REFERENCE_DIR"},{"attributeType":"null","col":4,"comment":"null","endLoc":9,"id":9619,"name":"MPL_VERSION","nodeType":"Attribute","startLoc":9,"text":"MPL_VERSION"},{"attributeType":"null","col":8,"comment":"null","endLoc":14,"id":9620,"name":"MPL_VERSION","nodeType":"Attribute","startLoc":14,"text":"MPL_VERSION"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":9621,"name":"ROOT","nodeType":"Attribute","startLoc":16,"text":"ROOT"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":9622,"name":"IMAGE_REFERENCE_DIR","nodeType":"Attribute","startLoc":17,"text":"IMAGE_REFERENCE_DIR"},{"col":0,"comment":"","endLoc":19,"header":"image_tests.py#<anonymous>","id":9623,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"try:\n    import matplotlib\n    from matplotlib import pyplot as plt  # noqa\nexcept ImportError:\n    MPL_VERSION = ''\n    ROOT = ''\n    IMAGE_REFERENCE_DIR = ''\nelse:\n    MPL_VERSION = matplotlib.__version__\n\n    # The developer versions of the form 3.2.x+... contain changes that will only\n    # be included in the 3.3.x release, so we update this here.\n    if MPL_VERSION[:3] == '3.2' and '+' in MPL_VERSION:\n        MPL_VERSION = '3.3'\n\n    ROOT = \"http://{server}/testing/astropy/2021-08-25T18:18:36.000000/{mpl_version}/\"\n    IMAGE_REFERENCE_DIR = (\n        ROOT.format(server='data.astropy.org', mpl_version=MPL_VERSION[:3] + '.x') + ',' +\n        ROOT.format(server='www.astropy.org/astropy-data', mpl_version=MPL_VERSION[:3] + '.x'))"},{"fileName":"runner.py","filePath":"astropy/tests","id":9624,"nodeType":"File","text":"\"\"\"Implements the Astropy TestRunner which is a thin wrapper around pytest.\"\"\"\n\nimport inspect\nimport os\nimport glob\nimport copy\nimport shlex\nimport sys\nimport tempfile\nimport warnings\nfrom collections import OrderedDict\nfrom importlib.util import find_spec\nfrom functools import wraps\n\nfrom astropy.config.paths import set_temp_config, set_temp_cache\nfrom astropy.utils import find_current_module\nfrom astropy.utils.exceptions import AstropyWarning, AstropyDeprecationWarning\n\n__all__ = ['TestRunner', 'TestRunnerBase', 'keyword']\n\n\nclass keyword:\n    \"\"\"\n    A decorator to mark a method as keyword argument for the ``TestRunner``.\n\n    Parameters\n    ----------\n    default_value : `object`\n        The default value for the keyword argument. (Default: `None`)\n\n    priority : `int`\n        keyword argument methods are executed in order of descending priority.\n    \"\"\"\n\n    def __init__(self, default_value=None, priority=0):\n        self.default_value = default_value\n        self.priority = priority\n\n    def __call__(self, f):\n        def keyword(*args, **kwargs):\n            return f(*args, **kwargs)\n\n        keyword._default_value = self.default_value\n        keyword._priority = self.priority\n        # Set __doc__ explicitly here rather than using wraps because we want\n        # to keep the function name as keyword so we can inspect it later.\n        keyword.__doc__ = f.__doc__\n\n        return keyword\n\n\nclass TestRunnerBase:\n    \"\"\"\n    The base class for the TestRunner.\n\n    A test runner can be constructed by creating a subclass of this class and\n    defining 'keyword' methods. These are methods that have the\n    :class:`~astropy.tests.runner.keyword` decorator, these methods are used to\n    construct allowed keyword arguments to the\n    ``run_tests`` method as a way to allow\n    customization of individual keyword arguments (and associated logic)\n    without having to re-implement the whole\n    ``run_tests`` method.\n\n    Examples\n    --------\n\n    A simple keyword method::\n\n        class MyRunner(TestRunnerBase):\n\n            @keyword('default_value'):\n            def spam(self, spam, kwargs):\n                \\\"\\\"\\\"\n                spam : `str`\n                    The parameter description for the run_tests docstring.\n                \\\"\\\"\\\"\n                # Return value must be a list with a CLI parameter for pytest.\n                return ['--spam={}'.format(spam)]\n    \"\"\"\n\n    def __init__(self, base_path):\n        self.base_path = os.path.abspath(base_path)\n\n    def __new__(cls, *args, **kwargs):\n        # Before constructing the class parse all the methods that have been\n        # decorated with ``keyword``.\n\n        # The objective of this method is to construct a default set of keyword\n        # arguments to the ``run_tests`` method. It does this by inspecting the\n        # methods of the class for functions with the name ``keyword`` which is\n        # the name of the decorator wrapping function. Once it has created this\n        # dictionary, it also formats the docstring of ``run_tests`` to be\n        # comprised of the docstrings for the ``keyword`` methods.\n\n        # To add a keyword argument to the ``run_tests`` method, define a new\n        # method decorated with ``@keyword`` and with the ``self, name, kwargs``\n        # signature.\n        # Get all 'function' members as the wrapped methods are functions\n        functions = inspect.getmembers(cls, predicate=inspect.isfunction)\n\n        # Filter out anything that's not got the name 'keyword'\n        keywords = filter(lambda func: func[1].__name__ == 'keyword', functions)\n        # Sort all keywords based on the priority flag.\n        sorted_keywords = sorted(keywords, key=lambda x: x[1]._priority, reverse=True)\n\n        cls.keywords = OrderedDict()\n        doc_keywords = \"\"\n        for name, func in sorted_keywords:\n            # Here we test if the function has been overloaded to return\n            # NotImplemented which is the way to disable arguments on\n            # subclasses. If it has been disabled we need to remove it from the\n            # default keywords dict. We do it in the try except block because\n            # we do not have access to an instance of the class, so this is\n            # going to error unless the method is just doing `return\n            # NotImplemented`.\n            try:\n                # Second argument is False, as it is normally a bool.\n                # The other two are placeholders for objects.\n                if func(None, False, None) is NotImplemented:\n                    continue\n            except Exception:\n                pass\n\n            # Construct the default kwargs dict and docstring\n            cls.keywords[name] = func._default_value\n            if func.__doc__:\n                doc_keywords += ' '*8\n                doc_keywords += func.__doc__.strip()\n                doc_keywords += '\\n\\n'\n\n        cls.run_tests.__doc__ = cls.RUN_TESTS_DOCSTRING.format(keywords=doc_keywords)\n\n        return super().__new__(cls)\n\n    def _generate_args(self, **kwargs):\n        # Update default values with passed kwargs\n        # but don't modify the defaults\n        keywords = copy.deepcopy(self.keywords)\n        keywords.update(kwargs)\n        # Iterate through the keywords (in order of priority)\n        args = []\n        for keyword in keywords.keys():\n            func = getattr(self, keyword)\n            result = func(keywords[keyword], keywords)\n\n            # Allow disabling of options in a subclass\n            if result is NotImplemented:\n                raise TypeError(f\"run_tests() got an unexpected keyword argument {keyword}\")\n\n            # keyword methods must return a list\n            if not isinstance(result, list):\n                raise TypeError(f\"{keyword} keyword method must return a list\")\n\n            args += result\n\n        return args\n\n    RUN_TESTS_DOCSTRING = \\\n        \"\"\"\n        Run the tests for the package.\n\n        This method builds arguments for and then calls ``pytest.main``.\n\n        Parameters\n        ----------\n{keywords}\n\n        \"\"\"\n\n    _required_dependencies = ['pytest', 'pytest_remotedata', 'pytest_doctestplus', 'pytest_astropy_header']\n    _missing_dependancy_error = (\n        \"Test dependencies are missing: {module}. You should install the \"\n        \"'pytest-astropy' package (you may need to update the package if you \"\n        \"have a previous version installed, e.g., \"\n        \"'pip install pytest-astropy --upgrade' or the equivalent with conda).\")\n\n    @classmethod\n    def _has_test_dependencies(cls):  # pragma: no cover\n        # Using the test runner will not work without these dependencies, but\n        # pytest-openfiles is optional, so it's not listed here.\n        for module in cls._required_dependencies:\n            spec = find_spec(module)\n            # Checking loader accounts for packages that were uninstalled\n            if spec is None or spec.loader is None:\n                raise RuntimeError(\n                    cls._missing_dependancy_error.format(module=module))\n\n    def run_tests(self, **kwargs):\n        # The following option will include eggs inside a .eggs folder in\n        # sys.path when running the tests. This is possible so that when\n        # running pytest, test dependencies installed via e.g.\n        # tests_requires are available here. This is not an advertised option\n        # since it is only for internal use\n        if kwargs.pop('add_local_eggs_to_path', False):\n\n            # Add each egg to sys.path individually\n            for egg in glob.glob(os.path.join('.eggs', '*.egg')):\n                sys.path.insert(0, egg)\n\n        self._has_test_dependencies()  # pragma: no cover\n\n        # The docstring for this method is defined as a class variable.\n        # This allows it to be built for each subclass in __new__.\n\n        # Don't import pytest until it's actually needed to run the tests\n        import pytest\n\n        # Raise error for undefined kwargs\n        allowed_kwargs = set(self.keywords.keys())\n        passed_kwargs = set(kwargs.keys())\n        if not passed_kwargs.issubset(allowed_kwargs):\n            wrong_kwargs = list(passed_kwargs.difference(allowed_kwargs))\n            raise TypeError(f\"run_tests() got an unexpected keyword argument {wrong_kwargs[0]}\")\n\n        args = self._generate_args(**kwargs)\n\n        if kwargs.get('plugins', None) is not None:\n            plugins = kwargs.pop('plugins')\n        elif self.keywords.get('plugins', None) is not None:\n            plugins = self.keywords['plugins']\n        else:\n            plugins = []\n\n        # Override the config locations to not make a new directory nor use\n        # existing cache or config. Note that we need to do this here in\n        # addition to in conftest.py - for users running tests interactively\n        # in e.g. IPython, conftest.py would get read in too late, so we need\n        # to do it here - but at the same time the code here doesn't work when\n        # running tests in parallel mode because this uses subprocesses which\n        # don't know about the temporary config/cache.\n        astropy_config = tempfile.mkdtemp('astropy_config')\n        astropy_cache = tempfile.mkdtemp('astropy_cache')\n\n        # Have to use nested with statements for cross-Python support\n        # Note, using these context managers here is superfluous if the\n        # config_dir or cache_dir options to pytest are in use, but it's\n        # also harmless to nest the contexts\n        with set_temp_config(astropy_config, delete=True):\n            with set_temp_cache(astropy_cache, delete=True):\n                return pytest.main(args=args, plugins=plugins)\n\n    @classmethod\n    def make_test_runner_in(cls, path):\n        \"\"\"\n        Constructs a `TestRunner` to run in the given path, and returns a\n        ``test()`` function which takes the same arguments as\n        ``TestRunner.run_tests``.\n\n        The returned ``test()`` function will be defined in the module this\n        was called from.  This is used to implement the ``astropy.test()``\n        function (or the equivalent for affiliated packages).\n        \"\"\"\n\n        runner = cls(path)\n\n        @wraps(runner.run_tests, ('__doc__',))\n        def test(**kwargs):\n            return runner.run_tests(**kwargs)\n\n        module = find_current_module(2)\n        if module is not None:\n            test.__module__ = module.__name__\n\n        # A somewhat unusual hack, but delete the attached __wrapped__\n        # attribute--although this is normally used to tell if the function\n        # was wrapped with wraps, on some version of Python this is also\n        # used to determine the signature to display in help() which is\n        # not useful in this case.  We don't really care in this case if the\n        # function was wrapped either\n        if hasattr(test, '__wrapped__'):\n            del test.__wrapped__\n\n        test.__test__ = False\n        return test\n\n\nclass TestRunner(TestRunnerBase):\n    \"\"\"\n    A test runner for astropy tests\n    \"\"\"\n\n    def packages_path(self, packages, base_path, error=None, warning=None):\n        \"\"\"\n        Generates the path for multiple packages.\n\n        Parameters\n        ----------\n        packages : str\n            Comma separated string of packages.\n        base_path : str\n            Base path to the source code or documentation.\n        error : str\n            Error message to be raised as ``ValueError``. Individual package\n            name and path can be accessed by ``{name}`` and ``{path}``\n            respectively. No error is raised if `None`. (Default: `None`)\n        warning : str\n            Warning message to be issued. Individual package\n            name and path can be accessed by ``{name}`` and ``{path}``\n            respectively. No warning is issues if `None`. (Default: `None`)\n\n        Returns\n        -------\n        paths : list of str\n            List of strings of existing package paths.\n        \"\"\"\n        packages = packages.split(\",\")\n\n        paths = []\n        for package in packages:\n            path = os.path.join(\n                base_path, package.replace('.', os.path.sep))\n            if not os.path.isdir(path):\n                info = {'name': package, 'path': path}\n                if error is not None:\n                    raise ValueError(error.format(**info))\n                if warning is not None:\n                    warnings.warn(warning.format(**info))\n            else:\n                paths.append(path)\n\n        return paths\n\n    # Increase priority so this warning is displayed first.\n    @keyword(priority=1000)\n    def coverage(self, coverage, kwargs):\n        if coverage:\n            warnings.warn(\n                \"The coverage option is ignored on run_tests, since it \"\n                \"can not be made to work in that context.  Use \"\n                \"'python setup.py test --coverage' instead.\",\n                AstropyWarning)\n\n        return []\n\n    # test_path depends on self.package_path so make sure this runs before\n    # test_path.\n    @keyword(priority=1)\n    def package(self, package, kwargs):\n        \"\"\"\n        package : str, optional\n            The name of a specific package to test, e.g. 'io.fits' or\n            'utils'. Accepts comma separated string to specify multiple\n            packages. If nothing is specified all default tests are run.\n        \"\"\"\n        if package is None:\n            self.package_path = [self.base_path]\n        else:\n            error_message = ('package to test is not found: {name} '\n                             '(at path {path}).')\n            self.package_path = self.packages_path(package, self.base_path,\n                                                   error=error_message)\n\n        if not kwargs['test_path']:\n            return self.package_path\n\n        return []\n\n    @keyword()\n    def test_path(self, test_path, kwargs):\n        \"\"\"\n        test_path : str, optional\n            Specify location to test by path. May be a single file or\n            directory. Must be specified absolutely or relative to the\n            calling directory.\n        \"\"\"\n        all_args = []\n        # Ensure that the package kwarg has been run.\n        self.package(kwargs['package'], kwargs)\n        if test_path:\n            base, ext = os.path.splitext(test_path)\n\n            if ext in ('.rst', ''):\n                if kwargs['docs_path'] is None:\n                    # This shouldn't happen from \"python setup.py test\"\n                    raise ValueError(\n                        \"Can not test .rst files without a docs_path \"\n                        \"specified.\")\n\n                abs_docs_path = os.path.abspath(kwargs['docs_path'])\n                abs_test_path = os.path.abspath(\n                    os.path.join(abs_docs_path, os.pardir, test_path))\n\n                common = os.path.commonprefix((abs_docs_path, abs_test_path))\n\n                if os.path.exists(abs_test_path) and common == abs_docs_path:\n                    # Turn on the doctest_rst plugin\n                    all_args.append('--doctest-rst')\n                    test_path = abs_test_path\n\n            # Check that the extensions are in the path and not at the end to\n            # support specifying the name of the test, i.e.\n            # test_quantity.py::test_unit\n            if not (os.path.isdir(test_path) or ('.py' in test_path or '.rst' in test_path)):\n                raise ValueError(\"Test path must be a directory or a path to \"\n                                 \"a .py or .rst file\")\n\n            return all_args + [test_path]\n\n        return []\n\n    @keyword()\n    def args(self, args, kwargs):\n        \"\"\"\n        args : str, optional\n            Additional arguments to be passed to ``pytest.main`` in the ``args``\n            keyword argument.\n        \"\"\"\n        if args:\n            return shlex.split(args, posix=not sys.platform.startswith('win'))\n\n        return []\n\n    @keyword(default_value=[])\n    def plugins(self, plugins, kwargs):\n        \"\"\"\n        plugins : list, optional\n            Plugins to be passed to ``pytest.main`` in the ``plugins`` keyword\n            argument.\n        \"\"\"\n        # Plugins are handled independently by `run_tests` so we define this\n        # keyword just for the docstring\n        return []\n\n    @keyword()\n    def verbose(self, verbose, kwargs):\n        \"\"\"\n        verbose : bool, optional\n            Convenience option to turn on verbose output from pytest. Passing\n            True is the same as specifying ``-v`` in ``args``.\n        \"\"\"\n        if verbose:\n            return ['-v']\n\n        return []\n\n    @keyword()\n    def pastebin(self, pastebin, kwargs):\n        \"\"\"\n        pastebin : ('failed', 'all', None), optional\n            Convenience option for turning on pytest pastebin output. Set to\n            'failed' to upload info for failed tests, or 'all' to upload info\n            for all tests.\n        \"\"\"\n        if pastebin is not None:\n            if pastebin in ['failed', 'all']:\n                return [f'--pastebin={pastebin}']\n            else:\n                raise ValueError(\"pastebin should be 'failed' or 'all'\")\n\n        return []\n\n    @keyword(default_value='none')\n    def remote_data(self, remote_data, kwargs):\n        \"\"\"\n        remote_data : {'none', 'astropy', 'any'}, optional\n            Controls whether to run tests marked with @pytest.mark.remote_data. This can be\n            set to run no tests with remote data (``none``), only ones that use\n            data from http://data.astropy.org (``astropy``), or all tests that\n            use remote data (``any``). The default is ``none``.\n        \"\"\"\n\n        if remote_data is True:\n            remote_data = 'any'\n        elif remote_data is False:\n            remote_data = 'none'\n        elif remote_data not in ('none', 'astropy', 'any'):\n            warnings.warn(\"The remote_data option should be one of \"\n                          \"none/astropy/any (found {}). For backward-compatibility, \"\n                          \"assuming 'any', but you should change the option to be \"\n                          \"one of the supported ones to avoid issues in \"\n                          \"future.\".format(remote_data),\n                          AstropyDeprecationWarning)\n            remote_data = 'any'\n\n        return [f'--remote-data={remote_data}']\n\n    @keyword()\n    def pep8(self, pep8, kwargs):\n        \"\"\"\n        pep8 : bool, optional\n            Turn on PEP8 checking via the pytest-pep8 plugin and disable normal\n            tests. Same as specifying ``--pep8 -k pep8`` in ``args``.\n        \"\"\"\n        if pep8:\n            try:\n                import pytest_pep8  # pylint: disable=W0611\n            except ImportError:\n                raise ImportError('PEP8 checking requires pytest-pep8 plugin: '\n                                  'https://pypi.org/project/pytest-pep8')\n            else:\n                return ['--pep8', '-k', 'pep8']\n\n        return []\n\n    @keyword()\n    def pdb(self, pdb, kwargs):\n        \"\"\"\n        pdb : bool, optional\n            Turn on PDB post-mortem analysis for failing tests. Same as\n            specifying ``--pdb`` in ``args``.\n        \"\"\"\n        if pdb:\n            return ['--pdb']\n        return []\n\n    @keyword()\n    def open_files(self, open_files, kwargs):\n        \"\"\"\n        open_files : bool, optional\n            Fail when any tests leave files open.  Off by default, because\n            this adds extra run time to the test suite.  Requires the\n            ``psutil`` package.\n        \"\"\"\n        if open_files:\n            if kwargs['parallel'] != 0:\n                raise SystemError(\n                    \"open file detection may not be used in conjunction with \"\n                    \"parallel testing.\")\n\n            try:\n                import psutil  # pylint: disable=W0611\n            except ImportError:\n                raise SystemError(\n                    \"open file detection requested, but psutil package \"\n                    \"is not installed.\")\n\n            return ['--open-files']\n\n            print(\"Checking for unclosed files\")\n\n        return []\n\n    @keyword(0)\n    def parallel(self, parallel, kwargs):\n        \"\"\"\n        parallel : int or 'auto', optional\n            When provided, run the tests in parallel on the specified\n            number of CPUs.  If parallel is ``'auto'``, it will use the all\n            the cores on the machine.  Requires the ``pytest-xdist`` plugin.\n        \"\"\"\n        if parallel != 0:\n            try:\n                from xdist import plugin # noqa\n            except ImportError:\n                raise SystemError(\n                    \"running tests in parallel requires the pytest-xdist package\")\n\n            return ['-n', str(parallel)]\n\n        return []\n\n    @keyword()\n    def docs_path(self, docs_path, kwargs):\n        \"\"\"\n        docs_path : str, optional\n            The path to the documentation .rst files.\n        \"\"\"\n\n        paths = []\n        if docs_path is not None and not kwargs['skip_docs']:\n            if kwargs['package'] is not None:\n                warning_message = (\"Can not test .rst docs for {name}, since \"\n                                   \"docs path ({path}) does not exist.\")\n                paths = self.packages_path(kwargs['package'], docs_path,\n                                           warning=warning_message)\n            elif not kwargs['test_path']:\n                paths = [docs_path, ]\n\n            if len(paths) and not kwargs['test_path']:\n                paths.append('--doctest-rst')\n\n        return paths\n\n    @keyword()\n    def skip_docs(self, skip_docs, kwargs):\n        \"\"\"\n        skip_docs : `bool`, optional\n            When `True`, skips running the doctests in the .rst files.\n        \"\"\"\n        # Skip docs is a bool used by docs_path only.\n        return []\n\n    @keyword()\n    def repeat(self, repeat, kwargs):\n        \"\"\"\n        repeat : `int`, optional\n            If set, specifies how many times each test should be run. This is\n            useful for diagnosing sporadic failures.\n        \"\"\"\n        if repeat:\n            return [f'--repeat={repeat}']\n\n        return []\n\n    # Override run_tests for astropy-specific fixes\n    def run_tests(self, **kwargs):\n\n        # This prevents cyclical import problems that make it\n        # impossible to test packages that define Table types on their\n        # own.\n        from astropy.table import Table  # pylint: disable=W0611\n\n        return super().run_tests(**kwargs)\n"},{"className":"set_temp_cache","col":0,"comment":"\n    Context manager to set a temporary path for the Astropy download cache,\n    primarily for use with testing (though there may be other applications\n    for setting a different cache directory, for example to switch to a cache\n    dedicated to large files).\n\n    If the path set by this context manager does not already exist it will be\n    created, if possible.\n\n    This may also be used as a decorator on a function to set the cache path\n    just within that function.\n\n    Parameters\n    ----------\n\n    path : str\n        The directory (which must exist) in which to find the Astropy cache\n        files, or create them if they do not already exist.  If None, this\n        restores the cache path to the user's default cache path as returned\n        by `get_cache_dir` as though this context manager were not in effect\n        (this is useful for testing).  In this case the ``delete`` argument is\n        always ignored.\n\n    delete : bool, optional\n        If True, cleans up the temporary directory after exiting the temp\n        context (default: False).\n    ","endLoc":286,"id":9625,"nodeType":"Class","startLoc":257,"text":"class set_temp_cache(_SetTempPath):\n    \"\"\"\n    Context manager to set a temporary path for the Astropy download cache,\n    primarily for use with testing (though there may be other applications\n    for setting a different cache directory, for example to switch to a cache\n    dedicated to large files).\n\n    If the path set by this context manager does not already exist it will be\n    created, if possible.\n\n    This may also be used as a decorator on a function to set the cache path\n    just within that function.\n\n    Parameters\n    ----------\n\n    path : str\n        The directory (which must exist) in which to find the Astropy cache\n        files, or create them if they do not already exist.  If None, this\n        restores the cache path to the user's default cache path as returned\n        by `get_cache_dir` as though this context manager were not in effect\n        (this is useful for testing).  In this case the ``delete`` argument is\n        always ignored.\n\n    delete : bool, optional\n        If True, cleans up the temporary directory after exiting the temp\n        context (default: False).\n    \"\"\"\n\n    _default_path_getter = staticmethod(get_cache_dir)"},{"attributeType":"null","col":4,"comment":"null","endLoc":286,"id":9626,"name":"_default_path_getter","nodeType":"Attribute","startLoc":286,"text":"_default_path_getter"},{"col":4,"comment":"null","endLoc":100,"header":"def __enter__(self)","id":9627,"name":"__enter__","nodeType":"Function","startLoc":98,"text":"def __enter__(self):\n        self._ctx = pytest.raises(self._exc)\n        return self._ctx.__enter__()"},{"className":"keyword","col":0,"comment":"\n    A decorator to mark a method as keyword argument for the ``TestRunner``.\n\n    Parameters\n    ----------\n    default_value : `object`\n        The default value for the keyword argument. (Default: `None`)\n\n    priority : `int`\n        keyword argument methods are executed in order of descending priority.\n    ","endLoc":49,"id":9628,"nodeType":"Class","startLoc":22,"text":"class keyword:\n    \"\"\"\n    A decorator to mark a method as keyword argument for the ``TestRunner``.\n\n    Parameters\n    ----------\n    default_value : `object`\n        The default value for the keyword argument. (Default: `None`)\n\n    priority : `int`\n        keyword argument methods are executed in order of descending priority.\n    \"\"\"\n\n    def __init__(self, default_value=None, priority=0):\n        self.default_value = default_value\n        self.priority = priority\n\n    def __call__(self, f):\n        def keyword(*args, **kwargs):\n            return f(*args, **kwargs)\n\n        keyword._default_value = self.default_value\n        keyword._priority = self.priority\n        # Set __doc__ explicitly here rather than using wraps because we want\n        # to keep the function name as keyword so we can inspect it later.\n        keyword.__doc__ = f.__doc__\n\n        return keyword"},{"col":4,"comment":"null","endLoc":49,"header":"def __call__(self, f)","id":9629,"name":"__call__","nodeType":"Function","startLoc":39,"text":"def __call__(self, f):\n        def keyword(*args, **kwargs):\n            return f(*args, **kwargs)\n\n        keyword._default_value = self.default_value\n        keyword._priority = self.priority\n        # Set __doc__ explicitly here rather than using wraps because we want\n        # to keep the function name as keyword so we can inspect it later.\n        keyword.__doc__ = f.__doc__\n\n        return keyword"},{"attributeType":"null","col":8,"comment":"null","endLoc":36,"id":9630,"name":"default_value","nodeType":"Attribute","startLoc":36,"text":"self.default_value"},{"className":"MyRow","col":0,"comment":"null","endLoc":42,"id":9631,"nodeType":"Class","startLoc":41,"text":"class MyRow(table.Row):\n    pass"},{"attributeType":"null","col":8,"comment":"null","endLoc":37,"id":9632,"name":"priority","nodeType":"Attribute","startLoc":37,"text":"self.priority"},{"className":"MyColumn","col":0,"comment":"null","endLoc":46,"id":9633,"nodeType":"Class","startLoc":45,"text":"class MyColumn(table.Column):\n    pass"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":9634,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"col":0,"comment":"","endLoc":1,"header":"runner.py#<anonymous>","id":9635,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"Implements the Astropy TestRunner which is a thin wrapper around pytest.\"\"\"\n\n__all__ = ['TestRunner', 'TestRunnerBase', 'keyword']"},{"className":"MyMaskedColumn","col":0,"comment":"null","endLoc":50,"id":9636,"nodeType":"Class","startLoc":49,"text":"class MyMaskedColumn(table.MaskedColumn):\n    pass"},{"className":"MyTableColumns","col":0,"comment":"null","endLoc":54,"id":9637,"nodeType":"Class","startLoc":53,"text":"class MyTableColumns(table.TableColumns):\n    pass"},{"className":"MyTableFormatter","col":0,"comment":"null","endLoc":58,"id":9638,"nodeType":"Class","startLoc":57,"text":"class MyTableFormatter(pprint.TableFormatter):\n    pass"},{"id":9639,"name":"astropy/tests/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/tests/tests","id":9640,"nodeType":"File","text":""},{"className":"MyTable","col":0,"comment":"null","endLoc":66,"id":9641,"nodeType":"Class","startLoc":61,"text":"class MyTable(table.Table):\n    Row = MyRow\n    Column = MyColumn\n    MaskedColumn = MyMaskedColumn\n    TableColumns = MyTableColumns\n    TableFormatter = MyTableFormatter"},{"id":9642,"name":"astropy/units","nodeType":"Package"},{"fileName":"deprecated.py","filePath":"astropy/units","id":9643,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis package defines deprecated units.\n\nThese units are not available in the top-level `astropy.units`\nnamespace. To use these units, you must import the `astropy.units.deprecated`\nmodule::\n\n    >>> from astropy.units import deprecated\n    >>> q = 10. * deprecated.emu  # doctest: +SKIP\n\nTo include them in `~astropy.units.UnitBase.compose` and the results of\n`~astropy.units.UnitBase.find_equivalent_units`, do::\n\n    >>> from astropy.units import deprecated\n    >>> deprecated.enable()  # doctest: +SKIP\n\n\"\"\"\n\n_ns = globals()\n\n\ndef _initialize_module():\n    # Local imports to avoid polluting top-level namespace\n    from . import cgs\n    from . import astrophys\n    from .core import def_unit, _add_prefixes\n\n    def_unit(['emu'], cgs.Bi, namespace=_ns,\n             doc='Biot: CGS (EMU) unit of current')\n\n    # Add only some *prefixes* as deprecated units.\n    _add_prefixes(astrophys.jupiterMass, namespace=_ns, prefixes=True)\n    _add_prefixes(astrophys.earthMass, namespace=_ns, prefixes=True)\n    _add_prefixes(astrophys.jupiterRad, namespace=_ns, prefixes=True)\n    _add_prefixes(astrophys.earthRad, namespace=_ns, prefixes=True)\n\n\n_initialize_module()\n\n\n###########################################################################\n# DOCSTRING\n\n# This generates a docstring for this module that describes all of the\n# standard units defined here.\nfrom .utils import (generate_unit_summary as _generate_unit_summary,\n                    generate_prefixonly_unit_summary as _generate_prefixonly_unit_summary)\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())\n    __doc__ += _generate_prefixonly_unit_summary(globals())\n\n\ndef enable():\n    \"\"\"\n    Enable deprecated units so they appear in results of\n    `~astropy.units.UnitBase.find_equivalent_units` and\n    `~astropy.units.UnitBase.compose`.\n\n    This may be used with the ``with`` statement to enable deprecated\n    units only temporarily.\n    \"\"\"\n    # Local import to avoid cyclical import\n    from .core import add_enabled_units\n    # Local import to avoid polluting namespace\n    import inspect\n    return add_enabled_units(inspect.getmodule(enable))\n"},{"col":0,"comment":"\n    Generates a summary of units from a given namespace.  This is used\n    to generate the docstring for the modules that define the actual\n    units.\n\n    Parameters\n    ----------\n    namespace : dict\n        A namespace containing units.\n\n    Returns\n    -------\n    docstring : str\n        A docstring containing a summary table of the units.\n    ","endLoc":117,"header":"def generate_unit_summary(namespace)","id":9644,"name":"generate_unit_summary","nodeType":"Function","startLoc":77,"text":"def generate_unit_summary(namespace):\n    \"\"\"\n    Generates a summary of units from a given namespace.  This is used\n    to generate the docstring for the modules that define the actual\n    units.\n\n    Parameters\n    ----------\n    namespace : dict\n        A namespace containing units.\n\n    Returns\n    -------\n    docstring : str\n        A docstring containing a summary table of the units.\n    \"\"\"\n\n    docstring = io.StringIO()\n\n    docstring.write(\"\"\"\n.. list-table:: Available Units\n   :header-rows: 1\n   :widths: 10 20 20 20 1\n\n   * - Unit\n     - Description\n     - Represents\n     - Aliases\n     - SI Prefixes\n\"\"\")\n\n    for unit_summary in _iter_unit_summary(namespace):\n        docstring.write(\"\"\"\n   * - ``{}``\n     - {}\n     - {}\n     - {}\n     - {}\n\"\"\".format(*unit_summary))\n\n    return docstring.getvalue()"},{"attributeType":"MyRow","col":4,"comment":"null","endLoc":62,"id":9645,"name":"Row","nodeType":"Attribute","startLoc":62,"text":"Row"},{"col":4,"comment":"null","endLoc":103,"header":"def __exit__(self, *exc_info)","id":9646,"name":"__exit__","nodeType":"Function","startLoc":102,"text":"def __exit__(self, *exc_info):\n        return self._ctx.__exit__(*exc_info)"},{"col":0,"comment":"\n    Generates the ``(unit, doc, represents, aliases, prefixes)``\n    tuple used to format the unit summary docs in `generate_unit_summary`.\n    ","endLoc":74,"header":"def _iter_unit_summary(namespace)","id":9647,"name":"_iter_unit_summary","nodeType":"Function","startLoc":36,"text":"def _iter_unit_summary(namespace):\n    \"\"\"\n    Generates the ``(unit, doc, represents, aliases, prefixes)``\n    tuple used to format the unit summary docs in `generate_unit_summary`.\n    \"\"\"\n\n    from . import core\n\n    # Get all of the units, and keep track of which ones have SI\n    # prefixes\n    units = []\n    has_prefixes = set()\n    for key, val in namespace.items():\n        # Skip non-unit items\n        if not isinstance(val, core.UnitBase):\n            continue\n\n        # Skip aliases\n        if key != val.name:\n            continue\n\n        if isinstance(val, core.PrefixUnit):\n            # This will return the root unit that is scaled by the prefix\n            # attached to it\n            has_prefixes.add(val._represents.bases[0].name)\n        else:\n            units.append(val)\n\n    # Sort alphabetically, case insensitive\n    units.sort(key=lambda x: x.name.lower())\n\n    for unit in units:\n        doc = _get_first_sentence(unit.__doc__).strip()\n        represents = ''\n        if isinstance(unit, core.Unit):\n            represents = f\":math:`{unit._represents.to_string('latex')[1:-1]}`\"\n        aliases = ', '.join(f'``{x}``' for x in unit.aliases)\n\n        yield (unit, doc, represents, aliases, 'Yes' if unit.name in has_prefixes else 'No')"},{"className":"FixRemoteDataOption","col":0,"comment":"\n    This metaclass is used to catch cases where the user is running the tests\n    with --remote-data. We've now changed the --remote-data option so that it\n    takes arguments, but we still want --remote-data to work as before and to\n    enable all remote tests. With this metaclass, we can modify sys.argv\n    before setuptools try to parse the command-line options.\n    ","endLoc":60,"id":9648,"nodeType":"Class","startLoc":36,"text":"class FixRemoteDataOption(type):\n    \"\"\"\n    This metaclass is used to catch cases where the user is running the tests\n    with --remote-data. We've now changed the --remote-data option so that it\n    takes arguments, but we still want --remote-data to work as before and to\n    enable all remote tests. With this metaclass, we can modify sys.argv\n    before setuptools try to parse the command-line options.\n    \"\"\"\n    def __init__(cls, name, bases, dct):\n\n        try:\n            idx = sys.argv.index('--remote-data')\n        except ValueError:\n            pass\n        else:\n            sys.argv[idx] = '--remote-data=any'\n\n        try:\n            idx = sys.argv.index('-R')\n        except ValueError:\n            pass\n        else:\n            sys.argv[idx] = '-R=any'\n\n        return super().__init__(name, bases, dct)"},{"attributeType":"None","col":8,"comment":"null","endLoc":90,"id":9649,"name":"_ctx","nodeType":"Attribute","startLoc":90,"text":"self._ctx"},{"attributeType":"null","col":8,"comment":"null","endLoc":89,"id":9650,"name":"_exc","nodeType":"Attribute","startLoc":89,"text":"self._exc"},{"attributeType":"MyColumn","col":4,"comment":"null","endLoc":63,"id":9651,"name":"Column","nodeType":"Attribute","startLoc":63,"text":"Column"},{"col":19,"endLoc":65,"id":9652,"nodeType":"Lambda","startLoc":65,"text":"lambda x: x.name.lower()"},{"col":0,"comment":"\n    Get the first sentence from a string and remove any carriage\n    returns.\n    ","endLoc":33,"header":"def _get_first_sentence(s)","id":9653,"name":"_get_first_sentence","nodeType":"Function","startLoc":24,"text":"def _get_first_sentence(s):\n    \"\"\"\n    Get the first sentence from a string and remove any carriage\n    returns.\n    \"\"\"\n\n    x = re.match(r\".*?\\S\\.\\s\", s)\n    if x is not None:\n        s = x.group(0)\n    return s.replace('\\n', ' ')"},{"className":"catch_warnings","col":0,"comment":"\n    A high-powered version of warnings.catch_warnings to use for testing\n    and to make sure that there is no dependence on the order in which\n    the tests are run.\n\n    This completely blitzes any memory of any warnings that have\n    appeared before so that all warnings will be caught and displayed.\n\n    ``*args`` is a set of warning classes to collect.  If no arguments are\n    provided, all warnings are collected.\n\n    Use as follows::\n\n        with catch_warnings(MyCustomWarning) as w:\n            do.something.bad()\n        assert len(w) > 0\n\n    .. note:: Usage of :ref:`pytest.warns <pytest:warns>` is preferred.\n\n    ","endLoc":297,"id":9654,"nodeType":"Class","startLoc":258,"text":"@deprecated('5.1', alternative='pytest.warns')\nclass catch_warnings(warnings.catch_warnings):\n    \"\"\"\n    A high-powered version of warnings.catch_warnings to use for testing\n    and to make sure that there is no dependence on the order in which\n    the tests are run.\n\n    This completely blitzes any memory of any warnings that have\n    appeared before so that all warnings will be caught and displayed.\n\n    ``*args`` is a set of warning classes to collect.  If no arguments are\n    provided, all warnings are collected.\n\n    Use as follows::\n\n        with catch_warnings(MyCustomWarning) as w:\n            do.something.bad()\n        assert len(w) > 0\n\n    .. note:: Usage of :ref:`pytest.warns <pytest:warns>` is preferred.\n\n    \"\"\"\n\n    def __init__(self, *classes):\n        super().__init__(record=True)\n        self.classes = classes\n\n    def __enter__(self):\n        warning_list = super().__enter__()\n        treat_deprecations_as_exceptions()\n        if len(self.classes) == 0:\n            warnings.simplefilter('always')\n        else:\n            warnings.simplefilter('ignore')\n            for cls in self.classes:\n                warnings.simplefilter('always', cls)\n        return warning_list\n\n    def __exit__(self, type, value, traceback):\n        treat_deprecations_as_exceptions()"},{"col":4,"comment":"null","endLoc":283,"header":"def __init__(self, *classes)","id":9655,"name":"__init__","nodeType":"Function","startLoc":281,"text":"def __init__(self, *classes):\n        super().__init__(record=True)\n        self.classes = classes"},{"attributeType":"MyMaskedColumn","col":4,"comment":"null","endLoc":64,"id":9656,"name":"MaskedColumn","nodeType":"Attribute","startLoc":64,"text":"MaskedColumn"},{"col":4,"comment":"null","endLoc":60,"header":"def __init__(cls, name, bases, dct)","id":9657,"name":"__init__","nodeType":"Function","startLoc":44,"text":"def __init__(cls, name, bases, dct):\n\n        try:\n            idx = sys.argv.index('--remote-data')\n        except ValueError:\n            pass\n        else:\n            sys.argv[idx] = '--remote-data=any'\n\n        try:\n            idx = sys.argv.index('-R')\n        except ValueError:\n            pass\n        else:\n            sys.argv[idx] = '-R=any'\n\n        return super().__init__(name, bases, dct)"},{"attributeType":"MyTableColumns","col":4,"comment":"null","endLoc":65,"id":9658,"name":"TableColumns","nodeType":"Attribute","startLoc":65,"text":"TableColumns"},{"col":4,"comment":"null","endLoc":294,"header":"def __enter__(self)","id":9659,"name":"__enter__","nodeType":"Function","startLoc":285,"text":"def __enter__(self):\n        warning_list = super().__enter__()\n        treat_deprecations_as_exceptions()\n        if len(self.classes) == 0:\n            warnings.simplefilter('always')\n        else:\n            warnings.simplefilter('ignore')\n            for cls in self.classes:\n                warnings.simplefilter('always', cls)\n        return warning_list"},{"attributeType":"MyTableFormatter","col":4,"comment":"null","endLoc":66,"id":9660,"name":"TableFormatter","nodeType":"Attribute","startLoc":66,"text":"TableFormatter"},{"className":"SubclassTable","col":0,"comment":"null","endLoc":108,"id":9661,"nodeType":"Class","startLoc":107,"text":"class SubclassTable(table.Table):\n    pass"},{"col":0,"comment":"\n    Turn all DeprecationWarnings (which indicate deprecated uses of\n    Python itself or Numpy, but not within Astropy, where we use our\n    own deprecation warning class) into exceptions so that we find\n    out about them early.\n\n    This completely resets the warning filters and any \"already seen\"\n    warning state.\n    ","endLoc":255,"header":"@deprecated('5.1', alternative='https://docs.pytest.org/en/stable/warnings.html')\ndef treat_deprecations_as_exceptions()","id":9662,"name":"treat_deprecations_as_exceptions","nodeType":"Function","startLoc":194,"text":"@deprecated('5.1', alternative='https://docs.pytest.org/en/stable/warnings.html')\ndef treat_deprecations_as_exceptions():\n    \"\"\"\n    Turn all DeprecationWarnings (which indicate deprecated uses of\n    Python itself or Numpy, but not within Astropy, where we use our\n    own deprecation warning class) into exceptions so that we find\n    out about them early.\n\n    This completely resets the warning filters and any \"already seen\"\n    warning state.\n    \"\"\"\n    # First, totally reset the warning state. The modules may change during\n    # this iteration thus we copy the original state to a list to iterate\n    # on. See https://github.com/astropy/astropy/pull/5513.\n    for module in list(sys.modules.values()):\n        try:\n            del module.__warningregistry__\n        except Exception:\n            pass\n\n    if not _deprecations_as_exceptions:\n        return\n\n    warnings.resetwarnings()\n\n    # Hide the next couple of DeprecationWarnings\n    warnings.simplefilter('ignore', DeprecationWarning)\n    # Here's the wrinkle: a couple of our third-party dependencies\n    # (pytest and scipy) are still using deprecated features\n    # themselves, and we'd like to ignore those.  Fortunately, those\n    # show up only at import time, so if we import those things *now*,\n    # before we turn the warnings into exceptions, we're golden.\n    for m in _modules_to_ignore_on_import:\n        try:\n            __import__(m)\n        except ImportError:\n            pass\n\n    # Now, start over again with the warning filters\n    warnings.resetwarnings()\n    # Now, turn these warnings into exceptions\n    _all_warns = [DeprecationWarning, FutureWarning, ImportWarning]\n\n    # Only turn astropy deprecation warnings into exceptions if requested\n    if _include_astropy_deprecations:\n        _all_warns += [AstropyDeprecationWarning,\n                       AstropyPendingDeprecationWarning]\n\n    for w in _all_warns:\n        warnings.filterwarnings(\"error\", \".*\", w)\n\n    # This ignores all specified warnings from given module(s),\n    # not just on import, for use of Astropy affiliated packages.\n    for m in _warnings_to_ignore_entire_module:\n        for w in _all_warns:\n            warnings.filterwarnings('ignore', category=w, module=m)\n\n    # This ignores only specified warnings by Python version, if applicable.\n    for v in _warnings_to_ignore_by_pyver:\n        if v is None or sys.version_info[:2] == v:\n            for s in _warnings_to_ignore_by_pyver[v]:\n                warnings.filterwarnings(\"ignore\", s[0], s[1])"},{"col":0,"comment":"\n    Use numpy to find the common dtype for a list of structured ndarray columns.\n\n    Only allow columns within the following fundamental numpy data types:\n    np.bool_, np.object_, np.number, np.character, np.void\n    ","endLoc":142,"header":"def common_dtype(cols)","id":9663,"name":"common_dtype","nodeType":"Function","startLoc":116,"text":"def common_dtype(cols):\n    \"\"\"\n    Use numpy to find the common dtype for a list of structured ndarray columns.\n\n    Only allow columns within the following fundamental numpy data types:\n    np.bool_, np.object_, np.number, np.character, np.void\n    \"\"\"\n    np_types = (np.bool_, np.object_, np.number, np.character, np.void)\n    uniq_types = set(tuple(issubclass(col.dtype.type, np_type) for np_type in np_types)\n                     for col in cols)\n    if len(uniq_types) > 1:\n        # Embed into the exception the actual list of incompatible types.\n        incompat_types = [col.dtype.name for col in cols]\n        tme = TableMergeError(f'Columns have incompatible types {incompat_types}')\n        tme._incompat_types = incompat_types\n        raise tme\n\n    arrs = [np.empty(1, dtype=col.dtype) for col in cols]\n\n    # For string-type arrays need to explicitly fill in non-zero\n    # values or the final arr_common = .. step is unpredictable.\n    for arr in arrs:\n        if arr.dtype.kind in ('S', 'U'):\n            arr[0] = '0' * arr.itemsize\n\n    arr_common = np.array([arr[0] for arr in arrs])\n    return arr_common.dtype.str"},{"col":0,"comment":"null","endLoc":32,"header":"@pytest.fixture(params=[table.Column, table.MaskedColumn])\ndef Column(request)","id":9664,"name":"Column","nodeType":"Function","startLoc":28,"text":"@pytest.fixture(params=[table.Column, table.MaskedColumn])\ndef Column(request):\n    # Fixture to run all the Column tests for both an unmasked (ndarray)\n    # and masked (MaskedArray) column.\n    return request.param"},{"col":0,"comment":"null","endLoc":85,"header":"@pytest.fixture(params=['unmasked', 'masked', 'subclass'])\ndef table_types(request)","id":9665,"name":"table_types","nodeType":"Function","startLoc":72,"text":"@pytest.fixture(params=['unmasked', 'masked', 'subclass'])\ndef table_types(request):\n    class TableTypes:\n        def __init__(self, request):\n            if request.param == 'unmasked':\n                self.Table = table.Table\n                self.Column = table.Column\n            elif request.param == 'masked':\n                self.Table = MaskedTable\n                self.Column = table.MaskedColumn\n            elif request.param == 'subclass':\n                self.Table = MyTable\n                self.Column = MyColumn\n    return TableTypes(request)"},{"col":0,"comment":"null","endLoc":104,"header":"@pytest.fixture(params=[False, True])\ndef table_data(request)","id":9667,"name":"table_data","nodeType":"Function","startLoc":90,"text":"@pytest.fixture(params=[False, True])\ndef table_data(request):\n    class TableData:\n        def __init__(self, request):\n            self.Table = MaskedTable if request.param else table.Table\n            self.Column = table.MaskedColumn if request.param else table.Column\n            self.COLS = [\n                self.Column(name='a', data=[1, 2, 3], description='da',\n                            format='%i', meta={'ma': 1}, unit='ua'),\n                self.Column(name='b', data=[4, 5, 6], description='db',\n                            format='%d', meta={'mb': 1}, unit='ub'),\n                self.Column(name='c', data=[7, 8, 9], description='dc',\n                            format='%f', meta={'mc': 1}, unit='ub')]\n            self.DATA = self.Table(self.COLS)\n    return TableData(request)"},{"className":"AstropyTest","col":0,"comment":"null","endLoc":356,"id":9668,"nodeType":"Class","startLoc":63,"text":"class AstropyTest(Command, metaclass=FixRemoteDataOption):\n    description = 'Run the tests for this package'\n\n    user_options = [\n        ('package=', 'P',\n         \"The name of a specific package to test, e.g. 'io.fits' or 'utils'. \"\n         \"Accepts comma separated string to specify multiple packages. \"\n         \"If nothing is specified, all default tests are run.\"),\n        ('test-path=', 't',\n         'Specify a test location by path.  If a relative path to a  .py file, '\n         'it is relative to the built package, so e.g., a  leading \"astropy/\" '\n         'is necessary.  If a relative  path to a .rst file, it is relative to '\n         'the directory *below* the --docs-path directory, so a leading '\n         '\"docs/\" is usually necessary.  May also be an absolute path.'),\n        ('verbose-results', 'V',\n         'Turn on verbose output from pytest.'),\n        ('plugins=', 'p',\n         'Plugins to enable when running pytest.'),\n        ('pastebin=', 'b',\n         \"Enable pytest pastebin output. Either 'all' or 'failed'.\"),\n        ('args=', 'a',\n         'Additional arguments to be passed to pytest.'),\n        ('remote-data=', 'R', 'Run tests that download remote data. Should be '\n         'one of none/astropy/any (defaults to none).'),\n        ('pep8', '8',\n         'Enable PEP8 checking and disable regular tests. '\n         'Requires the pytest-pep8 plugin.'),\n        ('pdb', 'd',\n         'Start the interactive Python debugger on errors.'),\n        ('coverage', 'c',\n         'Create a coverage report. Requires the coverage package.'),\n        ('open-files', 'o', 'Fail if any tests leave files open.  Requires the '\n         'psutil package.'),\n        ('parallel=', 'j',\n         'Run the tests in parallel on the specified number of '\n         'CPUs.  If \"auto\", all the cores on the machine will be '\n         'used.  Requires the pytest-xdist plugin.'),\n        ('docs-path=', None,\n         'The path to the documentation .rst files.  If not provided, and '\n         'the current directory contains a directory called \"docs\", that '\n         'will be used.'),\n        ('skip-docs', None,\n         \"Don't test the documentation .rst files.\"),\n        ('repeat=', None,\n         'How many times to repeat each test (can be used to check for '\n         'sporadic failures).'),\n        ('temp-root=', None,\n         'The root directory in which to create the temporary testing files. '\n         'If unspecified the system default is used (e.g. /tmp) as explained '\n         'in the documentation for tempfile.mkstemp.'),\n        ('verbose-install', None,\n         'Turn on terminal output from the installation of astropy in a '\n         'temporary folder.'),\n        ('readonly', None,\n         'Make the temporary installation being tested read-only.')\n    ]\n\n    package_name = ''\n\n    def initialize_options(self):\n        self.package = None\n        self.test_path = None\n        self.verbose_results = False\n        self.plugins = None\n        self.pastebin = None\n        self.args = None\n        self.remote_data = 'none'\n        self.pep8 = False\n        self.pdb = False\n        self.coverage = False\n        self.open_files = False\n        self.parallel = 0\n        self.docs_path = None\n        self.skip_docs = False\n        self.repeat = None\n        self.temp_root = None\n        self.verbose_install = False\n        self.readonly = False\n\n    def finalize_options(self):\n        # Normally we would validate the options here, but that's handled in\n        # run_tests\n        pass\n\n    def generate_testing_command(self):\n        \"\"\"\n        Build a Python script to run the tests.\n        \"\"\"\n\n        cmd_pre = ''  # Commands to run before the test function\n        cmd_post = ''  # Commands to run after the test function\n\n        if self.coverage:\n            pre, post = self._generate_coverage_commands()\n            cmd_pre += pre\n            cmd_post += post\n\n        set_flag = \"import builtins; builtins._ASTROPY_TEST_ = True\"\n\n        cmd = ('{cmd_pre}{0}; import {1.package_name}, sys; result = ('\n               '{1.package_name}.test('\n               'package={1.package!r}, '\n               'test_path={1.test_path!r}, '\n               'args={1.args!r}, '\n               'plugins={1.plugins!r}, '\n               'verbose={1.verbose_results!r}, '\n               'pastebin={1.pastebin!r}, '\n               'remote_data={1.remote_data!r}, '\n               'pep8={1.pep8!r}, '\n               'pdb={1.pdb!r}, '\n               'open_files={1.open_files!r}, '\n               'parallel={1.parallel!r}, '\n               'docs_path={1.docs_path!r}, '\n               'skip_docs={1.skip_docs!r}, '\n               'add_local_eggs_to_path=True, '  # see _build_temp_install below\n               'repeat={1.repeat!r})); '\n               '{cmd_post}'\n               'sys.exit(result)')\n        return cmd.format(set_flag, self, cmd_pre=cmd_pre, cmd_post=cmd_post)\n\n    def run(self):\n        \"\"\"\n        Run the tests!\n        \"\"\"\n\n        # Install the runtime dependencies.\n        if self.distribution.install_requires:\n            self.distribution.fetch_build_eggs(self.distribution.install_requires)\n\n        # Ensure there is a doc path\n        if self.docs_path is None:\n            cfg_docs_dir = self.distribution.get_option_dict('build_docs').get('source_dir', None)\n\n            # Some affiliated packages use this.\n            # See astropy/package-template#157\n            if cfg_docs_dir is not None and os.path.exists(cfg_docs_dir[1]):\n                self.docs_path = os.path.abspath(cfg_docs_dir[1])\n\n            # fall back on a default path of \"docs\"\n            elif os.path.exists('docs'):  # pragma: no cover\n                self.docs_path = os.path.abspath('docs')\n\n        # Build a testing install of the package\n        self._build_temp_install()\n\n        # Install the test dependencies\n        # NOTE: we do this here after _build_temp_install because there is\n        # a weird but which occurs if psutil is installed in this way before\n        # astropy is built, Cython can have segmentation fault. Strange, eh?\n        if self.distribution.tests_require:\n            self.distribution.fetch_build_eggs(self.distribution.tests_require)\n\n        # Copy any additional dependencies that may have been installed via\n        # tests_requires or install_requires. We then pass the\n        # add_local_eggs_to_path=True option to package.test() to make sure the\n        # eggs get included in the path.\n        if os.path.exists('.eggs'):\n            shutil.copytree('.eggs', os.path.join(self.testing_path, '.eggs'))\n\n        # This option exists so that we can make sure that the tests don't\n        # write to an installed location.\n        if self.readonly:\n            log.info('changing permissions of temporary installation to read-only')\n            self._change_permissions_testing_path(writable=False)\n\n        # Run everything in a try: finally: so that the tmp dir gets deleted.\n        try:\n            # Construct this modules testing command\n            cmd = self.generate_testing_command()\n\n            # Run the tests in a subprocess--this is necessary since\n            # new extension modules may have appeared, and this is the\n            # easiest way to set up a new environment\n\n            testproc = subprocess.Popen(\n                [sys.executable, '-c', cmd],\n                cwd=self.testing_path, close_fds=False)\n            retcode = testproc.wait()\n        except KeyboardInterrupt:\n            import signal\n            # If a keyboard interrupt is handled, pass it to the test\n            # subprocess to prompt pytest to initiate its teardown\n            testproc.send_signal(signal.SIGINT)\n            retcode = testproc.wait()\n        finally:\n            # Remove temporary directory\n            if self.readonly:\n                self._change_permissions_testing_path(writable=True)\n            shutil.rmtree(self.tmp_dir)\n\n        raise SystemExit(retcode)\n\n    def _build_temp_install(self):\n        \"\"\"\n        Install the package and to a temporary directory for the purposes of\n        testing. This allows us to test the install command, include the\n        entry points, and also avoids creating pyc and __pycache__ directories\n        inside the build directory\n        \"\"\"\n\n        # On OSX the default path for temp files is under /var, but in most\n        # cases on OSX /var is actually a symlink to /private/var; ensure we\n        # dereference that link, because pytest is very sensitive to relative\n        # paths...\n\n        tmp_dir = tempfile.mkdtemp(prefix=self.package_name + '-test-',\n                                   dir=self.temp_root)\n        self.tmp_dir = os.path.realpath(tmp_dir)\n\n        log.info(f'installing to temporary directory: {self.tmp_dir}')\n\n        # We now install the package to the temporary directory. We do this\n        # rather than build and copy because this will ensure that e.g. entry\n        # points work.\n        self.reinitialize_command('install')\n        install_cmd = self.distribution.get_command_obj('install')\n        install_cmd.prefix = self.tmp_dir\n        if self.verbose_install:\n            self.run_command('install')\n        else:\n            with _suppress_stdout():\n                self.run_command('install')\n\n        # We now get the path to the site-packages directory that was created\n        # inside self.tmp_dir\n        install_cmd = self.get_finalized_command('install')\n        self.testing_path = install_cmd.install_lib\n\n        # Ideally, docs_path is set properly in run(), but if it is still\n        # not set here, do not pretend it is, otherwise bad things happen.\n        # See astropy/package-template#157\n        if self.docs_path is not None:\n            new_docs_path = os.path.join(self.testing_path,\n                                         os.path.basename(self.docs_path))\n            shutil.copytree(self.docs_path, new_docs_path)\n            self.docs_path = new_docs_path\n\n        shutil.copy('setup.cfg', self.testing_path)\n\n    def _change_permissions_testing_path(self, writable=False):\n        if writable:\n            basic_flags = stat.S_IRUSR | stat.S_IWUSR\n        else:\n            basic_flags = stat.S_IRUSR\n        for root, dirs, files in os.walk(self.testing_path):\n            for dirname in dirs:\n                os.chmod(os.path.join(root, dirname), basic_flags | stat.S_IXUSR)\n            for filename in files:\n                os.chmod(os.path.join(root, filename), basic_flags)\n\n    def _generate_coverage_commands(self):\n        \"\"\"\n        This method creates the post and pre commands if coverage is to be\n        generated\n        \"\"\"\n        if self.parallel != 0:\n            raise ValueError(\n                \"--coverage can not be used with --parallel\")\n\n        try:\n            import coverage  # pylint: disable=W0611\n        except ImportError:\n            raise ImportError(\n                \"--coverage requires that the coverage package is \"\n                \"installed.\")\n\n        # Don't use get_pkg_data_filename here, because it\n        # requires importing astropy.config and thus screwing\n        # up coverage results for those packages.\n        coveragerc = os.path.join(\n            self.testing_path, self.package_name.replace('.', '/'),\n            'tests', 'coveragerc')\n\n        with open(coveragerc, 'r') as fd:\n            coveragerc_content = fd.read()\n\n        coveragerc_content = coveragerc_content.replace(\n            \"{packagename}\", self.package_name.replace('.', '/'))\n        tmp_coveragerc = os.path.join(self.tmp_dir, 'coveragerc')\n        with open(tmp_coveragerc, 'wb') as tmp:\n            tmp.write(coveragerc_content.encode('utf-8'))\n\n        cmd_pre = (\n            'import coverage; '\n            'cov = coverage.coverage(data_file=r\"{}\", config_file=r\"{}\"); '\n            'cov.start();'.format(\n                os.path.abspath(\".coverage\"), os.path.abspath(tmp_coveragerc)))\n        cmd_post = (\n            'cov.stop(); '\n            'from astropy.tests.helper import _save_coverage; '\n            '_save_coverage(cov, result, r\"{}\", r\"{}\");'.format(\n                os.path.abspath('.'), os.path.abspath(self.testing_path)))\n\n        return cmd_pre, cmd_post"},{"col":4,"comment":"null","endLoc":140,"header":"def initialize_options(self)","id":9669,"name":"initialize_options","nodeType":"Function","startLoc":122,"text":"def initialize_options(self):\n        self.package = None\n        self.test_path = None\n        self.verbose_results = False\n        self.plugins = None\n        self.pastebin = None\n        self.args = None\n        self.remote_data = 'none'\n        self.pep8 = False\n        self.pdb = False\n        self.coverage = False\n        self.open_files = False\n        self.parallel = 0\n        self.docs_path = None\n        self.skip_docs = False\n        self.repeat = None\n        self.temp_root = None\n        self.verbose_install = False\n        self.readonly = False"},{"col":4,"comment":"null","endLoc":145,"header":"def finalize_options(self)","id":9670,"name":"finalize_options","nodeType":"Function","startLoc":142,"text":"def finalize_options(self):\n        # Normally we would validate the options here, but that's handled in\n        # run_tests\n        pass"},{"col":4,"comment":"\n        Build a Python script to run the tests.\n        ","endLoc":181,"header":"def generate_testing_command(self)","id":9671,"name":"generate_testing_command","nodeType":"Function","startLoc":147,"text":"def generate_testing_command(self):\n        \"\"\"\n        Build a Python script to run the tests.\n        \"\"\"\n\n        cmd_pre = ''  # Commands to run before the test function\n        cmd_post = ''  # Commands to run after the test function\n\n        if self.coverage:\n            pre, post = self._generate_coverage_commands()\n            cmd_pre += pre\n            cmd_post += post\n\n        set_flag = \"import builtins; builtins._ASTROPY_TEST_ = True\"\n\n        cmd = ('{cmd_pre}{0}; import {1.package_name}, sys; result = ('\n               '{1.package_name}.test('\n               'package={1.package!r}, '\n               'test_path={1.test_path!r}, '\n               'args={1.args!r}, '\n               'plugins={1.plugins!r}, '\n               'verbose={1.verbose_results!r}, '\n               'pastebin={1.pastebin!r}, '\n               'remote_data={1.remote_data!r}, '\n               'pep8={1.pep8!r}, '\n               'pdb={1.pdb!r}, '\n               'open_files={1.open_files!r}, '\n               'parallel={1.parallel!r}, '\n               'docs_path={1.docs_path!r}, '\n               'skip_docs={1.skip_docs!r}, '\n               'add_local_eggs_to_path=True, '  # see _build_temp_install below\n               'repeat={1.repeat!r})); '\n               '{cmd_post}'\n               'sys.exit(result)')\n        return cmd.format(set_flag, self, cmd_pre=cmd_pre, cmd_post=cmd_post)"},{"col":4,"comment":"null","endLoc":297,"header":"def __exit__(self, type, value, traceback)","id":9672,"name":"__exit__","nodeType":"Function","startLoc":296,"text":"def __exit__(self, type, value, traceback):\n        treat_deprecations_as_exceptions()"},{"col":0,"comment":"\n    Generates table entries for units in a namespace that are just prefixes\n    without the base unit.  Note that this is intended to be used *after*\n    `generate_unit_summary` and therefore does not include the table header.\n\n    Parameters\n    ----------\n    namespace : dict\n        A namespace containing units that are prefixes but do *not* have the\n        base unit in their namespace.\n\n    Returns\n    -------\n    docstring : str\n        A docstring containing a summary table of the units.\n    ","endLoc":156,"header":"def generate_prefixonly_unit_summary(namespace)","id":9673,"name":"generate_prefixonly_unit_summary","nodeType":"Function","startLoc":120,"text":"def generate_prefixonly_unit_summary(namespace):\n    \"\"\"\n    Generates table entries for units in a namespace that are just prefixes\n    without the base unit.  Note that this is intended to be used *after*\n    `generate_unit_summary` and therefore does not include the table header.\n\n    Parameters\n    ----------\n    namespace : dict\n        A namespace containing units that are prefixes but do *not* have the\n        base unit in their namespace.\n\n    Returns\n    -------\n    docstring : str\n        A docstring containing a summary table of the units.\n    \"\"\"\n    from . import PrefixUnit\n\n    faux_namespace = {}\n    for nm, unit in namespace.items():\n        if isinstance(unit, PrefixUnit):\n            base_unit = unit.represents.bases[0]\n            faux_namespace[base_unit.name] = base_unit\n\n    docstring = io.StringIO()\n\n    for unit_summary in _iter_unit_summary(faux_namespace):\n        docstring.write(\"\"\"\n   * - Prefixes for ``{}``\n     - {} prefixes\n     - {}\n     - {}\n     - Only\n\"\"\".format(*unit_summary))\n\n    return docstring.getvalue()"},{"col":0,"comment":"null","endLoc":154,"header":"def _check_for_sequence_of_structured_arrays(arrays)","id":9674,"name":"_check_for_sequence_of_structured_arrays","nodeType":"Function","startLoc":145,"text":"def _check_for_sequence_of_structured_arrays(arrays):\n    err = '`arrays` arg must be a sequence (e.g. list) of structured arrays'\n    if not isinstance(arrays, Sequence):\n        raise TypeError(err)\n    for array in arrays:\n        # Must be structured array\n        if not isinstance(array, np.ndarray) or array.dtype.names is None:\n            raise TypeError(err)\n    if len(arrays) == 0:\n        raise ValueError('`arrays` arg must include at least one array')"},{"attributeType":"null","col":8,"comment":"null","endLoc":283,"id":9675,"name":"classes","nodeType":"Attribute","startLoc":283,"text":"self.classes"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":9676,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":6,"header":"np_utils.py#<anonymous>","id":9677,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nHigh-level operations for numpy structured arrays.\n\nSome code and inspiration taken from numpy.lib.recfunctions.join_by().\nRedistribution license restrictions apply.\n\"\"\"\n\n__all__ = ['TableMergeError']"},{"fileName":"si.py","filePath":"astropy/units","id":9678,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis package defines the SI units.  They are also available in the\n`astropy.units` namespace.\n\n\"\"\"\n\nfrom astropy.constants import si as _si\nfrom .core import UnitBase, Unit, def_unit\n\nimport numpy as _numpy\n\n_ns = globals()\n\n\n###########################################################################\n# DIMENSIONLESS\n\ndef_unit(['percent', 'pct'], Unit(0.01), namespace=_ns, prefixes=False,\n         doc=\"percent: one hundredth of unity, factor 0.01\",\n         format={'generic': '%', 'console': '%', 'cds': '%',\n                 'latex': r'\\%', 'unicode': '%'})\n\n###########################################################################\n# LENGTH\n\ndef_unit(['m', 'meter'], namespace=_ns, prefixes=True,\n         doc=\"meter: base unit of length in SI\")\n\ndef_unit(['micron'], um, namespace=_ns,\n         doc=\"micron: alias for micrometer (um)\",\n         format={'latex': r'\\mu m', 'unicode': '\\N{MICRO SIGN}m'})\n\ndef_unit(['Angstrom', 'AA', 'angstrom'], 0.1 * nm, namespace=_ns,\n         doc=\"ångström: 10 ** -10 m\",\n         prefixes=[(['m', 'milli'], ['milli', 'm'], 1.e-3)],\n         format={'latex': r'\\mathring{A}', 'unicode': 'Å',\n                 'vounit': 'Angstrom'})\n\n\n###########################################################################\n# VOLUMES\n\ndef_unit((['l', 'L'], ['liter']), 1000 * cm ** 3.0, namespace=_ns, prefixes=True,\n         format={'latex': r'\\mathcal{l}', 'unicode': 'ℓ'},\n         doc=\"liter: metric unit of volume\")\n\n\n###########################################################################\n# ANGULAR MEASUREMENTS\n\ndef_unit(['rad', 'radian'], namespace=_ns, prefixes=True,\n         doc=\"radian: angular measurement of the ratio between the length \"\n         \"on an arc and its radius\")\ndef_unit(['deg', 'degree'], _numpy.pi / 180.0 * rad, namespace=_ns,\n         prefixes=True,\n         doc=\"degree: angular measurement 1/360 of full rotation\",\n         format={'latex': r'{}^{\\circ}', 'unicode': '°'})\ndef_unit(['hourangle'], 15.0 * deg, namespace=_ns, prefixes=False,\n         doc=\"hour angle: angular measurement with 24 in a full circle\",\n         format={'latex': r'{}^{h}', 'unicode': 'ʰ'})\ndef_unit(['arcmin', 'arcminute'], 1.0 / 60.0 * deg, namespace=_ns,\n         prefixes=True,\n         doc=\"arc minute: angular measurement\",\n         format={'latex': r'{}^{\\prime}', 'unicode': '′'})\ndef_unit(['arcsec', 'arcsecond'], 1.0 / 3600.0 * deg, namespace=_ns,\n         prefixes=True,\n         doc=\"arc second: angular measurement\")\n# These special formats should only be used for the non-prefix versions\narcsec._format = {'latex': r'{}^{\\prime\\prime}', 'unicode': '″'}\ndef_unit(['mas'], 0.001 * arcsec, namespace=_ns,\n         doc=\"milli arc second: angular measurement\")\ndef_unit(['uas'], 0.000001 * arcsec, namespace=_ns,\n         doc=\"micro arc second: angular measurement\",\n         format={'latex': r'\\mu as', 'unicode': 'μas'})\n\ndef_unit(['sr', 'steradian'], rad ** 2, namespace=_ns, prefixes=True,\n         doc=\"steradian: unit of solid angle in SI\")\n\n\n###########################################################################\n# TIME\n\ndef_unit(['s', 'second'], namespace=_ns, prefixes=True,\n         exclude_prefixes=['a'],\n         doc=\"second: base unit of time in SI.\")\n\ndef_unit(['min', 'minute'], 60 * s, prefixes=True, namespace=_ns)\ndef_unit(['h', 'hour', 'hr'], 3600 * s, namespace=_ns, prefixes=True,\n         exclude_prefixes=['p'])\ndef_unit(['d', 'day'], 24 * h, namespace=_ns, prefixes=True,\n         exclude_prefixes=['c', 'y'])\ndef_unit(['sday'], 86164.09053 * s, namespace=_ns,\n         doc=\"Sidereal day (sday) is the time of one rotation of the Earth.\")\ndef_unit(['wk', 'week'], 7 * day, namespace=_ns)\ndef_unit(['fortnight'], 2 * wk, namespace=_ns)\n\ndef_unit(['a', 'annum'], 365.25 * d, namespace=_ns, prefixes=True,\n         exclude_prefixes=['P'])\ndef_unit(['yr', 'year'], 365.25 * d, namespace=_ns, prefixes=True)\n\n\n###########################################################################\n# FREQUENCY\n\ndef_unit(['Hz', 'Hertz', 'hertz'], 1 / s, namespace=_ns, prefixes=True,\n         doc=\"Frequency\")\n\n\n###########################################################################\n# MASS\n\ndef_unit(['kg', 'kilogram'], namespace=_ns,\n         doc=\"kilogram: base unit of mass in SI.\")\ndef_unit(['g', 'gram'], 1.0e-3 * kg, namespace=_ns, prefixes=True,\n         exclude_prefixes=['k', 'kilo'])\n\ndef_unit(['t', 'tonne'], 1000 * kg, namespace=_ns,\n         doc=\"Metric tonne\")\n\n\n###########################################################################\n# AMOUNT OF SUBSTANCE\n\ndef_unit(['mol', 'mole'], namespace=_ns, prefixes=True,\n         doc=\"mole: amount of a chemical substance in SI.\")\n\n\n###########################################################################\n# TEMPERATURE\n\ndef_unit(\n    ['K', 'Kelvin'], namespace=_ns, prefixes=True,\n    doc=\"Kelvin: temperature with a null point at absolute zero.\")\ndef_unit(\n    ['deg_C', 'Celsius'], namespace=_ns, doc='Degrees Celsius',\n    format={'latex': r'{}^{\\circ}C', 'unicode': '°C'})\n\n\n###########################################################################\n# FORCE\n\ndef_unit(['N', 'Newton', 'newton'], kg * m * s ** -2, namespace=_ns,\n         prefixes=True, doc=\"Newton: force\")\n\n\n##########################################################################\n# ENERGY\n\ndef_unit(['J', 'Joule', 'joule'], N * m, namespace=_ns, prefixes=True,\n         doc=\"Joule: energy\")\ndef_unit(['eV', 'electronvolt'], _si.e.value * J, namespace=_ns, prefixes=True,\n         doc=\"Electron Volt\")\n\n\n##########################################################################\n# PRESSURE\n\ndef_unit(['Pa', 'Pascal', 'pascal'], J * m ** -3, namespace=_ns, prefixes=True,\n         doc=\"Pascal: pressure\")\n\n\n###########################################################################\n# POWER\n\ndef_unit(['W', 'Watt', 'watt'], J / s, namespace=_ns, prefixes=True,\n         doc=\"Watt: power\")\n\n\n###########################################################################\n# ELECTRICAL\n\ndef_unit(['A', 'ampere', 'amp'], namespace=_ns, prefixes=True,\n         doc=\"ampere: base unit of electric current in SI\")\ndef_unit(['C', 'coulomb'], A * s, namespace=_ns, prefixes=True,\n         doc=\"coulomb: electric charge\")\ndef_unit(['V', 'Volt', 'volt'], J * C ** -1, namespace=_ns, prefixes=True,\n         doc=\"Volt: electric potential or electromotive force\")\ndef_unit((['Ohm', 'ohm'], ['Ohm']), V * A ** -1, namespace=_ns, prefixes=True,\n         doc=\"Ohm: electrical resistance\",\n         format={'latex': r'\\Omega', 'unicode': 'Ω'})\ndef_unit(['S', 'Siemens', 'siemens'], A * V ** -1, namespace=_ns,\n         prefixes=True, doc=\"Siemens: electrical conductance\")\ndef_unit(['F', 'Farad', 'farad'], C * V ** -1, namespace=_ns, prefixes=True,\n         doc=\"Farad: electrical capacitance\")\n\n\n###########################################################################\n# MAGNETIC\n\ndef_unit(['Wb', 'Weber', 'weber'], V * s, namespace=_ns, prefixes=True,\n         doc=\"Weber: magnetic flux\")\ndef_unit(['T', 'Tesla', 'tesla'], Wb * m ** -2, namespace=_ns, prefixes=True,\n         doc=\"Tesla: magnetic flux density\")\ndef_unit(['H', 'Henry', 'henry'], Wb * A ** -1, namespace=_ns, prefixes=True,\n         doc=\"Henry: inductance\")\n\n\n###########################################################################\n# ILLUMINATION\n\ndef_unit(['cd', 'candela'], namespace=_ns, prefixes=True,\n         doc=\"candela: base unit of luminous intensity in SI\")\ndef_unit(['lm', 'lumen'], cd * sr, namespace=_ns, prefixes=True,\n         doc=\"lumen: luminous flux\")\ndef_unit(['lx', 'lux'], lm * m ** -2, namespace=_ns, prefixes=True,\n         doc=\"lux: luminous emittance\")\n\n###########################################################################\n# RADIOACTIVITY\n\ndef_unit(['Bq', 'becquerel'], 1 / s, namespace=_ns, prefixes=False,\n         doc=\"becquerel: unit of radioactivity\")\ndef_unit(['Ci', 'curie'], Bq * 3.7e10, namespace=_ns, prefixes=False,\n         doc=\"curie: unit of radioactivity\")\n\n\n###########################################################################\n# BASES\n\nbases = set([m, s, kg, A, cd, rad, K, mol])\n\n\n###########################################################################\n# CLEANUP\n\ndel UnitBase\ndel Unit\ndel def_unit\n\n\n###########################################################################\n# DOCSTRING\n\n# This generates a docstring for this module that describes all of the\n# standard units defined here.\nfrom .utils import generate_unit_summary as _generate_unit_summary\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())\n"},{"col":0,"comment":"\n    Factory function for defining new units.\n\n    Parameters\n    ----------\n    s : str or list of str\n        The name of the unit.  If a list, the first element is the\n        canonical (short) name, and the rest of the elements are\n        aliases.\n\n    represents : UnitBase instance, optional\n        The unit that this named unit represents.  If not provided,\n        a new `IrreducibleUnit` is created.\n\n    doc : str, optional\n        A docstring describing the unit.\n\n    format : dict, optional\n        A mapping to format-specific representations of this unit.\n        For example, for the ``Ohm`` unit, it might be nice to\n        have it displayed as ``\\Omega`` by the ``latex``\n        formatter.  In that case, `format` argument should be set\n        to::\n\n            {'latex': r'\\Omega'}\n\n    prefixes : bool or list, optional\n        When `True`, generate all of the SI prefixed versions of the\n        unit as well.  For example, for a given unit ``m``, will\n        generate ``mm``, ``cm``, ``km``, etc.  When a list, it is a list of\n        prefix definitions of the form:\n\n            (short_names, long_tables, factor)\n\n        Default is `False`.  This function always returns the base\n        unit object, even if multiple scaled versions of the unit were\n        created.\n\n    exclude_prefixes : list of str, optional\n        If any of the SI prefixes need to be excluded, they may be\n        listed here.  For example, ``Pa`` can be interpreted either as\n        \"petaannum\" or \"Pascal\".  Therefore, when defining the\n        prefixes for ``a``, ``exclude_prefixes`` should be set to\n        ``[\"P\"]``.\n\n    namespace : dict, optional\n        When provided, inject the unit (and all of its aliases and\n        prefixes), into the given namespace dictionary.\n\n    Returns\n    -------\n    unit : `~astropy.units.UnitBase`\n        The newly-defined unit, or a matching unit that was already\n        defined.\n    ","endLoc":2527,"header":"def def_unit(s, represents=None, doc=None, format=None, prefixes=False,\n             exclude_prefixes=[], namespace=None)","id":9679,"name":"def_unit","nodeType":"Function","startLoc":2459,"text":"def def_unit(s, represents=None, doc=None, format=None, prefixes=False,\n             exclude_prefixes=[], namespace=None):\n    \"\"\"\n    Factory function for defining new units.\n\n    Parameters\n    ----------\n    s : str or list of str\n        The name of the unit.  If a list, the first element is the\n        canonical (short) name, and the rest of the elements are\n        aliases.\n\n    represents : UnitBase instance, optional\n        The unit that this named unit represents.  If not provided,\n        a new `IrreducibleUnit` is created.\n\n    doc : str, optional\n        A docstring describing the unit.\n\n    format : dict, optional\n        A mapping to format-specific representations of this unit.\n        For example, for the ``Ohm`` unit, it might be nice to\n        have it displayed as ``\\\\Omega`` by the ``latex``\n        formatter.  In that case, `format` argument should be set\n        to::\n\n            {'latex': r'\\\\Omega'}\n\n    prefixes : bool or list, optional\n        When `True`, generate all of the SI prefixed versions of the\n        unit as well.  For example, for a given unit ``m``, will\n        generate ``mm``, ``cm``, ``km``, etc.  When a list, it is a list of\n        prefix definitions of the form:\n\n            (short_names, long_tables, factor)\n\n        Default is `False`.  This function always returns the base\n        unit object, even if multiple scaled versions of the unit were\n        created.\n\n    exclude_prefixes : list of str, optional\n        If any of the SI prefixes need to be excluded, they may be\n        listed here.  For example, ``Pa`` can be interpreted either as\n        \"petaannum\" or \"Pascal\".  Therefore, when defining the\n        prefixes for ``a``, ``exclude_prefixes`` should be set to\n        ``[\"P\"]``.\n\n    namespace : dict, optional\n        When provided, inject the unit (and all of its aliases and\n        prefixes), into the given namespace dictionary.\n\n    Returns\n    -------\n    unit : `~astropy.units.UnitBase`\n        The newly-defined unit, or a matching unit that was already\n        defined.\n    \"\"\"\n\n    if represents is not None:\n        result = Unit(s, represents, namespace=namespace, doc=doc,\n                      format=format)\n    else:\n        result = IrreducibleUnit(\n            s, namespace=namespace, doc=doc, format=format)\n\n    if prefixes:\n        _add_prefixes(result, excludes=exclude_prefixes, namespace=namespace,\n                      prefixes=prefixes)\n    return result"},{"col":0,"comment":"null","endLoc":37,"header":"def _initialize_module()","id":9680,"name":"_initialize_module","nodeType":"Function","startLoc":24,"text":"def _initialize_module():\n    # Local imports to avoid polluting top-level namespace\n    from . import cgs\n    from . import astrophys\n    from .core import def_unit, _add_prefixes\n\n    def_unit(['emu'], cgs.Bi, namespace=_ns,\n             doc='Biot: CGS (EMU) unit of current')\n\n    # Add only some *prefixes* as deprecated units.\n    _add_prefixes(astrophys.jupiterMass, namespace=_ns, prefixes=True)\n    _add_prefixes(astrophys.earthMass, namespace=_ns, prefixes=True)\n    _add_prefixes(astrophys.jupiterRad, namespace=_ns, prefixes=True)\n    _add_prefixes(astrophys.earthRad, namespace=_ns, prefixes=True)"},{"className":"ignore_warnings","col":0,"comment":"\n    This can be used either as a context manager or function decorator to\n    ignore all warnings that occur within a function or block of code.\n\n    An optional category option can be supplied to only ignore warnings of a\n    certain category or categories (if a list is provided).\n    ","endLoc":336,"id":9681,"nodeType":"Class","startLoc":300,"text":"@deprecated('5.1', alternative='pytest.mark.filterwarnings')\nclass ignore_warnings(catch_warnings):\n    \"\"\"\n    This can be used either as a context manager or function decorator to\n    ignore all warnings that occur within a function or block of code.\n\n    An optional category option can be supplied to only ignore warnings of a\n    certain category or categories (if a list is provided).\n    \"\"\"\n\n    def __init__(self, category=None):\n        super().__init__()\n\n        if isinstance(category, type) and issubclass(category, Warning):\n            self.category = [category]\n        else:\n            self.category = category\n\n    def __call__(self, func):\n        @functools.wraps(func)\n        def wrapper(*args, **kwargs):\n            # Originally this just reused self, but that doesn't work if the\n            # function is called more than once so we need to make a new\n            # context manager instance for each call\n            with self.__class__(category=self.category):\n                return func(*args, **kwargs)\n\n        return wrapper\n\n    def __enter__(self):\n        retval = super().__enter__()\n        if self.category is not None:\n            for category in self.category:\n                warnings.simplefilter('ignore', category)\n        else:\n            warnings.simplefilter('ignore')\n        return retval"},{"col":4,"comment":"null","endLoc":316,"header":"def __init__(self, category=None)","id":9682,"name":"__init__","nodeType":"Function","startLoc":310,"text":"def __init__(self, category=None):\n        super().__init__()\n\n        if isinstance(category, type) and issubclass(category, Warning):\n            self.category = [category]\n        else:\n            self.category = category"},{"attributeType":"null","col":4,"comment":"null","endLoc":141,"id":9683,"name":"_represent_as_dict_primary_data","nodeType":"Attribute","startLoc":141,"text":"_represent_as_dict_primary_data"},{"col":0,"comment":"\n    Return a masked table from the io.votable test set that has a wide variety\n    of stressing types.\n    ","endLoc":137,"header":"def complex_table()","id":9684,"name":"complex_table","nodeType":"Function","startLoc":121,"text":"def complex_table():\n    \"\"\"\n    Return a masked table from the io.votable test set that has a wide variety\n    of stressing types.\n    \"\"\"\n    from astropy.utils.data import get_pkg_data_filename\n    from astropy.io.votable.table import parse\n    import warnings\n\n    with warnings.catch_warnings():\n        warnings.simplefilter(\"ignore\")\n        votable = parse(get_pkg_data_filename('../io/votable/tests/data/regression.xml'),\n                        pedantic=False)\n    first_table = votable.get_first_table()\n    table = first_table.to_table()\n\n    return table"},{"col":4,"comment":"\n        This method creates the post and pre commands if coverage is to be\n        generated\n        ","endLoc":356,"header":"def _generate_coverage_commands(self)","id":9685,"name":"_generate_coverage_commands","nodeType":"Function","startLoc":313,"text":"def _generate_coverage_commands(self):\n        \"\"\"\n        This method creates the post and pre commands if coverage is to be\n        generated\n        \"\"\"\n        if self.parallel != 0:\n            raise ValueError(\n                \"--coverage can not be used with --parallel\")\n\n        try:\n            import coverage  # pylint: disable=W0611\n        except ImportError:\n            raise ImportError(\n                \"--coverage requires that the coverage package is \"\n                \"installed.\")\n\n        # Don't use get_pkg_data_filename here, because it\n        # requires importing astropy.config and thus screwing\n        # up coverage results for those packages.\n        coveragerc = os.path.join(\n            self.testing_path, self.package_name.replace('.', '/'),\n            'tests', 'coveragerc')\n\n        with open(coveragerc, 'r') as fd:\n            coveragerc_content = fd.read()\n\n        coveragerc_content = coveragerc_content.replace(\n            \"{packagename}\", self.package_name.replace('.', '/'))\n        tmp_coveragerc = os.path.join(self.tmp_dir, 'coveragerc')\n        with open(tmp_coveragerc, 'wb') as tmp:\n            tmp.write(coveragerc_content.encode('utf-8'))\n\n        cmd_pre = (\n            'import coverage; '\n            'cov = coverage.coverage(data_file=r\"{}\", config_file=r\"{}\"); '\n            'cov.start();'.format(\n                os.path.abspath(\".coverage\"), os.path.abspath(tmp_coveragerc)))\n        cmd_post = (\n            'cov.stop(); '\n            'from astropy.tests.helper import _save_coverage; '\n            '_save_coverage(cov, result, r\"{}\", r\"{}\");'.format(\n                os.path.abspath('.'), os.path.abspath(self.testing_path)))\n\n        return cmd_pre, cmd_post"},{"col":4,"comment":"\n        Run the tests!\n        ","endLoc":253,"header":"def run(self)","id":9686,"name":"run","nodeType":"Function","startLoc":183,"text":"def run(self):\n        \"\"\"\n        Run the tests!\n        \"\"\"\n\n        # Install the runtime dependencies.\n        if self.distribution.install_requires:\n            self.distribution.fetch_build_eggs(self.distribution.install_requires)\n\n        # Ensure there is a doc path\n        if self.docs_path is None:\n            cfg_docs_dir = self.distribution.get_option_dict('build_docs').get('source_dir', None)\n\n            # Some affiliated packages use this.\n            # See astropy/package-template#157\n            if cfg_docs_dir is not None and os.path.exists(cfg_docs_dir[1]):\n                self.docs_path = os.path.abspath(cfg_docs_dir[1])\n\n            # fall back on a default path of \"docs\"\n            elif os.path.exists('docs'):  # pragma: no cover\n                self.docs_path = os.path.abspath('docs')\n\n        # Build a testing install of the package\n        self._build_temp_install()\n\n        # Install the test dependencies\n        # NOTE: we do this here after _build_temp_install because there is\n        # a weird but which occurs if psutil is installed in this way before\n        # astropy is built, Cython can have segmentation fault. Strange, eh?\n        if self.distribution.tests_require:\n            self.distribution.fetch_build_eggs(self.distribution.tests_require)\n\n        # Copy any additional dependencies that may have been installed via\n        # tests_requires or install_requires. We then pass the\n        # add_local_eggs_to_path=True option to package.test() to make sure the\n        # eggs get included in the path.\n        if os.path.exists('.eggs'):\n            shutil.copytree('.eggs', os.path.join(self.testing_path, '.eggs'))\n\n        # This option exists so that we can make sure that the tests don't\n        # write to an installed location.\n        if self.readonly:\n            log.info('changing permissions of temporary installation to read-only')\n            self._change_permissions_testing_path(writable=False)\n\n        # Run everything in a try: finally: so that the tmp dir gets deleted.\n        try:\n            # Construct this modules testing command\n            cmd = self.generate_testing_command()\n\n            # Run the tests in a subprocess--this is necessary since\n            # new extension modules may have appeared, and this is the\n            # easiest way to set up a new environment\n\n            testproc = subprocess.Popen(\n                [sys.executable, '-c', cmd],\n                cwd=self.testing_path, close_fds=False)\n            retcode = testproc.wait()\n        except KeyboardInterrupt:\n            import signal\n            # If a keyboard interrupt is handled, pass it to the test\n            # subprocess to prompt pytest to initiate its teardown\n            testproc.send_signal(signal.SIGINT)\n            retcode = testproc.wait()\n        finally:\n            # Remove temporary directory\n            if self.readonly:\n                self._change_permissions_testing_path(writable=True)\n            shutil.rmtree(self.tmp_dir)\n\n        raise SystemExit(retcode)"},{"col":4,"comment":"null","endLoc":327,"header":"def __call__(self, func)","id":9687,"name":"__call__","nodeType":"Function","startLoc":318,"text":"def __call__(self, func):\n        @functools.wraps(func)\n        def wrapper(*args, **kwargs):\n            # Originally this just reused self, but that doesn't work if the\n            # function is called more than once so we need to make a new\n            # context manager instance for each call\n            with self.__class__(category=self.category):\n                return func(*args, **kwargs)\n\n        return wrapper"},{"col":0,"comment":"\n    Set up all of the standard metric prefixes for a unit.  This\n    function should not be used directly, but instead use the\n    `prefixes` kwarg on `def_unit`.\n\n    Parameters\n    ----------\n    excludes : list of str, optional\n        Any prefixes to exclude from creation to avoid namespace\n        collisions.\n\n    namespace : dict, optional\n        When provided, inject the unit (and all of its aliases) into\n        the given namespace dictionary.\n\n    prefixes : list, optional\n        When provided, it is a list of prefix definitions of the form:\n\n            (short_names, long_tables, factor)\n    ","endLoc":2456,"header":"def _add_prefixes(u, excludes=[], namespace=None, prefixes=False)","id":9688,"name":"_add_prefixes","nodeType":"Function","startLoc":2401,"text":"def _add_prefixes(u, excludes=[], namespace=None, prefixes=False):\n    \"\"\"\n    Set up all of the standard metric prefixes for a unit.  This\n    function should not be used directly, but instead use the\n    `prefixes` kwarg on `def_unit`.\n\n    Parameters\n    ----------\n    excludes : list of str, optional\n        Any prefixes to exclude from creation to avoid namespace\n        collisions.\n\n    namespace : dict, optional\n        When provided, inject the unit (and all of its aliases) into\n        the given namespace dictionary.\n\n    prefixes : list, optional\n        When provided, it is a list of prefix definitions of the form:\n\n            (short_names, long_tables, factor)\n    \"\"\"\n    if prefixes is True:\n        prefixes = si_prefixes\n    elif prefixes is False:\n        prefixes = []\n\n    for short, full, factor in prefixes:\n        names = []\n        format = {}\n        for prefix in short:\n            if prefix in excludes:\n                continue\n\n            for alias in u.short_names:\n                names.append(prefix + alias)\n\n                # This is a hack to use Greek mu as a prefix\n                # for some formatters.\n                if prefix == 'u':\n                    format['latex'] = r'\\mu ' + u.get_format_name('latex')\n                    format['unicode'] = '\\N{MICRO SIGN}' + u.get_format_name('unicode')\n\n                for key, val in u._format.items():\n                    format.setdefault(key, prefix + val)\n\n        for prefix in full:\n            if prefix in excludes:\n                continue\n\n            for alias in u.long_names:\n                names.append(prefix + alias)\n\n        if len(names):\n            PrefixUnit(names, CompositeUnit(factor, [u], [1],\n                                            _error_check=False),\n                       namespace=namespace, format=format)"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":9689,"name":"_ns","nodeType":"Attribute","startLoc":14,"text":"_ns"},{"attributeType":"null","col":0,"comment":"null","endLoc":222,"id":9690,"name":"bases","nodeType":"Attribute","startLoc":222,"text":"bases"},{"col":0,"comment":"","endLoc":7,"header":"si.py#<anonymous>","id":9691,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis package defines the SI units.  They are also available in the\n`astropy.units` namespace.\n\n\"\"\"\n\n_ns = globals()\n\ndef_unit(['percent', 'pct'], Unit(0.01), namespace=_ns, prefixes=False,\n         doc=\"percent: one hundredth of unity, factor 0.01\",\n         format={'generic': '%', 'console': '%', 'cds': '%',\n                 'latex': r'\\%', 'unicode': '%'})\n\ndef_unit(['m', 'meter'], namespace=_ns, prefixes=True,\n         doc=\"meter: base unit of length in SI\")\n\ndef_unit(['micron'], um, namespace=_ns,\n         doc=\"micron: alias for micrometer (um)\",\n         format={'latex': r'\\mu m', 'unicode': '\\N{MICRO SIGN}m'})\n\ndef_unit(['Angstrom', 'AA', 'angstrom'], 0.1 * nm, namespace=_ns,\n         doc=\"ångström: 10 ** -10 m\",\n         prefixes=[(['m', 'milli'], ['milli', 'm'], 1.e-3)],\n         format={'latex': r'\\mathring{A}', 'unicode': 'Å',\n                 'vounit': 'Angstrom'})\n\ndef_unit((['l', 'L'], ['liter']), 1000 * cm ** 3.0, namespace=_ns, prefixes=True,\n         format={'latex': r'\\mathcal{l}', 'unicode': 'ℓ'},\n         doc=\"liter: metric unit of volume\")\n\ndef_unit(['rad', 'radian'], namespace=_ns, prefixes=True,\n         doc=\"radian: angular measurement of the ratio between the length \"\n         \"on an arc and its radius\")\n\ndef_unit(['deg', 'degree'], _numpy.pi / 180.0 * rad, namespace=_ns,\n         prefixes=True,\n         doc=\"degree: angular measurement 1/360 of full rotation\",\n         format={'latex': r'{}^{\\circ}', 'unicode': '°'})\n\ndef_unit(['hourangle'], 15.0 * deg, namespace=_ns, prefixes=False,\n         doc=\"hour angle: angular measurement with 24 in a full circle\",\n         format={'latex': r'{}^{h}', 'unicode': 'ʰ'})\n\ndef_unit(['arcmin', 'arcminute'], 1.0 / 60.0 * deg, namespace=_ns,\n         prefixes=True,\n         doc=\"arc minute: angular measurement\",\n         format={'latex': r'{}^{\\prime}', 'unicode': '′'})\n\ndef_unit(['arcsec', 'arcsecond'], 1.0 / 3600.0 * deg, namespace=_ns,\n         prefixes=True,\n         doc=\"arc second: angular measurement\")\n\narcsec._format = {'latex': r'{}^{\\prime\\prime}', 'unicode': '″'}\n\ndef_unit(['mas'], 0.001 * arcsec, namespace=_ns,\n         doc=\"milli arc second: angular measurement\")\n\ndef_unit(['uas'], 0.000001 * arcsec, namespace=_ns,\n         doc=\"micro arc second: angular measurement\",\n         format={'latex': r'\\mu as', 'unicode': 'μas'})\n\ndef_unit(['sr', 'steradian'], rad ** 2, namespace=_ns, prefixes=True,\n         doc=\"steradian: unit of solid angle in SI\")\n\ndef_unit(['s', 'second'], namespace=_ns, prefixes=True,\n         exclude_prefixes=['a'],\n         doc=\"second: base unit of time in SI.\")\n\ndef_unit(['min', 'minute'], 60 * s, prefixes=True, namespace=_ns)\n\ndef_unit(['h', 'hour', 'hr'], 3600 * s, namespace=_ns, prefixes=True,\n         exclude_prefixes=['p'])\n\ndef_unit(['d', 'day'], 24 * h, namespace=_ns, prefixes=True,\n         exclude_prefixes=['c', 'y'])\n\ndef_unit(['sday'], 86164.09053 * s, namespace=_ns,\n         doc=\"Sidereal day (sday) is the time of one rotation of the Earth.\")\n\ndef_unit(['wk', 'week'], 7 * day, namespace=_ns)\n\ndef_unit(['fortnight'], 2 * wk, namespace=_ns)\n\ndef_unit(['a', 'annum'], 365.25 * d, namespace=_ns, prefixes=True,\n         exclude_prefixes=['P'])\n\ndef_unit(['yr', 'year'], 365.25 * d, namespace=_ns, prefixes=True)\n\ndef_unit(['Hz', 'Hertz', 'hertz'], 1 / s, namespace=_ns, prefixes=True,\n         doc=\"Frequency\")\n\ndef_unit(['kg', 'kilogram'], namespace=_ns,\n         doc=\"kilogram: base unit of mass in SI.\")\n\ndef_unit(['g', 'gram'], 1.0e-3 * kg, namespace=_ns, prefixes=True,\n         exclude_prefixes=['k', 'kilo'])\n\ndef_unit(['t', 'tonne'], 1000 * kg, namespace=_ns,\n         doc=\"Metric tonne\")\n\ndef_unit(['mol', 'mole'], namespace=_ns, prefixes=True,\n         doc=\"mole: amount of a chemical substance in SI.\")\n\ndef_unit(\n    ['K', 'Kelvin'], namespace=_ns, prefixes=True,\n    doc=\"Kelvin: temperature with a null point at absolute zero.\")\n\ndef_unit(\n    ['deg_C', 'Celsius'], namespace=_ns, doc='Degrees Celsius',\n    format={'latex': r'{}^{\\circ}C', 'unicode': '°C'})\n\ndef_unit(['N', 'Newton', 'newton'], kg * m * s ** -2, namespace=_ns,\n         prefixes=True, doc=\"Newton: force\")\n\ndef_unit(['J', 'Joule', 'joule'], N * m, namespace=_ns, prefixes=True,\n         doc=\"Joule: energy\")\n\ndef_unit(['eV', 'electronvolt'], _si.e.value * J, namespace=_ns, prefixes=True,\n         doc=\"Electron Volt\")\n\ndef_unit(['Pa', 'Pascal', 'pascal'], J * m ** -3, namespace=_ns, prefixes=True,\n         doc=\"Pascal: pressure\")\n\ndef_unit(['W', 'Watt', 'watt'], J / s, namespace=_ns, prefixes=True,\n         doc=\"Watt: power\")\n\ndef_unit(['A', 'ampere', 'amp'], namespace=_ns, prefixes=True,\n         doc=\"ampere: base unit of electric current in SI\")\n\ndef_unit(['C', 'coulomb'], A * s, namespace=_ns, prefixes=True,\n         doc=\"coulomb: electric charge\")\n\ndef_unit(['V', 'Volt', 'volt'], J * C ** -1, namespace=_ns, prefixes=True,\n         doc=\"Volt: electric potential or electromotive force\")\n\ndef_unit((['Ohm', 'ohm'], ['Ohm']), V * A ** -1, namespace=_ns, prefixes=True,\n         doc=\"Ohm: electrical resistance\",\n         format={'latex': r'\\Omega', 'unicode': 'Ω'})\n\ndef_unit(['S', 'Siemens', 'siemens'], A * V ** -1, namespace=_ns,\n         prefixes=True, doc=\"Siemens: electrical conductance\")\n\ndef_unit(['F', 'Farad', 'farad'], C * V ** -1, namespace=_ns, prefixes=True,\n         doc=\"Farad: electrical capacitance\")\n\ndef_unit(['Wb', 'Weber', 'weber'], V * s, namespace=_ns, prefixes=True,\n         doc=\"Weber: magnetic flux\")\n\ndef_unit(['T', 'Tesla', 'tesla'], Wb * m ** -2, namespace=_ns, prefixes=True,\n         doc=\"Tesla: magnetic flux density\")\n\ndef_unit(['H', 'Henry', 'henry'], Wb * A ** -1, namespace=_ns, prefixes=True,\n         doc=\"Henry: inductance\")\n\ndef_unit(['cd', 'candela'], namespace=_ns, prefixes=True,\n         doc=\"candela: base unit of luminous intensity in SI\")\n\ndef_unit(['lm', 'lumen'], cd * sr, namespace=_ns, prefixes=True,\n         doc=\"lumen: luminous flux\")\n\ndef_unit(['lx', 'lux'], lm * m ** -2, namespace=_ns, prefixes=True,\n         doc=\"lux: luminous emittance\")\n\ndef_unit(['Bq', 'becquerel'], 1 / s, namespace=_ns, prefixes=False,\n         doc=\"becquerel: unit of radioactivity\")\n\ndef_unit(['Ci', 'curie'], Bq * 3.7e10, namespace=_ns, prefixes=False,\n         doc=\"curie: unit of radioactivity\")\n\nbases = set([m, s, kg, A, cd, rad, K, mol])\n\ndel UnitBase\n\ndel Unit\n\ndel def_unit\n\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())"},{"col":4,"comment":"\n        Install the package and to a temporary directory for the purposes of\n        testing. This allows us to test the install command, include the\n        entry points, and also avoids creating pyc and __pycache__ directories\n        inside the build directory\n        ","endLoc":300,"header":"def _build_temp_install(self)","id":9692,"name":"_build_temp_install","nodeType":"Function","startLoc":255,"text":"def _build_temp_install(self):\n        \"\"\"\n        Install the package and to a temporary directory for the purposes of\n        testing. This allows us to test the install command, include the\n        entry points, and also avoids creating pyc and __pycache__ directories\n        inside the build directory\n        \"\"\"\n\n        # On OSX the default path for temp files is under /var, but in most\n        # cases on OSX /var is actually a symlink to /private/var; ensure we\n        # dereference that link, because pytest is very sensitive to relative\n        # paths...\n\n        tmp_dir = tempfile.mkdtemp(prefix=self.package_name + '-test-',\n                                   dir=self.temp_root)\n        self.tmp_dir = os.path.realpath(tmp_dir)\n\n        log.info(f'installing to temporary directory: {self.tmp_dir}')\n\n        # We now install the package to the temporary directory. We do this\n        # rather than build and copy because this will ensure that e.g. entry\n        # points work.\n        self.reinitialize_command('install')\n        install_cmd = self.distribution.get_command_obj('install')\n        install_cmd.prefix = self.tmp_dir\n        if self.verbose_install:\n            self.run_command('install')\n        else:\n            with _suppress_stdout():\n                self.run_command('install')\n\n        # We now get the path to the site-packages directory that was created\n        # inside self.tmp_dir\n        install_cmd = self.get_finalized_command('install')\n        self.testing_path = install_cmd.install_lib\n\n        # Ideally, docs_path is set properly in run(), but if it is still\n        # not set here, do not pretend it is, otherwise bad things happen.\n        # See astropy/package-template#157\n        if self.docs_path is not None:\n            new_docs_path = os.path.join(self.testing_path,\n                                         os.path.basename(self.docs_path))\n            shutil.copytree(self.docs_path, new_docs_path)\n            self.docs_path = new_docs_path\n\n        shutil.copy('setup.cfg', self.testing_path)"},{"col":0,"comment":"","endLoc":6,"header":"table_helpers.py#<anonymous>","id":9693,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nHelper functions for table development, mostly creating useful\ntables for testing.\n\"\"\""},{"col":4,"comment":"null","endLoc":336,"header":"def __enter__(self)","id":9694,"name":"__enter__","nodeType":"Function","startLoc":329,"text":"def __enter__(self):\n        retval = super().__enter__()\n        if self.category is not None:\n            for category in self.category:\n                warnings.simplefilter('ignore', category)\n        else:\n            warnings.simplefilter('ignore')\n        return retval"},{"attributeType":"null","col":12,"comment":"null","endLoc":316,"id":9695,"name":"category","nodeType":"Attribute","startLoc":316,"text":"self.category"},{"fileName":"cgs.py","filePath":"astropy/units","id":9696,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis package defines the CGS units.  They are also available in the\ntop-level `astropy.units` namespace.\n\n\"\"\"\n\nfrom fractions import Fraction\n\nfrom . import si\nfrom .core import UnitBase, def_unit\n\n\n_ns = globals()\n\ndef_unit(['cm', 'centimeter'], si.cm, namespace=_ns, prefixes=False)\ng = si.g\ns = si.s\nC = si.C\nrad = si.rad\nsr = si.sr\ncd = si.cd\nK = si.K\ndeg_C = si.deg_C\nmol = si.mol\n\n\n##########################################################################\n# ACCELERATION\n\ndef_unit(['Gal', 'gal'], cm / s ** 2, namespace=_ns, prefixes=True,\n         doc=\"Gal: CGS unit of acceleration\")\n\n\n##########################################################################\n# ENERGY\n\n# Use CGS definition of erg\ndef_unit(['erg'], g * cm ** 2 / s ** 2, namespace=_ns, prefixes=True,\n         doc=\"erg: CGS unit of energy\")\n\n\n##########################################################################\n# FORCE\n\ndef_unit(['dyn', 'dyne'], g * cm / s ** 2, namespace=_ns,\n         prefixes=True,\n         doc=\"dyne: CGS unit of force\")\n\n\n##########################################################################\n# PRESSURE\n\ndef_unit(['Ba', 'Barye', 'barye'], g / (cm * s ** 2), namespace=_ns,\n         prefixes=True,\n         doc=\"Barye: CGS unit of pressure\")\n\n\n##########################################################################\n# DYNAMIC VISCOSITY\n\ndef_unit(['P', 'poise'], g / (cm * s), namespace=_ns,\n         prefixes=True,\n         doc=\"poise: CGS unit of dynamic viscosity\")\n\n\n##########################################################################\n# KINEMATIC VISCOSITY\n\ndef_unit(['St', 'stokes'], cm ** 2 / s, namespace=_ns,\n         prefixes=True,\n         doc=\"stokes: CGS unit of kinematic viscosity\")\n\n\n##########################################################################\n# WAVENUMBER\n\ndef_unit(['k', 'Kayser', 'kayser'], cm ** -1, namespace=_ns,\n         prefixes=True,\n         doc=\"kayser: CGS unit of wavenumber\")\n\n\n###########################################################################\n# ELECTRICAL\n\ndef_unit(['D', 'Debye', 'debye'], Fraction(1, 3) * 1e-29 * C * si.m,\n         namespace=_ns, prefixes=True,\n         doc=\"Debye: CGS unit of electric dipole moment\")\n\ndef_unit(['Fr', 'Franklin', 'statcoulomb', 'statC', 'esu'],\n         g ** Fraction(1, 2) * cm ** Fraction(3, 2) * s ** -1,\n         namespace=_ns,\n         doc='Franklin: CGS (ESU) unit of charge')\n\ndef_unit(['statA', 'statampere'], Fr * s ** -1, namespace=_ns,\n         doc='statampere: CGS (ESU) unit of current')\n\ndef_unit(['Bi', 'Biot', 'abA', 'abampere'],\n         g ** Fraction(1, 2) * cm ** Fraction(1, 2) * s ** -1, namespace=_ns,\n         doc='Biot: CGS (EMU) unit of current')\n\ndef_unit(['abC', 'abcoulomb'], Bi * s, namespace=_ns,\n         doc='abcoulomb: CGS (EMU) of charge')\n\n###########################################################################\n# MAGNETIC\n\ndef_unit(['G', 'Gauss', 'gauss'], 1e-4 * si.T, namespace=_ns, prefixes=True,\n         doc=\"Gauss: CGS unit for magnetic field\")\n\n\n###########################################################################\n# BASES\n\nbases = set([cm, g, s, rad, cd, K, mol])\n\n\n###########################################################################\n# CLEANUP\n\ndel UnitBase\ndel def_unit\ndel si\ndel Fraction\n\n\n###########################################################################\n# DOCSTRING\n\n# This generates a docstring for this module that describes all of the\n# standard units defined here.\nfrom .utils import generate_unit_summary as _generate_unit_summary\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())\n"},{"col":0,"comment":"\n    This method is called after the tests have been run in coverage mode\n    to cleanup and then save the coverage data and report.\n    ","endLoc":65,"header":"def _save_coverage(cov, result, rootdir, testing_path)","id":9697,"name":"_save_coverage","nodeType":"Function","startLoc":28,"text":"def _save_coverage(cov, result, rootdir, testing_path):\n    \"\"\"\n    This method is called after the tests have been run in coverage mode\n    to cleanup and then save the coverage data and report.\n    \"\"\"\n    from astropy.utils.console import color_print\n\n    if result != 0:\n        return\n\n    # The coverage report includes the full path to the temporary\n    # directory, so we replace all the paths with the true source\n    # path. Note that this will not work properly for packages that still\n    # rely on 2to3.\n    try:\n        # Coverage 4.0: _harvest_data has been renamed to get_data, the\n        # lines dict is private\n        cov.get_data()\n    except AttributeError:\n        # Coverage < 4.0\n        cov._harvest_data()\n        lines = cov.data.lines\n    else:\n        lines = cov.data._lines\n\n    for key in list(lines.keys()):\n        new_path = os.path.relpath(\n            os.path.realpath(key),\n            os.path.realpath(testing_path))\n        new_path = os.path.abspath(\n            os.path.join(rootdir, new_path))\n        lines[new_path] = lines.pop(key)\n\n    color_print('Saving coverage data in .coverage...', 'green')\n    cov.save()\n\n    color_print('Saving HTML coverage report in htmlcov...', 'green')\n    cov.html_report(directory=os.path.join(rootdir, 'htmlcov'))"},{"col":0,"comment":"\n    Enable deprecated units so they appear in results of\n    `~astropy.units.UnitBase.find_equivalent_units` and\n    `~astropy.units.UnitBase.compose`.\n\n    This may be used with the ``with`` statement to enable deprecated\n    units only temporarily.\n    ","endLoc":68,"header":"def enable()","id":9698,"name":"enable","nodeType":"Function","startLoc":55,"text":"def enable():\n    \"\"\"\n    Enable deprecated units so they appear in results of\n    `~astropy.units.UnitBase.find_equivalent_units` and\n    `~astropy.units.UnitBase.compose`.\n\n    This may be used with the ``with`` statement to enable deprecated\n    units only temporarily.\n    \"\"\"\n    # Local import to avoid cyclical import\n    from .core import add_enabled_units\n    # Local import to avoid polluting namespace\n    import inspect\n    return add_enabled_units(inspect.getmodule(enable))"},{"col":0,"comment":"\n    Adds to the set of units enabled in the unit registry.\n\n    These units are searched when using\n    `UnitBase.find_equivalent_units`, for example.\n\n    This may be used either permanently, or as a context manager using\n    the ``with`` statement (see example below).\n\n    Parameters\n    ----------\n    units : list of sequence, dict, or module\n        This is a list of things in which units may be found\n        (sequences, dicts or modules), or units themselves.  The\n        entire set will be added to the \"enabled\" set for searching\n        through by methods like `UnitBase.find_equivalent_units` and\n        `UnitBase.compose`.\n\n    Examples\n    --------\n\n    >>> from astropy import units as u\n    >>> from astropy.units import imperial\n    >>> with u.add_enabled_units(imperial):\n    ...     u.m.find_equivalent_units()\n    ...\n      Primary name | Unit definition | Aliases\n    [\n      AU           | 1.49598e+11 m   | au, astronomical_unit            ,\n      Angstrom     | 1e-10 m         | AA, angstrom                     ,\n      cm           | 0.01 m          | centimeter                       ,\n      earthRad     | 6.3781e+06 m    | R_earth, Rearth                  ,\n      ft           | 0.3048 m        | foot                             ,\n      fur          | 201.168 m       | furlong                          ,\n      inch         | 0.0254 m        |                                  ,\n      jupiterRad   | 7.1492e+07 m    | R_jup, Rjup, R_jupiter, Rjupiter ,\n      lsec         | 2.99792e+08 m   | lightsecond                      ,\n      lyr          | 9.46073e+15 m   | lightyear                        ,\n      m            | irreducible     | meter                            ,\n      mi           | 1609.34 m       | mile                             ,\n      micron       | 1e-06 m         |                                  ,\n      mil          | 2.54e-05 m      | thou                             ,\n      nmi          | 1852 m          | nauticalmile, NM                 ,\n      pc           | 3.08568e+16 m   | parsec                           ,\n      solRad       | 6.957e+08 m     | R_sun, Rsun                      ,\n      yd           | 0.9144 m        | yard                             ,\n    ]\n    ","endLoc":451,"header":"def add_enabled_units(units)","id":9699,"name":"add_enabled_units","nodeType":"Function","startLoc":398,"text":"def add_enabled_units(units):\n    \"\"\"\n    Adds to the set of units enabled in the unit registry.\n\n    These units are searched when using\n    `UnitBase.find_equivalent_units`, for example.\n\n    This may be used either permanently, or as a context manager using\n    the ``with`` statement (see example below).\n\n    Parameters\n    ----------\n    units : list of sequence, dict, or module\n        This is a list of things in which units may be found\n        (sequences, dicts or modules), or units themselves.  The\n        entire set will be added to the \"enabled\" set for searching\n        through by methods like `UnitBase.find_equivalent_units` and\n        `UnitBase.compose`.\n\n    Examples\n    --------\n\n    >>> from astropy import units as u\n    >>> from astropy.units import imperial\n    >>> with u.add_enabled_units(imperial):\n    ...     u.m.find_equivalent_units()\n    ...\n      Primary name | Unit definition | Aliases\n    [\n      AU           | 1.49598e+11 m   | au, astronomical_unit            ,\n      Angstrom     | 1e-10 m         | AA, angstrom                     ,\n      cm           | 0.01 m          | centimeter                       ,\n      earthRad     | 6.3781e+06 m    | R_earth, Rearth                  ,\n      ft           | 0.3048 m        | foot                             ,\n      fur          | 201.168 m       | furlong                          ,\n      inch         | 0.0254 m        |                                  ,\n      jupiterRad   | 7.1492e+07 m    | R_jup, Rjup, R_jupiter, Rjupiter ,\n      lsec         | 2.99792e+08 m   | lightsecond                      ,\n      lyr          | 9.46073e+15 m   | lightyear                        ,\n      m            | irreducible     | meter                            ,\n      mi           | 1609.34 m       | mile                             ,\n      micron       | 1e-06 m         |                                  ,\n      mil          | 2.54e-05 m      | thou                             ,\n      nmi          | 1852 m          | nauticalmile, NM                 ,\n      pc           | 3.08568e+16 m   | parsec                           ,\n      solRad       | 6.957e+08 m     | R_sun, Rsun                      ,\n      yd           | 0.9144 m        | yard                             ,\n    ]\n    \"\"\"\n    # get a context with a new registry, which is a copy of the current one\n    context = _UnitContext(get_current_unit_registry())\n    # in this new current registry, enable the further units requested\n    get_current_unit_registry().add_enabled_units(units)\n    return context"},{"col":0,"comment":"\n    A context manager to temporarily disable stdout.\n\n    Used later when installing a temporary copy of astropy to avoid a\n    very verbose output.\n    ","endLoc":33,"header":"@contextmanager\ndef _suppress_stdout()","id":9700,"name":"_suppress_stdout","nodeType":"Function","startLoc":19,"text":"@contextmanager\ndef _suppress_stdout():\n    '''\n    A context manager to temporarily disable stdout.\n\n    Used later when installing a temporary copy of astropy to avoid a\n    very verbose output.\n    '''\n    with open(os.devnull, \"w\") as devnull:\n        old_stdout = sys.stdout\n        sys.stdout = devnull\n        try:\n            yield\n        finally:\n            sys.stdout = old_stdout"},{"col":0,"comment":"\n    Turn on the feature that turns deprecations into exceptions.\n\n    Parameters\n    ----------\n    include_astropy_deprecations : bool\n        If set to `True`, ``AstropyDeprecationWarning`` and\n        ``AstropyPendingDeprecationWarning`` are also turned into exceptions.\n\n    modules_to_ignore_on_import : list of str\n        List of additional modules that generate deprecation warnings\n        on import, which are to be ignored. By default, these are already\n        included: ``compiler``, ``scipy``, ``pygments``, ``ipykernel``, and\n        ``setuptools``.\n\n    warnings_to_ignore_entire_module : list of str\n        List of modules with deprecation warnings to ignore completely,\n        not just during import. If ``include_astropy_deprecations=True``\n        is given, ``AstropyDeprecationWarning`` and\n        ``AstropyPendingDeprecationWarning`` are also ignored for the modules.\n\n    warnings_to_ignore_by_pyver : dict\n        Dictionary mapping tuple of ``(major, minor)`` Python version to\n        a list of ``(warning_message, warning_class)`` to ignore.\n        Python version-agnostic warnings should be mapped to `None` key.\n        This is in addition of those already ignored by default\n        (see ``_warnings_to_ignore_by_pyver`` values).\n\n    ","endLoc":191,"header":"@deprecated('5.1', alternative='https://docs.pytest.org/en/stable/warnings.html')\ndef enable_deprecations_as_exceptions(include_astropy_deprecations=True,\n                                      modules_to_ignore_on_import=[],\n                                      warnings_to_ignore_entire_module=[],\n                                      warnings_to_ignore_by_pyver={})","id":9701,"name":"enable_deprecations_as_exceptions","nodeType":"Function","startLoc":140,"text":"@deprecated('5.1', alternative='https://docs.pytest.org/en/stable/warnings.html')\ndef enable_deprecations_as_exceptions(include_astropy_deprecations=True,\n                                      modules_to_ignore_on_import=[],\n                                      warnings_to_ignore_entire_module=[],\n                                      warnings_to_ignore_by_pyver={}):\n    \"\"\"\n    Turn on the feature that turns deprecations into exceptions.\n\n    Parameters\n    ----------\n    include_astropy_deprecations : bool\n        If set to `True`, ``AstropyDeprecationWarning`` and\n        ``AstropyPendingDeprecationWarning`` are also turned into exceptions.\n\n    modules_to_ignore_on_import : list of str\n        List of additional modules that generate deprecation warnings\n        on import, which are to be ignored. By default, these are already\n        included: ``compiler``, ``scipy``, ``pygments``, ``ipykernel``, and\n        ``setuptools``.\n\n    warnings_to_ignore_entire_module : list of str\n        List of modules with deprecation warnings to ignore completely,\n        not just during import. If ``include_astropy_deprecations=True``\n        is given, ``AstropyDeprecationWarning`` and\n        ``AstropyPendingDeprecationWarning`` are also ignored for the modules.\n\n    warnings_to_ignore_by_pyver : dict\n        Dictionary mapping tuple of ``(major, minor)`` Python version to\n        a list of ``(warning_message, warning_class)`` to ignore.\n        Python version-agnostic warnings should be mapped to `None` key.\n        This is in addition of those already ignored by default\n        (see ``_warnings_to_ignore_by_pyver`` values).\n\n    \"\"\"\n    global _deprecations_as_exceptions\n    _deprecations_as_exceptions = True\n\n    global _include_astropy_deprecations\n    _include_astropy_deprecations = include_astropy_deprecations\n\n    global _modules_to_ignore_on_import\n    _modules_to_ignore_on_import.update(modules_to_ignore_on_import)\n\n    global _warnings_to_ignore_entire_module\n    _warnings_to_ignore_entire_module.update(warnings_to_ignore_entire_module)\n\n    global _warnings_to_ignore_by_pyver\n    for key, val in warnings_to_ignore_by_pyver.items():\n        if key in _warnings_to_ignore_by_pyver:\n            _warnings_to_ignore_by_pyver[key].update(val)\n        else:\n            _warnings_to_ignore_by_pyver[key] = set(val)"},{"col":4,"comment":"null","endLoc":329,"header":"def __init__(self, init=[], equivalencies=[])","id":9702,"name":"__init__","nodeType":"Function","startLoc":327,"text":"def __init__(self, init=[], equivalencies=[]):\n        _unit_registries.append(\n            _UnitRegistry(init=init, equivalencies=equivalencies))"},{"col":0,"comment":"\n    Test that an object follows our Unicode policy.  See\n    \"Unicode guidelines\" in the coding guidelines.\n\n    Parameters\n    ----------\n    x : object\n        The instance to test\n\n    roundtrip : module, optional\n        When provided, this namespace will be used to evaluate\n        ``repr(x)`` and ensure that it roundtrips.  It will also\n        ensure that ``__bytes__(x)`` roundtrip.\n        If not provided, no roundtrip testing will be performed.\n    ","endLoc":395,"header":"def assert_follows_unicode_guidelines(\n        x, roundtrip=None)","id":9703,"name":"assert_follows_unicode_guidelines","nodeType":"Function","startLoc":339,"text":"def assert_follows_unicode_guidelines(\n        x, roundtrip=None):\n    \"\"\"\n    Test that an object follows our Unicode policy.  See\n    \"Unicode guidelines\" in the coding guidelines.\n\n    Parameters\n    ----------\n    x : object\n        The instance to test\n\n    roundtrip : module, optional\n        When provided, this namespace will be used to evaluate\n        ``repr(x)`` and ensure that it roundtrips.  It will also\n        ensure that ``__bytes__(x)`` roundtrip.\n        If not provided, no roundtrip testing will be performed.\n    \"\"\"\n    from astropy import conf\n\n    with conf.set_temp('unicode_output', False):\n        bytes_x = bytes(x)\n        unicode_x = str(x)\n        repr_x = repr(x)\n\n        assert isinstance(bytes_x, bytes)\n        bytes_x.decode('ascii')\n        assert isinstance(unicode_x, str)\n        unicode_x.encode('ascii')\n        assert isinstance(repr_x, str)\n        if isinstance(repr_x, bytes):\n            repr_x.decode('ascii')\n        else:\n            repr_x.encode('ascii')\n\n        if roundtrip is not None:\n            assert x.__class__(bytes_x) == x\n            assert x.__class__(unicode_x) == x\n            assert eval(repr_x, roundtrip) == x\n\n    with conf.set_temp('unicode_output', True):\n        bytes_x = bytes(x)\n        unicode_x = str(x)\n        repr_x = repr(x)\n\n        assert isinstance(bytes_x, bytes)\n        bytes_x.decode('ascii')\n        assert isinstance(unicode_x, str)\n        assert isinstance(repr_x, str)\n        if isinstance(repr_x, bytes):\n            repr_x.decode('ascii')\n        else:\n            repr_x.encode('ascii')\n\n        if roundtrip is not None:\n            assert x.__class__(bytes_x) == x\n            assert x.__class__(unicode_x) == x\n            assert eval(repr_x, roundtrip) == x"},{"col":4,"comment":"null","endLoc":135,"header":"def __init__(self, init=[], equivalencies=[], aliases={})","id":9704,"name":"__init__","nodeType":"Function","startLoc":112,"text":"def __init__(self, init=[], equivalencies=[], aliases={}):\n\n        if isinstance(init, _UnitRegistry):\n            # If passed another registry we don't need to rebuild everything.\n            # but because these are mutable types we don't want to create\n            # conflicts so everything needs to be copied.\n            self._equivalencies = init._equivalencies.copy()\n            self._aliases = init._aliases.copy()\n            self._all_units = init._all_units.copy()\n            self._registry = init._registry.copy()\n            self._non_prefix_units = init._non_prefix_units.copy()\n            # The physical type is a dictionary containing sets as values.\n            # All of these must be copied otherwise we could alter the old\n            # registry.\n            self._by_physical_type = {k: v.copy() for k, v in\n                                      init._by_physical_type.items()}\n\n        else:\n            self._reset_units()\n            self._reset_equivalencies()\n            self._reset_aliases()\n            self.add_enabled_units(init)\n            self.add_enabled_equivalencies(equivalencies)\n            self.add_enabled_aliases(aliases)"},{"col":4,"comment":"null","endLoc":311,"header":"def _change_permissions_testing_path(self, writable=False)","id":9705,"name":"_change_permissions_testing_path","nodeType":"Function","startLoc":302,"text":"def _change_permissions_testing_path(self, writable=False):\n        if writable:\n            basic_flags = stat.S_IRUSR | stat.S_IWUSR\n        else:\n            basic_flags = stat.S_IRUSR\n        for root, dirs, files in os.walk(self.testing_path):\n            for dirname in dirs:\n                os.chmod(os.path.join(root, dirname), basic_flags | stat.S_IXUSR)\n            for filename in files:\n                os.chmod(os.path.join(root, filename), basic_flags)"},{"col":0,"comment":"null","endLoc":113,"header":"@pytest.fixture(params=[True, False])\ndef tableclass(request)","id":9707,"name":"tableclass","nodeType":"Function","startLoc":111,"text":"@pytest.fixture(params=[True, False])\ndef tableclass(request):\n    return table.Table if request.param else SubclassTable"},{"col":0,"comment":"\n    Fixture to run all the tests for all available pickle protocols.\n    ","endLoc":121,"header":"@pytest.fixture(params=list(range(0, pickle.HIGHEST_PROTOCOL + 1)))\ndef protocol(request)","id":9708,"name":"protocol","nodeType":"Function","startLoc":116,"text":"@pytest.fixture(params=list(range(0, pickle.HIGHEST_PROTOCOL + 1)))\ndef protocol(request):\n    \"\"\"\n    Fixture to run all the tests for all available pickle protocols.\n    \"\"\"\n    return request.param"},{"col":4,"comment":"null","endLoc":141,"header":"def _reset_units(self)","id":9709,"name":"_reset_units","nodeType":"Function","startLoc":137,"text":"def _reset_units(self):\n        self._all_units = set()\n        self._non_prefix_units = set()\n        self._registry = {}\n        self._by_physical_type = {}"},{"col":4,"comment":"null","endLoc":144,"header":"def _reset_equivalencies(self)","id":9710,"name":"_reset_equivalencies","nodeType":"Function","startLoc":143,"text":"def _reset_equivalencies(self):\n        self._equivalencies = set()"},{"col":4,"comment":"null","endLoc":147,"header":"def _reset_aliases(self)","id":9711,"name":"_reset_aliases","nodeType":"Function","startLoc":146,"text":"def _reset_aliases(self):\n        self._aliases = {}"},{"col":0,"comment":"\n    Fixture to run all the tests for protocols 0 and 1, and -1 (most advanced).\n    (Originally from astropy.table.tests.test_pickle)\n    ","endLoc":404,"header":"@pytest.fixture(params=[0, 1, -1])\ndef pickle_protocol(request)","id":9712,"name":"pickle_protocol","nodeType":"Function","startLoc":398,"text":"@pytest.fixture(params=[0, 1, -1])\ndef pickle_protocol(request):\n    \"\"\"\n    Fixture to run all the tests for protocols 0 and 1, and -1 (most advanced).\n    (Originally from astropy.table.tests.test_pickle)\n    \"\"\"\n    return request.param"},{"col":4,"comment":"\n        Adds to the set of units enabled in the unit registry.\n\n        These units are searched when using\n        `UnitBase.find_equivalent_units`, for example.\n\n        Parameters\n        ----------\n        units : list of sequence, dict, or module\n            This is a list of things in which units may be found\n            (sequences, dicts or modules), or units themselves.  The\n            entire set will be added to the \"enabled\" set for\n            searching through by methods like\n            `UnitBase.find_equivalent_units` and `UnitBase.compose`.\n        ","endLoc":216,"header":"def add_enabled_units(self, units)","id":9713,"name":"add_enabled_units","nodeType":"Function","startLoc":180,"text":"def add_enabled_units(self, units):\n        \"\"\"\n        Adds to the set of units enabled in the unit registry.\n\n        These units are searched when using\n        `UnitBase.find_equivalent_units`, for example.\n\n        Parameters\n        ----------\n        units : list of sequence, dict, or module\n            This is a list of things in which units may be found\n            (sequences, dicts or modules), or units themselves.  The\n            entire set will be added to the \"enabled\" set for\n            searching through by methods like\n            `UnitBase.find_equivalent_units` and `UnitBase.compose`.\n        \"\"\"\n        units = _flatten_units_collection(units)\n\n        for unit in units:\n            # Loop through all of the names first, to ensure all of them\n            # are new, then add them all as a single \"transaction\" below.\n            for st in unit._names:\n                if (st in self._registry and unit != self._registry[st]):\n                    raise ValueError(\n                        \"Object with name {!r} already exists in namespace. \"\n                        \"Filter the set of units to avoid name clashes before \"\n                        \"enabling them.\".format(st))\n\n            for st in unit._names:\n                self._registry[st] = unit\n\n            self._all_units.add(unit)\n            if not isinstance(unit, PrefixUnit):\n                self._non_prefix_units.add(unit)\n\n            hash = unit._get_physical_type_id()\n            self._by_physical_type.setdefault(hash, set()).add(unit)"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":9714,"name":"_ns","nodeType":"Attribute","startLoc":15,"text":"_ns"},{"col":0,"comment":"\n    Check if the attributes of a and b are equal. Then,\n    check if the attributes of the attributes are equal.\n    ","endLoc":432,"header":"def generic_recursive_equality_test(a, b, class_history)","id":9715,"name":"generic_recursive_equality_test","nodeType":"Function","startLoc":407,"text":"def generic_recursive_equality_test(a, b, class_history):\n    \"\"\"\n    Check if the attributes of a and b are equal. Then,\n    check if the attributes of the attributes are equal.\n    \"\"\"\n    dict_a = a.__getstate__() if hasattr(a, '__getstate__') else a.__dict__\n    dict_b = b.__dict__\n    for key in dict_a:\n        assert key in dict_b,\\\n          f\"Did not pickle {key}\"\n        if hasattr(dict_a[key], '__eq__'):\n            eq = (dict_a[key] == dict_b[key])\n            if '__iter__' in dir(eq):\n                eq = (False not in eq)\n            assert eq, f\"Value of {key} changed by pickling\"\n\n        if hasattr(dict_a[key], '__dict__'):\n            if dict_a[key].__class__ in class_history:\n                # attempt to prevent infinite recursion\n                pass\n            else:\n                new_class_history = [dict_a[key].__class__]\n                new_class_history.extend(class_history)\n                generic_recursive_equality_test(dict_a[key],\n                                                dict_b[key],\n                                                new_class_history)"},{"attributeType":"null","col":4,"comment":"null","endLoc":64,"id":9716,"name":"description","nodeType":"Attribute","startLoc":64,"text":"description"},{"attributeType":"null","col":4,"comment":"null","endLoc":66,"id":9717,"name":"user_options","nodeType":"Attribute","startLoc":66,"text":"user_options"},{"attributeType":"null","col":4,"comment":"null","endLoc":120,"id":9718,"name":"package_name","nodeType":"Attribute","startLoc":120,"text":"package_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":132,"id":9719,"name":"coverage","nodeType":"Attribute","startLoc":132,"text":"self.coverage"},{"attributeType":"null","col":8,"comment":"null","endLoc":289,"id":9720,"name":"testing_path","nodeType":"Attribute","startLoc":289,"text":"self.testing_path"},{"attributeType":"None","col":8,"comment":"null","endLoc":138,"id":9721,"name":"temp_root","nodeType":"Attribute","startLoc":138,"text":"self.temp_root"},{"attributeType":"None","col":8,"comment":"null","endLoc":123,"id":9722,"name":"package","nodeType":"Attribute","startLoc":123,"text":"self.package"},{"attributeType":"null","col":8,"comment":"null","endLoc":125,"id":9723,"name":"verbose_results","nodeType":"Attribute","startLoc":125,"text":"self.verbose_results"},{"attributeType":"None","col":8,"comment":"null","endLoc":126,"id":9724,"name":"plugins","nodeType":"Attribute","startLoc":126,"text":"self.plugins"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":9725,"name":"g","nodeType":"Attribute","startLoc":18,"text":"g"},{"attributeType":"null","col":8,"comment":"null","endLoc":130,"id":9726,"name":"pep8","nodeType":"Attribute","startLoc":130,"text":"self.pep8"},{"attributeType":"null","col":8,"comment":"null","endLoc":136,"id":9727,"name":"skip_docs","nodeType":"Attribute","startLoc":136,"text":"self.skip_docs"},{"attributeType":"null","col":8,"comment":"null","endLoc":129,"id":9728,"name":"remote_data","nodeType":"Attribute","startLoc":129,"text":"self.remote_data"},{"attributeType":"null","col":8,"comment":"null","endLoc":131,"id":9729,"name":"pdb","nodeType":"Attribute","startLoc":131,"text":"self.pdb"},{"attributeType":"null","col":8,"comment":"null","endLoc":270,"id":9730,"name":"tmp_dir","nodeType":"Attribute","startLoc":270,"text":"self.tmp_dir"},{"attributeType":"None","col":8,"comment":"null","endLoc":128,"id":9731,"name":"args","nodeType":"Attribute","startLoc":128,"text":"self.args"},{"attributeType":"None","col":8,"comment":"null","endLoc":124,"id":9732,"name":"test_path","nodeType":"Attribute","startLoc":124,"text":"self.test_path"},{"attributeType":"null","col":8,"comment":"null","endLoc":140,"id":9733,"name":"readonly","nodeType":"Attribute","startLoc":140,"text":"self.readonly"},{"attributeType":"null","col":8,"comment":"null","endLoc":133,"id":9734,"name":"open_files","nodeType":"Attribute","startLoc":133,"text":"self.open_files"},{"attributeType":"null","col":8,"comment":"null","endLoc":134,"id":9735,"name":"parallel","nodeType":"Attribute","startLoc":134,"text":"self.parallel"},{"attributeType":"None","col":8,"comment":"null","endLoc":137,"id":9736,"name":"repeat","nodeType":"Attribute","startLoc":137,"text":"self.repeat"},{"col":0,"comment":"\n    Try to pickle an object. If successful, make sure\n    the object's attributes survived pickling and unpickling.\n    ","endLoc":444,"header":"def check_pickling_recovery(original, protocol)","id":9737,"name":"check_pickling_recovery","nodeType":"Function","startLoc":435,"text":"def check_pickling_recovery(original, protocol):\n    \"\"\"\n    Try to pickle an object. If successful, make sure\n    the object's attributes survived pickling and unpickling.\n    \"\"\"\n    f = pickle.dumps(original, protocol=protocol)\n    unpickled = pickle.loads(f)\n    class_history = [original.__class__]\n    generic_recursive_equality_test(original, unpickled,\n                                    class_history)"},{"attributeType":"None","col":8,"comment":"null","endLoc":135,"id":9738,"name":"docs_path","nodeType":"Attribute","startLoc":135,"text":"self.docs_path"},{"attributeType":"None","col":8,"comment":"null","endLoc":127,"id":9739,"name":"pastebin","nodeType":"Attribute","startLoc":127,"text":"self.pastebin"},{"col":0,"comment":"\n    Raise an assertion if two objects are not equal up to desired tolerance.\n\n    This is a :class:`~astropy.units.Quantity`-aware version of\n    :func:`numpy.testing.assert_allclose`.\n    ","endLoc":458,"header":"def assert_quantity_allclose(actual, desired, rtol=1.e-7, atol=None,\n                             **kwargs)","id":9740,"name":"assert_quantity_allclose","nodeType":"Function","startLoc":447,"text":"def assert_quantity_allclose(actual, desired, rtol=1.e-7, atol=None,\n                             **kwargs):\n    \"\"\"\n    Raise an assertion if two objects are not equal up to desired tolerance.\n\n    This is a :class:`~astropy.units.Quantity`-aware version of\n    :func:`numpy.testing.assert_allclose`.\n    \"\"\"\n    import numpy as np\n    from astropy.units.quantity import _unquantify_allclose_arguments\n    np.testing.assert_allclose(*_unquantify_allclose_arguments(\n        actual, desired, rtol, atol), **kwargs)"},{"attributeType":"null","col":8,"comment":"null","endLoc":139,"id":9741,"name":"verbose_install","nodeType":"Attribute","startLoc":139,"text":"self.verbose_install"},{"col":0,"comment":"","endLoc":6,"header":"command.py#<anonymous>","id":9742,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"Implements the wrapper for the Astropy test runner.\n\nThis is for backward-compatibility for other downstream packages and can be removed\nonce astropy-helpers has reached end-of-life.\n\n\"\"\""},{"attributeType":"null","col":38,"comment":"null","endLoc":14,"id":9743,"name":"quantity_allclose","nodeType":"Attribute","startLoc":14,"text":"quantity_allclose"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":9744,"name":"__all__","nodeType":"Attribute","startLoc":23,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":107,"id":9745,"name":"_deprecations_as_exceptions","nodeType":"Attribute","startLoc":107,"text":"_deprecations_as_exceptions"},{"attributeType":"null","col":0,"comment":"null","endLoc":108,"id":9746,"name":"_include_astropy_deprecations","nodeType":"Attribute","startLoc":108,"text":"_include_astropy_deprecations"},{"attributeType":"null","col":0,"comment":"null","endLoc":109,"id":9747,"name":"_modules_to_ignore_on_import","nodeType":"Attribute","startLoc":109,"text":"_modules_to_ignore_on_import"},{"attributeType":"null","col":0,"comment":"null","endLoc":116,"id":9748,"name":"_warnings_to_ignore_entire_module","nodeType":"Attribute","startLoc":116,"text":"_warnings_to_ignore_entire_module"},{"attributeType":"null","col":0,"comment":"null","endLoc":117,"id":9749,"name":"_warnings_to_ignore_by_pyver","nodeType":"Attribute","startLoc":117,"text":"_warnings_to_ignore_by_pyver"},{"fileName":"astrophys.py","filePath":"astropy/units","id":9750,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis package defines the astrophysics-specific units.  They are also\navailable in the `astropy.units` namespace.\n\"\"\"\n\n\nfrom . import si\nfrom astropy.constants import si as _si\nfrom .core import (UnitBase, def_unit, si_prefixes, binary_prefixes,\n                   set_enabled_units)\n\n# To ensure si units of the constants can be interpreted.\nset_enabled_units([si])\n\nimport numpy as _numpy\n\n_ns = globals()\n\n###########################################################################\n# LENGTH\n\ndef_unit((['AU', 'au'], ['astronomical_unit']), _si.au, namespace=_ns, prefixes=True,\n         doc=\"astronomical unit: approximately the mean Earth--Sun \"\n         \"distance.\")\n\ndef_unit(['pc', 'parsec'], _si.pc, namespace=_ns, prefixes=True,\n         doc=\"parsec: approximately 3.26 light-years.\")\n\ndef_unit(['solRad', 'R_sun', 'Rsun'], _si.R_sun, namespace=_ns,\n         doc=\"Solar radius\", prefixes=False,\n         format={'latex': r'R_{\\odot}', 'unicode': 'R\\N{SUN}'})\ndef_unit(['jupiterRad', 'R_jup', 'Rjup', 'R_jupiter', 'Rjupiter'],\n         _si.R_jup, namespace=_ns, prefixes=False, doc=\"Jupiter radius\",\n         # LaTeX jupiter symbol requires wasysym\n         format={'latex': r'R_{\\rm J}', 'unicode': 'R\\N{JUPITER}'})\ndef_unit(['earthRad', 'R_earth', 'Rearth'], _si.R_earth, namespace=_ns,\n         prefixes=False, doc=\"Earth radius\",\n         # LaTeX earth symbol requires wasysym\n         format={'latex': r'R_{\\oplus}', 'unicode': 'R⊕'})\n\ndef_unit(['lyr', 'lightyear'], (_si.c * si.yr).to(si.m),\n         namespace=_ns, prefixes=True, doc=\"Light year\")\ndef_unit(['lsec', 'lightsecond'], (_si.c * si.s).to(si.m),\n         namespace=_ns, prefixes=False, doc=\"Light second\")\n\n\n###########################################################################\n# MASS\n\ndef_unit(['solMass', 'M_sun', 'Msun'], _si.M_sun, namespace=_ns,\n         prefixes=False, doc=\"Solar mass\",\n         format={'latex': r'M_{\\odot}', 'unicode': 'M\\N{SUN}'})\ndef_unit(['jupiterMass', 'M_jup', 'Mjup', 'M_jupiter', 'Mjupiter'],\n         _si.M_jup, namespace=_ns, prefixes=False, doc=\"Jupiter mass\",\n         # LaTeX jupiter symbol requires wasysym\n         format={'latex': r'M_{\\rm J}', 'unicode': 'M\\N{JUPITER}'})\ndef_unit(['earthMass', 'M_earth', 'Mearth'], _si.M_earth, namespace=_ns,\n         prefixes=False, doc=\"Earth mass\",\n         # LaTeX earth symbol requires wasysym\n         format={'latex': r'M_{\\oplus}', 'unicode': 'M⊕'})\n\n##########################################################################\n# ENERGY\n\n# Here, explicitly convert the planck constant to 'eV s' since the constant\n# can override that to give a more precise value that takes into account\n# covariances between e and h.  Eventually, this may also be replaced with\n# just `_si.Ryd.to(eV)`.\ndef_unit(['Ry', 'rydberg'],\n         (_si.Ryd * _si.c * _si.h.to(si.eV * si.s)).to(si.eV),\n         namespace=_ns, prefixes=True,\n         doc=\"Rydberg: Energy of a photon whose wavenumber is the Rydberg \"\n         \"constant\",\n         format={'latex': r'R_{\\infty}', 'unicode': 'R∞'})\n\n###########################################################################\n# ILLUMINATION\n\ndef_unit(['solLum', 'L_sun', 'Lsun'], _si.L_sun, namespace=_ns,\n         prefixes=False, doc=\"Solar luminance\",\n         format={'latex': r'L_{\\odot}', 'unicode': 'L\\N{SUN}'})\n\n\n###########################################################################\n# SPECTRAL DENSITY\n\ndef_unit((['ph', 'photon'], ['photon']),\n         format={'ogip': 'photon', 'vounit': 'photon'},\n         namespace=_ns, prefixes=True)\ndef_unit(['Jy', 'Jansky', 'jansky'], 1e-26 * si.W / si.m ** 2 / si.Hz,\n         namespace=_ns, prefixes=True,\n         doc=\"Jansky: spectral flux density\")\ndef_unit(['R', 'Rayleigh', 'rayleigh'],\n         (1e10 / (4 * _numpy.pi)) *\n         ph * si.m ** -2 * si.s ** -1 * si.sr ** -1,\n         namespace=_ns, prefixes=True,\n         doc=\"Rayleigh: photon flux\")\n\n\n###########################################################################\n# EVENTS\n\ndef_unit((['ct', 'count'], ['count']),\n         format={'fits': 'count', 'ogip': 'count', 'vounit': 'count'},\n         namespace=_ns, prefixes=True, exclude_prefixes=['p'])\ndef_unit(['adu'], namespace=_ns, prefixes=True)\ndef_unit(['DN', 'dn'], namespace=_ns, prefixes=False)\n\n###########################################################################\n# MISCELLANEOUS\n\n# Some of these are very FITS-specific and perhaps considered a mistake.\n# Maybe they should be moved into the FITS format class?\n# TODO: This is defined by the FITS standard as \"relative to the sun\".\n# Is that mass, volume, what?\ndef_unit(['Sun'], namespace=_ns)\ndef_unit(['chan'], namespace=_ns, prefixes=True)\ndef_unit(['bin'], namespace=_ns, prefixes=True)\ndef_unit(['beam'], namespace=_ns, prefixes=True)\ndef_unit(['electron'], doc=\"Number of electrons\", namespace=_ns,\n         format={'latex': r'e^{-}', 'unicode': 'e⁻'})\n\n###########################################################################\n# CLEANUP\n\ndel UnitBase\ndel def_unit\ndel si\n\n\n###########################################################################\n# DOCSTRING\n\n# This generates a docstring for this module that describes all of the\n# standard units defined here.\nfrom .utils import generate_unit_summary as _generate_unit_summary\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())\n\n\n# -------------------------------------------------------------------------\n\ndef __getattr__(attr):\n    if attr == \"littleh\":\n        import warnings\n        from astropy.cosmology.units import littleh\n        from astropy.utils.exceptions import AstropyDeprecationWarning\n\n        warnings.warn(\n            (\"`littleh` is deprecated from module `astropy.units.astrophys` \"\n             \"since astropy 5.0 and may be removed in a future version. \"\n             \"Use `astropy.cosmology.units.littleh` instead.\"),\n            AstropyDeprecationWarning)\n\n        return littleh\n\n    raise AttributeError(f\"module {__name__!r} has no attribute {attr!r}.\")\n"},{"col":0,"comment":"","endLoc":5,"header":"helper.py#<anonymous>","id":9751,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module provides the tools used to internally run the astropy test suite\nfrom the installed astropy.  It makes use of the `pytest`_ testing framework.\n\"\"\"\n\n__all__ = ['assert_follows_unicode_guidelines',\n           'assert_quantity_allclose', 'check_pickling_recovery',\n           'pickle_protocol', 'generic_recursive_equality_test']\n\n_deprecations_as_exceptions = False\n\n_include_astropy_deprecations = True\n\n_modules_to_ignore_on_import = set([\n    r'compiler',  # A deprecated stdlib module used by pytest\n    r'scipy',\n    r'pygments',\n    r'ipykernel',\n    r'IPython',   # deprecation warnings for async and await\n    r'setuptools'])\n\n_warnings_to_ignore_entire_module = set([])\n\n_warnings_to_ignore_by_pyver = {\n    None: set([  # Python version agnostic\n        # https://github.com/astropy/astropy/pull/7372\n        (r\"Importing from numpy\\.testing\\.decorators is deprecated, \"\n         r\"import from numpy\\.testing instead\\.\", DeprecationWarning),\n        # inspect raises this slightly different warning on Python 3.7.\n        # Keeping it since e.g. lxml as of 3.8.0 is still calling getargspec()\n        (r\"inspect\\.getargspec\\(\\) is deprecated, use \"\n         r\"inspect\\.signature\\(\\) or inspect\\.getfullargspec\\(\\)\",\n         DeprecationWarning),\n        # https://github.com/astropy/pytest-doctestplus/issues/29\n        (r\"split\\(\\) requires a non-empty pattern match\", FutureWarning),\n        # Package resolution warning that we can do nothing about\n        (r\"can't resolve package from __spec__ or __package__, \"\n         r\"falling back on __name__ and __path__\", ImportWarning)]),\n    (3, 7): set([\n        # Deprecation warning for collections.abc, fixed in Astropy but still\n        # used in lxml, and maybe others\n        (r\"Using or importing the ABCs from 'collections'\",\n         DeprecationWarning)])\n}"},{"col":4,"comment":"\n        Adds to the set of equivalencies enabled in the unit registry.\n\n        These equivalencies are used if no explicit equivalencies are given,\n        both in unit conversion and in finding equivalent units.\n\n        This is meant in particular for allowing angles to be dimensionless.\n        Use with care.\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            List of equivalent pairs, e.g., as returned by\n            `~astropy.units.equivalencies.dimensionless_angles`.\n        ","endLoc":270,"header":"def add_enabled_equivalencies(self, equivalencies)","id":9752,"name":"add_enabled_equivalencies","nodeType":"Function","startLoc":252,"text":"def add_enabled_equivalencies(self, equivalencies):\n        \"\"\"\n        Adds to the set of equivalencies enabled in the unit registry.\n\n        These equivalencies are used if no explicit equivalencies are given,\n        both in unit conversion and in finding equivalent units.\n\n        This is meant in particular for allowing angles to be dimensionless.\n        Use with care.\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            List of equivalent pairs, e.g., as returned by\n            `~astropy.units.equivalencies.dimensionless_angles`.\n        \"\"\"\n        # pre-normalize list to help catch mistakes\n        equivalencies = _normalize_equivalencies(equivalencies)\n        self._equivalencies |= set(equivalencies)"},{"col":4,"comment":"\n        Add aliases for units.\n\n        Parameters\n        ----------\n        aliases : dict of str, Unit\n            The aliases to add. The keys must be the string aliases, and values\n            must be the `astropy.units.Unit` that the alias will be mapped to.\n\n        Raises\n        ------\n        ValueError\n            If the alias already defines a different unit.\n\n        ","endLoc":323,"header":"def add_enabled_aliases(self, aliases)","id":9753,"name":"add_enabled_aliases","nodeType":"Function","startLoc":295,"text":"def add_enabled_aliases(self, aliases):\n        \"\"\"\n        Add aliases for units.\n\n        Parameters\n        ----------\n        aliases : dict of str, Unit\n            The aliases to add. The keys must be the string aliases, and values\n            must be the `astropy.units.Unit` that the alias will be mapped to.\n\n        Raises\n        ------\n        ValueError\n            If the alias already defines a different unit.\n\n        \"\"\"\n        for alias, unit in aliases.items():\n            if alias in self._registry and unit != self._registry[alias]:\n                raise ValueError(\n                    f\"{alias} already means {self._registry[alias]}, so \"\n                    f\"cannot be used as an alias for {unit}.\")\n            if alias in self._aliases and unit != self._aliases[alias]:\n                raise ValueError(\n                    f\"{alias} already is an alias for {self._aliases[alias]}, so \"\n                    f\"cannot be used as an alias for {unit}.\")\n\n        for alias, unit in aliases.items():\n            if alias not in self._registry and alias not in self._aliases:\n                self._aliases[alias] = unit"},{"fileName":"quantity.py","filePath":"astropy/units","id":9754,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module defines the `Quantity` object, which represents a number with some\nassociated units. `Quantity` objects support operations like ordinary numbers,\nbut will deal with unit conversions internally.\n\"\"\"\n\n\n# Standard library\nimport re\nimport numbers\nfrom fractions import Fraction\nimport operator\nimport warnings\n\nimport numpy as np\n\n# AstroPy\nfrom .core import (Unit, dimensionless_unscaled, get_current_unit_registry,\n                   UnitBase, UnitsError, UnitConversionError, UnitTypeError)\nfrom .structured import StructuredUnit\nfrom .utils import is_effectively_unity\nfrom .format.latex import Latex\nfrom astropy.utils.compat.misc import override__dir__\nfrom astropy.utils.exceptions import AstropyDeprecationWarning, AstropyWarning\nfrom astropy.utils.misc import isiterable\nfrom astropy.utils.data_info import ParentDtypeInfo\nfrom astropy import config as _config\nfrom .quantity_helper import (converters_and_unit, can_have_arbitrary_unit,\n                              check_output)\nfrom .quantity_helper.function_helpers import (\n    SUBCLASS_SAFE_FUNCTIONS, FUNCTION_HELPERS, DISPATCHED_FUNCTIONS,\n    UNSUPPORTED_FUNCTIONS)\n\n\n__all__ = [\"Quantity\", \"SpecificTypeQuantity\",\n           \"QuantityInfoBase\", \"QuantityInfo\", \"allclose\", \"isclose\"]\n\n\n# We don't want to run doctests in the docstrings we inherit from Numpy\n__doctest_skip__ = ['Quantity.*']\n\n_UNIT_NOT_INITIALISED = \"(Unit not initialised)\"\n_UFUNCS_FILTER_WARNINGS = {np.arcsin, np.arccos, np.arccosh, np.arctanh}\n\n\nclass Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for Quantity\n    \"\"\"\n    latex_array_threshold = _config.ConfigItem(100,\n        'The maximum size an array Quantity can be before its LaTeX '\n        'representation for IPython gets \"summarized\" (meaning only the first '\n        'and last few elements are shown with \"...\" between). Setting this to a '\n        'negative number means that the value will instead be whatever numpy '\n        'gets from get_printoptions.')\n\n\nconf = Conf()\n\n\nclass QuantityIterator:\n    \"\"\"\n    Flat iterator object to iterate over Quantities\n\n    A `QuantityIterator` iterator is returned by ``q.flat`` for any Quantity\n    ``q``.  It allows iterating over the array as if it were a 1-D array,\n    either in a for-loop or by calling its `next` method.\n\n    Iteration is done in C-contiguous style, with the last index varying the\n    fastest. The iterator can also be indexed using basic slicing or\n    advanced indexing.\n\n    See Also\n    --------\n    Quantity.flatten : Returns a flattened copy of an array.\n\n    Notes\n    -----\n    `QuantityIterator` is inspired by `~numpy.ma.core.MaskedIterator`.  It\n    is not exported by the `~astropy.units` module.  Instead of\n    instantiating a `QuantityIterator` directly, use `Quantity.flat`.\n    \"\"\"\n\n    def __init__(self, q):\n        self._quantity = q\n        self._dataiter = q.view(np.ndarray).flat\n\n    def __iter__(self):\n        return self\n\n    def __getitem__(self, indx):\n        out = self._dataiter.__getitem__(indx)\n        # For single elements, ndarray.flat.__getitem__ returns scalars; these\n        # need a new view as a Quantity.\n        if isinstance(out, type(self._quantity)):\n            return out\n        else:\n            return self._quantity._new_view(out)\n\n    def __setitem__(self, index, value):\n        self._dataiter[index] = self._quantity._to_own_unit(value)\n\n    def __next__(self):\n        \"\"\"\n        Return the next value, or raise StopIteration.\n        \"\"\"\n        out = next(self._dataiter)\n        # ndarray.flat._dataiter returns scalars, so need a view as a Quantity.\n        return self._quantity._new_view(out)\n\n    next = __next__\n\n    def __len__(self):\n        return len(self._dataiter)\n\n    #### properties and methods to match `numpy.ndarray.flatiter` ####\n\n    @property\n    def base(self):\n        \"\"\"A reference to the array that is iterated over.\"\"\"\n        return self._quantity\n\n    @property\n    def coords(self):\n        \"\"\"An N-dimensional tuple of current coordinates.\"\"\"\n        return self._dataiter.coords\n\n    @property\n    def index(self):\n        \"\"\"Current flat index into the array.\"\"\"\n        return self._dataiter.index\n\n    def copy(self):\n        \"\"\"Get a copy of the iterator as a 1-D array.\"\"\"\n        return self._quantity.flatten()\n\n\nclass QuantityInfoBase(ParentDtypeInfo):\n    # This is on a base class rather than QuantityInfo directly, so that\n    # it can be used for EarthLocationInfo yet make clear that that class\n    # should not be considered a typical Quantity subclass by Table.\n    attrs_from_parent = {'dtype', 'unit'}  # dtype and unit taken from parent\n    _supports_indexing = True\n\n    @staticmethod\n    def default_format(val):\n        return f'{val.value}'\n\n    @staticmethod\n    def possible_string_format_functions(format_):\n        \"\"\"Iterate through possible string-derived format functions.\n\n        A string can either be a format specifier for the format built-in,\n        a new-style format string, or an old-style format string.\n\n        This method is overridden in order to suppress printing the unit\n        in each row since it is already at the top in the column header.\n        \"\"\"\n        yield lambda format_, val: format(val.value, format_)\n        yield lambda format_, val: format_.format(val.value)\n        yield lambda format_, val: format_ % val.value\n\n\nclass QuantityInfo(QuantityInfoBase):\n    \"\"\"\n    Container for meta information like name, description, format.  This is\n    required when the object is used as a mixin column within a table, but can\n    be used as a general way to store meta information.\n    \"\"\"\n    _represent_as_dict_attrs = ('value', 'unit')\n    _construct_from_dict_args = ['value']\n    _represent_as_dict_primary_data = 'value'\n\n    def new_like(self, cols, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new Quantity instance which is consistent with the\n        input ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty column object whose elements can\n        be set in-place for table operations like join or vstack.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : `~astropy.units.Quantity` (or subclass)\n            Empty instance of this class consistent with ``cols``\n\n        \"\"\"\n\n        # Get merged info attributes like shape, dtype, format, description, etc.\n        attrs = self.merge_cols_attributes(cols, metadata_conflicts, name,\n                                           ('meta', 'format', 'description'))\n\n        # Make an empty quantity using the unit of the last one.\n        shape = (length,) + attrs.pop('shape')\n        dtype = attrs.pop('dtype')\n        # Use zeros so we do not get problems for Quantity subclasses such\n        # as Longitude and Latitude, which cannot take arbitrary values.\n        data = np.zeros(shape=shape, dtype=dtype)\n        # Get arguments needed to reconstruct class\n        map = {key: (data if key == 'value' else getattr(cols[-1], key))\n               for key in self._represent_as_dict_attrs}\n        map['copy'] = False\n        out = self._construct_from_dict(map)\n\n        # Set remaining info attributes\n        for attr, value in attrs.items():\n            setattr(out.info, attr, value)\n\n        return out\n\n    def get_sortable_arrays(self):\n        \"\"\"\n        Return a list of arrays which can be lexically sorted to represent\n        the order of the parent column.\n\n        For Quantity this is just the quantity itself.\n\n\n        Returns\n        -------\n        arrays : list of ndarray\n        \"\"\"\n        return [self._parent]\n\n\nclass Quantity(np.ndarray):\n    \"\"\"A `~astropy.units.Quantity` represents a number with some associated unit.\n\n    See also: https://docs.astropy.org/en/stable/units/quantity.html\n\n    Parameters\n    ----------\n    value : number, `~numpy.ndarray`, `~astropy.units.Quantity` (sequence), or str\n        The numerical value of this quantity in the units given by unit.  If a\n        `Quantity` or sequence of them (or any other valid object with a\n        ``unit`` attribute), creates a new `Quantity` object, converting to\n        `unit` units as needed.  If a string, it is converted to a number or\n        `Quantity`, depending on whether a unit is present.\n\n    unit : unit-like\n        An object that represents the unit associated with the input value.\n        Must be an `~astropy.units.UnitBase` object or a string parseable by\n        the :mod:`~astropy.units` package.\n\n    dtype : ~numpy.dtype, optional\n        The dtype of the resulting Numpy array or scalar that will\n        hold the value.  If not provided, it is determined from the input,\n        except that any integer and (non-Quantity) object inputs are converted\n        to float by default.\n\n    copy : bool, optional\n        If `True` (default), then the value is copied.  Otherwise, a copy will\n        only be made if ``__array__`` returns a copy, if value is a nested\n        sequence, or if a copy is needed to satisfy an explicitly given\n        ``dtype``.  (The `False` option is intended mostly for internal use,\n        to speed up initialization where a copy is known to have been made.\n        Use with care.)\n\n    order : {'C', 'F', 'A'}, optional\n        Specify the order of the array.  As in `~numpy.array`.  This parameter\n        is ignored if the input is a `Quantity` and ``copy=False``.\n\n    subok : bool, optional\n        If `False` (default), the returned array will be forced to be a\n        `Quantity`.  Otherwise, `Quantity` subclasses will be passed through,\n        or a subclass appropriate for the unit will be used (such as\n        `~astropy.units.Dex` for ``u.dex(u.AA)``).\n\n    ndmin : int, optional\n        Specifies the minimum number of dimensions that the resulting array\n        should have.  Ones will be pre-pended to the shape as needed to meet\n        this requirement.  This parameter is ignored if the input is a\n        `Quantity` and ``copy=False``.\n\n    Raises\n    ------\n    TypeError\n        If the value provided is not a Python numeric type.\n    TypeError\n        If the unit provided is not either a :class:`~astropy.units.Unit`\n        object or a parseable string unit.\n\n    Notes\n    -----\n    Quantities can also be created by multiplying a number or array with a\n    :class:`~astropy.units.Unit`. See https://docs.astropy.org/en/latest/units/\n\n    Unless the ``dtype`` argument is explicitly specified, integer\n    or (non-Quantity) object inputs are converted to `float` by default.\n    \"\"\"\n    # Need to set a class-level default for _equivalencies, or\n    # Constants can not initialize properly\n    _equivalencies = []\n\n    # Default unit for initialization; can be overridden by subclasses,\n    # possibly to `None` to indicate there is no default unit.\n    _default_unit = dimensionless_unscaled\n\n    # Ensures views have an undefined unit.\n    _unit = None\n\n    __array_priority__ = 10000\n\n    def __class_getitem__(cls, unit_shape_dtype):\n        \"\"\"Quantity Type Hints.\n\n        Unit-aware type hints are ``Annotated`` objects that encode the class,\n        the unit, and possibly shape and dtype information, depending on the\n        python and :mod:`numpy` versions.\n\n        Schematically, ``Annotated[cls[shape, dtype], unit]``\n\n        As a classmethod, the type is the class, ie ``Quantity``\n        produces an ``Annotated[Quantity, ...]`` while a subclass\n        like :class:`~astropy.coordinates.Angle` returns\n        ``Annotated[Angle, ...]``.\n\n        Parameters\n        ----------\n        unit_shape_dtype : :class:`~astropy.units.UnitBase`, str, `~astropy.units.PhysicalType`, or tuple\n            Unit specification, can be the physical type (ie str or class).\n            If tuple, then the first element is the unit specification\n            and all other elements are for `numpy.ndarray` type annotations.\n            Whether they are included depends on the python and :mod:`numpy`\n            versions.\n\n        Returns\n        -------\n        `typing.Annotated`, `typing_extensions.Annotated`, `astropy.units.Unit`, or `astropy.units.PhysicalType`\n            Return type in this preference order:\n            * if python v3.9+ : `typing.Annotated`\n            * if :mod:`typing_extensions` is installed : `typing_extensions.Annotated`\n            * `astropy.units.Unit` or `astropy.units.PhysicalType`\n\n        Raises\n        ------\n        TypeError\n            If the unit/physical_type annotation is not Unit-like or\n            PhysicalType-like.\n\n        Examples\n        --------\n        Create a unit-aware Quantity type annotation\n\n            >>> Quantity[Unit(\"s\")]\n            Annotated[Quantity, Unit(\"s\")]\n\n        See Also\n        --------\n        `~astropy.units.quantity_input`\n            Use annotations for unit checks on function arguments and results.\n\n        Notes\n        -----\n        With Python 3.9+ or :mod:`typing_extensions`, |Quantity| types are also\n        static-type compatible.\n        \"\"\"\n        # LOCAL\n        from ._typing import HAS_ANNOTATED, Annotated\n\n        # process whether [unit] or [unit, shape, ptype]\n        if isinstance(unit_shape_dtype, tuple):  # unit, shape, dtype\n            target = unit_shape_dtype[0]\n            shape_dtype = unit_shape_dtype[1:]\n        else:  # just unit\n            target = unit_shape_dtype\n            shape_dtype = ()\n\n        # Allowed unit/physical types. Errors if neither.\n        try:\n            unit = Unit(target)\n        except (TypeError, ValueError):\n            from astropy.units.physical import get_physical_type\n\n            try:\n                unit = get_physical_type(target)\n            except (TypeError, ValueError, KeyError):  # KeyError for Enum\n                raise TypeError(\"unit annotation is not a Unit or PhysicalType\") from None\n\n        # Allow to sort of work for python 3.8- / no typing_extensions\n        # instead of bailing out, return the unit for `quantity_input`\n        if not HAS_ANNOTATED:\n            warnings.warn(\"Quantity annotations are valid static type annotations only\"\n                          \" if Python is v3.9+ or `typing_extensions` is installed.\")\n            return unit\n\n        # Quantity does not (yet) properly extend the NumPy generics types,\n        # introduced in numpy v1.22+, instead just including the unit info as\n        # metadata using Annotated.\n        # TODO: ensure we do interact with NDArray.__class_getitem__.\n        return Annotated.__class_getitem__((cls, unit))\n\n    def __new__(cls, value, unit=None, dtype=None, copy=True, order=None,\n                subok=False, ndmin=0):\n\n        if unit is not None:\n            # convert unit first, to avoid multiple string->unit conversions\n            unit = Unit(unit)\n\n        # optimize speed for Quantity with no dtype given, copy=False\n        if isinstance(value, Quantity):\n            if unit is not None and unit is not value.unit:\n                value = value.to(unit)\n                # the above already makes a copy (with float dtype)\n                copy = False\n\n            if type(value) is not cls and not (subok and\n                                               isinstance(value, cls)):\n                value = value.view(cls)\n\n            if dtype is None and value.dtype.kind in 'iu':\n                dtype = float\n\n            return np.array(value, dtype=dtype, copy=copy, order=order,\n                            subok=True, ndmin=ndmin)\n\n        # Maybe str, or list/tuple of Quantity? If so, this may set value_unit.\n        # To ensure array remains fast, we short-circuit it.\n        value_unit = None\n        if not isinstance(value, np.ndarray):\n            if isinstance(value, str):\n                # The first part of the regex string matches any integer/float;\n                # the second parts adds possible trailing .+-, which will break\n                # the float function below and ensure things like 1.2.3deg\n                # will not work.\n                pattern = (r'\\s*[+-]?'\n                           r'((\\d+\\.?\\d*)|(\\.\\d+)|([nN][aA][nN])|'\n                           r'([iI][nN][fF]([iI][nN][iI][tT][yY]){0,1}))'\n                           r'([eE][+-]?\\d+)?'\n                           r'[.+-]?')\n\n                v = re.match(pattern, value)\n                unit_string = None\n                try:\n                    value = float(v.group())\n\n                except Exception:\n                    raise TypeError('Cannot parse \"{}\" as a {}. It does not '\n                                    'start with a number.'\n                                    .format(value, cls.__name__))\n\n                unit_string = v.string[v.end():].strip()\n                if unit_string:\n                    value_unit = Unit(unit_string)\n                    if unit is None:\n                        unit = value_unit  # signal no conversion needed below.\n\n            elif isiterable(value) and len(value) > 0:\n                # Iterables like lists and tuples.\n                if all(isinstance(v, Quantity) for v in value):\n                    # If a list/tuple containing only quantities, convert all\n                    # to the same unit.\n                    if unit is None:\n                        unit = value[0].unit\n                    value = [q.to_value(unit) for q in value]\n                    value_unit = unit  # signal below that conversion has been done\n                elif (dtype is None and not hasattr(value, 'dtype')\n                      and isinstance(unit, StructuredUnit)):\n                    # Special case for list/tuple of values and a structured unit:\n                    # ``np.array(value, dtype=None)`` would treat tuples as lower\n                    # levels of the array, rather than as elements of a structured\n                    # array, so we use the structure of the unit to help infer the\n                    # structured dtype of the value.\n                    dtype = unit._recursively_get_dtype(value)\n\n        if value_unit is None:\n            # If the value has a `unit` attribute and if not None\n            # (for Columns with uninitialized unit), treat it like a quantity.\n            value_unit = getattr(value, 'unit', None)\n            if value_unit is None:\n                # Default to dimensionless for no (initialized) unit attribute.\n                if unit is None:\n                    unit = cls._default_unit\n                value_unit = unit  # signal below that no conversion is needed\n            else:\n                try:\n                    value_unit = Unit(value_unit)\n                except Exception as exc:\n                    raise TypeError(\"The unit attribute {!r} of the input could \"\n                                    \"not be parsed as an astropy Unit, raising \"\n                                    \"the following exception:\\n{}\"\n                                    .format(value.unit, exc))\n\n                if unit is None:\n                    unit = value_unit\n                elif unit is not value_unit:\n                    copy = False  # copy will be made in conversion at end\n\n        value = np.array(value, dtype=dtype, copy=copy, order=order,\n                         subok=True, ndmin=ndmin)\n\n        # check that array contains numbers or long int objects\n        if (value.dtype.kind in 'OSU' and\n            not (value.dtype.kind == 'O' and\n                 isinstance(value.item(0), numbers.Number))):\n            raise TypeError(\"The value must be a valid Python or \"\n                            \"Numpy numeric type.\")\n\n        # by default, cast any integer, boolean, etc., to float\n        if dtype is None and value.dtype.kind in 'iuO':\n            value = value.astype(float)\n\n        # if we allow subclasses, allow a class from the unit.\n        if subok:\n            qcls = getattr(unit, '_quantity_class', cls)\n            if issubclass(qcls, cls):\n                cls = qcls\n\n        value = value.view(cls)\n        value._set_unit(value_unit)\n        if unit is value_unit:\n            return value\n        else:\n            # here we had non-Quantity input that had a \"unit\" attribute\n            # with a unit different from the desired one.  So, convert.\n            return value.to(unit)\n\n    def __array_finalize__(self, obj):\n        # Check whether super().__array_finalize should be called\n        # (sadly, ndarray.__array_finalize__ is None; we cannot be sure\n        # what is above us).\n        super_array_finalize = super().__array_finalize__\n        if super_array_finalize is not None:\n            super_array_finalize(obj)\n\n        # If we're a new object or viewing an ndarray, nothing has to be done.\n        if obj is None or obj.__class__ is np.ndarray:\n            return\n\n        # If our unit is not set and obj has a valid one, use it.\n        if self._unit is None:\n            unit = getattr(obj, '_unit', None)\n            if unit is not None:\n                self._set_unit(unit)\n\n        # Copy info if the original had `info` defined.  Because of the way the\n        # DataInfo works, `'info' in obj.__dict__` is False until the\n        # `info` attribute is accessed or set.\n        if 'info' in obj.__dict__:\n            self.info = obj.info\n\n    def __array_wrap__(self, obj, context=None):\n\n        if context is None:\n            # Methods like .squeeze() created a new `ndarray` and then call\n            # __array_wrap__ to turn the array into self's subclass.\n            return self._new_view(obj)\n\n        raise NotImplementedError('__array_wrap__ should not be used '\n                                  'with a context any more since all use '\n                                  'should go through array_function. '\n                                  'Please raise an issue on '\n                                  'https://github.com/astropy/astropy')\n\n    def __array_ufunc__(self, function, method, *inputs, **kwargs):\n        \"\"\"Wrap numpy ufuncs, taking care of units.\n\n        Parameters\n        ----------\n        function : callable\n            ufunc to wrap.\n        method : str\n            Ufunc method: ``__call__``, ``at``, ``reduce``, etc.\n        inputs : tuple\n            Input arrays.\n        kwargs : keyword arguments\n            As passed on, with ``out`` containing possible quantity output.\n\n        Returns\n        -------\n        result : `~astropy.units.Quantity`\n            Results of the ufunc, with the unit set properly.\n        \"\"\"\n        # Determine required conversion functions -- to bring the unit of the\n        # input to that expected (e.g., radian for np.sin), or to get\n        # consistent units between two inputs (e.g., in np.add) --\n        # and the unit of the result (or tuple of units for nout > 1).\n        converters, unit = converters_and_unit(function, method, *inputs)\n\n        out = kwargs.get('out', None)\n        # Avoid loop back by turning any Quantity output into array views.\n        if out is not None:\n            # If pre-allocated output is used, check it is suitable.\n            # This also returns array view, to ensure we don't loop back.\n            if function.nout == 1:\n                out = out[0]\n            out_array = check_output(out, unit, inputs, function=function)\n            # Ensure output argument remains a tuple.\n            kwargs['out'] = (out_array,) if function.nout == 1 else out_array\n\n        # Same for inputs, but here also convert if necessary.\n        arrays = []\n        for input_, converter in zip(inputs, converters):\n            input_ = getattr(input_, 'value', input_)\n            arrays.append(converter(input_) if converter else input_)\n\n        # Call our superclass's __array_ufunc__\n        result = super().__array_ufunc__(function, method, *arrays, **kwargs)\n        # If unit is None, a plain array is expected (e.g., comparisons), which\n        # means we're done.\n        # We're also done if the result was None (for method 'at') or\n        # NotImplemented, which can happen if other inputs/outputs override\n        # __array_ufunc__; hopefully, they can then deal with us.\n        if unit is None or result is None or result is NotImplemented:\n            return result\n\n        return self._result_as_quantity(result, unit, out)\n\n    def _result_as_quantity(self, result, unit, out):\n        \"\"\"Turn result into a quantity with the given unit.\n\n        If no output is given, it will take a view of the array as a quantity,\n        and set the unit.  If output is given, those should be quantity views\n        of the result arrays, and the function will just set the unit.\n\n        Parameters\n        ----------\n        result : ndarray or tuple thereof\n            Array(s) which need to be turned into quantity.\n        unit : `~astropy.units.Unit`\n            Unit for the quantities to be returned (or `None` if the result\n            should not be a quantity).  Should be tuple if result is a tuple.\n        out : `~astropy.units.Quantity` or None\n            Possible output quantity. Should be `None` or a tuple if result\n            is a tuple.\n\n        Returns\n        -------\n        out : `~astropy.units.Quantity`\n           With units set.\n        \"\"\"\n        if isinstance(result, (tuple, list)):\n            if out is None:\n                out = (None,) * len(result)\n            return result.__class__(\n                self._result_as_quantity(result_, unit_, out_)\n                for (result_, unit_, out_) in\n                zip(result, unit, out))\n\n        if out is None:\n            # View the result array as a Quantity with the proper unit.\n            return result if unit is None else self._new_view(result, unit)\n\n        # For given output, just set the unit. We know the unit is not None and\n        # the output is of the correct Quantity subclass, as it was passed\n        # through check_output.\n        out._set_unit(unit)\n        return out\n\n    def __quantity_subclass__(self, unit):\n        \"\"\"\n        Overridden by subclasses to change what kind of view is\n        created based on the output unit of an operation.\n\n        Parameters\n        ----------\n        unit : UnitBase\n            The unit for which the appropriate class should be returned\n\n        Returns\n        -------\n        tuple :\n            - `~astropy.units.Quantity` subclass\n            - bool: True if subclasses of the given class are ok\n        \"\"\"\n        return Quantity, True\n\n    def _new_view(self, obj=None, unit=None):\n        \"\"\"\n        Create a Quantity view of some array-like input, and set the unit\n\n        By default, return a view of ``obj`` of the same class as ``self`` and\n        with the same unit.  Subclasses can override the type of class for a\n        given unit using ``__quantity_subclass__``, and can ensure properties\n        other than the unit are copied using ``__array_finalize__``.\n\n        If the given unit defines a ``_quantity_class`` of which ``self``\n        is not an instance, a view using this class is taken.\n\n        Parameters\n        ----------\n        obj : ndarray or scalar, optional\n            The array to create a view of.  If obj is a numpy or python scalar,\n            it will be converted to an array scalar.  By default, ``self``\n            is converted.\n\n        unit : unit-like, optional\n            The unit of the resulting object.  It is used to select a\n            subclass, and explicitly assigned to the view if given.\n            If not given, the subclass and unit will be that of ``self``.\n\n        Returns\n        -------\n        view : `~astropy.units.Quantity` subclass\n        \"\"\"\n        # Determine the unit and quantity subclass that we need for the view.\n        if unit is None:\n            unit = self.unit\n            quantity_subclass = self.__class__\n        elif unit is self.unit and self.__class__ is Quantity:\n            # The second part is because we should not presume what other\n            # classes want to do for the same unit.  E.g., Constant will\n            # always want to fall back to Quantity, and relies on going\n            # through `__quantity_subclass__`.\n            quantity_subclass = Quantity\n        else:\n            unit = Unit(unit)\n            quantity_subclass = getattr(unit, '_quantity_class', Quantity)\n            if isinstance(self, quantity_subclass):\n                quantity_subclass, subok = self.__quantity_subclass__(unit)\n                if subok:\n                    quantity_subclass = self.__class__\n\n        # We only want to propagate information from ``self`` to our new view,\n        # so obj should be a regular array.  By using ``np.array``, we also\n        # convert python and numpy scalars, which cannot be viewed as arrays\n        # and thus not as Quantity either, to zero-dimensional arrays.\n        # (These are turned back into scalar in `.value`)\n        # Note that for an ndarray input, the np.array call takes only double\n        # ``obj.__class is np.ndarray``. So, not worth special-casing.\n        if obj is None:\n            obj = self.view(np.ndarray)\n        else:\n            obj = np.array(obj, copy=False, subok=True)\n\n        # Take the view, set the unit, and update possible other properties\n        # such as ``info``, ``wrap_angle`` in `Longitude`, etc.\n        view = obj.view(quantity_subclass)\n        view._set_unit(unit)\n        view.__array_finalize__(self)\n        return view\n\n    def _set_unit(self, unit):\n        \"\"\"Set the unit.\n\n        This is used anywhere the unit is set or modified, i.e., in the\n        initilizer, in ``__imul__`` and ``__itruediv__`` for in-place\n        multiplication and division by another unit, as well as in\n        ``__array_finalize__`` for wrapping up views.  For Quantity, it just\n        sets the unit, but subclasses can override it to check that, e.g.,\n        a unit is consistent.\n        \"\"\"\n        if not isinstance(unit, UnitBase):\n            if (isinstance(self._unit, StructuredUnit)\n                    or isinstance(unit, StructuredUnit)):\n                unit = StructuredUnit(unit, self.dtype)\n            else:\n                # Trying to go through a string ensures that, e.g., Magnitudes with\n                # dimensionless physical unit become Quantity with units of mag.\n                unit = Unit(str(unit), parse_strict='silent')\n                if not isinstance(unit, (UnitBase, StructuredUnit)):\n                    raise UnitTypeError(\n                        \"{} instances require normal units, not {} instances.\"\n                        .format(type(self).__name__, type(unit)))\n\n        self._unit = unit\n\n    def __deepcopy__(self, memo):\n        # If we don't define this, ``copy.deepcopy(quantity)`` will\n        # return a bare Numpy array.\n        return self.copy()\n\n    def __reduce__(self):\n        # patch to pickle Quantity objects (ndarray subclasses), see\n        # http://www.mail-archive.com/numpy-discussion@scipy.org/msg02446.html\n\n        object_state = list(super().__reduce__())\n        object_state[2] = (object_state[2], self.__dict__)\n        return tuple(object_state)\n\n    def __setstate__(self, state):\n        # patch to unpickle Quantity objects (ndarray subclasses), see\n        # http://www.mail-archive.com/numpy-discussion@scipy.org/msg02446.html\n\n        nd_state, own_state = state\n        super().__setstate__(nd_state)\n        self.__dict__.update(own_state)\n\n    info = QuantityInfo()\n\n    def _to_value(self, unit, equivalencies=[]):\n        \"\"\"Helper method for to and to_value.\"\"\"\n        if equivalencies == []:\n            equivalencies = self._equivalencies\n        if not self.dtype.names or isinstance(self.unit, StructuredUnit):\n            # Standard path, let unit to do work.\n            return self.unit.to(unit, self.view(np.ndarray),\n                                equivalencies=equivalencies)\n\n        else:\n            # The .to() method of a simple unit cannot convert a structured\n            # dtype, so we work around it, by recursing.\n            # TODO: deprecate this?\n            # Convert simple to Structured on initialization?\n            result = np.empty_like(self.view(np.ndarray))\n            for name in self.dtype.names:\n                result[name] = self[name]._to_value(unit, equivalencies)\n            return result\n\n    def to(self, unit, equivalencies=[], copy=True):\n        \"\"\"\n        Return a new `~astropy.units.Quantity` object with the specified unit.\n\n        Parameters\n        ----------\n        unit : unit-like\n            An object that represents the unit to convert to. Must be\n            an `~astropy.units.UnitBase` object or a string parseable\n            by the `~astropy.units` package.\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            If not provided or ``[]``, class default equivalencies will be used\n            (none for `~astropy.units.Quantity`, but may be set for subclasses)\n            If `None`, no equivalencies will be applied at all, not even any\n            set globally or within a context.\n\n        copy : bool, optional\n            If `True` (default), then the value is copied.  Otherwise, a copy\n            will only be made if necessary.\n\n        See also\n        --------\n        to_value : get the numerical value in a given unit.\n        \"\"\"\n        # We don't use `to_value` below since we always want to make a copy\n        # and don't want to slow down this method (esp. the scalar case).\n        unit = Unit(unit)\n        if copy:\n            # Avoid using to_value to ensure that we make a copy. We also\n            # don't want to slow down this method (esp. the scalar case).\n            value = self._to_value(unit, equivalencies)\n        else:\n            # to_value only copies if necessary\n            value = self.to_value(unit, equivalencies)\n        return self._new_view(value, unit)\n\n    def to_value(self, unit=None, equivalencies=[]):\n        \"\"\"\n        The numerical value, possibly in a different unit.\n\n        Parameters\n        ----------\n        unit : unit-like, optional\n            The unit in which the value should be given. If not given or `None`,\n            use the current unit.\n\n        equivalencies : list of tuple, optional\n            A list of equivalence pairs to try if the units are not directly\n            convertible (see :ref:`astropy:unit_equivalencies`). If not provided\n            or ``[]``, class default equivalencies will be used (none for\n            `~astropy.units.Quantity`, but may be set for subclasses).\n            If `None`, no equivalencies will be applied at all, not even any\n            set globally or within a context.\n\n        Returns\n        -------\n        value : ndarray or scalar\n            The value in the units specified. For arrays, this will be a view\n            of the data if no unit conversion was necessary.\n\n        See also\n        --------\n        to : Get a new instance in a different unit.\n        \"\"\"\n        if unit is None or unit is self.unit:\n            value = self.view(np.ndarray)\n        elif not self.dtype.names:\n            # For non-structured, we attempt a short-cut, where we just get\n            # the scale.  If that is 1, we do not have to do anything.\n            unit = Unit(unit)\n            # We want a view if the unit does not change.  One could check\n            # with \"==\", but that calculates the scale that we need anyway.\n            # TODO: would be better for `unit.to` to have an in-place flag.\n            try:\n                scale = self.unit._to(unit)\n            except Exception:\n                # Short-cut failed; try default (maybe equivalencies help).\n                value = self._to_value(unit, equivalencies)\n            else:\n                value = self.view(np.ndarray)\n                if not is_effectively_unity(scale):\n                    # not in-place!\n                    value = value * scale\n        else:\n            # For structured arrays, we go the default route.\n            value = self._to_value(unit, equivalencies)\n\n        # Index with empty tuple to decay array scalars in to numpy scalars.\n        return value if value.shape else value[()]\n\n    value = property(to_value,\n                     doc=\"\"\"The numerical value of this instance.\n\n    See also\n    --------\n    to_value : Get the numerical value in a given unit.\n    \"\"\")\n\n    @property\n    def unit(self):\n        \"\"\"\n        A `~astropy.units.UnitBase` object representing the unit of this\n        quantity.\n        \"\"\"\n\n        return self._unit\n\n    @property\n    def equivalencies(self):\n        \"\"\"\n        A list of equivalencies that will be applied by default during\n        unit conversions.\n        \"\"\"\n\n        return self._equivalencies\n\n    def _recursively_apply(self, func):\n        \"\"\"Apply function recursively to every field.\n\n        Returns a copy with the result.\n        \"\"\"\n        result = np.empty_like(self)\n        result_value = result.view(np.ndarray)\n        result_unit = ()\n        for name in self.dtype.names:\n            part = func(self[name])\n            result_value[name] = part.value\n            result_unit += (part.unit,)\n\n        result._set_unit(result_unit)\n        return result\n\n    @property\n    def si(self):\n        \"\"\"\n        Returns a copy of the current `Quantity` instance with SI units. The\n        value of the resulting object will be scaled.\n        \"\"\"\n        if self.dtype.names:\n            return self._recursively_apply(operator.attrgetter('si'))\n        si_unit = self.unit.si\n        return self._new_view(self.value * si_unit.scale,\n                              si_unit / si_unit.scale)\n\n    @property\n    def cgs(self):\n        \"\"\"\n        Returns a copy of the current `Quantity` instance with CGS units. The\n        value of the resulting object will be scaled.\n        \"\"\"\n        if self.dtype.names:\n            return self._recursively_apply(operator.attrgetter('cgs'))\n        cgs_unit = self.unit.cgs\n        return self._new_view(self.value * cgs_unit.scale,\n                              cgs_unit / cgs_unit.scale)\n\n    @property\n    def isscalar(self):\n        \"\"\"\n        True if the `value` of this quantity is a scalar, or False if it\n        is an array-like object.\n\n        .. note::\n            This is subtly different from `numpy.isscalar` in that\n            `numpy.isscalar` returns False for a zero-dimensional array\n            (e.g. ``np.array(1)``), while this is True for quantities,\n            since quantities cannot represent true numpy scalars.\n        \"\"\"\n        return not self.shape\n\n    # This flag controls whether convenience conversion members, such\n    # as `q.m` equivalent to `q.to_value(u.m)` are available.  This is\n    # not turned on on Quantity itself, but is on some subclasses of\n    # Quantity, such as `astropy.coordinates.Angle`.\n    _include_easy_conversion_members = False\n\n    @override__dir__\n    def __dir__(self):\n        \"\"\"\n        Quantities are able to directly convert to other units that\n        have the same physical type.  This function is implemented in\n        order to make autocompletion still work correctly in IPython.\n        \"\"\"\n        if not self._include_easy_conversion_members:\n            return []\n        extra_members = set()\n        equivalencies = Unit._normalize_equivalencies(self.equivalencies)\n        for equivalent in self.unit._get_units_with_same_physical_type(\n                equivalencies):\n            extra_members.update(equivalent.names)\n        return extra_members\n\n    def __getattr__(self, attr):\n        \"\"\"\n        Quantities are able to directly convert to other units that\n        have the same physical type.\n        \"\"\"\n        if not self._include_easy_conversion_members:\n            raise AttributeError(\n                f\"'{self.__class__.__name__}' object has no '{attr}' member\")\n\n        def get_virtual_unit_attribute():\n            registry = get_current_unit_registry().registry\n            to_unit = registry.get(attr, None)\n            if to_unit is None:\n                return None\n\n            try:\n                return self.unit.to(\n                    to_unit, self.value, equivalencies=self.equivalencies)\n            except UnitsError:\n                return None\n\n        value = get_virtual_unit_attribute()\n\n        if value is None:\n            raise AttributeError(\n                f\"{self.__class__.__name__} instance has no attribute '{attr}'\")\n        else:\n            return value\n\n    # Equality needs to be handled explicitly as ndarray.__eq__ gives\n    # DeprecationWarnings on any error, which is distracting, and does not\n    # deal well with structured arrays (nor does the ufunc).\n    def __eq__(self, other):\n        try:\n            other_value = self._to_own_unit(other)\n        except UnitsError:\n            return False\n        except Exception:\n            return NotImplemented\n        return self.value.__eq__(other_value)\n\n    def __ne__(self, other):\n        try:\n            other_value = self._to_own_unit(other)\n        except UnitsError:\n            return True\n        except Exception:\n            return NotImplemented\n        return self.value.__ne__(other_value)\n\n    # Unit conversion operator (<<).\n    def __lshift__(self, other):\n        try:\n            other = Unit(other, parse_strict='silent')\n        except UnitTypeError:\n            return NotImplemented\n\n        return self.__class__(self, other, copy=False, subok=True)\n\n    def __ilshift__(self, other):\n        try:\n            other = Unit(other, parse_strict='silent')\n        except UnitTypeError:\n            return NotImplemented\n\n        try:\n            factor = self.unit._to(other)\n        except Exception:\n            # Maybe via equivalencies?  Now we do make a temporary copy.\n            try:\n                value = self._to_value(other)\n            except UnitConversionError:\n                return NotImplemented\n\n            self.view(np.ndarray)[...] = value\n\n        else:\n            self.view(np.ndarray)[...] *= factor\n\n        self._set_unit(other)\n        return self\n\n    def __rlshift__(self, other):\n        if not self.isscalar:\n            return NotImplemented\n        return Unit(self).__rlshift__(other)\n\n    # Give warning for other >> self, since probably other << self was meant.\n    def __rrshift__(self, other):\n        warnings.warn(\">> is not implemented. Did you mean to convert \"\n                      \"something to this quantity as a unit using '<<'?\",\n                      AstropyWarning)\n        return NotImplemented\n\n    # Also define __rshift__ and __irshift__ so we override default ndarray\n    # behaviour, but instead of emitting a warning here, let it be done by\n    # other (which likely is a unit if this was a mistake).\n    def __rshift__(self, other):\n        return NotImplemented\n\n    def __irshift__(self, other):\n        return NotImplemented\n\n    # Arithmetic operations\n    def __mul__(self, other):\n        \"\"\" Multiplication between `Quantity` objects and other objects.\"\"\"\n\n        if isinstance(other, (UnitBase, str)):\n            try:\n                return self._new_view(self.copy(), other * self.unit)\n            except UnitsError:  # let other try to deal with it\n                return NotImplemented\n\n        return super().__mul__(other)\n\n    def __imul__(self, other):\n        \"\"\"In-place multiplication between `Quantity` objects and others.\"\"\"\n\n        if isinstance(other, (UnitBase, str)):\n            self._set_unit(other * self.unit)\n            return self\n\n        return super().__imul__(other)\n\n    def __rmul__(self, other):\n        \"\"\" Right Multiplication between `Quantity` objects and other\n        objects.\n        \"\"\"\n\n        return self.__mul__(other)\n\n    def __truediv__(self, other):\n        \"\"\" Division between `Quantity` objects and other objects.\"\"\"\n\n        if isinstance(other, (UnitBase, str)):\n            try:\n                return self._new_view(self.copy(), self.unit / other)\n            except UnitsError:  # let other try to deal with it\n                return NotImplemented\n\n        return super().__truediv__(other)\n\n    def __itruediv__(self, other):\n        \"\"\"Inplace division between `Quantity` objects and other objects.\"\"\"\n\n        if isinstance(other, (UnitBase, str)):\n            self._set_unit(self.unit / other)\n            return self\n\n        return super().__itruediv__(other)\n\n    def __rtruediv__(self, other):\n        \"\"\" Right Division between `Quantity` objects and other objects.\"\"\"\n\n        if isinstance(other, (UnitBase, str)):\n            return self._new_view(1. / self.value, other / self.unit)\n\n        return super().__rtruediv__(other)\n\n    def __pow__(self, other):\n        if isinstance(other, Fraction):\n            # Avoid getting object arrays by raising the value to a Fraction.\n            return self._new_view(self.value ** float(other),\n                                  self.unit ** other)\n\n        return super().__pow__(other)\n\n    # other overrides of special functions\n    def __hash__(self):\n        return hash(self.value) ^ hash(self.unit)\n\n    def __iter__(self):\n        if self.isscalar:\n            raise TypeError(\n                \"'{cls}' object with a scalar value is not iterable\"\n                .format(cls=self.__class__.__name__))\n\n        # Otherwise return a generator\n        def quantity_iter():\n            for val in self.value:\n                yield self._new_view(val)\n\n        return quantity_iter()\n\n    def __getitem__(self, key):\n        if isinstance(key, str) and isinstance(self.unit, StructuredUnit):\n            return self._new_view(self.view(np.ndarray)[key], self.unit[key])\n\n        try:\n            out = super().__getitem__(key)\n        except IndexError:\n            # We want zero-dimensional Quantity objects to behave like scalars,\n            # so they should raise a TypeError rather than an IndexError.\n            if self.isscalar:\n                raise TypeError(\n                    \"'{cls}' object with a scalar value does not support \"\n                    \"indexing\".format(cls=self.__class__.__name__))\n            else:\n                raise\n        # For single elements, ndarray.__getitem__ returns scalars; these\n        # need a new view as a Quantity.\n        if not isinstance(out, np.ndarray):\n            out = self._new_view(out)\n        return out\n\n    def __setitem__(self, i, value):\n        if isinstance(i, str):\n            # Indexing will cause a different unit, so by doing this in\n            # two steps we effectively try with the right unit.\n            self[i][...] = value\n            return\n\n        # update indices in info if the info property has been accessed\n        # (in which case 'info' in self.__dict__ is True; this is guaranteed\n        # to be the case if we're part of a table).\n        if not self.isscalar and 'info' in self.__dict__:\n            self.info.adjust_indices(i, value, len(self))\n        self.view(np.ndarray).__setitem__(i, self._to_own_unit(value))\n\n    # __contains__ is OK\n\n    def __bool__(self):\n        \"\"\"Quantities should always be treated as non-False; there is too much\n        potential for ambiguity otherwise.\n        \"\"\"\n        warnings.warn('The truth value of a Quantity is ambiguous. '\n                      'In the future this will raise a ValueError.',\n                      AstropyDeprecationWarning)\n        return True\n\n    def __len__(self):\n        if self.isscalar:\n            raise TypeError(\"'{cls}' object with a scalar value has no \"\n                            \"len()\".format(cls=self.__class__.__name__))\n        else:\n            return len(self.value)\n\n    # Numerical types\n    def __float__(self):\n        try:\n            return float(self.to_value(dimensionless_unscaled))\n        except (UnitsError, TypeError):\n            raise TypeError('only dimensionless scalar quantities can be '\n                            'converted to Python scalars')\n\n    def __int__(self):\n        try:\n            return int(self.to_value(dimensionless_unscaled))\n        except (UnitsError, TypeError):\n            raise TypeError('only dimensionless scalar quantities can be '\n                            'converted to Python scalars')\n\n    def __index__(self):\n        # for indices, we do not want to mess around with scaling at all,\n        # so unlike for float, int, we insist here on unscaled dimensionless\n        try:\n            assert self.unit.is_unity()\n            return self.value.__index__()\n        except Exception:\n            raise TypeError('only integer dimensionless scalar quantities '\n                            'can be converted to a Python index')\n\n    # TODO: we may want to add a hook for dimensionless quantities?\n    @property\n    def _unitstr(self):\n        if self.unit is None:\n            unitstr = _UNIT_NOT_INITIALISED\n        else:\n            unitstr = str(self.unit)\n\n        if unitstr:\n            unitstr = ' ' + unitstr\n\n        return unitstr\n\n    def to_string(self, unit=None, precision=None, format=None, subfmt=None):\n        \"\"\"\n        Generate a string representation of the quantity and its unit.\n\n        The behavior of this function can be altered via the\n        `numpy.set_printoptions` function and its various keywords.  The\n        exception to this is the ``threshold`` keyword, which is controlled via\n        the ``[units.quantity]`` configuration item ``latex_array_threshold``.\n        This is treated separately because the numpy default of 1000 is too big\n        for most browsers to handle.\n\n        Parameters\n        ----------\n        unit : unit-like, optional\n            Specifies the unit.  If not provided,\n            the unit used to initialize the quantity will be used.\n\n        precision : number, optional\n            The level of decimal precision. If `None`, or not provided,\n            it will be determined from NumPy print options.\n\n        format : str, optional\n            The format of the result. If not provided, an unadorned\n            string is returned. Supported values are:\n\n            - 'latex': Return a LaTeX-formatted string\n\n        subfmt : str, optional\n            Subformat of the result. For the moment,\n            only used for format=\"latex\". Supported values are:\n\n            - 'inline': Use ``$ ... $`` as delimiters.\n\n            - 'display': Use ``$\\\\displaystyle ... $`` as delimiters.\n\n        Returns\n        -------\n        str\n            A string with the contents of this Quantity\n        \"\"\"\n        if unit is not None and unit != self.unit:\n            return self.to(unit).to_string(\n                unit=None, precision=precision, format=format, subfmt=subfmt)\n\n        formats = {\n            None: None,\n            \"latex\": {\n                None: (\"$\", \"$\"),\n                \"inline\": (\"$\", \"$\"),\n                \"display\": (r\"$\\displaystyle \", r\"$\"),\n            },\n        }\n\n        if format not in formats:\n            raise ValueError(f\"Unknown format '{format}'\")\n        elif format is None:\n            if precision is None:\n                # Use default formatting settings\n                return f'{self.value}{self._unitstr:s}'\n            else:\n                # np.array2string properly formats arrays as well as scalars\n                return np.array2string(self.value, precision=precision,\n                                       floatmode=\"fixed\") + self._unitstr\n\n        # else, for the moment we assume format=\"latex\"\n\n        # Set the precision if set, otherwise use numpy default\n        pops = np.get_printoptions()\n        format_spec = f\".{precision if precision is not None else pops['precision']}g\"\n\n        def float_formatter(value):\n            return Latex.format_exponential_notation(value,\n                                                     format_spec=format_spec)\n\n        def complex_formatter(value):\n            return '({}{}i)'.format(\n                Latex.format_exponential_notation(value.real,\n                                                  format_spec=format_spec),\n                Latex.format_exponential_notation(value.imag,\n                                                  format_spec='+' + format_spec))\n\n        # The view is needed for the scalar case - self.value might be float.\n        latex_value = np.array2string(\n            self.view(np.ndarray),\n            threshold=(conf.latex_array_threshold\n                       if conf.latex_array_threshold > -1 else pops['threshold']),\n            formatter={'float_kind': float_formatter,\n                       'complex_kind': complex_formatter},\n            max_line_width=np.inf,\n            separator=',~')\n\n        latex_value = latex_value.replace('...', r'\\dots')\n\n        # Format unit\n        # [1:-1] strips the '$' on either side needed for math mode\n        latex_unit = (self.unit._repr_latex_()[1:-1]  # note this is unicode\n                      if self.unit is not None\n                      else _UNIT_NOT_INITIALISED)\n\n        delimiter_left, delimiter_right = formats[format][subfmt]\n\n        return rf'{delimiter_left}{latex_value} \\; {latex_unit}{delimiter_right}'\n\n    def __str__(self):\n        return self.to_string()\n\n    def __repr__(self):\n        prefixstr = '<' + self.__class__.__name__ + ' '\n        arrstr = np.array2string(self.view(np.ndarray), separator=', ',\n                                 prefix=prefixstr)\n        return f'{prefixstr}{arrstr}{self._unitstr:s}>'\n\n    def _repr_latex_(self):\n        \"\"\"\n        Generate a latex representation of the quantity and its unit.\n\n        Returns\n        -------\n        lstr\n            A LaTeX string with the contents of this Quantity\n        \"\"\"\n        # NOTE: This should change to display format in a future release\n        return self.to_string(format='latex', subfmt='inline')\n\n    def __format__(self, format_spec):\n        \"\"\"\n        Format quantities using the new-style python formatting codes\n        as specifiers for the number.\n\n        If the format specifier correctly applies itself to the value,\n        then it is used to format only the value. If it cannot be\n        applied to the value, then it is applied to the whole string.\n\n        \"\"\"\n        try:\n            value = format(self.value, format_spec)\n            full_format_spec = \"s\"\n        except ValueError:\n            value = self.value\n            full_format_spec = format_spec\n\n        return format(f\"{value}{self._unitstr:s}\",\n                      full_format_spec)\n\n    def decompose(self, bases=[]):\n        \"\"\"\n        Generates a new `Quantity` with the units\n        decomposed. Decomposed units have only irreducible units in\n        them (see `astropy.units.UnitBase.decompose`).\n\n        Parameters\n        ----------\n        bases : sequence of `~astropy.units.UnitBase`, optional\n            The bases to decompose into.  When not provided,\n            decomposes down to any irreducible units.  When provided,\n            the decomposed result will only contain the given units.\n            This will raises a `~astropy.units.UnitsError` if it's not possible\n            to do so.\n\n        Returns\n        -------\n        newq : `~astropy.units.Quantity`\n            A new object equal to this quantity with units decomposed.\n        \"\"\"\n        return self._decompose(False, bases=bases)\n\n    def _decompose(self, allowscaledunits=False, bases=[]):\n        \"\"\"\n        Generates a new `Quantity` with the units decomposed. Decomposed\n        units have only irreducible units in them (see\n        `astropy.units.UnitBase.decompose`).\n\n        Parameters\n        ----------\n        allowscaledunits : bool\n            If True, the resulting `Quantity` may have a scale factor\n            associated with it.  If False, any scaling in the unit will\n            be subsumed into the value of the resulting `Quantity`\n\n        bases : sequence of UnitBase, optional\n            The bases to decompose into.  When not provided,\n            decomposes down to any irreducible units.  When provided,\n            the decomposed result will only contain the given units.\n            This will raises a `~astropy.units.UnitsError` if it's not possible\n            to do so.\n\n        Returns\n        -------\n        newq : `~astropy.units.Quantity`\n            A new object equal to this quantity with units decomposed.\n\n        \"\"\"\n\n        new_unit = self.unit.decompose(bases=bases)\n\n        # Be careful here because self.value usually is a view of self;\n        # be sure that the original value is not being modified.\n        if not allowscaledunits and hasattr(new_unit, 'scale'):\n            new_value = self.value * new_unit.scale\n            new_unit = new_unit / new_unit.scale\n            return self._new_view(new_value, new_unit)\n        else:\n            return self._new_view(self.copy(), new_unit)\n\n    # These functions need to be overridden to take into account the units\n    # Array conversion\n    # https://numpy.org/doc/stable/reference/arrays.ndarray.html#array-conversion\n\n    def item(self, *args):\n        \"\"\"Copy an element of an array to a scalar Quantity and return it.\n\n        Like :meth:`~numpy.ndarray.item` except that it always\n        returns a `Quantity`, not a Python scalar.\n\n        \"\"\"\n        return self._new_view(super().item(*args))\n\n    def tolist(self):\n        raise NotImplementedError(\"cannot make a list of Quantities.  Get \"\n                                  \"list of values with q.value.tolist()\")\n\n    def _to_own_unit(self, value, check_precision=True):\n        try:\n            _value = value.to_value(self.unit)\n        except AttributeError:\n            # We're not a Quantity.\n            # First remove two special cases (with a fast test):\n            # 1) Maybe masked printing? MaskedArray with quantities does not\n            # work very well, but no reason to break even repr and str.\n            # 2) np.ma.masked? useful if we're a MaskedQuantity.\n            if (value is np.ma.masked\n                or (value is np.ma.masked_print_option\n                    and self.dtype.kind == 'O')):\n                return value\n            # Now, let's try a more general conversion.\n            # Plain arrays will be converted to dimensionless in the process,\n            # but anything with a unit attribute will use that.\n            try:\n                as_quantity = Quantity(value)\n                _value = as_quantity.to_value(self.unit)\n            except UnitsError:\n                # last chance: if this was not something with a unit\n                # and is all 0, inf, or nan, we treat it as arbitrary unit.\n                if (not hasattr(value, 'unit') and\n                        can_have_arbitrary_unit(as_quantity.value)):\n                    _value = as_quantity.value\n                else:\n                    raise\n\n        if self.dtype.kind == 'i' and check_precision:\n            # If, e.g., we are casting float to int, we want to fail if\n            # precision is lost, but let things pass if it works.\n            _value = np.array(_value, copy=False, subok=True)\n            if not np.can_cast(_value.dtype, self.dtype):\n                self_dtype_array = np.array(_value, self.dtype, subok=True)\n                if not np.all(np.logical_or(self_dtype_array == _value,\n                                            np.isnan(_value))):\n                    raise TypeError(\"cannot convert value type to array type \"\n                                    \"without precision loss\")\n\n        # Setting names to ensure things like equality work (note that\n        # above will have failed already if units did not match).\n        if self.dtype.names:\n            _value.dtype.names = self.dtype.names\n        return _value\n\n    def itemset(self, *args):\n        if len(args) == 0:\n            raise ValueError(\"itemset must have at least one argument\")\n\n        self.view(np.ndarray).itemset(*(args[:-1] +\n                                        (self._to_own_unit(args[-1]),)))\n\n    def tostring(self, order='C'):\n        raise NotImplementedError(\"cannot write Quantities to string.  Write \"\n                                  \"array with q.value.tostring(...).\")\n\n    def tobytes(self, order='C'):\n        raise NotImplementedError(\"cannot write Quantities to string.  Write \"\n                                  \"array with q.value.tobytes(...).\")\n\n    def tofile(self, fid, sep=\"\", format=\"%s\"):\n        raise NotImplementedError(\"cannot write Quantities to file.  Write \"\n                                  \"array with q.value.tofile(...)\")\n\n    def dump(self, file):\n        raise NotImplementedError(\"cannot dump Quantities to file.  Write \"\n                                  \"array with q.value.dump()\")\n\n    def dumps(self):\n        raise NotImplementedError(\"cannot dump Quantities to string.  Write \"\n                                  \"array with q.value.dumps()\")\n\n    # astype, byteswap, copy, view, getfield, setflags OK as is\n\n    def fill(self, value):\n        self.view(np.ndarray).fill(self._to_own_unit(value))\n\n    # Shape manipulation: resize cannot be done (does not own data), but\n    # shape, transpose, swapaxes, flatten, ravel, squeeze all OK.  Only\n    # the flat iterator needs to be overwritten, otherwise single items are\n    # returned as numbers.\n    @property\n    def flat(self):\n        \"\"\"A 1-D iterator over the Quantity array.\n\n        This returns a ``QuantityIterator`` instance, which behaves the same\n        as the `~numpy.flatiter` instance returned by `~numpy.ndarray.flat`,\n        and is similar to, but not a subclass of, Python's built-in iterator\n        object.\n        \"\"\"\n        return QuantityIterator(self)\n\n    @flat.setter\n    def flat(self, value):\n        y = self.ravel()\n        y[:] = value\n\n    # Item selection and manipulation\n    # repeat, sort, compress, diagonal OK\n    def take(self, indices, axis=None, out=None, mode='raise'):\n        out = super().take(indices, axis=axis, out=out, mode=mode)\n        # For single elements, ndarray.take returns scalars; these\n        # need a new view as a Quantity.\n        if type(out) is not type(self):\n            out = self._new_view(out)\n        return out\n\n    def put(self, indices, values, mode='raise'):\n        self.view(np.ndarray).put(indices, self._to_own_unit(values), mode)\n\n    def choose(self, choices, out=None, mode='raise'):\n        raise NotImplementedError(\"cannot choose based on quantity.  Choose \"\n                                  \"using array with q.value.choose(...)\")\n\n    # ensure we do not return indices as quantities\n    def argsort(self, axis=-1, kind='quicksort', order=None):\n        return self.view(np.ndarray).argsort(axis=axis, kind=kind, order=order)\n\n    def searchsorted(self, v, *args, **kwargs):\n        return np.searchsorted(np.array(self),\n                               self._to_own_unit(v, check_precision=False),\n                               *args, **kwargs)  # avoid numpy 1.6 problem\n\n    def argmax(self, axis=None, out=None):\n        return self.view(np.ndarray).argmax(axis, out=out)\n\n    def argmin(self, axis=None, out=None):\n        return self.view(np.ndarray).argmin(axis, out=out)\n\n    def __array_function__(self, function, types, args, kwargs):\n        \"\"\"Wrap numpy functions, taking care of units.\n\n        Parameters\n        ----------\n        function : callable\n            Numpy function to wrap\n        types : iterable of classes\n            Classes that provide an ``__array_function__`` override. Can\n            in principle be used to interact with other classes. Below,\n            mostly passed on to `~numpy.ndarray`, which can only interact\n            with subclasses.\n        args : tuple\n            Positional arguments provided in the function call.\n        kwargs : dict\n            Keyword arguments provided in the function call.\n\n        Returns\n        -------\n        result: `~astropy.units.Quantity`, `~numpy.ndarray`\n            As appropriate for the function.  If the function is not\n            supported, `NotImplemented` is returned, which will lead to\n            a `TypeError` unless another argument overrode the function.\n\n        Raises\n        ------\n        ~astropy.units.UnitsError\n            If operands have incompatible units.\n        \"\"\"\n        # A function should be in one of the following sets or dicts:\n        # 1. SUBCLASS_SAFE_FUNCTIONS (set), if the numpy implementation\n        #    supports Quantity; we pass on to ndarray.__array_function__.\n        # 2. FUNCTION_HELPERS (dict), if the numpy implementation is usable\n        #    after converting quantities to arrays with suitable units,\n        #    and possibly setting units on the result.\n        # 3. DISPATCHED_FUNCTIONS (dict), if the function makes sense but\n        #    requires a Quantity-specific implementation.\n        # 4. UNSUPPORTED_FUNCTIONS (set), if the function does not make sense.\n        # For now, since we may not yet have complete coverage, if a\n        # function is in none of the above, we simply call the numpy\n        # implementation.\n        if function in SUBCLASS_SAFE_FUNCTIONS:\n            return super().__array_function__(function, types, args, kwargs)\n\n        elif function in FUNCTION_HELPERS:\n            function_helper = FUNCTION_HELPERS[function]\n            try:\n                args, kwargs, unit, out = function_helper(*args, **kwargs)\n            except NotImplementedError:\n                return self._not_implemented_or_raise(function, types)\n\n            result = super().__array_function__(function, types, args, kwargs)\n            # Fall through to return section\n\n        elif function in DISPATCHED_FUNCTIONS:\n            dispatched_function = DISPATCHED_FUNCTIONS[function]\n            try:\n                result, unit, out = dispatched_function(*args, **kwargs)\n            except NotImplementedError:\n                return self._not_implemented_or_raise(function, types)\n\n            # Fall through to return section\n\n        elif function in UNSUPPORTED_FUNCTIONS:\n            return NotImplemented\n\n        else:\n            warnings.warn(\"function '{}' is not known to astropy's Quantity. \"\n                          \"Will run it anyway, hoping it will treat ndarray \"\n                          \"subclasses correctly. Please raise an issue at \"\n                          \"https://github.com/astropy/astropy/issues. \"\n                          .format(function.__name__), AstropyWarning)\n\n            return super().__array_function__(function, types, args, kwargs)\n\n        # If unit is None, a plain array is expected (e.g., boolean), which\n        # means we're done.\n        # We're also done if the result was NotImplemented, which can happen\n        # if other inputs/outputs override __array_function__;\n        # hopefully, they can then deal with us.\n        if unit is None or result is NotImplemented:\n            return result\n\n        return self._result_as_quantity(result, unit, out=out)\n\n    def _not_implemented_or_raise(self, function, types):\n        # Our function helper or dispatcher found that the function does not\n        # work with Quantity.  In principle, there may be another class that\n        # knows what to do with us, for which we should return NotImplemented.\n        # But if there is ndarray (or a non-Quantity subclass of it) around,\n        # it quite likely coerces, so we should just break.\n        if any(issubclass(t, np.ndarray) and not issubclass(t, Quantity)\n               for t in types):\n            raise TypeError(\"the Quantity implementation cannot handle {} \"\n                            \"with the given arguments.\"\n                            .format(function)) from None\n        else:\n            return NotImplemented\n\n    # Calculation -- override ndarray methods to take into account units.\n    # We use the corresponding numpy functions to evaluate the results, since\n    # the methods do not always allow calling with keyword arguments.\n    # For instance, np.array([0.,2.]).clip(a_min=0., a_max=1.) gives\n    # TypeError: 'a_max' is an invalid keyword argument for this function.\n    def _wrap_function(self, function, *args, unit=None, out=None, **kwargs):\n        \"\"\"Wrap a numpy function that processes self, returning a Quantity.\n\n        Parameters\n        ----------\n        function : callable\n            Numpy function to wrap.\n        args : positional arguments\n            Any positional arguments to the function beyond the first argument\n            (which will be set to ``self``).\n        kwargs : keyword arguments\n            Keyword arguments to the function.\n\n        If present, the following arguments are treated specially:\n\n        unit : `~astropy.units.Unit`\n            Unit of the output result.  If not given, the unit of ``self``.\n        out : `~astropy.units.Quantity`\n            A Quantity instance in which to store the output.\n\n        Notes\n        -----\n        Output should always be assigned via a keyword argument, otherwise\n        no proper account of the unit is taken.\n\n        Returns\n        -------\n        out : `~astropy.units.Quantity`\n            Result of the function call, with the unit set properly.\n        \"\"\"\n        if unit is None:\n            unit = self.unit\n        # Ensure we don't loop back by turning any Quantity into array views.\n        args = (self.value,) + tuple((arg.value if isinstance(arg, Quantity)\n                                      else arg) for arg in args)\n        if out is not None:\n            # If pre-allocated output is used, check it is suitable.\n            # This also returns array view, to ensure we don't loop back.\n            arrays = tuple(arg for arg in args if isinstance(arg, np.ndarray))\n            kwargs['out'] = check_output(out, unit, arrays, function=function)\n        # Apply the function and turn it back into a Quantity.\n        result = function(*args, **kwargs)\n        return self._result_as_quantity(result, unit, out)\n\n    def trace(self, offset=0, axis1=0, axis2=1, dtype=None, out=None):\n        return self._wrap_function(np.trace, offset, axis1, axis2, dtype,\n                                   out=out)\n\n    def var(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False):\n        return self._wrap_function(np.var, axis, dtype,\n                                   out=out, ddof=ddof, keepdims=keepdims,\n                                   unit=self.unit**2)\n\n    def std(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False):\n        return self._wrap_function(np.std, axis, dtype, out=out, ddof=ddof,\n                                   keepdims=keepdims)\n\n    def mean(self, axis=None, dtype=None, out=None, keepdims=False):\n        return self._wrap_function(np.mean, axis, dtype, out=out,\n                                   keepdims=keepdims)\n\n    def round(self, decimals=0, out=None):\n        return self._wrap_function(np.round, decimals, out=out)\n\n    def dot(self, b, out=None):\n        result_unit = self.unit * getattr(b, 'unit', dimensionless_unscaled)\n        return self._wrap_function(np.dot, b, out=out, unit=result_unit)\n\n    # Calculation: override methods that do not make sense.\n\n    def all(self, axis=None, out=None):\n        raise TypeError(\"cannot evaluate truth value of quantities. \"\n                        \"Evaluate array with q.value.all(...)\")\n\n    def any(self, axis=None, out=None):\n        raise TypeError(\"cannot evaluate truth value of quantities. \"\n                        \"Evaluate array with q.value.any(...)\")\n\n    # Calculation: numpy functions that can be overridden with methods.\n\n    def diff(self, n=1, axis=-1):\n        return self._wrap_function(np.diff, n, axis)\n\n    def ediff1d(self, to_end=None, to_begin=None):\n        return self._wrap_function(np.ediff1d, to_end, to_begin)\n\n    def nansum(self, axis=None, out=None, keepdims=False):\n        return self._wrap_function(np.nansum, axis,\n                                   out=out, keepdims=keepdims)\n\n    def insert(self, obj, values, axis=None):\n        \"\"\"\n        Insert values along the given axis before the given indices and return\n        a new `~astropy.units.Quantity` object.\n\n        This is a thin wrapper around the `numpy.insert` function.\n\n        Parameters\n        ----------\n        obj : int, slice or sequence of int\n            Object that defines the index or indices before which ``values`` is\n            inserted.\n        values : array-like\n            Values to insert.  If the type of ``values`` is different\n            from that of quantity, ``values`` is converted to the matching type.\n            ``values`` should be shaped so that it can be broadcast appropriately\n            The unit of ``values`` must be consistent with this quantity.\n        axis : int, optional\n            Axis along which to insert ``values``.  If ``axis`` is None then\n            the quantity array is flattened before insertion.\n\n        Returns\n        -------\n        out : `~astropy.units.Quantity`\n            A copy of quantity with ``values`` inserted.  Note that the\n            insertion does not occur in-place: a new quantity array is returned.\n\n        Examples\n        --------\n        >>> import astropy.units as u\n        >>> q = [1, 2] * u.m\n        >>> q.insert(0, 50 * u.cm)\n        <Quantity [ 0.5,  1.,  2.] m>\n\n        >>> q = [[1, 2], [3, 4]] * u.m\n        >>> q.insert(1, [10, 20] * u.m, axis=0)\n        <Quantity [[  1.,  2.],\n                   [ 10., 20.],\n                   [  3.,  4.]] m>\n\n        >>> q.insert(1, 10 * u.m, axis=1)\n        <Quantity [[  1., 10.,  2.],\n                   [  3., 10.,  4.]] m>\n\n        \"\"\"\n        out_array = np.insert(self.value, obj, self._to_own_unit(values), axis)\n        return self._new_view(out_array)\n\n\nclass SpecificTypeQuantity(Quantity):\n    \"\"\"Superclass for Quantities of specific physical type.\n\n    Subclasses of these work just like :class:`~astropy.units.Quantity`, except\n    that they are for specific physical types (and may have methods that are\n    only appropriate for that type).  Astropy examples are\n    :class:`~astropy.coordinates.Angle` and\n    :class:`~astropy.coordinates.Distance`\n\n    At a minimum, subclasses should set ``_equivalent_unit`` to the unit\n    associated with the physical type.\n    \"\"\"\n    # The unit for the specific physical type.  Instances can only be created\n    # with units that are equivalent to this.\n    _equivalent_unit = None\n\n    # The default unit used for views.  Even with `None`, views of arrays\n    # without units are possible, but will have an uninitialized unit.\n    _unit = None\n\n    # Default unit for initialization through the constructor.\n    _default_unit = None\n\n    # ensure that we get precedence over our superclass.\n    __array_priority__ = Quantity.__array_priority__ + 10\n\n    def __quantity_subclass__(self, unit):\n        if unit.is_equivalent(self._equivalent_unit):\n            return type(self), True\n        else:\n            return super().__quantity_subclass__(unit)[0], False\n\n    def _set_unit(self, unit):\n        if unit is None or not unit.is_equivalent(self._equivalent_unit):\n            raise UnitTypeError(\n                \"{} instances require units equivalent to '{}'\"\n                .format(type(self).__name__, self._equivalent_unit) +\n                (\", but no unit was given.\" if unit is None else\n                 f\", so cannot set it to '{unit}'.\"))\n\n        super()._set_unit(unit)\n\n\ndef isclose(a, b, rtol=1.e-5, atol=None, equal_nan=False, **kwargs):\n    \"\"\"\n    Return a boolean array where two arrays are element-wise equal\n    within a tolerance.\n\n    Parameters\n    ----------\n    a, b : array-like or `~astropy.units.Quantity`\n        Input values or arrays to compare\n    rtol : array-like or `~astropy.units.Quantity`\n        The relative tolerance for the comparison, which defaults to\n        ``1e-5``.  If ``rtol`` is a :class:`~astropy.units.Quantity`,\n        then it must be dimensionless.\n    atol : number or `~astropy.units.Quantity`\n        The absolute tolerance for the comparison.  The units (or lack\n        thereof) of ``a``, ``b``, and ``atol`` must be consistent with\n        each other.  If `None`, ``atol`` defaults to zero in the\n        appropriate units.\n    equal_nan : `bool`\n        Whether to compare NaN’s as equal. If `True`, NaNs in ``a`` will\n        be considered equal to NaN’s in ``b``.\n\n    Notes\n    -----\n    This is a :class:`~astropy.units.Quantity`-aware version of\n    :func:`numpy.isclose`. However, this differs from the `numpy` function in\n    that the default for the absolute tolerance here is zero instead of\n    ``atol=1e-8`` in `numpy`, as there is no natural way to set a default\n    *absolute* tolerance given two inputs that may have differently scaled\n    units.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If the dimensions of ``a``, ``b``, or ``atol`` are incompatible,\n        or if ``rtol`` is not dimensionless.\n\n    See also\n    --------\n    allclose\n    \"\"\"\n    unquantified_args = _unquantify_allclose_arguments(a, b, rtol, atol)\n    return np.isclose(*unquantified_args, equal_nan=equal_nan, **kwargs)\n\n\ndef allclose(a, b, rtol=1.e-5, atol=None, equal_nan=False, **kwargs) -> bool:\n    \"\"\"\n    Whether two arrays are element-wise equal within a tolerance.\n\n    Parameters\n    ----------\n    a, b : array-like or `~astropy.units.Quantity`\n        Input values or arrays to compare\n    rtol : array-like or `~astropy.units.Quantity`\n        The relative tolerance for the comparison, which defaults to\n        ``1e-5``.  If ``rtol`` is a :class:`~astropy.units.Quantity`,\n        then it must be dimensionless.\n    atol : number or `~astropy.units.Quantity`\n        The absolute tolerance for the comparison.  The units (or lack\n        thereof) of ``a``, ``b``, and ``atol`` must be consistent with\n        each other.  If `None`, ``atol`` defaults to zero in the\n        appropriate units.\n    equal_nan : `bool`\n        Whether to compare NaN’s as equal. If `True`, NaNs in ``a`` will\n        be considered equal to NaN’s in ``b``.\n\n    Notes\n    -----\n    This is a :class:`~astropy.units.Quantity`-aware version of\n    :func:`numpy.allclose`. However, this differs from the `numpy` function in\n    that the default for the absolute tolerance here is zero instead of\n    ``atol=1e-8`` in `numpy`, as there is no natural way to set a default\n    *absolute* tolerance given two inputs that may have differently scaled\n    units.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If the dimensions of ``a``, ``b``, or ``atol`` are incompatible,\n        or if ``rtol`` is not dimensionless.\n\n    See also\n    --------\n    isclose\n    \"\"\"\n    unquantified_args = _unquantify_allclose_arguments(a, b, rtol, atol)\n    return np.allclose(*unquantified_args, equal_nan=equal_nan, **kwargs)\n\n\ndef _unquantify_allclose_arguments(actual, desired, rtol, atol):\n    actual = Quantity(actual, subok=True, copy=False)\n\n    desired = Quantity(desired, subok=True, copy=False)\n    try:\n        desired = desired.to(actual.unit)\n    except UnitsError:\n        raise UnitsError(\n            f\"Units for 'desired' ({desired.unit}) and 'actual' \"\n            f\"({actual.unit}) are not convertible\"\n        )\n\n    if atol is None:\n        # By default, we assume an absolute tolerance of zero in the\n        # appropriate units.  The default value of None for atol is\n        # needed because the units of atol must be consistent with the\n        # units for a and b.\n        atol = Quantity(0)\n    else:\n        atol = Quantity(atol, subok=True, copy=False)\n        try:\n            atol = atol.to(actual.unit)\n        except UnitsError:\n            raise UnitsError(\n                f\"Units for 'atol' ({atol.unit}) and 'actual' \"\n                f\"({actual.unit}) are not convertible\"\n            )\n\n    rtol = Quantity(rtol, subok=True, copy=False)\n    try:\n        rtol = rtol.to(dimensionless_unscaled)\n    except Exception:\n        raise UnitsError(\"'rtol' should be dimensionless\")\n\n    return actual.value, desired.value, rtol.value, atol.value\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":2367,"id":9755,"name":"si_prefixes","nodeType":"Attribute","startLoc":2367,"text":"si_prefixes"},{"attributeType":"null","col":0,"comment":"null","endLoc":2569,"id":9756,"name":"dimensionless_unscaled","nodeType":"Attribute","startLoc":2569,"text":"dimensionless_unscaled"},{"attributeType":"null","col":0,"comment":"null","endLoc":2391,"id":9757,"name":"binary_prefixes","nodeType":"Attribute","startLoc":2391,"text":"binary_prefixes"},{"col":0,"comment":"\n    Sets the units enabled in the unit registry.\n\n    These units are searched when using\n    `UnitBase.find_equivalent_units`, for example.\n\n    This may be used either permanently, or as a context manager using\n    the ``with`` statement (see example below).\n\n    Parameters\n    ----------\n    units : list of sequence, dict, or module\n        This is a list of things in which units may be found\n        (sequences, dicts or modules), or units themselves.  The\n        entire set will be \"enabled\" for searching through by methods\n        like `UnitBase.find_equivalent_units` and `UnitBase.compose`.\n\n    Examples\n    --------\n\n    >>> from astropy import units as u\n    >>> with u.set_enabled_units([u.pc]):\n    ...     u.m.find_equivalent_units()\n    ...\n      Primary name | Unit definition | Aliases\n    [\n      pc           | 3.08568e+16 m   | parsec  ,\n    ]\n    >>> u.m.find_equivalent_units()\n      Primary name | Unit definition | Aliases\n    [\n      AU           | 1.49598e+11 m   | au, astronomical_unit            ,\n      Angstrom     | 1e-10 m         | AA, angstrom                     ,\n      cm           | 0.01 m          | centimeter                       ,\n      earthRad     | 6.3781e+06 m    | R_earth, Rearth                  ,\n      jupiterRad   | 7.1492e+07 m    | R_jup, Rjup, R_jupiter, Rjupiter ,\n      lsec         | 2.99792e+08 m   | lightsecond                      ,\n      lyr          | 9.46073e+15 m   | lightyear                        ,\n      m            | irreducible     | meter                            ,\n      micron       | 1e-06 m         |                                  ,\n      pc           | 3.08568e+16 m   | parsec                           ,\n      solRad       | 6.957e+08 m     | R_sun, Rsun                      ,\n    ]\n    ","endLoc":395,"header":"def set_enabled_units(units)","id":9758,"name":"set_enabled_units","nodeType":"Function","startLoc":345,"text":"def set_enabled_units(units):\n    \"\"\"\n    Sets the units enabled in the unit registry.\n\n    These units are searched when using\n    `UnitBase.find_equivalent_units`, for example.\n\n    This may be used either permanently, or as a context manager using\n    the ``with`` statement (see example below).\n\n    Parameters\n    ----------\n    units : list of sequence, dict, or module\n        This is a list of things in which units may be found\n        (sequences, dicts or modules), or units themselves.  The\n        entire set will be \"enabled\" for searching through by methods\n        like `UnitBase.find_equivalent_units` and `UnitBase.compose`.\n\n    Examples\n    --------\n\n    >>> from astropy import units as u\n    >>> with u.set_enabled_units([u.pc]):\n    ...     u.m.find_equivalent_units()\n    ...\n      Primary name | Unit definition | Aliases\n    [\n      pc           | 3.08568e+16 m   | parsec  ,\n    ]\n    >>> u.m.find_equivalent_units()\n      Primary name | Unit definition | Aliases\n    [\n      AU           | 1.49598e+11 m   | au, astronomical_unit            ,\n      Angstrom     | 1e-10 m         | AA, angstrom                     ,\n      cm           | 0.01 m          | centimeter                       ,\n      earthRad     | 6.3781e+06 m    | R_earth, Rearth                  ,\n      jupiterRad   | 7.1492e+07 m    | R_jup, Rjup, R_jupiter, Rjupiter ,\n      lsec         | 2.99792e+08 m   | lightsecond                      ,\n      lyr          | 9.46073e+15 m   | lightyear                        ,\n      m            | irreducible     | meter                            ,\n      micron       | 1e-06 m         |                                  ,\n      pc           | 3.08568e+16 m   | parsec                           ,\n      solRad       | 6.957e+08 m     | R_sun, Rsun                      ,\n    ]\n    \"\"\"\n    # get a context with a new registry, using equivalencies of the current one\n    context = _UnitContext(\n        equivalencies=get_current_unit_registry().equivalencies)\n    # in this new current registry, enable the units requested\n    get_current_unit_registry().set_enabled_units(units)\n    return context"},{"className":"UnitTypeError","col":0,"comment":"\n    Used specifically for errors in setting to units not allowed by a class.\n\n    E.g., would be raised if the unit of an `~astropy.coordinates.Angle`\n    instances were set to a non-angular unit.\n    ","endLoc":612,"id":9759,"nodeType":"Class","startLoc":606,"text":"class UnitTypeError(UnitsError, TypeError):\n    \"\"\"\n    Used specifically for errors in setting to units not allowed by a class.\n\n    E.g., would be raised if the unit of an `~astropy.coordinates.Angle`\n    instances were set to a non-angular unit.\n    \"\"\""},{"className":"StructuredUnit","col":0,"comment":"Container for units for a structured Quantity.\n\n    Parameters\n    ----------\n    units : unit-like, tuple of unit-like, or `~astropy.units.StructuredUnit`\n        Tuples can be nested.  If a `~astropy.units.StructuredUnit` is passed\n        in, it will be returned unchanged unless different names are requested.\n    names : tuple of str, tuple or list; `~numpy.dtype`; or `~astropy.units.StructuredUnit`, optional\n        Field names for the units, possibly nested. Can be inferred from a\n        structured `~numpy.dtype` or another `~astropy.units.StructuredUnit`.\n        For nested tuples, by default the name of the upper entry will be the\n        concatenation of the names of the lower levels.  One can pass in a\n        list with the upper-level name and a tuple of lower-level names to\n        avoid this.  For tuples, not all levels have to be given; for any level\n        not passed in, default field names of 'f0', 'f1', etc., will be used.\n\n    Notes\n    -----\n    It is recommended to initialze the class indirectly, using\n    `~astropy.units.Unit`.  E.g., ``u.Unit('AU,AU/day')``.\n\n    When combined with a structured array to produce a structured\n    `~astropy.units.Quantity`, array field names will take precedence.\n    Generally, passing in ``names`` is needed only if the unit is used\n    unattached to a `~astropy.units.Quantity` and one needs to access its\n    fields.\n\n    Examples\n    --------\n    Various ways to initialize a `~astropy.units.StructuredUnit`::\n\n        >>> import astropy.units as u\n        >>> su = u.Unit('(AU,AU/day),yr')\n        >>> su\n        Unit(\"((AU, AU / d), yr)\")\n        >>> su.field_names\n        (['f0', ('f0', 'f1')], 'f1')\n        >>> su['f1']\n        Unit(\"yr\")\n        >>> su2 = u.StructuredUnit(((u.AU, u.AU/u.day), u.yr), names=(('p', 'v'), 't'))\n        >>> su2 == su\n        True\n        >>> su2.field_names\n        (['pv', ('p', 'v')], 't')\n        >>> su3 = u.StructuredUnit((su2['pv'], u.day), names=(['p_v', ('p', 'v')], 't'))\n        >>> su3.field_names\n        (['p_v', ('p', 'v')], 't')\n        >>> su3.keys()\n        ('p_v', 't')\n        >>> su3.values()\n        (Unit(\"(AU, AU / d)\"), Unit(\"d\"))\n\n    Structured units share most methods with regular units::\n\n        >>> su.physical_type\n        ((PhysicalType('length'), PhysicalType({'speed', 'velocity'})), PhysicalType('time'))\n        >>> su.si\n        Unit(\"((1.49598e+11 m, 1.73146e+06 m / s), 3.15576e+07 s)\")\n\n    ","endLoc":492,"id":9760,"nodeType":"Class","startLoc":62,"text":"class StructuredUnit:\n    \"\"\"Container for units for a structured Quantity.\n\n    Parameters\n    ----------\n    units : unit-like, tuple of unit-like, or `~astropy.units.StructuredUnit`\n        Tuples can be nested.  If a `~astropy.units.StructuredUnit` is passed\n        in, it will be returned unchanged unless different names are requested.\n    names : tuple of str, tuple or list; `~numpy.dtype`; or `~astropy.units.StructuredUnit`, optional\n        Field names for the units, possibly nested. Can be inferred from a\n        structured `~numpy.dtype` or another `~astropy.units.StructuredUnit`.\n        For nested tuples, by default the name of the upper entry will be the\n        concatenation of the names of the lower levels.  One can pass in a\n        list with the upper-level name and a tuple of lower-level names to\n        avoid this.  For tuples, not all levels have to be given; for any level\n        not passed in, default field names of 'f0', 'f1', etc., will be used.\n\n    Notes\n    -----\n    It is recommended to initialze the class indirectly, using\n    `~astropy.units.Unit`.  E.g., ``u.Unit('AU,AU/day')``.\n\n    When combined with a structured array to produce a structured\n    `~astropy.units.Quantity`, array field names will take precedence.\n    Generally, passing in ``names`` is needed only if the unit is used\n    unattached to a `~astropy.units.Quantity` and one needs to access its\n    fields.\n\n    Examples\n    --------\n    Various ways to initialize a `~astropy.units.StructuredUnit`::\n\n        >>> import astropy.units as u\n        >>> su = u.Unit('(AU,AU/day),yr')\n        >>> su\n        Unit(\"((AU, AU / d), yr)\")\n        >>> su.field_names\n        (['f0', ('f0', 'f1')], 'f1')\n        >>> su['f1']\n        Unit(\"yr\")\n        >>> su2 = u.StructuredUnit(((u.AU, u.AU/u.day), u.yr), names=(('p', 'v'), 't'))\n        >>> su2 == su\n        True\n        >>> su2.field_names\n        (['pv', ('p', 'v')], 't')\n        >>> su3 = u.StructuredUnit((su2['pv'], u.day), names=(['p_v', ('p', 'v')], 't'))\n        >>> su3.field_names\n        (['p_v', ('p', 'v')], 't')\n        >>> su3.keys()\n        ('p_v', 't')\n        >>> su3.values()\n        (Unit(\"(AU, AU / d)\"), Unit(\"d\"))\n\n    Structured units share most methods with regular units::\n\n        >>> su.physical_type\n        ((PhysicalType('length'), PhysicalType({'speed', 'velocity'})), PhysicalType('time'))\n        >>> su.si\n        Unit(\"((1.49598e+11 m, 1.73146e+06 m / s), 3.15576e+07 s)\")\n\n    \"\"\"\n    def __new__(cls, units, names=None):\n        dtype = None\n        if names is not None:\n            if isinstance(names, StructuredUnit):\n                dtype = names._units.dtype\n                names = names.field_names\n            elif isinstance(names, np.dtype):\n                if not names.fields:\n                    raise ValueError('dtype should be structured, with fields.')\n                dtype = np.dtype([(name, DTYPE_OBJECT) for name in names.names])\n                names = _names_from_dtype(names)\n            else:\n                if not isinstance(names, tuple):\n                    names = (names,)\n                names = _normalize_names(names)\n\n        if not isinstance(units, tuple):\n            units = Unit(units)\n            if isinstance(units, StructuredUnit):\n                # Avoid constructing a new StructuredUnit if no field names\n                # are given, or if all field names are the same already anyway.\n                if names is None or units.field_names == names:\n                    return units\n\n                # Otherwise, turn (the upper level) into a tuple, for renaming.\n                units = units.values()\n            else:\n                # Single regular unit: make a tuple for iteration below.\n                units = (units,)\n\n        if names is None:\n            names = tuple(f'f{i}' for i in range(len(units)))\n\n        elif len(units) != len(names):\n            raise ValueError(\"lengths of units and field names must match.\")\n\n        converted = []\n        for unit, name in zip(units, names):\n            if isinstance(name, list):\n                # For list, the first item is the name of our level,\n                # and the second another tuple of names, i.e., we recurse.\n                unit = cls(unit, name[1])\n                name = name[0]\n            else:\n                # We are at the lowest level.  Check unit.\n                unit = Unit(unit)\n                if dtype is not None and isinstance(unit, StructuredUnit):\n                    raise ValueError(\"units do not match in depth with field \"\n                                     \"names from dtype or structured unit.\")\n\n            converted.append(unit)\n\n        self = super().__new__(cls)\n        if dtype is None:\n            dtype = np.dtype([((name[0] if isinstance(name, list) else name),\n                               DTYPE_OBJECT) for name in names])\n        # Decay array to void so we can access by field name and number.\n        self._units = np.array(tuple(converted), dtype)[()]\n        return self\n\n    def __getnewargs__(self):\n        \"\"\"When de-serializing, e.g. pickle, start with a blank structure.\"\"\"\n        return (), None\n\n    @property\n    def field_names(self):\n        \"\"\"Possibly nested tuple of the field names of the parts.\"\"\"\n        return tuple(([name, unit.field_names]\n                      if isinstance(unit, StructuredUnit) else name)\n                     for name, unit in self.items())\n\n    # Allow StructuredUnit to be treated as an (ordered) mapping.\n    def __len__(self):\n        return len(self._units.dtype.names)\n\n    def __getitem__(self, item):\n        # Since we are based on np.void, indexing by field number works too.\n        return self._units[item]\n\n    def values(self):\n        return self._units.item()\n\n    def keys(self):\n        return self._units.dtype.names\n\n    def items(self):\n        return tuple(zip(self._units.dtype.names, self._units.item()))\n\n    def __iter__(self):\n        yield from self._units.dtype.names\n\n    # Helpers for methods below.\n    def _recursively_apply(self, func, cls=None):\n        \"\"\"Apply func recursively.\n\n        Parameters\n        ----------\n        func : callable\n            Function to apply to all parts of the structured unit,\n            recursing as needed.\n        cls : type, optional\n            If given, should be a subclass of `~numpy.void`. By default,\n            will return a new `~astropy.units.StructuredUnit` instance.\n        \"\"\"\n        results = np.array(tuple([func(part) for part in self.values()]),\n                           self._units.dtype)[()]\n        if cls is not None:\n            return results.view((cls, results.dtype))\n\n        # Short-cut; no need to interpret field names, etc.\n        result = super().__new__(self.__class__)\n        result._units = results\n        return result\n\n    def _recursively_get_dtype(self, value, enter_lists=True):\n        \"\"\"Get structured dtype according to value, using our field names.\n\n        This is useful since ``np.array(value)`` would treat tuples as lower\n        levels of the array, rather than as elements of a structured array.\n        The routine does presume that the type of the first tuple is\n        representative of the rest.  Used in ``_get_converter``.\n\n        For the special value of ``UNITY``, all fields are assumed to be 1.0,\n        and hence this will return an all-float dtype.\n\n        \"\"\"\n        if enter_lists:\n            while isinstance(value, list):\n                value = value[0]\n        if value is UNITY:\n            value = (UNITY,) * len(self)\n        elif not isinstance(value, tuple) or len(self) != len(value):\n            raise ValueError(f\"cannot interpret value {value} for unit {self}.\")\n        descr = []\n        for (name, unit), part in zip(self.items(), value):\n            if isinstance(unit, StructuredUnit):\n                descr.append(\n                    (name, unit._recursively_get_dtype(part, enter_lists=False)))\n            else:\n                # Got a part associated with a regular unit. Gets its dtype.\n                # Like for Quantity, we cast integers to float.\n                part = np.array(part)\n                part_dtype = part.dtype\n                if part_dtype.kind in 'iu':\n                    part_dtype = np.dtype(float)\n                descr.append((name, part_dtype, part.shape))\n        return np.dtype(descr)\n\n    @property\n    def si(self):\n        \"\"\"The `StructuredUnit` instance in SI units.\"\"\"\n        return self._recursively_apply(operator.attrgetter('si'))\n\n    @property\n    def cgs(self):\n        \"\"\"The `StructuredUnit` instance in cgs units.\"\"\"\n        return self._recursively_apply(operator.attrgetter('cgs'))\n\n    # Needed to pass through Unit initializer, so might as well use it.\n    def _get_physical_type_id(self):\n        return self._recursively_apply(\n            operator.methodcaller('_get_physical_type_id'), cls=Structure)\n\n    @property\n    def physical_type(self):\n        \"\"\"Physical types of all the fields.\"\"\"\n        return self._recursively_apply(\n            operator.attrgetter('physical_type'), cls=Structure)\n\n    def decompose(self, bases=set()):\n        \"\"\"The `StructuredUnit` composed of only irreducible units.\n\n        Parameters\n        ----------\n        bases : sequence of `~astropy.units.UnitBase`, optional\n            The bases to decompose into.  When not provided,\n            decomposes down to any irreducible units.  When provided,\n            the decomposed result will only contain the given units.\n            This will raises a `UnitsError` if it's not possible\n            to do so.\n\n        Returns\n        -------\n        `~astropy.units.StructuredUnit`\n            With the unit for each field containing only irreducible units.\n        \"\"\"\n        return self._recursively_apply(\n            operator.methodcaller('decompose', bases=bases))\n\n    def is_equivalent(self, other, equivalencies=[]):\n        \"\"\"`True` if all fields are equivalent to the other's fields.\n\n        Parameters\n        ----------\n        other : `~astropy.units.StructuredUnit`\n            The structured unit to compare with, or what can initialize one.\n        equivalencies : list of tuple, optional\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`unit_equivalencies`.\n            The list will be applied to all fields.\n\n        Returns\n        -------\n        bool\n        \"\"\"\n        try:\n            other = StructuredUnit(other)\n        except Exception:\n            return False\n\n        if len(self) != len(other):\n            return False\n\n        for self_part, other_part in zip(self.values(), other.values()):\n            if not self_part.is_equivalent(other_part,\n                                           equivalencies=equivalencies):\n                return False\n\n        return True\n\n    def _get_converter(self, other, equivalencies=[]):\n        if not isinstance(other, type(self)):\n            other = self.__class__(other, names=self)\n\n        converters = [self_part._get_converter(other_part,\n                                               equivalencies=equivalencies)\n                      for (self_part, other_part) in zip(self.values(),\n                                                         other.values())]\n\n        def converter(value):\n            if not hasattr(value, 'dtype'):\n                value = np.array(value, self._recursively_get_dtype(value))\n            result = np.empty_like(value)\n            for name, converter_ in zip(result.dtype.names, converters):\n                result[name] = converter_(value[name])\n            # Index with empty tuple to decay array scalars to numpy void.\n            return result if result.shape else result[()]\n\n        return converter\n\n    def to(self, other, value=np._NoValue, equivalencies=[]):\n        \"\"\"Return values converted to the specified unit.\n\n        Parameters\n        ----------\n        other : `~astropy.units.StructuredUnit`\n            The unit to convert to.  If necessary, will be converted to\n            a `~astropy.units.StructuredUnit` using the dtype of ``value``.\n        value : array-like, optional\n            Value(s) in the current unit to be converted to the\n            specified unit.  If a sequence, the first element must have\n            entries of the correct type to represent all elements (i.e.,\n            not have, e.g., a ``float`` where other elements have ``complex``).\n            If not given, assumed to have 1. in all fields.\n        equivalencies : list of tuple, optional\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`unit_equivalencies`.\n            This list is in addition to possible global defaults set by, e.g.,\n            `set_enabled_equivalencies`.\n            Use `None` to turn off all equivalencies.\n\n        Returns\n        -------\n        values : scalar or array\n            Converted value(s).\n\n        Raises\n        ------\n        UnitsError\n            If units are inconsistent\n        \"\"\"\n        if value is np._NoValue:\n            # We do not have UNITY as a default, since then the docstring\n            # would list 1.0 as default, yet one could not pass that in.\n            value = UNITY\n        return self._get_converter(other, equivalencies=equivalencies)(value)\n\n    def to_string(self, format='generic'):\n        \"\"\"Output the unit in the given format as a string.\n\n        Units are separated by commas.\n\n        Parameters\n        ----------\n        format : `astropy.units.format.Base` instance or str\n            The name of a format or a formatter object.  If not\n            provided, defaults to the generic format.\n\n        Notes\n        -----\n        Structured units can be written to all formats, but can be\n        re-read only with 'generic'.\n\n        \"\"\"\n        parts = [part.to_string(format) for part in self.values()]\n        out_fmt = '({})' if len(self) > 1 else '({},)'\n        if format == 'latex':\n            # Strip $ from parts and add them on the outside.\n            parts = [part[1:-1] for part in parts]\n            out_fmt = '$' + out_fmt + '$'\n        return out_fmt.format(', '.join(parts))\n\n    def _repr_latex_(self):\n        return self.to_string('latex')\n\n    __array_ufunc__ = None\n\n    def __mul__(self, other):\n        if isinstance(other, str):\n            try:\n                other = Unit(other, parse_strict='silent')\n            except Exception:\n                return NotImplemented\n        if isinstance(other, UnitBase):\n            new_units = tuple(part * other for part in self.values())\n            return self.__class__(new_units, names=self)\n        if isinstance(other, StructuredUnit):\n            return NotImplemented\n\n        # Anything not like a unit, try initialising as a structured quantity.\n        try:\n            from .quantity import Quantity\n            return Quantity(other, unit=self)\n        except Exception:\n            return NotImplemented\n\n    def __rmul__(self, other):\n        return self.__mul__(other)\n\n    def __truediv__(self, other):\n        if isinstance(other, str):\n            try:\n                other = Unit(other, parse_strict='silent')\n            except Exception:\n                return NotImplemented\n\n        if isinstance(other, UnitBase):\n            new_units = tuple(part / other for part in self.values())\n            return self.__class__(new_units, names=self)\n        return NotImplemented\n\n    def __rlshift__(self, m):\n        try:\n            from .quantity import Quantity\n            return Quantity(m, self, copy=False, subok=True)\n        except Exception:\n            return NotImplemented\n\n    def __str__(self):\n        return self.to_string()\n\n    def __repr__(self):\n        return f'Unit(\"{self.to_string()}\")'\n\n    def __eq__(self, other):\n        try:\n            other = StructuredUnit(other)\n        except Exception:\n            return NotImplemented\n\n        return self.values() == other.values()\n\n    def __ne__(self, other):\n        if not isinstance(other, type(self)):\n            try:\n                other = StructuredUnit(other)\n            except Exception:\n                return NotImplemented\n\n        return self.values() != other.values()"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":9761,"name":"s","nodeType":"Attribute","startLoc":19,"text":"s"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":9762,"name":"C","nodeType":"Attribute","startLoc":20,"text":"C"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":9763,"name":"_ns","nodeType":"Attribute","startLoc":21,"text":"_ns"},{"col":4,"comment":"When de-serializing, e.g. pickle, start with a blank structure.","endLoc":185,"header":"def __getnewargs__(self)","id":9764,"name":"__getnewargs__","nodeType":"Function","startLoc":183,"text":"def __getnewargs__(self):\n        \"\"\"When de-serializing, e.g. pickle, start with a blank structure.\"\"\"\n        return (), None"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":9765,"name":"rad","nodeType":"Attribute","startLoc":21,"text":"rad"},{"col":4,"comment":"Possibly nested tuple of the field names of the parts.","endLoc":192,"header":"@property\n    def field_names(self)","id":9766,"name":"field_names","nodeType":"Function","startLoc":187,"text":"@property\n    def field_names(self):\n        \"\"\"Possibly nested tuple of the field names of the parts.\"\"\"\n        return tuple(([name, unit.field_names]\n                      if isinstance(unit, StructuredUnit) else name)\n                     for name, unit in self.items())"},{"col":0,"comment":"null","endLoc":128,"header":"@pytest.fixture(params=[False, True])\ndef table_type(request)","id":9767,"name":"table_type","nodeType":"Function","startLoc":126,"text":"@pytest.fixture(params=[False, True])\ndef table_type(request):\n    return MaskedTable if request.param else table.Table"},{"attributeType":"null","col":45,"comment":"null","endLoc":48,"id":9768,"name":"_generate_unit_summary","nodeType":"Attribute","startLoc":48,"text":"_generate_unit_summary"},{"attributeType":"null","col":56,"comment":"null","endLoc":49,"id":9769,"name":"_generate_prefixonly_unit_summary","nodeType":"Attribute","startLoc":49,"text":"_generate_prefixonly_unit_summary"},{"col":0,"comment":"","endLoc":19,"header":"deprecated.py#<anonymous>","id":9770,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis package defines deprecated units.\n\nThese units are not available in the top-level `astropy.units`\nnamespace. To use these units, you must import the `astropy.units.deprecated`\nmodule::\n\n    >>> from astropy.units import deprecated\n    >>> q = 10. * deprecated.emu  # doctest: +SKIP\n\nTo include them in `~astropy.units.UnitBase.compose` and the results of\n`~astropy.units.UnitBase.find_equivalent_units`, do::\n\n    >>> from astropy.units import deprecated\n    >>> deprecated.enable()  # doctest: +SKIP\n\n\"\"\"\n\n_ns = globals()\n\n_initialize_module()\n\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())\n    __doc__ += _generate_prefixonly_unit_summary(globals())"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":9771,"name":"sr","nodeType":"Attribute","startLoc":22,"text":"sr"},{"col":0,"comment":"\n    Fixture to return a set of columns for mixin testing which includes\n    an index column 'i', two string cols 'a', 'b' (for joins etc), and\n    one of the available mixin column types.\n    ","endLoc":176,"header":"@pytest.fixture(params=sorted(MIXIN_COLS))\ndef mixin_cols(request)","id":9772,"name":"mixin_cols","nodeType":"Function","startLoc":162,"text":"@pytest.fixture(params=sorted(MIXIN_COLS))\ndef mixin_cols(request):\n    \"\"\"\n    Fixture to return a set of columns for mixin testing which includes\n    an index column 'i', two string cols 'a', 'b' (for joins etc), and\n    one of the available mixin column types.\n    \"\"\"\n    cols = OrderedDict()\n    mixin_cols = deepcopy(MIXIN_COLS)\n    cols['i'] = table.Column([0, 1, 2, 3], name='i')\n    cols['a'] = table.Column(['a', 'b', 'b', 'c'], name='a')\n    cols['b'] = table.Column(['b', 'c', 'a', 'd'], name='b')\n    cols['m'] = mixin_cols[request.param]\n\n    return cols"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":9773,"name":"cd","nodeType":"Attribute","startLoc":23,"text":"cd"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":9774,"name":"K","nodeType":"Attribute","startLoc":24,"text":"K"},{"fileName":"utils.py","filePath":"astropy/units","id":9775,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nMiscellaneous utilities for `astropy.units`.\n\nNone of the functions in the module are meant for use outside of the\npackage.\n\"\"\"\n\nimport io\nimport re\nfrom fractions import Fraction\n\nimport numpy as np\nfrom numpy import finfo\n\n\n_float_finfo = finfo(float)\n# take float here to ensure comparison with another float is fast\n# give a little margin since often multiple calculations happened\n_JUST_BELOW_UNITY = float(1.-4.*_float_finfo.epsneg)\n_JUST_ABOVE_UNITY = float(1.+4.*_float_finfo.eps)\n\n\ndef _get_first_sentence(s):\n    \"\"\"\n    Get the first sentence from a string and remove any carriage\n    returns.\n    \"\"\"\n\n    x = re.match(r\".*?\\S\\.\\s\", s)\n    if x is not None:\n        s = x.group(0)\n    return s.replace('\\n', ' ')\n\n\ndef _iter_unit_summary(namespace):\n    \"\"\"\n    Generates the ``(unit, doc, represents, aliases, prefixes)``\n    tuple used to format the unit summary docs in `generate_unit_summary`.\n    \"\"\"\n\n    from . import core\n\n    # Get all of the units, and keep track of which ones have SI\n    # prefixes\n    units = []\n    has_prefixes = set()\n    for key, val in namespace.items():\n        # Skip non-unit items\n        if not isinstance(val, core.UnitBase):\n            continue\n\n        # Skip aliases\n        if key != val.name:\n            continue\n\n        if isinstance(val, core.PrefixUnit):\n            # This will return the root unit that is scaled by the prefix\n            # attached to it\n            has_prefixes.add(val._represents.bases[0].name)\n        else:\n            units.append(val)\n\n    # Sort alphabetically, case insensitive\n    units.sort(key=lambda x: x.name.lower())\n\n    for unit in units:\n        doc = _get_first_sentence(unit.__doc__).strip()\n        represents = ''\n        if isinstance(unit, core.Unit):\n            represents = f\":math:`{unit._represents.to_string('latex')[1:-1]}`\"\n        aliases = ', '.join(f'``{x}``' for x in unit.aliases)\n\n        yield (unit, doc, represents, aliases, 'Yes' if unit.name in has_prefixes else 'No')\n\n\ndef generate_unit_summary(namespace):\n    \"\"\"\n    Generates a summary of units from a given namespace.  This is used\n    to generate the docstring for the modules that define the actual\n    units.\n\n    Parameters\n    ----------\n    namespace : dict\n        A namespace containing units.\n\n    Returns\n    -------\n    docstring : str\n        A docstring containing a summary table of the units.\n    \"\"\"\n\n    docstring = io.StringIO()\n\n    docstring.write(\"\"\"\n.. list-table:: Available Units\n   :header-rows: 1\n   :widths: 10 20 20 20 1\n\n   * - Unit\n     - Description\n     - Represents\n     - Aliases\n     - SI Prefixes\n\"\"\")\n\n    for unit_summary in _iter_unit_summary(namespace):\n        docstring.write(\"\"\"\n   * - ``{}``\n     - {}\n     - {}\n     - {}\n     - {}\n\"\"\".format(*unit_summary))\n\n    return docstring.getvalue()\n\n\ndef generate_prefixonly_unit_summary(namespace):\n    \"\"\"\n    Generates table entries for units in a namespace that are just prefixes\n    without the base unit.  Note that this is intended to be used *after*\n    `generate_unit_summary` and therefore does not include the table header.\n\n    Parameters\n    ----------\n    namespace : dict\n        A namespace containing units that are prefixes but do *not* have the\n        base unit in their namespace.\n\n    Returns\n    -------\n    docstring : str\n        A docstring containing a summary table of the units.\n    \"\"\"\n    from . import PrefixUnit\n\n    faux_namespace = {}\n    for nm, unit in namespace.items():\n        if isinstance(unit, PrefixUnit):\n            base_unit = unit.represents.bases[0]\n            faux_namespace[base_unit.name] = base_unit\n\n    docstring = io.StringIO()\n\n    for unit_summary in _iter_unit_summary(faux_namespace):\n        docstring.write(\"\"\"\n   * - Prefixes for ``{}``\n     - {} prefixes\n     - {}\n     - {}\n     - Only\n\"\"\".format(*unit_summary))\n\n    return docstring.getvalue()\n\n\ndef is_effectively_unity(value):\n    # value is *almost* always real, except, e.g., for u.mag**0.5, when\n    # it will be complex.  Use try/except to ensure normal case is fast\n    try:\n        return _JUST_BELOW_UNITY <= value <= _JUST_ABOVE_UNITY\n    except TypeError:  # value is complex\n        return (_JUST_BELOW_UNITY <= value.real <= _JUST_ABOVE_UNITY and\n                _JUST_BELOW_UNITY <= value.imag + 1 <= _JUST_ABOVE_UNITY)\n\n\ndef sanitize_scale(scale):\n    if is_effectively_unity(scale):\n        return 1.0\n\n    # Maximum speed for regular case where scale is a float.\n    if scale.__class__ is float:\n        return scale\n\n    # We cannot have numpy scalars, since they don't autoconvert to\n    # complex if necessary.  They are also slower.\n    if hasattr(scale, 'dtype'):\n        scale = scale.item()\n\n    # All classes that scale can be (int, float, complex, Fraction)\n    # have an \"imag\" attribute.\n    if scale.imag:\n        if abs(scale.real) > abs(scale.imag):\n            if is_effectively_unity(scale.imag/scale.real + 1):\n                return scale.real\n\n        elif is_effectively_unity(scale.real/scale.imag + 1):\n            return complex(0., scale.imag)\n\n        return scale\n\n    else:\n        return scale.real\n\n\ndef maybe_simple_fraction(p, max_denominator=100):\n    \"\"\"Fraction very close to x with denominator at most max_denominator.\n\n    The fraction has to be such that fraction/x is unity to within 4 ulp.\n    If such a fraction does not exist, returns the float number.\n\n    The algorithm is that of `fractions.Fraction.limit_denominator`, but\n    sped up by not creating a fraction to start with.\n    \"\"\"\n    if p == 0 or p.__class__ is int:\n        return p\n    n, d = p.as_integer_ratio()\n    a = n // d\n    # Normally, start with 0,1 and 1,0; here we have applied first iteration.\n    n0, d0 = 1, 0\n    n1, d1 = a, 1\n    while d1 <= max_denominator:\n        if _JUST_BELOW_UNITY <= n1/(d1*p) <= _JUST_ABOVE_UNITY:\n            return Fraction(n1, d1)\n        n, d = d, n-a*d\n        a = n // d\n        n0, n1 = n1, n0+a*n1\n        d0, d1 = d1, d0+a*d1\n\n    return p\n\n\ndef validate_power(p):\n    \"\"\"Convert a power to a floating point value, an integer, or a Fraction.\n\n    If a fractional power can be represented exactly as a floating point\n    number, convert it to a float, to make the math much faster; otherwise,\n    retain it as a `fractions.Fraction` object to avoid losing precision.\n    Conversely, if the value is indistinguishable from a rational number with a\n    low-numbered denominator, convert to a Fraction object.\n\n    Parameters\n    ----------\n    p : float, int, Rational, Fraction\n        Power to be converted\n    \"\"\"\n    denom = getattr(p, 'denominator', None)\n    if denom is None:\n        try:\n            p = float(p)\n        except Exception:\n            if not np.isscalar(p):\n                raise ValueError(\"Quantities and Units may only be raised \"\n                                 \"to a scalar power\")\n            else:\n                raise\n\n        # This returns either a (simple) Fraction or the same float.\n        p = maybe_simple_fraction(p)\n        # If still a float, nothing more to be done.\n        if isinstance(p, float):\n            return p\n\n        # Otherwise, check for simplifications.\n        denom = p.denominator\n\n    if denom == 1:\n        p = p.numerator\n\n    elif (denom & (denom - 1)) == 0:\n        # Above is a bit-twiddling hack to see if denom is a power of two.\n        # If so, float does not lose precision and will speed things up.\n        p = float(p)\n\n    return p\n\n\ndef resolve_fractions(a, b):\n    \"\"\"\n    If either input is a Fraction, convert the other to a Fraction\n    (at least if it does not have a ridiculous denominator).\n    This ensures that any operation involving a Fraction will use\n    rational arithmetic and preserve precision.\n    \"\"\"\n    # We short-circuit on the most common cases of int and float, since\n    # isinstance(a, Fraction) is very slow for any non-Fraction instances.\n    a_is_fraction = (a.__class__ is not int and a.__class__ is not float and\n                     isinstance(a, Fraction))\n    b_is_fraction = (b.__class__ is not int and b.__class__ is not float and\n                     isinstance(b, Fraction))\n    if a_is_fraction and not b_is_fraction:\n        b = maybe_simple_fraction(b)\n    elif not a_is_fraction and b_is_fraction:\n        a = maybe_simple_fraction(a)\n    return a, b\n\n\ndef quantity_asanyarray(a, dtype=None):\n    from .quantity import Quantity\n    if not isinstance(a, np.ndarray) and not np.isscalar(a) and any(isinstance(x, Quantity) for x in a):\n        return Quantity(a, dtype=dtype)\n    else:\n        return np.asanyarray(a, dtype=dtype)\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":9776,"name":"_float_finfo","nodeType":"Attribute","startLoc":17,"text":"_float_finfo"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":9777,"name":"_JUST_BELOW_UNITY","nodeType":"Attribute","startLoc":20,"text":"_JUST_BELOW_UNITY"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":9778,"name":"_JUST_ABOVE_UNITY","nodeType":"Attribute","startLoc":21,"text":"_JUST_ABOVE_UNITY"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":9779,"name":"deg_C","nodeType":"Attribute","startLoc":25,"text":"deg_C"},{"col":0,"comment":"","endLoc":7,"header":"utils.py#<anonymous>","id":9780,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nMiscellaneous utilities for `astropy.units`.\n\nNone of the functions in the module are meant for use outside of the\npackage.\n\"\"\"\n\n_float_finfo = finfo(float)\n\n_JUST_BELOW_UNITY = float(1.-4.*_float_finfo.epsneg)\n\n_JUST_ABOVE_UNITY = float(1.+4.*_float_finfo.eps)"},{"col":4,"comment":"null","endLoc":209,"header":"def items(self)","id":9781,"name":"items","nodeType":"Function","startLoc":208,"text":"def items(self):\n        return tuple(zip(self._units.dtype.names, self._units.item()))"},{"fileName":"_typing.py","filePath":"astropy/units","id":9782,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nSupport for ``typing`` py3.9+ features while min version is py3.8.\n\"\"\"\n\nfrom typing import *\n\ntry:  # py 3.9+\n    from typing import Annotated\nexcept (ImportError, ModuleNotFoundError):  # optional dependency\n    try:\n        from typing_extensions import Annotated\n    except (ImportError, ModuleNotFoundError):\n\n        Annotated = NotImplemented\n\n    else:\n        from typing_extensions import *  # override typing\n\nHAS_ANNOTATED = Annotated is not NotImplemented\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":9783,"name":"HAS_ANNOTATED","nodeType":"Attribute","startLoc":20,"text":"HAS_ANNOTATED"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":9784,"name":"mol","nodeType":"Attribute","startLoc":26,"text":"mol"},{"col":4,"comment":"null","endLoc":196,"header":"def __len__(self)","id":9785,"name":"__len__","nodeType":"Function","startLoc":195,"text":"def __len__(self):\n        return len(self._units.dtype.names)"},{"col":0,"comment":"","endLoc":4,"header":"_typing.py#<anonymous>","id":9786,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nSupport for ``typing`` py3.9+ features while min version is py3.8.\n\"\"\"\n\ntry:  # py 3.9+\n    from typing import Annotated\nexcept (ImportError, ModuleNotFoundError):  # optional dependency\n    try:\n        from typing_extensions import Annotated\n    except (ImportError, ModuleNotFoundError):\n\n        Annotated = NotImplemented\n\n    else:\n        from typing_extensions import *  # override typing\n\nHAS_ANNOTATED = Annotated is not NotImplemented"},{"col":4,"comment":"null","endLoc":200,"header":"def __getitem__(self, item)","id":9787,"name":"__getitem__","nodeType":"Function","startLoc":198,"text":"def __getitem__(self, item):\n        # Since we are based on np.void, indexing by field number works too.\n        return self._units[item]"},{"col":4,"comment":"null","endLoc":203,"header":"def values(self)","id":9788,"name":"values","nodeType":"Function","startLoc":202,"text":"def values(self):\n        return self._units.item()"},{"col":4,"comment":"null","endLoc":206,"header":"def keys(self)","id":9789,"name":"keys","nodeType":"Function","startLoc":205,"text":"def keys(self):\n        return self._units.dtype.names"},{"col":4,"comment":"null","endLoc":212,"header":"def __iter__(self)","id":9790,"name":"__iter__","nodeType":"Function","startLoc":211,"text":"def __iter__(self):\n        yield from self._units.dtype.names"},{"col":4,"comment":"Apply func recursively.\n\n        Parameters\n        ----------\n        func : callable\n            Function to apply to all parts of the structured unit,\n            recursing as needed.\n        cls : type, optional\n            If given, should be a subclass of `~numpy.void`. By default,\n            will return a new `~astropy.units.StructuredUnit` instance.\n        ","endLoc":235,"header":"def _recursively_apply(self, func, cls=None)","id":9791,"name":"_recursively_apply","nodeType":"Function","startLoc":215,"text":"def _recursively_apply(self, func, cls=None):\n        \"\"\"Apply func recursively.\n\n        Parameters\n        ----------\n        func : callable\n            Function to apply to all parts of the structured unit,\n            recursing as needed.\n        cls : type, optional\n            If given, should be a subclass of `~numpy.void`. By default,\n            will return a new `~astropy.units.StructuredUnit` instance.\n        \"\"\"\n        results = np.array(tuple([func(part) for part in self.values()]),\n                           self._units.dtype)[()]\n        if cls is not None:\n            return results.view((cls, results.dtype))\n\n        # Short-cut; no need to interpret field names, etc.\n        result = super().__new__(self.__class__)\n        result._units = results\n        return result"},{"attributeType":"null","col":0,"comment":"null","endLoc":116,"id":9792,"name":"bases","nodeType":"Attribute","startLoc":116,"text":"bases"},{"col":0,"comment":"","endLoc":7,"header":"cgs.py#<anonymous>","id":9793,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis package defines the CGS units.  They are also available in the\ntop-level `astropy.units` namespace.\n\n\"\"\"\n\n_ns = globals()\n\ndef_unit(['cm', 'centimeter'], si.cm, namespace=_ns, prefixes=False)\n\ng = si.g\n\ns = si.s\n\nC = si.C\n\nrad = si.rad\n\nsr = si.sr\n\ncd = si.cd\n\nK = si.K\n\ndeg_C = si.deg_C\n\nmol = si.mol\n\ndef_unit(['Gal', 'gal'], cm / s ** 2, namespace=_ns, prefixes=True,\n         doc=\"Gal: CGS unit of acceleration\")\n\ndef_unit(['erg'], g * cm ** 2 / s ** 2, namespace=_ns, prefixes=True,\n         doc=\"erg: CGS unit of energy\")\n\ndef_unit(['dyn', 'dyne'], g * cm / s ** 2, namespace=_ns,\n         prefixes=True,\n         doc=\"dyne: CGS unit of force\")\n\ndef_unit(['Ba', 'Barye', 'barye'], g / (cm * s ** 2), namespace=_ns,\n         prefixes=True,\n         doc=\"Barye: CGS unit of pressure\")\n\ndef_unit(['P', 'poise'], g / (cm * s), namespace=_ns,\n         prefixes=True,\n         doc=\"poise: CGS unit of dynamic viscosity\")\n\ndef_unit(['St', 'stokes'], cm ** 2 / s, namespace=_ns,\n         prefixes=True,\n         doc=\"stokes: CGS unit of kinematic viscosity\")\n\ndef_unit(['k', 'Kayser', 'kayser'], cm ** -1, namespace=_ns,\n         prefixes=True,\n         doc=\"kayser: CGS unit of wavenumber\")\n\ndef_unit(['D', 'Debye', 'debye'], Fraction(1, 3) * 1e-29 * C * si.m,\n         namespace=_ns, prefixes=True,\n         doc=\"Debye: CGS unit of electric dipole moment\")\n\ndef_unit(['Fr', 'Franklin', 'statcoulomb', 'statC', 'esu'],\n         g ** Fraction(1, 2) * cm ** Fraction(3, 2) * s ** -1,\n         namespace=_ns,\n         doc='Franklin: CGS (ESU) unit of charge')\n\ndef_unit(['statA', 'statampere'], Fr * s ** -1, namespace=_ns,\n         doc='statampere: CGS (ESU) unit of current')\n\ndef_unit(['Bi', 'Biot', 'abA', 'abampere'],\n         g ** Fraction(1, 2) * cm ** Fraction(1, 2) * s ** -1, namespace=_ns,\n         doc='Biot: CGS (EMU) unit of current')\n\ndef_unit(['abC', 'abcoulomb'], Bi * s, namespace=_ns,\n         doc='abcoulomb: CGS (EMU) of charge')\n\ndef_unit(['G', 'Gauss', 'gauss'], 1e-4 * si.T, namespace=_ns, prefixes=True,\n         doc=\"Gauss: CGS unit for magnetic field\")\n\nbases = set([cm, g, s, rad, cd, K, mol])\n\ndel UnitBase\n\ndel def_unit\n\ndel si\n\ndel Fraction\n\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())"},{"fileName":"imperial.py","filePath":"astropy/units","id":9794,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis package defines colloquially used Imperial units.  They are\navailable in the `astropy.units.imperial` namespace, but not in the\ntop-level `astropy.units` namespace, e.g.::\n\n    >>> import astropy.units as u\n    >>> mph = u.imperial.mile / u.hour\n    >>> mph\n    Unit(\"mi / h\")\n\nTo include them in `~astropy.units.UnitBase.compose` and the results of\n`~astropy.units.UnitBase.find_equivalent_units`, do::\n\n    >>> import astropy.units as u\n    >>> u.imperial.enable()  # doctest: +SKIP\n\"\"\"\n\n\nfrom .core import UnitBase, def_unit\nfrom . import si\n\n_ns = globals()\n\n###########################################################################\n# LENGTH\n\ndef_unit(['inch'], 2.54 * si.cm, namespace=_ns,\n         doc=\"International inch\")\ndef_unit(['ft', 'foot'], 12 * inch, namespace=_ns,\n         doc=\"International foot\")\ndef_unit(['yd', 'yard'], 3 * ft, namespace=_ns,\n         doc=\"International yard\")\ndef_unit(['mi', 'mile'], 5280 * ft, namespace=_ns,\n         doc=\"International mile\")\ndef_unit(['mil', 'thou'], 0.001 * inch, namespace=_ns,\n         doc=\"Thousandth of an inch\")\ndef_unit(['nmi', 'nauticalmile', 'NM'], 1852 * si.m, namespace=_ns,\n         doc=\"Nautical mile\")\ndef_unit(['fur', 'furlong'], 660 * ft, namespace=_ns,\n         doc=\"Furlong\")\n\n\n###########################################################################\n# AREAS\n\ndef_unit(['ac', 'acre'], 43560 * ft ** 2, namespace=_ns,\n         doc=\"International acre\")\n\n\n###########################################################################\n# VOLUMES\n\ndef_unit(['gallon'], si.liter / 0.264172052, namespace=_ns,\n         doc=\"U.S. liquid gallon\")\ndef_unit(['quart'], gallon / 4, namespace=_ns,\n         doc=\"U.S. liquid quart\")\ndef_unit(['pint'], quart / 2, namespace=_ns,\n         doc=\"U.S. liquid pint\")\ndef_unit(['cup'], pint / 2, namespace=_ns,\n         doc=\"U.S. customary cup\")\ndef_unit(['foz', 'fluid_oz', 'fluid_ounce'], cup / 8, namespace=_ns,\n         doc=\"U.S. fluid ounce\")\ndef_unit(['tbsp', 'tablespoon'], foz / 2, namespace=_ns,\n         doc=\"U.S. customary tablespoon\")\ndef_unit(['tsp', 'teaspoon'], tbsp / 3, namespace=_ns,\n         doc=\"U.S. customary teaspoon\")\n\n\n###########################################################################\n# MASS\n\ndef_unit(['oz', 'ounce'], 28.349523125 * si.g, namespace=_ns,\n         doc=\"International avoirdupois ounce: mass\")\ndef_unit(['lb', 'lbm', 'pound'], 16 * oz, namespace=_ns,\n         doc=\"International avoirdupois pound: mass\")\ndef_unit(['st', 'stone'], 14 * lb, namespace=_ns,\n         doc=\"International avoirdupois stone: mass\")\ndef_unit(['ton'], 2000 * lb, namespace=_ns,\n         doc=\"International avoirdupois ton: mass\")\ndef_unit(['slug'], 32.174049 * lb, namespace=_ns,\n         doc=\"slug: mass\")\n\n\n###########################################################################\n# SPEED\n\ndef_unit(['kn', 'kt', 'knot', 'NMPH'], nmi / si.h, namespace=_ns,\n         doc=\"nautical unit of speed: 1 nmi per hour\")\n\n\n###########################################################################\n# FORCE\n\ndef_unit('lbf', slug * ft * si.s**-2, namespace=_ns,\n         doc=\"Pound: force\")\ndef_unit(['kip', 'kilopound'], 1000 * lbf, namespace=_ns,\n         doc=\"Kilopound: force\")\n\n\n##########################################################################\n# ENERGY\n\ndef_unit(['BTU', 'btu'], 1.05505585 * si.kJ, namespace=_ns,\n         doc=\"British thermal unit\")\ndef_unit(['cal', 'calorie'], 4.184 * si.J, namespace=_ns,\n         doc=\"Thermochemical calorie: pre-SI metric unit of energy\")\ndef_unit(['kcal', 'Cal', 'Calorie', 'kilocal', 'kilocalorie'],\n         1000 * cal, namespace=_ns,\n         doc=\"Calorie: colloquial definition of Calorie\")\n\n\n##########################################################################\n# PRESSURE\n\ndef_unit('psi', lbf * inch ** -2, namespace=_ns,\n         doc=\"Pound per square inch: pressure\")\n\n\n###########################################################################\n# POWER\n\n# Imperial units\ndef_unit(['hp', 'horsepower'], si.W / 0.00134102209, namespace=_ns,\n         doc=\"Electrical horsepower\")\n\n\n###########################################################################\n# TEMPERATURE\n\ndef_unit(['deg_F', 'Fahrenheit'], namespace=_ns, doc='Degrees Fahrenheit',\n         format={'latex': r'{}^{\\circ}F', 'unicode': '°F'})\ndef_unit(['deg_R', 'Rankine'], namespace=_ns, doc='Rankine scale: absolute scale of thermodynamic temperature')\n\n\n###########################################################################\n# CLEANUP\n\ndel UnitBase\ndel def_unit\n\n\n###########################################################################\n# DOCSTRING\n\n# This generates a docstring for this module that describes all of the\n# standard units defined here.\nfrom .utils import generate_unit_summary as _generate_unit_summary\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())\n\n\ndef enable():\n    \"\"\"\n    Enable Imperial units so they appear in results of\n    `~astropy.units.UnitBase.find_equivalent_units` and\n    `~astropy.units.UnitBase.compose`.\n\n    This may be used with the ``with`` statement to enable Imperial\n    units only temporarily.\n    \"\"\"\n    # Local import to avoid cyclical import\n    from .core import add_enabled_units\n    # Local import to avoid polluting namespace\n    import inspect\n    return add_enabled_units(inspect.getmodule(enable))\n"},{"col":4,"comment":"Get structured dtype according to value, using our field names.\n\n        This is useful since ``np.array(value)`` would treat tuples as lower\n        levels of the array, rather than as elements of a structured array.\n        The routine does presume that the type of the first tuple is\n        representative of the rest.  Used in ``_get_converter``.\n\n        For the special value of ``UNITY``, all fields are assumed to be 1.0,\n        and hence this will return an all-float dtype.\n\n        ","endLoc":269,"header":"def _recursively_get_dtype(self, value, enter_lists=True)","id":9795,"name":"_recursively_get_dtype","nodeType":"Function","startLoc":237,"text":"def _recursively_get_dtype(self, value, enter_lists=True):\n        \"\"\"Get structured dtype according to value, using our field names.\n\n        This is useful since ``np.array(value)`` would treat tuples as lower\n        levels of the array, rather than as elements of a structured array.\n        The routine does presume that the type of the first tuple is\n        representative of the rest.  Used in ``_get_converter``.\n\n        For the special value of ``UNITY``, all fields are assumed to be 1.0,\n        and hence this will return an all-float dtype.\n\n        \"\"\"\n        if enter_lists:\n            while isinstance(value, list):\n                value = value[0]\n        if value is UNITY:\n            value = (UNITY,) * len(self)\n        elif not isinstance(value, tuple) or len(self) != len(value):\n            raise ValueError(f\"cannot interpret value {value} for unit {self}.\")\n        descr = []\n        for (name, unit), part in zip(self.items(), value):\n            if isinstance(unit, StructuredUnit):\n                descr.append(\n                    (name, unit._recursively_get_dtype(part, enter_lists=False)))\n            else:\n                # Got a part associated with a regular unit. Gets its dtype.\n                # Like for Quantity, we cast integers to float.\n                part = np.array(part)\n                part_dtype = part.dtype\n                if part_dtype.kind in 'iu':\n                    part_dtype = np.dtype(float)\n                descr.append((name, part_dtype, part.shape))\n        return np.dtype(descr)"},{"col":0,"comment":"\n    Enable Imperial units so they appear in results of\n    `~astropy.units.UnitBase.find_equivalent_units` and\n    `~astropy.units.UnitBase.compose`.\n\n    This may be used with the ``with`` statement to enable Imperial\n    units only temporarily.\n    ","endLoc":168,"header":"def enable()","id":9796,"name":"enable","nodeType":"Function","startLoc":155,"text":"def enable():\n    \"\"\"\n    Enable Imperial units so they appear in results of\n    `~astropy.units.UnitBase.find_equivalent_units` and\n    `~astropy.units.UnitBase.compose`.\n\n    This may be used with the ``with`` statement to enable Imperial\n    units only temporarily.\n    \"\"\"\n    # Local import to avoid cyclical import\n    from .core import add_enabled_units\n    # Local import to avoid polluting namespace\n    import inspect\n    return add_enabled_units(inspect.getmodule(enable))"},{"fileName":"structured.py","filePath":"astropy/units","id":9797,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module defines structured units and quantities.\n\"\"\"\n\n# Standard library\nimport operator\n\nimport numpy as np\n\nfrom .core import Unit, UnitBase, UNITY\n\n\n__all__ = ['StructuredUnit']\n\n\nDTYPE_OBJECT = np.dtype('O')\n\n\ndef _names_from_dtype(dtype):\n    \"\"\"Recursively extract field names from a dtype.\"\"\"\n    names = []\n    for name in dtype.names:\n        subdtype = dtype.fields[name][0]\n        if subdtype.names:\n            names.append([name, _names_from_dtype(subdtype)])\n        else:\n            names.append(name)\n    return tuple(names)\n\n\ndef _normalize_names(names):\n    \"\"\"Recursively normalize, inferring upper level names for unadorned tuples.\n\n    Generally, we want the field names to be organized like dtypes, as in\n    ``(['pv', ('p', 'v')], 't')``.  But we automatically infer upper\n    field names if the list is absent from items like ``(('p', 'v'), 't')``,\n    by concatenating the names inside the tuple.\n    \"\"\"\n    result = []\n    for name in names:\n        if isinstance(name, str) and len(name) > 0:\n            result.append(name)\n        elif (isinstance(name, list)\n              and len(name) == 2\n              and isinstance(name[0], str) and len(name[0]) > 0\n              and isinstance(name[1], tuple) and len(name[1]) > 0):\n            result.append([name[0], _normalize_names(name[1])])\n        elif isinstance(name, tuple) and len(name) > 0:\n            new_tuple = _normalize_names(name)\n            result.append([''.join([(i[0] if isinstance(i, list) else i)\n                                    for i in new_tuple]), new_tuple])\n        else:\n            raise ValueError(f'invalid entry {name!r}. Should be a name, '\n                             'tuple of names, or 2-element list of the '\n                             'form [name, tuple of names].')\n\n    return tuple(result)\n\n\nclass StructuredUnit:\n    \"\"\"Container for units for a structured Quantity.\n\n    Parameters\n    ----------\n    units : unit-like, tuple of unit-like, or `~astropy.units.StructuredUnit`\n        Tuples can be nested.  If a `~astropy.units.StructuredUnit` is passed\n        in, it will be returned unchanged unless different names are requested.\n    names : tuple of str, tuple or list; `~numpy.dtype`; or `~astropy.units.StructuredUnit`, optional\n        Field names for the units, possibly nested. Can be inferred from a\n        structured `~numpy.dtype` or another `~astropy.units.StructuredUnit`.\n        For nested tuples, by default the name of the upper entry will be the\n        concatenation of the names of the lower levels.  One can pass in a\n        list with the upper-level name and a tuple of lower-level names to\n        avoid this.  For tuples, not all levels have to be given; for any level\n        not passed in, default field names of 'f0', 'f1', etc., will be used.\n\n    Notes\n    -----\n    It is recommended to initialze the class indirectly, using\n    `~astropy.units.Unit`.  E.g., ``u.Unit('AU,AU/day')``.\n\n    When combined with a structured array to produce a structured\n    `~astropy.units.Quantity`, array field names will take precedence.\n    Generally, passing in ``names`` is needed only if the unit is used\n    unattached to a `~astropy.units.Quantity` and one needs to access its\n    fields.\n\n    Examples\n    --------\n    Various ways to initialize a `~astropy.units.StructuredUnit`::\n\n        >>> import astropy.units as u\n        >>> su = u.Unit('(AU,AU/day),yr')\n        >>> su\n        Unit(\"((AU, AU / d), yr)\")\n        >>> su.field_names\n        (['f0', ('f0', 'f1')], 'f1')\n        >>> su['f1']\n        Unit(\"yr\")\n        >>> su2 = u.StructuredUnit(((u.AU, u.AU/u.day), u.yr), names=(('p', 'v'), 't'))\n        >>> su2 == su\n        True\n        >>> su2.field_names\n        (['pv', ('p', 'v')], 't')\n        >>> su3 = u.StructuredUnit((su2['pv'], u.day), names=(['p_v', ('p', 'v')], 't'))\n        >>> su3.field_names\n        (['p_v', ('p', 'v')], 't')\n        >>> su3.keys()\n        ('p_v', 't')\n        >>> su3.values()\n        (Unit(\"(AU, AU / d)\"), Unit(\"d\"))\n\n    Structured units share most methods with regular units::\n\n        >>> su.physical_type\n        ((PhysicalType('length'), PhysicalType({'speed', 'velocity'})), PhysicalType('time'))\n        >>> su.si\n        Unit(\"((1.49598e+11 m, 1.73146e+06 m / s), 3.15576e+07 s)\")\n\n    \"\"\"\n    def __new__(cls, units, names=None):\n        dtype = None\n        if names is not None:\n            if isinstance(names, StructuredUnit):\n                dtype = names._units.dtype\n                names = names.field_names\n            elif isinstance(names, np.dtype):\n                if not names.fields:\n                    raise ValueError('dtype should be structured, with fields.')\n                dtype = np.dtype([(name, DTYPE_OBJECT) for name in names.names])\n                names = _names_from_dtype(names)\n            else:\n                if not isinstance(names, tuple):\n                    names = (names,)\n                names = _normalize_names(names)\n\n        if not isinstance(units, tuple):\n            units = Unit(units)\n            if isinstance(units, StructuredUnit):\n                # Avoid constructing a new StructuredUnit if no field names\n                # are given, or if all field names are the same already anyway.\n                if names is None or units.field_names == names:\n                    return units\n\n                # Otherwise, turn (the upper level) into a tuple, for renaming.\n                units = units.values()\n            else:\n                # Single regular unit: make a tuple for iteration below.\n                units = (units,)\n\n        if names is None:\n            names = tuple(f'f{i}' for i in range(len(units)))\n\n        elif len(units) != len(names):\n            raise ValueError(\"lengths of units and field names must match.\")\n\n        converted = []\n        for unit, name in zip(units, names):\n            if isinstance(name, list):\n                # For list, the first item is the name of our level,\n                # and the second another tuple of names, i.e., we recurse.\n                unit = cls(unit, name[1])\n                name = name[0]\n            else:\n                # We are at the lowest level.  Check unit.\n                unit = Unit(unit)\n                if dtype is not None and isinstance(unit, StructuredUnit):\n                    raise ValueError(\"units do not match in depth with field \"\n                                     \"names from dtype or structured unit.\")\n\n            converted.append(unit)\n\n        self = super().__new__(cls)\n        if dtype is None:\n            dtype = np.dtype([((name[0] if isinstance(name, list) else name),\n                               DTYPE_OBJECT) for name in names])\n        # Decay array to void so we can access by field name and number.\n        self._units = np.array(tuple(converted), dtype)[()]\n        return self\n\n    def __getnewargs__(self):\n        \"\"\"When de-serializing, e.g. pickle, start with a blank structure.\"\"\"\n        return (), None\n\n    @property\n    def field_names(self):\n        \"\"\"Possibly nested tuple of the field names of the parts.\"\"\"\n        return tuple(([name, unit.field_names]\n                      if isinstance(unit, StructuredUnit) else name)\n                     for name, unit in self.items())\n\n    # Allow StructuredUnit to be treated as an (ordered) mapping.\n    def __len__(self):\n        return len(self._units.dtype.names)\n\n    def __getitem__(self, item):\n        # Since we are based on np.void, indexing by field number works too.\n        return self._units[item]\n\n    def values(self):\n        return self._units.item()\n\n    def keys(self):\n        return self._units.dtype.names\n\n    def items(self):\n        return tuple(zip(self._units.dtype.names, self._units.item()))\n\n    def __iter__(self):\n        yield from self._units.dtype.names\n\n    # Helpers for methods below.\n    def _recursively_apply(self, func, cls=None):\n        \"\"\"Apply func recursively.\n\n        Parameters\n        ----------\n        func : callable\n            Function to apply to all parts of the structured unit,\n            recursing as needed.\n        cls : type, optional\n            If given, should be a subclass of `~numpy.void`. By default,\n            will return a new `~astropy.units.StructuredUnit` instance.\n        \"\"\"\n        results = np.array(tuple([func(part) for part in self.values()]),\n                           self._units.dtype)[()]\n        if cls is not None:\n            return results.view((cls, results.dtype))\n\n        # Short-cut; no need to interpret field names, etc.\n        result = super().__new__(self.__class__)\n        result._units = results\n        return result\n\n    def _recursively_get_dtype(self, value, enter_lists=True):\n        \"\"\"Get structured dtype according to value, using our field names.\n\n        This is useful since ``np.array(value)`` would treat tuples as lower\n        levels of the array, rather than as elements of a structured array.\n        The routine does presume that the type of the first tuple is\n        representative of the rest.  Used in ``_get_converter``.\n\n        For the special value of ``UNITY``, all fields are assumed to be 1.0,\n        and hence this will return an all-float dtype.\n\n        \"\"\"\n        if enter_lists:\n            while isinstance(value, list):\n                value = value[0]\n        if value is UNITY:\n            value = (UNITY,) * len(self)\n        elif not isinstance(value, tuple) or len(self) != len(value):\n            raise ValueError(f\"cannot interpret value {value} for unit {self}.\")\n        descr = []\n        for (name, unit), part in zip(self.items(), value):\n            if isinstance(unit, StructuredUnit):\n                descr.append(\n                    (name, unit._recursively_get_dtype(part, enter_lists=False)))\n            else:\n                # Got a part associated with a regular unit. Gets its dtype.\n                # Like for Quantity, we cast integers to float.\n                part = np.array(part)\n                part_dtype = part.dtype\n                if part_dtype.kind in 'iu':\n                    part_dtype = np.dtype(float)\n                descr.append((name, part_dtype, part.shape))\n        return np.dtype(descr)\n\n    @property\n    def si(self):\n        \"\"\"The `StructuredUnit` instance in SI units.\"\"\"\n        return self._recursively_apply(operator.attrgetter('si'))\n\n    @property\n    def cgs(self):\n        \"\"\"The `StructuredUnit` instance in cgs units.\"\"\"\n        return self._recursively_apply(operator.attrgetter('cgs'))\n\n    # Needed to pass through Unit initializer, so might as well use it.\n    def _get_physical_type_id(self):\n        return self._recursively_apply(\n            operator.methodcaller('_get_physical_type_id'), cls=Structure)\n\n    @property\n    def physical_type(self):\n        \"\"\"Physical types of all the fields.\"\"\"\n        return self._recursively_apply(\n            operator.attrgetter('physical_type'), cls=Structure)\n\n    def decompose(self, bases=set()):\n        \"\"\"The `StructuredUnit` composed of only irreducible units.\n\n        Parameters\n        ----------\n        bases : sequence of `~astropy.units.UnitBase`, optional\n            The bases to decompose into.  When not provided,\n            decomposes down to any irreducible units.  When provided,\n            the decomposed result will only contain the given units.\n            This will raises a `UnitsError` if it's not possible\n            to do so.\n\n        Returns\n        -------\n        `~astropy.units.StructuredUnit`\n            With the unit for each field containing only irreducible units.\n        \"\"\"\n        return self._recursively_apply(\n            operator.methodcaller('decompose', bases=bases))\n\n    def is_equivalent(self, other, equivalencies=[]):\n        \"\"\"`True` if all fields are equivalent to the other's fields.\n\n        Parameters\n        ----------\n        other : `~astropy.units.StructuredUnit`\n            The structured unit to compare with, or what can initialize one.\n        equivalencies : list of tuple, optional\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`unit_equivalencies`.\n            The list will be applied to all fields.\n\n        Returns\n        -------\n        bool\n        \"\"\"\n        try:\n            other = StructuredUnit(other)\n        except Exception:\n            return False\n\n        if len(self) != len(other):\n            return False\n\n        for self_part, other_part in zip(self.values(), other.values()):\n            if not self_part.is_equivalent(other_part,\n                                           equivalencies=equivalencies):\n                return False\n\n        return True\n\n    def _get_converter(self, other, equivalencies=[]):\n        if not isinstance(other, type(self)):\n            other = self.__class__(other, names=self)\n\n        converters = [self_part._get_converter(other_part,\n                                               equivalencies=equivalencies)\n                      for (self_part, other_part) in zip(self.values(),\n                                                         other.values())]\n\n        def converter(value):\n            if not hasattr(value, 'dtype'):\n                value = np.array(value, self._recursively_get_dtype(value))\n            result = np.empty_like(value)\n            for name, converter_ in zip(result.dtype.names, converters):\n                result[name] = converter_(value[name])\n            # Index with empty tuple to decay array scalars to numpy void.\n            return result if result.shape else result[()]\n\n        return converter\n\n    def to(self, other, value=np._NoValue, equivalencies=[]):\n        \"\"\"Return values converted to the specified unit.\n\n        Parameters\n        ----------\n        other : `~astropy.units.StructuredUnit`\n            The unit to convert to.  If necessary, will be converted to\n            a `~astropy.units.StructuredUnit` using the dtype of ``value``.\n        value : array-like, optional\n            Value(s) in the current unit to be converted to the\n            specified unit.  If a sequence, the first element must have\n            entries of the correct type to represent all elements (i.e.,\n            not have, e.g., a ``float`` where other elements have ``complex``).\n            If not given, assumed to have 1. in all fields.\n        equivalencies : list of tuple, optional\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`unit_equivalencies`.\n            This list is in addition to possible global defaults set by, e.g.,\n            `set_enabled_equivalencies`.\n            Use `None` to turn off all equivalencies.\n\n        Returns\n        -------\n        values : scalar or array\n            Converted value(s).\n\n        Raises\n        ------\n        UnitsError\n            If units are inconsistent\n        \"\"\"\n        if value is np._NoValue:\n            # We do not have UNITY as a default, since then the docstring\n            # would list 1.0 as default, yet one could not pass that in.\n            value = UNITY\n        return self._get_converter(other, equivalencies=equivalencies)(value)\n\n    def to_string(self, format='generic'):\n        \"\"\"Output the unit in the given format as a string.\n\n        Units are separated by commas.\n\n        Parameters\n        ----------\n        format : `astropy.units.format.Base` instance or str\n            The name of a format or a formatter object.  If not\n            provided, defaults to the generic format.\n\n        Notes\n        -----\n        Structured units can be written to all formats, but can be\n        re-read only with 'generic'.\n\n        \"\"\"\n        parts = [part.to_string(format) for part in self.values()]\n        out_fmt = '({})' if len(self) > 1 else '({},)'\n        if format == 'latex':\n            # Strip $ from parts and add them on the outside.\n            parts = [part[1:-1] for part in parts]\n            out_fmt = '$' + out_fmt + '$'\n        return out_fmt.format(', '.join(parts))\n\n    def _repr_latex_(self):\n        return self.to_string('latex')\n\n    __array_ufunc__ = None\n\n    def __mul__(self, other):\n        if isinstance(other, str):\n            try:\n                other = Unit(other, parse_strict='silent')\n            except Exception:\n                return NotImplemented\n        if isinstance(other, UnitBase):\n            new_units = tuple(part * other for part in self.values())\n            return self.__class__(new_units, names=self)\n        if isinstance(other, StructuredUnit):\n            return NotImplemented\n\n        # Anything not like a unit, try initialising as a structured quantity.\n        try:\n            from .quantity import Quantity\n            return Quantity(other, unit=self)\n        except Exception:\n            return NotImplemented\n\n    def __rmul__(self, other):\n        return self.__mul__(other)\n\n    def __truediv__(self, other):\n        if isinstance(other, str):\n            try:\n                other = Unit(other, parse_strict='silent')\n            except Exception:\n                return NotImplemented\n\n        if isinstance(other, UnitBase):\n            new_units = tuple(part / other for part in self.values())\n            return self.__class__(new_units, names=self)\n        return NotImplemented\n\n    def __rlshift__(self, m):\n        try:\n            from .quantity import Quantity\n            return Quantity(m, self, copy=False, subok=True)\n        except Exception:\n            return NotImplemented\n\n    def __str__(self):\n        return self.to_string()\n\n    def __repr__(self):\n        return f'Unit(\"{self.to_string()}\")'\n\n    def __eq__(self, other):\n        try:\n            other = StructuredUnit(other)\n        except Exception:\n            return NotImplemented\n\n        return self.values() == other.values()\n\n    def __ne__(self, other):\n        if not isinstance(other, type(self)):\n            try:\n                other = StructuredUnit(other)\n            except Exception:\n                return NotImplemented\n\n        return self.values() != other.values()\n\n\nclass Structure(np.void):\n    \"\"\"Single element structure for physical type IDs, etc.\n\n    Behaves like a `~numpy.void` and thus mostly like a tuple which can also\n    be indexed with field names, but overrides ``__eq__`` and ``__ne__`` to\n    compare only the contents, not the field names.  Furthermore, this way no\n    `FutureWarning` about comparisons is given.\n\n    \"\"\"\n    # Note that it is important for physical type IDs to not be stored in a\n    # tuple, since then the physical types would be treated as alternatives in\n    # :meth:`~astropy.units.UnitBase.is_equivalent`.  (Of course, in that\n    # case, they could also not be indexed by name.)\n\n    def __eq__(self, other):\n        if isinstance(other, np.void):\n            other = other.item()\n\n        return self.item() == other\n\n    def __ne__(self, other):\n        if isinstance(other, np.void):\n            other = other.item()\n\n        return self.item() != other\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":9798,"name":"UNITY","nodeType":"Attribute","startLoc":33,"text":"UNITY"},{"className":"Structure","col":0,"comment":"Single element structure for physical type IDs, etc.\n\n    Behaves like a `~numpy.void` and thus mostly like a tuple which can also\n    be indexed with field names, but overrides ``__eq__`` and ``__ne__`` to\n    compare only the contents, not the field names.  Furthermore, this way no\n    `FutureWarning` about comparisons is given.\n\n    ","endLoc":519,"id":9799,"nodeType":"Class","startLoc":495,"text":"class Structure(np.void):\n    \"\"\"Single element structure for physical type IDs, etc.\n\n    Behaves like a `~numpy.void` and thus mostly like a tuple which can also\n    be indexed with field names, but overrides ``__eq__`` and ``__ne__`` to\n    compare only the contents, not the field names.  Furthermore, this way no\n    `FutureWarning` about comparisons is given.\n\n    \"\"\"\n    # Note that it is important for physical type IDs to not be stored in a\n    # tuple, since then the physical types would be treated as alternatives in\n    # :meth:`~astropy.units.UnitBase.is_equivalent`.  (Of course, in that\n    # case, they could also not be indexed by name.)\n\n    def __eq__(self, other):\n        if isinstance(other, np.void):\n            other = other.item()\n\n        return self.item() == other\n\n    def __ne__(self, other):\n        if isinstance(other, np.void):\n            other = other.item()\n\n        return self.item() != other"},{"col":4,"comment":"null","endLoc":513,"header":"def __eq__(self, other)","id":9800,"name":"__eq__","nodeType":"Function","startLoc":509,"text":"def __eq__(self, other):\n        if isinstance(other, np.void):\n            other = other.item()\n\n        return self.item() == other"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":9801,"name":"_ns","nodeType":"Attribute","startLoc":25,"text":"_ns"},{"col":4,"comment":"The `StructuredUnit` instance in SI units.","endLoc":274,"header":"@property\n    def si(self)","id":9802,"name":"si","nodeType":"Function","startLoc":271,"text":"@property\n    def si(self):\n        \"\"\"The `StructuredUnit` instance in SI units.\"\"\"\n        return self._recursively_apply(operator.attrgetter('si'))"},{"attributeType":"null","col":44,"comment":"null","endLoc":150,"id":9803,"name":"_generate_unit_summary","nodeType":"Attribute","startLoc":150,"text":"_generate_unit_summary"},{"col":0,"comment":"","endLoc":19,"header":"imperial.py#<anonymous>","id":9804,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nThis package defines colloquially used Imperial units.  They are\navailable in the `astropy.units.imperial` namespace, but not in the\ntop-level `astropy.units` namespace, e.g.::\n\n    >>> import astropy.units as u\n    >>> mph = u.imperial.mile / u.hour\n    >>> mph\n    Unit(\"mi / h\")\n\nTo include them in `~astropy.units.UnitBase.compose` and the results of\n`~astropy.units.UnitBase.find_equivalent_units`, do::\n\n    >>> import astropy.units as u\n    >>> u.imperial.enable()  # doctest: +SKIP\n\"\"\"\n\n_ns = globals()\n\ndef_unit(['inch'], 2.54 * si.cm, namespace=_ns,\n         doc=\"International inch\")\n\ndef_unit(['ft', 'foot'], 12 * inch, namespace=_ns,\n         doc=\"International foot\")\n\ndef_unit(['yd', 'yard'], 3 * ft, namespace=_ns,\n         doc=\"International yard\")\n\ndef_unit(['mi', 'mile'], 5280 * ft, namespace=_ns,\n         doc=\"International mile\")\n\ndef_unit(['mil', 'thou'], 0.001 * inch, namespace=_ns,\n         doc=\"Thousandth of an inch\")\n\ndef_unit(['nmi', 'nauticalmile', 'NM'], 1852 * si.m, namespace=_ns,\n         doc=\"Nautical mile\")\n\ndef_unit(['fur', 'furlong'], 660 * ft, namespace=_ns,\n         doc=\"Furlong\")\n\ndef_unit(['ac', 'acre'], 43560 * ft ** 2, namespace=_ns,\n         doc=\"International acre\")\n\ndef_unit(['gallon'], si.liter / 0.264172052, namespace=_ns,\n         doc=\"U.S. liquid gallon\")\n\ndef_unit(['quart'], gallon / 4, namespace=_ns,\n         doc=\"U.S. liquid quart\")\n\ndef_unit(['pint'], quart / 2, namespace=_ns,\n         doc=\"U.S. liquid pint\")\n\ndef_unit(['cup'], pint / 2, namespace=_ns,\n         doc=\"U.S. customary cup\")\n\ndef_unit(['foz', 'fluid_oz', 'fluid_ounce'], cup / 8, namespace=_ns,\n         doc=\"U.S. fluid ounce\")\n\ndef_unit(['tbsp', 'tablespoon'], foz / 2, namespace=_ns,\n         doc=\"U.S. customary tablespoon\")\n\ndef_unit(['tsp', 'teaspoon'], tbsp / 3, namespace=_ns,\n         doc=\"U.S. customary teaspoon\")\n\ndef_unit(['oz', 'ounce'], 28.349523125 * si.g, namespace=_ns,\n         doc=\"International avoirdupois ounce: mass\")\n\ndef_unit(['lb', 'lbm', 'pound'], 16 * oz, namespace=_ns,\n         doc=\"International avoirdupois pound: mass\")\n\ndef_unit(['st', 'stone'], 14 * lb, namespace=_ns,\n         doc=\"International avoirdupois stone: mass\")\n\ndef_unit(['ton'], 2000 * lb, namespace=_ns,\n         doc=\"International avoirdupois ton: mass\")\n\ndef_unit(['slug'], 32.174049 * lb, namespace=_ns,\n         doc=\"slug: mass\")\n\ndef_unit(['kn', 'kt', 'knot', 'NMPH'], nmi / si.h, namespace=_ns,\n         doc=\"nautical unit of speed: 1 nmi per hour\")\n\ndef_unit('lbf', slug * ft * si.s**-2, namespace=_ns,\n         doc=\"Pound: force\")\n\ndef_unit(['kip', 'kilopound'], 1000 * lbf, namespace=_ns,\n         doc=\"Kilopound: force\")\n\ndef_unit(['BTU', 'btu'], 1.05505585 * si.kJ, namespace=_ns,\n         doc=\"British thermal unit\")\n\ndef_unit(['cal', 'calorie'], 4.184 * si.J, namespace=_ns,\n         doc=\"Thermochemical calorie: pre-SI metric unit of energy\")\n\ndef_unit(['kcal', 'Cal', 'Calorie', 'kilocal', 'kilocalorie'],\n         1000 * cal, namespace=_ns,\n         doc=\"Calorie: colloquial definition of Calorie\")\n\ndef_unit('psi', lbf * inch ** -2, namespace=_ns,\n         doc=\"Pound per square inch: pressure\")\n\ndef_unit(['hp', 'horsepower'], si.W / 0.00134102209, namespace=_ns,\n         doc=\"Electrical horsepower\")\n\ndef_unit(['deg_F', 'Fahrenheit'], namespace=_ns, doc='Degrees Fahrenheit',\n         format={'latex': r'{}^{\\circ}F', 'unicode': '°F'})\n\ndef_unit(['deg_R', 'Rankine'], namespace=_ns, doc='Rankine scale: absolute scale of thermodynamic temperature')\n\ndel UnitBase\n\ndel def_unit\n\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())"},{"col":4,"comment":"The `StructuredUnit` instance in cgs units.","endLoc":279,"header":"@property\n    def cgs(self)","id":9805,"name":"cgs","nodeType":"Function","startLoc":276,"text":"@property\n    def cgs(self):\n        \"\"\"The `StructuredUnit` instance in cgs units.\"\"\"\n        return self._recursively_apply(operator.attrgetter('cgs'))"},{"col":4,"comment":"null","endLoc":284,"header":"def _get_physical_type_id(self)","id":9806,"name":"_get_physical_type_id","nodeType":"Function","startLoc":282,"text":"def _get_physical_type_id(self):\n        return self._recursively_apply(\n            operator.methodcaller('_get_physical_type_id'), cls=Structure)"},{"col":4,"comment":"Physical types of all the fields.","endLoc":290,"header":"@property\n    def physical_type(self)","id":9807,"name":"physical_type","nodeType":"Function","startLoc":286,"text":"@property\n    def physical_type(self):\n        \"\"\"Physical types of all the fields.\"\"\"\n        return self._recursively_apply(\n            operator.attrgetter('physical_type'), cls=Structure)"},{"col":4,"comment":"null","endLoc":519,"header":"def __ne__(self, other)","id":9808,"name":"__ne__","nodeType":"Function","startLoc":515,"text":"def __ne__(self, other):\n        if isinstance(other, np.void):\n            other = other.item()\n\n        return self.item() != other"},{"col":4,"comment":"The `StructuredUnit` composed of only irreducible units.\n\n        Parameters\n        ----------\n        bases : sequence of `~astropy.units.UnitBase`, optional\n            The bases to decompose into.  When not provided,\n            decomposes down to any irreducible units.  When provided,\n            the decomposed result will only contain the given units.\n            This will raises a `UnitsError` if it's not possible\n            to do so.\n\n        Returns\n        -------\n        `~astropy.units.StructuredUnit`\n            With the unit for each field containing only irreducible units.\n        ","endLoc":310,"header":"def decompose(self, bases=set())","id":9809,"name":"decompose","nodeType":"Function","startLoc":292,"text":"def decompose(self, bases=set()):\n        \"\"\"The `StructuredUnit` composed of only irreducible units.\n\n        Parameters\n        ----------\n        bases : sequence of `~astropy.units.UnitBase`, optional\n            The bases to decompose into.  When not provided,\n            decomposes down to any irreducible units.  When provided,\n            the decomposed result will only contain the given units.\n            This will raises a `UnitsError` if it's not possible\n            to do so.\n\n        Returns\n        -------\n        `~astropy.units.StructuredUnit`\n            With the unit for each field containing only irreducible units.\n        \"\"\"\n        return self._recursively_apply(\n            operator.methodcaller('decompose', bases=bases))"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":9810,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":9811,"name":"DTYPE_OBJECT","nodeType":"Attribute","startLoc":18,"text":"DTYPE_OBJECT"},{"col":0,"comment":"","endLoc":5,"header":"structured.py#<anonymous>","id":9812,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module defines structured units and quantities.\n\"\"\"\n\n__all__ = ['StructuredUnit']\n\nDTYPE_OBJECT = np.dtype('O')"},{"col":4,"comment":"`True` if all fields are equivalent to the other's fields.\n\n        Parameters\n        ----------\n        other : `~astropy.units.StructuredUnit`\n            The structured unit to compare with, or what can initialize one.\n        equivalencies : list of tuple, optional\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`unit_equivalencies`.\n            The list will be applied to all fields.\n\n        Returns\n        -------\n        bool\n        ","endLoc":341,"header":"def is_equivalent(self, other, equivalencies=[])","id":9813,"name":"is_equivalent","nodeType":"Function","startLoc":312,"text":"def is_equivalent(self, other, equivalencies=[]):\n        \"\"\"`True` if all fields are equivalent to the other's fields.\n\n        Parameters\n        ----------\n        other : `~astropy.units.StructuredUnit`\n            The structured unit to compare with, or what can initialize one.\n        equivalencies : list of tuple, optional\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`unit_equivalencies`.\n            The list will be applied to all fields.\n\n        Returns\n        -------\n        bool\n        \"\"\"\n        try:\n            other = StructuredUnit(other)\n        except Exception:\n            return False\n\n        if len(self) != len(other):\n            return False\n\n        for self_part, other_part in zip(self.values(), other.values()):\n            if not self_part.is_equivalent(other_part,\n                                           equivalencies=equivalencies):\n                return False\n\n        return True"},{"fileName":"photometric.py","filePath":"astropy/units","id":9814,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module defines magnitude zero points and related photometric quantities.\n\nThe corresponding magnitudes are given in the description of each unit\n(the actual definitions are in `~astropy.units.function.logarithmic`).\n\"\"\"\n\n\nimport numpy as _numpy\nfrom .core import UnitBase, def_unit, Unit\n\nfrom astropy.constants import si as _si\nfrom . import cgs, si, astrophys\n\n\n_ns = globals()\n\ndef_unit(['Bol', 'L_bol'], _si.L_bol0, namespace=_ns, prefixes=False,\n         doc=\"Luminosity corresponding to absolute bolometric magnitude zero \"\n         \"(magnitude ``M_bol``).\")\ndef_unit(['bol', 'f_bol'], _si.L_bol0 / (4 * _numpy.pi * (10.*astrophys.pc)**2),\n         namespace=_ns, prefixes=False, doc=\"Irradiance corresponding to \"\n         \"appparent bolometric magnitude zero (magnitude ``m_bol``).\")\ndef_unit(['AB', 'ABflux'], 10.**(48.6/-2.5) * cgs.erg * cgs.cm**-2 / si.s / si.Hz,\n         namespace=_ns, prefixes=False,\n         doc=\"AB magnitude zero flux density (magnitude ``ABmag``).\")\ndef_unit(['ST', 'STflux'], 10.**(21.1/-2.5) * cgs.erg * cgs.cm**-2 / si.s / si.AA,\n         namespace=_ns, prefixes=False,\n         doc=\"ST magnitude zero flux density (magnitude ``STmag``).\")\n\ndef_unit(['mgy', 'maggy'],\n         namespace=_ns, prefixes=[(['n'], ['nano'], 1e-9)],\n         doc=\"Maggies - a linear flux unit that is the flux for a mag=0 object.\"\n             \"To tie this onto a specific calibrated unit system, the \"\n             \"zero_point_flux equivalency should be used.\")\n\n\ndef zero_point_flux(flux0):\n    \"\"\"\n    An equivalency for converting linear flux units (\"maggys\") defined relative\n    to a standard source into a standardized system.\n\n    Parameters\n    ----------\n    flux0 : `~astropy.units.Quantity`\n        The flux of a magnitude-0 object in the \"maggy\" system.\n    \"\"\"\n    flux_unit0 = Unit(flux0)\n    return [(maggy, flux_unit0)]\n\n\n###########################################################################\n# CLEANUP\n\ndel UnitBase\ndel def_unit\ndel cgs, si, astrophys\n\n###########################################################################\n# DOCSTRING\n\n# This generates a docstring for this module that describes all of the\n# standard units defined here.\nfrom .utils import generate_unit_summary as _generate_unit_summary\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())\n"},{"col":0,"comment":"\n    An equivalency for converting linear flux units (\"maggys\") defined relative\n    to a standard source into a standardized system.\n\n    Parameters\n    ----------\n    flux0 : `~astropy.units.Quantity`\n        The flux of a magnitude-0 object in the \"maggy\" system.\n    ","endLoc":52,"header":"def zero_point_flux(flux0)","id":9815,"name":"zero_point_flux","nodeType":"Function","startLoc":41,"text":"def zero_point_flux(flux0):\n    \"\"\"\n    An equivalency for converting linear flux units (\"maggys\") defined relative\n    to a standard source into a standardized system.\n\n    Parameters\n    ----------\n    flux0 : `~astropy.units.Quantity`\n        The flux of a magnitude-0 object in the \"maggy\" system.\n    \"\"\"\n    flux_unit0 = Unit(flux0)\n    return [(maggy, flux_unit0)]"},{"col":4,"comment":"null","endLoc":361,"header":"def _get_converter(self, other, equivalencies=[])","id":9816,"name":"_get_converter","nodeType":"Function","startLoc":343,"text":"def _get_converter(self, other, equivalencies=[]):\n        if not isinstance(other, type(self)):\n            other = self.__class__(other, names=self)\n\n        converters = [self_part._get_converter(other_part,\n                                               equivalencies=equivalencies)\n                      for (self_part, other_part) in zip(self.values(),\n                                                         other.values())]\n\n        def converter(value):\n            if not hasattr(value, 'dtype'):\n                value = np.array(value, self._recursively_get_dtype(value))\n            result = np.empty_like(value)\n            for name, converter_ in zip(result.dtype.names, converters):\n                result[name] = converter_(value[name])\n            # Index with empty tuple to decay array scalars to numpy void.\n            return result if result.shape else result[()]\n\n        return converter"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":9817,"name":"_ns","nodeType":"Attribute","startLoc":19,"text":"_ns"},{"col":4,"comment":"Return values converted to the specified unit.\n\n        Parameters\n        ----------\n        other : `~astropy.units.StructuredUnit`\n            The unit to convert to.  If necessary, will be converted to\n            a `~astropy.units.StructuredUnit` using the dtype of ``value``.\n        value : array-like, optional\n            Value(s) in the current unit to be converted to the\n            specified unit.  If a sequence, the first element must have\n            entries of the correct type to represent all elements (i.e.,\n            not have, e.g., a ``float`` where other elements have ``complex``).\n            If not given, assumed to have 1. in all fields.\n        equivalencies : list of tuple, optional\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`unit_equivalencies`.\n            This list is in addition to possible global defaults set by, e.g.,\n            `set_enabled_equivalencies`.\n            Use `None` to turn off all equivalencies.\n\n        Returns\n        -------\n        values : scalar or array\n            Converted value(s).\n\n        Raises\n        ------\n        UnitsError\n            If units are inconsistent\n        ","endLoc":398,"header":"def to(self, other, value=np._NoValue, equivalencies=[])","id":9818,"name":"to","nodeType":"Function","startLoc":363,"text":"def to(self, other, value=np._NoValue, equivalencies=[]):\n        \"\"\"Return values converted to the specified unit.\n\n        Parameters\n        ----------\n        other : `~astropy.units.StructuredUnit`\n            The unit to convert to.  If necessary, will be converted to\n            a `~astropy.units.StructuredUnit` using the dtype of ``value``.\n        value : array-like, optional\n            Value(s) in the current unit to be converted to the\n            specified unit.  If a sequence, the first element must have\n            entries of the correct type to represent all elements (i.e.,\n            not have, e.g., a ``float`` where other elements have ``complex``).\n            If not given, assumed to have 1. in all fields.\n        equivalencies : list of tuple, optional\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`unit_equivalencies`.\n            This list is in addition to possible global defaults set by, e.g.,\n            `set_enabled_equivalencies`.\n            Use `None` to turn off all equivalencies.\n\n        Returns\n        -------\n        values : scalar or array\n            Converted value(s).\n\n        Raises\n        ------\n        UnitsError\n            If units are inconsistent\n        \"\"\"\n        if value is np._NoValue:\n            # We do not have UNITY as a default, since then the docstring\n            # would list 1.0 as default, yet one could not pass that in.\n            value = UNITY\n        return self._get_converter(other, equivalencies=equivalencies)(value)"},{"col":0,"comment":"","endLoc":9,"header":"photometric.py#<anonymous>","id":9819,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nThis module defines magnitude zero points and related photometric quantities.\n\nThe corresponding magnitudes are given in the description of each unit\n(the actual definitions are in `~astropy.units.function.logarithmic`).\n\"\"\"\n\n_ns = globals()\n\ndef_unit(['Bol', 'L_bol'], _si.L_bol0, namespace=_ns, prefixes=False,\n         doc=\"Luminosity corresponding to absolute bolometric magnitude zero \"\n         \"(magnitude ``M_bol``).\")\n\ndef_unit(['bol', 'f_bol'], _si.L_bol0 / (4 * _numpy.pi * (10.*astrophys.pc)**2),\n         namespace=_ns, prefixes=False, doc=\"Irradiance corresponding to \"\n         \"appparent bolometric magnitude zero (magnitude ``m_bol``).\")\n\ndef_unit(['AB', 'ABflux'], 10.**(48.6/-2.5) * cgs.erg * cgs.cm**-2 / si.s / si.Hz,\n         namespace=_ns, prefixes=False,\n         doc=\"AB magnitude zero flux density (magnitude ``ABmag``).\")\n\ndef_unit(['ST', 'STflux'], 10.**(21.1/-2.5) * cgs.erg * cgs.cm**-2 / si.s / si.AA,\n         namespace=_ns, prefixes=False,\n         doc=\"ST magnitude zero flux density (magnitude ``STmag``).\")\n\ndef_unit(['mgy', 'maggy'],\n         namespace=_ns, prefixes=[(['n'], ['nano'], 1e-9)],\n         doc=\"Maggies - a linear flux unit that is the flux for a mag=0 object.\"\n             \"To tie this onto a specific calibrated unit system, the \"\n             \"zero_point_flux equivalency should be used.\")\n\ndel UnitBase\n\ndel def_unit\n\ndel cgs, si, astrophys\n\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())"},{"fileName":"cds.py","filePath":"astropy/units","id":9820,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis package defines units used in the CDS format, both the units\ndefined in `Centre de Données astronomiques de Strasbourg\n<http://cds.u-strasbg.fr/>`_ `Standards for Astronomical Catalogues 2.0\n<http://vizier.u-strasbg.fr/vizier/doc/catstd-3.2.htx>`_ format and the `complete\nset of supported units <https://vizier.u-strasbg.fr/viz-bin/Unit>`_.\nThis format is used by VOTable up to version 1.2.\n\nThese units are not available in the top-level `astropy.units`\nnamespace.  To use these units, you must import the `astropy.units.cds`\nmodule::\n\n    >>> from astropy.units import cds\n    >>> q = 10. * cds.lyr  # doctest: +SKIP\n\nTo include them in `~astropy.units.UnitBase.compose` and the results of\n`~astropy.units.UnitBase.find_equivalent_units`, do::\n\n    >>> from astropy.units import cds\n    >>> cds.enable()  # doctest: +SKIP\n\"\"\"\n\n\n_ns = globals()\n\n\ndef _initialize_module():\n    # Local imports to avoid polluting top-level namespace\n    import numpy as np\n\n    from . import core\n    from astropy import units as u\n    from astropy.constants import si as _si\n\n    # The CDS format also supports power-of-2 prefixes as defined here:\n    # http://physics.nist.gov/cuu/Units/binary.html\n    prefixes = core.si_prefixes + core.binary_prefixes\n\n    # CDS only uses the short prefixes\n    prefixes = [(short, short, factor) for (short, long, factor) in prefixes]\n\n    # The following units are defined in alphabetical order, directly from\n    # here: https://vizier.u-strasbg.fr/viz-bin/Unit\n\n    mapping = [\n        (['A'], u.A, \"Ampere\"),\n        (['a'], u.a, \"year\", ['P']),\n        (['a0'], _si.a0, \"Bohr radius\"),\n        (['al'], u.lyr, \"Light year\", ['c', 'd']),\n        (['lyr'], u.lyr, \"Light year\"),\n        (['alpha'], _si.alpha, \"Fine structure constant\"),\n        ((['AA', 'Å'], ['Angstrom', 'Angstroem']), u.AA, \"Angstrom\"),\n        (['arcmin', 'arcm'], u.arcminute, \"minute of arc\"),\n        (['arcsec', 'arcs'], u.arcsecond, \"second of arc\"),\n        (['atm'], _si.atm, \"atmosphere\"),\n        (['AU', 'au'], u.au, \"astronomical unit\"),\n        (['bar'], u.bar, \"bar\"),\n        (['barn'], u.barn, \"barn\"),\n        (['bit'], u.bit, \"bit\"),\n        (['byte'], u.byte, \"byte\"),\n        (['C'], u.C, \"Coulomb\"),\n        (['c'], _si.c, \"speed of light\", ['p']),\n        (['cal'], 4.1854 * u.J, \"calorie\"),\n        (['cd'], u.cd, \"candela\"),\n        (['ct'], u.ct, \"count\"),\n        (['D'], u.D, \"Debye (dipole)\"),\n        (['d'], u.d, \"Julian day\", ['c']),\n        ((['deg', '°'], ['degree']), u.degree, \"degree\"),\n        (['dyn'], u.dyn, \"dyne\"),\n        (['e'], _si.e, \"electron charge\", ['m']),\n        (['eps0'], _si.eps0, \"electric constant\"),\n        (['erg'], u.erg, \"erg\"),\n        (['eV'], u.eV, \"electron volt\"),\n        (['F'], u.F, \"Farad\"),\n        (['G'], _si.G, \"Gravitation constant\"),\n        (['g'], u.g, \"gram\"),\n        (['gauss'], u.G, \"Gauss\"),\n        (['geoMass', 'Mgeo'], u.M_earth, \"Earth mass\"),\n        (['H'], u.H, \"Henry\"),\n        (['h'], u.h, \"hour\", ['p']),\n        (['hr'], u.h, \"hour\"),\n        (['\\\\h'], _si.h, \"Planck constant\"),\n        (['Hz'], u.Hz, \"Hertz\"),\n        (['inch'], 0.0254 * u.m, \"inch\"),\n        (['J'], u.J, \"Joule\"),\n        (['JD'], u.d, \"Julian day\", ['M']),\n        (['jovMass', 'Mjup'], u.M_jup, \"Jupiter mass\"),\n        (['Jy'], u.Jy, \"Jansky\"),\n        (['K'], u.K, \"Kelvin\"),\n        (['k'], _si.k_B, \"Boltzmann\"),\n        (['l'], u.l, \"litre\", ['a']),\n        (['lm'], u.lm, \"lumen\"),\n        (['Lsun', 'solLum'], u.solLum, \"solar luminosity\"),\n        (['lx'], u.lx, \"lux\"),\n        (['m'], u.m, \"meter\"),\n        (['mag'], u.mag, \"magnitude\"),\n        (['me'], _si.m_e, \"electron mass\"),\n        (['min'], u.minute, \"minute\"),\n        (['MJD'], u.d, \"Julian day\"),\n        (['mmHg'], 133.322387415 * u.Pa, \"millimeter of mercury\"),\n        (['mol'], u.mol, \"mole\"),\n        (['mp'], _si.m_p, \"proton mass\"),\n        (['Msun', 'solMass'], u.solMass, \"solar mass\"),\n        ((['mu0', 'µ0'], []), _si.mu0, \"magnetic constant\"),\n        (['muB'], _si.muB, \"Bohr magneton\"),\n        (['N'], u.N, \"Newton\"),\n        (['Ohm'], u.Ohm, \"Ohm\"),\n        (['Pa'], u.Pa, \"Pascal\"),\n        (['pc'], u.pc, \"parsec\"),\n        (['ph'], u.ph, \"photon\"),\n        (['pi'], u.Unit(np.pi), \"π\"),\n        (['pix'], u.pix, \"pixel\"),\n        (['ppm'], u.Unit(1e-6), \"parts per million\"),\n        (['R'], _si.R, \"gas constant\"),\n        (['rad'], u.radian, \"radian\"),\n        (['Rgeo'], _si.R_earth, \"Earth equatorial radius\"),\n        (['Rjup'], _si.R_jup, \"Jupiter equatorial radius\"),\n        (['Rsun', 'solRad'], u.solRad, \"solar radius\"),\n        (['Ry'], u.Ry, \"Rydberg\"),\n        (['S'], u.S, \"Siemens\"),\n        (['s', 'sec'], u.s, \"second\"),\n        (['sr'], u.sr, \"steradian\"),\n        (['Sun'], u.Sun, \"solar unit\"),\n        (['T'], u.T, \"Tesla\"),\n        (['t'], 1e3 * u.kg, \"metric tonne\", ['c']),\n        (['u'], _si.u, \"atomic mass\", ['da', 'a']),\n        (['V'], u.V, \"Volt\"),\n        (['W'], u.W, \"Watt\"),\n        (['Wb'], u.Wb, \"Weber\"),\n        (['yr'], u.a, \"year\"),\n    ]\n\n    for entry in mapping:\n        if len(entry) == 3:\n            names, unit, doc = entry\n            excludes = []\n        else:\n            names, unit, doc, excludes = entry\n        core.def_unit(names, unit, prefixes=prefixes, namespace=_ns, doc=doc,\n                      exclude_prefixes=excludes)\n\n    core.def_unit(['µas'], u.microarcsecond,\n                  doc=\"microsecond of arc\", namespace=_ns)\n    core.def_unit(['mas'], u.milliarcsecond,\n                  doc=\"millisecond of arc\", namespace=_ns)\n    core.def_unit(['---', '-'], u.dimensionless_unscaled,\n                  doc=\"dimensionless and unscaled\", namespace=_ns)\n    core.def_unit(['%'], u.percent,\n                  doc=\"percent\", namespace=_ns)\n    # The Vizier \"standard\" defines this in units of \"kg s-3\", but\n    # that may not make a whole lot of sense, so here we just define\n    # it as its own new disconnected unit.\n    core.def_unit(['Crab'], prefixes=prefixes, namespace=_ns,\n                  doc=\"Crab (X-ray) flux\")\n\n\n_initialize_module()\n\n\n###########################################################################\n# DOCSTRING\n\n# This generates a docstring for this module that describes all of the\n# standard units defined here.\nfrom .utils import generate_unit_summary as _generate_unit_summary\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())\n\n\ndef enable():\n    \"\"\"\n    Enable CDS units so they appear in results of\n    `~astropy.units.UnitBase.find_equivalent_units` and\n    `~astropy.units.UnitBase.compose`.  This will disable\n    all of the \"default\" `astropy.units` units, since there\n    are some namespace clashes between the two.\n\n    This may be used with the ``with`` statement to enable CDS\n    units only temporarily.\n    \"\"\"\n    # Local import to avoid cyclical import\n    from .core import set_enabled_units\n    # Local import to avoid polluting namespace\n    import inspect\n    return set_enabled_units(inspect.getmodule(enable))\n"},{"col":4,"comment":"Output the unit in the given format as a string.\n\n        Units are separated by commas.\n\n        Parameters\n        ----------\n        format : `astropy.units.format.Base` instance or str\n            The name of a format or a formatter object.  If not\n            provided, defaults to the generic format.\n\n        Notes\n        -----\n        Structured units can be written to all formats, but can be\n        re-read only with 'generic'.\n\n        ","endLoc":423,"header":"def to_string(self, format='generic')","id":9821,"name":"to_string","nodeType":"Function","startLoc":400,"text":"def to_string(self, format='generic'):\n        \"\"\"Output the unit in the given format as a string.\n\n        Units are separated by commas.\n\n        Parameters\n        ----------\n        format : `astropy.units.format.Base` instance or str\n            The name of a format or a formatter object.  If not\n            provided, defaults to the generic format.\n\n        Notes\n        -----\n        Structured units can be written to all formats, but can be\n        re-read only with 'generic'.\n\n        \"\"\"\n        parts = [part.to_string(format) for part in self.values()]\n        out_fmt = '({})' if len(self) > 1 else '({},)'\n        if format == 'latex':\n            # Strip $ from parts and add them on the outside.\n            parts = [part[1:-1] for part in parts]\n            out_fmt = '$' + out_fmt + '$'\n        return out_fmt.format(', '.join(parts))"},{"col":0,"comment":"null","endLoc":157,"header":"def _initialize_module()","id":9822,"name":"_initialize_module","nodeType":"Function","startLoc":30,"text":"def _initialize_module():\n    # Local imports to avoid polluting top-level namespace\n    import numpy as np\n\n    from . import core\n    from astropy import units as u\n    from astropy.constants import si as _si\n\n    # The CDS format also supports power-of-2 prefixes as defined here:\n    # http://physics.nist.gov/cuu/Units/binary.html\n    prefixes = core.si_prefixes + core.binary_prefixes\n\n    # CDS only uses the short prefixes\n    prefixes = [(short, short, factor) for (short, long, factor) in prefixes]\n\n    # The following units are defined in alphabetical order, directly from\n    # here: https://vizier.u-strasbg.fr/viz-bin/Unit\n\n    mapping = [\n        (['A'], u.A, \"Ampere\"),\n        (['a'], u.a, \"year\", ['P']),\n        (['a0'], _si.a0, \"Bohr radius\"),\n        (['al'], u.lyr, \"Light year\", ['c', 'd']),\n        (['lyr'], u.lyr, \"Light year\"),\n        (['alpha'], _si.alpha, \"Fine structure constant\"),\n        ((['AA', 'Å'], ['Angstrom', 'Angstroem']), u.AA, \"Angstrom\"),\n        (['arcmin', 'arcm'], u.arcminute, \"minute of arc\"),\n        (['arcsec', 'arcs'], u.arcsecond, \"second of arc\"),\n        (['atm'], _si.atm, \"atmosphere\"),\n        (['AU', 'au'], u.au, \"astronomical unit\"),\n        (['bar'], u.bar, \"bar\"),\n        (['barn'], u.barn, \"barn\"),\n        (['bit'], u.bit, \"bit\"),\n        (['byte'], u.byte, \"byte\"),\n        (['C'], u.C, \"Coulomb\"),\n        (['c'], _si.c, \"speed of light\", ['p']),\n        (['cal'], 4.1854 * u.J, \"calorie\"),\n        (['cd'], u.cd, \"candela\"),\n        (['ct'], u.ct, \"count\"),\n        (['D'], u.D, \"Debye (dipole)\"),\n        (['d'], u.d, \"Julian day\", ['c']),\n        ((['deg', '°'], ['degree']), u.degree, \"degree\"),\n        (['dyn'], u.dyn, \"dyne\"),\n        (['e'], _si.e, \"electron charge\", ['m']),\n        (['eps0'], _si.eps0, \"electric constant\"),\n        (['erg'], u.erg, \"erg\"),\n        (['eV'], u.eV, \"electron volt\"),\n        (['F'], u.F, \"Farad\"),\n        (['G'], _si.G, \"Gravitation constant\"),\n        (['g'], u.g, \"gram\"),\n        (['gauss'], u.G, \"Gauss\"),\n        (['geoMass', 'Mgeo'], u.M_earth, \"Earth mass\"),\n        (['H'], u.H, \"Henry\"),\n        (['h'], u.h, \"hour\", ['p']),\n        (['hr'], u.h, \"hour\"),\n        (['\\\\h'], _si.h, \"Planck constant\"),\n        (['Hz'], u.Hz, \"Hertz\"),\n        (['inch'], 0.0254 * u.m, \"inch\"),\n        (['J'], u.J, \"Joule\"),\n        (['JD'], u.d, \"Julian day\", ['M']),\n        (['jovMass', 'Mjup'], u.M_jup, \"Jupiter mass\"),\n        (['Jy'], u.Jy, \"Jansky\"),\n        (['K'], u.K, \"Kelvin\"),\n        (['k'], _si.k_B, \"Boltzmann\"),\n        (['l'], u.l, \"litre\", ['a']),\n        (['lm'], u.lm, \"lumen\"),\n        (['Lsun', 'solLum'], u.solLum, \"solar luminosity\"),\n        (['lx'], u.lx, \"lux\"),\n        (['m'], u.m, \"meter\"),\n        (['mag'], u.mag, \"magnitude\"),\n        (['me'], _si.m_e, \"electron mass\"),\n        (['min'], u.minute, \"minute\"),\n        (['MJD'], u.d, \"Julian day\"),\n        (['mmHg'], 133.322387415 * u.Pa, \"millimeter of mercury\"),\n        (['mol'], u.mol, \"mole\"),\n        (['mp'], _si.m_p, \"proton mass\"),\n        (['Msun', 'solMass'], u.solMass, \"solar mass\"),\n        ((['mu0', 'µ0'], []), _si.mu0, \"magnetic constant\"),\n        (['muB'], _si.muB, \"Bohr magneton\"),\n        (['N'], u.N, \"Newton\"),\n        (['Ohm'], u.Ohm, \"Ohm\"),\n        (['Pa'], u.Pa, \"Pascal\"),\n        (['pc'], u.pc, \"parsec\"),\n        (['ph'], u.ph, \"photon\"),\n        (['pi'], u.Unit(np.pi), \"π\"),\n        (['pix'], u.pix, \"pixel\"),\n        (['ppm'], u.Unit(1e-6), \"parts per million\"),\n        (['R'], _si.R, \"gas constant\"),\n        (['rad'], u.radian, \"radian\"),\n        (['Rgeo'], _si.R_earth, \"Earth equatorial radius\"),\n        (['Rjup'], _si.R_jup, \"Jupiter equatorial radius\"),\n        (['Rsun', 'solRad'], u.solRad, \"solar radius\"),\n        (['Ry'], u.Ry, \"Rydberg\"),\n        (['S'], u.S, \"Siemens\"),\n        (['s', 'sec'], u.s, \"second\"),\n        (['sr'], u.sr, \"steradian\"),\n        (['Sun'], u.Sun, \"solar unit\"),\n        (['T'], u.T, \"Tesla\"),\n        (['t'], 1e3 * u.kg, \"metric tonne\", ['c']),\n        (['u'], _si.u, \"atomic mass\", ['da', 'a']),\n        (['V'], u.V, \"Volt\"),\n        (['W'], u.W, \"Watt\"),\n        (['Wb'], u.Wb, \"Weber\"),\n        (['yr'], u.a, \"year\"),\n    ]\n\n    for entry in mapping:\n        if len(entry) == 3:\n            names, unit, doc = entry\n            excludes = []\n        else:\n            names, unit, doc, excludes = entry\n        core.def_unit(names, unit, prefixes=prefixes, namespace=_ns, doc=doc,\n                      exclude_prefixes=excludes)\n\n    core.def_unit(['µas'], u.microarcsecond,\n                  doc=\"microsecond of arc\", namespace=_ns)\n    core.def_unit(['mas'], u.milliarcsecond,\n                  doc=\"millisecond of arc\", namespace=_ns)\n    core.def_unit(['---', '-'], u.dimensionless_unscaled,\n                  doc=\"dimensionless and unscaled\", namespace=_ns)\n    core.def_unit(['%'], u.percent,\n                  doc=\"percent\", namespace=_ns)\n    # The Vizier \"standard\" defines this in units of \"kg s-3\", but\n    # that may not make a whole lot of sense, so here we just define\n    # it as its own new disconnected unit.\n    core.def_unit(['Crab'], prefixes=prefixes, namespace=_ns,\n                  doc=\"Crab (X-ray) flux\")"},{"col":4,"comment":"null","endLoc":426,"header":"def _repr_latex_(self)","id":9823,"name":"_repr_latex_","nodeType":"Function","startLoc":425,"text":"def _repr_latex_(self):\n        return self.to_string('latex')"},{"col":4,"comment":"null","endLoc":447,"header":"def __mul__(self, other)","id":9824,"name":"__mul__","nodeType":"Function","startLoc":430,"text":"def __mul__(self, other):\n        if isinstance(other, str):\n            try:\n                other = Unit(other, parse_strict='silent')\n            except Exception:\n                return NotImplemented\n        if isinstance(other, UnitBase):\n            new_units = tuple(part * other for part in self.values())\n            return self.__class__(new_units, names=self)\n        if isinstance(other, StructuredUnit):\n            return NotImplemented\n\n        # Anything not like a unit, try initialising as a structured quantity.\n        try:\n            from .quantity import Quantity\n            return Quantity(other, unit=self)\n        except Exception:\n            return NotImplemented"},{"fileName":"misc.py","filePath":"astropy/units","id":9825,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis package defines miscellaneous units. They are also\navailable in the `astropy.units` namespace.\n\"\"\"\n\n\nfrom . import si\nfrom astropy.constants import si as _si\nfrom .core import (UnitBase, def_unit, si_prefixes, binary_prefixes,\n                   set_enabled_units)\n\n# To ensure si units of the constants can be interpreted.\nset_enabled_units([si])\n\nimport numpy as _numpy\n\n_ns = globals()\n\n###########################################################################\n# AREAS\n\ndef_unit(['barn', 'barn'], 10 ** -28 * si.m ** 2, namespace=_ns, prefixes=True,\n         doc=\"barn: unit of area used in HEP\")\n\n\n###########################################################################\n# ANGULAR MEASUREMENTS\n\ndef_unit(['cycle', 'cy'], 2.0 * _numpy.pi * si.rad,\n         namespace=_ns, prefixes=False,\n         doc=\"cycle: angular measurement, a full turn or rotation\")\n\ndef_unit(['spat', 'sp'], 4.0 * _numpy.pi * si.sr,\n         namespace=_ns, prefixes=False,\n         doc=\"spat: the solid angle of the sphere, 4pi sr\")\n\n##########################################################################\n# PRESSURE\n\ndef_unit(['bar'], 1e5 * si.Pa, namespace=_ns,\n         prefixes=[(['m'], ['milli'], 1.e-3)],\n         doc=\"bar: pressure\")\n\n# The torr is almost the same as mmHg but not quite.\n# See https://en.wikipedia.org/wiki/Torr\n# Define the unit here despite it not being an astrophysical unit.\n# It may be moved if more similar units are created later.\ndef_unit(['Torr', 'torr'], _si.atm.value/760. * si.Pa, namespace=_ns,\n         prefixes=[(['m'], ['milli'], 1.e-3)],\n         doc=\"Unit of pressure based on an absolute scale, now defined as \"\n             \"exactly 1/760 of a standard atmosphere\")\n\n###########################################################################\n# MASS\n\ndef_unit(['M_p'], _si.m_p, namespace=_ns, doc=\"Proton mass\",\n         format={'latex': r'M_{p}', 'unicode': 'Mₚ'})\ndef_unit(['M_e'], _si.m_e, namespace=_ns, doc=\"Electron mass\",\n         format={'latex': r'M_{e}', 'unicode': 'Mₑ'})\n# Unified atomic mass unit\ndef_unit(['u', 'Da', 'Dalton'], _si.u, namespace=_ns,\n         prefixes=True, exclude_prefixes=['a', 'da'],\n         doc=\"Unified atomic mass unit\")\n\n\n###########################################################################\n# COMPUTER\n\ndef_unit((['bit', 'b'], ['bit']), namespace=_ns,\n         prefixes=si_prefixes + binary_prefixes)\ndef_unit((['byte', 'B'], ['byte']), 8 * bit, namespace=_ns,\n         format={'vounit': 'byte'},\n         prefixes=si_prefixes + binary_prefixes,\n         exclude_prefixes=['d'])\ndef_unit((['pix', 'pixel'], ['pixel']),\n         format={'ogip': 'pixel', 'vounit': 'pixel'},\n         namespace=_ns, prefixes=True)\ndef_unit((['vox', 'voxel'], ['voxel']),\n         format={'fits': 'voxel', 'ogip': 'voxel', 'vounit': 'voxel'},\n         namespace=_ns, prefixes=True)\n\n\n###########################################################################\n# CLEANUP\n\ndel UnitBase\ndel def_unit\ndel si\n\n###########################################################################\n# DOCSTRING\n\n# This generates a docstring for this module that describes all of the\n# standard units defined here.\nfrom .utils import generate_unit_summary as _generate_unit_summary\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())\n"},{"col":0,"comment":"null","endLoc":160,"header":"def __getattr__(attr)","id":9826,"name":"__getattr__","nodeType":"Function","startLoc":146,"text":"def __getattr__(attr):\n    if attr == \"littleh\":\n        import warnings\n        from astropy.cosmology.units import littleh\n        from astropy.utils.exceptions import AstropyDeprecationWarning\n\n        warnings.warn(\n            (\"`littleh` is deprecated from module `astropy.units.astrophys` \"\n             \"since astropy 5.0 and may be removed in a future version. \"\n             \"Use `astropy.cosmology.units.littleh` instead.\"),\n            AstropyDeprecationWarning)\n\n        return littleh\n\n    raise AttributeError(f\"module {__name__!r} has no attribute {attr!r}.\")"},{"fileName":"__init__.py","filePath":"astropy/units","id":9827,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis subpackage contains classes and functions for defining and converting\nbetween different physical units.\n\nThis code is adapted from the `pynbody\n<https://github.com/pynbody/pynbody>`_ units module written by Andrew\nPontzen, who has granted the Astropy project permission to use the\ncode under a BSD license.\n\"\"\"\n# Lots of things to import - go from more basic to advanced, so that\n# whatever advanced ones need generally has been imported already;\n# this helps prevent circular imports and makes it easier to understand\n# where most time is spent (e.g., using python -X importtime).\nfrom .core import *\nfrom .quantity import *\n\nfrom . import si\nfrom . import cgs\nfrom . import astrophys\nfrom . import photometric\nfrom . import misc\nfrom .function import units as function_units\n\nfrom .si import *\nfrom .astrophys import *\nfrom .photometric import *\nfrom .cgs import *\nfrom .physical import *\nfrom .function.units import *\nfrom .misc import *\n\nfrom .equivalencies import *\n\nfrom .function.core import *\nfrom .function.logarithmic import *\n\nfrom .structured import *\nfrom .decorators import *\n\ndel bases\n\n# Enable the set of default units.  This notably does *not* include\n# Imperial units.\n\nset_enabled_units([si, cgs, astrophys, function_units, misc, photometric])\n\n\n# -------------------------------------------------------------------------\n\ndef __getattr__(attr):\n    if attr == \"littleh\":\n        from astropy.units.astrophys import littleh\n        return littleh\n    elif attr == \"with_H0\":\n        from astropy.units.equivalencies import with_H0\n        return with_H0\n\n    raise AttributeError(f\"module {__name__!r} has no attribute {attr!r}.\")\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":9828,"name":"_ns","nodeType":"Attribute","startLoc":20,"text":"_ns"},{"col":0,"comment":"","endLoc":7,"header":"misc.py#<anonymous>","id":9829,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nThis package defines miscellaneous units. They are also\navailable in the `astropy.units` namespace.\n\"\"\"\n\nset_enabled_units([si])\n\n_ns = globals()\n\ndef_unit(['barn', 'barn'], 10 ** -28 * si.m ** 2, namespace=_ns, prefixes=True,\n         doc=\"barn: unit of area used in HEP\")\n\ndef_unit(['cycle', 'cy'], 2.0 * _numpy.pi * si.rad,\n         namespace=_ns, prefixes=False,\n         doc=\"cycle: angular measurement, a full turn or rotation\")\n\ndef_unit(['spat', 'sp'], 4.0 * _numpy.pi * si.sr,\n         namespace=_ns, prefixes=False,\n         doc=\"spat: the solid angle of the sphere, 4pi sr\")\n\ndef_unit(['bar'], 1e5 * si.Pa, namespace=_ns,\n         prefixes=[(['m'], ['milli'], 1.e-3)],\n         doc=\"bar: pressure\")\n\ndef_unit(['Torr', 'torr'], _si.atm.value/760. * si.Pa, namespace=_ns,\n         prefixes=[(['m'], ['milli'], 1.e-3)],\n         doc=\"Unit of pressure based on an absolute scale, now defined as \"\n             \"exactly 1/760 of a standard atmosphere\")\n\ndef_unit(['M_p'], _si.m_p, namespace=_ns, doc=\"Proton mass\",\n         format={'latex': r'M_{p}', 'unicode': 'Mₚ'})\n\ndef_unit(['M_e'], _si.m_e, namespace=_ns, doc=\"Electron mass\",\n         format={'latex': r'M_{e}', 'unicode': 'Mₑ'})\n\ndef_unit(['u', 'Da', 'Dalton'], _si.u, namespace=_ns,\n         prefixes=True, exclude_prefixes=['a', 'da'],\n         doc=\"Unified atomic mass unit\")\n\ndef_unit((['bit', 'b'], ['bit']), namespace=_ns,\n         prefixes=si_prefixes + binary_prefixes)\n\ndef_unit((['byte', 'B'], ['byte']), 8 * bit, namespace=_ns,\n         format={'vounit': 'byte'},\n         prefixes=si_prefixes + binary_prefixes,\n         exclude_prefixes=['d'])\n\ndef_unit((['pix', 'pixel'], ['pixel']),\n         format={'ogip': 'pixel', 'vounit': 'pixel'},\n         namespace=_ns, prefixes=True)\n\ndef_unit((['vox', 'voxel'], ['voxel']),\n         format={'fits': 'voxel', 'ogip': 'voxel', 'vounit': 'voxel'},\n         namespace=_ns, prefixes=True)\n\ndel UnitBase\n\ndel def_unit\n\ndel si\n\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())"},{"col":0,"comment":"null","endLoc":60,"header":"def __getattr__(attr)","id":9830,"name":"__getattr__","nodeType":"Function","startLoc":52,"text":"def __getattr__(attr):\n    if attr == \"littleh\":\n        from astropy.units.astrophys import littleh\n        return littleh\n    elif attr == \"with_H0\":\n        from astropy.units.equivalencies import with_H0\n        return with_H0\n\n    raise AttributeError(f\"module {__name__!r} has no attribute {attr!r}.\")"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":9831,"name":"_ns","nodeType":"Attribute","startLoc":20,"text":"_ns"},{"col":0,"comment":"","endLoc":11,"header":"__init__.py#<anonymous>","id":9832,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis subpackage contains classes and functions for defining and converting\nbetween different physical units.\n\nThis code is adapted from the `pynbody\n<https://github.com/pynbody/pynbody>`_ units module written by Andrew\nPontzen, who has granted the Astropy project permission to use the\ncode under a BSD license.\n\"\"\"\n\ndel bases\n\nset_enabled_units([si, cgs, astrophys, function_units, misc, photometric])"},{"col":0,"comment":"","endLoc":7,"header":"astrophys.py#<anonymous>","id":9833,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nThis package defines the astrophysics-specific units.  They are also\navailable in the `astropy.units` namespace.\n\"\"\"\n\nset_enabled_units([si])\n\n_ns = globals()\n\ndef_unit((['AU', 'au'], ['astronomical_unit']), _si.au, namespace=_ns, prefixes=True,\n         doc=\"astronomical unit: approximately the mean Earth--Sun \"\n         \"distance.\")\n\ndef_unit(['pc', 'parsec'], _si.pc, namespace=_ns, prefixes=True,\n         doc=\"parsec: approximately 3.26 light-years.\")\n\ndef_unit(['solRad', 'R_sun', 'Rsun'], _si.R_sun, namespace=_ns,\n         doc=\"Solar radius\", prefixes=False,\n         format={'latex': r'R_{\\odot}', 'unicode': 'R\\N{SUN}'})\n\ndef_unit(['jupiterRad', 'R_jup', 'Rjup', 'R_jupiter', 'Rjupiter'],\n         _si.R_jup, namespace=_ns, prefixes=False, doc=\"Jupiter radius\",\n         # LaTeX jupiter symbol requires wasysym\n         format={'latex': r'R_{\\rm J}', 'unicode': 'R\\N{JUPITER}'})\n\ndef_unit(['earthRad', 'R_earth', 'Rearth'], _si.R_earth, namespace=_ns,\n         prefixes=False, doc=\"Earth radius\",\n         # LaTeX earth symbol requires wasysym\n         format={'latex': r'R_{\\oplus}', 'unicode': 'R⊕'})\n\ndef_unit(['lyr', 'lightyear'], (_si.c * si.yr).to(si.m),\n         namespace=_ns, prefixes=True, doc=\"Light year\")\n\ndef_unit(['lsec', 'lightsecond'], (_si.c * si.s).to(si.m),\n         namespace=_ns, prefixes=False, doc=\"Light second\")\n\ndef_unit(['solMass', 'M_sun', 'Msun'], _si.M_sun, namespace=_ns,\n         prefixes=False, doc=\"Solar mass\",\n         format={'latex': r'M_{\\odot}', 'unicode': 'M\\N{SUN}'})\n\ndef_unit(['jupiterMass', 'M_jup', 'Mjup', 'M_jupiter', 'Mjupiter'],\n         _si.M_jup, namespace=_ns, prefixes=False, doc=\"Jupiter mass\",\n         # LaTeX jupiter symbol requires wasysym\n         format={'latex': r'M_{\\rm J}', 'unicode': 'M\\N{JUPITER}'})\n\ndef_unit(['earthMass', 'M_earth', 'Mearth'], _si.M_earth, namespace=_ns,\n         prefixes=False, doc=\"Earth mass\",\n         # LaTeX earth symbol requires wasysym\n         format={'latex': r'M_{\\oplus}', 'unicode': 'M⊕'})\n\ndef_unit(['Ry', 'rydberg'],\n         (_si.Ryd * _si.c * _si.h.to(si.eV * si.s)).to(si.eV),\n         namespace=_ns, prefixes=True,\n         doc=\"Rydberg: Energy of a photon whose wavenumber is the Rydberg \"\n         \"constant\",\n         format={'latex': r'R_{\\infty}', 'unicode': 'R∞'})\n\ndef_unit(['solLum', 'L_sun', 'Lsun'], _si.L_sun, namespace=_ns,\n         prefixes=False, doc=\"Solar luminance\",\n         format={'latex': r'L_{\\odot}', 'unicode': 'L\\N{SUN}'})\n\ndef_unit((['ph', 'photon'], ['photon']),\n         format={'ogip': 'photon', 'vounit': 'photon'},\n         namespace=_ns, prefixes=True)\n\ndef_unit(['Jy', 'Jansky', 'jansky'], 1e-26 * si.W / si.m ** 2 / si.Hz,\n         namespace=_ns, prefixes=True,\n         doc=\"Jansky: spectral flux density\")\n\ndef_unit(['R', 'Rayleigh', 'rayleigh'],\n         (1e10 / (4 * _numpy.pi)) *\n         ph * si.m ** -2 * si.s ** -1 * si.sr ** -1,\n         namespace=_ns, prefixes=True,\n         doc=\"Rayleigh: photon flux\")\n\ndef_unit((['ct', 'count'], ['count']),\n         format={'fits': 'count', 'ogip': 'count', 'vounit': 'count'},\n         namespace=_ns, prefixes=True, exclude_prefixes=['p'])\n\ndef_unit(['adu'], namespace=_ns, prefixes=True)\n\ndef_unit(['DN', 'dn'], namespace=_ns, prefixes=False)\n\ndef_unit(['Sun'], namespace=_ns)\n\ndef_unit(['chan'], namespace=_ns, prefixes=True)\n\ndef_unit(['bin'], namespace=_ns, prefixes=True)\n\ndef_unit(['beam'], namespace=_ns, prefixes=True)\n\ndef_unit(['electron'], doc=\"Number of electrons\", namespace=_ns,\n         format={'latex': r'e^{-}', 'unicode': 'e⁻'})\n\ndel UnitBase\n\ndel def_unit\n\ndel si\n\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())"},{"fileName":"physical.py","filePath":"astropy/units","id":9834,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"Defines the physical types that correspond to different units.\"\"\"\n\nimport numbers\nimport warnings\n\nfrom . import core\nfrom . import si\nfrom . import astrophys\nfrom . import cgs\nfrom . import imperial  # Need this for backward namespace compat, see issues 11975 and 11977  # noqa\nfrom . import misc\nfrom . import quantity\nfrom astropy.utils.exceptions import AstropyDeprecationWarning\n\n__all__ = [\"def_physical_type\", \"get_physical_type\", \"PhysicalType\"]\n\n_units_and_physical_types = [\n    (core.dimensionless_unscaled, \"dimensionless\"),\n    (si.m, \"length\"),\n    (si.m ** 2, \"area\"),\n    (si.m ** 3, \"volume\"),\n    (si.s, \"time\"),\n    (si.rad, \"angle\"),\n    (si.sr, \"solid angle\"),\n    (si.m / si.s, {\"speed\", \"velocity\"}),\n    (si.m / si.s ** 2, \"acceleration\"),\n    (si.Hz, \"frequency\"),\n    (si.g, \"mass\"),\n    (si.mol, \"amount of substance\"),\n    (si.K, \"temperature\"),\n    (si.W * si.m ** -1 * si.K ** -1, \"thermal conductivity\"),\n    (si.J * si.K ** -1, {\"heat capacity\", \"entropy\"}),\n    (si.J * si.K ** -1 * si.kg ** -1, {\"specific heat capacity\", \"specific entropy\"}),\n    (si.N, \"force\"),\n    (si.J, {\"energy\", \"work\", \"torque\"}),\n    (si.J * si.m ** -2 * si.s ** -1, {\"energy flux\", \"irradiance\"}),\n    (si.Pa, {\"pressure\", \"energy density\", \"stress\"}),\n    (si.W, {\"power\", \"radiant flux\"}),\n    (si.kg * si.m ** -3, \"mass density\"),\n    (si.m ** 3 / si.kg, \"specific volume\"),\n    (si.mol / si.m ** 3, \"molar concentration\"),\n    (si.m ** 3 / si.mol, \"molar volume\"),\n    (si.kg * si.m / si.s, {\"momentum\", \"impulse\"}),\n    (si.kg * si.m ** 2 / si.s, {\"angular momentum\", \"action\"}),\n    (si.rad / si.s, {\"angular speed\", \"angular velocity\", \"angular frequency\"}),\n    (si.rad / si.s ** 2, \"angular acceleration\"),\n    (si.rad / si.m, \"plate scale\"),\n    (si.g / (si.m * si.s), \"dynamic viscosity\"),\n    (si.m ** 2 / si.s, {\"diffusivity\", \"kinematic viscosity\"}),\n    (si.m ** -1, \"wavenumber\"),\n    (si.m ** -2, \"column density\"),\n    (si.A, \"electrical current\"),\n    (si.C, \"electrical charge\"),\n    (si.V, \"electrical potential\"),\n    (si.Ohm, {\"electrical resistance\", \"electrical impedance\", \"electrical reactance\"}),\n    (si.Ohm * si.m, \"electrical resistivity\"),\n    (si.S, \"electrical conductance\"),\n    (si.S / si.m, \"electrical conductivity\"),\n    (si.F, \"electrical capacitance\"),\n    (si.C * si.m, \"electrical dipole moment\"),\n    (si.A / si.m ** 2, \"electrical current density\"),\n    (si.V / si.m, \"electrical field strength\"),\n    (si.C / si.m ** 2,\n        {\"electrical flux density\", \"surface charge density\", \"polarization density\"},\n    ),\n    (si.C / si.m ** 3, \"electrical charge density\"),\n    (si.F / si.m, \"permittivity\"),\n    (si.Wb, \"magnetic flux\"),\n    (si.T, \"magnetic flux density\"),\n    (si.A / si.m, \"magnetic field strength\"),\n    (si.m ** 2 * si.A, \"magnetic moment\"),\n    (si.H / si.m, {\"electromagnetic field strength\", \"permeability\"}),\n    (si.H, \"inductance\"),\n    (si.cd, \"luminous intensity\"),\n    (si.lm, \"luminous flux\"),\n    (si.lx, {\"luminous emittance\", \"illuminance\"}),\n    (si.W / si.sr, \"radiant intensity\"),\n    (si.cd / si.m ** 2, \"luminance\"),\n    (si.m ** -3 * si.s ** -1, \"volumetric rate\"),\n    (astrophys.Jy, \"spectral flux density\"),\n    (si.W * si.m ** 2 * si.Hz ** -1, \"surface tension\"),\n    (si.J * si.m ** -3 * si.s ** -1, {\"spectral flux density wav\", \"power density\"}),\n    (astrophys.photon / si.Hz / si.cm ** 2 / si.s, \"photon flux density\"),\n    (astrophys.photon / si.AA / si.cm ** 2 / si.s, \"photon flux density wav\"),\n    (astrophys.R, \"photon flux\"),\n    (misc.bit, \"data quantity\"),\n    (misc.bit / si.s, \"bandwidth\"),\n    (cgs.Franklin, \"electrical charge (ESU)\"),\n    (cgs.statampere, \"electrical current (ESU)\"),\n    (cgs.Biot, \"electrical current (EMU)\"),\n    (cgs.abcoulomb, \"electrical charge (EMU)\"),\n    (si.m * si.s ** -3, {\"jerk\", \"jolt\"}),\n    (si.m * si.s ** -4, {\"snap\", \"jounce\"}),\n    (si.m * si.s ** -5, \"crackle\"),\n    (si.m * si.s ** -6, {\"pop\", \"pounce\"}),\n    (si.K / si.m, \"temperature gradient\"),\n    (si.J / si.kg, \"specific energy\"),\n    (si.mol * si.m ** -3 * si.s ** -1, \"reaction rate\"),\n    (si.kg * si.m ** 2, \"moment of inertia\"),\n    (si.mol / si.s, \"catalytic activity\"),\n    (si.J * si.K ** -1 * si.mol ** -1, \"molar heat capacity\"),\n    (si.mol / si.kg, \"molality\"),\n    (si.m * si.s, \"absement\"),\n    (si.m * si.s ** 2, \"absity\"),\n    (si.m ** 3 / si.s, \"volumetric flow rate\"),\n    (si.s ** -2, \"frequency drift\"),\n    (si.Pa ** -1, \"compressibility\"),\n    (astrophys.electron * si.m ** -3, \"electron density\"),\n    (astrophys.electron * si.m ** -2 * si.s ** -1, \"electron flux\"),\n    (si.kg / si.m ** 2, \"surface mass density\"),\n    (si.W / si.m ** 2 / si.sr, \"radiance\"),\n    (si.J / si.mol, \"chemical potential\"),\n    (si.kg / si.m, \"linear density\"),\n    (si.H ** -1, \"magnetic reluctance\"),\n    (si.W / si.K, \"thermal conductance\"),\n    (si.K / si.W, \"thermal resistance\"),\n    (si.K * si.m / si.W, \"thermal resistivity\"),\n    (si.N / si.s, \"yank\"),\n    (si.S * si.m ** 2 / si.mol, \"molar conductivity\"),\n    (si.m ** 2 / si.V / si.s, \"electrical mobility\"),\n    (si.lumen / si.W, \"luminous efficacy\"),\n    (si.m ** 2 / si.kg, {\"opacity\", \"mass attenuation coefficient\"}),\n    (si.kg * si.m ** -2 * si.s ** -1, {\"mass flux\", \"momentum density\"}),\n    (si.m ** -3, \"number density\"),\n    (si.m ** -2 * si.s ** -1, \"particle flux\"),\n]\n\n_physical_unit_mapping = {}\n_unit_physical_mapping = {}\n_name_physical_mapping = {}\n# mapping from attribute-accessible name (no spaces, etc.) to the actual name.\n_attrname_physical_mapping = {}\n\n\ndef _physical_type_from_str(name):\n    \"\"\"\n    Return the `PhysicalType` instance associated with the name of a\n    physical type.\n    \"\"\"\n    if name == \"unknown\":\n        raise ValueError(\"cannot uniquely identify an 'unknown' physical type.\")\n\n    elif name in _attrname_physical_mapping:\n        return _attrname_physical_mapping[name]  # convert attribute-accessible\n    elif name in _name_physical_mapping:\n        return _name_physical_mapping[name]\n    else:\n        raise ValueError(f\"{name!r} is not a known physical type.\")\n\n\ndef _replace_temperatures_with_kelvin(unit):\n    \"\"\"\n    If a unit contains a temperature unit besides kelvin, then replace\n    that unit with kelvin.\n\n    Temperatures cannot be converted directly between K, °F, °C, and\n    °Ra, in particular since there would be different conversions for\n    T and ΔT.  However, each of these temperatures each represents the\n    physical type.  Replacing the different temperature units with\n    kelvin allows the physical type to be treated consistently.\n    \"\"\"\n    physical_type_id = unit._get_physical_type_id()\n\n    physical_type_id_components = []\n    substitution_was_made = False\n\n    for base, power in physical_type_id:\n        if base in [\"deg_F\", \"deg_C\", \"deg_R\"]:\n            base = \"K\"\n            substitution_was_made = True\n        physical_type_id_components.append((base, power))\n\n    if substitution_was_made:\n        return core.Unit._from_physical_type_id(tuple(physical_type_id_components))\n    else:\n        return unit\n\n\ndef _standardize_physical_type_names(physical_type_input):\n    \"\"\"\n    Convert a string or `set` of strings into a `set` containing\n    string representations of physical types.\n\n    The strings provided in ``physical_type_input`` can each contain\n    multiple physical types that are separated by a regular slash.\n    Underscores are treated as spaces so that variable names could\n    be identical to physical type names.\n    \"\"\"\n    if isinstance(physical_type_input, str):\n        physical_type_input = {physical_type_input}\n\n    standardized_physical_types = set()\n\n    for ptype_input in physical_type_input:\n        if not isinstance(ptype_input, str):\n            raise ValueError(f\"expecting a string, but got {ptype_input}\")\n        input_set = set(ptype_input.split(\"/\"))\n        processed_set = {s.strip().replace(\"_\", \" \") for s in input_set}\n        standardized_physical_types |= processed_set\n\n    return standardized_physical_types\n\n\nclass PhysicalType:\n    \"\"\"\n    Represents the physical type(s) that are dimensionally compatible\n    with a set of units.\n\n    Instances of this class should be accessed through either\n    `get_physical_type` or by using the\n    `~astropy.units.core.UnitBase.physical_type` attribute of units.\n    This class is not intended to be instantiated directly in user code.\n\n    Parameters\n    ----------\n    unit : `~astropy.units.Unit`\n        The unit to be represented by the physical type.\n\n    physical_types : `str` or `set` of `str`\n        A `str` representing the name of the physical type of the unit,\n        or a `set` containing strings that represent one or more names\n        of physical types.\n\n    Notes\n    -----\n    A physical type will be considered equal to an equivalent\n    `PhysicalType` instance (recommended) or a string that contains a\n    name of the physical type.  The latter method is not recommended\n    in packages, as the names of some physical types may change in the\n    future.\n\n    To maintain backwards compatibility, two physical type names may be\n    included in one string if they are separated with a slash (e.g.,\n    ``\"momentum/impulse\"``).  String representations of physical types\n    may include underscores instead of spaces.\n\n    Examples\n    --------\n    `PhysicalType` instances may be accessed via the\n    `~astropy.units.core.UnitBase.physical_type` attribute of units.\n\n    >>> import astropy.units as u\n    >>> u.meter.physical_type\n    PhysicalType('length')\n\n    `PhysicalType` instances may also be accessed by calling\n    `get_physical_type`. This function will accept a unit, a string\n    containing the name of a physical type, or the number one.\n\n    >>> u.get_physical_type(u.m ** -3)\n    PhysicalType('number density')\n    >>> u.get_physical_type(\"volume\")\n    PhysicalType('volume')\n    >>> u.get_physical_type(1)\n    PhysicalType('dimensionless')\n\n    Some units are dimensionally compatible with multiple physical types.\n    A pascal is intended to represent pressure and stress, but the unit\n    decomposition is equivalent to that of energy density.\n\n    >>> pressure = u.get_physical_type(\"pressure\")\n    >>> pressure\n    PhysicalType({'energy density', 'pressure', 'stress'})\n    >>> 'energy density' in pressure\n    True\n\n    Physical types can be tested for equality against other physical\n    type objects or against strings that may contain the name of a\n    physical type.\n\n    >>> area = (u.m ** 2).physical_type\n    >>> area == u.barn.physical_type\n    True\n    >>> area == \"area\"\n    True\n\n    Multiplication, division, and exponentiation are enabled so that\n    physical types may be used for dimensional analysis.\n\n    >>> length = u.pc.physical_type\n    >>> area = (u.cm ** 2).physical_type\n    >>> length * area\n    PhysicalType('volume')\n    >>> area / length\n    PhysicalType('length')\n    >>> length ** 3\n    PhysicalType('volume')\n\n    may also be performed using a string that contains the name of a\n    physical type.\n\n    >>> \"length\" * area\n    PhysicalType('volume')\n    >>> \"area\" / length\n    PhysicalType('length')\n\n    Unknown physical types are labelled as ``\"unknown\"``.\n\n    >>> (u.s ** 13).physical_type\n    PhysicalType('unknown')\n\n    Dimensional analysis may be performed for unknown physical types too.\n\n    >>> length_to_19th_power = (u.m ** 19).physical_type\n    >>> length_to_20th_power = (u.m ** 20).physical_type\n    >>> length_to_20th_power / length_to_19th_power\n    PhysicalType('length')\n    \"\"\"\n\n    def __init__(self, unit, physical_types):\n        self._unit = _replace_temperatures_with_kelvin(unit)\n        self._physical_type_id = self._unit._get_physical_type_id()\n        self._physical_type = _standardize_physical_type_names(physical_types)\n        self._physical_type_list = sorted(self._physical_type)\n\n    def __iter__(self):\n        yield from self._physical_type_list\n\n    def __getattr__(self, attr):\n        # TODO: remove this whole method when accessing str attributes from\n        # physical types is no longer supported\n\n        # short circuit attribute accessed in __str__ to prevent recursion\n        if attr == '_physical_type_list':\n            super().__getattribute__(attr)\n\n        self_str_attr = getattr(str(self), attr, None)\n        if hasattr(str(self), attr):\n            warning_message = (\n                f\"support for accessing str attributes such as {attr!r} \"\n                \"from PhysicalType instances is deprecated since 4.3 \"\n                \"and will be removed in a subsequent release.\")\n            warnings.warn(warning_message, AstropyDeprecationWarning)\n            return self_str_attr\n        else:\n            super().__getattribute__(attr)  # to get standard error message\n\n    def __eq__(self, other):\n        \"\"\"\n        Return `True` if ``other`` represents a physical type that is\n        consistent with the physical type of the `PhysicalType` instance.\n        \"\"\"\n        if isinstance(other, PhysicalType):\n            return self._physical_type_id == other._physical_type_id\n        elif isinstance(other, str):\n            other = _standardize_physical_type_names(other)\n            return other.issubset(self._physical_type)\n        else:\n            return NotImplemented\n\n    def __ne__(self, other):\n        equality = self.__eq__(other)\n        return not equality if isinstance(equality, bool) else NotImplemented\n\n    def _name_string_as_ordered_set(self):\n        return \"{\" + str(self._physical_type_list)[1:-1] + \"}\"\n\n    def __repr__(self):\n        if len(self._physical_type) == 1:\n            names = \"'\" + self._physical_type_list[0] + \"'\"\n        else:\n            names = self._name_string_as_ordered_set()\n        return f\"PhysicalType({names})\"\n\n    def __str__(self):\n        return \"/\".join(self._physical_type_list)\n\n    @staticmethod\n    def _dimensionally_compatible_unit(obj):\n        \"\"\"\n        Return a unit that corresponds to the provided argument.\n\n        If a unit is passed in, return that unit.  If a physical type\n        (or a `str` with the name of a physical type) is passed in,\n        return a unit that corresponds to that physical type.  If the\n        number equal to ``1`` is passed in, return a dimensionless unit.\n        Otherwise, return `NotImplemented`.\n        \"\"\"\n        if isinstance(obj, core.UnitBase):\n            return _replace_temperatures_with_kelvin(obj)\n        elif isinstance(obj, PhysicalType):\n            return obj._unit\n        elif isinstance(obj, numbers.Real) and obj == 1:\n            return core.dimensionless_unscaled\n        elif isinstance(obj, str):\n            return _physical_type_from_str(obj)._unit\n        else:\n            return NotImplemented\n\n    def _dimensional_analysis(self, other, operation):\n        other_unit = self._dimensionally_compatible_unit(other)\n        if other_unit is NotImplemented:\n            return NotImplemented\n        other_unit = _replace_temperatures_with_kelvin(other_unit)\n        new_unit = getattr(self._unit, operation)(other_unit)\n        return new_unit.physical_type\n\n    def __mul__(self, other):\n        return self._dimensional_analysis(other, \"__mul__\")\n\n    def __rmul__(self, other):\n        return self.__mul__(other)\n\n    def __truediv__(self, other):\n        return self._dimensional_analysis(other, \"__truediv__\")\n\n    def __rtruediv__(self, other):\n        other = self._dimensionally_compatible_unit(other)\n        if other is NotImplemented:\n            return NotImplemented\n        return other.physical_type._dimensional_analysis(self, \"__truediv__\")\n\n    def __pow__(self, power):\n        return (self._unit ** power).physical_type\n\n    def __hash__(self):\n        return hash(self._physical_type_id)\n\n    def __len__(self):\n        return len(self._physical_type)\n\n    # We need to prevent operations like where a Unit instance left\n    # multiplies a PhysicalType instance from returning a `Quantity`\n    # instance with a PhysicalType as the value.  We can do this by\n    # preventing np.array from casting a PhysicalType instance as\n    # an object array.\n    __array__ = None\n\n\ndef def_physical_type(unit, name):\n    \"\"\"\n    Add a mapping between a unit and the corresponding physical type(s).\n\n    If a physical type already exists for a unit, add new physical type\n    names so long as those names are not already in use for other\n    physical types.\n\n    Parameters\n    ----------\n    unit : `~astropy.units.Unit`\n        The unit to be represented by the physical type.\n\n    name : `str` or `set` of `str`\n        A `str` representing the name of the physical type of the unit,\n        or a `set` containing strings that represent one or more names\n        of physical types.\n\n    Raises\n    ------\n    ValueError\n        If a physical type name is already in use for another unit, or\n        if attempting to name a unit as ``\"unknown\"``.\n    \"\"\"\n    physical_type_id = unit._get_physical_type_id()\n    physical_type_names = _standardize_physical_type_names(name)\n\n    if \"unknown\" in physical_type_names:\n        raise ValueError(\"cannot uniquely define an unknown physical type\")\n\n    names_for_other_units = set(_unit_physical_mapping.keys()).difference(\n        _physical_unit_mapping.get(physical_type_id, {}))\n    names_already_in_use = physical_type_names & names_for_other_units\n    if names_already_in_use:\n        raise ValueError(\n            f\"the following physical type names are already in use: \"\n            f\"{names_already_in_use}.\")\n\n    unit_already_in_use = physical_type_id in _physical_unit_mapping\n    if unit_already_in_use:\n        physical_type = _physical_unit_mapping[physical_type_id]\n        physical_type_names |= set(physical_type)\n        physical_type.__init__(unit, physical_type_names)\n    else:\n        physical_type = PhysicalType(unit, physical_type_names)\n        _physical_unit_mapping[physical_type_id] = physical_type\n\n    for ptype in physical_type:\n        _unit_physical_mapping[ptype] = physical_type_id\n\n    for ptype_name in physical_type_names:\n        _name_physical_mapping[ptype_name] = physical_type\n        # attribute-accessible name\n        attr_name = ptype_name.replace(' ', '_').replace('(', '').replace(')', '')\n        _attrname_physical_mapping[attr_name] = physical_type\n\n\ndef get_physical_type(obj):\n    \"\"\"\n    Return the physical type that corresponds to a unit (or another\n    physical type representation).\n\n    Parameters\n    ----------\n    obj : quantity-like or `~astropy.units.PhysicalType`-like\n        An object that (implicitly or explicitly) has a corresponding\n        physical type. This object may be a unit, a\n        `~astropy.units.Quantity`, an object that can be converted to a\n        `~astropy.units.Quantity` (such as a number or array), a string\n        that contains a name of a physical type, or a\n        `~astropy.units.PhysicalType` instance.\n\n    Returns\n    -------\n    `~astropy.units.PhysicalType`\n        A representation of the physical type(s) of the unit.\n\n    Examples\n    --------\n    The physical type may be retrieved from a unit or a\n    `~astropy.units.Quantity`.\n\n    >>> import astropy.units as u\n    >>> u.get_physical_type(u.meter ** -2)\n    PhysicalType('column density')\n    >>> u.get_physical_type(0.62 * u.barn * u.Mpc)\n    PhysicalType('volume')\n\n    The physical type may also be retrieved by providing a `str` that\n    contains the name of a physical type.\n\n    >>> u.get_physical_type(\"energy\")\n    PhysicalType({'energy', 'torque', 'work'})\n\n    Numbers and arrays of numbers correspond to a dimensionless physical\n    type.\n\n    >>> u.get_physical_type(1)\n    PhysicalType('dimensionless')\n    \"\"\"\n    if isinstance(obj, PhysicalType):\n        return obj\n\n    if isinstance(obj, str):\n        return _physical_type_from_str(obj)\n\n    try:\n        unit = obj if isinstance(obj, core.UnitBase) else quantity.Quantity(obj, copy=False).unit\n    except TypeError as exc:\n        raise TypeError(f\"{obj} does not correspond to a physical type.\") from exc\n\n    unit = _replace_temperatures_with_kelvin(unit)\n    physical_type_id = unit._get_physical_type_id()\n    unit_has_known_physical_type = physical_type_id in _physical_unit_mapping\n\n    if unit_has_known_physical_type:\n        return _physical_unit_mapping[physical_type_id]\n    else:\n        return PhysicalType(unit, \"unknown\")\n\n\n# ------------------------------------------------------------------------------\n# Script section creating the physical types and the documentation\n\n# define the physical types\nfor unit, physical_type in _units_and_physical_types:\n    def_physical_type(unit, physical_type)\n\n\n# For getting the physical types.\ndef __getattr__(name):\n    \"\"\"Checks for physical types using lazy import.\n\n    This also allows user-defined physical types to be accessible from the\n    :mod:`astropy.units.physical` module.\n    See `PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_\n\n    Parameters\n    ----------\n    name : str\n        The name of the attribute in this module. If it is already defined,\n        then this function is not called.\n\n    Returns\n    -------\n    ptype : `~astropy.units.physical.PhysicalType`\n\n    Raises\n    ------\n    AttributeError\n        If the ``name`` does not correspond to a physical type\n    \"\"\"\n    if name in _attrname_physical_mapping:\n        return _attrname_physical_mapping[name]\n\n    raise AttributeError(f\"module {__name__!r} has no attribute {name!r}\")\n\n\ndef __dir__():\n    \"\"\"Return contents directory (__all__ + all physical type names).\"\"\"\n    return list(set(__all__) | set(_attrname_physical_mapping.keys()))\n\n\n# This generates a docstring addition for this module that describes all of the\n# standard physical types defined here.\nif __doc__ is not None:\n    doclines = [\n        \".. list-table:: Defined Physical Types\",\n        \"    :header-rows: 1\",\n        \"    :widths: 30 10 50\",\n        \"\",\n        \"    * - Physical type\",\n        \"      - Unit\",\n        \"      - Other physical type(s) with same unit\"]\n\n    for name in sorted(_name_physical_mapping.keys()):\n        physical_type = _name_physical_mapping[name]\n        doclines.extend([\n            f\"    * - _`{name}`\",\n            f\"      - :math:`{physical_type._unit.to_string('latex')[1:-1]}`\",\n            f\"      - {', '.join([n for n in physical_type if n != name])}\"])\n\n    __doc__ += '\\n\\n' + '\\n'.join(doclines)\n\n\ndel unit, physical_type\n"},{"className":"PhysicalType","col":0,"comment":"\n    Represents the physical type(s) that are dimensionally compatible\n    with a set of units.\n\n    Instances of this class should be accessed through either\n    `get_physical_type` or by using the\n    `~astropy.units.core.UnitBase.physical_type` attribute of units.\n    This class is not intended to be instantiated directly in user code.\n\n    Parameters\n    ----------\n    unit : `~astropy.units.Unit`\n        The unit to be represented by the physical type.\n\n    physical_types : `str` or `set` of `str`\n        A `str` representing the name of the physical type of the unit,\n        or a `set` containing strings that represent one or more names\n        of physical types.\n\n    Notes\n    -----\n    A physical type will be considered equal to an equivalent\n    `PhysicalType` instance (recommended) or a string that contains a\n    name of the physical type.  The latter method is not recommended\n    in packages, as the names of some physical types may change in the\n    future.\n\n    To maintain backwards compatibility, two physical type names may be\n    included in one string if they are separated with a slash (e.g.,\n    ``\"momentum/impulse\"``).  String representations of physical types\n    may include underscores instead of spaces.\n\n    Examples\n    --------\n    `PhysicalType` instances may be accessed via the\n    `~astropy.units.core.UnitBase.physical_type` attribute of units.\n\n    >>> import astropy.units as u\n    >>> u.meter.physical_type\n    PhysicalType('length')\n\n    `PhysicalType` instances may also be accessed by calling\n    `get_physical_type`. This function will accept a unit, a string\n    containing the name of a physical type, or the number one.\n\n    >>> u.get_physical_type(u.m ** -3)\n    PhysicalType('number density')\n    >>> u.get_physical_type(\"volume\")\n    PhysicalType('volume')\n    >>> u.get_physical_type(1)\n    PhysicalType('dimensionless')\n\n    Some units are dimensionally compatible with multiple physical types.\n    A pascal is intended to represent pressure and stress, but the unit\n    decomposition is equivalent to that of energy density.\n\n    >>> pressure = u.get_physical_type(\"pressure\")\n    >>> pressure\n    PhysicalType({'energy density', 'pressure', 'stress'})\n    >>> 'energy density' in pressure\n    True\n\n    Physical types can be tested for equality against other physical\n    type objects or against strings that may contain the name of a\n    physical type.\n\n    >>> area = (u.m ** 2).physical_type\n    >>> area == u.barn.physical_type\n    True\n    >>> area == \"area\"\n    True\n\n    Multiplication, division, and exponentiation are enabled so that\n    physical types may be used for dimensional analysis.\n\n    >>> length = u.pc.physical_type\n    >>> area = (u.cm ** 2).physical_type\n    >>> length * area\n    PhysicalType('volume')\n    >>> area / length\n    PhysicalType('length')\n    >>> length ** 3\n    PhysicalType('volume')\n\n    may also be performed using a string that contains the name of a\n    physical type.\n\n    >>> \"length\" * area\n    PhysicalType('volume')\n    >>> \"area\" / length\n    PhysicalType('length')\n\n    Unknown physical types are labelled as ``\"unknown\"``.\n\n    >>> (u.s ** 13).physical_type\n    PhysicalType('unknown')\n\n    Dimensional analysis may be performed for unknown physical types too.\n\n    >>> length_to_19th_power = (u.m ** 19).physical_type\n    >>> length_to_20th_power = (u.m ** 20).physical_type\n    >>> length_to_20th_power / length_to_19th_power\n    PhysicalType('length')\n    ","endLoc":429,"id":9835,"nodeType":"Class","startLoc":206,"text":"class PhysicalType:\n    \"\"\"\n    Represents the physical type(s) that are dimensionally compatible\n    with a set of units.\n\n    Instances of this class should be accessed through either\n    `get_physical_type` or by using the\n    `~astropy.units.core.UnitBase.physical_type` attribute of units.\n    This class is not intended to be instantiated directly in user code.\n\n    Parameters\n    ----------\n    unit : `~astropy.units.Unit`\n        The unit to be represented by the physical type.\n\n    physical_types : `str` or `set` of `str`\n        A `str` representing the name of the physical type of the unit,\n        or a `set` containing strings that represent one or more names\n        of physical types.\n\n    Notes\n    -----\n    A physical type will be considered equal to an equivalent\n    `PhysicalType` instance (recommended) or a string that contains a\n    name of the physical type.  The latter method is not recommended\n    in packages, as the names of some physical types may change in the\n    future.\n\n    To maintain backwards compatibility, two physical type names may be\n    included in one string if they are separated with a slash (e.g.,\n    ``\"momentum/impulse\"``).  String representations of physical types\n    may include underscores instead of spaces.\n\n    Examples\n    --------\n    `PhysicalType` instances may be accessed via the\n    `~astropy.units.core.UnitBase.physical_type` attribute of units.\n\n    >>> import astropy.units as u\n    >>> u.meter.physical_type\n    PhysicalType('length')\n\n    `PhysicalType` instances may also be accessed by calling\n    `get_physical_type`. This function will accept a unit, a string\n    containing the name of a physical type, or the number one.\n\n    >>> u.get_physical_type(u.m ** -3)\n    PhysicalType('number density')\n    >>> u.get_physical_type(\"volume\")\n    PhysicalType('volume')\n    >>> u.get_physical_type(1)\n    PhysicalType('dimensionless')\n\n    Some units are dimensionally compatible with multiple physical types.\n    A pascal is intended to represent pressure and stress, but the unit\n    decomposition is equivalent to that of energy density.\n\n    >>> pressure = u.get_physical_type(\"pressure\")\n    >>> pressure\n    PhysicalType({'energy density', 'pressure', 'stress'})\n    >>> 'energy density' in pressure\n    True\n\n    Physical types can be tested for equality against other physical\n    type objects or against strings that may contain the name of a\n    physical type.\n\n    >>> area = (u.m ** 2).physical_type\n    >>> area == u.barn.physical_type\n    True\n    >>> area == \"area\"\n    True\n\n    Multiplication, division, and exponentiation are enabled so that\n    physical types may be used for dimensional analysis.\n\n    >>> length = u.pc.physical_type\n    >>> area = (u.cm ** 2).physical_type\n    >>> length * area\n    PhysicalType('volume')\n    >>> area / length\n    PhysicalType('length')\n    >>> length ** 3\n    PhysicalType('volume')\n\n    may also be performed using a string that contains the name of a\n    physical type.\n\n    >>> \"length\" * area\n    PhysicalType('volume')\n    >>> \"area\" / length\n    PhysicalType('length')\n\n    Unknown physical types are labelled as ``\"unknown\"``.\n\n    >>> (u.s ** 13).physical_type\n    PhysicalType('unknown')\n\n    Dimensional analysis may be performed for unknown physical types too.\n\n    >>> length_to_19th_power = (u.m ** 19).physical_type\n    >>> length_to_20th_power = (u.m ** 20).physical_type\n    >>> length_to_20th_power / length_to_19th_power\n    PhysicalType('length')\n    \"\"\"\n\n    def __init__(self, unit, physical_types):\n        self._unit = _replace_temperatures_with_kelvin(unit)\n        self._physical_type_id = self._unit._get_physical_type_id()\n        self._physical_type = _standardize_physical_type_names(physical_types)\n        self._physical_type_list = sorted(self._physical_type)\n\n    def __iter__(self):\n        yield from self._physical_type_list\n\n    def __getattr__(self, attr):\n        # TODO: remove this whole method when accessing str attributes from\n        # physical types is no longer supported\n\n        # short circuit attribute accessed in __str__ to prevent recursion\n        if attr == '_physical_type_list':\n            super().__getattribute__(attr)\n\n        self_str_attr = getattr(str(self), attr, None)\n        if hasattr(str(self), attr):\n            warning_message = (\n                f\"support for accessing str attributes such as {attr!r} \"\n                \"from PhysicalType instances is deprecated since 4.3 \"\n                \"and will be removed in a subsequent release.\")\n            warnings.warn(warning_message, AstropyDeprecationWarning)\n            return self_str_attr\n        else:\n            super().__getattribute__(attr)  # to get standard error message\n\n    def __eq__(self, other):\n        \"\"\"\n        Return `True` if ``other`` represents a physical type that is\n        consistent with the physical type of the `PhysicalType` instance.\n        \"\"\"\n        if isinstance(other, PhysicalType):\n            return self._physical_type_id == other._physical_type_id\n        elif isinstance(other, str):\n            other = _standardize_physical_type_names(other)\n            return other.issubset(self._physical_type)\n        else:\n            return NotImplemented\n\n    def __ne__(self, other):\n        equality = self.__eq__(other)\n        return not equality if isinstance(equality, bool) else NotImplemented\n\n    def _name_string_as_ordered_set(self):\n        return \"{\" + str(self._physical_type_list)[1:-1] + \"}\"\n\n    def __repr__(self):\n        if len(self._physical_type) == 1:\n            names = \"'\" + self._physical_type_list[0] + \"'\"\n        else:\n            names = self._name_string_as_ordered_set()\n        return f\"PhysicalType({names})\"\n\n    def __str__(self):\n        return \"/\".join(self._physical_type_list)\n\n    @staticmethod\n    def _dimensionally_compatible_unit(obj):\n        \"\"\"\n        Return a unit that corresponds to the provided argument.\n\n        If a unit is passed in, return that unit.  If a physical type\n        (or a `str` with the name of a physical type) is passed in,\n        return a unit that corresponds to that physical type.  If the\n        number equal to ``1`` is passed in, return a dimensionless unit.\n        Otherwise, return `NotImplemented`.\n        \"\"\"\n        if isinstance(obj, core.UnitBase):\n            return _replace_temperatures_with_kelvin(obj)\n        elif isinstance(obj, PhysicalType):\n            return obj._unit\n        elif isinstance(obj, numbers.Real) and obj == 1:\n            return core.dimensionless_unscaled\n        elif isinstance(obj, str):\n            return _physical_type_from_str(obj)._unit\n        else:\n            return NotImplemented\n\n    def _dimensional_analysis(self, other, operation):\n        other_unit = self._dimensionally_compatible_unit(other)\n        if other_unit is NotImplemented:\n            return NotImplemented\n        other_unit = _replace_temperatures_with_kelvin(other_unit)\n        new_unit = getattr(self._unit, operation)(other_unit)\n        return new_unit.physical_type\n\n    def __mul__(self, other):\n        return self._dimensional_analysis(other, \"__mul__\")\n\n    def __rmul__(self, other):\n        return self.__mul__(other)\n\n    def __truediv__(self, other):\n        return self._dimensional_analysis(other, \"__truediv__\")\n\n    def __rtruediv__(self, other):\n        other = self._dimensionally_compatible_unit(other)\n        if other is NotImplemented:\n            return NotImplemented\n        return other.physical_type._dimensional_analysis(self, \"__truediv__\")\n\n    def __pow__(self, power):\n        return (self._unit ** power).physical_type\n\n    def __hash__(self):\n        return hash(self._physical_type_id)\n\n    def __len__(self):\n        return len(self._physical_type)\n\n    # We need to prevent operations like where a Unit instance left\n    # multiplies a PhysicalType instance from returning a `Quantity`\n    # instance with a PhysicalType as the value.  We can do this by\n    # preventing np.array from casting a PhysicalType instance as\n    # an object array.\n    __array__ = None"},{"col":4,"comment":"null","endLoc":319,"header":"def __iter__(self)","id":9836,"name":"__iter__","nodeType":"Function","startLoc":318,"text":"def __iter__(self):\n        yield from self._physical_type_list"},{"col":4,"comment":"null","endLoc":338,"header":"def __getattr__(self, attr)","id":9837,"name":"__getattr__","nodeType":"Function","startLoc":321,"text":"def __getattr__(self, attr):\n        # TODO: remove this whole method when accessing str attributes from\n        # physical types is no longer supported\n\n        # short circuit attribute accessed in __str__ to prevent recursion\n        if attr == '_physical_type_list':\n            super().__getattribute__(attr)\n\n        self_str_attr = getattr(str(self), attr, None)\n        if hasattr(str(self), attr):\n            warning_message = (\n                f\"support for accessing str attributes such as {attr!r} \"\n                \"from PhysicalType instances is deprecated since 4.3 \"\n                \"and will be removed in a subsequent release.\")\n            warnings.warn(warning_message, AstropyDeprecationWarning)\n            return self_str_attr\n        else:\n            super().__getattribute__(attr)  # to get standard error message"},{"fileName":"core.py","filePath":"astropy/units","id":9838,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nCore units classes and functions\n\"\"\"\n\n\nimport inspect\nimport operator\nimport textwrap\nimport warnings\n\nimport numpy as np\n\nfrom astropy.utils.decorators import lazyproperty\nfrom astropy.utils.exceptions import AstropyWarning\nfrom astropy.utils.misc import isiterable\nfrom .utils import (is_effectively_unity, sanitize_scale, validate_power,\n                    resolve_fractions)\nfrom . import format as unit_format\n\n\n__all__ = [\n    'UnitsError', 'UnitsWarning', 'UnitConversionError', 'UnitTypeError',\n    'UnitBase', 'NamedUnit', 'IrreducibleUnit', 'Unit', 'CompositeUnit',\n    'PrefixUnit', 'UnrecognizedUnit', 'def_unit', 'get_current_unit_registry',\n    'set_enabled_units', 'add_enabled_units',\n    'set_enabled_equivalencies', 'add_enabled_equivalencies',\n    'set_enabled_aliases', 'add_enabled_aliases',\n    'dimensionless_unscaled', 'one',\n]\n\nUNITY = 1.0\n\n\ndef _flatten_units_collection(items):\n    \"\"\"\n    Given a list of sequences, modules or dictionaries of units, or\n    single units, return a flat set of all the units found.\n    \"\"\"\n    if not isinstance(items, list):\n        items = [items]\n\n    result = set()\n    for item in items:\n        if isinstance(item, UnitBase):\n            result.add(item)\n        else:\n            if isinstance(item, dict):\n                units = item.values()\n            elif inspect.ismodule(item):\n                units = vars(item).values()\n            elif isiterable(item):\n                units = item\n            else:\n                continue\n\n            for unit in units:\n                if isinstance(unit, UnitBase):\n                    result.add(unit)\n\n    return result\n\n\ndef _normalize_equivalencies(equivalencies):\n    \"\"\"\n    Normalizes equivalencies, ensuring each is a 4-tuple of the form::\n\n    (from_unit, to_unit, forward_func, backward_func)\n\n    Parameters\n    ----------\n    equivalencies : list of equivalency pairs\n\n    Raises\n    ------\n    ValueError if an equivalency cannot be interpreted\n    \"\"\"\n    if equivalencies is None:\n        return []\n\n    normalized = []\n\n    for i, equiv in enumerate(equivalencies):\n        if len(equiv) == 2:\n            funit, tunit = equiv\n            a = b = lambda x: x\n        elif len(equiv) == 3:\n            funit, tunit, a = equiv\n            b = a\n        elif len(equiv) == 4:\n            funit, tunit, a, b = equiv\n        else:\n            raise ValueError(\n                f\"Invalid equivalence entry {i}: {equiv!r}\")\n        if not (funit is Unit(funit) and\n                (tunit is None or tunit is Unit(tunit)) and\n                callable(a) and\n                callable(b)):\n            raise ValueError(\n                f\"Invalid equivalence entry {i}: {equiv!r}\")\n        normalized.append((funit, tunit, a, b))\n\n    return normalized\n\n\nclass _UnitRegistry:\n    \"\"\"\n    Manages a registry of the enabled units.\n    \"\"\"\n\n    def __init__(self, init=[], equivalencies=[], aliases={}):\n\n        if isinstance(init, _UnitRegistry):\n            # If passed another registry we don't need to rebuild everything.\n            # but because these are mutable types we don't want to create\n            # conflicts so everything needs to be copied.\n            self._equivalencies = init._equivalencies.copy()\n            self._aliases = init._aliases.copy()\n            self._all_units = init._all_units.copy()\n            self._registry = init._registry.copy()\n            self._non_prefix_units = init._non_prefix_units.copy()\n            # The physical type is a dictionary containing sets as values.\n            # All of these must be copied otherwise we could alter the old\n            # registry.\n            self._by_physical_type = {k: v.copy() for k, v in\n                                      init._by_physical_type.items()}\n\n        else:\n            self._reset_units()\n            self._reset_equivalencies()\n            self._reset_aliases()\n            self.add_enabled_units(init)\n            self.add_enabled_equivalencies(equivalencies)\n            self.add_enabled_aliases(aliases)\n\n    def _reset_units(self):\n        self._all_units = set()\n        self._non_prefix_units = set()\n        self._registry = {}\n        self._by_physical_type = {}\n\n    def _reset_equivalencies(self):\n        self._equivalencies = set()\n\n    def _reset_aliases(self):\n        self._aliases = {}\n\n    @property\n    def registry(self):\n        return self._registry\n\n    @property\n    def all_units(self):\n        return self._all_units\n\n    @property\n    def non_prefix_units(self):\n        return self._non_prefix_units\n\n    def set_enabled_units(self, units):\n        \"\"\"\n        Sets the units enabled in the unit registry.\n\n        These units are searched when using\n        `UnitBase.find_equivalent_units`, for example.\n\n        Parameters\n        ----------\n        units : list of sequence, dict, or module\n            This is a list of things in which units may be found\n            (sequences, dicts or modules), or units themselves.  The\n            entire set will be \"enabled\" for searching through by\n            methods like `UnitBase.find_equivalent_units` and\n            `UnitBase.compose`.\n        \"\"\"\n        self._reset_units()\n        return self.add_enabled_units(units)\n\n    def add_enabled_units(self, units):\n        \"\"\"\n        Adds to the set of units enabled in the unit registry.\n\n        These units are searched when using\n        `UnitBase.find_equivalent_units`, for example.\n\n        Parameters\n        ----------\n        units : list of sequence, dict, or module\n            This is a list of things in which units may be found\n            (sequences, dicts or modules), or units themselves.  The\n            entire set will be added to the \"enabled\" set for\n            searching through by methods like\n            `UnitBase.find_equivalent_units` and `UnitBase.compose`.\n        \"\"\"\n        units = _flatten_units_collection(units)\n\n        for unit in units:\n            # Loop through all of the names first, to ensure all of them\n            # are new, then add them all as a single \"transaction\" below.\n            for st in unit._names:\n                if (st in self._registry and unit != self._registry[st]):\n                    raise ValueError(\n                        \"Object with name {!r} already exists in namespace. \"\n                        \"Filter the set of units to avoid name clashes before \"\n                        \"enabling them.\".format(st))\n\n            for st in unit._names:\n                self._registry[st] = unit\n\n            self._all_units.add(unit)\n            if not isinstance(unit, PrefixUnit):\n                self._non_prefix_units.add(unit)\n\n            hash = unit._get_physical_type_id()\n            self._by_physical_type.setdefault(hash, set()).add(unit)\n\n    def get_units_with_physical_type(self, unit):\n        \"\"\"\n        Get all units in the registry with the same physical type as\n        the given unit.\n\n        Parameters\n        ----------\n        unit : UnitBase instance\n        \"\"\"\n        return self._by_physical_type.get(unit._get_physical_type_id(), set())\n\n    @property\n    def equivalencies(self):\n        return list(self._equivalencies)\n\n    def set_enabled_equivalencies(self, equivalencies):\n        \"\"\"\n        Sets the equivalencies enabled in the unit registry.\n\n        These equivalencies are used if no explicit equivalencies are given,\n        both in unit conversion and in finding equivalent units.\n\n        This is meant in particular for allowing angles to be dimensionless.\n        Use with care.\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            List of equivalent pairs, e.g., as returned by\n            `~astropy.units.equivalencies.dimensionless_angles`.\n        \"\"\"\n        self._reset_equivalencies()\n        return self.add_enabled_equivalencies(equivalencies)\n\n    def add_enabled_equivalencies(self, equivalencies):\n        \"\"\"\n        Adds to the set of equivalencies enabled in the unit registry.\n\n        These equivalencies are used if no explicit equivalencies are given,\n        both in unit conversion and in finding equivalent units.\n\n        This is meant in particular for allowing angles to be dimensionless.\n        Use with care.\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            List of equivalent pairs, e.g., as returned by\n            `~astropy.units.equivalencies.dimensionless_angles`.\n        \"\"\"\n        # pre-normalize list to help catch mistakes\n        equivalencies = _normalize_equivalencies(equivalencies)\n        self._equivalencies |= set(equivalencies)\n\n    @property\n    def aliases(self):\n        return self._aliases\n\n    def set_enabled_aliases(self, aliases):\n        \"\"\"\n        Set aliases for units.\n\n        Parameters\n        ----------\n        aliases : dict of str, Unit\n            The aliases to set. The keys must be the string aliases, and values\n            must be the `astropy.units.Unit` that the alias will be mapped to.\n\n        Raises\n        ------\n        ValueError\n            If the alias already defines a different unit.\n\n        \"\"\"\n        self._reset_aliases()\n        self.add_enabled_aliases(aliases)\n\n    def add_enabled_aliases(self, aliases):\n        \"\"\"\n        Add aliases for units.\n\n        Parameters\n        ----------\n        aliases : dict of str, Unit\n            The aliases to add. The keys must be the string aliases, and values\n            must be the `astropy.units.Unit` that the alias will be mapped to.\n\n        Raises\n        ------\n        ValueError\n            If the alias already defines a different unit.\n\n        \"\"\"\n        for alias, unit in aliases.items():\n            if alias in self._registry and unit != self._registry[alias]:\n                raise ValueError(\n                    f\"{alias} already means {self._registry[alias]}, so \"\n                    f\"cannot be used as an alias for {unit}.\")\n            if alias in self._aliases and unit != self._aliases[alias]:\n                raise ValueError(\n                    f\"{alias} already is an alias for {self._aliases[alias]}, so \"\n                    f\"cannot be used as an alias for {unit}.\")\n\n        for alias, unit in aliases.items():\n            if alias not in self._registry and alias not in self._aliases:\n                self._aliases[alias] = unit\n\n\nclass _UnitContext:\n    def __init__(self, init=[], equivalencies=[]):\n        _unit_registries.append(\n            _UnitRegistry(init=init, equivalencies=equivalencies))\n\n    def __enter__(self):\n        pass\n\n    def __exit__(self, type, value, tb):\n        _unit_registries.pop()\n\n\n_unit_registries = [_UnitRegistry()]\n\n\ndef get_current_unit_registry():\n    return _unit_registries[-1]\n\n\ndef set_enabled_units(units):\n    \"\"\"\n    Sets the units enabled in the unit registry.\n\n    These units are searched when using\n    `UnitBase.find_equivalent_units`, for example.\n\n    This may be used either permanently, or as a context manager using\n    the ``with`` statement (see example below).\n\n    Parameters\n    ----------\n    units : list of sequence, dict, or module\n        This is a list of things in which units may be found\n        (sequences, dicts or modules), or units themselves.  The\n        entire set will be \"enabled\" for searching through by methods\n        like `UnitBase.find_equivalent_units` and `UnitBase.compose`.\n\n    Examples\n    --------\n\n    >>> from astropy import units as u\n    >>> with u.set_enabled_units([u.pc]):\n    ...     u.m.find_equivalent_units()\n    ...\n      Primary name | Unit definition | Aliases\n    [\n      pc           | 3.08568e+16 m   | parsec  ,\n    ]\n    >>> u.m.find_equivalent_units()\n      Primary name | Unit definition | Aliases\n    [\n      AU           | 1.49598e+11 m   | au, astronomical_unit            ,\n      Angstrom     | 1e-10 m         | AA, angstrom                     ,\n      cm           | 0.01 m          | centimeter                       ,\n      earthRad     | 6.3781e+06 m    | R_earth, Rearth                  ,\n      jupiterRad   | 7.1492e+07 m    | R_jup, Rjup, R_jupiter, Rjupiter ,\n      lsec         | 2.99792e+08 m   | lightsecond                      ,\n      lyr          | 9.46073e+15 m   | lightyear                        ,\n      m            | irreducible     | meter                            ,\n      micron       | 1e-06 m         |                                  ,\n      pc           | 3.08568e+16 m   | parsec                           ,\n      solRad       | 6.957e+08 m     | R_sun, Rsun                      ,\n    ]\n    \"\"\"\n    # get a context with a new registry, using equivalencies of the current one\n    context = _UnitContext(\n        equivalencies=get_current_unit_registry().equivalencies)\n    # in this new current registry, enable the units requested\n    get_current_unit_registry().set_enabled_units(units)\n    return context\n\n\ndef add_enabled_units(units):\n    \"\"\"\n    Adds to the set of units enabled in the unit registry.\n\n    These units are searched when using\n    `UnitBase.find_equivalent_units`, for example.\n\n    This may be used either permanently, or as a context manager using\n    the ``with`` statement (see example below).\n\n    Parameters\n    ----------\n    units : list of sequence, dict, or module\n        This is a list of things in which units may be found\n        (sequences, dicts or modules), or units themselves.  The\n        entire set will be added to the \"enabled\" set for searching\n        through by methods like `UnitBase.find_equivalent_units` and\n        `UnitBase.compose`.\n\n    Examples\n    --------\n\n    >>> from astropy import units as u\n    >>> from astropy.units import imperial\n    >>> with u.add_enabled_units(imperial):\n    ...     u.m.find_equivalent_units()\n    ...\n      Primary name | Unit definition | Aliases\n    [\n      AU           | 1.49598e+11 m   | au, astronomical_unit            ,\n      Angstrom     | 1e-10 m         | AA, angstrom                     ,\n      cm           | 0.01 m          | centimeter                       ,\n      earthRad     | 6.3781e+06 m    | R_earth, Rearth                  ,\n      ft           | 0.3048 m        | foot                             ,\n      fur          | 201.168 m       | furlong                          ,\n      inch         | 0.0254 m        |                                  ,\n      jupiterRad   | 7.1492e+07 m    | R_jup, Rjup, R_jupiter, Rjupiter ,\n      lsec         | 2.99792e+08 m   | lightsecond                      ,\n      lyr          | 9.46073e+15 m   | lightyear                        ,\n      m            | irreducible     | meter                            ,\n      mi           | 1609.34 m       | mile                             ,\n      micron       | 1e-06 m         |                                  ,\n      mil          | 2.54e-05 m      | thou                             ,\n      nmi          | 1852 m          | nauticalmile, NM                 ,\n      pc           | 3.08568e+16 m   | parsec                           ,\n      solRad       | 6.957e+08 m     | R_sun, Rsun                      ,\n      yd           | 0.9144 m        | yard                             ,\n    ]\n    \"\"\"\n    # get a context with a new registry, which is a copy of the current one\n    context = _UnitContext(get_current_unit_registry())\n    # in this new current registry, enable the further units requested\n    get_current_unit_registry().add_enabled_units(units)\n    return context\n\n\ndef set_enabled_equivalencies(equivalencies):\n    \"\"\"\n    Sets the equivalencies enabled in the unit registry.\n\n    These equivalencies are used if no explicit equivalencies are given,\n    both in unit conversion and in finding equivalent units.\n\n    This is meant in particular for allowing angles to be dimensionless.\n    Use with care.\n\n    Parameters\n    ----------\n    equivalencies : list of tuple\n        list of equivalent pairs, e.g., as returned by\n        `~astropy.units.equivalencies.dimensionless_angles`.\n\n    Examples\n    --------\n    Exponentiation normally requires dimensionless quantities.  To avoid\n    problems with complex phases::\n\n        >>> from astropy import units as u\n        >>> with u.set_enabled_equivalencies(u.dimensionless_angles()):\n        ...     phase = 0.5 * u.cycle\n        ...     np.exp(1j*phase)  # doctest: +FLOAT_CMP\n        <Quantity -1.+1.2246468e-16j>\n    \"\"\"\n    # get a context with a new registry, using all units of the current one\n    context = _UnitContext(get_current_unit_registry())\n    # in this new current registry, enable the equivalencies requested\n    get_current_unit_registry().set_enabled_equivalencies(equivalencies)\n    return context\n\n\ndef add_enabled_equivalencies(equivalencies):\n    \"\"\"\n    Adds to the equivalencies enabled in the unit registry.\n\n    These equivalencies are used if no explicit equivalencies are given,\n    both in unit conversion and in finding equivalent units.\n\n    This is meant in particular for allowing angles to be dimensionless.\n    Since no equivalencies are enabled by default, generally it is recommended\n    to use `set_enabled_equivalencies`.\n\n    Parameters\n    ----------\n    equivalencies : list of tuple\n        list of equivalent pairs, e.g., as returned by\n        `~astropy.units.equivalencies.dimensionless_angles`.\n    \"\"\"\n    # get a context with a new registry, which is a copy of the current one\n    context = _UnitContext(get_current_unit_registry())\n    # in this new current registry, enable the further equivalencies requested\n    get_current_unit_registry().add_enabled_equivalencies(equivalencies)\n    return context\n\n\ndef set_enabled_aliases(aliases):\n    \"\"\"\n    Set aliases for units.\n\n    This is useful for handling alternate spellings for units, or\n    misspelled units in files one is trying to read.\n\n    Parameters\n    ----------\n    aliases : dict of str, Unit\n        The aliases to set. The keys must be the string aliases, and values\n        must be the `astropy.units.Unit` that the alias will be mapped to.\n\n    Raises\n    ------\n    ValueError\n        If the alias already defines a different unit.\n\n    Examples\n    --------\n    To temporarily allow for a misspelled 'Angstroem' unit::\n\n        >>> from astropy import units as u\n        >>> with u.set_enabled_aliases({'Angstroem': u.Angstrom}):\n        ...     print(u.Unit(\"Angstroem\", parse_strict=\"raise\") == u.Angstrom)\n        True\n\n    \"\"\"\n    # get a context with a new registry, which is a copy of the current one\n    context = _UnitContext(get_current_unit_registry())\n    # in this new current registry, enable the further equivalencies requested\n    get_current_unit_registry().set_enabled_aliases(aliases)\n    return context\n\n\ndef add_enabled_aliases(aliases):\n    \"\"\"\n    Add aliases for units.\n\n    This is useful for handling alternate spellings for units, or\n    misspelled units in files one is trying to read.\n\n    Since no aliases are enabled by default, generally it is recommended\n    to use `set_enabled_aliases`.\n\n    Parameters\n    ----------\n    aliases : dict of str, Unit\n        The aliases to add. The keys must be the string aliases, and values\n        must be the `astropy.units.Unit` that the alias will be mapped to.\n\n    Raises\n    ------\n    ValueError\n        If the alias already defines a different unit.\n\n    Examples\n    --------\n    To temporarily allow for a misspelled 'Angstroem' unit::\n\n        >>> from astropy import units as u\n        >>> with u.add_enabled_aliases({'Angstroem': u.Angstrom}):\n        ...     print(u.Unit(\"Angstroem\", parse_strict=\"raise\") == u.Angstrom)\n        True\n\n    \"\"\"\n    # get a context with a new registry, which is a copy of the current one\n    context = _UnitContext(get_current_unit_registry())\n    # in this new current registry, enable the further equivalencies requested\n    get_current_unit_registry().add_enabled_aliases(aliases)\n    return context\n\n\nclass UnitsError(Exception):\n    \"\"\"\n    The base class for unit-specific exceptions.\n    \"\"\"\n\n\nclass UnitScaleError(UnitsError, ValueError):\n    \"\"\"\n    Used to catch the errors involving scaled units,\n    which are not recognized by FITS format.\n    \"\"\"\n    pass\n\n\nclass UnitConversionError(UnitsError, ValueError):\n    \"\"\"\n    Used specifically for errors related to converting between units or\n    interpreting units in terms of other units.\n    \"\"\"\n\n\nclass UnitTypeError(UnitsError, TypeError):\n    \"\"\"\n    Used specifically for errors in setting to units not allowed by a class.\n\n    E.g., would be raised if the unit of an `~astropy.coordinates.Angle`\n    instances were set to a non-angular unit.\n    \"\"\"\n\n\nclass UnitsWarning(AstropyWarning):\n    \"\"\"\n    The base class for unit-specific warnings.\n    \"\"\"\n\n\nclass UnitBase:\n    \"\"\"\n    Abstract base class for units.\n\n    Most of the arithmetic operations on units are defined in this\n    base class.\n\n    Should not be instantiated by users directly.\n    \"\"\"\n    # Make sure that __rmul__ of units gets called over the __mul__ of Numpy\n    # arrays to avoid element-wise multiplication.\n    __array_priority__ = 1000\n\n    _hash = None\n\n    def __deepcopy__(self, memo):\n        # This may look odd, but the units conversion will be very\n        # broken after deep-copying if we don't guarantee that a given\n        # physical unit corresponds to only one instance\n        return self\n\n    def _repr_latex_(self):\n        \"\"\"\n        Generate latex representation of unit name.  This is used by\n        the IPython notebook to print a unit with a nice layout.\n\n        Returns\n        -------\n        Latex string\n        \"\"\"\n        return unit_format.Latex.to_string(self)\n\n    def __bytes__(self):\n        \"\"\"Return string representation for unit\"\"\"\n        return unit_format.Generic.to_string(self).encode('unicode_escape')\n\n    def __str__(self):\n        \"\"\"Return string representation for unit\"\"\"\n        return unit_format.Generic.to_string(self)\n\n    def __repr__(self):\n        string = unit_format.Generic.to_string(self)\n\n        return f'Unit(\"{string}\")'\n\n    def _get_physical_type_id(self):\n        \"\"\"\n        Returns an identifier that uniquely identifies the physical\n        type of this unit.  It is comprised of the bases and powers of\n        this unit, without the scale.  Since it is hashable, it is\n        useful as a dictionary key.\n        \"\"\"\n        unit = self.decompose()\n        r = zip([x.name for x in unit.bases], unit.powers)\n        # bases and powers are already sorted in a unique way\n        # r.sort()\n        r = tuple(r)\n        return r\n\n    @property\n    def names(self):\n        \"\"\"\n        Returns all of the names associated with this unit.\n        \"\"\"\n        raise AttributeError(\n            \"Can not get names from unnamed units. \"\n            \"Perhaps you meant to_string()?\")\n\n    @property\n    def name(self):\n        \"\"\"\n        Returns the canonical (short) name associated with this unit.\n        \"\"\"\n        raise AttributeError(\n            \"Can not get names from unnamed units. \"\n            \"Perhaps you meant to_string()?\")\n\n    @property\n    def aliases(self):\n        \"\"\"\n        Returns the alias (long) names for this unit.\n        \"\"\"\n        raise AttributeError(\n            \"Can not get aliases from unnamed units. \"\n            \"Perhaps you meant to_string()?\")\n\n    @property\n    def scale(self):\n        \"\"\"\n        Return the scale of the unit.\n        \"\"\"\n        return 1.0\n\n    @property\n    def bases(self):\n        \"\"\"\n        Return the bases of the unit.\n        \"\"\"\n        return [self]\n\n    @property\n    def powers(self):\n        \"\"\"\n        Return the powers of the unit.\n        \"\"\"\n        return [1]\n\n    def to_string(self, format=unit_format.Generic):\n        \"\"\"\n        Output the unit in the given format as a string.\n\n        Parameters\n        ----------\n        format : `astropy.units.format.Base` instance or str\n            The name of a format or a formatter object.  If not\n            provided, defaults to the generic format.\n        \"\"\"\n\n        f = unit_format.get_format(format)\n        return f.to_string(self)\n\n    def __format__(self, format_spec):\n        \"\"\"Try to format units using a formatter.\"\"\"\n        try:\n            return self.to_string(format=format_spec)\n        except ValueError:\n            return format(str(self), format_spec)\n\n    @staticmethod\n    def _normalize_equivalencies(equivalencies):\n        \"\"\"\n        Normalizes equivalencies, ensuring each is a 4-tuple of the form::\n\n        (from_unit, to_unit, forward_func, backward_func)\n\n        Parameters\n        ----------\n        equivalencies : list of equivalency pairs, or None\n\n        Returns\n        -------\n        A normalized list, including possible global defaults set by, e.g.,\n        `set_enabled_equivalencies`, except when `equivalencies`=`None`,\n        in which case the returned list is always empty.\n\n        Raises\n        ------\n        ValueError if an equivalency cannot be interpreted\n        \"\"\"\n        normalized = _normalize_equivalencies(equivalencies)\n        if equivalencies is not None:\n            normalized += get_current_unit_registry().equivalencies\n\n        return normalized\n\n    def __pow__(self, p):\n        p = validate_power(p)\n        return CompositeUnit(1, [self], [p], _error_check=False)\n\n    def __truediv__(self, m):\n        if isinstance(m, (bytes, str)):\n            m = Unit(m)\n\n        if isinstance(m, UnitBase):\n            if m.is_unity():\n                return self\n            return CompositeUnit(1, [self, m], [1, -1], _error_check=False)\n\n        try:\n            # Cannot handle this as Unit, re-try as Quantity\n            from .quantity import Quantity\n            return Quantity(1, self) / m\n        except TypeError:\n            return NotImplemented\n\n    def __rtruediv__(self, m):\n        if isinstance(m, (bytes, str)):\n            return Unit(m) / self\n\n        try:\n            # Cannot handle this as Unit.  Here, m cannot be a Quantity,\n            # so we make it into one, fasttracking when it does not have a\n            # unit, for the common case of <array> / <unit>.\n            from .quantity import Quantity\n            if hasattr(m, 'unit'):\n                result = Quantity(m)\n                result /= self\n                return result\n            else:\n                return Quantity(m, self**(-1))\n        except TypeError:\n            return NotImplemented\n\n    def __mul__(self, m):\n        if isinstance(m, (bytes, str)):\n            m = Unit(m)\n\n        if isinstance(m, UnitBase):\n            if m.is_unity():\n                return self\n            elif self.is_unity():\n                return m\n            return CompositeUnit(1, [self, m], [1, 1], _error_check=False)\n\n        # Cannot handle this as Unit, re-try as Quantity.\n        try:\n            from .quantity import Quantity\n            return Quantity(1, self) * m\n        except TypeError:\n            return NotImplemented\n\n    def __rmul__(self, m):\n        if isinstance(m, (bytes, str)):\n            return Unit(m) * self\n\n        # Cannot handle this as Unit.  Here, m cannot be a Quantity,\n        # so we make it into one, fasttracking when it does not have a unit\n        # for the common case of <array> * <unit>.\n        try:\n            from .quantity import Quantity\n            if hasattr(m, 'unit'):\n                result = Quantity(m)\n                result *= self\n                return result\n            else:\n                return Quantity(m, self)\n        except TypeError:\n            return NotImplemented\n\n    def __rlshift__(self, m):\n        try:\n            from .quantity import Quantity\n            return Quantity(m, self, copy=False, subok=True)\n        except Exception:\n            return NotImplemented\n\n    def __rrshift__(self, m):\n        warnings.warn(\">> is not implemented. Did you mean to convert \"\n                      \"to a Quantity with unit {} using '<<'?\".format(self),\n                      AstropyWarning)\n        return NotImplemented\n\n    def __hash__(self):\n        if self._hash is None:\n            parts = ([str(self.scale)] +\n                     [x.name for x in self.bases] +\n                     [str(x) for x in self.powers])\n            self._hash = hash(tuple(parts))\n        return self._hash\n\n    def __getstate__(self):\n        # If we get pickled, we should *not* store the memoized hash since\n        # hashes of strings vary between sessions.\n        state = self.__dict__.copy()\n        state.pop('_hash', None)\n        return state\n\n    def __eq__(self, other):\n        if self is other:\n            return True\n\n        try:\n            other = Unit(other, parse_strict='silent')\n        except (ValueError, UnitsError, TypeError):\n            return NotImplemented\n\n        # Other is unit-like, but the test below requires it is a UnitBase\n        # instance; if it is not, give up (so that other can try).\n        if not isinstance(other, UnitBase):\n            return NotImplemented\n\n        try:\n            return is_effectively_unity(self._to(other))\n        except UnitsError:\n            return False\n\n    def __ne__(self, other):\n        return not (self == other)\n\n    def __le__(self, other):\n        scale = self._to(Unit(other))\n        return scale <= 1. or is_effectively_unity(scale)\n\n    def __ge__(self, other):\n        scale = self._to(Unit(other))\n        return scale >= 1. or is_effectively_unity(scale)\n\n    def __lt__(self, other):\n        return not (self >= other)\n\n    def __gt__(self, other):\n        return not (self <= other)\n\n    def __neg__(self):\n        return self * -1.\n\n    def is_equivalent(self, other, equivalencies=[]):\n        \"\"\"\n        Returns `True` if this unit is equivalent to ``other``.\n\n        Parameters\n        ----------\n        other : `~astropy.units.Unit`, str, or tuple\n            The unit to convert to. If a tuple of units is specified, this\n            method returns true if the unit matches any of those in the tuple.\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            This list is in addition to possible global defaults set by, e.g.,\n            `set_enabled_equivalencies`.\n            Use `None` to turn off all equivalencies.\n\n        Returns\n        -------\n        bool\n        \"\"\"\n        equivalencies = self._normalize_equivalencies(equivalencies)\n\n        if isinstance(other, tuple):\n            return any(self.is_equivalent(u, equivalencies=equivalencies)\n                       for u in other)\n\n        other = Unit(other, parse_strict='silent')\n\n        return self._is_equivalent(other, equivalencies)\n\n    def _is_equivalent(self, other, equivalencies=[]):\n        \"\"\"Returns `True` if this unit is equivalent to `other`.\n        See `is_equivalent`, except that a proper Unit object should be\n        given (i.e., no string) and that the equivalency list should be\n        normalized using `_normalize_equivalencies`.\n        \"\"\"\n        if isinstance(other, UnrecognizedUnit):\n            return False\n\n        if (self._get_physical_type_id() ==\n                other._get_physical_type_id()):\n            return True\n        elif len(equivalencies):\n            unit = self.decompose()\n            other = other.decompose()\n            for a, b, forward, backward in equivalencies:\n                if b is None:\n                    # after canceling, is what's left convertible\n                    # to dimensionless (according to the equivalency)?\n                    try:\n                        (other/unit).decompose([a])\n                        return True\n                    except Exception:\n                        pass\n                else:\n                    if(a._is_equivalent(unit) and b._is_equivalent(other) or\n                       b._is_equivalent(unit) and a._is_equivalent(other)):\n                        return True\n\n        return False\n\n    def _apply_equivalencies(self, unit, other, equivalencies):\n        \"\"\"\n        Internal function (used from `_get_converter`) to apply\n        equivalence pairs.\n        \"\"\"\n        def make_converter(scale1, func, scale2):\n            def convert(v):\n                return func(_condition_arg(v) / scale1) * scale2\n            return convert\n\n        for funit, tunit, a, b in equivalencies:\n            if tunit is None:\n                try:\n                    ratio_in_funit = (other.decompose() /\n                                      unit.decompose()).decompose([funit])\n                    return make_converter(ratio_in_funit.scale, a, 1.)\n                except UnitsError:\n                    pass\n            else:\n                try:\n                    scale1 = funit._to(unit)\n                    scale2 = tunit._to(other)\n                    return make_converter(scale1, a, scale2)\n                except UnitsError:\n                    pass\n                try:\n                    scale1 = tunit._to(unit)\n                    scale2 = funit._to(other)\n                    return make_converter(scale1, b, scale2)\n                except UnitsError:\n                    pass\n\n        def get_err_str(unit):\n            unit_str = unit.to_string('unscaled')\n            physical_type = unit.physical_type\n            if physical_type != 'unknown':\n                unit_str = f\"'{unit_str}' ({physical_type})\"\n            else:\n                unit_str = f\"'{unit_str}'\"\n            return unit_str\n\n        unit_str = get_err_str(unit)\n        other_str = get_err_str(other)\n\n        raise UnitConversionError(\n            f\"{unit_str} and {other_str} are not convertible\")\n\n    def _get_converter(self, other, equivalencies=[]):\n        \"\"\"Get a converter for values in ``self`` to ``other``.\n\n        If no conversion is necessary, returns ``unit_scale_converter``\n        (which is used as a check in quantity helpers).\n\n        \"\"\"\n\n        # First see if it is just a scaling.\n        try:\n            scale = self._to(other)\n        except UnitsError:\n            pass\n        else:\n            if scale == 1.:\n                return unit_scale_converter\n            else:\n                return lambda val: scale * _condition_arg(val)\n\n        # if that doesn't work, maybe we can do it with equivalencies?\n        try:\n            return self._apply_equivalencies(\n                self, other, self._normalize_equivalencies(equivalencies))\n        except UnitsError as exc:\n            # Last hope: maybe other knows how to do it?\n            # We assume the equivalencies have the unit itself as first item.\n            # TODO: maybe better for other to have a `_back_converter` method?\n            if hasattr(other, 'equivalencies'):\n                for funit, tunit, a, b in other.equivalencies:\n                    if other is funit:\n                        try:\n                            return lambda v: b(self._get_converter(\n                                tunit, equivalencies=equivalencies)(v))\n                        except Exception:\n                            pass\n\n            raise exc\n\n    def _to(self, other):\n        \"\"\"\n        Returns the scale to the specified unit.\n\n        See `to`, except that a Unit object should be given (i.e., no\n        string), and that all defaults are used, i.e., no\n        equivalencies and value=1.\n        \"\"\"\n        # There are many cases where we just want to ensure a Quantity is\n        # of a particular unit, without checking whether it's already in\n        # a particular unit.  If we're being asked to convert from a unit\n        # to itself, we can short-circuit all of this.\n        if self is other:\n            return 1.0\n\n        # Don't presume decomposition is possible; e.g.,\n        # conversion to function units is through equivalencies.\n        if isinstance(other, UnitBase):\n            self_decomposed = self.decompose()\n            other_decomposed = other.decompose()\n\n            # Check quickly whether equivalent.  This is faster than\n            # `is_equivalent`, because it doesn't generate the entire\n            # physical type list of both units.  In other words it \"fails\n            # fast\".\n            if(self_decomposed.powers == other_decomposed.powers and\n               all(self_base is other_base for (self_base, other_base)\n                   in zip(self_decomposed.bases, other_decomposed.bases))):\n                return self_decomposed.scale / other_decomposed.scale\n\n        raise UnitConversionError(\n            f\"'{self!r}' is not a scaled version of '{other!r}'\")\n\n    def to(self, other, value=UNITY, equivalencies=[]):\n        \"\"\"\n        Return the converted values in the specified unit.\n\n        Parameters\n        ----------\n        other : unit-like\n            The unit to convert to.\n\n        value : int, float, or scalar array-like, optional\n            Value(s) in the current unit to be converted to the\n            specified unit.  If not provided, defaults to 1.0\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            This list is in addition to possible global defaults set by, e.g.,\n            `set_enabled_equivalencies`.\n            Use `None` to turn off all equivalencies.\n\n        Returns\n        -------\n        values : scalar or array\n            Converted value(s). Input value sequences are returned as\n            numpy arrays.\n\n        Raises\n        ------\n        UnitsError\n            If units are inconsistent\n        \"\"\"\n        if other is self and value is UNITY:\n            return UNITY\n        else:\n            return self._get_converter(Unit(other),\n                                       equivalencies=equivalencies)(value)\n\n    def in_units(self, other, value=1.0, equivalencies=[]):\n        \"\"\"\n        Alias for `to` for backward compatibility with pynbody.\n        \"\"\"\n        return self.to(\n            other, value=value, equivalencies=equivalencies)\n\n    def decompose(self, bases=set()):\n        \"\"\"\n        Return a unit object composed of only irreducible units.\n\n        Parameters\n        ----------\n        bases : sequence of UnitBase, optional\n            The bases to decompose into.  When not provided,\n            decomposes down to any irreducible units.  When provided,\n            the decomposed result will only contain the given units.\n            This will raises a `UnitsError` if it's not possible\n            to do so.\n\n        Returns\n        -------\n        unit : `~astropy.units.CompositeUnit`\n            New object containing only irreducible unit objects.\n        \"\"\"\n        raise NotImplementedError()\n\n    def _compose(self, equivalencies=[], namespace=[], max_depth=2, depth=0,\n                 cached_results=None):\n        def is_final_result(unit):\n            # Returns True if this result contains only the expected\n            # units\n            for base in unit.bases:\n                if base not in namespace:\n                    return False\n            return True\n\n        unit = self.decompose()\n        key = hash(unit)\n\n        cached = cached_results.get(key)\n        if cached is not None:\n            if isinstance(cached, Exception):\n                raise cached\n            return cached\n\n        # Prevent too many levels of recursion\n        # And special case for dimensionless unit\n        if depth >= max_depth:\n            cached_results[key] = [unit]\n            return [unit]\n\n        # Make a list including all of the equivalent units\n        units = [unit]\n        for funit, tunit, a, b in equivalencies:\n            if tunit is not None:\n                if self._is_equivalent(funit):\n                    scale = funit.decompose().scale / unit.scale\n                    units.append(Unit(a(1.0 / scale) * tunit).decompose())\n                elif self._is_equivalent(tunit):\n                    scale = tunit.decompose().scale / unit.scale\n                    units.append(Unit(b(1.0 / scale) * funit).decompose())\n            else:\n                if self._is_equivalent(funit):\n                    units.append(Unit(unit.scale))\n\n        # Store partial results\n        partial_results = []\n        # Store final results that reduce to a single unit or pair of\n        # units\n        if len(unit.bases) == 0:\n            final_results = [set([unit]), set()]\n        else:\n            final_results = [set(), set()]\n\n        for tunit in namespace:\n            tunit_decomposed = tunit.decompose()\n            for u in units:\n                # If the unit is a base unit, look for an exact match\n                # to one of the bases of the target unit.  If found,\n                # factor by the same power as the target unit's base.\n                # This allows us to factor out fractional powers\n                # without needing to do an exhaustive search.\n                if len(tunit_decomposed.bases) == 1:\n                    for base, power in zip(u.bases, u.powers):\n                        if tunit_decomposed._is_equivalent(base):\n                            tunit = tunit ** power\n                            tunit_decomposed = tunit_decomposed ** power\n                            break\n\n                composed = (u / tunit_decomposed).decompose()\n                factored = composed * tunit\n                len_bases = len(composed.bases)\n                if is_final_result(factored) and len_bases <= 1:\n                    final_results[len_bases].add(factored)\n                else:\n                    partial_results.append(\n                        (len_bases, composed, tunit))\n\n        # Do we have any minimal results?\n        for final_result in final_results:\n            if len(final_result):\n                results = final_results[0].union(final_results[1])\n                cached_results[key] = results\n                return results\n\n        partial_results.sort(key=operator.itemgetter(0))\n\n        # ...we have to recurse and try to further compose\n        results = []\n        for len_bases, composed, tunit in partial_results:\n            try:\n                composed_list = composed._compose(\n                    equivalencies=equivalencies,\n                    namespace=namespace,\n                    max_depth=max_depth, depth=depth + 1,\n                    cached_results=cached_results)\n            except UnitsError:\n                composed_list = []\n            for subcomposed in composed_list:\n                results.append(\n                    (len(subcomposed.bases), subcomposed, tunit))\n\n        if len(results):\n            results.sort(key=operator.itemgetter(0))\n\n            min_length = results[0][0]\n            subresults = set()\n            for len_bases, composed, tunit in results:\n                if len_bases > min_length:\n                    break\n                else:\n                    factored = composed * tunit\n                    if is_final_result(factored):\n                        subresults.add(factored)\n\n            if len(subresults):\n                cached_results[key] = subresults\n                return subresults\n\n        if not is_final_result(self):\n            result = UnitsError(\n                f\"Cannot represent unit {self} in terms of the given units\")\n            cached_results[key] = result\n            raise result\n\n        cached_results[key] = [self]\n        return [self]\n\n    def compose(self, equivalencies=[], units=None, max_depth=2,\n                include_prefix_units=None):\n        \"\"\"\n        Return the simplest possible composite unit(s) that represent\n        the given unit.  Since there may be multiple equally simple\n        compositions of the unit, a list of units is always returned.\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            A list of equivalence pairs to also list.  See\n            :ref:`astropy:unit_equivalencies`.\n            This list is in addition to possible global defaults set by, e.g.,\n            `set_enabled_equivalencies`.\n            Use `None` to turn off all equivalencies.\n\n        units : set of `~astropy.units.Unit`, optional\n            If not provided, any known units may be used to compose\n            into.  Otherwise, ``units`` is a dict, module or sequence\n            containing the units to compose into.\n\n        max_depth : int, optional\n            The maximum recursion depth to use when composing into\n            composite units.\n\n        include_prefix_units : bool, optional\n            When `True`, include prefixed units in the result.\n            Default is `True` if a sequence is passed in to ``units``,\n            `False` otherwise.\n\n        Returns\n        -------\n        units : list of `CompositeUnit`\n            A list of candidate compositions.  These will all be\n            equally simple, but it may not be possible to\n            automatically determine which of the candidates are\n            better.\n        \"\"\"\n        # if units parameter is specified and is a sequence (list|tuple),\n        # include_prefix_units is turned on by default.  Ex: units=[u.kpc]\n        if include_prefix_units is None:\n            include_prefix_units = isinstance(units, (list, tuple))\n\n        # Pre-normalize the equivalencies list\n        equivalencies = self._normalize_equivalencies(equivalencies)\n\n        # The namespace of units to compose into should be filtered to\n        # only include units with bases in common with self, otherwise\n        # they can't possibly provide useful results.  Having too many\n        # destination units greatly increases the search space.\n\n        def has_bases_in_common(a, b):\n            if len(a.bases) == 0 and len(b.bases) == 0:\n                return True\n            for ab in a.bases:\n                for bb in b.bases:\n                    if ab == bb:\n                        return True\n            return False\n\n        def has_bases_in_common_with_equiv(unit, other):\n            if has_bases_in_common(unit, other):\n                return True\n            for funit, tunit, a, b in equivalencies:\n                if tunit is not None:\n                    if unit._is_equivalent(funit):\n                        if has_bases_in_common(tunit.decompose(), other):\n                            return True\n                    elif unit._is_equivalent(tunit):\n                        if has_bases_in_common(funit.decompose(), other):\n                            return True\n                else:\n                    if unit._is_equivalent(funit):\n                        if has_bases_in_common(dimensionless_unscaled, other):\n                            return True\n            return False\n\n        def filter_units(units):\n            filtered_namespace = set()\n            for tunit in units:\n                if (isinstance(tunit, UnitBase) and\n                    (include_prefix_units or\n                     not isinstance(tunit, PrefixUnit)) and\n                    has_bases_in_common_with_equiv(\n                        decomposed, tunit.decompose())):\n                    filtered_namespace.add(tunit)\n            return filtered_namespace\n\n        decomposed = self.decompose()\n\n        if units is None:\n            units = filter_units(self._get_units_with_same_physical_type(\n                equivalencies=equivalencies))\n            if len(units) == 0:\n                units = get_current_unit_registry().non_prefix_units\n        elif isinstance(units, dict):\n            units = set(filter_units(units.values()))\n        elif inspect.ismodule(units):\n            units = filter_units(vars(units).values())\n        else:\n            units = filter_units(_flatten_units_collection(units))\n\n        def sort_results(results):\n            if not len(results):\n                return []\n\n            # Sort the results so the simplest ones appear first.\n            # Simplest is defined as \"the minimum sum of absolute\n            # powers\" (i.e. the fewest bases), and preference should\n            # be given to results where the sum of powers is positive\n            # and the scale is exactly equal to 1.0\n            results = list(results)\n            results.sort(key=lambda x: np.abs(x.scale))\n            results.sort(key=lambda x: np.sum(np.abs(x.powers)))\n            results.sort(key=lambda x: np.sum(x.powers) < 0.0)\n            results.sort(key=lambda x: not is_effectively_unity(x.scale))\n\n            last_result = results[0]\n            filtered = [last_result]\n            for result in results[1:]:\n                if str(result) != str(last_result):\n                    filtered.append(result)\n                last_result = result\n\n            return filtered\n\n        return sort_results(self._compose(\n            equivalencies=equivalencies, namespace=units,\n            max_depth=max_depth, depth=0, cached_results={}))\n\n    def to_system(self, system):\n        \"\"\"\n        Converts this unit into ones belonging to the given system.\n        Since more than one result may be possible, a list is always\n        returned.\n\n        Parameters\n        ----------\n        system : module\n            The module that defines the unit system.  Commonly used\n            ones include `astropy.units.si` and `astropy.units.cgs`.\n\n            To use your own module it must contain unit objects and a\n            sequence member named ``bases`` containing the base units of\n            the system.\n\n        Returns\n        -------\n        units : list of `CompositeUnit`\n            The list is ranked so that units containing only the base\n            units of that system will appear first.\n        \"\"\"\n        bases = set(system.bases)\n\n        def score(compose):\n            # In case that compose._bases has no elements we return\n            # 'np.inf' as 'score value'.  It does not really matter which\n            # number we would return. This case occurs for instance for\n            # dimensionless quantities:\n            compose_bases = compose.bases\n            if len(compose_bases) == 0:\n                return np.inf\n            else:\n                sum = 0\n                for base in compose_bases:\n                    if base in bases:\n                        sum += 1\n\n                return sum / float(len(compose_bases))\n\n        x = self.decompose(bases=bases)\n        composed = x.compose(units=system)\n        composed = sorted(composed, key=score, reverse=True)\n        return composed\n\n    @lazyproperty\n    def si(self):\n        \"\"\"\n        Returns a copy of the current `Unit` instance in SI units.\n        \"\"\"\n\n        from . import si\n        return self.to_system(si)[0]\n\n    @lazyproperty\n    def cgs(self):\n        \"\"\"\n        Returns a copy of the current `Unit` instance with CGS units.\n        \"\"\"\n        from . import cgs\n        return self.to_system(cgs)[0]\n\n    @property\n    def physical_type(self):\n        \"\"\"\n        Physical type(s) dimensionally compatible with the unit.\n\n        Returns\n        -------\n        `~astropy.units.physical.PhysicalType`\n            A representation of the physical type(s) of a unit.\n\n        Examples\n        --------\n        >>> from astropy import units as u\n        >>> u.m.physical_type\n        PhysicalType('length')\n        >>> (u.m ** 2 / u.s).physical_type\n        PhysicalType({'diffusivity', 'kinematic viscosity'})\n\n        Physical types can be compared to other physical types\n        (recommended in packages) or to strings.\n\n        >>> area = (u.m ** 2).physical_type\n        >>> area == u.m.physical_type ** 2\n        True\n        >>> area == \"area\"\n        True\n\n        `~astropy.units.physical.PhysicalType` objects can be used for\n        dimensional analysis.\n\n        >>> number_density = u.m.physical_type ** -3\n        >>> velocity = (u.m / u.s).physical_type\n        >>> number_density * velocity\n        PhysicalType('particle flux')\n        \"\"\"\n        from . import physical\n        return physical.get_physical_type(self)\n\n    def _get_units_with_same_physical_type(self, equivalencies=[]):\n        \"\"\"\n        Return a list of registered units with the same physical type\n        as this unit.\n\n        This function is used by Quantity to add its built-in\n        conversions to equivalent units.\n\n        This is a private method, since end users should be encouraged\n        to use the more powerful `compose` and `find_equivalent_units`\n        methods (which use this under the hood).\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            A list of equivalence pairs to also pull options from.\n            See :ref:`astropy:unit_equivalencies`.  It must already be\n            normalized using `_normalize_equivalencies`.\n        \"\"\"\n        unit_registry = get_current_unit_registry()\n        units = set(unit_registry.get_units_with_physical_type(self))\n        for funit, tunit, a, b in equivalencies:\n            if tunit is not None:\n                if self.is_equivalent(funit) and tunit not in units:\n                    units.update(\n                        unit_registry.get_units_with_physical_type(tunit))\n                if self._is_equivalent(tunit) and funit not in units:\n                    units.update(\n                        unit_registry.get_units_with_physical_type(funit))\n            else:\n                if self.is_equivalent(funit):\n                    units.add(dimensionless_unscaled)\n        return units\n\n    class EquivalentUnitsList(list):\n        \"\"\"\n        A class to handle pretty-printing the result of\n        `find_equivalent_units`.\n        \"\"\"\n\n        HEADING_NAMES = ('Primary name', 'Unit definition', 'Aliases')\n        ROW_LEN = 3  # len(HEADING_NAMES), but hard-code since it is constant\n        NO_EQUIV_UNITS_MSG = 'There are no equivalent units'\n\n        def __repr__(self):\n            if len(self) == 0:\n                return self.NO_EQUIV_UNITS_MSG\n            else:\n                lines = self._process_equivalent_units(self)\n                lines.insert(0, self.HEADING_NAMES)\n                widths = [0] * self.ROW_LEN\n                for line in lines:\n                    for i, col in enumerate(line):\n                        widths[i] = max(widths[i], len(col))\n\n                f = \"  {{0:<{0}s}} | {{1:<{1}s}} | {{2:<{2}s}}\".format(*widths)\n                lines = [f.format(*line) for line in lines]\n                lines = (lines[0:1] +\n                         ['['] +\n                         [f'{x} ,' for x in lines[1:]] +\n                         [']'])\n                return '\\n'.join(lines)\n\n        def _repr_html_(self):\n            \"\"\"\n            Outputs a HTML table representation within Jupyter notebooks.\n            \"\"\"\n            if len(self) == 0:\n                return f\"<p>{self.NO_EQUIV_UNITS_MSG}</p>\"\n            else:\n                # HTML tags to use to compose the table in HTML\n                blank_table = '<table style=\"width:50%\">{}</table>'\n                blank_row_container = \"<tr>{}</tr>\"\n                heading_row_content = \"<th>{}</th>\" * self.ROW_LEN\n                data_row_content = \"<td>{}</td>\" * self.ROW_LEN\n\n                # The HTML will be rendered & the table is simple, so don't\n                # bother to include newlines & indentation for the HTML code.\n                heading_row = blank_row_container.format(\n                    heading_row_content.format(*self.HEADING_NAMES))\n                data_rows = self._process_equivalent_units(self)\n                all_rows = heading_row\n                for row in data_rows:\n                    html_row = blank_row_container.format(\n                        data_row_content.format(*row))\n                    all_rows += html_row\n                return blank_table.format(all_rows)\n\n        @staticmethod\n        def _process_equivalent_units(equiv_units_data):\n            \"\"\"\n            Extract attributes, and sort, the equivalent units pre-formatting.\n            \"\"\"\n            processed_equiv_units = []\n            for u in equiv_units_data:\n                irred = u.decompose().to_string()\n                if irred == u.name:\n                    irred = 'irreducible'\n                processed_equiv_units.append(\n                    (u.name, irred, ', '.join(u.aliases)))\n            processed_equiv_units.sort()\n            return processed_equiv_units\n\n    def find_equivalent_units(self, equivalencies=[], units=None,\n                              include_prefix_units=False):\n        \"\"\"\n        Return a list of all the units that are the same type as ``self``.\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            A list of equivalence pairs to also list.  See\n            :ref:`astropy:unit_equivalencies`.\n            Any list given, including an empty one, supersedes global defaults\n            that may be in effect (as set by `set_enabled_equivalencies`)\n\n        units : set of `~astropy.units.Unit`, optional\n            If not provided, all defined units will be searched for\n            equivalencies.  Otherwise, may be a dict, module or\n            sequence containing the units to search for equivalencies.\n\n        include_prefix_units : bool, optional\n            When `True`, include prefixed units in the result.\n            Default is `False`.\n\n        Returns\n        -------\n        units : list of `UnitBase`\n            A list of unit objects that match ``u``.  A subclass of\n            `list` (``EquivalentUnitsList``) is returned that\n            pretty-prints the list of units when output.\n        \"\"\"\n        results = self.compose(\n            equivalencies=equivalencies, units=units, max_depth=1,\n            include_prefix_units=include_prefix_units)\n        results = set(\n            x.bases[0] for x in results if len(x.bases) == 1)\n        return self.EquivalentUnitsList(results)\n\n    def is_unity(self):\n        \"\"\"\n        Returns `True` if the unit is unscaled and dimensionless.\n        \"\"\"\n        return False\n\n\nclass NamedUnit(UnitBase):\n    \"\"\"\n    The base class of units that have a name.\n\n    Parameters\n    ----------\n    st : str, list of str, 2-tuple\n        The name of the unit.  If a list of strings, the first element\n        is the canonical (short) name, and the rest of the elements\n        are aliases.  If a tuple of lists, the first element is a list\n        of short names, and the second element is a list of long\n        names; all but the first short name are considered \"aliases\".\n        Each name *should* be a valid Python identifier to make it\n        easy to access, but this is not required.\n\n    namespace : dict, optional\n        When provided, inject the unit, and all of its aliases, in the\n        given namespace dictionary.  If a unit by the same name is\n        already in the namespace, a ValueError is raised.\n\n    doc : str, optional\n        A docstring describing the unit.\n\n    format : dict, optional\n        A mapping to format-specific representations of this unit.\n        For example, for the ``Ohm`` unit, it might be nice to have it\n        displayed as ``\\\\Omega`` by the ``latex`` formatter.  In that\n        case, `format` argument should be set to::\n\n            {'latex': r'\\\\Omega'}\n\n    Raises\n    ------\n    ValueError\n        If any of the given unit names are already in the registry.\n\n    ValueError\n        If any of the given unit names are not valid Python tokens.\n    \"\"\"\n\n    def __init__(self, st, doc=None, format=None, namespace=None):\n\n        UnitBase.__init__(self)\n\n        if isinstance(st, (bytes, str)):\n            self._names = [st]\n            self._short_names = [st]\n            self._long_names = []\n        elif isinstance(st, tuple):\n            if not len(st) == 2:\n                raise ValueError(\"st must be string, list or 2-tuple\")\n            self._names = st[0] + [n for n in st[1] if n not in st[0]]\n            if not len(self._names):\n                raise ValueError(\"must provide at least one name\")\n            self._short_names = st[0][:]\n            self._long_names = st[1][:]\n        else:\n            if len(st) == 0:\n                raise ValueError(\n                    \"st list must have at least one entry\")\n            self._names = st[:]\n            self._short_names = [st[0]]\n            self._long_names = st[1:]\n\n        if format is None:\n            format = {}\n        self._format = format\n\n        if doc is None:\n            doc = self._generate_doc()\n        else:\n            doc = textwrap.dedent(doc)\n            doc = textwrap.fill(doc)\n\n        self.__doc__ = doc\n\n        self._inject(namespace)\n\n    def _generate_doc(self):\n        \"\"\"\n        Generate a docstring for the unit if the user didn't supply\n        one.  This is only used from the constructor and may be\n        overridden in subclasses.\n        \"\"\"\n        names = self.names\n        if len(self.names) > 1:\n            return \"{1} ({0})\".format(*names[:2])\n        else:\n            return names[0]\n\n    def get_format_name(self, format):\n        \"\"\"\n        Get a name for this unit that is specific to a particular\n        format.\n\n        Uses the dictionary passed into the `format` kwarg in the\n        constructor.\n\n        Parameters\n        ----------\n        format : str\n            The name of the format\n\n        Returns\n        -------\n        name : str\n            The name of the unit for the given format.\n        \"\"\"\n        return self._format.get(format, self.name)\n\n    @property\n    def names(self):\n        \"\"\"\n        Returns all of the names associated with this unit.\n        \"\"\"\n        return self._names\n\n    @property\n    def name(self):\n        \"\"\"\n        Returns the canonical (short) name associated with this unit.\n        \"\"\"\n        return self._names[0]\n\n    @property\n    def aliases(self):\n        \"\"\"\n        Returns the alias (long) names for this unit.\n        \"\"\"\n        return self._names[1:]\n\n    @property\n    def short_names(self):\n        \"\"\"\n        Returns all of the short names associated with this unit.\n        \"\"\"\n        return self._short_names\n\n    @property\n    def long_names(self):\n        \"\"\"\n        Returns all of the long names associated with this unit.\n        \"\"\"\n        return self._long_names\n\n    def _inject(self, namespace=None):\n        \"\"\"\n        Injects the unit, and all of its aliases, in the given\n        namespace dictionary.\n        \"\"\"\n        if namespace is None:\n            return\n\n        # Loop through all of the names first, to ensure all of them\n        # are new, then add them all as a single \"transaction\" below.\n        for name in self._names:\n            if name in namespace and self != namespace[name]:\n                raise ValueError(\n                    \"Object with name {!r} already exists in \"\n                    \"given namespace ({!r}).\".format(\n                        name, namespace[name]))\n\n        for name in self._names:\n            namespace[name] = self\n\n\ndef _recreate_irreducible_unit(cls, names, registered):\n    \"\"\"\n    This is used to reconstruct units when passed around by\n    multiprocessing.\n    \"\"\"\n    registry = get_current_unit_registry().registry\n    if names[0] in registry:\n        # If in local registry return that object.\n        return registry[names[0]]\n    else:\n        # otherwise, recreate the unit.\n        unit = cls(names)\n        if registered:\n            # If not in local registry but registered in origin registry,\n            # enable unit in local registry.\n            get_current_unit_registry().add_enabled_units([unit])\n\n        return unit\n\n\nclass IrreducibleUnit(NamedUnit):\n    \"\"\"\n    Irreducible units are the units that all other units are defined\n    in terms of.\n\n    Examples are meters, seconds, kilograms, amperes, etc.  There is\n    only once instance of such a unit per type.\n    \"\"\"\n\n    def __reduce__(self):\n        # When IrreducibleUnit objects are passed to other processes\n        # over multiprocessing, they need to be recreated to be the\n        # ones already in the subprocesses' namespace, not new\n        # objects, or they will be considered \"unconvertible\".\n        # Therefore, we have a custom pickler/unpickler that\n        # understands how to recreate the Unit on the other side.\n        registry = get_current_unit_registry().registry\n        return (_recreate_irreducible_unit,\n                (self.__class__, list(self.names), self.name in registry),\n                self.__getstate__())\n\n    @property\n    def represents(self):\n        \"\"\"The unit that this named unit represents.\n\n        For an irreducible unit, that is always itself.\n        \"\"\"\n        return self\n\n    def decompose(self, bases=set()):\n        if len(bases) and self not in bases:\n            for base in bases:\n                try:\n                    scale = self._to(base)\n                except UnitsError:\n                    pass\n                else:\n                    if is_effectively_unity(scale):\n                        return base\n                    else:\n                        return CompositeUnit(scale, [base], [1],\n                                             _error_check=False)\n\n            raise UnitConversionError(\n                f\"Unit {self} can not be decomposed into the requested bases\")\n\n        return self\n\n\nclass UnrecognizedUnit(IrreducibleUnit):\n    \"\"\"\n    A unit that did not parse correctly.  This allows for\n    round-tripping it as a string, but no unit operations actually work\n    on it.\n\n    Parameters\n    ----------\n    st : str\n        The name of the unit.\n    \"\"\"\n    # For UnrecognizedUnits, we want to use \"standard\" Python\n    # pickling, not the special case that is used for\n    # IrreducibleUnits.\n    __reduce__ = object.__reduce__\n\n    def __repr__(self):\n        return f\"UnrecognizedUnit({str(self)})\"\n\n    def __bytes__(self):\n        return self.name.encode('ascii', 'replace')\n\n    def __str__(self):\n        return self.name\n\n    def to_string(self, format=None):\n        return self.name\n\n    def _unrecognized_operator(self, *args, **kwargs):\n        raise ValueError(\n            \"The unit {!r} is unrecognized, so all arithmetic operations \"\n            \"with it are invalid.\".format(self.name))\n\n    __pow__ = __truediv__ = __rtruediv__ = __mul__ = __rmul__ = __lt__ = \\\n        __gt__ = __le__ = __ge__ = __neg__ = _unrecognized_operator\n\n    def __eq__(self, other):\n        try:\n            other = Unit(other, parse_strict='silent')\n        except (ValueError, UnitsError, TypeError):\n            return NotImplemented\n\n        return isinstance(other, type(self)) and self.name == other.name\n\n    def __ne__(self, other):\n        return not (self == other)\n\n    def is_equivalent(self, other, equivalencies=None):\n        self._normalize_equivalencies(equivalencies)\n        return self == other\n\n    def _get_converter(self, other, equivalencies=None):\n        self._normalize_equivalencies(equivalencies)\n        raise ValueError(\n            \"The unit {!r} is unrecognized.  It can not be converted \"\n            \"to other units.\".format(self.name))\n\n    def get_format_name(self, format):\n        return self.name\n\n    def is_unity(self):\n        return False\n\n\nclass _UnitMetaClass(type):\n    \"\"\"\n    This metaclass exists because the Unit constructor should\n    sometimes return instances that already exist.  This \"overrides\"\n    the constructor before the new instance is actually created, so we\n    can return an existing one.\n    \"\"\"\n\n    def __call__(self, s=\"\", represents=None, format=None, namespace=None,\n                 doc=None, parse_strict='raise'):\n\n        # Short-circuit if we're already a unit\n        if hasattr(s, '_get_physical_type_id'):\n            return s\n\n        # turn possible Quantity input for s or represents into a Unit\n        from .quantity import Quantity\n\n        if isinstance(represents, Quantity):\n            if is_effectively_unity(represents.value):\n                represents = represents.unit\n            else:\n                represents = CompositeUnit(represents.value *\n                                           represents.unit.scale,\n                                           bases=represents.unit.bases,\n                                           powers=represents.unit.powers,\n                                           _error_check=False)\n\n        if isinstance(s, Quantity):\n            if is_effectively_unity(s.value):\n                s = s.unit\n            else:\n                s = CompositeUnit(s.value * s.unit.scale,\n                                  bases=s.unit.bases,\n                                  powers=s.unit.powers,\n                                  _error_check=False)\n\n        # now decide what we really need to do; define derived Unit?\n        if isinstance(represents, UnitBase):\n            # This has the effect of calling the real __new__ and\n            # __init__ on the Unit class.\n            return super().__call__(\n                s, represents, format=format, namespace=namespace, doc=doc)\n\n        # or interpret a Quantity (now became unit), string or number?\n        if isinstance(s, UnitBase):\n            return s\n\n        elif isinstance(s, (bytes, str)):\n            if len(s.strip()) == 0:\n                # Return the NULL unit\n                return dimensionless_unscaled\n\n            if format is None:\n                format = unit_format.Generic\n\n            f = unit_format.get_format(format)\n            if isinstance(s, bytes):\n                s = s.decode('ascii')\n\n            try:\n                return f.parse(s)\n            except NotImplementedError:\n                raise\n            except Exception as e:\n                if parse_strict == 'silent':\n                    pass\n                else:\n                    # Deliberately not issubclass here. Subclasses\n                    # should use their name.\n                    if f is not unit_format.Generic:\n                        format_clause = f.name + ' '\n                    else:\n                        format_clause = ''\n                    msg = (\"'{}' did not parse as {}unit: {} \"\n                           \"If this is meant to be a custom unit, \"\n                           \"define it with 'u.def_unit'. To have it \"\n                           \"recognized inside a file reader or other code, \"\n                           \"enable it with 'u.add_enabled_units'. \"\n                           \"For details, see \"\n                           \"https://docs.astropy.org/en/latest/units/combining_and_defining.html\"\n                           .format(s, format_clause, str(e)))\n                    if parse_strict == 'raise':\n                        raise ValueError(msg)\n                    elif parse_strict == 'warn':\n                        warnings.warn(msg, UnitsWarning)\n                    else:\n                        raise ValueError(\"'parse_strict' must be 'warn', \"\n                                         \"'raise' or 'silent'\")\n                return UnrecognizedUnit(s)\n\n        elif isinstance(s, (int, float, np.floating, np.integer)):\n            return CompositeUnit(s, [], [], _error_check=False)\n\n        elif isinstance(s, tuple):\n            from .structured import StructuredUnit\n            return StructuredUnit(s)\n\n        elif s is None:\n            raise TypeError(\"None is not a valid Unit\")\n\n        else:\n            raise TypeError(f\"{s} can not be converted to a Unit\")\n\n\nclass Unit(NamedUnit, metaclass=_UnitMetaClass):\n    \"\"\"\n    The main unit class.\n\n    There are a number of different ways to construct a Unit, but\n    always returns a `UnitBase` instance.  If the arguments refer to\n    an already-existing unit, that existing unit instance is returned,\n    rather than a new one.\n\n    - From a string::\n\n        Unit(s, format=None, parse_strict='silent')\n\n      Construct from a string representing a (possibly compound) unit.\n\n      The optional `format` keyword argument specifies the format the\n      string is in, by default ``\"generic\"``.  For a description of\n      the available formats, see `astropy.units.format`.\n\n      The optional ``parse_strict`` keyword controls what happens when an\n      unrecognized unit string is passed in.  It may be one of the following:\n\n         - ``'raise'``: (default) raise a ValueError exception.\n\n         - ``'warn'``: emit a Warning, and return an\n           `UnrecognizedUnit` instance.\n\n         - ``'silent'``: return an `UnrecognizedUnit` instance.\n\n    - From a number::\n\n        Unit(number)\n\n      Creates a dimensionless unit.\n\n    - From a `UnitBase` instance::\n\n        Unit(unit)\n\n      Returns the given unit unchanged.\n\n    - From no arguments::\n\n        Unit()\n\n      Returns the dimensionless unit.\n\n    - The last form, which creates a new `Unit` is described in detail\n      below.\n\n    See also: https://docs.astropy.org/en/stable/units/\n\n    Parameters\n    ----------\n    st : str or list of str\n        The name of the unit.  If a list, the first element is the\n        canonical (short) name, and the rest of the elements are\n        aliases.\n\n    represents : UnitBase instance\n        The unit that this named unit represents.\n\n    doc : str, optional\n        A docstring describing the unit.\n\n    format : dict, optional\n        A mapping to format-specific representations of this unit.\n        For example, for the ``Ohm`` unit, it might be nice to have it\n        displayed as ``\\\\Omega`` by the ``latex`` formatter.  In that\n        case, `format` argument should be set to::\n\n            {'latex': r'\\\\Omega'}\n\n    namespace : dict, optional\n        When provided, inject the unit (and all of its aliases) into\n        the given namespace.\n\n    Raises\n    ------\n    ValueError\n        If any of the given unit names are already in the registry.\n\n    ValueError\n        If any of the given unit names are not valid Python tokens.\n    \"\"\"\n\n    def __init__(self, st, represents=None, doc=None,\n                 format=None, namespace=None):\n\n        represents = Unit(represents)\n        self._represents = represents\n\n        NamedUnit.__init__(self, st, namespace=namespace, doc=doc,\n                           format=format)\n\n    @property\n    def represents(self):\n        \"\"\"The unit that this named unit represents.\"\"\"\n        return self._represents\n\n    def decompose(self, bases=set()):\n        return self._represents.decompose(bases=bases)\n\n    def is_unity(self):\n        return self._represents.is_unity()\n\n    def __hash__(self):\n        if self._hash is None:\n            self._hash = hash((self.name, self._represents))\n        return self._hash\n\n    @classmethod\n    def _from_physical_type_id(cls, physical_type_id):\n        # get string bases and powers from the ID tuple\n        bases = [cls(base) for base, _ in physical_type_id]\n        powers = [power for _, power in physical_type_id]\n\n        if len(physical_type_id) == 1 and powers[0] == 1:\n            unit = bases[0]\n        else:\n            unit = CompositeUnit(1, bases, powers,\n                                 _error_check=False)\n\n        return unit\n\n\nclass PrefixUnit(Unit):\n    \"\"\"\n    A unit that is simply a SI-prefixed version of another unit.\n\n    For example, ``mm`` is a `PrefixUnit` of ``.001 * m``.\n\n    The constructor is the same as for `Unit`.\n    \"\"\"\n\n\nclass CompositeUnit(UnitBase):\n    \"\"\"\n    Create a composite unit using expressions of previously defined\n    units.\n\n    Direct use of this class is not recommended. Instead use the\n    factory function `Unit` and arithmetic operators to compose\n    units.\n\n    Parameters\n    ----------\n    scale : number\n        A scaling factor for the unit.\n\n    bases : sequence of `UnitBase`\n        A sequence of units this unit is composed of.\n\n    powers : sequence of numbers\n        A sequence of powers (in parallel with ``bases``) for each\n        of the base units.\n    \"\"\"\n    _decomposed_cache = None\n\n    def __init__(self, scale, bases, powers, decompose=False,\n                 decompose_bases=set(), _error_check=True):\n        # There are many cases internal to astropy.units where we\n        # already know that all the bases are Unit objects, and the\n        # powers have been validated.  In those cases, we can skip the\n        # error checking for performance reasons.  When the private\n        # kwarg `_error_check` is False, the error checking is turned\n        # off.\n        if _error_check:\n            for base in bases:\n                if not isinstance(base, UnitBase):\n                    raise TypeError(\n                        \"bases must be sequence of UnitBase instances\")\n            powers = [validate_power(p) for p in powers]\n\n        if not decompose and len(bases) == 1 and powers[0] >= 0:\n            # Short-cut; with one unit there's nothing to expand and gather,\n            # as that has happened already when creating the unit.  But do only\n            # positive powers, since for negative powers we need to re-sort.\n            unit = bases[0]\n            power = powers[0]\n            if power == 1:\n                scale *= unit.scale\n                self._bases = unit.bases\n                self._powers = unit.powers\n            elif power == 0:\n                self._bases = []\n                self._powers = []\n            else:\n                scale *= unit.scale ** power\n                self._bases = unit.bases\n                self._powers = [operator.mul(*resolve_fractions(p, power))\n                                for p in unit.powers]\n\n            self._scale = sanitize_scale(scale)\n        else:\n            # Regular case: use inputs as preliminary scale, bases, and powers,\n            # then \"expand and gather\" identical bases, sanitize the scale, &c.\n            self._scale = scale\n            self._bases = bases\n            self._powers = powers\n            self._expand_and_gather(decompose=decompose,\n                                    bases=decompose_bases)\n\n    def __repr__(self):\n        if len(self._bases):\n            return super().__repr__()\n        else:\n            if self._scale != 1.0:\n                return f'Unit(dimensionless with a scale of {self._scale})'\n            else:\n                return 'Unit(dimensionless)'\n\n    @property\n    def scale(self):\n        \"\"\"\n        Return the scale of the composite unit.\n        \"\"\"\n        return self._scale\n\n    @property\n    def bases(self):\n        \"\"\"\n        Return the bases of the composite unit.\n        \"\"\"\n        return self._bases\n\n    @property\n    def powers(self):\n        \"\"\"\n        Return the powers of the composite unit.\n        \"\"\"\n        return self._powers\n\n    def _expand_and_gather(self, decompose=False, bases=set()):\n        def add_unit(unit, power, scale):\n            if bases and unit not in bases:\n                for base in bases:\n                    try:\n                        scale *= unit._to(base) ** power\n                    except UnitsError:\n                        pass\n                    else:\n                        unit = base\n                        break\n\n            if unit in new_parts:\n                a, b = resolve_fractions(new_parts[unit], power)\n                new_parts[unit] = a + b\n            else:\n                new_parts[unit] = power\n            return scale\n\n        new_parts = {}\n        scale = self._scale\n\n        for b, p in zip(self._bases, self._powers):\n            if decompose and b not in bases:\n                b = b.decompose(bases=bases)\n\n            if isinstance(b, CompositeUnit):\n                scale *= b._scale ** p\n                for b_sub, p_sub in zip(b._bases, b._powers):\n                    a, b = resolve_fractions(p_sub, p)\n                    scale = add_unit(b_sub, a * b, scale)\n            else:\n                scale = add_unit(b, p, scale)\n\n        new_parts = [x for x in new_parts.items() if x[1] != 0]\n        new_parts.sort(key=lambda x: (-x[1], getattr(x[0], 'name', '')))\n\n        self._bases = [x[0] for x in new_parts]\n        self._powers = [x[1] for x in new_parts]\n        self._scale = sanitize_scale(scale)\n\n    def __copy__(self):\n        \"\"\"\n        For compatibility with python copy module.\n        \"\"\"\n        return CompositeUnit(self._scale, self._bases[:], self._powers[:])\n\n    def decompose(self, bases=set()):\n        if len(bases) == 0 and self._decomposed_cache is not None:\n            return self._decomposed_cache\n\n        for base in self.bases:\n            if (not isinstance(base, IrreducibleUnit) or\n                    (len(bases) and base not in bases)):\n                break\n        else:\n            if len(bases) == 0:\n                self._decomposed_cache = self\n            return self\n\n        x = CompositeUnit(self.scale, self.bases, self.powers, decompose=True,\n                          decompose_bases=bases)\n        if len(bases) == 0:\n            self._decomposed_cache = x\n        return x\n\n    def is_unity(self):\n        unit = self.decompose()\n        return len(unit.bases) == 0 and unit.scale == 1.0\n\n\nsi_prefixes = [\n    (['Y'], ['yotta'], 1e24),\n    (['Z'], ['zetta'], 1e21),\n    (['E'], ['exa'], 1e18),\n    (['P'], ['peta'], 1e15),\n    (['T'], ['tera'], 1e12),\n    (['G'], ['giga'], 1e9),\n    (['M'], ['mega'], 1e6),\n    (['k'], ['kilo'], 1e3),\n    (['h'], ['hecto'], 1e2),\n    (['da'], ['deka', 'deca'], 1e1),\n    (['d'], ['deci'], 1e-1),\n    (['c'], ['centi'], 1e-2),\n    (['m'], ['milli'], 1e-3),\n    (['u'], ['micro'], 1e-6),\n    (['n'], ['nano'], 1e-9),\n    (['p'], ['pico'], 1e-12),\n    (['f'], ['femto'], 1e-15),\n    (['a'], ['atto'], 1e-18),\n    (['z'], ['zepto'], 1e-21),\n    (['y'], ['yocto'], 1e-24)\n]\n\n\nbinary_prefixes = [\n    (['Ki'], ['kibi'], 2. ** 10),\n    (['Mi'], ['mebi'], 2. ** 20),\n    (['Gi'], ['gibi'], 2. ** 30),\n    (['Ti'], ['tebi'], 2. ** 40),\n    (['Pi'], ['pebi'], 2. ** 50),\n    (['Ei'], ['exbi'], 2. ** 60)\n]\n\n\ndef _add_prefixes(u, excludes=[], namespace=None, prefixes=False):\n    \"\"\"\n    Set up all of the standard metric prefixes for a unit.  This\n    function should not be used directly, but instead use the\n    `prefixes` kwarg on `def_unit`.\n\n    Parameters\n    ----------\n    excludes : list of str, optional\n        Any prefixes to exclude from creation to avoid namespace\n        collisions.\n\n    namespace : dict, optional\n        When provided, inject the unit (and all of its aliases) into\n        the given namespace dictionary.\n\n    prefixes : list, optional\n        When provided, it is a list of prefix definitions of the form:\n\n            (short_names, long_tables, factor)\n    \"\"\"\n    if prefixes is True:\n        prefixes = si_prefixes\n    elif prefixes is False:\n        prefixes = []\n\n    for short, full, factor in prefixes:\n        names = []\n        format = {}\n        for prefix in short:\n            if prefix in excludes:\n                continue\n\n            for alias in u.short_names:\n                names.append(prefix + alias)\n\n                # This is a hack to use Greek mu as a prefix\n                # for some formatters.\n                if prefix == 'u':\n                    format['latex'] = r'\\mu ' + u.get_format_name('latex')\n                    format['unicode'] = '\\N{MICRO SIGN}' + u.get_format_name('unicode')\n\n                for key, val in u._format.items():\n                    format.setdefault(key, prefix + val)\n\n        for prefix in full:\n            if prefix in excludes:\n                continue\n\n            for alias in u.long_names:\n                names.append(prefix + alias)\n\n        if len(names):\n            PrefixUnit(names, CompositeUnit(factor, [u], [1],\n                                            _error_check=False),\n                       namespace=namespace, format=format)\n\n\ndef def_unit(s, represents=None, doc=None, format=None, prefixes=False,\n             exclude_prefixes=[], namespace=None):\n    \"\"\"\n    Factory function for defining new units.\n\n    Parameters\n    ----------\n    s : str or list of str\n        The name of the unit.  If a list, the first element is the\n        canonical (short) name, and the rest of the elements are\n        aliases.\n\n    represents : UnitBase instance, optional\n        The unit that this named unit represents.  If not provided,\n        a new `IrreducibleUnit` is created.\n\n    doc : str, optional\n        A docstring describing the unit.\n\n    format : dict, optional\n        A mapping to format-specific representations of this unit.\n        For example, for the ``Ohm`` unit, it might be nice to\n        have it displayed as ``\\\\Omega`` by the ``latex``\n        formatter.  In that case, `format` argument should be set\n        to::\n\n            {'latex': r'\\\\Omega'}\n\n    prefixes : bool or list, optional\n        When `True`, generate all of the SI prefixed versions of the\n        unit as well.  For example, for a given unit ``m``, will\n        generate ``mm``, ``cm``, ``km``, etc.  When a list, it is a list of\n        prefix definitions of the form:\n\n            (short_names, long_tables, factor)\n\n        Default is `False`.  This function always returns the base\n        unit object, even if multiple scaled versions of the unit were\n        created.\n\n    exclude_prefixes : list of str, optional\n        If any of the SI prefixes need to be excluded, they may be\n        listed here.  For example, ``Pa`` can be interpreted either as\n        \"petaannum\" or \"Pascal\".  Therefore, when defining the\n        prefixes for ``a``, ``exclude_prefixes`` should be set to\n        ``[\"P\"]``.\n\n    namespace : dict, optional\n        When provided, inject the unit (and all of its aliases and\n        prefixes), into the given namespace dictionary.\n\n    Returns\n    -------\n    unit : `~astropy.units.UnitBase`\n        The newly-defined unit, or a matching unit that was already\n        defined.\n    \"\"\"\n\n    if represents is not None:\n        result = Unit(s, represents, namespace=namespace, doc=doc,\n                      format=format)\n    else:\n        result = IrreducibleUnit(\n            s, namespace=namespace, doc=doc, format=format)\n\n    if prefixes:\n        _add_prefixes(result, excludes=exclude_prefixes, namespace=namespace,\n                      prefixes=prefixes)\n    return result\n\n\ndef _condition_arg(value):\n    \"\"\"\n    Validate value is acceptable for conversion purposes.\n\n    Will convert into an array if not a scalar, and can be converted\n    into an array\n\n    Parameters\n    ----------\n    value : int or float value, or sequence of such values\n\n    Returns\n    -------\n    Scalar value or numpy array\n\n    Raises\n    ------\n    ValueError\n        If value is not as expected\n    \"\"\"\n    if isinstance(value, (np.ndarray, float, int, complex, np.void)):\n        return value\n\n    avalue = np.array(value)\n    if avalue.dtype.kind not in ['i', 'f', 'c']:\n        raise ValueError(\"Value not scalar compatible or convertible to \"\n                         \"an int, float, or complex array\")\n    return avalue\n\n\ndef unit_scale_converter(val):\n    \"\"\"Function that just multiplies the value by unity.\n\n    This is a separate function so it can be recognized and\n    discarded in unit conversion.\n    \"\"\"\n    return 1. * _condition_arg(val)\n\n\ndimensionless_unscaled = CompositeUnit(1, [], [], _error_check=False)\n# Abbreviation of the above, see #1980\none = dimensionless_unscaled\n\n# Maintain error in old location for backward compatibility\n# TODO: Is this still needed? Should there be a deprecation warning?\nunit_format.fits.UnitScaleError = UnitScaleError\n"},{"col":4,"comment":"\n        Return `True` if ``other`` represents a physical type that is\n        consistent with the physical type of the `PhysicalType` instance.\n        ","endLoc":351,"header":"def __eq__(self, other)","id":9839,"name":"__eq__","nodeType":"Function","startLoc":340,"text":"def __eq__(self, other):\n        \"\"\"\n        Return `True` if ``other`` represents a physical type that is\n        consistent with the physical type of the `PhysicalType` instance.\n        \"\"\"\n        if isinstance(other, PhysicalType):\n            return self._physical_type_id == other._physical_type_id\n        elif isinstance(other, str):\n            other = _standardize_physical_type_names(other)\n            return other.issubset(self._physical_type)\n        else:\n            return NotImplemented"},{"className":"_UnitRegistry","col":0,"comment":"\n    Manages a registry of the enabled units.\n    ","endLoc":323,"id":9840,"nodeType":"Class","startLoc":107,"text":"class _UnitRegistry:\n    \"\"\"\n    Manages a registry of the enabled units.\n    \"\"\"\n\n    def __init__(self, init=[], equivalencies=[], aliases={}):\n\n        if isinstance(init, _UnitRegistry):\n            # If passed another registry we don't need to rebuild everything.\n            # but because these are mutable types we don't want to create\n            # conflicts so everything needs to be copied.\n            self._equivalencies = init._equivalencies.copy()\n            self._aliases = init._aliases.copy()\n            self._all_units = init._all_units.copy()\n            self._registry = init._registry.copy()\n            self._non_prefix_units = init._non_prefix_units.copy()\n            # The physical type is a dictionary containing sets as values.\n            # All of these must be copied otherwise we could alter the old\n            # registry.\n            self._by_physical_type = {k: v.copy() for k, v in\n                                      init._by_physical_type.items()}\n\n        else:\n            self._reset_units()\n            self._reset_equivalencies()\n            self._reset_aliases()\n            self.add_enabled_units(init)\n            self.add_enabled_equivalencies(equivalencies)\n            self.add_enabled_aliases(aliases)\n\n    def _reset_units(self):\n        self._all_units = set()\n        self._non_prefix_units = set()\n        self._registry = {}\n        self._by_physical_type = {}\n\n    def _reset_equivalencies(self):\n        self._equivalencies = set()\n\n    def _reset_aliases(self):\n        self._aliases = {}\n\n    @property\n    def registry(self):\n        return self._registry\n\n    @property\n    def all_units(self):\n        return self._all_units\n\n    @property\n    def non_prefix_units(self):\n        return self._non_prefix_units\n\n    def set_enabled_units(self, units):\n        \"\"\"\n        Sets the units enabled in the unit registry.\n\n        These units are searched when using\n        `UnitBase.find_equivalent_units`, for example.\n\n        Parameters\n        ----------\n        units : list of sequence, dict, or module\n            This is a list of things in which units may be found\n            (sequences, dicts or modules), or units themselves.  The\n            entire set will be \"enabled\" for searching through by\n            methods like `UnitBase.find_equivalent_units` and\n            `UnitBase.compose`.\n        \"\"\"\n        self._reset_units()\n        return self.add_enabled_units(units)\n\n    def add_enabled_units(self, units):\n        \"\"\"\n        Adds to the set of units enabled in the unit registry.\n\n        These units are searched when using\n        `UnitBase.find_equivalent_units`, for example.\n\n        Parameters\n        ----------\n        units : list of sequence, dict, or module\n            This is a list of things in which units may be found\n            (sequences, dicts or modules), or units themselves.  The\n            entire set will be added to the \"enabled\" set for\n            searching through by methods like\n            `UnitBase.find_equivalent_units` and `UnitBase.compose`.\n        \"\"\"\n        units = _flatten_units_collection(units)\n\n        for unit in units:\n            # Loop through all of the names first, to ensure all of them\n            # are new, then add them all as a single \"transaction\" below.\n            for st in unit._names:\n                if (st in self._registry and unit != self._registry[st]):\n                    raise ValueError(\n                        \"Object with name {!r} already exists in namespace. \"\n                        \"Filter the set of units to avoid name clashes before \"\n                        \"enabling them.\".format(st))\n\n            for st in unit._names:\n                self._registry[st] = unit\n\n            self._all_units.add(unit)\n            if not isinstance(unit, PrefixUnit):\n                self._non_prefix_units.add(unit)\n\n            hash = unit._get_physical_type_id()\n            self._by_physical_type.setdefault(hash, set()).add(unit)\n\n    def get_units_with_physical_type(self, unit):\n        \"\"\"\n        Get all units in the registry with the same physical type as\n        the given unit.\n\n        Parameters\n        ----------\n        unit : UnitBase instance\n        \"\"\"\n        return self._by_physical_type.get(unit._get_physical_type_id(), set())\n\n    @property\n    def equivalencies(self):\n        return list(self._equivalencies)\n\n    def set_enabled_equivalencies(self, equivalencies):\n        \"\"\"\n        Sets the equivalencies enabled in the unit registry.\n\n        These equivalencies are used if no explicit equivalencies are given,\n        both in unit conversion and in finding equivalent units.\n\n        This is meant in particular for allowing angles to be dimensionless.\n        Use with care.\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            List of equivalent pairs, e.g., as returned by\n            `~astropy.units.equivalencies.dimensionless_angles`.\n        \"\"\"\n        self._reset_equivalencies()\n        return self.add_enabled_equivalencies(equivalencies)\n\n    def add_enabled_equivalencies(self, equivalencies):\n        \"\"\"\n        Adds to the set of equivalencies enabled in the unit registry.\n\n        These equivalencies are used if no explicit equivalencies are given,\n        both in unit conversion and in finding equivalent units.\n\n        This is meant in particular for allowing angles to be dimensionless.\n        Use with care.\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            List of equivalent pairs, e.g., as returned by\n            `~astropy.units.equivalencies.dimensionless_angles`.\n        \"\"\"\n        # pre-normalize list to help catch mistakes\n        equivalencies = _normalize_equivalencies(equivalencies)\n        self._equivalencies |= set(equivalencies)\n\n    @property\n    def aliases(self):\n        return self._aliases\n\n    def set_enabled_aliases(self, aliases):\n        \"\"\"\n        Set aliases for units.\n\n        Parameters\n        ----------\n        aliases : dict of str, Unit\n            The aliases to set. The keys must be the string aliases, and values\n            must be the `astropy.units.Unit` that the alias will be mapped to.\n\n        Raises\n        ------\n        ValueError\n            If the alias already defines a different unit.\n\n        \"\"\"\n        self._reset_aliases()\n        self.add_enabled_aliases(aliases)\n\n    def add_enabled_aliases(self, aliases):\n        \"\"\"\n        Add aliases for units.\n\n        Parameters\n        ----------\n        aliases : dict of str, Unit\n            The aliases to add. The keys must be the string aliases, and values\n            must be the `astropy.units.Unit` that the alias will be mapped to.\n\n        Raises\n        ------\n        ValueError\n            If the alias already defines a different unit.\n\n        \"\"\"\n        for alias, unit in aliases.items():\n            if alias in self._registry and unit != self._registry[alias]:\n                raise ValueError(\n                    f\"{alias} already means {self._registry[alias]}, so \"\n                    f\"cannot be used as an alias for {unit}.\")\n            if alias in self._aliases and unit != self._aliases[alias]:\n                raise ValueError(\n                    f\"{alias} already is an alias for {self._aliases[alias]}, so \"\n                    f\"cannot be used as an alias for {unit}.\")\n\n        for alias, unit in aliases.items():\n            if alias not in self._registry and alias not in self._aliases:\n                self._aliases[alias] = unit"},{"col":4,"comment":"null","endLoc":151,"header":"@property\n    def registry(self)","id":9841,"name":"registry","nodeType":"Function","startLoc":149,"text":"@property\n    def registry(self):\n        return self._registry"},{"col":4,"comment":"null","endLoc":155,"header":"@property\n    def all_units(self)","id":9842,"name":"all_units","nodeType":"Function","startLoc":153,"text":"@property\n    def all_units(self):\n        return self._all_units"},{"col":4,"comment":"null","endLoc":159,"header":"@property\n    def non_prefix_units(self)","id":9843,"name":"non_prefix_units","nodeType":"Function","startLoc":157,"text":"@property\n    def non_prefix_units(self):\n        return self._non_prefix_units"},{"col":4,"comment":"\n        Sets the units enabled in the unit registry.\n\n        These units are searched when using\n        `UnitBase.find_equivalent_units`, for example.\n\n        Parameters\n        ----------\n        units : list of sequence, dict, or module\n            This is a list of things in which units may be found\n            (sequences, dicts or modules), or units themselves.  The\n            entire set will be \"enabled\" for searching through by\n            methods like `UnitBase.find_equivalent_units` and\n            `UnitBase.compose`.\n        ","endLoc":178,"header":"def set_enabled_units(self, units)","id":9844,"name":"set_enabled_units","nodeType":"Function","startLoc":161,"text":"def set_enabled_units(self, units):\n        \"\"\"\n        Sets the units enabled in the unit registry.\n\n        These units are searched when using\n        `UnitBase.find_equivalent_units`, for example.\n\n        Parameters\n        ----------\n        units : list of sequence, dict, or module\n            This is a list of things in which units may be found\n            (sequences, dicts or modules), or units themselves.  The\n            entire set will be \"enabled\" for searching through by\n            methods like `UnitBase.find_equivalent_units` and\n            `UnitBase.compose`.\n        \"\"\"\n        self._reset_units()\n        return self.add_enabled_units(units)"},{"col":4,"comment":"\n        Get all units in the registry with the same physical type as\n        the given unit.\n\n        Parameters\n        ----------\n        unit : UnitBase instance\n        ","endLoc":227,"header":"def get_units_with_physical_type(self, unit)","id":9845,"name":"get_units_with_physical_type","nodeType":"Function","startLoc":218,"text":"def get_units_with_physical_type(self, unit):\n        \"\"\"\n        Get all units in the registry with the same physical type as\n        the given unit.\n\n        Parameters\n        ----------\n        unit : UnitBase instance\n        \"\"\"\n        return self._by_physical_type.get(unit._get_physical_type_id(), set())"},{"col":4,"comment":"null","endLoc":231,"header":"@property\n    def equivalencies(self)","id":9846,"name":"equivalencies","nodeType":"Function","startLoc":229,"text":"@property\n    def equivalencies(self):\n        return list(self._equivalencies)"},{"col":4,"comment":"\n        Sets the equivalencies enabled in the unit registry.\n\n        These equivalencies are used if no explicit equivalencies are given,\n        both in unit conversion and in finding equivalent units.\n\n        This is meant in particular for allowing angles to be dimensionless.\n        Use with care.\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            List of equivalent pairs, e.g., as returned by\n            `~astropy.units.equivalencies.dimensionless_angles`.\n        ","endLoc":250,"header":"def set_enabled_equivalencies(self, equivalencies)","id":9847,"name":"set_enabled_equivalencies","nodeType":"Function","startLoc":233,"text":"def set_enabled_equivalencies(self, equivalencies):\n        \"\"\"\n        Sets the equivalencies enabled in the unit registry.\n\n        These equivalencies are used if no explicit equivalencies are given,\n        both in unit conversion and in finding equivalent units.\n\n        This is meant in particular for allowing angles to be dimensionless.\n        Use with care.\n\n        Parameters\n        ----------\n        equivalencies : list of tuple\n            List of equivalent pairs, e.g., as returned by\n            `~astropy.units.equivalencies.dimensionless_angles`.\n        \"\"\"\n        self._reset_equivalencies()\n        return self.add_enabled_equivalencies(equivalencies)"},{"col":4,"comment":"null","endLoc":274,"header":"@property\n    def aliases(self)","id":9848,"name":"aliases","nodeType":"Function","startLoc":272,"text":"@property\n    def aliases(self):\n        return self._aliases"},{"col":4,"comment":"\n        Set aliases for units.\n\n        Parameters\n        ----------\n        aliases : dict of str, Unit\n            The aliases to set. The keys must be the string aliases, and values\n            must be the `astropy.units.Unit` that the alias will be mapped to.\n\n        Raises\n        ------\n        ValueError\n            If the alias already defines a different unit.\n\n        ","endLoc":293,"header":"def set_enabled_aliases(self, aliases)","id":9849,"name":"set_enabled_aliases","nodeType":"Function","startLoc":276,"text":"def set_enabled_aliases(self, aliases):\n        \"\"\"\n        Set aliases for units.\n\n        Parameters\n        ----------\n        aliases : dict of str, Unit\n            The aliases to set. The keys must be the string aliases, and values\n            must be the `astropy.units.Unit` that the alias will be mapped to.\n\n        Raises\n        ------\n        ValueError\n            If the alias already defines a different unit.\n\n        \"\"\"\n        self._reset_aliases()\n        self.add_enabled_aliases(aliases)"},{"col":4,"comment":"null","endLoc":355,"header":"def __ne__(self, other)","id":9850,"name":"__ne__","nodeType":"Function","startLoc":353,"text":"def __ne__(self, other):\n        equality = self.__eq__(other)\n        return not equality if isinstance(equality, bool) else NotImplemented"},{"col":0,"comment":"\n    Enable CDS units so they appear in results of\n    `~astropy.units.UnitBase.find_equivalent_units` and\n    `~astropy.units.UnitBase.compose`.  This will disable\n    all of the \"default\" `astropy.units` units, since there\n    are some namespace clashes between the two.\n\n    This may be used with the ``with`` statement to enable CDS\n    units only temporarily.\n    ","endLoc":188,"header":"def enable()","id":9851,"name":"enable","nodeType":"Function","startLoc":173,"text":"def enable():\n    \"\"\"\n    Enable CDS units so they appear in results of\n    `~astropy.units.UnitBase.find_equivalent_units` and\n    `~astropy.units.UnitBase.compose`.  This will disable\n    all of the \"default\" `astropy.units` units, since there\n    are some namespace clashes between the two.\n\n    This may be used with the ``with`` statement to enable CDS\n    units only temporarily.\n    \"\"\"\n    # Local import to avoid cyclical import\n    from .core import set_enabled_units\n    # Local import to avoid polluting namespace\n    import inspect\n    return set_enabled_units(inspect.getmodule(enable))"},{"attributeType":"null","col":12,"comment":"null","endLoc":119,"id":9852,"name":"_aliases","nodeType":"Attribute","startLoc":119,"text":"self._aliases"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":9853,"name":"_ns","nodeType":"Attribute","startLoc":27,"text":"_ns"},{"fileName":"equivalencies.py","filePath":"astropy/units","id":9854,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"A set of standard astronomical equivalencies.\"\"\"\n\nfrom collections import UserList\n\n# THIRD-PARTY\nimport numpy as np\nimport warnings\n\n# LOCAL\nfrom astropy.constants import si as _si\nfrom astropy.utils.exceptions import AstropyDeprecationWarning\nfrom astropy.utils.misc import isiterable\nfrom . import si\nfrom . import cgs\nfrom . import astrophys\nfrom . import misc\nfrom .function import units as function_units\nfrom . import dimensionless_unscaled\nfrom .core import UnitsError, Unit\n\n\n__all__ = ['parallax', 'spectral', 'spectral_density', 'doppler_radio',\n           'doppler_optical', 'doppler_relativistic', 'doppler_redshift', 'mass_energy',\n           'brightness_temperature', 'thermodynamic_temperature',\n           'beam_angular_area', 'dimensionless_angles', 'logarithmic',\n           'temperature', 'temperature_energy', 'molar_mass_amu',\n           'pixel_scale', 'plate_scale', \"Equivalency\"]\n\n\nclass Equivalency(UserList):\n    \"\"\"\n    A container for a units equivalency.\n\n    Attributes\n    ----------\n    name: `str`\n        The name of the equivalency.\n    kwargs: `dict`\n        Any positional or keyword arguments used to make the equivalency.\n    \"\"\"\n\n    def __init__(self, equiv_list, name='', kwargs=None):\n        self.data = equiv_list\n        self.name = [name]\n        self.kwargs = [kwargs] if kwargs is not None else [dict()]\n\n    def __add__(self, other):\n        if isinstance(other, Equivalency):\n            new = super().__add__(other)\n            new.name = self.name[:] + other.name\n            new.kwargs = self.kwargs[:] + other.kwargs\n            return new\n        else:\n            return self.data.__add__(other)\n\n    def __eq__(self, other):\n        return (isinstance(other, self.__class__) and\n                self.name == other.name and\n                self.kwargs == other.kwargs)\n\n\ndef dimensionless_angles():\n    \"\"\"Allow angles to be equivalent to dimensionless (with 1 rad = 1 m/m = 1).\n\n    It is special compared to other equivalency pairs in that it\n    allows this independent of the power to which the angle is raised,\n    and independent of whether it is part of a more complicated unit.\n    \"\"\"\n    return Equivalency([(si.radian, None)], \"dimensionless_angles\")\n\n\ndef logarithmic():\n    \"\"\"Allow logarithmic units to be converted to dimensionless fractions\"\"\"\n    return Equivalency([\n        (dimensionless_unscaled, function_units.dex,\n         np.log10, lambda x: 10.**x)\n    ], \"logarithmic\")\n\n\ndef parallax():\n    \"\"\"\n    Returns a list of equivalence pairs that handle the conversion\n    between parallax angle and distance.\n    \"\"\"\n\n    def parallax_converter(x):\n        x = np.asanyarray(x)\n        d = 1 / x\n\n        if isiterable(d):\n            d[d < 0] = np.nan\n            return d\n\n        else:\n            if d < 0:\n                return np.array(np.nan)\n            else:\n                return d\n\n    return Equivalency([\n        (si.arcsecond, astrophys.parsec, parallax_converter)\n    ], \"parallax\")\n\n\ndef spectral():\n    \"\"\"\n    Returns a list of equivalence pairs that handle spectral\n    wavelength, wave number, frequency, and energy equivalencies.\n\n    Allows conversions between wavelength units, wave number units,\n    frequency units, and energy units as they relate to light.\n\n    There are two types of wave number:\n\n        * spectroscopic - :math:`1 / \\\\lambda` (per meter)\n        * angular - :math:`2 \\\\pi / \\\\lambda` (radian per meter)\n\n    \"\"\"\n    hc = _si.h.value * _si.c.value\n    two_pi = 2.0 * np.pi\n    inv_m_spec = si.m ** -1\n    inv_m_ang = si.radian / si.m\n\n    return Equivalency([\n        (si.m, si.Hz, lambda x: _si.c.value / x),\n        (si.m, si.J, lambda x: hc / x),\n        (si.Hz, si.J, lambda x: _si.h.value * x, lambda x: x / _si.h.value),\n        (si.m, inv_m_spec, lambda x: 1.0 / x),\n        (si.Hz, inv_m_spec, lambda x: x / _si.c.value,\n         lambda x: _si.c.value * x),\n        (si.J, inv_m_spec, lambda x: x / hc, lambda x: hc * x),\n        (inv_m_spec, inv_m_ang, lambda x: x * two_pi, lambda x: x / two_pi),\n        (si.m, inv_m_ang, lambda x: two_pi / x),\n        (si.Hz, inv_m_ang, lambda x: two_pi * x / _si.c.value,\n         lambda x: _si.c.value * x / two_pi),\n        (si.J, inv_m_ang, lambda x: x * two_pi / hc, lambda x: hc * x / two_pi)\n    ], \"spectral\")\n\n\ndef spectral_density(wav, factor=None):\n    \"\"\"\n    Returns a list of equivalence pairs that handle spectral density\n    with regard to wavelength and frequency.\n\n    Parameters\n    ----------\n    wav : `~astropy.units.Quantity`\n        `~astropy.units.Quantity` associated with values being converted\n        (e.g., wavelength or frequency).\n\n    Notes\n    -----\n    The ``factor`` argument is left for backward-compatibility with the syntax\n    ``spectral_density(unit, factor)`` but users are encouraged to use\n    ``spectral_density(factor * unit)`` instead.\n\n    \"\"\"\n    from .core import UnitBase\n\n    if isinstance(wav, UnitBase):\n        if factor is None:\n            raise ValueError(\n                'If `wav` is specified as a unit, `factor` should be set')\n        wav = factor * wav   # Convert to Quantity\n    c_Aps = _si.c.to_value(si.AA / si.s)  # Angstrom/s\n    h_cgs = _si.h.cgs.value  # erg * s\n    hc = c_Aps * h_cgs\n\n    # flux density\n    f_la = cgs.erg / si.angstrom / si.cm ** 2 / si.s\n    f_nu = cgs.erg / si.Hz / si.cm ** 2 / si.s\n    nu_f_nu = cgs.erg / si.cm ** 2 / si.s\n    la_f_la = nu_f_nu\n    phot_f_la = astrophys.photon / (si.cm ** 2 * si.s * si.AA)\n    phot_f_nu = astrophys.photon / (si.cm ** 2 * si.s * si.Hz)\n    la_phot_f_la = astrophys.photon / (si.cm ** 2 * si.s)\n\n    # luminosity density\n    L_nu = cgs.erg / si.s / si.Hz\n    L_la = cgs.erg / si.s / si.angstrom\n    nu_L_nu = cgs.erg / si.s\n    la_L_la = nu_L_nu\n    phot_L_la = astrophys.photon / (si.s * si.AA)\n    phot_L_nu = astrophys.photon / (si.s * si.Hz)\n\n    # surface brightness (flux equiv)\n    S_la = cgs.erg / si.angstrom / si.cm ** 2 / si.s / si.sr\n    S_nu = cgs.erg / si.Hz / si.cm ** 2 / si.s / si.sr\n    nu_S_nu = cgs.erg / si.cm ** 2 / si.s / si.sr\n    la_S_la = nu_S_nu\n    phot_S_la = astrophys.photon / (si.cm ** 2 * si.s * si.AA * si.sr)\n    phot_S_nu = astrophys.photon / (si.cm ** 2 * si.s * si.Hz * si.sr)\n\n    # surface brightness (luminosity equiv)\n    SL_nu = cgs.erg / si.s / si.Hz / si.sr\n    SL_la = cgs.erg / si.s / si.angstrom / si.sr\n    nu_SL_nu = cgs.erg / si.s / si.sr\n    la_SL_la = nu_SL_nu\n    phot_SL_la = astrophys.photon / (si.s * si.AA * si.sr)\n    phot_SL_nu = astrophys.photon / (si.s * si.Hz * si.sr)\n\n    def converter(x):\n        return x * (wav.to_value(si.AA, spectral()) ** 2 / c_Aps)\n\n    def iconverter(x):\n        return x / (wav.to_value(si.AA, spectral()) ** 2 / c_Aps)\n\n    def converter_f_nu_to_nu_f_nu(x):\n        return x * wav.to_value(si.Hz, spectral())\n\n    def iconverter_f_nu_to_nu_f_nu(x):\n        return x / wav.to_value(si.Hz, spectral())\n\n    def converter_f_la_to_la_f_la(x):\n        return x * wav.to_value(si.AA, spectral())\n\n    def iconverter_f_la_to_la_f_la(x):\n        return x / wav.to_value(si.AA, spectral())\n\n    def converter_phot_f_la_to_f_la(x):\n        return hc * x / wav.to_value(si.AA, spectral())\n\n    def iconverter_phot_f_la_to_f_la(x):\n        return x * wav.to_value(si.AA, spectral()) / hc\n\n    def converter_phot_f_la_to_f_nu(x):\n        return h_cgs * x * wav.to_value(si.AA, spectral())\n\n    def iconverter_phot_f_la_to_f_nu(x):\n        return x / (wav.to_value(si.AA, spectral()) * h_cgs)\n\n    def converter_phot_f_la_phot_f_nu(x):\n        return x * wav.to_value(si.AA, spectral()) ** 2 / c_Aps\n\n    def iconverter_phot_f_la_phot_f_nu(x):\n        return c_Aps * x / wav.to_value(si.AA, spectral()) ** 2\n\n    converter_phot_f_nu_to_f_nu = converter_phot_f_la_to_f_la\n    iconverter_phot_f_nu_to_f_nu = iconverter_phot_f_la_to_f_la\n\n    def converter_phot_f_nu_to_f_la(x):\n        return x * hc * c_Aps / wav.to_value(si.AA, spectral()) ** 3\n\n    def iconverter_phot_f_nu_to_f_la(x):\n        return x * wav.to_value(si.AA, spectral()) ** 3 / (hc * c_Aps)\n\n    # for luminosity density\n    converter_L_nu_to_nu_L_nu = converter_f_nu_to_nu_f_nu\n    iconverter_L_nu_to_nu_L_nu = iconverter_f_nu_to_nu_f_nu\n    converter_L_la_to_la_L_la = converter_f_la_to_la_f_la\n    iconverter_L_la_to_la_L_la = iconverter_f_la_to_la_f_la\n\n    converter_phot_L_la_to_L_la = converter_phot_f_la_to_f_la\n    iconverter_phot_L_la_to_L_la = iconverter_phot_f_la_to_f_la\n    converter_phot_L_la_to_L_nu = converter_phot_f_la_to_f_nu\n    iconverter_phot_L_la_to_L_nu = iconverter_phot_f_la_to_f_nu\n    converter_phot_L_la_phot_L_nu = converter_phot_f_la_phot_f_nu\n    iconverter_phot_L_la_phot_L_nu = iconverter_phot_f_la_phot_f_nu\n    converter_phot_L_nu_to_L_nu = converter_phot_f_nu_to_f_nu\n    iconverter_phot_L_nu_to_L_nu = iconverter_phot_f_nu_to_f_nu\n    converter_phot_L_nu_to_L_la = converter_phot_f_nu_to_f_la\n    iconverter_phot_L_nu_to_L_la = iconverter_phot_f_nu_to_f_la\n\n    return Equivalency([\n        # flux\n        (f_la, f_nu, converter, iconverter),\n        (f_nu, nu_f_nu, converter_f_nu_to_nu_f_nu, iconverter_f_nu_to_nu_f_nu),\n        (f_la, la_f_la, converter_f_la_to_la_f_la, iconverter_f_la_to_la_f_la),\n        (phot_f_la, f_la, converter_phot_f_la_to_f_la, iconverter_phot_f_la_to_f_la),\n        (phot_f_la, f_nu, converter_phot_f_la_to_f_nu, iconverter_phot_f_la_to_f_nu),\n        (phot_f_la, phot_f_nu, converter_phot_f_la_phot_f_nu, iconverter_phot_f_la_phot_f_nu),\n        (phot_f_nu, f_nu, converter_phot_f_nu_to_f_nu, iconverter_phot_f_nu_to_f_nu),\n        (phot_f_nu, f_la, converter_phot_f_nu_to_f_la, iconverter_phot_f_nu_to_f_la),\n        # integrated flux\n        (la_phot_f_la, la_f_la, converter_phot_f_la_to_f_la, iconverter_phot_f_la_to_f_la),\n        # luminosity\n        (L_la, L_nu, converter, iconverter),\n        (L_nu, nu_L_nu, converter_L_nu_to_nu_L_nu, iconverter_L_nu_to_nu_L_nu),\n        (L_la, la_L_la, converter_L_la_to_la_L_la, iconverter_L_la_to_la_L_la),\n        (phot_L_la, L_la, converter_phot_L_la_to_L_la, iconverter_phot_L_la_to_L_la),\n        (phot_L_la, L_nu, converter_phot_L_la_to_L_nu, iconverter_phot_L_la_to_L_nu),\n        (phot_L_la, phot_L_nu, converter_phot_L_la_phot_L_nu, iconverter_phot_L_la_phot_L_nu),\n        (phot_L_nu, L_nu, converter_phot_L_nu_to_L_nu, iconverter_phot_L_nu_to_L_nu),\n        (phot_L_nu, L_la, converter_phot_L_nu_to_L_la, iconverter_phot_L_nu_to_L_la),\n        # surface brightness (flux equiv)\n        (S_la, S_nu, converter, iconverter),\n        (S_nu, nu_S_nu, converter_f_nu_to_nu_f_nu, iconverter_f_nu_to_nu_f_nu),\n        (S_la, la_S_la, converter_f_la_to_la_f_la, iconverter_f_la_to_la_f_la),\n        (phot_S_la, S_la, converter_phot_f_la_to_f_la, iconverter_phot_f_la_to_f_la),\n        (phot_S_la, S_nu, converter_phot_f_la_to_f_nu, iconverter_phot_f_la_to_f_nu),\n        (phot_S_la, phot_S_nu, converter_phot_f_la_phot_f_nu, iconverter_phot_f_la_phot_f_nu),\n        (phot_S_nu, S_nu, converter_phot_f_nu_to_f_nu, iconverter_phot_f_nu_to_f_nu),\n        (phot_S_nu, S_la, converter_phot_f_nu_to_f_la, iconverter_phot_f_nu_to_f_la),\n        # surface brightness (luminosity equiv)\n        (SL_la, SL_nu, converter, iconverter),\n        (SL_nu, nu_SL_nu, converter_L_nu_to_nu_L_nu, iconverter_L_nu_to_nu_L_nu),\n        (SL_la, la_SL_la, converter_L_la_to_la_L_la, iconverter_L_la_to_la_L_la),\n        (phot_SL_la, SL_la, converter_phot_L_la_to_L_la, iconverter_phot_L_la_to_L_la),\n        (phot_SL_la, SL_nu, converter_phot_L_la_to_L_nu, iconverter_phot_L_la_to_L_nu),\n        (phot_SL_la, phot_SL_nu, converter_phot_L_la_phot_L_nu, iconverter_phot_L_la_phot_L_nu),\n        (phot_SL_nu, SL_nu, converter_phot_L_nu_to_L_nu, iconverter_phot_L_nu_to_L_nu),\n        (phot_SL_nu, SL_la, converter_phot_L_nu_to_L_la, iconverter_phot_L_nu_to_L_la),\n    ], \"spectral_density\", {'wav': wav, 'factor': factor})\n\n\ndef doppler_radio(rest):\n    r\"\"\"\n    Return the equivalency pairs for the radio convention for velocity.\n\n    The radio convention for the relation between velocity and frequency is:\n\n    :math:`V = c \\frac{f_0 - f}{f_0}  ;  f(V) = f_0 ( 1 - V/c )`\n\n    Parameters\n    ----------\n    rest : `~astropy.units.Quantity`\n        Any quantity supported by the standard spectral equivalencies\n        (wavelength, energy, frequency, wave number).\n\n    References\n    ----------\n    `NRAO site defining the conventions <https://www.gb.nrao.edu/~fghigo/gbtdoc/doppler.html>`_\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> CO_restfreq = 115.27120*u.GHz  # rest frequency of 12 CO 1-0 in GHz\n    >>> radio_CO_equiv = u.doppler_radio(CO_restfreq)\n    >>> measured_freq = 115.2832*u.GHz\n    >>> radio_velocity = measured_freq.to(u.km/u.s, equivalencies=radio_CO_equiv)\n    >>> radio_velocity  # doctest: +FLOAT_CMP\n    <Quantity -31.209092088877583 km / s>\n    \"\"\"\n\n    assert_is_spectral_unit(rest)\n\n    ckms = _si.c.to_value('km/s')\n\n    def to_vel_freq(x):\n        restfreq = rest.to_value(si.Hz, equivalencies=spectral())\n        return (restfreq-x) / (restfreq) * ckms\n\n    def from_vel_freq(x):\n        restfreq = rest.to_value(si.Hz, equivalencies=spectral())\n        voverc = x/ckms\n        return restfreq * (1-voverc)\n\n    def to_vel_wav(x):\n        restwav = rest.to_value(si.AA, spectral())\n        return (x-restwav) / (x) * ckms\n\n    def from_vel_wav(x):\n        restwav = rest.to_value(si.AA, spectral())\n        return restwav * ckms / (ckms-x)\n\n    def to_vel_en(x):\n        resten = rest.to_value(si.eV, equivalencies=spectral())\n        return (resten-x) / (resten) * ckms\n\n    def from_vel_en(x):\n        resten = rest.to_value(si.eV, equivalencies=spectral())\n        voverc = x/ckms\n        return resten * (1-voverc)\n\n    return Equivalency([(si.Hz, si.km/si.s, to_vel_freq, from_vel_freq),\n                        (si.AA, si.km/si.s, to_vel_wav, from_vel_wav),\n                        (si.eV, si.km/si.s, to_vel_en, from_vel_en),\n                        ], \"doppler_radio\", {'rest': rest})\n\n\ndef doppler_optical(rest):\n    r\"\"\"\n    Return the equivalency pairs for the optical convention for velocity.\n\n    The optical convention for the relation between velocity and frequency is:\n\n    :math:`V = c \\frac{f_0 - f}{f  }  ;  f(V) = f_0 ( 1 + V/c )^{-1}`\n\n    Parameters\n    ----------\n    rest : `~astropy.units.Quantity`\n        Any quantity supported by the standard spectral equivalencies\n        (wavelength, energy, frequency, wave number).\n\n    References\n    ----------\n    `NRAO site defining the conventions <https://www.gb.nrao.edu/~fghigo/gbtdoc/doppler.html>`_\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> CO_restfreq = 115.27120*u.GHz  # rest frequency of 12 CO 1-0 in GHz\n    >>> optical_CO_equiv = u.doppler_optical(CO_restfreq)\n    >>> measured_freq = 115.2832*u.GHz\n    >>> optical_velocity = measured_freq.to(u.km/u.s, equivalencies=optical_CO_equiv)\n    >>> optical_velocity  # doctest: +FLOAT_CMP\n    <Quantity -31.20584348799674 km / s>\n    \"\"\"\n\n    assert_is_spectral_unit(rest)\n\n    ckms = _si.c.to_value('km/s')\n\n    def to_vel_freq(x):\n        restfreq = rest.to_value(si.Hz, equivalencies=spectral())\n        return ckms * (restfreq-x) / x\n\n    def from_vel_freq(x):\n        restfreq = rest.to_value(si.Hz, equivalencies=spectral())\n        voverc = x/ckms\n        return restfreq / (1+voverc)\n\n    def to_vel_wav(x):\n        restwav = rest.to_value(si.AA, spectral())\n        return ckms * (x/restwav-1)\n\n    def from_vel_wav(x):\n        restwav = rest.to_value(si.AA, spectral())\n        voverc = x/ckms\n        return restwav * (1+voverc)\n\n    def to_vel_en(x):\n        resten = rest.to_value(si.eV, equivalencies=spectral())\n        return ckms * (resten-x) / x\n\n    def from_vel_en(x):\n        resten = rest.to_value(si.eV, equivalencies=spectral())\n        voverc = x/ckms\n        return resten / (1+voverc)\n\n    return Equivalency([(si.Hz, si.km/si.s, to_vel_freq, from_vel_freq),\n                        (si.AA, si.km/si.s, to_vel_wav, from_vel_wav),\n                        (si.eV, si.km/si.s, to_vel_en, from_vel_en),\n                        ], \"doppler_optical\", {'rest': rest})\n\n\ndef doppler_relativistic(rest):\n    r\"\"\"\n    Return the equivalency pairs for the relativistic convention for velocity.\n\n    The full relativistic convention for the relation between velocity and frequency is:\n\n    :math:`V = c \\frac{f_0^2 - f^2}{f_0^2 + f^2} ;  f(V) = f_0 \\frac{\\left(1 - (V/c)^2\\right)^{1/2}}{(1+V/c)}`\n\n    Parameters\n    ----------\n    rest : `~astropy.units.Quantity`\n        Any quantity supported by the standard spectral equivalencies\n        (wavelength, energy, frequency, wave number).\n\n    References\n    ----------\n    `NRAO site defining the conventions <https://www.gb.nrao.edu/~fghigo/gbtdoc/doppler.html>`_\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> CO_restfreq = 115.27120*u.GHz  # rest frequency of 12 CO 1-0 in GHz\n    >>> relativistic_CO_equiv = u.doppler_relativistic(CO_restfreq)\n    >>> measured_freq = 115.2832*u.GHz\n    >>> relativistic_velocity = measured_freq.to(u.km/u.s, equivalencies=relativistic_CO_equiv)\n    >>> relativistic_velocity  # doctest: +FLOAT_CMP\n    <Quantity -31.207467619351537 km / s>\n    >>> measured_velocity = 1250 * u.km/u.s\n    >>> relativistic_frequency = measured_velocity.to(u.GHz, equivalencies=relativistic_CO_equiv)\n    >>> relativistic_frequency  # doctest: +FLOAT_CMP\n    <Quantity 114.79156866993588 GHz>\n    >>> relativistic_wavelength = measured_velocity.to(u.mm, equivalencies=relativistic_CO_equiv)\n    >>> relativistic_wavelength  # doctest: +FLOAT_CMP\n    <Quantity 2.6116243681798923 mm>\n    \"\"\"  # noqa: E501\n\n    assert_is_spectral_unit(rest)\n\n    ckms = _si.c.to_value('km/s')\n\n    def to_vel_freq(x):\n        restfreq = rest.to_value(si.Hz, equivalencies=spectral())\n        return (restfreq**2-x**2) / (restfreq**2+x**2) * ckms\n\n    def from_vel_freq(x):\n        restfreq = rest.to_value(si.Hz, equivalencies=spectral())\n        voverc = x/ckms\n        return restfreq * ((1-voverc) / (1+(voverc)))**0.5\n\n    def to_vel_wav(x):\n        restwav = rest.to_value(si.AA, spectral())\n        return (x**2-restwav**2) / (restwav**2+x**2) * ckms\n\n    def from_vel_wav(x):\n        restwav = rest.to_value(si.AA, spectral())\n        voverc = x/ckms\n        return restwav * ((1+voverc) / (1-voverc))**0.5\n\n    def to_vel_en(x):\n        resten = rest.to_value(si.eV, spectral())\n        return (resten**2-x**2) / (resten**2+x**2) * ckms\n\n    def from_vel_en(x):\n        resten = rest.to_value(si.eV, spectral())\n        voverc = x/ckms\n        return resten * ((1-voverc) / (1+(voverc)))**0.5\n\n    return Equivalency([(si.Hz, si.km/si.s, to_vel_freq, from_vel_freq),\n                        (si.AA, si.km/si.s, to_vel_wav, from_vel_wav),\n                        (si.eV, si.km/si.s, to_vel_en, from_vel_en),\n                        ], \"doppler_relativistic\", {'rest': rest})\n\n\ndef doppler_redshift():\n    \"\"\"\n    Returns the equivalence between Doppler redshift (unitless) and radial velocity.\n\n    .. note::\n\n        This equivalency is not compatible with cosmological\n        redshift in `astropy.cosmology.units`.\n\n    \"\"\"\n    rv_unit = si.km / si.s\n    C_KMS = _si.c.to_value(rv_unit)\n\n    def convert_z_to_rv(z):\n        zponesq = (1 + z) ** 2\n        return C_KMS * (zponesq - 1) / (zponesq + 1)\n\n    def convert_rv_to_z(rv):\n        beta = rv / C_KMS\n        return np.sqrt((1 + beta) / (1 - beta)) - 1\n\n    return Equivalency([(dimensionless_unscaled, rv_unit, convert_z_to_rv, convert_rv_to_z)],\n                       \"doppler_redshift\")\n\n\ndef molar_mass_amu():\n    \"\"\"\n    Returns the equivalence between amu and molar mass.\n    \"\"\"\n    return Equivalency([\n        (si.g/si.mol, misc.u)\n    ], \"molar_mass_amu\")\n\n\ndef mass_energy():\n    \"\"\"\n    Returns a list of equivalence pairs that handle the conversion\n    between mass and energy.\n    \"\"\"\n\n    return Equivalency([(si.kg, si.J, lambda x: x * _si.c.value ** 2,\n                         lambda x: x / _si.c.value ** 2),\n                        (si.kg / si.m ** 2, si.J / si.m ** 2,\n                         lambda x: x * _si.c.value ** 2,\n                         lambda x: x / _si.c.value ** 2),\n                        (si.kg / si.m ** 3, si.J / si.m ** 3,\n                         lambda x: x * _si.c.value ** 2,\n                         lambda x: x / _si.c.value ** 2),\n                        (si.kg / si.s, si.J / si.s, lambda x: x * _si.c.value ** 2,\n                         lambda x: x / _si.c.value ** 2),\n                        ], \"mass_energy\")\n\n\ndef brightness_temperature(frequency, beam_area=None):\n    r\"\"\"\n    Defines the conversion between Jy/sr and \"brightness temperature\",\n    :math:`T_B`, in Kelvins.  The brightness temperature is a unit very\n    commonly used in radio astronomy.  See, e.g., \"Tools of Radio Astronomy\"\n    (Wilson 2009) eqn 8.16 and eqn 8.19 (these pages are available on `google\n    books\n    <https://books.google.com/books?id=9KHw6R8rQEMC&pg=PA179&source=gbs_toc_r&cad=4#v=onepage&q&f=false>`__).\n\n    :math:`T_B \\equiv S_\\nu / \\left(2 k \\nu^2 / c^2 \\right)`\n\n    If the input is in Jy/beam or Jy (assuming it came from a single beam), the\n    beam area is essential for this computation: the brightness temperature is\n    inversely proportional to the beam area.\n\n    Parameters\n    ----------\n    frequency : `~astropy.units.Quantity`\n        The observed ``spectral`` equivalent `~astropy.units.Unit` (e.g.,\n        frequency or wavelength).  The variable is named 'frequency' because it\n        is more commonly used in radio astronomy.\n        BACKWARD COMPATIBILITY NOTE: previous versions of the brightness\n        temperature equivalency used the keyword ``disp``, which is no longer\n        supported.\n    beam_area : `~astropy.units.Quantity` ['solid angle']\n        Beam area in angular units, i.e. steradian equivalent\n\n    Examples\n    --------\n    Arecibo C-band beam::\n\n        >>> import numpy as np\n        >>> from astropy import units as u\n        >>> beam_sigma = 50*u.arcsec\n        >>> beam_area = 2*np.pi*(beam_sigma)**2\n        >>> freq = 5*u.GHz\n        >>> equiv = u.brightness_temperature(freq)\n        >>> (1*u.Jy/beam_area).to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        <Quantity 3.526295144567176 K>\n\n    VLA synthetic beam::\n\n        >>> bmaj = 15*u.arcsec\n        >>> bmin = 15*u.arcsec\n        >>> fwhm_to_sigma = 1./(8*np.log(2))**0.5\n        >>> beam_area = 2.*np.pi*(bmaj*bmin*fwhm_to_sigma**2)\n        >>> freq = 5*u.GHz\n        >>> equiv = u.brightness_temperature(freq)\n        >>> (u.Jy/beam_area).to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        <Quantity 217.2658703625732 K>\n\n    Any generic surface brightness:\n\n        >>> surf_brightness = 1e6*u.MJy/u.sr\n        >>> surf_brightness.to(u.K, equivalencies=u.brightness_temperature(500*u.GHz)) # doctest: +FLOAT_CMP\n        <Quantity 130.1931904778803 K>\n    \"\"\"  # noqa: E501\n    if frequency.unit.is_equivalent(si.sr):\n        if not beam_area.unit.is_equivalent(si.Hz):\n            raise ValueError(\"The inputs to `brightness_temperature` are \"\n                             \"frequency and angular area.\")\n        warnings.warn(\"The inputs to `brightness_temperature` have changed. \"\n                      \"Frequency is now the first input, and angular area \"\n                      \"is the second, optional input.\",\n                      AstropyDeprecationWarning)\n        frequency, beam_area = beam_area, frequency\n\n    nu = frequency.to(si.GHz, spectral())\n\n    if beam_area is not None:\n        beam = beam_area.to_value(si.sr)\n\n        def convert_Jy_to_K(x_jybm):\n            factor = (2 * _si.k_B * si.K * nu**2 / _si.c**2).to(astrophys.Jy).value\n            return (x_jybm / beam / factor)\n\n        def convert_K_to_Jy(x_K):\n            factor = (astrophys.Jy / (2 * _si.k_B * nu**2 / _si.c**2)).to(si.K).value\n            return (x_K * beam / factor)\n\n        return Equivalency([(astrophys.Jy, si.K, convert_Jy_to_K, convert_K_to_Jy),\n                            (astrophys.Jy/astrophys.beam, si.K, convert_Jy_to_K, convert_K_to_Jy)],\n                           \"brightness_temperature\", {'frequency': frequency, 'beam_area': beam_area})  # noqa: E501\n    else:\n        def convert_JySr_to_K(x_jysr):\n            factor = (2 * _si.k_B * si.K * nu**2 / _si.c**2).to(astrophys.Jy).value\n            return (x_jysr / factor)\n\n        def convert_K_to_JySr(x_K):\n            factor = (astrophys.Jy / (2 * _si.k_B * nu**2 / _si.c**2)).to(si.K).value\n            return (x_K / factor)  # multiplied by 1x for 1 steradian\n\n        return Equivalency([(astrophys.Jy/si.sr, si.K, convert_JySr_to_K, convert_K_to_JySr)],\n                           \"brightness_temperature\", {'frequency': frequency, 'beam_area': beam_area})  # noqa: E501\n\n\ndef beam_angular_area(beam_area):\n    \"\"\"\n    Convert between the ``beam`` unit, which is commonly used to express the area\n    of a radio telescope resolution element, and an area on the sky.\n    This equivalency also supports direct conversion between ``Jy/beam`` and\n    ``Jy/steradian`` units, since that is a common operation.\n\n    Parameters\n    ----------\n    beam_area : unit-like\n        The area of the beam in angular area units (e.g., steradians)\n        Must have angular area equivalent units.\n    \"\"\"\n    return Equivalency([(astrophys.beam, Unit(beam_area)),\n                        (astrophys.beam**-1, Unit(beam_area)**-1),\n                        (astrophys.Jy/astrophys.beam, astrophys.Jy/Unit(beam_area))],\n                       \"beam_angular_area\", {'beam_area': beam_area})\n\n\ndef thermodynamic_temperature(frequency, T_cmb=None):\n    r\"\"\"Defines the conversion between Jy/sr and \"thermodynamic temperature\",\n    :math:`T_{CMB}`, in Kelvins.  The thermodynamic temperature is a unit very\n    commonly used in cosmology. See eqn 8 in [1]\n\n    :math:`K_{CMB} \\equiv I_\\nu / \\left(2 k \\nu^2 / c^2  f(\\nu) \\right)`\n\n    with :math:`f(\\nu) = \\frac{ x^2 e^x}{(e^x - 1 )^2}`\n    where :math:`x = h \\nu / k T`\n\n    Parameters\n    ----------\n    frequency : `~astropy.units.Quantity`\n        The observed `spectral` equivalent `~astropy.units.Unit` (e.g.,\n        frequency or wavelength). Must have spectral units.\n    T_cmb :  `~astropy.units.Quantity` ['temperature'] or None\n        The CMB temperature at z=0.  If `None`, the default cosmology will be\n        used to get this temperature. Must have units of temperature.\n\n    Notes\n    -----\n    For broad band receivers, this conversion do not hold\n    as it highly depends on the frequency\n\n    References\n    ----------\n    .. [1] Planck 2013 results. IX. HFI spectral response\n       https://arxiv.org/abs/1303.5070\n\n    Examples\n    --------\n    Planck HFI 143 GHz::\n\n        >>> from astropy import units as u\n        >>> from astropy.cosmology import Planck15\n        >>> freq = 143 * u.GHz\n        >>> equiv = u.thermodynamic_temperature(freq, Planck15.Tcmb0)\n        >>> (1. * u.mK).to(u.MJy / u.sr, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        <Quantity 0.37993172 MJy / sr>\n\n    \"\"\"\n    nu = frequency.to(si.GHz, spectral())\n\n    if T_cmb is None:\n        from astropy.cosmology import default_cosmology\n        T_cmb = default_cosmology.get().Tcmb0\n\n    def f(nu, T_cmb=T_cmb):\n        x = _si.h * nu / _si.k_B / T_cmb\n        return x**2 * np.exp(x) / np.expm1(x)**2\n\n    def convert_Jy_to_K(x_jybm):\n        factor = (f(nu) * 2 * _si.k_B * si.K * nu**2 / _si.c**2).to_value(astrophys.Jy)\n        return x_jybm / factor\n\n    def convert_K_to_Jy(x_K):\n        factor = (astrophys.Jy / (f(nu) * 2 * _si.k_B * nu**2 / _si.c**2)).to_value(si.K)\n        return x_K / factor\n\n    return Equivalency([(astrophys.Jy/si.sr, si.K, convert_Jy_to_K, convert_K_to_Jy)],\n                       \"thermodynamic_temperature\", {'frequency': frequency, \"T_cmb\": T_cmb})\n\n\ndef temperature():\n    \"\"\"Convert between Kelvin, Celsius, Rankine and Fahrenheit here because\n    Unit and CompositeUnit cannot do addition or subtraction properly.\n    \"\"\"\n    from .imperial import deg_F, deg_R\n    return Equivalency([\n        (si.K, si.deg_C, lambda x: x - 273.15, lambda x: x + 273.15),\n        (si.deg_C, deg_F, lambda x: x * 1.8 + 32.0, lambda x: (x - 32.0) / 1.8),\n        (si.K, deg_F, lambda x: (x - 273.15) * 1.8 + 32.0,\n         lambda x: ((x - 32.0) / 1.8) + 273.15),\n        (deg_R, deg_F, lambda x: x - 459.67, lambda x: x + 459.67),\n        (deg_R, si.deg_C, lambda x: (x - 491.67) * (5/9), lambda x: x * 1.8 + 491.67),\n        (deg_R, si.K, lambda x: x * (5/9), lambda x: x * 1.8)], \"temperature\")\n\n\ndef temperature_energy():\n    \"\"\"Convert between Kelvin and keV(eV) to an equivalent amount.\"\"\"\n    return Equivalency([\n        (si.K, si.eV, lambda x: x / (_si.e.value / _si.k_B.value),\n         lambda x: x * (_si.e.value / _si.k_B.value))], \"temperature_energy\")\n\n\ndef assert_is_spectral_unit(value):\n    try:\n        value.to(si.Hz, spectral())\n    except (AttributeError, UnitsError) as ex:\n        raise UnitsError(\"The 'rest' value must be a spectral equivalent \"\n                         \"(frequency, wavelength, or energy).\")\n\n\ndef pixel_scale(pixscale):\n    \"\"\"\n    Convert between pixel distances (in units of ``pix``) and other units,\n    given a particular ``pixscale``.\n\n    Parameters\n    ----------\n    pixscale : `~astropy.units.Quantity`\n        The pixel scale either in units of <unit>/pixel or pixel/<unit>.\n    \"\"\"\n\n    decomposed = pixscale.unit.decompose()\n    dimensions = dict(zip(decomposed.bases, decomposed.powers))\n    pix_power = dimensions.get(misc.pix, 0)\n\n    if pix_power == -1:\n        physical_unit = Unit(pixscale * misc.pix)\n    elif pix_power == 1:\n        physical_unit = Unit(misc.pix / pixscale)\n    else:\n        raise UnitsError(\n                \"The pixel scale unit must have\"\n                \" pixel dimensionality of 1 or -1.\")\n\n    return Equivalency([(misc.pix, physical_unit)],\n                       \"pixel_scale\", {'pixscale': pixscale})\n\n\ndef plate_scale(platescale):\n    \"\"\"\n    Convert between lengths (to be interpreted as lengths in the focal plane)\n    and angular units with a specified ``platescale``.\n\n    Parameters\n    ----------\n    platescale : `~astropy.units.Quantity`\n        The pixel scale either in units of distance/pixel or distance/angle.\n    \"\"\"\n    if platescale.unit.is_equivalent(si.arcsec/si.m):\n        platescale_val = platescale.to_value(si.radian/si.m)\n    elif platescale.unit.is_equivalent(si.m/si.arcsec):\n        platescale_val = (1/platescale).to_value(si.radian/si.m)\n    else:\n        raise UnitsError(\"The pixel scale must be in angle/distance or \"\n                         \"distance/angle\")\n\n    return Equivalency([(si.m, si.radian, lambda d: d*platescale_val,\n                         lambda rad: rad/platescale_val)],\n                       \"plate_scale\", {'platescale': platescale})\n\n\n# -------------------------------------------------------------------------\n\ndef __getattr__(attr):\n    if attr == \"with_H0\":\n        import warnings\n        from astropy.cosmology.units import with_H0\n        from astropy.utils.exceptions import AstropyDeprecationWarning\n\n        warnings.warn(\n            (\"`with_H0` is deprecated from `astropy.units.equivalencies` \"\n             \"since astropy 5.0 and may be removed in a future version. \"\n             \"Use `astropy.cosmology.units.with_H0` instead.\"),\n            AstropyDeprecationWarning)\n\n        return with_H0\n\n    raise AttributeError(f\"module {__name__!r} has no attribute {attr!r}.\")\n"},{"attributeType":"null","col":44,"comment":"null","endLoc":168,"id":9855,"name":"_generate_unit_summary","nodeType":"Attribute","startLoc":168,"text":"_generate_unit_summary"},{"col":0,"comment":"","endLoc":24,"header":"cds.py#<anonymous>","id":9856,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nThis package defines units used in the CDS format, both the units\ndefined in `Centre de Données astronomiques de Strasbourg\n<http://cds.u-strasbg.fr/>`_ `Standards for Astronomical Catalogues 2.0\n<http://vizier.u-strasbg.fr/vizier/doc/catstd-3.2.htx>`_ format and the `complete\nset of supported units <https://vizier.u-strasbg.fr/viz-bin/Unit>`_.\nThis format is used by VOTable up to version 1.2.\n\nThese units are not available in the top-level `astropy.units`\nnamespace.  To use these units, you must import the `astropy.units.cds`\nmodule::\n\n    >>> from astropy.units import cds\n    >>> q = 10. * cds.lyr  # doctest: +SKIP\n\nTo include them in `~astropy.units.UnitBase.compose` and the results of\n`~astropy.units.UnitBase.find_equivalent_units`, do::\n\n    >>> from astropy.units import cds\n    >>> cds.enable()  # doctest: +SKIP\n\"\"\"\n\n_ns = globals()\n\n_initialize_module()\n\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())"},{"col":0,"comment":"Allow angles to be equivalent to dimensionless (with 1 rad = 1 m/m = 1).\n\n    It is special compared to other equivalency pairs in that it\n    allows this independent of the power to which the angle is raised,\n    and independent of whether it is part of a more complicated unit.\n    ","endLoc":70,"header":"def dimensionless_angles()","id":9857,"name":"dimensionless_angles","nodeType":"Function","startLoc":63,"text":"def dimensionless_angles():\n    \"\"\"Allow angles to be equivalent to dimensionless (with 1 rad = 1 m/m = 1).\n\n    It is special compared to other equivalency pairs in that it\n    allows this independent of the power to which the angle is raised,\n    and independent of whether it is part of a more complicated unit.\n    \"\"\"\n    return Equivalency([(si.radian, None)], \"dimensionless_angles\")"},{"fileName":"required_by_vounit.py","filePath":"astropy/units","id":9858,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis package defines SI prefixed units that are required by the VOUnit standard\nbut that are rarely used in practice and liable to lead to confusion (such as\n``msolMass`` for milli-solar mass). They are in a separate module from\n`astropy.units.deprecated` because they need to be enabled by default for\n`astropy.units` to parse compliant VOUnit strings. As a result, e.g.,\n``Unit('msolMass')`` will just work, but to access the unit directly, use\n``astropy.units.required_by_vounit.msolMass`` instead of the more typical idiom\npossible for the non-prefixed unit, ``astropy.units.solMass``.\n\"\"\"\n\n_ns = globals()\n\n\ndef _initialize_module():\n    # Local imports to avoid polluting top-level namespace\n    from . import cgs\n    from . import astrophys\n    from .core import def_unit, _add_prefixes\n\n    _add_prefixes(astrophys.solMass, namespace=_ns, prefixes=True)\n    _add_prefixes(astrophys.solRad, namespace=_ns, prefixes=True)\n    _add_prefixes(astrophys.solLum, namespace=_ns, prefixes=True)\n\n\n_initialize_module()\n\n\n###########################################################################\n# DOCSTRING\n\n# This generates a docstring for this module that describes all of the\n# standard units defined here.\nfrom .utils import (generate_unit_summary as _generate_unit_summary,\n                    generate_prefixonly_unit_summary as _generate_prefixonly_unit_summary)\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())\n    __doc__ += _generate_prefixonly_unit_summary(globals())\n\n\ndef _enable():\n    \"\"\"\n    Enable the VOUnit-required extra units so they appear in results of\n    `~astropy.units.UnitBase.find_equivalent_units` and\n    `~astropy.units.UnitBase.compose`, and are recognized in the ``Unit('...')``\n    idiom.\n    \"\"\"\n    # Local import to avoid cyclical import\n    from .core import add_enabled_units\n    # Local import to avoid polluting namespace\n    import inspect\n    return add_enabled_units(inspect.getmodule(_enable))\n\n\n# Because these are VOUnit mandated units, they start enabled (which is why the\n# function is hidden).\n_enable()\n"},{"attributeType":"null","col":12,"comment":"null","endLoc":122,"id":9859,"name":"_non_prefix_units","nodeType":"Attribute","startLoc":122,"text":"self._non_prefix_units"},{"col":0,"comment":"Allow logarithmic units to be converted to dimensionless fractions","endLoc":78,"header":"def logarithmic()","id":9860,"name":"logarithmic","nodeType":"Function","startLoc":73,"text":"def logarithmic():\n    \"\"\"Allow logarithmic units to be converted to dimensionless fractions\"\"\"\n    return Equivalency([\n        (dimensionless_unscaled, function_units.dex,\n         np.log10, lambda x: 10.**x)\n    ], \"logarithmic\")"},{"col":19,"endLoc":77,"id":9861,"nodeType":"Lambda","startLoc":77,"text":"lambda x: 10.**x"},{"col":0,"comment":"null","endLoc":25,"header":"def _initialize_module()","id":9862,"name":"_initialize_module","nodeType":"Function","startLoc":17,"text":"def _initialize_module():\n    # Local imports to avoid polluting top-level namespace\n    from . import cgs\n    from . import astrophys\n    from .core import def_unit, _add_prefixes\n\n    _add_prefixes(astrophys.solMass, namespace=_ns, prefixes=True)\n    _add_prefixes(astrophys.solRad, namespace=_ns, prefixes=True)\n    _add_prefixes(astrophys.solLum, namespace=_ns, prefixes=True)"},{"col":0,"comment":"\n    Returns a list of equivalence pairs that handle spectral density\n    with regard to wavelength and frequency.\n\n    Parameters\n    ----------\n    wav : `~astropy.units.Quantity`\n        `~astropy.units.Quantity` associated with values being converted\n        (e.g., wavelength or frequency).\n\n    Notes\n    -----\n    The ``factor`` argument is left for backward-compatibility with the syntax\n    ``spectral_density(unit, factor)`` but users are encouraged to use\n    ``spectral_density(factor * unit)`` instead.\n\n    ","endLoc":304,"header":"def spectral_density(wav, factor=None)","id":9863,"name":"spectral_density","nodeType":"Function","startLoc":141,"text":"def spectral_density(wav, factor=None):\n    \"\"\"\n    Returns a list of equivalence pairs that handle spectral density\n    with regard to wavelength and frequency.\n\n    Parameters\n    ----------\n    wav : `~astropy.units.Quantity`\n        `~astropy.units.Quantity` associated with values being converted\n        (e.g., wavelength or frequency).\n\n    Notes\n    -----\n    The ``factor`` argument is left for backward-compatibility with the syntax\n    ``spectral_density(unit, factor)`` but users are encouraged to use\n    ``spectral_density(factor * unit)`` instead.\n\n    \"\"\"\n    from .core import UnitBase\n\n    if isinstance(wav, UnitBase):\n        if factor is None:\n            raise ValueError(\n                'If `wav` is specified as a unit, `factor` should be set')\n        wav = factor * wav   # Convert to Quantity\n    c_Aps = _si.c.to_value(si.AA / si.s)  # Angstrom/s\n    h_cgs = _si.h.cgs.value  # erg * s\n    hc = c_Aps * h_cgs\n\n    # flux density\n    f_la = cgs.erg / si.angstrom / si.cm ** 2 / si.s\n    f_nu = cgs.erg / si.Hz / si.cm ** 2 / si.s\n    nu_f_nu = cgs.erg / si.cm ** 2 / si.s\n    la_f_la = nu_f_nu\n    phot_f_la = astrophys.photon / (si.cm ** 2 * si.s * si.AA)\n    phot_f_nu = astrophys.photon / (si.cm ** 2 * si.s * si.Hz)\n    la_phot_f_la = astrophys.photon / (si.cm ** 2 * si.s)\n\n    # luminosity density\n    L_nu = cgs.erg / si.s / si.Hz\n    L_la = cgs.erg / si.s / si.angstrom\n    nu_L_nu = cgs.erg / si.s\n    la_L_la = nu_L_nu\n    phot_L_la = astrophys.photon / (si.s * si.AA)\n    phot_L_nu = astrophys.photon / (si.s * si.Hz)\n\n    # surface brightness (flux equiv)\n    S_la = cgs.erg / si.angstrom / si.cm ** 2 / si.s / si.sr\n    S_nu = cgs.erg / si.Hz / si.cm ** 2 / si.s / si.sr\n    nu_S_nu = cgs.erg / si.cm ** 2 / si.s / si.sr\n    la_S_la = nu_S_nu\n    phot_S_la = astrophys.photon / (si.cm ** 2 * si.s * si.AA * si.sr)\n    phot_S_nu = astrophys.photon / (si.cm ** 2 * si.s * si.Hz * si.sr)\n\n    # surface brightness (luminosity equiv)\n    SL_nu = cgs.erg / si.s / si.Hz / si.sr\n    SL_la = cgs.erg / si.s / si.angstrom / si.sr\n    nu_SL_nu = cgs.erg / si.s / si.sr\n    la_SL_la = nu_SL_nu\n    phot_SL_la = astrophys.photon / (si.s * si.AA * si.sr)\n    phot_SL_nu = astrophys.photon / (si.s * si.Hz * si.sr)\n\n    def converter(x):\n        return x * (wav.to_value(si.AA, spectral()) ** 2 / c_Aps)\n\n    def iconverter(x):\n        return x / (wav.to_value(si.AA, spectral()) ** 2 / c_Aps)\n\n    def converter_f_nu_to_nu_f_nu(x):\n        return x * wav.to_value(si.Hz, spectral())\n\n    def iconverter_f_nu_to_nu_f_nu(x):\n        return x / wav.to_value(si.Hz, spectral())\n\n    def converter_f_la_to_la_f_la(x):\n        return x * wav.to_value(si.AA, spectral())\n\n    def iconverter_f_la_to_la_f_la(x):\n        return x / wav.to_value(si.AA, spectral())\n\n    def converter_phot_f_la_to_f_la(x):\n        return hc * x / wav.to_value(si.AA, spectral())\n\n    def iconverter_phot_f_la_to_f_la(x):\n        return x * wav.to_value(si.AA, spectral()) / hc\n\n    def converter_phot_f_la_to_f_nu(x):\n        return h_cgs * x * wav.to_value(si.AA, spectral())\n\n    def iconverter_phot_f_la_to_f_nu(x):\n        return x / (wav.to_value(si.AA, spectral()) * h_cgs)\n\n    def converter_phot_f_la_phot_f_nu(x):\n        return x * wav.to_value(si.AA, spectral()) ** 2 / c_Aps\n\n    def iconverter_phot_f_la_phot_f_nu(x):\n        return c_Aps * x / wav.to_value(si.AA, spectral()) ** 2\n\n    converter_phot_f_nu_to_f_nu = converter_phot_f_la_to_f_la\n    iconverter_phot_f_nu_to_f_nu = iconverter_phot_f_la_to_f_la\n\n    def converter_phot_f_nu_to_f_la(x):\n        return x * hc * c_Aps / wav.to_value(si.AA, spectral()) ** 3\n\n    def iconverter_phot_f_nu_to_f_la(x):\n        return x * wav.to_value(si.AA, spectral()) ** 3 / (hc * c_Aps)\n\n    # for luminosity density\n    converter_L_nu_to_nu_L_nu = converter_f_nu_to_nu_f_nu\n    iconverter_L_nu_to_nu_L_nu = iconverter_f_nu_to_nu_f_nu\n    converter_L_la_to_la_L_la = converter_f_la_to_la_f_la\n    iconverter_L_la_to_la_L_la = iconverter_f_la_to_la_f_la\n\n    converter_phot_L_la_to_L_la = converter_phot_f_la_to_f_la\n    iconverter_phot_L_la_to_L_la = iconverter_phot_f_la_to_f_la\n    converter_phot_L_la_to_L_nu = converter_phot_f_la_to_f_nu\n    iconverter_phot_L_la_to_L_nu = iconverter_phot_f_la_to_f_nu\n    converter_phot_L_la_phot_L_nu = converter_phot_f_la_phot_f_nu\n    iconverter_phot_L_la_phot_L_nu = iconverter_phot_f_la_phot_f_nu\n    converter_phot_L_nu_to_L_nu = converter_phot_f_nu_to_f_nu\n    iconverter_phot_L_nu_to_L_nu = iconverter_phot_f_nu_to_f_nu\n    converter_phot_L_nu_to_L_la = converter_phot_f_nu_to_f_la\n    iconverter_phot_L_nu_to_L_la = iconverter_phot_f_nu_to_f_la\n\n    return Equivalency([\n        # flux\n        (f_la, f_nu, converter, iconverter),\n        (f_nu, nu_f_nu, converter_f_nu_to_nu_f_nu, iconverter_f_nu_to_nu_f_nu),\n        (f_la, la_f_la, converter_f_la_to_la_f_la, iconverter_f_la_to_la_f_la),\n        (phot_f_la, f_la, converter_phot_f_la_to_f_la, iconverter_phot_f_la_to_f_la),\n        (phot_f_la, f_nu, converter_phot_f_la_to_f_nu, iconverter_phot_f_la_to_f_nu),\n        (phot_f_la, phot_f_nu, converter_phot_f_la_phot_f_nu, iconverter_phot_f_la_phot_f_nu),\n        (phot_f_nu, f_nu, converter_phot_f_nu_to_f_nu, iconverter_phot_f_nu_to_f_nu),\n        (phot_f_nu, f_la, converter_phot_f_nu_to_f_la, iconverter_phot_f_nu_to_f_la),\n        # integrated flux\n        (la_phot_f_la, la_f_la, converter_phot_f_la_to_f_la, iconverter_phot_f_la_to_f_la),\n        # luminosity\n        (L_la, L_nu, converter, iconverter),\n        (L_nu, nu_L_nu, converter_L_nu_to_nu_L_nu, iconverter_L_nu_to_nu_L_nu),\n        (L_la, la_L_la, converter_L_la_to_la_L_la, iconverter_L_la_to_la_L_la),\n        (phot_L_la, L_la, converter_phot_L_la_to_L_la, iconverter_phot_L_la_to_L_la),\n        (phot_L_la, L_nu, converter_phot_L_la_to_L_nu, iconverter_phot_L_la_to_L_nu),\n        (phot_L_la, phot_L_nu, converter_phot_L_la_phot_L_nu, iconverter_phot_L_la_phot_L_nu),\n        (phot_L_nu, L_nu, converter_phot_L_nu_to_L_nu, iconverter_phot_L_nu_to_L_nu),\n        (phot_L_nu, L_la, converter_phot_L_nu_to_L_la, iconverter_phot_L_nu_to_L_la),\n        # surface brightness (flux equiv)\n        (S_la, S_nu, converter, iconverter),\n        (S_nu, nu_S_nu, converter_f_nu_to_nu_f_nu, iconverter_f_nu_to_nu_f_nu),\n        (S_la, la_S_la, converter_f_la_to_la_f_la, iconverter_f_la_to_la_f_la),\n        (phot_S_la, S_la, converter_phot_f_la_to_f_la, iconverter_phot_f_la_to_f_la),\n        (phot_S_la, S_nu, converter_phot_f_la_to_f_nu, iconverter_phot_f_la_to_f_nu),\n        (phot_S_la, phot_S_nu, converter_phot_f_la_phot_f_nu, iconverter_phot_f_la_phot_f_nu),\n        (phot_S_nu, S_nu, converter_phot_f_nu_to_f_nu, iconverter_phot_f_nu_to_f_nu),\n        (phot_S_nu, S_la, converter_phot_f_nu_to_f_la, iconverter_phot_f_nu_to_f_la),\n        # surface brightness (luminosity equiv)\n        (SL_la, SL_nu, converter, iconverter),\n        (SL_nu, nu_SL_nu, converter_L_nu_to_nu_L_nu, iconverter_L_nu_to_nu_L_nu),\n        (SL_la, la_SL_la, converter_L_la_to_la_L_la, iconverter_L_la_to_la_L_la),\n        (phot_SL_la, SL_la, converter_phot_L_la_to_L_la, iconverter_phot_L_la_to_L_la),\n        (phot_SL_la, SL_nu, converter_phot_L_la_to_L_nu, iconverter_phot_L_la_to_L_nu),\n        (phot_SL_la, phot_SL_nu, converter_phot_L_la_phot_L_nu, iconverter_phot_L_la_phot_L_nu),\n        (phot_SL_nu, SL_nu, converter_phot_L_nu_to_L_nu, iconverter_phot_L_nu_to_L_nu),\n        (phot_SL_nu, SL_la, converter_phot_L_nu_to_L_la, iconverter_phot_L_nu_to_L_la),\n    ], \"spectral_density\", {'wav': wav, 'factor': factor})"},{"attributeType":"null","col":12,"comment":"null","endLoc":118,"id":9864,"name":"_equivalencies","nodeType":"Attribute","startLoc":118,"text":"self._equivalencies"},{"attributeType":"null","col":12,"comment":"null","endLoc":120,"id":9865,"name":"_all_units","nodeType":"Attribute","startLoc":120,"text":"self._all_units"},{"col":0,"comment":"\n    Enable the VOUnit-required extra units so they appear in results of\n    `~astropy.units.UnitBase.find_equivalent_units` and\n    `~astropy.units.UnitBase.compose`, and are recognized in the ``Unit('...')``\n    idiom.\n    ","endLoc":54,"header":"def _enable()","id":9866,"name":"_enable","nodeType":"Function","startLoc":43,"text":"def _enable():\n    \"\"\"\n    Enable the VOUnit-required extra units so they appear in results of\n    `~astropy.units.UnitBase.find_equivalent_units` and\n    `~astropy.units.UnitBase.compose`, and are recognized in the ``Unit('...')``\n    idiom.\n    \"\"\"\n    # Local import to avoid cyclical import\n    from .core import add_enabled_units\n    # Local import to avoid polluting namespace\n    import inspect\n    return add_enabled_units(inspect.getmodule(_enable))"},{"attributeType":"null","col":12,"comment":"null","endLoc":121,"id":9867,"name":"_registry","nodeType":"Attribute","startLoc":121,"text":"self._registry"},{"attributeType":"null","col":12,"comment":"null","endLoc":126,"id":9868,"name":"_by_physical_type","nodeType":"Attribute","startLoc":126,"text":"self._by_physical_type"},{"className":"_UnitContext","col":0,"comment":"null","endLoc":335,"id":9869,"nodeType":"Class","startLoc":326,"text":"class _UnitContext:\n    def __init__(self, init=[], equivalencies=[]):\n        _unit_registries.append(\n            _UnitRegistry(init=init, equivalencies=equivalencies))\n\n    def __enter__(self):\n        pass\n\n    def __exit__(self, type, value, tb):\n        _unit_registries.pop()"},{"col":4,"comment":"null","endLoc":332,"header":"def __enter__(self)","id":9870,"name":"__enter__","nodeType":"Function","startLoc":331,"text":"def __enter__(self):\n        pass"},{"col":4,"comment":"null","endLoc":358,"header":"def _name_string_as_ordered_set(self)","id":9871,"name":"_name_string_as_ordered_set","nodeType":"Function","startLoc":357,"text":"def _name_string_as_ordered_set(self):\n        return \"{\" + str(self._physical_type_list)[1:-1] + \"}\""},{"col":4,"comment":"null","endLoc":335,"header":"def __exit__(self, type, value, tb)","id":9872,"name":"__exit__","nodeType":"Function","startLoc":334,"text":"def __exit__(self, type, value, tb):\n        _unit_registries.pop()"},{"col":4,"comment":"null","endLoc":365,"header":"def __repr__(self)","id":9873,"name":"__repr__","nodeType":"Function","startLoc":360,"text":"def __repr__(self):\n        if len(self._physical_type) == 1:\n            names = \"'\" + self._physical_type_list[0] + \"'\"\n        else:\n            names = self._name_string_as_ordered_set()\n        return f\"PhysicalType({names})\""},{"className":"UnitScaleError","col":0,"comment":"\n    Used to catch the errors involving scaled units,\n    which are not recognized by FITS format.\n    ","endLoc":596,"id":9874,"nodeType":"Class","startLoc":591,"text":"class UnitScaleError(UnitsError, ValueError):\n    \"\"\"\n    Used to catch the errors involving scaled units,\n    which are not recognized by FITS format.\n    \"\"\"\n    pass"},{"className":"UnitsWarning","col":0,"comment":"\n    The base class for unit-specific warnings.\n    ","endLoc":618,"id":9875,"nodeType":"Class","startLoc":615,"text":"class UnitsWarning(AstropyWarning):\n    \"\"\"\n    The base class for unit-specific warnings.\n    \"\"\""},{"className":"IrreducibleUnit","col":0,"comment":"\n    Irreducible units are the units that all other units are defined\n    in terms of.\n\n    Examples are meters, seconds, kilograms, amperes, etc.  There is\n    only once instance of such a unit per type.\n    ","endLoc":1891,"id":9876,"nodeType":"Class","startLoc":1845,"text":"class IrreducibleUnit(NamedUnit):\n    \"\"\"\n    Irreducible units are the units that all other units are defined\n    in terms of.\n\n    Examples are meters, seconds, kilograms, amperes, etc.  There is\n    only once instance of such a unit per type.\n    \"\"\"\n\n    def __reduce__(self):\n        # When IrreducibleUnit objects are passed to other processes\n        # over multiprocessing, they need to be recreated to be the\n        # ones already in the subprocesses' namespace, not new\n        # objects, or they will be considered \"unconvertible\".\n        # Therefore, we have a custom pickler/unpickler that\n        # understands how to recreate the Unit on the other side.\n        registry = get_current_unit_registry().registry\n        return (_recreate_irreducible_unit,\n                (self.__class__, list(self.names), self.name in registry),\n                self.__getstate__())\n\n    @property\n    def represents(self):\n        \"\"\"The unit that this named unit represents.\n\n        For an irreducible unit, that is always itself.\n        \"\"\"\n        return self\n\n    def decompose(self, bases=set()):\n        if len(bases) and self not in bases:\n            for base in bases:\n                try:\n                    scale = self._to(base)\n                except UnitsError:\n                    pass\n                else:\n                    if is_effectively_unity(scale):\n                        return base\n                    else:\n                        return CompositeUnit(scale, [base], [1],\n                                             _error_check=False)\n\n            raise UnitConversionError(\n                f\"Unit {self} can not be decomposed into the requested bases\")\n\n        return self"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":9877,"name":"_ns","nodeType":"Attribute","startLoc":14,"text":"_ns"},{"col":4,"comment":"null","endLoc":1864,"header":"def __reduce__(self)","id":9878,"name":"__reduce__","nodeType":"Function","startLoc":1854,"text":"def __reduce__(self):\n        # When IrreducibleUnit objects are passed to other processes\n        # over multiprocessing, they need to be recreated to be the\n        # ones already in the subprocesses' namespace, not new\n        # objects, or they will be considered \"unconvertible\".\n        # Therefore, we have a custom pickler/unpickler that\n        # understands how to recreate the Unit on the other side.\n        registry = get_current_unit_registry().registry\n        return (_recreate_irreducible_unit,\n                (self.__class__, list(self.names), self.name in registry),\n                self.__getstate__())"},{"col":4,"comment":"null","endLoc":368,"header":"def __str__(self)","id":9879,"name":"__str__","nodeType":"Function","startLoc":367,"text":"def __str__(self):\n        return \"/\".join(self._physical_type_list)"},{"col":4,"comment":"\n        Return a unit that corresponds to the provided argument.\n\n        If a unit is passed in, return that unit.  If a physical type\n        (or a `str` with the name of a physical type) is passed in,\n        return a unit that corresponds to that physical type.  If the\n        number equal to ``1`` is passed in, return a dimensionless unit.\n        Otherwise, return `NotImplemented`.\n        ","endLoc":390,"header":"@staticmethod\n    def _dimensionally_compatible_unit(obj)","id":9880,"name":"_dimensionally_compatible_unit","nodeType":"Function","startLoc":370,"text":"@staticmethod\n    def _dimensionally_compatible_unit(obj):\n        \"\"\"\n        Return a unit that corresponds to the provided argument.\n\n        If a unit is passed in, return that unit.  If a physical type\n        (or a `str` with the name of a physical type) is passed in,\n        return a unit that corresponds to that physical type.  If the\n        number equal to ``1`` is passed in, return a dimensionless unit.\n        Otherwise, return `NotImplemented`.\n        \"\"\"\n        if isinstance(obj, core.UnitBase):\n            return _replace_temperatures_with_kelvin(obj)\n        elif isinstance(obj, PhysicalType):\n            return obj._unit\n        elif isinstance(obj, numbers.Real) and obj == 1:\n            return core.dimensionless_unscaled\n        elif isinstance(obj, str):\n            return _physical_type_from_str(obj)._unit\n        else:\n            return NotImplemented"},{"attributeType":"null","col":45,"comment":"null","endLoc":36,"id":9881,"name":"_generate_unit_summary","nodeType":"Attribute","startLoc":36,"text":"_generate_unit_summary"},{"col":4,"comment":"null","endLoc":398,"header":"def _dimensional_analysis(self, other, operation)","id":9882,"name":"_dimensional_analysis","nodeType":"Function","startLoc":392,"text":"def _dimensional_analysis(self, other, operation):\n        other_unit = self._dimensionally_compatible_unit(other)\n        if other_unit is NotImplemented:\n            return NotImplemented\n        other_unit = _replace_temperatures_with_kelvin(other_unit)\n        new_unit = getattr(self._unit, operation)(other_unit)\n        return new_unit.physical_type"},{"attributeType":"null","col":56,"comment":"null","endLoc":37,"id":9883,"name":"_generate_prefixonly_unit_summary","nodeType":"Attribute","startLoc":37,"text":"_generate_prefixonly_unit_summary"},{"col":0,"comment":"","endLoc":12,"header":"required_by_vounit.py#<anonymous>","id":9884,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis package defines SI prefixed units that are required by the VOUnit standard\nbut that are rarely used in practice and liable to lead to confusion (such as\n``msolMass`` for milli-solar mass). They are in a separate module from\n`astropy.units.deprecated` because they need to be enabled by default for\n`astropy.units` to parse compliant VOUnit strings. As a result, e.g.,\n``Unit('msolMass')`` will just work, but to access the unit directly, use\n``astropy.units.required_by_vounit.msolMass`` instead of the more typical idiom\npossible for the non-prefixed unit, ``astropy.units.solMass``.\n\"\"\"\n\n_ns = globals()\n\n_initialize_module()\n\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())\n    __doc__ += _generate_prefixonly_unit_summary(globals())\n\n_enable()"},{"fileName":"decorators.py","filePath":"astropy/units","id":9885,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n__all__ = ['quantity_input']\n\nimport inspect\nfrom numbers import Number\nfrom collections.abc import Sequence\nfrom functools import wraps\n\nimport numpy as np\n\nfrom . import _typing as T\nfrom .core import (Unit, UnitBase, UnitsError,\n                   add_enabled_equivalencies, dimensionless_unscaled)\nfrom .function.core import FunctionUnitBase\nfrom .physical import PhysicalType, get_physical_type\nfrom .quantity import Quantity\nfrom .structured import StructuredUnit\n\n\nNoneType = type(None)\n\n\ndef _get_allowed_units(targets):\n    \"\"\"\n    From a list of target units (either as strings or unit objects) and physical\n    types, return a list of Unit objects.\n    \"\"\"\n    allowed_units = []\n    for target in targets:\n\n        try:\n            unit = Unit(target)\n        except (TypeError, ValueError):\n            try:\n                unit = get_physical_type(target)._unit\n            except (TypeError, ValueError, KeyError):  # KeyError for Enum\n                raise ValueError(f\"Invalid unit or physical type {target!r}.\") from None\n\n        allowed_units.append(unit)\n\n    return allowed_units\n\n\ndef _validate_arg_value(param_name, func_name, arg, targets, equivalencies,\n                        strict_dimensionless=False):\n    \"\"\"\n    Validates the object passed in to the wrapped function, ``arg``, with target\n    unit or physical type, ``target``.\n    \"\"\"\n\n    if len(targets) == 0:\n        return\n\n    allowed_units = _get_allowed_units(targets)\n\n    # If dimensionless is an allowed unit and the argument is unit-less,\n    #   allow numbers or numpy arrays with numeric dtypes\n    if (dimensionless_unscaled in allowed_units and not strict_dimensionless\n            and not hasattr(arg, \"unit\")):\n        if isinstance(arg, Number):\n            return\n\n        elif (isinstance(arg, np.ndarray)\n              and np.issubdtype(arg.dtype, np.number)):\n            return\n\n    for allowed_unit in allowed_units:\n        try:\n            is_equivalent = arg.unit.is_equivalent(allowed_unit,\n                                                   equivalencies=equivalencies)\n\n            if is_equivalent:\n                break\n\n        except AttributeError:  # Either there is no .unit or no .is_equivalent\n            if hasattr(arg, \"unit\"):\n                error_msg = (\"a 'unit' attribute without an 'is_equivalent' method\")\n            else:\n                error_msg = \"no 'unit' attribute\"\n\n            raise TypeError(f\"Argument '{param_name}' to function '{func_name}'\"\n                            f\" has {error_msg}. You should pass in an astropy \"\n                            \"Quantity instead.\")\n\n    else:\n        error_msg = (f\"Argument '{param_name}' to function '{func_name}' must \"\n                     \"be in units convertible to\")\n        if len(targets) > 1:\n            targ_names = \", \".join([f\"'{str(targ)}'\" for targ in targets])\n            raise UnitsError(f\"{error_msg} one of: {targ_names}.\")\n        else:\n            raise UnitsError(f\"{error_msg} '{str(targets[0])}'.\")\n\n\ndef _parse_annotation(target):\n\n    if target in (None, NoneType, inspect._empty):\n        return target\n\n    # check if unit-like\n    try:\n        unit = Unit(target)\n    except (TypeError, ValueError):\n        try:\n            ptype = get_physical_type(target)\n        except (TypeError, ValueError, KeyError):  # KeyError for Enum\n            if isinstance(target, str):\n                raise ValueError(f\"invalid unit or physical type {target!r}.\") from None\n        else:\n            return ptype\n    else:\n        return unit\n\n    # could be a type hint\n    origin = T.get_origin(target)\n    if origin is T.Union:\n        return [_parse_annotation(t) for t in T.get_args(target)]\n    elif origin is not T.Annotated:  # can't be Quantity[]\n        return False\n\n    # parse type hint\n    cls, *annotations = T.get_args(target)\n    if not issubclass(cls, Quantity) or not annotations:\n        return False\n\n    # get unit from type hint\n    unit, *rest = annotations\n    if not isinstance(unit, (UnitBase, PhysicalType)):\n        return False\n\n    return unit\n\n\nclass QuantityInput:\n\n    @classmethod\n    def as_decorator(cls, func=None, **kwargs):\n        r\"\"\"\n        A decorator for validating the units of arguments to functions.\n\n        Unit specifications can be provided as keyword arguments to the\n        decorator, or by using function annotation syntax. Arguments to the\n        decorator take precedence over any function annotations present.\n\n        A `~astropy.units.UnitsError` will be raised if the unit attribute of\n        the argument is not equivalent to the unit specified to the decorator or\n        in the annotation. If the argument has no unit attribute, i.e. it is not\n        a Quantity object, a `ValueError` will be raised unless the argument is\n        an annotation. This is to allow non Quantity annotations to pass\n        through.\n\n        Where an equivalency is specified in the decorator, the function will be\n        executed with that equivalency in force.\n\n        Notes\n        -----\n\n        The checking of arguments inside variable arguments to a function is not\n        supported (i.e. \\*arg or \\**kwargs).\n\n        The original function is accessible by the attributed ``__wrapped__``.\n        See :func:`functools.wraps` for details.\n\n        Examples\n        --------\n\n        .. code-block:: python\n\n            import astropy.units as u\n            @u.quantity_input(myangle=u.arcsec)\n            def myfunction(myangle):\n                return myangle**2\n\n\n        .. code-block:: python\n\n            import astropy.units as u\n            @u.quantity_input\n            def myfunction(myangle: u.arcsec):\n                return myangle**2\n\n        Or using a unit-aware Quantity annotation.\n\n        .. code-block:: python\n\n            @u.quantity_input\n            def myfunction(myangle: u.Quantity[u.arcsec]):\n                return myangle**2\n\n        Also you can specify a return value annotation, which will\n        cause the function to always return a `~astropy.units.Quantity` in that\n        unit.\n\n        .. code-block:: python\n\n            import astropy.units as u\n            @u.quantity_input\n            def myfunction(myangle: u.arcsec) -> u.deg**2:\n                return myangle**2\n\n        Using equivalencies::\n\n            import astropy.units as u\n            @u.quantity_input(myenergy=u.eV, equivalencies=u.mass_energy())\n            def myfunction(myenergy):\n                return myenergy**2\n\n        \"\"\"\n        self = cls(**kwargs)\n        if func is not None and not kwargs:\n            return self(func)\n        else:\n            return self\n\n    def __init__(self, func=None, strict_dimensionless=False, **kwargs):\n        self.equivalencies = kwargs.pop('equivalencies', [])\n        self.decorator_kwargs = kwargs\n        self.strict_dimensionless = strict_dimensionless\n\n    def __call__(self, wrapped_function):\n\n        # Extract the function signature for the function we are wrapping.\n        wrapped_signature = inspect.signature(wrapped_function)\n\n        # Define a new function to return in place of the wrapped one\n        @wraps(wrapped_function)\n        def wrapper(*func_args, **func_kwargs):\n            # Bind the arguments to our new function to the signature of the original.\n            bound_args = wrapped_signature.bind(*func_args, **func_kwargs)\n\n            # Iterate through the parameters of the original signature\n            for param in wrapped_signature.parameters.values():\n                # We do not support variable arguments (*args, **kwargs)\n                if param.kind in (inspect.Parameter.VAR_KEYWORD,\n                                  inspect.Parameter.VAR_POSITIONAL):\n                    continue\n\n                # Catch the (never triggered) case where bind relied on a default value.\n                if (param.name not in bound_args.arguments\n                        and param.default is not param.empty):\n                    bound_args.arguments[param.name] = param.default\n\n                # Get the value of this parameter (argument to new function)\n                arg = bound_args.arguments[param.name]\n\n                # Get target unit or physical type, either from decorator kwargs\n                #   or annotations\n                if param.name in self.decorator_kwargs:\n                    targets = self.decorator_kwargs[param.name]\n                    is_annotation = False\n                else:\n                    targets = param.annotation\n                    is_annotation = True\n\n                    # parses to unit if it's an annotation (or list thereof)\n                    targets = _parse_annotation(targets)\n\n                # If the targets is empty, then no target units or physical\n                #   types were specified so we can continue to the next arg\n                if targets is inspect.Parameter.empty:\n                    continue\n\n                # If the argument value is None, and the default value is None,\n                #   pass through the None even if there is a target unit\n                if arg is None and param.default is None:\n                    continue\n\n                # Here, we check whether multiple target unit/physical type's\n                #   were specified in the decorator/annotation, or whether a\n                #   single string (unit or physical type) or a Unit object was\n                #   specified\n                if (isinstance(targets, str)\n                        or not isinstance(targets, Sequence)):\n                    valid_targets = [targets]\n\n                # Check for None in the supplied list of allowed units and, if\n                #   present and the passed value is also None, ignore.\n                elif None in targets or NoneType in targets:\n                    if arg is None:\n                        continue\n                    else:\n                        valid_targets = [t for t in targets if t is not None]\n\n                else:\n                    valid_targets = targets\n\n                # If we're dealing with an annotation, skip all the targets that\n                #    are not strings or subclasses of Unit. This is to allow\n                #    non unit related annotations to pass through\n                if is_annotation:\n                    valid_targets = [t for t in valid_targets\n                                     if isinstance(t, (str, UnitBase, PhysicalType))]\n\n                # Now we loop over the allowed units/physical types and validate\n                #   the value of the argument:\n                _validate_arg_value(param.name, wrapped_function.__name__,\n                                    arg, valid_targets, self.equivalencies,\n                                    self.strict_dimensionless)\n\n            # Call the original function with any equivalencies in force.\n            with add_enabled_equivalencies(self.equivalencies):\n                return_ = wrapped_function(*func_args, **func_kwargs)\n\n            # Return\n            ra = wrapped_signature.return_annotation\n            valid_empty = (inspect.Signature.empty, None, NoneType, T.NoReturn)\n            if ra not in valid_empty:\n                target = (ra if T.get_origin(ra) not in (T.Annotated, T.Union)\n                          else _parse_annotation(ra))\n                if isinstance(target, str) or not isinstance(target, Sequence):\n                    target = [target]\n                valid_targets = [t for t in target\n                                 if isinstance(t, (str, UnitBase, PhysicalType))]\n                _validate_arg_value(\"return\", wrapped_function.__name__,\n                                    return_, valid_targets, self.equivalencies,\n                                    self.strict_dimensionless)\n                if len(valid_targets) > 0:\n                    return_ <<= valid_targets[0]\n            return return_\n\n        return wrapper\n\n\nquantity_input = QuantityInput.as_decorator\n"},{"col":0,"comment":"\n    Adds to the equivalencies enabled in the unit registry.\n\n    These equivalencies are used if no explicit equivalencies are given,\n    both in unit conversion and in finding equivalent units.\n\n    This is meant in particular for allowing angles to be dimensionless.\n    Since no equivalencies are enabled by default, generally it is recommended\n    to use `set_enabled_equivalencies`.\n\n    Parameters\n    ----------\n    equivalencies : list of tuple\n        list of equivalent pairs, e.g., as returned by\n        `~astropy.units.equivalencies.dimensionless_angles`.\n    ","endLoc":509,"header":"def add_enabled_equivalencies(equivalencies)","id":9886,"name":"add_enabled_equivalencies","nodeType":"Function","startLoc":488,"text":"def add_enabled_equivalencies(equivalencies):\n    \"\"\"\n    Adds to the equivalencies enabled in the unit registry.\n\n    These equivalencies are used if no explicit equivalencies are given,\n    both in unit conversion and in finding equivalent units.\n\n    This is meant in particular for allowing angles to be dimensionless.\n    Since no equivalencies are enabled by default, generally it is recommended\n    to use `set_enabled_equivalencies`.\n\n    Parameters\n    ----------\n    equivalencies : list of tuple\n        list of equivalent pairs, e.g., as returned by\n        `~astropy.units.equivalencies.dimensionless_angles`.\n    \"\"\"\n    # get a context with a new registry, which is a copy of the current one\n    context = _UnitContext(get_current_unit_registry())\n    # in this new current registry, enable the further equivalencies requested\n    get_current_unit_registry().add_enabled_equivalencies(equivalencies)\n    return context"},{"col":4,"comment":"null","endLoc":401,"header":"def __mul__(self, other)","id":9887,"name":"__mul__","nodeType":"Function","startLoc":400,"text":"def __mul__(self, other):\n        return self._dimensional_analysis(other, \"__mul__\")"},{"col":4,"comment":"null","endLoc":404,"header":"def __rmul__(self, other)","id":9888,"name":"__rmul__","nodeType":"Function","startLoc":403,"text":"def __rmul__(self, other):\n        return self.__mul__(other)"},{"className":"FunctionUnitBase","col":0,"comment":"Abstract base class for function units.\n\n    Function units are functions containing a physical unit, such as dB(mW).\n    Most of the arithmetic operations on function units are defined in this\n    base class.\n\n    While instantiation is defined, this class should not be used directly.\n    Rather, subclasses should be used that override the abstract properties\n    `_default_function_unit` and `_quantity_class`, and the abstract methods\n    `from_physical`, and `to_physical`.\n\n    Parameters\n    ----------\n    physical_unit : `~astropy.units.Unit` or `string`\n        Unit that is encapsulated within the function unit.\n        If not given, dimensionless.\n\n    function_unit :  `~astropy.units.Unit` or `string`\n        By default, the same as the function unit set by the subclass.\n    ","endLoc":406,"id":9889,"nodeType":"Class","startLoc":30,"text":"class FunctionUnitBase(metaclass=ABCMeta):\n    \"\"\"Abstract base class for function units.\n\n    Function units are functions containing a physical unit, such as dB(mW).\n    Most of the arithmetic operations on function units are defined in this\n    base class.\n\n    While instantiation is defined, this class should not be used directly.\n    Rather, subclasses should be used that override the abstract properties\n    `_default_function_unit` and `_quantity_class`, and the abstract methods\n    `from_physical`, and `to_physical`.\n\n    Parameters\n    ----------\n    physical_unit : `~astropy.units.Unit` or `string`\n        Unit that is encapsulated within the function unit.\n        If not given, dimensionless.\n\n    function_unit :  `~astropy.units.Unit` or `string`\n        By default, the same as the function unit set by the subclass.\n    \"\"\"\n    # ↓↓↓ the following four need to be set by subclasses\n    # Make this a property so we can ensure subclasses define it.\n    @property\n    @abstractmethod\n    def _default_function_unit(self):\n        \"\"\"Default function unit corresponding to the function.\n\n        This property should be overridden by subclasses, with, e.g.,\n        `~astropy.unit.MagUnit` returning `~astropy.unit.mag`.\n        \"\"\"\n\n    # This has to be a property because the function quantity will not be\n    # known at unit definition time, as it gets defined after.\n    @property\n    @abstractmethod\n    def _quantity_class(self):\n        \"\"\"Function quantity class corresponding to this function unit.\n\n        This property should be overridden by subclasses, with, e.g.,\n        `~astropy.unit.MagUnit` returning `~astropy.unit.Magnitude`.\n        \"\"\"\n\n    @abstractmethod\n    def from_physical(self, x):\n        \"\"\"Transformation from value in physical to value in function units.\n\n        This method should be overridden by subclasses.  It is used to\n        provide automatic transformations using an equivalency.\n        \"\"\"\n\n    @abstractmethod\n    def to_physical(self, x):\n        \"\"\"Transformation from value in function to value in physical units.\n\n        This method should be overridden by subclasses.  It is used to\n        provide automatic transformations using an equivalency.\n        \"\"\"\n    # ↑↑↑ the above four need to be set by subclasses\n\n    # have priority over arrays, regular units, and regular quantities\n    __array_priority__ = 30000\n\n    def __init__(self, physical_unit=None, function_unit=None):\n        if physical_unit is None:\n            self._physical_unit = dimensionless_unscaled\n        else:\n            self._physical_unit = Unit(physical_unit)\n            if (not isinstance(self._physical_unit, UnitBase) or\n                self._physical_unit.is_equivalent(\n                    self._default_function_unit)):\n                raise UnitConversionError(\"Unit {} is not a physical unit.\"\n                                          .format(self._physical_unit))\n\n        if function_unit is None:\n            self._function_unit = self._default_function_unit\n        else:\n            # any function unit should be equivalent to subclass default\n            function_unit = Unit(getattr(function_unit, 'function_unit',\n                                         function_unit))\n            if function_unit.is_equivalent(self._default_function_unit):\n                self._function_unit = function_unit\n            else:\n                raise UnitConversionError(\n                    \"Cannot initialize '{}' instance with function unit '{}'\"\n                    \", as it is not equivalent to default function unit '{}'.\"\n                    .format(self.__class__.__name__, function_unit,\n                            self._default_function_unit))\n\n    def _copy(self, physical_unit=None):\n        \"\"\"Copy oneself, possibly with a different physical unit.\"\"\"\n        if physical_unit is None:\n            physical_unit = self.physical_unit\n        return self.__class__(physical_unit, self.function_unit)\n\n    @property\n    def physical_unit(self):\n        return self._physical_unit\n\n    @property\n    def function_unit(self):\n        return self._function_unit\n\n    @property\n    def equivalencies(self):\n        \"\"\"List of equivalencies between function and physical units.\n\n        Uses the `from_physical` and `to_physical` methods.\n        \"\"\"\n        return [(self, self.physical_unit,\n                 self.to_physical, self.from_physical)]\n\n    # ↓↓↓ properties/methods required to behave like a unit\n    def decompose(self, bases=set()):\n        \"\"\"Copy the current unit with the physical unit decomposed.\n\n        For details, see `~astropy.units.UnitBase.decompose`.\n        \"\"\"\n        return self._copy(self.physical_unit.decompose(bases))\n\n    @property\n    def si(self):\n        \"\"\"Copy the current function unit with the physical unit in SI.\"\"\"\n        return self._copy(self.physical_unit.si)\n\n    @property\n    def cgs(self):\n        \"\"\"Copy the current function unit with the physical unit in CGS.\"\"\"\n        return self._copy(self.physical_unit.cgs)\n\n    def _get_physical_type_id(self):\n        \"\"\"Get physical type corresponding to physical unit.\"\"\"\n        return self.physical_unit._get_physical_type_id()\n\n    @property\n    def physical_type(self):\n        \"\"\"Return the physical type of the physical unit (e.g., 'length').\"\"\"\n        return self.physical_unit.physical_type\n\n    def is_equivalent(self, other, equivalencies=[]):\n        \"\"\"\n        Returns `True` if this unit is equivalent to ``other``.\n\n        Parameters\n        ----------\n        other : `~astropy.units.Unit`, string, or tuple\n            The unit to convert to. If a tuple of units is specified, this\n            method returns true if the unit matches any of those in the tuple.\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            This list is in addition to the built-in equivalencies between the\n            function unit and the physical one, as well as possible global\n            defaults set by, e.g., `~astropy.units.set_enabled_equivalencies`.\n            Use `None` to turn off any global equivalencies.\n\n        Returns\n        -------\n        bool\n        \"\"\"\n        if isinstance(other, tuple):\n            return any(self.is_equivalent(u, equivalencies=equivalencies)\n                       for u in other)\n\n        other_physical_unit = getattr(other, 'physical_unit', (\n            dimensionless_unscaled if self.function_unit.is_equivalent(other)\n            else other))\n\n        return self.physical_unit.is_equivalent(other_physical_unit,\n                                                equivalencies)\n\n    def to(self, other, value=1., equivalencies=[]):\n        \"\"\"\n        Return the converted values in the specified unit.\n\n        Parameters\n        ----------\n        other : `~astropy.units.Unit`, `~astropy.units.function.FunctionUnitBase`, or str\n            The unit to convert to.\n\n        value : int, float, or scalar array-like, optional\n            Value(s) in the current unit to be converted to the specified unit.\n            If not provided, defaults to 1.0.\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            This list is in meant to treat only equivalencies between different\n            physical units; the built-in equivalency between the function\n            unit and the physical one is automatically taken into account.\n\n        Returns\n        -------\n        values : scalar or array\n            Converted value(s). Input value sequences are returned as\n            numpy arrays.\n\n        Raises\n        ------\n        `~astropy.units.UnitsError`\n            If units are inconsistent.\n        \"\"\"\n        # conversion to one's own physical unit should be fastest\n        if other is self.physical_unit:\n            return self.to_physical(value)\n\n        other_function_unit = getattr(other, 'function_unit', other)\n        if self.function_unit.is_equivalent(other_function_unit):\n            # when other is an equivalent function unit:\n            # first convert physical units to other's physical units\n            other_physical_unit = getattr(other, 'physical_unit',\n                                          dimensionless_unscaled)\n            if self.physical_unit != other_physical_unit:\n                value_other_physical = self.physical_unit.to(\n                    other_physical_unit, self.to_physical(value),\n                    equivalencies)\n                # make function unit again, in own system\n                value = self.from_physical(value_other_physical)\n\n            # convert possible difference in function unit (e.g., dex->dB)\n            return self.function_unit.to(other_function_unit, value)\n\n        else:\n            try:\n                # when other is not a function unit\n                return self.physical_unit.to(other, self.to_physical(value),\n                                             equivalencies)\n            except UnitConversionError as e:\n                if self.function_unit == Unit('mag'):\n                    # One can get to raw magnitudes via math that strips the dimensions off.\n                    # Include extra information in the exception to remind users of this.\n                    msg = \"Did you perhaps subtract magnitudes so the unit got lost?\"\n                    e.args += (msg,)\n                    raise e\n                else:\n                    raise\n\n    def is_unity(self):\n        return False\n\n    def __eq__(self, other):\n        return (self.physical_unit == getattr(other, 'physical_unit',\n                                              dimensionless_unscaled) and\n                self.function_unit == getattr(other, 'function_unit', other))\n\n    def __ne__(self, other):\n        return not self.__eq__(other)\n\n    def __rlshift__(self, other):\n        \"\"\"Unit conversion operator ``<<``\"\"\"\n        try:\n            return self._quantity_class(other, self, copy=False, subok=True)\n        except Exception:\n            return NotImplemented\n\n    def __mul__(self, other):\n        if isinstance(other, (str, UnitBase, FunctionUnitBase)):\n            if self.physical_unit == dimensionless_unscaled:\n                # If dimensionless, drop back to normal unit and retry.\n                return self.function_unit * other\n            else:\n                raise UnitsError(\"Cannot multiply a function unit \"\n                                 \"with a physical dimension with any unit.\")\n        else:\n            # Anything not like a unit, try initialising as a function quantity.\n            try:\n                return self._quantity_class(other, unit=self)\n            except Exception:\n                return NotImplemented\n\n    def __rmul__(self, other):\n        return self.__mul__(other)\n\n    def __truediv__(self, other):\n        if isinstance(other, (str, UnitBase, FunctionUnitBase)):\n            if self.physical_unit == dimensionless_unscaled:\n                # If dimensionless, drop back to normal unit and retry.\n                return self.function_unit / other\n            else:\n                raise UnitsError(\"Cannot divide a function unit \"\n                                 \"with a physical dimension by any unit.\")\n        else:\n            # Anything not like a unit, try initialising as a function quantity.\n            try:\n                return self._quantity_class(1./other, unit=self)\n            except Exception:\n                return NotImplemented\n\n    def __rtruediv__(self, other):\n        if isinstance(other, (str, UnitBase, FunctionUnitBase)):\n            if self.physical_unit == dimensionless_unscaled:\n                # If dimensionless, drop back to normal unit and retry.\n                return other / self.function_unit\n            else:\n                raise UnitsError(\"Cannot divide a function unit \"\n                                 \"with a physical dimension into any unit\")\n        else:\n            # Don't know what to do with anything not like a unit.\n            return NotImplemented\n\n    def __pow__(self, power):\n        if power == 0:\n            return dimensionless_unscaled\n        elif power == 1:\n            return self._copy()\n\n        if self.physical_unit == dimensionless_unscaled:\n            return self.function_unit ** power\n\n        raise UnitsError(\"Cannot raise a function unit \"\n                         \"with a physical dimension to any power but 0 or 1.\")\n\n    def __pos__(self):\n        return self._copy()\n\n    def to_string(self, format='generic'):\n        \"\"\"\n        Output the unit in the given format as a string.\n\n        The physical unit is appended, within parentheses, to the function\n        unit, as in \"dB(mW)\", with both units set using the given format\n\n        Parameters\n        ----------\n        format : `astropy.units.format.Base` instance or str\n            The name of a format or a formatter object.  If not\n            provided, defaults to the generic format.\n        \"\"\"\n        if format not in ('generic', 'unscaled', 'latex'):\n            raise ValueError(\"Function units cannot be written in {} format. \"\n                             \"Only 'generic', 'unscaled' and 'latex' are \"\n                             \"supported.\".format(format))\n        self_str = self.function_unit.to_string(format)\n        pu_str = self.physical_unit.to_string(format)\n        if pu_str == '':\n            pu_str = '1'\n        if format == 'latex':\n            self_str += r'$\\mathrm{{\\left( {0} \\right)}}$'.format(\n                pu_str[1:-1])   # need to strip leading and trailing \"$\"\n        else:\n            self_str += f'({pu_str})'\n        return self_str\n\n    def __str__(self):\n        \"\"\"Return string representation for unit.\"\"\"\n        self_str = str(self.function_unit)\n        pu_str = str(self.physical_unit)\n        if pu_str:\n            self_str += f'({pu_str})'\n        return self_str\n\n    def __repr__(self):\n        # By default, try to give a representation using `Unit(<string>)`,\n        # with string such that parsing it would give the correct FunctionUnit.\n        if callable(self.function_unit):\n            return f'Unit(\"{self.to_string()}\")'\n\n        else:\n            return '{}(\"{}\"{})'.format(\n                self.__class__.__name__, self.physical_unit,\n                \"\" if self.function_unit is self._default_function_unit\n                else f', unit=\"{self.function_unit}\"')\n\n    def _repr_latex_(self):\n        \"\"\"\n        Generate latex representation of unit name.  This is used by\n        the IPython notebook to print a unit with a nice layout.\n\n        Returns\n        -------\n        Latex string\n        \"\"\"\n        return self.to_string('latex')\n\n    def __hash__(self):\n        return hash((self.function_unit, self.physical_unit))"},{"col":4,"comment":"null","endLoc":407,"header":"def __truediv__(self, other)","id":9890,"name":"__truediv__","nodeType":"Function","startLoc":406,"text":"def __truediv__(self, other):\n        return self._dimensional_analysis(other, \"__truediv__\")"},{"col":4,"comment":"null","endLoc":413,"header":"def __rtruediv__(self, other)","id":9891,"name":"__rtruediv__","nodeType":"Function","startLoc":409,"text":"def __rtruediv__(self, other):\n        other = self._dimensionally_compatible_unit(other)\n        if other is NotImplemented:\n            return NotImplemented\n        return other.physical_type._dimensional_analysis(self, \"__truediv__\")"},{"col":4,"comment":"null","endLoc":416,"header":"def __pow__(self, power)","id":9892,"name":"__pow__","nodeType":"Function","startLoc":415,"text":"def __pow__(self, power):\n        return (self._unit ** power).physical_type"},{"col":4,"comment":"null","endLoc":419,"header":"def __hash__(self)","id":9893,"name":"__hash__","nodeType":"Function","startLoc":418,"text":"def __hash__(self):\n        return hash(self._physical_type_id)"},{"col":4,"comment":"null","endLoc":422,"header":"def __len__(self)","id":9894,"name":"__len__","nodeType":"Function","startLoc":421,"text":"def __len__(self):\n        return len(self._physical_type)"},{"attributeType":"None","col":4,"comment":"null","endLoc":429,"id":9895,"name":"__array__","nodeType":"Attribute","startLoc":429,"text":"__array__"},{"attributeType":"{_get_physical_type_id}","col":8,"comment":"null","endLoc":313,"id":9896,"name":"_unit","nodeType":"Attribute","startLoc":313,"text":"self._unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":314,"id":9897,"name":"_physical_type_id","nodeType":"Attribute","startLoc":314,"text":"self._physical_type_id"},{"attributeType":"null","col":8,"comment":"null","endLoc":315,"id":9898,"name":"_physical_type","nodeType":"Attribute","startLoc":315,"text":"self._physical_type"},{"attributeType":"null","col":8,"comment":"null","endLoc":316,"id":9899,"name":"_physical_type_list","nodeType":"Attribute","startLoc":316,"text":"self._physical_type_list"},{"col":0,"comment":"\n    Add a mapping between a unit and the corresponding physical type(s).\n\n    If a physical type already exists for a unit, add new physical type\n    names so long as those names are not already in use for other\n    physical types.\n\n    Parameters\n    ----------\n    unit : `~astropy.units.Unit`\n        The unit to be represented by the physical type.\n\n    name : `str` or `set` of `str`\n        A `str` representing the name of the physical type of the unit,\n        or a `set` containing strings that represent one or more names\n        of physical types.\n\n    Raises\n    ------\n    ValueError\n        If a physical type name is already in use for another unit, or\n        if attempting to name a unit as ``\"unknown\"``.\n    ","endLoc":486,"header":"def def_physical_type(unit, name)","id":9900,"name":"def_physical_type","nodeType":"Function","startLoc":432,"text":"def def_physical_type(unit, name):\n    \"\"\"\n    Add a mapping between a unit and the corresponding physical type(s).\n\n    If a physical type already exists for a unit, add new physical type\n    names so long as those names are not already in use for other\n    physical types.\n\n    Parameters\n    ----------\n    unit : `~astropy.units.Unit`\n        The unit to be represented by the physical type.\n\n    name : `str` or `set` of `str`\n        A `str` representing the name of the physical type of the unit,\n        or a `set` containing strings that represent one or more names\n        of physical types.\n\n    Raises\n    ------\n    ValueError\n        If a physical type name is already in use for another unit, or\n        if attempting to name a unit as ``\"unknown\"``.\n    \"\"\"\n    physical_type_id = unit._get_physical_type_id()\n    physical_type_names = _standardize_physical_type_names(name)\n\n    if \"unknown\" in physical_type_names:\n        raise ValueError(\"cannot uniquely define an unknown physical type\")\n\n    names_for_other_units = set(_unit_physical_mapping.keys()).difference(\n        _physical_unit_mapping.get(physical_type_id, {}))\n    names_already_in_use = physical_type_names & names_for_other_units\n    if names_already_in_use:\n        raise ValueError(\n            f\"the following physical type names are already in use: \"\n            f\"{names_already_in_use}.\")\n\n    unit_already_in_use = physical_type_id in _physical_unit_mapping\n    if unit_already_in_use:\n        physical_type = _physical_unit_mapping[physical_type_id]\n        physical_type_names |= set(physical_type)\n        physical_type.__init__(unit, physical_type_names)\n    else:\n        physical_type = PhysicalType(unit, physical_type_names)\n        _physical_unit_mapping[physical_type_id] = physical_type\n\n    for ptype in physical_type:\n        _unit_physical_mapping[ptype] = physical_type_id\n\n    for ptype_name in physical_type_names:\n        _name_physical_mapping[ptype_name] = physical_type\n        # attribute-accessible name\n        attr_name = ptype_name.replace(' ', '_').replace('(', '').replace(')', '')\n        _attrname_physical_mapping[attr_name] = physical_type"},{"col":4,"comment":"The unit that this named unit represents.\n\n        For an irreducible unit, that is always itself.\n        ","endLoc":1872,"header":"@property\n    def represents(self)","id":9901,"name":"represents","nodeType":"Function","startLoc":1866,"text":"@property\n    def represents(self):\n        \"\"\"The unit that this named unit represents.\n\n        For an irreducible unit, that is always itself.\n        \"\"\"\n        return self"},{"col":4,"comment":"null","endLoc":1891,"header":"def decompose(self, bases=set())","id":9902,"name":"decompose","nodeType":"Function","startLoc":1874,"text":"def decompose(self, bases=set()):\n        if len(bases) and self not in bases:\n            for base in bases:\n                try:\n                    scale = self._to(base)\n                except UnitsError:\n                    pass\n                else:\n                    if is_effectively_unity(scale):\n                        return base\n                    else:\n                        return CompositeUnit(scale, [base], [1],\n                                             _error_check=False)\n\n            raise UnitConversionError(\n                f\"Unit {self} can not be decomposed into the requested bases\")\n\n        return self"},{"col":0,"comment":"null","endLoc":196,"header":"@pytest.fixture(params=[False, True])\ndef T1(request)","id":9903,"name":"T1","nodeType":"Function","startLoc":179,"text":"@pytest.fixture(params=[False, True])\ndef T1(request):\n    T = Table.read([' a b c d',\n                    ' 2 c 7.0 0',\n                    ' 2 b 5.0 1',\n                    ' 2 b 6.0 2',\n                    ' 2 a 4.0 3',\n                    ' 0 a 0.0 4',\n                    ' 1 b 3.0 5',\n                    ' 1 a 2.0 6',\n                    ' 1 a 1.0 7',\n                    ], format='ascii')\n    T.meta.update({'ta': 1})\n    T['c'].meta.update({'a': 1})\n    T['c'].description = 'column c'\n    if request.param:\n        T.add_index('a')\n    return T"},{"col":0,"comment":"\n    Return the equivalency pairs for the radio convention for velocity.\n\n    The radio convention for the relation between velocity and frequency is:\n\n    :math:`V = c \\frac{f_0 - f}{f_0}  ;  f(V) = f_0 ( 1 - V/c )`\n\n    Parameters\n    ----------\n    rest : `~astropy.units.Quantity`\n        Any quantity supported by the standard spectral equivalencies\n        (wavelength, energy, frequency, wave number).\n\n    References\n    ----------\n    `NRAO site defining the conventions <https://www.gb.nrao.edu/~fghigo/gbtdoc/doppler.html>`_\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> CO_restfreq = 115.27120*u.GHz  # rest frequency of 12 CO 1-0 in GHz\n    >>> radio_CO_equiv = u.doppler_radio(CO_restfreq)\n    >>> measured_freq = 115.2832*u.GHz\n    >>> radio_velocity = measured_freq.to(u.km/u.s, equivalencies=radio_CO_equiv)\n    >>> radio_velocity  # doctest: +FLOAT_CMP\n    <Quantity -31.209092088877583 km / s>\n    ","endLoc":369,"header":"def doppler_radio(rest)","id":9904,"name":"doppler_radio","nodeType":"Function","startLoc":307,"text":"def doppler_radio(rest):\n    r\"\"\"\n    Return the equivalency pairs for the radio convention for velocity.\n\n    The radio convention for the relation between velocity and frequency is:\n\n    :math:`V = c \\frac{f_0 - f}{f_0}  ;  f(V) = f_0 ( 1 - V/c )`\n\n    Parameters\n    ----------\n    rest : `~astropy.units.Quantity`\n        Any quantity supported by the standard spectral equivalencies\n        (wavelength, energy, frequency, wave number).\n\n    References\n    ----------\n    `NRAO site defining the conventions <https://www.gb.nrao.edu/~fghigo/gbtdoc/doppler.html>`_\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> CO_restfreq = 115.27120*u.GHz  # rest frequency of 12 CO 1-0 in GHz\n    >>> radio_CO_equiv = u.doppler_radio(CO_restfreq)\n    >>> measured_freq = 115.2832*u.GHz\n    >>> radio_velocity = measured_freq.to(u.km/u.s, equivalencies=radio_CO_equiv)\n    >>> radio_velocity  # doctest: +FLOAT_CMP\n    <Quantity -31.209092088877583 km / s>\n    \"\"\"\n\n    assert_is_spectral_unit(rest)\n\n    ckms = _si.c.to_value('km/s')\n\n    def to_vel_freq(x):\n        restfreq = rest.to_value(si.Hz, equivalencies=spectral())\n        return (restfreq-x) / (restfreq) * ckms\n\n    def from_vel_freq(x):\n        restfreq = rest.to_value(si.Hz, equivalencies=spectral())\n        voverc = x/ckms\n        return restfreq * (1-voverc)\n\n    def to_vel_wav(x):\n        restwav = rest.to_value(si.AA, spectral())\n        return (x-restwav) / (x) * ckms\n\n    def from_vel_wav(x):\n        restwav = rest.to_value(si.AA, spectral())\n        return restwav * ckms / (ckms-x)\n\n    def to_vel_en(x):\n        resten = rest.to_value(si.eV, equivalencies=spectral())\n        return (resten-x) / (resten) * ckms\n\n    def from_vel_en(x):\n        resten = rest.to_value(si.eV, equivalencies=spectral())\n        voverc = x/ckms\n        return resten * (1-voverc)\n\n    return Equivalency([(si.Hz, si.km/si.s, to_vel_freq, from_vel_freq),\n                        (si.AA, si.km/si.s, to_vel_wav, from_vel_wav),\n                        (si.eV, si.km/si.s, to_vel_en, from_vel_en),\n                        ], \"doppler_radio\", {'rest': rest})"},{"col":4,"comment":"Default function unit corresponding to the function.\n\n        This property should be overridden by subclasses, with, e.g.,\n        `~astropy.unit.MagUnit` returning `~astropy.unit.mag`.\n        ","endLoc":60,"header":"@property\n    @abstractmethod\n    def _default_function_unit(self)","id":9905,"name":"_default_function_unit","nodeType":"Function","startLoc":53,"text":"@property\n    @abstractmethod\n    def _default_function_unit(self):\n        \"\"\"Default function unit corresponding to the function.\n\n        This property should be overridden by subclasses, with, e.g.,\n        `~astropy.unit.MagUnit` returning `~astropy.unit.mag`.\n        \"\"\""},{"col":4,"comment":"Function quantity class corresponding to this function unit.\n\n        This property should be overridden by subclasses, with, e.g.,\n        `~astropy.unit.MagUnit` returning `~astropy.unit.Magnitude`.\n        ","endLoc":71,"header":"@property\n    @abstractmethod\n    def _quantity_class(self)","id":9906,"name":"_quantity_class","nodeType":"Function","startLoc":64,"text":"@property\n    @abstractmethod\n    def _quantity_class(self):\n        \"\"\"Function quantity class corresponding to this function unit.\n\n        This property should be overridden by subclasses, with, e.g.,\n        `~astropy.unit.MagUnit` returning `~astropy.unit.Magnitude`.\n        \"\"\""},{"col":4,"comment":"Transformation from value in physical to value in function units.\n\n        This method should be overridden by subclasses.  It is used to\n        provide automatic transformations using an equivalency.\n        ","endLoc":79,"header":"@abstractmethod\n    def from_physical(self, x)","id":9907,"name":"from_physical","nodeType":"Function","startLoc":73,"text":"@abstractmethod\n    def from_physical(self, x):\n        \"\"\"Transformation from value in physical to value in function units.\n\n        This method should be overridden by subclasses.  It is used to\n        provide automatic transformations using an equivalency.\n        \"\"\""},{"col":4,"comment":"Transformation from value in function to value in physical units.\n\n        This method should be overridden by subclasses.  It is used to\n        provide automatic transformations using an equivalency.\n        ","endLoc":87,"header":"@abstractmethod\n    def to_physical(self, x)","id":9908,"name":"to_physical","nodeType":"Function","startLoc":81,"text":"@abstractmethod\n    def to_physical(self, x):\n        \"\"\"Transformation from value in function to value in physical units.\n\n        This method should be overridden by subclasses.  It is used to\n        provide automatic transformations using an equivalency.\n        \"\"\""},{"col":4,"comment":"null","endLoc":117,"header":"def __init__(self, physical_unit=None, function_unit=None)","id":9909,"name":"__init__","nodeType":"Function","startLoc":93,"text":"def __init__(self, physical_unit=None, function_unit=None):\n        if physical_unit is None:\n            self._physical_unit = dimensionless_unscaled\n        else:\n            self._physical_unit = Unit(physical_unit)\n            if (not isinstance(self._physical_unit, UnitBase) or\n                self._physical_unit.is_equivalent(\n                    self._default_function_unit)):\n                raise UnitConversionError(\"Unit {} is not a physical unit.\"\n                                          .format(self._physical_unit))\n\n        if function_unit is None:\n            self._function_unit = self._default_function_unit\n        else:\n            # any function unit should be equivalent to subclass default\n            function_unit = Unit(getattr(function_unit, 'function_unit',\n                                         function_unit))\n            if function_unit.is_equivalent(self._default_function_unit):\n                self._function_unit = function_unit\n            else:\n                raise UnitConversionError(\n                    \"Cannot initialize '{}' instance with function unit '{}'\"\n                    \", as it is not equivalent to default function unit '{}'.\"\n                    .format(self.__class__.__name__, function_unit,\n                            self._default_function_unit))"},{"col":0,"comment":"Checks for physical types using lazy import.\n\n    This also allows user-defined physical types to be accessible from the\n    :mod:`astropy.units.physical` module.\n    See `PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_\n\n    Parameters\n    ----------\n    name : str\n        The name of the attribute in this module. If it is already defined,\n        then this function is not called.\n\n    Returns\n    -------\n    ptype : `~astropy.units.physical.PhysicalType`\n\n    Raises\n    ------\n    AttributeError\n        If the ``name`` does not correspond to a physical type\n    ","endLoc":587,"header":"def __getattr__(name)","id":9910,"name":"__getattr__","nodeType":"Function","startLoc":562,"text":"def __getattr__(name):\n    \"\"\"Checks for physical types using lazy import.\n\n    This also allows user-defined physical types to be accessible from the\n    :mod:`astropy.units.physical` module.\n    See `PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_\n\n    Parameters\n    ----------\n    name : str\n        The name of the attribute in this module. If it is already defined,\n        then this function is not called.\n\n    Returns\n    -------\n    ptype : `~astropy.units.physical.PhysicalType`\n\n    Raises\n    ------\n    AttributeError\n        If the ``name`` does not correspond to a physical type\n    \"\"\"\n    if name in _attrname_physical_mapping:\n        return _attrname_physical_mapping[name]\n\n    raise AttributeError(f\"module {__name__!r} has no attribute {name!r}\")"},{"col":0,"comment":"Return contents directory (__all__ + all physical type names).","endLoc":592,"header":"def __dir__()","id":9911,"name":"__dir__","nodeType":"Function","startLoc":590,"text":"def __dir__():\n    \"\"\"Return contents directory (__all__ + all physical type names).\"\"\"\n    return list(set(__all__) | set(_attrname_physical_mapping.keys()))"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":9912,"name":"__all__","nodeType":"Attribute","startLoc":17,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":9913,"name":"_units_and_physical_types","nodeType":"Attribute","startLoc":19,"text":"_units_and_physical_types"},{"attributeType":"null","col":0,"comment":"null","endLoc":130,"id":9914,"name":"_physical_unit_mapping","nodeType":"Attribute","startLoc":130,"text":"_physical_unit_mapping"},{"attributeType":"null","col":0,"comment":"null","endLoc":131,"id":9915,"name":"_unit_physical_mapping","nodeType":"Attribute","startLoc":131,"text":"_unit_physical_mapping"},{"attributeType":"null","col":0,"comment":"null","endLoc":132,"id":9916,"name":"_name_physical_mapping","nodeType":"Attribute","startLoc":132,"text":"_name_physical_mapping"},{"attributeType":"null","col":0,"comment":"null","endLoc":134,"id":9917,"name":"_attrname_physical_mapping","nodeType":"Attribute","startLoc":134,"text":"_attrname_physical_mapping"},{"attributeType":"null","col":4,"comment":"null","endLoc":557,"id":9918,"name":"unit","nodeType":"Attribute","startLoc":557,"text":"unit"},{"col":0,"comment":"\n    Return the equivalency pairs for the optical convention for velocity.\n\n    The optical convention for the relation between velocity and frequency is:\n\n    :math:`V = c \\frac{f_0 - f}{f  }  ;  f(V) = f_0 ( 1 + V/c )^{-1}`\n\n    Parameters\n    ----------\n    rest : `~astropy.units.Quantity`\n        Any quantity supported by the standard spectral equivalencies\n        (wavelength, energy, frequency, wave number).\n\n    References\n    ----------\n    `NRAO site defining the conventions <https://www.gb.nrao.edu/~fghigo/gbtdoc/doppler.html>`_\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> CO_restfreq = 115.27120*u.GHz  # rest frequency of 12 CO 1-0 in GHz\n    >>> optical_CO_equiv = u.doppler_optical(CO_restfreq)\n    >>> measured_freq = 115.2832*u.GHz\n    >>> optical_velocity = measured_freq.to(u.km/u.s, equivalencies=optical_CO_equiv)\n    >>> optical_velocity  # doctest: +FLOAT_CMP\n    <Quantity -31.20584348799674 km / s>\n    ","endLoc":435,"header":"def doppler_optical(rest)","id":9919,"name":"doppler_optical","nodeType":"Function","startLoc":372,"text":"def doppler_optical(rest):\n    r\"\"\"\n    Return the equivalency pairs for the optical convention for velocity.\n\n    The optical convention for the relation between velocity and frequency is:\n\n    :math:`V = c \\frac{f_0 - f}{f  }  ;  f(V) = f_0 ( 1 + V/c )^{-1}`\n\n    Parameters\n    ----------\n    rest : `~astropy.units.Quantity`\n        Any quantity supported by the standard spectral equivalencies\n        (wavelength, energy, frequency, wave number).\n\n    References\n    ----------\n    `NRAO site defining the conventions <https://www.gb.nrao.edu/~fghigo/gbtdoc/doppler.html>`_\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> CO_restfreq = 115.27120*u.GHz  # rest frequency of 12 CO 1-0 in GHz\n    >>> optical_CO_equiv = u.doppler_optical(CO_restfreq)\n    >>> measured_freq = 115.2832*u.GHz\n    >>> optical_velocity = measured_freq.to(u.km/u.s, equivalencies=optical_CO_equiv)\n    >>> optical_velocity  # doctest: +FLOAT_CMP\n    <Quantity -31.20584348799674 km / s>\n    \"\"\"\n\n    assert_is_spectral_unit(rest)\n\n    ckms = _si.c.to_value('km/s')\n\n    def to_vel_freq(x):\n        restfreq = rest.to_value(si.Hz, equivalencies=spectral())\n        return ckms * (restfreq-x) / x\n\n    def from_vel_freq(x):\n        restfreq = rest.to_value(si.Hz, equivalencies=spectral())\n        voverc = x/ckms\n        return restfreq / (1+voverc)\n\n    def to_vel_wav(x):\n        restwav = rest.to_value(si.AA, spectral())\n        return ckms * (x/restwav-1)\n\n    def from_vel_wav(x):\n        restwav = rest.to_value(si.AA, spectral())\n        voverc = x/ckms\n        return restwav * (1+voverc)\n\n    def to_vel_en(x):\n        resten = rest.to_value(si.eV, equivalencies=spectral())\n        return ckms * (resten-x) / x\n\n    def from_vel_en(x):\n        resten = rest.to_value(si.eV, equivalencies=spectral())\n        voverc = x/ckms\n        return resten / (1+voverc)\n\n    return Equivalency([(si.Hz, si.km/si.s, to_vel_freq, from_vel_freq),\n                        (si.AA, si.km/si.s, to_vel_wav, from_vel_wav),\n                        (si.eV, si.km/si.s, to_vel_en, from_vel_en),\n                        ], \"doppler_optical\", {'rest': rest})"},{"attributeType":"null","col":10,"comment":"null","endLoc":557,"id":9920,"name":"physical_type","nodeType":"Attribute","startLoc":557,"text":"physical_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":598,"id":9921,"name":"doclines","nodeType":"Attribute","startLoc":598,"text":"doclines"},{"attributeType":"null","col":8,"comment":"null","endLoc":607,"id":9922,"name":"name","nodeType":"Attribute","startLoc":607,"text":"name"},{"attributeType":"null","col":8,"comment":"null","endLoc":608,"id":9923,"name":"physical_type","nodeType":"Attribute","startLoc":608,"text":"physical_type"},{"col":0,"comment":"","endLoc":3,"header":"physical.py#<anonymous>","id":9924,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"Defines the physical types that correspond to different units.\"\"\"\n\n__all__ = [\"def_physical_type\", \"get_physical_type\", \"PhysicalType\"]\n\n_units_and_physical_types = [\n    (core.dimensionless_unscaled, \"dimensionless\"),\n    (si.m, \"length\"),\n    (si.m ** 2, \"area\"),\n    (si.m ** 3, \"volume\"),\n    (si.s, \"time\"),\n    (si.rad, \"angle\"),\n    (si.sr, \"solid angle\"),\n    (si.m / si.s, {\"speed\", \"velocity\"}),\n    (si.m / si.s ** 2, \"acceleration\"),\n    (si.Hz, \"frequency\"),\n    (si.g, \"mass\"),\n    (si.mol, \"amount of substance\"),\n    (si.K, \"temperature\"),\n    (si.W * si.m ** -1 * si.K ** -1, \"thermal conductivity\"),\n    (si.J * si.K ** -1, {\"heat capacity\", \"entropy\"}),\n    (si.J * si.K ** -1 * si.kg ** -1, {\"specific heat capacity\", \"specific entropy\"}),\n    (si.N, \"force\"),\n    (si.J, {\"energy\", \"work\", \"torque\"}),\n    (si.J * si.m ** -2 * si.s ** -1, {\"energy flux\", \"irradiance\"}),\n    (si.Pa, {\"pressure\", \"energy density\", \"stress\"}),\n    (si.W, {\"power\", \"radiant flux\"}),\n    (si.kg * si.m ** -3, \"mass density\"),\n    (si.m ** 3 / si.kg, \"specific volume\"),\n    (si.mol / si.m ** 3, \"molar concentration\"),\n    (si.m ** 3 / si.mol, \"molar volume\"),\n    (si.kg * si.m / si.s, {\"momentum\", \"impulse\"}),\n    (si.kg * si.m ** 2 / si.s, {\"angular momentum\", \"action\"}),\n    (si.rad / si.s, {\"angular speed\", \"angular velocity\", \"angular frequency\"}),\n    (si.rad / si.s ** 2, \"angular acceleration\"),\n    (si.rad / si.m, \"plate scale\"),\n    (si.g / (si.m * si.s), \"dynamic viscosity\"),\n    (si.m ** 2 / si.s, {\"diffusivity\", \"kinematic viscosity\"}),\n    (si.m ** -1, \"wavenumber\"),\n    (si.m ** -2, \"column density\"),\n    (si.A, \"electrical current\"),\n    (si.C, \"electrical charge\"),\n    (si.V, \"electrical potential\"),\n    (si.Ohm, {\"electrical resistance\", \"electrical impedance\", \"electrical reactance\"}),\n    (si.Ohm * si.m, \"electrical resistivity\"),\n    (si.S, \"electrical conductance\"),\n    (si.S / si.m, \"electrical conductivity\"),\n    (si.F, \"electrical capacitance\"),\n    (si.C * si.m, \"electrical dipole moment\"),\n    (si.A / si.m ** 2, \"electrical current density\"),\n    (si.V / si.m, \"electrical field strength\"),\n    (si.C / si.m ** 2,\n        {\"electrical flux density\", \"surface charge density\", \"polarization density\"},\n    ),\n    (si.C / si.m ** 3, \"electrical charge density\"),\n    (si.F / si.m, \"permittivity\"),\n    (si.Wb, \"magnetic flux\"),\n    (si.T, \"magnetic flux density\"),\n    (si.A / si.m, \"magnetic field strength\"),\n    (si.m ** 2 * si.A, \"magnetic moment\"),\n    (si.H / si.m, {\"electromagnetic field strength\", \"permeability\"}),\n    (si.H, \"inductance\"),\n    (si.cd, \"luminous intensity\"),\n    (si.lm, \"luminous flux\"),\n    (si.lx, {\"luminous emittance\", \"illuminance\"}),\n    (si.W / si.sr, \"radiant intensity\"),\n    (si.cd / si.m ** 2, \"luminance\"),\n    (si.m ** -3 * si.s ** -1, \"volumetric rate\"),\n    (astrophys.Jy, \"spectral flux density\"),\n    (si.W * si.m ** 2 * si.Hz ** -1, \"surface tension\"),\n    (si.J * si.m ** -3 * si.s ** -1, {\"spectral flux density wav\", \"power density\"}),\n    (astrophys.photon / si.Hz / si.cm ** 2 / si.s, \"photon flux density\"),\n    (astrophys.photon / si.AA / si.cm ** 2 / si.s, \"photon flux density wav\"),\n    (astrophys.R, \"photon flux\"),\n    (misc.bit, \"data quantity\"),\n    (misc.bit / si.s, \"bandwidth\"),\n    (cgs.Franklin, \"electrical charge (ESU)\"),\n    (cgs.statampere, \"electrical current (ESU)\"),\n    (cgs.Biot, \"electrical current (EMU)\"),\n    (cgs.abcoulomb, \"electrical charge (EMU)\"),\n    (si.m * si.s ** -3, {\"jerk\", \"jolt\"}),\n    (si.m * si.s ** -4, {\"snap\", \"jounce\"}),\n    (si.m * si.s ** -5, \"crackle\"),\n    (si.m * si.s ** -6, {\"pop\", \"pounce\"}),\n    (si.K / si.m, \"temperature gradient\"),\n    (si.J / si.kg, \"specific energy\"),\n    (si.mol * si.m ** -3 * si.s ** -1, \"reaction rate\"),\n    (si.kg * si.m ** 2, \"moment of inertia\"),\n    (si.mol / si.s, \"catalytic activity\"),\n    (si.J * si.K ** -1 * si.mol ** -1, \"molar heat capacity\"),\n    (si.mol / si.kg, \"molality\"),\n    (si.m * si.s, \"absement\"),\n    (si.m * si.s ** 2, \"absity\"),\n    (si.m ** 3 / si.s, \"volumetric flow rate\"),\n    (si.s ** -2, \"frequency drift\"),\n    (si.Pa ** -1, \"compressibility\"),\n    (astrophys.electron * si.m ** -3, \"electron density\"),\n    (astrophys.electron * si.m ** -2 * si.s ** -1, \"electron flux\"),\n    (si.kg / si.m ** 2, \"surface mass density\"),\n    (si.W / si.m ** 2 / si.sr, \"radiance\"),\n    (si.J / si.mol, \"chemical potential\"),\n    (si.kg / si.m, \"linear density\"),\n    (si.H ** -1, \"magnetic reluctance\"),\n    (si.W / si.K, \"thermal conductance\"),\n    (si.K / si.W, \"thermal resistance\"),\n    (si.K * si.m / si.W, \"thermal resistivity\"),\n    (si.N / si.s, \"yank\"),\n    (si.S * si.m ** 2 / si.mol, \"molar conductivity\"),\n    (si.m ** 2 / si.V / si.s, \"electrical mobility\"),\n    (si.lumen / si.W, \"luminous efficacy\"),\n    (si.m ** 2 / si.kg, {\"opacity\", \"mass attenuation coefficient\"}),\n    (si.kg * si.m ** -2 * si.s ** -1, {\"mass flux\", \"momentum density\"}),\n    (si.m ** -3, \"number density\"),\n    (si.m ** -2 * si.s ** -1, \"particle flux\"),\n]\n\n_physical_unit_mapping = {}\n\n_unit_physical_mapping = {}\n\n_name_physical_mapping = {}\n\n_attrname_physical_mapping = {}\n\nfor unit, physical_type in _units_and_physical_types:\n    def_physical_type(unit, physical_type)\n\nif __doc__ is not None:\n    doclines = [\n        \".. list-table:: Defined Physical Types\",\n        \"    :header-rows: 1\",\n        \"    :widths: 30 10 50\",\n        \"\",\n        \"    * - Physical type\",\n        \"      - Unit\",\n        \"      - Other physical type(s) with same unit\"]\n\n    for name in sorted(_name_physical_mapping.keys()):\n        physical_type = _name_physical_mapping[name]\n        doclines.extend([\n            f\"    * - _`{name}`\",\n            f\"      - :math:`{physical_type._unit.to_string('latex')[1:-1]}`\",\n            f\"      - {', '.join([n for n in physical_type if n != name])}\"])\n\n    __doc__ += '\\n\\n' + '\\n'.join(doclines)\n\ndel unit, physical_type"},{"col":0,"comment":"\n    Returns the equivalence between amu and molar mass.\n    ","endLoc":542,"header":"def molar_mass_amu()","id":9925,"name":"molar_mass_amu","nodeType":"Function","startLoc":536,"text":"def molar_mass_amu():\n    \"\"\"\n    Returns the equivalence between amu and molar mass.\n    \"\"\"\n    return Equivalency([\n        (si.g/si.mol, misc.u)\n    ], \"molar_mass_amu\")"},{"col":0,"comment":"\n    Returns a list of equivalence pairs that handle the conversion\n    between mass and energy.\n    ","endLoc":561,"header":"def mass_energy()","id":9926,"name":"mass_energy","nodeType":"Function","startLoc":545,"text":"def mass_energy():\n    \"\"\"\n    Returns a list of equivalence pairs that handle the conversion\n    between mass and energy.\n    \"\"\"\n\n    return Equivalency([(si.kg, si.J, lambda x: x * _si.c.value ** 2,\n                         lambda x: x / _si.c.value ** 2),\n                        (si.kg / si.m ** 2, si.J / si.m ** 2,\n                         lambda x: x * _si.c.value ** 2,\n                         lambda x: x / _si.c.value ** 2),\n                        (si.kg / si.m ** 3, si.J / si.m ** 3,\n                         lambda x: x * _si.c.value ** 2,\n                         lambda x: x / _si.c.value ** 2),\n                        (si.kg / si.s, si.J / si.s, lambda x: x * _si.c.value ** 2,\n                         lambda x: x / _si.c.value ** 2),\n                        ], \"mass_energy\")"},{"col":38,"endLoc":551,"id":9927,"nodeType":"Lambda","startLoc":551,"text":"lambda x: x * _si.c.value ** 2"},{"col":25,"endLoc":552,"id":9928,"nodeType":"Lambda","startLoc":552,"text":"lambda x: x / _si.c.value ** 2"},{"col":25,"endLoc":554,"id":9929,"nodeType":"Lambda","startLoc":554,"text":"lambda x: x * _si.c.value ** 2"},{"col":25,"endLoc":555,"id":9930,"nodeType":"Lambda","startLoc":555,"text":"lambda x: x / _si.c.value ** 2"},{"col":25,"endLoc":557,"id":9931,"nodeType":"Lambda","startLoc":557,"text":"lambda x: x * _si.c.value ** 2"},{"col":25,"endLoc":558,"id":9932,"nodeType":"Lambda","startLoc":558,"text":"lambda x: x / _si.c.value ** 2"},{"col":52,"endLoc":559,"id":9933,"nodeType":"Lambda","startLoc":559,"text":"lambda x: x * _si.c.value ** 2"},{"col":25,"endLoc":560,"id":9934,"nodeType":"Lambda","startLoc":560,"text":"lambda x: x / _si.c.value ** 2"},{"col":0,"comment":"\n    Defines the conversion between Jy/sr and \"brightness temperature\",\n    :math:`T_B`, in Kelvins.  The brightness temperature is a unit very\n    commonly used in radio astronomy.  See, e.g., \"Tools of Radio Astronomy\"\n    (Wilson 2009) eqn 8.16 and eqn 8.19 (these pages are available on `google\n    books\n    <https://books.google.com/books?id=9KHw6R8rQEMC&pg=PA179&source=gbs_toc_r&cad=4#v=onepage&q&f=false>`__).\n\n    :math:`T_B \\equiv S_\\nu / \\left(2 k \\nu^2 / c^2 \\right)`\n\n    If the input is in Jy/beam or Jy (assuming it came from a single beam), the\n    beam area is essential for this computation: the brightness temperature is\n    inversely proportional to the beam area.\n\n    Parameters\n    ----------\n    frequency : `~astropy.units.Quantity`\n        The observed ``spectral`` equivalent `~astropy.units.Unit` (e.g.,\n        frequency or wavelength).  The variable is named 'frequency' because it\n        is more commonly used in radio astronomy.\n        BACKWARD COMPATIBILITY NOTE: previous versions of the brightness\n        temperature equivalency used the keyword ``disp``, which is no longer\n        supported.\n    beam_area : `~astropy.units.Quantity` ['solid angle']\n        Beam area in angular units, i.e. steradian equivalent\n\n    Examples\n    --------\n    Arecibo C-band beam::\n\n        >>> import numpy as np\n        >>> from astropy import units as u\n        >>> beam_sigma = 50*u.arcsec\n        >>> beam_area = 2*np.pi*(beam_sigma)**2\n        >>> freq = 5*u.GHz\n        >>> equiv = u.brightness_temperature(freq)\n        >>> (1*u.Jy/beam_area).to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        <Quantity 3.526295144567176 K>\n\n    VLA synthetic beam::\n\n        >>> bmaj = 15*u.arcsec\n        >>> bmin = 15*u.arcsec\n        >>> fwhm_to_sigma = 1./(8*np.log(2))**0.5\n        >>> beam_area = 2.*np.pi*(bmaj*bmin*fwhm_to_sigma**2)\n        >>> freq = 5*u.GHz\n        >>> equiv = u.brightness_temperature(freq)\n        >>> (u.Jy/beam_area).to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        <Quantity 217.2658703625732 K>\n\n    Any generic surface brightness:\n\n        >>> surf_brightness = 1e6*u.MJy/u.sr\n        >>> surf_brightness.to(u.K, equivalencies=u.brightness_temperature(500*u.GHz)) # doctest: +FLOAT_CMP\n        <Quantity 130.1931904778803 K>\n    ","endLoc":657,"header":"def brightness_temperature(frequency, beam_area=None)","id":9935,"name":"brightness_temperature","nodeType":"Function","startLoc":564,"text":"def brightness_temperature(frequency, beam_area=None):\n    r\"\"\"\n    Defines the conversion between Jy/sr and \"brightness temperature\",\n    :math:`T_B`, in Kelvins.  The brightness temperature is a unit very\n    commonly used in radio astronomy.  See, e.g., \"Tools of Radio Astronomy\"\n    (Wilson 2009) eqn 8.16 and eqn 8.19 (these pages are available on `google\n    books\n    <https://books.google.com/books?id=9KHw6R8rQEMC&pg=PA179&source=gbs_toc_r&cad=4#v=onepage&q&f=false>`__).\n\n    :math:`T_B \\equiv S_\\nu / \\left(2 k \\nu^2 / c^2 \\right)`\n\n    If the input is in Jy/beam or Jy (assuming it came from a single beam), the\n    beam area is essential for this computation: the brightness temperature is\n    inversely proportional to the beam area.\n\n    Parameters\n    ----------\n    frequency : `~astropy.units.Quantity`\n        The observed ``spectral`` equivalent `~astropy.units.Unit` (e.g.,\n        frequency or wavelength).  The variable is named 'frequency' because it\n        is more commonly used in radio astronomy.\n        BACKWARD COMPATIBILITY NOTE: previous versions of the brightness\n        temperature equivalency used the keyword ``disp``, which is no longer\n        supported.\n    beam_area : `~astropy.units.Quantity` ['solid angle']\n        Beam area in angular units, i.e. steradian equivalent\n\n    Examples\n    --------\n    Arecibo C-band beam::\n\n        >>> import numpy as np\n        >>> from astropy import units as u\n        >>> beam_sigma = 50*u.arcsec\n        >>> beam_area = 2*np.pi*(beam_sigma)**2\n        >>> freq = 5*u.GHz\n        >>> equiv = u.brightness_temperature(freq)\n        >>> (1*u.Jy/beam_area).to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        <Quantity 3.526295144567176 K>\n\n    VLA synthetic beam::\n\n        >>> bmaj = 15*u.arcsec\n        >>> bmin = 15*u.arcsec\n        >>> fwhm_to_sigma = 1./(8*np.log(2))**0.5\n        >>> beam_area = 2.*np.pi*(bmaj*bmin*fwhm_to_sigma**2)\n        >>> freq = 5*u.GHz\n        >>> equiv = u.brightness_temperature(freq)\n        >>> (u.Jy/beam_area).to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        <Quantity 217.2658703625732 K>\n\n    Any generic surface brightness:\n\n        >>> surf_brightness = 1e6*u.MJy/u.sr\n        >>> surf_brightness.to(u.K, equivalencies=u.brightness_temperature(500*u.GHz)) # doctest: +FLOAT_CMP\n        <Quantity 130.1931904778803 K>\n    \"\"\"  # noqa: E501\n    if frequency.unit.is_equivalent(si.sr):\n        if not beam_area.unit.is_equivalent(si.Hz):\n            raise ValueError(\"The inputs to `brightness_temperature` are \"\n                             \"frequency and angular area.\")\n        warnings.warn(\"The inputs to `brightness_temperature` have changed. \"\n                      \"Frequency is now the first input, and angular area \"\n                      \"is the second, optional input.\",\n                      AstropyDeprecationWarning)\n        frequency, beam_area = beam_area, frequency\n\n    nu = frequency.to(si.GHz, spectral())\n\n    if beam_area is not None:\n        beam = beam_area.to_value(si.sr)\n\n        def convert_Jy_to_K(x_jybm):\n            factor = (2 * _si.k_B * si.K * nu**2 / _si.c**2).to(astrophys.Jy).value\n            return (x_jybm / beam / factor)\n\n        def convert_K_to_Jy(x_K):\n            factor = (astrophys.Jy / (2 * _si.k_B * nu**2 / _si.c**2)).to(si.K).value\n            return (x_K * beam / factor)\n\n        return Equivalency([(astrophys.Jy, si.K, convert_Jy_to_K, convert_K_to_Jy),\n                            (astrophys.Jy/astrophys.beam, si.K, convert_Jy_to_K, convert_K_to_Jy)],\n                           \"brightness_temperature\", {'frequency': frequency, 'beam_area': beam_area})  # noqa: E501\n    else:\n        def convert_JySr_to_K(x_jysr):\n            factor = (2 * _si.k_B * si.K * nu**2 / _si.c**2).to(astrophys.Jy).value\n            return (x_jysr / factor)\n\n        def convert_K_to_JySr(x_K):\n            factor = (astrophys.Jy / (2 * _si.k_B * nu**2 / _si.c**2)).to(si.K).value\n            return (x_K / factor)  # multiplied by 1x for 1 steradian\n\n        return Equivalency([(astrophys.Jy/si.sr, si.K, convert_JySr_to_K, convert_K_to_JySr)],\n                           \"brightness_temperature\", {'frequency': frequency, 'beam_area': beam_area})  # noqa: E501"},{"col":4,"comment":"Copy oneself, possibly with a different physical unit.","endLoc":123,"header":"def _copy(self, physical_unit=None)","id":9936,"name":"_copy","nodeType":"Function","startLoc":119,"text":"def _copy(self, physical_unit=None):\n        \"\"\"Copy oneself, possibly with a different physical unit.\"\"\"\n        if physical_unit is None:\n            physical_unit = self.physical_unit\n        return self.__class__(physical_unit, self.function_unit)"},{"col":4,"comment":"null","endLoc":127,"header":"@property\n    def physical_unit(self)","id":9937,"name":"physical_unit","nodeType":"Function","startLoc":125,"text":"@property\n    def physical_unit(self):\n        return self._physical_unit"},{"col":4,"comment":"null","endLoc":131,"header":"@property\n    def function_unit(self)","id":9938,"name":"function_unit","nodeType":"Function","startLoc":129,"text":"@property\n    def function_unit(self):\n        return self._function_unit"},{"col":4,"comment":"List of equivalencies between function and physical units.\n\n        Uses the `from_physical` and `to_physical` methods.\n        ","endLoc":140,"header":"@property\n    def equivalencies(self)","id":9939,"name":"equivalencies","nodeType":"Function","startLoc":133,"text":"@property\n    def equivalencies(self):\n        \"\"\"List of equivalencies between function and physical units.\n\n        Uses the `from_physical` and `to_physical` methods.\n        \"\"\"\n        return [(self, self.physical_unit,\n                 self.to_physical, self.from_physical)]"},{"col":4,"comment":"Copy the current unit with the physical unit decomposed.\n\n        For details, see `~astropy.units.UnitBase.decompose`.\n        ","endLoc":148,"header":"def decompose(self, bases=set())","id":9940,"name":"decompose","nodeType":"Function","startLoc":143,"text":"def decompose(self, bases=set()):\n        \"\"\"Copy the current unit with the physical unit decomposed.\n\n        For details, see `~astropy.units.UnitBase.decompose`.\n        \"\"\"\n        return self._copy(self.physical_unit.decompose(bases))"},{"col":0,"comment":"null","endLoc":201,"header":"@pytest.fixture(params=[Table, QTable])\ndef operation_table_type(request)","id":9941,"name":"operation_table_type","nodeType":"Function","startLoc":199,"text":"@pytest.fixture(params=[Table, QTable])\ndef operation_table_type(request):\n    return request.param"},{"attributeType":"null","col":16,"comment":"null","endLoc":17,"id":9942,"name":"np","nodeType":"Attribute","startLoc":17,"text":"np"},{"attributeType":"null","col":29,"comment":"null","endLoc":23,"id":9943,"name":"u","nodeType":"Attribute","startLoc":23,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":133,"id":9944,"name":"MIXIN_COLS","nodeType":"Attribute","startLoc":133,"text":"MIXIN_COLS"},{"col":0,"comment":"","endLoc":10,"header":"conftest.py#<anonymous>","id":9945,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nAll of the pytest fixtures used by astropy.table are defined here.\n\n`conftest.py` is a \"special\" module name for pytest that is always\nimported, but is not looked in for tests, and it is the recommended\nplace to put fixtures that are shared between modules.  These fixtures\ncan not be defined in a module by a different name and still be shared\nbetween modules.\n\"\"\"\n\nMIXIN_COLS = {'quantity': [0, 1, 2, 3] * u.m,\n              'longitude': coordinates.Longitude([0., 1., 5., 6.] * u.deg,\n                                                 wrap_angle=180. * u.deg),\n              'latitude': coordinates.Latitude([5., 6., 10., 11.] * u.deg),\n              'time': time.Time([2000, 2001, 2002, 2003], format='jyear'),\n              'timedelta': time.TimeDelta([1, 2, 3, 4], format='jd'),\n              'skycoord': coordinates.SkyCoord(ra=[0, 1, 2, 3] * u.deg,\n                                               dec=[0, 1, 2, 3] * u.deg),\n              'sphericalrep': coordinates.SphericalRepresentation(\n                  [0, 1, 2, 3]*u.deg, [0, 1, 2, 3]*u.deg, 1*u.kpc),\n              'cartesianrep': coordinates.CartesianRepresentation(\n                  [0, 1, 2, 3]*u.pc, [4, 5, 6, 7]*u.pc, [9, 8, 8, 6]*u.pc),\n              'sphericaldiff': coordinates.SphericalCosLatDifferential(\n                  [0, 1, 2, 3]*u.mas/u.yr, [0, 1, 2, 3]*u.mas/u.yr,\n                  10*u.km/u.s),\n              'arraywrap': ArrayWrapper([0, 1, 2, 3]),\n              'arrayswap': ArrayWrapper(np.arange(4, dtype='i').byteswap().newbyteorder()),\n              'ndarraylil': np.array([(7, 'a'), (8, 'b'), (9, 'c'), (9, 'c')],\n                                  dtype='<i4,|S1').view(table.NdarrayMixin),\n              'ndarraybig': np.array([(7, 'a'), (8, 'b'), (9, 'c'), (9, 'c')],\n                                  dtype='>i4,|S1').view(table.NdarrayMixin),\n              }\n\nMIXIN_COLS['earthlocation'] = coordinates.EarthLocation(\n    lon=MIXIN_COLS['longitude'], lat=MIXIN_COLS['latitude'],\n    height=MIXIN_COLS['quantity'])\n\nMIXIN_COLS['sphericalrepdiff'] = coordinates.SphericalRepresentation(\n    MIXIN_COLS['sphericalrep'], differentials=MIXIN_COLS['sphericaldiff'])"},{"col":4,"comment":"Copy the current function unit with the physical unit in SI.","endLoc":153,"header":"@property\n    def si(self)","id":9946,"name":"si","nodeType":"Function","startLoc":150,"text":"@property\n    def si(self):\n        \"\"\"Copy the current function unit with the physical unit in SI.\"\"\"\n        return self._copy(self.physical_unit.si)"},{"col":4,"comment":"Copy the current function unit with the physical unit in CGS.","endLoc":158,"header":"@property\n    def cgs(self)","id":9947,"name":"cgs","nodeType":"Function","startLoc":155,"text":"@property\n    def cgs(self):\n        \"\"\"Copy the current function unit with the physical unit in CGS.\"\"\"\n        return self._copy(self.physical_unit.cgs)"},{"id":9948,"name":"astropy/units/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/units/tests","id":9949,"nodeType":"File","text":""},{"col":4,"comment":"Get physical type corresponding to physical unit.","endLoc":162,"header":"def _get_physical_type_id(self)","id":9950,"name":"_get_physical_type_id","nodeType":"Function","startLoc":160,"text":"def _get_physical_type_id(self):\n        \"\"\"Get physical type corresponding to physical unit.\"\"\"\n        return self.physical_unit._get_physical_type_id()"},{"id":9951,"name":"astropy/units/format","nodeType":"Package"},{"fileName":"cds_parsetab.py","filePath":"astropy/units/format","id":9952,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# This file was automatically generated from ply. To re-generate this file,\n# remove it from this folder, then build astropy and run the tests in-place:\n#\n#   python setup.py build_ext --inplace\n#   pytest astropy/units\n#\n# You can then commit the changes to this file.\n\n\n# cds_parsetab.py\n# This file is automatically generated. Do not edit.\n# pylint: disable=W,C,R\n_tabversion = '3.10'\n\n_lr_method = 'LALR'\n\n_lr_signature = 'CLOSE_BRACKET CLOSE_PAREN DIMENSIONLESS DIVISION OPEN_BRACKET OPEN_PAREN PRODUCT SIGN UFLOAT UINT UNIT X\\n            main : factor combined_units\\n                 | combined_units\\n                 | DIMENSIONLESS\\n                 | OPEN_BRACKET combined_units CLOSE_BRACKET\\n                 | OPEN_BRACKET DIMENSIONLESS CLOSE_BRACKET\\n                 | factor\\n            \\n            combined_units : product_of_units\\n                           | division_of_units\\n            \\n            product_of_units : unit_expression PRODUCT combined_units\\n                             | unit_expression\\n            \\n            division_of_units : DIVISION unit_expression\\n                              | unit_expression DIVISION combined_units\\n            \\n            unit_expression : unit_with_power\\n                            | OPEN_PAREN combined_units CLOSE_PAREN\\n            \\n            factor : signed_float X UINT signed_int\\n                   | UINT X UINT signed_int\\n                   | UINT signed_int\\n                   | UINT\\n                   | signed_float\\n            \\n            unit_with_power : UNIT numeric_power\\n                            | UNIT\\n            \\n            numeric_power : sign UINT\\n            \\n            sign : SIGN\\n                 |\\n            \\n            signed_int : SIGN UINT\\n            \\n            signed_float : sign UINT\\n                         | sign UFLOAT\\n            '\n    \n_lr_action_items = {'DIMENSIONLESS':([0,5,],[4,19,]),'OPEN_BRACKET':([0,],[5,]),'UINT':([0,10,13,16,20,21,23,31,],[7,24,-23,-24,34,35,36,40,]),'DIVISION':([0,2,5,6,7,11,14,15,16,22,24,25,26,27,30,36,39,40,41,42,],[12,12,12,-19,-18,27,-13,12,-21,-17,-26,-27,12,12,-20,-25,-14,-22,-15,-16,]),'SIGN':([0,7,16,34,35,],[13,23,13,23,23,]),'UFLOAT':([0,10,13,],[-24,25,-23,]),'OPEN_PAREN':([0,2,5,6,7,12,15,22,24,25,26,27,36,41,42,],[15,15,15,-19,-18,15,15,-17,-26,-27,15,15,-25,-15,-16,]),'UNIT':([0,2,5,6,7,12,15,22,24,25,26,27,36,41,42,],[16,16,16,-19,-18,16,16,-17,-26,-27,16,16,-25,-15,-16,]),'$end':([1,2,3,4,6,7,8,9,11,14,16,17,22,24,25,28,30,32,33,36,37,38,39,40,41,42,],[0,-6,-2,-3,-19,-18,-7,-8,-10,-13,-21,-1,-17,-26,-27,-11,-20,-4,-5,-25,-9,-12,-14,-22,-15,-16,]),'X':([6,7,24,25,],[20,21,-26,-27,]),'CLOSE_BRACKET':([8,9,11,14,16,18,19,28,30,37,38,39,40,],[-7,-8,-10,-13,-21,32,33,-11,-20,-9,-12,-14,-22,]),'CLOSE_PAREN':([8,9,11,14,16,28,29,30,37,38,39,40,],[-7,-8,-10,-13,-21,-11,39,-20,-9,-12,-14,-22,]),'PRODUCT':([11,14,16,30,39,40,],[26,-13,-21,-20,-14,-22,]),}\n\n_lr_action = {}\nfor _k, _v in _lr_action_items.items():\n   for _x,_y in zip(_v[0],_v[1]):\n      if not _x in _lr_action:  _lr_action[_x] = {}\n      _lr_action[_x][_k] = _y\ndel _lr_action_items\n\n_lr_goto_items = {'main':([0,],[1,]),'factor':([0,],[2,]),'combined_units':([0,2,5,15,26,27,],[3,17,18,29,37,38,]),'signed_float':([0,],[6,]),'product_of_units':([0,2,5,15,26,27,],[8,8,8,8,8,8,]),'division_of_units':([0,2,5,15,26,27,],[9,9,9,9,9,9,]),'sign':([0,16,],[10,31,]),'unit_expression':([0,2,5,12,15,26,27,],[11,11,11,28,11,11,11,]),'unit_with_power':([0,2,5,12,15,26,27,],[14,14,14,14,14,14,14,]),'signed_int':([7,34,35,],[22,41,42,]),'numeric_power':([16,],[30,]),}\n\n_lr_goto = {}\nfor _k, _v in _lr_goto_items.items():\n   for _x, _y in zip(_v[0], _v[1]):\n       if not _x in _lr_goto: _lr_goto[_x] = {}\n       _lr_goto[_x][_k] = _y\ndel _lr_goto_items\n_lr_productions = [\n  (\"S' -> main\",\"S'\",1,None,None,None),\n  ('main -> factor combined_units','main',2,'p_main','cds.py',156),\n  ('main -> combined_units','main',1,'p_main','cds.py',157),\n  ('main -> DIMENSIONLESS','main',1,'p_main','cds.py',158),\n  ('main -> OPEN_BRACKET combined_units CLOSE_BRACKET','main',3,'p_main','cds.py',159),\n  ('main -> OPEN_BRACKET DIMENSIONLESS CLOSE_BRACKET','main',3,'p_main','cds.py',160),\n  ('main -> factor','main',1,'p_main','cds.py',161),\n  ('combined_units -> product_of_units','combined_units',1,'p_combined_units','cds.py',174),\n  ('combined_units -> division_of_units','combined_units',1,'p_combined_units','cds.py',175),\n  ('product_of_units -> unit_expression PRODUCT combined_units','product_of_units',3,'p_product_of_units','cds.py',181),\n  ('product_of_units -> unit_expression','product_of_units',1,'p_product_of_units','cds.py',182),\n  ('division_of_units -> DIVISION unit_expression','division_of_units',2,'p_division_of_units','cds.py',191),\n  ('division_of_units -> unit_expression DIVISION combined_units','division_of_units',3,'p_division_of_units','cds.py',192),\n  ('unit_expression -> unit_with_power','unit_expression',1,'p_unit_expression','cds.py',201),\n  ('unit_expression -> OPEN_PAREN combined_units CLOSE_PAREN','unit_expression',3,'p_unit_expression','cds.py',202),\n  ('factor -> signed_float X UINT signed_int','factor',4,'p_factor','cds.py',211),\n  ('factor -> UINT X UINT signed_int','factor',4,'p_factor','cds.py',212),\n  ('factor -> UINT signed_int','factor',2,'p_factor','cds.py',213),\n  ('factor -> UINT','factor',1,'p_factor','cds.py',214),\n  ('factor -> signed_float','factor',1,'p_factor','cds.py',215),\n  ('unit_with_power -> UNIT numeric_power','unit_with_power',2,'p_unit_with_power','cds.py',232),\n  ('unit_with_power -> UNIT','unit_with_power',1,'p_unit_with_power','cds.py',233),\n  ('numeric_power -> sign UINT','numeric_power',2,'p_numeric_power','cds.py',242),\n  ('sign -> SIGN','sign',1,'p_sign','cds.py',248),\n  ('sign -> <empty>','sign',0,'p_sign','cds.py',249),\n  ('signed_int -> SIGN UINT','signed_int',2,'p_signed_int','cds.py',258),\n  ('signed_float -> sign UINT','signed_float',2,'p_signed_float','cds.py',264),\n  ('signed_float -> sign UFLOAT','signed_float',2,'p_signed_float','cds.py',265),\n]\n"},{"col":4,"comment":"Return the physical type of the physical unit (e.g., 'length').","endLoc":167,"header":"@property\n    def physical_type(self)","id":9953,"name":"physical_type","nodeType":"Function","startLoc":164,"text":"@property\n    def physical_type(self):\n        \"\"\"Return the physical type of the physical unit (e.g., 'length').\"\"\"\n        return self.physical_unit.physical_type"},{"col":4,"comment":"\n        Returns `True` if this unit is equivalent to ``other``.\n\n        Parameters\n        ----------\n        other : `~astropy.units.Unit`, string, or tuple\n            The unit to convert to. If a tuple of units is specified, this\n            method returns true if the unit matches any of those in the tuple.\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            This list is in addition to the built-in equivalencies between the\n            function unit and the physical one, as well as possible global\n            defaults set by, e.g., `~astropy.units.set_enabled_equivalencies`.\n            Use `None` to turn off any global equivalencies.\n\n        Returns\n        -------\n        bool\n        ","endLoc":200,"header":"def is_equivalent(self, other, equivalencies=[])","id":9954,"name":"is_equivalent","nodeType":"Function","startLoc":169,"text":"def is_equivalent(self, other, equivalencies=[]):\n        \"\"\"\n        Returns `True` if this unit is equivalent to ``other``.\n\n        Parameters\n        ----------\n        other : `~astropy.units.Unit`, string, or tuple\n            The unit to convert to. If a tuple of units is specified, this\n            method returns true if the unit matches any of those in the tuple.\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            This list is in addition to the built-in equivalencies between the\n            function unit and the physical one, as well as possible global\n            defaults set by, e.g., `~astropy.units.set_enabled_equivalencies`.\n            Use `None` to turn off any global equivalencies.\n\n        Returns\n        -------\n        bool\n        \"\"\"\n        if isinstance(other, tuple):\n            return any(self.is_equivalent(u, equivalencies=equivalencies)\n                       for u in other)\n\n        other_physical_unit = getattr(other, 'physical_unit', (\n            dimensionless_unscaled if self.function_unit.is_equivalent(other)\n            else other))\n\n        return self.physical_unit.is_equivalent(other_physical_unit,\n                                                equivalencies)"},{"fileName":"ogip.py","filePath":"astropy/units/format","id":9955,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICNSE.rst\n\n# This module includes files automatically generated from ply (these end in\n# _lextab.py and _parsetab.py). To generate these files, remove them from this\n# folder, then build astropy and run the tests in-place:\n#\n#   python setup.py build_ext --inplace\n#   pytest astropy/units\n#\n# You can then commit the changes to the re-generated _lextab.py and\n# _parsetab.py files.\n\n\"\"\"\nHandles units in `Office of Guest Investigator Programs (OGIP)\nFITS files\n<https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/general/ogip_93_001/>`__.\n\"\"\"\n\nimport keyword\nimport math\nimport os\nimport copy\nimport warnings\nfrom fractions import Fraction\n\nfrom . import core, generic, utils\n\nfrom astropy.utils import parsing\n\n\nclass OGIP(generic.Generic):\n    \"\"\"\n    Support the units in `Office of Guest Investigator Programs (OGIP)\n    FITS files\n    <https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/general/ogip_93_001/>`__.\n    \"\"\"\n\n    _tokens = (\n        'DIVISION',\n        'OPEN_PAREN',\n        'CLOSE_PAREN',\n        'WHITESPACE',\n        'STARSTAR',\n        'STAR',\n        'SIGN',\n        'UFLOAT',\n        'LIT10',\n        'UINT',\n        'UNKNOWN',\n        'UNIT'\n    )\n\n    @staticmethod\n    def _generate_unit_names():\n\n        from astropy import units as u\n        names = {}\n        deprecated_names = set()\n\n        bases = [\n            'A', 'C', 'cd', 'eV', 'F', 'g', 'H', 'Hz', 'J',\n            'Jy', 'K', 'lm', 'lx', 'm', 'mol', 'N', 'ohm', 'Pa',\n            'pc', 'rad', 's', 'S', 'sr', 'T', 'V', 'W', 'Wb'\n        ]\n        deprecated_bases = []\n        prefixes = [\n            'y', 'z', 'a', 'f', 'p', 'n', 'u', 'm', 'c', 'd',\n            '', 'da', 'h', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'\n        ]\n\n        for base in bases + deprecated_bases:\n            for prefix in prefixes:\n                key = prefix + base\n                if keyword.iskeyword(key):\n                    continue\n                names[key] = getattr(u, key)\n        for base in deprecated_bases:\n            for prefix in prefixes:\n                deprecated_names.add(prefix + base)\n\n        simple_units = [\n            'angstrom', 'arcmin', 'arcsec', 'AU', 'barn', 'bin',\n            'byte', 'chan', 'count', 'day', 'deg', 'erg', 'G',\n            'h', 'lyr', 'mag', 'min', 'photon', 'pixel',\n            'voxel', 'yr'\n        ]\n        for unit in simple_units:\n            names[unit] = getattr(u, unit)\n\n        # Create a separate, disconnected unit for the special case of\n        # Crab and mCrab, since OGIP doesn't define their quantities.\n        Crab = u.def_unit(['Crab'], prefixes=False, doc='Crab (X-ray flux)')\n        mCrab = u.Unit(10 ** -3 * Crab)\n        names['Crab'] = Crab\n        names['mCrab'] = mCrab\n\n        deprecated_units = ['Crab', 'mCrab']\n        for unit in deprecated_units:\n            deprecated_names.add(unit)\n\n        # Define the function names, so we can parse them, even though\n        # we can't use any of them (other than sqrt) meaningfully for\n        # now.\n        functions = [\n            'log', 'ln', 'exp', 'sqrt', 'sin', 'cos', 'tan', 'asin',\n            'acos', 'atan', 'sinh', 'cosh', 'tanh'\n        ]\n        for name in functions:\n            names[name] = name\n\n        return names, deprecated_names, functions\n\n    @classmethod\n    def _make_lexer(cls):\n        tokens = cls._tokens\n\n        t_DIVISION = r'/'\n        t_OPEN_PAREN = r'\\('\n        t_CLOSE_PAREN = r'\\)'\n        t_WHITESPACE = '[ \\t]+'\n        t_STARSTAR = r'\\*\\*'\n        t_STAR = r'\\*'\n\n        # NOTE THE ORDERING OF THESE RULES IS IMPORTANT!!\n        # Regular expression rules for simple tokens\n        def t_UFLOAT(t):\n            r'(((\\d+\\.?\\d*)|(\\.\\d+))([eE][+-]?\\d+))|(((\\d+\\.\\d*)|(\\.\\d+))([eE][+-]?\\d+)?)'\n            t.value = float(t.value)\n            return t\n\n        def t_UINT(t):\n            r'\\d+'\n            t.value = int(t.value)\n            return t\n\n        def t_SIGN(t):\n            r'[+-](?=\\d)'\n            t.value = float(t.value + '1')\n            return t\n\n        def t_X(t):  # multiplication for factor in front of unit\n            r'[x×]'\n            return t\n\n        def t_LIT10(t):\n            r'10'\n            return 10\n\n        def t_UNKNOWN(t):\n            r'[Uu][Nn][Kk][Nn][Oo][Ww][Nn]'\n            return None\n\n        def t_UNIT(t):\n            r'[a-zA-Z][a-zA-Z_]*'\n            t.value = cls._get_unit(t)\n            return t\n\n        # Don't ignore whitespace\n        t_ignore = ''\n\n        # Error handling rule\n        def t_error(t):\n            raise ValueError(\n                f\"Invalid character at col {t.lexpos}\")\n\n        return parsing.lex(lextab='ogip_lextab', package='astropy/units')\n\n    @classmethod\n    def _make_parser(cls):\n        \"\"\"\n        The grammar here is based on the description in the\n        `Specification of Physical Units within OGIP FITS files\n        <https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/general/ogip_93_001/>`__,\n        which is not terribly precise.  The exact grammar is here is\n        based on the YACC grammar in the `unity library\n        <https://bitbucket.org/nxg/unity/>`_.\n        \"\"\"\n\n        tokens = cls._tokens\n\n        def p_main(p):\n            '''\n            main : UNKNOWN\n                 | complete_expression\n                 | scale_factor complete_expression\n                 | scale_factor WHITESPACE complete_expression\n            '''\n            if len(p) == 4:\n                p[0] = p[1] * p[3]\n            elif len(p) == 3:\n                p[0] = p[1] * p[2]\n            else:\n                p[0] = p[1]\n\n        def p_complete_expression(p):\n            '''\n            complete_expression : product_of_units\n            '''\n            p[0] = p[1]\n\n        def p_product_of_units(p):\n            '''\n            product_of_units : unit_expression\n                             | division unit_expression\n                             | product_of_units product unit_expression\n                             | product_of_units division unit_expression\n            '''\n            if len(p) == 4:\n                if p[2] == 'DIVISION':\n                    p[0] = p[1] / p[3]\n                else:\n                    p[0] = p[1] * p[3]\n            elif len(p) == 3:\n                p[0] = p[2] ** -1\n            else:\n                p[0] = p[1]\n\n        def p_unit_expression(p):\n            '''\n            unit_expression : unit\n                            | UNIT OPEN_PAREN complete_expression CLOSE_PAREN\n                            | OPEN_PAREN complete_expression CLOSE_PAREN\n                            | UNIT OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power\n                            | OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power\n            '''\n\n            # If we run p[1] in cls._functions, it will try and parse each\n            # item in the list into a unit, which is slow. Since we know that\n            # all the items in the list are strings, we can simply convert\n            # p[1] to a string instead.\n            p1_str = str(p[1])\n\n            if p1_str in cls._functions and p1_str != 'sqrt':\n                raise ValueError(\n                    \"The function '{}' is valid in OGIP, but not understood \"\n                    \"by astropy.units.\".format(\n                        p[1]))\n\n            if len(p) == 7:\n                if p1_str == 'sqrt':\n                    p[0] = p[1] * p[3] ** (0.5 * p[6])\n                else:\n                    p[0] = p[1] * p[3] ** p[6]\n            elif len(p) == 6:\n                p[0] = p[2] ** p[5]\n            elif len(p) == 5:\n                if p1_str == 'sqrt':\n                    p[0] = p[3] ** 0.5\n                else:\n                    p[0] = p[1] * p[3]\n            elif len(p) == 4:\n                p[0] = p[2]\n            else:\n                p[0] = p[1]\n\n        def p_scale_factor(p):\n            '''\n            scale_factor : LIT10 power numeric_power\n                         | LIT10\n                         | signed_float\n                         | signed_float power numeric_power\n                         | signed_int power numeric_power\n            '''\n            if len(p) == 4:\n                p[0] = 10 ** p[3]\n            else:\n                p[0] = p[1]\n            # Can't use np.log10 here, because p[0] may be a Python long.\n            if math.log10(p[0]) % 1.0 != 0.0:\n                from astropy.units.core import UnitsWarning\n                warnings.warn(\n                    \"'{}' scale should be a power of 10 in \"\n                    \"OGIP format\".format(p[0]), UnitsWarning)\n\n        def p_division(p):\n            '''\n            division : DIVISION\n                     | WHITESPACE DIVISION\n                     | WHITESPACE DIVISION WHITESPACE\n                     | DIVISION WHITESPACE\n            '''\n            p[0] = 'DIVISION'\n\n        def p_product(p):\n            '''\n            product : WHITESPACE\n                    | STAR\n                    | WHITESPACE STAR\n                    | WHITESPACE STAR WHITESPACE\n                    | STAR WHITESPACE\n            '''\n            p[0] = 'PRODUCT'\n\n        def p_power(p):\n            '''\n            power : STARSTAR\n            '''\n            p[0] = 'POWER'\n\n        def p_unit(p):\n            '''\n            unit : UNIT\n                 | UNIT power numeric_power\n            '''\n            if len(p) == 4:\n                p[0] = p[1] ** p[3]\n            else:\n                p[0] = p[1]\n\n        def p_numeric_power(p):\n            '''\n            numeric_power : UINT\n                          | signed_float\n                          | OPEN_PAREN signed_int CLOSE_PAREN\n                          | OPEN_PAREN signed_float CLOSE_PAREN\n                          | OPEN_PAREN signed_float division UINT CLOSE_PAREN\n            '''\n            if len(p) == 6:\n                p[0] = Fraction(int(p[2]), int(p[4]))\n            elif len(p) == 4:\n                p[0] = p[2]\n            else:\n                p[0] = p[1]\n\n        def p_sign(p):\n            '''\n            sign : SIGN\n                 |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1.0\n\n        def p_signed_int(p):\n            '''\n            signed_int : SIGN UINT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_signed_float(p):\n            '''\n            signed_float : sign UINT\n                         | sign UFLOAT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_error(p):\n            raise ValueError()\n\n        return parsing.yacc(tabmodule='ogip_parsetab', package='astropy/units')\n\n    @classmethod\n    def _validate_unit(cls, unit, detailed_exception=True):\n        if unit not in cls._units:\n            if detailed_exception:\n                raise ValueError(\n                    \"Unit '{}' not supported by the OGIP \"\n                    \"standard. {}\".format(\n                        unit, utils.did_you_mean_units(\n                            unit, cls._units, cls._deprecated_units,\n                            cls._to_decomposed_alternative)))\n            else:\n                raise ValueError()\n\n        if unit in cls._deprecated_units:\n            utils.unit_deprecation_warning(\n                unit, cls._units[unit], 'OGIP',\n                cls._to_decomposed_alternative)\n\n    @classmethod\n    def _parse_unit(cls, unit, detailed_exception=True):\n        cls._validate_unit(unit, detailed_exception=detailed_exception)\n        return cls._units[unit]\n\n    @classmethod\n    def parse(cls, s, debug=False):\n        s = s.strip()\n        try:\n            # This is a short circuit for the case where the string is\n            # just a single unit name\n            return cls._parse_unit(s, detailed_exception=False)\n        except ValueError:\n            try:\n                return core.Unit(\n                    cls._parser.parse(s, lexer=cls._lexer, debug=debug))\n            except ValueError as e:\n                if str(e):\n                    raise\n                else:\n                    raise ValueError(\n                        f\"Syntax error parsing unit '{s}'\")\n\n    @classmethod\n    def _get_unit_name(cls, unit):\n        name = unit.get_format_name('ogip')\n        cls._validate_unit(name)\n        return name\n\n    @classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        units.sort(key=lambda x: cls._get_unit_name(x[0]).lower())\n\n        for base, power in units:\n            if power == 1:\n                out.append(cls._get_unit_name(base))\n            else:\n                power = utils.format_power(power)\n                if '/' in power:\n                    out.append(f'{cls._get_unit_name(base)}**({power})')\n                else:\n                    out.append(f'{cls._get_unit_name(base)}**{power}')\n        return ' '.join(out)\n\n    @classmethod\n    def to_string(cls, unit):\n        # Remove units that aren't known to the format\n        unit = utils.decompose_to_known_units(unit, cls._get_unit_name)\n\n        if isinstance(unit, core.CompositeUnit):\n            # Can't use np.log10 here, because p[0] may be a Python long.\n            if math.log10(unit.scale) % 1.0 != 0.0:\n                warnings.warn(\n                    f\"'{unit.scale}' scale should be a power of 10 in OGIP format\",\n                    core.UnitsWarning)\n\n        return generic._to_string(cls, unit)\n\n    @classmethod\n    def _to_decomposed_alternative(cls, unit):\n        # Remove units that aren't known to the format\n        unit = utils.decompose_to_known_units(unit, cls._get_unit_name)\n\n        if isinstance(unit, core.CompositeUnit):\n            # Can't use np.log10 here, because p[0] may be a Python long.\n            if math.log10(unit.scale) % 1.0 != 0.0:\n                scale = unit.scale\n                unit = copy.copy(unit)\n                unit._scale = 1.0\n                return '{} (with data multiplied by {})'.format(\n                    generic._to_string(cls, unit), scale)\n\n        return generic._to_string(unit)\n"},{"col":4,"comment":"\n        Return the converted values in the specified unit.\n\n        Parameters\n        ----------\n        other : `~astropy.units.Unit`, `~astropy.units.function.FunctionUnitBase`, or str\n            The unit to convert to.\n\n        value : int, float, or scalar array-like, optional\n            Value(s) in the current unit to be converted to the specified unit.\n            If not provided, defaults to 1.0.\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            This list is in meant to treat only equivalencies between different\n            physical units; the built-in equivalency between the function\n            unit and the physical one is automatically taken into account.\n\n        Returns\n        -------\n        values : scalar or array\n            Converted value(s). Input value sequences are returned as\n            numpy arrays.\n\n        Raises\n        ------\n        `~astropy.units.UnitsError`\n            If units are inconsistent.\n        ","endLoc":266,"header":"def to(self, other, value=1., equivalencies=[])","id":9956,"name":"to","nodeType":"Function","startLoc":202,"text":"def to(self, other, value=1., equivalencies=[]):\n        \"\"\"\n        Return the converted values in the specified unit.\n\n        Parameters\n        ----------\n        other : `~astropy.units.Unit`, `~astropy.units.function.FunctionUnitBase`, or str\n            The unit to convert to.\n\n        value : int, float, or scalar array-like, optional\n            Value(s) in the current unit to be converted to the specified unit.\n            If not provided, defaults to 1.0.\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            This list is in meant to treat only equivalencies between different\n            physical units; the built-in equivalency between the function\n            unit and the physical one is automatically taken into account.\n\n        Returns\n        -------\n        values : scalar or array\n            Converted value(s). Input value sequences are returned as\n            numpy arrays.\n\n        Raises\n        ------\n        `~astropy.units.UnitsError`\n            If units are inconsistent.\n        \"\"\"\n        # conversion to one's own physical unit should be fastest\n        if other is self.physical_unit:\n            return self.to_physical(value)\n\n        other_function_unit = getattr(other, 'function_unit', other)\n        if self.function_unit.is_equivalent(other_function_unit):\n            # when other is an equivalent function unit:\n            # first convert physical units to other's physical units\n            other_physical_unit = getattr(other, 'physical_unit',\n                                          dimensionless_unscaled)\n            if self.physical_unit != other_physical_unit:\n                value_other_physical = self.physical_unit.to(\n                    other_physical_unit, self.to_physical(value),\n                    equivalencies)\n                # make function unit again, in own system\n                value = self.from_physical(value_other_physical)\n\n            # convert possible difference in function unit (e.g., dex->dB)\n            return self.function_unit.to(other_function_unit, value)\n\n        else:\n            try:\n                # when other is not a function unit\n                return self.physical_unit.to(other, self.to_physical(value),\n                                             equivalencies)\n            except UnitConversionError as e:\n                if self.function_unit == Unit('mag'):\n                    # One can get to raw magnitudes via math that strips the dimensions off.\n                    # Include extra information in the exception to remind users of this.\n                    msg = \"Did you perhaps subtract magnitudes so the unit got lost?\"\n                    e.args += (msg,)\n                    raise e\n                else:\n                    raise"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":9957,"name":"_tabversion","nodeType":"Attribute","startLoc":16,"text":"_tabversion"},{"col":0,"comment":"\n    Convert between the ``beam`` unit, which is commonly used to express the area\n    of a radio telescope resolution element, and an area on the sky.\n    This equivalency also supports direct conversion between ``Jy/beam`` and\n    ``Jy/steradian`` units, since that is a common operation.\n\n    Parameters\n    ----------\n    beam_area : unit-like\n        The area of the beam in angular area units (e.g., steradians)\n        Must have angular area equivalent units.\n    ","endLoc":676,"header":"def beam_angular_area(beam_area)","id":9958,"name":"beam_angular_area","nodeType":"Function","startLoc":660,"text":"def beam_angular_area(beam_area):\n    \"\"\"\n    Convert between the ``beam`` unit, which is commonly used to express the area\n    of a radio telescope resolution element, and an area on the sky.\n    This equivalency also supports direct conversion between ``Jy/beam`` and\n    ``Jy/steradian`` units, since that is a common operation.\n\n    Parameters\n    ----------\n    beam_area : unit-like\n        The area of the beam in angular area units (e.g., steradians)\n        Must have angular area equivalent units.\n    \"\"\"\n    return Equivalency([(astrophys.beam, Unit(beam_area)),\n                        (astrophys.beam**-1, Unit(beam_area)**-1),\n                        (astrophys.Jy/astrophys.beam, astrophys.Jy/Unit(beam_area))],\n                       \"beam_angular_area\", {'beam_area': beam_area})"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":9959,"name":"_lr_method","nodeType":"Attribute","startLoc":18,"text":"_lr_method"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":9960,"name":"_lr_signature","nodeType":"Attribute","startLoc":20,"text":"_lr_signature"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":9961,"name":"_lr_action_items","nodeType":"Attribute","startLoc":22,"text":"_lr_action_items"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":9962,"name":"_lr_action","nodeType":"Attribute","startLoc":24,"text":"_lr_action"},{"attributeType":"null","col":4,"comment":"null","endLoc":25,"id":9963,"name":"_k","nodeType":"Attribute","startLoc":25,"text":"_k"},{"attributeType":"null","col":8,"comment":"null","endLoc":25,"id":9964,"name":"_v","nodeType":"Attribute","startLoc":25,"text":"_v"},{"attributeType":"null","col":7,"comment":"null","endLoc":26,"id":9965,"name":"_x","nodeType":"Attribute","startLoc":26,"text":"_x"},{"attributeType":"null","col":10,"comment":"null","endLoc":26,"id":9966,"name":"_y","nodeType":"Attribute","startLoc":26,"text":"_y"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":9967,"name":"_lr_goto_items","nodeType":"Attribute","startLoc":31,"text":"_lr_goto_items"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":9968,"name":"_lr_goto","nodeType":"Attribute","startLoc":33,"text":"_lr_goto"},{"attributeType":"null","col":4,"comment":"null","endLoc":34,"id":9969,"name":"_k","nodeType":"Attribute","startLoc":34,"text":"_k"},{"attributeType":"null","col":8,"comment":"null","endLoc":34,"id":9970,"name":"_v","nodeType":"Attribute","startLoc":34,"text":"_v"},{"attributeType":"null","col":7,"comment":"null","endLoc":35,"id":9971,"name":"_x","nodeType":"Attribute","startLoc":35,"text":"_x"},{"attributeType":"null","col":11,"comment":"null","endLoc":35,"id":9972,"name":"_y","nodeType":"Attribute","startLoc":35,"text":"_y"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":9973,"name":"_lr_productions","nodeType":"Attribute","startLoc":39,"text":"_lr_productions"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":9974,"name":"core","nodeType":"Attribute","startLoc":12,"text":"core"},{"col":0,"comment":"","endLoc":16,"header":"cds_parsetab.py#<anonymous>","id":9975,"name":"<anonymous>","nodeType":"Function","startLoc":16,"text":"_tabversion = '3.10'\n\n_lr_method = 'LALR'\n\n_lr_signature = 'CLOSE_BRACKET CLOSE_PAREN DIMENSIONLESS DIVISION OPEN_BRACKET OPEN_PAREN PRODUCT SIGN UFLOAT UINT UNIT X\\n            main : factor combined_units\\n                 | combined_units\\n                 | DIMENSIONLESS\\n                 | OPEN_BRACKET combined_units CLOSE_BRACKET\\n                 | OPEN_BRACKET DIMENSIONLESS CLOSE_BRACKET\\n                 | factor\\n            \\n            combined_units : product_of_units\\n                           | division_of_units\\n            \\n            product_of_units : unit_expression PRODUCT combined_units\\n                             | unit_expression\\n            \\n            division_of_units : DIVISION unit_expression\\n                              | unit_expression DIVISION combined_units\\n            \\n            unit_expression : unit_with_power\\n                            | OPEN_PAREN combined_units CLOSE_PAREN\\n            \\n            factor : signed_float X UINT signed_int\\n                   | UINT X UINT signed_int\\n                   | UINT signed_int\\n                   | UINT\\n                   | signed_float\\n            \\n            unit_with_power : UNIT numeric_power\\n                            | UNIT\\n            \\n            numeric_power : sign UINT\\n            \\n            sign : SIGN\\n                 |\\n            \\n            signed_int : SIGN UINT\\n            \\n            signed_float : sign UINT\\n                         | sign UFLOAT\\n            '\n\n_lr_action_items = {'DIMENSIONLESS':([0,5,],[4,19,]),'OPEN_BRACKET':([0,],[5,]),'UINT':([0,10,13,16,20,21,23,31,],[7,24,-23,-24,34,35,36,40,]),'DIVISION':([0,2,5,6,7,11,14,15,16,22,24,25,26,27,30,36,39,40,41,42,],[12,12,12,-19,-18,27,-13,12,-21,-17,-26,-27,12,12,-20,-25,-14,-22,-15,-16,]),'SIGN':([0,7,16,34,35,],[13,23,13,23,23,]),'UFLOAT':([0,10,13,],[-24,25,-23,]),'OPEN_PAREN':([0,2,5,6,7,12,15,22,24,25,26,27,36,41,42,],[15,15,15,-19,-18,15,15,-17,-26,-27,15,15,-25,-15,-16,]),'UNIT':([0,2,5,6,7,12,15,22,24,25,26,27,36,41,42,],[16,16,16,-19,-18,16,16,-17,-26,-27,16,16,-25,-15,-16,]),'$end':([1,2,3,4,6,7,8,9,11,14,16,17,22,24,25,28,30,32,33,36,37,38,39,40,41,42,],[0,-6,-2,-3,-19,-18,-7,-8,-10,-13,-21,-1,-17,-26,-27,-11,-20,-4,-5,-25,-9,-12,-14,-22,-15,-16,]),'X':([6,7,24,25,],[20,21,-26,-27,]),'CLOSE_BRACKET':([8,9,11,14,16,18,19,28,30,37,38,39,40,],[-7,-8,-10,-13,-21,32,33,-11,-20,-9,-12,-14,-22,]),'CLOSE_PAREN':([8,9,11,14,16,28,29,30,37,38,39,40,],[-7,-8,-10,-13,-21,-11,39,-20,-9,-12,-14,-22,]),'PRODUCT':([11,14,16,30,39,40,],[26,-13,-21,-20,-14,-22,]),}\n\n_lr_action = {}\n\nfor _k, _v in _lr_action_items.items():\n   for _x,_y in zip(_v[0],_v[1]):\n      if not _x in _lr_action:  _lr_action[_x] = {}\n      _lr_action[_x][_k] = _y\n\ndel _lr_action_items\n\n_lr_goto_items = {'main':([0,],[1,]),'factor':([0,],[2,]),'combined_units':([0,2,5,15,26,27,],[3,17,18,29,37,38,]),'signed_float':([0,],[6,]),'product_of_units':([0,2,5,15,26,27,],[8,8,8,8,8,8,]),'division_of_units':([0,2,5,15,26,27,],[9,9,9,9,9,9,]),'sign':([0,16,],[10,31,]),'unit_expression':([0,2,5,12,15,26,27,],[11,11,11,28,11,11,11,]),'unit_with_power':([0,2,5,12,15,26,27,],[14,14,14,14,14,14,14,]),'signed_int':([7,34,35,],[22,41,42,]),'numeric_power':([16,],[30,]),}\n\n_lr_goto = {}\n\nfor _k, _v in _lr_goto_items.items():\n   for _x, _y in zip(_v[0], _v[1]):\n       if not _x in _lr_goto: _lr_goto[_x] = {}\n       _lr_goto[_x][_k] = _y\n\ndel _lr_goto_items\n\n_lr_productions = [\n  (\"S' -> main\",\"S'\",1,None,None,None),\n  ('main -> factor combined_units','main',2,'p_main','cds.py',156),\n  ('main -> combined_units','main',1,'p_main','cds.py',157),\n  ('main -> DIMENSIONLESS','main',1,'p_main','cds.py',158),\n  ('main -> OPEN_BRACKET combined_units CLOSE_BRACKET','main',3,'p_main','cds.py',159),\n  ('main -> OPEN_BRACKET DIMENSIONLESS CLOSE_BRACKET','main',3,'p_main','cds.py',160),\n  ('main -> factor','main',1,'p_main','cds.py',161),\n  ('combined_units -> product_of_units','combined_units',1,'p_combined_units','cds.py',174),\n  ('combined_units -> division_of_units','combined_units',1,'p_combined_units','cds.py',175),\n  ('product_of_units -> unit_expression PRODUCT combined_units','product_of_units',3,'p_product_of_units','cds.py',181),\n  ('product_of_units -> unit_expression','product_of_units',1,'p_product_of_units','cds.py',182),\n  ('division_of_units -> DIVISION unit_expression','division_of_units',2,'p_division_of_units','cds.py',191),\n  ('division_of_units -> unit_expression DIVISION combined_units','division_of_units',3,'p_division_of_units','cds.py',192),\n  ('unit_expression -> unit_with_power','unit_expression',1,'p_unit_expression','cds.py',201),\n  ('unit_expression -> OPEN_PAREN combined_units CLOSE_PAREN','unit_expression',3,'p_unit_expression','cds.py',202),\n  ('factor -> signed_float X UINT signed_int','factor',4,'p_factor','cds.py',211),\n  ('factor -> UINT X UINT signed_int','factor',4,'p_factor','cds.py',212),\n  ('factor -> UINT signed_int','factor',2,'p_factor','cds.py',213),\n  ('factor -> UINT','factor',1,'p_factor','cds.py',214),\n  ('factor -> signed_float','factor',1,'p_factor','cds.py',215),\n  ('unit_with_power -> UNIT numeric_power','unit_with_power',2,'p_unit_with_power','cds.py',232),\n  ('unit_with_power -> UNIT','unit_with_power',1,'p_unit_with_power','cds.py',233),\n  ('numeric_power -> sign UINT','numeric_power',2,'p_numeric_power','cds.py',242),\n  ('sign -> SIGN','sign',1,'p_sign','cds.py',248),\n  ('sign -> <empty>','sign',0,'p_sign','cds.py',249),\n  ('signed_int -> SIGN UINT','signed_int',2,'p_signed_int','cds.py',258),\n  ('signed_float -> sign UINT','signed_float',2,'p_signed_float','cds.py',264),\n  ('signed_float -> sign UFLOAT','signed_float',2,'p_signed_float','cds.py',265),\n]"},{"col":0,"comment":"Defines the conversion between Jy/sr and \"thermodynamic temperature\",\n    :math:`T_{CMB}`, in Kelvins.  The thermodynamic temperature is a unit very\n    commonly used in cosmology. See eqn 8 in [1]\n\n    :math:`K_{CMB} \\equiv I_\\nu / \\left(2 k \\nu^2 / c^2  f(\\nu) \\right)`\n\n    with :math:`f(\\nu) = \\frac{ x^2 e^x}{(e^x - 1 )^2}`\n    where :math:`x = h \\nu / k T`\n\n    Parameters\n    ----------\n    frequency : `~astropy.units.Quantity`\n        The observed `spectral` equivalent `~astropy.units.Unit` (e.g.,\n        frequency or wavelength). Must have spectral units.\n    T_cmb :  `~astropy.units.Quantity` ['temperature'] or None\n        The CMB temperature at z=0.  If `None`, the default cosmology will be\n        used to get this temperature. Must have units of temperature.\n\n    Notes\n    -----\n    For broad band receivers, this conversion do not hold\n    as it highly depends on the frequency\n\n    References\n    ----------\n    .. [1] Planck 2013 results. IX. HFI spectral response\n       https://arxiv.org/abs/1303.5070\n\n    Examples\n    --------\n    Planck HFI 143 GHz::\n\n        >>> from astropy import units as u\n        >>> from astropy.cosmology import Planck15\n        >>> freq = 143 * u.GHz\n        >>> equiv = u.thermodynamic_temperature(freq, Planck15.Tcmb0)\n        >>> (1. * u.mK).to(u.MJy / u.sr, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        <Quantity 0.37993172 MJy / sr>\n\n    ","endLoc":739,"header":"def thermodynamic_temperature(frequency, T_cmb=None)","id":9976,"name":"thermodynamic_temperature","nodeType":"Function","startLoc":679,"text":"def thermodynamic_temperature(frequency, T_cmb=None):\n    r\"\"\"Defines the conversion between Jy/sr and \"thermodynamic temperature\",\n    :math:`T_{CMB}`, in Kelvins.  The thermodynamic temperature is a unit very\n    commonly used in cosmology. See eqn 8 in [1]\n\n    :math:`K_{CMB} \\equiv I_\\nu / \\left(2 k \\nu^2 / c^2  f(\\nu) \\right)`\n\n    with :math:`f(\\nu) = \\frac{ x^2 e^x}{(e^x - 1 )^2}`\n    where :math:`x = h \\nu / k T`\n\n    Parameters\n    ----------\n    frequency : `~astropy.units.Quantity`\n        The observed `spectral` equivalent `~astropy.units.Unit` (e.g.,\n        frequency or wavelength). Must have spectral units.\n    T_cmb :  `~astropy.units.Quantity` ['temperature'] or None\n        The CMB temperature at z=0.  If `None`, the default cosmology will be\n        used to get this temperature. Must have units of temperature.\n\n    Notes\n    -----\n    For broad band receivers, this conversion do not hold\n    as it highly depends on the frequency\n\n    References\n    ----------\n    .. [1] Planck 2013 results. IX. HFI spectral response\n       https://arxiv.org/abs/1303.5070\n\n    Examples\n    --------\n    Planck HFI 143 GHz::\n\n        >>> from astropy import units as u\n        >>> from astropy.cosmology import Planck15\n        >>> freq = 143 * u.GHz\n        >>> equiv = u.thermodynamic_temperature(freq, Planck15.Tcmb0)\n        >>> (1. * u.mK).to(u.MJy / u.sr, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        <Quantity 0.37993172 MJy / sr>\n\n    \"\"\"\n    nu = frequency.to(si.GHz, spectral())\n\n    if T_cmb is None:\n        from astropy.cosmology import default_cosmology\n        T_cmb = default_cosmology.get().Tcmb0\n\n    def f(nu, T_cmb=T_cmb):\n        x = _si.h * nu / _si.k_B / T_cmb\n        return x**2 * np.exp(x) / np.expm1(x)**2\n\n    def convert_Jy_to_K(x_jybm):\n        factor = (f(nu) * 2 * _si.k_B * si.K * nu**2 / _si.c**2).to_value(astrophys.Jy)\n        return x_jybm / factor\n\n    def convert_K_to_Jy(x_K):\n        factor = (astrophys.Jy / (f(nu) * 2 * _si.k_B * nu**2 / _si.c**2)).to_value(si.K)\n        return x_K / factor\n\n    return Equivalency([(astrophys.Jy/si.sr, si.K, convert_Jy_to_K, convert_K_to_Jy)],\n                       \"thermodynamic_temperature\", {'frequency': frequency, \"T_cmb\": T_cmb})"},{"col":4,"comment":"null","endLoc":269,"header":"def is_unity(self)","id":9977,"name":"is_unity","nodeType":"Function","startLoc":268,"text":"def is_unity(self):\n        return False"},{"col":4,"comment":"null","endLoc":274,"header":"def __eq__(self, other)","id":9978,"name":"__eq__","nodeType":"Function","startLoc":271,"text":"def __eq__(self, other):\n        return (self.physical_unit == getattr(other, 'physical_unit',\n                                              dimensionless_unscaled) and\n                self.function_unit == getattr(other, 'function_unit', other))"},{"col":4,"comment":"null","endLoc":277,"header":"def __ne__(self, other)","id":9979,"name":"__ne__","nodeType":"Function","startLoc":276,"text":"def __ne__(self, other):\n        return not self.__eq__(other)"},{"className":"OGIP","col":0,"comment":"\n    Support the units in `Office of Guest Investigator Programs (OGIP)\n    FITS files\n    <https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/general/ogip_93_001/>`__.\n    ","endLoc":445,"id":9980,"nodeType":"Class","startLoc":32,"text":"class OGIP(generic.Generic):\n    \"\"\"\n    Support the units in `Office of Guest Investigator Programs (OGIP)\n    FITS files\n    <https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/general/ogip_93_001/>`__.\n    \"\"\"\n\n    _tokens = (\n        'DIVISION',\n        'OPEN_PAREN',\n        'CLOSE_PAREN',\n        'WHITESPACE',\n        'STARSTAR',\n        'STAR',\n        'SIGN',\n        'UFLOAT',\n        'LIT10',\n        'UINT',\n        'UNKNOWN',\n        'UNIT'\n    )\n\n    @staticmethod\n    def _generate_unit_names():\n\n        from astropy import units as u\n        names = {}\n        deprecated_names = set()\n\n        bases = [\n            'A', 'C', 'cd', 'eV', 'F', 'g', 'H', 'Hz', 'J',\n            'Jy', 'K', 'lm', 'lx', 'm', 'mol', 'N', 'ohm', 'Pa',\n            'pc', 'rad', 's', 'S', 'sr', 'T', 'V', 'W', 'Wb'\n        ]\n        deprecated_bases = []\n        prefixes = [\n            'y', 'z', 'a', 'f', 'p', 'n', 'u', 'm', 'c', 'd',\n            '', 'da', 'h', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'\n        ]\n\n        for base in bases + deprecated_bases:\n            for prefix in prefixes:\n                key = prefix + base\n                if keyword.iskeyword(key):\n                    continue\n                names[key] = getattr(u, key)\n        for base in deprecated_bases:\n            for prefix in prefixes:\n                deprecated_names.add(prefix + base)\n\n        simple_units = [\n            'angstrom', 'arcmin', 'arcsec', 'AU', 'barn', 'bin',\n            'byte', 'chan', 'count', 'day', 'deg', 'erg', 'G',\n            'h', 'lyr', 'mag', 'min', 'photon', 'pixel',\n            'voxel', 'yr'\n        ]\n        for unit in simple_units:\n            names[unit] = getattr(u, unit)\n\n        # Create a separate, disconnected unit for the special case of\n        # Crab and mCrab, since OGIP doesn't define their quantities.\n        Crab = u.def_unit(['Crab'], prefixes=False, doc='Crab (X-ray flux)')\n        mCrab = u.Unit(10 ** -3 * Crab)\n        names['Crab'] = Crab\n        names['mCrab'] = mCrab\n\n        deprecated_units = ['Crab', 'mCrab']\n        for unit in deprecated_units:\n            deprecated_names.add(unit)\n\n        # Define the function names, so we can parse them, even though\n        # we can't use any of them (other than sqrt) meaningfully for\n        # now.\n        functions = [\n            'log', 'ln', 'exp', 'sqrt', 'sin', 'cos', 'tan', 'asin',\n            'acos', 'atan', 'sinh', 'cosh', 'tanh'\n        ]\n        for name in functions:\n            names[name] = name\n\n        return names, deprecated_names, functions\n\n    @classmethod\n    def _make_lexer(cls):\n        tokens = cls._tokens\n\n        t_DIVISION = r'/'\n        t_OPEN_PAREN = r'\\('\n        t_CLOSE_PAREN = r'\\)'\n        t_WHITESPACE = '[ \\t]+'\n        t_STARSTAR = r'\\*\\*'\n        t_STAR = r'\\*'\n\n        # NOTE THE ORDERING OF THESE RULES IS IMPORTANT!!\n        # Regular expression rules for simple tokens\n        def t_UFLOAT(t):\n            r'(((\\d+\\.?\\d*)|(\\.\\d+))([eE][+-]?\\d+))|(((\\d+\\.\\d*)|(\\.\\d+))([eE][+-]?\\d+)?)'\n            t.value = float(t.value)\n            return t\n\n        def t_UINT(t):\n            r'\\d+'\n            t.value = int(t.value)\n            return t\n\n        def t_SIGN(t):\n            r'[+-](?=\\d)'\n            t.value = float(t.value + '1')\n            return t\n\n        def t_X(t):  # multiplication for factor in front of unit\n            r'[x×]'\n            return t\n\n        def t_LIT10(t):\n            r'10'\n            return 10\n\n        def t_UNKNOWN(t):\n            r'[Uu][Nn][Kk][Nn][Oo][Ww][Nn]'\n            return None\n\n        def t_UNIT(t):\n            r'[a-zA-Z][a-zA-Z_]*'\n            t.value = cls._get_unit(t)\n            return t\n\n        # Don't ignore whitespace\n        t_ignore = ''\n\n        # Error handling rule\n        def t_error(t):\n            raise ValueError(\n                f\"Invalid character at col {t.lexpos}\")\n\n        return parsing.lex(lextab='ogip_lextab', package='astropy/units')\n\n    @classmethod\n    def _make_parser(cls):\n        \"\"\"\n        The grammar here is based on the description in the\n        `Specification of Physical Units within OGIP FITS files\n        <https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/general/ogip_93_001/>`__,\n        which is not terribly precise.  The exact grammar is here is\n        based on the YACC grammar in the `unity library\n        <https://bitbucket.org/nxg/unity/>`_.\n        \"\"\"\n\n        tokens = cls._tokens\n\n        def p_main(p):\n            '''\n            main : UNKNOWN\n                 | complete_expression\n                 | scale_factor complete_expression\n                 | scale_factor WHITESPACE complete_expression\n            '''\n            if len(p) == 4:\n                p[0] = p[1] * p[3]\n            elif len(p) == 3:\n                p[0] = p[1] * p[2]\n            else:\n                p[0] = p[1]\n\n        def p_complete_expression(p):\n            '''\n            complete_expression : product_of_units\n            '''\n            p[0] = p[1]\n\n        def p_product_of_units(p):\n            '''\n            product_of_units : unit_expression\n                             | division unit_expression\n                             | product_of_units product unit_expression\n                             | product_of_units division unit_expression\n            '''\n            if len(p) == 4:\n                if p[2] == 'DIVISION':\n                    p[0] = p[1] / p[3]\n                else:\n                    p[0] = p[1] * p[3]\n            elif len(p) == 3:\n                p[0] = p[2] ** -1\n            else:\n                p[0] = p[1]\n\n        def p_unit_expression(p):\n            '''\n            unit_expression : unit\n                            | UNIT OPEN_PAREN complete_expression CLOSE_PAREN\n                            | OPEN_PAREN complete_expression CLOSE_PAREN\n                            | UNIT OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power\n                            | OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power\n            '''\n\n            # If we run p[1] in cls._functions, it will try and parse each\n            # item in the list into a unit, which is slow. Since we know that\n            # all the items in the list are strings, we can simply convert\n            # p[1] to a string instead.\n            p1_str = str(p[1])\n\n            if p1_str in cls._functions and p1_str != 'sqrt':\n                raise ValueError(\n                    \"The function '{}' is valid in OGIP, but not understood \"\n                    \"by astropy.units.\".format(\n                        p[1]))\n\n            if len(p) == 7:\n                if p1_str == 'sqrt':\n                    p[0] = p[1] * p[3] ** (0.5 * p[6])\n                else:\n                    p[0] = p[1] * p[3] ** p[6]\n            elif len(p) == 6:\n                p[0] = p[2] ** p[5]\n            elif len(p) == 5:\n                if p1_str == 'sqrt':\n                    p[0] = p[3] ** 0.5\n                else:\n                    p[0] = p[1] * p[3]\n            elif len(p) == 4:\n                p[0] = p[2]\n            else:\n                p[0] = p[1]\n\n        def p_scale_factor(p):\n            '''\n            scale_factor : LIT10 power numeric_power\n                         | LIT10\n                         | signed_float\n                         | signed_float power numeric_power\n                         | signed_int power numeric_power\n            '''\n            if len(p) == 4:\n                p[0] = 10 ** p[3]\n            else:\n                p[0] = p[1]\n            # Can't use np.log10 here, because p[0] may be a Python long.\n            if math.log10(p[0]) % 1.0 != 0.0:\n                from astropy.units.core import UnitsWarning\n                warnings.warn(\n                    \"'{}' scale should be a power of 10 in \"\n                    \"OGIP format\".format(p[0]), UnitsWarning)\n\n        def p_division(p):\n            '''\n            division : DIVISION\n                     | WHITESPACE DIVISION\n                     | WHITESPACE DIVISION WHITESPACE\n                     | DIVISION WHITESPACE\n            '''\n            p[0] = 'DIVISION'\n\n        def p_product(p):\n            '''\n            product : WHITESPACE\n                    | STAR\n                    | WHITESPACE STAR\n                    | WHITESPACE STAR WHITESPACE\n                    | STAR WHITESPACE\n            '''\n            p[0] = 'PRODUCT'\n\n        def p_power(p):\n            '''\n            power : STARSTAR\n            '''\n            p[0] = 'POWER'\n\n        def p_unit(p):\n            '''\n            unit : UNIT\n                 | UNIT power numeric_power\n            '''\n            if len(p) == 4:\n                p[0] = p[1] ** p[3]\n            else:\n                p[0] = p[1]\n\n        def p_numeric_power(p):\n            '''\n            numeric_power : UINT\n                          | signed_float\n                          | OPEN_PAREN signed_int CLOSE_PAREN\n                          | OPEN_PAREN signed_float CLOSE_PAREN\n                          | OPEN_PAREN signed_float division UINT CLOSE_PAREN\n            '''\n            if len(p) == 6:\n                p[0] = Fraction(int(p[2]), int(p[4]))\n            elif len(p) == 4:\n                p[0] = p[2]\n            else:\n                p[0] = p[1]\n\n        def p_sign(p):\n            '''\n            sign : SIGN\n                 |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1.0\n\n        def p_signed_int(p):\n            '''\n            signed_int : SIGN UINT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_signed_float(p):\n            '''\n            signed_float : sign UINT\n                         | sign UFLOAT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_error(p):\n            raise ValueError()\n\n        return parsing.yacc(tabmodule='ogip_parsetab', package='astropy/units')\n\n    @classmethod\n    def _validate_unit(cls, unit, detailed_exception=True):\n        if unit not in cls._units:\n            if detailed_exception:\n                raise ValueError(\n                    \"Unit '{}' not supported by the OGIP \"\n                    \"standard. {}\".format(\n                        unit, utils.did_you_mean_units(\n                            unit, cls._units, cls._deprecated_units,\n                            cls._to_decomposed_alternative)))\n            else:\n                raise ValueError()\n\n        if unit in cls._deprecated_units:\n            utils.unit_deprecation_warning(\n                unit, cls._units[unit], 'OGIP',\n                cls._to_decomposed_alternative)\n\n    @classmethod\n    def _parse_unit(cls, unit, detailed_exception=True):\n        cls._validate_unit(unit, detailed_exception=detailed_exception)\n        return cls._units[unit]\n\n    @classmethod\n    def parse(cls, s, debug=False):\n        s = s.strip()\n        try:\n            # This is a short circuit for the case where the string is\n            # just a single unit name\n            return cls._parse_unit(s, detailed_exception=False)\n        except ValueError:\n            try:\n                return core.Unit(\n                    cls._parser.parse(s, lexer=cls._lexer, debug=debug))\n            except ValueError as e:\n                if str(e):\n                    raise\n                else:\n                    raise ValueError(\n                        f\"Syntax error parsing unit '{s}'\")\n\n    @classmethod\n    def _get_unit_name(cls, unit):\n        name = unit.get_format_name('ogip')\n        cls._validate_unit(name)\n        return name\n\n    @classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        units.sort(key=lambda x: cls._get_unit_name(x[0]).lower())\n\n        for base, power in units:\n            if power == 1:\n                out.append(cls._get_unit_name(base))\n            else:\n                power = utils.format_power(power)\n                if '/' in power:\n                    out.append(f'{cls._get_unit_name(base)}**({power})')\n                else:\n                    out.append(f'{cls._get_unit_name(base)}**{power}')\n        return ' '.join(out)\n\n    @classmethod\n    def to_string(cls, unit):\n        # Remove units that aren't known to the format\n        unit = utils.decompose_to_known_units(unit, cls._get_unit_name)\n\n        if isinstance(unit, core.CompositeUnit):\n            # Can't use np.log10 here, because p[0] may be a Python long.\n            if math.log10(unit.scale) % 1.0 != 0.0:\n                warnings.warn(\n                    f\"'{unit.scale}' scale should be a power of 10 in OGIP format\",\n                    core.UnitsWarning)\n\n        return generic._to_string(cls, unit)\n\n    @classmethod\n    def _to_decomposed_alternative(cls, unit):\n        # Remove units that aren't known to the format\n        unit = utils.decompose_to_known_units(unit, cls._get_unit_name)\n\n        if isinstance(unit, core.CompositeUnit):\n            # Can't use np.log10 here, because p[0] may be a Python long.\n            if math.log10(unit.scale) % 1.0 != 0.0:\n                scale = unit.scale\n                unit = copy.copy(unit)\n                unit._scale = 1.0\n                return '{} (with data multiplied by {})'.format(\n                    generic._to_string(cls, unit), scale)\n\n        return generic._to_string(unit)"},{"col":4,"comment":"Unit conversion operator ``<<``","endLoc":284,"header":"def __rlshift__(self, other)","id":9981,"name":"__rlshift__","nodeType":"Function","startLoc":279,"text":"def __rlshift__(self, other):\n        \"\"\"Unit conversion operator ``<<``\"\"\"\n        try:\n            return self._quantity_class(other, self, copy=False, subok=True)\n        except Exception:\n            return NotImplemented"},{"fileName":"vounit.py","filePath":"astropy/units/format","id":9982,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nHandles the \"VOUnit\" unit format.\n\"\"\"\n\n\nimport copy\nimport keyword\nimport operator\nimport re\nimport warnings\n\nfrom . import core, generic, utils\n\n\nclass VOUnit(generic.Generic):\n    \"\"\"\n    The IVOA standard for units used by the VO.\n\n    This is an implementation of `Units in the VO 1.0\n    <http://www.ivoa.net/documents/VOUnits/>`_.\n    \"\"\"\n    _explicit_custom_unit_regex = re.compile(\n        r\"^[YZEPTGMkhdcmunpfazy]?'((?!\\d)\\w)+'$\")\n    _custom_unit_regex = re.compile(r\"^((?!\\d)\\w)+$\")\n    _custom_units = {}\n\n    @staticmethod\n    def _generate_unit_names():\n        from astropy import units as u\n        from astropy.units import required_by_vounit as uvo\n\n        names = {}\n        deprecated_names = set()\n\n        bases = [\n            'A', 'C', 'D', 'F', 'G', 'H', 'Hz', 'J', 'Jy', 'K', 'N',\n            'Ohm', 'Pa', 'R', 'Ry', 'S', 'T', 'V', 'W', 'Wb', 'a',\n            'adu', 'arcmin', 'arcsec', 'barn', 'beam', 'bin', 'cd',\n            'chan', 'count', 'ct', 'd', 'deg', 'eV', 'erg', 'g', 'h',\n            'lm', 'lx', 'lyr', 'm', 'mag', 'min', 'mol', 'pc', 'ph',\n            'photon', 'pix', 'pixel', 'rad', 'rad', 's', 'solLum',\n            'solMass', 'solRad', 'sr', 'u', 'voxel', 'yr'\n        ]\n        binary_bases = [\n            'bit', 'byte', 'B'\n        ]\n        simple_units = [\n            'Angstrom', 'angstrom', 'AU', 'au', 'Ba', 'dB', 'mas'\n        ]\n        si_prefixes = [\n            'y', 'z', 'a', 'f', 'p', 'n', 'u', 'm', 'c', 'd',\n            '', 'da', 'h', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'\n        ]\n        binary_prefixes = [\n            'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei'\n        ]\n        deprecated_units = set([\n            'a', 'angstrom', 'Angstrom', 'au', 'Ba', 'barn', 'ct',\n            'erg', 'G', 'ph', 'pix'\n        ])\n\n        def do_defines(bases, prefixes, skips=[]):\n            for base in bases:\n                for prefix in prefixes:\n                    key = prefix + base\n                    if key in skips:\n                        continue\n                    if keyword.iskeyword(key):\n                        continue\n\n                    names[key] = getattr(u if hasattr(u, key) else uvo, key)\n                    if base in deprecated_units:\n                        deprecated_names.add(key)\n\n        do_defines(bases, si_prefixes, ['pct', 'pcount', 'yd'])\n        do_defines(binary_bases, si_prefixes + binary_prefixes, ['dB', 'dbyte'])\n        do_defines(simple_units, [''])\n\n        return names, deprecated_names, []\n\n    @classmethod\n    def parse(cls, s, debug=False):\n        if s in ('unknown', 'UNKNOWN'):\n            return None\n        if s == '':\n            return core.dimensionless_unscaled\n        # Check for excess solidi, but exclude fractional exponents (allowed)\n        if (s.count('/') > 1 and\n                s.count('/') - len(re.findall(r'\\(\\d+/\\d+\\)', s)) > 1):\n            raise core.UnitsError(\n                \"'{}' contains multiple slashes, which is \"\n                \"disallowed by the VOUnit standard\".format(s))\n        result = cls._do_parse(s, debug=debug)\n        if hasattr(result, 'function_unit'):\n            raise ValueError(\"Function units are not yet supported in \"\n                             \"VOUnit.\")\n        return result\n\n    @classmethod\n    def _get_unit(cls, t):\n        try:\n            return super()._get_unit(t)\n        except ValueError:\n            if cls._explicit_custom_unit_regex.match(t.value):\n                return cls._def_custom_unit(t.value)\n\n            if cls._custom_unit_regex.match(t.value):\n                warnings.warn(\n                    \"Unit {!r} not supported by the VOUnit \"\n                    \"standard. {}\".format(\n                        t.value, utils.did_you_mean_units(\n                            t.value, cls._units, cls._deprecated_units,\n                            cls._to_decomposed_alternative)),\n                    core.UnitsWarning)\n\n                return cls._def_custom_unit(t.value)\n\n            raise\n\n    @classmethod\n    def _parse_unit(cls, unit, detailed_exception=True):\n        if unit not in cls._units:\n            raise ValueError()\n\n        if unit in cls._deprecated_units:\n            utils.unit_deprecation_warning(\n                unit, cls._units[unit], 'VOUnit',\n                cls._to_decomposed_alternative)\n\n        return cls._units[unit]\n\n    @classmethod\n    def _get_unit_name(cls, unit):\n        # The da- and d- prefixes are discouraged.  This has the\n        # effect of adding a scale to value in the result.\n        if isinstance(unit, core.PrefixUnit):\n            if unit._represents.scale == 10.0:\n                raise ValueError(\n                    \"In '{}': VOUnit can not represent units with the 'da' \"\n                    \"(deka) prefix\".format(unit))\n            elif unit._represents.scale == 0.1:\n                raise ValueError(\n                    \"In '{}': VOUnit can not represent units with the 'd' \"\n                    \"(deci) prefix\".format(unit))\n\n        name = unit.get_format_name('vounit')\n\n        if unit in cls._custom_units.values():\n            return name\n\n        if name not in cls._units:\n            raise ValueError(\n                f\"Unit {name!r} is not part of the VOUnit standard\")\n\n        if name in cls._deprecated_units:\n            utils.unit_deprecation_warning(\n                name, unit, 'VOUnit',\n                cls._to_decomposed_alternative)\n\n        return name\n\n    @classmethod\n    def _def_custom_unit(cls, unit):\n        def def_base(name):\n            if name in cls._custom_units:\n                return cls._custom_units[name]\n\n            if name.startswith(\"'\"):\n                return core.def_unit(\n                    [name[1:-1], name],\n                    format={'vounit': name},\n                    namespace=cls._custom_units)\n            else:\n                return core.def_unit(\n                    name, namespace=cls._custom_units)\n\n        if unit in cls._custom_units:\n            return cls._custom_units[unit]\n\n        for short, full, factor in core.si_prefixes:\n            for prefix in short:\n                if unit.startswith(prefix):\n                    base_name = unit[len(prefix):]\n                    base_unit = def_base(base_name)\n                    return core.PrefixUnit(\n                        [prefix + x for x in base_unit.names],\n                        core.CompositeUnit(factor, [base_unit], [1],\n                                           _error_check=False),\n                        format={'vounit': prefix + base_unit.names[-1]},\n                        namespace=cls._custom_units)\n\n        return def_base(unit)\n\n    @classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        units.sort(key=lambda x: cls._get_unit_name(x[0]).lower())\n\n        for base, power in units:\n            if power == 1:\n                out.append(cls._get_unit_name(base))\n            else:\n                power = utils.format_power(power)\n                if '/' in power or '.' in power:\n                    out.append(f'{cls._get_unit_name(base)}({power})')\n                else:\n                    out.append(f'{cls._get_unit_name(base)}**{power}')\n        return '.'.join(out)\n\n    @classmethod\n    def to_string(cls, unit):\n        from astropy.units import core\n\n        # Remove units that aren't known to the format\n        unit = utils.decompose_to_known_units(unit, cls._get_unit_name)\n\n        if isinstance(unit, core.CompositeUnit):\n            if unit.physical_type == 'dimensionless' and unit.scale != 1:\n                raise core.UnitScaleError(\n                    \"The VOUnit format is not able to \"\n                    \"represent scale for dimensionless units. \"\n                    \"Multiply your data by {:e}.\"\n                    .format(unit.scale))\n            s = ''\n            if unit.scale != 1:\n                s += f'{unit.scale:.8g}'\n\n            pairs = list(zip(unit.bases, unit.powers))\n            pairs.sort(key=operator.itemgetter(1), reverse=True)\n\n            s += cls._format_unit_list(pairs)\n        elif isinstance(unit, core.NamedUnit):\n            s = cls._get_unit_name(unit)\n\n        return s\n\n    @classmethod\n    def _to_decomposed_alternative(cls, unit):\n        from astropy.units import core\n\n        try:\n            s = cls.to_string(unit)\n        except core.UnitScaleError:\n            scale = unit.scale\n            unit = copy.copy(unit)\n            unit._scale = 1.0\n            return f'{cls.to_string(unit)} (with data multiplied by {scale})'\n        return s\n"},{"col":4,"comment":"null","endLoc":299,"header":"def __mul__(self, other)","id":9983,"name":"__mul__","nodeType":"Function","startLoc":286,"text":"def __mul__(self, other):\n        if isinstance(other, (str, UnitBase, FunctionUnitBase)):\n            if self.physical_unit == dimensionless_unscaled:\n                # If dimensionless, drop back to normal unit and retry.\n                return self.function_unit * other\n            else:\n                raise UnitsError(\"Cannot multiply a function unit \"\n                                 \"with a physical dimension with any unit.\")\n        else:\n            # Anything not like a unit, try initialising as a function quantity.\n            try:\n                return self._quantity_class(other, unit=self)\n            except Exception:\n                return NotImplemented"},{"className":"Generic","col":0,"comment":"\n    A \"generic\" format.\n\n    The syntax of the format is based directly on the FITS standard,\n    but instead of only supporting the units that FITS knows about, it\n    supports any unit available in the `astropy.units` namespace.\n    ","endLoc":644,"id":9984,"nodeType":"Class","startLoc":56,"text":"class Generic(Base):\n    \"\"\"\n    A \"generic\" format.\n\n    The syntax of the format is based directly on the FITS standard,\n    but instead of only supporting the units that FITS knows about, it\n    supports any unit available in the `astropy.units` namespace.\n    \"\"\"\n\n    _show_scale = True\n\n    _tokens = (\n        'COMMA',\n        'DOUBLE_STAR',\n        'STAR',\n        'PERIOD',\n        'SOLIDUS',\n        'CARET',\n        'OPEN_PAREN',\n        'CLOSE_PAREN',\n        'FUNCNAME',\n        'UNIT',\n        'SIGN',\n        'UINT',\n        'UFLOAT'\n    )\n\n    @classproperty(lazy=True)\n    def _all_units(cls):\n        return cls._generate_unit_names()\n\n    @classproperty(lazy=True)\n    def _units(cls):\n        return cls._all_units[0]\n\n    @classproperty(lazy=True)\n    def _deprecated_units(cls):\n        return cls._all_units[1]\n\n    @classproperty(lazy=True)\n    def _functions(cls):\n        return cls._all_units[2]\n\n    @classproperty(lazy=True)\n    def _parser(cls):\n        return cls._make_parser()\n\n    @classproperty(lazy=True)\n    def _lexer(cls):\n        return cls._make_lexer()\n\n    @classmethod\n    def _make_lexer(cls):\n        tokens = cls._tokens\n\n        t_COMMA = r'\\,'\n        t_STAR = r'\\*'\n        t_PERIOD = r'\\.'\n        t_SOLIDUS = r'/'\n        t_DOUBLE_STAR = r'\\*\\*'\n        t_CARET = r'\\^'\n        t_OPEN_PAREN = r'\\('\n        t_CLOSE_PAREN = r'\\)'\n\n        # NOTE THE ORDERING OF THESE RULES IS IMPORTANT!!\n        # Regular expression rules for simple tokens\n        def t_UFLOAT(t):\n            r'((\\d+\\.?\\d*)|(\\.\\d+))([eE][+-]?\\d+)?'\n            if not re.search(r'[eE\\.]', t.value):\n                t.type = 'UINT'\n                t.value = int(t.value)\n            elif t.value.endswith('.'):\n                t.type = 'UINT'\n                t.value = int(t.value[:-1])\n            else:\n                t.value = float(t.value)\n            return t\n\n        def t_UINT(t):\n            r'\\d+'\n            t.value = int(t.value)\n            return t\n\n        def t_SIGN(t):\n            r'[+-](?=\\d)'\n            t.value = int(t.value + '1')\n            return t\n\n        # This needs to be a function so we can force it to happen\n        # before t_UNIT\n        def t_FUNCNAME(t):\n            r'((sqrt)|(ln)|(exp)|(log)|(mag)|(dB)|(dex))(?=\\ *\\()'\n            return t\n\n        def t_UNIT(t):\n            \"%|([YZEPTGMkhdcmu\\N{MICRO SIGN}npfazy]?'((?!\\\\d)\\\\w)+')|((?!\\\\d)\\\\w)+\"\n            t.value = cls._get_unit(t)\n            return t\n\n        t_ignore = ' '\n\n        # Error handling rule\n        def t_error(t):\n            raise ValueError(\n                f\"Invalid character at col {t.lexpos}\")\n\n        return parsing.lex(lextab='generic_lextab', package='astropy/units',\n                           reflags=int(re.UNICODE))\n\n    @classmethod\n    def _make_parser(cls):\n        \"\"\"\n        The grammar here is based on the description in the `FITS\n        standard\n        <http://fits.gsfc.nasa.gov/standard30/fits_standard30aa.pdf>`_,\n        Section 4.3, which is not terribly precise.  The exact grammar\n        is here is based on the YACC grammar in the `unity library\n        <https://bitbucket.org/nxg/unity/>`_.\n\n        This same grammar is used by the `\"fits\"` and `\"vounit\"`\n        formats, the only difference being the set of available unit\n        strings.\n        \"\"\"\n        tokens = cls._tokens\n\n        def p_main(p):\n            '''\n            main : unit\n                 | structured_unit\n                 | structured_subunit\n            '''\n            if isinstance(p[1], tuple):\n                # Unpack possible StructuredUnit inside a tuple, ie.,\n                # ignore any set of very outer parentheses.\n                p[0] = p[1][0]\n            else:\n                p[0] = p[1]\n\n        def p_structured_subunit(p):\n            '''\n            structured_subunit : OPEN_PAREN structured_unit CLOSE_PAREN\n            '''\n            # We hide a structured unit enclosed by parentheses inside\n            # a tuple, so that we can easily distinguish units like\n            # \"(au, au/day), yr\" from \"au, au/day, yr\".\n            p[0] = (p[2],)\n\n        def p_structured_unit(p):\n            '''\n            structured_unit : subunit COMMA\n                            | subunit COMMA subunit\n            '''\n            from ..structured import StructuredUnit\n            inputs = (p[1],) if len(p) == 3 else (p[1], p[3])\n            units = ()\n            for subunit in inputs:\n                if isinstance(subunit, tuple):\n                    # Structured unit that should be its own entry in the\n                    # new StructuredUnit (was enclosed in parentheses).\n                    units += subunit\n                elif isinstance(subunit, StructuredUnit):\n                    # Structured unit whose entries should be\n                    # individiually added to the new StructuredUnit.\n                    units += subunit.values()\n                else:\n                    # Regular unit to be added to the StructuredUnit.\n                    units += (subunit,)\n\n            p[0] = StructuredUnit(units)\n\n        def p_subunit(p):\n            '''\n            subunit : unit\n                    | structured_unit\n                    | structured_subunit\n            '''\n            p[0] = p[1]\n\n        def p_unit(p):\n            '''\n            unit : product_of_units\n                 | factor product_of_units\n                 | factor product product_of_units\n                 | division_product_of_units\n                 | factor division_product_of_units\n                 | factor product division_product_of_units\n                 | inverse_unit\n                 | factor inverse_unit\n                 | factor product inverse_unit\n                 | factor\n            '''\n            from astropy.units.core import Unit\n            if len(p) == 2:\n                p[0] = Unit(p[1])\n            elif len(p) == 3:\n                p[0] = Unit(p[1] * p[2])\n            elif len(p) == 4:\n                p[0] = Unit(p[1] * p[3])\n\n        def p_division_product_of_units(p):\n            '''\n            division_product_of_units : division_product_of_units division product_of_units\n                                      | product_of_units\n            '''\n            from astropy.units.core import Unit\n            if len(p) == 4:\n                p[0] = Unit(p[1] / p[3])\n            else:\n                p[0] = p[1]\n\n        def p_inverse_unit(p):\n            '''\n            inverse_unit : division unit_expression\n            '''\n            p[0] = p[2] ** -1\n\n        def p_factor(p):\n            '''\n            factor : factor_fits\n                   | factor_float\n                   | factor_int\n            '''\n            p[0] = p[1]\n\n        def p_factor_float(p):\n            '''\n            factor_float : signed_float\n                         | signed_float UINT signed_int\n                         | signed_float UINT power numeric_power\n            '''\n            if cls.name == 'fits':\n                raise ValueError(\"Numeric factor not supported by FITS\")\n            if len(p) == 4:\n                p[0] = p[1] * p[2] ** float(p[3])\n            elif len(p) == 5:\n                p[0] = p[1] * p[2] ** float(p[4])\n            elif len(p) == 2:\n                p[0] = p[1]\n\n        def p_factor_int(p):\n            '''\n            factor_int : UINT\n                       | UINT signed_int\n                       | UINT power numeric_power\n                       | UINT UINT signed_int\n                       | UINT UINT power numeric_power\n            '''\n            if cls.name == 'fits':\n                raise ValueError(\"Numeric factor not supported by FITS\")\n            if len(p) == 2:\n                p[0] = p[1]\n            elif len(p) == 3:\n                p[0] = p[1] ** float(p[2])\n            elif len(p) == 4:\n                if isinstance(p[2], int):\n                    p[0] = p[1] * p[2] ** float(p[3])\n                else:\n                    p[0] = p[1] ** float(p[3])\n            elif len(p) == 5:\n                p[0] = p[1] * p[2] ** p[4]\n\n        def p_factor_fits(p):\n            '''\n            factor_fits : UINT power OPEN_PAREN signed_int CLOSE_PAREN\n                        | UINT power OPEN_PAREN UINT CLOSE_PAREN\n                        | UINT power signed_int\n                        | UINT power UINT\n                        | UINT SIGN UINT\n                        | UINT OPEN_PAREN signed_int CLOSE_PAREN\n            '''\n            if p[1] != 10:\n                if cls.name == 'fits':\n                    raise ValueError(\"Base must be 10\")\n                else:\n                    return\n            if len(p) == 4:\n                if p[2] in ('**', '^'):\n                    p[0] = 10 ** p[3]\n                else:\n                    p[0] = 10 ** (p[2] * p[3])\n            elif len(p) == 5:\n                p[0] = 10 ** p[3]\n            elif len(p) == 6:\n                p[0] = 10 ** p[4]\n\n        def p_product_of_units(p):\n            '''\n            product_of_units : unit_expression product product_of_units\n                             | unit_expression product_of_units\n                             | unit_expression\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            elif len(p) == 3:\n                p[0] = p[1] * p[2]\n            else:\n                p[0] = p[1] * p[3]\n\n        def p_unit_expression(p):\n            '''\n            unit_expression : function\n                            | unit_with_power\n                            | OPEN_PAREN product_of_units CLOSE_PAREN\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = p[2]\n\n        def p_unit_with_power(p):\n            '''\n            unit_with_power : UNIT power numeric_power\n                            | UNIT numeric_power\n                            | UNIT\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            elif len(p) == 3:\n                p[0] = p[1] ** p[2]\n            else:\n                p[0] = p[1] ** p[3]\n\n        def p_numeric_power(p):\n            '''\n            numeric_power : sign UINT\n                          | OPEN_PAREN paren_expr CLOSE_PAREN\n            '''\n            if len(p) == 3:\n                p[0] = p[1] * p[2]\n            elif len(p) == 4:\n                p[0] = p[2]\n\n        def p_paren_expr(p):\n            '''\n            paren_expr : sign UINT\n                       | signed_float\n                       | frac\n            '''\n            if len(p) == 3:\n                p[0] = p[1] * p[2]\n            else:\n                p[0] = p[1]\n\n        def p_frac(p):\n            '''\n            frac : sign UINT division sign UINT\n            '''\n            p[0] = Fraction(p[1] * p[2], p[4] * p[5])\n\n        def p_sign(p):\n            '''\n            sign : SIGN\n                 |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1\n\n        def p_product(p):\n            '''\n            product : STAR\n                    | PERIOD\n            '''\n            pass\n\n        def p_division(p):\n            '''\n            division : SOLIDUS\n            '''\n            pass\n\n        def p_power(p):\n            '''\n            power : DOUBLE_STAR\n                  | CARET\n            '''\n            p[0] = p[1]\n\n        def p_signed_int(p):\n            '''\n            signed_int : SIGN UINT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_signed_float(p):\n            '''\n            signed_float : sign UINT\n                         | sign UFLOAT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_function_name(p):\n            '''\n            function_name : FUNCNAME\n            '''\n            p[0] = p[1]\n\n        def p_function(p):\n            '''\n            function : function_name OPEN_PAREN main CLOSE_PAREN\n            '''\n            if p[1] == 'sqrt':\n                p[0] = p[3] ** 0.5\n                return\n            elif p[1] in ('mag', 'dB', 'dex'):\n                function_unit = cls._parse_unit(p[1])\n                # In Generic, this is callable, but that does not have to\n                # be the case in subclasses (e.g., in VOUnit it is not).\n                if callable(function_unit):\n                    p[0] = function_unit(p[3])\n                    return\n\n            raise ValueError(f\"'{p[1]}' is not a recognized function\")\n\n        def p_error(p):\n            raise ValueError()\n\n        return parsing.yacc(tabmodule='generic_parsetab', package='astropy/units')\n\n    @classmethod\n    def _get_unit(cls, t):\n        try:\n            return cls._parse_unit(t.value)\n        except ValueError as e:\n            registry = core.get_current_unit_registry()\n            if t.value in registry.aliases:\n                return registry.aliases[t.value]\n\n            raise ValueError(\n                f\"At col {t.lexpos}, {str(e)}\")\n\n    @classmethod\n    def _parse_unit(cls, s, detailed_exception=True):\n        registry = core.get_current_unit_registry().registry\n        if s in cls._unit_symbols:\n            s = cls._unit_symbols[s]\n\n        elif not s.isascii():\n            if s[0] == '\\N{MICRO SIGN}':\n                s = 'u' + s[1:]\n            if s[-1] in cls._prefixable_unit_symbols:\n                s = s[:-1] + cls._prefixable_unit_symbols[s[-1]]\n            elif len(s) > 1 and s[-1] in cls._unit_suffix_symbols:\n                s = s[:-1] + cls._unit_suffix_symbols[s[-1]]\n            elif s.endswith('R\\N{INFINITY}'):\n                s = s[:-2] + 'Ry'\n\n        if s in registry:\n            return registry[s]\n\n        if detailed_exception:\n            raise ValueError(\n                f'{s} is not a valid unit. {did_you_mean(s, registry)}')\n        else:\n            raise ValueError()\n\n    _unit_symbols = {\n        '%': 'percent',\n        '\\N{PRIME}': 'arcmin',\n        '\\N{DOUBLE PRIME}': 'arcsec',\n        '\\N{MODIFIER LETTER SMALL H}': 'hourangle',\n        'e\\N{SUPERSCRIPT MINUS}': 'electron',\n    }\n\n    _prefixable_unit_symbols = {\n        '\\N{GREEK CAPITAL LETTER OMEGA}': 'Ohm',\n        '\\N{LATIN CAPITAL LETTER A WITH RING ABOVE}': 'Angstrom',\n        '\\N{SCRIPT SMALL L}': 'l',\n    }\n\n    _unit_suffix_symbols = {\n        '\\N{CIRCLED DOT OPERATOR}': 'sun',\n        '\\N{SUN}': 'sun',\n        '\\N{CIRCLED PLUS}': 'earth',\n        '\\N{EARTH}': 'earth',\n        '\\N{JUPITER}': 'jupiter',\n        '\\N{LATIN SUBSCRIPT SMALL LETTER E}': '_e',\n        '\\N{LATIN SUBSCRIPT SMALL LETTER P}': '_p',\n    }\n\n    _translations = str.maketrans({\n        '\\N{GREEK SMALL LETTER MU}': '\\N{MICRO SIGN}',\n        '\\N{MINUS SIGN}': '-',\n    })\n    \"\"\"Character translations that should be applied before parsing a string.\n\n    Note that this does explicitly *not* generally translate MICRO SIGN to u,\n    since then a string like 'µ' would be interpreted as unit mass.\n    \"\"\"\n\n    _superscripts = (\n        '\\N{SUPERSCRIPT MINUS}'\n        '\\N{SUPERSCRIPT PLUS SIGN}'\n        '\\N{SUPERSCRIPT ZERO}'\n        '\\N{SUPERSCRIPT ONE}'\n        '\\N{SUPERSCRIPT TWO}'\n        '\\N{SUPERSCRIPT THREE}'\n        '\\N{SUPERSCRIPT FOUR}'\n        '\\N{SUPERSCRIPT FIVE}'\n        '\\N{SUPERSCRIPT SIX}'\n        '\\N{SUPERSCRIPT SEVEN}'\n        '\\N{SUPERSCRIPT EIGHT}'\n        '\\N{SUPERSCRIPT NINE}'\n    )\n\n    _superscript_translations = str.maketrans(_superscripts, '-+0123456789')\n    _regex_superscript = re.compile(f'[{_superscripts}]?[{_superscripts[2:]}]+')\n    _regex_deg = re.compile('°([CF])?')\n\n    @classmethod\n    def _convert_superscript(cls, m):\n        return f'({m.group().translate(cls._superscript_translations)})'\n\n    @classmethod\n    def _convert_deg(cls, m):\n        if len(m.string) == 1:\n            return 'deg'\n        return m.string.replace('°', 'deg_')\n\n    @classmethod\n    def parse(cls, s, debug=False):\n        if not isinstance(s, str):\n            s = s.decode('ascii')\n        elif not s.isascii():\n            # common normalization of unicode strings to avoid\n            # having to deal with multiple representations of\n            # the same character. This normalizes to \"composed\" form\n            # and will e.g. convert OHM SIGN to GREEK CAPITAL LETTER OMEGA\n            s = unicodedata.normalize('NFC', s)\n            # Translate some basic unicode items that we'd like to support on\n            # input but are not standard.\n            s = s.translate(cls._translations)\n\n            # TODO: might the below be better done in the parser/lexer?\n            # Translate superscripts to parenthesized numbers; this ensures\n            # that mixes of superscripts and regular numbers fail.\n            s = cls._regex_superscript.sub(cls._convert_superscript, s)\n            # Translate possible degrees.\n            s = cls._regex_deg.sub(cls._convert_deg, s)\n\n        result = cls._do_parse(s, debug=debug)\n        # Check for excess solidi, but exclude fractional exponents (accepted)\n        n_slashes = s.count('/')\n        if n_slashes > 1 and (n_slashes - len(re.findall(r'\\(\\d+/\\d+\\)', s))) > 1:\n            warnings.warn(\n                \"'{}' contains multiple slashes, which is \"\n                \"discouraged by the FITS standard\".format(s),\n                core.UnitsWarning)\n        return result\n\n    @classmethod\n    def _do_parse(cls, s, debug=False):\n        try:\n            # This is a short circuit for the case where the string\n            # is just a single unit name\n            return cls._parse_unit(s, detailed_exception=False)\n        except ValueError as e:\n            try:\n                return cls._parser.parse(s, lexer=cls._lexer, debug=debug)\n            except ValueError as e:\n                if str(e):\n                    raise\n                else:\n                    raise ValueError(f\"Syntax error parsing unit '{s}'\")\n\n    @classmethod\n    def _get_unit_name(cls, unit):\n        return unit.get_format_name('generic')\n\n    @classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        units.sort(key=lambda x: cls._get_unit_name(x[0]).lower())\n\n        for base, power in units:\n            if power == 1:\n                out.append(cls._get_unit_name(base))\n            else:\n                power = utils.format_power(power)\n                if '/' in power or '.' in power:\n                    out.append(f'{cls._get_unit_name(base)}({power})')\n                else:\n                    out.append(f'{cls._get_unit_name(base)}{power}')\n        return ' '.join(out)\n\n    @classmethod\n    def to_string(cls, unit):\n        return _to_string(cls, unit)"},{"className":"VOUnit","col":0,"comment":"\n    The IVOA standard for units used by the VO.\n\n    This is an implementation of `Units in the VO 1.0\n    <http://www.ivoa.net/documents/VOUnits/>`_.\n    ","endLoc":249,"id":9985,"nodeType":"Class","startLoc":16,"text":"class VOUnit(generic.Generic):\n    \"\"\"\n    The IVOA standard for units used by the VO.\n\n    This is an implementation of `Units in the VO 1.0\n    <http://www.ivoa.net/documents/VOUnits/>`_.\n    \"\"\"\n    _explicit_custom_unit_regex = re.compile(\n        r\"^[YZEPTGMkhdcmunpfazy]?'((?!\\d)\\w)+'$\")\n    _custom_unit_regex = re.compile(r\"^((?!\\d)\\w)+$\")\n    _custom_units = {}\n\n    @staticmethod\n    def _generate_unit_names():\n        from astropy import units as u\n        from astropy.units import required_by_vounit as uvo\n\n        names = {}\n        deprecated_names = set()\n\n        bases = [\n            'A', 'C', 'D', 'F', 'G', 'H', 'Hz', 'J', 'Jy', 'K', 'N',\n            'Ohm', 'Pa', 'R', 'Ry', 'S', 'T', 'V', 'W', 'Wb', 'a',\n            'adu', 'arcmin', 'arcsec', 'barn', 'beam', 'bin', 'cd',\n            'chan', 'count', 'ct', 'd', 'deg', 'eV', 'erg', 'g', 'h',\n            'lm', 'lx', 'lyr', 'm', 'mag', 'min', 'mol', 'pc', 'ph',\n            'photon', 'pix', 'pixel', 'rad', 'rad', 's', 'solLum',\n            'solMass', 'solRad', 'sr', 'u', 'voxel', 'yr'\n        ]\n        binary_bases = [\n            'bit', 'byte', 'B'\n        ]\n        simple_units = [\n            'Angstrom', 'angstrom', 'AU', 'au', 'Ba', 'dB', 'mas'\n        ]\n        si_prefixes = [\n            'y', 'z', 'a', 'f', 'p', 'n', 'u', 'm', 'c', 'd',\n            '', 'da', 'h', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'\n        ]\n        binary_prefixes = [\n            'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei'\n        ]\n        deprecated_units = set([\n            'a', 'angstrom', 'Angstrom', 'au', 'Ba', 'barn', 'ct',\n            'erg', 'G', 'ph', 'pix'\n        ])\n\n        def do_defines(bases, prefixes, skips=[]):\n            for base in bases:\n                for prefix in prefixes:\n                    key = prefix + base\n                    if key in skips:\n                        continue\n                    if keyword.iskeyword(key):\n                        continue\n\n                    names[key] = getattr(u if hasattr(u, key) else uvo, key)\n                    if base in deprecated_units:\n                        deprecated_names.add(key)\n\n        do_defines(bases, si_prefixes, ['pct', 'pcount', 'yd'])\n        do_defines(binary_bases, si_prefixes + binary_prefixes, ['dB', 'dbyte'])\n        do_defines(simple_units, [''])\n\n        return names, deprecated_names, []\n\n    @classmethod\n    def parse(cls, s, debug=False):\n        if s in ('unknown', 'UNKNOWN'):\n            return None\n        if s == '':\n            return core.dimensionless_unscaled\n        # Check for excess solidi, but exclude fractional exponents (allowed)\n        if (s.count('/') > 1 and\n                s.count('/') - len(re.findall(r'\\(\\d+/\\d+\\)', s)) > 1):\n            raise core.UnitsError(\n                \"'{}' contains multiple slashes, which is \"\n                \"disallowed by the VOUnit standard\".format(s))\n        result = cls._do_parse(s, debug=debug)\n        if hasattr(result, 'function_unit'):\n            raise ValueError(\"Function units are not yet supported in \"\n                             \"VOUnit.\")\n        return result\n\n    @classmethod\n    def _get_unit(cls, t):\n        try:\n            return super()._get_unit(t)\n        except ValueError:\n            if cls._explicit_custom_unit_regex.match(t.value):\n                return cls._def_custom_unit(t.value)\n\n            if cls._custom_unit_regex.match(t.value):\n                warnings.warn(\n                    \"Unit {!r} not supported by the VOUnit \"\n                    \"standard. {}\".format(\n                        t.value, utils.did_you_mean_units(\n                            t.value, cls._units, cls._deprecated_units,\n                            cls._to_decomposed_alternative)),\n                    core.UnitsWarning)\n\n                return cls._def_custom_unit(t.value)\n\n            raise\n\n    @classmethod\n    def _parse_unit(cls, unit, detailed_exception=True):\n        if unit not in cls._units:\n            raise ValueError()\n\n        if unit in cls._deprecated_units:\n            utils.unit_deprecation_warning(\n                unit, cls._units[unit], 'VOUnit',\n                cls._to_decomposed_alternative)\n\n        return cls._units[unit]\n\n    @classmethod\n    def _get_unit_name(cls, unit):\n        # The da- and d- prefixes are discouraged.  This has the\n        # effect of adding a scale to value in the result.\n        if isinstance(unit, core.PrefixUnit):\n            if unit._represents.scale == 10.0:\n                raise ValueError(\n                    \"In '{}': VOUnit can not represent units with the 'da' \"\n                    \"(deka) prefix\".format(unit))\n            elif unit._represents.scale == 0.1:\n                raise ValueError(\n                    \"In '{}': VOUnit can not represent units with the 'd' \"\n                    \"(deci) prefix\".format(unit))\n\n        name = unit.get_format_name('vounit')\n\n        if unit in cls._custom_units.values():\n            return name\n\n        if name not in cls._units:\n            raise ValueError(\n                f\"Unit {name!r} is not part of the VOUnit standard\")\n\n        if name in cls._deprecated_units:\n            utils.unit_deprecation_warning(\n                name, unit, 'VOUnit',\n                cls._to_decomposed_alternative)\n\n        return name\n\n    @classmethod\n    def _def_custom_unit(cls, unit):\n        def def_base(name):\n            if name in cls._custom_units:\n                return cls._custom_units[name]\n\n            if name.startswith(\"'\"):\n                return core.def_unit(\n                    [name[1:-1], name],\n                    format={'vounit': name},\n                    namespace=cls._custom_units)\n            else:\n                return core.def_unit(\n                    name, namespace=cls._custom_units)\n\n        if unit in cls._custom_units:\n            return cls._custom_units[unit]\n\n        for short, full, factor in core.si_prefixes:\n            for prefix in short:\n                if unit.startswith(prefix):\n                    base_name = unit[len(prefix):]\n                    base_unit = def_base(base_name)\n                    return core.PrefixUnit(\n                        [prefix + x for x in base_unit.names],\n                        core.CompositeUnit(factor, [base_unit], [1],\n                                           _error_check=False),\n                        format={'vounit': prefix + base_unit.names[-1]},\n                        namespace=cls._custom_units)\n\n        return def_base(unit)\n\n    @classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        units.sort(key=lambda x: cls._get_unit_name(x[0]).lower())\n\n        for base, power in units:\n            if power == 1:\n                out.append(cls._get_unit_name(base))\n            else:\n                power = utils.format_power(power)\n                if '/' in power or '.' in power:\n                    out.append(f'{cls._get_unit_name(base)}({power})')\n                else:\n                    out.append(f'{cls._get_unit_name(base)}**{power}')\n        return '.'.join(out)\n\n    @classmethod\n    def to_string(cls, unit):\n        from astropy.units import core\n\n        # Remove units that aren't known to the format\n        unit = utils.decompose_to_known_units(unit, cls._get_unit_name)\n\n        if isinstance(unit, core.CompositeUnit):\n            if unit.physical_type == 'dimensionless' and unit.scale != 1:\n                raise core.UnitScaleError(\n                    \"The VOUnit format is not able to \"\n                    \"represent scale for dimensionless units. \"\n                    \"Multiply your data by {:e}.\"\n                    .format(unit.scale))\n            s = ''\n            if unit.scale != 1:\n                s += f'{unit.scale:.8g}'\n\n            pairs = list(zip(unit.bases, unit.powers))\n            pairs.sort(key=operator.itemgetter(1), reverse=True)\n\n            s += cls._format_unit_list(pairs)\n        elif isinstance(unit, core.NamedUnit):\n            s = cls._get_unit_name(unit)\n\n        return s\n\n    @classmethod\n    def _to_decomposed_alternative(cls, unit):\n        from astropy.units import core\n\n        try:\n            s = cls.to_string(unit)\n        except core.UnitScaleError:\n            scale = unit.scale\n            unit = copy.copy(unit)\n            unit._scale = 1.0\n            return f'{cls.to_string(unit)} (with data multiplied by {scale})'\n        return s"},{"className":"Base","col":0,"comment":"\n    The abstract base class of all unit formats.\n    ","endLoc":40,"id":9986,"nodeType":"Class","startLoc":3,"text":"class Base:\n    \"\"\"\n    The abstract base class of all unit formats.\n    \"\"\"\n    registry = {}\n\n    def __new__(cls, *args, **kwargs):\n        # This __new__ is to make it clear that there is no reason to\n        # instantiate a Formatter--if you try to you'll just get back the\n        # class\n        return cls\n\n    def __init_subclass__(cls, **kwargs):\n        # Keep a registry of all formats.  Key by the class name unless a name\n        # is explicitly set (i.e., one *not* inherited from a superclass).\n        if 'name' not in cls.__dict__:\n            cls.name = cls.__name__.lower()\n\n        Base.registry[cls.name] = cls\n        super().__init_subclass__(**kwargs)\n\n    @classmethod\n    def parse(cls, s):\n        \"\"\"\n        Convert a string to a unit object.\n        \"\"\"\n\n        raise NotImplementedError(\n            f\"Can not parse with {cls.__name__} format\")\n\n    @classmethod\n    def to_string(cls, u):\n        \"\"\"\n        Convert a unit object to a string.\n        \"\"\"\n\n        raise NotImplementedError(\n            f\"Can not output in {cls.__name__} format\")"},{"col":4,"comment":"null","endLoc":302,"header":"def __rmul__(self, other)","id":9987,"name":"__rmul__","nodeType":"Function","startLoc":301,"text":"def __rmul__(self, other):\n        return self.__mul__(other)"},{"col":4,"comment":"null","endLoc":317,"header":"def __truediv__(self, other)","id":9988,"name":"__truediv__","nodeType":"Function","startLoc":304,"text":"def __truediv__(self, other):\n        if isinstance(other, (str, UnitBase, FunctionUnitBase)):\n            if self.physical_unit == dimensionless_unscaled:\n                # If dimensionless, drop back to normal unit and retry.\n                return self.function_unit / other\n            else:\n                raise UnitsError(\"Cannot divide a function unit \"\n                                 \"with a physical dimension by any unit.\")\n        else:\n            # Anything not like a unit, try initialising as a function quantity.\n            try:\n                return self._quantity_class(1./other, unit=self)\n            except Exception:\n                return NotImplemented"},{"col":4,"comment":"null","endLoc":13,"header":"def __new__(cls, *args, **kwargs)","id":9990,"name":"__new__","nodeType":"Function","startLoc":9,"text":"def __new__(cls, *args, **kwargs):\n        # This __new__ is to make it clear that there is no reason to\n        # instantiate a Formatter--if you try to you'll just get back the\n        # class\n        return cls"},{"col":4,"comment":"null","endLoc":22,"header":"def __init_subclass__(cls, **kwargs)","id":9991,"name":"__init_subclass__","nodeType":"Function","startLoc":15,"text":"def __init_subclass__(cls, **kwargs):\n        # Keep a registry of all formats.  Key by the class name unless a name\n        # is explicitly set (i.e., one *not* inherited from a superclass).\n        if 'name' not in cls.__dict__:\n            cls.name = cls.__name__.lower()\n\n        Base.registry[cls.name] = cls\n        super().__init_subclass__(**kwargs)"},{"col":4,"comment":"null","endLoc":329,"header":"def __rtruediv__(self, other)","id":9992,"name":"__rtruediv__","nodeType":"Function","startLoc":319,"text":"def __rtruediv__(self, other):\n        if isinstance(other, (str, UnitBase, FunctionUnitBase)):\n            if self.physical_unit == dimensionless_unscaled:\n                # If dimensionless, drop back to normal unit and retry.\n                return other / self.function_unit\n            else:\n                raise UnitsError(\"Cannot divide a function unit \"\n                                 \"with a physical dimension into any unit\")\n        else:\n            # Don't know what to do with anything not like a unit.\n            return NotImplemented"},{"col":4,"comment":"null","endLoc":341,"header":"def __pow__(self, power)","id":9993,"name":"__pow__","nodeType":"Function","startLoc":331,"text":"def __pow__(self, power):\n        if power == 0:\n            return dimensionless_unscaled\n        elif power == 1:\n            return self._copy()\n\n        if self.physical_unit == dimensionless_unscaled:\n            return self.function_unit ** power\n\n        raise UnitsError(\"Cannot raise a function unit \"\n                         \"with a physical dimension to any power but 0 or 1.\")"},{"col":4,"comment":"null","endLoc":80,"header":"@staticmethod\n    def _generate_unit_names()","id":9994,"name":"_generate_unit_names","nodeType":"Function","startLoc":28,"text":"@staticmethod\n    def _generate_unit_names():\n        from astropy import units as u\n        from astropy.units import required_by_vounit as uvo\n\n        names = {}\n        deprecated_names = set()\n\n        bases = [\n            'A', 'C', 'D', 'F', 'G', 'H', 'Hz', 'J', 'Jy', 'K', 'N',\n            'Ohm', 'Pa', 'R', 'Ry', 'S', 'T', 'V', 'W', 'Wb', 'a',\n            'adu', 'arcmin', 'arcsec', 'barn', 'beam', 'bin', 'cd',\n            'chan', 'count', 'ct', 'd', 'deg', 'eV', 'erg', 'g', 'h',\n            'lm', 'lx', 'lyr', 'm', 'mag', 'min', 'mol', 'pc', 'ph',\n            'photon', 'pix', 'pixel', 'rad', 'rad', 's', 'solLum',\n            'solMass', 'solRad', 'sr', 'u', 'voxel', 'yr'\n        ]\n        binary_bases = [\n            'bit', 'byte', 'B'\n        ]\n        simple_units = [\n            'Angstrom', 'angstrom', 'AU', 'au', 'Ba', 'dB', 'mas'\n        ]\n        si_prefixes = [\n            'y', 'z', 'a', 'f', 'p', 'n', 'u', 'm', 'c', 'd',\n            '', 'da', 'h', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'\n        ]\n        binary_prefixes = [\n            'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei'\n        ]\n        deprecated_units = set([\n            'a', 'angstrom', 'Angstrom', 'au', 'Ba', 'barn', 'ct',\n            'erg', 'G', 'ph', 'pix'\n        ])\n\n        def do_defines(bases, prefixes, skips=[]):\n            for base in bases:\n                for prefix in prefixes:\n                    key = prefix + base\n                    if key in skips:\n                        continue\n                    if keyword.iskeyword(key):\n                        continue\n\n                    names[key] = getattr(u if hasattr(u, key) else uvo, key)\n                    if base in deprecated_units:\n                        deprecated_names.add(key)\n\n        do_defines(bases, si_prefixes, ['pct', 'pcount', 'yd'])\n        do_defines(binary_bases, si_prefixes + binary_prefixes, ['dB', 'dbyte'])\n        do_defines(simple_units, [''])\n\n        return names, deprecated_names, []"},{"col":4,"comment":"\n        Convert a string to a unit object.\n        ","endLoc":31,"header":"@classmethod\n    def parse(cls, s)","id":9995,"name":"parse","nodeType":"Function","startLoc":24,"text":"@classmethod\n    def parse(cls, s):\n        \"\"\"\n        Convert a string to a unit object.\n        \"\"\"\n\n        raise NotImplementedError(\n            f\"Can not parse with {cls.__name__} format\")"},{"col":4,"comment":"\n        Convert a unit object to a string.\n        ","endLoc":40,"header":"@classmethod\n    def to_string(cls, u)","id":9996,"name":"to_string","nodeType":"Function","startLoc":33,"text":"@classmethod\n    def to_string(cls, u):\n        \"\"\"\n        Convert a unit object to a string.\n        \"\"\"\n\n        raise NotImplementedError(\n            f\"Can not output in {cls.__name__} format\")"},{"attributeType":"null","col":4,"comment":"null","endLoc":7,"id":9997,"name":"registry","nodeType":"Attribute","startLoc":7,"text":"registry"},{"col":4,"comment":"null","endLoc":344,"header":"def __pos__(self)","id":9998,"name":"__pos__","nodeType":"Function","startLoc":343,"text":"def __pos__(self):\n        return self._copy()"},{"attributeType":"null","col":12,"comment":"null","endLoc":19,"id":9999,"name":"name","nodeType":"Attribute","startLoc":19,"text":"cls.name"},{"col":4,"comment":"null","endLoc":85,"header":"@classproperty(lazy=True)\n    def _all_units(cls)","id":10000,"name":"_all_units","nodeType":"Function","startLoc":83,"text":"@classproperty(lazy=True)\n    def _all_units(cls):\n        return cls._generate_unit_names()"},{"col":4,"comment":"\n        Output the unit in the given format as a string.\n\n        The physical unit is appended, within parentheses, to the function\n        unit, as in \"dB(mW)\", with both units set using the given format\n\n        Parameters\n        ----------\n        format : `astropy.units.format.Base` instance or str\n            The name of a format or a formatter object.  If not\n            provided, defaults to the generic format.\n        ","endLoc":372,"header":"def to_string(self, format='generic')","id":10001,"name":"to_string","nodeType":"Function","startLoc":346,"text":"def to_string(self, format='generic'):\n        \"\"\"\n        Output the unit in the given format as a string.\n\n        The physical unit is appended, within parentheses, to the function\n        unit, as in \"dB(mW)\", with both units set using the given format\n\n        Parameters\n        ----------\n        format : `astropy.units.format.Base` instance or str\n            The name of a format or a formatter object.  If not\n            provided, defaults to the generic format.\n        \"\"\"\n        if format not in ('generic', 'unscaled', 'latex'):\n            raise ValueError(\"Function units cannot be written in {} format. \"\n                             \"Only 'generic', 'unscaled' and 'latex' are \"\n                             \"supported.\".format(format))\n        self_str = self.function_unit.to_string(format)\n        pu_str = self.physical_unit.to_string(format)\n        if pu_str == '':\n            pu_str = '1'\n        if format == 'latex':\n            self_str += r'$\\mathrm{{\\left( {0} \\right)}}$'.format(\n                pu_str[1:-1])   # need to strip leading and trailing \"$\"\n        else:\n            self_str += f'({pu_str})'\n        return self_str"},{"col":4,"comment":"null","endLoc":98,"header":"@classmethod\n    def parse(cls, s, debug=False)","id":10003,"name":"parse","nodeType":"Function","startLoc":82,"text":"@classmethod\n    def parse(cls, s, debug=False):\n        if s in ('unknown', 'UNKNOWN'):\n            return None\n        if s == '':\n            return core.dimensionless_unscaled\n        # Check for excess solidi, but exclude fractional exponents (allowed)\n        if (s.count('/') > 1 and\n                s.count('/') - len(re.findall(r'\\(\\d+/\\d+\\)', s)) > 1):\n            raise core.UnitsError(\n                \"'{}' contains multiple slashes, which is \"\n                \"disallowed by the VOUnit standard\".format(s))\n        result = cls._do_parse(s, debug=debug)\n        if hasattr(result, 'function_unit'):\n            raise ValueError(\"Function units are not yet supported in \"\n                             \"VOUnit.\")\n        return result"},{"col":4,"comment":"Return string representation for unit.","endLoc":380,"header":"def __str__(self)","id":10004,"name":"__str__","nodeType":"Function","startLoc":374,"text":"def __str__(self):\n        \"\"\"Return string representation for unit.\"\"\"\n        self_str = str(self.function_unit)\n        pu_str = str(self.physical_unit)\n        if pu_str:\n            self_str += f'({pu_str})'\n        return self_str"},{"col":4,"comment":"null","endLoc":392,"header":"def __repr__(self)","id":10005,"name":"__repr__","nodeType":"Function","startLoc":382,"text":"def __repr__(self):\n        # By default, try to give a representation using `Unit(<string>)`,\n        # with string such that parsing it would give the correct FunctionUnit.\n        if callable(self.function_unit):\n            return f'Unit(\"{self.to_string()}\")'\n\n        else:\n            return '{}(\"{}\"{})'.format(\n                self.__class__.__name__, self.physical_unit,\n                \"\" if self.function_unit is self._default_function_unit\n                else f', unit=\"{self.function_unit}\"')"},{"col":4,"comment":"\n        Generate latex representation of unit name.  This is used by\n        the IPython notebook to print a unit with a nice layout.\n\n        Returns\n        -------\n        Latex string\n        ","endLoc":403,"header":"def _repr_latex_(self)","id":10006,"name":"_repr_latex_","nodeType":"Function","startLoc":394,"text":"def _repr_latex_(self):\n        \"\"\"\n        Generate latex representation of unit name.  This is used by\n        the IPython notebook to print a unit with a nice layout.\n\n        Returns\n        -------\n        Latex string\n        \"\"\"\n        return self.to_string('latex')"},{"col":4,"comment":"null","endLoc":406,"header":"def __hash__(self)","id":10007,"name":"__hash__","nodeType":"Function","startLoc":405,"text":"def __hash__(self):\n        return hash((self.function_unit, self.physical_unit))"},{"attributeType":"null","col":4,"comment":"null","endLoc":91,"id":10008,"name":"__array_priority__","nodeType":"Attribute","startLoc":91,"text":"__array_priority__"},{"attributeType":"null","col":16,"comment":"null","endLoc":111,"id":10009,"name":"_function_unit","nodeType":"Attribute","startLoc":111,"text":"self._function_unit"},{"col":0,"comment":"Convert between Kelvin, Celsius, Rankine and Fahrenheit here because\n    Unit and CompositeUnit cannot do addition or subtraction properly.\n    ","endLoc":754,"header":"def temperature()","id":10010,"name":"temperature","nodeType":"Function","startLoc":742,"text":"def temperature():\n    \"\"\"Convert between Kelvin, Celsius, Rankine and Fahrenheit here because\n    Unit and CompositeUnit cannot do addition or subtraction properly.\n    \"\"\"\n    from .imperial import deg_F, deg_R\n    return Equivalency([\n        (si.K, si.deg_C, lambda x: x - 273.15, lambda x: x + 273.15),\n        (si.deg_C, deg_F, lambda x: x * 1.8 + 32.0, lambda x: (x - 32.0) / 1.8),\n        (si.K, deg_F, lambda x: (x - 273.15) * 1.8 + 32.0,\n         lambda x: ((x - 32.0) / 1.8) + 273.15),\n        (deg_R, deg_F, lambda x: x - 459.67, lambda x: x + 459.67),\n        (deg_R, si.deg_C, lambda x: (x - 491.67) * (5/9), lambda x: x * 1.8 + 491.67),\n        (deg_R, si.K, lambda x: x * (5/9), lambda x: x * 1.8)], \"temperature\")"},{"col":25,"endLoc":748,"id":10011,"nodeType":"Lambda","startLoc":748,"text":"lambda x: x - 273.15"},{"col":47,"endLoc":748,"id":10012,"nodeType":"Lambda","startLoc":748,"text":"lambda x: x + 273.15"},{"col":26,"endLoc":749,"id":10013,"nodeType":"Lambda","startLoc":749,"text":"lambda x: x * 1.8 + 32.0"},{"col":52,"endLoc":749,"id":10014,"nodeType":"Lambda","startLoc":749,"text":"lambda x: (x - 32.0) / 1.8"},{"col":22,"endLoc":750,"id":10015,"nodeType":"Lambda","startLoc":750,"text":"lambda x: (x - 273.15) * 1.8 + 32.0"},{"col":9,"endLoc":751,"id":10016,"nodeType":"Lambda","startLoc":751,"text":"lambda x: ((x - 32.0) / 1.8) + 273.15"},{"col":23,"endLoc":752,"id":10017,"nodeType":"Lambda","startLoc":752,"text":"lambda x: x - 459.67"},{"col":45,"endLoc":752,"id":10018,"nodeType":"Lambda","startLoc":752,"text":"lambda x: x + 459.67"},{"col":26,"endLoc":753,"id":10019,"nodeType":"Lambda","startLoc":753,"text":"lambda x: (x - 491.67) * (5/9)"},{"col":58,"endLoc":753,"id":10020,"nodeType":"Lambda","startLoc":753,"text":"lambda x: x * 1.8 + 491.67"},{"col":22,"endLoc":754,"id":10021,"nodeType":"Lambda","startLoc":754,"text":"lambda x: x * (5/9)"},{"col":43,"endLoc":754,"id":10022,"nodeType":"Lambda","startLoc":754,"text":"lambda x: x * 1.8"},{"attributeType":"null","col":12,"comment":"null","endLoc":97,"id":10023,"name":"_physical_unit","nodeType":"Attribute","startLoc":97,"text":"self._physical_unit"},{"col":0,"comment":"Convert between Kelvin and keV(eV) to an equivalent amount.","endLoc":761,"header":"def temperature_energy()","id":10024,"name":"temperature_energy","nodeType":"Function","startLoc":757,"text":"def temperature_energy():\n    \"\"\"Convert between Kelvin and keV(eV) to an equivalent amount.\"\"\"\n    return Equivalency([\n        (si.K, si.eV, lambda x: x / (_si.e.value / _si.k_B.value),\n         lambda x: x * (_si.e.value / _si.k_B.value))], \"temperature_energy\")"},{"col":22,"endLoc":760,"id":10025,"nodeType":"Lambda","startLoc":760,"text":"lambda x: x / (_si.e.value / _si.k_B.value)"},{"col":9,"endLoc":761,"id":10026,"nodeType":"Lambda","startLoc":761,"text":"lambda x: x * (_si.e.value / _si.k_B.value)"},{"col":0,"comment":"\n    Convert between pixel distances (in units of ``pix``) and other units,\n    given a particular ``pixscale``.\n\n    Parameters\n    ----------\n    pixscale : `~astropy.units.Quantity`\n        The pixel scale either in units of <unit>/pixel or pixel/<unit>.\n    ","endLoc":797,"header":"def pixel_scale(pixscale)","id":10027,"name":"pixel_scale","nodeType":"Function","startLoc":772,"text":"def pixel_scale(pixscale):\n    \"\"\"\n    Convert between pixel distances (in units of ``pix``) and other units,\n    given a particular ``pixscale``.\n\n    Parameters\n    ----------\n    pixscale : `~astropy.units.Quantity`\n        The pixel scale either in units of <unit>/pixel or pixel/<unit>.\n    \"\"\"\n\n    decomposed = pixscale.unit.decompose()\n    dimensions = dict(zip(decomposed.bases, decomposed.powers))\n    pix_power = dimensions.get(misc.pix, 0)\n\n    if pix_power == -1:\n        physical_unit = Unit(pixscale * misc.pix)\n    elif pix_power == 1:\n        physical_unit = Unit(misc.pix / pixscale)\n    else:\n        raise UnitsError(\n                \"The pixel scale unit must have\"\n                \" pixel dimensionality of 1 or -1.\")\n\n    return Equivalency([(misc.pix, physical_unit)],\n                       \"pixel_scale\", {'pixscale': pixscale})"},{"col":4,"comment":"null","endLoc":89,"header":"@classproperty(lazy=True)\n    def _units(cls)","id":10028,"name":"_units","nodeType":"Function","startLoc":87,"text":"@classproperty(lazy=True)\n    def _units(cls):\n        return cls._all_units[0]"},{"className":"QuantityInput","col":0,"comment":"null","endLoc":323,"id":10029,"nodeType":"Class","startLoc":136,"text":"class QuantityInput:\n\n    @classmethod\n    def as_decorator(cls, func=None, **kwargs):\n        r\"\"\"\n        A decorator for validating the units of arguments to functions.\n\n        Unit specifications can be provided as keyword arguments to the\n        decorator, or by using function annotation syntax. Arguments to the\n        decorator take precedence over any function annotations present.\n\n        A `~astropy.units.UnitsError` will be raised if the unit attribute of\n        the argument is not equivalent to the unit specified to the decorator or\n        in the annotation. If the argument has no unit attribute, i.e. it is not\n        a Quantity object, a `ValueError` will be raised unless the argument is\n        an annotation. This is to allow non Quantity annotations to pass\n        through.\n\n        Where an equivalency is specified in the decorator, the function will be\n        executed with that equivalency in force.\n\n        Notes\n        -----\n\n        The checking of arguments inside variable arguments to a function is not\n        supported (i.e. \\*arg or \\**kwargs).\n\n        The original function is accessible by the attributed ``__wrapped__``.\n        See :func:`functools.wraps` for details.\n\n        Examples\n        --------\n\n        .. code-block:: python\n\n            import astropy.units as u\n            @u.quantity_input(myangle=u.arcsec)\n            def myfunction(myangle):\n                return myangle**2\n\n\n        .. code-block:: python\n\n            import astropy.units as u\n            @u.quantity_input\n            def myfunction(myangle: u.arcsec):\n                return myangle**2\n\n        Or using a unit-aware Quantity annotation.\n\n        .. code-block:: python\n\n            @u.quantity_input\n            def myfunction(myangle: u.Quantity[u.arcsec]):\n                return myangle**2\n\n        Also you can specify a return value annotation, which will\n        cause the function to always return a `~astropy.units.Quantity` in that\n        unit.\n\n        .. code-block:: python\n\n            import astropy.units as u\n            @u.quantity_input\n            def myfunction(myangle: u.arcsec) -> u.deg**2:\n                return myangle**2\n\n        Using equivalencies::\n\n            import astropy.units as u\n            @u.quantity_input(myenergy=u.eV, equivalencies=u.mass_energy())\n            def myfunction(myenergy):\n                return myenergy**2\n\n        \"\"\"\n        self = cls(**kwargs)\n        if func is not None and not kwargs:\n            return self(func)\n        else:\n            return self\n\n    def __init__(self, func=None, strict_dimensionless=False, **kwargs):\n        self.equivalencies = kwargs.pop('equivalencies', [])\n        self.decorator_kwargs = kwargs\n        self.strict_dimensionless = strict_dimensionless\n\n    def __call__(self, wrapped_function):\n\n        # Extract the function signature for the function we are wrapping.\n        wrapped_signature = inspect.signature(wrapped_function)\n\n        # Define a new function to return in place of the wrapped one\n        @wraps(wrapped_function)\n        def wrapper(*func_args, **func_kwargs):\n            # Bind the arguments to our new function to the signature of the original.\n            bound_args = wrapped_signature.bind(*func_args, **func_kwargs)\n\n            # Iterate through the parameters of the original signature\n            for param in wrapped_signature.parameters.values():\n                # We do not support variable arguments (*args, **kwargs)\n                if param.kind in (inspect.Parameter.VAR_KEYWORD,\n                                  inspect.Parameter.VAR_POSITIONAL):\n                    continue\n\n                # Catch the (never triggered) case where bind relied on a default value.\n                if (param.name not in bound_args.arguments\n                        and param.default is not param.empty):\n                    bound_args.arguments[param.name] = param.default\n\n                # Get the value of this parameter (argument to new function)\n                arg = bound_args.arguments[param.name]\n\n                # Get target unit or physical type, either from decorator kwargs\n                #   or annotations\n                if param.name in self.decorator_kwargs:\n                    targets = self.decorator_kwargs[param.name]\n                    is_annotation = False\n                else:\n                    targets = param.annotation\n                    is_annotation = True\n\n                    # parses to unit if it's an annotation (or list thereof)\n                    targets = _parse_annotation(targets)\n\n                # If the targets is empty, then no target units or physical\n                #   types were specified so we can continue to the next arg\n                if targets is inspect.Parameter.empty:\n                    continue\n\n                # If the argument value is None, and the default value is None,\n                #   pass through the None even if there is a target unit\n                if arg is None and param.default is None:\n                    continue\n\n                # Here, we check whether multiple target unit/physical type's\n                #   were specified in the decorator/annotation, or whether a\n                #   single string (unit or physical type) or a Unit object was\n                #   specified\n                if (isinstance(targets, str)\n                        or not isinstance(targets, Sequence)):\n                    valid_targets = [targets]\n\n                # Check for None in the supplied list of allowed units and, if\n                #   present and the passed value is also None, ignore.\n                elif None in targets or NoneType in targets:\n                    if arg is None:\n                        continue\n                    else:\n                        valid_targets = [t for t in targets if t is not None]\n\n                else:\n                    valid_targets = targets\n\n                # If we're dealing with an annotation, skip all the targets that\n                #    are not strings or subclasses of Unit. This is to allow\n                #    non unit related annotations to pass through\n                if is_annotation:\n                    valid_targets = [t for t in valid_targets\n                                     if isinstance(t, (str, UnitBase, PhysicalType))]\n\n                # Now we loop over the allowed units/physical types and validate\n                #   the value of the argument:\n                _validate_arg_value(param.name, wrapped_function.__name__,\n                                    arg, valid_targets, self.equivalencies,\n                                    self.strict_dimensionless)\n\n            # Call the original function with any equivalencies in force.\n            with add_enabled_equivalencies(self.equivalencies):\n                return_ = wrapped_function(*func_args, **func_kwargs)\n\n            # Return\n            ra = wrapped_signature.return_annotation\n            valid_empty = (inspect.Signature.empty, None, NoneType, T.NoReturn)\n            if ra not in valid_empty:\n                target = (ra if T.get_origin(ra) not in (T.Annotated, T.Union)\n                          else _parse_annotation(ra))\n                if isinstance(target, str) or not isinstance(target, Sequence):\n                    target = [target]\n                valid_targets = [t for t in target\n                                 if isinstance(t, (str, UnitBase, PhysicalType))]\n                _validate_arg_value(\"return\", wrapped_function.__name__,\n                                    return_, valid_targets, self.equivalencies,\n                                    self.strict_dimensionless)\n                if len(valid_targets) > 0:\n                    return_ <<= valid_targets[0]\n            return return_\n\n        return wrapper"},{"col":4,"comment":"null","endLoc":323,"header":"def __call__(self, wrapped_function)","id":10030,"name":"__call__","nodeType":"Function","startLoc":222,"text":"def __call__(self, wrapped_function):\n\n        # Extract the function signature for the function we are wrapping.\n        wrapped_signature = inspect.signature(wrapped_function)\n\n        # Define a new function to return in place of the wrapped one\n        @wraps(wrapped_function)\n        def wrapper(*func_args, **func_kwargs):\n            # Bind the arguments to our new function to the signature of the original.\n            bound_args = wrapped_signature.bind(*func_args, **func_kwargs)\n\n            # Iterate through the parameters of the original signature\n            for param in wrapped_signature.parameters.values():\n                # We do not support variable arguments (*args, **kwargs)\n                if param.kind in (inspect.Parameter.VAR_KEYWORD,\n                                  inspect.Parameter.VAR_POSITIONAL):\n                    continue\n\n                # Catch the (never triggered) case where bind relied on a default value.\n                if (param.name not in bound_args.arguments\n                        and param.default is not param.empty):\n                    bound_args.arguments[param.name] = param.default\n\n                # Get the value of this parameter (argument to new function)\n                arg = bound_args.arguments[param.name]\n\n                # Get target unit or physical type, either from decorator kwargs\n                #   or annotations\n                if param.name in self.decorator_kwargs:\n                    targets = self.decorator_kwargs[param.name]\n                    is_annotation = False\n                else:\n                    targets = param.annotation\n                    is_annotation = True\n\n                    # parses to unit if it's an annotation (or list thereof)\n                    targets = _parse_annotation(targets)\n\n                # If the targets is empty, then no target units or physical\n                #   types were specified so we can continue to the next arg\n                if targets is inspect.Parameter.empty:\n                    continue\n\n                # If the argument value is None, and the default value is None,\n                #   pass through the None even if there is a target unit\n                if arg is None and param.default is None:\n                    continue\n\n                # Here, we check whether multiple target unit/physical type's\n                #   were specified in the decorator/annotation, or whether a\n                #   single string (unit or physical type) or a Unit object was\n                #   specified\n                if (isinstance(targets, str)\n                        or not isinstance(targets, Sequence)):\n                    valid_targets = [targets]\n\n                # Check for None in the supplied list of allowed units and, if\n                #   present and the passed value is also None, ignore.\n                elif None in targets or NoneType in targets:\n                    if arg is None:\n                        continue\n                    else:\n                        valid_targets = [t for t in targets if t is not None]\n\n                else:\n                    valid_targets = targets\n\n                # If we're dealing with an annotation, skip all the targets that\n                #    are not strings or subclasses of Unit. This is to allow\n                #    non unit related annotations to pass through\n                if is_annotation:\n                    valid_targets = [t for t in valid_targets\n                                     if isinstance(t, (str, UnitBase, PhysicalType))]\n\n                # Now we loop over the allowed units/physical types and validate\n                #   the value of the argument:\n                _validate_arg_value(param.name, wrapped_function.__name__,\n                                    arg, valid_targets, self.equivalencies,\n                                    self.strict_dimensionless)\n\n            # Call the original function with any equivalencies in force.\n            with add_enabled_equivalencies(self.equivalencies):\n                return_ = wrapped_function(*func_args, **func_kwargs)\n\n            # Return\n            ra = wrapped_signature.return_annotation\n            valid_empty = (inspect.Signature.empty, None, NoneType, T.NoReturn)\n            if ra not in valid_empty:\n                target = (ra if T.get_origin(ra) not in (T.Annotated, T.Union)\n                          else _parse_annotation(ra))\n                if isinstance(target, str) or not isinstance(target, Sequence):\n                    target = [target]\n                valid_targets = [t for t in target\n                                 if isinstance(t, (str, UnitBase, PhysicalType))]\n                _validate_arg_value(\"return\", wrapped_function.__name__,\n                                    return_, valid_targets, self.equivalencies,\n                                    self.strict_dimensionless)\n                if len(valid_targets) > 0:\n                    return_ <<= valid_targets[0]\n            return return_\n\n        return wrapper"},{"col":4,"comment":"null","endLoc":93,"header":"@classproperty(lazy=True)\n    def _deprecated_units(cls)","id":10031,"name":"_deprecated_units","nodeType":"Function","startLoc":91,"text":"@classproperty(lazy=True)\n    def _deprecated_units(cls):\n        return cls._all_units[1]"},{"col":4,"comment":"null","endLoc":620,"header":"@classmethod\n    def _do_parse(cls, s, debug=False)","id":10032,"name":"_do_parse","nodeType":"Function","startLoc":607,"text":"@classmethod\n    def _do_parse(cls, s, debug=False):\n        try:\n            # This is a short circuit for the case where the string\n            # is just a single unit name\n            return cls._parse_unit(s, detailed_exception=False)\n        except ValueError as e:\n            try:\n                return cls._parser.parse(s, lexer=cls._lexer, debug=debug)\n            except ValueError as e:\n                if str(e):\n                    raise\n                else:\n                    raise ValueError(f\"Syntax error parsing unit '{s}'\")"},{"col":4,"comment":"null","endLoc":97,"header":"@classproperty(lazy=True)\n    def _functions(cls)","id":10033,"name":"_functions","nodeType":"Function","startLoc":95,"text":"@classproperty(lazy=True)\n    def _functions(cls):\n        return cls._all_units[2]"},{"col":4,"comment":"null","endLoc":101,"header":"@classproperty(lazy=True)\n    def _parser(cls)","id":10034,"name":"_parser","nodeType":"Function","startLoc":99,"text":"@classproperty(lazy=True)\n    def _parser(cls):\n        return cls._make_parser()"},{"col":4,"comment":"null","endLoc":511,"header":"@classmethod\n    def _parse_unit(cls, s, detailed_exception=True)","id":10035,"name":"_parse_unit","nodeType":"Function","startLoc":488,"text":"@classmethod\n    def _parse_unit(cls, s, detailed_exception=True):\n        registry = core.get_current_unit_registry().registry\n        if s in cls._unit_symbols:\n            s = cls._unit_symbols[s]\n\n        elif not s.isascii():\n            if s[0] == '\\N{MICRO SIGN}':\n                s = 'u' + s[1:]\n            if s[-1] in cls._prefixable_unit_symbols:\n                s = s[:-1] + cls._prefixable_unit_symbols[s[-1]]\n            elif len(s) > 1 and s[-1] in cls._unit_suffix_symbols:\n                s = s[:-1] + cls._unit_suffix_symbols[s[-1]]\n            elif s.endswith('R\\N{INFINITY}'):\n                s = s[:-2] + 'Ry'\n\n        if s in registry:\n            return registry[s]\n\n        if detailed_exception:\n            raise ValueError(\n                f'{s} is not a valid unit. {did_you_mean(s, registry)}')\n        else:\n            raise ValueError()"},{"col":0,"comment":"\n    Convert between lengths (to be interpreted as lengths in the focal plane)\n    and angular units with a specified ``platescale``.\n\n    Parameters\n    ----------\n    platescale : `~astropy.units.Quantity`\n        The pixel scale either in units of distance/pixel or distance/angle.\n    ","endLoc":820,"header":"def plate_scale(platescale)","id":10036,"name":"plate_scale","nodeType":"Function","startLoc":800,"text":"def plate_scale(platescale):\n    \"\"\"\n    Convert between lengths (to be interpreted as lengths in the focal plane)\n    and angular units with a specified ``platescale``.\n\n    Parameters\n    ----------\n    platescale : `~astropy.units.Quantity`\n        The pixel scale either in units of distance/pixel or distance/angle.\n    \"\"\"\n    if platescale.unit.is_equivalent(si.arcsec/si.m):\n        platescale_val = platescale.to_value(si.radian/si.m)\n    elif platescale.unit.is_equivalent(si.m/si.arcsec):\n        platescale_val = (1/platescale).to_value(si.radian/si.m)\n    else:\n        raise UnitsError(\"The pixel scale must be in angle/distance or \"\n                         \"distance/angle\")\n\n    return Equivalency([(si.m, si.radian, lambda d: d*platescale_val,\n                         lambda rad: rad/platescale_val)],\n                       \"plate_scale\", {'platescale': platescale})"},{"col":4,"comment":"\n        The grammar here is based on the description in the `FITS\n        standard\n        <http://fits.gsfc.nasa.gov/standard30/fits_standard30aa.pdf>`_,\n        Section 4.3, which is not terribly precise.  The exact grammar\n        is here is based on the YACC grammar in the `unity library\n        <https://bitbucket.org/nxg/unity/>`_.\n\n        This same grammar is used by the `\"fits\"` and `\"vounit\"`\n        formats, the only difference being the set of available unit\n        strings.\n        ","endLoc":474,"header":"@classmethod\n    def _make_parser(cls)","id":10037,"name":"_make_parser","nodeType":"Function","startLoc":165,"text":"@classmethod\n    def _make_parser(cls):\n        \"\"\"\n        The grammar here is based on the description in the `FITS\n        standard\n        <http://fits.gsfc.nasa.gov/standard30/fits_standard30aa.pdf>`_,\n        Section 4.3, which is not terribly precise.  The exact grammar\n        is here is based on the YACC grammar in the `unity library\n        <https://bitbucket.org/nxg/unity/>`_.\n\n        This same grammar is used by the `\"fits\"` and `\"vounit\"`\n        formats, the only difference being the set of available unit\n        strings.\n        \"\"\"\n        tokens = cls._tokens\n\n        def p_main(p):\n            '''\n            main : unit\n                 | structured_unit\n                 | structured_subunit\n            '''\n            if isinstance(p[1], tuple):\n                # Unpack possible StructuredUnit inside a tuple, ie.,\n                # ignore any set of very outer parentheses.\n                p[0] = p[1][0]\n            else:\n                p[0] = p[1]\n\n        def p_structured_subunit(p):\n            '''\n            structured_subunit : OPEN_PAREN structured_unit CLOSE_PAREN\n            '''\n            # We hide a structured unit enclosed by parentheses inside\n            # a tuple, so that we can easily distinguish units like\n            # \"(au, au/day), yr\" from \"au, au/day, yr\".\n            p[0] = (p[2],)\n\n        def p_structured_unit(p):\n            '''\n            structured_unit : subunit COMMA\n                            | subunit COMMA subunit\n            '''\n            from ..structured import StructuredUnit\n            inputs = (p[1],) if len(p) == 3 else (p[1], p[3])\n            units = ()\n            for subunit in inputs:\n                if isinstance(subunit, tuple):\n                    # Structured unit that should be its own entry in the\n                    # new StructuredUnit (was enclosed in parentheses).\n                    units += subunit\n                elif isinstance(subunit, StructuredUnit):\n                    # Structured unit whose entries should be\n                    # individiually added to the new StructuredUnit.\n                    units += subunit.values()\n                else:\n                    # Regular unit to be added to the StructuredUnit.\n                    units += (subunit,)\n\n            p[0] = StructuredUnit(units)\n\n        def p_subunit(p):\n            '''\n            subunit : unit\n                    | structured_unit\n                    | structured_subunit\n            '''\n            p[0] = p[1]\n\n        def p_unit(p):\n            '''\n            unit : product_of_units\n                 | factor product_of_units\n                 | factor product product_of_units\n                 | division_product_of_units\n                 | factor division_product_of_units\n                 | factor product division_product_of_units\n                 | inverse_unit\n                 | factor inverse_unit\n                 | factor product inverse_unit\n                 | factor\n            '''\n            from astropy.units.core import Unit\n            if len(p) == 2:\n                p[0] = Unit(p[1])\n            elif len(p) == 3:\n                p[0] = Unit(p[1] * p[2])\n            elif len(p) == 4:\n                p[0] = Unit(p[1] * p[3])\n\n        def p_division_product_of_units(p):\n            '''\n            division_product_of_units : division_product_of_units division product_of_units\n                                      | product_of_units\n            '''\n            from astropy.units.core import Unit\n            if len(p) == 4:\n                p[0] = Unit(p[1] / p[3])\n            else:\n                p[0] = p[1]\n\n        def p_inverse_unit(p):\n            '''\n            inverse_unit : division unit_expression\n            '''\n            p[0] = p[2] ** -1\n\n        def p_factor(p):\n            '''\n            factor : factor_fits\n                   | factor_float\n                   | factor_int\n            '''\n            p[0] = p[1]\n\n        def p_factor_float(p):\n            '''\n            factor_float : signed_float\n                         | signed_float UINT signed_int\n                         | signed_float UINT power numeric_power\n            '''\n            if cls.name == 'fits':\n                raise ValueError(\"Numeric factor not supported by FITS\")\n            if len(p) == 4:\n                p[0] = p[1] * p[2] ** float(p[3])\n            elif len(p) == 5:\n                p[0] = p[1] * p[2] ** float(p[4])\n            elif len(p) == 2:\n                p[0] = p[1]\n\n        def p_factor_int(p):\n            '''\n            factor_int : UINT\n                       | UINT signed_int\n                       | UINT power numeric_power\n                       | UINT UINT signed_int\n                       | UINT UINT power numeric_power\n            '''\n            if cls.name == 'fits':\n                raise ValueError(\"Numeric factor not supported by FITS\")\n            if len(p) == 2:\n                p[0] = p[1]\n            elif len(p) == 3:\n                p[0] = p[1] ** float(p[2])\n            elif len(p) == 4:\n                if isinstance(p[2], int):\n                    p[0] = p[1] * p[2] ** float(p[3])\n                else:\n                    p[0] = p[1] ** float(p[3])\n            elif len(p) == 5:\n                p[0] = p[1] * p[2] ** p[4]\n\n        def p_factor_fits(p):\n            '''\n            factor_fits : UINT power OPEN_PAREN signed_int CLOSE_PAREN\n                        | UINT power OPEN_PAREN UINT CLOSE_PAREN\n                        | UINT power signed_int\n                        | UINT power UINT\n                        | UINT SIGN UINT\n                        | UINT OPEN_PAREN signed_int CLOSE_PAREN\n            '''\n            if p[1] != 10:\n                if cls.name == 'fits':\n                    raise ValueError(\"Base must be 10\")\n                else:\n                    return\n            if len(p) == 4:\n                if p[2] in ('**', '^'):\n                    p[0] = 10 ** p[3]\n                else:\n                    p[0] = 10 ** (p[2] * p[3])\n            elif len(p) == 5:\n                p[0] = 10 ** p[3]\n            elif len(p) == 6:\n                p[0] = 10 ** p[4]\n\n        def p_product_of_units(p):\n            '''\n            product_of_units : unit_expression product product_of_units\n                             | unit_expression product_of_units\n                             | unit_expression\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            elif len(p) == 3:\n                p[0] = p[1] * p[2]\n            else:\n                p[0] = p[1] * p[3]\n\n        def p_unit_expression(p):\n            '''\n            unit_expression : function\n                            | unit_with_power\n                            | OPEN_PAREN product_of_units CLOSE_PAREN\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = p[2]\n\n        def p_unit_with_power(p):\n            '''\n            unit_with_power : UNIT power numeric_power\n                            | UNIT numeric_power\n                            | UNIT\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            elif len(p) == 3:\n                p[0] = p[1] ** p[2]\n            else:\n                p[0] = p[1] ** p[3]\n\n        def p_numeric_power(p):\n            '''\n            numeric_power : sign UINT\n                          | OPEN_PAREN paren_expr CLOSE_PAREN\n            '''\n            if len(p) == 3:\n                p[0] = p[1] * p[2]\n            elif len(p) == 4:\n                p[0] = p[2]\n\n        def p_paren_expr(p):\n            '''\n            paren_expr : sign UINT\n                       | signed_float\n                       | frac\n            '''\n            if len(p) == 3:\n                p[0] = p[1] * p[2]\n            else:\n                p[0] = p[1]\n\n        def p_frac(p):\n            '''\n            frac : sign UINT division sign UINT\n            '''\n            p[0] = Fraction(p[1] * p[2], p[4] * p[5])\n\n        def p_sign(p):\n            '''\n            sign : SIGN\n                 |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1\n\n        def p_product(p):\n            '''\n            product : STAR\n                    | PERIOD\n            '''\n            pass\n\n        def p_division(p):\n            '''\n            division : SOLIDUS\n            '''\n            pass\n\n        def p_power(p):\n            '''\n            power : DOUBLE_STAR\n                  | CARET\n            '''\n            p[0] = p[1]\n\n        def p_signed_int(p):\n            '''\n            signed_int : SIGN UINT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_signed_float(p):\n            '''\n            signed_float : sign UINT\n                         | sign UFLOAT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_function_name(p):\n            '''\n            function_name : FUNCNAME\n            '''\n            p[0] = p[1]\n\n        def p_function(p):\n            '''\n            function : function_name OPEN_PAREN main CLOSE_PAREN\n            '''\n            if p[1] == 'sqrt':\n                p[0] = p[3] ** 0.5\n                return\n            elif p[1] in ('mag', 'dB', 'dex'):\n                function_unit = cls._parse_unit(p[1])\n                # In Generic, this is callable, but that does not have to\n                # be the case in subclasses (e.g., in VOUnit it is not).\n                if callable(function_unit):\n                    p[0] = function_unit(p[3])\n                    return\n\n            raise ValueError(f\"'{p[1]}' is not a recognized function\")\n\n        def p_error(p):\n            raise ValueError()\n\n        return parsing.yacc(tabmodule='generic_parsetab', package='astropy/units')"},{"col":0,"comment":"\n    When a string isn't found in a set of candidates, we can be nice\n    to provide a list of alternatives in the exception.  This\n    convenience function helps to format that part of the exception.\n\n    Parameters\n    ----------\n    s : str\n\n    candidates : sequence of str or dict of str keys\n\n    n : int\n        The maximum number of results to include.  See\n        `difflib.get_close_matches`.\n\n    cutoff : float\n        In the range [0, 1]. Possibilities that don't score at least\n        that similar to word are ignored.  See\n        `difflib.get_close_matches`.\n\n    fix : callable\n        A callable to modify the results after matching.  It should\n        take a single string and return a sequence of strings\n        containing the fixed matches.\n\n    Returns\n    -------\n    message : str\n        Returns the string \"Did you mean X, Y, or Z?\", or the empty\n        string if no alternatives were found.\n    ","endLoc":499,"header":"def did_you_mean(s, candidates, n=3, cutoff=0.8, fix=None)","id":10038,"name":"did_you_mean","nodeType":"Function","startLoc":424,"text":"def did_you_mean(s, candidates, n=3, cutoff=0.8, fix=None):\n    \"\"\"\n    When a string isn't found in a set of candidates, we can be nice\n    to provide a list of alternatives in the exception.  This\n    convenience function helps to format that part of the exception.\n\n    Parameters\n    ----------\n    s : str\n\n    candidates : sequence of str or dict of str keys\n\n    n : int\n        The maximum number of results to include.  See\n        `difflib.get_close_matches`.\n\n    cutoff : float\n        In the range [0, 1]. Possibilities that don't score at least\n        that similar to word are ignored.  See\n        `difflib.get_close_matches`.\n\n    fix : callable\n        A callable to modify the results after matching.  It should\n        take a single string and return a sequence of strings\n        containing the fixed matches.\n\n    Returns\n    -------\n    message : str\n        Returns the string \"Did you mean X, Y, or Z?\", or the empty\n        string if no alternatives were found.\n    \"\"\"\n    if isinstance(s, str):\n        s = strip_accents(s)\n    s_lower = s.lower()\n\n    # Create a mapping from the lower case name to all capitalization\n    # variants of that name.\n    candidates_lower = {}\n    for candidate in candidates:\n        candidate_lower = candidate.lower()\n        candidates_lower.setdefault(candidate_lower, [])\n        candidates_lower[candidate_lower].append(candidate)\n\n    # The heuristic here is to first try \"singularizing\" the word.  If\n    # that doesn't match anything use difflib to find close matches in\n    # original, lower and upper case.\n    if s_lower.endswith('s') and s_lower[:-1] in candidates_lower:\n        matches = [s_lower[:-1]]\n    else:\n        matches = difflib.get_close_matches(\n            s_lower, candidates_lower, n=n, cutoff=cutoff)\n\n    if len(matches):\n        capitalized_matches = set()\n        for match in matches:\n            capitalized_matches.update(candidates_lower[match])\n        matches = capitalized_matches\n\n        if fix is not None:\n            mapped_matches = []\n            for match in matches:\n                mapped_matches.extend(fix(match))\n            matches = mapped_matches\n\n        matches = list(set(matches))\n        matches = sorted(matches)\n\n        if len(matches) == 1:\n            matches = matches[0]\n        else:\n            matches = (', '.join(matches[:-1]) + ' or ' +\n                       matches[-1])\n        return f'Did you mean {matches}?'\n\n    return ''"},{"col":42,"endLoc":818,"id":10039,"nodeType":"Lambda","startLoc":818,"text":"lambda d: d*platescale_val"},{"col":25,"endLoc":819,"id":10040,"nodeType":"Lambda","startLoc":819,"text":"lambda rad: rad/platescale_val"},{"col":0,"comment":"\n    Remove accents from a Unicode string.\n\n    This helps with matching \"ångström\" to \"angstrom\", for example.\n    ","endLoc":421,"header":"def strip_accents(s)","id":10041,"name":"strip_accents","nodeType":"Function","startLoc":413,"text":"def strip_accents(s):\n    \"\"\"\n    Remove accents from a Unicode string.\n\n    This helps with matching \"ångström\" to \"angstrom\", for example.\n    \"\"\"\n    return ''.join(\n        c for c in unicodedata.normalize('NFD', s)\n        if unicodedata.category(c) != 'Mn')"},{"col":0,"comment":"null","endLoc":839,"header":"def __getattr__(attr)","id":10042,"name":"__getattr__","nodeType":"Function","startLoc":825,"text":"def __getattr__(attr):\n    if attr == \"with_H0\":\n        import warnings\n        from astropy.cosmology.units import with_H0\n        from astropy.utils.exceptions import AstropyDeprecationWarning\n\n        warnings.warn(\n            (\"`with_H0` is deprecated from `astropy.units.equivalencies` \"\n             \"since astropy 5.0 and may be removed in a future version. \"\n             \"Use `astropy.cosmology.units.with_H0` instead.\"),\n            AstropyDeprecationWarning)\n\n        return with_H0\n\n    raise AttributeError(f\"module {__name__!r} has no attribute {attr!r}.\")"},{"col":0,"comment":"null","endLoc":133,"header":"def _parse_annotation(target)","id":10043,"name":"_parse_annotation","nodeType":"Function","startLoc":97,"text":"def _parse_annotation(target):\n\n    if target in (None, NoneType, inspect._empty):\n        return target\n\n    # check if unit-like\n    try:\n        unit = Unit(target)\n    except (TypeError, ValueError):\n        try:\n            ptype = get_physical_type(target)\n        except (TypeError, ValueError, KeyError):  # KeyError for Enum\n            if isinstance(target, str):\n                raise ValueError(f\"invalid unit or physical type {target!r}.\") from None\n        else:\n            return ptype\n    else:\n        return unit\n\n    # could be a type hint\n    origin = T.get_origin(target)\n    if origin is T.Union:\n        return [_parse_annotation(t) for t in T.get_args(target)]\n    elif origin is not T.Annotated:  # can't be Quantity[]\n        return False\n\n    # parse type hint\n    cls, *annotations = T.get_args(target)\n    if not issubclass(cls, Quantity) or not annotations:\n        return False\n\n    # get unit from type hint\n    unit, *rest = annotations\n    if not isinstance(unit, (UnitBase, PhysicalType)):\n        return False\n\n    return unit"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":10044,"name":"__all__","nodeType":"Attribute","startLoc":23,"text":"__all__"},{"col":0,"comment":"","endLoc":2,"header":"equivalencies.py#<anonymous>","id":10045,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"A set of standard astronomical equivalencies.\"\"\"\n\n__all__ = ['parallax', 'spectral', 'spectral_density', 'doppler_radio',\n           'doppler_optical', 'doppler_relativistic', 'doppler_redshift', 'mass_energy',\n           'brightness_temperature', 'thermodynamic_temperature',\n           'beam_angular_area', 'dimensionless_angles', 'logarithmic',\n           'temperature', 'temperature_energy', 'molar_mass_amu',\n           'pixel_scale', 'plate_scale', \"Equivalency\"]"},{"fileName":"ogip_lextab.py","filePath":"astropy/units/format","id":10046,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# This file was automatically generated from ply. To re-generate this file,\n# remove it from this folder, then build astropy and run the tests in-place:\n#\n#   python setup.py build_ext --inplace\n#   pytest astropy/units\n#\n# You can then commit the changes to this file.\n\n# ogip_lextab.py. This file automatically created by PLY (version 3.11). Don't edit!\n_tabversion   = '3.10'\n_lextokens    = set(('CLOSE_PAREN', 'DIVISION', 'LIT10', 'OPEN_PAREN', 'SIGN', 'STAR', 'STARSTAR', 'UFLOAT', 'UINT', 'UNIT', 'UNKNOWN', 'WHITESPACE'))\n_lexreflags   = 64\n_lexliterals  = ''\n_lexstateinfo = {'INITIAL': 'inclusive'}\n_lexstatere   = {'INITIAL': [('(?P<t_UFLOAT>(((\\\\d+\\\\.?\\\\d*)|(\\\\.\\\\d+))([eE][+-]?\\\\d+))|(((\\\\d+\\\\.\\\\d*)|(\\\\.\\\\d+))([eE][+-]?\\\\d+)?))|(?P<t_UINT>\\\\d+)|(?P<t_SIGN>[+-](?=\\\\d))|(?P<t_X>[x×])|(?P<t_LIT10>10)|(?P<t_UNKNOWN>[Uu][Nn][Kk][Nn][Oo][Ww][Nn])|(?P<t_UNIT>[a-zA-Z][a-zA-Z_]*)|(?P<t_WHITESPACE>[ \\t]+)|(?P<t_STARSTAR>\\\\*\\\\*)|(?P<t_OPEN_PAREN>\\\\()|(?P<t_CLOSE_PAREN>\\\\))|(?P<t_STAR>\\\\*)|(?P<t_DIVISION>/)', [None, ('t_UFLOAT', 'UFLOAT'), None, None, None, None, None, None, None, None, None, None, ('t_UINT', 'UINT'), ('t_SIGN', 'SIGN'), ('t_X', 'X'), ('t_LIT10', 'LIT10'), ('t_UNKNOWN', 'UNKNOWN'), ('t_UNIT', 'UNIT'), (None, 'WHITESPACE'), (None, 'STARSTAR'), (None, 'OPEN_PAREN'), (None, 'CLOSE_PAREN'), (None, 'STAR'), (None, 'DIVISION')])]}\n_lexstateignore = {'INITIAL': ''}\n_lexstateerrorf = {'INITIAL': 't_error'}\n_lexstateeoff = {}\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":10047,"name":"_tabversion","nodeType":"Attribute","startLoc":13,"text":"_tabversion"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":10048,"name":"_lextokens","nodeType":"Attribute","startLoc":14,"text":"_lextokens"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":10049,"name":"_lexreflags","nodeType":"Attribute","startLoc":15,"text":"_lexreflags"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":10050,"name":"_lexliterals","nodeType":"Attribute","startLoc":16,"text":"_lexliterals"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":10051,"name":"_lexstateinfo","nodeType":"Attribute","startLoc":17,"text":"_lexstateinfo"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":10052,"name":"_lexstatere","nodeType":"Attribute","startLoc":18,"text":"_lexstatere"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":10053,"name":"_lexstateignore","nodeType":"Attribute","startLoc":19,"text":"_lexstateignore"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":10054,"name":"_lexstateerrorf","nodeType":"Attribute","startLoc":20,"text":"_lexstateerrorf"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":10055,"name":"_lexstateeoff","nodeType":"Attribute","startLoc":21,"text":"_lexstateeoff"},{"col":0,"comment":"","endLoc":13,"header":"ogip_lextab.py#<anonymous>","id":10056,"name":"<anonymous>","nodeType":"Function","startLoc":13,"text":"_tabversion   = '3.10'\n\n_lextokens    = set(('CLOSE_PAREN', 'DIVISION', 'LIT10', 'OPEN_PAREN', 'SIGN', 'STAR', 'STARSTAR', 'UFLOAT', 'UINT', 'UNIT', 'UNKNOWN', 'WHITESPACE'))\n\n_lexreflags   = 64\n\n_lexliterals  = ''\n\n_lexstateinfo = {'INITIAL': 'inclusive'}\n\n_lexstatere   = {'INITIAL': [('(?P<t_UFLOAT>(((\\\\d+\\\\.?\\\\d*)|(\\\\.\\\\d+))([eE][+-]?\\\\d+))|(((\\\\d+\\\\.\\\\d*)|(\\\\.\\\\d+))([eE][+-]?\\\\d+)?))|(?P<t_UINT>\\\\d+)|(?P<t_SIGN>[+-](?=\\\\d))|(?P<t_X>[x×])|(?P<t_LIT10>10)|(?P<t_UNKNOWN>[Uu][Nn][Kk][Nn][Oo][Ww][Nn])|(?P<t_UNIT>[a-zA-Z][a-zA-Z_]*)|(?P<t_WHITESPACE>[ \\t]+)|(?P<t_STARSTAR>\\\\*\\\\*)|(?P<t_OPEN_PAREN>\\\\()|(?P<t_CLOSE_PAREN>\\\\))|(?P<t_STAR>\\\\*)|(?P<t_DIVISION>/)', [None, ('t_UFLOAT', 'UFLOAT'), None, None, None, None, None, None, None, None, None, None, ('t_UINT', 'UINT'), ('t_SIGN', 'SIGN'), ('t_X', 'X'), ('t_LIT10', 'LIT10'), ('t_UNKNOWN', 'UNKNOWN'), ('t_UNIT', 'UNIT'), (None, 'WHITESPACE'), (None, 'STARSTAR'), (None, 'OPEN_PAREN'), (None, 'CLOSE_PAREN'), (None, 'STAR'), (None, 'DIVISION')])]}\n\n_lexstateignore = {'INITIAL': ''}\n\n_lexstateerrorf = {'INITIAL': 't_error'}\n\n_lexstateeoff = {}"},{"fileName":"generic_lextab.py","filePath":"astropy/units/format","id":10057,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# This file was automatically generated from ply. To re-generate this file,\n# remove it from this folder, then build astropy and run the tests in-place:\n#\n#   python setup.py build_ext --inplace\n#   pytest astropy/units\n#\n# You can then commit the changes to this file.\n\n# generic_lextab.py. This file automatically created by PLY (version 3.11). Don't edit!\n_tabversion   = '3.10'\n_lextokens    = set(('CARET', 'CLOSE_PAREN', 'COMMA', 'DOUBLE_STAR', 'FUNCNAME', 'OPEN_PAREN', 'PERIOD', 'SIGN', 'SOLIDUS', 'STAR', 'UFLOAT', 'UINT', 'UNIT'))\n_lexreflags   = 32\n_lexliterals  = ''\n_lexstateinfo = {'INITIAL': 'inclusive'}\n_lexstatere   = {'INITIAL': [(\"(?P<t_UFLOAT>((\\\\d+\\\\.?\\\\d*)|(\\\\.\\\\d+))([eE][+-]?\\\\d+)?)|(?P<t_UINT>\\\\d+)|(?P<t_SIGN>[+-](?=\\\\d))|(?P<t_FUNCNAME>((sqrt)|(ln)|(exp)|(log)|(mag)|(dB)|(dex))(?=\\\\ *\\\\())|(?P<t_UNIT>%|([YZEPTGMkhdcmuµnpfazy]?'((?!\\\\d)\\\\w)+')|((?!\\\\d)\\\\w)+)|(?P<t_DOUBLE_STAR>\\\\*\\\\*)|(?P<t_COMMA>\\\\,)|(?P<t_STAR>\\\\*)|(?P<t_PERIOD>\\\\.)|(?P<t_CARET>\\\\^)|(?P<t_OPEN_PAREN>\\\\()|(?P<t_CLOSE_PAREN>\\\\))|(?P<t_SOLIDUS>/)\", [None, ('t_UFLOAT', 'UFLOAT'), None, None, None, None, ('t_UINT', 'UINT'), ('t_SIGN', 'SIGN'), ('t_FUNCNAME', 'FUNCNAME'), None, None, None, None, None, None, None, None, ('t_UNIT', 'UNIT'), None, None, None, (None, 'DOUBLE_STAR'), (None, 'COMMA'), (None, 'STAR'), (None, 'PERIOD'), (None, 'CARET'), (None, 'OPEN_PAREN'), (None, 'CLOSE_PAREN'), (None, 'SOLIDUS')])]}\n_lexstateignore = {'INITIAL': ' '}\n_lexstateerrorf = {'INITIAL': 't_error'}\n_lexstateeoff = {}\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":10058,"name":"_tabversion","nodeType":"Attribute","startLoc":13,"text":"_tabversion"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":10059,"name":"_lextokens","nodeType":"Attribute","startLoc":14,"text":"_lextokens"},{"col":0,"comment":"\n    Validates the object passed in to the wrapped function, ``arg``, with target\n    unit or physical type, ``target``.\n    ","endLoc":94,"header":"def _validate_arg_value(param_name, func_name, arg, targets, equivalencies,\n                        strict_dimensionless=False)","id":10060,"name":"_validate_arg_value","nodeType":"Function","startLoc":46,"text":"def _validate_arg_value(param_name, func_name, arg, targets, equivalencies,\n                        strict_dimensionless=False):\n    \"\"\"\n    Validates the object passed in to the wrapped function, ``arg``, with target\n    unit or physical type, ``target``.\n    \"\"\"\n\n    if len(targets) == 0:\n        return\n\n    allowed_units = _get_allowed_units(targets)\n\n    # If dimensionless is an allowed unit and the argument is unit-less,\n    #   allow numbers or numpy arrays with numeric dtypes\n    if (dimensionless_unscaled in allowed_units and not strict_dimensionless\n            and not hasattr(arg, \"unit\")):\n        if isinstance(arg, Number):\n            return\n\n        elif (isinstance(arg, np.ndarray)\n              and np.issubdtype(arg.dtype, np.number)):\n            return\n\n    for allowed_unit in allowed_units:\n        try:\n            is_equivalent = arg.unit.is_equivalent(allowed_unit,\n                                                   equivalencies=equivalencies)\n\n            if is_equivalent:\n                break\n\n        except AttributeError:  # Either there is no .unit or no .is_equivalent\n            if hasattr(arg, \"unit\"):\n                error_msg = (\"a 'unit' attribute without an 'is_equivalent' method\")\n            else:\n                error_msg = \"no 'unit' attribute\"\n\n            raise TypeError(f\"Argument '{param_name}' to function '{func_name}'\"\n                            f\" has {error_msg}. You should pass in an astropy \"\n                            \"Quantity instead.\")\n\n    else:\n        error_msg = (f\"Argument '{param_name}' to function '{func_name}' must \"\n                     \"be in units convertible to\")\n        if len(targets) > 1:\n            targ_names = \", \".join([f\"'{str(targ)}'\" for targ in targets])\n            raise UnitsError(f\"{error_msg} one of: {targ_names}.\")\n        else:\n            raise UnitsError(f\"{error_msg} '{str(targets[0])}'.\")"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":10061,"name":"_lexreflags","nodeType":"Attribute","startLoc":15,"text":"_lexreflags"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":10062,"name":"_lexliterals","nodeType":"Attribute","startLoc":16,"text":"_lexliterals"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":10063,"name":"_lexstateinfo","nodeType":"Attribute","startLoc":17,"text":"_lexstateinfo"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":10064,"name":"_lexstatere","nodeType":"Attribute","startLoc":18,"text":"_lexstatere"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":10065,"name":"_lexstateignore","nodeType":"Attribute","startLoc":19,"text":"_lexstateignore"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":10066,"name":"_lexstateerrorf","nodeType":"Attribute","startLoc":20,"text":"_lexstateerrorf"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":10067,"name":"_lexstateeoff","nodeType":"Attribute","startLoc":21,"text":"_lexstateeoff"},{"col":0,"comment":"","endLoc":13,"header":"generic_lextab.py#<anonymous>","id":10068,"name":"<anonymous>","nodeType":"Function","startLoc":13,"text":"_tabversion   = '3.10'\n\n_lextokens    = set(('CARET', 'CLOSE_PAREN', 'COMMA', 'DOUBLE_STAR', 'FUNCNAME', 'OPEN_PAREN', 'PERIOD', 'SIGN', 'SOLIDUS', 'STAR', 'UFLOAT', 'UINT', 'UNIT'))\n\n_lexreflags   = 32\n\n_lexliterals  = ''\n\n_lexstateinfo = {'INITIAL': 'inclusive'}\n\n_lexstatere   = {'INITIAL': [(\"(?P<t_UFLOAT>((\\\\d+\\\\.?\\\\d*)|(\\\\.\\\\d+))([eE][+-]?\\\\d+)?)|(?P<t_UINT>\\\\d+)|(?P<t_SIGN>[+-](?=\\\\d))|(?P<t_FUNCNAME>((sqrt)|(ln)|(exp)|(log)|(mag)|(dB)|(dex))(?=\\\\ *\\\\())|(?P<t_UNIT>%|([YZEPTGMkhdcmuµnpfazy]?'((?!\\\\d)\\\\w)+')|((?!\\\\d)\\\\w)+)|(?P<t_DOUBLE_STAR>\\\\*\\\\*)|(?P<t_COMMA>\\\\,)|(?P<t_STAR>\\\\*)|(?P<t_PERIOD>\\\\.)|(?P<t_CARET>\\\\^)|(?P<t_OPEN_PAREN>\\\\()|(?P<t_CLOSE_PAREN>\\\\))|(?P<t_SOLIDUS>/)\", [None, ('t_UFLOAT', 'UFLOAT'), None, None, None, None, ('t_UINT', 'UINT'), ('t_SIGN', 'SIGN'), ('t_FUNCNAME', 'FUNCNAME'), None, None, None, None, None, None, None, None, ('t_UNIT', 'UNIT'), None, None, None, (None, 'DOUBLE_STAR'), (None, 'COMMA'), (None, 'STAR'), (None, 'PERIOD'), (None, 'CARET'), (None, 'OPEN_PAREN'), (None, 'CLOSE_PAREN'), (None, 'SOLIDUS')])]}\n\n_lexstateignore = {'INITIAL': ' '}\n\n_lexstateerrorf = {'INITIAL': 't_error'}\n\n_lexstateeoff = {}"},{"fileName":"utils.py","filePath":"astropy/units/format","id":10069,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nUtilities shared by the different formats.\n\"\"\"\n\n\nimport warnings\nfrom fractions import Fraction\n\nfrom astropy.utils.misc import did_you_mean\nfrom ..utils import maybe_simple_fraction\n\n\ndef get_grouped_by_powers(bases, powers):\n    \"\"\"\n    Groups the powers and bases in the given\n    `~astropy.units.CompositeUnit` into positive powers and\n    negative powers for easy display on either side of a solidus.\n\n    Parameters\n    ----------\n    bases : list of `astropy.units.UnitBase` instances\n\n    powers : list of int\n\n    Returns\n    -------\n    positives, negatives : tuple of lists\n       Each element in each list is tuple of the form (*base*,\n       *power*).  The negatives have the sign of their power reversed\n       (i.e. the powers are all positive).\n    \"\"\"\n    positive = []\n    negative = []\n    for base, power in zip(bases, powers):\n        if power < 0:\n            negative.append((base, -power))\n        elif power > 0:\n            positive.append((base, power))\n        else:\n            raise ValueError(\"Unit with 0 power\")\n    return positive, negative\n\n\ndef split_mantissa_exponent(v, format_spec=\".8g\"):\n    \"\"\"\n    Given a number, split it into its mantissa and base 10 exponent\n    parts, each as strings.  If the exponent is too small, it may be\n    returned as the empty string.\n\n    Parameters\n    ----------\n    v : float\n\n    format_spec : str, optional\n        Number representation formatting string\n\n    Returns\n    -------\n    mantissa, exponent : tuple of strings\n    \"\"\"\n    x = format(v, format_spec).split('e')\n    if x[0] != '1.' + '0' * (len(x[0]) - 2):\n        m = x[0]\n    else:\n        m = ''\n\n    if len(x) == 2:\n        ex = x[1].lstrip(\"0+\")\n        if len(ex) > 0 and ex[0] == '-':\n            ex = '-' + ex[1:].lstrip('0')\n    else:\n        ex = ''\n\n    return m, ex\n\n\ndef decompose_to_known_units(unit, func):\n    \"\"\"\n    Partially decomposes a unit so it is only composed of units that\n    are \"known\" to a given format.\n\n    Parameters\n    ----------\n    unit : `~astropy.units.UnitBase` instance\n\n    func : callable\n        This function will be called to determine if a given unit is\n        \"known\".  If the unit is not known, this function should raise a\n        `ValueError`.\n\n    Returns\n    -------\n    unit : `~astropy.units.UnitBase` instance\n        A flattened unit.\n    \"\"\"\n    from astropy.units import core\n    if isinstance(unit, core.CompositeUnit):\n        new_unit = core.Unit(unit.scale)\n        for base, power in zip(unit.bases, unit.powers):\n            new_unit = new_unit * decompose_to_known_units(base, func) ** power\n        return new_unit\n    elif isinstance(unit, core.NamedUnit):\n        try:\n            func(unit)\n        except ValueError:\n            if isinstance(unit, core.Unit):\n                return decompose_to_known_units(unit._represents, func)\n            raise\n        return unit\n    else:\n        raise TypeError(\"unit argument must be a 'NamedUnit' or 'CompositeUnit', \"\n                        f\"not {type(unit)}\")\n\n\ndef format_power(power):\n    \"\"\"\n    Converts a value for a power (which may be floating point or a\n    `fractions.Fraction` object), into a string looking like either\n    an integer or a fraction, if the power is close to that.\n    \"\"\"\n    if not hasattr(power, 'denominator'):\n        power = maybe_simple_fraction(power)\n        if getattr(power, 'denonimator', None) == 1:\n            power = power.nominator\n\n    return str(power)\n\n\ndef _try_decomposed(unit, format_decomposed):\n    represents = getattr(unit, '_represents', None)\n    if represents is not None:\n        try:\n            represents_string = format_decomposed(represents)\n        except ValueError:\n            pass\n        else:\n            return represents_string\n\n    decomposed = unit.decompose()\n    if decomposed is not unit:\n        try:\n            decompose_string = format_decomposed(decomposed)\n        except ValueError:\n            pass\n        else:\n            return decompose_string\n\n    return None\n\n\ndef did_you_mean_units(s, all_units, deprecated_units, format_decomposed):\n    \"\"\"\n    A wrapper around `astropy.utils.misc.did_you_mean` that deals with\n    the display of deprecated units.\n\n    Parameters\n    ----------\n    s : str\n        The invalid unit string\n\n    all_units : dict\n        A mapping from valid unit names to unit objects.\n\n    deprecated_units : sequence\n        The deprecated unit names\n\n    format_decomposed : callable\n        A function to turn a decomposed version of the unit into a\n        string.  Should return `None` if not possible\n\n    Returns\n    -------\n    msg : str\n        A string message with a list of alternatives, or the empty\n        string.\n    \"\"\"\n    def fix_deprecated(x):\n        if x in deprecated_units:\n            results = [x + ' (deprecated)']\n            decomposed = _try_decomposed(\n                all_units[x], format_decomposed)\n            if decomposed is not None:\n                results.append(decomposed)\n            return results\n        return (x,)\n\n    return did_you_mean(s, all_units, fix=fix_deprecated)\n\n\ndef unit_deprecation_warning(s, unit, standard_name, format_decomposed):\n    \"\"\"\n    Raises a UnitsWarning about a deprecated unit in a given format.\n    Suggests a decomposed alternative if one is available.\n\n    Parameters\n    ----------\n    s : str\n        The deprecated unit name.\n\n    unit : astropy.units.core.UnitBase\n        The unit object.\n\n    standard_name : str\n        The name of the format for which the unit is deprecated.\n\n    format_decomposed : callable\n        A function to turn a decomposed version of the unit into a\n        string.  Should return `None` if not possible\n    \"\"\"\n    from astropy.units.core import UnitsWarning\n\n    message = f\"The unit '{s}' has been deprecated in the {standard_name} standard.\"\n    decomposed = _try_decomposed(unit, format_decomposed)\n    if decomposed is not None:\n        message += f\" Suggested: {decomposed}.\"\n    warnings.warn(message, UnitsWarning)\n"},{"col":0,"comment":"\n    Partially decomposes a unit so it is only composed of units that\n    are \"known\" to a given format.\n\n    Parameters\n    ----------\n    unit : `~astropy.units.UnitBase` instance\n\n    func : callable\n        This function will be called to determine if a given unit is\n        \"known\".  If the unit is not known, this function should raise a\n        `ValueError`.\n\n    Returns\n    -------\n    unit : `~astropy.units.UnitBase` instance\n        A flattened unit.\n    ","endLoc":114,"header":"def decompose_to_known_units(unit, func)","id":10070,"name":"decompose_to_known_units","nodeType":"Function","startLoc":79,"text":"def decompose_to_known_units(unit, func):\n    \"\"\"\n    Partially decomposes a unit so it is only composed of units that\n    are \"known\" to a given format.\n\n    Parameters\n    ----------\n    unit : `~astropy.units.UnitBase` instance\n\n    func : callable\n        This function will be called to determine if a given unit is\n        \"known\".  If the unit is not known, this function should raise a\n        `ValueError`.\n\n    Returns\n    -------\n    unit : `~astropy.units.UnitBase` instance\n        A flattened unit.\n    \"\"\"\n    from astropy.units import core\n    if isinstance(unit, core.CompositeUnit):\n        new_unit = core.Unit(unit.scale)\n        for base, power in zip(unit.bases, unit.powers):\n            new_unit = new_unit * decompose_to_known_units(base, func) ** power\n        return new_unit\n    elif isinstance(unit, core.NamedUnit):\n        try:\n            func(unit)\n        except ValueError:\n            if isinstance(unit, core.Unit):\n                return decompose_to_known_units(unit._represents, func)\n            raise\n        return unit\n    else:\n        raise TypeError(\"unit argument must be a 'NamedUnit' or 'CompositeUnit', \"\n                        f\"not {type(unit)}\")"},{"col":0,"comment":"\n    From a list of target units (either as strings or unit objects) and physical\n    types, return a list of Unit objects.\n    ","endLoc":43,"header":"def _get_allowed_units(targets)","id":10071,"name":"_get_allowed_units","nodeType":"Function","startLoc":25,"text":"def _get_allowed_units(targets):\n    \"\"\"\n    From a list of target units (either as strings or unit objects) and physical\n    types, return a list of Unit objects.\n    \"\"\"\n    allowed_units = []\n    for target in targets:\n\n        try:\n            unit = Unit(target)\n        except (TypeError, ValueError):\n            try:\n                unit = get_physical_type(target)._unit\n            except (TypeError, ValueError, KeyError):  # KeyError for Enum\n                raise ValueError(f\"Invalid unit or physical type {target!r}.\") from None\n\n        allowed_units.append(unit)\n\n    return allowed_units"},{"col":0,"comment":"null","endLoc":150,"header":"def _try_decomposed(unit, format_decomposed)","id":10072,"name":"_try_decomposed","nodeType":"Function","startLoc":131,"text":"def _try_decomposed(unit, format_decomposed):\n    represents = getattr(unit, '_represents', None)\n    if represents is not None:\n        try:\n            represents_string = format_decomposed(represents)\n        except ValueError:\n            pass\n        else:\n            return represents_string\n\n    decomposed = unit.decompose()\n    if decomposed is not unit:\n        try:\n            decompose_string = format_decomposed(decomposed)\n        except ValueError:\n            pass\n        else:\n            return decompose_string\n\n    return None"},{"col":4,"comment":"null","endLoc":119,"header":"@classmethod\n    def _get_unit(cls, t)","id":10073,"name":"_get_unit","nodeType":"Function","startLoc":100,"text":"@classmethod\n    def _get_unit(cls, t):\n        try:\n            return super()._get_unit(t)\n        except ValueError:\n            if cls._explicit_custom_unit_regex.match(t.value):\n                return cls._def_custom_unit(t.value)\n\n            if cls._custom_unit_regex.match(t.value):\n                warnings.warn(\n                    \"Unit {!r} not supported by the VOUnit \"\n                    \"standard. {}\".format(\n                        t.value, utils.did_you_mean_units(\n                            t.value, cls._units, cls._deprecated_units,\n                            cls._to_decomposed_alternative)),\n                    core.UnitsWarning)\n\n                return cls._def_custom_unit(t.value)\n\n            raise"},{"col":0,"comment":"\n    A wrapper around `astropy.utils.misc.did_you_mean` that deals with\n    the display of deprecated units.\n\n    Parameters\n    ----------\n    s : str\n        The invalid unit string\n\n    all_units : dict\n        A mapping from valid unit names to unit objects.\n\n    deprecated_units : sequence\n        The deprecated unit names\n\n    format_decomposed : callable\n        A function to turn a decomposed version of the unit into a\n        string.  Should return `None` if not possible\n\n    Returns\n    -------\n    msg : str\n        A string message with a list of alternatives, or the empty\n        string.\n    ","endLoc":189,"header":"def did_you_mean_units(s, all_units, deprecated_units, format_decomposed)","id":10074,"name":"did_you_mean_units","nodeType":"Function","startLoc":153,"text":"def did_you_mean_units(s, all_units, deprecated_units, format_decomposed):\n    \"\"\"\n    A wrapper around `astropy.utils.misc.did_you_mean` that deals with\n    the display of deprecated units.\n\n    Parameters\n    ----------\n    s : str\n        The invalid unit string\n\n    all_units : dict\n        A mapping from valid unit names to unit objects.\n\n    deprecated_units : sequence\n        The deprecated unit names\n\n    format_decomposed : callable\n        A function to turn a decomposed version of the unit into a\n        string.  Should return `None` if not possible\n\n    Returns\n    -------\n    msg : str\n        A string message with a list of alternatives, or the empty\n        string.\n    \"\"\"\n    def fix_deprecated(x):\n        if x in deprecated_units:\n            results = [x + ' (deprecated)']\n            decomposed = _try_decomposed(\n                all_units[x], format_decomposed)\n            if decomposed is not None:\n                results.append(decomposed)\n            return results\n        return (x,)\n\n    return did_you_mean(s, all_units, fix=fix_deprecated)"},{"col":4,"comment":"null","endLoc":486,"header":"@classmethod\n    def _get_unit(cls, t)","id":10075,"name":"_get_unit","nodeType":"Function","startLoc":476,"text":"@classmethod\n    def _get_unit(cls, t):\n        try:\n            return cls._parse_unit(t.value)\n        except ValueError as e:\n            registry = core.get_current_unit_registry()\n            if t.value in registry.aliases:\n                return registry.aliases[t.value]\n\n            raise ValueError(\n                f\"At col {t.lexpos}, {str(e)}\")"},{"col":0,"comment":"\n    Raises a UnitsWarning about a deprecated unit in a given format.\n    Suggests a decomposed alternative if one is available.\n\n    Parameters\n    ----------\n    s : str\n        The deprecated unit name.\n\n    unit : astropy.units.core.UnitBase\n        The unit object.\n\n    standard_name : str\n        The name of the format for which the unit is deprecated.\n\n    format_decomposed : callable\n        A function to turn a decomposed version of the unit into a\n        string.  Should return `None` if not possible\n    ","endLoc":218,"header":"def unit_deprecation_warning(s, unit, standard_name, format_decomposed)","id":10076,"name":"unit_deprecation_warning","nodeType":"Function","startLoc":192,"text":"def unit_deprecation_warning(s, unit, standard_name, format_decomposed):\n    \"\"\"\n    Raises a UnitsWarning about a deprecated unit in a given format.\n    Suggests a decomposed alternative if one is available.\n\n    Parameters\n    ----------\n    s : str\n        The deprecated unit name.\n\n    unit : astropy.units.core.UnitBase\n        The unit object.\n\n    standard_name : str\n        The name of the format for which the unit is deprecated.\n\n    format_decomposed : callable\n        A function to turn a decomposed version of the unit into a\n        string.  Should return `None` if not possible\n    \"\"\"\n    from astropy.units.core import UnitsWarning\n\n    message = f\"The unit '{s}' has been deprecated in the {standard_name} standard.\"\n    decomposed = _try_decomposed(unit, format_decomposed)\n    if decomposed is not None:\n        message += f\" Suggested: {decomposed}.\"\n    warnings.warn(message, UnitsWarning)"},{"col":0,"comment":"","endLoc":5,"header":"utils.py#<anonymous>","id":10077,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nUtilities shared by the different formats.\n\"\"\""},{"fileName":"generic.py","filePath":"astropy/units/format","id":10078,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# This module includes files automatically generated from ply (these end in\n# _lextab.py and _parsetab.py). To generate these files, remove them from this\n# folder, then build astropy and run the tests in-place:\n#\n#   python setup.py build_ext --inplace\n#   pytest astropy/units\n#\n# You can then commit the changes to the re-generated _lextab.py and\n# _parsetab.py files.\n\n\"\"\"\nHandles a \"generic\" string format for units\n\"\"\"\n\nimport re\nimport warnings\nfrom fractions import Fraction\nimport unicodedata\n\nfrom . import core, utils\nfrom .base import Base\nfrom astropy.utils import classproperty, parsing\nfrom astropy.utils.misc import did_you_mean\n\n\ndef _to_string(cls, unit):\n    if isinstance(unit, core.CompositeUnit):\n        parts = []\n\n        if cls._show_scale and unit.scale != 1:\n            parts.append(f'{unit.scale:g}')\n\n        if len(unit.bases):\n            positives, negatives = utils.get_grouped_by_powers(\n                unit.bases, unit.powers)\n            if len(positives):\n                parts.append(cls._format_unit_list(positives))\n            elif len(parts) == 0:\n                parts.append('1')\n\n            if len(negatives):\n                parts.append('/')\n                unit_list = cls._format_unit_list(negatives)\n                if len(negatives) == 1:\n                    parts.append(f'{unit_list}')\n                else:\n                    parts.append(f'({unit_list})')\n\n        return ' '.join(parts)\n    elif isinstance(unit, core.NamedUnit):\n        return cls._get_unit_name(unit)\n\n\nclass Generic(Base):\n    \"\"\"\n    A \"generic\" format.\n\n    The syntax of the format is based directly on the FITS standard,\n    but instead of only supporting the units that FITS knows about, it\n    supports any unit available in the `astropy.units` namespace.\n    \"\"\"\n\n    _show_scale = True\n\n    _tokens = (\n        'COMMA',\n        'DOUBLE_STAR',\n        'STAR',\n        'PERIOD',\n        'SOLIDUS',\n        'CARET',\n        'OPEN_PAREN',\n        'CLOSE_PAREN',\n        'FUNCNAME',\n        'UNIT',\n        'SIGN',\n        'UINT',\n        'UFLOAT'\n    )\n\n    @classproperty(lazy=True)\n    def _all_units(cls):\n        return cls._generate_unit_names()\n\n    @classproperty(lazy=True)\n    def _units(cls):\n        return cls._all_units[0]\n\n    @classproperty(lazy=True)\n    def _deprecated_units(cls):\n        return cls._all_units[1]\n\n    @classproperty(lazy=True)\n    def _functions(cls):\n        return cls._all_units[2]\n\n    @classproperty(lazy=True)\n    def _parser(cls):\n        return cls._make_parser()\n\n    @classproperty(lazy=True)\n    def _lexer(cls):\n        return cls._make_lexer()\n\n    @classmethod\n    def _make_lexer(cls):\n        tokens = cls._tokens\n\n        t_COMMA = r'\\,'\n        t_STAR = r'\\*'\n        t_PERIOD = r'\\.'\n        t_SOLIDUS = r'/'\n        t_DOUBLE_STAR = r'\\*\\*'\n        t_CARET = r'\\^'\n        t_OPEN_PAREN = r'\\('\n        t_CLOSE_PAREN = r'\\)'\n\n        # NOTE THE ORDERING OF THESE RULES IS IMPORTANT!!\n        # Regular expression rules for simple tokens\n        def t_UFLOAT(t):\n            r'((\\d+\\.?\\d*)|(\\.\\d+))([eE][+-]?\\d+)?'\n            if not re.search(r'[eE\\.]', t.value):\n                t.type = 'UINT'\n                t.value = int(t.value)\n            elif t.value.endswith('.'):\n                t.type = 'UINT'\n                t.value = int(t.value[:-1])\n            else:\n                t.value = float(t.value)\n            return t\n\n        def t_UINT(t):\n            r'\\d+'\n            t.value = int(t.value)\n            return t\n\n        def t_SIGN(t):\n            r'[+-](?=\\d)'\n            t.value = int(t.value + '1')\n            return t\n\n        # This needs to be a function so we can force it to happen\n        # before t_UNIT\n        def t_FUNCNAME(t):\n            r'((sqrt)|(ln)|(exp)|(log)|(mag)|(dB)|(dex))(?=\\ *\\()'\n            return t\n\n        def t_UNIT(t):\n            \"%|([YZEPTGMkhdcmu\\N{MICRO SIGN}npfazy]?'((?!\\\\d)\\\\w)+')|((?!\\\\d)\\\\w)+\"\n            t.value = cls._get_unit(t)\n            return t\n\n        t_ignore = ' '\n\n        # Error handling rule\n        def t_error(t):\n            raise ValueError(\n                f\"Invalid character at col {t.lexpos}\")\n\n        return parsing.lex(lextab='generic_lextab', package='astropy/units',\n                           reflags=int(re.UNICODE))\n\n    @classmethod\n    def _make_parser(cls):\n        \"\"\"\n        The grammar here is based on the description in the `FITS\n        standard\n        <http://fits.gsfc.nasa.gov/standard30/fits_standard30aa.pdf>`_,\n        Section 4.3, which is not terribly precise.  The exact grammar\n        is here is based on the YACC grammar in the `unity library\n        <https://bitbucket.org/nxg/unity/>`_.\n\n        This same grammar is used by the `\"fits\"` and `\"vounit\"`\n        formats, the only difference being the set of available unit\n        strings.\n        \"\"\"\n        tokens = cls._tokens\n\n        def p_main(p):\n            '''\n            main : unit\n                 | structured_unit\n                 | structured_subunit\n            '''\n            if isinstance(p[1], tuple):\n                # Unpack possible StructuredUnit inside a tuple, ie.,\n                # ignore any set of very outer parentheses.\n                p[0] = p[1][0]\n            else:\n                p[0] = p[1]\n\n        def p_structured_subunit(p):\n            '''\n            structured_subunit : OPEN_PAREN structured_unit CLOSE_PAREN\n            '''\n            # We hide a structured unit enclosed by parentheses inside\n            # a tuple, so that we can easily distinguish units like\n            # \"(au, au/day), yr\" from \"au, au/day, yr\".\n            p[0] = (p[2],)\n\n        def p_structured_unit(p):\n            '''\n            structured_unit : subunit COMMA\n                            | subunit COMMA subunit\n            '''\n            from ..structured import StructuredUnit\n            inputs = (p[1],) if len(p) == 3 else (p[1], p[3])\n            units = ()\n            for subunit in inputs:\n                if isinstance(subunit, tuple):\n                    # Structured unit that should be its own entry in the\n                    # new StructuredUnit (was enclosed in parentheses).\n                    units += subunit\n                elif isinstance(subunit, StructuredUnit):\n                    # Structured unit whose entries should be\n                    # individiually added to the new StructuredUnit.\n                    units += subunit.values()\n                else:\n                    # Regular unit to be added to the StructuredUnit.\n                    units += (subunit,)\n\n            p[0] = StructuredUnit(units)\n\n        def p_subunit(p):\n            '''\n            subunit : unit\n                    | structured_unit\n                    | structured_subunit\n            '''\n            p[0] = p[1]\n\n        def p_unit(p):\n            '''\n            unit : product_of_units\n                 | factor product_of_units\n                 | factor product product_of_units\n                 | division_product_of_units\n                 | factor division_product_of_units\n                 | factor product division_product_of_units\n                 | inverse_unit\n                 | factor inverse_unit\n                 | factor product inverse_unit\n                 | factor\n            '''\n            from astropy.units.core import Unit\n            if len(p) == 2:\n                p[0] = Unit(p[1])\n            elif len(p) == 3:\n                p[0] = Unit(p[1] * p[2])\n            elif len(p) == 4:\n                p[0] = Unit(p[1] * p[3])\n\n        def p_division_product_of_units(p):\n            '''\n            division_product_of_units : division_product_of_units division product_of_units\n                                      | product_of_units\n            '''\n            from astropy.units.core import Unit\n            if len(p) == 4:\n                p[0] = Unit(p[1] / p[3])\n            else:\n                p[0] = p[1]\n\n        def p_inverse_unit(p):\n            '''\n            inverse_unit : division unit_expression\n            '''\n            p[0] = p[2] ** -1\n\n        def p_factor(p):\n            '''\n            factor : factor_fits\n                   | factor_float\n                   | factor_int\n            '''\n            p[0] = p[1]\n\n        def p_factor_float(p):\n            '''\n            factor_float : signed_float\n                         | signed_float UINT signed_int\n                         | signed_float UINT power numeric_power\n            '''\n            if cls.name == 'fits':\n                raise ValueError(\"Numeric factor not supported by FITS\")\n            if len(p) == 4:\n                p[0] = p[1] * p[2] ** float(p[3])\n            elif len(p) == 5:\n                p[0] = p[1] * p[2] ** float(p[4])\n            elif len(p) == 2:\n                p[0] = p[1]\n\n        def p_factor_int(p):\n            '''\n            factor_int : UINT\n                       | UINT signed_int\n                       | UINT power numeric_power\n                       | UINT UINT signed_int\n                       | UINT UINT power numeric_power\n            '''\n            if cls.name == 'fits':\n                raise ValueError(\"Numeric factor not supported by FITS\")\n            if len(p) == 2:\n                p[0] = p[1]\n            elif len(p) == 3:\n                p[0] = p[1] ** float(p[2])\n            elif len(p) == 4:\n                if isinstance(p[2], int):\n                    p[0] = p[1] * p[2] ** float(p[3])\n                else:\n                    p[0] = p[1] ** float(p[3])\n            elif len(p) == 5:\n                p[0] = p[1] * p[2] ** p[4]\n\n        def p_factor_fits(p):\n            '''\n            factor_fits : UINT power OPEN_PAREN signed_int CLOSE_PAREN\n                        | UINT power OPEN_PAREN UINT CLOSE_PAREN\n                        | UINT power signed_int\n                        | UINT power UINT\n                        | UINT SIGN UINT\n                        | UINT OPEN_PAREN signed_int CLOSE_PAREN\n            '''\n            if p[1] != 10:\n                if cls.name == 'fits':\n                    raise ValueError(\"Base must be 10\")\n                else:\n                    return\n            if len(p) == 4:\n                if p[2] in ('**', '^'):\n                    p[0] = 10 ** p[3]\n                else:\n                    p[0] = 10 ** (p[2] * p[3])\n            elif len(p) == 5:\n                p[0] = 10 ** p[3]\n            elif len(p) == 6:\n                p[0] = 10 ** p[4]\n\n        def p_product_of_units(p):\n            '''\n            product_of_units : unit_expression product product_of_units\n                             | unit_expression product_of_units\n                             | unit_expression\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            elif len(p) == 3:\n                p[0] = p[1] * p[2]\n            else:\n                p[0] = p[1] * p[3]\n\n        def p_unit_expression(p):\n            '''\n            unit_expression : function\n                            | unit_with_power\n                            | OPEN_PAREN product_of_units CLOSE_PAREN\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = p[2]\n\n        def p_unit_with_power(p):\n            '''\n            unit_with_power : UNIT power numeric_power\n                            | UNIT numeric_power\n                            | UNIT\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            elif len(p) == 3:\n                p[0] = p[1] ** p[2]\n            else:\n                p[0] = p[1] ** p[3]\n\n        def p_numeric_power(p):\n            '''\n            numeric_power : sign UINT\n                          | OPEN_PAREN paren_expr CLOSE_PAREN\n            '''\n            if len(p) == 3:\n                p[0] = p[1] * p[2]\n            elif len(p) == 4:\n                p[0] = p[2]\n\n        def p_paren_expr(p):\n            '''\n            paren_expr : sign UINT\n                       | signed_float\n                       | frac\n            '''\n            if len(p) == 3:\n                p[0] = p[1] * p[2]\n            else:\n                p[0] = p[1]\n\n        def p_frac(p):\n            '''\n            frac : sign UINT division sign UINT\n            '''\n            p[0] = Fraction(p[1] * p[2], p[4] * p[5])\n\n        def p_sign(p):\n            '''\n            sign : SIGN\n                 |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1\n\n        def p_product(p):\n            '''\n            product : STAR\n                    | PERIOD\n            '''\n            pass\n\n        def p_division(p):\n            '''\n            division : SOLIDUS\n            '''\n            pass\n\n        def p_power(p):\n            '''\n            power : DOUBLE_STAR\n                  | CARET\n            '''\n            p[0] = p[1]\n\n        def p_signed_int(p):\n            '''\n            signed_int : SIGN UINT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_signed_float(p):\n            '''\n            signed_float : sign UINT\n                         | sign UFLOAT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_function_name(p):\n            '''\n            function_name : FUNCNAME\n            '''\n            p[0] = p[1]\n\n        def p_function(p):\n            '''\n            function : function_name OPEN_PAREN main CLOSE_PAREN\n            '''\n            if p[1] == 'sqrt':\n                p[0] = p[3] ** 0.5\n                return\n            elif p[1] in ('mag', 'dB', 'dex'):\n                function_unit = cls._parse_unit(p[1])\n                # In Generic, this is callable, but that does not have to\n                # be the case in subclasses (e.g., in VOUnit it is not).\n                if callable(function_unit):\n                    p[0] = function_unit(p[3])\n                    return\n\n            raise ValueError(f\"'{p[1]}' is not a recognized function\")\n\n        def p_error(p):\n            raise ValueError()\n\n        return parsing.yacc(tabmodule='generic_parsetab', package='astropy/units')\n\n    @classmethod\n    def _get_unit(cls, t):\n        try:\n            return cls._parse_unit(t.value)\n        except ValueError as e:\n            registry = core.get_current_unit_registry()\n            if t.value in registry.aliases:\n                return registry.aliases[t.value]\n\n            raise ValueError(\n                f\"At col {t.lexpos}, {str(e)}\")\n\n    @classmethod\n    def _parse_unit(cls, s, detailed_exception=True):\n        registry = core.get_current_unit_registry().registry\n        if s in cls._unit_symbols:\n            s = cls._unit_symbols[s]\n\n        elif not s.isascii():\n            if s[0] == '\\N{MICRO SIGN}':\n                s = 'u' + s[1:]\n            if s[-1] in cls._prefixable_unit_symbols:\n                s = s[:-1] + cls._prefixable_unit_symbols[s[-1]]\n            elif len(s) > 1 and s[-1] in cls._unit_suffix_symbols:\n                s = s[:-1] + cls._unit_suffix_symbols[s[-1]]\n            elif s.endswith('R\\N{INFINITY}'):\n                s = s[:-2] + 'Ry'\n\n        if s in registry:\n            return registry[s]\n\n        if detailed_exception:\n            raise ValueError(\n                f'{s} is not a valid unit. {did_you_mean(s, registry)}')\n        else:\n            raise ValueError()\n\n    _unit_symbols = {\n        '%': 'percent',\n        '\\N{PRIME}': 'arcmin',\n        '\\N{DOUBLE PRIME}': 'arcsec',\n        '\\N{MODIFIER LETTER SMALL H}': 'hourangle',\n        'e\\N{SUPERSCRIPT MINUS}': 'electron',\n    }\n\n    _prefixable_unit_symbols = {\n        '\\N{GREEK CAPITAL LETTER OMEGA}': 'Ohm',\n        '\\N{LATIN CAPITAL LETTER A WITH RING ABOVE}': 'Angstrom',\n        '\\N{SCRIPT SMALL L}': 'l',\n    }\n\n    _unit_suffix_symbols = {\n        '\\N{CIRCLED DOT OPERATOR}': 'sun',\n        '\\N{SUN}': 'sun',\n        '\\N{CIRCLED PLUS}': 'earth',\n        '\\N{EARTH}': 'earth',\n        '\\N{JUPITER}': 'jupiter',\n        '\\N{LATIN SUBSCRIPT SMALL LETTER E}': '_e',\n        '\\N{LATIN SUBSCRIPT SMALL LETTER P}': '_p',\n    }\n\n    _translations = str.maketrans({\n        '\\N{GREEK SMALL LETTER MU}': '\\N{MICRO SIGN}',\n        '\\N{MINUS SIGN}': '-',\n    })\n    \"\"\"Character translations that should be applied before parsing a string.\n\n    Note that this does explicitly *not* generally translate MICRO SIGN to u,\n    since then a string like 'µ' would be interpreted as unit mass.\n    \"\"\"\n\n    _superscripts = (\n        '\\N{SUPERSCRIPT MINUS}'\n        '\\N{SUPERSCRIPT PLUS SIGN}'\n        '\\N{SUPERSCRIPT ZERO}'\n        '\\N{SUPERSCRIPT ONE}'\n        '\\N{SUPERSCRIPT TWO}'\n        '\\N{SUPERSCRIPT THREE}'\n        '\\N{SUPERSCRIPT FOUR}'\n        '\\N{SUPERSCRIPT FIVE}'\n        '\\N{SUPERSCRIPT SIX}'\n        '\\N{SUPERSCRIPT SEVEN}'\n        '\\N{SUPERSCRIPT EIGHT}'\n        '\\N{SUPERSCRIPT NINE}'\n    )\n\n    _superscript_translations = str.maketrans(_superscripts, '-+0123456789')\n    _regex_superscript = re.compile(f'[{_superscripts}]?[{_superscripts[2:]}]+')\n    _regex_deg = re.compile('°([CF])?')\n\n    @classmethod\n    def _convert_superscript(cls, m):\n        return f'({m.group().translate(cls._superscript_translations)})'\n\n    @classmethod\n    def _convert_deg(cls, m):\n        if len(m.string) == 1:\n            return 'deg'\n        return m.string.replace('°', 'deg_')\n\n    @classmethod\n    def parse(cls, s, debug=False):\n        if not isinstance(s, str):\n            s = s.decode('ascii')\n        elif not s.isascii():\n            # common normalization of unicode strings to avoid\n            # having to deal with multiple representations of\n            # the same character. This normalizes to \"composed\" form\n            # and will e.g. convert OHM SIGN to GREEK CAPITAL LETTER OMEGA\n            s = unicodedata.normalize('NFC', s)\n            # Translate some basic unicode items that we'd like to support on\n            # input but are not standard.\n            s = s.translate(cls._translations)\n\n            # TODO: might the below be better done in the parser/lexer?\n            # Translate superscripts to parenthesized numbers; this ensures\n            # that mixes of superscripts and regular numbers fail.\n            s = cls._regex_superscript.sub(cls._convert_superscript, s)\n            # Translate possible degrees.\n            s = cls._regex_deg.sub(cls._convert_deg, s)\n\n        result = cls._do_parse(s, debug=debug)\n        # Check for excess solidi, but exclude fractional exponents (accepted)\n        n_slashes = s.count('/')\n        if n_slashes > 1 and (n_slashes - len(re.findall(r'\\(\\d+/\\d+\\)', s))) > 1:\n            warnings.warn(\n                \"'{}' contains multiple slashes, which is \"\n                \"discouraged by the FITS standard\".format(s),\n                core.UnitsWarning)\n        return result\n\n    @classmethod\n    def _do_parse(cls, s, debug=False):\n        try:\n            # This is a short circuit for the case where the string\n            # is just a single unit name\n            return cls._parse_unit(s, detailed_exception=False)\n        except ValueError as e:\n            try:\n                return cls._parser.parse(s, lexer=cls._lexer, debug=debug)\n            except ValueError as e:\n                if str(e):\n                    raise\n                else:\n                    raise ValueError(f\"Syntax error parsing unit '{s}'\")\n\n    @classmethod\n    def _get_unit_name(cls, unit):\n        return unit.get_format_name('generic')\n\n    @classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        units.sort(key=lambda x: cls._get_unit_name(x[0]).lower())\n\n        for base, power in units:\n            if power == 1:\n                out.append(cls._get_unit_name(base))\n            else:\n                power = utils.format_power(power)\n                if '/' in power or '.' in power:\n                    out.append(f'{cls._get_unit_name(base)}({power})')\n                else:\n                    out.append(f'{cls._get_unit_name(base)}{power}')\n        return ' '.join(out)\n\n    @classmethod\n    def to_string(cls, unit):\n        return _to_string(cls, unit)\n\n\nclass Unscaled(Generic):\n    \"\"\"\n    A format that doesn't display the scale part of the unit, other\n    than that, it is identical to the `Generic` format.\n\n    This is used in some error messages where the scale is irrelevant.\n    \"\"\"\n    _show_scale = False\n"},{"col":4,"comment":"null","endLoc":105,"header":"@classproperty(lazy=True)\n    def _lexer(cls)","id":10079,"name":"_lexer","nodeType":"Function","startLoc":103,"text":"@classproperty(lazy=True)\n    def _lexer(cls):\n        return cls._make_lexer()"},{"className":"Unscaled","col":0,"comment":"\n    A format that doesn't display the scale part of the unit, other\n    than that, it is identical to the `Generic` format.\n\n    This is used in some error messages where the scale is irrelevant.\n    ","endLoc":654,"id":10080,"nodeType":"Class","startLoc":647,"text":"class Unscaled(Generic):\n    \"\"\"\n    A format that doesn't display the scale part of the unit, other\n    than that, it is identical to the `Generic` format.\n\n    This is used in some error messages where the scale is irrelevant.\n    \"\"\"\n    _show_scale = False"},{"attributeType":"null","col":4,"comment":"null","endLoc":654,"id":10081,"name":"_show_scale","nodeType":"Attribute","startLoc":654,"text":"_show_scale"},{"col":4,"comment":"null","endLoc":163,"header":"@classmethod\n    def _make_lexer(cls)","id":10082,"name":"_make_lexer","nodeType":"Function","startLoc":107,"text":"@classmethod\n    def _make_lexer(cls):\n        tokens = cls._tokens\n\n        t_COMMA = r'\\,'\n        t_STAR = r'\\*'\n        t_PERIOD = r'\\.'\n        t_SOLIDUS = r'/'\n        t_DOUBLE_STAR = r'\\*\\*'\n        t_CARET = r'\\^'\n        t_OPEN_PAREN = r'\\('\n        t_CLOSE_PAREN = r'\\)'\n\n        # NOTE THE ORDERING OF THESE RULES IS IMPORTANT!!\n        # Regular expression rules for simple tokens\n        def t_UFLOAT(t):\n            r'((\\d+\\.?\\d*)|(\\.\\d+))([eE][+-]?\\d+)?'\n            if not re.search(r'[eE\\.]', t.value):\n                t.type = 'UINT'\n                t.value = int(t.value)\n            elif t.value.endswith('.'):\n                t.type = 'UINT'\n                t.value = int(t.value[:-1])\n            else:\n                t.value = float(t.value)\n            return t\n\n        def t_UINT(t):\n            r'\\d+'\n            t.value = int(t.value)\n            return t\n\n        def t_SIGN(t):\n            r'[+-](?=\\d)'\n            t.value = int(t.value + '1')\n            return t\n\n        # This needs to be a function so we can force it to happen\n        # before t_UNIT\n        def t_FUNCNAME(t):\n            r'((sqrt)|(ln)|(exp)|(log)|(mag)|(dB)|(dex))(?=\\ *\\()'\n            return t\n\n        def t_UNIT(t):\n            \"%|([YZEPTGMkhdcmu\\N{MICRO SIGN}npfazy]?'((?!\\\\d)\\\\w)+')|((?!\\\\d)\\\\w)+\"\n            t.value = cls._get_unit(t)\n            return t\n\n        t_ignore = ' '\n\n        # Error handling rule\n        def t_error(t):\n            raise ValueError(\n                f\"Invalid character at col {t.lexpos}\")\n\n        return parsing.lex(lextab='generic_lextab', package='astropy/units',\n                           reflags=int(re.UNICODE))"},{"col":0,"comment":"","endLoc":15,"header":"generic.py#<anonymous>","id":10083,"name":"<anonymous>","nodeType":"Function","startLoc":13,"text":"\"\"\"\nHandles a \"generic\" string format for units\n\"\"\""},{"fileName":"console.py","filePath":"astropy/units/format","id":10084,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nHandles the \"Console\" unit format.\n\"\"\"\n\n\nfrom . import base, core, utils\n\n\nclass Console(base.Base):\n    \"\"\"\n    Output-only format for to display pretty formatting at the\n    console.\n\n    For example::\n\n      >>> import astropy.units as u\n      >>> print(u.Ry.decompose().to_string('console'))  # doctest: +FLOAT_CMP\n                       m^2 kg\n      2.1798721*10^-18 ------\n                        s^2\n    \"\"\"\n\n    _times = \"*\"\n    _line = \"-\"\n\n    @classmethod\n    def _get_unit_name(cls, unit):\n        return unit.get_format_name('console')\n\n    @classmethod\n    def _format_superscript(cls, number):\n        return f'^{number}'\n\n    @classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        for base, power in units:\n            if power == 1:\n                out.append(cls._get_unit_name(base))\n            else:\n                out.append('{}{}'.format(\n                    cls._get_unit_name(base),\n                    cls._format_superscript(\n                            utils.format_power(power))))\n        return ' '.join(out)\n\n    @classmethod\n    def format_exponential_notation(cls, val):\n        m, ex = utils.split_mantissa_exponent(val)\n\n        parts = []\n        if m:\n            parts.append(m)\n\n        if ex:\n            parts.append(f\"10{cls._format_superscript(ex)}\")\n\n        return cls._times.join(parts)\n\n    @classmethod\n    def to_string(cls, unit):\n        if isinstance(unit, core.CompositeUnit):\n            if unit.scale == 1:\n                s = ''\n            else:\n                s = cls.format_exponential_notation(unit.scale)\n\n            if len(unit.bases):\n                positives, negatives = utils.get_grouped_by_powers(\n                    unit.bases, unit.powers)\n                if len(negatives):\n                    if len(positives):\n                        positives = cls._format_unit_list(positives)\n                    else:\n                        positives = '1'\n                    negatives = cls._format_unit_list(negatives)\n                    l = len(s)\n                    r = max(len(positives), len(negatives))\n                    f = f\"{{0:^{l}s}} {{1:^{r}s}}\"\n\n                    lines = [\n                        f.format('', positives),\n                        f.format(s, cls._line * r),\n                        f.format('', negatives)\n                    ]\n\n                    s = '\\n'.join(lines)\n                else:\n                    positives = cls._format_unit_list(positives)\n                    s += positives\n        elif isinstance(unit, core.NamedUnit):\n            s = cls._get_unit_name(unit)\n\n        return s\n"},{"className":"Console","col":0,"comment":"\n    Output-only format for to display pretty formatting at the\n    console.\n\n    For example::\n\n      >>> import astropy.units as u\n      >>> print(u.Ry.decompose().to_string('console'))  # doctest: +FLOAT_CMP\n                       m^2 kg\n      2.1798721*10^-18 ------\n                        s^2\n    ","endLoc":97,"id":10085,"nodeType":"Class","startLoc":12,"text":"class Console(base.Base):\n    \"\"\"\n    Output-only format for to display pretty formatting at the\n    console.\n\n    For example::\n\n      >>> import astropy.units as u\n      >>> print(u.Ry.decompose().to_string('console'))  # doctest: +FLOAT_CMP\n                       m^2 kg\n      2.1798721*10^-18 ------\n                        s^2\n    \"\"\"\n\n    _times = \"*\"\n    _line = \"-\"\n\n    @classmethod\n    def _get_unit_name(cls, unit):\n        return unit.get_format_name('console')\n\n    @classmethod\n    def _format_superscript(cls, number):\n        return f'^{number}'\n\n    @classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        for base, power in units:\n            if power == 1:\n                out.append(cls._get_unit_name(base))\n            else:\n                out.append('{}{}'.format(\n                    cls._get_unit_name(base),\n                    cls._format_superscript(\n                            utils.format_power(power))))\n        return ' '.join(out)\n\n    @classmethod\n    def format_exponential_notation(cls, val):\n        m, ex = utils.split_mantissa_exponent(val)\n\n        parts = []\n        if m:\n            parts.append(m)\n\n        if ex:\n            parts.append(f\"10{cls._format_superscript(ex)}\")\n\n        return cls._times.join(parts)\n\n    @classmethod\n    def to_string(cls, unit):\n        if isinstance(unit, core.CompositeUnit):\n            if unit.scale == 1:\n                s = ''\n            else:\n                s = cls.format_exponential_notation(unit.scale)\n\n            if len(unit.bases):\n                positives, negatives = utils.get_grouped_by_powers(\n                    unit.bases, unit.powers)\n                if len(negatives):\n                    if len(positives):\n                        positives = cls._format_unit_list(positives)\n                    else:\n                        positives = '1'\n                    negatives = cls._format_unit_list(negatives)\n                    l = len(s)\n                    r = max(len(positives), len(negatives))\n                    f = f\"{{0:^{l}s}} {{1:^{r}s}}\"\n\n                    lines = [\n                        f.format('', positives),\n                        f.format(s, cls._line * r),\n                        f.format('', negatives)\n                    ]\n\n                    s = '\\n'.join(lines)\n                else:\n                    positives = cls._format_unit_list(positives)\n                    s += positives\n        elif isinstance(unit, core.NamedUnit):\n            s = cls._get_unit_name(unit)\n\n        return s"},{"col":4,"comment":"null","endLoc":31,"header":"@classmethod\n    def _get_unit_name(cls, unit)","id":10086,"name":"_get_unit_name","nodeType":"Function","startLoc":29,"text":"@classmethod\n    def _get_unit_name(cls, unit):\n        return unit.get_format_name('console')"},{"col":4,"comment":"null","endLoc":568,"header":"@classmethod\n    def _convert_superscript(cls, m)","id":10087,"name":"_convert_superscript","nodeType":"Function","startLoc":566,"text":"@classmethod\n    def _convert_superscript(cls, m):\n        return f'({m.group().translate(cls._superscript_translations)})'"},{"col":4,"comment":"null","endLoc":574,"header":"@classmethod\n    def _convert_deg(cls, m)","id":10088,"name":"_convert_deg","nodeType":"Function","startLoc":570,"text":"@classmethod\n    def _convert_deg(cls, m):\n        if len(m.string) == 1:\n            return 'deg'\n        return m.string.replace('°', 'deg_')"},{"col":4,"comment":"null","endLoc":605,"header":"@classmethod\n    def parse(cls, s, debug=False)","id":10089,"name":"parse","nodeType":"Function","startLoc":576,"text":"@classmethod\n    def parse(cls, s, debug=False):\n        if not isinstance(s, str):\n            s = s.decode('ascii')\n        elif not s.isascii():\n            # common normalization of unicode strings to avoid\n            # having to deal with multiple representations of\n            # the same character. This normalizes to \"composed\" form\n            # and will e.g. convert OHM SIGN to GREEK CAPITAL LETTER OMEGA\n            s = unicodedata.normalize('NFC', s)\n            # Translate some basic unicode items that we'd like to support on\n            # input but are not standard.\n            s = s.translate(cls._translations)\n\n            # TODO: might the below be better done in the parser/lexer?\n            # Translate superscripts to parenthesized numbers; this ensures\n            # that mixes of superscripts and regular numbers fail.\n            s = cls._regex_superscript.sub(cls._convert_superscript, s)\n            # Translate possible degrees.\n            s = cls._regex_deg.sub(cls._convert_deg, s)\n\n        result = cls._do_parse(s, debug=debug)\n        # Check for excess solidi, but exclude fractional exponents (accepted)\n        n_slashes = s.count('/')\n        if n_slashes > 1 and (n_slashes - len(re.findall(r'\\(\\d+/\\d+\\)', s))) > 1:\n            warnings.warn(\n                \"'{}' contains multiple slashes, which is \"\n                \"discouraged by the FITS standard\".format(s),\n                core.UnitsWarning)\n        return result"},{"col":4,"comment":"null","endLoc":35,"header":"@classmethod\n    def _format_superscript(cls, number)","id":10090,"name":"_format_superscript","nodeType":"Function","startLoc":33,"text":"@classmethod\n    def _format_superscript(cls, number):\n        return f'^{number}'"},{"col":4,"comment":"null","endLoc":48,"header":"@classmethod\n    def _format_unit_list(cls, units)","id":10091,"name":"_format_unit_list","nodeType":"Function","startLoc":37,"text":"@classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        for base, power in units:\n            if power == 1:\n                out.append(cls._get_unit_name(base))\n            else:\n                out.append('{}{}'.format(\n                    cls._get_unit_name(base),\n                    cls._format_superscript(\n                            utils.format_power(power))))\n        return ' '.join(out)"},{"attributeType":"null","col":8,"comment":"null","endLoc":219,"id":10092,"name":"decorator_kwargs","nodeType":"Attribute","startLoc":219,"text":"self.decorator_kwargs"},{"attributeType":"null","col":8,"comment":"null","endLoc":220,"id":10093,"name":"strict_dimensionless","nodeType":"Attribute","startLoc":220,"text":"self.strict_dimensionless"},{"attributeType":"null","col":8,"comment":"null","endLoc":218,"id":10094,"name":"equivalencies","nodeType":"Attribute","startLoc":218,"text":"self.equivalencies"},{"attributeType":"null","col":0,"comment":"null","endLoc":4,"id":10095,"name":"__all__","nodeType":"Attribute","startLoc":4,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":10096,"name":"NoneType","nodeType":"Attribute","startLoc":22,"text":"NoneType"},{"attributeType":"function","col":0,"comment":"null","endLoc":326,"id":10097,"name":"quantity_input","nodeType":"Attribute","startLoc":326,"text":"quantity_input"},{"col":4,"comment":"null","endLoc":624,"header":"@classmethod\n    def _get_unit_name(cls, unit)","id":10098,"name":"_get_unit_name","nodeType":"Function","startLoc":622,"text":"@classmethod\n    def _get_unit_name(cls, unit):\n        return unit.get_format_name('generic')"},{"col":4,"comment":"null","endLoc":640,"header":"@classmethod\n    def _format_unit_list(cls, units)","id":10099,"name":"_format_unit_list","nodeType":"Function","startLoc":626,"text":"@classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        units.sort(key=lambda x: cls._get_unit_name(x[0]).lower())\n\n        for base, power in units:\n            if power == 1:\n                out.append(cls._get_unit_name(base))\n            else:\n                power = utils.format_power(power)\n                if '/' in power or '.' in power:\n                    out.append(f'{cls._get_unit_name(base)}({power})')\n                else:\n                    out.append(f'{cls._get_unit_name(base)}{power}')\n        return ' '.join(out)"},{"col":4,"comment":"null","endLoc":450,"header":"def __rmul__(self, other)","id":10100,"name":"__rmul__","nodeType":"Function","startLoc":449,"text":"def __rmul__(self, other):\n        return self.__mul__(other)"},{"col":23,"endLoc":629,"id":10101,"nodeType":"Lambda","startLoc":629,"text":"lambda x: cls._get_unit_name(x[0]).lower()"},{"col":4,"comment":"null","endLoc":193,"header":"@classmethod\n    def _def_custom_unit(cls, unit)","id":10102,"name":"_def_custom_unit","nodeType":"Function","startLoc":163,"text":"@classmethod\n    def _def_custom_unit(cls, unit):\n        def def_base(name):\n            if name in cls._custom_units:\n                return cls._custom_units[name]\n\n            if name.startswith(\"'\"):\n                return core.def_unit(\n                    [name[1:-1], name],\n                    format={'vounit': name},\n                    namespace=cls._custom_units)\n            else:\n                return core.def_unit(\n                    name, namespace=cls._custom_units)\n\n        if unit in cls._custom_units:\n            return cls._custom_units[unit]\n\n        for short, full, factor in core.si_prefixes:\n            for prefix in short:\n                if unit.startswith(prefix):\n                    base_name = unit[len(prefix):]\n                    base_unit = def_base(base_name)\n                    return core.PrefixUnit(\n                        [prefix + x for x in base_unit.names],\n                        core.CompositeUnit(factor, [base_unit], [1],\n                                           _error_check=False),\n                        format={'vounit': prefix + base_unit.names[-1]},\n                        namespace=cls._custom_units)\n\n        return def_base(unit)"},{"attributeType":"null","col":4,"comment":"null","endLoc":65,"id":10104,"name":"_show_scale","nodeType":"Attribute","startLoc":65,"text":"_show_scale"},{"attributeType":"null","col":4,"comment":"null","endLoc":67,"id":10105,"name":"_tokens","nodeType":"Attribute","startLoc":67,"text":"_tokens"},{"col":0,"comment":"","endLoc":4,"header":"decorators.py#<anonymous>","id":10106,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['quantity_input']\n\nNoneType = type(None)\n\nquantity_input = QuantityInput.as_decorator"},{"attributeType":"null","col":4,"comment":"null","endLoc":513,"id":10107,"name":"_unit_symbols","nodeType":"Attribute","startLoc":513,"text":"_unit_symbols"},{"col":4,"comment":"null","endLoc":131,"header":"@classmethod\n    def _parse_unit(cls, unit, detailed_exception=True)","id":10108,"name":"_parse_unit","nodeType":"Function","startLoc":121,"text":"@classmethod\n    def _parse_unit(cls, unit, detailed_exception=True):\n        if unit not in cls._units:\n            raise ValueError()\n\n        if unit in cls._deprecated_units:\n            utils.unit_deprecation_warning(\n                unit, cls._units[unit], 'VOUnit',\n                cls._to_decomposed_alternative)\n\n        return cls._units[unit]"},{"col":4,"comment":"null","endLoc":61,"header":"@classmethod\n    def format_exponential_notation(cls, val)","id":10109,"name":"format_exponential_notation","nodeType":"Function","startLoc":50,"text":"@classmethod\n    def format_exponential_notation(cls, val):\n        m, ex = utils.split_mantissa_exponent(val)\n\n        parts = []\n        if m:\n            parts.append(m)\n\n        if ex:\n            parts.append(f\"10{cls._format_superscript(ex)}\")\n\n        return cls._times.join(parts)"},{"attributeType":"null","col":4,"comment":"null","endLoc":521,"id":10110,"name":"_prefixable_unit_symbols","nodeType":"Attribute","startLoc":521,"text":"_prefixable_unit_symbols"},{"col":4,"comment":"null","endLoc":462,"header":"def __truediv__(self, other)","id":10111,"name":"__truediv__","nodeType":"Function","startLoc":452,"text":"def __truediv__(self, other):\n        if isinstance(other, str):\n            try:\n                other = Unit(other, parse_strict='silent')\n            except Exception:\n                return NotImplemented\n\n        if isinstance(other, UnitBase):\n            new_units = tuple(part / other for part in self.values())\n            return self.__class__(new_units, names=self)\n        return NotImplemented"},{"col":4,"comment":"null","endLoc":161,"header":"@classmethod\n    def _get_unit_name(cls, unit)","id":10112,"name":"_get_unit_name","nodeType":"Function","startLoc":133,"text":"@classmethod\n    def _get_unit_name(cls, unit):\n        # The da- and d- prefixes are discouraged.  This has the\n        # effect of adding a scale to value in the result.\n        if isinstance(unit, core.PrefixUnit):\n            if unit._represents.scale == 10.0:\n                raise ValueError(\n                    \"In '{}': VOUnit can not represent units with the 'da' \"\n                    \"(deka) prefix\".format(unit))\n            elif unit._represents.scale == 0.1:\n                raise ValueError(\n                    \"In '{}': VOUnit can not represent units with the 'd' \"\n                    \"(deci) prefix\".format(unit))\n\n        name = unit.get_format_name('vounit')\n\n        if unit in cls._custom_units.values():\n            return name\n\n        if name not in cls._units:\n            raise ValueError(\n                f\"Unit {name!r} is not part of the VOUnit standard\")\n\n        if name in cls._deprecated_units:\n            utils.unit_deprecation_warning(\n                name, unit, 'VOUnit',\n                cls._to_decomposed_alternative)\n\n        return name"},{"attributeType":"null","col":4,"comment":"null","endLoc":527,"id":10113,"name":"_unit_suffix_symbols","nodeType":"Attribute","startLoc":527,"text":"_unit_suffix_symbols"},{"attributeType":"null","col":4,"comment":"Character translations that should be applied before parsing a string.\n\n    Note that this does explicitly *not* generally translate MICRO SIGN to u,\n    since then a string like 'µ' would be interpreted as unit mass.\n    ","endLoc":537,"id":10114,"name":"_translations","nodeType":"Attribute","startLoc":537,"text":"_translations"},{"attributeType":"null","col":4,"comment":"null","endLoc":547,"id":10115,"name":"_superscripts","nodeType":"Attribute","startLoc":547,"text":"_superscripts"},{"fileName":"latex.py","filePath":"astropy/units/format","id":10116,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nHandles the \"LaTeX\" unit format.\n\"\"\"\n\nimport re\n\nimport numpy as np\n\nfrom . import base, core, utils\n\n\nclass Latex(base.Base):\n    \"\"\"\n    Output LaTeX to display the unit based on IAU style guidelines.\n\n    Attempts to follow the `IAU Style Manual\n    <https://www.iau.org/static/publications/stylemanual1989.pdf>`_.\n    \"\"\"\n\n    @classmethod\n    def _latex_escape(cls, name):\n        # This doesn't escape arbitrary LaTeX strings, but it should\n        # be good enough for unit names which are required to be alpha\n        # + \"_\" anyway.\n        return name.replace('_', r'\\_')\n\n    @classmethod\n    def _get_unit_name(cls, unit):\n        name = unit.get_format_name('latex')\n        if name == unit.name:\n            return cls._latex_escape(name)\n        return name\n\n    @classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        for base, power in units:\n            base_latex = cls._get_unit_name(base)\n            if power == 1:\n                out.append(base_latex)\n            else:\n                # If the LaTeX representation of the base unit already ends with\n                # a superscript, we need to spell out the unit to avoid double\n                # superscripts. For example, the logic below ensures that\n                # `u.deg**2` returns `deg^{2}` instead of `{}^{\\circ}^{2}`.\n                if re.match(r\".*\\^{[^}]*}$\", base_latex): # ends w/ superscript?\n                    base_latex = base.short_names[0]\n                out.append(f'{base_latex}^{{{utils.format_power(power)}}}')\n        return r'\\,'.join(out)\n\n    @classmethod\n    def _format_bases(cls, unit):\n        positives, negatives = utils.get_grouped_by_powers(\n                unit.bases, unit.powers)\n\n        if len(negatives):\n            if len(positives):\n                positives = cls._format_unit_list(positives)\n            else:\n                positives = '1'\n            negatives = cls._format_unit_list(negatives)\n            s = fr'\\frac{{{positives}}}{{{negatives}}}'\n        else:\n            positives = cls._format_unit_list(positives)\n            s = positives\n\n        return s\n\n    @classmethod\n    def to_string(cls, unit):\n        latex_name = None\n        if hasattr(unit, '_format'):\n            latex_name = unit._format.get('latex')\n\n        if latex_name is not None:\n            s = latex_name\n        elif isinstance(unit, core.CompositeUnit):\n            if unit.scale == 1:\n                s = ''\n            else:\n                s = cls.format_exponential_notation(unit.scale) + r'\\,'\n\n            if len(unit.bases):\n                s += cls._format_bases(unit)\n\n        elif isinstance(unit, core.NamedUnit):\n            s = cls._latex_escape(unit.name)\n\n        return fr'$\\mathrm{{{s}}}$'\n\n    @classmethod\n    def format_exponential_notation(cls, val, format_spec=\".8g\"):\n        \"\"\"\n        Formats a value in exponential notation for LaTeX.\n\n        Parameters\n        ----------\n        val : number\n            The value to be formatted\n\n        format_spec : str, optional\n            Format used to split up mantissa and exponent\n\n        Returns\n        -------\n        latex_string : str\n            The value in exponential notation in a format suitable for LaTeX.\n        \"\"\"\n        if np.isfinite(val):\n            m, ex = utils.split_mantissa_exponent(val, format_spec)\n\n            parts = []\n            if m:\n                parts.append(m)\n            if ex:\n                parts.append(f\"10^{{{ex}}}\")\n\n            return r\" \\times \".join(parts)\n        else:\n            if np.isnan(val):\n                return r'{\\rm NaN}'\n            elif val > 0:\n                # positive infinity\n                return r'\\infty'\n            else:\n                # negative infinity\n                return r'-\\infty'\n\n\nclass LatexInline(Latex):\n    \"\"\"\n    Output LaTeX to display the unit based on IAU style guidelines with negative\n    powers.\n\n    Attempts to follow the `IAU Style Manual\n    <https://www.iau.org/static/publications/stylemanual1989.pdf>`_ and the\n    `ApJ and AJ style guide\n    <https://journals.aas.org/manuscript-preparation/>`_.\n    \"\"\"\n    name = 'latex_inline'\n\n    @classmethod\n    def _format_bases(cls, unit):\n        return cls._format_unit_list(zip(unit.bases, unit.powers))\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":562,"id":10117,"name":"_superscript_translations","nodeType":"Attribute","startLoc":562,"text":"_superscript_translations"},{"className":"Latex","col":0,"comment":"\n    Output LaTeX to display the unit based on IAU style guidelines.\n\n    Attempts to follow the `IAU Style Manual\n    <https://www.iau.org/static/publications/stylemanual1989.pdf>`_.\n    ","endLoc":129,"id":10118,"nodeType":"Class","startLoc":14,"text":"class Latex(base.Base):\n    \"\"\"\n    Output LaTeX to display the unit based on IAU style guidelines.\n\n    Attempts to follow the `IAU Style Manual\n    <https://www.iau.org/static/publications/stylemanual1989.pdf>`_.\n    \"\"\"\n\n    @classmethod\n    def _latex_escape(cls, name):\n        # This doesn't escape arbitrary LaTeX strings, but it should\n        # be good enough for unit names which are required to be alpha\n        # + \"_\" anyway.\n        return name.replace('_', r'\\_')\n\n    @classmethod\n    def _get_unit_name(cls, unit):\n        name = unit.get_format_name('latex')\n        if name == unit.name:\n            return cls._latex_escape(name)\n        return name\n\n    @classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        for base, power in units:\n            base_latex = cls._get_unit_name(base)\n            if power == 1:\n                out.append(base_latex)\n            else:\n                # If the LaTeX representation of the base unit already ends with\n                # a superscript, we need to spell out the unit to avoid double\n                # superscripts. For example, the logic below ensures that\n                # `u.deg**2` returns `deg^{2}` instead of `{}^{\\circ}^{2}`.\n                if re.match(r\".*\\^{[^}]*}$\", base_latex): # ends w/ superscript?\n                    base_latex = base.short_names[0]\n                out.append(f'{base_latex}^{{{utils.format_power(power)}}}')\n        return r'\\,'.join(out)\n\n    @classmethod\n    def _format_bases(cls, unit):\n        positives, negatives = utils.get_grouped_by_powers(\n                unit.bases, unit.powers)\n\n        if len(negatives):\n            if len(positives):\n                positives = cls._format_unit_list(positives)\n            else:\n                positives = '1'\n            negatives = cls._format_unit_list(negatives)\n            s = fr'\\frac{{{positives}}}{{{negatives}}}'\n        else:\n            positives = cls._format_unit_list(positives)\n            s = positives\n\n        return s\n\n    @classmethod\n    def to_string(cls, unit):\n        latex_name = None\n        if hasattr(unit, '_format'):\n            latex_name = unit._format.get('latex')\n\n        if latex_name is not None:\n            s = latex_name\n        elif isinstance(unit, core.CompositeUnit):\n            if unit.scale == 1:\n                s = ''\n            else:\n                s = cls.format_exponential_notation(unit.scale) + r'\\,'\n\n            if len(unit.bases):\n                s += cls._format_bases(unit)\n\n        elif isinstance(unit, core.NamedUnit):\n            s = cls._latex_escape(unit.name)\n\n        return fr'$\\mathrm{{{s}}}$'\n\n    @classmethod\n    def format_exponential_notation(cls, val, format_spec=\".8g\"):\n        \"\"\"\n        Formats a value in exponential notation for LaTeX.\n\n        Parameters\n        ----------\n        val : number\n            The value to be formatted\n\n        format_spec : str, optional\n            Format used to split up mantissa and exponent\n\n        Returns\n        -------\n        latex_string : str\n            The value in exponential notation in a format suitable for LaTeX.\n        \"\"\"\n        if np.isfinite(val):\n            m, ex = utils.split_mantissa_exponent(val, format_spec)\n\n            parts = []\n            if m:\n                parts.append(m)\n            if ex:\n                parts.append(f\"10^{{{ex}}}\")\n\n            return r\" \\times \".join(parts)\n        else:\n            if np.isnan(val):\n                return r'{\\rm NaN}'\n            elif val > 0:\n                # positive infinity\n                return r'\\infty'\n            else:\n                # negative infinity\n                return r'-\\infty'"},{"attributeType":"null","col":4,"comment":"null","endLoc":563,"id":10119,"name":"_regex_superscript","nodeType":"Attribute","startLoc":563,"text":"_regex_superscript"},{"attributeType":"null","col":4,"comment":"null","endLoc":564,"id":10120,"name":"_regex_deg","nodeType":"Attribute","startLoc":564,"text":"_regex_deg"},{"col":4,"comment":"null","endLoc":112,"header":"@staticmethod\n    def _generate_unit_names()","id":10121,"name":"_generate_unit_names","nodeType":"Function","startLoc":54,"text":"@staticmethod\n    def _generate_unit_names():\n\n        from astropy import units as u\n        names = {}\n        deprecated_names = set()\n\n        bases = [\n            'A', 'C', 'cd', 'eV', 'F', 'g', 'H', 'Hz', 'J',\n            'Jy', 'K', 'lm', 'lx', 'm', 'mol', 'N', 'ohm', 'Pa',\n            'pc', 'rad', 's', 'S', 'sr', 'T', 'V', 'W', 'Wb'\n        ]\n        deprecated_bases = []\n        prefixes = [\n            'y', 'z', 'a', 'f', 'p', 'n', 'u', 'm', 'c', 'd',\n            '', 'da', 'h', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'\n        ]\n\n        for base in bases + deprecated_bases:\n            for prefix in prefixes:\n                key = prefix + base\n                if keyword.iskeyword(key):\n                    continue\n                names[key] = getattr(u, key)\n        for base in deprecated_bases:\n            for prefix in prefixes:\n                deprecated_names.add(prefix + base)\n\n        simple_units = [\n            'angstrom', 'arcmin', 'arcsec', 'AU', 'barn', 'bin',\n            'byte', 'chan', 'count', 'day', 'deg', 'erg', 'G',\n            'h', 'lyr', 'mag', 'min', 'photon', 'pixel',\n            'voxel', 'yr'\n        ]\n        for unit in simple_units:\n            names[unit] = getattr(u, unit)\n\n        # Create a separate, disconnected unit for the special case of\n        # Crab and mCrab, since OGIP doesn't define their quantities.\n        Crab = u.def_unit(['Crab'], prefixes=False, doc='Crab (X-ray flux)')\n        mCrab = u.Unit(10 ** -3 * Crab)\n        names['Crab'] = Crab\n        names['mCrab'] = mCrab\n\n        deprecated_units = ['Crab', 'mCrab']\n        for unit in deprecated_units:\n            deprecated_names.add(unit)\n\n        # Define the function names, so we can parse them, even though\n        # we can't use any of them (other than sqrt) meaningfully for\n        # now.\n        functions = [\n            'log', 'ln', 'exp', 'sqrt', 'sin', 'cos', 'tan', 'asin',\n            'acos', 'atan', 'sinh', 'cosh', 'tanh'\n        ]\n        for name in functions:\n            names[name] = name\n\n        return names, deprecated_names, functions"},{"className":"LatexInline","col":0,"comment":"\n    Output LaTeX to display the unit based on IAU style guidelines with negative\n    powers.\n\n    Attempts to follow the `IAU Style Manual\n    <https://www.iau.org/static/publications/stylemanual1989.pdf>`_ and the\n    `ApJ and AJ style guide\n    <https://journals.aas.org/manuscript-preparation/>`_.\n    ","endLoc":146,"id":10122,"nodeType":"Class","startLoc":132,"text":"class LatexInline(Latex):\n    \"\"\"\n    Output LaTeX to display the unit based on IAU style guidelines with negative\n    powers.\n\n    Attempts to follow the `IAU Style Manual\n    <https://www.iau.org/static/publications/stylemanual1989.pdf>`_ and the\n    `ApJ and AJ style guide\n    <https://journals.aas.org/manuscript-preparation/>`_.\n    \"\"\"\n    name = 'latex_inline'\n\n    @classmethod\n    def _format_bases(cls, unit):\n        return cls._format_unit_list(zip(unit.bases, unit.powers))"},{"col":4,"comment":"null","endLoc":146,"header":"@classmethod\n    def _format_bases(cls, unit)","id":10123,"name":"_format_bases","nodeType":"Function","startLoc":144,"text":"@classmethod\n    def _format_bases(cls, unit):\n        return cls._format_unit_list(zip(unit.bases, unit.powers))"},{"col":4,"comment":"null","endLoc":97,"header":"@classmethod\n    def to_string(cls, unit)","id":10124,"name":"to_string","nodeType":"Function","startLoc":63,"text":"@classmethod\n    def to_string(cls, unit):\n        if isinstance(unit, core.CompositeUnit):\n            if unit.scale == 1:\n                s = ''\n            else:\n                s = cls.format_exponential_notation(unit.scale)\n\n            if len(unit.bases):\n                positives, negatives = utils.get_grouped_by_powers(\n                    unit.bases, unit.powers)\n                if len(negatives):\n                    if len(positives):\n                        positives = cls._format_unit_list(positives)\n                    else:\n                        positives = '1'\n                    negatives = cls._format_unit_list(negatives)\n                    l = len(s)\n                    r = max(len(positives), len(negatives))\n                    f = f\"{{0:^{l}s}} {{1:^{r}s}}\"\n\n                    lines = [\n                        f.format('', positives),\n                        f.format(s, cls._line * r),\n                        f.format('', negatives)\n                    ]\n\n                    s = '\\n'.join(lines)\n                else:\n                    positives = cls._format_unit_list(positives)\n                    s += positives\n        elif isinstance(unit, core.NamedUnit):\n            s = cls._get_unit_name(unit)\n\n        return s"},{"col":4,"comment":"null","endLoc":209,"header":"@classmethod\n    def _format_unit_list(cls, units)","id":10125,"name":"_format_unit_list","nodeType":"Function","startLoc":195,"text":"@classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        units.sort(key=lambda x: cls._get_unit_name(x[0]).lower())\n\n        for base, power in units:\n            if power == 1:\n                out.append(cls._get_unit_name(base))\n            else:\n                power = utils.format_power(power)\n                if '/' in power or '.' in power:\n                    out.append(f'{cls._get_unit_name(base)}({power})')\n                else:\n                    out.append(f'{cls._get_unit_name(base)}**{power}')\n        return '.'.join(out)"},{"col":23,"endLoc":198,"id":10126,"nodeType":"Lambda","startLoc":198,"text":"lambda x: cls._get_unit_name(x[0]).lower()"},{"attributeType":"null","col":4,"comment":"null","endLoc":142,"id":10127,"name":"name","nodeType":"Attribute","startLoc":142,"text":"name"},{"col":4,"comment":"null","endLoc":167,"header":"@classmethod\n    def _make_lexer(cls)","id":10128,"name":"_make_lexer","nodeType":"Function","startLoc":114,"text":"@classmethod\n    def _make_lexer(cls):\n        tokens = cls._tokens\n\n        t_DIVISION = r'/'\n        t_OPEN_PAREN = r'\\('\n        t_CLOSE_PAREN = r'\\)'\n        t_WHITESPACE = '[ \\t]+'\n        t_STARSTAR = r'\\*\\*'\n        t_STAR = r'\\*'\n\n        # NOTE THE ORDERING OF THESE RULES IS IMPORTANT!!\n        # Regular expression rules for simple tokens\n        def t_UFLOAT(t):\n            r'(((\\d+\\.?\\d*)|(\\.\\d+))([eE][+-]?\\d+))|(((\\d+\\.\\d*)|(\\.\\d+))([eE][+-]?\\d+)?)'\n            t.value = float(t.value)\n            return t\n\n        def t_UINT(t):\n            r'\\d+'\n            t.value = int(t.value)\n            return t\n\n        def t_SIGN(t):\n            r'[+-](?=\\d)'\n            t.value = float(t.value + '1')\n            return t\n\n        def t_X(t):  # multiplication for factor in front of unit\n            r'[x×]'\n            return t\n\n        def t_LIT10(t):\n            r'10'\n            return 10\n\n        def t_UNKNOWN(t):\n            r'[Uu][Nn][Kk][Nn][Oo][Ww][Nn]'\n            return None\n\n        def t_UNIT(t):\n            r'[a-zA-Z][a-zA-Z_]*'\n            t.value = cls._get_unit(t)\n            return t\n\n        # Don't ignore whitespace\n        t_ignore = ''\n\n        # Error handling rule\n        def t_error(t):\n            raise ValueError(\n                f\"Invalid character at col {t.lexpos}\")\n\n        return parsing.lex(lextab='ogip_lextab', package='astropy/units')"},{"col":0,"comment":"","endLoc":5,"header":"latex.py#<anonymous>","id":10129,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nHandles the \"LaTeX\" unit format.\n\"\"\""},{"fileName":"cds.py","filePath":"astropy/units/format","id":10130,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICNSE.rst\n\n# This module includes files automatically generated from ply (these end in\n# _lextab.py and _parsetab.py). To generate these files, remove them from this\n# folder, then build astropy and run the tests in-place:\n#\n#   python setup.py build_ext --inplace\n#   pytest astropy/units\n#\n# You can then commit the changes to the re-generated _lextab.py and\n# _parsetab.py files.\n\n\"\"\"\nHandles the CDS string format for units\n\"\"\"\n\n\nimport operator\nimport os\nimport re\n\n\nfrom .base import Base\nfrom . import core, utils\nfrom astropy.units.utils import is_effectively_unity\nfrom astropy.utils import classproperty, parsing\nfrom astropy.utils.misc import did_you_mean\n\n\n# TODO: Support logarithmic units using bracketed syntax\n\nclass CDS(Base):\n    \"\"\"\n    Support the `Centre de Données astronomiques de Strasbourg\n    <http://cds.u-strasbg.fr/>`_ `Standards for Astronomical\n    Catalogues 2.0 <http://vizier.u-strasbg.fr/vizier/doc/catstd-3.2.htx>`_\n    format, and the `complete set of supported units\n    <https://vizier.u-strasbg.fr/viz-bin/Unit>`_.  This format is used\n    by VOTable up to version 1.2.\n    \"\"\"\n\n    _tokens = (\n        'PRODUCT',\n        'DIVISION',\n        'OPEN_PAREN',\n        'CLOSE_PAREN',\n        'OPEN_BRACKET',\n        'CLOSE_BRACKET',\n        'X',\n        'SIGN',\n        'UINT',\n        'UFLOAT',\n        'UNIT',\n        'DIMENSIONLESS'\n    )\n\n    @classproperty(lazy=True)\n    def _units(cls):\n        return cls._generate_unit_names()\n\n    @classproperty(lazy=True)\n    def _parser(cls):\n        return cls._make_parser()\n\n    @classproperty(lazy=True)\n    def _lexer(cls):\n        return cls._make_lexer()\n\n    @staticmethod\n    def _generate_unit_names():\n        from astropy.units import cds\n        from astropy import units as u\n\n        names = {}\n\n        for key, val in cds.__dict__.items():\n            if isinstance(val, u.UnitBase):\n                names[key] = val\n\n        return names\n\n    @classmethod\n    def _make_lexer(cls):\n        tokens = cls._tokens\n\n        t_PRODUCT = r'\\.'\n        t_DIVISION = r'/'\n        t_OPEN_PAREN = r'\\('\n        t_CLOSE_PAREN = r'\\)'\n        t_OPEN_BRACKET = r'\\['\n        t_CLOSE_BRACKET = r'\\]'\n\n        # NOTE THE ORDERING OF THESE RULES IS IMPORTANT!!\n        # Regular expression rules for simple tokens\n\n        def t_UFLOAT(t):\n            r'((\\d+\\.?\\d+)|(\\.\\d+))([eE][+-]?\\d+)?'\n            if not re.search(r'[eE\\.]', t.value):\n                t.type = 'UINT'\n                t.value = int(t.value)\n            else:\n                t.value = float(t.value)\n            return t\n\n        def t_UINT(t):\n            r'\\d+'\n            t.value = int(t.value)\n            return t\n\n        def t_SIGN(t):\n            r'[+-](?=\\d)'\n            t.value = float(t.value + '1')\n            return t\n\n        def t_X(t):  # multiplication for factor in front of unit\n            r'[x×]'\n            return t\n\n        def t_UNIT(t):\n            r'\\%|°|\\\\h|((?!\\d)\\w)+'\n            t.value = cls._get_unit(t)\n            return t\n\n        def t_DIMENSIONLESS(t):\n            r'---|-'\n            # These are separate from t_UNIT since they cannot have a prefactor.\n            t.value = cls._get_unit(t)\n            return t\n\n        t_ignore = ''\n\n        # Error handling rule\n        def t_error(t):\n            raise ValueError(\n                f\"Invalid character at col {t.lexpos}\")\n\n        return parsing.lex(lextab='cds_lextab', package='astropy/units',\n                           reflags=int(re.UNICODE))\n\n    @classmethod\n    def _make_parser(cls):\n        \"\"\"\n        The grammar here is based on the description in the `Standards\n        for Astronomical Catalogues 2.0\n        <http://vizier.u-strasbg.fr/vizier/doc/catstd-3.2.htx>`_, which is not\n        terribly precise.  The exact grammar is here is based on the\n        YACC grammar in the `unity library\n        <https://bitbucket.org/nxg/unity/>`_.\n        \"\"\"\n\n        tokens = cls._tokens\n\n        def p_main(p):\n            '''\n            main : factor combined_units\n                 | combined_units\n                 | DIMENSIONLESS\n                 | OPEN_BRACKET combined_units CLOSE_BRACKET\n                 | OPEN_BRACKET DIMENSIONLESS CLOSE_BRACKET\n                 | factor\n            '''\n            from astropy.units.core import Unit\n            from astropy.units import dex\n            if len(p) == 3:\n                p[0] = Unit(p[1] * p[2])\n            elif len(p) == 4:\n                p[0] = dex(p[2])\n            else:\n                p[0] = Unit(p[1])\n\n        def p_combined_units(p):\n            '''\n            combined_units : product_of_units\n                           | division_of_units\n            '''\n            p[0] = p[1]\n\n        def p_product_of_units(p):\n            '''\n            product_of_units : unit_expression PRODUCT combined_units\n                             | unit_expression\n            '''\n            if len(p) == 4:\n                p[0] = p[1] * p[3]\n            else:\n                p[0] = p[1]\n\n        def p_division_of_units(p):\n            '''\n            division_of_units : DIVISION unit_expression\n                              | unit_expression DIVISION combined_units\n            '''\n            if len(p) == 3:\n                p[0] = p[2] ** -1\n            else:\n                p[0] = p[1] / p[3]\n\n        def p_unit_expression(p):\n            '''\n            unit_expression : unit_with_power\n                            | OPEN_PAREN combined_units CLOSE_PAREN\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = p[2]\n\n        def p_factor(p):\n            '''\n            factor : signed_float X UINT signed_int\n                   | UINT X UINT signed_int\n                   | UINT signed_int\n                   | UINT\n                   | signed_float\n            '''\n            if len(p) == 5:\n                if p[3] != 10:\n                    raise ValueError(\n                        \"Only base ten exponents are allowed in CDS\")\n                p[0] = p[1] * 10.0 ** p[4]\n            elif len(p) == 3:\n                if p[1] != 10:\n                    raise ValueError(\n                        \"Only base ten exponents are allowed in CDS\")\n                p[0] = 10.0 ** p[2]\n            elif len(p) == 2:\n                p[0] = p[1]\n\n        def p_unit_with_power(p):\n            '''\n            unit_with_power : UNIT numeric_power\n                            | UNIT\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = p[1] ** p[2]\n\n        def p_numeric_power(p):\n            '''\n            numeric_power : sign UINT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_sign(p):\n            '''\n            sign : SIGN\n                 |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1.0\n\n        def p_signed_int(p):\n            '''\n            signed_int : SIGN UINT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_signed_float(p):\n            '''\n            signed_float : sign UINT\n                         | sign UFLOAT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_error(p):\n            raise ValueError()\n\n        return parsing.yacc(tabmodule='cds_parsetab', package='astropy/units')\n\n    @classmethod\n    def _get_unit(cls, t):\n        try:\n            return cls._parse_unit(t.value)\n        except ValueError as e:\n            registry = core.get_current_unit_registry()\n            if t.value in registry.aliases:\n                return registry.aliases[t.value]\n\n            raise ValueError(\n                f\"At col {t.lexpos}, {str(e)}\")\n\n    @classmethod\n    def _parse_unit(cls, unit, detailed_exception=True):\n        if unit not in cls._units:\n            if detailed_exception:\n                raise ValueError(\n                    \"Unit '{}' not supported by the CDS SAC \"\n                    \"standard. {}\".format(\n                        unit, did_you_mean(\n                            unit, cls._units)))\n            else:\n                raise ValueError()\n\n        return cls._units[unit]\n\n    @classmethod\n    def parse(cls, s, debug=False):\n        if ' ' in s:\n            raise ValueError('CDS unit must not contain whitespace')\n\n        if not isinstance(s, str):\n            s = s.decode('ascii')\n\n        # This is a short circuit for the case where the string\n        # is just a single unit name\n        try:\n            return cls._parse_unit(s, detailed_exception=False)\n        except ValueError:\n            try:\n                return cls._parser.parse(s, lexer=cls._lexer, debug=debug)\n            except ValueError as e:\n                if str(e):\n                    raise ValueError(str(e))\n                else:\n                    raise ValueError(\"Syntax error\")\n\n    @staticmethod\n    def _get_unit_name(unit):\n        return unit.get_format_name('cds')\n\n    @classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        for base, power in units:\n            if power == 1:\n                out.append(cls._get_unit_name(base))\n            else:\n                out.append(f'{cls._get_unit_name(base)}{int(power)}')\n        return '.'.join(out)\n\n    @classmethod\n    def to_string(cls, unit):\n        # Remove units that aren't known to the format\n        unit = utils.decompose_to_known_units(unit, cls._get_unit_name)\n\n        if isinstance(unit, core.CompositeUnit):\n            if unit == core.dimensionless_unscaled:\n                return '---'\n            elif is_effectively_unity(unit.scale*100.):\n                return '%'\n\n            if unit.scale == 1:\n                s = ''\n            else:\n                m, e = utils.split_mantissa_exponent(unit.scale)\n                parts = []\n                if m not in ('', '1'):\n                    parts.append(m)\n                if e:\n                    if not e.startswith('-'):\n                        e = \"+\" + e\n                    parts.append(f'10{e}')\n                s = 'x'.join(parts)\n\n            pairs = list(zip(unit.bases, unit.powers))\n            if len(pairs) > 0:\n                pairs.sort(key=operator.itemgetter(1), reverse=True)\n\n                s += cls._format_unit_list(pairs)\n\n        elif isinstance(unit, core.NamedUnit):\n            s = cls._get_unit_name(unit)\n\n        return s\n"},{"col":4,"comment":"null","endLoc":236,"header":"@classmethod\n    def to_string(cls, unit)","id":10131,"name":"to_string","nodeType":"Function","startLoc":211,"text":"@classmethod\n    def to_string(cls, unit):\n        from astropy.units import core\n\n        # Remove units that aren't known to the format\n        unit = utils.decompose_to_known_units(unit, cls._get_unit_name)\n\n        if isinstance(unit, core.CompositeUnit):\n            if unit.physical_type == 'dimensionless' and unit.scale != 1:\n                raise core.UnitScaleError(\n                    \"The VOUnit format is not able to \"\n                    \"represent scale for dimensionless units. \"\n                    \"Multiply your data by {:e}.\"\n                    .format(unit.scale))\n            s = ''\n            if unit.scale != 1:\n                s += f'{unit.scale:.8g}'\n\n            pairs = list(zip(unit.bases, unit.powers))\n            pairs.sort(key=operator.itemgetter(1), reverse=True)\n\n            s += cls._format_unit_list(pairs)\n        elif isinstance(unit, core.NamedUnit):\n            s = cls._get_unit_name(unit)\n\n        return s"},{"col":4,"comment":"\n        The grammar here is based on the description in the\n        `Specification of Physical Units within OGIP FITS files\n        <https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/general/ogip_93_001/>`__,\n        which is not terribly precise.  The exact grammar is here is\n        based on the YACC grammar in the `unity library\n        <https://bitbucket.org/nxg/unity/>`_.\n        ","endLoc":352,"header":"@classmethod\n    def _make_parser(cls)","id":10132,"name":"_make_parser","nodeType":"Function","startLoc":169,"text":"@classmethod\n    def _make_parser(cls):\n        \"\"\"\n        The grammar here is based on the description in the\n        `Specification of Physical Units within OGIP FITS files\n        <https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/general/ogip_93_001/>`__,\n        which is not terribly precise.  The exact grammar is here is\n        based on the YACC grammar in the `unity library\n        <https://bitbucket.org/nxg/unity/>`_.\n        \"\"\"\n\n        tokens = cls._tokens\n\n        def p_main(p):\n            '''\n            main : UNKNOWN\n                 | complete_expression\n                 | scale_factor complete_expression\n                 | scale_factor WHITESPACE complete_expression\n            '''\n            if len(p) == 4:\n                p[0] = p[1] * p[3]\n            elif len(p) == 3:\n                p[0] = p[1] * p[2]\n            else:\n                p[0] = p[1]\n\n        def p_complete_expression(p):\n            '''\n            complete_expression : product_of_units\n            '''\n            p[0] = p[1]\n\n        def p_product_of_units(p):\n            '''\n            product_of_units : unit_expression\n                             | division unit_expression\n                             | product_of_units product unit_expression\n                             | product_of_units division unit_expression\n            '''\n            if len(p) == 4:\n                if p[2] == 'DIVISION':\n                    p[0] = p[1] / p[3]\n                else:\n                    p[0] = p[1] * p[3]\n            elif len(p) == 3:\n                p[0] = p[2] ** -1\n            else:\n                p[0] = p[1]\n\n        def p_unit_expression(p):\n            '''\n            unit_expression : unit\n                            | UNIT OPEN_PAREN complete_expression CLOSE_PAREN\n                            | OPEN_PAREN complete_expression CLOSE_PAREN\n                            | UNIT OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power\n                            | OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power\n            '''\n\n            # If we run p[1] in cls._functions, it will try and parse each\n            # item in the list into a unit, which is slow. Since we know that\n            # all the items in the list are strings, we can simply convert\n            # p[1] to a string instead.\n            p1_str = str(p[1])\n\n            if p1_str in cls._functions and p1_str != 'sqrt':\n                raise ValueError(\n                    \"The function '{}' is valid in OGIP, but not understood \"\n                    \"by astropy.units.\".format(\n                        p[1]))\n\n            if len(p) == 7:\n                if p1_str == 'sqrt':\n                    p[0] = p[1] * p[3] ** (0.5 * p[6])\n                else:\n                    p[0] = p[1] * p[3] ** p[6]\n            elif len(p) == 6:\n                p[0] = p[2] ** p[5]\n            elif len(p) == 5:\n                if p1_str == 'sqrt':\n                    p[0] = p[3] ** 0.5\n                else:\n                    p[0] = p[1] * p[3]\n            elif len(p) == 4:\n                p[0] = p[2]\n            else:\n                p[0] = p[1]\n\n        def p_scale_factor(p):\n            '''\n            scale_factor : LIT10 power numeric_power\n                         | LIT10\n                         | signed_float\n                         | signed_float power numeric_power\n                         | signed_int power numeric_power\n            '''\n            if len(p) == 4:\n                p[0] = 10 ** p[3]\n            else:\n                p[0] = p[1]\n            # Can't use np.log10 here, because p[0] may be a Python long.\n            if math.log10(p[0]) % 1.0 != 0.0:\n                from astropy.units.core import UnitsWarning\n                warnings.warn(\n                    \"'{}' scale should be a power of 10 in \"\n                    \"OGIP format\".format(p[0]), UnitsWarning)\n\n        def p_division(p):\n            '''\n            division : DIVISION\n                     | WHITESPACE DIVISION\n                     | WHITESPACE DIVISION WHITESPACE\n                     | DIVISION WHITESPACE\n            '''\n            p[0] = 'DIVISION'\n\n        def p_product(p):\n            '''\n            product : WHITESPACE\n                    | STAR\n                    | WHITESPACE STAR\n                    | WHITESPACE STAR WHITESPACE\n                    | STAR WHITESPACE\n            '''\n            p[0] = 'PRODUCT'\n\n        def p_power(p):\n            '''\n            power : STARSTAR\n            '''\n            p[0] = 'POWER'\n\n        def p_unit(p):\n            '''\n            unit : UNIT\n                 | UNIT power numeric_power\n            '''\n            if len(p) == 4:\n                p[0] = p[1] ** p[3]\n            else:\n                p[0] = p[1]\n\n        def p_numeric_power(p):\n            '''\n            numeric_power : UINT\n                          | signed_float\n                          | OPEN_PAREN signed_int CLOSE_PAREN\n                          | OPEN_PAREN signed_float CLOSE_PAREN\n                          | OPEN_PAREN signed_float division UINT CLOSE_PAREN\n            '''\n            if len(p) == 6:\n                p[0] = Fraction(int(p[2]), int(p[4]))\n            elif len(p) == 4:\n                p[0] = p[2]\n            else:\n                p[0] = p[1]\n\n        def p_sign(p):\n            '''\n            sign : SIGN\n                 |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1.0\n\n        def p_signed_int(p):\n            '''\n            signed_int : SIGN UINT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_signed_float(p):\n            '''\n            signed_float : sign UINT\n                         | sign UFLOAT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_error(p):\n            raise ValueError()\n\n        return parsing.yacc(tabmodule='ogip_parsetab', package='astropy/units')"},{"className":"CDS","col":0,"comment":"\n    Support the `Centre de Données astronomiques de Strasbourg\n    <http://cds.u-strasbg.fr/>`_ `Standards for Astronomical\n    Catalogues 2.0 <http://vizier.u-strasbg.fr/vizier/doc/catstd-3.2.htx>`_\n    format, and the `complete set of supported units\n    <https://vizier.u-strasbg.fr/viz-bin/Unit>`_.  This format is used\n    by VOTable up to version 1.2.\n    ","endLoc":368,"id":10133,"nodeType":"Class","startLoc":33,"text":"class CDS(Base):\n    \"\"\"\n    Support the `Centre de Données astronomiques de Strasbourg\n    <http://cds.u-strasbg.fr/>`_ `Standards for Astronomical\n    Catalogues 2.0 <http://vizier.u-strasbg.fr/vizier/doc/catstd-3.2.htx>`_\n    format, and the `complete set of supported units\n    <https://vizier.u-strasbg.fr/viz-bin/Unit>`_.  This format is used\n    by VOTable up to version 1.2.\n    \"\"\"\n\n    _tokens = (\n        'PRODUCT',\n        'DIVISION',\n        'OPEN_PAREN',\n        'CLOSE_PAREN',\n        'OPEN_BRACKET',\n        'CLOSE_BRACKET',\n        'X',\n        'SIGN',\n        'UINT',\n        'UFLOAT',\n        'UNIT',\n        'DIMENSIONLESS'\n    )\n\n    @classproperty(lazy=True)\n    def _units(cls):\n        return cls._generate_unit_names()\n\n    @classproperty(lazy=True)\n    def _parser(cls):\n        return cls._make_parser()\n\n    @classproperty(lazy=True)\n    def _lexer(cls):\n        return cls._make_lexer()\n\n    @staticmethod\n    def _generate_unit_names():\n        from astropy.units import cds\n        from astropy import units as u\n\n        names = {}\n\n        for key, val in cds.__dict__.items():\n            if isinstance(val, u.UnitBase):\n                names[key] = val\n\n        return names\n\n    @classmethod\n    def _make_lexer(cls):\n        tokens = cls._tokens\n\n        t_PRODUCT = r'\\.'\n        t_DIVISION = r'/'\n        t_OPEN_PAREN = r'\\('\n        t_CLOSE_PAREN = r'\\)'\n        t_OPEN_BRACKET = r'\\['\n        t_CLOSE_BRACKET = r'\\]'\n\n        # NOTE THE ORDERING OF THESE RULES IS IMPORTANT!!\n        # Regular expression rules for simple tokens\n\n        def t_UFLOAT(t):\n            r'((\\d+\\.?\\d+)|(\\.\\d+))([eE][+-]?\\d+)?'\n            if not re.search(r'[eE\\.]', t.value):\n                t.type = 'UINT'\n                t.value = int(t.value)\n            else:\n                t.value = float(t.value)\n            return t\n\n        def t_UINT(t):\n            r'\\d+'\n            t.value = int(t.value)\n            return t\n\n        def t_SIGN(t):\n            r'[+-](?=\\d)'\n            t.value = float(t.value + '1')\n            return t\n\n        def t_X(t):  # multiplication for factor in front of unit\n            r'[x×]'\n            return t\n\n        def t_UNIT(t):\n            r'\\%|°|\\\\h|((?!\\d)\\w)+'\n            t.value = cls._get_unit(t)\n            return t\n\n        def t_DIMENSIONLESS(t):\n            r'---|-'\n            # These are separate from t_UNIT since they cannot have a prefactor.\n            t.value = cls._get_unit(t)\n            return t\n\n        t_ignore = ''\n\n        # Error handling rule\n        def t_error(t):\n            raise ValueError(\n                f\"Invalid character at col {t.lexpos}\")\n\n        return parsing.lex(lextab='cds_lextab', package='astropy/units',\n                           reflags=int(re.UNICODE))\n\n    @classmethod\n    def _make_parser(cls):\n        \"\"\"\n        The grammar here is based on the description in the `Standards\n        for Astronomical Catalogues 2.0\n        <http://vizier.u-strasbg.fr/vizier/doc/catstd-3.2.htx>`_, which is not\n        terribly precise.  The exact grammar is here is based on the\n        YACC grammar in the `unity library\n        <https://bitbucket.org/nxg/unity/>`_.\n        \"\"\"\n\n        tokens = cls._tokens\n\n        def p_main(p):\n            '''\n            main : factor combined_units\n                 | combined_units\n                 | DIMENSIONLESS\n                 | OPEN_BRACKET combined_units CLOSE_BRACKET\n                 | OPEN_BRACKET DIMENSIONLESS CLOSE_BRACKET\n                 | factor\n            '''\n            from astropy.units.core import Unit\n            from astropy.units import dex\n            if len(p) == 3:\n                p[0] = Unit(p[1] * p[2])\n            elif len(p) == 4:\n                p[0] = dex(p[2])\n            else:\n                p[0] = Unit(p[1])\n\n        def p_combined_units(p):\n            '''\n            combined_units : product_of_units\n                           | division_of_units\n            '''\n            p[0] = p[1]\n\n        def p_product_of_units(p):\n            '''\n            product_of_units : unit_expression PRODUCT combined_units\n                             | unit_expression\n            '''\n            if len(p) == 4:\n                p[0] = p[1] * p[3]\n            else:\n                p[0] = p[1]\n\n        def p_division_of_units(p):\n            '''\n            division_of_units : DIVISION unit_expression\n                              | unit_expression DIVISION combined_units\n            '''\n            if len(p) == 3:\n                p[0] = p[2] ** -1\n            else:\n                p[0] = p[1] / p[3]\n\n        def p_unit_expression(p):\n            '''\n            unit_expression : unit_with_power\n                            | OPEN_PAREN combined_units CLOSE_PAREN\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = p[2]\n\n        def p_factor(p):\n            '''\n            factor : signed_float X UINT signed_int\n                   | UINT X UINT signed_int\n                   | UINT signed_int\n                   | UINT\n                   | signed_float\n            '''\n            if len(p) == 5:\n                if p[3] != 10:\n                    raise ValueError(\n                        \"Only base ten exponents are allowed in CDS\")\n                p[0] = p[1] * 10.0 ** p[4]\n            elif len(p) == 3:\n                if p[1] != 10:\n                    raise ValueError(\n                        \"Only base ten exponents are allowed in CDS\")\n                p[0] = 10.0 ** p[2]\n            elif len(p) == 2:\n                p[0] = p[1]\n\n        def p_unit_with_power(p):\n            '''\n            unit_with_power : UNIT numeric_power\n                            | UNIT\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = p[1] ** p[2]\n\n        def p_numeric_power(p):\n            '''\n            numeric_power : sign UINT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_sign(p):\n            '''\n            sign : SIGN\n                 |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1.0\n\n        def p_signed_int(p):\n            '''\n            signed_int : SIGN UINT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_signed_float(p):\n            '''\n            signed_float : sign UINT\n                         | sign UFLOAT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_error(p):\n            raise ValueError()\n\n        return parsing.yacc(tabmodule='cds_parsetab', package='astropy/units')\n\n    @classmethod\n    def _get_unit(cls, t):\n        try:\n            return cls._parse_unit(t.value)\n        except ValueError as e:\n            registry = core.get_current_unit_registry()\n            if t.value in registry.aliases:\n                return registry.aliases[t.value]\n\n            raise ValueError(\n                f\"At col {t.lexpos}, {str(e)}\")\n\n    @classmethod\n    def _parse_unit(cls, unit, detailed_exception=True):\n        if unit not in cls._units:\n            if detailed_exception:\n                raise ValueError(\n                    \"Unit '{}' not supported by the CDS SAC \"\n                    \"standard. {}\".format(\n                        unit, did_you_mean(\n                            unit, cls._units)))\n            else:\n                raise ValueError()\n\n        return cls._units[unit]\n\n    @classmethod\n    def parse(cls, s, debug=False):\n        if ' ' in s:\n            raise ValueError('CDS unit must not contain whitespace')\n\n        if not isinstance(s, str):\n            s = s.decode('ascii')\n\n        # This is a short circuit for the case where the string\n        # is just a single unit name\n        try:\n            return cls._parse_unit(s, detailed_exception=False)\n        except ValueError:\n            try:\n                return cls._parser.parse(s, lexer=cls._lexer, debug=debug)\n            except ValueError as e:\n                if str(e):\n                    raise ValueError(str(e))\n                else:\n                    raise ValueError(\"Syntax error\")\n\n    @staticmethod\n    def _get_unit_name(unit):\n        return unit.get_format_name('cds')\n\n    @classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        for base, power in units:\n            if power == 1:\n                out.append(cls._get_unit_name(base))\n            else:\n                out.append(f'{cls._get_unit_name(base)}{int(power)}')\n        return '.'.join(out)\n\n    @classmethod\n    def to_string(cls, unit):\n        # Remove units that aren't known to the format\n        unit = utils.decompose_to_known_units(unit, cls._get_unit_name)\n\n        if isinstance(unit, core.CompositeUnit):\n            if unit == core.dimensionless_unscaled:\n                return '---'\n            elif is_effectively_unity(unit.scale*100.):\n                return '%'\n\n            if unit.scale == 1:\n                s = ''\n            else:\n                m, e = utils.split_mantissa_exponent(unit.scale)\n                parts = []\n                if m not in ('', '1'):\n                    parts.append(m)\n                if e:\n                    if not e.startswith('-'):\n                        e = \"+\" + e\n                    parts.append(f'10{e}')\n                s = 'x'.join(parts)\n\n            pairs = list(zip(unit.bases, unit.powers))\n            if len(pairs) > 0:\n                pairs.sort(key=operator.itemgetter(1), reverse=True)\n\n                s += cls._format_unit_list(pairs)\n\n        elif isinstance(unit, core.NamedUnit):\n            s = cls._get_unit_name(unit)\n\n        return s"},{"col":4,"comment":"null","endLoc":60,"header":"@classproperty(lazy=True)\n    def _units(cls)","id":10134,"name":"_units","nodeType":"Function","startLoc":58,"text":"@classproperty(lazy=True)\n    def _units(cls):\n        return cls._generate_unit_names()"},{"attributeType":"null","col":4,"comment":"null","endLoc":26,"id":10135,"name":"_times","nodeType":"Attribute","startLoc":26,"text":"_times"},{"attributeType":"null","col":4,"comment":"null","endLoc":27,"id":10136,"name":"_line","nodeType":"Attribute","startLoc":27,"text":"_line"},{"col":0,"comment":"","endLoc":6,"header":"console.py#<anonymous>","id":10137,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nHandles the \"Console\" unit format.\n\"\"\""},{"className":"UnrecognizedUnit","col":0,"comment":"\n    A unit that did not parse correctly.  This allows for\n    round-tripping it as a string, but no unit operations actually work\n    on it.\n\n    Parameters\n    ----------\n    st : str\n        The name of the unit.\n    ","endLoc":1955,"id":10138,"nodeType":"Class","startLoc":1894,"text":"class UnrecognizedUnit(IrreducibleUnit):\n    \"\"\"\n    A unit that did not parse correctly.  This allows for\n    round-tripping it as a string, but no unit operations actually work\n    on it.\n\n    Parameters\n    ----------\n    st : str\n        The name of the unit.\n    \"\"\"\n    # For UnrecognizedUnits, we want to use \"standard\" Python\n    # pickling, not the special case that is used for\n    # IrreducibleUnits.\n    __reduce__ = object.__reduce__\n\n    def __repr__(self):\n        return f\"UnrecognizedUnit({str(self)})\"\n\n    def __bytes__(self):\n        return self.name.encode('ascii', 'replace')\n\n    def __str__(self):\n        return self.name\n\n    def to_string(self, format=None):\n        return self.name\n\n    def _unrecognized_operator(self, *args, **kwargs):\n        raise ValueError(\n            \"The unit {!r} is unrecognized, so all arithmetic operations \"\n            \"with it are invalid.\".format(self.name))\n\n    __pow__ = __truediv__ = __rtruediv__ = __mul__ = __rmul__ = __lt__ = \\\n        __gt__ = __le__ = __ge__ = __neg__ = _unrecognized_operator\n\n    def __eq__(self, other):\n        try:\n            other = Unit(other, parse_strict='silent')\n        except (ValueError, UnitsError, TypeError):\n            return NotImplemented\n\n        return isinstance(other, type(self)) and self.name == other.name\n\n    def __ne__(self, other):\n        return not (self == other)\n\n    def is_equivalent(self, other, equivalencies=None):\n        self._normalize_equivalencies(equivalencies)\n        return self == other\n\n    def _get_converter(self, other, equivalencies=None):\n        self._normalize_equivalencies(equivalencies)\n        raise ValueError(\n            \"The unit {!r} is unrecognized.  It can not be converted \"\n            \"to other units.\".format(self.name))\n\n    def get_format_name(self, format):\n        return self.name\n\n    def is_unity(self):\n        return False"},{"col":4,"comment":"null","endLoc":1911,"header":"def __repr__(self)","id":10139,"name":"__repr__","nodeType":"Function","startLoc":1910,"text":"def __repr__(self):\n        return f\"UnrecognizedUnit({str(self)})\""},{"col":4,"comment":"null","endLoc":1914,"header":"def __bytes__(self)","id":10140,"name":"__bytes__","nodeType":"Function","startLoc":1913,"text":"def __bytes__(self):\n        return self.name.encode('ascii', 'replace')"},{"col":4,"comment":"null","endLoc":370,"header":"@classmethod\n    def _validate_unit(cls, unit, detailed_exception=True)","id":10141,"name":"_validate_unit","nodeType":"Function","startLoc":354,"text":"@classmethod\n    def _validate_unit(cls, unit, detailed_exception=True):\n        if unit not in cls._units:\n            if detailed_exception:\n                raise ValueError(\n                    \"Unit '{}' not supported by the OGIP \"\n                    \"standard. {}\".format(\n                        unit, utils.did_you_mean_units(\n                            unit, cls._units, cls._deprecated_units,\n                            cls._to_decomposed_alternative)))\n            else:\n                raise ValueError()\n\n        if unit in cls._deprecated_units:\n            utils.unit_deprecation_warning(\n                unit, cls._units[unit], 'OGIP',\n                cls._to_decomposed_alternative)"},{"fileName":"__init__.py","filePath":"astropy/units/format","id":10142,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nA collection of different unit formats.\n\"\"\"\n\n\n# This is pretty atrocious, but it will prevent a circular import for those\n# formatters that need access to the units.core module An entry for it should\n# exist in sys.modules since astropy.units.core imports this module\nimport sys\ncore = sys.modules['astropy.units.core']\n\nfrom .base import Base  # noqa\nfrom .generic import Generic, Unscaled  # noqa\nfrom .cds import CDS  # noqa\nfrom .console import Console  # noqa\nfrom .fits import Fits  # noqa\nfrom .latex import Latex, LatexInline  # noqa\nfrom .ogip import OGIP  # noqa\nfrom .unicode_format import Unicode  # noqa\nfrom .vounit import VOUnit  # noqa\n\n\n__all__ = [\n    'Base', 'Generic', 'CDS', 'Console', 'Fits', 'Latex', 'LatexInline',\n    'OGIP', 'Unicode', 'Unscaled', 'VOUnit', 'get_format']\n\n\ndef _known_formats():\n    inout = [name for name, cls in Base.registry.items()\n             if cls.parse.__func__ is not Base.parse.__func__]\n    out_only = [name for name, cls in Base.registry.items()\n                if cls.parse.__func__ is Base.parse.__func__]\n    return (f\"Valid formatter names are: {inout} for input and output, \"\n            f\"and {out_only} for output only.\")\n\n\ndef get_format(format=None):\n    \"\"\"\n    Get a formatter by name.\n\n    Parameters\n    ----------\n    format : str or `astropy.units.format.Base` instance or subclass\n        The name of the format, or the format instance or subclass\n        itself.\n\n    Returns\n    -------\n    format : `astropy.units.format.Base` instance\n        The requested formatter.\n    \"\"\"\n    if format is None:\n        return Generic\n\n    if isinstance(format, type) and issubclass(format, Base):\n        return format\n    elif not (isinstance(format, str) or format is None):\n        raise TypeError(\n            f\"Formatter must a subclass or instance of a subclass of {Base!r} \"\n            f\"or a string giving the name of the formatter. {_known_formats()}.\")\n\n    format_lower = format.lower()\n\n    if format_lower in Base.registry:\n        return Base.registry[format_lower]\n\n    raise ValueError(f\"Unknown format {format!r}.  {_known_formats()}\")\n"},{"col":4,"comment":"null","endLoc":469,"header":"def __rlshift__(self, m)","id":10143,"name":"__rlshift__","nodeType":"Function","startLoc":464,"text":"def __rlshift__(self, m):\n        try:\n            from .quantity import Quantity\n            return Quantity(m, self, copy=False, subok=True)\n        except Exception:\n            return NotImplemented"},{"className":"Fits","col":0,"comment":"\n    The FITS standard unit format.\n\n    This supports the format defined in the Units section of the `FITS\n    Standard <https://fits.gsfc.nasa.gov/fits_standard.html>`_.\n    ","endLoc":156,"id":10144,"nodeType":"Class","startLoc":17,"text":"class Fits(generic.Generic):\n    \"\"\"\n    The FITS standard unit format.\n\n    This supports the format defined in the Units section of the `FITS\n    Standard <https://fits.gsfc.nasa.gov/fits_standard.html>`_.\n    \"\"\"\n\n    name = 'fits'\n\n    @staticmethod\n    def _generate_unit_names():\n        from astropy import units as u\n        names = {}\n        deprecated_names = set()\n\n        # Note about deprecated units: before v2.0, several units were treated\n        # as deprecated (G, barn, erg, Angstrom, angstrom). However, in the\n        # FITS 3.0 standard, these units are explicitly listed in the allowed\n        # units, but deprecated in the IAU Style Manual (McNally 1988). So\n        # after discussion (https://github.com/astropy/astropy/issues/2933),\n        # these units have been removed from the lists of deprecated units and\n        # bases.\n\n        bases = [\n            'm', 'g', 's', 'rad', 'sr', 'K', 'A', 'mol', 'cd',\n            'Hz', 'J', 'W', 'V', 'N', 'Pa', 'C', 'Ohm', 'S',\n            'F', 'Wb', 'T', 'H', 'lm', 'lx', 'a', 'yr', 'eV',\n            'pc', 'Jy', 'mag', 'R', 'bit', 'byte', 'G', 'barn'\n        ]\n        deprecated_bases = []\n        prefixes = [\n            'y', 'z', 'a', 'f', 'p', 'n', 'u', 'm', 'c', 'd',\n            '', 'da', 'h', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']\n\n        special_cases = {'dbyte': u.Unit('dbyte', 0.1*u.byte)}\n\n        for base in bases + deprecated_bases:\n            for prefix in prefixes:\n                key = prefix + base\n                if keyword.iskeyword(key):\n                    continue\n                elif key in special_cases:\n                    names[key] = special_cases[key]\n                else:\n                    names[key] = getattr(u, key)\n        for base in deprecated_bases:\n            for prefix in prefixes:\n                deprecated_names.add(prefix + base)\n\n        simple_units = [\n            'deg', 'arcmin', 'arcsec', 'mas', 'min', 'h', 'd', 'Ry',\n            'solMass', 'u', 'solLum', 'solRad', 'AU', 'lyr', 'count',\n            'ct', 'photon', 'ph', 'pixel', 'pix', 'D', 'Sun', 'chan',\n            'bin', 'voxel', 'adu', 'beam', 'erg', 'Angstrom', 'angstrom'\n        ]\n        deprecated_units = []\n\n        for unit in simple_units + deprecated_units:\n            names[unit] = getattr(u, unit)\n        for unit in deprecated_units:\n            deprecated_names.add(unit)\n\n        return names, deprecated_names, []\n\n    @classmethod\n    def _validate_unit(cls, unit, detailed_exception=True):\n        if unit not in cls._units:\n            if detailed_exception:\n                raise ValueError(\n                    \"Unit '{}' not supported by the FITS standard. {}\".format(\n                        unit, utils.did_you_mean_units(\n                            unit, cls._units, cls._deprecated_units,\n                            cls._to_decomposed_alternative)))\n            else:\n                raise ValueError()\n\n        if unit in cls._deprecated_units:\n            utils.unit_deprecation_warning(\n                unit, cls._units[unit], 'FITS',\n                cls._to_decomposed_alternative)\n\n    @classmethod\n    def _parse_unit(cls, unit, detailed_exception=True):\n        cls._validate_unit(unit)\n        return cls._units[unit]\n\n    @classmethod\n    def _get_unit_name(cls, unit):\n        name = unit.get_format_name('fits')\n        cls._validate_unit(name)\n        return name\n\n    @classmethod\n    def to_string(cls, unit):\n        # Remove units that aren't known to the format\n        unit = utils.decompose_to_known_units(unit, cls._get_unit_name)\n\n        parts = []\n\n        if isinstance(unit, core.CompositeUnit):\n            base = np.log10(unit.scale)\n\n            if base % 1.0 != 0.0:\n                raise core.UnitScaleError(\n                    \"The FITS unit format is not able to represent scales \"\n                    \"that are not powers of 10.  Multiply your data by \"\n                    \"{:e}.\".format(unit.scale))\n            elif unit.scale != 1.0:\n                parts.append(f'10**{int(base)}')\n\n            pairs = list(zip(unit.bases, unit.powers))\n            if len(pairs):\n                pairs.sort(key=operator.itemgetter(1), reverse=True)\n                parts.append(cls._format_unit_list(pairs))\n\n            s = ' '.join(parts)\n        elif isinstance(unit, core.NamedUnit):\n            s = cls._get_unit_name(unit)\n\n        return s\n\n    @classmethod\n    def _to_decomposed_alternative(cls, unit):\n        try:\n            s = cls.to_string(unit)\n        except core.UnitScaleError:\n            scale = unit.scale\n            unit = copy.copy(unit)\n            unit._scale = 1.0\n            return f'{cls.to_string(unit)} (with data multiplied by {scale})'\n        return s\n\n    @classmethod\n    def parse(cls, s, debug=False):\n        result = super().parse(s, debug)\n        if hasattr(result, 'function_unit'):\n            raise ValueError(\"Function units are not yet supported for \"\n                             \"FITS units.\")\n        return result"},{"col":4,"comment":"null","endLoc":375,"header":"@classmethod\n    def _parse_unit(cls, unit, detailed_exception=True)","id":10145,"name":"_parse_unit","nodeType":"Function","startLoc":372,"text":"@classmethod\n    def _parse_unit(cls, unit, detailed_exception=True):\n        cls._validate_unit(unit, detailed_exception=detailed_exception)\n        return cls._units[unit]"},{"col":4,"comment":"null","endLoc":393,"header":"@classmethod\n    def parse(cls, s, debug=False)","id":10146,"name":"parse","nodeType":"Function","startLoc":377,"text":"@classmethod\n    def parse(cls, s, debug=False):\n        s = s.strip()\n        try:\n            # This is a short circuit for the case where the string is\n            # just a single unit name\n            return cls._parse_unit(s, detailed_exception=False)\n        except ValueError:\n            try:\n                return core.Unit(\n                    cls._parser.parse(s, lexer=cls._lexer, debug=debug))\n            except ValueError as e:\n                if str(e):\n                    raise\n                else:\n                    raise ValueError(\n                        f\"Syntax error parsing unit '{s}'\")"},{"col":4,"comment":"null","endLoc":472,"header":"def __str__(self)","id":10147,"name":"__str__","nodeType":"Function","startLoc":471,"text":"def __str__(self):\n        return self.to_string()"},{"col":4,"comment":"null","endLoc":475,"header":"def __repr__(self)","id":10148,"name":"__repr__","nodeType":"Function","startLoc":474,"text":"def __repr__(self):\n        return f'Unit(\"{self.to_string()}\")'"},{"col":4,"comment":"null","endLoc":249,"header":"@classmethod\n    def _to_decomposed_alternative(cls, unit)","id":10149,"name":"_to_decomposed_alternative","nodeType":"Function","startLoc":238,"text":"@classmethod\n    def _to_decomposed_alternative(cls, unit):\n        from astropy.units import core\n\n        try:\n            s = cls.to_string(unit)\n        except core.UnitScaleError:\n            scale = unit.scale\n            unit = copy.copy(unit)\n            unit._scale = 1.0\n            return f'{cls.to_string(unit)} (with data multiplied by {scale})'\n        return s"},{"col":4,"comment":"null","endLoc":80,"header":"@staticmethod\n    def _generate_unit_names()","id":10150,"name":"_generate_unit_names","nodeType":"Function","startLoc":27,"text":"@staticmethod\n    def _generate_unit_names():\n        from astropy import units as u\n        names = {}\n        deprecated_names = set()\n\n        # Note about deprecated units: before v2.0, several units were treated\n        # as deprecated (G, barn, erg, Angstrom, angstrom). However, in the\n        # FITS 3.0 standard, these units are explicitly listed in the allowed\n        # units, but deprecated in the IAU Style Manual (McNally 1988). So\n        # after discussion (https://github.com/astropy/astropy/issues/2933),\n        # these units have been removed from the lists of deprecated units and\n        # bases.\n\n        bases = [\n            'm', 'g', 's', 'rad', 'sr', 'K', 'A', 'mol', 'cd',\n            'Hz', 'J', 'W', 'V', 'N', 'Pa', 'C', 'Ohm', 'S',\n            'F', 'Wb', 'T', 'H', 'lm', 'lx', 'a', 'yr', 'eV',\n            'pc', 'Jy', 'mag', 'R', 'bit', 'byte', 'G', 'barn'\n        ]\n        deprecated_bases = []\n        prefixes = [\n            'y', 'z', 'a', 'f', 'p', 'n', 'u', 'm', 'c', 'd',\n            '', 'da', 'h', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']\n\n        special_cases = {'dbyte': u.Unit('dbyte', 0.1*u.byte)}\n\n        for base in bases + deprecated_bases:\n            for prefix in prefixes:\n                key = prefix + base\n                if keyword.iskeyword(key):\n                    continue\n                elif key in special_cases:\n                    names[key] = special_cases[key]\n                else:\n                    names[key] = getattr(u, key)\n        for base in deprecated_bases:\n            for prefix in prefixes:\n                deprecated_names.add(prefix + base)\n\n        simple_units = [\n            'deg', 'arcmin', 'arcsec', 'mas', 'min', 'h', 'd', 'Ry',\n            'solMass', 'u', 'solLum', 'solRad', 'AU', 'lyr', 'count',\n            'ct', 'photon', 'ph', 'pixel', 'pix', 'D', 'Sun', 'chan',\n            'bin', 'voxel', 'adu', 'beam', 'erg', 'Angstrom', 'angstrom'\n        ]\n        deprecated_units = []\n\n        for unit in simple_units + deprecated_units:\n            names[unit] = getattr(u, unit)\n        for unit in deprecated_units:\n            deprecated_names.add(unit)\n\n        return names, deprecated_names, []"},{"col":4,"comment":"null","endLoc":483,"header":"def __eq__(self, other)","id":10151,"name":"__eq__","nodeType":"Function","startLoc":477,"text":"def __eq__(self, other):\n        try:\n            other = StructuredUnit(other)\n        except Exception:\n            return NotImplemented\n\n        return self.values() == other.values()"},{"col":4,"comment":"null","endLoc":1917,"header":"def __str__(self)","id":10152,"name":"__str__","nodeType":"Function","startLoc":1916,"text":"def __str__(self):\n        return self.name"},{"col":4,"comment":"null","endLoc":1920,"header":"def to_string(self, format=None)","id":10153,"name":"to_string","nodeType":"Function","startLoc":1919,"text":"def to_string(self, format=None):\n        return self.name"},{"col":4,"comment":"null","endLoc":1925,"header":"def _unrecognized_operator(self, *args, **kwargs)","id":10154,"name":"_unrecognized_operator","nodeType":"Function","startLoc":1922,"text":"def _unrecognized_operator(self, *args, **kwargs):\n        raise ValueError(\n            \"The unit {!r} is unrecognized, so all arithmetic operations \"\n            \"with it are invalid.\".format(self.name))"},{"attributeType":"null","col":4,"comment":"null","endLoc":23,"id":10155,"name":"_explicit_custom_unit_regex","nodeType":"Attribute","startLoc":23,"text":"_explicit_custom_unit_regex"},{"attributeType":"null","col":4,"comment":"null","endLoc":25,"id":10156,"name":"_custom_unit_regex","nodeType":"Attribute","startLoc":25,"text":"_custom_unit_regex"},{"attributeType":"null","col":4,"comment":"null","endLoc":26,"id":10157,"name":"_custom_units","nodeType":"Attribute","startLoc":26,"text":"_custom_units"},{"col":4,"comment":"null","endLoc":1936,"header":"def __eq__(self, other)","id":10158,"name":"__eq__","nodeType":"Function","startLoc":1930,"text":"def __eq__(self, other):\n        try:\n            other = Unit(other, parse_strict='silent')\n        except (ValueError, UnitsError, TypeError):\n            return NotImplemented\n\n        return isinstance(other, type(self)) and self.name == other.name"},{"col":0,"comment":"","endLoc":4,"header":"vounit.py#<anonymous>","id":10159,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nHandles the \"VOUnit\" unit format.\n\"\"\""},{"fileName":"fits.py","filePath":"astropy/units/format","id":10160,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nHandles the \"FITS\" unit format.\n\"\"\"\n\n\nimport numpy as np\n\nimport copy\nimport keyword\nimport operator\n\nfrom . import core, generic, utils\n\n\nclass Fits(generic.Generic):\n    \"\"\"\n    The FITS standard unit format.\n\n    This supports the format defined in the Units section of the `FITS\n    Standard <https://fits.gsfc.nasa.gov/fits_standard.html>`_.\n    \"\"\"\n\n    name = 'fits'\n\n    @staticmethod\n    def _generate_unit_names():\n        from astropy import units as u\n        names = {}\n        deprecated_names = set()\n\n        # Note about deprecated units: before v2.0, several units were treated\n        # as deprecated (G, barn, erg, Angstrom, angstrom). However, in the\n        # FITS 3.0 standard, these units are explicitly listed in the allowed\n        # units, but deprecated in the IAU Style Manual (McNally 1988). So\n        # after discussion (https://github.com/astropy/astropy/issues/2933),\n        # these units have been removed from the lists of deprecated units and\n        # bases.\n\n        bases = [\n            'm', 'g', 's', 'rad', 'sr', 'K', 'A', 'mol', 'cd',\n            'Hz', 'J', 'W', 'V', 'N', 'Pa', 'C', 'Ohm', 'S',\n            'F', 'Wb', 'T', 'H', 'lm', 'lx', 'a', 'yr', 'eV',\n            'pc', 'Jy', 'mag', 'R', 'bit', 'byte', 'G', 'barn'\n        ]\n        deprecated_bases = []\n        prefixes = [\n            'y', 'z', 'a', 'f', 'p', 'n', 'u', 'm', 'c', 'd',\n            '', 'da', 'h', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']\n\n        special_cases = {'dbyte': u.Unit('dbyte', 0.1*u.byte)}\n\n        for base in bases + deprecated_bases:\n            for prefix in prefixes:\n                key = prefix + base\n                if keyword.iskeyword(key):\n                    continue\n                elif key in special_cases:\n                    names[key] = special_cases[key]\n                else:\n                    names[key] = getattr(u, key)\n        for base in deprecated_bases:\n            for prefix in prefixes:\n                deprecated_names.add(prefix + base)\n\n        simple_units = [\n            'deg', 'arcmin', 'arcsec', 'mas', 'min', 'h', 'd', 'Ry',\n            'solMass', 'u', 'solLum', 'solRad', 'AU', 'lyr', 'count',\n            'ct', 'photon', 'ph', 'pixel', 'pix', 'D', 'Sun', 'chan',\n            'bin', 'voxel', 'adu', 'beam', 'erg', 'Angstrom', 'angstrom'\n        ]\n        deprecated_units = []\n\n        for unit in simple_units + deprecated_units:\n            names[unit] = getattr(u, unit)\n        for unit in deprecated_units:\n            deprecated_names.add(unit)\n\n        return names, deprecated_names, []\n\n    @classmethod\n    def _validate_unit(cls, unit, detailed_exception=True):\n        if unit not in cls._units:\n            if detailed_exception:\n                raise ValueError(\n                    \"Unit '{}' not supported by the FITS standard. {}\".format(\n                        unit, utils.did_you_mean_units(\n                            unit, cls._units, cls._deprecated_units,\n                            cls._to_decomposed_alternative)))\n            else:\n                raise ValueError()\n\n        if unit in cls._deprecated_units:\n            utils.unit_deprecation_warning(\n                unit, cls._units[unit], 'FITS',\n                cls._to_decomposed_alternative)\n\n    @classmethod\n    def _parse_unit(cls, unit, detailed_exception=True):\n        cls._validate_unit(unit)\n        return cls._units[unit]\n\n    @classmethod\n    def _get_unit_name(cls, unit):\n        name = unit.get_format_name('fits')\n        cls._validate_unit(name)\n        return name\n\n    @classmethod\n    def to_string(cls, unit):\n        # Remove units that aren't known to the format\n        unit = utils.decompose_to_known_units(unit, cls._get_unit_name)\n\n        parts = []\n\n        if isinstance(unit, core.CompositeUnit):\n            base = np.log10(unit.scale)\n\n            if base % 1.0 != 0.0:\n                raise core.UnitScaleError(\n                    \"The FITS unit format is not able to represent scales \"\n                    \"that are not powers of 10.  Multiply your data by \"\n                    \"{:e}.\".format(unit.scale))\n            elif unit.scale != 1.0:\n                parts.append(f'10**{int(base)}')\n\n            pairs = list(zip(unit.bases, unit.powers))\n            if len(pairs):\n                pairs.sort(key=operator.itemgetter(1), reverse=True)\n                parts.append(cls._format_unit_list(pairs))\n\n            s = ' '.join(parts)\n        elif isinstance(unit, core.NamedUnit):\n            s = cls._get_unit_name(unit)\n\n        return s\n\n    @classmethod\n    def _to_decomposed_alternative(cls, unit):\n        try:\n            s = cls.to_string(unit)\n        except core.UnitScaleError:\n            scale = unit.scale\n            unit = copy.copy(unit)\n            unit._scale = 1.0\n            return f'{cls.to_string(unit)} (with data multiplied by {scale})'\n        return s\n\n    @classmethod\n    def parse(cls, s, debug=False):\n        result = super().parse(s, debug)\n        if hasattr(result, 'function_unit'):\n            raise ValueError(\"Function units are not yet supported for \"\n                             \"FITS units.\")\n        return result\n"},{"col":0,"comment":"","endLoc":5,"header":"fits.py#<anonymous>","id":10161,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nHandles the \"FITS\" unit format.\n\"\"\""},{"col":4,"comment":"null","endLoc":81,"header":"@staticmethod\n    def _generate_unit_names()","id":10162,"name":"_generate_unit_names","nodeType":"Function","startLoc":70,"text":"@staticmethod\n    def _generate_unit_names():\n        from astropy.units import cds\n        from astropy import units as u\n\n        names = {}\n\n        for key, val in cds.__dict__.items():\n            if isinstance(val, u.UnitBase):\n                names[key] = val\n\n        return names"},{"col":4,"comment":"null","endLoc":64,"header":"@classproperty(lazy=True)\n    def _parser(cls)","id":10163,"name":"_parser","nodeType":"Function","startLoc":62,"text":"@classproperty(lazy=True)\n    def _parser(cls):\n        return cls._make_parser()"},{"fileName":"unicode_format.py","filePath":"astropy/units/format","id":10164,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nHandles the \"Unicode\" unit format.\n\"\"\"\n\n\nfrom . import console, utils\n\n\nclass Unicode(console.Console):\n    \"\"\"\n    Output-only format to display pretty formatting at the console\n    using Unicode characters.\n\n    For example::\n\n      >>> import astropy.units as u\n      >>> print(u.bar.decompose().to_string('unicode'))\n              kg\n      100000 ────\n             m s²\n    \"\"\"\n\n    _times = \"×\"\n    _line = \"─\"\n\n    @classmethod\n    def _get_unit_name(cls, unit):\n        return unit.get_format_name('unicode')\n\n    @classmethod\n    def format_exponential_notation(cls, val):\n        m, ex = utils.split_mantissa_exponent(val)\n\n        parts = []\n        if m:\n            parts.append(m.replace('-', '−'))\n\n        if ex:\n            parts.append(f\"10{cls._format_superscript(ex)}\")\n\n        return cls._times.join(parts)\n\n    @classmethod\n    def _format_superscript(cls, number):\n        mapping = {\n            '0': '⁰',\n            '1': '¹',\n            '2': '²',\n            '3': '³',\n            '4': '⁴',\n            '5': '⁵',\n            '6': '⁶',\n            '7': '⁷',\n            '8': '⁸',\n            '9': '⁹',\n            '-': '⁻',\n            '−': '⁻',\n            # This is actually a \"raised omission bracket\", but it's\n            # the closest thing I could find to a superscript solidus.\n            '/': '⸍',\n            }\n        output = []\n        for c in number:\n            output.append(mapping[c])\n        return ''.join(output)\n"},{"col":4,"comment":"null","endLoc":399,"header":"@classmethod\n    def _get_unit_name(cls, unit)","id":10165,"name":"_get_unit_name","nodeType":"Function","startLoc":395,"text":"@classmethod\n    def _get_unit_name(cls, unit):\n        name = unit.get_format_name('ogip')\n        cls._validate_unit(name)\n        return name"},{"className":"Unicode","col":0,"comment":"\n    Output-only format to display pretty formatting at the console\n    using Unicode characters.\n\n    For example::\n\n      >>> import astropy.units as u\n      >>> print(u.bar.decompose().to_string('unicode'))\n              kg\n      100000 ────\n             m s²\n    ","endLoc":68,"id":10166,"nodeType":"Class","startLoc":12,"text":"class Unicode(console.Console):\n    \"\"\"\n    Output-only format to display pretty formatting at the console\n    using Unicode characters.\n\n    For example::\n\n      >>> import astropy.units as u\n      >>> print(u.bar.decompose().to_string('unicode'))\n              kg\n      100000 ────\n             m s²\n    \"\"\"\n\n    _times = \"×\"\n    _line = \"─\"\n\n    @classmethod\n    def _get_unit_name(cls, unit):\n        return unit.get_format_name('unicode')\n\n    @classmethod\n    def format_exponential_notation(cls, val):\n        m, ex = utils.split_mantissa_exponent(val)\n\n        parts = []\n        if m:\n            parts.append(m.replace('-', '−'))\n\n        if ex:\n            parts.append(f\"10{cls._format_superscript(ex)}\")\n\n        return cls._times.join(parts)\n\n    @classmethod\n    def _format_superscript(cls, number):\n        mapping = {\n            '0': '⁰',\n            '1': '¹',\n            '2': '²',\n            '3': '³',\n            '4': '⁴',\n            '5': '⁵',\n            '6': '⁶',\n            '7': '⁷',\n            '8': '⁸',\n            '9': '⁹',\n            '-': '⁻',\n            '−': '⁻',\n            # This is actually a \"raised omission bracket\", but it's\n            # the closest thing I could find to a superscript solidus.\n            '/': '⸍',\n            }\n        output = []\n        for c in number:\n            output.append(mapping[c])\n        return ''.join(output)"},{"col":4,"comment":"null","endLoc":31,"header":"@classmethod\n    def _get_unit_name(cls, unit)","id":10167,"name":"_get_unit_name","nodeType":"Function","startLoc":29,"text":"@classmethod\n    def _get_unit_name(cls, unit):\n        return unit.get_format_name('unicode')"},{"col":4,"comment":"null","endLoc":97,"header":"@classmethod\n    def _validate_unit(cls, unit, detailed_exception=True)","id":10168,"name":"_validate_unit","nodeType":"Function","startLoc":82,"text":"@classmethod\n    def _validate_unit(cls, unit, detailed_exception=True):\n        if unit not in cls._units:\n            if detailed_exception:\n                raise ValueError(\n                    \"Unit '{}' not supported by the FITS standard. {}\".format(\n                        unit, utils.did_you_mean_units(\n                            unit, cls._units, cls._deprecated_units,\n                            cls._to_decomposed_alternative)))\n            else:\n                raise ValueError()\n\n        if unit in cls._deprecated_units:\n            utils.unit_deprecation_warning(\n                unit, cls._units[unit], 'FITS',\n                cls._to_decomposed_alternative)"},{"col":4,"comment":"\n        The grammar here is based on the description in the `Standards\n        for Astronomical Catalogues 2.0\n        <http://vizier.u-strasbg.fr/vizier/doc/catstd-3.2.htx>`_, which is not\n        terribly precise.  The exact grammar is here is based on the\n        YACC grammar in the `unity library\n        <https://bitbucket.org/nxg/unity/>`_.\n        ","endLoc":272,"header":"@classmethod\n    def _make_parser(cls)","id":10169,"name":"_make_parser","nodeType":"Function","startLoc":141,"text":"@classmethod\n    def _make_parser(cls):\n        \"\"\"\n        The grammar here is based on the description in the `Standards\n        for Astronomical Catalogues 2.0\n        <http://vizier.u-strasbg.fr/vizier/doc/catstd-3.2.htx>`_, which is not\n        terribly precise.  The exact grammar is here is based on the\n        YACC grammar in the `unity library\n        <https://bitbucket.org/nxg/unity/>`_.\n        \"\"\"\n\n        tokens = cls._tokens\n\n        def p_main(p):\n            '''\n            main : factor combined_units\n                 | combined_units\n                 | DIMENSIONLESS\n                 | OPEN_BRACKET combined_units CLOSE_BRACKET\n                 | OPEN_BRACKET DIMENSIONLESS CLOSE_BRACKET\n                 | factor\n            '''\n            from astropy.units.core import Unit\n            from astropy.units import dex\n            if len(p) == 3:\n                p[0] = Unit(p[1] * p[2])\n            elif len(p) == 4:\n                p[0] = dex(p[2])\n            else:\n                p[0] = Unit(p[1])\n\n        def p_combined_units(p):\n            '''\n            combined_units : product_of_units\n                           | division_of_units\n            '''\n            p[0] = p[1]\n\n        def p_product_of_units(p):\n            '''\n            product_of_units : unit_expression PRODUCT combined_units\n                             | unit_expression\n            '''\n            if len(p) == 4:\n                p[0] = p[1] * p[3]\n            else:\n                p[0] = p[1]\n\n        def p_division_of_units(p):\n            '''\n            division_of_units : DIVISION unit_expression\n                              | unit_expression DIVISION combined_units\n            '''\n            if len(p) == 3:\n                p[0] = p[2] ** -1\n            else:\n                p[0] = p[1] / p[3]\n\n        def p_unit_expression(p):\n            '''\n            unit_expression : unit_with_power\n                            | OPEN_PAREN combined_units CLOSE_PAREN\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = p[2]\n\n        def p_factor(p):\n            '''\n            factor : signed_float X UINT signed_int\n                   | UINT X UINT signed_int\n                   | UINT signed_int\n                   | UINT\n                   | signed_float\n            '''\n            if len(p) == 5:\n                if p[3] != 10:\n                    raise ValueError(\n                        \"Only base ten exponents are allowed in CDS\")\n                p[0] = p[1] * 10.0 ** p[4]\n            elif len(p) == 3:\n                if p[1] != 10:\n                    raise ValueError(\n                        \"Only base ten exponents are allowed in CDS\")\n                p[0] = 10.0 ** p[2]\n            elif len(p) == 2:\n                p[0] = p[1]\n\n        def p_unit_with_power(p):\n            '''\n            unit_with_power : UNIT numeric_power\n                            | UNIT\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = p[1] ** p[2]\n\n        def p_numeric_power(p):\n            '''\n            numeric_power : sign UINT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_sign(p):\n            '''\n            sign : SIGN\n                 |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1.0\n\n        def p_signed_int(p):\n            '''\n            signed_int : SIGN UINT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_signed_float(p):\n            '''\n            signed_float : sign UINT\n                         | sign UFLOAT\n            '''\n            p[0] = p[1] * p[2]\n\n        def p_error(p):\n            raise ValueError()\n\n        return parsing.yacc(tabmodule='cds_parsetab', package='astropy/units')"},{"col":4,"comment":"null","endLoc":44,"header":"@classmethod\n    def format_exponential_notation(cls, val)","id":10170,"name":"format_exponential_notation","nodeType":"Function","startLoc":33,"text":"@classmethod\n    def format_exponential_notation(cls, val):\n        m, ex = utils.split_mantissa_exponent(val)\n\n        parts = []\n        if m:\n            parts.append(m.replace('-', '−'))\n\n        if ex:\n            parts.append(f\"10{cls._format_superscript(ex)}\")\n\n        return cls._times.join(parts)"},{"col":4,"comment":"null","endLoc":415,"header":"@classmethod\n    def _format_unit_list(cls, units)","id":10171,"name":"_format_unit_list","nodeType":"Function","startLoc":401,"text":"@classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        units.sort(key=lambda x: cls._get_unit_name(x[0]).lower())\n\n        for base, power in units:\n            if power == 1:\n                out.append(cls._get_unit_name(base))\n            else:\n                power = utils.format_power(power)\n                if '/' in power:\n                    out.append(f'{cls._get_unit_name(base)}**({power})')\n                else:\n                    out.append(f'{cls._get_unit_name(base)}**{power}')\n        return ' '.join(out)"},{"col":4,"comment":"null","endLoc":1939,"header":"def __ne__(self, other)","id":10172,"name":"__ne__","nodeType":"Function","startLoc":1938,"text":"def __ne__(self, other):\n        return not (self == other)"},{"col":4,"comment":"null","endLoc":1943,"header":"def is_equivalent(self, other, equivalencies=None)","id":10173,"name":"is_equivalent","nodeType":"Function","startLoc":1941,"text":"def is_equivalent(self, other, equivalencies=None):\n        self._normalize_equivalencies(equivalencies)\n        return self == other"},{"col":4,"comment":"null","endLoc":102,"header":"@classmethod\n    def _parse_unit(cls, unit, detailed_exception=True)","id":10174,"name":"_parse_unit","nodeType":"Function","startLoc":99,"text":"@classmethod\n    def _parse_unit(cls, unit, detailed_exception=True):\n        cls._validate_unit(unit)\n        return cls._units[unit]"},{"col":4,"comment":"null","endLoc":492,"header":"def __ne__(self, other)","id":10175,"name":"__ne__","nodeType":"Function","startLoc":485,"text":"def __ne__(self, other):\n        if not isinstance(other, type(self)):\n            try:\n                other = StructuredUnit(other)\n            except Exception:\n                return NotImplemented\n\n        return self.values() != other.values()"},{"col":23,"endLoc":404,"id":10176,"nodeType":"Lambda","startLoc":404,"text":"lambda x: cls._get_unit_name(x[0]).lower()"},{"col":4,"comment":"null","endLoc":108,"header":"@classmethod\n    def _get_unit_name(cls, unit)","id":10177,"name":"_get_unit_name","nodeType":"Function","startLoc":104,"text":"@classmethod\n    def _get_unit_name(cls, unit):\n        name = unit.get_format_name('fits')\n        cls._validate_unit(name)\n        return name"},{"col":4,"comment":"null","endLoc":68,"header":"@classproperty(lazy=True)\n    def _lexer(cls)","id":10178,"name":"_lexer","nodeType":"Function","startLoc":66,"text":"@classproperty(lazy=True)\n    def _lexer(cls):\n        return cls._make_lexer()"},{"col":4,"comment":"null","endLoc":137,"header":"@classmethod\n    def to_string(cls, unit)","id":10179,"name":"to_string","nodeType":"Function","startLoc":110,"text":"@classmethod\n    def to_string(cls, unit):\n        # Remove units that aren't known to the format\n        unit = utils.decompose_to_known_units(unit, cls._get_unit_name)\n\n        parts = []\n\n        if isinstance(unit, core.CompositeUnit):\n            base = np.log10(unit.scale)\n\n            if base % 1.0 != 0.0:\n                raise core.UnitScaleError(\n                    \"The FITS unit format is not able to represent scales \"\n                    \"that are not powers of 10.  Multiply your data by \"\n                    \"{:e}.\".format(unit.scale))\n            elif unit.scale != 1.0:\n                parts.append(f'10**{int(base)}')\n\n            pairs = list(zip(unit.bases, unit.powers))\n            if len(pairs):\n                pairs.sort(key=operator.itemgetter(1), reverse=True)\n                parts.append(cls._format_unit_list(pairs))\n\n            s = ' '.join(parts)\n        elif isinstance(unit, core.NamedUnit):\n            s = cls._get_unit_name(unit)\n\n        return s"},{"col":4,"comment":"null","endLoc":68,"header":"@classmethod\n    def _format_superscript(cls, number)","id":10180,"name":"_format_superscript","nodeType":"Function","startLoc":46,"text":"@classmethod\n    def _format_superscript(cls, number):\n        mapping = {\n            '0': '⁰',\n            '1': '¹',\n            '2': '²',\n            '3': '³',\n            '4': '⁴',\n            '5': '⁵',\n            '6': '⁶',\n            '7': '⁷',\n            '8': '⁸',\n            '9': '⁹',\n            '-': '⁻',\n            '−': '⁻',\n            # This is actually a \"raised omission bracket\", but it's\n            # the closest thing I could find to a superscript solidus.\n            '/': '⸍',\n            }\n        output = []\n        for c in number:\n            output.append(mapping[c])\n        return ''.join(output)"},{"attributeType":"null","col":4,"comment":"null","endLoc":26,"id":10181,"name":"_times","nodeType":"Attribute","startLoc":26,"text":"_times"},{"attributeType":"null","col":4,"comment":"null","endLoc":27,"id":10182,"name":"_line","nodeType":"Attribute","startLoc":27,"text":"_line"},{"col":4,"comment":"null","endLoc":1949,"header":"def _get_converter(self, other, equivalencies=None)","id":10183,"name":"_get_converter","nodeType":"Function","startLoc":1945,"text":"def _get_converter(self, other, equivalencies=None):\n        self._normalize_equivalencies(equivalencies)\n        raise ValueError(\n            \"The unit {!r} is unrecognized.  It can not be converted \"\n            \"to other units.\".format(self.name))"},{"col":0,"comment":"","endLoc":6,"header":"unicode_format.py#<anonymous>","id":10184,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nHandles the \"Unicode\" unit format.\n\"\"\""},{"col":4,"comment":"null","endLoc":139,"header":"@classmethod\n    def _make_lexer(cls)","id":10185,"name":"_make_lexer","nodeType":"Function","startLoc":83,"text":"@classmethod\n    def _make_lexer(cls):\n        tokens = cls._tokens\n\n        t_PRODUCT = r'\\.'\n        t_DIVISION = r'/'\n        t_OPEN_PAREN = r'\\('\n        t_CLOSE_PAREN = r'\\)'\n        t_OPEN_BRACKET = r'\\['\n        t_CLOSE_BRACKET = r'\\]'\n\n        # NOTE THE ORDERING OF THESE RULES IS IMPORTANT!!\n        # Regular expression rules for simple tokens\n\n        def t_UFLOAT(t):\n            r'((\\d+\\.?\\d+)|(\\.\\d+))([eE][+-]?\\d+)?'\n            if not re.search(r'[eE\\.]', t.value):\n                t.type = 'UINT'\n                t.value = int(t.value)\n            else:\n                t.value = float(t.value)\n            return t\n\n        def t_UINT(t):\n            r'\\d+'\n            t.value = int(t.value)\n            return t\n\n        def t_SIGN(t):\n            r'[+-](?=\\d)'\n            t.value = float(t.value + '1')\n            return t\n\n        def t_X(t):  # multiplication for factor in front of unit\n            r'[x×]'\n            return t\n\n        def t_UNIT(t):\n            r'\\%|°|\\\\h|((?!\\d)\\w)+'\n            t.value = cls._get_unit(t)\n            return t\n\n        def t_DIMENSIONLESS(t):\n            r'---|-'\n            # These are separate from t_UNIT since they cannot have a prefactor.\n            t.value = cls._get_unit(t)\n            return t\n\n        t_ignore = ''\n\n        # Error handling rule\n        def t_error(t):\n            raise ValueError(\n                f\"Invalid character at col {t.lexpos}\")\n\n        return parsing.lex(lextab='cds_lextab', package='astropy/units',\n                           reflags=int(re.UNICODE))"},{"fileName":"cds_lextab.py","filePath":"astropy/units/format","id":10186,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# This file was automatically generated from ply. To re-generate this file,\n# remove it from this folder, then build astropy and run the tests in-place:\n#\n#   python setup.py build_ext --inplace\n#   pytest astropy/units\n#\n# You can then commit the changes to this file.\n\n# cds_lextab.py. This file automatically created by PLY (version 3.11). Don't edit!\n_tabversion   = '3.10'\n_lextokens    = set(('CLOSE_BRACKET', 'CLOSE_PAREN', 'DIMENSIONLESS', 'DIVISION', 'OPEN_BRACKET', 'OPEN_PAREN', 'PRODUCT', 'SIGN', 'UFLOAT', 'UINT', 'UNIT', 'X'))\n_lexreflags   = 32\n_lexliterals  = ''\n_lexstateinfo = {'INITIAL': 'inclusive'}\n_lexstatere   = {'INITIAL': [('(?P<t_UFLOAT>((\\\\d+\\\\.?\\\\d+)|(\\\\.\\\\d+))([eE][+-]?\\\\d+)?)|(?P<t_UINT>\\\\d+)|(?P<t_SIGN>[+-](?=\\\\d))|(?P<t_X>[x×])|(?P<t_UNIT>\\\\%|°|\\\\\\\\h|((?!\\\\d)\\\\w)+)|(?P<t_DIMENSIONLESS>---|-)|(?P<t_PRODUCT>\\\\.)|(?P<t_OPEN_PAREN>\\\\()|(?P<t_CLOSE_PAREN>\\\\))|(?P<t_OPEN_BRACKET>\\\\[)|(?P<t_CLOSE_BRACKET>\\\\])|(?P<t_DIVISION>/)', [None, ('t_UFLOAT', 'UFLOAT'), None, None, None, None, ('t_UINT', 'UINT'), ('t_SIGN', 'SIGN'), ('t_X', 'X'), ('t_UNIT', 'UNIT'), None, ('t_DIMENSIONLESS', 'DIMENSIONLESS'), (None, 'PRODUCT'), (None, 'OPEN_PAREN'), (None, 'CLOSE_PAREN'), (None, 'OPEN_BRACKET'), (None, 'CLOSE_BRACKET'), (None, 'DIVISION')])]}\n_lexstateignore = {'INITIAL': ''}\n_lexstateerrorf = {'INITIAL': 't_error'}\n_lexstateeoff = {}\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":10187,"name":"_tabversion","nodeType":"Attribute","startLoc":13,"text":"_tabversion"},{"col":4,"comment":"null","endLoc":1952,"header":"def get_format_name(self, format)","id":10188,"name":"get_format_name","nodeType":"Function","startLoc":1951,"text":"def get_format_name(self, format):\n        return self.name"},{"col":4,"comment":"null","endLoc":1955,"header":"def is_unity(self)","id":10189,"name":"is_unity","nodeType":"Function","startLoc":1954,"text":"def is_unity(self):\n        return False"},{"attributeType":"null","col":4,"comment":"null","endLoc":1908,"id":10190,"name":"__reduce__","nodeType":"Attribute","startLoc":1908,"text":"__reduce__"},{"attributeType":"null","col":4,"comment":"null","endLoc":428,"id":10191,"name":"__array_ufunc__","nodeType":"Attribute","startLoc":428,"text":"__array_ufunc__"},{"col":4,"comment":"null","endLoc":148,"header":"@classmethod\n    def _to_decomposed_alternative(cls, unit)","id":10192,"name":"_to_decomposed_alternative","nodeType":"Function","startLoc":139,"text":"@classmethod\n    def _to_decomposed_alternative(cls, unit):\n        try:\n            s = cls.to_string(unit)\n        except core.UnitScaleError:\n            scale = unit.scale\n            unit = copy.copy(unit)\n            unit._scale = 1.0\n            return f'{cls.to_string(unit)} (with data multiplied by {scale})'\n        return s"},{"attributeType":"function","col":4,"comment":"null","endLoc":1927,"id":10193,"name":"__pow__","nodeType":"Attribute","startLoc":1927,"text":"__pow__"},{"attributeType":"null","col":8,"comment":"null","endLoc":180,"id":10194,"name":"_units","nodeType":"Attribute","startLoc":180,"text":"self._units"},{"attributeType":"null","col":16,"comment":"null","endLoc":168,"id":10195,"name":"unit","nodeType":"Attribute","startLoc":168,"text":"unit"},{"attributeType":"null","col":12,"comment":"null","endLoc":154,"id":10196,"name":"names","nodeType":"Attribute","startLoc":154,"text":"names"},{"attributeType":"null","col":8,"comment":"null","endLoc":159,"id":10197,"name":"converted","nodeType":"Attribute","startLoc":159,"text":"converted"},{"attributeType":"null","col":16,"comment":"null","endLoc":165,"id":10198,"name":"name","nodeType":"Attribute","startLoc":165,"text":"name"},{"attributeType":"null","col":12,"comment":"null","endLoc":177,"id":10199,"name":"dtype","nodeType":"Attribute","startLoc":177,"text":"dtype"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":10200,"name":"_lextokens","nodeType":"Attribute","startLoc":14,"text":"_lextokens"},{"attributeType":"function","col":14,"comment":"null","endLoc":1927,"id":10201,"name":"__truediv__","nodeType":"Attribute","startLoc":1927,"text":"__truediv__"},{"attributeType":"null","col":8,"comment":"null","endLoc":175,"id":10202,"name":"self","nodeType":"Attribute","startLoc":175,"text":"self"},{"attributeType":"null","col":16,"comment":"null","endLoc":151,"id":10203,"name":"units","nodeType":"Attribute","startLoc":151,"text":"units"},{"col":4,"comment":"null","endLoc":429,"header":"@classmethod\n    def to_string(cls, unit)","id":10204,"name":"to_string","nodeType":"Function","startLoc":417,"text":"@classmethod\n    def to_string(cls, unit):\n        # Remove units that aren't known to the format\n        unit = utils.decompose_to_known_units(unit, cls._get_unit_name)\n\n        if isinstance(unit, core.CompositeUnit):\n            # Can't use np.log10 here, because p[0] may be a Python long.\n            if math.log10(unit.scale) % 1.0 != 0.0:\n                warnings.warn(\n                    f\"'{unit.scale}' scale should be a power of 10 in OGIP format\",\n                    core.UnitsWarning)\n\n        return generic._to_string(cls, unit)"},{"attributeType":"function","col":28,"comment":"null","endLoc":1927,"id":10205,"name":"__rtruediv__","nodeType":"Attribute","startLoc":1927,"text":"__rtruediv__"},{"attributeType":"function","col":43,"comment":"null","endLoc":1927,"id":10206,"name":"__mul__","nodeType":"Attribute","startLoc":1927,"text":"__mul__"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":10207,"name":"_lexreflags","nodeType":"Attribute","startLoc":15,"text":"_lexreflags"},{"attributeType":"function","col":53,"comment":"null","endLoc":1927,"id":10208,"name":"__rmul__","nodeType":"Attribute","startLoc":1927,"text":"__rmul__"},{"col":4,"comment":"null","endLoc":156,"header":"@classmethod\n    def parse(cls, s, debug=False)","id":10209,"name":"parse","nodeType":"Function","startLoc":150,"text":"@classmethod\n    def parse(cls, s, debug=False):\n        result = super().parse(s, debug)\n        if hasattr(result, 'function_unit'):\n            raise ValueError(\"Function units are not yet supported for \"\n                             \"FITS units.\")\n        return result"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":10210,"name":"_lexliterals","nodeType":"Attribute","startLoc":16,"text":"_lexliterals"},{"attributeType":"function","col":64,"comment":"null","endLoc":1927,"id":10211,"name":"__lt__","nodeType":"Attribute","startLoc":1927,"text":"__lt__"},{"attributeType":"function","col":8,"comment":"null","endLoc":1928,"id":10212,"name":"__gt__","nodeType":"Attribute","startLoc":1928,"text":"__gt__"},{"attributeType":"function","col":17,"comment":"null","endLoc":1928,"id":10213,"name":"__le__","nodeType":"Attribute","startLoc":1928,"text":"__le__"},{"attributeType":"function","col":26,"comment":"null","endLoc":1928,"id":10214,"name":"__ge__","nodeType":"Attribute","startLoc":1928,"text":"__ge__"},{"attributeType":"null","col":4,"comment":"null","endLoc":25,"id":10215,"name":"name","nodeType":"Attribute","startLoc":25,"text":"name"},{"attributeType":"function","col":35,"comment":"null","endLoc":1928,"id":10216,"name":"__neg__","nodeType":"Attribute","startLoc":1928,"text":"__neg__"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":10217,"name":"_lexstateinfo","nodeType":"Attribute","startLoc":17,"text":"_lexstateinfo"},{"className":"_UnitMetaClass","col":0,"comment":"\n    This metaclass exists because the Unit constructor should\n    sometimes return instances that already exist.  This \"overrides\"\n    the constructor before the new instance is actually created, so we\n    can return an existing one.\n    ","endLoc":2060,"id":10218,"nodeType":"Class","startLoc":1958,"text":"class _UnitMetaClass(type):\n    \"\"\"\n    This metaclass exists because the Unit constructor should\n    sometimes return instances that already exist.  This \"overrides\"\n    the constructor before the new instance is actually created, so we\n    can return an existing one.\n    \"\"\"\n\n    def __call__(self, s=\"\", represents=None, format=None, namespace=None,\n                 doc=None, parse_strict='raise'):\n\n        # Short-circuit if we're already a unit\n        if hasattr(s, '_get_physical_type_id'):\n            return s\n\n        # turn possible Quantity input for s or represents into a Unit\n        from .quantity import Quantity\n\n        if isinstance(represents, Quantity):\n            if is_effectively_unity(represents.value):\n                represents = represents.unit\n            else:\n                represents = CompositeUnit(represents.value *\n                                           represents.unit.scale,\n                                           bases=represents.unit.bases,\n                                           powers=represents.unit.powers,\n                                           _error_check=False)\n\n        if isinstance(s, Quantity):\n            if is_effectively_unity(s.value):\n                s = s.unit\n            else:\n                s = CompositeUnit(s.value * s.unit.scale,\n                                  bases=s.unit.bases,\n                                  powers=s.unit.powers,\n                                  _error_check=False)\n\n        # now decide what we really need to do; define derived Unit?\n        if isinstance(represents, UnitBase):\n            # This has the effect of calling the real __new__ and\n            # __init__ on the Unit class.\n            return super().__call__(\n                s, represents, format=format, namespace=namespace, doc=doc)\n\n        # or interpret a Quantity (now became unit), string or number?\n        if isinstance(s, UnitBase):\n            return s\n\n        elif isinstance(s, (bytes, str)):\n            if len(s.strip()) == 0:\n                # Return the NULL unit\n                return dimensionless_unscaled\n\n            if format is None:\n                format = unit_format.Generic\n\n            f = unit_format.get_format(format)\n            if isinstance(s, bytes):\n                s = s.decode('ascii')\n\n            try:\n                return f.parse(s)\n            except NotImplementedError:\n                raise\n            except Exception as e:\n                if parse_strict == 'silent':\n                    pass\n                else:\n                    # Deliberately not issubclass here. Subclasses\n                    # should use their name.\n                    if f is not unit_format.Generic:\n                        format_clause = f.name + ' '\n                    else:\n                        format_clause = ''\n                    msg = (\"'{}' did not parse as {}unit: {} \"\n                           \"If this is meant to be a custom unit, \"\n                           \"define it with 'u.def_unit'. To have it \"\n                           \"recognized inside a file reader or other code, \"\n                           \"enable it with 'u.add_enabled_units'. \"\n                           \"For details, see \"\n                           \"https://docs.astropy.org/en/latest/units/combining_and_defining.html\"\n                           .format(s, format_clause, str(e)))\n                    if parse_strict == 'raise':\n                        raise ValueError(msg)\n                    elif parse_strict == 'warn':\n                        warnings.warn(msg, UnitsWarning)\n                    else:\n                        raise ValueError(\"'parse_strict' must be 'warn', \"\n                                         \"'raise' or 'silent'\")\n                return UnrecognizedUnit(s)\n\n        elif isinstance(s, (int, float, np.floating, np.integer)):\n            return CompositeUnit(s, [], [], _error_check=False)\n\n        elif isinstance(s, tuple):\n            from .structured import StructuredUnit\n            return StructuredUnit(s)\n\n        elif s is None:\n            raise TypeError(\"None is not a valid Unit\")\n\n        else:\n            raise TypeError(f\"{s} can not be converted to a Unit\")"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":10219,"name":"_lexstatere","nodeType":"Attribute","startLoc":18,"text":"_lexstatere"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":10220,"name":"_lexstateignore","nodeType":"Attribute","startLoc":19,"text":"_lexstateignore"},{"className":"PrefixUnit","col":0,"comment":"\n    A unit that is simply a SI-prefixed version of another unit.\n\n    For example, ``mm`` is a `PrefixUnit` of ``.001 * m``.\n\n    The constructor is the same as for `Unit`.\n    ","endLoc":2196,"id":10221,"nodeType":"Class","startLoc":2189,"text":"class PrefixUnit(Unit):\n    \"\"\"\n    A unit that is simply a SI-prefixed version of another unit.\n\n    For example, ``mm`` is a `PrefixUnit` of ``.001 * m``.\n\n    The constructor is the same as for `Unit`.\n    \"\"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":10222,"name":"_lexstateerrorf","nodeType":"Attribute","startLoc":20,"text":"_lexstateerrorf"},{"className":"CompositeUnit","col":0,"comment":"\n    Create a composite unit using expressions of previously defined\n    units.\n\n    Direct use of this class is not recommended. Instead use the\n    factory function `Unit` and arithmetic operators to compose\n    units.\n\n    Parameters\n    ----------\n    scale : number\n        A scaling factor for the unit.\n\n    bases : sequence of `UnitBase`\n        A sequence of units this unit is composed of.\n\n    powers : sequence of numbers\n        A sequence of powers (in parallel with ``bases``) for each\n        of the base units.\n    ","endLoc":2364,"id":10223,"nodeType":"Class","startLoc":2199,"text":"class CompositeUnit(UnitBase):\n    \"\"\"\n    Create a composite unit using expressions of previously defined\n    units.\n\n    Direct use of this class is not recommended. Instead use the\n    factory function `Unit` and arithmetic operators to compose\n    units.\n\n    Parameters\n    ----------\n    scale : number\n        A scaling factor for the unit.\n\n    bases : sequence of `UnitBase`\n        A sequence of units this unit is composed of.\n\n    powers : sequence of numbers\n        A sequence of powers (in parallel with ``bases``) for each\n        of the base units.\n    \"\"\"\n    _decomposed_cache = None\n\n    def __init__(self, scale, bases, powers, decompose=False,\n                 decompose_bases=set(), _error_check=True):\n        # There are many cases internal to astropy.units where we\n        # already know that all the bases are Unit objects, and the\n        # powers have been validated.  In those cases, we can skip the\n        # error checking for performance reasons.  When the private\n        # kwarg `_error_check` is False, the error checking is turned\n        # off.\n        if _error_check:\n            for base in bases:\n                if not isinstance(base, UnitBase):\n                    raise TypeError(\n                        \"bases must be sequence of UnitBase instances\")\n            powers = [validate_power(p) for p in powers]\n\n        if not decompose and len(bases) == 1 and powers[0] >= 0:\n            # Short-cut; with one unit there's nothing to expand and gather,\n            # as that has happened already when creating the unit.  But do only\n            # positive powers, since for negative powers we need to re-sort.\n            unit = bases[0]\n            power = powers[0]\n            if power == 1:\n                scale *= unit.scale\n                self._bases = unit.bases\n                self._powers = unit.powers\n            elif power == 0:\n                self._bases = []\n                self._powers = []\n            else:\n                scale *= unit.scale ** power\n                self._bases = unit.bases\n                self._powers = [operator.mul(*resolve_fractions(p, power))\n                                for p in unit.powers]\n\n            self._scale = sanitize_scale(scale)\n        else:\n            # Regular case: use inputs as preliminary scale, bases, and powers,\n            # then \"expand and gather\" identical bases, sanitize the scale, &c.\n            self._scale = scale\n            self._bases = bases\n            self._powers = powers\n            self._expand_and_gather(decompose=decompose,\n                                    bases=decompose_bases)\n\n    def __repr__(self):\n        if len(self._bases):\n            return super().__repr__()\n        else:\n            if self._scale != 1.0:\n                return f'Unit(dimensionless with a scale of {self._scale})'\n            else:\n                return 'Unit(dimensionless)'\n\n    @property\n    def scale(self):\n        \"\"\"\n        Return the scale of the composite unit.\n        \"\"\"\n        return self._scale\n\n    @property\n    def bases(self):\n        \"\"\"\n        Return the bases of the composite unit.\n        \"\"\"\n        return self._bases\n\n    @property\n    def powers(self):\n        \"\"\"\n        Return the powers of the composite unit.\n        \"\"\"\n        return self._powers\n\n    def _expand_and_gather(self, decompose=False, bases=set()):\n        def add_unit(unit, power, scale):\n            if bases and unit not in bases:\n                for base in bases:\n                    try:\n                        scale *= unit._to(base) ** power\n                    except UnitsError:\n                        pass\n                    else:\n                        unit = base\n                        break\n\n            if unit in new_parts:\n                a, b = resolve_fractions(new_parts[unit], power)\n                new_parts[unit] = a + b\n            else:\n                new_parts[unit] = power\n            return scale\n\n        new_parts = {}\n        scale = self._scale\n\n        for b, p in zip(self._bases, self._powers):\n            if decompose and b not in bases:\n                b = b.decompose(bases=bases)\n\n            if isinstance(b, CompositeUnit):\n                scale *= b._scale ** p\n                for b_sub, p_sub in zip(b._bases, b._powers):\n                    a, b = resolve_fractions(p_sub, p)\n                    scale = add_unit(b_sub, a * b, scale)\n            else:\n                scale = add_unit(b, p, scale)\n\n        new_parts = [x for x in new_parts.items() if x[1] != 0]\n        new_parts.sort(key=lambda x: (-x[1], getattr(x[0], 'name', '')))\n\n        self._bases = [x[0] for x in new_parts]\n        self._powers = [x[1] for x in new_parts]\n        self._scale = sanitize_scale(scale)\n\n    def __copy__(self):\n        \"\"\"\n        For compatibility with python copy module.\n        \"\"\"\n        return CompositeUnit(self._scale, self._bases[:], self._powers[:])\n\n    def decompose(self, bases=set()):\n        if len(bases) == 0 and self._decomposed_cache is not None:\n            return self._decomposed_cache\n\n        for base in self.bases:\n            if (not isinstance(base, IrreducibleUnit) or\n                    (len(bases) and base not in bases)):\n                break\n        else:\n            if len(bases) == 0:\n                self._decomposed_cache = self\n            return self\n\n        x = CompositeUnit(self.scale, self.bases, self.powers, decompose=True,\n                          decompose_bases=bases)\n        if len(bases) == 0:\n            self._decomposed_cache = x\n        return x\n\n    def is_unity(self):\n        unit = self.decompose()\n        return len(unit.bases) == 0 and unit.scale == 1.0"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":10224,"name":"_lexstateeoff","nodeType":"Attribute","startLoc":21,"text":"_lexstateeoff"},{"col":0,"comment":"","endLoc":13,"header":"cds_lextab.py#<anonymous>","id":10225,"name":"<anonymous>","nodeType":"Function","startLoc":13,"text":"_tabversion   = '3.10'\n\n_lextokens    = set(('CLOSE_BRACKET', 'CLOSE_PAREN', 'DIMENSIONLESS', 'DIVISION', 'OPEN_BRACKET', 'OPEN_PAREN', 'PRODUCT', 'SIGN', 'UFLOAT', 'UINT', 'UNIT', 'X'))\n\n_lexreflags   = 32\n\n_lexliterals  = ''\n\n_lexstateinfo = {'INITIAL': 'inclusive'}\n\n_lexstatere   = {'INITIAL': [('(?P<t_UFLOAT>((\\\\d+\\\\.?\\\\d+)|(\\\\.\\\\d+))([eE][+-]?\\\\d+)?)|(?P<t_UINT>\\\\d+)|(?P<t_SIGN>[+-](?=\\\\d))|(?P<t_X>[x×])|(?P<t_UNIT>\\\\%|°|\\\\\\\\h|((?!\\\\d)\\\\w)+)|(?P<t_DIMENSIONLESS>---|-)|(?P<t_PRODUCT>\\\\.)|(?P<t_OPEN_PAREN>\\\\()|(?P<t_CLOSE_PAREN>\\\\))|(?P<t_OPEN_BRACKET>\\\\[)|(?P<t_CLOSE_BRACKET>\\\\])|(?P<t_DIVISION>/)', [None, ('t_UFLOAT', 'UFLOAT'), None, None, None, None, ('t_UINT', 'UINT'), ('t_SIGN', 'SIGN'), ('t_X', 'X'), ('t_UNIT', 'UNIT'), None, ('t_DIMENSIONLESS', 'DIMENSIONLESS'), (None, 'PRODUCT'), (None, 'OPEN_PAREN'), (None, 'CLOSE_PAREN'), (None, 'OPEN_BRACKET'), (None, 'CLOSE_BRACKET'), (None, 'DIVISION')])]}\n\n_lexstateignore = {'INITIAL': ''}\n\n_lexstateerrorf = {'INITIAL': 't_error'}\n\n_lexstateeoff = {}"},{"col":4,"comment":"null","endLoc":2273,"header":"def __repr__(self)","id":10226,"name":"__repr__","nodeType":"Function","startLoc":2266,"text":"def __repr__(self):\n        if len(self._bases):\n            return super().__repr__()\n        else:\n            if self._scale != 1.0:\n                return f'Unit(dimensionless with a scale of {self._scale})'\n            else:\n                return 'Unit(dimensionless)'"},{"col":4,"comment":"null","endLoc":445,"header":"@classmethod\n    def _to_decomposed_alternative(cls, unit)","id":10227,"name":"_to_decomposed_alternative","nodeType":"Function","startLoc":431,"text":"@classmethod\n    def _to_decomposed_alternative(cls, unit):\n        # Remove units that aren't known to the format\n        unit = utils.decompose_to_known_units(unit, cls._get_unit_name)\n\n        if isinstance(unit, core.CompositeUnit):\n            # Can't use np.log10 here, because p[0] may be a Python long.\n            if math.log10(unit.scale) % 1.0 != 0.0:\n                scale = unit.scale\n                unit = copy.copy(unit)\n                unit._scale = 1.0\n                return '{} (with data multiplied by {})'.format(\n                    generic._to_string(cls, unit), scale)\n\n        return generic._to_string(unit)"},{"fileName":"generic_parsetab.py","filePath":"astropy/units/format","id":10228,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# This file was automatically generated from ply. To re-generate this file,\n# remove it from this folder, then build astropy and run the tests in-place:\n#\n#   python setup.py build_ext --inplace\n#   pytest astropy/units\n#\n# You can then commit the changes to this file.\n\n\n# generic_parsetab.py\n# This file is automatically generated. Do not edit.\n# pylint: disable=W,C,R\n_tabversion = '3.10'\n\n_lr_method = 'LALR'\n\n_lr_signature = 'CARET CLOSE_PAREN COMMA DOUBLE_STAR FUNCNAME OPEN_PAREN PERIOD SIGN SOLIDUS STAR UFLOAT UINT UNIT\\n            main : unit\\n                 | structured_unit\\n                 | structured_subunit\\n            \\n            structured_subunit : OPEN_PAREN structured_unit CLOSE_PAREN\\n            \\n            structured_unit : subunit COMMA\\n                            | subunit COMMA subunit\\n            \\n            subunit : unit\\n                    | structured_unit\\n                    | structured_subunit\\n            \\n            unit : product_of_units\\n                 | factor product_of_units\\n                 | factor product product_of_units\\n                 | division_product_of_units\\n                 | factor division_product_of_units\\n                 | factor product division_product_of_units\\n                 | inverse_unit\\n                 | factor inverse_unit\\n                 | factor product inverse_unit\\n                 | factor\\n            \\n            division_product_of_units : division_product_of_units division product_of_units\\n                                      | product_of_units\\n            \\n            inverse_unit : division unit_expression\\n            \\n            factor : factor_fits\\n                   | factor_float\\n                   | factor_int\\n            \\n            factor_float : signed_float\\n                         | signed_float UINT signed_int\\n                         | signed_float UINT power numeric_power\\n            \\n            factor_int : UINT\\n                       | UINT signed_int\\n                       | UINT power numeric_power\\n                       | UINT UINT signed_int\\n                       | UINT UINT power numeric_power\\n            \\n            factor_fits : UINT power OPEN_PAREN signed_int CLOSE_PAREN\\n                        | UINT power OPEN_PAREN UINT CLOSE_PAREN\\n                        | UINT power signed_int\\n                        | UINT power UINT\\n                        | UINT SIGN UINT\\n                        | UINT OPEN_PAREN signed_int CLOSE_PAREN\\n            \\n            product_of_units : unit_expression product product_of_units\\n                             | unit_expression product_of_units\\n                             | unit_expression\\n            \\n            unit_expression : function\\n                            | unit_with_power\\n                            | OPEN_PAREN product_of_units CLOSE_PAREN\\n            \\n            unit_with_power : UNIT power numeric_power\\n                            | UNIT numeric_power\\n                            | UNIT\\n            \\n            numeric_power : sign UINT\\n                          | OPEN_PAREN paren_expr CLOSE_PAREN\\n            \\n            paren_expr : sign UINT\\n                       | signed_float\\n                       | frac\\n            \\n            frac : sign UINT division sign UINT\\n            \\n            sign : SIGN\\n                 |\\n            \\n            product : STAR\\n                    | PERIOD\\n            \\n            division : SOLIDUS\\n            \\n            power : DOUBLE_STAR\\n                  | CARET\\n            \\n            signed_int : SIGN UINT\\n            \\n            signed_float : sign UINT\\n                         | sign UFLOAT\\n            \\n            function_name : FUNCNAME\\n            \\n            function : function_name OPEN_PAREN main CLOSE_PAREN\\n            '\n    \n_lr_action_items = {'OPEN_PAREN':([0,6,10,11,12,13,14,15,16,17,18,20,21,22,23,25,27,30,31,32,33,34,35,40,44,46,48,49,51,52,53,56,57,66,68,69,71,73,74,77,78,79,81,82,87,88,91,92,93,94,96,97,],[10,32,35,32,-23,-24,-25,32,-43,-44,45,-26,-59,51,55,-65,32,-57,-58,32,32,10,35,32,72,-30,-60,-61,10,55,-47,-63,-64,-45,-32,55,-37,-36,-31,-38,-27,55,-46,-49,-33,-62,-39,-28,-66,-50,-35,-34,]),'UINT':([0,10,18,19,20,21,23,24,34,35,44,47,48,49,51,52,54,55,56,57,69,70,72,75,79,84,98,99,],[18,18,43,-55,50,-59,-56,56,18,18,71,77,-60,-61,18,-56,82,-56,-63,-64,-56,88,89,88,-56,95,-56,100,]),'SOLIDUS':([0,5,6,7,10,11,12,13,14,16,17,18,20,23,26,27,28,30,31,34,35,37,41,46,51,53,56,57,58,59,62,66,67,68,71,73,74,77,78,81,82,87,88,91,92,93,94,95,96,97,],[21,-21,21,21,21,-42,-23,-24,-25,-43,-44,-29,-26,-48,-21,21,21,-57,-58,21,21,-21,-41,-30,21,-47,-63,-64,-21,21,-20,-45,-40,-32,-37,-36,-31,-38,-27,-46,-49,-33,-62,-39,-28,-66,-50,21,-35,-34,]),'UNIT':([0,6,10,11,12,13,14,15,16,17,18,20,21,23,27,30,31,32,33,34,35,40,46,51,53,56,57,66,68,71,73,74,77,78,81,82,87,88,91,92,93,94,96,97,],[23,23,23,23,-23,-24,-25,23,-43,-44,-29,-26,-59,-48,23,-57,-58,23,23,23,23,23,-30,23,-47,-63,-64,-45,-32,-37,-36,-31,-38,-27,-46,-49,-33,-62,-39,-28,-66,-50,-35,-34,]),'FUNCNAME':([0,6,10,11,12,13,14,15,16,17,18,20,21,23,27,30,31,32,33,34,35,40,46,51,53,56,57,66,68,71,73,74,77,78,81,82,87,88,91,92,93,94,96,97,],[25,25,25,25,-23,-24,-25,25,-43,-44,-29,-26,-59,-48,25,-57,-58,25,25,25,25,25,-30,25,-47,-63,-64,-45,-32,-37,-36,-31,-38,-27,-46,-49,-33,-62,-39,-28,-66,-50,-35,-34,]),'SIGN':([0,10,18,21,23,34,35,43,44,45,48,49,50,51,52,55,69,72,79,98,],[19,19,47,-59,19,19,19,70,75,70,-60,-61,70,19,19,19,19,75,19,19,]),'UFLOAT':([0,10,19,24,34,35,51,55,72,75,84,],[-56,-56,-55,57,-56,-56,-56,-56,-56,-55,57,]),'$end':([1,2,3,4,5,6,7,8,11,12,13,14,16,17,18,20,23,26,28,29,34,38,39,41,42,46,53,56,57,58,59,60,62,63,64,65,66,67,68,71,73,74,77,78,81,82,87,88,91,92,93,94,96,97,],[0,-1,-2,-3,-10,-19,-13,-16,-42,-23,-24,-25,-43,-44,-29,-26,-48,-11,-14,-17,-5,-7,-9,-41,-22,-30,-47,-63,-64,-12,-15,-18,-20,-6,-8,-4,-45,-40,-32,-37,-36,-31,-38,-27,-46,-49,-33,-62,-39,-28,-66,-50,-35,-34,]),'CLOSE_PAREN':([2,3,4,5,6,7,8,11,12,13,14,16,17,18,20,23,26,28,29,34,36,37,38,39,41,42,46,53,56,57,58,59,60,61,62,63,64,65,66,67,68,71,73,74,76,77,78,80,81,82,83,85,86,87,88,89,90,91,92,93,94,95,96,97,100,],[-1,-2,-3,-10,-19,-13,-16,-42,-23,-24,-25,-43,-44,-29,-26,-48,-11,-14,-17,-5,65,66,-7,-9,-41,-22,-30,-47,-63,-64,-12,-15,-18,66,-20,-6,-8,-4,-45,-40,-32,-37,-36,-31,91,-38,-27,93,-46,-49,94,-52,-53,-33,-62,96,97,-39,-28,-66,-50,-51,-35,-34,-54,]),'COMMA':([2,3,4,5,6,7,8,9,11,12,13,14,16,17,18,20,23,26,28,29,34,36,37,38,39,41,42,46,53,56,57,58,59,60,62,63,64,65,66,67,68,71,73,74,77,78,81,82,87,88,91,92,93,94,96,97,],[-7,-8,-9,-10,-19,-13,-16,34,-42,-23,-24,-25,-43,-44,-29,-26,-48,-11,-14,-17,-5,-8,-10,-7,-9,-41,-22,-30,-47,-63,-64,-12,-15,-18,-20,34,-8,-4,-45,-40,-32,-37,-36,-31,-38,-27,-46,-49,-33,-62,-39,-28,-66,-50,-35,-34,]),'STAR':([6,11,12,13,14,16,17,18,20,23,46,53,56,57,66,68,71,73,74,77,78,81,82,87,88,91,92,93,94,96,97,],[30,30,-23,-24,-25,-43,-44,-29,-26,-48,-30,-47,-63,-64,-45,-32,-37,-36,-31,-38,-27,-46,-49,-33,-62,-39,-28,-66,-50,-35,-34,]),'PERIOD':([6,11,12,13,14,16,17,18,20,23,46,53,56,57,66,68,71,73,74,77,78,81,82,87,88,91,92,93,94,96,97,],[31,31,-23,-24,-25,-43,-44,-29,-26,-48,-30,-47,-63,-64,-45,-32,-37,-36,-31,-38,-27,-46,-49,-33,-62,-39,-28,-66,-50,-35,-34,]),'DOUBLE_STAR':([18,23,43,50,],[48,48,48,48,]),'CARET':([18,23,43,50,],[49,49,49,49,]),}\n\n_lr_action = {}\nfor _k, _v in _lr_action_items.items():\n   for _x,_y in zip(_v[0],_v[1]):\n      if not _x in _lr_action:  _lr_action[_x] = {}\n      _lr_action[_x][_k] = _y\ndel _lr_action_items\n\n_lr_goto_items = {'main':([0,51,],[1,80,]),'unit':([0,10,34,35,51,],[2,38,38,38,2,]),'structured_unit':([0,10,34,35,51,],[3,36,64,36,3,]),'structured_subunit':([0,10,34,35,51,],[4,39,39,39,4,]),'product_of_units':([0,6,10,11,27,32,33,34,35,40,51,],[5,26,37,41,58,61,62,5,37,67,5,]),'factor':([0,10,34,35,51,],[6,6,6,6,6,]),'division_product_of_units':([0,6,10,27,34,35,51,],[7,28,7,59,7,7,7,]),'inverse_unit':([0,6,10,27,34,35,51,],[8,29,8,60,8,8,8,]),'subunit':([0,10,34,35,51,],[9,9,63,9,9,]),'unit_expression':([0,6,10,11,15,27,32,33,34,35,40,51,],[11,11,11,11,42,11,11,11,11,11,11,11,]),'factor_fits':([0,10,34,35,51,],[12,12,12,12,12,]),'factor_float':([0,10,34,35,51,],[13,13,13,13,13,]),'factor_int':([0,10,34,35,51,],[14,14,14,14,14,]),'division':([0,6,7,10,27,28,34,35,51,59,95,],[15,15,33,15,15,33,15,15,15,33,98,]),'function':([0,6,10,11,15,27,32,33,34,35,40,51,],[16,16,16,16,16,16,16,16,16,16,16,16,]),'unit_with_power':([0,6,10,11,15,27,32,33,34,35,40,51,],[17,17,17,17,17,17,17,17,17,17,17,17,]),'signed_float':([0,10,34,35,51,55,72,],[20,20,20,20,20,85,85,]),'function_name':([0,6,10,11,15,27,32,33,34,35,40,51,],[22,22,22,22,22,22,22,22,22,22,22,22,]),'sign':([0,10,23,34,35,44,51,52,55,69,72,79,98,],[24,24,54,24,24,54,24,54,84,54,84,54,99,]),'product':([6,11,],[27,40,]),'power':([18,23,43,50,],[44,52,69,79,]),'signed_int':([18,43,44,45,50,72,],[46,68,73,76,78,90,]),'numeric_power':([23,44,52,69,79,],[53,74,81,87,92,]),'paren_expr':([55,72,],[83,83,]),'frac':([55,72,],[86,86,]),}\n\n_lr_goto = {}\nfor _k, _v in _lr_goto_items.items():\n   for _x, _y in zip(_v[0], _v[1]):\n       if not _x in _lr_goto: _lr_goto[_x] = {}\n       _lr_goto[_x][_k] = _y\ndel _lr_goto_items\n_lr_productions = [\n  (\"S' -> main\",\"S'\",1,None,None,None),\n  ('main -> unit','main',1,'p_main','generic.py',196),\n  ('main -> structured_unit','main',1,'p_main','generic.py',197),\n  ('main -> structured_subunit','main',1,'p_main','generic.py',198),\n  ('structured_subunit -> OPEN_PAREN structured_unit CLOSE_PAREN','structured_subunit',3,'p_structured_subunit','generic.py',209),\n  ('structured_unit -> subunit COMMA','structured_unit',2,'p_structured_unit','generic.py',218),\n  ('structured_unit -> subunit COMMA subunit','structured_unit',3,'p_structured_unit','generic.py',219),\n  ('subunit -> unit','subunit',1,'p_subunit','generic.py',241),\n  ('subunit -> structured_unit','subunit',1,'p_subunit','generic.py',242),\n  ('subunit -> structured_subunit','subunit',1,'p_subunit','generic.py',243),\n  ('unit -> product_of_units','unit',1,'p_unit','generic.py',249),\n  ('unit -> factor product_of_units','unit',2,'p_unit','generic.py',250),\n  ('unit -> factor product product_of_units','unit',3,'p_unit','generic.py',251),\n  ('unit -> division_product_of_units','unit',1,'p_unit','generic.py',252),\n  ('unit -> factor division_product_of_units','unit',2,'p_unit','generic.py',253),\n  ('unit -> factor product division_product_of_units','unit',3,'p_unit','generic.py',254),\n  ('unit -> inverse_unit','unit',1,'p_unit','generic.py',255),\n  ('unit -> factor inverse_unit','unit',2,'p_unit','generic.py',256),\n  ('unit -> factor product inverse_unit','unit',3,'p_unit','generic.py',257),\n  ('unit -> factor','unit',1,'p_unit','generic.py',258),\n  ('division_product_of_units -> division_product_of_units division product_of_units','division_product_of_units',3,'p_division_product_of_units','generic.py',270),\n  ('division_product_of_units -> product_of_units','division_product_of_units',1,'p_division_product_of_units','generic.py',271),\n  ('inverse_unit -> division unit_expression','inverse_unit',2,'p_inverse_unit','generic.py',281),\n  ('factor -> factor_fits','factor',1,'p_factor','generic.py',287),\n  ('factor -> factor_float','factor',1,'p_factor','generic.py',288),\n  ('factor -> factor_int','factor',1,'p_factor','generic.py',289),\n  ('factor_float -> signed_float','factor_float',1,'p_factor_float','generic.py',295),\n  ('factor_float -> signed_float UINT signed_int','factor_float',3,'p_factor_float','generic.py',296),\n  ('factor_float -> signed_float UINT power numeric_power','factor_float',4,'p_factor_float','generic.py',297),\n  ('factor_int -> UINT','factor_int',1,'p_factor_int','generic.py',310),\n  ('factor_int -> UINT signed_int','factor_int',2,'p_factor_int','generic.py',311),\n  ('factor_int -> UINT power numeric_power','factor_int',3,'p_factor_int','generic.py',312),\n  ('factor_int -> UINT UINT signed_int','factor_int',3,'p_factor_int','generic.py',313),\n  ('factor_int -> UINT UINT power numeric_power','factor_int',4,'p_factor_int','generic.py',314),\n  ('factor_fits -> UINT power OPEN_PAREN signed_int CLOSE_PAREN','factor_fits',5,'p_factor_fits','generic.py',332),\n  ('factor_fits -> UINT power OPEN_PAREN UINT CLOSE_PAREN','factor_fits',5,'p_factor_fits','generic.py',333),\n  ('factor_fits -> UINT power signed_int','factor_fits',3,'p_factor_fits','generic.py',334),\n  ('factor_fits -> UINT power UINT','factor_fits',3,'p_factor_fits','generic.py',335),\n  ('factor_fits -> UINT SIGN UINT','factor_fits',3,'p_factor_fits','generic.py',336),\n  ('factor_fits -> UINT OPEN_PAREN signed_int CLOSE_PAREN','factor_fits',4,'p_factor_fits','generic.py',337),\n  ('product_of_units -> unit_expression product product_of_units','product_of_units',3,'p_product_of_units','generic.py',356),\n  ('product_of_units -> unit_expression product_of_units','product_of_units',2,'p_product_of_units','generic.py',357),\n  ('product_of_units -> unit_expression','product_of_units',1,'p_product_of_units','generic.py',358),\n  ('unit_expression -> function','unit_expression',1,'p_unit_expression','generic.py',369),\n  ('unit_expression -> unit_with_power','unit_expression',1,'p_unit_expression','generic.py',370),\n  ('unit_expression -> OPEN_PAREN product_of_units CLOSE_PAREN','unit_expression',3,'p_unit_expression','generic.py',371),\n  ('unit_with_power -> UNIT power numeric_power','unit_with_power',3,'p_unit_with_power','generic.py',380),\n  ('unit_with_power -> UNIT numeric_power','unit_with_power',2,'p_unit_with_power','generic.py',381),\n  ('unit_with_power -> UNIT','unit_with_power',1,'p_unit_with_power','generic.py',382),\n  ('numeric_power -> sign UINT','numeric_power',2,'p_numeric_power','generic.py',393),\n  ('numeric_power -> OPEN_PAREN paren_expr CLOSE_PAREN','numeric_power',3,'p_numeric_power','generic.py',394),\n  ('paren_expr -> sign UINT','paren_expr',2,'p_paren_expr','generic.py',403),\n  ('paren_expr -> signed_float','paren_expr',1,'p_paren_expr','generic.py',404),\n  ('paren_expr -> frac','paren_expr',1,'p_paren_expr','generic.py',405),\n  ('frac -> sign UINT division sign UINT','frac',5,'p_frac','generic.py',414),\n  ('sign -> SIGN','sign',1,'p_sign','generic.py',420),\n  ('sign -> <empty>','sign',0,'p_sign','generic.py',421),\n  ('product -> STAR','product',1,'p_product','generic.py',430),\n  ('product -> PERIOD','product',1,'p_product','generic.py',431),\n  ('division -> SOLIDUS','division',1,'p_division','generic.py',437),\n  ('power -> DOUBLE_STAR','power',1,'p_power','generic.py',443),\n  ('power -> CARET','power',1,'p_power','generic.py',444),\n  ('signed_int -> SIGN UINT','signed_int',2,'p_signed_int','generic.py',450),\n  ('signed_float -> sign UINT','signed_float',2,'p_signed_float','generic.py',456),\n  ('signed_float -> sign UFLOAT','signed_float',2,'p_signed_float','generic.py',457),\n  ('function_name -> FUNCNAME','function_name',1,'p_function_name','generic.py',463),\n  ('function -> function_name OPEN_PAREN main CLOSE_PAREN','function',4,'p_function','generic.py',469),\n]\n"},{"attributeType":"null","col":0,"comment":"Functions with implementations supporting subclasses like Quantity.","endLoc":54,"id":10229,"name":"SUBCLASS_SAFE_FUNCTIONS","nodeType":"Attribute","startLoc":54,"text":"SUBCLASS_SAFE_FUNCTIONS"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":10230,"name":"__all__","nodeType":"Attribute","startLoc":25,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"__init__.py#<anonymous>","id":10231,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nA collection of different unit formats.\n\"\"\"\n\ncore = sys.modules['astropy.units.core']\n\n__all__ = [\n    'Base', 'Generic', 'CDS', 'Console', 'Fits', 'Latex', 'LatexInline',\n    'OGIP', 'Unicode', 'Unscaled', 'VOUnit', 'get_format']"},{"col":4,"comment":"\n        Return the scale of the composite unit.\n        ","endLoc":2280,"header":"@property\n    def scale(self)","id":10232,"name":"scale","nodeType":"Function","startLoc":2275,"text":"@property\n    def scale(self):\n        \"\"\"\n        Return the scale of the composite unit.\n        \"\"\"\n        return self._scale"},{"col":4,"comment":"\n        Return the bases of the composite unit.\n        ","endLoc":2287,"header":"@property\n    def bases(self)","id":10233,"name":"bases","nodeType":"Function","startLoc":2282,"text":"@property\n    def bases(self):\n        \"\"\"\n        Return the bases of the composite unit.\n        \"\"\"\n        return self._bases"},{"col":4,"comment":"\n        Return the powers of the composite unit.\n        ","endLoc":2294,"header":"@property\n    def powers(self)","id":10234,"name":"powers","nodeType":"Function","startLoc":2289,"text":"@property\n    def powers(self):\n        \"\"\"\n        Return the powers of the composite unit.\n        \"\"\"\n        return self._powers"},{"fileName":"ogip_parsetab.py","filePath":"astropy/units/format","id":10235,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# This file was automatically generated from ply. To re-generate this file,\n# remove it from this folder, then build astropy and run the tests in-place:\n#\n#   python setup.py build_ext --inplace\n#   pytest astropy/units\n#\n# You can then commit the changes to this file.\n\n\n# ogip_parsetab.py\n# This file is automatically generated. Do not edit.\n# pylint: disable=W,C,R\n_tabversion = '3.10'\n\n_lr_method = 'LALR'\n\n_lr_signature = 'CLOSE_PAREN DIVISION LIT10 OPEN_PAREN SIGN STAR STARSTAR UFLOAT UINT UNIT UNKNOWN WHITESPACE\\n            main : UNKNOWN\\n                 | complete_expression\\n                 | scale_factor complete_expression\\n                 | scale_factor WHITESPACE complete_expression\\n            \\n            complete_expression : product_of_units\\n            \\n            product_of_units : unit_expression\\n                             | division unit_expression\\n                             | product_of_units product unit_expression\\n                             | product_of_units division unit_expression\\n            \\n            unit_expression : unit\\n                            | UNIT OPEN_PAREN complete_expression CLOSE_PAREN\\n                            | OPEN_PAREN complete_expression CLOSE_PAREN\\n                            | UNIT OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power\\n                            | OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power\\n            \\n            scale_factor : LIT10 power numeric_power\\n                         | LIT10\\n                         | signed_float\\n                         | signed_float power numeric_power\\n                         | signed_int power numeric_power\\n            \\n            division : DIVISION\\n                     | WHITESPACE DIVISION\\n                     | WHITESPACE DIVISION WHITESPACE\\n                     | DIVISION WHITESPACE\\n            \\n            product : WHITESPACE\\n                    | STAR\\n                    | WHITESPACE STAR\\n                    | WHITESPACE STAR WHITESPACE\\n                    | STAR WHITESPACE\\n            \\n            power : STARSTAR\\n            \\n            unit : UNIT\\n                 | UNIT power numeric_power\\n            \\n            numeric_power : UINT\\n                          | signed_float\\n                          | OPEN_PAREN signed_int CLOSE_PAREN\\n                          | OPEN_PAREN signed_float CLOSE_PAREN\\n                          | OPEN_PAREN signed_float division UINT CLOSE_PAREN\\n            \\n            sign : SIGN\\n                 |\\n            \\n            signed_int : SIGN UINT\\n            \\n            signed_float : sign UINT\\n                         | sign UFLOAT\\n            '\n    \n_lr_action_items = {'UNKNOWN':([0,],[2,]),'LIT10':([0,],[7,]),'SIGN':([0,25,26,27,28,34,47,59,63,],[13,48,-29,48,48,48,13,48,48,]),'UNIT':([0,4,7,8,11,16,17,19,20,21,22,23,24,30,31,33,36,38,39,42,43,44,45,46,49,50,54,55,60,61,67,],[15,15,-16,-17,15,15,-20,15,-21,15,15,-24,-25,-40,-41,15,-23,-20,-22,-26,-28,-15,-32,-33,-18,-19,-22,-27,-34,-35,-36,]),'OPEN_PAREN':([0,4,7,8,11,15,16,17,19,20,21,22,23,24,25,26,27,28,30,31,33,34,36,38,39,42,43,44,45,46,49,50,54,55,59,60,61,63,67,],[16,16,-16,-17,16,33,16,-20,16,-21,16,16,-24,-25,47,-29,47,47,-40,-41,16,47,-23,-20,-22,-26,-28,-15,-32,-33,-18,-19,-22,-27,47,-34,-35,47,-36,]),'DIVISION':([0,4,5,6,7,8,10,14,15,16,19,23,29,30,31,33,40,41,44,45,46,49,50,52,53,57,58,60,61,64,66,67,],[17,17,20,17,-16,-17,-6,-10,-30,17,38,20,-7,-40,-41,17,-8,-9,-15,-32,-33,-18,-19,-31,-12,17,-11,-34,-35,-14,-13,-36,]),'WHITESPACE':([0,4,6,7,8,10,14,15,16,17,19,20,24,29,30,31,33,38,40,41,42,44,45,46,49,50,52,53,57,58,60,61,64,66,67,],[5,19,23,-16,-17,-6,-10,-30,5,36,5,39,43,-7,-40,-41,5,54,-8,-9,55,-15,-32,-33,-18,-19,-31,-12,5,-11,-34,-35,-14,-13,-36,]),'UINT':([0,12,13,17,20,25,26,27,28,34,36,39,47,48,59,62,63,],[-38,30,32,-20,-21,45,-29,45,45,45,-23,-22,-38,-37,45,65,45,]),'UFLOAT':([0,12,13,25,26,27,28,34,47,48,59,63,],[-38,31,-37,-38,-29,-38,-38,-38,-38,-37,-38,-38,]),'$end':([1,2,3,6,10,14,15,18,29,30,31,37,40,41,45,46,52,53,58,60,61,64,66,67,],[0,-1,-2,-5,-6,-10,-30,-3,-7,-40,-41,-4,-8,-9,-32,-33,-31,-12,-11,-34,-35,-14,-13,-36,]),'CLOSE_PAREN':([6,10,14,15,29,30,31,32,35,40,41,45,46,51,52,53,56,57,58,60,61,64,65,66,67,],[-5,-6,-10,-30,-7,-40,-41,-39,53,-8,-9,-32,-33,58,-31,-12,60,61,-11,-34,-35,-14,67,-13,-36,]),'STAR':([6,10,14,15,23,29,30,31,40,41,45,46,52,53,58,60,61,64,66,67,],[24,-6,-10,-30,42,-7,-40,-41,-8,-9,-32,-33,-31,-12,-11,-34,-35,-14,-13,-36,]),'STARSTAR':([7,8,9,15,30,31,32,53,58,],[26,26,26,26,-40,-41,-39,26,26,]),}\n\n_lr_action = {}\nfor _k, _v in _lr_action_items.items():\n   for _x,_y in zip(_v[0],_v[1]):\n      if not _x in _lr_action:  _lr_action[_x] = {}\n      _lr_action[_x][_k] = _y\ndel _lr_action_items\n\n_lr_goto_items = {'main':([0,],[1,]),'complete_expression':([0,4,16,19,33,],[3,18,35,37,51,]),'scale_factor':([0,],[4,]),'product_of_units':([0,4,16,19,33,],[6,6,6,6,6,]),'signed_float':([0,25,27,28,34,47,59,63,],[8,46,46,46,46,57,46,46,]),'signed_int':([0,47,],[9,56,]),'unit_expression':([0,4,11,16,19,21,22,33,],[10,10,29,10,10,40,41,10,]),'division':([0,4,6,16,19,33,57,],[11,11,22,11,11,11,62,]),'sign':([0,25,27,28,34,47,59,63,],[12,12,12,12,12,12,12,12,]),'unit':([0,4,11,16,19,21,22,33,],[14,14,14,14,14,14,14,14,]),'product':([6,],[21,]),'power':([7,8,9,15,53,58,],[25,27,28,34,59,63,]),'numeric_power':([25,27,28,34,59,63,],[44,49,50,52,64,66,]),}\n\n_lr_goto = {}\nfor _k, _v in _lr_goto_items.items():\n   for _x, _y in zip(_v[0], _v[1]):\n       if not _x in _lr_goto: _lr_goto[_x] = {}\n       _lr_goto[_x][_k] = _y\ndel _lr_goto_items\n_lr_productions = [\n  (\"S' -> main\",\"S'\",1,None,None,None),\n  ('main -> UNKNOWN','main',1,'p_main','ogip.py',184),\n  ('main -> complete_expression','main',1,'p_main','ogip.py',185),\n  ('main -> scale_factor complete_expression','main',2,'p_main','ogip.py',186),\n  ('main -> scale_factor WHITESPACE complete_expression','main',3,'p_main','ogip.py',187),\n  ('complete_expression -> product_of_units','complete_expression',1,'p_complete_expression','ogip.py',198),\n  ('product_of_units -> unit_expression','product_of_units',1,'p_product_of_units','ogip.py',204),\n  ('product_of_units -> division unit_expression','product_of_units',2,'p_product_of_units','ogip.py',205),\n  ('product_of_units -> product_of_units product unit_expression','product_of_units',3,'p_product_of_units','ogip.py',206),\n  ('product_of_units -> product_of_units division unit_expression','product_of_units',3,'p_product_of_units','ogip.py',207),\n  ('unit_expression -> unit','unit_expression',1,'p_unit_expression','ogip.py',221),\n  ('unit_expression -> UNIT OPEN_PAREN complete_expression CLOSE_PAREN','unit_expression',4,'p_unit_expression','ogip.py',222),\n  ('unit_expression -> OPEN_PAREN complete_expression CLOSE_PAREN','unit_expression',3,'p_unit_expression','ogip.py',223),\n  ('unit_expression -> UNIT OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power','unit_expression',6,'p_unit_expression','ogip.py',224),\n  ('unit_expression -> OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power','unit_expression',5,'p_unit_expression','ogip.py',225),\n  ('scale_factor -> LIT10 power numeric_power','scale_factor',3,'p_scale_factor','ogip.py',259),\n  ('scale_factor -> LIT10','scale_factor',1,'p_scale_factor','ogip.py',260),\n  ('scale_factor -> signed_float','scale_factor',1,'p_scale_factor','ogip.py',261),\n  ('scale_factor -> signed_float power numeric_power','scale_factor',3,'p_scale_factor','ogip.py',262),\n  ('scale_factor -> signed_int power numeric_power','scale_factor',3,'p_scale_factor','ogip.py',263),\n  ('division -> DIVISION','division',1,'p_division','ogip.py',278),\n  ('division -> WHITESPACE DIVISION','division',2,'p_division','ogip.py',279),\n  ('division -> WHITESPACE DIVISION WHITESPACE','division',3,'p_division','ogip.py',280),\n  ('division -> DIVISION WHITESPACE','division',2,'p_division','ogip.py',281),\n  ('product -> WHITESPACE','product',1,'p_product','ogip.py',287),\n  ('product -> STAR','product',1,'p_product','ogip.py',288),\n  ('product -> WHITESPACE STAR','product',2,'p_product','ogip.py',289),\n  ('product -> WHITESPACE STAR WHITESPACE','product',3,'p_product','ogip.py',290),\n  ('product -> STAR WHITESPACE','product',2,'p_product','ogip.py',291),\n  ('power -> STARSTAR','power',1,'p_power','ogip.py',297),\n  ('unit -> UNIT','unit',1,'p_unit','ogip.py',303),\n  ('unit -> UNIT power numeric_power','unit',3,'p_unit','ogip.py',304),\n  ('numeric_power -> UINT','numeric_power',1,'p_numeric_power','ogip.py',313),\n  ('numeric_power -> signed_float','numeric_power',1,'p_numeric_power','ogip.py',314),\n  ('numeric_power -> OPEN_PAREN signed_int CLOSE_PAREN','numeric_power',3,'p_numeric_power','ogip.py',315),\n  ('numeric_power -> OPEN_PAREN signed_float CLOSE_PAREN','numeric_power',3,'p_numeric_power','ogip.py',316),\n  ('numeric_power -> OPEN_PAREN signed_float division UINT CLOSE_PAREN','numeric_power',5,'p_numeric_power','ogip.py',317),\n  ('sign -> SIGN','sign',1,'p_sign','ogip.py',328),\n  ('sign -> <empty>','sign',0,'p_sign','ogip.py',329),\n  ('signed_int -> SIGN UINT','signed_int',2,'p_signed_int','ogip.py',338),\n  ('signed_float -> sign UINT','signed_float',2,'p_signed_float','ogip.py',344),\n  ('signed_float -> sign UFLOAT','signed_float',2,'p_signed_float','ogip.py',345),\n]\n"},{"col":4,"comment":"\n        For compatibility with python copy module.\n        ","endLoc":2341,"header":"def __copy__(self)","id":10236,"name":"__copy__","nodeType":"Function","startLoc":2337,"text":"def __copy__(self):\n        \"\"\"\n        For compatibility with python copy module.\n        \"\"\"\n        return CompositeUnit(self._scale, self._bases[:], self._powers[:])"},{"attributeType":"null","col":4,"comment":"null","endLoc":39,"id":10237,"name":"_tokens","nodeType":"Attribute","startLoc":39,"text":"_tokens"},{"col":4,"comment":"null","endLoc":2360,"header":"def decompose(self, bases=set())","id":10238,"name":"decompose","nodeType":"Function","startLoc":2343,"text":"def decompose(self, bases=set()):\n        if len(bases) == 0 and self._decomposed_cache is not None:\n            return self._decomposed_cache\n\n        for base in self.bases:\n            if (not isinstance(base, IrreducibleUnit) or\n                    (len(bases) and base not in bases)):\n                break\n        else:\n            if len(bases) == 0:\n                self._decomposed_cache = self\n            return self\n\n        x = CompositeUnit(self.scale, self.bases, self.powers, decompose=True,\n                          decompose_bases=bases)\n        if len(bases) == 0:\n            self._decomposed_cache = x\n        return x"},{"col":0,"comment":"","endLoc":18,"header":"ogip.py#<anonymous>","id":10239,"name":"<anonymous>","nodeType":"Function","startLoc":14,"text":"\"\"\"\nHandles units in `Office of Guest Investigator Programs (OGIP)\nFITS files\n<https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/general/ogip_93_001/>`__.\n\"\"\""},{"col":4,"comment":"null","endLoc":284,"header":"@classmethod\n    def _get_unit(cls, t)","id":10240,"name":"_get_unit","nodeType":"Function","startLoc":274,"text":"@classmethod\n    def _get_unit(cls, t):\n        try:\n            return cls._parse_unit(t.value)\n        except ValueError as e:\n            registry = core.get_current_unit_registry()\n            if t.value in registry.aliases:\n                return registry.aliases[t.value]\n\n            raise ValueError(\n                f\"At col {t.lexpos}, {str(e)}\")"},{"col":4,"comment":"null","endLoc":298,"header":"@classmethod\n    def _parse_unit(cls, unit, detailed_exception=True)","id":10241,"name":"_parse_unit","nodeType":"Function","startLoc":286,"text":"@classmethod\n    def _parse_unit(cls, unit, detailed_exception=True):\n        if unit not in cls._units:\n            if detailed_exception:\n                raise ValueError(\n                    \"Unit '{}' not supported by the CDS SAC \"\n                    \"standard. {}\".format(\n                        unit, did_you_mean(\n                            unit, cls._units)))\n            else:\n                raise ValueError()\n\n        return cls._units[unit]"},{"fileName":"base.py","filePath":"astropy/units/format","id":10242,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nclass Base:\n    \"\"\"\n    The abstract base class of all unit formats.\n    \"\"\"\n    registry = {}\n\n    def __new__(cls, *args, **kwargs):\n        # This __new__ is to make it clear that there is no reason to\n        # instantiate a Formatter--if you try to you'll just get back the\n        # class\n        return cls\n\n    def __init_subclass__(cls, **kwargs):\n        # Keep a registry of all formats.  Key by the class name unless a name\n        # is explicitly set (i.e., one *not* inherited from a superclass).\n        if 'name' not in cls.__dict__:\n            cls.name = cls.__name__.lower()\n\n        Base.registry[cls.name] = cls\n        super().__init_subclass__(**kwargs)\n\n    @classmethod\n    def parse(cls, s):\n        \"\"\"\n        Convert a string to a unit object.\n        \"\"\"\n\n        raise NotImplementedError(\n            f\"Can not parse with {cls.__name__} format\")\n\n    @classmethod\n    def to_string(cls, u):\n        \"\"\"\n        Convert a unit object to a string.\n        \"\"\"\n\n        raise NotImplementedError(\n            f\"Can not output in {cls.__name__} format\")\n"},{"id":10243,"name":"astropy/units/function","nodeType":"Package"},{"fileName":"core.py","filePath":"astropy/units/function","id":10244,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"Function Units and Quantities.\"\"\"\n\nfrom abc import ABCMeta, abstractmethod\n\nimport numpy as np\n\nfrom astropy.units import (Unit, UnitBase, UnitsError, UnitTypeError, UnitConversionError,\n                           dimensionless_unscaled, Quantity)\n\n__all__ = ['FunctionUnitBase', 'FunctionQuantity']\n\nSUPPORTED_UFUNCS = set(getattr(np.core.umath, ufunc) for ufunc in (\n    'isfinite', 'isinf', 'isnan', 'sign', 'signbit',\n    'rint', 'floor', 'ceil', 'trunc',\n    '_ones_like', 'ones_like', 'positive') if hasattr(np.core.umath, ufunc))\n\n# TODO: the following could work if helper changed relative to Quantity:\n# - spacing should return dimensionless, not same unit\n# - negative should negate unit too,\n# - add, subtract, comparisons can work if units added/subtracted\n\nSUPPORTED_FUNCTIONS = set(getattr(np, function) for function in\n                          ('clip', 'trace', 'mean', 'min', 'max', 'round'))\n\n\n# subclassing UnitBase or CompositeUnit was found to be problematic, requiring\n# a large number of overrides. Hence, define new class.\nclass FunctionUnitBase(metaclass=ABCMeta):\n    \"\"\"Abstract base class for function units.\n\n    Function units are functions containing a physical unit, such as dB(mW).\n    Most of the arithmetic operations on function units are defined in this\n    base class.\n\n    While instantiation is defined, this class should not be used directly.\n    Rather, subclasses should be used that override the abstract properties\n    `_default_function_unit` and `_quantity_class`, and the abstract methods\n    `from_physical`, and `to_physical`.\n\n    Parameters\n    ----------\n    physical_unit : `~astropy.units.Unit` or `string`\n        Unit that is encapsulated within the function unit.\n        If not given, dimensionless.\n\n    function_unit :  `~astropy.units.Unit` or `string`\n        By default, the same as the function unit set by the subclass.\n    \"\"\"\n    # ↓↓↓ the following four need to be set by subclasses\n    # Make this a property so we can ensure subclasses define it.\n    @property\n    @abstractmethod\n    def _default_function_unit(self):\n        \"\"\"Default function unit corresponding to the function.\n\n        This property should be overridden by subclasses, with, e.g.,\n        `~astropy.unit.MagUnit` returning `~astropy.unit.mag`.\n        \"\"\"\n\n    # This has to be a property because the function quantity will not be\n    # known at unit definition time, as it gets defined after.\n    @property\n    @abstractmethod\n    def _quantity_class(self):\n        \"\"\"Function quantity class corresponding to this function unit.\n\n        This property should be overridden by subclasses, with, e.g.,\n        `~astropy.unit.MagUnit` returning `~astropy.unit.Magnitude`.\n        \"\"\"\n\n    @abstractmethod\n    def from_physical(self, x):\n        \"\"\"Transformation from value in physical to value in function units.\n\n        This method should be overridden by subclasses.  It is used to\n        provide automatic transformations using an equivalency.\n        \"\"\"\n\n    @abstractmethod\n    def to_physical(self, x):\n        \"\"\"Transformation from value in function to value in physical units.\n\n        This method should be overridden by subclasses.  It is used to\n        provide automatic transformations using an equivalency.\n        \"\"\"\n    # ↑↑↑ the above four need to be set by subclasses\n\n    # have priority over arrays, regular units, and regular quantities\n    __array_priority__ = 30000\n\n    def __init__(self, physical_unit=None, function_unit=None):\n        if physical_unit is None:\n            self._physical_unit = dimensionless_unscaled\n        else:\n            self._physical_unit = Unit(physical_unit)\n            if (not isinstance(self._physical_unit, UnitBase) or\n                self._physical_unit.is_equivalent(\n                    self._default_function_unit)):\n                raise UnitConversionError(\"Unit {} is not a physical unit.\"\n                                          .format(self._physical_unit))\n\n        if function_unit is None:\n            self._function_unit = self._default_function_unit\n        else:\n            # any function unit should be equivalent to subclass default\n            function_unit = Unit(getattr(function_unit, 'function_unit',\n                                         function_unit))\n            if function_unit.is_equivalent(self._default_function_unit):\n                self._function_unit = function_unit\n            else:\n                raise UnitConversionError(\n                    \"Cannot initialize '{}' instance with function unit '{}'\"\n                    \", as it is not equivalent to default function unit '{}'.\"\n                    .format(self.__class__.__name__, function_unit,\n                            self._default_function_unit))\n\n    def _copy(self, physical_unit=None):\n        \"\"\"Copy oneself, possibly with a different physical unit.\"\"\"\n        if physical_unit is None:\n            physical_unit = self.physical_unit\n        return self.__class__(physical_unit, self.function_unit)\n\n    @property\n    def physical_unit(self):\n        return self._physical_unit\n\n    @property\n    def function_unit(self):\n        return self._function_unit\n\n    @property\n    def equivalencies(self):\n        \"\"\"List of equivalencies between function and physical units.\n\n        Uses the `from_physical` and `to_physical` methods.\n        \"\"\"\n        return [(self, self.physical_unit,\n                 self.to_physical, self.from_physical)]\n\n    # ↓↓↓ properties/methods required to behave like a unit\n    def decompose(self, bases=set()):\n        \"\"\"Copy the current unit with the physical unit decomposed.\n\n        For details, see `~astropy.units.UnitBase.decompose`.\n        \"\"\"\n        return self._copy(self.physical_unit.decompose(bases))\n\n    @property\n    def si(self):\n        \"\"\"Copy the current function unit with the physical unit in SI.\"\"\"\n        return self._copy(self.physical_unit.si)\n\n    @property\n    def cgs(self):\n        \"\"\"Copy the current function unit with the physical unit in CGS.\"\"\"\n        return self._copy(self.physical_unit.cgs)\n\n    def _get_physical_type_id(self):\n        \"\"\"Get physical type corresponding to physical unit.\"\"\"\n        return self.physical_unit._get_physical_type_id()\n\n    @property\n    def physical_type(self):\n        \"\"\"Return the physical type of the physical unit (e.g., 'length').\"\"\"\n        return self.physical_unit.physical_type\n\n    def is_equivalent(self, other, equivalencies=[]):\n        \"\"\"\n        Returns `True` if this unit is equivalent to ``other``.\n\n        Parameters\n        ----------\n        other : `~astropy.units.Unit`, string, or tuple\n            The unit to convert to. If a tuple of units is specified, this\n            method returns true if the unit matches any of those in the tuple.\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            This list is in addition to the built-in equivalencies between the\n            function unit and the physical one, as well as possible global\n            defaults set by, e.g., `~astropy.units.set_enabled_equivalencies`.\n            Use `None` to turn off any global equivalencies.\n\n        Returns\n        -------\n        bool\n        \"\"\"\n        if isinstance(other, tuple):\n            return any(self.is_equivalent(u, equivalencies=equivalencies)\n                       for u in other)\n\n        other_physical_unit = getattr(other, 'physical_unit', (\n            dimensionless_unscaled if self.function_unit.is_equivalent(other)\n            else other))\n\n        return self.physical_unit.is_equivalent(other_physical_unit,\n                                                equivalencies)\n\n    def to(self, other, value=1., equivalencies=[]):\n        \"\"\"\n        Return the converted values in the specified unit.\n\n        Parameters\n        ----------\n        other : `~astropy.units.Unit`, `~astropy.units.function.FunctionUnitBase`, or str\n            The unit to convert to.\n\n        value : int, float, or scalar array-like, optional\n            Value(s) in the current unit to be converted to the specified unit.\n            If not provided, defaults to 1.0.\n\n        equivalencies : list of tuple\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`astropy:unit_equivalencies`.\n            This list is in meant to treat only equivalencies between different\n            physical units; the built-in equivalency between the function\n            unit and the physical one is automatically taken into account.\n\n        Returns\n        -------\n        values : scalar or array\n            Converted value(s). Input value sequences are returned as\n            numpy arrays.\n\n        Raises\n        ------\n        `~astropy.units.UnitsError`\n            If units are inconsistent.\n        \"\"\"\n        # conversion to one's own physical unit should be fastest\n        if other is self.physical_unit:\n            return self.to_physical(value)\n\n        other_function_unit = getattr(other, 'function_unit', other)\n        if self.function_unit.is_equivalent(other_function_unit):\n            # when other is an equivalent function unit:\n            # first convert physical units to other's physical units\n            other_physical_unit = getattr(other, 'physical_unit',\n                                          dimensionless_unscaled)\n            if self.physical_unit != other_physical_unit:\n                value_other_physical = self.physical_unit.to(\n                    other_physical_unit, self.to_physical(value),\n                    equivalencies)\n                # make function unit again, in own system\n                value = self.from_physical(value_other_physical)\n\n            # convert possible difference in function unit (e.g., dex->dB)\n            return self.function_unit.to(other_function_unit, value)\n\n        else:\n            try:\n                # when other is not a function unit\n                return self.physical_unit.to(other, self.to_physical(value),\n                                             equivalencies)\n            except UnitConversionError as e:\n                if self.function_unit == Unit('mag'):\n                    # One can get to raw magnitudes via math that strips the dimensions off.\n                    # Include extra information in the exception to remind users of this.\n                    msg = \"Did you perhaps subtract magnitudes so the unit got lost?\"\n                    e.args += (msg,)\n                    raise e\n                else:\n                    raise\n\n    def is_unity(self):\n        return False\n\n    def __eq__(self, other):\n        return (self.physical_unit == getattr(other, 'physical_unit',\n                                              dimensionless_unscaled) and\n                self.function_unit == getattr(other, 'function_unit', other))\n\n    def __ne__(self, other):\n        return not self.__eq__(other)\n\n    def __rlshift__(self, other):\n        \"\"\"Unit conversion operator ``<<``\"\"\"\n        try:\n            return self._quantity_class(other, self, copy=False, subok=True)\n        except Exception:\n            return NotImplemented\n\n    def __mul__(self, other):\n        if isinstance(other, (str, UnitBase, FunctionUnitBase)):\n            if self.physical_unit == dimensionless_unscaled:\n                # If dimensionless, drop back to normal unit and retry.\n                return self.function_unit * other\n            else:\n                raise UnitsError(\"Cannot multiply a function unit \"\n                                 \"with a physical dimension with any unit.\")\n        else:\n            # Anything not like a unit, try initialising as a function quantity.\n            try:\n                return self._quantity_class(other, unit=self)\n            except Exception:\n                return NotImplemented\n\n    def __rmul__(self, other):\n        return self.__mul__(other)\n\n    def __truediv__(self, other):\n        if isinstance(other, (str, UnitBase, FunctionUnitBase)):\n            if self.physical_unit == dimensionless_unscaled:\n                # If dimensionless, drop back to normal unit and retry.\n                return self.function_unit / other\n            else:\n                raise UnitsError(\"Cannot divide a function unit \"\n                                 \"with a physical dimension by any unit.\")\n        else:\n            # Anything not like a unit, try initialising as a function quantity.\n            try:\n                return self._quantity_class(1./other, unit=self)\n            except Exception:\n                return NotImplemented\n\n    def __rtruediv__(self, other):\n        if isinstance(other, (str, UnitBase, FunctionUnitBase)):\n            if self.physical_unit == dimensionless_unscaled:\n                # If dimensionless, drop back to normal unit and retry.\n                return other / self.function_unit\n            else:\n                raise UnitsError(\"Cannot divide a function unit \"\n                                 \"with a physical dimension into any unit\")\n        else:\n            # Don't know what to do with anything not like a unit.\n            return NotImplemented\n\n    def __pow__(self, power):\n        if power == 0:\n            return dimensionless_unscaled\n        elif power == 1:\n            return self._copy()\n\n        if self.physical_unit == dimensionless_unscaled:\n            return self.function_unit ** power\n\n        raise UnitsError(\"Cannot raise a function unit \"\n                         \"with a physical dimension to any power but 0 or 1.\")\n\n    def __pos__(self):\n        return self._copy()\n\n    def to_string(self, format='generic'):\n        \"\"\"\n        Output the unit in the given format as a string.\n\n        The physical unit is appended, within parentheses, to the function\n        unit, as in \"dB(mW)\", with both units set using the given format\n\n        Parameters\n        ----------\n        format : `astropy.units.format.Base` instance or str\n            The name of a format or a formatter object.  If not\n            provided, defaults to the generic format.\n        \"\"\"\n        if format not in ('generic', 'unscaled', 'latex'):\n            raise ValueError(\"Function units cannot be written in {} format. \"\n                             \"Only 'generic', 'unscaled' and 'latex' are \"\n                             \"supported.\".format(format))\n        self_str = self.function_unit.to_string(format)\n        pu_str = self.physical_unit.to_string(format)\n        if pu_str == '':\n            pu_str = '1'\n        if format == 'latex':\n            self_str += r'$\\mathrm{{\\left( {0} \\right)}}$'.format(\n                pu_str[1:-1])   # need to strip leading and trailing \"$\"\n        else:\n            self_str += f'({pu_str})'\n        return self_str\n\n    def __str__(self):\n        \"\"\"Return string representation for unit.\"\"\"\n        self_str = str(self.function_unit)\n        pu_str = str(self.physical_unit)\n        if pu_str:\n            self_str += f'({pu_str})'\n        return self_str\n\n    def __repr__(self):\n        # By default, try to give a representation using `Unit(<string>)`,\n        # with string such that parsing it would give the correct FunctionUnit.\n        if callable(self.function_unit):\n            return f'Unit(\"{self.to_string()}\")'\n\n        else:\n            return '{}(\"{}\"{})'.format(\n                self.__class__.__name__, self.physical_unit,\n                \"\" if self.function_unit is self._default_function_unit\n                else f', unit=\"{self.function_unit}\"')\n\n    def _repr_latex_(self):\n        \"\"\"\n        Generate latex representation of unit name.  This is used by\n        the IPython notebook to print a unit with a nice layout.\n\n        Returns\n        -------\n        Latex string\n        \"\"\"\n        return self.to_string('latex')\n\n    def __hash__(self):\n        return hash((self.function_unit, self.physical_unit))\n\n\nclass FunctionQuantity(Quantity):\n    \"\"\"A representation of a (scaled) function of a number with a unit.\n\n    Function quantities are quantities whose units are functions containing a\n    physical unit, such as dB(mW).  Most of the arithmetic operations on\n    function quantities are defined in this base class.\n\n    While instantiation is also defined here, this class should not be\n    instantiated directly.  Rather, subclasses should be made which have\n    ``_unit_class`` pointing back to the corresponding function unit class.\n\n    Parameters\n    ----------\n    value : number, quantity-like, or sequence thereof\n        The numerical value of the function quantity. If a number or\n        a `~astropy.units.Quantity` with a function unit, it will be converted\n        to ``unit`` and the physical unit will be inferred from ``unit``.\n        If a `~astropy.units.Quantity` with just a physical unit, it will\n        converted to the function unit, after, if necessary, converting it to\n        the physical unit inferred from ``unit``.\n\n    unit : str, `~astropy.units.UnitBase`, or `~astropy.units.function.FunctionUnitBase`, optional\n        For an `~astropy.units.function.FunctionUnitBase` instance, the\n        physical unit will be taken from it; for other input, it will be\n        inferred from ``value``. By default, ``unit`` is set by the subclass.\n\n    dtype : `~numpy.dtype`, optional\n        The dtype of the resulting Numpy array or scalar that will\n        hold the value.  If not provided, it is determined from the input,\n        except that any input that cannot represent float (integer and bool)\n        is converted to float.\n\n    copy : bool, optional\n        If `True` (default), then the value is copied.  Otherwise, a copy will\n        only be made if ``__array__`` returns a copy, if value is a nested\n        sequence, or if a copy is needed to satisfy an explicitly given\n        ``dtype``.  (The `False` option is intended mostly for internal use,\n        to speed up initialization where a copy is known to have been made.\n        Use with care.)\n\n    order : {'C', 'F', 'A'}, optional\n        Specify the order of the array.  As in `~numpy.array`.  Ignored\n        if the input does not need to be converted and ``copy=False``.\n\n    subok : bool, optional\n        If `False` (default), the returned array will be forced to be of the\n        class used.  Otherwise, subclasses will be passed through.\n\n    ndmin : int, optional\n        Specifies the minimum number of dimensions that the resulting array\n        should have.  Ones will be pre-pended to the shape as needed to meet\n        this requirement.  This parameter is ignored if the input is a\n        `~astropy.units.Quantity` and ``copy=False``.\n\n    Raises\n    ------\n    TypeError\n        If the value provided is not a Python numeric type.\n    TypeError\n        If the unit provided is not a `~astropy.units.function.FunctionUnitBase`\n        or `~astropy.units.Unit` object, or a parseable string unit.\n    \"\"\"\n\n    _unit_class = None\n    \"\"\"Default `~astropy.units.function.FunctionUnitBase` subclass.\n\n    This should be overridden by subclasses.\n    \"\"\"\n\n    # Ensure priority over ndarray, regular Unit & Quantity, and FunctionUnit.\n    __array_priority__ = 40000\n\n    # Define functions that work on FunctionQuantity.\n    _supported_ufuncs = SUPPORTED_UFUNCS\n    _supported_functions = SUPPORTED_FUNCTIONS\n\n    def __new__(cls, value, unit=None, dtype=None, copy=True, order=None,\n                subok=False, ndmin=0):\n\n        if unit is not None:\n            # Convert possible string input to a (function) unit.\n            unit = Unit(unit)\n\n        if not isinstance(unit, FunctionUnitBase):\n            # By default, use value's physical unit.\n            value_unit = getattr(value, 'unit', None)\n            if value_unit is None:\n                # if iterable, see if first item has a unit\n                # (mixed lists fail in super call below).\n                try:\n                    value_unit = getattr(value[0], 'unit')\n                except Exception:\n                    pass\n            physical_unit = getattr(value_unit, 'physical_unit', value_unit)\n            unit = cls._unit_class(physical_unit, function_unit=unit)\n\n        # initialise!\n        return super().__new__(cls, value, unit, dtype=dtype, copy=copy,\n                               order=order, subok=subok, ndmin=ndmin)\n\n    # ↓↓↓ properties not found in Quantity\n    @property\n    def physical(self):\n        \"\"\"The physical quantity corresponding the function one.\"\"\"\n        return self.to(self.unit.physical_unit)\n\n    @property\n    def _function_view(self):\n        \"\"\"View as Quantity with function unit, dropping the physical unit.\n\n        Use `~astropy.units.quantity.Quantity.value` for just the value.\n        \"\"\"\n        return self._new_view(unit=self.unit.function_unit)\n\n    # ↓↓↓ methods overridden to change the behavior\n    @property\n    def si(self):\n        \"\"\"Return a copy with the physical unit in SI units.\"\"\"\n        return self.__class__(self.physical.si)\n\n    @property\n    def cgs(self):\n        \"\"\"Return a copy with the physical unit in CGS units.\"\"\"\n        return self.__class__(self.physical.cgs)\n\n    def decompose(self, bases=[]):\n        \"\"\"Generate a new `FunctionQuantity` with the physical unit decomposed.\n\n        For details, see `~astropy.units.Quantity.decompose`.\n        \"\"\"\n        return self.__class__(self.physical.decompose(bases))\n\n    # ↓↓↓ methods overridden to add additional behavior\n    def __quantity_subclass__(self, unit):\n        if isinstance(unit, FunctionUnitBase):\n            return self.__class__, True\n        else:\n            return super().__quantity_subclass__(unit)[0], False\n\n    def _set_unit(self, unit):\n        if not isinstance(unit, self._unit_class):\n            # Have to take care of, e.g., (10*u.mag).view(u.Magnitude)\n            try:\n                # \"or 'nonsense'\" ensures `None` breaks, just in case.\n                unit = self._unit_class(function_unit=unit or 'nonsense')\n            except Exception:\n                raise UnitTypeError(\n                    \"{} instances require {} function units\"\n                    .format(type(self).__name__, self._unit_class.__name__) +\n                    f\", so cannot set it to '{unit}'.\")\n\n        self._unit = unit\n\n    def __array_ufunc__(self, function, method, *inputs, **kwargs):\n        # TODO: it would be more logical to have this in Quantity already,\n        # instead of in UFUNC_HELPERS, where it cannot be overridden.\n        # And really it should just return NotImplemented, since possibly\n        # another argument might know what to do.\n        if function not in self._supported_ufuncs:\n            raise UnitTypeError(\n                f\"Cannot use ufunc '{function.__name__}' with function quantities\")\n\n        return super().__array_ufunc__(function, method, *inputs, **kwargs)\n\n    # ↓↓↓ methods overridden to change behavior\n    def __mul__(self, other):\n        if self.unit.physical_unit == dimensionless_unscaled:\n            return self._function_view * other\n\n        raise UnitTypeError(\"Cannot multiply function quantities which \"\n                            \"are not dimensionless with anything.\")\n\n    def __truediv__(self, other):\n        if self.unit.physical_unit == dimensionless_unscaled:\n            return self._function_view / other\n\n        raise UnitTypeError(\"Cannot divide function quantities which \"\n                            \"are not dimensionless by anything.\")\n\n    def __rtruediv__(self, other):\n        if self.unit.physical_unit == dimensionless_unscaled:\n            return self._function_view.__rtruediv__(other)\n\n        raise UnitTypeError(\"Cannot divide function quantities which \"\n                            \"are not dimensionless into anything.\")\n\n    def _comparison(self, other, comparison_func):\n        \"\"\"Do a comparison between self and other, raising UnitsError when\n        other cannot be converted to self because it has different physical\n        unit, and returning NotImplemented when there are other errors.\"\"\"\n        try:\n            # will raise a UnitsError if physical units not equivalent\n            other_in_own_unit = self._to_own_unit(other, check_precision=False)\n        except UnitsError as exc:\n            if self.unit.physical_unit != dimensionless_unscaled:\n                raise exc\n\n            try:\n                other_in_own_unit = self._function_view._to_own_unit(\n                    other, check_precision=False)\n            except Exception:\n                raise exc\n\n        except Exception:\n            return NotImplemented\n\n        return comparison_func(other_in_own_unit)\n\n    def __eq__(self, other):\n        try:\n            return self._comparison(other, self.value.__eq__)\n        except UnitsError:\n            return False\n\n    def __ne__(self, other):\n        try:\n            return self._comparison(other, self.value.__ne__)\n        except UnitsError:\n            return True\n\n    def __gt__(self, other):\n        return self._comparison(other, self.value.__gt__)\n\n    def __ge__(self, other):\n        return self._comparison(other, self.value.__ge__)\n\n    def __lt__(self, other):\n        return self._comparison(other, self.value.__lt__)\n\n    def __le__(self, other):\n        return self._comparison(other, self.value.__le__)\n\n    def __lshift__(self, other):\n        \"\"\"Unit conversion operator `<<`\"\"\"\n        try:\n            other = Unit(other, parse_strict='silent')\n        except UnitTypeError:\n            return NotImplemented\n\n        return self.__class__(self, other, copy=False, subok=True)\n\n    # Ensure Quantity methods are used only if they make sense.\n    def _wrap_function(self, function, *args, **kwargs):\n        if function in self._supported_functions:\n            return super()._wrap_function(function, *args, **kwargs)\n\n        # For dimensionless, we can convert to regular quantities.\n        if all(arg.unit.physical_unit == dimensionless_unscaled\n               for arg in (self,) + args\n               if (hasattr(arg, 'unit') and\n                   hasattr(arg.unit, 'physical_unit'))):\n            args = tuple(getattr(arg, '_function_view', arg) for arg in args)\n            return self._function_view._wrap_function(function, *args, **kwargs)\n\n        raise TypeError(\"Cannot use method that uses function '{}' with \"\n                        \"function quantities that are not dimensionless.\"\n                        .format(function.__name__))\n\n    # Override functions that are supported but do not use _wrap_function\n    # in Quantity.\n    def max(self, axis=None, out=None, keepdims=False):\n        return self._wrap_function(np.max, axis, out=out, keepdims=keepdims)\n\n    def min(self, axis=None, out=None, keepdims=False):\n        return self._wrap_function(np.min, axis, out=out, keepdims=keepdims)\n\n    def sum(self, axis=None, dtype=None, out=None, keepdims=False):\n        return self._wrap_function(np.sum, axis, dtype, out=out,\n                                   keepdims=keepdims)\n\n    def cumsum(self, axis=None, dtype=None, out=None):\n        return self._wrap_function(np.cumsum, axis, dtype, out=out)\n\n    def clip(self, a_min, a_max, out=None):\n        return self._wrap_function(np.clip, self._to_own_unit(a_min),\n                                   self._to_own_unit(a_max), out=out)\n"},{"col":4,"comment":"null","endLoc":2364,"header":"def is_unity(self)","id":10245,"name":"is_unity","nodeType":"Function","startLoc":2362,"text":"def is_unity(self):\n        unit = self.decompose()\n        return len(unit.bases) == 0 and unit.scale == 1.0"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":10246,"name":"_tabversion","nodeType":"Attribute","startLoc":16,"text":"_tabversion"},{"className":"FunctionQuantity","col":0,"comment":"A representation of a (scaled) function of a number with a unit.\n\n    Function quantities are quantities whose units are functions containing a\n    physical unit, such as dB(mW).  Most of the arithmetic operations on\n    function quantities are defined in this base class.\n\n    While instantiation is also defined here, this class should not be\n    instantiated directly.  Rather, subclasses should be made which have\n    ``_unit_class`` pointing back to the corresponding function unit class.\n\n    Parameters\n    ----------\n    value : number, quantity-like, or sequence thereof\n        The numerical value of the function quantity. If a number or\n        a `~astropy.units.Quantity` with a function unit, it will be converted\n        to ``unit`` and the physical unit will be inferred from ``unit``.\n        If a `~astropy.units.Quantity` with just a physical unit, it will\n        converted to the function unit, after, if necessary, converting it to\n        the physical unit inferred from ``unit``.\n\n    unit : str, `~astropy.units.UnitBase`, or `~astropy.units.function.FunctionUnitBase`, optional\n        For an `~astropy.units.function.FunctionUnitBase` instance, the\n        physical unit will be taken from it; for other input, it will be\n        inferred from ``value``. By default, ``unit`` is set by the subclass.\n\n    dtype : `~numpy.dtype`, optional\n        The dtype of the resulting Numpy array or scalar that will\n        hold the value.  If not provided, it is determined from the input,\n        except that any input that cannot represent float (integer and bool)\n        is converted to float.\n\n    copy : bool, optional\n        If `True` (default), then the value is copied.  Otherwise, a copy will\n        only be made if ``__array__`` returns a copy, if value is a nested\n        sequence, or if a copy is needed to satisfy an explicitly given\n        ``dtype``.  (The `False` option is intended mostly for internal use,\n        to speed up initialization where a copy is known to have been made.\n        Use with care.)\n\n    order : {'C', 'F', 'A'}, optional\n        Specify the order of the array.  As in `~numpy.array`.  Ignored\n        if the input does not need to be converted and ``copy=False``.\n\n    subok : bool, optional\n        If `False` (default), the returned array will be forced to be of the\n        class used.  Otherwise, subclasses will be passed through.\n\n    ndmin : int, optional\n        Specifies the minimum number of dimensions that the resulting array\n        should have.  Ones will be pre-pended to the shape as needed to meet\n        this requirement.  This parameter is ignored if the input is a\n        `~astropy.units.Quantity` and ``copy=False``.\n\n    Raises\n    ------\n    TypeError\n        If the value provided is not a Python numeric type.\n    TypeError\n        If the unit provided is not a `~astropy.units.function.FunctionUnitBase`\n        or `~astropy.units.Unit` object, or a parseable string unit.\n    ","endLoc":684,"id":10247,"nodeType":"Class","startLoc":409,"text":"class FunctionQuantity(Quantity):\n    \"\"\"A representation of a (scaled) function of a number with a unit.\n\n    Function quantities are quantities whose units are functions containing a\n    physical unit, such as dB(mW).  Most of the arithmetic operations on\n    function quantities are defined in this base class.\n\n    While instantiation is also defined here, this class should not be\n    instantiated directly.  Rather, subclasses should be made which have\n    ``_unit_class`` pointing back to the corresponding function unit class.\n\n    Parameters\n    ----------\n    value : number, quantity-like, or sequence thereof\n        The numerical value of the function quantity. If a number or\n        a `~astropy.units.Quantity` with a function unit, it will be converted\n        to ``unit`` and the physical unit will be inferred from ``unit``.\n        If a `~astropy.units.Quantity` with just a physical unit, it will\n        converted to the function unit, after, if necessary, converting it to\n        the physical unit inferred from ``unit``.\n\n    unit : str, `~astropy.units.UnitBase`, or `~astropy.units.function.FunctionUnitBase`, optional\n        For an `~astropy.units.function.FunctionUnitBase` instance, the\n        physical unit will be taken from it; for other input, it will be\n        inferred from ``value``. By default, ``unit`` is set by the subclass.\n\n    dtype : `~numpy.dtype`, optional\n        The dtype of the resulting Numpy array or scalar that will\n        hold the value.  If not provided, it is determined from the input,\n        except that any input that cannot represent float (integer and bool)\n        is converted to float.\n\n    copy : bool, optional\n        If `True` (default), then the value is copied.  Otherwise, a copy will\n        only be made if ``__array__`` returns a copy, if value is a nested\n        sequence, or if a copy is needed to satisfy an explicitly given\n        ``dtype``.  (The `False` option is intended mostly for internal use,\n        to speed up initialization where a copy is known to have been made.\n        Use with care.)\n\n    order : {'C', 'F', 'A'}, optional\n        Specify the order of the array.  As in `~numpy.array`.  Ignored\n        if the input does not need to be converted and ``copy=False``.\n\n    subok : bool, optional\n        If `False` (default), the returned array will be forced to be of the\n        class used.  Otherwise, subclasses will be passed through.\n\n    ndmin : int, optional\n        Specifies the minimum number of dimensions that the resulting array\n        should have.  Ones will be pre-pended to the shape as needed to meet\n        this requirement.  This parameter is ignored if the input is a\n        `~astropy.units.Quantity` and ``copy=False``.\n\n    Raises\n    ------\n    TypeError\n        If the value provided is not a Python numeric type.\n    TypeError\n        If the unit provided is not a `~astropy.units.function.FunctionUnitBase`\n        or `~astropy.units.Unit` object, or a parseable string unit.\n    \"\"\"\n\n    _unit_class = None\n    \"\"\"Default `~astropy.units.function.FunctionUnitBase` subclass.\n\n    This should be overridden by subclasses.\n    \"\"\"\n\n    # Ensure priority over ndarray, regular Unit & Quantity, and FunctionUnit.\n    __array_priority__ = 40000\n\n    # Define functions that work on FunctionQuantity.\n    _supported_ufuncs = SUPPORTED_UFUNCS\n    _supported_functions = SUPPORTED_FUNCTIONS\n\n    def __new__(cls, value, unit=None, dtype=None, copy=True, order=None,\n                subok=False, ndmin=0):\n\n        if unit is not None:\n            # Convert possible string input to a (function) unit.\n            unit = Unit(unit)\n\n        if not isinstance(unit, FunctionUnitBase):\n            # By default, use value's physical unit.\n            value_unit = getattr(value, 'unit', None)\n            if value_unit is None:\n                # if iterable, see if first item has a unit\n                # (mixed lists fail in super call below).\n                try:\n                    value_unit = getattr(value[0], 'unit')\n                except Exception:\n                    pass\n            physical_unit = getattr(value_unit, 'physical_unit', value_unit)\n            unit = cls._unit_class(physical_unit, function_unit=unit)\n\n        # initialise!\n        return super().__new__(cls, value, unit, dtype=dtype, copy=copy,\n                               order=order, subok=subok, ndmin=ndmin)\n\n    # ↓↓↓ properties not found in Quantity\n    @property\n    def physical(self):\n        \"\"\"The physical quantity corresponding the function one.\"\"\"\n        return self.to(self.unit.physical_unit)\n\n    @property\n    def _function_view(self):\n        \"\"\"View as Quantity with function unit, dropping the physical unit.\n\n        Use `~astropy.units.quantity.Quantity.value` for just the value.\n        \"\"\"\n        return self._new_view(unit=self.unit.function_unit)\n\n    # ↓↓↓ methods overridden to change the behavior\n    @property\n    def si(self):\n        \"\"\"Return a copy with the physical unit in SI units.\"\"\"\n        return self.__class__(self.physical.si)\n\n    @property\n    def cgs(self):\n        \"\"\"Return a copy with the physical unit in CGS units.\"\"\"\n        return self.__class__(self.physical.cgs)\n\n    def decompose(self, bases=[]):\n        \"\"\"Generate a new `FunctionQuantity` with the physical unit decomposed.\n\n        For details, see `~astropy.units.Quantity.decompose`.\n        \"\"\"\n        return self.__class__(self.physical.decompose(bases))\n\n    # ↓↓↓ methods overridden to add additional behavior\n    def __quantity_subclass__(self, unit):\n        if isinstance(unit, FunctionUnitBase):\n            return self.__class__, True\n        else:\n            return super().__quantity_subclass__(unit)[0], False\n\n    def _set_unit(self, unit):\n        if not isinstance(unit, self._unit_class):\n            # Have to take care of, e.g., (10*u.mag).view(u.Magnitude)\n            try:\n                # \"or 'nonsense'\" ensures `None` breaks, just in case.\n                unit = self._unit_class(function_unit=unit or 'nonsense')\n            except Exception:\n                raise UnitTypeError(\n                    \"{} instances require {} function units\"\n                    .format(type(self).__name__, self._unit_class.__name__) +\n                    f\", so cannot set it to '{unit}'.\")\n\n        self._unit = unit\n\n    def __array_ufunc__(self, function, method, *inputs, **kwargs):\n        # TODO: it would be more logical to have this in Quantity already,\n        # instead of in UFUNC_HELPERS, where it cannot be overridden.\n        # And really it should just return NotImplemented, since possibly\n        # another argument might know what to do.\n        if function not in self._supported_ufuncs:\n            raise UnitTypeError(\n                f\"Cannot use ufunc '{function.__name__}' with function quantities\")\n\n        return super().__array_ufunc__(function, method, *inputs, **kwargs)\n\n    # ↓↓↓ methods overridden to change behavior\n    def __mul__(self, other):\n        if self.unit.physical_unit == dimensionless_unscaled:\n            return self._function_view * other\n\n        raise UnitTypeError(\"Cannot multiply function quantities which \"\n                            \"are not dimensionless with anything.\")\n\n    def __truediv__(self, other):\n        if self.unit.physical_unit == dimensionless_unscaled:\n            return self._function_view / other\n\n        raise UnitTypeError(\"Cannot divide function quantities which \"\n                            \"are not dimensionless by anything.\")\n\n    def __rtruediv__(self, other):\n        if self.unit.physical_unit == dimensionless_unscaled:\n            return self._function_view.__rtruediv__(other)\n\n        raise UnitTypeError(\"Cannot divide function quantities which \"\n                            \"are not dimensionless into anything.\")\n\n    def _comparison(self, other, comparison_func):\n        \"\"\"Do a comparison between self and other, raising UnitsError when\n        other cannot be converted to self because it has different physical\n        unit, and returning NotImplemented when there are other errors.\"\"\"\n        try:\n            # will raise a UnitsError if physical units not equivalent\n            other_in_own_unit = self._to_own_unit(other, check_precision=False)\n        except UnitsError as exc:\n            if self.unit.physical_unit != dimensionless_unscaled:\n                raise exc\n\n            try:\n                other_in_own_unit = self._function_view._to_own_unit(\n                    other, check_precision=False)\n            except Exception:\n                raise exc\n\n        except Exception:\n            return NotImplemented\n\n        return comparison_func(other_in_own_unit)\n\n    def __eq__(self, other):\n        try:\n            return self._comparison(other, self.value.__eq__)\n        except UnitsError:\n            return False\n\n    def __ne__(self, other):\n        try:\n            return self._comparison(other, self.value.__ne__)\n        except UnitsError:\n            return True\n\n    def __gt__(self, other):\n        return self._comparison(other, self.value.__gt__)\n\n    def __ge__(self, other):\n        return self._comparison(other, self.value.__ge__)\n\n    def __lt__(self, other):\n        return self._comparison(other, self.value.__lt__)\n\n    def __le__(self, other):\n        return self._comparison(other, self.value.__le__)\n\n    def __lshift__(self, other):\n        \"\"\"Unit conversion operator `<<`\"\"\"\n        try:\n            other = Unit(other, parse_strict='silent')\n        except UnitTypeError:\n            return NotImplemented\n\n        return self.__class__(self, other, copy=False, subok=True)\n\n    # Ensure Quantity methods are used only if they make sense.\n    def _wrap_function(self, function, *args, **kwargs):\n        if function in self._supported_functions:\n            return super()._wrap_function(function, *args, **kwargs)\n\n        # For dimensionless, we can convert to regular quantities.\n        if all(arg.unit.physical_unit == dimensionless_unscaled\n               for arg in (self,) + args\n               if (hasattr(arg, 'unit') and\n                   hasattr(arg.unit, 'physical_unit'))):\n            args = tuple(getattr(arg, '_function_view', arg) for arg in args)\n            return self._function_view._wrap_function(function, *args, **kwargs)\n\n        raise TypeError(\"Cannot use method that uses function '{}' with \"\n                        \"function quantities that are not dimensionless.\"\n                        .format(function.__name__))\n\n    # Override functions that are supported but do not use _wrap_function\n    # in Quantity.\n    def max(self, axis=None, out=None, keepdims=False):\n        return self._wrap_function(np.max, axis, out=out, keepdims=keepdims)\n\n    def min(self, axis=None, out=None, keepdims=False):\n        return self._wrap_function(np.min, axis, out=out, keepdims=keepdims)\n\n    def sum(self, axis=None, dtype=None, out=None, keepdims=False):\n        return self._wrap_function(np.sum, axis, dtype, out=out,\n                                   keepdims=keepdims)\n\n    def cumsum(self, axis=None, dtype=None, out=None):\n        return self._wrap_function(np.cumsum, axis, dtype, out=out)\n\n    def clip(self, a_min, a_max, out=None):\n        return self._wrap_function(np.clip, self._to_own_unit(a_min),\n                                   self._to_own_unit(a_max), out=out)"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":10248,"name":"_lr_method","nodeType":"Attribute","startLoc":18,"text":"_lr_method"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":10249,"name":"_lr_signature","nodeType":"Attribute","startLoc":20,"text":"_lr_signature"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":10250,"name":"_lr_action_items","nodeType":"Attribute","startLoc":22,"text":"_lr_action_items"},{"col":4,"comment":"null","endLoc":507,"header":"def __new__(cls, value, unit=None, dtype=None, copy=True, order=None,\n                subok=False, ndmin=0)","id":10251,"name":"__new__","nodeType":"Function","startLoc":485,"text":"def __new__(cls, value, unit=None, dtype=None, copy=True, order=None,\n                subok=False, ndmin=0):\n\n        if unit is not None:\n            # Convert possible string input to a (function) unit.\n            unit = Unit(unit)\n\n        if not isinstance(unit, FunctionUnitBase):\n            # By default, use value's physical unit.\n            value_unit = getattr(value, 'unit', None)\n            if value_unit is None:\n                # if iterable, see if first item has a unit\n                # (mixed lists fail in super call below).\n                try:\n                    value_unit = getattr(value[0], 'unit')\n                except Exception:\n                    pass\n            physical_unit = getattr(value_unit, 'physical_unit', value_unit)\n            unit = cls._unit_class(physical_unit, function_unit=unit)\n\n        # initialise!\n        return super().__new__(cls, value, unit, dtype=dtype, copy=copy,\n                               order=order, subok=subok, ndmin=ndmin)"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":10252,"name":"_lr_action","nodeType":"Attribute","startLoc":24,"text":"_lr_action"},{"attributeType":"null","col":4,"comment":"null","endLoc":25,"id":10253,"name":"_k","nodeType":"Attribute","startLoc":25,"text":"_k"},{"col":4,"comment":"null","endLoc":319,"header":"@classmethod\n    def parse(cls, s, debug=False)","id":10254,"name":"parse","nodeType":"Function","startLoc":300,"text":"@classmethod\n    def parse(cls, s, debug=False):\n        if ' ' in s:\n            raise ValueError('CDS unit must not contain whitespace')\n\n        if not isinstance(s, str):\n            s = s.decode('ascii')\n\n        # This is a short circuit for the case where the string\n        # is just a single unit name\n        try:\n            return cls._parse_unit(s, detailed_exception=False)\n        except ValueError:\n            try:\n                return cls._parser.parse(s, lexer=cls._lexer, debug=debug)\n            except ValueError as e:\n                if str(e):\n                    raise ValueError(str(e))\n                else:\n                    raise ValueError(\"Syntax error\")"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":10255,"name":"_tabversion","nodeType":"Attribute","startLoc":16,"text":"_tabversion"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":10256,"name":"_lr_method","nodeType":"Attribute","startLoc":18,"text":"_lr_method"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":10257,"name":"_lr_signature","nodeType":"Attribute","startLoc":20,"text":"_lr_signature"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":10258,"name":"_lr_action_items","nodeType":"Attribute","startLoc":22,"text":"_lr_action_items"},{"attributeType":"None","col":4,"comment":"null","endLoc":2220,"id":10259,"name":"_decomposed_cache","nodeType":"Attribute","startLoc":2220,"text":"_decomposed_cache"},{"attributeType":"CompositeUnit","col":16,"comment":"null","endLoc":2353,"id":10260,"name":"_decomposed_cache","nodeType":"Attribute","startLoc":2353,"text":"self._decomposed_cache"},{"attributeType":"null","col":12,"comment":"null","endLoc":2260,"id":10261,"name":"_scale","nodeType":"Attribute","startLoc":2260,"text":"self._scale"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":10262,"name":"_lr_action","nodeType":"Attribute","startLoc":24,"text":"_lr_action"},{"attributeType":"null","col":4,"comment":"null","endLoc":25,"id":10263,"name":"_k","nodeType":"Attribute","startLoc":25,"text":"_k"},{"attributeType":"null","col":8,"comment":"null","endLoc":25,"id":10264,"name":"_v","nodeType":"Attribute","startLoc":25,"text":"_v"},{"attributeType":"null","col":7,"comment":"null","endLoc":26,"id":10265,"name":"_x","nodeType":"Attribute","startLoc":26,"text":"_x"},{"attributeType":"null","col":10,"comment":"null","endLoc":26,"id":10266,"name":"_y","nodeType":"Attribute","startLoc":26,"text":"_y"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":10267,"name":"_lr_goto_items","nodeType":"Attribute","startLoc":31,"text":"_lr_goto_items"},{"attributeType":"null","col":8,"comment":"null","endLoc":25,"id":10268,"name":"_v","nodeType":"Attribute","startLoc":25,"text":"_v"},{"attributeType":"null","col":7,"comment":"null","endLoc":26,"id":10269,"name":"_x","nodeType":"Attribute","startLoc":26,"text":"_x"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":10270,"name":"_lr_goto","nodeType":"Attribute","startLoc":33,"text":"_lr_goto"},{"attributeType":"null","col":4,"comment":"null","endLoc":34,"id":10271,"name":"_k","nodeType":"Attribute","startLoc":34,"text":"_k"},{"attributeType":"null","col":10,"comment":"null","endLoc":26,"id":10272,"name":"_y","nodeType":"Attribute","startLoc":26,"text":"_y"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":10273,"name":"_lr_goto_items","nodeType":"Attribute","startLoc":31,"text":"_lr_goto_items"},{"attributeType":"null","col":8,"comment":"null","endLoc":34,"id":10274,"name":"_v","nodeType":"Attribute","startLoc":34,"text":"_v"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":10275,"name":"_lr_goto","nodeType":"Attribute","startLoc":33,"text":"_lr_goto"},{"attributeType":"null","col":7,"comment":"null","endLoc":35,"id":10276,"name":"_x","nodeType":"Attribute","startLoc":35,"text":"_x"},{"attributeType":"null","col":4,"comment":"null","endLoc":34,"id":10277,"name":"_k","nodeType":"Attribute","startLoc":34,"text":"_k"},{"attributeType":"null","col":11,"comment":"null","endLoc":35,"id":10278,"name":"_y","nodeType":"Attribute","startLoc":35,"text":"_y"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":10279,"name":"_lr_productions","nodeType":"Attribute","startLoc":39,"text":"_lr_productions"},{"attributeType":"null","col":8,"comment":"null","endLoc":34,"id":10280,"name":"_v","nodeType":"Attribute","startLoc":34,"text":"_v"},{"attributeType":"null","col":7,"comment":"null","endLoc":35,"id":10281,"name":"_x","nodeType":"Attribute","startLoc":35,"text":"_x"},{"attributeType":"null","col":11,"comment":"null","endLoc":35,"id":10282,"name":"_y","nodeType":"Attribute","startLoc":35,"text":"_y"},{"col":0,"comment":"","endLoc":16,"header":"generic_parsetab.py#<anonymous>","id":10283,"name":"<anonymous>","nodeType":"Function","startLoc":16,"text":"_tabversion = '3.10'\n\n_lr_method = 'LALR'\n\n_lr_signature = 'CARET CLOSE_PAREN COMMA DOUBLE_STAR FUNCNAME OPEN_PAREN PERIOD SIGN SOLIDUS STAR UFLOAT UINT UNIT\\n            main : unit\\n                 | structured_unit\\n                 | structured_subunit\\n            \\n            structured_subunit : OPEN_PAREN structured_unit CLOSE_PAREN\\n            \\n            structured_unit : subunit COMMA\\n                            | subunit COMMA subunit\\n            \\n            subunit : unit\\n                    | structured_unit\\n                    | structured_subunit\\n            \\n            unit : product_of_units\\n                 | factor product_of_units\\n                 | factor product product_of_units\\n                 | division_product_of_units\\n                 | factor division_product_of_units\\n                 | factor product division_product_of_units\\n                 | inverse_unit\\n                 | factor inverse_unit\\n                 | factor product inverse_unit\\n                 | factor\\n            \\n            division_product_of_units : division_product_of_units division product_of_units\\n                                      | product_of_units\\n            \\n            inverse_unit : division unit_expression\\n            \\n            factor : factor_fits\\n                   | factor_float\\n                   | factor_int\\n            \\n            factor_float : signed_float\\n                         | signed_float UINT signed_int\\n                         | signed_float UINT power numeric_power\\n            \\n            factor_int : UINT\\n                       | UINT signed_int\\n                       | UINT power numeric_power\\n                       | UINT UINT signed_int\\n                       | UINT UINT power numeric_power\\n            \\n            factor_fits : UINT power OPEN_PAREN signed_int CLOSE_PAREN\\n                        | UINT power OPEN_PAREN UINT CLOSE_PAREN\\n                        | UINT power signed_int\\n                        | UINT power UINT\\n                        | UINT SIGN UINT\\n                        | UINT OPEN_PAREN signed_int CLOSE_PAREN\\n            \\n            product_of_units : unit_expression product product_of_units\\n                             | unit_expression product_of_units\\n                             | unit_expression\\n            \\n            unit_expression : function\\n                            | unit_with_power\\n                            | OPEN_PAREN product_of_units CLOSE_PAREN\\n            \\n            unit_with_power : UNIT power numeric_power\\n                            | UNIT numeric_power\\n                            | UNIT\\n            \\n            numeric_power : sign UINT\\n                          | OPEN_PAREN paren_expr CLOSE_PAREN\\n            \\n            paren_expr : sign UINT\\n                       | signed_float\\n                       | frac\\n            \\n            frac : sign UINT division sign UINT\\n            \\n            sign : SIGN\\n                 |\\n            \\n            product : STAR\\n                    | PERIOD\\n            \\n            division : SOLIDUS\\n            \\n            power : DOUBLE_STAR\\n                  | CARET\\n            \\n            signed_int : SIGN UINT\\n            \\n            signed_float : sign UINT\\n                         | sign UFLOAT\\n            \\n            function_name : FUNCNAME\\n            \\n            function : function_name OPEN_PAREN main CLOSE_PAREN\\n            '\n\n_lr_action_items = {'OPEN_PAREN':([0,6,10,11,12,13,14,15,16,17,18,20,21,22,23,25,27,30,31,32,33,34,35,40,44,46,48,49,51,52,53,56,57,66,68,69,71,73,74,77,78,79,81,82,87,88,91,92,93,94,96,97,],[10,32,35,32,-23,-24,-25,32,-43,-44,45,-26,-59,51,55,-65,32,-57,-58,32,32,10,35,32,72,-30,-60,-61,10,55,-47,-63,-64,-45,-32,55,-37,-36,-31,-38,-27,55,-46,-49,-33,-62,-39,-28,-66,-50,-35,-34,]),'UINT':([0,10,18,19,20,21,23,24,34,35,44,47,48,49,51,52,54,55,56,57,69,70,72,75,79,84,98,99,],[18,18,43,-55,50,-59,-56,56,18,18,71,77,-60,-61,18,-56,82,-56,-63,-64,-56,88,89,88,-56,95,-56,100,]),'SOLIDUS':([0,5,6,7,10,11,12,13,14,16,17,18,20,23,26,27,28,30,31,34,35,37,41,46,51,53,56,57,58,59,62,66,67,68,71,73,74,77,78,81,82,87,88,91,92,93,94,95,96,97,],[21,-21,21,21,21,-42,-23,-24,-25,-43,-44,-29,-26,-48,-21,21,21,-57,-58,21,21,-21,-41,-30,21,-47,-63,-64,-21,21,-20,-45,-40,-32,-37,-36,-31,-38,-27,-46,-49,-33,-62,-39,-28,-66,-50,21,-35,-34,]),'UNIT':([0,6,10,11,12,13,14,15,16,17,18,20,21,23,27,30,31,32,33,34,35,40,46,51,53,56,57,66,68,71,73,74,77,78,81,82,87,88,91,92,93,94,96,97,],[23,23,23,23,-23,-24,-25,23,-43,-44,-29,-26,-59,-48,23,-57,-58,23,23,23,23,23,-30,23,-47,-63,-64,-45,-32,-37,-36,-31,-38,-27,-46,-49,-33,-62,-39,-28,-66,-50,-35,-34,]),'FUNCNAME':([0,6,10,11,12,13,14,15,16,17,18,20,21,23,27,30,31,32,33,34,35,40,46,51,53,56,57,66,68,71,73,74,77,78,81,82,87,88,91,92,93,94,96,97,],[25,25,25,25,-23,-24,-25,25,-43,-44,-29,-26,-59,-48,25,-57,-58,25,25,25,25,25,-30,25,-47,-63,-64,-45,-32,-37,-36,-31,-38,-27,-46,-49,-33,-62,-39,-28,-66,-50,-35,-34,]),'SIGN':([0,10,18,21,23,34,35,43,44,45,48,49,50,51,52,55,69,72,79,98,],[19,19,47,-59,19,19,19,70,75,70,-60,-61,70,19,19,19,19,75,19,19,]),'UFLOAT':([0,10,19,24,34,35,51,55,72,75,84,],[-56,-56,-55,57,-56,-56,-56,-56,-56,-55,57,]),'$end':([1,2,3,4,5,6,7,8,11,12,13,14,16,17,18,20,23,26,28,29,34,38,39,41,42,46,53,56,57,58,59,60,62,63,64,65,66,67,68,71,73,74,77,78,81,82,87,88,91,92,93,94,96,97,],[0,-1,-2,-3,-10,-19,-13,-16,-42,-23,-24,-25,-43,-44,-29,-26,-48,-11,-14,-17,-5,-7,-9,-41,-22,-30,-47,-63,-64,-12,-15,-18,-20,-6,-8,-4,-45,-40,-32,-37,-36,-31,-38,-27,-46,-49,-33,-62,-39,-28,-66,-50,-35,-34,]),'CLOSE_PAREN':([2,3,4,5,6,7,8,11,12,13,14,16,17,18,20,23,26,28,29,34,36,37,38,39,41,42,46,53,56,57,58,59,60,61,62,63,64,65,66,67,68,71,73,74,76,77,78,80,81,82,83,85,86,87,88,89,90,91,92,93,94,95,96,97,100,],[-1,-2,-3,-10,-19,-13,-16,-42,-23,-24,-25,-43,-44,-29,-26,-48,-11,-14,-17,-5,65,66,-7,-9,-41,-22,-30,-47,-63,-64,-12,-15,-18,66,-20,-6,-8,-4,-45,-40,-32,-37,-36,-31,91,-38,-27,93,-46,-49,94,-52,-53,-33,-62,96,97,-39,-28,-66,-50,-51,-35,-34,-54,]),'COMMA':([2,3,4,5,6,7,8,9,11,12,13,14,16,17,18,20,23,26,28,29,34,36,37,38,39,41,42,46,53,56,57,58,59,60,62,63,64,65,66,67,68,71,73,74,77,78,81,82,87,88,91,92,93,94,96,97,],[-7,-8,-9,-10,-19,-13,-16,34,-42,-23,-24,-25,-43,-44,-29,-26,-48,-11,-14,-17,-5,-8,-10,-7,-9,-41,-22,-30,-47,-63,-64,-12,-15,-18,-20,34,-8,-4,-45,-40,-32,-37,-36,-31,-38,-27,-46,-49,-33,-62,-39,-28,-66,-50,-35,-34,]),'STAR':([6,11,12,13,14,16,17,18,20,23,46,53,56,57,66,68,71,73,74,77,78,81,82,87,88,91,92,93,94,96,97,],[30,30,-23,-24,-25,-43,-44,-29,-26,-48,-30,-47,-63,-64,-45,-32,-37,-36,-31,-38,-27,-46,-49,-33,-62,-39,-28,-66,-50,-35,-34,]),'PERIOD':([6,11,12,13,14,16,17,18,20,23,46,53,56,57,66,68,71,73,74,77,78,81,82,87,88,91,92,93,94,96,97,],[31,31,-23,-24,-25,-43,-44,-29,-26,-48,-30,-47,-63,-64,-45,-32,-37,-36,-31,-38,-27,-46,-49,-33,-62,-39,-28,-66,-50,-35,-34,]),'DOUBLE_STAR':([18,23,43,50,],[48,48,48,48,]),'CARET':([18,23,43,50,],[49,49,49,49,]),}\n\n_lr_action = {}\n\nfor _k, _v in _lr_action_items.items():\n   for _x,_y in zip(_v[0],_v[1]):\n      if not _x in _lr_action:  _lr_action[_x] = {}\n      _lr_action[_x][_k] = _y\n\ndel _lr_action_items\n\n_lr_goto_items = {'main':([0,51,],[1,80,]),'unit':([0,10,34,35,51,],[2,38,38,38,2,]),'structured_unit':([0,10,34,35,51,],[3,36,64,36,3,]),'structured_subunit':([0,10,34,35,51,],[4,39,39,39,4,]),'product_of_units':([0,6,10,11,27,32,33,34,35,40,51,],[5,26,37,41,58,61,62,5,37,67,5,]),'factor':([0,10,34,35,51,],[6,6,6,6,6,]),'division_product_of_units':([0,6,10,27,34,35,51,],[7,28,7,59,7,7,7,]),'inverse_unit':([0,6,10,27,34,35,51,],[8,29,8,60,8,8,8,]),'subunit':([0,10,34,35,51,],[9,9,63,9,9,]),'unit_expression':([0,6,10,11,15,27,32,33,34,35,40,51,],[11,11,11,11,42,11,11,11,11,11,11,11,]),'factor_fits':([0,10,34,35,51,],[12,12,12,12,12,]),'factor_float':([0,10,34,35,51,],[13,13,13,13,13,]),'factor_int':([0,10,34,35,51,],[14,14,14,14,14,]),'division':([0,6,7,10,27,28,34,35,51,59,95,],[15,15,33,15,15,33,15,15,15,33,98,]),'function':([0,6,10,11,15,27,32,33,34,35,40,51,],[16,16,16,16,16,16,16,16,16,16,16,16,]),'unit_with_power':([0,6,10,11,15,27,32,33,34,35,40,51,],[17,17,17,17,17,17,17,17,17,17,17,17,]),'signed_float':([0,10,34,35,51,55,72,],[20,20,20,20,20,85,85,]),'function_name':([0,6,10,11,15,27,32,33,34,35,40,51,],[22,22,22,22,22,22,22,22,22,22,22,22,]),'sign':([0,10,23,34,35,44,51,52,55,69,72,79,98,],[24,24,54,24,24,54,24,54,84,54,84,54,99,]),'product':([6,11,],[27,40,]),'power':([18,23,43,50,],[44,52,69,79,]),'signed_int':([18,43,44,45,50,72,],[46,68,73,76,78,90,]),'numeric_power':([23,44,52,69,79,],[53,74,81,87,92,]),'paren_expr':([55,72,],[83,83,]),'frac':([55,72,],[86,86,]),}\n\n_lr_goto = {}\n\nfor _k, _v in _lr_goto_items.items():\n   for _x, _y in zip(_v[0], _v[1]):\n       if not _x in _lr_goto: _lr_goto[_x] = {}\n       _lr_goto[_x][_k] = _y\n\ndel _lr_goto_items\n\n_lr_productions = [\n  (\"S' -> main\",\"S'\",1,None,None,None),\n  ('main -> unit','main',1,'p_main','generic.py',196),\n  ('main -> structured_unit','main',1,'p_main','generic.py',197),\n  ('main -> structured_subunit','main',1,'p_main','generic.py',198),\n  ('structured_subunit -> OPEN_PAREN structured_unit CLOSE_PAREN','structured_subunit',3,'p_structured_subunit','generic.py',209),\n  ('structured_unit -> subunit COMMA','structured_unit',2,'p_structured_unit','generic.py',218),\n  ('structured_unit -> subunit COMMA subunit','structured_unit',3,'p_structured_unit','generic.py',219),\n  ('subunit -> unit','subunit',1,'p_subunit','generic.py',241),\n  ('subunit -> structured_unit','subunit',1,'p_subunit','generic.py',242),\n  ('subunit -> structured_subunit','subunit',1,'p_subunit','generic.py',243),\n  ('unit -> product_of_units','unit',1,'p_unit','generic.py',249),\n  ('unit -> factor product_of_units','unit',2,'p_unit','generic.py',250),\n  ('unit -> factor product product_of_units','unit',3,'p_unit','generic.py',251),\n  ('unit -> division_product_of_units','unit',1,'p_unit','generic.py',252),\n  ('unit -> factor division_product_of_units','unit',2,'p_unit','generic.py',253),\n  ('unit -> factor product division_product_of_units','unit',3,'p_unit','generic.py',254),\n  ('unit -> inverse_unit','unit',1,'p_unit','generic.py',255),\n  ('unit -> factor inverse_unit','unit',2,'p_unit','generic.py',256),\n  ('unit -> factor product inverse_unit','unit',3,'p_unit','generic.py',257),\n  ('unit -> factor','unit',1,'p_unit','generic.py',258),\n  ('division_product_of_units -> division_product_of_units division product_of_units','division_product_of_units',3,'p_division_product_of_units','generic.py',270),\n  ('division_product_of_units -> product_of_units','division_product_of_units',1,'p_division_product_of_units','generic.py',271),\n  ('inverse_unit -> division unit_expression','inverse_unit',2,'p_inverse_unit','generic.py',281),\n  ('factor -> factor_fits','factor',1,'p_factor','generic.py',287),\n  ('factor -> factor_float','factor',1,'p_factor','generic.py',288),\n  ('factor -> factor_int','factor',1,'p_factor','generic.py',289),\n  ('factor_float -> signed_float','factor_float',1,'p_factor_float','generic.py',295),\n  ('factor_float -> signed_float UINT signed_int','factor_float',3,'p_factor_float','generic.py',296),\n  ('factor_float -> signed_float UINT power numeric_power','factor_float',4,'p_factor_float','generic.py',297),\n  ('factor_int -> UINT','factor_int',1,'p_factor_int','generic.py',310),\n  ('factor_int -> UINT signed_int','factor_int',2,'p_factor_int','generic.py',311),\n  ('factor_int -> UINT power numeric_power','factor_int',3,'p_factor_int','generic.py',312),\n  ('factor_int -> UINT UINT signed_int','factor_int',3,'p_factor_int','generic.py',313),\n  ('factor_int -> UINT UINT power numeric_power','factor_int',4,'p_factor_int','generic.py',314),\n  ('factor_fits -> UINT power OPEN_PAREN signed_int CLOSE_PAREN','factor_fits',5,'p_factor_fits','generic.py',332),\n  ('factor_fits -> UINT power OPEN_PAREN UINT CLOSE_PAREN','factor_fits',5,'p_factor_fits','generic.py',333),\n  ('factor_fits -> UINT power signed_int','factor_fits',3,'p_factor_fits','generic.py',334),\n  ('factor_fits -> UINT power UINT','factor_fits',3,'p_factor_fits','generic.py',335),\n  ('factor_fits -> UINT SIGN UINT','factor_fits',3,'p_factor_fits','generic.py',336),\n  ('factor_fits -> UINT OPEN_PAREN signed_int CLOSE_PAREN','factor_fits',4,'p_factor_fits','generic.py',337),\n  ('product_of_units -> unit_expression product product_of_units','product_of_units',3,'p_product_of_units','generic.py',356),\n  ('product_of_units -> unit_expression product_of_units','product_of_units',2,'p_product_of_units','generic.py',357),\n  ('product_of_units -> unit_expression','product_of_units',1,'p_product_of_units','generic.py',358),\n  ('unit_expression -> function','unit_expression',1,'p_unit_expression','generic.py',369),\n  ('unit_expression -> unit_with_power','unit_expression',1,'p_unit_expression','generic.py',370),\n  ('unit_expression -> OPEN_PAREN product_of_units CLOSE_PAREN','unit_expression',3,'p_unit_expression','generic.py',371),\n  ('unit_with_power -> UNIT power numeric_power','unit_with_power',3,'p_unit_with_power','generic.py',380),\n  ('unit_with_power -> UNIT numeric_power','unit_with_power',2,'p_unit_with_power','generic.py',381),\n  ('unit_with_power -> UNIT','unit_with_power',1,'p_unit_with_power','generic.py',382),\n  ('numeric_power -> sign UINT','numeric_power',2,'p_numeric_power','generic.py',393),\n  ('numeric_power -> OPEN_PAREN paren_expr CLOSE_PAREN','numeric_power',3,'p_numeric_power','generic.py',394),\n  ('paren_expr -> sign UINT','paren_expr',2,'p_paren_expr','generic.py',403),\n  ('paren_expr -> signed_float','paren_expr',1,'p_paren_expr','generic.py',404),\n  ('paren_expr -> frac','paren_expr',1,'p_paren_expr','generic.py',405),\n  ('frac -> sign UINT division sign UINT','frac',5,'p_frac','generic.py',414),\n  ('sign -> SIGN','sign',1,'p_sign','generic.py',420),\n  ('sign -> <empty>','sign',0,'p_sign','generic.py',421),\n  ('product -> STAR','product',1,'p_product','generic.py',430),\n  ('product -> PERIOD','product',1,'p_product','generic.py',431),\n  ('division -> SOLIDUS','division',1,'p_division','generic.py',437),\n  ('power -> DOUBLE_STAR','power',1,'p_power','generic.py',443),\n  ('power -> CARET','power',1,'p_power','generic.py',444),\n  ('signed_int -> SIGN UINT','signed_int',2,'p_signed_int','generic.py',450),\n  ('signed_float -> sign UINT','signed_float',2,'p_signed_float','generic.py',456),\n  ('signed_float -> sign UFLOAT','signed_float',2,'p_signed_float','generic.py',457),\n  ('function_name -> FUNCNAME','function_name',1,'p_function_name','generic.py',463),\n  ('function -> function_name OPEN_PAREN main CLOSE_PAREN','function',4,'p_function','generic.py',469),\n]"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":10284,"name":"_lr_productions","nodeType":"Attribute","startLoc":39,"text":"_lr_productions"},{"col":0,"comment":"","endLoc":16,"header":"ogip_parsetab.py#<anonymous>","id":10285,"name":"<anonymous>","nodeType":"Function","startLoc":16,"text":"_tabversion = '3.10'\n\n_lr_method = 'LALR'\n\n_lr_signature = 'CLOSE_PAREN DIVISION LIT10 OPEN_PAREN SIGN STAR STARSTAR UFLOAT UINT UNIT UNKNOWN WHITESPACE\\n            main : UNKNOWN\\n                 | complete_expression\\n                 | scale_factor complete_expression\\n                 | scale_factor WHITESPACE complete_expression\\n            \\n            complete_expression : product_of_units\\n            \\n            product_of_units : unit_expression\\n                             | division unit_expression\\n                             | product_of_units product unit_expression\\n                             | product_of_units division unit_expression\\n            \\n            unit_expression : unit\\n                            | UNIT OPEN_PAREN complete_expression CLOSE_PAREN\\n                            | OPEN_PAREN complete_expression CLOSE_PAREN\\n                            | UNIT OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power\\n                            | OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power\\n            \\n            scale_factor : LIT10 power numeric_power\\n                         | LIT10\\n                         | signed_float\\n                         | signed_float power numeric_power\\n                         | signed_int power numeric_power\\n            \\n            division : DIVISION\\n                     | WHITESPACE DIVISION\\n                     | WHITESPACE DIVISION WHITESPACE\\n                     | DIVISION WHITESPACE\\n            \\n            product : WHITESPACE\\n                    | STAR\\n                    | WHITESPACE STAR\\n                    | WHITESPACE STAR WHITESPACE\\n                    | STAR WHITESPACE\\n            \\n            power : STARSTAR\\n            \\n            unit : UNIT\\n                 | UNIT power numeric_power\\n            \\n            numeric_power : UINT\\n                          | signed_float\\n                          | OPEN_PAREN signed_int CLOSE_PAREN\\n                          | OPEN_PAREN signed_float CLOSE_PAREN\\n                          | OPEN_PAREN signed_float division UINT CLOSE_PAREN\\n            \\n            sign : SIGN\\n                 |\\n            \\n            signed_int : SIGN UINT\\n            \\n            signed_float : sign UINT\\n                         | sign UFLOAT\\n            '\n\n_lr_action_items = {'UNKNOWN':([0,],[2,]),'LIT10':([0,],[7,]),'SIGN':([0,25,26,27,28,34,47,59,63,],[13,48,-29,48,48,48,13,48,48,]),'UNIT':([0,4,7,8,11,16,17,19,20,21,22,23,24,30,31,33,36,38,39,42,43,44,45,46,49,50,54,55,60,61,67,],[15,15,-16,-17,15,15,-20,15,-21,15,15,-24,-25,-40,-41,15,-23,-20,-22,-26,-28,-15,-32,-33,-18,-19,-22,-27,-34,-35,-36,]),'OPEN_PAREN':([0,4,7,8,11,15,16,17,19,20,21,22,23,24,25,26,27,28,30,31,33,34,36,38,39,42,43,44,45,46,49,50,54,55,59,60,61,63,67,],[16,16,-16,-17,16,33,16,-20,16,-21,16,16,-24,-25,47,-29,47,47,-40,-41,16,47,-23,-20,-22,-26,-28,-15,-32,-33,-18,-19,-22,-27,47,-34,-35,47,-36,]),'DIVISION':([0,4,5,6,7,8,10,14,15,16,19,23,29,30,31,33,40,41,44,45,46,49,50,52,53,57,58,60,61,64,66,67,],[17,17,20,17,-16,-17,-6,-10,-30,17,38,20,-7,-40,-41,17,-8,-9,-15,-32,-33,-18,-19,-31,-12,17,-11,-34,-35,-14,-13,-36,]),'WHITESPACE':([0,4,6,7,8,10,14,15,16,17,19,20,24,29,30,31,33,38,40,41,42,44,45,46,49,50,52,53,57,58,60,61,64,66,67,],[5,19,23,-16,-17,-6,-10,-30,5,36,5,39,43,-7,-40,-41,5,54,-8,-9,55,-15,-32,-33,-18,-19,-31,-12,5,-11,-34,-35,-14,-13,-36,]),'UINT':([0,12,13,17,20,25,26,27,28,34,36,39,47,48,59,62,63,],[-38,30,32,-20,-21,45,-29,45,45,45,-23,-22,-38,-37,45,65,45,]),'UFLOAT':([0,12,13,25,26,27,28,34,47,48,59,63,],[-38,31,-37,-38,-29,-38,-38,-38,-38,-37,-38,-38,]),'$end':([1,2,3,6,10,14,15,18,29,30,31,37,40,41,45,46,52,53,58,60,61,64,66,67,],[0,-1,-2,-5,-6,-10,-30,-3,-7,-40,-41,-4,-8,-9,-32,-33,-31,-12,-11,-34,-35,-14,-13,-36,]),'CLOSE_PAREN':([6,10,14,15,29,30,31,32,35,40,41,45,46,51,52,53,56,57,58,60,61,64,65,66,67,],[-5,-6,-10,-30,-7,-40,-41,-39,53,-8,-9,-32,-33,58,-31,-12,60,61,-11,-34,-35,-14,67,-13,-36,]),'STAR':([6,10,14,15,23,29,30,31,40,41,45,46,52,53,58,60,61,64,66,67,],[24,-6,-10,-30,42,-7,-40,-41,-8,-9,-32,-33,-31,-12,-11,-34,-35,-14,-13,-36,]),'STARSTAR':([7,8,9,15,30,31,32,53,58,],[26,26,26,26,-40,-41,-39,26,26,]),}\n\n_lr_action = {}\n\nfor _k, _v in _lr_action_items.items():\n   for _x,_y in zip(_v[0],_v[1]):\n      if not _x in _lr_action:  _lr_action[_x] = {}\n      _lr_action[_x][_k] = _y\n\ndel _lr_action_items\n\n_lr_goto_items = {'main':([0,],[1,]),'complete_expression':([0,4,16,19,33,],[3,18,35,37,51,]),'scale_factor':([0,],[4,]),'product_of_units':([0,4,16,19,33,],[6,6,6,6,6,]),'signed_float':([0,25,27,28,34,47,59,63,],[8,46,46,46,46,57,46,46,]),'signed_int':([0,47,],[9,56,]),'unit_expression':([0,4,11,16,19,21,22,33,],[10,10,29,10,10,40,41,10,]),'division':([0,4,6,16,19,33,57,],[11,11,22,11,11,11,62,]),'sign':([0,25,27,28,34,47,59,63,],[12,12,12,12,12,12,12,12,]),'unit':([0,4,11,16,19,21,22,33,],[14,14,14,14,14,14,14,14,]),'product':([6,],[21,]),'power':([7,8,9,15,53,58,],[25,27,28,34,59,63,]),'numeric_power':([25,27,28,34,59,63,],[44,49,50,52,64,66,]),}\n\n_lr_goto = {}\n\nfor _k, _v in _lr_goto_items.items():\n   for _x, _y in zip(_v[0], _v[1]):\n       if not _x in _lr_goto: _lr_goto[_x] = {}\n       _lr_goto[_x][_k] = _y\n\ndel _lr_goto_items\n\n_lr_productions = [\n  (\"S' -> main\",\"S'\",1,None,None,None),\n  ('main -> UNKNOWN','main',1,'p_main','ogip.py',184),\n  ('main -> complete_expression','main',1,'p_main','ogip.py',185),\n  ('main -> scale_factor complete_expression','main',2,'p_main','ogip.py',186),\n  ('main -> scale_factor WHITESPACE complete_expression','main',3,'p_main','ogip.py',187),\n  ('complete_expression -> product_of_units','complete_expression',1,'p_complete_expression','ogip.py',198),\n  ('product_of_units -> unit_expression','product_of_units',1,'p_product_of_units','ogip.py',204),\n  ('product_of_units -> division unit_expression','product_of_units',2,'p_product_of_units','ogip.py',205),\n  ('product_of_units -> product_of_units product unit_expression','product_of_units',3,'p_product_of_units','ogip.py',206),\n  ('product_of_units -> product_of_units division unit_expression','product_of_units',3,'p_product_of_units','ogip.py',207),\n  ('unit_expression -> unit','unit_expression',1,'p_unit_expression','ogip.py',221),\n  ('unit_expression -> UNIT OPEN_PAREN complete_expression CLOSE_PAREN','unit_expression',4,'p_unit_expression','ogip.py',222),\n  ('unit_expression -> OPEN_PAREN complete_expression CLOSE_PAREN','unit_expression',3,'p_unit_expression','ogip.py',223),\n  ('unit_expression -> UNIT OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power','unit_expression',6,'p_unit_expression','ogip.py',224),\n  ('unit_expression -> OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power','unit_expression',5,'p_unit_expression','ogip.py',225),\n  ('scale_factor -> LIT10 power numeric_power','scale_factor',3,'p_scale_factor','ogip.py',259),\n  ('scale_factor -> LIT10','scale_factor',1,'p_scale_factor','ogip.py',260),\n  ('scale_factor -> signed_float','scale_factor',1,'p_scale_factor','ogip.py',261),\n  ('scale_factor -> signed_float power numeric_power','scale_factor',3,'p_scale_factor','ogip.py',262),\n  ('scale_factor -> signed_int power numeric_power','scale_factor',3,'p_scale_factor','ogip.py',263),\n  ('division -> DIVISION','division',1,'p_division','ogip.py',278),\n  ('division -> WHITESPACE DIVISION','division',2,'p_division','ogip.py',279),\n  ('division -> WHITESPACE DIVISION WHITESPACE','division',3,'p_division','ogip.py',280),\n  ('division -> DIVISION WHITESPACE','division',2,'p_division','ogip.py',281),\n  ('product -> WHITESPACE','product',1,'p_product','ogip.py',287),\n  ('product -> STAR','product',1,'p_product','ogip.py',288),\n  ('product -> WHITESPACE STAR','product',2,'p_product','ogip.py',289),\n  ('product -> WHITESPACE STAR WHITESPACE','product',3,'p_product','ogip.py',290),\n  ('product -> STAR WHITESPACE','product',2,'p_product','ogip.py',291),\n  ('power -> STARSTAR','power',1,'p_power','ogip.py',297),\n  ('unit -> UNIT','unit',1,'p_unit','ogip.py',303),\n  ('unit -> UNIT power numeric_power','unit',3,'p_unit','ogip.py',304),\n  ('numeric_power -> UINT','numeric_power',1,'p_numeric_power','ogip.py',313),\n  ('numeric_power -> signed_float','numeric_power',1,'p_numeric_power','ogip.py',314),\n  ('numeric_power -> OPEN_PAREN signed_int CLOSE_PAREN','numeric_power',3,'p_numeric_power','ogip.py',315),\n  ('numeric_power -> OPEN_PAREN signed_float CLOSE_PAREN','numeric_power',3,'p_numeric_power','ogip.py',316),\n  ('numeric_power -> OPEN_PAREN signed_float division UINT CLOSE_PAREN','numeric_power',5,'p_numeric_power','ogip.py',317),\n  ('sign -> SIGN','sign',1,'p_sign','ogip.py',328),\n  ('sign -> <empty>','sign',0,'p_sign','ogip.py',329),\n  ('signed_int -> SIGN UINT','signed_int',2,'p_signed_int','ogip.py',338),\n  ('signed_float -> sign UINT','signed_float',2,'p_signed_float','ogip.py',344),\n  ('signed_float -> sign UFLOAT','signed_float',2,'p_signed_float','ogip.py',345),\n]"},{"attributeType":"null","col":12,"comment":"null","endLoc":2261,"id":10286,"name":"_bases","nodeType":"Attribute","startLoc":2261,"text":"self._bases"},{"attributeType":"null","col":12,"comment":"null","endLoc":2262,"id":10287,"name":"_powers","nodeType":"Attribute","startLoc":2262,"text":"self._powers"},{"col":4,"comment":"null","endLoc":323,"header":"@staticmethod\n    def _get_unit_name(unit)","id":10288,"name":"_get_unit_name","nodeType":"Function","startLoc":321,"text":"@staticmethod\n    def _get_unit_name(unit):\n        return unit.get_format_name('cds')"},{"col":4,"comment":"null","endLoc":333,"header":"@classmethod\n    def _format_unit_list(cls, units)","id":10289,"name":"_format_unit_list","nodeType":"Function","startLoc":325,"text":"@classmethod\n    def _format_unit_list(cls, units):\n        out = []\n        for base, power in units:\n            if power == 1:\n                out.append(cls._get_unit_name(base))\n            else:\n                out.append(f'{cls._get_unit_name(base)}{int(power)}')\n        return '.'.join(out)"},{"col":0,"comment":"\n    Sets the equivalencies enabled in the unit registry.\n\n    These equivalencies are used if no explicit equivalencies are given,\n    both in unit conversion and in finding equivalent units.\n\n    This is meant in particular for allowing angles to be dimensionless.\n    Use with care.\n\n    Parameters\n    ----------\n    equivalencies : list of tuple\n        list of equivalent pairs, e.g., as returned by\n        `~astropy.units.equivalencies.dimensionless_angles`.\n\n    Examples\n    --------\n    Exponentiation normally requires dimensionless quantities.  To avoid\n    problems with complex phases::\n\n        >>> from astropy import units as u\n        >>> with u.set_enabled_equivalencies(u.dimensionless_angles()):\n        ...     phase = 0.5 * u.cycle\n        ...     np.exp(1j*phase)  # doctest: +FLOAT_CMP\n        <Quantity -1.+1.2246468e-16j>\n    ","endLoc":485,"header":"def set_enabled_equivalencies(equivalencies)","id":10290,"name":"set_enabled_equivalencies","nodeType":"Function","startLoc":454,"text":"def set_enabled_equivalencies(equivalencies):\n    \"\"\"\n    Sets the equivalencies enabled in the unit registry.\n\n    These equivalencies are used if no explicit equivalencies are given,\n    both in unit conversion and in finding equivalent units.\n\n    This is meant in particular for allowing angles to be dimensionless.\n    Use with care.\n\n    Parameters\n    ----------\n    equivalencies : list of tuple\n        list of equivalent pairs, e.g., as returned by\n        `~astropy.units.equivalencies.dimensionless_angles`.\n\n    Examples\n    --------\n    Exponentiation normally requires dimensionless quantities.  To avoid\n    problems with complex phases::\n\n        >>> from astropy import units as u\n        >>> with u.set_enabled_equivalencies(u.dimensionless_angles()):\n        ...     phase = 0.5 * u.cycle\n        ...     np.exp(1j*phase)  # doctest: +FLOAT_CMP\n        <Quantity -1.+1.2246468e-16j>\n    \"\"\"\n    # get a context with a new registry, using all units of the current one\n    context = _UnitContext(get_current_unit_registry())\n    # in this new current registry, enable the equivalencies requested\n    get_current_unit_registry().set_enabled_equivalencies(equivalencies)\n    return context"},{"fileName":"logarithmic.py","filePath":"astropy/units/function","id":10291,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport numbers\nimport numpy as np\n\nfrom astropy.units import (dimensionless_unscaled, photometric, Unit,\n                           CompositeUnit, UnitsError, UnitTypeError,\n                           UnitConversionError)\n\nfrom .core import FunctionUnitBase, FunctionQuantity\nfrom .units import dex, dB, mag\n\n\n__all__ = ['LogUnit', 'MagUnit', 'DexUnit', 'DecibelUnit',\n           'LogQuantity', 'Magnitude', 'Decibel', 'Dex',\n           'STmag', 'ABmag', 'M_bol', 'm_bol']\n\n\nclass LogUnit(FunctionUnitBase):\n    \"\"\"Logarithmic unit containing a physical one\n\n    Usually, logarithmic units are instantiated via specific subclasses\n    such `MagUnit`, `DecibelUnit`, and `DexUnit`.\n\n    Parameters\n    ----------\n    physical_unit : `~astropy.units.Unit` or `string`\n        Unit that is encapsulated within the logarithmic function unit.\n        If not given, dimensionless.\n\n    function_unit :  `~astropy.units.Unit` or `string`\n        By default, the same as the logarithmic unit set by the subclass.\n\n    \"\"\"\n    # the four essential overrides of FunctionUnitBase\n    @property\n    def _default_function_unit(self):\n        return dex\n\n    @property\n    def _quantity_class(self):\n        return LogQuantity\n\n    def from_physical(self, x):\n        \"\"\"Transformation from value in physical to value in logarithmic units.\n        Used in equivalency.\"\"\"\n        return dex.to(self._function_unit, np.log10(x))\n\n    def to_physical(self, x):\n        \"\"\"Transformation from value in logarithmic to value in physical units.\n        Used in equivalency.\"\"\"\n        return 10 ** self._function_unit.to(dex, x)\n    # ^^^^ the four essential overrides of FunctionUnitBase\n\n    # add addition and subtraction, which imply multiplication/division of\n    # the underlying physical units\n    def _add_and_adjust_physical_unit(self, other, sign_self, sign_other):\n        \"\"\"Add/subtract LogUnit to/from another unit, and adjust physical unit.\n\n        self and other are multiplied by sign_self and sign_other, resp.\n\n        We wish to do:   ±lu_1 + ±lu_2  -> lu_f          (lu=logarithmic unit)\n                  and     pu_1^(±1) * pu_2^(±1) -> pu_f  (pu=physical unit)\n\n        Raises\n        ------\n        UnitsError\n            If function units are not equivalent.\n        \"\"\"\n        # First, insist on compatible logarithmic type. Here, plain u.mag,\n        # u.dex, and u.dB are OK, i.e., other does not have to be LogUnit\n        # (this will indirectly test whether other is a unit at all).\n        try:\n            getattr(other, 'function_unit', other)._to(self._function_unit)\n        except AttributeError:\n            # if other is not a unit (i.e., does not have _to).\n            return NotImplemented\n        except UnitsError:\n            raise UnitsError(\"Can only add/subtract logarithmic units of\"\n                             \"of compatible type.\")\n\n        other_physical_unit = getattr(other, 'physical_unit',\n                                      dimensionless_unscaled)\n        physical_unit = CompositeUnit(\n            1, [self._physical_unit, other_physical_unit],\n            [sign_self, sign_other])\n\n        return self._copy(physical_unit)\n\n    def __neg__(self):\n        return self._copy(self.physical_unit**(-1))\n\n    def __add__(self, other):\n        # Only know how to add to a logarithmic unit with compatible type,\n        # be it a plain one (u.mag, etc.,) or another LogUnit\n        return self._add_and_adjust_physical_unit(other, +1, +1)\n\n    def __radd__(self, other):\n        return self._add_and_adjust_physical_unit(other, +1, +1)\n\n    def __sub__(self, other):\n        return self._add_and_adjust_physical_unit(other, +1, -1)\n\n    def __rsub__(self, other):\n        # here, in normal usage other cannot be LogUnit; only equivalent one\n        # would be u.mag,u.dB,u.dex.  But might as well use common routine.\n        return self._add_and_adjust_physical_unit(other, -1, +1)\n\n\nclass MagUnit(LogUnit):\n    \"\"\"Logarithmic physical units expressed in magnitudes\n\n    Parameters\n    ----------\n    physical_unit : `~astropy.units.Unit` or `string`\n        Unit that is encapsulated within the magnitude function unit.\n        If not given, dimensionless.\n\n    function_unit :  `~astropy.units.Unit` or `string`\n        By default, this is ``mag``, but this allows one to use an equivalent\n        unit such as ``2 mag``.\n    \"\"\"\n    @property\n    def _default_function_unit(self):\n        return mag\n\n    @property\n    def _quantity_class(self):\n        return Magnitude\n\n\nclass DexUnit(LogUnit):\n    \"\"\"Logarithmic physical units expressed in magnitudes\n\n    Parameters\n    ----------\n    physical_unit : `~astropy.units.Unit` or `string`\n        Unit that is encapsulated within the magnitude function unit.\n        If not given, dimensionless.\n\n    function_unit :  `~astropy.units.Unit` or `string`\n        By default, this is ``dex``, but this allows one to use an equivalent\n        unit such as ``0.5 dex``.\n    \"\"\"\n\n    @property\n    def _default_function_unit(self):\n        return dex\n\n    @property\n    def _quantity_class(self):\n        return Dex\n\n    def to_string(self, format='generic'):\n        if format == 'cds':\n            if self.physical_unit == dimensionless_unscaled:\n                return \"[-]\"  # by default, would get \"[---]\".\n            else:\n                return f\"[{self.physical_unit.to_string(format=format)}]\"\n        else:\n            return super(DexUnit, self).to_string()\n\n\nclass DecibelUnit(LogUnit):\n    \"\"\"Logarithmic physical units expressed in dB\n\n    Parameters\n    ----------\n    physical_unit : `~astropy.units.Unit` or `string`\n        Unit that is encapsulated within the decibel function unit.\n        If not given, dimensionless.\n\n    function_unit :  `~astropy.units.Unit` or `string`\n        By default, this is ``dB``, but this allows one to use an equivalent\n        unit such as ``2 dB``.\n    \"\"\"\n\n    @property\n    def _default_function_unit(self):\n        return dB\n\n    @property\n    def _quantity_class(self):\n        return Decibel\n\n\nclass LogQuantity(FunctionQuantity):\n    \"\"\"A representation of a (scaled) logarithm of a number with a unit\n\n    Parameters\n    ----------\n    value : number, `~astropy.units.Quantity`, `~astropy.units.function.logarithmic.LogQuantity`, or sequence of quantity-like.\n        The numerical value of the logarithmic quantity. If a number or\n        a `~astropy.units.Quantity` with a logarithmic unit, it will be\n        converted to ``unit`` and the physical unit will be inferred from\n        ``unit``.  If a `~astropy.units.Quantity` with just a physical unit,\n        it will converted to the logarithmic unit, after, if necessary,\n        converting it to the physical unit inferred from ``unit``.\n\n    unit : str, `~astropy.units.UnitBase`, or `~astropy.units.function.FunctionUnitBase`, optional\n        For an `~astropy.units.function.FunctionUnitBase` instance, the\n        physical unit will be taken from it; for other input, it will be\n        inferred from ``value``. By default, ``unit`` is set by the subclass.\n\n    dtype : `~numpy.dtype`, optional\n        The ``dtype`` of the resulting Numpy array or scalar that will\n        hold the value.  If not provided, is is determined automatically\n        from the input value.\n\n    copy : bool, optional\n        If `True` (default), then the value is copied.  Otherwise, a copy will\n        only be made if ``__array__`` returns a copy, if value is a nested\n        sequence, or if a copy is needed to satisfy an explicitly given\n        ``dtype``.  (The `False` option is intended mostly for internal use,\n        to speed up initialization where a copy is known to have been made.\n        Use with care.)\n\n    Examples\n    --------\n    Typically, use is made of an `~astropy.units.function.FunctionQuantity`\n    subclass, as in::\n\n        >>> import astropy.units as u\n        >>> u.Magnitude(-2.5)\n        <Magnitude -2.5 mag>\n        >>> u.Magnitude(10.*u.count/u.second)\n        <Magnitude -2.5 mag(ct / s)>\n        >>> u.Decibel(1.*u.W, u.DecibelUnit(u.mW))  # doctest: +FLOAT_CMP\n        <Decibel 30. dB(mW)>\n\n    \"\"\"\n    # only override of FunctionQuantity\n    _unit_class = LogUnit\n\n    # additions that work just for logarithmic units\n    def __add__(self, other):\n        # Add function units, thus multiplying physical units. If no unit is\n        # given, assume dimensionless_unscaled; this will give the appropriate\n        # exception in LogUnit.__add__.\n        new_unit = self.unit + getattr(other, 'unit', dimensionless_unscaled)\n        # Add actual logarithmic values, rescaling, e.g., dB -> dex.\n        result = self._function_view + getattr(other, '_function_view', other)\n        return self._new_view(result, new_unit)\n\n    def __radd__(self, other):\n        return self.__add__(other)\n\n    def __iadd__(self, other):\n        new_unit = self.unit + getattr(other, 'unit', dimensionless_unscaled)\n        # Do calculation in-place using _function_view of array.\n        function_view = self._function_view\n        function_view += getattr(other, '_function_view', other)\n        self._set_unit(new_unit)\n        return self\n\n    def __sub__(self, other):\n        # Subtract function units, thus dividing physical units.\n        new_unit = self.unit - getattr(other, 'unit', dimensionless_unscaled)\n        # Subtract actual logarithmic values, rescaling, e.g., dB -> dex.\n        result = self._function_view - getattr(other, '_function_view', other)\n        return self._new_view(result, new_unit)\n\n    def __rsub__(self, other):\n        new_unit = self.unit.__rsub__(\n            getattr(other, 'unit', dimensionless_unscaled))\n        result = self._function_view.__rsub__(\n            getattr(other, '_function_view', other))\n        # Ensure the result is in right function unit scale\n        # (with rsub, this does not have to be one's own).\n        result = result.to(new_unit.function_unit)\n        return self._new_view(result, new_unit)\n\n    def __isub__(self, other):\n        new_unit = self.unit - getattr(other, 'unit', dimensionless_unscaled)\n        # Do calculation in-place using _function_view of array.\n        function_view = self._function_view\n        function_view -= getattr(other, '_function_view', other)\n        self._set_unit(new_unit)\n        return self\n\n    def __mul__(self, other):\n        # Multiply by a float or a dimensionless quantity\n        if isinstance(other, numbers.Number):\n            # Multiplying a log means putting the factor into the exponent\n            # of the unit\n            new_physical_unit = self.unit.physical_unit**other\n            result = self.view(np.ndarray) * other\n            return self._new_view(result, self.unit._copy(new_physical_unit))\n        else:\n            return super().__mul__(other)\n\n    def __rmul__(self, other):\n        return self.__mul__(other)\n\n    def __imul__(self, other):\n        if isinstance(other, numbers.Number):\n            new_physical_unit = self.unit.physical_unit**other\n            function_view = self._function_view\n            function_view *= other\n            self._set_unit(self.unit._copy(new_physical_unit))\n            return self\n        else:\n            return super().__imul__(other)\n\n    def __truediv__(self, other):\n        # Divide by a float or a dimensionless quantity\n        if isinstance(other, numbers.Number):\n            # Dividing a log means putting the nominator into the exponent\n            # of the unit\n            new_physical_unit = self.unit.physical_unit**(1/other)\n            result = self.view(np.ndarray) / other\n            return self._new_view(result, self.unit._copy(new_physical_unit))\n        else:\n            return super().__truediv__(other)\n\n    def __itruediv__(self, other):\n        if isinstance(other, numbers.Number):\n            new_physical_unit = self.unit.physical_unit**(1/other)\n            function_view = self._function_view\n            function_view /= other\n            self._set_unit(self.unit._copy(new_physical_unit))\n            return self\n        else:\n            return super().__itruediv__(other)\n\n    def __pow__(self, other):\n        # We check if this power is OK by applying it first to the unit.\n        try:\n            other = float(other)\n        except TypeError:\n            return NotImplemented\n        new_unit = self.unit ** other\n        new_value = self.view(np.ndarray) ** other\n        return self._new_view(new_value, new_unit)\n\n    def __ilshift__(self, other):\n        try:\n            other = Unit(other)\n        except UnitTypeError:\n            return NotImplemented\n\n        if not isinstance(other, self._unit_class):\n            return NotImplemented\n\n        try:\n            factor = self.unit.physical_unit._to(other.physical_unit)\n        except UnitConversionError:\n            # Maybe via equivalencies?  Now we do make a temporary copy.\n            try:\n                value = self._to_value(other)\n            except UnitConversionError:\n                return NotImplemented\n\n            self.view(np.ndarray)[...] = value\n        else:\n            self.view(np.ndarray)[...] += self.unit.from_physical(factor)\n\n        self._set_unit(other)\n        return self\n\n    # Methods that do not work for function units generally but are OK for\n    # logarithmic units as they imply differences and independence of\n    # physical unit.\n    def var(self, axis=None, dtype=None, out=None, ddof=0):\n        return self._wrap_function(np.var, axis, dtype, out=out, ddof=ddof,\n                                   unit=self.unit.function_unit**2)\n\n    def std(self, axis=None, dtype=None, out=None, ddof=0):\n        return self._wrap_function(np.std, axis, dtype, out=out, ddof=ddof,\n                                   unit=self.unit._copy(dimensionless_unscaled))\n\n    def ptp(self, axis=None, out=None):\n        return self._wrap_function(np.ptp, axis, out=out,\n                                   unit=self.unit._copy(dimensionless_unscaled))\n\n    def diff(self, n=1, axis=-1):\n        return self._wrap_function(np.diff, n, axis,\n                                   unit=self.unit._copy(dimensionless_unscaled))\n\n    def ediff1d(self, to_end=None, to_begin=None):\n        return self._wrap_function(np.ediff1d, to_end, to_begin,\n                                   unit=self.unit._copy(dimensionless_unscaled))\n\n    _supported_functions = (FunctionQuantity._supported_functions |\n                            set(getattr(np, function) for function in\n                                ('var', 'std', 'ptp', 'diff', 'ediff1d')))\n\n\nclass Dex(LogQuantity):\n    _unit_class = DexUnit\n\n\nclass Decibel(LogQuantity):\n    _unit_class = DecibelUnit\n\n\nclass Magnitude(LogQuantity):\n    _unit_class = MagUnit\n\n\ndex._function_unit_class = DexUnit\ndB._function_unit_class = DecibelUnit\nmag._function_unit_class = MagUnit\n\n\nSTmag = MagUnit(photometric.STflux)\nSTmag.__doc__ = \"ST magnitude: STmag=-21.1 corresponds to 1 erg/s/cm2/A\"\n\nABmag = MagUnit(photometric.ABflux)\nABmag.__doc__ = \"AB magnitude: ABmag=-48.6 corresponds to 1 erg/s/cm2/Hz\"\n\nM_bol = MagUnit(photometric.Bol)\nM_bol.__doc__ = (\"Absolute bolometric magnitude: M_bol=0 corresponds to \"\n                 \"L_bol0={}\".format(photometric.Bol.si))\n\nm_bol = MagUnit(photometric.bol)\nm_bol.__doc__ = (\"Apparent bolometric magnitude: m_bol=0 corresponds to \"\n                 \"f_bol0={}\".format(photometric.bol.si))\n"},{"fileName":"mixin.py","filePath":"astropy/units/function","id":10292,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom astropy.units.core import IrreducibleUnit, Unit\n\n\nclass FunctionMixin:\n    \"\"\"Mixin class that makes UnitBase subclasses callable.\n\n    Provides a __call__ method that passes on arguments to a FunctionUnit.\n    Instances of this class should define ``_function_unit_class`` pointing\n    to the relevant class.\n\n    See units.py and logarithmic.py for usage.\n    \"\"\"\n    def __call__(self, unit=None):\n        return self._function_unit_class(physical_unit=unit,\n                                         function_unit=self)\n\n\nclass IrreducibleFunctionUnit(FunctionMixin, IrreducibleUnit):\n    pass\n\n\nclass RegularFunctionUnit(FunctionMixin, Unit):\n    pass\n"},{"className":"FunctionMixin","col":0,"comment":"Mixin class that makes UnitBase subclasses callable.\n\n    Provides a __call__ method that passes on arguments to a FunctionUnit.\n    Instances of this class should define ``_function_unit_class`` pointing\n    to the relevant class.\n\n    See units.py and logarithmic.py for usage.\n    ","endLoc":17,"id":10293,"nodeType":"Class","startLoc":6,"text":"class FunctionMixin:\n    \"\"\"Mixin class that makes UnitBase subclasses callable.\n\n    Provides a __call__ method that passes on arguments to a FunctionUnit.\n    Instances of this class should define ``_function_unit_class`` pointing\n    to the relevant class.\n\n    See units.py and logarithmic.py for usage.\n    \"\"\"\n    def __call__(self, unit=None):\n        return self._function_unit_class(physical_unit=unit,\n                                         function_unit=self)"},{"col":4,"comment":"null","endLoc":17,"header":"def __call__(self, unit=None)","id":10294,"name":"__call__","nodeType":"Function","startLoc":15,"text":"def __call__(self, unit=None):\n        return self._function_unit_class(physical_unit=unit,\n                                         function_unit=self)"},{"className":"IrreducibleFunctionUnit","col":0,"comment":"null","endLoc":21,"id":10295,"nodeType":"Class","startLoc":20,"text":"class IrreducibleFunctionUnit(FunctionMixin, IrreducibleUnit):\n    pass"},{"className":"RegularFunctionUnit","col":0,"comment":"null","endLoc":25,"id":10296,"nodeType":"Class","startLoc":24,"text":"class RegularFunctionUnit(FunctionMixin, Unit):\n    pass"},{"col":4,"comment":"The physical quantity corresponding the function one.","endLoc":513,"header":"@property\n    def physical(self)","id":10297,"name":"physical","nodeType":"Function","startLoc":510,"text":"@property\n    def physical(self):\n        \"\"\"The physical quantity corresponding the function one.\"\"\"\n        return self.to(self.unit.physical_unit)"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":10298,"name":"dex","nodeType":"Attribute","startLoc":21,"text":"dex"},{"col":0,"comment":"\n    Set aliases for units.\n\n    This is useful for handling alternate spellings for units, or\n    misspelled units in files one is trying to read.\n\n    Parameters\n    ----------\n    aliases : dict of str, Unit\n        The aliases to set. The keys must be the string aliases, and values\n        must be the `astropy.units.Unit` that the alias will be mapped to.\n\n    Raises\n    ------\n    ValueError\n        If the alias already defines a different unit.\n\n    Examples\n    --------\n    To temporarily allow for a misspelled 'Angstroem' unit::\n\n        >>> from astropy import units as u\n        >>> with u.set_enabled_aliases({'Angstroem': u.Angstrom}):\n        ...     print(u.Unit(\"Angstroem\", parse_strict=\"raise\") == u.Angstrom)\n        True\n\n    ","endLoc":544,"header":"def set_enabled_aliases(aliases)","id":10299,"name":"set_enabled_aliases","nodeType":"Function","startLoc":512,"text":"def set_enabled_aliases(aliases):\n    \"\"\"\n    Set aliases for units.\n\n    This is useful for handling alternate spellings for units, or\n    misspelled units in files one is trying to read.\n\n    Parameters\n    ----------\n    aliases : dict of str, Unit\n        The aliases to set. The keys must be the string aliases, and values\n        must be the `astropy.units.Unit` that the alias will be mapped to.\n\n    Raises\n    ------\n    ValueError\n        If the alias already defines a different unit.\n\n    Examples\n    --------\n    To temporarily allow for a misspelled 'Angstroem' unit::\n\n        >>> from astropy import units as u\n        >>> with u.set_enabled_aliases({'Angstroem': u.Angstrom}):\n        ...     print(u.Unit(\"Angstroem\", parse_strict=\"raise\") == u.Angstrom)\n        True\n\n    \"\"\"\n    # get a context with a new registry, which is a copy of the current one\n    context = _UnitContext(get_current_unit_registry())\n    # in this new current registry, enable the further equivalencies requested\n    get_current_unit_registry().set_enabled_aliases(aliases)\n    return context"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":10300,"name":"dB","nodeType":"Attribute","startLoc":24,"text":"dB"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":10301,"name":"mag","nodeType":"Attribute","startLoc":27,"text":"mag"},{"className":"LogUnit","col":0,"comment":"Logarithmic unit containing a physical one\n\n    Usually, logarithmic units are instantiated via specific subclasses\n    such `MagUnit`, `DecibelUnit`, and `DexUnit`.\n\n    Parameters\n    ----------\n    physical_unit : `~astropy.units.Unit` or `string`\n        Unit that is encapsulated within the logarithmic function unit.\n        If not given, dimensionless.\n\n    function_unit :  `~astropy.units.Unit` or `string`\n        By default, the same as the logarithmic unit set by the subclass.\n\n    ","endLoc":107,"id":10302,"nodeType":"Class","startLoc":19,"text":"class LogUnit(FunctionUnitBase):\n    \"\"\"Logarithmic unit containing a physical one\n\n    Usually, logarithmic units are instantiated via specific subclasses\n    such `MagUnit`, `DecibelUnit`, and `DexUnit`.\n\n    Parameters\n    ----------\n    physical_unit : `~astropy.units.Unit` or `string`\n        Unit that is encapsulated within the logarithmic function unit.\n        If not given, dimensionless.\n\n    function_unit :  `~astropy.units.Unit` or `string`\n        By default, the same as the logarithmic unit set by the subclass.\n\n    \"\"\"\n    # the four essential overrides of FunctionUnitBase\n    @property\n    def _default_function_unit(self):\n        return dex\n\n    @property\n    def _quantity_class(self):\n        return LogQuantity\n\n    def from_physical(self, x):\n        \"\"\"Transformation from value in physical to value in logarithmic units.\n        Used in equivalency.\"\"\"\n        return dex.to(self._function_unit, np.log10(x))\n\n    def to_physical(self, x):\n        \"\"\"Transformation from value in logarithmic to value in physical units.\n        Used in equivalency.\"\"\"\n        return 10 ** self._function_unit.to(dex, x)\n    # ^^^^ the four essential overrides of FunctionUnitBase\n\n    # add addition and subtraction, which imply multiplication/division of\n    # the underlying physical units\n    def _add_and_adjust_physical_unit(self, other, sign_self, sign_other):\n        \"\"\"Add/subtract LogUnit to/from another unit, and adjust physical unit.\n\n        self and other are multiplied by sign_self and sign_other, resp.\n\n        We wish to do:   ±lu_1 + ±lu_2  -> lu_f          (lu=logarithmic unit)\n                  and     pu_1^(±1) * pu_2^(±1) -> pu_f  (pu=physical unit)\n\n        Raises\n        ------\n        UnitsError\n            If function units are not equivalent.\n        \"\"\"\n        # First, insist on compatible logarithmic type. Here, plain u.mag,\n        # u.dex, and u.dB are OK, i.e., other does not have to be LogUnit\n        # (this will indirectly test whether other is a unit at all).\n        try:\n            getattr(other, 'function_unit', other)._to(self._function_unit)\n        except AttributeError:\n            # if other is not a unit (i.e., does not have _to).\n            return NotImplemented\n        except UnitsError:\n            raise UnitsError(\"Can only add/subtract logarithmic units of\"\n                             \"of compatible type.\")\n\n        other_physical_unit = getattr(other, 'physical_unit',\n                                      dimensionless_unscaled)\n        physical_unit = CompositeUnit(\n            1, [self._physical_unit, other_physical_unit],\n            [sign_self, sign_other])\n\n        return self._copy(physical_unit)\n\n    def __neg__(self):\n        return self._copy(self.physical_unit**(-1))\n\n    def __add__(self, other):\n        # Only know how to add to a logarithmic unit with compatible type,\n        # be it a plain one (u.mag, etc.,) or another LogUnit\n        return self._add_and_adjust_physical_unit(other, +1, +1)\n\n    def __radd__(self, other):\n        return self._add_and_adjust_physical_unit(other, +1, +1)\n\n    def __sub__(self, other):\n        return self._add_and_adjust_physical_unit(other, +1, -1)\n\n    def __rsub__(self, other):\n        # here, in normal usage other cannot be LogUnit; only equivalent one\n        # would be u.mag,u.dB,u.dex.  But might as well use common routine.\n        return self._add_and_adjust_physical_unit(other, -1, +1)"},{"fileName":"__init__.py","filePath":"astropy/units/function","id":10303,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis subpackage contains classes and functions for defining and converting\nbetween different function units and quantities, i.e., using units which\nare some function of a physical unit, such as magnitudes and decibels.\n\"\"\"\nfrom .core import *\nfrom .logarithmic import *\n"},{"col":0,"comment":"","endLoc":7,"header":"__init__.py#<anonymous>","id":10304,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis subpackage contains classes and functions for defining and converting\nbetween different function units and quantities, i.e., using units which\nare some function of a physical unit, such as magnitudes and decibels.\n\"\"\""},{"fileName":"units.py","filePath":"astropy/units/function","id":10305,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis package defines units that can also be used as functions of other units.\nIf called, their arguments are used to initialize the corresponding function\nunit (e.g., ``u.mag(u.ct/u.s)``).  Note that the prefixed versions cannot be\ncalled, as it would be unclear what, e.g., ``u.mmag(u.ct/u.s)`` would mean.\n\"\"\"\nfrom astropy.units.core import _add_prefixes\nfrom .mixin import RegularFunctionUnit, IrreducibleFunctionUnit\n\n\n_ns = globals()\n\n###########################################################################\n# Logarithmic units\n\n# These calls are what core.def_unit would do, but we need to use the callable\n# unit versions.  The actual function unit classes get added in logarithmic.\n\ndex = IrreducibleFunctionUnit(['dex'], namespace=_ns,\n                              doc=\"Dex: Base 10 logarithmic unit\")\n\ndB = RegularFunctionUnit(['dB', 'decibel'], 0.1 * dex, namespace=_ns,\n                         doc=\"Decibel: ten per base 10 logarithmic unit\")\n\nmag = RegularFunctionUnit(['mag'], -0.4 * dex, namespace=_ns,\n                          doc=(\"Astronomical magnitude: \"\n                               \"-2.5 per base 10 logarithmic unit\"))\n\n_add_prefixes(mag, namespace=_ns, prefixes=True)\n\n###########################################################################\n# CLEANUP\n\ndel RegularFunctionUnit\ndel IrreducibleFunctionUnit\n\n###########################################################################\n# DOCSTRING\n\n# This generates a docstring for this module that describes all of the\n# standard units defined here.\nfrom astropy.units.utils import generate_unit_summary as _generate_unit_summary\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":10306,"name":"_ns","nodeType":"Attribute","startLoc":13,"text":"_ns"},{"col":4,"comment":"null","endLoc":38,"header":"@property\n    def _default_function_unit(self)","id":10307,"name":"_default_function_unit","nodeType":"Function","startLoc":36,"text":"@property\n    def _default_function_unit(self):\n        return dex"},{"col":4,"comment":"null","endLoc":42,"header":"@property\n    def _quantity_class(self)","id":10308,"name":"_quantity_class","nodeType":"Function","startLoc":40,"text":"@property\n    def _quantity_class(self):\n        return LogQuantity"},{"col":4,"comment":"Transformation from value in physical to value in logarithmic units.\n        Used in equivalency.","endLoc":47,"header":"def from_physical(self, x)","id":10309,"name":"from_physical","nodeType":"Function","startLoc":44,"text":"def from_physical(self, x):\n        \"\"\"Transformation from value in physical to value in logarithmic units.\n        Used in equivalency.\"\"\"\n        return dex.to(self._function_unit, np.log10(x))"},{"col":4,"comment":"Transformation from value in logarithmic to value in physical units.\n        Used in equivalency.","endLoc":52,"header":"def to_physical(self, x)","id":10310,"name":"to_physical","nodeType":"Function","startLoc":49,"text":"def to_physical(self, x):\n        \"\"\"Transformation from value in logarithmic to value in physical units.\n        Used in equivalency.\"\"\"\n        return 10 ** self._function_unit.to(dex, x)"},{"col":4,"comment":"null","endLoc":368,"header":"@classmethod\n    def to_string(cls, unit)","id":10311,"name":"to_string","nodeType":"Function","startLoc":335,"text":"@classmethod\n    def to_string(cls, unit):\n        # Remove units that aren't known to the format\n        unit = utils.decompose_to_known_units(unit, cls._get_unit_name)\n\n        if isinstance(unit, core.CompositeUnit):\n            if unit == core.dimensionless_unscaled:\n                return '---'\n            elif is_effectively_unity(unit.scale*100.):\n                return '%'\n\n            if unit.scale == 1:\n                s = ''\n            else:\n                m, e = utils.split_mantissa_exponent(unit.scale)\n                parts = []\n                if m not in ('', '1'):\n                    parts.append(m)\n                if e:\n                    if not e.startswith('-'):\n                        e = \"+\" + e\n                    parts.append(f'10{e}')\n                s = 'x'.join(parts)\n\n            pairs = list(zip(unit.bases, unit.powers))\n            if len(pairs) > 0:\n                pairs.sort(key=operator.itemgetter(1), reverse=True)\n\n                s += cls._format_unit_list(pairs)\n\n        elif isinstance(unit, core.NamedUnit):\n            s = cls._get_unit_name(unit)\n\n        return s"},{"col":4,"comment":"View as Quantity with function unit, dropping the physical unit.\n\n        Use `~astropy.units.quantity.Quantity.value` for just the value.\n        ","endLoc":521,"header":"@property\n    def _function_view(self)","id":10312,"name":"_function_view","nodeType":"Function","startLoc":515,"text":"@property\n    def _function_view(self):\n        \"\"\"View as Quantity with function unit, dropping the physical unit.\n\n        Use `~astropy.units.quantity.Quantity.value` for just the value.\n        \"\"\"\n        return self._new_view(unit=self.unit.function_unit)"},{"col":4,"comment":"Add/subtract LogUnit to/from another unit, and adjust physical unit.\n\n        self and other are multiplied by sign_self and sign_other, resp.\n\n        We wish to do:   ±lu_1 + ±lu_2  -> lu_f          (lu=logarithmic unit)\n                  and     pu_1^(±1) * pu_2^(±1) -> pu_f  (pu=physical unit)\n\n        Raises\n        ------\n        UnitsError\n            If function units are not equivalent.\n        ","endLoc":88,"header":"def _add_and_adjust_physical_unit(self, other, sign_self, sign_other)","id":10313,"name":"_add_and_adjust_physical_unit","nodeType":"Function","startLoc":57,"text":"def _add_and_adjust_physical_unit(self, other, sign_self, sign_other):\n        \"\"\"Add/subtract LogUnit to/from another unit, and adjust physical unit.\n\n        self and other are multiplied by sign_self and sign_other, resp.\n\n        We wish to do:   ±lu_1 + ±lu_2  -> lu_f          (lu=logarithmic unit)\n                  and     pu_1^(±1) * pu_2^(±1) -> pu_f  (pu=physical unit)\n\n        Raises\n        ------\n        UnitsError\n            If function units are not equivalent.\n        \"\"\"\n        # First, insist on compatible logarithmic type. Here, plain u.mag,\n        # u.dex, and u.dB are OK, i.e., other does not have to be LogUnit\n        # (this will indirectly test whether other is a unit at all).\n        try:\n            getattr(other, 'function_unit', other)._to(self._function_unit)\n        except AttributeError:\n            # if other is not a unit (i.e., does not have _to).\n            return NotImplemented\n        except UnitsError:\n            raise UnitsError(\"Can only add/subtract logarithmic units of\"\n                             \"of compatible type.\")\n\n        other_physical_unit = getattr(other, 'physical_unit',\n                                      dimensionless_unscaled)\n        physical_unit = CompositeUnit(\n            1, [self._physical_unit, other_physical_unit],\n            [sign_self, sign_other])\n\n        return self._copy(physical_unit)"},{"col":4,"comment":"Return a copy with the physical unit in SI units.","endLoc":527,"header":"@property\n    def si(self)","id":10314,"name":"si","nodeType":"Function","startLoc":524,"text":"@property\n    def si(self):\n        \"\"\"Return a copy with the physical unit in SI units.\"\"\"\n        return self.__class__(self.physical.si)"},{"col":0,"comment":"\n    Add aliases for units.\n\n    This is useful for handling alternate spellings for units, or\n    misspelled units in files one is trying to read.\n\n    Since no aliases are enabled by default, generally it is recommended\n    to use `set_enabled_aliases`.\n\n    Parameters\n    ----------\n    aliases : dict of str, Unit\n        The aliases to add. The keys must be the string aliases, and values\n        must be the `astropy.units.Unit` that the alias will be mapped to.\n\n    Raises\n    ------\n    ValueError\n        If the alias already defines a different unit.\n\n    Examples\n    --------\n    To temporarily allow for a misspelled 'Angstroem' unit::\n\n        >>> from astropy import units as u\n        >>> with u.add_enabled_aliases({'Angstroem': u.Angstrom}):\n        ...     print(u.Unit(\"Angstroem\", parse_strict=\"raise\") == u.Angstrom)\n        True\n\n    ","endLoc":582,"header":"def add_enabled_aliases(aliases)","id":10315,"name":"add_enabled_aliases","nodeType":"Function","startLoc":547,"text":"def add_enabled_aliases(aliases):\n    \"\"\"\n    Add aliases for units.\n\n    This is useful for handling alternate spellings for units, or\n    misspelled units in files one is trying to read.\n\n    Since no aliases are enabled by default, generally it is recommended\n    to use `set_enabled_aliases`.\n\n    Parameters\n    ----------\n    aliases : dict of str, Unit\n        The aliases to add. The keys must be the string aliases, and values\n        must be the `astropy.units.Unit` that the alias will be mapped to.\n\n    Raises\n    ------\n    ValueError\n        If the alias already defines a different unit.\n\n    Examples\n    --------\n    To temporarily allow for a misspelled 'Angstroem' unit::\n\n        >>> from astropy import units as u\n        >>> with u.add_enabled_aliases({'Angstroem': u.Angstrom}):\n        ...     print(u.Unit(\"Angstroem\", parse_strict=\"raise\") == u.Angstrom)\n        True\n\n    \"\"\"\n    # get a context with a new registry, which is a copy of the current one\n    context = _UnitContext(get_current_unit_registry())\n    # in this new current registry, enable the further equivalencies requested\n    get_current_unit_registry().add_enabled_aliases(aliases)\n    return context"},{"col":0,"comment":"","endLoc":8,"header":"units.py#<anonymous>","id":10316,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis package defines units that can also be used as functions of other units.\nIf called, their arguments are used to initialize the corresponding function\nunit (e.g., ``u.mag(u.ct/u.s)``).  Note that the prefixed versions cannot be\ncalled, as it would be unclear what, e.g., ``u.mmag(u.ct/u.s)`` would mean.\n\"\"\"\n\n_ns = globals()\n\ndex = IrreducibleFunctionUnit(['dex'], namespace=_ns,\n                              doc=\"Dex: Base 10 logarithmic unit\")\n\ndB = RegularFunctionUnit(['dB', 'decibel'], 0.1 * dex, namespace=_ns,\n                         doc=\"Decibel: ten per base 10 logarithmic unit\")\n\nmag = RegularFunctionUnit(['mag'], -0.4 * dex, namespace=_ns,\n                          doc=(\"Astronomical magnitude: \"\n                               \"-2.5 per base 10 logarithmic unit\"))\n\n_add_prefixes(mag, namespace=_ns, prefixes=True)\n\ndel RegularFunctionUnit\n\ndel IrreducibleFunctionUnit\n\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())"},{"col":0,"comment":"\n    This is used to reconstruct units when passed around by\n    multiprocessing.\n    ","endLoc":1842,"header":"def _recreate_irreducible_unit(cls, names, registered)","id":10317,"name":"_recreate_irreducible_unit","nodeType":"Function","startLoc":1825,"text":"def _recreate_irreducible_unit(cls, names, registered):\n    \"\"\"\n    This is used to reconstruct units when passed around by\n    multiprocessing.\n    \"\"\"\n    registry = get_current_unit_registry().registry\n    if names[0] in registry:\n        # If in local registry return that object.\n        return registry[names[0]]\n    else:\n        # otherwise, recreate the unit.\n        unit = cls(names)\n        if registered:\n            # If not in local registry but registered in origin registry,\n            # enable unit in local registry.\n            get_current_unit_registry().add_enabled_units([unit])\n\n        return unit"},{"attributeType":"null","col":0,"comment":"Functions with implementations usable with proper unit conversion.","endLoc":56,"id":10318,"name":"FUNCTION_HELPERS","nodeType":"Attribute","startLoc":56,"text":"FUNCTION_HELPERS"},{"attributeType":"null","col":0,"comment":"Functions for which we provide our own implementation.","endLoc":58,"id":10319,"name":"DISPATCHED_FUNCTIONS","nodeType":"Attribute","startLoc":58,"text":"DISPATCHED_FUNCTIONS"},{"attributeType":"null","col":0,"comment":"Functions that cannot sensibly be used with quantities.","endLoc":60,"id":10320,"name":"UNSUPPORTED_FUNCTIONS","nodeType":"Attribute","startLoc":60,"text":"UNSUPPORTED_FUNCTIONS"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for Quantity\n    ","endLoc":57,"id":10321,"nodeType":"Class","startLoc":48,"text":"class Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for Quantity\n    \"\"\"\n    latex_array_threshold = _config.ConfigItem(100,\n        'The maximum size an array Quantity can be before its LaTeX '\n        'representation for IPython gets \"summarized\" (meaning only the first '\n        'and last few elements are shown with \"...\" between). Setting this to a '\n        'negative number means that the value will instead be whatever numpy '\n        'gets from get_printoptions.')"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":52,"id":10322,"name":"latex_array_threshold","nodeType":"Attribute","startLoc":52,"text":"latex_array_threshold"},{"col":4,"comment":"null","endLoc":91,"header":"def __neg__(self)","id":10323,"name":"__neg__","nodeType":"Function","startLoc":90,"text":"def __neg__(self):\n        return self._copy(self.physical_unit**(-1))"},{"className":"QuantityIterator","col":0,"comment":"\n    Flat iterator object to iterate over Quantities\n\n    A `QuantityIterator` iterator is returned by ``q.flat`` for any Quantity\n    ``q``.  It allows iterating over the array as if it were a 1-D array,\n    either in a for-loop or by calling its `next` method.\n\n    Iteration is done in C-contiguous style, with the last index varying the\n    fastest. The iterator can also be indexed using basic slicing or\n    advanced indexing.\n\n    See Also\n    --------\n    Quantity.flatten : Returns a flattened copy of an array.\n\n    Notes\n    -----\n    `QuantityIterator` is inspired by `~numpy.ma.core.MaskedIterator`.  It\n    is not exported by the `~astropy.units` module.  Instead of\n    instantiating a `QuantityIterator` directly, use `Quantity.flat`.\n    ","endLoc":137,"id":10324,"nodeType":"Class","startLoc":63,"text":"class QuantityIterator:\n    \"\"\"\n    Flat iterator object to iterate over Quantities\n\n    A `QuantityIterator` iterator is returned by ``q.flat`` for any Quantity\n    ``q``.  It allows iterating over the array as if it were a 1-D array,\n    either in a for-loop or by calling its `next` method.\n\n    Iteration is done in C-contiguous style, with the last index varying the\n    fastest. The iterator can also be indexed using basic slicing or\n    advanced indexing.\n\n    See Also\n    --------\n    Quantity.flatten : Returns a flattened copy of an array.\n\n    Notes\n    -----\n    `QuantityIterator` is inspired by `~numpy.ma.core.MaskedIterator`.  It\n    is not exported by the `~astropy.units` module.  Instead of\n    instantiating a `QuantityIterator` directly, use `Quantity.flat`.\n    \"\"\"\n\n    def __init__(self, q):\n        self._quantity = q\n        self._dataiter = q.view(np.ndarray).flat\n\n    def __iter__(self):\n        return self\n\n    def __getitem__(self, indx):\n        out = self._dataiter.__getitem__(indx)\n        # For single elements, ndarray.flat.__getitem__ returns scalars; these\n        # need a new view as a Quantity.\n        if isinstance(out, type(self._quantity)):\n            return out\n        else:\n            return self._quantity._new_view(out)\n\n    def __setitem__(self, index, value):\n        self._dataiter[index] = self._quantity._to_own_unit(value)\n\n    def __next__(self):\n        \"\"\"\n        Return the next value, or raise StopIteration.\n        \"\"\"\n        out = next(self._dataiter)\n        # ndarray.flat._dataiter returns scalars, so need a view as a Quantity.\n        return self._quantity._new_view(out)\n\n    next = __next__\n\n    def __len__(self):\n        return len(self._dataiter)\n\n    #### properties and methods to match `numpy.ndarray.flatiter` ####\n\n    @property\n    def base(self):\n        \"\"\"A reference to the array that is iterated over.\"\"\"\n        return self._quantity\n\n    @property\n    def coords(self):\n        \"\"\"An N-dimensional tuple of current coordinates.\"\"\"\n        return self._dataiter.coords\n\n    @property\n    def index(self):\n        \"\"\"Current flat index into the array.\"\"\"\n        return self._dataiter.index\n\n    def copy(self):\n        \"\"\"Get a copy of the iterator as a 1-D array.\"\"\"\n        return self._quantity.flatten()"},{"col":4,"comment":"null","endLoc":96,"header":"def __add__(self, other)","id":10325,"name":"__add__","nodeType":"Function","startLoc":93,"text":"def __add__(self, other):\n        # Only know how to add to a logarithmic unit with compatible type,\n        # be it a plain one (u.mag, etc.,) or another LogUnit\n        return self._add_and_adjust_physical_unit(other, +1, +1)"},{"col":4,"comment":"null","endLoc":91,"header":"def __iter__(self)","id":10326,"name":"__iter__","nodeType":"Function","startLoc":90,"text":"def __iter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":100,"header":"def __getitem__(self, indx)","id":10327,"name":"__getitem__","nodeType":"Function","startLoc":93,"text":"def __getitem__(self, indx):\n        out = self._dataiter.__getitem__(indx)\n        # For single elements, ndarray.flat.__getitem__ returns scalars; these\n        # need a new view as a Quantity.\n        if isinstance(out, type(self._quantity)):\n            return out\n        else:\n            return self._quantity._new_view(out)"},{"id":10328,"name":"astropy/units/quantity_helper","nodeType":"Package"},{"fileName":"scipy_special.py","filePath":"astropy/units/quantity_helper","id":10329,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"Quantity helpers for the scipy.special ufuncs.\n\nAvailable ufuncs in this module are at\nhttps://docs.scipy.org/doc/scipy/reference/special.html\n\"\"\"\nimport numpy as np\n\nfrom astropy.units.core import UnitsError, UnitTypeError, dimensionless_unscaled\nfrom . import UFUNC_HELPERS\nfrom .helpers import (get_converter,\n                      helper_dimensionless_to_dimensionless,\n                      helper_cbrt,\n                      helper_two_arg_dimensionless)\n\n\n# ufuncs that require dimensionless input and give dimensionless output.\ndimensionless_to_dimensionless_sps_ufuncs = (\n    'erf', 'erfc', 'erfcx', 'erfi', 'erfinv', 'erfcinv',\n    'gamma', 'gammaln', 'loggamma', 'gammasgn', 'psi', 'rgamma', 'digamma',\n    'wofz', 'dawsn', 'entr', 'exprel', 'expm1', 'log1p', 'exp2', 'exp10',\n    'j0', 'j1', 'y0', 'y1', 'i0', 'i0e', 'i1', 'i1e',\n    'k0', 'k0e', 'k1', 'k1e', 'itj0y0', 'it2j0y0', 'iti0k0', 'it2i0k0',\n    'ndtr', 'ndtri')\n\n\nscipy_special_ufuncs = dimensionless_to_dimensionless_sps_ufuncs\n# ufuncs that require input in degrees and give dimensionless output.\ndegree_to_dimensionless_sps_ufuncs = ('cosdg', 'sindg', 'tandg', 'cotdg')\nscipy_special_ufuncs += degree_to_dimensionless_sps_ufuncs\n# ufuncs that require 2 dimensionless inputs and give dimensionless output.\n# note: 'jv' and 'jn' are aliases in some scipy versions, which will\n# cause the same key to be written twice, but since both are handled by the\n# same helper there is no harm done.\ntwo_arg_dimensionless_sps_ufuncs = (\n    'jv', 'jn', 'jve', 'yn', 'yv', 'yve', 'kn', 'kv', 'kve', 'iv', 'ive',\n    'hankel1', 'hankel1e', 'hankel2', 'hankel2e')\nscipy_special_ufuncs += two_arg_dimensionless_sps_ufuncs\n# ufuncs handled as special cases\nscipy_special_ufuncs += ('cbrt', 'radian')\n\n\ndef helper_degree_to_dimensionless(f, unit):\n    from astropy.units.si import degree\n    try:\n        return [get_converter(unit, degree)], dimensionless_unscaled\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))\n\n\ndef helper_degree_minute_second_to_radian(f, unit1, unit2, unit3):\n    from astropy.units.si import degree, arcmin, arcsec, radian\n    try:\n        return [get_converter(unit1, degree),\n                get_converter(unit2, arcmin),\n                get_converter(unit3, arcsec)], radian\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))\n\n\ndef get_scipy_special_helpers():\n    import scipy.special as sps\n    SCIPY_HELPERS = {}\n    for name in dimensionless_to_dimensionless_sps_ufuncs:\n        # In SCIPY_LT_1_5, erfinv and erfcinv are not ufuncs.\n        ufunc = getattr(sps, name, None)\n        if isinstance(ufunc, np.ufunc):\n            SCIPY_HELPERS[ufunc] = helper_dimensionless_to_dimensionless\n\n    for ufunc in degree_to_dimensionless_sps_ufuncs:\n        SCIPY_HELPERS[getattr(sps, ufunc)] = helper_degree_to_dimensionless\n\n    for ufunc in two_arg_dimensionless_sps_ufuncs:\n        SCIPY_HELPERS[getattr(sps, ufunc)] = helper_two_arg_dimensionless\n\n    # ufuncs handled as special cases\n    SCIPY_HELPERS[sps.cbrt] = helper_cbrt\n    SCIPY_HELPERS[sps.radian] = helper_degree_minute_second_to_radian\n    return SCIPY_HELPERS\n\n\nUFUNC_HELPERS.register_module('scipy.special', scipy_special_ufuncs,\n                              get_scipy_special_helpers)\n"},{"col":4,"comment":"null","endLoc":99,"header":"def __radd__(self, other)","id":10330,"name":"__radd__","nodeType":"Function","startLoc":98,"text":"def __radd__(self, other):\n        return self._add_and_adjust_physical_unit(other, +1, +1)"},{"col":4,"comment":"null","endLoc":102,"header":"def __sub__(self, other)","id":10331,"name":"__sub__","nodeType":"Function","startLoc":101,"text":"def __sub__(self, other):\n        return self._add_and_adjust_physical_unit(other, +1, -1)"},{"col":4,"comment":"null","endLoc":103,"header":"def __setitem__(self, index, value)","id":10332,"name":"__setitem__","nodeType":"Function","startLoc":102,"text":"def __setitem__(self, index, value):\n        self._dataiter[index] = self._quantity._to_own_unit(value)"},{"col":4,"comment":"null","endLoc":107,"header":"def __rsub__(self, other)","id":10333,"name":"__rsub__","nodeType":"Function","startLoc":104,"text":"def __rsub__(self, other):\n        # here, in normal usage other cannot be LogUnit; only equivalent one\n        # would be u.mag,u.dB,u.dex.  But might as well use common routine.\n        return self._add_and_adjust_physical_unit(other, -1, +1)"},{"attributeType":"null","col":0,"comment":"null","endLoc":111,"id":10334,"name":"UFUNC_HELPERS","nodeType":"Attribute","startLoc":111,"text":"UFUNC_HELPERS"},{"col":4,"comment":"\n        Return the next value, or raise StopIteration.\n        ","endLoc":111,"header":"def __next__(self)","id":10335,"name":"__next__","nodeType":"Function","startLoc":105,"text":"def __next__(self):\n        \"\"\"\n        Return the next value, or raise StopIteration.\n        \"\"\"\n        out = next(self._dataiter)\n        # ndarray.flat._dataiter returns scalars, so need a view as a Quantity.\n        return self._quantity._new_view(out)"},{"className":"MagUnit","col":0,"comment":"Logarithmic physical units expressed in magnitudes\n\n    Parameters\n    ----------\n    physical_unit : `~astropy.units.Unit` or `string`\n        Unit that is encapsulated within the magnitude function unit.\n        If not given, dimensionless.\n\n    function_unit :  `~astropy.units.Unit` or `string`\n        By default, this is ``mag``, but this allows one to use an equivalent\n        unit such as ``2 mag``.\n    ","endLoc":129,"id":10336,"nodeType":"Class","startLoc":110,"text":"class MagUnit(LogUnit):\n    \"\"\"Logarithmic physical units expressed in magnitudes\n\n    Parameters\n    ----------\n    physical_unit : `~astropy.units.Unit` or `string`\n        Unit that is encapsulated within the magnitude function unit.\n        If not given, dimensionless.\n\n    function_unit :  `~astropy.units.Unit` or `string`\n        By default, this is ``mag``, but this allows one to use an equivalent\n        unit such as ``2 mag``.\n    \"\"\"\n    @property\n    def _default_function_unit(self):\n        return mag\n\n    @property\n    def _quantity_class(self):\n        return Magnitude"},{"col":4,"comment":"null","endLoc":125,"header":"@property\n    def _default_function_unit(self)","id":10337,"name":"_default_function_unit","nodeType":"Function","startLoc":123,"text":"@property\n    def _default_function_unit(self):\n        return mag"},{"col":4,"comment":"null","endLoc":129,"header":"@property\n    def _quantity_class(self)","id":10338,"name":"_quantity_class","nodeType":"Function","startLoc":127,"text":"@property\n    def _quantity_class(self):\n        return Magnitude"},{"className":"DexUnit","col":0,"comment":"Logarithmic physical units expressed in magnitudes\n\n    Parameters\n    ----------\n    physical_unit : `~astropy.units.Unit` or `string`\n        Unit that is encapsulated within the magnitude function unit.\n        If not given, dimensionless.\n\n    function_unit :  `~astropy.units.Unit` or `string`\n        By default, this is ``dex``, but this allows one to use an equivalent\n        unit such as ``0.5 dex``.\n    ","endLoc":161,"id":10339,"nodeType":"Class","startLoc":132,"text":"class DexUnit(LogUnit):\n    \"\"\"Logarithmic physical units expressed in magnitudes\n\n    Parameters\n    ----------\n    physical_unit : `~astropy.units.Unit` or `string`\n        Unit that is encapsulated within the magnitude function unit.\n        If not given, dimensionless.\n\n    function_unit :  `~astropy.units.Unit` or `string`\n        By default, this is ``dex``, but this allows one to use an equivalent\n        unit such as ``0.5 dex``.\n    \"\"\"\n\n    @property\n    def _default_function_unit(self):\n        return dex\n\n    @property\n    def _quantity_class(self):\n        return Dex\n\n    def to_string(self, format='generic'):\n        if format == 'cds':\n            if self.physical_unit == dimensionless_unscaled:\n                return \"[-]\"  # by default, would get \"[---]\".\n            else:\n                return f\"[{self.physical_unit.to_string(format=format)}]\"\n        else:\n            return super(DexUnit, self).to_string()"},{"col":4,"comment":"null","endLoc":148,"header":"@property\n    def _default_function_unit(self)","id":10340,"name":"_default_function_unit","nodeType":"Function","startLoc":146,"text":"@property\n    def _default_function_unit(self):\n        return dex"},{"col":4,"comment":"null","endLoc":152,"header":"@property\n    def _quantity_class(self)","id":10341,"name":"_quantity_class","nodeType":"Function","startLoc":150,"text":"@property\n    def _quantity_class(self):\n        return Dex"},{"col":4,"comment":"null","endLoc":161,"header":"def to_string(self, format='generic')","id":10342,"name":"to_string","nodeType":"Function","startLoc":154,"text":"def to_string(self, format='generic'):\n        if format == 'cds':\n            if self.physical_unit == dimensionless_unscaled:\n                return \"[-]\"  # by default, would get \"[---]\".\n            else:\n                return f\"[{self.physical_unit.to_string(format=format)}]\"\n        else:\n            return super(DexUnit, self).to_string()"},{"col":0,"comment":"Like Unit._get_converter, except returns None if no scaling is needed,\n    i.e., if the inferred scale is unity.","endLoc":33,"header":"def get_converter(from_unit, to_unit)","id":10343,"name":"get_converter","nodeType":"Function","startLoc":29,"text":"def get_converter(from_unit, to_unit):\n    \"\"\"Like Unit._get_converter, except returns None if no scaling is needed,\n    i.e., if the inferred scale is unity.\"\"\"\n    converter = from_unit._get_converter(to_unit)\n    return None if converter is unit_scale_converter else converter"},{"col":4,"comment":"null","endLoc":116,"header":"def __len__(self)","id":10344,"name":"__len__","nodeType":"Function","startLoc":115,"text":"def __len__(self):\n        return len(self._dataiter)"},{"col":4,"comment":"A reference to the array that is iterated over.","endLoc":123,"header":"@property\n    def base(self)","id":10345,"name":"base","nodeType":"Function","startLoc":120,"text":"@property\n    def base(self):\n        \"\"\"A reference to the array that is iterated over.\"\"\"\n        return self._quantity"},{"col":4,"comment":"An N-dimensional tuple of current coordinates.","endLoc":128,"header":"@property\n    def coords(self)","id":10346,"name":"coords","nodeType":"Function","startLoc":125,"text":"@property\n    def coords(self):\n        \"\"\"An N-dimensional tuple of current coordinates.\"\"\"\n        return self._dataiter.coords"},{"col":4,"comment":"Current flat index into the array.","endLoc":133,"header":"@property\n    def index(self)","id":10347,"name":"index","nodeType":"Function","startLoc":130,"text":"@property\n    def index(self):\n        \"\"\"Current flat index into the array.\"\"\"\n        return self._dataiter.index"},{"col":4,"comment":"Get a copy of the iterator as a 1-D array.","endLoc":137,"header":"def copy(self)","id":10348,"name":"copy","nodeType":"Function","startLoc":135,"text":"def copy(self):\n        \"\"\"Get a copy of the iterator as a 1-D array.\"\"\"\n        return self._quantity.flatten()"},{"attributeType":"function","col":4,"comment":"null","endLoc":113,"id":10349,"name":"next","nodeType":"Attribute","startLoc":113,"text":"next"},{"className":"DecibelUnit","col":0,"comment":"Logarithmic physical units expressed in dB\n\n    Parameters\n    ----------\n    physical_unit : `~astropy.units.Unit` or `string`\n        Unit that is encapsulated within the decibel function unit.\n        If not given, dimensionless.\n\n    function_unit :  `~astropy.units.Unit` or `string`\n        By default, this is ``dB``, but this allows one to use an equivalent\n        unit such as ``2 dB``.\n    ","endLoc":184,"id":10350,"nodeType":"Class","startLoc":164,"text":"class DecibelUnit(LogUnit):\n    \"\"\"Logarithmic physical units expressed in dB\n\n    Parameters\n    ----------\n    physical_unit : `~astropy.units.Unit` or `string`\n        Unit that is encapsulated within the decibel function unit.\n        If not given, dimensionless.\n\n    function_unit :  `~astropy.units.Unit` or `string`\n        By default, this is ``dB``, but this allows one to use an equivalent\n        unit such as ``2 dB``.\n    \"\"\"\n\n    @property\n    def _default_function_unit(self):\n        return dB\n\n    @property\n    def _quantity_class(self):\n        return Decibel"},{"col":4,"comment":"null","endLoc":180,"header":"@property\n    def _default_function_unit(self)","id":10351,"name":"_default_function_unit","nodeType":"Function","startLoc":178,"text":"@property\n    def _default_function_unit(self):\n        return dB"},{"col":4,"comment":"null","endLoc":184,"header":"@property\n    def _quantity_class(self)","id":10352,"name":"_quantity_class","nodeType":"Function","startLoc":182,"text":"@property\n    def _quantity_class(self):\n        return Decibel"},{"className":"LogQuantity","col":0,"comment":"A representation of a (scaled) logarithm of a number with a unit\n\n    Parameters\n    ----------\n    value : number, `~astropy.units.Quantity`, `~astropy.units.function.logarithmic.LogQuantity`, or sequence of quantity-like.\n        The numerical value of the logarithmic quantity. If a number or\n        a `~astropy.units.Quantity` with a logarithmic unit, it will be\n        converted to ``unit`` and the physical unit will be inferred from\n        ``unit``.  If a `~astropy.units.Quantity` with just a physical unit,\n        it will converted to the logarithmic unit, after, if necessary,\n        converting it to the physical unit inferred from ``unit``.\n\n    unit : str, `~astropy.units.UnitBase`, or `~astropy.units.function.FunctionUnitBase`, optional\n        For an `~astropy.units.function.FunctionUnitBase` instance, the\n        physical unit will be taken from it; for other input, it will be\n        inferred from ``value``. By default, ``unit`` is set by the subclass.\n\n    dtype : `~numpy.dtype`, optional\n        The ``dtype`` of the resulting Numpy array or scalar that will\n        hold the value.  If not provided, is is determined automatically\n        from the input value.\n\n    copy : bool, optional\n        If `True` (default), then the value is copied.  Otherwise, a copy will\n        only be made if ``__array__`` returns a copy, if value is a nested\n        sequence, or if a copy is needed to satisfy an explicitly given\n        ``dtype``.  (The `False` option is intended mostly for internal use,\n        to speed up initialization where a copy is known to have been made.\n        Use with care.)\n\n    Examples\n    --------\n    Typically, use is made of an `~astropy.units.function.FunctionQuantity`\n    subclass, as in::\n\n        >>> import astropy.units as u\n        >>> u.Magnitude(-2.5)\n        <Magnitude -2.5 mag>\n        >>> u.Magnitude(10.*u.count/u.second)\n        <Magnitude -2.5 mag(ct / s)>\n        >>> u.Decibel(1.*u.W, u.DecibelUnit(u.mW))  # doctest: +FLOAT_CMP\n        <Decibel 30. dB(mW)>\n\n    ","endLoc":386,"id":10353,"nodeType":"Class","startLoc":187,"text":"class LogQuantity(FunctionQuantity):\n    \"\"\"A representation of a (scaled) logarithm of a number with a unit\n\n    Parameters\n    ----------\n    value : number, `~astropy.units.Quantity`, `~astropy.units.function.logarithmic.LogQuantity`, or sequence of quantity-like.\n        The numerical value of the logarithmic quantity. If a number or\n        a `~astropy.units.Quantity` with a logarithmic unit, it will be\n        converted to ``unit`` and the physical unit will be inferred from\n        ``unit``.  If a `~astropy.units.Quantity` with just a physical unit,\n        it will converted to the logarithmic unit, after, if necessary,\n        converting it to the physical unit inferred from ``unit``.\n\n    unit : str, `~astropy.units.UnitBase`, or `~astropy.units.function.FunctionUnitBase`, optional\n        For an `~astropy.units.function.FunctionUnitBase` instance, the\n        physical unit will be taken from it; for other input, it will be\n        inferred from ``value``. By default, ``unit`` is set by the subclass.\n\n    dtype : `~numpy.dtype`, optional\n        The ``dtype`` of the resulting Numpy array or scalar that will\n        hold the value.  If not provided, is is determined automatically\n        from the input value.\n\n    copy : bool, optional\n        If `True` (default), then the value is copied.  Otherwise, a copy will\n        only be made if ``__array__`` returns a copy, if value is a nested\n        sequence, or if a copy is needed to satisfy an explicitly given\n        ``dtype``.  (The `False` option is intended mostly for internal use,\n        to speed up initialization where a copy is known to have been made.\n        Use with care.)\n\n    Examples\n    --------\n    Typically, use is made of an `~astropy.units.function.FunctionQuantity`\n    subclass, as in::\n\n        >>> import astropy.units as u\n        >>> u.Magnitude(-2.5)\n        <Magnitude -2.5 mag>\n        >>> u.Magnitude(10.*u.count/u.second)\n        <Magnitude -2.5 mag(ct / s)>\n        >>> u.Decibel(1.*u.W, u.DecibelUnit(u.mW))  # doctest: +FLOAT_CMP\n        <Decibel 30. dB(mW)>\n\n    \"\"\"\n    # only override of FunctionQuantity\n    _unit_class = LogUnit\n\n    # additions that work just for logarithmic units\n    def __add__(self, other):\n        # Add function units, thus multiplying physical units. If no unit is\n        # given, assume dimensionless_unscaled; this will give the appropriate\n        # exception in LogUnit.__add__.\n        new_unit = self.unit + getattr(other, 'unit', dimensionless_unscaled)\n        # Add actual logarithmic values, rescaling, e.g., dB -> dex.\n        result = self._function_view + getattr(other, '_function_view', other)\n        return self._new_view(result, new_unit)\n\n    def __radd__(self, other):\n        return self.__add__(other)\n\n    def __iadd__(self, other):\n        new_unit = self.unit + getattr(other, 'unit', dimensionless_unscaled)\n        # Do calculation in-place using _function_view of array.\n        function_view = self._function_view\n        function_view += getattr(other, '_function_view', other)\n        self._set_unit(new_unit)\n        return self\n\n    def __sub__(self, other):\n        # Subtract function units, thus dividing physical units.\n        new_unit = self.unit - getattr(other, 'unit', dimensionless_unscaled)\n        # Subtract actual logarithmic values, rescaling, e.g., dB -> dex.\n        result = self._function_view - getattr(other, '_function_view', other)\n        return self._new_view(result, new_unit)\n\n    def __rsub__(self, other):\n        new_unit = self.unit.__rsub__(\n            getattr(other, 'unit', dimensionless_unscaled))\n        result = self._function_view.__rsub__(\n            getattr(other, '_function_view', other))\n        # Ensure the result is in right function unit scale\n        # (with rsub, this does not have to be one's own).\n        result = result.to(new_unit.function_unit)\n        return self._new_view(result, new_unit)\n\n    def __isub__(self, other):\n        new_unit = self.unit - getattr(other, 'unit', dimensionless_unscaled)\n        # Do calculation in-place using _function_view of array.\n        function_view = self._function_view\n        function_view -= getattr(other, '_function_view', other)\n        self._set_unit(new_unit)\n        return self\n\n    def __mul__(self, other):\n        # Multiply by a float or a dimensionless quantity\n        if isinstance(other, numbers.Number):\n            # Multiplying a log means putting the factor into the exponent\n            # of the unit\n            new_physical_unit = self.unit.physical_unit**other\n            result = self.view(np.ndarray) * other\n            return self._new_view(result, self.unit._copy(new_physical_unit))\n        else:\n            return super().__mul__(other)\n\n    def __rmul__(self, other):\n        return self.__mul__(other)\n\n    def __imul__(self, other):\n        if isinstance(other, numbers.Number):\n            new_physical_unit = self.unit.physical_unit**other\n            function_view = self._function_view\n            function_view *= other\n            self._set_unit(self.unit._copy(new_physical_unit))\n            return self\n        else:\n            return super().__imul__(other)\n\n    def __truediv__(self, other):\n        # Divide by a float or a dimensionless quantity\n        if isinstance(other, numbers.Number):\n            # Dividing a log means putting the nominator into the exponent\n            # of the unit\n            new_physical_unit = self.unit.physical_unit**(1/other)\n            result = self.view(np.ndarray) / other\n            return self._new_view(result, self.unit._copy(new_physical_unit))\n        else:\n            return super().__truediv__(other)\n\n    def __itruediv__(self, other):\n        if isinstance(other, numbers.Number):\n            new_physical_unit = self.unit.physical_unit**(1/other)\n            function_view = self._function_view\n            function_view /= other\n            self._set_unit(self.unit._copy(new_physical_unit))\n            return self\n        else:\n            return super().__itruediv__(other)\n\n    def __pow__(self, other):\n        # We check if this power is OK by applying it first to the unit.\n        try:\n            other = float(other)\n        except TypeError:\n            return NotImplemented\n        new_unit = self.unit ** other\n        new_value = self.view(np.ndarray) ** other\n        return self._new_view(new_value, new_unit)\n\n    def __ilshift__(self, other):\n        try:\n            other = Unit(other)\n        except UnitTypeError:\n            return NotImplemented\n\n        if not isinstance(other, self._unit_class):\n            return NotImplemented\n\n        try:\n            factor = self.unit.physical_unit._to(other.physical_unit)\n        except UnitConversionError:\n            # Maybe via equivalencies?  Now we do make a temporary copy.\n            try:\n                value = self._to_value(other)\n            except UnitConversionError:\n                return NotImplemented\n\n            self.view(np.ndarray)[...] = value\n        else:\n            self.view(np.ndarray)[...] += self.unit.from_physical(factor)\n\n        self._set_unit(other)\n        return self\n\n    # Methods that do not work for function units generally but are OK for\n    # logarithmic units as they imply differences and independence of\n    # physical unit.\n    def var(self, axis=None, dtype=None, out=None, ddof=0):\n        return self._wrap_function(np.var, axis, dtype, out=out, ddof=ddof,\n                                   unit=self.unit.function_unit**2)\n\n    def std(self, axis=None, dtype=None, out=None, ddof=0):\n        return self._wrap_function(np.std, axis, dtype, out=out, ddof=ddof,\n                                   unit=self.unit._copy(dimensionless_unscaled))\n\n    def ptp(self, axis=None, out=None):\n        return self._wrap_function(np.ptp, axis, out=out,\n                                   unit=self.unit._copy(dimensionless_unscaled))\n\n    def diff(self, n=1, axis=-1):\n        return self._wrap_function(np.diff, n, axis,\n                                   unit=self.unit._copy(dimensionless_unscaled))\n\n    def ediff1d(self, to_end=None, to_begin=None):\n        return self._wrap_function(np.ediff1d, to_end, to_begin,\n                                   unit=self.unit._copy(dimensionless_unscaled))\n\n    _supported_functions = (FunctionQuantity._supported_functions |\n                            set(getattr(np, function) for function in\n                                ('var', 'std', 'ptp', 'diff', 'ediff1d')))"},{"col":4,"comment":"null","endLoc":243,"header":"def __add__(self, other)","id":10354,"name":"__add__","nodeType":"Function","startLoc":236,"text":"def __add__(self, other):\n        # Add function units, thus multiplying physical units. If no unit is\n        # given, assume dimensionless_unscaled; this will give the appropriate\n        # exception in LogUnit.__add__.\n        new_unit = self.unit + getattr(other, 'unit', dimensionless_unscaled)\n        # Add actual logarithmic values, rescaling, e.g., dB -> dex.\n        result = self._function_view + getattr(other, '_function_view', other)\n        return self._new_view(result, new_unit)"},{"col":4,"comment":"null","endLoc":246,"header":"def __radd__(self, other)","id":10355,"name":"__radd__","nodeType":"Function","startLoc":245,"text":"def __radd__(self, other):\n        return self.__add__(other)"},{"col":0,"comment":"null","endLoc":143,"header":"def helper_dimensionless_to_dimensionless(f, unit)","id":10356,"name":"helper_dimensionless_to_dimensionless","nodeType":"Function","startLoc":133,"text":"def helper_dimensionless_to_dimensionless(f, unit):\n    if unit is None:\n        return [None], dimensionless_unscaled\n\n    try:\n        return ([get_converter(unit, dimensionless_unscaled)],\n                dimensionless_unscaled)\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"dimensionless quantities\"\n                            .format(f.__name__))"},{"attributeType":"null","col":8,"comment":"null","endLoc":88,"id":10357,"name":"_dataiter","nodeType":"Attribute","startLoc":88,"text":"self._dataiter"},{"attributeType":"{view}","col":8,"comment":"null","endLoc":87,"id":10358,"name":"_quantity","nodeType":"Attribute","startLoc":87,"text":"self._quantity"},{"col":0,"comment":"\n    Return a boolean array where two arrays are element-wise equal\n    within a tolerance.\n\n    Parameters\n    ----------\n    a, b : array-like or `~astropy.units.Quantity`\n        Input values or arrays to compare\n    rtol : array-like or `~astropy.units.Quantity`\n        The relative tolerance for the comparison, which defaults to\n        ``1e-5``.  If ``rtol`` is a :class:`~astropy.units.Quantity`,\n        then it must be dimensionless.\n    atol : number or `~astropy.units.Quantity`\n        The absolute tolerance for the comparison.  The units (or lack\n        thereof) of ``a``, ``b``, and ``atol`` must be consistent with\n        each other.  If `None`, ``atol`` defaults to zero in the\n        appropriate units.\n    equal_nan : `bool`\n        Whether to compare NaN’s as equal. If `True`, NaNs in ``a`` will\n        be considered equal to NaN’s in ``b``.\n\n    Notes\n    -----\n    This is a :class:`~astropy.units.Quantity`-aware version of\n    :func:`numpy.isclose`. However, this differs from the `numpy` function in\n    that the default for the absolute tolerance here is zero instead of\n    ``atol=1e-8`` in `numpy`, as there is no natural way to set a default\n    *absolute* tolerance given two inputs that may have differently scaled\n    units.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If the dimensions of ``a``, ``b``, or ``atol`` are incompatible,\n        or if ``rtol`` is not dimensionless.\n\n    See also\n    --------\n    allclose\n    ","endLoc":1961,"header":"def isclose(a, b, rtol=1.e-5, atol=None, equal_nan=False, **kwargs)","id":10359,"name":"isclose","nodeType":"Function","startLoc":1919,"text":"def isclose(a, b, rtol=1.e-5, atol=None, equal_nan=False, **kwargs):\n    \"\"\"\n    Return a boolean array where two arrays are element-wise equal\n    within a tolerance.\n\n    Parameters\n    ----------\n    a, b : array-like or `~astropy.units.Quantity`\n        Input values or arrays to compare\n    rtol : array-like or `~astropy.units.Quantity`\n        The relative tolerance for the comparison, which defaults to\n        ``1e-5``.  If ``rtol`` is a :class:`~astropy.units.Quantity`,\n        then it must be dimensionless.\n    atol : number or `~astropy.units.Quantity`\n        The absolute tolerance for the comparison.  The units (or lack\n        thereof) of ``a``, ``b``, and ``atol`` must be consistent with\n        each other.  If `None`, ``atol`` defaults to zero in the\n        appropriate units.\n    equal_nan : `bool`\n        Whether to compare NaN’s as equal. If `True`, NaNs in ``a`` will\n        be considered equal to NaN’s in ``b``.\n\n    Notes\n    -----\n    This is a :class:`~astropy.units.Quantity`-aware version of\n    :func:`numpy.isclose`. However, this differs from the `numpy` function in\n    that the default for the absolute tolerance here is zero instead of\n    ``atol=1e-8`` in `numpy`, as there is no natural way to set a default\n    *absolute* tolerance given two inputs that may have differently scaled\n    units.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If the dimensions of ``a``, ``b``, or ``atol`` are incompatible,\n        or if ``rtol`` is not dimensionless.\n\n    See also\n    --------\n    allclose\n    \"\"\"\n    unquantified_args = _unquantify_allclose_arguments(a, b, rtol, atol)\n    return np.isclose(*unquantified_args, equal_nan=equal_nan, **kwargs)"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":10360,"name":"__all__","nodeType":"Attribute","startLoc":37,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":42,"id":10361,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":42,"text":"__doctest_skip__"},{"attributeType":"null","col":0,"comment":"null","endLoc":44,"id":10362,"name":"_UNIT_NOT_INITIALISED","nodeType":"Attribute","startLoc":44,"text":"_UNIT_NOT_INITIALISED"},{"attributeType":"null","col":0,"comment":"null","endLoc":45,"id":10363,"name":"_UFUNCS_FILTER_WARNINGS","nodeType":"Attribute","startLoc":45,"text":"_UFUNCS_FILTER_WARNINGS"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":60,"id":10364,"name":"conf","nodeType":"Attribute","startLoc":60,"text":"conf"},{"col":0,"comment":"null","endLoc":113,"header":"def helper_cbrt(f, unit)","id":10365,"name":"helper_cbrt","nodeType":"Function","startLoc":111,"text":"def helper_cbrt(f, unit):\n    return ([None], (unit ** one_third if unit is not None\n                     else dimensionless_unscaled))"},{"col":0,"comment":"Function that just multiplies the value by unity.\n\n    This is a separate function so it can be recognized and\n    discarded in unit conversion.\n    ","endLoc":2566,"header":"def unit_scale_converter(val)","id":10366,"name":"unit_scale_converter","nodeType":"Function","startLoc":2560,"text":"def unit_scale_converter(val):\n    \"\"\"Function that just multiplies the value by unity.\n\n    This is a separate function so it can be recognized and\n    discarded in unit conversion.\n    \"\"\"\n    return 1. * _condition_arg(val)"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":10367,"name":"__all__","nodeType":"Attribute","startLoc":23,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":338,"id":10368,"name":"_unit_registries","nodeType":"Attribute","startLoc":338,"text":"_unit_registries"},{"attributeType":"CompositeUnit","col":0,"comment":"null","endLoc":2571,"id":10369,"name":"one","nodeType":"Attribute","startLoc":2571,"text":"one"},{"col":0,"comment":"null","endLoc":261,"header":"def helper_two_arg_dimensionless(f, unit1, unit2)","id":10370,"name":"helper_two_arg_dimensionless","nodeType":"Function","startLoc":251,"text":"def helper_two_arg_dimensionless(f, unit1, unit2):\n    try:\n        converter1 = (get_converter(unit1, dimensionless_unscaled)\n                      if unit1 is not None else None)\n        converter2 = (get_converter(unit2, dimensionless_unscaled)\n                      if unit2 is not None else None)\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"dimensionless quantities\"\n                            .format(f.__name__))\n    return ([converter1, converter2], dimensionless_unscaled)"},{"col":4,"comment":"Return a copy with the physical unit in CGS units.","endLoc":532,"header":"@property\n    def cgs(self)","id":10371,"name":"cgs","nodeType":"Function","startLoc":529,"text":"@property\n    def cgs(self):\n        \"\"\"Return a copy with the physical unit in CGS units.\"\"\"\n        return self.__class__(self.physical.cgs)"},{"col":4,"comment":"null","endLoc":254,"header":"def __iadd__(self, other)","id":10372,"name":"__iadd__","nodeType":"Function","startLoc":248,"text":"def __iadd__(self, other):\n        new_unit = self.unit + getattr(other, 'unit', dimensionless_unscaled)\n        # Do calculation in-place using _function_view of array.\n        function_view = self._function_view\n        function_view += getattr(other, '_function_view', other)\n        self._set_unit(new_unit)\n        return self"},{"col":0,"comment":"","endLoc":7,"header":"quantity.py#<anonymous>","id":10373,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module defines the `Quantity` object, which represents a number with some\nassociated units. `Quantity` objects support operations like ordinary numbers,\nbut will deal with unit conversions internally.\n\"\"\"\n\n__all__ = [\"Quantity\", \"SpecificTypeQuantity\",\n           \"QuantityInfoBase\", \"QuantityInfo\", \"allclose\", \"isclose\"]\n\n__doctest_skip__ = ['Quantity.*']\n\n_UNIT_NOT_INITIALISED = \"(Unit not initialised)\"\n\n_UFUNCS_FILTER_WARNINGS = {np.arcsin, np.arccos, np.arccosh, np.arctanh}\n\nconf = Conf()"},{"col":0,"comment":"","endLoc":5,"header":"core.py#<anonymous>","id":10374,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nCore units classes and functions\n\"\"\"\n\n__all__ = [\n    'UnitsError', 'UnitsWarning', 'UnitConversionError', 'UnitTypeError',\n    'UnitBase', 'NamedUnit', 'IrreducibleUnit', 'Unit', 'CompositeUnit',\n    'PrefixUnit', 'UnrecognizedUnit', 'def_unit', 'get_current_unit_registry',\n    'set_enabled_units', 'add_enabled_units',\n    'set_enabled_equivalencies', 'add_enabled_equivalencies',\n    'set_enabled_aliases', 'add_enabled_aliases',\n    'dimensionless_unscaled', 'one',\n]\n\nUNITY = 1.0\n\n_unit_registries = [_UnitRegistry()]\n\nsi_prefixes = [\n    (['Y'], ['yotta'], 1e24),\n    (['Z'], ['zetta'], 1e21),\n    (['E'], ['exa'], 1e18),\n    (['P'], ['peta'], 1e15),\n    (['T'], ['tera'], 1e12),\n    (['G'], ['giga'], 1e9),\n    (['M'], ['mega'], 1e6),\n    (['k'], ['kilo'], 1e3),\n    (['h'], ['hecto'], 1e2),\n    (['da'], ['deka', 'deca'], 1e1),\n    (['d'], ['deci'], 1e-1),\n    (['c'], ['centi'], 1e-2),\n    (['m'], ['milli'], 1e-3),\n    (['u'], ['micro'], 1e-6),\n    (['n'], ['nano'], 1e-9),\n    (['p'], ['pico'], 1e-12),\n    (['f'], ['femto'], 1e-15),\n    (['a'], ['atto'], 1e-18),\n    (['z'], ['zepto'], 1e-21),\n    (['y'], ['yocto'], 1e-24)\n]\n\nbinary_prefixes = [\n    (['Ki'], ['kibi'], 2. ** 10),\n    (['Mi'], ['mebi'], 2. ** 20),\n    (['Gi'], ['gibi'], 2. ** 30),\n    (['Ti'], ['tebi'], 2. ** 40),\n    (['Pi'], ['pebi'], 2. ** 50),\n    (['Ei'], ['exbi'], 2. ** 60)\n]\n\ndimensionless_unscaled = CompositeUnit(1, [], [], _error_check=False)\n\none = dimensionless_unscaled\n\nunit_format.fits.UnitScaleError = UnitScaleError"},{"attributeType":"null","col":4,"comment":"null","endLoc":43,"id":10375,"name":"_tokens","nodeType":"Attribute","startLoc":43,"text":"_tokens"},{"col":0,"comment":"","endLoc":16,"header":"cds.py#<anonymous>","id":10376,"name":"<anonymous>","nodeType":"Function","startLoc":14,"text":"\"\"\"\nHandles the CDS string format for units\n\"\"\""},{"col":0,"comment":"null","endLoc":51,"header":"def helper_degree_to_dimensionless(f, unit)","id":10377,"name":"helper_degree_to_dimensionless","nodeType":"Function","startLoc":44,"text":"def helper_degree_to_dimensionless(f, unit):\n    from astropy.units.si import degree\n    try:\n        return [get_converter(unit, degree)], dimensionless_unscaled\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))"},{"fileName":"erfa.py","filePath":"astropy/units/quantity_helper","id":10378,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"Quantity helpers for the ERFA ufuncs.\"\"\"\n# Tests for these are in coordinates, not in units.\n\nfrom erfa import ufunc as erfa_ufunc, dt_pv, dt_eraLDBODY, dt_eraASTROM\n\nfrom astropy.units.core import UnitsError, UnitTypeError, dimensionless_unscaled\nfrom astropy.units.structured import StructuredUnit\nfrom . import UFUNC_HELPERS\nfrom .helpers import (get_converter, helper_invariant, helper_multiplication,\n                      helper_twoarg_invariant, _d)\n\n\nerfa_ufuncs = ('s2c', 's2p', 'c2s', 'p2s', 'pm', 'pdp', 'pxp', 'rxp',\n               'cpv', 'p2pv', 'pv2p', 'pv2s', 'pvdpv', 'pvm', 'pvmpv', 'pvppv',\n               'pvstar', 'pvtob', 'pvu', 'pvup', 'pvxpv', 'rxpv', 's2pv', 's2xpv',\n               'starpv', 'sxpv', 'trxpv', 'gd2gc', 'gc2gd', 'ldn', 'aper',\n               'apio', 'atciq', 'atciqn', 'atciqz', 'aticq', 'atioq', 'atoiq')\n\n\ndef has_matching_structure(unit, dtype):\n    dtype_fields = dtype.fields\n    if dtype_fields:\n        return (isinstance(unit, StructuredUnit)\n                and len(unit) == len(dtype_fields)\n                and all(has_matching_structure(u, df_v[0])\n                        for (u, df_v) in zip(unit.values(), dtype_fields.values())))\n    else:\n        return not isinstance(unit, StructuredUnit)\n\n\ndef check_structured_unit(unit, dtype):\n    if not has_matching_structure(unit, dtype):\n        msg = {dt_pv: 'pv',\n               dt_eraLDBODY: 'ldbody',\n               dt_eraASTROM: 'astrom'}.get(dtype, 'function')\n        raise UnitTypeError(f'{msg} input needs unit matching dtype={dtype}.')\n\n\ndef helper_s2c(f, unit1, unit2):\n    from astropy.units.si import radian\n    try:\n        return [get_converter(unit1, radian),\n                get_converter(unit2, radian)], dimensionless_unscaled\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))\n\n\ndef helper_s2p(f, unit1, unit2, unit3):\n    from astropy.units.si import radian\n    try:\n        return [get_converter(unit1, radian),\n                get_converter(unit2, radian), None], unit3\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))\n\n\ndef helper_c2s(f, unit1):\n    from astropy.units.si import radian\n    return [None], (radian, radian)\n\n\ndef helper_p2s(f, unit1):\n    from astropy.units.si import radian\n    return [None], (radian, radian, unit1)\n\n\ndef helper_gc2gd(f, nounit, unit1):\n    from astropy.units.si import m, radian\n    if nounit is not None:\n        raise UnitTypeError(\"ellipsoid cannot be a quantity.\")\n    try:\n        return [None, get_converter(unit1, m)], (radian, radian, m, None)\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"quantities with length units\"\n                            .format(f.__name__))\n\n\ndef helper_gd2gc(f, nounit, unit1, unit2, unit3):\n    from astropy.units.si import m, radian\n    if nounit is not None:\n        raise UnitTypeError(\"ellipsoid cannot be a quantity.\")\n    try:\n        return [None,\n                get_converter(unit1, radian),\n                get_converter(unit2, radian),\n                get_converter(unit3, m)], (m, None)\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to lon, lat \"\n                            \"with angle and height with length units\"\n                            .format(f.__name__))\n\n\ndef helper_p2pv(f, unit1):\n    from astropy.units.si import s\n    if isinstance(unit1, StructuredUnit):\n        raise UnitTypeError(\"p vector unit cannot be a structured unit.\")\n    return [None], StructuredUnit((unit1, unit1 / s))\n\n\ndef helper_pv2p(f, unit1):\n    check_structured_unit(unit1, dt_pv)\n    return [None], unit1[0]\n\n\ndef helper_pv2s(f, unit_pv):\n    from astropy.units.si import radian\n    check_structured_unit(unit_pv, dt_pv)\n    ang_unit = radian * unit_pv[1] / unit_pv[0]\n    return [None], (radian, radian, unit_pv[0], ang_unit, ang_unit, unit_pv[1])\n\n\ndef helper_s2pv(f, unit_theta, unit_phi, unit_r, unit_td, unit_pd, unit_rd):\n    from astropy.units.si import radian\n    time_unit = unit_r / unit_rd\n    return [get_converter(unit_theta, radian),\n            get_converter(unit_phi, radian),\n            None,\n            get_converter(unit_td, radian / time_unit),\n            get_converter(unit_pd, radian / time_unit),\n            None], StructuredUnit((unit_r, unit_rd))\n\n\ndef helper_pv_multiplication(f, unit1, unit2):\n    check_structured_unit(unit1, dt_pv)\n    check_structured_unit(unit2, dt_pv)\n    result_unit = StructuredUnit((unit1[0] * unit2[0], unit1[1] * unit2[0]))\n    converter = get_converter(unit2, StructuredUnit(\n        (unit2[0], unit1[1] * unit2[0] / unit1[0])))\n    return [None, converter], result_unit\n\n\ndef helper_pvm(f, unit1):\n    check_structured_unit(unit1, dt_pv)\n    return [None], (unit1[0], unit1[1])\n\n\ndef helper_pvstar(f, unit1):\n    from astropy.units.astrophys import AU\n    from astropy.units.si import km, s, radian, day, year, arcsec\n\n    return [get_converter(unit1, StructuredUnit((AU, AU/day)))], (\n        radian, radian, radian / year, radian / year, arcsec, km / s, None)\n\n\ndef helper_starpv(f, unit_ra, unit_dec, unit_pmr, unit_pmd,\n                  unit_px, unit_rv):\n    from astropy.units.si import km, s, day, year, radian, arcsec\n    from astropy.units.astrophys import AU\n\n    return [get_converter(unit_ra, radian),\n            get_converter(unit_dec, radian),\n            get_converter(unit_pmr, radian/year),\n            get_converter(unit_pmd, radian/year),\n            get_converter(unit_px, arcsec),\n            get_converter(unit_rv, km/s)], (StructuredUnit((AU, AU/day)), None)\n\n\ndef helper_pvtob(f, unit_elong, unit_phi, unit_hm,\n                 unit_xp, unit_yp, unit_sp, unit_theta):\n    from astropy.units.si import m, s, radian\n\n    return [get_converter(unit_elong, radian),\n            get_converter(unit_phi, radian),\n            get_converter(unit_hm, m),\n            get_converter(unit_xp, radian),\n            get_converter(unit_yp, radian),\n            get_converter(unit_sp, radian),\n            get_converter(unit_theta, radian)], StructuredUnit((m, m/s))\n\n\ndef helper_pvu(f, unit_t, unit_pv):\n    check_structured_unit(unit_pv, dt_pv)\n    return [get_converter(unit_t, unit_pv[0]/unit_pv[1]), None], unit_pv\n\n\ndef helper_pvup(f, unit_t, unit_pv):\n    check_structured_unit(unit_pv, dt_pv)\n    return [get_converter(unit_t, unit_pv[0]/unit_pv[1]), None], unit_pv[0]\n\n\ndef helper_s2xpv(f, unit1, unit2, unit_pv):\n    check_structured_unit(unit_pv, dt_pv)\n    return [None, None, None], StructuredUnit((_d(unit1) * unit_pv[0],\n                                               _d(unit2) * unit_pv[1]))\n\n\ndef ldbody_unit():\n    from astropy.units.si import day, radian\n    from astropy.units.astrophys import Msun, AU\n\n    return StructuredUnit((Msun, radian, (AU, AU/day)),\n                          erfa_ufunc.dt_eraLDBODY)\n\n\ndef astrom_unit():\n    from astropy.units.si import rad, year\n    from astropy.units.astrophys import AU\n    one = rel2c = dimensionless_unscaled\n\n    return StructuredUnit((year, AU, one, AU, rel2c, one, one, rad, rad, rad, rad,\n                           one, one, rel2c, rad, rad, rad),\n                          erfa_ufunc.dt_eraASTROM)\n\n\ndef helper_ldn(f, unit_b, unit_ob, unit_sc):\n    from astropy.units.astrophys import AU\n    return [get_converter(unit_b, ldbody_unit()),\n            get_converter(unit_ob, AU),\n            get_converter(_d(unit_sc), dimensionless_unscaled)], dimensionless_unscaled\n\n\ndef helper_aper(f, unit_theta, unit_astrom):\n    check_structured_unit(unit_astrom, dt_eraASTROM)\n    unit_along = unit_astrom[7]  # along\n\n    if unit_astrom[14] is unit_along:  # eral\n        result_unit = unit_astrom\n    else:\n        result_units = tuple((unit_along if i == 14 else v)\n                             for i, v in enumerate(unit_astrom.values()))\n        result_unit = unit_astrom.__class__(result_units, names=unit_astrom)\n    return [get_converter(unit_theta, unit_along), None], result_unit\n\n\ndef helper_apio(f, unit_sp, unit_theta, unit_elong, unit_phi, unit_hm,\n                unit_xp, unit_yp, unit_refa, unit_refb):\n    from astropy.units.si import radian, m\n    return [get_converter(unit_sp, radian),\n            get_converter(unit_theta, radian),\n            get_converter(unit_elong, radian),\n            get_converter(unit_phi, radian),\n            get_converter(unit_hm, m),\n            get_converter(unit_xp, radian),\n            get_converter(unit_xp, radian),\n            get_converter(unit_xp, radian),\n            get_converter(unit_xp, radian)], astrom_unit()\n\n\ndef helper_atciq(f, unit_rc, unit_dc, unit_pr, unit_pd, unit_px, unit_rv, unit_astrom):\n    from astropy.units.si import radian, arcsec, year, km, s\n    return [get_converter(unit_rc, radian),\n            get_converter(unit_dc, radian),\n            get_converter(unit_pr, radian / year),\n            get_converter(unit_pd, radian / year),\n            get_converter(unit_px, arcsec),\n            get_converter(unit_rv, km / s),\n            get_converter(unit_astrom, astrom_unit())], (radian, radian)\n\n\ndef helper_atciqn(f, unit_rc, unit_dc, unit_pr, unit_pd, unit_px, unit_rv, unit_astrom,\n                  unit_b):\n    from astropy.units.si import radian, arcsec, year, km, s\n    return [get_converter(unit_rc, radian),\n            get_converter(unit_dc, radian),\n            get_converter(unit_pr, radian / year),\n            get_converter(unit_pd, radian / year),\n            get_converter(unit_px, arcsec),\n            get_converter(unit_rv, km / s),\n            get_converter(unit_astrom, astrom_unit()),\n            get_converter(unit_b, ldbody_unit())], (radian, radian)\n\n\ndef helper_atciqz_aticq(f, unit_rc, unit_dc, unit_astrom):\n    from astropy.units.si import radian\n    return [get_converter(unit_rc, radian),\n            get_converter(unit_dc, radian),\n            get_converter(unit_astrom, astrom_unit())], (radian, radian)\n\n\ndef helper_aticqn(f, unit_rc, unit_dc, unit_astrom, unit_b):\n    from astropy.units.si import radian\n    return [get_converter(unit_rc, radian),\n            get_converter(unit_dc, radian),\n            get_converter(unit_astrom, astrom_unit()),\n            get_converter(unit_b, ldbody_unit())], (radian, radian)\n\n\ndef helper_atioq(f, unit_rc, unit_dc, unit_astrom):\n    from astropy.units.si import radian\n    return [get_converter(unit_rc, radian),\n            get_converter(unit_dc, radian),\n            get_converter(unit_astrom, astrom_unit())], (radian,)*5\n\n\ndef helper_atoiq(f, unit_type, unit_ri, unit_di, unit_astrom):\n    from astropy.units.si import radian\n    if unit_type is not None:\n        raise UnitTypeError(\"argument 'type' should not have a unit\")\n\n    return [None,\n            get_converter(unit_ri, radian),\n            get_converter(unit_di, radian),\n            get_converter(unit_astrom, astrom_unit())], (radian, radian)\n\n\ndef get_erfa_helpers():\n    ERFA_HELPERS = {}\n    ERFA_HELPERS[erfa_ufunc.s2c] = helper_s2c\n    ERFA_HELPERS[erfa_ufunc.s2p] = helper_s2p\n    ERFA_HELPERS[erfa_ufunc.c2s] = helper_c2s\n    ERFA_HELPERS[erfa_ufunc.p2s] = helper_p2s\n    ERFA_HELPERS[erfa_ufunc.pm] = helper_invariant\n    ERFA_HELPERS[erfa_ufunc.cpv] = helper_invariant\n    ERFA_HELPERS[erfa_ufunc.p2pv] = helper_p2pv\n    ERFA_HELPERS[erfa_ufunc.pv2p] = helper_pv2p\n    ERFA_HELPERS[erfa_ufunc.pv2s] = helper_pv2s\n    ERFA_HELPERS[erfa_ufunc.pvdpv] = helper_pv_multiplication\n    ERFA_HELPERS[erfa_ufunc.pvxpv] = helper_pv_multiplication\n    ERFA_HELPERS[erfa_ufunc.pvm] = helper_pvm\n    ERFA_HELPERS[erfa_ufunc.pvmpv] = helper_twoarg_invariant\n    ERFA_HELPERS[erfa_ufunc.pvppv] = helper_twoarg_invariant\n    ERFA_HELPERS[erfa_ufunc.pvstar] = helper_pvstar\n    ERFA_HELPERS[erfa_ufunc.pvtob] = helper_pvtob\n    ERFA_HELPERS[erfa_ufunc.pvu] = helper_pvu\n    ERFA_HELPERS[erfa_ufunc.pvup] = helper_pvup\n    ERFA_HELPERS[erfa_ufunc.pdp] = helper_multiplication\n    ERFA_HELPERS[erfa_ufunc.pxp] = helper_multiplication\n    ERFA_HELPERS[erfa_ufunc.rxp] = helper_multiplication\n    ERFA_HELPERS[erfa_ufunc.rxpv] = helper_multiplication\n    ERFA_HELPERS[erfa_ufunc.s2pv] = helper_s2pv\n    ERFA_HELPERS[erfa_ufunc.s2xpv] = helper_s2xpv\n    ERFA_HELPERS[erfa_ufunc.starpv] = helper_starpv\n    ERFA_HELPERS[erfa_ufunc.sxpv] = helper_multiplication\n    ERFA_HELPERS[erfa_ufunc.trxpv] = helper_multiplication\n    ERFA_HELPERS[erfa_ufunc.gc2gd] = helper_gc2gd\n    ERFA_HELPERS[erfa_ufunc.gd2gc] = helper_gd2gc\n    ERFA_HELPERS[erfa_ufunc.ldn] = helper_ldn\n    ERFA_HELPERS[erfa_ufunc.aper] = helper_aper\n    ERFA_HELPERS[erfa_ufunc.apio] = helper_apio\n    ERFA_HELPERS[erfa_ufunc.atciq] = helper_atciq\n    ERFA_HELPERS[erfa_ufunc.atciqn] = helper_atciqn\n    ERFA_HELPERS[erfa_ufunc.atciqz] = helper_atciqz_aticq\n    ERFA_HELPERS[erfa_ufunc.aticq] = helper_atciqz_aticq\n    ERFA_HELPERS[erfa_ufunc.aticqn] = helper_aticqn\n    ERFA_HELPERS[erfa_ufunc.atioq] = helper_atioq\n    ERFA_HELPERS[erfa_ufunc.atoiq] = helper_atoiq\n    return ERFA_HELPERS\n\n\nUFUNC_HELPERS.register_module('erfa.ufunc', erfa_ufuncs,\n                              get_erfa_helpers)\n"},{"fileName":"helpers.py","filePath":"astropy/units/quantity_helper","id":10379,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# The idea for this module (but no code) was borrowed from the\n# quantities (http://pythonhosted.org/quantities/) package.\n\"\"\"Helper functions for Quantity.\n\nIn particular, this implements the logic that determines scaling and result\nunits for a given ufunc, given input units.\n\"\"\"\n\nfrom fractions import Fraction\n\nimport numpy as np\n\nfrom . import UFUNC_HELPERS, UNSUPPORTED_UFUNCS\nfrom astropy.units.core import (\n    UnitsError, UnitConversionError, UnitTypeError,\n    dimensionless_unscaled, get_current_unit_registry,\n    unit_scale_converter)\n\n\ndef _d(unit):\n    if unit is None:\n        return dimensionless_unscaled\n    else:\n        return unit\n\n\ndef get_converter(from_unit, to_unit):\n    \"\"\"Like Unit._get_converter, except returns None if no scaling is needed,\n    i.e., if the inferred scale is unity.\"\"\"\n    converter = from_unit._get_converter(to_unit)\n    return None if converter is unit_scale_converter else converter\n\n\ndef get_converters_and_unit(f, unit1, unit2):\n    converters = [None, None]\n    # By default, we try adjusting unit2 to unit1, so that the result will\n    # be unit1 as well. But if there is no second unit, we have to try\n    # adjusting unit1 (to dimensionless, see below).\n    if unit2 is None:\n        if unit1 is None:\n            # No units for any input -- e.g., np.add(a1, a2, out=q)\n            return converters, dimensionless_unscaled\n        changeable = 0\n        # swap units.\n        unit2 = unit1\n        unit1 = None\n    elif unit2 is unit1:\n        # ensure identical units is fast (\"==\" is slow, so avoid that).\n        return converters, unit1\n    else:\n        changeable = 1\n\n    # Try to get a converter from unit2 to unit1.\n    if unit1 is None:\n        try:\n            converters[changeable] = get_converter(unit2,\n                                                   dimensionless_unscaled)\n        except UnitsError:\n            # special case: would be OK if unitless number is zero, inf, nan\n            converters[1-changeable] = False\n            return converters, unit2\n        else:\n            return converters, dimensionless_unscaled\n    else:\n        try:\n            converters[changeable] = get_converter(unit2, unit1)\n        except UnitsError:\n            raise UnitConversionError(\n                \"Can only apply '{}' function to quantities \"\n                \"with compatible dimensions\"\n                .format(f.__name__))\n\n        return converters, unit1\n\n\n# SINGLE ARGUMENT UFUNC HELPERS\n#\n# The functions below take a single argument, which is the quantity upon which\n# the ufunc is being used. The output of the helper function should be two\n# values: a list with a single converter to be used to scale the input before\n# it is being passed to the ufunc (or None if no conversion is needed), and\n# the unit the output will be in.\n\ndef helper_onearg_test(f, unit):\n    return ([None], None)\n\n\ndef helper_invariant(f, unit):\n    return ([None], _d(unit))\n\n\ndef helper_square(f, unit):\n    return ([None], unit ** 2 if unit is not None else dimensionless_unscaled)\n\n\ndef helper_reciprocal(f, unit):\n    return ([None], unit ** -1 if unit is not None else dimensionless_unscaled)\n\n\none_half = 0.5  # faster than Fraction(1, 2)\none_third = Fraction(1, 3)\n\n\ndef helper_sqrt(f, unit):\n    return ([None], unit ** one_half if unit is not None\n            else dimensionless_unscaled)\n\n\ndef helper_cbrt(f, unit):\n    return ([None], (unit ** one_third if unit is not None\n                     else dimensionless_unscaled))\n\n\ndef helper_modf(f, unit):\n    if unit is None:\n        return [None], (dimensionless_unscaled, dimensionless_unscaled)\n\n    try:\n        return ([get_converter(unit, dimensionless_unscaled)],\n                (dimensionless_unscaled, dimensionless_unscaled))\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"dimensionless quantities\"\n                            .format(f.__name__))\n\n\ndef helper__ones_like(f, unit):\n    return [None], dimensionless_unscaled\n\n\ndef helper_dimensionless_to_dimensionless(f, unit):\n    if unit is None:\n        return [None], dimensionless_unscaled\n\n    try:\n        return ([get_converter(unit, dimensionless_unscaled)],\n                dimensionless_unscaled)\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"dimensionless quantities\"\n                            .format(f.__name__))\n\n\ndef helper_dimensionless_to_radian(f, unit):\n    from astropy.units.si import radian\n    if unit is None:\n        return [None], radian\n\n    try:\n        return [get_converter(unit, dimensionless_unscaled)], radian\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"dimensionless quantities\"\n                            .format(f.__name__))\n\n\ndef helper_degree_to_radian(f, unit):\n    from astropy.units.si import degree, radian\n    try:\n        return [get_converter(unit, degree)], radian\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))\n\n\ndef helper_radian_to_degree(f, unit):\n    from astropy.units.si import degree, radian\n    try:\n        return [get_converter(unit, radian)], degree\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))\n\n\ndef helper_radian_to_dimensionless(f, unit):\n    from astropy.units.si import radian\n    try:\n        return [get_converter(unit, radian)], dimensionless_unscaled\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))\n\n\ndef helper_frexp(f, unit):\n    if not unit.is_unity():\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"unscaled dimensionless quantities\"\n                            .format(f.__name__))\n    return [None], (None, None)\n\n\n# TWO ARGUMENT UFUNC HELPERS\n#\n# The functions below take a two arguments. The output of the helper function\n# should be two values: a tuple of two converters to be used to scale the\n# inputs before being passed to the ufunc (None if no conversion is needed),\n# and the unit the output will be in.\n\ndef helper_multiplication(f, unit1, unit2):\n    return [None, None], _d(unit1) * _d(unit2)\n\n\ndef helper_division(f, unit1, unit2):\n    return [None, None], _d(unit1) / _d(unit2)\n\n\ndef helper_power(f, unit1, unit2):\n    # TODO: find a better way to do this, currently need to signal that one\n    # still needs to raise power of unit1 in main code\n    if unit2 is None:\n        return [None, None], False\n\n    try:\n        return [None, get_converter(unit2, dimensionless_unscaled)], False\n    except UnitsError:\n        raise UnitTypeError(\"Can only raise something to a \"\n                            \"dimensionless quantity\")\n\n\ndef helper_ldexp(f, unit1, unit2):\n    if unit2 is not None:\n        raise TypeError(\"Cannot use ldexp with a quantity \"\n                        \"as second argument.\")\n    else:\n        return [None, None], _d(unit1)\n\n\ndef helper_copysign(f, unit1, unit2):\n    # if first arg is not a quantity, just return plain array\n    if unit1 is None:\n        return [None, None], None\n    else:\n        return [None, None], unit1\n\n\ndef helper_heaviside(f, unit1, unit2):\n    try:\n        converter2 = (get_converter(unit2, dimensionless_unscaled)\n                      if unit2 is not None else None)\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply 'heaviside' function with a \"\n                            \"dimensionless second argument.\")\n    return ([None, converter2], dimensionless_unscaled)\n\n\ndef helper_two_arg_dimensionless(f, unit1, unit2):\n    try:\n        converter1 = (get_converter(unit1, dimensionless_unscaled)\n                      if unit1 is not None else None)\n        converter2 = (get_converter(unit2, dimensionless_unscaled)\n                      if unit2 is not None else None)\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"dimensionless quantities\"\n                            .format(f.__name__))\n    return ([converter1, converter2], dimensionless_unscaled)\n\n\n# This used to be a separate function that just called get_converters_and_unit.\n# Using it directly saves a few us; keeping the clearer name.\nhelper_twoarg_invariant = get_converters_and_unit\n\n\ndef helper_twoarg_comparison(f, unit1, unit2):\n    converters, _ = get_converters_and_unit(f, unit1, unit2)\n    return converters, None\n\n\ndef helper_twoarg_invtrig(f, unit1, unit2):\n    from astropy.units.si import radian\n    converters, _ = get_converters_and_unit(f, unit1, unit2)\n    return converters, radian\n\n\ndef helper_twoarg_floor_divide(f, unit1, unit2):\n    converters, _ = get_converters_and_unit(f, unit1, unit2)\n    return converters, dimensionless_unscaled\n\n\ndef helper_divmod(f, unit1, unit2):\n    converters, result_unit = get_converters_and_unit(f, unit1, unit2)\n    return converters, (dimensionless_unscaled, result_unit)\n\n\ndef helper_clip(f, unit1, unit2, unit3):\n    # Treat the array being clipped as primary.\n    converters = [None]\n    if unit1 is None:\n        result_unit = dimensionless_unscaled\n        try:\n            converters += [(None if unit is None else\n                            get_converter(unit, dimensionless_unscaled))\n                           for unit in (unit2, unit3)]\n        except UnitsError:\n            raise UnitConversionError(\n                \"Can only apply '{}' function to quantities with \"\n                \"compatible dimensions\".format(f.__name__))\n\n    else:\n        result_unit = unit1\n        for unit in unit2, unit3:\n            try:\n                converter = get_converter(_d(unit), result_unit)\n            except UnitsError:\n                if unit is None:\n                    # special case: OK if unitless number is zero, inf, nan\n                    converters.append(False)\n                else:\n                    raise UnitConversionError(\n                        \"Can only apply '{}' function to quantities with \"\n                        \"compatible dimensions\".format(f.__name__))\n            else:\n                converters.append(converter)\n\n    return converters, result_unit\n\n\n# list of ufuncs:\n# https://numpy.org/doc/stable/reference/ufuncs.html#available-ufuncs\n\nUNSUPPORTED_UFUNCS |= {\n    np.bitwise_and, np.bitwise_or, np.bitwise_xor, np.invert, np.left_shift,\n    np.right_shift, np.logical_and, np.logical_or, np.logical_xor,\n    np.logical_not, np.isnat, np.gcd, np.lcm}\n\n# SINGLE ARGUMENT UFUNCS\n\n# ufuncs that do not care about the unit and do not return a Quantity\n# (but rather a boolean, or -1, 0, or +1 for np.sign).\nonearg_test_ufuncs = (np.isfinite, np.isinf, np.isnan, np.sign, np.signbit)\nfor ufunc in onearg_test_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_onearg_test\n\n# ufuncs that return a value with the same unit as the input\ninvariant_ufuncs = (np.absolute, np.fabs, np.conj, np.conjugate, np.negative,\n                    np.spacing, np.rint, np.floor, np.ceil, np.trunc,\n                    np.positive)\nfor ufunc in invariant_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_invariant\n\n# ufuncs that require dimensionless input and and give dimensionless output\ndimensionless_to_dimensionless_ufuncs = (np.exp, np.expm1, np.exp2, np.log,\n                                         np.log10, np.log2, np.log1p)\n# Default numpy does not ship an \"erf\" ufunc, but some versions hacked by\n# intel do.  This is bad, since it means code written for that numpy will\n# not run on non-hacked numpy.  But still, we might as well support it.\nif isinstance(getattr(np.core.umath, 'erf', None), np.ufunc):\n    dimensionless_to_dimensionless_ufuncs += (np.core.umath.erf,)\n\nfor ufunc in dimensionless_to_dimensionless_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_dimensionless_to_dimensionless\n\n# ufuncs that require dimensionless input and give output in radians\ndimensionless_to_radian_ufuncs = (np.arccos, np.arcsin, np.arctan, np.arccosh,\n                                  np.arcsinh, np.arctanh)\nfor ufunc in dimensionless_to_radian_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_dimensionless_to_radian\n\n# ufuncs that require input in degrees and give output in radians\ndegree_to_radian_ufuncs = (np.radians, np.deg2rad)\nfor ufunc in degree_to_radian_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_degree_to_radian\n\n# ufuncs that require input in radians and give output in degrees\nradian_to_degree_ufuncs = (np.degrees, np.rad2deg)\nfor ufunc in radian_to_degree_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_radian_to_degree\n\n# ufuncs that require input in radians and give dimensionless output\nradian_to_dimensionless_ufuncs = (np.cos, np.sin, np.tan, np.cosh, np.sinh,\n                                  np.tanh)\nfor ufunc in radian_to_dimensionless_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_radian_to_dimensionless\n\n# ufuncs handled as special cases\nUFUNC_HELPERS[np.sqrt] = helper_sqrt\nUFUNC_HELPERS[np.square] = helper_square\nUFUNC_HELPERS[np.reciprocal] = helper_reciprocal\nUFUNC_HELPERS[np.cbrt] = helper_cbrt\nUFUNC_HELPERS[np.core.umath._ones_like] = helper__ones_like\nUFUNC_HELPERS[np.modf] = helper_modf\nUFUNC_HELPERS[np.frexp] = helper_frexp\n\n\n# TWO ARGUMENT UFUNCS\n\n# two argument ufuncs that require dimensionless input and and give\n# dimensionless output\ntwo_arg_dimensionless_ufuncs = (np.logaddexp, np.logaddexp2)\nfor ufunc in two_arg_dimensionless_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_two_arg_dimensionless\n\n# two argument ufuncs that return a value with the same unit as the input\ntwoarg_invariant_ufuncs = (np.add, np.subtract, np.hypot, np.maximum,\n                           np.minimum, np.fmin, np.fmax, np.nextafter,\n                           np.remainder, np.mod, np.fmod)\nfor ufunc in twoarg_invariant_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_twoarg_invariant\n\n# two argument ufuncs that need compatible inputs and return a boolean\ntwoarg_comparison_ufuncs = (np.greater, np.greater_equal, np.less,\n                            np.less_equal, np.not_equal, np.equal)\nfor ufunc in twoarg_comparison_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_twoarg_comparison\n\n# two argument ufuncs that do inverse trigonometry\ntwoarg_invtrig_ufuncs = (np.arctan2,)\n# another private function in numpy; use getattr in case it disappears\nif isinstance(getattr(np.core.umath, '_arg', None), np.ufunc):\n    twoarg_invtrig_ufuncs += (np.core.umath._arg,)\nfor ufunc in twoarg_invtrig_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_twoarg_invtrig\n\n# ufuncs handled as special cases\nUFUNC_HELPERS[np.multiply] = helper_multiplication\nif isinstance(getattr(np, 'matmul', None), np.ufunc):\n    UFUNC_HELPERS[np.matmul] = helper_multiplication\nUFUNC_HELPERS[np.divide] = helper_division\nUFUNC_HELPERS[np.true_divide] = helper_division\nUFUNC_HELPERS[np.power] = helper_power\nUFUNC_HELPERS[np.ldexp] = helper_ldexp\nUFUNC_HELPERS[np.copysign] = helper_copysign\nUFUNC_HELPERS[np.floor_divide] = helper_twoarg_floor_divide\nUFUNC_HELPERS[np.heaviside] = helper_heaviside\nUFUNC_HELPERS[np.float_power] = helper_power\nUFUNC_HELPERS[np.divmod] = helper_divmod\n# Check for clip ufunc; note that np.clip is a wrapper function, not the ufunc.\nif isinstance(getattr(np.core.umath, 'clip', None), np.ufunc):\n    UFUNC_HELPERS[np.core.umath.clip] = helper_clip\n\ndel ufunc\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":112,"id":10380,"name":"UNSUPPORTED_UFUNCS","nodeType":"Attribute","startLoc":112,"text":"UNSUPPORTED_UFUNCS"},{"col":4,"comment":"null","endLoc":560,"header":"def _set_unit(self, unit)","id":10381,"name":"_set_unit","nodeType":"Function","startLoc":548,"text":"def _set_unit(self, unit):\n        if not isinstance(unit, self._unit_class):\n            # Have to take care of, e.g., (10*u.mag).view(u.Magnitude)\n            try:\n                # \"or 'nonsense'\" ensures `None` breaks, just in case.\n                unit = self._unit_class(function_unit=unit or 'nonsense')\n            except Exception:\n                raise UnitTypeError(\n                    \"{} instances require {} function units\"\n                    .format(type(self).__name__, self._unit_class.__name__) +\n                    f\", so cannot set it to '{unit}'.\")\n\n        self._unit = unit"},{"col":0,"comment":"null","endLoc":26,"header":"def _d(unit)","id":10382,"name":"_d","nodeType":"Function","startLoc":22,"text":"def _d(unit):\n    if unit is None:\n        return dimensionless_unscaled\n    else:\n        return unit"},{"col":0,"comment":"null","endLoc":75,"header":"def get_converters_and_unit(f, unit1, unit2)","id":10383,"name":"get_converters_and_unit","nodeType":"Function","startLoc":36,"text":"def get_converters_and_unit(f, unit1, unit2):\n    converters = [None, None]\n    # By default, we try adjusting unit2 to unit1, so that the result will\n    # be unit1 as well. But if there is no second unit, we have to try\n    # adjusting unit1 (to dimensionless, see below).\n    if unit2 is None:\n        if unit1 is None:\n            # No units for any input -- e.g., np.add(a1, a2, out=q)\n            return converters, dimensionless_unscaled\n        changeable = 0\n        # swap units.\n        unit2 = unit1\n        unit1 = None\n    elif unit2 is unit1:\n        # ensure identical units is fast (\"==\" is slow, so avoid that).\n        return converters, unit1\n    else:\n        changeable = 1\n\n    # Try to get a converter from unit2 to unit1.\n    if unit1 is None:\n        try:\n            converters[changeable] = get_converter(unit2,\n                                                   dimensionless_unscaled)\n        except UnitsError:\n            # special case: would be OK if unitless number is zero, inf, nan\n            converters[1-changeable] = False\n            return converters, unit2\n        else:\n            return converters, dimensionless_unscaled\n    else:\n        try:\n            converters[changeable] = get_converter(unit2, unit1)\n        except UnitsError:\n            raise UnitConversionError(\n                \"Can only apply '{}' function to quantities \"\n                \"with compatible dimensions\"\n                .format(f.__name__))\n\n        return converters, unit1"},{"col":0,"comment":"null","endLoc":63,"header":"def helper_degree_minute_second_to_radian(f, unit1, unit2, unit3)","id":10384,"name":"helper_degree_minute_second_to_radian","nodeType":"Function","startLoc":54,"text":"def helper_degree_minute_second_to_radian(f, unit1, unit2, unit3):\n    from astropy.units.si import degree, arcmin, arcsec, radian\n    try:\n        return [get_converter(unit1, degree),\n                get_converter(unit2, arcmin),\n                get_converter(unit3, arcsec)], radian\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))"},{"fileName":"converters.py","filePath":"astropy/units/quantity_helper","id":10385,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"Converters for Quantity.\"\"\"\n\nimport threading\n\nimport numpy as np\n\nfrom astropy.units.core import (UnitsError, UnitConversionError, UnitTypeError,\n                                dimensionless_unscaled)\n\n__all__ = ['can_have_arbitrary_unit', 'converters_and_unit',\n           'check_output', 'UFUNC_HELPERS', 'UNSUPPORTED_UFUNCS']\n\n\nclass UfuncHelpers(dict):\n    \"\"\"Registry of unit conversion functions to help ufunc evaluation.\n\n    Based on dict for quick access, but with a missing method to load\n    helpers for additional modules such as scipy.special and erfa.\n\n    Such modules should be registered using ``register_module``.\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n        self.modules = {}\n        self.UNSUPPORTED = set()   # Upper-case for backwards compatibility\n        self._lock = threading.RLock()\n        super().__init__(*args, **kwargs)\n\n    def register_module(self, module, names, importer):\n        \"\"\"Register (but do not import) a set of ufunc helpers.\n\n        Parameters\n        ----------\n        module : str\n            Name of the module with the ufuncs (e.g., 'scipy.special').\n        names : iterable of str\n            Names of the module ufuncs for which helpers are available.\n        importer : callable\n            Function that imports the ufuncs and returns a dict of helpers\n            keyed by those ufuncs.  If the value is `None`, the ufunc is\n            explicitly *not* supported.\n        \"\"\"\n        with self._lock:\n            self.modules[module] = {'names': names,\n                                    'importer': importer}\n\n    def import_module(self, module):\n        \"\"\"Import the helpers from the given module using its helper function.\n\n        Parameters\n        ----------\n        module : str\n            Name of the module. Has to have been registered beforehand.\n        \"\"\"\n        with self._lock:\n            module_info = self.modules.pop(module)\n            self.update(module_info['importer']())\n\n    def __missing__(self, ufunc):\n        \"\"\"Called if a ufunc is not found.\n\n        Check if the ufunc is in any of the available modules, and, if so,\n        import the helpers for that module.\n        \"\"\"\n        with self._lock:\n            # Check if it was loaded while we waited for the lock\n            if ufunc in self:\n                return self[ufunc]\n\n            if ufunc in self.UNSUPPORTED:\n                raise TypeError(f\"Cannot use ufunc '{ufunc.__name__}' with quantities\")\n\n            for module, module_info in list(self.modules.items()):\n                if ufunc.__name__ in module_info['names']:\n                    # A ufunc with the same name is supported by this module.\n                    # Of course, this doesn't necessarily mean it is the\n                    # right module. So, we try let the importer do its work.\n                    # If it fails (e.g., for `scipy.special`), then that's\n                    # fine, just raise the TypeError.  If it succeeds, but\n                    # the ufunc is not found, that is also fine: we will\n                    # enter __missing__ again and either find another\n                    # module or get the TypeError there.\n                    try:\n                        self.import_module(module)\n                    except ImportError:  # pragma: no cover\n                        pass\n                    else:\n                        return self[ufunc]\n\n        raise TypeError(\"unknown ufunc {}.  If you believe this ufunc \"\n                        \"should be supported, please raise an issue on \"\n                        \"https://github.com/astropy/astropy\"\n                        .format(ufunc.__name__))\n\n    def __setitem__(self, key, value):\n        # Implementation note: in principle, we could just let `None`\n        # mean that something is not implemented, but this means an\n        # extra if clause for the output, slowing down the common\n        # path where a ufunc is supported.\n        with self._lock:\n            if value is None:\n                self.UNSUPPORTED |= {key}\n                self.pop(key, None)\n            else:\n                super().__setitem__(key, value)\n                self.UNSUPPORTED -= {key}\n\n\nUFUNC_HELPERS = UfuncHelpers()\nUNSUPPORTED_UFUNCS = UFUNC_HELPERS.UNSUPPORTED\n\n\ndef can_have_arbitrary_unit(value):\n    \"\"\"Test whether the items in value can have arbitrary units\n\n    Numbers whose value does not change upon a unit change, i.e.,\n    zero, infinity, or not-a-number\n\n    Parameters\n    ----------\n    value : number or array\n\n    Returns\n    -------\n    bool\n        `True` if each member is either zero or not finite, `False` otherwise\n    \"\"\"\n    return np.all(np.logical_or(np.equal(value, 0.), ~np.isfinite(value)))\n\n\ndef converters_and_unit(function, method, *args):\n    \"\"\"Determine the required converters and the unit of the ufunc result.\n\n    Converters are functions required to convert to a ufunc's expected unit,\n    e.g., radian for np.sin; or to ensure units of two inputs are consistent,\n    e.g., for np.add.  In these examples, the unit of the result would be\n    dimensionless_unscaled for np.sin, and the same consistent unit for np.add.\n\n    Parameters\n    ----------\n    function : `~numpy.ufunc`\n        Numpy universal function\n    method : str\n        Method with which the function is evaluated, e.g.,\n        '__call__', 'reduce', etc.\n    *args :  `~astropy.units.Quantity` or ndarray subclass\n        Input arguments to the function\n\n    Raises\n    ------\n    TypeError : when the specified function cannot be used with Quantities\n        (e.g., np.logical_or), or when the routine does not know how to handle\n        the specified function (in which case an issue should be raised on\n        https://github.com/astropy/astropy).\n    UnitTypeError : when the conversion to the required (or consistent) units\n        is not possible.\n    \"\"\"\n\n    # Check whether we support this ufunc, by getting the helper function\n    # (defined in helpers) which returns a list of function(s) that convert the\n    # input(s) to the unit required for the ufunc, as well as the unit the\n    # result will have (a tuple of units if there are multiple outputs).\n    ufunc_helper = UFUNC_HELPERS[function]\n\n    if method == '__call__' or (method == 'outer' and function.nin == 2):\n        # Find out the units of the arguments passed to the ufunc; usually,\n        # at least one is a quantity, but for two-argument ufuncs, the second\n        # could also be a Numpy array, etc.  These are given unit=None.\n        units = [getattr(arg, 'unit', None) for arg in args]\n\n        # Determine possible conversion functions, and the result unit.\n        converters, result_unit = ufunc_helper(function, *units)\n\n        if any(converter is False for converter in converters):\n            # for multi-argument ufuncs with a quantity and a non-quantity,\n            # the quantity normally needs to be dimensionless, *except*\n            # if the non-quantity can have arbitrary unit, i.e., when it\n            # is all zero, infinity or NaN.  In that case, the non-quantity\n            # can just have the unit of the quantity\n            # (this allows, e.g., `q > 0.` independent of unit)\n            try:\n                # Don't fold this loop in the test above: this rare case\n                # should not make the common case slower.\n                for i, converter in enumerate(converters):\n                    if converter is not False:\n                        continue\n                    if can_have_arbitrary_unit(args[i]):\n                        converters[i] = None\n                    else:\n                        raise UnitConversionError(\n                            \"Can only apply '{}' function to \"\n                            \"dimensionless quantities when other \"\n                            \"argument is not a quantity (unless the \"\n                            \"latter is all zero/infinity/nan)\"\n                            .format(function.__name__))\n            except TypeError:\n                # _can_have_arbitrary_unit failed: arg could not be compared\n                # with zero or checked to be finite. Then, ufunc will fail too.\n                raise TypeError(\"Unsupported operand type(s) for ufunc {}: \"\n                                \"'{}'\".format(function.__name__,\n                                               ','.join([arg.__class__.__name__\n                                                         for arg in args])))\n\n        # In the case of np.power and np.float_power, the unit itself needs to\n        # be modified by an amount that depends on one of the input values,\n        # so we need to treat this as a special case.\n        # TODO: find a better way to deal with this.\n        if result_unit is False:\n            if units[0] is None or units[0] == dimensionless_unscaled:\n                result_unit = dimensionless_unscaled\n            else:\n                if units[1] is None:\n                    p = args[1]\n                else:\n                    p = args[1].to(dimensionless_unscaled).value\n\n                try:\n                    result_unit = units[0] ** p\n                except ValueError as exc:\n                    # Changing the unit does not work for, e.g., array-shaped\n                    # power, but this is OK if we're (scaled) dimensionless.\n                    try:\n                        converters[0] = units[0]._get_converter(\n                            dimensionless_unscaled)\n                    except UnitConversionError:\n                        raise exc\n                    else:\n                        result_unit = dimensionless_unscaled\n\n    else:  # methods for which the unit should stay the same\n        nin = function.nin\n        unit = getattr(args[0], 'unit', None)\n        if method == 'at' and nin <= 2:\n            if nin == 1:\n                units = [unit]\n            else:\n                units = [unit, getattr(args[2], 'unit', None)]\n\n            converters, result_unit = ufunc_helper(function, *units)\n\n            # ensure there is no 'converter' for indices (2nd argument)\n            converters.insert(1, None)\n\n        elif method in {'reduce', 'accumulate', 'reduceat'} and nin == 2:\n            converters, result_unit = ufunc_helper(function, unit, unit)\n            converters = converters[:1]\n            if method == 'reduceat':\n                # add 'scale' for indices (2nd argument)\n                converters += [None]\n\n        else:\n            if method in {'reduce', 'accumulate',\n                          'reduceat', 'outer'} and nin != 2:\n                raise ValueError(f\"{method} only supported for binary functions\")\n\n            raise TypeError(\"Unexpected ufunc method {}.  If this should \"\n                            \"work, please raise an issue on\"\n                            \"https://github.com/astropy/astropy\"\n                            .format(method))\n\n        # for all but __call__ method, scaling is not allowed\n        if unit is not None and result_unit is None:\n            raise TypeError(\"Cannot use '{1}' method on ufunc {0} with a \"\n                            \"Quantity instance as the result is not a \"\n                            \"Quantity.\".format(function.__name__, method))\n\n        if (converters[0] is not None or\n            (unit is not None and unit is not result_unit and\n             (not result_unit.is_equivalent(unit) or\n              result_unit.to(unit) != 1.))):\n            # NOTE: this cannot be the more logical UnitTypeError, since\n            # then things like np.cumprod will not longer fail (they check\n            # for TypeError).\n            raise UnitsError(\"Cannot use '{1}' method on ufunc {0} with a \"\n                             \"Quantity instance as it would change the unit.\"\n                             .format(function.__name__, method))\n\n    return converters, result_unit\n\n\ndef check_output(output, unit, inputs, function=None):\n    \"\"\"Check that function output can be stored in the output array given.\n\n    Parameters\n    ----------\n    output : array or `~astropy.units.Quantity` or tuple\n        Array that should hold the function output (or tuple of such arrays).\n    unit : `~astropy.units.Unit` or None, or tuple\n        Unit that the output will have, or `None` for pure numbers (should be\n        tuple of same if output is a tuple of outputs).\n    inputs : tuple\n        Any input arguments.  These should be castable to the output.\n    function : callable\n        The function that will be producing the output.  If given, used to\n        give a more informative error message.\n\n    Returns\n    -------\n    arrays : ndarray view or tuple thereof\n        The view(s) is of ``output``.\n\n    Raises\n    ------\n    UnitTypeError : If ``unit`` is inconsistent with the class of ``output``\n\n    TypeError : If the ``inputs`` cannot be cast safely to ``output``.\n    \"\"\"\n    if isinstance(output, tuple):\n        return tuple(check_output(output_, unit_, inputs, function)\n                     for output_, unit_ in zip(output, unit))\n\n    # ``None`` indicates no actual array is needed.  This can happen, e.g.,\n    # with np.modf(a, out=(None, b)).\n    if output is None:\n        return None\n\n    if hasattr(output, '__quantity_subclass__'):\n        # Check that we're not trying to store a plain Numpy array or a\n        # Quantity with an inconsistent unit (e.g., not angular for Angle).\n        if unit is None:\n            raise TypeError(\"Cannot store non-quantity output{} in {} \"\n                            \"instance\".format(\n                                (f\" from {function.__name__} function\"\n                                 if function is not None else \"\"),\n                                type(output)))\n\n        q_cls, subok = output.__quantity_subclass__(unit)\n        if not (subok or q_cls is type(output)):\n            raise UnitTypeError(\n                \"Cannot store output with unit '{}'{} \"\n                \"in {} instance.  Use {} instance instead.\"\n                .format(unit, (f\" from {function.__name__} function\"\n                               if function is not None else \"\"),\n                        type(output), q_cls))\n\n        # check we can handle the dtype (e.g., that we are not int\n        # when float is required).  Note that we only do this for Quantity\n        # output; for array output, we defer to numpy's default handling.\n        # Also, any structured dtype are ignored (likely erfa ufuncs).\n        # TODO: make more logical; is this necessary at all?\n        if inputs and not output.dtype.names:\n            result_type = np.result_type(*inputs)\n            if not (result_type.names\n                    or np.can_cast(result_type, output.dtype,\n                                   casting='same_kind')):\n                raise TypeError(\"Arguments cannot be cast safely to inplace \"\n                                \"output with dtype={}\".format(output.dtype))\n        # Turn into ndarray, so we do not loop into array_wrap/array_ufunc\n        # if the output is used to store results of a function.\n        return output.view(np.ndarray)\n\n    else:\n        # output is not a Quantity, so cannot obtain a unit.\n        if not (unit is None or unit is dimensionless_unscaled):\n            raise UnitTypeError(\"Cannot store quantity with dimension \"\n                                \"{}in a non-Quantity instance.\"\n                                .format(\"\" if function is None else\n                                        \"resulting from {} function \"\n                                        .format(function.__name__)))\n\n        return output\n"},{"className":"UfuncHelpers","col":0,"comment":"Registry of unit conversion functions to help ufunc evaluation.\n\n    Based on dict for quick access, but with a missing method to load\n    helpers for additional modules such as scipy.special and erfa.\n\n    Such modules should be registered using ``register_module``.\n    ","endLoc":108,"id":10386,"nodeType":"Class","startLoc":16,"text":"class UfuncHelpers(dict):\n    \"\"\"Registry of unit conversion functions to help ufunc evaluation.\n\n    Based on dict for quick access, but with a missing method to load\n    helpers for additional modules such as scipy.special and erfa.\n\n    Such modules should be registered using ``register_module``.\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n        self.modules = {}\n        self.UNSUPPORTED = set()   # Upper-case for backwards compatibility\n        self._lock = threading.RLock()\n        super().__init__(*args, **kwargs)\n\n    def register_module(self, module, names, importer):\n        \"\"\"Register (but do not import) a set of ufunc helpers.\n\n        Parameters\n        ----------\n        module : str\n            Name of the module with the ufuncs (e.g., 'scipy.special').\n        names : iterable of str\n            Names of the module ufuncs for which helpers are available.\n        importer : callable\n            Function that imports the ufuncs and returns a dict of helpers\n            keyed by those ufuncs.  If the value is `None`, the ufunc is\n            explicitly *not* supported.\n        \"\"\"\n        with self._lock:\n            self.modules[module] = {'names': names,\n                                    'importer': importer}\n\n    def import_module(self, module):\n        \"\"\"Import the helpers from the given module using its helper function.\n\n        Parameters\n        ----------\n        module : str\n            Name of the module. Has to have been registered beforehand.\n        \"\"\"\n        with self._lock:\n            module_info = self.modules.pop(module)\n            self.update(module_info['importer']())\n\n    def __missing__(self, ufunc):\n        \"\"\"Called if a ufunc is not found.\n\n        Check if the ufunc is in any of the available modules, and, if so,\n        import the helpers for that module.\n        \"\"\"\n        with self._lock:\n            # Check if it was loaded while we waited for the lock\n            if ufunc in self:\n                return self[ufunc]\n\n            if ufunc in self.UNSUPPORTED:\n                raise TypeError(f\"Cannot use ufunc '{ufunc.__name__}' with quantities\")\n\n            for module, module_info in list(self.modules.items()):\n                if ufunc.__name__ in module_info['names']:\n                    # A ufunc with the same name is supported by this module.\n                    # Of course, this doesn't necessarily mean it is the\n                    # right module. So, we try let the importer do its work.\n                    # If it fails (e.g., for `scipy.special`), then that's\n                    # fine, just raise the TypeError.  If it succeeds, but\n                    # the ufunc is not found, that is also fine: we will\n                    # enter __missing__ again and either find another\n                    # module or get the TypeError there.\n                    try:\n                        self.import_module(module)\n                    except ImportError:  # pragma: no cover\n                        pass\n                    else:\n                        return self[ufunc]\n\n        raise TypeError(\"unknown ufunc {}.  If you believe this ufunc \"\n                        \"should be supported, please raise an issue on \"\n                        \"https://github.com/astropy/astropy\"\n                        .format(ufunc.__name__))\n\n    def __setitem__(self, key, value):\n        # Implementation note: in principle, we could just let `None`\n        # mean that something is not implemented, but this means an\n        # extra if clause for the output, slowing down the common\n        # path where a ufunc is supported.\n        with self._lock:\n            if value is None:\n                self.UNSUPPORTED |= {key}\n                self.pop(key, None)\n            else:\n                super().__setitem__(key, value)\n                self.UNSUPPORTED -= {key}"},{"col":4,"comment":"null","endLoc":29,"header":"def __init__(self, *args, **kwargs)","id":10387,"name":"__init__","nodeType":"Function","startLoc":25,"text":"def __init__(self, *args, **kwargs):\n        self.modules = {}\n        self.UNSUPPORTED = set()   # Upper-case for backwards compatibility\n        self._lock = threading.RLock()\n        super().__init__(*args, **kwargs)"},{"col":0,"comment":"null","endLoc":87,"header":"def helper_onearg_test(f, unit)","id":10388,"name":"helper_onearg_test","nodeType":"Function","startLoc":86,"text":"def helper_onearg_test(f, unit):\n    return ([None], None)"},{"col":0,"comment":"null","endLoc":91,"header":"def helper_invariant(f, unit)","id":10389,"name":"helper_invariant","nodeType":"Function","startLoc":90,"text":"def helper_invariant(f, unit):\n    return ([None], _d(unit))"},{"col":4,"comment":"Generate a new `FunctionQuantity` with the physical unit decomposed.\n\n        For details, see `~astropy.units.Quantity.decompose`.\n        ","endLoc":539,"header":"def decompose(self, bases=[])","id":10390,"name":"decompose","nodeType":"Function","startLoc":534,"text":"def decompose(self, bases=[]):\n        \"\"\"Generate a new `FunctionQuantity` with the physical unit decomposed.\n\n        For details, see `~astropy.units.Quantity.decompose`.\n        \"\"\"\n        return self.__class__(self.physical.decompose(bases))"},{"col":4,"comment":"Register (but do not import) a set of ufunc helpers.\n\n        Parameters\n        ----------\n        module : str\n            Name of the module with the ufuncs (e.g., 'scipy.special').\n        names : iterable of str\n            Names of the module ufuncs for which helpers are available.\n        importer : callable\n            Function that imports the ufuncs and returns a dict of helpers\n            keyed by those ufuncs.  If the value is `None`, the ufunc is\n            explicitly *not* supported.\n        ","endLoc":47,"header":"def register_module(self, module, names, importer)","id":10391,"name":"register_module","nodeType":"Function","startLoc":31,"text":"def register_module(self, module, names, importer):\n        \"\"\"Register (but do not import) a set of ufunc helpers.\n\n        Parameters\n        ----------\n        module : str\n            Name of the module with the ufuncs (e.g., 'scipy.special').\n        names : iterable of str\n            Names of the module ufuncs for which helpers are available.\n        importer : callable\n            Function that imports the ufuncs and returns a dict of helpers\n            keyed by those ufuncs.  If the value is `None`, the ufunc is\n            explicitly *not* supported.\n        \"\"\"\n        with self._lock:\n            self.modules[module] = {'names': names,\n                                    'importer': importer}"},{"col":4,"comment":"Import the helpers from the given module using its helper function.\n\n        Parameters\n        ----------\n        module : str\n            Name of the module. Has to have been registered beforehand.\n        ","endLoc":59,"header":"def import_module(self, module)","id":10392,"name":"import_module","nodeType":"Function","startLoc":49,"text":"def import_module(self, module):\n        \"\"\"Import the helpers from the given module using its helper function.\n\n        Parameters\n        ----------\n        module : str\n            Name of the module. Has to have been registered beforehand.\n        \"\"\"\n        with self._lock:\n            module_info = self.modules.pop(module)\n            self.update(module_info['importer']())"},{"col":0,"comment":"null","endLoc":205,"header":"def helper_multiplication(f, unit1, unit2)","id":10393,"name":"helper_multiplication","nodeType":"Function","startLoc":204,"text":"def helper_multiplication(f, unit1, unit2):\n    return [None, None], _d(unit1) * _d(unit2)"},{"col":0,"comment":"null","endLoc":95,"header":"def helper_square(f, unit)","id":10394,"name":"helper_square","nodeType":"Function","startLoc":94,"text":"def helper_square(f, unit):\n    return ([None], unit ** 2 if unit is not None else dimensionless_unscaled)"},{"col":0,"comment":"null","endLoc":99,"header":"def helper_reciprocal(f, unit)","id":10395,"name":"helper_reciprocal","nodeType":"Function","startLoc":98,"text":"def helper_reciprocal(f, unit):\n    return ([None], unit ** -1 if unit is not None else dimensionless_unscaled)"},{"col":0,"comment":"null","endLoc":108,"header":"def helper_sqrt(f, unit)","id":10396,"name":"helper_sqrt","nodeType":"Function","startLoc":106,"text":"def helper_sqrt(f, unit):\n    return ([None], unit ** one_half if unit is not None\n            else dimensionless_unscaled)"},{"col":0,"comment":"null","endLoc":126,"header":"def helper_modf(f, unit)","id":10397,"name":"helper_modf","nodeType":"Function","startLoc":116,"text":"def helper_modf(f, unit):\n    if unit is None:\n        return [None], (dimensionless_unscaled, dimensionless_unscaled)\n\n    try:\n        return ([get_converter(unit, dimensionless_unscaled)],\n                (dimensionless_unscaled, dimensionless_unscaled))\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"dimensionless quantities\"\n                            .format(f.__name__))"},{"col":4,"comment":"Called if a ufunc is not found.\n\n        Check if the ufunc is in any of the available modules, and, if so,\n        import the helpers for that module.\n        ","endLoc":95,"header":"def __missing__(self, ufunc)","id":10398,"name":"__missing__","nodeType":"Function","startLoc":61,"text":"def __missing__(self, ufunc):\n        \"\"\"Called if a ufunc is not found.\n\n        Check if the ufunc is in any of the available modules, and, if so,\n        import the helpers for that module.\n        \"\"\"\n        with self._lock:\n            # Check if it was loaded while we waited for the lock\n            if ufunc in self:\n                return self[ufunc]\n\n            if ufunc in self.UNSUPPORTED:\n                raise TypeError(f\"Cannot use ufunc '{ufunc.__name__}' with quantities\")\n\n            for module, module_info in list(self.modules.items()):\n                if ufunc.__name__ in module_info['names']:\n                    # A ufunc with the same name is supported by this module.\n                    # Of course, this doesn't necessarily mean it is the\n                    # right module. So, we try let the importer do its work.\n                    # If it fails (e.g., for `scipy.special`), then that's\n                    # fine, just raise the TypeError.  If it succeeds, but\n                    # the ufunc is not found, that is also fine: we will\n                    # enter __missing__ again and either find another\n                    # module or get the TypeError there.\n                    try:\n                        self.import_module(module)\n                    except ImportError:  # pragma: no cover\n                        pass\n                    else:\n                        return self[ufunc]\n\n        raise TypeError(\"unknown ufunc {}.  If you believe this ufunc \"\n                        \"should be supported, please raise an issue on \"\n                        \"https://github.com/astropy/astropy\"\n                        .format(ufunc.__name__))"},{"col":4,"comment":"null","endLoc":261,"header":"def __sub__(self, other)","id":10399,"name":"__sub__","nodeType":"Function","startLoc":256,"text":"def __sub__(self, other):\n        # Subtract function units, thus dividing physical units.\n        new_unit = self.unit - getattr(other, 'unit', dimensionless_unscaled)\n        # Subtract actual logarithmic values, rescaling, e.g., dB -> dex.\n        result = self._function_view - getattr(other, '_function_view', other)\n        return self._new_view(result, new_unit)"},{"col":4,"comment":"null","endLoc":546,"header":"def __quantity_subclass__(self, unit)","id":10400,"name":"__quantity_subclass__","nodeType":"Function","startLoc":542,"text":"def __quantity_subclass__(self, unit):\n        if isinstance(unit, FunctionUnitBase):\n            return self.__class__, True\n        else:\n            return super().__quantity_subclass__(unit)[0], False"},{"attributeType":"function","col":0,"comment":"null","endLoc":266,"id":10401,"name":"helper_twoarg_invariant","nodeType":"Attribute","startLoc":266,"text":"helper_twoarg_invariant"},{"col":0,"comment":"null","endLoc":30,"header":"def has_matching_structure(unit, dtype)","id":10402,"name":"has_matching_structure","nodeType":"Function","startLoc":22,"text":"def has_matching_structure(unit, dtype):\n    dtype_fields = dtype.fields\n    if dtype_fields:\n        return (isinstance(unit, StructuredUnit)\n                and len(unit) == len(dtype_fields)\n                and all(has_matching_structure(u, df_v[0])\n                        for (u, df_v) in zip(unit.values(), dtype_fields.values())))\n    else:\n        return not isinstance(unit, StructuredUnit)"},{"col":4,"comment":"null","endLoc":571,"header":"def __array_ufunc__(self, function, method, *inputs, **kwargs)","id":10403,"name":"__array_ufunc__","nodeType":"Function","startLoc":562,"text":"def __array_ufunc__(self, function, method, *inputs, **kwargs):\n        # TODO: it would be more logical to have this in Quantity already,\n        # instead of in UFUNC_HELPERS, where it cannot be overridden.\n        # And really it should just return NotImplemented, since possibly\n        # another argument might know what to do.\n        if function not in self._supported_ufuncs:\n            raise UnitTypeError(\n                f\"Cannot use ufunc '{function.__name__}' with function quantities\")\n\n        return super().__array_ufunc__(function, method, *inputs, **kwargs)"},{"col":4,"comment":"null","endLoc":271,"header":"def __rsub__(self, other)","id":10404,"name":"__rsub__","nodeType":"Function","startLoc":263,"text":"def __rsub__(self, other):\n        new_unit = self.unit.__rsub__(\n            getattr(other, 'unit', dimensionless_unscaled))\n        result = self._function_view.__rsub__(\n            getattr(other, '_function_view', other))\n        # Ensure the result is in right function unit scale\n        # (with rsub, this does not have to be one's own).\n        result = result.to(new_unit.function_unit)\n        return self._new_view(result, new_unit)"},{"col":0,"comment":"null","endLoc":130,"header":"def helper__ones_like(f, unit)","id":10405,"name":"helper__ones_like","nodeType":"Function","startLoc":129,"text":"def helper__ones_like(f, unit):\n    return [None], dimensionless_unscaled"},{"col":0,"comment":"null","endLoc":156,"header":"def helper_dimensionless_to_radian(f, unit)","id":10406,"name":"helper_dimensionless_to_radian","nodeType":"Function","startLoc":146,"text":"def helper_dimensionless_to_radian(f, unit):\n    from astropy.units.si import radian\n    if unit is None:\n        return [None], radian\n\n    try:\n        return [get_converter(unit, dimensionless_unscaled)], radian\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"dimensionless quantities\"\n                            .format(f.__name__))"},{"col":4,"comment":"null","endLoc":108,"header":"def __setitem__(self, key, value)","id":10407,"name":"__setitem__","nodeType":"Function","startLoc":97,"text":"def __setitem__(self, key, value):\n        # Implementation note: in principle, we could just let `None`\n        # mean that something is not implemented, but this means an\n        # extra if clause for the output, slowing down the common\n        # path where a ufunc is supported.\n        with self._lock:\n            if value is None:\n                self.UNSUPPORTED |= {key}\n                self.pop(key, None)\n            else:\n                super().__setitem__(key, value)\n                self.UNSUPPORTED -= {key}"},{"attributeType":"null","col":8,"comment":"null","endLoc":28,"id":10408,"name":"_lock","nodeType":"Attribute","startLoc":28,"text":"self._lock"},{"col":0,"comment":"null","endLoc":84,"header":"def get_scipy_special_helpers()","id":10409,"name":"get_scipy_special_helpers","nodeType":"Function","startLoc":66,"text":"def get_scipy_special_helpers():\n    import scipy.special as sps\n    SCIPY_HELPERS = {}\n    for name in dimensionless_to_dimensionless_sps_ufuncs:\n        # In SCIPY_LT_1_5, erfinv and erfcinv are not ufuncs.\n        ufunc = getattr(sps, name, None)\n        if isinstance(ufunc, np.ufunc):\n            SCIPY_HELPERS[ufunc] = helper_dimensionless_to_dimensionless\n\n    for ufunc in degree_to_dimensionless_sps_ufuncs:\n        SCIPY_HELPERS[getattr(sps, ufunc)] = helper_degree_to_dimensionless\n\n    for ufunc in two_arg_dimensionless_sps_ufuncs:\n        SCIPY_HELPERS[getattr(sps, ufunc)] = helper_two_arg_dimensionless\n\n    # ufuncs handled as special cases\n    SCIPY_HELPERS[sps.cbrt] = helper_cbrt\n    SCIPY_HELPERS[sps.radian] = helper_degree_minute_second_to_radian\n    return SCIPY_HELPERS"},{"attributeType":"null","col":8,"comment":"null","endLoc":27,"id":10410,"name":"UNSUPPORTED","nodeType":"Attribute","startLoc":27,"text":"self.UNSUPPORTED"},{"attributeType":"null","col":16,"comment":"null","endLoc":8,"id":10411,"name":"np","nodeType":"Attribute","startLoc":8,"text":"np"},{"col":0,"comment":"null","endLoc":166,"header":"def helper_degree_to_radian(f, unit)","id":10412,"name":"helper_degree_to_radian","nodeType":"Function","startLoc":159,"text":"def helper_degree_to_radian(f, unit):\n    from astropy.units.si import degree, radian\n    try:\n        return [get_converter(unit, degree)], radian\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":10413,"name":"dimensionless_to_dimensionless_sps_ufuncs","nodeType":"Attribute","startLoc":19,"text":"dimensionless_to_dimensionless_sps_ufuncs"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":10414,"name":"scipy_special_ufuncs","nodeType":"Attribute","startLoc":28,"text":"scipy_special_ufuncs"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":10415,"name":"degree_to_dimensionless_sps_ufuncs","nodeType":"Attribute","startLoc":30,"text":"degree_to_dimensionless_sps_ufuncs"},{"attributeType":"null","col":8,"comment":"null","endLoc":26,"id":10416,"name":"modules","nodeType":"Attribute","startLoc":26,"text":"self.modules"},{"attributeType":"null","col":0,"comment":"null","endLoc":36,"id":10417,"name":"two_arg_dimensionless_sps_ufuncs","nodeType":"Attribute","startLoc":36,"text":"two_arg_dimensionless_sps_ufuncs"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":10418,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"converters.py#<anonymous>","id":10419,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"Converters for Quantity.\"\"\"\n\n__all__ = ['can_have_arbitrary_unit', 'converters_and_unit',\n           'check_output', 'UFUNC_HELPERS', 'UNSUPPORTED_UFUNCS']\n\nUFUNC_HELPERS = UfuncHelpers()\n\nUNSUPPORTED_UFUNCS = UFUNC_HELPERS.UNSUPPORTED"},{"col":4,"comment":"null","endLoc":279,"header":"def __isub__(self, other)","id":10420,"name":"__isub__","nodeType":"Function","startLoc":273,"text":"def __isub__(self, other):\n        new_unit = self.unit - getattr(other, 'unit', dimensionless_unscaled)\n        # Do calculation in-place using _function_view of array.\n        function_view = self._function_view\n        function_view -= getattr(other, '_function_view', other)\n        self._set_unit(new_unit)\n        return self"},{"col":0,"comment":"","endLoc":7,"header":"scipy_special.py#<anonymous>","id":10421,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"Quantity helpers for the scipy.special ufuncs.\n\nAvailable ufuncs in this module are at\nhttps://docs.scipy.org/doc/scipy/reference/special.html\n\"\"\"\n\ndimensionless_to_dimensionless_sps_ufuncs = (\n    'erf', 'erfc', 'erfcx', 'erfi', 'erfinv', 'erfcinv',\n    'gamma', 'gammaln', 'loggamma', 'gammasgn', 'psi', 'rgamma', 'digamma',\n    'wofz', 'dawsn', 'entr', 'exprel', 'expm1', 'log1p', 'exp2', 'exp10',\n    'j0', 'j1', 'y0', 'y1', 'i0', 'i0e', 'i1', 'i1e',\n    'k0', 'k0e', 'k1', 'k1e', 'itj0y0', 'it2j0y0', 'iti0k0', 'it2i0k0',\n    'ndtr', 'ndtri')\n\nscipy_special_ufuncs = dimensionless_to_dimensionless_sps_ufuncs\n\ndegree_to_dimensionless_sps_ufuncs = ('cosdg', 'sindg', 'tandg', 'cotdg')\n\nscipy_special_ufuncs += degree_to_dimensionless_sps_ufuncs\n\ntwo_arg_dimensionless_sps_ufuncs = (\n    'jv', 'jn', 'jve', 'yn', 'yv', 'yve', 'kn', 'kv', 'kve', 'iv', 'ive',\n    'hankel1', 'hankel1e', 'hankel2', 'hankel2e')\n\nscipy_special_ufuncs += two_arg_dimensionless_sps_ufuncs\n\nscipy_special_ufuncs += ('cbrt', 'radian')\n\nUFUNC_HELPERS.register_module('scipy.special', scipy_special_ufuncs,\n                              get_scipy_special_helpers)"},{"col":4,"comment":"null","endLoc":290,"header":"def __mul__(self, other)","id":10422,"name":"__mul__","nodeType":"Function","startLoc":281,"text":"def __mul__(self, other):\n        # Multiply by a float or a dimensionless quantity\n        if isinstance(other, numbers.Number):\n            # Multiplying a log means putting the factor into the exponent\n            # of the unit\n            new_physical_unit = self.unit.physical_unit**other\n            result = self.view(np.ndarray) * other\n            return self._new_view(result, self.unit._copy(new_physical_unit))\n        else:\n            return super().__mul__(other)"},{"col":0,"comment":"null","endLoc":176,"header":"def helper_radian_to_degree(f, unit)","id":10423,"name":"helper_radian_to_degree","nodeType":"Function","startLoc":169,"text":"def helper_radian_to_degree(f, unit):\n    from astropy.units.si import degree, radian\n    try:\n        return [get_converter(unit, radian)], degree\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))"},{"fileName":"__init__.py","filePath":"astropy/units/quantity_helper","id":10424,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"Helper functions for Quantity.\n\nIn particular, this implements the logic that determines scaling and result\nunits for a given ufunc, given input units.\n\"\"\"\nfrom .converters import *\n# By importing helpers, all the unit conversion functions needed for\n# numpy ufuncs and functions are defined.\nfrom . import helpers, function_helpers\n# For scipy.special and erfa, importing the helper modules ensures\n# the definitions are added as modules to UFUNC_HELPERS, to be loaded\n# on demand.\nfrom . import scipy_special, erfa\n"},{"col":0,"comment":"","endLoc":6,"header":"__init__.py#<anonymous>","id":10425,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"Helper functions for Quantity.\n\nIn particular, this implements the logic that determines scaling and result\nunits for a given ufunc, given input units.\n\"\"\""},{"fileName":"function_helpers.py","filePath":"astropy/units/quantity_helper","id":10426,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license. See LICENSE.rst except\n# for parts explicitly labelled as being (largely) copies of numpy\n# implementations; for those, see licenses/NUMPY_LICENSE.rst.\n\"\"\"Helpers for overriding numpy functions.\n\nWe override numpy functions in `~astropy.units.Quantity.__array_function__`.\nIn this module, the numpy functions are split in four groups, each of\nwhich has an associated `set` or `dict`:\n\n1. SUBCLASS_SAFE_FUNCTIONS (set), if the numpy implementation\n   supports Quantity; we pass on to ndarray.__array_function__.\n2. FUNCTION_HELPERS (dict), if the numpy implementation is usable\n   after converting quantities to arrays with suitable units,\n   and possibly setting units on the result.\n3. DISPATCHED_FUNCTIONS (dict), if the function makes sense but\n   requires a Quantity-specific implementation\n4. UNSUPPORTED_FUNCTIONS (set), if the function does not make sense.\n\nFor the FUNCTION_HELPERS `dict`, the value is a function that does the\nunit conversion.  It should take the same arguments as the numpy\nfunction would (though one can use ``*args`` and ``**kwargs``) and\nreturn a tuple of ``args, kwargs, unit, out``, where ``args`` and\n``kwargs`` will be will be passed on to the numpy implementation,\n``unit`` is a possible unit of the result (`None` if it should not be\nconverted to Quantity), and ``out`` is a possible output Quantity passed\nin, which will be filled in-place.\n\nFor the DISPATCHED_FUNCTIONS `dict`, the value is a function that\nimplements the numpy functionality for Quantity input. It should\nreturn a tuple of ``result, unit, out``, where ``result`` is generally\na plain array with the result, and ``unit`` and ``out`` are as above.\nIf unit is `None`, result gets returned directly, so one can also\nreturn a Quantity directly using ``quantity_result, None, None``.\n\n\"\"\"\n\nimport functools\nimport operator\n\nimport numpy as np\nfrom numpy.lib import recfunctions as rfn\n\nfrom astropy.units.core import (\n    UnitsError, UnitTypeError, dimensionless_unscaled)\nfrom astropy.utils.compat import NUMPY_LT_1_20, NUMPY_LT_1_23\nfrom astropy.utils import isiterable\n\n# In 1.17, overrides are enabled by default, but it is still possible to\n# turn them off using an environment variable.  We use getattr since it\n# is planned to remove that possibility in later numpy versions.\nARRAY_FUNCTION_ENABLED = getattr(np.core.overrides,\n                                 'ENABLE_ARRAY_FUNCTION', True)\nSUBCLASS_SAFE_FUNCTIONS = set()\n\"\"\"Functions with implementations supporting subclasses like Quantity.\"\"\"\nFUNCTION_HELPERS = {}\n\"\"\"Functions with implementations usable with proper unit conversion.\"\"\"\nDISPATCHED_FUNCTIONS = {}\n\"\"\"Functions for which we provide our own implementation.\"\"\"\nUNSUPPORTED_FUNCTIONS = set()\n\"\"\"Functions that cannot sensibly be used with quantities.\"\"\"\n\nSUBCLASS_SAFE_FUNCTIONS |= {\n    np.shape, np.size, np.ndim,\n    np.reshape, np.ravel, np.moveaxis, np.rollaxis, np.swapaxes,\n    np.transpose, np.atleast_1d, np.atleast_2d, np.atleast_3d,\n    np.expand_dims, np.squeeze, np.broadcast_to, np.broadcast_arrays,\n    np.flip, np.fliplr, np.flipud, np.rot90,\n    np.argmin, np.argmax, np.argsort, np.lexsort, np.searchsorted,\n    np.nonzero, np.argwhere, np.flatnonzero,\n    np.diag_indices_from, np.triu_indices_from, np.tril_indices_from,\n    np.real, np.imag, np.diagonal, np.diagflat,\n    np.empty_like,\n    np.compress, np.extract, np.delete, np.trim_zeros, np.roll, np.take,\n    np.put, np.fill_diagonal, np.tile, np.repeat,\n    np.split, np.array_split, np.hsplit, np.vsplit, np.dsplit,\n    np.stack, np.column_stack, np.hstack, np.vstack, np.dstack,\n    np.amax, np.amin, np.ptp, np.sum, np.cumsum,\n    np.prod, np.product, np.cumprod, np.cumproduct,\n    np.round, np.around,\n    np.fix, np.angle, np.i0, np.clip,\n    np.isposinf, np.isneginf, np.isreal, np.iscomplex,\n    np.average, np.mean, np.std, np.var, np.median, np.trace,\n    np.nanmax, np.nanmin, np.nanargmin, np.nanargmax, np.nanmean,\n    np.nanmedian, np.nansum, np.nancumsum, np.nanstd, np.nanvar,\n    np.nanprod, np.nancumprod,\n    np.einsum_path, np.trapz, np.linspace,\n    np.sort, np.msort, np.partition, np.meshgrid,\n    np.common_type, np.result_type, np.can_cast, np.min_scalar_type,\n    np.iscomplexobj, np.isrealobj,\n    np.shares_memory, np.may_share_memory,\n    np.apply_along_axis, np.take_along_axis, np.put_along_axis,\n    np.linalg.cond, np.linalg.multi_dot}\n\n# Implemented as methods on Quantity:\n# np.ediff1d is from setops, but we support it anyway; the others\n# currently return NotImplementedError.\n# TODO: move latter to UNSUPPORTED? Would raise TypeError instead.\nSUBCLASS_SAFE_FUNCTIONS |= {np.ediff1d}\n\n# Nonsensical for quantities.\nUNSUPPORTED_FUNCTIONS |= {\n    np.packbits, np.unpackbits, np.unravel_index,\n    np.ravel_multi_index, np.ix_, np.cov, np.corrcoef,\n    np.busday_count, np.busday_offset, np.datetime_as_string,\n    np.is_busday, np.all, np.any, np.sometrue, np.alltrue}\n\n# Could be supported if we had a natural logarithm unit.\nUNSUPPORTED_FUNCTIONS |= {np.linalg.slogdet}\n\n# TODO! support whichever of these functions it makes sense to support\nTBD_FUNCTIONS = {\n    rfn.drop_fields, rfn.rename_fields, rfn.append_fields, rfn.join_by,\n    rfn.apply_along_fields, rfn.assign_fields_by_name, rfn.merge_arrays,\n    rfn.find_duplicates, rfn.recursive_fill_fields, rfn.require_fields,\n    rfn.repack_fields, rfn.stack_arrays\n}\nUNSUPPORTED_FUNCTIONS |= TBD_FUNCTIONS\n\n# The following are not just unsupported, but so unlikely to be thought\n# to be supported that we ignore them in testing.  (Kept in a separate\n# variable so that we can check consistency in the test routine -\n# test_quantity_non_ufuncs.py)\nIGNORED_FUNCTIONS = {\n    # I/O - useless for Quantity, since no way to store the unit.\n    np.save, np.savez, np.savetxt, np.savez_compressed,\n    # Polynomials\n    np.poly, np.polyadd, np.polyder, np.polydiv, np.polyfit, np.polyint,\n    np.polymul, np.polysub, np.polyval, np.roots, np.vander,\n    # functions taking record arrays (which are deprecated)\n    rfn.rec_append_fields, rfn.rec_drop_fields, rfn.rec_join,\n}\nif NUMPY_LT_1_20:\n    # financial\n    IGNORED_FUNCTIONS |= {np.fv, np.ipmt, np.irr, np.mirr, np.nper,\n                          np.npv, np.pmt, np.ppmt, np.pv, np.rate}\nif NUMPY_LT_1_23:\n    IGNORED_FUNCTIONS |= {\n        # Deprecated, removed in numpy 1.23\n        np.asscalar, np.alen,\n    }\nUNSUPPORTED_FUNCTIONS |= IGNORED_FUNCTIONS\n\n\nclass FunctionAssigner:\n    def __init__(self, assignments):\n        self.assignments = assignments\n\n    def __call__(self, f=None, helps=None, module=np):\n        \"\"\"Add a helper to a numpy function.\n\n        Normally used as a decorator.\n\n        If ``helps`` is given, it should be the numpy function helped (or an\n        iterable of numpy functions helped).\n\n        If ``helps`` is not given, it is assumed the function helped is the\n        numpy function with the same name as the decorated function.\n        \"\"\"\n        if f is not None:\n            if helps is None:\n                helps = getattr(module, f.__name__)\n            if not isiterable(helps):\n                helps = (helps,)\n            for h in helps:\n                self.assignments[h] = f\n            return f\n        elif helps is not None or module is not np:\n            return functools.partial(self.__call__, helps=helps, module=module)\n        else:  # pragma: no cover\n            raise ValueError(\"function_helper requires at least one argument.\")\n\n\nfunction_helper = FunctionAssigner(FUNCTION_HELPERS)\n\ndispatched_function = FunctionAssigner(DISPATCHED_FUNCTIONS)\n\n\n@function_helper(helps={\n    np.copy, np.asfarray, np.real_if_close, np.sort_complex, np.resize,\n    np.fft.fft, np.fft.ifft, np.fft.rfft, np.fft.irfft,\n    np.fft.fft2, np.fft.ifft2, np.fft.rfft2, np.fft.irfft2,\n    np.fft.fftn, np.fft.ifftn, np.fft.rfftn, np.fft.irfftn,\n    np.fft.hfft, np.fft.ihfft,\n    np.linalg.eigvals, np.linalg.eigvalsh})\ndef invariant_a_helper(a, *args, **kwargs):\n    return (a.view(np.ndarray),) + args, kwargs, a.unit, None\n\n\n@function_helper(helps={np.tril, np.triu})\ndef invariant_m_helper(m, *args, **kwargs):\n    return (m.view(np.ndarray),) + args, kwargs, m.unit, None\n\n\n@function_helper(helps={np.fft.fftshift, np.fft.ifftshift})\ndef invariant_x_helper(x, *args, **kwargs):\n    return (x.view(np.ndarray),) + args, kwargs, x.unit, None\n\n\n# Note that ones_like does *not* work by default since if one creates an empty\n# array with a unit, one cannot just fill it with unity.  Indeed, in this\n# respect, it is a bit of an odd function for Quantity. On the other hand, it\n# matches the idea that a unit is the same as the quantity with that unit and\n# value of 1. Also, it used to work without __array_function__.\n# zeros_like does work by default for regular quantities, because numpy first\n# creates an empty array with the unit and then fills it with 0 (which can have\n# any unit), but for structured dtype this fails (0 cannot have an arbitrary\n# structured unit), so we include it here too.\n@function_helper(helps={np.ones_like, np.zeros_like})\ndef like_helper(a, *args, **kwargs):\n    subok = args[2] if len(args) > 2 else kwargs.pop('subok', True)\n    unit = a.unit if subok else None\n    return (a.view(np.ndarray),) + args, kwargs, unit, None\n\n\n@function_helper\ndef sinc(x):\n    from astropy.units.si import radian\n    try:\n        x = x.to_value(radian)\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply 'sinc' function to \"\n                            \"quantities with angle units\")\n    return (x,), {}, dimensionless_unscaled, None\n\n\n@dispatched_function\ndef unwrap(p, discont=None, axis=-1):\n    from astropy.units.si import radian\n    if discont is None:\n        discont = np.pi << radian\n\n    p, discont = _as_quantities(p, discont)\n    result = np.unwrap.__wrapped__(p.to_value(radian),\n                                   discont.to_value(radian), axis=axis)\n    result = radian.to(p.unit, result)\n    return result, p.unit, None\n\n\n@function_helper\ndef argpartition(a, *args, **kwargs):\n    return (a.view(np.ndarray),) + args, kwargs, None, None\n\n\n@function_helper\ndef full_like(a, fill_value, *args, **kwargs):\n    unit = a.unit if kwargs.get('subok', True) else None\n    return (a.view(np.ndarray),\n            a._to_own_unit(fill_value)) + args, kwargs, unit, None\n\n\n@function_helper\ndef putmask(a, mask, values):\n    from astropy.units import Quantity\n    if isinstance(a, Quantity):\n        return (a.view(np.ndarray), mask,\n                a._to_own_unit(values)), {}, a.unit, None\n    elif isinstance(values, Quantity):\n        return (a, mask,\n                values.to_value(dimensionless_unscaled)), {}, None, None\n    else:\n        raise NotImplementedError\n\n\n@function_helper\ndef place(arr, mask, vals):\n    from astropy.units import Quantity\n    if isinstance(arr, Quantity):\n        return (arr.view(np.ndarray), mask,\n                arr._to_own_unit(vals)), {}, arr.unit, None\n    elif isinstance(vals, Quantity):\n        return (arr, mask,\n                vals.to_value(dimensionless_unscaled)), {}, None, None\n    else:\n        raise NotImplementedError\n\n\n@function_helper\ndef copyto(dst, src, *args, **kwargs):\n    from astropy.units import Quantity\n    if isinstance(dst, Quantity):\n        return ((dst.view(np.ndarray), dst._to_own_unit(src)) + args,\n                kwargs, None, None)\n    elif isinstance(src, Quantity):\n        return ((dst,  src.to_value(dimensionless_unscaled)) + args,\n                kwargs, None, None)\n    else:\n        raise NotImplementedError\n\n\n@function_helper\ndef nan_to_num(x, copy=True, nan=0.0, posinf=None, neginf=None):\n    nan = x._to_own_unit(nan)\n    if posinf is not None:\n        posinf = x._to_own_unit(posinf)\n    if neginf is not None:\n        neginf = x._to_own_unit(neginf)\n    return ((x.view(np.ndarray),),\n            dict(copy=True, nan=nan, posinf=posinf, neginf=neginf),\n            x.unit, None)\n\n\ndef _as_quantity(a):\n    \"\"\"Convert argument to a Quantity (or raise NotImplementedError).\"\"\"\n    from astropy.units import Quantity\n\n    try:\n        return Quantity(a, copy=False, subok=True)\n    except Exception:\n        # If we cannot convert to Quantity, we should just bail.\n        raise NotImplementedError\n\n\ndef _as_quantities(*args):\n    \"\"\"Convert arguments to Quantity (or raise NotImplentedError).\"\"\"\n    from astropy.units import Quantity\n\n    try:\n        return tuple(Quantity(a, copy=False, subok=True)\n                     for a in args)\n    except Exception:\n        # If we cannot convert to Quantity, we should just bail.\n        raise NotImplementedError\n\n\ndef _quantities2arrays(*args, unit_from_first=False):\n    \"\"\"Convert to arrays in units of the first argument that has a unit.\n\n    If unit_from_first, take the unit of the first argument regardless\n    whether it actually defined a unit (e.g., dimensionless for arrays).\n    \"\"\"\n\n    # Turn first argument into a quantity.\n    q = _as_quantity(args[0])\n    if len(args) == 1:\n        return (q.value,), q.unit\n\n    # If we care about the unit being explicit, then check whether this\n    # argument actually had a unit, or was likely inferred.\n    if not unit_from_first and (q.unit is q._default_unit\n                                and not hasattr(args[0], 'unit')):\n        # Here, the argument could still be things like [10*u.one, 11.*u.one]),\n        # i.e., properly dimensionless.  So, we only override with anything\n        # that has a unit not equivalent to dimensionless (fine to ignore other\n        # dimensionless units pass, even if explicitly given).\n        for arg in args[1:]:\n            trial = _as_quantity(arg)\n            if not trial.unit.is_equivalent(q.unit):\n                # Use any explicit unit not equivalent to dimensionless.\n                q = trial\n                break\n\n    # We use the private _to_own_unit method here instead of just\n    # converting everything to quantity and then do .to_value(qs0.unit)\n    # as we want to allow arbitrary unit for 0, inf, and nan.\n    try:\n        arrays = tuple((q._to_own_unit(arg)) for arg in args)\n    except TypeError:\n        raise NotImplementedError\n\n    return arrays, q.unit\n\n\ndef _iterable_helper(*args, out=None, **kwargs):\n    \"\"\"Convert arguments to Quantity, and treat possible 'out'.\"\"\"\n    from astropy.units import Quantity\n\n    if out is not None:\n        if isinstance(out, Quantity):\n            kwargs['out'] = out.view(np.ndarray)\n        else:\n            # TODO: for an ndarray output, we could in principle\n            # try converting all Quantity to dimensionless.\n            raise NotImplementedError\n\n    arrays, unit = _quantities2arrays(*args)\n    return arrays, kwargs, unit, out\n\n\n@function_helper\ndef concatenate(arrays, axis=0, out=None):\n    # TODO: make this smarter by creating an appropriately shaped\n    # empty output array and just filling it.\n    arrays, kwargs, unit, out = _iterable_helper(*arrays, out=out, axis=axis)\n    return (arrays,), kwargs, unit, out\n\n\n@dispatched_function\ndef block(arrays):\n    # We need to override block since the numpy implementation can take two\n    # different paths, one for concatenation, one for creating a large empty\n    # result array in which parts are set.  Each assumes array input and\n    # cannot be used directly.  Since it would be very costly to inspect all\n    # arrays and then turn them back into a nested list, we just copy here the\n    # second implementation, np.core.shape_base._block_slicing, since it is\n    # shortest and easiest.\n    (arrays, list_ndim, result_ndim,\n     final_size) = np.core.shape_base._block_setup(arrays)\n    shape, slices, arrays = np.core.shape_base._block_info_recursion(\n        arrays, list_ndim, result_ndim)\n    # Here, one line of difference!\n    arrays, unit = _quantities2arrays(*arrays)\n    # Back to _block_slicing\n    dtype = np.result_type(*[arr.dtype for arr in arrays])\n    F_order = all(arr.flags['F_CONTIGUOUS'] for arr in arrays)\n    C_order = all(arr.flags['C_CONTIGUOUS'] for arr in arrays)\n    order = 'F' if F_order and not C_order else 'C'\n    result = np.empty(shape=shape, dtype=dtype, order=order)\n    for the_slice, arr in zip(slices, arrays):\n        result[(Ellipsis,) + the_slice] = arr\n    return result, unit, None\n\n\n@function_helper\ndef choose(a, choices, out=None, **kwargs):\n    choices, kwargs, unit, out = _iterable_helper(*choices, out=out, **kwargs)\n    return (a, choices,), kwargs, unit, out\n\n\n@function_helper\ndef select(condlist, choicelist, default=0):\n    choicelist, kwargs, unit, out = _iterable_helper(*choicelist)\n    if default != 0:\n        default = (1 * unit)._to_own_unit(default)\n    return (condlist, choicelist, default), kwargs, unit, out\n\n\n@dispatched_function\ndef piecewise(x, condlist, funclist, *args, **kw):\n    from astropy.units import Quantity\n\n    # Copied implementation from numpy.lib.function_base.piecewise,\n    # taking care of units of function outputs.\n    n2 = len(funclist)\n    # undocumented: single condition is promoted to a list of one condition\n    if np.isscalar(condlist) or (\n            not isinstance(condlist[0], (list, np.ndarray)) and x.ndim != 0):\n        condlist = [condlist]\n\n    if any(isinstance(c, Quantity) for c in condlist):\n        raise NotImplementedError\n\n    condlist = np.array(condlist, dtype=bool)\n    n = len(condlist)\n\n    if n == n2 - 1:  # compute the \"otherwise\" condition.\n        condelse = ~np.any(condlist, axis=0, keepdims=True)\n        condlist = np.concatenate([condlist, condelse], axis=0)\n        n += 1\n    elif n != n2:\n        raise ValueError(\n            f\"with {n} condition(s), either {n} or {n + 1} functions are expected\"\n        )\n\n    y = np.zeros(x.shape, x.dtype)\n    where = []\n    what = []\n    for k in range(n):\n        item = funclist[k]\n        if not callable(item):\n            where.append(condlist[k])\n            what.append(item)\n        else:\n            vals = x[condlist[k]]\n            if vals.size > 0:\n                where.append(condlist[k])\n                what.append(item(vals, *args, **kw))\n\n    what, unit = _quantities2arrays(*what)\n    for item, value in zip(where, what):\n        y[item] = value\n\n    return y, unit, None\n\n\n@function_helper\ndef append(arr, values, *args, **kwargs):\n    arrays, unit = _quantities2arrays(arr, values, unit_from_first=True)\n    return arrays + args, kwargs, unit, None\n\n\n@function_helper\ndef insert(arr, obj, values, *args, **kwargs):\n    from astropy.units import Quantity\n\n    if isinstance(obj, Quantity):\n        raise NotImplementedError\n\n    (arr, values), unit = _quantities2arrays(arr, values,\n                                             unit_from_first=True)\n    return (arr, obj, values) + args, kwargs, unit, None\n\n\n@function_helper\ndef pad(array, pad_width, mode='constant', **kwargs):\n    # pad dispatches only on array, so that must be a Quantity.\n    for key in 'constant_values', 'end_values':\n        value = kwargs.pop(key, None)\n        if value is None:\n            continue\n        if not isinstance(value, tuple):\n            value = (value,)\n\n        new_value = []\n        for v in value:\n            new_value.append(\n                tuple(array._to_own_unit(_v) for _v in v)\n                if isinstance(v, tuple) else array._to_own_unit(v))\n        kwargs[key] = new_value\n\n    return (array.view(np.ndarray), pad_width, mode), kwargs, array.unit, None\n\n\n@function_helper\ndef where(condition, *args):\n    from astropy.units import Quantity\n    if isinstance(condition, Quantity) or len(args) != 2:\n        raise NotImplementedError\n\n    args, unit = _quantities2arrays(*args)\n    return (condition,) + args, {}, unit, None\n\n\n@function_helper(helps=({np.quantile, np.nanquantile}))\ndef quantile(a, q, *args, _q_unit=dimensionless_unscaled, **kwargs):\n    if len(args) >= 2:\n        out = args[1]\n        args = args[:1] + args[2:]\n    else:\n        out = kwargs.pop('out', None)\n\n    from astropy.units import Quantity\n    if isinstance(q, Quantity):\n        q = q.to_value(_q_unit)\n\n    (a,), kwargs, unit, out = _iterable_helper(a, out=out, **kwargs)\n\n    return (a, q) + args, kwargs, unit, out\n\n\n@function_helper(helps={np.percentile, np.nanpercentile})\ndef percentile(a, q, *args, **kwargs):\n    from astropy.units import percent\n    return quantile(a, q, *args, _q_unit=percent, **kwargs)\n\n\n@function_helper\ndef count_nonzero(a, *args, **kwargs):\n    return (a.value,) + args, kwargs, None, None\n\n\n@function_helper(helps={np.isclose, np.allclose})\ndef close(a, b, rtol=1e-05, atol=1e-08, *args, **kwargs):\n    from astropy.units import Quantity\n\n    (a, b), unit = _quantities2arrays(a, b, unit_from_first=True)\n    # Allow number without a unit as having the unit.\n    atol = Quantity(atol, unit).value\n\n    return (a, b, rtol, atol) + args, kwargs, None, None\n\n\n@function_helper\ndef array_equal(a1, a2):\n    args, unit = _quantities2arrays(a1, a2)\n    return args, {}, None, None\n\n\n@function_helper\ndef array_equiv(a1, a2):\n    args, unit = _quantities2arrays(a1, a2)\n    return args, {}, None, None\n\n\n@function_helper(helps={np.dot, np.outer})\ndef dot_like(a, b, out=None):\n    from astropy.units import Quantity\n\n    a, b = _as_quantities(a, b)\n    unit = a.unit * b.unit\n    if out is not None:\n        if not isinstance(out, Quantity):\n            raise NotImplementedError\n        return tuple(x.view(np.ndarray) for x in (a, b, out)), {}, unit, out\n    else:\n        return (a.view(np.ndarray), b.view(np.ndarray)), {}, unit, None\n\n\n@function_helper(helps={np.cross, np.inner, np.vdot, np.tensordot, np.kron,\n                        np.correlate, np.convolve})\ndef cross_like(a, b, *args, **kwargs):\n    a, b = _as_quantities(a, b)\n    unit = a.unit * b.unit\n    return (a.view(np.ndarray), b.view(np.ndarray)) + args, kwargs, unit, None\n\n\n@function_helper\ndef einsum(subscripts, *operands, out=None, **kwargs):\n    from astropy.units import Quantity\n\n    if not isinstance(subscripts, str):\n        raise ValueError('only \"subscripts\" string mode supported for einsum.')\n\n    if out is not None:\n        if not isinstance(out, Quantity):\n            raise NotImplementedError\n\n        else:\n            kwargs['out'] = out.view(np.ndarray)\n\n    qs = _as_quantities(*operands)\n    unit = functools.reduce(operator.mul, (q.unit for q in qs),\n                            dimensionless_unscaled)\n    arrays = tuple(q.view(np.ndarray) for q in qs)\n    return (subscripts,) + arrays, kwargs, unit, out\n\n\n@function_helper\ndef bincount(x, weights=None, minlength=0):\n    from astropy.units import Quantity\n    if isinstance(x, Quantity):\n        raise NotImplementedError\n    return (x, weights.value, minlength), {}, weights.unit, None\n\n\n@function_helper\ndef digitize(x, bins, *args, **kwargs):\n    arrays, unit = _quantities2arrays(x, bins, unit_from_first=True)\n    return arrays + args, kwargs, None, None\n\n\ndef _check_bins(bins, unit):\n    from astropy.units import Quantity\n\n    check = _as_quantity(bins)\n    if check.ndim > 0:\n        return check.to_value(unit)\n    elif isinstance(bins, Quantity):\n        # bins should be an integer (or at least definitely not a Quantity).\n        raise NotImplementedError\n    else:\n        return bins\n\n\n@function_helper\ndef histogram(a, bins=10, range=None, weights=None, density=None):\n    if weights is not None:\n        weights = _as_quantity(weights)\n        unit = weights.unit\n        weights = weights.value\n    else:\n        unit = None\n\n    a = _as_quantity(a)\n    if not isinstance(bins, str):\n        bins = _check_bins(bins, a.unit)\n\n    if density:\n        unit = (unit or 1) / a.unit\n\n    return ((a.value, bins, range), {'weights': weights, 'density': density},\n            (unit, a.unit), None)\n\n\n@function_helper(helps=np.histogram_bin_edges)\ndef histogram_bin_edges(a, bins=10, range=None, weights=None):\n    # weights is currently unused\n    a = _as_quantity(a)\n    if not isinstance(bins, str):\n        bins = _check_bins(bins, a.unit)\n\n    return (a.value, bins, range, weights), {}, a.unit, None\n\n\n@function_helper\ndef histogram2d(x, y, bins=10, range=None, weights=None, density=None):\n    from astropy.units import Quantity\n\n    if weights is not None:\n        weights = _as_quantity(weights)\n        unit = weights.unit\n        weights = weights.value\n    else:\n        unit = None\n\n    x, y = _as_quantities(x, y)\n    try:\n        n = len(bins)\n    except TypeError:\n        # bins should be an integer (or at least definitely not a Quantity).\n        if isinstance(bins, Quantity):\n            raise NotImplementedError\n\n    else:\n        if n == 1:\n            raise NotImplementedError\n        elif n == 2 and not isinstance(bins, Quantity):\n            bins = [_check_bins(b, unit)\n                    for (b, unit) in zip(bins, (x.unit, y.unit))]\n        else:\n            bins = _check_bins(bins, x.unit)\n            y = y.to(x.unit)\n\n    if density:\n        unit = (unit or 1) / x.unit / y.unit\n\n    return ((x.value, y.value, bins, range),\n            {'weights': weights, 'density': density},\n            (unit, x.unit, y.unit), None)\n\n\n@function_helper\ndef histogramdd(sample, bins=10, range=None, weights=None, density=None):\n    if weights is not None:\n        weights = _as_quantity(weights)\n        unit = weights.unit\n        weights = weights.value\n    else:\n        unit = None\n\n    try:\n        # Sample is an ND-array.\n        _, D = sample.shape\n    except (AttributeError, ValueError):\n        # Sample is a sequence of 1D arrays.\n        sample = _as_quantities(*sample)\n        sample_units = [s.unit for s in sample]\n        sample = [s.value for s in sample]\n        D = len(sample)\n    else:\n        sample = _as_quantity(sample)\n        sample_units = [sample.unit] * D\n\n    try:\n        M = len(bins)\n    except TypeError:\n        # bins should be an integer\n        from astropy.units import Quantity\n\n        if isinstance(bins, Quantity):\n            raise NotImplementedError\n    else:\n        if M != D:\n            raise ValueError(\n                'The dimension of bins must be equal to the dimension of the '\n                ' sample x.')\n        bins = [_check_bins(b, unit)\n                for (b, unit) in zip(bins, sample_units)]\n\n    if density:\n        unit = functools.reduce(operator.truediv, sample_units, (unit or 1))\n\n    return ((sample, bins, range), {'weights': weights, 'density': density},\n            (unit, sample_units), None)\n\n\n@function_helper\ndef diff(a, n=1, axis=-1, prepend=np._NoValue, append=np._NoValue):\n    a = _as_quantity(a)\n    if prepend is not np._NoValue:\n        prepend = _as_quantity(prepend).to_value(a.unit)\n    if append is not np._NoValue:\n        append = _as_quantity(append).to_value(a.unit)\n    return (a.value, n, axis, prepend, append), {}, a.unit, None\n\n\n@function_helper\ndef gradient(f, *varargs, **kwargs):\n    f = _as_quantity(f)\n    axis = kwargs.get('axis', None)\n    if axis is None:\n        n_axis = f.ndim\n    elif isinstance(axis, tuple):\n        n_axis = len(axis)\n    else:\n        n_axis = 1\n\n    if varargs:\n        varargs = _as_quantities(*varargs)\n        if len(varargs) == 1 and n_axis > 1:\n            varargs = varargs * n_axis\n\n    if varargs:\n        units = [f.unit / q.unit for q in varargs]\n        varargs = tuple(q.value for q in varargs)\n    else:\n        units = [f.unit] * n_axis\n\n    if len(units) == 1:\n        units = units[0]\n\n    return (f.value,) + varargs, kwargs, units, None\n\n\n@function_helper\ndef logspace(start, stop, *args, **kwargs):\n    from astropy.units import LogQuantity, dex\n    if (not isinstance(start, LogQuantity) or\n            not isinstance(stop, LogQuantity)):\n        raise NotImplementedError\n\n    # Get unit from end point as for linspace.\n    stop = stop.to(dex(stop.unit.physical_unit))\n    start = start.to(stop.unit)\n    unit = stop.unit.physical_unit\n    return (start.value, stop.value) + args, kwargs, unit, None\n\n\n@function_helper\ndef geomspace(start, stop, *args, **kwargs):\n    # Get unit from end point as for linspace.\n    (stop, start), unit = _quantities2arrays(stop, start)\n    return (start, stop) + args, kwargs, unit, None\n\n\n@function_helper\ndef interp(x, xp, fp, *args, **kwargs):\n    from astropy.units import Quantity\n\n    (x, xp), _ = _quantities2arrays(x, xp)\n    if isinstance(fp, Quantity):\n        unit = fp.unit\n        fp = fp.value\n    else:\n        unit = None\n\n    return (x, xp, fp) + args, kwargs, unit, None\n\n\n@function_helper\ndef unique(ar, return_index=False, return_inverse=False,\n           return_counts=False, axis=None):\n    unit = ar.unit\n    n_index = sum(bool(i) for i in\n                  (return_index, return_inverse, return_counts))\n    if n_index:\n        unit = [unit] + n_index * [None]\n\n    return (ar.value, return_index, return_inverse, return_counts,\n            axis), {}, unit, None\n\n\n@function_helper\ndef intersect1d(ar1, ar2, assume_unique=False, return_indices=False):\n    (ar1, ar2), unit = _quantities2arrays(ar1, ar2)\n    if return_indices:\n        unit = [unit, None, None]\n    return (ar1, ar2, assume_unique, return_indices), {}, unit, None\n\n\n@function_helper(helps=(np.setxor1d, np.union1d, np.setdiff1d))\ndef twosetop(ar1, ar2, *args, **kwargs):\n    (ar1, ar2), unit = _quantities2arrays(ar1, ar2)\n    return (ar1, ar2) + args, kwargs, unit, None\n\n\n@function_helper(helps=(np.isin, np.in1d))\ndef setcheckop(ar1, ar2, *args, **kwargs):\n    # This tests whether ar1 is in ar2, so we should change the unit of\n    # a1 to that of a2.\n    (ar2, ar1), unit = _quantities2arrays(ar2, ar1)\n    return (ar1, ar2) + args, kwargs, None, None\n\n\n@dispatched_function\ndef apply_over_axes(func, a, axes):\n    # Copied straight from numpy/lib/shape_base, just to omit its\n    # val = asarray(a); if only it had been asanyarray, or just not there\n    # since a is assumed to an an array in the next line...\n    # Which is what we do here - we can only get here if it is a Quantity.\n    val = a\n    N = a.ndim\n    if np.array(axes).ndim == 0:\n        axes = (axes,)\n    for axis in axes:\n        if axis < 0:\n            axis = N + axis\n        args = (val, axis)\n        res = func(*args)\n        if res.ndim == val.ndim:\n            val = res\n        else:\n            res = np.expand_dims(res, axis)\n            if res.ndim == val.ndim:\n                val = res\n            else:\n                raise ValueError(\"function is not returning \"\n                                 \"an array of the correct shape\")\n    # Returning unit is None to signal nothing should happen to\n    # the output.\n    return val, None, None\n\n\n@dispatched_function\ndef array_repr(arr, *args, **kwargs):\n    # TODO: The addition of \"unit='...'\" doesn't worry about line\n    # length.  Could copy & adapt _array_repr_implementation from\n    # numpy.core.arrayprint.py\n    cls_name = arr.__class__.__name__\n    fake_name = '_' * len(cls_name)\n    fake_cls = type(fake_name, (np.ndarray,), {})\n    no_unit = np.array_repr(arr.view(fake_cls),\n                            *args, **kwargs).replace(fake_name, cls_name)\n    unit_part = f\"unit='{arr.unit}'\"\n    pre, dtype, post = no_unit.rpartition('dtype')\n    if dtype:\n        return f\"{pre}{unit_part}, {dtype}{post}\", None, None\n    else:\n        return f\"{no_unit[:-1]}, {unit_part})\", None, None\n\n\n@dispatched_function\ndef array_str(arr, *args, **kwargs):\n    # TODO: The addition of the unit doesn't worry about line length.\n    # Could copy & adapt _array_repr_implementation from\n    # numpy.core.arrayprint.py\n    no_unit = np.array_str(arr.value, *args, **kwargs)\n    return no_unit + arr._unitstr, None, None\n\n\n@function_helper\ndef array2string(a, *args, **kwargs):\n    # array2string breaks on quantities as it tries to turn individual\n    # items into float, which works only for dimensionless.  Since the\n    # defaults would not keep any unit anyway, this is rather pointless -\n    # we're better off just passing on the array view.  However, one can\n    # also work around this by passing on a formatter (as is done in Angle).\n    # So, we do nothing if the formatter argument is present and has the\n    # relevant formatter for our dtype.\n    formatter = args[6] if len(args) >= 7 else kwargs.get('formatter', None)\n\n    if formatter is None:\n        a = a.value\n    else:\n        # See whether it covers our dtype.\n        from numpy.core.arrayprint import _get_format_function\n\n        with np.printoptions(formatter=formatter) as options:\n            try:\n                ff = _get_format_function(a.value, **options)\n            except Exception:\n                # Shouldn't happen, but possibly we're just not being smart\n                # enough, so let's pass things on as is.\n                pass\n            else:\n                # If the selected format function is that of numpy, we know\n                # things will fail\n                if 'numpy' in ff.__module__:\n                    a = a.value\n\n    return (a,) + args, kwargs, None, None\n\n\n@function_helper\ndef diag(v, *args, **kwargs):\n    # Function works for *getting* the diagonal, but not *setting*.\n    # So, override always.\n    return (v.value,) + args, kwargs, v.unit, None\n\n\n@function_helper(module=np.linalg)\ndef svd(a, full_matrices=True, compute_uv=True, hermitian=False):\n    unit = a.unit\n    if compute_uv:\n        unit = (None, unit, None)\n\n    return ((a.view(np.ndarray), full_matrices, compute_uv, hermitian),\n            {}, unit, None)\n\n\ndef _interpret_tol(tol, unit):\n    from astropy.units import Quantity\n\n    return Quantity(tol, unit).value\n\n\n@function_helper(module=np.linalg)\ndef matrix_rank(M, tol=None, *args, **kwargs):\n    if tol is not None:\n        tol = _interpret_tol(tol, M.unit)\n\n    return (M.view(np.ndarray), tol) + args, kwargs, None, None\n\n\n@function_helper(helps={np.linalg.inv, np.linalg.tensorinv})\ndef inv(a, *args, **kwargs):\n    return (a.view(np.ndarray),)+args, kwargs, 1/a.unit, None\n\n\n@function_helper(module=np.linalg)\ndef pinv(a, rcond=1e-15, *args, **kwargs):\n    rcond = _interpret_tol(rcond, a.unit)\n\n    return (a.view(np.ndarray), rcond) + args, kwargs, 1/a.unit, None\n\n\n@function_helper(module=np.linalg)\ndef det(a):\n    return (a.view(np.ndarray),), {}, a.unit ** a.shape[-1], None\n\n\n@function_helper(helps={np.linalg.solve, np.linalg.tensorsolve})\ndef solve(a, b, *args, **kwargs):\n    a, b = _as_quantities(a, b)\n\n    return ((a.view(np.ndarray), b.view(np.ndarray)) + args, kwargs,\n            b.unit / a.unit, None)\n\n\n@function_helper(module=np.linalg)\ndef lstsq(a, b, rcond=\"warn\"):\n    a, b = _as_quantities(a, b)\n\n    if rcond not in (None, \"warn\", -1):\n        rcond = _interpret_tol(rcond, a.unit)\n\n    return ((a.view(np.ndarray), b.view(np.ndarray), rcond), {},\n            (b.unit / a.unit, b.unit ** 2, None, a.unit), None)\n\n\n@function_helper(module=np.linalg)\ndef norm(x, ord=None, *args, **kwargs):\n    if ord == 0:\n        from astropy.units import dimensionless_unscaled\n\n        unit = dimensionless_unscaled\n    else:\n        unit = x.unit\n    return (x.view(np.ndarray), ord)+args, kwargs, unit, None\n\n\n@function_helper(module=np.linalg)\ndef matrix_power(a, n):\n    return (a.value, n), {}, a.unit ** n, None\n\n\n@function_helper(module=np.linalg)\ndef cholesky(a):\n    return (a.value,), {}, a.unit ** 0.5, None\n\n\n@function_helper(module=np.linalg)\ndef qr(a, mode='reduced'):\n    if mode.startswith('e'):\n        units = None\n    elif mode == 'r':\n        units = a.unit\n    else:\n        from astropy.units import dimensionless_unscaled\n        units = (dimensionless_unscaled, a.unit)\n\n    return (a.value, mode), {}, units, None\n\n\n@function_helper(helps={np.linalg.eig, np.linalg.eigh})\ndef eig(a, *args, **kwargs):\n    from astropy.units import dimensionless_unscaled\n\n    return (a.value,)+args, kwargs, (a.unit, dimensionless_unscaled), None\n\n\n@function_helper(module=np.lib.recfunctions)\ndef structured_to_unstructured(arr, *args, **kwargs):\n    \"\"\"\n    Convert a structured quantity to an unstructured one.\n    This only works if all the units are compatible.\n\n    \"\"\"\n    from astropy.units import StructuredUnit\n\n    target_unit = arr.unit.values()[0]\n\n    def replace_unit(x):\n        if isinstance(x, StructuredUnit):\n            return x._recursively_apply(replace_unit)\n        else:\n            return target_unit\n\n    to_unit = arr.unit._recursively_apply(replace_unit)\n    return (arr.to_value(to_unit), ) + args, kwargs, target_unit, None\n\n\ndef _build_structured_unit(dtype, unit):\n    \"\"\"Build structured unit from dtype\n\n    Parameters\n    ----------\n    dtype : `numpy.dtype`\n    unit : `astropy.units.Unit`\n\n    Returns\n    -------\n    `astropy.units.Unit` or tuple\n    \"\"\"\n    if dtype.fields is None:\n        return unit\n\n    return tuple(_build_structured_unit(v[0], unit) for v in dtype.fields.values())\n\n\n@function_helper(module=np.lib.recfunctions)\ndef unstructured_to_structured(arr, dtype, *args, **kwargs):\n    from astropy.units import StructuredUnit\n\n    target_unit = StructuredUnit(_build_structured_unit(dtype, arr.unit))\n\n    return (arr.to_value(arr.unit), dtype) + args, kwargs, target_unit, None\n"},{"col":0,"comment":"null","endLoc":38,"header":"def check_structured_unit(unit, dtype)","id":10427,"name":"check_structured_unit","nodeType":"Function","startLoc":33,"text":"def check_structured_unit(unit, dtype):\n    if not has_matching_structure(unit, dtype):\n        msg = {dt_pv: 'pv',\n               dt_eraLDBODY: 'ldbody',\n               dt_eraASTROM: 'astrom'}.get(dtype, 'function')\n        raise UnitTypeError(f'{msg} input needs unit matching dtype={dtype}.')"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":10428,"name":"NUMPY_LT_1_20","nodeType":"Attribute","startLoc":17,"text":"NUMPY_LT_1_20"},{"col":0,"comment":"null","endLoc":186,"header":"def helper_radian_to_dimensionless(f, unit)","id":10429,"name":"helper_radian_to_dimensionless","nodeType":"Function","startLoc":179,"text":"def helper_radian_to_dimensionless(f, unit):\n    from astropy.units.si import radian\n    try:\n        return [get_converter(unit, radian)], dimensionless_unscaled\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":10430,"name":"NUMPY_LT_1_23","nodeType":"Attribute","startLoc":21,"text":"NUMPY_LT_1_23"},{"className":"FunctionAssigner","col":0,"comment":"null","endLoc":171,"id":10431,"nodeType":"Class","startLoc":145,"text":"class FunctionAssigner:\n    def __init__(self, assignments):\n        self.assignments = assignments\n\n    def __call__(self, f=None, helps=None, module=np):\n        \"\"\"Add a helper to a numpy function.\n\n        Normally used as a decorator.\n\n        If ``helps`` is given, it should be the numpy function helped (or an\n        iterable of numpy functions helped).\n\n        If ``helps`` is not given, it is assumed the function helped is the\n        numpy function with the same name as the decorated function.\n        \"\"\"\n        if f is not None:\n            if helps is None:\n                helps = getattr(module, f.__name__)\n            if not isiterable(helps):\n                helps = (helps,)\n            for h in helps:\n                self.assignments[h] = f\n            return f\n        elif helps is not None or module is not np:\n            return functools.partial(self.__call__, helps=helps, module=module)\n        else:  # pragma: no cover\n            raise ValueError(\"function_helper requires at least one argument.\")"},{"col":4,"comment":"null","endLoc":147,"header":"def __init__(self, assignments)","id":10432,"name":"__init__","nodeType":"Function","startLoc":146,"text":"def __init__(self, assignments):\n        self.assignments = assignments"},{"col":4,"comment":"Add a helper to a numpy function.\n\n        Normally used as a decorator.\n\n        If ``helps`` is given, it should be the numpy function helped (or an\n        iterable of numpy functions helped).\n\n        If ``helps`` is not given, it is assumed the function helped is the\n        numpy function with the same name as the decorated function.\n        ","endLoc":171,"header":"def __call__(self, f=None, helps=None, module=np)","id":10433,"name":"__call__","nodeType":"Function","startLoc":149,"text":"def __call__(self, f=None, helps=None, module=np):\n        \"\"\"Add a helper to a numpy function.\n\n        Normally used as a decorator.\n\n        If ``helps`` is given, it should be the numpy function helped (or an\n        iterable of numpy functions helped).\n\n        If ``helps`` is not given, it is assumed the function helped is the\n        numpy function with the same name as the decorated function.\n        \"\"\"\n        if f is not None:\n            if helps is None:\n                helps = getattr(module, f.__name__)\n            if not isiterable(helps):\n                helps = (helps,)\n            for h in helps:\n                self.assignments[h] = f\n            return f\n        elif helps is not None or module is not np:\n            return functools.partial(self.__call__, helps=helps, module=module)\n        else:  # pragma: no cover\n            raise ValueError(\"function_helper requires at least one argument.\")"},{"col":0,"comment":"null","endLoc":49,"header":"def helper_s2c(f, unit1, unit2)","id":10434,"name":"helper_s2c","nodeType":"Function","startLoc":41,"text":"def helper_s2c(f, unit1, unit2):\n    from astropy.units.si import radian\n    try:\n        return [get_converter(unit1, radian),\n                get_converter(unit2, radian)], dimensionless_unscaled\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))"},{"id":10435,"name":"astropy/utils","nodeType":"Package"},{"fileName":"decorators.py","filePath":"astropy/utils","id":10436,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"Sundry function and class decorators.\"\"\"\n\n\nimport functools\nimport inspect\nimport textwrap\nimport threading\nimport types\nimport warnings\nfrom inspect import signature\n\nfrom .exceptions import (AstropyDeprecationWarning, AstropyUserWarning,\n                         AstropyPendingDeprecationWarning)\n\n\n__all__ = ['classproperty', 'deprecated', 'deprecated_attribute',\n           'deprecated_renamed_argument', 'format_doc',\n           'lazyproperty', 'sharedmethod']\n\n_NotFound = object()\n\n\ndef deprecated(since, message='', name='', alternative='', pending=False,\n               obj_type=None, warning_type=AstropyDeprecationWarning):\n    \"\"\"\n    Used to mark a function or class as deprecated.\n\n    To mark an attribute as deprecated, use `deprecated_attribute`.\n\n    Parameters\n    ----------\n    since : str\n        The release at which this API became deprecated.  This is\n        required.\n\n    message : str, optional\n        Override the default deprecation message.  The format\n        specifier ``func`` may be used for the name of the function,\n        and ``alternative`` may be used in the deprecation message\n        to insert the name of an alternative to the deprecated\n        function. ``obj_type`` may be used to insert a friendly name\n        for the type of object being deprecated.\n\n    name : str, optional\n        The name of the deprecated function or class; if not provided\n        the name is automatically determined from the passed in\n        function or class, though this is useful in the case of\n        renamed functions, where the new function is just assigned to\n        the name of the deprecated function.  For example::\n\n            def new_function():\n                ...\n            oldFunction = new_function\n\n    alternative : str, optional\n        An alternative function or class name that the user may use in\n        place of the deprecated object.  The deprecation warning will\n        tell the user about this alternative if provided.\n\n    pending : bool, optional\n        If True, uses a AstropyPendingDeprecationWarning instead of a\n        ``warning_type``.\n\n    obj_type : str, optional\n        The type of this object, if the automatically determined one\n        needs to be overridden.\n\n    warning_type : Warning\n        Warning to be issued.\n        Default is `~astropy.utils.exceptions.AstropyDeprecationWarning`.\n    \"\"\"\n\n    method_types = (classmethod, staticmethod, types.MethodType)\n\n    def deprecate_doc(old_doc, message):\n        \"\"\"\n        Returns a given docstring with a deprecation message prepended\n        to it.\n        \"\"\"\n        if not old_doc:\n            old_doc = ''\n        old_doc = textwrap.dedent(old_doc).strip('\\n')\n        new_doc = (('\\n.. deprecated:: {since}'\n                    '\\n    {message}\\n\\n'.format(\n                     **{'since': since, 'message': message.strip()})) + old_doc)\n        if not old_doc:\n            # This is to prevent a spurious 'unexpected unindent' warning from\n            # docutils when the original docstring was blank.\n            new_doc += r'\\ '\n        return new_doc\n\n    def get_function(func):\n        \"\"\"\n        Given a function or classmethod (or other function wrapper type), get\n        the function object.\n        \"\"\"\n        if isinstance(func, method_types):\n            func = func.__func__\n        return func\n\n    def deprecate_function(func, message, warning_type=warning_type):\n        \"\"\"\n        Returns a wrapped function that displays ``warning_type``\n        when it is called.\n        \"\"\"\n\n        if isinstance(func, method_types):\n            func_wrapper = type(func)\n        else:\n            func_wrapper = lambda f: f  # noqa: E731\n\n        func = get_function(func)\n\n        def deprecated_func(*args, **kwargs):\n            if pending:\n                category = AstropyPendingDeprecationWarning\n            else:\n                category = warning_type\n\n            warnings.warn(message, category, stacklevel=2)\n\n            return func(*args, **kwargs)\n\n        # If this is an extension function, we can't call\n        # functools.wraps on it, but we normally don't care.\n        # This crazy way to get the type of a wrapper descriptor is\n        # straight out of the Python 3.3 inspect module docs.\n        if type(func) is not type(str.__dict__['__add__']):  # noqa: E721\n            deprecated_func = functools.wraps(func)(deprecated_func)\n\n        deprecated_func.__doc__ = deprecate_doc(\n            deprecated_func.__doc__, message)\n\n        return func_wrapper(deprecated_func)\n\n    def deprecate_class(cls, message, warning_type=warning_type):\n        \"\"\"\n        Update the docstring and wrap the ``__init__`` in-place (or ``__new__``\n        if the class or any of the bases overrides ``__new__``) so it will give\n        a deprecation warning when an instance is created.\n\n        This won't work for extension classes because these can't be modified\n        in-place and the alternatives don't work in the general case:\n\n        - Using a new class that looks and behaves like the original doesn't\n          work because the __new__ method of extension types usually makes sure\n          that it's the same class or a subclass.\n        - Subclassing the class and return the subclass can lead to problems\n          with pickle and will look weird in the Sphinx docs.\n        \"\"\"\n        cls.__doc__ = deprecate_doc(cls.__doc__, message)\n        if cls.__new__ is object.__new__:\n            cls.__init__ = deprecate_function(get_function(cls.__init__),\n                                              message, warning_type)\n        else:\n            cls.__new__ = deprecate_function(get_function(cls.__new__),\n                                             message, warning_type)\n        return cls\n\n    def deprecate(obj, message=message, name=name, alternative=alternative,\n                  pending=pending, warning_type=warning_type):\n        if obj_type is None:\n            if isinstance(obj, type):\n                obj_type_name = 'class'\n            elif inspect.isfunction(obj):\n                obj_type_name = 'function'\n            elif inspect.ismethod(obj) or isinstance(obj, method_types):\n                obj_type_name = 'method'\n            else:\n                obj_type_name = 'object'\n        else:\n            obj_type_name = obj_type\n\n        if not name:\n            name = get_function(obj).__name__\n\n        altmessage = ''\n        if not message or type(message) is type(deprecate):\n            if pending:\n                message = ('The {func} {obj_type} will be deprecated in a '\n                           'future version.')\n            else:\n                message = ('The {func} {obj_type} is deprecated and may '\n                           'be removed in a future version.')\n            if alternative:\n                altmessage = f'\\n        Use {alternative} instead.'\n\n        message = ((message.format(**{\n            'func': name,\n            'name': name,\n            'alternative': alternative,\n            'obj_type': obj_type_name})) +\n            altmessage)\n\n        if isinstance(obj, type):\n            return deprecate_class(obj, message, warning_type)\n        else:\n            return deprecate_function(obj, message, warning_type)\n\n    if type(message) is type(deprecate):\n        return deprecate(message)\n\n    return deprecate\n\n\ndef deprecated_attribute(name, since, message=None, alternative=None,\n                         pending=False, warning_type=AstropyDeprecationWarning):\n    \"\"\"\n    Used to mark a public attribute as deprecated.  This creates a\n    property that will warn when the given attribute name is accessed.\n    To prevent the warning (i.e. for internal code), use the private\n    name for the attribute by prepending an underscore\n    (i.e. ``self._name``).\n\n    Parameters\n    ----------\n    name : str\n        The name of the deprecated attribute.\n\n    since : str\n        The release at which this API became deprecated.  This is\n        required.\n\n    message : str, optional\n        Override the default deprecation message.  The format\n        specifier ``name`` may be used for the name of the attribute,\n        and ``alternative`` may be used in the deprecation message\n        to insert the name of an alternative to the deprecated\n        function.\n\n    alternative : str, optional\n        An alternative attribute that the user may use in place of the\n        deprecated attribute.  The deprecation warning will tell the\n        user about this alternative if provided.\n\n    pending : bool, optional\n        If True, uses a AstropyPendingDeprecationWarning instead of\n        ``warning_type``.\n\n    warning_type : Warning\n        Warning to be issued.\n        Default is `~astropy.utils.exceptions.AstropyDeprecationWarning`.\n\n    Examples\n    --------\n\n    ::\n\n        class MyClass:\n            # Mark the old_name as deprecated\n            old_name = misc.deprecated_attribute('old_name', '0.1')\n\n            def method(self):\n                self._old_name = 42\n    \"\"\"\n    private_name = '_' + name\n\n    specific_deprecated = deprecated(since, name=name, obj_type='attribute',\n                                     message=message, alternative=alternative,\n                                     pending=pending,\n                                     warning_type=warning_type)\n\n    @specific_deprecated\n    def get(self):\n        return getattr(self, private_name)\n\n    @specific_deprecated\n    def set(self, val):\n        setattr(self, private_name, val)\n\n    @specific_deprecated\n    def delete(self):\n        delattr(self, private_name)\n\n    return property(get, set, delete)\n\n\ndef deprecated_renamed_argument(old_name, new_name, since,\n                                arg_in_kwargs=False, relax=False,\n                                pending=False,\n                                warning_type=AstropyDeprecationWarning,\n                                alternative='', message=''):\n    \"\"\"Deprecate a _renamed_ or _removed_ function argument.\n\n    The decorator assumes that the argument with the ``old_name`` was removed\n    from the function signature and the ``new_name`` replaced it at the\n    **same position** in the signature.  If the ``old_name`` argument is\n    given when calling the decorated function the decorator will catch it and\n    issue a deprecation warning and pass it on as ``new_name`` argument.\n\n    Parameters\n    ----------\n    old_name : str or sequence of str\n        The old name of the argument.\n\n    new_name : str or sequence of str or None\n        The new name of the argument. Set this to `None` to remove the\n        argument ``old_name`` instead of renaming it.\n\n    since : str or number or sequence of str or number\n        The release at which the old argument became deprecated.\n\n    arg_in_kwargs : bool or sequence of bool, optional\n        If the argument is not a named argument (for example it\n        was meant to be consumed by ``**kwargs``) set this to\n        ``True``.  Otherwise the decorator will throw an Exception\n        if the ``new_name`` cannot be found in the signature of\n        the decorated function.\n        Default is ``False``.\n\n    relax : bool or sequence of bool, optional\n        If ``False`` a ``TypeError`` is raised if both ``new_name`` and\n        ``old_name`` are given.  If ``True`` the value for ``new_name`` is used\n        and a Warning is issued.\n        Default is ``False``.\n\n    pending : bool or sequence of bool, optional\n        If ``True`` this will hide the deprecation warning and ignore the\n        corresponding ``relax`` parameter value.\n        Default is ``False``.\n\n    warning_type : Warning\n        Warning to be issued.\n        Default is `~astropy.utils.exceptions.AstropyDeprecationWarning`.\n\n    alternative : str, optional\n        An alternative function or class name that the user may use in\n        place of the deprecated object if ``new_name`` is None. The deprecation\n        warning will tell the user about this alternative if provided.\n\n    message : str, optional\n        A custom warning message. If provided then ``since`` and\n        ``alternative`` options will have no effect.\n\n    Raises\n    ------\n    TypeError\n        If the new argument name cannot be found in the function\n        signature and arg_in_kwargs was False or if it is used to\n        deprecate the name of the ``*args``-, ``**kwargs``-like arguments.\n        At runtime such an Error is raised if both the new_name\n        and old_name were specified when calling the function and\n        \"relax=False\".\n\n    Notes\n    -----\n    The decorator should be applied to a function where the **name**\n    of an argument was changed but it applies the same logic.\n\n    .. warning::\n        If ``old_name`` is a list or tuple the ``new_name`` and ``since`` must\n        also be a list or tuple with the same number of entries. ``relax`` and\n        ``arg_in_kwarg`` can be a single bool (applied to all) or also a\n        list/tuple with the same number of entries like ``new_name``, etc.\n\n    Examples\n    --------\n    The deprecation warnings are not shown in the following examples.\n\n    To deprecate a positional or keyword argument::\n\n        >>> from astropy.utils.decorators import deprecated_renamed_argument\n        >>> @deprecated_renamed_argument('sig', 'sigma', '1.0')\n        ... def test(sigma):\n        ...     return sigma\n\n        >>> test(2)\n        2\n        >>> test(sigma=2)\n        2\n        >>> test(sig=2)  # doctest: +SKIP\n        2\n\n    To deprecate an argument caught inside the ``**kwargs`` the\n    ``arg_in_kwargs`` has to be set::\n\n        >>> @deprecated_renamed_argument('sig', 'sigma', '1.0',\n        ...                             arg_in_kwargs=True)\n        ... def test(**kwargs):\n        ...     return kwargs['sigma']\n\n        >>> test(sigma=2)\n        2\n        >>> test(sig=2)  # doctest: +SKIP\n        2\n\n    By default providing the new and old keyword will lead to an Exception. If\n    a Warning is desired set the ``relax`` argument::\n\n        >>> @deprecated_renamed_argument('sig', 'sigma', '1.0', relax=True)\n        ... def test(sigma):\n        ...     return sigma\n\n        >>> test(sig=2)  # doctest: +SKIP\n        2\n\n    It is also possible to replace multiple arguments. The ``old_name``,\n    ``new_name`` and ``since`` have to be `tuple` or `list` and contain the\n    same number of entries::\n\n        >>> @deprecated_renamed_argument(['a', 'b'], ['alpha', 'beta'],\n        ...                              ['1.0', 1.2])\n        ... def test(alpha, beta):\n        ...     return alpha, beta\n\n        >>> test(a=2, b=3)  # doctest: +SKIP\n        (2, 3)\n\n    In this case ``arg_in_kwargs`` and ``relax`` can be a single value (which\n    is applied to all renamed arguments) or must also be a `tuple` or `list`\n    with values for each of the arguments.\n\n    \"\"\"\n    cls_iter = (list, tuple)\n    if isinstance(old_name, cls_iter):\n        n = len(old_name)\n        # Assume that new_name and since are correct (tuple/list with the\n        # appropriate length) in the spirit of the \"consenting adults\". But the\n        # optional parameters may not be set, so if these are not iterables\n        # wrap them.\n        if not isinstance(arg_in_kwargs, cls_iter):\n            arg_in_kwargs = [arg_in_kwargs] * n\n        if not isinstance(relax, cls_iter):\n            relax = [relax] * n\n        if not isinstance(pending, cls_iter):\n            pending = [pending] * n\n        if not isinstance(message, cls_iter):\n            message = [message] * n\n    else:\n        # To allow a uniform approach later on, wrap all arguments in lists.\n        n = 1\n        old_name = [old_name]\n        new_name = [new_name]\n        since = [since]\n        arg_in_kwargs = [arg_in_kwargs]\n        relax = [relax]\n        pending = [pending]\n        message = [message]\n\n    def decorator(function):\n        # The named arguments of the function.\n        arguments = signature(function).parameters\n        keys = list(arguments.keys())\n        position = [None] * n\n\n        for i in range(n):\n            # Determine the position of the argument.\n            if arg_in_kwargs[i]:\n                pass\n            else:\n                if new_name[i] is None:\n                    param = arguments[old_name[i]]\n                elif new_name[i] in arguments:\n                    param = arguments[new_name[i]]\n                # In case the argument is not found in the list of arguments\n                # the only remaining possibility is that it should be caught\n                # by some kind of **kwargs argument.\n                # This case has to be explicitly specified, otherwise throw\n                # an exception!\n                else:\n                    raise TypeError(\n                        f'\"{new_name[i]}\" was not specified in the function '\n                        'signature. If it was meant to be part of '\n                        '\"**kwargs\" then set \"arg_in_kwargs\" to \"True\"')\n\n                # There are several possibilities now:\n\n                # 1.) Positional or keyword argument:\n                if param.kind == param.POSITIONAL_OR_KEYWORD:\n                    if new_name[i] is None:\n                        position[i] = keys.index(old_name[i])\n                    else:\n                        position[i] = keys.index(new_name[i])\n\n                # 2.) Keyword only argument:\n                elif param.kind == param.KEYWORD_ONLY:\n                    # These cannot be specified by position.\n                    position[i] = None\n\n                # 3.) positional-only argument, varargs, varkwargs or some\n                #     unknown type:\n                else:\n                    raise TypeError(f'cannot replace argument \"{new_name[i]}\" '\n                                    f'of kind {repr(param.kind)}.')\n\n        @functools.wraps(function)\n        def wrapper(*args, **kwargs):\n            for i in range(n):\n                msg = message[i] or (f'\"{old_name[i]}\" was deprecated in '\n                                     f'version {since[i]} and will be removed '\n                                     'in a future version. ')\n                # The only way to have oldkeyword inside the function is\n                # that it is passed as kwarg because the oldkeyword\n                # parameter was renamed to newkeyword.\n                if old_name[i] in kwargs:\n                    value = kwargs.pop(old_name[i])\n                    # Display the deprecation warning only when it's not\n                    # pending.\n                    if not pending[i]:\n                        if not message[i]:\n                            if new_name[i] is not None:\n                                msg += f'Use argument \"{new_name[i]}\" instead.'\n                            elif alternative:\n                                msg += f'\\n        Use {alternative} instead.'\n                        warnings.warn(msg, warning_type, stacklevel=2)\n\n                    # Check if the newkeyword was given as well.\n                    newarg_in_args = (position[i] is not None and\n                                      len(args) > position[i])\n                    newarg_in_kwargs = new_name[i] in kwargs\n\n                    if newarg_in_args or newarg_in_kwargs:\n                        if not pending[i]:\n                            # If both are given print a Warning if relax is\n                            # True or raise an Exception is relax is False.\n                            if relax[i]:\n                                warnings.warn(\n                                    f'\"{old_name[i]}\" and \"{new_name[i]}\" '\n                                    'keywords were set. '\n                                    f'Using the value of \"{new_name[i]}\".',\n                                    AstropyUserWarning)\n                            else:\n                                raise TypeError(\n                                    f'cannot specify both \"{old_name[i]}\" and '\n                                    f'\"{new_name[i]}\".')\n                    else:\n                        # Pass the value of the old argument with the\n                        # name of the new argument to the function\n                        if new_name[i] is not None:\n                            kwargs[new_name[i]] = value\n                        # If old argument has no replacement, cast it back.\n                        # https://github.com/astropy/astropy/issues/9914\n                        else:\n                            kwargs[old_name[i]] = value\n\n                # Deprecated keyword without replacement is given as\n                # positional argument.\n                elif (not pending[i] and not new_name[i] and position[i] and\n                      len(args) > position[i]):\n                    if alternative and not message[i]:\n                        msg += f'\\n        Use {alternative} instead.'\n                    warnings.warn(msg, warning_type, stacklevel=2)\n\n            return function(*args, **kwargs)\n\n        return wrapper\n    return decorator\n\n\n# TODO: This can still be made to work for setters by implementing an\n# accompanying metaclass that supports it; we just don't need that right this\n# second\nclass classproperty(property):\n    \"\"\"\n    Similar to `property`, but allows class-level properties.  That is,\n    a property whose getter is like a `classmethod`.\n\n    The wrapped method may explicitly use the `classmethod` decorator (which\n    must become before this decorator), or the `classmethod` may be omitted\n    (it is implicit through use of this decorator).\n\n    .. note::\n\n        classproperty only works for *read-only* properties.  It does not\n        currently allow writeable/deletable properties, due to subtleties of how\n        Python descriptors work.  In order to implement such properties on a class\n        a metaclass for that class must be implemented.\n\n    Parameters\n    ----------\n    fget : callable\n        The function that computes the value of this property (in particular,\n        the function when this is used as a decorator) a la `property`.\n\n    doc : str, optional\n        The docstring for the property--by default inherited from the getter\n        function.\n\n    lazy : bool, optional\n        If True, caches the value returned by the first call to the getter\n        function, so that it is only called once (used for lazy evaluation\n        of an attribute).  This is analogous to `lazyproperty`.  The ``lazy``\n        argument can also be used when `classproperty` is used as a decorator\n        (see the third example below).  When used in the decorator syntax this\n        *must* be passed in as a keyword argument.\n\n    Examples\n    --------\n\n    ::\n\n        >>> class Foo:\n        ...     _bar_internal = 1\n        ...     @classproperty\n        ...     def bar(cls):\n        ...         return cls._bar_internal + 1\n        ...\n        >>> Foo.bar\n        2\n        >>> foo_instance = Foo()\n        >>> foo_instance.bar\n        2\n        >>> foo_instance._bar_internal = 2\n        >>> foo_instance.bar  # Ignores instance attributes\n        2\n\n    As previously noted, a `classproperty` is limited to implementing\n    read-only attributes::\n\n        >>> class Foo:\n        ...     _bar_internal = 1\n        ...     @classproperty\n        ...     def bar(cls):\n        ...         return cls._bar_internal\n        ...     @bar.setter\n        ...     def bar(cls, value):\n        ...         cls._bar_internal = value\n        ...\n        Traceback (most recent call last):\n        ...\n        NotImplementedError: classproperty can only be read-only; use a\n        metaclass to implement modifiable class-level properties\n\n    When the ``lazy`` option is used, the getter is only called once::\n\n        >>> class Foo:\n        ...     @classproperty(lazy=True)\n        ...     def bar(cls):\n        ...         print(\"Performing complicated calculation\")\n        ...         return 1\n        ...\n        >>> Foo.bar\n        Performing complicated calculation\n        1\n        >>> Foo.bar\n        1\n\n    If a subclass inherits a lazy `classproperty` the property is still\n    re-evaluated for the subclass::\n\n        >>> class FooSub(Foo):\n        ...     pass\n        ...\n        >>> FooSub.bar\n        Performing complicated calculation\n        1\n        >>> FooSub.bar\n        1\n    \"\"\"\n\n    def __new__(cls, fget=None, doc=None, lazy=False):\n        if fget is None:\n            # Being used as a decorator--return a wrapper that implements\n            # decorator syntax\n            def wrapper(func):\n                return cls(func, lazy=lazy)\n\n            return wrapper\n\n        return super().__new__(cls)\n\n    def __init__(self, fget, doc=None, lazy=False):\n        self._lazy = lazy\n        if lazy:\n            self._lock = threading.RLock()   # Protects _cache\n            self._cache = {}\n        fget = self._wrap_fget(fget)\n\n        super().__init__(fget=fget, doc=doc)\n\n        # There is a buglet in Python where self.__doc__ doesn't\n        # get set properly on instances of property subclasses if\n        # the doc argument was used rather than taking the docstring\n        # from fget\n        # Related Python issue: https://bugs.python.org/issue24766\n        if doc is not None:\n            self.__doc__ = doc\n\n    def __get__(self, obj, objtype):\n        if self._lazy:\n            val = self._cache.get(objtype, _NotFound)\n            if val is _NotFound:\n                with self._lock:\n                    # Check if another thread initialised before we locked.\n                    val = self._cache.get(objtype, _NotFound)\n                    if val is _NotFound:\n                        val = self.fget.__wrapped__(objtype)\n                        self._cache[objtype] = val\n        else:\n            # The base property.__get__ will just return self here;\n            # instead we pass objtype through to the original wrapped\n            # function (which takes the class as its sole argument)\n            val = self.fget.__wrapped__(objtype)\n        return val\n\n    def getter(self, fget):\n        return super().getter(self._wrap_fget(fget))\n\n    def setter(self, fset):\n        raise NotImplementedError(\n            \"classproperty can only be read-only; use a metaclass to \"\n            \"implement modifiable class-level properties\")\n\n    def deleter(self, fdel):\n        raise NotImplementedError(\n            \"classproperty can only be read-only; use a metaclass to \"\n            \"implement modifiable class-level properties\")\n\n    @staticmethod\n    def _wrap_fget(orig_fget):\n        if isinstance(orig_fget, classmethod):\n            orig_fget = orig_fget.__func__\n\n        # Using stock functools.wraps instead of the fancier version\n        # found later in this module, which is overkill for this purpose\n\n        @functools.wraps(orig_fget)\n        def fget(obj):\n            return orig_fget(obj.__class__)\n\n        return fget\n\n\n# Adapted from the recipe at\n# http://code.activestate.com/recipes/363602-lazy-property-evaluation\nclass lazyproperty(property):\n    \"\"\"\n    Works similarly to property(), but computes the value only once.\n\n    This essentially memorizes the value of the property by storing the result\n    of its computation in the ``__dict__`` of the object instance.  This is\n    useful for computing the value of some property that should otherwise be\n    invariant.  For example::\n\n        >>> class LazyTest:\n        ...     @lazyproperty\n        ...     def complicated_property(self):\n        ...         print('Computing the value for complicated_property...')\n        ...         return 42\n        ...\n        >>> lt = LazyTest()\n        >>> lt.complicated_property\n        Computing the value for complicated_property...\n        42\n        >>> lt.complicated_property\n        42\n\n    As the example shows, the second time ``complicated_property`` is accessed,\n    the ``print`` statement is not executed.  Only the return value from the\n    first access off ``complicated_property`` is returned.\n\n    By default, a setter and deleter are used which simply overwrite and\n    delete, respectively, the value stored in ``__dict__``. Any user-specified\n    setter or deleter is executed before executing these default actions.\n    The one exception is that the default setter is not run if the user setter\n    already sets the new value in ``__dict__`` and returns that value and the\n    returned value is not ``None``.\n\n    \"\"\"\n\n    def __init__(self, fget, fset=None, fdel=None, doc=None):\n        super().__init__(fget, fset, fdel, doc)\n        self._key = self.fget.__name__\n        self._lock = threading.RLock()\n\n    def __get__(self, obj, owner=None):\n        try:\n            obj_dict = obj.__dict__\n            val = obj_dict.get(self._key, _NotFound)\n            if val is _NotFound:\n                with self._lock:\n                    # Check if another thread beat us to it.\n                    val = obj_dict.get(self._key, _NotFound)\n                    if val is _NotFound:\n                        val = self.fget(obj)\n                        obj_dict[self._key] = val\n            return val\n        except AttributeError:\n            if obj is None:\n                return self\n            raise\n\n    def __set__(self, obj, val):\n        obj_dict = obj.__dict__\n        if self.fset:\n            ret = self.fset(obj, val)\n            if ret is not None and obj_dict.get(self._key) is ret:\n                # By returning the value set the setter signals that it\n                # took over setting the value in obj.__dict__; this\n                # mechanism allows it to override the input value\n                return\n        obj_dict[self._key] = val\n\n    def __delete__(self, obj):\n        if self.fdel:\n            self.fdel(obj)\n        obj.__dict__.pop(self._key, None)    # Delete if present\n\n\nclass sharedmethod(classmethod):\n    \"\"\"\n    This is a method decorator that allows both an instancemethod and a\n    `classmethod` to share the same name.\n\n    When using `sharedmethod` on a method defined in a class's body, it\n    may be called on an instance, or on a class.  In the former case it\n    behaves like a normal instance method (a reference to the instance is\n    automatically passed as the first ``self`` argument of the method)::\n\n        >>> class Example:\n        ...     @sharedmethod\n        ...     def identify(self, *args):\n        ...         print('self was', self)\n        ...         print('additional args were', args)\n        ...\n        >>> ex = Example()\n        >>> ex.identify(1, 2)\n        self was <astropy.utils.decorators.Example object at 0x...>\n        additional args were (1, 2)\n\n    In the latter case, when the `sharedmethod` is called directly from a\n    class, it behaves like a `classmethod`::\n\n        >>> Example.identify(3, 4)\n        self was <class 'astropy.utils.decorators.Example'>\n        additional args were (3, 4)\n\n    This also supports a more advanced usage, where the `classmethod`\n    implementation can be written separately.  If the class's *metaclass*\n    has a method of the same name as the `sharedmethod`, the version on\n    the metaclass is delegated to::\n\n        >>> class ExampleMeta(type):\n        ...     def identify(self):\n        ...         print('this implements the {0}.identify '\n        ...               'classmethod'.format(self.__name__))\n        ...\n        >>> class Example(metaclass=ExampleMeta):\n        ...     @sharedmethod\n        ...     def identify(self):\n        ...         print('this implements the instancemethod')\n        ...\n        >>> Example().identify()\n        this implements the instancemethod\n        >>> Example.identify()\n        this implements the Example.identify classmethod\n    \"\"\"\n\n    def __get__(self, obj, objtype=None):\n        if obj is None:\n            mcls = type(objtype)\n            clsmeth = getattr(mcls, self.__func__.__name__, None)\n            if callable(clsmeth):\n                func = clsmeth\n            else:\n                func = self.__func__\n\n            return self._make_method(func, objtype)\n        else:\n            return self._make_method(self.__func__, obj)\n\n    @staticmethod\n    def _make_method(func, instance):\n        return types.MethodType(func, instance)\n\n\ndef format_doc(docstring, *args, **kwargs):\n    \"\"\"\n    Replaces the docstring of the decorated object and then formats it.\n\n    The formatting works like :meth:`str.format` and if the decorated object\n    already has a docstring this docstring can be included in the new\n    documentation if you use the ``{__doc__}`` placeholder.\n    Its primary use is for reusing a *long* docstring in multiple functions\n    when it is the same or only slightly different between them.\n\n    Parameters\n    ----------\n    docstring : str or object or None\n        The docstring that will replace the docstring of the decorated\n        object. If it is an object like a function or class it will\n        take the docstring of this object. If it is a string it will use the\n        string itself. One special case is if the string is ``None`` then\n        it will use the decorated functions docstring and formats it.\n\n    args :\n        passed to :meth:`str.format`.\n\n    kwargs :\n        passed to :meth:`str.format`. If the function has a (not empty)\n        docstring the original docstring is added to the kwargs with the\n        keyword ``'__doc__'``.\n\n    Raises\n    ------\n    ValueError\n        If the ``docstring`` (or interpreted docstring if it was ``None``\n        or not a string) is empty.\n\n    IndexError, KeyError\n        If a placeholder in the (interpreted) ``docstring`` was not filled. see\n        :meth:`str.format` for more information.\n\n    Notes\n    -----\n    Using this decorator allows, for example Sphinx, to parse the\n    correct docstring.\n\n    Examples\n    --------\n\n    Replacing the current docstring is very easy::\n\n        >>> from astropy.utils.decorators import format_doc\n        >>> @format_doc('''Perform num1 + num2''')\n        ... def add(num1, num2):\n        ...     return num1+num2\n        ...\n        >>> help(add) # doctest: +SKIP\n        Help on function add in module __main__:\n        <BLANKLINE>\n        add(num1, num2)\n            Perform num1 + num2\n\n    sometimes instead of replacing you only want to add to it::\n\n        >>> doc = '''\n        ...       {__doc__}\n        ...       Parameters\n        ...       ----------\n        ...       num1, num2 : Numbers\n        ...       Returns\n        ...       -------\n        ...       result: Number\n        ...       '''\n        >>> @format_doc(doc)\n        ... def add(num1, num2):\n        ...     '''Perform addition.'''\n        ...     return num1+num2\n        ...\n        >>> help(add) # doctest: +SKIP\n        Help on function add in module __main__:\n        <BLANKLINE>\n        add(num1, num2)\n            Perform addition.\n            Parameters\n            ----------\n            num1, num2 : Numbers\n            Returns\n            -------\n            result : Number\n\n    in case one might want to format it further::\n\n        >>> doc = '''\n        ...       Perform {0}.\n        ...       Parameters\n        ...       ----------\n        ...       num1, num2 : Numbers\n        ...       Returns\n        ...       -------\n        ...       result: Number\n        ...           result of num1 {op} num2\n        ...       {__doc__}\n        ...       '''\n        >>> @format_doc(doc, 'addition', op='+')\n        ... def add(num1, num2):\n        ...     return num1+num2\n        ...\n        >>> @format_doc(doc, 'subtraction', op='-')\n        ... def subtract(num1, num2):\n        ...     '''Notes: This one has additional notes.'''\n        ...     return num1-num2\n        ...\n        >>> help(add) # doctest: +SKIP\n        Help on function add in module __main__:\n        <BLANKLINE>\n        add(num1, num2)\n            Perform addition.\n            Parameters\n            ----------\n            num1, num2 : Numbers\n            Returns\n            -------\n            result : Number\n                result of num1 + num2\n        >>> help(subtract) # doctest: +SKIP\n        Help on function subtract in module __main__:\n        <BLANKLINE>\n        subtract(num1, num2)\n            Perform subtraction.\n            Parameters\n            ----------\n            num1, num2 : Numbers\n            Returns\n            -------\n            result : Number\n                result of num1 - num2\n            Notes : This one has additional notes.\n\n    These methods can be combined an even taking the docstring from another\n    object is possible as docstring attribute. You just have to specify the\n    object::\n\n        >>> @format_doc(add)\n        ... def another_add(num1, num2):\n        ...     return num1 + num2\n        ...\n        >>> help(another_add) # doctest: +SKIP\n        Help on function another_add in module __main__:\n        <BLANKLINE>\n        another_add(num1, num2)\n            Perform addition.\n            Parameters\n            ----------\n            num1, num2 : Numbers\n            Returns\n            -------\n            result : Number\n                result of num1 + num2\n\n    But be aware that this decorator *only* formats the given docstring not\n    the strings passed as ``args`` or ``kwargs`` (not even the original\n    docstring)::\n\n        >>> @format_doc(doc, 'addition', op='+')\n        ... def yet_another_add(num1, num2):\n        ...    '''This one is good for {0}.'''\n        ...    return num1 + num2\n        ...\n        >>> help(yet_another_add) # doctest: +SKIP\n        Help on function yet_another_add in module __main__:\n        <BLANKLINE>\n        yet_another_add(num1, num2)\n            Perform addition.\n            Parameters\n            ----------\n            num1, num2 : Numbers\n            Returns\n            -------\n            result : Number\n                result of num1 + num2\n            This one is good for {0}.\n\n    To work around it you could specify the docstring to be ``None``::\n\n        >>> @format_doc(None, 'addition')\n        ... def last_add_i_swear(num1, num2):\n        ...    '''This one is good for {0}.'''\n        ...    return num1 + num2\n        ...\n        >>> help(last_add_i_swear) # doctest: +SKIP\n        Help on function last_add_i_swear in module __main__:\n        <BLANKLINE>\n        last_add_i_swear(num1, num2)\n            This one is good for addition.\n\n    Using it with ``None`` as docstring allows to use the decorator twice\n    on an object to first parse the new docstring and then to parse the\n    original docstring or the ``args`` and ``kwargs``.\n    \"\"\"\n    def set_docstring(obj):\n        if docstring is None:\n            # None means: use the objects __doc__\n            doc = obj.__doc__\n            # Delete documentation in this case so we don't end up with\n            # awkwardly self-inserted docs.\n            obj.__doc__ = None\n        elif isinstance(docstring, str):\n            # String: use the string that was given\n            doc = docstring\n        else:\n            # Something else: Use the __doc__ of this\n            doc = docstring.__doc__\n\n        if not doc:\n            # In case the docstring is empty it's probably not what was wanted.\n            raise ValueError('docstring must be a string or containing a '\n                             'docstring that is not empty.')\n\n        # If the original has a not-empty docstring append it to the format\n        # kwargs.\n        kwargs['__doc__'] = obj.__doc__ or ''\n        obj.__doc__ = doc.format(*args, **kwargs)\n        return obj\n    return set_docstring\n"},{"col":4,"comment":"null","endLoc":579,"header":"def __mul__(self, other)","id":10437,"name":"__mul__","nodeType":"Function","startLoc":574,"text":"def __mul__(self, other):\n        if self.unit.physical_unit == dimensionless_unscaled:\n            return self._function_view * other\n\n        raise UnitTypeError(\"Cannot multiply function quantities which \"\n                            \"are not dimensionless with anything.\")"},{"className":"sharedmethod","col":0,"comment":"\n    This is a method decorator that allows both an instancemethod and a\n    `classmethod` to share the same name.\n\n    When using `sharedmethod` on a method defined in a class's body, it\n    may be called on an instance, or on a class.  In the former case it\n    behaves like a normal instance method (a reference to the instance is\n    automatically passed as the first ``self`` argument of the method)::\n\n        >>> class Example:\n        ...     @sharedmethod\n        ...     def identify(self, *args):\n        ...         print('self was', self)\n        ...         print('additional args were', args)\n        ...\n        >>> ex = Example()\n        >>> ex.identify(1, 2)\n        self was <astropy.utils.decorators.Example object at 0x...>\n        additional args were (1, 2)\n\n    In the latter case, when the `sharedmethod` is called directly from a\n    class, it behaves like a `classmethod`::\n\n        >>> Example.identify(3, 4)\n        self was <class 'astropy.utils.decorators.Example'>\n        additional args were (3, 4)\n\n    This also supports a more advanced usage, where the `classmethod`\n    implementation can be written separately.  If the class's *metaclass*\n    has a method of the same name as the `sharedmethod`, the version on\n    the metaclass is delegated to::\n\n        >>> class ExampleMeta(type):\n        ...     def identify(self):\n        ...         print('this implements the {0}.identify '\n        ...               'classmethod'.format(self.__name__))\n        ...\n        >>> class Example(metaclass=ExampleMeta):\n        ...     @sharedmethod\n        ...     def identify(self):\n        ...         print('this implements the instancemethod')\n        ...\n        >>> Example().identify()\n        this implements the instancemethod\n        >>> Example.identify()\n        this implements the Example.identify classmethod\n    ","endLoc":866,"id":10438,"nodeType":"Class","startLoc":802,"text":"class sharedmethod(classmethod):\n    \"\"\"\n    This is a method decorator that allows both an instancemethod and a\n    `classmethod` to share the same name.\n\n    When using `sharedmethod` on a method defined in a class's body, it\n    may be called on an instance, or on a class.  In the former case it\n    behaves like a normal instance method (a reference to the instance is\n    automatically passed as the first ``self`` argument of the method)::\n\n        >>> class Example:\n        ...     @sharedmethod\n        ...     def identify(self, *args):\n        ...         print('self was', self)\n        ...         print('additional args were', args)\n        ...\n        >>> ex = Example()\n        >>> ex.identify(1, 2)\n        self was <astropy.utils.decorators.Example object at 0x...>\n        additional args were (1, 2)\n\n    In the latter case, when the `sharedmethod` is called directly from a\n    class, it behaves like a `classmethod`::\n\n        >>> Example.identify(3, 4)\n        self was <class 'astropy.utils.decorators.Example'>\n        additional args were (3, 4)\n\n    This also supports a more advanced usage, where the `classmethod`\n    implementation can be written separately.  If the class's *metaclass*\n    has a method of the same name as the `sharedmethod`, the version on\n    the metaclass is delegated to::\n\n        >>> class ExampleMeta(type):\n        ...     def identify(self):\n        ...         print('this implements the {0}.identify '\n        ...               'classmethod'.format(self.__name__))\n        ...\n        >>> class Example(metaclass=ExampleMeta):\n        ...     @sharedmethod\n        ...     def identify(self):\n        ...         print('this implements the instancemethod')\n        ...\n        >>> Example().identify()\n        this implements the instancemethod\n        >>> Example.identify()\n        this implements the Example.identify classmethod\n    \"\"\"\n\n    def __get__(self, obj, objtype=None):\n        if obj is None:\n            mcls = type(objtype)\n            clsmeth = getattr(mcls, self.__func__.__name__, None)\n            if callable(clsmeth):\n                func = clsmeth\n            else:\n                func = self.__func__\n\n            return self._make_method(func, objtype)\n        else:\n            return self._make_method(self.__func__, obj)\n\n    @staticmethod\n    def _make_method(func, instance):\n        return types.MethodType(func, instance)"},{"col":0,"comment":"null","endLoc":194,"header":"def helper_frexp(f, unit)","id":10439,"name":"helper_frexp","nodeType":"Function","startLoc":189,"text":"def helper_frexp(f, unit):\n    if not unit.is_unity():\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"unscaled dimensionless quantities\"\n                            .format(f.__name__))\n    return [None], (None, None)"},{"col":4,"comment":"null","endLoc":862,"header":"def __get__(self, obj, objtype=None)","id":10440,"name":"__get__","nodeType":"Function","startLoc":851,"text":"def __get__(self, obj, objtype=None):\n        if obj is None:\n            mcls = type(objtype)\n            clsmeth = getattr(mcls, self.__func__.__name__, None)\n            if callable(clsmeth):\n                func = clsmeth\n            else:\n                func = self.__func__\n\n            return self._make_method(func, objtype)\n        else:\n            return self._make_method(self.__func__, obj)"},{"col":4,"comment":"null","endLoc":586,"header":"def __truediv__(self, other)","id":10441,"name":"__truediv__","nodeType":"Function","startLoc":581,"text":"def __truediv__(self, other):\n        if self.unit.physical_unit == dimensionless_unscaled:\n            return self._function_view / other\n\n        raise UnitTypeError(\"Cannot divide function quantities which \"\n                            \"are not dimensionless by anything.\")"},{"col":4,"comment":"null","endLoc":593,"header":"def __rtruediv__(self, other)","id":10442,"name":"__rtruediv__","nodeType":"Function","startLoc":588,"text":"def __rtruediv__(self, other):\n        if self.unit.physical_unit == dimensionless_unscaled:\n            return self._function_view.__rtruediv__(other)\n\n        raise UnitTypeError(\"Cannot divide function quantities which \"\n                            \"are not dimensionless into anything.\")"},{"col":0,"comment":"null","endLoc":209,"header":"def helper_division(f, unit1, unit2)","id":10443,"name":"helper_division","nodeType":"Function","startLoc":208,"text":"def helper_division(f, unit1, unit2):\n    return [None, None], _d(unit1) / _d(unit2)"},{"attributeType":"null","col":8,"comment":"null","endLoc":147,"id":10444,"name":"assignments","nodeType":"Attribute","startLoc":147,"text":"self.assignments"},{"col":0,"comment":"null","endLoc":187,"header":"@function_helper(helps={\n    np.copy, np.asfarray, np.real_if_close, np.sort_complex, np.resize,\n    np.fft.fft, np.fft.ifft, np.fft.rfft, np.fft.irfft,\n    np.fft.fft2, np.fft.ifft2, np.fft.rfft2, np.fft.irfft2,\n    np.fft.fftn, np.fft.ifftn, np.fft.rfftn, np.fft.irfftn,\n    np.fft.hfft, np.fft.ihfft,\n    np.linalg.eigvals, np.linalg.eigvalsh})\ndef invariant_a_helper(a, *args, **kwargs)","id":10445,"name":"invariant_a_helper","nodeType":"Function","startLoc":179,"text":"@function_helper(helps={\n    np.copy, np.asfarray, np.real_if_close, np.sort_complex, np.resize,\n    np.fft.fft, np.fft.ifft, np.fft.rfft, np.fft.irfft,\n    np.fft.fft2, np.fft.ifft2, np.fft.rfft2, np.fft.irfft2,\n    np.fft.fftn, np.fft.ifftn, np.fft.rfftn, np.fft.irfftn,\n    np.fft.hfft, np.fft.ihfft,\n    np.linalg.eigvals, np.linalg.eigvalsh})\ndef invariant_a_helper(a, *args, **kwargs):\n    return (a.view(np.ndarray),) + args, kwargs, a.unit, None"},{"col":0,"comment":"null","endLoc":60,"header":"def helper_s2p(f, unit1, unit2, unit3)","id":10446,"name":"helper_s2p","nodeType":"Function","startLoc":52,"text":"def helper_s2p(f, unit1, unit2, unit3):\n    from astropy.units.si import radian\n    try:\n        return [get_converter(unit1, radian),\n                get_converter(unit2, radian), None], unit3\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))"},{"col":4,"comment":"Do a comparison between self and other, raising UnitsError when\n        other cannot be converted to self because it has different physical\n        unit, and returning NotImplemented when there are other errors.","endLoc":615,"header":"def _comparison(self, other, comparison_func)","id":10447,"name":"_comparison","nodeType":"Function","startLoc":595,"text":"def _comparison(self, other, comparison_func):\n        \"\"\"Do a comparison between self and other, raising UnitsError when\n        other cannot be converted to self because it has different physical\n        unit, and returning NotImplemented when there are other errors.\"\"\"\n        try:\n            # will raise a UnitsError if physical units not equivalent\n            other_in_own_unit = self._to_own_unit(other, check_precision=False)\n        except UnitsError as exc:\n            if self.unit.physical_unit != dimensionless_unscaled:\n                raise exc\n\n            try:\n                other_in_own_unit = self._function_view._to_own_unit(\n                    other, check_precision=False)\n            except Exception:\n                raise exc\n\n        except Exception:\n            return NotImplemented\n\n        return comparison_func(other_in_own_unit)"},{"col":0,"comment":"null","endLoc":222,"header":"def helper_power(f, unit1, unit2)","id":10448,"name":"helper_power","nodeType":"Function","startLoc":212,"text":"def helper_power(f, unit1, unit2):\n    # TODO: find a better way to do this, currently need to signal that one\n    # still needs to raise power of unit1 in main code\n    if unit2 is None:\n        return [None, None], False\n\n    try:\n        return [None, get_converter(unit2, dimensionless_unscaled)], False\n    except UnitsError:\n        raise UnitTypeError(\"Can only raise something to a \"\n                            \"dimensionless quantity\")"},{"col":4,"comment":"null","endLoc":293,"header":"def __rmul__(self, other)","id":10449,"name":"__rmul__","nodeType":"Function","startLoc":292,"text":"def __rmul__(self, other):\n        return self.__mul__(other)"},{"col":4,"comment":"null","endLoc":866,"header":"@staticmethod\n    def _make_method(func, instance)","id":10450,"name":"_make_method","nodeType":"Function","startLoc":864,"text":"@staticmethod\n    def _make_method(func, instance):\n        return types.MethodType(func, instance)"},{"col":0,"comment":"null","endLoc":230,"header":"def helper_ldexp(f, unit1, unit2)","id":10451,"name":"helper_ldexp","nodeType":"Function","startLoc":225,"text":"def helper_ldexp(f, unit1, unit2):\n    if unit2 is not None:\n        raise TypeError(\"Cannot use ldexp with a quantity \"\n                        \"as second argument.\")\n    else:\n        return [None, None], _d(unit1)"},{"col":0,"comment":"\n    Used to mark a public attribute as deprecated.  This creates a\n    property that will warn when the given attribute name is accessed.\n    To prevent the warning (i.e. for internal code), use the private\n    name for the attribute by prepending an underscore\n    (i.e. ``self._name``).\n\n    Parameters\n    ----------\n    name : str\n        The name of the deprecated attribute.\n\n    since : str\n        The release at which this API became deprecated.  This is\n        required.\n\n    message : str, optional\n        Override the default deprecation message.  The format\n        specifier ``name`` may be used for the name of the attribute,\n        and ``alternative`` may be used in the deprecation message\n        to insert the name of an alternative to the deprecated\n        function.\n\n    alternative : str, optional\n        An alternative attribute that the user may use in place of the\n        deprecated attribute.  The deprecation warning will tell the\n        user about this alternative if provided.\n\n    pending : bool, optional\n        If True, uses a AstropyPendingDeprecationWarning instead of\n        ``warning_type``.\n\n    warning_type : Warning\n        Warning to be issued.\n        Default is `~astropy.utils.exceptions.AstropyDeprecationWarning`.\n\n    Examples\n    --------\n\n    ::\n\n        class MyClass:\n            # Mark the old_name as deprecated\n            old_name = misc.deprecated_attribute('old_name', '0.1')\n\n            def method(self):\n                self._old_name = 42\n    ","endLoc":277,"header":"def deprecated_attribute(name, since, message=None, alternative=None,\n                         pending=False, warning_type=AstropyDeprecationWarning)","id":10452,"name":"deprecated_attribute","nodeType":"Function","startLoc":208,"text":"def deprecated_attribute(name, since, message=None, alternative=None,\n                         pending=False, warning_type=AstropyDeprecationWarning):\n    \"\"\"\n    Used to mark a public attribute as deprecated.  This creates a\n    property that will warn when the given attribute name is accessed.\n    To prevent the warning (i.e. for internal code), use the private\n    name for the attribute by prepending an underscore\n    (i.e. ``self._name``).\n\n    Parameters\n    ----------\n    name : str\n        The name of the deprecated attribute.\n\n    since : str\n        The release at which this API became deprecated.  This is\n        required.\n\n    message : str, optional\n        Override the default deprecation message.  The format\n        specifier ``name`` may be used for the name of the attribute,\n        and ``alternative`` may be used in the deprecation message\n        to insert the name of an alternative to the deprecated\n        function.\n\n    alternative : str, optional\n        An alternative attribute that the user may use in place of the\n        deprecated attribute.  The deprecation warning will tell the\n        user about this alternative if provided.\n\n    pending : bool, optional\n        If True, uses a AstropyPendingDeprecationWarning instead of\n        ``warning_type``.\n\n    warning_type : Warning\n        Warning to be issued.\n        Default is `~astropy.utils.exceptions.AstropyDeprecationWarning`.\n\n    Examples\n    --------\n\n    ::\n\n        class MyClass:\n            # Mark the old_name as deprecated\n            old_name = misc.deprecated_attribute('old_name', '0.1')\n\n            def method(self):\n                self._old_name = 42\n    \"\"\"\n    private_name = '_' + name\n\n    specific_deprecated = deprecated(since, name=name, obj_type='attribute',\n                                     message=message, alternative=alternative,\n                                     pending=pending,\n                                     warning_type=warning_type)\n\n    @specific_deprecated\n    def get(self):\n        return getattr(self, private_name)\n\n    @specific_deprecated\n    def set(self, val):\n        setattr(self, private_name, val)\n\n    @specific_deprecated\n    def delete(self):\n        delattr(self, private_name)\n\n    return property(get, set, delete)"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":10453,"name":"__all__","nodeType":"Attribute","startLoc":18,"text":"__all__"},{"col":0,"comment":"null","endLoc":65,"header":"def helper_c2s(f, unit1)","id":10454,"name":"helper_c2s","nodeType":"Function","startLoc":63,"text":"def helper_c2s(f, unit1):\n    from astropy.units.si import radian\n    return [None], (radian, radian)"},{"col":0,"comment":"null","endLoc":70,"header":"def helper_p2s(f, unit1)","id":10455,"name":"helper_p2s","nodeType":"Function","startLoc":68,"text":"def helper_p2s(f, unit1):\n    from astropy.units.si import radian\n    return [None], (radian, radian, unit1)"},{"col":0,"comment":"null","endLoc":82,"header":"def helper_gc2gd(f, nounit, unit1)","id":10456,"name":"helper_gc2gd","nodeType":"Function","startLoc":73,"text":"def helper_gc2gd(f, nounit, unit1):\n    from astropy.units.si import m, radian\n    if nounit is not None:\n        raise UnitTypeError(\"ellipsoid cannot be a quantity.\")\n    try:\n        return [None, get_converter(unit1, m)], (radian, radian, m, None)\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to \"\n                            \"quantities with length units\"\n                            .format(f.__name__))"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":10457,"name":"_NotFound","nodeType":"Attribute","startLoc":22,"text":"_NotFound"},{"col":0,"comment":"","endLoc":3,"header":"decorators.py#<anonymous>","id":10458,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"Sundry function and class decorators.\"\"\"\n\n__all__ = ['classproperty', 'deprecated', 'deprecated_attribute',\n           'deprecated_renamed_argument', 'format_doc',\n           'lazyproperty', 'sharedmethod']\n\n_NotFound = object()"},{"fileName":"exceptions.py","filePath":"astropy/utils","id":10459,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module contains errors/exceptions and warnings of general use for\nastropy. Exceptions that are specific to a given subpackage should *not* be\nhere, but rather in the particular subpackage.\n\"\"\"\n\n# TODO: deprecate these.  This cannot be trivially done with\n# astropy.utils.decorators.deprecate, since that module needs the exceptions\n# here, leading to circular import problems.\nfrom erfa import ErfaError, ErfaWarning  # noqa\n\n\n__all__ = [\n    'AstropyWarning',\n    'AstropyUserWarning',\n    'AstropyDeprecationWarning',\n    'AstropyPendingDeprecationWarning',\n    'AstropyBackwardsIncompatibleChangeWarning',\n    'DuplicateRepresentationWarning',\n    'NoValue']\n\n\nclass AstropyWarning(Warning):\n    \"\"\"\n    The base warning class from which all Astropy warnings should inherit.\n\n    Any warning inheriting from this class is handled by the Astropy logger.\n    \"\"\"\n\n\nclass AstropyUserWarning(UserWarning, AstropyWarning):\n    \"\"\"\n    The primary warning class for Astropy.\n\n    Use this if you do not need a specific sub-class.\n    \"\"\"\n\n\nclass AstropyDeprecationWarning(AstropyWarning):\n    \"\"\"\n    A warning class to indicate a deprecated feature.\n    \"\"\"\n\n\nclass AstropyPendingDeprecationWarning(PendingDeprecationWarning, AstropyWarning):\n    \"\"\"\n    A warning class to indicate a soon-to-be deprecated feature.\n    \"\"\"\n\n\nclass AstropyBackwardsIncompatibleChangeWarning(AstropyWarning):\n    \"\"\"\n    A warning class indicating a change in astropy that is incompatible\n    with previous versions.\n\n    The suggested procedure is to issue this warning for the version in\n    which the change occurs, and remove it for all following versions.\n    \"\"\"\n\n\nclass DuplicateRepresentationWarning(AstropyWarning):\n    \"\"\"\n    A warning class indicating a representation name was already registered\n    \"\"\"\n\n\nclass _NoValue:\n    \"\"\"Special keyword value.\n\n    This class may be used as the default value assigned to a\n    deprecated keyword in order to check if it has been given a user\n    defined value.\n    \"\"\"\n    def __repr__(self):\n        return 'astropy.utils.exceptions.NoValue'\n\n\nNoValue = _NoValue()\n"},{"col":4,"comment":"null","endLoc":303,"header":"def __imul__(self, other)","id":10460,"name":"__imul__","nodeType":"Function","startLoc":295,"text":"def __imul__(self, other):\n        if isinstance(other, numbers.Number):\n            new_physical_unit = self.unit.physical_unit**other\n            function_view = self._function_view\n            function_view *= other\n            self._set_unit(self.unit._copy(new_physical_unit))\n            return self\n        else:\n            return super().__imul__(other)"},{"col":0,"comment":"null","endLoc":192,"header":"@function_helper(helps={np.tril, np.triu})\ndef invariant_m_helper(m, *args, **kwargs)","id":10461,"name":"invariant_m_helper","nodeType":"Function","startLoc":190,"text":"@function_helper(helps={np.tril, np.triu})\ndef invariant_m_helper(m, *args, **kwargs):\n    return (m.view(np.ndarray),) + args, kwargs, m.unit, None"},{"col":0,"comment":"null","endLoc":238,"header":"def helper_copysign(f, unit1, unit2)","id":10462,"name":"helper_copysign","nodeType":"Function","startLoc":233,"text":"def helper_copysign(f, unit1, unit2):\n    # if first arg is not a quantity, just return plain array\n    if unit1 is None:\n        return [None, None], None\n    else:\n        return [None, None], unit1"},{"col":0,"comment":"null","endLoc":248,"header":"def helper_heaviside(f, unit1, unit2)","id":10463,"name":"helper_heaviside","nodeType":"Function","startLoc":241,"text":"def helper_heaviside(f, unit1, unit2):\n    try:\n        converter2 = (get_converter(unit2, dimensionless_unscaled)\n                      if unit2 is not None else None)\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply 'heaviside' function with a \"\n                            \"dimensionless second argument.\")\n    return ([None, converter2], dimensionless_unscaled)"},{"col":4,"comment":"null","endLoc":621,"header":"def __eq__(self, other)","id":10464,"name":"__eq__","nodeType":"Function","startLoc":617,"text":"def __eq__(self, other):\n        try:\n            return self._comparison(other, self.value.__eq__)\n        except UnitsError:\n            return False"},{"col":0,"comment":"null","endLoc":197,"header":"@function_helper(helps={np.fft.fftshift, np.fft.ifftshift})\ndef invariant_x_helper(x, *args, **kwargs)","id":10465,"name":"invariant_x_helper","nodeType":"Function","startLoc":195,"text":"@function_helper(helps={np.fft.fftshift, np.fft.ifftshift})\ndef invariant_x_helper(x, *args, **kwargs):\n    return (x.view(np.ndarray),) + args, kwargs, x.unit, None"},{"col":0,"comment":"null","endLoc":271,"header":"def helper_twoarg_comparison(f, unit1, unit2)","id":10466,"name":"helper_twoarg_comparison","nodeType":"Function","startLoc":269,"text":"def helper_twoarg_comparison(f, unit1, unit2):\n    converters, _ = get_converters_and_unit(f, unit1, unit2)\n    return converters, None"},{"col":4,"comment":"null","endLoc":627,"header":"def __ne__(self, other)","id":10467,"name":"__ne__","nodeType":"Function","startLoc":623,"text":"def __ne__(self, other):\n        try:\n            return self._comparison(other, self.value.__ne__)\n        except UnitsError:\n            return True"},{"col":0,"comment":"null","endLoc":213,"header":"@function_helper(helps={np.ones_like, np.zeros_like})\ndef like_helper(a, *args, **kwargs)","id":10468,"name":"like_helper","nodeType":"Function","startLoc":209,"text":"@function_helper(helps={np.ones_like, np.zeros_like})\ndef like_helper(a, *args, **kwargs):\n    subok = args[2] if len(args) > 2 else kwargs.pop('subok', True)\n    unit = a.unit if subok else None\n    return (a.view(np.ndarray),) + args, kwargs, unit, None"},{"col":0,"comment":"null","endLoc":277,"header":"def helper_twoarg_invtrig(f, unit1, unit2)","id":10469,"name":"helper_twoarg_invtrig","nodeType":"Function","startLoc":274,"text":"def helper_twoarg_invtrig(f, unit1, unit2):\n    from astropy.units.si import radian\n    converters, _ = get_converters_and_unit(f, unit1, unit2)\n    return converters, radian"},{"col":4,"comment":"null","endLoc":630,"header":"def __gt__(self, other)","id":10470,"name":"__gt__","nodeType":"Function","startLoc":629,"text":"def __gt__(self, other):\n        return self._comparison(other, self.value.__gt__)"},{"col":0,"comment":"null","endLoc":282,"header":"def helper_twoarg_floor_divide(f, unit1, unit2)","id":10471,"name":"helper_twoarg_floor_divide","nodeType":"Function","startLoc":280,"text":"def helper_twoarg_floor_divide(f, unit1, unit2):\n    converters, _ = get_converters_and_unit(f, unit1, unit2)\n    return converters, dimensionless_unscaled"},{"className":"AstropyBackwardsIncompatibleChangeWarning","col":0,"comment":"\n    A warning class indicating a change in astropy that is incompatible\n    with previous versions.\n\n    The suggested procedure is to issue this warning for the version in\n    which the change occurs, and remove it for all following versions.\n    ","endLoc":59,"id":10472,"nodeType":"Class","startLoc":52,"text":"class AstropyBackwardsIncompatibleChangeWarning(AstropyWarning):\n    \"\"\"\n    A warning class indicating a change in astropy that is incompatible\n    with previous versions.\n\n    The suggested procedure is to issue this warning for the version in\n    which the change occurs, and remove it for all following versions.\n    \"\"\""},{"col":4,"comment":"null","endLoc":633,"header":"def __ge__(self, other)","id":10473,"name":"__ge__","nodeType":"Function","startLoc":632,"text":"def __ge__(self, other):\n        return self._comparison(other, self.value.__ge__)"},{"className":"DuplicateRepresentationWarning","col":0,"comment":"\n    A warning class indicating a representation name was already registered\n    ","endLoc":65,"id":10474,"nodeType":"Class","startLoc":62,"text":"class DuplicateRepresentationWarning(AstropyWarning):\n    \"\"\"\n    A warning class indicating a representation name was already registered\n    \"\"\""},{"col":0,"comment":"null","endLoc":224,"header":"@function_helper\ndef sinc(x)","id":10475,"name":"sinc","nodeType":"Function","startLoc":216,"text":"@function_helper\ndef sinc(x):\n    from astropy.units.si import radian\n    try:\n        x = x.to_value(radian)\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply 'sinc' function to \"\n                            \"quantities with angle units\")\n    return (x,), {}, dimensionless_unscaled, None"},{"col":0,"comment":"null","endLoc":287,"header":"def helper_divmod(f, unit1, unit2)","id":10476,"name":"helper_divmod","nodeType":"Function","startLoc":285,"text":"def helper_divmod(f, unit1, unit2):\n    converters, result_unit = get_converters_and_unit(f, unit1, unit2)\n    return converters, (dimensionless_unscaled, result_unit)"},{"className":"_NoValue","col":0,"comment":"Special keyword value.\n\n    This class may be used as the default value assigned to a\n    deprecated keyword in order to check if it has been given a user\n    defined value.\n    ","endLoc":76,"id":10477,"nodeType":"Class","startLoc":68,"text":"class _NoValue:\n    \"\"\"Special keyword value.\n\n    This class may be used as the default value assigned to a\n    deprecated keyword in order to check if it has been given a user\n    defined value.\n    \"\"\"\n    def __repr__(self):\n        return 'astropy.utils.exceptions.NoValue'"},{"col":4,"comment":"null","endLoc":76,"header":"def __repr__(self)","id":10478,"name":"__repr__","nodeType":"Function","startLoc":75,"text":"def __repr__(self):\n        return 'astropy.utils.exceptions.NoValue'"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":10479,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"attributeType":"_NoValue","col":0,"comment":"null","endLoc":79,"id":10480,"name":"NoValue","nodeType":"Attribute","startLoc":79,"text":"NoValue"},{"col":4,"comment":"null","endLoc":636,"header":"def __lt__(self, other)","id":10481,"name":"__lt__","nodeType":"Function","startLoc":635,"text":"def __lt__(self, other):\n        return self._comparison(other, self.value.__lt__)"},{"col":0,"comment":"null","endLoc":320,"header":"def helper_clip(f, unit1, unit2, unit3)","id":10482,"name":"helper_clip","nodeType":"Function","startLoc":290,"text":"def helper_clip(f, unit1, unit2, unit3):\n    # Treat the array being clipped as primary.\n    converters = [None]\n    if unit1 is None:\n        result_unit = dimensionless_unscaled\n        try:\n            converters += [(None if unit is None else\n                            get_converter(unit, dimensionless_unscaled))\n                           for unit in (unit2, unit3)]\n        except UnitsError:\n            raise UnitConversionError(\n                \"Can only apply '{}' function to quantities with \"\n                \"compatible dimensions\".format(f.__name__))\n\n    else:\n        result_unit = unit1\n        for unit in unit2, unit3:\n            try:\n                converter = get_converter(_d(unit), result_unit)\n            except UnitsError:\n                if unit is None:\n                    # special case: OK if unitless number is zero, inf, nan\n                    converters.append(False)\n                else:\n                    raise UnitConversionError(\n                        \"Can only apply '{}' function to quantities with \"\n                        \"compatible dimensions\".format(f.__name__))\n            else:\n                converters.append(converter)\n\n    return converters, result_unit"},{"col":0,"comment":"","endLoc":6,"header":"exceptions.py#<anonymous>","id":10483,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module contains errors/exceptions and warnings of general use for\nastropy. Exceptions that are specific to a given subpackage should *not* be\nhere, but rather in the particular subpackage.\n\"\"\"\n\n__all__ = [\n    'AstropyWarning',\n    'AstropyUserWarning',\n    'AstropyDeprecationWarning',\n    'AstropyPendingDeprecationWarning',\n    'AstropyBackwardsIncompatibleChangeWarning',\n    'DuplicateRepresentationWarning',\n    'NoValue']\n\nNoValue = _NoValue()"},{"fileName":"data_info.py","filePath":"astropy/utils","id":10484,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"This module contains functions and methods that relate to the DataInfo class\nwhich provides a container for informational attributes as well as summary info\nmethods.\n\nA DataInfo object is attached to the Quantity, SkyCoord, and Time classes in\nastropy.  Here it allows those classes to be used in Tables and uniformly carry\ntable column attributes such as name, format, dtype, meta, and description.\n\"\"\"\n\n# Note: these functions and classes are tested extensively in astropy table\n# tests via their use in providing mixin column info, and in\n# astropy/tests/test_info for providing table and column info summary data.\n\n\nimport os\nimport re\nimport sys\nimport weakref\nimport warnings\nfrom io import StringIO\nfrom copy import deepcopy\nfrom functools import partial\nfrom collections import OrderedDict\nfrom contextlib import contextmanager\n\nimport numpy as np\n\nfrom . import metadata\n\n\n__all__ = ['data_info_factory', 'dtype_info_name', 'BaseColumnInfo',\n           'DataInfo', 'MixinInfo', 'ParentDtypeInfo']\n\n# Tuple of filterwarnings kwargs to ignore when calling info\nIGNORE_WARNINGS = (dict(category=RuntimeWarning, message='All-NaN|'\n                        'Mean of empty slice|Degrees of freedom <= 0|'\n                        'invalid value encountered in sqrt'),)\n\n\n@contextmanager\ndef serialize_context_as(context):\n    \"\"\"Set context for serialization.\n\n    This will allow downstream code to understand the context in which a column\n    is being serialized.  Objects like Time or SkyCoord will have different\n    default serialization representations depending on context.\n\n    Parameters\n    ----------\n    context : str\n        Context name, e.g. 'fits', 'hdf5', 'parquet', 'ecsv', 'yaml'\n    \"\"\"\n    old_context = BaseColumnInfo._serialize_context\n    BaseColumnInfo._serialize_context = context\n    try:\n        yield\n    finally:\n        BaseColumnInfo._serialize_context = old_context\n\n\ndef dtype_info_name(dtype):\n    \"\"\"Return a human-oriented string name of the ``dtype`` arg.\n    This can be use by astropy methods that present type information about\n    a data object.\n\n    The output is mostly equivalent to ``dtype.name`` which takes the form\n    <type_name>[B] where <type_name> is like ``int`` or ``bool`` and [B] is an\n    optional number of bits which gets included only for numeric types.\n\n    The output is shown below for ``bytes`` and ``str`` types, with <N> being\n    the number of characters. This representation corresponds to the Python\n    type that matches the dtype::\n\n      Numpy          S<N>      U<N>\n      Python      bytes<N>   str<N>\n\n    Parameters\n    ----------\n    dtype : str, `~numpy.dtype`, type\n        Input as an object that can be converted via :class:`numpy.dtype`.\n\n    Returns\n    -------\n    dtype_info_name : str\n        String name of ``dtype``\n    \"\"\"\n    dtype = np.dtype(dtype)\n    if dtype.kind in ('S', 'U'):\n        type_name = 'bytes' if dtype.kind == 'S' else 'str'\n        length = re.search(r'(\\d+)', dtype.str).group(1)\n        out = type_name + length\n    else:\n        out = dtype.name\n\n    return out\n\n\ndef data_info_factory(names, funcs):\n    \"\"\"\n    Factory to create a function that can be used as an ``option``\n    for outputting data object summary information.\n\n    Examples\n    --------\n    >>> from astropy.utils.data_info import data_info_factory\n    >>> from astropy.table import Column\n    >>> c = Column([4., 3., 2., 1.])\n    >>> mystats = data_info_factory(names=['min', 'median', 'max'],\n    ...                             funcs=[np.min, np.median, np.max])\n    >>> c.info(option=mystats)\n    min = 1\n    median = 2.5\n    max = 4\n    n_bad = 0\n    length = 4\n\n    Parameters\n    ----------\n    names : list\n        List of information attribute names\n    funcs : list\n        List of functions that compute the corresponding information attribute\n\n    Returns\n    -------\n    func : function\n        Function that can be used as a data info option\n    \"\"\"\n    def func(dat):\n        outs = []\n        for name, func in zip(names, funcs):\n            try:\n                if isinstance(func, str):\n                    out = getattr(dat, func)()\n                else:\n                    out = func(dat)\n            except Exception:\n                outs.append('--')\n            else:\n                try:\n                    outs.append(f'{out:g}')\n                except (TypeError, ValueError):\n                    outs.append(str(out))\n\n        return OrderedDict(zip(names, outs))\n    return func\n\n\ndef _get_obj_attrs_map(obj, attrs):\n    \"\"\"\n    Get the values for object ``attrs`` and return as a dict.  This\n    ignores any attributes that are None.  In the context of serializing\n    the supported core astropy classes this conversion will succeed and\n    results in more succinct and less python-specific YAML.\n    \"\"\"\n    out = {}\n    for attr in attrs:\n        val = getattr(obj, attr, None)\n\n        if val is not None:\n            out[attr] = val\n    return out\n\n\ndef _get_data_attribute(dat, attr=None):\n    \"\"\"\n    Get a data object attribute for the ``attributes`` info summary method\n    \"\"\"\n    if attr == 'class':\n        val = type(dat).__name__\n    elif attr == 'dtype':\n        val = dtype_info_name(dat.info.dtype)\n    elif attr == 'shape':\n        datshape = dat.shape[1:]\n        val = datshape if datshape else ''\n    else:\n        val = getattr(dat.info, attr)\n    if val is None:\n        val = ''\n    return str(val)\n\n\nclass InfoAttribute:\n    def __init__(self, attr, default=None):\n        self.attr = attr\n        self.default = default\n\n    def __get__(self, instance, owner_cls):\n        if instance is None:\n            return self\n\n        return instance._attrs.get(self.attr, self.default)\n\n    def __set__(self, instance, value):\n        if instance is None:\n            # This is an unbound descriptor on the class\n            raise ValueError('cannot set unbound descriptor')\n\n        instance._attrs[self.attr] = value\n\n\nclass ParentAttribute:\n    def __init__(self, attr):\n        self.attr = attr\n\n    def __get__(self, instance, owner_cls):\n        if instance is None:\n            return self\n\n        return getattr(instance._parent, self.attr)\n\n    def __set__(self, instance, value):\n        if instance is None:\n            # This is an unbound descriptor on the class\n            raise ValueError('cannot set unbound descriptor')\n\n        setattr(instance._parent, self.attr, value)\n\n\nclass DataInfoMeta(type):\n    def __new__(mcls, name, bases, dct):\n        # Ensure that we do not gain a __dict__, which would mean\n        # arbitrary attributes could be set.\n        dct.setdefault('__slots__', [])\n        return super().__new__(mcls, name, bases, dct)\n\n    def __init__(cls, name, bases, dct):\n        super().__init__(name, bases, dct)\n\n        # Define default getters/setters for attributes, if needed.\n        for attr in cls.attr_names:\n            if attr not in dct:\n                # If not defined explicitly for this class, did any of\n                # its superclasses define it, and, if so, was this an\n                # automatically defined look-up-on-parent attribute?\n                cls_attr = getattr(cls, attr, None)\n                if attr in cls.attrs_from_parent:\n                    # If the attribute is supposed to be stored on the parent,\n                    # and that is stated by this class yet it was not the case\n                    # on the superclass, override it.\n                    if 'attrs_from_parent' in dct and not isinstance(cls_attr, ParentAttribute):\n                        setattr(cls, attr, ParentAttribute(attr))\n                elif not cls_attr or isinstance(cls_attr, ParentAttribute):\n                    # If the attribute is not meant to be stored on the parent,\n                    # and if it was not defined already or was previously defined\n                    # as an attribute on the parent, define a regular\n                    # look-up-on-info attribute\n                    setattr(cls, attr,\n                            InfoAttribute(attr, cls._attr_defaults.get(attr)))\n\n\nclass DataInfo(metaclass=DataInfoMeta):\n    \"\"\"\n    Descriptor that data classes use to add an ``info`` attribute for storing\n    data attributes in a uniform and portable way.  Note that it *must* be\n    called ``info`` so that the DataInfo() object can be stored in the\n    ``instance`` using the ``info`` key.  Because owner_cls.x is a descriptor,\n    Python doesn't use __dict__['x'] normally, and the descriptor can safely\n    store stuff there.  Thanks to\n    https://nbviewer.jupyter.org/urls/gist.github.com/ChrisBeaumont/5758381/raw/descriptor_writeup.ipynb\n    for this trick that works for non-hashable classes.\n\n    Parameters\n    ----------\n    bound : bool\n        If True this is a descriptor attribute in a class definition, else it\n        is a DataInfo() object that is bound to a data object instance. Default is False.\n    \"\"\"\n    _stats = ['mean', 'std', 'min', 'max']\n    attrs_from_parent = set()\n    attr_names = set(['name', 'unit', 'dtype', 'format', 'description', 'meta'])\n    _attr_defaults = {'dtype': np.dtype('O')}\n    _attrs_no_copy = set()\n    _info_summary_attrs = ('dtype', 'shape', 'unit', 'format', 'description', 'class')\n    __slots__ = ['_parent_cls', '_parent_ref', '_attrs']\n    # This specifies the list of object attributes which must be stored in\n    # order to re-create the object after serialization.  This is independent\n    # of normal `info` attributes like name or description.  Subclasses will\n    # generally either define this statically (QuantityInfo) or dynamically\n    # (SkyCoordInfo).  These attributes may be scalars or arrays.  If arrays\n    # that match the object length they will be serialized as an independent\n    # column.\n    _represent_as_dict_attrs = ()\n\n    # This specifies attributes which are to be provided to the class\n    # initializer as ordered args instead of keyword args.  This is needed\n    # for Quantity subclasses where the keyword for data varies (e.g.\n    # between Quantity and Angle).\n    _construct_from_dict_args = ()\n\n    # This specifies the name of an attribute which is the \"primary\" data.\n    # Then when representing as columns\n    # (table.serialize._represent_mixin_as_column) the output for this\n    # attribute will be written with the just name of the mixin instead of the\n    # usual \"<name>.<attr>\".\n    _represent_as_dict_primary_data = None\n\n    def __init__(self, bound=False):\n        # If bound to a data object instance then create the dict of attributes\n        # which stores the info attribute values. Default of None for \"unset\"\n        # except for dtype where the default is object.\n        if bound:\n            self._attrs = {}\n\n    @property\n    def _parent(self):\n        try:\n            parent = self._parent_ref()\n        except AttributeError:\n            return None\n\n        if parent is None:\n            raise AttributeError(\"\"\"\\\nfailed to access \"info\" attribute on a temporary object.\n\nIt looks like you have done something like ``col[3:5].info`` or\n``col.quantity.info``, i.e.  you accessed ``info`` from a temporary slice\nobject that only exists momentarily.  This has failed because the reference to\nthat temporary object is now lost.  Instead force a permanent reference (e.g.\n``c = col[3:5]`` followed by ``c.info``).\"\"\")\n\n        return parent\n\n    def __get__(self, instance, owner_cls):\n        if instance is None:\n            # This is an unbound descriptor on the class\n            self._parent_cls = owner_cls\n            return self\n\n        info = instance.__dict__.get('info')\n        if info is None:\n            info = instance.__dict__['info'] = self.__class__(bound=True)\n        # We set _parent_ref on every call, since if one makes copies of\n        # instances, 'info' will be copied as well, which will lose the\n        # reference.\n        info._parent_ref = weakref.ref(instance)\n        return info\n\n    def __set__(self, instance, value):\n        if instance is None:\n            # This is an unbound descriptor on the class\n            raise ValueError('cannot set unbound descriptor')\n\n        if isinstance(value, DataInfo):\n            info = instance.__dict__['info'] = self.__class__(bound=True)\n            attr_names = info.attr_names\n            if value.__class__ is self.__class__:\n                # For same class, attributes are guaranteed to be stored in\n                # _attrs, so speed matters up by not accessing defaults.\n                # Doing this before difference in for loop helps speed.\n                attr_names = attr_names & set(value._attrs)  # NOT in-place!\n            else:\n                # For different classes, copy over the attributes in common.\n                attr_names = attr_names & (value.attr_names - value._attrs_no_copy)\n\n            for attr in attr_names - info.attrs_from_parent - info._attrs_no_copy:\n                info._attrs[attr] = deepcopy(getattr(value, attr))\n\n        else:\n            raise TypeError('info must be set with a DataInfo instance')\n\n    def __getstate__(self):\n        return self._attrs\n\n    def __setstate__(self, state):\n        self._attrs = state\n\n    def _represent_as_dict(self, attrs=None):\n        \"\"\"Get the values for the parent ``attrs`` and return as a dict.\n\n        By default, uses '_represent_as_dict_attrs'.\n        \"\"\"\n        if attrs is None:\n            attrs = self._represent_as_dict_attrs\n        return _get_obj_attrs_map(self._parent, attrs)\n\n    def _construct_from_dict(self, map):\n        args = [map.pop(attr) for attr in self._construct_from_dict_args]\n        return self._parent_cls(*args, **map)\n\n    info_summary_attributes = staticmethod(\n        data_info_factory(names=_info_summary_attrs,\n                          funcs=[partial(_get_data_attribute, attr=attr)\n                                 for attr in _info_summary_attrs]))\n\n    # No nan* methods in numpy < 1.8\n    info_summary_stats = staticmethod(\n        data_info_factory(names=_stats,\n                          funcs=[getattr(np, 'nan' + stat)\n                                 for stat in _stats]))\n\n    def __call__(self, option='attributes', out=''):\n        \"\"\"\n        Write summary information about data object to the ``out`` filehandle.\n        By default this prints to standard output via sys.stdout.\n\n        The ``option`` argument specifies what type of information\n        to include.  This can be a string, a function, or a list of\n        strings or functions.  Built-in options are:\n\n        - ``attributes``: data object attributes like ``dtype`` and ``format``\n        - ``stats``: basic statistics: min, mean, and max\n\n        If a function is specified then that function will be called with the\n        data object as its single argument.  The function must return an\n        OrderedDict containing the information attributes.\n\n        If a list is provided then the information attributes will be\n        appended for each of the options, in order.\n\n        Examples\n        --------\n\n        >>> from astropy.table import Column\n        >>> c = Column([1, 2], unit='m', dtype='int32')\n        >>> c.info()\n        dtype = int32\n        unit = m\n        class = Column\n        n_bad = 0\n        length = 2\n\n        >>> c.info(['attributes', 'stats'])\n        dtype = int32\n        unit = m\n        class = Column\n        mean = 1.5\n        std = 0.5\n        min = 1\n        max = 2\n        n_bad = 0\n        length = 2\n\n        Parameters\n        ----------\n        option : str, callable, list of (str or callable)\n            Info option, defaults to 'attributes'.\n        out : file-like, None\n            Output destination, defaults to sys.stdout.  If None then the\n            OrderedDict with information attributes is returned\n\n        Returns\n        -------\n        info : `~collections.OrderedDict` or None\n            `~collections.OrderedDict` if out==None else None\n        \"\"\"\n        if out == '':\n            out = sys.stdout\n\n        dat = self._parent\n        info = OrderedDict()\n        name = dat.info.name\n        if name is not None:\n            info['name'] = name\n\n        options = option if isinstance(option, (list, tuple)) else [option]\n        for option in options:\n            if isinstance(option, str):\n                if hasattr(self, 'info_summary_' + option):\n                    option = getattr(self, 'info_summary_' + option)\n                else:\n                    raise ValueError('option={} is not an allowed information type'\n                                     .format(option))\n\n            with warnings.catch_warnings():\n                for ignore_kwargs in IGNORE_WARNINGS:\n                    warnings.filterwarnings('ignore', **ignore_kwargs)\n                info.update(option(dat))\n\n        if hasattr(dat, 'mask'):\n            n_bad = np.count_nonzero(dat.mask)\n        else:\n            try:\n                n_bad = np.count_nonzero(np.isinf(dat) | np.isnan(dat))\n            except Exception:\n                n_bad = 0\n        info['n_bad'] = n_bad\n\n        try:\n            info['length'] = len(dat)\n        except (TypeError, IndexError):\n            pass\n\n        if out is None:\n            return info\n\n        for key, val in info.items():\n            if val != '':\n                out.write(f'{key} = {val}' + os.linesep)\n\n    def __repr__(self):\n        if self._parent is None:\n            return super().__repr__()\n\n        out = StringIO()\n        self.__call__(out=out)\n        return out.getvalue()\n\n\nclass BaseColumnInfo(DataInfo):\n    \"\"\"\n    Base info class for anything that can be a column in an astropy\n    Table.  There are at least two classes that inherit from this:\n\n      ColumnInfo: for native astropy Column / MaskedColumn objects\n      MixinInfo: for mixin column objects\n\n    Note that this class is defined here so that mixins can use it\n    without importing the table package.\n    \"\"\"\n    attr_names = DataInfo.attr_names.union(['parent_table', 'indices'])\n    _attrs_no_copy = set(['parent_table', 'indices'])\n\n    # Context for serialization.  This can be set temporarily via\n    # ``serialize_context_as(context)`` context manager to allow downstream\n    # code to understand the context in which a column is being serialized.\n    # Typical values are 'fits', 'hdf5', 'parquet', 'ecsv', 'yaml'.  Objects\n    # like Time or SkyCoord will have different default serialization\n    # representations depending on context.\n    _serialize_context = None\n    __slots__ = ['_format_funcs', '_copy_indices']\n\n    @property\n    def parent_table(self):\n        value = self._attrs.get('parent_table')\n        if callable(value):\n            value = value()\n        return value\n\n    @parent_table.setter\n    def parent_table(self, parent_table):\n        if parent_table is None:\n            self._attrs.pop('parent_table', None)\n        else:\n            parent_table = weakref.ref(parent_table)\n            self._attrs['parent_table'] = parent_table\n\n    def __init__(self, bound=False):\n        super().__init__(bound=bound)\n\n        # If bound to a data object instance then add a _format_funcs dict\n        # for caching functions for print formatting.\n        if bound:\n            self._format_funcs = {}\n\n    def __set__(self, instance, value):\n        # For Table columns do not set `info` when the instance is a scalar.\n        try:\n            if not instance.shape:\n                return\n        except AttributeError:\n            pass\n\n        super().__set__(instance, value)\n\n    def iter_str_vals(self):\n        \"\"\"\n        This is a mixin-safe version of Column.iter_str_vals.\n        \"\"\"\n        col = self._parent\n        if self.parent_table is None:\n            from astropy.table.column import FORMATTER as formatter\n        else:\n            formatter = self.parent_table.formatter\n\n        _pformat_col_iter = formatter._pformat_col_iter\n        for str_val in _pformat_col_iter(col, -1, False, False, {}):\n            yield str_val\n\n    @property\n    def indices(self):\n        # Implementation note: the auto-generation as an InfoAttribute cannot\n        # be used here, since on access, one should not just return the\n        # default (empty list is this case), but set _attrs['indices'] so that\n        # if the list is appended to, it is registered here.\n        return self._attrs.setdefault('indices', [])\n\n    @indices.setter\n    def indices(self, indices):\n        self._attrs['indices'] = indices\n\n    def adjust_indices(self, index, value, col_len):\n        '''\n        Adjust info indices after column modification.\n\n        Parameters\n        ----------\n        index : slice, int, list, or ndarray\n            Element(s) of column to modify. This parameter can\n            be a single row number, a list of row numbers, an\n            ndarray of row numbers, a boolean ndarray (a mask),\n            or a column slice.\n        value : int, list, or ndarray\n            New value(s) to insert\n        col_len : int\n            Length of the column\n        '''\n        if not self.indices:\n            return\n\n        if isinstance(index, slice):\n            # run through each key in slice\n            t = index.indices(col_len)\n            keys = list(range(*t))\n        elif isinstance(index, np.ndarray) and index.dtype.kind == 'b':\n            # boolean mask\n            keys = np.where(index)[0]\n        else:  # single int\n            keys = [index]\n\n        value = np.atleast_1d(value)  # turn array(x) into array([x])\n        if value.size == 1:\n            # repeat single value\n            value = list(value) * len(keys)\n\n        for key, val in zip(keys, value):\n            for col_index in self.indices:\n                col_index.replace(key, self.name, val)\n\n    def slice_indices(self, col_slice, item, col_len):\n        '''\n        Given a sliced object, modify its indices\n        to correctly represent the slice.\n\n        Parameters\n        ----------\n        col_slice : `~astropy.table.Column` or mixin\n            Sliced object. If not a column, it must be a valid mixin, see\n            https://docs.astropy.org/en/stable/table/mixin_columns.html\n        item : slice, list, or ndarray\n            Slice used to create col_slice\n        col_len : int\n            Length of original object\n        '''\n        from astropy.table.sorted_array import SortedArray\n        if not getattr(self, '_copy_indices', True):\n            # Necessary because MaskedArray will perform a shallow copy\n            col_slice.info.indices = []\n            return col_slice\n        elif isinstance(item, slice):\n            col_slice.info.indices = [x[item] for x in self.indices]\n        elif self.indices:\n            if isinstance(item, np.ndarray) and item.dtype.kind == 'b':\n                # boolean mask\n                item = np.where(item)[0]\n            # Empirical testing suggests that recreating a BST/RBT index is\n            # more effective than relabelling when less than ~60% of\n            # the total number of rows are involved, and is in general\n            # more effective for SortedArray.\n            small = len(item) <= 0.6 * col_len\n            col_slice.info.indices = []\n            for index in self.indices:\n                if small or isinstance(index, SortedArray):\n                    new_index = index.get_slice(col_slice, item)\n                else:\n                    new_index = deepcopy(index)\n                    new_index.replace_rows(item)\n                col_slice.info.indices.append(new_index)\n\n        return col_slice\n\n    @staticmethod\n    def merge_cols_attributes(cols, metadata_conflicts, name, attrs):\n        \"\"\"\n        Utility method to merge and validate the attributes ``attrs`` for the\n        input table columns ``cols``.\n\n        Note that ``dtype`` and ``shape`` attributes are handled specially.\n        These should not be passed in ``attrs`` but will always be in the\n        returned dict of merged attributes.\n\n        Parameters\n        ----------\n        cols : list\n            List of input Table column objects\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n        attrs : list\n            List of attribute names to be merged\n\n        Returns\n        -------\n        attrs : dict\n            Of merged attributes.\n\n        \"\"\"\n        from astropy.table.np_utils import TableMergeError\n\n        def warn_str_func(key, left, right):\n            out = (\"In merged column '{}' the '{}' attribute does not match \"\n                   \"({} != {}).  Using {} for merged output\"\n                   .format(name, key, left, right, right))\n            return out\n\n        def getattrs(col):\n            return {attr: getattr(col.info, attr) for attr in attrs\n                    if getattr(col.info, attr, None) is not None}\n\n        out = getattrs(cols[0])\n        for col in cols[1:]:\n            out = metadata.merge(out, getattrs(col), metadata_conflicts=metadata_conflicts,\n                                 warn_str_func=warn_str_func)\n\n        # Output dtype is the superset of all dtypes in in_cols\n        out['dtype'] = metadata.common_dtype(cols)\n\n        # Make sure all input shapes are the same\n        uniq_shapes = set(col.shape[1:] for col in cols)\n        if len(uniq_shapes) != 1:\n            raise TableMergeError('columns have different shapes')\n        out['shape'] = uniq_shapes.pop()\n\n        # \"Merged\" output name is the supplied name\n        if name is not None:\n            out['name'] = name\n\n        return out\n\n    def get_sortable_arrays(self):\n        \"\"\"\n        Return a list of arrays which can be lexically sorted to represent\n        the order of the parent column.\n\n        The base method raises NotImplementedError and must be overridden.\n\n        Returns\n        -------\n        arrays : list of ndarray\n        \"\"\"\n        raise NotImplementedError(f'column {self.name} is not sortable')\n\n\nclass MixinInfo(BaseColumnInfo):\n\n    @property\n    def name(self):\n        return self._attrs.get('name')\n\n    @name.setter\n    def name(self, name):\n        # For mixin columns that live within a table, rename the column in the\n        # table when setting the name attribute.  This mirrors the same\n        # functionality in the BaseColumn class.\n        if self.parent_table is not None:\n            new_name = None if name is None else str(name)\n            self.parent_table.columns._rename_column(self.name, new_name)\n\n        self._attrs['name'] = name\n\n\nclass ParentDtypeInfo(MixinInfo):\n    \"\"\"Mixin that gets info.dtype from parent\"\"\"\n\n    attrs_from_parent = set(['dtype'])  # dtype and unit taken from parent\n"},{"className":"InfoAttribute","col":0,"comment":"null","endLoc":202,"id":10485,"nodeType":"Class","startLoc":186,"text":"class InfoAttribute:\n    def __init__(self, attr, default=None):\n        self.attr = attr\n        self.default = default\n\n    def __get__(self, instance, owner_cls):\n        if instance is None:\n            return self\n\n        return instance._attrs.get(self.attr, self.default)\n\n    def __set__(self, instance, value):\n        if instance is None:\n            # This is an unbound descriptor on the class\n            raise ValueError('cannot set unbound descriptor')\n\n        instance._attrs[self.attr] = value"},{"col":4,"comment":"null","endLoc":189,"header":"def __init__(self, attr, default=None)","id":10486,"name":"__init__","nodeType":"Function","startLoc":187,"text":"def __init__(self, attr, default=None):\n        self.attr = attr\n        self.default = default"},{"col":4,"comment":"null","endLoc":195,"header":"def __get__(self, instance, owner_cls)","id":10487,"name":"__get__","nodeType":"Function","startLoc":191,"text":"def __get__(self, instance, owner_cls):\n        if instance is None:\n            return self\n\n        return instance._attrs.get(self.attr, self.default)"},{"col":4,"comment":"null","endLoc":314,"header":"def __truediv__(self, other)","id":10488,"name":"__truediv__","nodeType":"Function","startLoc":305,"text":"def __truediv__(self, other):\n        # Divide by a float or a dimensionless quantity\n        if isinstance(other, numbers.Number):\n            # Dividing a log means putting the nominator into the exponent\n            # of the unit\n            new_physical_unit = self.unit.physical_unit**(1/other)\n            result = self.view(np.ndarray) / other\n            return self._new_view(result, self.unit._copy(new_physical_unit))\n        else:\n            return super().__truediv__(other)"},{"col":4,"comment":"null","endLoc":202,"header":"def __set__(self, instance, value)","id":10489,"name":"__set__","nodeType":"Function","startLoc":197,"text":"def __set__(self, instance, value):\n        if instance is None:\n            # This is an unbound descriptor on the class\n            raise ValueError('cannot set unbound descriptor')\n\n        instance._attrs[self.attr] = value"},{"attributeType":"null","col":8,"comment":"null","endLoc":189,"id":10490,"name":"default","nodeType":"Attribute","startLoc":189,"text":"self.default"},{"attributeType":"null","col":8,"comment":"null","endLoc":188,"id":10491,"name":"attr","nodeType":"Attribute","startLoc":188,"text":"self.attr"},{"className":"ParentAttribute","col":0,"comment":"null","endLoc":220,"id":10492,"nodeType":"Class","startLoc":205,"text":"class ParentAttribute:\n    def __init__(self, attr):\n        self.attr = attr\n\n    def __get__(self, instance, owner_cls):\n        if instance is None:\n            return self\n\n        return getattr(instance._parent, self.attr)\n\n    def __set__(self, instance, value):\n        if instance is None:\n            # This is an unbound descriptor on the class\n            raise ValueError('cannot set unbound descriptor')\n\n        setattr(instance._parent, self.attr, value)"},{"col":4,"comment":"null","endLoc":207,"header":"def __init__(self, attr)","id":10493,"name":"__init__","nodeType":"Function","startLoc":206,"text":"def __init__(self, attr):\n        self.attr = attr"},{"col":4,"comment":"null","endLoc":213,"header":"def __get__(self, instance, owner_cls)","id":10494,"name":"__get__","nodeType":"Function","startLoc":209,"text":"def __get__(self, instance, owner_cls):\n        if instance is None:\n            return self\n\n        return getattr(instance._parent, self.attr)"},{"col":4,"comment":"null","endLoc":220,"header":"def __set__(self, instance, value)","id":10495,"name":"__set__","nodeType":"Function","startLoc":215,"text":"def __set__(self, instance, value):\n        if instance is None:\n            # This is an unbound descriptor on the class\n            raise ValueError('cannot set unbound descriptor')\n\n        setattr(instance._parent, self.attr, value)"},{"attributeType":"null","col":8,"comment":"null","endLoc":207,"id":10496,"name":"attr","nodeType":"Attribute","startLoc":207,"text":"self.attr"},{"col":0,"comment":"null","endLoc":97,"header":"def helper_gd2gc(f, nounit, unit1, unit2, unit3)","id":10497,"name":"helper_gd2gc","nodeType":"Function","startLoc":85,"text":"def helper_gd2gc(f, nounit, unit1, unit2, unit3):\n    from astropy.units.si import m, radian\n    if nounit is not None:\n        raise UnitTypeError(\"ellipsoid cannot be a quantity.\")\n    try:\n        return [None,\n                get_converter(unit1, radian),\n                get_converter(unit2, radian),\n                get_converter(unit3, m)], (m, None)\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{}' function to lon, lat \"\n                            \"with angle and height with length units\"\n                            .format(f.__name__))"},{"attributeType":"null","col":0,"comment":"null","endLoc":102,"id":10498,"name":"one_half","nodeType":"Attribute","startLoc":102,"text":"one_half"},{"className":"DataInfoMeta","col":0,"comment":"null","endLoc":252,"id":10499,"nodeType":"Class","startLoc":223,"text":"class DataInfoMeta(type):\n    def __new__(mcls, name, bases, dct):\n        # Ensure that we do not gain a __dict__, which would mean\n        # arbitrary attributes could be set.\n        dct.setdefault('__slots__', [])\n        return super().__new__(mcls, name, bases, dct)\n\n    def __init__(cls, name, bases, dct):\n        super().__init__(name, bases, dct)\n\n        # Define default getters/setters for attributes, if needed.\n        for attr in cls.attr_names:\n            if attr not in dct:\n                # If not defined explicitly for this class, did any of\n                # its superclasses define it, and, if so, was this an\n                # automatically defined look-up-on-parent attribute?\n                cls_attr = getattr(cls, attr, None)\n                if attr in cls.attrs_from_parent:\n                    # If the attribute is supposed to be stored on the parent,\n                    # and that is stated by this class yet it was not the case\n                    # on the superclass, override it.\n                    if 'attrs_from_parent' in dct and not isinstance(cls_attr, ParentAttribute):\n                        setattr(cls, attr, ParentAttribute(attr))\n                elif not cls_attr or isinstance(cls_attr, ParentAttribute):\n                    # If the attribute is not meant to be stored on the parent,\n                    # and if it was not defined already or was previously defined\n                    # as an attribute on the parent, define a regular\n                    # look-up-on-info attribute\n                    setattr(cls, attr,\n                            InfoAttribute(attr, cls._attr_defaults.get(attr)))"},{"col":4,"comment":"null","endLoc":228,"header":"def __new__(mcls, name, bases, dct)","id":10500,"name":"__new__","nodeType":"Function","startLoc":224,"text":"def __new__(mcls, name, bases, dct):\n        # Ensure that we do not gain a __dict__, which would mean\n        # arbitrary attributes could be set.\n        dct.setdefault('__slots__', [])\n        return super().__new__(mcls, name, bases, dct)"},{"attributeType":"null","col":0,"comment":"null","endLoc":103,"id":10501,"name":"one_third","nodeType":"Attribute","startLoc":103,"text":"one_third"},{"col":4,"comment":"null","endLoc":252,"header":"def __init__(cls, name, bases, dct)","id":10502,"name":"__init__","nodeType":"Function","startLoc":230,"text":"def __init__(cls, name, bases, dct):\n        super().__init__(name, bases, dct)\n\n        # Define default getters/setters for attributes, if needed.\n        for attr in cls.attr_names:\n            if attr not in dct:\n                # If not defined explicitly for this class, did any of\n                # its superclasses define it, and, if so, was this an\n                # automatically defined look-up-on-parent attribute?\n                cls_attr = getattr(cls, attr, None)\n                if attr in cls.attrs_from_parent:\n                    # If the attribute is supposed to be stored on the parent,\n                    # and that is stated by this class yet it was not the case\n                    # on the superclass, override it.\n                    if 'attrs_from_parent' in dct and not isinstance(cls_attr, ParentAttribute):\n                        setattr(cls, attr, ParentAttribute(attr))\n                elif not cls_attr or isinstance(cls_attr, ParentAttribute):\n                    # If the attribute is not meant to be stored on the parent,\n                    # and if it was not defined already or was previously defined\n                    # as an attribute on the parent, define a regular\n                    # look-up-on-info attribute\n                    setattr(cls, attr,\n                            InfoAttribute(attr, cls._attr_defaults.get(attr)))"},{"attributeType":"null","col":0,"comment":"null","endLoc":335,"id":10503,"name":"onearg_test_ufuncs","nodeType":"Attribute","startLoc":335,"text":"onearg_test_ufuncs"},{"col":0,"comment":"null","endLoc":237,"header":"@dispatched_function\ndef unwrap(p, discont=None, axis=-1)","id":10504,"name":"unwrap","nodeType":"Function","startLoc":227,"text":"@dispatched_function\ndef unwrap(p, discont=None, axis=-1):\n    from astropy.units.si import radian\n    if discont is None:\n        discont = np.pi << radian\n\n    p, discont = _as_quantities(p, discont)\n    result = np.unwrap.__wrapped__(p.to_value(radian),\n                                   discont.to_value(radian), axis=axis)\n    result = radian.to(p.unit, result)\n    return result, p.unit, None"},{"attributeType":"null","col":4,"comment":"null","endLoc":336,"id":10505,"name":"ufunc","nodeType":"Attribute","startLoc":336,"text":"ufunc"},{"col":0,"comment":"Convert arguments to Quantity (or raise NotImplentedError).","endLoc":323,"header":"def _as_quantities(*args)","id":10506,"name":"_as_quantities","nodeType":"Function","startLoc":314,"text":"def _as_quantities(*args):\n    \"\"\"Convert arguments to Quantity (or raise NotImplentedError).\"\"\"\n    from astropy.units import Quantity\n\n    try:\n        return tuple(Quantity(a, copy=False, subok=True)\n                     for a in args)\n    except Exception:\n        # If we cannot convert to Quantity, we should just bail.\n        raise NotImplementedError"},{"attributeType":"null","col":0,"comment":"null","endLoc":340,"id":10507,"name":"invariant_ufuncs","nodeType":"Attribute","startLoc":340,"text":"invariant_ufuncs"},{"col":4,"comment":"null","endLoc":639,"header":"def __le__(self, other)","id":10508,"name":"__le__","nodeType":"Function","startLoc":638,"text":"def __le__(self, other):\n        return self._comparison(other, self.value.__le__)"},{"attributeType":"null","col":4,"comment":"null","endLoc":343,"id":10509,"name":"ufunc","nodeType":"Attribute","startLoc":343,"text":"ufunc"},{"col":4,"comment":"null","endLoc":324,"header":"def __itruediv__(self, other)","id":10510,"name":"__itruediv__","nodeType":"Function","startLoc":316,"text":"def __itruediv__(self, other):\n        if isinstance(other, numbers.Number):\n            new_physical_unit = self.unit.physical_unit**(1/other)\n            function_view = self._function_view\n            function_view /= other\n            self._set_unit(self.unit._copy(new_physical_unit))\n            return self\n        else:\n            return super().__itruediv__(other)"},{"col":0,"comment":"null","endLoc":104,"header":"def helper_p2pv(f, unit1)","id":10511,"name":"helper_p2pv","nodeType":"Function","startLoc":100,"text":"def helper_p2pv(f, unit1):\n    from astropy.units.si import s\n    if isinstance(unit1, StructuredUnit):\n        raise UnitTypeError(\"p vector unit cannot be a structured unit.\")\n    return [None], StructuredUnit((unit1, unit1 / s))"},{"col":4,"comment":"Unit conversion operator `<<`","endLoc":648,"header":"def __lshift__(self, other)","id":10512,"name":"__lshift__","nodeType":"Function","startLoc":641,"text":"def __lshift__(self, other):\n        \"\"\"Unit conversion operator `<<`\"\"\"\n        try:\n            other = Unit(other, parse_strict='silent')\n        except UnitTypeError:\n            return NotImplemented\n\n        return self.__class__(self, other, copy=False, subok=True)"},{"attributeType":"null","col":0,"comment":"null","endLoc":347,"id":10513,"name":"dimensionless_to_dimensionless_ufuncs","nodeType":"Attribute","startLoc":347,"text":"dimensionless_to_dimensionless_ufuncs"},{"col":4,"comment":"null","endLoc":665,"header":"def _wrap_function(self, function, *args, **kwargs)","id":10514,"name":"_wrap_function","nodeType":"Function","startLoc":651,"text":"def _wrap_function(self, function, *args, **kwargs):\n        if function in self._supported_functions:\n            return super()._wrap_function(function, *args, **kwargs)\n\n        # For dimensionless, we can convert to regular quantities.\n        if all(arg.unit.physical_unit == dimensionless_unscaled\n               for arg in (self,) + args\n               if (hasattr(arg, 'unit') and\n                   hasattr(arg.unit, 'physical_unit'))):\n            args = tuple(getattr(arg, '_function_view', arg) for arg in args)\n            return self._function_view._wrap_function(function, *args, **kwargs)\n\n        raise TypeError(\"Cannot use method that uses function '{}' with \"\n                        \"function quantities that are not dimensionless.\"\n                        .format(function.__name__))"},{"col":4,"comment":"null","endLoc":334,"header":"def __pow__(self, other)","id":10515,"name":"__pow__","nodeType":"Function","startLoc":326,"text":"def __pow__(self, other):\n        # We check if this power is OK by applying it first to the unit.\n        try:\n            other = float(other)\n        except TypeError:\n            return NotImplemented\n        new_unit = self.unit ** other\n        new_value = self.view(np.ndarray) ** other\n        return self._new_view(new_value, new_unit)"},{"col":0,"comment":"\n    Get a data object attribute for the ``attributes`` info summary method\n    ","endLoc":183,"header":"def _get_data_attribute(dat, attr=None)","id":10516,"name":"_get_data_attribute","nodeType":"Function","startLoc":168,"text":"def _get_data_attribute(dat, attr=None):\n    \"\"\"\n    Get a data object attribute for the ``attributes`` info summary method\n    \"\"\"\n    if attr == 'class':\n        val = type(dat).__name__\n    elif attr == 'dtype':\n        val = dtype_info_name(dat.info.dtype)\n    elif attr == 'shape':\n        datshape = dat.shape[1:]\n        val = datshape if datshape else ''\n    else:\n        val = getattr(dat.info, attr)\n    if val is None:\n        val = ''\n    return str(val)"},{"attributeType":"null","col":0,"comment":"null","endLoc":34,"id":10517,"name":"__all__","nodeType":"Attribute","startLoc":34,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":10518,"name":"IGNORE_WARNINGS","nodeType":"Attribute","startLoc":38,"text":"IGNORE_WARNINGS"},{"col":0,"comment":"","endLoc":11,"header":"data_info.py#<anonymous>","id":10519,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"This module contains functions and methods that relate to the DataInfo class\nwhich provides a container for informational attributes as well as summary info\nmethods.\n\nA DataInfo object is attached to the Quantity, SkyCoord, and Time classes in\nastropy.  Here it allows those classes to be used in Tables and uniformly carry\ntable column attributes such as name, format, dtype, meta, and description.\n\"\"\"\n\n__all__ = ['data_info_factory', 'dtype_info_name', 'BaseColumnInfo',\n           'DataInfo', 'MixinInfo', 'ParentDtypeInfo']\n\nIGNORE_WARNINGS = (dict(category=RuntimeWarning, message='All-NaN|'\n                        'Mean of empty slice|Degrees of freedom <= 0|'\n                        'invalid value encountered in sqrt'),)"},{"col":0,"comment":"null","endLoc":109,"header":"def helper_pv2p(f, unit1)","id":10520,"name":"helper_pv2p","nodeType":"Function","startLoc":107,"text":"def helper_pv2p(f, unit1):\n    check_structured_unit(unit1, dt_pv)\n    return [None], unit1[0]"},{"col":0,"comment":"null","endLoc":116,"header":"def helper_pv2s(f, unit_pv)","id":10521,"name":"helper_pv2s","nodeType":"Function","startLoc":112,"text":"def helper_pv2s(f, unit_pv):\n    from astropy.units.si import radian\n    check_structured_unit(unit_pv, dt_pv)\n    ang_unit = radian * unit_pv[1] / unit_pv[0]\n    return [None], (radian, radian, unit_pv[0], ang_unit, ang_unit, unit_pv[1])"},{"fileName":"data.py","filePath":"astropy/utils","id":10522,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"Functions for accessing, downloading, and caching data files.\"\"\"\n\nimport atexit\nimport contextlib\nimport errno\nimport fnmatch\nimport functools\nimport hashlib\nimport os\nimport io\nimport re\nimport shutil\nimport ssl\nimport sys\nimport urllib.request\nimport urllib.error\nimport urllib.parse\nimport zipfile\nimport ftplib\n\nfrom tempfile import NamedTemporaryFile, gettempdir, TemporaryDirectory, mkdtemp\nfrom warnings import warn\n\ntry:\n    import certifi\nexcept ImportError:\n    # certifi support is optional; when available it will be used for TLS/SSL\n    # downloads\n    certifi = None\n\nimport astropy.config.paths\nfrom astropy import config as _config\nfrom astropy.utils.exceptions import AstropyWarning\nfrom astropy.utils.introspection import find_current_module, resolve_name\n\n\n# Order here determines order in the autosummary\n__all__ = [\n    'Conf', 'conf',\n    'download_file', 'download_files_in_parallel',\n    'get_readable_fileobj',\n    'get_pkg_data_fileobj', 'get_pkg_data_filename',\n    'get_pkg_data_contents', 'get_pkg_data_fileobjs',\n    'get_pkg_data_filenames', 'get_pkg_data_path',\n    'is_url', 'is_url_in_cache', 'get_cached_urls',\n    'cache_total_size', 'cache_contents',\n    'export_download_cache', 'import_download_cache', 'import_file_to_cache',\n    'check_download_cache',\n    'clear_download_cache',\n    'compute_hash',\n    'get_free_space_in_dir',\n    'check_free_space_in_dir',\n    'get_file_contents',\n    'CacheMissingWarning',\n    \"CacheDamaged\"\n]\n\n_dataurls_to_alias = {}\n\n\nclass _NonClosingBufferedReader(io.BufferedReader):\n    def __del__(self):\n        try:\n            # NOTE: self.raw will not be closed, but left in the state\n            # it was in at detactment\n            self.detach()\n        except Exception:\n            pass\n\n\nclass _NonClosingTextIOWrapper(io.TextIOWrapper):\n    def __del__(self):\n        try:\n            # NOTE: self.stream will not be closed, but left in the state\n            # it was in at detactment\n            self.detach()\n        except Exception:\n            pass\n\n\nclass Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.utils.data`.\n    \"\"\"\n\n    dataurl = _config.ConfigItem(\n        'http://data.astropy.org/',\n        'Primary URL for astropy remote data site.')\n    dataurl_mirror = _config.ConfigItem(\n        'http://www.astropy.org/astropy-data/',\n        'Mirror URL for astropy remote data site.')\n    default_http_user_agent = _config.ConfigItem(\n        'astropy',\n        'Default User-Agent for HTTP request headers. This can be overwritten '\n        'for a particular call via http_headers option, where available. '\n        'This only provides the default value when not set by https_headers.')\n    remote_timeout = _config.ConfigItem(\n        10.,\n        'Time to wait for remote data queries (in seconds).',\n        aliases=['astropy.coordinates.name_resolve.name_resolve_timeout'])\n    allow_internet = _config.ConfigItem(\n        True,\n        'If False, prevents any attempt to download from Internet.')\n    compute_hash_block_size = _config.ConfigItem(\n        2 ** 16,  # 64K\n        'Block size for computing file hashes.')\n    download_block_size = _config.ConfigItem(\n        2 ** 16,  # 64K\n        'Number of bytes of remote data to download per step.')\n    delete_temporary_downloads_at_exit = _config.ConfigItem(\n        True,\n        'If True, temporary download files created when the cache is '\n        'inaccessible will be deleted at the end of the python session.')\n\n\nconf = Conf()\n\n\nclass CacheMissingWarning(AstropyWarning):\n    \"\"\"\n    This warning indicates the standard cache directory is not accessible, with\n    the first argument providing the warning message. If args[1] is present, it\n    is a filename indicating the path to a temporary file that was created to\n    store a remote data download in the absence of the cache.\n    \"\"\"\n\n\ndef is_url(string):\n    \"\"\"\n    Test whether a string is a valid URL for :func:`download_file`.\n\n    Parameters\n    ----------\n    string : str\n        The string to test.\n\n    Returns\n    -------\n    status : bool\n        String is URL or not.\n\n    \"\"\"\n    url = urllib.parse.urlparse(string)\n    # we can't just check that url.scheme is not an empty string, because\n    # file paths in windows would return a non-empty scheme (e.g. e:\\\\\n    # returns 'e').\n    return url.scheme.lower() in ['http', 'https', 'ftp', 'sftp', 'ssh', 'file']\n\n\n# Backward compatibility because some downstream packages allegedly uses it.\n_is_url = is_url\n\n\ndef _is_inside(path, parent_path):\n    # We have to try realpath too to avoid issues with symlinks, but we leave\n    # abspath because some systems like debian have the absolute path (with no\n    # symlinks followed) match, but the real directories in different\n    # locations, so need to try both cases.\n    return os.path.abspath(path).startswith(os.path.abspath(parent_path)) \\\n        or os.path.realpath(path).startswith(os.path.realpath(parent_path))\n\n\n@contextlib.contextmanager\ndef get_readable_fileobj(name_or_obj, encoding=None, cache=False,\n                         show_progress=True, remote_timeout=None,\n                         sources=None, http_headers=None):\n    \"\"\"Yield a readable, seekable file-like object from a file or URL.\n\n    This supports passing filenames, URLs, and readable file-like objects,\n    any of which can be compressed in gzip, bzip2 or lzma (xz) if the\n    appropriate compression libraries are provided by the Python installation.\n\n    Notes\n    -----\n\n    This function is a context manager, and should be used for example\n    as::\n\n        with get_readable_fileobj('file.dat') as f:\n            contents = f.read()\n\n    If a URL is provided and the cache is in use, the provided URL will be the\n    name used in the cache. The contents may already be stored in the cache\n    under this URL provided, they may be downloaded from this URL, or they may\n    be downloaded from one of the locations listed in ``sources``. See\n    `~download_file` for details.\n\n    Parameters\n    ----------\n    name_or_obj : str or file-like\n        The filename of the file to access (if given as a string), or\n        the file-like object to access.\n\n        If a file-like object, it must be opened in binary mode.\n\n    encoding : str, optional\n        When `None` (default), returns a file-like object with a\n        ``read`` method that returns `str` (``unicode``) objects, using\n        `locale.getpreferredencoding` as an encoding.  This matches\n        the default behavior of the built-in `open` when no ``mode``\n        argument is provided.\n\n        When ``'binary'``, returns a file-like object where its ``read``\n        method returns `bytes` objects.\n\n        When another string, it is the name of an encoding, and the\n        file-like object's ``read`` method will return `str` (``unicode``)\n        objects, decoded from binary using the given encoding.\n\n    cache : bool or \"update\", optional\n        Whether to cache the contents of remote URLs. If \"update\",\n        check the remote URL for a new version but store the result\n        in the cache.\n\n    show_progress : bool, optional\n        Whether to display a progress bar if the file is downloaded\n        from a remote server.  Default is `True`.\n\n    remote_timeout : float\n        Timeout for remote requests in seconds (default is the configurable\n        `astropy.utils.data.Conf.remote_timeout`).\n\n    sources : list of str, optional\n        If provided, a list of URLs to try to obtain the file from. The\n        result will be stored under the original URL. The original URL\n        will *not* be tried unless it is in this list; this is to prevent\n        long waits for a primary server that is known to be inaccessible\n        at the moment.\n\n    http_headers : dict or None\n        HTTP request headers to pass into ``urlopen`` if needed. (These headers\n        are ignored if the protocol for the ``name_or_obj``/``sources`` entry\n        is not a remote HTTP URL.) In the default case (None), the headers are\n        ``User-Agent: some_value`` and ``Accept: */*``, where ``some_value``\n        is set by ``astropy.utils.data.conf.default_http_user_agent``.\n\n    Returns\n    -------\n    file : readable file-like\n    \"\"\"\n\n    # close_fds is a list of file handles created by this function\n    # that need to be closed.  We don't want to always just close the\n    # returned file handle, because it may simply be the file handle\n    # passed in.  In that case it is not the responsibility of this\n    # function to close it: doing so could result in a \"double close\"\n    # and an \"invalid file descriptor\" exception.\n\n    close_fds = []\n    delete_fds = []\n\n    if remote_timeout is None:\n        # use configfile default\n        remote_timeout = conf.remote_timeout\n\n    # name_or_obj could be an os.PathLike object\n    if isinstance(name_or_obj, os.PathLike):\n        name_or_obj = os.fspath(name_or_obj)\n\n    # Get a file object to the content\n    if isinstance(name_or_obj, str):\n        is_url = _is_url(name_or_obj)\n        if is_url:\n            name_or_obj = download_file(\n                name_or_obj, cache=cache, show_progress=show_progress,\n                timeout=remote_timeout, sources=sources,\n                http_headers=http_headers)\n        fileobj = io.FileIO(name_or_obj, 'r')\n        if is_url and not cache:\n            delete_fds.append(fileobj)\n        close_fds.append(fileobj)\n    else:\n        fileobj = name_or_obj\n\n    # Check if the file object supports random access, and if not,\n    # then wrap it in a BytesIO buffer.  It would be nicer to use a\n    # BufferedReader to avoid reading loading the whole file first,\n    # but that is not compatible with streams or urllib2.urlopen\n    # objects on Python 2.x.\n    if not hasattr(fileobj, 'seek'):\n        try:\n            # py.path.LocalPath objects have .read() method but it uses\n            # text mode, which won't work. .read_binary() does, and\n            # surely other ducks would return binary contents when\n            # called like this.\n            # py.path.LocalPath is what comes from the tmpdir fixture\n            # in pytest.\n            fileobj = io.BytesIO(fileobj.read_binary())\n        except AttributeError:\n            fileobj = io.BytesIO(fileobj.read())\n\n    # Now read enough bytes to look at signature\n    signature = fileobj.read(4)\n    fileobj.seek(0)\n\n    if signature[:3] == b'\\x1f\\x8b\\x08':  # gzip\n        import struct\n        try:\n            import gzip\n            fileobj_new = gzip.GzipFile(fileobj=fileobj, mode='rb')\n            fileobj_new.read(1)  # need to check that the file is really gzip\n        except (OSError, EOFError, struct.error):  # invalid gzip file\n            fileobj.seek(0)\n            fileobj_new.close()\n        else:\n            fileobj_new.seek(0)\n            fileobj = fileobj_new\n    elif signature[:3] == b'BZh':  # bzip2\n        try:\n            import bz2\n        except ImportError:\n            for fd in close_fds:\n                fd.close()\n            raise ModuleNotFoundError(\n                \"This Python installation does not provide the bz2 module.\")\n        try:\n            # bz2.BZ2File does not support file objects, only filenames, so we\n            # need to write the data to a temporary file\n            with NamedTemporaryFile(\"wb\", delete=False) as tmp:\n                tmp.write(fileobj.read())\n                tmp.close()\n                fileobj_new = bz2.BZ2File(tmp.name, mode='rb')\n            fileobj_new.read(1)  # need to check that the file is really bzip2\n        except OSError:  # invalid bzip2 file\n            fileobj.seek(0)\n            fileobj_new.close()\n            # raise\n        else:\n            fileobj_new.seek(0)\n            close_fds.append(fileobj_new)\n            fileobj = fileobj_new\n    elif signature[:3] == b'\\xfd7z':  # xz\n        try:\n            import lzma\n            fileobj_new = lzma.LZMAFile(fileobj, mode='rb')\n            fileobj_new.read(1)  # need to check that the file is really xz\n        except ImportError:\n            for fd in close_fds:\n                fd.close()\n            raise ModuleNotFoundError(\n                \"This Python installation does not provide the lzma module.\")\n        except (OSError, EOFError):  # invalid xz file\n            fileobj.seek(0)\n            fileobj_new.close()\n            # should we propagate this to the caller to signal bad content?\n            # raise ValueError(e)\n        else:\n            fileobj_new.seek(0)\n            fileobj = fileobj_new\n\n    # By this point, we have a file, io.FileIO, gzip.GzipFile, bz2.BZ2File\n    # or lzma.LZMAFile instance opened in binary mode (that is, read\n    # returns bytes).  Now we need to, if requested, wrap it in a\n    # io.TextIOWrapper so read will return unicode based on the\n    # encoding parameter.\n\n    needs_textio_wrapper = encoding != 'binary'\n\n    if needs_textio_wrapper:\n        # A bz2.BZ2File can not be wrapped by a TextIOWrapper,\n        # so we decompress it to a temporary file and then\n        # return a handle to that.\n        try:\n            import bz2\n        except ImportError:\n            pass\n        else:\n            if isinstance(fileobj, bz2.BZ2File):\n                tmp = NamedTemporaryFile(\"wb\", delete=False)\n                data = fileobj.read()\n                tmp.write(data)\n                tmp.close()\n                delete_fds.append(tmp)\n\n                fileobj = io.FileIO(tmp.name, 'r')\n                close_fds.append(fileobj)\n\n        fileobj = _NonClosingBufferedReader(fileobj)\n        fileobj = _NonClosingTextIOWrapper(fileobj, encoding=encoding)\n\n        # Ensure that file is at the start - io.FileIO will for\n        # example not always be at the start:\n        # >>> import io\n        # >>> f = open('test.fits', 'rb')\n        # >>> f.read(4)\n        # 'SIMP'\n        # >>> f.seek(0)\n        # >>> fileobj = io.FileIO(f.fileno())\n        # >>> fileobj.tell()\n        # 4096L\n\n        fileobj.seek(0)\n\n    try:\n        yield fileobj\n    finally:\n        for fd in close_fds:\n            fd.close()\n        for fd in delete_fds:\n            os.remove(fd.name)\n\n\ndef get_file_contents(*args, **kwargs):\n    \"\"\"\n    Retrieves the contents of a filename or file-like object.\n\n    See  the `get_readable_fileobj` docstring for details on parameters.\n\n    Returns\n    -------\n    object\n        The content of the file (as requested by ``encoding``).\n    \"\"\"\n    with get_readable_fileobj(*args, **kwargs) as f:\n        return f.read()\n\n\n@contextlib.contextmanager\ndef get_pkg_data_fileobj(data_name, package=None, encoding=None, cache=True):\n    \"\"\"\n    Retrieves a data file from the standard locations for the package and\n    provides the file as a file-like object that reads bytes.\n\n    Parameters\n    ----------\n    data_name : str\n        Name/location of the desired data file.  One of the following:\n\n            * The name of a data file included in the source\n              distribution.  The path is relative to the module\n              calling this function.  For example, if calling from\n              ``astropy.pkname``, use ``'data/file.dat'`` to get the\n              file in ``astropy/pkgname/data/file.dat``.  Double-dots\n              can be used to go up a level.  In the same example, use\n              ``'../data/file.dat'`` to get ``astropy/data/file.dat``.\n            * If a matching local file does not exist, the Astropy\n              data server will be queried for the file.\n            * A hash like that produced by `compute_hash` can be\n              requested, prefixed by 'hash/'\n              e.g. 'hash/34c33b3eb0d56eb9462003af249eff28'.  The hash\n              will first be searched for locally, and if not found,\n              the Astropy data server will be queried.\n\n    package : str, optional\n        If specified, look for a file relative to the given package, rather\n        than the default of looking relative to the calling module's package.\n\n    encoding : str, optional\n        When `None` (default), returns a file-like object with a\n        ``read`` method returns `str` (``unicode``) objects, using\n        `locale.getpreferredencoding` as an encoding.  This matches\n        the default behavior of the built-in `open` when no ``mode``\n        argument is provided.\n\n        When ``'binary'``, returns a file-like object where its ``read``\n        method returns `bytes` objects.\n\n        When another string, it is the name of an encoding, and the\n        file-like object's ``read`` method will return `str` (``unicode``)\n        objects, decoded from binary using the given encoding.\n\n    cache : bool\n        If True, the file will be downloaded and saved locally or the\n        already-cached local copy will be accessed. If False, the\n        file-like object will directly access the resource (e.g. if a\n        remote URL is accessed, an object like that from\n        `urllib.request.urlopen` is returned).\n\n    Returns\n    -------\n    fileobj : file-like\n        An object with the contents of the data file available via\n        ``read`` function.  Can be used as part of a ``with`` statement,\n        automatically closing itself after the ``with`` block.\n\n    Raises\n    ------\n    urllib.error.URLError\n        If a remote file cannot be found.\n    OSError\n        If problems occur writing or reading a local file.\n\n    Examples\n    --------\n\n    This will retrieve a data file and its contents for the `astropy.wcs`\n    tests::\n\n        >>> from astropy.utils.data import get_pkg_data_fileobj\n        >>> with get_pkg_data_fileobj('data/3d_cd.hdr',\n        ...                           package='astropy.wcs.tests') as fobj:\n        ...     fcontents = fobj.read()\n        ...\n\n    This next example would download a data file from the astropy data server\n    because the ``allsky/allsky_rosat.fits`` file is not present in the\n    source distribution.  It will also save the file locally so the\n    next time it is accessed it won't need to be downloaded.::\n\n        >>> from astropy.utils.data import get_pkg_data_fileobj\n        >>> with get_pkg_data_fileobj('allsky/allsky_rosat.fits',\n        ...                           encoding='binary') as fobj:  # doctest: +REMOTE_DATA +IGNORE_OUTPUT\n        ...     fcontents = fobj.read()\n        ...\n        Downloading http://data.astropy.org/allsky/allsky_rosat.fits [Done]\n\n    This does the same thing but does *not* cache it locally::\n\n        >>> with get_pkg_data_fileobj('allsky/allsky_rosat.fits',\n        ...                           encoding='binary', cache=False) as fobj:  # doctest: +REMOTE_DATA +IGNORE_OUTPUT\n        ...     fcontents = fobj.read()\n        ...\n        Downloading http://data.astropy.org/allsky/allsky_rosat.fits [Done]\n\n    See Also\n    --------\n    get_pkg_data_contents : returns the contents of a file or url as a bytes object\n    get_pkg_data_filename : returns a local name for a file containing the data\n    \"\"\"  # noqa\n\n    datafn = get_pkg_data_path(data_name, package=package)\n    if os.path.isdir(datafn):\n        raise OSError(\"Tried to access a data file that's actually \"\n                      \"a package data directory\")\n    elif os.path.isfile(datafn):  # local file\n        with get_readable_fileobj(datafn, encoding=encoding) as fileobj:\n            yield fileobj\n    else:  # remote file\n        with get_readable_fileobj(\n            conf.dataurl + data_name,\n            encoding=encoding,\n            cache=cache,\n            sources=[conf.dataurl + data_name,\n                     conf.dataurl_mirror + data_name],\n        ) as fileobj:\n            # We read a byte to trigger any URLErrors\n            fileobj.read(1)\n            fileobj.seek(0)\n            yield fileobj\n\n\ndef get_pkg_data_filename(data_name, package=None, show_progress=True,\n                          remote_timeout=None):\n    \"\"\"\n    Retrieves a data file from the standard locations for the package and\n    provides a local filename for the data.\n\n    This function is similar to `get_pkg_data_fileobj` but returns the\n    file *name* instead of a readable file-like object.  This means\n    that this function must always cache remote files locally, unlike\n    `get_pkg_data_fileobj`.\n\n    Parameters\n    ----------\n    data_name : str\n        Name/location of the desired data file.  One of the following:\n\n            * The name of a data file included in the source\n              distribution.  The path is relative to the module\n              calling this function.  For example, if calling from\n              ``astropy.pkname``, use ``'data/file.dat'`` to get the\n              file in ``astropy/pkgname/data/file.dat``.  Double-dots\n              can be used to go up a level.  In the same example, use\n              ``'../data/file.dat'`` to get ``astropy/data/file.dat``.\n            * If a matching local file does not exist, the Astropy\n              data server will be queried for the file.\n            * A hash like that produced by `compute_hash` can be\n              requested, prefixed by 'hash/'\n              e.g. 'hash/34c33b3eb0d56eb9462003af249eff28'.  The hash\n              will first be searched for locally, and if not found,\n              the Astropy data server will be queried.\n\n    package : str, optional\n        If specified, look for a file relative to the given package, rather\n        than the default of looking relative to the calling module's package.\n\n    show_progress : bool, optional\n        Whether to display a progress bar if the file is downloaded\n        from a remote server.  Default is `True`.\n\n    remote_timeout : float\n        Timeout for the requests in seconds (default is the\n        configurable `astropy.utils.data.Conf.remote_timeout`).\n\n    Raises\n    ------\n    urllib.error.URLError\n        If a remote file cannot be found.\n    OSError\n        If problems occur writing or reading a local file.\n\n    Returns\n    -------\n    filename : str\n        A file path on the local file system corresponding to the data\n        requested in ``data_name``.\n\n    Examples\n    --------\n\n    This will retrieve the contents of the data file for the `astropy.wcs`\n    tests::\n\n        >>> from astropy.utils.data import get_pkg_data_filename\n        >>> fn = get_pkg_data_filename('data/3d_cd.hdr',\n        ...                            package='astropy.wcs.tests')\n        >>> with open(fn) as f:\n        ...     fcontents = f.read()\n        ...\n\n    This retrieves a data file by hash either locally or from the astropy data\n    server::\n\n        >>> from astropy.utils.data import get_pkg_data_filename\n        >>> fn = get_pkg_data_filename('hash/34c33b3eb0d56eb9462003af249eff28')  # doctest: +SKIP\n        >>> with open(fn) as f:\n        ...     fcontents = f.read()\n        ...\n\n    See Also\n    --------\n    get_pkg_data_contents : returns the contents of a file or url as a bytes object\n    get_pkg_data_fileobj : returns a file-like object with the data\n    \"\"\"\n\n    if remote_timeout is None:\n        # use configfile default\n        remote_timeout = conf.remote_timeout\n\n    if data_name.startswith('hash/'):\n        # first try looking for a local version if a hash is specified\n        hashfn = _find_hash_fn(data_name[5:])\n\n        if hashfn is None:\n            return download_file(conf.dataurl + data_name, cache=True,\n                                 show_progress=show_progress,\n                                 timeout=remote_timeout,\n                                 sources=[conf.dataurl + data_name,\n                                          conf.dataurl_mirror + data_name])\n        else:\n            return hashfn\n    else:\n        fs_path = os.path.normpath(data_name)\n        datafn = get_pkg_data_path(fs_path, package=package)\n        if os.path.isdir(datafn):\n            raise OSError(\"Tried to access a data file that's actually \"\n                          \"a package data directory\")\n        elif os.path.isfile(datafn):  # local file\n            return datafn\n        else:  # remote file\n            return download_file(conf.dataurl + data_name, cache=True,\n                                 show_progress=show_progress,\n                                 timeout=remote_timeout,\n                                 sources=[conf.dataurl + data_name,\n                                          conf.dataurl_mirror + data_name])\n\n\ndef get_pkg_data_contents(data_name, package=None, encoding=None, cache=True):\n    \"\"\"\n    Retrieves a data file from the standard locations and returns its\n    contents as a bytes object.\n\n    Parameters\n    ----------\n    data_name : str\n        Name/location of the desired data file.  One of the following:\n\n            * The name of a data file included in the source\n              distribution.  The path is relative to the module\n              calling this function.  For example, if calling from\n              ``astropy.pkname``, use ``'data/file.dat'`` to get the\n              file in ``astropy/pkgname/data/file.dat``.  Double-dots\n              can be used to go up a level.  In the same example, use\n              ``'../data/file.dat'`` to get ``astropy/data/file.dat``.\n            * If a matching local file does not exist, the Astropy\n              data server will be queried for the file.\n            * A hash like that produced by `compute_hash` can be\n              requested, prefixed by 'hash/'\n              e.g. 'hash/34c33b3eb0d56eb9462003af249eff28'.  The hash\n              will first be searched for locally, and if not found,\n              the Astropy data server will be queried.\n            * A URL to some other file.\n\n    package : str, optional\n        If specified, look for a file relative to the given package, rather\n        than the default of looking relative to the calling module's package.\n\n\n    encoding : str, optional\n        When `None` (default), returns a file-like object with a\n        ``read`` method that returns `str` (``unicode``) objects, using\n        `locale.getpreferredencoding` as an encoding.  This matches\n        the default behavior of the built-in `open` when no ``mode``\n        argument is provided.\n\n        When ``'binary'``, returns a file-like object where its ``read``\n        method returns `bytes` objects.\n\n        When another string, it is the name of an encoding, and the\n        file-like object's ``read`` method will return `str` (``unicode``)\n        objects, decoded from binary using the given encoding.\n\n    cache : bool\n        If True, the file will be downloaded and saved locally or the\n        already-cached local copy will be accessed. If False, the\n        file-like object will directly access the resource (e.g. if a\n        remote URL is accessed, an object like that from\n        `urllib.request.urlopen` is returned).\n\n    Returns\n    -------\n    contents : bytes\n        The complete contents of the file as a bytes object.\n\n    Raises\n    ------\n    urllib.error.URLError\n        If a remote file cannot be found.\n    OSError\n        If problems occur writing or reading a local file.\n\n    See Also\n    --------\n    get_pkg_data_fileobj : returns a file-like object with the data\n    get_pkg_data_filename : returns a local name for a file containing the data\n    \"\"\"\n\n    with get_pkg_data_fileobj(data_name, package=package, encoding=encoding,\n                              cache=cache) as fd:\n        contents = fd.read()\n    return contents\n\n\ndef get_pkg_data_filenames(datadir, package=None, pattern='*'):\n    \"\"\"\n    Returns the path of all of the data files in a given directory\n    that match a given glob pattern.\n\n    Parameters\n    ----------\n    datadir : str\n        Name/location of the desired data files.  One of the following:\n\n            * The name of a directory included in the source\n              distribution.  The path is relative to the module\n              calling this function.  For example, if calling from\n              ``astropy.pkname``, use ``'data'`` to get the\n              files in ``astropy/pkgname/data``.\n            * Remote URLs are not currently supported.\n\n    package : str, optional\n        If specified, look for a file relative to the given package, rather\n        than the default of looking relative to the calling module's package.\n\n    pattern : str, optional\n        A UNIX-style filename glob pattern to match files.  See the\n        `glob` module in the standard library for more information.\n        By default, matches all files.\n\n    Returns\n    -------\n    filenames : iterator of str\n        Paths on the local filesystem in *datadir* matching *pattern*.\n\n    Examples\n    --------\n    This will retrieve the contents of the data file for the `astropy.wcs`\n    tests::\n\n        >>> from astropy.utils.data import get_pkg_data_filenames\n        >>> for fn in get_pkg_data_filenames('data/maps', 'astropy.wcs.tests',\n        ...                                  '*.hdr'):\n        ...     with open(fn) as f:\n        ...         fcontents = f.read()\n        ...\n    \"\"\"\n\n    path = get_pkg_data_path(datadir, package=package)\n    if os.path.isfile(path):\n        raise OSError(\n            \"Tried to access a data directory that's actually \"\n            \"a package data file\")\n    elif os.path.isdir(path):\n        for filename in os.listdir(path):\n            if fnmatch.fnmatch(filename, pattern):\n                yield os.path.join(path, filename)\n    else:\n        raise OSError(\"Path not found\")\n\n\ndef get_pkg_data_fileobjs(datadir, package=None, pattern='*', encoding=None):\n    \"\"\"\n    Returns readable file objects for all of the data files in a given\n    directory that match a given glob pattern.\n\n    Parameters\n    ----------\n    datadir : str\n        Name/location of the desired data files.  One of the following:\n\n            * The name of a directory included in the source\n              distribution.  The path is relative to the module\n              calling this function.  For example, if calling from\n              ``astropy.pkname``, use ``'data'`` to get the\n              files in ``astropy/pkgname/data``\n            * Remote URLs are not currently supported\n\n    package : str, optional\n        If specified, look for a file relative to the given package, rather\n        than the default of looking relative to the calling module's package.\n\n    pattern : str, optional\n        A UNIX-style filename glob pattern to match files.  See the\n        `glob` module in the standard library for more information.\n        By default, matches all files.\n\n    encoding : str, optional\n        When `None` (default), returns a file-like object with a\n        ``read`` method that returns `str` (``unicode``) objects, using\n        `locale.getpreferredencoding` as an encoding.  This matches\n        the default behavior of the built-in `open` when no ``mode``\n        argument is provided.\n\n        When ``'binary'``, returns a file-like object where its ``read``\n        method returns `bytes` objects.\n\n        When another string, it is the name of an encoding, and the\n        file-like object's ``read`` method will return `str` (``unicode``)\n        objects, decoded from binary using the given encoding.\n\n    Returns\n    -------\n    fileobjs : iterator of file object\n        File objects for each of the files on the local filesystem in\n        *datadir* matching *pattern*.\n\n    Examples\n    --------\n    This will retrieve the contents of the data file for the `astropy.wcs`\n    tests::\n\n        >>> from astropy.utils.data import get_pkg_data_filenames\n        >>> for fd in get_pkg_data_fileobjs('data/maps', 'astropy.wcs.tests',\n        ...                                 '*.hdr'):\n        ...     fcontents = fd.read()\n        ...\n    \"\"\"\n\n    for fn in get_pkg_data_filenames(datadir, package=package,\n                                     pattern=pattern):\n        with get_readable_fileobj(fn, encoding=encoding) as fd:\n            yield fd\n\n\ndef compute_hash(localfn):\n    \"\"\" Computes the MD5 hash for a file.\n\n    The hash for a data file is used for looking up data files in a unique\n    fashion. This is of particular use for tests; a test may require a\n    particular version of a particular file, in which case it can be accessed\n    via hash to get the appropriate version.\n\n    Typically, if you wish to write a test that requires a particular data\n    file, you will want to submit that file to the astropy data servers, and\n    use\n    e.g. ``get_pkg_data_filename('hash/34c33b3eb0d56eb9462003af249eff28')``,\n    but with the hash for your file in place of the hash in the example.\n\n    Parameters\n    ----------\n    localfn : str\n        The path to the file for which the hash should be generated.\n\n    Returns\n    -------\n    hash : str\n        The hex digest of the cryptographic hash for the contents of the\n        ``localfn`` file.\n    \"\"\"\n    with open(localfn, 'rb') as f:\n        h = hashlib.md5()\n        block = f.read(conf.compute_hash_block_size)\n        while block:\n            h.update(block)\n            block = f.read(conf.compute_hash_block_size)\n\n    return h.hexdigest()\n\n\ndef get_pkg_data_path(*path, package=None):\n    \"\"\"Get path from source-included data directories.\n\n    Parameters\n    ----------\n    *path : str\n        Name/location of the desired data file/directory.\n        May be a tuple of strings for ``os.path`` joining.\n\n    package : str or None, optional, keyword-only\n        If specified, look for a file relative to the given package, rather\n        than the calling module's package.\n\n    Returns\n    -------\n    path : str\n        Name/location of the desired data file/directory.\n\n    Raises\n    ------\n    ImportError\n        Given package or module is not importable.\n    RuntimeError\n        If the local data file is outside of the package's tree.\n\n    \"\"\"\n    if package is None:\n        module = find_current_module(1, finddiff=['astropy.utils.data', 'contextlib'])\n        if module is None:\n            # not called from inside an astropy package.  So just pass name\n            # through\n            return os.path.join(*path)\n\n        if not hasattr(module, '__package__') or not module.__package__:\n            # The __package__ attribute may be missing or set to None; see\n            # PEP-366, also astropy issue #1256\n            if '.' in module.__name__:\n                package = module.__name__.rpartition('.')[0]\n            else:\n                package = module.__name__\n        else:\n            package = module.__package__\n    else:\n        # package errors if it isn't a str\n        # so there is no need for checks in the containing if/else\n        module = resolve_name(package)\n\n    # module path within package\n    module_path = os.path.dirname(module.__file__)\n    full_path = os.path.join(module_path, *path)\n\n    # Check that file is inside tree.\n    rootpkgname = package.partition('.')[0]\n    rootpkg = resolve_name(rootpkgname)\n    root_dir = os.path.dirname(rootpkg.__file__)\n    if not _is_inside(full_path, root_dir):\n        raise RuntimeError(f\"attempted to get a local data file outside \"\n                           f\"of the {rootpkgname} tree.\")\n\n    return full_path\n\n\ndef _find_hash_fn(hexdigest, pkgname='astropy'):\n    \"\"\"\n    Looks for a local file by hash - returns file name if found and a valid\n    file, otherwise returns None.\n    \"\"\"\n    for v in cache_contents(pkgname=pkgname).values():\n        if compute_hash(v) == hexdigest:\n            return v\n    return None\n\n\ndef get_free_space_in_dir(path, unit=False):\n    \"\"\"\n    Given a path to a directory, returns the amount of free space\n    on that filesystem.\n\n    Parameters\n    ----------\n    path : str\n        The path to a directory.\n\n    unit : bool or `~astropy.units.Unit`\n        Return the amount of free space as Quantity in the given unit,\n        if provided. Default is `False` for backward-compatibility.\n\n    Returns\n    -------\n    free_space : int or `~astropy.units.Quantity`\n        The amount of free space on the partition that the directory is on.\n        If ``unit=False``, it is returned as plain integer (in bytes).\n\n    \"\"\"\n    if not os.path.isdir(path):\n        raise OSError(\n            \"Can only determine free space associated with directories, \"\n            \"not files.\")\n        # Actually you can on Linux but I want to avoid code that fails\n        # on Windows only.\n    free_space = shutil.disk_usage(path).free\n    if unit:\n        from astropy import units as u\n        # TODO: Automatically determine best prefix to use.\n        if unit is True:\n            unit = u.byte\n        free_space = u.Quantity(free_space, u.byte).to(unit)\n    return free_space\n\n\ndef check_free_space_in_dir(path, size):\n    \"\"\"\n    Determines if a given directory has enough space to hold a file of\n    a given size.\n\n    Parameters\n    ----------\n    path : str\n        The path to a directory.\n\n    size : int or `~astropy.units.Quantity`\n        A proposed filesize. If not a Quantity, assume it is in bytes.\n\n    Raises\n    ------\n    OSError\n        There is not enough room on the filesystem.\n    \"\"\"\n    space = get_free_space_in_dir(path, unit=getattr(size, 'unit', False))\n    if space < size:\n        from astropy.utils.console import human_file_size\n        raise OSError(f\"Not enough free space in {path} \"\n                      f\"to download a {human_file_size(size)} file, \"\n                      f\"only {human_file_size(space)} left\")\n\n\nclass _ftptlswrapper(urllib.request.ftpwrapper):\n    def init(self):\n        self.busy = 0\n        self.ftp = ftplib.FTP_TLS()\n        self.ftp.connect(self.host, self.port, self.timeout)\n        self.ftp.login(self.user, self.passwd)\n        self.ftp.prot_p()\n        _target = '/'.join(self.dirs)\n        self.ftp.cwd(_target)\n\n\nclass _FTPTLSHandler(urllib.request.FTPHandler):\n    def connect_ftp(self, user, passwd, host, port, dirs, timeout):\n        return _ftptlswrapper(user, passwd, host, port, dirs, timeout,\n                              persistent=False)\n\n\n@functools.lru_cache()\ndef _build_urlopener(ftp_tls=False, ssl_context=None, allow_insecure=False):\n    \"\"\"\n    Helper for building a `urllib.request.build_opener` which handles TLS/SSL.\n    \"\"\"\n\n    ssl_context = dict(it for it in ssl_context) if ssl_context else {}\n    cert_chain = {}\n    if 'certfile' in ssl_context:\n        cert_chain.update({\n            'certfile': ssl_context.pop('certfile'),\n            'keyfile': ssl_context.pop('keyfile', None),\n            'password': ssl_context.pop('password', None)\n        })\n    elif 'password' in ssl_context or 'keyfile' in ssl_context:\n        raise ValueError(\n            \"passing 'keyfile' or 'password' in the ssl_context argument \"\n            \"requires passing 'certfile' as well\")\n\n    if 'cafile' not in ssl_context and certifi is not None:\n        ssl_context['cafile'] = certifi.where()\n\n    ssl_context = ssl.create_default_context(**ssl_context)\n\n    if allow_insecure:\n        ssl_context.check_hostname = False\n        ssl_context.verify_mode = ssl.CERT_NONE\n\n    if cert_chain:\n        ssl_context.load_cert_chain(**cert_chain)\n\n    https_handler = urllib.request.HTTPSHandler(context=ssl_context)\n\n    if ftp_tls:\n        urlopener = urllib.request.build_opener(_FTPTLSHandler(), https_handler)\n    else:\n        urlopener = urllib.request.build_opener(https_handler)\n\n    return urlopener\n\n\ndef _try_url_open(source_url, timeout=None, http_headers=None, ftp_tls=False,\n                  ssl_context=None, allow_insecure=False):\n    \"\"\"Helper for opening a URL while handling TLS/SSL verification issues.\"\"\"\n\n    # Always try first with a secure connection\n    # _build_urlopener uses lru_cache, so the ssl_context argument must be\n    # converted to a hashshable type (a set of 2-tuples)\n    ssl_context = frozenset(ssl_context.items() if ssl_context else [])\n    urlopener = _build_urlopener(ftp_tls=ftp_tls, ssl_context=ssl_context,\n                                 allow_insecure=False)\n    req = urllib.request.Request(source_url, headers=http_headers)\n\n    try:\n        return urlopener.open(req, timeout=timeout)\n    except urllib.error.URLError as exc:\n        reason = exc.reason\n        if (isinstance(reason, ssl.SSLError)\n                and reason.reason == 'CERTIFICATE_VERIFY_FAILED'):\n            msg = (f'Verification of TLS/SSL certificate at {source_url} '\n                   f'failed: this can mean either the server is '\n                   f'misconfigured or your local root CA certificates are '\n                   f'out-of-date; in the latter case this can usually be '\n                   f'addressed by installing the Python package \"certifi\" '\n                   f'(see the documentation for astropy.utils.data.download_url)')\n            if not allow_insecure:\n                msg += (f' or in both cases you can work around this by '\n                        f'passing allow_insecure=True, but only if you '\n                        f'understand the implications; the original error '\n                        f'was: {reason}')\n                raise urllib.error.URLError(msg)\n            else:\n                msg += '. Re-trying with allow_insecure=True.'\n                warn(msg, AstropyWarning)\n                # Try again with a new urlopener allowing insecure connections\n                urlopener = _build_urlopener(ftp_tls=ftp_tls, ssl_context=ssl_context,\n                                             allow_insecure=True)\n                return urlopener.open(req, timeout=timeout)\n\n        raise\n\n\ndef _download_file_from_source(source_url, show_progress=True, timeout=None,\n                               remote_url=None, cache=False, pkgname='astropy',\n                               http_headers=None, ftp_tls=None,\n                               ssl_context=None, allow_insecure=False):\n    from astropy.utils.console import ProgressBarOrSpinner\n\n    if not conf.allow_internet:\n        raise urllib.error.URLError(\n            f\"URL {remote_url} was supposed to be downloaded but \"\n            f\"allow_internet is {conf.allow_internet}; \"\n            f\"if this is unexpected check the astropy.cfg file for the option \"\n            f\"allow_internet\")\n\n    if remote_url is None:\n        remote_url = source_url\n    if http_headers is None:\n        http_headers = {}\n\n    if ftp_tls is None and urllib.parse.urlparse(remote_url).scheme == \"ftp\":\n        try:\n            return _download_file_from_source(source_url,\n                                              show_progress=show_progress,\n                                              timeout=timeout,\n                                              remote_url=remote_url,\n                                              cache=cache,\n                                              pkgname=pkgname,\n                                              http_headers=http_headers,\n                                              ftp_tls=False)\n        except urllib.error.URLError as e:\n            # e.reason might not be a string, e.g. socket.gaierror\n            if str(e.reason).startswith(\"ftp error: error_perm\"):\n                ftp_tls = True\n            else:\n                raise\n\n    with _try_url_open(source_url, timeout=timeout, http_headers=http_headers,\n                       ftp_tls=ftp_tls, ssl_context=ssl_context,\n                       allow_insecure=allow_insecure) as remote:\n        info = remote.info()\n        try:\n            size = int(info['Content-Length'])\n        except (KeyError, ValueError, TypeError):\n            size = None\n\n        if size is not None:\n            check_free_space_in_dir(gettempdir(), size)\n            if cache:\n                dldir = _get_download_cache_loc(pkgname)\n                check_free_space_in_dir(dldir, size)\n\n        if show_progress and sys.stdout.isatty():\n            progress_stream = sys.stdout\n        else:\n            progress_stream = io.StringIO()\n\n        if source_url == remote_url:\n            dlmsg = f\"Downloading {remote_url}\"\n        else:\n            dlmsg = f\"Downloading {remote_url} from {source_url}\"\n        with ProgressBarOrSpinner(size, dlmsg, file=progress_stream) as p:\n            with NamedTemporaryFile(prefix=f\"astropy-download-{os.getpid()}-\",\n                                    delete=False) as f:\n                try:\n                    bytes_read = 0\n                    block = remote.read(conf.download_block_size)\n                    while block:\n                        f.write(block)\n                        bytes_read += len(block)\n                        p.update(bytes_read)\n                        block = remote.read(conf.download_block_size)\n                        if size is not None and bytes_read > size:\n                            raise urllib.error.URLError(\n                                f\"File was supposed to be {size} bytes but \"\n                                f\"server provides more, at least {bytes_read} \"\n                                f\"bytes. Download failed.\")\n                    if size is not None and bytes_read < size:\n                        raise urllib.error.ContentTooShortError(\n                            f\"File was supposed to be {size} bytes but we \"\n                            f\"only got {bytes_read} bytes. Download failed.\",\n                            content=None)\n                except BaseException:\n                    if os.path.exists(f.name):\n                        try:\n                            os.remove(f.name)\n                        except OSError:\n                            pass\n                    raise\n    return f.name\n\n\ndef download_file(remote_url, cache=False, show_progress=True, timeout=None,\n                  sources=None, pkgname='astropy', http_headers=None,\n                  ssl_context=None, allow_insecure=False):\n    \"\"\"Downloads a URL and optionally caches the result.\n\n    It returns the filename of a file containing the URL's contents.\n    If ``cache=True`` and the file is present in the cache, just\n    returns the filename; if the file had to be downloaded, add it\n    to the cache. If ``cache=\"update\"`` always download and add it\n    to the cache.\n\n    The cache is effectively a dictionary mapping URLs to files; by default the\n    file contains the contents of the URL that is its key, but in practice\n    these can be obtained from a mirror (using ``sources``) or imported from\n    the local filesystem (using `~import_file_to_cache` or\n    `~import_download_cache`).  Regardless, each file is regarded as\n    representing the contents of a particular URL, and this URL should be used\n    to look them up or otherwise manipulate them.\n\n    The files in the cache directory are named according to a cryptographic\n    hash of their URLs (currently MD5, so hackers can cause collisions).\n    The modification times on these files normally indicate when they were\n    last downloaded from the Internet.\n\n    Parameters\n    ----------\n    remote_url : str\n        The URL of the file to download\n\n    cache : bool or \"update\", optional\n        Whether to cache the contents of remote URLs. If \"update\",\n        always download the remote URL in case there is a new version\n        and store the result in the cache.\n\n    show_progress : bool, optional\n        Whether to display a progress bar during the download (default\n        is `True`). Regardless of this setting, the progress bar is only\n        displayed when outputting to a terminal.\n\n    timeout : float, optional\n        Timeout for remote requests in seconds (default is the configurable\n        `astropy.utils.data.Conf.remote_timeout`).\n\n    sources : list of str, optional\n        If provided, a list of URLs to try to obtain the file from. The\n        result will be stored under the original URL. The original URL\n        will *not* be tried unless it is in this list; this is to prevent\n        long waits for a primary server that is known to be inaccessible\n        at the moment. If an empty list is passed, then ``download_file``\n        will not attempt to connect to the Internet, that is, if the file\n        is not in the cache a KeyError will be raised.\n\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    http_headers : dict or None\n        HTTP request headers to pass into ``urlopen`` if needed. (These headers\n        are ignored if the protocol for the ``name_or_obj``/``sources`` entry\n        is not a remote HTTP URL.) In the default case (None), the headers are\n        ``User-Agent: some_value`` and ``Accept: */*``, where ``some_value``\n        is set by ``astropy.utils.data.conf.default_http_user_agent``.\n\n    ssl_context : dict, optional\n        Keyword arguments to pass to `ssl.create_default_context` when\n        downloading from HTTPS or TLS+FTP sources.  This can be used provide\n        alternative paths to root CA certificates.  Additionally, if the key\n        ``'certfile'`` and optionally ``'keyfile'`` and ``'password'`` are\n        included, they are passed to `ssl.SSLContext.load_cert_chain`.  This\n        can be used for performing SSL/TLS client certificate authentication\n        for servers that require it.\n\n    allow_insecure : bool, optional\n        Allow downloading files over a TLS/SSL connection even when the server\n        certificate verification failed.  When set to `True` the potentially\n        insecure download is allowed to proceed, but an\n        `~astropy.utils.exceptions.AstropyWarning` is issued.  If you are\n        frequently getting certificate verification warnings, consider\n        installing or upgrading `certifi`_ package, which provides frequently\n        updated certificates for common root CAs (i.e., a set similar to those\n        used by web browsers).  If installed, Astropy will use it\n        automatically.\n\n        .. _certifi: https://pypi.org/project/certifi/\n\n    Returns\n    -------\n    local_path : str\n        Returns the local path that the file was download to.\n\n    Raises\n    ------\n    urllib.error.URLError\n        Whenever there's a problem getting the remote file.\n    KeyError\n        When a file was requested from the cache but is missing and no\n        sources were provided to obtain it from the Internet.\n\n    Notes\n    -----\n    Because this function returns a filename, another process could run\n    `clear_download_cache` before you actually open the file, leaving\n    you with a filename that no longer points to a usable file.\n    \"\"\"\n    if timeout is None:\n        timeout = conf.remote_timeout\n    if sources is None:\n        sources = [remote_url]\n    if http_headers is None:\n        http_headers = {'User-Agent': conf.default_http_user_agent,\n                        'Accept': '*/*'}\n\n    missing_cache = \"\"\n\n    url_key = remote_url\n\n    if cache:\n        try:\n            dldir = _get_download_cache_loc(pkgname)\n        except OSError as e:\n            cache = False\n            missing_cache = (\n                f\"Cache directory cannot be read or created ({e}), \"\n                f\"providing data in temporary file instead.\"\n            )\n        else:\n            if cache == \"update\":\n                pass\n            elif isinstance(cache, str):\n                raise ValueError(f\"Cache value '{cache}' was requested but \"\n                                 f\"'update' is the only recognized string; \"\n                                 f\"otherwise use a boolean\")\n            else:\n                filename = os.path.join(dldir, _url_to_dirname(url_key), \"contents\")\n                if os.path.exists(filename):\n                    return os.path.abspath(filename)\n\n    errors = {}\n    for source_url in sources:\n        try:\n            f_name = _download_file_from_source(\n                    source_url,\n                    timeout=timeout,\n                    show_progress=show_progress,\n                    cache=cache,\n                    remote_url=remote_url,\n                    pkgname=pkgname,\n                    http_headers=http_headers,\n                    ssl_context=ssl_context,\n                    allow_insecure=allow_insecure)\n            # Success!\n            break\n\n        except urllib.error.URLError as e:\n            # errno 8 is from SSL \"EOF occurred in violation of protocol\"\n            if (hasattr(e, 'reason')\n                    and hasattr(e.reason, 'errno')\n                    and e.reason.errno == 8):\n                e.reason.strerror = (e.reason.strerror +\n                                     '. requested URL: '\n                                     + remote_url)\n                e.reason.args = (e.reason.errno, e.reason.strerror)\n            errors[source_url] = e\n    else:   # No success\n        if not sources:\n            raise KeyError(\n                f\"No sources listed and file {remote_url} not in cache! \"\n                f\"Please include primary URL in sources if you want it to be \"\n                f\"included as a valid source.\")\n        elif len(sources) == 1:\n            raise errors[sources[0]]\n        else:\n            raise urllib.error.URLError(\n                f\"Unable to open any source! Exceptions were {errors}\") \\\n                from errors[sources[0]]\n\n    if cache:\n        try:\n            return import_file_to_cache(url_key, f_name,\n                                        remove_original=True,\n                                        replace=(cache == 'update'),\n                                        pkgname=pkgname)\n        except PermissionError as e:\n            # Cache is readonly, we can't update it\n            missing_cache = (\n                f\"Cache directory appears to be read-only ({e}), unable to import \"\n                f\"downloaded file, providing data in temporary file {f_name} \"\n                f\"instead.\")\n        # FIXME: other kinds of cache problem can occur?\n\n    if missing_cache:\n        warn(CacheMissingWarning(missing_cache, f_name))\n    if conf.delete_temporary_downloads_at_exit:\n        global _tempfilestodel\n        _tempfilestodel.append(f_name)\n    return os.path.abspath(f_name)\n\n\ndef is_url_in_cache(url_key, pkgname='astropy'):\n    \"\"\"Check if a download for ``url_key`` is in the cache.\n\n    The provided ``url_key`` will be the name used in the cache. The contents\n    may have been downloaded from this URL or from a mirror or they may have\n    been provided by the user. See `~download_file` for details.\n\n    Parameters\n    ----------\n    url_key : str\n        The URL retrieved\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n\n    Returns\n    -------\n    in_cache : bool\n        `True` if a download for ``url_key`` is in the cache, `False` if not\n        or if the cache does not exist at all.\n\n    See Also\n    --------\n    cache_contents : obtain a dictionary listing everything in the cache\n    \"\"\"\n    try:\n        dldir = _get_download_cache_loc(pkgname)\n    except OSError:\n        return False\n    filename = os.path.join(dldir, _url_to_dirname(url_key), \"contents\")\n    return os.path.exists(filename)\n\n\ndef cache_total_size(pkgname='astropy'):\n    \"\"\"Return the total size in bytes of all files in the cache.\"\"\"\n    size = 0\n    dldir = _get_download_cache_loc(pkgname=pkgname)\n    for root, dirs, files in os.walk(dldir):\n        size += sum(os.path.getsize(os.path.join(root, name)) for name in files)\n    return size\n\n\ndef _do_download_files_in_parallel(kwargs):\n    with astropy.config.paths.set_temp_config(kwargs.pop(\"temp_config\")):\n        with astropy.config.paths.set_temp_cache(kwargs.pop(\"temp_cache\")):\n            return download_file(**kwargs)\n\n\ndef download_files_in_parallel(urls,\n                               cache=\"update\",\n                               show_progress=True,\n                               timeout=None,\n                               sources=None,\n                               multiprocessing_start_method=None,\n                               pkgname='astropy'):\n    \"\"\"Download multiple files in parallel from the given URLs.\n\n    Blocks until all files have downloaded.  The result is a list of\n    local file paths corresponding to the given urls.\n\n    The results will be stored in the cache under the values in ``urls`` even\n    if they are obtained from some other location via ``sources``. See\n    `~download_file` for details.\n\n    Parameters\n    ----------\n    urls : list of str\n        The URLs to retrieve.\n\n    cache : bool or \"update\", optional\n        Whether to use the cache (default is `True`). If \"update\",\n        always download the remote URLs to see if new data is available\n        and store the result in cache.\n\n        .. versionchanged:: 4.0\n            The default was changed to ``\"update\"`` and setting it to\n            ``False`` will print a Warning and set it to ``\"update\"`` again,\n            because the function will not work properly without cache. Using\n            ``True`` will work as expected.\n\n        .. versionchanged:: 3.0\n            The default was changed to ``True`` and setting it to ``False``\n            will print a Warning and set it to ``True`` again, because the\n            function will not work properly without cache.\n\n    show_progress : bool, optional\n        Whether to display a progress bar during the download (default\n        is `True`)\n\n    timeout : float, optional\n        Timeout for each individual requests in seconds (default is the\n        configurable `astropy.utils.data.Conf.remote_timeout`).\n\n    sources : dict, optional\n        If provided, for each URL a list of URLs to try to obtain the\n        file from. The result will be stored under the original URL.\n        For any URL in this dictionary, the original URL will *not* be\n        tried unless it is in this list; this is to prevent long waits\n        for a primary server that is known to be inaccessible at the\n        moment.\n\n    multiprocessing_start_method : str, optional\n        Useful primarily for testing; if in doubt leave it as the default.\n        When using multiprocessing, certain anomalies occur when starting\n        processes with the \"spawn\" method (the only option on Windows);\n        other anomalies occur with the \"fork\" method (the default on\n        Linux).\n\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    Returns\n    -------\n    paths : list of str\n        The local file paths corresponding to the downloaded URLs.\n\n    Notes\n    -----\n    If a URL is unreachable, the downloading will grind to a halt and the\n    exception will propagate upward, but an unpredictable number of\n    files will have been successfully downloaded and will remain in\n    the cache.\n    \"\"\"\n    from .console import ProgressBar\n\n    if timeout is None:\n        timeout = conf.remote_timeout\n    if sources is None:\n        sources = {}\n\n    if not cache:\n        # See issue #6662, on windows won't work because the files are removed\n        # again before they can be used. On *NIX systems it will behave as if\n        # cache was set to True because multiprocessing cannot insert the items\n        # in the list of to-be-removed files. This could be fixed, but really,\n        # just use the cache, with update_cache if appropriate.\n        warn('Disabling the cache does not work because of multiprocessing, '\n             'it will be set to ``\"update\"``. You may need to manually remove '\n             'the cached files with clear_download_cache() afterwards.',\n             AstropyWarning)\n        cache = \"update\"\n\n    if show_progress:\n        progress = sys.stdout\n    else:\n        progress = io.BytesIO()\n\n    # Combine duplicate URLs\n    combined_urls = list(set(urls))\n    combined_paths = ProgressBar.map(\n        _do_download_files_in_parallel,\n        [dict(remote_url=u,\n              cache=cache,\n              show_progress=False,\n              timeout=timeout,\n              sources=sources.get(u, None),\n              pkgname=pkgname,\n              temp_cache=astropy.config.paths.set_temp_cache._temp_path,\n              temp_config=astropy.config.paths.set_temp_config._temp_path)\n         for u in combined_urls],\n        file=progress,\n        multiprocess=True,\n        multiprocessing_start_method=multiprocessing_start_method,\n    )\n    paths = []\n    for url in urls:\n        paths.append(combined_paths[combined_urls.index(url)])\n    return paths\n\n\n# This is used by download_file and _deltemps to determine the files to delete\n# when the interpreter exits\n_tempfilestodel = []\n\n\n@atexit.register\ndef _deltemps():\n\n    global _tempfilestodel\n\n    if _tempfilestodel is not None:\n        while len(_tempfilestodel) > 0:\n            fn = _tempfilestodel.pop()\n            if os.path.isfile(fn):\n                try:\n                    os.remove(fn)\n                except OSError:\n                    # oh well we tried\n                    # could be held open by some process, on Windows\n                    pass\n            elif os.path.isdir(fn):\n                try:\n                    shutil.rmtree(fn)\n                except OSError:\n                    # couldn't get rid of it, sorry\n                    # could be held open by some process, on Windows\n                    pass\n\n\ndef clear_download_cache(hashorurl=None, pkgname='astropy'):\n    \"\"\"Clears the data file cache by deleting the local file(s).\n\n    If a URL is provided, it will be the name used in the cache. The contents\n    may have been downloaded from this URL or from a mirror or they may have\n    been provided by the user. See `~download_file` for details.\n\n    For the purposes of this function, a file can also be identified by a hash\n    of its contents or by the filename under which the data is stored (as\n    returned by `~download_file`, for example).\n\n    Parameters\n    ----------\n    hashorurl : str or None\n        If None, the whole cache is cleared.  Otherwise, specify\n        a hash for the cached file that is supposed to be deleted,\n        the full path to a file in the cache that should be deleted,\n        or a URL that should be removed from the cache if present.\n\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n    \"\"\"\n    try:\n        dldir = _get_download_cache_loc(pkgname)\n    except OSError as e:\n        # Problem arose when trying to open the cache\n        # Just a warning, though\n        msg = 'Not clearing data cache - cache inaccessible due to '\n        estr = '' if len(e.args) < 1 else (': ' + str(e))\n        warn(CacheMissingWarning(msg + e.__class__.__name__ + estr))\n        return\n    try:\n        if hashorurl is None:\n            # Optional: delete old incompatible caches too\n            _rmtree(dldir)\n        elif _is_url(hashorurl):\n            filepath = os.path.join(dldir, _url_to_dirname(hashorurl))\n            _rmtree(filepath)\n        else:\n            # Not a URL, it should be either a filename or a hash\n            filepath = os.path.join(dldir, hashorurl)\n            rp = os.path.relpath(filepath, dldir)\n            if rp.startswith(\"..\"):\n                raise RuntimeError(\n                    f\"attempted to use clear_download_cache on the path \"\n                    f\"{filepath} outside the data cache directory {dldir}\")\n            d, f = os.path.split(rp)\n            if d and f in [\"contents\", \"url\"]:\n                # It's a filename not the hash of a URL\n                # so we want to zap the directory containing the\n                # files \"url\" and \"contents\"\n                filepath = os.path.join(dldir, d)\n            if os.path.exists(filepath):\n                _rmtree(filepath)\n            elif (len(hashorurl) == 2*hashlib.md5().digest_size\n                    and re.match(r\"[0-9a-f]+\", hashorurl)):\n                # It's the hash of some file contents, we have to find the right file\n                filename = _find_hash_fn(hashorurl)\n                if filename is not None:\n                    clear_download_cache(filename)\n    except OSError as e:\n        msg = 'Not clearing data from cache - problem arose '\n        estr = '' if len(e.args) < 1 else (': ' + str(e))\n        warn(CacheMissingWarning(msg + e.__class__.__name__ + estr))\n\n\ndef _get_download_cache_loc(pkgname='astropy'):\n    \"\"\"Finds the path to the cache directory and makes them if they don't exist.\n\n    Parameters\n    ----------\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    Returns\n    -------\n    datadir : str\n        The path to the data cache directory.\n    \"\"\"\n    try:\n        datadir = os.path.join(astropy.config.paths.get_cache_dir(pkgname), 'download', 'url')\n\n        if not os.path.exists(datadir):\n            try:\n                os.makedirs(datadir)\n            except OSError:\n                if not os.path.exists(datadir):\n                    raise\n        elif not os.path.isdir(datadir):\n            raise OSError(f'Data cache directory {datadir} is not a directory')\n\n        return datadir\n    except OSError as e:\n        msg = 'Remote data cache could not be accessed due to '\n        estr = '' if len(e.args) < 1 else (': ' + str(e))\n        warn(CacheMissingWarning(msg + e.__class__.__name__ + estr))\n        raise\n\n\ndef _url_to_dirname(url):\n    if not _is_url(url):\n        raise ValueError(f\"Malformed URL: '{url}'\")\n    # Make domain names case-insensitive\n    # Also makes the http:// case-insensitive\n    urlobj = list(urllib.parse.urlsplit(url))\n    urlobj[1] = urlobj[1].lower()\n    if urlobj[0].lower() in ['http', 'https'] and urlobj[1] and urlobj[2] == '':\n        urlobj[2] = '/'\n    url_c = urllib.parse.urlunsplit(urlobj)\n    return hashlib.md5(url_c.encode(\"utf-8\")).hexdigest()\n\n\nclass ReadOnlyDict(dict):\n    def __setitem__(self, key, value):\n        raise TypeError(\"This object is read-only.\")\n\n\n_NOTHING = ReadOnlyDict({})\n\n\nclass CacheDamaged(ValueError):\n    \"\"\"Record the URL or file that was a problem.\n    Using clear_download_cache on the .bad_file or .bad_url attribute,\n    whichever is not None, should resolve this particular problem.\n    \"\"\"\n    def __init__(self, *args, bad_urls=None, bad_files=None, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.bad_urls = bad_urls if bad_urls is not None else []\n        self.bad_files = bad_files if bad_files is not None else []\n\n\ndef check_download_cache(pkgname='astropy'):\n    \"\"\"Do a consistency check on the cache.\n\n    .. note::\n\n        Since v5.0, this function no longer returns anything.\n\n    Because the cache is shared by all versions of ``astropy`` in all virtualenvs\n    run by your user, possibly concurrently, it could accumulate problems.\n    This could lead to hard-to-debug problems or wasted space. This function\n    detects a number of incorrect conditions, including nonexistent files that\n    are indexed, files that are indexed but in the wrong place, and, if you\n    request it, files whose content does not match the hash that is indexed.\n\n    This function also returns a list of non-indexed files. A few will be\n    associated with the shelve object; their exact names depend on the backend\n    used but will probably be based on ``urlmap``. The presence of other files\n    probably indicates that something has gone wrong and inaccessible files\n    have accumulated in the cache. These can be removed with\n    :func:`clear_download_cache`, either passing the filename returned here, or\n    with no arguments to empty the entire cache and return it to a\n    reasonable, if empty, state.\n\n    Parameters\n    ----------\n    pkgname : str, optional\n        The package name to use to locate the download cache, i.e., for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    Raises\n    ------\n    `~astropy.utils.data.CacheDamaged`\n        To indicate a problem with the cache contents; the exception contains\n        a ``.bad_files`` attribute containing a set of filenames to allow the\n        user to use :func:`clear_download_cache` to remove the offending items.\n    OSError, RuntimeError\n        To indicate some problem with the cache structure. This may need a full\n        :func:`clear_download_cache` to resolve, or may indicate some kind of\n        misconfiguration.\n    \"\"\"\n    bad_files = set()\n    messages = set()\n    dldir = _get_download_cache_loc(pkgname=pkgname)\n    with os.scandir(dldir) as it:\n        for entry in it:\n            f = os.path.abspath(os.path.join(dldir, entry.name))\n            if entry.name.startswith(\"rmtree-\"):\n                if f not in _tempfilestodel:\n                    bad_files.add(f)\n                    messages.add(f\"Cache entry {entry.name} not scheduled for deletion\")\n            elif entry.is_dir():\n                for sf in os.listdir(f):\n                    if sf in ['url', 'contents']:\n                        continue\n                    sf = os.path.join(f, sf)\n                    bad_files.add(sf)\n                    messages.add(f\"Unexpected file f{sf}\")\n                urlf = os.path.join(f, \"url\")\n                url = None\n                if not os.path.isfile(urlf):\n                    bad_files.add(urlf)\n                    messages.add(f\"Problem with URL file f{urlf}\")\n                else:\n                    url = get_file_contents(urlf, encoding=\"utf-8\")\n                    if not _is_url(url):\n                        bad_files.add(f)\n                        messages.add(f\"Malformed URL: {url}\")\n                    else:\n                        hashname = _url_to_dirname(url)\n                        if entry.name != hashname:\n                            bad_files.add(f)\n                            messages.add(f\"URL hashes to {hashname} but is stored in {entry.name}\")\n                if not os.path.isfile(os.path.join(f, \"contents\")):\n                    bad_files.add(f)\n                    if url is None:\n                        messages.add(f\"Hash {entry.name} is missing contents\")\n                    else:\n                        messages.add(f\"URL {url} with hash {entry.name} is missing contents\")\n            else:\n                bad_files.add(f)\n                messages.add(f\"Left-over non-directory {f} in cache\")\n    if bad_files:\n        raise CacheDamaged(\"\\n\".join(messages), bad_files=bad_files)\n\n\n@contextlib.contextmanager\ndef _SafeTemporaryDirectory(suffix=None, prefix=None, dir=None):\n    \"\"\"Temporary directory context manager\n\n    This will not raise an exception if the temporary directory goes away\n    before it's supposed to be deleted. Specifically, what is deleted will\n    be the directory *name* produced; if no such directory exists, no\n    exception will be raised.\n\n    It would be safer to delete it only if it's really the same directory\n    - checked by file descriptor - and if it's still called the same thing.\n    But that opens a platform-specific can of worms.\n\n    It would also be more robust to use ExitStack and TemporaryDirectory,\n    which is more aggressive about removing readonly things.\n    \"\"\"\n    d = mkdtemp(suffix=suffix, prefix=prefix, dir=dir)\n    try:\n        yield d\n    finally:\n        try:\n            shutil.rmtree(d)\n        except OSError:\n            pass\n\n\ndef _rmtree(path, replace=None):\n    \"\"\"More-atomic rmtree. Ignores missing directory.\"\"\"\n    with TemporaryDirectory(prefix=\"rmtree-\",\n                            dir=os.path.dirname(os.path.abspath(path))) as d:\n        try:\n            os.rename(path, os.path.join(d, \"to-zap\"))\n        except FileNotFoundError:\n            pass\n        except PermissionError:\n            warn(CacheMissingWarning(\n                f\"Unable to remove directory {path} because a file in it \"\n                f\"is in use and you are on Windows\", path))\n            raise\n        if replace is not None:\n            try:\n                os.rename(replace, path)\n            except FileExistsError:\n                # already there, fine\n                pass\n            except OSError as e:\n                if e.errno == errno.ENOTEMPTY:\n                    # already there, fine\n                    pass\n                else:\n                    raise\n\n\ndef import_file_to_cache(url_key, filename,\n                         remove_original=False,\n                         pkgname='astropy',\n                         *,\n                         replace=True):\n    \"\"\"Import the on-disk file specified by filename to the cache.\n\n    The provided ``url_key`` will be the name used in the cache. The file\n    should contain the contents of this URL, at least notionally (the URL may\n    be temporarily or permanently unavailable). It is using ``url_key`` that\n    users will request these contents from the cache. See :func:`download_file` for\n    details.\n\n    If ``url_key`` already exists in the cache, it will be updated to point to\n    these imported contents, and its old contents will be deleted from the\n    cache.\n\n    Parameters\n    ----------\n    url_key : str\n        The key to index the file under. This should probably be\n        the URL where the file was located, though if you obtained\n        it from a mirror you should use the URL of the primary\n        location.\n    filename : str\n        The file whose contents you want to import.\n    remove_original : bool\n        Whether to remove the original file (``filename``) once import is\n        complete.\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n    replace : boolean, optional\n        Whether or not to replace an existing object in the cache, if one exists.\n        If replacement is not requested but the object exists, silently pass.\n    \"\"\"\n    cache_dir = _get_download_cache_loc(pkgname=pkgname)\n    cache_dirname = _url_to_dirname(url_key)\n    local_dirname = os.path.join(cache_dir, cache_dirname)\n    local_filename = os.path.join(local_dirname, \"contents\")\n    with _SafeTemporaryDirectory(prefix=\"temp_dir\", dir=cache_dir) as temp_dir:\n        temp_filename = os.path.join(temp_dir, \"contents\")\n        # Make sure we're on the same filesystem\n        # This will raise an exception if the url_key doesn't turn into a valid filename\n        shutil.copy(filename, temp_filename)\n        with open(os.path.join(temp_dir, \"url\"), \"wt\", encoding=\"utf-8\") as f:\n            f.write(url_key)\n        if replace:\n            _rmtree(local_dirname, replace=temp_dir)\n        else:\n            try:\n                os.rename(temp_dir, local_dirname)\n            except FileExistsError:\n                # already there, fine\n                pass\n            except OSError as e:\n                if e.errno == errno.ENOTEMPTY:\n                    # already there, fine\n                    pass\n                else:\n                    raise\n    if remove_original:\n        os.remove(filename)\n    return os.path.abspath(local_filename)\n\n\ndef get_cached_urls(pkgname='astropy'):\n    \"\"\"\n    Get the list of URLs in the cache. Especially useful for looking up what\n    files are stored in your cache when you don't have internet access.\n\n    The listed URLs are the keys programs should use to access the file\n    contents, but those contents may have actually been obtained from a mirror.\n    See `~download_file` for details.\n\n    Parameters\n    ----------\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    Returns\n    -------\n    cached_urls : list\n        List of cached URLs.\n\n    See Also\n    --------\n    cache_contents : obtain a dictionary listing everything in the cache\n    \"\"\"\n    return sorted(cache_contents(pkgname=pkgname).keys())\n\n\ndef cache_contents(pkgname='astropy'):\n    \"\"\"Obtain a dict mapping cached URLs to filenames.\n\n    This dictionary is a read-only snapshot of the state of the cache when this\n    function was called. If other processes are actively working with the\n    cache, it is possible for them to delete files that are listed in this\n    dictionary. Use with some caution if you are working on a system that is\n    busy with many running astropy processes, although the same issues apply to\n    most functions in this module.\n    \"\"\"\n    r = {}\n    try:\n        dldir = _get_download_cache_loc(pkgname=pkgname)\n    except OSError:\n        return _NOTHING\n    with os.scandir(dldir) as it:\n        for entry in it:\n            if entry.is_dir:\n                url = get_file_contents(os.path.join(dldir, entry.name, \"url\"), encoding=\"utf-8\")\n                r[url] = os.path.abspath(os.path.join(dldir, entry.name, \"contents\"))\n    return ReadOnlyDict(r)\n\n\ndef export_download_cache(filename_or_obj, urls=None, overwrite=False, pkgname='astropy'):\n    \"\"\"Exports the cache contents as a ZIP file.\n\n    Parameters\n    ----------\n    filename_or_obj : str or file-like\n        Where to put the created ZIP file. Must be something the zipfile\n        module can write to.\n    urls : iterable of str or None\n        The URLs to include in the exported cache. The default is all\n        URLs currently in the cache. If a URL is included in this list\n        but is not currently in the cache, a KeyError will be raised.\n        To ensure that all are in the cache use `~download_file`\n        or `~download_files_in_parallel`.\n    overwrite : bool, optional\n        If filename_or_obj is a filename that exists, it will only be\n        overwritten if this is True.\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    See Also\n    --------\n    import_download_cache : import the contents of such a ZIP file\n    import_file_to_cache : import a single file directly\n    \"\"\"\n    if urls is None:\n        urls = get_cached_urls(pkgname)\n    with zipfile.ZipFile(filename_or_obj, 'w' if overwrite else 'x') as z:\n        for u in urls:\n            fn = download_file(u, cache=True, sources=[], pkgname=pkgname)\n            # Do not use os.path.join because ZIP files want\n            # \"/\" on all platforms\n            z_fn = urllib.parse.quote(u, safe=\"\")\n            z.write(fn, z_fn)\n\n\ndef import_download_cache(filename_or_obj, urls=None, update_cache=False, pkgname='astropy'):\n    \"\"\"Imports the contents of a ZIP file into the cache.\n\n    Each member of the ZIP file should be named by a quoted version of the\n    URL whose contents it stores. These names are decoded with\n    :func:`~urllib.parse.unquote`.\n\n    Parameters\n    ----------\n    filename_or_obj : str or file-like\n        Where the stored ZIP file is. Must be something the :mod:`~zipfile`\n        module can read from.\n    urls : set of str or list of str or None\n        The URLs to import from the ZIP file. The default is all\n        URLs in the file.\n    update_cache : bool, optional\n        If True, any entry in the ZIP file will overwrite the value in the\n        cache; if False, leave untouched any entry already in the cache.\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    See Also\n    --------\n    export_download_cache : export the contents the cache to of such a ZIP file\n    import_file_to_cache : import a single file directly\n    \"\"\"\n    with zipfile.ZipFile(filename_or_obj, 'r') as z, TemporaryDirectory() as d:\n        for i, zf in enumerate(z.infolist()):\n            url = urllib.parse.unquote(zf.filename)\n            # FIXME(aarchiba): do we want some kind of validation on this URL?\n            # urllib.parse might do something sensible...but what URLs might\n            # they have?\n            # is_url in this file is probably a good check, not just here\n            # but throughout this file.\n            if urls is not None and url not in urls:\n                continue\n            if not update_cache and is_url_in_cache(url, pkgname=pkgname):\n                continue\n            f_temp_name = os.path.join(d, str(i))\n            with z.open(zf) as f_zip, open(f_temp_name, \"wb\") as f_temp:\n                block = f_zip.read(conf.download_block_size)\n                while block:\n                    f_temp.write(block)\n                    block = f_zip.read(conf.download_block_size)\n            import_file_to_cache(url, f_temp_name,\n                                 remove_original=True,\n                                 pkgname=pkgname)\n"},{"col":0,"comment":"null","endLoc":127,"header":"def helper_s2pv(f, unit_theta, unit_phi, unit_r, unit_td, unit_pd, unit_rd)","id":10523,"name":"helper_s2pv","nodeType":"Function","startLoc":119,"text":"def helper_s2pv(f, unit_theta, unit_phi, unit_r, unit_td, unit_pd, unit_rd):\n    from astropy.units.si import radian\n    time_unit = unit_r / unit_rd\n    return [get_converter(unit_theta, radian),\n            get_converter(unit_phi, radian),\n            None,\n            get_converter(unit_td, radian / time_unit),\n            get_converter(unit_pd, radian / time_unit),\n            None], StructuredUnit((unit_r, unit_rd))"},{"attributeType":"null","col":4,"comment":"null","endLoc":355,"id":10524,"name":"ufunc","nodeType":"Attribute","startLoc":355,"text":"ufunc"},{"attributeType":"null","col":0,"comment":"null","endLoc":359,"id":10525,"name":"dimensionless_to_radian_ufuncs","nodeType":"Attribute","startLoc":359,"text":"dimensionless_to_radian_ufuncs"},{"attributeType":"null","col":4,"comment":"null","endLoc":361,"id":10526,"name":"ufunc","nodeType":"Attribute","startLoc":361,"text":"ufunc"},{"attributeType":"null","col":0,"comment":"null","endLoc":365,"id":10527,"name":"degree_to_radian_ufuncs","nodeType":"Attribute","startLoc":365,"text":"degree_to_radian_ufuncs"},{"attributeType":"null","col":4,"comment":"null","endLoc":366,"id":10528,"name":"ufunc","nodeType":"Attribute","startLoc":366,"text":"ufunc"},{"attributeType":"null","col":0,"comment":"null","endLoc":370,"id":10529,"name":"radian_to_degree_ufuncs","nodeType":"Attribute","startLoc":370,"text":"radian_to_degree_ufuncs"},{"attributeType":"null","col":4,"comment":"null","endLoc":371,"id":10530,"name":"ufunc","nodeType":"Attribute","startLoc":371,"text":"ufunc"},{"attributeType":"null","col":0,"comment":"null","endLoc":375,"id":10531,"name":"radian_to_dimensionless_ufuncs","nodeType":"Attribute","startLoc":375,"text":"radian_to_dimensionless_ufuncs"},{"attributeType":"null","col":4,"comment":"null","endLoc":377,"id":10532,"name":"ufunc","nodeType":"Attribute","startLoc":377,"text":"ufunc"},{"attributeType":"null","col":0,"comment":"null","endLoc":394,"id":10533,"name":"two_arg_dimensionless_ufuncs","nodeType":"Attribute","startLoc":394,"text":"two_arg_dimensionless_ufuncs"},{"attributeType":"null","col":4,"comment":"null","endLoc":395,"id":10534,"name":"ufunc","nodeType":"Attribute","startLoc":395,"text":"ufunc"},{"attributeType":"null","col":0,"comment":"null","endLoc":399,"id":10535,"name":"twoarg_invariant_ufuncs","nodeType":"Attribute","startLoc":399,"text":"twoarg_invariant_ufuncs"},{"col":4,"comment":"null","endLoc":359,"header":"def __ilshift__(self, other)","id":10536,"name":"__ilshift__","nodeType":"Function","startLoc":336,"text":"def __ilshift__(self, other):\n        try:\n            other = Unit(other)\n        except UnitTypeError:\n            return NotImplemented\n\n        if not isinstance(other, self._unit_class):\n            return NotImplemented\n\n        try:\n            factor = self.unit.physical_unit._to(other.physical_unit)\n        except UnitConversionError:\n            # Maybe via equivalencies?  Now we do make a temporary copy.\n            try:\n                value = self._to_value(other)\n            except UnitConversionError:\n                return NotImplemented\n\n            self.view(np.ndarray)[...] = value\n        else:\n            self.view(np.ndarray)[...] += self.unit.from_physical(factor)\n\n        self._set_unit(other)\n        return self"},{"className":"_NonClosingBufferedReader","col":0,"comment":"null","endLoc":70,"id":10537,"nodeType":"Class","startLoc":63,"text":"class _NonClosingBufferedReader(io.BufferedReader):\n    def __del__(self):\n        try:\n            # NOTE: self.raw will not be closed, but left in the state\n            # it was in at detactment\n            self.detach()\n        except Exception:\n            pass"},{"col":4,"comment":"null","endLoc":70,"header":"def __del__(self)","id":10538,"name":"__del__","nodeType":"Function","startLoc":64,"text":"def __del__(self):\n        try:\n            # NOTE: self.raw will not be closed, but left in the state\n            # it was in at detactment\n            self.detach()\n        except Exception:\n            pass"},{"className":"_NonClosingTextIOWrapper","col":0,"comment":"null","endLoc":80,"id":10539,"nodeType":"Class","startLoc":73,"text":"class _NonClosingTextIOWrapper(io.TextIOWrapper):\n    def __del__(self):\n        try:\n            # NOTE: self.stream will not be closed, but left in the state\n            # it was in at detactment\n            self.detach()\n        except Exception:\n            pass"},{"col":4,"comment":"null","endLoc":80,"header":"def __del__(self)","id":10540,"name":"__del__","nodeType":"Function","startLoc":74,"text":"def __del__(self):\n        try:\n            # NOTE: self.stream will not be closed, but left in the state\n            # it was in at detactment\n            self.detach()\n        except Exception:\n            pass"},{"attributeType":"null","col":4,"comment":"null","endLoc":402,"id":10541,"name":"ufunc","nodeType":"Attribute","startLoc":402,"text":"ufunc"},{"attributeType":"null","col":0,"comment":"null","endLoc":406,"id":10542,"name":"twoarg_comparison_ufuncs","nodeType":"Attribute","startLoc":406,"text":"twoarg_comparison_ufuncs"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.utils.data`.\n    ","endLoc":115,"id":10543,"nodeType":"Class","startLoc":83,"text":"class Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.utils.data`.\n    \"\"\"\n\n    dataurl = _config.ConfigItem(\n        'http://data.astropy.org/',\n        'Primary URL for astropy remote data site.')\n    dataurl_mirror = _config.ConfigItem(\n        'http://www.astropy.org/astropy-data/',\n        'Mirror URL for astropy remote data site.')\n    default_http_user_agent = _config.ConfigItem(\n        'astropy',\n        'Default User-Agent for HTTP request headers. This can be overwritten '\n        'for a particular call via http_headers option, where available. '\n        'This only provides the default value when not set by https_headers.')\n    remote_timeout = _config.ConfigItem(\n        10.,\n        'Time to wait for remote data queries (in seconds).',\n        aliases=['astropy.coordinates.name_resolve.name_resolve_timeout'])\n    allow_internet = _config.ConfigItem(\n        True,\n        'If False, prevents any attempt to download from Internet.')\n    compute_hash_block_size = _config.ConfigItem(\n        2 ** 16,  # 64K\n        'Block size for computing file hashes.')\n    download_block_size = _config.ConfigItem(\n        2 ** 16,  # 64K\n        'Number of bytes of remote data to download per step.')\n    delete_temporary_downloads_at_exit = _config.ConfigItem(\n        True,\n        'If True, temporary download files created when the cache is '\n        'inaccessible will be deleted at the end of the python session.')"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":88,"id":10544,"name":"dataurl","nodeType":"Attribute","startLoc":88,"text":"dataurl"},{"attributeType":"null","col":4,"comment":"null","endLoc":408,"id":10545,"name":"ufunc","nodeType":"Attribute","startLoc":408,"text":"ufunc"},{"attributeType":"null","col":0,"comment":"null","endLoc":412,"id":10546,"name":"twoarg_invtrig_ufuncs","nodeType":"Attribute","startLoc":412,"text":"twoarg_invtrig_ufuncs"},{"attributeType":"null","col":4,"comment":"null","endLoc":416,"id":10547,"name":"ufunc","nodeType":"Attribute","startLoc":416,"text":"ufunc"},{"col":0,"comment":"","endLoc":9,"header":"helpers.py#<anonymous>","id":10548,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"\"\"\"Helper functions for Quantity.\n\nIn particular, this implements the logic that determines scaling and result\nunits for a given ufunc, given input units.\n\"\"\"\n\none_half = 0.5  # faster than Fraction(1, 2)\n\none_third = Fraction(1, 3)\n\nhelper_twoarg_invariant = get_converters_and_unit\n\nUNSUPPORTED_UFUNCS |= {\n    np.bitwise_and, np.bitwise_or, np.bitwise_xor, np.invert, np.left_shift,\n    np.right_shift, np.logical_and, np.logical_or, np.logical_xor,\n    np.logical_not, np.isnat, np.gcd, np.lcm}\n\nonearg_test_ufuncs = (np.isfinite, np.isinf, np.isnan, np.sign, np.signbit)\n\nfor ufunc in onearg_test_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_onearg_test\n\ninvariant_ufuncs = (np.absolute, np.fabs, np.conj, np.conjugate, np.negative,\n                    np.spacing, np.rint, np.floor, np.ceil, np.trunc,\n                    np.positive)\n\nfor ufunc in invariant_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_invariant\n\ndimensionless_to_dimensionless_ufuncs = (np.exp, np.expm1, np.exp2, np.log,\n                                         np.log10, np.log2, np.log1p)\n\nif isinstance(getattr(np.core.umath, 'erf', None), np.ufunc):\n    dimensionless_to_dimensionless_ufuncs += (np.core.umath.erf,)\n\nfor ufunc in dimensionless_to_dimensionless_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_dimensionless_to_dimensionless\n\ndimensionless_to_radian_ufuncs = (np.arccos, np.arcsin, np.arctan, np.arccosh,\n                                  np.arcsinh, np.arctanh)\n\nfor ufunc in dimensionless_to_radian_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_dimensionless_to_radian\n\ndegree_to_radian_ufuncs = (np.radians, np.deg2rad)\n\nfor ufunc in degree_to_radian_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_degree_to_radian\n\nradian_to_degree_ufuncs = (np.degrees, np.rad2deg)\n\nfor ufunc in radian_to_degree_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_radian_to_degree\n\nradian_to_dimensionless_ufuncs = (np.cos, np.sin, np.tan, np.cosh, np.sinh,\n                                  np.tanh)\n\nfor ufunc in radian_to_dimensionless_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_radian_to_dimensionless\n\nUFUNC_HELPERS[np.sqrt] = helper_sqrt\n\nUFUNC_HELPERS[np.square] = helper_square\n\nUFUNC_HELPERS[np.reciprocal] = helper_reciprocal\n\nUFUNC_HELPERS[np.cbrt] = helper_cbrt\n\nUFUNC_HELPERS[np.core.umath._ones_like] = helper__ones_like\n\nUFUNC_HELPERS[np.modf] = helper_modf\n\nUFUNC_HELPERS[np.frexp] = helper_frexp\n\ntwo_arg_dimensionless_ufuncs = (np.logaddexp, np.logaddexp2)\n\nfor ufunc in two_arg_dimensionless_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_two_arg_dimensionless\n\ntwoarg_invariant_ufuncs = (np.add, np.subtract, np.hypot, np.maximum,\n                           np.minimum, np.fmin, np.fmax, np.nextafter,\n                           np.remainder, np.mod, np.fmod)\n\nfor ufunc in twoarg_invariant_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_twoarg_invariant\n\ntwoarg_comparison_ufuncs = (np.greater, np.greater_equal, np.less,\n                            np.less_equal, np.not_equal, np.equal)\n\nfor ufunc in twoarg_comparison_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_twoarg_comparison\n\ntwoarg_invtrig_ufuncs = (np.arctan2,)\n\nif isinstance(getattr(np.core.umath, '_arg', None), np.ufunc):\n    twoarg_invtrig_ufuncs += (np.core.umath._arg,)\n\nfor ufunc in twoarg_invtrig_ufuncs:\n    UFUNC_HELPERS[ufunc] = helper_twoarg_invtrig\n\nUFUNC_HELPERS[np.multiply] = helper_multiplication\n\nif isinstance(getattr(np, 'matmul', None), np.ufunc):\n    UFUNC_HELPERS[np.matmul] = helper_multiplication\n\nUFUNC_HELPERS[np.divide] = helper_division\n\nUFUNC_HELPERS[np.true_divide] = helper_division\n\nUFUNC_HELPERS[np.power] = helper_power\n\nUFUNC_HELPERS[np.ldexp] = helper_ldexp\n\nUFUNC_HELPERS[np.copysign] = helper_copysign\n\nUFUNC_HELPERS[np.floor_divide] = helper_twoarg_floor_divide\n\nUFUNC_HELPERS[np.heaviside] = helper_heaviside\n\nUFUNC_HELPERS[np.float_power] = helper_power\n\nUFUNC_HELPERS[np.divmod] = helper_divmod\n\nif isinstance(getattr(np.core.umath, 'clip', None), np.ufunc):\n    UFUNC_HELPERS[np.core.umath.clip] = helper_clip\n\ndel ufunc"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":91,"id":10549,"name":"dataurl_mirror","nodeType":"Attribute","startLoc":91,"text":"dataurl_mirror"},{"fileName":"console.py","filePath":"astropy/utils","id":10550,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nUtilities for console input and output.\n\"\"\"\n\nimport codecs\nimport locale\nimport re\nimport math\nimport multiprocessing\nimport os\nimport struct\nimport sys\nimport threading\nimport time\nfrom concurrent.futures import ProcessPoolExecutor, as_completed\n\ntry:\n    import fcntl\n    import termios\n    import signal\n    _CAN_RESIZE_TERMINAL = True\nexcept ImportError:\n    _CAN_RESIZE_TERMINAL = False\n\nfrom astropy import conf\n\nfrom .misc import isiterable\nfrom .decorators import classproperty\n\n\n__all__ = [\n    'isatty', 'color_print', 'human_time', 'human_file_size',\n    'ProgressBar', 'Spinner', 'print_code_line', 'ProgressBarOrSpinner',\n    'terminal_size']\n\n_DEFAULT_ENCODING = 'utf-8'\n\n\nclass _IPython:\n    \"\"\"Singleton class given access to IPython streams, etc.\"\"\"\n\n    @classproperty\n    def get_ipython(cls):\n        try:\n            from IPython import get_ipython\n        except ImportError:\n            pass\n        return get_ipython\n\n    @classproperty\n    def OutStream(cls):\n        if not hasattr(cls, '_OutStream'):\n            cls._OutStream = None\n            try:\n                cls.get_ipython()\n            except NameError:\n                return None\n\n            try:\n                from ipykernel.iostream import OutStream\n            except ImportError:\n                try:\n                    from IPython.zmq.iostream import OutStream\n                except ImportError:\n                    from IPython import version_info\n                    if version_info[0] >= 4:\n                        return None\n\n                    try:\n                        from IPython.kernel.zmq.iostream import OutStream\n                    except ImportError:\n                        return None\n\n            cls._OutStream = OutStream\n\n        return cls._OutStream\n\n    @classproperty\n    def ipyio(cls):\n        if not hasattr(cls, '_ipyio'):\n            try:\n                from IPython.utils import io\n            except ImportError:\n                cls._ipyio = None\n            else:\n                cls._ipyio = io\n        return cls._ipyio\n\n    @classmethod\n    def get_stream(cls, stream):\n        return getattr(cls.ipyio, stream)\n\n\ndef _get_stdout(stderr=False):\n    \"\"\"\n    This utility function contains the logic to determine what streams to use\n    by default for standard out/err.\n\n    Typically this will just return `sys.stdout`, but it contains additional\n    logic for use in IPython on Windows to determine the correct stream to use\n    (usually ``IPython.util.io.stdout`` but only if sys.stdout is a TTY).\n    \"\"\"\n\n    if stderr:\n        stream = 'stderr'\n    else:\n        stream = 'stdout'\n\n    sys_stream = getattr(sys, stream)\n    return sys_stream\n\n\ndef isatty(file):\n    \"\"\"\n    Returns `True` if ``file`` is a tty.\n\n    Most built-in Python file-like objects have an `isatty` member,\n    but some user-defined types may not, so this assumes those are not\n    ttys.\n    \"\"\"\n    if (multiprocessing.current_process().name != 'MainProcess' or\n            threading.current_thread().name != 'MainThread'):\n        return False\n\n    if hasattr(file, 'isatty'):\n        return file.isatty()\n\n    if _IPython.OutStream is None or (not isinstance(file, _IPython.OutStream)):\n        return False\n\n    # File is an IPython OutStream. Check whether:\n    # - File name is 'stdout'; or\n    # - File wraps a Console\n    if getattr(file, 'name', None) == 'stdout':\n        return True\n\n    if hasattr(file, 'stream'):\n        # FIXME: pyreadline has no had new release since 2015, drop it when\n        #        IPython minversion is 5.x.\n        # On Windows, in IPython 2 the standard I/O streams will wrap\n        # pyreadline.Console objects if pyreadline is available; this should\n        # be considered a TTY.\n        try:\n            from pyreadline.console import Console as PyreadlineConsole\n        except ImportError:\n            return False\n\n        return isinstance(file.stream, PyreadlineConsole)\n\n    return False\n\n\ndef terminal_size(file=None):\n    \"\"\"\n    Returns a tuple (height, width) containing the height and width of\n    the terminal.\n\n    This function will look for the width in height in multiple areas\n    before falling back on the width and height in astropy's\n    configuration.\n    \"\"\"\n\n    if file is None:\n        file = _get_stdout()\n\n    try:\n        s = struct.pack(\"HHHH\", 0, 0, 0, 0)\n        x = fcntl.ioctl(file, termios.TIOCGWINSZ, s)\n        (lines, width, xpixels, ypixels) = struct.unpack(\"HHHH\", x)\n        if lines > 12:\n            lines -= 6\n        if width > 10:\n            width -= 1\n        if lines <= 0 or width <= 0:\n            raise Exception('unable to get terminal size')\n        return (lines, width)\n    except Exception:\n        try:\n            # see if POSIX standard variables will work\n            return (int(os.environ.get('LINES')),\n                    int(os.environ.get('COLUMNS')))\n        except TypeError:\n            # fall back on configuration variables, or if not\n            # set, (25, 80)\n            lines = conf.max_lines\n            width = conf.max_width\n            if lines is None:\n                lines = 25\n            if width is None:\n                width = 80\n            return lines, width\n\n\ndef _color_text(text, color):\n    \"\"\"\n    Returns a string wrapped in ANSI color codes for coloring the\n    text in a terminal::\n\n        colored_text = color_text('Here is a message', 'blue')\n\n    This won't actually effect the text until it is printed to the\n    terminal.\n\n    Parameters\n    ----------\n    text : str\n        The string to return, bounded by the color codes.\n    color : str\n        An ANSI terminal color name. Must be one of:\n        black, red, green, brown, blue, magenta, cyan, lightgrey,\n        default, darkgrey, lightred, lightgreen, yellow, lightblue,\n        lightmagenta, lightcyan, white, or '' (the empty string).\n    \"\"\"\n    color_mapping = {\n        'black': '0;30',\n        'red': '0;31',\n        'green': '0;32',\n        'brown': '0;33',\n        'blue': '0;34',\n        'magenta': '0;35',\n        'cyan': '0;36',\n        'lightgrey': '0;37',\n        'default': '0;39',\n        'darkgrey': '1;30',\n        'lightred': '1;31',\n        'lightgreen': '1;32',\n        'yellow': '1;33',\n        'lightblue': '1;34',\n        'lightmagenta': '1;35',\n        'lightcyan': '1;36',\n        'white': '1;37'}\n\n    if sys.platform == 'win32' and _IPython.OutStream is None:\n        # On Windows do not colorize text unless in IPython\n        return text\n\n    color_code = color_mapping.get(color, '0;39')\n    return f'\\033[{color_code}m{text}\\033[0m'\n\n\ndef _decode_preferred_encoding(s):\n    \"\"\"Decode the supplied byte string using the preferred encoding\n    for the locale (`locale.getpreferredencoding`) or, if the default encoding\n    is invalid, fall back first on utf-8, then on latin-1 if the message cannot\n    be decoded with utf-8.\n    \"\"\"\n\n    enc = locale.getpreferredencoding()\n    try:\n        try:\n            return s.decode(enc)\n        except LookupError:\n            enc = _DEFAULT_ENCODING\n        return s.decode(enc)\n    except UnicodeDecodeError:\n        return s.decode('latin-1')\n\n\ndef _write_with_fallback(s, write, fileobj):\n    \"\"\"Write the supplied string with the given write function like\n    ``write(s)``, but use a writer for the locale's preferred encoding in case\n    of a UnicodeEncodeError.  Failing that attempt to write with 'utf-8' or\n    'latin-1'.\n    \"\"\"\n    try:\n        write(s)\n        return write\n    except UnicodeEncodeError:\n        # Let's try the next approach...\n        pass\n\n    enc = locale.getpreferredencoding()\n    try:\n        Writer = codecs.getwriter(enc)\n    except LookupError:\n        Writer = codecs.getwriter(_DEFAULT_ENCODING)\n\n    f = Writer(fileobj)\n    write = f.write\n\n    try:\n        write(s)\n        return write\n    except UnicodeEncodeError:\n        Writer = codecs.getwriter('latin-1')\n        f = Writer(fileobj)\n        write = f.write\n\n    # If this doesn't work let the exception bubble up; I'm out of ideas\n    write(s)\n    return write\n\n\ndef color_print(*args, end='\\n', **kwargs):\n    \"\"\"\n    Prints colors and styles to the terminal uses ANSI escape\n    sequences.\n\n    ::\n\n       color_print('This is the color ', 'default', 'GREEN', 'green')\n\n    Parameters\n    ----------\n    positional args : str\n        The positional arguments come in pairs (*msg*, *color*), where\n        *msg* is the string to display and *color* is the color to\n        display it in.\n\n        *color* is an ANSI terminal color name.  Must be one of:\n        black, red, green, brown, blue, magenta, cyan, lightgrey,\n        default, darkgrey, lightred, lightgreen, yellow, lightblue,\n        lightmagenta, lightcyan, white, or '' (the empty string).\n\n    file : writable file-like, optional\n        Where to write to.  Defaults to `sys.stdout`.  If file is not\n        a tty (as determined by calling its `isatty` member, if one\n        exists), no coloring will be included.\n\n    end : str, optional\n        The ending of the message.  Defaults to ``\\\\n``.  The end will\n        be printed after resetting any color or font state.\n    \"\"\"\n\n    file = kwargs.get('file', _get_stdout())\n\n    write = file.write\n    if isatty(file) and conf.use_color:\n        for i in range(0, len(args), 2):\n            msg = args[i]\n            if i + 1 == len(args):\n                color = ''\n            else:\n                color = args[i + 1]\n\n            if color:\n                msg = _color_text(msg, color)\n\n            # Some file objects support writing unicode sensibly on some Python\n            # versions; if this fails try creating a writer using the locale's\n            # preferred encoding. If that fails too give up.\n\n            write = _write_with_fallback(msg, write, file)\n\n        write(end)\n    else:\n        for i in range(0, len(args), 2):\n            msg = args[i]\n            write(msg)\n        write(end)\n\n\ndef strip_ansi_codes(s):\n    \"\"\"\n    Remove ANSI color codes from the string.\n    \"\"\"\n    return re.sub('\\033\\\\[([0-9]+)(;[0-9]+)*m', '', s)\n\n\ndef human_time(seconds):\n    \"\"\"\n    Returns a human-friendly time string that is always exactly 6\n    characters long.\n\n    Depending on the number of seconds given, can be one of::\n\n        1w 3d\n        2d 4h\n        1h 5m\n        1m 4s\n          15s\n\n    Will be in color if console coloring is turned on.\n\n    Parameters\n    ----------\n    seconds : int\n        The number of seconds to represent\n\n    Returns\n    -------\n    time : str\n        A human-friendly representation of the given number of seconds\n        that is always exactly 6 characters.\n    \"\"\"\n    units = [\n        ('y', 60 * 60 * 24 * 7 * 52),\n        ('w', 60 * 60 * 24 * 7),\n        ('d', 60 * 60 * 24),\n        ('h', 60 * 60),\n        ('m', 60),\n        ('s', 1),\n    ]\n\n    seconds = int(seconds)\n\n    if seconds < 60:\n        return f'   {seconds:2d}s'\n    for i in range(len(units) - 1):\n        unit1, limit1 = units[i]\n        unit2, limit2 = units[i + 1]\n        if seconds >= limit1:\n            return '{:2d}{}{:2d}{}'.format(\n                seconds // limit1, unit1,\n                (seconds % limit1) // limit2, unit2)\n    return '  ~inf'\n\n\ndef human_file_size(size):\n    \"\"\"\n    Returns a human-friendly string representing a file size\n    that is 2-4 characters long.\n\n    For example, depending on the number of bytes given, can be one\n    of::\n\n        256b\n        64k\n        1.1G\n\n    Parameters\n    ----------\n    size : int\n        The size of the file (in bytes)\n\n    Returns\n    -------\n    size : str\n        A human-friendly representation of the size of the file\n    \"\"\"\n    if hasattr(size, 'unit'):\n        # Import units only if necessary because the import takes a\n        # significant time [#4649]\n        from astropy import units as u\n        size = u.Quantity(size, u.byte).value\n\n    suffixes = ' kMGTPEZY'\n    if size == 0:\n        num_scale = 0\n    else:\n        num_scale = int(math.floor(math.log(size) / math.log(1000)))\n    if num_scale > 7:\n        suffix = '?'\n    else:\n        suffix = suffixes[num_scale]\n    num_scale = int(math.pow(1000, num_scale))\n    value = size / num_scale\n    str_value = str(value)\n    if suffix == ' ':\n        str_value = str_value[:str_value.index('.')]\n    elif str_value[2] == '.':\n        str_value = str_value[:2]\n    else:\n        str_value = str_value[:3]\n    return f\"{str_value:>3s}{suffix}\"\n\n\nclass _mapfunc(object):\n    \"\"\"\n    A function wrapper to support ProgressBar.map().\n    \"\"\"\n\n    def __init__(self, func):\n        self._func = func\n\n    def __call__(self, i_arg):\n        i, arg = i_arg\n        return i, self._func(arg)\n\n\nclass ProgressBar:\n    \"\"\"\n    A class to display a progress bar in the terminal.\n\n    It is designed to be used either with the ``with`` statement::\n\n        with ProgressBar(len(items)) as bar:\n            for item in enumerate(items):\n                bar.update()\n\n    or as a generator::\n\n        for item in ProgressBar(items):\n            item.process()\n    \"\"\"\n\n    def __init__(self, total_or_items, ipython_widget=False, file=None):\n        \"\"\"\n        Parameters\n        ----------\n        total_or_items : int or sequence\n            If an int, the number of increments in the process being\n            tracked.  If a sequence, the items to iterate over.\n\n        ipython_widget : bool, optional\n            If `True`, the progress bar will display as an IPython\n            notebook widget.\n\n        file : writable file-like, optional\n            The file to write the progress bar to.  Defaults to\n            `sys.stdout`.  If ``file`` is not a tty (as determined by\n            calling its `isatty` member, if any, or special case hacks\n            to detect the IPython console), the progress bar will be\n            completely silent.\n        \"\"\"\n        if file is None:\n            file = _get_stdout()\n\n        if not ipython_widget and not isatty(file):\n            self.update = self._silent_update\n            self._silent = True\n        else:\n            self._silent = False\n\n        if isiterable(total_or_items):\n            self._items = iter(total_or_items)\n            self._total = len(total_or_items)\n        else:\n            try:\n                self._total = int(total_or_items)\n            except TypeError:\n                raise TypeError(\"First argument must be int or sequence\")\n            else:\n                self._items = iter(range(self._total))\n\n        self._file = file\n        self._start_time = time.time()\n        self._human_total = human_file_size(self._total)\n        self._ipython_widget = ipython_widget\n\n        self._signal_set = False\n        if not ipython_widget:\n            self._should_handle_resize = (\n                _CAN_RESIZE_TERMINAL and self._file.isatty())\n            self._handle_resize()\n            if self._should_handle_resize:\n                signal.signal(signal.SIGWINCH, self._handle_resize)\n                self._signal_set = True\n\n        self.update(0)\n\n    def _handle_resize(self, signum=None, frame=None):\n        terminal_width = terminal_size(self._file)[1]\n        self._bar_length = terminal_width - 37\n\n    def __enter__(self):\n        return self\n\n    def __exit__(self, exc_type, exc_value, traceback):\n        if not self._silent:\n            if exc_type is None:\n                self.update(self._total)\n            self._file.write('\\n')\n            self._file.flush()\n            if self._signal_set:\n                signal.signal(signal.SIGWINCH, signal.SIG_DFL)\n\n    def __iter__(self):\n        return self\n\n    def __next__(self):\n        try:\n            rv = next(self._items)\n        except StopIteration:\n            self.__exit__(None, None, None)\n            raise\n        else:\n            self.update()\n            return rv\n\n    def update(self, value=None):\n        \"\"\"\n        Update progress bar via the console or notebook accordingly.\n        \"\"\"\n\n        # Update self.value\n        if value is None:\n            value = self._current_value + 1\n        self._current_value = value\n\n        # Choose the appropriate environment\n        if self._ipython_widget:\n            self._update_ipython_widget(value)\n        else:\n            self._update_console(value)\n\n    def _update_console(self, value=None):\n        \"\"\"\n        Update the progress bar to the given value (out of the total\n        given to the constructor).\n        \"\"\"\n\n        if self._total == 0:\n            frac = 1.0\n        else:\n            frac = float(value) / float(self._total)\n\n        file = self._file\n        write = file.write\n\n        if frac > 1:\n            bar_fill = int(self._bar_length)\n        else:\n            bar_fill = int(float(self._bar_length) * frac)\n        write('\\r|')\n        color_print('=' * bar_fill, 'blue', file=file, end='')\n        if bar_fill < self._bar_length:\n            color_print('>', 'green', file=file, end='')\n            write('-' * (self._bar_length - bar_fill - 1))\n        write('|')\n\n        if value >= self._total:\n            t = time.time() - self._start_time\n            prefix = '     '\n        elif value <= 0:\n            t = None\n            prefix = ''\n        else:\n            t = ((time.time() - self._start_time) * (1.0 - frac)) / frac\n            prefix = ' ETA '\n        write(f' {human_file_size(value):>4s}/{self._human_total:>4s}')\n        write(f' ({frac:>6.2%})')\n        write(prefix)\n        if t is not None:\n            write(human_time(t))\n        self._file.flush()\n\n    def _update_ipython_widget(self, value=None):\n        \"\"\"\n        Update the progress bar to the given value (out of a total\n        given to the constructor).\n\n        This method is for use in the IPython notebook 2+.\n        \"\"\"\n\n        # Create and display an empty progress bar widget,\n        # if none exists.\n        if not hasattr(self, '_widget'):\n            # Import only if an IPython widget, i.e., widget in iPython NB\n            from IPython import version_info\n            if version_info[0] < 4:\n                from IPython.html import widgets\n                self._widget = widgets.FloatProgressWidget()\n            else:\n                _IPython.get_ipython()\n                from ipywidgets import widgets\n                self._widget = widgets.FloatProgress()\n            from IPython.display import display\n\n            display(self._widget)\n            self._widget.value = 0\n\n        # Calculate percent completion, and update progress bar\n        frac = (value/self._total)\n        self._widget.value = frac * 100\n        self._widget.description = f' ({frac:>6.2%})'\n\n    def _silent_update(self, value=None):\n        pass\n\n    @classmethod\n    def map(cls, function, items, multiprocess=False, file=None, step=100,\n            ipython_widget=False, multiprocessing_start_method=None):\n        \"\"\"Map function over items while displaying a progress bar with percentage complete.\n\n        The map operation may run in arbitrary order on the items, but the results are\n        returned in sequential order.\n\n        ::\n\n            def work(i):\n                print(i)\n\n            ProgressBar.map(work, range(50))\n\n        Parameters\n        ----------\n        function : function\n            Function to call for each step\n\n        items : sequence\n            Sequence where each element is a tuple of arguments to pass to\n            *function*.\n\n        multiprocess : bool, int, optional\n            If `True`, use the `multiprocessing` module to distribute each task\n            to a different processor core. If a number greater than 1, then use\n            that number of cores.\n\n        ipython_widget : bool, optional\n            If `True`, the progress bar will display as an IPython\n            notebook widget.\n\n        file : writable file-like, optional\n            The file to write the progress bar to.  Defaults to\n            `sys.stdout`.  If ``file`` is not a tty (as determined by\n            calling its `isatty` member, if any), the scrollbar will\n            be completely silent.\n\n        step : int, optional\n            Update the progress bar at least every *step* steps (default: 100).\n            If ``multiprocess`` is `True`, this will affect the size\n            of the chunks of ``items`` that are submitted as separate tasks\n            to the process pool.  A large step size may make the job\n            complete faster if ``items`` is very long.\n\n        multiprocessing_start_method : str, optional\n            Useful primarily for testing; if in doubt leave it as the default.\n            When using multiprocessing, certain anomalies occur when starting\n            processes with the \"spawn\" method (the only option on Windows);\n            other anomalies occur with the \"fork\" method (the default on\n            Linux).\n        \"\"\"\n\n        if multiprocess:\n            function = _mapfunc(function)\n            items = list(enumerate(items))\n\n        results = cls.map_unordered(\n            function, items, multiprocess=multiprocess,\n            file=file, step=step,\n            ipython_widget=ipython_widget,\n            multiprocessing_start_method=multiprocessing_start_method)\n\n        if multiprocess:\n            _, results = zip(*sorted(results))\n            results = list(results)\n\n        return results\n\n    @classmethod\n    def map_unordered(cls, function, items, multiprocess=False, file=None,\n                      step=100, ipython_widget=False,\n                      multiprocessing_start_method=None):\n        \"\"\"Map function over items, reporting the progress.\n\n        Does a `map` operation while displaying a progress bar with\n        percentage complete. The map operation may run on arbitrary order\n        on the items, and the results may be returned in arbitrary order.\n\n        ::\n\n            def work(i):\n                print(i)\n\n            ProgressBar.map(work, range(50))\n\n        Parameters\n        ----------\n        function : function\n            Function to call for each step\n\n        items : sequence\n            Sequence where each element is a tuple of arguments to pass to\n            *function*.\n\n        multiprocess : bool, int, optional\n            If `True`, use the `multiprocessing` module to distribute each task\n            to a different processor core. If a number greater than 1, then use\n            that number of cores.\n\n        ipython_widget : bool, optional\n            If `True`, the progress bar will display as an IPython\n            notebook widget.\n\n        file : writable file-like, optional\n            The file to write the progress bar to.  Defaults to\n            `sys.stdout`.  If ``file`` is not a tty (as determined by\n            calling its `isatty` member, if any), the scrollbar will\n            be completely silent.\n\n        step : int, optional\n            Update the progress bar at least every *step* steps (default: 100).\n            If ``multiprocess`` is `True`, this will affect the size\n            of the chunks of ``items`` that are submitted as separate tasks\n            to the process pool.  A large step size may make the job\n            complete faster if ``items`` is very long.\n\n        multiprocessing_start_method : str, optional\n            Useful primarily for testing; if in doubt leave it as the default.\n            When using multiprocessing, certain anomalies occur when starting\n            processes with the \"spawn\" method (the only option on Windows);\n            other anomalies occur with the \"fork\" method (the default on\n            Linux).\n        \"\"\"\n\n        results = []\n\n        if file is None:\n            file = _get_stdout()\n\n        with cls(len(items), ipython_widget=ipython_widget, file=file) as bar:\n            if bar._ipython_widget:\n                chunksize = step\n            else:\n                default_step = max(int(float(len(items)) / bar._bar_length), 1)\n                chunksize = min(default_step, step)\n            if not multiprocess or multiprocess < 1:\n                for i, item in enumerate(items):\n                    results.append(function(item))\n                    if (i % chunksize) == 0:\n                        bar.update(i)\n            else:\n                ctx = multiprocessing.get_context(multiprocessing_start_method)\n                kwargs = dict(mp_context=ctx)\n\n                with ProcessPoolExecutor(\n                        max_workers=(int(multiprocess)\n                                     if multiprocess is not True\n                                     else None),\n                        **kwargs) as p:\n                    for i, f in enumerate(\n                            as_completed(\n                                p.submit(function, item)\n                                for item in items)):\n                        bar.update(i)\n                        results.append(f.result())\n\n        return results\n\n\nclass Spinner:\n    \"\"\"\n    A class to display a spinner in the terminal.\n\n    It is designed to be used with the ``with`` statement::\n\n        with Spinner(\"Reticulating splines\", \"green\") as s:\n            for item in enumerate(items):\n                s.update()\n    \"\"\"\n    _default_unicode_chars = \"◓◑◒◐\"\n    _default_ascii_chars = \"-/|\\\\\"\n\n    def __init__(self, msg, color='default', file=None, step=1,\n                 chars=None):\n        \"\"\"\n        Parameters\n        ----------\n        msg : str\n            The message to print\n\n        color : str, optional\n            An ANSI terminal color name.  Must be one of: black, red,\n            green, brown, blue, magenta, cyan, lightgrey, default,\n            darkgrey, lightred, lightgreen, yellow, lightblue,\n            lightmagenta, lightcyan, white.\n\n        file : writable file-like, optional\n            The file to write the spinner to.  Defaults to\n            `sys.stdout`.  If ``file`` is not a tty (as determined by\n            calling its `isatty` member, if any, or special case hacks\n            to detect the IPython console), the spinner will be\n            completely silent.\n\n        step : int, optional\n            Only update the spinner every *step* steps\n\n        chars : str, optional\n            The character sequence to use for the spinner\n        \"\"\"\n\n        if file is None:\n            file = _get_stdout()\n\n        self._msg = msg\n        self._color = color\n        self._file = file\n        self._step = step\n        if chars is None:\n            if conf.unicode_output:\n                chars = self._default_unicode_chars\n            else:\n                chars = self._default_ascii_chars\n        self._chars = chars\n\n        self._silent = not isatty(file)\n\n        if self._silent:\n            self._iter = self._silent_iterator()\n        else:\n            self._iter = self._iterator()\n\n    def _iterator(self):\n        chars = self._chars\n        index = 0\n        file = self._file\n        write = file.write\n        flush = file.flush\n        try_fallback = True\n\n        while True:\n            write('\\r')\n            color_print(self._msg, self._color, file=file, end='')\n            write(' ')\n            try:\n                if try_fallback:\n                    write = _write_with_fallback(chars[index], write, file)\n                else:\n                    write(chars[index])\n            except UnicodeError:\n                # If even _write_with_fallback failed for any reason just give\n                # up on trying to use the unicode characters\n                chars = self._default_ascii_chars\n                write(chars[index])\n                try_fallback = False  # No good will come of using this again\n            flush()\n            yield\n\n            for i in range(self._step):\n                yield\n\n            index = (index + 1) % len(chars)\n\n    def __enter__(self):\n        return self\n\n    def __exit__(self, exc_type, exc_value, traceback):\n        file = self._file\n        write = file.write\n        flush = file.flush\n\n        if not self._silent:\n            write('\\r')\n            color_print(self._msg, self._color, file=file, end='')\n        if exc_type is None:\n            color_print(' [Done]', 'green', file=file)\n        else:\n            color_print(' [Failed]', 'red', file=file)\n        flush()\n\n    def __iter__(self):\n        return self\n\n    def __next__(self):\n        next(self._iter)\n\n    def update(self, value=None):\n        \"\"\"Update the spin wheel in the terminal.\n\n        Parameters\n        ----------\n        value : int, optional\n            Ignored (present just for compatibility with `ProgressBar.update`).\n\n        \"\"\"\n\n        next(self)\n\n    def _silent_iterator(self):\n        color_print(self._msg, self._color, file=self._file, end='')\n        self._file.flush()\n\n        while True:\n            yield\n\n\nclass ProgressBarOrSpinner:\n    \"\"\"\n    A class that displays either a `ProgressBar` or `Spinner`\n    depending on whether the total size of the operation is\n    known or not.\n\n    It is designed to be used with the ``with`` statement::\n\n        if file.has_length():\n            length = file.get_length()\n        else:\n            length = None\n        bytes_read = 0\n        with ProgressBarOrSpinner(length) as bar:\n            while file.read(blocksize):\n                bytes_read += blocksize\n                bar.update(bytes_read)\n    \"\"\"\n\n    def __init__(self, total, msg, color='default', file=None):\n        \"\"\"\n        Parameters\n        ----------\n        total : int or None\n            If an int, the number of increments in the process being\n            tracked and a `ProgressBar` is displayed.  If `None`, a\n            `Spinner` is displayed.\n\n        msg : str\n            The message to display above the `ProgressBar` or\n            alongside the `Spinner`.\n\n        color : str, optional\n            The color of ``msg``, if any.  Must be an ANSI terminal\n            color name.  Must be one of: black, red, green, brown,\n            blue, magenta, cyan, lightgrey, default, darkgrey,\n            lightred, lightgreen, yellow, lightblue, lightmagenta,\n            lightcyan, white.\n\n        file : writable file-like, optional\n            The file to write the to.  Defaults to `sys.stdout`.  If\n            ``file`` is not a tty (as determined by calling its `isatty`\n            member, if any), only ``msg`` will be displayed: the\n            `ProgressBar` or `Spinner` will be silent.\n        \"\"\"\n\n        if file is None:\n            file = _get_stdout()\n\n        if total is None or not isatty(file):\n            self._is_spinner = True\n            self._obj = Spinner(msg, color=color, file=file)\n        else:\n            self._is_spinner = False\n            color_print(msg, color, file=file)\n            self._obj = ProgressBar(total, file=file)\n\n    def __enter__(self):\n        return self\n\n    def __exit__(self, exc_type, exc_value, traceback):\n        return self._obj.__exit__(exc_type, exc_value, traceback)\n\n    def update(self, value):\n        \"\"\"\n        Update the progress bar to the given value (out of the total\n        given to the constructor.\n        \"\"\"\n        self._obj.update(value)\n\n\ndef print_code_line(line, col=None, file=None, tabwidth=8, width=70):\n    \"\"\"\n    Prints a line of source code, highlighting a particular character\n    position in the line.  Useful for displaying the context of error\n    messages.\n\n    If the line is more than ``width`` characters, the line is truncated\n    accordingly and '…' characters are inserted at the front and/or\n    end.\n\n    It looks like this::\n\n        there_is_a_syntax_error_here :\n                                     ^\n\n    Parameters\n    ----------\n    line : unicode\n        The line of code to display\n\n    col : int, optional\n        The character in the line to highlight.  ``col`` must be less\n        than ``len(line)``.\n\n    file : writable file-like, optional\n        Where to write to.  Defaults to `sys.stdout`.\n\n    tabwidth : int, optional\n        The number of spaces per tab (``'\\\\t'``) character.  Default\n        is 8.  All tabs will be converted to spaces to ensure that the\n        caret lines up with the correct column.\n\n    width : int, optional\n        The width of the display, beyond which the line will be\n        truncated.  Defaults to 70 (this matches the default in the\n        standard library's `textwrap` module).\n    \"\"\"\n\n    if file is None:\n        file = _get_stdout()\n\n    if conf.unicode_output:\n        ellipsis = '…'\n    else:\n        ellipsis = '...'\n\n    write = file.write\n\n    if col is not None:\n        if col >= len(line):\n            raise ValueError('col must be less the the line length.')\n        ntabs = line[:col].count('\\t')\n        col += ntabs * (tabwidth - 1)\n\n    line = line.rstrip('\\n')\n    line = line.replace('\\t', ' ' * tabwidth)\n\n    if col is not None and col > width:\n        new_col = min(width // 2, len(line) - col)\n        offset = col - new_col\n        line = line[offset + len(ellipsis):]\n        width -= len(ellipsis)\n        new_col = col\n        col -= offset\n        color_print(ellipsis, 'darkgrey', file=file, end='')\n\n    if len(line) > width:\n        write(line[:width - len(ellipsis)])\n        color_print(ellipsis, 'darkgrey', file=file)\n    else:\n        write(line)\n        write('\\n')\n\n    if col is not None:\n        write(' ' * col)\n        color_print('^', 'red', file=file)\n\n\n# The following four Getch* classes implement unbuffered character reading from\n# stdin on Windows, linux, MacOSX.  This is taken directly from ActiveState\n# Code Recipes:\n# http://code.activestate.com/recipes/134892-getch-like-unbuffered-character-reading-from-stdin/\n#\n\nclass Getch:\n    \"\"\"Get a single character from standard input without screen echo.\n\n    Returns\n    -------\n    char : str (one character)\n    \"\"\"\n\n    def __init__(self):\n        try:\n            self.impl = _GetchWindows()\n        except ImportError:\n            try:\n                self.impl = _GetchMacCarbon()\n            except (ImportError, AttributeError):\n                self.impl = _GetchUnix()\n\n    def __call__(self):\n        return self.impl()\n\n\nclass _GetchUnix:\n    def __init__(self):\n        import tty  # pylint: disable=W0611\n        import sys  # pylint: disable=W0611\n\n        # import termios now or else you'll get the Unix\n        # version on the Mac\n        import termios  # pylint: disable=W0611\n\n    def __call__(self):\n        import sys\n        import tty\n        import termios\n        fd = sys.stdin.fileno()\n        old_settings = termios.tcgetattr(fd)\n        try:\n            tty.setraw(sys.stdin.fileno())\n            ch = sys.stdin.read(1)\n        finally:\n            termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)\n        return ch\n\n\nclass _GetchWindows:\n    def __init__(self):\n        import msvcrt  # pylint: disable=W0611\n\n    def __call__(self):\n        import msvcrt\n        return msvcrt.getch()\n\n\nclass _GetchMacCarbon:\n    \"\"\"\n    A function which returns the current ASCII key that is down;\n    if no ASCII key is down, the null string is returned.  The\n    page http://www.mactech.com/macintosh-c/chap02-1.html was\n    very helpful in figuring out how to do this.\n    \"\"\"\n\n    def __init__(self):\n        import Carbon\n        Carbon.Evt  # see if it has this (in Unix, it doesn't)\n\n    def __call__(self):\n        import Carbon\n        if Carbon.Evt.EventAvail(0x0008)[0] == 0:  # 0x0008 is the keyDownMask\n            return ''\n        else:\n            #\n            # The event contains the following info:\n            # (what,msg,when,where,mod)=Carbon.Evt.GetNextEvent(0x0008)[1]\n            #\n            # The message (msg) contains the ASCII char which is\n            # extracted with the 0x000000FF charCodeMask; this\n            # number is converted to an ASCII character with chr() and\n            # returned\n            #\n            (what, msg, when, where, mod) = Carbon.Evt.GetNextEvent(0x0008)[1]\n            return chr(msg & 0x000000FF)\n"},{"className":"_IPython","col":0,"comment":"Singleton class given access to IPython streams, etc.","endLoc":93,"id":10551,"nodeType":"Class","startLoc":41,"text":"class _IPython:\n    \"\"\"Singleton class given access to IPython streams, etc.\"\"\"\n\n    @classproperty\n    def get_ipython(cls):\n        try:\n            from IPython import get_ipython\n        except ImportError:\n            pass\n        return get_ipython\n\n    @classproperty\n    def OutStream(cls):\n        if not hasattr(cls, '_OutStream'):\n            cls._OutStream = None\n            try:\n                cls.get_ipython()\n            except NameError:\n                return None\n\n            try:\n                from ipykernel.iostream import OutStream\n            except ImportError:\n                try:\n                    from IPython.zmq.iostream import OutStream\n                except ImportError:\n                    from IPython import version_info\n                    if version_info[0] >= 4:\n                        return None\n\n                    try:\n                        from IPython.kernel.zmq.iostream import OutStream\n                    except ImportError:\n                        return None\n\n            cls._OutStream = OutStream\n\n        return cls._OutStream\n\n    @classproperty\n    def ipyio(cls):\n        if not hasattr(cls, '_ipyio'):\n            try:\n                from IPython.utils import io\n            except ImportError:\n                cls._ipyio = None\n            else:\n                cls._ipyio = io\n        return cls._ipyio\n\n    @classmethod\n    def get_stream(cls, stream):\n        return getattr(cls.ipyio, stream)"},{"col":4,"comment":"null","endLoc":50,"header":"@classproperty\n    def get_ipython(cls)","id":10552,"name":"get_ipython","nodeType":"Function","startLoc":44,"text":"@classproperty\n    def get_ipython(cls):\n        try:\n            from IPython import get_ipython\n        except ImportError:\n            pass\n        return get_ipython"},{"col":4,"comment":"null","endLoc":78,"header":"@classproperty\n    def OutStream(cls)","id":10553,"name":"OutStream","nodeType":"Function","startLoc":52,"text":"@classproperty\n    def OutStream(cls):\n        if not hasattr(cls, '_OutStream'):\n            cls._OutStream = None\n            try:\n                cls.get_ipython()\n            except NameError:\n                return None\n\n            try:\n                from ipykernel.iostream import OutStream\n            except ImportError:\n                try:\n                    from IPython.zmq.iostream import OutStream\n                except ImportError:\n                    from IPython import version_info\n                    if version_info[0] >= 4:\n                        return None\n\n                    try:\n                        from IPython.kernel.zmq.iostream import OutStream\n                    except ImportError:\n                        return None\n\n            cls._OutStream = OutStream\n\n        return cls._OutStream"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":94,"id":10554,"name":"default_http_user_agent","nodeType":"Attribute","startLoc":94,"text":"default_http_user_agent"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":99,"id":10555,"name":"remote_timeout","nodeType":"Attribute","startLoc":99,"text":"remote_timeout"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":103,"id":10556,"name":"allow_internet","nodeType":"Attribute","startLoc":103,"text":"allow_internet"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":106,"id":10557,"name":"compute_hash_block_size","nodeType":"Attribute","startLoc":106,"text":"compute_hash_block_size"},{"col":4,"comment":"null","endLoc":670,"header":"def max(self, axis=None, out=None, keepdims=False)","id":10558,"name":"max","nodeType":"Function","startLoc":669,"text":"def max(self, axis=None, out=None, keepdims=False):\n        return self._wrap_function(np.max, axis, out=out, keepdims=keepdims)"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":109,"id":10559,"name":"download_block_size","nodeType":"Attribute","startLoc":109,"text":"download_block_size"},{"col":4,"comment":"null","endLoc":89,"header":"@classproperty\n    def ipyio(cls)","id":10560,"name":"ipyio","nodeType":"Function","startLoc":80,"text":"@classproperty\n    def ipyio(cls):\n        if not hasattr(cls, '_ipyio'):\n            try:\n                from IPython.utils import io\n            except ImportError:\n                cls._ipyio = None\n            else:\n                cls._ipyio = io\n        return cls._ipyio"},{"col":4,"comment":"null","endLoc":93,"header":"@classmethod\n    def get_stream(cls, stream)","id":10561,"name":"get_stream","nodeType":"Function","startLoc":91,"text":"@classmethod\n    def get_stream(cls, stream):\n        return getattr(cls.ipyio, stream)"},{"attributeType":"None","col":16,"comment":"null","endLoc":86,"id":10562,"name":"_ipyio","nodeType":"Attribute","startLoc":86,"text":"cls._ipyio"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":112,"id":10563,"name":"delete_temporary_downloads_at_exit","nodeType":"Attribute","startLoc":112,"text":"delete_temporary_downloads_at_exit"},{"attributeType":"None","col":12,"comment":"null","endLoc":55,"id":10564,"name":"_OutStream","nodeType":"Attribute","startLoc":55,"text":"cls._OutStream"},{"className":"_mapfunc","col":0,"comment":"\n    A function wrapper to support ProgressBar.map().\n    ","endLoc":470,"id":10565,"nodeType":"Class","startLoc":460,"text":"class _mapfunc(object):\n    \"\"\"\n    A function wrapper to support ProgressBar.map().\n    \"\"\"\n\n    def __init__(self, func):\n        self._func = func\n\n    def __call__(self, i_arg):\n        i, arg = i_arg\n        return i, self._func(arg)"},{"col":4,"comment":"null","endLoc":470,"header":"def __call__(self, i_arg)","id":10566,"name":"__call__","nodeType":"Function","startLoc":468,"text":"def __call__(self, i_arg):\n        i, arg = i_arg\n        return i, self._func(arg)"},{"className":"CacheMissingWarning","col":0,"comment":"\n    This warning indicates the standard cache directory is not accessible, with\n    the first argument providing the warning message. If args[1] is present, it\n    is a filename indicating the path to a temporary file that was created to\n    store a remote data download in the absence of the cache.\n    ","endLoc":127,"id":10567,"nodeType":"Class","startLoc":121,"text":"class CacheMissingWarning(AstropyWarning):\n    \"\"\"\n    This warning indicates the standard cache directory is not accessible, with\n    the first argument providing the warning message. If args[1] is present, it\n    is a filename indicating the path to a temporary file that was created to\n    store a remote data download in the absence of the cache.\n    \"\"\""},{"className":"_ftptlswrapper","col":0,"comment":"null","endLoc":1036,"id":10568,"nodeType":"Class","startLoc":1028,"text":"class _ftptlswrapper(urllib.request.ftpwrapper):\n    def init(self):\n        self.busy = 0\n        self.ftp = ftplib.FTP_TLS()\n        self.ftp.connect(self.host, self.port, self.timeout)\n        self.ftp.login(self.user, self.passwd)\n        self.ftp.prot_p()\n        _target = '/'.join(self.dirs)\n        self.ftp.cwd(_target)"},{"col":4,"comment":"null","endLoc":673,"header":"def min(self, axis=None, out=None, keepdims=False)","id":10569,"name":"min","nodeType":"Function","startLoc":672,"text":"def min(self, axis=None, out=None, keepdims=False):\n        return self._wrap_function(np.min, axis, out=out, keepdims=keepdims)"},{"col":4,"comment":"null","endLoc":677,"header":"def sum(self, axis=None, dtype=None, out=None, keepdims=False)","id":10570,"name":"sum","nodeType":"Function","startLoc":675,"text":"def sum(self, axis=None, dtype=None, out=None, keepdims=False):\n        return self._wrap_function(np.sum, axis, dtype, out=out,\n                                   keepdims=keepdims)"},{"col":4,"comment":"null","endLoc":1036,"header":"def init(self)","id":10571,"name":"init","nodeType":"Function","startLoc":1029,"text":"def init(self):\n        self.busy = 0\n        self.ftp = ftplib.FTP_TLS()\n        self.ftp.connect(self.host, self.port, self.timeout)\n        self.ftp.login(self.user, self.passwd)\n        self.ftp.prot_p()\n        _target = '/'.join(self.dirs)\n        self.ftp.cwd(_target)"},{"col":4,"comment":"null","endLoc":680,"header":"def cumsum(self, axis=None, dtype=None, out=None)","id":10572,"name":"cumsum","nodeType":"Function","startLoc":679,"text":"def cumsum(self, axis=None, dtype=None, out=None):\n        return self._wrap_function(np.cumsum, axis, dtype, out=out)"},{"col":4,"comment":"null","endLoc":684,"header":"def clip(self, a_min, a_max, out=None)","id":10573,"name":"clip","nodeType":"Function","startLoc":682,"text":"def clip(self, a_min, a_max, out=None):\n        return self._wrap_function(np.clip, self._to_own_unit(a_min),\n                                   self._to_own_unit(a_max), out=out)"},{"attributeType":"None","col":4,"comment":"Default `~astropy.units.function.FunctionUnitBase` subclass.\n\n    This should be overridden by subclasses.\n    ","endLoc":472,"id":10574,"name":"_unit_class","nodeType":"Attribute","startLoc":472,"text":"_unit_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":479,"id":10575,"name":"__array_priority__","nodeType":"Attribute","startLoc":479,"text":"__array_priority__"},{"attributeType":"null","col":4,"comment":"null","endLoc":482,"id":10576,"name":"_supported_ufuncs","nodeType":"Attribute","startLoc":482,"text":"_supported_ufuncs"},{"attributeType":"null","col":8,"comment":"null","endLoc":1031,"id":10577,"name":"ftp","nodeType":"Attribute","startLoc":1031,"text":"self.ftp"},{"attributeType":"null","col":8,"comment":"null","endLoc":1030,"id":10578,"name":"busy","nodeType":"Attribute","startLoc":1030,"text":"self.busy"},{"className":"_FTPTLSHandler","col":0,"comment":"null","endLoc":1042,"id":10579,"nodeType":"Class","startLoc":1039,"text":"class _FTPTLSHandler(urllib.request.FTPHandler):\n    def connect_ftp(self, user, passwd, host, port, dirs, timeout):\n        return _ftptlswrapper(user, passwd, host, port, dirs, timeout,\n                              persistent=False)"},{"col":4,"comment":"null","endLoc":1042,"header":"def connect_ftp(self, user, passwd, host, port, dirs, timeout)","id":10580,"name":"connect_ftp","nodeType":"Function","startLoc":1040,"text":"def connect_ftp(self, user, passwd, host, port, dirs, timeout):\n        return _ftptlswrapper(user, passwd, host, port, dirs, timeout,\n                              persistent=False)"},{"className":"ReadOnlyDict","col":0,"comment":"null","endLoc":1737,"id":10581,"nodeType":"Class","startLoc":1735,"text":"class ReadOnlyDict(dict):\n    def __setitem__(self, key, value):\n        raise TypeError(\"This object is read-only.\")"},{"col":4,"comment":"null","endLoc":1737,"header":"def __setitem__(self, key, value)","id":10582,"name":"__setitem__","nodeType":"Function","startLoc":1736,"text":"def __setitem__(self, key, value):\n        raise TypeError(\"This object is read-only.\")"},{"className":"CacheDamaged","col":0,"comment":"Record the URL or file that was a problem.\n    Using clear_download_cache on the .bad_file or .bad_url attribute,\n    whichever is not None, should resolve this particular problem.\n    ","endLoc":1751,"id":10583,"nodeType":"Class","startLoc":1743,"text":"class CacheDamaged(ValueError):\n    \"\"\"Record the URL or file that was a problem.\n    Using clear_download_cache on the .bad_file or .bad_url attribute,\n    whichever is not None, should resolve this particular problem.\n    \"\"\"\n    def __init__(self, *args, bad_urls=None, bad_files=None, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.bad_urls = bad_urls if bad_urls is not None else []\n        self.bad_files = bad_files if bad_files is not None else []"},{"col":4,"comment":"null","endLoc":366,"header":"def var(self, axis=None, dtype=None, out=None, ddof=0)","id":10584,"name":"var","nodeType":"Function","startLoc":364,"text":"def var(self, axis=None, dtype=None, out=None, ddof=0):\n        return self._wrap_function(np.var, axis, dtype, out=out, ddof=ddof,\n                                   unit=self.unit.function_unit**2)"},{"col":0,"comment":"null","endLoc":136,"header":"def helper_pv_multiplication(f, unit1, unit2)","id":10585,"name":"helper_pv_multiplication","nodeType":"Function","startLoc":130,"text":"def helper_pv_multiplication(f, unit1, unit2):\n    check_structured_unit(unit1, dt_pv)\n    check_structured_unit(unit2, dt_pv)\n    result_unit = StructuredUnit((unit1[0] * unit2[0], unit1[1] * unit2[0]))\n    converter = get_converter(unit2, StructuredUnit(\n        (unit2[0], unit1[1] * unit2[0] / unit1[0])))\n    return [None, converter], result_unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":483,"id":10586,"name":"_supported_functions","nodeType":"Attribute","startLoc":483,"text":"_supported_functions"},{"attributeType":"null","col":12,"comment":"null","endLoc":503,"id":10587,"name":"unit","nodeType":"Attribute","startLoc":503,"text":"unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":560,"id":10588,"name":"_unit","nodeType":"Attribute","startLoc":560,"text":"self._unit"},{"col":4,"comment":"null","endLoc":370,"header":"def std(self, axis=None, dtype=None, out=None, ddof=0)","id":10589,"name":"std","nodeType":"Function","startLoc":368,"text":"def std(self, axis=None, dtype=None, out=None, ddof=0):\n        return self._wrap_function(np.std, axis, dtype, out=out, ddof=ddof,\n                                   unit=self.unit._copy(dimensionless_unscaled))"},{"col":4,"comment":"null","endLoc":374,"header":"def ptp(self, axis=None, out=None)","id":10590,"name":"ptp","nodeType":"Function","startLoc":372,"text":"def ptp(self, axis=None, out=None):\n        return self._wrap_function(np.ptp, axis, out=out,\n                                   unit=self.unit._copy(dimensionless_unscaled))"},{"col":4,"comment":"null","endLoc":378,"header":"def diff(self, n=1, axis=-1)","id":10591,"name":"diff","nodeType":"Function","startLoc":376,"text":"def diff(self, n=1, axis=-1):\n        return self._wrap_function(np.diff, n, axis,\n                                   unit=self.unit._copy(dimensionless_unscaled))"},{"col":0,"comment":"null","endLoc":141,"header":"def helper_pvm(f, unit1)","id":10592,"name":"helper_pvm","nodeType":"Function","startLoc":139,"text":"def helper_pvm(f, unit1):\n    check_structured_unit(unit1, dt_pv)\n    return [None], (unit1[0], unit1[1])"},{"col":0,"comment":"null","endLoc":149,"header":"def helper_pvstar(f, unit1)","id":10593,"name":"helper_pvstar","nodeType":"Function","startLoc":144,"text":"def helper_pvstar(f, unit1):\n    from astropy.units.astrophys import AU\n    from astropy.units.si import km, s, radian, day, year, arcsec\n\n    return [get_converter(unit1, StructuredUnit((AU, AU/day)))], (\n        radian, radian, radian / year, radian / year, arcsec, km / s, None)"},{"col":4,"comment":"null","endLoc":382,"header":"def ediff1d(self, to_end=None, to_begin=None)","id":10594,"name":"ediff1d","nodeType":"Function","startLoc":380,"text":"def ediff1d(self, to_end=None, to_begin=None):\n        return self._wrap_function(np.ediff1d, to_end, to_begin,\n                                   unit=self.unit._copy(dimensionless_unscaled))"},{"col":4,"comment":"null","endLoc":1751,"header":"def __init__(self, *args, bad_urls=None, bad_files=None, **kwargs)","id":10595,"name":"__init__","nodeType":"Function","startLoc":1748,"text":"def __init__(self, *args, bad_urls=None, bad_files=None, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.bad_urls = bad_urls if bad_urls is not None else []\n        self.bad_files = bad_files if bad_files is not None else []"},{"col":0,"comment":"null","endLoc":162,"header":"def helper_starpv(f, unit_ra, unit_dec, unit_pmr, unit_pmd,\n                  unit_px, unit_rv)","id":10596,"name":"helper_starpv","nodeType":"Function","startLoc":152,"text":"def helper_starpv(f, unit_ra, unit_dec, unit_pmr, unit_pmd,\n                  unit_px, unit_rv):\n    from astropy.units.si import km, s, day, year, radian, arcsec\n    from astropy.units.astrophys import AU\n\n    return [get_converter(unit_ra, radian),\n            get_converter(unit_dec, radian),\n            get_converter(unit_pmr, radian/year),\n            get_converter(unit_pmd, radian/year),\n            get_converter(unit_px, arcsec),\n            get_converter(unit_rv, km/s)], (StructuredUnit((AU, AU/day)), None)"},{"attributeType":"LogUnit","col":4,"comment":"null","endLoc":233,"id":10597,"name":"_unit_class","nodeType":"Attribute","startLoc":233,"text":"_unit_class"},{"attributeType":"null","col":20,"comment":"null","endLoc":499,"id":10598,"name":"value_unit","nodeType":"Attribute","startLoc":499,"text":"value_unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":1751,"id":10599,"name":"bad_files","nodeType":"Attribute","startLoc":1751,"text":"self.bad_files"},{"attributeType":"null","col":4,"comment":"null","endLoc":384,"id":10600,"name":"_supported_functions","nodeType":"Attribute","startLoc":384,"text":"_supported_functions"},{"attributeType":"null","col":12,"comment":"null","endLoc":502,"id":10601,"name":"physical_unit","nodeType":"Attribute","startLoc":502,"text":"physical_unit"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":10602,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":10603,"name":"SUPPORTED_UFUNCS","nodeType":"Attribute","startLoc":14,"text":"SUPPORTED_UFUNCS"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":10604,"name":"SUPPORTED_FUNCTIONS","nodeType":"Attribute","startLoc":24,"text":"SUPPORTED_FUNCTIONS"},{"col":0,"comment":"","endLoc":3,"header":"core.py#<anonymous>","id":10605,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"Function Units and Quantities.\"\"\"\n\n__all__ = ['FunctionUnitBase', 'FunctionQuantity']\n\nSUPPORTED_UFUNCS = set(getattr(np.core.umath, ufunc) for ufunc in (\n    'isfinite', 'isinf', 'isnan', 'sign', 'signbit',\n    'rint', 'floor', 'ceil', 'trunc',\n    '_ones_like', 'ones_like', 'positive') if hasattr(np.core.umath, ufunc))\n\nSUPPORTED_FUNCTIONS = set(getattr(np, function) for function in\n                          ('clip', 'trace', 'mean', 'min', 'max', 'round'))"},{"className":"Dex","col":0,"comment":"null","endLoc":390,"id":10606,"nodeType":"Class","startLoc":389,"text":"class Dex(LogQuantity):\n    _unit_class = DexUnit"},{"attributeType":"DexUnit","col":4,"comment":"null","endLoc":390,"id":10607,"name":"_unit_class","nodeType":"Attribute","startLoc":390,"text":"_unit_class"},{"className":"Decibel","col":0,"comment":"null","endLoc":394,"id":10608,"nodeType":"Class","startLoc":393,"text":"class Decibel(LogQuantity):\n    _unit_class = DecibelUnit"},{"attributeType":"DecibelUnit","col":4,"comment":"null","endLoc":394,"id":10609,"name":"_unit_class","nodeType":"Attribute","startLoc":394,"text":"_unit_class"},{"className":"Magnitude","col":0,"comment":"null","endLoc":398,"id":10610,"nodeType":"Class","startLoc":397,"text":"class Magnitude(LogQuantity):\n    _unit_class = MagUnit"},{"attributeType":"MagUnit","col":4,"comment":"null","endLoc":398,"id":10611,"name":"_unit_class","nodeType":"Attribute","startLoc":398,"text":"_unit_class"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":10612,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"attributeType":"MagUnit","col":0,"comment":"null","endLoc":406,"id":10613,"name":"STmag","nodeType":"Attribute","startLoc":406,"text":"STmag"},{"fileName":"collections.py","filePath":"astropy/utils","id":10614,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nA module containing specialized collection classes.\n\"\"\"\n\n\nclass HomogeneousList(list):\n    \"\"\"\n    A subclass of list that contains only elements of a given type or\n    types.  If an item that is not of the specified type is added to\n    the list, a `TypeError` is raised.\n    \"\"\"\n    def __init__(self, types, values=[]):\n        \"\"\"\n        Parameters\n        ----------\n        types : sequence of types\n            The types to accept.\n\n        values : sequence, optional\n            An initial set of values.\n        \"\"\"\n        self._types = types\n        super().__init__()\n        self.extend(values)\n\n    def _assert(self, x):\n        if not isinstance(x, self._types):\n            raise TypeError(\n                f\"homogeneous list must contain only objects of type '{self._types}'\")\n\n    def __iadd__(self, other):\n        self.extend(other)\n        return self\n\n    def __setitem__(self, idx, value):\n        if isinstance(idx, slice):\n            value = list(value)\n            for item in value:\n                self._assert(item)\n        else:\n            self._assert(value)\n        return super().__setitem__(idx, value)\n\n    def append(self, x):\n        self._assert(x)\n        return super().append(x)\n\n    def insert(self, i, x):\n        self._assert(x)\n        return super().insert(i, x)\n\n    def extend(self, x):\n        for item in x:\n            self._assert(item)\n            super().append(item)\n"},{"col":0,"comment":"","endLoc":4,"header":"collections.py#<anonymous>","id":10615,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nA module containing specialized collection classes.\n\"\"\""},{"fileName":"parsing.py","filePath":"astropy/utils","id":10616,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nWrappers for PLY to provide thread safety.\n\"\"\"\n\nimport contextlib\nimport functools\nimport re\nimport os\nimport threading\n\n\n__all__ = ['lex', 'ThreadSafeParser', 'yacc']\n\n\n_TAB_HEADER = \"\"\"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# This file was automatically generated from ply. To re-generate this file,\n# remove it from this folder, then build astropy and run the tests in-place:\n#\n#   python setup.py build_ext --inplace\n#   pytest {package}\n#\n# You can then commit the changes to this file.\n\n\"\"\"\n_LOCK = threading.RLock()\n\n\ndef _add_tab_header(filename, package):\n    with open(filename, 'r') as f:\n        contents = f.read()\n\n    with open(filename, 'w') as f:\n        f.write(_TAB_HEADER.format(package=package))\n        f.write(contents)\n\n\n@contextlib.contextmanager\ndef _patch_get_caller_module_dict(module):\n    \"\"\"Temporarily replace the module's get_caller_module_dict.\n\n    This is a function inside ``ply.lex`` and ``ply.yacc`` (each has a copy)\n    that is used to retrieve the caller's local symbols. Here, we patch the\n    function to instead retrieve the grandparent's local symbols to account\n    for a wrapper layer.\n    \"\"\"\n    original = module.get_caller_module_dict\n\n    @functools.wraps(original)\n    def wrapper(levels):\n        # Add 2, not 1, because the wrapper itself adds another level\n        return original(levels + 2)\n\n    module.get_caller_module_dict = wrapper\n    yield\n    module.get_caller_module_dict = original\n\n\ndef lex(lextab, package, reflags=int(re.VERBOSE)):\n    \"\"\"Create a lexer from local variables.\n\n    It automatically compiles the lexer in optimized mode, writing to\n    ``lextab`` in the same directory as the calling file.\n\n    This function is thread-safe. The returned lexer is *not* thread-safe, but\n    if it is used exclusively with a single parser returned by :func:`yacc`\n    then it will be safe.\n\n    It is only intended to work with lexers defined within the calling\n    function, rather than at class or module scope.\n\n    Parameters\n    ----------\n    lextab : str\n        Name for the file to write with the generated tables, if it does not\n        already exist (without ``.py`` suffix).\n    package : str\n        Name of a test package which should be run with pytest to regenerate\n        the output file. This is inserted into a comment in the generated\n        file.\n    reflags : int\n        Passed to ``ply.lex``.\n    \"\"\"\n    from astropy.extern.ply import lex\n\n    caller_file = lex.get_caller_module_dict(2)['__file__']\n    lextab_filename = os.path.join(os.path.dirname(caller_file), lextab + '.py')\n    with _LOCK:\n        lextab_exists = os.path.exists(lextab_filename)\n        with _patch_get_caller_module_dict(lex):\n            lexer = lex.lex(optimize=True, lextab=lextab,\n                            outputdir=os.path.dirname(caller_file),\n                            reflags=reflags)\n        if not lextab_exists:\n            _add_tab_header(lextab_filename, package)\n        return lexer\n\n\nclass ThreadSafeParser:\n    \"\"\"Wrap a parser produced by ``ply.yacc.yacc``.\n\n    It provides a :meth:`parse` method that is thread-safe.\n    \"\"\"\n\n    def __init__(self, parser):\n        self.parser = parser\n        self._lock = threading.RLock()\n\n    def parse(self, *args, **kwargs):\n        \"\"\"Run the wrapped parser, with a lock to ensure serialization.\"\"\"\n        with self._lock:\n            return self.parser.parse(*args, **kwargs)\n\n\ndef yacc(tabmodule, package):\n    \"\"\"Create a parser from local variables.\n\n    It automatically compiles the parser in optimized mode, writing to\n    ``tabmodule`` in the same directory as the calling file.\n\n    This function is thread-safe, and the returned parser is also thread-safe,\n    provided that it does not share a lexer with any other parser.\n\n    It is only intended to work with parsers defined within the calling\n    function, rather than at class or module scope.\n\n    Parameters\n    ----------\n    tabmodule : str\n        Name for the file to write with the generated tables, if it does not\n        already exist (without ``.py`` suffix).\n    package : str\n        Name of a test package which should be run with pytest to regenerate\n        the output file. This is inserted into a comment in the generated\n        file.\n    \"\"\"\n    from astropy.extern.ply import yacc\n\n    caller_file = yacc.get_caller_module_dict(2)['__file__']\n    tab_filename = os.path.join(os.path.dirname(caller_file), tabmodule + '.py')\n    with _LOCK:\n        tab_exists = os.path.exists(tab_filename)\n        with _patch_get_caller_module_dict(yacc):\n            parser = yacc.yacc(tabmodule=tabmodule,\n                               outputdir=os.path.dirname(caller_file),\n                               debug=False, optimize=True, write_tables=True)\n        if not tab_exists:\n            _add_tab_header(tab_filename, package)\n\n    return ThreadSafeParser(parser)\n"},{"className":"ThreadSafeParser","col":0,"comment":"Wrap a parser produced by ``ply.yacc.yacc``.\n\n    It provides a :meth:`parse` method that is thread-safe.\n    ","endLoc":115,"id":10617,"nodeType":"Class","startLoc":102,"text":"class ThreadSafeParser:\n    \"\"\"Wrap a parser produced by ``ply.yacc.yacc``.\n\n    It provides a :meth:`parse` method that is thread-safe.\n    \"\"\"\n\n    def __init__(self, parser):\n        self.parser = parser\n        self._lock = threading.RLock()\n\n    def parse(self, *args, **kwargs):\n        \"\"\"Run the wrapped parser, with a lock to ensure serialization.\"\"\"\n        with self._lock:\n            return self.parser.parse(*args, **kwargs)"},{"col":4,"comment":"Run the wrapped parser, with a lock to ensure serialization.","endLoc":115,"header":"def parse(self, *args, **kwargs)","id":10618,"name":"parse","nodeType":"Function","startLoc":112,"text":"def parse(self, *args, **kwargs):\n        \"\"\"Run the wrapped parser, with a lock to ensure serialization.\"\"\"\n        with self._lock:\n            return self.parser.parse(*args, **kwargs)"},{"col":0,"comment":"null","endLoc":175,"header":"def helper_pvtob(f, unit_elong, unit_phi, unit_hm,\n                 unit_xp, unit_yp, unit_sp, unit_theta)","id":10619,"name":"helper_pvtob","nodeType":"Function","startLoc":165,"text":"def helper_pvtob(f, unit_elong, unit_phi, unit_hm,\n                 unit_xp, unit_yp, unit_sp, unit_theta):\n    from astropy.units.si import m, s, radian\n\n    return [get_converter(unit_elong, radian),\n            get_converter(unit_phi, radian),\n            get_converter(unit_hm, m),\n            get_converter(unit_xp, radian),\n            get_converter(unit_yp, radian),\n            get_converter(unit_sp, radian),\n            get_converter(unit_theta, radian)], StructuredUnit((m, m/s))"},{"col":0,"comment":"null","endLoc":242,"header":"@function_helper\ndef argpartition(a, *args, **kwargs)","id":10620,"name":"argpartition","nodeType":"Function","startLoc":240,"text":"@function_helper\ndef argpartition(a, *args, **kwargs):\n    return (a.view(np.ndarray),) + args, kwargs, None, None"},{"attributeType":"null","col":8,"comment":"null","endLoc":109,"id":10621,"name":"parser","nodeType":"Attribute","startLoc":109,"text":"self.parser"},{"attributeType":"null","col":8,"comment":"null","endLoc":110,"id":10622,"name":"_lock","nodeType":"Attribute","startLoc":110,"text":"self._lock"},{"col":0,"comment":"null","endLoc":249,"header":"@function_helper\ndef full_like(a, fill_value, *args, **kwargs)","id":10623,"name":"full_like","nodeType":"Function","startLoc":245,"text":"@function_helper\ndef full_like(a, fill_value, *args, **kwargs):\n    unit = a.unit if kwargs.get('subok', True) else None\n    return (a.view(np.ndarray),\n            a._to_own_unit(fill_value)) + args, kwargs, unit, None"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":10624,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":10625,"name":"_TAB_HEADER","nodeType":"Attribute","startLoc":17,"text":"_TAB_HEADER"},{"attributeType":"null","col":0,"comment":"null","endLoc":29,"id":10626,"name":"_LOCK","nodeType":"Attribute","startLoc":29,"text":"_LOCK"},{"col":0,"comment":"","endLoc":5,"header":"parsing.py#<anonymous>","id":10627,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nWrappers for PLY to provide thread safety.\n\"\"\"\n\n__all__ = ['lex', 'ThreadSafeParser', 'yacc']\n\n_TAB_HEADER = \"\"\"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# This file was automatically generated from ply. To re-generate this file,\n# remove it from this folder, then build astropy and run the tests in-place:\n#\n#   python setup.py build_ext --inplace\n#   pytest {package}\n#\n# You can then commit the changes to this file.\n\n\"\"\"\n\n_LOCK = threading.RLock()"},{"fileName":"diff.py","filePath":"astropy/utils","id":10628,"nodeType":"File","text":"import difflib\nimport functools\nimport sys\nimport numbers\n\nimport numpy as np\n\nfrom .misc import indent\n\n__all__ = ['fixed_width_indent', 'diff_values', 'report_diff_values',\n           'where_not_allclose']\n\n\n# Smaller default shift-width for indent\nfixed_width_indent = functools.partial(indent, width=2)\n\n\ndef diff_values(a, b, rtol=0.0, atol=0.0):\n    \"\"\"\n    Diff two scalar values. If both values are floats, they are compared to\n    within the given absolute and relative tolerance.\n\n    Parameters\n    ----------\n    a, b : int, float, str\n        Scalar values to compare.\n\n    rtol, atol : float\n        Relative and absolute tolerances as accepted by\n        :func:`numpy.allclose`.\n\n    Returns\n    -------\n    is_different : bool\n        `True` if they are different, else `False`.\n\n    \"\"\"\n    if isinstance(a, float) and isinstance(b, float):\n        if np.isnan(a) and np.isnan(b):\n            return False\n        return not np.allclose(a, b, rtol=rtol, atol=atol)\n    else:\n        return a != b\n\n\ndef report_diff_values(a, b, fileobj=sys.stdout, indent_width=0):\n    \"\"\"\n    Write a diff report between two values to the specified file-like object.\n\n    Parameters\n    ----------\n    a, b\n        Values to compare. Anything that can be turned into strings\n        and compared using :py:mod:`difflib` should work.\n\n    fileobj : object\n        File-like object to write to.\n        The default is ``sys.stdout``, which writes to terminal.\n\n    indent_width : int\n        Character column(s) to indent.\n\n    Returns\n    -------\n    identical : bool\n        `True` if no diff, else `False`.\n\n    \"\"\"\n    if isinstance(a, np.ndarray) and isinstance(b, np.ndarray):\n        if a.shape != b.shape:\n            fileobj.write(\n                fixed_width_indent('  Different array shapes:\\n',\n                                   indent_width))\n            report_diff_values(str(a.shape), str(b.shape), fileobj=fileobj,\n                               indent_width=indent_width + 1)\n            return False\n\n        diff_indices = np.transpose(np.where(a != b))\n        num_diffs = diff_indices.shape[0]\n\n        for idx in diff_indices[:3]:\n            lidx = idx.tolist()\n            fileobj.write(\n                fixed_width_indent(f'  at {lidx!r}:\\n', indent_width))\n            report_diff_values(a[tuple(idx)], b[tuple(idx)], fileobj=fileobj,\n                               indent_width=indent_width + 1)\n\n        if num_diffs > 3:\n            fileobj.write(fixed_width_indent(\n                f'  ...and at {num_diffs - 3:d} more indices.\\n',\n                indent_width))\n            return False\n\n        return num_diffs == 0\n\n    typea = type(a)\n    typeb = type(b)\n\n    if typea == typeb:\n        lnpad = ' '\n        sign_a = 'a>'\n        sign_b = 'b>'\n        if isinstance(a, numbers.Number):\n            a = repr(a)\n            b = repr(b)\n        else:\n            a = str(a)\n            b = str(b)\n    else:\n        padding = max(len(typea.__name__), len(typeb.__name__)) + 3\n        lnpad = (padding + 1) * ' '\n        sign_a = ('(' + typea.__name__ + ') ').rjust(padding) + 'a>'\n        sign_b = ('(' + typeb.__name__ + ') ').rjust(padding) + 'b>'\n\n        is_a_str = isinstance(a, str)\n        is_b_str = isinstance(b, str)\n        a = (repr(a) if ((is_a_str and not is_b_str) or\n                         (not is_a_str and isinstance(a, numbers.Number)))\n             else str(a))\n        b = (repr(b) if ((is_b_str and not is_a_str) or\n                         (not is_b_str and isinstance(b, numbers.Number)))\n             else str(b))\n\n    identical = True\n\n    for line in difflib.ndiff(a.splitlines(), b.splitlines()):\n        if line[0] == '-':\n            identical = False\n            line = sign_a + line[1:]\n        elif line[0] == '+':\n            identical = False\n            line = sign_b + line[1:]\n        else:\n            line = lnpad + line\n        fileobj.write(fixed_width_indent(\n            '  {}\\n'.format(line.rstrip('\\n')), indent_width))\n\n    return identical\n\n\ndef where_not_allclose(a, b, rtol=1e-5, atol=1e-8):\n    \"\"\"\n    A version of :func:`numpy.allclose` that returns the indices\n    where the two arrays differ, instead of just a boolean value.\n\n    Parameters\n    ----------\n    a, b : array-like\n        Input arrays to compare.\n\n    rtol, atol : float\n        Relative and absolute tolerances as accepted by\n        :func:`numpy.allclose`.\n\n    Returns\n    -------\n    idx : tuple of array\n        Indices where the two arrays differ.\n\n    \"\"\"\n    # Create fixed mask arrays to handle INF and NaN; currently INF and NaN\n    # are handled as equivalent\n    if not np.all(np.isfinite(a)):\n        a = np.ma.fix_invalid(a).data\n    if not np.all(np.isfinite(b)):\n        b = np.ma.fix_invalid(b).data\n\n    if atol == 0.0 and rtol == 0.0:\n        # Use a faster comparison for the most simple (and common) case\n        return np.where(a != b)\n    return np.where(np.abs(a - b) > (atol + rtol * np.abs(b)))\n"},{"attributeType":"MagUnit","col":0,"comment":"null","endLoc":409,"id":10629,"name":"ABmag","nodeType":"Attribute","startLoc":409,"text":"ABmag"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":10630,"name":"__all__","nodeType":"Attribute","startLoc":10,"text":"__all__"},{"col":0,"comment":"","endLoc":1,"header":"diff.py#<anonymous>","id":10631,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"__all__ = ['fixed_width_indent', 'diff_values', 'report_diff_values',\n           'where_not_allclose']\n\nfixed_width_indent = functools.partial(indent, width=2)"},{"fileName":"codegen.py","filePath":"astropy/utils","id":10632,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"Utilities for generating new Python code at runtime.\"\"\"\n\n\nimport inspect\nimport itertools\nimport keyword\nimport os\nimport re\nimport textwrap\n\nfrom .introspection import find_current_module\n\n\n__all__ = ['make_function_with_signature']\n\n\n_ARGNAME_RE = re.compile(r'^[A-Za-z][A-Za-z_]*')\n\"\"\"\nRegular expression used my make_func which limits the allowed argument\nnames for the created function.  Only valid Python variable names in\nthe ASCII range and not beginning with '_' are allowed, currently.\n\"\"\"\n\n\ndef make_function_with_signature(func, args=(), kwargs={}, varargs=None,\n                                 varkwargs=None, name=None):\n    \"\"\"\n    Make a new function from an existing function but with the desired\n    signature.\n\n    The desired signature must of course be compatible with the arguments\n    actually accepted by the input function.\n\n    The ``args`` are strings that should be the names of the positional\n    arguments.  ``kwargs`` can map names of keyword arguments to their\n    default values.  It may be either a ``dict`` or a list of ``(keyword,\n    default)`` tuples.\n\n    If ``varargs`` is a string it is added to the positional arguments as\n    ``*<varargs>``.  Likewise ``varkwargs`` can be the name for a variable\n    keyword argument placeholder like ``**<varkwargs>``.\n\n    If not specified the name of the new function is taken from the original\n    function.  Otherwise, the ``name`` argument can be used to specify a new\n    name.\n\n    Note, the names may only be valid Python variable names.\n    \"\"\"\n\n    pos_args = []\n    key_args = []\n\n    if isinstance(kwargs, dict):\n        iter_kwargs = kwargs.items()\n    else:\n        iter_kwargs = iter(kwargs)\n\n    # Check that all the argument names are valid\n    for item in itertools.chain(args, iter_kwargs):\n        if isinstance(item, tuple):\n            argname = item[0]\n            key_args.append(item)\n        else:\n            argname = item\n            pos_args.append(item)\n\n        if keyword.iskeyword(argname) or not _ARGNAME_RE.match(argname):\n            raise SyntaxError(f'invalid argument name: {argname}')\n\n    for item in (varargs, varkwargs):\n        if item is not None:\n            if keyword.iskeyword(item) or not _ARGNAME_RE.match(item):\n                raise SyntaxError(f'invalid argument name: {item}')\n\n    def_signature = [', '.join(pos_args)]\n\n    if varargs:\n        def_signature.append(f', *{varargs}')\n\n    call_signature = def_signature[:]\n\n    if name is None:\n        name = func.__name__\n\n    global_vars = {f'__{name}__func': func}\n    local_vars = {}\n    # Make local variables to handle setting the default args\n    for idx, item in enumerate(key_args):\n        key, value = item\n        default_var = f'_kwargs{idx}'\n        local_vars[default_var] = value\n        def_signature.append(f', {key}={default_var}')\n        call_signature.append(', {0}={0}'.format(key))\n\n    if varkwargs:\n        def_signature.append(f', **{varkwargs}')\n        call_signature.append(f', **{varkwargs}')\n\n    def_signature = ''.join(def_signature).lstrip(', ')\n    call_signature = ''.join(call_signature).lstrip(', ')\n\n    mod = find_current_module(2)\n    frm = inspect.currentframe().f_back\n\n    if mod:\n        filename = mod.__file__\n        modname = mod.__name__\n        if filename.endswith('.pyc'):\n            filename = os.path.splitext(filename)[0] + '.py'\n    else:\n        filename = '<string>'\n        modname = '__main__'\n\n    # Subtract 2 from the line number since the length of the template itself\n    # is two lines.  Therefore we have to subtract those off in order for the\n    # pointer in tracebacks from __{name}__func to point to the right spot.\n    lineno = frm.f_lineno - 2\n\n    # The lstrip is in case there were *no* positional arguments (a rare case)\n    # in any context this will actually be used...\n    template = textwrap.dedent(\"\"\"{0}\\\n    def {name}({sig1}):\n        return __{name}__func({sig2})\n    \"\"\".format('\\n' * lineno, name=name, sig1=def_signature,\n               sig2=call_signature))\n\n    code = compile(template, filename, 'single')\n\n    eval(code, global_vars, local_vars)\n\n    new_func = local_vars[name]\n    new_func.__module__ = modname\n    new_func.__doc__ = func.__doc__\n\n    return new_func\n"},{"attributeType":"MagUnit","col":0,"comment":"null","endLoc":412,"id":10633,"name":"M_bol","nodeType":"Attribute","startLoc":412,"text":"M_bol"},{"attributeType":"MagUnit","col":0,"comment":"null","endLoc":416,"id":10634,"name":"m_bol","nodeType":"Attribute","startLoc":416,"text":"m_bol"},{"col":0,"comment":"\n    Make a new function from an existing function but with the desired\n    signature.\n\n    The desired signature must of course be compatible with the arguments\n    actually accepted by the input function.\n\n    The ``args`` are strings that should be the names of the positional\n    arguments.  ``kwargs`` can map names of keyword arguments to their\n    default values.  It may be either a ``dict`` or a list of ``(keyword,\n    default)`` tuples.\n\n    If ``varargs`` is a string it is added to the positional arguments as\n    ``*<varargs>``.  Likewise ``varkwargs`` can be the name for a variable\n    keyword argument placeholder like ``**<varkwargs>``.\n\n    If not specified the name of the new function is taken from the original\n    function.  Otherwise, the ``name`` argument can be used to specify a new\n    name.\n\n    Note, the names may only be valid Python variable names.\n    ","endLoc":137,"header":"def make_function_with_signature(func, args=(), kwargs={}, varargs=None,\n                                 varkwargs=None, name=None)","id":10635,"name":"make_function_with_signature","nodeType":"Function","startLoc":27,"text":"def make_function_with_signature(func, args=(), kwargs={}, varargs=None,\n                                 varkwargs=None, name=None):\n    \"\"\"\n    Make a new function from an existing function but with the desired\n    signature.\n\n    The desired signature must of course be compatible with the arguments\n    actually accepted by the input function.\n\n    The ``args`` are strings that should be the names of the positional\n    arguments.  ``kwargs`` can map names of keyword arguments to their\n    default values.  It may be either a ``dict`` or a list of ``(keyword,\n    default)`` tuples.\n\n    If ``varargs`` is a string it is added to the positional arguments as\n    ``*<varargs>``.  Likewise ``varkwargs`` can be the name for a variable\n    keyword argument placeholder like ``**<varkwargs>``.\n\n    If not specified the name of the new function is taken from the original\n    function.  Otherwise, the ``name`` argument can be used to specify a new\n    name.\n\n    Note, the names may only be valid Python variable names.\n    \"\"\"\n\n    pos_args = []\n    key_args = []\n\n    if isinstance(kwargs, dict):\n        iter_kwargs = kwargs.items()\n    else:\n        iter_kwargs = iter(kwargs)\n\n    # Check that all the argument names are valid\n    for item in itertools.chain(args, iter_kwargs):\n        if isinstance(item, tuple):\n            argname = item[0]\n            key_args.append(item)\n        else:\n            argname = item\n            pos_args.append(item)\n\n        if keyword.iskeyword(argname) or not _ARGNAME_RE.match(argname):\n            raise SyntaxError(f'invalid argument name: {argname}')\n\n    for item in (varargs, varkwargs):\n        if item is not None:\n            if keyword.iskeyword(item) or not _ARGNAME_RE.match(item):\n                raise SyntaxError(f'invalid argument name: {item}')\n\n    def_signature = [', '.join(pos_args)]\n\n    if varargs:\n        def_signature.append(f', *{varargs}')\n\n    call_signature = def_signature[:]\n\n    if name is None:\n        name = func.__name__\n\n    global_vars = {f'__{name}__func': func}\n    local_vars = {}\n    # Make local variables to handle setting the default args\n    for idx, item in enumerate(key_args):\n        key, value = item\n        default_var = f'_kwargs{idx}'\n        local_vars[default_var] = value\n        def_signature.append(f', {key}={default_var}')\n        call_signature.append(', {0}={0}'.format(key))\n\n    if varkwargs:\n        def_signature.append(f', **{varkwargs}')\n        call_signature.append(f', **{varkwargs}')\n\n    def_signature = ''.join(def_signature).lstrip(', ')\n    call_signature = ''.join(call_signature).lstrip(', ')\n\n    mod = find_current_module(2)\n    frm = inspect.currentframe().f_back\n\n    if mod:\n        filename = mod.__file__\n        modname = mod.__name__\n        if filename.endswith('.pyc'):\n            filename = os.path.splitext(filename)[0] + '.py'\n    else:\n        filename = '<string>'\n        modname = '__main__'\n\n    # Subtract 2 from the line number since the length of the template itself\n    # is two lines.  Therefore we have to subtract those off in order for the\n    # pointer in tracebacks from __{name}__func to point to the right spot.\n    lineno = frm.f_lineno - 2\n\n    # The lstrip is in case there were *no* positional arguments (a rare case)\n    # in any context this will actually be used...\n    template = textwrap.dedent(\"\"\"{0}\\\n    def {name}({sig1}):\n        return __{name}__func({sig2})\n    \"\"\".format('\\n' * lineno, name=name, sig1=def_signature,\n               sig2=call_signature))\n\n    code = compile(template, filename, 'single')\n\n    eval(code, global_vars, local_vars)\n\n    new_func = local_vars[name]\n    new_func.__module__ = modname\n    new_func.__doc__ = func.__doc__\n\n    return new_func"},{"col":0,"comment":"null","endLoc":262,"header":"@function_helper\ndef putmask(a, mask, values)","id":10636,"name":"putmask","nodeType":"Function","startLoc":252,"text":"@function_helper\ndef putmask(a, mask, values):\n    from astropy.units import Quantity\n    if isinstance(a, Quantity):\n        return (a.view(np.ndarray), mask,\n                a._to_own_unit(values)), {}, a.unit, None\n    elif isinstance(values, Quantity):\n        return (a, mask,\n                values.to_value(dimensionless_unscaled)), {}, None, None\n    else:\n        raise NotImplementedError"},{"col":0,"comment":"","endLoc":3,"header":"logarithmic.py#<anonymous>","id":10637,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['LogUnit', 'MagUnit', 'DexUnit', 'DecibelUnit',\n           'LogQuantity', 'Magnitude', 'Decibel', 'Dex',\n           'STmag', 'ABmag', 'M_bol', 'm_bol']\n\ndex._function_unit_class = DexUnit\n\ndB._function_unit_class = DecibelUnit\n\nmag._function_unit_class = MagUnit\n\nSTmag = MagUnit(photometric.STflux)\n\nSTmag.__doc__ = \"ST magnitude: STmag=-21.1 corresponds to 1 erg/s/cm2/A\"\n\nABmag = MagUnit(photometric.ABflux)\n\nABmag.__doc__ = \"AB magnitude: ABmag=-48.6 corresponds to 1 erg/s/cm2/Hz\"\n\nM_bol = MagUnit(photometric.Bol)\n\nM_bol.__doc__ = (\"Absolute bolometric magnitude: M_bol=0 corresponds to \"\n                 \"L_bol0={}\".format(photometric.Bol.si))\n\nm_bol = MagUnit(photometric.bol)\n\nm_bol.__doc__ = (\"Apparent bolometric magnitude: m_bol=0 corresponds to \"\n                 \"f_bol0={}\".format(photometric.bol.si))"},{"col":0,"comment":"null","endLoc":180,"header":"def helper_pvu(f, unit_t, unit_pv)","id":10638,"name":"helper_pvu","nodeType":"Function","startLoc":178,"text":"def helper_pvu(f, unit_t, unit_pv):\n    check_structured_unit(unit_pv, dt_pv)\n    return [get_converter(unit_t, unit_pv[0]/unit_pv[1]), None], unit_pv"},{"fileName":"state.py","filePath":"astropy/utils","id":10639,"nodeType":"File","text":"\"\"\"\nA simple class to manage a piece of global science state.  See\n:ref:`astropy:config-developer` for more details.\n\"\"\"\n\n\n__all__ = ['ScienceState']\n\n\nclass ScienceState:\n    \"\"\"\n    Science state subclasses are used to manage global items that can\n    affect science results.  Subclasses will generally override\n    `validate` to convert from any of the acceptable inputs (such as\n    strings) to the appropriate internal objects, and set an initial\n    value to the ``_value`` member so it has a default.\n\n    Examples\n    --------\n\n    ::\n\n        class MyState(ScienceState):\n            @classmethod\n            def validate(cls, value):\n                if value not in ('A', 'B', 'C'):\n                    raise ValueError(\"Must be one of A, B, C\")\n                return value\n    \"\"\"\n\n    def __init__(self):\n        raise RuntimeError(\n            \"This class is a singleton.  Do not instantiate.\")\n\n    @classmethod\n    def get(cls):\n        \"\"\"\n        Get the current science state value.\n        \"\"\"\n        return cls.validate(cls._value)\n\n    @classmethod\n    def set(cls, value):\n        \"\"\"\n        Set the current science state value.\n        \"\"\"\n        class _Context:\n            def __init__(self, parent, value):\n                self._value = value\n                self._parent = parent\n\n            def __enter__(self):\n                pass\n\n            def __exit__(self, type, value, tb):\n                self._parent._value = self._value\n\n            def __repr__(self):\n                # Ensure we have a single-line repr, just in case our\n                # value is not something simple like a string.\n                value_repr, lb, _ = repr(self._parent._value).partition('\\n')\n                if lb:\n                    value_repr += '...'\n                return (f'<ScienceState {self._parent.__name__}: {value_repr}>')\n\n        ctx = _Context(cls, cls._value)\n        value = cls.validate(value)\n        cls._value = value\n        return ctx\n\n    @classmethod\n    def validate(cls, value):\n        \"\"\"\n        Validate the value and convert it to its native type, if\n        necessary.\n        \"\"\"\n        return value\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":10640,"name":"__all__","nodeType":"Attribute","startLoc":7,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"state.py#<anonymous>","id":10641,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nA simple class to manage a piece of global science state.  See\n:ref:`astropy:config-developer` for more details.\n\"\"\"\n\n__all__ = ['ScienceState']"},{"col":0,"comment":"null","endLoc":185,"header":"def helper_pvup(f, unit_t, unit_pv)","id":10642,"name":"helper_pvup","nodeType":"Function","startLoc":183,"text":"def helper_pvup(f, unit_t, unit_pv):\n    check_structured_unit(unit_pv, dt_pv)\n    return [get_converter(unit_t, unit_pv[0]/unit_pv[1]), None], unit_pv[0]"},{"fileName":"setup_package.py","filePath":"astropy/utils","id":10643,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom setuptools import Extension\nfrom os.path import dirname, join, relpath\n\nASTROPY_UTILS_ROOT = dirname(__file__)\n\n\ndef get_extensions():\n    return [\n        Extension('astropy.utils._compiler',\n                  [relpath(join(ASTROPY_UTILS_ROOT, 'src', 'compiler.c'))])\n    ]\n"},{"col":0,"comment":"null","endLoc":13,"header":"def get_extensions()","id":10644,"name":"get_extensions","nodeType":"Function","startLoc":9,"text":"def get_extensions():\n    return [\n        Extension('astropy.utils._compiler',\n                  [relpath(join(ASTROPY_UTILS_ROOT, 'src', 'compiler.c'))])\n    ]"},{"col":0,"comment":"null","endLoc":191,"header":"def helper_s2xpv(f, unit1, unit2, unit_pv)","id":10645,"name":"helper_s2xpv","nodeType":"Function","startLoc":188,"text":"def helper_s2xpv(f, unit1, unit2, unit_pv):\n    check_structured_unit(unit_pv, dt_pv)\n    return [None, None, None], StructuredUnit((_d(unit1) * unit_pv[0],\n                                               _d(unit2) * unit_pv[1]))"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":10646,"name":"ASTROPY_UTILS_ROOT","nodeType":"Attribute","startLoc":6,"text":"ASTROPY_UTILS_ROOT"},{"col":0,"comment":"null","endLoc":275,"header":"@function_helper\ndef place(arr, mask, vals)","id":10647,"name":"place","nodeType":"Function","startLoc":265,"text":"@function_helper\ndef place(arr, mask, vals):\n    from astropy.units import Quantity\n    if isinstance(arr, Quantity):\n        return (arr.view(np.ndarray), mask,\n                arr._to_own_unit(vals)), {}, arr.unit, None\n    elif isinstance(vals, Quantity):\n        return (arr, mask,\n                vals.to_value(dimensionless_unscaled)), {}, None, None\n    else:\n        raise NotImplementedError"},{"attributeType":"null","col":8,"comment":"null","endLoc":1750,"id":10648,"name":"bad_urls","nodeType":"Attribute","startLoc":1750,"text":"self.bad_urls"},{"col":0,"comment":"null","endLoc":199,"header":"def ldbody_unit()","id":10649,"name":"ldbody_unit","nodeType":"Function","startLoc":194,"text":"def ldbody_unit():\n    from astropy.units.si import day, radian\n    from astropy.units.astrophys import Msun, AU\n\n    return StructuredUnit((Msun, radian, (AU, AU/day)),\n                          erfa_ufunc.dt_eraLDBODY)"},{"col":0,"comment":"\n    Returns readable file objects for all of the data files in a given\n    directory that match a given glob pattern.\n\n    Parameters\n    ----------\n    datadir : str\n        Name/location of the desired data files.  One of the following:\n\n            * The name of a directory included in the source\n              distribution.  The path is relative to the module\n              calling this function.  For example, if calling from\n              ``astropy.pkname``, use ``'data'`` to get the\n              files in ``astropy/pkgname/data``\n            * Remote URLs are not currently supported\n\n    package : str, optional\n        If specified, look for a file relative to the given package, rather\n        than the default of looking relative to the calling module's package.\n\n    pattern : str, optional\n        A UNIX-style filename glob pattern to match files.  See the\n        `glob` module in the standard library for more information.\n        By default, matches all files.\n\n    encoding : str, optional\n        When `None` (default), returns a file-like object with a\n        ``read`` method that returns `str` (``unicode``) objects, using\n        `locale.getpreferredencoding` as an encoding.  This matches\n        the default behavior of the built-in `open` when no ``mode``\n        argument is provided.\n\n        When ``'binary'``, returns a file-like object where its ``read``\n        method returns `bytes` objects.\n\n        When another string, it is the name of an encoding, and the\n        file-like object's ``read`` method will return `str` (``unicode``)\n        objects, decoded from binary using the given encoding.\n\n    Returns\n    -------\n    fileobjs : iterator of file object\n        File objects for each of the files on the local filesystem in\n        *datadir* matching *pattern*.\n\n    Examples\n    --------\n    This will retrieve the contents of the data file for the `astropy.wcs`\n    tests::\n\n        >>> from astropy.utils.data import get_pkg_data_filenames\n        >>> for fd in get_pkg_data_fileobjs('data/maps', 'astropy.wcs.tests',\n        ...                                 '*.hdr'):\n        ...     fcontents = fd.read()\n        ...\n    ","endLoc":854,"header":"def get_pkg_data_fileobjs(datadir, package=None, pattern='*', encoding=None)","id":10650,"name":"get_pkg_data_fileobjs","nodeType":"Function","startLoc":793,"text":"def get_pkg_data_fileobjs(datadir, package=None, pattern='*', encoding=None):\n    \"\"\"\n    Returns readable file objects for all of the data files in a given\n    directory that match a given glob pattern.\n\n    Parameters\n    ----------\n    datadir : str\n        Name/location of the desired data files.  One of the following:\n\n            * The name of a directory included in the source\n              distribution.  The path is relative to the module\n              calling this function.  For example, if calling from\n              ``astropy.pkname``, use ``'data'`` to get the\n              files in ``astropy/pkgname/data``\n            * Remote URLs are not currently supported\n\n    package : str, optional\n        If specified, look for a file relative to the given package, rather\n        than the default of looking relative to the calling module's package.\n\n    pattern : str, optional\n        A UNIX-style filename glob pattern to match files.  See the\n        `glob` module in the standard library for more information.\n        By default, matches all files.\n\n    encoding : str, optional\n        When `None` (default), returns a file-like object with a\n        ``read`` method that returns `str` (``unicode``) objects, using\n        `locale.getpreferredencoding` as an encoding.  This matches\n        the default behavior of the built-in `open` when no ``mode``\n        argument is provided.\n\n        When ``'binary'``, returns a file-like object where its ``read``\n        method returns `bytes` objects.\n\n        When another string, it is the name of an encoding, and the\n        file-like object's ``read`` method will return `str` (``unicode``)\n        objects, decoded from binary using the given encoding.\n\n    Returns\n    -------\n    fileobjs : iterator of file object\n        File objects for each of the files on the local filesystem in\n        *datadir* matching *pattern*.\n\n    Examples\n    --------\n    This will retrieve the contents of the data file for the `astropy.wcs`\n    tests::\n\n        >>> from astropy.utils.data import get_pkg_data_filenames\n        >>> for fd in get_pkg_data_fileobjs('data/maps', 'astropy.wcs.tests',\n        ...                                 '*.hdr'):\n        ...     fcontents = fd.read()\n        ...\n    \"\"\"\n\n    for fn in get_pkg_data_filenames(datadir, package=package,\n                                     pattern=pattern):\n        with get_readable_fileobj(fn, encoding=encoding) as fd:\n            yield fd"},{"col":0,"comment":"null","endLoc":209,"header":"def astrom_unit()","id":10651,"name":"astrom_unit","nodeType":"Function","startLoc":202,"text":"def astrom_unit():\n    from astropy.units.si import rad, year\n    from astropy.units.astrophys import AU\n    one = rel2c = dimensionless_unscaled\n\n    return StructuredUnit((year, AU, one, AU, rel2c, one, one, rad, rad, rad, rad,\n                           one, one, rel2c, rad, rad, rad),\n                          erfa_ufunc.dt_eraASTROM)"},{"col":0,"comment":"null","endLoc":216,"header":"def helper_ldn(f, unit_b, unit_ob, unit_sc)","id":10652,"name":"helper_ldn","nodeType":"Function","startLoc":212,"text":"def helper_ldn(f, unit_b, unit_ob, unit_sc):\n    from astropy.units.astrophys import AU\n    return [get_converter(unit_b, ldbody_unit()),\n            get_converter(unit_ob, AU),\n            get_converter(_d(unit_sc), dimensionless_unscaled)], dimensionless_unscaled"},{"col":0,"comment":"Return the total size in bytes of all files in the cache.","endLoc":1457,"header":"def cache_total_size(pkgname='astropy')","id":10653,"name":"cache_total_size","nodeType":"Function","startLoc":1451,"text":"def cache_total_size(pkgname='astropy'):\n    \"\"\"Return the total size in bytes of all files in the cache.\"\"\"\n    size = 0\n    dldir = _get_download_cache_loc(pkgname=pkgname)\n    for root, dirs, files in os.walk(dldir):\n        size += sum(os.path.getsize(os.path.join(root, name)) for name in files)\n    return size"},{"col":0,"comment":"null","endLoc":229,"header":"def helper_aper(f, unit_theta, unit_astrom)","id":10654,"name":"helper_aper","nodeType":"Function","startLoc":219,"text":"def helper_aper(f, unit_theta, unit_astrom):\n    check_structured_unit(unit_astrom, dt_eraASTROM)\n    unit_along = unit_astrom[7]  # along\n\n    if unit_astrom[14] is unit_along:  # eral\n        result_unit = unit_astrom\n    else:\n        result_units = tuple((unit_along if i == 14 else v)\n                             for i, v in enumerate(unit_astrom.values()))\n        result_unit = unit_astrom.__class__(result_units, names=unit_astrom)\n    return [get_converter(unit_theta, unit_along), None], result_unit"},{"col":0,"comment":"","endLoc":3,"header":"setup_package.py#<anonymous>","id":10655,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"ASTROPY_UTILS_ROOT = dirname(__file__)"},{"col":0,"comment":"null","endLoc":288,"header":"@function_helper\ndef copyto(dst, src, *args, **kwargs)","id":10656,"name":"copyto","nodeType":"Function","startLoc":278,"text":"@function_helper\ndef copyto(dst, src, *args, **kwargs):\n    from astropy.units import Quantity\n    if isinstance(dst, Quantity):\n        return ((dst.view(np.ndarray), dst._to_own_unit(src)) + args,\n                kwargs, None, None)\n    elif isinstance(src, Quantity):\n        return ((dst,  src.to_value(dimensionless_unscaled)) + args,\n                kwargs, None, None)\n    else:\n        raise NotImplementedError"},{"col":0,"comment":"null","endLoc":1463,"header":"def _do_download_files_in_parallel(kwargs)","id":10657,"name":"_do_download_files_in_parallel","nodeType":"Function","startLoc":1460,"text":"def _do_download_files_in_parallel(kwargs):\n    with astropy.config.paths.set_temp_config(kwargs.pop(\"temp_config\")):\n        with astropy.config.paths.set_temp_cache(kwargs.pop(\"temp_cache\")):\n            return download_file(**kwargs)"},{"fileName":"misc.py","filePath":"astropy/utils","id":10658,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nA \"grab bag\" of relatively small general-purpose utilities that don't have\na clear module/package to live in.\n\"\"\"\n\nimport abc\nimport contextlib\nimport difflib\nimport inspect\nimport json\nimport os\nimport signal\nimport sys\nimport traceback\nimport unicodedata\nimport locale\nimport threading\nimport re\n\nfrom contextlib import contextmanager\nfrom collections import defaultdict, OrderedDict\n\nfrom astropy.utils.decorators import deprecated\n\n\n__all__ = ['isiterable', 'silence', 'format_exception', 'NumpyRNGContext',\n           'find_api_page', 'is_path_hidden', 'walk_skip_hidden',\n           'JsonCustomEncoder', 'indent', 'dtype_bytes_or_chars',\n           'OrderedDescriptor', 'OrderedDescriptorContainer']\n\n\n# Because they are deprecated.\n__doctest_skip__ = ['OrderedDescriptor', 'OrderedDescriptorContainer']\n\n\nNOT_OVERWRITING_MSG = ('File {} already exists. If you mean to replace it '\n                       'then use the argument \"overwrite=True\".')\n# A useful regex for tests.\n_NOT_OVERWRITING_MSG_MATCH = (r'File .* already exists\\. If you mean to '\n                              r'replace it then use the argument '\n                              r'\"overwrite=True\"\\.')\n\n\ndef isiterable(obj):\n    \"\"\"Returns `True` if the given object is iterable.\"\"\"\n\n    try:\n        iter(obj)\n        return True\n    except TypeError:\n        return False\n\n\ndef indent(s, shift=1, width=4):\n    \"\"\"Indent a block of text.  The indentation is applied to each line.\"\"\"\n\n    indented = '\\n'.join(' ' * (width * shift) + l if l else ''\n                         for l in s.splitlines())\n    if s[-1] == '\\n':\n        indented += '\\n'\n\n    return indented\n\n\nclass _DummyFile:\n    \"\"\"A noop writeable object.\"\"\"\n\n    def write(self, s):\n        pass\n\n\n@contextlib.contextmanager\ndef silence():\n    \"\"\"A context manager that silences sys.stdout and sys.stderr.\"\"\"\n\n    old_stdout = sys.stdout\n    old_stderr = sys.stderr\n    sys.stdout = _DummyFile()\n    sys.stderr = _DummyFile()\n    yield\n    sys.stdout = old_stdout\n    sys.stderr = old_stderr\n\n\ndef format_exception(msg, *args, **kwargs):\n    \"\"\"\n    Given an exception message string, uses new-style formatting arguments\n    ``{filename}``, ``{lineno}``, ``{func}`` and/or ``{text}`` to fill in\n    information about the exception that occurred.  For example:\n\n        try:\n            1/0\n        except:\n            raise ZeroDivisionError(\n                format_except('A divide by zero occurred in {filename} at '\n                              'line {lineno} of function {func}.'))\n\n    Any additional positional or keyword arguments passed to this function are\n    also used to format the message.\n\n    .. note::\n        This uses `sys.exc_info` to gather up the information needed to fill\n        in the formatting arguments. Since `sys.exc_info` is not carried\n        outside a handled exception, it's not wise to use this\n        outside of an ``except`` clause - if it is, this will substitute\n        '<unknown>' for the 4 formatting arguments.\n    \"\"\"\n\n    tb = traceback.extract_tb(sys.exc_info()[2], limit=1)\n    if len(tb) > 0:\n        filename, lineno, func, text = tb[0]\n    else:\n        filename = lineno = func = text = '<unknown>'\n\n    return msg.format(*args, filename=filename, lineno=lineno, func=func,\n                      text=text, **kwargs)\n\n\nclass NumpyRNGContext:\n    \"\"\"\n    A context manager (for use with the ``with`` statement) that will seed the\n    numpy random number generator (RNG) to a specific value, and then restore\n    the RNG state back to whatever it was before.\n\n    This is primarily intended for use in the astropy testing suit, but it\n    may be useful in ensuring reproducibility of Monte Carlo simulations in a\n    science context.\n\n    Parameters\n    ----------\n    seed : int\n        The value to use to seed the numpy RNG\n\n    Examples\n    --------\n    A typical use case might be::\n\n        with NumpyRNGContext(<some seed value you pick>):\n            from numpy import random\n\n            randarr = random.randn(100)\n            ... run your test using `randarr` ...\n\n        #Any code using numpy.random at this indent level will act just as it\n        #would have if it had been before the with statement - e.g. whatever\n        #the default seed is.\n\n\n    \"\"\"\n\n    def __init__(self, seed):\n        self.seed = seed\n\n    def __enter__(self):\n        from numpy import random\n\n        self.startstate = random.get_state()\n        random.seed(self.seed)\n\n    def __exit__(self, exc_type, exc_value, traceback):\n        from numpy import random\n\n        random.set_state(self.startstate)\n\n\ndef find_api_page(obj, version=None, openinbrowser=True, timeout=None):\n    \"\"\"\n    Determines the URL of the API page for the specified object, and\n    optionally open that page in a web browser.\n\n    .. note::\n        You must be connected to the internet for this to function even if\n        ``openinbrowser`` is `False`, unless you provide a local version of\n        the documentation to ``version`` (e.g., ``file:///path/to/docs``).\n\n    Parameters\n    ----------\n    obj\n        The object to open the docs for or its fully-qualified name\n        (as a str).\n    version : str\n        The doc version - either a version number like '0.1', 'dev' for\n        the development/latest docs, or a URL to point to a specific\n        location that should be the *base* of the documentation. Defaults to\n        latest if you are on aren't on a release, otherwise, the version you\n        are on.\n    openinbrowser : bool\n        If `True`, the `webbrowser` package will be used to open the doc\n        page in a new web browser window.\n    timeout : number, optional\n        The number of seconds to wait before timing-out the query to\n        the astropy documentation.  If not given, the default python\n        stdlib timeout will be used.\n\n    Returns\n    -------\n    url : str\n        The loaded URL\n\n    Raises\n    ------\n    ValueError\n        If the documentation can't be found\n\n    \"\"\"\n    import webbrowser\n    from zlib import decompress\n    from astropy.utils.data import get_readable_fileobj\n\n    if (not isinstance(obj, str) and\n            hasattr(obj, '__module__') and\n            hasattr(obj, '__name__')):\n        obj = obj.__module__ + '.' + obj.__name__\n    elif inspect.ismodule(obj):\n        obj = obj.__name__\n\n    if version is None:\n        from astropy import version\n\n        if version.release:\n            version = 'v' + version.version\n        else:\n            version = 'dev'\n\n    if '://' in version:\n        if version.endswith('index.html'):\n            baseurl = version[:-10]\n        elif version.endswith('/'):\n            baseurl = version\n        else:\n            baseurl = version + '/'\n    elif version == 'dev' or version == 'latest':\n        baseurl = 'http://devdocs.astropy.org/'\n    else:\n        baseurl = f'https://docs.astropy.org/en/{version}/'\n\n    # Custom request headers; see\n    # https://github.com/astropy/astropy/issues/8990\n    url = baseurl + 'objects.inv'\n    headers = {'User-Agent': f'Astropy/{version}'}\n    with get_readable_fileobj(url, encoding='binary', remote_timeout=timeout,\n                              http_headers=headers) as uf:\n        oiread = uf.read()\n\n        # need to first read/remove the first four lines, which have info before\n        # the compressed section with the actual object inventory\n        idx = -1\n        headerlines = []\n        for _ in range(4):\n            oldidx = idx\n            idx = oiread.index(b'\\n', oldidx + 1)\n            headerlines.append(oiread[(oldidx+1):idx].decode('utf-8'))\n\n        # intersphinx version line, project name, and project version\n        ivers, proj, vers, compr = headerlines\n        if 'The remainder of this file is compressed using zlib' not in compr:\n            raise ValueError('The file downloaded from {} does not seem to be'\n                             'the usual Sphinx objects.inv format.  Maybe it '\n                             'has changed?'.format(baseurl + 'objects.inv'))\n\n        compressed = oiread[(idx+1):]\n\n    decompressed = decompress(compressed).decode('utf-8')\n\n    resurl = None\n\n    for l in decompressed.strip().splitlines():\n        ls = l.split()\n        name = ls[0]\n        loc = ls[3]\n        if loc.endswith('$'):\n            loc = loc[:-1] + name\n\n        if name == obj:\n            resurl = baseurl + loc\n            break\n\n    if resurl is None:\n        raise ValueError(f'Could not find the docs for the object {obj}')\n    elif openinbrowser:\n        webbrowser.open(resurl)\n\n    return resurl\n\n\ndef signal_number_to_name(signum):\n    \"\"\"\n    Given an OS signal number, returns a signal name.  If the signal\n    number is unknown, returns ``'UNKNOWN'``.\n    \"\"\"\n    # Since these numbers and names are platform specific, we use the\n    # builtin signal module and build a reverse mapping.\n\n    signal_to_name_map = dict((k, v) for v, k in signal.__dict__.items()\n                              if v.startswith('SIG'))\n\n    return signal_to_name_map.get(signum, 'UNKNOWN')\n\n\nif sys.platform == 'win32':\n    import ctypes\n\n    def _has_hidden_attribute(filepath):\n        \"\"\"\n        Returns True if the given filepath has the hidden attribute on\n        MS-Windows.  Based on a post here:\n        https://stackoverflow.com/questions/284115/cross-platform-hidden-file-detection\n        \"\"\"\n        if isinstance(filepath, bytes):\n            filepath = filepath.decode(sys.getfilesystemencoding())\n        try:\n            attrs = ctypes.windll.kernel32.GetFileAttributesW(filepath)\n            result = bool(attrs & 2) and attrs != -1\n        except AttributeError:\n            result = False\n        return result\nelse:\n    def _has_hidden_attribute(filepath):\n        return False\n\n\ndef is_path_hidden(filepath):\n    \"\"\"\n    Determines if a given file or directory is hidden.\n\n    Parameters\n    ----------\n    filepath : str\n        The path to a file or directory\n\n    Returns\n    -------\n    hidden : bool\n        Returns `True` if the file is hidden\n    \"\"\"\n    name = os.path.basename(os.path.abspath(filepath))\n    if isinstance(name, bytes):\n        is_dotted = name.startswith(b'.')\n    else:\n        is_dotted = name.startswith('.')\n    return is_dotted or _has_hidden_attribute(filepath)\n\n\ndef walk_skip_hidden(top, onerror=None, followlinks=False):\n    \"\"\"\n    A wrapper for `os.walk` that skips hidden files and directories.\n\n    This function does not have the parameter ``topdown`` from\n    `os.walk`: the directories must always be recursed top-down when\n    using this function.\n\n    See also\n    --------\n    os.walk : For a description of the parameters\n    \"\"\"\n    for root, dirs, files in os.walk(\n            top, topdown=True, onerror=onerror,\n            followlinks=followlinks):\n        # These lists must be updated in-place so os.walk will skip\n        # hidden directories\n        dirs[:] = [d for d in dirs if not is_path_hidden(d)]\n        files[:] = [f for f in files if not is_path_hidden(f)]\n        yield root, dirs, files\n\n\nclass JsonCustomEncoder(json.JSONEncoder):\n    \"\"\"Support for data types that JSON default encoder\n    does not do.\n\n    This includes:\n\n        * Numpy array or number\n        * Complex number\n        * Set\n        * Bytes\n        * astropy.UnitBase\n        * astropy.Quantity\n\n    Examples\n    --------\n    >>> import json\n    >>> import numpy as np\n    >>> from astropy.utils.misc import JsonCustomEncoder\n    >>> json.dumps(np.arange(3), cls=JsonCustomEncoder)\n    '[0, 1, 2]'\n\n    \"\"\"\n\n    def default(self, obj):\n        from astropy import units as u\n        import numpy as np\n        if isinstance(obj, u.Quantity):\n            return dict(value=obj.value, unit=obj.unit.to_string())\n        if isinstance(obj, (np.number, np.ndarray)):\n            return obj.tolist()\n        elif isinstance(obj, complex):\n            return [obj.real, obj.imag]\n        elif isinstance(obj, set):\n            return list(obj)\n        elif isinstance(obj, bytes):  # pragma: py3\n            return obj.decode()\n        elif isinstance(obj, (u.UnitBase, u.FunctionUnitBase)):\n            if obj == u.dimensionless_unscaled:\n                obj = 'dimensionless_unit'\n            else:\n                return obj.to_string()\n\n        return json.JSONEncoder.default(self, obj)\n\n\ndef strip_accents(s):\n    \"\"\"\n    Remove accents from a Unicode string.\n\n    This helps with matching \"ångström\" to \"angstrom\", for example.\n    \"\"\"\n    return ''.join(\n        c for c in unicodedata.normalize('NFD', s)\n        if unicodedata.category(c) != 'Mn')\n\n\ndef did_you_mean(s, candidates, n=3, cutoff=0.8, fix=None):\n    \"\"\"\n    When a string isn't found in a set of candidates, we can be nice\n    to provide a list of alternatives in the exception.  This\n    convenience function helps to format that part of the exception.\n\n    Parameters\n    ----------\n    s : str\n\n    candidates : sequence of str or dict of str keys\n\n    n : int\n        The maximum number of results to include.  See\n        `difflib.get_close_matches`.\n\n    cutoff : float\n        In the range [0, 1]. Possibilities that don't score at least\n        that similar to word are ignored.  See\n        `difflib.get_close_matches`.\n\n    fix : callable\n        A callable to modify the results after matching.  It should\n        take a single string and return a sequence of strings\n        containing the fixed matches.\n\n    Returns\n    -------\n    message : str\n        Returns the string \"Did you mean X, Y, or Z?\", or the empty\n        string if no alternatives were found.\n    \"\"\"\n    if isinstance(s, str):\n        s = strip_accents(s)\n    s_lower = s.lower()\n\n    # Create a mapping from the lower case name to all capitalization\n    # variants of that name.\n    candidates_lower = {}\n    for candidate in candidates:\n        candidate_lower = candidate.lower()\n        candidates_lower.setdefault(candidate_lower, [])\n        candidates_lower[candidate_lower].append(candidate)\n\n    # The heuristic here is to first try \"singularizing\" the word.  If\n    # that doesn't match anything use difflib to find close matches in\n    # original, lower and upper case.\n    if s_lower.endswith('s') and s_lower[:-1] in candidates_lower:\n        matches = [s_lower[:-1]]\n    else:\n        matches = difflib.get_close_matches(\n            s_lower, candidates_lower, n=n, cutoff=cutoff)\n\n    if len(matches):\n        capitalized_matches = set()\n        for match in matches:\n            capitalized_matches.update(candidates_lower[match])\n        matches = capitalized_matches\n\n        if fix is not None:\n            mapped_matches = []\n            for match in matches:\n                mapped_matches.extend(fix(match))\n            matches = mapped_matches\n\n        matches = list(set(matches))\n        matches = sorted(matches)\n\n        if len(matches) == 1:\n            matches = matches[0]\n        else:\n            matches = (', '.join(matches[:-1]) + ' or ' +\n                       matches[-1])\n        return f'Did you mean {matches}?'\n\n    return ''\n\n\n_ordered_descriptor_deprecation_message = \"\"\"\\\nThe {func} {obj_type} is deprecated and may be removed in a future version.\n\n    You can replace its functionality with a combination of the\n    __init_subclass__ and __set_name__ magic methods introduced in Python 3.6.\n    See https://github.com/astropy/astropy/issues/11094 for recipes on how to\n    replicate their functionality.\n\"\"\"\n\n\n@deprecated('4.3', _ordered_descriptor_deprecation_message)\nclass OrderedDescriptor(metaclass=abc.ABCMeta):\n    \"\"\"\n    Base class for descriptors whose order in the class body should be\n    preserved.  Intended for use in concert with the\n    `OrderedDescriptorContainer` metaclass.\n\n    Subclasses of `OrderedDescriptor` must define a value for a class attribute\n    called ``_class_attribute_``.  This is the name of a class attribute on the\n    *container* class for these descriptors, which will be set to an\n    `~collections.OrderedDict` at class creation time.  This\n    `~collections.OrderedDict` will contain a mapping of all class attributes\n    that were assigned instances of the `OrderedDescriptor` subclass, to the\n    instances themselves.  See the documentation for\n    `OrderedDescriptorContainer` for a concrete example.\n\n    Optionally, subclasses of `OrderedDescriptor` may define a value for a\n    class attribute called ``_name_attribute_``.  This should be the name of\n    an attribute on instances of the subclass.  When specified, during\n    creation of a class containing these descriptors, the name attribute on\n    each instance will be set to the name of the class attribute it was\n    assigned to on the class.\n\n    .. note::\n\n        Although this class is intended for use with *descriptors* (i.e.\n        classes that define any of the ``__get__``, ``__set__``, or\n        ``__delete__`` magic methods), this base class is not itself a\n        descriptor, and technically this could be used for classes that are\n        not descriptors too.  However, use with descriptors is the original\n        intended purpose.\n    \"\"\"\n\n    # This id increments for each OrderedDescriptor instance created, so they\n    # are always ordered in the order they were created.  Class bodies are\n    # guaranteed to be executed from top to bottom.  Not sure if this is\n    # thread-safe though.\n    _nextid = 1\n\n    @property\n    @abc.abstractmethod\n    def _class_attribute_(self):\n        \"\"\"\n        Subclasses should define this attribute to the name of an attribute on\n        classes containing this subclass.  That attribute will contain the mapping\n        of all instances of that `OrderedDescriptor` subclass defined in the class\n        body.  If the same descriptor needs to be used with different classes,\n        each with different names of this attribute, multiple subclasses will be\n        needed.\n        \"\"\"\n\n    _name_attribute_ = None\n    \"\"\"\n    Subclasses may optionally define this attribute to specify the name of an\n    attribute on instances of the class that should be filled with the\n    instance's attribute name at class creation time.\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n        # The _nextid attribute is shared across all subclasses so that\n        # different subclasses of OrderedDescriptors can be sorted correctly\n        # between themselves\n        self.__order = OrderedDescriptor._nextid\n        OrderedDescriptor._nextid += 1\n        super().__init__()\n\n    def __lt__(self, other):\n        \"\"\"\n        Defined for convenient sorting of `OrderedDescriptor` instances, which\n        are defined to sort in their creation order.\n        \"\"\"\n\n        if (isinstance(self, OrderedDescriptor) and\n                isinstance(other, OrderedDescriptor)):\n            try:\n                return self.__order < other.__order\n            except AttributeError:\n                raise RuntimeError(\n                    'Could not determine ordering for {} and {}; at least '\n                    'one of them is not calling super().__init__ in its '\n                    '__init__.'.format(self, other))\n        else:\n            return NotImplemented\n\n\n@deprecated('4.3', _ordered_descriptor_deprecation_message)\nclass OrderedDescriptorContainer(type):\n    \"\"\"\n    Classes should use this metaclass if they wish to use `OrderedDescriptor`\n    attributes, which are class attributes that \"remember\" the order in which\n    they were defined in the class body.\n\n    Every subclass of `OrderedDescriptor` has an attribute called\n    ``_class_attribute_``.  For example, if we have\n\n    .. code:: python\n\n        class ExampleDecorator(OrderedDescriptor):\n            _class_attribute_ = '_examples_'\n\n    Then when a class with the `OrderedDescriptorContainer` metaclass is\n    created, it will automatically be assigned a class attribute ``_examples_``\n    referencing an `~collections.OrderedDict` containing all instances of\n    ``ExampleDecorator`` defined in the class body, mapped to by the names of\n    the attributes they were assigned to.\n\n    When subclassing a class with this metaclass, the descriptor dict (i.e.\n    ``_examples_`` in the above example) will *not* contain descriptors\n    inherited from the base class.  That is, this only works by default with\n    decorators explicitly defined in the class body.  However, the subclass\n    *may* define an attribute ``_inherit_decorators_`` which lists\n    `OrderedDescriptor` classes that *should* be added from base classes.\n    See the examples section below for an example of this.\n\n    Examples\n    --------\n\n    >>> from astropy.utils import OrderedDescriptor, OrderedDescriptorContainer\n    >>> class TypedAttribute(OrderedDescriptor):\n    ...     \\\"\\\"\\\"\n    ...     Attributes that may only be assigned objects of a specific type,\n    ...     or subclasses thereof.  For some reason we care about their order.\n    ...     \\\"\\\"\\\"\n    ...\n    ...     _class_attribute_ = 'typed_attributes'\n    ...     _name_attribute_ = 'name'\n    ...     # A default name so that instances not attached to a class can\n    ...     # still be repr'd; useful for debugging\n    ...     name = '<unbound>'\n    ...\n    ...     def __init__(self, type):\n    ...         # Make sure not to forget to call the super __init__\n    ...         super().__init__()\n    ...         self.type = type\n    ...\n    ...     def __get__(self, obj, objtype=None):\n    ...         if obj is None:\n    ...             return self\n    ...         if self.name in obj.__dict__:\n    ...             return obj.__dict__[self.name]\n    ...         else:\n    ...             raise AttributeError(self.name)\n    ...\n    ...     def __set__(self, obj, value):\n    ...         if not isinstance(value, self.type):\n    ...             raise ValueError('{0}.{1} must be of type {2!r}'.format(\n    ...                 obj.__class__.__name__, self.name, self.type))\n    ...         obj.__dict__[self.name] = value\n    ...\n    ...     def __delete__(self, obj):\n    ...         if self.name in obj.__dict__:\n    ...             del obj.__dict__[self.name]\n    ...         else:\n    ...             raise AttributeError(self.name)\n    ...\n    ...     def __repr__(self):\n    ...         if isinstance(self.type, tuple) and len(self.type) > 1:\n    ...             typestr = '({0})'.format(\n    ...                 ', '.join(t.__name__ for t in self.type))\n    ...         else:\n    ...             typestr = self.type.__name__\n    ...         return '<{0}(name={1}, type={2})>'.format(\n    ...                 self.__class__.__name__, self.name, typestr)\n    ...\n\n    Now let's create an example class that uses this ``TypedAttribute``::\n\n        >>> class Point2D(metaclass=OrderedDescriptorContainer):\n        ...     x = TypedAttribute((float, int))\n        ...     y = TypedAttribute((float, int))\n        ...\n        ...     def __init__(self, x, y):\n        ...         self.x, self.y = x, y\n        ...\n        >>> p1 = Point2D(1.0, 2.0)\n        >>> p1.x\n        1.0\n        >>> p1.y\n        2.0\n        >>> p2 = Point2D('a', 'b')  # doctest: +IGNORE_EXCEPTION_DETAIL\n        Traceback (most recent call last):\n            ...\n        ValueError: Point2D.x must be of type (float, int>)\n\n    We see that ``TypedAttribute`` works more or less as advertised, but\n    there's nothing special about that.  Let's see what\n    `OrderedDescriptorContainer` did for us::\n\n        >>> Point2D.typed_attributes\n        OrderedDict([('x', <TypedAttribute(name=x, type=(float, int))>),\n        ('y', <TypedAttribute(name=y, type=(float, int))>)])\n\n    If we create a subclass, it does *not* by default add inherited descriptors\n    to ``typed_attributes``::\n\n        >>> class Point3D(Point2D):\n        ...     z = TypedAttribute((float, int))\n        ...\n        >>> Point3D.typed_attributes\n        OrderedDict([('z', <TypedAttribute(name=z, type=(float, int))>)])\n\n    However, if we specify ``_inherit_descriptors_`` from ``Point2D`` then\n    it will do so::\n\n        >>> class Point3D(Point2D):\n        ...     _inherit_descriptors_ = (TypedAttribute,)\n        ...     z = TypedAttribute((float, int))\n        ...\n        >>> Point3D.typed_attributes\n        OrderedDict([('x', <TypedAttribute(name=x, type=(float, int))>),\n        ('y', <TypedAttribute(name=y, type=(float, int))>),\n        ('z', <TypedAttribute(name=z, type=(float, int))>)])\n\n    .. note::\n\n        Hopefully it is clear from these examples that this construction\n        also allows a class of type `OrderedDescriptorContainer` to use\n        multiple different `OrderedDescriptor` classes simultaneously.\n    \"\"\"\n\n    _inherit_descriptors_ = ()\n\n    def __init__(cls, cls_name, bases, members):\n        descriptors = defaultdict(list)\n        seen = set()\n        inherit_descriptors = ()\n        descr_bases = {}\n\n        for mro_cls in cls.__mro__:\n            for name, obj in mro_cls.__dict__.items():\n                if name in seen:\n                    # Checks if we've already seen an attribute of the given\n                    # name (if so it will override anything of the same name in\n                    # any base class)\n                    continue\n\n                seen.add(name)\n\n                if (not isinstance(obj, OrderedDescriptor) or\n                        (inherit_descriptors and\n                            not isinstance(obj, inherit_descriptors))):\n                    # The second condition applies when checking any\n                    # subclasses, to see if we can inherit any descriptors of\n                    # the given type from subclasses (by default inheritance is\n                    # disabled unless the class has _inherit_descriptors_\n                    # defined)\n                    continue\n\n                if obj._name_attribute_ is not None:\n                    setattr(obj, obj._name_attribute_, name)\n\n                # Don't just use the descriptor's class directly; instead go\n                # through its MRO and find the class on which _class_attribute_\n                # is defined directly.  This way subclasses of some\n                # OrderedDescriptor *may* override _class_attribute_ and have\n                # its own _class_attribute_, but by default all subclasses of\n                # some OrderedDescriptor are still grouped together\n                # TODO: It might be worth clarifying this in the docs\n                if obj.__class__ not in descr_bases:\n                    for obj_cls_base in obj.__class__.__mro__:\n                        if '_class_attribute_' in obj_cls_base.__dict__:\n                            descr_bases[obj.__class__] = obj_cls_base\n                            descriptors[obj_cls_base].append((obj, name))\n                            break\n                else:\n                    # Make sure to put obj first for sorting purposes\n                    obj_cls_base = descr_bases[obj.__class__]\n                    descriptors[obj_cls_base].append((obj, name))\n\n            if not getattr(mro_cls, '_inherit_descriptors_', False):\n                # If _inherit_descriptors_ is undefined then we don't inherit\n                # any OrderedDescriptors from any of the base classes, and\n                # there's no reason to continue through the MRO\n                break\n            else:\n                inherit_descriptors = mro_cls._inherit_descriptors_\n\n        for descriptor_cls, instances in descriptors.items():\n            instances.sort()\n            instances = OrderedDict((key, value) for value, key in instances)\n            setattr(cls, descriptor_cls._class_attribute_, instances)\n\n        super(OrderedDescriptorContainer, cls).__init__(cls_name, bases,\n                                                        members)\n\n\nLOCALE_LOCK = threading.Lock()\n\n\n@contextmanager\ndef _set_locale(name):\n    \"\"\"\n    Context manager to temporarily set the locale to ``name``.\n\n    An example is setting locale to \"C\" so that the C strtod()\n    function will use \".\" as the decimal point to enable consistent\n    numerical string parsing.\n\n    Note that one cannot nest multiple _set_locale() context manager\n    statements as this causes a threading lock.\n\n    This code taken from https://stackoverflow.com/questions/18593661/how-do-i-strftime-a-date-object-in-a-different-locale.\n\n    Parameters\n    ==========\n    name : str\n        Locale name, e.g. \"C\" or \"fr_FR\".\n    \"\"\"\n    name = str(name)\n\n    with LOCALE_LOCK:\n        saved = locale.setlocale(locale.LC_ALL)\n        if saved == name:\n            # Don't do anything if locale is already the requested locale\n            yield\n        else:\n            try:\n                locale.setlocale(locale.LC_ALL, name)\n                yield\n            finally:\n                locale.setlocale(locale.LC_ALL, saved)\n\n\nset_locale = deprecated('4.0')(_set_locale)\nset_locale.__doc__ = \"\"\"Deprecated version of :func:`_set_locale` above.\nSee https://github.com/astropy/astropy/issues/9196\n\"\"\"\n\n\ndef dtype_bytes_or_chars(dtype):\n    \"\"\"\n    Parse the number out of a dtype.str value like '<U5' or '<f8'.\n\n    See #5819 for discussion on the need for this function for getting\n    the number of characters corresponding to a string dtype.\n\n    Parameters\n    ----------\n    dtype : numpy dtype object\n        Input dtype\n\n    Returns\n    -------\n    bytes_or_chars : int or None\n        Bits (for numeric types) or characters (for string types)\n    \"\"\"\n    match = re.search(r'(\\d+)$', dtype.str)\n    out = int(match.group(1)) if match else None\n    return out\n\n\ndef _hungry_for(option):  # pragma: no cover\n    \"\"\"\n    Open browser loaded with ``option`` options near you.\n\n    *Disclaimers: Payments not included. Astropy is not\n    responsible for any liability from using this function.*\n\n    .. note:: Accuracy depends on your browser settings.\n\n    \"\"\"\n    import webbrowser\n    webbrowser.open(f'https://www.google.com/search?q={option}+near+me')\n\n\ndef pizza():  # pragma: no cover\n    \"\"\"``/pizza``\"\"\"\n    _hungry_for('pizza')\n\n\ndef coffee(is_adam=False, is_brigitta=False):  # pragma: no cover\n    \"\"\"``/coffee``\"\"\"\n    if is_adam and is_brigitta:\n        raise ValueError('There can be only one!')\n    if is_adam:\n        option = 'fresh+third+wave+coffee'\n    elif is_brigitta:\n        option = 'decent+espresso'\n    else:\n        option = 'coffee'\n    _hungry_for(option)\n"},{"className":"_DummyFile","col":0,"comment":"A noop writeable object.","endLoc":71,"id":10659,"nodeType":"Class","startLoc":67,"text":"class _DummyFile:\n    \"\"\"A noop writeable object.\"\"\"\n\n    def write(self, s):\n        pass"},{"col":4,"comment":"null","endLoc":71,"header":"def write(self, s)","id":10660,"name":"write","nodeType":"Function","startLoc":70,"text":"def write(self, s):\n        pass"},{"className":"NumpyRNGContext","col":0,"comment":"\n    A context manager (for use with the ``with`` statement) that will seed the\n    numpy random number generator (RNG) to a specific value, and then restore\n    the RNG state back to whatever it was before.\n\n    This is primarily intended for use in the astropy testing suit, but it\n    may be useful in ensuring reproducibility of Monte Carlo simulations in a\n    science context.\n\n    Parameters\n    ----------\n    seed : int\n        The value to use to seed the numpy RNG\n\n    Examples\n    --------\n    A typical use case might be::\n\n        with NumpyRNGContext(<some seed value you pick>):\n            from numpy import random\n\n            randarr = random.randn(100)\n            ... run your test using `randarr` ...\n\n        #Any code using numpy.random at this indent level will act just as it\n        #would have if it had been before the with statement - e.g. whatever\n        #the default seed is.\n\n\n    ","endLoc":165,"id":10661,"nodeType":"Class","startLoc":121,"text":"class NumpyRNGContext:\n    \"\"\"\n    A context manager (for use with the ``with`` statement) that will seed the\n    numpy random number generator (RNG) to a specific value, and then restore\n    the RNG state back to whatever it was before.\n\n    This is primarily intended for use in the astropy testing suit, but it\n    may be useful in ensuring reproducibility of Monte Carlo simulations in a\n    science context.\n\n    Parameters\n    ----------\n    seed : int\n        The value to use to seed the numpy RNG\n\n    Examples\n    --------\n    A typical use case might be::\n\n        with NumpyRNGContext(<some seed value you pick>):\n            from numpy import random\n\n            randarr = random.randn(100)\n            ... run your test using `randarr` ...\n\n        #Any code using numpy.random at this indent level will act just as it\n        #would have if it had been before the with statement - e.g. whatever\n        #the default seed is.\n\n\n    \"\"\"\n\n    def __init__(self, seed):\n        self.seed = seed\n\n    def __enter__(self):\n        from numpy import random\n\n        self.startstate = random.get_state()\n        random.seed(self.seed)\n\n    def __exit__(self, exc_type, exc_value, traceback):\n        from numpy import random\n\n        random.set_state(self.startstate)"},{"col":4,"comment":"null","endLoc":154,"header":"def __init__(self, seed)","id":10662,"name":"__init__","nodeType":"Function","startLoc":153,"text":"def __init__(self, seed):\n        self.seed = seed"},{"col":4,"comment":"null","endLoc":160,"header":"def __enter__(self)","id":10663,"name":"__enter__","nodeType":"Function","startLoc":156,"text":"def __enter__(self):\n        from numpy import random\n\n        self.startstate = random.get_state()\n        random.seed(self.seed)"},{"col":4,"comment":"null","endLoc":165,"header":"def __exit__(self, exc_type, exc_value, traceback)","id":10664,"name":"__exit__","nodeType":"Function","startLoc":162,"text":"def __exit__(self, exc_type, exc_value, traceback):\n        from numpy import random\n\n        random.set_state(self.startstate)"},{"attributeType":"null","col":8,"comment":"null","endLoc":154,"id":10665,"name":"seed","nodeType":"Attribute","startLoc":154,"text":"self.seed"},{"col":0,"comment":"null","endLoc":300,"header":"@function_helper\ndef nan_to_num(x, copy=True, nan=0.0, posinf=None, neginf=None)","id":10666,"name":"nan_to_num","nodeType":"Function","startLoc":291,"text":"@function_helper\ndef nan_to_num(x, copy=True, nan=0.0, posinf=None, neginf=None):\n    nan = x._to_own_unit(nan)\n    if posinf is not None:\n        posinf = x._to_own_unit(posinf)\n    if neginf is not None:\n        neginf = x._to_own_unit(neginf)\n    return ((x.view(np.ndarray),),\n            dict(copy=True, nan=nan, posinf=posinf, neginf=neginf),\n            x.unit, None)"},{"attributeType":"null","col":8,"comment":"null","endLoc":159,"id":10667,"name":"startstate","nodeType":"Attribute","startLoc":159,"text":"self.startstate"},{"col":0,"comment":"Convert argument to a Quantity (or raise NotImplementedError).","endLoc":311,"header":"def _as_quantity(a)","id":10668,"name":"_as_quantity","nodeType":"Function","startLoc":303,"text":"def _as_quantity(a):\n    \"\"\"Convert argument to a Quantity (or raise NotImplementedError).\"\"\"\n    from astropy.units import Quantity\n\n    try:\n        return Quantity(a, copy=False, subok=True)\n    except Exception:\n        # If we cannot convert to Quantity, we should just bail.\n        raise NotImplementedError"},{"className":"JsonCustomEncoder","col":0,"comment":"Support for data types that JSON default encoder\n    does not do.\n\n    This includes:\n\n        * Numpy array or number\n        * Complex number\n        * Set\n        * Bytes\n        * astropy.UnitBase\n        * astropy.Quantity\n\n    Examples\n    --------\n    >>> import json\n    >>> import numpy as np\n    >>> from astropy.utils.misc import JsonCustomEncoder\n    >>> json.dumps(np.arange(3), cls=JsonCustomEncoder)\n    '[0, 1, 2]'\n\n    ","endLoc":410,"id":10669,"nodeType":"Class","startLoc":368,"text":"class JsonCustomEncoder(json.JSONEncoder):\n    \"\"\"Support for data types that JSON default encoder\n    does not do.\n\n    This includes:\n\n        * Numpy array or number\n        * Complex number\n        * Set\n        * Bytes\n        * astropy.UnitBase\n        * astropy.Quantity\n\n    Examples\n    --------\n    >>> import json\n    >>> import numpy as np\n    >>> from astropy.utils.misc import JsonCustomEncoder\n    >>> json.dumps(np.arange(3), cls=JsonCustomEncoder)\n    '[0, 1, 2]'\n\n    \"\"\"\n\n    def default(self, obj):\n        from astropy import units as u\n        import numpy as np\n        if isinstance(obj, u.Quantity):\n            return dict(value=obj.value, unit=obj.unit.to_string())\n        if isinstance(obj, (np.number, np.ndarray)):\n            return obj.tolist()\n        elif isinstance(obj, complex):\n            return [obj.real, obj.imag]\n        elif isinstance(obj, set):\n            return list(obj)\n        elif isinstance(obj, bytes):  # pragma: py3\n            return obj.decode()\n        elif isinstance(obj, (u.UnitBase, u.FunctionUnitBase)):\n            if obj == u.dimensionless_unscaled:\n                obj = 'dimensionless_unit'\n            else:\n                return obj.to_string()\n\n        return json.JSONEncoder.default(self, obj)"},{"col":4,"comment":"null","endLoc":410,"header":"def default(self, obj)","id":10670,"name":"default","nodeType":"Function","startLoc":391,"text":"def default(self, obj):\n        from astropy import units as u\n        import numpy as np\n        if isinstance(obj, u.Quantity):\n            return dict(value=obj.value, unit=obj.unit.to_string())\n        if isinstance(obj, (np.number, np.ndarray)):\n            return obj.tolist()\n        elif isinstance(obj, complex):\n            return [obj.real, obj.imag]\n        elif isinstance(obj, set):\n            return list(obj)\n        elif isinstance(obj, bytes):  # pragma: py3\n            return obj.decode()\n        elif isinstance(obj, (u.UnitBase, u.FunctionUnitBase)):\n            if obj == u.dimensionless_unscaled:\n                obj = 'dimensionless_unit'\n            else:\n                return obj.to_string()\n\n        return json.JSONEncoder.default(self, obj)"},{"col":0,"comment":"Download multiple files in parallel from the given URLs.\n\n    Blocks until all files have downloaded.  The result is a list of\n    local file paths corresponding to the given urls.\n\n    The results will be stored in the cache under the values in ``urls`` even\n    if they are obtained from some other location via ``sources``. See\n    `~download_file` for details.\n\n    Parameters\n    ----------\n    urls : list of str\n        The URLs to retrieve.\n\n    cache : bool or \"update\", optional\n        Whether to use the cache (default is `True`). If \"update\",\n        always download the remote URLs to see if new data is available\n        and store the result in cache.\n\n        .. versionchanged:: 4.0\n            The default was changed to ``\"update\"`` and setting it to\n            ``False`` will print a Warning and set it to ``\"update\"`` again,\n            because the function will not work properly without cache. Using\n            ``True`` will work as expected.\n\n        .. versionchanged:: 3.0\n            The default was changed to ``True`` and setting it to ``False``\n            will print a Warning and set it to ``True`` again, because the\n            function will not work properly without cache.\n\n    show_progress : bool, optional\n        Whether to display a progress bar during the download (default\n        is `True`)\n\n    timeout : float, optional\n        Timeout for each individual requests in seconds (default is the\n        configurable `astropy.utils.data.Conf.remote_timeout`).\n\n    sources : dict, optional\n        If provided, for each URL a list of URLs to try to obtain the\n        file from. The result will be stored under the original URL.\n        For any URL in this dictionary, the original URL will *not* be\n        tried unless it is in this list; this is to prevent long waits\n        for a primary server that is known to be inaccessible at the\n        moment.\n\n    multiprocessing_start_method : str, optional\n        Useful primarily for testing; if in doubt leave it as the default.\n        When using multiprocessing, certain anomalies occur when starting\n        processes with the \"spawn\" method (the only option on Windows);\n        other anomalies occur with the \"fork\" method (the default on\n        Linux).\n\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    Returns\n    -------\n    paths : list of str\n        The local file paths corresponding to the downloaded URLs.\n\n    Notes\n    -----\n    If a URL is unreachable, the downloading will grind to a halt and the\n    exception will propagate upward, but an unpredictable number of\n    files will have been successfully downloaded and will remain in\n    the cache.\n    ","endLoc":1587,"header":"def download_files_in_parallel(urls,\n                               cache=\"update\",\n                               show_progress=True,\n                               timeout=None,\n                               sources=None,\n                               multiprocessing_start_method=None,\n                               pkgname='astropy')","id":10671,"name":"download_files_in_parallel","nodeType":"Function","startLoc":1466,"text":"def download_files_in_parallel(urls,\n                               cache=\"update\",\n                               show_progress=True,\n                               timeout=None,\n                               sources=None,\n                               multiprocessing_start_method=None,\n                               pkgname='astropy'):\n    \"\"\"Download multiple files in parallel from the given URLs.\n\n    Blocks until all files have downloaded.  The result is a list of\n    local file paths corresponding to the given urls.\n\n    The results will be stored in the cache under the values in ``urls`` even\n    if they are obtained from some other location via ``sources``. See\n    `~download_file` for details.\n\n    Parameters\n    ----------\n    urls : list of str\n        The URLs to retrieve.\n\n    cache : bool or \"update\", optional\n        Whether to use the cache (default is `True`). If \"update\",\n        always download the remote URLs to see if new data is available\n        and store the result in cache.\n\n        .. versionchanged:: 4.0\n            The default was changed to ``\"update\"`` and setting it to\n            ``False`` will print a Warning and set it to ``\"update\"`` again,\n            because the function will not work properly without cache. Using\n            ``True`` will work as expected.\n\n        .. versionchanged:: 3.0\n            The default was changed to ``True`` and setting it to ``False``\n            will print a Warning and set it to ``True`` again, because the\n            function will not work properly without cache.\n\n    show_progress : bool, optional\n        Whether to display a progress bar during the download (default\n        is `True`)\n\n    timeout : float, optional\n        Timeout for each individual requests in seconds (default is the\n        configurable `astropy.utils.data.Conf.remote_timeout`).\n\n    sources : dict, optional\n        If provided, for each URL a list of URLs to try to obtain the\n        file from. The result will be stored under the original URL.\n        For any URL in this dictionary, the original URL will *not* be\n        tried unless it is in this list; this is to prevent long waits\n        for a primary server that is known to be inaccessible at the\n        moment.\n\n    multiprocessing_start_method : str, optional\n        Useful primarily for testing; if in doubt leave it as the default.\n        When using multiprocessing, certain anomalies occur when starting\n        processes with the \"spawn\" method (the only option on Windows);\n        other anomalies occur with the \"fork\" method (the default on\n        Linux).\n\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    Returns\n    -------\n    paths : list of str\n        The local file paths corresponding to the downloaded URLs.\n\n    Notes\n    -----\n    If a URL is unreachable, the downloading will grind to a halt and the\n    exception will propagate upward, but an unpredictable number of\n    files will have been successfully downloaded and will remain in\n    the cache.\n    \"\"\"\n    from .console import ProgressBar\n\n    if timeout is None:\n        timeout = conf.remote_timeout\n    if sources is None:\n        sources = {}\n\n    if not cache:\n        # See issue #6662, on windows won't work because the files are removed\n        # again before they can be used. On *NIX systems it will behave as if\n        # cache was set to True because multiprocessing cannot insert the items\n        # in the list of to-be-removed files. This could be fixed, but really,\n        # just use the cache, with update_cache if appropriate.\n        warn('Disabling the cache does not work because of multiprocessing, '\n             'it will be set to ``\"update\"``. You may need to manually remove '\n             'the cached files with clear_download_cache() afterwards.',\n             AstropyWarning)\n        cache = \"update\"\n\n    if show_progress:\n        progress = sys.stdout\n    else:\n        progress = io.BytesIO()\n\n    # Combine duplicate URLs\n    combined_urls = list(set(urls))\n    combined_paths = ProgressBar.map(\n        _do_download_files_in_parallel,\n        [dict(remote_url=u,\n              cache=cache,\n              show_progress=False,\n              timeout=timeout,\n              sources=sources.get(u, None),\n              pkgname=pkgname,\n              temp_cache=astropy.config.paths.set_temp_cache._temp_path,\n              temp_config=astropy.config.paths.set_temp_config._temp_path)\n         for u in combined_urls],\n        file=progress,\n        multiprocess=True,\n        multiprocessing_start_method=multiprocessing_start_method,\n    )\n    paths = []\n    for url in urls:\n        paths.append(combined_paths[combined_urls.index(url)])\n    return paths"},{"col":0,"comment":"Convert to arrays in units of the first argument that has a unit.\n\n    If unit_from_first, take the unit of the first argument regardless\n    whether it actually defined a unit (e.g., dimensionless for arrays).\n    ","endLoc":361,"header":"def _quantities2arrays(*args, unit_from_first=False)","id":10672,"name":"_quantities2arrays","nodeType":"Function","startLoc":326,"text":"def _quantities2arrays(*args, unit_from_first=False):\n    \"\"\"Convert to arrays in units of the first argument that has a unit.\n\n    If unit_from_first, take the unit of the first argument regardless\n    whether it actually defined a unit (e.g., dimensionless for arrays).\n    \"\"\"\n\n    # Turn first argument into a quantity.\n    q = _as_quantity(args[0])\n    if len(args) == 1:\n        return (q.value,), q.unit\n\n    # If we care about the unit being explicit, then check whether this\n    # argument actually had a unit, or was likely inferred.\n    if not unit_from_first and (q.unit is q._default_unit\n                                and not hasattr(args[0], 'unit')):\n        # Here, the argument could still be things like [10*u.one, 11.*u.one]),\n        # i.e., properly dimensionless.  So, we only override with anything\n        # that has a unit not equivalent to dimensionless (fine to ignore other\n        # dimensionless units pass, even if explicitly given).\n        for arg in args[1:]:\n            trial = _as_quantity(arg)\n            if not trial.unit.is_equivalent(q.unit):\n                # Use any explicit unit not equivalent to dimensionless.\n                q = trial\n                break\n\n    # We use the private _to_own_unit method here instead of just\n    # converting everything to quantity and then do .to_value(qs0.unit)\n    # as we want to allow arbitrary unit for 0, inf, and nan.\n    try:\n        arrays = tuple((q._to_own_unit(arg)) for arg in args)\n    except TypeError:\n        raise NotImplementedError\n\n    return arrays, q.unit"},{"col":0,"comment":"null","endLoc":1616,"header":"@atexit.register\ndef _deltemps()","id":10673,"name":"_deltemps","nodeType":"Function","startLoc":1595,"text":"@atexit.register\ndef _deltemps():\n\n    global _tempfilestodel\n\n    if _tempfilestodel is not None:\n        while len(_tempfilestodel) > 0:\n            fn = _tempfilestodel.pop()\n            if os.path.isfile(fn):\n                try:\n                    os.remove(fn)\n                except OSError:\n                    # oh well we tried\n                    # could be held open by some process, on Windows\n                    pass\n            elif os.path.isdir(fn):\n                try:\n                    shutil.rmtree(fn)\n                except OSError:\n                    # couldn't get rid of it, sorry\n                    # could be held open by some process, on Windows\n                    pass"},{"col":0,"comment":"Convert arguments to Quantity, and treat possible 'out'.","endLoc":377,"header":"def _iterable_helper(*args, out=None, **kwargs)","id":10674,"name":"_iterable_helper","nodeType":"Function","startLoc":364,"text":"def _iterable_helper(*args, out=None, **kwargs):\n    \"\"\"Convert arguments to Quantity, and treat possible 'out'.\"\"\"\n    from astropy.units import Quantity\n\n    if out is not None:\n        if isinstance(out, Quantity):\n            kwargs['out'] = out.view(np.ndarray)\n        else:\n            # TODO: for an ndarray output, we could in principle\n            # try converting all Quantity to dimensionless.\n            raise NotImplementedError\n\n    arrays, unit = _quantities2arrays(*args)\n    return arrays, kwargs, unit, out"},{"col":0,"comment":"null","endLoc":385,"header":"@function_helper\ndef concatenate(arrays, axis=0, out=None)","id":10675,"name":"concatenate","nodeType":"Function","startLoc":380,"text":"@function_helper\ndef concatenate(arrays, axis=0, out=None):\n    # TODO: make this smarter by creating an appropriately shaped\n    # empty output array and just filling it.\n    arrays, kwargs, unit, out = _iterable_helper(*arrays, out=out, axis=axis)\n    return (arrays,), kwargs, unit, out"},{"col":0,"comment":"null","endLoc":411,"header":"@dispatched_function\ndef block(arrays)","id":10676,"name":"block","nodeType":"Function","startLoc":388,"text":"@dispatched_function\ndef block(arrays):\n    # We need to override block since the numpy implementation can take two\n    # different paths, one for concatenation, one for creating a large empty\n    # result array in which parts are set.  Each assumes array input and\n    # cannot be used directly.  Since it would be very costly to inspect all\n    # arrays and then turn them back into a nested list, we just copy here the\n    # second implementation, np.core.shape_base._block_slicing, since it is\n    # shortest and easiest.\n    (arrays, list_ndim, result_ndim,\n     final_size) = np.core.shape_base._block_setup(arrays)\n    shape, slices, arrays = np.core.shape_base._block_info_recursion(\n        arrays, list_ndim, result_ndim)\n    # Here, one line of difference!\n    arrays, unit = _quantities2arrays(*arrays)\n    # Back to _block_slicing\n    dtype = np.result_type(*[arr.dtype for arr in arrays])\n    F_order = all(arr.flags['F_CONTIGUOUS'] for arr in arrays)\n    C_order = all(arr.flags['C_CONTIGUOUS'] for arr in arrays)\n    order = 'F' if F_order and not C_order else 'C'\n    result = np.empty(shape=shape, dtype=dtype, order=order)\n    for the_slice, arr in zip(slices, arrays):\n        result[(Ellipsis,) + the_slice] = arr\n    return result, unit, None"},{"attributeType":"null","col":8,"comment":"null","endLoc":466,"id":10677,"name":"_func","nodeType":"Attribute","startLoc":466,"text":"self._func"},{"className":"ProgressBar","col":0,"comment":"\n    A class to display a progress bar in the terminal.\n\n    It is designed to be used either with the ``with`` statement::\n\n        with ProgressBar(len(items)) as bar:\n            for item in enumerate(items):\n                bar.update()\n\n    or as a generator::\n\n        for item in ProgressBar(items):\n            item.process()\n    ","endLoc":821,"id":10678,"nodeType":"Class","startLoc":473,"text":"class ProgressBar:\n    \"\"\"\n    A class to display a progress bar in the terminal.\n\n    It is designed to be used either with the ``with`` statement::\n\n        with ProgressBar(len(items)) as bar:\n            for item in enumerate(items):\n                bar.update()\n\n    or as a generator::\n\n        for item in ProgressBar(items):\n            item.process()\n    \"\"\"\n\n    def __init__(self, total_or_items, ipython_widget=False, file=None):\n        \"\"\"\n        Parameters\n        ----------\n        total_or_items : int or sequence\n            If an int, the number of increments in the process being\n            tracked.  If a sequence, the items to iterate over.\n\n        ipython_widget : bool, optional\n            If `True`, the progress bar will display as an IPython\n            notebook widget.\n\n        file : writable file-like, optional\n            The file to write the progress bar to.  Defaults to\n            `sys.stdout`.  If ``file`` is not a tty (as determined by\n            calling its `isatty` member, if any, or special case hacks\n            to detect the IPython console), the progress bar will be\n            completely silent.\n        \"\"\"\n        if file is None:\n            file = _get_stdout()\n\n        if not ipython_widget and not isatty(file):\n            self.update = self._silent_update\n            self._silent = True\n        else:\n            self._silent = False\n\n        if isiterable(total_or_items):\n            self._items = iter(total_or_items)\n            self._total = len(total_or_items)\n        else:\n            try:\n                self._total = int(total_or_items)\n            except TypeError:\n                raise TypeError(\"First argument must be int or sequence\")\n            else:\n                self._items = iter(range(self._total))\n\n        self._file = file\n        self._start_time = time.time()\n        self._human_total = human_file_size(self._total)\n        self._ipython_widget = ipython_widget\n\n        self._signal_set = False\n        if not ipython_widget:\n            self._should_handle_resize = (\n                _CAN_RESIZE_TERMINAL and self._file.isatty())\n            self._handle_resize()\n            if self._should_handle_resize:\n                signal.signal(signal.SIGWINCH, self._handle_resize)\n                self._signal_set = True\n\n        self.update(0)\n\n    def _handle_resize(self, signum=None, frame=None):\n        terminal_width = terminal_size(self._file)[1]\n        self._bar_length = terminal_width - 37\n\n    def __enter__(self):\n        return self\n\n    def __exit__(self, exc_type, exc_value, traceback):\n        if not self._silent:\n            if exc_type is None:\n                self.update(self._total)\n            self._file.write('\\n')\n            self._file.flush()\n            if self._signal_set:\n                signal.signal(signal.SIGWINCH, signal.SIG_DFL)\n\n    def __iter__(self):\n        return self\n\n    def __next__(self):\n        try:\n            rv = next(self._items)\n        except StopIteration:\n            self.__exit__(None, None, None)\n            raise\n        else:\n            self.update()\n            return rv\n\n    def update(self, value=None):\n        \"\"\"\n        Update progress bar via the console or notebook accordingly.\n        \"\"\"\n\n        # Update self.value\n        if value is None:\n            value = self._current_value + 1\n        self._current_value = value\n\n        # Choose the appropriate environment\n        if self._ipython_widget:\n            self._update_ipython_widget(value)\n        else:\n            self._update_console(value)\n\n    def _update_console(self, value=None):\n        \"\"\"\n        Update the progress bar to the given value (out of the total\n        given to the constructor).\n        \"\"\"\n\n        if self._total == 0:\n            frac = 1.0\n        else:\n            frac = float(value) / float(self._total)\n\n        file = self._file\n        write = file.write\n\n        if frac > 1:\n            bar_fill = int(self._bar_length)\n        else:\n            bar_fill = int(float(self._bar_length) * frac)\n        write('\\r|')\n        color_print('=' * bar_fill, 'blue', file=file, end='')\n        if bar_fill < self._bar_length:\n            color_print('>', 'green', file=file, end='')\n            write('-' * (self._bar_length - bar_fill - 1))\n        write('|')\n\n        if value >= self._total:\n            t = time.time() - self._start_time\n            prefix = '     '\n        elif value <= 0:\n            t = None\n            prefix = ''\n        else:\n            t = ((time.time() - self._start_time) * (1.0 - frac)) / frac\n            prefix = ' ETA '\n        write(f' {human_file_size(value):>4s}/{self._human_total:>4s}')\n        write(f' ({frac:>6.2%})')\n        write(prefix)\n        if t is not None:\n            write(human_time(t))\n        self._file.flush()\n\n    def _update_ipython_widget(self, value=None):\n        \"\"\"\n        Update the progress bar to the given value (out of a total\n        given to the constructor).\n\n        This method is for use in the IPython notebook 2+.\n        \"\"\"\n\n        # Create and display an empty progress bar widget,\n        # if none exists.\n        if not hasattr(self, '_widget'):\n            # Import only if an IPython widget, i.e., widget in iPython NB\n            from IPython import version_info\n            if version_info[0] < 4:\n                from IPython.html import widgets\n                self._widget = widgets.FloatProgressWidget()\n            else:\n                _IPython.get_ipython()\n                from ipywidgets import widgets\n                self._widget = widgets.FloatProgress()\n            from IPython.display import display\n\n            display(self._widget)\n            self._widget.value = 0\n\n        # Calculate percent completion, and update progress bar\n        frac = (value/self._total)\n        self._widget.value = frac * 100\n        self._widget.description = f' ({frac:>6.2%})'\n\n    def _silent_update(self, value=None):\n        pass\n\n    @classmethod\n    def map(cls, function, items, multiprocess=False, file=None, step=100,\n            ipython_widget=False, multiprocessing_start_method=None):\n        \"\"\"Map function over items while displaying a progress bar with percentage complete.\n\n        The map operation may run in arbitrary order on the items, but the results are\n        returned in sequential order.\n\n        ::\n\n            def work(i):\n                print(i)\n\n            ProgressBar.map(work, range(50))\n\n        Parameters\n        ----------\n        function : function\n            Function to call for each step\n\n        items : sequence\n            Sequence where each element is a tuple of arguments to pass to\n            *function*.\n\n        multiprocess : bool, int, optional\n            If `True`, use the `multiprocessing` module to distribute each task\n            to a different processor core. If a number greater than 1, then use\n            that number of cores.\n\n        ipython_widget : bool, optional\n            If `True`, the progress bar will display as an IPython\n            notebook widget.\n\n        file : writable file-like, optional\n            The file to write the progress bar to.  Defaults to\n            `sys.stdout`.  If ``file`` is not a tty (as determined by\n            calling its `isatty` member, if any), the scrollbar will\n            be completely silent.\n\n        step : int, optional\n            Update the progress bar at least every *step* steps (default: 100).\n            If ``multiprocess`` is `True`, this will affect the size\n            of the chunks of ``items`` that are submitted as separate tasks\n            to the process pool.  A large step size may make the job\n            complete faster if ``items`` is very long.\n\n        multiprocessing_start_method : str, optional\n            Useful primarily for testing; if in doubt leave it as the default.\n            When using multiprocessing, certain anomalies occur when starting\n            processes with the \"spawn\" method (the only option on Windows);\n            other anomalies occur with the \"fork\" method (the default on\n            Linux).\n        \"\"\"\n\n        if multiprocess:\n            function = _mapfunc(function)\n            items = list(enumerate(items))\n\n        results = cls.map_unordered(\n            function, items, multiprocess=multiprocess,\n            file=file, step=step,\n            ipython_widget=ipython_widget,\n            multiprocessing_start_method=multiprocessing_start_method)\n\n        if multiprocess:\n            _, results = zip(*sorted(results))\n            results = list(results)\n\n        return results\n\n    @classmethod\n    def map_unordered(cls, function, items, multiprocess=False, file=None,\n                      step=100, ipython_widget=False,\n                      multiprocessing_start_method=None):\n        \"\"\"Map function over items, reporting the progress.\n\n        Does a `map` operation while displaying a progress bar with\n        percentage complete. The map operation may run on arbitrary order\n        on the items, and the results may be returned in arbitrary order.\n\n        ::\n\n            def work(i):\n                print(i)\n\n            ProgressBar.map(work, range(50))\n\n        Parameters\n        ----------\n        function : function\n            Function to call for each step\n\n        items : sequence\n            Sequence where each element is a tuple of arguments to pass to\n            *function*.\n\n        multiprocess : bool, int, optional\n            If `True`, use the `multiprocessing` module to distribute each task\n            to a different processor core. If a number greater than 1, then use\n            that number of cores.\n\n        ipython_widget : bool, optional\n            If `True`, the progress bar will display as an IPython\n            notebook widget.\n\n        file : writable file-like, optional\n            The file to write the progress bar to.  Defaults to\n            `sys.stdout`.  If ``file`` is not a tty (as determined by\n            calling its `isatty` member, if any), the scrollbar will\n            be completely silent.\n\n        step : int, optional\n            Update the progress bar at least every *step* steps (default: 100).\n            If ``multiprocess`` is `True`, this will affect the size\n            of the chunks of ``items`` that are submitted as separate tasks\n            to the process pool.  A large step size may make the job\n            complete faster if ``items`` is very long.\n\n        multiprocessing_start_method : str, optional\n            Useful primarily for testing; if in doubt leave it as the default.\n            When using multiprocessing, certain anomalies occur when starting\n            processes with the \"spawn\" method (the only option on Windows);\n            other anomalies occur with the \"fork\" method (the default on\n            Linux).\n        \"\"\"\n\n        results = []\n\n        if file is None:\n            file = _get_stdout()\n\n        with cls(len(items), ipython_widget=ipython_widget, file=file) as bar:\n            if bar._ipython_widget:\n                chunksize = step\n            else:\n                default_step = max(int(float(len(items)) / bar._bar_length), 1)\n                chunksize = min(default_step, step)\n            if not multiprocess or multiprocess < 1:\n                for i, item in enumerate(items):\n                    results.append(function(item))\n                    if (i % chunksize) == 0:\n                        bar.update(i)\n            else:\n                ctx = multiprocessing.get_context(multiprocessing_start_method)\n                kwargs = dict(mp_context=ctx)\n\n                with ProcessPoolExecutor(\n                        max_workers=(int(multiprocess)\n                                     if multiprocess is not True\n                                     else None),\n                        **kwargs) as p:\n                    for i, f in enumerate(\n                            as_completed(\n                                p.submit(function, item)\n                                for item in items)):\n                        bar.update(i)\n                        results.append(f.result())\n\n        return results"},{"col":4,"comment":"null","endLoc":549,"header":"def __enter__(self)","id":10679,"name":"__enter__","nodeType":"Function","startLoc":548,"text":"def __enter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":558,"header":"def __exit__(self, exc_type, exc_value, traceback)","id":10680,"name":"__exit__","nodeType":"Function","startLoc":551,"text":"def __exit__(self, exc_type, exc_value, traceback):\n        if not self._silent:\n            if exc_type is None:\n                self.update(self._total)\n            self._file.write('\\n')\n            self._file.flush()\n            if self._signal_set:\n                signal.signal(signal.SIGWINCH, signal.SIG_DFL)"},{"col":0,"comment":"null","endLoc":417,"header":"@function_helper\ndef choose(a, choices, out=None, **kwargs)","id":10681,"name":"choose","nodeType":"Function","startLoc":414,"text":"@function_helper\ndef choose(a, choices, out=None, **kwargs):\n    choices, kwargs, unit, out = _iterable_helper(*choices, out=out, **kwargs)\n    return (a, choices,), kwargs, unit, out"},{"col":0,"comment":"null","endLoc":425,"header":"@function_helper\ndef select(condlist, choicelist, default=0)","id":10682,"name":"select","nodeType":"Function","startLoc":420,"text":"@function_helper\ndef select(condlist, choicelist, default=0):\n    choicelist, kwargs, unit, out = _iterable_helper(*choicelist)\n    if default != 0:\n        default = (1 * unit)._to_own_unit(default)\n    return (condlist, choicelist, default), kwargs, unit, out"},{"col":0,"comment":"Do a consistency check on the cache.\n\n    .. note::\n\n        Since v5.0, this function no longer returns anything.\n\n    Because the cache is shared by all versions of ``astropy`` in all virtualenvs\n    run by your user, possibly concurrently, it could accumulate problems.\n    This could lead to hard-to-debug problems or wasted space. This function\n    detects a number of incorrect conditions, including nonexistent files that\n    are indexed, files that are indexed but in the wrong place, and, if you\n    request it, files whose content does not match the hash that is indexed.\n\n    This function also returns a list of non-indexed files. A few will be\n    associated with the shelve object; their exact names depend on the backend\n    used but will probably be based on ``urlmap``. The presence of other files\n    probably indicates that something has gone wrong and inaccessible files\n    have accumulated in the cache. These can be removed with\n    :func:`clear_download_cache`, either passing the filename returned here, or\n    with no arguments to empty the entire cache and return it to a\n    reasonable, if empty, state.\n\n    Parameters\n    ----------\n    pkgname : str, optional\n        The package name to use to locate the download cache, i.e., for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    Raises\n    ------\n    `~astropy.utils.data.CacheDamaged`\n        To indicate a problem with the cache contents; the exception contains\n        a ``.bad_files`` attribute containing a set of filenames to allow the\n        user to use :func:`clear_download_cache` to remove the offending items.\n    OSError, RuntimeError\n        To indicate some problem with the cache structure. This may need a full\n        :func:`clear_download_cache` to resolve, or may indicate some kind of\n        misconfiguration.\n    ","endLoc":1837,"header":"def check_download_cache(pkgname='astropy')","id":10683,"name":"check_download_cache","nodeType":"Function","startLoc":1754,"text":"def check_download_cache(pkgname='astropy'):\n    \"\"\"Do a consistency check on the cache.\n\n    .. note::\n\n        Since v5.0, this function no longer returns anything.\n\n    Because the cache is shared by all versions of ``astropy`` in all virtualenvs\n    run by your user, possibly concurrently, it could accumulate problems.\n    This could lead to hard-to-debug problems or wasted space. This function\n    detects a number of incorrect conditions, including nonexistent files that\n    are indexed, files that are indexed but in the wrong place, and, if you\n    request it, files whose content does not match the hash that is indexed.\n\n    This function also returns a list of non-indexed files. A few will be\n    associated with the shelve object; their exact names depend on the backend\n    used but will probably be based on ``urlmap``. The presence of other files\n    probably indicates that something has gone wrong and inaccessible files\n    have accumulated in the cache. These can be removed with\n    :func:`clear_download_cache`, either passing the filename returned here, or\n    with no arguments to empty the entire cache and return it to a\n    reasonable, if empty, state.\n\n    Parameters\n    ----------\n    pkgname : str, optional\n        The package name to use to locate the download cache, i.e., for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    Raises\n    ------\n    `~astropy.utils.data.CacheDamaged`\n        To indicate a problem with the cache contents; the exception contains\n        a ``.bad_files`` attribute containing a set of filenames to allow the\n        user to use :func:`clear_download_cache` to remove the offending items.\n    OSError, RuntimeError\n        To indicate some problem with the cache structure. This may need a full\n        :func:`clear_download_cache` to resolve, or may indicate some kind of\n        misconfiguration.\n    \"\"\"\n    bad_files = set()\n    messages = set()\n    dldir = _get_download_cache_loc(pkgname=pkgname)\n    with os.scandir(dldir) as it:\n        for entry in it:\n            f = os.path.abspath(os.path.join(dldir, entry.name))\n            if entry.name.startswith(\"rmtree-\"):\n                if f not in _tempfilestodel:\n                    bad_files.add(f)\n                    messages.add(f\"Cache entry {entry.name} not scheduled for deletion\")\n            elif entry.is_dir():\n                for sf in os.listdir(f):\n                    if sf in ['url', 'contents']:\n                        continue\n                    sf = os.path.join(f, sf)\n                    bad_files.add(sf)\n                    messages.add(f\"Unexpected file f{sf}\")\n                urlf = os.path.join(f, \"url\")\n                url = None\n                if not os.path.isfile(urlf):\n                    bad_files.add(urlf)\n                    messages.add(f\"Problem with URL file f{urlf}\")\n                else:\n                    url = get_file_contents(urlf, encoding=\"utf-8\")\n                    if not _is_url(url):\n                        bad_files.add(f)\n                        messages.add(f\"Malformed URL: {url}\")\n                    else:\n                        hashname = _url_to_dirname(url)\n                        if entry.name != hashname:\n                            bad_files.add(f)\n                            messages.add(f\"URL hashes to {hashname} but is stored in {entry.name}\")\n                if not os.path.isfile(os.path.join(f, \"contents\")):\n                    bad_files.add(f)\n                    if url is None:\n                        messages.add(f\"Hash {entry.name} is missing contents\")\n                    else:\n                        messages.add(f\"URL {url} with hash {entry.name} is missing contents\")\n            else:\n                bad_files.add(f)\n                messages.add(f\"Left-over non-directory {f} in cache\")\n    if bad_files:\n        raise CacheDamaged(\"\\n\".join(messages), bad_files=bad_files)"},{"col":0,"comment":"null","endLoc":473,"header":"@dispatched_function\ndef piecewise(x, condlist, funclist, *args, **kw)","id":10684,"name":"piecewise","nodeType":"Function","startLoc":428,"text":"@dispatched_function\ndef piecewise(x, condlist, funclist, *args, **kw):\n    from astropy.units import Quantity\n\n    # Copied implementation from numpy.lib.function_base.piecewise,\n    # taking care of units of function outputs.\n    n2 = len(funclist)\n    # undocumented: single condition is promoted to a list of one condition\n    if np.isscalar(condlist) or (\n            not isinstance(condlist[0], (list, np.ndarray)) and x.ndim != 0):\n        condlist = [condlist]\n\n    if any(isinstance(c, Quantity) for c in condlist):\n        raise NotImplementedError\n\n    condlist = np.array(condlist, dtype=bool)\n    n = len(condlist)\n\n    if n == n2 - 1:  # compute the \"otherwise\" condition.\n        condelse = ~np.any(condlist, axis=0, keepdims=True)\n        condlist = np.concatenate([condlist, condelse], axis=0)\n        n += 1\n    elif n != n2:\n        raise ValueError(\n            f\"with {n} condition(s), either {n} or {n + 1} functions are expected\"\n        )\n\n    y = np.zeros(x.shape, x.dtype)\n    where = []\n    what = []\n    for k in range(n):\n        item = funclist[k]\n        if not callable(item):\n            where.append(condlist[k])\n            what.append(item)\n        else:\n            vals = x[condlist[k]]\n            if vals.size > 0:\n                where.append(condlist[k])\n                what.append(item(vals, *args, **kw))\n\n    what, unit = _quantities2arrays(*what)\n    for item, value in zip(where, what):\n        y[item] = value\n\n    return y, unit, None"},{"col":0,"comment":"null","endLoc":243,"header":"def helper_apio(f, unit_sp, unit_theta, unit_elong, unit_phi, unit_hm,\n                unit_xp, unit_yp, unit_refa, unit_refb)","id":10685,"name":"helper_apio","nodeType":"Function","startLoc":232,"text":"def helper_apio(f, unit_sp, unit_theta, unit_elong, unit_phi, unit_hm,\n                unit_xp, unit_yp, unit_refa, unit_refb):\n    from astropy.units.si import radian, m\n    return [get_converter(unit_sp, radian),\n            get_converter(unit_theta, radian),\n            get_converter(unit_elong, radian),\n            get_converter(unit_phi, radian),\n            get_converter(unit_hm, m),\n            get_converter(unit_xp, radian),\n            get_converter(unit_xp, radian),\n            get_converter(unit_xp, radian),\n            get_converter(unit_xp, radian)], astrom_unit()"},{"col":0,"comment":"null","endLoc":479,"header":"@function_helper\ndef append(arr, values, *args, **kwargs)","id":10686,"name":"append","nodeType":"Function","startLoc":476,"text":"@function_helper\ndef append(arr, values, *args, **kwargs):\n    arrays, unit = _quantities2arrays(arr, values, unit_from_first=True)\n    return arrays + args, kwargs, unit, None"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":10687,"name":"__all__","nodeType":"Attribute","startLoc":16,"text":"__all__"},{"attributeType":"null","col":0,"comment":"\nRegular expression used my make_func which limits the allowed argument\nnames for the created function.  Only valid Python variable names in\nthe ASCII range and not beginning with '_' are allowed, currently.\n","endLoc":19,"id":10688,"name":"_ARGNAME_RE","nodeType":"Attribute","startLoc":19,"text":"_ARGNAME_RE"},{"col":0,"comment":"","endLoc":3,"header":"codegen.py#<anonymous>","id":10689,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"Utilities for generating new Python code at runtime.\"\"\"\n\n__all__ = ['make_function_with_signature']\n\n_ARGNAME_RE = re.compile(r'^[A-Za-z][A-Za-z_]*')\n\n\"\"\"\nRegular expression used my make_func which limits the allowed argument\nnames for the created function.  Only valid Python variable names in\nthe ASCII range and not beginning with '_' are allowed, currently.\n\"\"\""},{"col":0,"comment":"null","endLoc":491,"header":"@function_helper\ndef insert(arr, obj, values, *args, **kwargs)","id":10690,"name":"insert","nodeType":"Function","startLoc":482,"text":"@function_helper\ndef insert(arr, obj, values, *args, **kwargs):\n    from astropy.units import Quantity\n\n    if isinstance(obj, Quantity):\n        raise NotImplementedError\n\n    (arr, values), unit = _quantities2arrays(arr, values,\n                                             unit_from_first=True)\n    return (arr, obj, values) + args, kwargs, unit, None"},{"col":0,"comment":"null","endLoc":511,"header":"@function_helper\ndef pad(array, pad_width, mode='constant', **kwargs)","id":10691,"name":"pad","nodeType":"Function","startLoc":494,"text":"@function_helper\ndef pad(array, pad_width, mode='constant', **kwargs):\n    # pad dispatches only on array, so that must be a Quantity.\n    for key in 'constant_values', 'end_values':\n        value = kwargs.pop(key, None)\n        if value is None:\n            continue\n        if not isinstance(value, tuple):\n            value = (value,)\n\n        new_value = []\n        for v in value:\n            new_value.append(\n                tuple(array._to_own_unit(_v) for _v in v)\n                if isinstance(v, tuple) else array._to_own_unit(v))\n        kwargs[key] = new_value\n\n    return (array.view(np.ndarray), pad_width, mode), kwargs, array.unit, None"},{"fileName":"shapes.py","filePath":"astropy/utils","id":10692,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"The ShapedLikeNDArray mixin class and shape-related functions.\"\"\"\n\nimport abc\nfrom itertools import zip_longest\n\nimport numpy as np\n\n__all__ = ['NDArrayShapeMethods', 'ShapedLikeNDArray',\n           'check_broadcast', 'IncompatibleShapeError', 'unbroadcast']\n\n\nclass NDArrayShapeMethods:\n    \"\"\"Mixin class to provide shape-changing methods.\n\n    The class proper is assumed to have some underlying data, which are arrays\n    or array-like structures. It must define a ``shape`` property, which gives\n    the shape of those data, as well as an ``_apply`` method that creates a new\n    instance in which a `~numpy.ndarray` method has been applied to those.\n\n    Furthermore, for consistency with `~numpy.ndarray`, it is recommended to\n    define a setter for the ``shape`` property, which, like the\n    `~numpy.ndarray.shape` property allows in-place reshaping the internal data\n    (and, unlike the ``reshape`` method raises an exception if this is not\n    possible).\n\n    This class only provides the shape-changing methods and is meant in\n    particular for `~numpy.ndarray` subclasses that need to keep track of\n    other arrays.  For other classes, `~astropy.utils.shapes.ShapedLikeNDArray`\n    is recommended.\n\n    \"\"\"\n\n    # Note to developers: if new methods are added here, be sure to check that\n    # they work properly with the classes that use this, such as Time and\n    # BaseRepresentation, i.e., look at their ``_apply`` methods and add\n    # relevant tests.  This is particularly important for methods that imply\n    # copies rather than views of data (see the special-case treatment of\n    # 'flatten' in Time).\n\n    def __getitem__(self, item):\n        return self._apply('__getitem__', item)\n\n    def copy(self, *args, **kwargs):\n        \"\"\"Return an instance containing copies of the internal data.\n\n        Parameters are as for :meth:`~numpy.ndarray.copy`.\n        \"\"\"\n        return self._apply('copy', *args, **kwargs)\n\n    def reshape(self, *args, **kwargs):\n        \"\"\"Returns an instance containing the same data with a new shape.\n\n        Parameters are as for :meth:`~numpy.ndarray.reshape`.  Note that it is\n        not always possible to change the shape of an array without copying the\n        data (see :func:`~numpy.reshape` documentation). If you want an error\n        to be raise if the data is copied, you should assign the new shape to\n        the shape attribute (note: this may not be implemented for all classes\n        using ``NDArrayShapeMethods``).\n        \"\"\"\n        return self._apply('reshape', *args, **kwargs)\n\n    def ravel(self, *args, **kwargs):\n        \"\"\"Return an instance with the array collapsed into one dimension.\n\n        Parameters are as for :meth:`~numpy.ndarray.ravel`. Note that it is\n        not always possible to unravel an array without copying the data.\n        If you want an error to be raise if the data is copied, you should\n        should assign shape ``(-1,)`` to the shape attribute.\n        \"\"\"\n        return self._apply('ravel', *args, **kwargs)\n\n    def flatten(self, *args, **kwargs):\n        \"\"\"Return a copy with the array collapsed into one dimension.\n\n        Parameters are as for :meth:`~numpy.ndarray.flatten`.\n        \"\"\"\n        return self._apply('flatten', *args, **kwargs)\n\n    def transpose(self, *args, **kwargs):\n        \"\"\"Return an instance with the data transposed.\n\n        Parameters are as for :meth:`~numpy.ndarray.transpose`.  All internal\n        data are views of the data of the original.\n        \"\"\"\n        return self._apply('transpose', *args, **kwargs)\n\n    @property\n    def T(self):\n        \"\"\"Return an instance with the data transposed.\n\n        Parameters are as for :attr:`~numpy.ndarray.T`.  All internal\n        data are views of the data of the original.\n        \"\"\"\n        if self.ndim < 2:\n            return self\n        else:\n            return self.transpose()\n\n    def swapaxes(self, *args, **kwargs):\n        \"\"\"Return an instance with the given axes interchanged.\n\n        Parameters are as for :meth:`~numpy.ndarray.swapaxes`:\n        ``axis1, axis2``.  All internal data are views of the data of the\n        original.\n        \"\"\"\n        return self._apply('swapaxes', *args, **kwargs)\n\n    def diagonal(self, *args, **kwargs):\n        \"\"\"Return an instance with the specified diagonals.\n\n        Parameters are as for :meth:`~numpy.ndarray.diagonal`.  All internal\n        data are views of the data of the original.\n        \"\"\"\n        return self._apply('diagonal', *args, **kwargs)\n\n    def squeeze(self, *args, **kwargs):\n        \"\"\"Return an instance with single-dimensional shape entries removed\n\n        Parameters are as for :meth:`~numpy.ndarray.squeeze`.  All internal\n        data are views of the data of the original.\n        \"\"\"\n        return self._apply('squeeze', *args, **kwargs)\n\n    def take(self, indices, axis=None, out=None, mode='raise'):\n        \"\"\"Return a new instance formed from the elements at the given indices.\n\n        Parameters are as for :meth:`~numpy.ndarray.take`, except that,\n        obviously, no output array can be given.\n        \"\"\"\n        if out is not None:\n            return NotImplementedError(\"cannot pass 'out' argument to 'take.\")\n\n        return self._apply('take', indices, axis=axis, mode=mode)\n\n\nclass ShapedLikeNDArray(NDArrayShapeMethods, metaclass=abc.ABCMeta):\n    \"\"\"Mixin class to provide shape-changing methods.\n\n    The class proper is assumed to have some underlying data, which are arrays\n    or array-like structures. It must define a ``shape`` property, which gives\n    the shape of those data, as well as an ``_apply`` method that creates a new\n    instance in which a `~numpy.ndarray` method has been applied to those.\n\n    Furthermore, for consistency with `~numpy.ndarray`, it is recommended to\n    define a setter for the ``shape`` property, which, like the\n    `~numpy.ndarray.shape` property allows in-place reshaping the internal data\n    (and, unlike the ``reshape`` method raises an exception if this is not\n    possible).\n\n    This class also defines default implementations for ``ndim`` and ``size``\n    properties, calculating those from the ``shape``.  These can be overridden\n    by subclasses if there are faster ways to obtain those numbers.\n\n    \"\"\"\n\n    # Note to developers: if new methods are added here, be sure to check that\n    # they work properly with the classes that use this, such as Time and\n    # BaseRepresentation, i.e., look at their ``_apply`` methods and add\n    # relevant tests.  This is particularly important for methods that imply\n    # copies rather than views of data (see the special-case treatment of\n    # 'flatten' in Time).\n\n    @property\n    @abc.abstractmethod\n    def shape(self):\n        \"\"\"The shape of the underlying data.\"\"\"\n\n    @abc.abstractmethod\n    def _apply(method, *args, **kwargs):\n        \"\"\"Create a new instance, with ``method`` applied to underlying data.\n\n        The method is any of the shape-changing methods for `~numpy.ndarray`\n        (``reshape``, ``swapaxes``, etc.), as well as those picking particular\n        elements (``__getitem__``, ``take``, etc.). It will be applied to the\n        underlying arrays (e.g., ``jd1`` and ``jd2`` in `~astropy.time.Time`),\n        with the results used to create a new instance.\n\n        Parameters\n        ----------\n        method : str\n            Method to be applied to the instance's internal data arrays.\n        args : tuple\n            Any positional arguments for ``method``.\n        kwargs : dict\n            Any keyword arguments for ``method``.\n\n        \"\"\"\n\n    @property\n    def ndim(self):\n        \"\"\"The number of dimensions of the instance and underlying arrays.\"\"\"\n        return len(self.shape)\n\n    @property\n    def size(self):\n        \"\"\"The size of the object, as calculated from its shape.\"\"\"\n        size = 1\n        for sh in self.shape:\n            size *= sh\n        return size\n\n    @property\n    def isscalar(self):\n        return self.shape == ()\n\n    def __len__(self):\n        if self.isscalar:\n            raise TypeError(\"Scalar {!r} object has no len()\"\n                            .format(self.__class__.__name__))\n        return self.shape[0]\n\n    def __bool__(self):\n        \"\"\"Any instance should evaluate to True, except when it is empty.\"\"\"\n        return self.size > 0\n\n    def __getitem__(self, item):\n        try:\n            return self._apply('__getitem__', item)\n        except IndexError:\n            if self.isscalar:\n                raise TypeError('scalar {!r} object is not subscriptable.'\n                                .format(self.__class__.__name__))\n            else:\n                raise\n\n    def __iter__(self):\n        if self.isscalar:\n            raise TypeError('scalar {!r} object is not iterable.'\n                            .format(self.__class__.__name__))\n\n        # We cannot just write a generator here, since then the above error\n        # would only be raised once we try to use the iterator, rather than\n        # upon its definition using iter(self).\n        def self_iter():\n            for idx in range(len(self)):\n                yield self[idx]\n\n        return self_iter()\n\n    # Functions that change shape or essentially do indexing.\n    _APPLICABLE_FUNCTIONS = {\n        np.moveaxis, np.rollaxis,\n        np.atleast_1d, np.atleast_2d, np.atleast_3d, np.expand_dims,\n        np.broadcast_to, np.flip, np.fliplr, np.flipud, np.rot90,\n        np.roll, np.delete,\n        }\n\n    # Functions that themselves defer to a method. Those are all\n    # defined in np.core.fromnumeric, but exclude alen as well as\n    # sort and partition, which make copies before calling the method.\n    _METHOD_FUNCTIONS = {getattr(np, name):\n                         {'amax': 'max', 'amin': 'min', 'around': 'round',\n                          'round_': 'round', 'alltrue': 'all',\n                          'sometrue': 'any'}.get(name, name)\n                         for name in np.core.fromnumeric.__all__\n                         if name not in ['alen', 'sort', 'partition']}\n    # Add np.copy, which we may as well let defer to our method.\n    _METHOD_FUNCTIONS[np.copy] = 'copy'\n\n    # Could be made to work with a bit of effort:\n    # np.where, np.compress, np.extract,\n    # np.diag_indices_from, np.triu_indices_from, np.tril_indices_from\n    # np.tile, np.repeat (need .repeat method)\n    # TODO: create a proper implementation.\n    # Furthermore, some arithmetic functions such as np.mean, np.median,\n    # could work for Time, and many more for TimeDelta, so those should\n    # override __array_function__.\n    def __array_function__(self, function, types, args, kwargs):\n        \"\"\"Wrap numpy functions that make sense.\"\"\"\n        if function in self._APPLICABLE_FUNCTIONS:\n            if function is np.broadcast_to:\n                # Ensure that any ndarray subclasses used are\n                # properly propagated.\n                kwargs.setdefault('subok', True)\n            elif (function in {np.atleast_1d,\n                               np.atleast_2d,\n                               np.atleast_3d}\n                  and len(args) > 1):\n                return tuple(function(arg, **kwargs) for arg in args)\n\n            if self is not args[0]:\n                return NotImplemented\n\n            return self._apply(function, *args[1:], **kwargs)\n\n        # For functions that defer to methods, use the corresponding\n        # method/attribute if we have it.  Otherwise, fall through.\n        if self is args[0] and function in self._METHOD_FUNCTIONS:\n            method = getattr(self, self._METHOD_FUNCTIONS[function], None)\n            if method is not None:\n                if callable(method):\n                    return method(*args[1:], **kwargs)\n                else:\n                    # For np.shape, etc., just return the attribute.\n                    return method\n\n        # Fall-back, just pass the arguments on since perhaps the function\n        # works already (see above).\n        return function.__wrapped__(*args, **kwargs)\n\n\nclass IncompatibleShapeError(ValueError):\n    def __init__(self, shape_a, shape_a_idx, shape_b, shape_b_idx):\n        super().__init__(shape_a, shape_a_idx, shape_b, shape_b_idx)\n\n\ndef check_broadcast(*shapes):\n    \"\"\"\n    Determines whether two or more Numpy arrays can be broadcast with each\n    other based on their shape tuple alone.\n\n    Parameters\n    ----------\n    *shapes : tuple\n        All shapes to include in the comparison.  If only one shape is given it\n        is passed through unmodified.  If no shapes are given returns an empty\n        `tuple`.\n\n    Returns\n    -------\n    broadcast : `tuple`\n        If all shapes are mutually broadcastable, returns a tuple of the full\n        broadcast shape.\n    \"\"\"\n\n    if len(shapes) == 0:\n        return ()\n    elif len(shapes) == 1:\n        return shapes[0]\n\n    reversed_shapes = (reversed(shape) for shape in shapes)\n\n    full_shape = []\n\n    for dims in zip_longest(*reversed_shapes, fillvalue=1):\n        max_dim = 1\n        max_dim_idx = None\n        for idx, dim in enumerate(dims):\n            if dim == 1:\n                continue\n\n            if max_dim == 1:\n                # The first dimension of size greater than 1\n                max_dim = dim\n                max_dim_idx = idx\n            elif dim != max_dim:\n                raise IncompatibleShapeError(\n                    shapes[max_dim_idx], max_dim_idx, shapes[idx], idx)\n\n        full_shape.append(max_dim)\n\n    return tuple(full_shape[::-1])\n\n\ndef unbroadcast(array):\n    \"\"\"\n    Given an array, return a new array that is the smallest subset of the\n    original array that can be re-broadcasted back to the original array.\n\n    See https://stackoverflow.com/questions/40845769/un-broadcasting-numpy-arrays\n    for more details.\n    \"\"\"\n\n    if array.ndim == 0:\n        return array\n\n    array = array[tuple((slice(0, 1) if stride == 0 else slice(None))\n                        for stride in array.strides)]\n\n    # Remove leading ones, which are not needed in numpy broadcasting.\n    first_not_unity = next((i for (i, s) in enumerate(array.shape) if s > 1),\n                           array.ndim)\n\n    return array.reshape(array.shape[first_not_unity:])\n"},{"className":"IncompatibleShapeError","col":0,"comment":"null","endLoc":305,"id":10693,"nodeType":"Class","startLoc":303,"text":"class IncompatibleShapeError(ValueError):\n    def __init__(self, shape_a, shape_a_idx, shape_b, shape_b_idx):\n        super().__init__(shape_a, shape_a_idx, shape_b, shape_b_idx)"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":10694,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"col":0,"comment":"","endLoc":2,"header":"shapes.py#<anonymous>","id":10695,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"The ShapedLikeNDArray mixin class and shape-related functions.\"\"\"\n\n__all__ = ['NDArrayShapeMethods', 'ShapedLikeNDArray',\n           'check_broadcast', 'IncompatibleShapeError', 'unbroadcast']"},{"fileName":"__init__.py","filePath":"astropy/utils","id":10696,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis subpackage contains developer-oriented utilities used by Astropy.\n\nPublic functions and classes in this subpackage are safe to be used by other\npackages, but this subpackage is for utilities that are primarily of use for\ndevelopers or to implement python hacks.\n\nThis subpackage also includes the ``astropy.utils.compat`` package,\nwhich houses utilities that provide compatibility and bugfixes across\nall versions of Python that Astropy supports. However, the content of this\nmodule is solely for internal use of ``astropy`` and subject to changes\nwithout deprecations. Do not use it in external packages or code.\n\n\"\"\"\n\nfrom .codegen import *  # noqa\nfrom .decorators import *  # noqa\nfrom .introspection import *  # noqa\nfrom .misc import *  # noqa\nfrom .shapes import *  # noqa\n"},{"col":0,"comment":"","endLoc":15,"header":"__init__.py#<anonymous>","id":10697,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis subpackage contains developer-oriented utilities used by Astropy.\n\nPublic functions and classes in this subpackage are safe to be used by other\npackages, but this subpackage is for utilities that are primarily of use for\ndevelopers or to implement python hacks.\n\nThis subpackage also includes the ``astropy.utils.compat`` package,\nwhich houses utilities that provide compatibility and bugfixes across\nall versions of Python that Astropy supports. However, the content of this\nmodule is solely for internal use of ``astropy`` and subject to changes\nwithout deprecations. Do not use it in external packages or code.\n\n\"\"\""},{"fileName":"introspection.py","filePath":"astropy/utils","id":10698,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"Functions related to Python runtime introspection.\"\"\"\n\nimport collections\nimport inspect\nimport os\nimport sys\nimport types\nimport importlib\nfrom importlib import metadata\nfrom packaging.version import Version\n\nfrom astropy.utils.decorators import deprecated_renamed_argument\n\n__all__ = ['resolve_name', 'minversion', 'find_current_module',\n           'isinstancemethod']\n\n__doctest_skip__ = ['find_current_module']\n\nif sys.version_info[:2] >= (3, 10):\n    from importlib.metadata import packages_distributions\nelse:\n    def packages_distributions():\n        \"\"\"\n        Return a mapping of top-level packages to their distributions.\n        Note: copied from https://github.com/python/importlib_metadata/pull/287\n        \"\"\"\n        pkg_to_dist = collections.defaultdict(list)\n        for dist in metadata.distributions():\n            for pkg in (dist.read_text('top_level.txt') or '').split():\n                pkg_to_dist[pkg].append(dist.metadata['Name'])\n        return dict(pkg_to_dist)\n\n\ndef resolve_name(name, *additional_parts):\n    \"\"\"Resolve a name like ``module.object`` to an object and return it.\n\n    This ends up working like ``from module import object`` but is easier\n    to deal with than the `__import__` builtin and supports digging into\n    submodules.\n\n    Parameters\n    ----------\n\n    name : `str`\n        A dotted path to a Python object--that is, the name of a function,\n        class, or other object in a module with the full path to that module,\n        including parent modules, separated by dots.  Also known as the fully\n        qualified name of the object.\n\n    additional_parts : iterable, optional\n        If more than one positional arguments are given, those arguments are\n        automatically dotted together with ``name``.\n\n    Examples\n    --------\n\n    >>> resolve_name('astropy.utils.introspection.resolve_name')\n    <function resolve_name at 0x...>\n    >>> resolve_name('astropy', 'utils', 'introspection', 'resolve_name')\n    <function resolve_name at 0x...>\n\n    Raises\n    ------\n    `ImportError`\n        If the module or named object is not found.\n    \"\"\"\n\n    additional_parts = '.'.join(additional_parts)\n\n    if additional_parts:\n        name = name + '.' + additional_parts\n\n    parts = name.split('.')\n\n    if len(parts) == 1:\n        # No dots in the name--just a straight up module import\n        cursor = 1\n        fromlist = []\n    else:\n        cursor = len(parts) - 1\n        fromlist = [parts[-1]]\n\n    module_name = parts[:cursor]\n\n    while cursor > 0:\n        try:\n            ret = __import__('.'.join(module_name), fromlist=fromlist)\n            break\n        except ImportError:\n            if cursor == 0:\n                raise\n            cursor -= 1\n            module_name = parts[:cursor]\n            fromlist = [parts[cursor]]\n            ret = ''\n\n    for part in parts[cursor:]:\n        try:\n            ret = getattr(ret, part)\n        except AttributeError:\n            raise ImportError(name)\n\n    return ret\n\n\n@deprecated_renamed_argument('version_path', None, '5.0')\ndef minversion(module, version, inclusive=True, version_path='__version__'):\n    \"\"\"\n    Returns `True` if the specified Python module satisfies a minimum version\n    requirement, and `False` if not.\n\n    .. deprecated::\n        ``version_path`` is not used anymore and is deprecated in\n        ``astropy`` 5.0.\n\n    Parameters\n    ----------\n    module : module or `str`\n        An imported module of which to check the version, or the name of\n        that module (in which case an import of that module is attempted--\n        if this fails `False` is returned).\n\n    version : `str`\n        The version as a string that this module must have at a minimum (e.g.\n        ``'0.12'``).\n\n    inclusive : `bool`\n        The specified version meets the requirement inclusively (i.e. ``>=``)\n        as opposed to strictly greater than (default: `True`).\n\n    Examples\n    --------\n\n    >>> import astropy\n    >>> minversion(astropy, '0.4.4')\n    True\n    \"\"\"\n    if isinstance(module, types.ModuleType):\n        module_name = module.__name__\n        module_version = getattr(module, '__version__', None)\n    elif isinstance(module, str):\n        module_name = module\n        module_version = None\n        try:\n            module = resolve_name(module_name)\n        except ImportError:\n            return False\n    else:\n        raise ValueError('module argument must be an actual imported '\n                         'module, or the import name of the module; '\n                         f'got {repr(module)}')\n\n    if module_version is None:\n        try:\n            module_version = metadata.version(module_name)\n        except metadata.PackageNotFoundError:\n            # Maybe the distribution name is different from package name.\n            # Calling packages_distributions is costly so we do it only\n            # if necessary, as only a few packages don't have the same\n            # distribution name.\n            dist_names = packages_distributions()\n            module_version = metadata.version(dist_names[module_name][0])\n\n    if inclusive:\n        return Version(module_version) >= Version(version)\n    else:\n        return Version(module_version) > Version(version)\n\n\ndef find_current_module(depth=1, finddiff=False):\n    \"\"\"\n    Determines the module/package from which this function is called.\n\n    This function has two modes, determined by the ``finddiff`` option. it\n    will either simply go the requested number of frames up the call\n    stack (if ``finddiff`` is False), or it will go up the call stack until\n    it reaches a module that is *not* in a specified set.\n\n    Parameters\n    ----------\n    depth : int\n        Specifies how far back to go in the call stack (0-indexed, so that\n        passing in 0 gives back `astropy.utils.misc`).\n    finddiff : bool or list\n        If False, the returned ``mod`` will just be ``depth`` frames up from\n        the current frame. Otherwise, the function will start at a frame\n        ``depth`` up from current, and continue up the call stack to the\n        first module that is *different* from those in the provided list.\n        In this case, ``finddiff`` can be a list of modules or modules\n        names. Alternatively, it can be True, which will use the module\n        ``depth`` call stack frames up as the module the returned module\n        most be different from.\n\n    Returns\n    -------\n    mod : module or None\n        The module object or None if the package cannot be found. The name of\n        the module is available as the ``__name__`` attribute of the returned\n        object (if it isn't None).\n\n    Raises\n    ------\n    ValueError\n        If ``finddiff`` is a list with an invalid entry.\n\n    Examples\n    --------\n    The examples below assume that there are two modules in a package named\n    ``pkg``. ``mod1.py``::\n\n        def find1():\n            from astropy.utils import find_current_module\n            print find_current_module(1).__name__\n        def find2():\n            from astropy.utils import find_current_module\n            cmod = find_current_module(2)\n            if cmod is None:\n                print 'None'\n            else:\n                print cmod.__name__\n        def find_diff():\n            from astropy.utils import find_current_module\n            print find_current_module(0,True).__name__\n\n    ``mod2.py``::\n\n        def find():\n            from .mod1 import find2\n            find2()\n\n    With these modules in place, the following occurs::\n\n        >>> from pkg import mod1, mod2\n        >>> from astropy.utils import find_current_module\n        >>> mod1.find1()\n        pkg.mod1\n        >>> mod1.find2()\n        None\n        >>> mod2.find()\n        pkg.mod2\n        >>> find_current_module(0)\n        <module 'astropy.utils.misc' from 'astropy/utils/misc.py'>\n        >>> mod1.find_diff()\n        pkg.mod1\n\n    \"\"\"\n\n    frm = inspect.currentframe()\n    for i in range(depth):\n        frm = frm.f_back\n        if frm is None:\n            return None\n\n    if finddiff:\n        currmod = _get_module_from_frame(frm)\n        if finddiff is True:\n            diffmods = [currmod]\n        else:\n            diffmods = []\n            for fd in finddiff:\n                if inspect.ismodule(fd):\n                    diffmods.append(fd)\n                elif isinstance(fd, str):\n                    diffmods.append(importlib.import_module(fd))\n                elif fd is True:\n                    diffmods.append(currmod)\n                else:\n                    raise ValueError('invalid entry in finddiff')\n\n        while frm:\n            frmb = frm.f_back\n            modb = _get_module_from_frame(frmb)\n            if modb not in diffmods:\n                return modb\n            frm = frmb\n    else:\n        return _get_module_from_frame(frm)\n\n\ndef _get_module_from_frame(frm):\n    \"\"\"Uses inspect.getmodule() to get the module that the current frame's\n    code is running in.\n\n    However, this does not work reliably for code imported from a zip file,\n    so this provides a fallback mechanism for that case which is less\n    reliable in general, but more reliable than inspect.getmodule() for this\n    particular case.\n    \"\"\"\n\n    mod = inspect.getmodule(frm)\n    if mod is not None:\n        return mod\n\n    # Check to see if we're importing from a bundle file. First ensure that\n    # __file__ is available in globals; this is cheap to check to bail out\n    # immediately if this fails\n\n    if '__file__' in frm.f_globals and '__name__' in frm.f_globals:\n\n        filename = frm.f_globals['__file__']\n\n        # Using __file__ from the frame's globals and getting it into the form\n        # of an absolute path name with .py at the end works pretty well for\n        # looking up the module using the same means as inspect.getmodule\n\n        if filename[-4:].lower() in ('.pyc', '.pyo'):\n            filename = filename[:-4] + '.py'\n        filename = os.path.realpath(os.path.abspath(filename))\n        if filename in inspect.modulesbyfile:\n            return sys.modules.get(inspect.modulesbyfile[filename])\n\n        # On Windows, inspect.modulesbyfile appears to have filenames stored\n        # in lowercase, so we check for this case too.\n        if filename.lower() in inspect.modulesbyfile:\n            return sys.modules.get(inspect.modulesbyfile[filename.lower()])\n\n    # Otherwise there are still some even trickier things that might be possible\n    # to track down the module, but we'll leave those out unless we find a case\n    # where it's really necessary.  So return None if the module is not found.\n    return None\n\n\ndef find_mod_objs(modname, onlylocals=False):\n    \"\"\" Returns all the public attributes of a module referenced by name.\n\n    .. note::\n        The returned list *not* include subpackages or modules of\n        ``modname``, nor does it include private attributes (those that\n        begin with '_' or are not in `__all__`).\n\n    Parameters\n    ----------\n    modname : str\n        The name of the module to search.\n    onlylocals : bool or list of str\n        If `True`, only attributes that are either members of ``modname`` OR\n        one of its modules or subpackages will be included. If it is a list\n        of strings, those specify the possible packages that will be\n        considered \"local\".\n\n    Returns\n    -------\n    localnames : list of str\n        A list of the names of the attributes as they are named in the\n        module ``modname`` .\n    fqnames : list of str\n        A list of the full qualified names of the attributes (e.g.,\n        ``astropy.utils.introspection.find_mod_objs``). For attributes that are\n        simple variables, this is based on the local name, but for functions or\n        classes it can be different if they are actually defined elsewhere and\n        just referenced in ``modname``.\n    objs : list of objects\n        A list of the actual attributes themselves (in the same order as\n        the other arguments)\n\n    \"\"\"\n\n    mod = resolve_name(modname)\n\n    if hasattr(mod, '__all__'):\n        pkgitems = [(k, mod.__dict__[k]) for k in mod.__all__]\n    else:\n        pkgitems = [(k, mod.__dict__[k]) for k in dir(mod) if k[0] != '_']\n\n    # filter out modules and pull the names and objs out\n    ismodule = inspect.ismodule\n    localnames = [k for k, v in pkgitems if not ismodule(v)]\n    objs = [v for k, v in pkgitems if not ismodule(v)]\n\n    # fully qualified names can be determined from the object's module\n    fqnames = []\n    for obj, lnm in zip(objs, localnames):\n        if hasattr(obj, '__module__') and hasattr(obj, '__name__'):\n            fqnames.append(obj.__module__ + '.' + obj.__name__)\n        else:\n            fqnames.append(modname + '.' + lnm)\n\n    if onlylocals:\n        if onlylocals is True:\n            onlylocals = [modname]\n        valids = [any(fqn.startswith(nm) for nm in onlylocals) for fqn in fqnames]\n        localnames = [e for i, e in enumerate(localnames) if valids[i]]\n        fqnames = [e for i, e in enumerate(fqnames) if valids[i]]\n        objs = [e for i, e in enumerate(objs) if valids[i]]\n\n    return localnames, fqnames, objs\n\n\n# Note: I would have preferred call this is_instancemethod, but this naming is\n# for consistency with other functions in the `inspect` module\ndef isinstancemethod(cls, obj):\n    \"\"\"\n    Returns `True` if the given object is an instance method of the class\n    it is defined on (as opposed to a `staticmethod` or a `classmethod`).\n\n    This requires both the class the object is a member of as well as the\n    object itself in order to make this determination.\n\n    Parameters\n    ----------\n    cls : `type`\n        The class on which this method was defined.\n    obj : `object`\n        A member of the provided class (the membership is not checked directly,\n        but this function will always return `False` if the given object is not\n        a member of the given class).\n\n    Examples\n    --------\n    >>> class MetaClass(type):\n    ...     def a_classmethod(cls): pass\n    ...\n    >>> class MyClass(metaclass=MetaClass):\n    ...     def an_instancemethod(self): pass\n    ...\n    ...     @classmethod\n    ...     def another_classmethod(cls): pass\n    ...\n    ...     @staticmethod\n    ...     def a_staticmethod(): pass\n    ...\n    >>> isinstancemethod(MyClass, MyClass.a_classmethod)\n    False\n    >>> isinstancemethod(MyClass, MyClass.another_classmethod)\n    False\n    >>> isinstancemethod(MyClass, MyClass.a_staticmethod)\n    False\n    >>> isinstancemethod(MyClass, MyClass.an_instancemethod)\n    True\n    \"\"\"\n\n    return _isinstancemethod(cls, obj)\n\n\ndef _isinstancemethod(cls, obj):\n    if not isinstance(obj, types.FunctionType):\n        return False\n\n    # Unfortunately it seems the easiest way to get to the original\n    # staticmethod object is to look in the class's __dict__, though we\n    # also need to look up the MRO in case the method is not in the given\n    # class's dict\n    name = obj.__name__\n    for basecls in cls.mro():  # This includes cls\n        if name in basecls.__dict__:\n            return not isinstance(basecls.__dict__[name], staticmethod)\n\n    # This shouldn't happen, though this is the most sensible response if\n    # it does.\n    raise AttributeError(name)\n"},{"col":0,"comment":" Returns all the public attributes of a module referenced by name.\n\n    .. note::\n        The returned list *not* include subpackages or modules of\n        ``modname``, nor does it include private attributes (those that\n        begin with '_' or are not in `__all__`).\n\n    Parameters\n    ----------\n    modname : str\n        The name of the module to search.\n    onlylocals : bool or list of str\n        If `True`, only attributes that are either members of ``modname`` OR\n        one of its modules or subpackages will be included. If it is a list\n        of strings, those specify the possible packages that will be\n        considered \"local\".\n\n    Returns\n    -------\n    localnames : list of str\n        A list of the names of the attributes as they are named in the\n        module ``modname`` .\n    fqnames : list of str\n        A list of the full qualified names of the attributes (e.g.,\n        ``astropy.utils.introspection.find_mod_objs``). For attributes that are\n        simple variables, this is based on the local name, but for functions or\n        classes it can be different if they are actually defined elsewhere and\n        just referenced in ``modname``.\n    objs : list of objects\n        A list of the actual attributes themselves (in the same order as\n        the other arguments)\n\n    ","endLoc":388,"header":"def find_mod_objs(modname, onlylocals=False)","id":10699,"name":"find_mod_objs","nodeType":"Function","startLoc":325,"text":"def find_mod_objs(modname, onlylocals=False):\n    \"\"\" Returns all the public attributes of a module referenced by name.\n\n    .. note::\n        The returned list *not* include subpackages or modules of\n        ``modname``, nor does it include private attributes (those that\n        begin with '_' or are not in `__all__`).\n\n    Parameters\n    ----------\n    modname : str\n        The name of the module to search.\n    onlylocals : bool or list of str\n        If `True`, only attributes that are either members of ``modname`` OR\n        one of its modules or subpackages will be included. If it is a list\n        of strings, those specify the possible packages that will be\n        considered \"local\".\n\n    Returns\n    -------\n    localnames : list of str\n        A list of the names of the attributes as they are named in the\n        module ``modname`` .\n    fqnames : list of str\n        A list of the full qualified names of the attributes (e.g.,\n        ``astropy.utils.introspection.find_mod_objs``). For attributes that are\n        simple variables, this is based on the local name, but for functions or\n        classes it can be different if they are actually defined elsewhere and\n        just referenced in ``modname``.\n    objs : list of objects\n        A list of the actual attributes themselves (in the same order as\n        the other arguments)\n\n    \"\"\"\n\n    mod = resolve_name(modname)\n\n    if hasattr(mod, '__all__'):\n        pkgitems = [(k, mod.__dict__[k]) for k in mod.__all__]\n    else:\n        pkgitems = [(k, mod.__dict__[k]) for k in dir(mod) if k[0] != '_']\n\n    # filter out modules and pull the names and objs out\n    ismodule = inspect.ismodule\n    localnames = [k for k, v in pkgitems if not ismodule(v)]\n    objs = [v for k, v in pkgitems if not ismodule(v)]\n\n    # fully qualified names can be determined from the object's module\n    fqnames = []\n    for obj, lnm in zip(objs, localnames):\n        if hasattr(obj, '__module__') and hasattr(obj, '__name__'):\n            fqnames.append(obj.__module__ + '.' + obj.__name__)\n        else:\n            fqnames.append(modname + '.' + lnm)\n\n    if onlylocals:\n        if onlylocals is True:\n            onlylocals = [modname]\n        valids = [any(fqn.startswith(nm) for nm in onlylocals) for fqn in fqnames]\n        localnames = [e for i, e in enumerate(localnames) if valids[i]]\n        fqnames = [e for i, e in enumerate(fqnames) if valids[i]]\n        objs = [e for i, e in enumerate(objs) if valids[i]]\n\n    return localnames, fqnames, objs"},{"col":0,"comment":"null","endLoc":521,"header":"@function_helper\ndef where(condition, *args)","id":10700,"name":"where","nodeType":"Function","startLoc":514,"text":"@function_helper\ndef where(condition, *args):\n    from astropy.units import Quantity\n    if isinstance(condition, Quantity) or len(args) != 2:\n        raise NotImplementedError\n\n    args, unit = _quantities2arrays(*args)\n    return (condition,) + args, {}, unit, None"},{"col":0,"comment":"null","endLoc":538,"header":"@function_helper(helps=({np.quantile, np.nanquantile}))\ndef quantile(a, q, *args, _q_unit=dimensionless_unscaled, **kwargs)","id":10701,"name":"quantile","nodeType":"Function","startLoc":524,"text":"@function_helper(helps=({np.quantile, np.nanquantile}))\ndef quantile(a, q, *args, _q_unit=dimensionless_unscaled, **kwargs):\n    if len(args) >= 2:\n        out = args[1]\n        args = args[:1] + args[2:]\n    else:\n        out = kwargs.pop('out', None)\n\n    from astropy.units import Quantity\n    if isinstance(q, Quantity):\n        q = q.to_value(_q_unit)\n\n    (a,), kwargs, unit, out = _iterable_helper(a, out=out, **kwargs)\n\n    return (a, q) + args, kwargs, unit, out"},{"col":0,"comment":"null","endLoc":544,"header":"@function_helper(helps={np.percentile, np.nanpercentile})\ndef percentile(a, q, *args, **kwargs)","id":10702,"name":"percentile","nodeType":"Function","startLoc":541,"text":"@function_helper(helps={np.percentile, np.nanpercentile})\ndef percentile(a, q, *args, **kwargs):\n    from astropy.units import percent\n    return quantile(a, q, *args, _q_unit=percent, **kwargs)"},{"col":0,"comment":"null","endLoc":549,"header":"@function_helper\ndef count_nonzero(a, *args, **kwargs)","id":10703,"name":"count_nonzero","nodeType":"Function","startLoc":547,"text":"@function_helper\ndef count_nonzero(a, *args, **kwargs):\n    return (a.value,) + args, kwargs, None, None"},{"col":0,"comment":"null","endLoc":560,"header":"@function_helper(helps={np.isclose, np.allclose})\ndef close(a, b, rtol=1e-05, atol=1e-08, *args, **kwargs)","id":10704,"name":"close","nodeType":"Function","startLoc":552,"text":"@function_helper(helps={np.isclose, np.allclose})\ndef close(a, b, rtol=1e-05, atol=1e-08, *args, **kwargs):\n    from astropy.units import Quantity\n\n    (a, b), unit = _quantities2arrays(a, b, unit_from_first=True)\n    # Allow number without a unit as having the unit.\n    atol = Quantity(atol, unit).value\n\n    return (a, b, rtol, atol) + args, kwargs, None, None"},{"col":4,"comment":"null","endLoc":561,"header":"def __iter__(self)","id":10705,"name":"__iter__","nodeType":"Function","startLoc":560,"text":"def __iter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":571,"header":"def __next__(self)","id":10706,"name":"__next__","nodeType":"Function","startLoc":563,"text":"def __next__(self):\n        try:\n            rv = next(self._items)\n        except StopIteration:\n            self.__exit__(None, None, None)\n            raise\n        else:\n            self.update()\n            return rv"},{"className":"OrderedDescriptor","col":0,"comment":"\n    Base class for descriptors whose order in the class body should be\n    preserved.  Intended for use in concert with the\n    `OrderedDescriptorContainer` metaclass.\n\n    Subclasses of `OrderedDescriptor` must define a value for a class attribute\n    called ``_class_attribute_``.  This is the name of a class attribute on the\n    *container* class for these descriptors, which will be set to an\n    `~collections.OrderedDict` at class creation time.  This\n    `~collections.OrderedDict` will contain a mapping of all class attributes\n    that were assigned instances of the `OrderedDescriptor` subclass, to the\n    instances themselves.  See the documentation for\n    `OrderedDescriptorContainer` for a concrete example.\n\n    Optionally, subclasses of `OrderedDescriptor` may define a value for a\n    class attribute called ``_name_attribute_``.  This should be the name of\n    an attribute on instances of the subclass.  When specified, during\n    creation of a class containing these descriptors, the name attribute on\n    each instance will be set to the name of the class attribute it was\n    assigned to on the class.\n\n    .. note::\n\n        Although this class is intended for use with *descriptors* (i.e.\n        classes that define any of the ``__get__``, ``__set__``, or\n        ``__delete__`` magic methods), this base class is not itself a\n        descriptor, and technically this could be used for classes that are\n        not descriptors too.  However, use with descriptors is the original\n        intended purpose.\n    ","endLoc":594,"id":10707,"nodeType":"Class","startLoc":512,"text":"@deprecated('4.3', _ordered_descriptor_deprecation_message)\nclass OrderedDescriptor(metaclass=abc.ABCMeta):\n    \"\"\"\n    Base class for descriptors whose order in the class body should be\n    preserved.  Intended for use in concert with the\n    `OrderedDescriptorContainer` metaclass.\n\n    Subclasses of `OrderedDescriptor` must define a value for a class attribute\n    called ``_class_attribute_``.  This is the name of a class attribute on the\n    *container* class for these descriptors, which will be set to an\n    `~collections.OrderedDict` at class creation time.  This\n    `~collections.OrderedDict` will contain a mapping of all class attributes\n    that were assigned instances of the `OrderedDescriptor` subclass, to the\n    instances themselves.  See the documentation for\n    `OrderedDescriptorContainer` for a concrete example.\n\n    Optionally, subclasses of `OrderedDescriptor` may define a value for a\n    class attribute called ``_name_attribute_``.  This should be the name of\n    an attribute on instances of the subclass.  When specified, during\n    creation of a class containing these descriptors, the name attribute on\n    each instance will be set to the name of the class attribute it was\n    assigned to on the class.\n\n    .. note::\n\n        Although this class is intended for use with *descriptors* (i.e.\n        classes that define any of the ``__get__``, ``__set__``, or\n        ``__delete__`` magic methods), this base class is not itself a\n        descriptor, and technically this could be used for classes that are\n        not descriptors too.  However, use with descriptors is the original\n        intended purpose.\n    \"\"\"\n\n    # This id increments for each OrderedDescriptor instance created, so they\n    # are always ordered in the order they were created.  Class bodies are\n    # guaranteed to be executed from top to bottom.  Not sure if this is\n    # thread-safe though.\n    _nextid = 1\n\n    @property\n    @abc.abstractmethod\n    def _class_attribute_(self):\n        \"\"\"\n        Subclasses should define this attribute to the name of an attribute on\n        classes containing this subclass.  That attribute will contain the mapping\n        of all instances of that `OrderedDescriptor` subclass defined in the class\n        body.  If the same descriptor needs to be used with different classes,\n        each with different names of this attribute, multiple subclasses will be\n        needed.\n        \"\"\"\n\n    _name_attribute_ = None\n    \"\"\"\n    Subclasses may optionally define this attribute to specify the name of an\n    attribute on instances of the class that should be filled with the\n    instance's attribute name at class creation time.\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n        # The _nextid attribute is shared across all subclasses so that\n        # different subclasses of OrderedDescriptors can be sorted correctly\n        # between themselves\n        self.__order = OrderedDescriptor._nextid\n        OrderedDescriptor._nextid += 1\n        super().__init__()\n\n    def __lt__(self, other):\n        \"\"\"\n        Defined for convenient sorting of `OrderedDescriptor` instances, which\n        are defined to sort in their creation order.\n        \"\"\"\n\n        if (isinstance(self, OrderedDescriptor) and\n                isinstance(other, OrderedDescriptor)):\n            try:\n                return self.__order < other.__order\n            except AttributeError:\n                raise RuntimeError(\n                    'Could not determine ordering for {} and {}; at least '\n                    'one of them is not calling super().__init__ in its '\n                    '__init__.'.format(self, other))\n        else:\n            return NotImplemented"},{"col":4,"comment":"\n        Subclasses should define this attribute to the name of an attribute on\n        classes containing this subclass.  That attribute will contain the mapping\n        of all instances of that `OrderedDescriptor` subclass defined in the class\n        body.  If the same descriptor needs to be used with different classes,\n        each with different names of this attribute, multiple subclasses will be\n        needed.\n        ","endLoc":561,"header":"@property\n    @abc.abstractmethod\n    def _class_attribute_(self)","id":10708,"name":"_class_attribute_","nodeType":"Function","startLoc":551,"text":"@property\n    @abc.abstractmethod\n    def _class_attribute_(self):\n        \"\"\"\n        Subclasses should define this attribute to the name of an attribute on\n        classes containing this subclass.  That attribute will contain the mapping\n        of all instances of that `OrderedDescriptor` subclass defined in the class\n        body.  If the same descriptor needs to be used with different classes,\n        each with different names of this attribute, multiple subclasses will be\n        needed.\n        \"\"\""},{"col":4,"comment":"null","endLoc":576,"header":"def __init__(self, *args, **kwargs)","id":10709,"name":"__init__","nodeType":"Function","startLoc":570,"text":"def __init__(self, *args, **kwargs):\n        # The _nextid attribute is shared across all subclasses so that\n        # different subclasses of OrderedDescriptors can be sorted correctly\n        # between themselves\n        self.__order = OrderedDescriptor._nextid\n        OrderedDescriptor._nextid += 1\n        super().__init__()"},{"col":4,"comment":"\n        Defined for convenient sorting of `OrderedDescriptor` instances, which\n        are defined to sort in their creation order.\n        ","endLoc":594,"header":"def __lt__(self, other)","id":10710,"name":"__lt__","nodeType":"Function","startLoc":578,"text":"def __lt__(self, other):\n        \"\"\"\n        Defined for convenient sorting of `OrderedDescriptor` instances, which\n        are defined to sort in their creation order.\n        \"\"\"\n\n        if (isinstance(self, OrderedDescriptor) and\n                isinstance(other, OrderedDescriptor)):\n            try:\n                return self.__order < other.__order\n            except AttributeError:\n                raise RuntimeError(\n                    'Could not determine ordering for {} and {}; at least '\n                    'one of them is not calling super().__init__ in its '\n                    '__init__.'.format(self, other))\n        else:\n            return NotImplemented"},{"attributeType":"null","col":4,"comment":"null","endLoc":549,"id":10711,"name":"_nextid","nodeType":"Attribute","startLoc":549,"text":"_nextid"},{"col":4,"comment":"\n        Update progress bar via the console or notebook accordingly.\n        ","endLoc":587,"header":"def update(self, value=None)","id":10712,"name":"update","nodeType":"Function","startLoc":573,"text":"def update(self, value=None):\n        \"\"\"\n        Update progress bar via the console or notebook accordingly.\n        \"\"\"\n\n        # Update self.value\n        if value is None:\n            value = self._current_value + 1\n        self._current_value = value\n\n        # Choose the appropriate environment\n        if self._ipython_widget:\n            self._update_ipython_widget(value)\n        else:\n            self._update_console(value)"},{"col":0,"comment":"null","endLoc":566,"header":"@function_helper\ndef array_equal(a1, a2)","id":10713,"name":"array_equal","nodeType":"Function","startLoc":563,"text":"@function_helper\ndef array_equal(a1, a2):\n    args, unit = _quantities2arrays(a1, a2)\n    return args, {}, None, None"},{"attributeType":"None","col":4,"comment":"\n    Subclasses may optionally define this attribute to specify the name of an\n    attribute on instances of the class that should be filled with the\n    instance's attribute name at class creation time.\n    ","endLoc":563,"id":10714,"name":"_name_attribute_","nodeType":"Attribute","startLoc":563,"text":"_name_attribute_"},{"col":0,"comment":"null","endLoc":572,"header":"@function_helper\ndef array_equiv(a1, a2)","id":10715,"name":"array_equiv","nodeType":"Function","startLoc":569,"text":"@function_helper\ndef array_equiv(a1, a2):\n    args, unit = _quantities2arrays(a1, a2)\n    return args, {}, None, None"},{"col":0,"comment":"null","endLoc":586,"header":"@function_helper(helps={np.dot, np.outer})\ndef dot_like(a, b, out=None)","id":10716,"name":"dot_like","nodeType":"Function","startLoc":575,"text":"@function_helper(helps={np.dot, np.outer})\ndef dot_like(a, b, out=None):\n    from astropy.units import Quantity\n\n    a, b = _as_quantities(a, b)\n    unit = a.unit * b.unit\n    if out is not None:\n        if not isinstance(out, Quantity):\n            raise NotImplementedError\n        return tuple(x.view(np.ndarray) for x in (a, b, out)), {}, unit, out\n    else:\n        return (a.view(np.ndarray), b.view(np.ndarray)), {}, unit, None"},{"attributeType":"null","col":8,"comment":"null","endLoc":574,"id":10717,"name":"__order","nodeType":"Attribute","startLoc":574,"text":"self.__order"},{"className":"OrderedDescriptorContainer","col":0,"comment":"\n    Classes should use this metaclass if they wish to use `OrderedDescriptor`\n    attributes, which are class attributes that \"remember\" the order in which\n    they were defined in the class body.\n\n    Every subclass of `OrderedDescriptor` has an attribute called\n    ``_class_attribute_``.  For example, if we have\n\n    .. code:: python\n\n        class ExampleDecorator(OrderedDescriptor):\n            _class_attribute_ = '_examples_'\n\n    Then when a class with the `OrderedDescriptorContainer` metaclass is\n    created, it will automatically be assigned a class attribute ``_examples_``\n    referencing an `~collections.OrderedDict` containing all instances of\n    ``ExampleDecorator`` defined in the class body, mapped to by the names of\n    the attributes they were assigned to.\n\n    When subclassing a class with this metaclass, the descriptor dict (i.e.\n    ``_examples_`` in the above example) will *not* contain descriptors\n    inherited from the base class.  That is, this only works by default with\n    decorators explicitly defined in the class body.  However, the subclass\n    *may* define an attribute ``_inherit_decorators_`` which lists\n    `OrderedDescriptor` classes that *should* be added from base classes.\n    See the examples section below for an example of this.\n\n    Examples\n    --------\n\n    >>> from astropy.utils import OrderedDescriptor, OrderedDescriptorContainer\n    >>> class TypedAttribute(OrderedDescriptor):\n    ...     \"\"\"\n    ...     Attributes that may only be assigned objects of a specific type,\n    ...     or subclasses thereof.  For some reason we care about their order.\n    ...     \"\"\"\n    ...\n    ...     _class_attribute_ = 'typed_attributes'\n    ...     _name_attribute_ = 'name'\n    ...     # A default name so that instances not attached to a class can\n    ...     # still be repr'd; useful for debugging\n    ...     name = '<unbound>'\n    ...\n    ...     def __init__(self, type):\n    ...         # Make sure not to forget to call the super __init__\n    ...         super().__init__()\n    ...         self.type = type\n    ...\n    ...     def __get__(self, obj, objtype=None):\n    ...         if obj is None:\n    ...             return self\n    ...         if self.name in obj.__dict__:\n    ...             return obj.__dict__[self.name]\n    ...         else:\n    ...             raise AttributeError(self.name)\n    ...\n    ...     def __set__(self, obj, value):\n    ...         if not isinstance(value, self.type):\n    ...             raise ValueError('{0}.{1} must be of type {2!r}'.format(\n    ...                 obj.__class__.__name__, self.name, self.type))\n    ...         obj.__dict__[self.name] = value\n    ...\n    ...     def __delete__(self, obj):\n    ...         if self.name in obj.__dict__:\n    ...             del obj.__dict__[self.name]\n    ...         else:\n    ...             raise AttributeError(self.name)\n    ...\n    ...     def __repr__(self):\n    ...         if isinstance(self.type, tuple) and len(self.type) > 1:\n    ...             typestr = '({0})'.format(\n    ...                 ', '.join(t.__name__ for t in self.type))\n    ...         else:\n    ...             typestr = self.type.__name__\n    ...         return '<{0}(name={1}, type={2})>'.format(\n    ...                 self.__class__.__name__, self.name, typestr)\n    ...\n\n    Now let's create an example class that uses this ``TypedAttribute``::\n\n        >>> class Point2D(metaclass=OrderedDescriptorContainer):\n        ...     x = TypedAttribute((float, int))\n        ...     y = TypedAttribute((float, int))\n        ...\n        ...     def __init__(self, x, y):\n        ...         self.x, self.y = x, y\n        ...\n        >>> p1 = Point2D(1.0, 2.0)\n        >>> p1.x\n        1.0\n        >>> p1.y\n        2.0\n        >>> p2 = Point2D('a', 'b')  # doctest: +IGNORE_EXCEPTION_DETAIL\n        Traceback (most recent call last):\n            ...\n        ValueError: Point2D.x must be of type (float, int>)\n\n    We see that ``TypedAttribute`` works more or less as advertised, but\n    there's nothing special about that.  Let's see what\n    `OrderedDescriptorContainer` did for us::\n\n        >>> Point2D.typed_attributes\n        OrderedDict([('x', <TypedAttribute(name=x, type=(float, int))>),\n        ('y', <TypedAttribute(name=y, type=(float, int))>)])\n\n    If we create a subclass, it does *not* by default add inherited descriptors\n    to ``typed_attributes``::\n\n        >>> class Point3D(Point2D):\n        ...     z = TypedAttribute((float, int))\n        ...\n        >>> Point3D.typed_attributes\n        OrderedDict([('z', <TypedAttribute(name=z, type=(float, int))>)])\n\n    However, if we specify ``_inherit_descriptors_`` from ``Point2D`` then\n    it will do so::\n\n        >>> class Point3D(Point2D):\n        ...     _inherit_descriptors_ = (TypedAttribute,)\n        ...     z = TypedAttribute((float, int))\n        ...\n        >>> Point3D.typed_attributes\n        OrderedDict([('x', <TypedAttribute(name=x, type=(float, int))>),\n        ('y', <TypedAttribute(name=y, type=(float, int))>),\n        ('z', <TypedAttribute(name=z, type=(float, int))>)])\n\n    .. note::\n\n        Hopefully it is clear from these examples that this construction\n        also allows a class of type `OrderedDescriptorContainer` to use\n        multiple different `OrderedDescriptor` classes simultaneously.\n    ","endLoc":795,"id":10718,"nodeType":"Class","startLoc":597,"text":"@deprecated('4.3', _ordered_descriptor_deprecation_message)\nclass OrderedDescriptorContainer(type):\n    \"\"\"\n    Classes should use this metaclass if they wish to use `OrderedDescriptor`\n    attributes, which are class attributes that \"remember\" the order in which\n    they were defined in the class body.\n\n    Every subclass of `OrderedDescriptor` has an attribute called\n    ``_class_attribute_``.  For example, if we have\n\n    .. code:: python\n\n        class ExampleDecorator(OrderedDescriptor):\n            _class_attribute_ = '_examples_'\n\n    Then when a class with the `OrderedDescriptorContainer` metaclass is\n    created, it will automatically be assigned a class attribute ``_examples_``\n    referencing an `~collections.OrderedDict` containing all instances of\n    ``ExampleDecorator`` defined in the class body, mapped to by the names of\n    the attributes they were assigned to.\n\n    When subclassing a class with this metaclass, the descriptor dict (i.e.\n    ``_examples_`` in the above example) will *not* contain descriptors\n    inherited from the base class.  That is, this only works by default with\n    decorators explicitly defined in the class body.  However, the subclass\n    *may* define an attribute ``_inherit_decorators_`` which lists\n    `OrderedDescriptor` classes that *should* be added from base classes.\n    See the examples section below for an example of this.\n\n    Examples\n    --------\n\n    >>> from astropy.utils import OrderedDescriptor, OrderedDescriptorContainer\n    >>> class TypedAttribute(OrderedDescriptor):\n    ...     \\\"\\\"\\\"\n    ...     Attributes that may only be assigned objects of a specific type,\n    ...     or subclasses thereof.  For some reason we care about their order.\n    ...     \\\"\\\"\\\"\n    ...\n    ...     _class_attribute_ = 'typed_attributes'\n    ...     _name_attribute_ = 'name'\n    ...     # A default name so that instances not attached to a class can\n    ...     # still be repr'd; useful for debugging\n    ...     name = '<unbound>'\n    ...\n    ...     def __init__(self, type):\n    ...         # Make sure not to forget to call the super __init__\n    ...         super().__init__()\n    ...         self.type = type\n    ...\n    ...     def __get__(self, obj, objtype=None):\n    ...         if obj is None:\n    ...             return self\n    ...         if self.name in obj.__dict__:\n    ...             return obj.__dict__[self.name]\n    ...         else:\n    ...             raise AttributeError(self.name)\n    ...\n    ...     def __set__(self, obj, value):\n    ...         if not isinstance(value, self.type):\n    ...             raise ValueError('{0}.{1} must be of type {2!r}'.format(\n    ...                 obj.__class__.__name__, self.name, self.type))\n    ...         obj.__dict__[self.name] = value\n    ...\n    ...     def __delete__(self, obj):\n    ...         if self.name in obj.__dict__:\n    ...             del obj.__dict__[self.name]\n    ...         else:\n    ...             raise AttributeError(self.name)\n    ...\n    ...     def __repr__(self):\n    ...         if isinstance(self.type, tuple) and len(self.type) > 1:\n    ...             typestr = '({0})'.format(\n    ...                 ', '.join(t.__name__ for t in self.type))\n    ...         else:\n    ...             typestr = self.type.__name__\n    ...         return '<{0}(name={1}, type={2})>'.format(\n    ...                 self.__class__.__name__, self.name, typestr)\n    ...\n\n    Now let's create an example class that uses this ``TypedAttribute``::\n\n        >>> class Point2D(metaclass=OrderedDescriptorContainer):\n        ...     x = TypedAttribute((float, int))\n        ...     y = TypedAttribute((float, int))\n        ...\n        ...     def __init__(self, x, y):\n        ...         self.x, self.y = x, y\n        ...\n        >>> p1 = Point2D(1.0, 2.0)\n        >>> p1.x\n        1.0\n        >>> p1.y\n        2.0\n        >>> p2 = Point2D('a', 'b')  # doctest: +IGNORE_EXCEPTION_DETAIL\n        Traceback (most recent call last):\n            ...\n        ValueError: Point2D.x must be of type (float, int>)\n\n    We see that ``TypedAttribute`` works more or less as advertised, but\n    there's nothing special about that.  Let's see what\n    `OrderedDescriptorContainer` did for us::\n\n        >>> Point2D.typed_attributes\n        OrderedDict([('x', <TypedAttribute(name=x, type=(float, int))>),\n        ('y', <TypedAttribute(name=y, type=(float, int))>)])\n\n    If we create a subclass, it does *not* by default add inherited descriptors\n    to ``typed_attributes``::\n\n        >>> class Point3D(Point2D):\n        ...     z = TypedAttribute((float, int))\n        ...\n        >>> Point3D.typed_attributes\n        OrderedDict([('z', <TypedAttribute(name=z, type=(float, int))>)])\n\n    However, if we specify ``_inherit_descriptors_`` from ``Point2D`` then\n    it will do so::\n\n        >>> class Point3D(Point2D):\n        ...     _inherit_descriptors_ = (TypedAttribute,)\n        ...     z = TypedAttribute((float, int))\n        ...\n        >>> Point3D.typed_attributes\n        OrderedDict([('x', <TypedAttribute(name=x, type=(float, int))>),\n        ('y', <TypedAttribute(name=y, type=(float, int))>),\n        ('z', <TypedAttribute(name=z, type=(float, int))>)])\n\n    .. note::\n\n        Hopefully it is clear from these examples that this construction\n        also allows a class of type `OrderedDescriptorContainer` to use\n        multiple different `OrderedDescriptor` classes simultaneously.\n    \"\"\"\n\n    _inherit_descriptors_ = ()\n\n    def __init__(cls, cls_name, bases, members):\n        descriptors = defaultdict(list)\n        seen = set()\n        inherit_descriptors = ()\n        descr_bases = {}\n\n        for mro_cls in cls.__mro__:\n            for name, obj in mro_cls.__dict__.items():\n                if name in seen:\n                    # Checks if we've already seen an attribute of the given\n                    # name (if so it will override anything of the same name in\n                    # any base class)\n                    continue\n\n                seen.add(name)\n\n                if (not isinstance(obj, OrderedDescriptor) or\n                        (inherit_descriptors and\n                            not isinstance(obj, inherit_descriptors))):\n                    # The second condition applies when checking any\n                    # subclasses, to see if we can inherit any descriptors of\n                    # the given type from subclasses (by default inheritance is\n                    # disabled unless the class has _inherit_descriptors_\n                    # defined)\n                    continue\n\n                if obj._name_attribute_ is not None:\n                    setattr(obj, obj._name_attribute_, name)\n\n                # Don't just use the descriptor's class directly; instead go\n                # through its MRO and find the class on which _class_attribute_\n                # is defined directly.  This way subclasses of some\n                # OrderedDescriptor *may* override _class_attribute_ and have\n                # its own _class_attribute_, but by default all subclasses of\n                # some OrderedDescriptor are still grouped together\n                # TODO: It might be worth clarifying this in the docs\n                if obj.__class__ not in descr_bases:\n                    for obj_cls_base in obj.__class__.__mro__:\n                        if '_class_attribute_' in obj_cls_base.__dict__:\n                            descr_bases[obj.__class__] = obj_cls_base\n                            descriptors[obj_cls_base].append((obj, name))\n                            break\n                else:\n                    # Make sure to put obj first for sorting purposes\n                    obj_cls_base = descr_bases[obj.__class__]\n                    descriptors[obj_cls_base].append((obj, name))\n\n            if not getattr(mro_cls, '_inherit_descriptors_', False):\n                # If _inherit_descriptors_ is undefined then we don't inherit\n                # any OrderedDescriptors from any of the base classes, and\n                # there's no reason to continue through the MRO\n                break\n            else:\n                inherit_descriptors = mro_cls._inherit_descriptors_\n\n        for descriptor_cls, instances in descriptors.items():\n            instances.sort()\n            instances = OrderedDict((key, value) for value, key in instances)\n            setattr(cls, descriptor_cls._class_attribute_, instances)\n\n        super(OrderedDescriptorContainer, cls).__init__(cls_name, bases,\n                                                        members)"},{"col":4,"comment":"null","endLoc":795,"header":"def __init__(cls, cls_name, bases, members)","id":10719,"name":"__init__","nodeType":"Function","startLoc":734,"text":"def __init__(cls, cls_name, bases, members):\n        descriptors = defaultdict(list)\n        seen = set()\n        inherit_descriptors = ()\n        descr_bases = {}\n\n        for mro_cls in cls.__mro__:\n            for name, obj in mro_cls.__dict__.items():\n                if name in seen:\n                    # Checks if we've already seen an attribute of the given\n                    # name (if so it will override anything of the same name in\n                    # any base class)\n                    continue\n\n                seen.add(name)\n\n                if (not isinstance(obj, OrderedDescriptor) or\n                        (inherit_descriptors and\n                            not isinstance(obj, inherit_descriptors))):\n                    # The second condition applies when checking any\n                    # subclasses, to see if we can inherit any descriptors of\n                    # the given type from subclasses (by default inheritance is\n                    # disabled unless the class has _inherit_descriptors_\n                    # defined)\n                    continue\n\n                if obj._name_attribute_ is not None:\n                    setattr(obj, obj._name_attribute_, name)\n\n                # Don't just use the descriptor's class directly; instead go\n                # through its MRO and find the class on which _class_attribute_\n                # is defined directly.  This way subclasses of some\n                # OrderedDescriptor *may* override _class_attribute_ and have\n                # its own _class_attribute_, but by default all subclasses of\n                # some OrderedDescriptor are still grouped together\n                # TODO: It might be worth clarifying this in the docs\n                if obj.__class__ not in descr_bases:\n                    for obj_cls_base in obj.__class__.__mro__:\n                        if '_class_attribute_' in obj_cls_base.__dict__:\n                            descr_bases[obj.__class__] = obj_cls_base\n                            descriptors[obj_cls_base].append((obj, name))\n                            break\n                else:\n                    # Make sure to put obj first for sorting purposes\n                    obj_cls_base = descr_bases[obj.__class__]\n                    descriptors[obj_cls_base].append((obj, name))\n\n            if not getattr(mro_cls, '_inherit_descriptors_', False):\n                # If _inherit_descriptors_ is undefined then we don't inherit\n                # any OrderedDescriptors from any of the base classes, and\n                # there's no reason to continue through the MRO\n                break\n            else:\n                inherit_descriptors = mro_cls._inherit_descriptors_\n\n        for descriptor_cls, instances in descriptors.items():\n            instances.sort()\n            instances = OrderedDict((key, value) for value, key in instances)\n            setattr(cls, descriptor_cls._class_attribute_, instances)\n\n        super(OrderedDescriptorContainer, cls).__init__(cls_name, bases,\n                                                        members)"},{"col":0,"comment":"null","endLoc":594,"header":"@function_helper(helps={np.cross, np.inner, np.vdot, np.tensordot, np.kron,\n                        np.correlate, np.convolve})\ndef cross_like(a, b, *args, **kwargs)","id":10720,"name":"cross_like","nodeType":"Function","startLoc":589,"text":"@function_helper(helps={np.cross, np.inner, np.vdot, np.tensordot, np.kron,\n                        np.correlate, np.convolve})\ndef cross_like(a, b, *args, **kwargs):\n    a, b = _as_quantities(a, b)\n    unit = a.unit * b.unit\n    return (a.view(np.ndarray), b.view(np.ndarray)) + args, kwargs, unit, None"},{"col":0,"comment":"null","endLoc":254,"header":"def helper_atciq(f, unit_rc, unit_dc, unit_pr, unit_pd, unit_px, unit_rv, unit_astrom)","id":10721,"name":"helper_atciq","nodeType":"Function","startLoc":246,"text":"def helper_atciq(f, unit_rc, unit_dc, unit_pr, unit_pd, unit_px, unit_rv, unit_astrom):\n    from astropy.units.si import radian, arcsec, year, km, s\n    return [get_converter(unit_rc, radian),\n            get_converter(unit_dc, radian),\n            get_converter(unit_pr, radian / year),\n            get_converter(unit_pd, radian / year),\n            get_converter(unit_px, arcsec),\n            get_converter(unit_rv, km / s),\n            get_converter(unit_astrom, astrom_unit())], (radian, radian)"},{"col":0,"comment":"null","endLoc":267,"header":"def helper_atciqn(f, unit_rc, unit_dc, unit_pr, unit_pd, unit_px, unit_rv, unit_astrom,\n                  unit_b)","id":10722,"name":"helper_atciqn","nodeType":"Function","startLoc":257,"text":"def helper_atciqn(f, unit_rc, unit_dc, unit_pr, unit_pd, unit_px, unit_rv, unit_astrom,\n                  unit_b):\n    from astropy.units.si import radian, arcsec, year, km, s\n    return [get_converter(unit_rc, radian),\n            get_converter(unit_dc, radian),\n            get_converter(unit_pr, radian / year),\n            get_converter(unit_pd, radian / year),\n            get_converter(unit_px, arcsec),\n            get_converter(unit_rv, km / s),\n            get_converter(unit_astrom, astrom_unit()),\n            get_converter(unit_b, ldbody_unit())], (radian, radian)"},{"attributeType":"null","col":4,"comment":"null","endLoc":732,"id":10723,"name":"_inherit_descriptors_","nodeType":"Attribute","startLoc":732,"text":"_inherit_descriptors_"},{"col":4,"comment":"\n        Update the progress bar to the given value (out of a total\n        given to the constructor).\n\n        This method is for use in the IPython notebook 2+.\n        ","endLoc":658,"header":"def _update_ipython_widget(self, value=None)","id":10724,"name":"_update_ipython_widget","nodeType":"Function","startLoc":630,"text":"def _update_ipython_widget(self, value=None):\n        \"\"\"\n        Update the progress bar to the given value (out of a total\n        given to the constructor).\n\n        This method is for use in the IPython notebook 2+.\n        \"\"\"\n\n        # Create and display an empty progress bar widget,\n        # if none exists.\n        if not hasattr(self, '_widget'):\n            # Import only if an IPython widget, i.e., widget in iPython NB\n            from IPython import version_info\n            if version_info[0] < 4:\n                from IPython.html import widgets\n                self._widget = widgets.FloatProgressWidget()\n            else:\n                _IPython.get_ipython()\n                from ipywidgets import widgets\n                self._widget = widgets.FloatProgress()\n            from IPython.display import display\n\n            display(self._widget)\n            self._widget.value = 0\n\n        # Calculate percent completion, and update progress bar\n        frac = (value/self._total)\n        self._widget.value = frac * 100\n        self._widget.description = f' ({frac:>6.2%})'"},{"col":0,"comment":"A context manager that silences sys.stdout and sys.stderr.","endLoc":84,"header":"@contextlib.contextmanager\ndef silence()","id":10725,"name":"silence","nodeType":"Function","startLoc":74,"text":"@contextlib.contextmanager\ndef silence():\n    \"\"\"A context manager that silences sys.stdout and sys.stderr.\"\"\"\n\n    old_stdout = sys.stdout\n    old_stderr = sys.stderr\n    sys.stdout = _DummyFile()\n    sys.stderr = _DummyFile()\n    yield\n    sys.stdout = old_stdout\n    sys.stderr = old_stderr"},{"col":4,"comment":"\n        Returns True if the given filepath has the hidden attribute on\n        MS-Windows.  Based on a post here:\n        https://stackoverflow.com/questions/284115/cross-platform-hidden-file-detection\n        ","endLoc":318,"header":"def _has_hidden_attribute(filepath)","id":10726,"name":"_has_hidden_attribute","nodeType":"Function","startLoc":305,"text":"def _has_hidden_attribute(filepath):\n        \"\"\"\n        Returns True if the given filepath has the hidden attribute on\n        MS-Windows.  Based on a post here:\n        https://stackoverflow.com/questions/284115/cross-platform-hidden-file-detection\n        \"\"\"\n        if isinstance(filepath, bytes):\n            filepath = filepath.decode(sys.getfilesystemencoding())\n        try:\n            attrs = ctypes.windll.kernel32.GetFileAttributesW(filepath)\n            result = bool(attrs & 2) and attrs != -1\n        except AttributeError:\n            result = False\n        return result"},{"col":4,"comment":"null","endLoc":321,"header":"def _has_hidden_attribute(filepath)","id":10727,"name":"_has_hidden_attribute","nodeType":"Function","startLoc":320,"text":"def _has_hidden_attribute(filepath):\n        return False"},{"col":0,"comment":"\n    Determines if a given file or directory is hidden.\n\n    Parameters\n    ----------\n    filepath : str\n        The path to a file or directory\n\n    Returns\n    -------\n    hidden : bool\n        Returns `True` if the file is hidden\n    ","endLoc":343,"header":"def is_path_hidden(filepath)","id":10728,"name":"is_path_hidden","nodeType":"Function","startLoc":324,"text":"def is_path_hidden(filepath):\n    \"\"\"\n    Determines if a given file or directory is hidden.\n\n    Parameters\n    ----------\n    filepath : str\n        The path to a file or directory\n\n    Returns\n    -------\n    hidden : bool\n        Returns `True` if the file is hidden\n    \"\"\"\n    name = os.path.basename(os.path.abspath(filepath))\n    if isinstance(name, bytes):\n        is_dotted = name.startswith(b'.')\n    else:\n        is_dotted = name.startswith('.')\n    return is_dotted or _has_hidden_attribute(filepath)"},{"col":0,"comment":"\n    A wrapper for `os.walk` that skips hidden files and directories.\n\n    This function does not have the parameter ``topdown`` from\n    `os.walk`: the directories must always be recursed top-down when\n    using this function.\n\n    See also\n    --------\n    os.walk : For a description of the parameters\n    ","endLoc":365,"header":"def walk_skip_hidden(top, onerror=None, followlinks=False)","id":10729,"name":"walk_skip_hidden","nodeType":"Function","startLoc":346,"text":"def walk_skip_hidden(top, onerror=None, followlinks=False):\n    \"\"\"\n    A wrapper for `os.walk` that skips hidden files and directories.\n\n    This function does not have the parameter ``topdown`` from\n    `os.walk`: the directories must always be recursed top-down when\n    using this function.\n\n    See also\n    --------\n    os.walk : For a description of the parameters\n    \"\"\"\n    for root, dirs, files in os.walk(\n            top, topdown=True, onerror=onerror,\n            followlinks=followlinks):\n        # These lists must be updated in-place so os.walk will skip\n        # hidden directories\n        dirs[:] = [d for d in dirs if not is_path_hidden(d)]\n        files[:] = [f for f in files if not is_path_hidden(f)]\n        yield root, dirs, files"},{"col":0,"comment":"null","endLoc":274,"header":"def helper_atciqz_aticq(f, unit_rc, unit_dc, unit_astrom)","id":10730,"name":"helper_atciqz_aticq","nodeType":"Function","startLoc":270,"text":"def helper_atciqz_aticq(f, unit_rc, unit_dc, unit_astrom):\n    from astropy.units.si import radian\n    return [get_converter(unit_rc, radian),\n            get_converter(unit_dc, radian),\n            get_converter(unit_astrom, astrom_unit())], (radian, radian)"},{"col":0,"comment":"\n    Open browser loaded with ``option`` options near you.\n\n    *Disclaimers: Payments not included. Astropy is not\n    responsible for any liability from using this function.*\n\n    .. note:: Accuracy depends on your browser settings.\n\n    ","endLoc":874,"header":"def _hungry_for(option)","id":10731,"name":"_hungry_for","nodeType":"Function","startLoc":863,"text":"def _hungry_for(option):  # pragma: no cover\n    \"\"\"\n    Open browser loaded with ``option`` options near you.\n\n    *Disclaimers: Payments not included. Astropy is not\n    responsible for any liability from using this function.*\n\n    .. note:: Accuracy depends on your browser settings.\n\n    \"\"\"\n    import webbrowser\n    webbrowser.open(f'https://www.google.com/search?q={option}+near+me')"},{"col":0,"comment":"``/pizza``","endLoc":879,"header":"def pizza()","id":10732,"name":"pizza","nodeType":"Function","startLoc":877,"text":"def pizza():  # pragma: no cover\n    \"\"\"``/pizza``\"\"\"\n    _hungry_for('pizza')"},{"col":0,"comment":"``/coffee``","endLoc":892,"header":"def coffee(is_adam=False, is_brigitta=False)","id":10733,"name":"coffee","nodeType":"Function","startLoc":882,"text":"def coffee(is_adam=False, is_brigitta=False):  # pragma: no cover\n    \"\"\"``/coffee``\"\"\"\n    if is_adam and is_brigitta:\n        raise ValueError('There can be only one!')\n    if is_adam:\n        option = 'fresh+third+wave+coffee'\n    elif is_brigitta:\n        option = 'decent+espresso'\n    else:\n        option = 'coffee'\n    _hungry_for(option)"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":10734,"name":"__all__","nodeType":"Attribute","startLoc":28,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":10735,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":35,"text":"__doctest_skip__"},{"attributeType":"null","col":0,"comment":"null","endLoc":502,"id":10736,"name":"_ordered_descriptor_deprecation_message","nodeType":"Attribute","startLoc":502,"text":"_ordered_descriptor_deprecation_message"},{"attributeType":"null","col":0,"comment":"null","endLoc":798,"id":10737,"name":"LOCALE_LOCK","nodeType":"Attribute","startLoc":798,"text":"LOCALE_LOCK"},{"attributeType":"null","col":0,"comment":"null","endLoc":835,"id":10738,"name":"set_locale","nodeType":"Attribute","startLoc":835,"text":"set_locale"},{"col":0,"comment":"null","endLoc":282,"header":"def helper_aticqn(f, unit_rc, unit_dc, unit_astrom, unit_b)","id":10739,"name":"helper_aticqn","nodeType":"Function","startLoc":277,"text":"def helper_aticqn(f, unit_rc, unit_dc, unit_astrom, unit_b):\n    from astropy.units.si import radian\n    return [get_converter(unit_rc, radian),\n            get_converter(unit_dc, radian),\n            get_converter(unit_astrom, astrom_unit()),\n            get_converter(unit_b, ldbody_unit())], (radian, radian)"},{"col":0,"comment":"","endLoc":6,"header":"misc.py#<anonymous>","id":10740,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nA \"grab bag\" of relatively small general-purpose utilities that don't have\na clear module/package to live in.\n\"\"\"\n\n__all__ = ['isiterable', 'silence', 'format_exception', 'NumpyRNGContext',\n           'find_api_page', 'is_path_hidden', 'walk_skip_hidden',\n           'JsonCustomEncoder', 'indent', 'dtype_bytes_or_chars',\n           'OrderedDescriptor', 'OrderedDescriptorContainer']\n\n__doctest_skip__ = ['OrderedDescriptor', 'OrderedDescriptorContainer']\n\nNOT_OVERWRITING_MSG = ('File {} already exists. If you mean to replace it '\n                       'then use the argument \"overwrite=True\".')\n\n_NOT_OVERWRITING_MSG_MATCH = (r'File .* already exists\\. If you mean to '\n                              r'replace it then use the argument '\n                              r'\"overwrite=True\"\\.')\n\nif sys.platform == 'win32':\n    import ctypes\n\n    def _has_hidden_attribute(filepath):\n        \"\"\"\n        Returns True if the given filepath has the hidden attribute on\n        MS-Windows.  Based on a post here:\n        https://stackoverflow.com/questions/284115/cross-platform-hidden-file-detection\n        \"\"\"\n        if isinstance(filepath, bytes):\n            filepath = filepath.decode(sys.getfilesystemencoding())\n        try:\n            attrs = ctypes.windll.kernel32.GetFileAttributesW(filepath)\n            result = bool(attrs & 2) and attrs != -1\n        except AttributeError:\n            result = False\n        return result\nelse:\n    def _has_hidden_attribute(filepath):\n        return False\n\n_ordered_descriptor_deprecation_message = \"\"\"\\\nThe {func} {obj_type} is deprecated and may be removed in a future version.\n\n    You can replace its functionality with a combination of the\n    __init_subclass__ and __set_name__ magic methods introduced in Python 3.6.\n    See https://github.com/astropy/astropy/issues/11094 for recipes on how to\n    replicate their functionality.\n\"\"\"\n\nLOCALE_LOCK = threading.Lock()\n\nset_locale = deprecated('4.0')(_set_locale)\n\nset_locale.__doc__ = \"\"\"Deprecated version of :func:`_set_locale` above.\nSee https://github.com/astropy/astropy/issues/9196\n\"\"\""},{"col":0,"comment":"\n    Returns `True` if the given object is an instance method of the class\n    it is defined on (as opposed to a `staticmethod` or a `classmethod`).\n\n    This requires both the class the object is a member of as well as the\n    object itself in order to make this determination.\n\n    Parameters\n    ----------\n    cls : `type`\n        The class on which this method was defined.\n    obj : `object`\n        A member of the provided class (the membership is not checked directly,\n        but this function will always return `False` if the given object is not\n        a member of the given class).\n\n    Examples\n    --------\n    >>> class MetaClass(type):\n    ...     def a_classmethod(cls): pass\n    ...\n    >>> class MyClass(metaclass=MetaClass):\n    ...     def an_instancemethod(self): pass\n    ...\n    ...     @classmethod\n    ...     def another_classmethod(cls): pass\n    ...\n    ...     @staticmethod\n    ...     def a_staticmethod(): pass\n    ...\n    >>> isinstancemethod(MyClass, MyClass.a_classmethod)\n    False\n    >>> isinstancemethod(MyClass, MyClass.another_classmethod)\n    False\n    >>> isinstancemethod(MyClass, MyClass.a_staticmethod)\n    False\n    >>> isinstancemethod(MyClass, MyClass.an_instancemethod)\n    True\n    ","endLoc":434,"header":"def isinstancemethod(cls, obj)","id":10741,"name":"isinstancemethod","nodeType":"Function","startLoc":393,"text":"def isinstancemethod(cls, obj):\n    \"\"\"\n    Returns `True` if the given object is an instance method of the class\n    it is defined on (as opposed to a `staticmethod` or a `classmethod`).\n\n    This requires both the class the object is a member of as well as the\n    object itself in order to make this determination.\n\n    Parameters\n    ----------\n    cls : `type`\n        The class on which this method was defined.\n    obj : `object`\n        A member of the provided class (the membership is not checked directly,\n        but this function will always return `False` if the given object is not\n        a member of the given class).\n\n    Examples\n    --------\n    >>> class MetaClass(type):\n    ...     def a_classmethod(cls): pass\n    ...\n    >>> class MyClass(metaclass=MetaClass):\n    ...     def an_instancemethod(self): pass\n    ...\n    ...     @classmethod\n    ...     def another_classmethod(cls): pass\n    ...\n    ...     @staticmethod\n    ...     def a_staticmethod(): pass\n    ...\n    >>> isinstancemethod(MyClass, MyClass.a_classmethod)\n    False\n    >>> isinstancemethod(MyClass, MyClass.another_classmethod)\n    False\n    >>> isinstancemethod(MyClass, MyClass.a_staticmethod)\n    False\n    >>> isinstancemethod(MyClass, MyClass.an_instancemethod)\n    True\n    \"\"\"\n\n    return _isinstancemethod(cls, obj)"},{"col":0,"comment":"null","endLoc":452,"header":"def _isinstancemethod(cls, obj)","id":10742,"name":"_isinstancemethod","nodeType":"Function","startLoc":437,"text":"def _isinstancemethod(cls, obj):\n    if not isinstance(obj, types.FunctionType):\n        return False\n\n    # Unfortunately it seems the easiest way to get to the original\n    # staticmethod object is to look in the class's __dict__, though we\n    # also need to look up the MRO in case the method is not in the given\n    # class's dict\n    name = obj.__name__\n    for basecls in cls.mro():  # This includes cls\n        if name in basecls.__dict__:\n            return not isinstance(basecls.__dict__[name], staticmethod)\n\n    # This shouldn't happen, though this is the most sensible response if\n    # it does.\n    raise AttributeError(name)"},{"col":0,"comment":"null","endLoc":289,"header":"def helper_atioq(f, unit_rc, unit_dc, unit_astrom)","id":10743,"name":"helper_atioq","nodeType":"Function","startLoc":285,"text":"def helper_atioq(f, unit_rc, unit_dc, unit_astrom):\n    from astropy.units.si import radian\n    return [get_converter(unit_rc, radian),\n            get_converter(unit_dc, radian),\n            get_converter(unit_astrom, astrom_unit())], (radian,)*5"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":10744,"name":"__all__","nodeType":"Attribute","startLoc":16,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":10745,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":19,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":3,"header":"introspection.py#<anonymous>","id":10746,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"Functions related to Python runtime introspection.\"\"\"\n\n__all__ = ['resolve_name', 'minversion', 'find_current_module',\n           'isinstancemethod']\n\n__doctest_skip__ = ['find_current_module']\n\nif sys.version_info[:2] >= (3, 10):\n    from importlib.metadata import packages_distributions\nelse:\n    def packages_distributions():\n        \"\"\"\n        Return a mapping of top-level packages to their distributions.\n        Note: copied from https://github.com/python/importlib_metadata/pull/287\n        \"\"\"\n        pkg_to_dist = collections.defaultdict(list)\n        for dist in metadata.distributions():\n            for pkg in (dist.read_text('top_level.txt') or '').split():\n                pkg_to_dist[pkg].append(dist.metadata['Name'])\n        return dict(pkg_to_dist)"},{"col":4,"comment":"\n        Update the progress bar to the given value (out of the total\n        given to the constructor).\n        ","endLoc":628,"header":"def _update_console(self, value=None)","id":10747,"name":"_update_console","nodeType":"Function","startLoc":589,"text":"def _update_console(self, value=None):\n        \"\"\"\n        Update the progress bar to the given value (out of the total\n        given to the constructor).\n        \"\"\"\n\n        if self._total == 0:\n            frac = 1.0\n        else:\n            frac = float(value) / float(self._total)\n\n        file = self._file\n        write = file.write\n\n        if frac > 1:\n            bar_fill = int(self._bar_length)\n        else:\n            bar_fill = int(float(self._bar_length) * frac)\n        write('\\r|')\n        color_print('=' * bar_fill, 'blue', file=file, end='')\n        if bar_fill < self._bar_length:\n            color_print('>', 'green', file=file, end='')\n            write('-' * (self._bar_length - bar_fill - 1))\n        write('|')\n\n        if value >= self._total:\n            t = time.time() - self._start_time\n            prefix = '     '\n        elif value <= 0:\n            t = None\n            prefix = ''\n        else:\n            t = ((time.time() - self._start_time) * (1.0 - frac)) / frac\n            prefix = ' ETA '\n        write(f' {human_file_size(value):>4s}/{self._human_total:>4s}')\n        write(f' ({frac:>6.2%})')\n        write(prefix)\n        if t is not None:\n            write(human_time(t))\n        self._file.flush()"},{"fileName":"argparse.py","filePath":"astropy/utils","id":10748,"nodeType":"File","text":"\"\"\"Utilities and extensions for use with `argparse`.\"\"\"\n\n\nimport os\n\nimport argparse\n\n\ndef directory(arg):\n    \"\"\"\n    An argument type (for use with the ``type=`` argument to\n    `argparse.ArgumentParser.add_argument` which determines if the argument is\n    an existing directory (and returns the absolute path).\n    \"\"\"\n\n    if not isinstance(arg, str) and os.path.isdir(arg):\n        raise argparse.ArgumentTypeError(\n            \"{} is not a directory or does not exist (the directory must \"\n            \"be created first)\".format(arg))\n\n    return os.path.abspath(arg)\n\n\ndef readable_directory(arg):\n    \"\"\"\n    An argument type (for use with the ``type=`` argument to\n    `argparse.ArgumentParser.add_argument` which determines if the argument is\n    a directory that exists and is readable (and returns the absolute path).\n    \"\"\"\n\n    arg = directory(arg)\n\n    if not os.access(arg, os.R_OK):\n        raise argparse.ArgumentTypeError(\n            f\"{arg} exists but is not readable with its current permissions\")\n\n    return arg\n\n\ndef writeable_directory(arg):\n    \"\"\"\n    An argument type (for use with the ``type=`` argument to\n    `argparse.ArgumentParser.add_argument` which determines if the argument is\n    a directory that exists and is writeable (and returns the absolute path).\n    \"\"\"\n\n    arg = directory(arg)\n\n    if not os.access(arg, os.W_OK):\n        raise argparse.ArgumentTypeError(\n            f\"{arg} exists but is not writeable with its current permissions\")\n\n    return arg\n"},{"col":0,"comment":"\n    An argument type (for use with the ``type=`` argument to\n    `argparse.ArgumentParser.add_argument` which determines if the argument is\n    an existing directory (and returns the absolute path).\n    ","endLoc":21,"header":"def directory(arg)","id":10749,"name":"directory","nodeType":"Function","startLoc":9,"text":"def directory(arg):\n    \"\"\"\n    An argument type (for use with the ``type=`` argument to\n    `argparse.ArgumentParser.add_argument` which determines if the argument is\n    an existing directory (and returns the absolute path).\n    \"\"\"\n\n    if not isinstance(arg, str) and os.path.isdir(arg):\n        raise argparse.ArgumentTypeError(\n            \"{} is not a directory or does not exist (the directory must \"\n            \"be created first)\".format(arg))\n\n    return os.path.abspath(arg)"},{"col":0,"comment":"\n    An argument type (for use with the ``type=`` argument to\n    `argparse.ArgumentParser.add_argument` which determines if the argument is\n    a directory that exists and is readable (and returns the absolute path).\n    ","endLoc":37,"header":"def readable_directory(arg)","id":10750,"name":"readable_directory","nodeType":"Function","startLoc":24,"text":"def readable_directory(arg):\n    \"\"\"\n    An argument type (for use with the ``type=`` argument to\n    `argparse.ArgumentParser.add_argument` which determines if the argument is\n    a directory that exists and is readable (and returns the absolute path).\n    \"\"\"\n\n    arg = directory(arg)\n\n    if not os.access(arg, os.R_OK):\n        raise argparse.ArgumentTypeError(\n            f\"{arg} exists but is not readable with its current permissions\")\n\n    return arg"},{"fileName":"metadata.py","filePath":"astropy/utils","id":10751,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module contains helper functions and classes for handling metadata.\n\"\"\"\n\nfrom functools import wraps\n\nimport warnings\n\nfrom collections import OrderedDict\nfrom collections.abc import Mapping\nfrom copy import deepcopy\n\nimport numpy as np\nfrom astropy.utils.exceptions import AstropyWarning\nfrom astropy.utils.misc import dtype_bytes_or_chars\n\n\n__all__ = ['MergeConflictError', 'MergeConflictWarning', 'MERGE_STRATEGIES',\n           'common_dtype', 'MergePlus', 'MergeNpConcatenate', 'MergeStrategy',\n           'MergeStrategyMeta', 'enable_merge_strategies', 'merge', 'MetaData',\n           'MetaAttribute']\n\n\nclass MergeConflictError(TypeError):\n    pass\n\n\nclass MergeConflictWarning(AstropyWarning):\n    pass\n\n\nMERGE_STRATEGIES = []\n\n\ndef common_dtype(arrs):\n    \"\"\"\n    Use numpy to find the common dtype for a list of ndarrays.\n\n    Only allow arrays within the following fundamental numpy data types:\n    ``np.bool_``, ``np.object_``, ``np.number``, ``np.character``, ``np.void``\n\n    Parameters\n    ----------\n    arrs : list of ndarray\n        Arrays for which to find the common dtype\n\n    Returns\n    -------\n    dtype_str : str\n        String representation of dytpe (dtype ``str`` attribute)\n    \"\"\"\n    def dtype(arr):\n        return getattr(arr, 'dtype', np.dtype('O'))\n\n    np_types = (np.bool_, np.object_, np.number, np.character, np.void)\n    uniq_types = set(tuple(issubclass(dtype(arr).type, np_type) for np_type in np_types)\n                     for arr in arrs)\n    if len(uniq_types) > 1:\n        # Embed into the exception the actual list of incompatible types.\n        incompat_types = [dtype(arr).name for arr in arrs]\n        tme = MergeConflictError(f'Arrays have incompatible types {incompat_types}')\n        tme._incompat_types = incompat_types\n        raise tme\n\n    arrs = [np.empty(1, dtype=dtype(arr)) for arr in arrs]\n\n    # For string-type arrays need to explicitly fill in non-zero\n    # values or the final arr_common = .. step is unpredictable.\n    for i, arr in enumerate(arrs):\n        if arr.dtype.kind in ('S', 'U'):\n            arrs[i] = [('0' if arr.dtype.kind == 'U' else b'0') *\n                       dtype_bytes_or_chars(arr.dtype)]\n\n    arr_common = np.array([arr[0] for arr in arrs])\n    return arr_common.dtype.str\n\n\nclass MergeStrategyMeta(type):\n    \"\"\"\n    Metaclass that registers MergeStrategy subclasses into the\n    MERGE_STRATEGIES registry.\n    \"\"\"\n\n    def __new__(mcls, name, bases, members):\n        cls = super().__new__(mcls, name, bases, members)\n\n        # Wrap ``merge`` classmethod to catch any exception and re-raise as\n        # MergeConflictError.\n        if 'merge' in members and isinstance(members['merge'], classmethod):\n            orig_merge = members['merge'].__func__\n\n            @wraps(orig_merge)\n            def merge(cls, left, right):\n                try:\n                    return orig_merge(cls, left, right)\n                except Exception as err:\n                    raise MergeConflictError(err)\n\n            cls.merge = classmethod(merge)\n\n        # Register merging class (except for base MergeStrategy class)\n        if 'types' in members:\n            types = members['types']\n            if isinstance(types, tuple):\n                types = [types]\n            for left, right in reversed(types):\n                MERGE_STRATEGIES.insert(0, (left, right, cls))\n\n        return cls\n\n\nclass MergeStrategy(metaclass=MergeStrategyMeta):\n    \"\"\"\n    Base class for defining a strategy for merging metadata from two\n    sources, left and right, into a single output.\n\n    The primary functionality for the class is the ``merge(cls, left, right)``\n    class method.  This takes ``left`` and ``right`` side arguments and\n    returns a single merged output.\n\n    The first class attribute is ``types``.  This is defined as a list of\n    (left_types, right_types) tuples that indicate for which input types the\n    merge strategy applies.  In determining whether to apply this merge\n    strategy to a pair of (left, right) objects, a test is done:\n    ``isinstance(left, left_types) and isinstance(right, right_types)``.  For\n    example::\n\n      types = [(np.ndarray, np.ndarray),  # Two ndarrays\n               (np.ndarray, (list, tuple)),  # ndarray and (list or tuple)\n               ((list, tuple), np.ndarray)]  # (list or tuple) and ndarray\n\n    As a convenience, ``types`` can be defined as a single two-tuple instead of\n    a list of two-tuples, e.g. ``types = (np.ndarray, np.ndarray)``.\n\n    The other class attribute is ``enabled``, which defaults to ``False`` in\n    the base class.  By defining a subclass of ``MergeStrategy`` the new merge\n    strategy is automatically registered to be available for use in\n    merging. However, by default the new merge strategy is *not enabled*.  This\n    prevents inadvertently changing the behavior of unrelated code that is\n    performing metadata merge operations.\n\n    In most cases (particularly in library code that others might use) it is\n    recommended to leave custom strategies disabled and use the\n    `~astropy.utils.metadata.enable_merge_strategies` context manager to locally\n    enable the desired strategies.  However, if one is confident that the\n    new strategy will not produce unexpected behavior, then one can globally\n    enable it by setting the ``enabled`` class attribute to ``True``.\n\n    Examples\n    --------\n    Here we define a custom merge strategy that takes an int or float on\n    the left and right sides and returns a list with the two values.\n\n      >>> from astropy.utils.metadata import MergeStrategy\n      >>> class MergeNumbersAsList(MergeStrategy):\n      ...     types = ((int, float), (int, float))  # (left_types, right_types)\n      ...\n      ...     @classmethod\n      ...     def merge(cls, left, right):\n      ...         return [left, right]\n\n    \"\"\"\n    # Set ``enabled = True`` to globally enable applying this merge strategy.\n    # This is not generally recommended.\n    enabled = False\n\n    # types = [(left_types, right_types), ...]\n\n\nclass MergePlus(MergeStrategy):\n    \"\"\"\n    Merge ``left`` and ``right`` objects using the plus operator.  This\n    merge strategy is globally enabled by default.\n    \"\"\"\n    types = [(list, list), (tuple, tuple)]\n    enabled = True\n\n    @classmethod\n    def merge(cls, left, right):\n        return left + right\n\n\nclass MergeNpConcatenate(MergeStrategy):\n    \"\"\"\n    Merge ``left`` and ``right`` objects using np.concatenate.  This\n    merge strategy is globally enabled by default.\n\n    This will upcast a list or tuple to np.ndarray and the output is\n    always ndarray.\n    \"\"\"\n    types = [(np.ndarray, np.ndarray),\n             (np.ndarray, (list, tuple)),\n             ((list, tuple), np.ndarray)]\n    enabled = True\n\n    @classmethod\n    def merge(cls, left, right):\n        left, right = np.asanyarray(left), np.asanyarray(right)\n        common_dtype([left, right])  # Ensure left and right have compatible dtype\n        return np.concatenate([left, right])\n\n\ndef _both_isinstance(left, right, cls):\n    return isinstance(left, cls) and isinstance(right, cls)\n\n\ndef _not_equal(left, right):\n    try:\n        return bool(left != right)\n    except Exception:\n        return True\n\n\nclass _EnableMergeStrategies:\n    def __init__(self, *merge_strategies):\n        self.merge_strategies = merge_strategies\n        self.orig_enabled = {}\n        for left_type, right_type, merge_strategy in MERGE_STRATEGIES:\n            if issubclass(merge_strategy, merge_strategies):\n                self.orig_enabled[merge_strategy] = merge_strategy.enabled\n                merge_strategy.enabled = True\n\n    def __enter__(self):\n        pass\n\n    def __exit__(self, type, value, tb):\n        for merge_strategy, enabled in self.orig_enabled.items():\n            merge_strategy.enabled = enabled\n\n\ndef enable_merge_strategies(*merge_strategies):\n    \"\"\"\n    Context manager to temporarily enable one or more custom metadata merge\n    strategies.\n\n    Examples\n    --------\n    Here we define a custom merge strategy that takes an int or float on\n    the left and right sides and returns a list with the two values.\n\n      >>> from astropy.utils.metadata import MergeStrategy\n      >>> class MergeNumbersAsList(MergeStrategy):\n      ...     types = ((int, float),  # left side types\n      ...              (int, float))  # right side types\n      ...     @classmethod\n      ...     def merge(cls, left, right):\n      ...         return [left, right]\n\n    By defining this class the merge strategy is automatically registered to be\n    available for use in merging. However, by default new merge strategies are\n    *not enabled*.  This prevents inadvertently changing the behavior of\n    unrelated code that is performing metadata merge operations.\n\n    In order to use the new merge strategy, use this context manager as in the\n    following example::\n\n      >>> from astropy.table import Table, vstack\n      >>> from astropy.utils.metadata import enable_merge_strategies\n      >>> t1 = Table([[1]], names=['a'])\n      >>> t2 = Table([[2]], names=['a'])\n      >>> t1.meta = {'m': 1}\n      >>> t2.meta = {'m': 2}\n      >>> with enable_merge_strategies(MergeNumbersAsList):\n      ...    t12 = vstack([t1, t2])\n      >>> t12.meta['m']\n      [1, 2]\n\n    One can supply further merge strategies as additional arguments to the\n    context manager.\n\n    As a convenience, the enabling operation is actually done by checking\n    whether the registered strategies are subclasses of the context manager\n    arguments.  This means one can define a related set of merge strategies and\n    then enable them all at once by enabling the base class.  As a trivial\n    example, *all* registered merge strategies can be enabled with::\n\n      >>> with enable_merge_strategies(MergeStrategy):\n      ...    t12 = vstack([t1, t2])\n\n    Parameters\n    ----------\n    *merge_strategies : `~astropy.utils.metadata.MergeStrategy`\n        Merge strategies that will be enabled.\n\n    \"\"\"\n\n    return _EnableMergeStrategies(*merge_strategies)\n\n\ndef _warn_str_func(key, left, right):\n    out = ('Cannot merge meta key {0!r} types {1!r}'\n           ' and {2!r}, choosing {0}={3!r}'\n           .format(key, type(left), type(right), right))\n    return out\n\n\ndef _error_str_func(key, left, right):\n    out = f'Cannot merge meta key {key!r} types {type(left)!r} and {type(right)!r}'\n    return out\n\n\ndef merge(left, right, merge_func=None, metadata_conflicts='warn',\n          warn_str_func=_warn_str_func,\n          error_str_func=_error_str_func):\n    \"\"\"\n    Merge the ``left`` and ``right`` metadata objects.\n\n    This is a simplistic and limited implementation at this point.\n    \"\"\"\n    if not _both_isinstance(left, right, dict):\n        raise MergeConflictError('Can only merge two dict-based objects')\n\n    out = deepcopy(left)\n\n    for key, val in right.items():\n        # If no conflict then insert val into out dict and continue\n        if key not in out:\n            out[key] = deepcopy(val)\n            continue\n\n        # There is a conflict that must be resolved\n        if _both_isinstance(left[key], right[key], dict):\n            out[key] = merge(left[key], right[key], merge_func,\n                             metadata_conflicts=metadata_conflicts)\n\n        else:\n            try:\n                if merge_func is None:\n                    for left_type, right_type, merge_cls in MERGE_STRATEGIES:\n                        if not merge_cls.enabled:\n                            continue\n                        if (isinstance(left[key], left_type) and\n                                isinstance(right[key], right_type)):\n                            out[key] = merge_cls.merge(left[key], right[key])\n                            break\n                    else:\n                        raise MergeConflictError\n                else:\n                    out[key] = merge_func(left[key], right[key])\n            except MergeConflictError:\n\n                # Pick the metadata item that is not None, or they are both not\n                # None, then if they are equal, there is no conflict, and if\n                # they are different, there is a conflict and we pick the one\n                # on the right (or raise an error).\n\n                if left[key] is None:\n                    # This may not seem necessary since out[key] gets set to\n                    # right[key], but not all objects support != which is\n                    # needed for one of the if clauses.\n                    out[key] = right[key]\n                elif right[key] is None:\n                    out[key] = left[key]\n                elif _not_equal(left[key], right[key]):\n                    if metadata_conflicts == 'warn':\n                        warnings.warn(warn_str_func(key, left[key], right[key]),\n                                      MergeConflictWarning)\n                    elif metadata_conflicts == 'error':\n                        raise MergeConflictError(error_str_func(key, left[key], right[key]))\n                    elif metadata_conflicts != 'silent':\n                        raise ValueError('metadata_conflicts argument must be one '\n                                         'of \"silent\", \"warn\", or \"error\"')\n                    out[key] = right[key]\n                else:\n                    out[key] = right[key]\n\n    return out\n\n\nclass MetaData:\n    \"\"\"\n    A descriptor for classes that have a ``meta`` property.\n\n    This can be set to any valid `~collections.abc.Mapping`.\n\n    Parameters\n    ----------\n    doc : `str`, optional\n        Documentation for the attribute of the class.\n        Default is ``\"\"``.\n\n        .. versionadded:: 1.2\n\n    copy : `bool`, optional\n        If ``True`` the the value is deepcopied before setting, otherwise it\n        is saved as reference.\n        Default is ``True``.\n\n        .. versionadded:: 1.2\n    \"\"\"\n\n    def __init__(self, doc=\"\", copy=True):\n        self.__doc__ = doc\n        self.copy = copy\n\n    def __get__(self, instance, owner):\n        if instance is None:\n            return self\n        if not hasattr(instance, '_meta'):\n            instance._meta = OrderedDict()\n        return instance._meta\n\n    def __set__(self, instance, value):\n        if value is None:\n            instance._meta = OrderedDict()\n        else:\n            if isinstance(value, Mapping):\n                if self.copy:\n                    instance._meta = deepcopy(value)\n                else:\n                    instance._meta = value\n            else:\n                raise TypeError(\"meta attribute must be dict-like\")\n\n\nclass MetaAttribute:\n    \"\"\"\n    Descriptor to define custom attribute which gets stored in the object\n    ``meta`` dict and can have a defined default.\n\n    This descriptor is intended to provide a convenient way to add attributes\n    to a subclass of a complex class such as ``Table`` or ``NDData``.\n\n    This requires that the object has an attribute ``meta`` which is a\n    dict-like object.  The value of the MetaAttribute will be stored in a\n    new dict meta['__attributes__'] that is created when required.\n\n    Classes that define MetaAttributes are encouraged to support initializing\n    the attributes via the class ``__init__``.  For example::\n\n        for attr in list(kwargs):\n            descr = getattr(self.__class__, attr, None)\n            if isinstance(descr, MetaAttribute):\n                setattr(self, attr, kwargs.pop(attr))\n\n    The name of a ``MetaAttribute`` cannot be the same as any of the following:\n\n    - Keyword argument in the owner class ``__init__``\n    - Method or attribute of the \"parent class\", where the parent class is\n      taken to be ``owner.__mro__[1]``.\n\n    :param default: default value\n\n    \"\"\"\n    def __init__(self, default=None):\n        self.default = default\n\n    def __get__(self, instance, owner):\n        # When called without an instance, return self to allow access\n        # to descriptor attributes.\n        if instance is None:\n            return self\n\n        # If default is None and value has not been set already then return None\n        # without doing touching meta['__attributes__'] at all. This helps e.g.\n        # with the Table._hidden_columns attribute so it doesn't auto-create\n        # meta['__attributes__'] always.\n        if (self.default is None\n                and self.name not in instance.meta.get('__attributes__', {})):\n            return None\n\n        # Get the __attributes__ dict and create if not there already.\n        attributes = instance.meta.setdefault('__attributes__', {})\n        try:\n            value = attributes[self.name]\n        except KeyError:\n            if self.default is not None:\n                attributes[self.name] = deepcopy(self.default)\n            # Return either specified default or None\n            value = attributes.get(self.name)\n        return value\n\n    def __set__(self, instance, value):\n        # Get the __attributes__ dict and create if not there already.\n        attributes = instance.meta.setdefault('__attributes__', {})\n        attributes[self.name] = value\n\n    def __delete__(self, instance):\n        # Remove this attribute from meta['__attributes__'] if it exists.\n        if '__attributes__' in instance.meta:\n            attrs = instance.meta['__attributes__']\n            if self.name in attrs:\n                del attrs[self.name]\n            # If this was the last attribute then remove the meta key as well\n            if not attrs:\n                del instance.meta['__attributes__']\n\n    def __set_name__(self, owner, name):\n        import inspect\n        params = [param.name for param in inspect.signature(owner).parameters.values()\n                  if param.kind not in (inspect.Parameter.VAR_KEYWORD,\n                                        inspect.Parameter.VAR_POSITIONAL)]\n\n        # Reject names from existing params or best guess at parent class\n        if name in params or hasattr(owner.__mro__[1], name):\n            raise ValueError(f'{name} not allowed as {self.__class__.__name__}')\n\n        self.name = name\n\n    def __repr__(self):\n        return f'<{self.__class__.__name__} name={self.name} default={self.default}>'\n"},{"className":"MergeConflictError","col":0,"comment":"null","endLoc":26,"id":10752,"nodeType":"Class","startLoc":25,"text":"class MergeConflictError(TypeError):\n    pass"},{"className":"MergeConflictWarning","col":0,"comment":"null","endLoc":30,"id":10753,"nodeType":"Class","startLoc":29,"text":"class MergeConflictWarning(AstropyWarning):\n    pass"},{"className":"MergeStrategyMeta","col":0,"comment":"\n    Metaclass that registers MergeStrategy subclasses into the\n    MERGE_STRATEGIES registry.\n    ","endLoc":110,"id":10754,"nodeType":"Class","startLoc":79,"text":"class MergeStrategyMeta(type):\n    \"\"\"\n    Metaclass that registers MergeStrategy subclasses into the\n    MERGE_STRATEGIES registry.\n    \"\"\"\n\n    def __new__(mcls, name, bases, members):\n        cls = super().__new__(mcls, name, bases, members)\n\n        # Wrap ``merge`` classmethod to catch any exception and re-raise as\n        # MergeConflictError.\n        if 'merge' in members and isinstance(members['merge'], classmethod):\n            orig_merge = members['merge'].__func__\n\n            @wraps(orig_merge)\n            def merge(cls, left, right):\n                try:\n                    return orig_merge(cls, left, right)\n                except Exception as err:\n                    raise MergeConflictError(err)\n\n            cls.merge = classmethod(merge)\n\n        # Register merging class (except for base MergeStrategy class)\n        if 'types' in members:\n            types = members['types']\n            if isinstance(types, tuple):\n                types = [types]\n            for left, right in reversed(types):\n                MERGE_STRATEGIES.insert(0, (left, right, cls))\n\n        return cls"},{"col":4,"comment":"null","endLoc":110,"header":"def __new__(mcls, name, bases, members)","id":10755,"name":"__new__","nodeType":"Function","startLoc":85,"text":"def __new__(mcls, name, bases, members):\n        cls = super().__new__(mcls, name, bases, members)\n\n        # Wrap ``merge`` classmethod to catch any exception and re-raise as\n        # MergeConflictError.\n        if 'merge' in members and isinstance(members['merge'], classmethod):\n            orig_merge = members['merge'].__func__\n\n            @wraps(orig_merge)\n            def merge(cls, left, right):\n                try:\n                    return orig_merge(cls, left, right)\n                except Exception as err:\n                    raise MergeConflictError(err)\n\n            cls.merge = classmethod(merge)\n\n        # Register merging class (except for base MergeStrategy class)\n        if 'types' in members:\n            types = members['types']\n            if isinstance(types, tuple):\n                types = [types]\n            for left, right in reversed(types):\n                MERGE_STRATEGIES.insert(0, (left, right, cls))\n\n        return cls"},{"col":0,"comment":"\n    An argument type (for use with the ``type=`` argument to\n    `argparse.ArgumentParser.add_argument` which determines if the argument is\n    a directory that exists and is writeable (and returns the absolute path).\n    ","endLoc":53,"header":"def writeable_directory(arg)","id":10756,"name":"writeable_directory","nodeType":"Function","startLoc":40,"text":"def writeable_directory(arg):\n    \"\"\"\n    An argument type (for use with the ``type=`` argument to\n    `argparse.ArgumentParser.add_argument` which determines if the argument is\n    a directory that exists and is writeable (and returns the absolute path).\n    \"\"\"\n\n    arg = directory(arg)\n\n    if not os.access(arg, os.W_OK):\n        raise argparse.ArgumentTypeError(\n            f\"{arg} exists but is not writeable with its current permissions\")\n\n    return arg"},{"col":0,"comment":"null","endLoc":615,"header":"@function_helper\ndef einsum(subscripts, *operands, out=None, **kwargs)","id":10757,"name":"einsum","nodeType":"Function","startLoc":597,"text":"@function_helper\ndef einsum(subscripts, *operands, out=None, **kwargs):\n    from astropy.units import Quantity\n\n    if not isinstance(subscripts, str):\n        raise ValueError('only \"subscripts\" string mode supported for einsum.')\n\n    if out is not None:\n        if not isinstance(out, Quantity):\n            raise NotImplementedError\n\n        else:\n            kwargs['out'] = out.view(np.ndarray)\n\n    qs = _as_quantities(*operands)\n    unit = functools.reduce(operator.mul, (q.unit for q in qs),\n                            dimensionless_unscaled)\n    arrays = tuple(q.view(np.ndarray) for q in qs)\n    return (subscripts,) + arrays, kwargs, unit, out"},{"col":0,"comment":"null","endLoc":300,"header":"def helper_atoiq(f, unit_type, unit_ri, unit_di, unit_astrom)","id":10758,"name":"helper_atoiq","nodeType":"Function","startLoc":292,"text":"def helper_atoiq(f, unit_type, unit_ri, unit_di, unit_astrom):\n    from astropy.units.si import radian\n    if unit_type is not None:\n        raise UnitTypeError(\"argument 'type' should not have a unit\")\n\n    return [None,\n            get_converter(unit_ri, radian),\n            get_converter(unit_di, radian),\n            get_converter(unit_astrom, astrom_unit())], (radian, radian)"},{"col":0,"comment":"","endLoc":1,"header":"argparse.py#<anonymous>","id":10759,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"Utilities and extensions for use with `argparse`.\"\"\""},{"id":10760,"name":"astropy/utils/src","nodeType":"Package"},{"id":10761,"name":"compiler.c","nodeType":"TextFile","path":"astropy/utils/src","text":"#include <Python.h>\n\n/***************************************************************************\n * Macros for determining the compiler version.\n *\n * These are borrowed from boost, and majorly abridged to include only\n * the compilers we care about.\n ***************************************************************************/\n\n\n#define STRINGIZE(X) DO_STRINGIZE(X)\n#define DO_STRINGIZE(X) #X\n\n#if defined __clang__\n/*  Clang C++ emulates GCC, so it has to appear early. */\n#    define COMPILER \"Clang version \" __clang_version__\n\n#elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)\n/* Intel */\n#    if defined(__INTEL_COMPILER)\n#        define INTEL_VERSION __INTEL_COMPILER\n#    elif defined(__ICL)\n#        define INTEL_VERSION __ICL\n#    elif defined(__ICC)\n#        define INTEL_VERSION __ICC\n#    elif defined(__ECC)\n#        define INTEL_VERSION __ECC\n#    endif\n#    define COMPILER \"Intel C compiler version \" STRINGIZE(INTEL_VERSION)\n\n#elif defined(__GNUC__)\n/* gcc */\n#    define COMPILER \"GCC version \" __VERSION__\n\n#elif defined(__SUNPRO_CC)\n/* Sun Workshop Compiler */\n#    define COMPILER \"Sun compiler version \" STRINGIZE(__SUNPRO_CC)\n\n#elif defined(_MSC_VER)\n/* Microsoft Visual C/C++\n   Must be last since other compilers define _MSC_VER for compatibility as well */\n#    if _MSC_VER < 1200\n#        define COMPILER_VERSION 5.0\n#    elif _MSC_VER < 1300\n#        define COMPILER_VERSION 6.0\n#    elif _MSC_VER == 1300\n#        define COMPILER_VERSION 7.0\n#    elif _MSC_VER == 1310\n#        define COMPILER_VERSION 7.1\n#    elif _MSC_VER == 1400\n#        define COMPILER_VERSION 8.0\n#    elif _MSC_VER == 1500\n#        define COMPILER_VERSION 9.0\n#    elif _MSC_VER == 1600\n#        define COMPILER_VERSION 10.0\n#    else\n#        define COMPILER_VERSION _MSC_VER\n#    endif\n#    define COMPILER \"Microsoft Visual C++ version \" STRINGIZE(COMPILER_VERSION)\n\n#else\n/* Fallback */\n#    define COMPILER \"Unknown compiler\"\n\n#endif\n\n\n/***************************************************************************\n * Module-level\n ***************************************************************************/\n\nstruct module_state {\n/* The Sun compiler can't handle empty structs */\n#if defined(__SUNPRO_C) || defined(_MSC_VER)\n    int _dummy;\n#endif\n};\n\nstatic struct PyModuleDef moduledef = {\n    PyModuleDef_HEAD_INIT,\n    \"_compiler\",\n    NULL,\n    sizeof(struct module_state),\n    NULL,\n    NULL,\n    NULL,\n    NULL,\n    NULL\n};\n\nPyMODINIT_FUNC\nPyInit__compiler(void)\n\n{\n  PyObject* m;\n\n  m = PyModule_Create(&moduledef);\n\n  if (m == NULL)\n    return NULL;\n\n  PyModule_AddStringConstant(m, \"compiler\", COMPILER);\n\n  return m;\n}\n"},{"id":10762,"name":"astropy/utils/xml","nodeType":"Package"},{"fileName":"iterparser.py","filePath":"astropy/utils/xml","id":10763,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module includes a fast iterator-based XML parser.\n\"\"\"\n\n# STDLIB\nimport contextlib\nimport io\nimport sys\n\n# ASTROPY\nfrom astropy.utils import data\n\n\n__all__ = ['get_xml_iterator', 'get_xml_encoding', 'xml_readlines']\n\n\n@contextlib.contextmanager\ndef _convert_to_fd_or_read_function(fd):\n    \"\"\"\n    Returns a function suitable for streaming input, or a file object.\n\n    This function is only useful if passing off to C code where:\n\n       - If it's a real file object, we want to use it as a real\n         C file object to avoid the Python overhead.\n\n       - If it's not a real file object, it's much handier to just\n         have a Python function to call.\n\n    This is somewhat quirky behavior, of course, which is why it is\n    private.  For a more useful version of similar behavior, see\n    `astropy.utils.misc.get_readable_fileobj`.\n\n    Parameters\n    ----------\n    fd : object\n        May be:\n\n            - a file object.  If the file is uncompressed, this raw\n              file object is returned verbatim.  Otherwise, the read\n              method is returned.\n\n            - a function that reads from a stream, in which case it is\n              returned verbatim.\n\n            - a file path, in which case it is opened.  Again, like a\n              file object, if it's uncompressed, a raw file object is\n              returned, otherwise its read method.\n\n            - an object with a :meth:`read` method, in which case that\n              method is returned.\n\n    Returns\n    -------\n    fd : context-dependent\n        See above.\n    \"\"\"\n    if callable(fd):\n        yield fd\n        return\n\n    with data.get_readable_fileobj(fd, encoding='binary') as new_fd:\n        if sys.platform.startswith('win'):\n            yield new_fd.read\n        else:\n            if isinstance(new_fd, io.FileIO):\n                yield new_fd\n            else:\n                yield new_fd.read\n\n\ndef _fast_iterparse(fd, buffersize=2 ** 10):\n    from xml.parsers import expat\n\n    if not callable(fd):\n        read = fd.read\n    else:\n        read = fd\n\n    queue = []\n    text = []\n\n    def start(name, attr):\n        queue.append((True, name, attr,\n                      (parser.CurrentLineNumber, parser.CurrentColumnNumber)))\n        del text[:]\n\n    def end(name):\n        queue.append((False, name, ''.join(text).strip(),\n                      (parser.CurrentLineNumber, parser.CurrentColumnNumber)))\n\n    parser = expat.ParserCreate()\n    parser.specified_attributes = True\n    parser.StartElementHandler = start\n    parser.EndElementHandler = end\n    parser.CharacterDataHandler = text.append\n    Parse = parser.Parse\n\n    data = read(buffersize)\n    while data:\n        Parse(data, False)\n        for elem in queue:\n            yield elem\n        del queue[:]\n        data = read(buffersize)\n\n    Parse('', True)\n    for elem in queue:\n        yield elem\n\n\n# Try to import the C version of the iterparser, otherwise fall back\n# to the Python implementation above.\n_slow_iterparse = _fast_iterparse\ntry:\n    from . import _iterparser\n    _fast_iterparse = _iterparser.IterParser\nexcept ImportError:\n    pass\n\n\n@contextlib.contextmanager\ndef get_xml_iterator(source, _debug_python_based_parser=False):\n    \"\"\"\n    Returns an iterator over the elements of an XML file.\n\n    The iterator doesn't ever build a tree, so it is much more memory\n    and time efficient than the alternative in ``cElementTree``.\n\n    Parameters\n    ----------\n    source : path-like, readable file-like, or callable\n        Handle that contains the data or function that reads it.\n        If a function or callable object, it must directly read from a stream.\n        Non-callable objects must define a ``read`` method.\n\n    Returns\n    -------\n    parts : iterator\n\n        The iterator returns 4-tuples (*start*, *tag*, *data*, *pos*):\n\n            - *start*: when `True` is a start element event, otherwise\n              an end element event.\n\n            - *tag*: The name of the element\n\n            - *data*: Depends on the value of *event*:\n\n                - if *start* == `True`, data is a dictionary of\n                  attributes\n\n                - if *start* == `False`, data is a string containing\n                  the text content of the element\n\n            - *pos*: Tuple (*line*, *col*) indicating the source of the\n              event.\n    \"\"\"\n    with _convert_to_fd_or_read_function(source) as fd:\n        if _debug_python_based_parser:\n            context = _slow_iterparse(fd)\n        else:\n            context = _fast_iterparse(fd)\n        yield iter(context)\n\n\ndef get_xml_encoding(source):\n    \"\"\"\n    Determine the encoding of an XML file by reading its header.\n\n    Parameters\n    ----------\n    source : path-like, readable file-like, or callable\n        Handle that contains the data or function that reads it.\n        If a function or callable object, it must directly read from a stream.\n        Non-callable objects must define a ``read`` method.\n\n    Returns\n    -------\n    encoding : str\n    \"\"\"\n    with get_xml_iterator(source) as iterator:\n        start, tag, data, pos = next(iterator)\n        if not start or tag != 'xml':\n            raise OSError('Invalid XML file')\n\n    # The XML spec says that no encoding === utf-8\n    return data.get('encoding') or 'utf-8'\n\n\ndef xml_readlines(source):\n    \"\"\"\n    Get the lines from a given XML file.  Correctly determines the\n    encoding and always returns unicode.\n\n    Parameters\n    ----------\n    source : path-like, readable file-like, or callable\n        Handle that contains the data or function that reads it.\n        If a function or callable object, it must directly read from a stream.\n        Non-callable objects must define a ``read`` method.\n\n    Returns\n    -------\n    lines : list of unicode\n    \"\"\"\n    encoding = get_xml_encoding(source)\n\n    with data.get_readable_fileobj(source, encoding=encoding) as input:\n        input.seek(0)\n        xml_lines = input.readlines()\n\n    return xml_lines\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":10764,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"attributeType":"function","col":0,"comment":"null","endLoc":115,"id":10765,"name":"_slow_iterparse","nodeType":"Attribute","startLoc":115,"text":"_slow_iterparse"},{"attributeType":"null","col":4,"comment":"null","endLoc":118,"id":10766,"name":"_fast_iterparse","nodeType":"Attribute","startLoc":118,"text":"_fast_iterparse"},{"col":0,"comment":"","endLoc":4,"header":"iterparser.py#<anonymous>","id":10767,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module includes a fast iterator-based XML parser.\n\"\"\"\n\n__all__ = ['get_xml_iterator', 'get_xml_encoding', 'xml_readlines']\n\n_slow_iterparse = _fast_iterparse\n\ntry:\n    from . import _iterparser\n    _fast_iterparse = _iterparser.IterParser\nexcept ImportError:\n    pass"},{"fileName":"setup_package.py","filePath":"astropy/utils/xml","id":10768,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\nfrom collections import defaultdict\nfrom setuptools import Extension\nfrom os.path import join\n\nimport sys\n\nfrom extension_helpers import pkg_config\n\n\ndef get_extensions(build_type='release'):\n    XML_DIR = 'astropy/utils/xml/src'\n\n    cfg = defaultdict(list)\n    cfg['sources'] = [join(XML_DIR, \"iterparse.c\")]\n\n    if (int(os.environ.get('ASTROPY_USE_SYSTEM_EXPAT', 0)) or\n            int(os.environ.get('ASTROPY_USE_SYSTEM_ALL', 0))):\n        for k, v in pkg_config(['expat'], ['expat']).items():\n            cfg[k].extend(v)\n    else:\n        EXPAT_DIR = 'cextern/expat/lib'\n        cfg['sources'].extend([\n            join(EXPAT_DIR, fn) for fn in\n            [\"xmlparse.c\", \"xmlrole.c\", \"xmltok.c\", \"xmltok_impl.c\"]])\n        cfg['include_dirs'].extend([XML_DIR, EXPAT_DIR])\n        if sys.platform.startswith('linux'):\n            # This is to ensure we only export the Python entry point\n            # symbols and the linker won't try to use the system expat in\n            # place of ours.\n            cfg['extra_link_args'].extend([\n                f\"-Wl,--version-script={join(XML_DIR, 'iterparse.map')}\"\n                ])\n        cfg['define_macros'].append((\"HAVE_EXPAT_CONFIG_H\", 1))\n        if sys.byteorder == 'big':\n            cfg['define_macros'].append(('BYTEORDER', '4321'))\n        else:\n            cfg['define_macros'].append(('BYTEORDER', '1234'))\n        if sys.platform != 'win32':\n            cfg['define_macros'].append(('HAVE_UNISTD_H', None))\n\n    return [Extension(\"astropy.utils.xml._iterparser\", **cfg)]\n"},{"col":0,"comment":"null","endLoc":44,"header":"def get_extensions(build_type='release')","id":10769,"name":"get_extensions","nodeType":"Function","startLoc":13,"text":"def get_extensions(build_type='release'):\n    XML_DIR = 'astropy/utils/xml/src'\n\n    cfg = defaultdict(list)\n    cfg['sources'] = [join(XML_DIR, \"iterparse.c\")]\n\n    if (int(os.environ.get('ASTROPY_USE_SYSTEM_EXPAT', 0)) or\n            int(os.environ.get('ASTROPY_USE_SYSTEM_ALL', 0))):\n        for k, v in pkg_config(['expat'], ['expat']).items():\n            cfg[k].extend(v)\n    else:\n        EXPAT_DIR = 'cextern/expat/lib'\n        cfg['sources'].extend([\n            join(EXPAT_DIR, fn) for fn in\n            [\"xmlparse.c\", \"xmlrole.c\", \"xmltok.c\", \"xmltok_impl.c\"]])\n        cfg['include_dirs'].extend([XML_DIR, EXPAT_DIR])\n        if sys.platform.startswith('linux'):\n            # This is to ensure we only export the Python entry point\n            # symbols and the linker won't try to use the system expat in\n            # place of ours.\n            cfg['extra_link_args'].extend([\n                f\"-Wl,--version-script={join(XML_DIR, 'iterparse.map')}\"\n                ])\n        cfg['define_macros'].append((\"HAVE_EXPAT_CONFIG_H\", 1))\n        if sys.byteorder == 'big':\n            cfg['define_macros'].append(('BYTEORDER', '4321'))\n        else:\n            cfg['define_macros'].append(('BYTEORDER', '1234'))\n        if sys.platform != 'win32':\n            cfg['define_macros'].append(('HAVE_UNISTD_H', None))\n\n    return [Extension(\"astropy.utils.xml._iterparser\", **cfg)]"},{"col":0,"comment":"null","endLoc":623,"header":"@function_helper\ndef bincount(x, weights=None, minlength=0)","id":10770,"name":"bincount","nodeType":"Function","startLoc":618,"text":"@function_helper\ndef bincount(x, weights=None, minlength=0):\n    from astropy.units import Quantity\n    if isinstance(x, Quantity):\n        raise NotImplementedError\n    return (x, weights.value, minlength), {}, weights.unit, None"},{"col":0,"comment":"null","endLoc":629,"header":"@function_helper\ndef digitize(x, bins, *args, **kwargs)","id":10771,"name":"digitize","nodeType":"Function","startLoc":626,"text":"@function_helper\ndef digitize(x, bins, *args, **kwargs):\n    arrays, unit = _quantities2arrays(x, bins, unit_from_first=True)\n    return arrays + args, kwargs, None, None"},{"col":0,"comment":"null","endLoc":642,"header":"def _check_bins(bins, unit)","id":10772,"name":"_check_bins","nodeType":"Function","startLoc":632,"text":"def _check_bins(bins, unit):\n    from astropy.units import Quantity\n\n    check = _as_quantity(bins)\n    if check.ndim > 0:\n        return check.to_value(unit)\n    elif isinstance(bins, Quantity):\n        # bins should be an integer (or at least definitely not a Quantity).\n        raise NotImplementedError\n    else:\n        return bins"},{"attributeType":"null","col":12,"comment":"null","endLoc":91,"id":10773,"name":"orig_merge","nodeType":"Attribute","startLoc":91,"text":"orig_merge"},{"attributeType":"null","col":16,"comment":"null","endLoc":106,"id":10774,"name":"types","nodeType":"Attribute","startLoc":106,"text":"types"},{"attributeType":"null","col":12,"comment":"null","endLoc":100,"id":10775,"name":"merge","nodeType":"Attribute","startLoc":100,"text":"cls.merge"},{"attributeType":"null","col":8,"comment":"null","endLoc":86,"id":10776,"name":"cls","nodeType":"Attribute","startLoc":86,"text":"cls"},{"className":"MergeStrategy","col":0,"comment":"\n    Base class for defining a strategy for merging metadata from two\n    sources, left and right, into a single output.\n\n    The primary functionality for the class is the ``merge(cls, left, right)``\n    class method.  This takes ``left`` and ``right`` side arguments and\n    returns a single merged output.\n\n    The first class attribute is ``types``.  This is defined as a list of\n    (left_types, right_types) tuples that indicate for which input types the\n    merge strategy applies.  In determining whether to apply this merge\n    strategy to a pair of (left, right) objects, a test is done:\n    ``isinstance(left, left_types) and isinstance(right, right_types)``.  For\n    example::\n\n      types = [(np.ndarray, np.ndarray),  # Two ndarrays\n               (np.ndarray, (list, tuple)),  # ndarray and (list or tuple)\n               ((list, tuple), np.ndarray)]  # (list or tuple) and ndarray\n\n    As a convenience, ``types`` can be defined as a single two-tuple instead of\n    a list of two-tuples, e.g. ``types = (np.ndarray, np.ndarray)``.\n\n    The other class attribute is ``enabled``, which defaults to ``False`` in\n    the base class.  By defining a subclass of ``MergeStrategy`` the new merge\n    strategy is automatically registered to be available for use in\n    merging. However, by default the new merge strategy is *not enabled*.  This\n    prevents inadvertently changing the behavior of unrelated code that is\n    performing metadata merge operations.\n\n    In most cases (particularly in library code that others might use) it is\n    recommended to leave custom strategies disabled and use the\n    `~astropy.utils.metadata.enable_merge_strategies` context manager to locally\n    enable the desired strategies.  However, if one is confident that the\n    new strategy will not produce unexpected behavior, then one can globally\n    enable it by setting the ``enabled`` class attribute to ``True``.\n\n    Examples\n    --------\n    Here we define a custom merge strategy that takes an int or float on\n    the left and right sides and returns a list with the two values.\n\n      >>> from astropy.utils.metadata import MergeStrategy\n      >>> class MergeNumbersAsList(MergeStrategy):\n      ...     types = ((int, float), (int, float))  # (left_types, right_types)\n      ...\n      ...     @classmethod\n      ...     def merge(cls, left, right):\n      ...         return [left, right]\n\n    ","endLoc":168,"id":10777,"nodeType":"Class","startLoc":113,"text":"class MergeStrategy(metaclass=MergeStrategyMeta):\n    \"\"\"\n    Base class for defining a strategy for merging metadata from two\n    sources, left and right, into a single output.\n\n    The primary functionality for the class is the ``merge(cls, left, right)``\n    class method.  This takes ``left`` and ``right`` side arguments and\n    returns a single merged output.\n\n    The first class attribute is ``types``.  This is defined as a list of\n    (left_types, right_types) tuples that indicate for which input types the\n    merge strategy applies.  In determining whether to apply this merge\n    strategy to a pair of (left, right) objects, a test is done:\n    ``isinstance(left, left_types) and isinstance(right, right_types)``.  For\n    example::\n\n      types = [(np.ndarray, np.ndarray),  # Two ndarrays\n               (np.ndarray, (list, tuple)),  # ndarray and (list or tuple)\n               ((list, tuple), np.ndarray)]  # (list or tuple) and ndarray\n\n    As a convenience, ``types`` can be defined as a single two-tuple instead of\n    a list of two-tuples, e.g. ``types = (np.ndarray, np.ndarray)``.\n\n    The other class attribute is ``enabled``, which defaults to ``False`` in\n    the base class.  By defining a subclass of ``MergeStrategy`` the new merge\n    strategy is automatically registered to be available for use in\n    merging. However, by default the new merge strategy is *not enabled*.  This\n    prevents inadvertently changing the behavior of unrelated code that is\n    performing metadata merge operations.\n\n    In most cases (particularly in library code that others might use) it is\n    recommended to leave custom strategies disabled and use the\n    `~astropy.utils.metadata.enable_merge_strategies` context manager to locally\n    enable the desired strategies.  However, if one is confident that the\n    new strategy will not produce unexpected behavior, then one can globally\n    enable it by setting the ``enabled`` class attribute to ``True``.\n\n    Examples\n    --------\n    Here we define a custom merge strategy that takes an int or float on\n    the left and right sides and returns a list with the two values.\n\n      >>> from astropy.utils.metadata import MergeStrategy\n      >>> class MergeNumbersAsList(MergeStrategy):\n      ...     types = ((int, float), (int, float))  # (left_types, right_types)\n      ...\n      ...     @classmethod\n      ...     def merge(cls, left, right):\n      ...         return [left, right]\n\n    \"\"\"\n    # Set ``enabled = True`` to globally enable applying this merge strategy.\n    # This is not generally recommended.\n    enabled = False\n\n    # types = [(left_types, right_types), ...]"},{"attributeType":"null","col":4,"comment":"null","endLoc":166,"id":10778,"name":"enabled","nodeType":"Attribute","startLoc":166,"text":"enabled"},{"col":0,"comment":"null","endLoc":662,"header":"@function_helper\ndef histogram(a, bins=10, range=None, weights=None, density=None)","id":10779,"name":"histogram","nodeType":"Function","startLoc":645,"text":"@function_helper\ndef histogram(a, bins=10, range=None, weights=None, density=None):\n    if weights is not None:\n        weights = _as_quantity(weights)\n        unit = weights.unit\n        weights = weights.value\n    else:\n        unit = None\n\n    a = _as_quantity(a)\n    if not isinstance(bins, str):\n        bins = _check_bins(bins, a.unit)\n\n    if density:\n        unit = (unit or 1) / a.unit\n\n    return ((a.value, bins, range), {'weights': weights, 'density': density},\n            (unit, a.unit), None)"},{"className":"MergePlus","col":0,"comment":"\n    Merge ``left`` and ``right`` objects using the plus operator.  This\n    merge strategy is globally enabled by default.\n    ","endLoc":181,"id":10780,"nodeType":"Class","startLoc":171,"text":"class MergePlus(MergeStrategy):\n    \"\"\"\n    Merge ``left`` and ``right`` objects using the plus operator.  This\n    merge strategy is globally enabled by default.\n    \"\"\"\n    types = [(list, list), (tuple, tuple)]\n    enabled = True\n\n    @classmethod\n    def merge(cls, left, right):\n        return left + right"},{"col":4,"comment":"null","endLoc":181,"header":"@classmethod\n    def merge(cls, left, right)","id":10781,"name":"merge","nodeType":"Function","startLoc":179,"text":"@classmethod\n    def merge(cls, left, right):\n        return left + right"},{"attributeType":"null","col":4,"comment":"null","endLoc":176,"id":10782,"name":"types","nodeType":"Attribute","startLoc":176,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":177,"id":10783,"name":"enabled","nodeType":"Attribute","startLoc":177,"text":"enabled"},{"className":"MergeNpConcatenate","col":0,"comment":"\n    Merge ``left`` and ``right`` objects using np.concatenate.  This\n    merge strategy is globally enabled by default.\n\n    This will upcast a list or tuple to np.ndarray and the output is\n    always ndarray.\n    ","endLoc":201,"id":10784,"nodeType":"Class","startLoc":184,"text":"class MergeNpConcatenate(MergeStrategy):\n    \"\"\"\n    Merge ``left`` and ``right`` objects using np.concatenate.  This\n    merge strategy is globally enabled by default.\n\n    This will upcast a list or tuple to np.ndarray and the output is\n    always ndarray.\n    \"\"\"\n    types = [(np.ndarray, np.ndarray),\n             (np.ndarray, (list, tuple)),\n             ((list, tuple), np.ndarray)]\n    enabled = True\n\n    @classmethod\n    def merge(cls, left, right):\n        left, right = np.asanyarray(left), np.asanyarray(right)\n        common_dtype([left, right])  # Ensure left and right have compatible dtype\n        return np.concatenate([left, right])"},{"col":4,"comment":"null","endLoc":201,"header":"@classmethod\n    def merge(cls, left, right)","id":10785,"name":"merge","nodeType":"Function","startLoc":197,"text":"@classmethod\n    def merge(cls, left, right):\n        left, right = np.asanyarray(left), np.asanyarray(right)\n        common_dtype([left, right])  # Ensure left and right have compatible dtype\n        return np.concatenate([left, right])"},{"col":0,"comment":"null","endLoc":672,"header":"@function_helper(helps=np.histogram_bin_edges)\ndef histogram_bin_edges(a, bins=10, range=None, weights=None)","id":10786,"name":"histogram_bin_edges","nodeType":"Function","startLoc":665,"text":"@function_helper(helps=np.histogram_bin_edges)\ndef histogram_bin_edges(a, bins=10, range=None, weights=None):\n    # weights is currently unused\n    a = _as_quantity(a)\n    if not isinstance(bins, str):\n        bins = _check_bins(bins, a.unit)\n\n    return (a.value, bins, range, weights), {}, a.unit, None"},{"attributeType":"null","col":4,"comment":"null","endLoc":192,"id":10787,"name":"types","nodeType":"Attribute","startLoc":192,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":195,"id":10788,"name":"enabled","nodeType":"Attribute","startLoc":195,"text":"enabled"},{"className":"_EnableMergeStrategies","col":0,"comment":"null","endLoc":229,"id":10789,"nodeType":"Class","startLoc":215,"text":"class _EnableMergeStrategies:\n    def __init__(self, *merge_strategies):\n        self.merge_strategies = merge_strategies\n        self.orig_enabled = {}\n        for left_type, right_type, merge_strategy in MERGE_STRATEGIES:\n            if issubclass(merge_strategy, merge_strategies):\n                self.orig_enabled[merge_strategy] = merge_strategy.enabled\n                merge_strategy.enabled = True\n\n    def __enter__(self):\n        pass\n\n    def __exit__(self, type, value, tb):\n        for merge_strategy, enabled in self.orig_enabled.items():\n            merge_strategy.enabled = enabled"},{"col":4,"comment":"null","endLoc":222,"header":"def __init__(self, *merge_strategies)","id":10790,"name":"__init__","nodeType":"Function","startLoc":216,"text":"def __init__(self, *merge_strategies):\n        self.merge_strategies = merge_strategies\n        self.orig_enabled = {}\n        for left_type, right_type, merge_strategy in MERGE_STRATEGIES:\n            if issubclass(merge_strategy, merge_strategies):\n                self.orig_enabled[merge_strategy] = merge_strategy.enabled\n                merge_strategy.enabled = True"},{"col":0,"comment":"null","endLoc":709,"header":"@function_helper\ndef histogram2d(x, y, bins=10, range=None, weights=None, density=None)","id":10791,"name":"histogram2d","nodeType":"Function","startLoc":675,"text":"@function_helper\ndef histogram2d(x, y, bins=10, range=None, weights=None, density=None):\n    from astropy.units import Quantity\n\n    if weights is not None:\n        weights = _as_quantity(weights)\n        unit = weights.unit\n        weights = weights.value\n    else:\n        unit = None\n\n    x, y = _as_quantities(x, y)\n    try:\n        n = len(bins)\n    except TypeError:\n        # bins should be an integer (or at least definitely not a Quantity).\n        if isinstance(bins, Quantity):\n            raise NotImplementedError\n\n    else:\n        if n == 1:\n            raise NotImplementedError\n        elif n == 2 and not isinstance(bins, Quantity):\n            bins = [_check_bins(b, unit)\n                    for (b, unit) in zip(bins, (x.unit, y.unit))]\n        else:\n            bins = _check_bins(bins, x.unit)\n            y = y.to(x.unit)\n\n    if density:\n        unit = (unit or 1) / x.unit / y.unit\n\n    return ((x.value, y.value, bins, range),\n            {'weights': weights, 'density': density},\n            (unit, x.unit, y.unit), None)"},{"col":4,"comment":"null","endLoc":225,"header":"def __enter__(self)","id":10792,"name":"__enter__","nodeType":"Function","startLoc":224,"text":"def __enter__(self):\n        pass"},{"col":4,"comment":"null","endLoc":229,"header":"def __exit__(self, type, value, tb)","id":10793,"name":"__exit__","nodeType":"Function","startLoc":227,"text":"def __exit__(self, type, value, tb):\n        for merge_strategy, enabled in self.orig_enabled.items():\n            merge_strategy.enabled = enabled"},{"col":0,"comment":"\n    Get the list of URLs in the cache. Especially useful for looking up what\n    files are stored in your cache when you don't have internet access.\n\n    The listed URLs are the keys programs should use to access the file\n    contents, but those contents may have actually been obtained from a mirror.\n    See `~download_file` for details.\n\n    Parameters\n    ----------\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    Returns\n    -------\n    cached_urls : list\n        List of cached URLs.\n\n    See Also\n    --------\n    cache_contents : obtain a dictionary listing everything in the cache\n    ","endLoc":1985,"header":"def get_cached_urls(pkgname='astropy')","id":10794,"name":"get_cached_urls","nodeType":"Function","startLoc":1960,"text":"def get_cached_urls(pkgname='astropy'):\n    \"\"\"\n    Get the list of URLs in the cache. Especially useful for looking up what\n    files are stored in your cache when you don't have internet access.\n\n    The listed URLs are the keys programs should use to access the file\n    contents, but those contents may have actually been obtained from a mirror.\n    See `~download_file` for details.\n\n    Parameters\n    ----------\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    Returns\n    -------\n    cached_urls : list\n        List of cached URLs.\n\n    See Also\n    --------\n    cache_contents : obtain a dictionary listing everything in the cache\n    \"\"\"\n    return sorted(cache_contents(pkgname=pkgname).keys())"},{"attributeType":"null","col":8,"comment":"null","endLoc":218,"id":10795,"name":"orig_enabled","nodeType":"Attribute","startLoc":218,"text":"self.orig_enabled"},{"attributeType":"null","col":8,"comment":"null","endLoc":217,"id":10796,"name":"merge_strategies","nodeType":"Attribute","startLoc":217,"text":"self.merge_strategies"},{"col":0,"comment":"\n    Context manager to temporarily enable one or more custom metadata merge\n    strategies.\n\n    Examples\n    --------\n    Here we define a custom merge strategy that takes an int or float on\n    the left and right sides and returns a list with the two values.\n\n      >>> from astropy.utils.metadata import MergeStrategy\n      >>> class MergeNumbersAsList(MergeStrategy):\n      ...     types = ((int, float),  # left side types\n      ...              (int, float))  # right side types\n      ...     @classmethod\n      ...     def merge(cls, left, right):\n      ...         return [left, right]\n\n    By defining this class the merge strategy is automatically registered to be\n    available for use in merging. However, by default new merge strategies are\n    *not enabled*.  This prevents inadvertently changing the behavior of\n    unrelated code that is performing metadata merge operations.\n\n    In order to use the new merge strategy, use this context manager as in the\n    following example::\n\n      >>> from astropy.table import Table, vstack\n      >>> from astropy.utils.metadata import enable_merge_strategies\n      >>> t1 = Table([[1]], names=['a'])\n      >>> t2 = Table([[2]], names=['a'])\n      >>> t1.meta = {'m': 1}\n      >>> t2.meta = {'m': 2}\n      >>> with enable_merge_strategies(MergeNumbersAsList):\n      ...    t12 = vstack([t1, t2])\n      >>> t12.meta['m']\n      [1, 2]\n\n    One can supply further merge strategies as additional arguments to the\n    context manager.\n\n    As a convenience, the enabling operation is actually done by checking\n    whether the registered strategies are subclasses of the context manager\n    arguments.  This means one can define a related set of merge strategies and\n    then enable them all at once by enabling the base class.  As a trivial\n    example, *all* registered merge strategies can be enabled with::\n\n      >>> with enable_merge_strategies(MergeStrategy):\n      ...    t12 = vstack([t1, t2])\n\n    Parameters\n    ----------\n    *merge_strategies : `~astropy.utils.metadata.MergeStrategy`\n        Merge strategies that will be enabled.\n\n    ","endLoc":288,"header":"def enable_merge_strategies(*merge_strategies)","id":10797,"name":"enable_merge_strategies","nodeType":"Function","startLoc":232,"text":"def enable_merge_strategies(*merge_strategies):\n    \"\"\"\n    Context manager to temporarily enable one or more custom metadata merge\n    strategies.\n\n    Examples\n    --------\n    Here we define a custom merge strategy that takes an int or float on\n    the left and right sides and returns a list with the two values.\n\n      >>> from astropy.utils.metadata import MergeStrategy\n      >>> class MergeNumbersAsList(MergeStrategy):\n      ...     types = ((int, float),  # left side types\n      ...              (int, float))  # right side types\n      ...     @classmethod\n      ...     def merge(cls, left, right):\n      ...         return [left, right]\n\n    By defining this class the merge strategy is automatically registered to be\n    available for use in merging. However, by default new merge strategies are\n    *not enabled*.  This prevents inadvertently changing the behavior of\n    unrelated code that is performing metadata merge operations.\n\n    In order to use the new merge strategy, use this context manager as in the\n    following example::\n\n      >>> from astropy.table import Table, vstack\n      >>> from astropy.utils.metadata import enable_merge_strategies\n      >>> t1 = Table([[1]], names=['a'])\n      >>> t2 = Table([[2]], names=['a'])\n      >>> t1.meta = {'m': 1}\n      >>> t2.meta = {'m': 2}\n      >>> with enable_merge_strategies(MergeNumbersAsList):\n      ...    t12 = vstack([t1, t2])\n      >>> t12.meta['m']\n      [1, 2]\n\n    One can supply further merge strategies as additional arguments to the\n    context manager.\n\n    As a convenience, the enabling operation is actually done by checking\n    whether the registered strategies are subclasses of the context manager\n    arguments.  This means one can define a related set of merge strategies and\n    then enable them all at once by enabling the base class.  As a trivial\n    example, *all* registered merge strategies can be enabled with::\n\n      >>> with enable_merge_strategies(MergeStrategy):\n      ...    t12 = vstack([t1, t2])\n\n    Parameters\n    ----------\n    *merge_strategies : `~astropy.utils.metadata.MergeStrategy`\n        Merge strategies that will be enabled.\n\n    \"\"\"\n\n    return _EnableMergeStrategies(*merge_strategies)"},{"col":0,"comment":"null","endLoc":295,"header":"def _warn_str_func(key, left, right)","id":10798,"name":"_warn_str_func","nodeType":"Function","startLoc":291,"text":"def _warn_str_func(key, left, right):\n    out = ('Cannot merge meta key {0!r} types {1!r}'\n           ' and {2!r}, choosing {0}={3!r}'\n           .format(key, type(left), type(right), right))\n    return out"},{"col":0,"comment":"null","endLoc":754,"header":"@function_helper\ndef histogramdd(sample, bins=10, range=None, weights=None, density=None)","id":10799,"name":"histogramdd","nodeType":"Function","startLoc":712,"text":"@function_helper\ndef histogramdd(sample, bins=10, range=None, weights=None, density=None):\n    if weights is not None:\n        weights = _as_quantity(weights)\n        unit = weights.unit\n        weights = weights.value\n    else:\n        unit = None\n\n    try:\n        # Sample is an ND-array.\n        _, D = sample.shape\n    except (AttributeError, ValueError):\n        # Sample is a sequence of 1D arrays.\n        sample = _as_quantities(*sample)\n        sample_units = [s.unit for s in sample]\n        sample = [s.value for s in sample]\n        D = len(sample)\n    else:\n        sample = _as_quantity(sample)\n        sample_units = [sample.unit] * D\n\n    try:\n        M = len(bins)\n    except TypeError:\n        # bins should be an integer\n        from astropy.units import Quantity\n\n        if isinstance(bins, Quantity):\n            raise NotImplementedError\n    else:\n        if M != D:\n            raise ValueError(\n                'The dimension of bins must be equal to the dimension of the '\n                ' sample x.')\n        bins = [_check_bins(b, unit)\n                for (b, unit) in zip(bins, sample_units)]\n\n    if density:\n        unit = functools.reduce(operator.truediv, sample_units, (unit or 1))\n\n    return ((sample, bins, range), {'weights': weights, 'density': density},\n            (unit, sample_units), None)"},{"col":0,"comment":"null","endLoc":300,"header":"def _error_str_func(key, left, right)","id":10800,"name":"_error_str_func","nodeType":"Function","startLoc":298,"text":"def _error_str_func(key, left, right):\n    out = f'Cannot merge meta key {key!r} types {type(left)!r} and {type(right)!r}'\n    return out"},{"col":0,"comment":"Exports the cache contents as a ZIP file.\n\n    Parameters\n    ----------\n    filename_or_obj : str or file-like\n        Where to put the created ZIP file. Must be something the zipfile\n        module can write to.\n    urls : iterable of str or None\n        The URLs to include in the exported cache. The default is all\n        URLs currently in the cache. If a URL is included in this list\n        but is not currently in the cache, a KeyError will be raised.\n        To ensure that all are in the cache use `~download_file`\n        or `~download_files_in_parallel`.\n    overwrite : bool, optional\n        If filename_or_obj is a filename that exists, it will only be\n        overwritten if this is True.\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    See Also\n    --------\n    import_download_cache : import the contents of such a ZIP file\n    import_file_to_cache : import a single file directly\n    ","endLoc":2046,"header":"def export_download_cache(filename_or_obj, urls=None, overwrite=False, pkgname='astropy')","id":10801,"name":"export_download_cache","nodeType":"Function","startLoc":2011,"text":"def export_download_cache(filename_or_obj, urls=None, overwrite=False, pkgname='astropy'):\n    \"\"\"Exports the cache contents as a ZIP file.\n\n    Parameters\n    ----------\n    filename_or_obj : str or file-like\n        Where to put the created ZIP file. Must be something the zipfile\n        module can write to.\n    urls : iterable of str or None\n        The URLs to include in the exported cache. The default is all\n        URLs currently in the cache. If a URL is included in this list\n        but is not currently in the cache, a KeyError will be raised.\n        To ensure that all are in the cache use `~download_file`\n        or `~download_files_in_parallel`.\n    overwrite : bool, optional\n        If filename_or_obj is a filename that exists, it will only be\n        overwritten if this is True.\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    See Also\n    --------\n    import_download_cache : import the contents of such a ZIP file\n    import_file_to_cache : import a single file directly\n    \"\"\"\n    if urls is None:\n        urls = get_cached_urls(pkgname)\n    with zipfile.ZipFile(filename_or_obj, 'w' if overwrite else 'x') as z:\n        for u in urls:\n            fn = download_file(u, cache=True, sources=[], pkgname=pkgname)\n            # Do not use os.path.join because ZIP files want\n            # \"/\" on all platforms\n            z_fn = urllib.parse.quote(u, safe=\"\")\n            z.write(fn, z_fn)"},{"col":0,"comment":"null","endLoc":344,"header":"def get_erfa_helpers()","id":10802,"name":"get_erfa_helpers","nodeType":"Function","startLoc":303,"text":"def get_erfa_helpers():\n    ERFA_HELPERS = {}\n    ERFA_HELPERS[erfa_ufunc.s2c] = helper_s2c\n    ERFA_HELPERS[erfa_ufunc.s2p] = helper_s2p\n    ERFA_HELPERS[erfa_ufunc.c2s] = helper_c2s\n    ERFA_HELPERS[erfa_ufunc.p2s] = helper_p2s\n    ERFA_HELPERS[erfa_ufunc.pm] = helper_invariant\n    ERFA_HELPERS[erfa_ufunc.cpv] = helper_invariant\n    ERFA_HELPERS[erfa_ufunc.p2pv] = helper_p2pv\n    ERFA_HELPERS[erfa_ufunc.pv2p] = helper_pv2p\n    ERFA_HELPERS[erfa_ufunc.pv2s] = helper_pv2s\n    ERFA_HELPERS[erfa_ufunc.pvdpv] = helper_pv_multiplication\n    ERFA_HELPERS[erfa_ufunc.pvxpv] = helper_pv_multiplication\n    ERFA_HELPERS[erfa_ufunc.pvm] = helper_pvm\n    ERFA_HELPERS[erfa_ufunc.pvmpv] = helper_twoarg_invariant\n    ERFA_HELPERS[erfa_ufunc.pvppv] = helper_twoarg_invariant\n    ERFA_HELPERS[erfa_ufunc.pvstar] = helper_pvstar\n    ERFA_HELPERS[erfa_ufunc.pvtob] = helper_pvtob\n    ERFA_HELPERS[erfa_ufunc.pvu] = helper_pvu\n    ERFA_HELPERS[erfa_ufunc.pvup] = helper_pvup\n    ERFA_HELPERS[erfa_ufunc.pdp] = helper_multiplication\n    ERFA_HELPERS[erfa_ufunc.pxp] = helper_multiplication\n    ERFA_HELPERS[erfa_ufunc.rxp] = helper_multiplication\n    ERFA_HELPERS[erfa_ufunc.rxpv] = helper_multiplication\n    ERFA_HELPERS[erfa_ufunc.s2pv] = helper_s2pv\n    ERFA_HELPERS[erfa_ufunc.s2xpv] = helper_s2xpv\n    ERFA_HELPERS[erfa_ufunc.starpv] = helper_starpv\n    ERFA_HELPERS[erfa_ufunc.sxpv] = helper_multiplication\n    ERFA_HELPERS[erfa_ufunc.trxpv] = helper_multiplication\n    ERFA_HELPERS[erfa_ufunc.gc2gd] = helper_gc2gd\n    ERFA_HELPERS[erfa_ufunc.gd2gc] = helper_gd2gc\n    ERFA_HELPERS[erfa_ufunc.ldn] = helper_ldn\n    ERFA_HELPERS[erfa_ufunc.aper] = helper_aper\n    ERFA_HELPERS[erfa_ufunc.apio] = helper_apio\n    ERFA_HELPERS[erfa_ufunc.atciq] = helper_atciq\n    ERFA_HELPERS[erfa_ufunc.atciqn] = helper_atciqn\n    ERFA_HELPERS[erfa_ufunc.atciqz] = helper_atciqz_aticq\n    ERFA_HELPERS[erfa_ufunc.aticq] = helper_atciqz_aticq\n    ERFA_HELPERS[erfa_ufunc.aticqn] = helper_aticqn\n    ERFA_HELPERS[erfa_ufunc.atioq] = helper_atioq\n    ERFA_HELPERS[erfa_ufunc.atoiq] = helper_atoiq\n    return ERFA_HELPERS"},{"attributeType":"null","col":26,"comment":"null","endLoc":6,"id":10803,"name":"erfa_ufunc","nodeType":"Attribute","startLoc":6,"text":"erfa_ufunc"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":10804,"name":"erfa_ufuncs","nodeType":"Attribute","startLoc":15,"text":"erfa_ufuncs"},{"col":0,"comment":"","endLoc":3,"header":"erfa.py#<anonymous>","id":10805,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"Quantity helpers for the ERFA ufuncs.\"\"\"\n\nerfa_ufuncs = ('s2c', 's2p', 'c2s', 'p2s', 'pm', 'pdp', 'pxp', 'rxp',\n               'cpv', 'p2pv', 'pv2p', 'pv2s', 'pvdpv', 'pvm', 'pvmpv', 'pvppv',\n               'pvstar', 'pvtob', 'pvu', 'pvup', 'pvxpv', 'rxpv', 's2pv', 's2xpv',\n               'starpv', 'sxpv', 'trxpv', 'gd2gc', 'gc2gd', 'ldn', 'aper',\n               'apio', 'atciq', 'atciqn', 'atciqz', 'aticq', 'atioq', 'atoiq')\n\nUFUNC_HELPERS.register_module('erfa.ufunc', erfa_ufuncs,\n                              get_erfa_helpers)"},{"col":0,"comment":"null","endLoc":764,"header":"@function_helper\ndef diff(a, n=1, axis=-1, prepend=np._NoValue, append=np._NoValue)","id":10806,"name":"diff","nodeType":"Function","startLoc":757,"text":"@function_helper\ndef diff(a, n=1, axis=-1, prepend=np._NoValue, append=np._NoValue):\n    a = _as_quantity(a)\n    if prepend is not np._NoValue:\n        prepend = _as_quantity(prepend).to_value(a.unit)\n    if append is not np._NoValue:\n        append = _as_quantity(append).to_value(a.unit)\n    return (a.value, n, axis, prepend, append), {}, a.unit, None"},{"col":0,"comment":"Imports the contents of a ZIP file into the cache.\n\n    Each member of the ZIP file should be named by a quoted version of the\n    URL whose contents it stores. These names are decoded with\n    :func:`~urllib.parse.unquote`.\n\n    Parameters\n    ----------\n    filename_or_obj : str or file-like\n        Where the stored ZIP file is. Must be something the :mod:`~zipfile`\n        module can read from.\n    urls : set of str or list of str or None\n        The URLs to import from the ZIP file. The default is all\n        URLs in the file.\n    update_cache : bool, optional\n        If True, any entry in the ZIP file will overwrite the value in the\n        cache; if False, leave untouched any entry already in the cache.\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    See Also\n    --------\n    export_download_cache : export the contents the cache to of such a ZIP file\n    import_file_to_cache : import a single file directly\n    ","endLoc":2097,"header":"def import_download_cache(filename_or_obj, urls=None, update_cache=False, pkgname='astropy')","id":10807,"name":"import_download_cache","nodeType":"Function","startLoc":2049,"text":"def import_download_cache(filename_or_obj, urls=None, update_cache=False, pkgname='astropy'):\n    \"\"\"Imports the contents of a ZIP file into the cache.\n\n    Each member of the ZIP file should be named by a quoted version of the\n    URL whose contents it stores. These names are decoded with\n    :func:`~urllib.parse.unquote`.\n\n    Parameters\n    ----------\n    filename_or_obj : str or file-like\n        Where the stored ZIP file is. Must be something the :mod:`~zipfile`\n        module can read from.\n    urls : set of str or list of str or None\n        The URLs to import from the ZIP file. The default is all\n        URLs in the file.\n    update_cache : bool, optional\n        If True, any entry in the ZIP file will overwrite the value in the\n        cache; if False, leave untouched any entry already in the cache.\n    pkgname : `str`, optional\n        The package name to use to locate the download cache. i.e. for\n        ``pkgname='astropy'`` the default cache location is\n        ``~/.astropy/cache``.\n\n    See Also\n    --------\n    export_download_cache : export the contents the cache to of such a ZIP file\n    import_file_to_cache : import a single file directly\n    \"\"\"\n    with zipfile.ZipFile(filename_or_obj, 'r') as z, TemporaryDirectory() as d:\n        for i, zf in enumerate(z.infolist()):\n            url = urllib.parse.unquote(zf.filename)\n            # FIXME(aarchiba): do we want some kind of validation on this URL?\n            # urllib.parse might do something sensible...but what URLs might\n            # they have?\n            # is_url in this file is probably a good check, not just here\n            # but throughout this file.\n            if urls is not None and url not in urls:\n                continue\n            if not update_cache and is_url_in_cache(url, pkgname=pkgname):\n                continue\n            f_temp_name = os.path.join(d, str(i))\n            with z.open(zf) as f_zip, open(f_temp_name, \"wb\") as f_temp:\n                block = f_zip.read(conf.download_block_size)\n                while block:\n                    f_temp.write(block)\n                    block = f_zip.read(conf.download_block_size)\n            import_file_to_cache(url, f_temp_name,\n                                 remove_original=True,\n                                 pkgname=pkgname)"},{"fileName":"check.py","filePath":"astropy/utils/xml","id":10808,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nA collection of functions for checking various XML-related strings for\nstandards compliance.\n\"\"\"\n\n\nimport re\nimport urllib.parse\n\n\ndef check_id(ID):\n    \"\"\"\n    Returns `True` if *ID* is a valid XML ID.\n    \"\"\"\n    return re.match(r\"^[A-Za-z_][A-Za-z0-9_\\.\\-]*$\", ID) is not None\n\n\ndef fix_id(ID):\n    \"\"\"\n    Given an arbitrary string, create one that can be used as an xml\n    id.  This is rather simplistic at the moment, since it just\n    replaces non-valid characters with underscores.\n    \"\"\"\n    if re.match(r\"^[A-Za-z_][A-Za-z0-9_\\.\\-]*$\", ID):\n        return ID\n    if len(ID):\n        corrected = ID\n        if not len(corrected) or re.match('^[^A-Za-z_]$', corrected[0]):\n            corrected = '_' + corrected\n        corrected = (re.sub(r\"[^A-Za-z_]\", '_', corrected[0]) +\n                     re.sub(r\"[^A-Za-z0-9_\\.\\-]\", \"_\", corrected[1:]))\n        return corrected\n    return ''\n\n\n_token_regex = r\"(?![\\r\\l\\t ])[^\\r\\l\\t]*(?![\\r\\l\\t ])\"\n\n\ndef check_token(token):\n    \"\"\"\n    Returns `True` if *token* is a valid XML token, as defined by XML\n    Schema Part 2.\n    \"\"\"\n    return (token == '' or\n            re.match(\n                r\"[^\\r\\n\\t ]?([^\\r\\n\\t ]| [^\\r\\n\\t ])*[^\\r\\n\\t ]?$\", token)\n            is not None)\n\n\ndef check_mime_content_type(content_type):\n    \"\"\"\n    Returns `True` if *content_type* is a valid MIME content type\n    (syntactically at least), as defined by RFC 2045.\n    \"\"\"\n    ctrls = ''.join(chr(x) for x in range(0, 0x20))\n    token_regex = f'[^()<>@,;:\\\\\\\"/[\\\\]?= {ctrls}\\x7f]+'\n    return re.match(\n        fr'(?P<type>{token_regex})/(?P<subtype>{token_regex})$',\n        content_type) is not None\n\n\ndef check_anyuri(uri):\n    \"\"\"\n    Returns `True` if *uri* is a valid URI as defined in RFC 2396.\n    \"\"\"\n    if (re.match(\n        (r\"(([a-zA-Z][0-9a-zA-Z+\\-\\.]*:)?/{0,2}[0-9a-zA-Z;\" +\n         r\"/?:@&=+$\\.\\-_!~*'()%]+)?(#[0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?\"),\n        uri) is None):\n        return False\n    try:\n        urllib.parse.urlparse(uri)\n    except Exception:\n        return False\n    return True\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":10809,"name":"_token_regex","nodeType":"Attribute","startLoc":37,"text":"_token_regex"},{"col":0,"comment":"","endLoc":5,"header":"check.py#<anonymous>","id":10810,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nA collection of functions for checking various XML-related strings for\nstandards compliance.\n\"\"\"\n\n_token_regex = r\"(?![\\r\\l\\t ])[^\\r\\l\\t]*(?![\\r\\l\\t ])\""},{"col":0,"comment":"null","endLoc":792,"header":"@function_helper\ndef gradient(f, *varargs, **kwargs)","id":10811,"name":"gradient","nodeType":"Function","startLoc":767,"text":"@function_helper\ndef gradient(f, *varargs, **kwargs):\n    f = _as_quantity(f)\n    axis = kwargs.get('axis', None)\n    if axis is None:\n        n_axis = f.ndim\n    elif isinstance(axis, tuple):\n        n_axis = len(axis)\n    else:\n        n_axis = 1\n\n    if varargs:\n        varargs = _as_quantities(*varargs)\n        if len(varargs) == 1 and n_axis > 1:\n            varargs = varargs * n_axis\n\n    if varargs:\n        units = [f.unit / q.unit for q in varargs]\n        varargs = tuple(q.value for q in varargs)\n    else:\n        units = [f.unit] * n_axis\n\n    if len(units) == 1:\n        units = units[0]\n\n    return (f.value,) + varargs, kwargs, units, None"},{"fileName":"validate.py","filePath":"astropy/utils/xml","id":10812,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nFunctions to do XML schema and DTD validation.  At the moment, this\nmakes a subprocess call to xmllint.  This could use a Python-based\nlibrary at some point in the future, if something appropriate could be\nfound.\n\"\"\"\n\n\nimport os\nimport subprocess\n\n\ndef validate_schema(filename, schema_file):\n    \"\"\"\n    Validates an XML file against a schema or DTD.\n\n    Parameters\n    ----------\n    filename : str\n        The path to the XML file to validate\n\n    schema_file : str\n        The path to the XML schema or DTD\n\n    Returns\n    -------\n    returncode, stdout, stderr : int, str, str\n        Returns the returncode from xmllint and the stdout and stderr\n        as strings\n    \"\"\"\n\n    base, ext = os.path.splitext(schema_file)\n    if ext == '.xsd':\n        schema_part = '--schema ' + schema_file\n    elif ext == '.dtd':\n        schema_part = '--dtdvalid ' + schema_file\n    else:\n        raise TypeError(\"schema_file must be a path to an XML Schema or DTD\")\n\n    p = subprocess.Popen(\n        f\"xmllint --noout --nonet {schema_part} {filename}\",\n        shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n    stdout, stderr = p.communicate()\n\n    if p.returncode == 127:\n        raise OSError(\n            \"xmllint not found, so can not validate schema\")\n    elif p.returncode < 0:\n        from astropy.utils.misc import signal_number_to_name\n        raise OSError(\n            \"xmllint was terminated by signal '{}'\".format(\n                signal_number_to_name(-p.returncode)))\n\n    return p.returncode, stdout, stderr\n"},{"col":0,"comment":"","endLoc":8,"header":"validate.py#<anonymous>","id":10813,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nFunctions to do XML schema and DTD validation.  At the moment, this\nmakes a subprocess call to xmllint.  This could use a Python-based\nlibrary at some point in the future, if something appropriate could be\nfound.\n\"\"\""},{"fileName":"__init__.py","filePath":"astropy/utils/xml","id":10814,"nodeType":"File","text":""},{"fileName":"writer.py","filePath":"astropy/utils/xml","id":10815,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nContains a class that makes it simple to stream out well-formed and\nnicely-indented XML.\n\"\"\"\n\n# STDLIB\nimport contextlib\nimport textwrap\n\ntry:\n    from . import _iterparser\nexcept ImportError:\n    def xml_escape_cdata(s):\n        \"\"\"\n        Escapes &, < and > in an XML CDATA string.\n        \"\"\"\n        s = s.replace(\"&\", \"&amp;\")\n        s = s.replace(\"<\", \"&lt;\")\n        s = s.replace(\">\", \"&gt;\")\n        return s\n\n    def xml_escape(s):\n        \"\"\"\n        Escapes &, ', \", < and > in an XML attribute value.\n        \"\"\"\n        s = s.replace(\"&\", \"&amp;\")\n        s = s.replace(\"'\", \"&apos;\")\n        s = s.replace(\"\\\"\", \"&quot;\")\n        s = s.replace(\"<\", \"&lt;\")\n        s = s.replace(\">\", \"&gt;\")\n        return s\nelse:\n    xml_escape_cdata = _iterparser.escape_xml_cdata\n    xml_escape = _iterparser.escape_xml\n\n\nclass XMLWriter:\n    \"\"\"\n    A class to write well-formed and nicely indented XML.\n\n    Use like this::\n\n        w = XMLWriter(fh)\n        with w.tag('html'):\n            with w.tag('body'):\n                w.data('This is the content')\n\n    Which produces::\n\n        <html>\n         <body>\n          This is the content\n         </body>\n        </html>\n    \"\"\"\n\n    def __init__(self, file):\n        \"\"\"\n        Parameters\n        ----------\n        file : writable file-like\n        \"\"\"\n        self.write = file.write\n        if hasattr(file, \"flush\"):\n            self.flush = file.flush\n        self._open = 0  # true if start tag is open\n        self._tags = []\n        self._data = []\n        self._indentation = \" \" * 64\n\n        self.xml_escape_cdata = xml_escape_cdata\n        self.xml_escape = xml_escape\n\n    def _flush(self, indent=True, wrap=False):\n        \"\"\"\n        Flush internal buffers.\n        \"\"\"\n        if self._open:\n            if indent:\n                self.write(\">\\n\")\n            else:\n                self.write(\">\")\n            self._open = 0\n        if self._data:\n            data = ''.join(self._data)\n            if wrap:\n                indent = self.get_indentation_spaces(1)\n                data = textwrap.fill(\n                    data,\n                    initial_indent=indent,\n                    subsequent_indent=indent)\n                self.write('\\n')\n                self.write(self.xml_escape_cdata(data))\n                self.write('\\n')\n                self.write(self.get_indentation_spaces())\n            else:\n                self.write(self.xml_escape_cdata(data))\n            self._data = []\n\n    def start(self, tag, attrib={}, **extra):\n        \"\"\"\n        Opens a new element.  Attributes can be given as keyword\n        arguments, or as a string/string dictionary.  The method\n        returns an opaque identifier that can be passed to the\n        :meth:`close` method, to close all open elements up to and\n        including this one.\n\n        Parameters\n        ----------\n        tag : str\n            The element name\n\n        attrib : dict of str -> str\n            Attribute dictionary.  Alternatively, attributes can\n            be given as keyword arguments.\n\n        Returns\n        -------\n        id : int\n            Returns an element identifier.\n        \"\"\"\n        self._flush()\n        # This is just busy work -- we know our tag names are clean\n        # tag = xml_escape_cdata(tag)\n        self._data = []\n        self._tags.append(tag)\n        self.write(self.get_indentation_spaces(-1))\n        self.write(f\"<{tag}\")\n        if attrib or extra:\n            attrib = attrib.copy()\n            attrib.update(extra)\n            attrib = list(attrib.items())\n            attrib.sort()\n            for k, v in attrib:\n                if v is not None:\n                    # This is just busy work -- we know our keys are clean\n                    # k = xml_escape_cdata(k)\n                    v = self.xml_escape(v)\n                    self.write(f\" {k}=\\\"{v}\\\"\")\n        self._open = 1\n\n        return len(self._tags)\n\n    @contextlib.contextmanager\n    def xml_cleaning_method(self, method='escape_xml', **clean_kwargs):\n        \"\"\"Context manager to control how XML data tags are cleaned (escaped) to\n        remove potentially unsafe characters or constructs.\n\n        The default (``method='escape_xml'``) applies brute-force escaping of\n        certain key XML characters like ``<``, ``>``, and ``&`` to ensure that\n        the output is not valid XML.\n\n        In order to explicitly allow certain XML tags (e.g. link reference or\n        emphasis tags), use ``method='bleach_clean'``.  This sanitizes the data\n        string using the ``clean`` function of the\n        `bleach <https://bleach.readthedocs.io/en/latest/clean.html>`_ package.\n        Any additional keyword arguments will be passed directly to the\n        ``clean`` function.\n\n        Finally, use ``method='none'`` to disable any sanitization. This should\n        be used sparingly.\n\n        Example::\n\n          w = writer.XMLWriter(ListWriter(lines))\n          with w.xml_cleaning_method('bleach_clean'):\n              w.start('td')\n              w.data('<a href=\"https://google.com\">google.com</a>')\n              w.end()\n\n        Parameters\n        ----------\n        method : str\n            Cleaning method.  Allowed values are \"escape_xml\",\n            \"bleach_clean\", and \"none\".\n\n        **clean_kwargs : keyword args\n            Additional keyword args that are passed to the\n            bleach.clean() function.\n        \"\"\"\n        current_xml_escape_cdata = self.xml_escape_cdata\n\n        if method == 'bleach_clean':\n            # NOTE: bleach is imported locally to avoid importing it when\n            # it is not nocessary\n            try:\n                import bleach\n            except ImportError:\n                raise ValueError('bleach package is required when HTML escaping is disabled.\\n'\n                                 'Use \"pip install bleach\".')\n\n            if clean_kwargs is None:\n                clean_kwargs = {}\n            self.xml_escape_cdata = lambda x: bleach.clean(x, **clean_kwargs)\n        elif method == \"none\":\n            self.xml_escape_cdata = lambda x: x\n        elif method != 'escape_xml':\n            raise ValueError('allowed values of method are \"escape_xml\", \"bleach_clean\", and \"none\"')\n\n        yield\n\n        self.xml_escape_cdata = current_xml_escape_cdata\n\n    @contextlib.contextmanager\n    def tag(self, tag, attrib={}, **extra):\n        \"\"\"\n        A convenience method for creating wrapper elements using the\n        ``with`` statement.\n\n        Examples\n        --------\n\n        >>> with writer.tag('foo'):  # doctest: +SKIP\n        ...     writer.element('bar')\n        ... # </foo> is implicitly closed here\n        ...\n\n        Parameters are the same as to `start`.\n        \"\"\"\n        self.start(tag, attrib, **extra)\n        yield\n        self.end(tag)\n\n    def comment(self, comment):\n        \"\"\"\n        Adds a comment to the output stream.\n\n        Parameters\n        ----------\n        comment : str\n            Comment text, as a Unicode string.\n        \"\"\"\n        self._flush()\n        self.write(self.get_indentation_spaces())\n        self.write(f\"<!-- {self.xml_escape_cdata(comment)} -->\\n\")\n\n    def data(self, text):\n        \"\"\"\n        Adds character data to the output stream.\n\n        Parameters\n        ----------\n        text : str\n            Character data, as a Unicode string.\n        \"\"\"\n        self._data.append(text)\n\n    def end(self, tag=None, indent=True, wrap=False):\n        \"\"\"\n        Closes the current element (opened by the most recent call to\n        `start`).\n\n        Parameters\n        ----------\n        tag : str\n            Element name.  If given, the tag must match the start tag.\n            If omitted, the current element is closed.\n        \"\"\"\n        if tag:\n            if not self._tags:\n                raise ValueError(f\"unbalanced end({tag})\")\n            if tag != self._tags[-1]:\n                raise ValueError(f\"expected end({self._tags[-1]}), got {tag}\")\n        else:\n            if not self._tags:\n                raise ValueError(\"unbalanced end()\")\n        tag = self._tags.pop()\n        if self._data:\n            self._flush(indent, wrap)\n        elif self._open:\n            self._open = 0\n            self.write(\"/>\\n\")\n            return\n        if indent:\n            self.write(self.get_indentation_spaces())\n        self.write(f\"</{tag}>\\n\")\n\n    def close(self, id):\n        \"\"\"\n        Closes open elements, up to (and including) the element identified\n        by the given identifier.\n\n        Parameters\n        ----------\n        id : int\n            Element identifier, as returned by the `start` method.\n        \"\"\"\n        while len(self._tags) > id:\n            self.end()\n\n    def element(self, tag, text=None, wrap=False, attrib={}, **extra):\n        \"\"\"\n        Adds an entire element.  This is the same as calling `start`,\n        `data`, and `end` in sequence. The ``text`` argument\n        can be omitted.\n        \"\"\"\n        self.start(tag, attrib, **extra)\n        if text:\n            self.data(text)\n        self.end(indent=False, wrap=wrap)\n\n    def flush(self):\n        pass  # replaced by the constructor\n\n    def get_indentation(self):\n        \"\"\"\n        Returns the number of indentation levels the file is currently\n        in.\n        \"\"\"\n        return len(self._tags)\n\n    def get_indentation_spaces(self, offset=0):\n        \"\"\"\n        Returns a string of spaces that matches the current\n        indentation level.\n        \"\"\"\n        return self._indentation[:len(self._tags) + offset]\n\n    @staticmethod\n    def object_attrs(obj, attrs):\n        \"\"\"\n        Converts an object with a bunch of attributes on an object\n        into a dictionary for use by the `XMLWriter`.\n\n        Parameters\n        ----------\n        obj : object\n            Any Python object\n\n        attrs : sequence of str\n            Attribute names to pull from the object\n\n        Returns\n        -------\n        attrs : dict\n            Maps attribute names to the values retrieved from\n            ``obj.attr``.  If any of the attributes is `None`, it will\n            not appear in the output dictionary.\n        \"\"\"\n        d = {}\n        for attr in attrs:\n            if getattr(obj, attr) is not None:\n                d[attr.replace('_', '-')] = str(getattr(obj, attr))\n        return d\n"},{"col":0,"comment":"","endLoc":5,"header":"writer.py#<anonymous>","id":10816,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nContains a class that makes it simple to stream out well-formed and\nnicely-indented XML.\n\"\"\"\n\ntry:\n    from . import _iterparser\nexcept ImportError:\n    def xml_escape_cdata(s):\n        \"\"\"\n        Escapes &, < and > in an XML CDATA string.\n        \"\"\"\n        s = s.replace(\"&\", \"&amp;\")\n        s = s.replace(\"<\", \"&lt;\")\n        s = s.replace(\">\", \"&gt;\")\n        return s\n\n    def xml_escape(s):\n        \"\"\"\n        Escapes &, ', \", < and > in an XML attribute value.\n        \"\"\"\n        s = s.replace(\"&\", \"&amp;\")\n        s = s.replace(\"'\", \"&apos;\")\n        s = s.replace(\"\\\"\", \"&quot;\")\n        s = s.replace(\"<\", \"&lt;\")\n        s = s.replace(\">\", \"&gt;\")\n        return s\nelse:\n    xml_escape_cdata = _iterparser.escape_xml_cdata\n    xml_escape = _iterparser.escape_xml"},{"col":0,"comment":"null","endLoc":806,"header":"@function_helper\ndef logspace(start, stop, *args, **kwargs)","id":10817,"name":"logspace","nodeType":"Function","startLoc":795,"text":"@function_helper\ndef logspace(start, stop, *args, **kwargs):\n    from astropy.units import LogQuantity, dex\n    if (not isinstance(start, LogQuantity) or\n            not isinstance(stop, LogQuantity)):\n        raise NotImplementedError\n\n    # Get unit from end point as for linspace.\n    stop = stop.to(dex(stop.unit.physical_unit))\n    start = start.to(stop.unit)\n    unit = stop.unit.physical_unit\n    return (start.value, stop.value) + args, kwargs, unit, None"},{"fileName":"unescaper.py","filePath":"astropy/utils/xml","id":10818,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"URL unescaper functions.\"\"\"\n\n# STDLIB\nfrom xml.sax import saxutils\n\n\n__all__ = ['unescape_all']\n\n# This is DIY\n_bytes_entities = {b'&amp;': b'&', b'&lt;': b'<', b'&gt;': b'>',\n                   b'&amp;&amp;': b'&', b'&&': b'&', b'%2F': b'/'}\n_bytes_keys = [b'&amp;&amp;', b'&&', b'&amp;', b'&lt;', b'&gt;', b'%2F']\n\n# This is used by saxutils\n_str_entities = {'&amp;&amp;': '&', '&&': '&', '%2F': '/'}\n_str_keys = ['&amp;&amp;', '&&', '&amp;', '&lt;', '&gt;', '%2F']\n\n\ndef unescape_all(url):\n    \"\"\"Recursively unescape a given URL.\n\n    .. note:: '&amp;&amp;' becomes a single '&'.\n\n    Parameters\n    ----------\n    url : str or bytes\n        URL to unescape.\n\n    Returns\n    -------\n    clean_url : str or bytes\n        Unescaped URL.\n\n    \"\"\"\n    if isinstance(url, bytes):\n        func2use = _unescape_bytes\n        keys2use = _bytes_keys\n    else:\n        func2use = _unescape_str\n        keys2use = _str_keys\n    clean_url = func2use(url)\n    not_done = [clean_url.count(key) > 0 for key in keys2use]\n    if True in not_done:\n        return unescape_all(clean_url)\n    else:\n        return clean_url\n\n\ndef _unescape_str(url):\n    return saxutils.unescape(url, _str_entities)\n\n\ndef _unescape_bytes(url):\n    clean_url = url\n    for key in _bytes_keys:\n        clean_url = clean_url.replace(key, _bytes_entities[key])\n    return clean_url\n"},{"col":0,"comment":"Recursively unescape a given URL.\n\n    .. note:: '&amp;&amp;' becomes a single '&'.\n\n    Parameters\n    ----------\n    url : str or bytes\n        URL to unescape.\n\n    Returns\n    -------\n    clean_url : str or bytes\n        Unescaped URL.\n\n    ","endLoc":47,"header":"def unescape_all(url)","id":10819,"name":"unescape_all","nodeType":"Function","startLoc":20,"text":"def unescape_all(url):\n    \"\"\"Recursively unescape a given URL.\n\n    .. note:: '&amp;&amp;' becomes a single '&'.\n\n    Parameters\n    ----------\n    url : str or bytes\n        URL to unescape.\n\n    Returns\n    -------\n    clean_url : str or bytes\n        Unescaped URL.\n\n    \"\"\"\n    if isinstance(url, bytes):\n        func2use = _unescape_bytes\n        keys2use = _bytes_keys\n    else:\n        func2use = _unescape_str\n        keys2use = _str_keys\n    clean_url = func2use(url)\n    not_done = [clean_url.count(key) > 0 for key in keys2use]\n    if True in not_done:\n        return unescape_all(clean_url)\n    else:\n        return clean_url"},{"col":0,"comment":"null","endLoc":58,"header":"def _unescape_bytes(url)","id":10820,"name":"_unescape_bytes","nodeType":"Function","startLoc":54,"text":"def _unescape_bytes(url):\n    clean_url = url\n    for key in _bytes_keys:\n        clean_url = clean_url.replace(key, _bytes_entities[key])\n    return clean_url"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":10821,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":10822,"name":"MERGE_STRATEGIES","nodeType":"Attribute","startLoc":33,"text":"MERGE_STRATEGIES"},{"col":0,"comment":"","endLoc":4,"header":"metadata.py#<anonymous>","id":10823,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module contains helper functions and classes for handling metadata.\n\"\"\"\n\n__all__ = ['MergeConflictError', 'MergeConflictWarning', 'MERGE_STRATEGIES',\n           'common_dtype', 'MergePlus', 'MergeNpConcatenate', 'MergeStrategy',\n           'MergeStrategyMeta', 'enable_merge_strategies', 'merge', 'MetaData',\n           'MetaAttribute']\n\nMERGE_STRATEGIES = []"},{"id":10824,"name":"astropy/utils/xml/src","nodeType":"Package"},{"id":10825,"name":".gitignore","nodeType":"TextFile","path":"astropy/utils/xml/src","text":"!*.c\n"},{"id":10826,"name":"expat_config.h","nodeType":"TextFile","path":"astropy/utils/xml/src","text":"/* expat_config.h.  Generated from expat_config.h.in by configure.  */\n/* expat_config.h.in.  Generated from configure.ac by autoheader.  */\n\n/* Define if building universal (internal helper macro) */\n/* #undef AC_APPLE_UNIVERSAL_BUILD */\n\n/* 1234 = LILENDIAN, 4321 = BIGENDIAN */\n#define BYTEORDER 1234\n\n/* Define to 1 if you have the `arc4random' function. */\n/* #undef HAVE_ARC4RANDOM */\n\n/* Define to 1 if you have the `arc4random_buf' function. */\n/* #undef HAVE_ARC4RANDOM_BUF */\n\n/* Define to 1 if you have the <dlfcn.h> header file. */\n#define HAVE_DLFCN_H 1\n\n/* Define to 1 if you have the <fcntl.h> header file. */\n#define HAVE_FCNTL_H 1\n\n/* Define to 1 if you have the `getpagesize' function. */\n#define HAVE_GETPAGESIZE 1\n\n/* Define to 1 if you have the `getrandom' function. */\n/* #undef HAVE_GETRANDOM */\n\n/* Define to 1 if you have the <inttypes.h> header file. */\n#define HAVE_INTTYPES_H 1\n\n/* Define to 1 if you have the `bsd' library (-lbsd). */\n/* #undef HAVE_LIBBSD */\n\n/* Define to 1 if you have the <memory.h> header file. */\n#define HAVE_MEMORY_H 1\n\n/* Define to 1 if you have a working `mmap' system call. */\n#define HAVE_MMAP 1\n\n/* Define to 1 if you have the <stdint.h> header file. */\n#define HAVE_STDINT_H 1\n\n/* Define to 1 if you have the <stdlib.h> header file. */\n#define HAVE_STDLIB_H 1\n\n/* Define to 1 if you have the <strings.h> header file. */\n#define HAVE_STRINGS_H 1\n\n/* Define to 1 if you have the <string.h> header file. */\n#define HAVE_STRING_H 1\n\n/* Define to 1 if you have `syscall' and `SYS_getrandom'. */\n/* #undef HAVE_SYSCALL_GETRANDOM */\n\n/* Define to 1 if you have the <sys/param.h> header file. */\n#define HAVE_SYS_PARAM_H 1\n\n/* Define to 1 if you have the <sys/stat.h> header file. */\n#define HAVE_SYS_STAT_H 1\n\n/* Define to 1 if you have the <sys/types.h> header file. */\n#define HAVE_SYS_TYPES_H 1\n\n/* Define to 1 if you have the <unistd.h> header file. */\n#define HAVE_UNISTD_H 1\n\n/* Define to the sub-directory where libtool stores uninstalled libraries. */\n#define LT_OBJDIR \".libs/\"\n\n/* Name of package */\n#define PACKAGE \"expat\"\n\n/* Define to the address where bug reports for this package should be sent. */\n#define PACKAGE_BUGREPORT \"expat-bugs@libexpat.org\"\n\n/* Define to the full name of this package. */\n#define PACKAGE_NAME \"expat\"\n\n/* Define to the full name and version of this package. */\n#define PACKAGE_STRING \"expat 2.2.9\"\n\n/* Define to the one symbol short name of this package. */\n#define PACKAGE_TARNAME \"expat\"\n\n/* Define to the home page for this package. */\n#define PACKAGE_URL \"\"\n\n/* Define to the version of this package. */\n#define PACKAGE_VERSION \"2.2.9\"\n\n/* Define to 1 if you have the ANSI C header files. */\n#define STDC_HEADERS 1\n\n/* Version number of package */\n#define VERSION \"2.2.9\"\n\n/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most\n   significant byte first (like Motorola and SPARC, unlike Intel). */\n#if defined AC_APPLE_UNIVERSAL_BUILD\n# if defined __BIG_ENDIAN__\n#  define WORDS_BIGENDIAN 1\n# endif\n#else\n# ifndef WORDS_BIGENDIAN\n/* #  undef WORDS_BIGENDIAN */\n# endif\n#endif\n\n/* Define to allow retrieving the byte offsets for attribute names and values.\n   */\n/* #undef XML_ATTR_INFO */\n\n/* Define to specify how much context to retain around the current parse\n   point. */\n#define XML_CONTEXT_BYTES 1024\n\n/* Define to include code reading entropy from `/dev/urandom'. */\n#define XML_DEV_URANDOM 1\n\n/* Define to make parameter entity parsing functionality available. */\n#define XML_DTD 1\n\n/* Define to make XML Namespaces functionality available. */\n#define XML_NS 1\n\n/* Define to empty if `const' does not conform to ANSI C. */\n/* #undef const */\n\n/* Define to `long int' if <sys/types.h> does not define. */\n/* #undef off_t */\n\n/* Define to `unsigned int' if <sys/types.h> does not define. */\n/* #undef size_t */\n"},{"id":10827,"name":"iterparse.map","nodeType":"TextFile","path":"astropy/utils/xml/src","text":"VERS_1.0 {\n   global:\n      init_iterparser;\n      PyInit__iterparser;\n   local:\n      *;\n};\n"},{"id":10828,"name":"iterparse.c","nodeType":"TextFile","path":"astropy/utils/xml/src","text":"/******************************************************************************\n * C extension code for astropy.utils.xml.iterparse\n *\n * Everything in this file has an alternate Python implementation and\n * is included for performance reasons only.\n *\n * It has two main parts:\n *\n *   - An IterParser object which parses an XML file using the expat\n *     library, feeding expat events through a Python iterator.  It is\n *     faster and more memory efficient than the alternatives in the\n *     Python standard library because it does not build a tree of\n *     objects, and also throws away most text nodes, since for\n *     astropy.io.votable (the primary user of this library) we only\n *     care about simple text nodes contained between a single pair of\n *     open/close element nodes.  It also has an optimization for\n *     recognizing the most commonly occurring element in a VO file,\n *     \"TD\".\n *\n *   - Two functions, escape_xml() and escape_xml_cdata() that escape\n *     XML much faster than the alternatives in the Python standard\n *     library.\n ******************************************************************************/\n\n#include <stdio.h>\n#include <Python.h>\n#include \"structmember.h\"\n\n#include \"expat.h\"\n\n/******************************************************************************\n * Convenience macros and functions\n ******************************************************************************/\n#ifdef _MSC_VER\n#define inline\n#endif\n\n#undef  CLAMP\n#define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))\n\nstatic Py_ssize_t\nnext_power_of_2(Py_ssize_t n)\n{\n    /* Calculate the next-higher power of two that is >= 'n' */\n\n    /* These instructions are intended for uint32_t and originally\n       from http://www-graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2\n       Py_ssize_t is the same as the C datatype ssize_t and is\n       32/64-bits on 32-bit and 64-bit systems respectively. The implementation\n       here accounts for both.\n\n       Limitations: Since a signed size_t (ssize_t) was required for the underlying CPython implementation,\n       on 32 bit systems, it will not be possible to allocate memory sizes between\n       SSIZE_MAX and SIZE_MAX (i.e, for allocations in the range [2^31, 2^32 - 1] bytes)\n       even though such memory might be available and accessible on the (32-bit) computer. That\n       said, since the underlying CPython implementation *also* uses Py_ssize_t (i.e., ssize_t),\n       it is safe to assume that such memory allocations would probably not be usable anyway.\n\n       TLDR: Will work on 64-bit machines but be careful on 32 bit machines when reading in\n       ~ 2+ GB of memory -- @manodeep 2020-03-27\n    */\n\n    n--;\n    n |= n >> 1;\n    n |= n >> 2;\n    n |= n >> 4;\n    n |= n >> 8;\n    n |= n >> 16;\n    if(sizeof(Py_ssize_t) > 4) {\n        n |= n >> 32; /* this works for 64-bit systems but will need to be updated if (Py)_ssize_t\n                         ever increases beyond 64-bits */\n    }\n    n++;\n\n    return n;\n}\n\n/******************************************************************************\n * Python version compatibility macros\n ******************************************************************************/\n\n#if BYTEORDER == 1234\n# define TD_AS_INT      0x00004454\n# define TD_AS_INT_MASK 0x00ffffff\n#else\n# define TD_AS_INT      0x54440000\n# define TD_AS_INT_MASK 0xffffff00\n#endif\n\n/* Clang doesn't like the hackish stuff PyTuple_SET_ITEM does... */\n#ifdef __clang__\n#undef PyTuple_SET_ITEM\n#define PyTuple_SET_ITEM(a, b, c) PyTuple_SetItem((a), (b), (c))\n#endif\n\n/******************************************************************************\n * IterParser type\n ******************************************************************************/\ntypedef struct {\n    PyObject_HEAD\n    XML_Parser parser;          /* The expat parser */\n    int        done;            /* True when expat parser has read to EOF */\n\n    /* File-like object reading */\n    PyObject*  fd;              /* Python file object */\n    int        file;            /* C file descriptor */\n    PyObject*  read;            /* The read method on the file object */\n    Py_ssize_t    buffersize;      /* The size of the read buffer */\n    XML_Char*  buffer;          /* The read buffer */\n\n    /* Text nodes */\n    Py_ssize_t text_alloc;      /* The allocated size of the text buffer */\n    Py_ssize_t text_size;       /* The size of the content in the text buffer */\n    XML_Char*  text;            /* Text buffer (for returning text nodes) */\n    int        keep_text;       /* Flag: keep appending text chunks to the current text node */\n\n    /* XML event queue */\n    PyObject** queue;\n    Py_ssize_t queue_size;\n    Py_ssize_t queue_read_idx;\n    Py_ssize_t queue_write_idx;\n\n    /* Store the last Python exception so it can be returned when\n       dequeing events */\n    PyObject*  error_type;\n    PyObject*  error_value;\n    PyObject*  error_traceback;\n\n    /* Store the position for any XML exceptions that may be\n       returned later */\n    unsigned long last_line;\n    unsigned long last_col;\n\n    /* \"Constants\" for efficiency */\n    PyObject*  dict_singleton;  /* Empty dict */\n    PyObject*  td_singleton;    /* String \"TD\" */\n    PyObject*  read_args;       /* (buffersize) */\n} IterParser;\n\n/******************************************************************************\n * Tuple queue\n ******************************************************************************/\n\n/**\n * Extend the tuple queue based on the new length of the textual XML input.\n * This helps to cope with situations where the input is longer than\n * requested (as occurs with transparent decompression of the input\n * stream), and for the initial allocation to combine the logic in one place.\n */\nstatic int\nqueue_realloc(IterParser *self, Py_ssize_t req_size)\n{\n    PyObject** new_queue;\n    Py_ssize_t n = req_size / 2;\n\n    if (n <= self->queue_size)\n        return 0;\n\n    new_queue = realloc(self->queue, sizeof(PyObject*) * (size_t)n);\n\n    if (new_queue == NULL) {\n        PyErr_SetString(PyExc_MemoryError, \"Out of memory for XML parsing queue.\");\n        /*\n         * queue_realloc() is only called from IterParser_init() or\n         * IterParser_next() in situations where the queue is clear\n         * and empty.  If this function were to be used in other\n         * situations it would be wise to iterate over the queue and\n         * clear/decrement the individual references, to save work for\n         * the garbage collector (in an out-of-memory situation).\n         */\n        goto fail;\n    }\n\n    self->queue = new_queue;\n    self->queue_size = n;\n    return 0;\n\nfail:\n    free(self->queue);\n    self->queue = NULL;\n    self->queue_size = 0;\n    return -1;\n}\n\n/******************************************************************************\n * Text buffer\n ******************************************************************************/\n\n/**\n * Reallocate text buffer to the next highest power of two that fits the\n * requested size.\n */\nstatic int\ntext_realloc(IterParser *self, Py_ssize_t req_size)\n{\n    Py_ssize_t  n       = req_size;\n    char       *new_mem = NULL;\n\n    if (req_size < self->text_alloc) {\n        return 0;\n    }\n\n    /* Calculate the next-highest power of two */\n    n = next_power_of_2(n);\n\n    if (n < req_size) {\n        PyErr_SetString(PyExc_MemoryError, \"Out of memory for XML text.\");\n        return -1;\n    }\n\n    new_mem = malloc(n * sizeof(XML_Char));\n    if (new_mem == NULL) {\n        PyErr_SetString(PyExc_MemoryError, \"Out of memory for XML text.\");\n        return -1;\n    }\n\n    memcpy(new_mem, self->text, (size_t)(self->text_size + 1) * sizeof(XML_Char));\n\n    free(self->text);\n    self->text = new_mem;\n    self->text_alloc = n;\n\n    return 0;\n}\n\n#define IS_WHITESPACE(c) ((c) == (XML_Char)0x20 || \\\n                          (c) == (XML_Char)0x0d || \\\n                          (c) == (XML_Char)0x0a || \\\n                          (c) == (XML_Char)0x09)\n\n/*\n * Append text to the text buffer.\n *\n * For the first chunk of text, all whitespace characters before the\n * first non-whitespace character are stripped.  This saves time\n * stripping on the Python side later.\n */\nstatic int\ntext_append(IterParser *self, const XML_Char *data, Py_ssize_t len)\n{\n    Py_ssize_t new_size;\n\n    if (len == 0) {\n        return 0;\n    }\n\n    /* If this is the first chunk, handle whitespace */\n    if (self->text_size == 0) {\n        while (len && IS_WHITESPACE(*data)) {\n            ++data;\n            --len;\n        }\n    }\n\n    /* Grow text buffer if necessary */\n    new_size = self->text_size + len;\n    if (text_realloc(self, new_size + 1)) {\n        return -1;\n    }\n\n    memcpy(self->text + self->text_size,\n           data,\n           (size_t)len * sizeof(XML_Char));\n\n    self->text_size = new_size;\n    self->text[self->text_size] = (XML_Char)0x0;\n\n    return 0;\n}\n\n/*\n * Erase all content from the text buffer.\n */\nstatic void\ntext_clear(IterParser *self)\n{\n    self->text[0] = (XML_Char)0;\n    self->text_size = 0;\n}\n\n/******************************************************************************\n * XML event handling\n ******************************************************************************/\n\n/*\n * Make a \"position tuple\" from the current expat parser state.  This\n * is used to communicate the position of the parser within the file\n * to the Python side for generation of meaningful error messages.\n *\n * It is of the form (line, col), where line and col are both PyInts.\n */\nstatic inline PyObject*\nmake_pos(const IterParser *self)\n{\n    return Py_BuildValue(\n            \"(nn)\",\n            (size_t)self->last_line,\n            (size_t)self->last_col);\n}\n\n/*\n * Removes the namespace from an element or attribute name, that is,\n * remove everything before the first colon.  The namespace is not\n * needed to parse standards-compliant VOTable files.\n *\n * The returned pointer is an internal pointer to the buffer passed\n * in.\n */\nstatic const XML_Char *\nremove_namespace(const XML_Char *name)\n{\n    const XML_Char*  name_start = NULL;\n\n    /* If there is a namespace specifier, just chop it off */\n    for (name_start = name; *name_start != '\\0'; ++name_start) {\n        if (*name_start == ':') {\n            break;\n        }\n    }\n\n    if (*name_start == ':') {\n        ++name_start;\n    } else {\n        name_start = name;\n    }\n\n    return name_start;\n}\n\n/*\n * Handle the expat startElement event.\n */\nstatic void\nstartElement(IterParser *self, const XML_Char *name, const XML_Char **atts)\n{\n    PyObject*        pyname = NULL;\n    PyObject*        pyatts = NULL;\n    const XML_Char** att_ptr = atts;\n    const XML_Char*  name_start = NULL;\n    PyObject*        tuple = NULL;\n    PyObject*        key = NULL;\n    PyObject*        val = NULL;\n    PyObject*        pos = NULL;\n\n    /* If we've already had an error in a previous call, don't make\n       things worse. */\n    if (PyErr_Occurred() != NULL) {\n        XML_StopParser(self->parser, 0);\n        return;\n    }\n\n    /* Don't overflow the queue -- in practice this should *never* happen */\n    if (self->queue_write_idx < self->queue_size) {\n        tuple = PyTuple_New(4);\n        if (tuple == NULL) {\n            goto fail;\n        }\n\n        Py_INCREF(Py_True);\n        PyTuple_SET_ITEM(tuple, 0, Py_True);\n\n        /* This is an egregious but effective optimization.  Since by\n           far the most frequently occurring element name in a large\n           VOTABLE file is TD, we explicitly check for it here with\n           integer comparison to avoid the lookup in the interned\n           string table in PyString_InternFromString, and return a\n           singleton string for \"TD\" */\n        if ((*(int*)name & TD_AS_INT_MASK) == TD_AS_INT) {\n            Py_INCREF(self->td_singleton);\n            PyTuple_SetItem(tuple, 1, self->td_singleton);\n        } else {\n            name_start = remove_namespace(name);\n\n            pyname = PyUnicode_FromString(name_start);\n            if (pyname == NULL) {\n                goto fail;\n            }\n            PyTuple_SetItem(tuple, 1, pyname);\n            pyname = NULL;\n        }\n\n        if (*att_ptr) {\n            pyatts = PyDict_New();\n            if (pyatts == NULL) {\n                goto fail;\n            }\n            do {\n                key = PyUnicode_FromString(*att_ptr);\n                if (key == NULL) {\n                    goto fail;\n                }\n                val = PyUnicode_FromString(*(att_ptr + 1));\n                if (val == NULL) {\n                    Py_DECREF(key);\n                    goto fail;\n                }\n                if (PyDict_SetItem(pyatts, key, val)) {\n                    Py_DECREF(key);\n                    Py_DECREF(val);\n                    goto fail;\n                }\n                Py_DECREF(key);\n                Py_DECREF(val);\n                key = val = NULL;\n\n                att_ptr += 2;\n            } while (*att_ptr);\n        } else {\n            Py_INCREF(self->dict_singleton);\n            pyatts = self->dict_singleton;\n        }\n\n        PyTuple_SetItem(tuple, 2, pyatts);\n        pyatts = NULL;\n\n        self->last_line = (unsigned long)XML_GetCurrentLineNumber(\n            self->parser);\n        self->last_col = (unsigned long)XML_GetCurrentColumnNumber(\n            self->parser);\n\n        pos = make_pos(self);\n        if (pos == NULL) {\n            goto fail;\n        }\n        PyTuple_SetItem(tuple, 3, pos);\n        pos = NULL;\n\n        text_clear(self);\n\n        self->keep_text = 1;\n\n        self->queue[self->queue_write_idx++] = tuple;\n    } else {\n        PyErr_SetString(\n            PyExc_RuntimeError,\n            \"XML queue overflow in startElement.  This most likely indicates an internal bug.\");\n        goto fail;\n    }\n\n    return;\n\n fail:\n    Py_XDECREF(tuple);\n    Py_XDECREF(pyatts);\n    XML_StopParser(self->parser, 0);\n}\n\n/*\n * Handle the expat endElement event.\n */\nstatic void\nendElement(IterParser *self, const XML_Char *name)\n{\n    PyObject*       pyname     = NULL;\n    PyObject*       tuple      = NULL;\n    PyObject*       pytext     = NULL;\n    const XML_Char* name_start = NULL;\n    XML_Char*       end;\n    PyObject*       pos        = NULL;\n\n    /* If we've already had an error in a previous call, don't make\n       things worse. */\n    if (PyErr_Occurred() != NULL) {\n        XML_StopParser(self->parser, 0);\n        return;\n    }\n\n    /* Don't overflow the queue -- in practice this should *never* happen */\n    if (self->queue_write_idx < self->queue_size) {\n        tuple = PyTuple_New(4);\n        if (tuple == NULL) {\n            goto fail;\n        }\n\n        Py_INCREF(Py_False);\n        PyTuple_SET_ITEM(tuple, 0, Py_False);\n\n        /* This is an egregious but effective optimization.  Since by\n           far the most frequently occurring element name in a large\n           VOTABLE file is TD, we explicitly check for it here with\n           integer comparison to avoid the lookup in the interned\n           string table in PyString_InternFromString, and return a\n           singleton string for \"TD\" */\n        if ((*(int*)name & TD_AS_INT_MASK) == TD_AS_INT) {\n            Py_INCREF(self->td_singleton);\n            PyTuple_SetItem(tuple, 1, self->td_singleton);\n        } else {\n            name_start = remove_namespace(name);\n\n            pyname = PyUnicode_FromString(name_start);\n            if (pyname == NULL) {\n                goto fail;\n            }\n            PyTuple_SetItem(tuple, 1, pyname);\n            pyname = NULL;\n        }\n\n        /* Cut whitespace off the end of the string */\n        end = self->text + self->text_size - 1;\n        while (end >= self->text && IS_WHITESPACE(*end)) {\n            --end;\n            --self->text_size;\n        }\n\n        pytext = PyUnicode_FromStringAndSize(self->text, self->text_size);\n        if (pytext == NULL) {\n            goto fail;\n        }\n        PyTuple_SetItem(tuple, 2, pytext);\n        pytext = NULL;\n\n        pos = make_pos(self);\n        if (pos == NULL) {\n            goto fail;\n        }\n        PyTuple_SetItem(tuple, 3, pos);\n        pos = NULL;\n\n        self->keep_text = 0;\n\n        self->queue[self->queue_write_idx++] = tuple;\n    } else {\n        PyErr_SetString(\n            PyExc_RuntimeError,\n            \"XML queue overflow in endElement.  This most likely indicates an internal bug.\");\n        goto fail;\n    }\n\n    return;\n\n fail:\n    Py_XDECREF(tuple);\n    XML_StopParser(self->parser, 0);\n}\n\n/*\n * Handle the expat characterData event.\n */\nstatic void\ncharacterData(IterParser *self, const XML_Char *text, int len)\n{\n    /* If we've already had an error in a previous call, don't make\n       things worse. */\n    if (PyErr_Occurred() != NULL) {\n        XML_StopParser(self->parser, 0);\n        return;\n    }\n\n    if (self->text_size == 0) {\n        self->last_line = (unsigned long)XML_GetCurrentLineNumber(\n            self->parser);\n        self->last_col = (unsigned long)XML_GetCurrentColumnNumber(\n            self->parser);\n    }\n\n    if (self->keep_text) {\n        (void)text_append(self, text, (Py_ssize_t)len);\n    }\n}\n\n/*\n * Handle the XML declaration so that we can determine its encoding.\n */\nstatic void\nxmlDecl(IterParser *self, const XML_Char *version,\n        const XML_Char *encoding, int standalone)\n{\n    PyObject* tuple        = NULL;\n    PyObject* xml_str      = NULL;\n    PyObject* attrs        = NULL;\n    PyObject* encoding_str = NULL;\n    PyObject* version_str  = NULL;\n    PyObject* pos          = NULL;\n\n    if (self->queue_write_idx < self->queue_size) {\n        tuple = PyTuple_New(4);\n        if (tuple == NULL) {\n            goto fail;\n        }\n\n        Py_INCREF(Py_True);\n        PyTuple_SET_ITEM(tuple, 0, Py_True);\n\n        xml_str = PyUnicode_FromString(\"xml\");\n        if (xml_str == NULL) {\n            goto fail;\n        }\n        PyTuple_SET_ITEM(tuple, 1, xml_str);\n        xml_str = NULL;\n\n        attrs = PyDict_New();\n        if (attrs == NULL) {\n            goto fail;\n        }\n\n        if (encoding) {\n            encoding_str = PyUnicode_FromString(encoding);\n        } else {\n            encoding_str = PyUnicode_FromString(\"\");\n        }\n        if (encoding_str == NULL) {\n            goto fail;\n        }\n        if (PyDict_SetItemString(attrs, \"encoding\", encoding_str)) {\n            Py_DECREF(encoding_str);\n            goto fail;\n        }\n        Py_DECREF(encoding_str);\n        encoding_str = NULL;\n\n        if (version) {\n            version_str = PyUnicode_FromString(version);\n        } else {\n            version_str = PyUnicode_FromString(\"\");\n        }\n        if (version_str == NULL) {\n            goto fail;\n        }\n        if (PyDict_SetItemString(attrs, \"version\", version_str)) {\n            Py_DECREF(version_str);\n            goto fail;\n        }\n        Py_DECREF(version_str);\n        version_str = NULL;\n\n        PyTuple_SET_ITEM(tuple, 2, attrs);\n        attrs = NULL;\n\n        self->last_line = (unsigned long)XML_GetCurrentLineNumber(\n            self->parser);\n        self->last_col = (unsigned long)XML_GetCurrentColumnNumber(\n            self->parser);\n\n        pos = make_pos(self);\n        if (pos == NULL) {\n            goto fail;\n        }\n        PyTuple_SetItem(tuple, 3, pos);\n        pos = NULL;\n\n        self->queue[self->queue_write_idx++] = tuple;\n    } else {\n        PyErr_SetString(\n            PyExc_RuntimeError,\n            \"XML queue overflow in xmlDecl.  This most likely indicates an internal bug.\");\n        goto fail;\n    }\n\n    return;\n\n fail:\n    Py_XDECREF(tuple);\n    Py_XDECREF(attrs);\n    XML_StopParser(self->parser, 0);\n}\n\n/*\n * The object itself is an iterator, just return self for \"iter(self)\"\n * on the Python side.\n */\nstatic PyObject *\nIterParser_iter(IterParser* self)\n{\n    Py_INCREF(self);\n    return (PyObject*) self;\n}\n\n/*\n * Get the next element from the iterator.\n *\n * The expat event handlers above (startElement, endElement, characterData) add\n * elements to the queue, which are then dequeued by this method.\n *\n * Care must be taken to store and later raise exceptions.  Any\n * exceptions raised in the expat callbacks must be stored and then\n * later thrown once the queue is emptied, otherwise the exception is\n * raised \"too early\" in queue order.\n */\nstatic PyObject *\nIterParser_next(IterParser* self)\n{\n    PyObject*  data = NULL;\n    XML_Char*  buf;\n    Py_ssize_t buflen;\n\n    /* Is there anything in the queue to return? */\n    if (self->queue_read_idx < self->queue_write_idx) {\n        return self->queue[self->queue_read_idx++];\n    }\n\n    /* Now that the queue is empty, is there an error we need to raise? */\n    if (self->error_type) {\n        PyErr_Restore(self->error_type, self->error_value, self->error_traceback);\n        self->error_type = NULL;\n        self->error_value = NULL;\n        self->error_traceback = NULL;\n        return NULL;\n    }\n\n    /* The queue is empty -- have we already fed the entire file to\n       expat?  If so, we are done and indicate the end of the iterator\n       by simply returning NULL. */\n    if (self->done) {\n        return NULL;\n    }\n\n    self->queue_read_idx = 0;\n    self->queue_write_idx = 0;\n\n    do {\n        /* Handle a generic Python read method */\n        if (self->read) {\n            data = PyObject_CallObject(self->read, self->read_args);\n            if (data == NULL) {\n                goto fail;\n            }\n\n            if (PyBytes_AsStringAndSize(data, &buf, &buflen) == -1) {\n                Py_DECREF(data);\n                goto fail;\n            }\n\n            if (buflen < self->buffersize) {\n                /* EOF detection method only works for local regular files */\n                self->done = 1;\n            }\n        /* Handle a real C file descriptor or handle -- this is faster\n           if we've got one. */\n        } else {\n            buflen = (Py_ssize_t)read(\n                self->file, self->buffer, (size_t)self->buffersize);\n            if (buflen == -1) {\n                PyErr_SetFromErrno(PyExc_OSError);\n                goto fail;\n            } else if (buflen < self->buffersize) {\n                /* EOF detection method only works for local regular files */\n                self->done = 1;\n            }\n\n            buf = self->buffer;\n        }\n\n        if(queue_realloc(self, buflen)) {\n            Py_XDECREF(data);\n            goto fail;\n        }\n\n        /* Feed the read buffer to expat, which will call the event handlers */\n        if (XML_Parse(self->parser, buf, (int)buflen, self->done) == XML_STATUS_ERROR) {\n            /* One of the event handlers raised a Python error, make\n               note of it -- it won't be thrown until the queue is\n               emptied. */\n            if (PyErr_Occurred() != NULL) {\n                goto fail;\n            }\n\n            /* expat raised an error, make note of it -- it won't be thrown\n               until the queue is emptied. */\n            Py_XDECREF(data);\n            PyErr_Format(\n                PyExc_ValueError, \"%lu:%lu: %s\",\n                XML_GetCurrentLineNumber(self->parser),\n                XML_GetCurrentColumnNumber(self->parser),\n                XML_ErrorString(XML_GetErrorCode(self->parser)));\n            goto fail;\n        }\n        Py_XDECREF(data);\n\n        if (PyErr_Occurred() != NULL) {\n            goto fail;\n        }\n    } while (self->queue_write_idx == 0 && self->done == 0);\n\n    if (self->queue_write_idx == 0) {\n        return NULL;\n    }\n\n    if (self->queue_write_idx >= self->queue_size) {\n        PyErr_SetString(\n            PyExc_RuntimeError,\n            \"XML queue overflow.  This most likely indicates an internal bug.\");\n        return NULL;\n    }\n\n    return self->queue[self->queue_read_idx++];\n\n fail:\n    /* We got an exception somewhere along the way.  Store the exception in\n       the IterParser object, but clear the exception in the Python interpreter,\n       so we can empty the event queue and raise the exception later. */\n    PyErr_Fetch(&self->error_type, &self->error_value, &self->error_traceback);\n    PyErr_Clear();\n\n    if (self->queue_read_idx < self->queue_write_idx) {\n        return self->queue[self->queue_read_idx++];\n    }\n\n    PyErr_Restore(self->error_type, self->error_value, self->error_traceback);\n    self->error_type = NULL;\n    self->error_value = NULL;\n    self->error_traceback = NULL;\n    return NULL;\n}\n\n/******************************************************************************\n * IterParser object lifetime\n ******************************************************************************/\n\n/* To support cyclical garbage collection, all PyObject's must be\n   visited. */\nstatic int\nIterParser_traverse(IterParser *self, visitproc visit, void *arg)\n{\n    int vret;\n    Py_ssize_t read_index;\n\n    read_index = self->queue_read_idx;\n    while (read_index < self->queue_write_idx) {\n        vret = visit(self->queue[read_index++], arg);\n        if (vret != 0) return vret;\n    }\n\n    if (self->fd) {\n        vret = visit(self->fd, arg);\n        if (vret != 0) return vret;\n    }\n\n    if (self->read) {\n        vret = visit(self->read, arg);\n        if (vret != 0) return vret;\n    }\n\n    if (self->read_args) {\n        vret = visit(self->read_args, arg);\n        if (vret != 0) return vret;\n    }\n\n    if (self->dict_singleton) {\n        vret = visit(self->dict_singleton, arg);\n        if (vret != 0) return vret;\n    }\n\n    if (self->td_singleton) {\n        vret = visit(self->td_singleton, arg);\n        if (vret != 0) return vret;\n    }\n\n    if (self->error_type) {\n        vret = visit(self->error_type, arg);\n        if (vret != 0) return vret;\n    }\n\n    if (self->error_value) {\n        vret = visit(self->error_value, arg);\n        if (vret != 0) return vret;\n    }\n\n    if (self->error_traceback) {\n        vret = visit(self->error_traceback, arg);\n        if (vret != 0) return vret;\n    }\n\n    return 0;\n}\n\n/* To support cyclical garbage collection */\nstatic int\nIterParser_clear(IterParser *self)\n{\n    PyObject *tmp;\n\n    while (self->queue_read_idx < self->queue_write_idx) {\n        tmp = self->queue[self->queue_read_idx];\n        self->queue[self->queue_read_idx] = NULL;\n        Py_XDECREF(tmp);\n        self->queue_read_idx++;\n    }\n\n    tmp = self->fd;\n    self->fd = NULL;\n    Py_XDECREF(tmp);\n\n    tmp = self->read;\n    self->read = NULL;\n    Py_XDECREF(tmp);\n\n    tmp = self->read_args;\n    self->read_args = NULL;\n    Py_XDECREF(tmp);\n\n    tmp = self->dict_singleton;\n    self->dict_singleton = NULL;\n    Py_XDECREF(tmp);\n\n    tmp = self->td_singleton;\n    self->td_singleton = NULL;\n    Py_XDECREF(tmp);\n\n    tmp = self->error_type;\n    self->error_type = NULL;\n    Py_XDECREF(tmp);\n\n    tmp = self->error_value;\n    self->error_value = NULL;\n    Py_XDECREF(tmp);\n\n    tmp = self->error_traceback;\n    self->error_traceback = NULL;\n    Py_XDECREF(tmp);\n\n    return 0;\n}\n\n/*\n * Deallocate the IterParser object.  For the internal PyObject*, just\n * punt to IterParser_clear.\n */\nstatic void\nIterParser_dealloc(IterParser* self)\n{\n    IterParser_clear(self);\n\n    free(self->buffer); self->buffer = NULL;\n    free(self->queue);  self->queue = NULL;\n    free(self->text);   self->text = NULL;\n    if (self->parser != NULL) {\n        XML_ParserFree(self->parser);\n        self->parser = NULL;\n    }\n\n    Py_TYPE(self)->tp_free((PyObject*)self);\n}\n\n/*\n * Initialize the memory for an IterParser object\n */\n\nstatic PyObject *\nIterParser_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\n    IterParser *self = NULL;\n\n    self = (IterParser *)type->tp_alloc(type, 0);\n    if (self != NULL) {\n        self->parser          = NULL;\n        self->fd              = NULL;\n        self->file            = -1;\n        self->read            = NULL;\n        self->read_args       = NULL;\n        self->dict_singleton  = NULL;\n        self->td_singleton    = NULL;\n        self->buffersize      = 0;\n        self->buffer          = NULL;\n        self->queue_read_idx  = 0;\n        self->queue_write_idx = 0;\n        self->text_alloc      = 0;\n        self->text_size       = 0;\n        self->text            = NULL;\n        self->keep_text       = 0;\n        self->done            = 0;\n        self->queue_size      = 0;\n        self->queue           = NULL;\n        self->error_type      = NULL;\n        self->error_value     = NULL;\n        self->error_traceback = NULL;\n    }\n\n    return (PyObject *)self;\n}\n\n/*\n * Initialize an IterParser object\n *\n * The Python arguments are:\n *\n *    *fd*: A Python file object or a callable object\n *    *buffersize*: The size of the read buffer\n */\nstatic int\nIterParser_init(IterParser *self, PyObject *args, PyObject *kwds)\n{\n    PyObject* fd              = NULL;\n    PyObject* read            = NULL;\n    Py_ssize_t   buffersize      = 1 << 14;\n\n    static char *kwlist[] = {\"fd\", \"buffersize\", NULL};\n    if (!PyArg_ParseTupleAndKeywords(args, kwds, \"O|n:IterParser.__init__\", kwlist,\n                                     &fd, &buffersize)) {\n        return -1;\n    }\n\n    /* Keep the buffersize within a reasonable range */\n    self->buffersize = CLAMP(buffersize, (Py_ssize_t)(1 << 10), (Py_ssize_t)(1 << 24));\n#ifdef __clang__\n    /* Clang can't handle the file descriptors Python gives us,\n       so in that case, we just call the object's read method. */\n    read = PyObject_GetAttrString(fd, \"read\");\n    if (read != NULL) {\n        fd = read;\n    }\n#else\n    self->file = PyObject_AsFileDescriptor(fd);\n    if (self->file != -1) {\n        /* This is a real C file handle or descriptor.  We therefore\n           need to allocate our own read buffer, and get the real C\n           object. */\n        self->buffer = malloc((size_t)self->buffersize);\n        if (self->buffer == NULL) {\n            PyErr_SetString(PyExc_MemoryError, \"Out of memory\");\n            goto fail;\n        }\n        self->fd = fd;   Py_INCREF(self->fd);\n        lseek(self->file, 0, SEEK_SET);\n    } else\n#endif\n    if (PyCallable_Check(fd)) {\n        /* fd is a Python callable */\n        self->fd = fd;   Py_INCREF(self->fd);\n        self->read = fd; Py_INCREF(self->read);\n    } else {\n        PyErr_SetString(\n            PyExc_TypeError,\n            \"Arg 1 to iterparser must be a file object or callable object\");\n        goto fail;\n    }\n\n    PyErr_Clear();\n\n    self->queue_read_idx  = 0;\n    self->queue_write_idx = 0;\n    self->done            = 0;\n\n    self->text = malloc((size_t)buffersize * sizeof(XML_Char));\n    self->text_alloc = buffersize;\n    if (self->text == NULL) {\n        PyErr_SetString(PyExc_MemoryError, \"Out of memory\");\n        goto fail;\n    }\n    text_clear(self);\n\n    self->read_args = Py_BuildValue(\"(n)\", buffersize);\n    if (self->read_args == NULL) {\n        goto fail;\n    }\n\n    self->dict_singleton = PyDict_New();\n    if (self->dict_singleton == NULL) {\n        goto fail;\n    }\n\n    self->td_singleton = PyUnicode_FromString(\"TD\");\n    if (self->td_singleton == NULL) {\n        goto fail;\n    }\n\n    if (queue_realloc(self, buffersize)) {\n        goto fail;\n    }\n\n    /* Set up an expat parser with our callbacks */\n    self->parser = XML_ParserCreate(NULL);\n    if (self->parser == NULL) {\n        PyErr_SetString(PyExc_MemoryError, \"Out of memory\");\n        goto fail;\n    }\n    XML_SetUserData(self->parser, self);\n    XML_SetElementHandler(\n        self->parser,\n        (XML_StartElementHandler)startElement,\n        (XML_EndElementHandler)endElement);\n    XML_SetCharacterDataHandler(\n        self->parser,\n        (XML_CharacterDataHandler)characterData);\n    XML_SetXmlDeclHandler(\n        self->parser,\n        (XML_XmlDeclHandler)xmlDecl);\n\n    Py_XDECREF(read);\n\n    return 0;\n\n fail:\n    Py_XDECREF(read);\n    Py_XDECREF(self->fd);\n    Py_XDECREF(self->read);\n    free(self->text);\n    Py_XDECREF(self->dict_singleton);\n    Py_XDECREF(self->td_singleton);\n    Py_XDECREF(self->read_args);\n    free(self->queue);\n\n    return -1;\n}\n\nstatic PyMemberDef IterParser_members[] =\n{\n    {NULL}  /* Sentinel */\n};\n\nstatic PyMethodDef IterParser_methods[] =\n{\n    {NULL}  /* Sentinel */\n};\n\nstatic PyTypeObject IterParserType =\n{\n    PyVarObject_HEAD_INIT(NULL, 0)\n    \"astropy.utils.xml._iterparser.IterParser\",    /*tp_name*/\n    sizeof(IterParser),         /*tp_basicsize*/\n    0,                          /*tp_itemsize*/\n    (destructor)IterParser_dealloc, /*tp_dealloc*/\n    0,                          /*tp_print*/\n    0,                          /*tp_getattr*/\n    0,                          /*tp_setattr*/\n    0,                          /*tp_compare*/\n    0,                          /*tp_repr*/\n    0,                          /*tp_as_number*/\n    0,                          /*tp_as_sequence*/\n    0,                          /*tp_as_mapping*/\n    0,                          /*tp_hash */\n    0,                          /*tp_call*/\n    0,                          /*tp_str*/\n    0,                          /*tp_getattro*/\n    0,                          /*tp_setattro*/\n    0,                          /*tp_as_buffer*/\n    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/\n    \"IterParser objects\",       /* tp_doc */\n    (traverseproc)IterParser_traverse, /* tp_traverse */\n    (inquiry)IterParser_clear,  /* tp_clear */\n    0,                          /* tp_richcompare */\n    0,                          /* tp_weaklistoffset */\n    (getiterfunc)IterParser_iter, /* tp_iter */\n    (iternextfunc)IterParser_next, /* tp_iternext */\n    IterParser_methods,         /* tp_methods */\n    IterParser_members,         /* tp_members */\n    0,                          /* tp_getset */\n    0,                          /* tp_base */\n    0,                          /* tp_dict */\n    0,                          /* tp_descr_get */\n    0,                          /* tp_descr_set */\n    0,                          /* tp_dictoffset */\n    (initproc)IterParser_init,  /* tp_init */\n    0,                          /* tp_alloc */\n    IterParser_new,             /* tp_new */\n};\n\n/******************************************************************************\n * XML escaping\n ******************************************************************************/\n\n/* These are in reverse order by input character */\nstatic const char* escapes_cdata[] = {\n    \">\", \"&gt;\",\n    \"<\", \"&lt;\",\n    \"&\", \"&amp;\",\n    \"\\0\", \"\\0\",\n};\n\n/* These are in reverse order by input character */\nstatic const char* escapes[] = {\n    \">\", \"&gt;\",\n    \"<\", \"&lt;\",\n    \"'\", \"&apos;\",\n    \"&\", \"&amp;\",\n    \"\\\"\", \"&quot;\",\n    \"\\0\", \"\\0\"\n};\n\n/* Implementation of escape_xml.\n *\n * Returns:\n *  * 0  : No need to escape\n *  * >0 : output is escaped\n *  * -1 : error\n */\nstatic Py_ssize_t\n_escape_xml_impl(const char *input, Py_ssize_t input_len,\n                 char **output, const char **escapes)\n{\n    Py_ssize_t i;\n    int count = 0;\n    char *p = NULL;\n    const char** esc;\n    const char* ent;\n\n    for (i = 0; i < input_len; ++i) {\n        for (esc = escapes; ; esc += 2) {\n            if ((unsigned char)input[i] > **esc) {\n                break;\n            } else if (input[i] == **esc) {\n                ++count;\n                break;\n            }\n        }\n    }\n\n    if (!count) {\n        return 0;\n    }\n\n    p = malloc((input_len + 1 + count * 5) * sizeof(char));\n    if (p == NULL) {\n        PyErr_SetString(PyExc_MemoryError, \"Out of memory\");\n        return -1;\n    }\n    *output = p;\n\n    for (i = 0; i < input_len; ++i) {\n        for (esc = escapes; ; esc += 2) {\n            if ((unsigned char)input[i] > **esc) {\n                *(p++) = input[i];\n                break;\n            } else if (input[i] == **esc) {\n                for (ent = *(esc + 1); *ent != '\\0'; ++ent) {\n                    *(p++) = *ent;\n                }\n                break;\n            }\n        }\n    }\n\n    *p = 0;\n    return p - *output;\n}\n\n/*\n * Returns a copy of the given string (8-bit or Unicode) with the XML\n * control characters converted to XML character entities.\n *\n * If an 8-bit string is passed in, an 8-bit string is returned.  If a\n * Unicode string is passed in, a Unicode string is returned.\n */\nstatic PyObject*\n_escape_xml(PyObject* self, PyObject *args, const char** escapes)\n{\n    PyObject* input_obj;\n    PyObject* input_coerce = NULL;\n    PyObject* output_obj;\n    char* input = NULL;\n    Py_ssize_t input_len;\n    char* output = NULL;\n    Py_ssize_t output_len;\n\n    if (!PyArg_ParseTuple(args, \"O:escape_xml\", &input_obj)) {\n        return NULL;\n    }\n\n    /* First, try as Unicode */\n    if (!PyBytes_Check(input_obj)) {\n        input_coerce = PyObject_Str(input_obj);\n    }\n    if (input_coerce) {\n        input = (char*)PyUnicode_AsUTF8AndSize(input_coerce, &input_len);\n        if (input == NULL) {\n            Py_DECREF(input_coerce);\n            return NULL;\n        }\n\n        output_len = _escape_xml_impl(input, input_len, &output, escapes);\n        if (output_len < 0) {\n            Py_DECREF(input_coerce);\n            return NULL;\n        }\n        if (output_len > 0) {\n            Py_DECREF(input_coerce);\n            output_obj = PyUnicode_FromStringAndSize(output, output_len);\n            free(output);\n            return output_obj;\n        }\n        return input_coerce;\n    }\n\n    /* Now try as bytes */\n    input_coerce = PyObject_Bytes(input_obj);\n    if (input_coerce) {\n        if (PyBytes_AsStringAndSize(input_coerce, &input, &input_len) == -1) {\n            Py_DECREF(input_coerce);\n            return NULL;\n        }\n\n        output_len = _escape_xml_impl(input, input_len, &output, escapes);\n        if (output_len < 0) {\n            Py_DECREF(input_coerce);\n            return NULL;\n        }\n        if (output_len > 0) {\n            Py_DECREF(input_coerce);\n            output_obj = PyBytes_FromStringAndSize(output, output_len);\n            free(output);\n            return output_obj;\n        }\n        return input_coerce;\n    }\n\n    PyErr_SetString(PyExc_TypeError, \"must be convertible to str or bytes\");\n    return NULL;\n}\n\nstatic PyObject*\nescape_xml(PyObject* self, PyObject *args)\n{\n    return _escape_xml(self, args, escapes);\n}\n\nstatic PyObject*\nescape_xml_cdata(PyObject* self, PyObject *args)\n{\n    return _escape_xml(self, args, escapes_cdata);\n}\n\n/******************************************************************************\n * Module setup\n ******************************************************************************/\n\nstatic PyMethodDef module_methods[] =\n{\n    {\"escape_xml\", (PyCFunction)escape_xml, METH_VARARGS,\n     \"Fast method to escape XML strings\"},\n    {\"escape_xml_cdata\", (PyCFunction)escape_xml_cdata, METH_VARARGS,\n     \"Fast method to escape XML strings\"},\n    {NULL}  /* Sentinel */\n};\n\nstruct module_state {\n    void* none;\n};\n\nstatic int module_traverse(PyObject* m, visitproc visit, void* arg)\n{\n    return 0;\n}\n\nstatic int module_clear(PyObject* m)\n{\n    return 0;\n}\n\nstatic struct PyModuleDef moduledef = {\n    PyModuleDef_HEAD_INIT,\n    \"_iterparser\",\n    \"Fast XML parser\",\n    sizeof(struct module_state),\n    module_methods,\n    NULL,\n    module_traverse,\n    module_clear,\n    NULL\n};\n\nPyMODINIT_FUNC\nPyInit__iterparser(void)\n{\n    PyObject* m;\n    m = PyModule_Create(&moduledef);\n\n    if (m == NULL)\n        return NULL;\n\n    if (PyType_Ready(&IterParserType) < 0)\n        return NULL;\n\n    Py_INCREF(&IterParserType);\n    PyModule_AddObject(m, \"IterParser\", (PyObject *)&IterParserType);\n\n    return m;\n}\n"},{"id":10829,"name":"astropy/utils/xml/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/utils/xml/tests","id":10830,"nodeType":"File","text":""},{"id":10831,"name":"astropy/utils/iers","nodeType":"Package"},{"fileName":"iers.py","filePath":"astropy/utils/iers","id":10832,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThe astropy.utils.iers package provides access to the tables provided by\nthe International Earth Rotation and Reference Systems Service, in\nparticular allowing interpolation of published UT1-UTC values for given\ntimes.  These are used in `astropy.time` to provide UT1 values.  The polar\nmotions are also used for determining earth orientation for\ncelestial-to-terrestrial coordinate transformations\n(in `astropy.coordinates`).\n\"\"\"\n\nimport re\nfrom datetime import datetime\nfrom warnings import warn\nfrom urllib.parse import urlparse\n\nimport numpy as np\nimport erfa\n\nfrom astropy.time import Time, TimeDelta\nfrom astropy import config as _config\nfrom astropy import units as u\nfrom astropy.table import QTable, MaskedColumn\nfrom astropy.utils.data import (get_pkg_data_filename, clear_download_cache,\n                                is_url_in_cache, get_readable_fileobj)\nfrom astropy.utils.state import ScienceState\nfrom astropy import utils\nfrom astropy.utils.exceptions import AstropyWarning\n\n__all__ = ['Conf', 'conf', 'earth_orientation_table',\n           'IERS', 'IERS_B', 'IERS_A', 'IERS_Auto',\n           'FROM_IERS_B', 'FROM_IERS_A', 'FROM_IERS_A_PREDICTION',\n           'TIME_BEFORE_IERS_RANGE', 'TIME_BEYOND_IERS_RANGE',\n           'IERS_A_FILE', 'IERS_A_URL', 'IERS_A_URL_MIRROR', 'IERS_A_README',\n           'IERS_B_FILE', 'IERS_B_URL', 'IERS_B_README',\n           'IERSRangeError', 'IERSStaleWarning',\n           'LeapSeconds', 'IERS_LEAP_SECOND_FILE', 'IERS_LEAP_SECOND_URL',\n           'IETF_LEAP_SECOND_URL']\n\n# IERS-A default file name, URL, and ReadMe with content description\nIERS_A_FILE = 'finals2000A.all'\nIERS_A_URL = 'ftp://anonymous:mail%40astropy.org@gdc.cddis.eosdis.nasa.gov/pub/products/iers/finals2000A.all'  # noqa: E501\nIERS_A_URL_MIRROR = 'https://datacenter.iers.org/data/9/finals2000A.all'\nIERS_A_README = get_pkg_data_filename('data/ReadMe.finals2000A')\n\n# IERS-B default file name, URL, and ReadMe with content description\nIERS_B_FILE = get_pkg_data_filename('data/eopc04_IAU2000.62-now')\nIERS_B_URL = 'http://hpiers.obspm.fr/iers/eop/eopc04/eopc04_IAU2000.62-now'\nIERS_B_README = get_pkg_data_filename('data/ReadMe.eopc04_IAU2000')\n\n# LEAP SECONDS default file name, URL, and alternative format/URL\nIERS_LEAP_SECOND_FILE = get_pkg_data_filename('data/Leap_Second.dat')\nIERS_LEAP_SECOND_URL = 'https://hpiers.obspm.fr/iers/bul/bulc/Leap_Second.dat'\nIETF_LEAP_SECOND_URL = 'https://www.ietf.org/timezones/data/leap-seconds.list'\n\n# Status/source values returned by IERS.ut1_utc\nFROM_IERS_B = 0\nFROM_IERS_A = 1\nFROM_IERS_A_PREDICTION = 2\nTIME_BEFORE_IERS_RANGE = -1\nTIME_BEYOND_IERS_RANGE = -2\n\nMJD_ZERO = 2400000.5\n\nINTERPOLATE_ERROR = \"\"\"\\\ninterpolating from IERS_Auto using predictive values that are more\nthan {0} days old.\n\nNormally you should not see this error because this class\nautomatically downloads the latest IERS-A table.  Perhaps you are\noffline?  If you understand what you are doing then this error can be\nsuppressed by setting the auto_max_age configuration variable to\n``None``:\n\n  from astropy.utils.iers import conf\n  conf.auto_max_age = None\n\"\"\"\n\nMONTH_ABBR = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug',\n              'Sep', 'Oct', 'Nov', 'Dec']\n\n\ndef download_file(*args, **kwargs):\n    \"\"\"\n    Overload astropy.utils.data.download_file within iers module to use a\n    custom (longer) wait time.  This just passes through ``*args`` and\n    ``**kwargs`` after temporarily setting the download_file remote timeout to\n    the local ``iers.conf.remote_timeout`` value.\n    \"\"\"\n    kwargs.setdefault('http_headers', {'User-Agent': 'astropy/iers',\n                                       'Accept': '*/*'})\n\n    with utils.data.conf.set_temp('remote_timeout', conf.remote_timeout):\n        return utils.data.download_file(*args, **kwargs)\n\n\ndef _none_to_float(value):\n    \"\"\"\n    Convert None to a valid floating point value.  Especially\n    for auto_max_age = None.\n    \"\"\"\n    return (value if value is not None else np.finfo(float).max)\n\n\nclass IERSStaleWarning(AstropyWarning):\n    pass\n\n\nclass Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.utils.iers`.\n    \"\"\"\n    auto_download = _config.ConfigItem(\n        True,\n        'Enable auto-downloading of the latest IERS data.  If set to False '\n        'then the local IERS-B file will be used by default (even if the '\n        'full IERS file with predictions was already downloaded and cached). '\n        'This parameter also controls whether internet resources will be '\n        'queried to update the leap second table if the installed version is '\n        'out of date. Default is True.')\n    auto_max_age = _config.ConfigItem(\n        30.0,\n        'Maximum age (days) of predictive data before auto-downloading. '\n        'See \"Auto refresh behavior\" in astropy.utils.iers documentation for details. '\n        'Default is 30.')\n    iers_auto_url = _config.ConfigItem(\n        IERS_A_URL,\n        'URL for auto-downloading IERS file data.')\n    iers_auto_url_mirror = _config.ConfigItem(\n        IERS_A_URL_MIRROR,\n        'Mirror URL for auto-downloading IERS file data.')\n    remote_timeout = _config.ConfigItem(\n        10.0,\n        'Remote timeout downloading IERS file data (seconds).')\n    system_leap_second_file = _config.ConfigItem(\n        '',\n        'System file with leap seconds.')\n    iers_leap_second_auto_url = _config.ConfigItem(\n        IERS_LEAP_SECOND_URL,\n        'URL for auto-downloading leap seconds.')\n    ietf_leap_second_auto_url = _config.ConfigItem(\n        IETF_LEAP_SECOND_URL,\n        'Alternate URL for auto-downloading leap seconds.')\n\n\nconf = Conf()\n\n\nclass IERSRangeError(IndexError):\n    \"\"\"\n    Any error for when dates are outside of the valid range for IERS\n    \"\"\"\n\n\nclass IERS(QTable):\n    \"\"\"Generic IERS table class, defining interpolation functions.\n\n    Sub-classed from `astropy.table.QTable`.  The table should hold columns\n    'MJD', 'UT1_UTC', 'dX_2000A'/'dY_2000A', and 'PM_x'/'PM_y'.\n    \"\"\"\n\n    iers_table = None\n    \"\"\"Cached table, returned if ``open`` is called without arguments.\"\"\"\n\n    @classmethod\n    def open(cls, file=None, cache=False, **kwargs):\n        \"\"\"Open an IERS table, reading it from a file if not loaded before.\n\n        Parameters\n        ----------\n        file : str or None\n            full local or network path to the ascii file holding IERS data,\n            for passing on to the ``read`` class methods (further optional\n            arguments that are available for some IERS subclasses can be added).\n            If None, use the default location from the ``read`` class method.\n        cache : bool\n            Whether to use cache. Defaults to False, since IERS files\n            are regularly updated.\n\n        Returns\n        -------\n        IERS\n            An IERS table class instance\n\n        Notes\n        -----\n        On the first call in a session, the table will be memoized (in the\n        ``iers_table`` class attribute), and further calls to ``open`` will\n        return this stored table if ``file=None`` (the default).\n\n        If a table needs to be re-read from disk, pass on an explicit file\n        location or use the (sub-class) close method and re-open.\n\n        If the location is a network location it is first downloaded via\n        download_file.\n\n        For the IERS class itself, an IERS_B sub-class instance is opened.\n\n        \"\"\"\n        if file is not None or cls.iers_table is None:\n            if file is not None:\n                if urlparse(file).netloc:\n                    kwargs.update(file=download_file(file, cache=cache))\n                else:\n                    kwargs.update(file=file)\n\n            # TODO: the below is really ugly and probably a bad idea.  Instead,\n            # there should probably be an IERSBase class, which provides\n            # useful methods but cannot really be used on its own, and then\n            # *perhaps* an IERS class which provides best defaults.  But for\n            # backwards compatibility, we use the IERS_B reader for IERS here.\n            if cls is IERS:\n                cls.iers_table = IERS_B.read(**kwargs)\n            else:\n                cls.iers_table = cls.read(**kwargs)\n        return cls.iers_table\n\n    @classmethod\n    def close(cls):\n        \"\"\"Remove the IERS table from the class.\n\n        This allows the table to be re-read from disk during one's session\n        (e.g., if one finds it is out of date and has updated the file).\n        \"\"\"\n        cls.iers_table = None\n\n    def mjd_utc(self, jd1, jd2=0.):\n        \"\"\"Turn a time to MJD, returning integer and fractional parts.\n\n        Parameters\n        ----------\n        jd1 : float, array, or `~astropy.time.Time`\n            first part of two-part JD, or Time object\n        jd2 : float or array, optional\n            second part of two-part JD.\n            Default is 0., ignored if jd1 is `~astropy.time.Time`.\n\n        Returns\n        -------\n        mjd : float or array\n            integer part of MJD\n        utc : float or array\n            fractional part of MJD\n        \"\"\"\n        try:  # see if this is a Time object\n            jd1, jd2 = jd1.utc.jd1, jd1.utc.jd2\n        except Exception:\n            pass\n\n        mjd = np.floor(jd1 - MJD_ZERO + jd2)\n        utc = jd1 - (MJD_ZERO+mjd) + jd2\n        return mjd, utc\n\n    def ut1_utc(self, jd1, jd2=0., return_status=False):\n        \"\"\"Interpolate UT1-UTC corrections in IERS Table for given dates.\n\n        Parameters\n        ----------\n        jd1 : float, array of float, or `~astropy.time.Time` object\n            first part of two-part JD, or Time object\n        jd2 : float or float array, optional\n            second part of two-part JD.\n            Default is 0., ignored if jd1 is `~astropy.time.Time`.\n        return_status : bool\n            Whether to return status values.  If False (default),\n            raise ``IERSRangeError`` if any time is out of the range covered\n            by the IERS table.\n\n        Returns\n        -------\n        ut1_utc : float or float array\n            UT1-UTC, interpolated in IERS Table\n        status : int or int array\n            Status values (if ``return_status``=``True``)::\n            ``iers.FROM_IERS_B``\n            ``iers.FROM_IERS_A``\n            ``iers.FROM_IERS_A_PREDICTION``\n            ``iers.TIME_BEFORE_IERS_RANGE``\n            ``iers.TIME_BEYOND_IERS_RANGE``\n        \"\"\"\n        return self._interpolate(jd1, jd2, ['UT1_UTC'],\n                                 self.ut1_utc_source if return_status else None)\n\n    def dcip_xy(self, jd1, jd2=0., return_status=False):\n        \"\"\"Interpolate CIP corrections in IERS Table for given dates.\n\n        Parameters\n        ----------\n        jd1 : float, array of float, or `~astropy.time.Time` object\n            first part of two-part JD, or Time object\n        jd2 : float or float array, optional\n            second part of two-part JD (default 0., ignored if jd1 is Time)\n        return_status : bool\n            Whether to return status values.  If False (default),\n            raise ``IERSRangeError`` if any time is out of the range covered\n            by the IERS table.\n\n        Returns\n        -------\n        D_x : `~astropy.units.Quantity` ['angle']\n            x component of CIP correction for the requested times.\n        D_y : `~astropy.units.Quantity` ['angle']\n            y component of CIP correction for the requested times\n        status : int or int array\n            Status values (if ``return_status``=``True``)::\n            ``iers.FROM_IERS_B``\n            ``iers.FROM_IERS_A``\n            ``iers.FROM_IERS_A_PREDICTION``\n            ``iers.TIME_BEFORE_IERS_RANGE``\n            ``iers.TIME_BEYOND_IERS_RANGE``\n        \"\"\"\n        return self._interpolate(jd1, jd2, ['dX_2000A', 'dY_2000A'],\n                                 self.dcip_source if return_status else None)\n\n    def pm_xy(self, jd1, jd2=0., return_status=False):\n        \"\"\"Interpolate polar motions from IERS Table for given dates.\n\n        Parameters\n        ----------\n        jd1 : float, array of float, or `~astropy.time.Time` object\n            first part of two-part JD, or Time object\n        jd2 : float or float array, optional\n            second part of two-part JD.\n            Default is 0., ignored if jd1 is `~astropy.time.Time`.\n        return_status : bool\n            Whether to return status values.  If False (default),\n            raise ``IERSRangeError`` if any time is out of the range covered\n            by the IERS table.\n\n        Returns\n        -------\n        PM_x : `~astropy.units.Quantity` ['angle']\n            x component of polar motion for the requested times.\n        PM_y : `~astropy.units.Quantity` ['angle']\n            y component of polar motion for the requested times.\n        status : int or int array\n            Status values (if ``return_status``=``True``)::\n            ``iers.FROM_IERS_B``\n            ``iers.FROM_IERS_A``\n            ``iers.FROM_IERS_A_PREDICTION``\n            ``iers.TIME_BEFORE_IERS_RANGE``\n            ``iers.TIME_BEYOND_IERS_RANGE``\n        \"\"\"\n        return self._interpolate(jd1, jd2, ['PM_x', 'PM_y'],\n                                 self.pm_source if return_status else None)\n\n    def _check_interpolate_indices(self, indices_orig, indices_clipped, max_input_mjd):\n        \"\"\"\n        Check that the indices from interpolation match those after clipping\n        to the valid table range.  This method gets overridden in the IERS_Auto\n        class because it has different requirements.\n        \"\"\"\n        if np.any(indices_orig != indices_clipped):\n            raise IERSRangeError('(some) times are outside of range covered '\n                                 'by IERS table.')\n\n    def _interpolate(self, jd1, jd2, columns, source=None):\n        mjd, utc = self.mjd_utc(jd1, jd2)\n        # enforce array\n        is_scalar = not hasattr(mjd, '__array__') or mjd.ndim == 0\n        if is_scalar:\n            mjd = np.array([mjd])\n            utc = np.array([utc])\n        elif mjd.size == 0:\n            # Short-cut empty input.\n            return np.array([])\n\n        self._refresh_table_as_needed(mjd)\n\n        # For typical format, will always find a match (since MJD are integer)\n        # hence, important to define which side we will be; this ensures\n        # self['MJD'][i-1]<=mjd<self['MJD'][i]\n        i = np.searchsorted(self['MJD'].value, mjd, side='right')\n\n        # Get index to MJD at or just below given mjd, clipping to ensure we\n        # stay in range of table (status will be set below for those outside)\n        i1 = np.clip(i, 1, len(self) - 1)\n        i0 = i1 - 1\n        mjd_0, mjd_1 = self['MJD'][i0].value, self['MJD'][i1].value\n        results = []\n        for column in columns:\n            val_0, val_1 = self[column][i0], self[column][i1]\n            d_val = val_1 - val_0\n            if column == 'UT1_UTC':\n                # Check & correct for possible leap second (correcting diff.,\n                # not 1st point, since jump can only happen right at 2nd point)\n                d_val -= d_val.round()\n            # Linearly interpolate (which is what TEMPO does for UT1-UTC, but\n            # may want to follow IERS gazette #13 for more precise\n            # interpolation and correction for tidal effects;\n            # https://maia.usno.navy.mil/iers-gaz13)\n            val = val_0 + (mjd - mjd_0 + utc) / (mjd_1 - mjd_0) * d_val\n\n            # Do not extrapolate outside range, instead just propagate last values.\n            val[i == 0] = self[column][0]\n            val[i == len(self)] = self[column][-1]\n\n            if is_scalar:\n                val = val[0]\n\n            results.append(val)\n\n        if source:\n            # Set status to source, using the routine passed in.\n            status = source(i1)\n            # Check for out of range\n            status[i == 0] = TIME_BEFORE_IERS_RANGE\n            status[i == len(self)] = TIME_BEYOND_IERS_RANGE\n            if is_scalar:\n                status = status[0]\n            results.append(status)\n            return results\n        else:\n            self._check_interpolate_indices(i1, i, np.max(mjd))\n            return results[0] if len(results) == 1 else results\n\n    def _refresh_table_as_needed(self, mjd):\n        \"\"\"\n        Potentially update the IERS table in place depending on the requested\n        time values in ``mdj`` and the time span of the table.  The base behavior\n        is not to update the table.  ``IERS_Auto`` overrides this method.\n        \"\"\"\n        pass\n\n    def ut1_utc_source(self, i):\n        \"\"\"Source for UT1-UTC.  To be overridden by subclass.\"\"\"\n        return np.zeros_like(i)\n\n    def dcip_source(self, i):\n        \"\"\"Source for CIP correction.  To be overridden by subclass.\"\"\"\n        return np.zeros_like(i)\n\n    def pm_source(self, i):\n        \"\"\"Source for polar motion.  To be overridden by subclass.\"\"\"\n        return np.zeros_like(i)\n\n    @property\n    def time_now(self):\n        \"\"\"\n        Property to provide the current time, but also allow for explicitly setting\n        the _time_now attribute for testing purposes.\n        \"\"\"\n        try:\n            return self._time_now\n        except Exception:\n            return Time.now()\n\n    def _convert_col_for_table(self, col):\n        # Fill masked columns with units to avoid dropped-mask warnings\n        # when converting to Quantity.\n        # TODO: Once we support masked quantities, we can drop this and\n        # in the code below replace b_bad with table['UT1_UTC_B'].mask, etc.\n        if (getattr(col, 'unit', None) is not None and\n                isinstance(col, MaskedColumn)):\n            col = col.filled(np.nan)\n\n        return super()._convert_col_for_table(col)\n\n\nclass IERS_A(IERS):\n    \"\"\"IERS Table class targeted to IERS A, provided by USNO.\n\n    These include rapid turnaround and predicted times.\n    See https://datacenter.iers.org/eop.php\n\n    Notes\n    -----\n    The IERS A file is not part of astropy.  It can be downloaded from\n    ``iers.IERS_A_URL`` or ``iers.IERS_A_URL_MIRROR``. See ``iers.__doc__``\n    for instructions on use in ``Time``, etc.\n    \"\"\"\n\n    iers_table = None\n\n    @classmethod\n    def _combine_a_b_columns(cls, iers_a):\n        \"\"\"\n        Return a new table with appropriate combination of IERS_A and B columns.\n        \"\"\"\n        # IERS A has some rows at the end that hold nothing but dates & MJD\n        # presumably to be filled later.  Exclude those a priori -- there\n        # should at least be a predicted UT1-UTC and PM!\n        table = iers_a[np.isfinite(iers_a['UT1_UTC_A']) &\n                       (iers_a['PolPMFlag_A'] != '')]\n\n        # This does nothing for IERS_A, but allows IERS_Auto to ensure the\n        # IERS B values in the table are consistent with the true ones.\n        table = cls._substitute_iers_b(table)\n\n        # Combine A and B columns, using B where possible.\n        b_bad = np.isnan(table['UT1_UTC_B'])\n        table['UT1_UTC'] = np.where(b_bad, table['UT1_UTC_A'], table['UT1_UTC_B'])\n        table['UT1Flag'] = np.where(b_bad, table['UT1Flag_A'], 'B')\n        # Repeat for polar motions.\n        b_bad = np.isnan(table['PM_X_B']) | np.isnan(table['PM_Y_B'])\n        table['PM_x'] = np.where(b_bad, table['PM_x_A'], table['PM_X_B'])\n        table['PM_y'] = np.where(b_bad, table['PM_y_A'], table['PM_Y_B'])\n        table['PolPMFlag'] = np.where(b_bad, table['PolPMFlag_A'], 'B')\n\n        b_bad = np.isnan(table['dX_2000A_B']) | np.isnan(table['dY_2000A_B'])\n        table['dX_2000A'] = np.where(b_bad, table['dX_2000A_A'], table['dX_2000A_B'])\n        table['dY_2000A'] = np.where(b_bad, table['dY_2000A_A'], table['dY_2000A_B'])\n        table['NutFlag'] = np.where(b_bad, table['NutFlag_A'], 'B')\n\n        # Get the table index for the first row that has predictive values\n        # PolPMFlag_A  IERS (I) or Prediction (P) flag for\n        #              Bull. A polar motion values\n        # UT1Flag_A    IERS (I) or Prediction (P) flag for\n        #              Bull. A UT1-UTC values\n        # Since only 'P' and 'I' are possible and 'P' is guaranteed to come\n        # after 'I', we can use searchsorted for 100 times speed up over\n        # finding the first index where the flag equals 'P'.\n        p_index = min(np.searchsorted(table['UT1Flag_A'], 'P'),\n                      np.searchsorted(table['PolPMFlag_A'], 'P'))\n        table.meta['predictive_index'] = p_index\n        table.meta['predictive_mjd'] = table['MJD'][p_index].value\n\n        return table\n\n    @classmethod\n    def _substitute_iers_b(cls, table):\n        # See documentation in IERS_Auto.\n        return table\n\n    @classmethod\n    def read(cls, file=None, readme=None):\n        \"\"\"Read IERS-A table from a finals2000a.* file provided by USNO.\n\n        Parameters\n        ----------\n        file : str\n            full path to ascii file holding IERS-A data.\n            Defaults to ``iers.IERS_A_FILE``.\n        readme : str\n            full path to ascii file holding CDS-style readme.\n            Defaults to package version, ``iers.IERS_A_README``.\n\n        Returns\n        -------\n        ``IERS_A`` class instance\n        \"\"\"\n        if file is None:\n            file = IERS_A_FILE\n        if readme is None:\n            readme = IERS_A_README\n\n        iers_a = super().read(file, format='cds', readme=readme)\n\n        # Combine the A and B data for UT1-UTC and PM columns\n        table = cls._combine_a_b_columns(iers_a)\n        table.meta['data_path'] = file\n        table.meta['readme_path'] = readme\n\n        return table\n\n    def ut1_utc_source(self, i):\n        \"\"\"Set UT1-UTC source flag for entries in IERS table\"\"\"\n        ut1flag = self['UT1Flag'][i]\n        source = np.ones_like(i) * FROM_IERS_B\n        source[ut1flag == 'I'] = FROM_IERS_A\n        source[ut1flag == 'P'] = FROM_IERS_A_PREDICTION\n        return source\n\n    def dcip_source(self, i):\n        \"\"\"Set CIP correction source flag for entries in IERS table\"\"\"\n        nutflag = self['NutFlag'][i]\n        source = np.ones_like(i) * FROM_IERS_B\n        source[nutflag == 'I'] = FROM_IERS_A\n        source[nutflag == 'P'] = FROM_IERS_A_PREDICTION\n        return source\n\n    def pm_source(self, i):\n        \"\"\"Set polar motion source flag for entries in IERS table\"\"\"\n        pmflag = self['PolPMFlag'][i]\n        source = np.ones_like(i) * FROM_IERS_B\n        source[pmflag == 'I'] = FROM_IERS_A\n        source[pmflag == 'P'] = FROM_IERS_A_PREDICTION\n        return source\n\n\nclass IERS_B(IERS):\n    \"\"\"IERS Table class targeted to IERS B, provided by IERS itself.\n\n    These are final values; see https://www.iers.org/IERS/EN/Home/home_node.html\n\n    Notes\n    -----\n    If the package IERS B file (```iers.IERS_B_FILE``) is out of date, a new\n    version can be downloaded from ``iers.IERS_B_URL``.\n    \"\"\"\n\n    iers_table = None\n\n    @classmethod\n    def read(cls, file=None, readme=None, data_start=14):\n        \"\"\"Read IERS-B table from a eopc04_iau2000.* file provided by IERS.\n\n        Parameters\n        ----------\n        file : str\n            full path to ascii file holding IERS-B data.\n            Defaults to package version, ``iers.IERS_B_FILE``.\n        readme : str\n            full path to ascii file holding CDS-style readme.\n            Defaults to package version, ``iers.IERS_B_README``.\n        data_start : int\n            starting row. Default is 14, appropriate for standard IERS files.\n\n        Returns\n        -------\n        ``IERS_B`` class instance\n        \"\"\"\n        if file is None:\n            file = IERS_B_FILE\n        if readme is None:\n            readme = IERS_B_README\n\n        table = super().read(file, format='cds', readme=readme,\n                             data_start=data_start)\n\n        table.meta['data_path'] = file\n        table.meta['readme_path'] = readme\n        return table\n\n    def ut1_utc_source(self, i):\n        \"\"\"Set UT1-UTC source flag for entries in IERS table\"\"\"\n        return np.ones_like(i) * FROM_IERS_B\n\n    def dcip_source(self, i):\n        \"\"\"Set CIP correction source flag for entries in IERS table\"\"\"\n        return np.ones_like(i) * FROM_IERS_B\n\n    def pm_source(self, i):\n        \"\"\"Set PM source flag for entries in IERS table\"\"\"\n        return np.ones_like(i) * FROM_IERS_B\n\n\nclass IERS_Auto(IERS_A):\n    \"\"\"\n    Provide most-recent IERS data and automatically handle downloading\n    of updated values as necessary.\n    \"\"\"\n    iers_table = None\n\n    @classmethod\n    def open(cls):\n        \"\"\"If the configuration setting ``astropy.utils.iers.conf.auto_download``\n        is set to True (default), then open a recent version of the IERS-A\n        table with predictions for UT1-UTC and polar motion out to\n        approximately one year from now.  If the available version of this file\n        is older than ``astropy.utils.iers.conf.auto_max_age`` days old\n        (or non-existent) then it will be downloaded over the network and cached.\n\n        If the configuration setting ``astropy.utils.iers.conf.auto_download``\n        is set to False then ``astropy.utils.iers.IERS()`` is returned.  This\n        is normally the IERS-B table that is supplied with astropy.\n\n        On the first call in a session, the table will be memoized (in the\n        ``iers_table`` class attribute), and further calls to ``open`` will\n        return this stored table.\n\n        Returns\n        -------\n        `~astropy.table.QTable` instance\n            With IERS (Earth rotation) data columns\n\n        \"\"\"\n        if not conf.auto_download:\n            cls.iers_table = IERS_B.open()\n            return cls.iers_table\n\n        all_urls = (conf.iers_auto_url, conf.iers_auto_url_mirror)\n\n        if cls.iers_table is not None:\n\n            # If the URL has changed, we need to redownload the file, so we\n            # should ignore the internally cached version.\n\n            if cls.iers_table.meta.get('data_url') in all_urls:\n                return cls.iers_table\n\n        try:\n            filename = download_file(all_urls[0], sources=all_urls, cache=True)\n        except Exception as err:\n            # Issue a warning here, perhaps user is offline.  An exception\n            # will be raised downstream when actually trying to interpolate\n            # predictive values.\n            warn(AstropyWarning(\n                f'failed to download {\" and \".join(all_urls)}, '\n                f'using local IERS-B: {err}'))\n            cls.iers_table = IERS_B.open()\n            return cls.iers_table\n\n        cls.iers_table = cls.read(file=filename)\n        cls.iers_table.meta['data_url'] = all_urls[0]\n\n        return cls.iers_table\n\n    def _check_interpolate_indices(self, indices_orig, indices_clipped, max_input_mjd):\n        \"\"\"Check that the indices from interpolation match those after clipping to the\n        valid table range.  The IERS_Auto class is exempted as long as it has\n        sufficiently recent available data so the clipped interpolation is\n        always within the confidence bounds of current Earth rotation\n        knowledge.\n        \"\"\"\n        predictive_mjd = self.meta['predictive_mjd']\n\n        # See explanation in _refresh_table_as_needed for these conditions\n        auto_max_age = _none_to_float(conf.auto_max_age)\n        if (max_input_mjd > predictive_mjd and\n                self.time_now.mjd - predictive_mjd > auto_max_age):\n            raise ValueError(INTERPOLATE_ERROR.format(auto_max_age))\n\n    def _refresh_table_as_needed(self, mjd):\n        \"\"\"Potentially update the IERS table in place depending on the requested\n        time values in ``mjd`` and the time span of the table.\n\n        For IERS_Auto the behavior is that the table is refreshed from the IERS\n        server if both the following apply:\n\n        - Any of the requested IERS values are predictive.  The IERS-A table\n          contains predictive data out for a year after the available\n          definitive values.\n        - The first predictive values are at least ``conf.auto_max_age days`` old.\n          In other words the IERS-A table was created by IERS long enough\n          ago that it can be considered stale for predictions.\n        \"\"\"\n        max_input_mjd = np.max(mjd)\n        now_mjd = self.time_now.mjd\n\n        # IERS-A table contains predictive data out for a year after\n        # the available definitive values.\n        fpi = self.meta['predictive_index']\n        predictive_mjd = self.meta['predictive_mjd']\n\n        # Update table in place if necessary\n        auto_max_age = _none_to_float(conf.auto_max_age)\n\n        # If auto_max_age is smaller than IERS update time then repeated downloads may\n        # occur without getting updated values (giving a IERSStaleWarning).\n        if auto_max_age < 10:\n            raise ValueError('IERS auto_max_age configuration value must be larger than 10 days')\n\n        if (max_input_mjd > predictive_mjd and\n                (now_mjd - predictive_mjd) > auto_max_age):\n\n            all_urls = (conf.iers_auto_url, conf.iers_auto_url_mirror)\n\n            # Get the latest version\n            try:\n                filename = download_file(\n                    all_urls[0], sources=all_urls, cache=\"update\")\n            except Exception as err:\n                # Issue a warning here, perhaps user is offline.  An exception\n                # will be raised downstream when actually trying to interpolate\n                # predictive values.\n                warn(AstropyWarning(\n                    f'failed to download {\" and \".join(all_urls)}: {err}.\\n'\n                    'A coordinate or time-related '\n                    'calculation might be compromised or fail because the dates are '\n                    'not covered by the available IERS file.  See the '\n                    '\"IERS data access\" section of the astropy documentation '\n                    'for additional information on working offline.'))\n                return\n\n            new_table = self.__class__.read(file=filename)\n            new_table.meta['data_url'] = str(all_urls[0])\n\n            # New table has new values?\n            if new_table['MJD'][-1] > self['MJD'][-1]:\n                # Replace *replace* current values from the first predictive index through\n                # the end of the current table.  This replacement is much faster than just\n                # deleting all rows and then using add_row for the whole duration.\n                new_fpi = np.searchsorted(new_table['MJD'].value, predictive_mjd, side='right')\n                n_replace = len(self) - fpi\n                self[fpi:] = new_table[new_fpi:new_fpi + n_replace]\n\n                # Sanity check for continuity\n                if new_table['MJD'][new_fpi + n_replace] - self['MJD'][-1] != 1.0 * u.d:\n                    raise ValueError('unexpected gap in MJD when refreshing IERS table')\n\n                # Now add new rows in place\n                for row in new_table[new_fpi + n_replace:]:\n                    self.add_row(row)\n\n                self.meta.update(new_table.meta)\n            else:\n                warn(IERSStaleWarning(\n                    'IERS_Auto predictive values are older than {} days but downloading '\n                    'the latest table did not find newer values'.format(conf.auto_max_age)))\n\n    @classmethod\n    def _substitute_iers_b(cls, table):\n        \"\"\"Substitute IERS B values with those from a real IERS B table.\n\n        IERS-A has IERS-B values included, but for reasons unknown these\n        do not match the latest IERS-B values (see comments in #4436).\n        Here, we use the bundled astropy IERS-B table to overwrite the values\n        in the downloaded IERS-A table.\n        \"\"\"\n        iers_b = IERS_B.open()\n        # Substitute IERS-B values for existing B values in IERS-A table\n        mjd_b = table['MJD'][np.isfinite(table['UT1_UTC_B'])]\n        i0 = np.searchsorted(iers_b['MJD'], mjd_b[0], side='left')\n        i1 = np.searchsorted(iers_b['MJD'], mjd_b[-1], side='right')\n        iers_b = iers_b[i0:i1]\n        n_iers_b = len(iers_b)\n        # If there is overlap then replace IERS-A values from available IERS-B\n        if n_iers_b > 0:\n            # Sanity check that we are overwriting the correct values\n            if not u.allclose(table['MJD'][:n_iers_b], iers_b['MJD']):\n                raise ValueError('unexpected mismatch when copying '\n                                 'IERS-B values into IERS-A table.')\n            # Finally do the overwrite\n            table['UT1_UTC_B'][:n_iers_b] = iers_b['UT1_UTC']\n            table['PM_X_B'][:n_iers_b] = iers_b['PM_x']\n            table['PM_Y_B'][:n_iers_b] = iers_b['PM_y']\n            table['dX_2000A_B'][:n_iers_b] = iers_b['dX_2000A']\n            table['dY_2000A_B'][:n_iers_b] = iers_b['dY_2000A']\n\n        return table\n\n\nclass earth_orientation_table(ScienceState):\n    \"\"\"Default IERS table for Earth rotation and reference systems service.\n\n    These tables are used to calculate the offsets between ``UT1`` and ``UTC``\n    and for conversion to Earth-based coordinate systems.\n\n    The state itself is an IERS table, as an instance of one of the\n    `~astropy.utils.iers.IERS` classes.  The default, the auto-updating\n    `~astropy.utils.iers.IERS_Auto` class, should suffice for most\n    purposes.\n\n    Examples\n    --------\n    To temporarily use the IERS-B file packaged with astropy::\n\n      >>> from astropy.utils import iers\n      >>> from astropy.time import Time\n      >>> iers_b = iers.IERS_B.open(iers.IERS_B_FILE)\n      >>> with iers.earth_orientation_table.set(iers_b):\n      ...     print(Time('2000-01-01').ut1.isot)\n      2000-01-01T00:00:00.355\n\n    To use the most recent IERS-A file for the whole session::\n\n      >>> iers_a = iers.IERS_A.open(iers.IERS_A_URL)  # doctest: +SKIP\n      >>> iers.earth_orientation_table.set(iers_a)  # doctest: +SKIP\n      <ScienceState earth_orientation_table: <IERS_A length=17463>...>\n\n    To go back to the default (of `~astropy.utils.iers.IERS_Auto`)::\n\n      >>> iers.earth_orientation_table.set(None)  # doctest: +SKIP\n      <ScienceState earth_orientation_table: <IERS_Auto length=17428>...>\n    \"\"\"\n    _value = None\n\n    @classmethod\n    def validate(cls, value):\n        if value is None:\n            value = IERS_Auto.open()\n        if not isinstance(value, IERS):\n            raise ValueError(\"earth_orientation_table requires an IERS Table.\")\n        return value\n\n\nclass LeapSeconds(QTable):\n    \"\"\"Leap seconds class, holding TAI-UTC differences.\n\n    The table should hold columns 'year', 'month', 'tai_utc'.\n\n    Methods are provided to initialize the table from IERS ``Leap_Second.dat``,\n    IETF/ntp ``leap-seconds.list``, or built-in ERFA/SOFA, and to update the\n    list used by ERFA.\n\n    Notes\n    -----\n    Astropy has a built-in ``iers.IERS_LEAP_SECONDS_FILE``. Up to date versions\n    can be downloaded from ``iers.IERS_LEAP_SECONDS_URL`` or\n    ``iers.LEAP_SECONDS_LIST_URL``.  Many systems also store a version\n    of ``leap-seconds.list`` for use with ``ntp`` (e.g., on Debian/Ubuntu\n    systems, ``/usr/share/zoneinfo/leap-seconds.list``).\n\n    To prevent querying internet resources if the available local leap second\n    file(s) are out of date, set ``iers.conf.auto_download = False``. This\n    must be done prior to performing any ``Time`` scale transformations related\n    to UTC (e.g. converting from UTC to TAI).\n    \"\"\"\n    # Note: Time instances in this class should use scale='tai' to avoid\n    # needing leap seconds in their creation or interpretation.\n\n    _re_expires = re.compile(r'^#.*File expires on[:\\s]+(\\d+\\s\\w+\\s\\d+)\\s*$')\n    _expires = None\n    _auto_open_files = ['erfa',\n                        IERS_LEAP_SECOND_FILE,\n                        'system_leap_second_file',\n                        'iers_leap_second_auto_url',\n                        'ietf_leap_second_auto_url']\n    \"\"\"Files or conf attributes to try in auto_open.\"\"\"\n\n    @classmethod\n    def open(cls, file=None, cache=False):\n        \"\"\"Open a leap-second list.\n\n        Parameters\n        ----------\n        file : path-like or None\n            Full local or network path to the file holding leap-second data,\n            for passing on to the various ``from_`` class methods.\n            If 'erfa', return the data used by the ERFA library.\n            If `None`, use default locations from file and configuration to\n            find a table that is not expired.\n        cache : bool\n            Whether to use cache. Defaults to False, since leap-second files\n            are regularly updated.\n\n        Returns\n        -------\n        leap_seconds : `~astropy.utils.iers.LeapSeconds`\n            Table with 'year', 'month', and 'tai_utc' columns, plus possibly\n            others.\n\n        Notes\n        -----\n        Bulletin C is released about 10 days after a possible leap second is\n        introduced, i.e., mid-January or mid-July.  Expiration days are thus\n        generally at least 150 days after the present.  For the auto-loading,\n        a list comprised of the table shipped with astropy, and files and\n        URLs in `~astropy.utils.iers.Conf` are tried, returning the first\n        that is sufficiently new, or the newest among them all.\n        \"\"\"\n        if file is None:\n            return cls.auto_open()\n\n        if file.lower() == 'erfa':\n            return cls.from_erfa()\n\n        if urlparse(file).netloc:\n            file = download_file(file, cache=cache)\n\n        # Just try both reading methods.\n        try:\n            return cls.from_iers_leap_seconds(file)\n        except Exception:\n            return cls.from_leap_seconds_list(file)\n\n    @staticmethod\n    def _today():\n        # Get current day in scale='tai' without going through a scale change\n        # (so we do not need leap seconds).\n        s = '{0.year:04d}-{0.month:02d}-{0.day:02d}'.format(datetime.utcnow())\n        return Time(s, scale='tai', format='iso', out_subfmt='date')\n\n    @classmethod\n    def auto_open(cls, files=None):\n        \"\"\"Attempt to get an up-to-date leap-second list.\n\n        The routine will try the files in sequence until it finds one\n        whose expiration date is \"good enough\" (see below).  If none\n        are good enough, it returns the one with the most recent expiration\n        date, warning if that file is expired.\n\n        For remote files that are cached already, the cached file is tried\n        first before attempting to retrieve it again.\n\n        Parameters\n        ----------\n        files : list of path-like, optional\n            List of files/URLs to attempt to open.  By default, uses\n            ``cls._auto_open_files``.\n\n        Returns\n        -------\n        leap_seconds : `~astropy.utils.iers.LeapSeconds`\n            Up to date leap-second table\n\n        Notes\n        -----\n        Bulletin C is released about 10 days after a possible leap second is\n        introduced, i.e., mid-January or mid-July.  Expiration days are thus\n        generally at least 150 days after the present.  We look for a file\n        that expires more than 180 - `~astropy.utils.iers.Conf.auto_max_age`\n        after the present.\n        \"\"\"\n        offset = 180 - (30 if conf.auto_max_age is None else conf.auto_max_age)\n        good_enough = cls._today() + TimeDelta(offset, format='jd')\n\n        if files is None:\n            # Basic files to go over (entries in _auto_open_files can be\n            # configuration items, which we want to be sure are up to date).\n            files = [getattr(conf, f, f) for f in cls._auto_open_files]\n\n        # Remove empty entries.\n        files = [f for f in files if f]\n\n        # Our trials start with normal files and remote ones that are\n        # already in cache.  The bools here indicate that the cache\n        # should be used.\n        trials = [(f, True) for f in files\n                  if not urlparse(f).netloc or is_url_in_cache(f)]\n        # If we are allowed to download, we try downloading new versions\n        # if none of the above worked.\n        if conf.auto_download:\n            trials += [(f, False) for f in files if urlparse(f).netloc]\n\n        self = None\n        err_list = []\n        # Go through all entries, and return the first one that\n        # is not expired, or the most up to date one.\n        for f, allow_cache in trials:\n            if not allow_cache:\n                clear_download_cache(f)\n\n            try:\n                trial = cls.open(f, cache=True)\n            except Exception as exc:\n                err_list.append(exc)\n                continue\n\n            if self is None or trial.expires > self.expires:\n                self = trial\n                self.meta['data_url'] = str(f)\n                if self.expires > good_enough:\n                    break\n\n        if self is None:\n            raise ValueError('none of the files could be read. The '\n                             'following errors were raised:\\n' + str(err_list))\n\n        if self.expires < self._today() and conf.auto_max_age is not None:\n            warn('leap-second file is expired.', IERSStaleWarning)\n\n        return self\n\n    @property\n    def expires(self):\n        \"\"\"The limit of validity of the table.\"\"\"\n        return self._expires\n\n    @classmethod\n    def _read_leap_seconds(cls, file, **kwargs):\n        \"\"\"Read a file, identifying expiration by matching 'File expires'\"\"\"\n        expires = None\n        # Find expiration date.\n        with get_readable_fileobj(file) as fh:\n            lines = fh.readlines()\n            for line in lines:\n                match = cls._re_expires.match(line)\n                if match:\n                    day, month, year = match.groups()[0].split()\n                    month_nb = MONTH_ABBR.index(month[:3]) + 1\n                    expires = Time(f'{year}-{month_nb:02d}-{day}',\n                                   scale='tai', out_subfmt='date')\n                    break\n            else:\n                raise ValueError(f'did not find expiration date in {file}')\n\n        self = cls.read(lines, format='ascii.no_header', **kwargs)\n        self._expires = expires\n        return self\n\n    @classmethod\n    def from_iers_leap_seconds(cls, file=IERS_LEAP_SECOND_FILE):\n        \"\"\"Create a table from a file like the IERS ``Leap_Second.dat``.\n\n        Parameters\n        ----------\n        file : path-like, optional\n            Full local or network path to the file holding leap-second data\n            in a format consistent with that used by IERS.  By default, uses\n            ``iers.IERS_LEAP_SECOND_FILE``.\n\n        Notes\n        -----\n        The file *must* contain the expiration date in a comment line, like\n        '#  File expires on 28 June 2020'\n        \"\"\"\n        return cls._read_leap_seconds(\n            file, names=['mjd', 'day', 'month', 'year', 'tai_utc'])\n\n    @classmethod\n    def from_leap_seconds_list(cls, file):\n        \"\"\"Create a table from a file like the IETF ``leap-seconds.list``.\n\n        Parameters\n        ----------\n        file : path-like, optional\n            Full local or network path to the file holding leap-second data\n            in a format consistent with that used by IETF.  Up to date versions\n            can be retrieved from ``iers.IETF_LEAP_SECOND_URL``.\n\n        Notes\n        -----\n        The file *must* contain the expiration date in a comment line, like\n        '# File expires on:  28 June 2020'\n        \"\"\"\n        from astropy.io.ascii import convert_numpy  # Here to avoid circular import\n\n        names = ['ntp_seconds', 'tai_utc', 'comment', 'day', 'month', 'year']\n        # Note: ntp_seconds does not fit in 32 bit, so causes problems on\n        # 32-bit systems without the np.int64 converter.\n        self = cls._read_leap_seconds(\n            file, names=names, include_names=names[:2],\n            converters={'ntp_seconds': [convert_numpy(np.int64)]})\n        self['mjd'] = (self['ntp_seconds']/86400 + 15020).round()\n        # Note: cannot use Time.ymdhms, since that might require leap seconds.\n        isot = Time(self['mjd'], format='mjd', scale='tai').isot\n        ymd = np.array([[int(part) for part in t.partition('T')[0].split('-')]\n                        for t in isot])\n        self['year'], self['month'], self['day'] = ymd.T\n        return self\n\n    @classmethod\n    def from_erfa(cls, built_in=False):\n        \"\"\"Create table from the leap-second list in ERFA.\n\n        Parameters\n        ----------\n        built_in : bool\n            If `False` (default), retrieve the list currently used by ERFA,\n            which may have been updated.  If `True`, retrieve the list shipped\n            with erfa.\n        \"\"\"\n        current = cls(erfa.leap_seconds.get())\n        current._expires = Time('{0.year:04d}-{0.month:02d}-{0.day:02d}'\n                                .format(erfa.leap_seconds.expires),\n                                scale='tai')\n        if not built_in:\n            return current\n\n        try:\n            erfa.leap_seconds.set(None)  # reset to defaults\n            return cls.from_erfa(built_in=False)\n        finally:\n            erfa.leap_seconds.set(current)\n\n    def update_erfa_leap_seconds(self, initialize_erfa=False):\n        \"\"\"Add any leap seconds not already present to the ERFA table.\n\n        This method matches leap seconds with those present in the ERFA table,\n        and extends the latter as necessary.\n\n        Parameters\n        ----------\n        initialize_erfa : bool, or 'only', or 'empty'\n            Initialize the ERFA leap second table to its built-in value before\n            trying to expand it.  This is generally not needed but can help\n            in case it somehow got corrupted.  If equal to 'only', the ERFA\n            table is reinitialized and no attempt it made to update it.\n            If 'empty', the leap second table is emptied before updating, i.e.,\n            it is overwritten altogether (note that this may break things in\n            surprising ways, as most leap second tables do not include pre-1970\n            pseudo leap-seconds; you were warned).\n\n        Returns\n        -------\n        n_update : int\n            Number of items updated.\n\n        Raises\n        ------\n        ValueError\n            If the leap seconds in the table are not on 1st of January or July,\n            or if the matches are inconsistent.  This would normally suggest\n            a corrupted leap second table, but might also indicate that the\n            ERFA table was corrupted.  If needed, the ERFA table can be reset\n            by calling this method with an appropriate value for\n            ``initialize_erfa``.\n        \"\"\"\n        if initialize_erfa == 'empty':\n            # Initialize to empty and update is the same as overwrite.\n            erfa.leap_seconds.set(self)\n            return len(self)\n\n        if initialize_erfa:\n            erfa.leap_seconds.set()\n            if initialize_erfa == 'only':\n                return 0\n\n        return erfa.leap_seconds.update(self)\n"},{"className":"IERSStaleWarning","col":0,"comment":"null","endLoc":106,"id":10833,"nodeType":"Class","startLoc":105,"text":"class IERSStaleWarning(AstropyWarning):\n    pass"},{"fileName":"__init__.py","filePath":"astropy/utils/iers","id":10834,"nodeType":"File","text":"\nfrom .iers import *\n"},{"col":0,"comment":"null","endLoc":51,"header":"def _unescape_str(url)","id":10835,"name":"_unescape_str","nodeType":"Function","startLoc":50,"text":"def _unescape_str(url):\n    return saxutils.unescape(url, _str_entities)"},{"id":10836,"name":"astropy/utils/iers/data","nodeType":"Package"},{"id":10837,"name":"ReadMe.finals2000A","nodeType":"TextFile","path":"astropy/utils/iers/data","text":"Table: finals2000A\n================================================================================\n\nfrom http://maia.usno.navy.mil/\nfinals2000A.all -- all EOP values since 02 January 1973 with dX & dY using \nIAU2000A Nutation/Precession Theory (with 1 year of predic tions)\n\n================================================================================\n\nFile Summary:\n--------------------------------------------------------------------------------\n FileName      Lrecl    Records    Explanations\n--------------------------------------------------------------------------------\nReadMe            80          .    This file, adapted from readme.finals2000A\nfinals2000A.all  187      15182    all EOP values since 02 January 1973\n--------------------------------------------------------------------------------\n\n================================================================================\nByte-by-byte Description of file: *\n--------------------------------------------------------------------------------\n   Bytes Format Units  Label  Explanations\n--------------------------------------------------------------------------------\n  1-   2   I2    ---     year         To get true calendar year, add 1900 for \n                                      MJD<=51543 or add 2000 for MJD>=51544)\n  3-   4   I2    ---     month\n  5-   6   I2    ---     day          of month\n  8-  15   F8.2    d     MJD          fractional Modified Julian Date (MJD UTC)\n      17   A1    ---     PolPMFlag_A  IERS (I) or Prediction (P) flag for \n                                      Bull. A polar motion values\n 19-  27   F9.6  arcsec  PM_x_A       Bull. A PM-x\n 28-  36   F9.6  arcsec  e_PM_x_A     error in PM-x (sec. of arc)\n 38-  46   F9.6  arcsec  PM_y_A       Bull. A PM-y (sec. of arc)\n 47-  55   F9.6  arcsec  e_PM_y_A     error in PM-y (sec. of arc)\n      58   A1    ---     UT1Flag_A    IERS (I) or Prediction (P) flag for \n                                      Bull. A UT1-UTC values\n 59-  68   F10.7 s       UT1_UTC_A    Bull. A UT1-UTC (sec. of time)\n 69-  78   F10.7 s       e_UT1_UTC_A  error in UT1-UTC (sec. of time)\n 80-  86   F7.4  ms      LOD_A        Bull. A LOD (msec. of time)\n                                      -- NOT ALWAYS FILLED\n 87-  93   F7.4  ms      e_LOD_A      error in LOD (msec. of time) \n                                      -- NOT ALWAYS FILLED\n      96   A1    ---     NutFlag_A    IERS (I) or Prediction (P) flag for \n                                      Bull. A nutation values\n 98- 106   F9.3  marcsec dX_2000A_A   Bull. A dX wrt IAU2000A Nutation \n                                      Free Core Nutation NOT Removed\n107- 115   F9.3  marcsec e_dX_2000A_A error in dX (msec. of arc)\n117- 125   F9.3  marcsec dY_2000A_A   Bull. A dY wrt IAU2000A Nutation\n                                      Free Core Nutation NOT Removed\n126- 134   F9.3  marcsec e_dY_2000A_A error in dY (msec. of arc)\n135- 144   F10.6 arcsec  PM_X_B       Bull. B PM-x (sec. of arc)\n145- 154   F10.6 arcsec  PM_Y_B       Bull. B PM-y (sec. of arc)\n155- 165   F11.7 s       UT1_UTC_B    Bull. B UT1-UTC (sec. of time)\n166- 175   F10.3 marcsec dX_2000A_B   Bull. B dX wrt IAU2000A Nutation\n176- 185   F10.3 marcsec dY_2000A_B   Bull. B dY wrt IAU2000A Nutation\n--------------------------------------------------------------------------------\n\nNotes: The same format is used for finals2000A.data, finals2000A.daily, and finals2000A.all\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":10838,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":10839,"name":"_bytes_entities","nodeType":"Attribute","startLoc":11,"text":"_bytes_entities"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":10840,"name":"_bytes_keys","nodeType":"Attribute","startLoc":13,"text":"_bytes_keys"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":10841,"name":"_str_entities","nodeType":"Attribute","startLoc":16,"text":"_str_entities"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":10842,"name":"_str_keys","nodeType":"Attribute","startLoc":17,"text":"_str_keys"},{"col":0,"comment":"","endLoc":2,"header":"unescaper.py#<anonymous>","id":10843,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"URL unescaper functions.\"\"\"\n\n__all__ = ['unescape_all']\n\n_bytes_entities = {b'&amp;': b'&', b'&lt;': b'<', b'&gt;': b'>',\n                   b'&amp;&amp;': b'&', b'&&': b'&', b'%2F': b'/'}\n\n_bytes_keys = [b'&amp;&amp;', b'&&', b'&amp;', b'&lt;', b'&gt;', b'%2F']\n\n_str_entities = {'&amp;&amp;': '&', '&&': '&', '%2F': '/'}\n\n_str_keys = ['&amp;&amp;', '&&', '&amp;', '&lt;', '&gt;', '%2F']"},{"attributeType":"null","col":0,"comment":"null","endLoc":40,"id":10844,"name":"__all__","nodeType":"Attribute","startLoc":40,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":60,"id":10845,"name":"_dataurls_to_alias","nodeType":"Attribute","startLoc":60,"text":"_dataurls_to_alias"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":118,"id":10846,"name":"conf","nodeType":"Attribute","startLoc":118,"text":"conf"},{"id":10847,"name":"update_builtin_iers.sh","nodeType":"TextFile","path":"astropy/utils/iers/data","text":"#!/bin/sh\n\nset -euv\n\n# This script should be run every time an astropy release is made.\n# It downloads up-to-date versions of the earth rotation and leap\n# second tables.\n\nrm Leap_Second.dat\nrm eopc04_IAU2000.62-now\n\n# iers.IERS_B_URL\nwget http://hpiers.obspm.fr/iers/eop/eopc04/eopc04_IAU2000.62-now\n# iers.IERS_LEAP_SECOND_URL\nwget https://hpiers.obspm.fr/iers/bul/bulc/Leap_Second.dat\n"},{"col":0,"comment":"null","endLoc":813,"header":"@function_helper\ndef geomspace(start, stop, *args, **kwargs)","id":10848,"name":"geomspace","nodeType":"Function","startLoc":809,"text":"@function_helper\ndef geomspace(start, stop, *args, **kwargs):\n    # Get unit from end point as for linspace.\n    (stop, start), unit = _quantities2arrays(stop, start)\n    return (start, stop) + args, kwargs, unit, None"},{"id":10849,"name":"ReadMe.eopc04_IAU2000","nodeType":"TextFile","path":"astropy/utils/iers/data","text":"Table: eopc04_iau2000\n================================================================================\n\nfrom http://hpiers.obspm.fr/iers/eop/eopc04/eopc04_IAU2000.62-now\n\n                   INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE\n                        EARTH ORIENTATION PARAMETERS\n                          EOP (IERS) 08 C04\n\n================================================================================\n\nFile Summary:\n--------------------------------------------------------------------------------\n FileName           Lrecl    Records    Explanations\n--------------------------------------------------------------------------------\nReadMe                  80     .   This file, made using header\neopc04_IAU2000.62-now  155 18279   all EOP values since 01 January 1962\n--------------------------------------------------------------------------------\n\n================================================================================\nByte-by-byte Description of file: *\n--------------------------------------------------------------------------------\n   Bytes Format Units  Label  Explanations\n--------------------------------------------------------------------------------\n  1-  4   I4    ---     year         Calendar year\n  5-  8   I4    ---     month        Month\n  9- 12   I4    ---     day          day of month (0 hr UTC)\n 13- 19   I7    d       MJD          Modified Julian Date (MJD, 0 hr UTC)\n 20- 30   F11.6 arcsec  PM_x         polar motion x\n 31- 41   F11.6 arcsec  PM_y         polar motion y\n 42- 53   F12.7 s       UT1_UTC      Difference UT1-UTC\n 54- 65   F12.7 s       LOD          length of day\n 66- 76   F11.6 arcsec  dX_2000A     dX wrt IAU2000A Nutation \n 77- 87   F11.6 arcsec  dY_2000A     dY wrt IAU2000A Nutation\n 88- 98   F11.6 arcsec  e_PM_x       error in PM_x\n 99-109   F11.6 arcsec  e_PM_y       error in PM_y\n110-120   F11.7 s       e_UT1_UTC    error in UT1_UTC\n121-131   F11.7 s       e_LOD        error in length of day\n132-143   F12.6 arcsec  e_dX_2000A   error in dX_2000A\n144-155   F12.6 arcsec  e_dY_2000A   error in dY_2000A\n--------------------------------------------------------------------------------\n"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.utils.iers`.\n    ","endLoc":143,"id":10850,"nodeType":"Class","startLoc":109,"text":"class Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.utils.iers`.\n    \"\"\"\n    auto_download = _config.ConfigItem(\n        True,\n        'Enable auto-downloading of the latest IERS data.  If set to False '\n        'then the local IERS-B file will be used by default (even if the '\n        'full IERS file with predictions was already downloaded and cached). '\n        'This parameter also controls whether internet resources will be '\n        'queried to update the leap second table if the installed version is '\n        'out of date. Default is True.')\n    auto_max_age = _config.ConfigItem(\n        30.0,\n        'Maximum age (days) of predictive data before auto-downloading. '\n        'See \"Auto refresh behavior\" in astropy.utils.iers documentation for details. '\n        'Default is 30.')\n    iers_auto_url = _config.ConfigItem(\n        IERS_A_URL,\n        'URL for auto-downloading IERS file data.')\n    iers_auto_url_mirror = _config.ConfigItem(\n        IERS_A_URL_MIRROR,\n        'Mirror URL for auto-downloading IERS file data.')\n    remote_timeout = _config.ConfigItem(\n        10.0,\n        'Remote timeout downloading IERS file data (seconds).')\n    system_leap_second_file = _config.ConfigItem(\n        '',\n        'System file with leap seconds.')\n    iers_leap_second_auto_url = _config.ConfigItem(\n        IERS_LEAP_SECOND_URL,\n        'URL for auto-downloading leap seconds.')\n    ietf_leap_second_auto_url = _config.ConfigItem(\n        IETF_LEAP_SECOND_URL,\n        'Alternate URL for auto-downloading leap seconds.')"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":113,"id":10851,"name":"auto_download","nodeType":"Attribute","startLoc":113,"text":"auto_download"},{"id":10852,"name":"astropy/utils/iers/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/utils/iers/tests","id":10853,"nodeType":"File","text":""},{"attributeType":"null","col":0,"comment":"null","endLoc":1592,"id":10854,"name":"_tempfilestodel","nodeType":"Attribute","startLoc":1592,"text":"_tempfilestodel"},{"attributeType":"ReadOnlyDict","col":0,"comment":"null","endLoc":1740,"id":10855,"name":"_NOTHING","nodeType":"Attribute","startLoc":1740,"text":"_NOTHING"},{"col":0,"comment":"","endLoc":3,"header":"data.py#<anonymous>","id":10856,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"Functions for accessing, downloading, and caching data files.\"\"\"\n\ntry:\n    import certifi\nexcept ImportError:\n    # certifi support is optional; when available it will be used for TLS/SSL\n    # downloads\n    certifi = None\n\n__all__ = [\n    'Conf', 'conf',\n    'download_file', 'download_files_in_parallel',\n    'get_readable_fileobj',\n    'get_pkg_data_fileobj', 'get_pkg_data_filename',\n    'get_pkg_data_contents', 'get_pkg_data_fileobjs',\n    'get_pkg_data_filenames', 'get_pkg_data_path',\n    'is_url', 'is_url_in_cache', 'get_cached_urls',\n    'cache_total_size', 'cache_contents',\n    'export_download_cache', 'import_download_cache', 'import_file_to_cache',\n    'check_download_cache',\n    'clear_download_cache',\n    'compute_hash',\n    'get_free_space_in_dir',\n    'check_free_space_in_dir',\n    'get_file_contents',\n    'CacheMissingWarning',\n    \"CacheDamaged\"\n]\n\n_dataurls_to_alias = {}\n\nconf = Conf()\n\n_is_url = is_url\n\n_tempfilestodel = []\n\n_NOTHING = ReadOnlyDict({})"},{"id":10857,"name":"astropy/utils/iers/tests/data","nodeType":"Package"},{"id":10858,"name":"leap-seconds.list","nodeType":"TextFile","path":"astropy/utils/iers/tests/data","text":"#\n#\tIn the following text, the symbol '#' introduces\n#\ta comment, which continues from that symbol until\n#\tthe end of the line. A plain comment line has a\n#\twhitespace character following the comment indicator.\n#\tThere are also special comment lines defined below.\n#\tA special comment will always have a non-whitespace\n#\tcharacter in column 2.\n#\n#\tA blank line should be ignored.\n#\n#\tThe following table shows the corrections that must\n#\tbe applied to compute International Atomic Time (TAI)\n#\tfrom the Coordinated Universal Time (UTC) values that\n#\tare transmitted by almost all time services.\n#\n#\tThe first column shows an epoch as a number of seconds\n#\tsince 1 January 1900, 00:00:00 (1900.0 is also used to\n#\tindicate the same epoch.) Both of these time stamp formats\n#\tignore the complexities of the time scales that were\n#\tused before the current definition of UTC at the start\n#\tof 1972. (See note 3 below.)\n#\tThe second column shows the number of seconds that\n#\tmust be added to UTC to compute TAI for any timestamp\n#\tat or after that epoch. The value on each line is\n#\tvalid from the indicated initial instant until the\n#\tepoch given on the next one or indefinitely into the\n#\tfuture if there is no next line.\n#\t(The comment on each line shows the representation of\n#\tthe corresponding initial epoch in the usual\n#\tday-month-year format. The epoch always begins at\n#\t00:00:00 UTC on the indicated day. See Note 5 below.)\n#\n#\tImportant notes:\n#\n#\t1. Coordinated Universal Time (UTC) is often referred to\n#\tas Greenwich Mean Time (GMT). The GMT time scale is no\n#\tlonger used, and the use of GMT to designate UTC is\n#\tdiscouraged.\n#\n#\t2. The UTC time scale is realized by many national\n#\tlaboratories and timing centers. Each laboratory\n#\tidentifies its realization with its name: Thus\n#\tUTC(NIST), UTC(USNO), etc. The differences among\n#\tthese different realizations are typically on the\n#\torder of a few nanoseconds (i.e., 0.000 000 00x s)\n#\tand can be ignored for many purposes. These differences\n#\tare tabulated in Circular T, which is published monthly\n#\tby the International Bureau of Weights and Measures\n#\t(BIPM). See www.bipm.org for more information.\n#\n#\t3. The current definition of the relationship between UTC\n#\tand TAI dates from 1 January 1972. A number of different\n#\ttime scales were in use before that epoch, and it can be\n#\tquite difficult to compute precise timestamps and time\n#\tintervals in those \"prehistoric\" days. For more information,\n#\tconsult:\n#\n#\t\tThe Explanatory Supplement to the Astronomical\n#\t\tEphemeris.\n#\tor\n#\t\tTerry Quinn, \"The BIPM and the Accurate Measurement\n#\t\tof Time,\" Proc. of the IEEE, Vol. 79, pp. 894-905,\n#\t\tJuly, 1991. <http://dx.doi.org/10.1109/5.84965>\n#\t\treprinted in:\n#\t\t   Christine Hackman and Donald B Sullivan (eds.)\n#\t\t   Time and Frequency Measurement\n#\t\t   American Association of Physics Teachers (1996)\n#\t\t   <http://tf.nist.gov/general/pdf/1168.pdf>, pp. 75-86\n#\n#\t4. The decision to insert a leap second into UTC is currently\n#\tthe responsibility of the International Earth Rotation and\n#\tReference Systems Service. (The name was changed from the\n#\tInternational Earth Rotation Service, but the acronym IERS\n#\tis still used.)\n#\n#\tLeap seconds are announced by the IERS in its Bulletin C.\n#\n#\tSee www.iers.org for more details.\n#\n#\tEvery national laboratory and timing center uses the\n#\tdata from the BIPM and the IERS to construct UTC(lab),\n#\ttheir local realization of UTC.\n#\n#\tAlthough the definition also includes the possibility\n#\tof dropping seconds (\"negative\" leap seconds), this has\n#\tnever been done and is unlikely to be necessary in the\n#\tforeseeable future.\n#\n#\t5. If your system keeps time as the number of seconds since\n#\tsome epoch (e.g., NTP timestamps), then the algorithm for\n#\tassigning a UTC time stamp to an event that happens during a positive\n#\tleap second is not well defined. The official name of that leap\n#\tsecond is 23:59:60, but there is no way of representing that time\n#\tin these systems.\n#\tMany systems of this type effectively stop the system clock for\n#\tone second during the leap second and use a time that is equivalent\n#\tto 23:59:59 UTC twice. For these systems, the corresponding TAI\n#\ttimestamp would be obtained by advancing to the next entry in the\n#\tfollowing table when the time equivalent to 23:59:59 UTC\n#\tis used for the second time. Thus the leap second which\n#\toccurred on 30 June 1972 at 23:59:59 UTC would have TAI\n#\ttimestamps computed as follows:\n#\n#\t...\n#\t30 June 1972 23:59:59 (2287785599, first time):\tTAI= UTC + 10 seconds\n#\t30 June 1972 23:59:60 (2287785599,second time):\tTAI= UTC + 11 seconds\n#\t1  July 1972 00:00:00 (2287785600)\t\tTAI= UTC + 11 seconds\n#\t...\n#\n#\tIf your system realizes the leap second by repeating 00:00:00 UTC twice\n#\t(this is possible but not usual), then the advance to the next entry\n#\tin the table must occur the second time that a time equivalent to\n#\t00:00:00 UTC is used. Thus, using the same example as above:\n#\n#\t...\n#       30 June 1972 23:59:59 (2287785599):\t\tTAI= UTC + 10 seconds\n#       30 June 1972 23:59:60 (2287785600, first time):\tTAI= UTC + 10 seconds\n#       1  July 1972 00:00:00 (2287785600,second time):\tTAI= UTC + 11 seconds\n#\t...\n#\n#\tin both cases the use of timestamps based on TAI produces a smooth\n#\ttime scale with no discontinuity in the time interval. However,\n#\talthough the long-term behavior of the time scale is correct in both\n#\tmethods, the second method is technically not correct because it adds\n#\tthe extra second to the wrong day.\n#\n#\tThis complexity would not be needed for negative leap seconds (if they\n#\tare ever used). The UTC time would skip 23:59:59 and advance from\n#\t23:59:58 to 00:00:00 in that case. The TAI offset would decrease by\n#\t1 second at the same instant. This is a much easier situation to deal\n#\twith, since the difficulty of unambiguously representing the epoch\n#\tduring the leap second does not arise.\n#\n#\tSome systems implement leap seconds by amortizing the leap second\n#\tover the last few minutes of the day. The frequency of the local\n#\tclock is decreased (or increased) to realize the positive (or\n#\tnegative) leap second. This method removes the time step described\n#\tabove. Although the long-term behavior of the time scale is correct\n#\tin this case, this method introduces an error during the adjustment\n#\tperiod both in time and in frequency with respect to the official\n#\tdefinition of UTC.\n#\n#\tQuestions or comments to:\n#\t\tJudah Levine\n#\t\tTime and Frequency Division\n#\t\tNIST\n#\t\tBoulder, Colorado\n#\t\tJudah.Levine@nist.gov\n#\n#\tLast Update of leap second values:   8 July 2016\n#\n#\tThe following line shows this last update date in NTP timestamp\n#\tformat. This is the date on which the most recent change to\n#\tthe leap second data was added to the file. This line can\n#\tbe identified by the unique pair of characters in the first two\n#\tcolumns as shown below.\n#\n#$\t 3676924800\n#\n#\tThe NTP timestamps are in units of seconds since the NTP epoch,\n#\twhich is 1 January 1900, 00:00:00. The Modified Julian Day number\n#\tcorresponding to the NTP time stamp, X, can be computed as\n#\n#\tX/86400 + 15020\n#\n#\twhere the first term converts seconds to days and the second\n#\tterm adds the MJD corresponding to the time origin defined above.\n#\tThe integer portion of the result is the integer MJD for that\n#\tday, and any remainder is the time of day, expressed as the\n#\tfraction of the day since 0 hours UTC. The conversion from day\n#\tfraction to seconds or to hours, minutes, and seconds may involve\n#\trounding or truncation, depending on the method used in the\n#\tcomputation.\n#\n#\tThe data in this file will be updated periodically as new leap\n#\tseconds are announced. In addition to being entered on the line\n#\tabove, the update time (in NTP format) will be added to the basic\n#\tfile name leap-seconds to form the name leap-seconds.<NTP TIME>.\n#\tIn addition, the generic name leap-seconds.list will always point to\n#\tthe most recent version of the file.\n#\n#\tThis update procedure will be performed only when a new leap second\n#\tis announced.\n#\n#\tThe following entry specifies the expiration date of the data\n#\tin this file in units of seconds since the origin at the instant\n#\t1 January 1900, 00:00:00. This expiration date will be changed\n#\tat least twice per year whether or not a new leap second is\n#\tannounced. These semi-annual changes will be made no later\n#\tthan 1 June and 1 December of each year to indicate what\n#\taction (if any) is to be taken on 30 June and 31 December,\n#\trespectively. (These are the customary effective dates for new\n#\tleap seconds.) This expiration date will be identified by a\n#\tunique pair of characters in columns 1 and 2 as shown below.\n#\tIn the unlikely event that a leap second is announced with an\n#\teffective date other than 30 June or 31 December, then this\n#\tfile will be edited to include that leap second as soon as it is\n#\tannounced or at least one month before the effective date\n#\t(whichever is later).\n#\tIf an announcement by the IERS specifies that no leap second is\n#\tscheduled, then only the expiration date of the file will\n#\tbe advanced to show that the information in the file is still\n#\tcurrent -- the update time stamp, the data and the name of the file\n#\twill not change.\n#\n#\tUpdated through IERS Bulletin C58\n#\tFile expires on:  28 June 2020\n#\n#@\t3802291200\n#\n2272060800\t10\t# 1 Jan 1972\n2287785600\t11\t# 1 Jul 1972\n2303683200\t12\t# 1 Jan 1973\n2335219200\t13\t# 1 Jan 1974\n2366755200\t14\t# 1 Jan 1975\n2398291200\t15\t# 1 Jan 1976\n2429913600\t16\t# 1 Jan 1977\n2461449600\t17\t# 1 Jan 1978\n2492985600\t18\t# 1 Jan 1979\n2524521600\t19\t# 1 Jan 1980\n2571782400\t20\t# 1 Jul 1981\n2603318400\t21\t# 1 Jul 1982\n2634854400\t22\t# 1 Jul 1983\n2698012800\t23\t# 1 Jul 1985\n2776982400\t24\t# 1 Jan 1988\n2840140800\t25\t# 1 Jan 1990\n2871676800\t26\t# 1 Jan 1991\n2918937600\t27\t# 1 Jul 1992\n2950473600\t28\t# 1 Jul 1993\n2982009600\t29\t# 1 Jul 1994\n3029443200\t30\t# 1 Jan 1996\n3076704000\t31\t# 1 Jul 1997\n3124137600\t32\t# 1 Jan 1999\n3345062400\t33\t# 1 Jan 2006\n3439756800\t34\t# 1 Jan 2009\n3550089600\t35\t# 1 Jul 2012\n3644697600\t36\t# 1 Jul 2015\n3692217600\t37\t# 1 Jan 2017\n#\n#\tthe following special comment contains the\n#\thash value of the data in this file computed\n#\tuse the secure hash algorithm as specified\n#\tby FIPS 180-1. See the files in ~/pub/sha for\n#\tthe details of how this hash value is\n#\tcomputed. Note that the hash computation\n#\tignores comments and whitespace characters\n#\tin data lines. It includes the NTP values\n#\tof both the last modification time and the\n#\texpiration time of the file, but not the\n#\twhite space on those lines.\n#\tthe hash line is also ignored in the\n#\tcomputation.\n#\n#h \tf28827d2 f263b6c3 ec0f19eb a3e0dbf0 97f3fa30\n"},{"id":10859,"name":"finals2000A-2016-02-30-test","nodeType":"TextFile","path":"astropy/utils/iers/tests/data","text":"16 2 1 57359.00 I -0.003225 0.000031  0.299494 0.000025  I 0.0262864 0.0000042  1.3154 0.0035  I    -0.094    0.119    -0.077    0.029 -0.003291  0.299534  0.0262719    -0.094    -0.169\n16 2 2 57360.00 I -0.004706 0.000030  0.301252 0.000024  I 0.0249911 0.0000057  1.2412 0.0034  I    -0.108    0.119    -0.082    0.035 -0.004751  0.301342  0.0249958    -0.128    -0.151  \n16 2 3 57361.00 I -0.005690 0.000031  0.302711 0.000025  I 0.0238039 0.0000054  1.1674 0.0040  I    -0.112    0.045    -0.102    0.034 -0.005725  0.302649  0.0238016    -0.137    -0.154  \n16 2 4 57362.00 I -0.006490 0.000030  0.304493 0.000023  I 0.0226216 0.0000057  1.1976 0.0040  I    -0.105    0.045    -0.115    0.034 -0.006418  0.304497  0.0226308    -0.139    -0.163  \n16 2 5 57363.00 I -0.007499 0.000030  0.306410 0.000020  I 0.0214229 0.0000059  1.1850 0.0048  I    -0.094    0.045    -0.114    0.034 -0.007481  0.306466  0.0214306    -0.142    -0.171  \n16 2 6 57364.00 I -0.008637 0.000024  0.308121 0.000018  I 0.0201799 0.0000077  1.3874 0.0042  I    -0.094    0.070    -0.115    0.034 -0.008646  0.308134  0.0201501    -0.145    -0.180  \n16 2 7 57365.00 I -0.009431 0.000032  0.309779 0.000020  I 0.0186616 0.0000061  1.5494 0.0050  I    -0.103    0.053    -0.117    0.032 -0.009564  0.309799  0.0187256    -0.146    -0.188  \n16 2 8 57366.00 I -0.009639 0.000035  0.311456 0.000019  I 0.0171013 0.0000064  1.6508 0.0052  I    -0.118    0.052    -0.112    0.039 -0.009602  0.311455  0.0171286    -0.150    -0.197  \n16 2 9 57367.00 I -0.009707 0.000034  0.313146 0.000017  I 0.0153086 0.0000083  1.9064 0.0048  I    -0.137    0.119    -0.106    0.046 -0.009695  0.313158  0.0153216    -0.151    -0.205  \n16 210 57368.00 I -0.009949 0.000035  0.315007 0.000024  I 0.0133131 0.0000072  2.0881 0.0053  I    -0.163    0.119    -0.110    0.053 -0.009848  0.314971  0.0133091    -0.162    -0.134  \n16 211 57369.00 I -0.010522 0.000036  0.317056 0.000024  I 0.0111967 0.0000067  2.0770 0.0049  I    -0.189    0.119    -0.121    0.053 -0.010525  0.317115  0.0112339    -0.182    -0.133  \n16 212 57370.00 I -0.011219 0.000037  0.319016 0.000025  I 0.0091589 0.0000066  2.0665 0.0055  I    -0.206    0.119    -0.119    0.053 -0.011200  0.319001  0.0091407    -0.206    -0.158  \n16 213 57371.00 I -0.011874 0.000031  0.321066 0.000024  I 0.0070911 0.0000088  1.9738 0.0047  I    -0.211    0.119    -0.106    0.072 -0.011889  0.321068  0.0071356    -0.208    -0.158  \n16 214 57372.00 I -0.012456 0.000029  0.323240 0.000028  I 0.0052399 0.0000068  1.7954 0.0055  I    -0.210    0.119    -0.093    0.047 -0.012445  0.323271  0.0052511    -0.202    -0.149  \n16 215 57373.00 I -0.013108 0.000027  0.325311 0.000027  I 0.0034804 0.0000065  1.6767 0.0047  I    -0.209    0.119    -0.080    0.056 -0.013071  0.325381  0.0035069    -0.194    -0.140  \n16 216 57374.00 I -0.013911 0.000023  0.327010 0.000022  I 0.0019144 0.0000065  1.4745 0.0042  I    -0.203    0.045    -0.057    0.050 -0.013912  0.327076  0.0019126    -0.187    -0.130  \n16 217 57375.00 I -0.014798 0.000021  0.328533 0.000023  I 0.0004966 0.0000052  1.3769 0.0045  I    -0.186    0.045    -0.032    0.050 -0.014734  0.328472  0.0004608    -0.191    -0.037  \n16 218 57376.00 I -0.015972 0.000018  0.330387 0.000023  I-0.0008425 0.0000063  1.2886 0.0043  I    -0.166    0.045    -0.025    0.050 -0.015929  0.330417 -0.0008581    -0.186    -0.027  \n16 219 57377.00 I -0.017359 0.000017  0.332361 0.000022  I-0.0021162 0.0000068  1.3072 0.0107  I    -0.150    0.045    -0.032    0.050 -0.017369  0.332401 -0.0021130    -0.179    -0.049  \n16 220 57378.00 I -0.018572 0.000019  0.334012 0.000020  I-0.0034607 0.0000205  1.3373 0.0040  I    -0.135    0.082    -0.033    0.156 -0.018639  0.334094 -0.0034487    -0.171    -0.071  \n16 221 57379.00 I -0.019315 0.000033  0.335553 0.000023  I-0.0048274 0.0000044  1.4772 0.0105  I    -0.120    0.119    -0.029    0.011 -0.019329  0.335459 -0.0048827    -0.164    -0.092  \n16 222 57380.00 I -0.019952 0.000034  0.337603 0.000023  I-0.0064226 0.0000046  1.6395 0.0033  I    -0.108    0.119    -0.038    0.011 -0.019862  0.337623 -0.0064324    -0.156    -0.114  \n16 223 57381.00 I -0.020869 0.000035  0.339814 0.000022  I-0.0080691 0.0000049  1.6897 0.0032  I    -0.103    0.119    -0.063    0.027 -0.020905  0.339830 -0.0080787    -0.149    -0.136  \n16 224 57382.00 I -0.021582 0.000037  0.342052 0.000026  I-0.0098083 0.0000045  1.7588 0.0034  I    -0.096    0.119    -0.079    0.033 -0.021616  0.342062 -0.0097889    -0.143    -0.149  \n16 225 57383.00 I -0.021898 0.000037  0.344332 0.000025  I-0.0115839 0.0000046  1.8195 0.0036  I    -0.093    0.119    -0.073    0.033 -0.021911  0.344416 -0.0115637    -0.139    -0.160  \n16 226 57384.00 I -0.022036 0.000036  0.346321 0.000022  I-0.0134316 0.0000055  1.8329 0.0048  I    -0.102    0.119    -0.062    0.033 -0.022011  0.346307 -0.0134119    -0.133    -0.171  \n16 227 57385.00 I -0.022387 0.000024  0.348429 0.000019  I-0.0152292 0.0000084  1.7846 0.0042  I    -0.118    0.119    -0.064    0.059 -0.022273  0.348402 -0.0152189    -0.129    -0.181  \n16 228 57386.00 I -0.023235 0.000025  0.350749 0.000020  I-0.0170194 0.0000064  1.7921 0.0052  I    -0.122    0.119    -0.082    0.035 -0.023218  0.350815 -0.0169781    -0.124    -0.192  \n16 229 57387.00 I -0.024219 0.000023  0.352784 0.000020  I-0.0187707 0.0000062  1.6716 0.0053  I    -0.111    0.119    -0.105    0.027 -0.024254  0.352863 -0.0186952    -0.119    -0.203  \n16 3 1 57388.00 I -0.024807 0.000023  0.354400 0.000014  I-0.0203703 0.0000084  1.5743 0.0046  I    -0.088    0.119    -0.125    0.011 -0.024918  0.354451 -0.0203678    -0.114    -0.214  \n16 3 2 57389.00 I -0.024651 0.000025  0.355942 0.000020  I-0.0219780 0.0000067  1.6532 0.0052  I    -0.055    0.119    -0.125    0.049                                                     \n16 3 3 57390.00 I -0.024054 0.000025  0.357866 0.000019  I-0.0236772 0.0000060  1.7337 0.0044  I    -0.016    0.119    -0.093    0.049                                                     \n16 3 4 57391.00 I -0.023735 0.000027  0.360180 0.000019  I-0.0254270 0.0000057  1.7591 0.0052  I     0.008    0.119    -0.056    0.049                                                     \n16 3 5 57392.00 I -0.023740 0.000026  0.362598 0.000018  I-0.0272149 0.0000084  1.8430 0.0041  I     0.011    0.119    -0.053    0.091                                                     \n16 3 6 57393.00 I -0.023745 0.000027  0.365029 0.000018  I-0.0291495 0.0000060  2.0365 0.0052  I     0.010    0.119    -0.081    0.052                                                     \n16 3 7 57394.00 I -0.024021 0.000024  0.367538 0.000018  I-0.0312844 0.0000060  2.2194 0.0045  I     0.021    0.119    -0.095    0.052                                                     \n16 3 8 57395.00 I -0.024457 0.000021  0.370024 0.000012  I-0.0335554 0.0000066  2.3035 0.0044  I     0.036    0.119    -0.085    0.026                                                     \n16 3 9 57396.00 I -0.024829 0.000022  0.372483 0.000011  I-0.0359012 0.0000065  2.4168 0.0045  I     0.037    0.119    -0.072    0.026                                                     \n16 310 57397.00 I -0.025066 0.000020  0.374873 0.000011  I-0.0383738 0.0000062  2.4843 0.0044  I     0.025    0.119    -0.063    0.026                                                     \n16 311 57398.00 I -0.025097 0.000017  0.377004 0.000011  I-0.0408388 0.0000060  2.4588 0.0080  I     0.011    0.119    -0.053    0.026                                                     \n16 312 57399.00 I -0.025181 0.000017  0.378932 0.000012  I-0.0432700 0.0000148  2.3690 0.0040  I     0.008    0.119    -0.040    0.150                                                     \n16 313 57400.00 I -0.025188 0.000024  0.380780 0.000016  I-0.0455624 0.0000054  2.2359 0.0079  I     0.013    0.119    -0.031    0.150                                                     \n16 314 57401.00 I -0.024758 0.000026  0.382629 0.000016  I-0.0477465 0.0000056  2.1168 0.0038  I     0.011    0.119    -0.012    0.150                                                     \n16 315 57402.00 I -0.023945 0.000025  0.384773 0.000017  I-0.0497744 0.0000053  1.9330 0.0037  I    -0.002    0.119     0.022    0.150                                                     \n16 316 57403.00 I -0.022702 0.000026  0.387109 0.000023  I-0.0516492 0.0000048  1.8593 0.0035  I    -0.012    0.042     0.057    0.020                                                     \n16 317 57404.00 I -0.020782 0.000026  0.389469 0.000023  I-0.0535037 0.0000047  1.8176 0.0034  I    -0.009    0.042     0.067    0.020                                                     \n16 318 57405.00 I -0.018391 0.000025  0.391971 0.000022  I-0.0552954 0.0000047  1.8089 0.0041  I     0.001    0.042     0.060    0.020                                                     \n16 319 57406.00 I -0.016187 0.000017  0.394472 0.000020  I-0.0571458 0.0000067  1.8730 0.0036  I     0.003    0.047     0.046    0.029                                                     \n16 320 57407.00 I -0.014601 0.000025  0.396962 0.000029  I-0.0590734 0.0000055  2.0332 0.0044  I    -0.007    0.052     0.033    0.049                                                     \n16 321 57408.00 I -0.013767 0.000026  0.399494 0.000030  I-0.0611669 0.0000057  2.0575 0.0043  I    -0.028    0.052     0.021    0.056                                                     \n16 322 57409.00 I -0.013562 0.000024  0.402015 0.000024  I-0.0631898 0.0000065  2.0861 0.0043  I    -0.054    0.059     0.010    0.076                                                     \n16 323 57410.00 I -0.013645 0.000024  0.404333 0.000024  I-0.0653380 0.0000064  2.1115 0.0046  I    -0.074    0.059     0.009    0.076                                                     \n16 324 57411.00 I -0.013616 0.000024  0.406392 0.000024  I-0.0673565 0.0000066  1.9679 0.0046  I    -0.088    0.059     0.018    0.076                                                     \n16 325 57412.00 I -0.013255 0.000024  0.408403 0.000024  I-0.0693406 0.0000065  2.0248 0.0063  I    -0.109    0.059     0.024    0.076                                                     \n16 326 57413.00 I -0.012617 0.000013  0.410472 0.000013  I-0.0713968 0.0000108  2.0538 0.0066  I    -0.134    0.119     0.017    0.225                                                     \n16 327 57414.00 I -0.011855 0.000011  0.412577 0.000013  I-0.0734180 0.0000116  1.9922 0.0069  I    -0.144    0.119    -0.003    0.150                                                     \n16 328 57415.00 I -0.011092 0.000023  0.414506 0.000021  I-0.0753619 0.0000085  1.8727 0.0072  I    -0.132    0.058    -0.029    0.069                                                     \n16 329 57416.00 I -0.010256 0.000023  0.416297 0.000022  I-0.0771761 0.0000085  1.7914 0.0055  I    -0.106    0.058    -0.054    0.069                                                     \n16 330 57417.00 I -0.009394 0.000023  0.418007 0.000023  I-0.0789625 0.0000070  1.7637 0.0055  I    -0.070    0.047    -0.058    0.063                                                     \n16 331 57418.00 I -0.008769 0.000022  0.419685 0.000025  I-0.0807036 0.0000069  1.7363 0.0049  I    -0.034    0.047    -0.029    0.063                                                     \n16 4 1 57419.00 I -0.008414 0.000022  0.421202 0.000027  I-0.0824533 0.0000068  1.7634 0.0049  I    -0.021    0.047     0.000    0.063                                                     \n16 4 2 57420.00 I -0.008088 0.000022  0.422663 0.000027  I-0.0842517 0.0000069  1.8544 0.0042  I    -0.036    0.047    -0.021    0.063                                                     \n16 4 3 57421.00 I -0.007515 0.000013  0.424137 0.000024  I-0.0861632 0.0000050  1.9487 0.0047  I    -0.052    0.119    -0.082    0.024                                                     \n16 4 4 57422.00 I -0.006419 0.000021  0.425858 0.000023  I-0.0881549 0.0000064  2.0606 0.0045  I    -0.040    0.119    -0.113    0.024                                                     \n16 4 5 57423.00 I -0.004709 0.000022  0.427854 0.000022  I-0.0902894 0.0000074  2.1876 0.0049  I    -0.016    0.119    -0.084    0.014                                                     \n16 4 6 57424.00 I -0.002606 0.000022  0.429902 0.000021  I-0.0925256 0.0000073  2.3011 0.0052  I    -0.002    0.119    -0.031    0.014                                                     \n16 4 7 57425.00 I -0.000789 0.000022  0.432202 0.000018  I-0.0948791 0.0000073  2.3772 0.0052  I     0.000    0.119     0.010    0.014                                                     \n16 4 8 57426.00 I  0.000664 0.000022  0.434713 0.000016  I-0.0972531 0.0000073  2.3725 0.0122  I    -0.002    0.119     0.040    0.014                                                     \n16 4 9 57427.00 I  0.002059 0.000023  0.437042 0.000013  I-0.0995861 0.0000232  2.2539 0.0054  I    -0.006    0.119     0.063    0.150                                                     \n16 410 57428.00 I  0.003347 0.000021  0.439038 0.000016  I-0.1017251 0.0000079  2.0278 0.0120  I    -0.008    0.119     0.072    0.061                                                     \n16 411 57429.00 I  0.004628 0.000019  0.440926 0.000015  I-0.1036627 0.0000060  1.8647 0.0049  I    -0.005    0.119     0.078    0.061                                                     \n16 412 57430.00 I  0.006143 0.000019  0.442665 0.000016  I-0.1054713 0.0000059  1.7520 0.0042  I     0.004    0.119     0.096    0.061                                                     \n16 413 57431.00 I  0.007737 0.000020  0.444189 0.000016  I-0.1071693 0.0000060  1.6470 0.0044  I     0.019    0.119     0.114    0.061                                                     \n16 414 57432.00 I  0.009116 0.000020  0.445678 0.000016  I-0.1087724 0.0000066  1.5633 0.0046  I     0.046    0.119     0.118    0.061                                                     \n16 415 57433.00 I  0.010471 0.000019  0.447462 0.000017  I-0.1103218 0.0000069  1.5574 0.0087  I     0.076    0.119     0.108    0.061                                                     \n16 416 57434.00 I  0.011967 0.000020  0.449627 0.000018  I-0.1119079 0.0000162  1.6135 0.0060  I     0.095    0.119     0.095    0.150                                                     \n16 417 57435.00 I  0.013661 0.000025  0.451890 0.000023  I-0.1135287 0.0000097  1.6091 0.0095  I     0.099    0.119     0.086    0.013                                                     \n16 418 57436.00 I  0.015451 0.000028  0.454016 0.000028  I-0.1151529 0.0000098  1.6851 0.0068  I     0.090    0.119     0.090    0.013                                                     \n16 419 57437.00 I  0.017078 0.000032  0.455707 0.000031  I-0.1169025 0.0000096  1.7719 0.0070  I     0.070    0.119     0.113    0.013                                                     \n16 420 57438.00 I  0.018626 0.000041  0.456788 0.000041  I-0.1186505 0.0000101  1.7201 0.0062  P     0.011    0.239     0.092    0.600                                                     \n16 421 57439.00 I  0.020312 0.000044  0.457663 0.000043  I-0.1203383 0.0000079  1.6551 0.0058  P     0.002    0.239     0.097    0.600                                                     \n16 422 57440.00 I  0.022149 0.000091  0.458767 0.000093  I-0.1219712 0.0000056  1.6216 0.0057  P    -0.002    0.239     0.074    0.600                                                     \n16 423 57441.00 I  0.024059 0.000091  0.460210 0.000092  I-0.1235866 0.0000083  1.6033 0.0048  P    -0.009    0.239     0.041    0.600                                                     \n16 424 57442.00 I  0.025767 0.000091  0.461829 0.000092  I-0.1251404 0.0000079  1.4728 0.0092  P    -0.007    0.239     0.018    0.600                                                     \n16 425 57443.00 I  0.027084 0.000091  0.463531 0.000093  I-0.1265278 0.0000165  1.3290 0.0090  P     0.013    0.239     0.007    0.600                                                     \n16 426 57444.00 I  0.028086 0.000091  0.465338 0.000093  I-0.1278231 0.0000161  1.2593 0.0118  P     0.040    0.239     0.003    0.600                                                     \n16 427 57445.00 I  0.028928 0.000091  0.467015 0.000092  I-0.1290372 0.0000169  1.1618 0.0123  P     0.065    0.239     0.008    0.600                                                     \n16 428 57446.00 I  0.029730 0.000092  0.468564 0.000091  I-0.1303716 0.0000185                 P     0.083    0.239     0.035    0.600                                                     \n16 429 57447.00 P  0.030798 0.000622  0.469783 0.000448  P-0.1317429 0.0001080                 P     0.085    0.239     0.066    0.600                                                     \n16 430 57448.00 P  0.031994 0.000923  0.470993 0.000737  P-0.1331878 0.0002041                 P     0.065    0.239     0.057    0.600                                                     \n16 5 1 57449.00 P  0.033490 0.001163  0.472083 0.000987  P-0.1347405 0.0003028                 P     0.040    0.239     0.007    0.600                                                     \n16 5 2 57450.00 P  0.035183 0.001370  0.473116 0.001215  P-0.1364495 0.0004021                 P     0.034    0.239    -0.028    0.600                                                     \n16 5 3 57451.00 P  0.036987 0.001556  0.474102 0.001426  P-0.1383398 0.0005017                 P     0.043    0.239    -0.006    0.600                                                     \n16 5 4 57452.00 P  0.038845 0.001727  0.475046 0.001626  P-0.1403703 0.0006014                 P     0.046    0.239     0.044    0.600                                                     \n16 5 5 57453.00 P  0.040719 0.001885  0.475994 0.001817  P-0.1424457 0.0007012                 P     0.037    0.239     0.082    0.600                                                     \n16 5 6 57454.00 P  0.042581 0.002035  0.476950 0.002001  P-0.1444593 0.0007500                 P     0.028    0.239     0.101    0.600                                                     \n16 5 7 57455.00 P  0.044425 0.002176  0.477871 0.002178  P-0.1463307 0.0005500                 P     0.014    0.239     0.107    0.600                                                     \n16 5 8 57456.00 P  0.046286 0.002310  0.478748 0.002349  P-0.1480080 0.0007548                 P    -0.006    0.239     0.096    0.600                                                     \n16 5 9 57457.00 P  0.048207 0.002439  0.479583 0.002516  P-0.1494885 0.0009344                 P    -0.019    0.239     0.073    0.600                                                     \n16 510 57458.00 P  0.050193 0.002564  0.480379 0.002679  P-0.1508450 0.0010994                 P    -0.012    0.239     0.056    0.600                                                     \n16 511 57459.00 P  0.052250 0.002683  0.481153 0.002838  P-0.1521313 0.0012543                 P     0.016    0.239     0.051    0.600                                                     \n16 512 57460.00 P  0.054368 0.002799  0.481924 0.002993  P-0.1533788 0.0014016                 P     0.052    0.239     0.053    0.600                                                     \n16 513 57461.00 P  0.056522 0.002911  0.482690 0.003146  P-0.1546475 0.0015429                 P     0.077    0.239     0.062    0.600                                                     \n16 514 57462.00 P  0.058696 0.003020  0.483452 0.003295  P-0.1559391 0.0016792                 P     0.082    0.239     0.068    0.600                                                     \n16 515 57463.00 P  0.060870 0.003127  0.484205 0.003442  P-0.1572557 0.0018113                 P     0.077    0.239     0.061    0.600                                                     \n16 516 57464.00 P  0.063031 0.003230  0.484931 0.003587  P-0.1585736 0.0019399                 P     0.067    0.239     0.062    0.600                                                     \n16 517 57465.00 P  0.065179 0.003331  0.485615 0.003729  P-0.1598755 0.0020652                 P     0.046    0.239     0.087    0.600                                                     \n16 518 57466.00 P  0.067327 0.003430  0.486255 0.003870  P-0.1611463 0.0021877                 P     0.017    0.239     0.124    0.600                                                     \n16 519 57467.00 P  0.069480 0.003527  0.486853 0.004008  P-0.1623693 0.0023077                 P    -0.001    0.239     0.132    0.600                                                     \n16 520 57468.00 P  0.071641 0.003621  0.487411 0.004145  P-0.1635235 0.0024255                 P     0.001    0.239     0.103    0.600                                                     \n16 521 57469.00 P  0.073815 0.003714  0.487931 0.004279  P-0.1645892 0.0025411                 P     0.009    0.239     0.066    0.600                                                     \n16 522 57470.00 P  0.076004 0.003806  0.488420 0.004413  P-0.1655561 0.0026548                 P     0.018    0.239     0.050    0.600                                                     \n16 523 57471.00 P  0.078203 0.003895  0.488880 0.004544  P-0.1664451 0.0027668                 P     0.037    0.239     0.053    0.600                                                     \n16 524 57472.00 P  0.080408 0.003983  0.489309 0.004674  P-0.1672908 0.0028772                 P     0.059    0.239     0.062    0.600                                                     \n16 525 57473.00 P  0.082617 0.004070  0.489704 0.004803  P-0.1681336 0.0029860                 P     0.067    0.239     0.075    0.600                                                     \n16 526 57474.00 P  0.084827 0.004155  0.490064 0.004930  P-0.1690194 0.0030934                 P     0.059    0.239     0.093    0.600                                                     \n16 527 57475.00 P  0.087040 0.004239  0.490383 0.005057  P-0.1699970 0.0031995                 P     0.047    0.239     0.110    0.600                                                     \n16 528 57476.00 P  0.089257 0.004322  0.490663 0.005182  P-0.1710955 0.0033043                 P     0.037    0.239     0.111    0.600                                                     \n16 529 57477.00 P  0.091478 0.004403  0.490904 0.005305  P-0.1723451 0.0034080                 P     0.027    0.239     0.088    0.600                                                     \n16 530 57478.00 P  0.093706 0.004484  0.491106 0.005428  P-0.1737501 0.0035105                 P     0.023    0.239     0.065    0.600                                                     \n16 531 57479.00 P  0.095941 0.004563  0.491273 0.005550  P-0.1752782 0.0036120                 P     0.025    0.239     0.063    0.600                                                     \n16 6 1 57480.00 P  0.098182 0.004641  0.491405 0.005670  P-0.1768742 0.0037124                 P     0.023    0.239     0.083    0.600                                                     \n16 6 2 57481.00 P  0.100428 0.004719  0.491506 0.005790  P-0.1784618 0.0038119                 P     0.012    0.239     0.109    0.600                                                     \n16 6 3 57482.00 P  0.102675 0.004795  0.491574 0.005908  P-0.1799593 0.0039105                 P     0.000    0.239     0.131    0.600                                                     \n16 6 4 57483.00 P  0.104924 0.004871  0.491610 0.006026  P-0.1813071 0.0040082                 P    -0.005    0.239     0.137    0.600                                                     \n16 6 5 57484.00 P  0.107172 0.004945  0.491612 0.006143  P-0.1824904 0.0041051                 P    -0.005    0.239     0.124    0.600                                                     \n16 6 6 57485.00 P  0.109420 0.005019  0.491579 0.006259  P-0.1835411 0.0042012                 P    -0.003    0.239     0.101    0.600                                                     \n16 6 7 57486.00 P  0.111667 0.005092  0.491512 0.006374  P-0.1845091 0.0042965                 P     0.007    0.239     0.085    0.600                                                     \n16 6 8 57487.00 P  0.113913 0.005164  0.491411 0.006488  P-0.1854466 0.0043911                 P     0.030    0.239     0.084    0.600                                                     \n16 6 9 57488.00 P  0.116157 0.005235  0.491274 0.006602  P-0.1863873 0.0044849                 P     0.055    0.239     0.098    0.600                                                     \n16 610 57489.00 P  0.118399 0.005306  0.491104 0.006715  P-0.1873523 0.0045781                 P     0.065    0.239     0.127    0.600                                                     \n16 611 57490.00 P  0.120639 0.005376  0.490901 0.006827  P-0.1883409 0.0046706                 P     0.060    0.239     0.154    0.600                                                     \n16 612 57491.00 P  0.122875 0.005445  0.490664 0.006938  P-0.1893388 0.0047625                 P     0.052    0.239     0.159    0.600                                                     \n16 613 57492.00 P  0.125106 0.005514  0.490394 0.007049  P-0.1903249 0.0048537                 P     0.046    0.239     0.145    0.600                                                     \n16 614 57493.00 P  0.127331 0.005582  0.490090 0.007159  P-0.1912717 0.0049444                 P     0.032    0.239     0.141    0.600                                                     \n16 615 57494.00 P  0.129551 0.005650  0.489753 0.007268  P-0.1921561 0.0050344                 P     0.005    0.239     0.154    0.600                                                     \n16 616 57495.00 P  0.131763 0.005716  0.489382 0.007377  P-0.1929601 0.0051240                 P    -0.012    0.239     0.159    0.600                                                     \n16 617 57496.00 P  0.133969 0.005782  0.488978 0.007485  P-0.1936729 0.0052129                 P    -0.009    0.239     0.143    0.600                                                     \n16 618 57497.00 P  0.136167 0.005848  0.488539 0.007592  P-0.1942946 0.0053014                 P     0.004    0.239     0.122    0.600                                                     \n16 619 57498.00 P  0.138356 0.005913  0.488067 0.007699  P-0.1948369 0.0053893                 P     0.015    0.239     0.115    0.600                                                     \n16 620 57499.00 P  0.140538 0.005978  0.487561 0.007806  P-0.1953178 0.0054768                 P     0.029    0.239     0.117    0.600                                                     \n16 621 57500.00 P  0.142710 0.006042  0.487022 0.007911  P-0.1957658 0.0055637                 P     0.048    0.239     0.121    0.600                                                     \n16 622 57501.00 P  0.144872 0.006105  0.486450 0.008017  P-0.1962213 0.0056502                 P     0.056    0.239     0.132    0.600                                                     \n16 623 57502.00 P  0.147024 0.006168  0.485846 0.008121  P-0.1967329 0.0057362                 P     0.040    0.239     0.147    0.600                                                     \n16 624 57503.00 P  0.149165 0.006231  0.485208 0.008226  P-0.1973441 0.0058218                 P     0.019    0.239     0.155    0.600                                                     \n16 625 57504.00 P  0.151294 0.006293  0.484538 0.008329  P-0.1980871 0.0059070                 P     0.009    0.239     0.148    0.600                                                     \n16 626 57505.00 P  0.153411 0.006355  0.483836 0.008432  P-0.1989695 0.0059917                 P     0.009    0.239     0.141    0.600                                                     \n16 627 57506.00 P  0.155515 0.006416  0.483101 0.008535  P-0.1999726 0.0060760                 P     0.010    0.239     0.141    0.600                                                     \n16 628 57507.00 P  0.157606 0.006477  0.482334 0.008637  P-0.2010510 0.0061599                 P     0.007    0.239     0.138    0.600                                                     \n16 629 57508.00 P  0.159683 0.006537  0.481535 0.008739  P-0.2021438 0.0062434                 P     0.002    0.239     0.130    0.600                                                     \n16 630 57509.00 P  0.161745 0.006597  0.480705 0.008840  P-0.2031853 0.0063266                 P    -0.007    0.239     0.133    0.600                                                     \n16 7 1 57510.00 P  0.163793 0.006656  0.479843 0.008941  P-0.2041214 0.0064093                 P    -0.016    0.239     0.151    0.600                                                     \n16 7 2 57511.00 P  0.165825 0.006715  0.478950 0.009041  P-0.2049288 0.0064917                 P    -0.018    0.239     0.166    0.600                                                     \n16 7 3 57512.00 P  0.167840 0.006774  0.478026 0.009141  P-0.2056188 0.0065737                 P    -0.007    0.239     0.157    0.600                                                     \n16 7 4 57513.00 P  0.169839 0.006832  0.477071 0.009241  P-0.2062331 0.0066554                 P     0.011    0.239     0.140    0.600                                                     \n16 7 5 57514.00 P  0.171821 0.006890  0.476086 0.009340  P-0.2068275 0.0067368                 P     0.024    0.239     0.138    0.600                                                     \n16 7 6 57515.00 P  0.173785 0.006948  0.475071 0.009439  P-0.2074512 0.0068177                 P     0.031    0.239     0.152    0.600                                                     \n16 7 7 57516.00 P  0.175730 0.007005  0.474025 0.009537  P-0.2081302 0.0068984                 P     0.033    0.239     0.174    0.600                                                     \n16 7 8 57517.00 P  0.177656 0.007062  0.472950 0.009635  P-0.2088663 0.0069788                 P     0.031    0.239     0.202    0.600                                                     \n16 7 9 57518.00 P  0.179563 0.007118  0.471846 0.009732  P-0.2096451 0.0070588                 P     0.027    0.239     0.235    0.600                                                     \n16 710 57519.00 P  0.181450 0.007175  0.470713 0.009829  P-0.2104419 0.0071385                 P     0.025    0.239     0.250    0.600                                                     \n16 711 57520.00 P  0.183317 0.007230  0.469550 0.009926  P-0.2112284 0.0072179                 P     0.024    0.239     0.237    0.600                                                     \n16 712 57521.00 P  0.185162 0.007286  0.468360 0.010023  P-0.2119781 0.0072970                 P     0.013    0.239     0.216    0.600                                                     \n16 713 57522.00 P  0.186986 0.007341  0.467141 0.010119  P-0.2126684 0.0073758                 P    -0.003    0.239     0.205    0.600                                                     \n16 714 57523.00 P  0.188788 0.007396  0.465894 0.010214  P-0.2132848 0.0074544                 P    -0.011    0.239     0.203    0.600                                                     \n16 715 57524.00 P  0.190567 0.007451  0.464620 0.010310  P-0.2138206 0.0075326                 P    -0.007    0.239     0.193    0.600                                                     \n16 716 57525.00 P  0.192324 0.007505  0.463319 0.010405  P-0.2142803 0.0076106                 P     0.000    0.239     0.179    0.600                                                     \n16 717 57526.00 P  0.194056 0.007559  0.461990 0.010499  P-0.2146833 0.0076883                 P     0.004    0.239     0.170    0.600                                                     \n16 718 57527.00 P  0.195765 0.007613  0.460636 0.010594  P-0.2150602 0.0077657                 P     0.013    0.239     0.165    0.600                                                     \n16 719 57528.00 P  0.197449 0.007666  0.459255 0.010688  P-0.2154534 0.0078428                                                                                                             \n16 720 57529.00 P  0.199109 0.007719  0.457848 0.010781  P-0.2159127 0.0079197                                                                                                             \n16 721 57530.00 P  0.200742 0.007772  0.456416 0.010875  P-0.2164842 0.0079964                                                                                                             \n16 722 57531.00 P  0.202351 0.007825  0.454960 0.010968  P-0.2172005 0.0080728                                                                                                             \n16 723 57532.00 P  0.203932 0.007877  0.453478 0.011060  P-0.2180702 0.0081489                                                                                                             \n16 724 57533.00 P  0.205487 0.007929  0.451972 0.011153  P-0.2190692 0.0082248                                                                                                             \n16 725 57534.00 P  0.207015 0.007981  0.450443 0.011245  P-0.2201448 0.0083005                                                                                                             \n16 726 57535.00 P  0.208515 0.008033  0.448890 0.011337  P-0.2212286 0.0083759                                                                                                             \n16 727 57536.00 P  0.209988 0.008084  0.447315 0.011428  P-0.2222556 0.0084511                                                                                                             \n16 728 57537.00 P  0.211431 0.008135  0.445716 0.011520  P-0.2231750 0.0085261                                                                                                             \n16 729 57538.00 P  0.212846 0.008186  0.444096 0.011611  P-0.2239618 0.0086008                                                                                                             \n16 730 57539.00 P  0.214232 0.008236  0.442454 0.011701  P-0.2246227 0.0086754                                                                                                             \n"},{"id":10860,"name":"iers_a_excerpt","nodeType":"TextFile","path":"astropy/utils/iers/tests/data","text":"15 126 57048.00 I  0.002902 0.000024  0.302160 0.000040  I-0.4867876 0.0000073  1.2748 0.0071  I    -0.155    0.119    -0.040    0.034  0.002890  0.302200 -0.4867861    -0.194    -0.055  \n15 127 57049.00 I  0.002371 0.000039  0.303081 0.000035  I-0.4880090 0.0000121  1.1461 0.0051  I    -0.148    0.049    -0.021    0.073  0.002389  0.303074 -0.4880195    -0.193    -0.060  \n15 128 57050.00 I  0.002261 0.000048  0.304429 0.000038  I-0.4890652 0.0000071  0.9738 0.0068  I    -0.144    0.119     0.011    0.055  0.002280  0.304472 -0.4890627    -0.166    -0.016  \n15 129 57051.00 I  0.002244 0.000048  0.306179 0.000035  I-0.4899792 0.0000060  0.8694 0.0047  I    -0.133    0.119     0.034    0.055  0.002250  0.306164 -0.4899632    -0.132     0.035  \n15 130 57052.00 I  0.002854 0.000048  0.308403 0.000035  I-0.4908258 0.0000062  0.8305 0.0039  I    -0.115    0.119     0.040    0.055  0.002907  0.308446 -0.4908208    -0.089     0.086  \n15 131 57053.00 I  0.003759 0.000045  0.310804 0.000024  I-0.4916596 0.0000051  0.8499 0.0043  I    -0.101    0.119     0.042    0.054  0.003734  0.310824 -0.4916557    -0.086     0.094  \n15 2 1 57054.00 I  0.004544 0.000061  0.313148 0.000030  I-0.4925306 0.0000060  0.8845 0.0039  I    -0.094    0.119     0.052    0.059  0.004581  0.313150 -0.4925323    -0.093     0.081  \n15 2 2 57055.00 I  0.004623 0.000051  0.315517 0.000029  I-0.4934373 0.0000058  0.9452 0.0061  I    -0.087    0.119     0.072    0.053                                                     \n15 2 3 57056.00 I  0.004190 0.000042  0.317761 0.000025  I-0.4944317 0.0000107  1.0378 0.0041  I    -0.082    0.119     0.089    0.075                                                     \n15 2 4 57057.00 I  0.003858 0.000052  0.319727 0.000027  I-0.4955079 0.0000059  1.1152 0.0061  I    -0.075    0.119     0.103    0.048                                                     \n15 2 5 57058.00 I  0.003203 0.000052  0.321256 0.000026  I-0.4966586 0.0000058  1.1820 0.0040  I    -0.063    0.119     0.126    0.048                                                     \n15 2 6 57059.00 I  0.002604 0.000052  0.322746 0.000026  I-0.4978678 0.0000053  1.2367 0.0033  I    -0.053    0.119     0.163    0.048                                                     \n15 2 7 57060.00 I  0.002144 0.000032  0.324351 0.000019  I-0.4991451 0.0000033  1.3309 0.0034  I    -0.056    0.119     0.201    0.024                                                     \n15 2 8 57061.00 I  0.001898 0.000037  0.325746 0.000023  I-0.5005174 0.0000043  1.3884 0.0027  I    -0.071    0.119     0.225    0.052                                                     \n15 2 9 57062.00 I  0.002025 0.000037  0.327045 0.000021  I-0.5018830 0.0000043  1.3290 0.0036  I    -0.086    0.119     0.228    0.052                                                     \n15 210 57063.00 I  0.002138 0.000021  0.328333 0.000019  I-0.5031643 0.0000058  1.2363 0.0030  I    -0.098    0.119     0.202    0.062                                                     \n15 211 57064.00 I  0.002223 0.000032  0.329713 0.000023  I-0.5043650 0.0000043  1.1720 0.0036  I    -0.100    0.119     0.149    0.047                                                     \n15 212 57065.00 I  0.002256 0.000032  0.331138 0.000024  I-0.5055269 0.0000042  1.1636 0.0030  I    -0.079    0.119     0.095    0.047                                                     \n15 213 57066.00 I  0.002424 0.000032  0.332371 0.000024  I-0.5067041 0.0000042  1.1909 0.0026  I    -0.036    0.119     0.066    0.047                                                     \n15 214 57067.00 I  0.002704 0.000026  0.333462 0.000020  I-0.5078936 0.0000030  1.1728 0.0027  I     0.003    0.119     0.045    0.027                                                     \n15 215 57068.00 I  0.002772 0.000033  0.334534 0.000024  I-0.5090570 0.0000033  1.1764 0.0023  I     0.027    0.045     0.008    0.037                                                     \n15 216 57069.00 I  0.002854 0.000033  0.335722 0.000025  I-0.5102715 0.0000035  1.2552 0.0033  I     0.045    0.045    -0.015    0.037                                                     \n15 217 57070.00 I  0.002844 0.000023  0.337156 0.000022  I-0.5115860 0.0000058  1.3897 0.0024  I     0.055    0.066     0.003    0.050                                                     \n15 218 57071.00 I  0.002756 0.000033  0.338410 0.000025  I-0.5130736 0.0000033  1.5925 0.0034  I     0.043    0.040     0.046    0.036                                                     \n15 219 57072.00 I  0.002769 0.000032  0.339609 0.000025  I-0.5147512 0.0000034  1.7361 0.0025  I     0.012    0.040     0.080    0.036                                                     \n15 220 57073.00 I  0.002580 0.000032  0.341034 0.000026  I-0.5165088 0.0000037  1.7687 0.0027  I    -0.024    0.040     0.101    0.036                                                     \n15 221 57074.00 I  0.002345 0.000025  0.342662 0.000021  I-0.5182664 0.0000042  1.7345 0.0024  I    -0.052    0.119     0.114    0.023                                                     \n15 222 57075.00 I  0.002461 0.000030  0.344425 0.000024  I-0.5199568 0.0000031  1.6371 0.0026  I    -0.059    0.119     0.108    0.036                                                     \n15 223 57076.00 I  0.003021 0.000030  0.346361 0.000024  I-0.5215198 0.0000029  1.4774 0.0026  I    -0.043    0.119     0.092    0.036                                                     \n15 224 57077.00 I  0.003313 0.000020  0.348467 0.000020  I-0.5228871 0.0000042  1.2443 0.0026  I    -0.020    0.119     0.100    0.044                                                     \n15 225 57078.00 I  0.003151 0.000020  0.350293 0.000019  I-0.5240195 0.0000044  1.0446 0.0031  I    -0.004    0.119     0.151    0.045                                                     \n15 226 57079.00 I  0.003153 0.000020  0.351720 0.000019  I-0.5250116 0.0000045  0.9509 0.0033  I     0.012    0.119     0.220    0.045                                                     \n15 227 57080.00 I  0.003288 0.000021  0.353151 0.000021  I-0.5259330 0.0000050  0.8925 0.0063  I     0.041    0.119     0.284    0.045                                                     \n15 228 57081.00 I  0.003184 0.000011  0.354780 0.000015  I-0.5268057 0.0000118  0.8616 0.0064  P    -0.006    0.239     0.108    0.600                                                     \n15 3 1 57082.00 I  0.003159 0.000012  0.356592 0.000017  I-0.5276758 0.0000118  0.8894 0.0080  P     0.007    0.239     0.093    0.600                                                     \n15 3 2 57083.00 I  0.003484 0.000091  0.358608 0.000092  I-0.5285954 0.0000109  0.9498 0.0107  P     0.017    0.239     0.086    0.600                                                     \n15 3 3 57084.00 I  0.003836 0.000092  0.360558 0.000092  I-0.5295768 0.0000179  1.0144 0.0094  P     0.025    0.239     0.094    0.600                                                     \n15 3 4 57085.00 I  0.003961 0.000092  0.362222 0.000093  I-0.5306268 0.0000154  1.0866 0.0108  P     0.027    0.239     0.117    0.600                                                     \n15 3 5 57086.00 I  0.004269 0.000093  0.363666 0.000093  I-0.5317409 0.0000122  1.1313 0.0089  P     0.027    0.239     0.139    0.600                                                     \n15 3 6 57087.00 I  0.004778 0.000092  0.364949 0.000092  I-0.5328903 0.0000088  1.1785 0.0079  P     0.027    0.239     0.149    0.600                                                     \n15 3 7 57088.00 I  0.004988 0.000092  0.366147 0.000092  I-0.5340985 0.0000100  1.2274 0.0066  P     0.015    0.239     0.146    0.600                                                     \n15 3 8 57089.00 I  0.004638 0.000091  0.367236 0.000093  I-0.5353452 0.0000099  1.2765 0.0070  P    -0.009    0.239     0.142    0.600                                                     \n15 3 9 57090.00 I  0.004036 0.000092  0.368200 0.000093  I-0.5366619 0.0000099  1.3567 0.0070  P    -0.033    0.239     0.135    0.600                                                     \n15 310 57091.00 I  0.003585 0.000091  0.369259 0.000092  I-0.5380421 0.0000098  1.3875 0.0070  P    -0.045    0.239     0.117    0.600                                                     \n15 311 57092.00 I  0.003343 0.000092  0.370447 0.000093  I-0.5394314 0.0000100  1.4018 0.0068  P    -0.040    0.239     0.091    0.600                                                     \n15 312 57093.00 I  0.003194 0.000092  0.371602 0.000093  I-0.5408469 0.0000094  1.4197 0.0068  P    -0.015    0.239     0.085    0.600                                                     \n15 313 57094.00 I  0.002917 0.000091  0.372658 0.000092  I-0.5422589 0.0000091  1.4020 0.0065  P     0.019    0.239     0.117    0.600                                                     \n15 314 57095.00 I  0.002739 0.000092  0.373613 0.000092  I-0.5436785 0.0000090  1.4673 0.0056  P     0.029    0.239     0.148    0.600                                                     \n15 315 57096.00 I  0.002778 0.000091  0.374548 0.000091  I-0.5452040 0.0000066  1.5642 0.0053  P     0.008    0.239     0.132    0.600                                                     \n15 316 57097.00 I  0.002789 0.000091  0.375473 0.000093  I-0.5468035 0.0000056  1.6509 0.0042  P    -0.012    0.239     0.085    0.600                                                     \n15 317 57098.00 I  0.002799 0.000091  0.376430 0.000094  I-0.5485481 0.0000051  1.8644 0.0326  P    -0.009    0.239     0.068    0.600                                                     \n15 318 57099.00 I  0.002880 0.000091  0.377429 0.000094  I-0.5504555 0.0000650  1.8477 0.0277  P     0.007    0.239     0.099    0.600                                                     \n15 319 57100.00 I  0.003450 0.000091  0.378351 0.000091  I-0.5525515 0.0000552                 P     0.014    0.239     0.137    0.600                                                     \n15 320 57101.00 P  0.004024 0.000697  0.379498 0.000414  P-0.5547450 0.0001080                 P     0.011    0.239     0.163    0.600                                                     \n15 321 57102.00 P  0.004848 0.001034  0.380682 0.000681  P-0.5569577 0.0002041                 P     0.005    0.239     0.177    0.600                                                     \n15 322 57103.00 P  0.005564 0.001303  0.381927 0.000912  P-0.5590933 0.0003028                 P    -0.001    0.239     0.180    0.600                                                     \n15 323 57104.00 P  0.006227 0.001536  0.383232 0.001122  P-0.5610707 0.0004021                 P    -0.006    0.239     0.167    0.600                                                     \n15 324 57105.00 P  0.006860 0.001744  0.384571 0.001318  P-0.5628741 0.0005017                 P    -0.012    0.239     0.152    0.600                                                     \n15 325 57106.00 P  0.007427 0.001935  0.385947 0.001503  P-0.5645205 0.0006014                 P    -0.015    0.239     0.145    0.600                                                     \n15 326 57107.00 P  0.007984 0.002113  0.387309 0.001679  P-0.5660324 0.0007012                 P    -0.010    0.239     0.143    0.600                                                     \n"},{"col":0,"comment":"null","endLoc":827,"header":"@function_helper\ndef interp(x, xp, fp, *args, **kwargs)","id":10861,"name":"interp","nodeType":"Function","startLoc":816,"text":"@function_helper\ndef interp(x, xp, fp, *args, **kwargs):\n    from astropy.units import Quantity\n\n    (x, xp), _ = _quantities2arrays(x, xp)\n    if isinstance(fp, Quantity):\n        unit = fp.unit\n        fp = fp.value\n    else:\n        unit = None\n\n    return (x, xp, fp) + args, kwargs, unit, None"},{"id":10862,"name":"finals2000A-2016-04-30-test","nodeType":"TextFile","path":"astropy/utils/iers/tests/data","text":"16 2 1 57419.00 I -0.003225 0.000031  0.299494 0.000025  I 0.0262864 0.0000042  1.3154 0.0035  I    -0.094    0.119    -0.077    0.029 -0.003291  0.299534  0.0262719    -0.094    -0.169\n16 2 2 57420.00 I -0.004706 0.000030  0.301252 0.000024  I 0.0249911 0.0000057  1.2412 0.0034  I    -0.108    0.119    -0.082    0.035 -0.004751  0.301342  0.0249958    -0.128    -0.151  \n16 2 3 57421.00 I -0.005690 0.000031  0.302711 0.000025  I 0.0238039 0.0000054  1.1674 0.0040  I    -0.112    0.045    -0.102    0.034 -0.005725  0.302649  0.0238016    -0.137    -0.154  \n16 2 4 57422.00 I -0.006490 0.000030  0.304493 0.000023  I 0.0226216 0.0000057  1.1976 0.0040  I    -0.105    0.045    -0.115    0.034 -0.006418  0.304497  0.0226308    -0.139    -0.163  \n16 2 5 57423.00 I -0.007499 0.000030  0.306410 0.000020  I 0.0214229 0.0000059  1.1850 0.0048  I    -0.094    0.045    -0.114    0.034 -0.007481  0.306466  0.0214306    -0.142    -0.171  \n16 2 6 57424.00 I -0.008637 0.000024  0.308121 0.000018  I 0.0201799 0.0000077  1.3874 0.0042  I    -0.094    0.070    -0.115    0.034 -0.008646  0.308134  0.0201501    -0.145    -0.180  \n16 2 7 57425.00 I -0.009431 0.000032  0.309779 0.000020  I 0.0186616 0.0000061  1.5494 0.0050  I    -0.103    0.053    -0.117    0.032 -0.009564  0.309799  0.0187256    -0.146    -0.188  \n16 2 8 57426.00 I -0.009639 0.000035  0.311456 0.000019  I 0.0171013 0.0000064  1.6508 0.0052  I    -0.118    0.052    -0.112    0.039 -0.009602  0.311455  0.0171286    -0.150    -0.197  \n16 2 9 57427.00 I -0.009707 0.000034  0.313146 0.000017  I 0.0153086 0.0000083  1.9064 0.0048  I    -0.137    0.119    -0.106    0.046 -0.009695  0.313158  0.0153216    -0.151    -0.205  \n16 210 57428.00 I -0.009949 0.000035  0.315007 0.000024  I 0.0133131 0.0000072  2.0881 0.0053  I    -0.163    0.119    -0.110    0.053 -0.009848  0.314971  0.0133091    -0.162    -0.134  \n16 211 57429.00 I -0.010522 0.000036  0.317056 0.000024  I 0.0111967 0.0000067  2.0770 0.0049  I    -0.189    0.119    -0.121    0.053 -0.010525  0.317115  0.0112339    -0.182    -0.133  \n16 212 57430.00 I -0.011219 0.000037  0.319016 0.000025  I 0.0091589 0.0000066  2.0665 0.0055  I    -0.206    0.119    -0.119    0.053 -0.011200  0.319001  0.0091407    -0.206    -0.158  \n16 213 57431.00 I -0.011874 0.000031  0.321066 0.000024  I 0.0070911 0.0000088  1.9738 0.0047  I    -0.211    0.119    -0.106    0.072 -0.011889  0.321068  0.0071356    -0.208    -0.158  \n16 214 57432.00 I -0.012456 0.000029  0.323240 0.000028  I 0.0052399 0.0000068  1.7954 0.0055  I    -0.210    0.119    -0.093    0.047 -0.012445  0.323271  0.0052511    -0.202    -0.149  \n16 215 57433.00 I -0.013108 0.000027  0.325311 0.000027  I 0.0034804 0.0000065  1.6767 0.0047  I    -0.209    0.119    -0.080    0.056 -0.013071  0.325381  0.0035069    -0.194    -0.140  \n16 216 57434.00 I -0.013911 0.000023  0.327010 0.000022  I 0.0019144 0.0000065  1.4745 0.0042  I    -0.203    0.045    -0.057    0.050 -0.013912  0.327076  0.0019126    -0.187    -0.130  \n16 217 57435.00 I -0.014798 0.000021  0.328533 0.000023  I 0.0004966 0.0000052  1.3769 0.0045  I    -0.186    0.045    -0.032    0.050 -0.014734  0.328472  0.0004608    -0.191    -0.037  \n16 218 57436.00 I -0.015972 0.000018  0.330387 0.000023  I-0.0008425 0.0000063  1.2886 0.0043  I    -0.166    0.045    -0.025    0.050 -0.015929  0.330417 -0.0008581    -0.186    -0.027  \n16 219 57437.00 I -0.017359 0.000017  0.332361 0.000022  I-0.0021162 0.0000068  1.3072 0.0107  I    -0.150    0.045    -0.032    0.050 -0.017369  0.332401 -0.0021130    -0.179    -0.049  \n16 220 57438.00 I -0.018572 0.000019  0.334012 0.000020  I-0.0034607 0.0000205  1.3373 0.0040  I    -0.135    0.082    -0.033    0.156 -0.018639  0.334094 -0.0034487    -0.171    -0.071  \n16 221 57439.00 I -0.019315 0.000033  0.335553 0.000023  I-0.0048274 0.0000044  1.4772 0.0105  I    -0.120    0.119    -0.029    0.011 -0.019329  0.335459 -0.0048827    -0.164    -0.092  \n16 222 57440.00 I -0.019952 0.000034  0.337603 0.000023  I-0.0064226 0.0000046  1.6395 0.0033  I    -0.108    0.119    -0.038    0.011 -0.019862  0.337623 -0.0064324    -0.156    -0.114  \n16 223 57441.00 I -0.020869 0.000035  0.339814 0.000022  I-0.0080691 0.0000049  1.6897 0.0032  I    -0.103    0.119    -0.063    0.027 -0.020905  0.339830 -0.0080787    -0.149    -0.136  \n16 224 57442.00 I -0.021582 0.000037  0.342052 0.000026  I-0.0098083 0.0000045  1.7588 0.0034  I    -0.096    0.119    -0.079    0.033 -0.021616  0.342062 -0.0097889    -0.143    -0.149  \n16 225 57443.00 I -0.021898 0.000037  0.344332 0.000025  I-0.0115839 0.0000046  1.8195 0.0036  I    -0.093    0.119    -0.073    0.033 -0.021911  0.344416 -0.0115637    -0.139    -0.160  \n16 226 57444.00 I -0.022036 0.000036  0.346321 0.000022  I-0.0134316 0.0000055  1.8329 0.0048  I    -0.102    0.119    -0.062    0.033 -0.022011  0.346307 -0.0134119    -0.133    -0.171  \n16 227 57445.00 I -0.022387 0.000024  0.348429 0.000019  I-0.0152292 0.0000084  1.7846 0.0042  I    -0.118    0.119    -0.064    0.059 -0.022273  0.348402 -0.0152189    -0.129    -0.181  \n16 228 57446.00 I -0.023235 0.000025  0.350749 0.000020  I-0.0170194 0.0000064  1.7921 0.0052  I    -0.122    0.119    -0.082    0.035 -0.023218  0.350815 -0.0169781    -0.124    -0.192  \n16 229 57447.00 I -0.024219 0.000023  0.352784 0.000020  I-0.0187707 0.0000062  1.6716 0.0053  I    -0.111    0.119    -0.105    0.027 -0.024254  0.352863 -0.0186952    -0.119    -0.203  \n16 3 1 57448.00 I -0.024807 0.000023  0.354400 0.000014  I-0.0203703 0.0000084  1.5743 0.0046  I    -0.088    0.119    -0.125    0.011 -0.024918  0.354451 -0.0203678    -0.114    -0.214  \n16 3 2 57449.00 I -0.024651 0.000025  0.355942 0.000020  I-0.0219780 0.0000067  1.6532 0.0052  I    -0.055    0.119    -0.125    0.049                                                     \n16 3 3 57450.00 I -0.024054 0.000025  0.357866 0.000019  I-0.0236772 0.0000060  1.7337 0.0044  I    -0.016    0.119    -0.093    0.049                                                     \n16 3 4 57451.00 I -0.023735 0.000027  0.360180 0.000019  I-0.0254270 0.0000057  1.7591 0.0052  I     0.008    0.119    -0.056    0.049                                                     \n16 3 5 57452.00 I -0.023740 0.000026  0.362598 0.000018  I-0.0272149 0.0000084  1.8430 0.0041  I     0.011    0.119    -0.053    0.091                                                     \n16 3 6 57453.00 I -0.023745 0.000027  0.365029 0.000018  I-0.0291495 0.0000060  2.0365 0.0052  I     0.010    0.119    -0.081    0.052                                                     \n16 3 7 57454.00 I -0.024021 0.000024  0.367538 0.000018  I-0.0312844 0.0000060  2.2194 0.0045  I     0.021    0.119    -0.095    0.052                                                     \n16 3 8 57455.00 I -0.024457 0.000021  0.370024 0.000012  I-0.0335554 0.0000066  2.3035 0.0044  I     0.036    0.119    -0.085    0.026                                                     \n16 3 9 57456.00 I -0.024829 0.000022  0.372483 0.000011  I-0.0359012 0.0000065  2.4168 0.0045  I     0.037    0.119    -0.072    0.026                                                     \n16 310 57457.00 I -0.025066 0.000020  0.374873 0.000011  I-0.0383738 0.0000062  2.4843 0.0044  I     0.025    0.119    -0.063    0.026                                                     \n16 311 57458.00 I -0.025097 0.000017  0.377004 0.000011  I-0.0408388 0.0000060  2.4588 0.0080  I     0.011    0.119    -0.053    0.026                                                     \n16 312 57459.00 I -0.025181 0.000017  0.378932 0.000012  I-0.0432700 0.0000148  2.3690 0.0040  I     0.008    0.119    -0.040    0.150                                                     \n16 313 57460.00 I -0.025188 0.000024  0.380780 0.000016  I-0.0455624 0.0000054  2.2359 0.0079  I     0.013    0.119    -0.031    0.150                                                     \n16 314 57461.00 I -0.024758 0.000026  0.382629 0.000016  I-0.0477465 0.0000056  2.1168 0.0038  I     0.011    0.119    -0.012    0.150                                                     \n16 315 57462.00 I -0.023945 0.000025  0.384773 0.000017  I-0.0497744 0.0000053  1.9330 0.0037  I    -0.002    0.119     0.022    0.150                                                     \n16 316 57463.00 I -0.022702 0.000026  0.387109 0.000023  I-0.0516492 0.0000048  1.8593 0.0035  I    -0.012    0.042     0.057    0.020                                                     \n16 317 57464.00 I -0.020782 0.000026  0.389469 0.000023  I-0.0535037 0.0000047  1.8176 0.0034  I    -0.009    0.042     0.067    0.020                                                     \n16 318 57465.00 I -0.018391 0.000025  0.391971 0.000022  I-0.0552954 0.0000047  1.8089 0.0041  I     0.001    0.042     0.060    0.020                                                     \n16 319 57466.00 I -0.016187 0.000017  0.394472 0.000020  I-0.0571458 0.0000067  1.8730 0.0036  I     0.003    0.047     0.046    0.029                                                     \n16 320 57467.00 I -0.014601 0.000025  0.396962 0.000029  I-0.0590734 0.0000055  2.0332 0.0044  I    -0.007    0.052     0.033    0.049                                                     \n16 321 57468.00 I -0.013767 0.000026  0.399494 0.000030  I-0.0611669 0.0000057  2.0575 0.0043  I    -0.028    0.052     0.021    0.056                                                     \n16 322 57469.00 I -0.013562 0.000024  0.402015 0.000024  I-0.0631898 0.0000065  2.0861 0.0043  I    -0.054    0.059     0.010    0.076                                                     \n16 323 57470.00 I -0.013645 0.000024  0.404333 0.000024  I-0.0653380 0.0000064  2.1115 0.0046  I    -0.074    0.059     0.009    0.076                                                     \n16 324 57471.00 I -0.013616 0.000024  0.406392 0.000024  I-0.0673565 0.0000066  1.9679 0.0046  I    -0.088    0.059     0.018    0.076                                                     \n16 325 57472.00 I -0.013255 0.000024  0.408403 0.000024  I-0.0693406 0.0000065  2.0248 0.0063  I    -0.109    0.059     0.024    0.076                                                     \n16 326 57473.00 I -0.012617 0.000013  0.410472 0.000013  I-0.0713968 0.0000108  2.0538 0.0066  I    -0.134    0.119     0.017    0.225                                                     \n16 327 57474.00 I -0.011855 0.000011  0.412577 0.000013  I-0.0734180 0.0000116  1.9922 0.0069  I    -0.144    0.119    -0.003    0.150                                                     \n16 328 57475.00 I -0.011092 0.000023  0.414506 0.000021  I-0.0753619 0.0000085  1.8727 0.0072  I    -0.132    0.058    -0.029    0.069                                                     \n16 329 57476.00 I -0.010256 0.000023  0.416297 0.000022  I-0.0771761 0.0000085  1.7914 0.0055  I    -0.106    0.058    -0.054    0.069                                                     \n16 330 57477.00 I -0.009394 0.000023  0.418007 0.000023  I-0.0789625 0.0000070  1.7637 0.0055  I    -0.070    0.047    -0.058    0.063                                                     \n16 331 57478.00 I -0.008769 0.000022  0.419685 0.000025  I-0.0807036 0.0000069  1.7363 0.0049  I    -0.034    0.047    -0.029    0.063                                                     \n16 4 1 57479.00 I -0.008414 0.000022  0.421202 0.000027  I-0.0824533 0.0000068  1.7634 0.0049  I    -0.021    0.047     0.000    0.063                                                     \n16 4 2 57480.00 I -0.008088 0.000022  0.422663 0.000027  I-0.0842517 0.0000069  1.8544 0.0042  I    -0.036    0.047    -0.021    0.063                                                     \n16 4 3 57481.00 I -0.007515 0.000013  0.424137 0.000024  I-0.0861632 0.0000050  1.9487 0.0047  I    -0.052    0.119    -0.082    0.024                                                     \n16 4 4 57482.00 I -0.006419 0.000021  0.425858 0.000023  I-0.0881549 0.0000064  2.0606 0.0045  I    -0.040    0.119    -0.113    0.024                                                     \n16 4 5 57483.00 I -0.004709 0.000022  0.427854 0.000022  I-0.0902894 0.0000074  2.1876 0.0049  I    -0.016    0.119    -0.084    0.014                                                     \n16 4 6 57484.00 I -0.002606 0.000022  0.429902 0.000021  I-0.0925256 0.0000073  2.3011 0.0052  I    -0.002    0.119    -0.031    0.014                                                     \n16 4 7 57485.00 I -0.000789 0.000022  0.432202 0.000018  I-0.0948791 0.0000073  2.3772 0.0052  I     0.000    0.119     0.010    0.014                                                     \n16 4 8 57486.00 I  0.000664 0.000022  0.434713 0.000016  I-0.0972531 0.0000073  2.3725 0.0122  I    -0.002    0.119     0.040    0.014                                                     \n16 4 9 57487.00 I  0.002059 0.000023  0.437042 0.000013  I-0.0995861 0.0000232  2.2539 0.0054  I    -0.006    0.119     0.063    0.150                                                     \n16 410 57488.00 I  0.003347 0.000021  0.439038 0.000016  I-0.1017251 0.0000079  2.0278 0.0120  I    -0.008    0.119     0.072    0.061                                                     \n16 411 57489.00 I  0.004628 0.000019  0.440926 0.000015  I-0.1036627 0.0000060  1.8647 0.0049  I    -0.005    0.119     0.078    0.061                                                     \n16 412 57490.00 I  0.006143 0.000019  0.442665 0.000016  I-0.1054713 0.0000059  1.7520 0.0042  I     0.004    0.119     0.096    0.061                                                     \n16 413 57491.00 I  0.007737 0.000020  0.444189 0.000016  I-0.1071693 0.0000060  1.6470 0.0044  I     0.019    0.119     0.114    0.061                                                     \n16 414 57492.00 I  0.009116 0.000020  0.445678 0.000016  I-0.1087724 0.0000066  1.5633 0.0046  I     0.046    0.119     0.118    0.061                                                     \n16 415 57493.00 I  0.010471 0.000019  0.447462 0.000017  I-0.1103218 0.0000069  1.5574 0.0087  I     0.076    0.119     0.108    0.061                                                     \n16 416 57494.00 I  0.011967 0.000020  0.449627 0.000018  I-0.1119079 0.0000162  1.6135 0.0060  I     0.095    0.119     0.095    0.150                                                     \n16 417 57495.00 I  0.013661 0.000025  0.451890 0.000023  I-0.1135287 0.0000097  1.6091 0.0095  I     0.099    0.119     0.086    0.013                                                     \n16 418 57496.00 I  0.015451 0.000028  0.454016 0.000028  I-0.1151529 0.0000098  1.6851 0.0068  I     0.090    0.119     0.090    0.013                                                     \n16 419 57497.00 I  0.017078 0.000032  0.455707 0.000031  I-0.1169025 0.0000096  1.7719 0.0070  I     0.070    0.119     0.113    0.013                                                     \n16 420 57498.00 I  0.018626 0.000041  0.456788 0.000041  I-0.1186505 0.0000101  1.7201 0.0062  P     0.011    0.239     0.092    0.600                                                     \n16 421 57499.00 I  0.020312 0.000044  0.457663 0.000043  I-0.1203383 0.0000079  1.6551 0.0058  P     0.002    0.239     0.097    0.600                                                     \n16 422 57500.00 I  0.022149 0.000091  0.458767 0.000093  I-0.1219712 0.0000056  1.6216 0.0057  P    -0.002    0.239     0.074    0.600                                                     \n16 423 57501.00 I  0.024059 0.000091  0.460210 0.000092  I-0.1235866 0.0000083  1.6033 0.0048  P    -0.009    0.239     0.041    0.600                                                     \n16 424 57502.00 I  0.025767 0.000091  0.461829 0.000092  I-0.1251404 0.0000079  1.4728 0.0092  P    -0.007    0.239     0.018    0.600                                                     \n16 425 57503.00 I  0.027084 0.000091  0.463531 0.000093  I-0.1265278 0.0000165  1.3290 0.0090  P     0.013    0.239     0.007    0.600                                                     \n16 426 57504.00 I  0.028086 0.000091  0.465338 0.000093  I-0.1278231 0.0000161  1.2593 0.0118  P     0.040    0.239     0.003    0.600                                                     \n16 427 57505.00 I  0.028928 0.000091  0.467015 0.000092  I-0.1290372 0.0000169  1.1618 0.0123  P     0.065    0.239     0.008    0.600                                                     \n16 428 57506.00 I  0.029730 0.000092  0.468564 0.000091  I-0.1303716 0.0000185                 P     0.083    0.239     0.035    0.600                                                     \n16 429 57507.00 P  0.030798 0.000622  0.469783 0.000448  P-0.1317429 0.0001080                 P     0.085    0.239     0.066    0.600                                                     \n16 430 57508.00 P  0.031994 0.000923  0.470993 0.000737  P-0.1331878 0.0002041                 P     0.065    0.239     0.057    0.600                                                     \n16 5 1 57509.00 P  0.033490 0.001163  0.472083 0.000987  P-0.1347405 0.0003028                 P     0.040    0.239     0.007    0.600                                                     \n16 5 2 57510.00 P  0.035183 0.001370  0.473116 0.001215  P-0.1364495 0.0004021                 P     0.034    0.239    -0.028    0.600                                                     \n16 5 3 57511.00 P  0.036987 0.001556  0.474102 0.001426  P-0.1383398 0.0005017                 P     0.043    0.239    -0.006    0.600                                                     \n16 5 4 57512.00 P  0.038845 0.001727  0.475046 0.001626  P-0.1403703 0.0006014                 P     0.046    0.239     0.044    0.600                                                     \n16 5 5 57513.00 P  0.040719 0.001885  0.475994 0.001817  P-0.1424457 0.0007012                 P     0.037    0.239     0.082    0.600                                                     \n16 5 6 57514.00 P  0.042581 0.002035  0.476950 0.002001  P-0.1444593 0.0007500                 P     0.028    0.239     0.101    0.600                                                     \n16 5 7 57515.00 P  0.044425 0.002176  0.477871 0.002178  P-0.1463307 0.0005500                 P     0.014    0.239     0.107    0.600                                                     \n16 5 8 57516.00 P  0.046286 0.002310  0.478748 0.002349  P-0.1480080 0.0007548                 P    -0.006    0.239     0.096    0.600                                                     \n16 5 9 57517.00 P  0.048207 0.002439  0.479583 0.002516  P-0.1494885 0.0009344                 P    -0.019    0.239     0.073    0.600                                                     \n16 510 57518.00 P  0.050193 0.002564  0.480379 0.002679  P-0.1508450 0.0010994                 P    -0.012    0.239     0.056    0.600                                                     \n16 511 57519.00 P  0.052250 0.002683  0.481153 0.002838  P-0.1521313 0.0012543                 P     0.016    0.239     0.051    0.600                                                     \n16 512 57520.00 P  0.054368 0.002799  0.481924 0.002993  P-0.1533788 0.0014016                 P     0.052    0.239     0.053    0.600                                                     \n16 513 57521.00 P  0.056522 0.002911  0.482690 0.003146  P-0.1546475 0.0015429                 P     0.077    0.239     0.062    0.600                                                     \n16 514 57522.00 P  0.058696 0.003020  0.483452 0.003295  P-0.1559391 0.0016792                 P     0.082    0.239     0.068    0.600                                                     \n16 515 57523.00 P  0.060870 0.003127  0.484205 0.003442  P-0.1572557 0.0018113                 P     0.077    0.239     0.061    0.600                                                     \n16 516 57524.00 P  0.063031 0.003230  0.484931 0.003587  P-0.1585736 0.0019399                 P     0.067    0.239     0.062    0.600                                                     \n16 517 57525.00 P  0.065179 0.003331  0.485615 0.003729  P-0.1598755 0.0020652                 P     0.046    0.239     0.087    0.600                                                     \n16 518 57526.00 P  0.067327 0.003430  0.486255 0.003870  P-0.1611463 0.0021877                 P     0.017    0.239     0.124    0.600                                                     \n16 519 57527.00 P  0.069480 0.003527  0.486853 0.004008  P-0.1623693 0.0023077                 P    -0.001    0.239     0.132    0.600                                                     \n16 520 57528.00 P  0.071641 0.003621  0.487411 0.004145  P-0.1635235 0.0024255                 P     0.001    0.239     0.103    0.600                                                     \n16 521 57529.00 P  0.073815 0.003714  0.487931 0.004279  P-0.1645892 0.0025411                 P     0.009    0.239     0.066    0.600                                                     \n16 522 57530.00 P  0.076004 0.003806  0.488420 0.004413  P-0.1655561 0.0026548                 P     0.018    0.239     0.050    0.600                                                     \n16 523 57531.00 P  0.078203 0.003895  0.488880 0.004544  P-0.1664451 0.0027668                 P     0.037    0.239     0.053    0.600                                                     \n16 524 57532.00 P  0.080408 0.003983  0.489309 0.004674  P-0.1672908 0.0028772                 P     0.059    0.239     0.062    0.600                                                     \n16 525 57533.00 P  0.082617 0.004070  0.489704 0.004803  P-0.1681336 0.0029860                 P     0.067    0.239     0.075    0.600                                                     \n16 526 57534.00 P  0.084827 0.004155  0.490064 0.004930  P-0.1690194 0.0030934                 P     0.059    0.239     0.093    0.600                                                     \n16 527 57535.00 P  0.087040 0.004239  0.490383 0.005057  P-0.1699970 0.0031995                 P     0.047    0.239     0.110    0.600                                                     \n16 528 57536.00 P  0.089257 0.004322  0.490663 0.005182  P-0.1710955 0.0033043                 P     0.037    0.239     0.111    0.600                                                     \n16 529 57537.00 P  0.091478 0.004403  0.490904 0.005305  P-0.1723451 0.0034080                 P     0.027    0.239     0.088    0.600                                                     \n16 530 57538.00 P  0.093706 0.004484  0.491106 0.005428  P-0.1737501 0.0035105                 P     0.023    0.239     0.065    0.600                                                     \n16 531 57539.00 P  0.095941 0.004563  0.491273 0.005550  P-0.1752782 0.0036120                 P     0.025    0.239     0.063    0.600                                                     \n16 6 1 57540.00 P  0.098182 0.004641  0.491405 0.005670  P-0.1768742 0.0037124                 P     0.023    0.239     0.083    0.600                                                     \n16 6 2 57541.00 P  0.100428 0.004719  0.491506 0.005790  P-0.1784618 0.0038119                 P     0.012    0.239     0.109    0.600                                                     \n16 6 3 57542.00 P  0.102675 0.004795  0.491574 0.005908  P-0.1799593 0.0039105                 P     0.000    0.239     0.131    0.600                                                     \n16 6 4 57543.00 P  0.104924 0.004871  0.491610 0.006026  P-0.1813071 0.0040082                 P    -0.005    0.239     0.137    0.600                                                     \n16 6 5 57544.00 P  0.107172 0.004945  0.491612 0.006143  P-0.1824904 0.0041051                 P    -0.005    0.239     0.124    0.600                                                     \n16 6 6 57545.00 P  0.109420 0.005019  0.491579 0.006259  P-0.1835411 0.0042012                 P    -0.003    0.239     0.101    0.600                                                     \n16 6 7 57546.00 P  0.111667 0.005092  0.491512 0.006374  P-0.1845091 0.0042965                 P     0.007    0.239     0.085    0.600                                                     \n16 6 8 57547.00 P  0.113913 0.005164  0.491411 0.006488  P-0.1854466 0.0043911                 P     0.030    0.239     0.084    0.600                                                     \n16 6 9 57548.00 P  0.116157 0.005235  0.491274 0.006602  P-0.1863873 0.0044849                 P     0.055    0.239     0.098    0.600                                                     \n16 610 57549.00 P  0.118399 0.005306  0.491104 0.006715  P-0.1873523 0.0045781                 P     0.065    0.239     0.127    0.600                                                     \n16 611 57550.00 P  0.120639 0.005376  0.490901 0.006827  P-0.1883409 0.0046706                 P     0.060    0.239     0.154    0.600                                                     \n16 612 57551.00 P  0.122875 0.005445  0.490664 0.006938  P-0.1893388 0.0047625                 P     0.052    0.239     0.159    0.600                                                     \n16 613 57552.00 P  0.125106 0.005514  0.490394 0.007049  P-0.1903249 0.0048537                 P     0.046    0.239     0.145    0.600                                                     \n16 614 57553.00 P  0.127331 0.005582  0.490090 0.007159  P-0.1912717 0.0049444                 P     0.032    0.239     0.141    0.600                                                     \n16 615 57554.00 P  0.129551 0.005650  0.489753 0.007268  P-0.1921561 0.0050344                 P     0.005    0.239     0.154    0.600                                                     \n16 616 57555.00 P  0.131763 0.005716  0.489382 0.007377  P-0.1929601 0.0051240                 P    -0.012    0.239     0.159    0.600                                                     \n16 617 57556.00 P  0.133969 0.005782  0.488978 0.007485  P-0.1936729 0.0052129                 P    -0.009    0.239     0.143    0.600                                                     \n16 618 57557.00 P  0.136167 0.005848  0.488539 0.007592  P-0.1942946 0.0053014                 P     0.004    0.239     0.122    0.600                                                     \n16 619 57558.00 P  0.138356 0.005913  0.488067 0.007699  P-0.1948369 0.0053893                 P     0.015    0.239     0.115    0.600                                                     \n16 620 57559.00 P  0.140538 0.005978  0.487561 0.007806  P-0.1953178 0.0054768                 P     0.029    0.239     0.117    0.600                                                     \n16 621 57560.00 P  0.142710 0.006042  0.487022 0.007911  P-0.1957658 0.0055637                 P     0.048    0.239     0.121    0.600                                                     \n16 622 57561.00 P  0.144872 0.006105  0.486450 0.008017  P-0.1962213 0.0056502                 P     0.056    0.239     0.132    0.600                                                     \n16 623 57562.00 P  0.147024 0.006168  0.485846 0.008121  P-0.1967329 0.0057362                 P     0.040    0.239     0.147    0.600                                                     \n16 624 57563.00 P  0.149165 0.006231  0.485208 0.008226  P-0.1973441 0.0058218                 P     0.019    0.239     0.155    0.600                                                     \n16 625 57564.00 P  0.151294 0.006293  0.484538 0.008329  P-0.1980871 0.0059070                 P     0.009    0.239     0.148    0.600                                                     \n16 626 57565.00 P  0.153411 0.006355  0.483836 0.008432  P-0.1989695 0.0059917                 P     0.009    0.239     0.141    0.600                                                     \n16 627 57566.00 P  0.155515 0.006416  0.483101 0.008535  P-0.1999726 0.0060760                 P     0.010    0.239     0.141    0.600                                                     \n16 628 57567.00 P  0.157606 0.006477  0.482334 0.008637  P-0.2010510 0.0061599                 P     0.007    0.239     0.138    0.600                                                     \n16 629 57568.00 P  0.159683 0.006537  0.481535 0.008739  P-0.2021438 0.0062434                 P     0.002    0.239     0.130    0.600                                                     \n16 630 57569.00 P  0.161745 0.006597  0.480705 0.008840  P-0.2031853 0.0063266                 P    -0.007    0.239     0.133    0.600                                                     \n16 7 1 57570.00 P  0.163793 0.006656  0.479843 0.008941  P-0.2041214 0.0064093                 P    -0.016    0.239     0.151    0.600                                                     \n16 7 2 57571.00 P  0.165825 0.006715  0.478950 0.009041  P-0.2049288 0.0064917                 P    -0.018    0.239     0.166    0.600                                                     \n16 7 3 57572.00 P  0.167840 0.006774  0.478026 0.009141  P-0.2056188 0.0065737                 P    -0.007    0.239     0.157    0.600                                                     \n16 7 4 57573.00 P  0.169839 0.006832  0.477071 0.009241  P-0.2062331 0.0066554                 P     0.011    0.239     0.140    0.600                                                     \n16 7 5 57574.00 P  0.171821 0.006890  0.476086 0.009340  P-0.2068275 0.0067368                 P     0.024    0.239     0.138    0.600                                                     \n16 7 6 57575.00 P  0.173785 0.006948  0.475071 0.009439  P-0.2074512 0.0068177                 P     0.031    0.239     0.152    0.600                                                     \n16 7 7 57576.00 P  0.175730 0.007005  0.474025 0.009537  P-0.2081302 0.0068984                 P     0.033    0.239     0.174    0.600                                                     \n16 7 8 57577.00 P  0.177656 0.007062  0.472950 0.009635  P-0.2088663 0.0069788                 P     0.031    0.239     0.202    0.600                                                     \n16 7 9 57578.00 P  0.179563 0.007118  0.471846 0.009732  P-0.2096451 0.0070588                 P     0.027    0.239     0.235    0.600                                                     \n16 710 57579.00 P  0.181450 0.007175  0.470713 0.009829  P-0.2104419 0.0071385                 P     0.025    0.239     0.250    0.600                                                     \n16 711 57580.00 P  0.183317 0.007230  0.469550 0.009926  P-0.2112284 0.0072179                 P     0.024    0.239     0.237    0.600                                                     \n16 712 57581.00 P  0.185162 0.007286  0.468360 0.010023  P-0.2119781 0.0072970                 P     0.013    0.239     0.216    0.600                                                     \n16 713 57582.00 P  0.186986 0.007341  0.467141 0.010119  P-0.2126684 0.0073758                 P    -0.003    0.239     0.205    0.600                                                     \n16 714 57583.00 P  0.188788 0.007396  0.465894 0.010214  P-0.2132848 0.0074544                 P    -0.011    0.239     0.203    0.600                                                     \n16 715 57584.00 P  0.190567 0.007451  0.464620 0.010310  P-0.2138206 0.0075326                 P    -0.007    0.239     0.193    0.600                                                     \n16 716 57585.00 P  0.192324 0.007505  0.463319 0.010405  P-0.2142803 0.0076106                 P     0.000    0.239     0.179    0.600                                                     \n16 717 57586.00 P  0.194056 0.007559  0.461990 0.010499  P-0.2146833 0.0076883                 P     0.004    0.239     0.170    0.600                                                     \n16 718 57587.00 P  0.195765 0.007613  0.460636 0.010594  P-0.2150602 0.0077657                 P     0.013    0.239     0.165    0.600                                                     \n16 719 57588.00 P  0.197449 0.007666  0.459255 0.010688  P-0.2154534 0.0078428                                                                                                             \n16 720 57589.00 P  0.199109 0.007719  0.457848 0.010781  P-0.2159127 0.0079197                                                                                                             \n16 721 57590.00 P  0.200742 0.007772  0.456416 0.010875  P-0.2164842 0.0079964                                                                                                             \n16 722 57591.00 P  0.202351 0.007825  0.454960 0.010968  P-0.2172005 0.0080728                                                                                                             \n16 723 57592.00 P  0.203932 0.007877  0.453478 0.011060  P-0.2180702 0.0081489                                                                                                             \n16 724 57593.00 P  0.205487 0.007929  0.451972 0.011153  P-0.2190692 0.0082248                                                                                                             \n16 725 57594.00 P  0.207015 0.007981  0.450443 0.011245  P-0.2201448 0.0083005                                                                                                             \n16 726 57595.00 P  0.208515 0.008033  0.448890 0.011337  P-0.2212286 0.0083759                                                                                                             \n16 727 57596.00 P  0.209988 0.008084  0.447315 0.011428  P-0.2222556 0.0084511                                                                                                             \n16 728 57597.00 P  0.211431 0.008135  0.445716 0.011520  P-0.2231750 0.0085261                                                                                                             \n16 729 57598.00 P  0.212846 0.008186  0.444096 0.011611  P-0.2239618 0.0086008                                                                                                             \n16 730 57599.00 P  0.214232 0.008236  0.442454 0.011701  P-0.3000000 0.0086754\n"},{"col":0,"comment":"null","endLoc":840,"header":"@function_helper\ndef unique(ar, return_index=False, return_inverse=False,\n           return_counts=False, axis=None)","id":10863,"name":"unique","nodeType":"Function","startLoc":830,"text":"@function_helper\ndef unique(ar, return_index=False, return_inverse=False,\n           return_counts=False, axis=None):\n    unit = ar.unit\n    n_index = sum(bool(i) for i in\n                  (return_index, return_inverse, return_counts))\n    if n_index:\n        unit = [unit] + n_index * [None]\n\n    return (ar.value, return_index, return_inverse, return_counts,\n            axis), {}, unit, None"},{"col":0,"comment":"null","endLoc":848,"header":"@function_helper\ndef intersect1d(ar1, ar2, assume_unique=False, return_indices=False)","id":10864,"name":"intersect1d","nodeType":"Function","startLoc":843,"text":"@function_helper\ndef intersect1d(ar1, ar2, assume_unique=False, return_indices=False):\n    (ar1, ar2), unit = _quantities2arrays(ar1, ar2)\n    if return_indices:\n        unit = [unit, None, None]\n    return (ar1, ar2, assume_unique, return_indices), {}, unit, None"},{"col":0,"comment":"null","endLoc":854,"header":"@function_helper(helps=(np.setxor1d, np.union1d, np.setdiff1d))\ndef twosetop(ar1, ar2, *args, **kwargs)","id":10865,"name":"twosetop","nodeType":"Function","startLoc":851,"text":"@function_helper(helps=(np.setxor1d, np.union1d, np.setdiff1d))\ndef twosetop(ar1, ar2, *args, **kwargs):\n    (ar1, ar2), unit = _quantities2arrays(ar1, ar2)\n    return (ar1, ar2) + args, kwargs, unit, None"},{"id":10866,"name":"astropy/utils/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/utils/tests","id":10867,"nodeType":"File","text":""},{"id":10868,"name":"astropy/utils/tests/data","nodeType":"Package"},{"id":10869,"name":"local.dat","nodeType":"TextFile","path":"astropy/utils/tests/data","text":"This file is used in the test_local_data_* testing functions\nCONTENT\n"},{"id":10870,"name":"unicode.txt","nodeType":"TextFile","path":"astropy/utils/tests/data","text":"# -*- coding: utf-8 -*-\nהאסטרונומי פייתון\n"},{"id":10871,"name":".hidden_file.txt","nodeType":"TextFile","path":"astropy/utils/tests/data","text":"This is a deliberately hidden file.\n"},{"id":10872,"name":"alias.cfg","nodeType":"TextFile","path":"astropy/utils/tests/data","text":"[cosmology.core]\ndefault_cosmology = WMAP7"},{"id":10873,"name":"astropy/utils/tests/data/dataurl","nodeType":"Package"},{"id":10874,"name":"index.html","nodeType":"TextFile","path":"astropy/utils/tests/data/dataurl","text":""},{"id":10875,"name":"astropy/utils/tests/data/test_package","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/utils/tests/data/test_package","id":10876,"nodeType":"File","text":"from astropy.utils.data import get_pkg_data_filename\n\n\ndef get_data_filename():\n    return get_pkg_data_filename('data/foo.txt')\n"},{"col":0,"comment":"null","endLoc":5,"header":"def get_data_filename()","id":10877,"name":"get_data_filename","nodeType":"Function","startLoc":4,"text":"def get_data_filename():\n    return get_pkg_data_filename('data/foo.txt')"},{"col":0,"comment":"null","endLoc":862,"header":"@function_helper(helps=(np.isin, np.in1d))\ndef setcheckop(ar1, ar2, *args, **kwargs)","id":10878,"name":"setcheckop","nodeType":"Function","startLoc":857,"text":"@function_helper(helps=(np.isin, np.in1d))\ndef setcheckop(ar1, ar2, *args, **kwargs):\n    # This tests whether ar1 is in ar2, so we should change the unit of\n    # a1 to that of a2.\n    (ar2, ar1), unit = _quantities2arrays(ar2, ar1)\n    return (ar1, ar2) + args, kwargs, None, None"},{"id":10879,"name":"astropy/utils/tests/data/test_package/data","nodeType":"Package"},{"id":10880,"name":"foo.txt","nodeType":"TextFile","path":"astropy/utils/tests/data/test_package/data","text":""},{"id":10881,"name":"astropy/utils/tests/data/dataurl_mirror","nodeType":"Package"},{"id":10882,"name":"index.html","nodeType":"TextFile","path":"astropy/utils/tests/data/dataurl_mirror","text":""},{"id":10883,"name":"astropy/utils/compat","nodeType":"Package"},{"fileName":"numpycompat.py","filePath":"astropy/utils/compat","id":10884,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis is a collection of monkey patches and workarounds for bugs in\nearlier versions of Numpy.\n\"\"\"\n\nimport numpy as np\nfrom astropy.utils import minversion\n\n__all__ = ['NUMPY_LT_1_19', 'NUMPY_LT_1_20', 'NUMPY_LT_1_21_1',\n           'NUMPY_LT_1_22', 'NUMPY_LT_1_22_1', 'NUMPY_LT_1_23']\n\n# TODO: It might also be nice to have aliases to these named for specific\n# features/bugs we're checking for (ex:\n# astropy.table.table._BROKEN_UNICODE_TABLE_SORT)\nNUMPY_LT_1_19 = not minversion(np, '1.19')\nNUMPY_LT_1_20 = not minversion(np, '1.20')\nNUMPY_LT_1_21_1 = not minversion(np, '1.21.1')\nNUMPY_LT_1_22 = not minversion(np, '1.22')\nNUMPY_LT_1_22_1 = not minversion(np, '1.22.1')\nNUMPY_LT_1_23 = not minversion(np, '1.23dev0')\n"},{"col":0,"comment":"null","endLoc":891,"header":"@dispatched_function\ndef apply_over_axes(func, a, axes)","id":10885,"name":"apply_over_axes","nodeType":"Function","startLoc":865,"text":"@dispatched_function\ndef apply_over_axes(func, a, axes):\n    # Copied straight from numpy/lib/shape_base, just to omit its\n    # val = asarray(a); if only it had been asanyarray, or just not there\n    # since a is assumed to an an array in the next line...\n    # Which is what we do here - we can only get here if it is a Quantity.\n    val = a\n    N = a.ndim\n    if np.array(axes).ndim == 0:\n        axes = (axes,)\n    for axis in axes:\n        if axis < 0:\n            axis = N + axis\n        args = (val, axis)\n        res = func(*args)\n        if res.ndim == val.ndim:\n            val = res\n        else:\n            res = np.expand_dims(res, axis)\n            if res.ndim == val.ndim:\n                val = res\n            else:\n                raise ValueError(\"function is not returning \"\n                                 \"an array of the correct shape\")\n    # Returning unit is None to signal nothing should happen to\n    # the output.\n    return val, None, None"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":10886,"name":"__all__","nodeType":"Attribute","startLoc":10,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":10887,"name":"NUMPY_LT_1_19","nodeType":"Attribute","startLoc":16,"text":"NUMPY_LT_1_19"},{"col":0,"comment":"\n    Returns a human-friendly time string that is always exactly 6\n    characters long.\n\n    Depending on the number of seconds given, can be one of::\n\n        1w 3d\n        2d 4h\n        1h 5m\n        1m 4s\n          15s\n\n    Will be in color if console coloring is turned on.\n\n    Parameters\n    ----------\n    seconds : int\n        The number of seconds to represent\n\n    Returns\n    -------\n    time : str\n        A human-friendly representation of the given number of seconds\n        that is always exactly 6 characters.\n    ","endLoc":408,"header":"def human_time(seconds)","id":10888,"name":"human_time","nodeType":"Function","startLoc":362,"text":"def human_time(seconds):\n    \"\"\"\n    Returns a human-friendly time string that is always exactly 6\n    characters long.\n\n    Depending on the number of seconds given, can be one of::\n\n        1w 3d\n        2d 4h\n        1h 5m\n        1m 4s\n          15s\n\n    Will be in color if console coloring is turned on.\n\n    Parameters\n    ----------\n    seconds : int\n        The number of seconds to represent\n\n    Returns\n    -------\n    time : str\n        A human-friendly representation of the given number of seconds\n        that is always exactly 6 characters.\n    \"\"\"\n    units = [\n        ('y', 60 * 60 * 24 * 7 * 52),\n        ('w', 60 * 60 * 24 * 7),\n        ('d', 60 * 60 * 24),\n        ('h', 60 * 60),\n        ('m', 60),\n        ('s', 1),\n    ]\n\n    seconds = int(seconds)\n\n    if seconds < 60:\n        return f'   {seconds:2d}s'\n    for i in range(len(units) - 1):\n        unit1, limit1 = units[i]\n        unit2, limit2 = units[i + 1]\n        if seconds >= limit1:\n            return '{:2d}{}{:2d}{}'.format(\n                seconds // limit1, unit1,\n                (seconds % limit1) // limit2, unit2)\n    return '  ~inf'"},{"id":10889,"name":"Leap_Second.dat","nodeType":"TextFile","path":"astropy/utils/iers/data","text":"#  Value of TAI-UTC in second valid beetween the initial value until\n#  the epoch given on the next line. The last line reads that NO\n#  leap second was introduced since the corresponding date \n#  Updated through IERS Bulletin 63 issued in January 2022\n#  \n#\n#  File expires on 28 December 2022\n#\n#\n#    MJD        Date        TAI-UTC (s)\n#           day month year\n#    ---    --------------   ------   \n#\n    41317.0    1  1 1972       10\n    41499.0    1  7 1972       11\n    41683.0    1  1 1973       12\n    42048.0    1  1 1974       13\n    42413.0    1  1 1975       14\n    42778.0    1  1 1976       15\n    43144.0    1  1 1977       16\n    43509.0    1  1 1978       17\n    43874.0    1  1 1979       18\n    44239.0    1  1 1980       19\n    44786.0    1  7 1981       20\n    45151.0    1  7 1982       21\n    45516.0    1  7 1983       22\n    46247.0    1  7 1985       23\n    47161.0    1  1 1988       24\n    47892.0    1  1 1990       25\n    48257.0    1  1 1991       26\n    48804.0    1  7 1992       27\n    49169.0    1  7 1993       28\n    49534.0    1  7 1994       29\n    50083.0    1  1 1996       30\n    50630.0    1  7 1997       31\n    51179.0    1  1 1999       32\n    53736.0    1  1 2006       33\n    54832.0    1  1 2009       34\n    56109.0    1  7 2012       35\n    57204.0    1  7 2015       36\n    57754.0    1  1 2017       37\n"},{"fileName":"misc.py","filePath":"astropy/utils/compat","id":10890,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nSimple utility functions and bug fixes for compatibility with all supported\nversions of Python.  This module should generally not be used directly, as\neverything in `__all__` will be imported into `astropy.utils.compat` and can\nbe accessed from there.\n\"\"\"\n\nimport sys\nimport functools\nfrom contextlib import suppress\n\n\n__all__ = ['override__dir__', 'suppress',\n           'possible_filename', 'namedtuple_asdict']\n\n\ndef possible_filename(filename):\n    \"\"\"\n    Determine if the ``filename`` argument is an allowable type for a filename.\n\n    In Python 3.3 use of non-unicode filenames on system calls such as\n    `os.stat` and others that accept a filename argument was deprecated (and\n    may be removed outright in the future).\n\n    Therefore this returns `True` in all cases except for `bytes` strings in\n    Windows.\n    \"\"\"\n\n    if isinstance(filename, str):\n        return True\n    elif isinstance(filename, bytes):\n        return not (sys.platform == 'win32')\n\n    return False\n\n\ndef override__dir__(f):\n    \"\"\"\n    When overriding a __dir__ method on an object, you often want to\n    include the \"standard\" members on the object as well.  This\n    decorator takes care of that automatically, and all the wrapped\n    function needs to do is return a list of the \"special\" members\n    that wouldn't be found by the normal Python means.\n\n    Example\n    -------\n\n    Your class could define __dir__ as follows::\n\n        @override__dir__\n        def __dir__(self):\n            return ['special_method1', 'special_method2']\n    \"\"\"\n    # http://bugs.python.org/issue12166\n\n    @functools.wraps(f)\n    def override__dir__wrapper(self):\n        members = set(object.__dir__(self))\n        members.update(f(self))\n        return sorted(members)\n\n    return override__dir__wrapper\n\n\ndef namedtuple_asdict(namedtuple):\n    \"\"\"\n    The same as ``namedtuple._adict()``.\n\n    Parameters\n    ----------\n    namedtuple : collections.namedtuple\n    The named tuple to get the dict of\n    \"\"\"\n    return namedtuple._asdict()\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":530,"id":10891,"name":"_human_total","nodeType":"Attribute","startLoc":530,"text":"self._human_total"},{"fileName":"__init__.py","filePath":"astropy/utils/compat","id":10892,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis subpackage contains utility modules for compatibility with older/newer\nversions of python, as well as including some bugfixes for the stdlib that are\nimportant for Astropy.\n\nNote that all public functions in the `astropy.utils.compat.misc` module are\nimported here for easier access.\n\nThe content of this module is solely for internal use of ``astropy``\nand subject to changes without deprecations. Do not use it in external\npackages or code.\n\n\"\"\"\n\nfrom .misc import *  # noqa\n\n# Importing this module will also install monkey-patches defined in it\nfrom .numpycompat import *  # noqa\n"},{"col":0,"comment":"\n    The same as ``namedtuple._adict()``.\n\n    Parameters\n    ----------\n    namedtuple : collections.namedtuple\n    The named tuple to get the dict of\n    ","endLoc":75,"header":"def namedtuple_asdict(namedtuple)","id":10893,"name":"namedtuple_asdict","nodeType":"Function","startLoc":66,"text":"def namedtuple_asdict(namedtuple):\n    \"\"\"\n    The same as ``namedtuple._adict()``.\n\n    Parameters\n    ----------\n    namedtuple : collections.namedtuple\n    The named tuple to get the dict of\n    \"\"\"\n    return namedtuple._asdict()"},{"col":0,"comment":"","endLoc":14,"header":"__init__.py#<anonymous>","id":10894,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis subpackage contains utility modules for compatibility with older/newer\nversions of python, as well as including some bugfixes for the stdlib that are\nimportant for Astropy.\n\nNote that all public functions in the `astropy.utils.compat.misc` module are\nimported here for easier access.\n\nThe content of this module is solely for internal use of ``astropy``\nand subject to changes without deprecations. Do not use it in external\npackages or code.\n\n\"\"\""},{"fileName":"optional_deps.py","filePath":"astropy/utils/compat","id":10895,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"Checks for optional dependencies using lazy import from\n`PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_.\n\"\"\"\nimport importlib\nimport warnings\n\n# First, the top-level packages:\n# TODO: This list is a duplicate of the dependencies in setup.cfg \"all\", but\n# some of the package names are different from the pip-install name (e.g.,\n# beautifulsoup4 -> bs4).\n_optional_deps = ['asdf', 'bleach', 'bottleneck', 'bs4', 'bz2', 'h5py',\n                  'html5lib', 'IPython', 'jplephem', 'lxml', 'matplotlib',\n                  'mpmath', 'pandas', 'PIL', 'pytz', 'scipy', 'skyfield',\n                  'sortedcontainers', 'lzma', 'pyarrow']\n_formerly_optional_deps = ['yaml']  # for backward compatibility\n_deps = {k.upper(): k for k in _optional_deps + _formerly_optional_deps}\n\n# Any subpackages that have different import behavior:\n_deps['PLT'] = 'matplotlib.pyplot'\n\n__all__ = [f\"HAS_{pkg}\" for pkg in _deps]\n\n\ndef __getattr__(name):\n    if name in __all__:\n        module_name = name[4:]\n\n        if module_name == \"YAML\":\n            warnings.warn(\n                \"PyYaml is now a strict dependency. HAS_YAML is deprecated as \"\n                \"of v5.0 and will be removed in a subsequent version.\",\n                category=AstropyDeprecationWarning)\n\n        try:\n            importlib.import_module(_deps[module_name])\n        except (ImportError, ModuleNotFoundError):\n            return False\n        return True\n\n    raise AttributeError(f\"Module {__name__!r} has no attribute {name!r}.\")\n"},{"attributeType":"function","col":12,"comment":"null","endLoc":512,"id":10896,"name":"update","nodeType":"Attribute","startLoc":512,"text":"self.update"},{"attributeType":"null","col":12,"comment":"null","endLoc":535,"id":10897,"name":"_should_handle_resize","nodeType":"Attribute","startLoc":535,"text":"self._should_handle_resize"},{"col":0,"comment":"null","endLoc":41,"header":"def __getattr__(name)","id":10898,"name":"__getattr__","nodeType":"Function","startLoc":25,"text":"def __getattr__(name):\n    if name in __all__:\n        module_name = name[4:]\n\n        if module_name == \"YAML\":\n            warnings.warn(\n                \"PyYaml is now a strict dependency. HAS_YAML is deprecated as \"\n                \"of v5.0 and will be removed in a subsequent version.\",\n                category=AstropyDeprecationWarning)\n\n        try:\n            importlib.import_module(_deps[module_name])\n        except (ImportError, ModuleNotFoundError):\n            return False\n        return True\n\n    raise AttributeError(f\"Module {__name__!r} has no attribute {name!r}.\")"},{"col":0,"comment":"null","endLoc":909,"header":"@dispatched_function\ndef array_repr(arr, *args, **kwargs)","id":10899,"name":"array_repr","nodeType":"Function","startLoc":894,"text":"@dispatched_function\ndef array_repr(arr, *args, **kwargs):\n    # TODO: The addition of \"unit='...'\" doesn't worry about line\n    # length.  Could copy & adapt _array_repr_implementation from\n    # numpy.core.arrayprint.py\n    cls_name = arr.__class__.__name__\n    fake_name = '_' * len(cls_name)\n    fake_cls = type(fake_name, (np.ndarray,), {})\n    no_unit = np.array_repr(arr.view(fake_cls),\n                            *args, **kwargs).replace(fake_name, cls_name)\n    unit_part = f\"unit='{arr.unit}'\"\n    pre, dtype, post = no_unit.rpartition('dtype')\n    if dtype:\n        return f\"{pre}{unit_part}, {dtype}{post}\", None, None\n    else:\n        return f\"{no_unit[:-1]}, {unit_part})\", None, None"},{"attributeType":"null","col":8,"comment":"null","endLoc":528,"id":10900,"name":"_file","nodeType":"Attribute","startLoc":528,"text":"self._file"},{"attributeType":"null","col":12,"comment":"null","endLoc":515,"id":10901,"name":"_silent","nodeType":"Attribute","startLoc":515,"text":"self._silent"},{"attributeType":"null","col":8,"comment":"null","endLoc":529,"id":10902,"name":"_start_time","nodeType":"Attribute","startLoc":529,"text":"self._start_time"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":121,"id":10903,"name":"auto_max_age","nodeType":"Attribute","startLoc":121,"text":"auto_max_age"},{"attributeType":"null","col":16,"comment":"null","endLoc":540,"id":10904,"name":"_signal_set","nodeType":"Attribute","startLoc":540,"text":"self._signal_set"},{"attributeType":"null","col":8,"comment":"null","endLoc":531,"id":10905,"name":"_ipython_widget","nodeType":"Attribute","startLoc":531,"text":"self._ipython_widget"},{"attributeType":"null","col":16,"comment":"null","endLoc":645,"id":10906,"name":"_widget","nodeType":"Attribute","startLoc":645,"text":"self._widget"},{"attributeType":"null","col":16,"comment":"null","endLoc":522,"id":10907,"name":"_total","nodeType":"Attribute","startLoc":522,"text":"self._total"},{"attributeType":"null","col":16,"comment":"null","endLoc":526,"id":10908,"name":"_items","nodeType":"Attribute","startLoc":526,"text":"self._items"},{"attributeType":"null","col":8,"comment":"null","endLoc":546,"id":10909,"name":"_bar_length","nodeType":"Attribute","startLoc":546,"text":"self._bar_length"},{"attributeType":"null","col":8,"comment":"null","endLoc":581,"id":10910,"name":"_current_value","nodeType":"Attribute","startLoc":581,"text":"self._current_value"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":10911,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":7,"header":"misc.py#<anonymous>","id":10912,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nSimple utility functions and bug fixes for compatibility with all supported\nversions of Python.  This module should generally not be used directly, as\neverything in `__all__` will be imported into `astropy.utils.compat` and can\nbe accessed from there.\n\"\"\"\n\n__all__ = ['override__dir__', 'suppress',\n           'possible_filename', 'namedtuple_asdict']"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":10913,"name":"_optional_deps","nodeType":"Attribute","startLoc":12,"text":"_optional_deps"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":10914,"name":"_formerly_optional_deps","nodeType":"Attribute","startLoc":16,"text":"_formerly_optional_deps"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":10915,"name":"_deps","nodeType":"Attribute","startLoc":17,"text":"_deps"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":10916,"name":"__all__","nodeType":"Attribute","startLoc":22,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"optional_deps.py#<anonymous>","id":10917,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"Checks for optional dependencies using lazy import from\n`PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_.\n\"\"\"\n\n_optional_deps = ['asdf', 'bleach', 'bottleneck', 'bs4', 'bz2', 'h5py',\n                  'html5lib', 'IPython', 'jplephem', 'lxml', 'matplotlib',\n                  'mpmath', 'pandas', 'PIL', 'pytz', 'scipy', 'skyfield',\n                  'sortedcontainers', 'lzma', 'pyarrow']\n\n_formerly_optional_deps = ['yaml']  # for backward compatibility\n\n_deps = {k.upper(): k for k in _optional_deps + _formerly_optional_deps}\n\n_deps['PLT'] = 'matplotlib.pyplot'\n\n__all__ = [f\"HAS_{pkg}\" for pkg in _deps]"},{"id":10918,"name":"astropy/utils/masked","nodeType":"Package"},{"fileName":"core.py","filePath":"astropy/utils/masked","id":10919,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nBuilt-in mask mixin class.\n\nThe design uses `Masked` as a factory class which automatically\ngenerates new subclasses for any data class that is itself a\nsubclass of a predefined masked class, with `MaskedNDArray`\nproviding such a predefined class for `~numpy.ndarray`.\n\nGenerally, any new predefined class should override the\n``from_unmasked(data, mask, copy=False)`` class method that\ncreates an instance from unmasked data and a mask, as well as\nthe ``unmasked`` property that returns just the data.\nThe `Masked` class itself provides a base ``mask`` property,\nwhich can also be overridden if needed.\n\n\"\"\"\nimport builtins\n\nimport numpy as np\n\nfrom astropy.utils.shapes import NDArrayShapeMethods\nfrom astropy.utils.data_info import ParentDtypeInfo\n\nfrom .function_helpers import (MASKED_SAFE_FUNCTIONS,\n                               APPLY_TO_BOTH_FUNCTIONS,\n                               DISPATCHED_FUNCTIONS,\n                               UNSUPPORTED_FUNCTIONS)\n\n\n__all__ = ['Masked', 'MaskedNDArray']\n\n\nget__doc__ = \"\"\"Masked version of {0.__name__}.\n\nExcept for the ability to pass in a ``mask``, parameters are\nas for `{0.__module__}.{0.__name__}`.\n\"\"\".format\n\n\nclass Masked(NDArrayShapeMethods):\n    \"\"\"A scalar value or array of values with associated mask.\n\n    The resulting instance will take its exact type from whatever the\n    contents are, with the type generated on the fly as needed.\n\n    Parameters\n    ----------\n    data : array-like\n        The data for which a mask is to be added.  The result will be a\n        a subclass of the type of ``data``.\n    mask : array-like of bool, optional\n        The initial mask to assign.  If not given, taken from the data.\n    copy : bool\n        Whether the data and mask should be copied. Default: `False`.\n\n    \"\"\"\n\n    _base_classes = {}\n    \"\"\"Explicitly defined masked classes keyed by their unmasked counterparts.\n\n    For subclasses of these unmasked classes, masked counterparts can be generated.\n    \"\"\"\n\n    _masked_classes = {}\n    \"\"\"Masked classes keyed by their unmasked data counterparts.\"\"\"\n\n    def __new__(cls, *args, **kwargs):\n        if cls is Masked:\n            # Initializing with Masked itself means we're in \"factory mode\".\n            if not kwargs and len(args) == 1 and isinstance(args[0], type):\n                # Create a new masked class.\n                return cls._get_masked_cls(args[0])\n            else:\n                return cls._get_masked_instance(*args, **kwargs)\n        else:\n            # Otherwise we're a subclass and should just pass information on.\n            return super().__new__(cls, *args, **kwargs)\n\n    def __init_subclass__(cls, base_cls=None, data_cls=None, **kwargs):\n        \"\"\"Register a Masked subclass.\n\n        Parameters\n        ----------\n        base_cls : type, optional\n            If given, it is taken to mean that ``cls`` can be used as\n            a base for masked versions of all subclasses of ``base_cls``,\n            so it is registered as such in ``_base_classes``.\n        data_cls : type, optional\n            If given, ``cls`` should will be registered as the masked version of\n            ``data_cls``.  Will set the private ``cls._data_cls`` attribute,\n            and auto-generate a docstring if not present already.\n        **kwargs\n            Passed on for possible further initialization by superclasses.\n\n        \"\"\"\n        if base_cls is not None:\n            Masked._base_classes[base_cls] = cls\n\n        if data_cls is not None:\n            cls._data_cls = data_cls\n            cls._masked_classes[data_cls] = cls\n            if cls.__doc__ is None:\n                cls.__doc__ = get__doc__(data_cls)\n\n        super().__init_subclass__(**kwargs)\n\n    # This base implementation just uses the class initializer.\n    # Subclasses can override this in case the class does not work\n    # with this signature, or to provide a faster implementation.\n    @classmethod\n    def from_unmasked(cls, data, mask=None, copy=False):\n        \"\"\"Create an instance from unmasked data and a mask.\"\"\"\n        return cls(data, mask=mask, copy=copy)\n\n    @classmethod\n    def _get_masked_instance(cls, data, mask=None, copy=False):\n        data, data_mask = cls._get_data_and_mask(data)\n        if mask is None:\n            mask = False if data_mask is None else data_mask\n\n        masked_cls = cls._get_masked_cls(data.__class__)\n        return masked_cls.from_unmasked(data, mask, copy)\n\n    @classmethod\n    def _get_masked_cls(cls, data_cls):\n        \"\"\"Get the masked wrapper for a given data class.\n\n        If the data class does not exist yet but is a subclass of any of the\n        registered base data classes, it is automatically generated\n        (except we skip `~numpy.ma.MaskedArray` subclasses, since then the\n        masking mechanisms would interfere).\n        \"\"\"\n        if issubclass(data_cls, (Masked, np.ma.MaskedArray)):\n            return data_cls\n\n        masked_cls = cls._masked_classes.get(data_cls)\n        if masked_cls is None:\n            # Walk through MRO and find closest base data class.\n            # Note: right now, will basically always be ndarray, but\n            # one could imagine needing some special care for one subclass,\n            # which would then get its own entry.  E.g., if MaskedAngle\n            # defined something special, then MaskedLongitude should depend\n            # on it.\n            for mro_item in data_cls.__mro__:\n                base_cls = cls._base_classes.get(mro_item)\n                if base_cls is not None:\n                    break\n            else:\n                # Just hope that MaskedNDArray can handle it.\n                # TODO: this covers the case where a user puts in a list or so,\n                # but for those one could just explicitly do something like\n                # _masked_classes[list] = MaskedNDArray.\n                return MaskedNDArray\n\n            # Create (and therefore register) new Masked subclass for the\n            # given data_cls.\n            masked_cls = type('Masked' + data_cls.__name__,\n                              (data_cls, base_cls), {}, data_cls=data_cls)\n\n        return masked_cls\n\n    @classmethod\n    def _get_data_and_mask(cls, data, allow_ma_masked=False):\n        \"\"\"Split data into unmasked and mask, if present.\n\n        Parameters\n        ----------\n        data : array-like\n            Possibly masked item, judged by whether it has a ``mask`` attribute.\n            If so, checks for being an instance of `~astropy.utils.masked.Masked`\n            or `~numpy.ma.MaskedArray`, and gets unmasked data appropriately.\n        allow_ma_masked : bool, optional\n            Whether or not to process `~numpy.ma.masked`, i.e., an item that\n            implies no data but the presence of a mask.\n\n        Returns\n        -------\n        unmasked, mask : array-like\n            Unmasked will be `None` for `~numpy.ma.masked`.\n\n        Raises\n        ------\n        ValueError\n            If `~numpy.ma.masked` is passed in and ``allow_ma_masked`` is not set.\n\n        \"\"\"\n        mask = getattr(data, 'mask', None)\n        if mask is not None:\n            try:\n                data = data.unmasked\n            except AttributeError:\n                if not isinstance(data, np.ma.MaskedArray):\n                    raise\n                if data is np.ma.masked:\n                    if allow_ma_masked:\n                        data = None\n                    else:\n                        raise ValueError('cannot handle np.ma.masked here.') from None\n                else:\n                    data = data.data\n\n        return data, mask\n\n    @classmethod\n    def _get_data_and_masks(cls, *args):\n        data_masks = [cls._get_data_and_mask(arg) for arg in args]\n        return (tuple(data for data, _ in data_masks),\n                tuple(mask for _, mask in data_masks))\n\n    def _get_mask(self):\n        \"\"\"The mask.\n\n        If set, replace the original mask, with whatever it is set with,\n        using a view if no broadcasting or type conversion is required.\n        \"\"\"\n        return self._mask\n\n    def _set_mask(self, mask, copy=False):\n        self_dtype = getattr(self, 'dtype', None)\n        mask_dtype = (np.ma.make_mask_descr(self_dtype)\n                      if self_dtype and self_dtype.names else np.dtype('?'))\n        ma = np.asanyarray(mask, dtype=mask_dtype)\n        if ma.shape != self.shape:\n            # This will fail (correctly) if not broadcastable.\n            self._mask = np.empty(self.shape, dtype=mask_dtype)\n            self._mask[...] = ma\n        elif ma is mask:\n            # Even if not copying use a view so that shape setting\n            # does not propagate.\n            self._mask = mask.copy() if copy else mask.view()\n        else:\n            self._mask = ma\n\n    mask = property(_get_mask, _set_mask)\n\n    # Note: subclass should generally override the unmasked property.\n    # This one assumes the unmasked data is stored in a private attribute.\n    @property\n    def unmasked(self):\n        \"\"\"The unmasked values.\n\n        See Also\n        --------\n        astropy.utils.masked.Masked.filled\n        \"\"\"\n        return self._unmasked\n\n    def filled(self, fill_value):\n        \"\"\"Get a copy of the underlying data, with masked values filled in.\n\n        Parameters\n        ----------\n        fill_value : object\n            Value to replace masked values with.\n\n        See Also\n        --------\n        astropy.utils.masked.Masked.unmasked\n        \"\"\"\n        unmasked = self.unmasked.copy()\n        if self.mask.dtype.names:\n            np.ma.core._recursive_filled(unmasked, self.mask, fill_value)\n        else:\n            unmasked[self.mask] = fill_value\n\n        return unmasked\n\n    def _apply(self, method, *args, **kwargs):\n        # Required method for NDArrayShapeMethods, to help provide __getitem__\n        # and shape-changing methods.\n        if callable(method):\n            data = method(self.unmasked, *args, **kwargs)\n            mask = method(self.mask, *args, **kwargs)\n        else:\n            data = getattr(self.unmasked, method)(*args, **kwargs)\n            mask = getattr(self.mask, method)(*args, **kwargs)\n\n        result = self.from_unmasked(data, mask, copy=False)\n        if 'info' in self.__dict__:\n            result.info = self.info\n\n        return result\n\n    def __setitem__(self, item, value):\n        value, mask = self._get_data_and_mask(value, allow_ma_masked=True)\n        if value is not None:\n            self.unmasked[item] = value\n        self.mask[item] = mask\n\n\nclass MaskedInfoBase:\n    mask_val = np.ma.masked\n\n    def __init__(self, bound=False):\n        super().__init__(bound)\n\n        # If bound to a data object instance then create the dict of attributes\n        # which stores the info attribute values.\n        if bound:\n            # Specify how to serialize this object depending on context.\n            self.serialize_method = {'fits': 'null_value',\n                                     'ecsv': 'null_value',\n                                     'hdf5': 'data_mask',\n                                     'parquet': 'data_mask',\n                                     None: 'null_value'}\n\n\nclass MaskedNDArrayInfo(MaskedInfoBase, ParentDtypeInfo):\n    \"\"\"\n    Container for meta information like name, description, format.\n    \"\"\"\n\n    # Add `serialize_method` attribute to the attrs that MaskedNDArrayInfo knows\n    # about.  This allows customization of the way that MaskedColumn objects\n    # get written to file depending on format.  The default is to use whatever\n    # the writer would normally do, which in the case of FITS or ECSV is to use\n    # a NULL value within the data itself.  If serialize_method is 'data_mask'\n    # then the mask is explicitly written out as a separate column if there\n    # are any masked values.  This is the same as for MaskedColumn.\n    attr_names = ParentDtypeInfo.attr_names | {'serialize_method'}\n\n    # When `serialize_method` is 'data_mask', and data and mask are being written\n    # as separate columns, use column names <name> and <name>.mask (instead\n    # of default encoding as <name>.data and <name>.mask).\n    _represent_as_dict_primary_data = 'data'\n\n    def _represent_as_dict(self):\n        out = super()._represent_as_dict()\n\n        masked_array = self._parent\n\n        # If the serialize method for this context (e.g. 'fits' or 'ecsv') is\n        # 'data_mask', that means to serialize using an explicit mask column.\n        method = self.serialize_method[self._serialize_context]\n\n        if method == 'data_mask':\n            out['data'] = masked_array.unmasked\n\n            if np.any(masked_array.mask):\n                # Only if there are actually masked elements do we add the ``mask`` column\n                out['mask'] = masked_array.mask\n\n        elif method == 'null_value':\n            out['data'] = np.ma.MaskedArray(masked_array.unmasked,\n                                            mask=masked_array.mask)\n\n        else:\n            raise ValueError('serialize method must be either \"data_mask\" or \"null_value\"')\n\n        return out\n\n    def _construct_from_dict(self, map):\n        # Override usual handling, since MaskedNDArray takes shape and buffer\n        # as input, which is less useful here.\n        # The map can contain either a MaskedColumn or a Column and a mask.\n        # Extract the mask for the former case.\n        map.setdefault('mask', getattr(map['data'], 'mask', False))\n        return self._parent_cls.from_unmasked(**map)\n\n\nclass MaskedArraySubclassInfo(MaskedInfoBase):\n    \"\"\"Mixin class to create a subclasses such as MaskedQuantityInfo.\"\"\"\n    # This is used below in __init_subclass__, which also inserts a\n    # 'serialize_method' attribute in attr_names.\n\n    def _represent_as_dict(self):\n        # Use the data_cls as the class name for serialization,\n        # so that we do not have to store all possible masked classes\n        # in astropy.table.serialize.__construct_mixin_classes.\n        out = super()._represent_as_dict()\n        data_cls = self._parent._data_cls\n        out.setdefault('__class__',\n                       data_cls.__module__ + '.' + data_cls.__name__)\n        return out\n\n\ndef _comparison_method(op):\n    \"\"\"\n    Create a comparison operator for MaskedNDArray.\n\n    Needed since for string dtypes the base operators bypass __array_ufunc__\n    and hence return unmasked results.\n    \"\"\"\n    def _compare(self, other):\n        other_data, other_mask = self._get_data_and_mask(other)\n        result = getattr(self.unmasked, op)(other_data)\n        if result is NotImplemented:\n            return NotImplemented\n        mask = self.mask | (other_mask if other_mask is not None else False)\n        return self._masked_result(result, mask, None)\n\n    return _compare\n\n\nclass MaskedIterator:\n    \"\"\"\n    Flat iterator object to iterate over Masked Arrays.\n\n    A `~astropy.utils.masked.MaskedIterator` iterator is returned by ``m.flat``\n    for any masked array ``m``.  It allows iterating over the array as if it\n    were a 1-D array, either in a for-loop or by calling its `next` method.\n\n    Iteration is done in C-contiguous style, with the last index varying the\n    fastest. The iterator can also be indexed using basic slicing or\n    advanced indexing.\n\n    Notes\n    -----\n    The design of `~astropy.utils.masked.MaskedIterator` follows that of\n    `~numpy.ma.core.MaskedIterator`.  It is not exported by the\n    `~astropy.utils.masked` module.  Instead of instantiating directly,\n    use the ``flat`` method in the masked array instance.\n    \"\"\"\n\n    def __init__(self, m):\n        self._masked = m\n        self._dataiter = m.unmasked.flat\n        self._maskiter = m.mask.flat\n\n    def __iter__(self):\n        return self\n\n    def __getitem__(self, indx):\n        out = self._dataiter.__getitem__(indx)\n        mask = self._maskiter.__getitem__(indx)\n        # For single elements, ndarray.flat.__getitem__ returns scalars; these\n        # need a new view as a Masked array.\n        if not isinstance(out, np.ndarray):\n            out = out[...]\n            mask = mask[...]\n\n        return self._masked.from_unmasked(out, mask, copy=False)\n\n    def __setitem__(self, index, value):\n        data, mask = self._masked._get_data_and_mask(value, allow_ma_masked=True)\n        if data is not None:\n            self._dataiter[index] = data\n        self._maskiter[index] = mask\n\n    def __next__(self):\n        \"\"\"\n        Return the next value, or raise StopIteration.\n        \"\"\"\n        out = next(self._dataiter)[...]\n        mask = next(self._maskiter)[...]\n        return self._masked.from_unmasked(out, mask, copy=False)\n\n    next = __next__\n\n\nclass MaskedNDArray(Masked, np.ndarray, base_cls=np.ndarray, data_cls=np.ndarray):\n    _mask = None\n\n    info = MaskedNDArrayInfo()\n\n    def __new__(cls, *args, mask=None, **kwargs):\n        \"\"\"Get data class instance from arguments and then set mask.\"\"\"\n        self = super().__new__(cls, *args, **kwargs)\n        if mask is not None:\n            self.mask = mask\n        elif self._mask is None:\n            self.mask = False\n        return self\n\n    def __init_subclass__(cls, **kwargs):\n        super().__init_subclass__(cls, **kwargs)\n        # For all subclasses we should set a default __new__ that passes on\n        # arguments other than mask to the data class, and then sets the mask.\n        if '__new__' not in cls.__dict__:\n            def __new__(newcls, *args, mask=None, **kwargs):\n                \"\"\"Get data class instance from arguments and then set mask.\"\"\"\n                # Need to explicitly mention classes outside of class definition.\n                self = super(cls, newcls).__new__(newcls, *args, **kwargs)\n                if mask is not None:\n                    self.mask = mask\n                elif self._mask is None:\n                    self.mask = False\n                return self\n            cls.__new__ = __new__\n\n        if 'info' not in cls.__dict__ and hasattr(cls._data_cls, 'info'):\n            data_info = cls._data_cls.info\n            attr_names = data_info.attr_names | {'serialize_method'}\n            new_info = type(cls.__name__+'Info',\n                            (MaskedArraySubclassInfo, data_info.__class__),\n                            dict(attr_names=attr_names))\n            cls.info = new_info()\n\n    # The two pieces typically overridden.\n    @classmethod\n    def from_unmasked(cls, data, mask=None, copy=False):\n        # Note: have to override since __new__ would use ndarray.__new__\n        # which expects the shape as its first argument, not an array.\n        data = np.array(data, subok=True, copy=copy)\n        self = data.view(cls)\n        self._set_mask(mask, copy=copy)\n        return self\n\n    @property\n    def unmasked(self):\n        return super().view(self._data_cls)\n\n    @classmethod\n    def _get_masked_cls(cls, data_cls):\n        # Short-cuts\n        if data_cls is np.ndarray:\n            return MaskedNDArray\n        elif data_cls is None:  # for .view()\n            return cls\n\n        return super()._get_masked_cls(data_cls)\n\n    @property\n    def flat(self):\n        \"\"\"A 1-D iterator over the Masked array.\n\n        This returns a ``MaskedIterator`` instance, which behaves the same\n        as the `~numpy.flatiter` instance returned by `~numpy.ndarray.flat`,\n        and is similar to Python's built-in iterator, except that it also\n        allows assignment.\n        \"\"\"\n        return MaskedIterator(self)\n\n    @property\n    def _baseclass(self):\n        \"\"\"Work-around for MaskedArray initialization.\n\n        Allows the base class to be inferred correctly when a masked instance\n        is used to initialize (or viewed as) a `~numpy.ma.MaskedArray`.\n\n        \"\"\"\n        return self._data_cls\n\n    def view(self, dtype=None, type=None):\n        \"\"\"New view of the masked array.\n\n        Like `numpy.ndarray.view`, but always returning a masked array subclass.\n        \"\"\"\n        if type is None and (isinstance(dtype, builtins.type)\n                             and issubclass(dtype, np.ndarray)):\n            return super().view(self._get_masked_cls(dtype))\n\n        if dtype is None:\n            return super().view(self._get_masked_cls(type))\n\n        dtype = np.dtype(dtype)\n        if not (dtype.itemsize == self.dtype.itemsize\n                and (dtype.names is None\n                     or len(dtype.names) == len(self.dtype.names))):\n            raise NotImplementedError(\n                f\"{self.__class__} cannot be viewed with a dtype with a \"\n                f\"with a different number of fields or size.\")\n\n        return super().view(dtype, self._get_masked_cls(type))\n\n    def __array_finalize__(self, obj):\n        # If we're a new object or viewing an ndarray, nothing has to be done.\n        if obj is None or obj.__class__ is np.ndarray:\n            return\n\n        # Logically, this should come from ndarray and hence be None, but\n        # just in case someone creates a new mixin, we check.\n        super_array_finalize = super().__array_finalize__\n        if super_array_finalize:  # pragma: no cover\n            super_array_finalize(obj)\n\n        if self._mask is None:\n            # Got here after, e.g., a view of another masked class.\n            # Get its mask, or initialize ours.\n            self._set_mask(getattr(obj, '_mask', False))\n\n        if 'info' in obj.__dict__:\n            self.info = obj.info\n\n    @property\n    def shape(self):\n        \"\"\"The shape of the data and the mask.\n\n        Usually used to get the current shape of an array, but may also be\n        used to reshape the array in-place by assigning a tuple of array\n        dimensions to it.  As with `numpy.reshape`, one of the new shape\n        dimensions can be -1, in which case its value is inferred from the\n        size of the array and the remaining dimensions.\n\n        Raises\n        ------\n        AttributeError\n            If a copy is required, of either the data or the mask.\n\n        \"\"\"\n        # Redefinition to allow defining a setter and add a docstring.\n        return super().shape\n\n    @shape.setter\n    def shape(self, shape):\n        old_shape = self.shape\n        self._mask.shape = shape\n        # Reshape array proper in try/except just in case some broadcasting\n        # or so causes it to fail.\n        try:\n            super(MaskedNDArray, type(self)).shape.__set__(self, shape)\n        except Exception as exc:\n            self._mask.shape = old_shape\n            # Given that the mask reshaping succeeded, the only logical\n            # reason for an exception is something like a broadcast error in\n            # in __array_finalize__, or a different memory ordering between\n            # mask and data.  For those, give a more useful error message;\n            # otherwise just raise the error.\n            if 'could not broadcast' in exc.args[0]:\n                raise AttributeError(\n                    'Incompatible shape for in-place modification. '\n                    'Use `.reshape()` to make a copy with the desired '\n                    'shape.') from None\n            else:  # pragma: no cover\n                raise\n\n    _eq_simple = _comparison_method('__eq__')\n    _ne_simple = _comparison_method('__ne__')\n    __lt__ = _comparison_method('__lt__')\n    __le__ = _comparison_method('__le__')\n    __gt__ = _comparison_method('__gt__')\n    __ge__ = _comparison_method('__ge__')\n\n    def __eq__(self, other):\n        if not self.dtype.names:\n            return self._eq_simple(other)\n\n        # For structured arrays, we treat this as a reduction over the fields,\n        # where masked fields are skipped and thus do not influence the result.\n        other = np.asanyarray(other, dtype=self.dtype)\n        result = np.stack([self[field] == other[field]\n                           for field in self.dtype.names], axis=-1)\n        return result.all(axis=-1)\n\n    def __ne__(self, other):\n        if not self.dtype.names:\n            return self._ne_simple(other)\n\n        # For structured arrays, we treat this as a reduction over the fields,\n        # where masked fields are skipped and thus do not influence the result.\n        other = np.asanyarray(other, dtype=self.dtype)\n        result = np.stack([self[field] != other[field]\n                           for field in self.dtype.names], axis=-1)\n        return result.any(axis=-1)\n\n    def _combine_masks(self, masks, out=None):\n        masks = [m for m in masks if m is not None and m is not False]\n        if not masks:\n            return False\n        if len(masks) == 1:\n            if out is None:\n                return masks[0].copy()\n            else:\n                np.copyto(out, masks[0])\n                return out\n\n        out = np.logical_or(masks[0], masks[1], out=out)\n        for mask in masks[2:]:\n            np.logical_or(out, mask, out=out)\n        return out\n\n    def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):\n        out = kwargs.pop('out', None)\n        out_unmasked = None\n        out_mask = None\n        if out is not None:\n            out_unmasked, out_masks = self._get_data_and_masks(*out)\n            for d, m in zip(out_unmasked, out_masks):\n                if m is None:\n                    # TODO: allow writing to unmasked output if nothing is masked?\n                    if d is not None:\n                        raise TypeError('cannot write to unmasked output')\n                elif out_mask is None:\n                    out_mask = m\n\n        unmasked, masks = self._get_data_and_masks(*inputs)\n\n        if ufunc.signature:\n            # We're dealing with a gufunc. For now, only deal with\n            # np.matmul and gufuncs for which the mask of any output always\n            # depends on all core dimension values of all inputs.\n            # Also ignore axes keyword for now...\n            # TODO: in principle, it should be possible to generate the mask\n            # purely based on the signature.\n            if 'axes' in kwargs:\n                raise NotImplementedError(\"Masked does not yet support gufunc \"\n                                          \"calls with 'axes'.\")\n            if ufunc is np.matmul:\n                # np.matmul is tricky and its signature cannot be parsed by\n                # _parse_gufunc_signature.\n                unmasked = np.atleast_1d(*unmasked)\n                mask0, mask1 = masks\n                masks = []\n                is_mat1 = unmasked[1].ndim >= 2\n                if mask0 is not None:\n                    masks.append(\n                        np.logical_or.reduce(mask0, axis=-1, keepdims=is_mat1))\n\n                if mask1 is not None:\n                    masks.append(\n                        np.logical_or.reduce(mask1, axis=-2, keepdims=True)\n                        if is_mat1 else\n                        np.logical_or.reduce(mask1))\n\n                mask = self._combine_masks(masks, out=out_mask)\n\n            else:\n                # Parse signature with private numpy function. Note it\n                # cannot handle spaces in tuples, so remove those.\n                in_sig, out_sig = np.lib.function_base._parse_gufunc_signature(\n                    ufunc.signature.replace(' ', ''))\n                axis = kwargs.get('axis', -1)\n                keepdims = kwargs.get('keepdims', False)\n                in_masks = []\n                for sig, mask in zip(in_sig, masks):\n                    if mask is not None:\n                        if sig:\n                            # Input has core dimensions.  Assume that if any\n                            # value in those is masked, the output will be\n                            # masked too (TODO: for multiple core dimensions\n                            # this may be too strong).\n                            mask = np.logical_or.reduce(\n                                mask, axis=axis, keepdims=keepdims)\n                        in_masks.append(mask)\n\n                mask = self._combine_masks(in_masks)\n                result_masks = []\n                for os in out_sig:\n                    if os:\n                        # Output has core dimensions.  Assume all those\n                        # get the same mask.\n                        result_mask = np.expand_dims(mask, axis)\n                    else:\n                        result_mask = mask\n                    result_masks.append(result_mask)\n\n                mask = result_masks if len(result_masks) > 1 else result_masks[0]\n\n        elif method == '__call__':\n            # Regular ufunc call.\n            mask = self._combine_masks(masks, out=out_mask)\n\n        elif method == 'outer':\n            # Must have two arguments; adjust masks as will be done for data.\n            assert len(masks) == 2\n            masks = [(m if m is not None else False) for m in masks]\n            mask = np.logical_or.outer(masks[0], masks[1], out=out_mask)\n\n        elif method in {'reduce', 'accumulate'}:\n            # Reductions like np.add.reduce (sum).\n            if masks[0] is not None:\n                # By default, we simply propagate masks, since for\n                # things like np.sum, it makes no sense to do otherwise.\n                # Individual methods need to override as needed.\n                # TODO: take care of 'out' too?\n                if method == 'reduce':\n                    axis = kwargs.get('axis', None)\n                    keepdims = kwargs.get('keepdims', False)\n                    where = kwargs.get('where', True)\n                    mask = np.logical_or.reduce(masks[0], where=where,\n                                                axis=axis, keepdims=keepdims,\n                                                out=out_mask)\n                    if where is not True:\n                        # Mask also whole rows that were not selected by where,\n                        # so would have been left as unmasked above.\n                        mask |= np.logical_and.reduce(masks[0], where=where,\n                                                      axis=axis, keepdims=keepdims)\n\n                else:\n                    # Accumulate\n                    axis = kwargs.get('axis', 0)\n                    mask = np.logical_or.accumulate(masks[0], axis=axis,\n                                                    out=out_mask)\n\n            elif out is not None:\n                mask = False\n\n            else:  # pragma: no cover\n                # Can only get here if neither input nor output was masked, but\n                # perhaps axis or where was masked (in numpy < 1.21 this is\n                # possible).  We don't support this.\n                return NotImplemented\n\n        elif method in {'reduceat', 'at'}:  # pragma: no cover\n            # TODO: implement things like np.add.accumulate (used for cumsum).\n            raise NotImplementedError(\"masked instances cannot yet deal with \"\n                                      \"'reduceat' or 'at'.\")\n\n        if out_unmasked is not None:\n            kwargs['out'] = out_unmasked\n        result = getattr(ufunc, method)(*unmasked, **kwargs)\n\n        if result is None:  # pragma: no cover\n            # This happens for the \"at\" method.\n            return result\n\n        if out is not None and len(out) == 1:\n            out = out[0]\n        return self._masked_result(result, mask, out)\n\n    def __array_function__(self, function, types, args, kwargs):\n        # TODO: go through functions systematically to see which ones\n        # work and/or can be supported.\n        if function in MASKED_SAFE_FUNCTIONS:\n            return super().__array_function__(function, types, args, kwargs)\n\n        elif function in APPLY_TO_BOTH_FUNCTIONS:\n            helper = APPLY_TO_BOTH_FUNCTIONS[function]\n            try:\n                helper_result = helper(*args, **kwargs)\n            except NotImplementedError:\n                return self._not_implemented_or_raise(function, types)\n\n            data_args, mask_args, kwargs, out = helper_result\n            if out is not None:\n                if not isinstance(out, Masked):\n                    return self._not_implemented_or_raise(function, types)\n                function(*mask_args, out=out.mask, **kwargs)\n                function(*data_args, out=out.unmasked, **kwargs)\n                return out\n\n            mask = function(*mask_args, **kwargs)\n            result = function(*data_args, **kwargs)\n\n        elif function in DISPATCHED_FUNCTIONS:\n            dispatched_function = DISPATCHED_FUNCTIONS[function]\n            try:\n                dispatched_result = dispatched_function(*args, **kwargs)\n            except NotImplementedError:\n                return self._not_implemented_or_raise(function, types)\n\n            if not isinstance(dispatched_result, tuple):\n                return dispatched_result\n\n            result, mask, out = dispatched_result\n\n        elif function in UNSUPPORTED_FUNCTIONS:\n            return NotImplemented\n\n        else:  # pragma: no cover\n            # By default, just pass it through for now.\n            return super().__array_function__(function, types, args, kwargs)\n\n        if mask is None:\n            return result\n        else:\n            return self._masked_result(result, mask, out)\n\n    def _not_implemented_or_raise(self, function, types):\n        # Our function helper or dispatcher found that the function does not\n        # work with Masked.  In principle, there may be another class that\n        # knows what to do with us, for which we should return NotImplemented.\n        # But if there is ndarray (or a non-Masked subclass of it) around,\n        # it quite likely coerces, so we should just break.\n        if any(issubclass(t, np.ndarray) and not issubclass(t, Masked)\n               for t in types):\n            raise TypeError(\"the MaskedNDArray implementation cannot handle {} \"\n                            \"with the given arguments.\"\n                            .format(function)) from None\n        else:\n            return NotImplemented\n\n    def _masked_result(self, result, mask, out):\n        if isinstance(result, tuple):\n            if out is None:\n                out = (None,) * len(result)\n            if not isinstance(mask, (list, tuple)):\n                mask = (mask,) * len(result)\n            return tuple(self._masked_result(result_, mask_, out_)\n                         for (result_, mask_, out_) in zip(result, mask, out))\n\n        if out is None:\n            # Note that we cannot count on result being the same class as\n            # 'self' (e.g., comparison of quantity results in an ndarray, most\n            # operations on Longitude and Latitude result in Angle or\n            # Quantity), so use Masked to determine the appropriate class.\n            return Masked(result, mask)\n\n        # TODO: remove this sanity check once test cases are more complete.\n        assert isinstance(out, Masked)\n        # If we have an output, the result was written in-place, so we should\n        # also write the mask in-place (if not done already in the code).\n        if out._mask is not mask:\n            out._mask[...] = mask\n        return out\n\n    # Below are ndarray methods that need to be overridden as masked elements\n    # need to be skipped and/or an initial value needs to be set.\n    def _reduce_defaults(self, kwargs, initial_func=None):\n        \"\"\"Get default where and initial for masked reductions.\n\n        Generally, the default should be to skip all masked elements.  For\n        reductions such as np.minimum.reduce, we also need an initial value,\n        which can be determined using ``initial_func``.\n\n        \"\"\"\n        if 'where' not in kwargs:\n            kwargs['where'] = ~self.mask\n        if initial_func is not None and 'initial' not in kwargs:\n            kwargs['initial'] = initial_func(self.unmasked)\n        return kwargs\n\n    def trace(self, offset=0, axis1=0, axis2=1, dtype=None, out=None):\n        # Unfortunately, cannot override the call to diagonal inside trace, so\n        # duplicate implementation in numpy/core/src/multiarray/calculation.c.\n        diagonal = self.diagonal(offset=offset, axis1=axis1, axis2=axis2)\n        return diagonal.sum(-1, dtype=dtype, out=out)\n\n    def min(self, axis=None, out=None, **kwargs):\n        return super().min(axis=axis, out=out,\n                           **self._reduce_defaults(kwargs, np.nanmax))\n\n    def max(self, axis=None, out=None, **kwargs):\n        return super().max(axis=axis, out=out,\n                           **self._reduce_defaults(kwargs, np.nanmin))\n\n    def nonzero(self):\n        unmasked_nonzero = self.unmasked.nonzero()\n        if self.ndim >= 1:\n            not_masked = ~self.mask[unmasked_nonzero]\n            return tuple(u[not_masked] for u in unmasked_nonzero)\n        else:\n            return unmasked_nonzero if not self.mask else np.nonzero(0)\n\n    def compress(self, condition, axis=None, out=None):\n        if out is not None:\n            raise NotImplementedError('cannot yet give output')\n        return self._apply('compress', condition, axis=axis)\n\n    def repeat(self, repeats, axis=None):\n        return self._apply('repeat', repeats, axis=axis)\n\n    def choose(self, choices, out=None, mode='raise'):\n        # Let __array_function__ take care since choices can be masked too.\n        return np.choose(self, choices, out=out, mode=mode)\n\n    def argmin(self, axis=None, out=None):\n        # Todo: should this return a masked integer array, with masks\n        # if all elements were masked?\n        at_min = self == self.min(axis=axis, keepdims=True)\n        return at_min.filled(False).argmax(axis=axis, out=out)\n\n    def argmax(self, axis=None, out=None):\n        at_max = self == self.max(axis=axis, keepdims=True)\n        return at_max.filled(False).argmax(axis=axis, out=out)\n\n    def argsort(self, axis=-1, kind=None, order=None):\n        \"\"\"Returns the indices that would sort an array.\n\n        Perform an indirect sort along the given axis on both the array\n        and the mask, with masked items being sorted to the end.\n\n        Parameters\n        ----------\n        axis : int or None, optional\n            Axis along which to sort.  The default is -1 (the last axis).\n            If None, the flattened array is used.\n        kind : str or None, ignored.\n            The kind of sort.  Present only to allow subclasses to work.\n        order : str or list of str.\n            For an array with fields defined, the fields to compare first,\n            second, etc.  A single field can be specified as a string, and not\n            all fields need be specified, but unspecified fields will still be\n            used, in dtype order, to break ties.\n\n        Returns\n        -------\n        index_array : ndarray, int\n            Array of indices that sorts along the specified ``axis``.  Use\n            ``np.take_along_axis(self, index_array, axis=axis)`` to obtain\n            the sorted array.\n\n        \"\"\"\n        if axis is None:\n            data = self.ravel()\n            axis = -1\n        else:\n            data = self\n\n        if self.dtype.names:\n            # As done inside the argsort implementation in multiarray/methods.c.\n            if order is None:\n                order = self.dtype.names\n            else:\n                order = np.core._internal._newnames(self.dtype, order)\n\n            keys = tuple(data[name] for name in order[::-1])\n\n        elif order is not None:\n            raise ValueError('Cannot specify order when the array has no fields.')\n\n        else:\n            keys = (data,)\n\n        return np.lexsort(keys, axis=axis)\n\n    def sort(self, axis=-1, kind=None, order=None):\n        \"\"\"Sort an array in-place. Refer to `numpy.sort` for full documentation.\"\"\"\n        # TODO: probably possible to do this faster than going through argsort!\n        indices = self.argsort(axis, kind=kind, order=order)\n        self[:] = np.take_along_axis(self, indices, axis=axis)\n\n    def argpartition(self, kth, axis=-1, kind='introselect', order=None):\n        # TODO: should be possible to do this faster than with a full argsort!\n        return self.argsort(axis=axis, order=order)\n\n    def partition(self, kth, axis=-1, kind='introselect', order=None):\n        # TODO: should be possible to do this faster than with a full argsort!\n        return self.sort(axis=axis, order=None)\n\n    def cumsum(self, axis=None, dtype=None, out=None):\n        if axis is None:\n            self = self.ravel()\n            axis = 0\n        return np.add.accumulate(self, axis=axis, dtype=dtype, out=out)\n\n    def cumprod(self, axis=None, dtype=None, out=None):\n        if axis is None:\n            self = self.ravel()\n            axis = 0\n        return np.multiply.accumulate(self, axis=axis, dtype=dtype, out=out)\n\n    def clip(self, min=None, max=None, out=None, **kwargs):\n        \"\"\"Return an array whose values are limited to ``[min, max]``.\n\n        Like `~numpy.clip`, but any masked values in ``min`` and ``max``\n        are ignored for clipping.  The mask of the input array is propagated.\n        \"\"\"\n        # TODO: implement this at the ufunc level.\n        dmin, mmin = self._get_data_and_mask(min)\n        dmax, mmax = self._get_data_and_mask(max)\n        if mmin is None and mmax is None:\n            # Fast path for unmasked max, min.\n            return super().clip(min, max, out=out, **kwargs)\n\n        masked_out = np.positive(self, out=out)\n        out = masked_out.unmasked\n        if dmin is not None:\n            np.maximum(out, dmin, out=out, where=True if mmin is None else ~mmin)\n        if dmax is not None:\n            np.minimum(out, dmax, out=out, where=True if mmax is None else ~mmax)\n        return masked_out\n\n    def mean(self, axis=None, dtype=None, out=None, keepdims=False):\n        # Implementation based on that in numpy/core/_methods.py\n        # Cast bool, unsigned int, and int to float64 by default,\n        # and do float16 at higher precision.\n        is_float16_result = False\n        if dtype is None:\n            if issubclass(self.dtype.type, (np.integer, np.bool_)):\n                dtype = np.dtype('f8')\n            elif issubclass(self.dtype.type, np.float16):\n                dtype = np.dtype('f4')\n                is_float16_result = out is None\n\n        result = self.sum(axis=axis, dtype=dtype, out=out,\n                          keepdims=keepdims, where=~self.mask)\n        n = np.add.reduce(~self.mask, axis=axis, keepdims=keepdims)\n        result /= n\n        if is_float16_result:\n            result = result.astype(self.dtype)\n        return result\n\n    def var(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False):\n        # Simplified implementation based on that in numpy/core/_methods.py\n        n = np.add.reduce(~self.mask, axis=axis, keepdims=keepdims)[...]\n\n        # Cast bool, unsigned int, and int to float64 by default.\n        if dtype is None and issubclass(self.dtype.type,\n                                        (np.integer, np.bool_)):\n            dtype = np.dtype('f8')\n        mean = self.mean(axis=axis, dtype=dtype, keepdims=True)\n\n        x = self - mean\n        x *= x.conjugate()  # Conjugate just returns x if not complex.\n\n        result = x.sum(axis=axis, dtype=dtype, out=out,\n                       keepdims=keepdims, where=~x.mask)\n        n -= ddof\n        n = np.maximum(n, 0, out=n)\n        result /= n\n        result._mask |= (n == 0)\n        return result\n\n    def std(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False):\n        result = self.var(axis=axis, dtype=dtype, out=out, ddof=ddof,\n                          keepdims=keepdims)\n        return np.sqrt(result, out=result)\n\n    def __bool__(self):\n        # First get result from array itself; this will error if not a scalar.\n        result = super().__bool__()\n        return result and not self.mask\n\n    def any(self, axis=None, out=None, keepdims=False):\n        return np.logical_or.reduce(self, axis=axis, out=out,\n                                    keepdims=keepdims, where=~self.mask)\n\n    def all(self, axis=None, out=None, keepdims=False):\n        return np.logical_and.reduce(self, axis=axis, out=out,\n                                     keepdims=keepdims, where=~self.mask)\n\n    # Following overrides needed since somehow the ndarray implementation\n    # does not actually call these.\n    def __str__(self):\n        return np.array_str(self)\n\n    def __repr__(self):\n        return np.array_repr(self)\n\n    def __format__(self, format_spec):\n        string = super().__format__(format_spec)\n        if self.shape == () and self.mask:\n            n = min(3, max(1, len(string)))\n            return ' ' * (len(string)-n) + '\\u2014' * n\n        else:\n            return string\n\n\nclass MaskedRecarray(np.recarray, MaskedNDArray, data_cls=np.recarray):\n    # Explicit definition since we need to override some methods.\n\n    def __array_finalize__(self, obj):\n        # recarray.__array_finalize__ does not do super, so we do it\n        # explicitly.\n        super().__array_finalize__(obj)\n        super(np.recarray, self).__array_finalize__(obj)\n\n    # __getattribute__, __setattr__, and field use these somewhat\n    # obscrure ndarray methods.  TODO: override in MaskedNDArray?\n    def getfield(self, dtype, offset=0):\n        for field, info in self.dtype.fields.items():\n            if offset == info[1] and dtype == info[0]:\n                return self[field]\n\n        raise NotImplementedError('can only get existing field from '\n                                  'structured dtype.')\n\n    def setfield(self, val, dtype, offset=0):\n        for field, info in self.dtype.fields.items():\n            if offset == info[1] and dtype == info[0]:\n                self[field] = val\n                return\n\n        raise NotImplementedError('can only set existing field from '\n                                  'structured dtype.')\n"},{"attributeType":"null","col":0,"comment":"Set of functions that work fine on Masked classes already.\n\nMost of these internally use `numpy.ufunc` or other functions that\nare already covered.\n","endLoc":25,"id":10920,"name":"MASKED_SAFE_FUNCTIONS","nodeType":"Attribute","startLoc":25,"text":"MASKED_SAFE_FUNCTIONS"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":126,"id":10921,"name":"iers_auto_url","nodeType":"Attribute","startLoc":126,"text":"iers_auto_url"},{"className":"Spinner","col":0,"comment":"\n    A class to display a spinner in the terminal.\n\n    It is designed to be used with the ``with`` statement::\n\n        with Spinner(\"Reticulating splines\", \"green\") as s:\n            for item in enumerate(items):\n                s.update()\n    ","endLoc":957,"id":10922,"nodeType":"Class","startLoc":824,"text":"class Spinner:\n    \"\"\"\n    A class to display a spinner in the terminal.\n\n    It is designed to be used with the ``with`` statement::\n\n        with Spinner(\"Reticulating splines\", \"green\") as s:\n            for item in enumerate(items):\n                s.update()\n    \"\"\"\n    _default_unicode_chars = \"◓◑◒◐\"\n    _default_ascii_chars = \"-/|\\\\\"\n\n    def __init__(self, msg, color='default', file=None, step=1,\n                 chars=None):\n        \"\"\"\n        Parameters\n        ----------\n        msg : str\n            The message to print\n\n        color : str, optional\n            An ANSI terminal color name.  Must be one of: black, red,\n            green, brown, blue, magenta, cyan, lightgrey, default,\n            darkgrey, lightred, lightgreen, yellow, lightblue,\n            lightmagenta, lightcyan, white.\n\n        file : writable file-like, optional\n            The file to write the spinner to.  Defaults to\n            `sys.stdout`.  If ``file`` is not a tty (as determined by\n            calling its `isatty` member, if any, or special case hacks\n            to detect the IPython console), the spinner will be\n            completely silent.\n\n        step : int, optional\n            Only update the spinner every *step* steps\n\n        chars : str, optional\n            The character sequence to use for the spinner\n        \"\"\"\n\n        if file is None:\n            file = _get_stdout()\n\n        self._msg = msg\n        self._color = color\n        self._file = file\n        self._step = step\n        if chars is None:\n            if conf.unicode_output:\n                chars = self._default_unicode_chars\n            else:\n                chars = self._default_ascii_chars\n        self._chars = chars\n\n        self._silent = not isatty(file)\n\n        if self._silent:\n            self._iter = self._silent_iterator()\n        else:\n            self._iter = self._iterator()\n\n    def _iterator(self):\n        chars = self._chars\n        index = 0\n        file = self._file\n        write = file.write\n        flush = file.flush\n        try_fallback = True\n\n        while True:\n            write('\\r')\n            color_print(self._msg, self._color, file=file, end='')\n            write(' ')\n            try:\n                if try_fallback:\n                    write = _write_with_fallback(chars[index], write, file)\n                else:\n                    write(chars[index])\n            except UnicodeError:\n                # If even _write_with_fallback failed for any reason just give\n                # up on trying to use the unicode characters\n                chars = self._default_ascii_chars\n                write(chars[index])\n                try_fallback = False  # No good will come of using this again\n            flush()\n            yield\n\n            for i in range(self._step):\n                yield\n\n            index = (index + 1) % len(chars)\n\n    def __enter__(self):\n        return self\n\n    def __exit__(self, exc_type, exc_value, traceback):\n        file = self._file\n        write = file.write\n        flush = file.flush\n\n        if not self._silent:\n            write('\\r')\n            color_print(self._msg, self._color, file=file, end='')\n        if exc_type is None:\n            color_print(' [Done]', 'green', file=file)\n        else:\n            color_print(' [Failed]', 'red', file=file)\n        flush()\n\n    def __iter__(self):\n        return self\n\n    def __next__(self):\n        next(self._iter)\n\n    def update(self, value=None):\n        \"\"\"Update the spin wheel in the terminal.\n\n        Parameters\n        ----------\n        value : int, optional\n            Ignored (present just for compatibility with `ProgressBar.update`).\n\n        \"\"\"\n\n        next(self)\n\n    def _silent_iterator(self):\n        color_print(self._msg, self._color, file=self._file, end='')\n        self._file.flush()\n\n        while True:\n            yield"},{"col":4,"comment":"null","endLoc":918,"header":"def __enter__(self)","id":10923,"name":"__enter__","nodeType":"Function","startLoc":917,"text":"def __enter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":932,"header":"def __exit__(self, exc_type, exc_value, traceback)","id":10924,"name":"__exit__","nodeType":"Function","startLoc":920,"text":"def __exit__(self, exc_type, exc_value, traceback):\n        file = self._file\n        write = file.write\n        flush = file.flush\n\n        if not self._silent:\n            write('\\r')\n            color_print(self._msg, self._color, file=file, end='')\n        if exc_type is None:\n            color_print(' [Done]', 'green', file=file)\n        else:\n            color_print(' [Failed]', 'red', file=file)\n        flush()"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":129,"id":10925,"name":"iers_auto_url_mirror","nodeType":"Attribute","startLoc":129,"text":"iers_auto_url_mirror"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":10926,"name":"NUMPY_LT_1_21_1","nodeType":"Attribute","startLoc":18,"text":"NUMPY_LT_1_21_1"},{"col":0,"comment":"null","endLoc":918,"header":"@dispatched_function\ndef array_str(arr, *args, **kwargs)","id":10927,"name":"array_str","nodeType":"Function","startLoc":912,"text":"@dispatched_function\ndef array_str(arr, *args, **kwargs):\n    # TODO: The addition of the unit doesn't worry about line length.\n    # Could copy & adapt _array_repr_implementation from\n    # numpy.core.arrayprint.py\n    no_unit = np.array_str(arr.value, *args, **kwargs)\n    return no_unit + arr._unitstr, None, None"},{"fileName":"__init__.py","filePath":"astropy/utils/masked","id":10928,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nBuilt-in mask mixin class.\n\nThe design uses `Masked` as a factory class which automatically\ngenerates new subclasses for any data class that is itself a\nsubclass of a predefined masked class, with `MaskedNDArray`\nproviding such a predefined class for `~numpy.ndarray`.\n\"\"\"\nfrom .core import *  # noqa\n"},{"col":0,"comment":"null","endLoc":951,"header":"@function_helper\ndef array2string(a, *args, **kwargs)","id":10929,"name":"array2string","nodeType":"Function","startLoc":921,"text":"@function_helper\ndef array2string(a, *args, **kwargs):\n    # array2string breaks on quantities as it tries to turn individual\n    # items into float, which works only for dimensionless.  Since the\n    # defaults would not keep any unit anyway, this is rather pointless -\n    # we're better off just passing on the array view.  However, one can\n    # also work around this by passing on a formatter (as is done in Angle).\n    # So, we do nothing if the formatter argument is present and has the\n    # relevant formatter for our dtype.\n    formatter = args[6] if len(args) >= 7 else kwargs.get('formatter', None)\n\n    if formatter is None:\n        a = a.value\n    else:\n        # See whether it covers our dtype.\n        from numpy.core.arrayprint import _get_format_function\n\n        with np.printoptions(formatter=formatter) as options:\n            try:\n                ff = _get_format_function(a.value, **options)\n            except Exception:\n                # Shouldn't happen, but possibly we're just not being smart\n                # enough, so let's pass things on as is.\n                pass\n            else:\n                # If the selected format function is that of numpy, we know\n                # things will fail\n                if 'numpy' in ff.__module__:\n                    a = a.value\n\n    return (a,) + args, kwargs, None, None"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":10930,"name":"NUMPY_LT_1_22","nodeType":"Attribute","startLoc":19,"text":"NUMPY_LT_1_22"},{"col":0,"comment":"","endLoc":9,"header":"__init__.py#<anonymous>","id":10931,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nBuilt-in mask mixin class.\n\nThe design uses `Masked` as a factory class which automatically\ngenerates new subclasses for any data class that is itself a\nsubclass of a predefined masked class, with `MaskedNDArray`\nproviding such a predefined class for `~numpy.ndarray`.\n\"\"\""},{"col":0,"comment":"null","endLoc":958,"header":"@function_helper\ndef diag(v, *args, **kwargs)","id":10932,"name":"diag","nodeType":"Function","startLoc":954,"text":"@function_helper\ndef diag(v, *args, **kwargs):\n    # Function works for *getting* the diagonal, but not *setting*.\n    # So, override always.\n    return (v.value,) + args, kwargs, v.unit, None"},{"col":0,"comment":"null","endLoc":968,"header":"@function_helper(module=np.linalg)\ndef svd(a, full_matrices=True, compute_uv=True, hermitian=False)","id":10933,"name":"svd","nodeType":"Function","startLoc":961,"text":"@function_helper(module=np.linalg)\ndef svd(a, full_matrices=True, compute_uv=True, hermitian=False):\n    unit = a.unit\n    if compute_uv:\n        unit = (None, unit, None)\n\n    return ((a.view(np.ndarray), full_matrices, compute_uv, hermitian),\n            {}, unit, None)"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":10934,"name":"NUMPY_LT_1_22_1","nodeType":"Attribute","startLoc":20,"text":"NUMPY_LT_1_22_1"},{"col":0,"comment":"","endLoc":5,"header":"numpycompat.py#<anonymous>","id":10935,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis is a collection of monkey patches and workarounds for bugs in\nearlier versions of Numpy.\n\"\"\"\n\n__all__ = ['NUMPY_LT_1_19', 'NUMPY_LT_1_20', 'NUMPY_LT_1_21_1',\n           'NUMPY_LT_1_22', 'NUMPY_LT_1_22_1', 'NUMPY_LT_1_23']\n\nNUMPY_LT_1_19 = not minversion(np, '1.19')\n\nNUMPY_LT_1_20 = not minversion(np, '1.20')\n\nNUMPY_LT_1_21_1 = not minversion(np, '1.21.1')\n\nNUMPY_LT_1_22 = not minversion(np, '1.22')\n\nNUMPY_LT_1_22_1 = not minversion(np, '1.22.1')\n\nNUMPY_LT_1_23 = not minversion(np, '1.23dev0')"},{"col":0,"comment":"null","endLoc":974,"header":"def _interpret_tol(tol, unit)","id":10936,"name":"_interpret_tol","nodeType":"Function","startLoc":971,"text":"def _interpret_tol(tol, unit):\n    from astropy.units import Quantity\n\n    return Quantity(tol, unit).value"},{"fileName":"function_helpers.py","filePath":"astropy/utils/masked","id":10937,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"Helpers for letting numpy functions interact with Masked arrays.\n\nThe module supplies helper routines for numpy functions that propagate\nmasks appropriately., for use in the ``__array_function__``\nimplementation of `~astropy.utils.masked.MaskedNDArray`.  They are not\nvery useful on their own, but the ones with docstrings are included in\nthe documentation so that there is a place to find out how the mask is\ninterpreted.\n\n\"\"\"\nimport numpy as np\n\nfrom astropy.units.quantity_helper.function_helpers import (\n    FunctionAssigner)\nfrom astropy.utils.compat import NUMPY_LT_1_19, NUMPY_LT_1_20, NUMPY_LT_1_23\n\n# This module should not really be imported, but we define __all__\n# such that sphinx can typeset the functions with docstrings.\n# The latter are added to __all__ at the end.\n__all__ = ['MASKED_SAFE_FUNCTIONS', 'APPLY_TO_BOTH_FUNCTIONS',\n           'DISPATCHED_FUNCTIONS', 'UNSUPPORTED_FUNCTIONS']\n\n\nMASKED_SAFE_FUNCTIONS = set()\n\"\"\"Set of functions that work fine on Masked classes already.\n\nMost of these internally use `numpy.ufunc` or other functions that\nare already covered.\n\"\"\"\n\nAPPLY_TO_BOTH_FUNCTIONS = {}\n\"\"\"Dict of functions that should apply to both data and mask.\n\nThe `dict` is keyed by the numpy function and the values are functions\nthat take the input arguments of the numpy function and organize these\nfor passing the data and mask to the numpy function.\n\nReturns\n-------\ndata_args : tuple\n    Arguments to pass on to the numpy function for the unmasked data.\nmask_args : tuple\n    Arguments to pass on to the numpy function for the masked data.\nkwargs : dict\n    Keyword arguments to pass on for both unmasked data and mask.\nout : `~astropy.utils.masked.Masked` instance or None\n    Optional instance in which to store the output.\n\nRaises\n------\nNotImplementedError\n   When an arguments is masked when it should not be or vice versa.\n\"\"\"\n\nDISPATCHED_FUNCTIONS = {}\n\"\"\"Dict of functions that provide the numpy function's functionality.\n\nThese are for more complicated versions where the numpy function itself\ncannot easily be used.  It should return either the result of the\nfunction, or a tuple consisting of the unmasked result, the mask for the\nresult and a possible output instance.\n\nIt should raise `NotImplementedError` if one of the arguments is masked\nwhen it should not be or vice versa.\n\"\"\"\n\nUNSUPPORTED_FUNCTIONS = set()\n\"\"\"Set of numpy functions that are not supported for masked arrays.\n\nFor most, masked input simply makes no sense, but for others it may have\nbeen lack of time.  Issues or PRs for support for functions are welcome.\n\"\"\"\n\n# Almost all from np.core.fromnumeric defer to methods so are OK.\nMASKED_SAFE_FUNCTIONS |= set(\n    getattr(np, name) for name in np.core.fromnumeric.__all__\n    if name not in ({'choose', 'put', 'resize', 'searchsorted', 'where', 'alen'}))\n\nMASKED_SAFE_FUNCTIONS |= {\n    # built-in from multiarray\n    np.may_share_memory, np.can_cast, np.min_scalar_type, np.result_type,\n    np.shares_memory,\n    # np.core.arrayprint\n    np.array_repr,\n    # np.core.function_base\n    np.linspace, np.logspace, np.geomspace,\n    # np.core.numeric\n    np.isclose, np.allclose, np.flatnonzero, np.argwhere,\n    # np.core.shape_base\n    np.atleast_1d, np.atleast_2d, np.atleast_3d, np.stack, np.hstack, np.vstack,\n    # np.lib.function_base\n    np.average, np.diff, np.extract, np.meshgrid, np.trapz, np.gradient,\n    # np.lib.index_tricks\n    np.diag_indices_from, np.triu_indices_from, np.tril_indices_from,\n    np.fill_diagonal,\n    # np.lib.shape_base\n    np.column_stack, np.row_stack, np.dstack,\n    np.array_split, np.split, np.hsplit, np.vsplit, np.dsplit,\n    np.expand_dims, np.apply_along_axis, np.kron, np.tile,\n    np.take_along_axis, np.put_along_axis,\n    # np.lib.type_check (all but asfarray, nan_to_num)\n    np.iscomplexobj, np.isrealobj, np.imag, np.isreal,\n    np.real, np.real_if_close, np.common_type,\n    # np.lib.ufunclike\n    np.fix, np.isneginf, np.isposinf,\n    # np.lib.function_base\n    np.angle, np.i0,\n}\n\nIGNORED_FUNCTIONS = {\n    # I/O - useless for Masked, since no way to store the mask.\n    np.save, np.savez, np.savetxt, np.savez_compressed,\n    # Polynomials\n    np.poly, np.polyadd, np.polyder, np.polydiv, np.polyfit, np.polyint,\n    np.polymul, np.polysub, np.polyval, np.roots, np.vander}\nif NUMPY_LT_1_20:\n    # financial\n    IGNORED_FUNCTIONS |= {np.fv, np.ipmt, np.irr, np.mirr, np.nper,\n                          np.npv, np.pmt, np.ppmt, np.pv, np.rate}\n\n# TODO: some of the following could in principle be supported.\nIGNORED_FUNCTIONS |= {\n    np.pad,\n    np.searchsorted, np.digitize,\n    np.is_busday, np.busday_count, np.busday_offset,\n    # numpy.lib.function_base\n    np.cov, np.corrcoef, np.trim_zeros,\n    # numpy.core.numeric\n    np.correlate, np.convolve,\n    # numpy.lib.histograms\n    np.histogram, np.histogram2d, np.histogramdd, np.histogram_bin_edges,\n    # TODO!!\n    np.dot, np.vdot, np.inner, np.tensordot, np.cross,\n    np.einsum, np.einsum_path,\n}\n\n# Really should do these...\nIGNORED_FUNCTIONS |= set(getattr(np, setopsname)\n                         for setopsname in np.lib.arraysetops.__all__)\n\n\nif NUMPY_LT_1_23:\n    IGNORED_FUNCTIONS |= {\n        # Deprecated, removed in numpy 1.23\n        np.asscalar, np.alen,\n    }\n\n# Explicitly unsupported functions\nUNSUPPORTED_FUNCTIONS |= {\n    np.unravel_index, np.ravel_multi_index, np.ix_,\n}\n\n# No support for the functions also not supported by Quantity\n# (io, polynomial, etc.).\nUNSUPPORTED_FUNCTIONS |= IGNORED_FUNCTIONS\n\n\napply_to_both = FunctionAssigner(APPLY_TO_BOTH_FUNCTIONS)\ndispatched_function = FunctionAssigner(DISPATCHED_FUNCTIONS)\n\n\ndef _get_data_and_masks(*args):\n    \"\"\"Separate out arguments into tuples of data and masks.\n\n    An all-False mask is created if an argument does not have a mask.\n    \"\"\"\n    from .core import Masked\n\n    data, masks = Masked._get_data_and_masks(*args)\n    masks = tuple(m if m is not None else np.zeros(np.shape(d), bool)\n                  for d, m in zip(data, masks))\n    return data, masks\n\n\n# Following are simple ufunc-like functions which should just copy the mask.\n@dispatched_function\ndef datetime_as_string(arr, *args, **kwargs):\n    return (np.datetime_as_string(arr.unmasked, *args, **kwargs),\n            arr.mask.copy(), None)\n\n\n@dispatched_function\ndef sinc(x):\n    return np.sinc(x.unmasked), x.mask.copy(), None\n\n\n@dispatched_function\ndef iscomplex(x):\n    return np.iscomplex(x.unmasked), x.mask.copy(), None\n\n\n@dispatched_function\ndef unwrap(p, *args, **kwargs):\n    return np.unwrap(p.unmasked, *args, **kwargs), p.mask.copy(), None\n\n\n@dispatched_function\ndef nan_to_num(x, copy=True, nan=0.0, posinf=None, neginf=None):\n    data = np.nan_to_num(x.unmasked, copy=copy,\n                         nan=nan, posinf=posinf, neginf=neginf)\n    return (data, x.mask.copy(), None) if copy else x\n\n\n# Following are simple functions related to shapes, where the same function\n# should be applied to the data and the mask.  They cannot all share the\n# same helper, because the first arguments have different names.\n@apply_to_both(helps={\n    np.copy, np.asfarray, np.resize, np.moveaxis, np.rollaxis, np.roll})\ndef masked_a_helper(a, *args, **kwargs):\n    data, mask = _get_data_and_masks(a)\n    return data + args, mask + args, kwargs, None\n\n\n@apply_to_both(helps={np.flip, np.flipud, np.fliplr, np.rot90, np.triu, np.tril})\ndef masked_m_helper(m, *args, **kwargs):\n    data, mask = _get_data_and_masks(m)\n    return data + args, mask + args, kwargs, None\n\n\n@apply_to_both(helps={np.diag, np.diagflat})\ndef masked_v_helper(v, *args, **kwargs):\n    data, mask = _get_data_and_masks(v)\n    return data + args, mask + args, kwargs, None\n\n\n@apply_to_both(helps={np.delete})\ndef masked_arr_helper(array, *args, **kwargs):\n    data, mask = _get_data_and_masks(array)\n    return data + args, mask + args, kwargs, None\n\n\n@apply_to_both\ndef broadcast_to(array,  shape, subok=False):\n    \"\"\"Broadcast array to the given shape.\n\n    Like `numpy.broadcast_to`, and applied to both unmasked data and mask.\n    Note that ``subok`` is taken to mean whether or not subclasses of\n    the unmasked data and mask are allowed, i.e., for ``subok=False``,\n    a `~astropy.utils.masked.MaskedNDArray` will be returned.\n    \"\"\"\n    data, mask = _get_data_and_masks(array)\n    return data, mask, dict(shape=shape, subok=subok), None\n\n\n@dispatched_function\ndef outer(a, b, out=None):\n    return np.multiply.outer(np.ravel(a), np.ravel(b), out=out)\n\n\n@dispatched_function\ndef empty_like(prototype, dtype=None, order='K', subok=True, shape=None):\n    \"\"\"Return a new array with the same shape and type as a given array.\n\n    Like `numpy.empty_like`, but will add an empty mask.\n    \"\"\"\n    unmasked = np.empty_like(prototype.unmasked, dtype=dtype, order=order,\n                             subok=subok, shape=shape)\n    if dtype is not None:\n        dtype = (np.ma.make_mask_descr(unmasked.dtype)\n                 if unmasked.dtype.names else np.dtype('?'))\n    mask = np.empty_like(prototype.mask, dtype=dtype, order=order,\n                         subok=subok, shape=shape)\n\n    return unmasked, mask, None\n\n\n@dispatched_function\ndef zeros_like(a, dtype=None, order='K', subok=True, shape=None):\n    \"\"\"Return an array of zeros with the same shape and type as a given array.\n\n    Like `numpy.zeros_like`, but will add an all-false mask.\n    \"\"\"\n    unmasked = np.zeros_like(a.unmasked, dtype=dtype, order=order,\n                             subok=subok, shape=shape)\n    return unmasked, False, None\n\n\n@dispatched_function\ndef ones_like(a, dtype=None, order='K', subok=True, shape=None):\n    \"\"\"Return an array of ones with the same shape and type as a given array.\n\n    Like `numpy.ones_like`, but will add an all-false mask.\n    \"\"\"\n    unmasked = np.ones_like(a.unmasked, dtype=dtype, order=order,\n                            subok=subok, shape=shape)\n    return unmasked, False, None\n\n\n@dispatched_function\ndef full_like(a, fill_value, dtype=None, order='K', subok=True, shape=None):\n    \"\"\"Return a full array with the same shape and type as a given array.\n\n    Like `numpy.full_like`, but with a mask that is also set.\n    If ``fill_value`` is `numpy.ma.masked`, the data will be left unset\n    (i.e., as created by `numpy.empty_like`).\n    \"\"\"\n    result = np.empty_like(a, dtype=dtype, order=order, subok=subok, shape=shape)\n    result[...] = fill_value\n    return result\n\n\n@dispatched_function\ndef put(a, ind, v, mode='raise'):\n    \"\"\"Replaces specified elements of an array with given values.\n\n    Like `numpy.put`, but for masked array ``a`` and possibly masked\n    value ``v``.  Masked indices ``ind`` are not supported.\n    \"\"\"\n    from astropy.utils.masked import Masked\n    if isinstance(ind, Masked) or not isinstance(a, Masked):\n        raise NotImplementedError\n\n    v_data, v_mask = a._get_data_and_mask(v)\n    if v_data is not None:\n        np.put(a.unmasked, ind, v_data, mode=mode)\n    # v_mask of None will be correctly interpreted as False.\n    np.put(a.mask, ind, v_mask, mode=mode)\n    return None\n\n\n@dispatched_function\ndef putmask(a, mask, values):\n    \"\"\"Changes elements of an array based on conditional and input values.\n\n    Like `numpy.putmask`, but for masked array ``a`` and possibly masked\n    ``values``.  Masked ``mask`` is not supported.\n    \"\"\"\n    from astropy.utils.masked import Masked\n    if isinstance(mask, Masked) or not isinstance(a, Masked):\n        raise NotImplementedError\n\n    values_data, values_mask = a._get_data_and_mask(values)\n    if values_data is not None:\n        np.putmask(a.unmasked, mask, values_data)\n    np.putmask(a.mask, mask, values_mask)\n    return None\n\n\n@dispatched_function\ndef place(arr, mask, vals):\n    \"\"\"Change elements of an array based on conditional and input values.\n\n    Like `numpy.place`, but for masked array ``a`` and possibly masked\n    ``values``.  Masked ``mask`` is not supported.\n    \"\"\"\n    from astropy.utils.masked import Masked\n    if isinstance(mask, Masked) or not isinstance(arr, Masked):\n        raise NotImplementedError\n\n    vals_data, vals_mask = arr._get_data_and_mask(vals)\n    if vals_data is not None:\n        np.place(arr.unmasked, mask, vals_data)\n    np.place(arr.mask, mask, vals_mask)\n    return None\n\n\n@dispatched_function\ndef copyto(dst, src,  casting='same_kind', where=True):\n    \"\"\"Copies values from one array to another, broadcasting as necessary.\n\n    Like `numpy.copyto`, but for masked destination ``dst`` and possibly\n    masked source ``src``.\n    \"\"\"\n    from astropy.utils.masked import Masked\n    if not isinstance(dst, Masked) or isinstance(where, Masked):\n        raise NotImplementedError\n\n    src_data, src_mask = dst._get_data_and_mask(src)\n\n    if src_data is not None:\n        np.copyto(dst.unmasked, src_data, casting=casting, where=where)\n    if src_mask is not None:\n        np.copyto(dst.mask, src_mask, where=where)\n    return None\n\n\n@dispatched_function\ndef packbits(a, *args, **kwargs):\n    result = np.packbits(a.unmasked, *args, **kwargs)\n    mask = np.packbits(a.mask, *args, **kwargs).astype(bool)\n    return result, mask, None\n\n\n@dispatched_function\ndef unpackbits(a, *args, **kwargs):\n    result = np.unpackbits(a.unmasked, *args, **kwargs)\n    mask = np.zeros(a.shape, dtype='u1')\n    mask[a.mask] = 255\n    mask = np.unpackbits(mask, *args, **kwargs).astype(bool)\n    return result, mask, None\n\n\n@dispatched_function\ndef bincount(x, weights=None, minlength=0):\n    \"\"\"Count number of occurrences of each value in array of non-negative ints.\n\n    Like `numpy.bincount`, but masked entries in ``x`` will be skipped.\n    Any masked entries in ``weights`` will lead the corresponding bin to\n    be masked.\n    \"\"\"\n    from astropy.utils.masked import Masked\n    if weights is not None:\n        weights = np.asanyarray(weights)\n    if isinstance(x, Masked) and x.ndim <= 1:\n        # let other dimensions lead to errors.\n        if weights is not None and weights.ndim == x.ndim:\n            weights = weights[~x.mask]\n        x = x.unmasked[~x.mask]\n    mask = None\n    if weights is not None:\n        weights, w_mask = Masked._get_data_and_mask(weights)\n        if w_mask is not None:\n            mask = np.bincount(x, w_mask.astype(int),\n                               minlength=minlength).astype(bool)\n    result = np.bincount(x, weights, minlength=0)\n    return result, mask, None\n\n\n@dispatched_function\ndef msort(a):\n    result = a.copy()\n    result.sort(axis=0)\n    return result\n\n\n@dispatched_function\ndef sort_complex(a):\n    # Just a copy of function_base.sort_complex, to avoid the asarray.\n    b = a.copy()\n    b.sort()\n    if not issubclass(b.dtype.type, np.complexfloating):  # pragma: no cover\n        if b.dtype.char in 'bhBH':\n            return b.astype('F')\n        elif b.dtype.char == 'g':\n            return b.astype('G')\n        else:\n            return b.astype('D')\n    else:\n        return b\n\n\n@apply_to_both\ndef concatenate(arrays, axis=0, out=None):\n    data, masks = _get_data_and_masks(*arrays)\n    return (data,), (masks,), dict(axis=axis), out\n\n\n@apply_to_both\ndef append(arr, values, axis=None):\n    data, masks = _get_data_and_masks(arr, values)\n    return data, masks, dict(axis=axis), None\n\n\n@dispatched_function\ndef block(arrays):\n    # We need to override block since the numpy implementation can take two\n    # different paths, one for concatenation, one for creating a large empty\n    # result array in which parts are set.  Each assumes array input and\n    # cannot be used directly.  Since it would be very costly to inspect all\n    # arrays and then turn them back into a nested list, we just copy here the\n    # second implementation, np.core.shape_base._block_slicing, since it is\n    # shortest and easiest.\n    from astropy.utils.masked import Masked\n    (arrays, list_ndim, result_ndim,\n     final_size) = np.core.shape_base._block_setup(arrays)\n    shape, slices, arrays = np.core.shape_base._block_info_recursion(\n        arrays, list_ndim, result_ndim)\n    dtype = np.result_type(*[arr.dtype for arr in arrays])\n    F_order = all(arr.flags['F_CONTIGUOUS'] for arr in arrays)\n    C_order = all(arr.flags['C_CONTIGUOUS'] for arr in arrays)\n    order = 'F' if F_order and not C_order else 'C'\n    result = Masked(np.empty(shape=shape, dtype=dtype, order=order))\n    for the_slice, arr in zip(slices, arrays):\n        result[(Ellipsis,) + the_slice] = arr\n    return result\n\n\n@dispatched_function\ndef broadcast_arrays(*args, subok=True):\n    \"\"\"Broadcast arrays to a common shape.\n\n    Like `numpy.broadcast_arrays`, applied to both unmasked data and masks.\n    Note that ``subok`` is taken to mean whether or not subclasses of\n    the unmasked data and masks are allowed, i.e., for ``subok=False``,\n    `~astropy.utils.masked.MaskedNDArray` instances will be returned.\n    \"\"\"\n    from .core import Masked\n\n    are_masked = [isinstance(arg, Masked) for arg in args]\n    data = [(arg.unmasked if is_masked else arg)\n            for arg, is_masked in zip(args, are_masked)]\n    results = np.broadcast_arrays(*data, subok=subok)\n\n    shape = results[0].shape if isinstance(results, list) else results.shape\n    masks = [(np.broadcast_to(arg.mask, shape, subok=subok)\n              if is_masked else None)\n             for arg, is_masked in zip(args, are_masked)]\n    results = [(Masked(result, mask) if mask is not None else result)\n               for (result, mask) in zip(results, masks)]\n    return results if len(results) > 1 else results[0]\n\n\n@apply_to_both\ndef insert(arr, obj, values, axis=None):\n    \"\"\"Insert values along the given axis before the given indices.\n\n    Like `numpy.insert` but for possibly masked ``arr`` and ``values``.\n    Masked ``obj`` is not supported.\n    \"\"\"\n    from astropy.utils.masked import Masked\n    if isinstance(obj, Masked) or not isinstance(arr, Masked):\n        raise NotImplementedError\n\n    (arr_data, val_data), (arr_mask, val_mask) = _get_data_and_masks(arr, values)\n    return ((arr_data, obj, val_data, axis),\n            (arr_mask, obj, val_mask, axis), {}, None)\n\n\nif NUMPY_LT_1_19:\n    @dispatched_function\n    def count_nonzero(a, axis=None):\n        \"\"\"Counts the number of non-zero values in the array ``a``.\n\n        Like `numpy.count_nonzero`, with masked values counted as 0 or `False`.\n        \"\"\"\n        filled = a.filled(np.zeros((), a.dtype))\n        return np.count_nonzero(filled, axis)\nelse:\n    @dispatched_function\n    def count_nonzero(a, axis=None, *, keepdims=False):\n        \"\"\"Counts the number of non-zero values in the array ``a``.\n\n        Like `numpy.count_nonzero`, with masked values counted as 0 or `False`.\n        \"\"\"\n        filled = a.filled(np.zeros((), a.dtype))\n        return np.count_nonzero(filled, axis, keepdims=keepdims)\n\n\nif NUMPY_LT_1_19:\n    def _zeros_like(a, dtype=None, order='K', subok=True, shape=None):\n        if shape != ():\n            return np.zeros_like(a, dtype=dtype, order=order, subok=subok, shape=shape)\n        else:\n            return np.zeros_like(a, dtype=dtype, order=order, subok=subok,\n                                 shape=(1,))[0]\nelse:\n    _zeros_like = np.zeros_like\n\n\ndef _masked_median_1d(a, overwrite_input):\n    # TODO: need an in-place mask-sorting option.\n    unmasked = a.unmasked[~a.mask]\n    if unmasked.size:\n        return a.from_unmasked(\n            np.median(unmasked, overwrite_input=overwrite_input))\n    else:\n        return a.from_unmasked(_zeros_like(a.unmasked, shape=(1,))[0], mask=True)\n\n\ndef _masked_median(a, axis=None, out=None, overwrite_input=False):\n    # As for np.nanmedian, but without a fast option as yet.\n    if axis is None or a.ndim == 1:\n        part = a.ravel()\n        result = _masked_median_1d(part, overwrite_input)\n    else:\n        result = np.apply_along_axis(_masked_median_1d, axis, a, overwrite_input)\n    if out is not None:\n        out[...] = result\n    return result\n\n\n@dispatched_function\ndef median(a, axis=None, out=None, overwrite_input=False, keepdims=False):\n    from astropy.utils.masked import Masked\n    if out is not None and not isinstance(out, Masked):\n        raise NotImplementedError\n\n    a = Masked(a)\n    r, k = np.lib.function_base._ureduce(\n        a, func=_masked_median, axis=axis, out=out,\n        overwrite_input=overwrite_input)\n    return (r.reshape(k) if keepdims else r) if out is None else out\n\n\ndef _masked_quantile_1d(a, q, **kwargs):\n    \"\"\"\n    Private function for rank 1 arrays. Compute quantile ignoring NaNs.\n    See nanpercentile for parameter usage\n    \"\"\"\n    unmasked = a.unmasked[~a.mask]\n    if unmasked.size:\n        result = np.lib.function_base._quantile_unchecked(unmasked, q, **kwargs)\n        return a.from_unmasked(result)\n    else:\n        return a.from_unmasked(_zeros_like(a.unmasked, shape=q.shape), True)\n\n\ndef _masked_quantile(a, q, axis=None, out=None, **kwargs):\n    # As for np.nanmedian, but without a fast option as yet.\n    if axis is None or a.ndim == 1:\n        part = a.ravel()\n        result = _masked_quantile_1d(part, q, **kwargs)\n    else:\n        result = np.apply_along_axis(_masked_quantile_1d, axis, a, q, **kwargs)\n        # apply_along_axis fills in collapsed axis with results.\n        # Move that axis to the beginning to match percentile's\n        # convention.\n        if q.ndim != 0:\n            result = np.moveaxis(result, axis, 0)\n\n    if out is not None:\n        out[...] = result\n    return result\n\n\n@dispatched_function\ndef quantile(a, q, axis=None, out=None, **kwargs):\n    from astropy.utils.masked import Masked\n    if isinstance(q, Masked) or out is not None and not isinstance(out, Masked):\n        raise NotImplementedError\n\n    a = Masked(a)\n    q = np.asanyarray(q)\n    if not np.lib.function_base._quantile_is_valid(q):\n        raise ValueError(\"Quantiles must be in the range [0, 1]\")\n\n    keepdims = kwargs.pop('keepdims', False)\n    r, k = np.lib.function_base._ureduce(\n        a, func=_masked_quantile, q=q, axis=axis, out=out, **kwargs)\n    return (r.reshape(k) if keepdims else r) if out is None else out\n\n\n@dispatched_function\ndef percentile(a, q, *args, **kwargs):\n    q = np.true_divide(q, 100)\n    return quantile(a, q, *args, **kwargs)\n\n\n@dispatched_function\ndef array_equal(a1, a2, equal_nan=False):\n    (a1d, a2d), (a1m, a2m) = _get_data_and_masks(a1, a2)\n    if a1d.shape != a2d.shape:\n        return False\n\n    equal = (a1d == a2d)\n    if equal_nan:\n        equal |= np.isnan(a1d) & np.isnan(a2d)\n    return bool((equal | a1m | a2m).all())\n\n\n@dispatched_function\ndef array_equiv(a1, a2):\n    return bool((a1 == a2).all())\n\n\n@dispatched_function\ndef where(condition, *args):\n    from astropy.utils.masked import Masked\n    if not args:\n        return condition.nonzero(), None, None\n\n    condition, c_mask = Masked._get_data_and_mask(condition)\n\n    data, masks = _get_data_and_masks(*args)\n    unmasked = np.where(condition, *data)\n    mask = np.where(condition, *masks)\n    if c_mask is not None:\n        mask |= c_mask\n    return Masked(unmasked, mask=mask)\n\n\n@dispatched_function\ndef choose(a, choices, out=None, mode='raise'):\n    \"\"\"Construct an array from an index array and a set of arrays to choose from.\n\n    Like `numpy.choose`.  Masked indices in ``a`` will lead to masked output\n    values and underlying data values are ignored if out of bounds (for\n    ``mode='raise'``).  Any values masked in ``choices`` will be propagated\n    if chosen.\n\n    \"\"\"\n    from astropy.utils.masked import Masked\n\n    a_data, a_mask = Masked._get_data_and_mask(a)\n    if a_mask is not None and mode == 'raise':\n        # Avoid raising on masked indices.\n        a_data = a.filled(fill_value=0)\n\n    kwargs = {'mode': mode}\n    if out is not None:\n        if not isinstance(out, Masked):\n            raise NotImplementedError\n        kwargs['out'] = out.unmasked\n\n    data, masks = _get_data_and_masks(*choices)\n    data_chosen = np.choose(a_data, data, **kwargs)\n    if out is not None:\n        kwargs['out'] = out.mask\n\n    mask_chosen = np.choose(a_data, masks, **kwargs)\n    if a_mask is not None:\n        mask_chosen |= a_mask\n\n    return Masked(data_chosen, mask_chosen) if out is None else out\n\n\n@apply_to_both\ndef select(condlist, choicelist, default=0):\n    \"\"\"Return an array drawn from elements in choicelist, depending on conditions.\n\n    Like `numpy.select`, with masks in ``choicelist`` are propagated.\n    Any masks in ``condlist`` are ignored.\n\n    \"\"\"\n    from astropy.utils.masked import Masked\n\n    condlist = [c.unmasked if isinstance(c, Masked) else c\n                for c in condlist]\n\n    data_list, mask_list = _get_data_and_masks(*choicelist)\n    default = Masked(default) if default is not np.ma.masked else Masked(0, mask=True)\n    return ((condlist, data_list, default.unmasked),\n            (condlist, mask_list, default.mask), {}, None)\n\n\n@dispatched_function\ndef piecewise(x, condlist, funclist, *args, **kw):\n    \"\"\"Evaluate a piecewise-defined function.\n\n    Like `numpy.piecewise` but for masked input array ``x``.\n    Any masks in ``condlist`` are ignored.\n\n    \"\"\"\n    # Copied implementation from numpy.lib.function_base.piecewise,\n    # just to ensure output is Masked.\n    n2 = len(funclist)\n    # undocumented: single condition is promoted to a list of one condition\n    if np.isscalar(condlist) or (\n            not isinstance(condlist[0], (list, np.ndarray))\n            and x.ndim != 0):  # pragma: no cover\n        condlist = [condlist]\n\n    condlist = np.array(condlist, dtype=bool)\n    n = len(condlist)\n\n    if n == n2 - 1:  # compute the \"otherwise\" condition.\n        condelse = ~np.any(condlist, axis=0, keepdims=True)\n        condlist = np.concatenate([condlist, condelse], axis=0)\n        n += 1\n    elif n != n2:\n        raise ValueError(\n            f\"with {n} condition(s), either {n} or {n + 1} functions are expected\"\n        )\n\n    # The one real change...\n    y = np.zeros_like(x)\n    where = []\n    what = []\n    for k in range(n):\n        item = funclist[k]\n        if not callable(item):\n            where.append(condlist[k])\n            what.append(item)\n        else:\n            vals = x[condlist[k]]\n            if vals.size > 0:\n                where.append(condlist[k])\n                what.append(item(vals, *args, **kw))\n\n    for item, value in zip(where, what):\n        y[item] = value\n\n    return y\n\n\n@dispatched_function\ndef interp(x, xp, fp, *args, **kwargs):\n    \"\"\"One-dimensional linear interpolation.\n\n    Like `numpy.interp`, but any masked points in ``xp`` and ``fp``\n    are ignored.  Any masked values in ``x`` will still be evaluated,\n    but masked on output.\n    \"\"\"\n    from astropy.utils.masked import Masked\n    xd, xm = Masked._get_data_and_mask(x)\n    if isinstance(xp, Masked) or isinstance(fp, Masked):\n        (xp, fp), (xpm, fpm) = _get_data_and_masks(xp, fp)\n        if xp.ndim == fp.ndim == 1:\n            # Avoid making arrays 1-D; will just raise below.\n            m = xpm | fpm\n            xp = xp[m]\n            fp = fp[m]\n\n    result = np.interp(xd, xp, fp, *args, **kwargs)\n    return result if xm is None else Masked(result, xm.copy())\n\n\n@dispatched_function\ndef lexsort(keys, axis=-1):\n    \"\"\"Perform an indirect stable sort using a sequence of keys.\n\n    Like `numpy.lexsort` but for possibly masked ``keys``.  Masked\n    values are sorted towards the end for each key.\n    \"\"\"\n    # Sort masks to the end.\n    from .core import Masked\n\n    new_keys = []\n    for key in keys:\n        if isinstance(key, Masked):\n            # If there are other keys below, want to be sure that\n            # for masked values, those other keys set the order.\n            new_key = key.unmasked\n            if new_keys and key.mask.any():\n                new_key = new_key.copy()\n                new_key[key.mask] = new_key.flat[0]\n            new_keys.extend([new_key, key.mask])\n        else:\n            new_keys.append(key)\n\n    return np.lexsort(new_keys, axis=axis)\n\n\n@dispatched_function\ndef apply_over_axes(func, a, axes):\n    # Copied straight from numpy/lib/shape_base, just to omit its\n    # val = asarray(a); if only it had been asanyarray, or just not there\n    # since a is assumed to an an array in the next line...\n    # Which is what we do here - we can only get here if it is Masked.\n    val = a\n    N = a.ndim\n    if np.array(axes).ndim == 0:\n        axes = (axes,)\n    for axis in axes:\n        if axis < 0:\n            axis = N + axis\n        args = (val, axis)\n        res = func(*args)\n        if res.ndim == val.ndim:\n            val = res\n        else:\n            res = np.expand_dims(res, axis)\n            if res.ndim == val.ndim:\n                val = res\n            else:\n                raise ValueError(\"function is not returning \"\n                                 \"an array of the correct shape\")\n\n    return val\n\n\nclass MaskedFormat:\n    \"\"\"Formatter for masked array scalars.\n\n    For use in `numpy.array2string`, wrapping the regular formatters such\n    that if a value is masked, its formatted string is replaced.\n\n    Typically initialized using the ``from_data`` class method.\n    \"\"\"\n    def __init__(self, format_function):\n        self.format_function = format_function\n        # Special case for structured void: we need to make all the\n        # format functions for the items masked as well.\n        # TODO: maybe is a separate class is more logical?\n        ffs = getattr(format_function, 'format_functions', None)\n        if ffs:\n            self.format_function.format_functions = [MaskedFormat(ff) for ff in ffs]\n\n    def __call__(self, x):\n        if x.dtype.names:\n            # The replacement of x with a list is needed because the function\n            # inside StructuredVoidFormat iterates over x, which works for an\n            # np.void but not an array scalar.\n            return self.format_function([x[field] for field in x.dtype.names])\n\n        string = self.format_function(x.unmasked[()])\n        if x.mask:\n            # Strikethrough would be neat, but terminal needs a different\n            # formatting than, say, jupyter notebook.\n            # return \"\\x1B[9m\"+string+\"\\x1B[29m\"\n            # return ''.join(s+'\\u0336' for s in string)\n            n = min(3, max(1, len(string)))\n            return ' ' * (len(string)-n) + '\\u2014' * n\n        else:\n            return string\n\n    @classmethod\n    def from_data(cls, data, **options):\n        from numpy.core.arrayprint import _get_format_function\n        return cls(_get_format_function(data, **options))\n\n\ndef _array2string(a, options, separator=' ', prefix=\"\"):\n    # Mostly copied from numpy.core.arrayprint, except:\n    # - The format function is wrapped in a mask-aware class;\n    # - Arrays scalars are not cast as arrays.\n    from numpy.core.arrayprint import _leading_trailing, _formatArray\n\n    data = np.asarray(a)\n\n    if a.size > options['threshold']:\n        summary_insert = \"...\"\n        data = _leading_trailing(data, options['edgeitems'])\n    else:\n        summary_insert = \"\"\n\n    # find the right formatting function for the array\n    format_function = MaskedFormat.from_data(data, **options)\n\n    # skip over \"[\"\n    next_line_prefix = \" \"\n    # skip over array(\n    next_line_prefix += \" \"*len(prefix)\n\n    lst = _formatArray(a, format_function, options['linewidth'],\n                       next_line_prefix, separator, options['edgeitems'],\n                       summary_insert, options['legacy'])\n    return lst\n\n\n@dispatched_function\ndef array2string(a, max_line_width=None, precision=None,\n                 suppress_small=None, separator=' ', prefix=\"\",\n                 style=np._NoValue, formatter=None, threshold=None,\n                 edgeitems=None, sign=None, floatmode=None, suffix=\"\"):\n    # Copied from numpy.core.arrayprint, but using _array2string above.\n    from numpy.core.arrayprint import _make_options_dict, _format_options\n\n    overrides = _make_options_dict(precision, threshold, edgeitems,\n                                   max_line_width, suppress_small, None, None,\n                                   sign, formatter, floatmode)\n    options = _format_options.copy()\n    options.update(overrides)\n\n    options['linewidth'] -= len(suffix)\n\n    # treat as a null array if any of shape elements == 0\n    if a.size == 0:\n        return \"[]\"\n\n    return _array2string(a, options, separator, prefix)\n\n\n@dispatched_function\ndef array_str(a, max_line_width=None, precision=None, suppress_small=None):\n    # Override to avoid special treatment of array scalars.\n    return array2string(a, max_line_width, precision, suppress_small, ' ', \"\")\n\n\n# For the nanfunctions, we just treat any nan as an additional mask.\n_nanfunc_fill_values = {'nansum': 0, 'nancumsum': 0,\n                        'nanprod': 1, 'nancumprod': 1}\n\n\ndef masked_nanfunc(nanfuncname):\n    np_func = getattr(np, nanfuncname[3:])\n    fill_value = _nanfunc_fill_values.get(nanfuncname, None)\n\n    def nanfunc(a, *args, **kwargs):\n        from astropy.utils.masked import Masked\n\n        a, mask = Masked._get_data_and_mask(a)\n        if issubclass(a.dtype.type, np.inexact):\n            nans = np.isnan(a)\n            mask = nans if mask is None else (nans | mask)\n\n        if mask is not None:\n            a = Masked(a, mask)\n            if fill_value is not None:\n                a = a.filled(fill_value)\n\n        return np_func(a, *args, **kwargs)\n\n    doc = f\"Like `numpy.{nanfuncname}`, skipping masked values as well.\\n\\n\"\n    if fill_value is not None:\n        # sum, cumsum, prod, cumprod\n        doc += (f\"Masked/NaN values are replaced with {fill_value}. \"\n                \"The output is not masked.\")\n    elif \"arg\" in nanfuncname:\n        doc += (\"No exceptions are raised for fully masked/NaN slices.\\n\"\n                \"Instead, these give index 0.\")\n    else:\n        doc += (\"No warnings are given for fully masked/NaN slices.\\n\"\n                \"Instead, they are masked in the output.\")\n\n    nanfunc.__doc__ = doc\n    nanfunc.__name__ = nanfuncname\n\n    return nanfunc\n\n\nfor nanfuncname in np.lib.nanfunctions.__all__:\n    globals()[nanfuncname] = dispatched_function(masked_nanfunc(nanfuncname),\n                                                 helps=getattr(np, nanfuncname))\n\n\n# Add any dispatched or helper function that has a docstring to\n# __all__, so they will be typeset by sphinx. The logic is that for\n# those presumably the use of the mask is not entirely obvious.\n__all__ += sorted(helper.__name__ for helper in (\n    set(APPLY_TO_BOTH_FUNCTIONS.values())\n    | set(DISPATCHED_FUNCTIONS.values())) if helper.__doc__)\n"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":132,"id":10938,"name":"remote_timeout","nodeType":"Attribute","startLoc":132,"text":"remote_timeout"},{"col":0,"comment":"null","endLoc":982,"header":"@function_helper(module=np.linalg)\ndef matrix_rank(M, tol=None, *args, **kwargs)","id":10939,"name":"matrix_rank","nodeType":"Function","startLoc":977,"text":"@function_helper(module=np.linalg)\ndef matrix_rank(M, tol=None, *args, **kwargs):\n    if tol is not None:\n        tol = _interpret_tol(tol, M.unit)\n\n    return (M.view(np.ndarray), tol) + args, kwargs, None, None"},{"id":10940,"name":"astropy/utils/masked/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/utils/masked/tests","id":10941,"nodeType":"File","text":""},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":135,"id":10942,"name":"system_leap_second_file","nodeType":"Attribute","startLoc":135,"text":"system_leap_second_file"},{"col":0,"comment":"null","endLoc":987,"header":"@function_helper(helps={np.linalg.inv, np.linalg.tensorinv})\ndef inv(a, *args, **kwargs)","id":10943,"name":"inv","nodeType":"Function","startLoc":985,"text":"@function_helper(helps={np.linalg.inv, np.linalg.tensorinv})\ndef inv(a, *args, **kwargs):\n    return (a.view(np.ndarray),)+args, kwargs, 1/a.unit, None"},{"id":10944,"name":"astropy/config","nodeType":"Package"},{"fileName":"affiliated.py","filePath":"astropy/config","id":10945,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"This module contains functions and classes for finding information about\naffiliated packages and installing them.\n\"\"\"\n\n\n__all__ = []\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":10946,"name":"__all__","nodeType":"Attribute","startLoc":7,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"affiliated.py#<anonymous>","id":10947,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"This module contains functions and classes for finding information about\naffiliated packages and installing them.\n\"\"\"\n\n__all__ = []"},{"col":0,"comment":"null","endLoc":994,"header":"@function_helper(module=np.linalg)\ndef pinv(a, rcond=1e-15, *args, **kwargs)","id":10948,"name":"pinv","nodeType":"Function","startLoc":990,"text":"@function_helper(module=np.linalg)\ndef pinv(a, rcond=1e-15, *args, **kwargs):\n    rcond = _interpret_tol(rcond, a.unit)\n\n    return (a.view(np.ndarray), rcond) + args, kwargs, 1/a.unit, None"},{"fileName":"configuration.py","filePath":"astropy/config","id":10949,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"This module contains classes and functions to standardize access to\nconfiguration files for Astropy and affiliated packages.\n\n.. note::\n    The configuration system makes use of the 'configobj' package, which stores\n    configuration in a text format like that used in the standard library\n    `ConfigParser`. More information and documentation for configobj can be\n    found at https://configobj.readthedocs.io .\n\"\"\"\n\nimport io\nimport pkgutil\nimport warnings\nimport importlib\nimport contextlib\nimport os\nfrom os import path\nfrom textwrap import TextWrapper\nfrom warnings import warn\nfrom contextlib import contextmanager, nullcontext\n\nfrom astropy.extern.configobj import configobj, validate\nfrom astropy.utils import find_current_module, silence\nfrom astropy.utils.decorators import deprecated\nfrom astropy.utils.exceptions import AstropyDeprecationWarning, AstropyWarning\nfrom astropy.utils.introspection import resolve_name\n\nfrom .paths import get_config_dir\n\n__all__ = ('InvalidConfigurationItemWarning', 'ConfigurationMissingWarning',\n           'get_config', 'reload_config', 'ConfigNamespace', 'ConfigItem',\n           'generate_config', 'create_config_file')\n\n\nclass InvalidConfigurationItemWarning(AstropyWarning):\n    \"\"\" A Warning that is issued when the configuration value specified in the\n    astropy configuration file does not match the type expected for that\n    configuration value.\n    \"\"\"\n\n\n# This was raised with Astropy < 4.3 when the configuration file was not found.\n# It is kept for compatibility and should be removed at some point.\n@deprecated('5.0')\nclass ConfigurationMissingWarning(AstropyWarning):\n    \"\"\" A Warning that is issued when the configuration directory cannot be\n    accessed (usually due to a permissions problem). If this warning appears,\n    configuration items will be set to their defaults rather than read from the\n    configuration file, and no configuration will persist across sessions.\n    \"\"\"\n\n\n# these are not in __all__ because it's not intended that a user ever see them\nclass ConfigurationDefaultMissingError(ValueError):\n    \"\"\" An exception that is raised when the configuration defaults (which\n    should be generated at build-time) are missing.\n    \"\"\"\n\n\n# this is used in astropy/__init__.py\nclass ConfigurationDefaultMissingWarning(AstropyWarning):\n    \"\"\" A warning that is issued when the configuration defaults (which\n    should be generated at build-time) are missing.\n    \"\"\"\n\n\nclass ConfigurationChangedWarning(AstropyWarning):\n    \"\"\"\n    A warning that the configuration options have changed.\n    \"\"\"\n\n\nclass _ConfigNamespaceMeta(type):\n    def __init__(cls, name, bases, dict):\n        if cls.__bases__[0] is object:\n            return\n\n        for key, val in dict.items():\n            if isinstance(val, ConfigItem):\n                val.name = key\n\n\nclass ConfigNamespace(metaclass=_ConfigNamespaceMeta):\n    \"\"\"\n    A namespace of configuration items.  Each subpackage with\n    configuration items should define a subclass of this class,\n    containing `ConfigItem` instances as members.\n\n    For example::\n\n        class Conf(_config.ConfigNamespace):\n            unicode_output = _config.ConfigItem(\n                False,\n                'Use Unicode characters when outputting values, ...')\n            use_color = _config.ConfigItem(\n                sys.platform != 'win32',\n                'When True, use ANSI color escape sequences when ...',\n                aliases=['astropy.utils.console.USE_COLOR'])\n        conf = Conf()\n    \"\"\"\n    def __iter__(self):\n        for key, val in self.__class__.__dict__.items():\n            if isinstance(val, ConfigItem):\n                yield key\n\n    keys = __iter__\n    \"\"\"Iterate over configuration item names.\"\"\"\n\n    def values(self):\n        \"\"\"Iterate over configuration item values.\"\"\"\n        for val in self.__class__.__dict__.values():\n            if isinstance(val, ConfigItem):\n                yield val\n\n    def items(self):\n        \"\"\"Iterate over configuration item ``(name, value)`` pairs.\"\"\"\n        for key, val in self.__class__.__dict__.items():\n            if isinstance(val, ConfigItem):\n                yield key, val\n\n    def set_temp(self, attr, value):\n        \"\"\"\n        Temporarily set a configuration value.\n\n        Parameters\n        ----------\n        attr : str\n            Configuration item name\n\n        value : object\n            The value to set temporarily.\n\n        Examples\n        --------\n        >>> import astropy\n        >>> with astropy.conf.set_temp('use_color', False):\n        ...     pass\n        ...     # console output will not contain color\n        >>> # console output contains color again...\n        \"\"\"\n        if hasattr(self, attr):\n            return self.__class__.__dict__[attr].set_temp(value)\n        raise AttributeError(f\"No configuration parameter '{attr}'\")\n\n    def reload(self, attr=None):\n        \"\"\"\n        Reload a configuration item from the configuration file.\n\n        Parameters\n        ----------\n        attr : str, optional\n            The name of the configuration parameter to reload.  If not\n            provided, reload all configuration parameters.\n        \"\"\"\n        if attr is not None:\n            if hasattr(self, attr):\n                return self.__class__.__dict__[attr].reload()\n            raise AttributeError(f\"No configuration parameter '{attr}'\")\n\n        for item in self.values():\n            item.reload()\n\n    def reset(self, attr=None):\n        \"\"\"\n        Reset a configuration item to its default.\n\n        Parameters\n        ----------\n        attr : str, optional\n            The name of the configuration parameter to reload.  If not\n            provided, reset all configuration parameters.\n        \"\"\"\n        if attr is not None:\n            if hasattr(self, attr):\n                prop = self.__class__.__dict__[attr]\n                prop.set(prop.defaultvalue)\n                return\n            raise AttributeError(f\"No configuration parameter '{attr}'\")\n\n        for item in self.values():\n            item.set(item.defaultvalue)\n\n\nclass ConfigItem:\n    \"\"\"\n    A setting and associated value stored in a configuration file.\n\n    These objects should be created as members of\n    `ConfigNamespace` subclasses, for example::\n\n        class _Conf(config.ConfigNamespace):\n            unicode_output = config.ConfigItem(\n                False,\n                'Use Unicode characters when outputting values, and writing widgets '\n                'to the console.')\n        conf = _Conf()\n\n    Parameters\n    ----------\n    defaultvalue : object, optional\n        The default value for this item. If this is a list of strings, this\n        item will be interpreted as an 'options' value - this item must be one\n        of those values, and the first in the list will be taken as the default\n        value.\n\n    description : str or None, optional\n        A description of this item (will be shown as a comment in the\n        configuration file)\n\n    cfgtype : str or None, optional\n        A type specifier like those used as the *values* of a particular key\n        in a ``configspec`` file of ``configobj``. If None, the type will be\n        inferred from the default value.\n\n    module : str or None, optional\n        The full module name that this item is associated with. The first\n        element (e.g. 'astropy' if this is 'astropy.config.configuration')\n        will be used to determine the name of the configuration file, while\n        the remaining items determine the section. If None, the package will be\n        inferred from the package within which this object's initializer is\n        called.\n\n    aliases : str, or list of str, optional\n        The deprecated location(s) of this configuration item.  If the\n        config item is not found at the new location, it will be\n        searched for at all of the old locations.\n\n    Raises\n    ------\n    RuntimeError\n        If ``module`` is `None`, but the module this item is created from\n        cannot be determined.\n    \"\"\"\n\n    # this is used to make validation faster so a Validator object doesn't\n    # have to be created every time\n    _validator = validate.Validator()\n    cfgtype = None\n    \"\"\"\n    A type specifier like those used as the *values* of a particular key in a\n    ``configspec`` file of ``configobj``.\n    \"\"\"\n\n    rootname = 'astropy'\n    \"\"\"\n    Rootname sets the base path for all config files.\n    \"\"\"\n\n    def __init__(self, defaultvalue='', description=None, cfgtype=None,\n                 module=None, aliases=None):\n        from astropy.utils import isiterable\n\n        if module is None:\n            module = find_current_module(2)\n            if module is None:\n                msg1 = 'Cannot automatically determine get_config module, '\n                msg2 = 'because it is not called from inside a valid module'\n                raise RuntimeError(msg1 + msg2)\n            else:\n                module = module.__name__\n\n        self.module = module\n        self.description = description\n        self.__doc__ = description\n\n        # now determine cfgtype if it is not given\n        if cfgtype is None:\n            if (isiterable(defaultvalue) and not\n                    isinstance(defaultvalue, str)):\n                # it is an options list\n                dvstr = [str(v) for v in defaultvalue]\n                cfgtype = 'option(' + ', '.join(dvstr) + ')'\n                defaultvalue = dvstr[0]\n            elif isinstance(defaultvalue, bool):\n                cfgtype = 'boolean'\n            elif isinstance(defaultvalue, int):\n                cfgtype = 'integer'\n            elif isinstance(defaultvalue, float):\n                cfgtype = 'float'\n            elif isinstance(defaultvalue, str):\n                cfgtype = 'string'\n                defaultvalue = str(defaultvalue)\n\n        self.cfgtype = cfgtype\n\n        self._validate_val(defaultvalue)\n        self.defaultvalue = defaultvalue\n\n        if aliases is None:\n            self.aliases = []\n        elif isinstance(aliases, str):\n            self.aliases = [aliases]\n        else:\n            self.aliases = aliases\n\n    def __set__(self, obj, value):\n        return self.set(value)\n\n    def __get__(self, obj, objtype=None):\n        if obj is None:\n            return self\n        return self()\n\n    def set(self, value):\n        \"\"\"\n        Sets the current value of this ``ConfigItem``.\n\n        This also updates the comments that give the description and type\n        information.\n\n        Parameters\n        ----------\n        value\n            The value this item should be set to.\n\n        Raises\n        ------\n        TypeError\n            If the provided ``value`` is not valid for this ``ConfigItem``.\n        \"\"\"\n        try:\n            value = self._validate_val(value)\n        except validate.ValidateError as e:\n            msg = 'Provided value for configuration item {0} not valid: {1}'\n            raise TypeError(msg.format(self.name, e.args[0]))\n\n        sec = get_config(self.module, rootname=self.rootname)\n\n        sec[self.name] = value\n\n    @contextmanager\n    def set_temp(self, value):\n        \"\"\"\n        Sets this item to a specified value only inside a with block.\n\n        Use as::\n\n            ITEM = ConfigItem('ITEM', 'default', 'description')\n\n            with ITEM.set_temp('newval'):\n                #... do something that wants ITEM's value to be 'newval' ...\n                print(ITEM)\n\n            # ITEM is now 'default' after the with block\n\n        Parameters\n        ----------\n        value\n            The value to set this item to inside the with block.\n\n        \"\"\"\n        initval = self()\n        self.set(value)\n        try:\n            yield\n        finally:\n            self.set(initval)\n\n    def reload(self):\n        \"\"\" Reloads the value of this ``ConfigItem`` from the relevant\n        configuration file.\n\n        Returns\n        -------\n        val : object\n            The new value loaded from the configuration file.\n\n        \"\"\"\n        self.set(self.defaultvalue)\n        baseobj = get_config(self.module, True, rootname=self.rootname)\n        secname = baseobj.name\n\n        cobj = baseobj\n        # a ConfigObj's parent is itself, so we look for the parent with that\n        while cobj.parent is not cobj:\n            cobj = cobj.parent\n\n        newobj = configobj.ConfigObj(cobj.filename, interpolation=False)\n        if secname is not None:\n            if secname not in newobj:\n                return baseobj.get(self.name)\n            newobj = newobj[secname]\n\n        if self.name in newobj:\n            baseobj[self.name] = newobj[self.name]\n        return baseobj.get(self.name)\n\n    def __repr__(self):\n        out = '<{}: name={!r} value={!r} at 0x{:x}>'.format(\n            self.__class__.__name__, self.name, self(), id(self))\n        return out\n\n    def __str__(self):\n        out = '\\n'.join(('{0}: {1}',\n                         '  cfgtype={2!r}',\n                         '  defaultvalue={3!r}',\n                         '  description={4!r}',\n                         '  module={5}',\n                         '  value={6!r}'))\n        out = out.format(self.__class__.__name__, self.name, self.cfgtype,\n                         self.defaultvalue, self.description, self.module,\n                         self())\n        return out\n\n    def __call__(self):\n        \"\"\" Returns the value of this ``ConfigItem``\n\n        Returns\n        -------\n        val : object\n            This item's value, with a type determined by the ``cfgtype``\n            attribute.\n\n        Raises\n        ------\n        TypeError\n            If the configuration value as stored is not this item's type.\n\n        \"\"\"\n        def section_name(section):\n            if section == '':\n                return 'at the top-level'\n            else:\n                return f'in section [{section}]'\n\n        options = []\n        sec = get_config(self.module, rootname=self.rootname)\n        if self.name in sec:\n            options.append((sec[self.name], self.module, self.name))\n\n        for alias in self.aliases:\n            module, name = alias.rsplit('.', 1)\n            sec = get_config(module, rootname=self.rootname)\n            if '.' in module:\n                filename, module = module.split('.', 1)\n            else:\n                filename = module\n                module = ''\n            if name in sec:\n                if '.' in self.module:\n                    new_module = self.module.split('.', 1)[1]\n                else:\n                    new_module = ''\n                warn(\n                    \"Config parameter '{}' {} of the file '{}' \"\n                    \"is deprecated. Use '{}' {} instead.\".format(\n                        name, section_name(module), get_config_filename(filename,\n                                                                        rootname=self.rootname),\n                        self.name, section_name(new_module)),\n                    AstropyDeprecationWarning)\n                options.append((sec[name], module, name))\n\n        if len(options) == 0:\n            self.set(self.defaultvalue)\n            options.append((self.defaultvalue, None, None))\n\n        if len(options) > 1:\n            filename, sec = self.module.split('.', 1)\n            warn(\n                \"Config parameter '{}' {} of the file '{}' is \"\n                \"given by more than one alias ({}). Using the first.\".format(\n                    self.name, section_name(sec), get_config_filename(filename,\n                                                                      rootname=self.rootname),\n                    ', '.join([\n                        '.'.join(x[1:3]) for x in options if x[1] is not None])),\n                AstropyDeprecationWarning)\n\n        val = options[0][0]\n\n        try:\n            return self._validate_val(val)\n        except validate.ValidateError as e:\n            raise TypeError('Configuration value not valid:' + e.args[0])\n\n    def _validate_val(self, val):\n        \"\"\" Validates the provided value based on cfgtype and returns the\n        type-cast value\n\n        throws the underlying configobj exception if it fails\n        \"\"\"\n        # note that this will normally use the *class* attribute `_validator`,\n        # but if some arcane reason is needed for making a special one for an\n        # instance or sub-class, it will be used\n        return self._validator.check(self.cfgtype, val)\n\n\n# this dictionary stores the primary copy of the ConfigObj's for each\n# root package\n_cfgobjs = {}\n\n\ndef get_config_filename(packageormod=None, rootname=None):\n    \"\"\"\n    Get the filename of the config file associated with the given\n    package or module.\n    \"\"\"\n    cfg = get_config(packageormod, rootname=rootname)\n    while cfg.parent is not cfg:\n        cfg = cfg.parent\n    return cfg.filename\n\n\n# This is used by testing to override the config file, so we can test\n# with various config files that exercise different features of the\n# config system.\n_override_config_file = None\n\n\ndef get_config(packageormod=None, reload=False, rootname=None):\n    \"\"\" Gets the configuration object or section associated with a particular\n    package or module.\n\n    Parameters\n    ----------\n    packageormod : str or None\n        The package for which to retrieve the configuration object. If a\n        string, it must be a valid package name, or if ``None``, the package from\n        which this function is called will be used.\n\n    reload : bool, optional\n        Reload the file, even if we have it cached.\n\n    rootname : str or None\n        Name of the root configuration directory. If ``None`` and\n        ``packageormod`` is ``None``, this defaults to be the name of\n        the package from which this function is called. If ``None`` and\n        ``packageormod`` is not ``None``, this defaults to ``astropy``.\n\n    Returns\n    -------\n    cfgobj : ``configobj.ConfigObj`` or ``configobj.Section``\n        If the requested package is a base package, this will be the\n        ``configobj.ConfigObj`` for that package, or if it is a subpackage or\n        module, it will return the relevant ``configobj.Section`` object.\n\n    Raises\n    ------\n    RuntimeError\n        If ``packageormod`` is `None`, but the package this item is created\n        from cannot be determined.\n    \"\"\"\n\n    if packageormod is None:\n        packageormod = find_current_module(2)\n        if packageormod is None:\n            msg1 = 'Cannot automatically determine get_config module, '\n            msg2 = 'because it is not called from inside a valid module'\n            raise RuntimeError(msg1 + msg2)\n        else:\n            packageormod = packageormod.__name__\n\n        _autopkg = True\n\n    else:\n        _autopkg = False\n\n    packageormodspl = packageormod.split('.')\n    pkgname = packageormodspl[0]\n    secname = '.'.join(packageormodspl[1:])\n\n    if rootname is None:\n        if _autopkg:\n            rootname = pkgname\n        else:\n            rootname = 'astropy'  # so we don't break affiliated packages\n\n    cobj = _cfgobjs.get(pkgname, None)\n\n    if cobj is None or reload:\n        cfgfn = None\n        try:\n            # This feature is intended only for use by the unit tests\n            if _override_config_file is not None:\n                cfgfn = _override_config_file\n            else:\n                cfgfn = path.join(get_config_dir(rootname=rootname), pkgname + '.cfg')\n            cobj = configobj.ConfigObj(cfgfn, interpolation=False)\n        except OSError:\n            # This can happen when HOME is not set\n            cobj = configobj.ConfigObj(interpolation=False)\n\n        # This caches the object, so if the file becomes accessible, this\n        # function won't see it unless the module is reloaded\n        _cfgobjs[pkgname] = cobj\n\n    if secname:  # not the root package\n        if secname not in cobj:\n            cobj[secname] = {}\n        return cobj[secname]\n    else:\n        return cobj\n\n\ndef generate_config(pkgname='astropy', filename=None, verbose=False):\n    \"\"\"Generates a configuration file, from the list of `ConfigItem`\n    objects for each subpackage.\n\n    .. versionadded:: 4.1\n\n    Parameters\n    ----------\n    pkgname : str or None\n        The package for which to retrieve the configuration object.\n    filename : str or file-like or None\n        If None, the default configuration path is taken from `get_config`.\n\n    \"\"\"\n    if verbose:\n        verbosity = nullcontext\n        filter_warnings = AstropyDeprecationWarning\n    else:\n        verbosity = silence\n        filter_warnings = Warning\n\n    package = importlib.import_module(pkgname)\n    with verbosity(), warnings.catch_warnings():\n        warnings.simplefilter('ignore', category=filter_warnings)\n        for mod in pkgutil.walk_packages(path=package.__path__,\n                                         prefix=package.__name__ + '.'):\n\n            if (mod.module_finder.path.endswith(('test', 'tests')) or\n                    mod.name.endswith('setup_package')):\n                # Skip test and setup_package modules\n                continue\n            if mod.name.split('.')[-1].startswith('_'):\n                # Skip private modules\n                continue\n\n            with contextlib.suppress(ImportError):\n                importlib.import_module(mod.name)\n\n    wrapper = TextWrapper(initial_indent=\"## \", subsequent_indent='## ',\n                          width=78)\n\n    if filename is None:\n        filename = get_config_filename(pkgname)\n\n    with contextlib.ExitStack() as stack:\n        if isinstance(filename, (str, os.PathLike)):\n            fp = stack.enter_context(open(filename, 'w'))\n        else:\n            # assume it's a file object, or io.StringIO\n            fp = filename\n\n        # Parse the subclasses, ordered by their module name\n        subclasses = ConfigNamespace.__subclasses__()\n        processed = set()\n\n        for conf in sorted(subclasses, key=lambda x: x.__module__):\n            mod = conf.__module__\n\n            # Skip modules for other packages, e.g. astropy modules that\n            # would be imported when running the function for astroquery.\n            if mod.split('.')[0] != pkgname:\n                continue\n\n            # Check that modules are not processed twice, which can happen\n            # when they are imported in another module.\n            if mod in processed:\n                continue\n            else:\n                processed.add(mod)\n\n            print_module = True\n            for item in conf().values():\n                if print_module:\n                    # If this is the first item of the module, we print the\n                    # module name, but not if this is the root package...\n                    if item.module != pkgname:\n                        modname = item.module.replace(f'{pkgname}.', '')\n                        fp.write(f\"[{modname}]\\n\\n\")\n                    print_module = False\n\n                fp.write(wrapper.fill(item.description) + '\\n')\n                if isinstance(item.defaultvalue, (tuple, list)):\n                    if len(item.defaultvalue) == 0:\n                        fp.write(f'# {item.name} = ,\\n\\n')\n                    elif len(item.defaultvalue) == 1:\n                        fp.write(f'# {item.name} = {item.defaultvalue[0]},\\n\\n')\n                    else:\n                        fp.write(f'# {item.name} = {\",\".join(map(str, item.defaultvalue))}\\n\\n')\n                else:\n                    fp.write(f'# {item.name} = {item.defaultvalue}\\n\\n')\n\n\ndef reload_config(packageormod=None, rootname=None):\n    \"\"\" Reloads configuration settings from a configuration file for the root\n    package of the requested package/module.\n\n    This overwrites any changes that may have been made in `ConfigItem`\n    objects.  This applies for any items that are based on this file, which\n    is determined by the *root* package of ``packageormod``\n    (e.g. ``'astropy.cfg'`` for the ``'astropy.config.configuration'``\n    module).\n\n    Parameters\n    ----------\n    packageormod : str or None\n        The package or module name - see `get_config` for details.\n    rootname : str or None\n        Name of the root configuration directory - see `get_config`\n        for details.\n    \"\"\"\n    sec = get_config(packageormod, True, rootname=rootname)\n    # look for the section that is its own parent - that's the base object\n    while sec.parent is not sec:\n        sec = sec.parent\n    sec.reload()\n\n\ndef is_unedited_config_file(content, template_content=None):\n    \"\"\"\n    Determines if a config file can be safely replaced because it doesn't\n    actually contain any meaningful content, i.e. if it contains only comments\n    or is completely empty.\n    \"\"\"\n    buffer = io.StringIO(content)\n    raw_cfg = configobj.ConfigObj(buffer, interpolation=True)\n    # If any of the items is set, return False\n    return not any(len(v) > 0 for v in raw_cfg.values())\n\n\n# This function is no more used by astropy but it is kept for the other\n# packages that may use it (e.g. astroquery). It should be removed at some\n# point.\n# this is not in __all__ because it's not intended that a user uses it\n@deprecated('5.0')\ndef update_default_config(pkg, default_cfg_dir_or_fn, version=None, rootname='astropy'):\n    \"\"\"\n    Checks if the configuration file for the specified package exists,\n    and if not, copy over the default configuration.  If the\n    configuration file looks like it has already been edited, we do\n    not write over it, but instead write a file alongside it named\n    ``pkg.version.cfg`` as a \"template\" for the user.\n\n    Parameters\n    ----------\n    pkg : str\n        The package to be updated.\n    default_cfg_dir_or_fn : str\n        The filename or directory name where the default configuration file is.\n        If a directory name, ``'pkg.cfg'`` will be used in that directory.\n    version : str, optional\n        The current version of the given package.  If not provided, it will\n        be obtained from ``pkg.__version__``.\n    rootname : str\n        Name of the root configuration directory.\n\n    Returns\n    -------\n    updated : bool\n        If the profile was updated, `True`, otherwise `False`.\n\n    Raises\n    ------\n    AttributeError\n        If the version number of the package could not determined.\n\n    \"\"\"\n\n    if path.isdir(default_cfg_dir_or_fn):\n        default_cfgfn = path.join(default_cfg_dir_or_fn, pkg + '.cfg')\n    else:\n        default_cfgfn = default_cfg_dir_or_fn\n\n    if not path.isfile(default_cfgfn):\n        # There is no template configuration file, which basically\n        # means the affiliated package is not using the configuration\n        # system, so just return.\n        return False\n\n    cfgfn = get_config(pkg, rootname=rootname).filename\n\n    with open(default_cfgfn, 'rt', encoding='latin-1') as fr:\n        template_content = fr.read()\n\n    doupdate = False\n    if cfgfn is not None:\n        if path.exists(cfgfn):\n            with open(cfgfn, 'rt', encoding='latin-1') as fd:\n                content = fd.read()\n\n            identical = (content == template_content)\n\n            if not identical:\n                doupdate = is_unedited_config_file(\n                    content, template_content)\n        elif path.exists(path.dirname(cfgfn)):\n            doupdate = True\n            identical = False\n\n    if version is None:\n        version = resolve_name(pkg, '__version__')\n\n    # Don't install template files for dev versions, or we'll end up\n    # spamming `~/.astropy/config`.\n    if version and 'dev' not in version and cfgfn is not None:\n        template_path = path.join(\n            get_config_dir(rootname=rootname), f'{pkg}.{version}.cfg')\n        needs_template = not path.exists(template_path)\n    else:\n        needs_template = False\n\n    if doupdate or needs_template:\n        if needs_template:\n            with open(template_path, 'wt', encoding='latin-1') as fw:\n                fw.write(template_content)\n            # If we just installed a new template file and we can't\n            # update the main configuration file because it has user\n            # changes, display a warning.\n            if not identical and not doupdate:\n                warn(\n                    \"The configuration options in {} {} may have changed, \"\n                    \"your configuration file was not updated in order to \"\n                    \"preserve local changes.  A new configuration template \"\n                    \"has been saved to '{}'.\".format(\n                        pkg, version, template_path),\n                    ConfigurationChangedWarning)\n\n        if doupdate and not identical:\n            with open(cfgfn, 'wt', encoding='latin-1') as fw:\n                fw.write(template_content)\n            return True\n\n    return False\n\n\ndef create_config_file(pkg, rootname='astropy', overwrite=False):\n    \"\"\"\n    Create the default configuration file for the specified package.\n    If the file already exists, it is updated only if it has not been\n    modified.  Otherwise the ``overwrite`` flag is needed to overwrite it.\n\n    Parameters\n    ----------\n    pkg : str\n        The package to be updated.\n    rootname : str\n        Name of the root configuration directory.\n    overwrite : bool\n        Force updating the file if it already exists.\n\n    Returns\n    -------\n    updated : bool\n        If the profile was updated, `True`, otherwise `False`.\n\n    \"\"\"\n\n    # local import to prevent using the logger before it is configured\n    from astropy.logger import log\n\n    cfgfn = get_config_filename(pkg, rootname=rootname)\n\n    # generate the default config template\n    template_content = io.StringIO()\n    generate_config(pkg, template_content)\n    template_content.seek(0)\n    template_content = template_content.read()\n\n    doupdate = True\n\n    # if the file already exists, check that it has not been modified\n    if cfgfn is not None and path.exists(cfgfn):\n        with open(cfgfn, 'rt', encoding='latin-1') as fd:\n            content = fd.read()\n\n        doupdate = is_unedited_config_file(content, template_content)\n\n    if doupdate or overwrite:\n        with open(cfgfn, 'wt', encoding='latin-1') as fw:\n            fw.write(template_content)\n        log.info('The configuration file has been successfully written '\n                 f'to {cfgfn}')\n        return True\n    elif not doupdate:\n        log.warning('The configuration file already exists and seems to '\n                    'have been customized, so it has not been updated. '\n                    'Use overwrite=True if you really want to update it.')\n\n    return False\n"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":138,"id":10950,"name":"iers_leap_second_auto_url","nodeType":"Attribute","startLoc":138,"text":"iers_leap_second_auto_url"},{"className":"InvalidConfigurationItemWarning","col":0,"comment":" A Warning that is issued when the configuration value specified in the\n    astropy configuration file does not match the type expected for that\n    configuration value.\n    ","endLoc":40,"id":10951,"nodeType":"Class","startLoc":36,"text":"class InvalidConfigurationItemWarning(AstropyWarning):\n    \"\"\" A Warning that is issued when the configuration value specified in the\n    astropy configuration file does not match the type expected for that\n    configuration value.\n    \"\"\""},{"className":"ConfigurationMissingWarning","col":0,"comment":" A Warning that is issued when the configuration directory cannot be\n    accessed (usually due to a permissions problem). If this warning appears,\n    configuration items will be set to their defaults rather than read from the\n    configuration file, and no configuration will persist across sessions.\n    ","endLoc":51,"id":10952,"nodeType":"Class","startLoc":45,"text":"@deprecated('5.0')\nclass ConfigurationMissingWarning(AstropyWarning):\n    \"\"\" A Warning that is issued when the configuration directory cannot be\n    accessed (usually due to a permissions problem). If this warning appears,\n    configuration items will be set to their defaults rather than read from the\n    configuration file, and no configuration will persist across sessions.\n    \"\"\""},{"col":0,"comment":"null","endLoc":999,"header":"@function_helper(module=np.linalg)\ndef det(a)","id":10953,"name":"det","nodeType":"Function","startLoc":997,"text":"@function_helper(module=np.linalg)\ndef det(a):\n    return (a.view(np.ndarray),), {}, a.unit ** a.shape[-1], None"},{"col":4,"comment":"null","endLoc":935,"header":"def __iter__(self)","id":10954,"name":"__iter__","nodeType":"Function","startLoc":934,"text":"def __iter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":938,"header":"def __next__(self)","id":10955,"name":"__next__","nodeType":"Function","startLoc":937,"text":"def __next__(self):\n        next(self._iter)"},{"className":"ConfigurationDefaultMissingError","col":0,"comment":" An exception that is raised when the configuration defaults (which\n    should be generated at build-time) are missing.\n    ","endLoc":58,"id":10956,"nodeType":"Class","startLoc":55,"text":"class ConfigurationDefaultMissingError(ValueError):\n    \"\"\" An exception that is raised when the configuration defaults (which\n    should be generated at build-time) are missing.\n    \"\"\""},{"col":4,"comment":"Update the spin wheel in the terminal.\n\n        Parameters\n        ----------\n        value : int, optional\n            Ignored (present just for compatibility with `ProgressBar.update`).\n\n        ","endLoc":950,"header":"def update(self, value=None)","id":10957,"name":"update","nodeType":"Function","startLoc":940,"text":"def update(self, value=None):\n        \"\"\"Update the spin wheel in the terminal.\n\n        Parameters\n        ----------\n        value : int, optional\n            Ignored (present just for compatibility with `ProgressBar.update`).\n\n        \"\"\"\n\n        next(self)"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":141,"id":10958,"name":"ietf_leap_second_auto_url","nodeType":"Attribute","startLoc":141,"text":"ietf_leap_second_auto_url"},{"attributeType":"null","col":4,"comment":"null","endLoc":834,"id":10959,"name":"_default_unicode_chars","nodeType":"Attribute","startLoc":834,"text":"_default_unicode_chars"},{"attributeType":"null","col":4,"comment":"null","endLoc":835,"id":10960,"name":"_default_ascii_chars","nodeType":"Attribute","startLoc":835,"text":"_default_ascii_chars"},{"className":"ConfigurationDefaultMissingWarning","col":0,"comment":" A warning that is issued when the configuration defaults (which\n    should be generated at build-time) are missing.\n    ","endLoc":65,"id":10961,"nodeType":"Class","startLoc":62,"text":"class ConfigurationDefaultMissingWarning(AstropyWarning):\n    \"\"\" A warning that is issued when the configuration defaults (which\n    should be generated at build-time) are missing.\n    \"\"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":870,"id":10962,"name":"_file","nodeType":"Attribute","startLoc":870,"text":"self._file"},{"attributeType":"null","col":8,"comment":"null","endLoc":879,"id":10963,"name":"_silent","nodeType":"Attribute","startLoc":879,"text":"self._silent"},{"attributeType":"null","col":8,"comment":"null","endLoc":869,"id":10964,"name":"_color","nodeType":"Attribute","startLoc":869,"text":"self._color"},{"col":0,"comment":"null","endLoc":1007,"header":"@function_helper(helps={np.linalg.solve, np.linalg.tensorsolve})\ndef solve(a, b, *args, **kwargs)","id":10965,"name":"solve","nodeType":"Function","startLoc":1002,"text":"@function_helper(helps={np.linalg.solve, np.linalg.tensorsolve})\ndef solve(a, b, *args, **kwargs):\n    a, b = _as_quantities(a, b)\n\n    return ((a.view(np.ndarray), b.view(np.ndarray)) + args, kwargs,\n            b.unit / a.unit, None)"},{"className":"ConfigurationChangedWarning","col":0,"comment":"\n    A warning that the configuration options have changed.\n    ","endLoc":71,"id":10966,"nodeType":"Class","startLoc":68,"text":"class ConfigurationChangedWarning(AstropyWarning):\n    \"\"\"\n    A warning that the configuration options have changed.\n    \"\"\""},{"className":"_ConfigNamespaceMeta","col":0,"comment":"null","endLoc":81,"id":10967,"nodeType":"Class","startLoc":74,"text":"class _ConfigNamespaceMeta(type):\n    def __init__(cls, name, bases, dict):\n        if cls.__bases__[0] is object:\n            return\n\n        for key, val in dict.items():\n            if isinstance(val, ConfigItem):\n                val.name = key"},{"attributeType":"null","col":8,"comment":"null","endLoc":871,"id":10968,"name":"_step","nodeType":"Attribute","startLoc":871,"text":"self._step"},{"col":4,"comment":"null","endLoc":81,"header":"def __init__(cls, name, bases, dict)","id":10969,"name":"__init__","nodeType":"Function","startLoc":75,"text":"def __init__(cls, name, bases, dict):\n        if cls.__bases__[0] is object:\n            return\n\n        for key, val in dict.items():\n            if isinstance(val, ConfigItem):\n                val.name = key"},{"className":"IERSRangeError","col":0,"comment":"\n    Any error for when dates are outside of the valid range for IERS\n    ","endLoc":152,"id":10970,"nodeType":"Class","startLoc":149,"text":"class IERSRangeError(IndexError):\n    \"\"\"\n    Any error for when dates are outside of the valid range for IERS\n    \"\"\""},{"className":"IERS","col":0,"comment":"Generic IERS table class, defining interpolation functions.\n\n    Sub-classed from `astropy.table.QTable`.  The table should hold columns\n    'MJD', 'UT1_UTC', 'dX_2000A'/'dY_2000A', and 'PM_x'/'PM_y'.\n    ","endLoc":457,"id":10971,"nodeType":"Class","startLoc":155,"text":"class IERS(QTable):\n    \"\"\"Generic IERS table class, defining interpolation functions.\n\n    Sub-classed from `astropy.table.QTable`.  The table should hold columns\n    'MJD', 'UT1_UTC', 'dX_2000A'/'dY_2000A', and 'PM_x'/'PM_y'.\n    \"\"\"\n\n    iers_table = None\n    \"\"\"Cached table, returned if ``open`` is called without arguments.\"\"\"\n\n    @classmethod\n    def open(cls, file=None, cache=False, **kwargs):\n        \"\"\"Open an IERS table, reading it from a file if not loaded before.\n\n        Parameters\n        ----------\n        file : str or None\n            full local or network path to the ascii file holding IERS data,\n            for passing on to the ``read`` class methods (further optional\n            arguments that are available for some IERS subclasses can be added).\n            If None, use the default location from the ``read`` class method.\n        cache : bool\n            Whether to use cache. Defaults to False, since IERS files\n            are regularly updated.\n\n        Returns\n        -------\n        IERS\n            An IERS table class instance\n\n        Notes\n        -----\n        On the first call in a session, the table will be memoized (in the\n        ``iers_table`` class attribute), and further calls to ``open`` will\n        return this stored table if ``file=None`` (the default).\n\n        If a table needs to be re-read from disk, pass on an explicit file\n        location or use the (sub-class) close method and re-open.\n\n        If the location is a network location it is first downloaded via\n        download_file.\n\n        For the IERS class itself, an IERS_B sub-class instance is opened.\n\n        \"\"\"\n        if file is not None or cls.iers_table is None:\n            if file is not None:\n                if urlparse(file).netloc:\n                    kwargs.update(file=download_file(file, cache=cache))\n                else:\n                    kwargs.update(file=file)\n\n            # TODO: the below is really ugly and probably a bad idea.  Instead,\n            # there should probably be an IERSBase class, which provides\n            # useful methods but cannot really be used on its own, and then\n            # *perhaps* an IERS class which provides best defaults.  But for\n            # backwards compatibility, we use the IERS_B reader for IERS here.\n            if cls is IERS:\n                cls.iers_table = IERS_B.read(**kwargs)\n            else:\n                cls.iers_table = cls.read(**kwargs)\n        return cls.iers_table\n\n    @classmethod\n    def close(cls):\n        \"\"\"Remove the IERS table from the class.\n\n        This allows the table to be re-read from disk during one's session\n        (e.g., if one finds it is out of date and has updated the file).\n        \"\"\"\n        cls.iers_table = None\n\n    def mjd_utc(self, jd1, jd2=0.):\n        \"\"\"Turn a time to MJD, returning integer and fractional parts.\n\n        Parameters\n        ----------\n        jd1 : float, array, or `~astropy.time.Time`\n            first part of two-part JD, or Time object\n        jd2 : float or array, optional\n            second part of two-part JD.\n            Default is 0., ignored if jd1 is `~astropy.time.Time`.\n\n        Returns\n        -------\n        mjd : float or array\n            integer part of MJD\n        utc : float or array\n            fractional part of MJD\n        \"\"\"\n        try:  # see if this is a Time object\n            jd1, jd2 = jd1.utc.jd1, jd1.utc.jd2\n        except Exception:\n            pass\n\n        mjd = np.floor(jd1 - MJD_ZERO + jd2)\n        utc = jd1 - (MJD_ZERO+mjd) + jd2\n        return mjd, utc\n\n    def ut1_utc(self, jd1, jd2=0., return_status=False):\n        \"\"\"Interpolate UT1-UTC corrections in IERS Table for given dates.\n\n        Parameters\n        ----------\n        jd1 : float, array of float, or `~astropy.time.Time` object\n            first part of two-part JD, or Time object\n        jd2 : float or float array, optional\n            second part of two-part JD.\n            Default is 0., ignored if jd1 is `~astropy.time.Time`.\n        return_status : bool\n            Whether to return status values.  If False (default),\n            raise ``IERSRangeError`` if any time is out of the range covered\n            by the IERS table.\n\n        Returns\n        -------\n        ut1_utc : float or float array\n            UT1-UTC, interpolated in IERS Table\n        status : int or int array\n            Status values (if ``return_status``=``True``)::\n            ``iers.FROM_IERS_B``\n            ``iers.FROM_IERS_A``\n            ``iers.FROM_IERS_A_PREDICTION``\n            ``iers.TIME_BEFORE_IERS_RANGE``\n            ``iers.TIME_BEYOND_IERS_RANGE``\n        \"\"\"\n        return self._interpolate(jd1, jd2, ['UT1_UTC'],\n                                 self.ut1_utc_source if return_status else None)\n\n    def dcip_xy(self, jd1, jd2=0., return_status=False):\n        \"\"\"Interpolate CIP corrections in IERS Table for given dates.\n\n        Parameters\n        ----------\n        jd1 : float, array of float, or `~astropy.time.Time` object\n            first part of two-part JD, or Time object\n        jd2 : float or float array, optional\n            second part of two-part JD (default 0., ignored if jd1 is Time)\n        return_status : bool\n            Whether to return status values.  If False (default),\n            raise ``IERSRangeError`` if any time is out of the range covered\n            by the IERS table.\n\n        Returns\n        -------\n        D_x : `~astropy.units.Quantity` ['angle']\n            x component of CIP correction for the requested times.\n        D_y : `~astropy.units.Quantity` ['angle']\n            y component of CIP correction for the requested times\n        status : int or int array\n            Status values (if ``return_status``=``True``)::\n            ``iers.FROM_IERS_B``\n            ``iers.FROM_IERS_A``\n            ``iers.FROM_IERS_A_PREDICTION``\n            ``iers.TIME_BEFORE_IERS_RANGE``\n            ``iers.TIME_BEYOND_IERS_RANGE``\n        \"\"\"\n        return self._interpolate(jd1, jd2, ['dX_2000A', 'dY_2000A'],\n                                 self.dcip_source if return_status else None)\n\n    def pm_xy(self, jd1, jd2=0., return_status=False):\n        \"\"\"Interpolate polar motions from IERS Table for given dates.\n\n        Parameters\n        ----------\n        jd1 : float, array of float, or `~astropy.time.Time` object\n            first part of two-part JD, or Time object\n        jd2 : float or float array, optional\n            second part of two-part JD.\n            Default is 0., ignored if jd1 is `~astropy.time.Time`.\n        return_status : bool\n            Whether to return status values.  If False (default),\n            raise ``IERSRangeError`` if any time is out of the range covered\n            by the IERS table.\n\n        Returns\n        -------\n        PM_x : `~astropy.units.Quantity` ['angle']\n            x component of polar motion for the requested times.\n        PM_y : `~astropy.units.Quantity` ['angle']\n            y component of polar motion for the requested times.\n        status : int or int array\n            Status values (if ``return_status``=``True``)::\n            ``iers.FROM_IERS_B``\n            ``iers.FROM_IERS_A``\n            ``iers.FROM_IERS_A_PREDICTION``\n            ``iers.TIME_BEFORE_IERS_RANGE``\n            ``iers.TIME_BEYOND_IERS_RANGE``\n        \"\"\"\n        return self._interpolate(jd1, jd2, ['PM_x', 'PM_y'],\n                                 self.pm_source if return_status else None)\n\n    def _check_interpolate_indices(self, indices_orig, indices_clipped, max_input_mjd):\n        \"\"\"\n        Check that the indices from interpolation match those after clipping\n        to the valid table range.  This method gets overridden in the IERS_Auto\n        class because it has different requirements.\n        \"\"\"\n        if np.any(indices_orig != indices_clipped):\n            raise IERSRangeError('(some) times are outside of range covered '\n                                 'by IERS table.')\n\n    def _interpolate(self, jd1, jd2, columns, source=None):\n        mjd, utc = self.mjd_utc(jd1, jd2)\n        # enforce array\n        is_scalar = not hasattr(mjd, '__array__') or mjd.ndim == 0\n        if is_scalar:\n            mjd = np.array([mjd])\n            utc = np.array([utc])\n        elif mjd.size == 0:\n            # Short-cut empty input.\n            return np.array([])\n\n        self._refresh_table_as_needed(mjd)\n\n        # For typical format, will always find a match (since MJD are integer)\n        # hence, important to define which side we will be; this ensures\n        # self['MJD'][i-1]<=mjd<self['MJD'][i]\n        i = np.searchsorted(self['MJD'].value, mjd, side='right')\n\n        # Get index to MJD at or just below given mjd, clipping to ensure we\n        # stay in range of table (status will be set below for those outside)\n        i1 = np.clip(i, 1, len(self) - 1)\n        i0 = i1 - 1\n        mjd_0, mjd_1 = self['MJD'][i0].value, self['MJD'][i1].value\n        results = []\n        for column in columns:\n            val_0, val_1 = self[column][i0], self[column][i1]\n            d_val = val_1 - val_0\n            if column == 'UT1_UTC':\n                # Check & correct for possible leap second (correcting diff.,\n                # not 1st point, since jump can only happen right at 2nd point)\n                d_val -= d_val.round()\n            # Linearly interpolate (which is what TEMPO does for UT1-UTC, but\n            # may want to follow IERS gazette #13 for more precise\n            # interpolation and correction for tidal effects;\n            # https://maia.usno.navy.mil/iers-gaz13)\n            val = val_0 + (mjd - mjd_0 + utc) / (mjd_1 - mjd_0) * d_val\n\n            # Do not extrapolate outside range, instead just propagate last values.\n            val[i == 0] = self[column][0]\n            val[i == len(self)] = self[column][-1]\n\n            if is_scalar:\n                val = val[0]\n\n            results.append(val)\n\n        if source:\n            # Set status to source, using the routine passed in.\n            status = source(i1)\n            # Check for out of range\n            status[i == 0] = TIME_BEFORE_IERS_RANGE\n            status[i == len(self)] = TIME_BEYOND_IERS_RANGE\n            if is_scalar:\n                status = status[0]\n            results.append(status)\n            return results\n        else:\n            self._check_interpolate_indices(i1, i, np.max(mjd))\n            return results[0] if len(results) == 1 else results\n\n    def _refresh_table_as_needed(self, mjd):\n        \"\"\"\n        Potentially update the IERS table in place depending on the requested\n        time values in ``mdj`` and the time span of the table.  The base behavior\n        is not to update the table.  ``IERS_Auto`` overrides this method.\n        \"\"\"\n        pass\n\n    def ut1_utc_source(self, i):\n        \"\"\"Source for UT1-UTC.  To be overridden by subclass.\"\"\"\n        return np.zeros_like(i)\n\n    def dcip_source(self, i):\n        \"\"\"Source for CIP correction.  To be overridden by subclass.\"\"\"\n        return np.zeros_like(i)\n\n    def pm_source(self, i):\n        \"\"\"Source for polar motion.  To be overridden by subclass.\"\"\"\n        return np.zeros_like(i)\n\n    @property\n    def time_now(self):\n        \"\"\"\n        Property to provide the current time, but also allow for explicitly setting\n        the _time_now attribute for testing purposes.\n        \"\"\"\n        try:\n            return self._time_now\n        except Exception:\n            return Time.now()\n\n    def _convert_col_for_table(self, col):\n        # Fill masked columns with units to avoid dropped-mask warnings\n        # when converting to Quantity.\n        # TODO: Once we support masked quantities, we can drop this and\n        # in the code below replace b_bad with table['UT1_UTC_B'].mask, etc.\n        if (getattr(col, 'unit', None) is not None and\n                isinstance(col, MaskedColumn)):\n            col = col.filled(np.nan)\n\n        return super()._convert_col_for_table(col)"},{"attributeType":"null","col":12,"comment":"null","endLoc":884,"id":10972,"name":"_iter","nodeType":"Attribute","startLoc":884,"text":"self._iter"},{"col":4,"comment":"Open an IERS table, reading it from a file if not loaded before.\n\n        Parameters\n        ----------\n        file : str or None\n            full local or network path to the ascii file holding IERS data,\n            for passing on to the ``read`` class methods (further optional\n            arguments that are available for some IERS subclasses can be added).\n            If None, use the default location from the ``read`` class method.\n        cache : bool\n            Whether to use cache. Defaults to False, since IERS files\n            are regularly updated.\n\n        Returns\n        -------\n        IERS\n            An IERS table class instance\n\n        Notes\n        -----\n        On the first call in a session, the table will be memoized (in the\n        ``iers_table`` class attribute), and further calls to ``open`` will\n        return this stored table if ``file=None`` (the default).\n\n        If a table needs to be re-read from disk, pass on an explicit file\n        location or use the (sub-class) close method and re-open.\n\n        If the location is a network location it is first downloaded via\n        download_file.\n\n        For the IERS class itself, an IERS_B sub-class instance is opened.\n\n        ","endLoc":216,"header":"@classmethod\n    def open(cls, file=None, cache=False, **kwargs)","id":10973,"name":"open","nodeType":"Function","startLoc":165,"text":"@classmethod\n    def open(cls, file=None, cache=False, **kwargs):\n        \"\"\"Open an IERS table, reading it from a file if not loaded before.\n\n        Parameters\n        ----------\n        file : str or None\n            full local or network path to the ascii file holding IERS data,\n            for passing on to the ``read`` class methods (further optional\n            arguments that are available for some IERS subclasses can be added).\n            If None, use the default location from the ``read`` class method.\n        cache : bool\n            Whether to use cache. Defaults to False, since IERS files\n            are regularly updated.\n\n        Returns\n        -------\n        IERS\n            An IERS table class instance\n\n        Notes\n        -----\n        On the first call in a session, the table will be memoized (in the\n        ``iers_table`` class attribute), and further calls to ``open`` will\n        return this stored table if ``file=None`` (the default).\n\n        If a table needs to be re-read from disk, pass on an explicit file\n        location or use the (sub-class) close method and re-open.\n\n        If the location is a network location it is first downloaded via\n        download_file.\n\n        For the IERS class itself, an IERS_B sub-class instance is opened.\n\n        \"\"\"\n        if file is not None or cls.iers_table is None:\n            if file is not None:\n                if urlparse(file).netloc:\n                    kwargs.update(file=download_file(file, cache=cache))\n                else:\n                    kwargs.update(file=file)\n\n            # TODO: the below is really ugly and probably a bad idea.  Instead,\n            # there should probably be an IERSBase class, which provides\n            # useful methods but cannot really be used on its own, and then\n            # *perhaps* an IERS class which provides best defaults.  But for\n            # backwards compatibility, we use the IERS_B reader for IERS here.\n            if cls is IERS:\n                cls.iers_table = IERS_B.read(**kwargs)\n            else:\n                cls.iers_table = cls.read(**kwargs)\n        return cls.iers_table"},{"col":0,"comment":"null","endLoc":1018,"header":"@function_helper(module=np.linalg)\ndef lstsq(a, b, rcond=\"warn\")","id":10974,"name":"lstsq","nodeType":"Function","startLoc":1010,"text":"@function_helper(module=np.linalg)\ndef lstsq(a, b, rcond=\"warn\"):\n    a, b = _as_quantities(a, b)\n\n    if rcond not in (None, \"warn\", -1):\n        rcond = _interpret_tol(rcond, a.unit)\n\n    return ((a.view(np.ndarray), b.view(np.ndarray), rcond), {},\n            (b.unit / a.unit, b.unit ** 2, None, a.unit), None)"},{"className":"ConfigItem","col":0,"comment":"\n    A setting and associated value stored in a configuration file.\n\n    These objects should be created as members of\n    `ConfigNamespace` subclasses, for example::\n\n        class _Conf(config.ConfigNamespace):\n            unicode_output = config.ConfigItem(\n                False,\n                'Use Unicode characters when outputting values, and writing widgets '\n                'to the console.')\n        conf = _Conf()\n\n    Parameters\n    ----------\n    defaultvalue : object, optional\n        The default value for this item. If this is a list of strings, this\n        item will be interpreted as an 'options' value - this item must be one\n        of those values, and the first in the list will be taken as the default\n        value.\n\n    description : str or None, optional\n        A description of this item (will be shown as a comment in the\n        configuration file)\n\n    cfgtype : str or None, optional\n        A type specifier like those used as the *values* of a particular key\n        in a ``configspec`` file of ``configobj``. If None, the type will be\n        inferred from the default value.\n\n    module : str or None, optional\n        The full module name that this item is associated with. The first\n        element (e.g. 'astropy' if this is 'astropy.config.configuration')\n        will be used to determine the name of the configuration file, while\n        the remaining items determine the section. If None, the package will be\n        inferred from the package within which this object's initializer is\n        called.\n\n    aliases : str, or list of str, optional\n        The deprecated location(s) of this configuration item.  If the\n        config item is not found at the new location, it will be\n        searched for at all of the old locations.\n\n    Raises\n    ------\n    RuntimeError\n        If ``module`` is `None`, but the module this item is created from\n        cannot be determined.\n    ","endLoc":485,"id":10975,"nodeType":"Class","startLoc":185,"text":"class ConfigItem:\n    \"\"\"\n    A setting and associated value stored in a configuration file.\n\n    These objects should be created as members of\n    `ConfigNamespace` subclasses, for example::\n\n        class _Conf(config.ConfigNamespace):\n            unicode_output = config.ConfigItem(\n                False,\n                'Use Unicode characters when outputting values, and writing widgets '\n                'to the console.')\n        conf = _Conf()\n\n    Parameters\n    ----------\n    defaultvalue : object, optional\n        The default value for this item. If this is a list of strings, this\n        item will be interpreted as an 'options' value - this item must be one\n        of those values, and the first in the list will be taken as the default\n        value.\n\n    description : str or None, optional\n        A description of this item (will be shown as a comment in the\n        configuration file)\n\n    cfgtype : str or None, optional\n        A type specifier like those used as the *values* of a particular key\n        in a ``configspec`` file of ``configobj``. If None, the type will be\n        inferred from the default value.\n\n    module : str or None, optional\n        The full module name that this item is associated with. The first\n        element (e.g. 'astropy' if this is 'astropy.config.configuration')\n        will be used to determine the name of the configuration file, while\n        the remaining items determine the section. If None, the package will be\n        inferred from the package within which this object's initializer is\n        called.\n\n    aliases : str, or list of str, optional\n        The deprecated location(s) of this configuration item.  If the\n        config item is not found at the new location, it will be\n        searched for at all of the old locations.\n\n    Raises\n    ------\n    RuntimeError\n        If ``module`` is `None`, but the module this item is created from\n        cannot be determined.\n    \"\"\"\n\n    # this is used to make validation faster so a Validator object doesn't\n    # have to be created every time\n    _validator = validate.Validator()\n    cfgtype = None\n    \"\"\"\n    A type specifier like those used as the *values* of a particular key in a\n    ``configspec`` file of ``configobj``.\n    \"\"\"\n\n    rootname = 'astropy'\n    \"\"\"\n    Rootname sets the base path for all config files.\n    \"\"\"\n\n    def __init__(self, defaultvalue='', description=None, cfgtype=None,\n                 module=None, aliases=None):\n        from astropy.utils import isiterable\n\n        if module is None:\n            module = find_current_module(2)\n            if module is None:\n                msg1 = 'Cannot automatically determine get_config module, '\n                msg2 = 'because it is not called from inside a valid module'\n                raise RuntimeError(msg1 + msg2)\n            else:\n                module = module.__name__\n\n        self.module = module\n        self.description = description\n        self.__doc__ = description\n\n        # now determine cfgtype if it is not given\n        if cfgtype is None:\n            if (isiterable(defaultvalue) and not\n                    isinstance(defaultvalue, str)):\n                # it is an options list\n                dvstr = [str(v) for v in defaultvalue]\n                cfgtype = 'option(' + ', '.join(dvstr) + ')'\n                defaultvalue = dvstr[0]\n            elif isinstance(defaultvalue, bool):\n                cfgtype = 'boolean'\n            elif isinstance(defaultvalue, int):\n                cfgtype = 'integer'\n            elif isinstance(defaultvalue, float):\n                cfgtype = 'float'\n            elif isinstance(defaultvalue, str):\n                cfgtype = 'string'\n                defaultvalue = str(defaultvalue)\n\n        self.cfgtype = cfgtype\n\n        self._validate_val(defaultvalue)\n        self.defaultvalue = defaultvalue\n\n        if aliases is None:\n            self.aliases = []\n        elif isinstance(aliases, str):\n            self.aliases = [aliases]\n        else:\n            self.aliases = aliases\n\n    def __set__(self, obj, value):\n        return self.set(value)\n\n    def __get__(self, obj, objtype=None):\n        if obj is None:\n            return self\n        return self()\n\n    def set(self, value):\n        \"\"\"\n        Sets the current value of this ``ConfigItem``.\n\n        This also updates the comments that give the description and type\n        information.\n\n        Parameters\n        ----------\n        value\n            The value this item should be set to.\n\n        Raises\n        ------\n        TypeError\n            If the provided ``value`` is not valid for this ``ConfigItem``.\n        \"\"\"\n        try:\n            value = self._validate_val(value)\n        except validate.ValidateError as e:\n            msg = 'Provided value for configuration item {0} not valid: {1}'\n            raise TypeError(msg.format(self.name, e.args[0]))\n\n        sec = get_config(self.module, rootname=self.rootname)\n\n        sec[self.name] = value\n\n    @contextmanager\n    def set_temp(self, value):\n        \"\"\"\n        Sets this item to a specified value only inside a with block.\n\n        Use as::\n\n            ITEM = ConfigItem('ITEM', 'default', 'description')\n\n            with ITEM.set_temp('newval'):\n                #... do something that wants ITEM's value to be 'newval' ...\n                print(ITEM)\n\n            # ITEM is now 'default' after the with block\n\n        Parameters\n        ----------\n        value\n            The value to set this item to inside the with block.\n\n        \"\"\"\n        initval = self()\n        self.set(value)\n        try:\n            yield\n        finally:\n            self.set(initval)\n\n    def reload(self):\n        \"\"\" Reloads the value of this ``ConfigItem`` from the relevant\n        configuration file.\n\n        Returns\n        -------\n        val : object\n            The new value loaded from the configuration file.\n\n        \"\"\"\n        self.set(self.defaultvalue)\n        baseobj = get_config(self.module, True, rootname=self.rootname)\n        secname = baseobj.name\n\n        cobj = baseobj\n        # a ConfigObj's parent is itself, so we look for the parent with that\n        while cobj.parent is not cobj:\n            cobj = cobj.parent\n\n        newobj = configobj.ConfigObj(cobj.filename, interpolation=False)\n        if secname is not None:\n            if secname not in newobj:\n                return baseobj.get(self.name)\n            newobj = newobj[secname]\n\n        if self.name in newobj:\n            baseobj[self.name] = newobj[self.name]\n        return baseobj.get(self.name)\n\n    def __repr__(self):\n        out = '<{}: name={!r} value={!r} at 0x{:x}>'.format(\n            self.__class__.__name__, self.name, self(), id(self))\n        return out\n\n    def __str__(self):\n        out = '\\n'.join(('{0}: {1}',\n                         '  cfgtype={2!r}',\n                         '  defaultvalue={3!r}',\n                         '  description={4!r}',\n                         '  module={5}',\n                         '  value={6!r}'))\n        out = out.format(self.__class__.__name__, self.name, self.cfgtype,\n                         self.defaultvalue, self.description, self.module,\n                         self())\n        return out\n\n    def __call__(self):\n        \"\"\" Returns the value of this ``ConfigItem``\n\n        Returns\n        -------\n        val : object\n            This item's value, with a type determined by the ``cfgtype``\n            attribute.\n\n        Raises\n        ------\n        TypeError\n            If the configuration value as stored is not this item's type.\n\n        \"\"\"\n        def section_name(section):\n            if section == '':\n                return 'at the top-level'\n            else:\n                return f'in section [{section}]'\n\n        options = []\n        sec = get_config(self.module, rootname=self.rootname)\n        if self.name in sec:\n            options.append((sec[self.name], self.module, self.name))\n\n        for alias in self.aliases:\n            module, name = alias.rsplit('.', 1)\n            sec = get_config(module, rootname=self.rootname)\n            if '.' in module:\n                filename, module = module.split('.', 1)\n            else:\n                filename = module\n                module = ''\n            if name in sec:\n                if '.' in self.module:\n                    new_module = self.module.split('.', 1)[1]\n                else:\n                    new_module = ''\n                warn(\n                    \"Config parameter '{}' {} of the file '{}' \"\n                    \"is deprecated. Use '{}' {} instead.\".format(\n                        name, section_name(module), get_config_filename(filename,\n                                                                        rootname=self.rootname),\n                        self.name, section_name(new_module)),\n                    AstropyDeprecationWarning)\n                options.append((sec[name], module, name))\n\n        if len(options) == 0:\n            self.set(self.defaultvalue)\n            options.append((self.defaultvalue, None, None))\n\n        if len(options) > 1:\n            filename, sec = self.module.split('.', 1)\n            warn(\n                \"Config parameter '{}' {} of the file '{}' is \"\n                \"given by more than one alias ({}). Using the first.\".format(\n                    self.name, section_name(sec), get_config_filename(filename,\n                                                                      rootname=self.rootname),\n                    ', '.join([\n                        '.'.join(x[1:3]) for x in options if x[1] is not None])),\n                AstropyDeprecationWarning)\n\n        val = options[0][0]\n\n        try:\n            return self._validate_val(val)\n        except validate.ValidateError as e:\n            raise TypeError('Configuration value not valid:' + e.args[0])\n\n    def _validate_val(self, val):\n        \"\"\" Validates the provided value based on cfgtype and returns the\n        type-cast value\n\n        throws the underlying configobj exception if it fails\n        \"\"\"\n        # note that this will normally use the *class* attribute `_validator`,\n        # but if some arcane reason is needed for making a special one for an\n        # instance or sub-class, it will be used\n        return self._validator.check(self.cfgtype, val)"},{"col":4,"comment":"null","endLoc":295,"header":"def __init__(self, defaultvalue='', description=None, cfgtype=None,\n                 module=None, aliases=None)","id":10976,"name":"__init__","nodeType":"Function","startLoc":250,"text":"def __init__(self, defaultvalue='', description=None, cfgtype=None,\n                 module=None, aliases=None):\n        from astropy.utils import isiterable\n\n        if module is None:\n            module = find_current_module(2)\n            if module is None:\n                msg1 = 'Cannot automatically determine get_config module, '\n                msg2 = 'because it is not called from inside a valid module'\n                raise RuntimeError(msg1 + msg2)\n            else:\n                module = module.__name__\n\n        self.module = module\n        self.description = description\n        self.__doc__ = description\n\n        # now determine cfgtype if it is not given\n        if cfgtype is None:\n            if (isiterable(defaultvalue) and not\n                    isinstance(defaultvalue, str)):\n                # it is an options list\n                dvstr = [str(v) for v in defaultvalue]\n                cfgtype = 'option(' + ', '.join(dvstr) + ')'\n                defaultvalue = dvstr[0]\n            elif isinstance(defaultvalue, bool):\n                cfgtype = 'boolean'\n            elif isinstance(defaultvalue, int):\n                cfgtype = 'integer'\n            elif isinstance(defaultvalue, float):\n                cfgtype = 'float'\n            elif isinstance(defaultvalue, str):\n                cfgtype = 'string'\n                defaultvalue = str(defaultvalue)\n\n        self.cfgtype = cfgtype\n\n        self._validate_val(defaultvalue)\n        self.defaultvalue = defaultvalue\n\n        if aliases is None:\n            self.aliases = []\n        elif isinstance(aliases, str):\n            self.aliases = [aliases]\n        else:\n            self.aliases = aliases"},{"attributeType":"null","col":8,"comment":"null","endLoc":868,"id":10977,"name":"_msg","nodeType":"Attribute","startLoc":868,"text":"self._msg"},{"attributeType":"null","col":8,"comment":"null","endLoc":877,"id":10978,"name":"_chars","nodeType":"Attribute","startLoc":877,"text":"self._chars"},{"col":4,"comment":"Read IERS-B table from a eopc04_iau2000.* file provided by IERS.\n\n        Parameters\n        ----------\n        file : str\n            full path to ascii file holding IERS-B data.\n            Defaults to package version, ``iers.IERS_B_FILE``.\n        readme : str\n            full path to ascii file holding CDS-style readme.\n            Defaults to package version, ``iers.IERS_B_README``.\n        data_start : int\n            starting row. Default is 14, appropriate for standard IERS files.\n\n        Returns\n        -------\n        ``IERS_B`` class instance\n        ","endLoc":623,"header":"@classmethod\n    def read(cls, file=None, readme=None, data_start=14)","id":10979,"name":"read","nodeType":"Function","startLoc":594,"text":"@classmethod\n    def read(cls, file=None, readme=None, data_start=14):\n        \"\"\"Read IERS-B table from a eopc04_iau2000.* file provided by IERS.\n\n        Parameters\n        ----------\n        file : str\n            full path to ascii file holding IERS-B data.\n            Defaults to package version, ``iers.IERS_B_FILE``.\n        readme : str\n            full path to ascii file holding CDS-style readme.\n            Defaults to package version, ``iers.IERS_B_README``.\n        data_start : int\n            starting row. Default is 14, appropriate for standard IERS files.\n\n        Returns\n        -------\n        ``IERS_B`` class instance\n        \"\"\"\n        if file is None:\n            file = IERS_B_FILE\n        if readme is None:\n            readme = IERS_B_README\n\n        table = super().read(file, format='cds', readme=readme,\n                             data_start=data_start)\n\n        table.meta['data_path'] = file\n        table.meta['readme_path'] = readme\n        return table"},{"className":"MaskedFormat","col":0,"comment":"Formatter for masked array scalars.\n\n    For use in `numpy.array2string`, wrapping the regular formatters such\n    that if a value is masked, its formatted string is replaced.\n\n    Typically initialized using the ``from_data`` class method.\n    ","endLoc":891,"id":10980,"nodeType":"Class","startLoc":853,"text":"class MaskedFormat:\n    \"\"\"Formatter for masked array scalars.\n\n    For use in `numpy.array2string`, wrapping the regular formatters such\n    that if a value is masked, its formatted string is replaced.\n\n    Typically initialized using the ``from_data`` class method.\n    \"\"\"\n    def __init__(self, format_function):\n        self.format_function = format_function\n        # Special case for structured void: we need to make all the\n        # format functions for the items masked as well.\n        # TODO: maybe is a separate class is more logical?\n        ffs = getattr(format_function, 'format_functions', None)\n        if ffs:\n            self.format_function.format_functions = [MaskedFormat(ff) for ff in ffs]\n\n    def __call__(self, x):\n        if x.dtype.names:\n            # The replacement of x with a list is needed because the function\n            # inside StructuredVoidFormat iterates over x, which works for an\n            # np.void but not an array scalar.\n            return self.format_function([x[field] for field in x.dtype.names])\n\n        string = self.format_function(x.unmasked[()])\n        if x.mask:\n            # Strikethrough would be neat, but terminal needs a different\n            # formatting than, say, jupyter notebook.\n            # return \"\\x1B[9m\"+string+\"\\x1B[29m\"\n            # return ''.join(s+'\\u0336' for s in string)\n            n = min(3, max(1, len(string)))\n            return ' ' * (len(string)-n) + '\\u2014' * n\n        else:\n            return string\n\n    @classmethod\n    def from_data(cls, data, **options):\n        from numpy.core.arrayprint import _get_format_function\n        return cls(_get_format_function(data, **options))"},{"col":4,"comment":"null","endLoc":868,"header":"def __init__(self, format_function)","id":10981,"name":"__init__","nodeType":"Function","startLoc":861,"text":"def __init__(self, format_function):\n        self.format_function = format_function\n        # Special case for structured void: we need to make all the\n        # format functions for the items masked as well.\n        # TODO: maybe is a separate class is more logical?\n        ffs = getattr(format_function, 'format_functions', None)\n        if ffs:\n            self.format_function.format_functions = [MaskedFormat(ff) for ff in ffs]"},{"attributeType":"null","col":0,"comment":"Dict of functions that should apply to both data and mask.\n\nThe `dict` is keyed by the numpy function and the values are functions\nthat take the input arguments of the numpy function and organize these\nfor passing the data and mask to the numpy function.\n\nReturns\n-------\ndata_args : tuple\n    Arguments to pass on to the numpy function for the unmasked data.\nmask_args : tuple\n    Arguments to pass on to the numpy function for the masked data.\nkwargs : dict\n    Keyword arguments to pass on for both unmasked data and mask.\nout : `~astropy.utils.masked.Masked` instance or None\n    Optional instance in which to store the output.\n\nRaises\n------\nNotImplementedError\n   When an arguments is masked when it should not be or vice versa.\n","endLoc":32,"id":10982,"name":"APPLY_TO_BOTH_FUNCTIONS","nodeType":"Attribute","startLoc":32,"text":"APPLY_TO_BOTH_FUNCTIONS"},{"col":4,"comment":"Remove the IERS table from the class.\n\n        This allows the table to be re-read from disk during one's session\n        (e.g., if one finds it is out of date and has updated the file).\n        ","endLoc":225,"header":"@classmethod\n    def close(cls)","id":10983,"name":"close","nodeType":"Function","startLoc":218,"text":"@classmethod\n    def close(cls):\n        \"\"\"Remove the IERS table from the class.\n\n        This allows the table to be re-read from disk during one's session\n        (e.g., if one finds it is out of date and has updated the file).\n        \"\"\"\n        cls.iers_table = None"},{"col":4,"comment":"Turn a time to MJD, returning integer and fractional parts.\n\n        Parameters\n        ----------\n        jd1 : float, array, or `~astropy.time.Time`\n            first part of two-part JD, or Time object\n        jd2 : float or array, optional\n            second part of two-part JD.\n            Default is 0., ignored if jd1 is `~astropy.time.Time`.\n\n        Returns\n        -------\n        mjd : float or array\n            integer part of MJD\n        utc : float or array\n            fractional part of MJD\n        ","endLoc":252,"header":"def mjd_utc(self, jd1, jd2=0.)","id":10984,"name":"mjd_utc","nodeType":"Function","startLoc":227,"text":"def mjd_utc(self, jd1, jd2=0.):\n        \"\"\"Turn a time to MJD, returning integer and fractional parts.\n\n        Parameters\n        ----------\n        jd1 : float, array, or `~astropy.time.Time`\n            first part of two-part JD, or Time object\n        jd2 : float or array, optional\n            second part of two-part JD.\n            Default is 0., ignored if jd1 is `~astropy.time.Time`.\n\n        Returns\n        -------\n        mjd : float or array\n            integer part of MJD\n        utc : float or array\n            fractional part of MJD\n        \"\"\"\n        try:  # see if this is a Time object\n            jd1, jd2 = jd1.utc.jd1, jd1.utc.jd2\n        except Exception:\n            pass\n\n        mjd = np.floor(jd1 - MJD_ZERO + jd2)\n        utc = jd1 - (MJD_ZERO+mjd) + jd2\n        return mjd, utc"},{"attributeType":"null","col":0,"comment":"Dict of functions that provide the numpy function's functionality.\n\nThese are for more complicated versions where the numpy function itself\ncannot easily be used.  It should return either the result of the\nfunction, or a tuple consisting of the unmasked result, the mask for the\nresult and a possible output instance.\n\nIt should raise `NotImplementedError` if one of the arguments is masked\nwhen it should not be or vice versa.\n","endLoc":56,"id":10985,"name":"DISPATCHED_FUNCTIONS","nodeType":"Attribute","startLoc":56,"text":"DISPATCHED_FUNCTIONS"},{"attributeType":"null","col":0,"comment":"Set of numpy functions that are not supported for masked arrays.\n\nFor most, masked input simply makes no sense, but for others it may have\nbeen lack of time.  Issues or PRs for support for functions are welcome.\n","endLoc":68,"id":10986,"name":"UNSUPPORTED_FUNCTIONS","nodeType":"Attribute","startLoc":68,"text":"UNSUPPORTED_FUNCTIONS"},{"col":4,"comment":"Interpolate UT1-UTC corrections in IERS Table for given dates.\n\n        Parameters\n        ----------\n        jd1 : float, array of float, or `~astropy.time.Time` object\n            first part of two-part JD, or Time object\n        jd2 : float or float array, optional\n            second part of two-part JD.\n            Default is 0., ignored if jd1 is `~astropy.time.Time`.\n        return_status : bool\n            Whether to return status values.  If False (default),\n            raise ``IERSRangeError`` if any time is out of the range covered\n            by the IERS table.\n\n        Returns\n        -------\n        ut1_utc : float or float array\n            UT1-UTC, interpolated in IERS Table\n        status : int or int array\n            Status values (if ``return_status``=``True``)::\n            ``iers.FROM_IERS_B``\n            ``iers.FROM_IERS_A``\n            ``iers.FROM_IERS_A_PREDICTION``\n            ``iers.TIME_BEFORE_IERS_RANGE``\n            ``iers.TIME_BEYOND_IERS_RANGE``\n        ","endLoc":282,"header":"def ut1_utc(self, jd1, jd2=0., return_status=False)","id":10987,"name":"ut1_utc","nodeType":"Function","startLoc":254,"text":"def ut1_utc(self, jd1, jd2=0., return_status=False):\n        \"\"\"Interpolate UT1-UTC corrections in IERS Table for given dates.\n\n        Parameters\n        ----------\n        jd1 : float, array of float, or `~astropy.time.Time` object\n            first part of two-part JD, or Time object\n        jd2 : float or float array, optional\n            second part of two-part JD.\n            Default is 0., ignored if jd1 is `~astropy.time.Time`.\n        return_status : bool\n            Whether to return status values.  If False (default),\n            raise ``IERSRangeError`` if any time is out of the range covered\n            by the IERS table.\n\n        Returns\n        -------\n        ut1_utc : float or float array\n            UT1-UTC, interpolated in IERS Table\n        status : int or int array\n            Status values (if ``return_status``=``True``)::\n            ``iers.FROM_IERS_B``\n            ``iers.FROM_IERS_A``\n            ``iers.FROM_IERS_A_PREDICTION``\n            ``iers.TIME_BEFORE_IERS_RANGE``\n            ``iers.TIME_BEYOND_IERS_RANGE``\n        \"\"\"\n        return self._interpolate(jd1, jd2, ['UT1_UTC'],\n                                 self.ut1_utc_source if return_status else None)"},{"className":"MaskedInfoBase","col":0,"comment":"null","endLoc":307,"id":10988,"nodeType":"Class","startLoc":293,"text":"class MaskedInfoBase:\n    mask_val = np.ma.masked\n\n    def __init__(self, bound=False):\n        super().__init__(bound)\n\n        # If bound to a data object instance then create the dict of attributes\n        # which stores the info attribute values.\n        if bound:\n            # Specify how to serialize this object depending on context.\n            self.serialize_method = {'fits': 'null_value',\n                                     'ecsv': 'null_value',\n                                     'hdf5': 'data_mask',\n                                     'parquet': 'data_mask',\n                                     None: 'null_value'}"},{"col":4,"comment":"null","endLoc":307,"header":"def __init__(self, bound=False)","id":10989,"name":"__init__","nodeType":"Function","startLoc":296,"text":"def __init__(self, bound=False):\n        super().__init__(bound)\n\n        # If bound to a data object instance then create the dict of attributes\n        # which stores the info attribute values.\n        if bound:\n            # Specify how to serialize this object depending on context.\n            self.serialize_method = {'fits': 'null_value',\n                                     'ecsv': 'null_value',\n                                     'hdf5': 'data_mask',\n                                     'parquet': 'data_mask',\n                                     None: 'null_value'}"},{"attributeType":"null","col":4,"comment":"null","endLoc":294,"id":10990,"name":"mask_val","nodeType":"Attribute","startLoc":294,"text":"mask_val"},{"attributeType":"null","col":12,"comment":"null","endLoc":303,"id":10991,"name":"serialize_method","nodeType":"Attribute","startLoc":303,"text":"self.serialize_method"},{"className":"ProgressBarOrSpinner","col":0,"comment":"\n    A class that displays either a `ProgressBar` or `Spinner`\n    depending on whether the total size of the operation is\n    known or not.\n\n    It is designed to be used with the ``with`` statement::\n\n        if file.has_length():\n            length = file.get_length()\n        else:\n            length = None\n        bytes_read = 0\n        with ProgressBarOrSpinner(length) as bar:\n            while file.read(blocksize):\n                bytes_read += blocksize\n                bar.update(bytes_read)\n    ","endLoc":1028,"id":10992,"nodeType":"Class","startLoc":960,"text":"class ProgressBarOrSpinner:\n    \"\"\"\n    A class that displays either a `ProgressBar` or `Spinner`\n    depending on whether the total size of the operation is\n    known or not.\n\n    It is designed to be used with the ``with`` statement::\n\n        if file.has_length():\n            length = file.get_length()\n        else:\n            length = None\n        bytes_read = 0\n        with ProgressBarOrSpinner(length) as bar:\n            while file.read(blocksize):\n                bytes_read += blocksize\n                bar.update(bytes_read)\n    \"\"\"\n\n    def __init__(self, total, msg, color='default', file=None):\n        \"\"\"\n        Parameters\n        ----------\n        total : int or None\n            If an int, the number of increments in the process being\n            tracked and a `ProgressBar` is displayed.  If `None`, a\n            `Spinner` is displayed.\n\n        msg : str\n            The message to display above the `ProgressBar` or\n            alongside the `Spinner`.\n\n        color : str, optional\n            The color of ``msg``, if any.  Must be an ANSI terminal\n            color name.  Must be one of: black, red, green, brown,\n            blue, magenta, cyan, lightgrey, default, darkgrey,\n            lightred, lightgreen, yellow, lightblue, lightmagenta,\n            lightcyan, white.\n\n        file : writable file-like, optional\n            The file to write the to.  Defaults to `sys.stdout`.  If\n            ``file`` is not a tty (as determined by calling its `isatty`\n            member, if any), only ``msg`` will be displayed: the\n            `ProgressBar` or `Spinner` will be silent.\n        \"\"\"\n\n        if file is None:\n            file = _get_stdout()\n\n        if total is None or not isatty(file):\n            self._is_spinner = True\n            self._obj = Spinner(msg, color=color, file=file)\n        else:\n            self._is_spinner = False\n            color_print(msg, color, file=file)\n            self._obj = ProgressBar(total, file=file)\n\n    def __enter__(self):\n        return self\n\n    def __exit__(self, exc_type, exc_value, traceback):\n        return self._obj.__exit__(exc_type, exc_value, traceback)\n\n    def update(self, value):\n        \"\"\"\n        Update the progress bar to the given value (out of the total\n        given to the constructor.\n        \"\"\"\n        self._obj.update(value)"},{"col":4,"comment":"null","endLoc":1018,"header":"def __enter__(self)","id":10993,"name":"__enter__","nodeType":"Function","startLoc":1017,"text":"def __enter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":1021,"header":"def __exit__(self, exc_type, exc_value, traceback)","id":10994,"name":"__exit__","nodeType":"Function","startLoc":1020,"text":"def __exit__(self, exc_type, exc_value, traceback):\n        return self._obj.__exit__(exc_type, exc_value, traceback)"},{"col":0,"comment":"null","endLoc":1029,"header":"@function_helper(module=np.linalg)\ndef norm(x, ord=None, *args, **kwargs)","id":10995,"name":"norm","nodeType":"Function","startLoc":1021,"text":"@function_helper(module=np.linalg)\ndef norm(x, ord=None, *args, **kwargs):\n    if ord == 0:\n        from astropy.units import dimensionless_unscaled\n\n        unit = dimensionless_unscaled\n    else:\n        unit = x.unit\n    return (x.view(np.ndarray), ord)+args, kwargs, unit, None"},{"col":4,"comment":"null","endLoc":886,"header":"def __call__(self, x)","id":10996,"name":"__call__","nodeType":"Function","startLoc":870,"text":"def __call__(self, x):\n        if x.dtype.names:\n            # The replacement of x with a list is needed because the function\n            # inside StructuredVoidFormat iterates over x, which works for an\n            # np.void but not an array scalar.\n            return self.format_function([x[field] for field in x.dtype.names])\n\n        string = self.format_function(x.unmasked[()])\n        if x.mask:\n            # Strikethrough would be neat, but terminal needs a different\n            # formatting than, say, jupyter notebook.\n            # return \"\\x1B[9m\"+string+\"\\x1B[29m\"\n            # return ''.join(s+'\\u0336' for s in string)\n            n = min(3, max(1, len(string)))\n            return ' ' * (len(string)-n) + '\\u2014' * n\n        else:\n            return string"},{"col":0,"comment":"null","endLoc":1034,"header":"@function_helper(module=np.linalg)\ndef matrix_power(a, n)","id":10997,"name":"matrix_power","nodeType":"Function","startLoc":1032,"text":"@function_helper(module=np.linalg)\ndef matrix_power(a, n):\n    return (a.value, n), {}, a.unit ** n, None"},{"col":4,"comment":"\n        Update the progress bar to the given value (out of the total\n        given to the constructor.\n        ","endLoc":1028,"header":"def update(self, value)","id":10998,"name":"update","nodeType":"Function","startLoc":1023,"text":"def update(self, value):\n        \"\"\"\n        Update the progress bar to the given value (out of the total\n        given to the constructor.\n        \"\"\"\n        self._obj.update(value)"},{"col":0,"comment":"null","endLoc":1039,"header":"@function_helper(module=np.linalg)\ndef cholesky(a)","id":10999,"name":"cholesky","nodeType":"Function","startLoc":1037,"text":"@function_helper(module=np.linalg)\ndef cholesky(a):\n    return (a.value,), {}, a.unit ** 0.5, None"},{"attributeType":"null","col":12,"comment":"null","endLoc":1013,"id":11000,"name":"_is_spinner","nodeType":"Attribute","startLoc":1013,"text":"self._is_spinner"},{"col":0,"comment":"null","endLoc":1052,"header":"@function_helper(module=np.linalg)\ndef qr(a, mode='reduced')","id":11001,"name":"qr","nodeType":"Function","startLoc":1042,"text":"@function_helper(module=np.linalg)\ndef qr(a, mode='reduced'):\n    if mode.startswith('e'):\n        units = None\n    elif mode == 'r':\n        units = a.unit\n    else:\n        from astropy.units import dimensionless_unscaled\n        units = (dimensionless_unscaled, a.unit)\n\n    return (a.value, mode), {}, units, None"},{"attributeType":"ProgressBar","col":12,"comment":"null","endLoc":1015,"id":11002,"name":"_obj","nodeType":"Attribute","startLoc":1015,"text":"self._obj"},{"className":"_GetchUnix","col":0,"comment":"null","endLoc":1156,"id":11003,"nodeType":"Class","startLoc":1136,"text":"class _GetchUnix:\n    def __init__(self):\n        import tty  # pylint: disable=W0611\n        import sys  # pylint: disable=W0611\n\n        # import termios now or else you'll get the Unix\n        # version on the Mac\n        import termios  # pylint: disable=W0611\n\n    def __call__(self):\n        import sys\n        import tty\n        import termios\n        fd = sys.stdin.fileno()\n        old_settings = termios.tcgetattr(fd)\n        try:\n            tty.setraw(sys.stdin.fileno())\n            ch = sys.stdin.read(1)\n        finally:\n            termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)\n        return ch"},{"col":4,"comment":"null","endLoc":1156,"header":"def __call__(self)","id":11004,"name":"__call__","nodeType":"Function","startLoc":1145,"text":"def __call__(self):\n        import sys\n        import tty\n        import termios\n        fd = sys.stdin.fileno()\n        old_settings = termios.tcgetattr(fd)\n        try:\n            tty.setraw(sys.stdin.fileno())\n            ch = sys.stdin.read(1)\n        finally:\n            termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)\n        return ch"},{"col":0,"comment":"null","endLoc":1059,"header":"@function_helper(helps={np.linalg.eig, np.linalg.eigh})\ndef eig(a, *args, **kwargs)","id":11005,"name":"eig","nodeType":"Function","startLoc":1055,"text":"@function_helper(helps={np.linalg.eig, np.linalg.eigh})\ndef eig(a, *args, **kwargs):\n    from astropy.units import dimensionless_unscaled\n\n    return (a.value,)+args, kwargs, (a.unit, dimensionless_unscaled), None"},{"className":"_GetchWindows","col":0,"comment":"null","endLoc":1165,"id":11006,"nodeType":"Class","startLoc":1159,"text":"class _GetchWindows:\n    def __init__(self):\n        import msvcrt  # pylint: disable=W0611\n\n    def __call__(self):\n        import msvcrt\n        return msvcrt.getch()"},{"col":4,"comment":"null","endLoc":1165,"header":"def __call__(self)","id":11007,"name":"__call__","nodeType":"Function","startLoc":1163,"text":"def __call__(self):\n        import msvcrt\n        return msvcrt.getch()"},{"className":"_GetchMacCarbon","col":0,"comment":"\n    A function which returns the current ASCII key that is down;\n    if no ASCII key is down, the null string is returned.  The\n    page http://www.mactech.com/macintosh-c/chap02-1.html was\n    very helpful in figuring out how to do this.\n    ","endLoc":1195,"id":11008,"nodeType":"Class","startLoc":1168,"text":"class _GetchMacCarbon:\n    \"\"\"\n    A function which returns the current ASCII key that is down;\n    if no ASCII key is down, the null string is returned.  The\n    page http://www.mactech.com/macintosh-c/chap02-1.html was\n    very helpful in figuring out how to do this.\n    \"\"\"\n\n    def __init__(self):\n        import Carbon\n        Carbon.Evt  # see if it has this (in Unix, it doesn't)\n\n    def __call__(self):\n        import Carbon\n        if Carbon.Evt.EventAvail(0x0008)[0] == 0:  # 0x0008 is the keyDownMask\n            return ''\n        else:\n            #\n            # The event contains the following info:\n            # (what,msg,when,where,mod)=Carbon.Evt.GetNextEvent(0x0008)[1]\n            #\n            # The message (msg) contains the ASCII char which is\n            # extracted with the 0x000000FF charCodeMask; this\n            # number is converted to an ASCII character with chr() and\n            # returned\n            #\n            (what, msg, when, where, mod) = Carbon.Evt.GetNextEvent(0x0008)[1]\n            return chr(msg & 0x000000FF)"},{"col":4,"comment":"null","endLoc":1195,"header":"def __call__(self)","id":11009,"name":"__call__","nodeType":"Function","startLoc":1180,"text":"def __call__(self):\n        import Carbon\n        if Carbon.Evt.EventAvail(0x0008)[0] == 0:  # 0x0008 is the keyDownMask\n            return ''\n        else:\n            #\n            # The event contains the following info:\n            # (what,msg,when,where,mod)=Carbon.Evt.GetNextEvent(0x0008)[1]\n            #\n            # The message (msg) contains the ASCII char which is\n            # extracted with the 0x000000FF charCodeMask; this\n            # number is converted to an ASCII character with chr() and\n            # returned\n            #\n            (what, msg, when, where, mod) = Carbon.Evt.GetNextEvent(0x0008)[1]\n            return chr(msg & 0x000000FF)"},{"col":0,"comment":"\n    Convert a structured quantity to an unstructured one.\n    This only works if all the units are compatible.\n\n    ","endLoc":1080,"header":"@function_helper(module=np.lib.recfunctions)\ndef structured_to_unstructured(arr, *args, **kwargs)","id":11010,"name":"structured_to_unstructured","nodeType":"Function","startLoc":1062,"text":"@function_helper(module=np.lib.recfunctions)\ndef structured_to_unstructured(arr, *args, **kwargs):\n    \"\"\"\n    Convert a structured quantity to an unstructured one.\n    This only works if all the units are compatible.\n\n    \"\"\"\n    from astropy.units import StructuredUnit\n\n    target_unit = arr.unit.values()[0]\n\n    def replace_unit(x):\n        if isinstance(x, StructuredUnit):\n            return x._recursively_apply(replace_unit)\n        else:\n            return target_unit\n\n    to_unit = arr.unit._recursively_apply(replace_unit)\n    return (arr.to_value(to_unit), ) + args, kwargs, target_unit, None"},{"col":4,"comment":"null","endLoc":891,"header":"@classmethod\n    def from_data(cls, data, **options)","id":11011,"name":"from_data","nodeType":"Function","startLoc":888,"text":"@classmethod\n    def from_data(cls, data, **options):\n        from numpy.core.arrayprint import _get_format_function\n        return cls(_get_format_function(data, **options))"},{"attributeType":"null","col":8,"comment":"null","endLoc":862,"id":11012,"name":"format_function","nodeType":"Attribute","startLoc":862,"text":"self.format_function"},{"col":0,"comment":"Separate out arguments into tuples of data and masks.\n\n    An all-False mask is created if an argument does not have a mask.\n    ","endLoc":173,"header":"def _get_data_and_masks(*args)","id":11013,"name":"_get_data_and_masks","nodeType":"Function","startLoc":163,"text":"def _get_data_and_masks(*args):\n    \"\"\"Separate out arguments into tuples of data and masks.\n\n    An all-False mask is created if an argument does not have a mask.\n    \"\"\"\n    from .core import Masked\n\n    data, masks = Masked._get_data_and_masks(*args)\n    masks = tuple(m if m is not None else np.zeros(np.shape(d), bool)\n                  for d, m in zip(data, masks))\n    return data, masks"},{"col":0,"comment":"Build structured unit from dtype\n\n    Parameters\n    ----------\n    dtype : `numpy.dtype`\n    unit : `astropy.units.Unit`\n\n    Returns\n    -------\n    `astropy.units.Unit` or tuple\n    ","endLoc":1098,"header":"def _build_structured_unit(dtype, unit)","id":11014,"name":"_build_structured_unit","nodeType":"Function","startLoc":1083,"text":"def _build_structured_unit(dtype, unit):\n    \"\"\"Build structured unit from dtype\n\n    Parameters\n    ----------\n    dtype : `numpy.dtype`\n    unit : `astropy.units.Unit`\n\n    Returns\n    -------\n    `astropy.units.Unit` or tuple\n    \"\"\"\n    if dtype.fields is None:\n        return unit\n\n    return tuple(_build_structured_unit(v[0], unit) for v in dtype.fields.values())"},{"col":0,"comment":"null","endLoc":180,"header":"@dispatched_function\ndef datetime_as_string(arr, *args, **kwargs)","id":11015,"name":"datetime_as_string","nodeType":"Function","startLoc":177,"text":"@dispatched_function\ndef datetime_as_string(arr, *args, **kwargs):\n    return (np.datetime_as_string(arr.unmasked, *args, **kwargs),\n            arr.mask.copy(), None)"},{"col":0,"comment":"null","endLoc":185,"header":"@dispatched_function\ndef sinc(x)","id":11016,"name":"sinc","nodeType":"Function","startLoc":183,"text":"@dispatched_function\ndef sinc(x):\n    return np.sinc(x.unmasked), x.mask.copy(), None"},{"className":"MaskedNDArrayInfo","col":0,"comment":"\n    Container for meta information like name, description, format.\n    ","endLoc":360,"id":11017,"nodeType":"Class","startLoc":310,"text":"class MaskedNDArrayInfo(MaskedInfoBase, ParentDtypeInfo):\n    \"\"\"\n    Container for meta information like name, description, format.\n    \"\"\"\n\n    # Add `serialize_method` attribute to the attrs that MaskedNDArrayInfo knows\n    # about.  This allows customization of the way that MaskedColumn objects\n    # get written to file depending on format.  The default is to use whatever\n    # the writer would normally do, which in the case of FITS or ECSV is to use\n    # a NULL value within the data itself.  If serialize_method is 'data_mask'\n    # then the mask is explicitly written out as a separate column if there\n    # are any masked values.  This is the same as for MaskedColumn.\n    attr_names = ParentDtypeInfo.attr_names | {'serialize_method'}\n\n    # When `serialize_method` is 'data_mask', and data and mask are being written\n    # as separate columns, use column names <name> and <name>.mask (instead\n    # of default encoding as <name>.data and <name>.mask).\n    _represent_as_dict_primary_data = 'data'\n\n    def _represent_as_dict(self):\n        out = super()._represent_as_dict()\n\n        masked_array = self._parent\n\n        # If the serialize method for this context (e.g. 'fits' or 'ecsv') is\n        # 'data_mask', that means to serialize using an explicit mask column.\n        method = self.serialize_method[self._serialize_context]\n\n        if method == 'data_mask':\n            out['data'] = masked_array.unmasked\n\n            if np.any(masked_array.mask):\n                # Only if there are actually masked elements do we add the ``mask`` column\n                out['mask'] = masked_array.mask\n\n        elif method == 'null_value':\n            out['data'] = np.ma.MaskedArray(masked_array.unmasked,\n                                            mask=masked_array.mask)\n\n        else:\n            raise ValueError('serialize method must be either \"data_mask\" or \"null_value\"')\n\n        return out\n\n    def _construct_from_dict(self, map):\n        # Override usual handling, since MaskedNDArray takes shape and buffer\n        # as input, which is less useful here.\n        # The map can contain either a MaskedColumn or a Column and a mask.\n        # Extract the mask for the former case.\n        map.setdefault('mask', getattr(map['data'], 'mask', False))\n        return self._parent_cls.from_unmasked(**map)"},{"col":4,"comment":"null","endLoc":352,"header":"def _represent_as_dict(self)","id":11018,"name":"_represent_as_dict","nodeType":"Function","startLoc":329,"text":"def _represent_as_dict(self):\n        out = super()._represent_as_dict()\n\n        masked_array = self._parent\n\n        # If the serialize method for this context (e.g. 'fits' or 'ecsv') is\n        # 'data_mask', that means to serialize using an explicit mask column.\n        method = self.serialize_method[self._serialize_context]\n\n        if method == 'data_mask':\n            out['data'] = masked_array.unmasked\n\n            if np.any(masked_array.mask):\n                # Only if there are actually masked elements do we add the ``mask`` column\n                out['mask'] = masked_array.mask\n\n        elif method == 'null_value':\n            out['data'] = np.ma.MaskedArray(masked_array.unmasked,\n                                            mask=masked_array.mask)\n\n        else:\n            raise ValueError('serialize method must be either \"data_mask\" or \"null_value\"')\n\n        return out"},{"col":0,"comment":"null","endLoc":1107,"header":"@function_helper(module=np.lib.recfunctions)\ndef unstructured_to_structured(arr, dtype, *args, **kwargs)","id":11019,"name":"unstructured_to_structured","nodeType":"Function","startLoc":1101,"text":"@function_helper(module=np.lib.recfunctions)\ndef unstructured_to_structured(arr, dtype, *args, **kwargs):\n    from astropy.units import StructuredUnit\n\n    target_unit = StructuredUnit(_build_structured_unit(dtype, arr.unit))\n\n    return (arr.to_value(arr.unit), dtype) + args, kwargs, target_unit, None"},{"col":0,"comment":"null","endLoc":190,"header":"@dispatched_function\ndef iscomplex(x)","id":11020,"name":"iscomplex","nodeType":"Function","startLoc":188,"text":"@dispatched_function\ndef iscomplex(x):\n    return np.iscomplex(x.unmasked), x.mask.copy(), None"},{"col":0,"comment":"null","endLoc":195,"header":"@dispatched_function\ndef unwrap(p, *args, **kwargs)","id":11021,"name":"unwrap","nodeType":"Function","startLoc":193,"text":"@dispatched_function\ndef unwrap(p, *args, **kwargs):\n    return np.unwrap(p.unmasked, *args, **kwargs), p.mask.copy(), None"},{"col":0,"comment":"null","endLoc":202,"header":"@dispatched_function\ndef nan_to_num(x, copy=True, nan=0.0, posinf=None, neginf=None)","id":11022,"name":"nan_to_num","nodeType":"Function","startLoc":198,"text":"@dispatched_function\ndef nan_to_num(x, copy=True, nan=0.0, posinf=None, neginf=None):\n    data = np.nan_to_num(x.unmasked, copy=copy,\n                         nan=nan, posinf=posinf, neginf=neginf)\n    return (data, x.mask.copy(), None) if copy else x"},{"col":0,"comment":"null","endLoc":212,"header":"@apply_to_both(helps={\n    np.copy, np.asfarray, np.resize, np.moveaxis, np.rollaxis, np.roll})\ndef masked_a_helper(a, *args, **kwargs)","id":11023,"name":"masked_a_helper","nodeType":"Function","startLoc":208,"text":"@apply_to_both(helps={\n    np.copy, np.asfarray, np.resize, np.moveaxis, np.rollaxis, np.roll})\ndef masked_a_helper(a, *args, **kwargs):\n    data, mask = _get_data_and_masks(a)\n    return data + args, mask + args, kwargs, None"},{"col":0,"comment":"Decode the supplied byte string using the preferred encoding\n    for the locale (`locale.getpreferredencoding`) or, if the default encoding\n    is invalid, fall back first on utf-8, then on latin-1 if the message cannot\n    be decoded with utf-8.\n    ","endLoc":258,"header":"def _decode_preferred_encoding(s)","id":11024,"name":"_decode_preferred_encoding","nodeType":"Function","startLoc":243,"text":"def _decode_preferred_encoding(s):\n    \"\"\"Decode the supplied byte string using the preferred encoding\n    for the locale (`locale.getpreferredencoding`) or, if the default encoding\n    is invalid, fall back first on utf-8, then on latin-1 if the message cannot\n    be decoded with utf-8.\n    \"\"\"\n\n    enc = locale.getpreferredencoding()\n    try:\n        try:\n            return s.decode(enc)\n        except LookupError:\n            enc = _DEFAULT_ENCODING\n        return s.decode(enc)\n    except UnicodeDecodeError:\n        return s.decode('latin-1')"},{"col":4,"comment":"null","endLoc":360,"header":"def _construct_from_dict(self, map)","id":11025,"name":"_construct_from_dict","nodeType":"Function","startLoc":354,"text":"def _construct_from_dict(self, map):\n        # Override usual handling, since MaskedNDArray takes shape and buffer\n        # as input, which is less useful here.\n        # The map can contain either a MaskedColumn or a Column and a mask.\n        # Extract the mask for the former case.\n        map.setdefault('mask', getattr(map['data'], 'mask', False))\n        return self._parent_cls.from_unmasked(**map)"},{"col":0,"comment":"\n    Remove ANSI color codes from the string.\n    ","endLoc":359,"header":"def strip_ansi_codes(s)","id":11026,"name":"strip_ansi_codes","nodeType":"Function","startLoc":355,"text":"def strip_ansi_codes(s):\n    \"\"\"\n    Remove ANSI color codes from the string.\n    \"\"\"\n    return re.sub('\\033\\\\[([0-9]+)(;[0-9]+)*m', '', s)"},{"attributeType":"null","col":4,"comment":"null","endLoc":23,"id":11027,"name":"_CAN_RESIZE_TERMINAL","nodeType":"Attribute","startLoc":23,"text":"_CAN_RESIZE_TERMINAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":11028,"name":"__all__","nodeType":"Attribute","startLoc":33,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":11029,"name":"_DEFAULT_ENCODING","nodeType":"Attribute","startLoc":38,"text":"_DEFAULT_ENCODING"},{"attributeType":"null","col":0,"comment":"null","endLoc":52,"id":11030,"name":"ARRAY_FUNCTION_ENABLED","nodeType":"Attribute","startLoc":52,"text":"ARRAY_FUNCTION_ENABLED"},{"col":0,"comment":"","endLoc":5,"header":"console.py#<anonymous>","id":11031,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nUtilities for console input and output.\n\"\"\"\n\ntry:\n    import fcntl\n    import termios\n    import signal\n    _CAN_RESIZE_TERMINAL = True\nexcept ImportError:\n    _CAN_RESIZE_TERMINAL = False\n\n__all__ = [\n    'isatty', 'color_print', 'human_time', 'human_file_size',\n    'ProgressBar', 'Spinner', 'print_code_line', 'ProgressBarOrSpinner',\n    'terminal_size']\n\n_DEFAULT_ENCODING = 'utf-8'"},{"attributeType":"null","col":0,"comment":"null","endLoc":112,"id":11032,"name":"TBD_FUNCTIONS","nodeType":"Attribute","startLoc":112,"text":"TBD_FUNCTIONS"},{"attributeType":"null","col":0,"comment":"null","endLoc":124,"id":11033,"name":"IGNORED_FUNCTIONS","nodeType":"Attribute","startLoc":124,"text":"IGNORED_FUNCTIONS"},{"attributeType":"FunctionAssigner","col":0,"comment":"null","endLoc":174,"id":11034,"name":"function_helper","nodeType":"Attribute","startLoc":174,"text":"function_helper"},{"attributeType":"FunctionAssigner","col":0,"comment":"null","endLoc":176,"id":11035,"name":"dispatched_function","nodeType":"Attribute","startLoc":176,"text":"dispatched_function"},{"attributeType":"null","col":4,"comment":"null","endLoc":322,"id":11036,"name":"attr_names","nodeType":"Attribute","startLoc":322,"text":"attr_names"},{"col":0,"comment":"","endLoc":36,"header":"function_helpers.py#<anonymous>","id":11037,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"\"\"\"Helpers for overriding numpy functions.\n\nWe override numpy functions in `~astropy.units.Quantity.__array_function__`.\nIn this module, the numpy functions are split in four groups, each of\nwhich has an associated `set` or `dict`:\n\n1. SUBCLASS_SAFE_FUNCTIONS (set), if the numpy implementation\n   supports Quantity; we pass on to ndarray.__array_function__.\n2. FUNCTION_HELPERS (dict), if the numpy implementation is usable\n   after converting quantities to arrays with suitable units,\n   and possibly setting units on the result.\n3. DISPATCHED_FUNCTIONS (dict), if the function makes sense but\n   requires a Quantity-specific implementation\n4. UNSUPPORTED_FUNCTIONS (set), if the function does not make sense.\n\nFor the FUNCTION_HELPERS `dict`, the value is a function that does the\nunit conversion.  It should take the same arguments as the numpy\nfunction would (though one can use ``*args`` and ``**kwargs``) and\nreturn a tuple of ``args, kwargs, unit, out``, where ``args`` and\n``kwargs`` will be will be passed on to the numpy implementation,\n``unit`` is a possible unit of the result (`None` if it should not be\nconverted to Quantity), and ``out`` is a possible output Quantity passed\nin, which will be filled in-place.\n\nFor the DISPATCHED_FUNCTIONS `dict`, the value is a function that\nimplements the numpy functionality for Quantity input. It should\nreturn a tuple of ``result, unit, out``, where ``result`` is generally\na plain array with the result, and ``unit`` and ``out`` are as above.\nIf unit is `None`, result gets returned directly, so one can also\nreturn a Quantity directly using ``quantity_result, None, None``.\n\n\"\"\"\n\nARRAY_FUNCTION_ENABLED = getattr(np.core.overrides,\n                                 'ENABLE_ARRAY_FUNCTION', True)\n\nSUBCLASS_SAFE_FUNCTIONS = set()\n\n\"\"\"Functions with implementations supporting subclasses like Quantity.\"\"\"\n\nFUNCTION_HELPERS = {}\n\n\"\"\"Functions with implementations usable with proper unit conversion.\"\"\"\n\nDISPATCHED_FUNCTIONS = {}\n\n\"\"\"Functions for which we provide our own implementation.\"\"\"\n\nUNSUPPORTED_FUNCTIONS = set()\n\n\"\"\"Functions that cannot sensibly be used with quantities.\"\"\"\n\nSUBCLASS_SAFE_FUNCTIONS |= {\n    np.shape, np.size, np.ndim,\n    np.reshape, np.ravel, np.moveaxis, np.rollaxis, np.swapaxes,\n    np.transpose, np.atleast_1d, np.atleast_2d, np.atleast_3d,\n    np.expand_dims, np.squeeze, np.broadcast_to, np.broadcast_arrays,\n    np.flip, np.fliplr, np.flipud, np.rot90,\n    np.argmin, np.argmax, np.argsort, np.lexsort, np.searchsorted,\n    np.nonzero, np.argwhere, np.flatnonzero,\n    np.diag_indices_from, np.triu_indices_from, np.tril_indices_from,\n    np.real, np.imag, np.diagonal, np.diagflat,\n    np.empty_like,\n    np.compress, np.extract, np.delete, np.trim_zeros, np.roll, np.take,\n    np.put, np.fill_diagonal, np.tile, np.repeat,\n    np.split, np.array_split, np.hsplit, np.vsplit, np.dsplit,\n    np.stack, np.column_stack, np.hstack, np.vstack, np.dstack,\n    np.amax, np.amin, np.ptp, np.sum, np.cumsum,\n    np.prod, np.product, np.cumprod, np.cumproduct,\n    np.round, np.around,\n    np.fix, np.angle, np.i0, np.clip,\n    np.isposinf, np.isneginf, np.isreal, np.iscomplex,\n    np.average, np.mean, np.std, np.var, np.median, np.trace,\n    np.nanmax, np.nanmin, np.nanargmin, np.nanargmax, np.nanmean,\n    np.nanmedian, np.nansum, np.nancumsum, np.nanstd, np.nanvar,\n    np.nanprod, np.nancumprod,\n    np.einsum_path, np.trapz, np.linspace,\n    np.sort, np.msort, np.partition, np.meshgrid,\n    np.common_type, np.result_type, np.can_cast, np.min_scalar_type,\n    np.iscomplexobj, np.isrealobj,\n    np.shares_memory, np.may_share_memory,\n    np.apply_along_axis, np.take_along_axis, np.put_along_axis,\n    np.linalg.cond, np.linalg.multi_dot}\n\nSUBCLASS_SAFE_FUNCTIONS |= {np.ediff1d}\n\nUNSUPPORTED_FUNCTIONS |= {\n    np.packbits, np.unpackbits, np.unravel_index,\n    np.ravel_multi_index, np.ix_, np.cov, np.corrcoef,\n    np.busday_count, np.busday_offset, np.datetime_as_string,\n    np.is_busday, np.all, np.any, np.sometrue, np.alltrue}\n\nUNSUPPORTED_FUNCTIONS |= {np.linalg.slogdet}\n\nTBD_FUNCTIONS = {\n    rfn.drop_fields, rfn.rename_fields, rfn.append_fields, rfn.join_by,\n    rfn.apply_along_fields, rfn.assign_fields_by_name, rfn.merge_arrays,\n    rfn.find_duplicates, rfn.recursive_fill_fields, rfn.require_fields,\n    rfn.repack_fields, rfn.stack_arrays\n}\n\nUNSUPPORTED_FUNCTIONS |= TBD_FUNCTIONS\n\nIGNORED_FUNCTIONS = {\n    # I/O - useless for Quantity, since no way to store the unit.\n    np.save, np.savez, np.savetxt, np.savez_compressed,\n    # Polynomials\n    np.poly, np.polyadd, np.polyder, np.polydiv, np.polyfit, np.polyint,\n    np.polymul, np.polysub, np.polyval, np.roots, np.vander,\n    # functions taking record arrays (which are deprecated)\n    rfn.rec_append_fields, rfn.rec_drop_fields, rfn.rec_join,\n}\n\nif NUMPY_LT_1_20:\n    # financial\n    IGNORED_FUNCTIONS |= {np.fv, np.ipmt, np.irr, np.mirr, np.nper,\n                          np.npv, np.pmt, np.ppmt, np.pv, np.rate}\n\nif NUMPY_LT_1_23:\n    IGNORED_FUNCTIONS |= {\n        # Deprecated, removed in numpy 1.23\n        np.asscalar, np.alen,\n    }\n\nUNSUPPORTED_FUNCTIONS |= IGNORED_FUNCTIONS\n\nfunction_helper = FunctionAssigner(FUNCTION_HELPERS)\n\ndispatched_function = FunctionAssigner(DISPATCHED_FUNCTIONS)"},{"col":4,"comment":" Validates the provided value based on cfgtype and returns the\n        type-cast value\n\n        throws the underlying configobj exception if it fails\n        ","endLoc":485,"header":"def _validate_val(self, val)","id":11038,"name":"_validate_val","nodeType":"Function","startLoc":476,"text":"def _validate_val(self, val):\n        \"\"\" Validates the provided value based on cfgtype and returns the\n        type-cast value\n\n        throws the underlying configobj exception if it fails\n        \"\"\"\n        # note that this will normally use the *class* attribute `_validator`,\n        # but if some arcane reason is needed for making a special one for an\n        # instance or sub-class, it will be used\n        return self._validator.check(self.cfgtype, val)"},{"col":4,"comment":"\n        Usage: check(check, value)\n\n        Arguments:\n            check: string representing check to apply (including arguments)\n            value: object to be checked\n        Returns value, converted to correct type if necessary\n\n        If the check fails, raises a ``ValidateError`` subclass.\n\n        >>> vtor.check('yoda', '')\n        Traceback (most recent call last):\n        VdtUnknownCheckError: the check \"yoda\" is unknown.\n        >>> vtor.check('yoda()', '')\n        Traceback (most recent call last):\n        VdtUnknownCheckError: the check \"yoda\" is unknown.\n\n        >>> vtor.check('string(default=\"\")', '', missing=True)\n        ''\n        ","endLoc":625,"header":"def check(self, check, value, missing=False)","id":11039,"name":"check","nodeType":"Function","startLoc":593,"text":"def check(self, check, value, missing=False):\n        \"\"\"\n        Usage: check(check, value)\n\n        Arguments:\n            check: string representing check to apply (including arguments)\n            value: object to be checked\n        Returns value, converted to correct type if necessary\n\n        If the check fails, raises a ``ValidateError`` subclass.\n\n        >>> vtor.check('yoda', '')\n        Traceback (most recent call last):\n        VdtUnknownCheckError: the check \"yoda\" is unknown.\n        >>> vtor.check('yoda()', '')\n        Traceback (most recent call last):\n        VdtUnknownCheckError: the check \"yoda\" is unknown.\n\n        >>> vtor.check('string(default=\"\")', '', missing=True)\n        ''\n        \"\"\"\n        fun_name, fun_args, fun_kwargs, default = self._parse_with_caching(check)\n\n        if missing:\n            if default is None:\n                # no information needed here - to be handled by caller\n                raise VdtMissingValue()\n            value = self._handle_none(default)\n\n        if value is None:\n            return None\n\n        return self._check_value(value, fun_name, fun_args, fun_kwargs)"},{"fileName":"paths.py","filePath":"astropy/config","id":11040,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\" This module contains functions to determine where configuration and\ndata/cache files used by Astropy should be placed.\n\"\"\"\n\nfrom functools import wraps\n\nimport os\nimport shutil\nimport sys\n\n\n__all__ = ['get_config_dir', 'get_cache_dir', 'set_temp_config',\n           'set_temp_cache']\n\n\ndef _find_home():\n    \"\"\"Locates and return the home directory (or best approximation) on this\n    system.\n\n    Raises\n    ------\n    OSError\n        If the home directory cannot be located - usually means you are running\n        Astropy on some obscure platform that doesn't have standard home\n        directories.\n    \"\"\"\n    try:\n        homedir = os.path.expanduser('~')\n    except Exception:\n        # Linux, Unix, AIX, OS X\n        if os.name == 'posix':\n            if 'HOME' in os.environ:\n                homedir = os.environ['HOME']\n            else:\n                raise OSError('Could not find unix home directory to search for '\n                              'astropy config dir')\n        elif os.name == 'nt':  # This is for all modern Windows (NT or after)\n            if 'MSYSTEM' in os.environ and os.environ.get('HOME'):\n                # Likely using an msys shell; use whatever it is using for its\n                # $HOME directory\n                homedir = os.environ['HOME']\n            # See if there's a local home\n            elif 'HOMEDRIVE' in os.environ and 'HOMEPATH' in os.environ:\n                homedir = os.path.join(os.environ['HOMEDRIVE'],\n                                       os.environ['HOMEPATH'])\n            # Maybe a user profile?\n            elif 'USERPROFILE' in os.environ:\n                homedir = os.path.join(os.environ['USERPROFILE'])\n            else:\n                try:\n                    import winreg as wreg\n                    shell_folders = r'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders'  # noqa: E501\n                    key = wreg.OpenKey(wreg.HKEY_CURRENT_USER, shell_folders)\n\n                    homedir = wreg.QueryValueEx(key, 'Personal')[0]\n                    key.Close()\n                except Exception:\n                    # As a final possible resort, see if HOME is present\n                    if 'HOME' in os.environ:\n                        homedir = os.environ['HOME']\n                    else:\n                        raise OSError('Could not find windows home directory to '\n                                      'search for astropy config dir')\n        else:\n            # for other platforms, try HOME, although it probably isn't there\n            if 'HOME' in os.environ:\n                homedir = os.environ['HOME']\n            else:\n                raise OSError('Could not find a home directory to search for '\n                              'astropy config dir - are you on an unsupported '\n                              'platform?')\n    return homedir\n\n\ndef get_config_dir(rootname='astropy'):\n    \"\"\"\n    Determines the package configuration directory name and creates the\n    directory if it doesn't exist.\n\n    This directory is typically ``$HOME/.astropy/config``, but if the\n    XDG_CONFIG_HOME environment variable is set and the\n    ``$XDG_CONFIG_HOME/astropy`` directory exists, it will be that directory.\n    If neither exists, the former will be created and symlinked to the latter.\n\n    Parameters\n    ----------\n    rootname : str\n        Name of the root configuration directory. For example, if ``rootname =\n        'pkgname'``, the configuration directory would be ``<home>/.pkgname/``\n        rather than ``<home>/.astropy`` (depending on platform).\n\n    Returns\n    -------\n    configdir : str\n        The absolute path to the configuration directory.\n\n    \"\"\"\n\n    # symlink will be set to this if the directory is created\n    linkto = None\n\n    # If using set_temp_config, that overrides all\n    if set_temp_config._temp_path is not None:\n        xch = set_temp_config._temp_path\n        config_path = os.path.join(xch, rootname)\n        if not os.path.exists(config_path):\n            os.mkdir(config_path)\n        return os.path.abspath(config_path)\n\n    # first look for XDG_CONFIG_HOME\n    xch = os.environ.get('XDG_CONFIG_HOME')\n\n    if xch is not None and os.path.exists(xch):\n        xchpth = os.path.join(xch, rootname)\n        if not os.path.islink(xchpth):\n            if os.path.exists(xchpth):\n                return os.path.abspath(xchpth)\n            else:\n                linkto = xchpth\n    return os.path.abspath(_find_or_create_root_dir('config', linkto, rootname))\n\n\ndef get_cache_dir(rootname=\"astropy\"):\n    \"\"\"\n    Determines the Astropy cache directory name and creates the directory if it\n    doesn't exist.\n\n    This directory is typically ``$HOME/.astropy/cache``, but if the\n    XDG_CACHE_HOME environment variable is set and the\n    ``$XDG_CACHE_HOME/astropy`` directory exists, it will be that directory.\n    If neither exists, the former will be created and symlinked to the latter.\n\n    Parameters\n    ----------\n    rootname : str\n        Name of the root cache directory. For example, if\n        ``rootname = 'pkgname'``, the cache directory will be\n        ``<cache>/.pkgname/``.\n\n    Returns\n    -------\n    cachedir : str\n        The absolute path to the cache directory.\n\n    \"\"\"\n\n    # symlink will be set to this if the directory is created\n    linkto = None\n\n    # If using set_temp_cache, that overrides all\n    if set_temp_cache._temp_path is not None:\n        xch = set_temp_cache._temp_path\n        cache_path = os.path.join(xch, rootname)\n        if not os.path.exists(cache_path):\n            os.mkdir(cache_path)\n        return os.path.abspath(cache_path)\n\n    # first look for XDG_CACHE_HOME\n    xch = os.environ.get('XDG_CACHE_HOME')\n\n    if xch is not None and os.path.exists(xch):\n        xchpth = os.path.join(xch, rootname)\n        if not os.path.islink(xchpth):\n            if os.path.exists(xchpth):\n                return os.path.abspath(xchpth)\n            else:\n                linkto = xchpth\n\n    return os.path.abspath(_find_or_create_root_dir('cache', linkto, rootname))\n\n\nclass _SetTempPath:\n    _temp_path = None\n    _default_path_getter = None\n\n    def __init__(self, path=None, delete=False):\n        if path is not None:\n            path = os.path.abspath(path)\n\n        self._path = path\n        self._delete = delete\n        self._prev_path = self.__class__._temp_path\n\n    def __enter__(self):\n        self.__class__._temp_path = self._path\n        try:\n            return self._default_path_getter('astropy')\n        except Exception:\n            self.__class__._temp_path = self._prev_path\n            raise\n\n    def __exit__(self, *args):\n        self.__class__._temp_path = self._prev_path\n\n        if self._delete and self._path is not None:\n            shutil.rmtree(self._path)\n\n    def __call__(self, func):\n        \"\"\"Implements use as a decorator.\"\"\"\n\n        @wraps(func)\n        def wrapper(*args, **kwargs):\n            with self:\n                func(*args, **kwargs)\n\n        return wrapper\n\n\nclass set_temp_config(_SetTempPath):\n    \"\"\"\n    Context manager to set a temporary path for the Astropy config, primarily\n    for use with testing.\n\n    If the path set by this context manager does not already exist it will be\n    created, if possible.\n\n    This may also be used as a decorator on a function to set the config path\n    just within that function.\n\n    Parameters\n    ----------\n\n    path : str, optional\n        The directory (which must exist) in which to find the Astropy config\n        files, or create them if they do not already exist.  If None, this\n        restores the config path to the user's default config path as returned\n        by `get_config_dir` as though this context manager were not in effect\n        (this is useful for testing).  In this case the ``delete`` argument is\n        always ignored.\n\n    delete : bool, optional\n        If True, cleans up the temporary directory after exiting the temp\n        context (default: False).\n    \"\"\"\n\n    _default_path_getter = staticmethod(get_config_dir)\n\n    def __enter__(self):\n        # Special case for the config case, where we need to reset all the\n        # cached config objects.  We do keep the cache, since some of it\n        # may have been set programmatically rather than be stored in the\n        # config file (e.g., iers.conf.auto_download=False for our tests).\n        from .configuration import _cfgobjs\n        self._cfgobjs_copy = _cfgobjs.copy()\n        _cfgobjs.clear()\n        return super().__enter__()\n\n    def __exit__(self, *args):\n        from .configuration import _cfgobjs\n        _cfgobjs.clear()\n        _cfgobjs.update(self._cfgobjs_copy)\n        del self._cfgobjs_copy\n        super().__exit__(*args)\n\n\nclass set_temp_cache(_SetTempPath):\n    \"\"\"\n    Context manager to set a temporary path for the Astropy download cache,\n    primarily for use with testing (though there may be other applications\n    for setting a different cache directory, for example to switch to a cache\n    dedicated to large files).\n\n    If the path set by this context manager does not already exist it will be\n    created, if possible.\n\n    This may also be used as a decorator on a function to set the cache path\n    just within that function.\n\n    Parameters\n    ----------\n\n    path : str\n        The directory (which must exist) in which to find the Astropy cache\n        files, or create them if they do not already exist.  If None, this\n        restores the cache path to the user's default cache path as returned\n        by `get_cache_dir` as though this context manager were not in effect\n        (this is useful for testing).  In this case the ``delete`` argument is\n        always ignored.\n\n    delete : bool, optional\n        If True, cleans up the temporary directory after exiting the temp\n        context (default: False).\n    \"\"\"\n\n    _default_path_getter = staticmethod(get_cache_dir)\n\n\ndef _find_or_create_root_dir(dirnm, linkto, pkgname='astropy'):\n    innerdir = os.path.join(_find_home(), f'.{pkgname}')\n    maindir = os.path.join(_find_home(), f'.{pkgname}', dirnm)\n\n    if not os.path.exists(maindir):\n        # first create .astropy dir if needed\n        if not os.path.exists(innerdir):\n            try:\n                os.mkdir(innerdir)\n            except OSError:\n                if not os.path.isdir(innerdir):\n                    raise\n        elif not os.path.isdir(innerdir):\n            msg = 'Intended {0} {1} directory {1} is actually a file.'\n            raise OSError(msg.format(pkgname, dirnm, maindir))\n\n        try:\n            os.mkdir(maindir)\n        except OSError:\n            if not os.path.isdir(maindir):\n                raise\n\n        if (not sys.platform.startswith('win') and\n            linkto is not None and\n                not os.path.exists(linkto)):\n            os.symlink(maindir, linkto)\n\n    elif not os.path.isdir(maindir):\n        msg = 'Intended {0} {1} directory {1} is actually a file.'\n        raise OSError(msg.format(pkgname, dirnm, maindir))\n\n    return os.path.abspath(maindir)\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":11041,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"paths.py#<anonymous>","id":11042,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\" This module contains functions to determine where configuration and\ndata/cache files used by Astropy should be placed.\n\"\"\"\n\n__all__ = ['get_config_dir', 'get_cache_dir', 'set_temp_config',\n           'set_temp_cache']"},{"attributeType":"null","col":4,"comment":"null","endLoc":327,"id":11043,"name":"_represent_as_dict_primary_data","nodeType":"Attribute","startLoc":327,"text":"_represent_as_dict_primary_data"},{"className":"MaskedArraySubclassInfo","col":0,"comment":"Mixin class to create a subclasses such as MaskedQuantityInfo.","endLoc":376,"id":11044,"nodeType":"Class","startLoc":363,"text":"class MaskedArraySubclassInfo(MaskedInfoBase):\n    \"\"\"Mixin class to create a subclasses such as MaskedQuantityInfo.\"\"\"\n    # This is used below in __init_subclass__, which also inserts a\n    # 'serialize_method' attribute in attr_names.\n\n    def _represent_as_dict(self):\n        # Use the data_cls as the class name for serialization,\n        # so that we do not have to store all possible masked classes\n        # in astropy.table.serialize.__construct_mixin_classes.\n        out = super()._represent_as_dict()\n        data_cls = self._parent._data_cls\n        out.setdefault('__class__',\n                       data_cls.__module__ + '.' + data_cls.__name__)\n        return out"},{"col":4,"comment":"null","endLoc":376,"header":"def _represent_as_dict(self)","id":11045,"name":"_represent_as_dict","nodeType":"Function","startLoc":368,"text":"def _represent_as_dict(self):\n        # Use the data_cls as the class name for serialization,\n        # so that we do not have to store all possible masked classes\n        # in astropy.table.serialize.__construct_mixin_classes.\n        out = super()._represent_as_dict()\n        data_cls = self._parent._data_cls\n        out.setdefault('__class__',\n                       data_cls.__module__ + '.' + data_cls.__name__)\n        return out"},{"fileName":"__init__.py","filePath":"astropy/config","id":11046,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module contains configuration and setup utilities for the\nAstropy project. This includes all functionality related to the\naffiliated package index.\n\"\"\"\n\nfrom .paths import *\nfrom .configuration import *\nfrom .affiliated import *\n"},{"col":0,"comment":"null","endLoc":218,"header":"@apply_to_both(helps={np.flip, np.flipud, np.fliplr, np.rot90, np.triu, np.tril})\ndef masked_m_helper(m, *args, **kwargs)","id":11047,"name":"masked_m_helper","nodeType":"Function","startLoc":215,"text":"@apply_to_both(helps={np.flip, np.flipud, np.fliplr, np.rot90, np.triu, np.tril})\ndef masked_m_helper(m, *args, **kwargs):\n    data, mask = _get_data_and_masks(m)\n    return data + args, mask + args, kwargs, None"},{"className":"MaskedIterator","col":0,"comment":"\n    Flat iterator object to iterate over Masked Arrays.\n\n    A `~astropy.utils.masked.MaskedIterator` iterator is returned by ``m.flat``\n    for any masked array ``m``.  It allows iterating over the array as if it\n    were a 1-D array, either in a for-loop or by calling its `next` method.\n\n    Iteration is done in C-contiguous style, with the last index varying the\n    fastest. The iterator can also be indexed using basic slicing or\n    advanced indexing.\n\n    Notes\n    -----\n    The design of `~astropy.utils.masked.MaskedIterator` follows that of\n    `~numpy.ma.core.MaskedIterator`.  It is not exported by the\n    `~astropy.utils.masked` module.  Instead of instantiating directly,\n    use the ``flat`` method in the masked array instance.\n    ","endLoc":450,"id":11048,"nodeType":"Class","startLoc":397,"text":"class MaskedIterator:\n    \"\"\"\n    Flat iterator object to iterate over Masked Arrays.\n\n    A `~astropy.utils.masked.MaskedIterator` iterator is returned by ``m.flat``\n    for any masked array ``m``.  It allows iterating over the array as if it\n    were a 1-D array, either in a for-loop or by calling its `next` method.\n\n    Iteration is done in C-contiguous style, with the last index varying the\n    fastest. The iterator can also be indexed using basic slicing or\n    advanced indexing.\n\n    Notes\n    -----\n    The design of `~astropy.utils.masked.MaskedIterator` follows that of\n    `~numpy.ma.core.MaskedIterator`.  It is not exported by the\n    `~astropy.utils.masked` module.  Instead of instantiating directly,\n    use the ``flat`` method in the masked array instance.\n    \"\"\"\n\n    def __init__(self, m):\n        self._masked = m\n        self._dataiter = m.unmasked.flat\n        self._maskiter = m.mask.flat\n\n    def __iter__(self):\n        return self\n\n    def __getitem__(self, indx):\n        out = self._dataiter.__getitem__(indx)\n        mask = self._maskiter.__getitem__(indx)\n        # For single elements, ndarray.flat.__getitem__ returns scalars; these\n        # need a new view as a Masked array.\n        if not isinstance(out, np.ndarray):\n            out = out[...]\n            mask = mask[...]\n\n        return self._masked.from_unmasked(out, mask, copy=False)\n\n    def __setitem__(self, index, value):\n        data, mask = self._masked._get_data_and_mask(value, allow_ma_masked=True)\n        if data is not None:\n            self._dataiter[index] = data\n        self._maskiter[index] = mask\n\n    def __next__(self):\n        \"\"\"\n        Return the next value, or raise StopIteration.\n        \"\"\"\n        out = next(self._dataiter)[...]\n        mask = next(self._maskiter)[...]\n        return self._masked.from_unmasked(out, mask, copy=False)\n\n    next = __next__"},{"col":4,"comment":"null","endLoc":420,"header":"def __init__(self, m)","id":11049,"name":"__init__","nodeType":"Function","startLoc":417,"text":"def __init__(self, m):\n        self._masked = m\n        self._dataiter = m.unmasked.flat\n        self._maskiter = m.mask.flat"},{"col":4,"comment":"null","endLoc":423,"header":"def __iter__(self)","id":11050,"name":"__iter__","nodeType":"Function","startLoc":422,"text":"def __iter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":434,"header":"def __getitem__(self, indx)","id":11051,"name":"__getitem__","nodeType":"Function","startLoc":425,"text":"def __getitem__(self, indx):\n        out = self._dataiter.__getitem__(indx)\n        mask = self._maskiter.__getitem__(indx)\n        # For single elements, ndarray.flat.__getitem__ returns scalars; these\n        # need a new view as a Masked array.\n        if not isinstance(out, np.ndarray):\n            out = out[...]\n            mask = mask[...]\n\n        return self._masked.from_unmasked(out, mask, copy=False)"},{"col":0,"comment":"","endLoc":7,"header":"__init__.py#<anonymous>","id":11052,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module contains configuration and setup utilities for the\nAstropy project. This includes all functionality related to the\naffiliated package index.\n\"\"\""},{"id":11053,"name":"astropy/config/tests/data","nodeType":"Package"},{"id":11054,"name":"empty.cfg","nodeType":"TextFile","path":"astropy/config/tests/data","text":"## Use Unicode characters when outputting values, and writing widgets to the\n## console.\n#unicode_output = False\n\n[utils.console]\n\n## When True, use ANSI color escape sequences when writing to the console.\n# use_color = True\n\n[logger]\n\n## Threshold for the logging messages. Logging messages that are less severe\n## than this level will be ignored. The levels are 'DEBUG', 'INFO', 'WARNING',\n## 'ERROR'\n# log_level = INFO\n"},{"id":11055,"name":"alias.cfg","nodeType":"TextFile","path":"astropy/config/tests/data","text":"[coordinates.name_resolve]\nname_resolve_timeout = 42.0"},{"col":0,"comment":"null","endLoc":224,"header":"@apply_to_both(helps={np.diag, np.diagflat})\ndef masked_v_helper(v, *args, **kwargs)","id":11056,"name":"masked_v_helper","nodeType":"Function","startLoc":221,"text":"@apply_to_both(helps={np.diag, np.diagflat})\ndef masked_v_helper(v, *args, **kwargs):\n    data, mask = _get_data_and_masks(v)\n    return data + args, mask + args, kwargs, None"},{"id":11057,"name":"not_empty.cfg","nodeType":"TextFile","path":"astropy/config/tests/data","text":"## Use Unicode characters when outputting values, and writing widgets to the\n## console.\n#unicode_output = False\n\n[utils.console]\n\n## When True, use ANSI color escape sequences when writing to the console.\n# use_color = True\n\n[logger]\n\n## Threshold for the logging messages. Logging messages that are less severe\n## than this level will be ignored. The levels are 'DEBUG', 'INFO', 'WARNING',\n## 'ERROR'\nlog_level = INFO\n"},{"id":11058,"name":"deprecated.cfg","nodeType":"TextFile","path":"astropy/config/tests/data","text":"[table.pprint]\nmax_lines = 25\n"},{"id":11059,"name":"astropy/extern","nodeType":"Package"},{"id":11060,"name":"README.rst","nodeType":"TextFile","path":"astropy/extern","text":"astropy.extern\n==============\n\nThis sub-package contains third-party Python packages/modules that are\nrequired for some of Astropy's core functionality.  It also contains third-\nparty JavaScript libraries used for browser-based features.\n\nIn particular, this currently includes for Python:\n\n- ConfigObj_: This provides the core config file handling for Astropy's\n  configuration system.\n\n- PLY_: This is a parser generator providing lex/yacc-like tools in Python.\n  It is used for Astropy's unit parsing and angle/coordinate string parsing.\n\nAnd for JavaScript:\n\n- jQuery_: This is used currently for the browser-based table viewer feature.\n\n- DataTables_: This is a plug-in for jQuery used also for the browser-based\n  table viewer.\n\nNotes for developers\n--------------------\n\njQuery/DataTables\n^^^^^^^^^^^^^^^^^\n\nThe minified files are the ones that are used in the table viewer feature, but\nthe non-minified versions are also present in the ``js/`` sub-directory for\npackaging reasons. These files must also be distributed, to provide the source\nfiles from which the minified ones can be compiled. This is a requirement for\nLinux distributions such as Debian and Fedora.\n\n\nNotes for third-party packagers\n-------------------------------\n\nPackagers preparing Astropy for inclusion in packaging frameworks have\ndifferent options for how to handle these third-party extern packages, if they\nwould prefer to use their system packages rather than the bundled versions.\n\njQuery/DataTables\n^^^^^^^^^^^^^^^^^\n\nPackagers may either use system copies of these JavaScript modules, or require\nuse of online versions (perhaps via URLs of cloud-hosted versions of these\nmodules).\n\nIt is possible to change the default urls for the remote versions of these\nfiles by using the Astropy\n`Configuration system <https://docs.astropy.org/en/stable/config/>`_. The default\nconfiguration file (``$HOME/.astropy/config``) contains a commented section\n``[table.jsviewer]`` with two items for jQuery and DataTables. It is also\npossible to display the default value and modify it by importing the\nconfiguration module::\n\n    In [1]: from astropy.table.jsviewer import conf\n\n    In [2]: conf.jquery_url\n    Out[2]: u'https://code.jquery.com/jquery-1.11.3.min.js'\n\n    In [3]: conf.jquery_url = '...'\n\nThird-party packagers can override the defaults for these configuration items\n(by modifying the configuration objects in ``astropy/table/jsviewer.py``, or\nprovide astropy config files that include the overrides appropriate for the\npackaged version.  They would *also* need to set the default\n``use_local_files`` option to ``False`` for these settings to be read.\n\n\nOther\n^^^^^\n\nTo replace any of the other Python modules included in this package, simply\nremove them and update any imports in Astropy to import the system versions\nrather than the bundled copies.\n\n\n.. _ConfigObj: https://github.com/DiffSK/configobj\n.. _PLY: http://www.dabeaz.com/ply/\n.. _jQuery: http://jquery.com/\n.. _DataTables: http://www.datatables.net/\n"},{"fileName":"_strptime.py","filePath":"astropy/extern","id":11061,"nodeType":"File","text":"\"\"\"Strptime-related classes and functions.\n\nCLASSES:\n    LocaleTime -- Discovers and stores locale-specific time information\n    TimeRE -- Creates regexes for pattern matching a string of text containing\n                time information\n\nFUNCTIONS:\n    _getlang -- Figure out what language is being used for the locale\n    strptime -- Calculates the time struct represented by the passed-in string\n\n\"\"\"\n# -----------------------------------------------------------------------------\n# _strptime.py\n#\n# Licensed under PYTHON SOFTWARE FOUNDATION LICENSE\n# See licenses/PYTHON.rst\n#\n# Copied from https://github.com/python/cpython/blob/3.5/Lib/_strptime.py\n# -----------------------------------------------------------------------------\nimport time\nimport locale\nimport calendar\nfrom re import compile as re_compile\nfrom re import IGNORECASE\nfrom re import escape as re_escape\nfrom datetime import (date as datetime_date,\n                      timedelta as datetime_timedelta,\n                      timezone as datetime_timezone)\ntry:\n    from _thread import allocate_lock as _thread_allocate_lock\nexcept ImportError:\n    from _dummy_thread import allocate_lock as _thread_allocate_lock\n\n__all__ = []\n\ndef _getlang():\n    # Figure out what the current language is set to.\n    return locale.getlocale(locale.LC_TIME)\n\nclass LocaleTime(object):\n    \"\"\"Stores and handles locale-specific information related to time.\n\n    ATTRIBUTES:\n        f_weekday -- full weekday names (7-item list)\n        a_weekday -- abbreviated weekday names (7-item list)\n        f_month -- full month names (13-item list; dummy value in [0], which\n                    is added by code)\n        a_month -- abbreviated month names (13-item list, dummy value in\n                    [0], which is added by code)\n        am_pm -- AM/PM representation (2-item list)\n        LC_date_time -- format string for date/time representation (string)\n        LC_date -- format string for date representation (string)\n        LC_time -- format string for time representation (string)\n        timezone -- daylight- and non-daylight-savings timezone representation\n                    (2-item list of sets)\n        lang -- Language used by instance (2-item tuple)\n    \"\"\"\n\n    def __init__(self):\n        \"\"\"Set all attributes.\n\n        Order of methods called matters for dependency reasons.\n\n        The locale language is set at the offset and then checked again before\n        exiting.  This is to make sure that the attributes were not set with a\n        mix of information from more than one locale.  This would most likely\n        happen when using threads where one thread calls a locale-dependent\n        function while another thread changes the locale while the function in\n        the other thread is still running.  Proper coding would call for\n        locks to prevent changing the locale while locale-dependent code is\n        running.  The check here is done in case someone does not think about\n        doing this.\n\n        Only other possible issue is if someone changed the timezone and did\n        not call tz.tzset .  That is an issue for the programmer, though,\n        since changing the timezone is worthless without that call.\n\n        \"\"\"\n        self.lang = _getlang()\n        self.__calc_weekday()\n        self.__calc_month()\n        self.__calc_am_pm()\n        self.__calc_timezone()\n        self.__calc_date_time()\n        if _getlang() != self.lang:\n            raise ValueError(\"locale changed during initialization\")\n        if time.tzname != self.tzname or time.daylight != self.daylight:\n            raise ValueError(\"timezone changed during initialization\")\n\n    def __pad(self, seq, front):\n        # Add '' to seq to either the front (is True), else the back.\n        seq = list(seq)\n        if front:\n            seq.insert(0, '')\n        else:\n            seq.append('')\n        return seq\n\n    def __calc_weekday(self):\n        # Set self.a_weekday and self.f_weekday using the calendar\n        # module.\n        a_weekday = [calendar.day_abbr[i].lower() for i in range(7)]\n        f_weekday = [calendar.day_name[i].lower() for i in range(7)]\n        self.a_weekday = a_weekday\n        self.f_weekday = f_weekday\n\n    def __calc_month(self):\n        # Set self.f_month and self.a_month using the calendar module.\n        a_month = [calendar.month_abbr[i].lower() for i in range(13)]\n        f_month = [calendar.month_name[i].lower() for i in range(13)]\n        self.a_month = a_month\n        self.f_month = f_month\n\n    def __calc_am_pm(self):\n        # Set self.am_pm by using time.strftime().\n\n        # The magic date (1999,3,17,hour,44,55,2,76,0) is not really that\n        # magical; just happened to have used it everywhere else where a\n        # static date was needed.\n        am_pm = []\n        for hour in (1, 22):\n            time_tuple = time.struct_time((1999,3,17,hour,44,55,2,76,0))\n            am_pm.append(time.strftime(\"%p\", time_tuple).lower())\n        self.am_pm = am_pm\n\n    def __calc_date_time(self):\n        # Set self.date_time, self.date, & self.time by using\n        # time.strftime().\n\n        # Use (1999,3,17,22,44,55,2,76,0) for magic date because the amount of\n        # overloaded numbers is minimized.  The order in which searches for\n        # values within the format string is very important; it eliminates\n        # possible ambiguity for what something represents.\n        time_tuple = time.struct_time((1999,3,17,22,44,55,2,76,0))\n        date_time = [None, None, None]\n        date_time[0] = time.strftime(\"%c\", time_tuple).lower()\n        date_time[1] = time.strftime(\"%x\", time_tuple).lower()\n        date_time[2] = time.strftime(\"%X\", time_tuple).lower()\n        replacement_pairs = [('%', '%%'), (self.f_weekday[2], '%A'),\n                    (self.f_month[3], '%B'), (self.a_weekday[2], '%a'),\n                    (self.a_month[3], '%b'), (self.am_pm[1], '%p'),\n                    ('1999', '%Y'), ('99', '%y'), ('22', '%H'),\n                    ('44', '%M'), ('55', '%S'), ('76', '%j'),\n                    ('17', '%d'), ('03', '%m'), ('3', '%m'),\n                    # '3' needed for when no leading zero.\n                    ('2', '%w'), ('10', '%I')]\n        replacement_pairs.extend([(tz, \"%Z\") for tz_values in self.timezone\n                                                for tz in tz_values])\n        for offset,directive in ((0,'%c'), (1,'%x'), (2,'%X')):\n            current_format = date_time[offset]\n            for old, new in replacement_pairs:\n                # Must deal with possible lack of locale info\n                # manifesting itself as the empty string (e.g., Swedish's\n                # lack of AM/PM info) or a platform returning a tuple of empty\n                # strings (e.g., MacOS 9 having timezone as ('','')).\n                if old:\n                    current_format = current_format.replace(old, new)\n            # If %W is used, then Sunday, 2005-01-03 will fall on week 0 since\n            # 2005-01-03 occurs before the first Monday of the year.  Otherwise\n            # %U is used.\n            time_tuple = time.struct_time((1999,1,3,1,1,1,6,3,0))\n            if '00' in time.strftime(directive, time_tuple):\n                U_W = '%W'\n            else:\n                U_W = '%U'\n            date_time[offset] = current_format.replace('11', U_W)\n        self.LC_date_time = date_time[0]\n        self.LC_date = date_time[1]\n        self.LC_time = date_time[2]\n\n    def __calc_timezone(self):\n        # Set self.timezone by using time.tzname.\n        # Do not worry about possibility of time.tzname[0] == time.tzname[1]\n        # and time.daylight; handle that in strptime.\n        try:\n            time.tzset()\n        except AttributeError:\n            pass\n        self.tzname = time.tzname\n        self.daylight = time.daylight\n        no_saving = frozenset({\"utc\", \"gmt\", self.tzname[0].lower()})\n        if self.daylight:\n            has_saving = frozenset({self.tzname[1].lower()})\n        else:\n            has_saving = frozenset()\n        self.timezone = (no_saving, has_saving)\n\n\nclass TimeRE(dict):\n    \"\"\"Handle conversion from format directives to regexes.\"\"\"\n\n    def __init__(self, locale_time=None):\n        \"\"\"Create keys/values.\n\n        Order of execution is important for dependency reasons.\n\n        \"\"\"\n        if locale_time:\n            self.locale_time = locale_time\n        else:\n            self.locale_time = LocaleTime()\n        base = super()\n        base.__init__({\n            # The \" \\d\" part of the regex is to make %c from ANSI C work\n            'd': r\"(?P<d>3[0-1]|[1-2]\\d|0[1-9]|[1-9]| [1-9])\",\n            'f': r\"(?P<f>[0-9]{1,6})\",\n            'H': r\"(?P<H>2[0-3]|[0-1]\\d|\\d)\",\n            'I': r\"(?P<I>1[0-2]|0[1-9]|[1-9])\",\n            'j': r\"(?P<j>36[0-6]|3[0-5]\\d|[1-2]\\d\\d|0[1-9]\\d|00[1-9]|[1-9]\\d|0[1-9]|[1-9])\",\n            'm': r\"(?P<m>1[0-2]|0[1-9]|[1-9])\",\n            'M': r\"(?P<M>[0-5]\\d|\\d)\",\n            'S': r\"(?P<S>6[0-1]|[0-5]\\d|\\d)\",\n            'U': r\"(?P<U>5[0-3]|[0-4]\\d|\\d)\",\n            'w': r\"(?P<w>[0-6])\",\n            # W is set below by using 'U'\n            'y': r\"(?P<y>\\d\\d)\",\n            #XXX: Does 'Y' need to worry about having less or more than\n            #     4 digits?\n            'Y': r\"(?P<Y>\\d\\d\\d\\d)\",\n            'z': r\"(?P<z>[+-]\\d\\d[0-5]\\d)\",\n            'A': self.__seqToRE(self.locale_time.f_weekday, 'A'),\n            'a': self.__seqToRE(self.locale_time.a_weekday, 'a'),\n            'B': self.__seqToRE(self.locale_time.f_month[1:], 'B'),\n            'b': self.__seqToRE(self.locale_time.a_month[1:], 'b'),\n            'p': self.__seqToRE(self.locale_time.am_pm, 'p'),\n            'Z': self.__seqToRE((tz for tz_names in self.locale_time.timezone\n                                        for tz in tz_names),\n                                'Z'),\n            '%': '%'})\n        base.__setitem__('W', base.__getitem__('U').replace('U', 'W'))\n        base.__setitem__('c', self.pattern(self.locale_time.LC_date_time))\n        base.__setitem__('x', self.pattern(self.locale_time.LC_date))\n        base.__setitem__('X', self.pattern(self.locale_time.LC_time))\n\n    def __seqToRE(self, to_convert, directive):\n        \"\"\"Convert a list to a regex string for matching a directive.\n\n        Want possible matching values to be from longest to shortest.  This\n        prevents the possibility of a match occurring for a value that also\n        a substring of a larger value that should have matched (e.g., 'abc'\n        matching when 'abcdef' should have been the match).\n\n        \"\"\"\n        to_convert = sorted(to_convert, key=len, reverse=True)\n        for value in to_convert:\n            if value != '':\n                break\n        else:\n            return ''\n        regex = '|'.join(re_escape(stuff) for stuff in to_convert)\n        regex = '(?P<%s>%s' % (directive, regex)\n        return '%s)' % regex\n\n    def pattern(self, format):\n        \"\"\"Return regex pattern for the format string.\n\n        Need to make sure that any characters that might be interpreted as\n        regex syntax are escaped.\n\n        \"\"\"\n        processed_format = ''\n        # The sub() call escapes all characters that might be misconstrued\n        # as regex syntax.  Cannot use re.escape since we have to deal with\n        # format directives (%m, etc.).\n        regex_chars = re_compile(r\"([\\\\.^$*+?\\(\\){}\\[\\]|])\")\n        format = regex_chars.sub(r\"\\\\\\1\", format)\n        whitespace_replacement = re_compile(r'\\s+')\n        format = whitespace_replacement.sub(r'\\\\s+', format)\n        while '%' in format:\n            directive_index = format.index('%')+1\n            processed_format = \"%s%s%s\" % (processed_format,\n                                           format[:directive_index-1],\n                                           self[format[directive_index]])\n            format = format[directive_index+1:]\n        return \"%s%s\" % (processed_format, format)\n\n    def compile(self, format):\n        \"\"\"Return a compiled re object for the format string.\"\"\"\n        return re_compile(self.pattern(format), IGNORECASE)\n\n_cache_lock = _thread_allocate_lock()\n# DO NOT modify _TimeRE_cache or _regex_cache without acquiring the cache lock\n# first!\n_TimeRE_cache = TimeRE()\n_CACHE_MAX_SIZE = 5 # Max number of regexes stored in _regex_cache\n_regex_cache = {}\n\ndef _calc_julian_from_U_or_W(year, week_of_year, day_of_week, week_starts_Mon):\n    \"\"\"Calculate the Julian day based on the year, week of the year, and day of\n    the week, with week_start_day representing whether the week of the year\n    assumes the week starts on Sunday or Monday (6 or 0).\"\"\"\n    first_weekday = datetime_date(year, 1, 1).weekday()\n    # If we are dealing with the %U directive (week starts on Sunday), it's\n    # easier to just shift the view to Sunday being the first day of the\n    # week.\n    if not week_starts_Mon:\n        first_weekday = (first_weekday + 1) % 7\n        day_of_week = (day_of_week + 1) % 7\n    # Need to watch out for a week 0 (when the first day of the year is not\n    # the same as that specified by %U or %W).\n    week_0_length = (7 - first_weekday) % 7\n    if week_of_year == 0:\n        return 1 + day_of_week - first_weekday\n    else:\n        days_to_week = week_0_length + (7 * (week_of_year - 1))\n        return 1 + days_to_week + day_of_week\n\n\ndef _strptime(data_string, format=\"%a %b %d %H:%M:%S %Y\"):\n    \"\"\"Return a 2-tuple consisting of a time struct and an int containing\n    the number of microseconds based on the input string and the\n    format string.\"\"\"\n\n    for index, arg in enumerate([data_string, format]):\n        if not isinstance(arg, str):\n            msg = \"strptime() argument {} must be str, not {}\"\n            raise TypeError(msg.format(index, type(arg)))\n\n    global _TimeRE_cache, _regex_cache\n    with _cache_lock:\n        locale_time = _TimeRE_cache.locale_time\n        if (_getlang() != locale_time.lang or\n            time.tzname != locale_time.tzname or\n            time.daylight != locale_time.daylight):\n            _TimeRE_cache = TimeRE()\n            _regex_cache.clear()\n            locale_time = _TimeRE_cache.locale_time\n        if len(_regex_cache) > _CACHE_MAX_SIZE:\n            _regex_cache.clear()\n        format_regex = _regex_cache.get(format)\n        if not format_regex:\n            try:\n                format_regex = _TimeRE_cache.compile(format)\n            # KeyError raised when a bad format is found; can be specified as\n            # \\\\, in which case it was a stray % but with a space after it\n            except KeyError as err:\n                bad_directive = err.args[0]\n                if bad_directive == \"\\\\\":\n                    bad_directive = \"%\"\n                del err\n                raise ValueError(\"'%s' is a bad directive in format '%s'\" %\n                                    (bad_directive, format)) from None\n            # IndexError only occurs when the format string is \"%\"\n            except IndexError:\n                raise ValueError(\"stray %% in format '%s'\" % format) from None\n            _regex_cache[format] = format_regex\n    found = format_regex.match(data_string)\n    if not found:\n        raise ValueError(\"time data %r does not match format %r\" %\n                         (data_string, format))\n    if len(data_string) != found.end():\n        raise ValueError(\"unconverted data remains: %s\" %\n                          data_string[found.end():])\n\n    year = None\n    month = day = 1\n    hour = minute = second = fraction = 0\n    tz = -1\n    tzoffset = None\n    # Default to -1 to signify that values not known; not critical to have,\n    # though\n    week_of_year = -1\n    week_of_year_start = -1\n    # weekday and julian defaulted to None so as to signal need to calculate\n    # values\n    weekday = julian = None\n    found_dict = found.groupdict()\n    for group_key in found_dict.keys():\n        # Directives not explicitly handled below:\n        #   c, x, X\n        #      handled by making out of other directives\n        #   U, W\n        #      worthless without day of the week\n        if group_key == 'y':\n            year = int(found_dict['y'])\n            # Open Group specification for strptime() states that a %y\n            #value in the range of [00, 68] is in the century 2000, while\n            #[69,99] is in the century 1900\n            if year <= 68:\n                year += 2000\n            else:\n                year += 1900\n        elif group_key == 'Y':\n            year = int(found_dict['Y'])\n        elif group_key == 'm':\n            month = int(found_dict['m'])\n        elif group_key == 'B':\n            month = locale_time.f_month.index(found_dict['B'].lower())\n        elif group_key == 'b':\n            month = locale_time.a_month.index(found_dict['b'].lower())\n        elif group_key == 'd':\n            day = int(found_dict['d'])\n        elif group_key == 'H':\n            hour = int(found_dict['H'])\n        elif group_key == 'I':\n            hour = int(found_dict['I'])\n            ampm = found_dict.get('p', '').lower()\n            # If there was no AM/PM indicator, we'll treat this like AM\n            if ampm in ('', locale_time.am_pm[0]):\n                # We're in AM so the hour is correct unless we're\n                # looking at 12 midnight.\n                # 12 midnight == 12 AM == hour 0\n                if hour == 12:\n                    hour = 0\n            elif ampm == locale_time.am_pm[1]:\n                # We're in PM so we need to add 12 to the hour unless\n                # we're looking at 12 noon.\n                # 12 noon == 12 PM == hour 12\n                if hour != 12:\n                    hour += 12\n        elif group_key == 'M':\n            minute = int(found_dict['M'])\n        elif group_key == 'S':\n            second = int(found_dict['S'])\n        elif group_key == 'f':\n            s = found_dict['f']\n            # Pad to always return microseconds.\n            s += \"0\" * (6 - len(s))\n            fraction = int(s)\n        elif group_key == 'A':\n            weekday = locale_time.f_weekday.index(found_dict['A'].lower())\n        elif group_key == 'a':\n            weekday = locale_time.a_weekday.index(found_dict['a'].lower())\n        elif group_key == 'w':\n            weekday = int(found_dict['w'])\n            if weekday == 0:\n                weekday = 6\n            else:\n                weekday -= 1\n        elif group_key == 'j':\n            julian = int(found_dict['j'])\n        elif group_key in ('U', 'W'):\n            week_of_year = int(found_dict[group_key])\n            if group_key == 'U':\n                # U starts week on Sunday.\n                week_of_year_start = 6\n            else:\n                # W starts week on Monday.\n                week_of_year_start = 0\n        elif group_key == 'z':\n            z = found_dict['z']\n            tzoffset = int(z[1:3]) * 60 + int(z[3:5])\n            if z.startswith(\"-\"):\n                tzoffset = -tzoffset\n        elif group_key == 'Z':\n            # Since -1 is default value only need to worry about setting tz if\n            # it can be something other than -1.\n            found_zone = found_dict['Z'].lower()\n            for value, tz_values in enumerate(locale_time.timezone):\n                if found_zone in tz_values:\n                    # Deal with bad locale setup where timezone names are the\n                    # same and yet time.daylight is true; too ambiguous to\n                    # be able to tell what timezone has daylight savings\n                    if (time.tzname[0] == time.tzname[1] and\n                       time.daylight and found_zone not in (\"utc\", \"gmt\")):\n                        break\n                    else:\n                        tz = value\n                        break\n    leap_year_fix = False\n    if year is None and month == 2 and day == 29:\n        year = 1904  # 1904 is first leap year of 20th century\n        leap_year_fix = True\n    elif year is None:\n        year = 1900\n    # If we know the week of the year and what day of that week, we can figure\n    # out the Julian day of the year.\n    if julian is None and week_of_year != -1 and weekday is not None:\n        week_starts_Mon = True if week_of_year_start == 0 else False\n        julian = _calc_julian_from_U_or_W(year, week_of_year, weekday,\n                                            week_starts_Mon)\n        if julian <= 0:\n            year -= 1\n            yday = 366 if calendar.isleap(year) else 365\n            julian += yday\n    # Cannot pre-calculate datetime_date() since can change in Julian\n    # calculation and thus could have different value for the day of the week\n    # calculation.\n    if julian is None:\n        # Need to add 1 to result since first day of the year is 1, not 0.\n        julian = datetime_date(year, month, day).toordinal() - \\\n                  datetime_date(year, 1, 1).toordinal() + 1\n    else:  # Assume that if they bothered to include Julian day it will\n           # be accurate.\n        datetime_result = datetime_date.fromordinal((julian - 1) + datetime_date(year, 1, 1).toordinal())\n        year = datetime_result.year\n        month = datetime_result.month\n        day = datetime_result.day\n    if weekday is None:\n        weekday = datetime_date(year, month, day).weekday()\n    # Add timezone info\n    tzname = found_dict.get(\"Z\")\n    if tzoffset is not None:\n        gmtoff = tzoffset * 60\n    else:\n        gmtoff = None\n\n    if leap_year_fix:\n        # the caller didn't supply a year but asked for Feb 29th. We couldn't\n        # use the default of 1900 for computations. We set it back to ensure\n        # that February 29th is smaller than March 1st.\n        year = 1900\n\n    return (year, month, day,\n            hour, minute, second,\n            weekday, julian, tz, tzname, gmtoff), fraction\n\ndef _strptime_time(data_string, format=\"%a %b %d %H:%M:%S %Y\"):\n    \"\"\"Return a time struct based on the input string and the\n    format string.\"\"\"\n    tt = _strptime(data_string, format)[0]\n    return time.struct_time(tt[:time._STRUCT_TM_ITEMS])\n\ndef _strptime_datetime(cls, data_string, format=\"%a %b %d %H:%M:%S %Y\"):\n    \"\"\"Return a class cls instance based on the input string and the\n    format string.\"\"\"\n    tt, fraction = _strptime(data_string, format)\n    tzname, gmtoff = tt[-2:]\n    args = tt[:6] + (fraction,)\n    if gmtoff is not None:\n        tzdelta = datetime_timedelta(seconds=gmtoff)\n        if tzname:\n            tz = datetime_timezone(tzdelta, tzname)\n        else:\n            tz = datetime_timezone(tzdelta)\n        args += (tz,)\n\n    return cls(*args)\n"},{"col":0,"comment":"null","endLoc":230,"header":"@apply_to_both(helps={np.delete})\ndef masked_arr_helper(array, *args, **kwargs)","id":11062,"name":"masked_arr_helper","nodeType":"Function","startLoc":227,"text":"@apply_to_both(helps={np.delete})\ndef masked_arr_helper(array, *args, **kwargs):\n    data, mask = _get_data_and_masks(array)\n    return data + args, mask + args, kwargs, None"},{"className":"LocaleTime","col":0,"comment":"Stores and handles locale-specific information related to time.\n\n    ATTRIBUTES:\n        f_weekday -- full weekday names (7-item list)\n        a_weekday -- abbreviated weekday names (7-item list)\n        f_month -- full month names (13-item list; dummy value in [0], which\n                    is added by code)\n        a_month -- abbreviated month names (13-item list, dummy value in\n                    [0], which is added by code)\n        am_pm -- AM/PM representation (2-item list)\n        LC_date_time -- format string for date/time representation (string)\n        LC_date -- format string for date representation (string)\n        LC_time -- format string for time representation (string)\n        timezone -- daylight- and non-daylight-savings timezone representation\n                    (2-item list of sets)\n        lang -- Language used by instance (2-item tuple)\n    ","endLoc":187,"id":11063,"nodeType":"Class","startLoc":41,"text":"class LocaleTime(object):\n    \"\"\"Stores and handles locale-specific information related to time.\n\n    ATTRIBUTES:\n        f_weekday -- full weekday names (7-item list)\n        a_weekday -- abbreviated weekday names (7-item list)\n        f_month -- full month names (13-item list; dummy value in [0], which\n                    is added by code)\n        a_month -- abbreviated month names (13-item list, dummy value in\n                    [0], which is added by code)\n        am_pm -- AM/PM representation (2-item list)\n        LC_date_time -- format string for date/time representation (string)\n        LC_date -- format string for date representation (string)\n        LC_time -- format string for time representation (string)\n        timezone -- daylight- and non-daylight-savings timezone representation\n                    (2-item list of sets)\n        lang -- Language used by instance (2-item tuple)\n    \"\"\"\n\n    def __init__(self):\n        \"\"\"Set all attributes.\n\n        Order of methods called matters for dependency reasons.\n\n        The locale language is set at the offset and then checked again before\n        exiting.  This is to make sure that the attributes were not set with a\n        mix of information from more than one locale.  This would most likely\n        happen when using threads where one thread calls a locale-dependent\n        function while another thread changes the locale while the function in\n        the other thread is still running.  Proper coding would call for\n        locks to prevent changing the locale while locale-dependent code is\n        running.  The check here is done in case someone does not think about\n        doing this.\n\n        Only other possible issue is if someone changed the timezone and did\n        not call tz.tzset .  That is an issue for the programmer, though,\n        since changing the timezone is worthless without that call.\n\n        \"\"\"\n        self.lang = _getlang()\n        self.__calc_weekday()\n        self.__calc_month()\n        self.__calc_am_pm()\n        self.__calc_timezone()\n        self.__calc_date_time()\n        if _getlang() != self.lang:\n            raise ValueError(\"locale changed during initialization\")\n        if time.tzname != self.tzname or time.daylight != self.daylight:\n            raise ValueError(\"timezone changed during initialization\")\n\n    def __pad(self, seq, front):\n        # Add '' to seq to either the front (is True), else the back.\n        seq = list(seq)\n        if front:\n            seq.insert(0, '')\n        else:\n            seq.append('')\n        return seq\n\n    def __calc_weekday(self):\n        # Set self.a_weekday and self.f_weekday using the calendar\n        # module.\n        a_weekday = [calendar.day_abbr[i].lower() for i in range(7)]\n        f_weekday = [calendar.day_name[i].lower() for i in range(7)]\n        self.a_weekday = a_weekday\n        self.f_weekday = f_weekday\n\n    def __calc_month(self):\n        # Set self.f_month and self.a_month using the calendar module.\n        a_month = [calendar.month_abbr[i].lower() for i in range(13)]\n        f_month = [calendar.month_name[i].lower() for i in range(13)]\n        self.a_month = a_month\n        self.f_month = f_month\n\n    def __calc_am_pm(self):\n        # Set self.am_pm by using time.strftime().\n\n        # The magic date (1999,3,17,hour,44,55,2,76,0) is not really that\n        # magical; just happened to have used it everywhere else where a\n        # static date was needed.\n        am_pm = []\n        for hour in (1, 22):\n            time_tuple = time.struct_time((1999,3,17,hour,44,55,2,76,0))\n            am_pm.append(time.strftime(\"%p\", time_tuple).lower())\n        self.am_pm = am_pm\n\n    def __calc_date_time(self):\n        # Set self.date_time, self.date, & self.time by using\n        # time.strftime().\n\n        # Use (1999,3,17,22,44,55,2,76,0) for magic date because the amount of\n        # overloaded numbers is minimized.  The order in which searches for\n        # values within the format string is very important; it eliminates\n        # possible ambiguity for what something represents.\n        time_tuple = time.struct_time((1999,3,17,22,44,55,2,76,0))\n        date_time = [None, None, None]\n        date_time[0] = time.strftime(\"%c\", time_tuple).lower()\n        date_time[1] = time.strftime(\"%x\", time_tuple).lower()\n        date_time[2] = time.strftime(\"%X\", time_tuple).lower()\n        replacement_pairs = [('%', '%%'), (self.f_weekday[2], '%A'),\n                    (self.f_month[3], '%B'), (self.a_weekday[2], '%a'),\n                    (self.a_month[3], '%b'), (self.am_pm[1], '%p'),\n                    ('1999', '%Y'), ('99', '%y'), ('22', '%H'),\n                    ('44', '%M'), ('55', '%S'), ('76', '%j'),\n                    ('17', '%d'), ('03', '%m'), ('3', '%m'),\n                    # '3' needed for when no leading zero.\n                    ('2', '%w'), ('10', '%I')]\n        replacement_pairs.extend([(tz, \"%Z\") for tz_values in self.timezone\n                                                for tz in tz_values])\n        for offset,directive in ((0,'%c'), (1,'%x'), (2,'%X')):\n            current_format = date_time[offset]\n            for old, new in replacement_pairs:\n                # Must deal with possible lack of locale info\n                # manifesting itself as the empty string (e.g., Swedish's\n                # lack of AM/PM info) or a platform returning a tuple of empty\n                # strings (e.g., MacOS 9 having timezone as ('','')).\n                if old:\n                    current_format = current_format.replace(old, new)\n            # If %W is used, then Sunday, 2005-01-03 will fall on week 0 since\n            # 2005-01-03 occurs before the first Monday of the year.  Otherwise\n            # %U is used.\n            time_tuple = time.struct_time((1999,1,3,1,1,1,6,3,0))\n            if '00' in time.strftime(directive, time_tuple):\n                U_W = '%W'\n            else:\n                U_W = '%U'\n            date_time[offset] = current_format.replace('11', U_W)\n        self.LC_date_time = date_time[0]\n        self.LC_date = date_time[1]\n        self.LC_time = date_time[2]\n\n    def __calc_timezone(self):\n        # Set self.timezone by using time.tzname.\n        # Do not worry about possibility of time.tzname[0] == time.tzname[1]\n        # and time.daylight; handle that in strptime.\n        try:\n            time.tzset()\n        except AttributeError:\n            pass\n        self.tzname = time.tzname\n        self.daylight = time.daylight\n        no_saving = frozenset({\"utc\", \"gmt\", self.tzname[0].lower()})\n        if self.daylight:\n            has_saving = frozenset({self.tzname[1].lower()})\n        else:\n            has_saving = frozenset()\n        self.timezone = (no_saving, has_saving)"},{"col":4,"comment":"null","endLoc":98,"header":"def __pad(self, seq, front)","id":11064,"name":"__pad","nodeType":"Function","startLoc":91,"text":"def __pad(self, seq, front):\n        # Add '' to seq to either the front (is True), else the back.\n        seq = list(seq)\n        if front:\n            seq.insert(0, '')\n        else:\n            seq.append('')\n        return seq"},{"col":0,"comment":"Broadcast array to the given shape.\n\n    Like `numpy.broadcast_to`, and applied to both unmasked data and mask.\n    Note that ``subok`` is taken to mean whether or not subclasses of\n    the unmasked data and mask are allowed, i.e., for ``subok=False``,\n    a `~astropy.utils.masked.MaskedNDArray` will be returned.\n    ","endLoc":243,"header":"@apply_to_both\ndef broadcast_to(array,  shape, subok=False)","id":11065,"name":"broadcast_to","nodeType":"Function","startLoc":233,"text":"@apply_to_both\ndef broadcast_to(array,  shape, subok=False):\n    \"\"\"Broadcast array to the given shape.\n\n    Like `numpy.broadcast_to`, and applied to both unmasked data and mask.\n    Note that ``subok`` is taken to mean whether or not subclasses of\n    the unmasked data and mask are allowed, i.e., for ``subok=False``,\n    a `~astropy.utils.masked.MaskedNDArray` will be returned.\n    \"\"\"\n    data, mask = _get_data_and_masks(array)\n    return data, mask, dict(shape=shape, subok=subok), None"},{"col":0,"comment":"null","endLoc":248,"header":"@dispatched_function\ndef outer(a, b, out=None)","id":11066,"name":"outer","nodeType":"Function","startLoc":246,"text":"@dispatched_function\ndef outer(a, b, out=None):\n    return np.multiply.outer(np.ravel(a), np.ravel(b), out=out)"},{"attributeType":"null","col":8,"comment":"null","endLoc":169,"id":11067,"name":"LC_date","nodeType":"Attribute","startLoc":169,"text":"self.LC_date"},{"col":0,"comment":"Return a new array with the same shape and type as a given array.\n\n    Like `numpy.empty_like`, but will add an empty mask.\n    ","endLoc":265,"header":"@dispatched_function\ndef empty_like(prototype, dtype=None, order='K', subok=True, shape=None)","id":11068,"name":"empty_like","nodeType":"Function","startLoc":251,"text":"@dispatched_function\ndef empty_like(prototype, dtype=None, order='K', subok=True, shape=None):\n    \"\"\"Return a new array with the same shape and type as a given array.\n\n    Like `numpy.empty_like`, but will add an empty mask.\n    \"\"\"\n    unmasked = np.empty_like(prototype.unmasked, dtype=dtype, order=order,\n                             subok=subok, shape=shape)\n    if dtype is not None:\n        dtype = (np.ma.make_mask_descr(unmasked.dtype)\n                 if unmasked.dtype.names else np.dtype('?'))\n    mask = np.empty_like(prototype.mask, dtype=dtype, order=order,\n                         subok=subok, shape=shape)\n\n    return unmasked, mask, None"},{"col":0,"comment":"Return an array of zeros with the same shape and type as a given array.\n\n    Like `numpy.zeros_like`, but will add an all-false mask.\n    ","endLoc":276,"header":"@dispatched_function\ndef zeros_like(a, dtype=None, order='K', subok=True, shape=None)","id":11069,"name":"zeros_like","nodeType":"Function","startLoc":268,"text":"@dispatched_function\ndef zeros_like(a, dtype=None, order='K', subok=True, shape=None):\n    \"\"\"Return an array of zeros with the same shape and type as a given array.\n\n    Like `numpy.zeros_like`, but will add an all-false mask.\n    \"\"\"\n    unmasked = np.zeros_like(a.unmasked, dtype=dtype, order=order,\n                             subok=subok, shape=shape)\n    return unmasked, False, None"},{"id":11070,"name":"astropy/config/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/config/tests","id":11071,"nodeType":"File","text":""},{"col":4,"comment":"null","endLoc":415,"header":"def _interpolate(self, jd1, jd2, columns, source=None)","id":11072,"name":"_interpolate","nodeType":"Function","startLoc":357,"text":"def _interpolate(self, jd1, jd2, columns, source=None):\n        mjd, utc = self.mjd_utc(jd1, jd2)\n        # enforce array\n        is_scalar = not hasattr(mjd, '__array__') or mjd.ndim == 0\n        if is_scalar:\n            mjd = np.array([mjd])\n            utc = np.array([utc])\n        elif mjd.size == 0:\n            # Short-cut empty input.\n            return np.array([])\n\n        self._refresh_table_as_needed(mjd)\n\n        # For typical format, will always find a match (since MJD are integer)\n        # hence, important to define which side we will be; this ensures\n        # self['MJD'][i-1]<=mjd<self['MJD'][i]\n        i = np.searchsorted(self['MJD'].value, mjd, side='right')\n\n        # Get index to MJD at or just below given mjd, clipping to ensure we\n        # stay in range of table (status will be set below for those outside)\n        i1 = np.clip(i, 1, len(self) - 1)\n        i0 = i1 - 1\n        mjd_0, mjd_1 = self['MJD'][i0].value, self['MJD'][i1].value\n        results = []\n        for column in columns:\n            val_0, val_1 = self[column][i0], self[column][i1]\n            d_val = val_1 - val_0\n            if column == 'UT1_UTC':\n                # Check & correct for possible leap second (correcting diff.,\n                # not 1st point, since jump can only happen right at 2nd point)\n                d_val -= d_val.round()\n            # Linearly interpolate (which is what TEMPO does for UT1-UTC, but\n            # may want to follow IERS gazette #13 for more precise\n            # interpolation and correction for tidal effects;\n            # https://maia.usno.navy.mil/iers-gaz13)\n            val = val_0 + (mjd - mjd_0 + utc) / (mjd_1 - mjd_0) * d_val\n\n            # Do not extrapolate outside range, instead just propagate last values.\n            val[i == 0] = self[column][0]\n            val[i == len(self)] = self[column][-1]\n\n            if is_scalar:\n                val = val[0]\n\n            results.append(val)\n\n        if source:\n            # Set status to source, using the routine passed in.\n            status = source(i1)\n            # Check for out of range\n            status[i == 0] = TIME_BEFORE_IERS_RANGE\n            status[i == len(self)] = TIME_BEYOND_IERS_RANGE\n            if is_scalar:\n                status = status[0]\n            results.append(status)\n            return results\n        else:\n            self._check_interpolate_indices(i1, i, np.max(mjd))\n            return results[0] if len(results) == 1 else results"},{"col":0,"comment":"Return an array of ones with the same shape and type as a given array.\n\n    Like `numpy.ones_like`, but will add an all-false mask.\n    ","endLoc":287,"header":"@dispatched_function\ndef ones_like(a, dtype=None, order='K', subok=True, shape=None)","id":11073,"name":"ones_like","nodeType":"Function","startLoc":279,"text":"@dispatched_function\ndef ones_like(a, dtype=None, order='K', subok=True, shape=None):\n    \"\"\"Return an array of ones with the same shape and type as a given array.\n\n    Like `numpy.ones_like`, but will add an all-false mask.\n    \"\"\"\n    unmasked = np.ones_like(a.unmasked, dtype=dtype, order=order,\n                            subok=subok, shape=shape)\n    return unmasked, False, None"},{"col":0,"comment":"Return a full array with the same shape and type as a given array.\n\n    Like `numpy.full_like`, but with a mask that is also set.\n    If ``fill_value`` is `numpy.ma.masked`, the data will be left unset\n    (i.e., as created by `numpy.empty_like`).\n    ","endLoc":300,"header":"@dispatched_function\ndef full_like(a, fill_value, dtype=None, order='K', subok=True, shape=None)","id":11074,"name":"full_like","nodeType":"Function","startLoc":290,"text":"@dispatched_function\ndef full_like(a, fill_value, dtype=None, order='K', subok=True, shape=None):\n    \"\"\"Return a full array with the same shape and type as a given array.\n\n    Like `numpy.full_like`, but with a mask that is also set.\n    If ``fill_value`` is `numpy.ma.masked`, the data will be left unset\n    (i.e., as created by `numpy.empty_like`).\n    \"\"\"\n    result = np.empty_like(a, dtype=dtype, order=order, subok=subok, shape=shape)\n    result[...] = fill_value\n    return result"},{"col":0,"comment":"Replaces specified elements of an array with given values.\n\n    Like `numpy.put`, but for masked array ``a`` and possibly masked\n    value ``v``.  Masked indices ``ind`` are not supported.\n    ","endLoc":319,"header":"@dispatched_function\ndef put(a, ind, v, mode='raise')","id":11075,"name":"put","nodeType":"Function","startLoc":303,"text":"@dispatched_function\ndef put(a, ind, v, mode='raise'):\n    \"\"\"Replaces specified elements of an array with given values.\n\n    Like `numpy.put`, but for masked array ``a`` and possibly masked\n    value ``v``.  Masked indices ``ind`` are not supported.\n    \"\"\"\n    from astropy.utils.masked import Masked\n    if isinstance(ind, Masked) or not isinstance(a, Masked):\n        raise NotImplementedError\n\n    v_data, v_mask = a._get_data_and_mask(v)\n    if v_data is not None:\n        np.put(a.unmasked, ind, v_data, mode=mode)\n    # v_mask of None will be correctly interpreted as False.\n    np.put(a.mask, ind, v_mask, mode=mode)\n    return None"},{"col":4,"comment":"null","endLoc":440,"header":"def __setitem__(self, index, value)","id":11076,"name":"__setitem__","nodeType":"Function","startLoc":436,"text":"def __setitem__(self, index, value):\n        data, mask = self._masked._get_data_and_mask(value, allow_ma_masked=True)\n        if data is not None:\n            self._dataiter[index] = data\n        self._maskiter[index] = mask"},{"col":4,"comment":"\n        Return the next value, or raise StopIteration.\n        ","endLoc":448,"header":"def __next__(self)","id":11077,"name":"__next__","nodeType":"Function","startLoc":442,"text":"def __next__(self):\n        \"\"\"\n        Return the next value, or raise StopIteration.\n        \"\"\"\n        out = next(self._dataiter)[...]\n        mask = next(self._maskiter)[...]\n        return self._masked.from_unmasked(out, mask, copy=False)"},{"attributeType":"function","col":4,"comment":"null","endLoc":450,"id":11078,"name":"next","nodeType":"Attribute","startLoc":450,"text":"next"},{"attributeType":"null","col":8,"comment":"null","endLoc":419,"id":11079,"name":"_dataiter","nodeType":"Attribute","startLoc":419,"text":"self._dataiter"},{"attributeType":"{unmasked, mask}","col":8,"comment":"null","endLoc":418,"id":11080,"name":"_masked","nodeType":"Attribute","startLoc":418,"text":"self._masked"},{"attributeType":"null","col":8,"comment":"null","endLoc":420,"id":11081,"name":"_maskiter","nodeType":"Attribute","startLoc":420,"text":"self._maskiter"},{"col":4,"comment":"\n        Potentially update the IERS table in place depending on the requested\n        time values in ``mdj`` and the time span of the table.  The base behavior\n        is not to update the table.  ``IERS_Auto`` overrides this method.\n        ","endLoc":423,"header":"def _refresh_table_as_needed(self, mjd)","id":11082,"name":"_refresh_table_as_needed","nodeType":"Function","startLoc":417,"text":"def _refresh_table_as_needed(self, mjd):\n        \"\"\"\n        Potentially update the IERS table in place depending on the requested\n        time values in ``mdj`` and the time span of the table.  The base behavior\n        is not to update the table.  ``IERS_Auto`` overrides this method.\n        \"\"\"\n        pass"},{"className":"MaskedNDArray","col":0,"comment":"null","endLoc":1119,"id":11083,"nodeType":"Class","startLoc":453,"text":"class MaskedNDArray(Masked, np.ndarray, base_cls=np.ndarray, data_cls=np.ndarray):\n    _mask = None\n\n    info = MaskedNDArrayInfo()\n\n    def __new__(cls, *args, mask=None, **kwargs):\n        \"\"\"Get data class instance from arguments and then set mask.\"\"\"\n        self = super().__new__(cls, *args, **kwargs)\n        if mask is not None:\n            self.mask = mask\n        elif self._mask is None:\n            self.mask = False\n        return self\n\n    def __init_subclass__(cls, **kwargs):\n        super().__init_subclass__(cls, **kwargs)\n        # For all subclasses we should set a default __new__ that passes on\n        # arguments other than mask to the data class, and then sets the mask.\n        if '__new__' not in cls.__dict__:\n            def __new__(newcls, *args, mask=None, **kwargs):\n                \"\"\"Get data class instance from arguments and then set mask.\"\"\"\n                # Need to explicitly mention classes outside of class definition.\n                self = super(cls, newcls).__new__(newcls, *args, **kwargs)\n                if mask is not None:\n                    self.mask = mask\n                elif self._mask is None:\n                    self.mask = False\n                return self\n            cls.__new__ = __new__\n\n        if 'info' not in cls.__dict__ and hasattr(cls._data_cls, 'info'):\n            data_info = cls._data_cls.info\n            attr_names = data_info.attr_names | {'serialize_method'}\n            new_info = type(cls.__name__+'Info',\n                            (MaskedArraySubclassInfo, data_info.__class__),\n                            dict(attr_names=attr_names))\n            cls.info = new_info()\n\n    # The two pieces typically overridden.\n    @classmethod\n    def from_unmasked(cls, data, mask=None, copy=False):\n        # Note: have to override since __new__ would use ndarray.__new__\n        # which expects the shape as its first argument, not an array.\n        data = np.array(data, subok=True, copy=copy)\n        self = data.view(cls)\n        self._set_mask(mask, copy=copy)\n        return self\n\n    @property\n    def unmasked(self):\n        return super().view(self._data_cls)\n\n    @classmethod\n    def _get_masked_cls(cls, data_cls):\n        # Short-cuts\n        if data_cls is np.ndarray:\n            return MaskedNDArray\n        elif data_cls is None:  # for .view()\n            return cls\n\n        return super()._get_masked_cls(data_cls)\n\n    @property\n    def flat(self):\n        \"\"\"A 1-D iterator over the Masked array.\n\n        This returns a ``MaskedIterator`` instance, which behaves the same\n        as the `~numpy.flatiter` instance returned by `~numpy.ndarray.flat`,\n        and is similar to Python's built-in iterator, except that it also\n        allows assignment.\n        \"\"\"\n        return MaskedIterator(self)\n\n    @property\n    def _baseclass(self):\n        \"\"\"Work-around for MaskedArray initialization.\n\n        Allows the base class to be inferred correctly when a masked instance\n        is used to initialize (or viewed as) a `~numpy.ma.MaskedArray`.\n\n        \"\"\"\n        return self._data_cls\n\n    def view(self, dtype=None, type=None):\n        \"\"\"New view of the masked array.\n\n        Like `numpy.ndarray.view`, but always returning a masked array subclass.\n        \"\"\"\n        if type is None and (isinstance(dtype, builtins.type)\n                             and issubclass(dtype, np.ndarray)):\n            return super().view(self._get_masked_cls(dtype))\n\n        if dtype is None:\n            return super().view(self._get_masked_cls(type))\n\n        dtype = np.dtype(dtype)\n        if not (dtype.itemsize == self.dtype.itemsize\n                and (dtype.names is None\n                     or len(dtype.names) == len(self.dtype.names))):\n            raise NotImplementedError(\n                f\"{self.__class__} cannot be viewed with a dtype with a \"\n                f\"with a different number of fields or size.\")\n\n        return super().view(dtype, self._get_masked_cls(type))\n\n    def __array_finalize__(self, obj):\n        # If we're a new object or viewing an ndarray, nothing has to be done.\n        if obj is None or obj.__class__ is np.ndarray:\n            return\n\n        # Logically, this should come from ndarray and hence be None, but\n        # just in case someone creates a new mixin, we check.\n        super_array_finalize = super().__array_finalize__\n        if super_array_finalize:  # pragma: no cover\n            super_array_finalize(obj)\n\n        if self._mask is None:\n            # Got here after, e.g., a view of another masked class.\n            # Get its mask, or initialize ours.\n            self._set_mask(getattr(obj, '_mask', False))\n\n        if 'info' in obj.__dict__:\n            self.info = obj.info\n\n    @property\n    def shape(self):\n        \"\"\"The shape of the data and the mask.\n\n        Usually used to get the current shape of an array, but may also be\n        used to reshape the array in-place by assigning a tuple of array\n        dimensions to it.  As with `numpy.reshape`, one of the new shape\n        dimensions can be -1, in which case its value is inferred from the\n        size of the array and the remaining dimensions.\n\n        Raises\n        ------\n        AttributeError\n            If a copy is required, of either the data or the mask.\n\n        \"\"\"\n        # Redefinition to allow defining a setter and add a docstring.\n        return super().shape\n\n    @shape.setter\n    def shape(self, shape):\n        old_shape = self.shape\n        self._mask.shape = shape\n        # Reshape array proper in try/except just in case some broadcasting\n        # or so causes it to fail.\n        try:\n            super(MaskedNDArray, type(self)).shape.__set__(self, shape)\n        except Exception as exc:\n            self._mask.shape = old_shape\n            # Given that the mask reshaping succeeded, the only logical\n            # reason for an exception is something like a broadcast error in\n            # in __array_finalize__, or a different memory ordering between\n            # mask and data.  For those, give a more useful error message;\n            # otherwise just raise the error.\n            if 'could not broadcast' in exc.args[0]:\n                raise AttributeError(\n                    'Incompatible shape for in-place modification. '\n                    'Use `.reshape()` to make a copy with the desired '\n                    'shape.') from None\n            else:  # pragma: no cover\n                raise\n\n    _eq_simple = _comparison_method('__eq__')\n    _ne_simple = _comparison_method('__ne__')\n    __lt__ = _comparison_method('__lt__')\n    __le__ = _comparison_method('__le__')\n    __gt__ = _comparison_method('__gt__')\n    __ge__ = _comparison_method('__ge__')\n\n    def __eq__(self, other):\n        if not self.dtype.names:\n            return self._eq_simple(other)\n\n        # For structured arrays, we treat this as a reduction over the fields,\n        # where masked fields are skipped and thus do not influence the result.\n        other = np.asanyarray(other, dtype=self.dtype)\n        result = np.stack([self[field] == other[field]\n                           for field in self.dtype.names], axis=-1)\n        return result.all(axis=-1)\n\n    def __ne__(self, other):\n        if not self.dtype.names:\n            return self._ne_simple(other)\n\n        # For structured arrays, we treat this as a reduction over the fields,\n        # where masked fields are skipped and thus do not influence the result.\n        other = np.asanyarray(other, dtype=self.dtype)\n        result = np.stack([self[field] != other[field]\n                           for field in self.dtype.names], axis=-1)\n        return result.any(axis=-1)\n\n    def _combine_masks(self, masks, out=None):\n        masks = [m for m in masks if m is not None and m is not False]\n        if not masks:\n            return False\n        if len(masks) == 1:\n            if out is None:\n                return masks[0].copy()\n            else:\n                np.copyto(out, masks[0])\n                return out\n\n        out = np.logical_or(masks[0], masks[1], out=out)\n        for mask in masks[2:]:\n            np.logical_or(out, mask, out=out)\n        return out\n\n    def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):\n        out = kwargs.pop('out', None)\n        out_unmasked = None\n        out_mask = None\n        if out is not None:\n            out_unmasked, out_masks = self._get_data_and_masks(*out)\n            for d, m in zip(out_unmasked, out_masks):\n                if m is None:\n                    # TODO: allow writing to unmasked output if nothing is masked?\n                    if d is not None:\n                        raise TypeError('cannot write to unmasked output')\n                elif out_mask is None:\n                    out_mask = m\n\n        unmasked, masks = self._get_data_and_masks(*inputs)\n\n        if ufunc.signature:\n            # We're dealing with a gufunc. For now, only deal with\n            # np.matmul and gufuncs for which the mask of any output always\n            # depends on all core dimension values of all inputs.\n            # Also ignore axes keyword for now...\n            # TODO: in principle, it should be possible to generate the mask\n            # purely based on the signature.\n            if 'axes' in kwargs:\n                raise NotImplementedError(\"Masked does not yet support gufunc \"\n                                          \"calls with 'axes'.\")\n            if ufunc is np.matmul:\n                # np.matmul is tricky and its signature cannot be parsed by\n                # _parse_gufunc_signature.\n                unmasked = np.atleast_1d(*unmasked)\n                mask0, mask1 = masks\n                masks = []\n                is_mat1 = unmasked[1].ndim >= 2\n                if mask0 is not None:\n                    masks.append(\n                        np.logical_or.reduce(mask0, axis=-1, keepdims=is_mat1))\n\n                if mask1 is not None:\n                    masks.append(\n                        np.logical_or.reduce(mask1, axis=-2, keepdims=True)\n                        if is_mat1 else\n                        np.logical_or.reduce(mask1))\n\n                mask = self._combine_masks(masks, out=out_mask)\n\n            else:\n                # Parse signature with private numpy function. Note it\n                # cannot handle spaces in tuples, so remove those.\n                in_sig, out_sig = np.lib.function_base._parse_gufunc_signature(\n                    ufunc.signature.replace(' ', ''))\n                axis = kwargs.get('axis', -1)\n                keepdims = kwargs.get('keepdims', False)\n                in_masks = []\n                for sig, mask in zip(in_sig, masks):\n                    if mask is not None:\n                        if sig:\n                            # Input has core dimensions.  Assume that if any\n                            # value in those is masked, the output will be\n                            # masked too (TODO: for multiple core dimensions\n                            # this may be too strong).\n                            mask = np.logical_or.reduce(\n                                mask, axis=axis, keepdims=keepdims)\n                        in_masks.append(mask)\n\n                mask = self._combine_masks(in_masks)\n                result_masks = []\n                for os in out_sig:\n                    if os:\n                        # Output has core dimensions.  Assume all those\n                        # get the same mask.\n                        result_mask = np.expand_dims(mask, axis)\n                    else:\n                        result_mask = mask\n                    result_masks.append(result_mask)\n\n                mask = result_masks if len(result_masks) > 1 else result_masks[0]\n\n        elif method == '__call__':\n            # Regular ufunc call.\n            mask = self._combine_masks(masks, out=out_mask)\n\n        elif method == 'outer':\n            # Must have two arguments; adjust masks as will be done for data.\n            assert len(masks) == 2\n            masks = [(m if m is not None else False) for m in masks]\n            mask = np.logical_or.outer(masks[0], masks[1], out=out_mask)\n\n        elif method in {'reduce', 'accumulate'}:\n            # Reductions like np.add.reduce (sum).\n            if masks[0] is not None:\n                # By default, we simply propagate masks, since for\n                # things like np.sum, it makes no sense to do otherwise.\n                # Individual methods need to override as needed.\n                # TODO: take care of 'out' too?\n                if method == 'reduce':\n                    axis = kwargs.get('axis', None)\n                    keepdims = kwargs.get('keepdims', False)\n                    where = kwargs.get('where', True)\n                    mask = np.logical_or.reduce(masks[0], where=where,\n                                                axis=axis, keepdims=keepdims,\n                                                out=out_mask)\n                    if where is not True:\n                        # Mask also whole rows that were not selected by where,\n                        # so would have been left as unmasked above.\n                        mask |= np.logical_and.reduce(masks[0], where=where,\n                                                      axis=axis, keepdims=keepdims)\n\n                else:\n                    # Accumulate\n                    axis = kwargs.get('axis', 0)\n                    mask = np.logical_or.accumulate(masks[0], axis=axis,\n                                                    out=out_mask)\n\n            elif out is not None:\n                mask = False\n\n            else:  # pragma: no cover\n                # Can only get here if neither input nor output was masked, but\n                # perhaps axis or where was masked (in numpy < 1.21 this is\n                # possible).  We don't support this.\n                return NotImplemented\n\n        elif method in {'reduceat', 'at'}:  # pragma: no cover\n            # TODO: implement things like np.add.accumulate (used for cumsum).\n            raise NotImplementedError(\"masked instances cannot yet deal with \"\n                                      \"'reduceat' or 'at'.\")\n\n        if out_unmasked is not None:\n            kwargs['out'] = out_unmasked\n        result = getattr(ufunc, method)(*unmasked, **kwargs)\n\n        if result is None:  # pragma: no cover\n            # This happens for the \"at\" method.\n            return result\n\n        if out is not None and len(out) == 1:\n            out = out[0]\n        return self._masked_result(result, mask, out)\n\n    def __array_function__(self, function, types, args, kwargs):\n        # TODO: go through functions systematically to see which ones\n        # work and/or can be supported.\n        if function in MASKED_SAFE_FUNCTIONS:\n            return super().__array_function__(function, types, args, kwargs)\n\n        elif function in APPLY_TO_BOTH_FUNCTIONS:\n            helper = APPLY_TO_BOTH_FUNCTIONS[function]\n            try:\n                helper_result = helper(*args, **kwargs)\n            except NotImplementedError:\n                return self._not_implemented_or_raise(function, types)\n\n            data_args, mask_args, kwargs, out = helper_result\n            if out is not None:\n                if not isinstance(out, Masked):\n                    return self._not_implemented_or_raise(function, types)\n                function(*mask_args, out=out.mask, **kwargs)\n                function(*data_args, out=out.unmasked, **kwargs)\n                return out\n\n            mask = function(*mask_args, **kwargs)\n            result = function(*data_args, **kwargs)\n\n        elif function in DISPATCHED_FUNCTIONS:\n            dispatched_function = DISPATCHED_FUNCTIONS[function]\n            try:\n                dispatched_result = dispatched_function(*args, **kwargs)\n            except NotImplementedError:\n                return self._not_implemented_or_raise(function, types)\n\n            if not isinstance(dispatched_result, tuple):\n                return dispatched_result\n\n            result, mask, out = dispatched_result\n\n        elif function in UNSUPPORTED_FUNCTIONS:\n            return NotImplemented\n\n        else:  # pragma: no cover\n            # By default, just pass it through for now.\n            return super().__array_function__(function, types, args, kwargs)\n\n        if mask is None:\n            return result\n        else:\n            return self._masked_result(result, mask, out)\n\n    def _not_implemented_or_raise(self, function, types):\n        # Our function helper or dispatcher found that the function does not\n        # work with Masked.  In principle, there may be another class that\n        # knows what to do with us, for which we should return NotImplemented.\n        # But if there is ndarray (or a non-Masked subclass of it) around,\n        # it quite likely coerces, so we should just break.\n        if any(issubclass(t, np.ndarray) and not issubclass(t, Masked)\n               for t in types):\n            raise TypeError(\"the MaskedNDArray implementation cannot handle {} \"\n                            \"with the given arguments.\"\n                            .format(function)) from None\n        else:\n            return NotImplemented\n\n    def _masked_result(self, result, mask, out):\n        if isinstance(result, tuple):\n            if out is None:\n                out = (None,) * len(result)\n            if not isinstance(mask, (list, tuple)):\n                mask = (mask,) * len(result)\n            return tuple(self._masked_result(result_, mask_, out_)\n                         for (result_, mask_, out_) in zip(result, mask, out))\n\n        if out is None:\n            # Note that we cannot count on result being the same class as\n            # 'self' (e.g., comparison of quantity results in an ndarray, most\n            # operations on Longitude and Latitude result in Angle or\n            # Quantity), so use Masked to determine the appropriate class.\n            return Masked(result, mask)\n\n        # TODO: remove this sanity check once test cases are more complete.\n        assert isinstance(out, Masked)\n        # If we have an output, the result was written in-place, so we should\n        # also write the mask in-place (if not done already in the code).\n        if out._mask is not mask:\n            out._mask[...] = mask\n        return out\n\n    # Below are ndarray methods that need to be overridden as masked elements\n    # need to be skipped and/or an initial value needs to be set.\n    def _reduce_defaults(self, kwargs, initial_func=None):\n        \"\"\"Get default where and initial for masked reductions.\n\n        Generally, the default should be to skip all masked elements.  For\n        reductions such as np.minimum.reduce, we also need an initial value,\n        which can be determined using ``initial_func``.\n\n        \"\"\"\n        if 'where' not in kwargs:\n            kwargs['where'] = ~self.mask\n        if initial_func is not None and 'initial' not in kwargs:\n            kwargs['initial'] = initial_func(self.unmasked)\n        return kwargs\n\n    def trace(self, offset=0, axis1=0, axis2=1, dtype=None, out=None):\n        # Unfortunately, cannot override the call to diagonal inside trace, so\n        # duplicate implementation in numpy/core/src/multiarray/calculation.c.\n        diagonal = self.diagonal(offset=offset, axis1=axis1, axis2=axis2)\n        return diagonal.sum(-1, dtype=dtype, out=out)\n\n    def min(self, axis=None, out=None, **kwargs):\n        return super().min(axis=axis, out=out,\n                           **self._reduce_defaults(kwargs, np.nanmax))\n\n    def max(self, axis=None, out=None, **kwargs):\n        return super().max(axis=axis, out=out,\n                           **self._reduce_defaults(kwargs, np.nanmin))\n\n    def nonzero(self):\n        unmasked_nonzero = self.unmasked.nonzero()\n        if self.ndim >= 1:\n            not_masked = ~self.mask[unmasked_nonzero]\n            return tuple(u[not_masked] for u in unmasked_nonzero)\n        else:\n            return unmasked_nonzero if not self.mask else np.nonzero(0)\n\n    def compress(self, condition, axis=None, out=None):\n        if out is not None:\n            raise NotImplementedError('cannot yet give output')\n        return self._apply('compress', condition, axis=axis)\n\n    def repeat(self, repeats, axis=None):\n        return self._apply('repeat', repeats, axis=axis)\n\n    def choose(self, choices, out=None, mode='raise'):\n        # Let __array_function__ take care since choices can be masked too.\n        return np.choose(self, choices, out=out, mode=mode)\n\n    def argmin(self, axis=None, out=None):\n        # Todo: should this return a masked integer array, with masks\n        # if all elements were masked?\n        at_min = self == self.min(axis=axis, keepdims=True)\n        return at_min.filled(False).argmax(axis=axis, out=out)\n\n    def argmax(self, axis=None, out=None):\n        at_max = self == self.max(axis=axis, keepdims=True)\n        return at_max.filled(False).argmax(axis=axis, out=out)\n\n    def argsort(self, axis=-1, kind=None, order=None):\n        \"\"\"Returns the indices that would sort an array.\n\n        Perform an indirect sort along the given axis on both the array\n        and the mask, with masked items being sorted to the end.\n\n        Parameters\n        ----------\n        axis : int or None, optional\n            Axis along which to sort.  The default is -1 (the last axis).\n            If None, the flattened array is used.\n        kind : str or None, ignored.\n            The kind of sort.  Present only to allow subclasses to work.\n        order : str or list of str.\n            For an array with fields defined, the fields to compare first,\n            second, etc.  A single field can be specified as a string, and not\n            all fields need be specified, but unspecified fields will still be\n            used, in dtype order, to break ties.\n\n        Returns\n        -------\n        index_array : ndarray, int\n            Array of indices that sorts along the specified ``axis``.  Use\n            ``np.take_along_axis(self, index_array, axis=axis)`` to obtain\n            the sorted array.\n\n        \"\"\"\n        if axis is None:\n            data = self.ravel()\n            axis = -1\n        else:\n            data = self\n\n        if self.dtype.names:\n            # As done inside the argsort implementation in multiarray/methods.c.\n            if order is None:\n                order = self.dtype.names\n            else:\n                order = np.core._internal._newnames(self.dtype, order)\n\n            keys = tuple(data[name] for name in order[::-1])\n\n        elif order is not None:\n            raise ValueError('Cannot specify order when the array has no fields.')\n\n        else:\n            keys = (data,)\n\n        return np.lexsort(keys, axis=axis)\n\n    def sort(self, axis=-1, kind=None, order=None):\n        \"\"\"Sort an array in-place. Refer to `numpy.sort` for full documentation.\"\"\"\n        # TODO: probably possible to do this faster than going through argsort!\n        indices = self.argsort(axis, kind=kind, order=order)\n        self[:] = np.take_along_axis(self, indices, axis=axis)\n\n    def argpartition(self, kth, axis=-1, kind='introselect', order=None):\n        # TODO: should be possible to do this faster than with a full argsort!\n        return self.argsort(axis=axis, order=order)\n\n    def partition(self, kth, axis=-1, kind='introselect', order=None):\n        # TODO: should be possible to do this faster than with a full argsort!\n        return self.sort(axis=axis, order=None)\n\n    def cumsum(self, axis=None, dtype=None, out=None):\n        if axis is None:\n            self = self.ravel()\n            axis = 0\n        return np.add.accumulate(self, axis=axis, dtype=dtype, out=out)\n\n    def cumprod(self, axis=None, dtype=None, out=None):\n        if axis is None:\n            self = self.ravel()\n            axis = 0\n        return np.multiply.accumulate(self, axis=axis, dtype=dtype, out=out)\n\n    def clip(self, min=None, max=None, out=None, **kwargs):\n        \"\"\"Return an array whose values are limited to ``[min, max]``.\n\n        Like `~numpy.clip`, but any masked values in ``min`` and ``max``\n        are ignored for clipping.  The mask of the input array is propagated.\n        \"\"\"\n        # TODO: implement this at the ufunc level.\n        dmin, mmin = self._get_data_and_mask(min)\n        dmax, mmax = self._get_data_and_mask(max)\n        if mmin is None and mmax is None:\n            # Fast path for unmasked max, min.\n            return super().clip(min, max, out=out, **kwargs)\n\n        masked_out = np.positive(self, out=out)\n        out = masked_out.unmasked\n        if dmin is not None:\n            np.maximum(out, dmin, out=out, where=True if mmin is None else ~mmin)\n        if dmax is not None:\n            np.minimum(out, dmax, out=out, where=True if mmax is None else ~mmax)\n        return masked_out\n\n    def mean(self, axis=None, dtype=None, out=None, keepdims=False):\n        # Implementation based on that in numpy/core/_methods.py\n        # Cast bool, unsigned int, and int to float64 by default,\n        # and do float16 at higher precision.\n        is_float16_result = False\n        if dtype is None:\n            if issubclass(self.dtype.type, (np.integer, np.bool_)):\n                dtype = np.dtype('f8')\n            elif issubclass(self.dtype.type, np.float16):\n                dtype = np.dtype('f4')\n                is_float16_result = out is None\n\n        result = self.sum(axis=axis, dtype=dtype, out=out,\n                          keepdims=keepdims, where=~self.mask)\n        n = np.add.reduce(~self.mask, axis=axis, keepdims=keepdims)\n        result /= n\n        if is_float16_result:\n            result = result.astype(self.dtype)\n        return result\n\n    def var(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False):\n        # Simplified implementation based on that in numpy/core/_methods.py\n        n = np.add.reduce(~self.mask, axis=axis, keepdims=keepdims)[...]\n\n        # Cast bool, unsigned int, and int to float64 by default.\n        if dtype is None and issubclass(self.dtype.type,\n                                        (np.integer, np.bool_)):\n            dtype = np.dtype('f8')\n        mean = self.mean(axis=axis, dtype=dtype, keepdims=True)\n\n        x = self - mean\n        x *= x.conjugate()  # Conjugate just returns x if not complex.\n\n        result = x.sum(axis=axis, dtype=dtype, out=out,\n                       keepdims=keepdims, where=~x.mask)\n        n -= ddof\n        n = np.maximum(n, 0, out=n)\n        result /= n\n        result._mask |= (n == 0)\n        return result\n\n    def std(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False):\n        result = self.var(axis=axis, dtype=dtype, out=out, ddof=ddof,\n                          keepdims=keepdims)\n        return np.sqrt(result, out=result)\n\n    def __bool__(self):\n        # First get result from array itself; this will error if not a scalar.\n        result = super().__bool__()\n        return result and not self.mask\n\n    def any(self, axis=None, out=None, keepdims=False):\n        return np.logical_or.reduce(self, axis=axis, out=out,\n                                    keepdims=keepdims, where=~self.mask)\n\n    def all(self, axis=None, out=None, keepdims=False):\n        return np.logical_and.reduce(self, axis=axis, out=out,\n                                     keepdims=keepdims, where=~self.mask)\n\n    # Following overrides needed since somehow the ndarray implementation\n    # does not actually call these.\n    def __str__(self):\n        return np.array_str(self)\n\n    def __repr__(self):\n        return np.array_repr(self)\n\n    def __format__(self, format_spec):\n        string = super().__format__(format_spec)\n        if self.shape == () and self.mask:\n            n = min(3, max(1, len(string)))\n            return ' ' * (len(string)-n) + '\\u2014' * n\n        else:\n            return string"},{"col":4,"comment":"Get data class instance from arguments and then set mask.","endLoc":465,"header":"def __new__(cls, *args, mask=None, **kwargs)","id":11084,"name":"__new__","nodeType":"Function","startLoc":458,"text":"def __new__(cls, *args, mask=None, **kwargs):\n        \"\"\"Get data class instance from arguments and then set mask.\"\"\"\n        self = super().__new__(cls, *args, **kwargs)\n        if mask is not None:\n            self.mask = mask\n        elif self._mask is None:\n            self.mask = False\n        return self"},{"col":4,"comment":"null","endLoc":648,"header":"def _parse_with_caching(self, check)","id":11085,"name":"_parse_with_caching","nodeType":"Function","startLoc":637,"text":"def _parse_with_caching(self, check):\n        if check in self._cache:\n            fun_name, fun_args, fun_kwargs, default = self._cache[check]\n            # We call list and dict below to work with *copies* of the data\n            # rather than the original (which are mutable of course)\n            fun_args = list(fun_args)\n            fun_kwargs = dict(fun_kwargs)\n        else:\n            fun_name, fun_args, fun_kwargs, default = self._parse_check(check)\n            fun_kwargs = dict([(str(key), value) for (key, value) in list(fun_kwargs.items())])\n            self._cache[check] = fun_name, list(fun_args), dict(fun_kwargs), default\n        return fun_name, fun_args, fun_kwargs, default"},{"attributeType":"null","col":8,"comment":"null","endLoc":105,"id":11086,"name":"a_weekday","nodeType":"Attribute","startLoc":105,"text":"self.a_weekday"},{"col":4,"comment":"null","endLoc":697,"header":"def _parse_check(self, check)","id":11087,"name":"_parse_check","nodeType":"Function","startLoc":660,"text":"def _parse_check(self, check):\n        fun_match = self._func_re.match(check)\n        if fun_match:\n            fun_name = fun_match.group(1)\n            arg_string = fun_match.group(2)\n            arg_match = self._matchfinder.match(arg_string)\n            if arg_match is None:\n                # Bad syntax\n                raise VdtParamError('Bad syntax in check \"%s\".' % check)\n            fun_args = []\n            fun_kwargs = {}\n            # pull out args of group 2\n            for arg in self._paramfinder.findall(arg_string):\n                # args may need whitespace removing (before removing quotes)\n                arg = arg.strip()\n                listmatch = self._list_arg.match(arg)\n                if listmatch:\n                    key, val = self._list_handle(listmatch)\n                    fun_kwargs[key] = val\n                    continue\n                keymatch = self._key_arg.match(arg)\n                if keymatch:\n                    val = keymatch.group(2)\n                    if not val in (\"'None'\", '\"None\"'):\n                        # Special case a quoted None\n                        val = self._unquote(val)\n                    fun_kwargs[keymatch.group(1)] = val\n                    continue\n\n                fun_args.append(self._unquote(arg))\n        else:\n            # allows for function names without (args)\n            return check, (), {}, None\n\n        # Default must be deleted if the value is specified too,\n        # otherwise the check function will get a spurious \"default\" keyword arg\n        default = fun_kwargs.pop('default', None)\n        return fun_name, fun_args, fun_kwargs, default"},{"fileName":"__init__.py","filePath":"astropy/extern","id":11088,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis packages contains python packages that are bundled with Astropy but are\nexternal to Astropy, and hence are developed in a separate source tree.  Note\nthat this package is distinct from the /cextern directory of the source code\ndistribution, as that directory only contains C extension code.\n\nSee the README.rst in this directory of the Astropy source repository for more\ndetails.\n\"\"\"\n"},{"col":0,"comment":"Changes elements of an array based on conditional and input values.\n\n    Like `numpy.putmask`, but for masked array ``a`` and possibly masked\n    ``values``.  Masked ``mask`` is not supported.\n    ","endLoc":337,"header":"@dispatched_function\ndef putmask(a, mask, values)","id":11089,"name":"putmask","nodeType":"Function","startLoc":322,"text":"@dispatched_function\ndef putmask(a, mask, values):\n    \"\"\"Changes elements of an array based on conditional and input values.\n\n    Like `numpy.putmask`, but for masked array ``a`` and possibly masked\n    ``values``.  Masked ``mask`` is not supported.\n    \"\"\"\n    from astropy.utils.masked import Masked\n    if isinstance(mask, Masked) or not isinstance(a, Masked):\n        raise NotImplementedError\n\n    values_data, values_mask = a._get_data_and_mask(values)\n    if values_data is not None:\n        np.putmask(a.unmasked, mask, values_data)\n    np.putmask(a.mask, mask, values_mask)\n    return None"},{"col":0,"comment":"","endLoc":10,"header":"__init__.py#<anonymous>","id":11090,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis packages contains python packages that are bundled with Astropy but are\nexternal to Astropy, and hence are developed in a separate source tree.  Note\nthat this package is distinct from the /cextern directory of the source code\ndistribution, as that directory only contains C extension code.\n\nSee the README.rst in this directory of the Astropy source repository for more\ndetails.\n\"\"\""},{"id":11091,"name":"astropy/extern/ply","nodeType":"Package"},{"fileName":"ygen.py","filePath":"astropy/extern/ply","id":11092,"nodeType":"File","text":"# ply: ygen.py\n#\n# This is a support program that auto-generates different versions of the YACC parsing\n# function with different features removed for the purposes of performance.\n#\n# Users should edit the method LRParser.parsedebug() in yacc.py.   The source code\n# for that method is then used to create the other methods.   See the comments in\n# yacc.py for further details.\n\nimport os.path\nimport shutil\n\ndef get_source_range(lines, tag):\n    srclines = enumerate(lines)\n    start_tag = '#--! %s-start' % tag\n    end_tag = '#--! %s-end' % tag\n\n    for start_index, line in srclines:\n        if line.strip().startswith(start_tag):\n            break\n\n    for end_index, line in srclines:\n        if line.strip().endswith(end_tag):\n            break\n\n    return (start_index + 1, end_index)\n\ndef filter_section(lines, tag):\n    filtered_lines = []\n    include = True\n    tag_text = '#--! %s' % tag\n    for line in lines:\n        if line.strip().startswith(tag_text):\n            include = not include\n        elif include:\n            filtered_lines.append(line)\n    return filtered_lines\n\ndef main():\n    dirname = os.path.dirname(__file__)\n    shutil.copy2(os.path.join(dirname, 'yacc.py'), os.path.join(dirname, 'yacc.py.bak'))\n    with open(os.path.join(dirname, 'yacc.py'), 'r') as f:\n        lines = f.readlines()\n\n    parse_start, parse_end = get_source_range(lines, 'parsedebug')\n    parseopt_start, parseopt_end = get_source_range(lines, 'parseopt')\n    parseopt_notrack_start, parseopt_notrack_end = get_source_range(lines, 'parseopt-notrack')\n\n    # Get the original source\n    orig_lines = lines[parse_start:parse_end]\n\n    # Filter the DEBUG sections out\n    parseopt_lines = filter_section(orig_lines, 'DEBUG')\n\n    # Filter the TRACKING sections out\n    parseopt_notrack_lines = filter_section(parseopt_lines, 'TRACKING')\n\n    # Replace the parser source sections with updated versions\n    lines[parseopt_notrack_start:parseopt_notrack_end] = parseopt_notrack_lines\n    lines[parseopt_start:parseopt_end] = parseopt_lines\n\n    lines = [line.rstrip()+'\\n' for line in lines]\n    with open(os.path.join(dirname, 'yacc.py'), 'w') as f:\n        f.writelines(lines)\n\n    print('Updated yacc.py')\n\nif __name__ == '__main__':\n    main()\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":168,"id":11093,"name":"LC_date_time","nodeType":"Attribute","startLoc":168,"text":"self.LC_date_time"},{"attributeType":"null","col":8,"comment":"null","endLoc":181,"id":11094,"name":"daylight","nodeType":"Attribute","startLoc":181,"text":"self.daylight"},{"col":0,"comment":"null","endLoc":26,"header":"def get_source_range(lines, tag)","id":11095,"name":"get_source_range","nodeType":"Function","startLoc":13,"text":"def get_source_range(lines, tag):\n    srclines = enumerate(lines)\n    start_tag = '#--! %s-start' % tag\n    end_tag = '#--! %s-end' % tag\n\n    for start_index, line in srclines:\n        if line.strip().startswith(start_tag):\n            break\n\n    for end_index, line in srclines:\n        if line.strip().endswith(end_tag):\n            break\n\n    return (start_index + 1, end_index)"},{"col":0,"comment":"Change elements of an array based on conditional and input values.\n\n    Like `numpy.place`, but for masked array ``a`` and possibly masked\n    ``values``.  Masked ``mask`` is not supported.\n    ","endLoc":355,"header":"@dispatched_function\ndef place(arr, mask, vals)","id":11096,"name":"place","nodeType":"Function","startLoc":340,"text":"@dispatched_function\ndef place(arr, mask, vals):\n    \"\"\"Change elements of an array based on conditional and input values.\n\n    Like `numpy.place`, but for masked array ``a`` and possibly masked\n    ``values``.  Masked ``mask`` is not supported.\n    \"\"\"\n    from astropy.utils.masked import Masked\n    if isinstance(mask, Masked) or not isinstance(arr, Masked):\n        raise NotImplementedError\n\n    vals_data, vals_mask = arr._get_data_and_mask(vals)\n    if vals_data is not None:\n        np.place(arr.unmasked, mask, vals_data)\n    np.place(arr.mask, mask, vals_mask)\n    return None"},{"col":0,"comment":"null","endLoc":37,"header":"def filter_section(lines, tag)","id":11097,"name":"filter_section","nodeType":"Function","startLoc":28,"text":"def filter_section(lines, tag):\n    filtered_lines = []\n    include = True\n    tag_text = '#--! %s' % tag\n    for line in lines:\n        if line.strip().startswith(tag_text):\n            include = not include\n        elif include:\n            filtered_lines.append(line)\n    return filtered_lines"},{"col":0,"comment":"Copies values from one array to another, broadcasting as necessary.\n\n    Like `numpy.copyto`, but for masked destination ``dst`` and possibly\n    masked source ``src``.\n    ","endLoc":375,"header":"@dispatched_function\ndef copyto(dst, src,  casting='same_kind', where=True)","id":11098,"name":"copyto","nodeType":"Function","startLoc":358,"text":"@dispatched_function\ndef copyto(dst, src,  casting='same_kind', where=True):\n    \"\"\"Copies values from one array to another, broadcasting as necessary.\n\n    Like `numpy.copyto`, but for masked destination ``dst`` and possibly\n    masked source ``src``.\n    \"\"\"\n    from astropy.utils.masked import Masked\n    if not isinstance(dst, Masked) or isinstance(where, Masked):\n        raise NotImplementedError\n\n    src_data, src_mask = dst._get_data_and_mask(src)\n\n    if src_data is not None:\n        np.copyto(dst.unmasked, src_data, casting=casting, where=where)\n    if src_mask is not None:\n        np.copyto(dst.mask, src_mask, where=where)\n    return None"},{"attributeType":"null","col":8,"comment":"null","endLoc":187,"id":11099,"name":"timezone","nodeType":"Attribute","startLoc":187,"text":"self.timezone"},{"col":0,"comment":"null","endLoc":382,"header":"@dispatched_function\ndef packbits(a, *args, **kwargs)","id":11100,"name":"packbits","nodeType":"Function","startLoc":378,"text":"@dispatched_function\ndef packbits(a, *args, **kwargs):\n    result = np.packbits(a.unmasked, *args, **kwargs)\n    mask = np.packbits(a.mask, *args, **kwargs).astype(bool)\n    return result, mask, None"},{"col":0,"comment":"null","endLoc":391,"header":"@dispatched_function\ndef unpackbits(a, *args, **kwargs)","id":11101,"name":"unpackbits","nodeType":"Function","startLoc":385,"text":"@dispatched_function\ndef unpackbits(a, *args, **kwargs):\n    result = np.unpackbits(a.unmasked, *args, **kwargs)\n    mask = np.zeros(a.shape, dtype='u1')\n    mask[a.mask] = 255\n    mask = np.unpackbits(mask, *args, **kwargs).astype(bool)\n    return result, mask, None"},{"col":0,"comment":"Count number of occurrences of each value in array of non-negative ints.\n\n    Like `numpy.bincount`, but masked entries in ``x`` will be skipped.\n    Any masked entries in ``weights`` will lead the corresponding bin to\n    be masked.\n    ","endLoc":417,"header":"@dispatched_function\ndef bincount(x, weights=None, minlength=0)","id":11102,"name":"bincount","nodeType":"Function","startLoc":394,"text":"@dispatched_function\ndef bincount(x, weights=None, minlength=0):\n    \"\"\"Count number of occurrences of each value in array of non-negative ints.\n\n    Like `numpy.bincount`, but masked entries in ``x`` will be skipped.\n    Any masked entries in ``weights`` will lead the corresponding bin to\n    be masked.\n    \"\"\"\n    from astropy.utils.masked import Masked\n    if weights is not None:\n        weights = np.asanyarray(weights)\n    if isinstance(x, Masked) and x.ndim <= 1:\n        # let other dimensions lead to errors.\n        if weights is not None and weights.ndim == x.ndim:\n            weights = weights[~x.mask]\n        x = x.unmasked[~x.mask]\n    mask = None\n    if weights is not None:\n        weights, w_mask = Masked._get_data_and_mask(weights)\n        if w_mask is not None:\n            mask = np.bincount(x, w_mask.astype(int),\n                               minlength=minlength).astype(bool)\n    result = np.bincount(x, weights, minlength=0)\n    return result, mask, None"},{"col":0,"comment":"null","endLoc":66,"header":"def main()","id":11103,"name":"main","nodeType":"Function","startLoc":39,"text":"def main():\n    dirname = os.path.dirname(__file__)\n    shutil.copy2(os.path.join(dirname, 'yacc.py'), os.path.join(dirname, 'yacc.py.bak'))\n    with open(os.path.join(dirname, 'yacc.py'), 'r') as f:\n        lines = f.readlines()\n\n    parse_start, parse_end = get_source_range(lines, 'parsedebug')\n    parseopt_start, parseopt_end = get_source_range(lines, 'parseopt')\n    parseopt_notrack_start, parseopt_notrack_end = get_source_range(lines, 'parseopt-notrack')\n\n    # Get the original source\n    orig_lines = lines[parse_start:parse_end]\n\n    # Filter the DEBUG sections out\n    parseopt_lines = filter_section(orig_lines, 'DEBUG')\n\n    # Filter the TRACKING sections out\n    parseopt_notrack_lines = filter_section(parseopt_lines, 'TRACKING')\n\n    # Replace the parser source sections with updated versions\n    lines[parseopt_notrack_start:parseopt_notrack_end] = parseopt_notrack_lines\n    lines[parseopt_start:parseopt_end] = parseopt_lines\n\n    lines = [line.rstrip()+'\\n' for line in lines]\n    with open(os.path.join(dirname, 'yacc.py'), 'w') as f:\n        f.writelines(lines)\n\n    print('Updated yacc.py')"},{"col":4,"comment":"\n        Check that the indices from interpolation match those after clipping\n        to the valid table range.  This method gets overridden in the IERS_Auto\n        class because it has different requirements.\n        ","endLoc":355,"header":"def _check_interpolate_indices(self, indices_orig, indices_clipped, max_input_mjd)","id":11104,"name":"_check_interpolate_indices","nodeType":"Function","startLoc":347,"text":"def _check_interpolate_indices(self, indices_orig, indices_clipped, max_input_mjd):\n        \"\"\"\n        Check that the indices from interpolation match those after clipping\n        to the valid table range.  This method gets overridden in the IERS_Auto\n        class because it has different requirements.\n        \"\"\"\n        if np.any(indices_orig != indices_clipped):\n            raise IERSRangeError('(some) times are outside of range covered '\n                                 'by IERS table.')"},{"col":4,"comment":"Interpolate CIP corrections in IERS Table for given dates.\n\n        Parameters\n        ----------\n        jd1 : float, array of float, or `~astropy.time.Time` object\n            first part of two-part JD, or Time object\n        jd2 : float or float array, optional\n            second part of two-part JD (default 0., ignored if jd1 is Time)\n        return_status : bool\n            Whether to return status values.  If False (default),\n            raise ``IERSRangeError`` if any time is out of the range covered\n            by the IERS table.\n\n        Returns\n        -------\n        D_x : `~astropy.units.Quantity` ['angle']\n            x component of CIP correction for the requested times.\n        D_y : `~astropy.units.Quantity` ['angle']\n            y component of CIP correction for the requested times\n        status : int or int array\n            Status values (if ``return_status``=``True``)::\n            ``iers.FROM_IERS_B``\n            ``iers.FROM_IERS_A``\n            ``iers.FROM_IERS_A_PREDICTION``\n            ``iers.TIME_BEFORE_IERS_RANGE``\n            ``iers.TIME_BEYOND_IERS_RANGE``\n        ","endLoc":313,"header":"def dcip_xy(self, jd1, jd2=0., return_status=False)","id":11105,"name":"dcip_xy","nodeType":"Function","startLoc":284,"text":"def dcip_xy(self, jd1, jd2=0., return_status=False):\n        \"\"\"Interpolate CIP corrections in IERS Table for given dates.\n\n        Parameters\n        ----------\n        jd1 : float, array of float, or `~astropy.time.Time` object\n            first part of two-part JD, or Time object\n        jd2 : float or float array, optional\n            second part of two-part JD (default 0., ignored if jd1 is Time)\n        return_status : bool\n            Whether to return status values.  If False (default),\n            raise ``IERSRangeError`` if any time is out of the range covered\n            by the IERS table.\n\n        Returns\n        -------\n        D_x : `~astropy.units.Quantity` ['angle']\n            x component of CIP correction for the requested times.\n        D_y : `~astropy.units.Quantity` ['angle']\n            y component of CIP correction for the requested times\n        status : int or int array\n            Status values (if ``return_status``=``True``)::\n            ``iers.FROM_IERS_B``\n            ``iers.FROM_IERS_A``\n            ``iers.FROM_IERS_A_PREDICTION``\n            ``iers.TIME_BEFORE_IERS_RANGE``\n            ``iers.TIME_BEYOND_IERS_RANGE``\n        \"\"\"\n        return self._interpolate(jd1, jd2, ['dX_2000A', 'dY_2000A'],\n                                 self.dcip_source if return_status else None)"},{"col":0,"comment":"","endLoc":10,"header":"ygen.py#<anonymous>","id":11106,"name":"<anonymous>","nodeType":"Function","startLoc":10,"text":"if __name__ == '__main__':\n    main()"},{"col":4,"comment":"Interpolate polar motions from IERS Table for given dates.\n\n        Parameters\n        ----------\n        jd1 : float, array of float, or `~astropy.time.Time` object\n            first part of two-part JD, or Time object\n        jd2 : float or float array, optional\n            second part of two-part JD.\n            Default is 0., ignored if jd1 is `~astropy.time.Time`.\n        return_status : bool\n            Whether to return status values.  If False (default),\n            raise ``IERSRangeError`` if any time is out of the range covered\n            by the IERS table.\n\n        Returns\n        -------\n        PM_x : `~astropy.units.Quantity` ['angle']\n            x component of polar motion for the requested times.\n        PM_y : `~astropy.units.Quantity` ['angle']\n            y component of polar motion for the requested times.\n        status : int or int array\n            Status values (if ``return_status``=``True``)::\n            ``iers.FROM_IERS_B``\n            ``iers.FROM_IERS_A``\n            ``iers.FROM_IERS_A_PREDICTION``\n            ``iers.TIME_BEFORE_IERS_RANGE``\n            ``iers.TIME_BEYOND_IERS_RANGE``\n        ","endLoc":345,"header":"def pm_xy(self, jd1, jd2=0., return_status=False)","id":11107,"name":"pm_xy","nodeType":"Function","startLoc":315,"text":"def pm_xy(self, jd1, jd2=0., return_status=False):\n        \"\"\"Interpolate polar motions from IERS Table for given dates.\n\n        Parameters\n        ----------\n        jd1 : float, array of float, or `~astropy.time.Time` object\n            first part of two-part JD, or Time object\n        jd2 : float or float array, optional\n            second part of two-part JD.\n            Default is 0., ignored if jd1 is `~astropy.time.Time`.\n        return_status : bool\n            Whether to return status values.  If False (default),\n            raise ``IERSRangeError`` if any time is out of the range covered\n            by the IERS table.\n\n        Returns\n        -------\n        PM_x : `~astropy.units.Quantity` ['angle']\n            x component of polar motion for the requested times.\n        PM_y : `~astropy.units.Quantity` ['angle']\n            y component of polar motion for the requested times.\n        status : int or int array\n            Status values (if ``return_status``=``True``)::\n            ``iers.FROM_IERS_B``\n            ``iers.FROM_IERS_A``\n            ``iers.FROM_IERS_A_PREDICTION``\n            ``iers.TIME_BEFORE_IERS_RANGE``\n            ``iers.TIME_BEYOND_IERS_RANGE``\n        \"\"\"\n        return self._interpolate(jd1, jd2, ['PM_x', 'PM_y'],\n                                 self.pm_source if return_status else None)"},{"fileName":"ctokens.py","filePath":"astropy/extern/ply","id":11108,"nodeType":"File","text":"# ----------------------------------------------------------------------\n# ctokens.py\n#\n# Token specifications for symbols in ANSI C and C++.  This file is\n# meant to be used as a library in other tokenizers.\n# ----------------------------------------------------------------------\n\n# Reserved words\n\ntokens = [\n    # Literals (identifier, integer constant, float constant, string constant, char const)\n    'ID', 'TYPEID', 'INTEGER', 'FLOAT', 'STRING', 'CHARACTER',\n\n    # Operators (+,-,*,/,%,|,&,~,^,<<,>>, ||, &&, !, <, <=, >, >=, ==, !=)\n    'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MODULO',\n    'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT',\n    'LOR', 'LAND', 'LNOT',\n    'LT', 'LE', 'GT', 'GE', 'EQ', 'NE',\n\n    # Assignment (=, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |=)\n    'EQUALS', 'TIMESEQUAL', 'DIVEQUAL', 'MODEQUAL', 'PLUSEQUAL', 'MINUSEQUAL',\n    'LSHIFTEQUAL','RSHIFTEQUAL', 'ANDEQUAL', 'XOREQUAL', 'OREQUAL',\n\n    # Increment/decrement (++,--)\n    'INCREMENT', 'DECREMENT',\n\n    # Structure dereference (->)\n    'ARROW',\n\n    # Ternary operator (?)\n    'TERNARY',\n\n    # Delimeters ( ) [ ] { } , . ; :\n    'LPAREN', 'RPAREN',\n    'LBRACKET', 'RBRACKET',\n    'LBRACE', 'RBRACE',\n    'COMMA', 'PERIOD', 'SEMI', 'COLON',\n\n    # Ellipsis (...)\n    'ELLIPSIS',\n]\n\n# Operators\nt_PLUS             = r'\\+'\nt_MINUS            = r'-'\nt_TIMES            = r'\\*'\nt_DIVIDE           = r'/'\nt_MODULO           = r'%'\nt_OR               = r'\\|'\nt_AND              = r'&'\nt_NOT              = r'~'\nt_XOR              = r'\\^'\nt_LSHIFT           = r'<<'\nt_RSHIFT           = r'>>'\nt_LOR              = r'\\|\\|'\nt_LAND             = r'&&'\nt_LNOT             = r'!'\nt_LT               = r'<'\nt_GT               = r'>'\nt_LE               = r'<='\nt_GE               = r'>='\nt_EQ               = r'=='\nt_NE               = r'!='\n\n# Assignment operators\n\nt_EQUALS           = r'='\nt_TIMESEQUAL       = r'\\*='\nt_DIVEQUAL         = r'/='\nt_MODEQUAL         = r'%='\nt_PLUSEQUAL        = r'\\+='\nt_MINUSEQUAL       = r'-='\nt_LSHIFTEQUAL      = r'<<='\nt_RSHIFTEQUAL      = r'>>='\nt_ANDEQUAL         = r'&='\nt_OREQUAL          = r'\\|='\nt_XOREQUAL         = r'\\^='\n\n# Increment/decrement\nt_INCREMENT        = r'\\+\\+'\nt_DECREMENT        = r'--'\n\n# ->\nt_ARROW            = r'->'\n\n# ?\nt_TERNARY          = r'\\?'\n\n# Delimeters\nt_LPAREN           = r'\\('\nt_RPAREN           = r'\\)'\nt_LBRACKET         = r'\\['\nt_RBRACKET         = r'\\]'\nt_LBRACE           = r'\\{'\nt_RBRACE           = r'\\}'\nt_COMMA            = r','\nt_PERIOD           = r'\\.'\nt_SEMI             = r';'\nt_COLON            = r':'\nt_ELLIPSIS         = r'\\.\\.\\.'\n\n# Identifiers\nt_ID = r'[A-Za-z_][A-Za-z0-9_]*'\n\n# Integer literal\nt_INTEGER = r'\\d+([uU]|[lL]|[uU][lL]|[lL][uU])?'\n\n# Floating literal\nt_FLOAT = r'((\\d+)(\\.\\d+)(e(\\+|-)?(\\d+))? | (\\d+)e(\\+|-)?(\\d+))([lL]|[fF])?'\n\n# String literal\nt_STRING = r'\\\"([^\\\\\\n]|(\\\\.))*?\\\"'\n\n# Character constant 'c' or L'c'\nt_CHARACTER = r'(L)?\\'([^\\\\\\n]|(\\\\.))*?\\''\n\n# Comment (C-Style)\ndef t_COMMENT(t):\n    r'/\\*(.|\\n)*?\\*/'\n    t.lexer.lineno += t.value.count('\\n')\n    return t\n\n# Comment (C++-Style)\ndef t_CPPCOMMENT(t):\n    r'//.*\\n'\n    t.lexer.lineno += 1\n    return t\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":125,"id":11109,"name":"am_pm","nodeType":"Attribute","startLoc":125,"text":"self.am_pm"},{"col":0,"comment":"/\\*(.|\\n)*?\\*/","endLoc":121,"header":"def t_COMMENT(t)","id":11110,"name":"t_COMMENT","nodeType":"Function","startLoc":118,"text":"def t_COMMENT(t):\n    r'/\\*(.|\\n)*?\\*/'\n    t.lexer.lineno += t.value.count('\\n')\n    return t"},{"col":0,"comment":"null","endLoc":424,"header":"@dispatched_function\ndef msort(a)","id":11111,"name":"msort","nodeType":"Function","startLoc":420,"text":"@dispatched_function\ndef msort(a):\n    result = a.copy()\n    result.sort(axis=0)\n    return result"},{"col":0,"comment":"null","endLoc":440,"header":"@dispatched_function\ndef sort_complex(a)","id":11112,"name":"sort_complex","nodeType":"Function","startLoc":427,"text":"@dispatched_function\ndef sort_complex(a):\n    # Just a copy of function_base.sort_complex, to avoid the asarray.\n    b = a.copy()\n    b.sort()\n    if not issubclass(b.dtype.type, np.complexfloating):  # pragma: no cover\n        if b.dtype.char in 'bhBH':\n            return b.astype('F')\n        elif b.dtype.char == 'g':\n            return b.astype('G')\n        else:\n            return b.astype('D')\n    else:\n        return b"},{"col":4,"comment":"Source for UT1-UTC.  To be overridden by subclass.","endLoc":427,"header":"def ut1_utc_source(self, i)","id":11113,"name":"ut1_utc_source","nodeType":"Function","startLoc":425,"text":"def ut1_utc_source(self, i):\n        \"\"\"Source for UT1-UTC.  To be overridden by subclass.\"\"\"\n        return np.zeros_like(i)"},{"col":0,"comment":"//.*\\n","endLoc":127,"header":"def t_CPPCOMMENT(t)","id":11114,"name":"t_CPPCOMMENT","nodeType":"Function","startLoc":124,"text":"def t_CPPCOMMENT(t):\n    r'//.*\\n'\n    t.lexer.lineno += 1\n    return t"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":11115,"name":"tokens","nodeType":"Attribute","startLoc":10,"text":"tokens"},{"attributeType":"null","col":0,"comment":"null","endLoc":44,"id":11116,"name":"t_PLUS","nodeType":"Attribute","startLoc":44,"text":"t_PLUS"},{"col":4,"comment":"\n        >>> raise VdtParamError('yoda', 'jedi')\n        Traceback (most recent call last):\n        VdtParamError: passed an incorrect value \"jedi\" for parameter \"yoda\".\n        ","endLoc":395,"header":"def __init__(self, name, value)","id":11117,"name":"__init__","nodeType":"Function","startLoc":389,"text":"def __init__(self, name, value):\n        \"\"\"\n        >>> raise VdtParamError('yoda', 'jedi')\n        Traceback (most recent call last):\n        VdtParamError: passed an incorrect value \"jedi\" for parameter \"yoda\".\n        \"\"\"\n        SyntaxError.__init__(self, 'passed an incorrect value \"%s\" for parameter \"%s\".' % (value, name))"},{"attributeType":"null","col":0,"comment":"null","endLoc":45,"id":11118,"name":"t_MINUS","nodeType":"Attribute","startLoc":45,"text":"t_MINUS"},{"attributeType":"null","col":0,"comment":"null","endLoc":46,"id":11119,"name":"t_TIMES","nodeType":"Attribute","startLoc":46,"text":"t_TIMES"},{"attributeType":"null","col":0,"comment":"null","endLoc":47,"id":11120,"name":"t_DIVIDE","nodeType":"Attribute","startLoc":47,"text":"t_DIVIDE"},{"attributeType":"null","col":0,"comment":"null","endLoc":48,"id":11121,"name":"t_MODULO","nodeType":"Attribute","startLoc":48,"text":"t_MODULO"},{"attributeType":"null","col":0,"comment":"null","endLoc":49,"id":11122,"name":"t_OR","nodeType":"Attribute","startLoc":49,"text":"t_OR"},{"attributeType":"null","col":0,"comment":"null","endLoc":50,"id":11123,"name":"t_AND","nodeType":"Attribute","startLoc":50,"text":"t_AND"},{"attributeType":"null","col":8,"comment":"null","endLoc":170,"id":11124,"name":"LC_time","nodeType":"Attribute","startLoc":170,"text":"self.LC_time"},{"attributeType":"null","col":0,"comment":"null","endLoc":51,"id":11125,"name":"t_NOT","nodeType":"Attribute","startLoc":51,"text":"t_NOT"},{"attributeType":"null","col":0,"comment":"null","endLoc":52,"id":11126,"name":"t_XOR","nodeType":"Attribute","startLoc":52,"text":"t_XOR"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":11127,"name":"t_LSHIFT","nodeType":"Attribute","startLoc":53,"text":"t_LSHIFT"},{"attributeType":"null","col":0,"comment":"null","endLoc":54,"id":11128,"name":"t_RSHIFT","nodeType":"Attribute","startLoc":54,"text":"t_RSHIFT"},{"attributeType":"null","col":0,"comment":"null","endLoc":55,"id":11129,"name":"t_LOR","nodeType":"Attribute","startLoc":55,"text":"t_LOR"},{"attributeType":"null","col":0,"comment":"null","endLoc":56,"id":11130,"name":"t_LAND","nodeType":"Attribute","startLoc":56,"text":"t_LAND"},{"attributeType":"null","col":0,"comment":"null","endLoc":57,"id":11131,"name":"t_LNOT","nodeType":"Attribute","startLoc":57,"text":"t_LNOT"},{"attributeType":"null","col":0,"comment":"null","endLoc":58,"id":11132,"name":"t_LT","nodeType":"Attribute","startLoc":58,"text":"t_LT"},{"col":0,"comment":"null","endLoc":446,"header":"@apply_to_both\ndef concatenate(arrays, axis=0, out=None)","id":11133,"name":"concatenate","nodeType":"Function","startLoc":443,"text":"@apply_to_both\ndef concatenate(arrays, axis=0, out=None):\n    data, masks = _get_data_and_masks(*arrays)\n    return (data,), (masks,), dict(axis=axis), out"},{"attributeType":"null","col":0,"comment":"null","endLoc":59,"id":11134,"name":"t_GT","nodeType":"Attribute","startLoc":59,"text":"t_GT"},{"attributeType":"null","col":0,"comment":"null","endLoc":60,"id":11135,"name":"t_LE","nodeType":"Attribute","startLoc":60,"text":"t_LE"},{"attributeType":"null","col":0,"comment":"null","endLoc":61,"id":11136,"name":"t_GE","nodeType":"Attribute","startLoc":61,"text":"t_GE"},{"attributeType":"null","col":0,"comment":"null","endLoc":62,"id":11137,"name":"t_EQ","nodeType":"Attribute","startLoc":62,"text":"t_EQ"},{"attributeType":"null","col":0,"comment":"null","endLoc":63,"id":11138,"name":"t_NE","nodeType":"Attribute","startLoc":63,"text":"t_NE"},{"col":0,"comment":"null","endLoc":452,"header":"@apply_to_both\ndef append(arr, values, axis=None)","id":11139,"name":"append","nodeType":"Function","startLoc":449,"text":"@apply_to_both\ndef append(arr, values, axis=None):\n    data, masks = _get_data_and_masks(arr, values)\n    return data, masks, dict(axis=axis), None"},{"attributeType":"null","col":0,"comment":"null","endLoc":67,"id":11140,"name":"t_EQUALS","nodeType":"Attribute","startLoc":67,"text":"t_EQUALS"},{"attributeType":"null","col":0,"comment":"null","endLoc":68,"id":11141,"name":"t_TIMESEQUAL","nodeType":"Attribute","startLoc":68,"text":"t_TIMESEQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":69,"id":11142,"name":"t_DIVEQUAL","nodeType":"Attribute","startLoc":69,"text":"t_DIVEQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":70,"id":11143,"name":"t_MODEQUAL","nodeType":"Attribute","startLoc":70,"text":"t_MODEQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":71,"id":11144,"name":"t_PLUSEQUAL","nodeType":"Attribute","startLoc":71,"text":"t_PLUSEQUAL"},{"col":0,"comment":"null","endLoc":476,"header":"@dispatched_function\ndef block(arrays)","id":11145,"name":"block","nodeType":"Function","startLoc":455,"text":"@dispatched_function\ndef block(arrays):\n    # We need to override block since the numpy implementation can take two\n    # different paths, one for concatenation, one for creating a large empty\n    # result array in which parts are set.  Each assumes array input and\n    # cannot be used directly.  Since it would be very costly to inspect all\n    # arrays and then turn them back into a nested list, we just copy here the\n    # second implementation, np.core.shape_base._block_slicing, since it is\n    # shortest and easiest.\n    from astropy.utils.masked import Masked\n    (arrays, list_ndim, result_ndim,\n     final_size) = np.core.shape_base._block_setup(arrays)\n    shape, slices, arrays = np.core.shape_base._block_info_recursion(\n        arrays, list_ndim, result_ndim)\n    dtype = np.result_type(*[arr.dtype for arr in arrays])\n    F_order = all(arr.flags['F_CONTIGUOUS'] for arr in arrays)\n    C_order = all(arr.flags['C_CONTIGUOUS'] for arr in arrays)\n    order = 'F' if F_order and not C_order else 'C'\n    result = Masked(np.empty(shape=shape, dtype=dtype, order=order))\n    for the_slice, arr in zip(slices, arrays):\n        result[(Ellipsis,) + the_slice] = arr\n    return result"},{"attributeType":"null","col":0,"comment":"null","endLoc":72,"id":11146,"name":"t_MINUSEQUAL","nodeType":"Attribute","startLoc":72,"text":"t_MINUSEQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":73,"id":11147,"name":"t_LSHIFTEQUAL","nodeType":"Attribute","startLoc":73,"text":"t_LSHIFTEQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":74,"id":11148,"name":"t_RSHIFTEQUAL","nodeType":"Attribute","startLoc":74,"text":"t_RSHIFTEQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":75,"id":11149,"name":"t_ANDEQUAL","nodeType":"Attribute","startLoc":75,"text":"t_ANDEQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":76,"id":11150,"name":"t_OREQUAL","nodeType":"Attribute","startLoc":76,"text":"t_OREQUAL"},{"col":4,"comment":"Source for CIP correction.  To be overridden by subclass.","endLoc":431,"header":"def dcip_source(self, i)","id":11151,"name":"dcip_source","nodeType":"Function","startLoc":429,"text":"def dcip_source(self, i):\n        \"\"\"Source for CIP correction.  To be overridden by subclass.\"\"\"\n        return np.zeros_like(i)"},{"attributeType":"null","col":0,"comment":"null","endLoc":77,"id":11152,"name":"t_XOREQUAL","nodeType":"Attribute","startLoc":77,"text":"t_XOREQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":80,"id":11153,"name":"t_INCREMENT","nodeType":"Attribute","startLoc":80,"text":"t_INCREMENT"},{"attributeType":"null","col":8,"comment":"null","endLoc":106,"id":11154,"name":"f_weekday","nodeType":"Attribute","startLoc":106,"text":"self.f_weekday"},{"attributeType":"null","col":0,"comment":"null","endLoc":81,"id":11155,"name":"t_DECREMENT","nodeType":"Attribute","startLoc":81,"text":"t_DECREMENT"},{"attributeType":"null","col":0,"comment":"null","endLoc":84,"id":11156,"name":"t_ARROW","nodeType":"Attribute","startLoc":84,"text":"t_ARROW"},{"attributeType":"null","col":0,"comment":"null","endLoc":87,"id":11157,"name":"t_TERNARY","nodeType":"Attribute","startLoc":87,"text":"t_TERNARY"},{"attributeType":"null","col":0,"comment":"null","endLoc":90,"id":11158,"name":"t_LPAREN","nodeType":"Attribute","startLoc":90,"text":"t_LPAREN"},{"attributeType":"null","col":0,"comment":"null","endLoc":91,"id":11159,"name":"t_RPAREN","nodeType":"Attribute","startLoc":91,"text":"t_RPAREN"},{"attributeType":"null","col":0,"comment":"null","endLoc":92,"id":11160,"name":"t_LBRACKET","nodeType":"Attribute","startLoc":92,"text":"t_LBRACKET"},{"attributeType":"null","col":0,"comment":"null","endLoc":93,"id":11161,"name":"t_RBRACKET","nodeType":"Attribute","startLoc":93,"text":"t_RBRACKET"},{"attributeType":"null","col":0,"comment":"null","endLoc":94,"id":11162,"name":"t_LBRACE","nodeType":"Attribute","startLoc":94,"text":"t_LBRACE"},{"col":4,"comment":"Source for polar motion.  To be overridden by subclass.","endLoc":435,"header":"def pm_source(self, i)","id":11163,"name":"pm_source","nodeType":"Function","startLoc":433,"text":"def pm_source(self, i):\n        \"\"\"Source for polar motion.  To be overridden by subclass.\"\"\"\n        return np.zeros_like(i)"},{"attributeType":"null","col":0,"comment":"null","endLoc":95,"id":11164,"name":"t_RBRACE","nodeType":"Attribute","startLoc":95,"text":"t_RBRACE"},{"attributeType":"null","col":0,"comment":"null","endLoc":96,"id":11165,"name":"t_COMMA","nodeType":"Attribute","startLoc":96,"text":"t_COMMA"},{"attributeType":"null","col":0,"comment":"null","endLoc":97,"id":11166,"name":"t_PERIOD","nodeType":"Attribute","startLoc":97,"text":"t_PERIOD"},{"attributeType":"null","col":0,"comment":"null","endLoc":98,"id":11167,"name":"t_SEMI","nodeType":"Attribute","startLoc":98,"text":"t_SEMI"},{"col":4,"comment":"\n        Property to provide the current time, but also allow for explicitly setting\n        the _time_now attribute for testing purposes.\n        ","endLoc":446,"header":"@property\n    def time_now(self)","id":11168,"name":"time_now","nodeType":"Function","startLoc":437,"text":"@property\n    def time_now(self):\n        \"\"\"\n        Property to provide the current time, but also allow for explicitly setting\n        the _time_now attribute for testing purposes.\n        \"\"\"\n        try:\n            return self._time_now\n        except Exception:\n            return Time.now()"},{"attributeType":"null","col":0,"comment":"null","endLoc":99,"id":11169,"name":"t_COLON","nodeType":"Attribute","startLoc":99,"text":"t_COLON"},{"attributeType":"null","col":8,"comment":"null","endLoc":113,"id":11170,"name":"f_month","nodeType":"Attribute","startLoc":113,"text":"self.f_month"},{"attributeType":"null","col":0,"comment":"null","endLoc":100,"id":11171,"name":"t_ELLIPSIS","nodeType":"Attribute","startLoc":100,"text":"t_ELLIPSIS"},{"attributeType":"null","col":0,"comment":"null","endLoc":103,"id":11172,"name":"t_ID","nodeType":"Attribute","startLoc":103,"text":"t_ID"},{"attributeType":"null","col":0,"comment":"null","endLoc":106,"id":11173,"name":"t_INTEGER","nodeType":"Attribute","startLoc":106,"text":"t_INTEGER"},{"attributeType":"null","col":0,"comment":"null","endLoc":109,"id":11174,"name":"t_FLOAT","nodeType":"Attribute","startLoc":109,"text":"t_FLOAT"},{"attributeType":"null","col":8,"comment":"null","endLoc":80,"id":11175,"name":"lang","nodeType":"Attribute","startLoc":80,"text":"self.lang"},{"col":4,"comment":"null","endLoc":457,"header":"def _convert_col_for_table(self, col)","id":11176,"name":"_convert_col_for_table","nodeType":"Function","startLoc":448,"text":"def _convert_col_for_table(self, col):\n        # Fill masked columns with units to avoid dropped-mask warnings\n        # when converting to Quantity.\n        # TODO: Once we support masked quantities, we can drop this and\n        # in the code below replace b_bad with table['UT1_UTC_B'].mask, etc.\n        if (getattr(col, 'unit', None) is not None and\n                isinstance(col, MaskedColumn)):\n            col = col.filled(np.nan)\n\n        return super()._convert_col_for_table(col)"},{"col":0,"comment":"Broadcast arrays to a common shape.\n\n    Like `numpy.broadcast_arrays`, applied to both unmasked data and masks.\n    Note that ``subok`` is taken to mean whether or not subclasses of\n    the unmasked data and masks are allowed, i.e., for ``subok=False``,\n    `~astropy.utils.masked.MaskedNDArray` instances will be returned.\n    ","endLoc":501,"header":"@dispatched_function\ndef broadcast_arrays(*args, subok=True)","id":11177,"name":"broadcast_arrays","nodeType":"Function","startLoc":479,"text":"@dispatched_function\ndef broadcast_arrays(*args, subok=True):\n    \"\"\"Broadcast arrays to a common shape.\n\n    Like `numpy.broadcast_arrays`, applied to both unmasked data and masks.\n    Note that ``subok`` is taken to mean whether or not subclasses of\n    the unmasked data and masks are allowed, i.e., for ``subok=False``,\n    `~astropy.utils.masked.MaskedNDArray` instances will be returned.\n    \"\"\"\n    from .core import Masked\n\n    are_masked = [isinstance(arg, Masked) for arg in args]\n    data = [(arg.unmasked if is_masked else arg)\n            for arg, is_masked in zip(args, are_masked)]\n    results = np.broadcast_arrays(*data, subok=subok)\n\n    shape = results[0].shape if isinstance(results, list) else results.shape\n    masks = [(np.broadcast_to(arg.mask, shape, subok=subok)\n              if is_masked else None)\n             for arg, is_masked in zip(args, are_masked)]\n    results = [(Masked(result, mask) if mask is not None else result)\n               for (result, mask) in zip(results, masks)]\n    return results if len(results) > 1 else results[0]"},{"attributeType":"null","col":0,"comment":"null","endLoc":112,"id":11178,"name":"t_STRING","nodeType":"Attribute","startLoc":112,"text":"t_STRING"},{"attributeType":"null","col":0,"comment":"null","endLoc":115,"id":11179,"name":"t_CHARACTER","nodeType":"Attribute","startLoc":115,"text":"t_CHARACTER"},{"col":0,"comment":"","endLoc":41,"header":"ctokens.py#<anonymous>","id":11180,"name":"<anonymous>","nodeType":"Function","startLoc":10,"text":"tokens = [\n    # Literals (identifier, integer constant, float constant, string constant, char const)\n    'ID', 'TYPEID', 'INTEGER', 'FLOAT', 'STRING', 'CHARACTER',\n\n    # Operators (+,-,*,/,%,|,&,~,^,<<,>>, ||, &&, !, <, <=, >, >=, ==, !=)\n    'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MODULO',\n    'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT',\n    'LOR', 'LAND', 'LNOT',\n    'LT', 'LE', 'GT', 'GE', 'EQ', 'NE',\n\n    # Assignment (=, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |=)\n    'EQUALS', 'TIMESEQUAL', 'DIVEQUAL', 'MODEQUAL', 'PLUSEQUAL', 'MINUSEQUAL',\n    'LSHIFTEQUAL','RSHIFTEQUAL', 'ANDEQUAL', 'XOREQUAL', 'OREQUAL',\n\n    # Increment/decrement (++,--)\n    'INCREMENT', 'DECREMENT',\n\n    # Structure dereference (->)\n    'ARROW',\n\n    # Ternary operator (?)\n    'TERNARY',\n\n    # Delimeters ( ) [ ] { } , . ; :\n    'LPAREN', 'RPAREN',\n    'LBRACKET', 'RBRACKET',\n    'LBRACE', 'RBRACE',\n    'COMMA', 'PERIOD', 'SEMI', 'COLON',\n\n    # Ellipsis (...)\n    'ELLIPSIS',\n]\n\nt_PLUS             = r'\\+'\n\nt_MINUS            = r'-'\n\nt_TIMES            = r'\\*'\n\nt_DIVIDE           = r'/'\n\nt_MODULO           = r'%'\n\nt_OR               = r'\\|'\n\nt_AND              = r'&'\n\nt_NOT              = r'~'\n\nt_XOR              = r'\\^'\n\nt_LSHIFT           = r'<<'\n\nt_RSHIFT           = r'>>'\n\nt_LOR              = r'\\|\\|'\n\nt_LAND             = r'&&'\n\nt_LNOT             = r'!'\n\nt_LT               = r'<'\n\nt_GT               = r'>'\n\nt_LE               = r'<='\n\nt_GE               = r'>='\n\nt_EQ               = r'=='\n\nt_NE               = r'!='\n\nt_EQUALS           = r'='\n\nt_TIMESEQUAL       = r'\\*='\n\nt_DIVEQUAL         = r'/='\n\nt_MODEQUAL         = r'%='\n\nt_PLUSEQUAL        = r'\\+='\n\nt_MINUSEQUAL       = r'-='\n\nt_LSHIFTEQUAL      = r'<<='\n\nt_RSHIFTEQUAL      = r'>>='\n\nt_ANDEQUAL         = r'&='\n\nt_OREQUAL          = r'\\|='\n\nt_XOREQUAL         = r'\\^='\n\nt_INCREMENT        = r'\\+\\+'\n\nt_DECREMENT        = r'--'\n\nt_ARROW            = r'->'\n\nt_TERNARY          = r'\\?'\n\nt_LPAREN           = r'\\('\n\nt_RPAREN           = r'\\)'\n\nt_LBRACKET         = r'\\['\n\nt_RBRACKET         = r'\\]'\n\nt_LBRACE           = r'\\{'\n\nt_RBRACE           = r'\\}'\n\nt_COMMA            = r','\n\nt_PERIOD           = r'\\.'\n\nt_SEMI             = r';'\n\nt_COLON            = r':'\n\nt_ELLIPSIS         = r'\\.\\.\\.'\n\nt_ID = r'[A-Za-z_][A-Za-z0-9_]*'\n\nt_INTEGER = r'\\d+([uU]|[lL]|[uU][lL]|[lL][uU])?'\n\nt_FLOAT = r'((\\d+)(\\.\\d+)(e(\\+|-)?(\\d+))? | (\\d+)e(\\+|-)?(\\d+))([lL]|[fF])?'\n\nt_STRING = r'\\\"([^\\\\\\n]|(\\\\.))*?\\\"'\n\nt_CHARACTER = r'(L)?\\'([^\\\\\\n]|(\\\\.))*?\\''"},{"col":4,"comment":"Take apart a ``keyword=list('val, 'val')`` type string.","endLoc":714,"header":"def _list_handle(self, listmatch)","id":11181,"name":"_list_handle","nodeType":"Function","startLoc":707,"text":"def _list_handle(self, listmatch):\n        \"\"\"Take apart a ``keyword=list('val, 'val')`` type string.\"\"\"\n        out = []\n        name = listmatch.group(1)\n        args = listmatch.group(2)\n        for arg in self._list_members.findall(args):\n            out.append(self._unquote(arg))\n        return name, out"},{"attributeType":"null","col":8,"comment":"null","endLoc":180,"id":11182,"name":"tzname","nodeType":"Attribute","startLoc":180,"text":"self.tzname"},{"attributeType":"null","col":8,"comment":"null","endLoc":112,"id":11183,"name":"a_month","nodeType":"Attribute","startLoc":112,"text":"self.a_month"},{"fileName":"yacc.py","filePath":"astropy/extern/ply","id":11184,"nodeType":"File","text":"# -----------------------------------------------------------------------------\n# ply: yacc.py\n#\n# Copyright (C) 2001-2018\n# David M. Beazley (Dabeaz LLC)\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# * Redistributions of source code must retain the above copyright notice,\n#   this list of conditions and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright notice,\n#   this list of conditions and the following disclaimer in the documentation\n#   and/or other materials provided with the distribution.\n# * Neither the name of the David Beazley or Dabeaz LLC may be used to\n#   endorse or promote products derived from this software without\n#  specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n# -----------------------------------------------------------------------------\n#\n# This implements an LR parser that is constructed from grammar rules defined\n# as Python functions. The grammar is specified by supplying the BNF inside\n# Python documentation strings.  The inspiration for this technique was borrowed\n# from John Aycock's Spark parsing system.  PLY might be viewed as cross between\n# Spark and the GNU bison utility.\n#\n# The current implementation is only somewhat object-oriented. The\n# LR parser itself is defined in terms of an object (which allows multiple\n# parsers to co-exist).  However, most of the variables used during table\n# construction are defined in terms of global variables.  Users shouldn't\n# notice unless they are trying to define multiple parsers at the same\n# time using threads (in which case they should have their head examined).\n#\n# This implementation supports both SLR and LALR(1) parsing.  LALR(1)\n# support was originally implemented by Elias Ioup (ezioup@alumni.uchicago.edu),\n# using the algorithm found in Aho, Sethi, and Ullman \"Compilers: Principles,\n# Techniques, and Tools\" (The Dragon Book).  LALR(1) has since been replaced\n# by the more efficient DeRemer and Pennello algorithm.\n#\n# :::::::: WARNING :::::::\n#\n# Construction of LR parsing tables is fairly complicated and expensive.\n# To make this module run fast, a *LOT* of work has been put into\n# optimization---often at the expensive of readability and what might\n# consider to be good Python \"coding style.\"   Modify the code at your\n# own risk!\n# ----------------------------------------------------------------------------\n\nimport re\nimport types\nimport sys\nimport os.path\nimport inspect\nimport warnings\n\n__version__    = '3.11'\n__tabversion__ = '3.10'\n\n#-----------------------------------------------------------------------------\n#                     === User configurable parameters ===\n#\n# Change these to modify the default behavior of yacc (if you wish)\n#-----------------------------------------------------------------------------\n\nyaccdebug   = True             # Debugging mode.  If set, yacc generates a\n                               # a 'parser.out' file in the current directory\n\ndebug_file  = 'parser.out'     # Default name of the debugging file\ntab_module  = 'parsetab'       # Default name of the table module\ndefault_lr  = 'LALR'           # Default LR table generation method\n\nerror_count = 3                # Number of symbols that must be shifted to leave recovery mode\n\nyaccdevel   = False            # Set to True if developing yacc.  This turns off optimized\n                               # implementations of certain functions.\n\nresultlimit = 40               # Size limit of results when running in debug mode.\n\npickle_protocol = 0            # Protocol to use when writing pickle files\n\n# String type-checking compatibility\nif sys.version_info[0] < 3:\n    string_types = basestring\nelse:\n    string_types = str\n\nMAXINT = sys.maxsize\n\n# This object is a stand-in for a logging object created by the\n# logging module.   PLY will use this by default to create things\n# such as the parser.out file.  If a user wants more detailed\n# information, they can create their own logging object and pass\n# it into PLY.\n\nclass PlyLogger(object):\n    def __init__(self, f):\n        self.f = f\n\n    def debug(self, msg, *args, **kwargs):\n        self.f.write((msg % args) + '\\n')\n\n    info = debug\n\n    def warning(self, msg, *args, **kwargs):\n        self.f.write('WARNING: ' + (msg % args) + '\\n')\n\n    def error(self, msg, *args, **kwargs):\n        self.f.write('ERROR: ' + (msg % args) + '\\n')\n\n    critical = debug\n\n# Null logger is used when no output is generated. Does nothing.\nclass NullLogger(object):\n    def __getattribute__(self, name):\n        return self\n\n    def __call__(self, *args, **kwargs):\n        return self\n\n# Exception raised for yacc-related errors\nclass YaccError(Exception):\n    pass\n\n# Format the result message that the parser produces when running in debug mode.\ndef format_result(r):\n    repr_str = repr(r)\n    if '\\n' in repr_str:\n        repr_str = repr(repr_str)\n    if len(repr_str) > resultlimit:\n        repr_str = repr_str[:resultlimit] + ' ...'\n    result = '<%s @ 0x%x> (%s)' % (type(r).__name__, id(r), repr_str)\n    return result\n\n# Format stack entries when the parser is running in debug mode\ndef format_stack_entry(r):\n    repr_str = repr(r)\n    if '\\n' in repr_str:\n        repr_str = repr(repr_str)\n    if len(repr_str) < 16:\n        return repr_str\n    else:\n        return '<%s @ 0x%x>' % (type(r).__name__, id(r))\n\n# Panic mode error recovery support.   This feature is being reworked--much of the\n# code here is to offer a deprecation/backwards compatible transition\n\n_errok = None\n_token = None\n_restart = None\n_warnmsg = '''PLY: Don't use global functions errok(), token(), and restart() in p_error().\nInstead, invoke the methods on the associated parser instance:\n\n    def p_error(p):\n        ...\n        # Use parser.errok(), parser.token(), parser.restart()\n        ...\n\n    parser = yacc.yacc()\n'''\n\ndef errok():\n    warnings.warn(_warnmsg)\n    return _errok()\n\ndef restart():\n    warnings.warn(_warnmsg)\n    return _restart()\n\ndef token():\n    warnings.warn(_warnmsg)\n    return _token()\n\n# Utility function to call the p_error() function with some deprecation hacks\ndef call_errorfunc(errorfunc, token, parser):\n    global _errok, _token, _restart\n    _errok = parser.errok\n    _token = parser.token\n    _restart = parser.restart\n    r = errorfunc(token)\n    try:\n        del _errok, _token, _restart\n    except NameError:\n        pass\n    return r\n\n#-----------------------------------------------------------------------------\n#                        ===  LR Parsing Engine ===\n#\n# The following classes are used for the LR parser itself.  These are not\n# used during table construction and are independent of the actual LR\n# table generation algorithm\n#-----------------------------------------------------------------------------\n\n# This class is used to hold non-terminal grammar symbols during parsing.\n# It normally has the following attributes set:\n#        .type       = Grammar symbol type\n#        .value      = Symbol value\n#        .lineno     = Starting line number\n#        .endlineno  = Ending line number (optional, set automatically)\n#        .lexpos     = Starting lex position\n#        .endlexpos  = Ending lex position (optional, set automatically)\n\nclass YaccSymbol:\n    def __str__(self):\n        return self.type\n\n    def __repr__(self):\n        return str(self)\n\n# This class is a wrapper around the objects actually passed to each\n# grammar rule.   Index lookup and assignment actually assign the\n# .value attribute of the underlying YaccSymbol object.\n# The lineno() method returns the line number of a given\n# item (or 0 if not defined).   The linespan() method returns\n# a tuple of (startline,endline) representing the range of lines\n# for a symbol.  The lexspan() method returns a tuple (lexpos,endlexpos)\n# representing the range of positional information for a symbol.\n\nclass YaccProduction:\n    def __init__(self, s, stack=None):\n        self.slice = s\n        self.stack = stack\n        self.lexer = None\n        self.parser = None\n\n    def __getitem__(self, n):\n        if isinstance(n, slice):\n            return [s.value for s in self.slice[n]]\n        elif n >= 0:\n            return self.slice[n].value\n        else:\n            return self.stack[n].value\n\n    def __setitem__(self, n, v):\n        self.slice[n].value = v\n\n    def __getslice__(self, i, j):\n        return [s.value for s in self.slice[i:j]]\n\n    def __len__(self):\n        return len(self.slice)\n\n    def lineno(self, n):\n        return getattr(self.slice[n], 'lineno', 0)\n\n    def set_lineno(self, n, lineno):\n        self.slice[n].lineno = lineno\n\n    def linespan(self, n):\n        startline = getattr(self.slice[n], 'lineno', 0)\n        endline = getattr(self.slice[n], 'endlineno', startline)\n        return startline, endline\n\n    def lexpos(self, n):\n        return getattr(self.slice[n], 'lexpos', 0)\n\n    def set_lexpos(self, n, lexpos):\n        self.slice[n].lexpos = lexpos\n\n    def lexspan(self, n):\n        startpos = getattr(self.slice[n], 'lexpos', 0)\n        endpos = getattr(self.slice[n], 'endlexpos', startpos)\n        return startpos, endpos\n\n    def error(self):\n        raise SyntaxError\n\n# -----------------------------------------------------------------------------\n#                               == LRParser ==\n#\n# The LR Parsing engine.\n# -----------------------------------------------------------------------------\n\nclass LRParser:\n    def __init__(self, lrtab, errorf):\n        self.productions = lrtab.lr_productions\n        self.action = lrtab.lr_action\n        self.goto = lrtab.lr_goto\n        self.errorfunc = errorf\n        self.set_defaulted_states()\n        self.errorok = True\n\n    def errok(self):\n        self.errorok = True\n\n    def restart(self):\n        del self.statestack[:]\n        del self.symstack[:]\n        sym = YaccSymbol()\n        sym.type = '$end'\n        self.symstack.append(sym)\n        self.statestack.append(0)\n\n    # Defaulted state support.\n    # This method identifies parser states where there is only one possible reduction action.\n    # For such states, the parser can make a choose to make a rule reduction without consuming\n    # the next look-ahead token.  This delayed invocation of the tokenizer can be useful in\n    # certain kinds of advanced parsing situations where the lexer and parser interact with\n    # each other or change states (i.e., manipulation of scope, lexer states, etc.).\n    #\n    # See:  http://www.gnu.org/software/bison/manual/html_node/Default-Reductions.html#Default-Reductions\n    def set_defaulted_states(self):\n        self.defaulted_states = {}\n        for state, actions in self.action.items():\n            rules = list(actions.values())\n            if len(rules) == 1 and rules[0] < 0:\n                self.defaulted_states[state] = rules[0]\n\n    def disable_defaulted_states(self):\n        self.defaulted_states = {}\n\n    def parse(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None):\n        if debug or yaccdevel:\n            if isinstance(debug, int):\n                debug = PlyLogger(sys.stderr)\n            return self.parsedebug(input, lexer, debug, tracking, tokenfunc)\n        elif tracking:\n            return self.parseopt(input, lexer, debug, tracking, tokenfunc)\n        else:\n            return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)\n\n\n    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n    # parsedebug().\n    #\n    # This is the debugging enabled version of parse().  All changes made to the\n    # parsing engine should be made here.   Optimized versions of this function\n    # are automatically created by the ply/ygen.py script.  This script cuts out\n    # sections enclosed in markers such as this:\n    #\n    #      #--! DEBUG\n    #      statements\n    #      #--! DEBUG\n    #\n    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n    def parsedebug(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None):\n        #--! parsedebug-start\n        lookahead = None                         # Current lookahead symbol\n        lookaheadstack = []                      # Stack of lookahead symbols\n        actions = self.action                    # Local reference to action table (to avoid lookup on self.)\n        goto    = self.goto                      # Local reference to goto table (to avoid lookup on self.)\n        prod    = self.productions               # Local reference to production list (to avoid lookup on self.)\n        defaulted_states = self.defaulted_states # Local reference to defaulted states\n        pslice  = YaccProduction(None)           # Production object passed to grammar rules\n        errorcount = 0                           # Used during error recovery\n\n        #--! DEBUG\n        debug.info('PLY: PARSE DEBUG START')\n        #--! DEBUG\n\n        # If no lexer was given, we will try to use the lex module\n        if not lexer:\n            from . import lex\n            lexer = lex.lexer\n\n        # Set up the lexer and parser objects on pslice\n        pslice.lexer = lexer\n        pslice.parser = self\n\n        # If input was supplied, pass to lexer\n        if input is not None:\n            lexer.input(input)\n\n        if tokenfunc is None:\n            # Tokenize function\n            get_token = lexer.token\n        else:\n            get_token = tokenfunc\n\n        # Set the parser() token method (sometimes used in error recovery)\n        self.token = get_token\n\n        # Set up the state and symbol stacks\n\n        statestack = []                # Stack of parsing states\n        self.statestack = statestack\n        symstack   = []                # Stack of grammar symbols\n        self.symstack = symstack\n\n        pslice.stack = symstack         # Put in the production\n        errtoken   = None               # Err token\n\n        # The start state is assumed to be (0,$end)\n\n        statestack.append(0)\n        sym = YaccSymbol()\n        sym.type = '$end'\n        symstack.append(sym)\n        state = 0\n        while True:\n            # Get the next symbol on the input.  If a lookahead symbol\n            # is already set, we just use that. Otherwise, we'll pull\n            # the next token off of the lookaheadstack or from the lexer\n\n            #--! DEBUG\n            debug.debug('')\n            debug.debug('State  : %s', state)\n            #--! DEBUG\n\n            if state not in defaulted_states:\n                if not lookahead:\n                    if not lookaheadstack:\n                        lookahead = get_token()     # Get the next token\n                    else:\n                        lookahead = lookaheadstack.pop()\n                    if not lookahead:\n                        lookahead = YaccSymbol()\n                        lookahead.type = '$end'\n\n                # Check the action table\n                ltype = lookahead.type\n                t = actions[state].get(ltype)\n            else:\n                t = defaulted_states[state]\n                #--! DEBUG\n                debug.debug('Defaulted state %s: Reduce using %d', state, -t)\n                #--! DEBUG\n\n            #--! DEBUG\n            debug.debug('Stack  : %s',\n                        ('%s . %s' % (' '.join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip())\n            #--! DEBUG\n\n            if t is not None:\n                if t > 0:\n                    # shift a symbol on the stack\n                    statestack.append(t)\n                    state = t\n\n                    #--! DEBUG\n                    debug.debug('Action : Shift and goto state %s', t)\n                    #--! DEBUG\n\n                    symstack.append(lookahead)\n                    lookahead = None\n\n                    # Decrease error count on successful shift\n                    if errorcount:\n                        errorcount -= 1\n                    continue\n\n                if t < 0:\n                    # reduce a symbol on the stack, emit a production\n                    p = prod[-t]\n                    pname = p.name\n                    plen  = p.len\n\n                    # Get production function\n                    sym = YaccSymbol()\n                    sym.type = pname       # Production name\n                    sym.value = None\n\n                    #--! DEBUG\n                    if plen:\n                        debug.info('Action : Reduce rule [%s] with %s and goto state %d', p.str,\n                                   '['+','.join([format_stack_entry(_v.value) for _v in symstack[-plen:]])+']',\n                                   goto[statestack[-1-plen]][pname])\n                    else:\n                        debug.info('Action : Reduce rule [%s] with %s and goto state %d', p.str, [],\n                                   goto[statestack[-1]][pname])\n\n                    #--! DEBUG\n\n                    if plen:\n                        targ = symstack[-plen-1:]\n                        targ[0] = sym\n\n                        #--! TRACKING\n                        if tracking:\n                            t1 = targ[1]\n                            sym.lineno = t1.lineno\n                            sym.lexpos = t1.lexpos\n                            t1 = targ[-1]\n                            sym.endlineno = getattr(t1, 'endlineno', t1.lineno)\n                            sym.endlexpos = getattr(t1, 'endlexpos', t1.lexpos)\n                        #--! TRACKING\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # below as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            del symstack[-plen:]\n                            self.state = state\n                            p.callable(pslice)\n                            del statestack[-plen:]\n                            #--! DEBUG\n                            debug.info('Result : %s', format_result(pslice[0]))\n                            #--! DEBUG\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            symstack.extend(targ[1:-1])         # Put the production slice back on the stack\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                    else:\n\n                        #--! TRACKING\n                        if tracking:\n                            sym.lineno = lexer.lineno\n                            sym.lexpos = lexer.lexpos\n                        #--! TRACKING\n\n                        targ = [sym]\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # above as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            self.state = state\n                            p.callable(pslice)\n                            #--! DEBUG\n                            debug.info('Result : %s', format_result(pslice[0]))\n                            #--! DEBUG\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                if t == 0:\n                    n = symstack[-1]\n                    result = getattr(n, 'value', None)\n                    #--! DEBUG\n                    debug.info('Done   : Returning %s', format_result(result))\n                    debug.info('PLY: PARSE DEBUG END')\n                    #--! DEBUG\n                    return result\n\n            if t is None:\n\n                #--! DEBUG\n                debug.error('Error  : %s',\n                            ('%s . %s' % (' '.join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip())\n                #--! DEBUG\n\n                # We have some kind of parsing error here.  To handle\n                # this, we are going to push the current token onto\n                # the tokenstack and replace it with an 'error' token.\n                # If there are any synchronization rules, they may\n                # catch it.\n                #\n                # In addition to pushing the error token, we call call\n                # the user defined p_error() function if this is the\n                # first syntax error.  This function is only called if\n                # errorcount == 0.\n                if errorcount == 0 or self.errorok:\n                    errorcount = error_count\n                    self.errorok = False\n                    errtoken = lookahead\n                    if errtoken.type == '$end':\n                        errtoken = None               # End of file!\n                    if self.errorfunc:\n                        if errtoken and not hasattr(errtoken, 'lexer'):\n                            errtoken.lexer = lexer\n                        self.state = state\n                        tok = call_errorfunc(self.errorfunc, errtoken, self)\n                        if self.errorok:\n                            # User must have done some kind of panic\n                            # mode recovery on their own.  The\n                            # returned token is the next lookahead\n                            lookahead = tok\n                            errtoken = None\n                            continue\n                    else:\n                        if errtoken:\n                            if hasattr(errtoken, 'lineno'):\n                                lineno = lookahead.lineno\n                            else:\n                                lineno = 0\n                            if lineno:\n                                sys.stderr.write('yacc: Syntax error at line %d, token=%s\\n' % (lineno, errtoken.type))\n                            else:\n                                sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type)\n                        else:\n                            sys.stderr.write('yacc: Parse error in input. EOF\\n')\n                            return\n\n                else:\n                    errorcount = error_count\n\n                # case 1:  the statestack only has 1 entry on it.  If we're in this state, the\n                # entire parse has been rolled back and we're completely hosed.   The token is\n                # discarded and we just keep going.\n\n                if len(statestack) <= 1 and lookahead.type != '$end':\n                    lookahead = None\n                    errtoken = None\n                    state = 0\n                    # Nuke the pushback stack\n                    del lookaheadstack[:]\n                    continue\n\n                # case 2: the statestack has a couple of entries on it, but we're\n                # at the end of the file. nuke the top entry and generate an error token\n\n                # Start nuking entries on the stack\n                if lookahead.type == '$end':\n                    # Whoa. We're really hosed here. Bail out\n                    return\n\n                if lookahead.type != 'error':\n                    sym = symstack[-1]\n                    if sym.type == 'error':\n                        # Hmmm. Error is on top of stack, we'll just nuke input\n                        # symbol and continue\n                        #--! TRACKING\n                        if tracking:\n                            sym.endlineno = getattr(lookahead, 'lineno', sym.lineno)\n                            sym.endlexpos = getattr(lookahead, 'lexpos', sym.lexpos)\n                        #--! TRACKING\n                        lookahead = None\n                        continue\n\n                    # Create the error symbol for the first time and make it the new lookahead symbol\n                    t = YaccSymbol()\n                    t.type = 'error'\n\n                    if hasattr(lookahead, 'lineno'):\n                        t.lineno = t.endlineno = lookahead.lineno\n                    if hasattr(lookahead, 'lexpos'):\n                        t.lexpos = t.endlexpos = lookahead.lexpos\n                    t.value = lookahead\n                    lookaheadstack.append(lookahead)\n                    lookahead = t\n                else:\n                    sym = symstack.pop()\n                    #--! TRACKING\n                    if tracking:\n                        lookahead.lineno = sym.lineno\n                        lookahead.lexpos = sym.lexpos\n                    #--! TRACKING\n                    statestack.pop()\n                    state = statestack[-1]\n\n                continue\n\n            # Call an error function here\n            raise RuntimeError('yacc: internal parser error!!!\\n')\n\n        #--! parsedebug-end\n\n    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n    # parseopt().\n    #\n    # Optimized version of parse() method.  DO NOT EDIT THIS CODE DIRECTLY!\n    # This code is automatically generated by the ply/ygen.py script. Make\n    # changes to the parsedebug() method instead.\n    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n    def parseopt(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None):\n        #--! parseopt-start\n        lookahead = None                         # Current lookahead symbol\n        lookaheadstack = []                      # Stack of lookahead symbols\n        actions = self.action                    # Local reference to action table (to avoid lookup on self.)\n        goto    = self.goto                      # Local reference to goto table (to avoid lookup on self.)\n        prod    = self.productions               # Local reference to production list (to avoid lookup on self.)\n        defaulted_states = self.defaulted_states # Local reference to defaulted states\n        pslice  = YaccProduction(None)           # Production object passed to grammar rules\n        errorcount = 0                           # Used during error recovery\n\n\n        # If no lexer was given, we will try to use the lex module\n        if not lexer:\n            from . import lex\n            lexer = lex.lexer\n\n        # Set up the lexer and parser objects on pslice\n        pslice.lexer = lexer\n        pslice.parser = self\n\n        # If input was supplied, pass to lexer\n        if input is not None:\n            lexer.input(input)\n\n        if tokenfunc is None:\n            # Tokenize function\n            get_token = lexer.token\n        else:\n            get_token = tokenfunc\n\n        # Set the parser() token method (sometimes used in error recovery)\n        self.token = get_token\n\n        # Set up the state and symbol stacks\n\n        statestack = []                # Stack of parsing states\n        self.statestack = statestack\n        symstack   = []                # Stack of grammar symbols\n        self.symstack = symstack\n\n        pslice.stack = symstack         # Put in the production\n        errtoken   = None               # Err token\n\n        # The start state is assumed to be (0,$end)\n\n        statestack.append(0)\n        sym = YaccSymbol()\n        sym.type = '$end'\n        symstack.append(sym)\n        state = 0\n        while True:\n            # Get the next symbol on the input.  If a lookahead symbol\n            # is already set, we just use that. Otherwise, we'll pull\n            # the next token off of the lookaheadstack or from the lexer\n\n\n            if state not in defaulted_states:\n                if not lookahead:\n                    if not lookaheadstack:\n                        lookahead = get_token()     # Get the next token\n                    else:\n                        lookahead = lookaheadstack.pop()\n                    if not lookahead:\n                        lookahead = YaccSymbol()\n                        lookahead.type = '$end'\n\n                # Check the action table\n                ltype = lookahead.type\n                t = actions[state].get(ltype)\n            else:\n                t = defaulted_states[state]\n\n\n            if t is not None:\n                if t > 0:\n                    # shift a symbol on the stack\n                    statestack.append(t)\n                    state = t\n\n\n                    symstack.append(lookahead)\n                    lookahead = None\n\n                    # Decrease error count on successful shift\n                    if errorcount:\n                        errorcount -= 1\n                    continue\n\n                if t < 0:\n                    # reduce a symbol on the stack, emit a production\n                    p = prod[-t]\n                    pname = p.name\n                    plen  = p.len\n\n                    # Get production function\n                    sym = YaccSymbol()\n                    sym.type = pname       # Production name\n                    sym.value = None\n\n\n                    if plen:\n                        targ = symstack[-plen-1:]\n                        targ[0] = sym\n\n                        #--! TRACKING\n                        if tracking:\n                            t1 = targ[1]\n                            sym.lineno = t1.lineno\n                            sym.lexpos = t1.lexpos\n                            t1 = targ[-1]\n                            sym.endlineno = getattr(t1, 'endlineno', t1.lineno)\n                            sym.endlexpos = getattr(t1, 'endlexpos', t1.lexpos)\n                        #--! TRACKING\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # below as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            del symstack[-plen:]\n                            self.state = state\n                            p.callable(pslice)\n                            del statestack[-plen:]\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            symstack.extend(targ[1:-1])         # Put the production slice back on the stack\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                    else:\n\n                        #--! TRACKING\n                        if tracking:\n                            sym.lineno = lexer.lineno\n                            sym.lexpos = lexer.lexpos\n                        #--! TRACKING\n\n                        targ = [sym]\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # above as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            self.state = state\n                            p.callable(pslice)\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                if t == 0:\n                    n = symstack[-1]\n                    result = getattr(n, 'value', None)\n                    return result\n\n            if t is None:\n\n\n                # We have some kind of parsing error here.  To handle\n                # this, we are going to push the current token onto\n                # the tokenstack and replace it with an 'error' token.\n                # If there are any synchronization rules, they may\n                # catch it.\n                #\n                # In addition to pushing the error token, we call call\n                # the user defined p_error() function if this is the\n                # first syntax error.  This function is only called if\n                # errorcount == 0.\n                if errorcount == 0 or self.errorok:\n                    errorcount = error_count\n                    self.errorok = False\n                    errtoken = lookahead\n                    if errtoken.type == '$end':\n                        errtoken = None               # End of file!\n                    if self.errorfunc:\n                        if errtoken and not hasattr(errtoken, 'lexer'):\n                            errtoken.lexer = lexer\n                        self.state = state\n                        tok = call_errorfunc(self.errorfunc, errtoken, self)\n                        if self.errorok:\n                            # User must have done some kind of panic\n                            # mode recovery on their own.  The\n                            # returned token is the next lookahead\n                            lookahead = tok\n                            errtoken = None\n                            continue\n                    else:\n                        if errtoken:\n                            if hasattr(errtoken, 'lineno'):\n                                lineno = lookahead.lineno\n                            else:\n                                lineno = 0\n                            if lineno:\n                                sys.stderr.write('yacc: Syntax error at line %d, token=%s\\n' % (lineno, errtoken.type))\n                            else:\n                                sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type)\n                        else:\n                            sys.stderr.write('yacc: Parse error in input. EOF\\n')\n                            return\n\n                else:\n                    errorcount = error_count\n\n                # case 1:  the statestack only has 1 entry on it.  If we're in this state, the\n                # entire parse has been rolled back and we're completely hosed.   The token is\n                # discarded and we just keep going.\n\n                if len(statestack) <= 1 and lookahead.type != '$end':\n                    lookahead = None\n                    errtoken = None\n                    state = 0\n                    # Nuke the pushback stack\n                    del lookaheadstack[:]\n                    continue\n\n                # case 2: the statestack has a couple of entries on it, but we're\n                # at the end of the file. nuke the top entry and generate an error token\n\n                # Start nuking entries on the stack\n                if lookahead.type == '$end':\n                    # Whoa. We're really hosed here. Bail out\n                    return\n\n                if lookahead.type != 'error':\n                    sym = symstack[-1]\n                    if sym.type == 'error':\n                        # Hmmm. Error is on top of stack, we'll just nuke input\n                        # symbol and continue\n                        #--! TRACKING\n                        if tracking:\n                            sym.endlineno = getattr(lookahead, 'lineno', sym.lineno)\n                            sym.endlexpos = getattr(lookahead, 'lexpos', sym.lexpos)\n                        #--! TRACKING\n                        lookahead = None\n                        continue\n\n                    # Create the error symbol for the first time and make it the new lookahead symbol\n                    t = YaccSymbol()\n                    t.type = 'error'\n\n                    if hasattr(lookahead, 'lineno'):\n                        t.lineno = t.endlineno = lookahead.lineno\n                    if hasattr(lookahead, 'lexpos'):\n                        t.lexpos = t.endlexpos = lookahead.lexpos\n                    t.value = lookahead\n                    lookaheadstack.append(lookahead)\n                    lookahead = t\n                else:\n                    sym = symstack.pop()\n                    #--! TRACKING\n                    if tracking:\n                        lookahead.lineno = sym.lineno\n                        lookahead.lexpos = sym.lexpos\n                    #--! TRACKING\n                    statestack.pop()\n                    state = statestack[-1]\n\n                continue\n\n            # Call an error function here\n            raise RuntimeError('yacc: internal parser error!!!\\n')\n\n        #--! parseopt-end\n\n    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n    # parseopt_notrack().\n    #\n    # Optimized version of parseopt() with line number tracking removed.\n    # DO NOT EDIT THIS CODE DIRECTLY. This code is automatically generated\n    # by the ply/ygen.py script. Make changes to the parsedebug() method instead.\n    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n    def parseopt_notrack(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None):\n        #--! parseopt-notrack-start\n        lookahead = None                         # Current lookahead symbol\n        lookaheadstack = []                      # Stack of lookahead symbols\n        actions = self.action                    # Local reference to action table (to avoid lookup on self.)\n        goto    = self.goto                      # Local reference to goto table (to avoid lookup on self.)\n        prod    = self.productions               # Local reference to production list (to avoid lookup on self.)\n        defaulted_states = self.defaulted_states # Local reference to defaulted states\n        pslice  = YaccProduction(None)           # Production object passed to grammar rules\n        errorcount = 0                           # Used during error recovery\n\n\n        # If no lexer was given, we will try to use the lex module\n        if not lexer:\n            from . import lex\n            lexer = lex.lexer\n\n        # Set up the lexer and parser objects on pslice\n        pslice.lexer = lexer\n        pslice.parser = self\n\n        # If input was supplied, pass to lexer\n        if input is not None:\n            lexer.input(input)\n\n        if tokenfunc is None:\n            # Tokenize function\n            get_token = lexer.token\n        else:\n            get_token = tokenfunc\n\n        # Set the parser() token method (sometimes used in error recovery)\n        self.token = get_token\n\n        # Set up the state and symbol stacks\n\n        statestack = []                # Stack of parsing states\n        self.statestack = statestack\n        symstack   = []                # Stack of grammar symbols\n        self.symstack = symstack\n\n        pslice.stack = symstack         # Put in the production\n        errtoken   = None               # Err token\n\n        # The start state is assumed to be (0,$end)\n\n        statestack.append(0)\n        sym = YaccSymbol()\n        sym.type = '$end'\n        symstack.append(sym)\n        state = 0\n        while True:\n            # Get the next symbol on the input.  If a lookahead symbol\n            # is already set, we just use that. Otherwise, we'll pull\n            # the next token off of the lookaheadstack or from the lexer\n\n\n            if state not in defaulted_states:\n                if not lookahead:\n                    if not lookaheadstack:\n                        lookahead = get_token()     # Get the next token\n                    else:\n                        lookahead = lookaheadstack.pop()\n                    if not lookahead:\n                        lookahead = YaccSymbol()\n                        lookahead.type = '$end'\n\n                # Check the action table\n                ltype = lookahead.type\n                t = actions[state].get(ltype)\n            else:\n                t = defaulted_states[state]\n\n\n            if t is not None:\n                if t > 0:\n                    # shift a symbol on the stack\n                    statestack.append(t)\n                    state = t\n\n\n                    symstack.append(lookahead)\n                    lookahead = None\n\n                    # Decrease error count on successful shift\n                    if errorcount:\n                        errorcount -= 1\n                    continue\n\n                if t < 0:\n                    # reduce a symbol on the stack, emit a production\n                    p = prod[-t]\n                    pname = p.name\n                    plen  = p.len\n\n                    # Get production function\n                    sym = YaccSymbol()\n                    sym.type = pname       # Production name\n                    sym.value = None\n\n\n                    if plen:\n                        targ = symstack[-plen-1:]\n                        targ[0] = sym\n\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # below as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            del symstack[-plen:]\n                            self.state = state\n                            p.callable(pslice)\n                            del statestack[-plen:]\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            symstack.extend(targ[1:-1])         # Put the production slice back on the stack\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                    else:\n\n\n                        targ = [sym]\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # above as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            self.state = state\n                            p.callable(pslice)\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                if t == 0:\n                    n = symstack[-1]\n                    result = getattr(n, 'value', None)\n                    return result\n\n            if t is None:\n\n\n                # We have some kind of parsing error here.  To handle\n                # this, we are going to push the current token onto\n                # the tokenstack and replace it with an 'error' token.\n                # If there are any synchronization rules, they may\n                # catch it.\n                #\n                # In addition to pushing the error token, we call call\n                # the user defined p_error() function if this is the\n                # first syntax error.  This function is only called if\n                # errorcount == 0.\n                if errorcount == 0 or self.errorok:\n                    errorcount = error_count\n                    self.errorok = False\n                    errtoken = lookahead\n                    if errtoken.type == '$end':\n                        errtoken = None               # End of file!\n                    if self.errorfunc:\n                        if errtoken and not hasattr(errtoken, 'lexer'):\n                            errtoken.lexer = lexer\n                        self.state = state\n                        tok = call_errorfunc(self.errorfunc, errtoken, self)\n                        if self.errorok:\n                            # User must have done some kind of panic\n                            # mode recovery on their own.  The\n                            # returned token is the next lookahead\n                            lookahead = tok\n                            errtoken = None\n                            continue\n                    else:\n                        if errtoken:\n                            if hasattr(errtoken, 'lineno'):\n                                lineno = lookahead.lineno\n                            else:\n                                lineno = 0\n                            if lineno:\n                                sys.stderr.write('yacc: Syntax error at line %d, token=%s\\n' % (lineno, errtoken.type))\n                            else:\n                                sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type)\n                        else:\n                            sys.stderr.write('yacc: Parse error in input. EOF\\n')\n                            return\n\n                else:\n                    errorcount = error_count\n\n                # case 1:  the statestack only has 1 entry on it.  If we're in this state, the\n                # entire parse has been rolled back and we're completely hosed.   The token is\n                # discarded and we just keep going.\n\n                if len(statestack) <= 1 and lookahead.type != '$end':\n                    lookahead = None\n                    errtoken = None\n                    state = 0\n                    # Nuke the pushback stack\n                    del lookaheadstack[:]\n                    continue\n\n                # case 2: the statestack has a couple of entries on it, but we're\n                # at the end of the file. nuke the top entry and generate an error token\n\n                # Start nuking entries on the stack\n                if lookahead.type == '$end':\n                    # Whoa. We're really hosed here. Bail out\n                    return\n\n                if lookahead.type != 'error':\n                    sym = symstack[-1]\n                    if sym.type == 'error':\n                        # Hmmm. Error is on top of stack, we'll just nuke input\n                        # symbol and continue\n                        lookahead = None\n                        continue\n\n                    # Create the error symbol for the first time and make it the new lookahead symbol\n                    t = YaccSymbol()\n                    t.type = 'error'\n\n                    if hasattr(lookahead, 'lineno'):\n                        t.lineno = t.endlineno = lookahead.lineno\n                    if hasattr(lookahead, 'lexpos'):\n                        t.lexpos = t.endlexpos = lookahead.lexpos\n                    t.value = lookahead\n                    lookaheadstack.append(lookahead)\n                    lookahead = t\n                else:\n                    sym = symstack.pop()\n                    statestack.pop()\n                    state = statestack[-1]\n\n                continue\n\n            # Call an error function here\n            raise RuntimeError('yacc: internal parser error!!!\\n')\n\n        #--! parseopt-notrack-end\n\n# -----------------------------------------------------------------------------\n#                          === Grammar Representation ===\n#\n# The following functions, classes, and variables are used to represent and\n# manipulate the rules that make up a grammar.\n# -----------------------------------------------------------------------------\n\n# regex matching identifiers\n_is_identifier = re.compile(r'^[a-zA-Z0-9_-]+$')\n\n# -----------------------------------------------------------------------------\n# class Production:\n#\n# This class stores the raw information about a single production or grammar rule.\n# A grammar rule refers to a specification such as this:\n#\n#       expr : expr PLUS term\n#\n# Here are the basic attributes defined on all productions\n#\n#       name     - Name of the production.  For example 'expr'\n#       prod     - A list of symbols on the right side ['expr','PLUS','term']\n#       prec     - Production precedence level\n#       number   - Production number.\n#       func     - Function that executes on reduce\n#       file     - File where production function is defined\n#       lineno   - Line number where production function is defined\n#\n# The following attributes are defined or optional.\n#\n#       len       - Length of the production (number of symbols on right hand side)\n#       usyms     - Set of unique symbols found in the production\n# -----------------------------------------------------------------------------\n\nclass Production(object):\n    reduced = 0\n    def __init__(self, number, name, prod, precedence=('right', 0), func=None, file='', line=0):\n        self.name     = name\n        self.prod     = tuple(prod)\n        self.number   = number\n        self.func     = func\n        self.callable = None\n        self.file     = file\n        self.line     = line\n        self.prec     = precedence\n\n        # Internal settings used during table construction\n\n        self.len  = len(self.prod)   # Length of the production\n\n        # Create a list of unique production symbols used in the production\n        self.usyms = []\n        for s in self.prod:\n            if s not in self.usyms:\n                self.usyms.append(s)\n\n        # List of all LR items for the production\n        self.lr_items = []\n        self.lr_next = None\n\n        # Create a string representation\n        if self.prod:\n            self.str = '%s -> %s' % (self.name, ' '.join(self.prod))\n        else:\n            self.str = '%s -> <empty>' % self.name\n\n    def __str__(self):\n        return self.str\n\n    def __repr__(self):\n        return 'Production(' + str(self) + ')'\n\n    def __len__(self):\n        return len(self.prod)\n\n    def __nonzero__(self):\n        return 1\n\n    def __getitem__(self, index):\n        return self.prod[index]\n\n    # Return the nth lr_item from the production (or None if at the end)\n    def lr_item(self, n):\n        if n > len(self.prod):\n            return None\n        p = LRItem(self, n)\n        # Precompute the list of productions immediately following.\n        try:\n            p.lr_after = self.Prodnames[p.prod[n+1]]\n        except (IndexError, KeyError):\n            p.lr_after = []\n        try:\n            p.lr_before = p.prod[n-1]\n        except IndexError:\n            p.lr_before = None\n        return p\n\n    # Bind the production function name to a callable\n    def bind(self, pdict):\n        if self.func:\n            self.callable = pdict[self.func]\n\n# This class serves as a minimal standin for Production objects when\n# reading table data from files.   It only contains information\n# actually used by the LR parsing engine, plus some additional\n# debugging information.\nclass MiniProduction(object):\n    def __init__(self, str, name, len, func, file, line):\n        self.name     = name\n        self.len      = len\n        self.func     = func\n        self.callable = None\n        self.file     = file\n        self.line     = line\n        self.str      = str\n\n    def __str__(self):\n        return self.str\n\n    def __repr__(self):\n        return 'MiniProduction(%s)' % self.str\n\n    # Bind the production function name to a callable\n    def bind(self, pdict):\n        if self.func:\n            self.callable = pdict[self.func]\n\n\n# -----------------------------------------------------------------------------\n# class LRItem\n#\n# This class represents a specific stage of parsing a production rule.  For\n# example:\n#\n#       expr : expr . PLUS term\n#\n# In the above, the \".\" represents the current location of the parse.  Here\n# basic attributes:\n#\n#       name       - Name of the production.  For example 'expr'\n#       prod       - A list of symbols on the right side ['expr','.', 'PLUS','term']\n#       number     - Production number.\n#\n#       lr_next      Next LR item. Example, if we are ' expr -> expr . PLUS term'\n#                    then lr_next refers to 'expr -> expr PLUS . term'\n#       lr_index   - LR item index (location of the \".\") in the prod list.\n#       lookaheads - LALR lookahead symbols for this item\n#       len        - Length of the production (number of symbols on right hand side)\n#       lr_after    - List of all productions that immediately follow\n#       lr_before   - Grammar symbol immediately before\n# -----------------------------------------------------------------------------\n\nclass LRItem(object):\n    def __init__(self, p, n):\n        self.name       = p.name\n        self.prod       = list(p.prod)\n        self.number     = p.number\n        self.lr_index   = n\n        self.lookaheads = {}\n        self.prod.insert(n, '.')\n        self.prod       = tuple(self.prod)\n        self.len        = len(self.prod)\n        self.usyms      = p.usyms\n\n    def __str__(self):\n        if self.prod:\n            s = '%s -> %s' % (self.name, ' '.join(self.prod))\n        else:\n            s = '%s -> <empty>' % self.name\n        return s\n\n    def __repr__(self):\n        return 'LRItem(' + str(self) + ')'\n\n# -----------------------------------------------------------------------------\n# rightmost_terminal()\n#\n# Return the rightmost terminal from a list of symbols.  Used in add_production()\n# -----------------------------------------------------------------------------\ndef rightmost_terminal(symbols, terminals):\n    i = len(symbols) - 1\n    while i >= 0:\n        if symbols[i] in terminals:\n            return symbols[i]\n        i -= 1\n    return None\n\n# -----------------------------------------------------------------------------\n#                           === GRAMMAR CLASS ===\n#\n# The following class represents the contents of the specified grammar along\n# with various computed properties such as first sets, follow sets, LR items, etc.\n# This data is used for critical parts of the table generation process later.\n# -----------------------------------------------------------------------------\n\nclass GrammarError(YaccError):\n    pass\n\nclass Grammar(object):\n    def __init__(self, terminals):\n        self.Productions  = [None]  # A list of all of the productions.  The first\n                                    # entry is always reserved for the purpose of\n                                    # building an augmented grammar\n\n        self.Prodnames    = {}      # A dictionary mapping the names of nonterminals to a list of all\n                                    # productions of that nonterminal.\n\n        self.Prodmap      = {}      # A dictionary that is only used to detect duplicate\n                                    # productions.\n\n        self.Terminals    = {}      # A dictionary mapping the names of terminal symbols to a\n                                    # list of the rules where they are used.\n\n        for term in terminals:\n            self.Terminals[term] = []\n\n        self.Terminals['error'] = []\n\n        self.Nonterminals = {}      # A dictionary mapping names of nonterminals to a list\n                                    # of rule numbers where they are used.\n\n        self.First        = {}      # A dictionary of precomputed FIRST(x) symbols\n\n        self.Follow       = {}      # A dictionary of precomputed FOLLOW(x) symbols\n\n        self.Precedence   = {}      # Precedence rules for each terminal. Contains tuples of the\n                                    # form ('right',level) or ('nonassoc', level) or ('left',level)\n\n        self.UsedPrecedence = set() # Precedence rules that were actually used by the grammer.\n                                    # This is only used to provide error checking and to generate\n                                    # a warning about unused precedence rules.\n\n        self.Start = None           # Starting symbol for the grammar\n\n\n    def __len__(self):\n        return len(self.Productions)\n\n    def __getitem__(self, index):\n        return self.Productions[index]\n\n    # -----------------------------------------------------------------------------\n    # set_precedence()\n    #\n    # Sets the precedence for a given terminal. assoc is the associativity such as\n    # 'left','right', or 'nonassoc'.  level is a numeric level.\n    #\n    # -----------------------------------------------------------------------------\n\n    def set_precedence(self, term, assoc, level):\n        assert self.Productions == [None], 'Must call set_precedence() before add_production()'\n        if term in self.Precedence:\n            raise GrammarError('Precedence already specified for terminal %r' % term)\n        if assoc not in ['left', 'right', 'nonassoc']:\n            raise GrammarError(\"Associativity must be one of 'left','right', or 'nonassoc'\")\n        self.Precedence[term] = (assoc, level)\n\n    # -----------------------------------------------------------------------------\n    # add_production()\n    #\n    # Given an action function, this function assembles a production rule and\n    # computes its precedence level.\n    #\n    # The production rule is supplied as a list of symbols.   For example,\n    # a rule such as 'expr : expr PLUS term' has a production name of 'expr' and\n    # symbols ['expr','PLUS','term'].\n    #\n    # Precedence is determined by the precedence of the right-most non-terminal\n    # or the precedence of a terminal specified by %prec.\n    #\n    # A variety of error checks are performed to make sure production symbols\n    # are valid and that %prec is used correctly.\n    # -----------------------------------------------------------------------------\n\n    def add_production(self, prodname, syms, func=None, file='', line=0):\n\n        if prodname in self.Terminals:\n            raise GrammarError('%s:%d: Illegal rule name %r. Already defined as a token' % (file, line, prodname))\n        if prodname == 'error':\n            raise GrammarError('%s:%d: Illegal rule name %r. error is a reserved word' % (file, line, prodname))\n        if not _is_identifier.match(prodname):\n            raise GrammarError('%s:%d: Illegal rule name %r' % (file, line, prodname))\n\n        # Look for literal tokens\n        for n, s in enumerate(syms):\n            if s[0] in \"'\\\"\":\n                try:\n                    c = eval(s)\n                    if (len(c) > 1):\n                        raise GrammarError('%s:%d: Literal token %s in rule %r may only be a single character' %\n                                           (file, line, s, prodname))\n                    if c not in self.Terminals:\n                        self.Terminals[c] = []\n                    syms[n] = c\n                    continue\n                except SyntaxError:\n                    pass\n            if not _is_identifier.match(s) and s != '%prec':\n                raise GrammarError('%s:%d: Illegal name %r in rule %r' % (file, line, s, prodname))\n\n        # Determine the precedence level\n        if '%prec' in syms:\n            if syms[-1] == '%prec':\n                raise GrammarError('%s:%d: Syntax error. Nothing follows %%prec' % (file, line))\n            if syms[-2] != '%prec':\n                raise GrammarError('%s:%d: Syntax error. %%prec can only appear at the end of a grammar rule' %\n                                   (file, line))\n            precname = syms[-1]\n            prodprec = self.Precedence.get(precname)\n            if not prodprec:\n                raise GrammarError('%s:%d: Nothing known about the precedence of %r' % (file, line, precname))\n            else:\n                self.UsedPrecedence.add(precname)\n            del syms[-2:]     # Drop %prec from the rule\n        else:\n            # If no %prec, precedence is determined by the rightmost terminal symbol\n            precname = rightmost_terminal(syms, self.Terminals)\n            prodprec = self.Precedence.get(precname, ('right', 0))\n\n        # See if the rule is already in the rulemap\n        map = '%s -> %s' % (prodname, syms)\n        if map in self.Prodmap:\n            m = self.Prodmap[map]\n            raise GrammarError('%s:%d: Duplicate rule %s. ' % (file, line, m) +\n                               'Previous definition at %s:%d' % (m.file, m.line))\n\n        # From this point on, everything is valid.  Create a new Production instance\n        pnumber  = len(self.Productions)\n        if prodname not in self.Nonterminals:\n            self.Nonterminals[prodname] = []\n\n        # Add the production number to Terminals and Nonterminals\n        for t in syms:\n            if t in self.Terminals:\n                self.Terminals[t].append(pnumber)\n            else:\n                if t not in self.Nonterminals:\n                    self.Nonterminals[t] = []\n                self.Nonterminals[t].append(pnumber)\n\n        # Create a production and add it to the list of productions\n        p = Production(pnumber, prodname, syms, prodprec, func, file, line)\n        self.Productions.append(p)\n        self.Prodmap[map] = p\n\n        # Add to the global productions list\n        try:\n            self.Prodnames[prodname].append(p)\n        except KeyError:\n            self.Prodnames[prodname] = [p]\n\n    # -----------------------------------------------------------------------------\n    # set_start()\n    #\n    # Sets the starting symbol and creates the augmented grammar.  Production\n    # rule 0 is S' -> start where start is the start symbol.\n    # -----------------------------------------------------------------------------\n\n    def set_start(self, start=None):\n        if not start:\n            start = self.Productions[1].name\n        if start not in self.Nonterminals:\n            raise GrammarError('start symbol %s undefined' % start)\n        self.Productions[0] = Production(0, \"S'\", [start])\n        self.Nonterminals[start].append(0)\n        self.Start = start\n\n    # -----------------------------------------------------------------------------\n    # find_unreachable()\n    #\n    # Find all of the nonterminal symbols that can't be reached from the starting\n    # symbol.  Returns a list of nonterminals that can't be reached.\n    # -----------------------------------------------------------------------------\n\n    def find_unreachable(self):\n\n        # Mark all symbols that are reachable from a symbol s\n        def mark_reachable_from(s):\n            if s in reachable:\n                return\n            reachable.add(s)\n            for p in self.Prodnames.get(s, []):\n                for r in p.prod:\n                    mark_reachable_from(r)\n\n        reachable = set()\n        mark_reachable_from(self.Productions[0].prod[0])\n        return [s for s in self.Nonterminals if s not in reachable]\n\n    # -----------------------------------------------------------------------------\n    # infinite_cycles()\n    #\n    # This function looks at the various parsing rules and tries to detect\n    # infinite recursion cycles (grammar rules where there is no possible way\n    # to derive a string of only terminals).\n    # -----------------------------------------------------------------------------\n\n    def infinite_cycles(self):\n        terminates = {}\n\n        # Terminals:\n        for t in self.Terminals:\n            terminates[t] = True\n\n        terminates['$end'] = True\n\n        # Nonterminals:\n\n        # Initialize to false:\n        for n in self.Nonterminals:\n            terminates[n] = False\n\n        # Then propagate termination until no change:\n        while True:\n            some_change = False\n            for (n, pl) in self.Prodnames.items():\n                # Nonterminal n terminates iff any of its productions terminates.\n                for p in pl:\n                    # Production p terminates iff all of its rhs symbols terminate.\n                    for s in p.prod:\n                        if not terminates[s]:\n                            # The symbol s does not terminate,\n                            # so production p does not terminate.\n                            p_terminates = False\n                            break\n                    else:\n                        # didn't break from the loop,\n                        # so every symbol s terminates\n                        # so production p terminates.\n                        p_terminates = True\n\n                    if p_terminates:\n                        # symbol n terminates!\n                        if not terminates[n]:\n                            terminates[n] = True\n                            some_change = True\n                        # Don't need to consider any more productions for this n.\n                        break\n\n            if not some_change:\n                break\n\n        infinite = []\n        for (s, term) in terminates.items():\n            if not term:\n                if s not in self.Prodnames and s not in self.Terminals and s != 'error':\n                    # s is used-but-not-defined, and we've already warned of that,\n                    # so it would be overkill to say that it's also non-terminating.\n                    pass\n                else:\n                    infinite.append(s)\n\n        return infinite\n\n    # -----------------------------------------------------------------------------\n    # undefined_symbols()\n    #\n    # Find all symbols that were used the grammar, but not defined as tokens or\n    # grammar rules.  Returns a list of tuples (sym, prod) where sym in the symbol\n    # and prod is the production where the symbol was used.\n    # -----------------------------------------------------------------------------\n    def undefined_symbols(self):\n        result = []\n        for p in self.Productions:\n            if not p:\n                continue\n\n            for s in p.prod:\n                if s not in self.Prodnames and s not in self.Terminals and s != 'error':\n                    result.append((s, p))\n        return result\n\n    # -----------------------------------------------------------------------------\n    # unused_terminals()\n    #\n    # Find all terminals that were defined, but not used by the grammar.  Returns\n    # a list of all symbols.\n    # -----------------------------------------------------------------------------\n    def unused_terminals(self):\n        unused_tok = []\n        for s, v in self.Terminals.items():\n            if s != 'error' and not v:\n                unused_tok.append(s)\n\n        return unused_tok\n\n    # ------------------------------------------------------------------------------\n    # unused_rules()\n    #\n    # Find all grammar rules that were defined,  but not used (maybe not reachable)\n    # Returns a list of productions.\n    # ------------------------------------------------------------------------------\n\n    def unused_rules(self):\n        unused_prod = []\n        for s, v in self.Nonterminals.items():\n            if not v:\n                p = self.Prodnames[s][0]\n                unused_prod.append(p)\n        return unused_prod\n\n    # -----------------------------------------------------------------------------\n    # unused_precedence()\n    #\n    # Returns a list of tuples (term,precedence) corresponding to precedence\n    # rules that were never used by the grammar.  term is the name of the terminal\n    # on which precedence was applied and precedence is a string such as 'left' or\n    # 'right' corresponding to the type of precedence.\n    # -----------------------------------------------------------------------------\n\n    def unused_precedence(self):\n        unused = []\n        for termname in self.Precedence:\n            if not (termname in self.Terminals or termname in self.UsedPrecedence):\n                unused.append((termname, self.Precedence[termname][0]))\n\n        return unused\n\n    # -------------------------------------------------------------------------\n    # _first()\n    #\n    # Compute the value of FIRST1(beta) where beta is a tuple of symbols.\n    #\n    # During execution of compute_first1, the result may be incomplete.\n    # Afterward (e.g., when called from compute_follow()), it will be complete.\n    # -------------------------------------------------------------------------\n    def _first(self, beta):\n\n        # We are computing First(x1,x2,x3,...,xn)\n        result = []\n        for x in beta:\n            x_produces_empty = False\n\n            # Add all the non-<empty> symbols of First[x] to the result.\n            for f in self.First[x]:\n                if f == '<empty>':\n                    x_produces_empty = True\n                else:\n                    if f not in result:\n                        result.append(f)\n\n            if x_produces_empty:\n                # We have to consider the next x in beta,\n                # i.e. stay in the loop.\n                pass\n            else:\n                # We don't have to consider any further symbols in beta.\n                break\n        else:\n            # There was no 'break' from the loop,\n            # so x_produces_empty was true for all x in beta,\n            # so beta produces empty as well.\n            result.append('<empty>')\n\n        return result\n\n    # -------------------------------------------------------------------------\n    # compute_first()\n    #\n    # Compute the value of FIRST1(X) for all symbols\n    # -------------------------------------------------------------------------\n    def compute_first(self):\n        if self.First:\n            return self.First\n\n        # Terminals:\n        for t in self.Terminals:\n            self.First[t] = [t]\n\n        self.First['$end'] = ['$end']\n\n        # Nonterminals:\n\n        # Initialize to the empty set:\n        for n in self.Nonterminals:\n            self.First[n] = []\n\n        # Then propagate symbols until no change:\n        while True:\n            some_change = False\n            for n in self.Nonterminals:\n                for p in self.Prodnames[n]:\n                    for f in self._first(p.prod):\n                        if f not in self.First[n]:\n                            self.First[n].append(f)\n                            some_change = True\n            if not some_change:\n                break\n\n        return self.First\n\n    # ---------------------------------------------------------------------\n    # compute_follow()\n    #\n    # Computes all of the follow sets for every non-terminal symbol.  The\n    # follow set is the set of all symbols that might follow a given\n    # non-terminal.  See the Dragon book, 2nd Ed. p. 189.\n    # ---------------------------------------------------------------------\n    def compute_follow(self, start=None):\n        # If already computed, return the result\n        if self.Follow:\n            return self.Follow\n\n        # If first sets not computed yet, do that first.\n        if not self.First:\n            self.compute_first()\n\n        # Add '$end' to the follow list of the start symbol\n        for k in self.Nonterminals:\n            self.Follow[k] = []\n\n        if not start:\n            start = self.Productions[1].name\n\n        self.Follow[start] = ['$end']\n\n        while True:\n            didadd = False\n            for p in self.Productions[1:]:\n                # Here is the production set\n                for i, B in enumerate(p.prod):\n                    if B in self.Nonterminals:\n                        # Okay. We got a non-terminal in a production\n                        fst = self._first(p.prod[i+1:])\n                        hasempty = False\n                        for f in fst:\n                            if f != '<empty>' and f not in self.Follow[B]:\n                                self.Follow[B].append(f)\n                                didadd = True\n                            if f == '<empty>':\n                                hasempty = True\n                        if hasempty or i == (len(p.prod)-1):\n                            # Add elements of follow(a) to follow(b)\n                            for f in self.Follow[p.name]:\n                                if f not in self.Follow[B]:\n                                    self.Follow[B].append(f)\n                                    didadd = True\n            if not didadd:\n                break\n        return self.Follow\n\n\n    # -----------------------------------------------------------------------------\n    # build_lritems()\n    #\n    # This function walks the list of productions and builds a complete set of the\n    # LR items.  The LR items are stored in two ways:  First, they are uniquely\n    # numbered and placed in the list _lritems.  Second, a linked list of LR items\n    # is built for each production.  For example:\n    #\n    #   E -> E PLUS E\n    #\n    # Creates the list\n    #\n    #  [E -> . E PLUS E, E -> E . PLUS E, E -> E PLUS . E, E -> E PLUS E . ]\n    # -----------------------------------------------------------------------------\n\n    def build_lritems(self):\n        for p in self.Productions:\n            lastlri = p\n            i = 0\n            lr_items = []\n            while True:\n                if i > len(p):\n                    lri = None\n                else:\n                    lri = LRItem(p, i)\n                    # Precompute the list of productions immediately following\n                    try:\n                        lri.lr_after = self.Prodnames[lri.prod[i+1]]\n                    except (IndexError, KeyError):\n                        lri.lr_after = []\n                    try:\n                        lri.lr_before = lri.prod[i-1]\n                    except IndexError:\n                        lri.lr_before = None\n\n                lastlri.lr_next = lri\n                if not lri:\n                    break\n                lr_items.append(lri)\n                lastlri = lri\n                i += 1\n            p.lr_items = lr_items\n\n# -----------------------------------------------------------------------------\n#                            == Class LRTable ==\n#\n# This basic class represents a basic table of LR parsing information.\n# Methods for generating the tables are not defined here.  They are defined\n# in the derived class LRGeneratedTable.\n# -----------------------------------------------------------------------------\n\nclass VersionError(YaccError):\n    pass\n\nclass LRTable(object):\n    def __init__(self):\n        self.lr_action = None\n        self.lr_goto = None\n        self.lr_productions = None\n        self.lr_method = None\n\n    def read_table(self, module):\n        if isinstance(module, types.ModuleType):\n            parsetab = module\n        else:\n            exec('import %s' % module)\n            parsetab = sys.modules[module]\n\n        if parsetab._tabversion != __tabversion__:\n            raise VersionError('yacc table file version is out of date')\n\n        self.lr_action = parsetab._lr_action\n        self.lr_goto = parsetab._lr_goto\n\n        self.lr_productions = []\n        for p in parsetab._lr_productions:\n            self.lr_productions.append(MiniProduction(*p))\n\n        self.lr_method = parsetab._lr_method\n        return parsetab._lr_signature\n\n    def read_pickle(self, filename):\n        try:\n            import cPickle as pickle\n        except ImportError:\n            import pickle\n\n        if not os.path.exists(filename):\n          raise ImportError\n\n        in_f = open(filename, 'rb')\n\n        tabversion = pickle.load(in_f)\n        if tabversion != __tabversion__:\n            raise VersionError('yacc table file version is out of date')\n        self.lr_method = pickle.load(in_f)\n        signature      = pickle.load(in_f)\n        self.lr_action = pickle.load(in_f)\n        self.lr_goto   = pickle.load(in_f)\n        productions    = pickle.load(in_f)\n\n        self.lr_productions = []\n        for p in productions:\n            self.lr_productions.append(MiniProduction(*p))\n\n        in_f.close()\n        return signature\n\n    # Bind all production function names to callable objects in pdict\n    def bind_callables(self, pdict):\n        for p in self.lr_productions:\n            p.bind(pdict)\n\n\n# -----------------------------------------------------------------------------\n#                           === LR Generator ===\n#\n# The following classes and functions are used to generate LR parsing tables on\n# a grammar.\n# -----------------------------------------------------------------------------\n\n# -----------------------------------------------------------------------------\n# digraph()\n# traverse()\n#\n# The following two functions are used to compute set valued functions\n# of the form:\n#\n#     F(x) = F'(x) U U{F(y) | x R y}\n#\n# This is used to compute the values of Read() sets as well as FOLLOW sets\n# in LALR(1) generation.\n#\n# Inputs:  X    - An input set\n#          R    - A relation\n#          FP   - Set-valued function\n# ------------------------------------------------------------------------------\n\ndef digraph(X, R, FP):\n    N = {}\n    for x in X:\n        N[x] = 0\n    stack = []\n    F = {}\n    for x in X:\n        if N[x] == 0:\n            traverse(x, N, stack, F, X, R, FP)\n    return F\n\ndef traverse(x, N, stack, F, X, R, FP):\n    stack.append(x)\n    d = len(stack)\n    N[x] = d\n    F[x] = FP(x)             # F(X) <- F'(x)\n\n    rel = R(x)               # Get y's related to x\n    for y in rel:\n        if N[y] == 0:\n            traverse(y, N, stack, F, X, R, FP)\n        N[x] = min(N[x], N[y])\n        for a in F.get(y, []):\n            if a not in F[x]:\n                F[x].append(a)\n    if N[x] == d:\n        N[stack[-1]] = MAXINT\n        F[stack[-1]] = F[x]\n        element = stack.pop()\n        while element != x:\n            N[stack[-1]] = MAXINT\n            F[stack[-1]] = F[x]\n            element = stack.pop()\n\nclass LALRError(YaccError):\n    pass\n\n# -----------------------------------------------------------------------------\n#                             == LRGeneratedTable ==\n#\n# This class implements the LR table generation algorithm.  There are no\n# public methods except for write()\n# -----------------------------------------------------------------------------\n\nclass LRGeneratedTable(LRTable):\n    def __init__(self, grammar, method='LALR', log=None):\n        if method not in ['SLR', 'LALR']:\n            raise LALRError('Unsupported method %s' % method)\n\n        self.grammar = grammar\n        self.lr_method = method\n\n        # Set up the logger\n        if not log:\n            log = NullLogger()\n        self.log = log\n\n        # Internal attributes\n        self.lr_action     = {}        # Action table\n        self.lr_goto       = {}        # Goto table\n        self.lr_productions  = grammar.Productions    # Copy of grammar Production array\n        self.lr_goto_cache = {}        # Cache of computed gotos\n        self.lr0_cidhash   = {}        # Cache of closures\n\n        self._add_count    = 0         # Internal counter used to detect cycles\n\n        # Diagonistic information filled in by the table generator\n        self.sr_conflict   = 0\n        self.rr_conflict   = 0\n        self.conflicts     = []        # List of conflicts\n\n        self.sr_conflicts  = []\n        self.rr_conflicts  = []\n\n        # Build the tables\n        self.grammar.build_lritems()\n        self.grammar.compute_first()\n        self.grammar.compute_follow()\n        self.lr_parse_table()\n\n    # Compute the LR(0) closure operation on I, where I is a set of LR(0) items.\n\n    def lr0_closure(self, I):\n        self._add_count += 1\n\n        # Add everything in I to J\n        J = I[:]\n        didadd = True\n        while didadd:\n            didadd = False\n            for j in J:\n                for x in j.lr_after:\n                    if getattr(x, 'lr0_added', 0) == self._add_count:\n                        continue\n                    # Add B --> .G to J\n                    J.append(x.lr_next)\n                    x.lr0_added = self._add_count\n                    didadd = True\n\n        return J\n\n    # Compute the LR(0) goto function goto(I,X) where I is a set\n    # of LR(0) items and X is a grammar symbol.   This function is written\n    # in a way that guarantees uniqueness of the generated goto sets\n    # (i.e. the same goto set will never be returned as two different Python\n    # objects).  With uniqueness, we can later do fast set comparisons using\n    # id(obj) instead of element-wise comparison.\n\n    def lr0_goto(self, I, x):\n        # First we look for a previously cached entry\n        g = self.lr_goto_cache.get((id(I), x))\n        if g:\n            return g\n\n        # Now we generate the goto set in a way that guarantees uniqueness\n        # of the result\n\n        s = self.lr_goto_cache.get(x)\n        if not s:\n            s = {}\n            self.lr_goto_cache[x] = s\n\n        gs = []\n        for p in I:\n            n = p.lr_next\n            if n and n.lr_before == x:\n                s1 = s.get(id(n))\n                if not s1:\n                    s1 = {}\n                    s[id(n)] = s1\n                gs.append(n)\n                s = s1\n        g = s.get('$end')\n        if not g:\n            if gs:\n                g = self.lr0_closure(gs)\n                s['$end'] = g\n            else:\n                s['$end'] = gs\n        self.lr_goto_cache[(id(I), x)] = g\n        return g\n\n    # Compute the LR(0) sets of item function\n    def lr0_items(self):\n        C = [self.lr0_closure([self.grammar.Productions[0].lr_next])]\n        i = 0\n        for I in C:\n            self.lr0_cidhash[id(I)] = i\n            i += 1\n\n        # Loop over the items in C and each grammar symbols\n        i = 0\n        while i < len(C):\n            I = C[i]\n            i += 1\n\n            # Collect all of the symbols that could possibly be in the goto(I,X) sets\n            asyms = {}\n            for ii in I:\n                for s in ii.usyms:\n                    asyms[s] = None\n\n            for x in asyms:\n                g = self.lr0_goto(I, x)\n                if not g or id(g) in self.lr0_cidhash:\n                    continue\n                self.lr0_cidhash[id(g)] = len(C)\n                C.append(g)\n\n        return C\n\n    # -----------------------------------------------------------------------------\n    #                       ==== LALR(1) Parsing ====\n    #\n    # LALR(1) parsing is almost exactly the same as SLR except that instead of\n    # relying upon Follow() sets when performing reductions, a more selective\n    # lookahead set that incorporates the state of the LR(0) machine is utilized.\n    # Thus, we mainly just have to focus on calculating the lookahead sets.\n    #\n    # The method used here is due to DeRemer and Pennelo (1982).\n    #\n    # DeRemer, F. L., and T. J. Pennelo: \"Efficient Computation of LALR(1)\n    #     Lookahead Sets\", ACM Transactions on Programming Languages and Systems,\n    #     Vol. 4, No. 4, Oct. 1982, pp. 615-649\n    #\n    # Further details can also be found in:\n    #\n    #  J. Tremblay and P. Sorenson, \"The Theory and Practice of Compiler Writing\",\n    #      McGraw-Hill Book Company, (1985).\n    #\n    # -----------------------------------------------------------------------------\n\n    # -----------------------------------------------------------------------------\n    # compute_nullable_nonterminals()\n    #\n    # Creates a dictionary containing all of the non-terminals that might produce\n    # an empty production.\n    # -----------------------------------------------------------------------------\n\n    def compute_nullable_nonterminals(self):\n        nullable = set()\n        num_nullable = 0\n        while True:\n            for p in self.grammar.Productions[1:]:\n                if p.len == 0:\n                    nullable.add(p.name)\n                    continue\n                for t in p.prod:\n                    if t not in nullable:\n                        break\n                else:\n                    nullable.add(p.name)\n            if len(nullable) == num_nullable:\n                break\n            num_nullable = len(nullable)\n        return nullable\n\n    # -----------------------------------------------------------------------------\n    # find_nonterminal_trans(C)\n    #\n    # Given a set of LR(0) items, this functions finds all of the non-terminal\n    # transitions.    These are transitions in which a dot appears immediately before\n    # a non-terminal.   Returns a list of tuples of the form (state,N) where state\n    # is the state number and N is the nonterminal symbol.\n    #\n    # The input C is the set of LR(0) items.\n    # -----------------------------------------------------------------------------\n\n    def find_nonterminal_transitions(self, C):\n        trans = []\n        for stateno, state in enumerate(C):\n            for p in state:\n                if p.lr_index < p.len - 1:\n                    t = (stateno, p.prod[p.lr_index+1])\n                    if t[1] in self.grammar.Nonterminals:\n                        if t not in trans:\n                            trans.append(t)\n        return trans\n\n    # -----------------------------------------------------------------------------\n    # dr_relation()\n    #\n    # Computes the DR(p,A) relationships for non-terminal transitions.  The input\n    # is a tuple (state,N) where state is a number and N is a nonterminal symbol.\n    #\n    # Returns a list of terminals.\n    # -----------------------------------------------------------------------------\n\n    def dr_relation(self, C, trans, nullable):\n        state, N = trans\n        terms = []\n\n        g = self.lr0_goto(C[state], N)\n        for p in g:\n            if p.lr_index < p.len - 1:\n                a = p.prod[p.lr_index+1]\n                if a in self.grammar.Terminals:\n                    if a not in terms:\n                        terms.append(a)\n\n        # This extra bit is to handle the start state\n        if state == 0 and N == self.grammar.Productions[0].prod[0]:\n            terms.append('$end')\n\n        return terms\n\n    # -----------------------------------------------------------------------------\n    # reads_relation()\n    #\n    # Computes the READS() relation (p,A) READS (t,C).\n    # -----------------------------------------------------------------------------\n\n    def reads_relation(self, C, trans, empty):\n        # Look for empty transitions\n        rel = []\n        state, N = trans\n\n        g = self.lr0_goto(C[state], N)\n        j = self.lr0_cidhash.get(id(g), -1)\n        for p in g:\n            if p.lr_index < p.len - 1:\n                a = p.prod[p.lr_index + 1]\n                if a in empty:\n                    rel.append((j, a))\n\n        return rel\n\n    # -----------------------------------------------------------------------------\n    # compute_lookback_includes()\n    #\n    # Determines the lookback and includes relations\n    #\n    # LOOKBACK:\n    #\n    # This relation is determined by running the LR(0) state machine forward.\n    # For example, starting with a production \"N : . A B C\", we run it forward\n    # to obtain \"N : A B C .\"   We then build a relationship between this final\n    # state and the starting state.   These relationships are stored in a dictionary\n    # lookdict.\n    #\n    # INCLUDES:\n    #\n    # Computes the INCLUDE() relation (p,A) INCLUDES (p',B).\n    #\n    # This relation is used to determine non-terminal transitions that occur\n    # inside of other non-terminal transition states.   (p,A) INCLUDES (p', B)\n    # if the following holds:\n    #\n    #       B -> LAT, where T -> epsilon and p' -L-> p\n    #\n    # L is essentially a prefix (which may be empty), T is a suffix that must be\n    # able to derive an empty string.  State p' must lead to state p with the string L.\n    #\n    # -----------------------------------------------------------------------------\n\n    def compute_lookback_includes(self, C, trans, nullable):\n        lookdict = {}          # Dictionary of lookback relations\n        includedict = {}       # Dictionary of include relations\n\n        # Make a dictionary of non-terminal transitions\n        dtrans = {}\n        for t in trans:\n            dtrans[t] = 1\n\n        # Loop over all transitions and compute lookbacks and includes\n        for state, N in trans:\n            lookb = []\n            includes = []\n            for p in C[state]:\n                if p.name != N:\n                    continue\n\n                # Okay, we have a name match.  We now follow the production all the way\n                # through the state machine until we get the . on the right hand side\n\n                lr_index = p.lr_index\n                j = state\n                while lr_index < p.len - 1:\n                    lr_index = lr_index + 1\n                    t = p.prod[lr_index]\n\n                    # Check to see if this symbol and state are a non-terminal transition\n                    if (j, t) in dtrans:\n                        # Yes.  Okay, there is some chance that this is an includes relation\n                        # the only way to know for certain is whether the rest of the\n                        # production derives empty\n\n                        li = lr_index + 1\n                        while li < p.len:\n                            if p.prod[li] in self.grammar.Terminals:\n                                break      # No forget it\n                            if p.prod[li] not in nullable:\n                                break\n                            li = li + 1\n                        else:\n                            # Appears to be a relation between (j,t) and (state,N)\n                            includes.append((j, t))\n\n                    g = self.lr0_goto(C[j], t)               # Go to next set\n                    j = self.lr0_cidhash.get(id(g), -1)      # Go to next state\n\n                # When we get here, j is the final state, now we have to locate the production\n                for r in C[j]:\n                    if r.name != p.name:\n                        continue\n                    if r.len != p.len:\n                        continue\n                    i = 0\n                    # This look is comparing a production \". A B C\" with \"A B C .\"\n                    while i < r.lr_index:\n                        if r.prod[i] != p.prod[i+1]:\n                            break\n                        i = i + 1\n                    else:\n                        lookb.append((j, r))\n            for i in includes:\n                if i not in includedict:\n                    includedict[i] = []\n                includedict[i].append((state, N))\n            lookdict[(state, N)] = lookb\n\n        return lookdict, includedict\n\n    # -----------------------------------------------------------------------------\n    # compute_read_sets()\n    #\n    # Given a set of LR(0) items, this function computes the read sets.\n    #\n    # Inputs:  C        =  Set of LR(0) items\n    #          ntrans   = Set of nonterminal transitions\n    #          nullable = Set of empty transitions\n    #\n    # Returns a set containing the read sets\n    # -----------------------------------------------------------------------------\n\n    def compute_read_sets(self, C, ntrans, nullable):\n        FP = lambda x: self.dr_relation(C, x, nullable)\n        R =  lambda x: self.reads_relation(C, x, nullable)\n        F = digraph(ntrans, R, FP)\n        return F\n\n    # -----------------------------------------------------------------------------\n    # compute_follow_sets()\n    #\n    # Given a set of LR(0) items, a set of non-terminal transitions, a readset,\n    # and an include set, this function computes the follow sets\n    #\n    # Follow(p,A) = Read(p,A) U U {Follow(p',B) | (p,A) INCLUDES (p',B)}\n    #\n    # Inputs:\n    #            ntrans     = Set of nonterminal transitions\n    #            readsets   = Readset (previously computed)\n    #            inclsets   = Include sets (previously computed)\n    #\n    # Returns a set containing the follow sets\n    # -----------------------------------------------------------------------------\n\n    def compute_follow_sets(self, ntrans, readsets, inclsets):\n        FP = lambda x: readsets[x]\n        R  = lambda x: inclsets.get(x, [])\n        F = digraph(ntrans, R, FP)\n        return F\n\n    # -----------------------------------------------------------------------------\n    # add_lookaheads()\n    #\n    # Attaches the lookahead symbols to grammar rules.\n    #\n    # Inputs:    lookbacks         -  Set of lookback relations\n    #            followset         -  Computed follow set\n    #\n    # This function directly attaches the lookaheads to productions contained\n    # in the lookbacks set\n    # -----------------------------------------------------------------------------\n\n    def add_lookaheads(self, lookbacks, followset):\n        for trans, lb in lookbacks.items():\n            # Loop over productions in lookback\n            for state, p in lb:\n                if state not in p.lookaheads:\n                    p.lookaheads[state] = []\n                f = followset.get(trans, [])\n                for a in f:\n                    if a not in p.lookaheads[state]:\n                        p.lookaheads[state].append(a)\n\n    # -----------------------------------------------------------------------------\n    # add_lalr_lookaheads()\n    #\n    # This function does all of the work of adding lookahead information for use\n    # with LALR parsing\n    # -----------------------------------------------------------------------------\n\n    def add_lalr_lookaheads(self, C):\n        # Determine all of the nullable nonterminals\n        nullable = self.compute_nullable_nonterminals()\n\n        # Find all non-terminal transitions\n        trans = self.find_nonterminal_transitions(C)\n\n        # Compute read sets\n        readsets = self.compute_read_sets(C, trans, nullable)\n\n        # Compute lookback/includes relations\n        lookd, included = self.compute_lookback_includes(C, trans, nullable)\n\n        # Compute LALR FOLLOW sets\n        followsets = self.compute_follow_sets(trans, readsets, included)\n\n        # Add all of the lookaheads\n        self.add_lookaheads(lookd, followsets)\n\n    # -----------------------------------------------------------------------------\n    # lr_parse_table()\n    #\n    # This function constructs the parse tables for SLR or LALR\n    # -----------------------------------------------------------------------------\n    def lr_parse_table(self):\n        Productions = self.grammar.Productions\n        Precedence  = self.grammar.Precedence\n        goto   = self.lr_goto         # Goto array\n        action = self.lr_action       # Action array\n        log    = self.log             # Logger for output\n\n        actionp = {}                  # Action production array (temporary)\n\n        log.info('Parsing method: %s', self.lr_method)\n\n        # Step 1: Construct C = { I0, I1, ... IN}, collection of LR(0) items\n        # This determines the number of states\n\n        C = self.lr0_items()\n\n        if self.lr_method == 'LALR':\n            self.add_lalr_lookaheads(C)\n\n        # Build the parser table, state by state\n        st = 0\n        for I in C:\n            # Loop over each production in I\n            actlist = []              # List of actions\n            st_action  = {}\n            st_actionp = {}\n            st_goto    = {}\n            log.info('')\n            log.info('state %d', st)\n            log.info('')\n            for p in I:\n                log.info('    (%d) %s', p.number, p)\n            log.info('')\n\n            for p in I:\n                    if p.len == p.lr_index + 1:\n                        if p.name == \"S'\":\n                            # Start symbol. Accept!\n                            st_action['$end'] = 0\n                            st_actionp['$end'] = p\n                        else:\n                            # We are at the end of a production.  Reduce!\n                            if self.lr_method == 'LALR':\n                                laheads = p.lookaheads[st]\n                            else:\n                                laheads = self.grammar.Follow[p.name]\n                            for a in laheads:\n                                actlist.append((a, p, 'reduce using rule %d (%s)' % (p.number, p)))\n                                r = st_action.get(a)\n                                if r is not None:\n                                    # Whoa. Have a shift/reduce or reduce/reduce conflict\n                                    if r > 0:\n                                        # Need to decide on shift or reduce here\n                                        # By default we favor shifting. Need to add\n                                        # some precedence rules here.\n\n                                        # Shift precedence comes from the token\n                                        sprec, slevel = Precedence.get(a, ('right', 0))\n\n                                        # Reduce precedence comes from rule being reduced (p)\n                                        rprec, rlevel = Productions[p.number].prec\n\n                                        if (slevel < rlevel) or ((slevel == rlevel) and (rprec == 'left')):\n                                            # We really need to reduce here.\n                                            st_action[a] = -p.number\n                                            st_actionp[a] = p\n                                            if not slevel and not rlevel:\n                                                log.info('  ! shift/reduce conflict for %s resolved as reduce', a)\n                                                self.sr_conflicts.append((st, a, 'reduce'))\n                                            Productions[p.number].reduced += 1\n                                        elif (slevel == rlevel) and (rprec == 'nonassoc'):\n                                            st_action[a] = None\n                                        else:\n                                            # Hmmm. Guess we'll keep the shift\n                                            if not rlevel:\n                                                log.info('  ! shift/reduce conflict for %s resolved as shift', a)\n                                                self.sr_conflicts.append((st, a, 'shift'))\n                                    elif r < 0:\n                                        # Reduce/reduce conflict.   In this case, we favor the rule\n                                        # that was defined first in the grammar file\n                                        oldp = Productions[-r]\n                                        pp = Productions[p.number]\n                                        if oldp.line > pp.line:\n                                            st_action[a] = -p.number\n                                            st_actionp[a] = p\n                                            chosenp, rejectp = pp, oldp\n                                            Productions[p.number].reduced += 1\n                                            Productions[oldp.number].reduced -= 1\n                                        else:\n                                            chosenp, rejectp = oldp, pp\n                                        self.rr_conflicts.append((st, chosenp, rejectp))\n                                        log.info('  ! reduce/reduce conflict for %s resolved using rule %d (%s)',\n                                                 a, st_actionp[a].number, st_actionp[a])\n                                    else:\n                                        raise LALRError('Unknown conflict in state %d' % st)\n                                else:\n                                    st_action[a] = -p.number\n                                    st_actionp[a] = p\n                                    Productions[p.number].reduced += 1\n                    else:\n                        i = p.lr_index\n                        a = p.prod[i+1]       # Get symbol right after the \".\"\n                        if a in self.grammar.Terminals:\n                            g = self.lr0_goto(I, a)\n                            j = self.lr0_cidhash.get(id(g), -1)\n                            if j >= 0:\n                                # We are in a shift state\n                                actlist.append((a, p, 'shift and go to state %d' % j))\n                                r = st_action.get(a)\n                                if r is not None:\n                                    # Whoa have a shift/reduce or shift/shift conflict\n                                    if r > 0:\n                                        if r != j:\n                                            raise LALRError('Shift/shift conflict in state %d' % st)\n                                    elif r < 0:\n                                        # Do a precedence check.\n                                        #   -  if precedence of reduce rule is higher, we reduce.\n                                        #   -  if precedence of reduce is same and left assoc, we reduce.\n                                        #   -  otherwise we shift\n\n                                        # Shift precedence comes from the token\n                                        sprec, slevel = Precedence.get(a, ('right', 0))\n\n                                        # Reduce precedence comes from the rule that could have been reduced\n                                        rprec, rlevel = Productions[st_actionp[a].number].prec\n\n                                        if (slevel > rlevel) or ((slevel == rlevel) and (rprec == 'right')):\n                                            # We decide to shift here... highest precedence to shift\n                                            Productions[st_actionp[a].number].reduced -= 1\n                                            st_action[a] = j\n                                            st_actionp[a] = p\n                                            if not rlevel:\n                                                log.info('  ! shift/reduce conflict for %s resolved as shift', a)\n                                                self.sr_conflicts.append((st, a, 'shift'))\n                                        elif (slevel == rlevel) and (rprec == 'nonassoc'):\n                                            st_action[a] = None\n                                        else:\n                                            # Hmmm. Guess we'll keep the reduce\n                                            if not slevel and not rlevel:\n                                                log.info('  ! shift/reduce conflict for %s resolved as reduce', a)\n                                                self.sr_conflicts.append((st, a, 'reduce'))\n\n                                    else:\n                                        raise LALRError('Unknown conflict in state %d' % st)\n                                else:\n                                    st_action[a] = j\n                                    st_actionp[a] = p\n\n            # Print the actions associated with each terminal\n            _actprint = {}\n            for a, p, m in actlist:\n                if a in st_action:\n                    if p is st_actionp[a]:\n                        log.info('    %-15s %s', a, m)\n                        _actprint[(a, m)] = 1\n            log.info('')\n            # Print the actions that were not used. (debugging)\n            not_used = 0\n            for a, p, m in actlist:\n                if a in st_action:\n                    if p is not st_actionp[a]:\n                        if not (a, m) in _actprint:\n                            log.debug('  ! %-15s [ %s ]', a, m)\n                            not_used = 1\n                            _actprint[(a, m)] = 1\n            if not_used:\n                log.debug('')\n\n            # Construct the goto table for this state\n\n            nkeys = {}\n            for ii in I:\n                for s in ii.usyms:\n                    if s in self.grammar.Nonterminals:\n                        nkeys[s] = None\n            for n in nkeys:\n                g = self.lr0_goto(I, n)\n                j = self.lr0_cidhash.get(id(g), -1)\n                if j >= 0:\n                    st_goto[n] = j\n                    log.info('    %-30s shift and go to state %d', n, j)\n\n            action[st] = st_action\n            actionp[st] = st_actionp\n            goto[st] = st_goto\n            st += 1\n\n    # -----------------------------------------------------------------------------\n    # write()\n    #\n    # This function writes the LR parsing tables to a file\n    # -----------------------------------------------------------------------------\n\n    def write_table(self, tabmodule, outputdir='', signature=''):\n        if isinstance(tabmodule, types.ModuleType):\n            raise IOError(\"Won't overwrite existing tabmodule\")\n\n        basemodulename = tabmodule.split('.')[-1]\n        filename = os.path.join(outputdir, basemodulename) + '.py'\n        try:\n            f = open(filename, 'w')\n\n            f.write('''\n# %s\n# This file is automatically generated. Do not edit.\n# pylint: disable=W,C,R\n_tabversion = %r\n\n_lr_method = %r\n\n_lr_signature = %r\n    ''' % (os.path.basename(filename), __tabversion__, self.lr_method, signature))\n\n            # Change smaller to 0 to go back to original tables\n            smaller = 1\n\n            # Factor out names to try and make smaller\n            if smaller:\n                items = {}\n\n                for s, nd in self.lr_action.items():\n                    for name, v in nd.items():\n                        i = items.get(name)\n                        if not i:\n                            i = ([], [])\n                            items[name] = i\n                        i[0].append(s)\n                        i[1].append(v)\n\n                f.write('\\n_lr_action_items = {')\n                for k, v in items.items():\n                    f.write('%r:([' % k)\n                    for i in v[0]:\n                        f.write('%r,' % i)\n                    f.write('],[')\n                    for i in v[1]:\n                        f.write('%r,' % i)\n\n                    f.write(']),')\n                f.write('}\\n')\n\n                f.write('''\n_lr_action = {}\nfor _k, _v in _lr_action_items.items():\n   for _x,_y in zip(_v[0],_v[1]):\n      if not _x in _lr_action:  _lr_action[_x] = {}\n      _lr_action[_x][_k] = _y\ndel _lr_action_items\n''')\n\n            else:\n                f.write('\\n_lr_action = { ')\n                for k, v in self.lr_action.items():\n                    f.write('(%r,%r):%r,' % (k[0], k[1], v))\n                f.write('}\\n')\n\n            if smaller:\n                # Factor out names to try and make smaller\n                items = {}\n\n                for s, nd in self.lr_goto.items():\n                    for name, v in nd.items():\n                        i = items.get(name)\n                        if not i:\n                            i = ([], [])\n                            items[name] = i\n                        i[0].append(s)\n                        i[1].append(v)\n\n                f.write('\\n_lr_goto_items = {')\n                for k, v in items.items():\n                    f.write('%r:([' % k)\n                    for i in v[0]:\n                        f.write('%r,' % i)\n                    f.write('],[')\n                    for i in v[1]:\n                        f.write('%r,' % i)\n\n                    f.write(']),')\n                f.write('}\\n')\n\n                f.write('''\n_lr_goto = {}\nfor _k, _v in _lr_goto_items.items():\n   for _x, _y in zip(_v[0], _v[1]):\n       if not _x in _lr_goto: _lr_goto[_x] = {}\n       _lr_goto[_x][_k] = _y\ndel _lr_goto_items\n''')\n            else:\n                f.write('\\n_lr_goto = { ')\n                for k, v in self.lr_goto.items():\n                    f.write('(%r,%r):%r,' % (k[0], k[1], v))\n                f.write('}\\n')\n\n            # Write production table\n            f.write('_lr_productions = [\\n')\n            for p in self.lr_productions:\n                if p.func:\n                    f.write('  (%r,%r,%d,%r,%r,%d),\\n' % (p.str, p.name, p.len,\n                                                          p.func, os.path.basename(p.file), p.line))\n                else:\n                    f.write('  (%r,%r,%d,None,None,None),\\n' % (str(p), p.name, p.len))\n            f.write(']\\n')\n            f.close()\n\n        except IOError as e:\n            raise\n\n\n    # -----------------------------------------------------------------------------\n    # pickle_table()\n    #\n    # This function pickles the LR parsing tables to a supplied file object\n    # -----------------------------------------------------------------------------\n\n    def pickle_table(self, filename, signature=''):\n        try:\n            import cPickle as pickle\n        except ImportError:\n            import pickle\n        with open(filename, 'wb') as outf:\n            pickle.dump(__tabversion__, outf, pickle_protocol)\n            pickle.dump(self.lr_method, outf, pickle_protocol)\n            pickle.dump(signature, outf, pickle_protocol)\n            pickle.dump(self.lr_action, outf, pickle_protocol)\n            pickle.dump(self.lr_goto, outf, pickle_protocol)\n\n            outp = []\n            for p in self.lr_productions:\n                if p.func:\n                    outp.append((p.str, p.name, p.len, p.func, os.path.basename(p.file), p.line))\n                else:\n                    outp.append((str(p), p.name, p.len, None, None, None))\n            pickle.dump(outp, outf, pickle_protocol)\n\n# -----------------------------------------------------------------------------\n#                            === INTROSPECTION ===\n#\n# The following functions and classes are used to implement the PLY\n# introspection features followed by the yacc() function itself.\n# -----------------------------------------------------------------------------\n\n# -----------------------------------------------------------------------------\n# get_caller_module_dict()\n#\n# This function returns a dictionary containing all of the symbols defined within\n# a caller further down the call stack.  This is used to get the environment\n# associated with the yacc() call if none was provided.\n# -----------------------------------------------------------------------------\n\ndef get_caller_module_dict(levels):\n    f = sys._getframe(levels)\n    ldict = f.f_globals.copy()\n    if f.f_globals != f.f_locals:\n        ldict.update(f.f_locals)\n    return ldict\n\n# -----------------------------------------------------------------------------\n# parse_grammar()\n#\n# This takes a raw grammar rule string and parses it into production data\n# -----------------------------------------------------------------------------\ndef parse_grammar(doc, file, line):\n    grammar = []\n    # Split the doc string into lines\n    pstrings = doc.splitlines()\n    lastp = None\n    dline = line\n    for ps in pstrings:\n        dline += 1\n        p = ps.split()\n        if not p:\n            continue\n        try:\n            if p[0] == '|':\n                # This is a continuation of a previous rule\n                if not lastp:\n                    raise SyntaxError(\"%s:%d: Misplaced '|'\" % (file, dline))\n                prodname = lastp\n                syms = p[1:]\n            else:\n                prodname = p[0]\n                lastp = prodname\n                syms   = p[2:]\n                assign = p[1]\n                if assign != ':' and assign != '::=':\n                    raise SyntaxError(\"%s:%d: Syntax error. Expected ':'\" % (file, dline))\n\n            grammar.append((file, dline, prodname, syms))\n        except SyntaxError:\n            raise\n        except Exception:\n            raise SyntaxError('%s:%d: Syntax error in rule %r' % (file, dline, ps.strip()))\n\n    return grammar\n\n# -----------------------------------------------------------------------------\n# ParserReflect()\n#\n# This class represents information extracted for building a parser including\n# start symbol, error function, tokens, precedence list, action functions,\n# etc.\n# -----------------------------------------------------------------------------\nclass ParserReflect(object):\n    def __init__(self, pdict, log=None):\n        self.pdict      = pdict\n        self.start      = None\n        self.error_func = None\n        self.tokens     = None\n        self.modules    = set()\n        self.grammar    = []\n        self.error      = False\n\n        if log is None:\n            self.log = PlyLogger(sys.stderr)\n        else:\n            self.log = log\n\n    # Get all of the basic information\n    def get_all(self):\n        self.get_start()\n        self.get_error_func()\n        self.get_tokens()\n        self.get_precedence()\n        self.get_pfunctions()\n\n    # Validate all of the information\n    def validate_all(self):\n        self.validate_start()\n        self.validate_error_func()\n        self.validate_tokens()\n        self.validate_precedence()\n        self.validate_pfunctions()\n        self.validate_modules()\n        return self.error\n\n    # Compute a signature over the grammar\n    def signature(self):\n        parts = []\n        try:\n            if self.start:\n                parts.append(self.start)\n            if self.prec:\n                parts.append(''.join([''.join(p) for p in self.prec]))\n            if self.tokens:\n                parts.append(' '.join(self.tokens))\n            for f in self.pfuncs:\n                if f[3]:\n                    parts.append(f[3])\n        except (TypeError, ValueError):\n            pass\n        return ''.join(parts)\n\n    # -----------------------------------------------------------------------------\n    # validate_modules()\n    #\n    # This method checks to see if there are duplicated p_rulename() functions\n    # in the parser module file.  Without this function, it is really easy for\n    # users to make mistakes by cutting and pasting code fragments (and it's a real\n    # bugger to try and figure out why the resulting parser doesn't work).  Therefore,\n    # we just do a little regular expression pattern matching of def statements\n    # to try and detect duplicates.\n    # -----------------------------------------------------------------------------\n\n    def validate_modules(self):\n        # Match def p_funcname(\n        fre = re.compile(r'\\s*def\\s+(p_[a-zA-Z_0-9]*)\\(')\n\n        for module in self.modules:\n            try:\n                lines, linen = inspect.getsourcelines(module)\n            except IOError:\n                continue\n\n            counthash = {}\n            for linen, line in enumerate(lines):\n                linen += 1\n                m = fre.match(line)\n                if m:\n                    name = m.group(1)\n                    prev = counthash.get(name)\n                    if not prev:\n                        counthash[name] = linen\n                    else:\n                        filename = inspect.getsourcefile(module)\n                        self.log.warning('%s:%d: Function %s redefined. Previously defined on line %d',\n                                         filename, linen, name, prev)\n\n    # Get the start symbol\n    def get_start(self):\n        self.start = self.pdict.get('start')\n\n    # Validate the start symbol\n    def validate_start(self):\n        if self.start is not None:\n            if not isinstance(self.start, string_types):\n                self.log.error(\"'start' must be a string\")\n\n    # Look for error handler\n    def get_error_func(self):\n        self.error_func = self.pdict.get('p_error')\n\n    # Validate the error function\n    def validate_error_func(self):\n        if self.error_func:\n            if isinstance(self.error_func, types.FunctionType):\n                ismethod = 0\n            elif isinstance(self.error_func, types.MethodType):\n                ismethod = 1\n            else:\n                self.log.error(\"'p_error' defined, but is not a function or method\")\n                self.error = True\n                return\n\n            eline = self.error_func.__code__.co_firstlineno\n            efile = self.error_func.__code__.co_filename\n            module = inspect.getmodule(self.error_func)\n            self.modules.add(module)\n\n            argcount = self.error_func.__code__.co_argcount - ismethod\n            if argcount != 1:\n                self.log.error('%s:%d: p_error() requires 1 argument', efile, eline)\n                self.error = True\n\n    # Get the tokens map\n    def get_tokens(self):\n        tokens = self.pdict.get('tokens')\n        if not tokens:\n            self.log.error('No token list is defined')\n            self.error = True\n            return\n\n        if not isinstance(tokens, (list, tuple)):\n            self.log.error('tokens must be a list or tuple')\n            self.error = True\n            return\n\n        if not tokens:\n            self.log.error('tokens is empty')\n            self.error = True\n            return\n\n        self.tokens = sorted(tokens)\n\n    # Validate the tokens\n    def validate_tokens(self):\n        # Validate the tokens.\n        if 'error' in self.tokens:\n            self.log.error(\"Illegal token name 'error'. Is a reserved word\")\n            self.error = True\n            return\n\n        terminals = set()\n        for n in self.tokens:\n            if n in terminals:\n                self.log.warning('Token %r multiply defined', n)\n            terminals.add(n)\n\n    # Get the precedence map (if any)\n    def get_precedence(self):\n        self.prec = self.pdict.get('precedence')\n\n    # Validate and parse the precedence map\n    def validate_precedence(self):\n        preclist = []\n        if self.prec:\n            if not isinstance(self.prec, (list, tuple)):\n                self.log.error('precedence must be a list or tuple')\n                self.error = True\n                return\n            for level, p in enumerate(self.prec):\n                if not isinstance(p, (list, tuple)):\n                    self.log.error('Bad precedence table')\n                    self.error = True\n                    return\n\n                if len(p) < 2:\n                    self.log.error('Malformed precedence entry %s. Must be (assoc, term, ..., term)', p)\n                    self.error = True\n                    return\n                assoc = p[0]\n                if not isinstance(assoc, string_types):\n                    self.log.error('precedence associativity must be a string')\n                    self.error = True\n                    return\n                for term in p[1:]:\n                    if not isinstance(term, string_types):\n                        self.log.error('precedence items must be strings')\n                        self.error = True\n                        return\n                    preclist.append((term, assoc, level+1))\n        self.preclist = preclist\n\n    # Get all p_functions from the grammar\n    def get_pfunctions(self):\n        p_functions = []\n        for name, item in self.pdict.items():\n            if not name.startswith('p_') or name == 'p_error':\n                continue\n            if isinstance(item, (types.FunctionType, types.MethodType)):\n                line = getattr(item, 'co_firstlineno', item.__code__.co_firstlineno)\n                module = inspect.getmodule(item)\n                p_functions.append((line, module, name, item.__doc__))\n\n        # Sort all of the actions by line number; make sure to stringify\n        # modules to make them sortable, since `line` may not uniquely sort all\n        # p functions\n        p_functions.sort(key=lambda p_function: (\n            p_function[0],\n            str(p_function[1]),\n            p_function[2],\n            p_function[3]))\n        self.pfuncs = p_functions\n\n    # Validate all of the p_functions\n    def validate_pfunctions(self):\n        grammar = []\n        # Check for non-empty symbols\n        if len(self.pfuncs) == 0:\n            self.log.error('no rules of the form p_rulename are defined')\n            self.error = True\n            return\n\n        for line, module, name, doc in self.pfuncs:\n            file = inspect.getsourcefile(module)\n            func = self.pdict[name]\n            if isinstance(func, types.MethodType):\n                reqargs = 2\n            else:\n                reqargs = 1\n            if func.__code__.co_argcount > reqargs:\n                self.log.error('%s:%d: Rule %r has too many arguments', file, line, func.__name__)\n                self.error = True\n            elif func.__code__.co_argcount < reqargs:\n                self.log.error('%s:%d: Rule %r requires an argument', file, line, func.__name__)\n                self.error = True\n            elif not func.__doc__:\n                self.log.warning('%s:%d: No documentation string specified in function %r (ignored)',\n                                 file, line, func.__name__)\n            else:\n                try:\n                    parsed_g = parse_grammar(doc, file, line)\n                    for g in parsed_g:\n                        grammar.append((name, g))\n                except SyntaxError as e:\n                    self.log.error(str(e))\n                    self.error = True\n\n                # Looks like a valid grammar rule\n                # Mark the file in which defined.\n                self.modules.add(module)\n\n        # Secondary validation step that looks for p_ definitions that are not functions\n        # or functions that look like they might be grammar rules.\n\n        for n, v in self.pdict.items():\n            if n.startswith('p_') and isinstance(v, (types.FunctionType, types.MethodType)):\n                continue\n            if n.startswith('t_'):\n                continue\n            if n.startswith('p_') and n != 'p_error':\n                self.log.warning('%r not defined as a function', n)\n            if ((isinstance(v, types.FunctionType) and v.__code__.co_argcount == 1) or\n                   (isinstance(v, types.MethodType) and v.__func__.__code__.co_argcount == 2)):\n                if v.__doc__:\n                    try:\n                        doc = v.__doc__.split(' ')\n                        if doc[1] == ':':\n                            self.log.warning('%s:%d: Possible grammar rule %r defined without p_ prefix',\n                                             v.__code__.co_filename, v.__code__.co_firstlineno, n)\n                    except IndexError:\n                        pass\n\n        self.grammar = grammar\n\n# -----------------------------------------------------------------------------\n# yacc(module)\n#\n# Build a parser\n# -----------------------------------------------------------------------------\n\ndef yacc(method='LALR', debug=yaccdebug, module=None, tabmodule=tab_module, start=None,\n         check_recursion=True, optimize=False, write_tables=True, debugfile=debug_file,\n         outputdir=None, debuglog=None, errorlog=None, picklefile=None):\n\n    if tabmodule is None:\n        tabmodule = tab_module\n\n    # Reference to the parsing method of the last built parser\n    global parse\n\n    # If pickling is enabled, table files are not created\n    if picklefile:\n        write_tables = 0\n\n    if errorlog is None:\n        errorlog = PlyLogger(sys.stderr)\n\n    # Get the module dictionary used for the parser\n    if module:\n        _items = [(k, getattr(module, k)) for k in dir(module)]\n        pdict = dict(_items)\n        # If no __file__ or __package__ attributes are available, try to obtain them\n        # from the __module__ instead\n        if '__file__' not in pdict:\n            pdict['__file__'] = sys.modules[pdict['__module__']].__file__\n        if '__package__' not in pdict and '__module__' in pdict:\n            if hasattr(sys.modules[pdict['__module__']], '__package__'):\n                pdict['__package__'] = sys.modules[pdict['__module__']].__package__\n    else:\n        pdict = get_caller_module_dict(2)\n\n    if outputdir is None:\n        # If no output directory is set, the location of the output files\n        # is determined according to the following rules:\n        #     - If tabmodule specifies a package, files go into that package directory\n        #     - Otherwise, files go in the same directory as the specifying module\n        if isinstance(tabmodule, types.ModuleType):\n            srcfile = tabmodule.__file__\n        else:\n            if '.' not in tabmodule:\n                srcfile = pdict['__file__']\n            else:\n                parts = tabmodule.split('.')\n                pkgname = '.'.join(parts[:-1])\n                exec('import %s' % pkgname)\n                srcfile = getattr(sys.modules[pkgname], '__file__', '')\n        outputdir = os.path.dirname(srcfile)\n\n    # Determine if the module is package of a package or not.\n    # If so, fix the tabmodule setting so that tables load correctly\n    pkg = pdict.get('__package__')\n    if pkg and isinstance(tabmodule, str):\n        if '.' not in tabmodule:\n            tabmodule = pkg + '.' + tabmodule\n\n\n\n    # Set start symbol if it's specified directly using an argument\n    if start is not None:\n        pdict['start'] = start\n\n    # Collect parser information from the dictionary\n    pinfo = ParserReflect(pdict, log=errorlog)\n    pinfo.get_all()\n\n    if pinfo.error:\n        raise YaccError('Unable to build parser')\n\n    # Check signature against table files (if any)\n    signature = pinfo.signature()\n\n    # Read the tables\n    try:\n        lr = LRTable()\n        if picklefile:\n            read_signature = lr.read_pickle(picklefile)\n        else:\n            read_signature = lr.read_table(tabmodule)\n        if optimize or (read_signature == signature):\n            try:\n                lr.bind_callables(pinfo.pdict)\n                parser = LRParser(lr, pinfo.error_func)\n                parse = parser.parse\n                return parser\n            except Exception as e:\n                errorlog.warning('There was a problem loading the table file: %r', e)\n    except VersionError as e:\n        errorlog.warning(str(e))\n    except ImportError:\n        pass\n\n    if debuglog is None:\n        if debug:\n            try:\n                debuglog = PlyLogger(open(os.path.join(outputdir, debugfile), 'w'))\n            except IOError as e:\n                errorlog.warning(\"Couldn't open %r. %s\" % (debugfile, e))\n                debuglog = NullLogger()\n        else:\n            debuglog = NullLogger()\n\n    debuglog.info('Created by PLY version %s (http://www.dabeaz.com/ply)', __version__)\n\n    errors = False\n\n    # Validate the parser information\n    if pinfo.validate_all():\n        raise YaccError('Unable to build parser')\n\n    if not pinfo.error_func:\n        errorlog.warning('no p_error() function is defined')\n\n    # Create a grammar object\n    grammar = Grammar(pinfo.tokens)\n\n    # Set precedence level for terminals\n    for term, assoc, level in pinfo.preclist:\n        try:\n            grammar.set_precedence(term, assoc, level)\n        except GrammarError as e:\n            errorlog.warning('%s', e)\n\n    # Add productions to the grammar\n    for funcname, gram in pinfo.grammar:\n        file, line, prodname, syms = gram\n        try:\n            grammar.add_production(prodname, syms, funcname, file, line)\n        except GrammarError as e:\n            errorlog.error('%s', e)\n            errors = True\n\n    # Set the grammar start symbols\n    try:\n        if start is None:\n            grammar.set_start(pinfo.start)\n        else:\n            grammar.set_start(start)\n    except GrammarError as e:\n        errorlog.error(str(e))\n        errors = True\n\n    if errors:\n        raise YaccError('Unable to build parser')\n\n    # Verify the grammar structure\n    undefined_symbols = grammar.undefined_symbols()\n    for sym, prod in undefined_symbols:\n        errorlog.error('%s:%d: Symbol %r used, but not defined as a token or a rule', prod.file, prod.line, sym)\n        errors = True\n\n    unused_terminals = grammar.unused_terminals()\n    if unused_terminals:\n        debuglog.info('')\n        debuglog.info('Unused terminals:')\n        debuglog.info('')\n        for term in unused_terminals:\n            errorlog.warning('Token %r defined, but not used', term)\n            debuglog.info('    %s', term)\n\n    # Print out all productions to the debug log\n    if debug:\n        debuglog.info('')\n        debuglog.info('Grammar')\n        debuglog.info('')\n        for n, p in enumerate(grammar.Productions):\n            debuglog.info('Rule %-5d %s', n, p)\n\n    # Find unused non-terminals\n    unused_rules = grammar.unused_rules()\n    for prod in unused_rules:\n        errorlog.warning('%s:%d: Rule %r defined, but not used', prod.file, prod.line, prod.name)\n\n    if len(unused_terminals) == 1:\n        errorlog.warning('There is 1 unused token')\n    if len(unused_terminals) > 1:\n        errorlog.warning('There are %d unused tokens', len(unused_terminals))\n\n    if len(unused_rules) == 1:\n        errorlog.warning('There is 1 unused rule')\n    if len(unused_rules) > 1:\n        errorlog.warning('There are %d unused rules', len(unused_rules))\n\n    if debug:\n        debuglog.info('')\n        debuglog.info('Terminals, with rules where they appear')\n        debuglog.info('')\n        terms = list(grammar.Terminals)\n        terms.sort()\n        for term in terms:\n            debuglog.info('%-20s : %s', term, ' '.join([str(s) for s in grammar.Terminals[term]]))\n\n        debuglog.info('')\n        debuglog.info('Nonterminals, with rules where they appear')\n        debuglog.info('')\n        nonterms = list(grammar.Nonterminals)\n        nonterms.sort()\n        for nonterm in nonterms:\n            debuglog.info('%-20s : %s', nonterm, ' '.join([str(s) for s in grammar.Nonterminals[nonterm]]))\n        debuglog.info('')\n\n    if check_recursion:\n        unreachable = grammar.find_unreachable()\n        for u in unreachable:\n            errorlog.warning('Symbol %r is unreachable', u)\n\n        infinite = grammar.infinite_cycles()\n        for inf in infinite:\n            errorlog.error('Infinite recursion detected for symbol %r', inf)\n            errors = True\n\n    unused_prec = grammar.unused_precedence()\n    for term, assoc in unused_prec:\n        errorlog.error('Precedence rule %r defined for unknown symbol %r', assoc, term)\n        errors = True\n\n    if errors:\n        raise YaccError('Unable to build parser')\n\n    # Run the LRGeneratedTable on the grammar\n    if debug:\n        errorlog.debug('Generating %s tables', method)\n\n    lr = LRGeneratedTable(grammar, method, debuglog)\n\n    if debug:\n        num_sr = len(lr.sr_conflicts)\n\n        # Report shift/reduce and reduce/reduce conflicts\n        if num_sr == 1:\n            errorlog.warning('1 shift/reduce conflict')\n        elif num_sr > 1:\n            errorlog.warning('%d shift/reduce conflicts', num_sr)\n\n        num_rr = len(lr.rr_conflicts)\n        if num_rr == 1:\n            errorlog.warning('1 reduce/reduce conflict')\n        elif num_rr > 1:\n            errorlog.warning('%d reduce/reduce conflicts', num_rr)\n\n    # Write out conflicts to the output file\n    if debug and (lr.sr_conflicts or lr.rr_conflicts):\n        debuglog.warning('')\n        debuglog.warning('Conflicts:')\n        debuglog.warning('')\n\n        for state, tok, resolution in lr.sr_conflicts:\n            debuglog.warning('shift/reduce conflict for %s in state %d resolved as %s',  tok, state, resolution)\n\n        already_reported = set()\n        for state, rule, rejected in lr.rr_conflicts:\n            if (state, id(rule), id(rejected)) in already_reported:\n                continue\n            debuglog.warning('reduce/reduce conflict in state %d resolved using rule (%s)', state, rule)\n            debuglog.warning('rejected rule (%s) in state %d', rejected, state)\n            errorlog.warning('reduce/reduce conflict in state %d resolved using rule (%s)', state, rule)\n            errorlog.warning('rejected rule (%s) in state %d', rejected, state)\n            already_reported.add((state, id(rule), id(rejected)))\n\n        warned_never = []\n        for state, rule, rejected in lr.rr_conflicts:\n            if not rejected.reduced and (rejected not in warned_never):\n                debuglog.warning('Rule (%s) is never reduced', rejected)\n                errorlog.warning('Rule (%s) is never reduced', rejected)\n                warned_never.append(rejected)\n\n    # Write the table file if requested\n    if write_tables:\n        try:\n            lr.write_table(tabmodule, outputdir, signature)\n            if tabmodule in sys.modules:\n                del sys.modules[tabmodule]\n        except IOError as e:\n            errorlog.warning(\"Couldn't create %r. %s\" % (tabmodule, e))\n\n    # Write a pickled version of the tables\n    if picklefile:\n        try:\n            lr.pickle_table(picklefile, signature)\n        except IOError as e:\n            errorlog.warning(\"Couldn't create %r. %s\" % (picklefile, e))\n\n    # Build the parser\n    lr.bind_callables(pinfo.pdict)\n    parser = LRParser(lr, pinfo.error_func)\n\n    parse = parser.parse\n    return parser\n"},{"className":"PlyLogger","col":0,"comment":"null","endLoc":123,"id":11185,"nodeType":"Class","startLoc":108,"text":"class PlyLogger(object):\n    def __init__(self, f):\n        self.f = f\n\n    def debug(self, msg, *args, **kwargs):\n        self.f.write((msg % args) + '\\n')\n\n    info = debug\n\n    def warning(self, msg, *args, **kwargs):\n        self.f.write('WARNING: ' + (msg % args) + '\\n')\n\n    def error(self, msg, *args, **kwargs):\n        self.f.write('ERROR: ' + (msg % args) + '\\n')\n\n    critical = debug"},{"col":4,"comment":"null","endLoc":113,"header":"def debug(self, msg, *args, **kwargs)","id":11186,"name":"debug","nodeType":"Function","startLoc":112,"text":"def debug(self, msg, *args, **kwargs):\n        self.f.write((msg % args) + '\\n')"},{"col":4,"comment":"Unquote a value if necessary.","endLoc":704,"header":"def _unquote(self, val)","id":11187,"name":"_unquote","nodeType":"Function","startLoc":700,"text":"def _unquote(self, val):\n        \"\"\"Unquote a value if necessary.\"\"\"\n        if (len(val) >= 2) and (val[0] in (\"'\", '\"')) and (val[0] == val[-1]):\n            val = val[1:-1]\n        return val"},{"col":0,"comment":"Insert values along the given axis before the given indices.\n\n    Like `numpy.insert` but for possibly masked ``arr`` and ``values``.\n    Masked ``obj`` is not supported.\n    ","endLoc":517,"header":"@apply_to_both\ndef insert(arr, obj, values, axis=None)","id":11188,"name":"insert","nodeType":"Function","startLoc":504,"text":"@apply_to_both\ndef insert(arr, obj, values, axis=None):\n    \"\"\"Insert values along the given axis before the given indices.\n\n    Like `numpy.insert` but for possibly masked ``arr`` and ``values``.\n    Masked ``obj`` is not supported.\n    \"\"\"\n    from astropy.utils.masked import Masked\n    if isinstance(obj, Masked) or not isinstance(arr, Masked):\n        raise NotImplementedError\n\n    (arr_data, val_data), (arr_mask, val_mask) = _get_data_and_masks(arr, values)\n    return ((arr_data, obj, val_data, axis),\n            (arr_mask, obj, val_mask, axis), {}, None)"},{"attributeType":"None","col":4,"comment":"Cached table, returned if ``open`` is called without arguments.","endLoc":162,"id":11189,"name":"iers_table","nodeType":"Attribute","startLoc":162,"text":"iers_table"},{"attributeType":"null","col":16,"comment":"null","endLoc":213,"id":11190,"name":"iers_table","nodeType":"Attribute","startLoc":213,"text":"cls.iers_table"},{"col":4,"comment":"Counts the number of non-zero values in the array ``a``.\n\n        Like `numpy.count_nonzero`, with masked values counted as 0 or `False`.\n        ","endLoc":528,"header":"@dispatched_function\n    def count_nonzero(a, axis=None)","id":11191,"name":"count_nonzero","nodeType":"Function","startLoc":521,"text":"@dispatched_function\n    def count_nonzero(a, axis=None):\n        \"\"\"Counts the number of non-zero values in the array ``a``.\n\n        Like `numpy.count_nonzero`, with masked values counted as 0 or `False`.\n        \"\"\"\n        filled = a.filled(np.zeros((), a.dtype))\n        return np.count_nonzero(filled, axis)"},{"className":"TimeRE","col":0,"comment":"Handle conversion from format directives to regexes.","endLoc":280,"id":11192,"nodeType":"Class","startLoc":190,"text":"class TimeRE(dict):\n    \"\"\"Handle conversion from format directives to regexes.\"\"\"\n\n    def __init__(self, locale_time=None):\n        \"\"\"Create keys/values.\n\n        Order of execution is important for dependency reasons.\n\n        \"\"\"\n        if locale_time:\n            self.locale_time = locale_time\n        else:\n            self.locale_time = LocaleTime()\n        base = super()\n        base.__init__({\n            # The \" \\d\" part of the regex is to make %c from ANSI C work\n            'd': r\"(?P<d>3[0-1]|[1-2]\\d|0[1-9]|[1-9]| [1-9])\",\n            'f': r\"(?P<f>[0-9]{1,6})\",\n            'H': r\"(?P<H>2[0-3]|[0-1]\\d|\\d)\",\n            'I': r\"(?P<I>1[0-2]|0[1-9]|[1-9])\",\n            'j': r\"(?P<j>36[0-6]|3[0-5]\\d|[1-2]\\d\\d|0[1-9]\\d|00[1-9]|[1-9]\\d|0[1-9]|[1-9])\",\n            'm': r\"(?P<m>1[0-2]|0[1-9]|[1-9])\",\n            'M': r\"(?P<M>[0-5]\\d|\\d)\",\n            'S': r\"(?P<S>6[0-1]|[0-5]\\d|\\d)\",\n            'U': r\"(?P<U>5[0-3]|[0-4]\\d|\\d)\",\n            'w': r\"(?P<w>[0-6])\",\n            # W is set below by using 'U'\n            'y': r\"(?P<y>\\d\\d)\",\n            #XXX: Does 'Y' need to worry about having less or more than\n            #     4 digits?\n            'Y': r\"(?P<Y>\\d\\d\\d\\d)\",\n            'z': r\"(?P<z>[+-]\\d\\d[0-5]\\d)\",\n            'A': self.__seqToRE(self.locale_time.f_weekday, 'A'),\n            'a': self.__seqToRE(self.locale_time.a_weekday, 'a'),\n            'B': self.__seqToRE(self.locale_time.f_month[1:], 'B'),\n            'b': self.__seqToRE(self.locale_time.a_month[1:], 'b'),\n            'p': self.__seqToRE(self.locale_time.am_pm, 'p'),\n            'Z': self.__seqToRE((tz for tz_names in self.locale_time.timezone\n                                        for tz in tz_names),\n                                'Z'),\n            '%': '%'})\n        base.__setitem__('W', base.__getitem__('U').replace('U', 'W'))\n        base.__setitem__('c', self.pattern(self.locale_time.LC_date_time))\n        base.__setitem__('x', self.pattern(self.locale_time.LC_date))\n        base.__setitem__('X', self.pattern(self.locale_time.LC_time))\n\n    def __seqToRE(self, to_convert, directive):\n        \"\"\"Convert a list to a regex string for matching a directive.\n\n        Want possible matching values to be from longest to shortest.  This\n        prevents the possibility of a match occurring for a value that also\n        a substring of a larger value that should have matched (e.g., 'abc'\n        matching when 'abcdef' should have been the match).\n\n        \"\"\"\n        to_convert = sorted(to_convert, key=len, reverse=True)\n        for value in to_convert:\n            if value != '':\n                break\n        else:\n            return ''\n        regex = '|'.join(re_escape(stuff) for stuff in to_convert)\n        regex = '(?P<%s>%s' % (directive, regex)\n        return '%s)' % regex\n\n    def pattern(self, format):\n        \"\"\"Return regex pattern for the format string.\n\n        Need to make sure that any characters that might be interpreted as\n        regex syntax are escaped.\n\n        \"\"\"\n        processed_format = ''\n        # The sub() call escapes all characters that might be misconstrued\n        # as regex syntax.  Cannot use re.escape since we have to deal with\n        # format directives (%m, etc.).\n        regex_chars = re_compile(r\"([\\\\.^$*+?\\(\\){}\\[\\]|])\")\n        format = regex_chars.sub(r\"\\\\\\1\", format)\n        whitespace_replacement = re_compile(r'\\s+')\n        format = whitespace_replacement.sub(r'\\\\s+', format)\n        while '%' in format:\n            directive_index = format.index('%')+1\n            processed_format = \"%s%s%s\" % (processed_format,\n                                           format[:directive_index-1],\n                                           self[format[directive_index]])\n            format = format[directive_index+1:]\n        return \"%s%s\" % (processed_format, format)\n\n    def compile(self, format):\n        \"\"\"Return a compiled re object for the format string.\"\"\"\n        return re_compile(self.pattern(format), IGNORECASE)"},{"className":"IERS_A","col":0,"comment":"IERS Table class targeted to IERS A, provided by USNO.\n\n    These include rapid turnaround and predicted times.\n    See https://datacenter.iers.org/eop.php\n\n    Notes\n    -----\n    The IERS A file is not part of astropy.  It can be downloaded from\n    ``iers.IERS_A_URL`` or ``iers.IERS_A_URL_MIRROR``. See ``iers.__doc__``\n    for instructions on use in ``Time``, etc.\n    ","endLoc":578,"id":11193,"nodeType":"Class","startLoc":460,"text":"class IERS_A(IERS):\n    \"\"\"IERS Table class targeted to IERS A, provided by USNO.\n\n    These include rapid turnaround and predicted times.\n    See https://datacenter.iers.org/eop.php\n\n    Notes\n    -----\n    The IERS A file is not part of astropy.  It can be downloaded from\n    ``iers.IERS_A_URL`` or ``iers.IERS_A_URL_MIRROR``. See ``iers.__doc__``\n    for instructions on use in ``Time``, etc.\n    \"\"\"\n\n    iers_table = None\n\n    @classmethod\n    def _combine_a_b_columns(cls, iers_a):\n        \"\"\"\n        Return a new table with appropriate combination of IERS_A and B columns.\n        \"\"\"\n        # IERS A has some rows at the end that hold nothing but dates & MJD\n        # presumably to be filled later.  Exclude those a priori -- there\n        # should at least be a predicted UT1-UTC and PM!\n        table = iers_a[np.isfinite(iers_a['UT1_UTC_A']) &\n                       (iers_a['PolPMFlag_A'] != '')]\n\n        # This does nothing for IERS_A, but allows IERS_Auto to ensure the\n        # IERS B values in the table are consistent with the true ones.\n        table = cls._substitute_iers_b(table)\n\n        # Combine A and B columns, using B where possible.\n        b_bad = np.isnan(table['UT1_UTC_B'])\n        table['UT1_UTC'] = np.where(b_bad, table['UT1_UTC_A'], table['UT1_UTC_B'])\n        table['UT1Flag'] = np.where(b_bad, table['UT1Flag_A'], 'B')\n        # Repeat for polar motions.\n        b_bad = np.isnan(table['PM_X_B']) | np.isnan(table['PM_Y_B'])\n        table['PM_x'] = np.where(b_bad, table['PM_x_A'], table['PM_X_B'])\n        table['PM_y'] = np.where(b_bad, table['PM_y_A'], table['PM_Y_B'])\n        table['PolPMFlag'] = np.where(b_bad, table['PolPMFlag_A'], 'B')\n\n        b_bad = np.isnan(table['dX_2000A_B']) | np.isnan(table['dY_2000A_B'])\n        table['dX_2000A'] = np.where(b_bad, table['dX_2000A_A'], table['dX_2000A_B'])\n        table['dY_2000A'] = np.where(b_bad, table['dY_2000A_A'], table['dY_2000A_B'])\n        table['NutFlag'] = np.where(b_bad, table['NutFlag_A'], 'B')\n\n        # Get the table index for the first row that has predictive values\n        # PolPMFlag_A  IERS (I) or Prediction (P) flag for\n        #              Bull. A polar motion values\n        # UT1Flag_A    IERS (I) or Prediction (P) flag for\n        #              Bull. A UT1-UTC values\n        # Since only 'P' and 'I' are possible and 'P' is guaranteed to come\n        # after 'I', we can use searchsorted for 100 times speed up over\n        # finding the first index where the flag equals 'P'.\n        p_index = min(np.searchsorted(table['UT1Flag_A'], 'P'),\n                      np.searchsorted(table['PolPMFlag_A'], 'P'))\n        table.meta['predictive_index'] = p_index\n        table.meta['predictive_mjd'] = table['MJD'][p_index].value\n\n        return table\n\n    @classmethod\n    def _substitute_iers_b(cls, table):\n        # See documentation in IERS_Auto.\n        return table\n\n    @classmethod\n    def read(cls, file=None, readme=None):\n        \"\"\"Read IERS-A table from a finals2000a.* file provided by USNO.\n\n        Parameters\n        ----------\n        file : str\n            full path to ascii file holding IERS-A data.\n            Defaults to ``iers.IERS_A_FILE``.\n        readme : str\n            full path to ascii file holding CDS-style readme.\n            Defaults to package version, ``iers.IERS_A_README``.\n\n        Returns\n        -------\n        ``IERS_A`` class instance\n        \"\"\"\n        if file is None:\n            file = IERS_A_FILE\n        if readme is None:\n            readme = IERS_A_README\n\n        iers_a = super().read(file, format='cds', readme=readme)\n\n        # Combine the A and B data for UT1-UTC and PM columns\n        table = cls._combine_a_b_columns(iers_a)\n        table.meta['data_path'] = file\n        table.meta['readme_path'] = readme\n\n        return table\n\n    def ut1_utc_source(self, i):\n        \"\"\"Set UT1-UTC source flag for entries in IERS table\"\"\"\n        ut1flag = self['UT1Flag'][i]\n        source = np.ones_like(i) * FROM_IERS_B\n        source[ut1flag == 'I'] = FROM_IERS_A\n        source[ut1flag == 'P'] = FROM_IERS_A_PREDICTION\n        return source\n\n    def dcip_source(self, i):\n        \"\"\"Set CIP correction source flag for entries in IERS table\"\"\"\n        nutflag = self['NutFlag'][i]\n        source = np.ones_like(i) * FROM_IERS_B\n        source[nutflag == 'I'] = FROM_IERS_A\n        source[nutflag == 'P'] = FROM_IERS_A_PREDICTION\n        return source\n\n    def pm_source(self, i):\n        \"\"\"Set polar motion source flag for entries in IERS table\"\"\"\n        pmflag = self['PolPMFlag'][i]\n        source = np.ones_like(i) * FROM_IERS_B\n        source[pmflag == 'I'] = FROM_IERS_A\n        source[pmflag == 'P'] = FROM_IERS_A_PREDICTION\n        return source"},{"col":4,"comment":"Return a compiled re object for the format string.","endLoc":280,"header":"def compile(self, format)","id":11194,"name":"compile","nodeType":"Function","startLoc":278,"text":"def compile(self, format):\n        \"\"\"Return a compiled re object for the format string.\"\"\"\n        return re_compile(self.pattern(format), IGNORECASE)"},{"col":4,"comment":"\n        Return a new table with appropriate combination of IERS_A and B columns.\n        ","endLoc":518,"header":"@classmethod\n    def _combine_a_b_columns(cls, iers_a)","id":11195,"name":"_combine_a_b_columns","nodeType":"Function","startLoc":475,"text":"@classmethod\n    def _combine_a_b_columns(cls, iers_a):\n        \"\"\"\n        Return a new table with appropriate combination of IERS_A and B columns.\n        \"\"\"\n        # IERS A has some rows at the end that hold nothing but dates & MJD\n        # presumably to be filled later.  Exclude those a priori -- there\n        # should at least be a predicted UT1-UTC and PM!\n        table = iers_a[np.isfinite(iers_a['UT1_UTC_A']) &\n                       (iers_a['PolPMFlag_A'] != '')]\n\n        # This does nothing for IERS_A, but allows IERS_Auto to ensure the\n        # IERS B values in the table are consistent with the true ones.\n        table = cls._substitute_iers_b(table)\n\n        # Combine A and B columns, using B where possible.\n        b_bad = np.isnan(table['UT1_UTC_B'])\n        table['UT1_UTC'] = np.where(b_bad, table['UT1_UTC_A'], table['UT1_UTC_B'])\n        table['UT1Flag'] = np.where(b_bad, table['UT1Flag_A'], 'B')\n        # Repeat for polar motions.\n        b_bad = np.isnan(table['PM_X_B']) | np.isnan(table['PM_Y_B'])\n        table['PM_x'] = np.where(b_bad, table['PM_x_A'], table['PM_X_B'])\n        table['PM_y'] = np.where(b_bad, table['PM_y_A'], table['PM_Y_B'])\n        table['PolPMFlag'] = np.where(b_bad, table['PolPMFlag_A'], 'B')\n\n        b_bad = np.isnan(table['dX_2000A_B']) | np.isnan(table['dY_2000A_B'])\n        table['dX_2000A'] = np.where(b_bad, table['dX_2000A_A'], table['dX_2000A_B'])\n        table['dY_2000A'] = np.where(b_bad, table['dY_2000A_A'], table['dY_2000A_B'])\n        table['NutFlag'] = np.where(b_bad, table['NutFlag_A'], 'B')\n\n        # Get the table index for the first row that has predictive values\n        # PolPMFlag_A  IERS (I) or Prediction (P) flag for\n        #              Bull. A polar motion values\n        # UT1Flag_A    IERS (I) or Prediction (P) flag for\n        #              Bull. A UT1-UTC values\n        # Since only 'P' and 'I' are possible and 'P' is guaranteed to come\n        # after 'I', we can use searchsorted for 100 times speed up over\n        # finding the first index where the flag equals 'P'.\n        p_index = min(np.searchsorted(table['UT1Flag_A'], 'P'),\n                      np.searchsorted(table['PolPMFlag_A'], 'P'))\n        table.meta['predictive_index'] = p_index\n        table.meta['predictive_mjd'] = table['MJD'][p_index].value\n\n        return table"},{"col":4,"comment":"null","endLoc":489,"header":"def __init_subclass__(cls, **kwargs)","id":11196,"name":"__init_subclass__","nodeType":"Function","startLoc":467,"text":"def __init_subclass__(cls, **kwargs):\n        super().__init_subclass__(cls, **kwargs)\n        # For all subclasses we should set a default __new__ that passes on\n        # arguments other than mask to the data class, and then sets the mask.\n        if '__new__' not in cls.__dict__:\n            def __new__(newcls, *args, mask=None, **kwargs):\n                \"\"\"Get data class instance from arguments and then set mask.\"\"\"\n                # Need to explicitly mention classes outside of class definition.\n                self = super(cls, newcls).__new__(newcls, *args, **kwargs)\n                if mask is not None:\n                    self.mask = mask\n                elif self._mask is None:\n                    self.mask = False\n                return self\n            cls.__new__ = __new__\n\n        if 'info' not in cls.__dict__ and hasattr(cls._data_cls, 'info'):\n            data_info = cls._data_cls.info\n            attr_names = data_info.attr_names | {'serialize_method'}\n            new_info = type(cls.__name__+'Info',\n                            (MaskedArraySubclassInfo, data_info.__class__),\n                            dict(attr_names=attr_names))\n            cls.info = new_info()"},{"col":4,"comment":"null","endLoc":523,"header":"@classmethod\n    def _substitute_iers_b(cls, table)","id":11197,"name":"_substitute_iers_b","nodeType":"Function","startLoc":520,"text":"@classmethod\n    def _substitute_iers_b(cls, table):\n        # See documentation in IERS_Auto.\n        return table"},{"col":4,"comment":"null","endLoc":118,"header":"def warning(self, msg, *args, **kwargs)","id":11198,"name":"warning","nodeType":"Function","startLoc":117,"text":"def warning(self, msg, *args, **kwargs):\n        self.f.write('WARNING: ' + (msg % args) + '\\n')"},{"col":4,"comment":"Counts the number of non-zero values in the array ``a``.\n\n        Like `numpy.count_nonzero`, with masked values counted as 0 or `False`.\n        ","endLoc":537,"header":"@dispatched_function\n    def count_nonzero(a, axis=None, *, keepdims=False)","id":11199,"name":"count_nonzero","nodeType":"Function","startLoc":530,"text":"@dispatched_function\n    def count_nonzero(a, axis=None, *, keepdims=False):\n        \"\"\"Counts the number of non-zero values in the array ``a``.\n\n        Like `numpy.count_nonzero`, with masked values counted as 0 or `False`.\n        \"\"\"\n        filled = a.filled(np.zeros((), a.dtype))\n        return np.count_nonzero(filled, axis, keepdims=keepdims)"},{"col":4,"comment":"null","endLoc":499,"header":"@classmethod\n    def from_unmasked(cls, data, mask=None, copy=False)","id":11200,"name":"from_unmasked","nodeType":"Function","startLoc":492,"text":"@classmethod\n    def from_unmasked(cls, data, mask=None, copy=False):\n        # Note: have to override since __new__ would use ndarray.__new__\n        # which expects the shape as its first argument, not an array.\n        data = np.array(data, subok=True, copy=copy)\n        self = data.view(cls)\n        self._set_mask(mask, copy=copy)\n        return self"},{"col":4,"comment":"null","endLoc":503,"header":"@property\n    def unmasked(self)","id":11201,"name":"unmasked","nodeType":"Function","startLoc":501,"text":"@property\n    def unmasked(self):\n        return super().view(self._data_cls)"},{"col":4,"comment":"null","endLoc":546,"header":"def _zeros_like(a, dtype=None, order='K', subok=True, shape=None)","id":11202,"name":"_zeros_like","nodeType":"Function","startLoc":541,"text":"def _zeros_like(a, dtype=None, order='K', subok=True, shape=None):\n        if shape != ():\n            return np.zeros_like(a, dtype=dtype, order=order, subok=subok, shape=shape)\n        else:\n            return np.zeros_like(a, dtype=dtype, order=order, subok=subok,\n                                 shape=(1,))[0]"},{"col":4,"comment":"null","endLoc":513,"header":"@classmethod\n    def _get_masked_cls(cls, data_cls)","id":11203,"name":"_get_masked_cls","nodeType":"Function","startLoc":505,"text":"@classmethod\n    def _get_masked_cls(cls, data_cls):\n        # Short-cuts\n        if data_cls is np.ndarray:\n            return MaskedNDArray\n        elif data_cls is None:  # for .view()\n            return cls\n\n        return super()._get_masked_cls(data_cls)"},{"col":0,"comment":"null","endLoc":558,"header":"def _masked_median_1d(a, overwrite_input)","id":11204,"name":"_masked_median_1d","nodeType":"Function","startLoc":551,"text":"def _masked_median_1d(a, overwrite_input):\n    # TODO: need an in-place mask-sorting option.\n    unmasked = a.unmasked[~a.mask]\n    if unmasked.size:\n        return a.from_unmasked(\n            np.median(unmasked, overwrite_input=overwrite_input))\n    else:\n        return a.from_unmasked(_zeros_like(a.unmasked, shape=(1,))[0], mask=True)"},{"col":4,"comment":"null","endLoc":634,"header":"def _handle_none(self, value)","id":11205,"name":"_handle_none","nodeType":"Function","startLoc":628,"text":"def _handle_none(self, value):\n        if value == 'None':\n            return None\n        elif value in (\"'None'\", '\"None\"'):\n            # Special case a quoted None\n            value = self._unquote(value)\n        return value"},{"col":4,"comment":"null","endLoc":657,"header":"def _check_value(self, value, fun_name, fun_args, fun_kwargs)","id":11206,"name":"_check_value","nodeType":"Function","startLoc":651,"text":"def _check_value(self, value, fun_name, fun_args, fun_kwargs):\n        try:\n            fun = self.functions[fun_name]\n        except KeyError:\n            raise VdtUnknownCheckError(fun_name)\n        else:\n            return fun(value, *fun_args, **fun_kwargs)"},{"col":4,"comment":"\n        >>> raise VdtUnknownCheckError('yoda')\n        Traceback (most recent call last):\n        VdtUnknownCheckError: the check \"yoda\" is unknown.\n        ","endLoc":383,"header":"def __init__(self, value)","id":11207,"name":"__init__","nodeType":"Function","startLoc":377,"text":"def __init__(self, value):\n        \"\"\"\n        >>> raise VdtUnknownCheckError('yoda')\n        Traceback (most recent call last):\n        VdtUnknownCheckError: the check \"yoda\" is unknown.\n        \"\"\"\n        ValidateError.__init__(self, 'the check \"%s\" is unknown.' % (value,))"},{"col":4,"comment":"null","endLoc":298,"header":"def __set__(self, obj, value)","id":11208,"name":"__set__","nodeType":"Function","startLoc":297,"text":"def __set__(self, obj, value):\n        return self.set(value)"},{"col":4,"comment":"A 1-D iterator over the Masked array.\n\n        This returns a ``MaskedIterator`` instance, which behaves the same\n        as the `~numpy.flatiter` instance returned by `~numpy.ndarray.flat`,\n        and is similar to Python's built-in iterator, except that it also\n        allows assignment.\n        ","endLoc":524,"header":"@property\n    def flat(self)","id":11209,"name":"flat","nodeType":"Function","startLoc":515,"text":"@property\n    def flat(self):\n        \"\"\"A 1-D iterator over the Masked array.\n\n        This returns a ``MaskedIterator`` instance, which behaves the same\n        as the `~numpy.flatiter` instance returned by `~numpy.ndarray.flat`,\n        and is similar to Python's built-in iterator, except that it also\n        allows assignment.\n        \"\"\"\n        return MaskedIterator(self)"},{"col":4,"comment":"\n        Sets the current value of this ``ConfigItem``.\n\n        This also updates the comments that give the description and type\n        information.\n\n        Parameters\n        ----------\n        value\n            The value this item should be set to.\n\n        Raises\n        ------\n        TypeError\n            If the provided ``value`` is not valid for this ``ConfigItem``.\n        ","endLoc":330,"header":"def set(self, value)","id":11210,"name":"set","nodeType":"Function","startLoc":305,"text":"def set(self, value):\n        \"\"\"\n        Sets the current value of this ``ConfigItem``.\n\n        This also updates the comments that give the description and type\n        information.\n\n        Parameters\n        ----------\n        value\n            The value this item should be set to.\n\n        Raises\n        ------\n        TypeError\n            If the provided ``value`` is not valid for this ``ConfigItem``.\n        \"\"\"\n        try:\n            value = self._validate_val(value)\n        except validate.ValidateError as e:\n            msg = 'Provided value for configuration item {0} not valid: {1}'\n            raise TypeError(msg.format(self.name, e.args[0]))\n\n        sec = get_config(self.module, rootname=self.rootname)\n\n        sec[self.name] = value"},{"col":4,"comment":"Work-around for MaskedArray initialization.\n\n        Allows the base class to be inferred correctly when a masked instance\n        is used to initialize (or viewed as) a `~numpy.ma.MaskedArray`.\n\n        ","endLoc":534,"header":"@property\n    def _baseclass(self)","id":11211,"name":"_baseclass","nodeType":"Function","startLoc":526,"text":"@property\n    def _baseclass(self):\n        \"\"\"Work-around for MaskedArray initialization.\n\n        Allows the base class to be inferred correctly when a masked instance\n        is used to initialize (or viewed as) a `~numpy.ma.MaskedArray`.\n\n        \"\"\"\n        return self._data_cls"},{"col":4,"comment":"null","endLoc":303,"header":"def __get__(self, obj, objtype=None)","id":11212,"name":"__get__","nodeType":"Function","startLoc":300,"text":"def __get__(self, obj, objtype=None):\n        if obj is None:\n            return self\n        return self()"},{"col":4,"comment":" Returns the value of this ``ConfigItem``\n\n        Returns\n        -------\n        val : object\n            This item's value, with a type determined by the ``cfgtype``\n            attribute.\n\n        Raises\n        ------\n        TypeError\n            If the configuration value as stored is not this item's type.\n\n        ","endLoc":474,"header":"def __call__(self)","id":11213,"name":"__call__","nodeType":"Function","startLoc":406,"text":"def __call__(self):\n        \"\"\" Returns the value of this ``ConfigItem``\n\n        Returns\n        -------\n        val : object\n            This item's value, with a type determined by the ``cfgtype``\n            attribute.\n\n        Raises\n        ------\n        TypeError\n            If the configuration value as stored is not this item's type.\n\n        \"\"\"\n        def section_name(section):\n            if section == '':\n                return 'at the top-level'\n            else:\n                return f'in section [{section}]'\n\n        options = []\n        sec = get_config(self.module, rootname=self.rootname)\n        if self.name in sec:\n            options.append((sec[self.name], self.module, self.name))\n\n        for alias in self.aliases:\n            module, name = alias.rsplit('.', 1)\n            sec = get_config(module, rootname=self.rootname)\n            if '.' in module:\n                filename, module = module.split('.', 1)\n            else:\n                filename = module\n                module = ''\n            if name in sec:\n                if '.' in self.module:\n                    new_module = self.module.split('.', 1)[1]\n                else:\n                    new_module = ''\n                warn(\n                    \"Config parameter '{}' {} of the file '{}' \"\n                    \"is deprecated. Use '{}' {} instead.\".format(\n                        name, section_name(module), get_config_filename(filename,\n                                                                        rootname=self.rootname),\n                        self.name, section_name(new_module)),\n                    AstropyDeprecationWarning)\n                options.append((sec[name], module, name))\n\n        if len(options) == 0:\n            self.set(self.defaultvalue)\n            options.append((self.defaultvalue, None, None))\n\n        if len(options) > 1:\n            filename, sec = self.module.split('.', 1)\n            warn(\n                \"Config parameter '{}' {} of the file '{}' is \"\n                \"given by more than one alias ({}). Using the first.\".format(\n                    self.name, section_name(sec), get_config_filename(filename,\n                                                                      rootname=self.rootname),\n                    ', '.join([\n                        '.'.join(x[1:3]) for x in options if x[1] is not None])),\n                AstropyDeprecationWarning)\n\n        val = options[0][0]\n\n        try:\n            return self._validate_val(val)\n        except validate.ValidateError as e:\n            raise TypeError('Configuration value not valid:' + e.args[0])"},{"col":4,"comment":"Read IERS-A table from a finals2000a.* file provided by USNO.\n\n        Parameters\n        ----------\n        file : str\n            full path to ascii file holding IERS-A data.\n            Defaults to ``iers.IERS_A_FILE``.\n        readme : str\n            full path to ascii file holding CDS-style readme.\n            Defaults to package version, ``iers.IERS_A_README``.\n\n        Returns\n        -------\n        ``IERS_A`` class instance\n        ","endLoc":554,"header":"@classmethod\n    def read(cls, file=None, readme=None)","id":11214,"name":"read","nodeType":"Function","startLoc":525,"text":"@classmethod\n    def read(cls, file=None, readme=None):\n        \"\"\"Read IERS-A table from a finals2000a.* file provided by USNO.\n\n        Parameters\n        ----------\n        file : str\n            full path to ascii file holding IERS-A data.\n            Defaults to ``iers.IERS_A_FILE``.\n        readme : str\n            full path to ascii file holding CDS-style readme.\n            Defaults to package version, ``iers.IERS_A_README``.\n\n        Returns\n        -------\n        ``IERS_A`` class instance\n        \"\"\"\n        if file is None:\n            file = IERS_A_FILE\n        if readme is None:\n            readme = IERS_A_README\n\n        iers_a = super().read(file, format='cds', readme=readme)\n\n        # Combine the A and B data for UT1-UTC and PM columns\n        table = cls._combine_a_b_columns(iers_a)\n        table.meta['data_path'] = file\n        table.meta['readme_path'] = readme\n\n        return table"},{"col":4,"comment":"New view of the masked array.\n\n        Like `numpy.ndarray.view`, but always returning a masked array subclass.\n        ","endLoc":556,"header":"def view(self, dtype=None, type=None)","id":11215,"name":"view","nodeType":"Function","startLoc":536,"text":"def view(self, dtype=None, type=None):\n        \"\"\"New view of the masked array.\n\n        Like `numpy.ndarray.view`, but always returning a masked array subclass.\n        \"\"\"\n        if type is None and (isinstance(dtype, builtins.type)\n                             and issubclass(dtype, np.ndarray)):\n            return super().view(self._get_masked_cls(dtype))\n\n        if dtype is None:\n            return super().view(self._get_masked_cls(type))\n\n        dtype = np.dtype(dtype)\n        if not (dtype.itemsize == self.dtype.itemsize\n                and (dtype.names is None\n                     or len(dtype.names) == len(self.dtype.names))):\n            raise NotImplementedError(\n                f\"{self.__class__} cannot be viewed with a dtype with a \"\n                f\"with a different number of fields or size.\")\n\n        return super().view(dtype, self._get_masked_cls(type))"},{"col":0,"comment":"null","endLoc":570,"header":"def _masked_median(a, axis=None, out=None, overwrite_input=False)","id":11216,"name":"_masked_median","nodeType":"Function","startLoc":561,"text":"def _masked_median(a, axis=None, out=None, overwrite_input=False):\n    # As for np.nanmedian, but without a fast option as yet.\n    if axis is None or a.ndim == 1:\n        part = a.ravel()\n        result = _masked_median_1d(part, overwrite_input)\n    else:\n        result = np.apply_along_axis(_masked_median_1d, axis, a, overwrite_input)\n    if out is not None:\n        out[...] = result\n    return result"},{"attributeType":"LocaleTime","col":12,"comment":"null","endLoc":202,"id":11217,"name":"locale_time","nodeType":"Attribute","startLoc":202,"text":"self.locale_time"},{"col":4,"comment":"null","endLoc":121,"header":"def error(self, msg, *args, **kwargs)","id":11218,"name":"error","nodeType":"Function","startLoc":120,"text":"def error(self, msg, *args, **kwargs):\n        self.f.write('ERROR: ' + (msg % args) + '\\n')"},{"col":0,"comment":"null","endLoc":583,"header":"@dispatched_function\ndef median(a, axis=None, out=None, overwrite_input=False, keepdims=False)","id":11219,"name":"median","nodeType":"Function","startLoc":573,"text":"@dispatched_function\ndef median(a, axis=None, out=None, overwrite_input=False, keepdims=False):\n    from astropy.utils.masked import Masked\n    if out is not None and not isinstance(out, Masked):\n        raise NotImplementedError\n\n    a = Masked(a)\n    r, k = np.lib.function_base._ureduce(\n        a, func=_masked_median, axis=axis, out=out,\n        overwrite_input=overwrite_input)\n    return (r.reshape(k) if keepdims else r) if out is None else out"},{"col":4,"comment":"Set UT1-UTC source flag for entries in IERS table","endLoc":562,"header":"def ut1_utc_source(self, i)","id":11220,"name":"ut1_utc_source","nodeType":"Function","startLoc":556,"text":"def ut1_utc_source(self, i):\n        \"\"\"Set UT1-UTC source flag for entries in IERS table\"\"\"\n        ut1flag = self['UT1Flag'][i]\n        source = np.ones_like(i) * FROM_IERS_B\n        source[ut1flag == 'I'] = FROM_IERS_A\n        source[ut1flag == 'P'] = FROM_IERS_A_PREDICTION\n        return source"},{"col":0,"comment":"Return a time struct based on the input string and the\n    format string.","endLoc":513,"header":"def _strptime_time(data_string, format=\"%a %b %d %H:%M:%S %Y\")","id":11221,"name":"_strptime_time","nodeType":"Function","startLoc":509,"text":"def _strptime_time(data_string, format=\"%a %b %d %H:%M:%S %Y\"):\n    \"\"\"Return a time struct based on the input string and the\n    format string.\"\"\"\n    tt = _strptime(data_string, format)[0]\n    return time.struct_time(tt[:time._STRUCT_TM_ITEMS])"},{"col":0,"comment":"Return a class cls instance based on the input string and the\n    format string.","endLoc":529,"header":"def _strptime_datetime(cls, data_string, format=\"%a %b %d %H:%M:%S %Y\")","id":11222,"name":"_strptime_datetime","nodeType":"Function","startLoc":515,"text":"def _strptime_datetime(cls, data_string, format=\"%a %b %d %H:%M:%S %Y\"):\n    \"\"\"Return a class cls instance based on the input string and the\n    format string.\"\"\"\n    tt, fraction = _strptime(data_string, format)\n    tzname, gmtoff = tt[-2:]\n    args = tt[:6] + (fraction,)\n    if gmtoff is not None:\n        tzdelta = datetime_timedelta(seconds=gmtoff)\n        if tzname:\n            tz = datetime_timezone(tzdelta, tzname)\n        else:\n            tz = datetime_timezone(tzdelta)\n        args += (tz,)\n\n    return cls(*args)"},{"col":4,"comment":"Set CIP correction source flag for entries in IERS table","endLoc":570,"header":"def dcip_source(self, i)","id":11223,"name":"dcip_source","nodeType":"Function","startLoc":564,"text":"def dcip_source(self, i):\n        \"\"\"Set CIP correction source flag for entries in IERS table\"\"\"\n        nutflag = self['NutFlag'][i]\n        source = np.ones_like(i) * FROM_IERS_B\n        source[nutflag == 'I'] = FROM_IERS_A\n        source[nutflag == 'P'] = FROM_IERS_A_PREDICTION\n        return source"},{"col":4,"comment":"Set polar motion source flag for entries in IERS table","endLoc":578,"header":"def pm_source(self, i)","id":11224,"name":"pm_source","nodeType":"Function","startLoc":572,"text":"def pm_source(self, i):\n        \"\"\"Set polar motion source flag for entries in IERS table\"\"\"\n        pmflag = self['PolPMFlag'][i]\n        source = np.ones_like(i) * FROM_IERS_B\n        source[pmflag == 'I'] = FROM_IERS_A\n        source[pmflag == 'P'] = FROM_IERS_A_PREDICTION\n        return source"},{"attributeType":"None","col":4,"comment":"null","endLoc":473,"id":11225,"name":"iers_table","nodeType":"Attribute","startLoc":473,"text":"iers_table"},{"className":"IERS_B","col":0,"comment":"IERS Table class targeted to IERS B, provided by IERS itself.\n\n    These are final values; see https://www.iers.org/IERS/EN/Home/home_node.html\n\n    Notes\n    -----\n    If the package IERS B file (```iers.IERS_B_FILE``) is out of date, a new\n    version can be downloaded from ``iers.IERS_B_URL``.\n    ","endLoc":635,"id":11226,"nodeType":"Class","startLoc":581,"text":"class IERS_B(IERS):\n    \"\"\"IERS Table class targeted to IERS B, provided by IERS itself.\n\n    These are final values; see https://www.iers.org/IERS/EN/Home/home_node.html\n\n    Notes\n    -----\n    If the package IERS B file (```iers.IERS_B_FILE``) is out of date, a new\n    version can be downloaded from ``iers.IERS_B_URL``.\n    \"\"\"\n\n    iers_table = None\n\n    @classmethod\n    def read(cls, file=None, readme=None, data_start=14):\n        \"\"\"Read IERS-B table from a eopc04_iau2000.* file provided by IERS.\n\n        Parameters\n        ----------\n        file : str\n            full path to ascii file holding IERS-B data.\n            Defaults to package version, ``iers.IERS_B_FILE``.\n        readme : str\n            full path to ascii file holding CDS-style readme.\n            Defaults to package version, ``iers.IERS_B_README``.\n        data_start : int\n            starting row. Default is 14, appropriate for standard IERS files.\n\n        Returns\n        -------\n        ``IERS_B`` class instance\n        \"\"\"\n        if file is None:\n            file = IERS_B_FILE\n        if readme is None:\n            readme = IERS_B_README\n\n        table = super().read(file, format='cds', readme=readme,\n                             data_start=data_start)\n\n        table.meta['data_path'] = file\n        table.meta['readme_path'] = readme\n        return table\n\n    def ut1_utc_source(self, i):\n        \"\"\"Set UT1-UTC source flag for entries in IERS table\"\"\"\n        return np.ones_like(i) * FROM_IERS_B\n\n    def dcip_source(self, i):\n        \"\"\"Set CIP correction source flag for entries in IERS table\"\"\"\n        return np.ones_like(i) * FROM_IERS_B\n\n    def pm_source(self, i):\n        \"\"\"Set PM source flag for entries in IERS table\"\"\"\n        return np.ones_like(i) * FROM_IERS_B"},{"col":4,"comment":"Set UT1-UTC source flag for entries in IERS table","endLoc":627,"header":"def ut1_utc_source(self, i)","id":11227,"name":"ut1_utc_source","nodeType":"Function","startLoc":625,"text":"def ut1_utc_source(self, i):\n        \"\"\"Set UT1-UTC source flag for entries in IERS table\"\"\"\n        return np.ones_like(i) * FROM_IERS_B"},{"col":4,"comment":"Set CIP correction source flag for entries in IERS table","endLoc":631,"header":"def dcip_source(self, i)","id":11228,"name":"dcip_source","nodeType":"Function","startLoc":629,"text":"def dcip_source(self, i):\n        \"\"\"Set CIP correction source flag for entries in IERS table\"\"\"\n        return np.ones_like(i) * FROM_IERS_B"},{"col":4,"comment":"Set PM source flag for entries in IERS table","endLoc":635,"header":"def pm_source(self, i)","id":11229,"name":"pm_source","nodeType":"Function","startLoc":633,"text":"def pm_source(self, i):\n        \"\"\"Set PM source flag for entries in IERS table\"\"\"\n        return np.ones_like(i) * FROM_IERS_B"},{"attributeType":"None","col":4,"comment":"null","endLoc":592,"id":11230,"name":"iers_table","nodeType":"Attribute","startLoc":592,"text":"iers_table"},{"col":0,"comment":"\n    Private function for rank 1 arrays. Compute quantile ignoring NaNs.\n    See nanpercentile for parameter usage\n    ","endLoc":596,"header":"def _masked_quantile_1d(a, q, **kwargs)","id":11231,"name":"_masked_quantile_1d","nodeType":"Function","startLoc":586,"text":"def _masked_quantile_1d(a, q, **kwargs):\n    \"\"\"\n    Private function for rank 1 arrays. Compute quantile ignoring NaNs.\n    See nanpercentile for parameter usage\n    \"\"\"\n    unmasked = a.unmasked[~a.mask]\n    if unmasked.size:\n        result = np.lib.function_base._quantile_unchecked(unmasked, q, **kwargs)\n        return a.from_unmasked(result)\n    else:\n        return a.from_unmasked(_zeros_like(a.unmasked, shape=q.shape), True)"},{"className":"IERS_Auto","col":0,"comment":"\n    Provide most-recent IERS data and automatically handle downloading\n    of updated values as necessary.\n    ","endLoc":821,"id":11232,"nodeType":"Class","startLoc":638,"text":"class IERS_Auto(IERS_A):\n    \"\"\"\n    Provide most-recent IERS data and automatically handle downloading\n    of updated values as necessary.\n    \"\"\"\n    iers_table = None\n\n    @classmethod\n    def open(cls):\n        \"\"\"If the configuration setting ``astropy.utils.iers.conf.auto_download``\n        is set to True (default), then open a recent version of the IERS-A\n        table with predictions for UT1-UTC and polar motion out to\n        approximately one year from now.  If the available version of this file\n        is older than ``astropy.utils.iers.conf.auto_max_age`` days old\n        (or non-existent) then it will be downloaded over the network and cached.\n\n        If the configuration setting ``astropy.utils.iers.conf.auto_download``\n        is set to False then ``astropy.utils.iers.IERS()`` is returned.  This\n        is normally the IERS-B table that is supplied with astropy.\n\n        On the first call in a session, the table will be memoized (in the\n        ``iers_table`` class attribute), and further calls to ``open`` will\n        return this stored table.\n\n        Returns\n        -------\n        `~astropy.table.QTable` instance\n            With IERS (Earth rotation) data columns\n\n        \"\"\"\n        if not conf.auto_download:\n            cls.iers_table = IERS_B.open()\n            return cls.iers_table\n\n        all_urls = (conf.iers_auto_url, conf.iers_auto_url_mirror)\n\n        if cls.iers_table is not None:\n\n            # If the URL has changed, we need to redownload the file, so we\n            # should ignore the internally cached version.\n\n            if cls.iers_table.meta.get('data_url') in all_urls:\n                return cls.iers_table\n\n        try:\n            filename = download_file(all_urls[0], sources=all_urls, cache=True)\n        except Exception as err:\n            # Issue a warning here, perhaps user is offline.  An exception\n            # will be raised downstream when actually trying to interpolate\n            # predictive values.\n            warn(AstropyWarning(\n                f'failed to download {\" and \".join(all_urls)}, '\n                f'using local IERS-B: {err}'))\n            cls.iers_table = IERS_B.open()\n            return cls.iers_table\n\n        cls.iers_table = cls.read(file=filename)\n        cls.iers_table.meta['data_url'] = all_urls[0]\n\n        return cls.iers_table\n\n    def _check_interpolate_indices(self, indices_orig, indices_clipped, max_input_mjd):\n        \"\"\"Check that the indices from interpolation match those after clipping to the\n        valid table range.  The IERS_Auto class is exempted as long as it has\n        sufficiently recent available data so the clipped interpolation is\n        always within the confidence bounds of current Earth rotation\n        knowledge.\n        \"\"\"\n        predictive_mjd = self.meta['predictive_mjd']\n\n        # See explanation in _refresh_table_as_needed for these conditions\n        auto_max_age = _none_to_float(conf.auto_max_age)\n        if (max_input_mjd > predictive_mjd and\n                self.time_now.mjd - predictive_mjd > auto_max_age):\n            raise ValueError(INTERPOLATE_ERROR.format(auto_max_age))\n\n    def _refresh_table_as_needed(self, mjd):\n        \"\"\"Potentially update the IERS table in place depending on the requested\n        time values in ``mjd`` and the time span of the table.\n\n        For IERS_Auto the behavior is that the table is refreshed from the IERS\n        server if both the following apply:\n\n        - Any of the requested IERS values are predictive.  The IERS-A table\n          contains predictive data out for a year after the available\n          definitive values.\n        - The first predictive values are at least ``conf.auto_max_age days`` old.\n          In other words the IERS-A table was created by IERS long enough\n          ago that it can be considered stale for predictions.\n        \"\"\"\n        max_input_mjd = np.max(mjd)\n        now_mjd = self.time_now.mjd\n\n        # IERS-A table contains predictive data out for a year after\n        # the available definitive values.\n        fpi = self.meta['predictive_index']\n        predictive_mjd = self.meta['predictive_mjd']\n\n        # Update table in place if necessary\n        auto_max_age = _none_to_float(conf.auto_max_age)\n\n        # If auto_max_age is smaller than IERS update time then repeated downloads may\n        # occur without getting updated values (giving a IERSStaleWarning).\n        if auto_max_age < 10:\n            raise ValueError('IERS auto_max_age configuration value must be larger than 10 days')\n\n        if (max_input_mjd > predictive_mjd and\n                (now_mjd - predictive_mjd) > auto_max_age):\n\n            all_urls = (conf.iers_auto_url, conf.iers_auto_url_mirror)\n\n            # Get the latest version\n            try:\n                filename = download_file(\n                    all_urls[0], sources=all_urls, cache=\"update\")\n            except Exception as err:\n                # Issue a warning here, perhaps user is offline.  An exception\n                # will be raised downstream when actually trying to interpolate\n                # predictive values.\n                warn(AstropyWarning(\n                    f'failed to download {\" and \".join(all_urls)}: {err}.\\n'\n                    'A coordinate or time-related '\n                    'calculation might be compromised or fail because the dates are '\n                    'not covered by the available IERS file.  See the '\n                    '\"IERS data access\" section of the astropy documentation '\n                    'for additional information on working offline.'))\n                return\n\n            new_table = self.__class__.read(file=filename)\n            new_table.meta['data_url'] = str(all_urls[0])\n\n            # New table has new values?\n            if new_table['MJD'][-1] > self['MJD'][-1]:\n                # Replace *replace* current values from the first predictive index through\n                # the end of the current table.  This replacement is much faster than just\n                # deleting all rows and then using add_row for the whole duration.\n                new_fpi = np.searchsorted(new_table['MJD'].value, predictive_mjd, side='right')\n                n_replace = len(self) - fpi\n                self[fpi:] = new_table[new_fpi:new_fpi + n_replace]\n\n                # Sanity check for continuity\n                if new_table['MJD'][new_fpi + n_replace] - self['MJD'][-1] != 1.0 * u.d:\n                    raise ValueError('unexpected gap in MJD when refreshing IERS table')\n\n                # Now add new rows in place\n                for row in new_table[new_fpi + n_replace:]:\n                    self.add_row(row)\n\n                self.meta.update(new_table.meta)\n            else:\n                warn(IERSStaleWarning(\n                    'IERS_Auto predictive values are older than {} days but downloading '\n                    'the latest table did not find newer values'.format(conf.auto_max_age)))\n\n    @classmethod\n    def _substitute_iers_b(cls, table):\n        \"\"\"Substitute IERS B values with those from a real IERS B table.\n\n        IERS-A has IERS-B values included, but for reasons unknown these\n        do not match the latest IERS-B values (see comments in #4436).\n        Here, we use the bundled astropy IERS-B table to overwrite the values\n        in the downloaded IERS-A table.\n        \"\"\"\n        iers_b = IERS_B.open()\n        # Substitute IERS-B values for existing B values in IERS-A table\n        mjd_b = table['MJD'][np.isfinite(table['UT1_UTC_B'])]\n        i0 = np.searchsorted(iers_b['MJD'], mjd_b[0], side='left')\n        i1 = np.searchsorted(iers_b['MJD'], mjd_b[-1], side='right')\n        iers_b = iers_b[i0:i1]\n        n_iers_b = len(iers_b)\n        # If there is overlap then replace IERS-A values from available IERS-B\n        if n_iers_b > 0:\n            # Sanity check that we are overwriting the correct values\n            if not u.allclose(table['MJD'][:n_iers_b], iers_b['MJD']):\n                raise ValueError('unexpected mismatch when copying '\n                                 'IERS-B values into IERS-A table.')\n            # Finally do the overwrite\n            table['UT1_UTC_B'][:n_iers_b] = iers_b['UT1_UTC']\n            table['PM_X_B'][:n_iers_b] = iers_b['PM_x']\n            table['PM_Y_B'][:n_iers_b] = iers_b['PM_y']\n            table['dX_2000A_B'][:n_iers_b] = iers_b['dX_2000A']\n            table['dY_2000A_B'][:n_iers_b] = iers_b['dY_2000A']\n\n        return table"},{"col":4,"comment":"If the configuration setting ``astropy.utils.iers.conf.auto_download``\n        is set to True (default), then open a recent version of the IERS-A\n        table with predictions for UT1-UTC and polar motion out to\n        approximately one year from now.  If the available version of this file\n        is older than ``astropy.utils.iers.conf.auto_max_age`` days old\n        (or non-existent) then it will be downloaded over the network and cached.\n\n        If the configuration setting ``astropy.utils.iers.conf.auto_download``\n        is set to False then ``astropy.utils.iers.IERS()`` is returned.  This\n        is normally the IERS-B table that is supplied with astropy.\n\n        On the first call in a session, the table will be memoized (in the\n        ``iers_table`` class attribute), and further calls to ``open`` will\n        return this stored table.\n\n        Returns\n        -------\n        `~astropy.table.QTable` instance\n            With IERS (Earth rotation) data columns\n\n        ","endLoc":697,"header":"@classmethod\n    def open(cls)","id":11233,"name":"open","nodeType":"Function","startLoc":645,"text":"@classmethod\n    def open(cls):\n        \"\"\"If the configuration setting ``astropy.utils.iers.conf.auto_download``\n        is set to True (default), then open a recent version of the IERS-A\n        table with predictions for UT1-UTC and polar motion out to\n        approximately one year from now.  If the available version of this file\n        is older than ``astropy.utils.iers.conf.auto_max_age`` days old\n        (or non-existent) then it will be downloaded over the network and cached.\n\n        If the configuration setting ``astropy.utils.iers.conf.auto_download``\n        is set to False then ``astropy.utils.iers.IERS()`` is returned.  This\n        is normally the IERS-B table that is supplied with astropy.\n\n        On the first call in a session, the table will be memoized (in the\n        ``iers_table`` class attribute), and further calls to ``open`` will\n        return this stored table.\n\n        Returns\n        -------\n        `~astropy.table.QTable` instance\n            With IERS (Earth rotation) data columns\n\n        \"\"\"\n        if not conf.auto_download:\n            cls.iers_table = IERS_B.open()\n            return cls.iers_table\n\n        all_urls = (conf.iers_auto_url, conf.iers_auto_url_mirror)\n\n        if cls.iers_table is not None:\n\n            # If the URL has changed, we need to redownload the file, so we\n            # should ignore the internally cached version.\n\n            if cls.iers_table.meta.get('data_url') in all_urls:\n                return cls.iers_table\n\n        try:\n            filename = download_file(all_urls[0], sources=all_urls, cache=True)\n        except Exception as err:\n            # Issue a warning here, perhaps user is offline.  An exception\n            # will be raised downstream when actually trying to interpolate\n            # predictive values.\n            warn(AstropyWarning(\n                f'failed to download {\" and \".join(all_urls)}, '\n                f'using local IERS-B: {err}'))\n            cls.iers_table = IERS_B.open()\n            return cls.iers_table\n\n        cls.iers_table = cls.read(file=filename)\n        cls.iers_table.meta['data_url'] = all_urls[0]\n\n        return cls.iers_table"},{"col":0,"comment":"null","endLoc":614,"header":"def _masked_quantile(a, q, axis=None, out=None, **kwargs)","id":11234,"name":"_masked_quantile","nodeType":"Function","startLoc":599,"text":"def _masked_quantile(a, q, axis=None, out=None, **kwargs):\n    # As for np.nanmedian, but without a fast option as yet.\n    if axis is None or a.ndim == 1:\n        part = a.ravel()\n        result = _masked_quantile_1d(part, q, **kwargs)\n    else:\n        result = np.apply_along_axis(_masked_quantile_1d, axis, a, q, **kwargs)\n        # apply_along_axis fills in collapsed axis with results.\n        # Move that axis to the beginning to match percentile's\n        # convention.\n        if q.ndim != 0:\n            result = np.moveaxis(result, axis, 0)\n\n    if out is not None:\n        out[...] = result\n    return result"},{"col":0,"comment":"\n    Get the filename of the config file associated with the given\n    package or module.\n    ","endLoc":501,"header":"def get_config_filename(packageormod=None, rootname=None)","id":11236,"name":"get_config_filename","nodeType":"Function","startLoc":493,"text":"def get_config_filename(packageormod=None, rootname=None):\n    \"\"\"\n    Get the filename of the config file associated with the given\n    package or module.\n    \"\"\"\n    cfg = get_config(packageormod, rootname=rootname)\n    while cfg.parent is not cfg:\n        cfg = cfg.parent\n    return cfg.filename"},{"col":0,"comment":"null","endLoc":631,"header":"@dispatched_function\ndef quantile(a, q, axis=None, out=None, **kwargs)","id":11237,"name":"quantile","nodeType":"Function","startLoc":617,"text":"@dispatched_function\ndef quantile(a, q, axis=None, out=None, **kwargs):\n    from astropy.utils.masked import Masked\n    if isinstance(q, Masked) or out is not None and not isinstance(out, Masked):\n        raise NotImplementedError\n\n    a = Masked(a)\n    q = np.asanyarray(q)\n    if not np.lib.function_base._quantile_is_valid(q):\n        raise ValueError(\"Quantiles must be in the range [0, 1]\")\n\n    keepdims = kwargs.pop('keepdims', False)\n    r, k = np.lib.function_base._ureduce(\n        a, func=_masked_quantile, q=q, axis=axis, out=out, **kwargs)\n    return (r.reshape(k) if keepdims else r) if out is None else out"},{"attributeType":"function","col":4,"comment":"null","endLoc":115,"id":11238,"name":"info","nodeType":"Attribute","startLoc":115,"text":"info"},{"col":4,"comment":"null","endLoc":575,"header":"def __array_finalize__(self, obj)","id":11239,"name":"__array_finalize__","nodeType":"Function","startLoc":558,"text":"def __array_finalize__(self, obj):\n        # If we're a new object or viewing an ndarray, nothing has to be done.\n        if obj is None or obj.__class__ is np.ndarray:\n            return\n\n        # Logically, this should come from ndarray and hence be None, but\n        # just in case someone creates a new mixin, we check.\n        super_array_finalize = super().__array_finalize__\n        if super_array_finalize:  # pragma: no cover\n            super_array_finalize(obj)\n\n        if self._mask is None:\n            # Got here after, e.g., a view of another masked class.\n            # Get its mask, or initialize ours.\n            self._set_mask(getattr(obj, '_mask', False))\n\n        if 'info' in obj.__dict__:\n            self.info = obj.info"},{"col":0,"comment":"null","endLoc":637,"header":"@dispatched_function\ndef percentile(a, q, *args, **kwargs)","id":11240,"name":"percentile","nodeType":"Function","startLoc":634,"text":"@dispatched_function\ndef percentile(a, q, *args, **kwargs):\n    q = np.true_divide(q, 100)\n    return quantile(a, q, *args, **kwargs)"},{"attributeType":"function","col":4,"comment":"null","endLoc":123,"id":11241,"name":"critical","nodeType":"Attribute","startLoc":123,"text":"critical"},{"attributeType":"null","col":8,"comment":"null","endLoc":110,"id":11242,"name":"f","nodeType":"Attribute","startLoc":110,"text":"self.f"},{"className":"NullLogger","col":0,"comment":"null","endLoc":131,"id":11243,"nodeType":"Class","startLoc":126,"text":"class NullLogger(object):\n    def __getattribute__(self, name):\n        return self\n\n    def __call__(self, *args, **kwargs):\n        return self"},{"col":4,"comment":"null","endLoc":128,"header":"def __getattribute__(self, name)","id":11244,"name":"__getattribute__","nodeType":"Function","startLoc":127,"text":"def __getattribute__(self, name):\n        return self"},{"col":4,"comment":"null","endLoc":131,"header":"def __call__(self, *args, **kwargs)","id":11245,"name":"__call__","nodeType":"Function","startLoc":130,"text":"def __call__(self, *args, **kwargs):\n        return self"},{"className":"YaccError","col":0,"comment":"null","endLoc":135,"id":11246,"nodeType":"Class","startLoc":134,"text":"class YaccError(Exception):\n    pass"},{"className":"YaccSymbol","col":0,"comment":"null","endLoc":221,"id":11247,"nodeType":"Class","startLoc":216,"text":"class YaccSymbol:\n    def __str__(self):\n        return self.type\n\n    def __repr__(self):\n        return str(self)"},{"col":4,"comment":"null","endLoc":218,"header":"def __str__(self)","id":11248,"name":"__str__","nodeType":"Function","startLoc":217,"text":"def __str__(self):\n        return self.type"},{"col":4,"comment":"null","endLoc":221,"header":"def __repr__(self)","id":11249,"name":"__repr__","nodeType":"Function","startLoc":220,"text":"def __repr__(self):\n        return str(self)"},{"className":"YaccProduction","col":0,"comment":"null","endLoc":279,"id":11250,"nodeType":"Class","startLoc":232,"text":"class YaccProduction:\n    def __init__(self, s, stack=None):\n        self.slice = s\n        self.stack = stack\n        self.lexer = None\n        self.parser = None\n\n    def __getitem__(self, n):\n        if isinstance(n, slice):\n            return [s.value for s in self.slice[n]]\n        elif n >= 0:\n            return self.slice[n].value\n        else:\n            return self.stack[n].value\n\n    def __setitem__(self, n, v):\n        self.slice[n].value = v\n\n    def __getslice__(self, i, j):\n        return [s.value for s in self.slice[i:j]]\n\n    def __len__(self):\n        return len(self.slice)\n\n    def lineno(self, n):\n        return getattr(self.slice[n], 'lineno', 0)\n\n    def set_lineno(self, n, lineno):\n        self.slice[n].lineno = lineno\n\n    def linespan(self, n):\n        startline = getattr(self.slice[n], 'lineno', 0)\n        endline = getattr(self.slice[n], 'endlineno', startline)\n        return startline, endline\n\n    def lexpos(self, n):\n        return getattr(self.slice[n], 'lexpos', 0)\n\n    def set_lexpos(self, n, lexpos):\n        self.slice[n].lexpos = lexpos\n\n    def lexspan(self, n):\n        startpos = getattr(self.slice[n], 'lexpos', 0)\n        endpos = getattr(self.slice[n], 'endlexpos', startpos)\n        return startpos, endpos\n\n    def error(self):\n        raise SyntaxError"},{"col":4,"comment":"null","endLoc":237,"header":"def __init__(self, s, stack=None)","id":11251,"name":"__init__","nodeType":"Function","startLoc":233,"text":"def __init__(self, s, stack=None):\n        self.slice = s\n        self.stack = stack\n        self.lexer = None\n        self.parser = None"},{"col":4,"comment":"null","endLoc":245,"header":"def __getitem__(self, n)","id":11252,"name":"__getitem__","nodeType":"Function","startLoc":239,"text":"def __getitem__(self, n):\n        if isinstance(n, slice):\n            return [s.value for s in self.slice[n]]\n        elif n >= 0:\n            return self.slice[n].value\n        else:\n            return self.stack[n].value"},{"col":4,"comment":"null","endLoc":248,"header":"def __setitem__(self, n, v)","id":11253,"name":"__setitem__","nodeType":"Function","startLoc":247,"text":"def __setitem__(self, n, v):\n        self.slice[n].value = v"},{"col":4,"comment":"null","endLoc":251,"header":"def __getslice__(self, i, j)","id":11254,"name":"__getslice__","nodeType":"Function","startLoc":250,"text":"def __getslice__(self, i, j):\n        return [s.value for s in self.slice[i:j]]"},{"col":4,"comment":"null","endLoc":254,"header":"def __len__(self)","id":11255,"name":"__len__","nodeType":"Function","startLoc":253,"text":"def __len__(self):\n        return len(self.slice)"},{"col":4,"comment":"null","endLoc":257,"header":"def lineno(self, n)","id":11256,"name":"lineno","nodeType":"Function","startLoc":256,"text":"def lineno(self, n):\n        return getattr(self.slice[n], 'lineno', 0)"},{"col":4,"comment":"null","endLoc":260,"header":"def set_lineno(self, n, lineno)","id":11257,"name":"set_lineno","nodeType":"Function","startLoc":259,"text":"def set_lineno(self, n, lineno):\n        self.slice[n].lineno = lineno"},{"col":4,"comment":"null","endLoc":265,"header":"def linespan(self, n)","id":11258,"name":"linespan","nodeType":"Function","startLoc":262,"text":"def linespan(self, n):\n        startline = getattr(self.slice[n], 'lineno', 0)\n        endline = getattr(self.slice[n], 'endlineno', startline)\n        return startline, endline"},{"col":4,"comment":"null","endLoc":268,"header":"def lexpos(self, n)","id":11259,"name":"lexpos","nodeType":"Function","startLoc":267,"text":"def lexpos(self, n):\n        return getattr(self.slice[n], 'lexpos', 0)"},{"col":4,"comment":"null","endLoc":271,"header":"def set_lexpos(self, n, lexpos)","id":11260,"name":"set_lexpos","nodeType":"Function","startLoc":270,"text":"def set_lexpos(self, n, lexpos):\n        self.slice[n].lexpos = lexpos"},{"col":4,"comment":"null","endLoc":276,"header":"def lexspan(self, n)","id":11261,"name":"lexspan","nodeType":"Function","startLoc":273,"text":"def lexspan(self, n):\n        startpos = getattr(self.slice[n], 'lexpos', 0)\n        endpos = getattr(self.slice[n], 'endlexpos', startpos)\n        return startpos, endpos"},{"col":4,"comment":"null","endLoc":279,"header":"def error(self)","id":11262,"name":"error","nodeType":"Function","startLoc":278,"text":"def error(self):\n        raise SyntaxError"},{"attributeType":"null","col":8,"comment":"null","endLoc":235,"id":11263,"name":"stack","nodeType":"Attribute","startLoc":235,"text":"self.stack"},{"col":0,"comment":"null","endLoc":649,"header":"@dispatched_function\ndef array_equal(a1, a2, equal_nan=False)","id":11264,"name":"array_equal","nodeType":"Function","startLoc":640,"text":"@dispatched_function\ndef array_equal(a1, a2, equal_nan=False):\n    (a1d, a2d), (a1m, a2m) = _get_data_and_masks(a1, a2)\n    if a1d.shape != a2d.shape:\n        return False\n\n    equal = (a1d == a2d)\n    if equal_nan:\n        equal |= np.isnan(a1d) & np.isnan(a2d)\n    return bool((equal | a1m | a2m).all())"},{"col":4,"comment":"The shape of the data and the mask.\n\n        Usually used to get the current shape of an array, but may also be\n        used to reshape the array in-place by assigning a tuple of array\n        dimensions to it.  As with `numpy.reshape`, one of the new shape\n        dimensions can be -1, in which case its value is inferred from the\n        size of the array and the remaining dimensions.\n\n        Raises\n        ------\n        AttributeError\n            If a copy is required, of either the data or the mask.\n\n        ","endLoc":594,"header":"@property\n    def shape(self)","id":11265,"name":"shape","nodeType":"Function","startLoc":577,"text":"@property\n    def shape(self):\n        \"\"\"The shape of the data and the mask.\n\n        Usually used to get the current shape of an array, but may also be\n        used to reshape the array in-place by assigning a tuple of array\n        dimensions to it.  As with `numpy.reshape`, one of the new shape\n        dimensions can be -1, in which case its value is inferred from the\n        size of the array and the remaining dimensions.\n\n        Raises\n        ------\n        AttributeError\n            If a copy is required, of either the data or the mask.\n\n        \"\"\"\n        # Redefinition to allow defining a setter and add a docstring.\n        return super().shape"},{"col":4,"comment":"null","endLoc":617,"header":"@shape.setter\n    def shape(self, shape)","id":11266,"name":"shape","nodeType":"Function","startLoc":596,"text":"@shape.setter\n    def shape(self, shape):\n        old_shape = self.shape\n        self._mask.shape = shape\n        # Reshape array proper in try/except just in case some broadcasting\n        # or so causes it to fail.\n        try:\n            super(MaskedNDArray, type(self)).shape.__set__(self, shape)\n        except Exception as exc:\n            self._mask.shape = old_shape\n            # Given that the mask reshaping succeeded, the only logical\n            # reason for an exception is something like a broadcast error in\n            # in __array_finalize__, or a different memory ordering between\n            # mask and data.  For those, give a more useful error message;\n            # otherwise just raise the error.\n            if 'could not broadcast' in exc.args[0]:\n                raise AttributeError(\n                    'Incompatible shape for in-place modification. '\n                    'Use `.reshape()` to make a copy with the desired '\n                    'shape.') from None\n            else:  # pragma: no cover\n                raise"},{"attributeType":"None","col":8,"comment":"null","endLoc":237,"id":11267,"name":"parser","nodeType":"Attribute","startLoc":237,"text":"self.parser"},{"attributeType":"null","col":8,"comment":"null","endLoc":234,"id":11268,"name":"slice","nodeType":"Attribute","startLoc":234,"text":"self.slice"},{"attributeType":"None","col":8,"comment":"null","endLoc":236,"id":11269,"name":"lexer","nodeType":"Attribute","startLoc":236,"text":"self.lexer"},{"className":"LRParser","col":0,"comment":"null","endLoc":1275,"id":11270,"nodeType":"Class","startLoc":287,"text":"class LRParser:\n    def __init__(self, lrtab, errorf):\n        self.productions = lrtab.lr_productions\n        self.action = lrtab.lr_action\n        self.goto = lrtab.lr_goto\n        self.errorfunc = errorf\n        self.set_defaulted_states()\n        self.errorok = True\n\n    def errok(self):\n        self.errorok = True\n\n    def restart(self):\n        del self.statestack[:]\n        del self.symstack[:]\n        sym = YaccSymbol()\n        sym.type = '$end'\n        self.symstack.append(sym)\n        self.statestack.append(0)\n\n    # Defaulted state support.\n    # This method identifies parser states where there is only one possible reduction action.\n    # For such states, the parser can make a choose to make a rule reduction without consuming\n    # the next look-ahead token.  This delayed invocation of the tokenizer can be useful in\n    # certain kinds of advanced parsing situations where the lexer and parser interact with\n    # each other or change states (i.e., manipulation of scope, lexer states, etc.).\n    #\n    # See:  http://www.gnu.org/software/bison/manual/html_node/Default-Reductions.html#Default-Reductions\n    def set_defaulted_states(self):\n        self.defaulted_states = {}\n        for state, actions in self.action.items():\n            rules = list(actions.values())\n            if len(rules) == 1 and rules[0] < 0:\n                self.defaulted_states[state] = rules[0]\n\n    def disable_defaulted_states(self):\n        self.defaulted_states = {}\n\n    def parse(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None):\n        if debug or yaccdevel:\n            if isinstance(debug, int):\n                debug = PlyLogger(sys.stderr)\n            return self.parsedebug(input, lexer, debug, tracking, tokenfunc)\n        elif tracking:\n            return self.parseopt(input, lexer, debug, tracking, tokenfunc)\n        else:\n            return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)\n\n\n    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n    # parsedebug().\n    #\n    # This is the debugging enabled version of parse().  All changes made to the\n    # parsing engine should be made here.   Optimized versions of this function\n    # are automatically created by the ply/ygen.py script.  This script cuts out\n    # sections enclosed in markers such as this:\n    #\n    #      #--! DEBUG\n    #      statements\n    #      #--! DEBUG\n    #\n    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n    def parsedebug(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None):\n        #--! parsedebug-start\n        lookahead = None                         # Current lookahead symbol\n        lookaheadstack = []                      # Stack of lookahead symbols\n        actions = self.action                    # Local reference to action table (to avoid lookup on self.)\n        goto    = self.goto                      # Local reference to goto table (to avoid lookup on self.)\n        prod    = self.productions               # Local reference to production list (to avoid lookup on self.)\n        defaulted_states = self.defaulted_states # Local reference to defaulted states\n        pslice  = YaccProduction(None)           # Production object passed to grammar rules\n        errorcount = 0                           # Used during error recovery\n\n        #--! DEBUG\n        debug.info('PLY: PARSE DEBUG START')\n        #--! DEBUG\n\n        # If no lexer was given, we will try to use the lex module\n        if not lexer:\n            from . import lex\n            lexer = lex.lexer\n\n        # Set up the lexer and parser objects on pslice\n        pslice.lexer = lexer\n        pslice.parser = self\n\n        # If input was supplied, pass to lexer\n        if input is not None:\n            lexer.input(input)\n\n        if tokenfunc is None:\n            # Tokenize function\n            get_token = lexer.token\n        else:\n            get_token = tokenfunc\n\n        # Set the parser() token method (sometimes used in error recovery)\n        self.token = get_token\n\n        # Set up the state and symbol stacks\n\n        statestack = []                # Stack of parsing states\n        self.statestack = statestack\n        symstack   = []                # Stack of grammar symbols\n        self.symstack = symstack\n\n        pslice.stack = symstack         # Put in the production\n        errtoken   = None               # Err token\n\n        # The start state is assumed to be (0,$end)\n\n        statestack.append(0)\n        sym = YaccSymbol()\n        sym.type = '$end'\n        symstack.append(sym)\n        state = 0\n        while True:\n            # Get the next symbol on the input.  If a lookahead symbol\n            # is already set, we just use that. Otherwise, we'll pull\n            # the next token off of the lookaheadstack or from the lexer\n\n            #--! DEBUG\n            debug.debug('')\n            debug.debug('State  : %s', state)\n            #--! DEBUG\n\n            if state not in defaulted_states:\n                if not lookahead:\n                    if not lookaheadstack:\n                        lookahead = get_token()     # Get the next token\n                    else:\n                        lookahead = lookaheadstack.pop()\n                    if not lookahead:\n                        lookahead = YaccSymbol()\n                        lookahead.type = '$end'\n\n                # Check the action table\n                ltype = lookahead.type\n                t = actions[state].get(ltype)\n            else:\n                t = defaulted_states[state]\n                #--! DEBUG\n                debug.debug('Defaulted state %s: Reduce using %d', state, -t)\n                #--! DEBUG\n\n            #--! DEBUG\n            debug.debug('Stack  : %s',\n                        ('%s . %s' % (' '.join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip())\n            #--! DEBUG\n\n            if t is not None:\n                if t > 0:\n                    # shift a symbol on the stack\n                    statestack.append(t)\n                    state = t\n\n                    #--! DEBUG\n                    debug.debug('Action : Shift and goto state %s', t)\n                    #--! DEBUG\n\n                    symstack.append(lookahead)\n                    lookahead = None\n\n                    # Decrease error count on successful shift\n                    if errorcount:\n                        errorcount -= 1\n                    continue\n\n                if t < 0:\n                    # reduce a symbol on the stack, emit a production\n                    p = prod[-t]\n                    pname = p.name\n                    plen  = p.len\n\n                    # Get production function\n                    sym = YaccSymbol()\n                    sym.type = pname       # Production name\n                    sym.value = None\n\n                    #--! DEBUG\n                    if plen:\n                        debug.info('Action : Reduce rule [%s] with %s and goto state %d', p.str,\n                                   '['+','.join([format_stack_entry(_v.value) for _v in symstack[-plen:]])+']',\n                                   goto[statestack[-1-plen]][pname])\n                    else:\n                        debug.info('Action : Reduce rule [%s] with %s and goto state %d', p.str, [],\n                                   goto[statestack[-1]][pname])\n\n                    #--! DEBUG\n\n                    if plen:\n                        targ = symstack[-plen-1:]\n                        targ[0] = sym\n\n                        #--! TRACKING\n                        if tracking:\n                            t1 = targ[1]\n                            sym.lineno = t1.lineno\n                            sym.lexpos = t1.lexpos\n                            t1 = targ[-1]\n                            sym.endlineno = getattr(t1, 'endlineno', t1.lineno)\n                            sym.endlexpos = getattr(t1, 'endlexpos', t1.lexpos)\n                        #--! TRACKING\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # below as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            del symstack[-plen:]\n                            self.state = state\n                            p.callable(pslice)\n                            del statestack[-plen:]\n                            #--! DEBUG\n                            debug.info('Result : %s', format_result(pslice[0]))\n                            #--! DEBUG\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            symstack.extend(targ[1:-1])         # Put the production slice back on the stack\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                    else:\n\n                        #--! TRACKING\n                        if tracking:\n                            sym.lineno = lexer.lineno\n                            sym.lexpos = lexer.lexpos\n                        #--! TRACKING\n\n                        targ = [sym]\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # above as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            self.state = state\n                            p.callable(pslice)\n                            #--! DEBUG\n                            debug.info('Result : %s', format_result(pslice[0]))\n                            #--! DEBUG\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                if t == 0:\n                    n = symstack[-1]\n                    result = getattr(n, 'value', None)\n                    #--! DEBUG\n                    debug.info('Done   : Returning %s', format_result(result))\n                    debug.info('PLY: PARSE DEBUG END')\n                    #--! DEBUG\n                    return result\n\n            if t is None:\n\n                #--! DEBUG\n                debug.error('Error  : %s',\n                            ('%s . %s' % (' '.join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip())\n                #--! DEBUG\n\n                # We have some kind of parsing error here.  To handle\n                # this, we are going to push the current token onto\n                # the tokenstack and replace it with an 'error' token.\n                # If there are any synchronization rules, they may\n                # catch it.\n                #\n                # In addition to pushing the error token, we call call\n                # the user defined p_error() function if this is the\n                # first syntax error.  This function is only called if\n                # errorcount == 0.\n                if errorcount == 0 or self.errorok:\n                    errorcount = error_count\n                    self.errorok = False\n                    errtoken = lookahead\n                    if errtoken.type == '$end':\n                        errtoken = None               # End of file!\n                    if self.errorfunc:\n                        if errtoken and not hasattr(errtoken, 'lexer'):\n                            errtoken.lexer = lexer\n                        self.state = state\n                        tok = call_errorfunc(self.errorfunc, errtoken, self)\n                        if self.errorok:\n                            # User must have done some kind of panic\n                            # mode recovery on their own.  The\n                            # returned token is the next lookahead\n                            lookahead = tok\n                            errtoken = None\n                            continue\n                    else:\n                        if errtoken:\n                            if hasattr(errtoken, 'lineno'):\n                                lineno = lookahead.lineno\n                            else:\n                                lineno = 0\n                            if lineno:\n                                sys.stderr.write('yacc: Syntax error at line %d, token=%s\\n' % (lineno, errtoken.type))\n                            else:\n                                sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type)\n                        else:\n                            sys.stderr.write('yacc: Parse error in input. EOF\\n')\n                            return\n\n                else:\n                    errorcount = error_count\n\n                # case 1:  the statestack only has 1 entry on it.  If we're in this state, the\n                # entire parse has been rolled back and we're completely hosed.   The token is\n                # discarded and we just keep going.\n\n                if len(statestack) <= 1 and lookahead.type != '$end':\n                    lookahead = None\n                    errtoken = None\n                    state = 0\n                    # Nuke the pushback stack\n                    del lookaheadstack[:]\n                    continue\n\n                # case 2: the statestack has a couple of entries on it, but we're\n                # at the end of the file. nuke the top entry and generate an error token\n\n                # Start nuking entries on the stack\n                if lookahead.type == '$end':\n                    # Whoa. We're really hosed here. Bail out\n                    return\n\n                if lookahead.type != 'error':\n                    sym = symstack[-1]\n                    if sym.type == 'error':\n                        # Hmmm. Error is on top of stack, we'll just nuke input\n                        # symbol and continue\n                        #--! TRACKING\n                        if tracking:\n                            sym.endlineno = getattr(lookahead, 'lineno', sym.lineno)\n                            sym.endlexpos = getattr(lookahead, 'lexpos', sym.lexpos)\n                        #--! TRACKING\n                        lookahead = None\n                        continue\n\n                    # Create the error symbol for the first time and make it the new lookahead symbol\n                    t = YaccSymbol()\n                    t.type = 'error'\n\n                    if hasattr(lookahead, 'lineno'):\n                        t.lineno = t.endlineno = lookahead.lineno\n                    if hasattr(lookahead, 'lexpos'):\n                        t.lexpos = t.endlexpos = lookahead.lexpos\n                    t.value = lookahead\n                    lookaheadstack.append(lookahead)\n                    lookahead = t\n                else:\n                    sym = symstack.pop()\n                    #--! TRACKING\n                    if tracking:\n                        lookahead.lineno = sym.lineno\n                        lookahead.lexpos = sym.lexpos\n                    #--! TRACKING\n                    statestack.pop()\n                    state = statestack[-1]\n\n                continue\n\n            # Call an error function here\n            raise RuntimeError('yacc: internal parser error!!!\\n')\n\n        #--! parsedebug-end\n\n    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n    # parseopt().\n    #\n    # Optimized version of parse() method.  DO NOT EDIT THIS CODE DIRECTLY!\n    # This code is automatically generated by the ply/ygen.py script. Make\n    # changes to the parsedebug() method instead.\n    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n    def parseopt(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None):\n        #--! parseopt-start\n        lookahead = None                         # Current lookahead symbol\n        lookaheadstack = []                      # Stack of lookahead symbols\n        actions = self.action                    # Local reference to action table (to avoid lookup on self.)\n        goto    = self.goto                      # Local reference to goto table (to avoid lookup on self.)\n        prod    = self.productions               # Local reference to production list (to avoid lookup on self.)\n        defaulted_states = self.defaulted_states # Local reference to defaulted states\n        pslice  = YaccProduction(None)           # Production object passed to grammar rules\n        errorcount = 0                           # Used during error recovery\n\n\n        # If no lexer was given, we will try to use the lex module\n        if not lexer:\n            from . import lex\n            lexer = lex.lexer\n\n        # Set up the lexer and parser objects on pslice\n        pslice.lexer = lexer\n        pslice.parser = self\n\n        # If input was supplied, pass to lexer\n        if input is not None:\n            lexer.input(input)\n\n        if tokenfunc is None:\n            # Tokenize function\n            get_token = lexer.token\n        else:\n            get_token = tokenfunc\n\n        # Set the parser() token method (sometimes used in error recovery)\n        self.token = get_token\n\n        # Set up the state and symbol stacks\n\n        statestack = []                # Stack of parsing states\n        self.statestack = statestack\n        symstack   = []                # Stack of grammar symbols\n        self.symstack = symstack\n\n        pslice.stack = symstack         # Put in the production\n        errtoken   = None               # Err token\n\n        # The start state is assumed to be (0,$end)\n\n        statestack.append(0)\n        sym = YaccSymbol()\n        sym.type = '$end'\n        symstack.append(sym)\n        state = 0\n        while True:\n            # Get the next symbol on the input.  If a lookahead symbol\n            # is already set, we just use that. Otherwise, we'll pull\n            # the next token off of the lookaheadstack or from the lexer\n\n\n            if state not in defaulted_states:\n                if not lookahead:\n                    if not lookaheadstack:\n                        lookahead = get_token()     # Get the next token\n                    else:\n                        lookahead = lookaheadstack.pop()\n                    if not lookahead:\n                        lookahead = YaccSymbol()\n                        lookahead.type = '$end'\n\n                # Check the action table\n                ltype = lookahead.type\n                t = actions[state].get(ltype)\n            else:\n                t = defaulted_states[state]\n\n\n            if t is not None:\n                if t > 0:\n                    # shift a symbol on the stack\n                    statestack.append(t)\n                    state = t\n\n\n                    symstack.append(lookahead)\n                    lookahead = None\n\n                    # Decrease error count on successful shift\n                    if errorcount:\n                        errorcount -= 1\n                    continue\n\n                if t < 0:\n                    # reduce a symbol on the stack, emit a production\n                    p = prod[-t]\n                    pname = p.name\n                    plen  = p.len\n\n                    # Get production function\n                    sym = YaccSymbol()\n                    sym.type = pname       # Production name\n                    sym.value = None\n\n\n                    if plen:\n                        targ = symstack[-plen-1:]\n                        targ[0] = sym\n\n                        #--! TRACKING\n                        if tracking:\n                            t1 = targ[1]\n                            sym.lineno = t1.lineno\n                            sym.lexpos = t1.lexpos\n                            t1 = targ[-1]\n                            sym.endlineno = getattr(t1, 'endlineno', t1.lineno)\n                            sym.endlexpos = getattr(t1, 'endlexpos', t1.lexpos)\n                        #--! TRACKING\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # below as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            del symstack[-plen:]\n                            self.state = state\n                            p.callable(pslice)\n                            del statestack[-plen:]\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            symstack.extend(targ[1:-1])         # Put the production slice back on the stack\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                    else:\n\n                        #--! TRACKING\n                        if tracking:\n                            sym.lineno = lexer.lineno\n                            sym.lexpos = lexer.lexpos\n                        #--! TRACKING\n\n                        targ = [sym]\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # above as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            self.state = state\n                            p.callable(pslice)\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                if t == 0:\n                    n = symstack[-1]\n                    result = getattr(n, 'value', None)\n                    return result\n\n            if t is None:\n\n\n                # We have some kind of parsing error here.  To handle\n                # this, we are going to push the current token onto\n                # the tokenstack and replace it with an 'error' token.\n                # If there are any synchronization rules, they may\n                # catch it.\n                #\n                # In addition to pushing the error token, we call call\n                # the user defined p_error() function if this is the\n                # first syntax error.  This function is only called if\n                # errorcount == 0.\n                if errorcount == 0 or self.errorok:\n                    errorcount = error_count\n                    self.errorok = False\n                    errtoken = lookahead\n                    if errtoken.type == '$end':\n                        errtoken = None               # End of file!\n                    if self.errorfunc:\n                        if errtoken and not hasattr(errtoken, 'lexer'):\n                            errtoken.lexer = lexer\n                        self.state = state\n                        tok = call_errorfunc(self.errorfunc, errtoken, self)\n                        if self.errorok:\n                            # User must have done some kind of panic\n                            # mode recovery on their own.  The\n                            # returned token is the next lookahead\n                            lookahead = tok\n                            errtoken = None\n                            continue\n                    else:\n                        if errtoken:\n                            if hasattr(errtoken, 'lineno'):\n                                lineno = lookahead.lineno\n                            else:\n                                lineno = 0\n                            if lineno:\n                                sys.stderr.write('yacc: Syntax error at line %d, token=%s\\n' % (lineno, errtoken.type))\n                            else:\n                                sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type)\n                        else:\n                            sys.stderr.write('yacc: Parse error in input. EOF\\n')\n                            return\n\n                else:\n                    errorcount = error_count\n\n                # case 1:  the statestack only has 1 entry on it.  If we're in this state, the\n                # entire parse has been rolled back and we're completely hosed.   The token is\n                # discarded and we just keep going.\n\n                if len(statestack) <= 1 and lookahead.type != '$end':\n                    lookahead = None\n                    errtoken = None\n                    state = 0\n                    # Nuke the pushback stack\n                    del lookaheadstack[:]\n                    continue\n\n                # case 2: the statestack has a couple of entries on it, but we're\n                # at the end of the file. nuke the top entry and generate an error token\n\n                # Start nuking entries on the stack\n                if lookahead.type == '$end':\n                    # Whoa. We're really hosed here. Bail out\n                    return\n\n                if lookahead.type != 'error':\n                    sym = symstack[-1]\n                    if sym.type == 'error':\n                        # Hmmm. Error is on top of stack, we'll just nuke input\n                        # symbol and continue\n                        #--! TRACKING\n                        if tracking:\n                            sym.endlineno = getattr(lookahead, 'lineno', sym.lineno)\n                            sym.endlexpos = getattr(lookahead, 'lexpos', sym.lexpos)\n                        #--! TRACKING\n                        lookahead = None\n                        continue\n\n                    # Create the error symbol for the first time and make it the new lookahead symbol\n                    t = YaccSymbol()\n                    t.type = 'error'\n\n                    if hasattr(lookahead, 'lineno'):\n                        t.lineno = t.endlineno = lookahead.lineno\n                    if hasattr(lookahead, 'lexpos'):\n                        t.lexpos = t.endlexpos = lookahead.lexpos\n                    t.value = lookahead\n                    lookaheadstack.append(lookahead)\n                    lookahead = t\n                else:\n                    sym = symstack.pop()\n                    #--! TRACKING\n                    if tracking:\n                        lookahead.lineno = sym.lineno\n                        lookahead.lexpos = sym.lexpos\n                    #--! TRACKING\n                    statestack.pop()\n                    state = statestack[-1]\n\n                continue\n\n            # Call an error function here\n            raise RuntimeError('yacc: internal parser error!!!\\n')\n\n        #--! parseopt-end\n\n    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n    # parseopt_notrack().\n    #\n    # Optimized version of parseopt() with line number tracking removed.\n    # DO NOT EDIT THIS CODE DIRECTLY. This code is automatically generated\n    # by the ply/ygen.py script. Make changes to the parsedebug() method instead.\n    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n    def parseopt_notrack(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None):\n        #--! parseopt-notrack-start\n        lookahead = None                         # Current lookahead symbol\n        lookaheadstack = []                      # Stack of lookahead symbols\n        actions = self.action                    # Local reference to action table (to avoid lookup on self.)\n        goto    = self.goto                      # Local reference to goto table (to avoid lookup on self.)\n        prod    = self.productions               # Local reference to production list (to avoid lookup on self.)\n        defaulted_states = self.defaulted_states # Local reference to defaulted states\n        pslice  = YaccProduction(None)           # Production object passed to grammar rules\n        errorcount = 0                           # Used during error recovery\n\n\n        # If no lexer was given, we will try to use the lex module\n        if not lexer:\n            from . import lex\n            lexer = lex.lexer\n\n        # Set up the lexer and parser objects on pslice\n        pslice.lexer = lexer\n        pslice.parser = self\n\n        # If input was supplied, pass to lexer\n        if input is not None:\n            lexer.input(input)\n\n        if tokenfunc is None:\n            # Tokenize function\n            get_token = lexer.token\n        else:\n            get_token = tokenfunc\n\n        # Set the parser() token method (sometimes used in error recovery)\n        self.token = get_token\n\n        # Set up the state and symbol stacks\n\n        statestack = []                # Stack of parsing states\n        self.statestack = statestack\n        symstack   = []                # Stack of grammar symbols\n        self.symstack = symstack\n\n        pslice.stack = symstack         # Put in the production\n        errtoken   = None               # Err token\n\n        # The start state is assumed to be (0,$end)\n\n        statestack.append(0)\n        sym = YaccSymbol()\n        sym.type = '$end'\n        symstack.append(sym)\n        state = 0\n        while True:\n            # Get the next symbol on the input.  If a lookahead symbol\n            # is already set, we just use that. Otherwise, we'll pull\n            # the next token off of the lookaheadstack or from the lexer\n\n\n            if state not in defaulted_states:\n                if not lookahead:\n                    if not lookaheadstack:\n                        lookahead = get_token()     # Get the next token\n                    else:\n                        lookahead = lookaheadstack.pop()\n                    if not lookahead:\n                        lookahead = YaccSymbol()\n                        lookahead.type = '$end'\n\n                # Check the action table\n                ltype = lookahead.type\n                t = actions[state].get(ltype)\n            else:\n                t = defaulted_states[state]\n\n\n            if t is not None:\n                if t > 0:\n                    # shift a symbol on the stack\n                    statestack.append(t)\n                    state = t\n\n\n                    symstack.append(lookahead)\n                    lookahead = None\n\n                    # Decrease error count on successful shift\n                    if errorcount:\n                        errorcount -= 1\n                    continue\n\n                if t < 0:\n                    # reduce a symbol on the stack, emit a production\n                    p = prod[-t]\n                    pname = p.name\n                    plen  = p.len\n\n                    # Get production function\n                    sym = YaccSymbol()\n                    sym.type = pname       # Production name\n                    sym.value = None\n\n\n                    if plen:\n                        targ = symstack[-plen-1:]\n                        targ[0] = sym\n\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # below as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            del symstack[-plen:]\n                            self.state = state\n                            p.callable(pslice)\n                            del statestack[-plen:]\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            symstack.extend(targ[1:-1])         # Put the production slice back on the stack\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                    else:\n\n\n                        targ = [sym]\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # above as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            self.state = state\n                            p.callable(pslice)\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                if t == 0:\n                    n = symstack[-1]\n                    result = getattr(n, 'value', None)\n                    return result\n\n            if t is None:\n\n\n                # We have some kind of parsing error here.  To handle\n                # this, we are going to push the current token onto\n                # the tokenstack and replace it with an 'error' token.\n                # If there are any synchronization rules, they may\n                # catch it.\n                #\n                # In addition to pushing the error token, we call call\n                # the user defined p_error() function if this is the\n                # first syntax error.  This function is only called if\n                # errorcount == 0.\n                if errorcount == 0 or self.errorok:\n                    errorcount = error_count\n                    self.errorok = False\n                    errtoken = lookahead\n                    if errtoken.type == '$end':\n                        errtoken = None               # End of file!\n                    if self.errorfunc:\n                        if errtoken and not hasattr(errtoken, 'lexer'):\n                            errtoken.lexer = lexer\n                        self.state = state\n                        tok = call_errorfunc(self.errorfunc, errtoken, self)\n                        if self.errorok:\n                            # User must have done some kind of panic\n                            # mode recovery on their own.  The\n                            # returned token is the next lookahead\n                            lookahead = tok\n                            errtoken = None\n                            continue\n                    else:\n                        if errtoken:\n                            if hasattr(errtoken, 'lineno'):\n                                lineno = lookahead.lineno\n                            else:\n                                lineno = 0\n                            if lineno:\n                                sys.stderr.write('yacc: Syntax error at line %d, token=%s\\n' % (lineno, errtoken.type))\n                            else:\n                                sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type)\n                        else:\n                            sys.stderr.write('yacc: Parse error in input. EOF\\n')\n                            return\n\n                else:\n                    errorcount = error_count\n\n                # case 1:  the statestack only has 1 entry on it.  If we're in this state, the\n                # entire parse has been rolled back and we're completely hosed.   The token is\n                # discarded and we just keep going.\n\n                if len(statestack) <= 1 and lookahead.type != '$end':\n                    lookahead = None\n                    errtoken = None\n                    state = 0\n                    # Nuke the pushback stack\n                    del lookaheadstack[:]\n                    continue\n\n                # case 2: the statestack has a couple of entries on it, but we're\n                # at the end of the file. nuke the top entry and generate an error token\n\n                # Start nuking entries on the stack\n                if lookahead.type == '$end':\n                    # Whoa. We're really hosed here. Bail out\n                    return\n\n                if lookahead.type != 'error':\n                    sym = symstack[-1]\n                    if sym.type == 'error':\n                        # Hmmm. Error is on top of stack, we'll just nuke input\n                        # symbol and continue\n                        lookahead = None\n                        continue\n\n                    # Create the error symbol for the first time and make it the new lookahead symbol\n                    t = YaccSymbol()\n                    t.type = 'error'\n\n                    if hasattr(lookahead, 'lineno'):\n                        t.lineno = t.endlineno = lookahead.lineno\n                    if hasattr(lookahead, 'lexpos'):\n                        t.lexpos = t.endlexpos = lookahead.lexpos\n                    t.value = lookahead\n                    lookaheadstack.append(lookahead)\n                    lookahead = t\n                else:\n                    sym = symstack.pop()\n                    statestack.pop()\n                    state = statestack[-1]\n\n                continue\n\n            # Call an error function here\n            raise RuntimeError('yacc: internal parser error!!!\\n')\n\n        #--! parseopt-notrack-end"},{"col":4,"comment":"null","endLoc":635,"header":"def __eq__(self, other)","id":11271,"name":"__eq__","nodeType":"Function","startLoc":626,"text":"def __eq__(self, other):\n        if not self.dtype.names:\n            return self._eq_simple(other)\n\n        # For structured arrays, we treat this as a reduction over the fields,\n        # where masked fields are skipped and thus do not influence the result.\n        other = np.asanyarray(other, dtype=self.dtype)\n        result = np.stack([self[field] == other[field]\n                           for field in self.dtype.names], axis=-1)\n        return result.all(axis=-1)"},{"col":4,"comment":"null","endLoc":297,"header":"def errok(self)","id":11272,"name":"errok","nodeType":"Function","startLoc":296,"text":"def errok(self):\n        self.errorok = True"},{"col":4,"comment":"null","endLoc":305,"header":"def restart(self)","id":11273,"name":"restart","nodeType":"Function","startLoc":299,"text":"def restart(self):\n        del self.statestack[:]\n        del self.symstack[:]\n        sym = YaccSymbol()\n        sym.type = '$end'\n        self.symstack.append(sym)\n        self.statestack.append(0)"},{"col":4,"comment":"Check that the indices from interpolation match those after clipping to the\n        valid table range.  The IERS_Auto class is exempted as long as it has\n        sufficiently recent available data so the clipped interpolation is\n        always within the confidence bounds of current Earth rotation\n        knowledge.\n        ","endLoc":712,"header":"def _check_interpolate_indices(self, indices_orig, indices_clipped, max_input_mjd)","id":11275,"name":"_check_interpolate_indices","nodeType":"Function","startLoc":699,"text":"def _check_interpolate_indices(self, indices_orig, indices_clipped, max_input_mjd):\n        \"\"\"Check that the indices from interpolation match those after clipping to the\n        valid table range.  The IERS_Auto class is exempted as long as it has\n        sufficiently recent available data so the clipped interpolation is\n        always within the confidence bounds of current Earth rotation\n        knowledge.\n        \"\"\"\n        predictive_mjd = self.meta['predictive_mjd']\n\n        # See explanation in _refresh_table_as_needed for these conditions\n        auto_max_age = _none_to_float(conf.auto_max_age)\n        if (max_input_mjd > predictive_mjd and\n                self.time_now.mjd - predictive_mjd > auto_max_age):\n            raise ValueError(INTERPOLATE_ERROR.format(auto_max_age))"},{"col":4,"comment":"\n        Sets this item to a specified value only inside a with block.\n\n        Use as::\n\n            ITEM = ConfigItem('ITEM', 'default', 'description')\n\n            with ITEM.set_temp('newval'):\n                #... do something that wants ITEM's value to be 'newval' ...\n                print(ITEM)\n\n            # ITEM is now 'default' after the with block\n\n        Parameters\n        ----------\n        value\n            The value to set this item to inside the with block.\n\n        ","endLoc":358,"header":"@contextmanager\n    def set_temp(self, value)","id":11276,"name":"set_temp","nodeType":"Function","startLoc":332,"text":"@contextmanager\n    def set_temp(self, value):\n        \"\"\"\n        Sets this item to a specified value only inside a with block.\n\n        Use as::\n\n            ITEM = ConfigItem('ITEM', 'default', 'description')\n\n            with ITEM.set_temp('newval'):\n                #... do something that wants ITEM's value to be 'newval' ...\n                print(ITEM)\n\n            # ITEM is now 'default' after the with block\n\n        Parameters\n        ----------\n        value\n            The value to set this item to inside the with block.\n\n        \"\"\"\n        initval = self()\n        self.set(value)\n        try:\n            yield\n        finally:\n            self.set(initval)"},{"col":0,"comment":"\n    Convert None to a valid floating point value.  Especially\n    for auto_max_age = None.\n    ","endLoc":102,"header":"def _none_to_float(value)","id":11277,"name":"_none_to_float","nodeType":"Function","startLoc":97,"text":"def _none_to_float(value):\n    \"\"\"\n    Convert None to a valid floating point value.  Especially\n    for auto_max_age = None.\n    \"\"\"\n    return (value if value is not None else np.finfo(float).max)"},{"col":4,"comment":"null","endLoc":646,"header":"def __ne__(self, other)","id":11278,"name":"__ne__","nodeType":"Function","startLoc":637,"text":"def __ne__(self, other):\n        if not self.dtype.names:\n            return self._ne_simple(other)\n\n        # For structured arrays, we treat this as a reduction over the fields,\n        # where masked fields are skipped and thus do not influence the result.\n        other = np.asanyarray(other, dtype=self.dtype)\n        result = np.stack([self[field] != other[field]\n                           for field in self.dtype.names], axis=-1)\n        return result.any(axis=-1)"},{"col":0,"comment":"null","endLoc":654,"header":"@dispatched_function\ndef array_equiv(a1, a2)","id":11279,"name":"array_equiv","nodeType":"Function","startLoc":652,"text":"@dispatched_function\ndef array_equiv(a1, a2):\n    return bool((a1 == a2).all())"},{"col":0,"comment":"null","endLoc":670,"header":"@dispatched_function\ndef where(condition, *args)","id":11280,"name":"where","nodeType":"Function","startLoc":657,"text":"@dispatched_function\ndef where(condition, *args):\n    from astropy.utils.masked import Masked\n    if not args:\n        return condition.nonzero(), None, None\n\n    condition, c_mask = Masked._get_data_and_mask(condition)\n\n    data, masks = _get_data_and_masks(*args)\n    unmasked = np.where(condition, *data)\n    mask = np.where(condition, *masks)\n    if c_mask is not None:\n        mask |= c_mask\n    return Masked(unmasked, mask=mask)"},{"col":4,"comment":" Reloads the value of this ``ConfigItem`` from the relevant\n        configuration file.\n\n        Returns\n        -------\n        val : object\n            The new value loaded from the configuration file.\n\n        ","endLoc":387,"header":"def reload(self)","id":11281,"name":"reload","nodeType":"Function","startLoc":360,"text":"def reload(self):\n        \"\"\" Reloads the value of this ``ConfigItem`` from the relevant\n        configuration file.\n\n        Returns\n        -------\n        val : object\n            The new value loaded from the configuration file.\n\n        \"\"\"\n        self.set(self.defaultvalue)\n        baseobj = get_config(self.module, True, rootname=self.rootname)\n        secname = baseobj.name\n\n        cobj = baseobj\n        # a ConfigObj's parent is itself, so we look for the parent with that\n        while cobj.parent is not cobj:\n            cobj = cobj.parent\n\n        newobj = configobj.ConfigObj(cobj.filename, interpolation=False)\n        if secname is not None:\n            if secname not in newobj:\n                return baseobj.get(self.name)\n            newobj = newobj[secname]\n\n        if self.name in newobj:\n            baseobj[self.name] = newobj[self.name]\n        return baseobj.get(self.name)"},{"col":0,"comment":"Construct an array from an index array and a set of arrays to choose from.\n\n    Like `numpy.choose`.  Masked indices in ``a`` will lead to masked output\n    values and underlying data values are ignored if out of bounds (for\n    ``mode='raise'``).  Any values masked in ``choices`` will be propagated\n    if chosen.\n\n    ","endLoc":705,"header":"@dispatched_function\ndef choose(a, choices, out=None, mode='raise')","id":11282,"name":"choose","nodeType":"Function","startLoc":673,"text":"@dispatched_function\ndef choose(a, choices, out=None, mode='raise'):\n    \"\"\"Construct an array from an index array and a set of arrays to choose from.\n\n    Like `numpy.choose`.  Masked indices in ``a`` will lead to masked output\n    values and underlying data values are ignored if out of bounds (for\n    ``mode='raise'``).  Any values masked in ``choices`` will be propagated\n    if chosen.\n\n    \"\"\"\n    from astropy.utils.masked import Masked\n\n    a_data, a_mask = Masked._get_data_and_mask(a)\n    if a_mask is not None and mode == 'raise':\n        # Avoid raising on masked indices.\n        a_data = a.filled(fill_value=0)\n\n    kwargs = {'mode': mode}\n    if out is not None:\n        if not isinstance(out, Masked):\n            raise NotImplementedError\n        kwargs['out'] = out.unmasked\n\n    data, masks = _get_data_and_masks(*choices)\n    data_chosen = np.choose(a_data, data, **kwargs)\n    if out is not None:\n        kwargs['out'] = out.mask\n\n    mask_chosen = np.choose(a_data, masks, **kwargs)\n    if a_mask is not None:\n        mask_chosen |= a_mask\n\n    return Masked(data_chosen, mask_chosen) if out is None else out"},{"col":4,"comment":"null","endLoc":323,"header":"def disable_defaulted_states(self)","id":11283,"name":"disable_defaulted_states","nodeType":"Function","startLoc":322,"text":"def disable_defaulted_states(self):\n        self.defaulted_states = {}"},{"col":4,"comment":"null","endLoc":333,"header":"def parse(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None)","id":11284,"name":"parse","nodeType":"Function","startLoc":325,"text":"def parse(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None):\n        if debug or yaccdevel:\n            if isinstance(debug, int):\n                debug = PlyLogger(sys.stderr)\n            return self.parsedebug(input, lexer, debug, tracking, tokenfunc)\n        elif tracking:\n            return self.parseopt(input, lexer, debug, tracking, tokenfunc)\n        else:\n            return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)"},{"col":0,"comment":"Return an array drawn from elements in choicelist, depending on conditions.\n\n    Like `numpy.select`, with masks in ``choicelist`` are propagated.\n    Any masks in ``condlist`` are ignored.\n\n    ","endLoc":724,"header":"@apply_to_both\ndef select(condlist, choicelist, default=0)","id":11285,"name":"select","nodeType":"Function","startLoc":708,"text":"@apply_to_both\ndef select(condlist, choicelist, default=0):\n    \"\"\"Return an array drawn from elements in choicelist, depending on conditions.\n\n    Like `numpy.select`, with masks in ``choicelist`` are propagated.\n    Any masks in ``condlist`` are ignored.\n\n    \"\"\"\n    from astropy.utils.masked import Masked\n\n    condlist = [c.unmasked if isinstance(c, Masked) else c\n                for c in condlist]\n\n    data_list, mask_list = _get_data_and_masks(*choicelist)\n    default = Masked(default) if default is not np.ma.masked else Masked(0, mask=True)\n    return ((condlist, data_list, default.unmasked),\n            (condlist, mask_list, default.mask), {}, None)"},{"col":4,"comment":"Potentially update the IERS table in place depending on the requested\n        time values in ``mjd`` and the time span of the table.\n\n        For IERS_Auto the behavior is that the table is refreshed from the IERS\n        server if both the following apply:\n\n        - Any of the requested IERS values are predictive.  The IERS-A table\n          contains predictive data out for a year after the available\n          definitive values.\n        - The first predictive values are at least ``conf.auto_max_age days`` old.\n          In other words the IERS-A table was created by IERS long enough\n          ago that it can be considered stale for predictions.\n        ","endLoc":790,"header":"def _refresh_table_as_needed(self, mjd)","id":11286,"name":"_refresh_table_as_needed","nodeType":"Function","startLoc":714,"text":"def _refresh_table_as_needed(self, mjd):\n        \"\"\"Potentially update the IERS table in place depending on the requested\n        time values in ``mjd`` and the time span of the table.\n\n        For IERS_Auto the behavior is that the table is refreshed from the IERS\n        server if both the following apply:\n\n        - Any of the requested IERS values are predictive.  The IERS-A table\n          contains predictive data out for a year after the available\n          definitive values.\n        - The first predictive values are at least ``conf.auto_max_age days`` old.\n          In other words the IERS-A table was created by IERS long enough\n          ago that it can be considered stale for predictions.\n        \"\"\"\n        max_input_mjd = np.max(mjd)\n        now_mjd = self.time_now.mjd\n\n        # IERS-A table contains predictive data out for a year after\n        # the available definitive values.\n        fpi = self.meta['predictive_index']\n        predictive_mjd = self.meta['predictive_mjd']\n\n        # Update table in place if necessary\n        auto_max_age = _none_to_float(conf.auto_max_age)\n\n        # If auto_max_age is smaller than IERS update time then repeated downloads may\n        # occur without getting updated values (giving a IERSStaleWarning).\n        if auto_max_age < 10:\n            raise ValueError('IERS auto_max_age configuration value must be larger than 10 days')\n\n        if (max_input_mjd > predictive_mjd and\n                (now_mjd - predictive_mjd) > auto_max_age):\n\n            all_urls = (conf.iers_auto_url, conf.iers_auto_url_mirror)\n\n            # Get the latest version\n            try:\n                filename = download_file(\n                    all_urls[0], sources=all_urls, cache=\"update\")\n            except Exception as err:\n                # Issue a warning here, perhaps user is offline.  An exception\n                # will be raised downstream when actually trying to interpolate\n                # predictive values.\n                warn(AstropyWarning(\n                    f'failed to download {\" and \".join(all_urls)}: {err}.\\n'\n                    'A coordinate or time-related '\n                    'calculation might be compromised or fail because the dates are '\n                    'not covered by the available IERS file.  See the '\n                    '\"IERS data access\" section of the astropy documentation '\n                    'for additional information on working offline.'))\n                return\n\n            new_table = self.__class__.read(file=filename)\n            new_table.meta['data_url'] = str(all_urls[0])\n\n            # New table has new values?\n            if new_table['MJD'][-1] > self['MJD'][-1]:\n                # Replace *replace* current values from the first predictive index through\n                # the end of the current table.  This replacement is much faster than just\n                # deleting all rows and then using add_row for the whole duration.\n                new_fpi = np.searchsorted(new_table['MJD'].value, predictive_mjd, side='right')\n                n_replace = len(self) - fpi\n                self[fpi:] = new_table[new_fpi:new_fpi + n_replace]\n\n                # Sanity check for continuity\n                if new_table['MJD'][new_fpi + n_replace] - self['MJD'][-1] != 1.0 * u.d:\n                    raise ValueError('unexpected gap in MJD when refreshing IERS table')\n\n                # Now add new rows in place\n                for row in new_table[new_fpi + n_replace:]:\n                    self.add_row(row)\n\n                self.meta.update(new_table.meta)\n            else:\n                warn(IERSStaleWarning(\n                    'IERS_Auto predictive values are older than {} days but downloading '\n                    'the latest table did not find newer values'.format(conf.auto_max_age)))"},{"col":0,"comment":"Evaluate a piecewise-defined function.\n\n    Like `numpy.piecewise` but for masked input array ``x``.\n    Any masks in ``condlist`` are ignored.\n\n    ","endLoc":774,"header":"@dispatched_function\ndef piecewise(x, condlist, funclist, *args, **kw)","id":11287,"name":"piecewise","nodeType":"Function","startLoc":727,"text":"@dispatched_function\ndef piecewise(x, condlist, funclist, *args, **kw):\n    \"\"\"Evaluate a piecewise-defined function.\n\n    Like `numpy.piecewise` but for masked input array ``x``.\n    Any masks in ``condlist`` are ignored.\n\n    \"\"\"\n    # Copied implementation from numpy.lib.function_base.piecewise,\n    # just to ensure output is Masked.\n    n2 = len(funclist)\n    # undocumented: single condition is promoted to a list of one condition\n    if np.isscalar(condlist) or (\n            not isinstance(condlist[0], (list, np.ndarray))\n            and x.ndim != 0):  # pragma: no cover\n        condlist = [condlist]\n\n    condlist = np.array(condlist, dtype=bool)\n    n = len(condlist)\n\n    if n == n2 - 1:  # compute the \"otherwise\" condition.\n        condelse = ~np.any(condlist, axis=0, keepdims=True)\n        condlist = np.concatenate([condlist, condelse], axis=0)\n        n += 1\n    elif n != n2:\n        raise ValueError(\n            f\"with {n} condition(s), either {n} or {n + 1} functions are expected\"\n        )\n\n    # The one real change...\n    y = np.zeros_like(x)\n    where = []\n    what = []\n    for k in range(n):\n        item = funclist[k]\n        if not callable(item):\n            where.append(condlist[k])\n            what.append(item)\n        else:\n            vals = x[condlist[k]]\n            if vals.size > 0:\n                where.append(condlist[k])\n                what.append(item(vals, *args, **kw))\n\n    for item, value in zip(where, what):\n        y[item] = value\n\n    return y"},{"col":4,"comment":"null","endLoc":662,"header":"def _combine_masks(self, masks, out=None)","id":11288,"name":"_combine_masks","nodeType":"Function","startLoc":648,"text":"def _combine_masks(self, masks, out=None):\n        masks = [m for m in masks if m is not None and m is not False]\n        if not masks:\n            return False\n        if len(masks) == 1:\n            if out is None:\n                return masks[0].copy()\n            else:\n                np.copyto(out, masks[0])\n                return out\n\n        out = np.logical_or(masks[0], masks[1], out=out)\n        for mask in masks[2:]:\n            np.logical_or(out, mask, out=out)\n        return out"},{"col":4,"comment":"null","endLoc":687,"header":"def parsedebug(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None)","id":11289,"name":"parsedebug","nodeType":"Function","startLoc":350,"text":"def parsedebug(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None):\n        #--! parsedebug-start\n        lookahead = None                         # Current lookahead symbol\n        lookaheadstack = []                      # Stack of lookahead symbols\n        actions = self.action                    # Local reference to action table (to avoid lookup on self.)\n        goto    = self.goto                      # Local reference to goto table (to avoid lookup on self.)\n        prod    = self.productions               # Local reference to production list (to avoid lookup on self.)\n        defaulted_states = self.defaulted_states # Local reference to defaulted states\n        pslice  = YaccProduction(None)           # Production object passed to grammar rules\n        errorcount = 0                           # Used during error recovery\n\n        #--! DEBUG\n        debug.info('PLY: PARSE DEBUG START')\n        #--! DEBUG\n\n        # If no lexer was given, we will try to use the lex module\n        if not lexer:\n            from . import lex\n            lexer = lex.lexer\n\n        # Set up the lexer and parser objects on pslice\n        pslice.lexer = lexer\n        pslice.parser = self\n\n        # If input was supplied, pass to lexer\n        if input is not None:\n            lexer.input(input)\n\n        if tokenfunc is None:\n            # Tokenize function\n            get_token = lexer.token\n        else:\n            get_token = tokenfunc\n\n        # Set the parser() token method (sometimes used in error recovery)\n        self.token = get_token\n\n        # Set up the state and symbol stacks\n\n        statestack = []                # Stack of parsing states\n        self.statestack = statestack\n        symstack   = []                # Stack of grammar symbols\n        self.symstack = symstack\n\n        pslice.stack = symstack         # Put in the production\n        errtoken   = None               # Err token\n\n        # The start state is assumed to be (0,$end)\n\n        statestack.append(0)\n        sym = YaccSymbol()\n        sym.type = '$end'\n        symstack.append(sym)\n        state = 0\n        while True:\n            # Get the next symbol on the input.  If a lookahead symbol\n            # is already set, we just use that. Otherwise, we'll pull\n            # the next token off of the lookaheadstack or from the lexer\n\n            #--! DEBUG\n            debug.debug('')\n            debug.debug('State  : %s', state)\n            #--! DEBUG\n\n            if state not in defaulted_states:\n                if not lookahead:\n                    if not lookaheadstack:\n                        lookahead = get_token()     # Get the next token\n                    else:\n                        lookahead = lookaheadstack.pop()\n                    if not lookahead:\n                        lookahead = YaccSymbol()\n                        lookahead.type = '$end'\n\n                # Check the action table\n                ltype = lookahead.type\n                t = actions[state].get(ltype)\n            else:\n                t = defaulted_states[state]\n                #--! DEBUG\n                debug.debug('Defaulted state %s: Reduce using %d', state, -t)\n                #--! DEBUG\n\n            #--! DEBUG\n            debug.debug('Stack  : %s',\n                        ('%s . %s' % (' '.join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip())\n            #--! DEBUG\n\n            if t is not None:\n                if t > 0:\n                    # shift a symbol on the stack\n                    statestack.append(t)\n                    state = t\n\n                    #--! DEBUG\n                    debug.debug('Action : Shift and goto state %s', t)\n                    #--! DEBUG\n\n                    symstack.append(lookahead)\n                    lookahead = None\n\n                    # Decrease error count on successful shift\n                    if errorcount:\n                        errorcount -= 1\n                    continue\n\n                if t < 0:\n                    # reduce a symbol on the stack, emit a production\n                    p = prod[-t]\n                    pname = p.name\n                    plen  = p.len\n\n                    # Get production function\n                    sym = YaccSymbol()\n                    sym.type = pname       # Production name\n                    sym.value = None\n\n                    #--! DEBUG\n                    if plen:\n                        debug.info('Action : Reduce rule [%s] with %s and goto state %d', p.str,\n                                   '['+','.join([format_stack_entry(_v.value) for _v in symstack[-plen:]])+']',\n                                   goto[statestack[-1-plen]][pname])\n                    else:\n                        debug.info('Action : Reduce rule [%s] with %s and goto state %d', p.str, [],\n                                   goto[statestack[-1]][pname])\n\n                    #--! DEBUG\n\n                    if plen:\n                        targ = symstack[-plen-1:]\n                        targ[0] = sym\n\n                        #--! TRACKING\n                        if tracking:\n                            t1 = targ[1]\n                            sym.lineno = t1.lineno\n                            sym.lexpos = t1.lexpos\n                            t1 = targ[-1]\n                            sym.endlineno = getattr(t1, 'endlineno', t1.lineno)\n                            sym.endlexpos = getattr(t1, 'endlexpos', t1.lexpos)\n                        #--! TRACKING\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # below as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            del symstack[-plen:]\n                            self.state = state\n                            p.callable(pslice)\n                            del statestack[-plen:]\n                            #--! DEBUG\n                            debug.info('Result : %s', format_result(pslice[0]))\n                            #--! DEBUG\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            symstack.extend(targ[1:-1])         # Put the production slice back on the stack\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                    else:\n\n                        #--! TRACKING\n                        if tracking:\n                            sym.lineno = lexer.lineno\n                            sym.lexpos = lexer.lexpos\n                        #--! TRACKING\n\n                        targ = [sym]\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # above as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            self.state = state\n                            p.callable(pslice)\n                            #--! DEBUG\n                            debug.info('Result : %s', format_result(pslice[0]))\n                            #--! DEBUG\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                if t == 0:\n                    n = symstack[-1]\n                    result = getattr(n, 'value', None)\n                    #--! DEBUG\n                    debug.info('Done   : Returning %s', format_result(result))\n                    debug.info('PLY: PARSE DEBUG END')\n                    #--! DEBUG\n                    return result\n\n            if t is None:\n\n                #--! DEBUG\n                debug.error('Error  : %s',\n                            ('%s . %s' % (' '.join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip())\n                #--! DEBUG\n\n                # We have some kind of parsing error here.  To handle\n                # this, we are going to push the current token onto\n                # the tokenstack and replace it with an 'error' token.\n                # If there are any synchronization rules, they may\n                # catch it.\n                #\n                # In addition to pushing the error token, we call call\n                # the user defined p_error() function if this is the\n                # first syntax error.  This function is only called if\n                # errorcount == 0.\n                if errorcount == 0 or self.errorok:\n                    errorcount = error_count\n                    self.errorok = False\n                    errtoken = lookahead\n                    if errtoken.type == '$end':\n                        errtoken = None               # End of file!\n                    if self.errorfunc:\n                        if errtoken and not hasattr(errtoken, 'lexer'):\n                            errtoken.lexer = lexer\n                        self.state = state\n                        tok = call_errorfunc(self.errorfunc, errtoken, self)\n                        if self.errorok:\n                            # User must have done some kind of panic\n                            # mode recovery on their own.  The\n                            # returned token is the next lookahead\n                            lookahead = tok\n                            errtoken = None\n                            continue\n                    else:\n                        if errtoken:\n                            if hasattr(errtoken, 'lineno'):\n                                lineno = lookahead.lineno\n                            else:\n                                lineno = 0\n                            if lineno:\n                                sys.stderr.write('yacc: Syntax error at line %d, token=%s\\n' % (lineno, errtoken.type))\n                            else:\n                                sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type)\n                        else:\n                            sys.stderr.write('yacc: Parse error in input. EOF\\n')\n                            return\n\n                else:\n                    errorcount = error_count\n\n                # case 1:  the statestack only has 1 entry on it.  If we're in this state, the\n                # entire parse has been rolled back and we're completely hosed.   The token is\n                # discarded and we just keep going.\n\n                if len(statestack) <= 1 and lookahead.type != '$end':\n                    lookahead = None\n                    errtoken = None\n                    state = 0\n                    # Nuke the pushback stack\n                    del lookaheadstack[:]\n                    continue\n\n                # case 2: the statestack has a couple of entries on it, but we're\n                # at the end of the file. nuke the top entry and generate an error token\n\n                # Start nuking entries on the stack\n                if lookahead.type == '$end':\n                    # Whoa. We're really hosed here. Bail out\n                    return\n\n                if lookahead.type != 'error':\n                    sym = symstack[-1]\n                    if sym.type == 'error':\n                        # Hmmm. Error is on top of stack, we'll just nuke input\n                        # symbol and continue\n                        #--! TRACKING\n                        if tracking:\n                            sym.endlineno = getattr(lookahead, 'lineno', sym.lineno)\n                            sym.endlexpos = getattr(lookahead, 'lexpos', sym.lexpos)\n                        #--! TRACKING\n                        lookahead = None\n                        continue\n\n                    # Create the error symbol for the first time and make it the new lookahead symbol\n                    t = YaccSymbol()\n                    t.type = 'error'\n\n                    if hasattr(lookahead, 'lineno'):\n                        t.lineno = t.endlineno = lookahead.lineno\n                    if hasattr(lookahead, 'lexpos'):\n                        t.lexpos = t.endlexpos = lookahead.lexpos\n                    t.value = lookahead\n                    lookaheadstack.append(lookahead)\n                    lookahead = t\n                else:\n                    sym = symstack.pop()\n                    #--! TRACKING\n                    if tracking:\n                        lookahead.lineno = sym.lineno\n                        lookahead.lexpos = sym.lexpos\n                    #--! TRACKING\n                    statestack.pop()\n                    state = statestack[-1]\n\n                continue\n\n            # Call an error function here\n            raise RuntimeError('yacc: internal parser error!!!\\n')\n\n        #--! parsedebug-end"},{"col":4,"comment":"A version of ``get`` that doesn't bypass string interpolation.","endLoc":642,"header":"def get(self, key, default=None)","id":11290,"name":"get","nodeType":"Function","startLoc":637,"text":"def get(self, key, default=None):\n        \"\"\"A version of ``get`` that doesn't bypass string interpolation.\"\"\"\n        try:\n            return self[key]\n        except KeyError:\n            return default"},{"col":4,"comment":"null","endLoc":392,"header":"def __repr__(self)","id":11291,"name":"__repr__","nodeType":"Function","startLoc":389,"text":"def __repr__(self):\n        out = '<{}: name={!r} value={!r} at 0x{:x}>'.format(\n            self.__class__.__name__, self.name, self(), id(self))\n        return out"},{"col":4,"comment":"null","endLoc":404,"header":"def __str__(self)","id":11292,"name":"__str__","nodeType":"Function","startLoc":394,"text":"def __str__(self):\n        out = '\\n'.join(('{0}: {1}',\n                         '  cfgtype={2!r}',\n                         '  defaultvalue={3!r}',\n                         '  description={4!r}',\n                         '  module={5}',\n                         '  value={6!r}'))\n        out = out.format(self.__class__.__name__, self.name, self.cfgtype,\n                         self.defaultvalue, self.description, self.module,\n                         self())\n        return out"},{"attributeType":"Validator","col":4,"comment":"null","endLoc":238,"id":11293,"name":"_validator","nodeType":"Attribute","startLoc":238,"text":"_validator"},{"attributeType":"None","col":4,"comment":"\n    A type specifier like those used as the *values* of a particular key in a\n    ``configspec`` file of ``configobj``.\n    ","endLoc":239,"id":11294,"name":"cfgtype","nodeType":"Attribute","startLoc":239,"text":"cfgtype"},{"attributeType":"null","col":4,"comment":"\n    Rootname sets the base path for all config files.\n    ","endLoc":245,"id":11295,"name":"rootname","nodeType":"Attribute","startLoc":245,"text":"rootname"},{"col":4,"comment":"null","endLoc":801,"header":"def __array_ufunc__(self, ufunc, method, *inputs, **kwargs)","id":11296,"name":"__array_ufunc__","nodeType":"Function","startLoc":664,"text":"def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):\n        out = kwargs.pop('out', None)\n        out_unmasked = None\n        out_mask = None\n        if out is not None:\n            out_unmasked, out_masks = self._get_data_and_masks(*out)\n            for d, m in zip(out_unmasked, out_masks):\n                if m is None:\n                    # TODO: allow writing to unmasked output if nothing is masked?\n                    if d is not None:\n                        raise TypeError('cannot write to unmasked output')\n                elif out_mask is None:\n                    out_mask = m\n\n        unmasked, masks = self._get_data_and_masks(*inputs)\n\n        if ufunc.signature:\n            # We're dealing with a gufunc. For now, only deal with\n            # np.matmul and gufuncs for which the mask of any output always\n            # depends on all core dimension values of all inputs.\n            # Also ignore axes keyword for now...\n            # TODO: in principle, it should be possible to generate the mask\n            # purely based on the signature.\n            if 'axes' in kwargs:\n                raise NotImplementedError(\"Masked does not yet support gufunc \"\n                                          \"calls with 'axes'.\")\n            if ufunc is np.matmul:\n                # np.matmul is tricky and its signature cannot be parsed by\n                # _parse_gufunc_signature.\n                unmasked = np.atleast_1d(*unmasked)\n                mask0, mask1 = masks\n                masks = []\n                is_mat1 = unmasked[1].ndim >= 2\n                if mask0 is not None:\n                    masks.append(\n                        np.logical_or.reduce(mask0, axis=-1, keepdims=is_mat1))\n\n                if mask1 is not None:\n                    masks.append(\n                        np.logical_or.reduce(mask1, axis=-2, keepdims=True)\n                        if is_mat1 else\n                        np.logical_or.reduce(mask1))\n\n                mask = self._combine_masks(masks, out=out_mask)\n\n            else:\n                # Parse signature with private numpy function. Note it\n                # cannot handle spaces in tuples, so remove those.\n                in_sig, out_sig = np.lib.function_base._parse_gufunc_signature(\n                    ufunc.signature.replace(' ', ''))\n                axis = kwargs.get('axis', -1)\n                keepdims = kwargs.get('keepdims', False)\n                in_masks = []\n                for sig, mask in zip(in_sig, masks):\n                    if mask is not None:\n                        if sig:\n                            # Input has core dimensions.  Assume that if any\n                            # value in those is masked, the output will be\n                            # masked too (TODO: for multiple core dimensions\n                            # this may be too strong).\n                            mask = np.logical_or.reduce(\n                                mask, axis=axis, keepdims=keepdims)\n                        in_masks.append(mask)\n\n                mask = self._combine_masks(in_masks)\n                result_masks = []\n                for os in out_sig:\n                    if os:\n                        # Output has core dimensions.  Assume all those\n                        # get the same mask.\n                        result_mask = np.expand_dims(mask, axis)\n                    else:\n                        result_mask = mask\n                    result_masks.append(result_mask)\n\n                mask = result_masks if len(result_masks) > 1 else result_masks[0]\n\n        elif method == '__call__':\n            # Regular ufunc call.\n            mask = self._combine_masks(masks, out=out_mask)\n\n        elif method == 'outer':\n            # Must have two arguments; adjust masks as will be done for data.\n            assert len(masks) == 2\n            masks = [(m if m is not None else False) for m in masks]\n            mask = np.logical_or.outer(masks[0], masks[1], out=out_mask)\n\n        elif method in {'reduce', 'accumulate'}:\n            # Reductions like np.add.reduce (sum).\n            if masks[0] is not None:\n                # By default, we simply propagate masks, since for\n                # things like np.sum, it makes no sense to do otherwise.\n                # Individual methods need to override as needed.\n                # TODO: take care of 'out' too?\n                if method == 'reduce':\n                    axis = kwargs.get('axis', None)\n                    keepdims = kwargs.get('keepdims', False)\n                    where = kwargs.get('where', True)\n                    mask = np.logical_or.reduce(masks[0], where=where,\n                                                axis=axis, keepdims=keepdims,\n                                                out=out_mask)\n                    if where is not True:\n                        # Mask also whole rows that were not selected by where,\n                        # so would have been left as unmasked above.\n                        mask |= np.logical_and.reduce(masks[0], where=where,\n                                                      axis=axis, keepdims=keepdims)\n\n                else:\n                    # Accumulate\n                    axis = kwargs.get('axis', 0)\n                    mask = np.logical_or.accumulate(masks[0], axis=axis,\n                                                    out=out_mask)\n\n            elif out is not None:\n                mask = False\n\n            else:  # pragma: no cover\n                # Can only get here if neither input nor output was masked, but\n                # perhaps axis or where was masked (in numpy < 1.21 this is\n                # possible).  We don't support this.\n                return NotImplemented\n\n        elif method in {'reduceat', 'at'}:  # pragma: no cover\n            # TODO: implement things like np.add.accumulate (used for cumsum).\n            raise NotImplementedError(\"masked instances cannot yet deal with \"\n                                      \"'reduceat' or 'at'.\")\n\n        if out_unmasked is not None:\n            kwargs['out'] = out_unmasked\n        result = getattr(ufunc, method)(*unmasked, **kwargs)\n\n        if result is None:  # pragma: no cover\n            # This happens for the \"at\" method.\n            return result\n\n        if out is not None and len(out) == 1:\n            out = out[0]\n        return self._masked_result(result, mask, out)"},{"col":4,"comment":"Substitute IERS B values with those from a real IERS B table.\n\n        IERS-A has IERS-B values included, but for reasons unknown these\n        do not match the latest IERS-B values (see comments in #4436).\n        Here, we use the bundled astropy IERS-B table to overwrite the values\n        in the downloaded IERS-A table.\n        ","endLoc":821,"header":"@classmethod\n    def _substitute_iers_b(cls, table)","id":11297,"name":"_substitute_iers_b","nodeType":"Function","startLoc":792,"text":"@classmethod\n    def _substitute_iers_b(cls, table):\n        \"\"\"Substitute IERS B values with those from a real IERS B table.\n\n        IERS-A has IERS-B values included, but for reasons unknown these\n        do not match the latest IERS-B values (see comments in #4436).\n        Here, we use the bundled astropy IERS-B table to overwrite the values\n        in the downloaded IERS-A table.\n        \"\"\"\n        iers_b = IERS_B.open()\n        # Substitute IERS-B values for existing B values in IERS-A table\n        mjd_b = table['MJD'][np.isfinite(table['UT1_UTC_B'])]\n        i0 = np.searchsorted(iers_b['MJD'], mjd_b[0], side='left')\n        i1 = np.searchsorted(iers_b['MJD'], mjd_b[-1], side='right')\n        iers_b = iers_b[i0:i1]\n        n_iers_b = len(iers_b)\n        # If there is overlap then replace IERS-A values from available IERS-B\n        if n_iers_b > 0:\n            # Sanity check that we are overwriting the correct values\n            if not u.allclose(table['MJD'][:n_iers_b], iers_b['MJD']):\n                raise ValueError('unexpected mismatch when copying '\n                                 'IERS-B values into IERS-A table.')\n            # Finally do the overwrite\n            table['UT1_UTC_B'][:n_iers_b] = iers_b['UT1_UTC']\n            table['PM_X_B'][:n_iers_b] = iers_b['PM_x']\n            table['PM_Y_B'][:n_iers_b] = iers_b['PM_y']\n            table['dX_2000A_B'][:n_iers_b] = iers_b['dX_2000A']\n            table['dY_2000A_B'][:n_iers_b] = iers_b['dY_2000A']\n\n        return table"},{"attributeType":"null","col":12,"comment":"null","endLoc":295,"id":11298,"name":"aliases","nodeType":"Attribute","startLoc":295,"text":"self.aliases"},{"attributeType":"null","col":8,"comment":"null","endLoc":263,"id":11299,"name":"module","nodeType":"Attribute","startLoc":263,"text":"self.module"},{"attributeType":"None","col":8,"comment":"null","endLoc":285,"id":11300,"name":"cfgtype","nodeType":"Attribute","startLoc":285,"text":"self.cfgtype"},{"attributeType":"None","col":4,"comment":"null","endLoc":643,"id":11301,"name":"iers_table","nodeType":"Attribute","startLoc":643,"text":"iers_table"},{"attributeType":"IERS_B","col":12,"comment":"null","endLoc":669,"id":11302,"name":"iers_table","nodeType":"Attribute","startLoc":669,"text":"cls.iers_table"},{"className":"earth_orientation_table","col":0,"comment":"Default IERS table for Earth rotation and reference systems service.\n\n    These tables are used to calculate the offsets between ``UT1`` and ``UTC``\n    and for conversion to Earth-based coordinate systems.\n\n    The state itself is an IERS table, as an instance of one of the\n    `~astropy.utils.iers.IERS` classes.  The default, the auto-updating\n    `~astropy.utils.iers.IERS_Auto` class, should suffice for most\n    purposes.\n\n    Examples\n    --------\n    To temporarily use the IERS-B file packaged with astropy::\n\n      >>> from astropy.utils import iers\n      >>> from astropy.time import Time\n      >>> iers_b = iers.IERS_B.open(iers.IERS_B_FILE)\n      >>> with iers.earth_orientation_table.set(iers_b):\n      ...     print(Time('2000-01-01').ut1.isot)\n      2000-01-01T00:00:00.355\n\n    To use the most recent IERS-A file for the whole session::\n\n      >>> iers_a = iers.IERS_A.open(iers.IERS_A_URL)  # doctest: +SKIP\n      >>> iers.earth_orientation_table.set(iers_a)  # doctest: +SKIP\n      <ScienceState earth_orientation_table: <IERS_A length=17463>...>\n\n    To go back to the default (of `~astropy.utils.iers.IERS_Auto`)::\n\n      >>> iers.earth_orientation_table.set(None)  # doctest: +SKIP\n      <ScienceState earth_orientation_table: <IERS_Auto length=17428>...>\n    ","endLoc":865,"id":11303,"nodeType":"Class","startLoc":824,"text":"class earth_orientation_table(ScienceState):\n    \"\"\"Default IERS table for Earth rotation and reference systems service.\n\n    These tables are used to calculate the offsets between ``UT1`` and ``UTC``\n    and for conversion to Earth-based coordinate systems.\n\n    The state itself is an IERS table, as an instance of one of the\n    `~astropy.utils.iers.IERS` classes.  The default, the auto-updating\n    `~astropy.utils.iers.IERS_Auto` class, should suffice for most\n    purposes.\n\n    Examples\n    --------\n    To temporarily use the IERS-B file packaged with astropy::\n\n      >>> from astropy.utils import iers\n      >>> from astropy.time import Time\n      >>> iers_b = iers.IERS_B.open(iers.IERS_B_FILE)\n      >>> with iers.earth_orientation_table.set(iers_b):\n      ...     print(Time('2000-01-01').ut1.isot)\n      2000-01-01T00:00:00.355\n\n    To use the most recent IERS-A file for the whole session::\n\n      >>> iers_a = iers.IERS_A.open(iers.IERS_A_URL)  # doctest: +SKIP\n      >>> iers.earth_orientation_table.set(iers_a)  # doctest: +SKIP\n      <ScienceState earth_orientation_table: <IERS_A length=17463>...>\n\n    To go back to the default (of `~astropy.utils.iers.IERS_Auto`)::\n\n      >>> iers.earth_orientation_table.set(None)  # doctest: +SKIP\n      <ScienceState earth_orientation_table: <IERS_Auto length=17428>...>\n    \"\"\"\n    _value = None\n\n    @classmethod\n    def validate(cls, value):\n        if value is None:\n            value = IERS_Auto.open()\n        if not isinstance(value, IERS):\n            raise ValueError(\"earth_orientation_table requires an IERS Table.\")\n        return value"},{"col":4,"comment":"null","endLoc":865,"header":"@classmethod\n    def validate(cls, value)","id":11304,"name":"validate","nodeType":"Function","startLoc":859,"text":"@classmethod\n    def validate(cls, value):\n        if value is None:\n            value = IERS_Auto.open()\n        if not isinstance(value, IERS):\n            raise ValueError(\"earth_orientation_table requires an IERS Table.\")\n        return value"},{"attributeType":"None","col":4,"comment":"null","endLoc":857,"id":11305,"name":"_value","nodeType":"Attribute","startLoc":857,"text":"_value"},{"className":"LeapSeconds","col":0,"comment":"Leap seconds class, holding TAI-UTC differences.\n\n    The table should hold columns 'year', 'month', 'tai_utc'.\n\n    Methods are provided to initialize the table from IERS ``Leap_Second.dat``,\n    IETF/ntp ``leap-seconds.list``, or built-in ERFA/SOFA, and to update the\n    list used by ERFA.\n\n    Notes\n    -----\n    Astropy has a built-in ``iers.IERS_LEAP_SECONDS_FILE``. Up to date versions\n    can be downloaded from ``iers.IERS_LEAP_SECONDS_URL`` or\n    ``iers.LEAP_SECONDS_LIST_URL``.  Many systems also store a version\n    of ``leap-seconds.list`` for use with ``ntp`` (e.g., on Debian/Ubuntu\n    systems, ``/usr/share/zoneinfo/leap-seconds.list``).\n\n    To prevent querying internet resources if the available local leap second\n    file(s) are out of date, set ``iers.conf.auto_download = False``. This\n    must be done prior to performing any ``Time`` scale transformations related\n    to UTC (e.g. converting from UTC to TAI).\n    ","endLoc":1181,"id":11306,"nodeType":"Class","startLoc":868,"text":"class LeapSeconds(QTable):\n    \"\"\"Leap seconds class, holding TAI-UTC differences.\n\n    The table should hold columns 'year', 'month', 'tai_utc'.\n\n    Methods are provided to initialize the table from IERS ``Leap_Second.dat``,\n    IETF/ntp ``leap-seconds.list``, or built-in ERFA/SOFA, and to update the\n    list used by ERFA.\n\n    Notes\n    -----\n    Astropy has a built-in ``iers.IERS_LEAP_SECONDS_FILE``. Up to date versions\n    can be downloaded from ``iers.IERS_LEAP_SECONDS_URL`` or\n    ``iers.LEAP_SECONDS_LIST_URL``.  Many systems also store a version\n    of ``leap-seconds.list`` for use with ``ntp`` (e.g., on Debian/Ubuntu\n    systems, ``/usr/share/zoneinfo/leap-seconds.list``).\n\n    To prevent querying internet resources if the available local leap second\n    file(s) are out of date, set ``iers.conf.auto_download = False``. This\n    must be done prior to performing any ``Time`` scale transformations related\n    to UTC (e.g. converting from UTC to TAI).\n    \"\"\"\n    # Note: Time instances in this class should use scale='tai' to avoid\n    # needing leap seconds in their creation or interpretation.\n\n    _re_expires = re.compile(r'^#.*File expires on[:\\s]+(\\d+\\s\\w+\\s\\d+)\\s*$')\n    _expires = None\n    _auto_open_files = ['erfa',\n                        IERS_LEAP_SECOND_FILE,\n                        'system_leap_second_file',\n                        'iers_leap_second_auto_url',\n                        'ietf_leap_second_auto_url']\n    \"\"\"Files or conf attributes to try in auto_open.\"\"\"\n\n    @classmethod\n    def open(cls, file=None, cache=False):\n        \"\"\"Open a leap-second list.\n\n        Parameters\n        ----------\n        file : path-like or None\n            Full local or network path to the file holding leap-second data,\n            for passing on to the various ``from_`` class methods.\n            If 'erfa', return the data used by the ERFA library.\n            If `None`, use default locations from file and configuration to\n            find a table that is not expired.\n        cache : bool\n            Whether to use cache. Defaults to False, since leap-second files\n            are regularly updated.\n\n        Returns\n        -------\n        leap_seconds : `~astropy.utils.iers.LeapSeconds`\n            Table with 'year', 'month', and 'tai_utc' columns, plus possibly\n            others.\n\n        Notes\n        -----\n        Bulletin C is released about 10 days after a possible leap second is\n        introduced, i.e., mid-January or mid-July.  Expiration days are thus\n        generally at least 150 days after the present.  For the auto-loading,\n        a list comprised of the table shipped with astropy, and files and\n        URLs in `~astropy.utils.iers.Conf` are tried, returning the first\n        that is sufficiently new, or the newest among them all.\n        \"\"\"\n        if file is None:\n            return cls.auto_open()\n\n        if file.lower() == 'erfa':\n            return cls.from_erfa()\n\n        if urlparse(file).netloc:\n            file = download_file(file, cache=cache)\n\n        # Just try both reading methods.\n        try:\n            return cls.from_iers_leap_seconds(file)\n        except Exception:\n            return cls.from_leap_seconds_list(file)\n\n    @staticmethod\n    def _today():\n        # Get current day in scale='tai' without going through a scale change\n        # (so we do not need leap seconds).\n        s = '{0.year:04d}-{0.month:02d}-{0.day:02d}'.format(datetime.utcnow())\n        return Time(s, scale='tai', format='iso', out_subfmt='date')\n\n    @classmethod\n    def auto_open(cls, files=None):\n        \"\"\"Attempt to get an up-to-date leap-second list.\n\n        The routine will try the files in sequence until it finds one\n        whose expiration date is \"good enough\" (see below).  If none\n        are good enough, it returns the one with the most recent expiration\n        date, warning if that file is expired.\n\n        For remote files that are cached already, the cached file is tried\n        first before attempting to retrieve it again.\n\n        Parameters\n        ----------\n        files : list of path-like, optional\n            List of files/URLs to attempt to open.  By default, uses\n            ``cls._auto_open_files``.\n\n        Returns\n        -------\n        leap_seconds : `~astropy.utils.iers.LeapSeconds`\n            Up to date leap-second table\n\n        Notes\n        -----\n        Bulletin C is released about 10 days after a possible leap second is\n        introduced, i.e., mid-January or mid-July.  Expiration days are thus\n        generally at least 150 days after the present.  We look for a file\n        that expires more than 180 - `~astropy.utils.iers.Conf.auto_max_age`\n        after the present.\n        \"\"\"\n        offset = 180 - (30 if conf.auto_max_age is None else conf.auto_max_age)\n        good_enough = cls._today() + TimeDelta(offset, format='jd')\n\n        if files is None:\n            # Basic files to go over (entries in _auto_open_files can be\n            # configuration items, which we want to be sure are up to date).\n            files = [getattr(conf, f, f) for f in cls._auto_open_files]\n\n        # Remove empty entries.\n        files = [f for f in files if f]\n\n        # Our trials start with normal files and remote ones that are\n        # already in cache.  The bools here indicate that the cache\n        # should be used.\n        trials = [(f, True) for f in files\n                  if not urlparse(f).netloc or is_url_in_cache(f)]\n        # If we are allowed to download, we try downloading new versions\n        # if none of the above worked.\n        if conf.auto_download:\n            trials += [(f, False) for f in files if urlparse(f).netloc]\n\n        self = None\n        err_list = []\n        # Go through all entries, and return the first one that\n        # is not expired, or the most up to date one.\n        for f, allow_cache in trials:\n            if not allow_cache:\n                clear_download_cache(f)\n\n            try:\n                trial = cls.open(f, cache=True)\n            except Exception as exc:\n                err_list.append(exc)\n                continue\n\n            if self is None or trial.expires > self.expires:\n                self = trial\n                self.meta['data_url'] = str(f)\n                if self.expires > good_enough:\n                    break\n\n        if self is None:\n            raise ValueError('none of the files could be read. The '\n                             'following errors were raised:\\n' + str(err_list))\n\n        if self.expires < self._today() and conf.auto_max_age is not None:\n            warn('leap-second file is expired.', IERSStaleWarning)\n\n        return self\n\n    @property\n    def expires(self):\n        \"\"\"The limit of validity of the table.\"\"\"\n        return self._expires\n\n    @classmethod\n    def _read_leap_seconds(cls, file, **kwargs):\n        \"\"\"Read a file, identifying expiration by matching 'File expires'\"\"\"\n        expires = None\n        # Find expiration date.\n        with get_readable_fileobj(file) as fh:\n            lines = fh.readlines()\n            for line in lines:\n                match = cls._re_expires.match(line)\n                if match:\n                    day, month, year = match.groups()[0].split()\n                    month_nb = MONTH_ABBR.index(month[:3]) + 1\n                    expires = Time(f'{year}-{month_nb:02d}-{day}',\n                                   scale='tai', out_subfmt='date')\n                    break\n            else:\n                raise ValueError(f'did not find expiration date in {file}')\n\n        self = cls.read(lines, format='ascii.no_header', **kwargs)\n        self._expires = expires\n        return self\n\n    @classmethod\n    def from_iers_leap_seconds(cls, file=IERS_LEAP_SECOND_FILE):\n        \"\"\"Create a table from a file like the IERS ``Leap_Second.dat``.\n\n        Parameters\n        ----------\n        file : path-like, optional\n            Full local or network path to the file holding leap-second data\n            in a format consistent with that used by IERS.  By default, uses\n            ``iers.IERS_LEAP_SECOND_FILE``.\n\n        Notes\n        -----\n        The file *must* contain the expiration date in a comment line, like\n        '#  File expires on 28 June 2020'\n        \"\"\"\n        return cls._read_leap_seconds(\n            file, names=['mjd', 'day', 'month', 'year', 'tai_utc'])\n\n    @classmethod\n    def from_leap_seconds_list(cls, file):\n        \"\"\"Create a table from a file like the IETF ``leap-seconds.list``.\n\n        Parameters\n        ----------\n        file : path-like, optional\n            Full local or network path to the file holding leap-second data\n            in a format consistent with that used by IETF.  Up to date versions\n            can be retrieved from ``iers.IETF_LEAP_SECOND_URL``.\n\n        Notes\n        -----\n        The file *must* contain the expiration date in a comment line, like\n        '# File expires on:  28 June 2020'\n        \"\"\"\n        from astropy.io.ascii import convert_numpy  # Here to avoid circular import\n\n        names = ['ntp_seconds', 'tai_utc', 'comment', 'day', 'month', 'year']\n        # Note: ntp_seconds does not fit in 32 bit, so causes problems on\n        # 32-bit systems without the np.int64 converter.\n        self = cls._read_leap_seconds(\n            file, names=names, include_names=names[:2],\n            converters={'ntp_seconds': [convert_numpy(np.int64)]})\n        self['mjd'] = (self['ntp_seconds']/86400 + 15020).round()\n        # Note: cannot use Time.ymdhms, since that might require leap seconds.\n        isot = Time(self['mjd'], format='mjd', scale='tai').isot\n        ymd = np.array([[int(part) for part in t.partition('T')[0].split('-')]\n                        for t in isot])\n        self['year'], self['month'], self['day'] = ymd.T\n        return self\n\n    @classmethod\n    def from_erfa(cls, built_in=False):\n        \"\"\"Create table from the leap-second list in ERFA.\n\n        Parameters\n        ----------\n        built_in : bool\n            If `False` (default), retrieve the list currently used by ERFA,\n            which may have been updated.  If `True`, retrieve the list shipped\n            with erfa.\n        \"\"\"\n        current = cls(erfa.leap_seconds.get())\n        current._expires = Time('{0.year:04d}-{0.month:02d}-{0.day:02d}'\n                                .format(erfa.leap_seconds.expires),\n                                scale='tai')\n        if not built_in:\n            return current\n\n        try:\n            erfa.leap_seconds.set(None)  # reset to defaults\n            return cls.from_erfa(built_in=False)\n        finally:\n            erfa.leap_seconds.set(current)\n\n    def update_erfa_leap_seconds(self, initialize_erfa=False):\n        \"\"\"Add any leap seconds not already present to the ERFA table.\n\n        This method matches leap seconds with those present in the ERFA table,\n        and extends the latter as necessary.\n\n        Parameters\n        ----------\n        initialize_erfa : bool, or 'only', or 'empty'\n            Initialize the ERFA leap second table to its built-in value before\n            trying to expand it.  This is generally not needed but can help\n            in case it somehow got corrupted.  If equal to 'only', the ERFA\n            table is reinitialized and no attempt it made to update it.\n            If 'empty', the leap second table is emptied before updating, i.e.,\n            it is overwritten altogether (note that this may break things in\n            surprising ways, as most leap second tables do not include pre-1970\n            pseudo leap-seconds; you were warned).\n\n        Returns\n        -------\n        n_update : int\n            Number of items updated.\n\n        Raises\n        ------\n        ValueError\n            If the leap seconds in the table are not on 1st of January or July,\n            or if the matches are inconsistent.  This would normally suggest\n            a corrupted leap second table, but might also indicate that the\n            ERFA table was corrupted.  If needed, the ERFA table can be reset\n            by calling this method with an appropriate value for\n            ``initialize_erfa``.\n        \"\"\"\n        if initialize_erfa == 'empty':\n            # Initialize to empty and update is the same as overwrite.\n            erfa.leap_seconds.set(self)\n            return len(self)\n\n        if initialize_erfa:\n            erfa.leap_seconds.set()\n            if initialize_erfa == 'only':\n                return 0\n\n        return erfa.leap_seconds.update(self)"},{"col":4,"comment":"The limit of validity of the table.","endLoc":1039,"header":"@property\n    def expires(self)","id":11307,"name":"expires","nodeType":"Function","startLoc":1036,"text":"@property\n    def expires(self):\n        \"\"\"The limit of validity of the table.\"\"\"\n        return self._expires"},{"col":4,"comment":"Add any leap seconds not already present to the ERFA table.\n\n        This method matches leap seconds with those present in the ERFA table,\n        and extends the latter as necessary.\n\n        Parameters\n        ----------\n        initialize_erfa : bool, or 'only', or 'empty'\n            Initialize the ERFA leap second table to its built-in value before\n            trying to expand it.  This is generally not needed but can help\n            in case it somehow got corrupted.  If equal to 'only', the ERFA\n            table is reinitialized and no attempt it made to update it.\n            If 'empty', the leap second table is emptied before updating, i.e.,\n            it is overwritten altogether (note that this may break things in\n            surprising ways, as most leap second tables do not include pre-1970\n            pseudo leap-seconds; you were warned).\n\n        Returns\n        -------\n        n_update : int\n            Number of items updated.\n\n        Raises\n        ------\n        ValueError\n            If the leap seconds in the table are not on 1st of January or July,\n            or if the matches are inconsistent.  This would normally suggest\n            a corrupted leap second table, but might also indicate that the\n            ERFA table was corrupted.  If needed, the ERFA table can be reset\n            by calling this method with an appropriate value for\n            ``initialize_erfa``.\n        ","endLoc":1181,"header":"def update_erfa_leap_seconds(self, initialize_erfa=False)","id":11308,"name":"update_erfa_leap_seconds","nodeType":"Function","startLoc":1138,"text":"def update_erfa_leap_seconds(self, initialize_erfa=False):\n        \"\"\"Add any leap seconds not already present to the ERFA table.\n\n        This method matches leap seconds with those present in the ERFA table,\n        and extends the latter as necessary.\n\n        Parameters\n        ----------\n        initialize_erfa : bool, or 'only', or 'empty'\n            Initialize the ERFA leap second table to its built-in value before\n            trying to expand it.  This is generally not needed but can help\n            in case it somehow got corrupted.  If equal to 'only', the ERFA\n            table is reinitialized and no attempt it made to update it.\n            If 'empty', the leap second table is emptied before updating, i.e.,\n            it is overwritten altogether (note that this may break things in\n            surprising ways, as most leap second tables do not include pre-1970\n            pseudo leap-seconds; you were warned).\n\n        Returns\n        -------\n        n_update : int\n            Number of items updated.\n\n        Raises\n        ------\n        ValueError\n            If the leap seconds in the table are not on 1st of January or July,\n            or if the matches are inconsistent.  This would normally suggest\n            a corrupted leap second table, but might also indicate that the\n            ERFA table was corrupted.  If needed, the ERFA table can be reset\n            by calling this method with an appropriate value for\n            ``initialize_erfa``.\n        \"\"\"\n        if initialize_erfa == 'empty':\n            # Initialize to empty and update is the same as overwrite.\n            erfa.leap_seconds.set(self)\n            return len(self)\n\n        if initialize_erfa:\n            erfa.leap_seconds.set()\n            if initialize_erfa == 'only':\n                return 0\n\n        return erfa.leap_seconds.update(self)"},{"attributeType":"null","col":8,"comment":"null","endLoc":264,"id":11309,"name":"description","nodeType":"Attribute","startLoc":264,"text":"self.description"},{"attributeType":"null","col":4,"comment":"null","endLoc":893,"id":11310,"name":"_re_expires","nodeType":"Attribute","startLoc":893,"text":"_re_expires"},{"attributeType":"None","col":4,"comment":"null","endLoc":894,"id":11311,"name":"_expires","nodeType":"Attribute","startLoc":894,"text":"_expires"},{"attributeType":"null","col":4,"comment":"Files or conf attributes to try in auto_open.","endLoc":895,"id":11312,"name":"_auto_open_files","nodeType":"Attribute","startLoc":895,"text":"_auto_open_files"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":11313,"name":"__all__","nodeType":"Attribute","startLoc":30,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":41,"id":11314,"name":"IERS_A_FILE","nodeType":"Attribute","startLoc":41,"text":"IERS_A_FILE"},{"attributeType":"null","col":0,"comment":"null","endLoc":42,"id":11315,"name":"IERS_A_URL","nodeType":"Attribute","startLoc":42,"text":"IERS_A_URL"},{"attributeType":"null","col":0,"comment":"null","endLoc":43,"id":11316,"name":"IERS_A_URL_MIRROR","nodeType":"Attribute","startLoc":43,"text":"IERS_A_URL_MIRROR"},{"attributeType":"null","col":0,"comment":"null","endLoc":44,"id":11317,"name":"IERS_A_README","nodeType":"Attribute","startLoc":44,"text":"IERS_A_README"},{"attributeType":"null","col":0,"comment":"null","endLoc":47,"id":11318,"name":"IERS_B_FILE","nodeType":"Attribute","startLoc":47,"text":"IERS_B_FILE"},{"attributeType":"null","col":0,"comment":"null","endLoc":48,"id":11319,"name":"IERS_B_URL","nodeType":"Attribute","startLoc":48,"text":"IERS_B_URL"},{"attributeType":"null","col":0,"comment":"null","endLoc":49,"id":11320,"name":"IERS_B_README","nodeType":"Attribute","startLoc":49,"text":"IERS_B_README"},{"col":0,"comment":"One-dimensional linear interpolation.\n\n    Like `numpy.interp`, but any masked points in ``xp`` and ``fp``\n    are ignored.  Any masked values in ``x`` will still be evaluated,\n    but masked on output.\n    ","endLoc":796,"header":"@dispatched_function\ndef interp(x, xp, fp, *args, **kwargs)","id":11321,"name":"interp","nodeType":"Function","startLoc":777,"text":"@dispatched_function\ndef interp(x, xp, fp, *args, **kwargs):\n    \"\"\"One-dimensional linear interpolation.\n\n    Like `numpy.interp`, but any masked points in ``xp`` and ``fp``\n    are ignored.  Any masked values in ``x`` will still be evaluated,\n    but masked on output.\n    \"\"\"\n    from astropy.utils.masked import Masked\n    xd, xm = Masked._get_data_and_mask(x)\n    if isinstance(xp, Masked) or isinstance(fp, Masked):\n        (xp, fp), (xpm, fpm) = _get_data_and_masks(xp, fp)\n        if xp.ndim == fp.ndim == 1:\n            # Avoid making arrays 1-D; will just raise below.\n            m = xpm | fpm\n            xp = xp[m]\n            fp = fp[m]\n\n    result = np.interp(xd, xp, fp, *args, **kwargs)\n    return result if xm is None else Masked(result, xm.copy())"},{"attributeType":"null","col":0,"comment":"null","endLoc":52,"id":11322,"name":"IERS_LEAP_SECOND_FILE","nodeType":"Attribute","startLoc":52,"text":"IERS_LEAP_SECOND_FILE"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":11323,"name":"IERS_LEAP_SECOND_URL","nodeType":"Attribute","startLoc":53,"text":"IERS_LEAP_SECOND_URL"},{"attributeType":"null","col":0,"comment":"null","endLoc":54,"id":11324,"name":"IETF_LEAP_SECOND_URL","nodeType":"Attribute","startLoc":54,"text":"IETF_LEAP_SECOND_URL"},{"attributeType":"null","col":0,"comment":"null","endLoc":57,"id":11325,"name":"FROM_IERS_B","nodeType":"Attribute","startLoc":57,"text":"FROM_IERS_B"},{"attributeType":"null","col":0,"comment":"null","endLoc":58,"id":11326,"name":"FROM_IERS_A","nodeType":"Attribute","startLoc":58,"text":"FROM_IERS_A"},{"attributeType":"null","col":0,"comment":"null","endLoc":59,"id":11327,"name":"FROM_IERS_A_PREDICTION","nodeType":"Attribute","startLoc":59,"text":"FROM_IERS_A_PREDICTION"},{"attributeType":"null","col":0,"comment":"null","endLoc":60,"id":11328,"name":"TIME_BEFORE_IERS_RANGE","nodeType":"Attribute","startLoc":60,"text":"TIME_BEFORE_IERS_RANGE"},{"attributeType":"null","col":0,"comment":"null","endLoc":61,"id":11329,"name":"TIME_BEYOND_IERS_RANGE","nodeType":"Attribute","startLoc":61,"text":"TIME_BEYOND_IERS_RANGE"},{"attributeType":"null","col":0,"comment":"null","endLoc":63,"id":11330,"name":"MJD_ZERO","nodeType":"Attribute","startLoc":63,"text":"MJD_ZERO"},{"attributeType":"null","col":0,"comment":"null","endLoc":65,"id":11331,"name":"INTERPOLATE_ERROR","nodeType":"Attribute","startLoc":65,"text":"INTERPOLATE_ERROR"},{"attributeType":"null","col":0,"comment":"null","endLoc":79,"id":11332,"name":"MONTH_ABBR","nodeType":"Attribute","startLoc":79,"text":"MONTH_ABBR"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":146,"id":11333,"name":"conf","nodeType":"Attribute","startLoc":146,"text":"conf"},{"col":0,"comment":"","endLoc":10,"header":"iers.py#<anonymous>","id":11334,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThe astropy.utils.iers package provides access to the tables provided by\nthe International Earth Rotation and Reference Systems Service, in\nparticular allowing interpolation of published UT1-UTC values for given\ntimes.  These are used in `astropy.time` to provide UT1 values.  The polar\nmotions are also used for determining earth orientation for\ncelestial-to-terrestrial coordinate transformations\n(in `astropy.coordinates`).\n\"\"\"\n\n__all__ = ['Conf', 'conf', 'earth_orientation_table',\n           'IERS', 'IERS_B', 'IERS_A', 'IERS_Auto',\n           'FROM_IERS_B', 'FROM_IERS_A', 'FROM_IERS_A_PREDICTION',\n           'TIME_BEFORE_IERS_RANGE', 'TIME_BEYOND_IERS_RANGE',\n           'IERS_A_FILE', 'IERS_A_URL', 'IERS_A_URL_MIRROR', 'IERS_A_README',\n           'IERS_B_FILE', 'IERS_B_URL', 'IERS_B_README',\n           'IERSRangeError', 'IERSStaleWarning',\n           'LeapSeconds', 'IERS_LEAP_SECOND_FILE', 'IERS_LEAP_SECOND_URL',\n           'IETF_LEAP_SECOND_URL']\n\nIERS_A_FILE = 'finals2000A.all'\n\nIERS_A_URL = 'ftp://anonymous:mail%40astropy.org@gdc.cddis.eosdis.nasa.gov/pub/products/iers/finals2000A.all'  # noqa: E501\n\nIERS_A_URL_MIRROR = 'https://datacenter.iers.org/data/9/finals2000A.all'\n\nIERS_A_README = get_pkg_data_filename('data/ReadMe.finals2000A')\n\nIERS_B_FILE = get_pkg_data_filename('data/eopc04_IAU2000.62-now')\n\nIERS_B_URL = 'http://hpiers.obspm.fr/iers/eop/eopc04/eopc04_IAU2000.62-now'\n\nIERS_B_README = get_pkg_data_filename('data/ReadMe.eopc04_IAU2000')\n\nIERS_LEAP_SECOND_FILE = get_pkg_data_filename('data/Leap_Second.dat')\n\nIERS_LEAP_SECOND_URL = 'https://hpiers.obspm.fr/iers/bul/bulc/Leap_Second.dat'\n\nIETF_LEAP_SECOND_URL = 'https://www.ietf.org/timezones/data/leap-seconds.list'\n\nFROM_IERS_B = 0\n\nFROM_IERS_A = 1\n\nFROM_IERS_A_PREDICTION = 2\n\nTIME_BEFORE_IERS_RANGE = -1\n\nTIME_BEYOND_IERS_RANGE = -2\n\nMJD_ZERO = 2400000.5\n\nINTERPOLATE_ERROR = \"\"\"\\\ninterpolating from IERS_Auto using predictive values that are more\nthan {0} days old.\n\nNormally you should not see this error because this class\nautomatically downloads the latest IERS-A table.  Perhaps you are\noffline?  If you understand what you are doing then this error can be\nsuppressed by setting the auto_max_age configuration variable to\n``None``:\n\n  from astropy.utils.iers import conf\n  conf.auto_max_age = None\n\"\"\"\n\nMONTH_ABBR = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug',\n              'Sep', 'Oct', 'Nov', 'Dec']\n\nconf = Conf()"},{"col":0,"comment":"null","endLoc":155,"header":"def format_stack_entry(r)","id":11335,"name":"format_stack_entry","nodeType":"Function","startLoc":148,"text":"def format_stack_entry(r):\n    repr_str = repr(r)\n    if '\\n' in repr_str:\n        repr_str = repr(repr_str)\n    if len(repr_str) < 16:\n        return repr_str\n    else:\n        return '<%s @ 0x%x>' % (type(r).__name__, id(r))"},{"fileName":"lex.py","filePath":"astropy/extern/ply","id":11336,"nodeType":"File","text":"# -----------------------------------------------------------------------------\n# ply: lex.py\n#\n# Copyright (C) 2001-2018\n# David M. Beazley (Dabeaz LLC)\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# * Redistributions of source code must retain the above copyright notice,\n#   this list of conditions and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright notice,\n#   this list of conditions and the following disclaimer in the documentation\n#   and/or other materials provided with the distribution.\n# * Neither the name of the David Beazley or Dabeaz LLC may be used to\n#   endorse or promote products derived from this software without\n#  specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n# -----------------------------------------------------------------------------\n\n__version__    = '3.11'\n__tabversion__ = '3.10'\n\nimport re\nimport sys\nimport types\nimport copy\nimport os\nimport inspect\n\n# This tuple contains known string types\ntry:\n    # Python 2.6\n    StringTypes = (types.StringType, types.UnicodeType)\nexcept AttributeError:\n    # Python 3.0\n    StringTypes = (str, bytes)\n\n# This regular expression is used to match valid token names\n_is_identifier = re.compile(r'^[a-zA-Z0-9_]+$')\n\n# Exception thrown when invalid token encountered and no default error\n# handler is defined.\nclass LexError(Exception):\n    def __init__(self, message, s):\n        self.args = (message,)\n        self.text = s\n\n\n# Token class.  This class is used to represent the tokens produced.\nclass LexToken(object):\n    def __str__(self):\n        return 'LexToken(%s,%r,%d,%d)' % (self.type, self.value, self.lineno, self.lexpos)\n\n    def __repr__(self):\n        return str(self)\n\n\n# This object is a stand-in for a logging object created by the\n# logging module.\n\nclass PlyLogger(object):\n    def __init__(self, f):\n        self.f = f\n\n    def critical(self, msg, *args, **kwargs):\n        self.f.write((msg % args) + '\\n')\n\n    def warning(self, msg, *args, **kwargs):\n        self.f.write('WARNING: ' + (msg % args) + '\\n')\n\n    def error(self, msg, *args, **kwargs):\n        self.f.write('ERROR: ' + (msg % args) + '\\n')\n\n    info = critical\n    debug = critical\n\n\n# Null logger is used when no output is generated. Does nothing.\nclass NullLogger(object):\n    def __getattribute__(self, name):\n        return self\n\n    def __call__(self, *args, **kwargs):\n        return self\n\n\n# -----------------------------------------------------------------------------\n#                        === Lexing Engine ===\n#\n# The following Lexer class implements the lexer runtime.   There are only\n# a few public methods and attributes:\n#\n#    input()          -  Store a new string in the lexer\n#    token()          -  Get the next token\n#    clone()          -  Clone the lexer\n#\n#    lineno           -  Current line number\n#    lexpos           -  Current position in the input string\n# -----------------------------------------------------------------------------\n\nclass Lexer:\n    def __init__(self):\n        self.lexre = None             # Master regular expression. This is a list of\n                                      # tuples (re, findex) where re is a compiled\n                                      # regular expression and findex is a list\n                                      # mapping regex group numbers to rules\n        self.lexretext = None         # Current regular expression strings\n        self.lexstatere = {}          # Dictionary mapping lexer states to master regexs\n        self.lexstateretext = {}      # Dictionary mapping lexer states to regex strings\n        self.lexstaterenames = {}     # Dictionary mapping lexer states to symbol names\n        self.lexstate = 'INITIAL'     # Current lexer state\n        self.lexstatestack = []       # Stack of lexer states\n        self.lexstateinfo = None      # State information\n        self.lexstateignore = {}      # Dictionary of ignored characters for each state\n        self.lexstateerrorf = {}      # Dictionary of error functions for each state\n        self.lexstateeoff = {}        # Dictionary of eof functions for each state\n        self.lexreflags = 0           # Optional re compile flags\n        self.lexdata = None           # Actual input data (as a string)\n        self.lexpos = 0               # Current position in input text\n        self.lexlen = 0               # Length of the input text\n        self.lexerrorf = None         # Error rule (if any)\n        self.lexeoff = None           # EOF rule (if any)\n        self.lextokens = None         # List of valid tokens\n        self.lexignore = ''           # Ignored characters\n        self.lexliterals = ''         # Literal characters that can be passed through\n        self.lexmodule = None         # Module\n        self.lineno = 1               # Current line number\n        self.lexoptimize = False      # Optimized mode\n\n    def clone(self, object=None):\n        c = copy.copy(self)\n\n        # If the object parameter has been supplied, it means we are attaching the\n        # lexer to a new object.  In this case, we have to rebind all methods in\n        # the lexstatere and lexstateerrorf tables.\n\n        if object:\n            newtab = {}\n            for key, ritem in self.lexstatere.items():\n                newre = []\n                for cre, findex in ritem:\n                    newfindex = []\n                    for f in findex:\n                        if not f or not f[0]:\n                            newfindex.append(f)\n                            continue\n                        newfindex.append((getattr(object, f[0].__name__), f[1]))\n                newre.append((cre, newfindex))\n                newtab[key] = newre\n            c.lexstatere = newtab\n            c.lexstateerrorf = {}\n            for key, ef in self.lexstateerrorf.items():\n                c.lexstateerrorf[key] = getattr(object, ef.__name__)\n            c.lexmodule = object\n        return c\n\n    # ------------------------------------------------------------\n    # writetab() - Write lexer information to a table file\n    # ------------------------------------------------------------\n    def writetab(self, lextab, outputdir=''):\n        if isinstance(lextab, types.ModuleType):\n            raise IOError(\"Won't overwrite existing lextab module\")\n        basetabmodule = lextab.split('.')[-1]\n        filename = os.path.join(outputdir, basetabmodule) + '.py'\n        with open(filename, 'w') as tf:\n            tf.write('# %s.py. This file automatically created by PLY (version %s). Don\\'t edit!\\n' % (basetabmodule, __version__))\n            tf.write('_tabversion   = %s\\n' % repr(__tabversion__))\n            tf.write('_lextokens    = set(%s)\\n' % repr(tuple(sorted(self.lextokens))))\n            tf.write('_lexreflags   = %s\\n' % repr(int(self.lexreflags)))\n            tf.write('_lexliterals  = %s\\n' % repr(self.lexliterals))\n            tf.write('_lexstateinfo = %s\\n' % repr(self.lexstateinfo))\n\n            # Rewrite the lexstatere table, replacing function objects with function names\n            tabre = {}\n            for statename, lre in self.lexstatere.items():\n                titem = []\n                for (pat, func), retext, renames in zip(lre, self.lexstateretext[statename], self.lexstaterenames[statename]):\n                    titem.append((retext, _funcs_to_names(func, renames)))\n                tabre[statename] = titem\n\n            tf.write('_lexstatere   = %s\\n' % repr(tabre))\n            tf.write('_lexstateignore = %s\\n' % repr(self.lexstateignore))\n\n            taberr = {}\n            for statename, ef in self.lexstateerrorf.items():\n                taberr[statename] = ef.__name__ if ef else None\n            tf.write('_lexstateerrorf = %s\\n' % repr(taberr))\n\n            tabeof = {}\n            for statename, ef in self.lexstateeoff.items():\n                tabeof[statename] = ef.__name__ if ef else None\n            tf.write('_lexstateeoff = %s\\n' % repr(tabeof))\n\n    # ------------------------------------------------------------\n    # readtab() - Read lexer information from a tab file\n    # ------------------------------------------------------------\n    def readtab(self, tabfile, fdict):\n        if isinstance(tabfile, types.ModuleType):\n            lextab = tabfile\n        else:\n            exec('import %s' % tabfile)\n            lextab = sys.modules[tabfile]\n\n        if getattr(lextab, '_tabversion', '0.0') != __tabversion__:\n            raise ImportError('Inconsistent PLY version')\n\n        self.lextokens      = lextab._lextokens\n        self.lexreflags     = lextab._lexreflags\n        self.lexliterals    = lextab._lexliterals\n        self.lextokens_all  = self.lextokens | set(self.lexliterals)\n        self.lexstateinfo   = lextab._lexstateinfo\n        self.lexstateignore = lextab._lexstateignore\n        self.lexstatere     = {}\n        self.lexstateretext = {}\n        for statename, lre in lextab._lexstatere.items():\n            titem = []\n            txtitem = []\n            for pat, func_name in lre:\n                titem.append((re.compile(pat, lextab._lexreflags), _names_to_funcs(func_name, fdict)))\n\n            self.lexstatere[statename] = titem\n            self.lexstateretext[statename] = txtitem\n\n        self.lexstateerrorf = {}\n        for statename, ef in lextab._lexstateerrorf.items():\n            self.lexstateerrorf[statename] = fdict[ef]\n\n        self.lexstateeoff = {}\n        for statename, ef in lextab._lexstateeoff.items():\n            self.lexstateeoff[statename] = fdict[ef]\n\n        self.begin('INITIAL')\n\n    # ------------------------------------------------------------\n    # input() - Push a new string into the lexer\n    # ------------------------------------------------------------\n    def input(self, s):\n        # Pull off the first character to see if s looks like a string\n        c = s[:1]\n        if not isinstance(c, StringTypes):\n            raise ValueError('Expected a string')\n        self.lexdata = s\n        self.lexpos = 0\n        self.lexlen = len(s)\n\n    # ------------------------------------------------------------\n    # begin() - Changes the lexing state\n    # ------------------------------------------------------------\n    def begin(self, state):\n        if state not in self.lexstatere:\n            raise ValueError('Undefined state')\n        self.lexre = self.lexstatere[state]\n        self.lexretext = self.lexstateretext[state]\n        self.lexignore = self.lexstateignore.get(state, '')\n        self.lexerrorf = self.lexstateerrorf.get(state, None)\n        self.lexeoff = self.lexstateeoff.get(state, None)\n        self.lexstate = state\n\n    # ------------------------------------------------------------\n    # push_state() - Changes the lexing state and saves old on stack\n    # ------------------------------------------------------------\n    def push_state(self, state):\n        self.lexstatestack.append(self.lexstate)\n        self.begin(state)\n\n    # ------------------------------------------------------------\n    # pop_state() - Restores the previous state\n    # ------------------------------------------------------------\n    def pop_state(self):\n        self.begin(self.lexstatestack.pop())\n\n    # ------------------------------------------------------------\n    # current_state() - Returns the current lexing state\n    # ------------------------------------------------------------\n    def current_state(self):\n        return self.lexstate\n\n    # ------------------------------------------------------------\n    # skip() - Skip ahead n characters\n    # ------------------------------------------------------------\n    def skip(self, n):\n        self.lexpos += n\n\n    # ------------------------------------------------------------\n    # opttoken() - Return the next token from the Lexer\n    #\n    # Note: This function has been carefully implemented to be as fast\n    # as possible.  Don't make changes unless you really know what\n    # you are doing\n    # ------------------------------------------------------------\n    def token(self):\n        # Make local copies of frequently referenced attributes\n        lexpos    = self.lexpos\n        lexlen    = self.lexlen\n        lexignore = self.lexignore\n        lexdata   = self.lexdata\n\n        while lexpos < lexlen:\n            # This code provides some short-circuit code for whitespace, tabs, and other ignored characters\n            if lexdata[lexpos] in lexignore:\n                lexpos += 1\n                continue\n\n            # Look for a regular expression match\n            for lexre, lexindexfunc in self.lexre:\n                m = lexre.match(lexdata, lexpos)\n                if not m:\n                    continue\n\n                # Create a token for return\n                tok = LexToken()\n                tok.value = m.group()\n                tok.lineno = self.lineno\n                tok.lexpos = lexpos\n\n                i = m.lastindex\n                func, tok.type = lexindexfunc[i]\n\n                if not func:\n                    # If no token type was set, it's an ignored token\n                    if tok.type:\n                        self.lexpos = m.end()\n                        return tok\n                    else:\n                        lexpos = m.end()\n                        break\n\n                lexpos = m.end()\n\n                # If token is processed by a function, call it\n\n                tok.lexer = self      # Set additional attributes useful in token rules\n                self.lexmatch = m\n                self.lexpos = lexpos\n\n                newtok = func(tok)\n\n                # Every function must return a token, if nothing, we just move to next token\n                if not newtok:\n                    lexpos    = self.lexpos         # This is here in case user has updated lexpos.\n                    lexignore = self.lexignore      # This is here in case there was a state change\n                    break\n\n                # Verify type of the token.  If not in the token map, raise an error\n                if not self.lexoptimize:\n                    if newtok.type not in self.lextokens_all:\n                        raise LexError(\"%s:%d: Rule '%s' returned an unknown token type '%s'\" % (\n                            func.__code__.co_filename, func.__code__.co_firstlineno,\n                            func.__name__, newtok.type), lexdata[lexpos:])\n\n                return newtok\n            else:\n                # No match, see if in literals\n                if lexdata[lexpos] in self.lexliterals:\n                    tok = LexToken()\n                    tok.value = lexdata[lexpos]\n                    tok.lineno = self.lineno\n                    tok.type = tok.value\n                    tok.lexpos = lexpos\n                    self.lexpos = lexpos + 1\n                    return tok\n\n                # No match. Call t_error() if defined.\n                if self.lexerrorf:\n                    tok = LexToken()\n                    tok.value = self.lexdata[lexpos:]\n                    tok.lineno = self.lineno\n                    tok.type = 'error'\n                    tok.lexer = self\n                    tok.lexpos = lexpos\n                    self.lexpos = lexpos\n                    newtok = self.lexerrorf(tok)\n                    if lexpos == self.lexpos:\n                        # Error method didn't change text position at all. This is an error.\n                        raise LexError(\"Scanning error. Illegal character '%s'\" % (lexdata[lexpos]), lexdata[lexpos:])\n                    lexpos = self.lexpos\n                    if not newtok:\n                        continue\n                    return newtok\n\n                self.lexpos = lexpos\n                raise LexError(\"Illegal character '%s' at index %d\" % (lexdata[lexpos], lexpos), lexdata[lexpos:])\n\n        if self.lexeoff:\n            tok = LexToken()\n            tok.type = 'eof'\n            tok.value = ''\n            tok.lineno = self.lineno\n            tok.lexpos = lexpos\n            tok.lexer = self\n            self.lexpos = lexpos\n            newtok = self.lexeoff(tok)\n            return newtok\n\n        self.lexpos = lexpos + 1\n        if self.lexdata is None:\n            raise RuntimeError('No input string given with input()')\n        return None\n\n    # Iterator interface\n    def __iter__(self):\n        return self\n\n    def next(self):\n        t = self.token()\n        if t is None:\n            raise StopIteration\n        return t\n\n    __next__ = next\n\n# -----------------------------------------------------------------------------\n#                           ==== Lex Builder ===\n#\n# The functions and classes below are used to collect lexing information\n# and build a Lexer object from it.\n# -----------------------------------------------------------------------------\n\n# -----------------------------------------------------------------------------\n# _get_regex(func)\n#\n# Returns the regular expression assigned to a function either as a doc string\n# or as a .regex attribute attached by the @TOKEN decorator.\n# -----------------------------------------------------------------------------\ndef _get_regex(func):\n    return getattr(func, 'regex', func.__doc__)\n\n# -----------------------------------------------------------------------------\n# get_caller_module_dict()\n#\n# This function returns a dictionary containing all of the symbols defined within\n# a caller further down the call stack.  This is used to get the environment\n# associated with the yacc() call if none was provided.\n# -----------------------------------------------------------------------------\ndef get_caller_module_dict(levels):\n    f = sys._getframe(levels)\n    ldict = f.f_globals.copy()\n    if f.f_globals != f.f_locals:\n        ldict.update(f.f_locals)\n    return ldict\n\n# -----------------------------------------------------------------------------\n# _funcs_to_names()\n#\n# Given a list of regular expression functions, this converts it to a list\n# suitable for output to a table file\n# -----------------------------------------------------------------------------\ndef _funcs_to_names(funclist, namelist):\n    result = []\n    for f, name in zip(funclist, namelist):\n        if f and f[0]:\n            result.append((name, f[1]))\n        else:\n            result.append(f)\n    return result\n\n# -----------------------------------------------------------------------------\n# _names_to_funcs()\n#\n# Given a list of regular expression function names, this converts it back to\n# functions.\n# -----------------------------------------------------------------------------\ndef _names_to_funcs(namelist, fdict):\n    result = []\n    for n in namelist:\n        if n and n[0]:\n            result.append((fdict[n[0]], n[1]))\n        else:\n            result.append(n)\n    return result\n\n# -----------------------------------------------------------------------------\n# _form_master_re()\n#\n# This function takes a list of all of the regex components and attempts to\n# form the master regular expression.  Given limitations in the Python re\n# module, it may be necessary to break the master regex into separate expressions.\n# -----------------------------------------------------------------------------\ndef _form_master_re(relist, reflags, ldict, toknames):\n    if not relist:\n        return []\n    regex = '|'.join(relist)\n    try:\n        lexre = re.compile(regex, reflags)\n\n        # Build the index to function map for the matching engine\n        lexindexfunc = [None] * (max(lexre.groupindex.values()) + 1)\n        lexindexnames = lexindexfunc[:]\n\n        for f, i in lexre.groupindex.items():\n            handle = ldict.get(f, None)\n            if type(handle) in (types.FunctionType, types.MethodType):\n                lexindexfunc[i] = (handle, toknames[f])\n                lexindexnames[i] = f\n            elif handle is not None:\n                lexindexnames[i] = f\n                if f.find('ignore_') > 0:\n                    lexindexfunc[i] = (None, None)\n                else:\n                    lexindexfunc[i] = (None, toknames[f])\n\n        return [(lexre, lexindexfunc)], [regex], [lexindexnames]\n    except Exception:\n        m = int(len(relist)/2)\n        if m == 0:\n            m = 1\n        llist, lre, lnames = _form_master_re(relist[:m], reflags, ldict, toknames)\n        rlist, rre, rnames = _form_master_re(relist[m:], reflags, ldict, toknames)\n        return (llist+rlist), (lre+rre), (lnames+rnames)\n\n# -----------------------------------------------------------------------------\n# def _statetoken(s,names)\n#\n# Given a declaration name s of the form \"t_\" and a dictionary whose keys are\n# state names, this function returns a tuple (states,tokenname) where states\n# is a tuple of state names and tokenname is the name of the token.  For example,\n# calling this with s = \"t_foo_bar_SPAM\" might return (('foo','bar'),'SPAM')\n# -----------------------------------------------------------------------------\ndef _statetoken(s, names):\n    parts = s.split('_')\n    for i, part in enumerate(parts[1:], 1):\n        if part not in names and part != 'ANY':\n            break\n\n    if i > 1:\n        states = tuple(parts[1:i])\n    else:\n        states = ('INITIAL',)\n\n    if 'ANY' in states:\n        states = tuple(names)\n\n    tokenname = '_'.join(parts[i:])\n    return (states, tokenname)\n\n\n# -----------------------------------------------------------------------------\n# LexerReflect()\n#\n# This class represents information needed to build a lexer as extracted from a\n# user's input file.\n# -----------------------------------------------------------------------------\nclass LexerReflect(object):\n    def __init__(self, ldict, log=None, reflags=0):\n        self.ldict      = ldict\n        self.error_func = None\n        self.tokens     = []\n        self.reflags    = reflags\n        self.stateinfo  = {'INITIAL': 'inclusive'}\n        self.modules    = set()\n        self.error      = False\n        self.log        = PlyLogger(sys.stderr) if log is None else log\n\n    # Get all of the basic information\n    def get_all(self):\n        self.get_tokens()\n        self.get_literals()\n        self.get_states()\n        self.get_rules()\n\n    # Validate all of the information\n    def validate_all(self):\n        self.validate_tokens()\n        self.validate_literals()\n        self.validate_rules()\n        return self.error\n\n    # Get the tokens map\n    def get_tokens(self):\n        tokens = self.ldict.get('tokens', None)\n        if not tokens:\n            self.log.error('No token list is defined')\n            self.error = True\n            return\n\n        if not isinstance(tokens, (list, tuple)):\n            self.log.error('tokens must be a list or tuple')\n            self.error = True\n            return\n\n        if not tokens:\n            self.log.error('tokens is empty')\n            self.error = True\n            return\n\n        self.tokens = tokens\n\n    # Validate the tokens\n    def validate_tokens(self):\n        terminals = {}\n        for n in self.tokens:\n            if not _is_identifier.match(n):\n                self.log.error(\"Bad token name '%s'\", n)\n                self.error = True\n            if n in terminals:\n                self.log.warning(\"Token '%s' multiply defined\", n)\n            terminals[n] = 1\n\n    # Get the literals specifier\n    def get_literals(self):\n        self.literals = self.ldict.get('literals', '')\n        if not self.literals:\n            self.literals = ''\n\n    # Validate literals\n    def validate_literals(self):\n        try:\n            for c in self.literals:\n                if not isinstance(c, StringTypes) or len(c) > 1:\n                    self.log.error('Invalid literal %s. Must be a single character', repr(c))\n                    self.error = True\n\n        except TypeError:\n            self.log.error('Invalid literals specification. literals must be a sequence of characters')\n            self.error = True\n\n    def get_states(self):\n        self.states = self.ldict.get('states', None)\n        # Build statemap\n        if self.states:\n            if not isinstance(self.states, (tuple, list)):\n                self.log.error('states must be defined as a tuple or list')\n                self.error = True\n            else:\n                for s in self.states:\n                    if not isinstance(s, tuple) or len(s) != 2:\n                        self.log.error(\"Invalid state specifier %s. Must be a tuple (statename,'exclusive|inclusive')\", repr(s))\n                        self.error = True\n                        continue\n                    name, statetype = s\n                    if not isinstance(name, StringTypes):\n                        self.log.error('State name %s must be a string', repr(name))\n                        self.error = True\n                        continue\n                    if not (statetype == 'inclusive' or statetype == 'exclusive'):\n                        self.log.error(\"State type for state %s must be 'inclusive' or 'exclusive'\", name)\n                        self.error = True\n                        continue\n                    if name in self.stateinfo:\n                        self.log.error(\"State '%s' already defined\", name)\n                        self.error = True\n                        continue\n                    self.stateinfo[name] = statetype\n\n    # Get all of the symbols with a t_ prefix and sort them into various\n    # categories (functions, strings, error functions, and ignore characters)\n\n    def get_rules(self):\n        tsymbols = [f for f in self.ldict if f[:2] == 't_']\n\n        # Now build up a list of functions and a list of strings\n        self.toknames = {}        # Mapping of symbols to token names\n        self.funcsym  = {}        # Symbols defined as functions\n        self.strsym   = {}        # Symbols defined as strings\n        self.ignore   = {}        # Ignore strings by state\n        self.errorf   = {}        # Error functions by state\n        self.eoff     = {}        # EOF functions by state\n\n        for s in self.stateinfo:\n            self.funcsym[s] = []\n            self.strsym[s] = []\n\n        if len(tsymbols) == 0:\n            self.log.error('No rules of the form t_rulename are defined')\n            self.error = True\n            return\n\n        for f in tsymbols:\n            t = self.ldict[f]\n            states, tokname = _statetoken(f, self.stateinfo)\n            self.toknames[f] = tokname\n\n            if hasattr(t, '__call__'):\n                if tokname == 'error':\n                    for s in states:\n                        self.errorf[s] = t\n                elif tokname == 'eof':\n                    for s in states:\n                        self.eoff[s] = t\n                elif tokname == 'ignore':\n                    line = t.__code__.co_firstlineno\n                    file = t.__code__.co_filename\n                    self.log.error(\"%s:%d: Rule '%s' must be defined as a string\", file, line, t.__name__)\n                    self.error = True\n                else:\n                    for s in states:\n                        self.funcsym[s].append((f, t))\n            elif isinstance(t, StringTypes):\n                if tokname == 'ignore':\n                    for s in states:\n                        self.ignore[s] = t\n                    if '\\\\' in t:\n                        self.log.warning(\"%s contains a literal backslash '\\\\'\", f)\n\n                elif tokname == 'error':\n                    self.log.error(\"Rule '%s' must be defined as a function\", f)\n                    self.error = True\n                else:\n                    for s in states:\n                        self.strsym[s].append((f, t))\n            else:\n                self.log.error('%s not defined as a function or string', f)\n                self.error = True\n\n        # Sort the functions by line number\n        for f in self.funcsym.values():\n            f.sort(key=lambda x: x[1].__code__.co_firstlineno)\n\n        # Sort the strings by regular expression length\n        for s in self.strsym.values():\n            s.sort(key=lambda x: len(x[1]), reverse=True)\n\n    # Validate all of the t_rules collected\n    def validate_rules(self):\n        for state in self.stateinfo:\n            # Validate all rules defined by functions\n\n            for fname, f in self.funcsym[state]:\n                line = f.__code__.co_firstlineno\n                file = f.__code__.co_filename\n                module = inspect.getmodule(f)\n                self.modules.add(module)\n\n                tokname = self.toknames[fname]\n                if isinstance(f, types.MethodType):\n                    reqargs = 2\n                else:\n                    reqargs = 1\n                nargs = f.__code__.co_argcount\n                if nargs > reqargs:\n                    self.log.error(\"%s:%d: Rule '%s' has too many arguments\", file, line, f.__name__)\n                    self.error = True\n                    continue\n\n                if nargs < reqargs:\n                    self.log.error(\"%s:%d: Rule '%s' requires an argument\", file, line, f.__name__)\n                    self.error = True\n                    continue\n\n                if not _get_regex(f):\n                    self.log.error(\"%s:%d: No regular expression defined for rule '%s'\", file, line, f.__name__)\n                    self.error = True\n                    continue\n\n                try:\n                    c = re.compile('(?P<%s>%s)' % (fname, _get_regex(f)), self.reflags)\n                    if c.match(''):\n                        self.log.error(\"%s:%d: Regular expression for rule '%s' matches empty string\", file, line, f.__name__)\n                        self.error = True\n                except re.error as e:\n                    self.log.error(\"%s:%d: Invalid regular expression for rule '%s'. %s\", file, line, f.__name__, e)\n                    if '#' in _get_regex(f):\n                        self.log.error(\"%s:%d. Make sure '#' in rule '%s' is escaped with '\\\\#'\", file, line, f.__name__)\n                    self.error = True\n\n            # Validate all rules defined by strings\n            for name, r in self.strsym[state]:\n                tokname = self.toknames[name]\n                if tokname == 'error':\n                    self.log.error(\"Rule '%s' must be defined as a function\", name)\n                    self.error = True\n                    continue\n\n                if tokname not in self.tokens and tokname.find('ignore_') < 0:\n                    self.log.error(\"Rule '%s' defined for an unspecified token %s\", name, tokname)\n                    self.error = True\n                    continue\n\n                try:\n                    c = re.compile('(?P<%s>%s)' % (name, r), self.reflags)\n                    if (c.match('')):\n                        self.log.error(\"Regular expression for rule '%s' matches empty string\", name)\n                        self.error = True\n                except re.error as e:\n                    self.log.error(\"Invalid regular expression for rule '%s'. %s\", name, e)\n                    if '#' in r:\n                        self.log.error(\"Make sure '#' in rule '%s' is escaped with '\\\\#'\", name)\n                    self.error = True\n\n            if not self.funcsym[state] and not self.strsym[state]:\n                self.log.error(\"No rules defined for state '%s'\", state)\n                self.error = True\n\n            # Validate the error function\n            efunc = self.errorf.get(state, None)\n            if efunc:\n                f = efunc\n                line = f.__code__.co_firstlineno\n                file = f.__code__.co_filename\n                module = inspect.getmodule(f)\n                self.modules.add(module)\n\n                if isinstance(f, types.MethodType):\n                    reqargs = 2\n                else:\n                    reqargs = 1\n                nargs = f.__code__.co_argcount\n                if nargs > reqargs:\n                    self.log.error(\"%s:%d: Rule '%s' has too many arguments\", file, line, f.__name__)\n                    self.error = True\n\n                if nargs < reqargs:\n                    self.log.error(\"%s:%d: Rule '%s' requires an argument\", file, line, f.__name__)\n                    self.error = True\n\n        for module in self.modules:\n            self.validate_module(module)\n\n    # -----------------------------------------------------------------------------\n    # validate_module()\n    #\n    # This checks to see if there are duplicated t_rulename() functions or strings\n    # in the parser input file.  This is done using a simple regular expression\n    # match on each line in the source code of the given module.\n    # -----------------------------------------------------------------------------\n\n    def validate_module(self, module):\n        try:\n            lines, linen = inspect.getsourcelines(module)\n        except IOError:\n            return\n\n        fre = re.compile(r'\\s*def\\s+(t_[a-zA-Z_0-9]*)\\(')\n        sre = re.compile(r'\\s*(t_[a-zA-Z_0-9]*)\\s*=')\n\n        counthash = {}\n        linen += 1\n        for line in lines:\n            m = fre.match(line)\n            if not m:\n                m = sre.match(line)\n            if m:\n                name = m.group(1)\n                prev = counthash.get(name)\n                if not prev:\n                    counthash[name] = linen\n                else:\n                    filename = inspect.getsourcefile(module)\n                    self.log.error('%s:%d: Rule %s redefined. Previously defined on line %d', filename, linen, name, prev)\n                    self.error = True\n            linen += 1\n\n# -----------------------------------------------------------------------------\n# lex(module)\n#\n# Build all of the regular expression rules from definitions in the supplied module\n# -----------------------------------------------------------------------------\ndef lex(module=None, object=None, debug=False, optimize=False, lextab='lextab',\n        reflags=int(re.VERBOSE), nowarn=False, outputdir=None, debuglog=None, errorlog=None):\n\n    if lextab is None:\n        lextab = 'lextab'\n\n    global lexer\n\n    ldict = None\n    stateinfo  = {'INITIAL': 'inclusive'}\n    lexobj = Lexer()\n    lexobj.lexoptimize = optimize\n    global token, input\n\n    if errorlog is None:\n        errorlog = PlyLogger(sys.stderr)\n\n    if debug:\n        if debuglog is None:\n            debuglog = PlyLogger(sys.stderr)\n\n    # Get the module dictionary used for the lexer\n    if object:\n        module = object\n\n    # Get the module dictionary used for the parser\n    if module:\n        _items = [(k, getattr(module, k)) for k in dir(module)]\n        ldict = dict(_items)\n        # If no __file__ attribute is available, try to obtain it from the __module__ instead\n        if '__file__' not in ldict:\n            ldict['__file__'] = sys.modules[ldict['__module__']].__file__\n    else:\n        ldict = get_caller_module_dict(2)\n\n    # Determine if the module is package of a package or not.\n    # If so, fix the tabmodule setting so that tables load correctly\n    pkg = ldict.get('__package__')\n    if pkg and isinstance(lextab, str):\n        if '.' not in lextab:\n            lextab = pkg + '.' + lextab\n\n    # Collect parser information from the dictionary\n    linfo = LexerReflect(ldict, log=errorlog, reflags=reflags)\n    linfo.get_all()\n    if not optimize:\n        if linfo.validate_all():\n            raise SyntaxError(\"Can't build lexer\")\n\n    if optimize and lextab:\n        try:\n            lexobj.readtab(lextab, ldict)\n            token = lexobj.token\n            input = lexobj.input\n            lexer = lexobj\n            return lexobj\n\n        except ImportError:\n            pass\n\n    # Dump some basic debugging information\n    if debug:\n        debuglog.info('lex: tokens   = %r', linfo.tokens)\n        debuglog.info('lex: literals = %r', linfo.literals)\n        debuglog.info('lex: states   = %r', linfo.stateinfo)\n\n    # Build a dictionary of valid token names\n    lexobj.lextokens = set()\n    for n in linfo.tokens:\n        lexobj.lextokens.add(n)\n\n    # Get literals specification\n    if isinstance(linfo.literals, (list, tuple)):\n        lexobj.lexliterals = type(linfo.literals[0])().join(linfo.literals)\n    else:\n        lexobj.lexliterals = linfo.literals\n\n    lexobj.lextokens_all = lexobj.lextokens | set(lexobj.lexliterals)\n\n    # Get the stateinfo dictionary\n    stateinfo = linfo.stateinfo\n\n    regexs = {}\n    # Build the master regular expressions\n    for state in stateinfo:\n        regex_list = []\n\n        # Add rules defined by functions first\n        for fname, f in linfo.funcsym[state]:\n            regex_list.append('(?P<%s>%s)' % (fname, _get_regex(f)))\n            if debug:\n                debuglog.info(\"lex: Adding rule %s -> '%s' (state '%s')\", fname, _get_regex(f), state)\n\n        # Now add all of the simple rules\n        for name, r in linfo.strsym[state]:\n            regex_list.append('(?P<%s>%s)' % (name, r))\n            if debug:\n                debuglog.info(\"lex: Adding rule %s -> '%s' (state '%s')\", name, r, state)\n\n        regexs[state] = regex_list\n\n    # Build the master regular expressions\n\n    if debug:\n        debuglog.info('lex: ==== MASTER REGEXS FOLLOW ====')\n\n    for state in regexs:\n        lexre, re_text, re_names = _form_master_re(regexs[state], reflags, ldict, linfo.toknames)\n        lexobj.lexstatere[state] = lexre\n        lexobj.lexstateretext[state] = re_text\n        lexobj.lexstaterenames[state] = re_names\n        if debug:\n            for i, text in enumerate(re_text):\n                debuglog.info(\"lex: state '%s' : regex[%d] = '%s'\", state, i, text)\n\n    # For inclusive states, we need to add the regular expressions from the INITIAL state\n    for state, stype in stateinfo.items():\n        if state != 'INITIAL' and stype == 'inclusive':\n            lexobj.lexstatere[state].extend(lexobj.lexstatere['INITIAL'])\n            lexobj.lexstateretext[state].extend(lexobj.lexstateretext['INITIAL'])\n            lexobj.lexstaterenames[state].extend(lexobj.lexstaterenames['INITIAL'])\n\n    lexobj.lexstateinfo = stateinfo\n    lexobj.lexre = lexobj.lexstatere['INITIAL']\n    lexobj.lexretext = lexobj.lexstateretext['INITIAL']\n    lexobj.lexreflags = reflags\n\n    # Set up ignore variables\n    lexobj.lexstateignore = linfo.ignore\n    lexobj.lexignore = lexobj.lexstateignore.get('INITIAL', '')\n\n    # Set up error functions\n    lexobj.lexstateerrorf = linfo.errorf\n    lexobj.lexerrorf = linfo.errorf.get('INITIAL', None)\n    if not lexobj.lexerrorf:\n        errorlog.warning('No t_error rule is defined')\n\n    # Set up eof functions\n    lexobj.lexstateeoff = linfo.eoff\n    lexobj.lexeoff = linfo.eoff.get('INITIAL', None)\n\n    # Check state information for ignore and error rules\n    for s, stype in stateinfo.items():\n        if stype == 'exclusive':\n            if s not in linfo.errorf:\n                errorlog.warning(\"No error rule is defined for exclusive state '%s'\", s)\n            if s not in linfo.ignore and lexobj.lexignore:\n                errorlog.warning(\"No ignore rule is defined for exclusive state '%s'\", s)\n        elif stype == 'inclusive':\n            if s not in linfo.errorf:\n                linfo.errorf[s] = linfo.errorf.get('INITIAL', None)\n            if s not in linfo.ignore:\n                linfo.ignore[s] = linfo.ignore.get('INITIAL', '')\n\n    # Create global versions of the token() and input() functions\n    token = lexobj.token\n    input = lexobj.input\n    lexer = lexobj\n\n    # If in optimize mode, we write the lextab\n    if lextab and optimize:\n        if outputdir is None:\n            # If no output directory is set, the location of the output files\n            # is determined according to the following rules:\n            #     - If lextab specifies a package, files go into that package directory\n            #     - Otherwise, files go in the same directory as the specifying module\n            if isinstance(lextab, types.ModuleType):\n                srcfile = lextab.__file__\n            else:\n                if '.' not in lextab:\n                    srcfile = ldict['__file__']\n                else:\n                    parts = lextab.split('.')\n                    pkgname = '.'.join(parts[:-1])\n                    exec('import %s' % pkgname)\n                    srcfile = getattr(sys.modules[pkgname], '__file__', '')\n            outputdir = os.path.dirname(srcfile)\n        try:\n            lexobj.writetab(lextab, outputdir)\n            if lextab in sys.modules:\n                del sys.modules[lextab]\n        except IOError as e:\n            errorlog.warning(\"Couldn't write lextab module %r. %s\" % (lextab, e))\n\n    return lexobj\n\n# -----------------------------------------------------------------------------\n# runmain()\n#\n# This runs the lexer as a main program\n# -----------------------------------------------------------------------------\n\ndef runmain(lexer=None, data=None):\n    if not data:\n        try:\n            filename = sys.argv[1]\n            f = open(filename)\n            data = f.read()\n            f.close()\n        except IndexError:\n            sys.stdout.write('Reading from standard input (type EOF to end):\\n')\n            data = sys.stdin.read()\n\n    if lexer:\n        _input = lexer.input\n    else:\n        _input = input\n    _input(data)\n    if lexer:\n        _token = lexer.token\n    else:\n        _token = token\n\n    while True:\n        tok = _token()\n        if not tok:\n            break\n        sys.stdout.write('(%s,%r,%d,%d)\\n' % (tok.type, tok.value, tok.lineno, tok.lexpos))\n\n# -----------------------------------------------------------------------------\n# @TOKEN(regex)\n#\n# This decorator function can be used to set the regex expression on a function\n# when its docstring might need to be set in an alternative way\n# -----------------------------------------------------------------------------\n\ndef TOKEN(r):\n    def set_regex(f):\n        if hasattr(r, '__call__'):\n            f.regex = _get_regex(r)\n        else:\n            f.regex = r\n        return f\n    return set_regex\n\n# Alternative spelling of the TOKEN decorator\nToken = TOKEN\n"},{"className":"LexError","col":0,"comment":"null","endLoc":60,"id":11337,"nodeType":"Class","startLoc":57,"text":"class LexError(Exception):\n    def __init__(self, message, s):\n        self.args = (message,)\n        self.text = s"},{"col":4,"comment":"null","endLoc":60,"header":"def __init__(self, message, s)","id":11338,"name":"__init__","nodeType":"Function","startLoc":58,"text":"def __init__(self, message, s):\n        self.args = (message,)\n        self.text = s"},{"attributeType":"null","col":8,"comment":"null","endLoc":59,"id":11339,"name":"args","nodeType":"Attribute","startLoc":59,"text":"self.args"},{"col":0,"comment":"Perform an indirect stable sort using a sequence of keys.\n\n    Like `numpy.lexsort` but for possibly masked ``keys``.  Masked\n    values are sorted towards the end for each key.\n    ","endLoc":822,"header":"@dispatched_function\ndef lexsort(keys, axis=-1)","id":11340,"name":"lexsort","nodeType":"Function","startLoc":799,"text":"@dispatched_function\ndef lexsort(keys, axis=-1):\n    \"\"\"Perform an indirect stable sort using a sequence of keys.\n\n    Like `numpy.lexsort` but for possibly masked ``keys``.  Masked\n    values are sorted towards the end for each key.\n    \"\"\"\n    # Sort masks to the end.\n    from .core import Masked\n\n    new_keys = []\n    for key in keys:\n        if isinstance(key, Masked):\n            # If there are other keys below, want to be sure that\n            # for masked values, those other keys set the order.\n            new_key = key.unmasked\n            if new_keys and key.mask.any():\n                new_key = new_key.copy()\n                new_key[key.mask] = new_key.flat[0]\n            new_keys.extend([new_key, key.mask])\n        else:\n            new_keys.append(key)\n\n    return np.lexsort(new_keys, axis=axis)"},{"attributeType":"null","col":8,"comment":"null","endLoc":60,"id":11341,"name":"text","nodeType":"Attribute","startLoc":60,"text":"self.text"},{"className":"LexToken","col":0,"comment":"null","endLoc":69,"id":11342,"nodeType":"Class","startLoc":64,"text":"class LexToken(object):\n    def __str__(self):\n        return 'LexToken(%s,%r,%d,%d)' % (self.type, self.value, self.lineno, self.lexpos)\n\n    def __repr__(self):\n        return str(self)"},{"col":4,"comment":"null","endLoc":66,"header":"def __str__(self)","id":11343,"name":"__str__","nodeType":"Function","startLoc":65,"text":"def __str__(self):\n        return 'LexToken(%s,%r,%d,%d)' % (self.type, self.value, self.lineno, self.lexpos)"},{"col":4,"comment":"null","endLoc":69,"header":"def __repr__(self)","id":11344,"name":"__repr__","nodeType":"Function","startLoc":68,"text":"def __repr__(self):\n        return str(self)"},{"className":"PlyLogger","col":0,"comment":"null","endLoc":89,"id":11345,"nodeType":"Class","startLoc":75,"text":"class PlyLogger(object):\n    def __init__(self, f):\n        self.f = f\n\n    def critical(self, msg, *args, **kwargs):\n        self.f.write((msg % args) + '\\n')\n\n    def warning(self, msg, *args, **kwargs):\n        self.f.write('WARNING: ' + (msg % args) + '\\n')\n\n    def error(self, msg, *args, **kwargs):\n        self.f.write('ERROR: ' + (msg % args) + '\\n')\n\n    info = critical\n    debug = critical"},{"col":4,"comment":"null","endLoc":80,"header":"def critical(self, msg, *args, **kwargs)","id":11346,"name":"critical","nodeType":"Function","startLoc":79,"text":"def critical(self, msg, *args, **kwargs):\n        self.f.write((msg % args) + '\\n')"},{"col":0,"comment":"null","endLoc":850,"header":"@dispatched_function\ndef apply_over_axes(func, a, axes)","id":11347,"name":"apply_over_axes","nodeType":"Function","startLoc":825,"text":"@dispatched_function\ndef apply_over_axes(func, a, axes):\n    # Copied straight from numpy/lib/shape_base, just to omit its\n    # val = asarray(a); if only it had been asanyarray, or just not there\n    # since a is assumed to an an array in the next line...\n    # Which is what we do here - we can only get here if it is Masked.\n    val = a\n    N = a.ndim\n    if np.array(axes).ndim == 0:\n        axes = (axes,)\n    for axis in axes:\n        if axis < 0:\n            axis = N + axis\n        args = (val, axis)\n        res = func(*args)\n        if res.ndim == val.ndim:\n            val = res\n        else:\n            res = np.expand_dims(res, axis)\n            if res.ndim == val.ndim:\n                val = res\n            else:\n                raise ValueError(\"function is not returning \"\n                                 \"an array of the correct shape\")\n\n    return val"},{"col":4,"comment":"null","endLoc":83,"header":"def warning(self, msg, *args, **kwargs)","id":11348,"name":"warning","nodeType":"Function","startLoc":82,"text":"def warning(self, msg, *args, **kwargs):\n        self.f.write('WARNING: ' + (msg % args) + '\\n')"},{"col":4,"comment":"null","endLoc":86,"header":"def error(self, msg, *args, **kwargs)","id":11349,"name":"error","nodeType":"Function","startLoc":85,"text":"def error(self, msg, *args, **kwargs):\n        self.f.write('ERROR: ' + (msg % args) + '\\n')"},{"attributeType":"function","col":4,"comment":"null","endLoc":88,"id":11350,"name":"info","nodeType":"Attribute","startLoc":88,"text":"info"},{"attributeType":"function","col":4,"comment":"null","endLoc":89,"id":11351,"name":"debug","nodeType":"Attribute","startLoc":89,"text":"debug"},{"attributeType":"null","col":8,"comment":"null","endLoc":77,"id":11352,"name":"f","nodeType":"Attribute","startLoc":77,"text":"self.f"},{"className":"NullLogger","col":0,"comment":"null","endLoc":98,"id":11353,"nodeType":"Class","startLoc":93,"text":"class NullLogger(object):\n    def __getattribute__(self, name):\n        return self\n\n    def __call__(self, *args, **kwargs):\n        return self"},{"col":4,"comment":"null","endLoc":95,"header":"def __getattribute__(self, name)","id":11354,"name":"__getattribute__","nodeType":"Function","startLoc":94,"text":"def __getattribute__(self, name):\n        return self"},{"col":4,"comment":"null","endLoc":98,"header":"def __call__(self, *args, **kwargs)","id":11355,"name":"__call__","nodeType":"Function","startLoc":97,"text":"def __call__(self, *args, **kwargs):\n        return self"},{"className":"Lexer","col":0,"comment":"null","endLoc":424,"id":11356,"nodeType":"Class","startLoc":115,"text":"class Lexer:\n    def __init__(self):\n        self.lexre = None             # Master regular expression. This is a list of\n                                      # tuples (re, findex) where re is a compiled\n                                      # regular expression and findex is a list\n                                      # mapping regex group numbers to rules\n        self.lexretext = None         # Current regular expression strings\n        self.lexstatere = {}          # Dictionary mapping lexer states to master regexs\n        self.lexstateretext = {}      # Dictionary mapping lexer states to regex strings\n        self.lexstaterenames = {}     # Dictionary mapping lexer states to symbol names\n        self.lexstate = 'INITIAL'     # Current lexer state\n        self.lexstatestack = []       # Stack of lexer states\n        self.lexstateinfo = None      # State information\n        self.lexstateignore = {}      # Dictionary of ignored characters for each state\n        self.lexstateerrorf = {}      # Dictionary of error functions for each state\n        self.lexstateeoff = {}        # Dictionary of eof functions for each state\n        self.lexreflags = 0           # Optional re compile flags\n        self.lexdata = None           # Actual input data (as a string)\n        self.lexpos = 0               # Current position in input text\n        self.lexlen = 0               # Length of the input text\n        self.lexerrorf = None         # Error rule (if any)\n        self.lexeoff = None           # EOF rule (if any)\n        self.lextokens = None         # List of valid tokens\n        self.lexignore = ''           # Ignored characters\n        self.lexliterals = ''         # Literal characters that can be passed through\n        self.lexmodule = None         # Module\n        self.lineno = 1               # Current line number\n        self.lexoptimize = False      # Optimized mode\n\n    def clone(self, object=None):\n        c = copy.copy(self)\n\n        # If the object parameter has been supplied, it means we are attaching the\n        # lexer to a new object.  In this case, we have to rebind all methods in\n        # the lexstatere and lexstateerrorf tables.\n\n        if object:\n            newtab = {}\n            for key, ritem in self.lexstatere.items():\n                newre = []\n                for cre, findex in ritem:\n                    newfindex = []\n                    for f in findex:\n                        if not f or not f[0]:\n                            newfindex.append(f)\n                            continue\n                        newfindex.append((getattr(object, f[0].__name__), f[1]))\n                newre.append((cre, newfindex))\n                newtab[key] = newre\n            c.lexstatere = newtab\n            c.lexstateerrorf = {}\n            for key, ef in self.lexstateerrorf.items():\n                c.lexstateerrorf[key] = getattr(object, ef.__name__)\n            c.lexmodule = object\n        return c\n\n    # ------------------------------------------------------------\n    # writetab() - Write lexer information to a table file\n    # ------------------------------------------------------------\n    def writetab(self, lextab, outputdir=''):\n        if isinstance(lextab, types.ModuleType):\n            raise IOError(\"Won't overwrite existing lextab module\")\n        basetabmodule = lextab.split('.')[-1]\n        filename = os.path.join(outputdir, basetabmodule) + '.py'\n        with open(filename, 'w') as tf:\n            tf.write('# %s.py. This file automatically created by PLY (version %s). Don\\'t edit!\\n' % (basetabmodule, __version__))\n            tf.write('_tabversion   = %s\\n' % repr(__tabversion__))\n            tf.write('_lextokens    = set(%s)\\n' % repr(tuple(sorted(self.lextokens))))\n            tf.write('_lexreflags   = %s\\n' % repr(int(self.lexreflags)))\n            tf.write('_lexliterals  = %s\\n' % repr(self.lexliterals))\n            tf.write('_lexstateinfo = %s\\n' % repr(self.lexstateinfo))\n\n            # Rewrite the lexstatere table, replacing function objects with function names\n            tabre = {}\n            for statename, lre in self.lexstatere.items():\n                titem = []\n                for (pat, func), retext, renames in zip(lre, self.lexstateretext[statename], self.lexstaterenames[statename]):\n                    titem.append((retext, _funcs_to_names(func, renames)))\n                tabre[statename] = titem\n\n            tf.write('_lexstatere   = %s\\n' % repr(tabre))\n            tf.write('_lexstateignore = %s\\n' % repr(self.lexstateignore))\n\n            taberr = {}\n            for statename, ef in self.lexstateerrorf.items():\n                taberr[statename] = ef.__name__ if ef else None\n            tf.write('_lexstateerrorf = %s\\n' % repr(taberr))\n\n            tabeof = {}\n            for statename, ef in self.lexstateeoff.items():\n                tabeof[statename] = ef.__name__ if ef else None\n            tf.write('_lexstateeoff = %s\\n' % repr(tabeof))\n\n    # ------------------------------------------------------------\n    # readtab() - Read lexer information from a tab file\n    # ------------------------------------------------------------\n    def readtab(self, tabfile, fdict):\n        if isinstance(tabfile, types.ModuleType):\n            lextab = tabfile\n        else:\n            exec('import %s' % tabfile)\n            lextab = sys.modules[tabfile]\n\n        if getattr(lextab, '_tabversion', '0.0') != __tabversion__:\n            raise ImportError('Inconsistent PLY version')\n\n        self.lextokens      = lextab._lextokens\n        self.lexreflags     = lextab._lexreflags\n        self.lexliterals    = lextab._lexliterals\n        self.lextokens_all  = self.lextokens | set(self.lexliterals)\n        self.lexstateinfo   = lextab._lexstateinfo\n        self.lexstateignore = lextab._lexstateignore\n        self.lexstatere     = {}\n        self.lexstateretext = {}\n        for statename, lre in lextab._lexstatere.items():\n            titem = []\n            txtitem = []\n            for pat, func_name in lre:\n                titem.append((re.compile(pat, lextab._lexreflags), _names_to_funcs(func_name, fdict)))\n\n            self.lexstatere[statename] = titem\n            self.lexstateretext[statename] = txtitem\n\n        self.lexstateerrorf = {}\n        for statename, ef in lextab._lexstateerrorf.items():\n            self.lexstateerrorf[statename] = fdict[ef]\n\n        self.lexstateeoff = {}\n        for statename, ef in lextab._lexstateeoff.items():\n            self.lexstateeoff[statename] = fdict[ef]\n\n        self.begin('INITIAL')\n\n    # ------------------------------------------------------------\n    # input() - Push a new string into the lexer\n    # ------------------------------------------------------------\n    def input(self, s):\n        # Pull off the first character to see if s looks like a string\n        c = s[:1]\n        if not isinstance(c, StringTypes):\n            raise ValueError('Expected a string')\n        self.lexdata = s\n        self.lexpos = 0\n        self.lexlen = len(s)\n\n    # ------------------------------------------------------------\n    # begin() - Changes the lexing state\n    # ------------------------------------------------------------\n    def begin(self, state):\n        if state not in self.lexstatere:\n            raise ValueError('Undefined state')\n        self.lexre = self.lexstatere[state]\n        self.lexretext = self.lexstateretext[state]\n        self.lexignore = self.lexstateignore.get(state, '')\n        self.lexerrorf = self.lexstateerrorf.get(state, None)\n        self.lexeoff = self.lexstateeoff.get(state, None)\n        self.lexstate = state\n\n    # ------------------------------------------------------------\n    # push_state() - Changes the lexing state and saves old on stack\n    # ------------------------------------------------------------\n    def push_state(self, state):\n        self.lexstatestack.append(self.lexstate)\n        self.begin(state)\n\n    # ------------------------------------------------------------\n    # pop_state() - Restores the previous state\n    # ------------------------------------------------------------\n    def pop_state(self):\n        self.begin(self.lexstatestack.pop())\n\n    # ------------------------------------------------------------\n    # current_state() - Returns the current lexing state\n    # ------------------------------------------------------------\n    def current_state(self):\n        return self.lexstate\n\n    # ------------------------------------------------------------\n    # skip() - Skip ahead n characters\n    # ------------------------------------------------------------\n    def skip(self, n):\n        self.lexpos += n\n\n    # ------------------------------------------------------------\n    # opttoken() - Return the next token from the Lexer\n    #\n    # Note: This function has been carefully implemented to be as fast\n    # as possible.  Don't make changes unless you really know what\n    # you are doing\n    # ------------------------------------------------------------\n    def token(self):\n        # Make local copies of frequently referenced attributes\n        lexpos    = self.lexpos\n        lexlen    = self.lexlen\n        lexignore = self.lexignore\n        lexdata   = self.lexdata\n\n        while lexpos < lexlen:\n            # This code provides some short-circuit code for whitespace, tabs, and other ignored characters\n            if lexdata[lexpos] in lexignore:\n                lexpos += 1\n                continue\n\n            # Look for a regular expression match\n            for lexre, lexindexfunc in self.lexre:\n                m = lexre.match(lexdata, lexpos)\n                if not m:\n                    continue\n\n                # Create a token for return\n                tok = LexToken()\n                tok.value = m.group()\n                tok.lineno = self.lineno\n                tok.lexpos = lexpos\n\n                i = m.lastindex\n                func, tok.type = lexindexfunc[i]\n\n                if not func:\n                    # If no token type was set, it's an ignored token\n                    if tok.type:\n                        self.lexpos = m.end()\n                        return tok\n                    else:\n                        lexpos = m.end()\n                        break\n\n                lexpos = m.end()\n\n                # If token is processed by a function, call it\n\n                tok.lexer = self      # Set additional attributes useful in token rules\n                self.lexmatch = m\n                self.lexpos = lexpos\n\n                newtok = func(tok)\n\n                # Every function must return a token, if nothing, we just move to next token\n                if not newtok:\n                    lexpos    = self.lexpos         # This is here in case user has updated lexpos.\n                    lexignore = self.lexignore      # This is here in case there was a state change\n                    break\n\n                # Verify type of the token.  If not in the token map, raise an error\n                if not self.lexoptimize:\n                    if newtok.type not in self.lextokens_all:\n                        raise LexError(\"%s:%d: Rule '%s' returned an unknown token type '%s'\" % (\n                            func.__code__.co_filename, func.__code__.co_firstlineno,\n                            func.__name__, newtok.type), lexdata[lexpos:])\n\n                return newtok\n            else:\n                # No match, see if in literals\n                if lexdata[lexpos] in self.lexliterals:\n                    tok = LexToken()\n                    tok.value = lexdata[lexpos]\n                    tok.lineno = self.lineno\n                    tok.type = tok.value\n                    tok.lexpos = lexpos\n                    self.lexpos = lexpos + 1\n                    return tok\n\n                # No match. Call t_error() if defined.\n                if self.lexerrorf:\n                    tok = LexToken()\n                    tok.value = self.lexdata[lexpos:]\n                    tok.lineno = self.lineno\n                    tok.type = 'error'\n                    tok.lexer = self\n                    tok.lexpos = lexpos\n                    self.lexpos = lexpos\n                    newtok = self.lexerrorf(tok)\n                    if lexpos == self.lexpos:\n                        # Error method didn't change text position at all. This is an error.\n                        raise LexError(\"Scanning error. Illegal character '%s'\" % (lexdata[lexpos]), lexdata[lexpos:])\n                    lexpos = self.lexpos\n                    if not newtok:\n                        continue\n                    return newtok\n\n                self.lexpos = lexpos\n                raise LexError(\"Illegal character '%s' at index %d\" % (lexdata[lexpos], lexpos), lexdata[lexpos:])\n\n        if self.lexeoff:\n            tok = LexToken()\n            tok.type = 'eof'\n            tok.value = ''\n            tok.lineno = self.lineno\n            tok.lexpos = lexpos\n            tok.lexer = self\n            self.lexpos = lexpos\n            newtok = self.lexeoff(tok)\n            return newtok\n\n        self.lexpos = lexpos + 1\n        if self.lexdata is None:\n            raise RuntimeError('No input string given with input()')\n        return None\n\n    # Iterator interface\n    def __iter__(self):\n        return self\n\n    def next(self):\n        t = self.token()\n        if t is None:\n            raise StopIteration\n        return t\n\n    __next__ = next"},{"col":4,"comment":"null","endLoc":169,"header":"def clone(self, object=None)","id":11357,"name":"clone","nodeType":"Function","startLoc":144,"text":"def clone(self, object=None):\n        c = copy.copy(self)\n\n        # If the object parameter has been supplied, it means we are attaching the\n        # lexer to a new object.  In this case, we have to rebind all methods in\n        # the lexstatere and lexstateerrorf tables.\n\n        if object:\n            newtab = {}\n            for key, ritem in self.lexstatere.items():\n                newre = []\n                for cre, findex in ritem:\n                    newfindex = []\n                    for f in findex:\n                        if not f or not f[0]:\n                            newfindex.append(f)\n                            continue\n                        newfindex.append((getattr(object, f[0].__name__), f[1]))\n                newre.append((cre, newfindex))\n                newtab[key] = newre\n            c.lexstatere = newtab\n            c.lexstateerrorf = {}\n            for key, ef in self.lexstateerrorf.items():\n                c.lexstateerrorf[key] = getattr(object, ef.__name__)\n            c.lexmodule = object\n        return c"},{"col":0,"comment":"null","endLoc":919,"header":"def _array2string(a, options, separator=' ', prefix=\"\")","id":11358,"name":"_array2string","nodeType":"Function","startLoc":894,"text":"def _array2string(a, options, separator=' ', prefix=\"\"):\n    # Mostly copied from numpy.core.arrayprint, except:\n    # - The format function is wrapped in a mask-aware class;\n    # - Arrays scalars are not cast as arrays.\n    from numpy.core.arrayprint import _leading_trailing, _formatArray\n\n    data = np.asarray(a)\n\n    if a.size > options['threshold']:\n        summary_insert = \"...\"\n        data = _leading_trailing(data, options['edgeitems'])\n    else:\n        summary_insert = \"\"\n\n    # find the right formatting function for the array\n    format_function = MaskedFormat.from_data(data, **options)\n\n    # skip over \"[\"\n    next_line_prefix = \" \"\n    # skip over array(\n    next_line_prefix += \" \"*len(prefix)\n\n    lst = _formatArray(a, format_function, options['linewidth'],\n                       next_line_prefix, separator, options['edgeitems'],\n                       summary_insert, options['legacy'])\n    return lst"},{"col":0,"comment":"null","endLoc":145,"header":"def format_result(r)","id":11359,"name":"format_result","nodeType":"Function","startLoc":138,"text":"def format_result(r):\n    repr_str = repr(r)\n    if '\\n' in repr_str:\n        repr_str = repr(repr_str)\n    if len(repr_str) > resultlimit:\n        repr_str = repr_str[:resultlimit] + ' ...'\n    result = '<%s @ 0x%x> (%s)' % (type(r).__name__, id(r), repr_str)\n    return result"},{"col":0,"comment":"null","endLoc":942,"header":"@dispatched_function\ndef array2string(a, max_line_width=None, precision=None,\n                 suppress_small=None, separator=' ', prefix=\"\",\n                 style=np._NoValue, formatter=None, threshold=None,\n                 edgeitems=None, sign=None, floatmode=None, suffix=\"\")","id":11360,"name":"array2string","nodeType":"Function","startLoc":922,"text":"@dispatched_function\ndef array2string(a, max_line_width=None, precision=None,\n                 suppress_small=None, separator=' ', prefix=\"\",\n                 style=np._NoValue, formatter=None, threshold=None,\n                 edgeitems=None, sign=None, floatmode=None, suffix=\"\"):\n    # Copied from numpy.core.arrayprint, but using _array2string above.\n    from numpy.core.arrayprint import _make_options_dict, _format_options\n\n    overrides = _make_options_dict(precision, threshold, edgeitems,\n                                   max_line_width, suppress_small, None, None,\n                                   sign, formatter, floatmode)\n    options = _format_options.copy()\n    options.update(overrides)\n\n    options['linewidth'] -= len(suffix)\n\n    # treat as a null array if any of shape elements == 0\n    if a.size == 0:\n        return \"[]\"\n\n    return _array2string(a, options, separator, prefix)"},{"col":0,"comment":"null","endLoc":948,"header":"@dispatched_function\ndef array_str(a, max_line_width=None, precision=None, suppress_small=None)","id":11361,"name":"array_str","nodeType":"Function","startLoc":945,"text":"@dispatched_function\ndef array_str(a, max_line_width=None, precision=None, suppress_small=None):\n    # Override to avoid special treatment of array scalars.\n    return array2string(a, max_line_width, precision, suppress_small, ' ', \"\")"},{"col":0,"comment":"null","endLoc":990,"header":"def masked_nanfunc(nanfuncname)","id":11362,"name":"masked_nanfunc","nodeType":"Function","startLoc":956,"text":"def masked_nanfunc(nanfuncname):\n    np_func = getattr(np, nanfuncname[3:])\n    fill_value = _nanfunc_fill_values.get(nanfuncname, None)\n\n    def nanfunc(a, *args, **kwargs):\n        from astropy.utils.masked import Masked\n\n        a, mask = Masked._get_data_and_mask(a)\n        if issubclass(a.dtype.type, np.inexact):\n            nans = np.isnan(a)\n            mask = nans if mask is None else (nans | mask)\n\n        if mask is not None:\n            a = Masked(a, mask)\n            if fill_value is not None:\n                a = a.filled(fill_value)\n\n        return np_func(a, *args, **kwargs)\n\n    doc = f\"Like `numpy.{nanfuncname}`, skipping masked values as well.\\n\\n\"\n    if fill_value is not None:\n        # sum, cumsum, prod, cumprod\n        doc += (f\"Masked/NaN values are replaced with {fill_value}. \"\n                \"The output is not masked.\")\n    elif \"arg\" in nanfuncname:\n        doc += (\"No exceptions are raised for fully masked/NaN slices.\\n\"\n                \"Instead, these give index 0.\")\n    else:\n        doc += (\"No warnings are given for fully masked/NaN slices.\\n\"\n                \"Instead, they are masked in the output.\")\n\n    nanfunc.__doc__ = doc\n    nanfunc.__name__ = nanfuncname\n\n    return nanfunc"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":11363,"name":"__all__","nodeType":"Attribute","startLoc":35,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":282,"id":11364,"name":"_cache_lock","nodeType":"Attribute","startLoc":282,"text":"_cache_lock"},{"col":4,"comment":"null","endLoc":206,"header":"def writetab(self, lextab, outputdir='')","id":11365,"name":"writetab","nodeType":"Function","startLoc":174,"text":"def writetab(self, lextab, outputdir=''):\n        if isinstance(lextab, types.ModuleType):\n            raise IOError(\"Won't overwrite existing lextab module\")\n        basetabmodule = lextab.split('.')[-1]\n        filename = os.path.join(outputdir, basetabmodule) + '.py'\n        with open(filename, 'w') as tf:\n            tf.write('# %s.py. This file automatically created by PLY (version %s). Don\\'t edit!\\n' % (basetabmodule, __version__))\n            tf.write('_tabversion   = %s\\n' % repr(__tabversion__))\n            tf.write('_lextokens    = set(%s)\\n' % repr(tuple(sorted(self.lextokens))))\n            tf.write('_lexreflags   = %s\\n' % repr(int(self.lexreflags)))\n            tf.write('_lexliterals  = %s\\n' % repr(self.lexliterals))\n            tf.write('_lexstateinfo = %s\\n' % repr(self.lexstateinfo))\n\n            # Rewrite the lexstatere table, replacing function objects with function names\n            tabre = {}\n            for statename, lre in self.lexstatere.items():\n                titem = []\n                for (pat, func), retext, renames in zip(lre, self.lexstateretext[statename], self.lexstaterenames[statename]):\n                    titem.append((retext, _funcs_to_names(func, renames)))\n                tabre[statename] = titem\n\n            tf.write('_lexstatere   = %s\\n' % repr(tabre))\n            tf.write('_lexstateignore = %s\\n' % repr(self.lexstateignore))\n\n            taberr = {}\n            for statename, ef in self.lexstateerrorf.items():\n                taberr[statename] = ef.__name__ if ef else None\n            tf.write('_lexstateerrorf = %s\\n' % repr(taberr))\n\n            tabeof = {}\n            for statename, ef in self.lexstateeoff.items():\n                tabeof[statename] = ef.__name__ if ef else None\n            tf.write('_lexstateeoff = %s\\n' % repr(tabeof))"},{"attributeType":"TimeRE","col":0,"comment":"null","endLoc":285,"id":11366,"name":"_TimeRE_cache","nodeType":"Attribute","startLoc":285,"text":"_TimeRE_cache"},{"attributeType":"null","col":0,"comment":"null","endLoc":286,"id":11367,"name":"_CACHE_MAX_SIZE","nodeType":"Attribute","startLoc":286,"text":"_CACHE_MAX_SIZE"},{"attributeType":"null","col":0,"comment":"null","endLoc":287,"id":11368,"name":"_regex_cache","nodeType":"Attribute","startLoc":287,"text":"_regex_cache"},{"col":0,"comment":"","endLoc":12,"header":"_strptime.py#<anonymous>","id":11369,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"Strptime-related classes and functions.\n\nCLASSES:\n    LocaleTime -- Discovers and stores locale-specific time information\n    TimeRE -- Creates regexes for pattern matching a string of text containing\n                time information\n\nFUNCTIONS:\n    _getlang -- Figure out what language is being used for the locale\n    strptime -- Calculates the time struct represented by the passed-in string\n\n\"\"\"\n\ntry:\n    from _thread import allocate_lock as _thread_allocate_lock\nexcept ImportError:\n    from _dummy_thread import allocate_lock as _thread_allocate_lock\n\n__all__ = []\n\n_cache_lock = _thread_allocate_lock()\n\n_TimeRE_cache = TimeRE()\n\n_CACHE_MAX_SIZE = 5 # Max number of regexes stored in _regex_cache\n\n_regex_cache = {}"},{"fileName":"__init__.py","filePath":"astropy/extern/ply","id":11370,"nodeType":"File","text":"# PLY package\n# Author: David Beazley (dave@dabeaz.com)\n\n__version__ = '3.11'\n__all__ = ['lex','yacc']\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":11371,"name":"__all__","nodeType":"Attribute","startLoc":21,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":111,"id":11372,"name":"IGNORED_FUNCTIONS","nodeType":"Attribute","startLoc":111,"text":"IGNORED_FUNCTIONS"},{"attributeType":"FunctionAssigner","col":0,"comment":"null","endLoc":159,"id":11373,"name":"apply_to_both","nodeType":"Attribute","startLoc":159,"text":"apply_to_both"},{"attributeType":"FunctionAssigner","col":0,"comment":"null","endLoc":160,"id":11374,"name":"dispatched_function","nodeType":"Attribute","startLoc":160,"text":"dispatched_function"},{"attributeType":"null","col":4,"comment":"null","endLoc":548,"id":11375,"name":"_zeros_like","nodeType":"Attribute","startLoc":548,"text":"_zeros_like"},{"attributeType":"null","col":0,"comment":"null","endLoc":952,"id":11376,"name":"_nanfunc_fill_values","nodeType":"Attribute","startLoc":952,"text":"_nanfunc_fill_values"},{"attributeType":"null","col":4,"comment":"null","endLoc":993,"id":11377,"name":"nanfuncname","nodeType":"Attribute","startLoc":993,"text":"nanfuncname"},{"col":0,"comment":"","endLoc":11,"header":"function_helpers.py#<anonymous>","id":11378,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"Helpers for letting numpy functions interact with Masked arrays.\n\nThe module supplies helper routines for numpy functions that propagate\nmasks appropriately., for use in the ``__array_function__``\nimplementation of `~astropy.utils.masked.MaskedNDArray`.  They are not\nvery useful on their own, but the ones with docstrings are included in\nthe documentation so that there is a place to find out how the mask is\ninterpreted.\n\n\"\"\"\n\n__all__ = ['MASKED_SAFE_FUNCTIONS', 'APPLY_TO_BOTH_FUNCTIONS',\n           'DISPATCHED_FUNCTIONS', 'UNSUPPORTED_FUNCTIONS']\n\nMASKED_SAFE_FUNCTIONS = set()\n\n\"\"\"Set of functions that work fine on Masked classes already.\n\nMost of these internally use `numpy.ufunc` or other functions that\nare already covered.\n\"\"\"\n\nAPPLY_TO_BOTH_FUNCTIONS = {}\n\n\"\"\"Dict of functions that should apply to both data and mask.\n\nThe `dict` is keyed by the numpy function and the values are functions\nthat take the input arguments of the numpy function and organize these\nfor passing the data and mask to the numpy function.\n\nReturns\n-------\ndata_args : tuple\n    Arguments to pass on to the numpy function for the unmasked data.\nmask_args : tuple\n    Arguments to pass on to the numpy function for the masked data.\nkwargs : dict\n    Keyword arguments to pass on for both unmasked data and mask.\nout : `~astropy.utils.masked.Masked` instance or None\n    Optional instance in which to store the output.\n\nRaises\n------\nNotImplementedError\n   When an arguments is masked when it should not be or vice versa.\n\"\"\"\n\nDISPATCHED_FUNCTIONS = {}\n\n\"\"\"Dict of functions that provide the numpy function's functionality.\n\nThese are for more complicated versions where the numpy function itself\ncannot easily be used.  It should return either the result of the\nfunction, or a tuple consisting of the unmasked result, the mask for the\nresult and a possible output instance.\n\nIt should raise `NotImplementedError` if one of the arguments is masked\nwhen it should not be or vice versa.\n\"\"\"\n\nUNSUPPORTED_FUNCTIONS = set()\n\n\"\"\"Set of numpy functions that are not supported for masked arrays.\n\nFor most, masked input simply makes no sense, but for others it may have\nbeen lack of time.  Issues or PRs for support for functions are welcome.\n\"\"\"\n\nMASKED_SAFE_FUNCTIONS |= set(\n    getattr(np, name) for name in np.core.fromnumeric.__all__\n    if name not in ({'choose', 'put', 'resize', 'searchsorted', 'where', 'alen'}))\n\nMASKED_SAFE_FUNCTIONS |= {\n    # built-in from multiarray\n    np.may_share_memory, np.can_cast, np.min_scalar_type, np.result_type,\n    np.shares_memory,\n    # np.core.arrayprint\n    np.array_repr,\n    # np.core.function_base\n    np.linspace, np.logspace, np.geomspace,\n    # np.core.numeric\n    np.isclose, np.allclose, np.flatnonzero, np.argwhere,\n    # np.core.shape_base\n    np.atleast_1d, np.atleast_2d, np.atleast_3d, np.stack, np.hstack, np.vstack,\n    # np.lib.function_base\n    np.average, np.diff, np.extract, np.meshgrid, np.trapz, np.gradient,\n    # np.lib.index_tricks\n    np.diag_indices_from, np.triu_indices_from, np.tril_indices_from,\n    np.fill_diagonal,\n    # np.lib.shape_base\n    np.column_stack, np.row_stack, np.dstack,\n    np.array_split, np.split, np.hsplit, np.vsplit, np.dsplit,\n    np.expand_dims, np.apply_along_axis, np.kron, np.tile,\n    np.take_along_axis, np.put_along_axis,\n    # np.lib.type_check (all but asfarray, nan_to_num)\n    np.iscomplexobj, np.isrealobj, np.imag, np.isreal,\n    np.real, np.real_if_close, np.common_type,\n    # np.lib.ufunclike\n    np.fix, np.isneginf, np.isposinf,\n    # np.lib.function_base\n    np.angle, np.i0,\n}\n\nIGNORED_FUNCTIONS = {\n    # I/O - useless for Masked, since no way to store the mask.\n    np.save, np.savez, np.savetxt, np.savez_compressed,\n    # Polynomials\n    np.poly, np.polyadd, np.polyder, np.polydiv, np.polyfit, np.polyint,\n    np.polymul, np.polysub, np.polyval, np.roots, np.vander}\n\nif NUMPY_LT_1_20:\n    # financial\n    IGNORED_FUNCTIONS |= {np.fv, np.ipmt, np.irr, np.mirr, np.nper,\n                          np.npv, np.pmt, np.ppmt, np.pv, np.rate}\n\nIGNORED_FUNCTIONS |= {\n    np.pad,\n    np.searchsorted, np.digitize,\n    np.is_busday, np.busday_count, np.busday_offset,\n    # numpy.lib.function_base\n    np.cov, np.corrcoef, np.trim_zeros,\n    # numpy.core.numeric\n    np.correlate, np.convolve,\n    # numpy.lib.histograms\n    np.histogram, np.histogram2d, np.histogramdd, np.histogram_bin_edges,\n    # TODO!!\n    np.dot, np.vdot, np.inner, np.tensordot, np.cross,\n    np.einsum, np.einsum_path,\n}\n\nIGNORED_FUNCTIONS |= set(getattr(np, setopsname)\n                         for setopsname in np.lib.arraysetops.__all__)\n\nif NUMPY_LT_1_23:\n    IGNORED_FUNCTIONS |= {\n        # Deprecated, removed in numpy 1.23\n        np.asscalar, np.alen,\n    }\n\nUNSUPPORTED_FUNCTIONS |= {\n    np.unravel_index, np.ravel_multi_index, np.ix_,\n}\n\nUNSUPPORTED_FUNCTIONS |= IGNORED_FUNCTIONS\n\napply_to_both = FunctionAssigner(APPLY_TO_BOTH_FUNCTIONS)\n\ndispatched_function = FunctionAssigner(DISPATCHED_FUNCTIONS)\n\nif NUMPY_LT_1_19:\n    @dispatched_function\n    def count_nonzero(a, axis=None):\n        \"\"\"Counts the number of non-zero values in the array ``a``.\n\n        Like `numpy.count_nonzero`, with masked values counted as 0 or `False`.\n        \"\"\"\n        filled = a.filled(np.zeros((), a.dtype))\n        return np.count_nonzero(filled, axis)\nelse:\n    @dispatched_function\n    def count_nonzero(a, axis=None, *, keepdims=False):\n        \"\"\"Counts the number of non-zero values in the array ``a``.\n\n        Like `numpy.count_nonzero`, with masked values counted as 0 or `False`.\n        \"\"\"\n        filled = a.filled(np.zeros((), a.dtype))\n        return np.count_nonzero(filled, axis, keepdims=keepdims)\n\nif NUMPY_LT_1_19:\n    def _zeros_like(a, dtype=None, order='K', subok=True, shape=None):\n        if shape != ():\n            return np.zeros_like(a, dtype=dtype, order=order, subok=subok, shape=shape)\n        else:\n            return np.zeros_like(a, dtype=dtype, order=order, subok=subok,\n                                 shape=(1,))[0]\nelse:\n    _zeros_like = np.zeros_like\n\n_nanfunc_fill_values = {'nansum': 0, 'nancumsum': 0,\n                        'nanprod': 1, 'nancumprod': 1}\n\nfor nanfuncname in np.lib.nanfunctions.__all__:\n    globals()[nanfuncname] = dispatched_function(masked_nanfunc(nanfuncname),\n                                                 helps=getattr(np, nanfuncname))\n\n__all__ += sorted(helper.__name__ for helper in (\n    set(APPLY_TO_BOTH_FUNCTIONS.values())\n    | set(DISPATCHED_FUNCTIONS.values())) if helper.__doc__)"},{"attributeType":"null","col":0,"comment":"null","endLoc":4,"id":11379,"name":"__version__","nodeType":"Attribute","startLoc":4,"text":"__version__"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":11380,"name":"__all__","nodeType":"Attribute","startLoc":5,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"__init__.py#<anonymous>","id":11381,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__version__ = '3.11'\n\n__all__ = ['lex','yacc']"},{"fileName":"cpp.py","filePath":"astropy/extern/ply","id":11382,"nodeType":"File","text":"# -----------------------------------------------------------------------------\n# cpp.py\n#\n# Author:  David Beazley (http://www.dabeaz.com)\n# Copyright (C) 2007\n# All rights reserved\n#\n# This module implements an ANSI-C style lexical preprocessor for PLY.\n# -----------------------------------------------------------------------------\nfrom __future__ import generators\n\nimport sys\n\n# Some Python 3 compatibility shims\nif sys.version_info.major < 3:\n    STRING_TYPES = (str, unicode)\nelse:\n    STRING_TYPES = str\n    xrange = range\n\n# -----------------------------------------------------------------------------\n# Default preprocessor lexer definitions.   These tokens are enough to get\n# a basic preprocessor working.   Other modules may import these if they want\n# -----------------------------------------------------------------------------\n\ntokens = (\n   'CPP_ID','CPP_INTEGER', 'CPP_FLOAT', 'CPP_STRING', 'CPP_CHAR', 'CPP_WS', 'CPP_COMMENT1', 'CPP_COMMENT2', 'CPP_POUND','CPP_DPOUND'\n)\n\nliterals = \"+-*/%|&~^<>=!?()[]{}.,;:\\\\\\'\\\"\"\n\n# Whitespace\ndef t_CPP_WS(t):\n    r'\\s+'\n    t.lexer.lineno += t.value.count(\"\\n\")\n    return t\n\nt_CPP_POUND = r'\\#'\nt_CPP_DPOUND = r'\\#\\#'\n\n# Identifier\nt_CPP_ID = r'[A-Za-z_][\\w_]*'\n\n# Integer literal\ndef CPP_INTEGER(t):\n    r'(((((0x)|(0X))[0-9a-fA-F]+)|(\\d+))([uU][lL]|[lL][uU]|[uU]|[lL])?)'\n    return t\n\nt_CPP_INTEGER = CPP_INTEGER\n\n# Floating literal\nt_CPP_FLOAT = r'((\\d+)(\\.\\d+)(e(\\+|-)?(\\d+))? | (\\d+)e(\\+|-)?(\\d+))([lL]|[fF])?'\n\n# String literal\ndef t_CPP_STRING(t):\n    r'\\\"([^\\\\\\n]|(\\\\(.|\\n)))*?\\\"'\n    t.lexer.lineno += t.value.count(\"\\n\")\n    return t\n\n# Character constant 'c' or L'c'\ndef t_CPP_CHAR(t):\n    r'(L)?\\'([^\\\\\\n]|(\\\\(.|\\n)))*?\\''\n    t.lexer.lineno += t.value.count(\"\\n\")\n    return t\n\n# Comment\ndef t_CPP_COMMENT1(t):\n    r'(/\\*(.|\\n)*?\\*/)'\n    ncr = t.value.count(\"\\n\")\n    t.lexer.lineno += ncr\n    # replace with one space or a number of '\\n'\n    t.type = 'CPP_WS'; t.value = '\\n' * ncr if ncr else ' '\n    return t\n\n# Line comment\ndef t_CPP_COMMENT2(t):\n    r'(//.*?(\\n|$))'\n    # replace with '/n'\n    t.type = 'CPP_WS'; t.value = '\\n'\n    return t\n\ndef t_error(t):\n    t.type = t.value[0]\n    t.value = t.value[0]\n    t.lexer.skip(1)\n    return t\n\nimport re\nimport copy\nimport time\nimport os.path\n\n# -----------------------------------------------------------------------------\n# trigraph()\n#\n# Given an input string, this function replaces all trigraph sequences.\n# The following mapping is used:\n#\n#     ??=    #\n#     ??/    \\\n#     ??'    ^\n#     ??(    [\n#     ??)    ]\n#     ??!    |\n#     ??<    {\n#     ??>    }\n#     ??-    ~\n# -----------------------------------------------------------------------------\n\n_trigraph_pat = re.compile(r'''\\?\\?[=/\\'\\(\\)\\!<>\\-]''')\n_trigraph_rep = {\n    '=':'#',\n    '/':'\\\\',\n    \"'\":'^',\n    '(':'[',\n    ')':']',\n    '!':'|',\n    '<':'{',\n    '>':'}',\n    '-':'~'\n}\n\ndef trigraph(input):\n    return _trigraph_pat.sub(lambda g: _trigraph_rep[g.group()[-1]],input)\n\n# ------------------------------------------------------------------\n# Macro object\n#\n# This object holds information about preprocessor macros\n#\n#    .name      - Macro name (string)\n#    .value     - Macro value (a list of tokens)\n#    .arglist   - List of argument names\n#    .variadic  - Boolean indicating whether or not variadic macro\n#    .vararg    - Name of the variadic parameter\n#\n# When a macro is created, the macro replacement token sequence is\n# pre-scanned and used to create patch lists that are later used\n# during macro expansion\n# ------------------------------------------------------------------\n\nclass Macro(object):\n    def __init__(self,name,value,arglist=None,variadic=False):\n        self.name = name\n        self.value = value\n        self.arglist = arglist\n        self.variadic = variadic\n        if variadic:\n            self.vararg = arglist[-1]\n        self.source = None\n\n# ------------------------------------------------------------------\n# Preprocessor object\n#\n# Object representing a preprocessor.  Contains macro definitions,\n# include directories, and other information\n# ------------------------------------------------------------------\n\nclass Preprocessor(object):\n    def __init__(self,lexer=None):\n        if lexer is None:\n            lexer = lex.lexer\n        self.lexer = lexer\n        self.macros = { }\n        self.path = []\n        self.temp_path = []\n\n        # Probe the lexer for selected tokens\n        self.lexprobe()\n\n        tm = time.localtime()\n        self.define(\"__DATE__ \\\"%s\\\"\" % time.strftime(\"%b %d %Y\",tm))\n        self.define(\"__TIME__ \\\"%s\\\"\" % time.strftime(\"%H:%M:%S\",tm))\n        self.parser = None\n\n    # -----------------------------------------------------------------------------\n    # tokenize()\n    #\n    # Utility function. Given a string of text, tokenize into a list of tokens\n    # -----------------------------------------------------------------------------\n\n    def tokenize(self,text):\n        tokens = []\n        self.lexer.input(text)\n        while True:\n            tok = self.lexer.token()\n            if not tok: break\n            tokens.append(tok)\n        return tokens\n\n    # ---------------------------------------------------------------------\n    # error()\n    #\n    # Report a preprocessor error/warning of some kind\n    # ----------------------------------------------------------------------\n\n    def error(self,file,line,msg):\n        print(\"%s:%d %s\" % (file,line,msg))\n\n    # ----------------------------------------------------------------------\n    # lexprobe()\n    #\n    # This method probes the preprocessor lexer object to discover\n    # the token types of symbols that are important to the preprocessor.\n    # If this works right, the preprocessor will simply \"work\"\n    # with any suitable lexer regardless of how tokens have been named.\n    # ----------------------------------------------------------------------\n\n    def lexprobe(self):\n\n        # Determine the token type for identifiers\n        self.lexer.input(\"identifier\")\n        tok = self.lexer.token()\n        if not tok or tok.value != \"identifier\":\n            print(\"Couldn't determine identifier type\")\n        else:\n            self.t_ID = tok.type\n\n        # Determine the token type for integers\n        self.lexer.input(\"12345\")\n        tok = self.lexer.token()\n        if not tok or int(tok.value) != 12345:\n            print(\"Couldn't determine integer type\")\n        else:\n            self.t_INTEGER = tok.type\n            self.t_INTEGER_TYPE = type(tok.value)\n\n        # Determine the token type for strings enclosed in double quotes\n        self.lexer.input(\"\\\"filename\\\"\")\n        tok = self.lexer.token()\n        if not tok or tok.value != \"\\\"filename\\\"\":\n            print(\"Couldn't determine string type\")\n        else:\n            self.t_STRING = tok.type\n\n        # Determine the token type for whitespace--if any\n        self.lexer.input(\"  \")\n        tok = self.lexer.token()\n        if not tok or tok.value != \"  \":\n            self.t_SPACE = None\n        else:\n            self.t_SPACE = tok.type\n\n        # Determine the token type for newlines\n        self.lexer.input(\"\\n\")\n        tok = self.lexer.token()\n        if not tok or tok.value != \"\\n\":\n            self.t_NEWLINE = None\n            print(\"Couldn't determine token for newlines\")\n        else:\n            self.t_NEWLINE = tok.type\n\n        self.t_WS = (self.t_SPACE, self.t_NEWLINE)\n\n        # Check for other characters used by the preprocessor\n        chars = [ '<','>','#','##','\\\\','(',')',',','.']\n        for c in chars:\n            self.lexer.input(c)\n            tok = self.lexer.token()\n            if not tok or tok.value != c:\n                print(\"Unable to lex '%s' required for preprocessor\" % c)\n\n    # ----------------------------------------------------------------------\n    # add_path()\n    #\n    # Adds a search path to the preprocessor.\n    # ----------------------------------------------------------------------\n\n    def add_path(self,path):\n        self.path.append(path)\n\n    # ----------------------------------------------------------------------\n    # group_lines()\n    #\n    # Given an input string, this function splits it into lines.  Trailing whitespace\n    # is removed.   Any line ending with \\ is grouped with the next line.  This\n    # function forms the lowest level of the preprocessor---grouping into text into\n    # a line-by-line format.\n    # ----------------------------------------------------------------------\n\n    def group_lines(self,input):\n        lex = self.lexer.clone()\n        lines = [x.rstrip() for x in input.splitlines()]\n        for i in xrange(len(lines)):\n            j = i+1\n            while lines[i].endswith('\\\\') and (j < len(lines)):\n                lines[i] = lines[i][:-1]+lines[j]\n                lines[j] = \"\"\n                j += 1\n\n        input = \"\\n\".join(lines)\n        lex.input(input)\n        lex.lineno = 1\n\n        current_line = []\n        while True:\n            tok = lex.token()\n            if not tok:\n                break\n            current_line.append(tok)\n            if tok.type in self.t_WS and '\\n' in tok.value:\n                yield current_line\n                current_line = []\n\n        if current_line:\n            yield current_line\n\n    # ----------------------------------------------------------------------\n    # tokenstrip()\n    #\n    # Remove leading/trailing whitespace tokens from a token list\n    # ----------------------------------------------------------------------\n\n    def tokenstrip(self,tokens):\n        i = 0\n        while i < len(tokens) and tokens[i].type in self.t_WS:\n            i += 1\n        del tokens[:i]\n        i = len(tokens)-1\n        while i >= 0 and tokens[i].type in self.t_WS:\n            i -= 1\n        del tokens[i+1:]\n        return tokens\n\n\n    # ----------------------------------------------------------------------\n    # collect_args()\n    #\n    # Collects comma separated arguments from a list of tokens.   The arguments\n    # must be enclosed in parenthesis.  Returns a tuple (tokencount,args,positions)\n    # where tokencount is the number of tokens consumed, args is a list of arguments,\n    # and positions is a list of integers containing the starting index of each\n    # argument.  Each argument is represented by a list of tokens.\n    #\n    # When collecting arguments, leading and trailing whitespace is removed\n    # from each argument.\n    #\n    # This function properly handles nested parenthesis and commas---these do not\n    # define new arguments.\n    # ----------------------------------------------------------------------\n\n    def collect_args(self,tokenlist):\n        args = []\n        positions = []\n        current_arg = []\n        nesting = 1\n        tokenlen = len(tokenlist)\n\n        # Search for the opening '('.\n        i = 0\n        while (i < tokenlen) and (tokenlist[i].type in self.t_WS):\n            i += 1\n\n        if (i < tokenlen) and (tokenlist[i].value == '('):\n            positions.append(i+1)\n        else:\n            self.error(self.source,tokenlist[0].lineno,\"Missing '(' in macro arguments\")\n            return 0, [], []\n\n        i += 1\n\n        while i < tokenlen:\n            t = tokenlist[i]\n            if t.value == '(':\n                current_arg.append(t)\n                nesting += 1\n            elif t.value == ')':\n                nesting -= 1\n                if nesting == 0:\n                    if current_arg:\n                        args.append(self.tokenstrip(current_arg))\n                        positions.append(i)\n                    return i+1,args,positions\n                current_arg.append(t)\n            elif t.value == ',' and nesting == 1:\n                args.append(self.tokenstrip(current_arg))\n                positions.append(i+1)\n                current_arg = []\n            else:\n                current_arg.append(t)\n            i += 1\n\n        # Missing end argument\n        self.error(self.source,tokenlist[-1].lineno,\"Missing ')' in macro arguments\")\n        return 0, [],[]\n\n    # ----------------------------------------------------------------------\n    # macro_prescan()\n    #\n    # Examine the macro value (token sequence) and identify patch points\n    # This is used to speed up macro expansion later on---we'll know\n    # right away where to apply patches to the value to form the expansion\n    # ----------------------------------------------------------------------\n\n    def macro_prescan(self,macro):\n        macro.patch     = []             # Standard macro arguments\n        macro.str_patch = []             # String conversion expansion\n        macro.var_comma_patch = []       # Variadic macro comma patch\n        i = 0\n        while i < len(macro.value):\n            if macro.value[i].type == self.t_ID and macro.value[i].value in macro.arglist:\n                argnum = macro.arglist.index(macro.value[i].value)\n                # Conversion of argument to a string\n                if i > 0 and macro.value[i-1].value == '#':\n                    macro.value[i] = copy.copy(macro.value[i])\n                    macro.value[i].type = self.t_STRING\n                    del macro.value[i-1]\n                    macro.str_patch.append((argnum,i-1))\n                    continue\n                # Concatenation\n                elif (i > 0 and macro.value[i-1].value == '##'):\n                    macro.patch.append(('c',argnum,i-1))\n                    del macro.value[i-1]\n                    i -= 1\n                    continue\n                elif ((i+1) < len(macro.value) and macro.value[i+1].value == '##'):\n                    macro.patch.append(('c',argnum,i))\n                    del macro.value[i + 1]\n                    continue\n                # Standard expansion\n                else:\n                    macro.patch.append(('e',argnum,i))\n            elif macro.value[i].value == '##':\n                if macro.variadic and (i > 0) and (macro.value[i-1].value == ',') and \\\n                        ((i+1) < len(macro.value)) and (macro.value[i+1].type == self.t_ID) and \\\n                        (macro.value[i+1].value == macro.vararg):\n                    macro.var_comma_patch.append(i-1)\n            i += 1\n        macro.patch.sort(key=lambda x: x[2],reverse=True)\n\n    # ----------------------------------------------------------------------\n    # macro_expand_args()\n    #\n    # Given a Macro and list of arguments (each a token list), this method\n    # returns an expanded version of a macro.  The return value is a token sequence\n    # representing the replacement macro tokens\n    # ----------------------------------------------------------------------\n\n    def macro_expand_args(self,macro,args):\n        # Make a copy of the macro token sequence\n        rep = [copy.copy(_x) for _x in macro.value]\n\n        # Make string expansion patches.  These do not alter the length of the replacement sequence\n\n        str_expansion = {}\n        for argnum, i in macro.str_patch:\n            if argnum not in str_expansion:\n                str_expansion[argnum] = ('\"%s\"' % \"\".join([x.value for x in args[argnum]])).replace(\"\\\\\",\"\\\\\\\\\")\n            rep[i] = copy.copy(rep[i])\n            rep[i].value = str_expansion[argnum]\n\n        # Make the variadic macro comma patch.  If the variadic macro argument is empty, we get rid\n        comma_patch = False\n        if macro.variadic and not args[-1]:\n            for i in macro.var_comma_patch:\n                rep[i] = None\n                comma_patch = True\n\n        # Make all other patches.   The order of these matters.  It is assumed that the patch list\n        # has been sorted in reverse order of patch location since replacements will cause the\n        # size of the replacement sequence to expand from the patch point.\n\n        expanded = { }\n        for ptype, argnum, i in macro.patch:\n            # Concatenation.   Argument is left unexpanded\n            if ptype == 'c':\n                rep[i:i+1] = args[argnum]\n            # Normal expansion.  Argument is macro expanded first\n            elif ptype == 'e':\n                if argnum not in expanded:\n                    expanded[argnum] = self.expand_macros(args[argnum])\n                rep[i:i+1] = expanded[argnum]\n\n        # Get rid of removed comma if necessary\n        if comma_patch:\n            rep = [_i for _i in rep if _i]\n\n        return rep\n\n\n    # ----------------------------------------------------------------------\n    # expand_macros()\n    #\n    # Given a list of tokens, this function performs macro expansion.\n    # The expanded argument is a dictionary that contains macros already\n    # expanded.  This is used to prevent infinite recursion.\n    # ----------------------------------------------------------------------\n\n    def expand_macros(self,tokens,expanded=None):\n        if expanded is None:\n            expanded = {}\n        i = 0\n        while i < len(tokens):\n            t = tokens[i]\n            if t.type == self.t_ID:\n                if t.value in self.macros and t.value not in expanded:\n                    # Yes, we found a macro match\n                    expanded[t.value] = True\n\n                    m = self.macros[t.value]\n                    if not m.arglist:\n                        # A simple macro\n                        ex = self.expand_macros([copy.copy(_x) for _x in m.value],expanded)\n                        for e in ex:\n                            e.lineno = t.lineno\n                        tokens[i:i+1] = ex\n                        i += len(ex)\n                    else:\n                        # A macro with arguments\n                        j = i + 1\n                        while j < len(tokens) and tokens[j].type in self.t_WS:\n                            j += 1\n                        if j < len(tokens) and tokens[j].value == '(':\n                            tokcount,args,positions = self.collect_args(tokens[j:])\n                            if not m.variadic and len(args) !=  len(m.arglist):\n                                self.error(self.source,t.lineno,\"Macro %s requires %d arguments\" % (t.value,len(m.arglist)))\n                                i = j + tokcount\n                            elif m.variadic and len(args) < len(m.arglist)-1:\n                                if len(m.arglist) > 2:\n                                    self.error(self.source,t.lineno,\"Macro %s must have at least %d arguments\" % (t.value, len(m.arglist)-1))\n                                else:\n                                    self.error(self.source,t.lineno,\"Macro %s must have at least %d argument\" % (t.value, len(m.arglist)-1))\n                                i = j + tokcount\n                            else:\n                                if m.variadic:\n                                    if len(args) == len(m.arglist)-1:\n                                        args.append([])\n                                    else:\n                                        args[len(m.arglist)-1] = tokens[j+positions[len(m.arglist)-1]:j+tokcount-1]\n                                        del args[len(m.arglist):]\n\n                                # Get macro replacement text\n                                rep = self.macro_expand_args(m,args)\n                                rep = self.expand_macros(rep,expanded)\n                                for r in rep:\n                                    r.lineno = t.lineno\n                                tokens[i:j+tokcount] = rep\n                                i += len(rep)\n                        else:\n                            # This is not a macro. It is just a word which\n                            # equals to name of the macro. Hence, go to the\n                            # next token.\n                            i += 1\n\n                    del expanded[t.value]\n                    continue\n                elif t.value == '__LINE__':\n                    t.type = self.t_INTEGER\n                    t.value = self.t_INTEGER_TYPE(t.lineno)\n\n            i += 1\n        return tokens\n\n    # ----------------------------------------------------------------------\n    # evalexpr()\n    #\n    # Evaluate an expression token sequence for the purposes of evaluating\n    # integral expressions.\n    # ----------------------------------------------------------------------\n\n    def evalexpr(self,tokens):\n        # tokens = tokenize(line)\n        # Search for defined macros\n        i = 0\n        while i < len(tokens):\n            if tokens[i].type == self.t_ID and tokens[i].value == 'defined':\n                j = i + 1\n                needparen = False\n                result = \"0L\"\n                while j < len(tokens):\n                    if tokens[j].type in self.t_WS:\n                        j += 1\n                        continue\n                    elif tokens[j].type == self.t_ID:\n                        if tokens[j].value in self.macros:\n                            result = \"1L\"\n                        else:\n                            result = \"0L\"\n                        if not needparen: break\n                    elif tokens[j].value == '(':\n                        needparen = True\n                    elif tokens[j].value == ')':\n                        break\n                    else:\n                        self.error(self.source,tokens[i].lineno,\"Malformed defined()\")\n                    j += 1\n                tokens[i].type = self.t_INTEGER\n                tokens[i].value = self.t_INTEGER_TYPE(result)\n                del tokens[i+1:j+1]\n            i += 1\n        tokens = self.expand_macros(tokens)\n        for i,t in enumerate(tokens):\n            if t.type == self.t_ID:\n                tokens[i] = copy.copy(t)\n                tokens[i].type = self.t_INTEGER\n                tokens[i].value = self.t_INTEGER_TYPE(\"0L\")\n            elif t.type == self.t_INTEGER:\n                tokens[i] = copy.copy(t)\n                # Strip off any trailing suffixes\n                tokens[i].value = str(tokens[i].value)\n                while tokens[i].value[-1] not in \"0123456789abcdefABCDEF\":\n                    tokens[i].value = tokens[i].value[:-1]\n\n        expr = \"\".join([str(x.value) for x in tokens])\n        expr = expr.replace(\"&&\",\" and \")\n        expr = expr.replace(\"||\",\" or \")\n        expr = expr.replace(\"!\",\" not \")\n        try:\n            result = eval(expr)\n        except Exception:\n            self.error(self.source,tokens[0].lineno,\"Couldn't evaluate expression\")\n            result = 0\n        return result\n\n    # ----------------------------------------------------------------------\n    # parsegen()\n    #\n    # Parse an input string/\n    # ----------------------------------------------------------------------\n    def parsegen(self,input,source=None):\n\n        # Replace trigraph sequences\n        t = trigraph(input)\n        lines = self.group_lines(t)\n\n        if not source:\n            source = \"\"\n\n        self.define(\"__FILE__ \\\"%s\\\"\" % source)\n\n        self.source = source\n        chunk = []\n        enable = True\n        iftrigger = False\n        ifstack = []\n\n        for x in lines:\n            for i,tok in enumerate(x):\n                if tok.type not in self.t_WS: break\n            if tok.value == '#':\n                # Preprocessor directive\n\n                # insert necessary whitespace instead of eaten tokens\n                for tok in x:\n                    if tok.type in self.t_WS and '\\n' in tok.value:\n                        chunk.append(tok)\n\n                dirtokens = self.tokenstrip(x[i+1:])\n                if dirtokens:\n                    name = dirtokens[0].value\n                    args = self.tokenstrip(dirtokens[1:])\n                else:\n                    name = \"\"\n                    args = []\n\n                if name == 'define':\n                    if enable:\n                        for tok in self.expand_macros(chunk):\n                            yield tok\n                        chunk = []\n                        self.define(args)\n                elif name == 'include':\n                    if enable:\n                        for tok in self.expand_macros(chunk):\n                            yield tok\n                        chunk = []\n                        oldfile = self.macros['__FILE__']\n                        for tok in self.include(args):\n                            yield tok\n                        self.macros['__FILE__'] = oldfile\n                        self.source = source\n                elif name == 'undef':\n                    if enable:\n                        for tok in self.expand_macros(chunk):\n                            yield tok\n                        chunk = []\n                        self.undef(args)\n                elif name == 'ifdef':\n                    ifstack.append((enable,iftrigger))\n                    if enable:\n                        if not args[0].value in self.macros:\n                            enable = False\n                            iftrigger = False\n                        else:\n                            iftrigger = True\n                elif name == 'ifndef':\n                    ifstack.append((enable,iftrigger))\n                    if enable:\n                        if args[0].value in self.macros:\n                            enable = False\n                            iftrigger = False\n                        else:\n                            iftrigger = True\n                elif name == 'if':\n                    ifstack.append((enable,iftrigger))\n                    if enable:\n                        result = self.evalexpr(args)\n                        if not result:\n                            enable = False\n                            iftrigger = False\n                        else:\n                            iftrigger = True\n                elif name == 'elif':\n                    if ifstack:\n                        if ifstack[-1][0]:     # We only pay attention if outer \"if\" allows this\n                            if enable:         # If already true, we flip enable False\n                                enable = False\n                            elif not iftrigger:   # If False, but not triggered yet, we'll check expression\n                                result = self.evalexpr(args)\n                                if result:\n                                    enable  = True\n                                    iftrigger = True\n                    else:\n                        self.error(self.source,dirtokens[0].lineno,\"Misplaced #elif\")\n\n                elif name == 'else':\n                    if ifstack:\n                        if ifstack[-1][0]:\n                            if enable:\n                                enable = False\n                            elif not iftrigger:\n                                enable = True\n                                iftrigger = True\n                    else:\n                        self.error(self.source,dirtokens[0].lineno,\"Misplaced #else\")\n\n                elif name == 'endif':\n                    if ifstack:\n                        enable,iftrigger = ifstack.pop()\n                    else:\n                        self.error(self.source,dirtokens[0].lineno,\"Misplaced #endif\")\n                else:\n                    # Unknown preprocessor directive\n                    pass\n\n            else:\n                # Normal text\n                if enable:\n                    chunk.extend(x)\n\n        for tok in self.expand_macros(chunk):\n            yield tok\n        chunk = []\n\n    # ----------------------------------------------------------------------\n    # include()\n    #\n    # Implementation of file-inclusion\n    # ----------------------------------------------------------------------\n\n    def include(self,tokens):\n        # Try to extract the filename and then process an include file\n        if not tokens:\n            return\n        if tokens:\n            if tokens[0].value != '<' and tokens[0].type != self.t_STRING:\n                tokens = self.expand_macros(tokens)\n\n            if tokens[0].value == '<':\n                # Include <...>\n                i = 1\n                while i < len(tokens):\n                    if tokens[i].value == '>':\n                        break\n                    i += 1\n                else:\n                    print(\"Malformed #include <...>\")\n                    return\n                filename = \"\".join([x.value for x in tokens[1:i]])\n                path = self.path + [\"\"] + self.temp_path\n            elif tokens[0].type == self.t_STRING:\n                filename = tokens[0].value[1:-1]\n                path = self.temp_path + [\"\"] + self.path\n            else:\n                print(\"Malformed #include statement\")\n                return\n        for p in path:\n            iname = os.path.join(p,filename)\n            try:\n                data = open(iname,\"r\").read()\n                dname = os.path.dirname(iname)\n                if dname:\n                    self.temp_path.insert(0,dname)\n                for tok in self.parsegen(data,filename):\n                    yield tok\n                if dname:\n                    del self.temp_path[0]\n                break\n            except IOError:\n                pass\n        else:\n            print(\"Couldn't find '%s'\" % filename)\n\n    # ----------------------------------------------------------------------\n    # define()\n    #\n    # Define a new macro\n    # ----------------------------------------------------------------------\n\n    def define(self,tokens):\n        if isinstance(tokens,STRING_TYPES):\n            tokens = self.tokenize(tokens)\n\n        linetok = tokens\n        try:\n            name = linetok[0]\n            if len(linetok) > 1:\n                mtype = linetok[1]\n            else:\n                mtype = None\n            if not mtype:\n                m = Macro(name.value,[])\n                self.macros[name.value] = m\n            elif mtype.type in self.t_WS:\n                # A normal macro\n                m = Macro(name.value,self.tokenstrip(linetok[2:]))\n                self.macros[name.value] = m\n            elif mtype.value == '(':\n                # A macro with arguments\n                tokcount, args, positions = self.collect_args(linetok[1:])\n                variadic = False\n                for a in args:\n                    if variadic:\n                        print(\"No more arguments may follow a variadic argument\")\n                        break\n                    astr = \"\".join([str(_i.value) for _i in a])\n                    if astr == \"...\":\n                        variadic = True\n                        a[0].type = self.t_ID\n                        a[0].value = '__VA_ARGS__'\n                        variadic = True\n                        del a[1:]\n                        continue\n                    elif astr[-3:] == \"...\" and a[0].type == self.t_ID:\n                        variadic = True\n                        del a[1:]\n                        # If, for some reason, \".\" is part of the identifier, strip off the name for the purposes\n                        # of macro expansion\n                        if a[0].value[-3:] == '...':\n                            a[0].value = a[0].value[:-3]\n                        continue\n                    if len(a) > 1 or a[0].type != self.t_ID:\n                        print(\"Invalid macro argument\")\n                        break\n                else:\n                    mvalue = self.tokenstrip(linetok[1+tokcount:])\n                    i = 0\n                    while i < len(mvalue):\n                        if i+1 < len(mvalue):\n                            if mvalue[i].type in self.t_WS and mvalue[i+1].value == '##':\n                                del mvalue[i]\n                                continue\n                            elif mvalue[i].value == '##' and mvalue[i+1].type in self.t_WS:\n                                del mvalue[i+1]\n                        i += 1\n                    m = Macro(name.value,mvalue,[x[0].value for x in args],variadic)\n                    self.macro_prescan(m)\n                    self.macros[name.value] = m\n            else:\n                print(\"Bad macro definition\")\n        except LookupError:\n            print(\"Bad macro definition\")\n\n    # ----------------------------------------------------------------------\n    # undef()\n    #\n    # Undefine a macro\n    # ----------------------------------------------------------------------\n\n    def undef(self,tokens):\n        id = tokens[0].value\n        try:\n            del self.macros[id]\n        except LookupError:\n            pass\n\n    # ----------------------------------------------------------------------\n    # parse()\n    #\n    # Parse input text.\n    # ----------------------------------------------------------------------\n    def parse(self,input,source=None,ignore={}):\n        self.ignore = ignore\n        self.parser = self.parsegen(input,source)\n\n    # ----------------------------------------------------------------------\n    # token()\n    #\n    # Method to return individual tokens\n    # ----------------------------------------------------------------------\n    def token(self):\n        try:\n            while True:\n                tok = next(self.parser)\n                if tok.type not in self.ignore: return tok\n        except StopIteration:\n            self.parser = None\n            return None\n\nif __name__ == '__main__':\n    import ply.lex as lex\n    lexer = lex.lex()\n\n    # Run a preprocessor\n    import sys\n    f = open(sys.argv[1])\n    input = f.read()\n\n    p = Preprocessor(lexer)\n    p.parse(input,sys.argv[1])\n    while True:\n        tok = p.token()\n        if not tok: break\n        print(p.source, tok)\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":265,"id":11383,"name":"__doc__","nodeType":"Attribute","startLoc":265,"text":"self.__doc__"},{"col":0,"comment":"null","endLoc":469,"header":"def _funcs_to_names(funclist, namelist)","id":11384,"name":"_funcs_to_names","nodeType":"Function","startLoc":462,"text":"def _funcs_to_names(funclist, namelist):\n    result = []\n    for f, name in zip(funclist, namelist):\n        if f and f[0]:\n            result.append((name, f[1]))\n        else:\n            result.append(f)\n    return result"},{"col":4,"comment":"null","endLoc":887,"header":"def _masked_result(self, result, mask, out)","id":11385,"name":"_masked_result","nodeType":"Function","startLoc":865,"text":"def _masked_result(self, result, mask, out):\n        if isinstance(result, tuple):\n            if out is None:\n                out = (None,) * len(result)\n            if not isinstance(mask, (list, tuple)):\n                mask = (mask,) * len(result)\n            return tuple(self._masked_result(result_, mask_, out_)\n                         for (result_, mask_, out_) in zip(result, mask, out))\n\n        if out is None:\n            # Note that we cannot count on result being the same class as\n            # 'self' (e.g., comparison of quantity results in an ndarray, most\n            # operations on Longitude and Latitude result in Angle or\n            # Quantity), so use Masked to determine the appropriate class.\n            return Masked(result, mask)\n\n        # TODO: remove this sanity check once test cases are more complete.\n        assert isinstance(out, Masked)\n        # If we have an output, the result was written in-place, so we should\n        # also write the mask in-place (if not done already in the code).\n        if out._mask is not mask:\n            out._mask[...] = mask\n        return out"},{"id":11386,"name":"cextern","nodeType":"Package"},{"id":11387,"name":".gitignore","nodeType":"TextFile","path":"cextern","text":"!*.c\n"},{"id":11388,"name":"trim_cfitsio.sh","nodeType":"TextFile","path":"cextern","text":"#!/bin/sh\n\nset -euv\n\n# This script should be run every time cfitsio is updated.\n# This moves all the code needed for the actual library to lib\n# and deletes everything else (except License.txt and doc/changes.txt)\n\n# So, the standard update would be to execute, from this directory,\n# rm -rf cfitsio\n# tar xvf <PATH_TO_TAR>   # (e.g., cfitsio3410.tar.gz)\n# ./trim_cfitsio.sh\n\n\n# This just gets CORE_SOURCES from Makefile.in, excluding anything beyond zlib\nlib_files=`make -f cfitsio/Makefile.in cfitsioLibSrcs | sed 's/zlib\\/.*//'`\n# The include files cannot be directly inferred from Makefile.in\ninc_files='fitsio.h fitsio2.h longnam.h drvrsmem.h eval_defs.h eval_tab.h region.h group.h simplerng.h grparser.h'\n\nif [ ! -d cfitsio/lib ]; then\n    mkdir cfitsio/lib\nfi\n\nfor fil in $lib_files $inc_files; do\n    if [ -f cfitsio/$fil ]; then\n        mv cfitsio/$fil cfitsio/lib/\n    fi\ndone\n\nrm -f cfitsio/README\nrm -f cfitsio/configure\nrm -f cfitsio/install-sh\nrm -f cfitsio/docs/*.tex\nrm -f cfitsio/docs/*.ps\nrm -f cfitsio/docs/*.pdf\nrm -f cfitsio/docs/*.doc\nrm -f cfitsio/docs/*.toc\nrm -rf cfitsio/[^L]*.*\n\ncat <<EOF >cfitsio/README.txt\nNote: astropy only requires the CFITSIO library, and hence in this bundled version,\nwe removed all other files except the required license (License.txt) and changelog\n(docs/changes.txt, which has the version number).\nEOF\n"},{"id":11389,"name":"trim_expat.sh","nodeType":"TextFile","path":"cextern","text":"#!/bin/sh\n\nset -euv\n\n# This script should be run every time expat is updated.\n\n# So, the standard update would be to execute, from this directory:\n#\n# rm -rf expat\n# tar xvf <PATH_TO_TAR>   # (e.g., expat-2.2.6.tar.bz2)\n# cd expat\n# ./buildconf.sh\n# ./configure --without-getrandom --without-sys-getrandom\n# cp expat_config.h ../../astropy/utils/xml/src/\n# cd ..\n# ./trim_expat.sh\n# cd ..\n# git add . -u\n#\n# And if the trim script missed anything, try to remove the extra files\n# with a \"git clean -xdf\" command, do a local build, and run a full test suite\n# with \"pytest --remote-data\" to make sure we didn't accidentally deleted an\n# important file.\n\nrm -rf expat/{conftools,doc,examples,m4,test,win32,CMake*,configure*,Makefile*,lib/*vcxproj*,tests,*.cmake,aclocal.m4,run.sh.in,test-driver-wrapper.sh,expat.*,xmlwf}\n\ncat <<EOF >expat/README.txt\nNote: astropy only requires the expat library, and hence in this bundled version,\nwe removed all other files except the required license and changelog.\nEOF\n"},{"col":4,"comment":"null","endLoc":246,"header":"def readtab(self, tabfile, fdict)","id":11390,"name":"readtab","nodeType":"Function","startLoc":211,"text":"def readtab(self, tabfile, fdict):\n        if isinstance(tabfile, types.ModuleType):\n            lextab = tabfile\n        else:\n            exec('import %s' % tabfile)\n            lextab = sys.modules[tabfile]\n\n        if getattr(lextab, '_tabversion', '0.0') != __tabversion__:\n            raise ImportError('Inconsistent PLY version')\n\n        self.lextokens      = lextab._lextokens\n        self.lexreflags     = lextab._lexreflags\n        self.lexliterals    = lextab._lexliterals\n        self.lextokens_all  = self.lextokens | set(self.lexliterals)\n        self.lexstateinfo   = lextab._lexstateinfo\n        self.lexstateignore = lextab._lexstateignore\n        self.lexstatere     = {}\n        self.lexstateretext = {}\n        for statename, lre in lextab._lexstatere.items():\n            titem = []\n            txtitem = []\n            for pat, func_name in lre:\n                titem.append((re.compile(pat, lextab._lexreflags), _names_to_funcs(func_name, fdict)))\n\n            self.lexstatere[statename] = titem\n            self.lexstateretext[statename] = txtitem\n\n        self.lexstateerrorf = {}\n        for statename, ef in lextab._lexstateerrorf.items():\n            self.lexstateerrorf[statename] = fdict[ef]\n\n        self.lexstateeoff = {}\n        for statename, ef in lextab._lexstateeoff.items():\n            self.lexstateeoff[statename] = fdict[ef]\n\n        self.begin('INITIAL')"},{"col":4,"comment":"null","endLoc":849,"header":"def __array_function__(self, function, types, args, kwargs)","id":11391,"name":"__array_function__","nodeType":"Function","startLoc":803,"text":"def __array_function__(self, function, types, args, kwargs):\n        # TODO: go through functions systematically to see which ones\n        # work and/or can be supported.\n        if function in MASKED_SAFE_FUNCTIONS:\n            return super().__array_function__(function, types, args, kwargs)\n\n        elif function in APPLY_TO_BOTH_FUNCTIONS:\n            helper = APPLY_TO_BOTH_FUNCTIONS[function]\n            try:\n                helper_result = helper(*args, **kwargs)\n            except NotImplementedError:\n                return self._not_implemented_or_raise(function, types)\n\n            data_args, mask_args, kwargs, out = helper_result\n            if out is not None:\n                if not isinstance(out, Masked):\n                    return self._not_implemented_or_raise(function, types)\n                function(*mask_args, out=out.mask, **kwargs)\n                function(*data_args, out=out.unmasked, **kwargs)\n                return out\n\n            mask = function(*mask_args, **kwargs)\n            result = function(*data_args, **kwargs)\n\n        elif function in DISPATCHED_FUNCTIONS:\n            dispatched_function = DISPATCHED_FUNCTIONS[function]\n            try:\n                dispatched_result = dispatched_function(*args, **kwargs)\n            except NotImplementedError:\n                return self._not_implemented_or_raise(function, types)\n\n            if not isinstance(dispatched_result, tuple):\n                return dispatched_result\n\n            result, mask, out = dispatched_result\n\n        elif function in UNSUPPORTED_FUNCTIONS:\n            return NotImplemented\n\n        else:  # pragma: no cover\n            # By default, just pass it through for now.\n            return super().__array_function__(function, types, args, kwargs)\n\n        if mask is None:\n            return result\n        else:\n            return self._masked_result(result, mask, out)"},{"id":11392,"name":"README.rst","nodeType":"TextFile","path":"cextern","text":"External Packages/Libraries\n===========================\n\nThis directory contains C libraries included with Astropy. Note that only C\nlibraries without python-specific code  should be included in this directory.\nCython or C code intended for use with Astropy or wrapper code should be in\nthe Astropy source tree.\n\n"},{"className":"Macro","col":0,"comment":"null","endLoc":150,"id":11393,"nodeType":"Class","startLoc":142,"text":"class Macro(object):\n    def __init__(self,name,value,arglist=None,variadic=False):\n        self.name = name\n        self.value = value\n        self.arglist = arglist\n        self.variadic = variadic\n        if variadic:\n            self.vararg = arglist[-1]\n        self.source = None"},{"col":0,"comment":"null","endLoc":484,"header":"def _names_to_funcs(namelist, fdict)","id":11394,"name":"_names_to_funcs","nodeType":"Function","startLoc":477,"text":"def _names_to_funcs(namelist, fdict):\n    result = []\n    for n in namelist:\n        if n and n[0]:\n            result.append((fdict[n[0]], n[1]))\n        else:\n            result.append(n)\n    return result"},{"id":11395,"name":"trim_wcslib.sh","nodeType":"TextFile","path":"cextern","text":"#!/bin/sh\n\n# This script should be run every time wcslib is updated.\n\n# This removes extra large files from wcslib that aren't needed.\n\nrm -rf wcslib/C/test\nrm -rf wcslib/doxygen\nrm -rf wcslib/Fortran\nrm -rf wcslib/html\nrm -rf wcslib/pgsbox\nrm -rf wcslib/utils\nrm wcslib/*.pdf\n"},{"id":11396,"name":"astropy/extern/jquery","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/extern/jquery","id":11397,"nodeType":"File","text":""},{"col":4,"comment":"null","endLoc":863,"header":"def _not_implemented_or_raise(self, function, types)","id":11398,"name":"_not_implemented_or_raise","nodeType":"Function","startLoc":851,"text":"def _not_implemented_or_raise(self, function, types):\n        # Our function helper or dispatcher found that the function does not\n        # work with Masked.  In principle, there may be another class that\n        # knows what to do with us, for which we should return NotImplemented.\n        # But if there is ndarray (or a non-Masked subclass of it) around,\n        # it quite likely coerces, so we should just break.\n        if any(issubclass(t, np.ndarray) and not issubclass(t, Masked)\n               for t in types):\n            raise TypeError(\"the MaskedNDArray implementation cannot handle {} \"\n                            \"with the given arguments.\"\n                            .format(function)) from None\n        else:\n            return NotImplemented"},{"col":4,"comment":"null","endLoc":150,"header":"def __init__(self,name,value,arglist=None,variadic=False)","id":11399,"name":"__init__","nodeType":"Function","startLoc":143,"text":"def __init__(self,name,value,arglist=None,variadic=False):\n        self.name = name\n        self.value = value\n        self.arglist = arglist\n        self.variadic = variadic\n        if variadic:\n            self.vararg = arglist[-1]\n        self.source = None"},{"attributeType":"null","col":8,"comment":"null","endLoc":146,"id":11400,"name":"arglist","nodeType":"Attribute","startLoc":146,"text":"self.arglist"},{"col":0,"comment":"null","endLoc":197,"header":"def call_errorfunc(errorfunc, token, parser)","id":11401,"name":"call_errorfunc","nodeType":"Function","startLoc":187,"text":"def call_errorfunc(errorfunc, token, parser):\n    global _errok, _token, _restart\n    _errok = parser.errok\n    _token = parser.token\n    _restart = parser.restart\n    r = errorfunc(token)\n    try:\n        del _errok, _token, _restart\n    except NameError:\n        pass\n    return r"},{"col":4,"comment":"null","endLoc":271,"header":"def begin(self, state)","id":11402,"name":"begin","nodeType":"Function","startLoc":263,"text":"def begin(self, state):\n        if state not in self.lexstatere:\n            raise ValueError('Undefined state')\n        self.lexre = self.lexstatere[state]\n        self.lexretext = self.lexstateretext[state]\n        self.lexignore = self.lexstateignore.get(state, '')\n        self.lexerrorf = self.lexstateerrorf.get(state, None)\n        self.lexeoff = self.lexstateeoff.get(state, None)\n        self.lexstate = state"},{"attributeType":"null","col":12,"comment":"null","endLoc":149,"id":11403,"name":"vararg","nodeType":"Attribute","startLoc":149,"text":"self.vararg"},{"col":4,"comment":"null","endLoc":258,"header":"def input(self, s)","id":11404,"name":"input","nodeType":"Function","startLoc":251,"text":"def input(self, s):\n        # Pull off the first character to see if s looks like a string\n        c = s[:1]\n        if not isinstance(c, StringTypes):\n            raise ValueError('Expected a string')\n        self.lexdata = s\n        self.lexpos = 0\n        self.lexlen = len(s)"},{"col":4,"comment":"null","endLoc":278,"header":"def push_state(self, state)","id":11405,"name":"push_state","nodeType":"Function","startLoc":276,"text":"def push_state(self, state):\n        self.lexstatestack.append(self.lexstate)\n        self.begin(state)"},{"attributeType":"null","col":8,"comment":"null","endLoc":144,"id":11406,"name":"name","nodeType":"Attribute","startLoc":144,"text":"self.name"},{"attributeType":"null","col":8,"comment":"null","endLoc":147,"id":11407,"name":"variadic","nodeType":"Attribute","startLoc":147,"text":"self.variadic"},{"attributeType":"None","col":8,"comment":"null","endLoc":150,"id":11408,"name":"source","nodeType":"Attribute","startLoc":150,"text":"self.source"},{"col":4,"comment":"null","endLoc":284,"header":"def pop_state(self)","id":11409,"name":"pop_state","nodeType":"Function","startLoc":283,"text":"def pop_state(self):\n        self.begin(self.lexstatestack.pop())"},{"attributeType":"null","col":8,"comment":"null","endLoc":145,"id":11410,"name":"value","nodeType":"Attribute","startLoc":145,"text":"self.value"},{"col":4,"comment":"Get default where and initial for masked reductions.\n\n        Generally, the default should be to skip all masked elements.  For\n        reductions such as np.minimum.reduce, we also need an initial value,\n        which can be determined using ``initial_func``.\n\n        ","endLoc":903,"header":"def _reduce_defaults(self, kwargs, initial_func=None)","id":11411,"name":"_reduce_defaults","nodeType":"Function","startLoc":891,"text":"def _reduce_defaults(self, kwargs, initial_func=None):\n        \"\"\"Get default where and initial for masked reductions.\n\n        Generally, the default should be to skip all masked elements.  For\n        reductions such as np.minimum.reduce, we also need an initial value,\n        which can be determined using ``initial_func``.\n\n        \"\"\"\n        if 'where' not in kwargs:\n            kwargs['where'] = ~self.mask\n        if initial_func is not None and 'initial' not in kwargs:\n            kwargs['initial'] = initial_func(self.unmasked)\n        return kwargs"},{"className":"Preprocessor","col":0,"comment":"null","endLoc":898,"id":11412,"nodeType":"Class","startLoc":159,"text":"class Preprocessor(object):\n    def __init__(self,lexer=None):\n        if lexer is None:\n            lexer = lex.lexer\n        self.lexer = lexer\n        self.macros = { }\n        self.path = []\n        self.temp_path = []\n\n        # Probe the lexer for selected tokens\n        self.lexprobe()\n\n        tm = time.localtime()\n        self.define(\"__DATE__ \\\"%s\\\"\" % time.strftime(\"%b %d %Y\",tm))\n        self.define(\"__TIME__ \\\"%s\\\"\" % time.strftime(\"%H:%M:%S\",tm))\n        self.parser = None\n\n    # -----------------------------------------------------------------------------\n    # tokenize()\n    #\n    # Utility function. Given a string of text, tokenize into a list of tokens\n    # -----------------------------------------------------------------------------\n\n    def tokenize(self,text):\n        tokens = []\n        self.lexer.input(text)\n        while True:\n            tok = self.lexer.token()\n            if not tok: break\n            tokens.append(tok)\n        return tokens\n\n    # ---------------------------------------------------------------------\n    # error()\n    #\n    # Report a preprocessor error/warning of some kind\n    # ----------------------------------------------------------------------\n\n    def error(self,file,line,msg):\n        print(\"%s:%d %s\" % (file,line,msg))\n\n    # ----------------------------------------------------------------------\n    # lexprobe()\n    #\n    # This method probes the preprocessor lexer object to discover\n    # the token types of symbols that are important to the preprocessor.\n    # If this works right, the preprocessor will simply \"work\"\n    # with any suitable lexer regardless of how tokens have been named.\n    # ----------------------------------------------------------------------\n\n    def lexprobe(self):\n\n        # Determine the token type for identifiers\n        self.lexer.input(\"identifier\")\n        tok = self.lexer.token()\n        if not tok or tok.value != \"identifier\":\n            print(\"Couldn't determine identifier type\")\n        else:\n            self.t_ID = tok.type\n\n        # Determine the token type for integers\n        self.lexer.input(\"12345\")\n        tok = self.lexer.token()\n        if not tok or int(tok.value) != 12345:\n            print(\"Couldn't determine integer type\")\n        else:\n            self.t_INTEGER = tok.type\n            self.t_INTEGER_TYPE = type(tok.value)\n\n        # Determine the token type for strings enclosed in double quotes\n        self.lexer.input(\"\\\"filename\\\"\")\n        tok = self.lexer.token()\n        if not tok or tok.value != \"\\\"filename\\\"\":\n            print(\"Couldn't determine string type\")\n        else:\n            self.t_STRING = tok.type\n\n        # Determine the token type for whitespace--if any\n        self.lexer.input(\"  \")\n        tok = self.lexer.token()\n        if not tok or tok.value != \"  \":\n            self.t_SPACE = None\n        else:\n            self.t_SPACE = tok.type\n\n        # Determine the token type for newlines\n        self.lexer.input(\"\\n\")\n        tok = self.lexer.token()\n        if not tok or tok.value != \"\\n\":\n            self.t_NEWLINE = None\n            print(\"Couldn't determine token for newlines\")\n        else:\n            self.t_NEWLINE = tok.type\n\n        self.t_WS = (self.t_SPACE, self.t_NEWLINE)\n\n        # Check for other characters used by the preprocessor\n        chars = [ '<','>','#','##','\\\\','(',')',',','.']\n        for c in chars:\n            self.lexer.input(c)\n            tok = self.lexer.token()\n            if not tok or tok.value != c:\n                print(\"Unable to lex '%s' required for preprocessor\" % c)\n\n    # ----------------------------------------------------------------------\n    # add_path()\n    #\n    # Adds a search path to the preprocessor.\n    # ----------------------------------------------------------------------\n\n    def add_path(self,path):\n        self.path.append(path)\n\n    # ----------------------------------------------------------------------\n    # group_lines()\n    #\n    # Given an input string, this function splits it into lines.  Trailing whitespace\n    # is removed.   Any line ending with \\ is grouped with the next line.  This\n    # function forms the lowest level of the preprocessor---grouping into text into\n    # a line-by-line format.\n    # ----------------------------------------------------------------------\n\n    def group_lines(self,input):\n        lex = self.lexer.clone()\n        lines = [x.rstrip() for x in input.splitlines()]\n        for i in xrange(len(lines)):\n            j = i+1\n            while lines[i].endswith('\\\\') and (j < len(lines)):\n                lines[i] = lines[i][:-1]+lines[j]\n                lines[j] = \"\"\n                j += 1\n\n        input = \"\\n\".join(lines)\n        lex.input(input)\n        lex.lineno = 1\n\n        current_line = []\n        while True:\n            tok = lex.token()\n            if not tok:\n                break\n            current_line.append(tok)\n            if tok.type in self.t_WS and '\\n' in tok.value:\n                yield current_line\n                current_line = []\n\n        if current_line:\n            yield current_line\n\n    # ----------------------------------------------------------------------\n    # tokenstrip()\n    #\n    # Remove leading/trailing whitespace tokens from a token list\n    # ----------------------------------------------------------------------\n\n    def tokenstrip(self,tokens):\n        i = 0\n        while i < len(tokens) and tokens[i].type in self.t_WS:\n            i += 1\n        del tokens[:i]\n        i = len(tokens)-1\n        while i >= 0 and tokens[i].type in self.t_WS:\n            i -= 1\n        del tokens[i+1:]\n        return tokens\n\n\n    # ----------------------------------------------------------------------\n    # collect_args()\n    #\n    # Collects comma separated arguments from a list of tokens.   The arguments\n    # must be enclosed in parenthesis.  Returns a tuple (tokencount,args,positions)\n    # where tokencount is the number of tokens consumed, args is a list of arguments,\n    # and positions is a list of integers containing the starting index of each\n    # argument.  Each argument is represented by a list of tokens.\n    #\n    # When collecting arguments, leading and trailing whitespace is removed\n    # from each argument.\n    #\n    # This function properly handles nested parenthesis and commas---these do not\n    # define new arguments.\n    # ----------------------------------------------------------------------\n\n    def collect_args(self,tokenlist):\n        args = []\n        positions = []\n        current_arg = []\n        nesting = 1\n        tokenlen = len(tokenlist)\n\n        # Search for the opening '('.\n        i = 0\n        while (i < tokenlen) and (tokenlist[i].type in self.t_WS):\n            i += 1\n\n        if (i < tokenlen) and (tokenlist[i].value == '('):\n            positions.append(i+1)\n        else:\n            self.error(self.source,tokenlist[0].lineno,\"Missing '(' in macro arguments\")\n            return 0, [], []\n\n        i += 1\n\n        while i < tokenlen:\n            t = tokenlist[i]\n            if t.value == '(':\n                current_arg.append(t)\n                nesting += 1\n            elif t.value == ')':\n                nesting -= 1\n                if nesting == 0:\n                    if current_arg:\n                        args.append(self.tokenstrip(current_arg))\n                        positions.append(i)\n                    return i+1,args,positions\n                current_arg.append(t)\n            elif t.value == ',' and nesting == 1:\n                args.append(self.tokenstrip(current_arg))\n                positions.append(i+1)\n                current_arg = []\n            else:\n                current_arg.append(t)\n            i += 1\n\n        # Missing end argument\n        self.error(self.source,tokenlist[-1].lineno,\"Missing ')' in macro arguments\")\n        return 0, [],[]\n\n    # ----------------------------------------------------------------------\n    # macro_prescan()\n    #\n    # Examine the macro value (token sequence) and identify patch points\n    # This is used to speed up macro expansion later on---we'll know\n    # right away where to apply patches to the value to form the expansion\n    # ----------------------------------------------------------------------\n\n    def macro_prescan(self,macro):\n        macro.patch     = []             # Standard macro arguments\n        macro.str_patch = []             # String conversion expansion\n        macro.var_comma_patch = []       # Variadic macro comma patch\n        i = 0\n        while i < len(macro.value):\n            if macro.value[i].type == self.t_ID and macro.value[i].value in macro.arglist:\n                argnum = macro.arglist.index(macro.value[i].value)\n                # Conversion of argument to a string\n                if i > 0 and macro.value[i-1].value == '#':\n                    macro.value[i] = copy.copy(macro.value[i])\n                    macro.value[i].type = self.t_STRING\n                    del macro.value[i-1]\n                    macro.str_patch.append((argnum,i-1))\n                    continue\n                # Concatenation\n                elif (i > 0 and macro.value[i-1].value == '##'):\n                    macro.patch.append(('c',argnum,i-1))\n                    del macro.value[i-1]\n                    i -= 1\n                    continue\n                elif ((i+1) < len(macro.value) and macro.value[i+1].value == '##'):\n                    macro.patch.append(('c',argnum,i))\n                    del macro.value[i + 1]\n                    continue\n                # Standard expansion\n                else:\n                    macro.patch.append(('e',argnum,i))\n            elif macro.value[i].value == '##':\n                if macro.variadic and (i > 0) and (macro.value[i-1].value == ',') and \\\n                        ((i+1) < len(macro.value)) and (macro.value[i+1].type == self.t_ID) and \\\n                        (macro.value[i+1].value == macro.vararg):\n                    macro.var_comma_patch.append(i-1)\n            i += 1\n        macro.patch.sort(key=lambda x: x[2],reverse=True)\n\n    # ----------------------------------------------------------------------\n    # macro_expand_args()\n    #\n    # Given a Macro and list of arguments (each a token list), this method\n    # returns an expanded version of a macro.  The return value is a token sequence\n    # representing the replacement macro tokens\n    # ----------------------------------------------------------------------\n\n    def macro_expand_args(self,macro,args):\n        # Make a copy of the macro token sequence\n        rep = [copy.copy(_x) for _x in macro.value]\n\n        # Make string expansion patches.  These do not alter the length of the replacement sequence\n\n        str_expansion = {}\n        for argnum, i in macro.str_patch:\n            if argnum not in str_expansion:\n                str_expansion[argnum] = ('\"%s\"' % \"\".join([x.value for x in args[argnum]])).replace(\"\\\\\",\"\\\\\\\\\")\n            rep[i] = copy.copy(rep[i])\n            rep[i].value = str_expansion[argnum]\n\n        # Make the variadic macro comma patch.  If the variadic macro argument is empty, we get rid\n        comma_patch = False\n        if macro.variadic and not args[-1]:\n            for i in macro.var_comma_patch:\n                rep[i] = None\n                comma_patch = True\n\n        # Make all other patches.   The order of these matters.  It is assumed that the patch list\n        # has been sorted in reverse order of patch location since replacements will cause the\n        # size of the replacement sequence to expand from the patch point.\n\n        expanded = { }\n        for ptype, argnum, i in macro.patch:\n            # Concatenation.   Argument is left unexpanded\n            if ptype == 'c':\n                rep[i:i+1] = args[argnum]\n            # Normal expansion.  Argument is macro expanded first\n            elif ptype == 'e':\n                if argnum not in expanded:\n                    expanded[argnum] = self.expand_macros(args[argnum])\n                rep[i:i+1] = expanded[argnum]\n\n        # Get rid of removed comma if necessary\n        if comma_patch:\n            rep = [_i for _i in rep if _i]\n\n        return rep\n\n\n    # ----------------------------------------------------------------------\n    # expand_macros()\n    #\n    # Given a list of tokens, this function performs macro expansion.\n    # The expanded argument is a dictionary that contains macros already\n    # expanded.  This is used to prevent infinite recursion.\n    # ----------------------------------------------------------------------\n\n    def expand_macros(self,tokens,expanded=None):\n        if expanded is None:\n            expanded = {}\n        i = 0\n        while i < len(tokens):\n            t = tokens[i]\n            if t.type == self.t_ID:\n                if t.value in self.macros and t.value not in expanded:\n                    # Yes, we found a macro match\n                    expanded[t.value] = True\n\n                    m = self.macros[t.value]\n                    if not m.arglist:\n                        # A simple macro\n                        ex = self.expand_macros([copy.copy(_x) for _x in m.value],expanded)\n                        for e in ex:\n                            e.lineno = t.lineno\n                        tokens[i:i+1] = ex\n                        i += len(ex)\n                    else:\n                        # A macro with arguments\n                        j = i + 1\n                        while j < len(tokens) and tokens[j].type in self.t_WS:\n                            j += 1\n                        if j < len(tokens) and tokens[j].value == '(':\n                            tokcount,args,positions = self.collect_args(tokens[j:])\n                            if not m.variadic and len(args) !=  len(m.arglist):\n                                self.error(self.source,t.lineno,\"Macro %s requires %d arguments\" % (t.value,len(m.arglist)))\n                                i = j + tokcount\n                            elif m.variadic and len(args) < len(m.arglist)-1:\n                                if len(m.arglist) > 2:\n                                    self.error(self.source,t.lineno,\"Macro %s must have at least %d arguments\" % (t.value, len(m.arglist)-1))\n                                else:\n                                    self.error(self.source,t.lineno,\"Macro %s must have at least %d argument\" % (t.value, len(m.arglist)-1))\n                                i = j + tokcount\n                            else:\n                                if m.variadic:\n                                    if len(args) == len(m.arglist)-1:\n                                        args.append([])\n                                    else:\n                                        args[len(m.arglist)-1] = tokens[j+positions[len(m.arglist)-1]:j+tokcount-1]\n                                        del args[len(m.arglist):]\n\n                                # Get macro replacement text\n                                rep = self.macro_expand_args(m,args)\n                                rep = self.expand_macros(rep,expanded)\n                                for r in rep:\n                                    r.lineno = t.lineno\n                                tokens[i:j+tokcount] = rep\n                                i += len(rep)\n                        else:\n                            # This is not a macro. It is just a word which\n                            # equals to name of the macro. Hence, go to the\n                            # next token.\n                            i += 1\n\n                    del expanded[t.value]\n                    continue\n                elif t.value == '__LINE__':\n                    t.type = self.t_INTEGER\n                    t.value = self.t_INTEGER_TYPE(t.lineno)\n\n            i += 1\n        return tokens\n\n    # ----------------------------------------------------------------------\n    # evalexpr()\n    #\n    # Evaluate an expression token sequence for the purposes of evaluating\n    # integral expressions.\n    # ----------------------------------------------------------------------\n\n    def evalexpr(self,tokens):\n        # tokens = tokenize(line)\n        # Search for defined macros\n        i = 0\n        while i < len(tokens):\n            if tokens[i].type == self.t_ID and tokens[i].value == 'defined':\n                j = i + 1\n                needparen = False\n                result = \"0L\"\n                while j < len(tokens):\n                    if tokens[j].type in self.t_WS:\n                        j += 1\n                        continue\n                    elif tokens[j].type == self.t_ID:\n                        if tokens[j].value in self.macros:\n                            result = \"1L\"\n                        else:\n                            result = \"0L\"\n                        if not needparen: break\n                    elif tokens[j].value == '(':\n                        needparen = True\n                    elif tokens[j].value == ')':\n                        break\n                    else:\n                        self.error(self.source,tokens[i].lineno,\"Malformed defined()\")\n                    j += 1\n                tokens[i].type = self.t_INTEGER\n                tokens[i].value = self.t_INTEGER_TYPE(result)\n                del tokens[i+1:j+1]\n            i += 1\n        tokens = self.expand_macros(tokens)\n        for i,t in enumerate(tokens):\n            if t.type == self.t_ID:\n                tokens[i] = copy.copy(t)\n                tokens[i].type = self.t_INTEGER\n                tokens[i].value = self.t_INTEGER_TYPE(\"0L\")\n            elif t.type == self.t_INTEGER:\n                tokens[i] = copy.copy(t)\n                # Strip off any trailing suffixes\n                tokens[i].value = str(tokens[i].value)\n                while tokens[i].value[-1] not in \"0123456789abcdefABCDEF\":\n                    tokens[i].value = tokens[i].value[:-1]\n\n        expr = \"\".join([str(x.value) for x in tokens])\n        expr = expr.replace(\"&&\",\" and \")\n        expr = expr.replace(\"||\",\" or \")\n        expr = expr.replace(\"!\",\" not \")\n        try:\n            result = eval(expr)\n        except Exception:\n            self.error(self.source,tokens[0].lineno,\"Couldn't evaluate expression\")\n            result = 0\n        return result\n\n    # ----------------------------------------------------------------------\n    # parsegen()\n    #\n    # Parse an input string/\n    # ----------------------------------------------------------------------\n    def parsegen(self,input,source=None):\n\n        # Replace trigraph sequences\n        t = trigraph(input)\n        lines = self.group_lines(t)\n\n        if not source:\n            source = \"\"\n\n        self.define(\"__FILE__ \\\"%s\\\"\" % source)\n\n        self.source = source\n        chunk = []\n        enable = True\n        iftrigger = False\n        ifstack = []\n\n        for x in lines:\n            for i,tok in enumerate(x):\n                if tok.type not in self.t_WS: break\n            if tok.value == '#':\n                # Preprocessor directive\n\n                # insert necessary whitespace instead of eaten tokens\n                for tok in x:\n                    if tok.type in self.t_WS and '\\n' in tok.value:\n                        chunk.append(tok)\n\n                dirtokens = self.tokenstrip(x[i+1:])\n                if dirtokens:\n                    name = dirtokens[0].value\n                    args = self.tokenstrip(dirtokens[1:])\n                else:\n                    name = \"\"\n                    args = []\n\n                if name == 'define':\n                    if enable:\n                        for tok in self.expand_macros(chunk):\n                            yield tok\n                        chunk = []\n                        self.define(args)\n                elif name == 'include':\n                    if enable:\n                        for tok in self.expand_macros(chunk):\n                            yield tok\n                        chunk = []\n                        oldfile = self.macros['__FILE__']\n                        for tok in self.include(args):\n                            yield tok\n                        self.macros['__FILE__'] = oldfile\n                        self.source = source\n                elif name == 'undef':\n                    if enable:\n                        for tok in self.expand_macros(chunk):\n                            yield tok\n                        chunk = []\n                        self.undef(args)\n                elif name == 'ifdef':\n                    ifstack.append((enable,iftrigger))\n                    if enable:\n                        if not args[0].value in self.macros:\n                            enable = False\n                            iftrigger = False\n                        else:\n                            iftrigger = True\n                elif name == 'ifndef':\n                    ifstack.append((enable,iftrigger))\n                    if enable:\n                        if args[0].value in self.macros:\n                            enable = False\n                            iftrigger = False\n                        else:\n                            iftrigger = True\n                elif name == 'if':\n                    ifstack.append((enable,iftrigger))\n                    if enable:\n                        result = self.evalexpr(args)\n                        if not result:\n                            enable = False\n                            iftrigger = False\n                        else:\n                            iftrigger = True\n                elif name == 'elif':\n                    if ifstack:\n                        if ifstack[-1][0]:     # We only pay attention if outer \"if\" allows this\n                            if enable:         # If already true, we flip enable False\n                                enable = False\n                            elif not iftrigger:   # If False, but not triggered yet, we'll check expression\n                                result = self.evalexpr(args)\n                                if result:\n                                    enable  = True\n                                    iftrigger = True\n                    else:\n                        self.error(self.source,dirtokens[0].lineno,\"Misplaced #elif\")\n\n                elif name == 'else':\n                    if ifstack:\n                        if ifstack[-1][0]:\n                            if enable:\n                                enable = False\n                            elif not iftrigger:\n                                enable = True\n                                iftrigger = True\n                    else:\n                        self.error(self.source,dirtokens[0].lineno,\"Misplaced #else\")\n\n                elif name == 'endif':\n                    if ifstack:\n                        enable,iftrigger = ifstack.pop()\n                    else:\n                        self.error(self.source,dirtokens[0].lineno,\"Misplaced #endif\")\n                else:\n                    # Unknown preprocessor directive\n                    pass\n\n            else:\n                # Normal text\n                if enable:\n                    chunk.extend(x)\n\n        for tok in self.expand_macros(chunk):\n            yield tok\n        chunk = []\n\n    # ----------------------------------------------------------------------\n    # include()\n    #\n    # Implementation of file-inclusion\n    # ----------------------------------------------------------------------\n\n    def include(self,tokens):\n        # Try to extract the filename and then process an include file\n        if not tokens:\n            return\n        if tokens:\n            if tokens[0].value != '<' and tokens[0].type != self.t_STRING:\n                tokens = self.expand_macros(tokens)\n\n            if tokens[0].value == '<':\n                # Include <...>\n                i = 1\n                while i < len(tokens):\n                    if tokens[i].value == '>':\n                        break\n                    i += 1\n                else:\n                    print(\"Malformed #include <...>\")\n                    return\n                filename = \"\".join([x.value for x in tokens[1:i]])\n                path = self.path + [\"\"] + self.temp_path\n            elif tokens[0].type == self.t_STRING:\n                filename = tokens[0].value[1:-1]\n                path = self.temp_path + [\"\"] + self.path\n            else:\n                print(\"Malformed #include statement\")\n                return\n        for p in path:\n            iname = os.path.join(p,filename)\n            try:\n                data = open(iname,\"r\").read()\n                dname = os.path.dirname(iname)\n                if dname:\n                    self.temp_path.insert(0,dname)\n                for tok in self.parsegen(data,filename):\n                    yield tok\n                if dname:\n                    del self.temp_path[0]\n                break\n            except IOError:\n                pass\n        else:\n            print(\"Couldn't find '%s'\" % filename)\n\n    # ----------------------------------------------------------------------\n    # define()\n    #\n    # Define a new macro\n    # ----------------------------------------------------------------------\n\n    def define(self,tokens):\n        if isinstance(tokens,STRING_TYPES):\n            tokens = self.tokenize(tokens)\n\n        linetok = tokens\n        try:\n            name = linetok[0]\n            if len(linetok) > 1:\n                mtype = linetok[1]\n            else:\n                mtype = None\n            if not mtype:\n                m = Macro(name.value,[])\n                self.macros[name.value] = m\n            elif mtype.type in self.t_WS:\n                # A normal macro\n                m = Macro(name.value,self.tokenstrip(linetok[2:]))\n                self.macros[name.value] = m\n            elif mtype.value == '(':\n                # A macro with arguments\n                tokcount, args, positions = self.collect_args(linetok[1:])\n                variadic = False\n                for a in args:\n                    if variadic:\n                        print(\"No more arguments may follow a variadic argument\")\n                        break\n                    astr = \"\".join([str(_i.value) for _i in a])\n                    if astr == \"...\":\n                        variadic = True\n                        a[0].type = self.t_ID\n                        a[0].value = '__VA_ARGS__'\n                        variadic = True\n                        del a[1:]\n                        continue\n                    elif astr[-3:] == \"...\" and a[0].type == self.t_ID:\n                        variadic = True\n                        del a[1:]\n                        # If, for some reason, \".\" is part of the identifier, strip off the name for the purposes\n                        # of macro expansion\n                        if a[0].value[-3:] == '...':\n                            a[0].value = a[0].value[:-3]\n                        continue\n                    if len(a) > 1 or a[0].type != self.t_ID:\n                        print(\"Invalid macro argument\")\n                        break\n                else:\n                    mvalue = self.tokenstrip(linetok[1+tokcount:])\n                    i = 0\n                    while i < len(mvalue):\n                        if i+1 < len(mvalue):\n                            if mvalue[i].type in self.t_WS and mvalue[i+1].value == '##':\n                                del mvalue[i]\n                                continue\n                            elif mvalue[i].value == '##' and mvalue[i+1].type in self.t_WS:\n                                del mvalue[i+1]\n                        i += 1\n                    m = Macro(name.value,mvalue,[x[0].value for x in args],variadic)\n                    self.macro_prescan(m)\n                    self.macros[name.value] = m\n            else:\n                print(\"Bad macro definition\")\n        except LookupError:\n            print(\"Bad macro definition\")\n\n    # ----------------------------------------------------------------------\n    # undef()\n    #\n    # Undefine a macro\n    # ----------------------------------------------------------------------\n\n    def undef(self,tokens):\n        id = tokens[0].value\n        try:\n            del self.macros[id]\n        except LookupError:\n            pass\n\n    # ----------------------------------------------------------------------\n    # parse()\n    #\n    # Parse input text.\n    # ----------------------------------------------------------------------\n    def parse(self,input,source=None,ignore={}):\n        self.ignore = ignore\n        self.parser = self.parsegen(input,source)\n\n    # ----------------------------------------------------------------------\n    # token()\n    #\n    # Method to return individual tokens\n    # ----------------------------------------------------------------------\n    def token(self):\n        try:\n            while True:\n                tok = next(self.parser)\n                if tok.type not in self.ignore: return tok\n        except StopIteration:\n            self.parser = None\n            return None"},{"col":4,"comment":"null","endLoc":290,"header":"def current_state(self)","id":11413,"name":"current_state","nodeType":"Function","startLoc":289,"text":"def current_state(self):\n        return self.lexstate"},{"col":4,"comment":"null","endLoc":296,"header":"def skip(self, n)","id":11414,"name":"skip","nodeType":"Function","startLoc":295,"text":"def skip(self, n):\n        self.lexpos += n"},{"col":4,"comment":"null","endLoc":412,"header":"def token(self)","id":11415,"name":"token","nodeType":"Function","startLoc":305,"text":"def token(self):\n        # Make local copies of frequently referenced attributes\n        lexpos    = self.lexpos\n        lexlen    = self.lexlen\n        lexignore = self.lexignore\n        lexdata   = self.lexdata\n\n        while lexpos < lexlen:\n            # This code provides some short-circuit code for whitespace, tabs, and other ignored characters\n            if lexdata[lexpos] in lexignore:\n                lexpos += 1\n                continue\n\n            # Look for a regular expression match\n            for lexre, lexindexfunc in self.lexre:\n                m = lexre.match(lexdata, lexpos)\n                if not m:\n                    continue\n\n                # Create a token for return\n                tok = LexToken()\n                tok.value = m.group()\n                tok.lineno = self.lineno\n                tok.lexpos = lexpos\n\n                i = m.lastindex\n                func, tok.type = lexindexfunc[i]\n\n                if not func:\n                    # If no token type was set, it's an ignored token\n                    if tok.type:\n                        self.lexpos = m.end()\n                        return tok\n                    else:\n                        lexpos = m.end()\n                        break\n\n                lexpos = m.end()\n\n                # If token is processed by a function, call it\n\n                tok.lexer = self      # Set additional attributes useful in token rules\n                self.lexmatch = m\n                self.lexpos = lexpos\n\n                newtok = func(tok)\n\n                # Every function must return a token, if nothing, we just move to next token\n                if not newtok:\n                    lexpos    = self.lexpos         # This is here in case user has updated lexpos.\n                    lexignore = self.lexignore      # This is here in case there was a state change\n                    break\n\n                # Verify type of the token.  If not in the token map, raise an error\n                if not self.lexoptimize:\n                    if newtok.type not in self.lextokens_all:\n                        raise LexError(\"%s:%d: Rule '%s' returned an unknown token type '%s'\" % (\n                            func.__code__.co_filename, func.__code__.co_firstlineno,\n                            func.__name__, newtok.type), lexdata[lexpos:])\n\n                return newtok\n            else:\n                # No match, see if in literals\n                if lexdata[lexpos] in self.lexliterals:\n                    tok = LexToken()\n                    tok.value = lexdata[lexpos]\n                    tok.lineno = self.lineno\n                    tok.type = tok.value\n                    tok.lexpos = lexpos\n                    self.lexpos = lexpos + 1\n                    return tok\n\n                # No match. Call t_error() if defined.\n                if self.lexerrorf:\n                    tok = LexToken()\n                    tok.value = self.lexdata[lexpos:]\n                    tok.lineno = self.lineno\n                    tok.type = 'error'\n                    tok.lexer = self\n                    tok.lexpos = lexpos\n                    self.lexpos = lexpos\n                    newtok = self.lexerrorf(tok)\n                    if lexpos == self.lexpos:\n                        # Error method didn't change text position at all. This is an error.\n                        raise LexError(\"Scanning error. Illegal character '%s'\" % (lexdata[lexpos]), lexdata[lexpos:])\n                    lexpos = self.lexpos\n                    if not newtok:\n                        continue\n                    return newtok\n\n                self.lexpos = lexpos\n                raise LexError(\"Illegal character '%s' at index %d\" % (lexdata[lexpos], lexpos), lexdata[lexpos:])\n\n        if self.lexeoff:\n            tok = LexToken()\n            tok.type = 'eof'\n            tok.value = ''\n            tok.lineno = self.lineno\n            tok.lexpos = lexpos\n            tok.lexer = self\n            self.lexpos = lexpos\n            newtok = self.lexeoff(tok)\n            return newtok\n\n        self.lexpos = lexpos + 1\n        if self.lexdata is None:\n            raise RuntimeError('No input string given with input()')\n        return None"},{"col":4,"comment":"null","endLoc":909,"header":"def trace(self, offset=0, axis1=0, axis2=1, dtype=None, out=None)","id":11416,"name":"trace","nodeType":"Function","startLoc":905,"text":"def trace(self, offset=0, axis1=0, axis2=1, dtype=None, out=None):\n        # Unfortunately, cannot override the call to diagonal inside trace, so\n        # duplicate implementation in numpy/core/src/multiarray/calculation.c.\n        diagonal = self.diagonal(offset=offset, axis1=axis1, axis2=axis2)\n        return diagonal.sum(-1, dtype=dtype, out=out)"},{"id":11417,"name":"astropy/extern/jquery/data/js","nodeType":"Package"},{"id":11418,"name":"jquery.dataTables.js","nodeType":"TextFile","path":"astropy/extern/jquery/data/js","text":"/*! DataTables 1.10.12\n * ©2008-2015 SpryMedia Ltd - datatables.net/license\n */\n\n/**\n * @summary     DataTables\n * @description Paginate, search and order HTML tables\n * @version     1.10.12\n * @file        jquery.dataTables.js\n * @author      SpryMedia Ltd (www.sprymedia.co.uk)\n * @contact     www.sprymedia.co.uk/contact\n * @copyright   Copyright 2008-2015 SpryMedia Ltd.\n *\n * This source file is free software, available under the following license:\n *   MIT license - http://datatables.net/license\n *\n * This source file is distributed in the hope that it will be useful, but\n * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\n * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.\n *\n * For details please refer to: http://www.datatables.net\n */\n\n/*jslint evil: true, undef: true, browser: true */\n/*globals $,require,jQuery,define,_selector_run,_selector_opts,_selector_first,_selector_row_indexes,_ext,_Api,_api_register,_api_registerPlural,_re_new_lines,_re_html,_re_formatted_numeric,_re_escape_regex,_empty,_intVal,_numToDecimal,_isNumber,_isHtml,_htmlNumeric,_pluck,_pluck_order,_range,_stripHtml,_unique,_fnBuildAjax,_fnAjaxUpdate,_fnAjaxParameters,_fnAjaxUpdateDraw,_fnAjaxDataSrc,_fnAddColumn,_fnColumnOptions,_fnAdjustColumnSizing,_fnVisibleToColumnIndex,_fnColumnIndexToVisible,_fnVisbleColumns,_fnGetColumns,_fnColumnTypes,_fnApplyColumnDefs,_fnHungarianMap,_fnCamelToHungarian,_fnLanguageCompat,_fnBrowserDetect,_fnAddData,_fnAddTr,_fnNodeToDataIndex,_fnNodeToColumnIndex,_fnGetCellData,_fnSetCellData,_fnSplitObjNotation,_fnGetObjectDataFn,_fnSetObjectDataFn,_fnGetDataMaster,_fnClearTable,_fnDeleteIndex,_fnInvalidate,_fnGetRowElements,_fnCreateTr,_fnBuildHead,_fnDrawHead,_fnDraw,_fnReDraw,_fnAddOptionsHtml,_fnDetectHeader,_fnGetUniqueThs,_fnFeatureHtmlFilter,_fnFilterComplete,_fnFilterCustom,_fnFilterColumn,_fnFilter,_fnFilterCreateSearch,_fnEscapeRegex,_fnFilterData,_fnFeatureHtmlInfo,_fnUpdateInfo,_fnInfoMacros,_fnInitialise,_fnInitComplete,_fnLengthChange,_fnFeatureHtmlLength,_fnFeatureHtmlPaginate,_fnPageChange,_fnFeatureHtmlProcessing,_fnProcessingDisplay,_fnFeatureHtmlTable,_fnScrollDraw,_fnApplyToChildren,_fnCalculateColumnWidths,_fnThrottle,_fnConvertToWidth,_fnGetWidestNode,_fnGetMaxLenString,_fnStringToCss,_fnSortFlatten,_fnSort,_fnSortAria,_fnSortListener,_fnSortAttachListener,_fnSortingClasses,_fnSortData,_fnSaveState,_fnLoadState,_fnSettingsFromNode,_fnLog,_fnMap,_fnBindAction,_fnCallbackReg,_fnCallbackFire,_fnLengthOverflow,_fnRenderer,_fnDataSource,_fnRowAttributes*/\n\n(function( factory ) {\n\t\"use strict\";\n\n\tif ( typeof define === 'function' && define.amd ) {\n\t\t// AMD\n\t\tdefine( ['jquery'], function ( $ ) {\n\t\t\treturn factory( $, window, document );\n\t\t} );\n\t}\n\telse if ( typeof exports === 'object' ) {\n\t\t// CommonJS\n\t\tmodule.exports = function (root, $) {\n\t\t\tif ( ! root ) {\n\t\t\t\t// CommonJS environments without a window global must pass a\n\t\t\t\t// root. This will give an error otherwise\n\t\t\t\troot = window;\n\t\t\t}\n\n\t\t\tif ( ! $ ) {\n\t\t\t\t$ = typeof window !== 'undefined' ? // jQuery's factory checks for a global window\n\t\t\t\t\trequire('jquery') :\n\t\t\t\t\trequire('jquery')( root );\n\t\t\t}\n\n\t\t\treturn factory( $, root, root.document );\n\t\t};\n\t}\n\telse {\n\t\t// Browser\n\t\tfactory( jQuery, window, document );\n\t}\n}\n(function( $, window, document, undefined ) {\n\t\"use strict\";\n\n\t/**\n\t * DataTables is a plug-in for the jQuery Javascript library. It is a highly\n\t * flexible tool, based upon the foundations of progressive enhancement,\n\t * which will add advanced interaction controls to any HTML table. For a\n\t * full list of features please refer to\n\t * [DataTables.net](href=\"http://datatables.net).\n\t *\n\t * Note that the `DataTable` object is not a global variable but is aliased\n\t * to `jQuery.fn.DataTable` and `jQuery.fn.dataTable` through which it may\n\t * be  accessed.\n\t *\n\t *  @class\n\t *  @param {object} [init={}] Configuration object for DataTables. Options\n\t *    are defined by {@link DataTable.defaults}\n\t *  @requires jQuery 1.7+\n\t *\n\t *  @example\n\t *    // Basic initialisation\n\t *    $(document).ready( function {\n\t *      $('#example').dataTable();\n\t *    } );\n\t *\n\t *  @example\n\t *    // Initialisation with configuration options - in this case, disable\n\t *    // pagination and sorting.\n\t *    $(document).ready( function {\n\t *      $('#example').dataTable( {\n\t *        \"paginate\": false,\n\t *        \"sort\": false\n\t *      } );\n\t *    } );\n\t */\n\tvar DataTable = function ( options )\n\t{\n\t\t/**\n\t\t * Perform a jQuery selector action on the table's TR elements (from the tbody) and\n\t\t * return the resulting jQuery object.\n\t\t *  @param {string|node|jQuery} sSelector jQuery selector or node collection to act on\n\t\t *  @param {object} [oOpts] Optional parameters for modifying the rows to be included\n\t\t *  @param {string} [oOpts.filter=none] Select TR elements that meet the current filter\n\t\t *    criterion (\"applied\") or all TR elements (i.e. no filter).\n\t\t *  @param {string} [oOpts.order=current] Order of the TR elements in the processed array.\n\t\t *    Can be either 'current', whereby the current sorting of the table is used, or\n\t\t *    'original' whereby the original order the data was read into the table is used.\n\t\t *  @param {string} [oOpts.page=all] Limit the selection to the currently displayed page\n\t\t *    (\"current\") or not (\"all\"). If 'current' is given, then order is assumed to be\n\t\t *    'current' and filter is 'applied', regardless of what they might be given as.\n\t\t *  @returns {object} jQuery object, filtered by the given selector.\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable = $('#example').dataTable();\n\t\t *\n\t\t *      // Highlight every second row\n\t\t *      oTable.$('tr:odd').css('backgroundColor', 'blue');\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable = $('#example').dataTable();\n\t\t *\n\t\t *      // Filter to rows with 'Webkit' in them, add a background colour and then\n\t\t *      // remove the filter, thus highlighting the 'Webkit' rows only.\n\t\t *      oTable.fnFilter('Webkit');\n\t\t *      oTable.$('tr', {\"search\": \"applied\"}).css('backgroundColor', 'blue');\n\t\t *      oTable.fnFilter('');\n\t\t *    } );\n\t\t */\n\t\tthis.$ = function ( sSelector, oOpts )\n\t\t{\n\t\t\treturn this.api(true).$( sSelector, oOpts );\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Almost identical to $ in operation, but in this case returns the data for the matched\n\t\t * rows - as such, the jQuery selector used should match TR row nodes or TD/TH cell nodes\n\t\t * rather than any descendants, so the data can be obtained for the row/cell. If matching\n\t\t * rows are found, the data returned is the original data array/object that was used to\n\t\t * create the row (or a generated array if from a DOM source).\n\t\t *\n\t\t * This method is often useful in-combination with $ where both functions are given the\n\t\t * same parameters and the array indexes will match identically.\n\t\t *  @param {string|node|jQuery} sSelector jQuery selector or node collection to act on\n\t\t *  @param {object} [oOpts] Optional parameters for modifying the rows to be included\n\t\t *  @param {string} [oOpts.filter=none] Select elements that meet the current filter\n\t\t *    criterion (\"applied\") or all elements (i.e. no filter).\n\t\t *  @param {string} [oOpts.order=current] Order of the data in the processed array.\n\t\t *    Can be either 'current', whereby the current sorting of the table is used, or\n\t\t *    'original' whereby the original order the data was read into the table is used.\n\t\t *  @param {string} [oOpts.page=all] Limit the selection to the currently displayed page\n\t\t *    (\"current\") or not (\"all\"). If 'current' is given, then order is assumed to be\n\t\t *    'current' and filter is 'applied', regardless of what they might be given as.\n\t\t *  @returns {array} Data for the matched elements. If any elements, as a result of the\n\t\t *    selector, were not TR, TD or TH elements in the DataTable, they will have a null\n\t\t *    entry in the array.\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable = $('#example').dataTable();\n\t\t *\n\t\t *      // Get the data from the first row in the table\n\t\t *      var data = oTable._('tr:first');\n\t\t *\n\t\t *      // Do something useful with the data\n\t\t *      alert( \"First cell is: \"+data[0] );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable = $('#example').dataTable();\n\t\t *\n\t\t *      // Filter to 'Webkit' and get all data for\n\t\t *      oTable.fnFilter('Webkit');\n\t\t *      var data = oTable._('tr', {\"search\": \"applied\"});\n\t\t *\n\t\t *      // Do something with the data\n\t\t *      alert( data.length+\" rows matched the search\" );\n\t\t *    } );\n\t\t */\n\t\tthis._ = function ( sSelector, oOpts )\n\t\t{\n\t\t\treturn this.api(true).rows( sSelector, oOpts ).data();\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Create a DataTables Api instance, with the currently selected tables for\n\t\t * the Api's context.\n\t\t * @param {boolean} [traditional=false] Set the API instance's context to be\n\t\t *   only the table referred to by the `DataTable.ext.iApiIndex` option, as was\n\t\t *   used in the API presented by DataTables 1.9- (i.e. the traditional mode),\n\t\t *   or if all tables captured in the jQuery object should be used.\n\t\t * @return {DataTables.Api}\n\t\t */\n\t\tthis.api = function ( traditional )\n\t\t{\n\t\t\treturn traditional ?\n\t\t\t\tnew _Api(\n\t\t\t\t\t_fnSettingsFromNode( this[ _ext.iApiIndex ] )\n\t\t\t\t) :\n\t\t\t\tnew _Api( this );\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Add a single new row or multiple rows of data to the table. Please note\n\t\t * that this is suitable for client-side processing only - if you are using\n\t\t * server-side processing (i.e. \"bServerSide\": true), then to add data, you\n\t\t * must add it to the data source, i.e. the server-side, through an Ajax call.\n\t\t *  @param {array|object} data The data to be added to the table. This can be:\n\t\t *    <ul>\n\t\t *      <li>1D array of data - add a single row with the data provided</li>\n\t\t *      <li>2D array of arrays - add multiple rows in a single call</li>\n\t\t *      <li>object - data object when using <i>mData</i></li>\n\t\t *      <li>array of objects - multiple data objects when using <i>mData</i></li>\n\t\t *    </ul>\n\t\t *  @param {bool} [redraw=true] redraw the table or not\n\t\t *  @returns {array} An array of integers, representing the list of indexes in\n\t\t *    <i>aoData</i> ({@link DataTable.models.oSettings}) that have been added to\n\t\t *    the table.\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    // Global var for counter\n\t\t *    var giCount = 2;\n\t\t *\n\t\t *    $(document).ready(function() {\n\t\t *      $('#example').dataTable();\n\t\t *    } );\n\t\t *\n\t\t *    function fnClickAddRow() {\n\t\t *      $('#example').dataTable().fnAddData( [\n\t\t *        giCount+\".1\",\n\t\t *        giCount+\".2\",\n\t\t *        giCount+\".3\",\n\t\t *        giCount+\".4\" ]\n\t\t *      );\n\t\t *\n\t\t *      giCount++;\n\t\t *    }\n\t\t */\n\t\tthis.fnAddData = function( data, redraw )\n\t\t{\n\t\t\tvar api = this.api( true );\n\t\t\n\t\t\t/* Check if we want to add multiple rows or not */\n\t\t\tvar rows = $.isArray(data) && ( $.isArray(data[0]) || $.isPlainObject(data[0]) ) ?\n\t\t\t\tapi.rows.add( data ) :\n\t\t\t\tapi.row.add( data );\n\t\t\n\t\t\tif ( redraw === undefined || redraw ) {\n\t\t\t\tapi.draw();\n\t\t\t}\n\t\t\n\t\t\treturn rows.flatten().toArray();\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * This function will make DataTables recalculate the column sizes, based on the data\n\t\t * contained in the table and the sizes applied to the columns (in the DOM, CSS or\n\t\t * through the sWidth parameter). This can be useful when the width of the table's\n\t\t * parent element changes (for example a window resize).\n\t\t *  @param {boolean} [bRedraw=true] Redraw the table or not, you will typically want to\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable = $('#example').dataTable( {\n\t\t *        \"sScrollY\": \"200px\",\n\t\t *        \"bPaginate\": false\n\t\t *      } );\n\t\t *\n\t\t *      $(window).bind('resize', function () {\n\t\t *        oTable.fnAdjustColumnSizing();\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\tthis.fnAdjustColumnSizing = function ( bRedraw )\n\t\t{\n\t\t\tvar api = this.api( true ).columns.adjust();\n\t\t\tvar settings = api.settings()[0];\n\t\t\tvar scroll = settings.oScroll;\n\t\t\n\t\t\tif ( bRedraw === undefined || bRedraw ) {\n\t\t\t\tapi.draw( false );\n\t\t\t}\n\t\t\telse if ( scroll.sX !== \"\" || scroll.sY !== \"\" ) {\n\t\t\t\t/* If not redrawing, but scrolling, we want to apply the new column sizes anyway */\n\t\t\t\t_fnScrollDraw( settings );\n\t\t\t}\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Quickly and simply clear a table\n\t\t *  @param {bool} [bRedraw=true] redraw the table or not\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable = $('#example').dataTable();\n\t\t *\n\t\t *      // Immediately 'nuke' the current rows (perhaps waiting for an Ajax callback...)\n\t\t *      oTable.fnClearTable();\n\t\t *    } );\n\t\t */\n\t\tthis.fnClearTable = function( bRedraw )\n\t\t{\n\t\t\tvar api = this.api( true ).clear();\n\t\t\n\t\t\tif ( bRedraw === undefined || bRedraw ) {\n\t\t\t\tapi.draw();\n\t\t\t}\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * The exact opposite of 'opening' a row, this function will close any rows which\n\t\t * are currently 'open'.\n\t\t *  @param {node} nTr the table row to 'close'\n\t\t *  @returns {int} 0 on success, or 1 if failed (can't find the row)\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable;\n\t\t *\n\t\t *      // 'open' an information row when a row is clicked on\n\t\t *      $('#example tbody tr').click( function () {\n\t\t *        if ( oTable.fnIsOpen(this) ) {\n\t\t *          oTable.fnClose( this );\n\t\t *        } else {\n\t\t *          oTable.fnOpen( this, \"Temporary row opened\", \"info_row\" );\n\t\t *        }\n\t\t *      } );\n\t\t *\n\t\t *      oTable = $('#example').dataTable();\n\t\t *    } );\n\t\t */\n\t\tthis.fnClose = function( nTr )\n\t\t{\n\t\t\tthis.api( true ).row( nTr ).child.hide();\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Remove a row for the table\n\t\t *  @param {mixed} target The index of the row from aoData to be deleted, or\n\t\t *    the TR element you want to delete\n\t\t *  @param {function|null} [callBack] Callback function\n\t\t *  @param {bool} [redraw=true] Redraw the table or not\n\t\t *  @returns {array} The row that was deleted\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable = $('#example').dataTable();\n\t\t *\n\t\t *      // Immediately remove the first row\n\t\t *      oTable.fnDeleteRow( 0 );\n\t\t *    } );\n\t\t */\n\t\tthis.fnDeleteRow = function( target, callback, redraw )\n\t\t{\n\t\t\tvar api = this.api( true );\n\t\t\tvar rows = api.rows( target );\n\t\t\tvar settings = rows.settings()[0];\n\t\t\tvar data = settings.aoData[ rows[0][0] ];\n\t\t\n\t\t\trows.remove();\n\t\t\n\t\t\tif ( callback ) {\n\t\t\t\tcallback.call( this, settings, data );\n\t\t\t}\n\t\t\n\t\t\tif ( redraw === undefined || redraw ) {\n\t\t\t\tapi.draw();\n\t\t\t}\n\t\t\n\t\t\treturn data;\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Restore the table to it's original state in the DOM by removing all of DataTables\n\t\t * enhancements, alterations to the DOM structure of the table and event listeners.\n\t\t *  @param {boolean} [remove=false] Completely remove the table from the DOM\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      // This example is fairly pointless in reality, but shows how fnDestroy can be used\n\t\t *      var oTable = $('#example').dataTable();\n\t\t *      oTable.fnDestroy();\n\t\t *    } );\n\t\t */\n\t\tthis.fnDestroy = function ( remove )\n\t\t{\n\t\t\tthis.api( true ).destroy( remove );\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Redraw the table\n\t\t *  @param {bool} [complete=true] Re-filter and resort (if enabled) the table before the draw.\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable = $('#example').dataTable();\n\t\t *\n\t\t *      // Re-draw the table - you wouldn't want to do it here, but it's an example :-)\n\t\t *      oTable.fnDraw();\n\t\t *    } );\n\t\t */\n\t\tthis.fnDraw = function( complete )\n\t\t{\n\t\t\t// Note that this isn't an exact match to the old call to _fnDraw - it takes\n\t\t\t// into account the new data, but can hold position.\n\t\t\tthis.api( true ).draw( complete );\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Filter the input based on data\n\t\t *  @param {string} sInput String to filter the table on\n\t\t *  @param {int|null} [iColumn] Column to limit filtering to\n\t\t *  @param {bool} [bRegex=false] Treat as regular expression or not\n\t\t *  @param {bool} [bSmart=true] Perform smart filtering or not\n\t\t *  @param {bool} [bShowGlobal=true] Show the input global filter in it's input box(es)\n\t\t *  @param {bool} [bCaseInsensitive=true] Do case-insensitive matching (true) or not (false)\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable = $('#example').dataTable();\n\t\t *\n\t\t *      // Sometime later - filter...\n\t\t *      oTable.fnFilter( 'test string' );\n\t\t *    } );\n\t\t */\n\t\tthis.fnFilter = function( sInput, iColumn, bRegex, bSmart, bShowGlobal, bCaseInsensitive )\n\t\t{\n\t\t\tvar api = this.api( true );\n\t\t\n\t\t\tif ( iColumn === null || iColumn === undefined ) {\n\t\t\t\tapi.search( sInput, bRegex, bSmart, bCaseInsensitive );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tapi.column( iColumn ).search( sInput, bRegex, bSmart, bCaseInsensitive );\n\t\t\t}\n\t\t\n\t\t\tapi.draw();\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Get the data for the whole table, an individual row or an individual cell based on the\n\t\t * provided parameters.\n\t\t *  @param {int|node} [src] A TR row node, TD/TH cell node or an integer. If given as\n\t\t *    a TR node then the data source for the whole row will be returned. If given as a\n\t\t *    TD/TH cell node then iCol will be automatically calculated and the data for the\n\t\t *    cell returned. If given as an integer, then this is treated as the aoData internal\n\t\t *    data index for the row (see fnGetPosition) and the data for that row used.\n\t\t *  @param {int} [col] Optional column index that you want the data of.\n\t\t *  @returns {array|object|string} If mRow is undefined, then the data for all rows is\n\t\t *    returned. If mRow is defined, just data for that row, and is iCol is\n\t\t *    defined, only data for the designated cell is returned.\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    // Row data\n\t\t *    $(document).ready(function() {\n\t\t *      oTable = $('#example').dataTable();\n\t\t *\n\t\t *      oTable.$('tr').click( function () {\n\t\t *        var data = oTable.fnGetData( this );\n\t\t *        // ... do something with the array / object of data for the row\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Individual cell data\n\t\t *    $(document).ready(function() {\n\t\t *      oTable = $('#example').dataTable();\n\t\t *\n\t\t *      oTable.$('td').click( function () {\n\t\t *        var sData = oTable.fnGetData( this );\n\t\t *        alert( 'The cell clicked on had the value of '+sData );\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\tthis.fnGetData = function( src, col )\n\t\t{\n\t\t\tvar api = this.api( true );\n\t\t\n\t\t\tif ( src !== undefined ) {\n\t\t\t\tvar type = src.nodeName ? src.nodeName.toLowerCase() : '';\n\t\t\n\t\t\t\treturn col !== undefined || type == 'td' || type == 'th' ?\n\t\t\t\t\tapi.cell( src, col ).data() :\n\t\t\t\t\tapi.row( src ).data() || null;\n\t\t\t}\n\t\t\n\t\t\treturn api.data().toArray();\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Get an array of the TR nodes that are used in the table's body. Note that you will\n\t\t * typically want to use the '$' API method in preference to this as it is more\n\t\t * flexible.\n\t\t *  @param {int} [iRow] Optional row index for the TR element you want\n\t\t *  @returns {array|node} If iRow is undefined, returns an array of all TR elements\n\t\t *    in the table's body, or iRow is defined, just the TR element requested.\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable = $('#example').dataTable();\n\t\t *\n\t\t *      // Get the nodes from the table\n\t\t *      var nNodes = oTable.fnGetNodes( );\n\t\t *    } );\n\t\t */\n\t\tthis.fnGetNodes = function( iRow )\n\t\t{\n\t\t\tvar api = this.api( true );\n\t\t\n\t\t\treturn iRow !== undefined ?\n\t\t\t\tapi.row( iRow ).node() :\n\t\t\t\tapi.rows().nodes().flatten().toArray();\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Get the array indexes of a particular cell from it's DOM element\n\t\t * and column index including hidden columns\n\t\t *  @param {node} node this can either be a TR, TD or TH in the table's body\n\t\t *  @returns {int} If nNode is given as a TR, then a single index is returned, or\n\t\t *    if given as a cell, an array of [row index, column index (visible),\n\t\t *    column index (all)] is given.\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      $('#example tbody td').click( function () {\n\t\t *        // Get the position of the current data from the node\n\t\t *        var aPos = oTable.fnGetPosition( this );\n\t\t *\n\t\t *        // Get the data array for this row\n\t\t *        var aData = oTable.fnGetData( aPos[0] );\n\t\t *\n\t\t *        // Update the data array and return the value\n\t\t *        aData[ aPos[1] ] = 'clicked';\n\t\t *        this.innerHTML = 'clicked';\n\t\t *      } );\n\t\t *\n\t\t *      // Init DataTables\n\t\t *      oTable = $('#example').dataTable();\n\t\t *    } );\n\t\t */\n\t\tthis.fnGetPosition = function( node )\n\t\t{\n\t\t\tvar api = this.api( true );\n\t\t\tvar nodeName = node.nodeName.toUpperCase();\n\t\t\n\t\t\tif ( nodeName == 'TR' ) {\n\t\t\t\treturn api.row( node ).index();\n\t\t\t}\n\t\t\telse if ( nodeName == 'TD' || nodeName == 'TH' ) {\n\t\t\t\tvar cell = api.cell( node ).index();\n\t\t\n\t\t\t\treturn [\n\t\t\t\t\tcell.row,\n\t\t\t\t\tcell.columnVisible,\n\t\t\t\t\tcell.column\n\t\t\t\t];\n\t\t\t}\n\t\t\treturn null;\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Check to see if a row is 'open' or not.\n\t\t *  @param {node} nTr the table row to check\n\t\t *  @returns {boolean} true if the row is currently open, false otherwise\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable;\n\t\t *\n\t\t *      // 'open' an information row when a row is clicked on\n\t\t *      $('#example tbody tr').click( function () {\n\t\t *        if ( oTable.fnIsOpen(this) ) {\n\t\t *          oTable.fnClose( this );\n\t\t *        } else {\n\t\t *          oTable.fnOpen( this, \"Temporary row opened\", \"info_row\" );\n\t\t *        }\n\t\t *      } );\n\t\t *\n\t\t *      oTable = $('#example').dataTable();\n\t\t *    } );\n\t\t */\n\t\tthis.fnIsOpen = function( nTr )\n\t\t{\n\t\t\treturn this.api( true ).row( nTr ).child.isShown();\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * This function will place a new row directly after a row which is currently\n\t\t * on display on the page, with the HTML contents that is passed into the\n\t\t * function. This can be used, for example, to ask for confirmation that a\n\t\t * particular record should be deleted.\n\t\t *  @param {node} nTr The table row to 'open'\n\t\t *  @param {string|node|jQuery} mHtml The HTML to put into the row\n\t\t *  @param {string} sClass Class to give the new TD cell\n\t\t *  @returns {node} The row opened. Note that if the table row passed in as the\n\t\t *    first parameter, is not found in the table, this method will silently\n\t\t *    return.\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable;\n\t\t *\n\t\t *      // 'open' an information row when a row is clicked on\n\t\t *      $('#example tbody tr').click( function () {\n\t\t *        if ( oTable.fnIsOpen(this) ) {\n\t\t *          oTable.fnClose( this );\n\t\t *        } else {\n\t\t *          oTable.fnOpen( this, \"Temporary row opened\", \"info_row\" );\n\t\t *        }\n\t\t *      } );\n\t\t *\n\t\t *      oTable = $('#example').dataTable();\n\t\t *    } );\n\t\t */\n\t\tthis.fnOpen = function( nTr, mHtml, sClass )\n\t\t{\n\t\t\treturn this.api( true )\n\t\t\t\t.row( nTr )\n\t\t\t\t.child( mHtml, sClass )\n\t\t\t\t.show()\n\t\t\t\t.child()[0];\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Change the pagination - provides the internal logic for pagination in a simple API\n\t\t * function. With this function you can have a DataTables table go to the next,\n\t\t * previous, first or last pages.\n\t\t *  @param {string|int} mAction Paging action to take: \"first\", \"previous\", \"next\" or \"last\"\n\t\t *    or page number to jump to (integer), note that page 0 is the first page.\n\t\t *  @param {bool} [bRedraw=true] Redraw the table or not\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable = $('#example').dataTable();\n\t\t *      oTable.fnPageChange( 'next' );\n\t\t *    } );\n\t\t */\n\t\tthis.fnPageChange = function ( mAction, bRedraw )\n\t\t{\n\t\t\tvar api = this.api( true ).page( mAction );\n\t\t\n\t\t\tif ( bRedraw === undefined || bRedraw ) {\n\t\t\t\tapi.draw(false);\n\t\t\t}\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Show a particular column\n\t\t *  @param {int} iCol The column whose display should be changed\n\t\t *  @param {bool} bShow Show (true) or hide (false) the column\n\t\t *  @param {bool} [bRedraw=true] Redraw the table or not\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable = $('#example').dataTable();\n\t\t *\n\t\t *      // Hide the second column after initialisation\n\t\t *      oTable.fnSetColumnVis( 1, false );\n\t\t *    } );\n\t\t */\n\t\tthis.fnSetColumnVis = function ( iCol, bShow, bRedraw )\n\t\t{\n\t\t\tvar api = this.api( true ).column( iCol ).visible( bShow );\n\t\t\n\t\t\tif ( bRedraw === undefined || bRedraw ) {\n\t\t\t\tapi.columns.adjust().draw();\n\t\t\t}\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Get the settings for a particular table for external manipulation\n\t\t *  @returns {object} DataTables settings object. See\n\t\t *    {@link DataTable.models.oSettings}\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable = $('#example').dataTable();\n\t\t *      var oSettings = oTable.fnSettings();\n\t\t *\n\t\t *      // Show an example parameter from the settings\n\t\t *      alert( oSettings._iDisplayStart );\n\t\t *    } );\n\t\t */\n\t\tthis.fnSettings = function()\n\t\t{\n\t\t\treturn _fnSettingsFromNode( this[_ext.iApiIndex] );\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Sort the table by a particular column\n\t\t *  @param {int} iCol the data index to sort on. Note that this will not match the\n\t\t *    'display index' if you have hidden data entries\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable = $('#example').dataTable();\n\t\t *\n\t\t *      // Sort immediately with columns 0 and 1\n\t\t *      oTable.fnSort( [ [0,'asc'], [1,'asc'] ] );\n\t\t *    } );\n\t\t */\n\t\tthis.fnSort = function( aaSort )\n\t\t{\n\t\t\tthis.api( true ).order( aaSort ).draw();\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Attach a sort listener to an element for a given column\n\t\t *  @param {node} nNode the element to attach the sort listener to\n\t\t *  @param {int} iColumn the column that a click on this node will sort on\n\t\t *  @param {function} [fnCallback] callback function when sort is run\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable = $('#example').dataTable();\n\t\t *\n\t\t *      // Sort on column 1, when 'sorter' is clicked on\n\t\t *      oTable.fnSortListener( document.getElementById('sorter'), 1 );\n\t\t *    } );\n\t\t */\n\t\tthis.fnSortListener = function( nNode, iColumn, fnCallback )\n\t\t{\n\t\t\tthis.api( true ).order.listener( nNode, iColumn, fnCallback );\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Update a table cell or row - this method will accept either a single value to\n\t\t * update the cell with, an array of values with one element for each column or\n\t\t * an object in the same format as the original data source. The function is\n\t\t * self-referencing in order to make the multi column updates easier.\n\t\t *  @param {object|array|string} mData Data to update the cell/row with\n\t\t *  @param {node|int} mRow TR element you want to update or the aoData index\n\t\t *  @param {int} [iColumn] The column to update, give as null or undefined to\n\t\t *    update a whole row.\n\t\t *  @param {bool} [bRedraw=true] Redraw the table or not\n\t\t *  @param {bool} [bAction=true] Perform pre-draw actions or not\n\t\t *  @returns {int} 0 on success, 1 on error\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable = $('#example').dataTable();\n\t\t *      oTable.fnUpdate( 'Example update', 0, 0 ); // Single cell\n\t\t *      oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], $('tbody tr')[0] ); // Row\n\t\t *    } );\n\t\t */\n\t\tthis.fnUpdate = function( mData, mRow, iColumn, bRedraw, bAction )\n\t\t{\n\t\t\tvar api = this.api( true );\n\t\t\n\t\t\tif ( iColumn === undefined || iColumn === null ) {\n\t\t\t\tapi.row( mRow ).data( mData );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tapi.cell( mRow, iColumn ).data( mData );\n\t\t\t}\n\t\t\n\t\t\tif ( bAction === undefined || bAction ) {\n\t\t\t\tapi.columns.adjust();\n\t\t\t}\n\t\t\n\t\t\tif ( bRedraw === undefined || bRedraw ) {\n\t\t\t\tapi.draw();\n\t\t\t}\n\t\t\treturn 0;\n\t\t};\n\t\t\n\t\t\n\t\t/**\n\t\t * Provide a common method for plug-ins to check the version of DataTables being used, in order\n\t\t * to ensure compatibility.\n\t\t *  @param {string} sVersion Version string to check for, in the format \"X.Y.Z\". Note that the\n\t\t *    formats \"X\" and \"X.Y\" are also acceptable.\n\t\t *  @returns {boolean} true if this version of DataTables is greater or equal to the required\n\t\t *    version, or false if this version of DataTales is not suitable\n\t\t *  @method\n\t\t *  @dtopt API\n\t\t *  @deprecated Since v1.10\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready(function() {\n\t\t *      var oTable = $('#example').dataTable();\n\t\t *      alert( oTable.fnVersionCheck( '1.9.0' ) );\n\t\t *    } );\n\t\t */\n\t\tthis.fnVersionCheck = _ext.fnVersionCheck;\n\t\t\n\n\t\tvar _that = this;\n\t\tvar emptyInit = options === undefined;\n\t\tvar len = this.length;\n\n\t\tif ( emptyInit ) {\n\t\t\toptions = {};\n\t\t}\n\n\t\tthis.oApi = this.internal = _ext.internal;\n\n\t\t// Extend with old style plug-in API methods\n\t\tfor ( var fn in DataTable.ext.internal ) {\n\t\t\tif ( fn ) {\n\t\t\t\tthis[fn] = _fnExternApiFunc(fn);\n\t\t\t}\n\t\t}\n\n\t\tthis.each(function() {\n\t\t\t// For each initialisation we want to give it a clean initialisation\n\t\t\t// object that can be bashed around\n\t\t\tvar o = {};\n\t\t\tvar oInit = len > 1 ? // optimisation for single table case\n\t\t\t\t_fnExtend( o, options, true ) :\n\t\t\t\toptions;\n\n\t\t\t/*global oInit,_that,emptyInit*/\n\t\t\tvar i=0, iLen, j, jLen, k, kLen;\n\t\t\tvar sId = this.getAttribute( 'id' );\n\t\t\tvar bInitHandedOff = false;\n\t\t\tvar defaults = DataTable.defaults;\n\t\t\tvar $this = $(this);\n\t\t\t\n\t\t\t\n\t\t\t/* Sanity check */\n\t\t\tif ( this.nodeName.toLowerCase() != 'table' )\n\t\t\t{\n\t\t\t\t_fnLog( null, 0, 'Non-table node initialisation ('+this.nodeName+')', 2 );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t/* Backwards compatibility for the defaults */\n\t\t\t_fnCompatOpts( defaults );\n\t\t\t_fnCompatCols( defaults.column );\n\t\t\t\n\t\t\t/* Convert the camel-case defaults to Hungarian */\n\t\t\t_fnCamelToHungarian( defaults, defaults, true );\n\t\t\t_fnCamelToHungarian( defaults.column, defaults.column, true );\n\t\t\t\n\t\t\t/* Setting up the initialisation object */\n\t\t\t_fnCamelToHungarian( defaults, $.extend( oInit, $this.data() ) );\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t/* Check to see if we are re-initialising a table */\n\t\t\tvar allSettings = DataTable.settings;\n\t\t\tfor ( i=0, iLen=allSettings.length ; i<iLen ; i++ )\n\t\t\t{\n\t\t\t\tvar s = allSettings[i];\n\t\t\t\n\t\t\t\t/* Base check on table node */\n\t\t\t\tif ( s.nTable == this || s.nTHead.parentNode == this || (s.nTFoot && s.nTFoot.parentNode == this) )\n\t\t\t\t{\n\t\t\t\t\tvar bRetrieve = oInit.bRetrieve !== undefined ? oInit.bRetrieve : defaults.bRetrieve;\n\t\t\t\t\tvar bDestroy = oInit.bDestroy !== undefined ? oInit.bDestroy : defaults.bDestroy;\n\t\t\t\n\t\t\t\t\tif ( emptyInit || bRetrieve )\n\t\t\t\t\t{\n\t\t\t\t\t\treturn s.oInstance;\n\t\t\t\t\t}\n\t\t\t\t\telse if ( bDestroy )\n\t\t\t\t\t{\n\t\t\t\t\t\ts.oInstance.fnDestroy();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t_fnLog( s, 0, 'Cannot reinitialise DataTable', 3 );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\n\t\t\t\t/* If the element we are initialising has the same ID as a table which was previously\n\t\t\t\t * initialised, but the table nodes don't match (from before) then we destroy the old\n\t\t\t\t * instance by simply deleting it. This is under the assumption that the table has been\n\t\t\t\t * destroyed by other methods. Anyone using non-id selectors will need to do this manually\n\t\t\t\t */\n\t\t\t\tif ( s.sTableId == this.id )\n\t\t\t\t{\n\t\t\t\t\tallSettings.splice( i, 1 );\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t/* Ensure the table has an ID - required for accessibility */\n\t\t\tif ( sId === null || sId === \"\" )\n\t\t\t{\n\t\t\t\tsId = \"DataTables_Table_\"+(DataTable.ext._unique++);\n\t\t\t\tthis.id = sId;\n\t\t\t}\n\t\t\t\n\t\t\t/* Create the settings object for this table and set some of the default parameters */\n\t\t\tvar oSettings = $.extend( true, {}, DataTable.models.oSettings, {\n\t\t\t\t\"sDestroyWidth\": $this[0].style.width,\n\t\t\t\t\"sInstance\":     sId,\n\t\t\t\t\"sTableId\":      sId\n\t\t\t} );\n\t\t\toSettings.nTable = this;\n\t\t\toSettings.oApi   = _that.internal;\n\t\t\toSettings.oInit  = oInit;\n\t\t\t\n\t\t\tallSettings.push( oSettings );\n\t\t\t\n\t\t\t// Need to add the instance after the instance after the settings object has been added\n\t\t\t// to the settings array, so we can self reference the table instance if more than one\n\t\t\toSettings.oInstance = (_that.length===1) ? _that : $this.dataTable();\n\t\t\t\n\t\t\t// Backwards compatibility, before we apply all the defaults\n\t\t\t_fnCompatOpts( oInit );\n\t\t\t\n\t\t\tif ( oInit.oLanguage )\n\t\t\t{\n\t\t\t\t_fnLanguageCompat( oInit.oLanguage );\n\t\t\t}\n\t\t\t\n\t\t\t// If the length menu is given, but the init display length is not, use the length menu\n\t\t\tif ( oInit.aLengthMenu && ! oInit.iDisplayLength )\n\t\t\t{\n\t\t\t\toInit.iDisplayLength = $.isArray( oInit.aLengthMenu[0] ) ?\n\t\t\t\t\toInit.aLengthMenu[0][0] : oInit.aLengthMenu[0];\n\t\t\t}\n\t\t\t\n\t\t\t// Apply the defaults and init options to make a single init object will all\n\t\t\t// options defined from defaults and instance options.\n\t\t\toInit = _fnExtend( $.extend( true, {}, defaults ), oInit );\n\t\t\t\n\t\t\t\n\t\t\t// Map the initialisation options onto the settings object\n\t\t\t_fnMap( oSettings.oFeatures, oInit, [\n\t\t\t\t\"bPaginate\",\n\t\t\t\t\"bLengthChange\",\n\t\t\t\t\"bFilter\",\n\t\t\t\t\"bSort\",\n\t\t\t\t\"bSortMulti\",\n\t\t\t\t\"bInfo\",\n\t\t\t\t\"bProcessing\",\n\t\t\t\t\"bAutoWidth\",\n\t\t\t\t\"bSortClasses\",\n\t\t\t\t\"bServerSide\",\n\t\t\t\t\"bDeferRender\"\n\t\t\t] );\n\t\t\t_fnMap( oSettings, oInit, [\n\t\t\t\t\"asStripeClasses\",\n\t\t\t\t\"ajax\",\n\t\t\t\t\"fnServerData\",\n\t\t\t\t\"fnFormatNumber\",\n\t\t\t\t\"sServerMethod\",\n\t\t\t\t\"aaSorting\",\n\t\t\t\t\"aaSortingFixed\",\n\t\t\t\t\"aLengthMenu\",\n\t\t\t\t\"sPaginationType\",\n\t\t\t\t\"sAjaxSource\",\n\t\t\t\t\"sAjaxDataProp\",\n\t\t\t\t\"iStateDuration\",\n\t\t\t\t\"sDom\",\n\t\t\t\t\"bSortCellsTop\",\n\t\t\t\t\"iTabIndex\",\n\t\t\t\t\"fnStateLoadCallback\",\n\t\t\t\t\"fnStateSaveCallback\",\n\t\t\t\t\"renderer\",\n\t\t\t\t\"searchDelay\",\n\t\t\t\t\"rowId\",\n\t\t\t\t[ \"iCookieDuration\", \"iStateDuration\" ], // backwards compat\n\t\t\t\t[ \"oSearch\", \"oPreviousSearch\" ],\n\t\t\t\t[ \"aoSearchCols\", \"aoPreSearchCols\" ],\n\t\t\t\t[ \"iDisplayLength\", \"_iDisplayLength\" ],\n\t\t\t\t[ \"bJQueryUI\", \"bJUI\" ]\n\t\t\t] );\n\t\t\t_fnMap( oSettings.oScroll, oInit, [\n\t\t\t\t[ \"sScrollX\", \"sX\" ],\n\t\t\t\t[ \"sScrollXInner\", \"sXInner\" ],\n\t\t\t\t[ \"sScrollY\", \"sY\" ],\n\t\t\t\t[ \"bScrollCollapse\", \"bCollapse\" ]\n\t\t\t] );\n\t\t\t_fnMap( oSettings.oLanguage, oInit, \"fnInfoCallback\" );\n\t\t\t\n\t\t\t/* Callback functions which are array driven */\n\t\t\t_fnCallbackReg( oSettings, 'aoDrawCallback',       oInit.fnDrawCallback,      'user' );\n\t\t\t_fnCallbackReg( oSettings, 'aoServerParams',       oInit.fnServerParams,      'user' );\n\t\t\t_fnCallbackReg( oSettings, 'aoStateSaveParams',    oInit.fnStateSaveParams,   'user' );\n\t\t\t_fnCallbackReg( oSettings, 'aoStateLoadParams',    oInit.fnStateLoadParams,   'user' );\n\t\t\t_fnCallbackReg( oSettings, 'aoStateLoaded',        oInit.fnStateLoaded,       'user' );\n\t\t\t_fnCallbackReg( oSettings, 'aoRowCallback',        oInit.fnRowCallback,       'user' );\n\t\t\t_fnCallbackReg( oSettings, 'aoRowCreatedCallback', oInit.fnCreatedRow,        'user' );\n\t\t\t_fnCallbackReg( oSettings, 'aoHeaderCallback',     oInit.fnHeaderCallback,    'user' );\n\t\t\t_fnCallbackReg( oSettings, 'aoFooterCallback',     oInit.fnFooterCallback,    'user' );\n\t\t\t_fnCallbackReg( oSettings, 'aoInitComplete',       oInit.fnInitComplete,      'user' );\n\t\t\t_fnCallbackReg( oSettings, 'aoPreDrawCallback',    oInit.fnPreDrawCallback,   'user' );\n\t\t\t\n\t\t\toSettings.rowIdFn = _fnGetObjectDataFn( oInit.rowId );\n\t\t\t\n\t\t\t/* Browser support detection */\n\t\t\t_fnBrowserDetect( oSettings );\n\t\t\t\n\t\t\tvar oClasses = oSettings.oClasses;\n\t\t\t\n\t\t\t// @todo Remove in 1.11\n\t\t\tif ( oInit.bJQueryUI )\n\t\t\t{\n\t\t\t\t/* Use the JUI classes object for display. You could clone the oStdClasses object if\n\t\t\t\t * you want to have multiple tables with multiple independent classes\n\t\t\t\t */\n\t\t\t\t$.extend( oClasses, DataTable.ext.oJUIClasses, oInit.oClasses );\n\t\t\t\n\t\t\t\tif ( oInit.sDom === defaults.sDom && defaults.sDom === \"lfrtip\" )\n\t\t\t\t{\n\t\t\t\t\t/* Set the DOM to use a layout suitable for jQuery UI's theming */\n\t\t\t\t\toSettings.sDom = '<\"H\"lfr>t<\"F\"ip>';\n\t\t\t\t}\n\t\t\t\n\t\t\t\tif ( ! oSettings.renderer ) {\n\t\t\t\t\toSettings.renderer = 'jqueryui';\n\t\t\t\t}\n\t\t\t\telse if ( $.isPlainObject( oSettings.renderer ) && ! oSettings.renderer.header ) {\n\t\t\t\t\toSettings.renderer.header = 'jqueryui';\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$.extend( oClasses, DataTable.ext.classes, oInit.oClasses );\n\t\t\t}\n\t\t\t$this.addClass( oClasses.sTable );\n\t\t\t\n\t\t\t\n\t\t\tif ( oSettings.iInitDisplayStart === undefined )\n\t\t\t{\n\t\t\t\t/* Display start point, taking into account the save saving */\n\t\t\t\toSettings.iInitDisplayStart = oInit.iDisplayStart;\n\t\t\t\toSettings._iDisplayStart = oInit.iDisplayStart;\n\t\t\t}\n\t\t\t\n\t\t\tif ( oInit.iDeferLoading !== null )\n\t\t\t{\n\t\t\t\toSettings.bDeferLoading = true;\n\t\t\t\tvar tmp = $.isArray( oInit.iDeferLoading );\n\t\t\t\toSettings._iRecordsDisplay = tmp ? oInit.iDeferLoading[0] : oInit.iDeferLoading;\n\t\t\t\toSettings._iRecordsTotal = tmp ? oInit.iDeferLoading[1] : oInit.iDeferLoading;\n\t\t\t}\n\t\t\t\n\t\t\t/* Language definitions */\n\t\t\tvar oLanguage = oSettings.oLanguage;\n\t\t\t$.extend( true, oLanguage, oInit.oLanguage );\n\t\t\t\n\t\t\tif ( oLanguage.sUrl !== \"\" )\n\t\t\t{\n\t\t\t\t/* Get the language definitions from a file - because this Ajax call makes the language\n\t\t\t\t * get async to the remainder of this function we use bInitHandedOff to indicate that\n\t\t\t\t * _fnInitialise will be fired by the returned Ajax handler, rather than the constructor\n\t\t\t\t */\n\t\t\t\t$.ajax( {\n\t\t\t\t\tdataType: 'json',\n\t\t\t\t\turl: oLanguage.sUrl,\n\t\t\t\t\tsuccess: function ( json ) {\n\t\t\t\t\t\t_fnLanguageCompat( json );\n\t\t\t\t\t\t_fnCamelToHungarian( defaults.oLanguage, json );\n\t\t\t\t\t\t$.extend( true, oLanguage, json );\n\t\t\t\t\t\t_fnInitialise( oSettings );\n\t\t\t\t\t},\n\t\t\t\t\terror: function () {\n\t\t\t\t\t\t// Error occurred loading language file, continue on as best we can\n\t\t\t\t\t\t_fnInitialise( oSettings );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\tbInitHandedOff = true;\n\t\t\t}\n\t\t\t\n\t\t\t/*\n\t\t\t * Stripes\n\t\t\t */\n\t\t\tif ( oInit.asStripeClasses === null )\n\t\t\t{\n\t\t\t\toSettings.asStripeClasses =[\n\t\t\t\t\toClasses.sStripeOdd,\n\t\t\t\t\toClasses.sStripeEven\n\t\t\t\t];\n\t\t\t}\n\t\t\t\n\t\t\t/* Remove row stripe classes if they are already on the table row */\n\t\t\tvar stripeClasses = oSettings.asStripeClasses;\n\t\t\tvar rowOne = $this.children('tbody').find('tr').eq(0);\n\t\t\tif ( $.inArray( true, $.map( stripeClasses, function(el, i) {\n\t\t\t\treturn rowOne.hasClass(el);\n\t\t\t} ) ) !== -1 ) {\n\t\t\t\t$('tbody tr', this).removeClass( stripeClasses.join(' ') );\n\t\t\t\toSettings.asDestroyStripes = stripeClasses.slice();\n\t\t\t}\n\t\t\t\n\t\t\t/*\n\t\t\t * Columns\n\t\t\t * See if we should load columns automatically or use defined ones\n\t\t\t */\n\t\t\tvar anThs = [];\n\t\t\tvar aoColumnsInit;\n\t\t\tvar nThead = this.getElementsByTagName('thead');\n\t\t\tif ( nThead.length !== 0 )\n\t\t\t{\n\t\t\t\t_fnDetectHeader( oSettings.aoHeader, nThead[0] );\n\t\t\t\tanThs = _fnGetUniqueThs( oSettings );\n\t\t\t}\n\t\t\t\n\t\t\t/* If not given a column array, generate one with nulls */\n\t\t\tif ( oInit.aoColumns === null )\n\t\t\t{\n\t\t\t\taoColumnsInit = [];\n\t\t\t\tfor ( i=0, iLen=anThs.length ; i<iLen ; i++ )\n\t\t\t\t{\n\t\t\t\t\taoColumnsInit.push( null );\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\taoColumnsInit = oInit.aoColumns;\n\t\t\t}\n\t\t\t\n\t\t\t/* Add the columns */\n\t\t\tfor ( i=0, iLen=aoColumnsInit.length ; i<iLen ; i++ )\n\t\t\t{\n\t\t\t\t_fnAddColumn( oSettings, anThs ? anThs[i] : null );\n\t\t\t}\n\t\t\t\n\t\t\t/* Apply the column definitions */\n\t\t\t_fnApplyColumnDefs( oSettings, oInit.aoColumnDefs, aoColumnsInit, function (iCol, oDef) {\n\t\t\t\t_fnColumnOptions( oSettings, iCol, oDef );\n\t\t\t} );\n\t\t\t\n\t\t\t/* HTML5 attribute detection - build an mData object automatically if the\n\t\t\t * attributes are found\n\t\t\t */\n\t\t\tif ( rowOne.length ) {\n\t\t\t\tvar a = function ( cell, name ) {\n\t\t\t\t\treturn cell.getAttribute( 'data-'+name ) !== null ? name : null;\n\t\t\t\t};\n\t\t\t\n\t\t\t\t$( rowOne[0] ).children('th, td').each( function (i, cell) {\n\t\t\t\t\tvar col = oSettings.aoColumns[i];\n\t\t\t\n\t\t\t\t\tif ( col.mData === i ) {\n\t\t\t\t\t\tvar sort = a( cell, 'sort' ) || a( cell, 'order' );\n\t\t\t\t\t\tvar filter = a( cell, 'filter' ) || a( cell, 'search' );\n\t\t\t\n\t\t\t\t\t\tif ( sort !== null || filter !== null ) {\n\t\t\t\t\t\t\tcol.mData = {\n\t\t\t\t\t\t\t\t_:      i+'.display',\n\t\t\t\t\t\t\t\tsort:   sort !== null   ? i+'.@data-'+sort   : undefined,\n\t\t\t\t\t\t\t\ttype:   sort !== null   ? i+'.@data-'+sort   : undefined,\n\t\t\t\t\t\t\t\tfilter: filter !== null ? i+'.@data-'+filter : undefined\n\t\t\t\t\t\t\t};\n\t\t\t\n\t\t\t\t\t\t\t_fnColumnOptions( oSettings, i );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\t\t\t\n\t\t\tvar features = oSettings.oFeatures;\n\t\t\t\n\t\t\t/* Must be done after everything which can be overridden by the state saving! */\n\t\t\tif ( oInit.bStateSave )\n\t\t\t{\n\t\t\t\tfeatures.bStateSave = true;\n\t\t\t\t_fnLoadState( oSettings, oInit );\n\t\t\t\t_fnCallbackReg( oSettings, 'aoDrawCallback', _fnSaveState, 'state_save' );\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t/*\n\t\t\t * Sorting\n\t\t\t * @todo For modularisation (1.11) this needs to do into a sort start up handler\n\t\t\t */\n\t\t\t\n\t\t\t// If aaSorting is not defined, then we use the first indicator in asSorting\n\t\t\t// in case that has been altered, so the default sort reflects that option\n\t\t\tif ( oInit.aaSorting === undefined )\n\t\t\t{\n\t\t\t\tvar sorting = oSettings.aaSorting;\n\t\t\t\tfor ( i=0, iLen=sorting.length ; i<iLen ; i++ )\n\t\t\t\t{\n\t\t\t\t\tsorting[i][1] = oSettings.aoColumns[ i ].asSorting[0];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t/* Do a first pass on the sorting classes (allows any size changes to be taken into\n\t\t\t * account, and also will apply sorting disabled classes if disabled\n\t\t\t */\n\t\t\t_fnSortingClasses( oSettings );\n\t\t\t\n\t\t\tif ( features.bSort )\n\t\t\t{\n\t\t\t\t_fnCallbackReg( oSettings, 'aoDrawCallback', function () {\n\t\t\t\t\tif ( oSettings.bSorted ) {\n\t\t\t\t\t\tvar aSort = _fnSortFlatten( oSettings );\n\t\t\t\t\t\tvar sortedColumns = {};\n\t\t\t\n\t\t\t\t\t\t$.each( aSort, function (i, val) {\n\t\t\t\t\t\t\tsortedColumns[ val.src ] = val.dir;\n\t\t\t\t\t\t} );\n\t\t\t\n\t\t\t\t\t\t_fnCallbackFire( oSettings, null, 'order', [oSettings, aSort, sortedColumns] );\n\t\t\t\t\t\t_fnSortAria( oSettings );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\t\t\t\n\t\t\t_fnCallbackReg( oSettings, 'aoDrawCallback', function () {\n\t\t\t\tif ( oSettings.bSorted || _fnDataSource( oSettings ) === 'ssp' || features.bDeferRender ) {\n\t\t\t\t\t_fnSortingClasses( oSettings );\n\t\t\t\t}\n\t\t\t}, 'sc' );\n\t\t\t\n\t\t\t\n\t\t\t/*\n\t\t\t * Final init\n\t\t\t * Cache the header, body and footer as required, creating them if needed\n\t\t\t */\n\t\t\t\n\t\t\t// Work around for Webkit bug 83867 - store the caption-side before removing from doc\n\t\t\tvar captions = $this.children('caption').each( function () {\n\t\t\t\tthis._captionSide = $this.css('caption-side');\n\t\t\t} );\n\t\t\t\n\t\t\tvar thead = $this.children('thead');\n\t\t\tif ( thead.length === 0 )\n\t\t\t{\n\t\t\t\tthead = $('<thead/>').appendTo(this);\n\t\t\t}\n\t\t\toSettings.nTHead = thead[0];\n\t\t\t\n\t\t\tvar tbody = $this.children('tbody');\n\t\t\tif ( tbody.length === 0 )\n\t\t\t{\n\t\t\t\ttbody = $('<tbody/>').appendTo(this);\n\t\t\t}\n\t\t\toSettings.nTBody = tbody[0];\n\t\t\t\n\t\t\tvar tfoot = $this.children('tfoot');\n\t\t\tif ( tfoot.length === 0 && captions.length > 0 && (oSettings.oScroll.sX !== \"\" || oSettings.oScroll.sY !== \"\") )\n\t\t\t{\n\t\t\t\t// If we are a scrolling table, and no footer has been given, then we need to create\n\t\t\t\t// a tfoot element for the caption element to be appended to\n\t\t\t\ttfoot = $('<tfoot/>').appendTo(this);\n\t\t\t}\n\t\t\t\n\t\t\tif ( tfoot.length === 0 || tfoot.children().length === 0 ) {\n\t\t\t\t$this.addClass( oClasses.sNoFooter );\n\t\t\t}\n\t\t\telse if ( tfoot.length > 0 ) {\n\t\t\t\toSettings.nTFoot = tfoot[0];\n\t\t\t\t_fnDetectHeader( oSettings.aoFooter, oSettings.nTFoot );\n\t\t\t}\n\t\t\t\n\t\t\t/* Check if there is data passing into the constructor */\n\t\t\tif ( oInit.aaData )\n\t\t\t{\n\t\t\t\tfor ( i=0 ; i<oInit.aaData.length ; i++ )\n\t\t\t\t{\n\t\t\t\t\t_fnAddData( oSettings, oInit.aaData[ i ] );\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ( oSettings.bDeferLoading || _fnDataSource( oSettings ) == 'dom' )\n\t\t\t{\n\t\t\t\t/* Grab the data from the page - only do this when deferred loading or no Ajax\n\t\t\t\t * source since there is no point in reading the DOM data if we are then going\n\t\t\t\t * to replace it with Ajax data\n\t\t\t\t */\n\t\t\t\t_fnAddTr( oSettings, $(oSettings.nTBody).children('tr') );\n\t\t\t}\n\t\t\t\n\t\t\t/* Copy the data index array */\n\t\t\toSettings.aiDisplay = oSettings.aiDisplayMaster.slice();\n\t\t\t\n\t\t\t/* Initialisation complete - table can be drawn */\n\t\t\toSettings.bInitialised = true;\n\t\t\t\n\t\t\t/* Check if we need to initialise the table (it might not have been handed off to the\n\t\t\t * language processor)\n\t\t\t */\n\t\t\tif ( bInitHandedOff === false )\n\t\t\t{\n\t\t\t\t_fnInitialise( oSettings );\n\t\t\t}\n\t\t} );\n\t\t_that = null;\n\t\treturn this;\n\t};\n\n\t\n\t/*\n\t * It is useful to have variables which are scoped locally so only the\n\t * DataTables functions can access them and they don't leak into global space.\n\t * At the same time these functions are often useful over multiple files in the\n\t * core and API, so we list, or at least document, all variables which are used\n\t * by DataTables as private variables here. This also ensures that there is no\n\t * clashing of variable names and that they can easily referenced for reuse.\n\t */\n\t\n\t\n\t// Defined else where\n\t//  _selector_run\n\t//  _selector_opts\n\t//  _selector_first\n\t//  _selector_row_indexes\n\t\n\tvar _ext; // DataTable.ext\n\tvar _Api; // DataTable.Api\n\tvar _api_register; // DataTable.Api.register\n\tvar _api_registerPlural; // DataTable.Api.registerPlural\n\t\n\tvar _re_dic = {};\n\tvar _re_new_lines = /[\\r\\n]/g;\n\tvar _re_html = /<.*?>/g;\n\tvar _re_date_start = /^[\\w\\+\\-]/;\n\tvar _re_date_end = /[\\w\\+\\-]$/;\n\t\n\t// Escape regular expression special characters\n\tvar _re_escape_regex = new RegExp( '(\\\\' + [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\\\', '$', '^', '-' ].join('|\\\\') + ')', 'g' );\n\t\n\t// http://en.wikipedia.org/wiki/Foreign_exchange_market\n\t// - \\u20BD - Russian ruble.\n\t// - \\u20a9 - South Korean Won\n\t// - \\u20BA - Turkish Lira\n\t// - \\u20B9 - Indian Rupee\n\t// - R - Brazil (R$) and South Africa\n\t// - fr - Swiss Franc\n\t// - kr - Swedish krona, Norwegian krone and Danish krone\n\t// - \\u2009 is thin space and \\u202F is narrow no-break space, both used in many\n\t//   standards as thousands separators.\n\tvar _re_formatted_numeric = /[',$£€¥%\\u2009\\u202F\\u20BD\\u20a9\\u20BArfk]/gi;\n\t\n\t\n\tvar _empty = function ( d ) {\n\t\treturn !d || d === true || d === '-' ? true : false;\n\t};\n\t\n\t\n\tvar _intVal = function ( s ) {\n\t\tvar integer = parseInt( s, 10 );\n\t\treturn !isNaN(integer) && isFinite(s) ? integer : null;\n\t};\n\t\n\t// Convert from a formatted number with characters other than `.` as the\n\t// decimal place, to a Javascript number\n\tvar _numToDecimal = function ( num, decimalPoint ) {\n\t\t// Cache created regular expressions for speed as this function is called often\n\t\tif ( ! _re_dic[ decimalPoint ] ) {\n\t\t\t_re_dic[ decimalPoint ] = new RegExp( _fnEscapeRegex( decimalPoint ), 'g' );\n\t\t}\n\t\treturn typeof num === 'string' && decimalPoint !== '.' ?\n\t\t\tnum.replace( /\\./g, '' ).replace( _re_dic[ decimalPoint ], '.' ) :\n\t\t\tnum;\n\t};\n\t\n\t\n\tvar _isNumber = function ( d, decimalPoint, formatted ) {\n\t\tvar strType = typeof d === 'string';\n\t\n\t\t// If empty return immediately so there must be a number if it is a\n\t\t// formatted string (this stops the string \"k\", or \"kr\", etc being detected\n\t\t// as a formatted number for currency\n\t\tif ( _empty( d ) ) {\n\t\t\treturn true;\n\t\t}\n\t\n\t\tif ( decimalPoint && strType ) {\n\t\t\td = _numToDecimal( d, decimalPoint );\n\t\t}\n\t\n\t\tif ( formatted && strType ) {\n\t\t\td = d.replace( _re_formatted_numeric, '' );\n\t\t}\n\t\n\t\treturn !isNaN( parseFloat(d) ) && isFinite( d );\n\t};\n\t\n\t\n\t// A string without HTML in it can be considered to be HTML still\n\tvar _isHtml = function ( d ) {\n\t\treturn _empty( d ) || typeof d === 'string';\n\t};\n\t\n\t\n\tvar _htmlNumeric = function ( d, decimalPoint, formatted ) {\n\t\tif ( _empty( d ) ) {\n\t\t\treturn true;\n\t\t}\n\t\n\t\tvar html = _isHtml( d );\n\t\treturn ! html ?\n\t\t\tnull :\n\t\t\t_isNumber( _stripHtml( d ), decimalPoint, formatted ) ?\n\t\t\t\ttrue :\n\t\t\t\tnull;\n\t};\n\t\n\t\n\tvar _pluck = function ( a, prop, prop2 ) {\n\t\tvar out = [];\n\t\tvar i=0, ien=a.length;\n\t\n\t\t// Could have the test in the loop for slightly smaller code, but speed\n\t\t// is essential here\n\t\tif ( prop2 !== undefined ) {\n\t\t\tfor ( ; i<ien ; i++ ) {\n\t\t\t\tif ( a[i] && a[i][ prop ] ) {\n\t\t\t\t\tout.push( a[i][ prop ][ prop2 ] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tfor ( ; i<ien ; i++ ) {\n\t\t\t\tif ( a[i] ) {\n\t\t\t\t\tout.push( a[i][ prop ] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\treturn out;\n\t};\n\t\n\t\n\t// Basically the same as _pluck, but rather than looping over `a` we use `order`\n\t// as the indexes to pick from `a`\n\tvar _pluck_order = function ( a, order, prop, prop2 )\n\t{\n\t\tvar out = [];\n\t\tvar i=0, ien=order.length;\n\t\n\t\t// Could have the test in the loop for slightly smaller code, but speed\n\t\t// is essential here\n\t\tif ( prop2 !== undefined ) {\n\t\t\tfor ( ; i<ien ; i++ ) {\n\t\t\t\tif ( a[ order[i] ][ prop ] ) {\n\t\t\t\t\tout.push( a[ order[i] ][ prop ][ prop2 ] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tfor ( ; i<ien ; i++ ) {\n\t\t\t\tout.push( a[ order[i] ][ prop ] );\n\t\t\t}\n\t\t}\n\t\n\t\treturn out;\n\t};\n\t\n\t\n\tvar _range = function ( len, start )\n\t{\n\t\tvar out = [];\n\t\tvar end;\n\t\n\t\tif ( start === undefined ) {\n\t\t\tstart = 0;\n\t\t\tend = len;\n\t\t}\n\t\telse {\n\t\t\tend = start;\n\t\t\tstart = len;\n\t\t}\n\t\n\t\tfor ( var i=start ; i<end ; i++ ) {\n\t\t\tout.push( i );\n\t\t}\n\t\n\t\treturn out;\n\t};\n\t\n\t\n\tvar _removeEmpty = function ( a )\n\t{\n\t\tvar out = [];\n\t\n\t\tfor ( var i=0, ien=a.length ; i<ien ; i++ ) {\n\t\t\tif ( a[i] ) { // careful - will remove all falsy values!\n\t\t\t\tout.push( a[i] );\n\t\t\t}\n\t\t}\n\t\n\t\treturn out;\n\t};\n\t\n\t\n\tvar _stripHtml = function ( d ) {\n\t\treturn d.replace( _re_html, '' );\n\t};\n\t\n\t\n\t/**\n\t * Find the unique elements in a source array.\n\t *\n\t * @param  {array} src Source array\n\t * @return {array} Array of unique items\n\t * @ignore\n\t */\n\tvar _unique = function ( src )\n\t{\n\t\t// A faster unique method is to use object keys to identify used values,\n\t\t// but this doesn't work with arrays or objects, which we must also\n\t\t// consider. See jsperf.com/compare-array-unique-versions/4 for more\n\t\t// information.\n\t\tvar\n\t\t\tout = [],\n\t\t\tval,\n\t\t\ti, ien=src.length,\n\t\t\tj, k=0;\n\t\n\t\tagain: for ( i=0 ; i<ien ; i++ ) {\n\t\t\tval = src[i];\n\t\n\t\t\tfor ( j=0 ; j<k ; j++ ) {\n\t\t\t\tif ( out[j] === val ) {\n\t\t\t\t\tcontinue again;\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tout.push( val );\n\t\t\tk++;\n\t\t}\n\t\n\t\treturn out;\n\t};\n\t\n\t\n\t/**\n\t * DataTables utility methods\n\t * \n\t * This namespace provides helper methods that DataTables uses internally to\n\t * create a DataTable, but which are not exclusively used only for DataTables.\n\t * These methods can be used by extension authors to save the duplication of\n\t * code.\n\t *\n\t *  @namespace\n\t */\n\tDataTable.util = {\n\t\t/**\n\t\t * Throttle the calls to a function. Arguments and context are maintained\n\t\t * for the throttled function.\n\t\t *\n\t\t * @param {function} fn Function to be called\n\t\t * @param {integer} freq Call frequency in mS\n\t\t * @return {function} Wrapped function\n\t\t */\n\t\tthrottle: function ( fn, freq ) {\n\t\t\tvar\n\t\t\t\tfrequency = freq !== undefined ? freq : 200,\n\t\t\t\tlast,\n\t\t\t\ttimer;\n\t\n\t\t\treturn function () {\n\t\t\t\tvar\n\t\t\t\t\tthat = this,\n\t\t\t\t\tnow  = +new Date(),\n\t\t\t\t\targs = arguments;\n\t\n\t\t\t\tif ( last && now < last + frequency ) {\n\t\t\t\t\tclearTimeout( timer );\n\t\n\t\t\t\t\ttimer = setTimeout( function () {\n\t\t\t\t\t\tlast = undefined;\n\t\t\t\t\t\tfn.apply( that, args );\n\t\t\t\t\t}, frequency );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlast = now;\n\t\t\t\t\tfn.apply( that, args );\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\n\t\n\t\t/**\n\t\t * Escape a string such that it can be used in a regular expression\n\t\t *\n\t\t *  @param {string} val string to escape\n\t\t *  @returns {string} escaped string\n\t\t */\n\t\tescapeRegex: function ( val ) {\n\t\t\treturn val.replace( _re_escape_regex, '\\\\$1' );\n\t\t}\n\t};\n\t\n\t\n\t\n\t/**\n\t * Create a mapping object that allows camel case parameters to be looked up\n\t * for their Hungarian counterparts. The mapping is stored in a private\n\t * parameter called `_hungarianMap` which can be accessed on the source object.\n\t *  @param {object} o\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnHungarianMap ( o )\n\t{\n\t\tvar\n\t\t\thungarian = 'a aa ai ao as b fn i m o s ',\n\t\t\tmatch,\n\t\t\tnewKey,\n\t\t\tmap = {};\n\t\n\t\t$.each( o, function (key, val) {\n\t\t\tmatch = key.match(/^([^A-Z]+?)([A-Z])/);\n\t\n\t\t\tif ( match && hungarian.indexOf(match[1]+' ') !== -1 )\n\t\t\t{\n\t\t\t\tnewKey = key.replace( match[0], match[2].toLowerCase() );\n\t\t\t\tmap[ newKey ] = key;\n\t\n\t\t\t\tif ( match[1] === 'o' )\n\t\t\t\t{\n\t\t\t\t\t_fnHungarianMap( o[key] );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t\n\t\to._hungarianMap = map;\n\t}\n\t\n\t\n\t/**\n\t * Convert from camel case parameters to Hungarian, based on a Hungarian map\n\t * created by _fnHungarianMap.\n\t *  @param {object} src The model object which holds all parameters that can be\n\t *    mapped.\n\t *  @param {object} user The object to convert from camel case to Hungarian.\n\t *  @param {boolean} force When set to `true`, properties which already have a\n\t *    Hungarian value in the `user` object will be overwritten. Otherwise they\n\t *    won't be.\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnCamelToHungarian ( src, user, force )\n\t{\n\t\tif ( ! src._hungarianMap ) {\n\t\t\t_fnHungarianMap( src );\n\t\t}\n\t\n\t\tvar hungarianKey;\n\t\n\t\t$.each( user, function (key, val) {\n\t\t\thungarianKey = src._hungarianMap[ key ];\n\t\n\t\t\tif ( hungarianKey !== undefined && (force || user[hungarianKey] === undefined) )\n\t\t\t{\n\t\t\t\t// For objects, we need to buzz down into the object to copy parameters\n\t\t\t\tif ( hungarianKey.charAt(0) === 'o' )\n\t\t\t\t{\n\t\t\t\t\t// Copy the camelCase options over to the hungarian\n\t\t\t\t\tif ( ! user[ hungarianKey ] ) {\n\t\t\t\t\t\tuser[ hungarianKey ] = {};\n\t\t\t\t\t}\n\t\t\t\t\t$.extend( true, user[hungarianKey], user[key] );\n\t\n\t\t\t\t\t_fnCamelToHungarian( src[hungarianKey], user[hungarianKey], force );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tuser[hungarianKey] = user[ key ];\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\t\n\t\n\t/**\n\t * Language compatibility - when certain options are given, and others aren't, we\n\t * need to duplicate the values over, in order to provide backwards compatibility\n\t * with older language files.\n\t *  @param {object} oSettings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnLanguageCompat( lang )\n\t{\n\t\tvar defaults = DataTable.defaults.oLanguage;\n\t\tvar zeroRecords = lang.sZeroRecords;\n\t\n\t\t/* Backwards compatibility - if there is no sEmptyTable given, then use the same as\n\t\t * sZeroRecords - assuming that is given.\n\t\t */\n\t\tif ( ! lang.sEmptyTable && zeroRecords &&\n\t\t\tdefaults.sEmptyTable === \"No data available in table\" )\n\t\t{\n\t\t\t_fnMap( lang, lang, 'sZeroRecords', 'sEmptyTable' );\n\t\t}\n\t\n\t\t/* Likewise with loading records */\n\t\tif ( ! lang.sLoadingRecords && zeroRecords &&\n\t\t\tdefaults.sLoadingRecords === \"Loading...\" )\n\t\t{\n\t\t\t_fnMap( lang, lang, 'sZeroRecords', 'sLoadingRecords' );\n\t\t}\n\t\n\t\t// Old parameter name of the thousands separator mapped onto the new\n\t\tif ( lang.sInfoThousands ) {\n\t\t\tlang.sThousands = lang.sInfoThousands;\n\t\t}\n\t\n\t\tvar decimal = lang.sDecimal;\n\t\tif ( decimal ) {\n\t\t\t_addNumericSort( decimal );\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Map one parameter onto another\n\t *  @param {object} o Object to map\n\t *  @param {*} knew The new parameter name\n\t *  @param {*} old The old parameter name\n\t */\n\tvar _fnCompatMap = function ( o, knew, old ) {\n\t\tif ( o[ knew ] !== undefined ) {\n\t\t\to[ old ] = o[ knew ];\n\t\t}\n\t};\n\t\n\t\n\t/**\n\t * Provide backwards compatibility for the main DT options. Note that the new\n\t * options are mapped onto the old parameters, so this is an external interface\n\t * change only.\n\t *  @param {object} init Object to map\n\t */\n\tfunction _fnCompatOpts ( init )\n\t{\n\t\t_fnCompatMap( init, 'ordering',      'bSort' );\n\t\t_fnCompatMap( init, 'orderMulti',    'bSortMulti' );\n\t\t_fnCompatMap( init, 'orderClasses',  'bSortClasses' );\n\t\t_fnCompatMap( init, 'orderCellsTop', 'bSortCellsTop' );\n\t\t_fnCompatMap( init, 'order',         'aaSorting' );\n\t\t_fnCompatMap( init, 'orderFixed',    'aaSortingFixed' );\n\t\t_fnCompatMap( init, 'paging',        'bPaginate' );\n\t\t_fnCompatMap( init, 'pagingType',    'sPaginationType' );\n\t\t_fnCompatMap( init, 'pageLength',    'iDisplayLength' );\n\t\t_fnCompatMap( init, 'searching',     'bFilter' );\n\t\n\t\t// Boolean initialisation of x-scrolling\n\t\tif ( typeof init.sScrollX === 'boolean' ) {\n\t\t\tinit.sScrollX = init.sScrollX ? '100%' : '';\n\t\t}\n\t\tif ( typeof init.scrollX === 'boolean' ) {\n\t\t\tinit.scrollX = init.scrollX ? '100%' : '';\n\t\t}\n\t\n\t\t// Column search objects are in an array, so it needs to be converted\n\t\t// element by element\n\t\tvar searchCols = init.aoSearchCols;\n\t\n\t\tif ( searchCols ) {\n\t\t\tfor ( var i=0, ien=searchCols.length ; i<ien ; i++ ) {\n\t\t\t\tif ( searchCols[i] ) {\n\t\t\t\t\t_fnCamelToHungarian( DataTable.models.oSearch, searchCols[i] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Provide backwards compatibility for column options. Note that the new options\n\t * are mapped onto the old parameters, so this is an external interface change\n\t * only.\n\t *  @param {object} init Object to map\n\t */\n\tfunction _fnCompatCols ( init )\n\t{\n\t\t_fnCompatMap( init, 'orderable',     'bSortable' );\n\t\t_fnCompatMap( init, 'orderData',     'aDataSort' );\n\t\t_fnCompatMap( init, 'orderSequence', 'asSorting' );\n\t\t_fnCompatMap( init, 'orderDataType', 'sortDataType' );\n\t\n\t\t// orderData can be given as an integer\n\t\tvar dataSort = init.aDataSort;\n\t\tif ( dataSort && ! $.isArray( dataSort ) ) {\n\t\t\tinit.aDataSort = [ dataSort ];\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Browser feature detection for capabilities, quirks\n\t *  @param {object} settings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnBrowserDetect( settings )\n\t{\n\t\t// We don't need to do this every time DataTables is constructed, the values\n\t\t// calculated are specific to the browser and OS configuration which we\n\t\t// don't expect to change between initialisations\n\t\tif ( ! DataTable.__browser ) {\n\t\t\tvar browser = {};\n\t\t\tDataTable.__browser = browser;\n\t\n\t\t\t// Scrolling feature / quirks detection\n\t\t\tvar n = $('<div/>')\n\t\t\t\t.css( {\n\t\t\t\t\tposition: 'fixed',\n\t\t\t\t\ttop: 0,\n\t\t\t\t\tleft: 0,\n\t\t\t\t\theight: 1,\n\t\t\t\t\twidth: 1,\n\t\t\t\t\toverflow: 'hidden'\n\t\t\t\t} )\n\t\t\t\t.append(\n\t\t\t\t\t$('<div/>')\n\t\t\t\t\t\t.css( {\n\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\ttop: 1,\n\t\t\t\t\t\t\tleft: 1,\n\t\t\t\t\t\t\twidth: 100,\n\t\t\t\t\t\t\toverflow: 'scroll'\n\t\t\t\t\t\t} )\n\t\t\t\t\t\t.append(\n\t\t\t\t\t\t\t$('<div/>')\n\t\t\t\t\t\t\t\t.css( {\n\t\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\t\theight: 10\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.appendTo( 'body' );\n\t\n\t\t\tvar outer = n.children();\n\t\t\tvar inner = outer.children();\n\t\n\t\t\t// Numbers below, in order, are:\n\t\t\t// inner.offsetWidth, inner.clientWidth, outer.offsetWidth, outer.clientWidth\n\t\t\t//\n\t\t\t// IE6 XP:                           100 100 100  83\n\t\t\t// IE7 Vista:                        100 100 100  83\n\t\t\t// IE 8+ Windows:                     83  83 100  83\n\t\t\t// Evergreen Windows:                 83  83 100  83\n\t\t\t// Evergreen Mac with scrollbars:     85  85 100  85\n\t\t\t// Evergreen Mac without scrollbars: 100 100 100 100\n\t\n\t\t\t// Get scrollbar width\n\t\t\tbrowser.barWidth = outer[0].offsetWidth - outer[0].clientWidth;\n\t\n\t\t\t// IE6/7 will oversize a width 100% element inside a scrolling element, to\n\t\t\t// include the width of the scrollbar, while other browsers ensure the inner\n\t\t\t// element is contained without forcing scrolling\n\t\t\tbrowser.bScrollOversize = inner[0].offsetWidth === 100 && outer[0].clientWidth !== 100;\n\t\n\t\t\t// In rtl text layout, some browsers (most, but not all) will place the\n\t\t\t// scrollbar on the left, rather than the right.\n\t\t\tbrowser.bScrollbarLeft = Math.round( inner.offset().left ) !== 1;\n\t\n\t\t\t// IE8- don't provide height and width for getBoundingClientRect\n\t\t\tbrowser.bBounding = n[0].getBoundingClientRect().width ? true : false;\n\t\n\t\t\tn.remove();\n\t\t}\n\t\n\t\t$.extend( settings.oBrowser, DataTable.__browser );\n\t\tsettings.oScroll.iBarWidth = DataTable.__browser.barWidth;\n\t}\n\t\n\t\n\t/**\n\t * Array.prototype reduce[Right] method, used for browsers which don't support\n\t * JS 1.6. Done this way to reduce code size, since we iterate either way\n\t *  @param {object} settings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnReduce ( that, fn, init, start, end, inc )\n\t{\n\t\tvar\n\t\t\ti = start,\n\t\t\tvalue,\n\t\t\tisSet = false;\n\t\n\t\tif ( init !== undefined ) {\n\t\t\tvalue = init;\n\t\t\tisSet = true;\n\t\t}\n\t\n\t\twhile ( i !== end ) {\n\t\t\tif ( ! that.hasOwnProperty(i) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\n\t\t\tvalue = isSet ?\n\t\t\t\tfn( value, that[i], i, that ) :\n\t\t\t\tthat[i];\n\t\n\t\t\tisSet = true;\n\t\t\ti += inc;\n\t\t}\n\t\n\t\treturn value;\n\t}\n\t\n\t/**\n\t * Add a column to the list used for the table with default values\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param {node} nTh The th element for this column\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnAddColumn( oSettings, nTh )\n\t{\n\t\t// Add column to aoColumns array\n\t\tvar oDefaults = DataTable.defaults.column;\n\t\tvar iCol = oSettings.aoColumns.length;\n\t\tvar oCol = $.extend( {}, DataTable.models.oColumn, oDefaults, {\n\t\t\t\"nTh\": nTh ? nTh : document.createElement('th'),\n\t\t\t\"sTitle\":    oDefaults.sTitle    ? oDefaults.sTitle    : nTh ? nTh.innerHTML : '',\n\t\t\t\"aDataSort\": oDefaults.aDataSort ? oDefaults.aDataSort : [iCol],\n\t\t\t\"mData\": oDefaults.mData ? oDefaults.mData : iCol,\n\t\t\tidx: iCol\n\t\t} );\n\t\toSettings.aoColumns.push( oCol );\n\t\n\t\t// Add search object for column specific search. Note that the `searchCols[ iCol ]`\n\t\t// passed into extend can be undefined. This allows the user to give a default\n\t\t// with only some of the parameters defined, and also not give a default\n\t\tvar searchCols = oSettings.aoPreSearchCols;\n\t\tsearchCols[ iCol ] = $.extend( {}, DataTable.models.oSearch, searchCols[ iCol ] );\n\t\n\t\t// Use the default column options function to initialise classes etc\n\t\t_fnColumnOptions( oSettings, iCol, $(nTh).data() );\n\t}\n\t\n\t\n\t/**\n\t * Apply options for a column\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param {int} iCol column index to consider\n\t *  @param {object} oOptions object with sType, bVisible and bSearchable etc\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnColumnOptions( oSettings, iCol, oOptions )\n\t{\n\t\tvar oCol = oSettings.aoColumns[ iCol ];\n\t\tvar oClasses = oSettings.oClasses;\n\t\tvar th = $(oCol.nTh);\n\t\n\t\t// Try to get width information from the DOM. We can't get it from CSS\n\t\t// as we'd need to parse the CSS stylesheet. `width` option can override\n\t\tif ( ! oCol.sWidthOrig ) {\n\t\t\t// Width attribute\n\t\t\toCol.sWidthOrig = th.attr('width') || null;\n\t\n\t\t\t// Style attribute\n\t\t\tvar t = (th.attr('style') || '').match(/width:\\s*(\\d+[pxem%]+)/);\n\t\t\tif ( t ) {\n\t\t\t\toCol.sWidthOrig = t[1];\n\t\t\t}\n\t\t}\n\t\n\t\t/* User specified column options */\n\t\tif ( oOptions !== undefined && oOptions !== null )\n\t\t{\n\t\t\t// Backwards compatibility\n\t\t\t_fnCompatCols( oOptions );\n\t\n\t\t\t// Map camel case parameters to their Hungarian counterparts\n\t\t\t_fnCamelToHungarian( DataTable.defaults.column, oOptions );\n\t\n\t\t\t/* Backwards compatibility for mDataProp */\n\t\t\tif ( oOptions.mDataProp !== undefined && !oOptions.mData )\n\t\t\t{\n\t\t\t\toOptions.mData = oOptions.mDataProp;\n\t\t\t}\n\t\n\t\t\tif ( oOptions.sType )\n\t\t\t{\n\t\t\t\toCol._sManualType = oOptions.sType;\n\t\t\t}\n\t\n\t\t\t// `class` is a reserved word in Javascript, so we need to provide\n\t\t\t// the ability to use a valid name for the camel case input\n\t\t\tif ( oOptions.className && ! oOptions.sClass )\n\t\t\t{\n\t\t\t\toOptions.sClass = oOptions.className;\n\t\t\t}\n\t\n\t\t\t$.extend( oCol, oOptions );\n\t\t\t_fnMap( oCol, oOptions, \"sWidth\", \"sWidthOrig\" );\n\t\n\t\t\t/* iDataSort to be applied (backwards compatibility), but aDataSort will take\n\t\t\t * priority if defined\n\t\t\t */\n\t\t\tif ( oOptions.iDataSort !== undefined )\n\t\t\t{\n\t\t\t\toCol.aDataSort = [ oOptions.iDataSort ];\n\t\t\t}\n\t\t\t_fnMap( oCol, oOptions, \"aDataSort\" );\n\t\t}\n\t\n\t\t/* Cache the data get and set functions for speed */\n\t\tvar mDataSrc = oCol.mData;\n\t\tvar mData = _fnGetObjectDataFn( mDataSrc );\n\t\tvar mRender = oCol.mRender ? _fnGetObjectDataFn( oCol.mRender ) : null;\n\t\n\t\tvar attrTest = function( src ) {\n\t\t\treturn typeof src === 'string' && src.indexOf('@') !== -1;\n\t\t};\n\t\toCol._bAttrSrc = $.isPlainObject( mDataSrc ) && (\n\t\t\tattrTest(mDataSrc.sort) || attrTest(mDataSrc.type) || attrTest(mDataSrc.filter)\n\t\t);\n\t\toCol._setter = null;\n\t\n\t\toCol.fnGetData = function (rowData, type, meta) {\n\t\t\tvar innerData = mData( rowData, type, undefined, meta );\n\t\n\t\t\treturn mRender && type ?\n\t\t\t\tmRender( innerData, type, rowData, meta ) :\n\t\t\t\tinnerData;\n\t\t};\n\t\toCol.fnSetData = function ( rowData, val, meta ) {\n\t\t\treturn _fnSetObjectDataFn( mDataSrc )( rowData, val, meta );\n\t\t};\n\t\n\t\t// Indicate if DataTables should read DOM data as an object or array\n\t\t// Used in _fnGetRowElements\n\t\tif ( typeof mDataSrc !== 'number' ) {\n\t\t\toSettings._rowReadObject = true;\n\t\t}\n\t\n\t\t/* Feature sorting overrides column specific when off */\n\t\tif ( !oSettings.oFeatures.bSort )\n\t\t{\n\t\t\toCol.bSortable = false;\n\t\t\tth.addClass( oClasses.sSortableNone ); // Have to add class here as order event isn't called\n\t\t}\n\t\n\t\t/* Check that the class assignment is correct for sorting */\n\t\tvar bAsc = $.inArray('asc', oCol.asSorting) !== -1;\n\t\tvar bDesc = $.inArray('desc', oCol.asSorting) !== -1;\n\t\tif ( !oCol.bSortable || (!bAsc && !bDesc) )\n\t\t{\n\t\t\toCol.sSortingClass = oClasses.sSortableNone;\n\t\t\toCol.sSortingClassJUI = \"\";\n\t\t}\n\t\telse if ( bAsc && !bDesc )\n\t\t{\n\t\t\toCol.sSortingClass = oClasses.sSortableAsc;\n\t\t\toCol.sSortingClassJUI = oClasses.sSortJUIAscAllowed;\n\t\t}\n\t\telse if ( !bAsc && bDesc )\n\t\t{\n\t\t\toCol.sSortingClass = oClasses.sSortableDesc;\n\t\t\toCol.sSortingClassJUI = oClasses.sSortJUIDescAllowed;\n\t\t}\n\t\telse\n\t\t{\n\t\t\toCol.sSortingClass = oClasses.sSortable;\n\t\t\toCol.sSortingClassJUI = oClasses.sSortJUI;\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Adjust the table column widths for new data. Note: you would probably want to\n\t * do a redraw after calling this function!\n\t *  @param {object} settings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnAdjustColumnSizing ( settings )\n\t{\n\t\t/* Not interested in doing column width calculation if auto-width is disabled */\n\t\tif ( settings.oFeatures.bAutoWidth !== false )\n\t\t{\n\t\t\tvar columns = settings.aoColumns;\n\t\n\t\t\t_fnCalculateColumnWidths( settings );\n\t\t\tfor ( var i=0 , iLen=columns.length ; i<iLen ; i++ )\n\t\t\t{\n\t\t\t\tcolumns[i].nTh.style.width = columns[i].sWidth;\n\t\t\t}\n\t\t}\n\t\n\t\tvar scroll = settings.oScroll;\n\t\tif ( scroll.sY !== '' || scroll.sX !== '')\n\t\t{\n\t\t\t_fnScrollDraw( settings );\n\t\t}\n\t\n\t\t_fnCallbackFire( settings, null, 'column-sizing', [settings] );\n\t}\n\t\n\t\n\t/**\n\t * Covert the index of a visible column to the index in the data array (take account\n\t * of hidden columns)\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param {int} iMatch Visible column index to lookup\n\t *  @returns {int} i the data index\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnVisibleToColumnIndex( oSettings, iMatch )\n\t{\n\t\tvar aiVis = _fnGetColumns( oSettings, 'bVisible' );\n\t\n\t\treturn typeof aiVis[iMatch] === 'number' ?\n\t\t\taiVis[iMatch] :\n\t\t\tnull;\n\t}\n\t\n\t\n\t/**\n\t * Covert the index of an index in the data array and convert it to the visible\n\t *   column index (take account of hidden columns)\n\t *  @param {int} iMatch Column index to lookup\n\t *  @param {object} oSettings dataTables settings object\n\t *  @returns {int} i the data index\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnColumnIndexToVisible( oSettings, iMatch )\n\t{\n\t\tvar aiVis = _fnGetColumns( oSettings, 'bVisible' );\n\t\tvar iPos = $.inArray( iMatch, aiVis );\n\t\n\t\treturn iPos !== -1 ? iPos : null;\n\t}\n\t\n\t\n\t/**\n\t * Get the number of visible columns\n\t *  @param {object} oSettings dataTables settings object\n\t *  @returns {int} i the number of visible columns\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnVisbleColumns( oSettings )\n\t{\n\t\tvar vis = 0;\n\t\n\t\t// No reduce in IE8, use a loop for now\n\t\t$.each( oSettings.aoColumns, function ( i, col ) {\n\t\t\tif ( col.bVisible && $(col.nTh).css('display') !== 'none' ) {\n\t\t\t\tvis++;\n\t\t\t}\n\t\t} );\n\t\n\t\treturn vis;\n\t}\n\t\n\t\n\t/**\n\t * Get an array of column indexes that match a given property\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param {string} sParam Parameter in aoColumns to look for - typically\n\t *    bVisible or bSearchable\n\t *  @returns {array} Array of indexes with matched properties\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnGetColumns( oSettings, sParam )\n\t{\n\t\tvar a = [];\n\t\n\t\t$.map( oSettings.aoColumns, function(val, i) {\n\t\t\tif ( val[sParam] ) {\n\t\t\t\ta.push( i );\n\t\t\t}\n\t\t} );\n\t\n\t\treturn a;\n\t}\n\t\n\t\n\t/**\n\t * Calculate the 'type' of a column\n\t *  @param {object} settings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnColumnTypes ( settings )\n\t{\n\t\tvar columns = settings.aoColumns;\n\t\tvar data = settings.aoData;\n\t\tvar types = DataTable.ext.type.detect;\n\t\tvar i, ien, j, jen, k, ken;\n\t\tvar col, cell, detectedType, cache;\n\t\n\t\t// For each column, spin over the \n\t\tfor ( i=0, ien=columns.length ; i<ien ; i++ ) {\n\t\t\tcol = columns[i];\n\t\t\tcache = [];\n\t\n\t\t\tif ( ! col.sType && col._sManualType ) {\n\t\t\t\tcol.sType = col._sManualType;\n\t\t\t}\n\t\t\telse if ( ! col.sType ) {\n\t\t\t\tfor ( j=0, jen=types.length ; j<jen ; j++ ) {\n\t\t\t\t\tfor ( k=0, ken=data.length ; k<ken ; k++ ) {\n\t\t\t\t\t\t// Use a cache array so we only need to get the type data\n\t\t\t\t\t\t// from the formatter once (when using multiple detectors)\n\t\t\t\t\t\tif ( cache[k] === undefined ) {\n\t\t\t\t\t\t\tcache[k] = _fnGetCellData( settings, k, i, 'type' );\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\tdetectedType = types[j]( cache[k], settings );\n\t\n\t\t\t\t\t\t// If null, then this type can't apply to this column, so\n\t\t\t\t\t\t// rather than testing all cells, break out. There is an\n\t\t\t\t\t\t// exception for the last type which is `html`. We need to\n\t\t\t\t\t\t// scan all rows since it is possible to mix string and HTML\n\t\t\t\t\t\t// types\n\t\t\t\t\t\tif ( ! detectedType && j !== types.length-1 ) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t// Only a single match is needed for html type since it is\n\t\t\t\t\t\t// bottom of the pile and very similar to string\n\t\t\t\t\t\tif ( detectedType === 'html' ) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Type is valid for all data points in the column - use this\n\t\t\t\t\t// type\n\t\t\t\t\tif ( detectedType ) {\n\t\t\t\t\t\tcol.sType = detectedType;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Fall back - if no type was detected, always use string\n\t\t\t\tif ( ! col.sType ) {\n\t\t\t\t\tcol.sType = 'string';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Take the column definitions and static columns arrays and calculate how\n\t * they relate to column indexes. The callback function will then apply the\n\t * definition found for a column to a suitable configuration object.\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param {array} aoColDefs The aoColumnDefs array that is to be applied\n\t *  @param {array} aoCols The aoColumns array that defines columns individually\n\t *  @param {function} fn Callback function - takes two parameters, the calculated\n\t *    column index and the definition for that column.\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnApplyColumnDefs( oSettings, aoColDefs, aoCols, fn )\n\t{\n\t\tvar i, iLen, j, jLen, k, kLen, def;\n\t\tvar columns = oSettings.aoColumns;\n\t\n\t\t// Column definitions with aTargets\n\t\tif ( aoColDefs )\n\t\t{\n\t\t\t/* Loop over the definitions array - loop in reverse so first instance has priority */\n\t\t\tfor ( i=aoColDefs.length-1 ; i>=0 ; i-- )\n\t\t\t{\n\t\t\t\tdef = aoColDefs[i];\n\t\n\t\t\t\t/* Each definition can target multiple columns, as it is an array */\n\t\t\t\tvar aTargets = def.targets !== undefined ?\n\t\t\t\t\tdef.targets :\n\t\t\t\t\tdef.aTargets;\n\t\n\t\t\t\tif ( ! $.isArray( aTargets ) )\n\t\t\t\t{\n\t\t\t\t\taTargets = [ aTargets ];\n\t\t\t\t}\n\t\n\t\t\t\tfor ( j=0, jLen=aTargets.length ; j<jLen ; j++ )\n\t\t\t\t{\n\t\t\t\t\tif ( typeof aTargets[j] === 'number' && aTargets[j] >= 0 )\n\t\t\t\t\t{\n\t\t\t\t\t\t/* Add columns that we don't yet know about */\n\t\t\t\t\t\twhile( columns.length <= aTargets[j] )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t_fnAddColumn( oSettings );\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t/* Integer, basic index */\n\t\t\t\t\t\tfn( aTargets[j], def );\n\t\t\t\t\t}\n\t\t\t\t\telse if ( typeof aTargets[j] === 'number' && aTargets[j] < 0 )\n\t\t\t\t\t{\n\t\t\t\t\t\t/* Negative integer, right to left column counting */\n\t\t\t\t\t\tfn( columns.length+aTargets[j], def );\n\t\t\t\t\t}\n\t\t\t\t\telse if ( typeof aTargets[j] === 'string' )\n\t\t\t\t\t{\n\t\t\t\t\t\t/* Class name matching on TH element */\n\t\t\t\t\t\tfor ( k=0, kLen=columns.length ; k<kLen ; k++ )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ( aTargets[j] == \"_all\" ||\n\t\t\t\t\t\t\t     $(columns[k].nTh).hasClass( aTargets[j] ) )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfn( k, def );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\t// Statically defined columns array\n\t\tif ( aoCols )\n\t\t{\n\t\t\tfor ( i=0, iLen=aoCols.length ; i<iLen ; i++ )\n\t\t\t{\n\t\t\t\tfn( i, aoCols[i] );\n\t\t\t}\n\t\t}\n\t}\n\t\n\t/**\n\t * Add a data array to the table, creating DOM node etc. This is the parallel to\n\t * _fnGatherData, but for adding rows from a Javascript source, rather than a\n\t * DOM source.\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param {array} aData data array to be added\n\t *  @param {node} [nTr] TR element to add to the table - optional. If not given,\n\t *    DataTables will create a row automatically\n\t *  @param {array} [anTds] Array of TD|TH elements for the row - must be given\n\t *    if nTr is.\n\t *  @returns {int} >=0 if successful (index of new aoData entry), -1 if failed\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnAddData ( oSettings, aDataIn, nTr, anTds )\n\t{\n\t\t/* Create the object for storing information about this new row */\n\t\tvar iRow = oSettings.aoData.length;\n\t\tvar oData = $.extend( true, {}, DataTable.models.oRow, {\n\t\t\tsrc: nTr ? 'dom' : 'data',\n\t\t\tidx: iRow\n\t\t} );\n\t\n\t\toData._aData = aDataIn;\n\t\toSettings.aoData.push( oData );\n\t\n\t\t/* Create the cells */\n\t\tvar nTd, sThisType;\n\t\tvar columns = oSettings.aoColumns;\n\t\n\t\t// Invalidate the column types as the new data needs to be revalidated\n\t\tfor ( var i=0, iLen=columns.length ; i<iLen ; i++ )\n\t\t{\n\t\t\tcolumns[i].sType = null;\n\t\t}\n\t\n\t\t/* Add to the display array */\n\t\toSettings.aiDisplayMaster.push( iRow );\n\t\n\t\tvar id = oSettings.rowIdFn( aDataIn );\n\t\tif ( id !== undefined ) {\n\t\t\toSettings.aIds[ id ] = oData;\n\t\t}\n\t\n\t\t/* Create the DOM information, or register it if already present */\n\t\tif ( nTr || ! oSettings.oFeatures.bDeferRender )\n\t\t{\n\t\t\t_fnCreateTr( oSettings, iRow, nTr, anTds );\n\t\t}\n\t\n\t\treturn iRow;\n\t}\n\t\n\t\n\t/**\n\t * Add one or more TR elements to the table. Generally we'd expect to\n\t * use this for reading data from a DOM sourced table, but it could be\n\t * used for an TR element. Note that if a TR is given, it is used (i.e.\n\t * it is not cloned).\n\t *  @param {object} settings dataTables settings object\n\t *  @param {array|node|jQuery} trs The TR element(s) to add to the table\n\t *  @returns {array} Array of indexes for the added rows\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnAddTr( settings, trs )\n\t{\n\t\tvar row;\n\t\n\t\t// Allow an individual node to be passed in\n\t\tif ( ! (trs instanceof $) ) {\n\t\t\ttrs = $(trs);\n\t\t}\n\t\n\t\treturn trs.map( function (i, el) {\n\t\t\trow = _fnGetRowElements( settings, el );\n\t\t\treturn _fnAddData( settings, row.data, el, row.cells );\n\t\t} );\n\t}\n\t\n\t\n\t/**\n\t * Take a TR element and convert it to an index in aoData\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param {node} n the TR element to find\n\t *  @returns {int} index if the node is found, null if not\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnNodeToDataIndex( oSettings, n )\n\t{\n\t\treturn (n._DT_RowIndex!==undefined) ? n._DT_RowIndex : null;\n\t}\n\t\n\t\n\t/**\n\t * Take a TD element and convert it into a column data index (not the visible index)\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param {int} iRow The row number the TD/TH can be found in\n\t *  @param {node} n The TD/TH element to find\n\t *  @returns {int} index if the node is found, -1 if not\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnNodeToColumnIndex( oSettings, iRow, n )\n\t{\n\t\treturn $.inArray( n, oSettings.aoData[ iRow ].anCells );\n\t}\n\t\n\t\n\t/**\n\t * Get the data for a given cell from the internal cache, taking into account data mapping\n\t *  @param {object} settings dataTables settings object\n\t *  @param {int} rowIdx aoData row id\n\t *  @param {int} colIdx Column index\n\t *  @param {string} type data get type ('display', 'type' 'filter' 'sort')\n\t *  @returns {*} Cell data\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnGetCellData( settings, rowIdx, colIdx, type )\n\t{\n\t\tvar draw           = settings.iDraw;\n\t\tvar col            = settings.aoColumns[colIdx];\n\t\tvar rowData        = settings.aoData[rowIdx]._aData;\n\t\tvar defaultContent = col.sDefaultContent;\n\t\tvar cellData       = col.fnGetData( rowData, type, {\n\t\t\tsettings: settings,\n\t\t\trow:      rowIdx,\n\t\t\tcol:      colIdx\n\t\t} );\n\t\n\t\tif ( cellData === undefined ) {\n\t\t\tif ( settings.iDrawError != draw && defaultContent === null ) {\n\t\t\t\t_fnLog( settings, 0, \"Requested unknown parameter \"+\n\t\t\t\t\t(typeof col.mData=='function' ? '{function}' : \"'\"+col.mData+\"'\")+\n\t\t\t\t\t\" for row \"+rowIdx+\", column \"+colIdx, 4 );\n\t\t\t\tsettings.iDrawError = draw;\n\t\t\t}\n\t\t\treturn defaultContent;\n\t\t}\n\t\n\t\t// When the data source is null and a specific data type is requested (i.e.\n\t\t// not the original data), we can use default column data\n\t\tif ( (cellData === rowData || cellData === null) && defaultContent !== null && type !== undefined ) {\n\t\t\tcellData = defaultContent;\n\t\t}\n\t\telse if ( typeof cellData === 'function' ) {\n\t\t\t// If the data source is a function, then we run it and use the return,\n\t\t\t// executing in the scope of the data object (for instances)\n\t\t\treturn cellData.call( rowData );\n\t\t}\n\t\n\t\tif ( cellData === null && type == 'display' ) {\n\t\t\treturn '';\n\t\t}\n\t\treturn cellData;\n\t}\n\t\n\t\n\t/**\n\t * Set the value for a specific cell, into the internal data cache\n\t *  @param {object} settings dataTables settings object\n\t *  @param {int} rowIdx aoData row id\n\t *  @param {int} colIdx Column index\n\t *  @param {*} val Value to set\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnSetCellData( settings, rowIdx, colIdx, val )\n\t{\n\t\tvar col     = settings.aoColumns[colIdx];\n\t\tvar rowData = settings.aoData[rowIdx]._aData;\n\t\n\t\tcol.fnSetData( rowData, val, {\n\t\t\tsettings: settings,\n\t\t\trow:      rowIdx,\n\t\t\tcol:      colIdx\n\t\t}  );\n\t}\n\t\n\t\n\t// Private variable that is used to match action syntax in the data property object\n\tvar __reArray = /\\[.*?\\]$/;\n\tvar __reFn = /\\(\\)$/;\n\t\n\t/**\n\t * Split string on periods, taking into account escaped periods\n\t * @param  {string} str String to split\n\t * @return {array} Split string\n\t */\n\tfunction _fnSplitObjNotation( str )\n\t{\n\t\treturn $.map( str.match(/(\\\\.|[^\\.])+/g) || [''], function ( s ) {\n\t\t\treturn s.replace(/\\\\./g, '.');\n\t\t} );\n\t}\n\t\n\t\n\t/**\n\t * Return a function that can be used to get data from a source object, taking\n\t * into account the ability to use nested objects as a source\n\t *  @param {string|int|function} mSource The data source for the object\n\t *  @returns {function} Data get function\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnGetObjectDataFn( mSource )\n\t{\n\t\tif ( $.isPlainObject( mSource ) )\n\t\t{\n\t\t\t/* Build an object of get functions, and wrap them in a single call */\n\t\t\tvar o = {};\n\t\t\t$.each( mSource, function (key, val) {\n\t\t\t\tif ( val ) {\n\t\t\t\t\to[key] = _fnGetObjectDataFn( val );\n\t\t\t\t}\n\t\t\t} );\n\t\n\t\t\treturn function (data, type, row, meta) {\n\t\t\t\tvar t = o[type] || o._;\n\t\t\t\treturn t !== undefined ?\n\t\t\t\t\tt(data, type, row, meta) :\n\t\t\t\t\tdata;\n\t\t\t};\n\t\t}\n\t\telse if ( mSource === null )\n\t\t{\n\t\t\t/* Give an empty string for rendering / sorting etc */\n\t\t\treturn function (data) { // type, row and meta also passed, but not used\n\t\t\t\treturn data;\n\t\t\t};\n\t\t}\n\t\telse if ( typeof mSource === 'function' )\n\t\t{\n\t\t\treturn function (data, type, row, meta) {\n\t\t\t\treturn mSource( data, type, row, meta );\n\t\t\t};\n\t\t}\n\t\telse if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 ||\n\t\t\t      mSource.indexOf('[') !== -1 || mSource.indexOf('(') !== -1) )\n\t\t{\n\t\t\t/* If there is a . in the source string then the data source is in a\n\t\t\t * nested object so we loop over the data for each level to get the next\n\t\t\t * level down. On each loop we test for undefined, and if found immediately\n\t\t\t * return. This allows entire objects to be missing and sDefaultContent to\n\t\t\t * be used if defined, rather than throwing an error\n\t\t\t */\n\t\t\tvar fetchData = function (data, type, src) {\n\t\t\t\tvar arrayNotation, funcNotation, out, innerSrc;\n\t\n\t\t\t\tif ( src !== \"\" )\n\t\t\t\t{\n\t\t\t\t\tvar a = _fnSplitObjNotation( src );\n\t\n\t\t\t\t\tfor ( var i=0, iLen=a.length ; i<iLen ; i++ )\n\t\t\t\t\t{\n\t\t\t\t\t\t// Check if we are dealing with special notation\n\t\t\t\t\t\tarrayNotation = a[i].match(__reArray);\n\t\t\t\t\t\tfuncNotation = a[i].match(__reFn);\n\t\n\t\t\t\t\t\tif ( arrayNotation )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Array notation\n\t\t\t\t\t\t\ta[i] = a[i].replace(__reArray, '');\n\t\n\t\t\t\t\t\t\t// Condition allows simply [] to be passed in\n\t\t\t\t\t\t\tif ( a[i] !== \"\" ) {\n\t\t\t\t\t\t\t\tdata = data[ a[i] ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tout = [];\n\t\n\t\t\t\t\t\t\t// Get the remainder of the nested object to get\n\t\t\t\t\t\t\ta.splice( 0, i+1 );\n\t\t\t\t\t\t\tinnerSrc = a.join('.');\n\t\n\t\t\t\t\t\t\t// Traverse each entry in the array getting the properties requested\n\t\t\t\t\t\t\tif ( $.isArray( data ) ) {\n\t\t\t\t\t\t\t\tfor ( var j=0, jLen=data.length ; j<jLen ; j++ ) {\n\t\t\t\t\t\t\t\t\tout.push( fetchData( data[j], type, innerSrc ) );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t// If a string is given in between the array notation indicators, that\n\t\t\t\t\t\t\t// is used to join the strings together, otherwise an array is returned\n\t\t\t\t\t\t\tvar join = arrayNotation[0].substring(1, arrayNotation[0].length-1);\n\t\t\t\t\t\t\tdata = (join===\"\") ? out : out.join(join);\n\t\n\t\t\t\t\t\t\t// The inner call to fetchData has already traversed through the remainder\n\t\t\t\t\t\t\t// of the source requested, so we exit from the loop\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if ( funcNotation )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Function call\n\t\t\t\t\t\t\ta[i] = a[i].replace(__reFn, '');\n\t\t\t\t\t\t\tdata = data[ a[i] ]();\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\tif ( data === null || data[ a[i] ] === undefined )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdata = data[ a[i] ];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\treturn data;\n\t\t\t};\n\t\n\t\t\treturn function (data, type) { // row and meta also passed, but not used\n\t\t\t\treturn fetchData( data, type, mSource );\n\t\t\t};\n\t\t}\n\t\telse\n\t\t{\n\t\t\t/* Array or flat object mapping */\n\t\t\treturn function (data, type) { // row and meta also passed, but not used\n\t\t\t\treturn data[mSource];\n\t\t\t};\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Return a function that can be used to set data from a source object, taking\n\t * into account the ability to use nested objects as a source\n\t *  @param {string|int|function} mSource The data source for the object\n\t *  @returns {function} Data set function\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnSetObjectDataFn( mSource )\n\t{\n\t\tif ( $.isPlainObject( mSource ) )\n\t\t{\n\t\t\t/* Unlike get, only the underscore (global) option is used for for\n\t\t\t * setting data since we don't know the type here. This is why an object\n\t\t\t * option is not documented for `mData` (which is read/write), but it is\n\t\t\t * for `mRender` which is read only.\n\t\t\t */\n\t\t\treturn _fnSetObjectDataFn( mSource._ );\n\t\t}\n\t\telse if ( mSource === null )\n\t\t{\n\t\t\t/* Nothing to do when the data source is null */\n\t\t\treturn function () {};\n\t\t}\n\t\telse if ( typeof mSource === 'function' )\n\t\t{\n\t\t\treturn function (data, val, meta) {\n\t\t\t\tmSource( data, 'set', val, meta );\n\t\t\t};\n\t\t}\n\t\telse if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 ||\n\t\t\t      mSource.indexOf('[') !== -1 || mSource.indexOf('(') !== -1) )\n\t\t{\n\t\t\t/* Like the get, we need to get data from a nested object */\n\t\t\tvar setData = function (data, val, src) {\n\t\t\t\tvar a = _fnSplitObjNotation( src ), b;\n\t\t\t\tvar aLast = a[a.length-1];\n\t\t\t\tvar arrayNotation, funcNotation, o, innerSrc;\n\t\n\t\t\t\tfor ( var i=0, iLen=a.length-1 ; i<iLen ; i++ )\n\t\t\t\t{\n\t\t\t\t\t// Check if we are dealing with an array notation request\n\t\t\t\t\tarrayNotation = a[i].match(__reArray);\n\t\t\t\t\tfuncNotation = a[i].match(__reFn);\n\t\n\t\t\t\t\tif ( arrayNotation )\n\t\t\t\t\t{\n\t\t\t\t\t\ta[i] = a[i].replace(__reArray, '');\n\t\t\t\t\t\tdata[ a[i] ] = [];\n\t\n\t\t\t\t\t\t// Get the remainder of the nested object to set so we can recurse\n\t\t\t\t\t\tb = a.slice();\n\t\t\t\t\t\tb.splice( 0, i+1 );\n\t\t\t\t\t\tinnerSrc = b.join('.');\n\t\n\t\t\t\t\t\t// Traverse each entry in the array setting the properties requested\n\t\t\t\t\t\tif ( $.isArray( val ) )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfor ( var j=0, jLen=val.length ; j<jLen ; j++ )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\to = {};\n\t\t\t\t\t\t\t\tsetData( o, val[j], innerSrc );\n\t\t\t\t\t\t\t\tdata[ a[i] ].push( o );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// We've been asked to save data to an array, but it\n\t\t\t\t\t\t\t// isn't array data to be saved. Best that can be done\n\t\t\t\t\t\t\t// is to just save the value.\n\t\t\t\t\t\t\tdata[ a[i] ] = val;\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t// The inner call to setData has already traversed through the remainder\n\t\t\t\t\t\t// of the source and has set the data, thus we can exit here\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\telse if ( funcNotation )\n\t\t\t\t\t{\n\t\t\t\t\t\t// Function call\n\t\t\t\t\t\ta[i] = a[i].replace(__reFn, '');\n\t\t\t\t\t\tdata = data[ a[i] ]( val );\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// If the nested object doesn't currently exist - since we are\n\t\t\t\t\t// trying to set the value - create it\n\t\t\t\t\tif ( data[ a[i] ] === null || data[ a[i] ] === undefined )\n\t\t\t\t\t{\n\t\t\t\t\t\tdata[ a[i] ] = {};\n\t\t\t\t\t}\n\t\t\t\t\tdata = data[ a[i] ];\n\t\t\t\t}\n\t\n\t\t\t\t// Last item in the input - i.e, the actual set\n\t\t\t\tif ( aLast.match(__reFn ) )\n\t\t\t\t{\n\t\t\t\t\t// Function call\n\t\t\t\t\tdata = data[ aLast.replace(__reFn, '') ]( val );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// If array notation is used, we just want to strip it and use the property name\n\t\t\t\t\t// and assign the value. If it isn't used, then we get the result we want anyway\n\t\t\t\t\tdata[ aLast.replace(__reArray, '') ] = val;\n\t\t\t\t}\n\t\t\t};\n\t\n\t\t\treturn function (data, val) { // meta is also passed in, but not used\n\t\t\t\treturn setData( data, val, mSource );\n\t\t\t};\n\t\t}\n\t\telse\n\t\t{\n\t\t\t/* Array or flat object mapping */\n\t\t\treturn function (data, val) { // meta is also passed in, but not used\n\t\t\t\tdata[mSource] = val;\n\t\t\t};\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Return an array with the full table data\n\t *  @param {object} oSettings dataTables settings object\n\t *  @returns array {array} aData Master data array\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnGetDataMaster ( settings )\n\t{\n\t\treturn _pluck( settings.aoData, '_aData' );\n\t}\n\t\n\t\n\t/**\n\t * Nuke the table\n\t *  @param {object} oSettings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnClearTable( settings )\n\t{\n\t\tsettings.aoData.length = 0;\n\t\tsettings.aiDisplayMaster.length = 0;\n\t\tsettings.aiDisplay.length = 0;\n\t\tsettings.aIds = {};\n\t}\n\t\n\t\n\t /**\n\t * Take an array of integers (index array) and remove a target integer (value - not\n\t * the key!)\n\t *  @param {array} a Index array to target\n\t *  @param {int} iTarget value to find\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnDeleteIndex( a, iTarget, splice )\n\t{\n\t\tvar iTargetIndex = -1;\n\t\n\t\tfor ( var i=0, iLen=a.length ; i<iLen ; i++ )\n\t\t{\n\t\t\tif ( a[i] == iTarget )\n\t\t\t{\n\t\t\t\tiTargetIndex = i;\n\t\t\t}\n\t\t\telse if ( a[i] > iTarget )\n\t\t\t{\n\t\t\t\ta[i]--;\n\t\t\t}\n\t\t}\n\t\n\t\tif ( iTargetIndex != -1 && splice === undefined )\n\t\t{\n\t\t\ta.splice( iTargetIndex, 1 );\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Mark cached data as invalid such that a re-read of the data will occur when\n\t * the cached data is next requested. Also update from the data source object.\n\t *\n\t * @param {object} settings DataTables settings object\n\t * @param {int}    rowIdx   Row index to invalidate\n\t * @param {string} [src]    Source to invalidate from: undefined, 'auto', 'dom'\n\t *     or 'data'\n\t * @param {int}    [colIdx] Column index to invalidate. If undefined the whole\n\t *     row will be invalidated\n\t * @memberof DataTable#oApi\n\t *\n\t * @todo For the modularisation of v1.11 this will need to become a callback, so\n\t *   the sort and filter methods can subscribe to it. That will required\n\t *   initialisation options for sorting, which is why it is not already baked in\n\t */\n\tfunction _fnInvalidate( settings, rowIdx, src, colIdx )\n\t{\n\t\tvar row = settings.aoData[ rowIdx ];\n\t\tvar i, ien;\n\t\tvar cellWrite = function ( cell, col ) {\n\t\t\t// This is very frustrating, but in IE if you just write directly\n\t\t\t// to innerHTML, and elements that are overwritten are GC'ed,\n\t\t\t// even if there is a reference to them elsewhere\n\t\t\twhile ( cell.childNodes.length ) {\n\t\t\t\tcell.removeChild( cell.firstChild );\n\t\t\t}\n\t\n\t\t\tcell.innerHTML = _fnGetCellData( settings, rowIdx, col, 'display' );\n\t\t};\n\t\n\t\t// Are we reading last data from DOM or the data object?\n\t\tif ( src === 'dom' || ((! src || src === 'auto') && row.src === 'dom') ) {\n\t\t\t// Read the data from the DOM\n\t\t\trow._aData = _fnGetRowElements(\n\t\t\t\t\tsettings, row, colIdx, colIdx === undefined ? undefined : row._aData\n\t\t\t\t)\n\t\t\t\t.data;\n\t\t}\n\t\telse {\n\t\t\t// Reading from data object, update the DOM\n\t\t\tvar cells = row.anCells;\n\t\n\t\t\tif ( cells ) {\n\t\t\t\tif ( colIdx !== undefined ) {\n\t\t\t\t\tcellWrite( cells[colIdx], colIdx );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tfor ( i=0, ien=cells.length ; i<ien ; i++ ) {\n\t\t\t\t\t\tcellWrite( cells[i], i );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\t// For both row and cell invalidation, the cached data for sorting and\n\t\t// filtering is nulled out\n\t\trow._aSortData = null;\n\t\trow._aFilterData = null;\n\t\n\t\t// Invalidate the type for a specific column (if given) or all columns since\n\t\t// the data might have changed\n\t\tvar cols = settings.aoColumns;\n\t\tif ( colIdx !== undefined ) {\n\t\t\tcols[ colIdx ].sType = null;\n\t\t}\n\t\telse {\n\t\t\tfor ( i=0, ien=cols.length ; i<ien ; i++ ) {\n\t\t\t\tcols[i].sType = null;\n\t\t\t}\n\t\n\t\t\t// Update DataTables special `DT_*` attributes for the row\n\t\t\t_fnRowAttributes( settings, row );\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Build a data source object from an HTML row, reading the contents of the\n\t * cells that are in the row.\n\t *\n\t * @param {object} settings DataTables settings object\n\t * @param {node|object} TR element from which to read data or existing row\n\t *   object from which to re-read the data from the cells\n\t * @param {int} [colIdx] Optional column index\n\t * @param {array|object} [d] Data source object. If `colIdx` is given then this\n\t *   parameter should also be given and will be used to write the data into.\n\t *   Only the column in question will be written\n\t * @returns {object} Object with two parameters: `data` the data read, in\n\t *   document order, and `cells` and array of nodes (they can be useful to the\n\t *   caller, so rather than needing a second traversal to get them, just return\n\t *   them from here).\n\t * @memberof DataTable#oApi\n\t */\n\tfunction _fnGetRowElements( settings, row, colIdx, d )\n\t{\n\t\tvar\n\t\t\ttds = [],\n\t\t\ttd = row.firstChild,\n\t\t\tname, col, o, i=0, contents,\n\t\t\tcolumns = settings.aoColumns,\n\t\t\tobjectRead = settings._rowReadObject;\n\t\n\t\t// Allow the data object to be passed in, or construct\n\t\td = d !== undefined ?\n\t\t\td :\n\t\t\tobjectRead ?\n\t\t\t\t{} :\n\t\t\t\t[];\n\t\n\t\tvar attr = function ( str, td  ) {\n\t\t\tif ( typeof str === 'string' ) {\n\t\t\t\tvar idx = str.indexOf('@');\n\t\n\t\t\t\tif ( idx !== -1 ) {\n\t\t\t\t\tvar attr = str.substring( idx+1 );\n\t\t\t\t\tvar setter = _fnSetObjectDataFn( str );\n\t\t\t\t\tsetter( d, td.getAttribute( attr ) );\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\n\t\t// Read data from a cell and store into the data object\n\t\tvar cellProcess = function ( cell ) {\n\t\t\tif ( colIdx === undefined || colIdx === i ) {\n\t\t\t\tcol = columns[i];\n\t\t\t\tcontents = $.trim(cell.innerHTML);\n\t\n\t\t\t\tif ( col && col._bAttrSrc ) {\n\t\t\t\t\tvar setter = _fnSetObjectDataFn( col.mData._ );\n\t\t\t\t\tsetter( d, contents );\n\t\n\t\t\t\t\tattr( col.mData.sort, cell );\n\t\t\t\t\tattr( col.mData.type, cell );\n\t\t\t\t\tattr( col.mData.filter, cell );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// Depending on the `data` option for the columns the data can\n\t\t\t\t\t// be read to either an object or an array.\n\t\t\t\t\tif ( objectRead ) {\n\t\t\t\t\t\tif ( ! col._setter ) {\n\t\t\t\t\t\t\t// Cache the setter function\n\t\t\t\t\t\t\tcol._setter = _fnSetObjectDataFn( col.mData );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcol._setter( d, contents );\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\td[i] = contents;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\ti++;\n\t\t};\n\t\n\t\tif ( td ) {\n\t\t\t// `tr` element was passed in\n\t\t\twhile ( td ) {\n\t\t\t\tname = td.nodeName.toUpperCase();\n\t\n\t\t\t\tif ( name == \"TD\" || name == \"TH\" ) {\n\t\t\t\t\tcellProcess( td );\n\t\t\t\t\ttds.push( td );\n\t\t\t\t}\n\t\n\t\t\t\ttd = td.nextSibling;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// Existing row object passed in\n\t\t\ttds = row.anCells;\n\t\n\t\t\tfor ( var j=0, jen=tds.length ; j<jen ; j++ ) {\n\t\t\t\tcellProcess( tds[j] );\n\t\t\t}\n\t\t}\n\t\n\t\t// Read the ID from the DOM if present\n\t\tvar rowNode = row.firstChild ? row : row.nTr;\n\t\n\t\tif ( rowNode ) {\n\t\t\tvar id = rowNode.getAttribute( 'id' );\n\t\n\t\t\tif ( id ) {\n\t\t\t\t_fnSetObjectDataFn( settings.rowId )( d, id );\n\t\t\t}\n\t\t}\n\t\n\t\treturn {\n\t\t\tdata: d,\n\t\t\tcells: tds\n\t\t};\n\t}\n\t/**\n\t * Create a new TR element (and it's TD children) for a row\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param {int} iRow Row to consider\n\t *  @param {node} [nTrIn] TR element to add to the table - optional. If not given,\n\t *    DataTables will create a row automatically\n\t *  @param {array} [anTds] Array of TD|TH elements for the row - must be given\n\t *    if nTr is.\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnCreateTr ( oSettings, iRow, nTrIn, anTds )\n\t{\n\t\tvar\n\t\t\trow = oSettings.aoData[iRow],\n\t\t\trowData = row._aData,\n\t\t\tcells = [],\n\t\t\tnTr, nTd, oCol,\n\t\t\ti, iLen;\n\t\n\t\tif ( row.nTr === null )\n\t\t{\n\t\t\tnTr = nTrIn || document.createElement('tr');\n\t\n\t\t\trow.nTr = nTr;\n\t\t\trow.anCells = cells;\n\t\n\t\t\t/* Use a private property on the node to allow reserve mapping from the node\n\t\t\t * to the aoData array for fast look up\n\t\t\t */\n\t\t\tnTr._DT_RowIndex = iRow;\n\t\n\t\t\t/* Special parameters can be given by the data source to be used on the row */\n\t\t\t_fnRowAttributes( oSettings, row );\n\t\n\t\t\t/* Process each column */\n\t\t\tfor ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )\n\t\t\t{\n\t\t\t\toCol = oSettings.aoColumns[i];\n\t\n\t\t\t\tnTd = nTrIn ? anTds[i] : document.createElement( oCol.sCellType );\n\t\t\t\tnTd._DT_CellIndex = {\n\t\t\t\t\trow: iRow,\n\t\t\t\t\tcolumn: i\n\t\t\t\t};\n\t\t\t\t\n\t\t\t\tcells.push( nTd );\n\t\n\t\t\t\t// Need to create the HTML if new, or if a rendering function is defined\n\t\t\t\tif ( (!nTrIn || oCol.mRender || oCol.mData !== i) &&\n\t\t\t\t\t (!$.isPlainObject(oCol.mData) || oCol.mData._ !== i+'.display')\n\t\t\t\t) {\n\t\t\t\t\tnTd.innerHTML = _fnGetCellData( oSettings, iRow, i, 'display' );\n\t\t\t\t}\n\t\n\t\t\t\t/* Add user defined class */\n\t\t\t\tif ( oCol.sClass )\n\t\t\t\t{\n\t\t\t\t\tnTd.className += ' '+oCol.sClass;\n\t\t\t\t}\n\t\n\t\t\t\t// Visibility - add or remove as required\n\t\t\t\tif ( oCol.bVisible && ! nTrIn )\n\t\t\t\t{\n\t\t\t\t\tnTr.appendChild( nTd );\n\t\t\t\t}\n\t\t\t\telse if ( ! oCol.bVisible && nTrIn )\n\t\t\t\t{\n\t\t\t\t\tnTd.parentNode.removeChild( nTd );\n\t\t\t\t}\n\t\n\t\t\t\tif ( oCol.fnCreatedCell )\n\t\t\t\t{\n\t\t\t\t\toCol.fnCreatedCell.call( oSettings.oInstance,\n\t\t\t\t\t\tnTd, _fnGetCellData( oSettings, iRow, i ), rowData, iRow, i\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t_fnCallbackFire( oSettings, 'aoRowCreatedCallback', null, [nTr, rowData, iRow] );\n\t\t}\n\t\n\t\t// Remove once webkit bug 131819 and Chromium bug 365619 have been resolved\n\t\t// and deployed\n\t\trow.nTr.setAttribute( 'role', 'row' );\n\t}\n\t\n\t\n\t/**\n\t * Add attributes to a row based on the special `DT_*` parameters in a data\n\t * source object.\n\t *  @param {object} settings DataTables settings object\n\t *  @param {object} DataTables row object for the row to be modified\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnRowAttributes( settings, row )\n\t{\n\t\tvar tr = row.nTr;\n\t\tvar data = row._aData;\n\t\n\t\tif ( tr ) {\n\t\t\tvar id = settings.rowIdFn( data );\n\t\n\t\t\tif ( id ) {\n\t\t\t\ttr.id = id;\n\t\t\t}\n\t\n\t\t\tif ( data.DT_RowClass ) {\n\t\t\t\t// Remove any classes added by DT_RowClass before\n\t\t\t\tvar a = data.DT_RowClass.split(' ');\n\t\t\t\trow.__rowc = row.__rowc ?\n\t\t\t\t\t_unique( row.__rowc.concat( a ) ) :\n\t\t\t\t\ta;\n\t\n\t\t\t\t$(tr)\n\t\t\t\t\t.removeClass( row.__rowc.join(' ') )\n\t\t\t\t\t.addClass( data.DT_RowClass );\n\t\t\t}\n\t\n\t\t\tif ( data.DT_RowAttr ) {\n\t\t\t\t$(tr).attr( data.DT_RowAttr );\n\t\t\t}\n\t\n\t\t\tif ( data.DT_RowData ) {\n\t\t\t\t$(tr).data( data.DT_RowData );\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Create the HTML header for the table\n\t *  @param {object} oSettings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnBuildHead( oSettings )\n\t{\n\t\tvar i, ien, cell, row, column;\n\t\tvar thead = oSettings.nTHead;\n\t\tvar tfoot = oSettings.nTFoot;\n\t\tvar createHeader = $('th, td', thead).length === 0;\n\t\tvar classes = oSettings.oClasses;\n\t\tvar columns = oSettings.aoColumns;\n\t\n\t\tif ( createHeader ) {\n\t\t\trow = $('<tr/>').appendTo( thead );\n\t\t}\n\t\n\t\tfor ( i=0, ien=columns.length ; i<ien ; i++ ) {\n\t\t\tcolumn = columns[i];\n\t\t\tcell = $( column.nTh ).addClass( column.sClass );\n\t\n\t\t\tif ( createHeader ) {\n\t\t\t\tcell.appendTo( row );\n\t\t\t}\n\t\n\t\t\t// 1.11 move into sorting\n\t\t\tif ( oSettings.oFeatures.bSort ) {\n\t\t\t\tcell.addClass( column.sSortingClass );\n\t\n\t\t\t\tif ( column.bSortable !== false ) {\n\t\t\t\t\tcell\n\t\t\t\t\t\t.attr( 'tabindex', oSettings.iTabIndex )\n\t\t\t\t\t\t.attr( 'aria-controls', oSettings.sTableId );\n\t\n\t\t\t\t\t_fnSortAttachListener( oSettings, column.nTh, i );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tif ( column.sTitle != cell[0].innerHTML ) {\n\t\t\t\tcell.html( column.sTitle );\n\t\t\t}\n\t\n\t\t\t_fnRenderer( oSettings, 'header' )(\n\t\t\t\toSettings, cell, column, classes\n\t\t\t);\n\t\t}\n\t\n\t\tif ( createHeader ) {\n\t\t\t_fnDetectHeader( oSettings.aoHeader, thead );\n\t\t}\n\t\t\n\t\t/* ARIA role for the rows */\n\t \t$(thead).find('>tr').attr('role', 'row');\n\t\n\t\t/* Deal with the footer - add classes if required */\n\t\t$(thead).find('>tr>th, >tr>td').addClass( classes.sHeaderTH );\n\t\t$(tfoot).find('>tr>th, >tr>td').addClass( classes.sFooterTH );\n\t\n\t\t// Cache the footer cells. Note that we only take the cells from the first\n\t\t// row in the footer. If there is more than one row the user wants to\n\t\t// interact with, they need to use the table().foot() method. Note also this\n\t\t// allows cells to be used for multiple columns using colspan\n\t\tif ( tfoot !== null ) {\n\t\t\tvar cells = oSettings.aoFooter[0];\n\t\n\t\t\tfor ( i=0, ien=cells.length ; i<ien ; i++ ) {\n\t\t\t\tcolumn = columns[i];\n\t\t\t\tcolumn.nTf = cells[i].cell;\n\t\n\t\t\t\tif ( column.sClass ) {\n\t\t\t\t\t$(column.nTf).addClass( column.sClass );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Draw the header (or footer) element based on the column visibility states. The\n\t * methodology here is to use the layout array from _fnDetectHeader, modified for\n\t * the instantaneous column visibility, to construct the new layout. The grid is\n\t * traversed over cell at a time in a rows x columns grid fashion, although each\n\t * cell insert can cover multiple elements in the grid - which is tracks using the\n\t * aApplied array. Cell inserts in the grid will only occur where there isn't\n\t * already a cell in that position.\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param array {objects} aoSource Layout array from _fnDetectHeader\n\t *  @param {boolean} [bIncludeHidden=false] If true then include the hidden columns in the calc,\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnDrawHead( oSettings, aoSource, bIncludeHidden )\n\t{\n\t\tvar i, iLen, j, jLen, k, kLen, n, nLocalTr;\n\t\tvar aoLocal = [];\n\t\tvar aApplied = [];\n\t\tvar iColumns = oSettings.aoColumns.length;\n\t\tvar iRowspan, iColspan;\n\t\n\t\tif ( ! aoSource )\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\n\t\tif (  bIncludeHidden === undefined )\n\t\t{\n\t\t\tbIncludeHidden = false;\n\t\t}\n\t\n\t\t/* Make a copy of the master layout array, but without the visible columns in it */\n\t\tfor ( i=0, iLen=aoSource.length ; i<iLen ; i++ )\n\t\t{\n\t\t\taoLocal[i] = aoSource[i].slice();\n\t\t\taoLocal[i].nTr = aoSource[i].nTr;\n\t\n\t\t\t/* Remove any columns which are currently hidden */\n\t\t\tfor ( j=iColumns-1 ; j>=0 ; j-- )\n\t\t\t{\n\t\t\t\tif ( !oSettings.aoColumns[j].bVisible && !bIncludeHidden )\n\t\t\t\t{\n\t\t\t\t\taoLocal[i].splice( j, 1 );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t/* Prep the applied array - it needs an element for each row */\n\t\t\taApplied.push( [] );\n\t\t}\n\t\n\t\tfor ( i=0, iLen=aoLocal.length ; i<iLen ; i++ )\n\t\t{\n\t\t\tnLocalTr = aoLocal[i].nTr;\n\t\n\t\t\t/* All cells are going to be replaced, so empty out the row */\n\t\t\tif ( nLocalTr )\n\t\t\t{\n\t\t\t\twhile( (n = nLocalTr.firstChild) )\n\t\t\t\t{\n\t\t\t\t\tnLocalTr.removeChild( n );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tfor ( j=0, jLen=aoLocal[i].length ; j<jLen ; j++ )\n\t\t\t{\n\t\t\t\tiRowspan = 1;\n\t\t\t\tiColspan = 1;\n\t\n\t\t\t\t/* Check to see if there is already a cell (row/colspan) covering our target\n\t\t\t\t * insert point. If there is, then there is nothing to do.\n\t\t\t\t */\n\t\t\t\tif ( aApplied[i][j] === undefined )\n\t\t\t\t{\n\t\t\t\t\tnLocalTr.appendChild( aoLocal[i][j].cell );\n\t\t\t\t\taApplied[i][j] = 1;\n\t\n\t\t\t\t\t/* Expand the cell to cover as many rows as needed */\n\t\t\t\t\twhile ( aoLocal[i+iRowspan] !== undefined &&\n\t\t\t\t\t        aoLocal[i][j].cell == aoLocal[i+iRowspan][j].cell )\n\t\t\t\t\t{\n\t\t\t\t\t\taApplied[i+iRowspan][j] = 1;\n\t\t\t\t\t\tiRowspan++;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t/* Expand the cell to cover as many columns as needed */\n\t\t\t\t\twhile ( aoLocal[i][j+iColspan] !== undefined &&\n\t\t\t\t\t        aoLocal[i][j].cell == aoLocal[i][j+iColspan].cell )\n\t\t\t\t\t{\n\t\t\t\t\t\t/* Must update the applied array over the rows for the columns */\n\t\t\t\t\t\tfor ( k=0 ; k<iRowspan ; k++ )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\taApplied[i+k][j+iColspan] = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tiColspan++;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t/* Do the actual expansion in the DOM */\n\t\t\t\t\t$(aoLocal[i][j].cell)\n\t\t\t\t\t\t.attr('rowspan', iRowspan)\n\t\t\t\t\t\t.attr('colspan', iColspan);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Insert the required TR nodes into the table for display\n\t *  @param {object} oSettings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnDraw( oSettings )\n\t{\n\t\t/* Provide a pre-callback function which can be used to cancel the draw is false is returned */\n\t\tvar aPreDraw = _fnCallbackFire( oSettings, 'aoPreDrawCallback', 'preDraw', [oSettings] );\n\t\tif ( $.inArray( false, aPreDraw ) !== -1 )\n\t\t{\n\t\t\t_fnProcessingDisplay( oSettings, false );\n\t\t\treturn;\n\t\t}\n\t\n\t\tvar i, iLen, n;\n\t\tvar anRows = [];\n\t\tvar iRowCount = 0;\n\t\tvar asStripeClasses = oSettings.asStripeClasses;\n\t\tvar iStripes = asStripeClasses.length;\n\t\tvar iOpenRows = oSettings.aoOpenRows.length;\n\t\tvar oLang = oSettings.oLanguage;\n\t\tvar iInitDisplayStart = oSettings.iInitDisplayStart;\n\t\tvar bServerSide = _fnDataSource( oSettings ) == 'ssp';\n\t\tvar aiDisplay = oSettings.aiDisplay;\n\t\n\t\toSettings.bDrawing = true;\n\t\n\t\t/* Check and see if we have an initial draw position from state saving */\n\t\tif ( iInitDisplayStart !== undefined && iInitDisplayStart !== -1 )\n\t\t{\n\t\t\toSettings._iDisplayStart = bServerSide ?\n\t\t\t\tiInitDisplayStart :\n\t\t\t\tiInitDisplayStart >= oSettings.fnRecordsDisplay() ?\n\t\t\t\t\t0 :\n\t\t\t\t\tiInitDisplayStart;\n\t\n\t\t\toSettings.iInitDisplayStart = -1;\n\t\t}\n\t\n\t\tvar iDisplayStart = oSettings._iDisplayStart;\n\t\tvar iDisplayEnd = oSettings.fnDisplayEnd();\n\t\n\t\t/* Server-side processing draw intercept */\n\t\tif ( oSettings.bDeferLoading )\n\t\t{\n\t\t\toSettings.bDeferLoading = false;\n\t\t\toSettings.iDraw++;\n\t\t\t_fnProcessingDisplay( oSettings, false );\n\t\t}\n\t\telse if ( !bServerSide )\n\t\t{\n\t\t\toSettings.iDraw++;\n\t\t}\n\t\telse if ( !oSettings.bDestroying && !_fnAjaxUpdate( oSettings ) )\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\n\t\tif ( aiDisplay.length !== 0 )\n\t\t{\n\t\t\tvar iStart = bServerSide ? 0 : iDisplayStart;\n\t\t\tvar iEnd = bServerSide ? oSettings.aoData.length : iDisplayEnd;\n\t\n\t\t\tfor ( var j=iStart ; j<iEnd ; j++ )\n\t\t\t{\n\t\t\t\tvar iDataIndex = aiDisplay[j];\n\t\t\t\tvar aoData = oSettings.aoData[ iDataIndex ];\n\t\t\t\tif ( aoData.nTr === null )\n\t\t\t\t{\n\t\t\t\t\t_fnCreateTr( oSettings, iDataIndex );\n\t\t\t\t}\n\t\n\t\t\t\tvar nRow = aoData.nTr;\n\t\n\t\t\t\t/* Remove the old striping classes and then add the new one */\n\t\t\t\tif ( iStripes !== 0 )\n\t\t\t\t{\n\t\t\t\t\tvar sStripe = asStripeClasses[ iRowCount % iStripes ];\n\t\t\t\t\tif ( aoData._sRowStripe != sStripe )\n\t\t\t\t\t{\n\t\t\t\t\t\t$(nRow).removeClass( aoData._sRowStripe ).addClass( sStripe );\n\t\t\t\t\t\taoData._sRowStripe = sStripe;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Row callback functions - might want to manipulate the row\n\t\t\t\t// iRowCount and j are not currently documented. Are they at all\n\t\t\t\t// useful?\n\t\t\t\t_fnCallbackFire( oSettings, 'aoRowCallback', null,\n\t\t\t\t\t[nRow, aoData._aData, iRowCount, j] );\n\t\n\t\t\t\tanRows.push( nRow );\n\t\t\t\tiRowCount++;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t/* Table is empty - create a row with an empty message in it */\n\t\t\tvar sZero = oLang.sZeroRecords;\n\t\t\tif ( oSettings.iDraw == 1 &&  _fnDataSource( oSettings ) == 'ajax' )\n\t\t\t{\n\t\t\t\tsZero = oLang.sLoadingRecords;\n\t\t\t}\n\t\t\telse if ( oLang.sEmptyTable && oSettings.fnRecordsTotal() === 0 )\n\t\t\t{\n\t\t\t\tsZero = oLang.sEmptyTable;\n\t\t\t}\n\t\n\t\t\tanRows[ 0 ] = $( '<tr/>', { 'class': iStripes ? asStripeClasses[0] : '' } )\n\t\t\t\t.append( $('<td />', {\n\t\t\t\t\t'valign':  'top',\n\t\t\t\t\t'colSpan': _fnVisbleColumns( oSettings ),\n\t\t\t\t\t'class':   oSettings.oClasses.sRowEmpty\n\t\t\t\t} ).html( sZero ) )[0];\n\t\t}\n\t\n\t\t/* Header and footer callbacks */\n\t\t_fnCallbackFire( oSettings, 'aoHeaderCallback', 'header', [ $(oSettings.nTHead).children('tr')[0],\n\t\t\t_fnGetDataMaster( oSettings ), iDisplayStart, iDisplayEnd, aiDisplay ] );\n\t\n\t\t_fnCallbackFire( oSettings, 'aoFooterCallback', 'footer', [ $(oSettings.nTFoot).children('tr')[0],\n\t\t\t_fnGetDataMaster( oSettings ), iDisplayStart, iDisplayEnd, aiDisplay ] );\n\t\n\t\tvar body = $(oSettings.nTBody);\n\t\n\t\tbody.children().detach();\n\t\tbody.append( $(anRows) );\n\t\n\t\t/* Call all required callback functions for the end of a draw */\n\t\t_fnCallbackFire( oSettings, 'aoDrawCallback', 'draw', [oSettings] );\n\t\n\t\t/* Draw is complete, sorting and filtering must be as well */\n\t\toSettings.bSorted = false;\n\t\toSettings.bFiltered = false;\n\t\toSettings.bDrawing = false;\n\t}\n\t\n\t\n\t/**\n\t * Redraw the table - taking account of the various features which are enabled\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param {boolean} [holdPosition] Keep the current paging position. By default\n\t *    the paging is reset to the first page\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnReDraw( settings, holdPosition )\n\t{\n\t\tvar\n\t\t\tfeatures = settings.oFeatures,\n\t\t\tsort     = features.bSort,\n\t\t\tfilter   = features.bFilter;\n\t\n\t\tif ( sort ) {\n\t\t\t_fnSort( settings );\n\t\t}\n\t\n\t\tif ( filter ) {\n\t\t\t_fnFilterComplete( settings, settings.oPreviousSearch );\n\t\t}\n\t\telse {\n\t\t\t// No filtering, so we want to just use the display master\n\t\t\tsettings.aiDisplay = settings.aiDisplayMaster.slice();\n\t\t}\n\t\n\t\tif ( holdPosition !== true ) {\n\t\t\tsettings._iDisplayStart = 0;\n\t\t}\n\t\n\t\t// Let any modules know about the draw hold position state (used by\n\t\t// scrolling internally)\n\t\tsettings._drawHold = holdPosition;\n\t\n\t\t_fnDraw( settings );\n\t\n\t\tsettings._drawHold = false;\n\t}\n\t\n\t\n\t/**\n\t * Add the options to the page HTML for the table\n\t *  @param {object} oSettings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnAddOptionsHtml ( oSettings )\n\t{\n\t\tvar classes = oSettings.oClasses;\n\t\tvar table = $(oSettings.nTable);\n\t\tvar holding = $('<div/>').insertBefore( table ); // Holding element for speed\n\t\tvar features = oSettings.oFeatures;\n\t\n\t\t// All DataTables are wrapped in a div\n\t\tvar insert = $('<div/>', {\n\t\t\tid:      oSettings.sTableId+'_wrapper',\n\t\t\t'class': classes.sWrapper + (oSettings.nTFoot ? '' : ' '+classes.sNoFooter)\n\t\t} );\n\t\n\t\toSettings.nHolding = holding[0];\n\t\toSettings.nTableWrapper = insert[0];\n\t\toSettings.nTableReinsertBefore = oSettings.nTable.nextSibling;\n\t\n\t\t/* Loop over the user set positioning and place the elements as needed */\n\t\tvar aDom = oSettings.sDom.split('');\n\t\tvar featureNode, cOption, nNewNode, cNext, sAttr, j;\n\t\tfor ( var i=0 ; i<aDom.length ; i++ )\n\t\t{\n\t\t\tfeatureNode = null;\n\t\t\tcOption = aDom[i];\n\t\n\t\t\tif ( cOption == '<' )\n\t\t\t{\n\t\t\t\t/* New container div */\n\t\t\t\tnNewNode = $('<div/>')[0];\n\t\n\t\t\t\t/* Check to see if we should append an id and/or a class name to the container */\n\t\t\t\tcNext = aDom[i+1];\n\t\t\t\tif ( cNext == \"'\" || cNext == '\"' )\n\t\t\t\t{\n\t\t\t\t\tsAttr = \"\";\n\t\t\t\t\tj = 2;\n\t\t\t\t\twhile ( aDom[i+j] != cNext )\n\t\t\t\t\t{\n\t\t\t\t\t\tsAttr += aDom[i+j];\n\t\t\t\t\t\tj++;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t/* Replace jQuery UI constants @todo depreciated */\n\t\t\t\t\tif ( sAttr == \"H\" )\n\t\t\t\t\t{\n\t\t\t\t\t\tsAttr = classes.sJUIHeader;\n\t\t\t\t\t}\n\t\t\t\t\telse if ( sAttr == \"F\" )\n\t\t\t\t\t{\n\t\t\t\t\t\tsAttr = classes.sJUIFooter;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t/* The attribute can be in the format of \"#id.class\", \"#id\" or \"class\" This logic\n\t\t\t\t\t * breaks the string into parts and applies them as needed\n\t\t\t\t\t */\n\t\t\t\t\tif ( sAttr.indexOf('.') != -1 )\n\t\t\t\t\t{\n\t\t\t\t\t\tvar aSplit = sAttr.split('.');\n\t\t\t\t\t\tnNewNode.id = aSplit[0].substr(1, aSplit[0].length-1);\n\t\t\t\t\t\tnNewNode.className = aSplit[1];\n\t\t\t\t\t}\n\t\t\t\t\telse if ( sAttr.charAt(0) == \"#\" )\n\t\t\t\t\t{\n\t\t\t\t\t\tnNewNode.id = sAttr.substr(1, sAttr.length-1);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tnNewNode.className = sAttr;\n\t\t\t\t\t}\n\t\n\t\t\t\t\ti += j; /* Move along the position array */\n\t\t\t\t}\n\t\n\t\t\t\tinsert.append( nNewNode );\n\t\t\t\tinsert = $(nNewNode);\n\t\t\t}\n\t\t\telse if ( cOption == '>' )\n\t\t\t{\n\t\t\t\t/* End container div */\n\t\t\t\tinsert = insert.parent();\n\t\t\t}\n\t\t\t// @todo Move options into their own plugins?\n\t\t\telse if ( cOption == 'l' && features.bPaginate && features.bLengthChange )\n\t\t\t{\n\t\t\t\t/* Length */\n\t\t\t\tfeatureNode = _fnFeatureHtmlLength( oSettings );\n\t\t\t}\n\t\t\telse if ( cOption == 'f' && features.bFilter )\n\t\t\t{\n\t\t\t\t/* Filter */\n\t\t\t\tfeatureNode = _fnFeatureHtmlFilter( oSettings );\n\t\t\t}\n\t\t\telse if ( cOption == 'r' && features.bProcessing )\n\t\t\t{\n\t\t\t\t/* pRocessing */\n\t\t\t\tfeatureNode = _fnFeatureHtmlProcessing( oSettings );\n\t\t\t}\n\t\t\telse if ( cOption == 't' )\n\t\t\t{\n\t\t\t\t/* Table */\n\t\t\t\tfeatureNode = _fnFeatureHtmlTable( oSettings );\n\t\t\t}\n\t\t\telse if ( cOption ==  'i' && features.bInfo )\n\t\t\t{\n\t\t\t\t/* Info */\n\t\t\t\tfeatureNode = _fnFeatureHtmlInfo( oSettings );\n\t\t\t}\n\t\t\telse if ( cOption == 'p' && features.bPaginate )\n\t\t\t{\n\t\t\t\t/* Pagination */\n\t\t\t\tfeatureNode = _fnFeatureHtmlPaginate( oSettings );\n\t\t\t}\n\t\t\telse if ( DataTable.ext.feature.length !== 0 )\n\t\t\t{\n\t\t\t\t/* Plug-in features */\n\t\t\t\tvar aoFeatures = DataTable.ext.feature;\n\t\t\t\tfor ( var k=0, kLen=aoFeatures.length ; k<kLen ; k++ )\n\t\t\t\t{\n\t\t\t\t\tif ( cOption == aoFeatures[k].cFeature )\n\t\t\t\t\t{\n\t\t\t\t\t\tfeatureNode = aoFeatures[k].fnInit( oSettings );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t/* Add to the 2D features array */\n\t\t\tif ( featureNode )\n\t\t\t{\n\t\t\t\tvar aanFeatures = oSettings.aanFeatures;\n\t\n\t\t\t\tif ( ! aanFeatures[cOption] )\n\t\t\t\t{\n\t\t\t\t\taanFeatures[cOption] = [];\n\t\t\t\t}\n\t\n\t\t\t\taanFeatures[cOption].push( featureNode );\n\t\t\t\tinsert.append( featureNode );\n\t\t\t}\n\t\t}\n\t\n\t\t/* Built our DOM structure - replace the holding div with what we want */\n\t\tholding.replaceWith( insert );\n\t\toSettings.nHolding = null;\n\t}\n\t\n\t\n\t/**\n\t * Use the DOM source to create up an array of header cells. The idea here is to\n\t * create a layout grid (array) of rows x columns, which contains a reference\n\t * to the cell that that point in the grid (regardless of col/rowspan), such that\n\t * any column / row could be removed and the new grid constructed\n\t *  @param array {object} aLayout Array to store the calculated layout in\n\t *  @param {node} nThead The header/footer element for the table\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnDetectHeader ( aLayout, nThead )\n\t{\n\t\tvar nTrs = $(nThead).children('tr');\n\t\tvar nTr, nCell;\n\t\tvar i, k, l, iLen, jLen, iColShifted, iColumn, iColspan, iRowspan;\n\t\tvar bUnique;\n\t\tvar fnShiftCol = function ( a, i, j ) {\n\t\t\tvar k = a[i];\n\t                while ( k[j] ) {\n\t\t\t\tj++;\n\t\t\t}\n\t\t\treturn j;\n\t\t};\n\t\n\t\taLayout.splice( 0, aLayout.length );\n\t\n\t\t/* We know how many rows there are in the layout - so prep it */\n\t\tfor ( i=0, iLen=nTrs.length ; i<iLen ; i++ )\n\t\t{\n\t\t\taLayout.push( [] );\n\t\t}\n\t\n\t\t/* Calculate a layout array */\n\t\tfor ( i=0, iLen=nTrs.length ; i<iLen ; i++ )\n\t\t{\n\t\t\tnTr = nTrs[i];\n\t\t\tiColumn = 0;\n\t\n\t\t\t/* For every cell in the row... */\n\t\t\tnCell = nTr.firstChild;\n\t\t\twhile ( nCell ) {\n\t\t\t\tif ( nCell.nodeName.toUpperCase() == \"TD\" ||\n\t\t\t\t     nCell.nodeName.toUpperCase() == \"TH\" )\n\t\t\t\t{\n\t\t\t\t\t/* Get the col and rowspan attributes from the DOM and sanitise them */\n\t\t\t\t\tiColspan = nCell.getAttribute('colspan') * 1;\n\t\t\t\t\tiRowspan = nCell.getAttribute('rowspan') * 1;\n\t\t\t\t\tiColspan = (!iColspan || iColspan===0 || iColspan===1) ? 1 : iColspan;\n\t\t\t\t\tiRowspan = (!iRowspan || iRowspan===0 || iRowspan===1) ? 1 : iRowspan;\n\t\n\t\t\t\t\t/* There might be colspan cells already in this row, so shift our target\n\t\t\t\t\t * accordingly\n\t\t\t\t\t */\n\t\t\t\t\tiColShifted = fnShiftCol( aLayout, i, iColumn );\n\t\n\t\t\t\t\t/* Cache calculation for unique columns */\n\t\t\t\t\tbUnique = iColspan === 1 ? true : false;\n\t\n\t\t\t\t\t/* If there is col / rowspan, copy the information into the layout grid */\n\t\t\t\t\tfor ( l=0 ; l<iColspan ; l++ )\n\t\t\t\t\t{\n\t\t\t\t\t\tfor ( k=0 ; k<iRowspan ; k++ )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\taLayout[i+k][iColShifted+l] = {\n\t\t\t\t\t\t\t\t\"cell\": nCell,\n\t\t\t\t\t\t\t\t\"unique\": bUnique\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\taLayout[i+k].nTr = nTr;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tnCell = nCell.nextSibling;\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Get an array of unique th elements, one for each column\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param {node} nHeader automatically detect the layout from this node - optional\n\t *  @param {array} aLayout thead/tfoot layout from _fnDetectHeader - optional\n\t *  @returns array {node} aReturn list of unique th's\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnGetUniqueThs ( oSettings, nHeader, aLayout )\n\t{\n\t\tvar aReturn = [];\n\t\tif ( !aLayout )\n\t\t{\n\t\t\taLayout = oSettings.aoHeader;\n\t\t\tif ( nHeader )\n\t\t\t{\n\t\t\t\taLayout = [];\n\t\t\t\t_fnDetectHeader( aLayout, nHeader );\n\t\t\t}\n\t\t}\n\t\n\t\tfor ( var i=0, iLen=aLayout.length ; i<iLen ; i++ )\n\t\t{\n\t\t\tfor ( var j=0, jLen=aLayout[i].length ; j<jLen ; j++ )\n\t\t\t{\n\t\t\t\tif ( aLayout[i][j].unique &&\n\t\t\t\t\t (!aReturn[j] || !oSettings.bSortCellsTop) )\n\t\t\t\t{\n\t\t\t\t\taReturn[j] = aLayout[i][j].cell;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\treturn aReturn;\n\t}\n\t\n\t/**\n\t * Create an Ajax call based on the table's settings, taking into account that\n\t * parameters can have multiple forms, and backwards compatibility.\n\t *\n\t * @param {object} oSettings dataTables settings object\n\t * @param {array} data Data to send to the server, required by\n\t *     DataTables - may be augmented by developer callbacks\n\t * @param {function} fn Callback function to run when data is obtained\n\t */\n\tfunction _fnBuildAjax( oSettings, data, fn )\n\t{\n\t\t// Compatibility with 1.9-, allow fnServerData and event to manipulate\n\t\t_fnCallbackFire( oSettings, 'aoServerParams', 'serverParams', [data] );\n\t\n\t\t// Convert to object based for 1.10+ if using the old array scheme which can\n\t\t// come from server-side processing or serverParams\n\t\tif ( data && $.isArray(data) ) {\n\t\t\tvar tmp = {};\n\t\t\tvar rbracket = /(.*?)\\[\\]$/;\n\t\n\t\t\t$.each( data, function (key, val) {\n\t\t\t\tvar match = val.name.match(rbracket);\n\t\n\t\t\t\tif ( match ) {\n\t\t\t\t\t// Support for arrays\n\t\t\t\t\tvar name = match[0];\n\t\n\t\t\t\t\tif ( ! tmp[ name ] ) {\n\t\t\t\t\t\ttmp[ name ] = [];\n\t\t\t\t\t}\n\t\t\t\t\ttmp[ name ].push( val.value );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttmp[val.name] = val.value;\n\t\t\t\t}\n\t\t\t} );\n\t\t\tdata = tmp;\n\t\t}\n\t\n\t\tvar ajaxData;\n\t\tvar ajax = oSettings.ajax;\n\t\tvar instance = oSettings.oInstance;\n\t\tvar callback = function ( json ) {\n\t\t\t_fnCallbackFire( oSettings, null, 'xhr', [oSettings, json, oSettings.jqXHR] );\n\t\t\tfn( json );\n\t\t};\n\t\n\t\tif ( $.isPlainObject( ajax ) && ajax.data )\n\t\t{\n\t\t\tajaxData = ajax.data;\n\t\n\t\t\tvar newData = $.isFunction( ajaxData ) ?\n\t\t\t\tajaxData( data, oSettings ) :  // fn can manipulate data or return\n\t\t\t\tajaxData;                      // an object object or array to merge\n\t\n\t\t\t// If the function returned something, use that alone\n\t\t\tdata = $.isFunction( ajaxData ) && newData ?\n\t\t\t\tnewData :\n\t\t\t\t$.extend( true, data, newData );\n\t\n\t\t\t// Remove the data property as we've resolved it already and don't want\n\t\t\t// jQuery to do it again (it is restored at the end of the function)\n\t\t\tdelete ajax.data;\n\t\t}\n\t\n\t\tvar baseAjax = {\n\t\t\t\"data\": data,\n\t\t\t\"success\": function (json) {\n\t\t\t\tvar error = json.error || json.sError;\n\t\t\t\tif ( error ) {\n\t\t\t\t\t_fnLog( oSettings, 0, error );\n\t\t\t\t}\n\t\n\t\t\t\toSettings.json = json;\n\t\t\t\tcallback( json );\n\t\t\t},\n\t\t\t\"dataType\": \"json\",\n\t\t\t\"cache\": false,\n\t\t\t\"type\": oSettings.sServerMethod,\n\t\t\t\"error\": function (xhr, error, thrown) {\n\t\t\t\tvar ret = _fnCallbackFire( oSettings, null, 'xhr', [oSettings, null, oSettings.jqXHR] );\n\t\n\t\t\t\tif ( $.inArray( true, ret ) === -1 ) {\n\t\t\t\t\tif ( error == \"parsererror\" ) {\n\t\t\t\t\t\t_fnLog( oSettings, 0, 'Invalid JSON response', 1 );\n\t\t\t\t\t}\n\t\t\t\t\telse if ( xhr.readyState === 4 ) {\n\t\t\t\t\t\t_fnLog( oSettings, 0, 'Ajax error', 7 );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t_fnProcessingDisplay( oSettings, false );\n\t\t\t}\n\t\t};\n\t\n\t\t// Store the data submitted for the API\n\t\toSettings.oAjaxData = data;\n\t\n\t\t// Allow plug-ins and external processes to modify the data\n\t\t_fnCallbackFire( oSettings, null, 'preXhr', [oSettings, data] );\n\t\n\t\tif ( oSettings.fnServerData )\n\t\t{\n\t\t\t// DataTables 1.9- compatibility\n\t\t\toSettings.fnServerData.call( instance,\n\t\t\t\toSettings.sAjaxSource,\n\t\t\t\t$.map( data, function (val, key) { // Need to convert back to 1.9 trad format\n\t\t\t\t\treturn { name: key, value: val };\n\t\t\t\t} ),\n\t\t\t\tcallback,\n\t\t\t\toSettings\n\t\t\t);\n\t\t}\n\t\telse if ( oSettings.sAjaxSource || typeof ajax === 'string' )\n\t\t{\n\t\t\t// DataTables 1.9- compatibility\n\t\t\toSettings.jqXHR = $.ajax( $.extend( baseAjax, {\n\t\t\t\turl: ajax || oSettings.sAjaxSource\n\t\t\t} ) );\n\t\t}\n\t\telse if ( $.isFunction( ajax ) )\n\t\t{\n\t\t\t// Is a function - let the caller define what needs to be done\n\t\t\toSettings.jqXHR = ajax.call( instance, data, callback, oSettings );\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Object to extend the base settings\n\t\t\toSettings.jqXHR = $.ajax( $.extend( baseAjax, ajax ) );\n\t\n\t\t\t// Restore for next time around\n\t\t\tajax.data = ajaxData;\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Update the table using an Ajax call\n\t *  @param {object} settings dataTables settings object\n\t *  @returns {boolean} Block the table drawing or not\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnAjaxUpdate( settings )\n\t{\n\t\tif ( settings.bAjaxDataGet ) {\n\t\t\tsettings.iDraw++;\n\t\t\t_fnProcessingDisplay( settings, true );\n\t\n\t\t\t_fnBuildAjax(\n\t\t\t\tsettings,\n\t\t\t\t_fnAjaxParameters( settings ),\n\t\t\t\tfunction(json) {\n\t\t\t\t\t_fnAjaxUpdateDraw( settings, json );\n\t\t\t\t}\n\t\t\t);\n\t\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\t\n\t\n\t/**\n\t * Build up the parameters in an object needed for a server-side processing\n\t * request. Note that this is basically done twice, is different ways - a modern\n\t * method which is used by default in DataTables 1.10 which uses objects and\n\t * arrays, or the 1.9- method with is name / value pairs. 1.9 method is used if\n\t * the sAjaxSource option is used in the initialisation, or the legacyAjax\n\t * option is set.\n\t *  @param {object} oSettings dataTables settings object\n\t *  @returns {bool} block the table drawing or not\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnAjaxParameters( settings )\n\t{\n\t\tvar\n\t\t\tcolumns = settings.aoColumns,\n\t\t\tcolumnCount = columns.length,\n\t\t\tfeatures = settings.oFeatures,\n\t\t\tpreSearch = settings.oPreviousSearch,\n\t\t\tpreColSearch = settings.aoPreSearchCols,\n\t\t\ti, data = [], dataProp, column, columnSearch,\n\t\t\tsort = _fnSortFlatten( settings ),\n\t\t\tdisplayStart = settings._iDisplayStart,\n\t\t\tdisplayLength = features.bPaginate !== false ?\n\t\t\t\tsettings._iDisplayLength :\n\t\t\t\t-1;\n\t\n\t\tvar param = function ( name, value ) {\n\t\t\tdata.push( { 'name': name, 'value': value } );\n\t\t};\n\t\n\t\t// DataTables 1.9- compatible method\n\t\tparam( 'sEcho',          settings.iDraw );\n\t\tparam( 'iColumns',       columnCount );\n\t\tparam( 'sColumns',       _pluck( columns, 'sName' ).join(',') );\n\t\tparam( 'iDisplayStart',  displayStart );\n\t\tparam( 'iDisplayLength', displayLength );\n\t\n\t\t// DataTables 1.10+ method\n\t\tvar d = {\n\t\t\tdraw:    settings.iDraw,\n\t\t\tcolumns: [],\n\t\t\torder:   [],\n\t\t\tstart:   displayStart,\n\t\t\tlength:  displayLength,\n\t\t\tsearch:  {\n\t\t\t\tvalue: preSearch.sSearch,\n\t\t\t\tregex: preSearch.bRegex\n\t\t\t}\n\t\t};\n\t\n\t\tfor ( i=0 ; i<columnCount ; i++ ) {\n\t\t\tcolumn = columns[i];\n\t\t\tcolumnSearch = preColSearch[i];\n\t\t\tdataProp = typeof column.mData==\"function\" ? 'function' : column.mData ;\n\t\n\t\t\td.columns.push( {\n\t\t\t\tdata:       dataProp,\n\t\t\t\tname:       column.sName,\n\t\t\t\tsearchable: column.bSearchable,\n\t\t\t\torderable:  column.bSortable,\n\t\t\t\tsearch:     {\n\t\t\t\t\tvalue: columnSearch.sSearch,\n\t\t\t\t\tregex: columnSearch.bRegex\n\t\t\t\t}\n\t\t\t} );\n\t\n\t\t\tparam( \"mDataProp_\"+i, dataProp );\n\t\n\t\t\tif ( features.bFilter ) {\n\t\t\t\tparam( 'sSearch_'+i,     columnSearch.sSearch );\n\t\t\t\tparam( 'bRegex_'+i,      columnSearch.bRegex );\n\t\t\t\tparam( 'bSearchable_'+i, column.bSearchable );\n\t\t\t}\n\t\n\t\t\tif ( features.bSort ) {\n\t\t\t\tparam( 'bSortable_'+i, column.bSortable );\n\t\t\t}\n\t\t}\n\t\n\t\tif ( features.bFilter ) {\n\t\t\tparam( 'sSearch', preSearch.sSearch );\n\t\t\tparam( 'bRegex', preSearch.bRegex );\n\t\t}\n\t\n\t\tif ( features.bSort ) {\n\t\t\t$.each( sort, function ( i, val ) {\n\t\t\t\td.order.push( { column: val.col, dir: val.dir } );\n\t\n\t\t\t\tparam( 'iSortCol_'+i, val.col );\n\t\t\t\tparam( 'sSortDir_'+i, val.dir );\n\t\t\t} );\n\t\n\t\t\tparam( 'iSortingCols', sort.length );\n\t\t}\n\t\n\t\t// If the legacy.ajax parameter is null, then we automatically decide which\n\t\t// form to use, based on sAjaxSource\n\t\tvar legacy = DataTable.ext.legacy.ajax;\n\t\tif ( legacy === null ) {\n\t\t\treturn settings.sAjaxSource ? data : d;\n\t\t}\n\t\n\t\t// Otherwise, if legacy has been specified then we use that to decide on the\n\t\t// form\n\t\treturn legacy ? data : d;\n\t}\n\t\n\t\n\t/**\n\t * Data the data from the server (nuking the old) and redraw the table\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param {object} json json data return from the server.\n\t *  @param {string} json.sEcho Tracking flag for DataTables to match requests\n\t *  @param {int} json.iTotalRecords Number of records in the data set, not accounting for filtering\n\t *  @param {int} json.iTotalDisplayRecords Number of records in the data set, accounting for filtering\n\t *  @param {array} json.aaData The data to display on this page\n\t *  @param {string} [json.sColumns] Column ordering (sName, comma separated)\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnAjaxUpdateDraw ( settings, json )\n\t{\n\t\t// v1.10 uses camelCase variables, while 1.9 uses Hungarian notation.\n\t\t// Support both\n\t\tvar compat = function ( old, modern ) {\n\t\t\treturn json[old] !== undefined ? json[old] : json[modern];\n\t\t};\n\t\n\t\tvar data = _fnAjaxDataSrc( settings, json );\n\t\tvar draw            = compat( 'sEcho',                'draw' );\n\t\tvar recordsTotal    = compat( 'iTotalRecords',        'recordsTotal' );\n\t\tvar recordsFiltered = compat( 'iTotalDisplayRecords', 'recordsFiltered' );\n\t\n\t\tif ( draw ) {\n\t\t\t// Protect against out of sequence returns\n\t\t\tif ( draw*1 < settings.iDraw ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsettings.iDraw = draw * 1;\n\t\t}\n\t\n\t\t_fnClearTable( settings );\n\t\tsettings._iRecordsTotal   = parseInt(recordsTotal, 10);\n\t\tsettings._iRecordsDisplay = parseInt(recordsFiltered, 10);\n\t\n\t\tfor ( var i=0, ien=data.length ; i<ien ; i++ ) {\n\t\t\t_fnAddData( settings, data[i] );\n\t\t}\n\t\tsettings.aiDisplay = settings.aiDisplayMaster.slice();\n\t\n\t\tsettings.bAjaxDataGet = false;\n\t\t_fnDraw( settings );\n\t\n\t\tif ( ! settings._bInitComplete ) {\n\t\t\t_fnInitComplete( settings, json );\n\t\t}\n\t\n\t\tsettings.bAjaxDataGet = true;\n\t\t_fnProcessingDisplay( settings, false );\n\t}\n\t\n\t\n\t/**\n\t * Get the data from the JSON data source to use for drawing a table. Using\n\t * `_fnGetObjectDataFn` allows the data to be sourced from a property of the\n\t * source object, or from a processing function.\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param  {object} json Data source object / array from the server\n\t *  @return {array} Array of data to use\n\t */\n\tfunction _fnAjaxDataSrc ( oSettings, json )\n\t{\n\t\tvar dataSrc = $.isPlainObject( oSettings.ajax ) && oSettings.ajax.dataSrc !== undefined ?\n\t\t\toSettings.ajax.dataSrc :\n\t\t\toSettings.sAjaxDataProp; // Compatibility with 1.9-.\n\t\n\t\t// Compatibility with 1.9-. In order to read from aaData, check if the\n\t\t// default has been changed, if not, check for aaData\n\t\tif ( dataSrc === 'data' ) {\n\t\t\treturn json.aaData || json[dataSrc];\n\t\t}\n\t\n\t\treturn dataSrc !== \"\" ?\n\t\t\t_fnGetObjectDataFn( dataSrc )( json ) :\n\t\t\tjson;\n\t}\n\t\n\t/**\n\t * Generate the node required for filtering text\n\t *  @returns {node} Filter control element\n\t *  @param {object} oSettings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnFeatureHtmlFilter ( settings )\n\t{\n\t\tvar classes = settings.oClasses;\n\t\tvar tableId = settings.sTableId;\n\t\tvar language = settings.oLanguage;\n\t\tvar previousSearch = settings.oPreviousSearch;\n\t\tvar features = settings.aanFeatures;\n\t\tvar input = '<input type=\"search\" class=\"'+classes.sFilterInput+'\"/>';\n\t\n\t\tvar str = language.sSearch;\n\t\tstr = str.match(/_INPUT_/) ?\n\t\t\tstr.replace('_INPUT_', input) :\n\t\t\tstr+input;\n\t\n\t\tvar filter = $('<div/>', {\n\t\t\t\t'id': ! features.f ? tableId+'_filter' : null,\n\t\t\t\t'class': classes.sFilter\n\t\t\t} )\n\t\t\t.append( $('<label/>' ).append( str ) );\n\t\n\t\tvar searchFn = function() {\n\t\t\t/* Update all other filter input elements for the new display */\n\t\t\tvar n = features.f;\n\t\t\tvar val = !this.value ? \"\" : this.value; // mental IE8 fix :-(\n\t\n\t\t\t/* Now do the filter */\n\t\t\tif ( val != previousSearch.sSearch ) {\n\t\t\t\t_fnFilterComplete( settings, {\n\t\t\t\t\t\"sSearch\": val,\n\t\t\t\t\t\"bRegex\": previousSearch.bRegex,\n\t\t\t\t\t\"bSmart\": previousSearch.bSmart ,\n\t\t\t\t\t\"bCaseInsensitive\": previousSearch.bCaseInsensitive\n\t\t\t\t} );\n\t\n\t\t\t\t// Need to redraw, without resorting\n\t\t\t\tsettings._iDisplayStart = 0;\n\t\t\t\t_fnDraw( settings );\n\t\t\t}\n\t\t};\n\t\n\t\tvar searchDelay = settings.searchDelay !== null ?\n\t\t\tsettings.searchDelay :\n\t\t\t_fnDataSource( settings ) === 'ssp' ?\n\t\t\t\t400 :\n\t\t\t\t0;\n\t\n\t\tvar jqFilter = $('input', filter)\n\t\t\t.val( previousSearch.sSearch )\n\t\t\t.attr( 'placeholder', language.sSearchPlaceholder )\n\t\t\t.bind(\n\t\t\t\t'keyup.DT search.DT input.DT paste.DT cut.DT',\n\t\t\t\tsearchDelay ?\n\t\t\t\t\t_fnThrottle( searchFn, searchDelay ) :\n\t\t\t\t\tsearchFn\n\t\t\t)\n\t\t\t.bind( 'keypress.DT', function(e) {\n\t\t\t\t/* Prevent form submission */\n\t\t\t\tif ( e.keyCode == 13 ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.attr('aria-controls', tableId);\n\t\n\t\t// Update the input elements whenever the table is filtered\n\t\t$(settings.nTable).on( 'search.dt.DT', function ( ev, s ) {\n\t\t\tif ( settings === s ) {\n\t\t\t\t// IE9 throws an 'unknown error' if document.activeElement is used\n\t\t\t\t// inside an iframe or frame...\n\t\t\t\ttry {\n\t\t\t\t\tif ( jqFilter[0] !== document.activeElement ) {\n\t\t\t\t\t\tjqFilter.val( previousSearch.sSearch );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch ( e ) {}\n\t\t\t}\n\t\t} );\n\t\n\t\treturn filter[0];\n\t}\n\t\n\t\n\t/**\n\t * Filter the table using both the global filter and column based filtering\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param {object} oSearch search information\n\t *  @param {int} [iForce] force a research of the master array (1) or not (undefined or 0)\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnFilterComplete ( oSettings, oInput, iForce )\n\t{\n\t\tvar oPrevSearch = oSettings.oPreviousSearch;\n\t\tvar aoPrevSearch = oSettings.aoPreSearchCols;\n\t\tvar fnSaveFilter = function ( oFilter ) {\n\t\t\t/* Save the filtering values */\n\t\t\toPrevSearch.sSearch = oFilter.sSearch;\n\t\t\toPrevSearch.bRegex = oFilter.bRegex;\n\t\t\toPrevSearch.bSmart = oFilter.bSmart;\n\t\t\toPrevSearch.bCaseInsensitive = oFilter.bCaseInsensitive;\n\t\t};\n\t\tvar fnRegex = function ( o ) {\n\t\t\t// Backwards compatibility with the bEscapeRegex option\n\t\t\treturn o.bEscapeRegex !== undefined ? !o.bEscapeRegex : o.bRegex;\n\t\t};\n\t\n\t\t// Resolve any column types that are unknown due to addition or invalidation\n\t\t// @todo As per sort - can this be moved into an event handler?\n\t\t_fnColumnTypes( oSettings );\n\t\n\t\t/* In server-side processing all filtering is done by the server, so no point hanging around here */\n\t\tif ( _fnDataSource( oSettings ) != 'ssp' )\n\t\t{\n\t\t\t/* Global filter */\n\t\t\t_fnFilter( oSettings, oInput.sSearch, iForce, fnRegex(oInput), oInput.bSmart, oInput.bCaseInsensitive );\n\t\t\tfnSaveFilter( oInput );\n\t\n\t\t\t/* Now do the individual column filter */\n\t\t\tfor ( var i=0 ; i<aoPrevSearch.length ; i++ )\n\t\t\t{\n\t\t\t\t_fnFilterColumn( oSettings, aoPrevSearch[i].sSearch, i, fnRegex(aoPrevSearch[i]),\n\t\t\t\t\taoPrevSearch[i].bSmart, aoPrevSearch[i].bCaseInsensitive );\n\t\t\t}\n\t\n\t\t\t/* Custom filtering */\n\t\t\t_fnFilterCustom( oSettings );\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfnSaveFilter( oInput );\n\t\t}\n\t\n\t\t/* Tell the draw function we have been filtering */\n\t\toSettings.bFiltered = true;\n\t\t_fnCallbackFire( oSettings, null, 'search', [oSettings] );\n\t}\n\t\n\t\n\t/**\n\t * Apply custom filtering functions\n\t *  @param {object} oSettings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnFilterCustom( settings )\n\t{\n\t\tvar filters = DataTable.ext.search;\n\t\tvar displayRows = settings.aiDisplay;\n\t\tvar row, rowIdx;\n\t\n\t\tfor ( var i=0, ien=filters.length ; i<ien ; i++ ) {\n\t\t\tvar rows = [];\n\t\n\t\t\t// Loop over each row and see if it should be included\n\t\t\tfor ( var j=0, jen=displayRows.length ; j<jen ; j++ ) {\n\t\t\t\trowIdx = displayRows[ j ];\n\t\t\t\trow = settings.aoData[ rowIdx ];\n\t\n\t\t\t\tif ( filters[i]( settings, row._aFilterData, rowIdx, row._aData, j ) ) {\n\t\t\t\t\trows.push( rowIdx );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// So the array reference doesn't break set the results into the\n\t\t\t// existing array\n\t\t\tdisplayRows.length = 0;\n\t\t\t$.merge( displayRows, rows );\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Filter the table on a per-column basis\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param {string} sInput string to filter on\n\t *  @param {int} iColumn column to filter\n\t *  @param {bool} bRegex treat search string as a regular expression or not\n\t *  @param {bool} bSmart use smart filtering or not\n\t *  @param {bool} bCaseInsensitive Do case insenstive matching or not\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnFilterColumn ( settings, searchStr, colIdx, regex, smart, caseInsensitive )\n\t{\n\t\tif ( searchStr === '' ) {\n\t\t\treturn;\n\t\t}\n\t\n\t\tvar data;\n\t\tvar display = settings.aiDisplay;\n\t\tvar rpSearch = _fnFilterCreateSearch( searchStr, regex, smart, caseInsensitive );\n\t\n\t\tfor ( var i=display.length-1 ; i>=0 ; i-- ) {\n\t\t\tdata = settings.aoData[ display[i] ]._aFilterData[ colIdx ];\n\t\n\t\t\tif ( ! rpSearch.test( data ) ) {\n\t\t\t\tdisplay.splice( i, 1 );\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Filter the data table based on user input and draw the table\n\t *  @param {object} settings dataTables settings object\n\t *  @param {string} input string to filter on\n\t *  @param {int} force optional - force a research of the master array (1) or not (undefined or 0)\n\t *  @param {bool} regex treat as a regular expression or not\n\t *  @param {bool} smart perform smart filtering or not\n\t *  @param {bool} caseInsensitive Do case insenstive matching or not\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnFilter( settings, input, force, regex, smart, caseInsensitive )\n\t{\n\t\tvar rpSearch = _fnFilterCreateSearch( input, regex, smart, caseInsensitive );\n\t\tvar prevSearch = settings.oPreviousSearch.sSearch;\n\t\tvar displayMaster = settings.aiDisplayMaster;\n\t\tvar display, invalidated, i;\n\t\n\t\t// Need to take account of custom filtering functions - always filter\n\t\tif ( DataTable.ext.search.length !== 0 ) {\n\t\t\tforce = true;\n\t\t}\n\t\n\t\t// Check if any of the rows were invalidated\n\t\tinvalidated = _fnFilterData( settings );\n\t\n\t\t// If the input is blank - we just want the full data set\n\t\tif ( input.length <= 0 ) {\n\t\t\tsettings.aiDisplay = displayMaster.slice();\n\t\t}\n\t\telse {\n\t\t\t// New search - start from the master array\n\t\t\tif ( invalidated ||\n\t\t\t\t force ||\n\t\t\t\t prevSearch.length > input.length ||\n\t\t\t\t input.indexOf(prevSearch) !== 0 ||\n\t\t\t\t settings.bSorted // On resort, the display master needs to be\n\t\t\t\t                  // re-filtered since indexes will have changed\n\t\t\t) {\n\t\t\t\tsettings.aiDisplay = displayMaster.slice();\n\t\t\t}\n\t\n\t\t\t// Search the display array\n\t\t\tdisplay = settings.aiDisplay;\n\t\n\t\t\tfor ( i=display.length-1 ; i>=0 ; i-- ) {\n\t\t\t\tif ( ! rpSearch.test( settings.aoData[ display[i] ]._sFilterRow ) ) {\n\t\t\t\t\tdisplay.splice( i, 1 );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Build a regular expression object suitable for searching a table\n\t *  @param {string} sSearch string to search for\n\t *  @param {bool} bRegex treat as a regular expression or not\n\t *  @param {bool} bSmart perform smart filtering or not\n\t *  @param {bool} bCaseInsensitive Do case insensitive matching or not\n\t *  @returns {RegExp} constructed object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnFilterCreateSearch( search, regex, smart, caseInsensitive )\n\t{\n\t\tsearch = regex ?\n\t\t\tsearch :\n\t\t\t_fnEscapeRegex( search );\n\t\t\n\t\tif ( smart ) {\n\t\t\t/* For smart filtering we want to allow the search to work regardless of\n\t\t\t * word order. We also want double quoted text to be preserved, so word\n\t\t\t * order is important - a la google. So this is what we want to\n\t\t\t * generate:\n\t\t\t * \n\t\t\t * ^(?=.*?\\bone\\b)(?=.*?\\btwo three\\b)(?=.*?\\bfour\\b).*$\n\t\t\t */\n\t\t\tvar a = $.map( search.match( /\"[^\"]+\"|[^ ]+/g ) || [''], function ( word ) {\n\t\t\t\tif ( word.charAt(0) === '\"' ) {\n\t\t\t\t\tvar m = word.match( /^\"(.*)\"$/ );\n\t\t\t\t\tword = m ? m[1] : word;\n\t\t\t\t}\n\t\n\t\t\t\treturn word.replace('\"', '');\n\t\t\t} );\n\t\n\t\t\tsearch = '^(?=.*?'+a.join( ')(?=.*?' )+').*$';\n\t\t}\n\t\n\t\treturn new RegExp( search, caseInsensitive ? 'i' : '' );\n\t}\n\t\n\t\n\t/**\n\t * Escape a string such that it can be used in a regular expression\n\t *  @param {string} sVal string to escape\n\t *  @returns {string} escaped string\n\t *  @memberof DataTable#oApi\n\t */\n\tvar _fnEscapeRegex = DataTable.util.escapeRegex;\n\t\n\tvar __filter_div = $('<div>')[0];\n\tvar __filter_div_textContent = __filter_div.textContent !== undefined;\n\t\n\t// Update the filtering data for each row if needed (by invalidation or first run)\n\tfunction _fnFilterData ( settings )\n\t{\n\t\tvar columns = settings.aoColumns;\n\t\tvar column;\n\t\tvar i, j, ien, jen, filterData, cellData, row;\n\t\tvar fomatters = DataTable.ext.type.search;\n\t\tvar wasInvalidated = false;\n\t\n\t\tfor ( i=0, ien=settings.aoData.length ; i<ien ; i++ ) {\n\t\t\trow = settings.aoData[i];\n\t\n\t\t\tif ( ! row._aFilterData ) {\n\t\t\t\tfilterData = [];\n\t\n\t\t\t\tfor ( j=0, jen=columns.length ; j<jen ; j++ ) {\n\t\t\t\t\tcolumn = columns[j];\n\t\n\t\t\t\t\tif ( column.bSearchable ) {\n\t\t\t\t\t\tcellData = _fnGetCellData( settings, i, j, 'filter' );\n\t\n\t\t\t\t\t\tif ( fomatters[ column.sType ] ) {\n\t\t\t\t\t\t\tcellData = fomatters[ column.sType ]( cellData );\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t// Search in DataTables 1.10 is string based. In 1.11 this\n\t\t\t\t\t\t// should be altered to also allow strict type checking.\n\t\t\t\t\t\tif ( cellData === null ) {\n\t\t\t\t\t\t\tcellData = '';\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\tif ( typeof cellData !== 'string' && cellData.toString ) {\n\t\t\t\t\t\t\tcellData = cellData.toString();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tcellData = '';\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// If it looks like there is an HTML entity in the string,\n\t\t\t\t\t// attempt to decode it so sorting works as expected. Note that\n\t\t\t\t\t// we could use a single line of jQuery to do this, but the DOM\n\t\t\t\t\t// method used here is much faster http://jsperf.com/html-decode\n\t\t\t\t\tif ( cellData.indexOf && cellData.indexOf('&') !== -1 ) {\n\t\t\t\t\t\t__filter_div.innerHTML = cellData;\n\t\t\t\t\t\tcellData = __filter_div_textContent ?\n\t\t\t\t\t\t\t__filter_div.textContent :\n\t\t\t\t\t\t\t__filter_div.innerText;\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif ( cellData.replace ) {\n\t\t\t\t\t\tcellData = cellData.replace(/[\\r\\n]/g, '');\n\t\t\t\t\t}\n\t\n\t\t\t\t\tfilterData.push( cellData );\n\t\t\t\t}\n\t\n\t\t\t\trow._aFilterData = filterData;\n\t\t\t\trow._sFilterRow = filterData.join('  ');\n\t\t\t\twasInvalidated = true;\n\t\t\t}\n\t\t}\n\t\n\t\treturn wasInvalidated;\n\t}\n\t\n\t\n\t/**\n\t * Convert from the internal Hungarian notation to camelCase for external\n\t * interaction\n\t *  @param {object} obj Object to convert\n\t *  @returns {object} Inverted object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnSearchToCamel ( obj )\n\t{\n\t\treturn {\n\t\t\tsearch:          obj.sSearch,\n\t\t\tsmart:           obj.bSmart,\n\t\t\tregex:           obj.bRegex,\n\t\t\tcaseInsensitive: obj.bCaseInsensitive\n\t\t};\n\t}\n\t\n\t\n\t\n\t/**\n\t * Convert from camelCase notation to the internal Hungarian. We could use the\n\t * Hungarian convert function here, but this is cleaner\n\t *  @param {object} obj Object to convert\n\t *  @returns {object} Inverted object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnSearchToHung ( obj )\n\t{\n\t\treturn {\n\t\t\tsSearch:          obj.search,\n\t\t\tbSmart:           obj.smart,\n\t\t\tbRegex:           obj.regex,\n\t\t\tbCaseInsensitive: obj.caseInsensitive\n\t\t};\n\t}\n\t\n\t/**\n\t * Generate the node required for the info display\n\t *  @param {object} oSettings dataTables settings object\n\t *  @returns {node} Information element\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnFeatureHtmlInfo ( settings )\n\t{\n\t\tvar\n\t\t\ttid = settings.sTableId,\n\t\t\tnodes = settings.aanFeatures.i,\n\t\t\tn = $('<div/>', {\n\t\t\t\t'class': settings.oClasses.sInfo,\n\t\t\t\t'id': ! nodes ? tid+'_info' : null\n\t\t\t} );\n\t\n\t\tif ( ! nodes ) {\n\t\t\t// Update display on each draw\n\t\t\tsettings.aoDrawCallback.push( {\n\t\t\t\t\"fn\": _fnUpdateInfo,\n\t\t\t\t\"sName\": \"information\"\n\t\t\t} );\n\t\n\t\t\tn\n\t\t\t\t.attr( 'role', 'status' )\n\t\t\t\t.attr( 'aria-live', 'polite' );\n\t\n\t\t\t// Table is described by our info div\n\t\t\t$(settings.nTable).attr( 'aria-describedby', tid+'_info' );\n\t\t}\n\t\n\t\treturn n[0];\n\t}\n\t\n\t\n\t/**\n\t * Update the information elements in the display\n\t *  @param {object} settings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnUpdateInfo ( settings )\n\t{\n\t\t/* Show information about the table */\n\t\tvar nodes = settings.aanFeatures.i;\n\t\tif ( nodes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\t\n\t\tvar\n\t\t\tlang  = settings.oLanguage,\n\t\t\tstart = settings._iDisplayStart+1,\n\t\t\tend   = settings.fnDisplayEnd(),\n\t\t\tmax   = settings.fnRecordsTotal(),\n\t\t\ttotal = settings.fnRecordsDisplay(),\n\t\t\tout   = total ?\n\t\t\t\tlang.sInfo :\n\t\t\t\tlang.sInfoEmpty;\n\t\n\t\tif ( total !== max ) {\n\t\t\t/* Record set after filtering */\n\t\t\tout += ' ' + lang.sInfoFiltered;\n\t\t}\n\t\n\t\t// Convert the macros\n\t\tout += lang.sInfoPostFix;\n\t\tout = _fnInfoMacros( settings, out );\n\t\n\t\tvar callback = lang.fnInfoCallback;\n\t\tif ( callback !== null ) {\n\t\t\tout = callback.call( settings.oInstance,\n\t\t\t\tsettings, start, end, max, total, out\n\t\t\t);\n\t\t}\n\t\n\t\t$(nodes).html( out );\n\t}\n\t\n\t\n\tfunction _fnInfoMacros ( settings, str )\n\t{\n\t\t// When infinite scrolling, we are always starting at 1. _iDisplayStart is used only\n\t\t// internally\n\t\tvar\n\t\t\tformatter  = settings.fnFormatNumber,\n\t\t\tstart      = settings._iDisplayStart+1,\n\t\t\tlen        = settings._iDisplayLength,\n\t\t\tvis        = settings.fnRecordsDisplay(),\n\t\t\tall        = len === -1;\n\t\n\t\treturn str.\n\t\t\treplace(/_START_/g, formatter.call( settings, start ) ).\n\t\t\treplace(/_END_/g,   formatter.call( settings, settings.fnDisplayEnd() ) ).\n\t\t\treplace(/_MAX_/g,   formatter.call( settings, settings.fnRecordsTotal() ) ).\n\t\t\treplace(/_TOTAL_/g, formatter.call( settings, vis ) ).\n\t\t\treplace(/_PAGE_/g,  formatter.call( settings, all ? 1 : Math.ceil( start / len ) ) ).\n\t\t\treplace(/_PAGES_/g, formatter.call( settings, all ? 1 : Math.ceil( vis / len ) ) );\n\t}\n\t\n\t\n\t\n\t/**\n\t * Draw the table for the first time, adding all required features\n\t *  @param {object} settings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnInitialise ( settings )\n\t{\n\t\tvar i, iLen, iAjaxStart=settings.iInitDisplayStart;\n\t\tvar columns = settings.aoColumns, column;\n\t\tvar features = settings.oFeatures;\n\t\tvar deferLoading = settings.bDeferLoading; // value modified by the draw\n\t\n\t\t/* Ensure that the table data is fully initialised */\n\t\tif ( ! settings.bInitialised ) {\n\t\t\tsetTimeout( function(){ _fnInitialise( settings ); }, 200 );\n\t\t\treturn;\n\t\t}\n\t\n\t\t/* Show the display HTML options */\n\t\t_fnAddOptionsHtml( settings );\n\t\n\t\t/* Build and draw the header / footer for the table */\n\t\t_fnBuildHead( settings );\n\t\t_fnDrawHead( settings, settings.aoHeader );\n\t\t_fnDrawHead( settings, settings.aoFooter );\n\t\n\t\t/* Okay to show that something is going on now */\n\t\t_fnProcessingDisplay( settings, true );\n\t\n\t\t/* Calculate sizes for columns */\n\t\tif ( features.bAutoWidth ) {\n\t\t\t_fnCalculateColumnWidths( settings );\n\t\t}\n\t\n\t\tfor ( i=0, iLen=columns.length ; i<iLen ; i++ ) {\n\t\t\tcolumn = columns[i];\n\t\n\t\t\tif ( column.sWidth ) {\n\t\t\t\tcolumn.nTh.style.width = _fnStringToCss( column.sWidth );\n\t\t\t}\n\t\t}\n\t\n\t\t_fnCallbackFire( settings, null, 'preInit', [settings] );\n\t\n\t\t// If there is default sorting required - let's do it. The sort function\n\t\t// will do the drawing for us. Otherwise we draw the table regardless of the\n\t\t// Ajax source - this allows the table to look initialised for Ajax sourcing\n\t\t// data (show 'loading' message possibly)\n\t\t_fnReDraw( settings );\n\t\n\t\t// Server-side processing init complete is done by _fnAjaxUpdateDraw\n\t\tvar dataSrc = _fnDataSource( settings );\n\t\tif ( dataSrc != 'ssp' || deferLoading ) {\n\t\t\t// if there is an ajax source load the data\n\t\t\tif ( dataSrc == 'ajax' ) {\n\t\t\t\t_fnBuildAjax( settings, [], function(json) {\n\t\t\t\t\tvar aData = _fnAjaxDataSrc( settings, json );\n\t\n\t\t\t\t\t// Got the data - add it to the table\n\t\t\t\t\tfor ( i=0 ; i<aData.length ; i++ ) {\n\t\t\t\t\t\t_fnAddData( settings, aData[i] );\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Reset the init display for cookie saving. We've already done\n\t\t\t\t\t// a filter, and therefore cleared it before. So we need to make\n\t\t\t\t\t// it appear 'fresh'\n\t\t\t\t\tsettings.iInitDisplayStart = iAjaxStart;\n\t\n\t\t\t\t\t_fnReDraw( settings );\n\t\n\t\t\t\t\t_fnProcessingDisplay( settings, false );\n\t\t\t\t\t_fnInitComplete( settings, json );\n\t\t\t\t}, settings );\n\t\t\t}\n\t\t\telse {\n\t\t\t\t_fnProcessingDisplay( settings, false );\n\t\t\t\t_fnInitComplete( settings );\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Draw the table for the first time, adding all required features\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param {object} [json] JSON from the server that completed the table, if using Ajax source\n\t *    with client-side processing (optional)\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnInitComplete ( settings, json )\n\t{\n\t\tsettings._bInitComplete = true;\n\t\n\t\t// When data was added after the initialisation (data or Ajax) we need to\n\t\t// calculate the column sizing\n\t\tif ( json || settings.oInit.aaData ) {\n\t\t\t_fnAdjustColumnSizing( settings );\n\t\t}\n\t\n\t\t_fnCallbackFire( settings, null, 'plugin-init', [settings, json] );\n\t\t_fnCallbackFire( settings, 'aoInitComplete', 'init', [settings, json] );\n\t}\n\t\n\t\n\tfunction _fnLengthChange ( settings, val )\n\t{\n\t\tvar len = parseInt( val, 10 );\n\t\tsettings._iDisplayLength = len;\n\t\n\t\t_fnLengthOverflow( settings );\n\t\n\t\t// Fire length change event\n\t\t_fnCallbackFire( settings, null, 'length', [settings, len] );\n\t}\n\t\n\t\n\t/**\n\t * Generate the node required for user display length changing\n\t *  @param {object} settings dataTables settings object\n\t *  @returns {node} Display length feature node\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnFeatureHtmlLength ( settings )\n\t{\n\t\tvar\n\t\t\tclasses  = settings.oClasses,\n\t\t\ttableId  = settings.sTableId,\n\t\t\tmenu     = settings.aLengthMenu,\n\t\t\td2       = $.isArray( menu[0] ),\n\t\t\tlengths  = d2 ? menu[0] : menu,\n\t\t\tlanguage = d2 ? menu[1] : menu;\n\t\n\t\tvar select = $('<select/>', {\n\t\t\t'name':          tableId+'_length',\n\t\t\t'aria-controls': tableId,\n\t\t\t'class':         classes.sLengthSelect\n\t\t} );\n\t\n\t\tfor ( var i=0, ien=lengths.length ; i<ien ; i++ ) {\n\t\t\tselect[0][ i ] = new Option( language[i], lengths[i] );\n\t\t}\n\t\n\t\tvar div = $('<div><label/></div>').addClass( classes.sLength );\n\t\tif ( ! settings.aanFeatures.l ) {\n\t\t\tdiv[0].id = tableId+'_length';\n\t\t}\n\t\n\t\tdiv.children().append(\n\t\t\tsettings.oLanguage.sLengthMenu.replace( '_MENU_', select[0].outerHTML )\n\t\t);\n\t\n\t\t// Can't use `select` variable as user might provide their own and the\n\t\t// reference is broken by the use of outerHTML\n\t\t$('select', div)\n\t\t\t.val( settings._iDisplayLength )\n\t\t\t.bind( 'change.DT', function(e) {\n\t\t\t\t_fnLengthChange( settings, $(this).val() );\n\t\t\t\t_fnDraw( settings );\n\t\t\t} );\n\t\n\t\t// Update node value whenever anything changes the table's length\n\t\t$(settings.nTable).bind( 'length.dt.DT', function (e, s, len) {\n\t\t\tif ( settings === s ) {\n\t\t\t\t$('select', div).val( len );\n\t\t\t}\n\t\t} );\n\t\n\t\treturn div[0];\n\t}\n\t\n\t\n\t\n\t/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\t * Note that most of the paging logic is done in\n\t * DataTable.ext.pager\n\t */\n\t\n\t/**\n\t * Generate the node required for default pagination\n\t *  @param {object} oSettings dataTables settings object\n\t *  @returns {node} Pagination feature node\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnFeatureHtmlPaginate ( settings )\n\t{\n\t\tvar\n\t\t\ttype   = settings.sPaginationType,\n\t\t\tplugin = DataTable.ext.pager[ type ],\n\t\t\tmodern = typeof plugin === 'function',\n\t\t\tredraw = function( settings ) {\n\t\t\t\t_fnDraw( settings );\n\t\t\t},\n\t\t\tnode = $('<div/>').addClass( settings.oClasses.sPaging + type )[0],\n\t\t\tfeatures = settings.aanFeatures;\n\t\n\t\tif ( ! modern ) {\n\t\t\tplugin.fnInit( settings, node, redraw );\n\t\t}\n\t\n\t\t/* Add a draw callback for the pagination on first instance, to update the paging display */\n\t\tif ( ! features.p )\n\t\t{\n\t\t\tnode.id = settings.sTableId+'_paginate';\n\t\n\t\t\tsettings.aoDrawCallback.push( {\n\t\t\t\t\"fn\": function( settings ) {\n\t\t\t\t\tif ( modern ) {\n\t\t\t\t\t\tvar\n\t\t\t\t\t\t\tstart      = settings._iDisplayStart,\n\t\t\t\t\t\t\tlen        = settings._iDisplayLength,\n\t\t\t\t\t\t\tvisRecords = settings.fnRecordsDisplay(),\n\t\t\t\t\t\t\tall        = len === -1,\n\t\t\t\t\t\t\tpage = all ? 0 : Math.ceil( start / len ),\n\t\t\t\t\t\t\tpages = all ? 1 : Math.ceil( visRecords / len ),\n\t\t\t\t\t\t\tbuttons = plugin(page, pages),\n\t\t\t\t\t\t\ti, ien;\n\t\n\t\t\t\t\t\tfor ( i=0, ien=features.p.length ; i<ien ; i++ ) {\n\t\t\t\t\t\t\t_fnRenderer( settings, 'pageButton' )(\n\t\t\t\t\t\t\t\tsettings, features.p[i], i, buttons, page, pages\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tplugin.fnUpdate( settings, redraw );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"sName\": \"pagination\"\n\t\t\t} );\n\t\t}\n\t\n\t\treturn node;\n\t}\n\t\n\t\n\t/**\n\t * Alter the display settings to change the page\n\t *  @param {object} settings DataTables settings object\n\t *  @param {string|int} action Paging action to take: \"first\", \"previous\",\n\t *    \"next\" or \"last\" or page number to jump to (integer)\n\t *  @param [bool] redraw Automatically draw the update or not\n\t *  @returns {bool} true page has changed, false - no change\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnPageChange ( settings, action, redraw )\n\t{\n\t\tvar\n\t\t\tstart     = settings._iDisplayStart,\n\t\t\tlen       = settings._iDisplayLength,\n\t\t\trecords   = settings.fnRecordsDisplay();\n\t\n\t\tif ( records === 0 || len === -1 )\n\t\t{\n\t\t\tstart = 0;\n\t\t}\n\t\telse if ( typeof action === \"number\" )\n\t\t{\n\t\t\tstart = action * len;\n\t\n\t\t\tif ( start > records )\n\t\t\t{\n\t\t\t\tstart = 0;\n\t\t\t}\n\t\t}\n\t\telse if ( action == \"first\" )\n\t\t{\n\t\t\tstart = 0;\n\t\t}\n\t\telse if ( action == \"previous\" )\n\t\t{\n\t\t\tstart = len >= 0 ?\n\t\t\t\tstart - len :\n\t\t\t\t0;\n\t\n\t\t\tif ( start < 0 )\n\t\t\t{\n\t\t\t  start = 0;\n\t\t\t}\n\t\t}\n\t\telse if ( action == \"next\" )\n\t\t{\n\t\t\tif ( start + len < records )\n\t\t\t{\n\t\t\t\tstart += len;\n\t\t\t}\n\t\t}\n\t\telse if ( action == \"last\" )\n\t\t{\n\t\t\tstart = Math.floor( (records-1) / len) * len;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t_fnLog( settings, 0, \"Unknown paging action: \"+action, 5 );\n\t\t}\n\t\n\t\tvar changed = settings._iDisplayStart !== start;\n\t\tsettings._iDisplayStart = start;\n\t\n\t\tif ( changed ) {\n\t\t\t_fnCallbackFire( settings, null, 'page', [settings] );\n\t\n\t\t\tif ( redraw ) {\n\t\t\t\t_fnDraw( settings );\n\t\t\t}\n\t\t}\n\t\n\t\treturn changed;\n\t}\n\t\n\t\n\t\n\t/**\n\t * Generate the node required for the processing node\n\t *  @param {object} settings dataTables settings object\n\t *  @returns {node} Processing element\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnFeatureHtmlProcessing ( settings )\n\t{\n\t\treturn $('<div/>', {\n\t\t\t\t'id': ! settings.aanFeatures.r ? settings.sTableId+'_processing' : null,\n\t\t\t\t'class': settings.oClasses.sProcessing\n\t\t\t} )\n\t\t\t.html( settings.oLanguage.sProcessing )\n\t\t\t.insertBefore( settings.nTable )[0];\n\t}\n\t\n\t\n\t/**\n\t * Display or hide the processing indicator\n\t *  @param {object} settings dataTables settings object\n\t *  @param {bool} show Show the processing indicator (true) or not (false)\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnProcessingDisplay ( settings, show )\n\t{\n\t\tif ( settings.oFeatures.bProcessing ) {\n\t\t\t$(settings.aanFeatures.r).css( 'display', show ? 'block' : 'none' );\n\t\t}\n\t\n\t\t_fnCallbackFire( settings, null, 'processing', [settings, show] );\n\t}\n\t\n\t/**\n\t * Add any control elements for the table - specifically scrolling\n\t *  @param {object} settings dataTables settings object\n\t *  @returns {node} Node to add to the DOM\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnFeatureHtmlTable ( settings )\n\t{\n\t\tvar table = $(settings.nTable);\n\t\n\t\t// Add the ARIA grid role to the table\n\t\ttable.attr( 'role', 'grid' );\n\t\n\t\t// Scrolling from here on in\n\t\tvar scroll = settings.oScroll;\n\t\n\t\tif ( scroll.sX === '' && scroll.sY === '' ) {\n\t\t\treturn settings.nTable;\n\t\t}\n\t\n\t\tvar scrollX = scroll.sX;\n\t\tvar scrollY = scroll.sY;\n\t\tvar classes = settings.oClasses;\n\t\tvar caption = table.children('caption');\n\t\tvar captionSide = caption.length ? caption[0]._captionSide : null;\n\t\tvar headerClone = $( table[0].cloneNode(false) );\n\t\tvar footerClone = $( table[0].cloneNode(false) );\n\t\tvar footer = table.children('tfoot');\n\t\tvar _div = '<div/>';\n\t\tvar size = function ( s ) {\n\t\t\treturn !s ? null : _fnStringToCss( s );\n\t\t};\n\t\n\t\tif ( ! footer.length ) {\n\t\t\tfooter = null;\n\t\t}\n\t\n\t\t/*\n\t\t * The HTML structure that we want to generate in this function is:\n\t\t *  div - scroller\n\t\t *    div - scroll head\n\t\t *      div - scroll head inner\n\t\t *        table - scroll head table\n\t\t *          thead - thead\n\t\t *    div - scroll body\n\t\t *      table - table (master table)\n\t\t *        thead - thead clone for sizing\n\t\t *        tbody - tbody\n\t\t *    div - scroll foot\n\t\t *      div - scroll foot inner\n\t\t *        table - scroll foot table\n\t\t *          tfoot - tfoot\n\t\t */\n\t\tvar scroller = $( _div, { 'class': classes.sScrollWrapper } )\n\t\t\t.append(\n\t\t\t\t$(_div, { 'class': classes.sScrollHead } )\n\t\t\t\t\t.css( {\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\tposition: 'relative',\n\t\t\t\t\t\tborder: 0,\n\t\t\t\t\t\twidth: scrollX ? size(scrollX) : '100%'\n\t\t\t\t\t} )\n\t\t\t\t\t.append(\n\t\t\t\t\t\t$(_div, { 'class': classes.sScrollHeadInner } )\n\t\t\t\t\t\t\t.css( {\n\t\t\t\t\t\t\t\t'box-sizing': 'content-box',\n\t\t\t\t\t\t\t\twidth: scroll.sXInner || '100%'\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t.append(\n\t\t\t\t\t\t\t\theaderClone\n\t\t\t\t\t\t\t\t\t.removeAttr('id')\n\t\t\t\t\t\t\t\t\t.css( 'margin-left', 0 )\n\t\t\t\t\t\t\t\t\t.append( captionSide === 'top' ? caption : null )\n\t\t\t\t\t\t\t\t\t.append(\n\t\t\t\t\t\t\t\t\t\ttable.children('thead')\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t)\n\t\t\t.append(\n\t\t\t\t$(_div, { 'class': classes.sScrollBody } )\n\t\t\t\t\t.css( {\n\t\t\t\t\t\tposition: 'relative',\n\t\t\t\t\t\toverflow: 'auto',\n\t\t\t\t\t\twidth: size( scrollX )\n\t\t\t\t\t} )\n\t\t\t\t\t.append( table )\n\t\t\t);\n\t\n\t\tif ( footer ) {\n\t\t\tscroller.append(\n\t\t\t\t$(_div, { 'class': classes.sScrollFoot } )\n\t\t\t\t\t.css( {\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\tborder: 0,\n\t\t\t\t\t\twidth: scrollX ? size(scrollX) : '100%'\n\t\t\t\t\t} )\n\t\t\t\t\t.append(\n\t\t\t\t\t\t$(_div, { 'class': classes.sScrollFootInner } )\n\t\t\t\t\t\t\t.append(\n\t\t\t\t\t\t\t\tfooterClone\n\t\t\t\t\t\t\t\t\t.removeAttr('id')\n\t\t\t\t\t\t\t\t\t.css( 'margin-left', 0 )\n\t\t\t\t\t\t\t\t\t.append( captionSide === 'bottom' ? caption : null )\n\t\t\t\t\t\t\t\t\t.append(\n\t\t\t\t\t\t\t\t\t\ttable.children('tfoot')\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t);\n\t\t}\n\t\n\t\tvar children = scroller.children();\n\t\tvar scrollHead = children[0];\n\t\tvar scrollBody = children[1];\n\t\tvar scrollFoot = footer ? children[2] : null;\n\t\n\t\t// When the body is scrolled, then we also want to scroll the headers\n\t\tif ( scrollX ) {\n\t\t\t$(scrollBody).on( 'scroll.DT', function (e) {\n\t\t\t\tvar scrollLeft = this.scrollLeft;\n\t\n\t\t\t\tscrollHead.scrollLeft = scrollLeft;\n\t\n\t\t\t\tif ( footer ) {\n\t\t\t\t\tscrollFoot.scrollLeft = scrollLeft;\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t\n\t\t$(scrollBody).css(\n\t\t\tscrollY && scroll.bCollapse ? 'max-height' : 'height', \n\t\t\tscrollY\n\t\t);\n\t\n\t\tsettings.nScrollHead = scrollHead;\n\t\tsettings.nScrollBody = scrollBody;\n\t\tsettings.nScrollFoot = scrollFoot;\n\t\n\t\t// On redraw - align columns\n\t\tsettings.aoDrawCallback.push( {\n\t\t\t\"fn\": _fnScrollDraw,\n\t\t\t\"sName\": \"scrolling\"\n\t\t} );\n\t\n\t\treturn scroller[0];\n\t}\n\t\n\t\n\t\n\t/**\n\t * Update the header, footer and body tables for resizing - i.e. column\n\t * alignment.\n\t *\n\t * Welcome to the most horrible function DataTables. The process that this\n\t * function follows is basically:\n\t *   1. Re-create the table inside the scrolling div\n\t *   2. Take live measurements from the DOM\n\t *   3. Apply the measurements to align the columns\n\t *   4. Clean up\n\t *\n\t *  @param {object} settings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnScrollDraw ( settings )\n\t{\n\t\t// Given that this is such a monster function, a lot of variables are use\n\t\t// to try and keep the minimised size as small as possible\n\t\tvar\n\t\t\tscroll         = settings.oScroll,\n\t\t\tscrollX        = scroll.sX,\n\t\t\tscrollXInner   = scroll.sXInner,\n\t\t\tscrollY        = scroll.sY,\n\t\t\tbarWidth       = scroll.iBarWidth,\n\t\t\tdivHeader      = $(settings.nScrollHead),\n\t\t\tdivHeaderStyle = divHeader[0].style,\n\t\t\tdivHeaderInner = divHeader.children('div'),\n\t\t\tdivHeaderInnerStyle = divHeaderInner[0].style,\n\t\t\tdivHeaderTable = divHeaderInner.children('table'),\n\t\t\tdivBodyEl      = settings.nScrollBody,\n\t\t\tdivBody        = $(divBodyEl),\n\t\t\tdivBodyStyle   = divBodyEl.style,\n\t\t\tdivFooter      = $(settings.nScrollFoot),\n\t\t\tdivFooterInner = divFooter.children('div'),\n\t\t\tdivFooterTable = divFooterInner.children('table'),\n\t\t\theader         = $(settings.nTHead),\n\t\t\ttable          = $(settings.nTable),\n\t\t\ttableEl        = table[0],\n\t\t\ttableStyle     = tableEl.style,\n\t\t\tfooter         = settings.nTFoot ? $(settings.nTFoot) : null,\n\t\t\tbrowser        = settings.oBrowser,\n\t\t\tie67           = browser.bScrollOversize,\n\t\t\tdtHeaderCells  = _pluck( settings.aoColumns, 'nTh' ),\n\t\t\theaderTrgEls, footerTrgEls,\n\t\t\theaderSrcEls, footerSrcEls,\n\t\t\theaderCopy, footerCopy,\n\t\t\theaderWidths=[], footerWidths=[],\n\t\t\theaderContent=[], footerContent=[],\n\t\t\tidx, correction, sanityWidth,\n\t\t\tzeroOut = function(nSizer) {\n\t\t\t\tvar style = nSizer.style;\n\t\t\t\tstyle.paddingTop = \"0\";\n\t\t\t\tstyle.paddingBottom = \"0\";\n\t\t\t\tstyle.borderTopWidth = \"0\";\n\t\t\t\tstyle.borderBottomWidth = \"0\";\n\t\t\t\tstyle.height = 0;\n\t\t\t};\n\t\n\t\t// If the scrollbar visibility has changed from the last draw, we need to\n\t\t// adjust the column sizes as the table width will have changed to account\n\t\t// for the scrollbar\n\t\tvar scrollBarVis = divBodyEl.scrollHeight > divBodyEl.clientHeight;\n\t\t\n\t\tif ( settings.scrollBarVis !== scrollBarVis && settings.scrollBarVis !== undefined ) {\n\t\t\tsettings.scrollBarVis = scrollBarVis;\n\t\t\t_fnAdjustColumnSizing( settings );\n\t\t\treturn; // adjust column sizing will call this function again\n\t\t}\n\t\telse {\n\t\t\tsettings.scrollBarVis = scrollBarVis;\n\t\t}\n\t\n\t\t/*\n\t\t * 1. Re-create the table inside the scrolling div\n\t\t */\n\t\n\t\t// Remove the old minimised thead and tfoot elements in the inner table\n\t\ttable.children('thead, tfoot').remove();\n\t\n\t\tif ( footer ) {\n\t\t\tfooterCopy = footer.clone().prependTo( table );\n\t\t\tfooterTrgEls = footer.find('tr'); // the original tfoot is in its own table and must be sized\n\t\t\tfooterSrcEls = footerCopy.find('tr');\n\t\t}\n\t\n\t\t// Clone the current header and footer elements and then place it into the inner table\n\t\theaderCopy = header.clone().prependTo( table );\n\t\theaderTrgEls = header.find('tr'); // original header is in its own table\n\t\theaderSrcEls = headerCopy.find('tr');\n\t\theaderCopy.find('th, td').removeAttr('tabindex');\n\t\n\t\n\t\t/*\n\t\t * 2. Take live measurements from the DOM - do not alter the DOM itself!\n\t\t */\n\t\n\t\t// Remove old sizing and apply the calculated column widths\n\t\t// Get the unique column headers in the newly created (cloned) header. We want to apply the\n\t\t// calculated sizes to this header\n\t\tif ( ! scrollX )\n\t\t{\n\t\t\tdivBodyStyle.width = '100%';\n\t\t\tdivHeader[0].style.width = '100%';\n\t\t}\n\t\n\t\t$.each( _fnGetUniqueThs( settings, headerCopy ), function ( i, el ) {\n\t\t\tidx = _fnVisibleToColumnIndex( settings, i );\n\t\t\tel.style.width = settings.aoColumns[idx].sWidth;\n\t\t} );\n\t\n\t\tif ( footer ) {\n\t\t\t_fnApplyToChildren( function(n) {\n\t\t\t\tn.style.width = \"\";\n\t\t\t}, footerSrcEls );\n\t\t}\n\t\n\t\t// Size the table as a whole\n\t\tsanityWidth = table.outerWidth();\n\t\tif ( scrollX === \"\" ) {\n\t\t\t// No x scrolling\n\t\t\ttableStyle.width = \"100%\";\n\t\n\t\t\t// IE7 will make the width of the table when 100% include the scrollbar\n\t\t\t// - which is shouldn't. When there is a scrollbar we need to take this\n\t\t\t// into account.\n\t\t\tif ( ie67 && (table.find('tbody').height() > divBodyEl.offsetHeight ||\n\t\t\t\tdivBody.css('overflow-y') == \"scroll\")\n\t\t\t) {\n\t\t\t\ttableStyle.width = _fnStringToCss( table.outerWidth() - barWidth);\n\t\t\t}\n\t\n\t\t\t// Recalculate the sanity width\n\t\t\tsanityWidth = table.outerWidth();\n\t\t}\n\t\telse if ( scrollXInner !== \"\" ) {\n\t\t\t// legacy x scroll inner has been given - use it\n\t\t\ttableStyle.width = _fnStringToCss(scrollXInner);\n\t\n\t\t\t// Recalculate the sanity width\n\t\t\tsanityWidth = table.outerWidth();\n\t\t}\n\t\n\t\t// Hidden header should have zero height, so remove padding and borders. Then\n\t\t// set the width based on the real headers\n\t\n\t\t// Apply all styles in one pass\n\t\t_fnApplyToChildren( zeroOut, headerSrcEls );\n\t\n\t\t// Read all widths in next pass\n\t\t_fnApplyToChildren( function(nSizer) {\n\t\t\theaderContent.push( nSizer.innerHTML );\n\t\t\theaderWidths.push( _fnStringToCss( $(nSizer).css('width') ) );\n\t\t}, headerSrcEls );\n\t\n\t\t// Apply all widths in final pass\n\t\t_fnApplyToChildren( function(nToSize, i) {\n\t\t\t// Only apply widths to the DataTables detected header cells - this\n\t\t\t// prevents complex headers from having contradictory sizes applied\n\t\t\tif ( $.inArray( nToSize, dtHeaderCells ) !== -1 ) {\n\t\t\t\tnToSize.style.width = headerWidths[i];\n\t\t\t}\n\t\t}, headerTrgEls );\n\t\n\t\t$(headerSrcEls).height(0);\n\t\n\t\t/* Same again with the footer if we have one */\n\t\tif ( footer )\n\t\t{\n\t\t\t_fnApplyToChildren( zeroOut, footerSrcEls );\n\t\n\t\t\t_fnApplyToChildren( function(nSizer) {\n\t\t\t\tfooterContent.push( nSizer.innerHTML );\n\t\t\t\tfooterWidths.push( _fnStringToCss( $(nSizer).css('width') ) );\n\t\t\t}, footerSrcEls );\n\t\n\t\t\t_fnApplyToChildren( function(nToSize, i) {\n\t\t\t\tnToSize.style.width = footerWidths[i];\n\t\t\t}, footerTrgEls );\n\t\n\t\t\t$(footerSrcEls).height(0);\n\t\t}\n\t\n\t\n\t\t/*\n\t\t * 3. Apply the measurements\n\t\t */\n\t\n\t\t// \"Hide\" the header and footer that we used for the sizing. We need to keep\n\t\t// the content of the cell so that the width applied to the header and body\n\t\t// both match, but we want to hide it completely. We want to also fix their\n\t\t// width to what they currently are\n\t\t_fnApplyToChildren( function(nSizer, i) {\n\t\t\tnSizer.innerHTML = '<div class=\"dataTables_sizing\" style=\"height:0;overflow:hidden;\">'+headerContent[i]+'</div>';\n\t\t\tnSizer.style.width = headerWidths[i];\n\t\t}, headerSrcEls );\n\t\n\t\tif ( footer )\n\t\t{\n\t\t\t_fnApplyToChildren( function(nSizer, i) {\n\t\t\t\tnSizer.innerHTML = '<div class=\"dataTables_sizing\" style=\"height:0;overflow:hidden;\">'+footerContent[i]+'</div>';\n\t\t\t\tnSizer.style.width = footerWidths[i];\n\t\t\t}, footerSrcEls );\n\t\t}\n\t\n\t\t// Sanity check that the table is of a sensible width. If not then we are going to get\n\t\t// misalignment - try to prevent this by not allowing the table to shrink below its min width\n\t\tif ( table.outerWidth() < sanityWidth )\n\t\t{\n\t\t\t// The min width depends upon if we have a vertical scrollbar visible or not */\n\t\t\tcorrection = ((divBodyEl.scrollHeight > divBodyEl.offsetHeight ||\n\t\t\t\tdivBody.css('overflow-y') == \"scroll\")) ?\n\t\t\t\t\tsanityWidth+barWidth :\n\t\t\t\t\tsanityWidth;\n\t\n\t\t\t// IE6/7 are a law unto themselves...\n\t\t\tif ( ie67 && (divBodyEl.scrollHeight >\n\t\t\t\tdivBodyEl.offsetHeight || divBody.css('overflow-y') == \"scroll\")\n\t\t\t) {\n\t\t\t\ttableStyle.width = _fnStringToCss( correction-barWidth );\n\t\t\t}\n\t\n\t\t\t// And give the user a warning that we've stopped the table getting too small\n\t\t\tif ( scrollX === \"\" || scrollXInner !== \"\" ) {\n\t\t\t\t_fnLog( settings, 1, 'Possible column misalignment', 6 );\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcorrection = '100%';\n\t\t}\n\t\n\t\t// Apply to the container elements\n\t\tdivBodyStyle.width = _fnStringToCss( correction );\n\t\tdivHeaderStyle.width = _fnStringToCss( correction );\n\t\n\t\tif ( footer ) {\n\t\t\tsettings.nScrollFoot.style.width = _fnStringToCss( correction );\n\t\t}\n\t\n\t\n\t\t/*\n\t\t * 4. Clean up\n\t\t */\n\t\tif ( ! scrollY ) {\n\t\t\t/* IE7< puts a vertical scrollbar in place (when it shouldn't be) due to subtracting\n\t\t\t * the scrollbar height from the visible display, rather than adding it on. We need to\n\t\t\t * set the height in order to sort this. Don't want to do it in any other browsers.\n\t\t\t */\n\t\t\tif ( ie67 ) {\n\t\t\t\tdivBodyStyle.height = _fnStringToCss( tableEl.offsetHeight+barWidth );\n\t\t\t}\n\t\t}\n\t\n\t\t/* Finally set the width's of the header and footer tables */\n\t\tvar iOuterWidth = table.outerWidth();\n\t\tdivHeaderTable[0].style.width = _fnStringToCss( iOuterWidth );\n\t\tdivHeaderInnerStyle.width = _fnStringToCss( iOuterWidth );\n\t\n\t\t// Figure out if there are scrollbar present - if so then we need a the header and footer to\n\t\t// provide a bit more space to allow \"overflow\" scrolling (i.e. past the scrollbar)\n\t\tvar bScrolling = table.height() > divBodyEl.clientHeight || divBody.css('overflow-y') == \"scroll\";\n\t\tvar padding = 'padding' + (browser.bScrollbarLeft ? 'Left' : 'Right' );\n\t\tdivHeaderInnerStyle[ padding ] = bScrolling ? barWidth+\"px\" : \"0px\";\n\t\n\t\tif ( footer ) {\n\t\t\tdivFooterTable[0].style.width = _fnStringToCss( iOuterWidth );\n\t\t\tdivFooterInner[0].style.width = _fnStringToCss( iOuterWidth );\n\t\t\tdivFooterInner[0].style[padding] = bScrolling ? barWidth+\"px\" : \"0px\";\n\t\t}\n\t\n\t\t// Correct DOM ordering for colgroup - comes before the thead\n\t\ttable.children('colgroup').insertBefore( table.children('thead') );\n\t\n\t\t/* Adjust the position of the header in case we loose the y-scrollbar */\n\t\tdivBody.scroll();\n\t\n\t\t// If sorting or filtering has occurred, jump the scrolling back to the top\n\t\t// only if we aren't holding the position\n\t\tif ( (settings.bSorted || settings.bFiltered) && ! settings._drawHold ) {\n\t\t\tdivBodyEl.scrollTop = 0;\n\t\t}\n\t}\n\t\n\t\n\t\n\t/**\n\t * Apply a given function to the display child nodes of an element array (typically\n\t * TD children of TR rows\n\t *  @param {function} fn Method to apply to the objects\n\t *  @param array {nodes} an1 List of elements to look through for display children\n\t *  @param array {nodes} an2 Another list (identical structure to the first) - optional\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnApplyToChildren( fn, an1, an2 )\n\t{\n\t\tvar index=0, i=0, iLen=an1.length;\n\t\tvar nNode1, nNode2;\n\t\n\t\twhile ( i < iLen ) {\n\t\t\tnNode1 = an1[i].firstChild;\n\t\t\tnNode2 = an2 ? an2[i].firstChild : null;\n\t\n\t\t\twhile ( nNode1 ) {\n\t\t\t\tif ( nNode1.nodeType === 1 ) {\n\t\t\t\t\tif ( an2 ) {\n\t\t\t\t\t\tfn( nNode1, nNode2, index );\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tfn( nNode1, index );\n\t\t\t\t\t}\n\t\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\t\n\t\t\t\tnNode1 = nNode1.nextSibling;\n\t\t\t\tnNode2 = an2 ? nNode2.nextSibling : null;\n\t\t\t}\n\t\n\t\t\ti++;\n\t\t}\n\t}\n\t\n\t\n\t\n\tvar __re_html_remove = /<.*?>/g;\n\t\n\t\n\t/**\n\t * Calculate the width of columns for the table\n\t *  @param {object} oSettings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnCalculateColumnWidths ( oSettings )\n\t{\n\t\tvar\n\t\t\ttable = oSettings.nTable,\n\t\t\tcolumns = oSettings.aoColumns,\n\t\t\tscroll = oSettings.oScroll,\n\t\t\tscrollY = scroll.sY,\n\t\t\tscrollX = scroll.sX,\n\t\t\tscrollXInner = scroll.sXInner,\n\t\t\tcolumnCount = columns.length,\n\t\t\tvisibleColumns = _fnGetColumns( oSettings, 'bVisible' ),\n\t\t\theaderCells = $('th', oSettings.nTHead),\n\t\t\ttableWidthAttr = table.getAttribute('width'), // from DOM element\n\t\t\ttableContainer = table.parentNode,\n\t\t\tuserInputs = false,\n\t\t\ti, column, columnIdx, width, outerWidth,\n\t\t\tbrowser = oSettings.oBrowser,\n\t\t\tie67 = browser.bScrollOversize;\n\t\n\t\tvar styleWidth = table.style.width;\n\t\tif ( styleWidth && styleWidth.indexOf('%') !== -1 ) {\n\t\t\ttableWidthAttr = styleWidth;\n\t\t}\n\t\n\t\t/* Convert any user input sizes into pixel sizes */\n\t\tfor ( i=0 ; i<visibleColumns.length ; i++ ) {\n\t\t\tcolumn = columns[ visibleColumns[i] ];\n\t\n\t\t\tif ( column.sWidth !== null ) {\n\t\t\t\tcolumn.sWidth = _fnConvertToWidth( column.sWidthOrig, tableContainer );\n\t\n\t\t\t\tuserInputs = true;\n\t\t\t}\n\t\t}\n\t\n\t\t/* If the number of columns in the DOM equals the number that we have to\n\t\t * process in DataTables, then we can use the offsets that are created by\n\t\t * the web- browser. No custom sizes can be set in order for this to happen,\n\t\t * nor scrolling used\n\t\t */\n\t\tif ( ie67 || ! userInputs && ! scrollX && ! scrollY &&\n\t\t     columnCount == _fnVisbleColumns( oSettings ) &&\n\t\t     columnCount == headerCells.length\n\t\t) {\n\t\t\tfor ( i=0 ; i<columnCount ; i++ ) {\n\t\t\t\tvar colIdx = _fnVisibleToColumnIndex( oSettings, i );\n\t\n\t\t\t\tif ( colIdx !== null ) {\n\t\t\t\t\tcolumns[ colIdx ].sWidth = _fnStringToCss( headerCells.eq(i).width() );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Otherwise construct a single row, worst case, table with the widest\n\t\t\t// node in the data, assign any user defined widths, then insert it into\n\t\t\t// the DOM and allow the browser to do all the hard work of calculating\n\t\t\t// table widths\n\t\t\tvar tmpTable = $(table).clone() // don't use cloneNode - IE8 will remove events on the main table\n\t\t\t\t.css( 'visibility', 'hidden' )\n\t\t\t\t.removeAttr( 'id' );\n\t\n\t\t\t// Clean up the table body\n\t\t\ttmpTable.find('tbody tr').remove();\n\t\t\tvar tr = $('<tr/>').appendTo( tmpTable.find('tbody') );\n\t\n\t\t\t// Clone the table header and footer - we can't use the header / footer\n\t\t\t// from the cloned table, since if scrolling is active, the table's\n\t\t\t// real header and footer are contained in different table tags\n\t\t\ttmpTable.find('thead, tfoot').remove();\n\t\t\ttmpTable\n\t\t\t\t.append( $(oSettings.nTHead).clone() )\n\t\t\t\t.append( $(oSettings.nTFoot).clone() );\n\t\n\t\t\t// Remove any assigned widths from the footer (from scrolling)\n\t\t\ttmpTable.find('tfoot th, tfoot td').css('width', '');\n\t\n\t\t\t// Apply custom sizing to the cloned header\n\t\t\theaderCells = _fnGetUniqueThs( oSettings, tmpTable.find('thead')[0] );\n\t\n\t\t\tfor ( i=0 ; i<visibleColumns.length ; i++ ) {\n\t\t\t\tcolumn = columns[ visibleColumns[i] ];\n\t\n\t\t\t\theaderCells[i].style.width = column.sWidthOrig !== null && column.sWidthOrig !== '' ?\n\t\t\t\t\t_fnStringToCss( column.sWidthOrig ) :\n\t\t\t\t\t'';\n\t\n\t\t\t\t// For scrollX we need to force the column width otherwise the\n\t\t\t\t// browser will collapse it. If this width is smaller than the\n\t\t\t\t// width the column requires, then it will have no effect\n\t\t\t\tif ( column.sWidthOrig && scrollX ) {\n\t\t\t\t\t$( headerCells[i] ).append( $('<div/>').css( {\n\t\t\t\t\t\twidth: column.sWidthOrig,\n\t\t\t\t\t\tmargin: 0,\n\t\t\t\t\t\tpadding: 0,\n\t\t\t\t\t\tborder: 0,\n\t\t\t\t\t\theight: 1\n\t\t\t\t\t} ) );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Find the widest cell for each column and put it into the table\n\t\t\tif ( oSettings.aoData.length ) {\n\t\t\t\tfor ( i=0 ; i<visibleColumns.length ; i++ ) {\n\t\t\t\t\tcolumnIdx = visibleColumns[i];\n\t\t\t\t\tcolumn = columns[ columnIdx ];\n\t\n\t\t\t\t\t$( _fnGetWidestNode( oSettings, columnIdx ) )\n\t\t\t\t\t\t.clone( false )\n\t\t\t\t\t\t.append( column.sContentPadding )\n\t\t\t\t\t\t.appendTo( tr );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Tidy the temporary table - remove name attributes so there aren't\n\t\t\t// duplicated in the dom (radio elements for example)\n\t\t\t$('[name]', tmpTable).removeAttr('name');\n\t\n\t\t\t// Table has been built, attach to the document so we can work with it.\n\t\t\t// A holding element is used, positioned at the top of the container\n\t\t\t// with minimal height, so it has no effect on if the container scrolls\n\t\t\t// or not. Otherwise it might trigger scrolling when it actually isn't\n\t\t\t// needed\n\t\t\tvar holder = $('<div/>').css( scrollX || scrollY ?\n\t\t\t\t\t{\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\theight: 1,\n\t\t\t\t\t\tright: 0,\n\t\t\t\t\t\toverflow: 'hidden'\n\t\t\t\t\t} :\n\t\t\t\t\t{}\n\t\t\t\t)\n\t\t\t\t.append( tmpTable )\n\t\t\t\t.appendTo( tableContainer );\n\t\n\t\t\t// When scrolling (X or Y) we want to set the width of the table as \n\t\t\t// appropriate. However, when not scrolling leave the table width as it\n\t\t\t// is. This results in slightly different, but I think correct behaviour\n\t\t\tif ( scrollX && scrollXInner ) {\n\t\t\t\ttmpTable.width( scrollXInner );\n\t\t\t}\n\t\t\telse if ( scrollX ) {\n\t\t\t\ttmpTable.css( 'width', 'auto' );\n\t\t\t\ttmpTable.removeAttr('width');\n\t\n\t\t\t\t// If there is no width attribute or style, then allow the table to\n\t\t\t\t// collapse\n\t\t\t\tif ( tmpTable.width() < tableContainer.clientWidth && tableWidthAttr ) {\n\t\t\t\t\ttmpTable.width( tableContainer.clientWidth );\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ( scrollY ) {\n\t\t\t\ttmpTable.width( tableContainer.clientWidth );\n\t\t\t}\n\t\t\telse if ( tableWidthAttr ) {\n\t\t\t\ttmpTable.width( tableWidthAttr );\n\t\t\t}\n\t\n\t\t\t// Get the width of each column in the constructed table - we need to\n\t\t\t// know the inner width (so it can be assigned to the other table's\n\t\t\t// cells) and the outer width so we can calculate the full width of the\n\t\t\t// table. This is safe since DataTables requires a unique cell for each\n\t\t\t// column, but if ever a header can span multiple columns, this will\n\t\t\t// need to be modified.\n\t\t\tvar total = 0;\n\t\t\tfor ( i=0 ; i<visibleColumns.length ; i++ ) {\n\t\t\t\tvar cell = $(headerCells[i]);\n\t\t\t\tvar border = cell.outerWidth() - cell.width();\n\t\n\t\t\t\t// Use getBounding... where possible (not IE8-) because it can give\n\t\t\t\t// sub-pixel accuracy, which we then want to round up!\n\t\t\t\tvar bounding = browser.bBounding ?\n\t\t\t\t\tMath.ceil( headerCells[i].getBoundingClientRect().width ) :\n\t\t\t\t\tcell.outerWidth();\n\t\n\t\t\t\t// Total is tracked to remove any sub-pixel errors as the outerWidth\n\t\t\t\t// of the table might not equal the total given here (IE!).\n\t\t\t\ttotal += bounding;\n\t\n\t\t\t\t// Width for each column to use\n\t\t\t\tcolumns[ visibleColumns[i] ].sWidth = _fnStringToCss( bounding - border );\n\t\t\t}\n\t\n\t\t\ttable.style.width = _fnStringToCss( total );\n\t\n\t\t\t// Finished with the table - ditch it\n\t\t\tholder.remove();\n\t\t}\n\t\n\t\t// If there is a width attr, we want to attach an event listener which\n\t\t// allows the table sizing to automatically adjust when the window is\n\t\t// resized. Use the width attr rather than CSS, since we can't know if the\n\t\t// CSS is a relative value or absolute - DOM read is always px.\n\t\tif ( tableWidthAttr ) {\n\t\t\ttable.style.width = _fnStringToCss( tableWidthAttr );\n\t\t}\n\t\n\t\tif ( (tableWidthAttr || scrollX) && ! oSettings._reszEvt ) {\n\t\t\tvar bindResize = function () {\n\t\t\t\t$(window).bind('resize.DT-'+oSettings.sInstance, _fnThrottle( function () {\n\t\t\t\t\t_fnAdjustColumnSizing( oSettings );\n\t\t\t\t} ) );\n\t\t\t};\n\t\n\t\t\t// IE6/7 will crash if we bind a resize event handler on page load.\n\t\t\t// To be removed in 1.11 which drops IE6/7 support\n\t\t\tif ( ie67 ) {\n\t\t\t\tsetTimeout( bindResize, 1000 );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tbindResize();\n\t\t\t}\n\t\n\t\t\toSettings._reszEvt = true;\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Throttle the calls to a function. Arguments and context are maintained for\n\t * the throttled function\n\t *  @param {function} fn Function to be called\n\t *  @param {int} [freq=200] call frequency in mS\n\t *  @returns {function} wrapped function\n\t *  @memberof DataTable#oApi\n\t */\n\tvar _fnThrottle = DataTable.util.throttle;\n\t\n\t\n\t/**\n\t * Convert a CSS unit width to pixels (e.g. 2em)\n\t *  @param {string} width width to be converted\n\t *  @param {node} parent parent to get the with for (required for relative widths) - optional\n\t *  @returns {int} width in pixels\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnConvertToWidth ( width, parent )\n\t{\n\t\tif ( ! width ) {\n\t\t\treturn 0;\n\t\t}\n\t\n\t\tvar n = $('<div/>')\n\t\t\t.css( 'width', _fnStringToCss( width ) )\n\t\t\t.appendTo( parent || document.body );\n\t\n\t\tvar val = n[0].offsetWidth;\n\t\tn.remove();\n\t\n\t\treturn val;\n\t}\n\t\n\t\n\t/**\n\t * Get the widest node\n\t *  @param {object} settings dataTables settings object\n\t *  @param {int} colIdx column of interest\n\t *  @returns {node} widest table node\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnGetWidestNode( settings, colIdx )\n\t{\n\t\tvar idx = _fnGetMaxLenString( settings, colIdx );\n\t\tif ( idx < 0 ) {\n\t\t\treturn null;\n\t\t}\n\t\n\t\tvar data = settings.aoData[ idx ];\n\t\treturn ! data.nTr ? // Might not have been created when deferred rendering\n\t\t\t$('<td/>').html( _fnGetCellData( settings, idx, colIdx, 'display' ) )[0] :\n\t\t\tdata.anCells[ colIdx ];\n\t}\n\t\n\t\n\t/**\n\t * Get the maximum strlen for each data column\n\t *  @param {object} settings dataTables settings object\n\t *  @param {int} colIdx column of interest\n\t *  @returns {string} max string length for each column\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnGetMaxLenString( settings, colIdx )\n\t{\n\t\tvar s, max=-1, maxIdx = -1;\n\t\n\t\tfor ( var i=0, ien=settings.aoData.length ; i<ien ; i++ ) {\n\t\t\ts = _fnGetCellData( settings, i, colIdx, 'display' )+'';\n\t\t\ts = s.replace( __re_html_remove, '' );\n\t\t\ts = s.replace( /&nbsp;/g, ' ' );\n\t\n\t\t\tif ( s.length > max ) {\n\t\t\t\tmax = s.length;\n\t\t\t\tmaxIdx = i;\n\t\t\t}\n\t\t}\n\t\n\t\treturn maxIdx;\n\t}\n\t\n\t\n\t/**\n\t * Append a CSS unit (only if required) to a string\n\t *  @param {string} value to css-ify\n\t *  @returns {string} value with css unit\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnStringToCss( s )\n\t{\n\t\tif ( s === null ) {\n\t\t\treturn '0px';\n\t\t}\n\t\n\t\tif ( typeof s == 'number' ) {\n\t\t\treturn s < 0 ?\n\t\t\t\t'0px' :\n\t\t\t\ts+'px';\n\t\t}\n\t\n\t\t// Check it has a unit character already\n\t\treturn s.match(/\\d$/) ?\n\t\t\ts+'px' :\n\t\t\ts;\n\t}\n\t\n\t\n\t\n\tfunction _fnSortFlatten ( settings )\n\t{\n\t\tvar\n\t\t\ti, iLen, k, kLen,\n\t\t\taSort = [],\n\t\t\taiOrig = [],\n\t\t\taoColumns = settings.aoColumns,\n\t\t\taDataSort, iCol, sType, srcCol,\n\t\t\tfixed = settings.aaSortingFixed,\n\t\t\tfixedObj = $.isPlainObject( fixed ),\n\t\t\tnestedSort = [],\n\t\t\tadd = function ( a ) {\n\t\t\t\tif ( a.length && ! $.isArray( a[0] ) ) {\n\t\t\t\t\t// 1D array\n\t\t\t\t\tnestedSort.push( a );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// 2D array\n\t\t\t\t\t$.merge( nestedSort, a );\n\t\t\t\t}\n\t\t\t};\n\t\n\t\t// Build the sort array, with pre-fix and post-fix options if they have been\n\t\t// specified\n\t\tif ( $.isArray( fixed ) ) {\n\t\t\tadd( fixed );\n\t\t}\n\t\n\t\tif ( fixedObj && fixed.pre ) {\n\t\t\tadd( fixed.pre );\n\t\t}\n\t\n\t\tadd( settings.aaSorting );\n\t\n\t\tif (fixedObj && fixed.post ) {\n\t\t\tadd( fixed.post );\n\t\t}\n\t\n\t\tfor ( i=0 ; i<nestedSort.length ; i++ )\n\t\t{\n\t\t\tsrcCol = nestedSort[i][0];\n\t\t\taDataSort = aoColumns[ srcCol ].aDataSort;\n\t\n\t\t\tfor ( k=0, kLen=aDataSort.length ; k<kLen ; k++ )\n\t\t\t{\n\t\t\t\tiCol = aDataSort[k];\n\t\t\t\tsType = aoColumns[ iCol ].sType || 'string';\n\t\n\t\t\t\tif ( nestedSort[i]._idx === undefined ) {\n\t\t\t\t\tnestedSort[i]._idx = $.inArray( nestedSort[i][1], aoColumns[iCol].asSorting );\n\t\t\t\t}\n\t\n\t\t\t\taSort.push( {\n\t\t\t\t\tsrc:       srcCol,\n\t\t\t\t\tcol:       iCol,\n\t\t\t\t\tdir:       nestedSort[i][1],\n\t\t\t\t\tindex:     nestedSort[i]._idx,\n\t\t\t\t\ttype:      sType,\n\t\t\t\t\tformatter: DataTable.ext.type.order[ sType+\"-pre\" ]\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t\n\t\treturn aSort;\n\t}\n\t\n\t/**\n\t * Change the order of the table\n\t *  @param {object} oSettings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t *  @todo This really needs split up!\n\t */\n\tfunction _fnSort ( oSettings )\n\t{\n\t\tvar\n\t\t\ti, ien, iLen, j, jLen, k, kLen,\n\t\t\tsDataType, nTh,\n\t\t\taiOrig = [],\n\t\t\toExtSort = DataTable.ext.type.order,\n\t\t\taoData = oSettings.aoData,\n\t\t\taoColumns = oSettings.aoColumns,\n\t\t\taDataSort, data, iCol, sType, oSort,\n\t\t\tformatters = 0,\n\t\t\tsortCol,\n\t\t\tdisplayMaster = oSettings.aiDisplayMaster,\n\t\t\taSort;\n\t\n\t\t// Resolve any column types that are unknown due to addition or invalidation\n\t\t// @todo Can this be moved into a 'data-ready' handler which is called when\n\t\t//   data is going to be used in the table?\n\t\t_fnColumnTypes( oSettings );\n\t\n\t\taSort = _fnSortFlatten( oSettings );\n\t\n\t\tfor ( i=0, ien=aSort.length ; i<ien ; i++ ) {\n\t\t\tsortCol = aSort[i];\n\t\n\t\t\t// Track if we can use the fast sort algorithm\n\t\t\tif ( sortCol.formatter ) {\n\t\t\t\tformatters++;\n\t\t\t}\n\t\n\t\t\t// Load the data needed for the sort, for each cell\n\t\t\t_fnSortData( oSettings, sortCol.col );\n\t\t}\n\t\n\t\t/* No sorting required if server-side or no sorting array */\n\t\tif ( _fnDataSource( oSettings ) != 'ssp' && aSort.length !== 0 )\n\t\t{\n\t\t\t// Create a value - key array of the current row positions such that we can use their\n\t\t\t// current position during the sort, if values match, in order to perform stable sorting\n\t\t\tfor ( i=0, iLen=displayMaster.length ; i<iLen ; i++ ) {\n\t\t\t\taiOrig[ displayMaster[i] ] = i;\n\t\t\t}\n\t\n\t\t\t/* Do the sort - here we want multi-column sorting based on a given data source (column)\n\t\t\t * and sorting function (from oSort) in a certain direction. It's reasonably complex to\n\t\t\t * follow on it's own, but this is what we want (example two column sorting):\n\t\t\t *  fnLocalSorting = function(a,b){\n\t\t\t *    var iTest;\n\t\t\t *    iTest = oSort['string-asc']('data11', 'data12');\n\t\t\t *      if (iTest !== 0)\n\t\t\t *        return iTest;\n\t\t\t *    iTest = oSort['numeric-desc']('data21', 'data22');\n\t\t\t *    if (iTest !== 0)\n\t\t\t *      return iTest;\n\t\t\t *    return oSort['numeric-asc']( aiOrig[a], aiOrig[b] );\n\t\t\t *  }\n\t\t\t * Basically we have a test for each sorting column, if the data in that column is equal,\n\t\t\t * test the next column. If all columns match, then we use a numeric sort on the row\n\t\t\t * positions in the original data array to provide a stable sort.\n\t\t\t *\n\t\t\t * Note - I know it seems excessive to have two sorting methods, but the first is around\n\t\t\t * 15% faster, so the second is only maintained for backwards compatibility with sorting\n\t\t\t * methods which do not have a pre-sort formatting function.\n\t\t\t */\n\t\t\tif ( formatters === aSort.length ) {\n\t\t\t\t// All sort types have formatting functions\n\t\t\t\tdisplayMaster.sort( function ( a, b ) {\n\t\t\t\t\tvar\n\t\t\t\t\t\tx, y, k, test, sort,\n\t\t\t\t\t\tlen=aSort.length,\n\t\t\t\t\t\tdataA = aoData[a]._aSortData,\n\t\t\t\t\t\tdataB = aoData[b]._aSortData;\n\t\n\t\t\t\t\tfor ( k=0 ; k<len ; k++ ) {\n\t\t\t\t\t\tsort = aSort[k];\n\t\n\t\t\t\t\t\tx = dataA[ sort.col ];\n\t\t\t\t\t\ty = dataB[ sort.col ];\n\t\n\t\t\t\t\t\ttest = x<y ? -1 : x>y ? 1 : 0;\n\t\t\t\t\t\tif ( test !== 0 ) {\n\t\t\t\t\t\t\treturn sort.dir === 'asc' ? test : -test;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\tx = aiOrig[a];\n\t\t\t\t\ty = aiOrig[b];\n\t\t\t\t\treturn x<y ? -1 : x>y ? 1 : 0;\n\t\t\t\t} );\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Depreciated - remove in 1.11 (providing a plug-in option)\n\t\t\t\t// Not all sort types have formatting methods, so we have to call their sorting\n\t\t\t\t// methods.\n\t\t\t\tdisplayMaster.sort( function ( a, b ) {\n\t\t\t\t\tvar\n\t\t\t\t\t\tx, y, k, l, test, sort, fn,\n\t\t\t\t\t\tlen=aSort.length,\n\t\t\t\t\t\tdataA = aoData[a]._aSortData,\n\t\t\t\t\t\tdataB = aoData[b]._aSortData;\n\t\n\t\t\t\t\tfor ( k=0 ; k<len ; k++ ) {\n\t\t\t\t\t\tsort = aSort[k];\n\t\n\t\t\t\t\t\tx = dataA[ sort.col ];\n\t\t\t\t\t\ty = dataB[ sort.col ];\n\t\n\t\t\t\t\t\tfn = oExtSort[ sort.type+\"-\"+sort.dir ] || oExtSort[ \"string-\"+sort.dir ];\n\t\t\t\t\t\ttest = fn( x, y );\n\t\t\t\t\t\tif ( test !== 0 ) {\n\t\t\t\t\t\t\treturn test;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\tx = aiOrig[a];\n\t\t\t\t\ty = aiOrig[b];\n\t\t\t\t\treturn x<y ? -1 : x>y ? 1 : 0;\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t\n\t\t/* Tell the draw function that we have sorted the data */\n\t\toSettings.bSorted = true;\n\t}\n\t\n\t\n\tfunction _fnSortAria ( settings )\n\t{\n\t\tvar label;\n\t\tvar nextSort;\n\t\tvar columns = settings.aoColumns;\n\t\tvar aSort = _fnSortFlatten( settings );\n\t\tvar oAria = settings.oLanguage.oAria;\n\t\n\t\t// ARIA attributes - need to loop all columns, to update all (removing old\n\t\t// attributes as needed)\n\t\tfor ( var i=0, iLen=columns.length ; i<iLen ; i++ )\n\t\t{\n\t\t\tvar col = columns[i];\n\t\t\tvar asSorting = col.asSorting;\n\t\t\tvar sTitle = col.sTitle.replace( /<.*?>/g, \"\" );\n\t\t\tvar th = col.nTh;\n\t\n\t\t\t// IE7 is throwing an error when setting these properties with jQuery's\n\t\t\t// attr() and removeAttr() methods...\n\t\t\tth.removeAttribute('aria-sort');\n\t\n\t\t\t/* In ARIA only the first sorting column can be marked as sorting - no multi-sort option */\n\t\t\tif ( col.bSortable ) {\n\t\t\t\tif ( aSort.length > 0 && aSort[0].col == i ) {\n\t\t\t\t\tth.setAttribute('aria-sort', aSort[0].dir==\"asc\" ? \"ascending\" : \"descending\" );\n\t\t\t\t\tnextSort = asSorting[ aSort[0].index+1 ] || asSorting[0];\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tnextSort = asSorting[0];\n\t\t\t\t}\n\t\n\t\t\t\tlabel = sTitle + ( nextSort === \"asc\" ?\n\t\t\t\t\toAria.sSortAscending :\n\t\t\t\t\toAria.sSortDescending\n\t\t\t\t);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlabel = sTitle;\n\t\t\t}\n\t\n\t\t\tth.setAttribute('aria-label', label);\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Function to run on user sort request\n\t *  @param {object} settings dataTables settings object\n\t *  @param {node} attachTo node to attach the handler to\n\t *  @param {int} colIdx column sorting index\n\t *  @param {boolean} [append=false] Append the requested sort to the existing\n\t *    sort if true (i.e. multi-column sort)\n\t *  @param {function} [callback] callback function\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnSortListener ( settings, colIdx, append, callback )\n\t{\n\t\tvar col = settings.aoColumns[ colIdx ];\n\t\tvar sorting = settings.aaSorting;\n\t\tvar asSorting = col.asSorting;\n\t\tvar nextSortIdx;\n\t\tvar next = function ( a, overflow ) {\n\t\t\tvar idx = a._idx;\n\t\t\tif ( idx === undefined ) {\n\t\t\t\tidx = $.inArray( a[1], asSorting );\n\t\t\t}\n\t\n\t\t\treturn idx+1 < asSorting.length ?\n\t\t\t\tidx+1 :\n\t\t\t\toverflow ?\n\t\t\t\t\tnull :\n\t\t\t\t\t0;\n\t\t};\n\t\n\t\t// Convert to 2D array if needed\n\t\tif ( typeof sorting[0] === 'number' ) {\n\t\t\tsorting = settings.aaSorting = [ sorting ];\n\t\t}\n\t\n\t\t// If appending the sort then we are multi-column sorting\n\t\tif ( append && settings.oFeatures.bSortMulti ) {\n\t\t\t// Are we already doing some kind of sort on this column?\n\t\t\tvar sortIdx = $.inArray( colIdx, _pluck(sorting, '0') );\n\t\n\t\t\tif ( sortIdx !== -1 ) {\n\t\t\t\t// Yes, modify the sort\n\t\t\t\tnextSortIdx = next( sorting[sortIdx], true );\n\t\n\t\t\t\tif ( nextSortIdx === null && sorting.length === 1 ) {\n\t\t\t\t\tnextSortIdx = 0; // can't remove sorting completely\n\t\t\t\t}\n\t\n\t\t\t\tif ( nextSortIdx === null ) {\n\t\t\t\t\tsorting.splice( sortIdx, 1 );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tsorting[sortIdx][1] = asSorting[ nextSortIdx ];\n\t\t\t\t\tsorting[sortIdx]._idx = nextSortIdx;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// No sort on this column yet\n\t\t\t\tsorting.push( [ colIdx, asSorting[0], 0 ] );\n\t\t\t\tsorting[sorting.length-1]._idx = 0;\n\t\t\t}\n\t\t}\n\t\telse if ( sorting.length && sorting[0][0] == colIdx ) {\n\t\t\t// Single column - already sorting on this column, modify the sort\n\t\t\tnextSortIdx = next( sorting[0] );\n\t\n\t\t\tsorting.length = 1;\n\t\t\tsorting[0][1] = asSorting[ nextSortIdx ];\n\t\t\tsorting[0]._idx = nextSortIdx;\n\t\t}\n\t\telse {\n\t\t\t// Single column - sort only on this column\n\t\t\tsorting.length = 0;\n\t\t\tsorting.push( [ colIdx, asSorting[0] ] );\n\t\t\tsorting[0]._idx = 0;\n\t\t}\n\t\n\t\t// Run the sort by calling a full redraw\n\t\t_fnReDraw( settings );\n\t\n\t\t// callback used for async user interaction\n\t\tif ( typeof callback == 'function' ) {\n\t\t\tcallback( settings );\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Attach a sort handler (click) to a node\n\t *  @param {object} settings dataTables settings object\n\t *  @param {node} attachTo node to attach the handler to\n\t *  @param {int} colIdx column sorting index\n\t *  @param {function} [callback] callback function\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnSortAttachListener ( settings, attachTo, colIdx, callback )\n\t{\n\t\tvar col = settings.aoColumns[ colIdx ];\n\t\n\t\t_fnBindAction( attachTo, {}, function (e) {\n\t\t\t/* If the column is not sortable - don't to anything */\n\t\t\tif ( col.bSortable === false ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// If processing is enabled use a timeout to allow the processing\n\t\t\t// display to be shown - otherwise to it synchronously\n\t\t\tif ( settings.oFeatures.bProcessing ) {\n\t\t\t\t_fnProcessingDisplay( settings, true );\n\t\n\t\t\t\tsetTimeout( function() {\n\t\t\t\t\t_fnSortListener( settings, colIdx, e.shiftKey, callback );\n\t\n\t\t\t\t\t// In server-side processing, the draw callback will remove the\n\t\t\t\t\t// processing display\n\t\t\t\t\tif ( _fnDataSource( settings ) !== 'ssp' ) {\n\t\t\t\t\t\t_fnProcessingDisplay( settings, false );\n\t\t\t\t\t}\n\t\t\t\t}, 0 );\n\t\t\t}\n\t\t\telse {\n\t\t\t\t_fnSortListener( settings, colIdx, e.shiftKey, callback );\n\t\t\t}\n\t\t} );\n\t}\n\t\n\t\n\t/**\n\t * Set the sorting classes on table's body, Note: it is safe to call this function\n\t * when bSort and bSortClasses are false\n\t *  @param {object} oSettings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnSortingClasses( settings )\n\t{\n\t\tvar oldSort = settings.aLastSort;\n\t\tvar sortClass = settings.oClasses.sSortColumn;\n\t\tvar sort = _fnSortFlatten( settings );\n\t\tvar features = settings.oFeatures;\n\t\tvar i, ien, colIdx;\n\t\n\t\tif ( features.bSort && features.bSortClasses ) {\n\t\t\t// Remove old sorting classes\n\t\t\tfor ( i=0, ien=oldSort.length ; i<ien ; i++ ) {\n\t\t\t\tcolIdx = oldSort[i].src;\n\t\n\t\t\t\t// Remove column sorting\n\t\t\t\t$( _pluck( settings.aoData, 'anCells', colIdx ) )\n\t\t\t\t\t.removeClass( sortClass + (i<2 ? i+1 : 3) );\n\t\t\t}\n\t\n\t\t\t// Add new column sorting\n\t\t\tfor ( i=0, ien=sort.length ; i<ien ; i++ ) {\n\t\t\t\tcolIdx = sort[i].src;\n\t\n\t\t\t\t$( _pluck( settings.aoData, 'anCells', colIdx ) )\n\t\t\t\t\t.addClass( sortClass + (i<2 ? i+1 : 3) );\n\t\t\t}\n\t\t}\n\t\n\t\tsettings.aLastSort = sort;\n\t}\n\t\n\t\n\t// Get the data to sort a column, be it from cache, fresh (populating the\n\t// cache), or from a sort formatter\n\tfunction _fnSortData( settings, idx )\n\t{\n\t\t// Custom sorting function - provided by the sort data type\n\t\tvar column = settings.aoColumns[ idx ];\n\t\tvar customSort = DataTable.ext.order[ column.sSortDataType ];\n\t\tvar customData;\n\t\n\t\tif ( customSort ) {\n\t\t\tcustomData = customSort.call( settings.oInstance, settings, idx,\n\t\t\t\t_fnColumnIndexToVisible( settings, idx )\n\t\t\t);\n\t\t}\n\t\n\t\t// Use / populate cache\n\t\tvar row, cellData;\n\t\tvar formatter = DataTable.ext.type.order[ column.sType+\"-pre\" ];\n\t\n\t\tfor ( var i=0, ien=settings.aoData.length ; i<ien ; i++ ) {\n\t\t\trow = settings.aoData[i];\n\t\n\t\t\tif ( ! row._aSortData ) {\n\t\t\t\trow._aSortData = [];\n\t\t\t}\n\t\n\t\t\tif ( ! row._aSortData[idx] || customSort ) {\n\t\t\t\tcellData = customSort ?\n\t\t\t\t\tcustomData[i] : // If there was a custom sort function, use data from there\n\t\t\t\t\t_fnGetCellData( settings, i, idx, 'sort' );\n\t\n\t\t\t\trow._aSortData[ idx ] = formatter ?\n\t\t\t\t\tformatter( cellData ) :\n\t\t\t\t\tcellData;\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\t\n\t/**\n\t * Save the state of a table\n\t *  @param {object} oSettings dataTables settings object\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnSaveState ( settings )\n\t{\n\t\tif ( !settings.oFeatures.bStateSave || settings.bDestroying )\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\n\t\t/* Store the interesting variables */\n\t\tvar state = {\n\t\t\ttime:    +new Date(),\n\t\t\tstart:   settings._iDisplayStart,\n\t\t\tlength:  settings._iDisplayLength,\n\t\t\torder:   $.extend( true, [], settings.aaSorting ),\n\t\t\tsearch:  _fnSearchToCamel( settings.oPreviousSearch ),\n\t\t\tcolumns: $.map( settings.aoColumns, function ( col, i ) {\n\t\t\t\treturn {\n\t\t\t\t\tvisible: col.bVisible,\n\t\t\t\t\tsearch: _fnSearchToCamel( settings.aoPreSearchCols[i] )\n\t\t\t\t};\n\t\t\t} )\n\t\t};\n\t\n\t\t_fnCallbackFire( settings, \"aoStateSaveParams\", 'stateSaveParams', [settings, state] );\n\t\n\t\tsettings.oSavedState = state;\n\t\tsettings.fnStateSaveCallback.call( settings.oInstance, settings, state );\n\t}\n\t\n\t\n\t/**\n\t * Attempt to load a saved table state\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param {object} oInit DataTables init object so we can override settings\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnLoadState ( settings, oInit )\n\t{\n\t\tvar i, ien;\n\t\tvar columns = settings.aoColumns;\n\t\n\t\tif ( ! settings.oFeatures.bStateSave ) {\n\t\t\treturn;\n\t\t}\n\t\n\t\tvar state = settings.fnStateLoadCallback.call( settings.oInstance, settings );\n\t\tif ( ! state || ! state.time ) {\n\t\t\treturn;\n\t\t}\n\t\n\t\t/* Allow custom and plug-in manipulation functions to alter the saved data set and\n\t\t * cancelling of loading by returning false\n\t\t */\n\t\tvar abStateLoad = _fnCallbackFire( settings, 'aoStateLoadParams', 'stateLoadParams', [settings, state] );\n\t\tif ( $.inArray( false, abStateLoad ) !== -1 ) {\n\t\t\treturn;\n\t\t}\n\t\n\t\t/* Reject old data */\n\t\tvar duration = settings.iStateDuration;\n\t\tif ( duration > 0 && state.time < +new Date() - (duration*1000) ) {\n\t\t\treturn;\n\t\t}\n\t\n\t\t// Number of columns have changed - all bets are off, no restore of settings\n\t\tif ( columns.length !== state.columns.length ) {\n\t\t\treturn;\n\t\t}\n\t\n\t\t// Store the saved state so it might be accessed at any time\n\t\tsettings.oLoadedState = $.extend( true, {}, state );\n\t\n\t\t// Restore key features - todo - for 1.11 this needs to be done by\n\t\t// subscribed events\n\t\tif ( state.start !== undefined ) {\n\t\t\tsettings._iDisplayStart    = state.start;\n\t\t\tsettings.iInitDisplayStart = state.start;\n\t\t}\n\t\tif ( state.length !== undefined ) {\n\t\t\tsettings._iDisplayLength   = state.length;\n\t\t}\n\t\n\t\t// Order\n\t\tif ( state.order !== undefined ) {\n\t\t\tsettings.aaSorting = [];\n\t\t\t$.each( state.order, function ( i, col ) {\n\t\t\t\tsettings.aaSorting.push( col[0] >= columns.length ?\n\t\t\t\t\t[ 0, col[1] ] :\n\t\t\t\t\tcol\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\t\n\t\t// Search\n\t\tif ( state.search !== undefined ) {\n\t\t\t$.extend( settings.oPreviousSearch, _fnSearchToHung( state.search ) );\n\t\t}\n\t\n\t\t// Columns\n\t\tfor ( i=0, ien=state.columns.length ; i<ien ; i++ ) {\n\t\t\tvar col = state.columns[i];\n\t\n\t\t\t// Visibility\n\t\t\tif ( col.visible !== undefined ) {\n\t\t\t\tcolumns[i].bVisible = col.visible;\n\t\t\t}\n\t\n\t\t\t// Search\n\t\t\tif ( col.search !== undefined ) {\n\t\t\t\t$.extend( settings.aoPreSearchCols[i], _fnSearchToHung( col.search ) );\n\t\t\t}\n\t\t}\n\t\n\t\t_fnCallbackFire( settings, 'aoStateLoaded', 'stateLoaded', [settings, state] );\n\t}\n\t\n\t\n\t/**\n\t * Return the settings object for a particular table\n\t *  @param {node} table table we are using as a dataTable\n\t *  @returns {object} Settings object - or null if not found\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnSettingsFromNode ( table )\n\t{\n\t\tvar settings = DataTable.settings;\n\t\tvar idx = $.inArray( table, _pluck( settings, 'nTable' ) );\n\t\n\t\treturn idx !== -1 ?\n\t\t\tsettings[ idx ] :\n\t\t\tnull;\n\t}\n\t\n\t\n\t/**\n\t * Log an error message\n\t *  @param {object} settings dataTables settings object\n\t *  @param {int} level log error messages, or display them to the user\n\t *  @param {string} msg error message\n\t *  @param {int} tn Technical note id to get more information about the error.\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnLog( settings, level, msg, tn )\n\t{\n\t\tmsg = 'DataTables warning: '+\n\t\t\t(settings ? 'table id='+settings.sTableId+' - ' : '')+msg;\n\t\n\t\tif ( tn ) {\n\t\t\tmsg += '. For more information about this error, please see '+\n\t\t\t'http://datatables.net/tn/'+tn;\n\t\t}\n\t\n\t\tif ( ! level  ) {\n\t\t\t// Backwards compatibility pre 1.10\n\t\t\tvar ext = DataTable.ext;\n\t\t\tvar type = ext.sErrMode || ext.errMode;\n\t\n\t\t\tif ( settings ) {\n\t\t\t\t_fnCallbackFire( settings, null, 'error', [ settings, tn, msg ] );\n\t\t\t}\n\t\n\t\t\tif ( type == 'alert' ) {\n\t\t\t\talert( msg );\n\t\t\t}\n\t\t\telse if ( type == 'throw' ) {\n\t\t\t\tthrow new Error(msg);\n\t\t\t}\n\t\t\telse if ( typeof type == 'function' ) {\n\t\t\t\ttype( settings, tn, msg );\n\t\t\t}\n\t\t}\n\t\telse if ( window.console && console.log ) {\n\t\t\tconsole.log( msg );\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * See if a property is defined on one object, if so assign it to the other object\n\t *  @param {object} ret target object\n\t *  @param {object} src source object\n\t *  @param {string} name property\n\t *  @param {string} [mappedName] name to map too - optional, name used if not given\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnMap( ret, src, name, mappedName )\n\t{\n\t\tif ( $.isArray( name ) ) {\n\t\t\t$.each( name, function (i, val) {\n\t\t\t\tif ( $.isArray( val ) ) {\n\t\t\t\t\t_fnMap( ret, src, val[0], val[1] );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t_fnMap( ret, src, val );\n\t\t\t\t}\n\t\t\t} );\n\t\n\t\t\treturn;\n\t\t}\n\t\n\t\tif ( mappedName === undefined ) {\n\t\t\tmappedName = name;\n\t\t}\n\t\n\t\tif ( src[name] !== undefined ) {\n\t\t\tret[mappedName] = src[name];\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Extend objects - very similar to jQuery.extend, but deep copy objects, and\n\t * shallow copy arrays. The reason we need to do this, is that we don't want to\n\t * deep copy array init values (such as aaSorting) since the dev wouldn't be\n\t * able to override them, but we do want to deep copy arrays.\n\t *  @param {object} out Object to extend\n\t *  @param {object} extender Object from which the properties will be applied to\n\t *      out\n\t *  @param {boolean} breakRefs If true, then arrays will be sliced to take an\n\t *      independent copy with the exception of the `data` or `aaData` parameters\n\t *      if they are present. This is so you can pass in a collection to\n\t *      DataTables and have that used as your data source without breaking the\n\t *      references\n\t *  @returns {object} out Reference, just for convenience - out === the return.\n\t *  @memberof DataTable#oApi\n\t *  @todo This doesn't take account of arrays inside the deep copied objects.\n\t */\n\tfunction _fnExtend( out, extender, breakRefs )\n\t{\n\t\tvar val;\n\t\n\t\tfor ( var prop in extender ) {\n\t\t\tif ( extender.hasOwnProperty(prop) ) {\n\t\t\t\tval = extender[prop];\n\t\n\t\t\t\tif ( $.isPlainObject( val ) ) {\n\t\t\t\t\tif ( ! $.isPlainObject( out[prop] ) ) {\n\t\t\t\t\t\tout[prop] = {};\n\t\t\t\t\t}\n\t\t\t\t\t$.extend( true, out[prop], val );\n\t\t\t\t}\n\t\t\t\telse if ( breakRefs && prop !== 'data' && prop !== 'aaData' && $.isArray(val) ) {\n\t\t\t\t\tout[prop] = val.slice();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tout[prop] = val;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\treturn out;\n\t}\n\t\n\t\n\t/**\n\t * Bind an event handers to allow a click or return key to activate the callback.\n\t * This is good for accessibility since a return on the keyboard will have the\n\t * same effect as a click, if the element has focus.\n\t *  @param {element} n Element to bind the action to\n\t *  @param {object} oData Data object to pass to the triggered function\n\t *  @param {function} fn Callback function for when the event is triggered\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnBindAction( n, oData, fn )\n\t{\n\t\t$(n)\n\t\t\t.bind( 'click.DT', oData, function (e) {\n\t\t\t\t\tn.blur(); // Remove focus outline for mouse users\n\t\t\t\t\tfn(e);\n\t\t\t\t} )\n\t\t\t.bind( 'keypress.DT', oData, function (e){\n\t\t\t\t\tif ( e.which === 13 ) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tfn(e);\n\t\t\t\t\t}\n\t\t\t\t} )\n\t\t\t.bind( 'selectstart.DT', function () {\n\t\t\t\t\t/* Take the brutal approach to cancelling text selection */\n\t\t\t\t\treturn false;\n\t\t\t\t} );\n\t}\n\t\n\t\n\t/**\n\t * Register a callback function. Easily allows a callback function to be added to\n\t * an array store of callback functions that can then all be called together.\n\t *  @param {object} oSettings dataTables settings object\n\t *  @param {string} sStore Name of the array storage for the callbacks in oSettings\n\t *  @param {function} fn Function to be called back\n\t *  @param {string} sName Identifying name for the callback (i.e. a label)\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnCallbackReg( oSettings, sStore, fn, sName )\n\t{\n\t\tif ( fn )\n\t\t{\n\t\t\toSettings[sStore].push( {\n\t\t\t\t\"fn\": fn,\n\t\t\t\t\"sName\": sName\n\t\t\t} );\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t * Fire callback functions and trigger events. Note that the loop over the\n\t * callback array store is done backwards! Further note that you do not want to\n\t * fire off triggers in time sensitive applications (for example cell creation)\n\t * as its slow.\n\t *  @param {object} settings dataTables settings object\n\t *  @param {string} callbackArr Name of the array storage for the callbacks in\n\t *      oSettings\n\t *  @param {string} eventName Name of the jQuery custom event to trigger. If\n\t *      null no trigger is fired\n\t *  @param {array} args Array of arguments to pass to the callback function /\n\t *      trigger\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnCallbackFire( settings, callbackArr, eventName, args )\n\t{\n\t\tvar ret = [];\n\t\n\t\tif ( callbackArr ) {\n\t\t\tret = $.map( settings[callbackArr].slice().reverse(), function (val, i) {\n\t\t\t\treturn val.fn.apply( settings.oInstance, args );\n\t\t\t} );\n\t\t}\n\t\n\t\tif ( eventName !== null ) {\n\t\t\tvar e = $.Event( eventName+'.dt' );\n\t\n\t\t\t$(settings.nTable).trigger( e, args );\n\t\n\t\t\tret.push( e.result );\n\t\t}\n\t\n\t\treturn ret;\n\t}\n\t\n\t\n\tfunction _fnLengthOverflow ( settings )\n\t{\n\t\tvar\n\t\t\tstart = settings._iDisplayStart,\n\t\t\tend = settings.fnDisplayEnd(),\n\t\t\tlen = settings._iDisplayLength;\n\t\n\t\t/* If we have space to show extra rows (backing up from the end point - then do so */\n\t\tif ( start >= end )\n\t\t{\n\t\t\tstart = end - len;\n\t\t}\n\t\n\t\t// Keep the start record on the current page\n\t\tstart -= (start % len);\n\t\n\t\tif ( len === -1 || start < 0 )\n\t\t{\n\t\t\tstart = 0;\n\t\t}\n\t\n\t\tsettings._iDisplayStart = start;\n\t}\n\t\n\t\n\tfunction _fnRenderer( settings, type )\n\t{\n\t\tvar renderer = settings.renderer;\n\t\tvar host = DataTable.ext.renderer[type];\n\t\n\t\tif ( $.isPlainObject( renderer ) && renderer[type] ) {\n\t\t\t// Specific renderer for this type. If available use it, otherwise use\n\t\t\t// the default.\n\t\t\treturn host[renderer[type]] || host._;\n\t\t}\n\t\telse if ( typeof renderer === 'string' ) {\n\t\t\t// Common renderer - if there is one available for this type use it,\n\t\t\t// otherwise use the default\n\t\t\treturn host[renderer] || host._;\n\t\t}\n\t\n\t\t// Use the default\n\t\treturn host._;\n\t}\n\t\n\t\n\t/**\n\t * Detect the data source being used for the table. Used to simplify the code\n\t * a little (ajax) and to make it compress a little smaller.\n\t *\n\t *  @param {object} settings dataTables settings object\n\t *  @returns {string} Data source\n\t *  @memberof DataTable#oApi\n\t */\n\tfunction _fnDataSource ( settings )\n\t{\n\t\tif ( settings.oFeatures.bServerSide ) {\n\t\t\treturn 'ssp';\n\t\t}\n\t\telse if ( settings.ajax || settings.sAjaxSource ) {\n\t\t\treturn 'ajax';\n\t\t}\n\t\treturn 'dom';\n\t}\n\t\n\n\t\n\t\n\t/**\n\t * Computed structure of the DataTables API, defined by the options passed to\n\t * `DataTable.Api.register()` when building the API.\n\t *\n\t * The structure is built in order to speed creation and extension of the Api\n\t * objects since the extensions are effectively pre-parsed.\n\t *\n\t * The array is an array of objects with the following structure, where this\n\t * base array represents the Api prototype base:\n\t *\n\t *     [\n\t *       {\n\t *         name:      'data'                -- string   - Property name\n\t *         val:       function () {},       -- function - Api method (or undefined if just an object\n\t *         methodExt: [ ... ],              -- array    - Array of Api object definitions to extend the method result\n\t *         propExt:   [ ... ]               -- array    - Array of Api object definitions to extend the property\n\t *       },\n\t *       {\n\t *         name:     'row'\n\t *         val:       {},\n\t *         methodExt: [ ... ],\n\t *         propExt:   [\n\t *           {\n\t *             name:      'data'\n\t *             val:       function () {},\n\t *             methodExt: [ ... ],\n\t *             propExt:   [ ... ]\n\t *           },\n\t *           ...\n\t *         ]\n\t *       }\n\t *     ]\n\t *\n\t * @type {Array}\n\t * @ignore\n\t */\n\tvar __apiStruct = [];\n\t\n\t\n\t/**\n\t * `Array.prototype` reference.\n\t *\n\t * @type object\n\t * @ignore\n\t */\n\tvar __arrayProto = Array.prototype;\n\t\n\t\n\t/**\n\t * Abstraction for `context` parameter of the `Api` constructor to allow it to\n\t * take several different forms for ease of use.\n\t *\n\t * Each of the input parameter types will be converted to a DataTables settings\n\t * object where possible.\n\t *\n\t * @param  {string|node|jQuery|object} mixed DataTable identifier. Can be one\n\t *   of:\n\t *\n\t *   * `string` - jQuery selector. Any DataTables' matching the given selector\n\t *     with be found and used.\n\t *   * `node` - `TABLE` node which has already been formed into a DataTable.\n\t *   * `jQuery` - A jQuery object of `TABLE` nodes.\n\t *   * `object` - DataTables settings object\n\t *   * `DataTables.Api` - API instance\n\t * @return {array|null} Matching DataTables settings objects. `null` or\n\t *   `undefined` is returned if no matching DataTable is found.\n\t * @ignore\n\t */\n\tvar _toSettings = function ( mixed )\n\t{\n\t\tvar idx, jq;\n\t\tvar settings = DataTable.settings;\n\t\tvar tables = $.map( settings, function (el, i) {\n\t\t\treturn el.nTable;\n\t\t} );\n\t\n\t\tif ( ! mixed ) {\n\t\t\treturn [];\n\t\t}\n\t\telse if ( mixed.nTable && mixed.oApi ) {\n\t\t\t// DataTables settings object\n\t\t\treturn [ mixed ];\n\t\t}\n\t\telse if ( mixed.nodeName && mixed.nodeName.toLowerCase() === 'table' ) {\n\t\t\t// Table node\n\t\t\tidx = $.inArray( mixed, tables );\n\t\t\treturn idx !== -1 ? [ settings[idx] ] : null;\n\t\t}\n\t\telse if ( mixed && typeof mixed.settings === 'function' ) {\n\t\t\treturn mixed.settings().toArray();\n\t\t}\n\t\telse if ( typeof mixed === 'string' ) {\n\t\t\t// jQuery selector\n\t\t\tjq = $(mixed);\n\t\t}\n\t\telse if ( mixed instanceof $ ) {\n\t\t\t// jQuery object (also DataTables instance)\n\t\t\tjq = mixed;\n\t\t}\n\t\n\t\tif ( jq ) {\n\t\t\treturn jq.map( function(i) {\n\t\t\t\tidx = $.inArray( this, tables );\n\t\t\t\treturn idx !== -1 ? settings[idx] : null;\n\t\t\t} ).toArray();\n\t\t}\n\t};\n\t\n\t\n\t/**\n\t * DataTables API class - used to control and interface with  one or more\n\t * DataTables enhanced tables.\n\t *\n\t * The API class is heavily based on jQuery, presenting a chainable interface\n\t * that you can use to interact with tables. Each instance of the API class has\n\t * a \"context\" - i.e. the tables that it will operate on. This could be a single\n\t * table, all tables on a page or a sub-set thereof.\n\t *\n\t * Additionally the API is designed to allow you to easily work with the data in\n\t * the tables, retrieving and manipulating it as required. This is done by\n\t * presenting the API class as an array like interface. The contents of the\n\t * array depend upon the actions requested by each method (for example\n\t * `rows().nodes()` will return an array of nodes, while `rows().data()` will\n\t * return an array of objects or arrays depending upon your table's\n\t * configuration). The API object has a number of array like methods (`push`,\n\t * `pop`, `reverse` etc) as well as additional helper methods (`each`, `pluck`,\n\t * `unique` etc) to assist your working with the data held in a table.\n\t *\n\t * Most methods (those which return an Api instance) are chainable, which means\n\t * the return from a method call also has all of the methods available that the\n\t * top level object had. For example, these two calls are equivalent:\n\t *\n\t *     // Not chained\n\t *     api.row.add( {...} );\n\t *     api.draw();\n\t *\n\t *     // Chained\n\t *     api.row.add( {...} ).draw();\n\t *\n\t * @class DataTable.Api\n\t * @param {array|object|string|jQuery} context DataTable identifier. This is\n\t *   used to define which DataTables enhanced tables this API will operate on.\n\t *   Can be one of:\n\t *\n\t *   * `string` - jQuery selector. Any DataTables' matching the given selector\n\t *     with be found and used.\n\t *   * `node` - `TABLE` node which has already been formed into a DataTable.\n\t *   * `jQuery` - A jQuery object of `TABLE` nodes.\n\t *   * `object` - DataTables settings object\n\t * @param {array} [data] Data to initialise the Api instance with.\n\t *\n\t * @example\n\t *   // Direct initialisation during DataTables construction\n\t *   var api = $('#example').DataTable();\n\t *\n\t * @example\n\t *   // Initialisation using a DataTables jQuery object\n\t *   var api = $('#example').dataTable().api();\n\t *\n\t * @example\n\t *   // Initialisation as a constructor\n\t *   var api = new $.fn.DataTable.Api( 'table.dataTable' );\n\t */\n\t_Api = function ( context, data )\n\t{\n\t\tif ( ! (this instanceof _Api) ) {\n\t\t\treturn new _Api( context, data );\n\t\t}\n\t\n\t\tvar settings = [];\n\t\tvar ctxSettings = function ( o ) {\n\t\t\tvar a = _toSettings( o );\n\t\t\tif ( a ) {\n\t\t\t\tsettings = settings.concat( a );\n\t\t\t}\n\t\t};\n\t\n\t\tif ( $.isArray( context ) ) {\n\t\t\tfor ( var i=0, ien=context.length ; i<ien ; i++ ) {\n\t\t\t\tctxSettings( context[i] );\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tctxSettings( context );\n\t\t}\n\t\n\t\t// Remove duplicates\n\t\tthis.context = _unique( settings );\n\t\n\t\t// Initial data\n\t\tif ( data ) {\n\t\t\t$.merge( this, data );\n\t\t}\n\t\n\t\t// selector\n\t\tthis.selector = {\n\t\t\trows: null,\n\t\t\tcols: null,\n\t\t\topts: null\n\t\t};\n\t\n\t\t_Api.extend( this, this, __apiStruct );\n\t};\n\t\n\tDataTable.Api = _Api;\n\t\n\t// Don't destroy the existing prototype, just extend it. Required for jQuery 2's\n\t// isPlainObject.\n\t$.extend( _Api.prototype, {\n\t\tany: function ()\n\t\t{\n\t\t\treturn this.count() !== 0;\n\t\t},\n\t\n\t\n\t\tconcat:  __arrayProto.concat,\n\t\n\t\n\t\tcontext: [], // array of table settings objects\n\t\n\t\n\t\tcount: function ()\n\t\t{\n\t\t\treturn this.flatten().length;\n\t\t},\n\t\n\t\n\t\teach: function ( fn )\n\t\t{\n\t\t\tfor ( var i=0, ien=this.length ; i<ien; i++ ) {\n\t\t\t\tfn.call( this, this[i], i, this );\n\t\t\t}\n\t\n\t\t\treturn this;\n\t\t},\n\t\n\t\n\t\teq: function ( idx )\n\t\t{\n\t\t\tvar ctx = this.context;\n\t\n\t\t\treturn ctx.length > idx ?\n\t\t\t\tnew _Api( ctx[idx], this[idx] ) :\n\t\t\t\tnull;\n\t\t},\n\t\n\t\n\t\tfilter: function ( fn )\n\t\t{\n\t\t\tvar a = [];\n\t\n\t\t\tif ( __arrayProto.filter ) {\n\t\t\t\ta = __arrayProto.filter.call( this, fn, this );\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Compatibility for browsers without EMCA-252-5 (JS 1.6)\n\t\t\t\tfor ( var i=0, ien=this.length ; i<ien ; i++ ) {\n\t\t\t\t\tif ( fn.call( this, this[i], i, this ) ) {\n\t\t\t\t\t\ta.push( this[i] );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn new _Api( this.context, a );\n\t\t},\n\t\n\t\n\t\tflatten: function ()\n\t\t{\n\t\t\tvar a = [];\n\t\t\treturn new _Api( this.context, a.concat.apply( a, this.toArray() ) );\n\t\t},\n\t\n\t\n\t\tjoin:    __arrayProto.join,\n\t\n\t\n\t\tindexOf: __arrayProto.indexOf || function (obj, start)\n\t\t{\n\t\t\tfor ( var i=(start || 0), ien=this.length ; i<ien ; i++ ) {\n\t\t\t\tif ( this[i] === obj ) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn -1;\n\t\t},\n\t\n\t\titerator: function ( flatten, type, fn, alwaysNew ) {\n\t\t\tvar\n\t\t\t\ta = [], ret,\n\t\t\t\ti, ien, j, jen,\n\t\t\t\tcontext = this.context,\n\t\t\t\trows, items, item,\n\t\t\t\tselector = this.selector;\n\t\n\t\t\t// Argument shifting\n\t\t\tif ( typeof flatten === 'string' ) {\n\t\t\t\talwaysNew = fn;\n\t\t\t\tfn = type;\n\t\t\t\ttype = flatten;\n\t\t\t\tflatten = false;\n\t\t\t}\n\t\n\t\t\tfor ( i=0, ien=context.length ; i<ien ; i++ ) {\n\t\t\t\tvar apiInst = new _Api( context[i] );\n\t\n\t\t\t\tif ( type === 'table' ) {\n\t\t\t\t\tret = fn.call( apiInst, context[i], i );\n\t\n\t\t\t\t\tif ( ret !== undefined ) {\n\t\t\t\t\t\ta.push( ret );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if ( type === 'columns' || type === 'rows' ) {\n\t\t\t\t\t// this has same length as context - one entry for each table\n\t\t\t\t\tret = fn.call( apiInst, context[i], this[i], i );\n\t\n\t\t\t\t\tif ( ret !== undefined ) {\n\t\t\t\t\t\ta.push( ret );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if ( type === 'column' || type === 'column-rows' || type === 'row' || type === 'cell' ) {\n\t\t\t\t\t// columns and rows share the same structure.\n\t\t\t\t\t// 'this' is an array of column indexes for each context\n\t\t\t\t\titems = this[i];\n\t\n\t\t\t\t\tif ( type === 'column-rows' ) {\n\t\t\t\t\t\trows = _selector_row_indexes( context[i], selector.opts );\n\t\t\t\t\t}\n\t\n\t\t\t\t\tfor ( j=0, jen=items.length ; j<jen ; j++ ) {\n\t\t\t\t\t\titem = items[j];\n\t\n\t\t\t\t\t\tif ( type === 'cell' ) {\n\t\t\t\t\t\t\tret = fn.call( apiInst, context[i], item.row, item.column, i, j );\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tret = fn.call( apiInst, context[i], item, i, j, rows );\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\tif ( ret !== undefined ) {\n\t\t\t\t\t\t\ta.push( ret );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tif ( a.length || alwaysNew ) {\n\t\t\t\tvar api = new _Api( context, flatten ? a.concat.apply( [], a ) : a );\n\t\t\t\tvar apiSelector = api.selector;\n\t\t\t\tapiSelector.rows = selector.rows;\n\t\t\t\tapiSelector.cols = selector.cols;\n\t\t\t\tapiSelector.opts = selector.opts;\n\t\t\t\treturn api;\n\t\t\t}\n\t\t\treturn this;\n\t\t},\n\t\n\t\n\t\tlastIndexOf: __arrayProto.lastIndexOf || function (obj, start)\n\t\t{\n\t\t\t// Bit cheeky...\n\t\t\treturn this.indexOf.apply( this.toArray.reverse(), arguments );\n\t\t},\n\t\n\t\n\t\tlength:  0,\n\t\n\t\n\t\tmap: function ( fn )\n\t\t{\n\t\t\tvar a = [];\n\t\n\t\t\tif ( __arrayProto.map ) {\n\t\t\t\ta = __arrayProto.map.call( this, fn, this );\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Compatibility for browsers without EMCA-252-5 (JS 1.6)\n\t\t\t\tfor ( var i=0, ien=this.length ; i<ien ; i++ ) {\n\t\t\t\t\ta.push( fn.call( this, this[i], i ) );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn new _Api( this.context, a );\n\t\t},\n\t\n\t\n\t\tpluck: function ( prop )\n\t\t{\n\t\t\treturn this.map( function ( el ) {\n\t\t\t\treturn el[ prop ];\n\t\t\t} );\n\t\t},\n\t\n\t\tpop:     __arrayProto.pop,\n\t\n\t\n\t\tpush:    __arrayProto.push,\n\t\n\t\n\t\t// Does not return an API instance\n\t\treduce: __arrayProto.reduce || function ( fn, init )\n\t\t{\n\t\t\treturn _fnReduce( this, fn, init, 0, this.length, 1 );\n\t\t},\n\t\n\t\n\t\treduceRight: __arrayProto.reduceRight || function ( fn, init )\n\t\t{\n\t\t\treturn _fnReduce( this, fn, init, this.length-1, -1, -1 );\n\t\t},\n\t\n\t\n\t\treverse: __arrayProto.reverse,\n\t\n\t\n\t\t// Object with rows, columns and opts\n\t\tselector: null,\n\t\n\t\n\t\tshift:   __arrayProto.shift,\n\t\n\t\n\t\tsort:    __arrayProto.sort, // ? name - order?\n\t\n\t\n\t\tsplice:  __arrayProto.splice,\n\t\n\t\n\t\ttoArray: function ()\n\t\t{\n\t\t\treturn __arrayProto.slice.call( this );\n\t\t},\n\t\n\t\n\t\tto$: function ()\n\t\t{\n\t\t\treturn $( this );\n\t\t},\n\t\n\t\n\t\ttoJQuery: function ()\n\t\t{\n\t\t\treturn $( this );\n\t\t},\n\t\n\t\n\t\tunique: function ()\n\t\t{\n\t\t\treturn new _Api( this.context, _unique(this) );\n\t\t},\n\t\n\t\n\t\tunshift: __arrayProto.unshift\n\t} );\n\t\n\t\n\t_Api.extend = function ( scope, obj, ext )\n\t{\n\t\t// Only extend API instances and static properties of the API\n\t\tif ( ! ext.length || ! obj || ( ! (obj instanceof _Api) && ! obj.__dt_wrapper ) ) {\n\t\t\treturn;\n\t\t}\n\t\n\t\tvar\n\t\t\ti, ien,\n\t\t\tj, jen,\n\t\t\tstruct, inner,\n\t\t\tmethodScoping = function ( scope, fn, struc ) {\n\t\t\t\treturn function () {\n\t\t\t\t\tvar ret = fn.apply( scope, arguments );\n\t\n\t\t\t\t\t// Method extension\n\t\t\t\t\t_Api.extend( ret, ret, struc.methodExt );\n\t\t\t\t\treturn ret;\n\t\t\t\t};\n\t\t\t};\n\t\n\t\tfor ( i=0, ien=ext.length ; i<ien ; i++ ) {\n\t\t\tstruct = ext[i];\n\t\n\t\t\t// Value\n\t\t\tobj[ struct.name ] = typeof struct.val === 'function' ?\n\t\t\t\tmethodScoping( scope, struct.val, struct ) :\n\t\t\t\t$.isPlainObject( struct.val ) ?\n\t\t\t\t\t{} :\n\t\t\t\t\tstruct.val;\n\t\n\t\t\tobj[ struct.name ].__dt_wrapper = true;\n\t\n\t\t\t// Property extension\n\t\t\t_Api.extend( scope, obj[ struct.name ], struct.propExt );\n\t\t}\n\t};\n\t\n\t\n\t// @todo - Is there need for an augment function?\n\t// _Api.augment = function ( inst, name )\n\t// {\n\t// \t// Find src object in the structure from the name\n\t// \tvar parts = name.split('.');\n\t\n\t// \t_Api.extend( inst, obj );\n\t// };\n\t\n\t\n\t//     [\n\t//       {\n\t//         name:      'data'                -- string   - Property name\n\t//         val:       function () {},       -- function - Api method (or undefined if just an object\n\t//         methodExt: [ ... ],              -- array    - Array of Api object definitions to extend the method result\n\t//         propExt:   [ ... ]               -- array    - Array of Api object definitions to extend the property\n\t//       },\n\t//       {\n\t//         name:     'row'\n\t//         val:       {},\n\t//         methodExt: [ ... ],\n\t//         propExt:   [\n\t//           {\n\t//             name:      'data'\n\t//             val:       function () {},\n\t//             methodExt: [ ... ],\n\t//             propExt:   [ ... ]\n\t//           },\n\t//           ...\n\t//         ]\n\t//       }\n\t//     ]\n\t\n\t_Api.register = _api_register = function ( name, val )\n\t{\n\t\tif ( $.isArray( name ) ) {\n\t\t\tfor ( var j=0, jen=name.length ; j<jen ; j++ ) {\n\t\t\t\t_Api.register( name[j], val );\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\n\t\tvar\n\t\t\ti, ien,\n\t\t\their = name.split('.'),\n\t\t\tstruct = __apiStruct,\n\t\t\tkey, method;\n\t\n\t\tvar find = function ( src, name ) {\n\t\t\tfor ( var i=0, ien=src.length ; i<ien ; i++ ) {\n\t\t\t\tif ( src[i].name === name ) {\n\t\t\t\t\treturn src[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t};\n\t\n\t\tfor ( i=0, ien=heir.length ; i<ien ; i++ ) {\n\t\t\tmethod = heir[i].indexOf('()') !== -1;\n\t\t\tkey = method ?\n\t\t\t\their[i].replace('()', '') :\n\t\t\t\their[i];\n\t\n\t\t\tvar src = find( struct, key );\n\t\t\tif ( ! src ) {\n\t\t\t\tsrc = {\n\t\t\t\t\tname:      key,\n\t\t\t\t\tval:       {},\n\t\t\t\t\tmethodExt: [],\n\t\t\t\t\tpropExt:   []\n\t\t\t\t};\n\t\t\t\tstruct.push( src );\n\t\t\t}\n\t\n\t\t\tif ( i === ien-1 ) {\n\t\t\t\tsrc.val = val;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tstruct = method ?\n\t\t\t\t\tsrc.methodExt :\n\t\t\t\t\tsrc.propExt;\n\t\t\t}\n\t\t}\n\t};\n\t\n\t\n\t_Api.registerPlural = _api_registerPlural = function ( pluralName, singularName, val ) {\n\t\t_Api.register( pluralName, val );\n\t\n\t\t_Api.register( singularName, function () {\n\t\t\tvar ret = val.apply( this, arguments );\n\t\n\t\t\tif ( ret === this ) {\n\t\t\t\t// Returned item is the API instance that was passed in, return it\n\t\t\t\treturn this;\n\t\t\t}\n\t\t\telse if ( ret instanceof _Api ) {\n\t\t\t\t// New API instance returned, want the value from the first item\n\t\t\t\t// in the returned array for the singular result.\n\t\t\t\treturn ret.length ?\n\t\t\t\t\t$.isArray( ret[0] ) ?\n\t\t\t\t\t\tnew _Api( ret.context, ret[0] ) : // Array results are 'enhanced'\n\t\t\t\t\t\tret[0] :\n\t\t\t\t\tundefined;\n\t\t\t}\n\t\n\t\t\t// Non-API return - just fire it back\n\t\t\treturn ret;\n\t\t} );\n\t};\n\t\n\t\n\t/**\n\t * Selector for HTML tables. Apply the given selector to the give array of\n\t * DataTables settings objects.\n\t *\n\t * @param {string|integer} [selector] jQuery selector string or integer\n\t * @param  {array} Array of DataTables settings objects to be filtered\n\t * @return {array}\n\t * @ignore\n\t */\n\tvar __table_selector = function ( selector, a )\n\t{\n\t\t// Integer is used to pick out a table by index\n\t\tif ( typeof selector === 'number' ) {\n\t\t\treturn [ a[ selector ] ];\n\t\t}\n\t\n\t\t// Perform a jQuery selector on the table nodes\n\t\tvar nodes = $.map( a, function (el, i) {\n\t\t\treturn el.nTable;\n\t\t} );\n\t\n\t\treturn $(nodes)\n\t\t\t.filter( selector )\n\t\t\t.map( function (i) {\n\t\t\t\t// Need to translate back from the table node to the settings\n\t\t\t\tvar idx = $.inArray( this, nodes );\n\t\t\t\treturn a[ idx ];\n\t\t\t} )\n\t\t\t.toArray();\n\t};\n\t\n\t\n\t\n\t/**\n\t * Context selector for the API's context (i.e. the tables the API instance\n\t * refers to.\n\t *\n\t * @name    DataTable.Api#tables\n\t * @param {string|integer} [selector] Selector to pick which tables the iterator\n\t *   should operate on. If not given, all tables in the current context are\n\t *   used. This can be given as a jQuery selector (for example `':gt(0)'`) to\n\t *   select multiple tables or as an integer to select a single table.\n\t * @returns {DataTable.Api} Returns a new API instance if a selector is given.\n\t */\n\t_api_register( 'tables()', function ( selector ) {\n\t\t// A new instance is created if there was a selector specified\n\t\treturn selector ?\n\t\t\tnew _Api( __table_selector( selector, this.context ) ) :\n\t\t\tthis;\n\t} );\n\t\n\t\n\t_api_register( 'table()', function ( selector ) {\n\t\tvar tables = this.tables( selector );\n\t\tvar ctx = tables.context;\n\t\n\t\t// Truncate to the first matched table\n\t\treturn ctx.length ?\n\t\t\tnew _Api( ctx[0] ) :\n\t\t\ttables;\n\t} );\n\t\n\t\n\t_api_registerPlural( 'tables().nodes()', 'table().node()' , function () {\n\t\treturn this.iterator( 'table', function ( ctx ) {\n\t\t\treturn ctx.nTable;\n\t\t}, 1 );\n\t} );\n\t\n\t\n\t_api_registerPlural( 'tables().body()', 'table().body()' , function () {\n\t\treturn this.iterator( 'table', function ( ctx ) {\n\t\t\treturn ctx.nTBody;\n\t\t}, 1 );\n\t} );\n\t\n\t\n\t_api_registerPlural( 'tables().header()', 'table().header()' , function () {\n\t\treturn this.iterator( 'table', function ( ctx ) {\n\t\t\treturn ctx.nTHead;\n\t\t}, 1 );\n\t} );\n\t\n\t\n\t_api_registerPlural( 'tables().footer()', 'table().footer()' , function () {\n\t\treturn this.iterator( 'table', function ( ctx ) {\n\t\t\treturn ctx.nTFoot;\n\t\t}, 1 );\n\t} );\n\t\n\t\n\t_api_registerPlural( 'tables().containers()', 'table().container()' , function () {\n\t\treturn this.iterator( 'table', function ( ctx ) {\n\t\t\treturn ctx.nTableWrapper;\n\t\t}, 1 );\n\t} );\n\t\n\t\n\t\n\t/**\n\t * Redraw the tables in the current context.\n\t */\n\t_api_register( 'draw()', function ( paging ) {\n\t\treturn this.iterator( 'table', function ( settings ) {\n\t\t\tif ( paging === 'page' ) {\n\t\t\t\t_fnDraw( settings );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ( typeof paging === 'string' ) {\n\t\t\t\t\tpaging = paging === 'full-hold' ?\n\t\t\t\t\t\tfalse :\n\t\t\t\t\t\ttrue;\n\t\t\t\t}\n\t\n\t\t\t\t_fnReDraw( settings, paging===false );\n\t\t\t}\n\t\t} );\n\t} );\n\t\n\t\n\t\n\t/**\n\t * Get the current page index.\n\t *\n\t * @return {integer} Current page index (zero based)\n\t *//**\n\t * Set the current page.\n\t *\n\t * Note that if you attempt to show a page which does not exist, DataTables will\n\t * not throw an error, but rather reset the paging.\n\t *\n\t * @param {integer|string} action The paging action to take. This can be one of:\n\t *  * `integer` - The page index to jump to\n\t *  * `string` - An action to take:\n\t *    * `first` - Jump to first page.\n\t *    * `next` - Jump to the next page\n\t *    * `previous` - Jump to previous page\n\t *    * `last` - Jump to the last page.\n\t * @returns {DataTables.Api} this\n\t */\n\t_api_register( 'page()', function ( action ) {\n\t\tif ( action === undefined ) {\n\t\t\treturn this.page.info().page; // not an expensive call\n\t\t}\n\t\n\t\t// else, have an action to take on all tables\n\t\treturn this.iterator( 'table', function ( settings ) {\n\t\t\t_fnPageChange( settings, action );\n\t\t} );\n\t} );\n\t\n\t\n\t/**\n\t * Paging information for the first table in the current context.\n\t *\n\t * If you require paging information for another table, use the `table()` method\n\t * with a suitable selector.\n\t *\n\t * @return {object} Object with the following properties set:\n\t *  * `page` - Current page index (zero based - i.e. the first page is `0`)\n\t *  * `pages` - Total number of pages\n\t *  * `start` - Display index for the first record shown on the current page\n\t *  * `end` - Display index for the last record shown on the current page\n\t *  * `length` - Display length (number of records). Note that generally `start\n\t *    + length = end`, but this is not always true, for example if there are\n\t *    only 2 records to show on the final page, with a length of 10.\n\t *  * `recordsTotal` - Full data set length\n\t *  * `recordsDisplay` - Data set length once the current filtering criterion\n\t *    are applied.\n\t */\n\t_api_register( 'page.info()', function ( action ) {\n\t\tif ( this.context.length === 0 ) {\n\t\t\treturn undefined;\n\t\t}\n\t\n\t\tvar\n\t\t\tsettings   = this.context[0],\n\t\t\tstart      = settings._iDisplayStart,\n\t\t\tlen        = settings.oFeatures.bPaginate ? settings._iDisplayLength : -1,\n\t\t\tvisRecords = settings.fnRecordsDisplay(),\n\t\t\tall        = len === -1;\n\t\n\t\treturn {\n\t\t\t\"page\":           all ? 0 : Math.floor( start / len ),\n\t\t\t\"pages\":          all ? 1 : Math.ceil( visRecords / len ),\n\t\t\t\"start\":          start,\n\t\t\t\"end\":            settings.fnDisplayEnd(),\n\t\t\t\"length\":         len,\n\t\t\t\"recordsTotal\":   settings.fnRecordsTotal(),\n\t\t\t\"recordsDisplay\": visRecords,\n\t\t\t\"serverSide\":     _fnDataSource( settings ) === 'ssp'\n\t\t};\n\t} );\n\t\n\t\n\t/**\n\t * Get the current page length.\n\t *\n\t * @return {integer} Current page length. Note `-1` indicates that all records\n\t *   are to be shown.\n\t *//**\n\t * Set the current page length.\n\t *\n\t * @param {integer} Page length to set. Use `-1` to show all records.\n\t * @returns {DataTables.Api} this\n\t */\n\t_api_register( 'page.len()', function ( len ) {\n\t\t// Note that we can't call this function 'length()' because `length`\n\t\t// is a Javascript property of functions which defines how many arguments\n\t\t// the function expects.\n\t\tif ( len === undefined ) {\n\t\t\treturn this.context.length !== 0 ?\n\t\t\t\tthis.context[0]._iDisplayLength :\n\t\t\t\tundefined;\n\t\t}\n\t\n\t\t// else, set the page length\n\t\treturn this.iterator( 'table', function ( settings ) {\n\t\t\t_fnLengthChange( settings, len );\n\t\t} );\n\t} );\n\t\n\t\n\t\n\tvar __reload = function ( settings, holdPosition, callback ) {\n\t\t// Use the draw event to trigger a callback\n\t\tif ( callback ) {\n\t\t\tvar api = new _Api( settings );\n\t\n\t\t\tapi.one( 'draw', function () {\n\t\t\t\tcallback( api.ajax.json() );\n\t\t\t} );\n\t\t}\n\t\n\t\tif ( _fnDataSource( settings ) == 'ssp' ) {\n\t\t\t_fnReDraw( settings, holdPosition );\n\t\t}\n\t\telse {\n\t\t\t_fnProcessingDisplay( settings, true );\n\t\n\t\t\t// Cancel an existing request\n\t\t\tvar xhr = settings.jqXHR;\n\t\t\tif ( xhr && xhr.readyState !== 4 ) {\n\t\t\t\txhr.abort();\n\t\t\t}\n\t\n\t\t\t// Trigger xhr\n\t\t\t_fnBuildAjax( settings, [], function( json ) {\n\t\t\t\t_fnClearTable( settings );\n\t\n\t\t\t\tvar data = _fnAjaxDataSrc( settings, json );\n\t\t\t\tfor ( var i=0, ien=data.length ; i<ien ; i++ ) {\n\t\t\t\t\t_fnAddData( settings, data[i] );\n\t\t\t\t}\n\t\n\t\t\t\t_fnReDraw( settings, holdPosition );\n\t\t\t\t_fnProcessingDisplay( settings, false );\n\t\t\t} );\n\t\t}\n\t};\n\t\n\t\n\t/**\n\t * Get the JSON response from the last Ajax request that DataTables made to the\n\t * server. Note that this returns the JSON from the first table in the current\n\t * context.\n\t *\n\t * @return {object} JSON received from the server.\n\t */\n\t_api_register( 'ajax.json()', function () {\n\t\tvar ctx = this.context;\n\t\n\t\tif ( ctx.length > 0 ) {\n\t\t\treturn ctx[0].json;\n\t\t}\n\t\n\t\t// else return undefined;\n\t} );\n\t\n\t\n\t/**\n\t * Get the data submitted in the last Ajax request\n\t */\n\t_api_register( 'ajax.params()', function () {\n\t\tvar ctx = this.context;\n\t\n\t\tif ( ctx.length > 0 ) {\n\t\t\treturn ctx[0].oAjaxData;\n\t\t}\n\t\n\t\t// else return undefined;\n\t} );\n\t\n\t\n\t/**\n\t * Reload tables from the Ajax data source. Note that this function will\n\t * automatically re-draw the table when the remote data has been loaded.\n\t *\n\t * @param {boolean} [reset=true] Reset (default) or hold the current paging\n\t *   position. A full re-sort and re-filter is performed when this method is\n\t *   called, which is why the pagination reset is the default action.\n\t * @returns {DataTables.Api} this\n\t */\n\t_api_register( 'ajax.reload()', function ( callback, resetPaging ) {\n\t\treturn this.iterator( 'table', function (settings) {\n\t\t\t__reload( settings, resetPaging===false, callback );\n\t\t} );\n\t} );\n\t\n\t\n\t/**\n\t * Get the current Ajax URL. Note that this returns the URL from the first\n\t * table in the current context.\n\t *\n\t * @return {string} Current Ajax source URL\n\t *//**\n\t * Set the Ajax URL. Note that this will set the URL for all tables in the\n\t * current context.\n\t *\n\t * @param {string} url URL to set.\n\t * @returns {DataTables.Api} this\n\t */\n\t_api_register( 'ajax.url()', function ( url ) {\n\t\tvar ctx = this.context;\n\t\n\t\tif ( url === undefined ) {\n\t\t\t// get\n\t\t\tif ( ctx.length === 0 ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tctx = ctx[0];\n\t\n\t\t\treturn ctx.ajax ?\n\t\t\t\t$.isPlainObject( ctx.ajax ) ?\n\t\t\t\t\tctx.ajax.url :\n\t\t\t\t\tctx.ajax :\n\t\t\t\tctx.sAjaxSource;\n\t\t}\n\t\n\t\t// set\n\t\treturn this.iterator( 'table', function ( settings ) {\n\t\t\tif ( $.isPlainObject( settings.ajax ) ) {\n\t\t\t\tsettings.ajax.url = url;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsettings.ajax = url;\n\t\t\t}\n\t\t\t// No need to consider sAjaxSource here since DataTables gives priority\n\t\t\t// to `ajax` over `sAjaxSource`. So setting `ajax` here, renders any\n\t\t\t// value of `sAjaxSource` redundant.\n\t\t} );\n\t} );\n\t\n\t\n\t/**\n\t * Load data from the newly set Ajax URL. Note that this method is only\n\t * available when `ajax.url()` is used to set a URL. Additionally, this method\n\t * has the same effect as calling `ajax.reload()` but is provided for\n\t * convenience when setting a new URL. Like `ajax.reload()` it will\n\t * automatically redraw the table once the remote data has been loaded.\n\t *\n\t * @returns {DataTables.Api} this\n\t */\n\t_api_register( 'ajax.url().load()', function ( callback, resetPaging ) {\n\t\t// Same as a reload, but makes sense to present it for easy access after a\n\t\t// url change\n\t\treturn this.iterator( 'table', function ( ctx ) {\n\t\t\t__reload( ctx, resetPaging===false, callback );\n\t\t} );\n\t} );\n\t\n\t\n\t\n\t\n\tvar _selector_run = function ( type, selector, selectFn, settings, opts )\n\t{\n\t\tvar\n\t\t\tout = [], res,\n\t\t\ta, i, ien, j, jen,\n\t\t\tselectorType = typeof selector;\n\t\n\t\t// Can't just check for isArray here, as an API or jQuery instance might be\n\t\t// given with their array like look\n\t\tif ( ! selector || selectorType === 'string' || selectorType === 'function' || selector.length === undefined ) {\n\t\t\tselector = [ selector ];\n\t\t}\n\t\n\t\tfor ( i=0, ien=selector.length ; i<ien ; i++ ) {\n\t\t\ta = selector[i] && selector[i].split ?\n\t\t\t\tselector[i].split(',') :\n\t\t\t\t[ selector[i] ];\n\t\n\t\t\tfor ( j=0, jen=a.length ; j<jen ; j++ ) {\n\t\t\t\tres = selectFn( typeof a[j] === 'string' ? $.trim(a[j]) : a[j] );\n\t\n\t\t\t\tif ( res && res.length ) {\n\t\t\t\t\tout = out.concat( res );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\t// selector extensions\n\t\tvar ext = _ext.selector[ type ];\n\t\tif ( ext.length ) {\n\t\t\tfor ( i=0, ien=ext.length ; i<ien ; i++ ) {\n\t\t\t\tout = ext[i]( settings, opts, out );\n\t\t\t}\n\t\t}\n\t\n\t\treturn _unique( out );\n\t};\n\t\n\t\n\tvar _selector_opts = function ( opts )\n\t{\n\t\tif ( ! opts ) {\n\t\t\topts = {};\n\t\t}\n\t\n\t\t// Backwards compatibility for 1.9- which used the terminology filter rather\n\t\t// than search\n\t\tif ( opts.filter && opts.search === undefined ) {\n\t\t\topts.search = opts.filter;\n\t\t}\n\t\n\t\treturn $.extend( {\n\t\t\tsearch: 'none',\n\t\t\torder: 'current',\n\t\t\tpage: 'all'\n\t\t}, opts );\n\t};\n\t\n\t\n\tvar _selector_first = function ( inst )\n\t{\n\t\t// Reduce the API instance to the first item found\n\t\tfor ( var i=0, ien=inst.length ; i<ien ; i++ ) {\n\t\t\tif ( inst[i].length > 0 ) {\n\t\t\t\t// Assign the first element to the first item in the instance\n\t\t\t\t// and truncate the instance and context\n\t\t\t\tinst[0] = inst[i];\n\t\t\t\tinst[0].length = 1;\n\t\t\t\tinst.length = 1;\n\t\t\t\tinst.context = [ inst.context[i] ];\n\t\n\t\t\t\treturn inst;\n\t\t\t}\n\t\t}\n\t\n\t\t// Not found - return an empty instance\n\t\tinst.length = 0;\n\t\treturn inst;\n\t};\n\t\n\t\n\tvar _selector_row_indexes = function ( settings, opts )\n\t{\n\t\tvar\n\t\t\ti, ien, tmp, a=[],\n\t\t\tdisplayFiltered = settings.aiDisplay,\n\t\t\tdisplayMaster = settings.aiDisplayMaster;\n\t\n\t\tvar\n\t\t\tsearch = opts.search,  // none, applied, removed\n\t\t\torder  = opts.order,   // applied, current, index (original - compatibility with 1.9)\n\t\t\tpage   = opts.page;    // all, current\n\t\n\t\tif ( _fnDataSource( settings ) == 'ssp' ) {\n\t\t\t// In server-side processing mode, most options are irrelevant since\n\t\t\t// rows not shown don't exist and the index order is the applied order\n\t\t\t// Removed is a special case - for consistency just return an empty\n\t\t\t// array\n\t\t\treturn search === 'removed' ?\n\t\t\t\t[] :\n\t\t\t\t_range( 0, displayMaster.length );\n\t\t}\n\t\telse if ( page == 'current' ) {\n\t\t\t// Current page implies that order=current and fitler=applied, since it is\n\t\t\t// fairly senseless otherwise, regardless of what order and search actually\n\t\t\t// are\n\t\t\tfor ( i=settings._iDisplayStart, ien=settings.fnDisplayEnd() ; i<ien ; i++ ) {\n\t\t\t\ta.push( displayFiltered[i] );\n\t\t\t}\n\t\t}\n\t\telse if ( order == 'current' || order == 'applied' ) {\n\t\t\ta = search == 'none' ?\n\t\t\t\tdisplayMaster.slice() :                      // no search\n\t\t\t\tsearch == 'applied' ?\n\t\t\t\t\tdisplayFiltered.slice() :                // applied search\n\t\t\t\t\t$.map( displayMaster, function (el, i) { // removed search\n\t\t\t\t\t\treturn $.inArray( el, displayFiltered ) === -1 ? el : null;\n\t\t\t\t\t} );\n\t\t}\n\t\telse if ( order == 'index' || order == 'original' ) {\n\t\t\tfor ( i=0, ien=settings.aoData.length ; i<ien ; i++ ) {\n\t\t\t\tif ( search == 'none' ) {\n\t\t\t\t\ta.push( i );\n\t\t\t\t}\n\t\t\t\telse { // applied | removed\n\t\t\t\t\ttmp = $.inArray( i, displayFiltered );\n\t\n\t\t\t\t\tif ((tmp === -1 && search == 'removed') ||\n\t\t\t\t\t\t(tmp >= 0   && search == 'applied') )\n\t\t\t\t\t{\n\t\t\t\t\t\ta.push( i );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\treturn a;\n\t};\n\t\n\t\n\t/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\t * Rows\n\t *\n\t * {}          - no selector - use all available rows\n\t * {integer}   - row aoData index\n\t * {node}      - TR node\n\t * {string}    - jQuery selector to apply to the TR elements\n\t * {array}     - jQuery array of nodes, or simply an array of TR nodes\n\t *\n\t */\n\t\n\t\n\tvar __row_selector = function ( settings, selector, opts )\n\t{\n\t\tvar run = function ( sel ) {\n\t\t\tvar selInt = _intVal( sel );\n\t\t\tvar i, ien;\n\t\n\t\t\t// Short cut - selector is a number and no options provided (default is\n\t\t\t// all records, so no need to check if the index is in there, since it\n\t\t\t// must be - dev error if the index doesn't exist).\n\t\t\tif ( selInt !== null && ! opts ) {\n\t\t\t\treturn [ selInt ];\n\t\t\t}\n\t\n\t\t\tvar rows = _selector_row_indexes( settings, opts );\n\t\n\t\t\tif ( selInt !== null && $.inArray( selInt, rows ) !== -1 ) {\n\t\t\t\t// Selector - integer\n\t\t\t\treturn [ selInt ];\n\t\t\t}\n\t\t\telse if ( ! sel ) {\n\t\t\t\t// Selector - none\n\t\t\t\treturn rows;\n\t\t\t}\n\t\n\t\t\t// Selector - function\n\t\t\tif ( typeof sel === 'function' ) {\n\t\t\t\treturn $.map( rows, function (idx) {\n\t\t\t\t\tvar row = settings.aoData[ idx ];\n\t\t\t\t\treturn sel( idx, row._aData, row.nTr ) ? idx : null;\n\t\t\t\t} );\n\t\t\t}\n\t\n\t\t\t// Get nodes in the order from the `rows` array with null values removed\n\t\t\tvar nodes = _removeEmpty(\n\t\t\t\t_pluck_order( settings.aoData, rows, 'nTr' )\n\t\t\t);\n\t\n\t\t\t// Selector - node\n\t\t\tif ( sel.nodeName ) {\n\t\t\t\tif ( sel._DT_RowIndex !== undefined ) {\n\t\t\t\t\treturn [ sel._DT_RowIndex ]; // Property added by DT for fast lookup\n\t\t\t\t}\n\t\t\t\telse if ( sel._DT_CellIndex ) {\n\t\t\t\t\treturn [ sel._DT_CellIndex.row ];\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tvar host = $(sel).closest('*[data-dt-row]');\n\t\t\t\t\treturn host.length ?\n\t\t\t\t\t\t[ host.data('dt-row') ] :\n\t\t\t\t\t\t[];\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// ID selector. Want to always be able to select rows by id, regardless\n\t\t\t// of if the tr element has been created or not, so can't rely upon\n\t\t\t// jQuery here - hence a custom implementation. This does not match\n\t\t\t// Sizzle's fast selector or HTML4 - in HTML5 the ID can be anything,\n\t\t\t// but to select it using a CSS selector engine (like Sizzle or\n\t\t\t// querySelect) it would need to need to be escaped for some characters.\n\t\t\t// DataTables simplifies this for row selectors since you can select\n\t\t\t// only a row. A # indicates an id any anything that follows is the id -\n\t\t\t// unescaped.\n\t\t\tif ( typeof sel === 'string' && sel.charAt(0) === '#' ) {\n\t\t\t\t// get row index from id\n\t\t\t\tvar rowObj = settings.aIds[ sel.replace( /^#/, '' ) ];\n\t\t\t\tif ( rowObj !== undefined ) {\n\t\t\t\t\treturn [ rowObj.idx ];\n\t\t\t\t}\n\t\n\t\t\t\t// need to fall through to jQuery in case there is DOM id that\n\t\t\t\t// matches\n\t\t\t}\n\t\n\t\t\t// Selector - jQuery selector string, array of nodes or jQuery object/\n\t\t\t// As jQuery's .filter() allows jQuery objects to be passed in filter,\n\t\t\t// it also allows arrays, so this will cope with all three options\n\t\t\treturn $(nodes)\n\t\t\t\t.filter( sel )\n\t\t\t\t.map( function () {\n\t\t\t\t\treturn this._DT_RowIndex;\n\t\t\t\t} )\n\t\t\t\t.toArray();\n\t\t};\n\t\n\t\treturn _selector_run( 'row', selector, run, settings, opts );\n\t};\n\t\n\t\n\t_api_register( 'rows()', function ( selector, opts ) {\n\t\t// argument shifting\n\t\tif ( selector === undefined ) {\n\t\t\tselector = '';\n\t\t}\n\t\telse if ( $.isPlainObject( selector ) ) {\n\t\t\topts = selector;\n\t\t\tselector = '';\n\t\t}\n\t\n\t\topts = _selector_opts( opts );\n\t\n\t\tvar inst = this.iterator( 'table', function ( settings ) {\n\t\t\treturn __row_selector( settings, selector, opts );\n\t\t}, 1 );\n\t\n\t\t// Want argument shifting here and in __row_selector?\n\t\tinst.selector.rows = selector;\n\t\tinst.selector.opts = opts;\n\t\n\t\treturn inst;\n\t} );\n\t\n\t_api_register( 'rows().nodes()', function () {\n\t\treturn this.iterator( 'row', function ( settings, row ) {\n\t\t\treturn settings.aoData[ row ].nTr || undefined;\n\t\t}, 1 );\n\t} );\n\t\n\t_api_register( 'rows().data()', function () {\n\t\treturn this.iterator( true, 'rows', function ( settings, rows ) {\n\t\t\treturn _pluck_order( settings.aoData, rows, '_aData' );\n\t\t}, 1 );\n\t} );\n\t\n\t_api_registerPlural( 'rows().cache()', 'row().cache()', function ( type ) {\n\t\treturn this.iterator( 'row', function ( settings, row ) {\n\t\t\tvar r = settings.aoData[ row ];\n\t\t\treturn type === 'search' ? r._aFilterData : r._aSortData;\n\t\t}, 1 );\n\t} );\n\t\n\t_api_registerPlural( 'rows().invalidate()', 'row().invalidate()', function ( src ) {\n\t\treturn this.iterator( 'row', function ( settings, row ) {\n\t\t\t_fnInvalidate( settings, row, src );\n\t\t} );\n\t} );\n\t\n\t_api_registerPlural( 'rows().indexes()', 'row().index()', function () {\n\t\treturn this.iterator( 'row', function ( settings, row ) {\n\t\t\treturn row;\n\t\t}, 1 );\n\t} );\n\t\n\t_api_registerPlural( 'rows().ids()', 'row().id()', function ( hash ) {\n\t\tvar a = [];\n\t\tvar context = this.context;\n\t\n\t\t// `iterator` will drop undefined values, but in this case we want them\n\t\tfor ( var i=0, ien=context.length ; i<ien ; i++ ) {\n\t\t\tfor ( var j=0, jen=this[i].length ; j<jen ; j++ ) {\n\t\t\t\tvar id = context[i].rowIdFn( context[i].aoData[ this[i][j] ]._aData );\n\t\t\t\ta.push( (hash === true ? '#' : '' )+ id );\n\t\t\t}\n\t\t}\n\t\n\t\treturn new _Api( context, a );\n\t} );\n\t\n\t_api_registerPlural( 'rows().remove()', 'row().remove()', function () {\n\t\tvar that = this;\n\t\n\t\tthis.iterator( 'row', function ( settings, row, thatIdx ) {\n\t\t\tvar data = settings.aoData;\n\t\t\tvar rowData = data[ row ];\n\t\t\tvar i, ien, j, jen;\n\t\t\tvar loopRow, loopCells;\n\t\n\t\t\tdata.splice( row, 1 );\n\t\n\t\t\t// Update the cached indexes\n\t\t\tfor ( i=0, ien=data.length ; i<ien ; i++ ) {\n\t\t\t\tloopRow = data[i];\n\t\t\t\tloopCells = loopRow.anCells;\n\t\n\t\t\t\t// Rows\n\t\t\t\tif ( loopRow.nTr !== null ) {\n\t\t\t\t\tloopRow.nTr._DT_RowIndex = i;\n\t\t\t\t}\n\t\n\t\t\t\t// Cells\n\t\t\t\tif ( loopCells !== null ) {\n\t\t\t\t\tfor ( j=0, jen=loopCells.length ; j<jen ; j++ ) {\n\t\t\t\t\t\tloopCells[j]._DT_CellIndex.row = i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Delete from the display arrays\n\t\t\t_fnDeleteIndex( settings.aiDisplayMaster, row );\n\t\t\t_fnDeleteIndex( settings.aiDisplay, row );\n\t\t\t_fnDeleteIndex( that[ thatIdx ], row, false ); // maintain local indexes\n\t\n\t\t\t// Check for an 'overflow' they case for displaying the table\n\t\t\t_fnLengthOverflow( settings );\n\t\n\t\t\t// Remove the row's ID reference if there is one\n\t\t\tvar id = settings.rowIdFn( rowData._aData );\n\t\t\tif ( id !== undefined ) {\n\t\t\t\tdelete settings.aIds[ id ];\n\t\t\t}\n\t\t} );\n\t\n\t\tthis.iterator( 'table', function ( settings ) {\n\t\t\tfor ( var i=0, ien=settings.aoData.length ; i<ien ; i++ ) {\n\t\t\t\tsettings.aoData[i].idx = i;\n\t\t\t}\n\t\t} );\n\t\n\t\treturn this;\n\t} );\n\t\n\t\n\t_api_register( 'rows.add()', function ( rows ) {\n\t\tvar newRows = this.iterator( 'table', function ( settings ) {\n\t\t\t\tvar row, i, ien;\n\t\t\t\tvar out = [];\n\t\n\t\t\t\tfor ( i=0, ien=rows.length ; i<ien ; i++ ) {\n\t\t\t\t\trow = rows[i];\n\t\n\t\t\t\t\tif ( row.nodeName && row.nodeName.toUpperCase() === 'TR' ) {\n\t\t\t\t\t\tout.push( _fnAddTr( settings, row )[0] );\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tout.push( _fnAddData( settings, row ) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\treturn out;\n\t\t\t}, 1 );\n\t\n\t\t// Return an Api.rows() extended instance, so rows().nodes() etc can be used\n\t\tvar modRows = this.rows( -1 );\n\t\tmodRows.pop();\n\t\t$.merge( modRows, newRows );\n\t\n\t\treturn modRows;\n\t} );\n\t\n\t\n\t\n\t\n\t\n\t/**\n\t *\n\t */\n\t_api_register( 'row()', function ( selector, opts ) {\n\t\treturn _selector_first( this.rows( selector, opts ) );\n\t} );\n\t\n\t\n\t_api_register( 'row().data()', function ( data ) {\n\t\tvar ctx = this.context;\n\t\n\t\tif ( data === undefined ) {\n\t\t\t// Get\n\t\t\treturn ctx.length && this.length ?\n\t\t\t\tctx[0].aoData[ this[0] ]._aData :\n\t\t\t\tundefined;\n\t\t}\n\t\n\t\t// Set\n\t\tctx[0].aoData[ this[0] ]._aData = data;\n\t\n\t\t// Automatically invalidate\n\t\t_fnInvalidate( ctx[0], this[0], 'data' );\n\t\n\t\treturn this;\n\t} );\n\t\n\t\n\t_api_register( 'row().node()', function () {\n\t\tvar ctx = this.context;\n\t\n\t\treturn ctx.length && this.length ?\n\t\t\tctx[0].aoData[ this[0] ].nTr || null :\n\t\t\tnull;\n\t} );\n\t\n\t\n\t_api_register( 'row.add()', function ( row ) {\n\t\t// Allow a jQuery object to be passed in - only a single row is added from\n\t\t// it though - the first element in the set\n\t\tif ( row instanceof $ && row.length ) {\n\t\t\trow = row[0];\n\t\t}\n\t\n\t\tvar rows = this.iterator( 'table', function ( settings ) {\n\t\t\tif ( row.nodeName && row.nodeName.toUpperCase() === 'TR' ) {\n\t\t\t\treturn _fnAddTr( settings, row )[0];\n\t\t\t}\n\t\t\treturn _fnAddData( settings, row );\n\t\t} );\n\t\n\t\t// Return an Api.rows() extended instance, with the newly added row selected\n\t\treturn this.row( rows[0] );\n\t} );\n\t\n\t\n\t\n\tvar __details_add = function ( ctx, row, data, klass )\n\t{\n\t\t// Convert to array of TR elements\n\t\tvar rows = [];\n\t\tvar addRow = function ( r, k ) {\n\t\t\t// Recursion to allow for arrays of jQuery objects\n\t\t\tif ( $.isArray( r ) || r instanceof $ ) {\n\t\t\t\tfor ( var i=0, ien=r.length ; i<ien ; i++ ) {\n\t\t\t\t\taddRow( r[i], k );\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// If we get a TR element, then just add it directly - up to the dev\n\t\t\t// to add the correct number of columns etc\n\t\t\tif ( r.nodeName && r.nodeName.toLowerCase() === 'tr' ) {\n\t\t\t\trows.push( r );\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Otherwise create a row with a wrapper\n\t\t\t\tvar created = $('<tr><td/></tr>').addClass( k );\n\t\t\t\t$('td', created)\n\t\t\t\t\t.addClass( k )\n\t\t\t\t\t.html( r )\n\t\t\t\t\t[0].colSpan = _fnVisbleColumns( ctx );\n\t\n\t\t\t\trows.push( created[0] );\n\t\t\t}\n\t\t};\n\t\n\t\taddRow( data, klass );\n\t\n\t\tif ( row._details ) {\n\t\t\trow._details.remove();\n\t\t}\n\t\n\t\trow._details = $(rows);\n\t\n\t\t// If the children were already shown, that state should be retained\n\t\tif ( row._detailsShow ) {\n\t\t\trow._details.insertAfter( row.nTr );\n\t\t}\n\t};\n\t\n\t\n\tvar __details_remove = function ( api, idx )\n\t{\n\t\tvar ctx = api.context;\n\t\n\t\tif ( ctx.length ) {\n\t\t\tvar row = ctx[0].aoData[ idx !== undefined ? idx : api[0] ];\n\t\n\t\t\tif ( row && row._details ) {\n\t\t\t\trow._details.remove();\n\t\n\t\t\t\trow._detailsShow = undefined;\n\t\t\t\trow._details = undefined;\n\t\t\t}\n\t\t}\n\t};\n\t\n\t\n\tvar __details_display = function ( api, show ) {\n\t\tvar ctx = api.context;\n\t\n\t\tif ( ctx.length && api.length ) {\n\t\t\tvar row = ctx[0].aoData[ api[0] ];\n\t\n\t\t\tif ( row._details ) {\n\t\t\t\trow._detailsShow = show;\n\t\n\t\t\t\tif ( show ) {\n\t\t\t\t\trow._details.insertAfter( row.nTr );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\trow._details.detach();\n\t\t\t\t}\n\t\n\t\t\t\t__details_events( ctx[0] );\n\t\t\t}\n\t\t}\n\t};\n\t\n\t\n\tvar __details_events = function ( settings )\n\t{\n\t\tvar api = new _Api( settings );\n\t\tvar namespace = '.dt.DT_details';\n\t\tvar drawEvent = 'draw'+namespace;\n\t\tvar colvisEvent = 'column-visibility'+namespace;\n\t\tvar destroyEvent = 'destroy'+namespace;\n\t\tvar data = settings.aoData;\n\t\n\t\tapi.off( drawEvent +' '+ colvisEvent +' '+ destroyEvent );\n\t\n\t\tif ( _pluck( data, '_details' ).length > 0 ) {\n\t\t\t// On each draw, insert the required elements into the document\n\t\t\tapi.on( drawEvent, function ( e, ctx ) {\n\t\t\t\tif ( settings !== ctx ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\tapi.rows( {page:'current'} ).eq(0).each( function (idx) {\n\t\t\t\t\t// Internal data grab\n\t\t\t\t\tvar row = data[ idx ];\n\t\n\t\t\t\t\tif ( row._detailsShow ) {\n\t\t\t\t\t\trow._details.insertAfter( row.nTr );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\n\t\t\t// Column visibility change - update the colspan\n\t\t\tapi.on( colvisEvent, function ( e, ctx, idx, vis ) {\n\t\t\t\tif ( settings !== ctx ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\t// Update the colspan for the details rows (note, only if it already has\n\t\t\t\t// a colspan)\n\t\t\t\tvar row, visible = _fnVisbleColumns( ctx );\n\t\n\t\t\t\tfor ( var i=0, ien=data.length ; i<ien ; i++ ) {\n\t\t\t\t\trow = data[i];\n\t\n\t\t\t\t\tif ( row._details ) {\n\t\t\t\t\t\trow._details.children('td[colspan]').attr('colspan', visible );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\n\t\t\t// Table destroyed - nuke any child rows\n\t\t\tapi.on( destroyEvent, function ( e, ctx ) {\n\t\t\t\tif ( settings !== ctx ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\tfor ( var i=0, ien=data.length ; i<ien ; i++ ) {\n\t\t\t\t\tif ( data[i]._details ) {\n\t\t\t\t\t\t__details_remove( api, i );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t};\n\t\n\t// Strings for the method names to help minification\n\tvar _emp = '';\n\tvar _child_obj = _emp+'row().child';\n\tvar _child_mth = _child_obj+'()';\n\t\n\t// data can be:\n\t//  tr\n\t//  string\n\t//  jQuery or array of any of the above\n\t_api_register( _child_mth, function ( data, klass ) {\n\t\tvar ctx = this.context;\n\t\n\t\tif ( data === undefined ) {\n\t\t\t// get\n\t\t\treturn ctx.length && this.length ?\n\t\t\t\tctx[0].aoData[ this[0] ]._details :\n\t\t\t\tundefined;\n\t\t}\n\t\telse if ( data === true ) {\n\t\t\t// show\n\t\t\tthis.child.show();\n\t\t}\n\t\telse if ( data === false ) {\n\t\t\t// remove\n\t\t\t__details_remove( this );\n\t\t}\n\t\telse if ( ctx.length && this.length ) {\n\t\t\t// set\n\t\t\t__details_add( ctx[0], ctx[0].aoData[ this[0] ], data, klass );\n\t\t}\n\t\n\t\treturn this;\n\t} );\n\t\n\t\n\t_api_register( [\n\t\t_child_obj+'.show()',\n\t\t_child_mth+'.show()' // only when `child()` was called with parameters (without\n\t], function ( show ) {   // it returns an object and this method is not executed)\n\t\t__details_display( this, true );\n\t\treturn this;\n\t} );\n\t\n\t\n\t_api_register( [\n\t\t_child_obj+'.hide()',\n\t\t_child_mth+'.hide()' // only when `child()` was called with parameters (without\n\t], function () {         // it returns an object and this method is not executed)\n\t\t__details_display( this, false );\n\t\treturn this;\n\t} );\n\t\n\t\n\t_api_register( [\n\t\t_child_obj+'.remove()',\n\t\t_child_mth+'.remove()' // only when `child()` was called with parameters (without\n\t], function () {           // it returns an object and this method is not executed)\n\t\t__details_remove( this );\n\t\treturn this;\n\t} );\n\t\n\t\n\t_api_register( _child_obj+'.isShown()', function () {\n\t\tvar ctx = this.context;\n\t\n\t\tif ( ctx.length && this.length ) {\n\t\t\t// _detailsShown as false or undefined will fall through to return false\n\t\t\treturn ctx[0].aoData[ this[0] ]._detailsShow || false;\n\t\t}\n\t\treturn false;\n\t} );\n\t\n\t\n\t\n\t/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\t * Columns\n\t *\n\t * {integer}           - column index (>=0 count from left, <0 count from right)\n\t * \"{integer}:visIdx\"  - visible column index (i.e. translate to column index)  (>=0 count from left, <0 count from right)\n\t * \"{integer}:visible\" - alias for {integer}:visIdx  (>=0 count from left, <0 count from right)\n\t * \"{string}:name\"     - column name\n\t * \"{string}\"          - jQuery selector on column header nodes\n\t *\n\t */\n\t\n\t// can be an array of these items, comma separated list, or an array of comma\n\t// separated lists\n\t\n\tvar __re_column_selector = /^(.+):(name|visIdx|visible)$/;\n\t\n\t\n\t// r1 and r2 are redundant - but it means that the parameters match for the\n\t// iterator callback in columns().data()\n\tvar __columnData = function ( settings, column, r1, r2, rows ) {\n\t\tvar a = [];\n\t\tfor ( var row=0, ien=rows.length ; row<ien ; row++ ) {\n\t\t\ta.push( _fnGetCellData( settings, rows[row], column ) );\n\t\t}\n\t\treturn a;\n\t};\n\t\n\t\n\tvar __column_selector = function ( settings, selector, opts )\n\t{\n\t\tvar\n\t\t\tcolumns = settings.aoColumns,\n\t\t\tnames = _pluck( columns, 'sName' ),\n\t\t\tnodes = _pluck( columns, 'nTh' );\n\t\n\t\tvar run = function ( s ) {\n\t\t\tvar selInt = _intVal( s );\n\t\n\t\t\t// Selector - all\n\t\t\tif ( s === '' ) {\n\t\t\t\treturn _range( columns.length );\n\t\t\t}\n\t\n\t\t\t// Selector - index\n\t\t\tif ( selInt !== null ) {\n\t\t\t\treturn [ selInt >= 0 ?\n\t\t\t\t\tselInt : // Count from left\n\t\t\t\t\tcolumns.length + selInt // Count from right (+ because its a negative value)\n\t\t\t\t];\n\t\t\t}\n\t\n\t\t\t// Selector = function\n\t\t\tif ( typeof s === 'function' ) {\n\t\t\t\tvar rows = _selector_row_indexes( settings, opts );\n\t\n\t\t\t\treturn $.map( columns, function (col, idx) {\n\t\t\t\t\treturn s(\n\t\t\t\t\t\t\tidx,\n\t\t\t\t\t\t\t__columnData( settings, idx, 0, 0, rows ),\n\t\t\t\t\t\t\tnodes[ idx ]\n\t\t\t\t\t\t) ? idx : null;\n\t\t\t\t} );\n\t\t\t}\n\t\n\t\t\t// jQuery or string selector\n\t\t\tvar match = typeof s === 'string' ?\n\t\t\t\ts.match( __re_column_selector ) :\n\t\t\t\t'';\n\t\n\t\t\tif ( match ) {\n\t\t\t\tswitch( match[2] ) {\n\t\t\t\t\tcase 'visIdx':\n\t\t\t\t\tcase 'visible':\n\t\t\t\t\t\tvar idx = parseInt( match[1], 10 );\n\t\t\t\t\t\t// Visible index given, convert to column index\n\t\t\t\t\t\tif ( idx < 0 ) {\n\t\t\t\t\t\t\t// Counting from the right\n\t\t\t\t\t\t\tvar visColumns = $.map( columns, function (col,i) {\n\t\t\t\t\t\t\t\treturn col.bVisible ? i : null;\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\treturn [ visColumns[ visColumns.length + idx ] ];\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Counting from the left\n\t\t\t\t\t\treturn [ _fnVisibleToColumnIndex( settings, idx ) ];\n\t\n\t\t\t\t\tcase 'name':\n\t\t\t\t\t\t// match by name. `names` is column index complete and in order\n\t\t\t\t\t\treturn $.map( names, function (name, i) {\n\t\t\t\t\t\t\treturn name === match[1] ? i : null;\n\t\t\t\t\t\t} );\n\t\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Cell in the table body\n\t\t\tif ( s.nodeName && s._DT_CellIndex ) {\n\t\t\t\treturn [ s._DT_CellIndex.column ];\n\t\t\t}\n\t\n\t\t\t// jQuery selector on the TH elements for the columns\n\t\t\tvar jqResult = $( nodes )\n\t\t\t\t.filter( s )\n\t\t\t\t.map( function () {\n\t\t\t\t\treturn $.inArray( this, nodes ); // `nodes` is column index complete and in order\n\t\t\t\t} )\n\t\t\t\t.toArray();\n\t\n\t\t\tif ( jqResult.length || ! s.nodeName ) {\n\t\t\t\treturn jqResult;\n\t\t\t}\n\t\n\t\t\t// Otherwise a node which might have a `dt-column` data attribute, or be\n\t\t\t// a child or such an element\n\t\t\tvar host = $(s).closest('*[data-dt-column]');\n\t\t\treturn host.length ?\n\t\t\t\t[ host.data('dt-column') ] :\n\t\t\t\t[];\n\t\t};\n\t\n\t\treturn _selector_run( 'column', selector, run, settings, opts );\n\t};\n\t\n\t\n\tvar __setColumnVis = function ( settings, column, vis ) {\n\t\tvar\n\t\t\tcols = settings.aoColumns,\n\t\t\tcol  = cols[ column ],\n\t\t\tdata = settings.aoData,\n\t\t\trow, cells, i, ien, tr;\n\t\n\t\t// Get\n\t\tif ( vis === undefined ) {\n\t\t\treturn col.bVisible;\n\t\t}\n\t\n\t\t// Set\n\t\t// No change\n\t\tif ( col.bVisible === vis ) {\n\t\t\treturn;\n\t\t}\n\t\n\t\tif ( vis ) {\n\t\t\t// Insert column\n\t\t\t// Need to decide if we should use appendChild or insertBefore\n\t\t\tvar insertBefore = $.inArray( true, _pluck(cols, 'bVisible'), column+1 );\n\t\n\t\t\tfor ( i=0, ien=data.length ; i<ien ; i++ ) {\n\t\t\t\ttr = data[i].nTr;\n\t\t\t\tcells = data[i].anCells;\n\t\n\t\t\t\tif ( tr ) {\n\t\t\t\t\t// insertBefore can act like appendChild if 2nd arg is null\n\t\t\t\t\ttr.insertBefore( cells[ column ], cells[ insertBefore ] || null );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// Remove column\n\t\t\t$( _pluck( settings.aoData, 'anCells', column ) ).detach();\n\t\t}\n\t\n\t\t// Common actions\n\t\tcol.bVisible = vis;\n\t\t_fnDrawHead( settings, settings.aoHeader );\n\t\t_fnDrawHead( settings, settings.aoFooter );\n\t\n\t\t_fnSaveState( settings );\n\t};\n\t\n\t\n\t_api_register( 'columns()', function ( selector, opts ) {\n\t\t// argument shifting\n\t\tif ( selector === undefined ) {\n\t\t\tselector = '';\n\t\t}\n\t\telse if ( $.isPlainObject( selector ) ) {\n\t\t\topts = selector;\n\t\t\tselector = '';\n\t\t}\n\t\n\t\topts = _selector_opts( opts );\n\t\n\t\tvar inst = this.iterator( 'table', function ( settings ) {\n\t\t\treturn __column_selector( settings, selector, opts );\n\t\t}, 1 );\n\t\n\t\t// Want argument shifting here and in _row_selector?\n\t\tinst.selector.cols = selector;\n\t\tinst.selector.opts = opts;\n\t\n\t\treturn inst;\n\t} );\n\t\n\t_api_registerPlural( 'columns().header()', 'column().header()', function ( selector, opts ) {\n\t\treturn this.iterator( 'column', function ( settings, column ) {\n\t\t\treturn settings.aoColumns[column].nTh;\n\t\t}, 1 );\n\t} );\n\t\n\t_api_registerPlural( 'columns().footer()', 'column().footer()', function ( selector, opts ) {\n\t\treturn this.iterator( 'column', function ( settings, column ) {\n\t\t\treturn settings.aoColumns[column].nTf;\n\t\t}, 1 );\n\t} );\n\t\n\t_api_registerPlural( 'columns().data()', 'column().data()', function () {\n\t\treturn this.iterator( 'column-rows', __columnData, 1 );\n\t} );\n\t\n\t_api_registerPlural( 'columns().dataSrc()', 'column().dataSrc()', function () {\n\t\treturn this.iterator( 'column', function ( settings, column ) {\n\t\t\treturn settings.aoColumns[column].mData;\n\t\t}, 1 );\n\t} );\n\t\n\t_api_registerPlural( 'columns().cache()', 'column().cache()', function ( type ) {\n\t\treturn this.iterator( 'column-rows', function ( settings, column, i, j, rows ) {\n\t\t\treturn _pluck_order( settings.aoData, rows,\n\t\t\t\ttype === 'search' ? '_aFilterData' : '_aSortData', column\n\t\t\t);\n\t\t}, 1 );\n\t} );\n\t\n\t_api_registerPlural( 'columns().nodes()', 'column().nodes()', function () {\n\t\treturn this.iterator( 'column-rows', function ( settings, column, i, j, rows ) {\n\t\t\treturn _pluck_order( settings.aoData, rows, 'anCells', column ) ;\n\t\t}, 1 );\n\t} );\n\t\n\t_api_registerPlural( 'columns().visible()', 'column().visible()', function ( vis, calc ) {\n\t\tvar ret = this.iterator( 'column', function ( settings, column ) {\n\t\t\tif ( vis === undefined ) {\n\t\t\t\treturn settings.aoColumns[ column ].bVisible;\n\t\t\t} // else\n\t\t\t__setColumnVis( settings, column, vis );\n\t\t} );\n\t\n\t\t// Group the column visibility changes\n\t\tif ( vis !== undefined ) {\n\t\t\t// Second loop once the first is done for events\n\t\t\tthis.iterator( 'column', function ( settings, column ) {\n\t\t\t\t_fnCallbackFire( settings, null, 'column-visibility', [settings, column, vis, calc] );\n\t\t\t} );\n\t\n\t\t\tif ( calc === undefined || calc ) {\n\t\t\t\tthis.columns.adjust();\n\t\t\t}\n\t\t}\n\t\n\t\treturn ret;\n\t} );\n\t\n\t_api_registerPlural( 'columns().indexes()', 'column().index()', function ( type ) {\n\t\treturn this.iterator( 'column', function ( settings, column ) {\n\t\t\treturn type === 'visible' ?\n\t\t\t\t_fnColumnIndexToVisible( settings, column ) :\n\t\t\t\tcolumn;\n\t\t}, 1 );\n\t} );\n\t\n\t_api_register( 'columns.adjust()', function () {\n\t\treturn this.iterator( 'table', function ( settings ) {\n\t\t\t_fnAdjustColumnSizing( settings );\n\t\t}, 1 );\n\t} );\n\t\n\t_api_register( 'column.index()', function ( type, idx ) {\n\t\tif ( this.context.length !== 0 ) {\n\t\t\tvar ctx = this.context[0];\n\t\n\t\t\tif ( type === 'fromVisible' || type === 'toData' ) {\n\t\t\t\treturn _fnVisibleToColumnIndex( ctx, idx );\n\t\t\t}\n\t\t\telse if ( type === 'fromData' || type === 'toVisible' ) {\n\t\t\t\treturn _fnColumnIndexToVisible( ctx, idx );\n\t\t\t}\n\t\t}\n\t} );\n\t\n\t_api_register( 'column()', function ( selector, opts ) {\n\t\treturn _selector_first( this.columns( selector, opts ) );\n\t} );\n\t\n\t\n\t\n\tvar __cell_selector = function ( settings, selector, opts )\n\t{\n\t\tvar data = settings.aoData;\n\t\tvar rows = _selector_row_indexes( settings, opts );\n\t\tvar cells = _removeEmpty( _pluck_order( data, rows, 'anCells' ) );\n\t\tvar allCells = $( [].concat.apply([], cells) );\n\t\tvar row;\n\t\tvar columns = settings.aoColumns.length;\n\t\tvar a, i, ien, j, o, host;\n\t\n\t\tvar run = function ( s ) {\n\t\t\tvar fnSelector = typeof s === 'function';\n\t\n\t\t\tif ( s === null || s === undefined || fnSelector ) {\n\t\t\t\t// All cells and function selectors\n\t\t\t\ta = [];\n\t\n\t\t\t\tfor ( i=0, ien=rows.length ; i<ien ; i++ ) {\n\t\t\t\t\trow = rows[i];\n\t\n\t\t\t\t\tfor ( j=0 ; j<columns ; j++ ) {\n\t\t\t\t\t\to = {\n\t\t\t\t\t\t\trow: row,\n\t\t\t\t\t\t\tcolumn: j\n\t\t\t\t\t\t};\n\t\n\t\t\t\t\t\tif ( fnSelector ) {\n\t\t\t\t\t\t\t// Selector - function\n\t\t\t\t\t\t\thost = data[ row ];\n\t\n\t\t\t\t\t\t\tif ( s( o, _fnGetCellData(settings, row, j), host.anCells ? host.anCells[j] : null ) ) {\n\t\t\t\t\t\t\t\ta.push( o );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t// Selector - all\n\t\t\t\t\t\t\ta.push( o );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\treturn a;\n\t\t\t}\n\t\t\t\n\t\t\t// Selector - index\n\t\t\tif ( $.isPlainObject( s ) ) {\n\t\t\t\treturn [s];\n\t\t\t}\n\t\n\t\t\t// Selector - jQuery filtered cells\n\t\t\tvar jqResult = allCells\n\t\t\t\t.filter( s )\n\t\t\t\t.map( function (i, el) {\n\t\t\t\t\treturn { // use a new object, in case someone changes the values\n\t\t\t\t\t\trow:    el._DT_CellIndex.row,\n\t\t\t\t\t\tcolumn: el._DT_CellIndex.column\n\t \t\t\t\t};\n\t\t\t\t} )\n\t\t\t\t.toArray();\n\t\n\t\t\tif ( jqResult.length || ! s.nodeName ) {\n\t\t\t\treturn jqResult;\n\t\t\t}\n\t\n\t\t\t// Otherwise the selector is a node, and there is one last option - the\n\t\t\t// element might be a child of an element which has dt-row and dt-column\n\t\t\t// data attributes\n\t\t\thost = $(s).closest('*[data-dt-row]');\n\t\t\treturn host.length ?\n\t\t\t\t[ {\n\t\t\t\t\trow: host.data('dt-row'),\n\t\t\t\t\tcolumn: host.data('dt-column')\n\t\t\t\t} ] :\n\t\t\t\t[];\n\t\t};\n\t\n\t\treturn _selector_run( 'cell', selector, run, settings, opts );\n\t};\n\t\n\t\n\t\n\t\n\t_api_register( 'cells()', function ( rowSelector, columnSelector, opts ) {\n\t\t// Argument shifting\n\t\tif ( $.isPlainObject( rowSelector ) ) {\n\t\t\t// Indexes\n\t\t\tif ( rowSelector.row === undefined ) {\n\t\t\t\t// Selector options in first parameter\n\t\t\t\topts = rowSelector;\n\t\t\t\trowSelector = null;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Cell index objects in first parameter\n\t\t\t\topts = columnSelector;\n\t\t\t\tcolumnSelector = null;\n\t\t\t}\n\t\t}\n\t\tif ( $.isPlainObject( columnSelector ) ) {\n\t\t\topts = columnSelector;\n\t\t\tcolumnSelector = null;\n\t\t}\n\t\n\t\t// Cell selector\n\t\tif ( columnSelector === null || columnSelector === undefined ) {\n\t\t\treturn this.iterator( 'table', function ( settings ) {\n\t\t\t\treturn __cell_selector( settings, rowSelector, _selector_opts( opts ) );\n\t\t\t} );\n\t\t}\n\t\n\t\t// Row + column selector\n\t\tvar columns = this.columns( columnSelector, opts );\n\t\tvar rows = this.rows( rowSelector, opts );\n\t\tvar a, i, ien, j, jen;\n\t\n\t\tvar cells = this.iterator( 'table', function ( settings, idx ) {\n\t\t\ta = [];\n\t\n\t\t\tfor ( i=0, ien=rows[idx].length ; i<ien ; i++ ) {\n\t\t\t\tfor ( j=0, jen=columns[idx].length ; j<jen ; j++ ) {\n\t\t\t\t\ta.push( {\n\t\t\t\t\t\trow:    rows[idx][i],\n\t\t\t\t\t\tcolumn: columns[idx][j]\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn a;\n\t\t}, 1 );\n\t\n\t\t$.extend( cells.selector, {\n\t\t\tcols: columnSelector,\n\t\t\trows: rowSelector,\n\t\t\topts: opts\n\t\t} );\n\t\n\t\treturn cells;\n\t} );\n\t\n\t\n\t_api_registerPlural( 'cells().nodes()', 'cell().node()', function () {\n\t\treturn this.iterator( 'cell', function ( settings, row, column ) {\n\t\t\tvar data = settings.aoData[ row ];\n\t\n\t\t\treturn data && data.anCells ?\n\t\t\t\tdata.anCells[ column ] :\n\t\t\t\tundefined;\n\t\t}, 1 );\n\t} );\n\t\n\t\n\t_api_register( 'cells().data()', function () {\n\t\treturn this.iterator( 'cell', function ( settings, row, column ) {\n\t\t\treturn _fnGetCellData( settings, row, column );\n\t\t}, 1 );\n\t} );\n\t\n\t\n\t_api_registerPlural( 'cells().cache()', 'cell().cache()', function ( type ) {\n\t\ttype = type === 'search' ? '_aFilterData' : '_aSortData';\n\t\n\t\treturn this.iterator( 'cell', function ( settings, row, column ) {\n\t\t\treturn settings.aoData[ row ][ type ][ column ];\n\t\t}, 1 );\n\t} );\n\t\n\t\n\t_api_registerPlural( 'cells().render()', 'cell().render()', function ( type ) {\n\t\treturn this.iterator( 'cell', function ( settings, row, column ) {\n\t\t\treturn _fnGetCellData( settings, row, column, type );\n\t\t}, 1 );\n\t} );\n\t\n\t\n\t_api_registerPlural( 'cells().indexes()', 'cell().index()', function () {\n\t\treturn this.iterator( 'cell', function ( settings, row, column ) {\n\t\t\treturn {\n\t\t\t\trow: row,\n\t\t\t\tcolumn: column,\n\t\t\t\tcolumnVisible: _fnColumnIndexToVisible( settings, column )\n\t\t\t};\n\t\t}, 1 );\n\t} );\n\t\n\t\n\t_api_registerPlural( 'cells().invalidate()', 'cell().invalidate()', function ( src ) {\n\t\treturn this.iterator( 'cell', function ( settings, row, column ) {\n\t\t\t_fnInvalidate( settings, row, src, column );\n\t\t} );\n\t} );\n\t\n\t\n\t\n\t_api_register( 'cell()', function ( rowSelector, columnSelector, opts ) {\n\t\treturn _selector_first( this.cells( rowSelector, columnSelector, opts ) );\n\t} );\n\t\n\t\n\t_api_register( 'cell().data()', function ( data ) {\n\t\tvar ctx = this.context;\n\t\tvar cell = this[0];\n\t\n\t\tif ( data === undefined ) {\n\t\t\t// Get\n\t\t\treturn ctx.length && cell.length ?\n\t\t\t\t_fnGetCellData( ctx[0], cell[0].row, cell[0].column ) :\n\t\t\t\tundefined;\n\t\t}\n\t\n\t\t// Set\n\t\t_fnSetCellData( ctx[0], cell[0].row, cell[0].column, data );\n\t\t_fnInvalidate( ctx[0], cell[0].row, 'data', cell[0].column );\n\t\n\t\treturn this;\n\t} );\n\t\n\t\n\t\n\t/**\n\t * Get current ordering (sorting) that has been applied to the table.\n\t *\n\t * @returns {array} 2D array containing the sorting information for the first\n\t *   table in the current context. Each element in the parent array represents\n\t *   a column being sorted upon (i.e. multi-sorting with two columns would have\n\t *   2 inner arrays). The inner arrays may have 2 or 3 elements. The first is\n\t *   the column index that the sorting condition applies to, the second is the\n\t *   direction of the sort (`desc` or `asc`) and, optionally, the third is the\n\t *   index of the sorting order from the `column.sorting` initialisation array.\n\t *//**\n\t * Set the ordering for the table.\n\t *\n\t * @param {integer} order Column index to sort upon.\n\t * @param {string} direction Direction of the sort to be applied (`asc` or `desc`)\n\t * @returns {DataTables.Api} this\n\t *//**\n\t * Set the ordering for the table.\n\t *\n\t * @param {array} order 1D array of sorting information to be applied.\n\t * @param {array} [...] Optional additional sorting conditions\n\t * @returns {DataTables.Api} this\n\t *//**\n\t * Set the ordering for the table.\n\t *\n\t * @param {array} order 2D array of sorting information to be applied.\n\t * @returns {DataTables.Api} this\n\t */\n\t_api_register( 'order()', function ( order, dir ) {\n\t\tvar ctx = this.context;\n\t\n\t\tif ( order === undefined ) {\n\t\t\t// get\n\t\t\treturn ctx.length !== 0 ?\n\t\t\t\tctx[0].aaSorting :\n\t\t\t\tundefined;\n\t\t}\n\t\n\t\t// set\n\t\tif ( typeof order === 'number' ) {\n\t\t\t// Simple column / direction passed in\n\t\t\torder = [ [ order, dir ] ];\n\t\t}\n\t\telse if ( order.length && ! $.isArray( order[0] ) ) {\n\t\t\t// Arguments passed in (list of 1D arrays)\n\t\t\torder = Array.prototype.slice.call( arguments );\n\t\t}\n\t\t// otherwise a 2D array was passed in\n\t\n\t\treturn this.iterator( 'table', function ( settings ) {\n\t\t\tsettings.aaSorting = order.slice();\n\t\t} );\n\t} );\n\t\n\t\n\t/**\n\t * Attach a sort listener to an element for a given column\n\t *\n\t * @param {node|jQuery|string} node Identifier for the element(s) to attach the\n\t *   listener to. This can take the form of a single DOM node, a jQuery\n\t *   collection of nodes or a jQuery selector which will identify the node(s).\n\t * @param {integer} column the column that a click on this node will sort on\n\t * @param {function} [callback] callback function when sort is run\n\t * @returns {DataTables.Api} this\n\t */\n\t_api_register( 'order.listener()', function ( node, column, callback ) {\n\t\treturn this.iterator( 'table', function ( settings ) {\n\t\t\t_fnSortAttachListener( settings, node, column, callback );\n\t\t} );\n\t} );\n\t\n\t\n\t_api_register( 'order.fixed()', function ( set ) {\n\t\tif ( ! set ) {\n\t\t\tvar ctx = this.context;\n\t\t\tvar fixed = ctx.length ?\n\t\t\t\tctx[0].aaSortingFixed :\n\t\t\t\tundefined;\n\t\n\t\t\treturn $.isArray( fixed ) ?\n\t\t\t\t{ pre: fixed } :\n\t\t\t\tfixed;\n\t\t}\n\t\n\t\treturn this.iterator( 'table', function ( settings ) {\n\t\t\tsettings.aaSortingFixed = $.extend( true, {}, set );\n\t\t} );\n\t} );\n\t\n\t\n\t// Order by the selected column(s)\n\t_api_register( [\n\t\t'columns().order()',\n\t\t'column().order()'\n\t], function ( dir ) {\n\t\tvar that = this;\n\t\n\t\treturn this.iterator( 'table', function ( settings, i ) {\n\t\t\tvar sort = [];\n\t\n\t\t\t$.each( that[i], function (j, col) {\n\t\t\t\tsort.push( [ col, dir ] );\n\t\t\t} );\n\t\n\t\t\tsettings.aaSorting = sort;\n\t\t} );\n\t} );\n\t\n\t\n\t\n\t_api_register( 'search()', function ( input, regex, smart, caseInsen ) {\n\t\tvar ctx = this.context;\n\t\n\t\tif ( input === undefined ) {\n\t\t\t// get\n\t\t\treturn ctx.length !== 0 ?\n\t\t\t\tctx[0].oPreviousSearch.sSearch :\n\t\t\t\tundefined;\n\t\t}\n\t\n\t\t// set\n\t\treturn this.iterator( 'table', function ( settings ) {\n\t\t\tif ( ! settings.oFeatures.bFilter ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t_fnFilterComplete( settings, $.extend( {}, settings.oPreviousSearch, {\n\t\t\t\t\"sSearch\": input+\"\",\n\t\t\t\t\"bRegex\":  regex === null ? false : regex,\n\t\t\t\t\"bSmart\":  smart === null ? true  : smart,\n\t\t\t\t\"bCaseInsensitive\": caseInsen === null ? true : caseInsen\n\t\t\t} ), 1 );\n\t\t} );\n\t} );\n\t\n\t\n\t_api_registerPlural(\n\t\t'columns().search()',\n\t\t'column().search()',\n\t\tfunction ( input, regex, smart, caseInsen ) {\n\t\t\treturn this.iterator( 'column', function ( settings, column ) {\n\t\t\t\tvar preSearch = settings.aoPreSearchCols;\n\t\n\t\t\t\tif ( input === undefined ) {\n\t\t\t\t\t// get\n\t\t\t\t\treturn preSearch[ column ].sSearch;\n\t\t\t\t}\n\t\n\t\t\t\t// set\n\t\t\t\tif ( ! settings.oFeatures.bFilter ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\t$.extend( preSearch[ column ], {\n\t\t\t\t\t\"sSearch\": input+\"\",\n\t\t\t\t\t\"bRegex\":  regex === null ? false : regex,\n\t\t\t\t\t\"bSmart\":  smart === null ? true  : smart,\n\t\t\t\t\t\"bCaseInsensitive\": caseInsen === null ? true : caseInsen\n\t\t\t\t} );\n\t\n\t\t\t\t_fnFilterComplete( settings, settings.oPreviousSearch, 1 );\n\t\t\t} );\n\t\t}\n\t);\n\t\n\t/*\n\t * State API methods\n\t */\n\t\n\t_api_register( 'state()', function () {\n\t\treturn this.context.length ?\n\t\t\tthis.context[0].oSavedState :\n\t\t\tnull;\n\t} );\n\t\n\t\n\t_api_register( 'state.clear()', function () {\n\t\treturn this.iterator( 'table', function ( settings ) {\n\t\t\t// Save an empty object\n\t\t\tsettings.fnStateSaveCallback.call( settings.oInstance, settings, {} );\n\t\t} );\n\t} );\n\t\n\t\n\t_api_register( 'state.loaded()', function () {\n\t\treturn this.context.length ?\n\t\t\tthis.context[0].oLoadedState :\n\t\t\tnull;\n\t} );\n\t\n\t\n\t_api_register( 'state.save()', function () {\n\t\treturn this.iterator( 'table', function ( settings ) {\n\t\t\t_fnSaveState( settings );\n\t\t} );\n\t} );\n\t\n\t\n\t\n\t/**\n\t * Provide a common method for plug-ins to check the version of DataTables being\n\t * used, in order to ensure compatibility.\n\t *\n\t *  @param {string} version Version string to check for, in the format \"X.Y.Z\".\n\t *    Note that the formats \"X\" and \"X.Y\" are also acceptable.\n\t *  @returns {boolean} true if this version of DataTables is greater or equal to\n\t *    the required version, or false if this version of DataTales is not\n\t *    suitable\n\t *  @static\n\t *  @dtopt API-Static\n\t *\n\t *  @example\n\t *    alert( $.fn.dataTable.versionCheck( '1.9.0' ) );\n\t */\n\tDataTable.versionCheck = DataTable.fnVersionCheck = function( version )\n\t{\n\t\tvar aThis = DataTable.version.split('.');\n\t\tvar aThat = version.split('.');\n\t\tvar iThis, iThat;\n\t\n\t\tfor ( var i=0, iLen=aThat.length ; i<iLen ; i++ ) {\n\t\t\tiThis = parseInt( aThis[i], 10 ) || 0;\n\t\t\tiThat = parseInt( aThat[i], 10 ) || 0;\n\t\n\t\t\t// Parts are the same, keep comparing\n\t\t\tif (iThis === iThat) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\n\t\t\t// Parts are different, return immediately\n\t\t\treturn iThis > iThat;\n\t\t}\n\t\n\t\treturn true;\n\t};\n\t\n\t\n\t/**\n\t * Check if a `<table>` node is a DataTable table already or not.\n\t *\n\t *  @param {node|jquery|string} table Table node, jQuery object or jQuery\n\t *      selector for the table to test. Note that if more than more than one\n\t *      table is passed on, only the first will be checked\n\t *  @returns {boolean} true the table given is a DataTable, or false otherwise\n\t *  @static\n\t *  @dtopt API-Static\n\t *\n\t *  @example\n\t *    if ( ! $.fn.DataTable.isDataTable( '#example' ) ) {\n\t *      $('#example').dataTable();\n\t *    }\n\t */\n\tDataTable.isDataTable = DataTable.fnIsDataTable = function ( table )\n\t{\n\t\tvar t = $(table).get(0);\n\t\tvar is = false;\n\t\n\t\t$.each( DataTable.settings, function (i, o) {\n\t\t\tvar head = o.nScrollHead ? $('table', o.nScrollHead)[0] : null;\n\t\t\tvar foot = o.nScrollFoot ? $('table', o.nScrollFoot)[0] : null;\n\t\n\t\t\tif ( o.nTable === t || head === t || foot === t ) {\n\t\t\t\tis = true;\n\t\t\t}\n\t\t} );\n\t\n\t\treturn is;\n\t};\n\t\n\t\n\t/**\n\t * Get all DataTable tables that have been initialised - optionally you can\n\t * select to get only currently visible tables.\n\t *\n\t *  @param {boolean} [visible=false] Flag to indicate if you want all (default)\n\t *    or visible tables only.\n\t *  @returns {array} Array of `table` nodes (not DataTable instances) which are\n\t *    DataTables\n\t *  @static\n\t *  @dtopt API-Static\n\t *\n\t *  @example\n\t *    $.each( $.fn.dataTable.tables(true), function () {\n\t *      $(table).DataTable().columns.adjust();\n\t *    } );\n\t */\n\tDataTable.tables = DataTable.fnTables = function ( visible )\n\t{\n\t\tvar api = false;\n\t\n\t\tif ( $.isPlainObject( visible ) ) {\n\t\t\tapi = visible.api;\n\t\t\tvisible = visible.visible;\n\t\t}\n\t\n\t\tvar a = $.map( DataTable.settings, function (o) {\n\t\t\tif ( !visible || (visible && $(o.nTable).is(':visible')) ) {\n\t\t\t\treturn o.nTable;\n\t\t\t}\n\t\t} );\n\t\n\t\treturn api ?\n\t\t\tnew _Api( a ) :\n\t\t\ta;\n\t};\n\t\n\t\n\t/**\n\t * Convert from camel case parameters to Hungarian notation. This is made public\n\t * for the extensions to provide the same ability as DataTables core to accept\n\t * either the 1.9 style Hungarian notation, or the 1.10+ style camelCase\n\t * parameters.\n\t *\n\t *  @param {object} src The model object which holds all parameters that can be\n\t *    mapped.\n\t *  @param {object} user The object to convert from camel case to Hungarian.\n\t *  @param {boolean} force When set to `true`, properties which already have a\n\t *    Hungarian value in the `user` object will be overwritten. Otherwise they\n\t *    won't be.\n\t */\n\tDataTable.camelToHungarian = _fnCamelToHungarian;\n\t\n\t\n\t\n\t/**\n\t *\n\t */\n\t_api_register( '$()', function ( selector, opts ) {\n\t\tvar\n\t\t\trows   = this.rows( opts ).nodes(), // Get all rows\n\t\t\tjqRows = $(rows);\n\t\n\t\treturn $( [].concat(\n\t\t\tjqRows.filter( selector ).toArray(),\n\t\t\tjqRows.find( selector ).toArray()\n\t\t) );\n\t} );\n\t\n\t\n\t// jQuery functions to operate on the tables\n\t$.each( [ 'on', 'one', 'off' ], function (i, key) {\n\t\t_api_register( key+'()', function ( /* event, handler */ ) {\n\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\n\t\t\t// Add the `dt` namespace automatically if it isn't already present\n\t\t\tif ( ! args[0].match(/\\.dt\\b/) ) {\n\t\t\t\targs[0] += '.dt';\n\t\t\t}\n\t\n\t\t\tvar inst = $( this.tables().nodes() );\n\t\t\tinst[key].apply( inst, args );\n\t\t\treturn this;\n\t\t} );\n\t} );\n\t\n\t\n\t_api_register( 'clear()', function () {\n\t\treturn this.iterator( 'table', function ( settings ) {\n\t\t\t_fnClearTable( settings );\n\t\t} );\n\t} );\n\t\n\t\n\t_api_register( 'settings()', function () {\n\t\treturn new _Api( this.context, this.context );\n\t} );\n\t\n\t\n\t_api_register( 'init()', function () {\n\t\tvar ctx = this.context;\n\t\treturn ctx.length ? ctx[0].oInit : null;\n\t} );\n\t\n\t\n\t_api_register( 'data()', function () {\n\t\treturn this.iterator( 'table', function ( settings ) {\n\t\t\treturn _pluck( settings.aoData, '_aData' );\n\t\t} ).flatten();\n\t} );\n\t\n\t\n\t_api_register( 'destroy()', function ( remove ) {\n\t\tremove = remove || false;\n\t\n\t\treturn this.iterator( 'table', function ( settings ) {\n\t\t\tvar orig      = settings.nTableWrapper.parentNode;\n\t\t\tvar classes   = settings.oClasses;\n\t\t\tvar table     = settings.nTable;\n\t\t\tvar tbody     = settings.nTBody;\n\t\t\tvar thead     = settings.nTHead;\n\t\t\tvar tfoot     = settings.nTFoot;\n\t\t\tvar jqTable   = $(table);\n\t\t\tvar jqTbody   = $(tbody);\n\t\t\tvar jqWrapper = $(settings.nTableWrapper);\n\t\t\tvar rows      = $.map( settings.aoData, function (r) { return r.nTr; } );\n\t\t\tvar i, ien;\n\t\n\t\t\t// Flag to note that the table is currently being destroyed - no action\n\t\t\t// should be taken\n\t\t\tsettings.bDestroying = true;\n\t\n\t\t\t// Fire off the destroy callbacks for plug-ins etc\n\t\t\t_fnCallbackFire( settings, \"aoDestroyCallback\", \"destroy\", [settings] );\n\t\n\t\t\t// If not being removed from the document, make all columns visible\n\t\t\tif ( ! remove ) {\n\t\t\t\tnew _Api( settings ).columns().visible( true );\n\t\t\t}\n\t\n\t\t\t// Blitz all `DT` namespaced events (these are internal events, the\n\t\t\t// lowercase, `dt` events are user subscribed and they are responsible\n\t\t\t// for removing them\n\t\t\tjqWrapper.unbind('.DT').find(':not(tbody *)').unbind('.DT');\n\t\t\t$(window).unbind('.DT-'+settings.sInstance);\n\t\n\t\t\t// When scrolling we had to break the table up - restore it\n\t\t\tif ( table != thead.parentNode ) {\n\t\t\t\tjqTable.children('thead').detach();\n\t\t\t\tjqTable.append( thead );\n\t\t\t}\n\t\n\t\t\tif ( tfoot && table != tfoot.parentNode ) {\n\t\t\t\tjqTable.children('tfoot').detach();\n\t\t\t\tjqTable.append( tfoot );\n\t\t\t}\n\t\n\t\t\tsettings.aaSorting = [];\n\t\t\tsettings.aaSortingFixed = [];\n\t\t\t_fnSortingClasses( settings );\n\t\n\t\t\t$( rows ).removeClass( settings.asStripeClasses.join(' ') );\n\t\n\t\t\t$('th, td', thead).removeClass( classes.sSortable+' '+\n\t\t\t\tclasses.sSortableAsc+' '+classes.sSortableDesc+' '+classes.sSortableNone\n\t\t\t);\n\t\n\t\t\tif ( settings.bJUI ) {\n\t\t\t\t$('th span.'+classes.sSortIcon+ ', td span.'+classes.sSortIcon, thead).detach();\n\t\t\t\t$('th, td', thead).each( function () {\n\t\t\t\t\tvar wrapper = $('div.'+classes.sSortJUIWrapper, this);\n\t\t\t\t\t$(this).append( wrapper.contents() );\n\t\t\t\t\twrapper.detach();\n\t\t\t\t} );\n\t\t\t}\n\t\n\t\t\t// Add the TR elements back into the table in their original order\n\t\t\tjqTbody.children().detach();\n\t\t\tjqTbody.append( rows );\n\t\n\t\t\t// Remove the DataTables generated nodes, events and classes\n\t\t\tvar removedMethod = remove ? 'remove' : 'detach';\n\t\t\tjqTable[ removedMethod ]();\n\t\t\tjqWrapper[ removedMethod ]();\n\t\n\t\t\t// If we need to reattach the table to the document\n\t\t\tif ( ! remove && orig ) {\n\t\t\t\t// insertBefore acts like appendChild if !arg[1]\n\t\t\t\torig.insertBefore( table, settings.nTableReinsertBefore );\n\t\n\t\t\t\t// Restore the width of the original table - was read from the style property,\n\t\t\t\t// so we can restore directly to that\n\t\t\t\tjqTable\n\t\t\t\t\t.css( 'width', settings.sDestroyWidth )\n\t\t\t\t\t.removeClass( classes.sTable );\n\t\n\t\t\t\t// If the were originally stripe classes - then we add them back here.\n\t\t\t\t// Note this is not fool proof (for example if not all rows had stripe\n\t\t\t\t// classes - but it's a good effort without getting carried away\n\t\t\t\tien = settings.asDestroyStripes.length;\n\t\n\t\t\t\tif ( ien ) {\n\t\t\t\t\tjqTbody.children().each( function (i) {\n\t\t\t\t\t\t$(this).addClass( settings.asDestroyStripes[i % ien] );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t/* Remove the settings object from the settings array */\n\t\t\tvar idx = $.inArray( settings, DataTable.settings );\n\t\t\tif ( idx !== -1 ) {\n\t\t\t\tDataTable.settings.splice( idx, 1 );\n\t\t\t}\n\t\t} );\n\t} );\n\t\n\t\n\t// Add the `every()` method for rows, columns and cells in a compact form\n\t$.each( [ 'column', 'row', 'cell' ], function ( i, type ) {\n\t\t_api_register( type+'s().every()', function ( fn ) {\n\t\t\tvar opts = this.selector.opts;\n\t\t\tvar api = this;\n\t\n\t\t\treturn this.iterator( type, function ( settings, arg1, arg2, arg3, arg4 ) {\n\t\t\t\t// Rows and columns:\n\t\t\t\t//  arg1 - index\n\t\t\t\t//  arg2 - table counter\n\t\t\t\t//  arg3 - loop counter\n\t\t\t\t//  arg4 - undefined\n\t\t\t\t// Cells:\n\t\t\t\t//  arg1 - row index\n\t\t\t\t//  arg2 - column index\n\t\t\t\t//  arg3 - table counter\n\t\t\t\t//  arg4 - loop counter\n\t\t\t\tfn.call(\n\t\t\t\t\tapi[ type ](\n\t\t\t\t\t\targ1,\n\t\t\t\t\t\ttype==='cell' ? arg2 : opts,\n\t\t\t\t\t\ttype==='cell' ? opts : undefined\n\t\t\t\t\t),\n\t\t\t\t\targ1, arg2, arg3, arg4\n\t\t\t\t);\n\t\t\t} );\n\t\t} );\n\t} );\n\t\n\t\n\t// i18n method for extensions to be able to use the language object from the\n\t// DataTable\n\t_api_register( 'i18n()', function ( token, def, plural ) {\n\t\tvar ctx = this.context[0];\n\t\tvar resolved = _fnGetObjectDataFn( token )( ctx.oLanguage );\n\t\n\t\tif ( resolved === undefined ) {\n\t\t\tresolved = def;\n\t\t}\n\t\n\t\tif ( plural !== undefined && $.isPlainObject( resolved ) ) {\n\t\t\tresolved = resolved[ plural ] !== undefined ?\n\t\t\t\tresolved[ plural ] :\n\t\t\t\tresolved._;\n\t\t}\n\t\n\t\treturn resolved.replace( '%d', plural ); // nb: plural might be undefined,\n\t} );\n\n\t/**\n\t * Version string for plug-ins to check compatibility. Allowed format is\n\t * `a.b.c-d` where: a:int, b:int, c:int, d:string(dev|beta|alpha). `d` is used\n\t * only for non-release builds. See http://semver.org/ for more information.\n\t *  @member\n\t *  @type string\n\t *  @default Version number\n\t */\n\tDataTable.version = \"1.10.12\";\n\n\t/**\n\t * Private data store, containing all of the settings objects that are\n\t * created for the tables on a given page.\n\t *\n\t * Note that the `DataTable.settings` object is aliased to\n\t * `jQuery.fn.dataTableExt` through which it may be accessed and\n\t * manipulated, or `jQuery.fn.dataTable.settings`.\n\t *  @member\n\t *  @type array\n\t *  @default []\n\t *  @private\n\t */\n\tDataTable.settings = [];\n\n\t/**\n\t * Object models container, for the various models that DataTables has\n\t * available to it. These models define the objects that are used to hold\n\t * the active state and configuration of the table.\n\t *  @namespace\n\t */\n\tDataTable.models = {};\n\t\n\t\n\t\n\t/**\n\t * Template object for the way in which DataTables holds information about\n\t * search information for the global filter and individual column filters.\n\t *  @namespace\n\t */\n\tDataTable.models.oSearch = {\n\t\t/**\n\t\t * Flag to indicate if the filtering should be case insensitive or not\n\t\t *  @type boolean\n\t\t *  @default true\n\t\t */\n\t\t\"bCaseInsensitive\": true,\n\t\n\t\t/**\n\t\t * Applied search term\n\t\t *  @type string\n\t\t *  @default <i>Empty string</i>\n\t\t */\n\t\t\"sSearch\": \"\",\n\t\n\t\t/**\n\t\t * Flag to indicate if the search term should be interpreted as a\n\t\t * regular expression (true) or not (false) and therefore and special\n\t\t * regex characters escaped.\n\t\t *  @type boolean\n\t\t *  @default false\n\t\t */\n\t\t\"bRegex\": false,\n\t\n\t\t/**\n\t\t * Flag to indicate if DataTables is to use its smart filtering or not.\n\t\t *  @type boolean\n\t\t *  @default true\n\t\t */\n\t\t\"bSmart\": true\n\t};\n\t\n\t\n\t\n\t\n\t/**\n\t * Template object for the way in which DataTables holds information about\n\t * each individual row. This is the object format used for the settings\n\t * aoData array.\n\t *  @namespace\n\t */\n\tDataTable.models.oRow = {\n\t\t/**\n\t\t * TR element for the row\n\t\t *  @type node\n\t\t *  @default null\n\t\t */\n\t\t\"nTr\": null,\n\t\n\t\t/**\n\t\t * Array of TD elements for each row. This is null until the row has been\n\t\t * created.\n\t\t *  @type array nodes\n\t\t *  @default []\n\t\t */\n\t\t\"anCells\": null,\n\t\n\t\t/**\n\t\t * Data object from the original data source for the row. This is either\n\t\t * an array if using the traditional form of DataTables, or an object if\n\t\t * using mData options. The exact type will depend on the passed in\n\t\t * data from the data source, or will be an array if using DOM a data\n\t\t * source.\n\t\t *  @type array|object\n\t\t *  @default []\n\t\t */\n\t\t\"_aData\": [],\n\t\n\t\t/**\n\t\t * Sorting data cache - this array is ostensibly the same length as the\n\t\t * number of columns (although each index is generated only as it is\n\t\t * needed), and holds the data that is used for sorting each column in the\n\t\t * row. We do this cache generation at the start of the sort in order that\n\t\t * the formatting of the sort data need be done only once for each cell\n\t\t * per sort. This array should not be read from or written to by anything\n\t\t * other than the master sorting methods.\n\t\t *  @type array\n\t\t *  @default null\n\t\t *  @private\n\t\t */\n\t\t\"_aSortData\": null,\n\t\n\t\t/**\n\t\t * Per cell filtering data cache. As per the sort data cache, used to\n\t\t * increase the performance of the filtering in DataTables\n\t\t *  @type array\n\t\t *  @default null\n\t\t *  @private\n\t\t */\n\t\t\"_aFilterData\": null,\n\t\n\t\t/**\n\t\t * Filtering data cache. This is the same as the cell filtering cache, but\n\t\t * in this case a string rather than an array. This is easily computed with\n\t\t * a join on `_aFilterData`, but is provided as a cache so the join isn't\n\t\t * needed on every search (memory traded for performance)\n\t\t *  @type array\n\t\t *  @default null\n\t\t *  @private\n\t\t */\n\t\t\"_sFilterRow\": null,\n\t\n\t\t/**\n\t\t * Cache of the class name that DataTables has applied to the row, so we\n\t\t * can quickly look at this variable rather than needing to do a DOM check\n\t\t * on className for the nTr property.\n\t\t *  @type string\n\t\t *  @default <i>Empty string</i>\n\t\t *  @private\n\t\t */\n\t\t\"_sRowStripe\": \"\",\n\t\n\t\t/**\n\t\t * Denote if the original data source was from the DOM, or the data source\n\t\t * object. This is used for invalidating data, so DataTables can\n\t\t * automatically read data from the original source, unless uninstructed\n\t\t * otherwise.\n\t\t *  @type string\n\t\t *  @default null\n\t\t *  @private\n\t\t */\n\t\t\"src\": null,\n\t\n\t\t/**\n\t\t * Index in the aoData array. This saves an indexOf lookup when we have the\n\t\t * object, but want to know the index\n\t\t *  @type integer\n\t\t *  @default -1\n\t\t *  @private\n\t\t */\n\t\t\"idx\": -1\n\t};\n\t\n\t\n\t/**\n\t * Template object for the column information object in DataTables. This object\n\t * is held in the settings aoColumns array and contains all the information that\n\t * DataTables needs about each individual column.\n\t *\n\t * Note that this object is related to {@link DataTable.defaults.column}\n\t * but this one is the internal data store for DataTables's cache of columns.\n\t * It should NOT be manipulated outside of DataTables. Any configuration should\n\t * be done through the initialisation options.\n\t *  @namespace\n\t */\n\tDataTable.models.oColumn = {\n\t\t/**\n\t\t * Column index. This could be worked out on-the-fly with $.inArray, but it\n\t\t * is faster to just hold it as a variable\n\t\t *  @type integer\n\t\t *  @default null\n\t\t */\n\t\t\"idx\": null,\n\t\n\t\t/**\n\t\t * A list of the columns that sorting should occur on when this column\n\t\t * is sorted. That this property is an array allows multi-column sorting\n\t\t * to be defined for a column (for example first name / last name columns\n\t\t * would benefit from this). The values are integers pointing to the\n\t\t * columns to be sorted on (typically it will be a single integer pointing\n\t\t * at itself, but that doesn't need to be the case).\n\t\t *  @type array\n\t\t */\n\t\t\"aDataSort\": null,\n\t\n\t\t/**\n\t\t * Define the sorting directions that are applied to the column, in sequence\n\t\t * as the column is repeatedly sorted upon - i.e. the first value is used\n\t\t * as the sorting direction when the column if first sorted (clicked on).\n\t\t * Sort it again (click again) and it will move on to the next index.\n\t\t * Repeat until loop.\n\t\t *  @type array\n\t\t */\n\t\t\"asSorting\": null,\n\t\n\t\t/**\n\t\t * Flag to indicate if the column is searchable, and thus should be included\n\t\t * in the filtering or not.\n\t\t *  @type boolean\n\t\t */\n\t\t\"bSearchable\": null,\n\t\n\t\t/**\n\t\t * Flag to indicate if the column is sortable or not.\n\t\t *  @type boolean\n\t\t */\n\t\t\"bSortable\": null,\n\t\n\t\t/**\n\t\t * Flag to indicate if the column is currently visible in the table or not\n\t\t *  @type boolean\n\t\t */\n\t\t\"bVisible\": null,\n\t\n\t\t/**\n\t\t * Store for manual type assignment using the `column.type` option. This\n\t\t * is held in store so we can manipulate the column's `sType` property.\n\t\t *  @type string\n\t\t *  @default null\n\t\t *  @private\n\t\t */\n\t\t\"_sManualType\": null,\n\t\n\t\t/**\n\t\t * Flag to indicate if HTML5 data attributes should be used as the data\n\t\t * source for filtering or sorting. True is either are.\n\t\t *  @type boolean\n\t\t *  @default false\n\t\t *  @private\n\t\t */\n\t\t\"_bAttrSrc\": false,\n\t\n\t\t/**\n\t\t * Developer definable function that is called whenever a cell is created (Ajax source,\n\t\t * etc) or processed for input (DOM source). This can be used as a compliment to mRender\n\t\t * allowing you to modify the DOM element (add background colour for example) when the\n\t\t * element is available.\n\t\t *  @type function\n\t\t *  @param {element} nTd The TD node that has been created\n\t\t *  @param {*} sData The Data for the cell\n\t\t *  @param {array|object} oData The data for the whole row\n\t\t *  @param {int} iRow The row index for the aoData data store\n\t\t *  @default null\n\t\t */\n\t\t\"fnCreatedCell\": null,\n\t\n\t\t/**\n\t\t * Function to get data from a cell in a column. You should <b>never</b>\n\t\t * access data directly through _aData internally in DataTables - always use\n\t\t * the method attached to this property. It allows mData to function as\n\t\t * required. This function is automatically assigned by the column\n\t\t * initialisation method\n\t\t *  @type function\n\t\t *  @param {array|object} oData The data array/object for the array\n\t\t *    (i.e. aoData[]._aData)\n\t\t *  @param {string} sSpecific The specific data type you want to get -\n\t\t *    'display', 'type' 'filter' 'sort'\n\t\t *  @returns {*} The data for the cell from the given row's data\n\t\t *  @default null\n\t\t */\n\t\t\"fnGetData\": null,\n\t\n\t\t/**\n\t\t * Function to set data for a cell in the column. You should <b>never</b>\n\t\t * set the data directly to _aData internally in DataTables - always use\n\t\t * this method. It allows mData to function as required. This function\n\t\t * is automatically assigned by the column initialisation method\n\t\t *  @type function\n\t\t *  @param {array|object} oData The data array/object for the array\n\t\t *    (i.e. aoData[]._aData)\n\t\t *  @param {*} sValue Value to set\n\t\t *  @default null\n\t\t */\n\t\t\"fnSetData\": null,\n\t\n\t\t/**\n\t\t * Property to read the value for the cells in the column from the data\n\t\t * source array / object. If null, then the default content is used, if a\n\t\t * function is given then the return from the function is used.\n\t\t *  @type function|int|string|null\n\t\t *  @default null\n\t\t */\n\t\t\"mData\": null,\n\t\n\t\t/**\n\t\t * Partner property to mData which is used (only when defined) to get\n\t\t * the data - i.e. it is basically the same as mData, but without the\n\t\t * 'set' option, and also the data fed to it is the result from mData.\n\t\t * This is the rendering method to match the data method of mData.\n\t\t *  @type function|int|string|null\n\t\t *  @default null\n\t\t */\n\t\t\"mRender\": null,\n\t\n\t\t/**\n\t\t * Unique header TH/TD element for this column - this is what the sorting\n\t\t * listener is attached to (if sorting is enabled.)\n\t\t *  @type node\n\t\t *  @default null\n\t\t */\n\t\t\"nTh\": null,\n\t\n\t\t/**\n\t\t * Unique footer TH/TD element for this column (if there is one). Not used\n\t\t * in DataTables as such, but can be used for plug-ins to reference the\n\t\t * footer for each column.\n\t\t *  @type node\n\t\t *  @default null\n\t\t */\n\t\t\"nTf\": null,\n\t\n\t\t/**\n\t\t * The class to apply to all TD elements in the table's TBODY for the column\n\t\t *  @type string\n\t\t *  @default null\n\t\t */\n\t\t\"sClass\": null,\n\t\n\t\t/**\n\t\t * When DataTables calculates the column widths to assign to each column,\n\t\t * it finds the longest string in each column and then constructs a\n\t\t * temporary table and reads the widths from that. The problem with this\n\t\t * is that \"mmm\" is much wider then \"iiii\", but the latter is a longer\n\t\t * string - thus the calculation can go wrong (doing it properly and putting\n\t\t * it into an DOM object and measuring that is horribly(!) slow). Thus as\n\t\t * a \"work around\" we provide this option. It will append its value to the\n\t\t * text that is found to be the longest string for the column - i.e. padding.\n\t\t *  @type string\n\t\t */\n\t\t\"sContentPadding\": null,\n\t\n\t\t/**\n\t\t * Allows a default value to be given for a column's data, and will be used\n\t\t * whenever a null data source is encountered (this can be because mData\n\t\t * is set to null, or because the data source itself is null).\n\t\t *  @type string\n\t\t *  @default null\n\t\t */\n\t\t\"sDefaultContent\": null,\n\t\n\t\t/**\n\t\t * Name for the column, allowing reference to the column by name as well as\n\t\t * by index (needs a lookup to work by name).\n\t\t *  @type string\n\t\t */\n\t\t\"sName\": null,\n\t\n\t\t/**\n\t\t * Custom sorting data type - defines which of the available plug-ins in\n\t\t * afnSortData the custom sorting will use - if any is defined.\n\t\t *  @type string\n\t\t *  @default std\n\t\t */\n\t\t\"sSortDataType\": 'std',\n\t\n\t\t/**\n\t\t * Class to be applied to the header element when sorting on this column\n\t\t *  @type string\n\t\t *  @default null\n\t\t */\n\t\t\"sSortingClass\": null,\n\t\n\t\t/**\n\t\t * Class to be applied to the header element when sorting on this column -\n\t\t * when jQuery UI theming is used.\n\t\t *  @type string\n\t\t *  @default null\n\t\t */\n\t\t\"sSortingClassJUI\": null,\n\t\n\t\t/**\n\t\t * Title of the column - what is seen in the TH element (nTh).\n\t\t *  @type string\n\t\t */\n\t\t\"sTitle\": null,\n\t\n\t\t/**\n\t\t * Column sorting and filtering type\n\t\t *  @type string\n\t\t *  @default null\n\t\t */\n\t\t\"sType\": null,\n\t\n\t\t/**\n\t\t * Width of the column\n\t\t *  @type string\n\t\t *  @default null\n\t\t */\n\t\t\"sWidth\": null,\n\t\n\t\t/**\n\t\t * Width of the column when it was first \"encountered\"\n\t\t *  @type string\n\t\t *  @default null\n\t\t */\n\t\t\"sWidthOrig\": null\n\t};\n\t\n\t\n\t/*\n\t * Developer note: The properties of the object below are given in Hungarian\n\t * notation, that was used as the interface for DataTables prior to v1.10, however\n\t * from v1.10 onwards the primary interface is camel case. In order to avoid\n\t * breaking backwards compatibility utterly with this change, the Hungarian\n\t * version is still, internally the primary interface, but is is not documented\n\t * - hence the @name tags in each doc comment. This allows a Javascript function\n\t * to create a map from Hungarian notation to camel case (going the other direction\n\t * would require each property to be listed, which would at around 3K to the size\n\t * of DataTables, while this method is about a 0.5K hit.\n\t *\n\t * Ultimately this does pave the way for Hungarian notation to be dropped\n\t * completely, but that is a massive amount of work and will break current\n\t * installs (therefore is on-hold until v2).\n\t */\n\t\n\t/**\n\t * Initialisation options that can be given to DataTables at initialisation\n\t * time.\n\t *  @namespace\n\t */\n\tDataTable.defaults = {\n\t\t/**\n\t\t * An array of data to use for the table, passed in at initialisation which\n\t\t * will be used in preference to any data which is already in the DOM. This is\n\t\t * particularly useful for constructing tables purely in Javascript, for\n\t\t * example with a custom Ajax call.\n\t\t *  @type array\n\t\t *  @default null\n\t\t *\n\t\t *  @dtopt Option\n\t\t *  @name DataTable.defaults.data\n\t\t *\n\t\t *  @example\n\t\t *    // Using a 2D array data source\n\t\t *    $(document).ready( function () {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"data\": [\n\t\t *          ['Trident', 'Internet Explorer 4.0', 'Win 95+', 4, 'X'],\n\t\t *          ['Trident', 'Internet Explorer 5.0', 'Win 95+', 5, 'C'],\n\t\t *        ],\n\t\t *        \"columns\": [\n\t\t *          { \"title\": \"Engine\" },\n\t\t *          { \"title\": \"Browser\" },\n\t\t *          { \"title\": \"Platform\" },\n\t\t *          { \"title\": \"Version\" },\n\t\t *          { \"title\": \"Grade\" }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Using an array of objects as a data source (`data`)\n\t\t *    $(document).ready( function () {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"data\": [\n\t\t *          {\n\t\t *            \"engine\":   \"Trident\",\n\t\t *            \"browser\":  \"Internet Explorer 4.0\",\n\t\t *            \"platform\": \"Win 95+\",\n\t\t *            \"version\":  4,\n\t\t *            \"grade\":    \"X\"\n\t\t *          },\n\t\t *          {\n\t\t *            \"engine\":   \"Trident\",\n\t\t *            \"browser\":  \"Internet Explorer 5.0\",\n\t\t *            \"platform\": \"Win 95+\",\n\t\t *            \"version\":  5,\n\t\t *            \"grade\":    \"C\"\n\t\t *          }\n\t\t *        ],\n\t\t *        \"columns\": [\n\t\t *          { \"title\": \"Engine\",   \"data\": \"engine\" },\n\t\t *          { \"title\": \"Browser\",  \"data\": \"browser\" },\n\t\t *          { \"title\": \"Platform\", \"data\": \"platform\" },\n\t\t *          { \"title\": \"Version\",  \"data\": \"version\" },\n\t\t *          { \"title\": \"Grade\",    \"data\": \"grade\" }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"aaData\": null,\n\t\n\t\n\t\t/**\n\t\t * If ordering is enabled, then DataTables will perform a first pass sort on\n\t\t * initialisation. You can define which column(s) the sort is performed\n\t\t * upon, and the sorting direction, with this variable. The `sorting` array\n\t\t * should contain an array for each column to be sorted initially containing\n\t\t * the column's index and a direction string ('asc' or 'desc').\n\t\t *  @type array\n\t\t *  @default [[0,'asc']]\n\t\t *\n\t\t *  @dtopt Option\n\t\t *  @name DataTable.defaults.order\n\t\t *\n\t\t *  @example\n\t\t *    // Sort by 3rd column first, and then 4th column\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"order\": [[2,'asc'], [3,'desc']]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *    // No initial sorting\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"order\": []\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"aaSorting\": [[0,'asc']],\n\t\n\t\n\t\t/**\n\t\t * This parameter is basically identical to the `sorting` parameter, but\n\t\t * cannot be overridden by user interaction with the table. What this means\n\t\t * is that you could have a column (visible or hidden) which the sorting\n\t\t * will always be forced on first - any sorting after that (from the user)\n\t\t * will then be performed as required. This can be useful for grouping rows\n\t\t * together.\n\t\t *  @type array\n\t\t *  @default null\n\t\t *\n\t\t *  @dtopt Option\n\t\t *  @name DataTable.defaults.orderFixed\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"orderFixed\": [[0,'asc']]\n\t\t *      } );\n\t\t *    } )\n\t\t */\n\t\t\"aaSortingFixed\": [],\n\t\n\t\n\t\t/**\n\t\t * DataTables can be instructed to load data to display in the table from a\n\t\t * Ajax source. This option defines how that Ajax call is made and where to.\n\t\t *\n\t\t * The `ajax` property has three different modes of operation, depending on\n\t\t * how it is defined. These are:\n\t\t *\n\t\t * * `string` - Set the URL from where the data should be loaded from.\n\t\t * * `object` - Define properties for `jQuery.ajax`.\n\t\t * * `function` - Custom data get function\n\t\t *\n\t\t * `string`\n\t\t * --------\n\t\t *\n\t\t * As a string, the `ajax` property simply defines the URL from which\n\t\t * DataTables will load data.\n\t\t *\n\t\t * `object`\n\t\t * --------\n\t\t *\n\t\t * As an object, the parameters in the object are passed to\n\t\t * [jQuery.ajax](http://api.jquery.com/jQuery.ajax/) allowing fine control\n\t\t * of the Ajax request. DataTables has a number of default parameters which\n\t\t * you can override using this option. Please refer to the jQuery\n\t\t * documentation for a full description of the options available, although\n\t\t * the following parameters provide additional options in DataTables or\n\t\t * require special consideration:\n\t\t *\n\t\t * * `data` - As with jQuery, `data` can be provided as an object, but it\n\t\t *   can also be used as a function to manipulate the data DataTables sends\n\t\t *   to the server. The function takes a single parameter, an object of\n\t\t *   parameters with the values that DataTables has readied for sending. An\n\t\t *   object may be returned which will be merged into the DataTables\n\t\t *   defaults, or you can add the items to the object that was passed in and\n\t\t *   not return anything from the function. This supersedes `fnServerParams`\n\t\t *   from DataTables 1.9-.\n\t\t *\n\t\t * * `dataSrc` - By default DataTables will look for the property `data` (or\n\t\t *   `aaData` for compatibility with DataTables 1.9-) when obtaining data\n\t\t *   from an Ajax source or for server-side processing - this parameter\n\t\t *   allows that property to be changed. You can use Javascript dotted\n\t\t *   object notation to get a data source for multiple levels of nesting, or\n\t\t *   it my be used as a function. As a function it takes a single parameter,\n\t\t *   the JSON returned from the server, which can be manipulated as\n\t\t *   required, with the returned value being that used by DataTables as the\n\t\t *   data source for the table. This supersedes `sAjaxDataProp` from\n\t\t *   DataTables 1.9-.\n\t\t *\n\t\t * * `success` - Should not be overridden it is used internally in\n\t\t *   DataTables. To manipulate / transform the data returned by the server\n\t\t *   use `ajax.dataSrc`, or use `ajax` as a function (see below).\n\t\t *\n\t\t * `function`\n\t\t * ----------\n\t\t *\n\t\t * As a function, making the Ajax call is left up to yourself allowing\n\t\t * complete control of the Ajax request. Indeed, if desired, a method other\n\t\t * than Ajax could be used to obtain the required data, such as Web storage\n\t\t * or an AIR database.\n\t\t *\n\t\t * The function is given four parameters and no return is required. The\n\t\t * parameters are:\n\t\t *\n\t\t * 1. _object_ - Data to send to the server\n\t\t * 2. _function_ - Callback function that must be executed when the required\n\t\t *    data has been obtained. That data should be passed into the callback\n\t\t *    as the only parameter\n\t\t * 3. _object_ - DataTables settings object for the table\n\t\t *\n\t\t * Note that this supersedes `fnServerData` from DataTables 1.9-.\n\t\t *\n\t\t *  @type string|object|function\n\t\t *  @default null\n\t\t *\n\t\t *  @dtopt Option\n\t\t *  @name DataTable.defaults.ajax\n\t\t *  @since 1.10.0\n\t\t *\n\t\t * @example\n\t\t *   // Get JSON data from a file via Ajax.\n\t\t *   // Note DataTables expects data in the form `{ data: [ ...data... ] }` by default).\n\t\t *   $('#example').dataTable( {\n\t\t *     \"ajax\": \"data.json\"\n\t\t *   } );\n\t\t *\n\t\t * @example\n\t\t *   // Get JSON data from a file via Ajax, using `dataSrc` to change\n\t\t *   // `data` to `tableData` (i.e. `{ tableData: [ ...data... ] }`)\n\t\t *   $('#example').dataTable( {\n\t\t *     \"ajax\": {\n\t\t *       \"url\": \"data.json\",\n\t\t *       \"dataSrc\": \"tableData\"\n\t\t *     }\n\t\t *   } );\n\t\t *\n\t\t * @example\n\t\t *   // Get JSON data from a file via Ajax, using `dataSrc` to read data\n\t\t *   // from a plain array rather than an array in an object\n\t\t *   $('#example').dataTable( {\n\t\t *     \"ajax\": {\n\t\t *       \"url\": \"data.json\",\n\t\t *       \"dataSrc\": \"\"\n\t\t *     }\n\t\t *   } );\n\t\t *\n\t\t * @example\n\t\t *   // Manipulate the data returned from the server - add a link to data\n\t\t *   // (note this can, should, be done using `render` for the column - this\n\t\t *   // is just a simple example of how the data can be manipulated).\n\t\t *   $('#example').dataTable( {\n\t\t *     \"ajax\": {\n\t\t *       \"url\": \"data.json\",\n\t\t *       \"dataSrc\": function ( json ) {\n\t\t *         for ( var i=0, ien=json.length ; i<ien ; i++ ) {\n\t\t *           json[i][0] = '<a href=\"/message/'+json[i][0]+'>View message</a>';\n\t\t *         }\n\t\t *         return json;\n\t\t *       }\n\t\t *     }\n\t\t *   } );\n\t\t *\n\t\t * @example\n\t\t *   // Add data to the request\n\t\t *   $('#example').dataTable( {\n\t\t *     \"ajax\": {\n\t\t *       \"url\": \"data.json\",\n\t\t *       \"data\": function ( d ) {\n\t\t *         return {\n\t\t *           \"extra_search\": $('#extra').val()\n\t\t *         };\n\t\t *       }\n\t\t *     }\n\t\t *   } );\n\t\t *\n\t\t * @example\n\t\t *   // Send request as POST\n\t\t *   $('#example').dataTable( {\n\t\t *     \"ajax\": {\n\t\t *       \"url\": \"data.json\",\n\t\t *       \"type\": \"POST\"\n\t\t *     }\n\t\t *   } );\n\t\t *\n\t\t * @example\n\t\t *   // Get the data from localStorage (could interface with a form for\n\t\t *   // adding, editing and removing rows).\n\t\t *   $('#example').dataTable( {\n\t\t *     \"ajax\": function (data, callback, settings) {\n\t\t *       callback(\n\t\t *         JSON.parse( localStorage.getItem('dataTablesData') )\n\t\t *       );\n\t\t *     }\n\t\t *   } );\n\t\t */\n\t\t\"ajax\": null,\n\t\n\t\n\t\t/**\n\t\t * This parameter allows you to readily specify the entries in the length drop\n\t\t * down menu that DataTables shows when pagination is enabled. It can be\n\t\t * either a 1D array of options which will be used for both the displayed\n\t\t * option and the value, or a 2D array which will use the array in the first\n\t\t * position as the value, and the array in the second position as the\n\t\t * displayed options (useful for language strings such as 'All').\n\t\t *\n\t\t * Note that the `pageLength` property will be automatically set to the\n\t\t * first value given in this array, unless `pageLength` is also provided.\n\t\t *  @type array\n\t\t *  @default [ 10, 25, 50, 100 ]\n\t\t *\n\t\t *  @dtopt Option\n\t\t *  @name DataTable.defaults.lengthMenu\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"lengthMenu\": [[10, 25, 50, -1], [10, 25, 50, \"All\"]]\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"aLengthMenu\": [ 10, 25, 50, 100 ],\n\t\n\t\n\t\t/**\n\t\t * The `columns` option in the initialisation parameter allows you to define\n\t\t * details about the way individual columns behave. For a full list of\n\t\t * column options that can be set, please see\n\t\t * {@link DataTable.defaults.column}. Note that if you use `columns` to\n\t\t * define your columns, you must have an entry in the array for every single\n\t\t * column that you have in your table (these can be null if you don't which\n\t\t * to specify any options).\n\t\t *  @member\n\t\t *\n\t\t *  @name DataTable.defaults.column\n\t\t */\n\t\t\"aoColumns\": null,\n\t\n\t\t/**\n\t\t * Very similar to `columns`, `columnDefs` allows you to target a specific\n\t\t * column, multiple columns, or all columns, using the `targets` property of\n\t\t * each object in the array. This allows great flexibility when creating\n\t\t * tables, as the `columnDefs` arrays can be of any length, targeting the\n\t\t * columns you specifically want. `columnDefs` may use any of the column\n\t\t * options available: {@link DataTable.defaults.column}, but it _must_\n\t\t * have `targets` defined in each object in the array. Values in the `targets`\n\t\t * array may be:\n\t\t *   <ul>\n\t\t *     <li>a string - class name will be matched on the TH for the column</li>\n\t\t *     <li>0 or a positive integer - column index counting from the left</li>\n\t\t *     <li>a negative integer - column index counting from the right</li>\n\t\t *     <li>the string \"_all\" - all columns (i.e. assign a default)</li>\n\t\t *   </ul>\n\t\t *  @member\n\t\t *\n\t\t *  @name DataTable.defaults.columnDefs\n\t\t */\n\t\t\"aoColumnDefs\": null,\n\t\n\t\n\t\t/**\n\t\t * Basically the same as `search`, this parameter defines the individual column\n\t\t * filtering state at initialisation time. The array must be of the same size\n\t\t * as the number of columns, and each element be an object with the parameters\n\t\t * `search` and `escapeRegex` (the latter is optional). 'null' is also\n\t\t * accepted and the default will be used.\n\t\t *  @type array\n\t\t *  @default []\n\t\t *\n\t\t *  @dtopt Option\n\t\t *  @name DataTable.defaults.searchCols\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"searchCols\": [\n\t\t *          null,\n\t\t *          { \"search\": \"My filter\" },\n\t\t *          null,\n\t\t *          { \"search\": \"^[0-9]\", \"escapeRegex\": false }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } )\n\t\t */\n\t\t\"aoSearchCols\": [],\n\t\n\t\n\t\t/**\n\t\t * An array of CSS classes that should be applied to displayed rows. This\n\t\t * array may be of any length, and DataTables will apply each class\n\t\t * sequentially, looping when required.\n\t\t *  @type array\n\t\t *  @default null <i>Will take the values determined by the `oClasses.stripe*`\n\t\t *    options</i>\n\t\t *\n\t\t *  @dtopt Option\n\t\t *  @name DataTable.defaults.stripeClasses\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"stripeClasses\": [ 'strip1', 'strip2', 'strip3' ]\n\t\t *      } );\n\t\t *    } )\n\t\t */\n\t\t\"asStripeClasses\": null,\n\t\n\t\n\t\t/**\n\t\t * Enable or disable automatic column width calculation. This can be disabled\n\t\t * as an optimisation (it takes some time to calculate the widths) if the\n\t\t * tables widths are passed in using `columns`.\n\t\t *  @type boolean\n\t\t *  @default true\n\t\t *\n\t\t *  @dtopt Features\n\t\t *  @name DataTable.defaults.autoWidth\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function () {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"autoWidth\": false\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"bAutoWidth\": true,\n\t\n\t\n\t\t/**\n\t\t * Deferred rendering can provide DataTables with a huge speed boost when you\n\t\t * are using an Ajax or JS data source for the table. This option, when set to\n\t\t * true, will cause DataTables to defer the creation of the table elements for\n\t\t * each row until they are needed for a draw - saving a significant amount of\n\t\t * time.\n\t\t *  @type boolean\n\t\t *  @default false\n\t\t *\n\t\t *  @dtopt Features\n\t\t *  @name DataTable.defaults.deferRender\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"ajax\": \"sources/arrays.txt\",\n\t\t *        \"deferRender\": true\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"bDeferRender\": false,\n\t\n\t\n\t\t/**\n\t\t * Replace a DataTable which matches the given selector and replace it with\n\t\t * one which has the properties of the new initialisation object passed. If no\n\t\t * table matches the selector, then the new DataTable will be constructed as\n\t\t * per normal.\n\t\t *  @type boolean\n\t\t *  @default false\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @name DataTable.defaults.destroy\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"srollY\": \"200px\",\n\t\t *        \"paginate\": false\n\t\t *      } );\n\t\t *\n\t\t *      // Some time later....\n\t\t *      $('#example').dataTable( {\n\t\t *        \"filter\": false,\n\t\t *        \"destroy\": true\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"bDestroy\": false,\n\t\n\t\n\t\t/**\n\t\t * Enable or disable filtering of data. Filtering in DataTables is \"smart\" in\n\t\t * that it allows the end user to input multiple words (space separated) and\n\t\t * will match a row containing those words, even if not in the order that was\n\t\t * specified (this allow matching across multiple columns). Note that if you\n\t\t * wish to use filtering in DataTables this must remain 'true' - to remove the\n\t\t * default filtering input box and retain filtering abilities, please use\n\t\t * {@link DataTable.defaults.dom}.\n\t\t *  @type boolean\n\t\t *  @default true\n\t\t *\n\t\t *  @dtopt Features\n\t\t *  @name DataTable.defaults.searching\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function () {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"searching\": false\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"bFilter\": true,\n\t\n\t\n\t\t/**\n\t\t * Enable or disable the table information display. This shows information\n\t\t * about the data that is currently visible on the page, including information\n\t\t * about filtered data if that action is being performed.\n\t\t *  @type boolean\n\t\t *  @default true\n\t\t *\n\t\t *  @dtopt Features\n\t\t *  @name DataTable.defaults.info\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function () {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"info\": false\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"bInfo\": true,\n\t\n\t\n\t\t/**\n\t\t * Enable jQuery UI ThemeRoller support (required as ThemeRoller requires some\n\t\t * slightly different and additional mark-up from what DataTables has\n\t\t * traditionally used).\n\t\t *  @type boolean\n\t\t *  @default false\n\t\t *\n\t\t *  @dtopt Features\n\t\t *  @name DataTable.defaults.jQueryUI\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"jQueryUI\": true\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"bJQueryUI\": false,\n\t\n\t\n\t\t/**\n\t\t * Allows the end user to select the size of a formatted page from a select\n\t\t * menu (sizes are 10, 25, 50 and 100). Requires pagination (`paginate`).\n\t\t *  @type boolean\n\t\t *  @default true\n\t\t *\n\t\t *  @dtopt Features\n\t\t *  @name DataTable.defaults.lengthChange\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function () {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"lengthChange\": false\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"bLengthChange\": true,\n\t\n\t\n\t\t/**\n\t\t * Enable or disable pagination.\n\t\t *  @type boolean\n\t\t *  @default true\n\t\t *\n\t\t *  @dtopt Features\n\t\t *  @name DataTable.defaults.paging\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function () {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"paging\": false\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"bPaginate\": true,\n\t\n\t\n\t\t/**\n\t\t * Enable or disable the display of a 'processing' indicator when the table is\n\t\t * being processed (e.g. a sort). This is particularly useful for tables with\n\t\t * large amounts of data where it can take a noticeable amount of time to sort\n\t\t * the entries.\n\t\t *  @type boolean\n\t\t *  @default false\n\t\t *\n\t\t *  @dtopt Features\n\t\t *  @name DataTable.defaults.processing\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function () {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"processing\": true\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"bProcessing\": false,\n\t\n\t\n\t\t/**\n\t\t * Retrieve the DataTables object for the given selector. Note that if the\n\t\t * table has already been initialised, this parameter will cause DataTables\n\t\t * to simply return the object that has already been set up - it will not take\n\t\t * account of any changes you might have made to the initialisation object\n\t\t * passed to DataTables (setting this parameter to true is an acknowledgement\n\t\t * that you understand this). `destroy` can be used to reinitialise a table if\n\t\t * you need.\n\t\t *  @type boolean\n\t\t *  @default false\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @name DataTable.defaults.retrieve\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      initTable();\n\t\t *      tableActions();\n\t\t *    } );\n\t\t *\n\t\t *    function initTable ()\n\t\t *    {\n\t\t *      return $('#example').dataTable( {\n\t\t *        \"scrollY\": \"200px\",\n\t\t *        \"paginate\": false,\n\t\t *        \"retrieve\": true\n\t\t *      } );\n\t\t *    }\n\t\t *\n\t\t *    function tableActions ()\n\t\t *    {\n\t\t *      var table = initTable();\n\t\t *      // perform API operations with oTable\n\t\t *    }\n\t\t */\n\t\t\"bRetrieve\": false,\n\t\n\t\n\t\t/**\n\t\t * When vertical (y) scrolling is enabled, DataTables will force the height of\n\t\t * the table's viewport to the given height at all times (useful for layout).\n\t\t * However, this can look odd when filtering data down to a small data set,\n\t\t * and the footer is left \"floating\" further down. This parameter (when\n\t\t * enabled) will cause DataTables to collapse the table's viewport down when\n\t\t * the result set will fit within the given Y height.\n\t\t *  @type boolean\n\t\t *  @default false\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @name DataTable.defaults.scrollCollapse\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"scrollY\": \"200\",\n\t\t *        \"scrollCollapse\": true\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"bScrollCollapse\": false,\n\t\n\t\n\t\t/**\n\t\t * Configure DataTables to use server-side processing. Note that the\n\t\t * `ajax` parameter must also be given in order to give DataTables a\n\t\t * source to obtain the required data for each draw.\n\t\t *  @type boolean\n\t\t *  @default false\n\t\t *\n\t\t *  @dtopt Features\n\t\t *  @dtopt Server-side\n\t\t *  @name DataTable.defaults.serverSide\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function () {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"serverSide\": true,\n\t\t *        \"ajax\": \"xhr.php\"\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"bServerSide\": false,\n\t\n\t\n\t\t/**\n\t\t * Enable or disable sorting of columns. Sorting of individual columns can be\n\t\t * disabled by the `sortable` option for each column.\n\t\t *  @type boolean\n\t\t *  @default true\n\t\t *\n\t\t *  @dtopt Features\n\t\t *  @name DataTable.defaults.ordering\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function () {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"ordering\": false\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"bSort\": true,\n\t\n\t\n\t\t/**\n\t\t * Enable or display DataTables' ability to sort multiple columns at the\n\t\t * same time (activated by shift-click by the user).\n\t\t *  @type boolean\n\t\t *  @default true\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @name DataTable.defaults.orderMulti\n\t\t *\n\t\t *  @example\n\t\t *    // Disable multiple column sorting ability\n\t\t *    $(document).ready( function () {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"orderMulti\": false\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"bSortMulti\": true,\n\t\n\t\n\t\t/**\n\t\t * Allows control over whether DataTables should use the top (true) unique\n\t\t * cell that is found for a single column, or the bottom (false - default).\n\t\t * This is useful when using complex headers.\n\t\t *  @type boolean\n\t\t *  @default false\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @name DataTable.defaults.orderCellsTop\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"orderCellsTop\": true\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"bSortCellsTop\": false,\n\t\n\t\n\t\t/**\n\t\t * Enable or disable the addition of the classes `sorting\\_1`, `sorting\\_2` and\n\t\t * `sorting\\_3` to the columns which are currently being sorted on. This is\n\t\t * presented as a feature switch as it can increase processing time (while\n\t\t * classes are removed and added) so for large data sets you might want to\n\t\t * turn this off.\n\t\t *  @type boolean\n\t\t *  @default true\n\t\t *\n\t\t *  @dtopt Features\n\t\t *  @name DataTable.defaults.orderClasses\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function () {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"orderClasses\": false\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"bSortClasses\": true,\n\t\n\t\n\t\t/**\n\t\t * Enable or disable state saving. When enabled HTML5 `localStorage` will be\n\t\t * used to save table display information such as pagination information,\n\t\t * display length, filtering and sorting. As such when the end user reloads\n\t\t * the page the display display will match what thy had previously set up.\n\t\t *\n\t\t * Due to the use of `localStorage` the default state saving is not supported\n\t\t * in IE6 or 7. If state saving is required in those browsers, use\n\t\t * `stateSaveCallback` to provide a storage solution such as cookies.\n\t\t *  @type boolean\n\t\t *  @default false\n\t\t *\n\t\t *  @dtopt Features\n\t\t *  @name DataTable.defaults.stateSave\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function () {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"stateSave\": true\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"bStateSave\": false,\n\t\n\t\n\t\t/**\n\t\t * This function is called when a TR element is created (and all TD child\n\t\t * elements have been inserted), or registered if using a DOM source, allowing\n\t\t * manipulation of the TR element (adding classes etc).\n\t\t *  @type function\n\t\t *  @param {node} row \"TR\" element for the current row\n\t\t *  @param {array} data Raw data array for this row\n\t\t *  @param {int} dataIndex The index of this row in the internal aoData array\n\t\t *\n\t\t *  @dtopt Callbacks\n\t\t *  @name DataTable.defaults.createdRow\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"createdRow\": function( row, data, dataIndex ) {\n\t\t *          // Bold the grade for all 'A' grade browsers\n\t\t *          if ( data[4] == \"A\" )\n\t\t *          {\n\t\t *            $('td:eq(4)', row).html( '<b>A</b>' );\n\t\t *          }\n\t\t *        }\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"fnCreatedRow\": null,\n\t\n\t\n\t\t/**\n\t\t * This function is called on every 'draw' event, and allows you to\n\t\t * dynamically modify any aspect you want about the created DOM.\n\t\t *  @type function\n\t\t *  @param {object} settings DataTables settings object\n\t\t *\n\t\t *  @dtopt Callbacks\n\t\t *  @name DataTable.defaults.drawCallback\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"drawCallback\": function( settings ) {\n\t\t *          alert( 'DataTables has redrawn the table' );\n\t\t *        }\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"fnDrawCallback\": null,\n\t\n\t\n\t\t/**\n\t\t * Identical to fnHeaderCallback() but for the table footer this function\n\t\t * allows you to modify the table footer on every 'draw' event.\n\t\t *  @type function\n\t\t *  @param {node} foot \"TR\" element for the footer\n\t\t *  @param {array} data Full table data (as derived from the original HTML)\n\t\t *  @param {int} start Index for the current display starting point in the\n\t\t *    display array\n\t\t *  @param {int} end Index for the current display ending point in the\n\t\t *    display array\n\t\t *  @param {array int} display Index array to translate the visual position\n\t\t *    to the full data array\n\t\t *\n\t\t *  @dtopt Callbacks\n\t\t *  @name DataTable.defaults.footerCallback\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"footerCallback\": function( tfoot, data, start, end, display ) {\n\t\t *          tfoot.getElementsByTagName('th')[0].innerHTML = \"Starting index is \"+start;\n\t\t *        }\n\t\t *      } );\n\t\t *    } )\n\t\t */\n\t\t\"fnFooterCallback\": null,\n\t\n\t\n\t\t/**\n\t\t * When rendering large numbers in the information element for the table\n\t\t * (i.e. \"Showing 1 to 10 of 57 entries\") DataTables will render large numbers\n\t\t * to have a comma separator for the 'thousands' units (e.g. 1 million is\n\t\t * rendered as \"1,000,000\") to help readability for the end user. This\n\t\t * function will override the default method DataTables uses.\n\t\t *  @type function\n\t\t *  @member\n\t\t *  @param {int} toFormat number to be formatted\n\t\t *  @returns {string} formatted string for DataTables to show the number\n\t\t *\n\t\t *  @dtopt Callbacks\n\t\t *  @name DataTable.defaults.formatNumber\n\t\t *\n\t\t *  @example\n\t\t *    // Format a number using a single quote for the separator (note that\n\t\t *    // this can also be done with the language.thousands option)\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"formatNumber\": function ( toFormat ) {\n\t\t *          return toFormat.toString().replace(\n\t\t *            /\\B(?=(\\d{3})+(?!\\d))/g, \"'\"\n\t\t *          );\n\t\t *        };\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"fnFormatNumber\": function ( toFormat ) {\n\t\t\treturn toFormat.toString().replace(\n\t\t\t\t/\\B(?=(\\d{3})+(?!\\d))/g,\n\t\t\t\tthis.oLanguage.sThousands\n\t\t\t);\n\t\t},\n\t\n\t\n\t\t/**\n\t\t * This function is called on every 'draw' event, and allows you to\n\t\t * dynamically modify the header row. This can be used to calculate and\n\t\t * display useful information about the table.\n\t\t *  @type function\n\t\t *  @param {node} head \"TR\" element for the header\n\t\t *  @param {array} data Full table data (as derived from the original HTML)\n\t\t *  @param {int} start Index for the current display starting point in the\n\t\t *    display array\n\t\t *  @param {int} end Index for the current display ending point in the\n\t\t *    display array\n\t\t *  @param {array int} display Index array to translate the visual position\n\t\t *    to the full data array\n\t\t *\n\t\t *  @dtopt Callbacks\n\t\t *  @name DataTable.defaults.headerCallback\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"fheaderCallback\": function( head, data, start, end, display ) {\n\t\t *          head.getElementsByTagName('th')[0].innerHTML = \"Displaying \"+(end-start)+\" records\";\n\t\t *        }\n\t\t *      } );\n\t\t *    } )\n\t\t */\n\t\t\"fnHeaderCallback\": null,\n\t\n\t\n\t\t/**\n\t\t * The information element can be used to convey information about the current\n\t\t * state of the table. Although the internationalisation options presented by\n\t\t * DataTables are quite capable of dealing with most customisations, there may\n\t\t * be times where you wish to customise the string further. This callback\n\t\t * allows you to do exactly that.\n\t\t *  @type function\n\t\t *  @param {object} oSettings DataTables settings object\n\t\t *  @param {int} start Starting position in data for the draw\n\t\t *  @param {int} end End position in data for the draw\n\t\t *  @param {int} max Total number of rows in the table (regardless of\n\t\t *    filtering)\n\t\t *  @param {int} total Total number of rows in the data set, after filtering\n\t\t *  @param {string} pre The string that DataTables has formatted using it's\n\t\t *    own rules\n\t\t *  @returns {string} The string to be displayed in the information element.\n\t\t *\n\t\t *  @dtopt Callbacks\n\t\t *  @name DataTable.defaults.infoCallback\n\t\t *\n\t\t *  @example\n\t\t *    $('#example').dataTable( {\n\t\t *      \"infoCallback\": function( settings, start, end, max, total, pre ) {\n\t\t *        return start +\" to \"+ end;\n\t\t *      }\n\t\t *    } );\n\t\t */\n\t\t\"fnInfoCallback\": null,\n\t\n\t\n\t\t/**\n\t\t * Called when the table has been initialised. Normally DataTables will\n\t\t * initialise sequentially and there will be no need for this function,\n\t\t * however, this does not hold true when using external language information\n\t\t * since that is obtained using an async XHR call.\n\t\t *  @type function\n\t\t *  @param {object} settings DataTables settings object\n\t\t *  @param {object} json The JSON object request from the server - only\n\t\t *    present if client-side Ajax sourced data is used\n\t\t *\n\t\t *  @dtopt Callbacks\n\t\t *  @name DataTable.defaults.initComplete\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"initComplete\": function(settings, json) {\n\t\t *          alert( 'DataTables has finished its initialisation.' );\n\t\t *        }\n\t\t *      } );\n\t\t *    } )\n\t\t */\n\t\t\"fnInitComplete\": null,\n\t\n\t\n\t\t/**\n\t\t * Called at the very start of each table draw and can be used to cancel the\n\t\t * draw by returning false, any other return (including undefined) results in\n\t\t * the full draw occurring).\n\t\t *  @type function\n\t\t *  @param {object} settings DataTables settings object\n\t\t *  @returns {boolean} False will cancel the draw, anything else (including no\n\t\t *    return) will allow it to complete.\n\t\t *\n\t\t *  @dtopt Callbacks\n\t\t *  @name DataTable.defaults.preDrawCallback\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"preDrawCallback\": function( settings ) {\n\t\t *          if ( $('#test').val() == 1 ) {\n\t\t *            return false;\n\t\t *          }\n\t\t *        }\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"fnPreDrawCallback\": null,\n\t\n\t\n\t\t/**\n\t\t * This function allows you to 'post process' each row after it have been\n\t\t * generated for each table draw, but before it is rendered on screen. This\n\t\t * function might be used for setting the row class name etc.\n\t\t *  @type function\n\t\t *  @param {node} row \"TR\" element for the current row\n\t\t *  @param {array} data Raw data array for this row\n\t\t *  @param {int} displayIndex The display index for the current table draw\n\t\t *  @param {int} displayIndexFull The index of the data in the full list of\n\t\t *    rows (after filtering)\n\t\t *\n\t\t *  @dtopt Callbacks\n\t\t *  @name DataTable.defaults.rowCallback\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"rowCallback\": function( row, data, displayIndex, displayIndexFull ) {\n\t\t *          // Bold the grade for all 'A' grade browsers\n\t\t *          if ( data[4] == \"A\" ) {\n\t\t *            $('td:eq(4)', row).html( '<b>A</b>' );\n\t\t *          }\n\t\t *        }\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"fnRowCallback\": null,\n\t\n\t\n\t\t/**\n\t\t * __Deprecated__ The functionality provided by this parameter has now been\n\t\t * superseded by that provided through `ajax`, which should be used instead.\n\t\t *\n\t\t * This parameter allows you to override the default function which obtains\n\t\t * the data from the server so something more suitable for your application.\n\t\t * For example you could use POST data, or pull information from a Gears or\n\t\t * AIR database.\n\t\t *  @type function\n\t\t *  @member\n\t\t *  @param {string} source HTTP source to obtain the data from (`ajax`)\n\t\t *  @param {array} data A key/value pair object containing the data to send\n\t\t *    to the server\n\t\t *  @param {function} callback to be called on completion of the data get\n\t\t *    process that will draw the data on the page.\n\t\t *  @param {object} settings DataTables settings object\n\t\t *\n\t\t *  @dtopt Callbacks\n\t\t *  @dtopt Server-side\n\t\t *  @name DataTable.defaults.serverData\n\t\t *\n\t\t *  @deprecated 1.10. Please use `ajax` for this functionality now.\n\t\t */\n\t\t\"fnServerData\": null,\n\t\n\t\n\t\t/**\n\t\t * __Deprecated__ The functionality provided by this parameter has now been\n\t\t * superseded by that provided through `ajax`, which should be used instead.\n\t\t *\n\t\t *  It is often useful to send extra data to the server when making an Ajax\n\t\t * request - for example custom filtering information, and this callback\n\t\t * function makes it trivial to send extra information to the server. The\n\t\t * passed in parameter is the data set that has been constructed by\n\t\t * DataTables, and you can add to this or modify it as you require.\n\t\t *  @type function\n\t\t *  @param {array} data Data array (array of objects which are name/value\n\t\t *    pairs) that has been constructed by DataTables and will be sent to the\n\t\t *    server. In the case of Ajax sourced data with server-side processing\n\t\t *    this will be an empty array, for server-side processing there will be a\n\t\t *    significant number of parameters!\n\t\t *  @returns {undefined} Ensure that you modify the data array passed in,\n\t\t *    as this is passed by reference.\n\t\t *\n\t\t *  @dtopt Callbacks\n\t\t *  @dtopt Server-side\n\t\t *  @name DataTable.defaults.serverParams\n\t\t *\n\t\t *  @deprecated 1.10. Please use `ajax` for this functionality now.\n\t\t */\n\t\t\"fnServerParams\": null,\n\t\n\t\n\t\t/**\n\t\t * Load the table state. With this function you can define from where, and how, the\n\t\t * state of a table is loaded. By default DataTables will load from `localStorage`\n\t\t * but you might wish to use a server-side database or cookies.\n\t\t *  @type function\n\t\t *  @member\n\t\t *  @param {object} settings DataTables settings object\n\t\t *  @return {object} The DataTables state object to be loaded\n\t\t *\n\t\t *  @dtopt Callbacks\n\t\t *  @name DataTable.defaults.stateLoadCallback\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"stateSave\": true,\n\t\t *        \"stateLoadCallback\": function (settings) {\n\t\t *          var o;\n\t\t *\n\t\t *          // Send an Ajax request to the server to get the data. Note that\n\t\t *          // this is a synchronous request.\n\t\t *          $.ajax( {\n\t\t *            \"url\": \"/state_load\",\n\t\t *            \"async\": false,\n\t\t *            \"dataType\": \"json\",\n\t\t *            \"success\": function (json) {\n\t\t *              o = json;\n\t\t *            }\n\t\t *          } );\n\t\t *\n\t\t *          return o;\n\t\t *        }\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"fnStateLoadCallback\": function ( settings ) {\n\t\t\ttry {\n\t\t\t\treturn JSON.parse(\n\t\t\t\t\t(settings.iStateDuration === -1 ? sessionStorage : localStorage).getItem(\n\t\t\t\t\t\t'DataTables_'+settings.sInstance+'_'+location.pathname\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} catch (e) {}\n\t\t},\n\t\n\t\n\t\t/**\n\t\t * Callback which allows modification of the saved state prior to loading that state.\n\t\t * This callback is called when the table is loading state from the stored data, but\n\t\t * prior to the settings object being modified by the saved state. Note that for\n\t\t * plug-in authors, you should use the `stateLoadParams` event to load parameters for\n\t\t * a plug-in.\n\t\t *  @type function\n\t\t *  @param {object} settings DataTables settings object\n\t\t *  @param {object} data The state object that is to be loaded\n\t\t *\n\t\t *  @dtopt Callbacks\n\t\t *  @name DataTable.defaults.stateLoadParams\n\t\t *\n\t\t *  @example\n\t\t *    // Remove a saved filter, so filtering is never loaded\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"stateSave\": true,\n\t\t *        \"stateLoadParams\": function (settings, data) {\n\t\t *          data.oSearch.sSearch = \"\";\n\t\t *        }\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Disallow state loading by returning false\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"stateSave\": true,\n\t\t *        \"stateLoadParams\": function (settings, data) {\n\t\t *          return false;\n\t\t *        }\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"fnStateLoadParams\": null,\n\t\n\t\n\t\t/**\n\t\t * Callback that is called when the state has been loaded from the state saving method\n\t\t * and the DataTables settings object has been modified as a result of the loaded state.\n\t\t *  @type function\n\t\t *  @param {object} settings DataTables settings object\n\t\t *  @param {object} data The state object that was loaded\n\t\t *\n\t\t *  @dtopt Callbacks\n\t\t *  @name DataTable.defaults.stateLoaded\n\t\t *\n\t\t *  @example\n\t\t *    // Show an alert with the filtering value that was saved\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"stateSave\": true,\n\t\t *        \"stateLoaded\": function (settings, data) {\n\t\t *          alert( 'Saved filter was: '+data.oSearch.sSearch );\n\t\t *        }\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"fnStateLoaded\": null,\n\t\n\t\n\t\t/**\n\t\t * Save the table state. This function allows you to define where and how the state\n\t\t * information for the table is stored By default DataTables will use `localStorage`\n\t\t * but you might wish to use a server-side database or cookies.\n\t\t *  @type function\n\t\t *  @member\n\t\t *  @param {object} settings DataTables settings object\n\t\t *  @param {object} data The state object to be saved\n\t\t *\n\t\t *  @dtopt Callbacks\n\t\t *  @name DataTable.defaults.stateSaveCallback\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"stateSave\": true,\n\t\t *        \"stateSaveCallback\": function (settings, data) {\n\t\t *          // Send an Ajax request to the server with the state object\n\t\t *          $.ajax( {\n\t\t *            \"url\": \"/state_save\",\n\t\t *            \"data\": data,\n\t\t *            \"dataType\": \"json\",\n\t\t *            \"method\": \"POST\"\n\t\t *            \"success\": function () {}\n\t\t *          } );\n\t\t *        }\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"fnStateSaveCallback\": function ( settings, data ) {\n\t\t\ttry {\n\t\t\t\t(settings.iStateDuration === -1 ? sessionStorage : localStorage).setItem(\n\t\t\t\t\t'DataTables_'+settings.sInstance+'_'+location.pathname,\n\t\t\t\t\tJSON.stringify( data )\n\t\t\t\t);\n\t\t\t} catch (e) {}\n\t\t},\n\t\n\t\n\t\t/**\n\t\t * Callback which allows modification of the state to be saved. Called when the table\n\t\t * has changed state a new state save is required. This method allows modification of\n\t\t * the state saving object prior to actually doing the save, including addition or\n\t\t * other state properties or modification. Note that for plug-in authors, you should\n\t\t * use the `stateSaveParams` event to save parameters for a plug-in.\n\t\t *  @type function\n\t\t *  @param {object} settings DataTables settings object\n\t\t *  @param {object} data The state object to be saved\n\t\t *\n\t\t *  @dtopt Callbacks\n\t\t *  @name DataTable.defaults.stateSaveParams\n\t\t *\n\t\t *  @example\n\t\t *    // Remove a saved filter, so filtering is never saved\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"stateSave\": true,\n\t\t *        \"stateSaveParams\": function (settings, data) {\n\t\t *          data.oSearch.sSearch = \"\";\n\t\t *        }\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"fnStateSaveParams\": null,\n\t\n\t\n\t\t/**\n\t\t * Duration for which the saved state information is considered valid. After this period\n\t\t * has elapsed the state will be returned to the default.\n\t\t * Value is given in seconds.\n\t\t *  @type int\n\t\t *  @default 7200 <i>(2 hours)</i>\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @name DataTable.defaults.stateDuration\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"stateDuration\": 60*60*24; // 1 day\n\t\t *      } );\n\t\t *    } )\n\t\t */\n\t\t\"iStateDuration\": 7200,\n\t\n\t\n\t\t/**\n\t\t * When enabled DataTables will not make a request to the server for the first\n\t\t * page draw - rather it will use the data already on the page (no sorting etc\n\t\t * will be applied to it), thus saving on an XHR at load time. `deferLoading`\n\t\t * is used to indicate that deferred loading is required, but it is also used\n\t\t * to tell DataTables how many records there are in the full table (allowing\n\t\t * the information element and pagination to be displayed correctly). In the case\n\t\t * where a filtering is applied to the table on initial load, this can be\n\t\t * indicated by giving the parameter as an array, where the first element is\n\t\t * the number of records available after filtering and the second element is the\n\t\t * number of records without filtering (allowing the table information element\n\t\t * to be shown correctly).\n\t\t *  @type int | array\n\t\t *  @default null\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @name DataTable.defaults.deferLoading\n\t\t *\n\t\t *  @example\n\t\t *    // 57 records available in the table, no filtering applied\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"serverSide\": true,\n\t\t *        \"ajax\": \"scripts/server_processing.php\",\n\t\t *        \"deferLoading\": 57\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // 57 records after filtering, 100 without filtering (an initial filter applied)\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"serverSide\": true,\n\t\t *        \"ajax\": \"scripts/server_processing.php\",\n\t\t *        \"deferLoading\": [ 57, 100 ],\n\t\t *        \"search\": {\n\t\t *          \"search\": \"my_filter\"\n\t\t *        }\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"iDeferLoading\": null,\n\t\n\t\n\t\t/**\n\t\t * Number of rows to display on a single page when using pagination. If\n\t\t * feature enabled (`lengthChange`) then the end user will be able to override\n\t\t * this to a custom setting using a pop-up menu.\n\t\t *  @type int\n\t\t *  @default 10\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @name DataTable.defaults.pageLength\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"pageLength\": 50\n\t\t *      } );\n\t\t *    } )\n\t\t */\n\t\t\"iDisplayLength\": 10,\n\t\n\t\n\t\t/**\n\t\t * Define the starting point for data display when using DataTables with\n\t\t * pagination. Note that this parameter is the number of records, rather than\n\t\t * the page number, so if you have 10 records per page and want to start on\n\t\t * the third page, it should be \"20\".\n\t\t *  @type int\n\t\t *  @default 0\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @name DataTable.defaults.displayStart\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"displayStart\": 20\n\t\t *      } );\n\t\t *    } )\n\t\t */\n\t\t\"iDisplayStart\": 0,\n\t\n\t\n\t\t/**\n\t\t * By default DataTables allows keyboard navigation of the table (sorting, paging,\n\t\t * and filtering) by adding a `tabindex` attribute to the required elements. This\n\t\t * allows you to tab through the controls and press the enter key to activate them.\n\t\t * The tabindex is default 0, meaning that the tab follows the flow of the document.\n\t\t * You can overrule this using this parameter if you wish. Use a value of -1 to\n\t\t * disable built-in keyboard navigation.\n\t\t *  @type int\n\t\t *  @default 0\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @name DataTable.defaults.tabIndex\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"tabIndex\": 1\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"iTabIndex\": 0,\n\t\n\t\n\t\t/**\n\t\t * Classes that DataTables assigns to the various components and features\n\t\t * that it adds to the HTML table. This allows classes to be configured\n\t\t * during initialisation in addition to through the static\n\t\t * {@link DataTable.ext.oStdClasses} object).\n\t\t *  @namespace\n\t\t *  @name DataTable.defaults.classes\n\t\t */\n\t\t\"oClasses\": {},\n\t\n\t\n\t\t/**\n\t\t * All strings that DataTables uses in the user interface that it creates\n\t\t * are defined in this object, allowing you to modified them individually or\n\t\t * completely replace them all as required.\n\t\t *  @namespace\n\t\t *  @name DataTable.defaults.language\n\t\t */\n\t\t\"oLanguage\": {\n\t\t\t/**\n\t\t\t * Strings that are used for WAI-ARIA labels and controls only (these are not\n\t\t\t * actually visible on the page, but will be read by screenreaders, and thus\n\t\t\t * must be internationalised as well).\n\t\t\t *  @namespace\n\t\t\t *  @name DataTable.defaults.language.aria\n\t\t\t */\n\t\t\t\"oAria\": {\n\t\t\t\t/**\n\t\t\t\t * ARIA label that is added to the table headers when the column may be\n\t\t\t\t * sorted ascending by activing the column (click or return when focused).\n\t\t\t\t * Note that the column header is prefixed to this string.\n\t\t\t\t *  @type string\n\t\t\t\t *  @default : activate to sort column ascending\n\t\t\t\t *\n\t\t\t\t *  @dtopt Language\n\t\t\t\t *  @name DataTable.defaults.language.aria.sortAscending\n\t\t\t\t *\n\t\t\t\t *  @example\n\t\t\t\t *    $(document).ready( function() {\n\t\t\t\t *      $('#example').dataTable( {\n\t\t\t\t *        \"language\": {\n\t\t\t\t *          \"aria\": {\n\t\t\t\t *            \"sortAscending\": \" - click/return to sort ascending\"\n\t\t\t\t *          }\n\t\t\t\t *        }\n\t\t\t\t *      } );\n\t\t\t\t *    } );\n\t\t\t\t */\n\t\t\t\t\"sSortAscending\": \": activate to sort column ascending\",\n\t\n\t\t\t\t/**\n\t\t\t\t * ARIA label that is added to the table headers when the column may be\n\t\t\t\t * sorted descending by activing the column (click or return when focused).\n\t\t\t\t * Note that the column header is prefixed to this string.\n\t\t\t\t *  @type string\n\t\t\t\t *  @default : activate to sort column ascending\n\t\t\t\t *\n\t\t\t\t *  @dtopt Language\n\t\t\t\t *  @name DataTable.defaults.language.aria.sortDescending\n\t\t\t\t *\n\t\t\t\t *  @example\n\t\t\t\t *    $(document).ready( function() {\n\t\t\t\t *      $('#example').dataTable( {\n\t\t\t\t *        \"language\": {\n\t\t\t\t *          \"aria\": {\n\t\t\t\t *            \"sortDescending\": \" - click/return to sort descending\"\n\t\t\t\t *          }\n\t\t\t\t *        }\n\t\t\t\t *      } );\n\t\t\t\t *    } );\n\t\t\t\t */\n\t\t\t\t\"sSortDescending\": \": activate to sort column descending\"\n\t\t\t},\n\t\n\t\t\t/**\n\t\t\t * Pagination string used by DataTables for the built-in pagination\n\t\t\t * control types.\n\t\t\t *  @namespace\n\t\t\t *  @name DataTable.defaults.language.paginate\n\t\t\t */\n\t\t\t\"oPaginate\": {\n\t\t\t\t/**\n\t\t\t\t * Text to use when using the 'full_numbers' type of pagination for the\n\t\t\t\t * button to take the user to the first page.\n\t\t\t\t *  @type string\n\t\t\t\t *  @default First\n\t\t\t\t *\n\t\t\t\t *  @dtopt Language\n\t\t\t\t *  @name DataTable.defaults.language.paginate.first\n\t\t\t\t *\n\t\t\t\t *  @example\n\t\t\t\t *    $(document).ready( function() {\n\t\t\t\t *      $('#example').dataTable( {\n\t\t\t\t *        \"language\": {\n\t\t\t\t *          \"paginate\": {\n\t\t\t\t *            \"first\": \"First page\"\n\t\t\t\t *          }\n\t\t\t\t *        }\n\t\t\t\t *      } );\n\t\t\t\t *    } );\n\t\t\t\t */\n\t\t\t\t\"sFirst\": \"First\",\n\t\n\t\n\t\t\t\t/**\n\t\t\t\t * Text to use when using the 'full_numbers' type of pagination for the\n\t\t\t\t * button to take the user to the last page.\n\t\t\t\t *  @type string\n\t\t\t\t *  @default Last\n\t\t\t\t *\n\t\t\t\t *  @dtopt Language\n\t\t\t\t *  @name DataTable.defaults.language.paginate.last\n\t\t\t\t *\n\t\t\t\t *  @example\n\t\t\t\t *    $(document).ready( function() {\n\t\t\t\t *      $('#example').dataTable( {\n\t\t\t\t *        \"language\": {\n\t\t\t\t *          \"paginate\": {\n\t\t\t\t *            \"last\": \"Last page\"\n\t\t\t\t *          }\n\t\t\t\t *        }\n\t\t\t\t *      } );\n\t\t\t\t *    } );\n\t\t\t\t */\n\t\t\t\t\"sLast\": \"Last\",\n\t\n\t\n\t\t\t\t/**\n\t\t\t\t * Text to use for the 'next' pagination button (to take the user to the\n\t\t\t\t * next page).\n\t\t\t\t *  @type string\n\t\t\t\t *  @default Next\n\t\t\t\t *\n\t\t\t\t *  @dtopt Language\n\t\t\t\t *  @name DataTable.defaults.language.paginate.next\n\t\t\t\t *\n\t\t\t\t *  @example\n\t\t\t\t *    $(document).ready( function() {\n\t\t\t\t *      $('#example').dataTable( {\n\t\t\t\t *        \"language\": {\n\t\t\t\t *          \"paginate\": {\n\t\t\t\t *            \"next\": \"Next page\"\n\t\t\t\t *          }\n\t\t\t\t *        }\n\t\t\t\t *      } );\n\t\t\t\t *    } );\n\t\t\t\t */\n\t\t\t\t\"sNext\": \"Next\",\n\t\n\t\n\t\t\t\t/**\n\t\t\t\t * Text to use for the 'previous' pagination button (to take the user to\n\t\t\t\t * the previous page).\n\t\t\t\t *  @type string\n\t\t\t\t *  @default Previous\n\t\t\t\t *\n\t\t\t\t *  @dtopt Language\n\t\t\t\t *  @name DataTable.defaults.language.paginate.previous\n\t\t\t\t *\n\t\t\t\t *  @example\n\t\t\t\t *    $(document).ready( function() {\n\t\t\t\t *      $('#example').dataTable( {\n\t\t\t\t *        \"language\": {\n\t\t\t\t *          \"paginate\": {\n\t\t\t\t *            \"previous\": \"Previous page\"\n\t\t\t\t *          }\n\t\t\t\t *        }\n\t\t\t\t *      } );\n\t\t\t\t *    } );\n\t\t\t\t */\n\t\t\t\t\"sPrevious\": \"Previous\"\n\t\t\t},\n\t\n\t\t\t/**\n\t\t\t * This string is shown in preference to `zeroRecords` when the table is\n\t\t\t * empty of data (regardless of filtering). Note that this is an optional\n\t\t\t * parameter - if it is not given, the value of `zeroRecords` will be used\n\t\t\t * instead (either the default or given value).\n\t\t\t *  @type string\n\t\t\t *  @default No data available in table\n\t\t\t *\n\t\t\t *  @dtopt Language\n\t\t\t *  @name DataTable.defaults.language.emptyTable\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    $(document).ready( function() {\n\t\t\t *      $('#example').dataTable( {\n\t\t\t *        \"language\": {\n\t\t\t *          \"emptyTable\": \"No data available in table\"\n\t\t\t *        }\n\t\t\t *      } );\n\t\t\t *    } );\n\t\t\t */\n\t\t\t\"sEmptyTable\": \"No data available in table\",\n\t\n\t\n\t\t\t/**\n\t\t\t * This string gives information to the end user about the information\n\t\t\t * that is current on display on the page. The following tokens can be\n\t\t\t * used in the string and will be dynamically replaced as the table\n\t\t\t * display updates. This tokens can be placed anywhere in the string, or\n\t\t\t * removed as needed by the language requires:\n\t\t\t *\n\t\t\t * * `\\_START\\_` - Display index of the first record on the current page\n\t\t\t * * `\\_END\\_` - Display index of the last record on the current page\n\t\t\t * * `\\_TOTAL\\_` - Number of records in the table after filtering\n\t\t\t * * `\\_MAX\\_` - Number of records in the table without filtering\n\t\t\t * * `\\_PAGE\\_` - Current page number\n\t\t\t * * `\\_PAGES\\_` - Total number of pages of data in the table\n\t\t\t *\n\t\t\t *  @type string\n\t\t\t *  @default Showing _START_ to _END_ of _TOTAL_ entries\n\t\t\t *\n\t\t\t *  @dtopt Language\n\t\t\t *  @name DataTable.defaults.language.info\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    $(document).ready( function() {\n\t\t\t *      $('#example').dataTable( {\n\t\t\t *        \"language\": {\n\t\t\t *          \"info\": \"Showing page _PAGE_ of _PAGES_\"\n\t\t\t *        }\n\t\t\t *      } );\n\t\t\t *    } );\n\t\t\t */\n\t\t\t\"sInfo\": \"Showing _START_ to _END_ of _TOTAL_ entries\",\n\t\n\t\n\t\t\t/**\n\t\t\t * Display information string for when the table is empty. Typically the\n\t\t\t * format of this string should match `info`.\n\t\t\t *  @type string\n\t\t\t *  @default Showing 0 to 0 of 0 entries\n\t\t\t *\n\t\t\t *  @dtopt Language\n\t\t\t *  @name DataTable.defaults.language.infoEmpty\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    $(document).ready( function() {\n\t\t\t *      $('#example').dataTable( {\n\t\t\t *        \"language\": {\n\t\t\t *          \"infoEmpty\": \"No entries to show\"\n\t\t\t *        }\n\t\t\t *      } );\n\t\t\t *    } );\n\t\t\t */\n\t\t\t\"sInfoEmpty\": \"Showing 0 to 0 of 0 entries\",\n\t\n\t\n\t\t\t/**\n\t\t\t * When a user filters the information in a table, this string is appended\n\t\t\t * to the information (`info`) to give an idea of how strong the filtering\n\t\t\t * is. The variable _MAX_ is dynamically updated.\n\t\t\t *  @type string\n\t\t\t *  @default (filtered from _MAX_ total entries)\n\t\t\t *\n\t\t\t *  @dtopt Language\n\t\t\t *  @name DataTable.defaults.language.infoFiltered\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    $(document).ready( function() {\n\t\t\t *      $('#example').dataTable( {\n\t\t\t *        \"language\": {\n\t\t\t *          \"infoFiltered\": \" - filtering from _MAX_ records\"\n\t\t\t *        }\n\t\t\t *      } );\n\t\t\t *    } );\n\t\t\t */\n\t\t\t\"sInfoFiltered\": \"(filtered from _MAX_ total entries)\",\n\t\n\t\n\t\t\t/**\n\t\t\t * If can be useful to append extra information to the info string at times,\n\t\t\t * and this variable does exactly that. This information will be appended to\n\t\t\t * the `info` (`infoEmpty` and `infoFiltered` in whatever combination they are\n\t\t\t * being used) at all times.\n\t\t\t *  @type string\n\t\t\t *  @default <i>Empty string</i>\n\t\t\t *\n\t\t\t *  @dtopt Language\n\t\t\t *  @name DataTable.defaults.language.infoPostFix\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    $(document).ready( function() {\n\t\t\t *      $('#example').dataTable( {\n\t\t\t *        \"language\": {\n\t\t\t *          \"infoPostFix\": \"All records shown are derived from real information.\"\n\t\t\t *        }\n\t\t\t *      } );\n\t\t\t *    } );\n\t\t\t */\n\t\t\t\"sInfoPostFix\": \"\",\n\t\n\t\n\t\t\t/**\n\t\t\t * This decimal place operator is a little different from the other\n\t\t\t * language options since DataTables doesn't output floating point\n\t\t\t * numbers, so it won't ever use this for display of a number. Rather,\n\t\t\t * what this parameter does is modify the sort methods of the table so\n\t\t\t * that numbers which are in a format which has a character other than\n\t\t\t * a period (`.`) as a decimal place will be sorted numerically.\n\t\t\t *\n\t\t\t * Note that numbers with different decimal places cannot be shown in\n\t\t\t * the same table and still be sortable, the table must be consistent.\n\t\t\t * However, multiple different tables on the page can use different\n\t\t\t * decimal place characters.\n\t\t\t *  @type string\n\t\t\t *  @default \n\t\t\t *\n\t\t\t *  @dtopt Language\n\t\t\t *  @name DataTable.defaults.language.decimal\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    $(document).ready( function() {\n\t\t\t *      $('#example').dataTable( {\n\t\t\t *        \"language\": {\n\t\t\t *          \"decimal\": \",\"\n\t\t\t *          \"thousands\": \".\"\n\t\t\t *        }\n\t\t\t *      } );\n\t\t\t *    } );\n\t\t\t */\n\t\t\t\"sDecimal\": \"\",\n\t\n\t\n\t\t\t/**\n\t\t\t * DataTables has a build in number formatter (`formatNumber`) which is\n\t\t\t * used to format large numbers that are used in the table information.\n\t\t\t * By default a comma is used, but this can be trivially changed to any\n\t\t\t * character you wish with this parameter.\n\t\t\t *  @type string\n\t\t\t *  @default ,\n\t\t\t *\n\t\t\t *  @dtopt Language\n\t\t\t *  @name DataTable.defaults.language.thousands\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    $(document).ready( function() {\n\t\t\t *      $('#example').dataTable( {\n\t\t\t *        \"language\": {\n\t\t\t *          \"thousands\": \"'\"\n\t\t\t *        }\n\t\t\t *      } );\n\t\t\t *    } );\n\t\t\t */\n\t\t\t\"sThousands\": \",\",\n\t\n\t\n\t\t\t/**\n\t\t\t * Detail the action that will be taken when the drop down menu for the\n\t\t\t * pagination length option is changed. The '_MENU_' variable is replaced\n\t\t\t * with a default select list of 10, 25, 50 and 100, and can be replaced\n\t\t\t * with a custom select box if required.\n\t\t\t *  @type string\n\t\t\t *  @default Show _MENU_ entries\n\t\t\t *\n\t\t\t *  @dtopt Language\n\t\t\t *  @name DataTable.defaults.language.lengthMenu\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    // Language change only\n\t\t\t *    $(document).ready( function() {\n\t\t\t *      $('#example').dataTable( {\n\t\t\t *        \"language\": {\n\t\t\t *          \"lengthMenu\": \"Display _MENU_ records\"\n\t\t\t *        }\n\t\t\t *      } );\n\t\t\t *    } );\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    // Language and options change\n\t\t\t *    $(document).ready( function() {\n\t\t\t *      $('#example').dataTable( {\n\t\t\t *        \"language\": {\n\t\t\t *          \"lengthMenu\": 'Display <select>'+\n\t\t\t *            '<option value=\"10\">10</option>'+\n\t\t\t *            '<option value=\"20\">20</option>'+\n\t\t\t *            '<option value=\"30\">30</option>'+\n\t\t\t *            '<option value=\"40\">40</option>'+\n\t\t\t *            '<option value=\"50\">50</option>'+\n\t\t\t *            '<option value=\"-1\">All</option>'+\n\t\t\t *            '</select> records'\n\t\t\t *        }\n\t\t\t *      } );\n\t\t\t *    } );\n\t\t\t */\n\t\t\t\"sLengthMenu\": \"Show _MENU_ entries\",\n\t\n\t\n\t\t\t/**\n\t\t\t * When using Ajax sourced data and during the first draw when DataTables is\n\t\t\t * gathering the data, this message is shown in an empty row in the table to\n\t\t\t * indicate to the end user the the data is being loaded. Note that this\n\t\t\t * parameter is not used when loading data by server-side processing, just\n\t\t\t * Ajax sourced data with client-side processing.\n\t\t\t *  @type string\n\t\t\t *  @default Loading...\n\t\t\t *\n\t\t\t *  @dtopt Language\n\t\t\t *  @name DataTable.defaults.language.loadingRecords\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    $(document).ready( function() {\n\t\t\t *      $('#example').dataTable( {\n\t\t\t *        \"language\": {\n\t\t\t *          \"loadingRecords\": \"Please wait - loading...\"\n\t\t\t *        }\n\t\t\t *      } );\n\t\t\t *    } );\n\t\t\t */\n\t\t\t\"sLoadingRecords\": \"Loading...\",\n\t\n\t\n\t\t\t/**\n\t\t\t * Text which is displayed when the table is processing a user action\n\t\t\t * (usually a sort command or similar).\n\t\t\t *  @type string\n\t\t\t *  @default Processing...\n\t\t\t *\n\t\t\t *  @dtopt Language\n\t\t\t *  @name DataTable.defaults.language.processing\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    $(document).ready( function() {\n\t\t\t *      $('#example').dataTable( {\n\t\t\t *        \"language\": {\n\t\t\t *          \"processing\": \"DataTables is currently busy\"\n\t\t\t *        }\n\t\t\t *      } );\n\t\t\t *    } );\n\t\t\t */\n\t\t\t\"sProcessing\": \"Processing...\",\n\t\n\t\n\t\t\t/**\n\t\t\t * Details the actions that will be taken when the user types into the\n\t\t\t * filtering input text box. The variable \"_INPUT_\", if used in the string,\n\t\t\t * is replaced with the HTML text box for the filtering input allowing\n\t\t\t * control over where it appears in the string. If \"_INPUT_\" is not given\n\t\t\t * then the input box is appended to the string automatically.\n\t\t\t *  @type string\n\t\t\t *  @default Search:\n\t\t\t *\n\t\t\t *  @dtopt Language\n\t\t\t *  @name DataTable.defaults.language.search\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    // Input text box will be appended at the end automatically\n\t\t\t *    $(document).ready( function() {\n\t\t\t *      $('#example').dataTable( {\n\t\t\t *        \"language\": {\n\t\t\t *          \"search\": \"Filter records:\"\n\t\t\t *        }\n\t\t\t *      } );\n\t\t\t *    } );\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    // Specify where the filter should appear\n\t\t\t *    $(document).ready( function() {\n\t\t\t *      $('#example').dataTable( {\n\t\t\t *        \"language\": {\n\t\t\t *          \"search\": \"Apply filter _INPUT_ to table\"\n\t\t\t *        }\n\t\t\t *      } );\n\t\t\t *    } );\n\t\t\t */\n\t\t\t\"sSearch\": \"Search:\",\n\t\n\t\n\t\t\t/**\n\t\t\t * Assign a `placeholder` attribute to the search `input` element\n\t\t\t *  @type string\n\t\t\t *  @default \n\t\t\t *\n\t\t\t *  @dtopt Language\n\t\t\t *  @name DataTable.defaults.language.searchPlaceholder\n\t\t\t */\n\t\t\t\"sSearchPlaceholder\": \"\",\n\t\n\t\n\t\t\t/**\n\t\t\t * All of the language information can be stored in a file on the\n\t\t\t * server-side, which DataTables will look up if this parameter is passed.\n\t\t\t * It must store the URL of the language file, which is in a JSON format,\n\t\t\t * and the object has the same properties as the oLanguage object in the\n\t\t\t * initialiser object (i.e. the above parameters). Please refer to one of\n\t\t\t * the example language files to see how this works in action.\n\t\t\t *  @type string\n\t\t\t *  @default <i>Empty string - i.e. disabled</i>\n\t\t\t *\n\t\t\t *  @dtopt Language\n\t\t\t *  @name DataTable.defaults.language.url\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    $(document).ready( function() {\n\t\t\t *      $('#example').dataTable( {\n\t\t\t *        \"language\": {\n\t\t\t *          \"url\": \"http://www.sprymedia.co.uk/dataTables/lang.txt\"\n\t\t\t *        }\n\t\t\t *      } );\n\t\t\t *    } );\n\t\t\t */\n\t\t\t\"sUrl\": \"\",\n\t\n\t\n\t\t\t/**\n\t\t\t * Text shown inside the table records when the is no information to be\n\t\t\t * displayed after filtering. `emptyTable` is shown when there is simply no\n\t\t\t * information in the table at all (regardless of filtering).\n\t\t\t *  @type string\n\t\t\t *  @default No matching records found\n\t\t\t *\n\t\t\t *  @dtopt Language\n\t\t\t *  @name DataTable.defaults.language.zeroRecords\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    $(document).ready( function() {\n\t\t\t *      $('#example').dataTable( {\n\t\t\t *        \"language\": {\n\t\t\t *          \"zeroRecords\": \"No records to display\"\n\t\t\t *        }\n\t\t\t *      } );\n\t\t\t *    } );\n\t\t\t */\n\t\t\t\"sZeroRecords\": \"No matching records found\"\n\t\t},\n\t\n\t\n\t\t/**\n\t\t * This parameter allows you to have define the global filtering state at\n\t\t * initialisation time. As an object the `search` parameter must be\n\t\t * defined, but all other parameters are optional. When `regex` is true,\n\t\t * the search string will be treated as a regular expression, when false\n\t\t * (default) it will be treated as a straight string. When `smart`\n\t\t * DataTables will use it's smart filtering methods (to word match at\n\t\t * any point in the data), when false this will not be done.\n\t\t *  @namespace\n\t\t *  @extends DataTable.models.oSearch\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @name DataTable.defaults.search\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"search\": {\"search\": \"Initial search\"}\n\t\t *      } );\n\t\t *    } )\n\t\t */\n\t\t\"oSearch\": $.extend( {}, DataTable.models.oSearch ),\n\t\n\t\n\t\t/**\n\t\t * __Deprecated__ The functionality provided by this parameter has now been\n\t\t * superseded by that provided through `ajax`, which should be used instead.\n\t\t *\n\t\t * By default DataTables will look for the property `data` (or `aaData` for\n\t\t * compatibility with DataTables 1.9-) when obtaining data from an Ajax\n\t\t * source or for server-side processing - this parameter allows that\n\t\t * property to be changed. You can use Javascript dotted object notation to\n\t\t * get a data source for multiple levels of nesting.\n\t\t *  @type string\n\t\t *  @default data\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @dtopt Server-side\n\t\t *  @name DataTable.defaults.ajaxDataProp\n\t\t *\n\t\t *  @deprecated 1.10. Please use `ajax` for this functionality now.\n\t\t */\n\t\t\"sAjaxDataProp\": \"data\",\n\t\n\t\n\t\t/**\n\t\t * __Deprecated__ The functionality provided by this parameter has now been\n\t\t * superseded by that provided through `ajax`, which should be used instead.\n\t\t *\n\t\t * You can instruct DataTables to load data from an external\n\t\t * source using this parameter (use aData if you want to pass data in you\n\t\t * already have). Simply provide a url a JSON object can be obtained from.\n\t\t *  @type string\n\t\t *  @default null\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @dtopt Server-side\n\t\t *  @name DataTable.defaults.ajaxSource\n\t\t *\n\t\t *  @deprecated 1.10. Please use `ajax` for this functionality now.\n\t\t */\n\t\t\"sAjaxSource\": null,\n\t\n\t\n\t\t/**\n\t\t * This initialisation variable allows you to specify exactly where in the\n\t\t * DOM you want DataTables to inject the various controls it adds to the page\n\t\t * (for example you might want the pagination controls at the top of the\n\t\t * table). DIV elements (with or without a custom class) can also be added to\n\t\t * aid styling. The follow syntax is used:\n\t\t *   <ul>\n\t\t *     <li>The following options are allowed:\n\t\t *       <ul>\n\t\t *         <li>'l' - Length changing</li>\n\t\t *         <li>'f' - Filtering input</li>\n\t\t *         <li>'t' - The table!</li>\n\t\t *         <li>'i' - Information</li>\n\t\t *         <li>'p' - Pagination</li>\n\t\t *         <li>'r' - pRocessing</li>\n\t\t *       </ul>\n\t\t *     </li>\n\t\t *     <li>The following constants are allowed:\n\t\t *       <ul>\n\t\t *         <li>'H' - jQueryUI theme \"header\" classes ('fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix')</li>\n\t\t *         <li>'F' - jQueryUI theme \"footer\" classes ('fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix')</li>\n\t\t *       </ul>\n\t\t *     </li>\n\t\t *     <li>The following syntax is expected:\n\t\t *       <ul>\n\t\t *         <li>'&lt;' and '&gt;' - div elements</li>\n\t\t *         <li>'&lt;\"class\" and '&gt;' - div with a class</li>\n\t\t *         <li>'&lt;\"#id\" and '&gt;' - div with an ID</li>\n\t\t *       </ul>\n\t\t *     </li>\n\t\t *     <li>Examples:\n\t\t *       <ul>\n\t\t *         <li>'&lt;\"wrapper\"flipt&gt;'</li>\n\t\t *         <li>'&lt;lf&lt;t&gt;ip&gt;'</li>\n\t\t *       </ul>\n\t\t *     </li>\n\t\t *   </ul>\n\t\t *  @type string\n\t\t *  @default lfrtip <i>(when `jQueryUI` is false)</i> <b>or</b>\n\t\t *    <\"H\"lfr>t<\"F\"ip> <i>(when `jQueryUI` is true)</i>\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @name DataTable.defaults.dom\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"dom\": '&lt;\"top\"i&gt;rt&lt;\"bottom\"flp&gt;&lt;\"clear\"&gt;'\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"sDom\": \"lfrtip\",\n\t\n\t\n\t\t/**\n\t\t * Search delay option. This will throttle full table searches that use the\n\t\t * DataTables provided search input element (it does not effect calls to\n\t\t * `dt-api search()`, providing a delay before the search is made.\n\t\t *  @type integer\n\t\t *  @default 0\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @name DataTable.defaults.searchDelay\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"searchDelay\": 200\n\t\t *      } );\n\t\t *    } )\n\t\t */\n\t\t\"searchDelay\": null,\n\t\n\t\n\t\t/**\n\t\t * DataTables features four different built-in options for the buttons to\n\t\t * display for pagination control:\n\t\t *\n\t\t * * `simple` - 'Previous' and 'Next' buttons only\n\t\t * * 'simple_numbers` - 'Previous' and 'Next' buttons, plus page numbers\n\t\t * * `full` - 'First', 'Previous', 'Next' and 'Last' buttons\n\t\t * * `full_numbers` - 'First', 'Previous', 'Next' and 'Last' buttons, plus\n\t\t *   page numbers\n\t\t *  \n\t\t * Further methods can be added using {@link DataTable.ext.oPagination}.\n\t\t *  @type string\n\t\t *  @default simple_numbers\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @name DataTable.defaults.pagingType\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"pagingType\": \"full_numbers\"\n\t\t *      } );\n\t\t *    } )\n\t\t */\n\t\t\"sPaginationType\": \"simple_numbers\",\n\t\n\t\n\t\t/**\n\t\t * Enable horizontal scrolling. When a table is too wide to fit into a\n\t\t * certain layout, or you have a large number of columns in the table, you\n\t\t * can enable x-scrolling to show the table in a viewport, which can be\n\t\t * scrolled. This property can be `true` which will allow the table to\n\t\t * scroll horizontally when needed, or any CSS unit, or a number (in which\n\t\t * case it will be treated as a pixel measurement). Setting as simply `true`\n\t\t * is recommended.\n\t\t *  @type boolean|string\n\t\t *  @default <i>blank string - i.e. disabled</i>\n\t\t *\n\t\t *  @dtopt Features\n\t\t *  @name DataTable.defaults.scrollX\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"scrollX\": true,\n\t\t *        \"scrollCollapse\": true\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"sScrollX\": \"\",\n\t\n\t\n\t\t/**\n\t\t * This property can be used to force a DataTable to use more width than it\n\t\t * might otherwise do when x-scrolling is enabled. For example if you have a\n\t\t * table which requires to be well spaced, this parameter is useful for\n\t\t * \"over-sizing\" the table, and thus forcing scrolling. This property can by\n\t\t * any CSS unit, or a number (in which case it will be treated as a pixel\n\t\t * measurement).\n\t\t *  @type string\n\t\t *  @default <i>blank string - i.e. disabled</i>\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @name DataTable.defaults.scrollXInner\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"scrollX\": \"100%\",\n\t\t *        \"scrollXInner\": \"110%\"\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"sScrollXInner\": \"\",\n\t\n\t\n\t\t/**\n\t\t * Enable vertical scrolling. Vertical scrolling will constrain the DataTable\n\t\t * to the given height, and enable scrolling for any data which overflows the\n\t\t * current viewport. This can be used as an alternative to paging to display\n\t\t * a lot of data in a small area (although paging and scrolling can both be\n\t\t * enabled at the same time). This property can be any CSS unit, or a number\n\t\t * (in which case it will be treated as a pixel measurement).\n\t\t *  @type string\n\t\t *  @default <i>blank string - i.e. disabled</i>\n\t\t *\n\t\t *  @dtopt Features\n\t\t *  @name DataTable.defaults.scrollY\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"scrollY\": \"200px\",\n\t\t *        \"paginate\": false\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"sScrollY\": \"\",\n\t\n\t\n\t\t/**\n\t\t * __Deprecated__ The functionality provided by this parameter has now been\n\t\t * superseded by that provided through `ajax`, which should be used instead.\n\t\t *\n\t\t * Set the HTTP method that is used to make the Ajax call for server-side\n\t\t * processing or Ajax sourced data.\n\t\t *  @type string\n\t\t *  @default GET\n\t\t *\n\t\t *  @dtopt Options\n\t\t *  @dtopt Server-side\n\t\t *  @name DataTable.defaults.serverMethod\n\t\t *\n\t\t *  @deprecated 1.10. Please use `ajax` for this functionality now.\n\t\t */\n\t\t\"sServerMethod\": \"GET\",\n\t\n\t\n\t\t/**\n\t\t * DataTables makes use of renderers when displaying HTML elements for\n\t\t * a table. These renderers can be added or modified by plug-ins to\n\t\t * generate suitable mark-up for a site. For example the Bootstrap\n\t\t * integration plug-in for DataTables uses a paging button renderer to\n\t\t * display pagination buttons in the mark-up required by Bootstrap.\n\t\t *\n\t\t * For further information about the renderers available see\n\t\t * DataTable.ext.renderer\n\t\t *  @type string|object\n\t\t *  @default null\n\t\t *\n\t\t *  @name DataTable.defaults.renderer\n\t\t *\n\t\t */\n\t\t\"renderer\": null,\n\t\n\t\n\t\t/**\n\t\t * Set the data property name that DataTables should use to get a row's id\n\t\t * to set as the `id` property in the node.\n\t\t *  @type string\n\t\t *  @default DT_RowId\n\t\t *\n\t\t *  @name DataTable.defaults.rowId\n\t\t */\n\t\t\"rowId\": \"DT_RowId\"\n\t};\n\t\n\t_fnHungarianMap( DataTable.defaults );\n\t\n\t\n\t\n\t/*\n\t * Developer note - See note in model.defaults.js about the use of Hungarian\n\t * notation and camel case.\n\t */\n\t\n\t/**\n\t * Column options that can be given to DataTables at initialisation time.\n\t *  @namespace\n\t */\n\tDataTable.defaults.column = {\n\t\t/**\n\t\t * Define which column(s) an order will occur on for this column. This\n\t\t * allows a column's ordering to take multiple columns into account when\n\t\t * doing a sort or use the data from a different column. For example first\n\t\t * name / last name columns make sense to do a multi-column sort over the\n\t\t * two columns.\n\t\t *  @type array|int\n\t\t *  @default null <i>Takes the value of the column index automatically</i>\n\t\t *\n\t\t *  @name DataTable.defaults.column.orderData\n\t\t *  @dtopt Columns\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columnDefs`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [\n\t\t *          { \"orderData\": [ 0, 1 ], \"targets\": [ 0 ] },\n\t\t *          { \"orderData\": [ 1, 0 ], \"targets\": [ 1 ] },\n\t\t *          { \"orderData\": 2, \"targets\": [ 2 ] }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columns`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columns\": [\n\t\t *          { \"orderData\": [ 0, 1 ] },\n\t\t *          { \"orderData\": [ 1, 0 ] },\n\t\t *          { \"orderData\": 2 },\n\t\t *          null,\n\t\t *          null\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"aDataSort\": null,\n\t\t\"iDataSort\": -1,\n\t\n\t\n\t\t/**\n\t\t * You can control the default ordering direction, and even alter the\n\t\t * behaviour of the sort handler (i.e. only allow ascending ordering etc)\n\t\t * using this parameter.\n\t\t *  @type array\n\t\t *  @default [ 'asc', 'desc' ]\n\t\t *\n\t\t *  @name DataTable.defaults.column.orderSequence\n\t\t *  @dtopt Columns\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columnDefs`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [\n\t\t *          { \"orderSequence\": [ \"asc\" ], \"targets\": [ 1 ] },\n\t\t *          { \"orderSequence\": [ \"desc\", \"asc\", \"asc\" ], \"targets\": [ 2 ] },\n\t\t *          { \"orderSequence\": [ \"desc\" ], \"targets\": [ 3 ] }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columns`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columns\": [\n\t\t *          null,\n\t\t *          { \"orderSequence\": [ \"asc\" ] },\n\t\t *          { \"orderSequence\": [ \"desc\", \"asc\", \"asc\" ] },\n\t\t *          { \"orderSequence\": [ \"desc\" ] },\n\t\t *          null\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"asSorting\": [ 'asc', 'desc' ],\n\t\n\t\n\t\t/**\n\t\t * Enable or disable filtering on the data in this column.\n\t\t *  @type boolean\n\t\t *  @default true\n\t\t *\n\t\t *  @name DataTable.defaults.column.searchable\n\t\t *  @dtopt Columns\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columnDefs`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [\n\t\t *          { \"searchable\": false, \"targets\": [ 0 ] }\n\t\t *        ] } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columns`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columns\": [\n\t\t *          { \"searchable\": false },\n\t\t *          null,\n\t\t *          null,\n\t\t *          null,\n\t\t *          null\n\t\t *        ] } );\n\t\t *    } );\n\t\t */\n\t\t\"bSearchable\": true,\n\t\n\t\n\t\t/**\n\t\t * Enable or disable ordering on this column.\n\t\t *  @type boolean\n\t\t *  @default true\n\t\t *\n\t\t *  @name DataTable.defaults.column.orderable\n\t\t *  @dtopt Columns\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columnDefs`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [\n\t\t *          { \"orderable\": false, \"targets\": [ 0 ] }\n\t\t *        ] } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columns`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columns\": [\n\t\t *          { \"orderable\": false },\n\t\t *          null,\n\t\t *          null,\n\t\t *          null,\n\t\t *          null\n\t\t *        ] } );\n\t\t *    } );\n\t\t */\n\t\t\"bSortable\": true,\n\t\n\t\n\t\t/**\n\t\t * Enable or disable the display of this column.\n\t\t *  @type boolean\n\t\t *  @default true\n\t\t *\n\t\t *  @name DataTable.defaults.column.visible\n\t\t *  @dtopt Columns\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columnDefs`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [\n\t\t *          { \"visible\": false, \"targets\": [ 0 ] }\n\t\t *        ] } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columns`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columns\": [\n\t\t *          { \"visible\": false },\n\t\t *          null,\n\t\t *          null,\n\t\t *          null,\n\t\t *          null\n\t\t *        ] } );\n\t\t *    } );\n\t\t */\n\t\t\"bVisible\": true,\n\t\n\t\n\t\t/**\n\t\t * Developer definable function that is called whenever a cell is created (Ajax source,\n\t\t * etc) or processed for input (DOM source). This can be used as a compliment to mRender\n\t\t * allowing you to modify the DOM element (add background colour for example) when the\n\t\t * element is available.\n\t\t *  @type function\n\t\t *  @param {element} td The TD node that has been created\n\t\t *  @param {*} cellData The Data for the cell\n\t\t *  @param {array|object} rowData The data for the whole row\n\t\t *  @param {int} row The row index for the aoData data store\n\t\t *  @param {int} col The column index for aoColumns\n\t\t *\n\t\t *  @name DataTable.defaults.column.createdCell\n\t\t *  @dtopt Columns\n\t\t *\n\t\t *  @example\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [ {\n\t\t *          \"targets\": [3],\n\t\t *          \"createdCell\": function (td, cellData, rowData, row, col) {\n\t\t *            if ( cellData == \"1.7\" ) {\n\t\t *              $(td).css('color', 'blue')\n\t\t *            }\n\t\t *          }\n\t\t *        } ]\n\t\t *      });\n\t\t *    } );\n\t\t */\n\t\t\"fnCreatedCell\": null,\n\t\n\t\n\t\t/**\n\t\t * This parameter has been replaced by `data` in DataTables to ensure naming\n\t\t * consistency. `dataProp` can still be used, as there is backwards\n\t\t * compatibility in DataTables for this option, but it is strongly\n\t\t * recommended that you use `data` in preference to `dataProp`.\n\t\t *  @name DataTable.defaults.column.dataProp\n\t\t */\n\t\n\t\n\t\t/**\n\t\t * This property can be used to read data from any data source property,\n\t\t * including deeply nested objects / properties. `data` can be given in a\n\t\t * number of different ways which effect its behaviour:\n\t\t *\n\t\t * * `integer` - treated as an array index for the data source. This is the\n\t\t *   default that DataTables uses (incrementally increased for each column).\n\t\t * * `string` - read an object property from the data source. There are\n\t\t *   three 'special' options that can be used in the string to alter how\n\t\t *   DataTables reads the data from the source object:\n\t\t *    * `.` - Dotted Javascript notation. Just as you use a `.` in\n\t\t *      Javascript to read from nested objects, so to can the options\n\t\t *      specified in `data`. For example: `browser.version` or\n\t\t *      `browser.name`. If your object parameter name contains a period, use\n\t\t *      `\\\\` to escape it - i.e. `first\\\\.name`.\n\t\t *    * `[]` - Array notation. DataTables can automatically combine data\n\t\t *      from and array source, joining the data with the characters provided\n\t\t *      between the two brackets. For example: `name[, ]` would provide a\n\t\t *      comma-space separated list from the source array. If no characters\n\t\t *      are provided between the brackets, the original array source is\n\t\t *      returned.\n\t\t *    * `()` - Function notation. Adding `()` to the end of a parameter will\n\t\t *      execute a function of the name given. For example: `browser()` for a\n\t\t *      simple function on the data source, `browser.version()` for a\n\t\t *      function in a nested property or even `browser().version` to get an\n\t\t *      object property if the function called returns an object. Note that\n\t\t *      function notation is recommended for use in `render` rather than\n\t\t *      `data` as it is much simpler to use as a renderer.\n\t\t * * `null` - use the original data source for the row rather than plucking\n\t\t *   data directly from it. This action has effects on two other\n\t\t *   initialisation options:\n\t\t *    * `defaultContent` - When null is given as the `data` option and\n\t\t *      `defaultContent` is specified for the column, the value defined by\n\t\t *      `defaultContent` will be used for the cell.\n\t\t *    * `render` - When null is used for the `data` option and the `render`\n\t\t *      option is specified for the column, the whole data source for the\n\t\t *      row is used for the renderer.\n\t\t * * `function` - the function given will be executed whenever DataTables\n\t\t *   needs to set or get the data for a cell in the column. The function\n\t\t *   takes three parameters:\n\t\t *    * Parameters:\n\t\t *      * `{array|object}` The data source for the row\n\t\t *      * `{string}` The type call data requested - this will be 'set' when\n\t\t *        setting data or 'filter', 'display', 'type', 'sort' or undefined\n\t\t *        when gathering data. Note that when `undefined` is given for the\n\t\t *        type DataTables expects to get the raw data for the object back<\n\t\t *      * `{*}` Data to set when the second parameter is 'set'.\n\t\t *    * Return:\n\t\t *      * The return value from the function is not required when 'set' is\n\t\t *        the type of call, but otherwise the return is what will be used\n\t\t *        for the data requested.\n\t\t *\n\t\t * Note that `data` is a getter and setter option. If you just require\n\t\t * formatting of data for output, you will likely want to use `render` which\n\t\t * is simply a getter and thus simpler to use.\n\t\t *\n\t\t * Note that prior to DataTables 1.9.2 `data` was called `mDataProp`. The\n\t\t * name change reflects the flexibility of this property and is consistent\n\t\t * with the naming of mRender. If 'mDataProp' is given, then it will still\n\t\t * be used by DataTables, as it automatically maps the old name to the new\n\t\t * if required.\n\t\t *\n\t\t *  @type string|int|function|null\n\t\t *  @default null <i>Use automatically calculated column index</i>\n\t\t *\n\t\t *  @name DataTable.defaults.column.data\n\t\t *  @dtopt Columns\n\t\t *\n\t\t *  @example\n\t\t *    // Read table data from objects\n\t\t *    // JSON structure for each row:\n\t\t *    //   {\n\t\t *    //      \"engine\": {value},\n\t\t *    //      \"browser\": {value},\n\t\t *    //      \"platform\": {value},\n\t\t *    //      \"version\": {value},\n\t\t *    //      \"grade\": {value}\n\t\t *    //   }\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"ajaxSource\": \"sources/objects.txt\",\n\t\t *        \"columns\": [\n\t\t *          { \"data\": \"engine\" },\n\t\t *          { \"data\": \"browser\" },\n\t\t *          { \"data\": \"platform\" },\n\t\t *          { \"data\": \"version\" },\n\t\t *          { \"data\": \"grade\" }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Read information from deeply nested objects\n\t\t *    // JSON structure for each row:\n\t\t *    //   {\n\t\t *    //      \"engine\": {value},\n\t\t *    //      \"browser\": {value},\n\t\t *    //      \"platform\": {\n\t\t *    //         \"inner\": {value}\n\t\t *    //      },\n\t\t *    //      \"details\": [\n\t\t *    //         {value}, {value}\n\t\t *    //      ]\n\t\t *    //   }\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"ajaxSource\": \"sources/deep.txt\",\n\t\t *        \"columns\": [\n\t\t *          { \"data\": \"engine\" },\n\t\t *          { \"data\": \"browser\" },\n\t\t *          { \"data\": \"platform.inner\" },\n\t\t *          { \"data\": \"platform.details.0\" },\n\t\t *          { \"data\": \"platform.details.1\" }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Using `data` as a function to provide different information for\n\t\t *    // sorting, filtering and display. In this case, currency (price)\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [ {\n\t\t *          \"targets\": [ 0 ],\n\t\t *          \"data\": function ( source, type, val ) {\n\t\t *            if (type === 'set') {\n\t\t *              source.price = val;\n\t\t *              // Store the computed dislay and filter values for efficiency\n\t\t *              source.price_display = val==\"\" ? \"\" : \"$\"+numberFormat(val);\n\t\t *              source.price_filter  = val==\"\" ? \"\" : \"$\"+numberFormat(val)+\" \"+val;\n\t\t *              return;\n\t\t *            }\n\t\t *            else if (type === 'display') {\n\t\t *              return source.price_display;\n\t\t *            }\n\t\t *            else if (type === 'filter') {\n\t\t *              return source.price_filter;\n\t\t *            }\n\t\t *            // 'sort', 'type' and undefined all just use the integer\n\t\t *            return source.price;\n\t\t *          }\n\t\t *        } ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Using default content\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [ {\n\t\t *          \"targets\": [ 0 ],\n\t\t *          \"data\": null,\n\t\t *          \"defaultContent\": \"Click to edit\"\n\t\t *        } ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Using array notation - outputting a list from an array\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [ {\n\t\t *          \"targets\": [ 0 ],\n\t\t *          \"data\": \"name[, ]\"\n\t\t *        } ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t */\n\t\t\"mData\": null,\n\t\n\t\n\t\t/**\n\t\t * This property is the rendering partner to `data` and it is suggested that\n\t\t * when you want to manipulate data for display (including filtering,\n\t\t * sorting etc) without altering the underlying data for the table, use this\n\t\t * property. `render` can be considered to be the the read only companion to\n\t\t * `data` which is read / write (then as such more complex). Like `data`\n\t\t * this option can be given in a number of different ways to effect its\n\t\t * behaviour:\n\t\t *\n\t\t * * `integer` - treated as an array index for the data source. This is the\n\t\t *   default that DataTables uses (incrementally increased for each column).\n\t\t * * `string` - read an object property from the data source. There are\n\t\t *   three 'special' options that can be used in the string to alter how\n\t\t *   DataTables reads the data from the source object:\n\t\t *    * `.` - Dotted Javascript notation. Just as you use a `.` in\n\t\t *      Javascript to read from nested objects, so to can the options\n\t\t *      specified in `data`. For example: `browser.version` or\n\t\t *      `browser.name`. If your object parameter name contains a period, use\n\t\t *      `\\\\` to escape it - i.e. `first\\\\.name`.\n\t\t *    * `[]` - Array notation. DataTables can automatically combine data\n\t\t *      from and array source, joining the data with the characters provided\n\t\t *      between the two brackets. For example: `name[, ]` would provide a\n\t\t *      comma-space separated list from the source array. If no characters\n\t\t *      are provided between the brackets, the original array source is\n\t\t *      returned.\n\t\t *    * `()` - Function notation. Adding `()` to the end of a parameter will\n\t\t *      execute a function of the name given. For example: `browser()` for a\n\t\t *      simple function on the data source, `browser.version()` for a\n\t\t *      function in a nested property or even `browser().version` to get an\n\t\t *      object property if the function called returns an object.\n\t\t * * `object` - use different data for the different data types requested by\n\t\t *   DataTables ('filter', 'display', 'type' or 'sort'). The property names\n\t\t *   of the object is the data type the property refers to and the value can\n\t\t *   defined using an integer, string or function using the same rules as\n\t\t *   `render` normally does. Note that an `_` option _must_ be specified.\n\t\t *   This is the default value to use if you haven't specified a value for\n\t\t *   the data type requested by DataTables.\n\t\t * * `function` - the function given will be executed whenever DataTables\n\t\t *   needs to set or get the data for a cell in the column. The function\n\t\t *   takes three parameters:\n\t\t *    * Parameters:\n\t\t *      * {array|object} The data source for the row (based on `data`)\n\t\t *      * {string} The type call data requested - this will be 'filter',\n\t\t *        'display', 'type' or 'sort'.\n\t\t *      * {array|object} The full data source for the row (not based on\n\t\t *        `data`)\n\t\t *    * Return:\n\t\t *      * The return value from the function is what will be used for the\n\t\t *        data requested.\n\t\t *\n\t\t *  @type string|int|function|object|null\n\t\t *  @default null Use the data source value.\n\t\t *\n\t\t *  @name DataTable.defaults.column.render\n\t\t *  @dtopt Columns\n\t\t *\n\t\t *  @example\n\t\t *    // Create a comma separated list from an array of objects\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"ajaxSource\": \"sources/deep.txt\",\n\t\t *        \"columns\": [\n\t\t *          { \"data\": \"engine\" },\n\t\t *          { \"data\": \"browser\" },\n\t\t *          {\n\t\t *            \"data\": \"platform\",\n\t\t *            \"render\": \"[, ].name\"\n\t\t *          }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Execute a function to obtain data\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [ {\n\t\t *          \"targets\": [ 0 ],\n\t\t *          \"data\": null, // Use the full data source object for the renderer's source\n\t\t *          \"render\": \"browserName()\"\n\t\t *        } ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // As an object, extracting different data for the different types\n\t\t *    // This would be used with a data source such as:\n\t\t *    //   { \"phone\": 5552368, \"phone_filter\": \"5552368 555-2368\", \"phone_display\": \"555-2368\" }\n\t\t *    // Here the `phone` integer is used for sorting and type detection, while `phone_filter`\n\t\t *    // (which has both forms) is used for filtering for if a user inputs either format, while\n\t\t *    // the formatted phone number is the one that is shown in the table.\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [ {\n\t\t *          \"targets\": [ 0 ],\n\t\t *          \"data\": null, // Use the full data source object for the renderer's source\n\t\t *          \"render\": {\n\t\t *            \"_\": \"phone\",\n\t\t *            \"filter\": \"phone_filter\",\n\t\t *            \"display\": \"phone_display\"\n\t\t *          }\n\t\t *        } ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Use as a function to create a link from the data source\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [ {\n\t\t *          \"targets\": [ 0 ],\n\t\t *          \"data\": \"download_link\",\n\t\t *          \"render\": function ( data, type, full ) {\n\t\t *            return '<a href=\"'+data+'\">Download</a>';\n\t\t *          }\n\t\t *        } ]\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"mRender\": null,\n\t\n\t\n\t\t/**\n\t\t * Change the cell type created for the column - either TD cells or TH cells. This\n\t\t * can be useful as TH cells have semantic meaning in the table body, allowing them\n\t\t * to act as a header for a row (you may wish to add scope='row' to the TH elements).\n\t\t *  @type string\n\t\t *  @default td\n\t\t *\n\t\t *  @name DataTable.defaults.column.cellType\n\t\t *  @dtopt Columns\n\t\t *\n\t\t *  @example\n\t\t *    // Make the first column use TH cells\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [ {\n\t\t *          \"targets\": [ 0 ],\n\t\t *          \"cellType\": \"th\"\n\t\t *        } ]\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"sCellType\": \"td\",\n\t\n\t\n\t\t/**\n\t\t * Class to give to each cell in this column.\n\t\t *  @type string\n\t\t *  @default <i>Empty string</i>\n\t\t *\n\t\t *  @name DataTable.defaults.column.class\n\t\t *  @dtopt Columns\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columnDefs`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [\n\t\t *          { \"class\": \"my_class\", \"targets\": [ 0 ] }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columns`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columns\": [\n\t\t *          { \"class\": \"my_class\" },\n\t\t *          null,\n\t\t *          null,\n\t\t *          null,\n\t\t *          null\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"sClass\": \"\",\n\t\n\t\t/**\n\t\t * When DataTables calculates the column widths to assign to each column,\n\t\t * it finds the longest string in each column and then constructs a\n\t\t * temporary table and reads the widths from that. The problem with this\n\t\t * is that \"mmm\" is much wider then \"iiii\", but the latter is a longer\n\t\t * string - thus the calculation can go wrong (doing it properly and putting\n\t\t * it into an DOM object and measuring that is horribly(!) slow). Thus as\n\t\t * a \"work around\" we provide this option. It will append its value to the\n\t\t * text that is found to be the longest string for the column - i.e. padding.\n\t\t * Generally you shouldn't need this!\n\t\t *  @type string\n\t\t *  @default <i>Empty string<i>\n\t\t *\n\t\t *  @name DataTable.defaults.column.contentPadding\n\t\t *  @dtopt Columns\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columns`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columns\": [\n\t\t *          null,\n\t\t *          null,\n\t\t *          null,\n\t\t *          {\n\t\t *            \"contentPadding\": \"mmm\"\n\t\t *          }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"sContentPadding\": \"\",\n\t\n\t\n\t\t/**\n\t\t * Allows a default value to be given for a column's data, and will be used\n\t\t * whenever a null data source is encountered (this can be because `data`\n\t\t * is set to null, or because the data source itself is null).\n\t\t *  @type string\n\t\t *  @default null\n\t\t *\n\t\t *  @name DataTable.defaults.column.defaultContent\n\t\t *  @dtopt Columns\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columnDefs`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [\n\t\t *          {\n\t\t *            \"data\": null,\n\t\t *            \"defaultContent\": \"Edit\",\n\t\t *            \"targets\": [ -1 ]\n\t\t *          }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columns`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columns\": [\n\t\t *          null,\n\t\t *          null,\n\t\t *          null,\n\t\t *          {\n\t\t *            \"data\": null,\n\t\t *            \"defaultContent\": \"Edit\"\n\t\t *          }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"sDefaultContent\": null,\n\t\n\t\n\t\t/**\n\t\t * This parameter is only used in DataTables' server-side processing. It can\n\t\t * be exceptionally useful to know what columns are being displayed on the\n\t\t * client side, and to map these to database fields. When defined, the names\n\t\t * also allow DataTables to reorder information from the server if it comes\n\t\t * back in an unexpected order (i.e. if you switch your columns around on the\n\t\t * client-side, your server-side code does not also need updating).\n\t\t *  @type string\n\t\t *  @default <i>Empty string</i>\n\t\t *\n\t\t *  @name DataTable.defaults.column.name\n\t\t *  @dtopt Columns\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columnDefs`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [\n\t\t *          { \"name\": \"engine\", \"targets\": [ 0 ] },\n\t\t *          { \"name\": \"browser\", \"targets\": [ 1 ] },\n\t\t *          { \"name\": \"platform\", \"targets\": [ 2 ] },\n\t\t *          { \"name\": \"version\", \"targets\": [ 3 ] },\n\t\t *          { \"name\": \"grade\", \"targets\": [ 4 ] }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columns`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columns\": [\n\t\t *          { \"name\": \"engine\" },\n\t\t *          { \"name\": \"browser\" },\n\t\t *          { \"name\": \"platform\" },\n\t\t *          { \"name\": \"version\" },\n\t\t *          { \"name\": \"grade\" }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"sName\": \"\",\n\t\n\t\n\t\t/**\n\t\t * Defines a data source type for the ordering which can be used to read\n\t\t * real-time information from the table (updating the internally cached\n\t\t * version) prior to ordering. This allows ordering to occur on user\n\t\t * editable elements such as form inputs.\n\t\t *  @type string\n\t\t *  @default std\n\t\t *\n\t\t *  @name DataTable.defaults.column.orderDataType\n\t\t *  @dtopt Columns\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columnDefs`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [\n\t\t *          { \"orderDataType\": \"dom-text\", \"targets\": [ 2, 3 ] },\n\t\t *          { \"type\": \"numeric\", \"targets\": [ 3 ] },\n\t\t *          { \"orderDataType\": \"dom-select\", \"targets\": [ 4 ] },\n\t\t *          { \"orderDataType\": \"dom-checkbox\", \"targets\": [ 5 ] }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columns`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columns\": [\n\t\t *          null,\n\t\t *          null,\n\t\t *          { \"orderDataType\": \"dom-text\" },\n\t\t *          { \"orderDataType\": \"dom-text\", \"type\": \"numeric\" },\n\t\t *          { \"orderDataType\": \"dom-select\" },\n\t\t *          { \"orderDataType\": \"dom-checkbox\" }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"sSortDataType\": \"std\",\n\t\n\t\n\t\t/**\n\t\t * The title of this column.\n\t\t *  @type string\n\t\t *  @default null <i>Derived from the 'TH' value for this column in the\n\t\t *    original HTML table.</i>\n\t\t *\n\t\t *  @name DataTable.defaults.column.title\n\t\t *  @dtopt Columns\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columnDefs`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [\n\t\t *          { \"title\": \"My column title\", \"targets\": [ 0 ] }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columns`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columns\": [\n\t\t *          { \"title\": \"My column title\" },\n\t\t *          null,\n\t\t *          null,\n\t\t *          null,\n\t\t *          null\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"sTitle\": null,\n\t\n\t\n\t\t/**\n\t\t * The type allows you to specify how the data for this column will be\n\t\t * ordered. Four types (string, numeric, date and html (which will strip\n\t\t * HTML tags before ordering)) are currently available. Note that only date\n\t\t * formats understood by Javascript's Date() object will be accepted as type\n\t\t * date. For example: \"Mar 26, 2008 5:03 PM\". May take the values: 'string',\n\t\t * 'numeric', 'date' or 'html' (by default). Further types can be adding\n\t\t * through plug-ins.\n\t\t *  @type string\n\t\t *  @default null <i>Auto-detected from raw data</i>\n\t\t *\n\t\t *  @name DataTable.defaults.column.type\n\t\t *  @dtopt Columns\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columnDefs`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [\n\t\t *          { \"type\": \"html\", \"targets\": [ 0 ] }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columns`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columns\": [\n\t\t *          { \"type\": \"html\" },\n\t\t *          null,\n\t\t *          null,\n\t\t *          null,\n\t\t *          null\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"sType\": null,\n\t\n\t\n\t\t/**\n\t\t * Defining the width of the column, this parameter may take any CSS value\n\t\t * (3em, 20px etc). DataTables applies 'smart' widths to columns which have not\n\t\t * been given a specific width through this interface ensuring that the table\n\t\t * remains readable.\n\t\t *  @type string\n\t\t *  @default null <i>Automatic</i>\n\t\t *\n\t\t *  @name DataTable.defaults.column.width\n\t\t *  @dtopt Columns\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columnDefs`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columnDefs\": [\n\t\t *          { \"width\": \"20%\", \"targets\": [ 0 ] }\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t *\n\t\t *  @example\n\t\t *    // Using `columns`\n\t\t *    $(document).ready( function() {\n\t\t *      $('#example').dataTable( {\n\t\t *        \"columns\": [\n\t\t *          { \"width\": \"20%\" },\n\t\t *          null,\n\t\t *          null,\n\t\t *          null,\n\t\t *          null\n\t\t *        ]\n\t\t *      } );\n\t\t *    } );\n\t\t */\n\t\t\"sWidth\": null\n\t};\n\t\n\t_fnHungarianMap( DataTable.defaults.column );\n\t\n\t\n\t\n\t/**\n\t * DataTables settings object - this holds all the information needed for a\n\t * given table, including configuration, data and current application of the\n\t * table options. DataTables does not have a single instance for each DataTable\n\t * with the settings attached to that instance, but rather instances of the\n\t * DataTable \"class\" are created on-the-fly as needed (typically by a\n\t * $().dataTable() call) and the settings object is then applied to that\n\t * instance.\n\t *\n\t * Note that this object is related to {@link DataTable.defaults} but this\n\t * one is the internal data store for DataTables's cache of columns. It should\n\t * NOT be manipulated outside of DataTables. Any configuration should be done\n\t * through the initialisation options.\n\t *  @namespace\n\t *  @todo Really should attach the settings object to individual instances so we\n\t *    don't need to create new instances on each $().dataTable() call (if the\n\t *    table already exists). It would also save passing oSettings around and\n\t *    into every single function. However, this is a very significant\n\t *    architecture change for DataTables and will almost certainly break\n\t *    backwards compatibility with older installations. This is something that\n\t *    will be done in 2.0.\n\t */\n\tDataTable.models.oSettings = {\n\t\t/**\n\t\t * Primary features of DataTables and their enablement state.\n\t\t *  @namespace\n\t\t */\n\t\t\"oFeatures\": {\n\t\n\t\t\t/**\n\t\t\t * Flag to say if DataTables should automatically try to calculate the\n\t\t\t * optimum table and columns widths (true) or not (false).\n\t\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t\t * set a default use {@link DataTable.defaults}.\n\t\t\t *  @type boolean\n\t\t\t */\n\t\t\t\"bAutoWidth\": null,\n\t\n\t\t\t/**\n\t\t\t * Delay the creation of TR and TD elements until they are actually\n\t\t\t * needed by a driven page draw. This can give a significant speed\n\t\t\t * increase for Ajax source and Javascript source data, but makes no\n\t\t\t * difference at all fro DOM and server-side processing tables.\n\t\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t\t * set a default use {@link DataTable.defaults}.\n\t\t\t *  @type boolean\n\t\t\t */\n\t\t\t\"bDeferRender\": null,\n\t\n\t\t\t/**\n\t\t\t * Enable filtering on the table or not. Note that if this is disabled\n\t\t\t * then there is no filtering at all on the table, including fnFilter.\n\t\t\t * To just remove the filtering input use sDom and remove the 'f' option.\n\t\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t\t * set a default use {@link DataTable.defaults}.\n\t\t\t *  @type boolean\n\t\t\t */\n\t\t\t\"bFilter\": null,\n\t\n\t\t\t/**\n\t\t\t * Table information element (the 'Showing x of y records' div) enable\n\t\t\t * flag.\n\t\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t\t * set a default use {@link DataTable.defaults}.\n\t\t\t *  @type boolean\n\t\t\t */\n\t\t\t\"bInfo\": null,\n\t\n\t\t\t/**\n\t\t\t * Present a user control allowing the end user to change the page size\n\t\t\t * when pagination is enabled.\n\t\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t\t * set a default use {@link DataTable.defaults}.\n\t\t\t *  @type boolean\n\t\t\t */\n\t\t\t\"bLengthChange\": null,\n\t\n\t\t\t/**\n\t\t\t * Pagination enabled or not. Note that if this is disabled then length\n\t\t\t * changing must also be disabled.\n\t\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t\t * set a default use {@link DataTable.defaults}.\n\t\t\t *  @type boolean\n\t\t\t */\n\t\t\t\"bPaginate\": null,\n\t\n\t\t\t/**\n\t\t\t * Processing indicator enable flag whenever DataTables is enacting a\n\t\t\t * user request - typically an Ajax request for server-side processing.\n\t\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t\t * set a default use {@link DataTable.defaults}.\n\t\t\t *  @type boolean\n\t\t\t */\n\t\t\t\"bProcessing\": null,\n\t\n\t\t\t/**\n\t\t\t * Server-side processing enabled flag - when enabled DataTables will\n\t\t\t * get all data from the server for every draw - there is no filtering,\n\t\t\t * sorting or paging done on the client-side.\n\t\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t\t * set a default use {@link DataTable.defaults}.\n\t\t\t *  @type boolean\n\t\t\t */\n\t\t\t\"bServerSide\": null,\n\t\n\t\t\t/**\n\t\t\t * Sorting enablement flag.\n\t\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t\t * set a default use {@link DataTable.defaults}.\n\t\t\t *  @type boolean\n\t\t\t */\n\t\t\t\"bSort\": null,\n\t\n\t\t\t/**\n\t\t\t * Multi-column sorting\n\t\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t\t * set a default use {@link DataTable.defaults}.\n\t\t\t *  @type boolean\n\t\t\t */\n\t\t\t\"bSortMulti\": null,\n\t\n\t\t\t/**\n\t\t\t * Apply a class to the columns which are being sorted to provide a\n\t\t\t * visual highlight or not. This can slow things down when enabled since\n\t\t\t * there is a lot of DOM interaction.\n\t\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t\t * set a default use {@link DataTable.defaults}.\n\t\t\t *  @type boolean\n\t\t\t */\n\t\t\t\"bSortClasses\": null,\n\t\n\t\t\t/**\n\t\t\t * State saving enablement flag.\n\t\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t\t * set a default use {@link DataTable.defaults}.\n\t\t\t *  @type boolean\n\t\t\t */\n\t\t\t\"bStateSave\": null\n\t\t},\n\t\n\t\n\t\t/**\n\t\t * Scrolling settings for a table.\n\t\t *  @namespace\n\t\t */\n\t\t\"oScroll\": {\n\t\t\t/**\n\t\t\t * When the table is shorter in height than sScrollY, collapse the\n\t\t\t * table container down to the height of the table (when true).\n\t\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t\t * set a default use {@link DataTable.defaults}.\n\t\t\t *  @type boolean\n\t\t\t */\n\t\t\t\"bCollapse\": null,\n\t\n\t\t\t/**\n\t\t\t * Width of the scrollbar for the web-browser's platform. Calculated\n\t\t\t * during table initialisation.\n\t\t\t *  @type int\n\t\t\t *  @default 0\n\t\t\t */\n\t\t\t\"iBarWidth\": 0,\n\t\n\t\t\t/**\n\t\t\t * Viewport width for horizontal scrolling. Horizontal scrolling is\n\t\t\t * disabled if an empty string.\n\t\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t\t * set a default use {@link DataTable.defaults}.\n\t\t\t *  @type string\n\t\t\t */\n\t\t\t\"sX\": null,\n\t\n\t\t\t/**\n\t\t\t * Width to expand the table to when using x-scrolling. Typically you\n\t\t\t * should not need to use this.\n\t\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t\t * set a default use {@link DataTable.defaults}.\n\t\t\t *  @type string\n\t\t\t *  @deprecated\n\t\t\t */\n\t\t\t\"sXInner\": null,\n\t\n\t\t\t/**\n\t\t\t * Viewport height for vertical scrolling. Vertical scrolling is disabled\n\t\t\t * if an empty string.\n\t\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t\t * set a default use {@link DataTable.defaults}.\n\t\t\t *  @type string\n\t\t\t */\n\t\t\t\"sY\": null\n\t\t},\n\t\n\t\t/**\n\t\t * Language information for the table.\n\t\t *  @namespace\n\t\t *  @extends DataTable.defaults.oLanguage\n\t\t */\n\t\t\"oLanguage\": {\n\t\t\t/**\n\t\t\t * Information callback function. See\n\t\t\t * {@link DataTable.defaults.fnInfoCallback}\n\t\t\t *  @type function\n\t\t\t *  @default null\n\t\t\t */\n\t\t\t\"fnInfoCallback\": null\n\t\t},\n\t\n\t\t/**\n\t\t * Browser support parameters\n\t\t *  @namespace\n\t\t */\n\t\t\"oBrowser\": {\n\t\t\t/**\n\t\t\t * Indicate if the browser incorrectly calculates width:100% inside a\n\t\t\t * scrolling element (IE6/7)\n\t\t\t *  @type boolean\n\t\t\t *  @default false\n\t\t\t */\n\t\t\t\"bScrollOversize\": false,\n\t\n\t\t\t/**\n\t\t\t * Determine if the vertical scrollbar is on the right or left of the\n\t\t\t * scrolling container - needed for rtl language layout, although not\n\t\t\t * all browsers move the scrollbar (Safari).\n\t\t\t *  @type boolean\n\t\t\t *  @default false\n\t\t\t */\n\t\t\t\"bScrollbarLeft\": false,\n\t\n\t\t\t/**\n\t\t\t * Flag for if `getBoundingClientRect` is fully supported or not\n\t\t\t *  @type boolean\n\t\t\t *  @default false\n\t\t\t */\n\t\t\t\"bBounding\": false,\n\t\n\t\t\t/**\n\t\t\t * Browser scrollbar width\n\t\t\t *  @type integer\n\t\t\t *  @default 0\n\t\t\t */\n\t\t\t\"barWidth\": 0\n\t\t},\n\t\n\t\n\t\t\"ajax\": null,\n\t\n\t\n\t\t/**\n\t\t * Array referencing the nodes which are used for the features. The\n\t\t * parameters of this object match what is allowed by sDom - i.e.\n\t\t *   <ul>\n\t\t *     <li>'l' - Length changing</li>\n\t\t *     <li>'f' - Filtering input</li>\n\t\t *     <li>'t' - The table!</li>\n\t\t *     <li>'i' - Information</li>\n\t\t *     <li>'p' - Pagination</li>\n\t\t *     <li>'r' - pRocessing</li>\n\t\t *   </ul>\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aanFeatures\": [],\n\t\n\t\t/**\n\t\t * Store data information - see {@link DataTable.models.oRow} for detailed\n\t\t * information.\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoData\": [],\n\t\n\t\t/**\n\t\t * Array of indexes which are in the current display (after filtering etc)\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aiDisplay\": [],\n\t\n\t\t/**\n\t\t * Array of indexes for display - no filtering\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aiDisplayMaster\": [],\n\t\n\t\t/**\n\t\t * Map of row ids to data indexes\n\t\t *  @type object\n\t\t *  @default {}\n\t\t */\n\t\t\"aIds\": {},\n\t\n\t\t/**\n\t\t * Store information about each column that is in use\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoColumns\": [],\n\t\n\t\t/**\n\t\t * Store information about the table's header\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoHeader\": [],\n\t\n\t\t/**\n\t\t * Store information about the table's footer\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoFooter\": [],\n\t\n\t\t/**\n\t\t * Store the applied global search information in case we want to force a\n\t\t * research or compare the old search to a new one.\n\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t * set a default use {@link DataTable.defaults}.\n\t\t *  @namespace\n\t\t *  @extends DataTable.models.oSearch\n\t\t */\n\t\t\"oPreviousSearch\": {},\n\t\n\t\t/**\n\t\t * Store the applied search for each column - see\n\t\t * {@link DataTable.models.oSearch} for the format that is used for the\n\t\t * filtering information for each column.\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoPreSearchCols\": [],\n\t\n\t\t/**\n\t\t * Sorting that is applied to the table. Note that the inner arrays are\n\t\t * used in the following manner:\n\t\t * <ul>\n\t\t *   <li>Index 0 - column number</li>\n\t\t *   <li>Index 1 - current sorting direction</li>\n\t\t * </ul>\n\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t * set a default use {@link DataTable.defaults}.\n\t\t *  @type array\n\t\t *  @todo These inner arrays should really be objects\n\t\t */\n\t\t\"aaSorting\": null,\n\t\n\t\t/**\n\t\t * Sorting that is always applied to the table (i.e. prefixed in front of\n\t\t * aaSorting).\n\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t * set a default use {@link DataTable.defaults}.\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aaSortingFixed\": [],\n\t\n\t\t/**\n\t\t * Classes to use for the striping of a table.\n\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t * set a default use {@link DataTable.defaults}.\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"asStripeClasses\": null,\n\t\n\t\t/**\n\t\t * If restoring a table - we should restore its striping classes as well\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"asDestroyStripes\": [],\n\t\n\t\t/**\n\t\t * If restoring a table - we should restore its width\n\t\t *  @type int\n\t\t *  @default 0\n\t\t */\n\t\t\"sDestroyWidth\": 0,\n\t\n\t\t/**\n\t\t * Callback functions array for every time a row is inserted (i.e. on a draw).\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoRowCallback\": [],\n\t\n\t\t/**\n\t\t * Callback functions for the header on each draw.\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoHeaderCallback\": [],\n\t\n\t\t/**\n\t\t * Callback function for the footer on each draw.\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoFooterCallback\": [],\n\t\n\t\t/**\n\t\t * Array of callback functions for draw callback functions\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoDrawCallback\": [],\n\t\n\t\t/**\n\t\t * Array of callback functions for row created function\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoRowCreatedCallback\": [],\n\t\n\t\t/**\n\t\t * Callback functions for just before the table is redrawn. A return of\n\t\t * false will be used to cancel the draw.\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoPreDrawCallback\": [],\n\t\n\t\t/**\n\t\t * Callback functions for when the table has been initialised.\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoInitComplete\": [],\n\t\n\t\n\t\t/**\n\t\t * Callbacks for modifying the settings to be stored for state saving, prior to\n\t\t * saving state.\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoStateSaveParams\": [],\n\t\n\t\t/**\n\t\t * Callbacks for modifying the settings that have been stored for state saving\n\t\t * prior to using the stored values to restore the state.\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoStateLoadParams\": [],\n\t\n\t\t/**\n\t\t * Callbacks for operating on the settings object once the saved state has been\n\t\t * loaded\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoStateLoaded\": [],\n\t\n\t\t/**\n\t\t * Cache the table ID for quick access\n\t\t *  @type string\n\t\t *  @default <i>Empty string</i>\n\t\t */\n\t\t\"sTableId\": \"\",\n\t\n\t\t/**\n\t\t * The TABLE node for the main table\n\t\t *  @type node\n\t\t *  @default null\n\t\t */\n\t\t\"nTable\": null,\n\t\n\t\t/**\n\t\t * Permanent ref to the thead element\n\t\t *  @type node\n\t\t *  @default null\n\t\t */\n\t\t\"nTHead\": null,\n\t\n\t\t/**\n\t\t * Permanent ref to the tfoot element - if it exists\n\t\t *  @type node\n\t\t *  @default null\n\t\t */\n\t\t\"nTFoot\": null,\n\t\n\t\t/**\n\t\t * Permanent ref to the tbody element\n\t\t *  @type node\n\t\t *  @default null\n\t\t */\n\t\t\"nTBody\": null,\n\t\n\t\t/**\n\t\t * Cache the wrapper node (contains all DataTables controlled elements)\n\t\t *  @type node\n\t\t *  @default null\n\t\t */\n\t\t\"nTableWrapper\": null,\n\t\n\t\t/**\n\t\t * Indicate if when using server-side processing the loading of data\n\t\t * should be deferred until the second draw.\n\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t * set a default use {@link DataTable.defaults}.\n\t\t *  @type boolean\n\t\t *  @default false\n\t\t */\n\t\t\"bDeferLoading\": false,\n\t\n\t\t/**\n\t\t * Indicate if all required information has been read in\n\t\t *  @type boolean\n\t\t *  @default false\n\t\t */\n\t\t\"bInitialised\": false,\n\t\n\t\t/**\n\t\t * Information about open rows. Each object in the array has the parameters\n\t\t * 'nTr' and 'nParent'\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoOpenRows\": [],\n\t\n\t\t/**\n\t\t * Dictate the positioning of DataTables' control elements - see\n\t\t * {@link DataTable.model.oInit.sDom}.\n\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t * set a default use {@link DataTable.defaults}.\n\t\t *  @type string\n\t\t *  @default null\n\t\t */\n\t\t\"sDom\": null,\n\t\n\t\t/**\n\t\t * Search delay (in mS)\n\t\t *  @type integer\n\t\t *  @default null\n\t\t */\n\t\t\"searchDelay\": null,\n\t\n\t\t/**\n\t\t * Which type of pagination should be used.\n\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t * set a default use {@link DataTable.defaults}.\n\t\t *  @type string\n\t\t *  @default two_button\n\t\t */\n\t\t\"sPaginationType\": \"two_button\",\n\t\n\t\t/**\n\t\t * The state duration (for `stateSave`) in seconds.\n\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t * set a default use {@link DataTable.defaults}.\n\t\t *  @type int\n\t\t *  @default 0\n\t\t */\n\t\t\"iStateDuration\": 0,\n\t\n\t\t/**\n\t\t * Array of callback functions for state saving. Each array element is an\n\t\t * object with the following parameters:\n\t\t *   <ul>\n\t\t *     <li>function:fn - function to call. Takes two parameters, oSettings\n\t\t *       and the JSON string to save that has been thus far created. Returns\n\t\t *       a JSON string to be inserted into a json object\n\t\t *       (i.e. '\"param\": [ 0, 1, 2]')</li>\n\t\t *     <li>string:sName - name of callback</li>\n\t\t *   </ul>\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoStateSave\": [],\n\t\n\t\t/**\n\t\t * Array of callback functions for state loading. Each array element is an\n\t\t * object with the following parameters:\n\t\t *   <ul>\n\t\t *     <li>function:fn - function to call. Takes two parameters, oSettings\n\t\t *       and the object stored. May return false to cancel state loading</li>\n\t\t *     <li>string:sName - name of callback</li>\n\t\t *   </ul>\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoStateLoad\": [],\n\t\n\t\t/**\n\t\t * State that was saved. Useful for back reference\n\t\t *  @type object\n\t\t *  @default null\n\t\t */\n\t\t\"oSavedState\": null,\n\t\n\t\t/**\n\t\t * State that was loaded. Useful for back reference\n\t\t *  @type object\n\t\t *  @default null\n\t\t */\n\t\t\"oLoadedState\": null,\n\t\n\t\t/**\n\t\t * Source url for AJAX data for the table.\n\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t * set a default use {@link DataTable.defaults}.\n\t\t *  @type string\n\t\t *  @default null\n\t\t */\n\t\t\"sAjaxSource\": null,\n\t\n\t\t/**\n\t\t * Property from a given object from which to read the table data from. This\n\t\t * can be an empty string (when not server-side processing), in which case\n\t\t * it is  assumed an an array is given directly.\n\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t * set a default use {@link DataTable.defaults}.\n\t\t *  @type string\n\t\t */\n\t\t\"sAjaxDataProp\": null,\n\t\n\t\t/**\n\t\t * Note if draw should be blocked while getting data\n\t\t *  @type boolean\n\t\t *  @default true\n\t\t */\n\t\t\"bAjaxDataGet\": true,\n\t\n\t\t/**\n\t\t * The last jQuery XHR object that was used for server-side data gathering.\n\t\t * This can be used for working with the XHR information in one of the\n\t\t * callbacks\n\t\t *  @type object\n\t\t *  @default null\n\t\t */\n\t\t\"jqXHR\": null,\n\t\n\t\t/**\n\t\t * JSON returned from the server in the last Ajax request\n\t\t *  @type object\n\t\t *  @default undefined\n\t\t */\n\t\t\"json\": undefined,\n\t\n\t\t/**\n\t\t * Data submitted as part of the last Ajax request\n\t\t *  @type object\n\t\t *  @default undefined\n\t\t */\n\t\t\"oAjaxData\": undefined,\n\t\n\t\t/**\n\t\t * Function to get the server-side data.\n\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t * set a default use {@link DataTable.defaults}.\n\t\t *  @type function\n\t\t */\n\t\t\"fnServerData\": null,\n\t\n\t\t/**\n\t\t * Functions which are called prior to sending an Ajax request so extra\n\t\t * parameters can easily be sent to the server\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoServerParams\": [],\n\t\n\t\t/**\n\t\t * Send the XHR HTTP method - GET or POST (could be PUT or DELETE if\n\t\t * required).\n\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t * set a default use {@link DataTable.defaults}.\n\t\t *  @type string\n\t\t */\n\t\t\"sServerMethod\": null,\n\t\n\t\t/**\n\t\t * Format numbers for display.\n\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t * set a default use {@link DataTable.defaults}.\n\t\t *  @type function\n\t\t */\n\t\t\"fnFormatNumber\": null,\n\t\n\t\t/**\n\t\t * List of options that can be used for the user selectable length menu.\n\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t * set a default use {@link DataTable.defaults}.\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aLengthMenu\": null,\n\t\n\t\t/**\n\t\t * Counter for the draws that the table does. Also used as a tracker for\n\t\t * server-side processing\n\t\t *  @type int\n\t\t *  @default 0\n\t\t */\n\t\t\"iDraw\": 0,\n\t\n\t\t/**\n\t\t * Indicate if a redraw is being done - useful for Ajax\n\t\t *  @type boolean\n\t\t *  @default false\n\t\t */\n\t\t\"bDrawing\": false,\n\t\n\t\t/**\n\t\t * Draw index (iDraw) of the last error when parsing the returned data\n\t\t *  @type int\n\t\t *  @default -1\n\t\t */\n\t\t\"iDrawError\": -1,\n\t\n\t\t/**\n\t\t * Paging display length\n\t\t *  @type int\n\t\t *  @default 10\n\t\t */\n\t\t\"_iDisplayLength\": 10,\n\t\n\t\t/**\n\t\t * Paging start point - aiDisplay index\n\t\t *  @type int\n\t\t *  @default 0\n\t\t */\n\t\t\"_iDisplayStart\": 0,\n\t\n\t\t/**\n\t\t * Server-side processing - number of records in the result set\n\t\t * (i.e. before filtering), Use fnRecordsTotal rather than\n\t\t * this property to get the value of the number of records, regardless of\n\t\t * the server-side processing setting.\n\t\t *  @type int\n\t\t *  @default 0\n\t\t *  @private\n\t\t */\n\t\t\"_iRecordsTotal\": 0,\n\t\n\t\t/**\n\t\t * Server-side processing - number of records in the current display set\n\t\t * (i.e. after filtering). Use fnRecordsDisplay rather than\n\t\t * this property to get the value of the number of records, regardless of\n\t\t * the server-side processing setting.\n\t\t *  @type boolean\n\t\t *  @default 0\n\t\t *  @private\n\t\t */\n\t\t\"_iRecordsDisplay\": 0,\n\t\n\t\t/**\n\t\t * Flag to indicate if jQuery UI marking and classes should be used.\n\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t * set a default use {@link DataTable.defaults}.\n\t\t *  @type boolean\n\t\t */\n\t\t\"bJUI\": null,\n\t\n\t\t/**\n\t\t * The classes to use for the table\n\t\t *  @type object\n\t\t *  @default {}\n\t\t */\n\t\t\"oClasses\": {},\n\t\n\t\t/**\n\t\t * Flag attached to the settings object so you can check in the draw\n\t\t * callback if filtering has been done in the draw. Deprecated in favour of\n\t\t * events.\n\t\t *  @type boolean\n\t\t *  @default false\n\t\t *  @deprecated\n\t\t */\n\t\t\"bFiltered\": false,\n\t\n\t\t/**\n\t\t * Flag attached to the settings object so you can check in the draw\n\t\t * callback if sorting has been done in the draw. Deprecated in favour of\n\t\t * events.\n\t\t *  @type boolean\n\t\t *  @default false\n\t\t *  @deprecated\n\t\t */\n\t\t\"bSorted\": false,\n\t\n\t\t/**\n\t\t * Indicate that if multiple rows are in the header and there is more than\n\t\t * one unique cell per column, if the top one (true) or bottom one (false)\n\t\t * should be used for sorting / title by DataTables.\n\t\t * Note that this parameter will be set by the initialisation routine. To\n\t\t * set a default use {@link DataTable.defaults}.\n\t\t *  @type boolean\n\t\t */\n\t\t\"bSortCellsTop\": null,\n\t\n\t\t/**\n\t\t * Initialisation object that is used for the table\n\t\t *  @type object\n\t\t *  @default null\n\t\t */\n\t\t\"oInit\": null,\n\t\n\t\t/**\n\t\t * Destroy callback functions - for plug-ins to attach themselves to the\n\t\t * destroy so they can clean up markup and events.\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aoDestroyCallback\": [],\n\t\n\t\n\t\t/**\n\t\t * Get the number of records in the current record set, before filtering\n\t\t *  @type function\n\t\t */\n\t\t\"fnRecordsTotal\": function ()\n\t\t{\n\t\t\treturn _fnDataSource( this ) == 'ssp' ?\n\t\t\t\tthis._iRecordsTotal * 1 :\n\t\t\t\tthis.aiDisplayMaster.length;\n\t\t},\n\t\n\t\t/**\n\t\t * Get the number of records in the current record set, after filtering\n\t\t *  @type function\n\t\t */\n\t\t\"fnRecordsDisplay\": function ()\n\t\t{\n\t\t\treturn _fnDataSource( this ) == 'ssp' ?\n\t\t\t\tthis._iRecordsDisplay * 1 :\n\t\t\t\tthis.aiDisplay.length;\n\t\t},\n\t\n\t\t/**\n\t\t * Get the display end point - aiDisplay index\n\t\t *  @type function\n\t\t */\n\t\t\"fnDisplayEnd\": function ()\n\t\t{\n\t\t\tvar\n\t\t\t\tlen      = this._iDisplayLength,\n\t\t\t\tstart    = this._iDisplayStart,\n\t\t\t\tcalc     = start + len,\n\t\t\t\trecords  = this.aiDisplay.length,\n\t\t\t\tfeatures = this.oFeatures,\n\t\t\t\tpaginate = features.bPaginate;\n\t\n\t\t\tif ( features.bServerSide ) {\n\t\t\t\treturn paginate === false || len === -1 ?\n\t\t\t\t\tstart + records :\n\t\t\t\t\tMath.min( start+len, this._iRecordsDisplay );\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn ! paginate || calc>records || len===-1 ?\n\t\t\t\t\trecords :\n\t\t\t\t\tcalc;\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * The DataTables object for this table\n\t\t *  @type object\n\t\t *  @default null\n\t\t */\n\t\t\"oInstance\": null,\n\t\n\t\t/**\n\t\t * Unique identifier for each instance of the DataTables object. If there\n\t\t * is an ID on the table node, then it takes that value, otherwise an\n\t\t * incrementing internal counter is used.\n\t\t *  @type string\n\t\t *  @default null\n\t\t */\n\t\t\"sInstance\": null,\n\t\n\t\t/**\n\t\t * tabindex attribute value that is added to DataTables control elements, allowing\n\t\t * keyboard navigation of the table and its controls.\n\t\t */\n\t\t\"iTabIndex\": 0,\n\t\n\t\t/**\n\t\t * DIV container for the footer scrolling table if scrolling\n\t\t */\n\t\t\"nScrollHead\": null,\n\t\n\t\t/**\n\t\t * DIV container for the footer scrolling table if scrolling\n\t\t */\n\t\t\"nScrollFoot\": null,\n\t\n\t\t/**\n\t\t * Last applied sort\n\t\t *  @type array\n\t\t *  @default []\n\t\t */\n\t\t\"aLastSort\": [],\n\t\n\t\t/**\n\t\t * Stored plug-in instances\n\t\t *  @type object\n\t\t *  @default {}\n\t\t */\n\t\t\"oPlugins\": {},\n\t\n\t\t/**\n\t\t * Function used to get a row's id from the row's data\n\t\t *  @type function\n\t\t *  @default null\n\t\t */\n\t\t\"rowIdFn\": null,\n\t\n\t\t/**\n\t\t * Data location where to store a row's id\n\t\t *  @type string\n\t\t *  @default null\n\t\t */\n\t\t\"rowId\": null\n\t};\n\n\t/**\n\t * Extension object for DataTables that is used to provide all extension\n\t * options.\n\t *\n\t * Note that the `DataTable.ext` object is available through\n\t * `jQuery.fn.dataTable.ext` where it may be accessed and manipulated. It is\n\t * also aliased to `jQuery.fn.dataTableExt` for historic reasons.\n\t *  @namespace\n\t *  @extends DataTable.models.ext\n\t */\n\t\n\t\n\t/**\n\t * DataTables extensions\n\t * \n\t * This namespace acts as a collection area for plug-ins that can be used to\n\t * extend DataTables capabilities. Indeed many of the build in methods\n\t * use this method to provide their own capabilities (sorting methods for\n\t * example).\n\t *\n\t * Note that this namespace is aliased to `jQuery.fn.dataTableExt` for legacy\n\t * reasons\n\t *\n\t *  @namespace\n\t */\n\tDataTable.ext = _ext = {\n\t\t/**\n\t\t * Buttons. For use with the Buttons extension for DataTables. This is\n\t\t * defined here so other extensions can define buttons regardless of load\n\t\t * order. It is _not_ used by DataTables core.\n\t\t *\n\t\t *  @type object\n\t\t *  @default {}\n\t\t */\n\t\tbuttons: {},\n\t\n\t\n\t\t/**\n\t\t * Element class names\n\t\t *\n\t\t *  @type object\n\t\t *  @default {}\n\t\t */\n\t\tclasses: {},\n\t\n\t\n\t\t/**\n\t\t * DataTables build type (expanded by the download builder)\n\t\t *\n\t\t *  @type string\n\t\t */\n\t\tbuilder: \"-source-\",\n\t\n\t\n\t\t/**\n\t\t * Error reporting.\n\t\t * \n\t\t * How should DataTables report an error. Can take the value 'alert',\n\t\t * 'throw', 'none' or a function.\n\t\t *\n\t\t *  @type string|function\n\t\t *  @default alert\n\t\t */\n\t\terrMode: \"alert\",\n\t\n\t\n\t\t/**\n\t\t * Feature plug-ins.\n\t\t * \n\t\t * This is an array of objects which describe the feature plug-ins that are\n\t\t * available to DataTables. These feature plug-ins are then available for\n\t\t * use through the `dom` initialisation option.\n\t\t * \n\t\t * Each feature plug-in is described by an object which must have the\n\t\t * following properties:\n\t\t * \n\t\t * * `fnInit` - function that is used to initialise the plug-in,\n\t\t * * `cFeature` - a character so the feature can be enabled by the `dom`\n\t\t *   instillation option. This is case sensitive.\n\t\t *\n\t\t * The `fnInit` function has the following input parameters:\n\t\t *\n\t\t * 1. `{object}` DataTables settings object: see\n\t\t *    {@link DataTable.models.oSettings}\n\t\t *\n\t\t * And the following return is expected:\n\t\t * \n\t\t * * {node|null} The element which contains your feature. Note that the\n\t\t *   return may also be void if your plug-in does not require to inject any\n\t\t *   DOM elements into DataTables control (`dom`) - for example this might\n\t\t *   be useful when developing a plug-in which allows table control via\n\t\t *   keyboard entry\n\t\t *\n\t\t *  @type array\n\t\t *\n\t\t *  @example\n\t\t *    $.fn.dataTable.ext.features.push( {\n\t\t *      \"fnInit\": function( oSettings ) {\n\t\t *        return new TableTools( { \"oDTSettings\": oSettings } );\n\t\t *      },\n\t\t *      \"cFeature\": \"T\"\n\t\t *    } );\n\t\t */\n\t\tfeature: [],\n\t\n\t\n\t\t/**\n\t\t * Row searching.\n\t\t * \n\t\t * This method of searching is complimentary to the default type based\n\t\t * searching, and a lot more comprehensive as it allows you complete control\n\t\t * over the searching logic. Each element in this array is a function\n\t\t * (parameters described below) that is called for every row in the table,\n\t\t * and your logic decides if it should be included in the searching data set\n\t\t * or not.\n\t\t *\n\t\t * Searching functions have the following input parameters:\n\t\t *\n\t\t * 1. `{object}` DataTables settings object: see\n\t\t *    {@link DataTable.models.oSettings}\n\t\t * 2. `{array|object}` Data for the row to be processed (same as the\n\t\t *    original format that was passed in as the data source, or an array\n\t\t *    from a DOM data source\n\t\t * 3. `{int}` Row index ({@link DataTable.models.oSettings.aoData}), which\n\t\t *    can be useful to retrieve the `TR` element if you need DOM interaction.\n\t\t *\n\t\t * And the following return is expected:\n\t\t *\n\t\t * * {boolean} Include the row in the searched result set (true) or not\n\t\t *   (false)\n\t\t *\n\t\t * Note that as with the main search ability in DataTables, technically this\n\t\t * is \"filtering\", since it is subtractive. However, for consistency in\n\t\t * naming we call it searching here.\n\t\t *\n\t\t *  @type array\n\t\t *  @default []\n\t\t *\n\t\t *  @example\n\t\t *    // The following example shows custom search being applied to the\n\t\t *    // fourth column (i.e. the data[3] index) based on two input values\n\t\t *    // from the end-user, matching the data in a certain range.\n\t\t *    $.fn.dataTable.ext.search.push(\n\t\t *      function( settings, data, dataIndex ) {\n\t\t *        var min = document.getElementById('min').value * 1;\n\t\t *        var max = document.getElementById('max').value * 1;\n\t\t *        var version = data[3] == \"-\" ? 0 : data[3]*1;\n\t\t *\n\t\t *        if ( min == \"\" && max == \"\" ) {\n\t\t *          return true;\n\t\t *        }\n\t\t *        else if ( min == \"\" && version < max ) {\n\t\t *          return true;\n\t\t *        }\n\t\t *        else if ( min < version && \"\" == max ) {\n\t\t *          return true;\n\t\t *        }\n\t\t *        else if ( min < version && version < max ) {\n\t\t *          return true;\n\t\t *        }\n\t\t *        return false;\n\t\t *      }\n\t\t *    );\n\t\t */\n\t\tsearch: [],\n\t\n\t\n\t\t/**\n\t\t * Selector extensions\n\t\t *\n\t\t * The `selector` option can be used to extend the options available for the\n\t\t * selector modifier options (`selector-modifier` object data type) that\n\t\t * each of the three built in selector types offer (row, column and cell +\n\t\t * their plural counterparts). For example the Select extension uses this\n\t\t * mechanism to provide an option to select only rows, columns and cells\n\t\t * that have been marked as selected by the end user (`{selected: true}`),\n\t\t * which can be used in conjunction with the existing built in selector\n\t\t * options.\n\t\t *\n\t\t * Each property is an array to which functions can be pushed. The functions\n\t\t * take three attributes:\n\t\t *\n\t\t * * Settings object for the host table\n\t\t * * Options object (`selector-modifier` object type)\n\t\t * * Array of selected item indexes\n\t\t *\n\t\t * The return is an array of the resulting item indexes after the custom\n\t\t * selector has been applied.\n\t\t *\n\t\t *  @type object\n\t\t */\n\t\tselector: {\n\t\t\tcell: [],\n\t\t\tcolumn: [],\n\t\t\trow: []\n\t\t},\n\t\n\t\n\t\t/**\n\t\t * Internal functions, exposed for used in plug-ins.\n\t\t * \n\t\t * Please note that you should not need to use the internal methods for\n\t\t * anything other than a plug-in (and even then, try to avoid if possible).\n\t\t * The internal function may change between releases.\n\t\t *\n\t\t *  @type object\n\t\t *  @default {}\n\t\t */\n\t\tinternal: {},\n\t\n\t\n\t\t/**\n\t\t * Legacy configuration options. Enable and disable legacy options that\n\t\t * are available in DataTables.\n\t\t *\n\t\t *  @type object\n\t\t */\n\t\tlegacy: {\n\t\t\t/**\n\t\t\t * Enable / disable DataTables 1.9 compatible server-side processing\n\t\t\t * requests\n\t\t\t *\n\t\t\t *  @type boolean\n\t\t\t *  @default null\n\t\t\t */\n\t\t\tajax: null\n\t\t},\n\t\n\t\n\t\t/**\n\t\t * Pagination plug-in methods.\n\t\t * \n\t\t * Each entry in this object is a function and defines which buttons should\n\t\t * be shown by the pagination rendering method that is used for the table:\n\t\t * {@link DataTable.ext.renderer.pageButton}. The renderer addresses how the\n\t\t * buttons are displayed in the document, while the functions here tell it\n\t\t * what buttons to display. This is done by returning an array of button\n\t\t * descriptions (what each button will do).\n\t\t *\n\t\t * Pagination types (the four built in options and any additional plug-in\n\t\t * options defined here) can be used through the `paginationType`\n\t\t * initialisation parameter.\n\t\t *\n\t\t * The functions defined take two parameters:\n\t\t *\n\t\t * 1. `{int} page` The current page index\n\t\t * 2. `{int} pages` The number of pages in the table\n\t\t *\n\t\t * Each function is expected to return an array where each element of the\n\t\t * array can be one of:\n\t\t *\n\t\t * * `first` - Jump to first page when activated\n\t\t * * `last` - Jump to last page when activated\n\t\t * * `previous` - Show previous page when activated\n\t\t * * `next` - Show next page when activated\n\t\t * * `{int}` - Show page of the index given\n\t\t * * `{array}` - A nested array containing the above elements to add a\n\t\t *   containing 'DIV' element (might be useful for styling).\n\t\t *\n\t\t * Note that DataTables v1.9- used this object slightly differently whereby\n\t\t * an object with two functions would be defined for each plug-in. That\n\t\t * ability is still supported by DataTables 1.10+ to provide backwards\n\t\t * compatibility, but this option of use is now decremented and no longer\n\t\t * documented in DataTables 1.10+.\n\t\t *\n\t\t *  @type object\n\t\t *  @default {}\n\t\t *\n\t\t *  @example\n\t\t *    // Show previous, next and current page buttons only\n\t\t *    $.fn.dataTableExt.oPagination.current = function ( page, pages ) {\n\t\t *      return [ 'previous', page, 'next' ];\n\t\t *    };\n\t\t */\n\t\tpager: {},\n\t\n\t\n\t\trenderer: {\n\t\t\tpageButton: {},\n\t\t\theader: {}\n\t\t},\n\t\n\t\n\t\t/**\n\t\t * Ordering plug-ins - custom data source\n\t\t * \n\t\t * The extension options for ordering of data available here is complimentary\n\t\t * to the default type based ordering that DataTables typically uses. It\n\t\t * allows much greater control over the the data that is being used to\n\t\t * order a column, but is necessarily therefore more complex.\n\t\t * \n\t\t * This type of ordering is useful if you want to do ordering based on data\n\t\t * live from the DOM (for example the contents of an 'input' element) rather\n\t\t * than just the static string that DataTables knows of.\n\t\t * \n\t\t * The way these plug-ins work is that you create an array of the values you\n\t\t * wish to be ordering for the column in question and then return that\n\t\t * array. The data in the array much be in the index order of the rows in\n\t\t * the table (not the currently ordering order!). Which order data gathering\n\t\t * function is run here depends on the `dt-init columns.orderDataType`\n\t\t * parameter that is used for the column (if any).\n\t\t *\n\t\t * The functions defined take two parameters:\n\t\t *\n\t\t * 1. `{object}` DataTables settings object: see\n\t\t *    {@link DataTable.models.oSettings}\n\t\t * 2. `{int}` Target column index\n\t\t *\n\t\t * Each function is expected to return an array:\n\t\t *\n\t\t * * `{array}` Data for the column to be ordering upon\n\t\t *\n\t\t *  @type array\n\t\t *\n\t\t *  @example\n\t\t *    // Ordering using `input` node values\n\t\t *    $.fn.dataTable.ext.order['dom-text'] = function  ( settings, col )\n\t\t *    {\n\t\t *      return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {\n\t\t *        return $('input', td).val();\n\t\t *      } );\n\t\t *    }\n\t\t */\n\t\torder: {},\n\t\n\t\n\t\t/**\n\t\t * Type based plug-ins.\n\t\t *\n\t\t * Each column in DataTables has a type assigned to it, either by automatic\n\t\t * detection or by direct assignment using the `type` option for the column.\n\t\t * The type of a column will effect how it is ordering and search (plug-ins\n\t\t * can also make use of the column type if required).\n\t\t *\n\t\t * @namespace\n\t\t */\n\t\ttype: {\n\t\t\t/**\n\t\t\t * Type detection functions.\n\t\t\t *\n\t\t\t * The functions defined in this object are used to automatically detect\n\t\t\t * a column's type, making initialisation of DataTables super easy, even\n\t\t\t * when complex data is in the table.\n\t\t\t *\n\t\t\t * The functions defined take two parameters:\n\t\t\t *\n\t\t     *  1. `{*}` Data from the column cell to be analysed\n\t\t     *  2. `{settings}` DataTables settings object. This can be used to\n\t\t     *     perform context specific type detection - for example detection\n\t\t     *     based on language settings such as using a comma for a decimal\n\t\t     *     place. Generally speaking the options from the settings will not\n\t\t     *     be required\n\t\t\t *\n\t\t\t * Each function is expected to return:\n\t\t\t *\n\t\t\t * * `{string|null}` Data type detected, or null if unknown (and thus\n\t\t\t *   pass it on to the other type detection functions.\n\t\t\t *\n\t\t\t *  @type array\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    // Currency type detection plug-in:\n\t\t\t *    $.fn.dataTable.ext.type.detect.push(\n\t\t\t *      function ( data, settings ) {\n\t\t\t *        // Check the numeric part\n\t\t\t *        if ( ! $.isNumeric( data.substring(1) ) ) {\n\t\t\t *          return null;\n\t\t\t *        }\n\t\t\t *\n\t\t\t *        // Check prefixed by currency\n\t\t\t *        if ( data.charAt(0) == '$' || data.charAt(0) == '&pound;' ) {\n\t\t\t *          return 'currency';\n\t\t\t *        }\n\t\t\t *        return null;\n\t\t\t *      }\n\t\t\t *    );\n\t\t\t */\n\t\t\tdetect: [],\n\t\n\t\n\t\t\t/**\n\t\t\t * Type based search formatting.\n\t\t\t *\n\t\t\t * The type based searching functions can be used to pre-format the\n\t\t\t * data to be search on. For example, it can be used to strip HTML\n\t\t\t * tags or to de-format telephone numbers for numeric only searching.\n\t\t\t *\n\t\t\t * Note that is a search is not defined for a column of a given type,\n\t\t\t * no search formatting will be performed.\n\t\t\t * \n\t\t\t * Pre-processing of searching data plug-ins - When you assign the sType\n\t\t\t * for a column (or have it automatically detected for you by DataTables\n\t\t\t * or a type detection plug-in), you will typically be using this for\n\t\t\t * custom sorting, but it can also be used to provide custom searching\n\t\t\t * by allowing you to pre-processing the data and returning the data in\n\t\t\t * the format that should be searched upon. This is done by adding\n\t\t\t * functions this object with a parameter name which matches the sType\n\t\t\t * for that target column. This is the corollary of <i>afnSortData</i>\n\t\t\t * for searching data.\n\t\t\t *\n\t\t\t * The functions defined take a single parameter:\n\t\t\t *\n\t\t     *  1. `{*}` Data from the column cell to be prepared for searching\n\t\t\t *\n\t\t\t * Each function is expected to return:\n\t\t\t *\n\t\t\t * * `{string|null}` Formatted string that will be used for the searching.\n\t\t\t *\n\t\t\t *  @type object\n\t\t\t *  @default {}\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    $.fn.dataTable.ext.type.search['title-numeric'] = function ( d ) {\n\t\t\t *      return d.replace(/\\n/g,\" \").replace( /<.*?>/g, \"\" );\n\t\t\t *    }\n\t\t\t */\n\t\t\tsearch: {},\n\t\n\t\n\t\t\t/**\n\t\t\t * Type based ordering.\n\t\t\t *\n\t\t\t * The column type tells DataTables what ordering to apply to the table\n\t\t\t * when a column is sorted upon. The order for each type that is defined,\n\t\t\t * is defined by the functions available in this object.\n\t\t\t *\n\t\t\t * Each ordering option can be described by three properties added to\n\t\t\t * this object:\n\t\t\t *\n\t\t\t * * `{type}-pre` - Pre-formatting function\n\t\t\t * * `{type}-asc` - Ascending order function\n\t\t\t * * `{type}-desc` - Descending order function\n\t\t\t *\n\t\t\t * All three can be used together, only `{type}-pre` or only\n\t\t\t * `{type}-asc` and `{type}-desc` together. It is generally recommended\n\t\t\t * that only `{type}-pre` is used, as this provides the optimal\n\t\t\t * implementation in terms of speed, although the others are provided\n\t\t\t * for compatibility with existing Javascript sort functions.\n\t\t\t *\n\t\t\t * `{type}-pre`: Functions defined take a single parameter:\n\t\t\t *\n\t\t     *  1. `{*}` Data from the column cell to be prepared for ordering\n\t\t\t *\n\t\t\t * And return:\n\t\t\t *\n\t\t\t * * `{*}` Data to be sorted upon\n\t\t\t *\n\t\t\t * `{type}-asc` and `{type}-desc`: Functions are typical Javascript sort\n\t\t\t * functions, taking two parameters:\n\t\t\t *\n\t\t     *  1. `{*}` Data to compare to the second parameter\n\t\t     *  2. `{*}` Data to compare to the first parameter\n\t\t\t *\n\t\t\t * And returning:\n\t\t\t *\n\t\t\t * * `{*}` Ordering match: <0 if first parameter should be sorted lower\n\t\t\t *   than the second parameter, ===0 if the two parameters are equal and\n\t\t\t *   >0 if the first parameter should be sorted height than the second\n\t\t\t *   parameter.\n\t\t\t * \n\t\t\t *  @type object\n\t\t\t *  @default {}\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    // Numeric ordering of formatted numbers with a pre-formatter\n\t\t\t *    $.extend( $.fn.dataTable.ext.type.order, {\n\t\t\t *      \"string-pre\": function(x) {\n\t\t\t *        a = (a === \"-\" || a === \"\") ? 0 : a.replace( /[^\\d\\-\\.]/g, \"\" );\n\t\t\t *        return parseFloat( a );\n\t\t\t *      }\n\t\t\t *    } );\n\t\t\t *\n\t\t\t *  @example\n\t\t\t *    // Case-sensitive string ordering, with no pre-formatting method\n\t\t\t *    $.extend( $.fn.dataTable.ext.order, {\n\t\t\t *      \"string-case-asc\": function(x,y) {\n\t\t\t *        return ((x < y) ? -1 : ((x > y) ? 1 : 0));\n\t\t\t *      },\n\t\t\t *      \"string-case-desc\": function(x,y) {\n\t\t\t *        return ((x < y) ? 1 : ((x > y) ? -1 : 0));\n\t\t\t *      }\n\t\t\t *    } );\n\t\t\t */\n\t\t\torder: {}\n\t\t},\n\t\n\t\t/**\n\t\t * Unique DataTables instance counter\n\t\t *\n\t\t * @type int\n\t\t * @private\n\t\t */\n\t\t_unique: 0,\n\t\n\t\n\t\t//\n\t\t// Depreciated\n\t\t// The following properties are retained for backwards compatiblity only.\n\t\t// The should not be used in new projects and will be removed in a future\n\t\t// version\n\t\t//\n\t\n\t\t/**\n\t\t * Version check function.\n\t\t *  @type function\n\t\t *  @depreciated Since 1.10\n\t\t */\n\t\tfnVersionCheck: DataTable.fnVersionCheck,\n\t\n\t\n\t\t/**\n\t\t * Index for what 'this' index API functions should use\n\t\t *  @type int\n\t\t *  @deprecated Since v1.10\n\t\t */\n\t\tiApiIndex: 0,\n\t\n\t\n\t\t/**\n\t\t * jQuery UI class container\n\t\t *  @type object\n\t\t *  @deprecated Since v1.10\n\t\t */\n\t\toJUIClasses: {},\n\t\n\t\n\t\t/**\n\t\t * Software version\n\t\t *  @type string\n\t\t *  @deprecated Since v1.10\n\t\t */\n\t\tsVersion: DataTable.version\n\t};\n\t\n\t\n\t//\n\t// Backwards compatibility. Alias to pre 1.10 Hungarian notation counter parts\n\t//\n\t$.extend( _ext, {\n\t\tafnFiltering: _ext.search,\n\t\taTypes:       _ext.type.detect,\n\t\tofnSearch:    _ext.type.search,\n\t\toSort:        _ext.type.order,\n\t\tafnSortData:  _ext.order,\n\t\taoFeatures:   _ext.feature,\n\t\toApi:         _ext.internal,\n\t\toStdClasses:  _ext.classes,\n\t\toPagination:  _ext.pager\n\t} );\n\t\n\t\n\t$.extend( DataTable.ext.classes, {\n\t\t\"sTable\": \"dataTable\",\n\t\t\"sNoFooter\": \"no-footer\",\n\t\n\t\t/* Paging buttons */\n\t\t\"sPageButton\": \"paginate_button\",\n\t\t\"sPageButtonActive\": \"current\",\n\t\t\"sPageButtonDisabled\": \"disabled\",\n\t\n\t\t/* Striping classes */\n\t\t\"sStripeOdd\": \"odd\",\n\t\t\"sStripeEven\": \"even\",\n\t\n\t\t/* Empty row */\n\t\t\"sRowEmpty\": \"dataTables_empty\",\n\t\n\t\t/* Features */\n\t\t\"sWrapper\": \"dataTables_wrapper\",\n\t\t\"sFilter\": \"dataTables_filter\",\n\t\t\"sInfo\": \"dataTables_info\",\n\t\t\"sPaging\": \"dataTables_paginate paging_\", /* Note that the type is postfixed */\n\t\t\"sLength\": \"dataTables_length\",\n\t\t\"sProcessing\": \"dataTables_processing\",\n\t\n\t\t/* Sorting */\n\t\t\"sSortAsc\": \"sorting_asc\",\n\t\t\"sSortDesc\": \"sorting_desc\",\n\t\t\"sSortable\": \"sorting\", /* Sortable in both directions */\n\t\t\"sSortableAsc\": \"sorting_asc_disabled\",\n\t\t\"sSortableDesc\": \"sorting_desc_disabled\",\n\t\t\"sSortableNone\": \"sorting_disabled\",\n\t\t\"sSortColumn\": \"sorting_\", /* Note that an int is postfixed for the sorting order */\n\t\n\t\t/* Filtering */\n\t\t\"sFilterInput\": \"\",\n\t\n\t\t/* Page length */\n\t\t\"sLengthSelect\": \"\",\n\t\n\t\t/* Scrolling */\n\t\t\"sScrollWrapper\": \"dataTables_scroll\",\n\t\t\"sScrollHead\": \"dataTables_scrollHead\",\n\t\t\"sScrollHeadInner\": \"dataTables_scrollHeadInner\",\n\t\t\"sScrollBody\": \"dataTables_scrollBody\",\n\t\t\"sScrollFoot\": \"dataTables_scrollFoot\",\n\t\t\"sScrollFootInner\": \"dataTables_scrollFootInner\",\n\t\n\t\t/* Misc */\n\t\t\"sHeaderTH\": \"\",\n\t\t\"sFooterTH\": \"\",\n\t\n\t\t// Deprecated\n\t\t\"sSortJUIAsc\": \"\",\n\t\t\"sSortJUIDesc\": \"\",\n\t\t\"sSortJUI\": \"\",\n\t\t\"sSortJUIAscAllowed\": \"\",\n\t\t\"sSortJUIDescAllowed\": \"\",\n\t\t\"sSortJUIWrapper\": \"\",\n\t\t\"sSortIcon\": \"\",\n\t\t\"sJUIHeader\": \"\",\n\t\t\"sJUIFooter\": \"\"\n\t} );\n\t\n\t\n\t(function() {\n\t\n\t// Reused strings for better compression. Closure compiler appears to have a\n\t// weird edge case where it is trying to expand strings rather than use the\n\t// variable version. This results in about 200 bytes being added, for very\n\t// little preference benefit since it this run on script load only.\n\tvar _empty = '';\n\t_empty = '';\n\t\n\tvar _stateDefault = _empty + 'ui-state-default';\n\tvar _sortIcon     = _empty + 'css_right ui-icon ui-icon-';\n\tvar _headerFooter = _empty + 'fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix';\n\t\n\t$.extend( DataTable.ext.oJUIClasses, DataTable.ext.classes, {\n\t\t/* Full numbers paging buttons */\n\t\t\"sPageButton\":         \"fg-button ui-button \"+_stateDefault,\n\t\t\"sPageButtonActive\":   \"ui-state-disabled\",\n\t\t\"sPageButtonDisabled\": \"ui-state-disabled\",\n\t\n\t\t/* Features */\n\t\t\"sPaging\": \"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi \"+\n\t\t\t\"ui-buttonset-multi paging_\", /* Note that the type is postfixed */\n\t\n\t\t/* Sorting */\n\t\t\"sSortAsc\":            _stateDefault+\" sorting_asc\",\n\t\t\"sSortDesc\":           _stateDefault+\" sorting_desc\",\n\t\t\"sSortable\":           _stateDefault+\" sorting\",\n\t\t\"sSortableAsc\":        _stateDefault+\" sorting_asc_disabled\",\n\t\t\"sSortableDesc\":       _stateDefault+\" sorting_desc_disabled\",\n\t\t\"sSortableNone\":       _stateDefault+\" sorting_disabled\",\n\t\t\"sSortJUIAsc\":         _sortIcon+\"triangle-1-n\",\n\t\t\"sSortJUIDesc\":        _sortIcon+\"triangle-1-s\",\n\t\t\"sSortJUI\":            _sortIcon+\"carat-2-n-s\",\n\t\t\"sSortJUIAscAllowed\":  _sortIcon+\"carat-1-n\",\n\t\t\"sSortJUIDescAllowed\": _sortIcon+\"carat-1-s\",\n\t\t\"sSortJUIWrapper\":     \"DataTables_sort_wrapper\",\n\t\t\"sSortIcon\":           \"DataTables_sort_icon\",\n\t\n\t\t/* Scrolling */\n\t\t\"sScrollHead\": \"dataTables_scrollHead \"+_stateDefault,\n\t\t\"sScrollFoot\": \"dataTables_scrollFoot \"+_stateDefault,\n\t\n\t\t/* Misc */\n\t\t\"sHeaderTH\":  _stateDefault,\n\t\t\"sFooterTH\":  _stateDefault,\n\t\t\"sJUIHeader\": _headerFooter+\" ui-corner-tl ui-corner-tr\",\n\t\t\"sJUIFooter\": _headerFooter+\" ui-corner-bl ui-corner-br\"\n\t} );\n\t\n\t}());\n\t\n\t\n\t\n\tvar extPagination = DataTable.ext.pager;\n\t\n\tfunction _numbers ( page, pages ) {\n\t\tvar\n\t\t\tnumbers = [],\n\t\t\tbuttons = extPagination.numbers_length,\n\t\t\thalf = Math.floor( buttons / 2 ),\n\t\t\ti = 1;\n\t\n\t\tif ( pages <= buttons ) {\n\t\t\tnumbers = _range( 0, pages );\n\t\t}\n\t\telse if ( page <= half ) {\n\t\t\tnumbers = _range( 0, buttons-2 );\n\t\t\tnumbers.push( 'ellipsis' );\n\t\t\tnumbers.push( pages-1 );\n\t\t}\n\t\telse if ( page >= pages - 1 - half ) {\n\t\t\tnumbers = _range( pages-(buttons-2), pages );\n\t\t\tnumbers.splice( 0, 0, 'ellipsis' ); // no unshift in ie6\n\t\t\tnumbers.splice( 0, 0, 0 );\n\t\t}\n\t\telse {\n\t\t\tnumbers = _range( page-half+2, page+half-1 );\n\t\t\tnumbers.push( 'ellipsis' );\n\t\t\tnumbers.push( pages-1 );\n\t\t\tnumbers.splice( 0, 0, 'ellipsis' );\n\t\t\tnumbers.splice( 0, 0, 0 );\n\t\t}\n\t\n\t\tnumbers.DT_el = 'span';\n\t\treturn numbers;\n\t}\n\t\n\t\n\t$.extend( extPagination, {\n\t\tsimple: function ( page, pages ) {\n\t\t\treturn [ 'previous', 'next' ];\n\t\t},\n\t\n\t\tfull: function ( page, pages ) {\n\t\t\treturn [  'first', 'previous', 'next', 'last' ];\n\t\t},\n\t\n\t\tnumbers: function ( page, pages ) {\n\t\t\treturn [ _numbers(page, pages) ];\n\t\t},\n\t\n\t\tsimple_numbers: function ( page, pages ) {\n\t\t\treturn [ 'previous', _numbers(page, pages), 'next' ];\n\t\t},\n\t\n\t\tfull_numbers: function ( page, pages ) {\n\t\t\treturn [ 'first', 'previous', _numbers(page, pages), 'next', 'last' ];\n\t\t},\n\t\n\t\t// For testing and plug-ins to use\n\t\t_numbers: _numbers,\n\t\n\t\t// Number of number buttons (including ellipsis) to show. _Must be odd!_\n\t\tnumbers_length: 7\n\t} );\n\t\n\t\n\t$.extend( true, DataTable.ext.renderer, {\n\t\tpageButton: {\n\t\t\t_: function ( settings, host, idx, buttons, page, pages ) {\n\t\t\t\tvar classes = settings.oClasses;\n\t\t\t\tvar lang = settings.oLanguage.oPaginate;\n\t\t\t\tvar aria = settings.oLanguage.oAria.paginate || {};\n\t\t\t\tvar btnDisplay, btnClass, counter=0;\n\t\n\t\t\t\tvar attach = function( container, buttons ) {\n\t\t\t\t\tvar i, ien, node, button;\n\t\t\t\t\tvar clickHandler = function ( e ) {\n\t\t\t\t\t\t_fnPageChange( settings, e.data.action, true );\n\t\t\t\t\t};\n\t\n\t\t\t\t\tfor ( i=0, ien=buttons.length ; i<ien ; i++ ) {\n\t\t\t\t\t\tbutton = buttons[i];\n\t\n\t\t\t\t\t\tif ( $.isArray( button ) ) {\n\t\t\t\t\t\t\tvar inner = $( '<'+(button.DT_el || 'div')+'/>' )\n\t\t\t\t\t\t\t\t.appendTo( container );\n\t\t\t\t\t\t\tattach( inner, button );\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tbtnDisplay = null;\n\t\t\t\t\t\t\tbtnClass = '';\n\t\n\t\t\t\t\t\t\tswitch ( button ) {\n\t\t\t\t\t\t\t\tcase 'ellipsis':\n\t\t\t\t\t\t\t\t\tcontainer.append('<span class=\"ellipsis\">&#x2026;</span>');\n\t\t\t\t\t\t\t\t\tbreak;\n\t\n\t\t\t\t\t\t\t\tcase 'first':\n\t\t\t\t\t\t\t\t\tbtnDisplay = lang.sFirst;\n\t\t\t\t\t\t\t\t\tbtnClass = button + (page > 0 ?\n\t\t\t\t\t\t\t\t\t\t'' : ' '+classes.sPageButtonDisabled);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\n\t\t\t\t\t\t\t\tcase 'previous':\n\t\t\t\t\t\t\t\t\tbtnDisplay = lang.sPrevious;\n\t\t\t\t\t\t\t\t\tbtnClass = button + (page > 0 ?\n\t\t\t\t\t\t\t\t\t\t'' : ' '+classes.sPageButtonDisabled);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\n\t\t\t\t\t\t\t\tcase 'next':\n\t\t\t\t\t\t\t\t\tbtnDisplay = lang.sNext;\n\t\t\t\t\t\t\t\t\tbtnClass = button + (page < pages-1 ?\n\t\t\t\t\t\t\t\t\t\t'' : ' '+classes.sPageButtonDisabled);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\n\t\t\t\t\t\t\t\tcase 'last':\n\t\t\t\t\t\t\t\t\tbtnDisplay = lang.sLast;\n\t\t\t\t\t\t\t\t\tbtnClass = button + (page < pages-1 ?\n\t\t\t\t\t\t\t\t\t\t'' : ' '+classes.sPageButtonDisabled);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tbtnDisplay = button + 1;\n\t\t\t\t\t\t\t\t\tbtnClass = page === button ?\n\t\t\t\t\t\t\t\t\t\tclasses.sPageButtonActive : '';\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\tif ( btnDisplay !== null ) {\n\t\t\t\t\t\t\t\tnode = $('<a>', {\n\t\t\t\t\t\t\t\t\t\t'class': classes.sPageButton+' '+btnClass,\n\t\t\t\t\t\t\t\t\t\t'aria-controls': settings.sTableId,\n\t\t\t\t\t\t\t\t\t\t'aria-label': aria[ button ],\n\t\t\t\t\t\t\t\t\t\t'data-dt-idx': counter,\n\t\t\t\t\t\t\t\t\t\t'tabindex': settings.iTabIndex,\n\t\t\t\t\t\t\t\t\t\t'id': idx === 0 && typeof button === 'string' ?\n\t\t\t\t\t\t\t\t\t\t\tsettings.sTableId +'_'+ button :\n\t\t\t\t\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t.html( btnDisplay )\n\t\t\t\t\t\t\t\t\t.appendTo( container );\n\t\n\t\t\t\t\t\t\t\t_fnBindAction(\n\t\t\t\t\t\t\t\t\tnode, {action: button}, clickHandler\n\t\t\t\t\t\t\t\t);\n\t\n\t\t\t\t\t\t\t\tcounter++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\t\n\t\t\t\t// IE9 throws an 'unknown error' if document.activeElement is used\n\t\t\t\t// inside an iframe or frame. Try / catch the error. Not good for\n\t\t\t\t// accessibility, but neither are frames.\n\t\t\t\tvar activeEl;\n\t\n\t\t\t\ttry {\n\t\t\t\t\t// Because this approach is destroying and recreating the paging\n\t\t\t\t\t// elements, focus is lost on the select button which is bad for\n\t\t\t\t\t// accessibility. So we want to restore focus once the draw has\n\t\t\t\t\t// completed\n\t\t\t\t\tactiveEl = $(host).find(document.activeElement).data('dt-idx');\n\t\t\t\t}\n\t\t\t\tcatch (e) {}\n\t\n\t\t\t\tattach( $(host).empty(), buttons );\n\t\n\t\t\t\tif ( activeEl ) {\n\t\t\t\t\t$(host).find( '[data-dt-idx='+activeEl+']' ).focus();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} );\n\t\n\t\n\t\n\t// Built in type detection. See model.ext.aTypes for information about\n\t// what is required from this methods.\n\t$.extend( DataTable.ext.type.detect, [\n\t\t// Plain numbers - first since V8 detects some plain numbers as dates\n\t\t// e.g. Date.parse('55') (but not all, e.g. Date.parse('22')...).\n\t\tfunction ( d, settings )\n\t\t{\n\t\t\tvar decimal = settings.oLanguage.sDecimal;\n\t\t\treturn _isNumber( d, decimal ) ? 'num'+decimal : null;\n\t\t},\n\t\n\t\t// Dates (only those recognised by the browser's Date.parse)\n\t\tfunction ( d, settings )\n\t\t{\n\t\t\t// V8 will remove any unknown characters at the start and end of the\n\t\t\t// expression, leading to false matches such as `$245.12` or `10%` being\n\t\t\t// a valid date. See forum thread 18941 for detail.\n\t\t\tif ( d && !(d instanceof Date) && ( ! _re_date_start.test(d) || ! _re_date_end.test(d) ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tvar parsed = Date.parse(d);\n\t\t\treturn (parsed !== null && !isNaN(parsed)) || _empty(d) ? 'date' : null;\n\t\t},\n\t\n\t\t// Formatted numbers\n\t\tfunction ( d, settings )\n\t\t{\n\t\t\tvar decimal = settings.oLanguage.sDecimal;\n\t\t\treturn _isNumber( d, decimal, true ) ? 'num-fmt'+decimal : null;\n\t\t},\n\t\n\t\t// HTML numeric\n\t\tfunction ( d, settings )\n\t\t{\n\t\t\tvar decimal = settings.oLanguage.sDecimal;\n\t\t\treturn _htmlNumeric( d, decimal ) ? 'html-num'+decimal : null;\n\t\t},\n\t\n\t\t// HTML numeric, formatted\n\t\tfunction ( d, settings )\n\t\t{\n\t\t\tvar decimal = settings.oLanguage.sDecimal;\n\t\t\treturn _htmlNumeric( d, decimal, true ) ? 'html-num-fmt'+decimal : null;\n\t\t},\n\t\n\t\t// HTML (this is strict checking - there must be html)\n\t\tfunction ( d, settings )\n\t\t{\n\t\t\treturn _empty( d ) || (typeof d === 'string' && d.indexOf('<') !== -1) ?\n\t\t\t\t'html' : null;\n\t\t}\n\t] );\n\t\n\t\n\t\n\t// Filter formatting functions. See model.ext.ofnSearch for information about\n\t// what is required from these methods.\n\t// \n\t// Note that additional search methods are added for the html numbers and\n\t// html formatted numbers by `_addNumericSort()` when we know what the decimal\n\t// place is\n\t\n\t\n\t$.extend( DataTable.ext.type.search, {\n\t\thtml: function ( data ) {\n\t\t\treturn _empty(data) ?\n\t\t\t\tdata :\n\t\t\t\ttypeof data === 'string' ?\n\t\t\t\t\tdata\n\t\t\t\t\t\t.replace( _re_new_lines, \" \" )\n\t\t\t\t\t\t.replace( _re_html, \"\" ) :\n\t\t\t\t\t'';\n\t\t},\n\t\n\t\tstring: function ( data ) {\n\t\t\treturn _empty(data) ?\n\t\t\t\tdata :\n\t\t\t\ttypeof data === 'string' ?\n\t\t\t\t\tdata.replace( _re_new_lines, \" \" ) :\n\t\t\t\t\tdata;\n\t\t}\n\t} );\n\t\n\t\n\t\n\tvar __numericReplace = function ( d, decimalPlace, re1, re2 ) {\n\t\tif ( d !== 0 && (!d || d === '-') ) {\n\t\t\treturn -Infinity;\n\t\t}\n\t\n\t\t// If a decimal place other than `.` is used, it needs to be given to the\n\t\t// function so we can detect it and replace with a `.` which is the only\n\t\t// decimal place Javascript recognises - it is not locale aware.\n\t\tif ( decimalPlace ) {\n\t\t\td = _numToDecimal( d, decimalPlace );\n\t\t}\n\t\n\t\tif ( d.replace ) {\n\t\t\tif ( re1 ) {\n\t\t\t\td = d.replace( re1, '' );\n\t\t\t}\n\t\n\t\t\tif ( re2 ) {\n\t\t\t\td = d.replace( re2, '' );\n\t\t\t}\n\t\t}\n\t\n\t\treturn d * 1;\n\t};\n\t\n\t\n\t// Add the numeric 'deformatting' functions for sorting and search. This is done\n\t// in a function to provide an easy ability for the language options to add\n\t// additional methods if a non-period decimal place is used.\n\tfunction _addNumericSort ( decimalPlace ) {\n\t\t$.each(\n\t\t\t{\n\t\t\t\t// Plain numbers\n\t\t\t\t\"num\": function ( d ) {\n\t\t\t\t\treturn __numericReplace( d, decimalPlace );\n\t\t\t\t},\n\t\n\t\t\t\t// Formatted numbers\n\t\t\t\t\"num-fmt\": function ( d ) {\n\t\t\t\t\treturn __numericReplace( d, decimalPlace, _re_formatted_numeric );\n\t\t\t\t},\n\t\n\t\t\t\t// HTML numeric\n\t\t\t\t\"html-num\": function ( d ) {\n\t\t\t\t\treturn __numericReplace( d, decimalPlace, _re_html );\n\t\t\t\t},\n\t\n\t\t\t\t// HTML numeric, formatted\n\t\t\t\t\"html-num-fmt\": function ( d ) {\n\t\t\t\t\treturn __numericReplace( d, decimalPlace, _re_html, _re_formatted_numeric );\n\t\t\t\t}\n\t\t\t},\n\t\t\tfunction ( key, fn ) {\n\t\t\t\t// Add the ordering method\n\t\t\t\t_ext.type.order[ key+decimalPlace+'-pre' ] = fn;\n\t\n\t\t\t\t// For HTML types add a search formatter that will strip the HTML\n\t\t\t\tif ( key.match(/^html\\-/) ) {\n\t\t\t\t\t_ext.type.search[ key+decimalPlace ] = _ext.type.search.html;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\t\n\t\n\t// Default sort methods\n\t$.extend( _ext.type.order, {\n\t\t// Dates\n\t\t\"date-pre\": function ( d ) {\n\t\t\treturn Date.parse( d ) || 0;\n\t\t},\n\t\n\t\t// html\n\t\t\"html-pre\": function ( a ) {\n\t\t\treturn _empty(a) ?\n\t\t\t\t'' :\n\t\t\t\ta.replace ?\n\t\t\t\t\ta.replace( /<.*?>/g, \"\" ).toLowerCase() :\n\t\t\t\t\ta+'';\n\t\t},\n\t\n\t\t// string\n\t\t\"string-pre\": function ( a ) {\n\t\t\t// This is a little complex, but faster than always calling toString,\n\t\t\t// http://jsperf.com/tostring-v-check\n\t\t\treturn _empty(a) ?\n\t\t\t\t'' :\n\t\t\t\ttypeof a === 'string' ?\n\t\t\t\t\ta.toLowerCase() :\n\t\t\t\t\t! a.toString ?\n\t\t\t\t\t\t'' :\n\t\t\t\t\t\ta.toString();\n\t\t},\n\t\n\t\t// string-asc and -desc are retained only for compatibility with the old\n\t\t// sort methods\n\t\t\"string-asc\": function ( x, y ) {\n\t\t\treturn ((x < y) ? -1 : ((x > y) ? 1 : 0));\n\t\t},\n\t\n\t\t\"string-desc\": function ( x, y ) {\n\t\t\treturn ((x < y) ? 1 : ((x > y) ? -1 : 0));\n\t\t}\n\t} );\n\t\n\t\n\t// Numeric sorting types - order doesn't matter here\n\t_addNumericSort( '' );\n\t\n\t\n\t$.extend( true, DataTable.ext.renderer, {\n\t\theader: {\n\t\t\t_: function ( settings, cell, column, classes ) {\n\t\t\t\t// No additional mark-up required\n\t\t\t\t// Attach a sort listener to update on sort - note that using the\n\t\t\t\t// `DT` namespace will allow the event to be removed automatically\n\t\t\t\t// on destroy, while the `dt` namespaced event is the one we are\n\t\t\t\t// listening for\n\t\t\t\t$(settings.nTable).on( 'order.dt.DT', function ( e, ctx, sorting, columns ) {\n\t\t\t\t\tif ( settings !== ctx ) { // need to check this this is the host\n\t\t\t\t\t\treturn;               // table, not a nested one\n\t\t\t\t\t}\n\t\n\t\t\t\t\tvar colIdx = column.idx;\n\t\n\t\t\t\t\tcell\n\t\t\t\t\t\t.removeClass(\n\t\t\t\t\t\t\tcolumn.sSortingClass +' '+\n\t\t\t\t\t\t\tclasses.sSortAsc +' '+\n\t\t\t\t\t\t\tclasses.sSortDesc\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.addClass( columns[ colIdx ] == 'asc' ?\n\t\t\t\t\t\t\tclasses.sSortAsc : columns[ colIdx ] == 'desc' ?\n\t\t\t\t\t\t\t\tclasses.sSortDesc :\n\t\t\t\t\t\t\t\tcolumn.sSortingClass\n\t\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t},\n\t\n\t\t\tjqueryui: function ( settings, cell, column, classes ) {\n\t\t\t\t$('<div/>')\n\t\t\t\t\t.addClass( classes.sSortJUIWrapper )\n\t\t\t\t\t.append( cell.contents() )\n\t\t\t\t\t.append( $('<span/>')\n\t\t\t\t\t\t.addClass( classes.sSortIcon+' '+column.sSortingClassJUI )\n\t\t\t\t\t)\n\t\t\t\t\t.appendTo( cell );\n\t\n\t\t\t\t// Attach a sort listener to update on sort\n\t\t\t\t$(settings.nTable).on( 'order.dt.DT', function ( e, ctx, sorting, columns ) {\n\t\t\t\t\tif ( settings !== ctx ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\n\t\t\t\t\tvar colIdx = column.idx;\n\t\n\t\t\t\t\tcell\n\t\t\t\t\t\t.removeClass( classes.sSortAsc +\" \"+classes.sSortDesc )\n\t\t\t\t\t\t.addClass( columns[ colIdx ] == 'asc' ?\n\t\t\t\t\t\t\tclasses.sSortAsc : columns[ colIdx ] == 'desc' ?\n\t\t\t\t\t\t\t\tclasses.sSortDesc :\n\t\t\t\t\t\t\t\tcolumn.sSortingClass\n\t\t\t\t\t\t);\n\t\n\t\t\t\t\tcell\n\t\t\t\t\t\t.find( 'span.'+classes.sSortIcon )\n\t\t\t\t\t\t.removeClass(\n\t\t\t\t\t\t\tclasses.sSortJUIAsc +\" \"+\n\t\t\t\t\t\t\tclasses.sSortJUIDesc +\" \"+\n\t\t\t\t\t\t\tclasses.sSortJUI +\" \"+\n\t\t\t\t\t\t\tclasses.sSortJUIAscAllowed +\" \"+\n\t\t\t\t\t\t\tclasses.sSortJUIDescAllowed\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.addClass( columns[ colIdx ] == 'asc' ?\n\t\t\t\t\t\t\tclasses.sSortJUIAsc : columns[ colIdx ] == 'desc' ?\n\t\t\t\t\t\t\t\tclasses.sSortJUIDesc :\n\t\t\t\t\t\t\t\tcolumn.sSortingClassJUI\n\t\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t} );\n\t\n\t/*\n\t * Public helper functions. These aren't used internally by DataTables, or\n\t * called by any of the options passed into DataTables, but they can be used\n\t * externally by developers working with DataTables. They are helper functions\n\t * to make working with DataTables a little bit easier.\n\t */\n\t\n\tvar __htmlEscapeEntities = function ( d ) {\n\t\treturn typeof d === 'string' ?\n\t\t\td.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;') :\n\t\t\td;\n\t};\n\t\n\t/**\n\t * Helpers for `columns.render`.\n\t *\n\t * The options defined here can be used with the `columns.render` initialisation\n\t * option to provide a display renderer. The following functions are defined:\n\t *\n\t * * `number` - Will format numeric data (defined by `columns.data`) for\n\t *   display, retaining the original unformatted data for sorting and filtering.\n\t *   It takes 5 parameters:\n\t *   * `string` - Thousands grouping separator\n\t *   * `string` - Decimal point indicator\n\t *   * `integer` - Number of decimal points to show\n\t *   * `string` (optional) - Prefix.\n\t *   * `string` (optional) - Postfix (/suffix).\n\t * * `text` - Escape HTML to help prevent XSS attacks. It has no optional\n\t *   parameters.\n\t *\n\t * @example\n\t *   // Column definition using the number renderer\n\t *   {\n\t *     data: \"salary\",\n\t *     render: $.fn.dataTable.render.number( '\\'', '.', 0, '$' )\n\t *   }\n\t *\n\t * @namespace\n\t */\n\tDataTable.render = {\n\t\tnumber: function ( thousands, decimal, precision, prefix, postfix ) {\n\t\t\treturn {\n\t\t\t\tdisplay: function ( d ) {\n\t\t\t\t\tif ( typeof d !== 'number' && typeof d !== 'string' ) {\n\t\t\t\t\t\treturn d;\n\t\t\t\t\t}\n\t\n\t\t\t\t\tvar negative = d < 0 ? '-' : '';\n\t\t\t\t\tvar flo = parseFloat( d );\n\t\n\t\t\t\t\t// If NaN then there isn't much formatting that we can do - just\n\t\t\t\t\t// return immediately, escaping any HTML (this was supposed to\n\t\t\t\t\t// be a number after all)\n\t\t\t\t\tif ( isNaN( flo ) ) {\n\t\t\t\t\t\treturn __htmlEscapeEntities( d );\n\t\t\t\t\t}\n\t\n\t\t\t\t\td = Math.abs( flo );\n\t\n\t\t\t\t\tvar intPart = parseInt( d, 10 );\n\t\t\t\t\tvar floatPart = precision ?\n\t\t\t\t\t\tdecimal+(d - intPart).toFixed( precision ).substring( 2 ):\n\t\t\t\t\t\t'';\n\t\n\t\t\t\t\treturn negative + (prefix||'') +\n\t\t\t\t\t\tintPart.toString().replace(\n\t\t\t\t\t\t\t/\\B(?=(\\d{3})+(?!\\d))/g, thousands\n\t\t\t\t\t\t) +\n\t\t\t\t\t\tfloatPart +\n\t\t\t\t\t\t(postfix||'');\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\n\t\ttext: function () {\n\t\t\treturn {\n\t\t\t\tdisplay: __htmlEscapeEntities\n\t\t\t};\n\t\t}\n\t};\n\t\n\t\n\t/*\n\t * This is really a good bit rubbish this method of exposing the internal methods\n\t * publicly... - To be fixed in 2.0 using methods on the prototype\n\t */\n\t\n\t\n\t/**\n\t * Create a wrapper function for exporting an internal functions to an external API.\n\t *  @param {string} fn API function name\n\t *  @returns {function} wrapped function\n\t *  @memberof DataTable#internal\n\t */\n\tfunction _fnExternApiFunc (fn)\n\t{\n\t\treturn function() {\n\t\t\tvar args = [_fnSettingsFromNode( this[DataTable.ext.iApiIndex] )].concat(\n\t\t\t\tArray.prototype.slice.call(arguments)\n\t\t\t);\n\t\t\treturn DataTable.ext.internal[fn].apply( this, args );\n\t\t};\n\t}\n\t\n\t\n\t/**\n\t * Reference to internal functions for use by plug-in developers. Note that\n\t * these methods are references to internal functions and are considered to be\n\t * private. If you use these methods, be aware that they are liable to change\n\t * between versions.\n\t *  @namespace\n\t */\n\t$.extend( DataTable.ext.internal, {\n\t\t_fnExternApiFunc: _fnExternApiFunc,\n\t\t_fnBuildAjax: _fnBuildAjax,\n\t\t_fnAjaxUpdate: _fnAjaxUpdate,\n\t\t_fnAjaxParameters: _fnAjaxParameters,\n\t\t_fnAjaxUpdateDraw: _fnAjaxUpdateDraw,\n\t\t_fnAjaxDataSrc: _fnAjaxDataSrc,\n\t\t_fnAddColumn: _fnAddColumn,\n\t\t_fnColumnOptions: _fnColumnOptions,\n\t\t_fnAdjustColumnSizing: _fnAdjustColumnSizing,\n\t\t_fnVisibleToColumnIndex: _fnVisibleToColumnIndex,\n\t\t_fnColumnIndexToVisible: _fnColumnIndexToVisible,\n\t\t_fnVisbleColumns: _fnVisbleColumns,\n\t\t_fnGetColumns: _fnGetColumns,\n\t\t_fnColumnTypes: _fnColumnTypes,\n\t\t_fnApplyColumnDefs: _fnApplyColumnDefs,\n\t\t_fnHungarianMap: _fnHungarianMap,\n\t\t_fnCamelToHungarian: _fnCamelToHungarian,\n\t\t_fnLanguageCompat: _fnLanguageCompat,\n\t\t_fnBrowserDetect: _fnBrowserDetect,\n\t\t_fnAddData: _fnAddData,\n\t\t_fnAddTr: _fnAddTr,\n\t\t_fnNodeToDataIndex: _fnNodeToDataIndex,\n\t\t_fnNodeToColumnIndex: _fnNodeToColumnIndex,\n\t\t_fnGetCellData: _fnGetCellData,\n\t\t_fnSetCellData: _fnSetCellData,\n\t\t_fnSplitObjNotation: _fnSplitObjNotation,\n\t\t_fnGetObjectDataFn: _fnGetObjectDataFn,\n\t\t_fnSetObjectDataFn: _fnSetObjectDataFn,\n\t\t_fnGetDataMaster: _fnGetDataMaster,\n\t\t_fnClearTable: _fnClearTable,\n\t\t_fnDeleteIndex: _fnDeleteIndex,\n\t\t_fnInvalidate: _fnInvalidate,\n\t\t_fnGetRowElements: _fnGetRowElements,\n\t\t_fnCreateTr: _fnCreateTr,\n\t\t_fnBuildHead: _fnBuildHead,\n\t\t_fnDrawHead: _fnDrawHead,\n\t\t_fnDraw: _fnDraw,\n\t\t_fnReDraw: _fnReDraw,\n\t\t_fnAddOptionsHtml: _fnAddOptionsHtml,\n\t\t_fnDetectHeader: _fnDetectHeader,\n\t\t_fnGetUniqueThs: _fnGetUniqueThs,\n\t\t_fnFeatureHtmlFilter: _fnFeatureHtmlFilter,\n\t\t_fnFilterComplete: _fnFilterComplete,\n\t\t_fnFilterCustom: _fnFilterCustom,\n\t\t_fnFilterColumn: _fnFilterColumn,\n\t\t_fnFilter: _fnFilter,\n\t\t_fnFilterCreateSearch: _fnFilterCreateSearch,\n\t\t_fnEscapeRegex: _fnEscapeRegex,\n\t\t_fnFilterData: _fnFilterData,\n\t\t_fnFeatureHtmlInfo: _fnFeatureHtmlInfo,\n\t\t_fnUpdateInfo: _fnUpdateInfo,\n\t\t_fnInfoMacros: _fnInfoMacros,\n\t\t_fnInitialise: _fnInitialise,\n\t\t_fnInitComplete: _fnInitComplete,\n\t\t_fnLengthChange: _fnLengthChange,\n\t\t_fnFeatureHtmlLength: _fnFeatureHtmlLength,\n\t\t_fnFeatureHtmlPaginate: _fnFeatureHtmlPaginate,\n\t\t_fnPageChange: _fnPageChange,\n\t\t_fnFeatureHtmlProcessing: _fnFeatureHtmlProcessing,\n\t\t_fnProcessingDisplay: _fnProcessingDisplay,\n\t\t_fnFeatureHtmlTable: _fnFeatureHtmlTable,\n\t\t_fnScrollDraw: _fnScrollDraw,\n\t\t_fnApplyToChildren: _fnApplyToChildren,\n\t\t_fnCalculateColumnWidths: _fnCalculateColumnWidths,\n\t\t_fnThrottle: _fnThrottle,\n\t\t_fnConvertToWidth: _fnConvertToWidth,\n\t\t_fnGetWidestNode: _fnGetWidestNode,\n\t\t_fnGetMaxLenString: _fnGetMaxLenString,\n\t\t_fnStringToCss: _fnStringToCss,\n\t\t_fnSortFlatten: _fnSortFlatten,\n\t\t_fnSort: _fnSort,\n\t\t_fnSortAria: _fnSortAria,\n\t\t_fnSortListener: _fnSortListener,\n\t\t_fnSortAttachListener: _fnSortAttachListener,\n\t\t_fnSortingClasses: _fnSortingClasses,\n\t\t_fnSortData: _fnSortData,\n\t\t_fnSaveState: _fnSaveState,\n\t\t_fnLoadState: _fnLoadState,\n\t\t_fnSettingsFromNode: _fnSettingsFromNode,\n\t\t_fnLog: _fnLog,\n\t\t_fnMap: _fnMap,\n\t\t_fnBindAction: _fnBindAction,\n\t\t_fnCallbackReg: _fnCallbackReg,\n\t\t_fnCallbackFire: _fnCallbackFire,\n\t\t_fnLengthOverflow: _fnLengthOverflow,\n\t\t_fnRenderer: _fnRenderer,\n\t\t_fnDataSource: _fnDataSource,\n\t\t_fnRowAttributes: _fnRowAttributes,\n\t\t_fnCalculateEnd: function () {} // Used by a lot of plug-ins, but redundant\n\t\t                                // in 1.10, so this dead-end function is\n\t\t                                // added to prevent errors\n\t} );\n\t\n\n\t// jQuery access\n\t$.fn.dataTable = DataTable;\n\n\t// Provide access to the host jQuery object (circular reference)\n\tDataTable.$ = $;\n\n\t// Legacy aliases\n\t$.fn.dataTableSettings = DataTable.settings;\n\t$.fn.dataTableExt = DataTable.ext;\n\n\t// With a capital `D` we return a DataTables API instance rather than a\n\t// jQuery object\n\t$.fn.DataTable = function ( opts ) {\n\t\treturn $(this).dataTable( opts ).api();\n\t};\n\n\t// All properties that are available to $.fn.dataTable should also be\n\t// available on $.fn.DataTable\n\t$.each( DataTable, function ( prop, val ) {\n\t\t$.fn.DataTable[ prop ] = val;\n\t} );\n\n\n\t// Information about events fired by DataTables - for documentation.\n\t/**\n\t * Draw event, fired whenever the table is redrawn on the page, at the same\n\t * point as fnDrawCallback. This may be useful for binding events or\n\t * performing calculations when the table is altered at all.\n\t *  @name DataTable#draw.dt\n\t *  @event\n\t *  @param {event} e jQuery event object\n\t *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}\n\t */\n\n\t/**\n\t * Search event, fired when the searching applied to the table (using the\n\t * built-in global search, or column filters) is altered.\n\t *  @name DataTable#search.dt\n\t *  @event\n\t *  @param {event} e jQuery event object\n\t *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}\n\t */\n\n\t/**\n\t * Page change event, fired when the paging of the table is altered.\n\t *  @name DataTable#page.dt\n\t *  @event\n\t *  @param {event} e jQuery event object\n\t *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}\n\t */\n\n\t/**\n\t * Order event, fired when the ordering applied to the table is altered.\n\t *  @name DataTable#order.dt\n\t *  @event\n\t *  @param {event} e jQuery event object\n\t *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}\n\t */\n\n\t/**\n\t * DataTables initialisation complete event, fired when the table is fully\n\t * drawn, including Ajax data loaded, if Ajax data is required.\n\t *  @name DataTable#init.dt\n\t *  @event\n\t *  @param {event} e jQuery event object\n\t *  @param {object} oSettings DataTables settings object\n\t *  @param {object} json The JSON object request from the server - only\n\t *    present if client-side Ajax sourced data is used</li></ol>\n\t */\n\n\t/**\n\t * State save event, fired when the table has changed state a new state save\n\t * is required. This event allows modification of the state saving object\n\t * prior to actually doing the save, including addition or other state\n\t * properties (for plug-ins) or modification of a DataTables core property.\n\t *  @name DataTable#stateSaveParams.dt\n\t *  @event\n\t *  @param {event} e jQuery event object\n\t *  @param {object} oSettings DataTables settings object\n\t *  @param {object} json The state information to be saved\n\t */\n\n\t/**\n\t * State load event, fired when the table is loading state from the stored\n\t * data, but prior to the settings object being modified by the saved state\n\t * - allowing modification of the saved state is required or loading of\n\t * state for a plug-in.\n\t *  @name DataTable#stateLoadParams.dt\n\t *  @event\n\t *  @param {event} e jQuery event object\n\t *  @param {object} oSettings DataTables settings object\n\t *  @param {object} json The saved state information\n\t */\n\n\t/**\n\t * State loaded event, fired when state has been loaded from stored data and\n\t * the settings object has been modified by the loaded data.\n\t *  @name DataTable#stateLoaded.dt\n\t *  @event\n\t *  @param {event} e jQuery event object\n\t *  @param {object} oSettings DataTables settings object\n\t *  @param {object} json The saved state information\n\t */\n\n\t/**\n\t * Processing event, fired when DataTables is doing some kind of processing\n\t * (be it, order, searcg or anything else). It can be used to indicate to\n\t * the end user that there is something happening, or that something has\n\t * finished.\n\t *  @name DataTable#processing.dt\n\t *  @event\n\t *  @param {event} e jQuery event object\n\t *  @param {object} oSettings DataTables settings object\n\t *  @param {boolean} bShow Flag for if DataTables is doing processing or not\n\t */\n\n\t/**\n\t * Ajax (XHR) event, fired whenever an Ajax request is completed from a\n\t * request to made to the server for new data. This event is called before\n\t * DataTables processed the returned data, so it can also be used to pre-\n\t * process the data returned from the server, if needed.\n\t *\n\t * Note that this trigger is called in `fnServerData`, if you override\n\t * `fnServerData` and which to use this event, you need to trigger it in you\n\t * success function.\n\t *  @name DataTable#xhr.dt\n\t *  @event\n\t *  @param {event} e jQuery event object\n\t *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}\n\t *  @param {object} json JSON returned from the server\n\t *\n\t *  @example\n\t *     // Use a custom property returned from the server in another DOM element\n\t *     $('#table').dataTable().on('xhr.dt', function (e, settings, json) {\n\t *       $('#status').html( json.status );\n\t *     } );\n\t *\n\t *  @example\n\t *     // Pre-process the data returned from the server\n\t *     $('#table').dataTable().on('xhr.dt', function (e, settings, json) {\n\t *       for ( var i=0, ien=json.aaData.length ; i<ien ; i++ ) {\n\t *         json.aaData[i].sum = json.aaData[i].one + json.aaData[i].two;\n\t *       }\n\t *       // Note no return - manipulate the data directly in the JSON object.\n\t *     } );\n\t */\n\n\t/**\n\t * Destroy event, fired when the DataTable is destroyed by calling fnDestroy\n\t * or passing the bDestroy:true parameter in the initialisation object. This\n\t * can be used to remove bound events, added DOM nodes, etc.\n\t *  @name DataTable#destroy.dt\n\t *  @event\n\t *  @param {event} e jQuery event object\n\t *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}\n\t */\n\n\t/**\n\t * Page length change event, fired when number of records to show on each\n\t * page (the length) is changed.\n\t *  @name DataTable#length.dt\n\t *  @event\n\t *  @param {event} e jQuery event object\n\t *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}\n\t *  @param {integer} len New length\n\t */\n\n\t/**\n\t * Column sizing has changed.\n\t *  @name DataTable#column-sizing.dt\n\t *  @event\n\t *  @param {event} e jQuery event object\n\t *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}\n\t */\n\n\t/**\n\t * Column visibility has changed.\n\t *  @name DataTable#column-visibility.dt\n\t *  @event\n\t *  @param {event} e jQuery event object\n\t *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}\n\t *  @param {int} column Column index\n\t *  @param {bool} vis `false` if column now hidden, or `true` if visible\n\t */\n\n\treturn $.fn.dataTable;\n}));\n"},{"col":4,"comment":"null","endLoc":174,"header":"def __init__(self,lexer=None)","id":11419,"name":"__init__","nodeType":"Function","startLoc":160,"text":"def __init__(self,lexer=None):\n        if lexer is None:\n            lexer = lex.lexer\n        self.lexer = lexer\n        self.macros = { }\n        self.path = []\n        self.temp_path = []\n\n        # Probe the lexer for selected tokens\n        self.lexprobe()\n\n        tm = time.localtime()\n        self.define(\"__DATE__ \\\"%s\\\"\" % time.strftime(\"%b %d %Y\",tm))\n        self.define(\"__TIME__ \\\"%s\\\"\" % time.strftime(\"%H:%M:%S\",tm))\n        self.parser = None"},{"col":4,"comment":"null","endLoc":913,"header":"def min(self, axis=None, out=None, **kwargs)","id":11420,"name":"min","nodeType":"Function","startLoc":911,"text":"def min(self, axis=None, out=None, **kwargs):\n        return super().min(axis=axis, out=out,\n                           **self._reduce_defaults(kwargs, np.nanmax))"},{"id":11421,"name":"jquery-3.1.1.min.js","nodeType":"TextFile","path":"astropy/extern/jquery/data/js","text":"/*! jQuery v3.1.1 | (c) jQuery Foundation | jquery.org/license */\n!function(a,b){\"use strict\";\"object\"==typeof module&&\"object\"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error(\"jQuery requires a window with a document\");return b(a)}:b(a)}(\"undefined\"!=typeof window?window:this,function(a,b){\"use strict\";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement(\"script\");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q=\"3.1.1\",r=function(a,b){return new r.fn.init(a,b)},s=/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c<b?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for(\"boolean\"==typeof g&&(j=g,g=arguments[h]||{},h++),\"object\"==typeof g||r.isFunction(g)||(g={}),h===i&&(g=this,h--);h<i;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=r.isArray(d)))?(e?(e=!1,f=c&&r.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:\"jQuery\"+(q+Math.random()).replace(/\\D/g,\"\"),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return\"function\"===r.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return(\"number\"===b||\"string\"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return!(!a||\"[object Object]\"!==k.call(a))&&(!(b=e(a))||(c=l.call(b,\"constructor\")&&b.constructor,\"function\"==typeof c&&m.call(c)===n))},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+\"\":\"object\"==typeof a||\"function\"==typeof a?j[k.call(a)]||\"object\":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,\"ms-\").replace(u,v)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;d<c;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?\"\":(a+\"\").replace(s,\"\")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,\"string\"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;f<g;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;f<d;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;if(\"string\"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a))return d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e},now:Date.now,support:o}),\"function\"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each(\"Boolean Number String Function Array Date RegExp Object Error Symbol\".split(\" \"),function(a,b){j[\"[object \"+b+\"]\"]=b.toLowerCase()});function w(a){var b=!!a&&\"length\"in a&&a.length,c=r.type(a);return\"function\"!==c&&!r.isWindow(a)&&(\"array\"===c||0===b||\"number\"==typeof b&&b>0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u=\"sizzle\"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},J=\"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped\",K=\"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\",L=\"(?:\\\\\\\\.|[\\\\w-]|[^\\0-\\\\xa0])+\",M=\"\\\\[\"+K+\"*(\"+L+\")(?:\"+K+\"*([*^$|!~]?=)\"+K+\"*(?:'((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\"|(\"+L+\"))|)\"+K+\"*\\\\]\",N=\":(\"+L+\")(?:\\\\((('((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\")|((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|\"+M+\")*)|.*)\\\\)|)\",O=new RegExp(K+\"+\",\"g\"),P=new RegExp(\"^\"+K+\"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\"+K+\"+$\",\"g\"),Q=new RegExp(\"^\"+K+\"*,\"+K+\"*\"),R=new RegExp(\"^\"+K+\"*([>+~]|\"+K+\")\"+K+\"*\"),S=new RegExp(\"=\"+K+\"*([^\\\\]'\\\"]*?)\"+K+\"*\\\\]\",\"g\"),T=new RegExp(N),U=new RegExp(\"^\"+L+\"$\"),V={ID:new RegExp(\"^#(\"+L+\")\"),CLASS:new RegExp(\"^\\\\.(\"+L+\")\"),TAG:new RegExp(\"^(\"+L+\"|[*])\"),ATTR:new RegExp(\"^\"+M),PSEUDO:new RegExp(\"^\"+N),CHILD:new RegExp(\"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(\"+K+\"*(even|odd|(([+-]|)(\\\\d*)n|)\"+K+\"*(?:([+-]|)\"+K+\"*(\\\\d+)|))\"+K+\"*\\\\)|)\",\"i\"),bool:new RegExp(\"^(?:\"+J+\")$\",\"i\"),needsContext:new RegExp(\"^\"+K+\"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\"+K+\"*((?:-\\\\d)?\\\\d*)\"+K+\"*\\\\)|)(?=[^-]|$)\",\"i\")},W=/^(?:input|select|textarea|button)$/i,X=/^h\\d$/i,Y=/^[^{]+\\{\\s*\\[native \\w/,Z=/^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/,$=/[+~]/,_=new RegExp(\"\\\\\\\\([\\\\da-f]{1,6}\"+K+\"?|(\"+K+\")|.)\",\"ig\"),aa=function(a,b,c){var d=\"0x\"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\\0-\\x1f\\x7f]|^-?\\d)|^-$|[^\\0-\\x1f\\x7f-\\uFFFF\\w-]/g,ca=function(a,b){return b?\"\\0\"===a?\"\\ufffd\":a.slice(0,-1)+\"\\\\\"+a.charCodeAt(a.length-1).toString(16)+\" \":\"\\\\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&(\"form\"in a||\"label\"in a)},{dir:\"parentNode\",next:\"legend\"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],\"string\"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+\" \"]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if(\"object\"!==b.nodeName.toLowerCase()){(k=b.getAttribute(\"id\"))?k=k.replace(ba,ca):b.setAttribute(\"id\",k=u),o=g(a),h=o.length;while(h--)o[h]=\"#\"+k+\" \"+sa(o[h]);r=o.join(\",\"),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute(\"id\")}}}return i(a.replace(P,\"$1\"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+\" \")>d.cacheLength&&delete b[a.shift()],b[c+\" \"]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement(\"fieldset\");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split(\"|\"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return\"input\"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return(\"input\"===c||\"button\"===c)&&b.type===a}}function oa(a){return function(b){return\"form\"in b?b.parentNode&&b.disabled===!1?\"label\"in b?\"label\"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:\"label\"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&\"undefined\"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&\"HTML\"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener(\"unload\",da,!1):e.attachEvent&&e.attachEvent(\"onunload\",da)),c.attributes=ja(function(a){return a.className=\"i\",!a.getAttribute(\"className\")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment(\"\")),!a.getElementsByTagName(\"*\").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute(\"id\")===b}},d.find.ID=function(a,b){if(\"undefined\"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c=\"undefined\"!=typeof a.getAttributeNode&&a.getAttributeNode(\"id\");return c&&c.value===b}},d.find.ID=function(a,b){if(\"undefined\"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode(\"id\"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode(\"id\"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return\"undefined\"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if(\"*\"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if(\"undefined\"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML=\"<a id='\"+u+\"'></a><select id='\"+u+\"-\\r\\\\' msallowcapture=''><option selected=''></option></select>\",a.querySelectorAll(\"[msallowcapture^='']\").length&&q.push(\"[*^$]=\"+K+\"*(?:''|\\\"\\\")\"),a.querySelectorAll(\"[selected]\").length||q.push(\"\\\\[\"+K+\"*(?:value|\"+J+\")\"),a.querySelectorAll(\"[id~=\"+u+\"-]\").length||q.push(\"~=\"),a.querySelectorAll(\":checked\").length||q.push(\":checked\"),a.querySelectorAll(\"a#\"+u+\"+*\").length||q.push(\".#.+[+~]\")}),ja(function(a){a.innerHTML=\"<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>\";var b=n.createElement(\"input\");b.setAttribute(\"type\",\"hidden\"),a.appendChild(b).setAttribute(\"name\",\"D\"),a.querySelectorAll(\"[name=d]\").length&&q.push(\"name\"+K+\"*[*^$|!~]?=\"),2!==a.querySelectorAll(\":enabled\").length&&q.push(\":enabled\",\":disabled\"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(\":disabled\").length&&q.push(\":enabled\",\":disabled\"),a.querySelectorAll(\"*,:x\"),q.push(\",.*:\")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,\"*\"),s.call(a,\"[s!='']:x\"),r.push(\"!=\",N)}),q=q.length&&new RegExp(q.join(\"|\")),r=r.length&&new RegExp(r.join(\"|\")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,\"='$1']\"),c.matchesSelector&&p&&!A[b+\" \"]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+\"\").replace(ba,ca)},ga.error=function(a){throw new Error(\"Syntax error, unrecognized expression: \"+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c=\"\",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if(\"string\"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{\">\":{dir:\"parentNode\",first:!0},\" \":{dir:\"parentNode\"},\"+\":{dir:\"previousSibling\",first:!0},\"~\":{dir:\"previousSibling\"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||\"\").replace(_,aa),\"~=\"===a[2]&&(a[3]=\" \"+a[3]+\" \"),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),\"nth\"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*(\"even\"===a[3]||\"odd\"===a[3])),a[5]=+(a[7]+a[8]||\"odd\"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||\"\":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(\")\",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return\"*\"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+\" \"];return b||(b=new RegExp(\"(^|\"+K+\")\"+a+\"(\"+K+\"|$)\"))&&y(a,function(a){return b.test(\"string\"==typeof a.className&&a.className||\"undefined\"!=typeof a.getAttribute&&a.getAttribute(\"class\")||\"\")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?\"!=\"===b:!b||(e+=\"\",\"=\"===b?e===c:\"!=\"===b?e!==c:\"^=\"===b?c&&0===e.indexOf(c):\"*=\"===b?c&&e.indexOf(c)>-1:\"$=\"===b?c&&e.slice(-c.length)===c:\"~=\"===b?(\" \"+e.replace(O,\" \")+\" \").indexOf(c)>-1:\"|=\"===b&&(e===c||e.slice(0,c.length+1)===c+\"-\"))}},CHILD:function(a,b,c,d,e){var f=\"nth\"!==a.slice(0,3),g=\"last\"!==a.slice(-4),h=\"of-type\"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?\"nextSibling\":\"previousSibling\",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p=\"only\"===a&&!o&&\"nextSibling\"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error(\"unsupported pseudo: \"+a);return e[u]?e(b):e.length>1?(c=[a,a,\"\",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,\"$1\"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||\"\")||ga.error(\"unsupported lang: \"+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute(\"xml:lang\")||b.getAttribute(\"lang\"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+\"-\");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return\"input\"===b&&!!a.checked||\"option\"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return\"input\"===b&&\"button\"===a.type||\"button\"===b},text:function(a){var b;return\"input\"===a.nodeName.toLowerCase()&&\"text\"===a.type&&(null==(b=a.getAttribute(\"type\"))||\"text\"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c<b;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;c<b;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function ra(){}ra.prototype=d.filters=d.pseudos,d.setFilters=new ra,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+\" \"];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=Q.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P,\" \")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function sa(a){for(var b=0,c=a.length,d=\"\";b<c;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&&\"parentNode\"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e);return!1}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&&a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&&e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&&j[0]===w&&j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}return!1}}function ua(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d<e;d++)ga(a,b[d],c);return c}function wa(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;h<i;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function xa(a,b,c,d,e,f){return d&&!d[u]&&(d=xa(d)),e&&!e[u]&&(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||\"*\",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=wa(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[\" \"],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i<f;i++)if(c=d.relative[a[i].type])m=[ta(ua(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;e<f;e++)if(d.relative[a[e].type])break;return xa(i>1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:\" \"===a[i-2].type?\"*\":\"\"})).replace(P,\"$1\"),c,i<e&&ya(a.slice(i,e)),e<f&&ya(a=a.slice(e)),e<f&&sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s=\"0\",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG(\"*\",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+\" \"];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m=\"function\"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&\"ID\"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split(\"\").sort(B).join(\"\")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement(\"fieldset\"))}),ja(function(a){return a.innerHTML=\"<a href='#'></a>\",\"#\"===a.firstChild.getAttribute(\"href\")})||ka(\"type|href|height|width\",function(a,b,c){if(!c)return a.getAttribute(b,\"type\"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML=\"<input/>\",a.firstChild.setAttribute(\"value\",\"\"),\"\"===a.firstChild.getAttribute(\"value\")})||ka(\"value\",function(a,b,c){if(!c&&\"input\"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute(\"disabled\")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[\":\"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\\/\\0>:\\x20\\t\\r\\n\\f]*)[\\x20\\t\\r\\n\\f]*\\/?>(?:<\\/\\1>|)$/i,C=/^.[^:#\\[\\.,]*$/;function D(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):\"string\"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):C.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=\":not(\"+a+\")\"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if(\"string\"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b<d;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;b<d;b++)r.find(a,e[b],c);return d>1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,\"string\"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\\s*(<[\\w\\W]+>)[^>]*|#([\\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,\"string\"==typeof a){if(e=\"<\"===a[0]&&\">\"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a<c;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g=\"string\"!=typeof a&&r(a);if(!A.test(a))for(;d<e;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?\"string\"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,\"parentNode\")},parentsUntil:function(a,b,c){return y(a,\"parentNode\",c)},next:function(a){return J(a,\"nextSibling\")},prev:function(a){return J(a,\"previousSibling\")},nextAll:function(a){return y(a,\"nextSibling\")},prevAll:function(a){return y(a,\"previousSibling\")},nextUntil:function(a,b,c){return y(a,\"nextSibling\",c)},prevUntil:function(a,b,c){return y(a,\"previousSibling\",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return\"Until\"!==a.slice(-5)&&(d=c),d&&\"string\"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/[^\\x20\\t\\r\\n\\f]+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a=\"string\"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:\"\")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){r.each(b,function(b,c){r.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&\"string\"!==r.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return r.each(arguments,function(a,b){var c;while((c=r.inArray(b,f,c))>-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c=\"\",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=\"\"),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[[\"notify\",\"progress\",r.Callbacks(\"memory\"),r.Callbacks(\"memory\"),2],[\"resolve\",\"done\",r.Callbacks(\"once memory\"),r.Callbacks(\"once memory\"),0,\"resolved\"],[\"reject\",\"fail\",r.Callbacks(\"once memory\"),r.Callbacks(\"once memory\"),1,\"rejected\"]],d=\"pending\",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},\"catch\":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+\"With\"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b<f)){if(a=d.apply(h,i),a===c.promise())throw new TypeError(\"Thenable self-resolution\");j=a&&(\"object\"==typeof a||\"function\"==typeof a)&&a.then,r.isFunction(j)?e?j.call(a,g(f,c,M,e),g(f,c,N,e)):(f++,j.call(a,g(f,c,M,e),g(f,c,N,e),g(f,c,M,c.notifyWith))):(d!==M&&(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&&r.Deferred.exceptionHook(a,k.stackTrace),b+1>=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+\"With\"](this===f?void 0:this,arguments),this},f[b[0]+\"With\"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(O(a,g.done(h(c)).resolve,g.reject),\"pending\"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn(\"jQuery.Deferred exception: \"+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a)[\"catch\"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener(\"DOMContentLoaded\",R),\na.removeEventListener(\"load\",R),r.ready()}\"complete\"===d.readyState||\"loading\"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener(\"DOMContentLoaded\",R),a.addEventListener(\"load\",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if(\"object\"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h<i;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},T=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function U(){this.expando=r.expando+U.uid++}U.uid=1,U.prototype={cache:function(a){var b=a[this.expando];return b||(b={},T(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if(\"string\"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&\"string\"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){r.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(K)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var V=new U,W=new U,X=/^(?:\\{[\\w\\W]*\\}|\\[[\\w\\W]*\\])$/,Y=/[A-Z]/g;function Z(a){return\"true\"===a||\"false\"!==a&&(\"null\"===a?null:a===+a+\"\"?+a:X.test(a)?JSON.parse(a):a)}function $(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d=\"data-\"+b.replace(Y,\"-$&\").toLowerCase(),c=a.getAttribute(d),\"string\"==typeof c){try{c=Z(c)}catch(e){}W.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return W.hasData(a)||V.hasData(a)},data:function(a,b,c){return W.access(a,b,c)},removeData:function(a,b){W.remove(a,b)},_data:function(a,b,c){return V.access(a,b,c)},_removeData:function(a,b){V.remove(a,b)}}),r.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=W.get(f),1===f.nodeType&&!V.get(f,\"hasDataAttrs\"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf(\"data-\")&&(d=r.camelCase(d.slice(5)),$(f,d,e[d])));V.set(f,\"hasDataAttrs\",!0)}return e}return\"object\"==typeof a?this.each(function(){W.set(this,a)}):S(this,function(b){var c;if(f&&void 0===b){if(c=W.get(f,a),void 0!==c)return c;if(c=$(f,a),void 0!==c)return c}else this.each(function(){W.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||\"fx\")+\"queue\",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||\"fx\";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};\"inprogress\"===e&&(e=c.shift(),d--),e&&(\"fx\"===b&&c.unshift(\"inprogress\"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+\"queueHooks\";return V.get(a,c)||V.access(a,c,{empty:r.Callbacks(\"once memory\").add(function(){V.remove(a,[b+\"queue\",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return\"string\"!=typeof a&&(b=a,a=\"fx\",c--),arguments.length<c?r.queue(this[0],a):void 0===b?this:this.each(function(){var c=r.queue(this,a,b);r._queueHooks(this,a),\"fx\"===a&&\"inprogress\"!==c[0]&&r.dequeue(this,a)})},dequeue:function(a){return this.each(function(){r.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||\"fx\",[])},promise:function(a,b){var c,d=1,e=r.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};\"string\"!=typeof a&&(b=a,a=void 0),a=a||\"fx\";while(g--)c=V.get(f[g],a+\"queueHooks\"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var _=/[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/.source,aa=new RegExp(\"^(?:([+-])=|)(\"+_+\")([a-z%]*)$\",\"i\"),ba=[\"Top\",\"Right\",\"Bottom\",\"Left\"],ca=function(a,b){return a=b||a,\"none\"===a.style.display||\"\"===a.style.display&&r.contains(a.ownerDocument,a)&&\"none\"===r.css(a,\"display\")},da=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};function ea(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return r.css(a,b,\"\")},i=h(),j=c&&c[3]||(r.cssNumber[b]?\"\":\"px\"),k=(r.cssNumber[b]||\"px\"!==j&&+i)&&aa.exec(r.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||\".5\",k/=f,r.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var fa={};function ga(a){var b,c=a.ownerDocument,d=a.nodeName,e=fa[d];return e?e:(b=c.body.appendChild(c.createElement(d)),e=r.css(b,\"display\"),b.parentNode.removeChild(b),\"none\"===e&&(e=\"block\"),fa[d]=e,e)}function ha(a,b){for(var c,d,e=[],f=0,g=a.length;f<g;f++)d=a[f],d.style&&(c=d.style.display,b?(\"none\"===c&&(e[f]=V.get(d,\"display\")||null,e[f]||(d.style.display=\"\")),\"\"===d.style.display&&ca(d)&&(e[f]=ga(d))):\"none\"!==c&&(e[f]=\"none\",V.set(d,\"display\",c)));for(f=0;f<g;f++)null!=e[f]&&(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ha(this,!0)},hide:function(){return ha(this)},toggle:function(a){return\"boolean\"==typeof a?a?this.show():this.hide():this.each(function(){ca(this)?r(this).show():r(this).hide()})}});var ia=/^(?:checkbox|radio)$/i,ja=/<([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]+)/i,ka=/^$|\\/(?:java|ecma)script/i,la={option:[1,\"<select multiple='multiple'>\",\"</select>\"],thead:[1,\"<table>\",\"</table>\"],col:[2,\"<table><colgroup>\",\"</colgroup></table>\"],tr:[2,\"<table><tbody>\",\"</tbody></table>\"],td:[3,\"<table><tbody><tr>\",\"</tr></tbody></table>\"],_default:[0,\"\",\"\"]};la.optgroup=la.option,la.tbody=la.tfoot=la.colgroup=la.caption=la.thead,la.th=la.td;function ma(a,b){var c;return c=\"undefined\"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||\"*\"):\"undefined\"!=typeof a.querySelectorAll?a.querySelectorAll(b||\"*\"):[],void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function na(a,b){for(var c=0,d=a.length;c<d;c++)V.set(a[c],\"globalEval\",!b||V.get(b[c],\"globalEval\"))}var oa=/<|&#?\\w+;/;function pa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;n<o;n++)if(f=a[n],f||0===f)if(\"object\"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(oa.test(f)){g=g||l.appendChild(b.createElement(\"div\")),h=(ja.exec(f)||[\"\",\"\"])[1].toLowerCase(),i=la[h]||la._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=\"\"}else m.push(b.createTextNode(f));l.textContent=\"\",n=0;while(f=m[n++])if(d&&r.inArray(f,d)>-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=ma(l.appendChild(f),\"script\"),j&&na(g),c){k=0;while(f=g[k++])ka.test(f.type||\"\")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement(\"div\")),c=d.createElement(\"input\");c.setAttribute(\"type\",\"radio\"),c.setAttribute(\"checked\",\"checked\"),c.setAttribute(\"name\",\"t\"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML=\"<textarea>x</textarea>\",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var qa=d.documentElement,ra=/^key/,sa=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ta=/^([^.]*)(?:\\.(.+)|)/;function ua(){return!0}function va(){return!1}function wa(){try{return d.activeElement}catch(a){}}function xa(a,b,c,d,e,f){var g,h;if(\"object\"==typeof b){\"string\"!=typeof c&&(d=d||c,c=void 0);for(h in b)xa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&(\"string\"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=va;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(qa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return\"undefined\"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||\"\").match(K)||[\"\"],j=b.length;while(j--)h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||\"\").split(\".\").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(\".\")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||\"\").match(K)||[\"\"],j=b.length;while(j--)if(h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||\"\").split(\".\").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp(\"(^|\\\\.)\"+o.join(\"\\\\.(?:.*\\\\.|)\")+\"(\\\\.|$)\"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&(\"**\"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,\"handle events\")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,\"events\")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c<arguments.length;c++)i[c]=arguments[c];if(b.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,b)!==!1){h=r.event.handlers.call(this,b,j),c=0;while((f=h[c++])&&!b.isPropagationStopped()){b.currentTarget=f.elem,d=0;while((g=f.handlers[d++])&&!b.isImmediatePropagationStopped())b.rnamespace&&!b.rnamespace.test(g.namespace)||(b.handleObj=g,b.data=g.data,e=((r.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(b.result=e)===!1&&(b.preventDefault(),b.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,b),b.result}},handlers:function(a,b){var c,d,e,f,g,h=[],i=b.delegateCount,j=a.target;if(i&&j.nodeType&&!(\"click\"===a.type&&a.button>=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&(\"click\"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c<i;c++)d=b[c],e=d.selector+\" \",void 0===g[e]&&(g[e]=d.needsContext?r(e,this).index(j)>-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i<b.length&&h.push({elem:j,handlers:b.slice(i)}),h},addProp:function(a,b){Object.defineProperty(r.Event.prototype,a,{enumerable:!0,configurable:!0,get:r.isFunction(b)?function(){if(this.originalEvent)return b(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[a]},set:function(b){Object.defineProperty(this,a,{enumerable:!0,configurable:!0,writable:!0,value:b})}})},fix:function(a){return a[r.expando]?a:new r.Event(a)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==wa()&&this.focus)return this.focus(),!1},delegateType:\"focusin\"},blur:{trigger:function(){if(this===wa()&&this.blur)return this.blur(),!1},delegateType:\"focusout\"},click:{trigger:function(){if(\"checkbox\"===this.type&&this.click&&r.nodeName(this,\"input\"))return this.click(),!1},_default:function(a){return r.nodeName(a.target,\"a\")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},r.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},r.Event=function(a,b){return this instanceof r.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ua:va,this.target=a.target&&3===a.target.nodeType?a.target.parentNode:a.target,this.currentTarget=a.currentTarget,this.relatedTarget=a.relatedTarget):this.type=a,b&&r.extend(this,b),this.timeStamp=a&&a.timeStamp||r.now(),void(this[r.expando]=!0)):new r.Event(a,b)},r.Event.prototype={constructor:r.Event,isDefaultPrevented:va,isPropagationStopped:va,isImmediatePropagationStopped:va,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ua,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ua,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ua,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},r.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,\"char\":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(a){var b=a.button;return null==a.which&&ra.test(a.type)?null!=a.charCode?a.charCode:a.keyCode:!a.which&&void 0!==b&&sa.test(a.type)?1&b?1:2&b?3:4&b?2:0:a.which}},r.event.addProp),r.each({mouseenter:\"mouseover\",mouseleave:\"mouseout\",pointerenter:\"pointerover\",pointerleave:\"pointerout\"},function(a,b){r.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||r.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),r.fn.extend({on:function(a,b,c,d){return xa(this,a,b,c,d)},one:function(a,b,c,d){return xa(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,r(a.delegateTarget).off(d.namespace?d.origType+\".\"+d.namespace:d.origType,d.selector,d.handler),this;if(\"object\"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&\"function\"!=typeof b||(c=b,b=void 0),c===!1&&(c=va),this.each(function(){r.event.remove(this,a,c,b)})}});var ya=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]*)[^>]*)\\/>/gi,za=/<script|<style|<link/i,Aa=/checked\\s*(?:[^=]|=\\s*.checked.)/i,Ba=/^true\\/(.*)/,Ca=/^\\s*<!(?:\\[CDATA\\[|--)|(?:\\]\\]|--)>\\s*$/g;function Da(a,b){return r.nodeName(a,\"table\")&&r.nodeName(11!==b.nodeType?b:b.firstChild,\"tr\")?a.getElementsByTagName(\"tbody\")[0]||a:a}function Ea(a){return a.type=(null!==a.getAttribute(\"type\"))+\"/\"+a.type,a}function Fa(a){var b=Ba.exec(a.type);return b?a.type=b[1]:a.removeAttribute(\"type\"),a}function Ga(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c<d;c++)r.event.add(b,e,j[e][c])}W.hasData(a)&&(h=W.access(a),i=r.extend({},h),W.set(b,i))}}function Ha(a,b){var c=b.nodeName.toLowerCase();\"input\"===c&&ia.test(a.type)?b.checked=a.checked:\"input\"!==c&&\"textarea\"!==c||(b.defaultValue=a.defaultValue)}function Ia(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m>1&&\"string\"==typeof q&&!o.checkClone&&Aa.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ia(f,b,c,d)});if(m&&(e=pa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(ma(e,\"script\"),Ea),i=h.length;l<m;l++)j=e,l!==n&&(j=r.clone(j,!0,!0),i&&r.merge(h,ma(j,\"script\"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Fa),l=0;l<i;l++)j=h[l],ka.test(j.type||\"\")&&!V.access(j,\"globalEval\")&&r.contains(k,j)&&(j.src?r._evalUrl&&r._evalUrl(j.src):p(j.textContent.replace(Ca,\"\"),k))}return a}function Ja(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(ma(d)),d.parentNode&&(c&&r.contains(d.ownerDocument,d)&&na(ma(d,\"script\")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(ya,\"<$1></$2>\")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=ma(h),f=ma(a),d=0,e=f.length;d<e;d++)Ha(f[d],g[d]);if(b)if(c)for(f=f||ma(a),g=g||ma(h),d=0,e=f.length;d<e;d++)Ga(f[d],g[d]);else Ga(a,h);return g=ma(h,\"script\"),g.length>0&&na(g,!i&&ma(a,\"script\")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ja(this,a,!0)},remove:function(a){return Ja(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.appendChild(a)}})},prepend:function(){return Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(ma(a,!1)),a.textContent=\"\");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if(\"string\"==typeof a&&!za.test(a)&&!la[(ja.exec(a)||[\"\",\"\"])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c<d;c++)b=this[c]||{},1===b.nodeType&&(r.cleanData(ma(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ia(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)<0&&(r.cleanData(ma(this)),c&&c.replaceChild(b,this))},a)}}),r.each({appendTo:\"append\",prependTo:\"prepend\",insertBefore:\"before\",insertAfter:\"after\",replaceAll:\"replaceWith\"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;g<=f;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var Ka=/^margin/,La=new RegExp(\"^(\"+_+\")(?!px)[a-z%]+$\",\"i\"),Ma=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText=\"box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%\",i.innerHTML=\"\",qa.appendChild(h);var b=a.getComputedStyle(i);c=\"1%\"!==b.top,g=\"2px\"===b.marginLeft,e=\"4px\"===b.width,i.style.marginRight=\"50%\",f=\"4px\"===b.marginRight,qa.removeChild(h),i=null}}var c,e,f,g,h=d.createElement(\"div\"),i=d.createElement(\"div\");i.style&&(i.style.backgroundClip=\"content-box\",i.cloneNode(!0).style.backgroundClip=\"\",o.clearCloneStyle=\"content-box\"===i.style.backgroundClip,h.style.cssText=\"border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute\",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Na(a,b,c){var d,e,f,g,h=a.style;return c=c||Ma(a),c&&(g=c.getPropertyValue(b)||c[b],\"\"!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&&La.test(g)&&Ka.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+\"\":g}function Oa(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Pa=/^(none|table(?!-c[ea]).+)/,Qa={position:\"absolute\",visibility:\"hidden\",display:\"block\"},Ra={letterSpacing:\"0\",fontWeight:\"400\"},Sa=[\"Webkit\",\"Moz\",\"ms\"],Ta=d.createElement(\"div\").style;function Ua(a){if(a in Ta)return a;var b=a[0].toUpperCase()+a.slice(1),c=Sa.length;while(c--)if(a=Sa[c]+b,a in Ta)return a}function Va(a,b,c){var d=aa.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||\"px\"):b}function Wa(a,b,c,d,e){var f,g=0;for(f=c===(d?\"border\":\"content\")?4:\"width\"===b?1:0;f<4;f+=2)\"margin\"===c&&(g+=r.css(a,c+ba[f],!0,e)),d?(\"content\"===c&&(g-=r.css(a,\"padding\"+ba[f],!0,e)),\"margin\"!==c&&(g-=r.css(a,\"border\"+ba[f]+\"Width\",!0,e))):(g+=r.css(a,\"padding\"+ba[f],!0,e),\"padding\"!==c&&(g+=r.css(a,\"border\"+ba[f]+\"Width\",!0,e)));return g}function Xa(a,b,c){var d,e=!0,f=Ma(a),g=\"border-box\"===r.css(a,\"boxSizing\",!1,f);if(a.getClientRects().length&&(d=a.getBoundingClientRect()[b]),d<=0||null==d){if(d=Na(a,b,f),(d<0||null==d)&&(d=a.style[b]),La.test(d))return d;e=g&&(o.boxSizingReliable()||d===a.style[b]),d=parseFloat(d)||0}return d+Wa(a,b,c||(g?\"border\":\"content\"),e,f)+\"px\"}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Na(a,\"opacity\");return\"\"===c?\"1\":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{\"float\":\"cssFloat\"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=r.camelCase(b),i=a.style;return b=r.cssProps[h]||(r.cssProps[h]=Ua(h)||h),g=r.cssHooks[b]||r.cssHooks[h],void 0===c?g&&\"get\"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,\"string\"===f&&(e=aa.exec(c))&&e[1]&&(c=ea(a,b,e),f=\"number\"),null!=c&&c===c&&(\"number\"===f&&(c+=e&&e[3]||(r.cssNumber[h]?\"\":\"px\")),o.clearCloneStyle||\"\"!==c||0!==b.indexOf(\"background\")||(i[b]=\"inherit\"),g&&\"set\"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b);return b=r.cssProps[h]||(r.cssProps[h]=Ua(h)||h),g=r.cssHooks[b]||r.cssHooks[h],g&&\"get\"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Na(a,b,d)),\"normal\"===e&&b in Ra&&(e=Ra[b]),\"\"===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each([\"height\",\"width\"],function(a,b){r.cssHooks[b]={get:function(a,c,d){if(c)return!Pa.test(r.css(a,\"display\"))||a.getClientRects().length&&a.getBoundingClientRect().width?Xa(a,b,d):da(a,Qa,function(){return Xa(a,b,d)})},set:function(a,c,d){var e,f=d&&Ma(a),g=d&&Wa(a,b,d,\"border-box\"===r.css(a,\"boxSizing\",!1,f),f);return g&&(e=aa.exec(c))&&\"px\"!==(e[3]||\"px\")&&(a.style[b]=c,c=r.css(a,b)),Va(a,c,g)}}}),r.cssHooks.marginLeft=Oa(o.reliableMarginLeft,function(a,b){if(b)return(parseFloat(Na(a,\"marginLeft\"))||a.getBoundingClientRect().left-da(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+\"px\"}),r.each({margin:\"\",padding:\"\",border:\"Width\"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f=\"string\"==typeof c?c.split(\" \"):[c];d<4;d++)e[a+ba[d]+b]=f[d]||f[d-2]||f[0];return e}},Ka.test(a)||(r.cssHooks[a+b].set=Va)}),r.fn.extend({css:function(a,b){return S(this,function(a,b,c){var d,e,f={},g=0;if(r.isArray(b)){for(d=Ma(a),e=b.length;g<e;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length>1)}});function Ya(a,b,c,d,e){return new Ya.prototype.init(a,b,c,d,e)}r.Tween=Ya,Ya.prototype={constructor:Ya,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?\"\":\"px\")},cur:function(){var a=Ya.propHooks[this.prop];return a&&a.get?a.get(this):Ya.propHooks._default.get(this)},run:function(a){var b,c=Ya.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ya.propHooks._default.set(this),this}},Ya.prototype.init.prototype=Ya.prototype,Ya.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,\"\"),b&&\"auto\"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},Ya.propHooks.scrollTop=Ya.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:\"swing\"},r.fx=Ya.prototype.init,r.fx.step={};var Za,$a,_a=/^(?:toggle|show|hide)$/,ab=/queueHooks$/;function bb(){$a&&(a.requestAnimationFrame(bb),r.fx.tick())}function cb(){return a.setTimeout(function(){Za=void 0}),Za=r.now()}function db(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ba[d],e[\"margin\"+c]=e[\"padding\"+c]=a;return b&&(e.opacity=e.width=a),e}function eb(a,b,c){for(var d,e=(hb.tweeners[b]||[]).concat(hb.tweeners[\"*\"]),f=0,g=e.length;f<g;f++)if(d=e[f].call(c,b,a))return d}function fb(a,b,c){var d,e,f,g,h,i,j,k,l=\"width\"in b||\"height\"in b,m=this,n={},o=a.style,p=a.nodeType&&ca(a),q=V.get(a,\"fxshow\");c.queue||(g=r._queueHooks(a,\"fx\"),null==g.unqueued&&(g.unqueued=0,h=g.empty.fire,g.empty.fire=function(){g.unqueued||h()}),g.unqueued++,m.always(function(){m.always(function(){g.unqueued--,r.queue(a,\"fx\").length||g.empty.fire()})}));for(d in b)if(e=b[d],_a.test(e)){if(delete b[d],f=f||\"toggle\"===e,e===(p?\"hide\":\"show\")){if(\"show\"!==e||!q||void 0===q[d])continue;p=!0}n[d]=q&&q[d]||r.style(a,d)}if(i=!r.isEmptyObject(b),i||!r.isEmptyObject(n)){l&&1===a.nodeType&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=q&&q.display,null==j&&(j=V.get(a,\"display\")),k=r.css(a,\"display\"),\"none\"===k&&(j?k=j:(ha([a],!0),j=a.style.display||j,k=r.css(a,\"display\"),ha([a]))),(\"inline\"===k||\"inline-block\"===k&&null!=j)&&\"none\"===r.css(a,\"float\")&&(i||(m.done(function(){o.display=j}),null==j&&(k=o.display,j=\"none\"===k?\"\":k)),o.display=\"inline-block\")),c.overflow&&(o.overflow=\"hidden\",m.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]})),i=!1;for(d in n)i||(q?\"hidden\"in q&&(p=q.hidden):q=V.access(a,\"fxshow\",{display:j}),f&&(q.hidden=!p),p&&ha([a],!0),m.done(function(){p||ha([a]),V.remove(a,\"fxshow\");for(d in n)r.style(a,d,n[d])})),i=eb(p?q[d]:0,d,m),d in q||(q[d]=i.start,p&&(i.end=i.start,i.start=0))}}function gb(a,b){var c,d,e,f,g;for(c in a)if(d=r.camelCase(c),e=b[d],f=a[c],r.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=r.cssHooks[d],g&&\"expand\"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function hb(a,b,c){var d,e,f=0,g=hb.prefilters.length,h=r.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Za||cb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;g<i;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),f<1&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:r.extend({},b),opts:r.extend(!0,{specialEasing:{},easing:r.easing._default},c),originalProperties:b,originalOptions:c,startTime:Za||cb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=r.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;c<d;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(gb(k,j.opts.specialEasing);f<g;f++)if(d=hb.prefilters[f].call(j,a,k,j.opts))return r.isFunction(d.stop)&&(r._queueHooks(j.elem,j.opts.queue).stop=r.proxy(d.stop,d)),d;return r.map(k,eb,j),r.isFunction(j.opts.start)&&j.opts.start.call(a,j),r.fx.timer(r.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}r.Animation=r.extend(hb,{tweeners:{\"*\":[function(a,b){var c=this.createTween(a,b);return ea(c.elem,a,aa.exec(b),c),c}]},tweener:function(a,b){r.isFunction(a)?(b=a,a=[\"*\"]):a=a.match(K);for(var c,d=0,e=a.length;d<e;d++)c=a[d],hb.tweeners[c]=hb.tweeners[c]||[],hb.tweeners[c].unshift(b)},prefilters:[fb],prefilter:function(a,b){b?hb.prefilters.unshift(a):hb.prefilters.push(a)}}),r.speed=function(a,b,c){var e=a&&\"object\"==typeof a?r.extend({},a):{complete:c||!c&&b||r.isFunction(a)&&a,duration:a,easing:c&&b||b&&!r.isFunction(b)&&b};return r.fx.off||d.hidden?e.duration=0:\"number\"!=typeof e.duration&&(e.duration in r.fx.speeds?e.duration=r.fx.speeds[e.duration]:e.duration=r.fx.speeds._default),null!=e.queue&&e.queue!==!0||(e.queue=\"fx\"),e.old=e.complete,e.complete=function(){r.isFunction(e.old)&&e.old.call(this),e.queue&&r.dequeue(this,e.queue)},e},r.fn.extend({fadeTo:function(a,b,c,d){return this.filter(ca).css(\"opacity\",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=r.isEmptyObject(a),f=r.speed(b,c,d),g=function(){var b=hb(this,r.extend({},a),f);(e||V.get(this,\"finish\"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return\"string\"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||\"fx\",[]),this.each(function(){var b=!0,e=null!=a&&a+\"queueHooks\",f=r.timers,g=V.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&ab.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||r.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||\"fx\"),this.each(function(){var b,c=V.get(this),d=c[a+\"queue\"],e=c[a+\"queueHooks\"],f=r.timers,g=d?d.length:0;for(c.finish=!0,r.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;b<g;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),r.each([\"toggle\",\"show\",\"hide\"],function(a,b){var c=r.fn[b];r.fn[b]=function(a,d,e){return null==a||\"boolean\"==typeof a?c.apply(this,arguments):this.animate(db(b,!0),a,d,e)}}),r.each({slideDown:db(\"show\"),slideUp:db(\"hide\"),slideToggle:db(\"toggle\"),fadeIn:{opacity:\"show\"},fadeOut:{opacity:\"hide\"},fadeToggle:{opacity:\"toggle\"}},function(a,b){r.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),r.timers=[],r.fx.tick=function(){var a,b=0,c=r.timers;for(Za=r.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||r.fx.stop(),Za=void 0},r.fx.timer=function(a){r.timers.push(a),a()?r.fx.start():r.timers.pop()},r.fx.interval=13,r.fx.start=function(){$a||($a=a.requestAnimationFrame?a.requestAnimationFrame(bb):a.setInterval(r.fx.tick,r.fx.interval))},r.fx.stop=function(){a.cancelAnimationFrame?a.cancelAnimationFrame($a):a.clearInterval($a),$a=null},r.fx.speeds={slow:600,fast:200,_default:400},r.fn.delay=function(b,c){return b=r.fx?r.fx.speeds[b]||b:b,c=c||\"fx\",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement(\"input\"),b=d.createElement(\"select\"),c=b.appendChild(d.createElement(\"option\"));a.type=\"checkbox\",o.checkOn=\"\"!==a.value,o.optSelected=c.selected,a=d.createElement(\"input\"),a.value=\"t\",a.type=\"radio\",o.radioValue=\"t\"===a.value}();var ib,jb=r.expr.attrHandle;r.fn.extend({attr:function(a,b){return S(this,r.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return\"undefined\"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?ib:void 0)),\nvoid 0!==c?null===c?void r.removeAttr(a,b):e&&\"set\"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+\"\"),c):e&&\"get\"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&\"radio\"===b&&r.nodeName(a,\"input\")){var c=a.value;return a.setAttribute(\"type\",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),ib={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\\w+/g),function(a,b){var c=jb[b]||r.find.attr;jb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=jb[g],jb[g]=e,e=null!=c(a,b,d)?g:null,jb[g]=f),e}});var kb=/^(?:input|select|textarea|button)$/i,lb=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&\"set\"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&\"get\"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,\"tabindex\");return b?parseInt(b,10):kb.test(a.nodeName)||lb.test(a.nodeName)&&a.href?0:-1}}},propFix:{\"for\":\"htmlFor\",\"class\":\"className\"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each([\"tabIndex\",\"readOnly\",\"maxLength\",\"cellSpacing\",\"cellPadding\",\"rowSpan\",\"colSpan\",\"useMap\",\"frameBorder\",\"contentEditable\"],function(){r.propFix[this.toLowerCase()]=this});function mb(a){var b=a.match(K)||[];return b.join(\" \")}function nb(a){return a.getAttribute&&a.getAttribute(\"class\")||\"\"}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,nb(this)))});if(\"string\"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=nb(c),d=1===c.nodeType&&\" \"+mb(e)+\" \"){g=0;while(f=b[g++])d.indexOf(\" \"+f+\" \")<0&&(d+=f+\" \");h=mb(d),e!==h&&c.setAttribute(\"class\",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,nb(this)))});if(!arguments.length)return this.attr(\"class\",\"\");if(\"string\"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=nb(c),d=1===c.nodeType&&\" \"+mb(e)+\" \"){g=0;while(f=b[g++])while(d.indexOf(\" \"+f+\" \")>-1)d=d.replace(\" \"+f+\" \",\" \");h=mb(d),e!==h&&c.setAttribute(\"class\",h)}}return this},toggleClass:function(a,b){var c=typeof a;return\"boolean\"==typeof b&&\"string\"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,nb(this),b),b)}):this.each(function(){var b,d,e,f;if(\"string\"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&\"boolean\"!==c||(b=nb(this),b&&V.set(this,\"__className__\",b),this.setAttribute&&this.setAttribute(\"class\",b||a===!1?\"\":V.get(this,\"__className__\")||\"\"))})},hasClass:function(a){var b,c,d=0;b=\" \"+a+\" \";while(c=this[d++])if(1===c.nodeType&&(\" \"+mb(nb(c))+\" \").indexOf(b)>-1)return!0;return!1}});var ob=/\\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e=\"\":\"number\"==typeof e?e+=\"\":r.isArray(e)&&(e=r.map(e,function(a){return null==a?\"\":a+\"\"})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&\"set\"in b&&void 0!==b.set(this,e,\"value\")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&\"get\"in b&&void 0!==(c=b.get(e,\"value\"))?c:(c=e.value,\"string\"==typeof c?c.replace(ob,\"\"):null==c?\"\":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,\"value\");return null!=b?b:mb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g=\"select-one\"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d<i;d++)if(c=e[d],(c.selected||d===f)&&!c.disabled&&(!c.parentNode.disabled||!r.nodeName(c.parentNode,\"optgroup\"))){if(b=r(c).val(),g)return b;h.push(b)}return h},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each([\"radio\",\"checkbox\"],function(){r.valHooks[this]={set:function(a,b){if(r.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute(\"value\")?\"on\":a.value})});var pb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,\"type\")?b.type:b,q=l.call(b,\"namespace\")?b.namespace.split(\".\"):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!pb.test(p+r.event.triggered)&&(p.indexOf(\".\")>-1&&(q=p.split(\".\"),p=q.shift(),q.sort()),k=p.indexOf(\":\")<0&&\"on\"+p,b=b[r.expando]?b:new r.Event(p,\"object\"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join(\".\"),b.rnamespace=b.namespace?new RegExp(\"(^|\\\\.)\"+q.join(\"\\\\.(?:.*\\\\.|)\")+\"(\\\\.|$)\"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,pb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,\"events\")||{})[b.type]&&V.get(h,\"handle\"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each(\"blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu\".split(\" \"),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin=\"onfocusin\"in a,o.focusin||r.each({focus:\"focusin\",blur:\"focusout\"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var qb=a.location,rb=r.now(),sb=/\\?/;r.parseXML=function(b){var c;if(!b||\"string\"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,\"text/xml\")}catch(d){c=void 0}return c&&!c.getElementsByTagName(\"parsererror\").length||r.error(\"Invalid XML: \"+b),c};var tb=/\\[\\]$/,ub=/\\r?\\n/g,vb=/^(?:submit|button|image|reset|file)$/i,wb=/^(?:input|select|textarea|keygen)/i;function xb(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||tb.test(a)?d(a,e):xb(a+\"[\"+(\"object\"==typeof e&&null!=e?b:\"\")+\"]\",e,c,d)});else if(c||\"object\"!==r.type(b))d(a,b);else for(e in b)xb(a+\"[\"+e+\"]\",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+\"=\"+encodeURIComponent(null==c?\"\":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)xb(c,a[c],b,e);return d.join(\"&\")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,\"elements\");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(\":disabled\")&&wb.test(this.nodeName)&&!vb.test(a)&&(this.checked||!ia.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(ub,\"\\r\\n\")}}):{name:b.name,value:c.replace(ub,\"\\r\\n\")}}).get()}});var yb=/%20/g,zb=/#.*$/,Ab=/([?&])_=[^&]*/,Bb=/^(.*?):[ \\t]*([^\\r\\n]*)$/gm,Cb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Db=/^(?:GET|HEAD)$/,Eb=/^\\/\\//,Fb={},Gb={},Hb=\"*/\".concat(\"*\"),Ib=d.createElement(\"a\");Ib.href=qb.href;function Jb(a){return function(b,c){\"string\"!=typeof b&&(c=b,b=\"*\");var d,e=0,f=b.toLowerCase().match(K)||[];if(r.isFunction(c))while(d=f[e++])\"+\"===d[0]?(d=d.slice(1)||\"*\",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Kb(a,b,c,d){var e={},f=a===Gb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return\"string\"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e[\"*\"]&&g(\"*\")}function Lb(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Mb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while(\"*\"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader(\"Content-Type\"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+\" \"+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Nb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if(\"*\"===f)f=i;else if(\"*\"!==i&&i!==f){if(g=j[i+\" \"+f]||j[\"* \"+f],!g)for(e in j)if(h=e.split(\" \"),h[1]===f&&(g=j[i+\" \"+h[0]]||j[\"* \"+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a[\"throws\"])b=g(b);else try{b=g(b)}catch(l){return{state:\"parsererror\",error:g?l:\"No conversion from \"+i+\" to \"+f}}}return{state:\"success\",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qb.href,type:\"GET\",isLocal:Cb.test(qb.protocol),global:!0,processData:!0,async:!0,contentType:\"application/x-www-form-urlencoded; charset=UTF-8\",accepts:{\"*\":Hb,text:\"text/plain\",html:\"text/html\",xml:\"application/xml, text/xml\",json:\"application/json, text/javascript\"},contents:{xml:/\\bxml\\b/,html:/\\bhtml/,json:/\\bjson\\b/},responseFields:{xml:\"responseXML\",text:\"responseText\",json:\"responseJSON\"},converters:{\"* text\":String,\"text html\":!0,\"text json\":JSON.parse,\"text xml\":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Lb(Lb(a,r.ajaxSettings),b):Lb(r.ajaxSettings,a)},ajaxPrefilter:Jb(Fb),ajaxTransport:Jb(Gb),ajax:function(b,c){\"object\"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks(\"once memory\"),u=o.statusCode||{},v={},w={},x=\"canceled\",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Bb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||qb.href)+\"\").replace(Eb,qb.protocol+\"//\"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||\"*\").toLowerCase().match(K)||[\"\"],null==o.crossDomain){j=d.createElement(\"a\");try{j.href=o.url,j.href=j.href,o.crossDomain=Ib.protocol+\"//\"+Ib.host!=j.protocol+\"//\"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&\"string\"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Kb(Fb,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger(\"ajaxStart\"),o.type=o.type.toUpperCase(),o.hasContent=!Db.test(o.type),f=o.url.replace(zb,\"\"),o.hasContent?o.data&&o.processData&&0===(o.contentType||\"\").indexOf(\"application/x-www-form-urlencoded\")&&(o.data=o.data.replace(yb,\"+\")):(n=o.url.slice(f.length),o.data&&(f+=(sb.test(f)?\"&\":\"?\")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Ab,\"$1\"),n=(sb.test(f)?\"&\":\"?\")+\"_=\"+rb++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader(\"If-Modified-Since\",r.lastModified[f]),r.etag[f]&&y.setRequestHeader(\"If-None-Match\",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader(\"Content-Type\",o.contentType),y.setRequestHeader(\"Accept\",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+(\"*\"!==o.dataTypes[0]?\", \"+Hb+\"; q=0.01\":\"\"):o.accepts[\"*\"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x=\"abort\",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Kb(Gb,o,c,y)){if(y.readyState=1,l&&q.trigger(\"ajaxSend\",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort(\"timeout\")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,\"No Transport\");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||\"\",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Mb(o,y,d)),v=Nb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader(\"Last-Modified\"),w&&(r.lastModified[f]=w),w=y.getResponseHeader(\"etag\"),w&&(r.etag[f]=w)),204===b||\"HEAD\"===o.type?x=\"nocontent\":304===b?x=\"notmodified\":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x=\"error\",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+\"\",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?\"ajaxSuccess\":\"ajaxError\",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger(\"ajaxComplete\",[y,o]),--r.active||r.event.trigger(\"ajaxStop\")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,\"json\")},getScript:function(a,b){return r.get(a,void 0,b,\"script\")}}),r.each([\"get\",\"post\"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:\"GET\",dataType:\"script\",cache:!0,async:!1,global:!1,\"throws\":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not(\"body\").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Ob={0:200,1223:204},Pb=r.ajaxSettings.xhr();o.cors=!!Pb&&\"withCredentials\"in Pb,o.ajax=Pb=!!Pb,r.ajaxTransport(function(b){var c,d;if(o.cors||Pb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e[\"X-Requested-With\"]||(e[\"X-Requested-With\"]=\"XMLHttpRequest\");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,\"abort\"===a?h.abort():\"error\"===a?\"number\"!=typeof h.status?f(0,\"error\"):f(h.status,h.statusText):f(Ob[h.status]||h.status,h.statusText,\"text\"!==(h.responseType||\"text\")||\"string\"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c(\"error\"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c(\"abort\");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:\"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript\"},contents:{script:/\\b(?:java|ecma)script\\b/},converters:{\"text script\":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter(\"script\",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type=\"GET\")}),r.ajaxTransport(\"script\",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r(\"<script>\").prop({charset:a.scriptCharset,src:a.url}).on(\"load error\",c=function(a){b.remove(),c=null,a&&f(\"error\"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Qb=[],Rb=/(=)\\?(?=&|$)|\\?\\?/;r.ajaxSetup({jsonp:\"callback\",jsonpCallback:function(){var a=Qb.pop()||r.expando+\"_\"+rb++;return this[a]=!0,a}}),r.ajaxPrefilter(\"json jsonp\",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Rb.test(b.url)?\"url\":\"string\"==typeof b.data&&0===(b.contentType||\"\").indexOf(\"application/x-www-form-urlencoded\")&&Rb.test(b.data)&&\"data\");if(h||\"jsonp\"===b.dataTypes[0])return e=b.jsonpCallback=r.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Rb,\"$1\"+e):b.jsonp!==!1&&(b.url+=(sb.test(b.url)?\"&\":\"?\")+b.jsonp+\"=\"+e),b.converters[\"script json\"]=function(){return g||r.error(e+\" was not called\"),g[0]},b.dataTypes[0]=\"json\",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?r(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Qb.push(e)),g&&r.isFunction(f)&&f(g[0]),g=f=void 0}),\"script\"}),o.createHTMLDocument=function(){var a=d.implementation.createHTMLDocument(\"\").body;return a.innerHTML=\"<form></form><form></form>\",2===a.childNodes.length}(),r.parseHTML=function(a,b,c){if(\"string\"!=typeof a)return[];\"boolean\"==typeof b&&(c=b,b=!1);var e,f,g;return b||(o.createHTMLDocument?(b=d.implementation.createHTMLDocument(\"\"),e=b.createElement(\"base\"),e.href=d.location.href,b.head.appendChild(e)):b=d),f=B.exec(a),g=!c&&[],f?[b.createElement(f[1])]:(f=pa([a],b,g),g&&g.length&&r(g).remove(),r.merge([],f.childNodes))},r.fn.load=function(a,b,c){var d,e,f,g=this,h=a.indexOf(\" \");return h>-1&&(d=mb(a.slice(h)),a=a.slice(0,h)),r.isFunction(b)?(c=b,b=void 0):b&&\"object\"==typeof b&&(e=\"POST\"),g.length>0&&r.ajax({url:a,type:e||\"GET\",dataType:\"html\",data:b}).done(function(a){f=arguments,g.html(d?r(\"<div>\").append(r.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},r.each([\"ajaxStart\",\"ajaxStop\",\"ajaxComplete\",\"ajaxError\",\"ajaxSuccess\",\"ajaxSend\"],function(a,b){r.fn[b]=function(a){return this.on(b,a)}}),r.expr.pseudos.animated=function(a){return r.grep(r.timers,function(b){return a===b.elem}).length};function Sb(a){return r.isWindow(a)?a:9===a.nodeType&&a.defaultView}r.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=r.css(a,\"position\"),l=r(a),m={};\"static\"===k&&(a.style.position=\"relative\"),h=l.offset(),f=r.css(a,\"top\"),i=r.css(a,\"left\"),j=(\"absolute\"===k||\"fixed\"===k)&&(f+i).indexOf(\"auto\")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),r.isFunction(b)&&(b=b.call(a,c,r.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),\"using\"in b?b.using.call(a,m):l.css(m)}},r.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){r.offset.setOffset(this,a,b)});var b,c,d,e,f=this[0];if(f)return f.getClientRects().length?(d=f.getBoundingClientRect(),d.width||d.height?(e=f.ownerDocument,c=Sb(e),b=e.documentElement,{top:d.top+c.pageYOffset-b.clientTop,left:d.left+c.pageXOffset-b.clientLeft}):d):{top:0,left:0}},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return\"fixed\"===r.css(c,\"position\")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),r.nodeName(a[0],\"html\")||(d=a.offset()),d={top:d.top+r.css(a[0],\"borderTopWidth\",!0),left:d.left+r.css(a[0],\"borderLeftWidth\",!0)}),{top:b.top-d.top-r.css(c,\"marginTop\",!0),left:b.left-d.left-r.css(c,\"marginLeft\",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&\"static\"===r.css(a,\"position\"))a=a.offsetParent;return a||qa})}}),r.each({scrollLeft:\"pageXOffset\",scrollTop:\"pageYOffset\"},function(a,b){var c=\"pageYOffset\"===b;r.fn[a]=function(d){return S(this,function(a,d,e){var f=Sb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),r.each([\"top\",\"left\"],function(a,b){r.cssHooks[b]=Oa(o.pixelPosition,function(a,c){if(c)return c=Na(a,b),La.test(c)?r(a).position()[b]+\"px\":c})}),r.each({Height:\"height\",Width:\"width\"},function(a,b){r.each({padding:\"inner\"+a,content:b,\"\":\"outer\"+a},function(c,d){r.fn[d]=function(e,f){var g=arguments.length&&(c||\"boolean\"!=typeof e),h=c||(e===!0||f===!0?\"margin\":\"border\");return S(this,function(b,c,e){var f;return r.isWindow(b)?0===d.indexOf(\"outer\")?b[\"inner\"+a]:b.document.documentElement[\"client\"+a]:9===b.nodeType?(f=b.documentElement,Math.max(b.body[\"scroll\"+a],f[\"scroll\"+a],b.body[\"offset\"+a],f[\"offset\"+a],f[\"client\"+a])):void 0===e?r.css(b,c,h):r.style(b,c,e,h)},b,g?e:void 0,g)}})}),r.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,\"**\"):this.off(b,a||\"**\",c)}}),r.parseJSON=JSON.parse,\"function\"==typeof define&&define.amd&&define(\"jquery\",[],function(){return r});var Tb=a.jQuery,Ub=a.$;return r.noConflict=function(b){return a.$===r&&(a.$=Ub),b&&a.jQuery===r&&(a.jQuery=Tb),r},b||(a.jQuery=a.$=r),r});\n"},{"col":4,"comment":"null","endLoc":917,"header":"def max(self, axis=None, out=None, **kwargs)","id":11422,"name":"max","nodeType":"Function","startLoc":915,"text":"def max(self, axis=None, out=None, **kwargs):\n        return super().max(axis=axis, out=out,\n                           **self._reduce_defaults(kwargs, np.nanmin))"},{"col":4,"comment":"null","endLoc":925,"header":"def nonzero(self)","id":11423,"name":"nonzero","nodeType":"Function","startLoc":919,"text":"def nonzero(self):\n        unmasked_nonzero = self.unmasked.nonzero()\n        if self.ndim >= 1:\n            not_masked = ~self.mask[unmasked_nonzero]\n            return tuple(u[not_masked] for u in unmasked_nonzero)\n        else:\n            return unmasked_nonzero if not self.mask else np.nonzero(0)"},{"col":4,"comment":"null","endLoc":261,"header":"def lexprobe(self)","id":11424,"name":"lexprobe","nodeType":"Function","startLoc":209,"text":"def lexprobe(self):\n\n        # Determine the token type for identifiers\n        self.lexer.input(\"identifier\")\n        tok = self.lexer.token()\n        if not tok or tok.value != \"identifier\":\n            print(\"Couldn't determine identifier type\")\n        else:\n            self.t_ID = tok.type\n\n        # Determine the token type for integers\n        self.lexer.input(\"12345\")\n        tok = self.lexer.token()\n        if not tok or int(tok.value) != 12345:\n            print(\"Couldn't determine integer type\")\n        else:\n            self.t_INTEGER = tok.type\n            self.t_INTEGER_TYPE = type(tok.value)\n\n        # Determine the token type for strings enclosed in double quotes\n        self.lexer.input(\"\\\"filename\\\"\")\n        tok = self.lexer.token()\n        if not tok or tok.value != \"\\\"filename\\\"\":\n            print(\"Couldn't determine string type\")\n        else:\n            self.t_STRING = tok.type\n\n        # Determine the token type for whitespace--if any\n        self.lexer.input(\"  \")\n        tok = self.lexer.token()\n        if not tok or tok.value != \"  \":\n            self.t_SPACE = None\n        else:\n            self.t_SPACE = tok.type\n\n        # Determine the token type for newlines\n        self.lexer.input(\"\\n\")\n        tok = self.lexer.token()\n        if not tok or tok.value != \"\\n\":\n            self.t_NEWLINE = None\n            print(\"Couldn't determine token for newlines\")\n        else:\n            self.t_NEWLINE = tok.type\n\n        self.t_WS = (self.t_SPACE, self.t_NEWLINE)\n\n        # Check for other characters used by the preprocessor\n        chars = [ '<','>','#','##','\\\\','(',')',',','.']\n        for c in chars:\n            self.lexer.input(c)\n            tok = self.lexer.token()\n            if not tok or tok.value != c:\n                print(\"Unable to lex '%s' required for preprocessor\" % c)"},{"id":11425,"name":"jquery-3.1.1.js","nodeType":"TextFile","path":"astropy/extern/jquery/data/js","text":"/*!\n * jQuery JavaScript Library v3.1.1\n * https://jquery.com/\n *\n * Includes Sizzle.js\n * https://sizzlejs.com/\n *\n * Copyright jQuery Foundation and other contributors\n * Released under the MIT license\n * https://jquery.org/license\n *\n * Date: 2016-09-22T22:30Z\n */\n( function( global, factory ) {\n\n\t\"use strict\";\n\n\tif ( typeof module === \"object\" && typeof module.exports === \"object\" ) {\n\n\t\t// For CommonJS and CommonJS-like environments where a proper `window`\n\t\t// is present, execute the factory and get jQuery.\n\t\t// For environments that do not have a `window` with a `document`\n\t\t// (such as Node.js), expose a factory as module.exports.\n\t\t// This accentuates the need for the creation of a real `window`.\n\t\t// e.g. var jQuery = require(\"jquery\")(window);\n\t\t// See ticket #14549 for more info.\n\t\tmodule.exports = global.document ?\n\t\t\tfactory( global, true ) :\n\t\t\tfunction( w ) {\n\t\t\t\tif ( !w.document ) {\n\t\t\t\t\tthrow new Error( \"jQuery requires a window with a document\" );\n\t\t\t\t}\n\t\t\t\treturn factory( w );\n\t\t\t};\n\t} else {\n\t\tfactory( global );\n\t}\n\n// Pass this if window is not defined yet\n} )( typeof window !== \"undefined\" ? window : this, function( window, noGlobal ) {\n\n// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1\n// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode\n// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common\n// enough that all such attempts are guarded in a try block.\n\"use strict\";\n\nvar arr = [];\n\nvar document = window.document;\n\nvar getProto = Object.getPrototypeOf;\n\nvar slice = arr.slice;\n\nvar concat = arr.concat;\n\nvar push = arr.push;\n\nvar indexOf = arr.indexOf;\n\nvar class2type = {};\n\nvar toString = class2type.toString;\n\nvar hasOwn = class2type.hasOwnProperty;\n\nvar fnToString = hasOwn.toString;\n\nvar ObjectFunctionString = fnToString.call( Object );\n\nvar support = {};\n\n\n\n\tfunction DOMEval( code, doc ) {\n\t\tdoc = doc || document;\n\n\t\tvar script = doc.createElement( \"script\" );\n\n\t\tscript.text = code;\n\t\tdoc.head.appendChild( script ).parentNode.removeChild( script );\n\t}\n/* global Symbol */\n// Defining this global in .eslintrc.json would create a danger of using the global\n// unguarded in another place, it seems safer to define global only for this module\n\n\n\nvar\n\tversion = \"3.1.1\",\n\n\t// Define a local copy of jQuery\n\tjQuery = function( selector, context ) {\n\n\t\t// The jQuery object is actually just the init constructor 'enhanced'\n\t\t// Need init if jQuery is called (just allow error to be thrown if not included)\n\t\treturn new jQuery.fn.init( selector, context );\n\t},\n\n\t// Support: Android <=4.0 only\n\t// Make sure we trim BOM and NBSP\n\trtrim = /^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g,\n\n\t// Matches dashed string for camelizing\n\trmsPrefix = /^-ms-/,\n\trdashAlpha = /-([a-z])/g,\n\n\t// Used by jQuery.camelCase as callback to replace()\n\tfcamelCase = function( all, letter ) {\n\t\treturn letter.toUpperCase();\n\t};\n\njQuery.fn = jQuery.prototype = {\n\n\t// The current version of jQuery being used\n\tjquery: version,\n\n\tconstructor: jQuery,\n\n\t// The default length of a jQuery object is 0\n\tlength: 0,\n\n\ttoArray: function() {\n\t\treturn slice.call( this );\n\t},\n\n\t// Get the Nth element in the matched element set OR\n\t// Get the whole matched element set as a clean array\n\tget: function( num ) {\n\n\t\t// Return all the elements in a clean array\n\t\tif ( num == null ) {\n\t\t\treturn slice.call( this );\n\t\t}\n\n\t\t// Return just the one element from the set\n\t\treturn num < 0 ? this[ num + this.length ] : this[ num ];\n\t},\n\n\t// Take an array of elements and push it onto the stack\n\t// (returning the new matched element set)\n\tpushStack: function( elems ) {\n\n\t\t// Build a new jQuery matched element set\n\t\tvar ret = jQuery.merge( this.constructor(), elems );\n\n\t\t// Add the old object onto the stack (as a reference)\n\t\tret.prevObject = this;\n\n\t\t// Return the newly-formed element set\n\t\treturn ret;\n\t},\n\n\t// Execute a callback for every element in the matched set.\n\teach: function( callback ) {\n\t\treturn jQuery.each( this, callback );\n\t},\n\n\tmap: function( callback ) {\n\t\treturn this.pushStack( jQuery.map( this, function( elem, i ) {\n\t\t\treturn callback.call( elem, i, elem );\n\t\t} ) );\n\t},\n\n\tslice: function() {\n\t\treturn this.pushStack( slice.apply( this, arguments ) );\n\t},\n\n\tfirst: function() {\n\t\treturn this.eq( 0 );\n\t},\n\n\tlast: function() {\n\t\treturn this.eq( -1 );\n\t},\n\n\teq: function( i ) {\n\t\tvar len = this.length,\n\t\t\tj = +i + ( i < 0 ? len : 0 );\n\t\treturn this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );\n\t},\n\n\tend: function() {\n\t\treturn this.prevObject || this.constructor();\n\t},\n\n\t// For internal use only.\n\t// Behaves like an Array's method, not like a jQuery method.\n\tpush: push,\n\tsort: arr.sort,\n\tsplice: arr.splice\n};\n\njQuery.extend = jQuery.fn.extend = function() {\n\tvar options, name, src, copy, copyIsArray, clone,\n\t\ttarget = arguments[ 0 ] || {},\n\t\ti = 1,\n\t\tlength = arguments.length,\n\t\tdeep = false;\n\n\t// Handle a deep copy situation\n\tif ( typeof target === \"boolean\" ) {\n\t\tdeep = target;\n\n\t\t// Skip the boolean and the target\n\t\ttarget = arguments[ i ] || {};\n\t\ti++;\n\t}\n\n\t// Handle case when target is a string or something (possible in deep copy)\n\tif ( typeof target !== \"object\" && !jQuery.isFunction( target ) ) {\n\t\ttarget = {};\n\t}\n\n\t// Extend jQuery itself if only one argument is passed\n\tif ( i === length ) {\n\t\ttarget = this;\n\t\ti--;\n\t}\n\n\tfor ( ; i < length; i++ ) {\n\n\t\t// Only deal with non-null/undefined values\n\t\tif ( ( options = arguments[ i ] ) != null ) {\n\n\t\t\t// Extend the base object\n\t\t\tfor ( name in options ) {\n\t\t\t\tsrc = target[ name ];\n\t\t\t\tcopy = options[ name ];\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif ( target === copy ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\tif ( deep && copy && ( jQuery.isPlainObject( copy ) ||\n\t\t\t\t\t( copyIsArray = jQuery.isArray( copy ) ) ) ) {\n\n\t\t\t\t\tif ( copyIsArray ) {\n\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\tclone = src && jQuery.isArray( src ) ? src : [];\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tclone = src && jQuery.isPlainObject( src ) ? src : {};\n\t\t\t\t\t}\n\n\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\ttarget[ name ] = jQuery.extend( deep, clone, copy );\n\n\t\t\t\t// Don't bring in undefined values\n\t\t\t\t} else if ( copy !== undefined ) {\n\t\t\t\t\ttarget[ name ] = copy;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n\njQuery.extend( {\n\n\t// Unique for each copy of jQuery on the page\n\texpando: \"jQuery\" + ( version + Math.random() ).replace( /\\D/g, \"\" ),\n\n\t// Assume jQuery is ready without the ready module\n\tisReady: true,\n\n\terror: function( msg ) {\n\t\tthrow new Error( msg );\n\t},\n\n\tnoop: function() {},\n\n\tisFunction: function( obj ) {\n\t\treturn jQuery.type( obj ) === \"function\";\n\t},\n\n\tisArray: Array.isArray,\n\n\tisWindow: function( obj ) {\n\t\treturn obj != null && obj === obj.window;\n\t},\n\n\tisNumeric: function( obj ) {\n\n\t\t// As of jQuery 3.0, isNumeric is limited to\n\t\t// strings and numbers (primitives or objects)\n\t\t// that can be coerced to finite numbers (gh-2662)\n\t\tvar type = jQuery.type( obj );\n\t\treturn ( type === \"number\" || type === \"string\" ) &&\n\n\t\t\t// parseFloat NaNs numeric-cast false positives (\"\")\n\t\t\t// ...but misinterprets leading-number strings, particularly hex literals (\"0x...\")\n\t\t\t// subtraction forces infinities to NaN\n\t\t\t!isNaN( obj - parseFloat( obj ) );\n\t},\n\n\tisPlainObject: function( obj ) {\n\t\tvar proto, Ctor;\n\n\t\t// Detect obvious negatives\n\t\t// Use toString instead of jQuery.type to catch host objects\n\t\tif ( !obj || toString.call( obj ) !== \"[object Object]\" ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tproto = getProto( obj );\n\n\t\t// Objects with no prototype (e.g., `Object.create( null )`) are plain\n\t\tif ( !proto ) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Objects with prototype are plain iff they were constructed by a global Object function\n\t\tCtor = hasOwn.call( proto, \"constructor\" ) && proto.constructor;\n\t\treturn typeof Ctor === \"function\" && fnToString.call( Ctor ) === ObjectFunctionString;\n\t},\n\n\tisEmptyObject: function( obj ) {\n\n\t\t/* eslint-disable no-unused-vars */\n\t\t// See https://github.com/eslint/eslint/issues/6125\n\t\tvar name;\n\n\t\tfor ( name in obj ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t},\n\n\ttype: function( obj ) {\n\t\tif ( obj == null ) {\n\t\t\treturn obj + \"\";\n\t\t}\n\n\t\t// Support: Android <=2.3 only (functionish RegExp)\n\t\treturn typeof obj === \"object\" || typeof obj === \"function\" ?\n\t\t\tclass2type[ toString.call( obj ) ] || \"object\" :\n\t\t\ttypeof obj;\n\t},\n\n\t// Evaluates a script in a global context\n\tglobalEval: function( code ) {\n\t\tDOMEval( code );\n\t},\n\n\t// Convert dashed to camelCase; used by the css and data modules\n\t// Support: IE <=9 - 11, Edge 12 - 13\n\t// Microsoft forgot to hump their vendor prefix (#9572)\n\tcamelCase: function( string ) {\n\t\treturn string.replace( rmsPrefix, \"ms-\" ).replace( rdashAlpha, fcamelCase );\n\t},\n\n\tnodeName: function( elem, name ) {\n\t\treturn elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();\n\t},\n\n\teach: function( obj, callback ) {\n\t\tvar length, i = 0;\n\n\t\tif ( isArrayLike( obj ) ) {\n\t\t\tlength = obj.length;\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tif ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( i in obj ) {\n\t\t\t\tif ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn obj;\n\t},\n\n\t// Support: Android <=4.0 only\n\ttrim: function( text ) {\n\t\treturn text == null ?\n\t\t\t\"\" :\n\t\t\t( text + \"\" ).replace( rtrim, \"\" );\n\t},\n\n\t// results is for internal usage only\n\tmakeArray: function( arr, results ) {\n\t\tvar ret = results || [];\n\n\t\tif ( arr != null ) {\n\t\t\tif ( isArrayLike( Object( arr ) ) ) {\n\t\t\t\tjQuery.merge( ret,\n\t\t\t\t\ttypeof arr === \"string\" ?\n\t\t\t\t\t[ arr ] : arr\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tpush.call( ret, arr );\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\tinArray: function( elem, arr, i ) {\n\t\treturn arr == null ? -1 : indexOf.call( arr, elem, i );\n\t},\n\n\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t// push.apply(_, arraylike) throws on ancient WebKit\n\tmerge: function( first, second ) {\n\t\tvar len = +second.length,\n\t\t\tj = 0,\n\t\t\ti = first.length;\n\n\t\tfor ( ; j < len; j++ ) {\n\t\t\tfirst[ i++ ] = second[ j ];\n\t\t}\n\n\t\tfirst.length = i;\n\n\t\treturn first;\n\t},\n\n\tgrep: function( elems, callback, invert ) {\n\t\tvar callbackInverse,\n\t\t\tmatches = [],\n\t\t\ti = 0,\n\t\t\tlength = elems.length,\n\t\t\tcallbackExpect = !invert;\n\n\t\t// Go through the array, only saving the items\n\t\t// that pass the validator function\n\t\tfor ( ; i < length; i++ ) {\n\t\t\tcallbackInverse = !callback( elems[ i ], i );\n\t\t\tif ( callbackInverse !== callbackExpect ) {\n\t\t\t\tmatches.push( elems[ i ] );\n\t\t\t}\n\t\t}\n\n\t\treturn matches;\n\t},\n\n\t// arg is for internal usage only\n\tmap: function( elems, callback, arg ) {\n\t\tvar length, value,\n\t\t\ti = 0,\n\t\t\tret = [];\n\n\t\t// Go through the array, translating each of the items to their new values\n\t\tif ( isArrayLike( elems ) ) {\n\t\t\tlength = elems.length;\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tvalue = callback( elems[ i ], i, arg );\n\n\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret.push( value );\n\t\t\t\t}\n\t\t\t}\n\n\t\t// Go through every key on the object,\n\t\t} else {\n\t\t\tfor ( i in elems ) {\n\t\t\t\tvalue = callback( elems[ i ], i, arg );\n\n\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret.push( value );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Flatten any nested arrays\n\t\treturn concat.apply( [], ret );\n\t},\n\n\t// A global GUID counter for objects\n\tguid: 1,\n\n\t// Bind a function to a context, optionally partially applying any\n\t// arguments.\n\tproxy: function( fn, context ) {\n\t\tvar tmp, args, proxy;\n\n\t\tif ( typeof context === \"string\" ) {\n\t\t\ttmp = fn[ context ];\n\t\t\tcontext = fn;\n\t\t\tfn = tmp;\n\t\t}\n\n\t\t// Quick check to determine if target is callable, in the spec\n\t\t// this throws a TypeError, but we will just return undefined.\n\t\tif ( !jQuery.isFunction( fn ) ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Simulated bind\n\t\targs = slice.call( arguments, 2 );\n\t\tproxy = function() {\n\t\t\treturn fn.apply( context || this, args.concat( slice.call( arguments ) ) );\n\t\t};\n\n\t\t// Set the guid of unique handler to the same of original handler, so it can be removed\n\t\tproxy.guid = fn.guid = fn.guid || jQuery.guid++;\n\n\t\treturn proxy;\n\t},\n\n\tnow: Date.now,\n\n\t// jQuery.support is not used in Core but other projects attach their\n\t// properties to it so it needs to exist.\n\tsupport: support\n} );\n\nif ( typeof Symbol === \"function\" ) {\n\tjQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];\n}\n\n// Populate the class2type map\njQuery.each( \"Boolean Number String Function Array Date RegExp Object Error Symbol\".split( \" \" ),\nfunction( i, name ) {\n\tclass2type[ \"[object \" + name + \"]\" ] = name.toLowerCase();\n} );\n\nfunction isArrayLike( obj ) {\n\n\t// Support: real iOS 8.2 only (not reproducible in simulator)\n\t// `in` check used to prevent JIT error (gh-2145)\n\t// hasOwn isn't used here due to false negatives\n\t// regarding Nodelist length in IE\n\tvar length = !!obj && \"length\" in obj && obj.length,\n\t\ttype = jQuery.type( obj );\n\n\tif ( type === \"function\" || jQuery.isWindow( obj ) ) {\n\t\treturn false;\n\t}\n\n\treturn type === \"array\" || length === 0 ||\n\t\ttypeof length === \"number\" && length > 0 && ( length - 1 ) in obj;\n}\nvar Sizzle =\n/*!\n * Sizzle CSS Selector Engine v2.3.3\n * https://sizzlejs.com/\n *\n * Copyright jQuery Foundation and other contributors\n * Released under the MIT license\n * http://jquery.org/license\n *\n * Date: 2016-08-08\n */\n(function( window ) {\n\nvar i,\n\tsupport,\n\tExpr,\n\tgetText,\n\tisXML,\n\ttokenize,\n\tcompile,\n\tselect,\n\toutermostContext,\n\tsortInput,\n\thasDuplicate,\n\n\t// Local document vars\n\tsetDocument,\n\tdocument,\n\tdocElem,\n\tdocumentIsHTML,\n\trbuggyQSA,\n\trbuggyMatches,\n\tmatches,\n\tcontains,\n\n\t// Instance-specific data\n\texpando = \"sizzle\" + 1 * new Date(),\n\tpreferredDoc = window.document,\n\tdirruns = 0,\n\tdone = 0,\n\tclassCache = createCache(),\n\ttokenCache = createCache(),\n\tcompilerCache = createCache(),\n\tsortOrder = function( a, b ) {\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t}\n\t\treturn 0;\n\t},\n\n\t// Instance methods\n\thasOwn = ({}).hasOwnProperty,\n\tarr = [],\n\tpop = arr.pop,\n\tpush_native = arr.push,\n\tpush = arr.push,\n\tslice = arr.slice,\n\t// Use a stripped-down indexOf as it's faster than native\n\t// https://jsperf.com/thor-indexof-vs-for/5\n\tindexOf = function( list, elem ) {\n\t\tvar i = 0,\n\t\t\tlen = list.length;\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( list[i] === elem ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t},\n\n\tbooleans = \"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped\",\n\n\t// Regular expressions\n\n\t// http://www.w3.org/TR/css3-selectors/#whitespace\n\twhitespace = \"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\",\n\n\t// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier\n\tidentifier = \"(?:\\\\\\\\.|[\\\\w-]|[^\\0-\\\\xa0])+\",\n\n\t// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors\n\tattributes = \"\\\\[\" + whitespace + \"*(\" + identifier + \")(?:\" + whitespace +\n\t\t// Operator (capture 2)\n\t\t\"*([*^$|!~]?=)\" + whitespace +\n\t\t// \"Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]\"\n\t\t\"*(?:'((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\"|(\" + identifier + \"))|)\" + whitespace +\n\t\t\"*\\\\]\",\n\n\tpseudos = \":(\" + identifier + \")(?:\\\\((\" +\n\t\t// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:\n\t\t// 1. quoted (capture 3; capture 4 or capture 5)\n\t\t\"('((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\")|\" +\n\t\t// 2. simple (capture 6)\n\t\t\"((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|\" + attributes + \")*)|\" +\n\t\t// 3. anything else (capture 2)\n\t\t\".*\" +\n\t\t\")\\\\)|)\",\n\n\t// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter\n\trwhitespace = new RegExp( whitespace + \"+\", \"g\" ),\n\trtrim = new RegExp( \"^\" + whitespace + \"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\" + whitespace + \"+$\", \"g\" ),\n\n\trcomma = new RegExp( \"^\" + whitespace + \"*,\" + whitespace + \"*\" ),\n\trcombinators = new RegExp( \"^\" + whitespace + \"*([>+~]|\" + whitespace + \")\" + whitespace + \"*\" ),\n\n\trattributeQuotes = new RegExp( \"=\" + whitespace + \"*([^\\\\]'\\\"]*?)\" + whitespace + \"*\\\\]\", \"g\" ),\n\n\trpseudo = new RegExp( pseudos ),\n\tridentifier = new RegExp( \"^\" + identifier + \"$\" ),\n\n\tmatchExpr = {\n\t\t\"ID\": new RegExp( \"^#(\" + identifier + \")\" ),\n\t\t\"CLASS\": new RegExp( \"^\\\\.(\" + identifier + \")\" ),\n\t\t\"TAG\": new RegExp( \"^(\" + identifier + \"|[*])\" ),\n\t\t\"ATTR\": new RegExp( \"^\" + attributes ),\n\t\t\"PSEUDO\": new RegExp( \"^\" + pseudos ),\n\t\t\"CHILD\": new RegExp( \"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(\" + whitespace +\n\t\t\t\"*(even|odd|(([+-]|)(\\\\d*)n|)\" + whitespace + \"*(?:([+-]|)\" + whitespace +\n\t\t\t\"*(\\\\d+)|))\" + whitespace + \"*\\\\)|)\", \"i\" ),\n\t\t\"bool\": new RegExp( \"^(?:\" + booleans + \")$\", \"i\" ),\n\t\t// For use in libraries implementing .is()\n\t\t// We use this for POS matching in `select`\n\t\t\"needsContext\": new RegExp( \"^\" + whitespace + \"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\" +\n\t\t\twhitespace + \"*((?:-\\\\d)?\\\\d*)\" + whitespace + \"*\\\\)|)(?=[^-]|$)\", \"i\" )\n\t},\n\n\trinputs = /^(?:input|select|textarea|button)$/i,\n\trheader = /^h\\d$/i,\n\n\trnative = /^[^{]+\\{\\s*\\[native \\w/,\n\n\t// Easily-parseable/retrievable ID or TAG or CLASS selectors\n\trquickExpr = /^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/,\n\n\trsibling = /[+~]/,\n\n\t// CSS escapes\n\t// http://www.w3.org/TR/CSS21/syndata.html#escaped-characters\n\trunescape = new RegExp( \"\\\\\\\\([\\\\da-f]{1,6}\" + whitespace + \"?|(\" + whitespace + \")|.)\", \"ig\" ),\n\tfunescape = function( _, escaped, escapedWhitespace ) {\n\t\tvar high = \"0x\" + escaped - 0x10000;\n\t\t// NaN means non-codepoint\n\t\t// Support: Firefox<24\n\t\t// Workaround erroneous numeric interpretation of +\"0x\"\n\t\treturn high !== high || escapedWhitespace ?\n\t\t\tescaped :\n\t\t\thigh < 0 ?\n\t\t\t\t// BMP codepoint\n\t\t\t\tString.fromCharCode( high + 0x10000 ) :\n\t\t\t\t// Supplemental Plane codepoint (surrogate pair)\n\t\t\t\tString.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );\n\t},\n\n\t// CSS string/identifier serialization\n\t// https://drafts.csswg.org/cssom/#common-serializing-idioms\n\trcssescape = /([\\0-\\x1f\\x7f]|^-?\\d)|^-$|[^\\0-\\x1f\\x7f-\\uFFFF\\w-]/g,\n\tfcssescape = function( ch, asCodePoint ) {\n\t\tif ( asCodePoint ) {\n\n\t\t\t// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER\n\t\t\tif ( ch === \"\\0\" ) {\n\t\t\t\treturn \"\\uFFFD\";\n\t\t\t}\n\n\t\t\t// Control characters and (dependent upon position) numbers get escaped as code points\n\t\t\treturn ch.slice( 0, -1 ) + \"\\\\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + \" \";\n\t\t}\n\n\t\t// Other potentially-special ASCII characters get backslash-escaped\n\t\treturn \"\\\\\" + ch;\n\t},\n\n\t// Used for iframes\n\t// See setDocument()\n\t// Removing the function wrapper causes a \"Permission Denied\"\n\t// error in IE\n\tunloadHandler = function() {\n\t\tsetDocument();\n\t},\n\n\tdisabledAncestor = addCombinator(\n\t\tfunction( elem ) {\n\t\t\treturn elem.disabled === true && (\"form\" in elem || \"label\" in elem);\n\t\t},\n\t\t{ dir: \"parentNode\", next: \"legend\" }\n\t);\n\n// Optimize for push.apply( _, NodeList )\ntry {\n\tpush.apply(\n\t\t(arr = slice.call( preferredDoc.childNodes )),\n\t\tpreferredDoc.childNodes\n\t);\n\t// Support: Android<4.0\n\t// Detect silently failing push.apply\n\tarr[ preferredDoc.childNodes.length ].nodeType;\n} catch ( e ) {\n\tpush = { apply: arr.length ?\n\n\t\t// Leverage slice if possible\n\t\tfunction( target, els ) {\n\t\t\tpush_native.apply( target, slice.call(els) );\n\t\t} :\n\n\t\t// Support: IE<9\n\t\t// Otherwise append directly\n\t\tfunction( target, els ) {\n\t\t\tvar j = target.length,\n\t\t\t\ti = 0;\n\t\t\t// Can't trust NodeList.length\n\t\t\twhile ( (target[j++] = els[i++]) ) {}\n\t\t\ttarget.length = j - 1;\n\t\t}\n\t};\n}\n\nfunction Sizzle( selector, context, results, seed ) {\n\tvar m, i, elem, nid, match, groups, newSelector,\n\t\tnewContext = context && context.ownerDocument,\n\n\t\t// nodeType defaults to 9, since context defaults to document\n\t\tnodeType = context ? context.nodeType : 9;\n\n\tresults = results || [];\n\n\t// Return early from calls with invalid selector or context\n\tif ( typeof selector !== \"string\" || !selector ||\n\t\tnodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {\n\n\t\treturn results;\n\t}\n\n\t// Try to shortcut find operations (as opposed to filters) in HTML documents\n\tif ( !seed ) {\n\n\t\tif ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {\n\t\t\tsetDocument( context );\n\t\t}\n\t\tcontext = context || document;\n\n\t\tif ( documentIsHTML ) {\n\n\t\t\t// If the selector is sufficiently simple, try using a \"get*By*\" DOM method\n\t\t\t// (excepting DocumentFragment context, where the methods don't exist)\n\t\t\tif ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {\n\n\t\t\t\t// ID selector\n\t\t\t\tif ( (m = match[1]) ) {\n\n\t\t\t\t\t// Document context\n\t\t\t\t\tif ( nodeType === 9 ) {\n\t\t\t\t\t\tif ( (elem = context.getElementById( m )) ) {\n\n\t\t\t\t\t\t\t// Support: IE, Opera, Webkit\n\t\t\t\t\t\t\t// TODO: identify versions\n\t\t\t\t\t\t\t// getElementById can match elements by name instead of ID\n\t\t\t\t\t\t\tif ( elem.id === m ) {\n\t\t\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t// Element context\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// Support: IE, Opera, Webkit\n\t\t\t\t\t\t// TODO: identify versions\n\t\t\t\t\t\t// getElementById can match elements by name instead of ID\n\t\t\t\t\t\tif ( newContext && (elem = newContext.getElementById( m )) &&\n\t\t\t\t\t\t\tcontains( context, elem ) &&\n\t\t\t\t\t\t\telem.id === m ) {\n\n\t\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t// Type selector\n\t\t\t\t} else if ( match[2] ) {\n\t\t\t\t\tpush.apply( results, context.getElementsByTagName( selector ) );\n\t\t\t\t\treturn results;\n\n\t\t\t\t// Class selector\n\t\t\t\t} else if ( (m = match[3]) && support.getElementsByClassName &&\n\t\t\t\t\tcontext.getElementsByClassName ) {\n\n\t\t\t\t\tpush.apply( results, context.getElementsByClassName( m ) );\n\t\t\t\t\treturn results;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Take advantage of querySelectorAll\n\t\t\tif ( support.qsa &&\n\t\t\t\t!compilerCache[ selector + \" \" ] &&\n\t\t\t\t(!rbuggyQSA || !rbuggyQSA.test( selector )) ) {\n\n\t\t\t\tif ( nodeType !== 1 ) {\n\t\t\t\t\tnewContext = context;\n\t\t\t\t\tnewSelector = selector;\n\n\t\t\t\t// qSA looks outside Element context, which is not what we want\n\t\t\t\t// Thanks to Andrew Dupont for this workaround technique\n\t\t\t\t// Support: IE <=8\n\t\t\t\t// Exclude object elements\n\t\t\t\t} else if ( context.nodeName.toLowerCase() !== \"object\" ) {\n\n\t\t\t\t\t// Capture the context ID, setting it first if necessary\n\t\t\t\t\tif ( (nid = context.getAttribute( \"id\" )) ) {\n\t\t\t\t\t\tnid = nid.replace( rcssescape, fcssescape );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontext.setAttribute( \"id\", (nid = expando) );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Prefix every selector in the list\n\t\t\t\t\tgroups = tokenize( selector );\n\t\t\t\t\ti = groups.length;\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tgroups[i] = \"#\" + nid + \" \" + toSelector( groups[i] );\n\t\t\t\t\t}\n\t\t\t\t\tnewSelector = groups.join( \",\" );\n\n\t\t\t\t\t// Expand context for sibling selectors\n\t\t\t\t\tnewContext = rsibling.test( selector ) && testContext( context.parentNode ) ||\n\t\t\t\t\t\tcontext;\n\t\t\t\t}\n\n\t\t\t\tif ( newSelector ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tpush.apply( results,\n\t\t\t\t\t\t\tnewContext.querySelectorAll( newSelector )\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn results;\n\t\t\t\t\t} catch ( qsaError ) {\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tif ( nid === expando ) {\n\t\t\t\t\t\t\tcontext.removeAttribute( \"id\" );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// All others\n\treturn select( selector.replace( rtrim, \"$1\" ), context, results, seed );\n}\n\n/**\n * Create key-value caches of limited size\n * @returns {function(string, object)} Returns the Object data after storing it on itself with\n *\tproperty name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)\n *\tdeleting the oldest entry\n */\nfunction createCache() {\n\tvar keys = [];\n\n\tfunction cache( key, value ) {\n\t\t// Use (key + \" \") to avoid collision with native prototype properties (see Issue #157)\n\t\tif ( keys.push( key + \" \" ) > Expr.cacheLength ) {\n\t\t\t// Only keep the most recent entries\n\t\t\tdelete cache[ keys.shift() ];\n\t\t}\n\t\treturn (cache[ key + \" \" ] = value);\n\t}\n\treturn cache;\n}\n\n/**\n * Mark a function for special use by Sizzle\n * @param {Function} fn The function to mark\n */\nfunction markFunction( fn ) {\n\tfn[ expando ] = true;\n\treturn fn;\n}\n\n/**\n * Support testing using an element\n * @param {Function} fn Passed the created element and returns a boolean result\n */\nfunction assert( fn ) {\n\tvar el = document.createElement(\"fieldset\");\n\n\ttry {\n\t\treturn !!fn( el );\n\t} catch (e) {\n\t\treturn false;\n\t} finally {\n\t\t// Remove from its parent by default\n\t\tif ( el.parentNode ) {\n\t\t\tel.parentNode.removeChild( el );\n\t\t}\n\t\t// release memory in IE\n\t\tel = null;\n\t}\n}\n\n/**\n * Adds the same handler for all of the specified attrs\n * @param {String} attrs Pipe-separated list of attributes\n * @param {Function} handler The method that will be applied\n */\nfunction addHandle( attrs, handler ) {\n\tvar arr = attrs.split(\"|\"),\n\t\ti = arr.length;\n\n\twhile ( i-- ) {\n\t\tExpr.attrHandle[ arr[i] ] = handler;\n\t}\n}\n\n/**\n * Checks document order of two siblings\n * @param {Element} a\n * @param {Element} b\n * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b\n */\nfunction siblingCheck( a, b ) {\n\tvar cur = b && a,\n\t\tdiff = cur && a.nodeType === 1 && b.nodeType === 1 &&\n\t\t\ta.sourceIndex - b.sourceIndex;\n\n\t// Use IE sourceIndex if available on both nodes\n\tif ( diff ) {\n\t\treturn diff;\n\t}\n\n\t// Check if b follows a\n\tif ( cur ) {\n\t\twhile ( (cur = cur.nextSibling) ) {\n\t\t\tif ( cur === b ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn a ? 1 : -1;\n}\n\n/**\n * Returns a function to use in pseudos for input types\n * @param {String} type\n */\nfunction createInputPseudo( type ) {\n\treturn function( elem ) {\n\t\tvar name = elem.nodeName.toLowerCase();\n\t\treturn name === \"input\" && elem.type === type;\n\t};\n}\n\n/**\n * Returns a function to use in pseudos for buttons\n * @param {String} type\n */\nfunction createButtonPseudo( type ) {\n\treturn function( elem ) {\n\t\tvar name = elem.nodeName.toLowerCase();\n\t\treturn (name === \"input\" || name === \"button\") && elem.type === type;\n\t};\n}\n\n/**\n * Returns a function to use in pseudos for :enabled/:disabled\n * @param {Boolean} disabled true for :disabled; false for :enabled\n */\nfunction createDisabledPseudo( disabled ) {\n\n\t// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable\n\treturn function( elem ) {\n\n\t\t// Only certain elements can match :enabled or :disabled\n\t\t// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled\n\t\t// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled\n\t\tif ( \"form\" in elem ) {\n\n\t\t\t// Check for inherited disabledness on relevant non-disabled elements:\n\t\t\t// * listed form-associated elements in a disabled fieldset\n\t\t\t//   https://html.spec.whatwg.org/multipage/forms.html#category-listed\n\t\t\t//   https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled\n\t\t\t// * option elements in a disabled optgroup\n\t\t\t//   https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled\n\t\t\t// All such elements have a \"form\" property.\n\t\t\tif ( elem.parentNode && elem.disabled === false ) {\n\n\t\t\t\t// Option elements defer to a parent optgroup if present\n\t\t\t\tif ( \"label\" in elem ) {\n\t\t\t\t\tif ( \"label\" in elem.parentNode ) {\n\t\t\t\t\t\treturn elem.parentNode.disabled === disabled;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn elem.disabled === disabled;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Support: IE 6 - 11\n\t\t\t\t// Use the isDisabled shortcut property to check for disabled fieldset ancestors\n\t\t\t\treturn elem.isDisabled === disabled ||\n\n\t\t\t\t\t// Where there is no isDisabled, check manually\n\t\t\t\t\t/* jshint -W018 */\n\t\t\t\t\telem.isDisabled !== !disabled &&\n\t\t\t\t\t\tdisabledAncestor( elem ) === disabled;\n\t\t\t}\n\n\t\t\treturn elem.disabled === disabled;\n\n\t\t// Try to winnow out elements that can't be disabled before trusting the disabled property.\n\t\t// Some victims get caught in our net (label, legend, menu, track), but it shouldn't\n\t\t// even exist on them, let alone have a boolean value.\n\t\t} else if ( \"label\" in elem ) {\n\t\t\treturn elem.disabled === disabled;\n\t\t}\n\n\t\t// Remaining elements are neither :enabled nor :disabled\n\t\treturn false;\n\t};\n}\n\n/**\n * Returns a function to use in pseudos for positionals\n * @param {Function} fn\n */\nfunction createPositionalPseudo( fn ) {\n\treturn markFunction(function( argument ) {\n\t\targument = +argument;\n\t\treturn markFunction(function( seed, matches ) {\n\t\t\tvar j,\n\t\t\t\tmatchIndexes = fn( [], seed.length, argument ),\n\t\t\t\ti = matchIndexes.length;\n\n\t\t\t// Match elements found at the specified indexes\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( seed[ (j = matchIndexes[i]) ] ) {\n\t\t\t\t\tseed[j] = !(matches[j] = seed[j]);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n}\n\n/**\n * Checks a node for validity as a Sizzle context\n * @param {Element|Object=} context\n * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value\n */\nfunction testContext( context ) {\n\treturn context && typeof context.getElementsByTagName !== \"undefined\" && context;\n}\n\n// Expose support vars for convenience\nsupport = Sizzle.support = {};\n\n/**\n * Detects XML nodes\n * @param {Element|Object} elem An element or a document\n * @returns {Boolean} True iff elem is a non-HTML XML node\n */\nisXML = Sizzle.isXML = function( elem ) {\n\t// documentElement is verified for cases where it doesn't yet exist\n\t// (such as loading iframes in IE - #4833)\n\tvar documentElement = elem && (elem.ownerDocument || elem).documentElement;\n\treturn documentElement ? documentElement.nodeName !== \"HTML\" : false;\n};\n\n/**\n * Sets document-related variables once based on the current document\n * @param {Element|Object} [doc] An element or document object to use to set the document\n * @returns {Object} Returns the current document\n */\nsetDocument = Sizzle.setDocument = function( node ) {\n\tvar hasCompare, subWindow,\n\t\tdoc = node ? node.ownerDocument || node : preferredDoc;\n\n\t// Return early if doc is invalid or already selected\n\tif ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {\n\t\treturn document;\n\t}\n\n\t// Update global variables\n\tdocument = doc;\n\tdocElem = document.documentElement;\n\tdocumentIsHTML = !isXML( document );\n\n\t// Support: IE 9-11, Edge\n\t// Accessing iframe documents after unload throws \"permission denied\" errors (jQuery #13936)\n\tif ( preferredDoc !== document &&\n\t\t(subWindow = document.defaultView) && subWindow.top !== subWindow ) {\n\n\t\t// Support: IE 11, Edge\n\t\tif ( subWindow.addEventListener ) {\n\t\t\tsubWindow.addEventListener( \"unload\", unloadHandler, false );\n\n\t\t// Support: IE 9 - 10 only\n\t\t} else if ( subWindow.attachEvent ) {\n\t\t\tsubWindow.attachEvent( \"onunload\", unloadHandler );\n\t\t}\n\t}\n\n\t/* Attributes\n\t---------------------------------------------------------------------- */\n\n\t// Support: IE<8\n\t// Verify that getAttribute really returns attributes and not properties\n\t// (excepting IE8 booleans)\n\tsupport.attributes = assert(function( el ) {\n\t\tel.className = \"i\";\n\t\treturn !el.getAttribute(\"className\");\n\t});\n\n\t/* getElement(s)By*\n\t---------------------------------------------------------------------- */\n\n\t// Check if getElementsByTagName(\"*\") returns only elements\n\tsupport.getElementsByTagName = assert(function( el ) {\n\t\tel.appendChild( document.createComment(\"\") );\n\t\treturn !el.getElementsByTagName(\"*\").length;\n\t});\n\n\t// Support: IE<9\n\tsupport.getElementsByClassName = rnative.test( document.getElementsByClassName );\n\n\t// Support: IE<10\n\t// Check if getElementById returns elements by name\n\t// The broken getElementById methods don't pick up programmatically-set names,\n\t// so use a roundabout getElementsByName test\n\tsupport.getById = assert(function( el ) {\n\t\tdocElem.appendChild( el ).id = expando;\n\t\treturn !document.getElementsByName || !document.getElementsByName( expando ).length;\n\t});\n\n\t// ID filter and find\n\tif ( support.getById ) {\n\t\tExpr.filter[\"ID\"] = function( id ) {\n\t\t\tvar attrId = id.replace( runescape, funescape );\n\t\t\treturn function( elem ) {\n\t\t\t\treturn elem.getAttribute(\"id\") === attrId;\n\t\t\t};\n\t\t};\n\t\tExpr.find[\"ID\"] = function( id, context ) {\n\t\t\tif ( typeof context.getElementById !== \"undefined\" && documentIsHTML ) {\n\t\t\t\tvar elem = context.getElementById( id );\n\t\t\t\treturn elem ? [ elem ] : [];\n\t\t\t}\n\t\t};\n\t} else {\n\t\tExpr.filter[\"ID\"] =  function( id ) {\n\t\t\tvar attrId = id.replace( runescape, funescape );\n\t\t\treturn function( elem ) {\n\t\t\t\tvar node = typeof elem.getAttributeNode !== \"undefined\" &&\n\t\t\t\t\telem.getAttributeNode(\"id\");\n\t\t\t\treturn node && node.value === attrId;\n\t\t\t};\n\t\t};\n\n\t\t// Support: IE 6 - 7 only\n\t\t// getElementById is not reliable as a find shortcut\n\t\tExpr.find[\"ID\"] = function( id, context ) {\n\t\t\tif ( typeof context.getElementById !== \"undefined\" && documentIsHTML ) {\n\t\t\t\tvar node, i, elems,\n\t\t\t\t\telem = context.getElementById( id );\n\n\t\t\t\tif ( elem ) {\n\n\t\t\t\t\t// Verify the id attribute\n\t\t\t\t\tnode = elem.getAttributeNode(\"id\");\n\t\t\t\t\tif ( node && node.value === id ) {\n\t\t\t\t\t\treturn [ elem ];\n\t\t\t\t\t}\n\n\t\t\t\t\t// Fall back on getElementsByName\n\t\t\t\t\telems = context.getElementsByName( id );\n\t\t\t\t\ti = 0;\n\t\t\t\t\twhile ( (elem = elems[i++]) ) {\n\t\t\t\t\t\tnode = elem.getAttributeNode(\"id\");\n\t\t\t\t\t\tif ( node && node.value === id ) {\n\t\t\t\t\t\t\treturn [ elem ];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn [];\n\t\t\t}\n\t\t};\n\t}\n\n\t// Tag\n\tExpr.find[\"TAG\"] = support.getElementsByTagName ?\n\t\tfunction( tag, context ) {\n\t\t\tif ( typeof context.getElementsByTagName !== \"undefined\" ) {\n\t\t\t\treturn context.getElementsByTagName( tag );\n\n\t\t\t// DocumentFragment nodes don't have gEBTN\n\t\t\t} else if ( support.qsa ) {\n\t\t\t\treturn context.querySelectorAll( tag );\n\t\t\t}\n\t\t} :\n\n\t\tfunction( tag, context ) {\n\t\t\tvar elem,\n\t\t\t\ttmp = [],\n\t\t\t\ti = 0,\n\t\t\t\t// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too\n\t\t\t\tresults = context.getElementsByTagName( tag );\n\n\t\t\t// Filter out possible comments\n\t\t\tif ( tag === \"*\" ) {\n\t\t\t\twhile ( (elem = results[i++]) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\t\ttmp.push( elem );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn tmp;\n\t\t\t}\n\t\t\treturn results;\n\t\t};\n\n\t// Class\n\tExpr.find[\"CLASS\"] = support.getElementsByClassName && function( className, context ) {\n\t\tif ( typeof context.getElementsByClassName !== \"undefined\" && documentIsHTML ) {\n\t\t\treturn context.getElementsByClassName( className );\n\t\t}\n\t};\n\n\t/* QSA/matchesSelector\n\t---------------------------------------------------------------------- */\n\n\t// QSA and matchesSelector support\n\n\t// matchesSelector(:active) reports false when true (IE9/Opera 11.5)\n\trbuggyMatches = [];\n\n\t// qSa(:focus) reports false when true (Chrome 21)\n\t// We allow this because of a bug in IE8/9 that throws an error\n\t// whenever `document.activeElement` is accessed on an iframe\n\t// So, we allow :focus to pass through QSA all the time to avoid the IE error\n\t// See https://bugs.jquery.com/ticket/13378\n\trbuggyQSA = [];\n\n\tif ( (support.qsa = rnative.test( document.querySelectorAll )) ) {\n\t\t// Build QSA regex\n\t\t// Regex strategy adopted from Diego Perini\n\t\tassert(function( el ) {\n\t\t\t// Select is set to empty string on purpose\n\t\t\t// This is to test IE's treatment of not explicitly\n\t\t\t// setting a boolean content attribute,\n\t\t\t// since its presence should be enough\n\t\t\t// https://bugs.jquery.com/ticket/12359\n\t\t\tdocElem.appendChild( el ).innerHTML = \"<a id='\" + expando + \"'></a>\" +\n\t\t\t\t\"<select id='\" + expando + \"-\\r\\\\' msallowcapture=''>\" +\n\t\t\t\t\"<option selected=''></option></select>\";\n\n\t\t\t// Support: IE8, Opera 11-12.16\n\t\t\t// Nothing should be selected when empty strings follow ^= or $= or *=\n\t\t\t// The test attribute must be unknown in Opera but \"safe\" for WinRT\n\t\t\t// https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section\n\t\t\tif ( el.querySelectorAll(\"[msallowcapture^='']\").length ) {\n\t\t\t\trbuggyQSA.push( \"[*^$]=\" + whitespace + \"*(?:''|\\\"\\\")\" );\n\t\t\t}\n\n\t\t\t// Support: IE8\n\t\t\t// Boolean attributes and \"value\" are not treated correctly\n\t\t\tif ( !el.querySelectorAll(\"[selected]\").length ) {\n\t\t\t\trbuggyQSA.push( \"\\\\[\" + whitespace + \"*(?:value|\" + booleans + \")\" );\n\t\t\t}\n\n\t\t\t// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+\n\t\t\tif ( !el.querySelectorAll( \"[id~=\" + expando + \"-]\" ).length ) {\n\t\t\t\trbuggyQSA.push(\"~=\");\n\t\t\t}\n\n\t\t\t// Webkit/Opera - :checked should return selected option elements\n\t\t\t// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n\t\t\t// IE8 throws error here and will not see later tests\n\t\t\tif ( !el.querySelectorAll(\":checked\").length ) {\n\t\t\t\trbuggyQSA.push(\":checked\");\n\t\t\t}\n\n\t\t\t// Support: Safari 8+, iOS 8+\n\t\t\t// https://bugs.webkit.org/show_bug.cgi?id=136851\n\t\t\t// In-page `selector#id sibling-combinator selector` fails\n\t\t\tif ( !el.querySelectorAll( \"a#\" + expando + \"+*\" ).length ) {\n\t\t\t\trbuggyQSA.push(\".#.+[+~]\");\n\t\t\t}\n\t\t});\n\n\t\tassert(function( el ) {\n\t\t\tel.innerHTML = \"<a href='' disabled='disabled'></a>\" +\n\t\t\t\t\"<select disabled='disabled'><option/></select>\";\n\n\t\t\t// Support: Windows 8 Native Apps\n\t\t\t// The type and name attributes are restricted during .innerHTML assignment\n\t\t\tvar input = document.createElement(\"input\");\n\t\t\tinput.setAttribute( \"type\", \"hidden\" );\n\t\t\tel.appendChild( input ).setAttribute( \"name\", \"D\" );\n\n\t\t\t// Support: IE8\n\t\t\t// Enforce case-sensitivity of name attribute\n\t\t\tif ( el.querySelectorAll(\"[name=d]\").length ) {\n\t\t\t\trbuggyQSA.push( \"name\" + whitespace + \"*[*^$|!~]?=\" );\n\t\t\t}\n\n\t\t\t// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)\n\t\t\t// IE8 throws error here and will not see later tests\n\t\t\tif ( el.querySelectorAll(\":enabled\").length !== 2 ) {\n\t\t\t\trbuggyQSA.push( \":enabled\", \":disabled\" );\n\t\t\t}\n\n\t\t\t// Support: IE9-11+\n\t\t\t// IE's :disabled selector does not pick up the children of disabled fieldsets\n\t\t\tdocElem.appendChild( el ).disabled = true;\n\t\t\tif ( el.querySelectorAll(\":disabled\").length !== 2 ) {\n\t\t\t\trbuggyQSA.push( \":enabled\", \":disabled\" );\n\t\t\t}\n\n\t\t\t// Opera 10-11 does not throw on post-comma invalid pseudos\n\t\t\tel.querySelectorAll(\"*,:x\");\n\t\t\trbuggyQSA.push(\",.*:\");\n\t\t});\n\t}\n\n\tif ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||\n\t\tdocElem.webkitMatchesSelector ||\n\t\tdocElem.mozMatchesSelector ||\n\t\tdocElem.oMatchesSelector ||\n\t\tdocElem.msMatchesSelector) )) ) {\n\n\t\tassert(function( el ) {\n\t\t\t// Check to see if it's possible to do matchesSelector\n\t\t\t// on a disconnected node (IE 9)\n\t\t\tsupport.disconnectedMatch = matches.call( el, \"*\" );\n\n\t\t\t// This should fail with an exception\n\t\t\t// Gecko does not error, returns false instead\n\t\t\tmatches.call( el, \"[s!='']:x\" );\n\t\t\trbuggyMatches.push( \"!=\", pseudos );\n\t\t});\n\t}\n\n\trbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join(\"|\") );\n\trbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join(\"|\") );\n\n\t/* Contains\n\t---------------------------------------------------------------------- */\n\thasCompare = rnative.test( docElem.compareDocumentPosition );\n\n\t// Element contains another\n\t// Purposefully self-exclusive\n\t// As in, an element does not contain itself\n\tcontains = hasCompare || rnative.test( docElem.contains ) ?\n\t\tfunction( a, b ) {\n\t\t\tvar adown = a.nodeType === 9 ? a.documentElement : a,\n\t\t\t\tbup = b && b.parentNode;\n\t\t\treturn a === bup || !!( bup && bup.nodeType === 1 && (\n\t\t\t\tadown.contains ?\n\t\t\t\t\tadown.contains( bup ) :\n\t\t\t\t\ta.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16\n\t\t\t));\n\t\t} :\n\t\tfunction( a, b ) {\n\t\t\tif ( b ) {\n\t\t\t\twhile ( (b = b.parentNode) ) {\n\t\t\t\t\tif ( b === a ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n\n\t/* Sorting\n\t---------------------------------------------------------------------- */\n\n\t// Document order sorting\n\tsortOrder = hasCompare ?\n\tfunction( a, b ) {\n\n\t\t// Flag for duplicate removal\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t\treturn 0;\n\t\t}\n\n\t\t// Sort on method existence if only one input has compareDocumentPosition\n\t\tvar compare = !a.compareDocumentPosition - !b.compareDocumentPosition;\n\t\tif ( compare ) {\n\t\t\treturn compare;\n\t\t}\n\n\t\t// Calculate position if both inputs belong to the same document\n\t\tcompare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?\n\t\t\ta.compareDocumentPosition( b ) :\n\n\t\t\t// Otherwise we know they are disconnected\n\t\t\t1;\n\n\t\t// Disconnected nodes\n\t\tif ( compare & 1 ||\n\t\t\t(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {\n\n\t\t\t// Choose the first element that is related to our preferred document\n\t\t\tif ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tif ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\t// Maintain original order\n\t\t\treturn sortInput ?\n\t\t\t\t( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :\n\t\t\t\t0;\n\t\t}\n\n\t\treturn compare & 4 ? -1 : 1;\n\t} :\n\tfunction( a, b ) {\n\t\t// Exit early if the nodes are identical\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t\treturn 0;\n\t\t}\n\n\t\tvar cur,\n\t\t\ti = 0,\n\t\t\taup = a.parentNode,\n\t\t\tbup = b.parentNode,\n\t\t\tap = [ a ],\n\t\t\tbp = [ b ];\n\n\t\t// Parentless nodes are either documents or disconnected\n\t\tif ( !aup || !bup ) {\n\t\t\treturn a === document ? -1 :\n\t\t\t\tb === document ? 1 :\n\t\t\t\taup ? -1 :\n\t\t\t\tbup ? 1 :\n\t\t\t\tsortInput ?\n\t\t\t\t( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :\n\t\t\t\t0;\n\n\t\t// If the nodes are siblings, we can do a quick check\n\t\t} else if ( aup === bup ) {\n\t\t\treturn siblingCheck( a, b );\n\t\t}\n\n\t\t// Otherwise we need full lists of their ancestors for comparison\n\t\tcur = a;\n\t\twhile ( (cur = cur.parentNode) ) {\n\t\t\tap.unshift( cur );\n\t\t}\n\t\tcur = b;\n\t\twhile ( (cur = cur.parentNode) ) {\n\t\t\tbp.unshift( cur );\n\t\t}\n\n\t\t// Walk down the tree looking for a discrepancy\n\t\twhile ( ap[i] === bp[i] ) {\n\t\t\ti++;\n\t\t}\n\n\t\treturn i ?\n\t\t\t// Do a sibling check if the nodes have a common ancestor\n\t\t\tsiblingCheck( ap[i], bp[i] ) :\n\n\t\t\t// Otherwise nodes in our document sort first\n\t\t\tap[i] === preferredDoc ? -1 :\n\t\t\tbp[i] === preferredDoc ? 1 :\n\t\t\t0;\n\t};\n\n\treturn document;\n};\n\nSizzle.matches = function( expr, elements ) {\n\treturn Sizzle( expr, null, null, elements );\n};\n\nSizzle.matchesSelector = function( elem, expr ) {\n\t// Set document vars if needed\n\tif ( ( elem.ownerDocument || elem ) !== document ) {\n\t\tsetDocument( elem );\n\t}\n\n\t// Make sure that attribute selectors are quoted\n\texpr = expr.replace( rattributeQuotes, \"='$1']\" );\n\n\tif ( support.matchesSelector && documentIsHTML &&\n\t\t!compilerCache[ expr + \" \" ] &&\n\t\t( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&\n\t\t( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {\n\n\t\ttry {\n\t\t\tvar ret = matches.call( elem, expr );\n\n\t\t\t// IE 9's matchesSelector returns false on disconnected nodes\n\t\t\tif ( ret || support.disconnectedMatch ||\n\t\t\t\t\t// As well, disconnected nodes are said to be in a document\n\t\t\t\t\t// fragment in IE 9\n\t\t\t\t\telem.document && elem.document.nodeType !== 11 ) {\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t} catch (e) {}\n\t}\n\n\treturn Sizzle( expr, document, null, [ elem ] ).length > 0;\n};\n\nSizzle.contains = function( context, elem ) {\n\t// Set document vars if needed\n\tif ( ( context.ownerDocument || context ) !== document ) {\n\t\tsetDocument( context );\n\t}\n\treturn contains( context, elem );\n};\n\nSizzle.attr = function( elem, name ) {\n\t// Set document vars if needed\n\tif ( ( elem.ownerDocument || elem ) !== document ) {\n\t\tsetDocument( elem );\n\t}\n\n\tvar fn = Expr.attrHandle[ name.toLowerCase() ],\n\t\t// Don't get fooled by Object.prototype properties (jQuery #13807)\n\t\tval = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?\n\t\t\tfn( elem, name, !documentIsHTML ) :\n\t\t\tundefined;\n\n\treturn val !== undefined ?\n\t\tval :\n\t\tsupport.attributes || !documentIsHTML ?\n\t\t\telem.getAttribute( name ) :\n\t\t\t(val = elem.getAttributeNode(name)) && val.specified ?\n\t\t\t\tval.value :\n\t\t\t\tnull;\n};\n\nSizzle.escape = function( sel ) {\n\treturn (sel + \"\").replace( rcssescape, fcssescape );\n};\n\nSizzle.error = function( msg ) {\n\tthrow new Error( \"Syntax error, unrecognized expression: \" + msg );\n};\n\n/**\n * Document sorting and removing duplicates\n * @param {ArrayLike} results\n */\nSizzle.uniqueSort = function( results ) {\n\tvar elem,\n\t\tduplicates = [],\n\t\tj = 0,\n\t\ti = 0;\n\n\t// Unless we *know* we can detect duplicates, assume their presence\n\thasDuplicate = !support.detectDuplicates;\n\tsortInput = !support.sortStable && results.slice( 0 );\n\tresults.sort( sortOrder );\n\n\tif ( hasDuplicate ) {\n\t\twhile ( (elem = results[i++]) ) {\n\t\t\tif ( elem === results[ i ] ) {\n\t\t\t\tj = duplicates.push( i );\n\t\t\t}\n\t\t}\n\t\twhile ( j-- ) {\n\t\t\tresults.splice( duplicates[ j ], 1 );\n\t\t}\n\t}\n\n\t// Clear input after sorting to release objects\n\t// See https://github.com/jquery/sizzle/pull/225\n\tsortInput = null;\n\n\treturn results;\n};\n\n/**\n * Utility function for retrieving the text value of an array of DOM nodes\n * @param {Array|Element} elem\n */\ngetText = Sizzle.getText = function( elem ) {\n\tvar node,\n\t\tret = \"\",\n\t\ti = 0,\n\t\tnodeType = elem.nodeType;\n\n\tif ( !nodeType ) {\n\t\t// If no nodeType, this is expected to be an array\n\t\twhile ( (node = elem[i++]) ) {\n\t\t\t// Do not traverse comment nodes\n\t\t\tret += getText( node );\n\t\t}\n\t} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {\n\t\t// Use textContent for elements\n\t\t// innerText usage removed for consistency of new lines (jQuery #11153)\n\t\tif ( typeof elem.textContent === \"string\" ) {\n\t\t\treturn elem.textContent;\n\t\t} else {\n\t\t\t// Traverse its children\n\t\t\tfor ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {\n\t\t\t\tret += getText( elem );\n\t\t\t}\n\t\t}\n\t} else if ( nodeType === 3 || nodeType === 4 ) {\n\t\treturn elem.nodeValue;\n\t}\n\t// Do not include comment or processing instruction nodes\n\n\treturn ret;\n};\n\nExpr = Sizzle.selectors = {\n\n\t// Can be adjusted by the user\n\tcacheLength: 50,\n\n\tcreatePseudo: markFunction,\n\n\tmatch: matchExpr,\n\n\tattrHandle: {},\n\n\tfind: {},\n\n\trelative: {\n\t\t\">\": { dir: \"parentNode\", first: true },\n\t\t\" \": { dir: \"parentNode\" },\n\t\t\"+\": { dir: \"previousSibling\", first: true },\n\t\t\"~\": { dir: \"previousSibling\" }\n\t},\n\n\tpreFilter: {\n\t\t\"ATTR\": function( match ) {\n\t\t\tmatch[1] = match[1].replace( runescape, funescape );\n\n\t\t\t// Move the given value to match[3] whether quoted or unquoted\n\t\t\tmatch[3] = ( match[3] || match[4] || match[5] || \"\" ).replace( runescape, funescape );\n\n\t\t\tif ( match[2] === \"~=\" ) {\n\t\t\t\tmatch[3] = \" \" + match[3] + \" \";\n\t\t\t}\n\n\t\t\treturn match.slice( 0, 4 );\n\t\t},\n\n\t\t\"CHILD\": function( match ) {\n\t\t\t/* matches from matchExpr[\"CHILD\"]\n\t\t\t\t1 type (only|nth|...)\n\t\t\t\t2 what (child|of-type)\n\t\t\t\t3 argument (even|odd|\\d*|\\d*n([+-]\\d+)?|...)\n\t\t\t\t4 xn-component of xn+y argument ([+-]?\\d*n|)\n\t\t\t\t5 sign of xn-component\n\t\t\t\t6 x of xn-component\n\t\t\t\t7 sign of y-component\n\t\t\t\t8 y of y-component\n\t\t\t*/\n\t\t\tmatch[1] = match[1].toLowerCase();\n\n\t\t\tif ( match[1].slice( 0, 3 ) === \"nth\" ) {\n\t\t\t\t// nth-* requires argument\n\t\t\t\tif ( !match[3] ) {\n\t\t\t\t\tSizzle.error( match[0] );\n\t\t\t\t}\n\n\t\t\t\t// numeric x and y parameters for Expr.filter.CHILD\n\t\t\t\t// remember that false/true cast respectively to 0/1\n\t\t\t\tmatch[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === \"even\" || match[3] === \"odd\" ) );\n\t\t\t\tmatch[5] = +( ( match[7] + match[8] ) || match[3] === \"odd\" );\n\n\t\t\t// other types prohibit arguments\n\t\t\t} else if ( match[3] ) {\n\t\t\t\tSizzle.error( match[0] );\n\t\t\t}\n\n\t\t\treturn match;\n\t\t},\n\n\t\t\"PSEUDO\": function( match ) {\n\t\t\tvar excess,\n\t\t\t\tunquoted = !match[6] && match[2];\n\n\t\t\tif ( matchExpr[\"CHILD\"].test( match[0] ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// Accept quoted arguments as-is\n\t\t\tif ( match[3] ) {\n\t\t\t\tmatch[2] = match[4] || match[5] || \"\";\n\n\t\t\t// Strip excess characters from unquoted arguments\n\t\t\t} else if ( unquoted && rpseudo.test( unquoted ) &&\n\t\t\t\t// Get excess from tokenize (recursively)\n\t\t\t\t(excess = tokenize( unquoted, true )) &&\n\t\t\t\t// advance to the next closing parenthesis\n\t\t\t\t(excess = unquoted.indexOf( \")\", unquoted.length - excess ) - unquoted.length) ) {\n\n\t\t\t\t// excess is a negative index\n\t\t\t\tmatch[0] = match[0].slice( 0, excess );\n\t\t\t\tmatch[2] = unquoted.slice( 0, excess );\n\t\t\t}\n\n\t\t\t// Return only captures needed by the pseudo filter method (type and argument)\n\t\t\treturn match.slice( 0, 3 );\n\t\t}\n\t},\n\n\tfilter: {\n\n\t\t\"TAG\": function( nodeNameSelector ) {\n\t\t\tvar nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();\n\t\t\treturn nodeNameSelector === \"*\" ?\n\t\t\t\tfunction() { return true; } :\n\t\t\t\tfunction( elem ) {\n\t\t\t\t\treturn elem.nodeName && elem.nodeName.toLowerCase() === nodeName;\n\t\t\t\t};\n\t\t},\n\n\t\t\"CLASS\": function( className ) {\n\t\t\tvar pattern = classCache[ className + \" \" ];\n\n\t\t\treturn pattern ||\n\t\t\t\t(pattern = new RegExp( \"(^|\" + whitespace + \")\" + className + \"(\" + whitespace + \"|$)\" )) &&\n\t\t\t\tclassCache( className, function( elem ) {\n\t\t\t\t\treturn pattern.test( typeof elem.className === \"string\" && elem.className || typeof elem.getAttribute !== \"undefined\" && elem.getAttribute(\"class\") || \"\" );\n\t\t\t\t});\n\t\t},\n\n\t\t\"ATTR\": function( name, operator, check ) {\n\t\t\treturn function( elem ) {\n\t\t\t\tvar result = Sizzle.attr( elem, name );\n\n\t\t\t\tif ( result == null ) {\n\t\t\t\t\treturn operator === \"!=\";\n\t\t\t\t}\n\t\t\t\tif ( !operator ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tresult += \"\";\n\n\t\t\t\treturn operator === \"=\" ? result === check :\n\t\t\t\t\toperator === \"!=\" ? result !== check :\n\t\t\t\t\toperator === \"^=\" ? check && result.indexOf( check ) === 0 :\n\t\t\t\t\toperator === \"*=\" ? check && result.indexOf( check ) > -1 :\n\t\t\t\t\toperator === \"$=\" ? check && result.slice( -check.length ) === check :\n\t\t\t\t\toperator === \"~=\" ? ( \" \" + result.replace( rwhitespace, \" \" ) + \" \" ).indexOf( check ) > -1 :\n\t\t\t\t\toperator === \"|=\" ? result === check || result.slice( 0, check.length + 1 ) === check + \"-\" :\n\t\t\t\t\tfalse;\n\t\t\t};\n\t\t},\n\n\t\t\"CHILD\": function( type, what, argument, first, last ) {\n\t\t\tvar simple = type.slice( 0, 3 ) !== \"nth\",\n\t\t\t\tforward = type.slice( -4 ) !== \"last\",\n\t\t\t\tofType = what === \"of-type\";\n\n\t\t\treturn first === 1 && last === 0 ?\n\n\t\t\t\t// Shortcut for :nth-*(n)\n\t\t\t\tfunction( elem ) {\n\t\t\t\t\treturn !!elem.parentNode;\n\t\t\t\t} :\n\n\t\t\t\tfunction( elem, context, xml ) {\n\t\t\t\t\tvar cache, uniqueCache, outerCache, node, nodeIndex, start,\n\t\t\t\t\t\tdir = simple !== forward ? \"nextSibling\" : \"previousSibling\",\n\t\t\t\t\t\tparent = elem.parentNode,\n\t\t\t\t\t\tname = ofType && elem.nodeName.toLowerCase(),\n\t\t\t\t\t\tuseCache = !xml && !ofType,\n\t\t\t\t\t\tdiff = false;\n\n\t\t\t\t\tif ( parent ) {\n\n\t\t\t\t\t\t// :(first|last|only)-(child|of-type)\n\t\t\t\t\t\tif ( simple ) {\n\t\t\t\t\t\t\twhile ( dir ) {\n\t\t\t\t\t\t\t\tnode = elem;\n\t\t\t\t\t\t\t\twhile ( (node = node[ dir ]) ) {\n\t\t\t\t\t\t\t\t\tif ( ofType ?\n\t\t\t\t\t\t\t\t\t\tnode.nodeName.toLowerCase() === name :\n\t\t\t\t\t\t\t\t\t\tnode.nodeType === 1 ) {\n\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Reverse direction for :only-* (if we haven't yet done so)\n\t\t\t\t\t\t\t\tstart = dir = type === \"only\" && !start && \"nextSibling\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstart = [ forward ? parent.firstChild : parent.lastChild ];\n\n\t\t\t\t\t\t// non-xml :nth-child(...) stores cache data on `parent`\n\t\t\t\t\t\tif ( forward && useCache ) {\n\n\t\t\t\t\t\t\t// Seek `elem` from a previously-cached index\n\n\t\t\t\t\t\t\t// ...in a gzip-friendly way\n\t\t\t\t\t\t\tnode = parent;\n\t\t\t\t\t\t\touterCache = node[ expando ] || (node[ expando ] = {});\n\n\t\t\t\t\t\t\t// Support: IE <9 only\n\t\t\t\t\t\t\t// Defend against cloned attroperties (jQuery gh-1709)\n\t\t\t\t\t\t\tuniqueCache = outerCache[ node.uniqueID ] ||\n\t\t\t\t\t\t\t\t(outerCache[ node.uniqueID ] = {});\n\n\t\t\t\t\t\t\tcache = uniqueCache[ type ] || [];\n\t\t\t\t\t\t\tnodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];\n\t\t\t\t\t\t\tdiff = nodeIndex && cache[ 2 ];\n\t\t\t\t\t\t\tnode = nodeIndex && parent.childNodes[ nodeIndex ];\n\n\t\t\t\t\t\t\twhile ( (node = ++nodeIndex && node && node[ dir ] ||\n\n\t\t\t\t\t\t\t\t// Fallback to seeking `elem` from the start\n\t\t\t\t\t\t\t\t(diff = nodeIndex = 0) || start.pop()) ) {\n\n\t\t\t\t\t\t\t\t// When found, cache indexes on `parent` and break\n\t\t\t\t\t\t\t\tif ( node.nodeType === 1 && ++diff && node === elem ) {\n\t\t\t\t\t\t\t\t\tuniqueCache[ type ] = [ dirruns, nodeIndex, diff ];\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Use previously-cached element index if available\n\t\t\t\t\t\t\tif ( useCache ) {\n\t\t\t\t\t\t\t\t// ...in a gzip-friendly way\n\t\t\t\t\t\t\t\tnode = elem;\n\t\t\t\t\t\t\t\touterCache = node[ expando ] || (node[ expando ] = {});\n\n\t\t\t\t\t\t\t\t// Support: IE <9 only\n\t\t\t\t\t\t\t\t// Defend against cloned attroperties (jQuery gh-1709)\n\t\t\t\t\t\t\t\tuniqueCache = outerCache[ node.uniqueID ] ||\n\t\t\t\t\t\t\t\t\t(outerCache[ node.uniqueID ] = {});\n\n\t\t\t\t\t\t\t\tcache = uniqueCache[ type ] || [];\n\t\t\t\t\t\t\t\tnodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];\n\t\t\t\t\t\t\t\tdiff = nodeIndex;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// xml :nth-child(...)\n\t\t\t\t\t\t\t// or :nth-last-child(...) or :nth(-last)?-of-type(...)\n\t\t\t\t\t\t\tif ( diff === false ) {\n\t\t\t\t\t\t\t\t// Use the same loop as above to seek `elem` from the start\n\t\t\t\t\t\t\t\twhile ( (node = ++nodeIndex && node && node[ dir ] ||\n\t\t\t\t\t\t\t\t\t(diff = nodeIndex = 0) || start.pop()) ) {\n\n\t\t\t\t\t\t\t\t\tif ( ( ofType ?\n\t\t\t\t\t\t\t\t\t\tnode.nodeName.toLowerCase() === name :\n\t\t\t\t\t\t\t\t\t\tnode.nodeType === 1 ) &&\n\t\t\t\t\t\t\t\t\t\t++diff ) {\n\n\t\t\t\t\t\t\t\t\t\t// Cache the index of each encountered element\n\t\t\t\t\t\t\t\t\t\tif ( useCache ) {\n\t\t\t\t\t\t\t\t\t\t\touterCache = node[ expando ] || (node[ expando ] = {});\n\n\t\t\t\t\t\t\t\t\t\t\t// Support: IE <9 only\n\t\t\t\t\t\t\t\t\t\t\t// Defend against cloned attroperties (jQuery gh-1709)\n\t\t\t\t\t\t\t\t\t\t\tuniqueCache = outerCache[ node.uniqueID ] ||\n\t\t\t\t\t\t\t\t\t\t\t\t(outerCache[ node.uniqueID ] = {});\n\n\t\t\t\t\t\t\t\t\t\t\tuniqueCache[ type ] = [ dirruns, diff ];\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tif ( node === elem ) {\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Incorporate the offset, then check against cycle size\n\t\t\t\t\t\tdiff -= last;\n\t\t\t\t\t\treturn diff === first || ( diff % first === 0 && diff / first >= 0 );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t},\n\n\t\t\"PSEUDO\": function( pseudo, argument ) {\n\t\t\t// pseudo-class names are case-insensitive\n\t\t\t// http://www.w3.org/TR/selectors/#pseudo-classes\n\t\t\t// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters\n\t\t\t// Remember that setFilters inherits from pseudos\n\t\t\tvar args,\n\t\t\t\tfn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||\n\t\t\t\t\tSizzle.error( \"unsupported pseudo: \" + pseudo );\n\n\t\t\t// The user may use createPseudo to indicate that\n\t\t\t// arguments are needed to create the filter function\n\t\t\t// just as Sizzle does\n\t\t\tif ( fn[ expando ] ) {\n\t\t\t\treturn fn( argument );\n\t\t\t}\n\n\t\t\t// But maintain support for old signatures\n\t\t\tif ( fn.length > 1 ) {\n\t\t\t\targs = [ pseudo, pseudo, \"\", argument ];\n\t\t\t\treturn Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?\n\t\t\t\t\tmarkFunction(function( seed, matches ) {\n\t\t\t\t\t\tvar idx,\n\t\t\t\t\t\t\tmatched = fn( seed, argument ),\n\t\t\t\t\t\t\ti = matched.length;\n\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\tidx = indexOf( seed, matched[i] );\n\t\t\t\t\t\t\tseed[ idx ] = !( matches[ idx ] = matched[i] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}) :\n\t\t\t\t\tfunction( elem ) {\n\t\t\t\t\t\treturn fn( elem, 0, args );\n\t\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn fn;\n\t\t}\n\t},\n\n\tpseudos: {\n\t\t// Potentially complex pseudos\n\t\t\"not\": markFunction(function( selector ) {\n\t\t\t// Trim the selector passed to compile\n\t\t\t// to avoid treating leading and trailing\n\t\t\t// spaces as combinators\n\t\t\tvar input = [],\n\t\t\t\tresults = [],\n\t\t\t\tmatcher = compile( selector.replace( rtrim, \"$1\" ) );\n\n\t\t\treturn matcher[ expando ] ?\n\t\t\t\tmarkFunction(function( seed, matches, context, xml ) {\n\t\t\t\t\tvar elem,\n\t\t\t\t\t\tunmatched = matcher( seed, null, xml, [] ),\n\t\t\t\t\t\ti = seed.length;\n\n\t\t\t\t\t// Match elements unmatched by `matcher`\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tif ( (elem = unmatched[i]) ) {\n\t\t\t\t\t\t\tseed[i] = !(matches[i] = elem);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}) :\n\t\t\t\tfunction( elem, context, xml ) {\n\t\t\t\t\tinput[0] = elem;\n\t\t\t\t\tmatcher( input, null, xml, results );\n\t\t\t\t\t// Don't keep the element (issue #299)\n\t\t\t\t\tinput[0] = null;\n\t\t\t\t\treturn !results.pop();\n\t\t\t\t};\n\t\t}),\n\n\t\t\"has\": markFunction(function( selector ) {\n\t\t\treturn function( elem ) {\n\t\t\t\treturn Sizzle( selector, elem ).length > 0;\n\t\t\t};\n\t\t}),\n\n\t\t\"contains\": markFunction(function( text ) {\n\t\t\ttext = text.replace( runescape, funescape );\n\t\t\treturn function( elem ) {\n\t\t\t\treturn ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;\n\t\t\t};\n\t\t}),\n\n\t\t// \"Whether an element is represented by a :lang() selector\n\t\t// is based solely on the element's language value\n\t\t// being equal to the identifier C,\n\t\t// or beginning with the identifier C immediately followed by \"-\".\n\t\t// The matching of C against the element's language value is performed case-insensitively.\n\t\t// The identifier C does not have to be a valid language name.\"\n\t\t// http://www.w3.org/TR/selectors/#lang-pseudo\n\t\t\"lang\": markFunction( function( lang ) {\n\t\t\t// lang value must be a valid identifier\n\t\t\tif ( !ridentifier.test(lang || \"\") ) {\n\t\t\t\tSizzle.error( \"unsupported lang: \" + lang );\n\t\t\t}\n\t\t\tlang = lang.replace( runescape, funescape ).toLowerCase();\n\t\t\treturn function( elem ) {\n\t\t\t\tvar elemLang;\n\t\t\t\tdo {\n\t\t\t\t\tif ( (elemLang = documentIsHTML ?\n\t\t\t\t\t\telem.lang :\n\t\t\t\t\t\telem.getAttribute(\"xml:lang\") || elem.getAttribute(\"lang\")) ) {\n\n\t\t\t\t\t\telemLang = elemLang.toLowerCase();\n\t\t\t\t\t\treturn elemLang === lang || elemLang.indexOf( lang + \"-\" ) === 0;\n\t\t\t\t\t}\n\t\t\t\t} while ( (elem = elem.parentNode) && elem.nodeType === 1 );\n\t\t\t\treturn false;\n\t\t\t};\n\t\t}),\n\n\t\t// Miscellaneous\n\t\t\"target\": function( elem ) {\n\t\t\tvar hash = window.location && window.location.hash;\n\t\t\treturn hash && hash.slice( 1 ) === elem.id;\n\t\t},\n\n\t\t\"root\": function( elem ) {\n\t\t\treturn elem === docElem;\n\t\t},\n\n\t\t\"focus\": function( elem ) {\n\t\t\treturn elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);\n\t\t},\n\n\t\t// Boolean properties\n\t\t\"enabled\": createDisabledPseudo( false ),\n\t\t\"disabled\": createDisabledPseudo( true ),\n\n\t\t\"checked\": function( elem ) {\n\t\t\t// In CSS3, :checked should return both checked and selected elements\n\t\t\t// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n\t\t\tvar nodeName = elem.nodeName.toLowerCase();\n\t\t\treturn (nodeName === \"input\" && !!elem.checked) || (nodeName === \"option\" && !!elem.selected);\n\t\t},\n\n\t\t\"selected\": function( elem ) {\n\t\t\t// Accessing this property makes selected-by-default\n\t\t\t// options in Safari work properly\n\t\t\tif ( elem.parentNode ) {\n\t\t\t\telem.parentNode.selectedIndex;\n\t\t\t}\n\n\t\t\treturn elem.selected === true;\n\t\t},\n\n\t\t// Contents\n\t\t\"empty\": function( elem ) {\n\t\t\t// http://www.w3.org/TR/selectors/#empty-pseudo\n\t\t\t// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),\n\t\t\t//   but not by others (comment: 8; processing instruction: 7; etc.)\n\t\t\t// nodeType < 6 works because attributes (2) do not appear as children\n\t\t\tfor ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {\n\t\t\t\tif ( elem.nodeType < 6 ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\n\t\t\"parent\": function( elem ) {\n\t\t\treturn !Expr.pseudos[\"empty\"]( elem );\n\t\t},\n\n\t\t// Element/input types\n\t\t\"header\": function( elem ) {\n\t\t\treturn rheader.test( elem.nodeName );\n\t\t},\n\n\t\t\"input\": function( elem ) {\n\t\t\treturn rinputs.test( elem.nodeName );\n\t\t},\n\n\t\t\"button\": function( elem ) {\n\t\t\tvar name = elem.nodeName.toLowerCase();\n\t\t\treturn name === \"input\" && elem.type === \"button\" || name === \"button\";\n\t\t},\n\n\t\t\"text\": function( elem ) {\n\t\t\tvar attr;\n\t\t\treturn elem.nodeName.toLowerCase() === \"input\" &&\n\t\t\t\telem.type === \"text\" &&\n\n\t\t\t\t// Support: IE<8\n\t\t\t\t// New HTML5 attribute values (e.g., \"search\") appear with elem.type === \"text\"\n\t\t\t\t( (attr = elem.getAttribute(\"type\")) == null || attr.toLowerCase() === \"text\" );\n\t\t},\n\n\t\t// Position-in-collection\n\t\t\"first\": createPositionalPseudo(function() {\n\t\t\treturn [ 0 ];\n\t\t}),\n\n\t\t\"last\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\treturn [ length - 1 ];\n\t\t}),\n\n\t\t\"eq\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\treturn [ argument < 0 ? argument + length : argument ];\n\t\t}),\n\n\t\t\"even\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\tvar i = 0;\n\t\t\tfor ( ; i < length; i += 2 ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"odd\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\tvar i = 1;\n\t\t\tfor ( ; i < length; i += 2 ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"lt\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\tvar i = argument < 0 ? argument + length : argument;\n\t\t\tfor ( ; --i >= 0; ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"gt\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\tvar i = argument < 0 ? argument + length : argument;\n\t\t\tfor ( ; ++i < length; ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t})\n\t}\n};\n\nExpr.pseudos[\"nth\"] = Expr.pseudos[\"eq\"];\n\n// Add button/input type pseudos\nfor ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {\n\tExpr.pseudos[ i ] = createInputPseudo( i );\n}\nfor ( i in { submit: true, reset: true } ) {\n\tExpr.pseudos[ i ] = createButtonPseudo( i );\n}\n\n// Easy API for creating new setFilters\nfunction setFilters() {}\nsetFilters.prototype = Expr.filters = Expr.pseudos;\nExpr.setFilters = new setFilters();\n\ntokenize = Sizzle.tokenize = function( selector, parseOnly ) {\n\tvar matched, match, tokens, type,\n\t\tsoFar, groups, preFilters,\n\t\tcached = tokenCache[ selector + \" \" ];\n\n\tif ( cached ) {\n\t\treturn parseOnly ? 0 : cached.slice( 0 );\n\t}\n\n\tsoFar = selector;\n\tgroups = [];\n\tpreFilters = Expr.preFilter;\n\n\twhile ( soFar ) {\n\n\t\t// Comma and first run\n\t\tif ( !matched || (match = rcomma.exec( soFar )) ) {\n\t\t\tif ( match ) {\n\t\t\t\t// Don't consume trailing commas as valid\n\t\t\t\tsoFar = soFar.slice( match[0].length ) || soFar;\n\t\t\t}\n\t\t\tgroups.push( (tokens = []) );\n\t\t}\n\n\t\tmatched = false;\n\n\t\t// Combinators\n\t\tif ( (match = rcombinators.exec( soFar )) ) {\n\t\t\tmatched = match.shift();\n\t\t\ttokens.push({\n\t\t\t\tvalue: matched,\n\t\t\t\t// Cast descendant combinators to space\n\t\t\t\ttype: match[0].replace( rtrim, \" \" )\n\t\t\t});\n\t\t\tsoFar = soFar.slice( matched.length );\n\t\t}\n\n\t\t// Filters\n\t\tfor ( type in Expr.filter ) {\n\t\t\tif ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||\n\t\t\t\t(match = preFilters[ type ]( match ))) ) {\n\t\t\t\tmatched = match.shift();\n\t\t\t\ttokens.push({\n\t\t\t\t\tvalue: matched,\n\t\t\t\t\ttype: type,\n\t\t\t\t\tmatches: match\n\t\t\t\t});\n\t\t\t\tsoFar = soFar.slice( matched.length );\n\t\t\t}\n\t\t}\n\n\t\tif ( !matched ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Return the length of the invalid excess\n\t// if we're just parsing\n\t// Otherwise, throw an error or return tokens\n\treturn parseOnly ?\n\t\tsoFar.length :\n\t\tsoFar ?\n\t\t\tSizzle.error( selector ) :\n\t\t\t// Cache the tokens\n\t\t\ttokenCache( selector, groups ).slice( 0 );\n};\n\nfunction toSelector( tokens ) {\n\tvar i = 0,\n\t\tlen = tokens.length,\n\t\tselector = \"\";\n\tfor ( ; i < len; i++ ) {\n\t\tselector += tokens[i].value;\n\t}\n\treturn selector;\n}\n\nfunction addCombinator( matcher, combinator, base ) {\n\tvar dir = combinator.dir,\n\t\tskip = combinator.next,\n\t\tkey = skip || dir,\n\t\tcheckNonElements = base && key === \"parentNode\",\n\t\tdoneName = done++;\n\n\treturn combinator.first ?\n\t\t// Check against closest ancestor/preceding element\n\t\tfunction( elem, context, xml ) {\n\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\treturn matcher( elem, context, xml );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t} :\n\n\t\t// Check against all ancestor/preceding elements\n\t\tfunction( elem, context, xml ) {\n\t\t\tvar oldCache, uniqueCache, outerCache,\n\t\t\t\tnewCache = [ dirruns, doneName ];\n\n\t\t\t// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching\n\t\t\tif ( xml ) {\n\t\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\t\tif ( matcher( elem, context, xml ) ) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\t\touterCache = elem[ expando ] || (elem[ expando ] = {});\n\n\t\t\t\t\t\t// Support: IE <9 only\n\t\t\t\t\t\t// Defend against cloned attroperties (jQuery gh-1709)\n\t\t\t\t\t\tuniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});\n\n\t\t\t\t\t\tif ( skip && skip === elem.nodeName.toLowerCase() ) {\n\t\t\t\t\t\t\telem = elem[ dir ] || elem;\n\t\t\t\t\t\t} else if ( (oldCache = uniqueCache[ key ]) &&\n\t\t\t\t\t\t\toldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {\n\n\t\t\t\t\t\t\t// Assign to newCache so results back-propagate to previous elements\n\t\t\t\t\t\t\treturn (newCache[ 2 ] = oldCache[ 2 ]);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Reuse newcache so results back-propagate to previous elements\n\t\t\t\t\t\t\tuniqueCache[ key ] = newCache;\n\n\t\t\t\t\t\t\t// A match means we're done; a fail means we have to keep checking\n\t\t\t\t\t\t\tif ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n}\n\nfunction elementMatcher( matchers ) {\n\treturn matchers.length > 1 ?\n\t\tfunction( elem, context, xml ) {\n\t\t\tvar i = matchers.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( !matchers[i]( elem, context, xml ) ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t} :\n\t\tmatchers[0];\n}\n\nfunction multipleContexts( selector, contexts, results ) {\n\tvar i = 0,\n\t\tlen = contexts.length;\n\tfor ( ; i < len; i++ ) {\n\t\tSizzle( selector, contexts[i], results );\n\t}\n\treturn results;\n}\n\nfunction condense( unmatched, map, filter, context, xml ) {\n\tvar elem,\n\t\tnewUnmatched = [],\n\t\ti = 0,\n\t\tlen = unmatched.length,\n\t\tmapped = map != null;\n\n\tfor ( ; i < len; i++ ) {\n\t\tif ( (elem = unmatched[i]) ) {\n\t\t\tif ( !filter || filter( elem, context, xml ) ) {\n\t\t\t\tnewUnmatched.push( elem );\n\t\t\t\tif ( mapped ) {\n\t\t\t\t\tmap.push( i );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn newUnmatched;\n}\n\nfunction setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {\n\tif ( postFilter && !postFilter[ expando ] ) {\n\t\tpostFilter = setMatcher( postFilter );\n\t}\n\tif ( postFinder && !postFinder[ expando ] ) {\n\t\tpostFinder = setMatcher( postFinder, postSelector );\n\t}\n\treturn markFunction(function( seed, results, context, xml ) {\n\t\tvar temp, i, elem,\n\t\t\tpreMap = [],\n\t\t\tpostMap = [],\n\t\t\tpreexisting = results.length,\n\n\t\t\t// Get initial elements from seed or context\n\t\t\telems = seed || multipleContexts( selector || \"*\", context.nodeType ? [ context ] : context, [] ),\n\n\t\t\t// Prefilter to get matcher input, preserving a map for seed-results synchronization\n\t\t\tmatcherIn = preFilter && ( seed || !selector ) ?\n\t\t\t\tcondense( elems, preMap, preFilter, context, xml ) :\n\t\t\t\telems,\n\n\t\t\tmatcherOut = matcher ?\n\t\t\t\t// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,\n\t\t\t\tpostFinder || ( seed ? preFilter : preexisting || postFilter ) ?\n\n\t\t\t\t\t// ...intermediate processing is necessary\n\t\t\t\t\t[] :\n\n\t\t\t\t\t// ...otherwise use results directly\n\t\t\t\t\tresults :\n\t\t\t\tmatcherIn;\n\n\t\t// Find primary matches\n\t\tif ( matcher ) {\n\t\t\tmatcher( matcherIn, matcherOut, context, xml );\n\t\t}\n\n\t\t// Apply postFilter\n\t\tif ( postFilter ) {\n\t\t\ttemp = condense( matcherOut, postMap );\n\t\t\tpostFilter( temp, [], context, xml );\n\n\t\t\t// Un-match failing elements by moving them back to matcherIn\n\t\t\ti = temp.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( (elem = temp[i]) ) {\n\t\t\t\t\tmatcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( seed ) {\n\t\t\tif ( postFinder || preFilter ) {\n\t\t\t\tif ( postFinder ) {\n\t\t\t\t\t// Get the final matcherOut by condensing this intermediate into postFinder contexts\n\t\t\t\t\ttemp = [];\n\t\t\t\t\ti = matcherOut.length;\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tif ( (elem = matcherOut[i]) ) {\n\t\t\t\t\t\t\t// Restore matcherIn since elem is not yet a final match\n\t\t\t\t\t\t\ttemp.push( (matcherIn[i] = elem) );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tpostFinder( null, (matcherOut = []), temp, xml );\n\t\t\t\t}\n\n\t\t\t\t// Move matched elements from seed to results to keep them synchronized\n\t\t\t\ti = matcherOut.length;\n\t\t\t\twhile ( i-- ) {\n\t\t\t\t\tif ( (elem = matcherOut[i]) &&\n\t\t\t\t\t\t(temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {\n\n\t\t\t\t\t\tseed[temp] = !(results[temp] = elem);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t// Add elements to results, through postFinder if defined\n\t\t} else {\n\t\t\tmatcherOut = condense(\n\t\t\t\tmatcherOut === results ?\n\t\t\t\t\tmatcherOut.splice( preexisting, matcherOut.length ) :\n\t\t\t\t\tmatcherOut\n\t\t\t);\n\t\t\tif ( postFinder ) {\n\t\t\t\tpostFinder( null, results, matcherOut, xml );\n\t\t\t} else {\n\t\t\t\tpush.apply( results, matcherOut );\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction matcherFromTokens( tokens ) {\n\tvar checkContext, matcher, j,\n\t\tlen = tokens.length,\n\t\tleadingRelative = Expr.relative[ tokens[0].type ],\n\t\timplicitRelative = leadingRelative || Expr.relative[\" \"],\n\t\ti = leadingRelative ? 1 : 0,\n\n\t\t// The foundational matcher ensures that elements are reachable from top-level context(s)\n\t\tmatchContext = addCombinator( function( elem ) {\n\t\t\treturn elem === checkContext;\n\t\t}, implicitRelative, true ),\n\t\tmatchAnyContext = addCombinator( function( elem ) {\n\t\t\treturn indexOf( checkContext, elem ) > -1;\n\t\t}, implicitRelative, true ),\n\t\tmatchers = [ function( elem, context, xml ) {\n\t\t\tvar ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (\n\t\t\t\t(checkContext = context).nodeType ?\n\t\t\t\t\tmatchContext( elem, context, xml ) :\n\t\t\t\t\tmatchAnyContext( elem, context, xml ) );\n\t\t\t// Avoid hanging onto element (issue #299)\n\t\t\tcheckContext = null;\n\t\t\treturn ret;\n\t\t} ];\n\n\tfor ( ; i < len; i++ ) {\n\t\tif ( (matcher = Expr.relative[ tokens[i].type ]) ) {\n\t\t\tmatchers = [ addCombinator(elementMatcher( matchers ), matcher) ];\n\t\t} else {\n\t\t\tmatcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );\n\n\t\t\t// Return special upon seeing a positional matcher\n\t\t\tif ( matcher[ expando ] ) {\n\t\t\t\t// Find the next relative operator (if any) for proper handling\n\t\t\t\tj = ++i;\n\t\t\t\tfor ( ; j < len; j++ ) {\n\t\t\t\t\tif ( Expr.relative[ tokens[j].type ] ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn setMatcher(\n\t\t\t\t\ti > 1 && elementMatcher( matchers ),\n\t\t\t\t\ti > 1 && toSelector(\n\t\t\t\t\t\t// If the preceding token was a descendant combinator, insert an implicit any-element `*`\n\t\t\t\t\t\ttokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === \" \" ? \"*\" : \"\" })\n\t\t\t\t\t).replace( rtrim, \"$1\" ),\n\t\t\t\t\tmatcher,\n\t\t\t\t\ti < j && matcherFromTokens( tokens.slice( i, j ) ),\n\t\t\t\t\tj < len && matcherFromTokens( (tokens = tokens.slice( j )) ),\n\t\t\t\t\tj < len && toSelector( tokens )\n\t\t\t\t);\n\t\t\t}\n\t\t\tmatchers.push( matcher );\n\t\t}\n\t}\n\n\treturn elementMatcher( matchers );\n}\n\nfunction matcherFromGroupMatchers( elementMatchers, setMatchers ) {\n\tvar bySet = setMatchers.length > 0,\n\t\tbyElement = elementMatchers.length > 0,\n\t\tsuperMatcher = function( seed, context, xml, results, outermost ) {\n\t\t\tvar elem, j, matcher,\n\t\t\t\tmatchedCount = 0,\n\t\t\t\ti = \"0\",\n\t\t\t\tunmatched = seed && [],\n\t\t\t\tsetMatched = [],\n\t\t\t\tcontextBackup = outermostContext,\n\t\t\t\t// We must always have either seed elements or outermost context\n\t\t\t\telems = seed || byElement && Expr.find[\"TAG\"]( \"*\", outermost ),\n\t\t\t\t// Use integer dirruns iff this is the outermost matcher\n\t\t\t\tdirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),\n\t\t\t\tlen = elems.length;\n\n\t\t\tif ( outermost ) {\n\t\t\t\toutermostContext = context === document || context || outermost;\n\t\t\t}\n\n\t\t\t// Add elements passing elementMatchers directly to results\n\t\t\t// Support: IE<9, Safari\n\t\t\t// Tolerate NodeList properties (IE: \"length\"; Safari: <number>) matching elements by id\n\t\t\tfor ( ; i !== len && (elem = elems[i]) != null; i++ ) {\n\t\t\t\tif ( byElement && elem ) {\n\t\t\t\t\tj = 0;\n\t\t\t\t\tif ( !context && elem.ownerDocument !== document ) {\n\t\t\t\t\t\tsetDocument( elem );\n\t\t\t\t\t\txml = !documentIsHTML;\n\t\t\t\t\t}\n\t\t\t\t\twhile ( (matcher = elementMatchers[j++]) ) {\n\t\t\t\t\t\tif ( matcher( elem, context || document, xml) ) {\n\t\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ( outermost ) {\n\t\t\t\t\t\tdirruns = dirrunsUnique;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Track unmatched elements for set filters\n\t\t\t\tif ( bySet ) {\n\t\t\t\t\t// They will have gone through all possible matchers\n\t\t\t\t\tif ( (elem = !matcher && elem) ) {\n\t\t\t\t\t\tmatchedCount--;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Lengthen the array for every element, matched or not\n\t\t\t\t\tif ( seed ) {\n\t\t\t\t\t\tunmatched.push( elem );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// `i` is now the count of elements visited above, and adding it to `matchedCount`\n\t\t\t// makes the latter nonnegative.\n\t\t\tmatchedCount += i;\n\n\t\t\t// Apply set filters to unmatched elements\n\t\t\t// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`\n\t\t\t// equals `i`), unless we didn't visit _any_ elements in the above loop because we have\n\t\t\t// no element matchers and no seed.\n\t\t\t// Incrementing an initially-string \"0\" `i` allows `i` to remain a string only in that\n\t\t\t// case, which will result in a \"00\" `matchedCount` that differs from `i` but is also\n\t\t\t// numerically zero.\n\t\t\tif ( bySet && i !== matchedCount ) {\n\t\t\t\tj = 0;\n\t\t\t\twhile ( (matcher = setMatchers[j++]) ) {\n\t\t\t\t\tmatcher( unmatched, setMatched, context, xml );\n\t\t\t\t}\n\n\t\t\t\tif ( seed ) {\n\t\t\t\t\t// Reintegrate element matches to eliminate the need for sorting\n\t\t\t\t\tif ( matchedCount > 0 ) {\n\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\tif ( !(unmatched[i] || setMatched[i]) ) {\n\t\t\t\t\t\t\t\tsetMatched[i] = pop.call( results );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Discard index placeholder values to get only actual matches\n\t\t\t\t\tsetMatched = condense( setMatched );\n\t\t\t\t}\n\n\t\t\t\t// Add matches to results\n\t\t\t\tpush.apply( results, setMatched );\n\n\t\t\t\t// Seedless set matches succeeding multiple successful matchers stipulate sorting\n\t\t\t\tif ( outermost && !seed && setMatched.length > 0 &&\n\t\t\t\t\t( matchedCount + setMatchers.length ) > 1 ) {\n\n\t\t\t\t\tSizzle.uniqueSort( results );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Override manipulation of globals by nested matchers\n\t\t\tif ( outermost ) {\n\t\t\t\tdirruns = dirrunsUnique;\n\t\t\t\toutermostContext = contextBackup;\n\t\t\t}\n\n\t\t\treturn unmatched;\n\t\t};\n\n\treturn bySet ?\n\t\tmarkFunction( superMatcher ) :\n\t\tsuperMatcher;\n}\n\ncompile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {\n\tvar i,\n\t\tsetMatchers = [],\n\t\telementMatchers = [],\n\t\tcached = compilerCache[ selector + \" \" ];\n\n\tif ( !cached ) {\n\t\t// Generate a function of recursive functions that can be used to check each element\n\t\tif ( !match ) {\n\t\t\tmatch = tokenize( selector );\n\t\t}\n\t\ti = match.length;\n\t\twhile ( i-- ) {\n\t\t\tcached = matcherFromTokens( match[i] );\n\t\t\tif ( cached[ expando ] ) {\n\t\t\t\tsetMatchers.push( cached );\n\t\t\t} else {\n\t\t\t\telementMatchers.push( cached );\n\t\t\t}\n\t\t}\n\n\t\t// Cache the compiled function\n\t\tcached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );\n\n\t\t// Save selector and tokenization\n\t\tcached.selector = selector;\n\t}\n\treturn cached;\n};\n\n/**\n * A low-level selection function that works with Sizzle's compiled\n *  selector functions\n * @param {String|Function} selector A selector or a pre-compiled\n *  selector function built with Sizzle.compile\n * @param {Element} context\n * @param {Array} [results]\n * @param {Array} [seed] A set of elements to match against\n */\nselect = Sizzle.select = function( selector, context, results, seed ) {\n\tvar i, tokens, token, type, find,\n\t\tcompiled = typeof selector === \"function\" && selector,\n\t\tmatch = !seed && tokenize( (selector = compiled.selector || selector) );\n\n\tresults = results || [];\n\n\t// Try to minimize operations if there is only one selector in the list and no seed\n\t// (the latter of which guarantees us context)\n\tif ( match.length === 1 ) {\n\n\t\t// Reduce context if the leading compound selector is an ID\n\t\ttokens = match[0] = match[0].slice( 0 );\n\t\tif ( tokens.length > 2 && (token = tokens[0]).type === \"ID\" &&\n\t\t\t\tcontext.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {\n\n\t\t\tcontext = ( Expr.find[\"ID\"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];\n\t\t\tif ( !context ) {\n\t\t\t\treturn results;\n\n\t\t\t// Precompiled matchers will still verify ancestry, so step up a level\n\t\t\t} else if ( compiled ) {\n\t\t\t\tcontext = context.parentNode;\n\t\t\t}\n\n\t\t\tselector = selector.slice( tokens.shift().value.length );\n\t\t}\n\n\t\t// Fetch a seed set for right-to-left matching\n\t\ti = matchExpr[\"needsContext\"].test( selector ) ? 0 : tokens.length;\n\t\twhile ( i-- ) {\n\t\t\ttoken = tokens[i];\n\n\t\t\t// Abort if we hit a combinator\n\t\t\tif ( Expr.relative[ (type = token.type) ] ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( (find = Expr.find[ type ]) ) {\n\t\t\t\t// Search, expanding context for leading sibling combinators\n\t\t\t\tif ( (seed = find(\n\t\t\t\t\ttoken.matches[0].replace( runescape, funescape ),\n\t\t\t\t\trsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context\n\t\t\t\t)) ) {\n\n\t\t\t\t\t// If seed is empty or no tokens remain, we can return early\n\t\t\t\t\ttokens.splice( i, 1 );\n\t\t\t\t\tselector = seed.length && toSelector( tokens );\n\t\t\t\t\tif ( !selector ) {\n\t\t\t\t\t\tpush.apply( results, seed );\n\t\t\t\t\t\treturn results;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Compile and execute a filtering function if one is not provided\n\t// Provide `match` to avoid retokenization if we modified the selector above\n\t( compiled || compile( selector, match ) )(\n\t\tseed,\n\t\tcontext,\n\t\t!documentIsHTML,\n\t\tresults,\n\t\t!context || rsibling.test( selector ) && testContext( context.parentNode ) || context\n\t);\n\treturn results;\n};\n\n// One-time assignments\n\n// Sort stability\nsupport.sortStable = expando.split(\"\").sort( sortOrder ).join(\"\") === expando;\n\n// Support: Chrome 14-35+\n// Always assume duplicates if they aren't passed to the comparison function\nsupport.detectDuplicates = !!hasDuplicate;\n\n// Initialize against the default document\nsetDocument();\n\n// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)\n// Detached nodes confoundingly follow *each other*\nsupport.sortDetached = assert(function( el ) {\n\t// Should return 1, but returns 4 (following)\n\treturn el.compareDocumentPosition( document.createElement(\"fieldset\") ) & 1;\n});\n\n// Support: IE<8\n// Prevent attribute/property \"interpolation\"\n// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx\nif ( !assert(function( el ) {\n\tel.innerHTML = \"<a href='#'></a>\";\n\treturn el.firstChild.getAttribute(\"href\") === \"#\" ;\n}) ) {\n\taddHandle( \"type|href|height|width\", function( elem, name, isXML ) {\n\t\tif ( !isXML ) {\n\t\t\treturn elem.getAttribute( name, name.toLowerCase() === \"type\" ? 1 : 2 );\n\t\t}\n\t});\n}\n\n// Support: IE<9\n// Use defaultValue in place of getAttribute(\"value\")\nif ( !support.attributes || !assert(function( el ) {\n\tel.innerHTML = \"<input/>\";\n\tel.firstChild.setAttribute( \"value\", \"\" );\n\treturn el.firstChild.getAttribute( \"value\" ) === \"\";\n}) ) {\n\taddHandle( \"value\", function( elem, name, isXML ) {\n\t\tif ( !isXML && elem.nodeName.toLowerCase() === \"input\" ) {\n\t\t\treturn elem.defaultValue;\n\t\t}\n\t});\n}\n\n// Support: IE<9\n// Use getAttributeNode to fetch booleans when getAttribute lies\nif ( !assert(function( el ) {\n\treturn el.getAttribute(\"disabled\") == null;\n}) ) {\n\taddHandle( booleans, function( elem, name, isXML ) {\n\t\tvar val;\n\t\tif ( !isXML ) {\n\t\t\treturn elem[ name ] === true ? name.toLowerCase() :\n\t\t\t\t\t(val = elem.getAttributeNode( name )) && val.specified ?\n\t\t\t\t\tval.value :\n\t\t\t\tnull;\n\t\t}\n\t});\n}\n\nreturn Sizzle;\n\n})( window );\n\n\n\njQuery.find = Sizzle;\njQuery.expr = Sizzle.selectors;\n\n// Deprecated\njQuery.expr[ \":\" ] = jQuery.expr.pseudos;\njQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;\njQuery.text = Sizzle.getText;\njQuery.isXMLDoc = Sizzle.isXML;\njQuery.contains = Sizzle.contains;\njQuery.escapeSelector = Sizzle.escape;\n\n\n\n\nvar dir = function( elem, dir, until ) {\n\tvar matched = [],\n\t\ttruncate = until !== undefined;\n\n\twhile ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {\n\t\tif ( elem.nodeType === 1 ) {\n\t\t\tif ( truncate && jQuery( elem ).is( until ) ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tmatched.push( elem );\n\t\t}\n\t}\n\treturn matched;\n};\n\n\nvar siblings = function( n, elem ) {\n\tvar matched = [];\n\n\tfor ( ; n; n = n.nextSibling ) {\n\t\tif ( n.nodeType === 1 && n !== elem ) {\n\t\t\tmatched.push( n );\n\t\t}\n\t}\n\n\treturn matched;\n};\n\n\nvar rneedsContext = jQuery.expr.match.needsContext;\n\nvar rsingleTag = ( /^<([a-z][^\\/\\0>:\\x20\\t\\r\\n\\f]*)[\\x20\\t\\r\\n\\f]*\\/?>(?:<\\/\\1>|)$/i );\n\n\n\nvar risSimple = /^.[^:#\\[\\.,]*$/;\n\n// Implement the identical functionality for filter and not\nfunction winnow( elements, qualifier, not ) {\n\tif ( jQuery.isFunction( qualifier ) ) {\n\t\treturn jQuery.grep( elements, function( elem, i ) {\n\t\t\treturn !!qualifier.call( elem, i, elem ) !== not;\n\t\t} );\n\t}\n\n\t// Single element\n\tif ( qualifier.nodeType ) {\n\t\treturn jQuery.grep( elements, function( elem ) {\n\t\t\treturn ( elem === qualifier ) !== not;\n\t\t} );\n\t}\n\n\t// Arraylike of elements (jQuery, arguments, Array)\n\tif ( typeof qualifier !== \"string\" ) {\n\t\treturn jQuery.grep( elements, function( elem ) {\n\t\t\treturn ( indexOf.call( qualifier, elem ) > -1 ) !== not;\n\t\t} );\n\t}\n\n\t// Simple selector that can be filtered directly, removing non-Elements\n\tif ( risSimple.test( qualifier ) ) {\n\t\treturn jQuery.filter( qualifier, elements, not );\n\t}\n\n\t// Complex selector, compare the two sets, removing non-Elements\n\tqualifier = jQuery.filter( qualifier, elements );\n\treturn jQuery.grep( elements, function( elem ) {\n\t\treturn ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;\n\t} );\n}\n\njQuery.filter = function( expr, elems, not ) {\n\tvar elem = elems[ 0 ];\n\n\tif ( not ) {\n\t\texpr = \":not(\" + expr + \")\";\n\t}\n\n\tif ( elems.length === 1 && elem.nodeType === 1 ) {\n\t\treturn jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];\n\t}\n\n\treturn jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {\n\t\treturn elem.nodeType === 1;\n\t} ) );\n};\n\njQuery.fn.extend( {\n\tfind: function( selector ) {\n\t\tvar i, ret,\n\t\t\tlen = this.length,\n\t\t\tself = this;\n\n\t\tif ( typeof selector !== \"string\" ) {\n\t\t\treturn this.pushStack( jQuery( selector ).filter( function() {\n\t\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\t\tif ( jQuery.contains( self[ i ], this ) ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} ) );\n\t\t}\n\n\t\tret = this.pushStack( [] );\n\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tjQuery.find( selector, self[ i ], ret );\n\t\t}\n\n\t\treturn len > 1 ? jQuery.uniqueSort( ret ) : ret;\n\t},\n\tfilter: function( selector ) {\n\t\treturn this.pushStack( winnow( this, selector || [], false ) );\n\t},\n\tnot: function( selector ) {\n\t\treturn this.pushStack( winnow( this, selector || [], true ) );\n\t},\n\tis: function( selector ) {\n\t\treturn !!winnow(\n\t\t\tthis,\n\n\t\t\t// If this is a positional/relative selector, check membership in the returned set\n\t\t\t// so $(\"p:first\").is(\"p:last\") won't return true for a doc with two \"p\".\n\t\t\ttypeof selector === \"string\" && rneedsContext.test( selector ) ?\n\t\t\t\tjQuery( selector ) :\n\t\t\t\tselector || [],\n\t\t\tfalse\n\t\t).length;\n\t}\n} );\n\n\n// Initialize a jQuery object\n\n\n// A central reference to the root jQuery(document)\nvar rootjQuery,\n\n\t// A simple way to check for HTML strings\n\t// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)\n\t// Strict HTML recognition (#11290: must start with <)\n\t// Shortcut simple #id case for speed\n\trquickExpr = /^(?:\\s*(<[\\w\\W]+>)[^>]*|#([\\w-]+))$/,\n\n\tinit = jQuery.fn.init = function( selector, context, root ) {\n\t\tvar match, elem;\n\n\t\t// HANDLE: $(\"\"), $(null), $(undefined), $(false)\n\t\tif ( !selector ) {\n\t\t\treturn this;\n\t\t}\n\n\t\t// Method init() accepts an alternate rootjQuery\n\t\t// so migrate can support jQuery.sub (gh-2101)\n\t\troot = root || rootjQuery;\n\n\t\t// Handle HTML strings\n\t\tif ( typeof selector === \"string\" ) {\n\t\t\tif ( selector[ 0 ] === \"<\" &&\n\t\t\t\tselector[ selector.length - 1 ] === \">\" &&\n\t\t\t\tselector.length >= 3 ) {\n\n\t\t\t\t// Assume that strings that start and end with <> are HTML and skip the regex check\n\t\t\t\tmatch = [ null, selector, null ];\n\n\t\t\t} else {\n\t\t\t\tmatch = rquickExpr.exec( selector );\n\t\t\t}\n\n\t\t\t// Match html or make sure no context is specified for #id\n\t\t\tif ( match && ( match[ 1 ] || !context ) ) {\n\n\t\t\t\t// HANDLE: $(html) -> $(array)\n\t\t\t\tif ( match[ 1 ] ) {\n\t\t\t\t\tcontext = context instanceof jQuery ? context[ 0 ] : context;\n\n\t\t\t\t\t// Option to run scripts is true for back-compat\n\t\t\t\t\t// Intentionally let the error be thrown if parseHTML is not present\n\t\t\t\t\tjQuery.merge( this, jQuery.parseHTML(\n\t\t\t\t\t\tmatch[ 1 ],\n\t\t\t\t\t\tcontext && context.nodeType ? context.ownerDocument || context : document,\n\t\t\t\t\t\ttrue\n\t\t\t\t\t) );\n\n\t\t\t\t\t// HANDLE: $(html, props)\n\t\t\t\t\tif ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {\n\t\t\t\t\t\tfor ( match in context ) {\n\n\t\t\t\t\t\t\t// Properties of context are called as methods if possible\n\t\t\t\t\t\t\tif ( jQuery.isFunction( this[ match ] ) ) {\n\t\t\t\t\t\t\t\tthis[ match ]( context[ match ] );\n\n\t\t\t\t\t\t\t// ...and otherwise set as attributes\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.attr( match, context[ match ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this;\n\n\t\t\t\t// HANDLE: $(#id)\n\t\t\t\t} else {\n\t\t\t\t\telem = document.getElementById( match[ 2 ] );\n\n\t\t\t\t\tif ( elem ) {\n\n\t\t\t\t\t\t// Inject the element directly into the jQuery object\n\t\t\t\t\t\tthis[ 0 ] = elem;\n\t\t\t\t\t\tthis.length = 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\n\t\t\t// HANDLE: $(expr, $(...))\n\t\t\t} else if ( !context || context.jquery ) {\n\t\t\t\treturn ( context || root ).find( selector );\n\n\t\t\t// HANDLE: $(expr, context)\n\t\t\t// (which is just equivalent to: $(context).find(expr)\n\t\t\t} else {\n\t\t\t\treturn this.constructor( context ).find( selector );\n\t\t\t}\n\n\t\t// HANDLE: $(DOMElement)\n\t\t} else if ( selector.nodeType ) {\n\t\t\tthis[ 0 ] = selector;\n\t\t\tthis.length = 1;\n\t\t\treturn this;\n\n\t\t// HANDLE: $(function)\n\t\t// Shortcut for document ready\n\t\t} else if ( jQuery.isFunction( selector ) ) {\n\t\t\treturn root.ready !== undefined ?\n\t\t\t\troot.ready( selector ) :\n\n\t\t\t\t// Execute immediately if ready is not present\n\t\t\t\tselector( jQuery );\n\t\t}\n\n\t\treturn jQuery.makeArray( selector, this );\n\t};\n\n// Give the init function the jQuery prototype for later instantiation\ninit.prototype = jQuery.fn;\n\n// Initialize central reference\nrootjQuery = jQuery( document );\n\n\nvar rparentsprev = /^(?:parents|prev(?:Until|All))/,\n\n\t// Methods guaranteed to produce a unique set when starting from a unique set\n\tguaranteedUnique = {\n\t\tchildren: true,\n\t\tcontents: true,\n\t\tnext: true,\n\t\tprev: true\n\t};\n\njQuery.fn.extend( {\n\thas: function( target ) {\n\t\tvar targets = jQuery( target, this ),\n\t\t\tl = targets.length;\n\n\t\treturn this.filter( function() {\n\t\t\tvar i = 0;\n\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\tif ( jQuery.contains( this, targets[ i ] ) ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t},\n\n\tclosest: function( selectors, context ) {\n\t\tvar cur,\n\t\t\ti = 0,\n\t\t\tl = this.length,\n\t\t\tmatched = [],\n\t\t\ttargets = typeof selectors !== \"string\" && jQuery( selectors );\n\n\t\t// Positional selectors never match, since there's no _selection_ context\n\t\tif ( !rneedsContext.test( selectors ) ) {\n\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\tfor ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {\n\n\t\t\t\t\t// Always skip document fragments\n\t\t\t\t\tif ( cur.nodeType < 11 && ( targets ?\n\t\t\t\t\t\ttargets.index( cur ) > -1 :\n\n\t\t\t\t\t\t// Don't pass non-elements to Sizzle\n\t\t\t\t\t\tcur.nodeType === 1 &&\n\t\t\t\t\t\t\tjQuery.find.matchesSelector( cur, selectors ) ) ) {\n\n\t\t\t\t\t\tmatched.push( cur );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );\n\t},\n\n\t// Determine the position of an element within the set\n\tindex: function( elem ) {\n\n\t\t// No argument, return index in parent\n\t\tif ( !elem ) {\n\t\t\treturn ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;\n\t\t}\n\n\t\t// Index in selector\n\t\tif ( typeof elem === \"string\" ) {\n\t\t\treturn indexOf.call( jQuery( elem ), this[ 0 ] );\n\t\t}\n\n\t\t// Locate the position of the desired element\n\t\treturn indexOf.call( this,\n\n\t\t\t// If it receives a jQuery object, the first element is used\n\t\t\telem.jquery ? elem[ 0 ] : elem\n\t\t);\n\t},\n\n\tadd: function( selector, context ) {\n\t\treturn this.pushStack(\n\t\t\tjQuery.uniqueSort(\n\t\t\t\tjQuery.merge( this.get(), jQuery( selector, context ) )\n\t\t\t)\n\t\t);\n\t},\n\n\taddBack: function( selector ) {\n\t\treturn this.add( selector == null ?\n\t\t\tthis.prevObject : this.prevObject.filter( selector )\n\t\t);\n\t}\n} );\n\nfunction sibling( cur, dir ) {\n\twhile ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}\n\treturn cur;\n}\n\njQuery.each( {\n\tparent: function( elem ) {\n\t\tvar parent = elem.parentNode;\n\t\treturn parent && parent.nodeType !== 11 ? parent : null;\n\t},\n\tparents: function( elem ) {\n\t\treturn dir( elem, \"parentNode\" );\n\t},\n\tparentsUntil: function( elem, i, until ) {\n\t\treturn dir( elem, \"parentNode\", until );\n\t},\n\tnext: function( elem ) {\n\t\treturn sibling( elem, \"nextSibling\" );\n\t},\n\tprev: function( elem ) {\n\t\treturn sibling( elem, \"previousSibling\" );\n\t},\n\tnextAll: function( elem ) {\n\t\treturn dir( elem, \"nextSibling\" );\n\t},\n\tprevAll: function( elem ) {\n\t\treturn dir( elem, \"previousSibling\" );\n\t},\n\tnextUntil: function( elem, i, until ) {\n\t\treturn dir( elem, \"nextSibling\", until );\n\t},\n\tprevUntil: function( elem, i, until ) {\n\t\treturn dir( elem, \"previousSibling\", until );\n\t},\n\tsiblings: function( elem ) {\n\t\treturn siblings( ( elem.parentNode || {} ).firstChild, elem );\n\t},\n\tchildren: function( elem ) {\n\t\treturn siblings( elem.firstChild );\n\t},\n\tcontents: function( elem ) {\n\t\treturn elem.contentDocument || jQuery.merge( [], elem.childNodes );\n\t}\n}, function( name, fn ) {\n\tjQuery.fn[ name ] = function( until, selector ) {\n\t\tvar matched = jQuery.map( this, fn, until );\n\n\t\tif ( name.slice( -5 ) !== \"Until\" ) {\n\t\t\tselector = until;\n\t\t}\n\n\t\tif ( selector && typeof selector === \"string\" ) {\n\t\t\tmatched = jQuery.filter( selector, matched );\n\t\t}\n\n\t\tif ( this.length > 1 ) {\n\n\t\t\t// Remove duplicates\n\t\t\tif ( !guaranteedUnique[ name ] ) {\n\t\t\t\tjQuery.uniqueSort( matched );\n\t\t\t}\n\n\t\t\t// Reverse order for parents* and prev-derivatives\n\t\t\tif ( rparentsprev.test( name ) ) {\n\t\t\t\tmatched.reverse();\n\t\t\t}\n\t\t}\n\n\t\treturn this.pushStack( matched );\n\t};\n} );\nvar rnothtmlwhite = ( /[^\\x20\\t\\r\\n\\f]+/g );\n\n\n\n// Convert String-formatted options into Object-formatted ones\nfunction createOptions( options ) {\n\tvar object = {};\n\tjQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {\n\t\tobject[ flag ] = true;\n\t} );\n\treturn object;\n}\n\n/*\n * Create a callback list using the following parameters:\n *\n *\toptions: an optional list of space-separated options that will change how\n *\t\t\tthe callback list behaves or a more traditional option object\n *\n * By default a callback list will act like an event callback list and can be\n * \"fired\" multiple times.\n *\n * Possible options:\n *\n *\tonce:\t\t\twill ensure the callback list can only be fired once (like a Deferred)\n *\n *\tmemory:\t\t\twill keep track of previous values and will call any callback added\n *\t\t\t\t\tafter the list has been fired right away with the latest \"memorized\"\n *\t\t\t\t\tvalues (like a Deferred)\n *\n *\tunique:\t\t\twill ensure a callback can only be added once (no duplicate in the list)\n *\n *\tstopOnFalse:\tinterrupt callings when a callback returns false\n *\n */\njQuery.Callbacks = function( options ) {\n\n\t// Convert options from String-formatted to Object-formatted if needed\n\t// (we check in cache first)\n\toptions = typeof options === \"string\" ?\n\t\tcreateOptions( options ) :\n\t\tjQuery.extend( {}, options );\n\n\tvar // Flag to know if list is currently firing\n\t\tfiring,\n\n\t\t// Last fire value for non-forgettable lists\n\t\tmemory,\n\n\t\t// Flag to know if list was already fired\n\t\tfired,\n\n\t\t// Flag to prevent firing\n\t\tlocked,\n\n\t\t// Actual callback list\n\t\tlist = [],\n\n\t\t// Queue of execution data for repeatable lists\n\t\tqueue = [],\n\n\t\t// Index of currently firing callback (modified by add/remove as needed)\n\t\tfiringIndex = -1,\n\n\t\t// Fire callbacks\n\t\tfire = function() {\n\n\t\t\t// Enforce single-firing\n\t\t\tlocked = options.once;\n\n\t\t\t// Execute callbacks for all pending executions,\n\t\t\t// respecting firingIndex overrides and runtime changes\n\t\t\tfired = firing = true;\n\t\t\tfor ( ; queue.length; firingIndex = -1 ) {\n\t\t\t\tmemory = queue.shift();\n\t\t\t\twhile ( ++firingIndex < list.length ) {\n\n\t\t\t\t\t// Run callback and check for early termination\n\t\t\t\t\tif ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&\n\t\t\t\t\t\toptions.stopOnFalse ) {\n\n\t\t\t\t\t\t// Jump to end and forget the data so .add doesn't re-fire\n\t\t\t\t\t\tfiringIndex = list.length;\n\t\t\t\t\t\tmemory = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Forget the data if we're done with it\n\t\t\tif ( !options.memory ) {\n\t\t\t\tmemory = false;\n\t\t\t}\n\n\t\t\tfiring = false;\n\n\t\t\t// Clean up if we're done firing for good\n\t\t\tif ( locked ) {\n\n\t\t\t\t// Keep an empty list if we have data for future add calls\n\t\t\t\tif ( memory ) {\n\t\t\t\t\tlist = [];\n\n\t\t\t\t// Otherwise, this object is spent\n\t\t\t\t} else {\n\t\t\t\t\tlist = \"\";\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t// Actual Callbacks object\n\t\tself = {\n\n\t\t\t// Add a callback or a collection of callbacks to the list\n\t\t\tadd: function() {\n\t\t\t\tif ( list ) {\n\n\t\t\t\t\t// If we have memory from a past run, we should fire after adding\n\t\t\t\t\tif ( memory && !firing ) {\n\t\t\t\t\t\tfiringIndex = list.length - 1;\n\t\t\t\t\t\tqueue.push( memory );\n\t\t\t\t\t}\n\n\t\t\t\t\t( function add( args ) {\n\t\t\t\t\t\tjQuery.each( args, function( _, arg ) {\n\t\t\t\t\t\t\tif ( jQuery.isFunction( arg ) ) {\n\t\t\t\t\t\t\t\tif ( !options.unique || !self.has( arg ) ) {\n\t\t\t\t\t\t\t\t\tlist.push( arg );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if ( arg && arg.length && jQuery.type( arg ) !== \"string\" ) {\n\n\t\t\t\t\t\t\t\t// Inspect recursively\n\t\t\t\t\t\t\t\tadd( arg );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t} )( arguments );\n\n\t\t\t\t\tif ( memory && !firing ) {\n\t\t\t\t\t\tfire();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\n\t\t\t// Remove a callback from the list\n\t\t\tremove: function() {\n\t\t\t\tjQuery.each( arguments, function( _, arg ) {\n\t\t\t\t\tvar index;\n\t\t\t\t\twhile ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {\n\t\t\t\t\t\tlist.splice( index, 1 );\n\n\t\t\t\t\t\t// Handle firing indexes\n\t\t\t\t\t\tif ( index <= firingIndex ) {\n\t\t\t\t\t\t\tfiringIndex--;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\treturn this;\n\t\t\t},\n\n\t\t\t// Check if a given callback is in the list.\n\t\t\t// If no argument is given, return whether or not list has callbacks attached.\n\t\t\thas: function( fn ) {\n\t\t\t\treturn fn ?\n\t\t\t\t\tjQuery.inArray( fn, list ) > -1 :\n\t\t\t\t\tlist.length > 0;\n\t\t\t},\n\n\t\t\t// Remove all callbacks from the list\n\t\t\tempty: function() {\n\t\t\t\tif ( list ) {\n\t\t\t\t\tlist = [];\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\n\t\t\t// Disable .fire and .add\n\t\t\t// Abort any current/pending executions\n\t\t\t// Clear all callbacks and values\n\t\t\tdisable: function() {\n\t\t\t\tlocked = queue = [];\n\t\t\t\tlist = memory = \"\";\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tdisabled: function() {\n\t\t\t\treturn !list;\n\t\t\t},\n\n\t\t\t// Disable .fire\n\t\t\t// Also disable .add unless we have memory (since it would have no effect)\n\t\t\t// Abort any pending executions\n\t\t\tlock: function() {\n\t\t\t\tlocked = queue = [];\n\t\t\t\tif ( !memory && !firing ) {\n\t\t\t\t\tlist = memory = \"\";\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tlocked: function() {\n\t\t\t\treturn !!locked;\n\t\t\t},\n\n\t\t\t// Call all callbacks with the given context and arguments\n\t\t\tfireWith: function( context, args ) {\n\t\t\t\tif ( !locked ) {\n\t\t\t\t\targs = args || [];\n\t\t\t\t\targs = [ context, args.slice ? args.slice() : args ];\n\t\t\t\t\tqueue.push( args );\n\t\t\t\t\tif ( !firing ) {\n\t\t\t\t\t\tfire();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\n\t\t\t// Call all the callbacks with the given arguments\n\t\t\tfire: function() {\n\t\t\t\tself.fireWith( this, arguments );\n\t\t\t\treturn this;\n\t\t\t},\n\n\t\t\t// To know if the callbacks have already been called at least once\n\t\t\tfired: function() {\n\t\t\t\treturn !!fired;\n\t\t\t}\n\t\t};\n\n\treturn self;\n};\n\n\nfunction Identity( v ) {\n\treturn v;\n}\nfunction Thrower( ex ) {\n\tthrow ex;\n}\n\nfunction adoptValue( value, resolve, reject ) {\n\tvar method;\n\n\ttry {\n\n\t\t// Check for promise aspect first to privilege synchronous behavior\n\t\tif ( value && jQuery.isFunction( ( method = value.promise ) ) ) {\n\t\t\tmethod.call( value ).done( resolve ).fail( reject );\n\n\t\t// Other thenables\n\t\t} else if ( value && jQuery.isFunction( ( method = value.then ) ) ) {\n\t\t\tmethod.call( value, resolve, reject );\n\n\t\t// Other non-thenables\n\t\t} else {\n\n\t\t\t// Support: Android 4.0 only\n\t\t\t// Strict mode functions invoked without .call/.apply get global-object context\n\t\t\tresolve.call( undefined, value );\n\t\t}\n\n\t// For Promises/A+, convert exceptions into rejections\n\t// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in\n\t// Deferred#then to conditionally suppress rejection.\n\t} catch ( value ) {\n\n\t\t// Support: Android 4.0 only\n\t\t// Strict mode functions invoked without .call/.apply get global-object context\n\t\treject.call( undefined, value );\n\t}\n}\n\njQuery.extend( {\n\n\tDeferred: function( func ) {\n\t\tvar tuples = [\n\n\t\t\t\t// action, add listener, callbacks,\n\t\t\t\t// ... .then handlers, argument index, [final state]\n\t\t\t\t[ \"notify\", \"progress\", jQuery.Callbacks( \"memory\" ),\n\t\t\t\t\tjQuery.Callbacks( \"memory\" ), 2 ],\n\t\t\t\t[ \"resolve\", \"done\", jQuery.Callbacks( \"once memory\" ),\n\t\t\t\t\tjQuery.Callbacks( \"once memory\" ), 0, \"resolved\" ],\n\t\t\t\t[ \"reject\", \"fail\", jQuery.Callbacks( \"once memory\" ),\n\t\t\t\t\tjQuery.Callbacks( \"once memory\" ), 1, \"rejected\" ]\n\t\t\t],\n\t\t\tstate = \"pending\",\n\t\t\tpromise = {\n\t\t\t\tstate: function() {\n\t\t\t\t\treturn state;\n\t\t\t\t},\n\t\t\t\talways: function() {\n\t\t\t\t\tdeferred.done( arguments ).fail( arguments );\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\t\t\t\t\"catch\": function( fn ) {\n\t\t\t\t\treturn promise.then( null, fn );\n\t\t\t\t},\n\n\t\t\t\t// Keep pipe for back-compat\n\t\t\t\tpipe: function( /* fnDone, fnFail, fnProgress */ ) {\n\t\t\t\t\tvar fns = arguments;\n\n\t\t\t\t\treturn jQuery.Deferred( function( newDefer ) {\n\t\t\t\t\t\tjQuery.each( tuples, function( i, tuple ) {\n\n\t\t\t\t\t\t\t// Map tuples (progress, done, fail) to arguments (done, fail, progress)\n\t\t\t\t\t\t\tvar fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];\n\n\t\t\t\t\t\t\t// deferred.progress(function() { bind to newDefer or newDefer.notify })\n\t\t\t\t\t\t\t// deferred.done(function() { bind to newDefer or newDefer.resolve })\n\t\t\t\t\t\t\t// deferred.fail(function() { bind to newDefer or newDefer.reject })\n\t\t\t\t\t\t\tdeferred[ tuple[ 1 ] ]( function() {\n\t\t\t\t\t\t\t\tvar returned = fn && fn.apply( this, arguments );\n\t\t\t\t\t\t\t\tif ( returned && jQuery.isFunction( returned.promise ) ) {\n\t\t\t\t\t\t\t\t\treturned.promise()\n\t\t\t\t\t\t\t\t\t\t.progress( newDefer.notify )\n\t\t\t\t\t\t\t\t\t\t.done( newDefer.resolve )\n\t\t\t\t\t\t\t\t\t\t.fail( newDefer.reject );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tnewDefer[ tuple[ 0 ] + \"With\" ](\n\t\t\t\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t\t\t\tfn ? [ returned ] : arguments\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tfns = null;\n\t\t\t\t\t} ).promise();\n\t\t\t\t},\n\t\t\t\tthen: function( onFulfilled, onRejected, onProgress ) {\n\t\t\t\t\tvar maxDepth = 0;\n\t\t\t\t\tfunction resolve( depth, deferred, handler, special ) {\n\t\t\t\t\t\treturn function() {\n\t\t\t\t\t\t\tvar that = this,\n\t\t\t\t\t\t\t\targs = arguments,\n\t\t\t\t\t\t\t\tmightThrow = function() {\n\t\t\t\t\t\t\t\t\tvar returned, then;\n\n\t\t\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.3.3.3\n\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-59\n\t\t\t\t\t\t\t\t\t// Ignore double-resolution attempts\n\t\t\t\t\t\t\t\t\tif ( depth < maxDepth ) {\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\treturned = handler.apply( that, args );\n\n\t\t\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.1\n\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-48\n\t\t\t\t\t\t\t\t\tif ( returned === deferred.promise() ) {\n\t\t\t\t\t\t\t\t\t\tthrow new TypeError( \"Thenable self-resolution\" );\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t// Support: Promises/A+ sections 2.3.3.1, 3.5\n\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-54\n\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-75\n\t\t\t\t\t\t\t\t\t// Retrieve `then` only once\n\t\t\t\t\t\t\t\t\tthen = returned &&\n\n\t\t\t\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.4\n\t\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-64\n\t\t\t\t\t\t\t\t\t\t// Only check objects and functions for thenability\n\t\t\t\t\t\t\t\t\t\t( typeof returned === \"object\" ||\n\t\t\t\t\t\t\t\t\t\t\ttypeof returned === \"function\" ) &&\n\t\t\t\t\t\t\t\t\t\treturned.then;\n\n\t\t\t\t\t\t\t\t\t// Handle a returned thenable\n\t\t\t\t\t\t\t\t\tif ( jQuery.isFunction( then ) ) {\n\n\t\t\t\t\t\t\t\t\t\t// Special processors (notify) just wait for resolution\n\t\t\t\t\t\t\t\t\t\tif ( special ) {\n\t\t\t\t\t\t\t\t\t\t\tthen.call(\n\t\t\t\t\t\t\t\t\t\t\t\treturned,\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Identity, special ),\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Thrower, special )\n\t\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\t\t// Normal processors (resolve) also hook into progress\n\t\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\t\t\t// ...and disregard older resolution values\n\t\t\t\t\t\t\t\t\t\t\tmaxDepth++;\n\n\t\t\t\t\t\t\t\t\t\t\tthen.call(\n\t\t\t\t\t\t\t\t\t\t\t\treturned,\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Identity, special ),\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Thrower, special ),\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Identity,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdeferred.notifyWith )\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t// Handle all other returned values\n\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\t\t// Only substitute handlers pass on context\n\t\t\t\t\t\t\t\t\t\t// and multiple values (non-spec behavior)\n\t\t\t\t\t\t\t\t\t\tif ( handler !== Identity ) {\n\t\t\t\t\t\t\t\t\t\t\tthat = undefined;\n\t\t\t\t\t\t\t\t\t\t\targs = [ returned ];\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t// Process the value(s)\n\t\t\t\t\t\t\t\t\t\t// Default process is resolve\n\t\t\t\t\t\t\t\t\t\t( special || deferred.resolveWith )( that, args );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t// Only normal processors (resolve) catch and reject exceptions\n\t\t\t\t\t\t\t\tprocess = special ?\n\t\t\t\t\t\t\t\t\tmightThrow :\n\t\t\t\t\t\t\t\t\tfunction() {\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tmightThrow();\n\t\t\t\t\t\t\t\t\t\t} catch ( e ) {\n\n\t\t\t\t\t\t\t\t\t\t\tif ( jQuery.Deferred.exceptionHook ) {\n\t\t\t\t\t\t\t\t\t\t\t\tjQuery.Deferred.exceptionHook( e,\n\t\t\t\t\t\t\t\t\t\t\t\t\tprocess.stackTrace );\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.3.3.4.1\n\t\t\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-61\n\t\t\t\t\t\t\t\t\t\t\t// Ignore post-resolution exceptions\n\t\t\t\t\t\t\t\t\t\t\tif ( depth + 1 >= maxDepth ) {\n\n\t\t\t\t\t\t\t\t\t\t\t\t// Only substitute handlers pass on context\n\t\t\t\t\t\t\t\t\t\t\t\t// and multiple values (non-spec behavior)\n\t\t\t\t\t\t\t\t\t\t\t\tif ( handler !== Thrower ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tthat = undefined;\n\t\t\t\t\t\t\t\t\t\t\t\t\targs = [ e ];\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\tdeferred.rejectWith( that, args );\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.3.3.1\n\t\t\t\t\t\t\t// https://promisesaplus.com/#point-57\n\t\t\t\t\t\t\t// Re-resolve promises immediately to dodge false rejection from\n\t\t\t\t\t\t\t// subsequent errors\n\t\t\t\t\t\t\tif ( depth ) {\n\t\t\t\t\t\t\t\tprocess();\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// Call an optional hook to record the stack, in case of exception\n\t\t\t\t\t\t\t\t// since it's otherwise lost when execution goes async\n\t\t\t\t\t\t\t\tif ( jQuery.Deferred.getStackHook ) {\n\t\t\t\t\t\t\t\t\tprocess.stackTrace = jQuery.Deferred.getStackHook();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\twindow.setTimeout( process );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\treturn jQuery.Deferred( function( newDefer ) {\n\n\t\t\t\t\t\t// progress_handlers.add( ... )\n\t\t\t\t\t\ttuples[ 0 ][ 3 ].add(\n\t\t\t\t\t\t\tresolve(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tnewDefer,\n\t\t\t\t\t\t\t\tjQuery.isFunction( onProgress ) ?\n\t\t\t\t\t\t\t\t\tonProgress :\n\t\t\t\t\t\t\t\t\tIdentity,\n\t\t\t\t\t\t\t\tnewDefer.notifyWith\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// fulfilled_handlers.add( ... )\n\t\t\t\t\t\ttuples[ 1 ][ 3 ].add(\n\t\t\t\t\t\t\tresolve(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tnewDefer,\n\t\t\t\t\t\t\t\tjQuery.isFunction( onFulfilled ) ?\n\t\t\t\t\t\t\t\t\tonFulfilled :\n\t\t\t\t\t\t\t\t\tIdentity\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// rejected_handlers.add( ... )\n\t\t\t\t\t\ttuples[ 2 ][ 3 ].add(\n\t\t\t\t\t\t\tresolve(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tnewDefer,\n\t\t\t\t\t\t\t\tjQuery.isFunction( onRejected ) ?\n\t\t\t\t\t\t\t\t\tonRejected :\n\t\t\t\t\t\t\t\t\tThrower\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t} ).promise();\n\t\t\t\t},\n\n\t\t\t\t// Get a promise for this deferred\n\t\t\t\t// If obj is provided, the promise aspect is added to the object\n\t\t\t\tpromise: function( obj ) {\n\t\t\t\t\treturn obj != null ? jQuery.extend( obj, promise ) : promise;\n\t\t\t\t}\n\t\t\t},\n\t\t\tdeferred = {};\n\n\t\t// Add list-specific methods\n\t\tjQuery.each( tuples, function( i, tuple ) {\n\t\t\tvar list = tuple[ 2 ],\n\t\t\t\tstateString = tuple[ 5 ];\n\n\t\t\t// promise.progress = list.add\n\t\t\t// promise.done = list.add\n\t\t\t// promise.fail = list.add\n\t\t\tpromise[ tuple[ 1 ] ] = list.add;\n\n\t\t\t// Handle state\n\t\t\tif ( stateString ) {\n\t\t\t\tlist.add(\n\t\t\t\t\tfunction() {\n\n\t\t\t\t\t\t// state = \"resolved\" (i.e., fulfilled)\n\t\t\t\t\t\t// state = \"rejected\"\n\t\t\t\t\t\tstate = stateString;\n\t\t\t\t\t},\n\n\t\t\t\t\t// rejected_callbacks.disable\n\t\t\t\t\t// fulfilled_callbacks.disable\n\t\t\t\t\ttuples[ 3 - i ][ 2 ].disable,\n\n\t\t\t\t\t// progress_callbacks.lock\n\t\t\t\t\ttuples[ 0 ][ 2 ].lock\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// progress_handlers.fire\n\t\t\t// fulfilled_handlers.fire\n\t\t\t// rejected_handlers.fire\n\t\t\tlist.add( tuple[ 3 ].fire );\n\n\t\t\t// deferred.notify = function() { deferred.notifyWith(...) }\n\t\t\t// deferred.resolve = function() { deferred.resolveWith(...) }\n\t\t\t// deferred.reject = function() { deferred.rejectWith(...) }\n\t\t\tdeferred[ tuple[ 0 ] ] = function() {\n\t\t\t\tdeferred[ tuple[ 0 ] + \"With\" ]( this === deferred ? undefined : this, arguments );\n\t\t\t\treturn this;\n\t\t\t};\n\n\t\t\t// deferred.notifyWith = list.fireWith\n\t\t\t// deferred.resolveWith = list.fireWith\n\t\t\t// deferred.rejectWith = list.fireWith\n\t\t\tdeferred[ tuple[ 0 ] + \"With\" ] = list.fireWith;\n\t\t} );\n\n\t\t// Make the deferred a promise\n\t\tpromise.promise( deferred );\n\n\t\t// Call given func if any\n\t\tif ( func ) {\n\t\t\tfunc.call( deferred, deferred );\n\t\t}\n\n\t\t// All done!\n\t\treturn deferred;\n\t},\n\n\t// Deferred helper\n\twhen: function( singleValue ) {\n\t\tvar\n\n\t\t\t// count of uncompleted subordinates\n\t\t\tremaining = arguments.length,\n\n\t\t\t// count of unprocessed arguments\n\t\t\ti = remaining,\n\n\t\t\t// subordinate fulfillment data\n\t\t\tresolveContexts = Array( i ),\n\t\t\tresolveValues = slice.call( arguments ),\n\n\t\t\t// the master Deferred\n\t\t\tmaster = jQuery.Deferred(),\n\n\t\t\t// subordinate callback factory\n\t\t\tupdateFunc = function( i ) {\n\t\t\t\treturn function( value ) {\n\t\t\t\t\tresolveContexts[ i ] = this;\n\t\t\t\t\tresolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;\n\t\t\t\t\tif ( !( --remaining ) ) {\n\t\t\t\t\t\tmaster.resolveWith( resolveContexts, resolveValues );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t};\n\n\t\t// Single- and empty arguments are adopted like Promise.resolve\n\t\tif ( remaining <= 1 ) {\n\t\t\tadoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject );\n\n\t\t\t// Use .then() to unwrap secondary thenables (cf. gh-3000)\n\t\t\tif ( master.state() === \"pending\" ||\n\t\t\t\tjQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {\n\n\t\t\t\treturn master.then();\n\t\t\t}\n\t\t}\n\n\t\t// Multiple arguments are aggregated like Promise.all array elements\n\t\twhile ( i-- ) {\n\t\t\tadoptValue( resolveValues[ i ], updateFunc( i ), master.reject );\n\t\t}\n\n\t\treturn master.promise();\n\t}\n} );\n\n\n// These usually indicate a programmer mistake during development,\n// warn about them ASAP rather than swallowing them by default.\nvar rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;\n\njQuery.Deferred.exceptionHook = function( error, stack ) {\n\n\t// Support: IE 8 - 9 only\n\t// Console exists when dev tools are open, which can happen at any time\n\tif ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {\n\t\twindow.console.warn( \"jQuery.Deferred exception: \" + error.message, error.stack, stack );\n\t}\n};\n\n\n\n\njQuery.readyException = function( error ) {\n\twindow.setTimeout( function() {\n\t\tthrow error;\n\t} );\n};\n\n\n\n\n// The deferred used on DOM ready\nvar readyList = jQuery.Deferred();\n\njQuery.fn.ready = function( fn ) {\n\n\treadyList\n\t\t.then( fn )\n\n\t\t// Wrap jQuery.readyException in a function so that the lookup\n\t\t// happens at the time of error handling instead of callback\n\t\t// registration.\n\t\t.catch( function( error ) {\n\t\t\tjQuery.readyException( error );\n\t\t} );\n\n\treturn this;\n};\n\njQuery.extend( {\n\n\t// Is the DOM ready to be used? Set to true once it occurs.\n\tisReady: false,\n\n\t// A counter to track how many items to wait for before\n\t// the ready event fires. See #6781\n\treadyWait: 1,\n\n\t// Hold (or release) the ready event\n\tholdReady: function( hold ) {\n\t\tif ( hold ) {\n\t\t\tjQuery.readyWait++;\n\t\t} else {\n\t\t\tjQuery.ready( true );\n\t\t}\n\t},\n\n\t// Handle when the DOM is ready\n\tready: function( wait ) {\n\n\t\t// Abort if there are pending holds or we're already ready\n\t\tif ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Remember that the DOM is ready\n\t\tjQuery.isReady = true;\n\n\t\t// If a normal DOM Ready event fired, decrement, and wait if need be\n\t\tif ( wait !== true && --jQuery.readyWait > 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If there are functions bound, to execute\n\t\treadyList.resolveWith( document, [ jQuery ] );\n\t}\n} );\n\njQuery.ready.then = readyList.then;\n\n// The ready event handler and self cleanup method\nfunction completed() {\n\tdocument.removeEventListener( \"DOMContentLoaded\", completed );\n\twindow.removeEventListener( \"load\", completed );\n\tjQuery.ready();\n}\n\n// Catch cases where $(document).ready() is called\n// after the browser event has already occurred.\n// Support: IE <=9 - 10 only\n// Older IE sometimes signals \"interactive\" too soon\nif ( document.readyState === \"complete\" ||\n\t( document.readyState !== \"loading\" && !document.documentElement.doScroll ) ) {\n\n\t// Handle it asynchronously to allow scripts the opportunity to delay ready\n\twindow.setTimeout( jQuery.ready );\n\n} else {\n\n\t// Use the handy event callback\n\tdocument.addEventListener( \"DOMContentLoaded\", completed );\n\n\t// A fallback to window.onload, that will always work\n\twindow.addEventListener( \"load\", completed );\n}\n\n\n\n\n// Multifunctional method to get and set values of a collection\n// The value/s can optionally be executed if it's a function\nvar access = function( elems, fn, key, value, chainable, emptyGet, raw ) {\n\tvar i = 0,\n\t\tlen = elems.length,\n\t\tbulk = key == null;\n\n\t// Sets many values\n\tif ( jQuery.type( key ) === \"object\" ) {\n\t\tchainable = true;\n\t\tfor ( i in key ) {\n\t\t\taccess( elems, fn, i, key[ i ], true, emptyGet, raw );\n\t\t}\n\n\t// Sets one value\n\t} else if ( value !== undefined ) {\n\t\tchainable = true;\n\n\t\tif ( !jQuery.isFunction( value ) ) {\n\t\t\traw = true;\n\t\t}\n\n\t\tif ( bulk ) {\n\n\t\t\t// Bulk operations run against the entire set\n\t\t\tif ( raw ) {\n\t\t\t\tfn.call( elems, value );\n\t\t\t\tfn = null;\n\n\t\t\t// ...except when executing function values\n\t\t\t} else {\n\t\t\t\tbulk = fn;\n\t\t\t\tfn = function( elem, key, value ) {\n\t\t\t\t\treturn bulk.call( jQuery( elem ), value );\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tif ( fn ) {\n\t\t\tfor ( ; i < len; i++ ) {\n\t\t\t\tfn(\n\t\t\t\t\telems[ i ], key, raw ?\n\t\t\t\t\tvalue :\n\t\t\t\t\tvalue.call( elems[ i ], i, fn( elems[ i ], key ) )\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( chainable ) {\n\t\treturn elems;\n\t}\n\n\t// Gets\n\tif ( bulk ) {\n\t\treturn fn.call( elems );\n\t}\n\n\treturn len ? fn( elems[ 0 ], key ) : emptyGet;\n};\nvar acceptData = function( owner ) {\n\n\t// Accepts only:\n\t//  - Node\n\t//    - Node.ELEMENT_NODE\n\t//    - Node.DOCUMENT_NODE\n\t//  - Object\n\t//    - Any\n\treturn owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );\n};\n\n\n\n\nfunction Data() {\n\tthis.expando = jQuery.expando + Data.uid++;\n}\n\nData.uid = 1;\n\nData.prototype = {\n\n\tcache: function( owner ) {\n\n\t\t// Check if the owner object already has a cache\n\t\tvar value = owner[ this.expando ];\n\n\t\t// If not, create one\n\t\tif ( !value ) {\n\t\t\tvalue = {};\n\n\t\t\t// We can accept data for non-element nodes in modern browsers,\n\t\t\t// but we should not, see #8335.\n\t\t\t// Always return an empty object.\n\t\t\tif ( acceptData( owner ) ) {\n\n\t\t\t\t// If it is a node unlikely to be stringify-ed or looped over\n\t\t\t\t// use plain assignment\n\t\t\t\tif ( owner.nodeType ) {\n\t\t\t\t\towner[ this.expando ] = value;\n\n\t\t\t\t// Otherwise secure it in a non-enumerable property\n\t\t\t\t// configurable must be true to allow the property to be\n\t\t\t\t// deleted when data is removed\n\t\t\t\t} else {\n\t\t\t\t\tObject.defineProperty( owner, this.expando, {\n\t\t\t\t\t\tvalue: value,\n\t\t\t\t\t\tconfigurable: true\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn value;\n\t},\n\tset: function( owner, data, value ) {\n\t\tvar prop,\n\t\t\tcache = this.cache( owner );\n\n\t\t// Handle: [ owner, key, value ] args\n\t\t// Always use camelCase key (gh-2257)\n\t\tif ( typeof data === \"string\" ) {\n\t\t\tcache[ jQuery.camelCase( data ) ] = value;\n\n\t\t// Handle: [ owner, { properties } ] args\n\t\t} else {\n\n\t\t\t// Copy the properties one-by-one to the cache object\n\t\t\tfor ( prop in data ) {\n\t\t\t\tcache[ jQuery.camelCase( prop ) ] = data[ prop ];\n\t\t\t}\n\t\t}\n\t\treturn cache;\n\t},\n\tget: function( owner, key ) {\n\t\treturn key === undefined ?\n\t\t\tthis.cache( owner ) :\n\n\t\t\t// Always use camelCase key (gh-2257)\n\t\t\towner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ];\n\t},\n\taccess: function( owner, key, value ) {\n\n\t\t// In cases where either:\n\t\t//\n\t\t//   1. No key was specified\n\t\t//   2. A string key was specified, but no value provided\n\t\t//\n\t\t// Take the \"read\" path and allow the get method to determine\n\t\t// which value to return, respectively either:\n\t\t//\n\t\t//   1. The entire cache object\n\t\t//   2. The data stored at the key\n\t\t//\n\t\tif ( key === undefined ||\n\t\t\t\t( ( key && typeof key === \"string\" ) && value === undefined ) ) {\n\n\t\t\treturn this.get( owner, key );\n\t\t}\n\n\t\t// When the key is not a string, or both a key and value\n\t\t// are specified, set or extend (existing objects) with either:\n\t\t//\n\t\t//   1. An object of properties\n\t\t//   2. A key and value\n\t\t//\n\t\tthis.set( owner, key, value );\n\n\t\t// Since the \"set\" path can have two possible entry points\n\t\t// return the expected data based on which path was taken[*]\n\t\treturn value !== undefined ? value : key;\n\t},\n\tremove: function( owner, key ) {\n\t\tvar i,\n\t\t\tcache = owner[ this.expando ];\n\n\t\tif ( cache === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( key !== undefined ) {\n\n\t\t\t// Support array or space separated string of keys\n\t\t\tif ( jQuery.isArray( key ) ) {\n\n\t\t\t\t// If key is an array of keys...\n\t\t\t\t// We always set camelCase keys, so remove that.\n\t\t\t\tkey = key.map( jQuery.camelCase );\n\t\t\t} else {\n\t\t\t\tkey = jQuery.camelCase( key );\n\n\t\t\t\t// If a key with the spaces exists, use it.\n\t\t\t\t// Otherwise, create an array by matching non-whitespace\n\t\t\t\tkey = key in cache ?\n\t\t\t\t\t[ key ] :\n\t\t\t\t\t( key.match( rnothtmlwhite ) || [] );\n\t\t\t}\n\n\t\t\ti = key.length;\n\n\t\t\twhile ( i-- ) {\n\t\t\t\tdelete cache[ key[ i ] ];\n\t\t\t}\n\t\t}\n\n\t\t// Remove the expando if there's no more data\n\t\tif ( key === undefined || jQuery.isEmptyObject( cache ) ) {\n\n\t\t\t// Support: Chrome <=35 - 45\n\t\t\t// Webkit & Blink performance suffers when deleting properties\n\t\t\t// from DOM nodes, so set to undefined instead\n\t\t\t// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)\n\t\t\tif ( owner.nodeType ) {\n\t\t\t\towner[ this.expando ] = undefined;\n\t\t\t} else {\n\t\t\t\tdelete owner[ this.expando ];\n\t\t\t}\n\t\t}\n\t},\n\thasData: function( owner ) {\n\t\tvar cache = owner[ this.expando ];\n\t\treturn cache !== undefined && !jQuery.isEmptyObject( cache );\n\t}\n};\nvar dataPriv = new Data();\n\nvar dataUser = new Data();\n\n\n\n//\tImplementation Summary\n//\n//\t1. Enforce API surface and semantic compatibility with 1.9.x branch\n//\t2. Improve the module's maintainability by reducing the storage\n//\t\tpaths to a single mechanism.\n//\t3. Use the same single mechanism to support \"private\" and \"user\" data.\n//\t4. _Never_ expose \"private\" data to user code (TODO: Drop _data, _removeData)\n//\t5. Avoid exposing implementation details on user objects (eg. expando properties)\n//\t6. Provide a clear path for implementation upgrade to WeakMap in 2014\n\nvar rbrace = /^(?:\\{[\\w\\W]*\\}|\\[[\\w\\W]*\\])$/,\n\trmultiDash = /[A-Z]/g;\n\nfunction getData( data ) {\n\tif ( data === \"true\" ) {\n\t\treturn true;\n\t}\n\n\tif ( data === \"false\" ) {\n\t\treturn false;\n\t}\n\n\tif ( data === \"null\" ) {\n\t\treturn null;\n\t}\n\n\t// Only convert to a number if it doesn't change the string\n\tif ( data === +data + \"\" ) {\n\t\treturn +data;\n\t}\n\n\tif ( rbrace.test( data ) ) {\n\t\treturn JSON.parse( data );\n\t}\n\n\treturn data;\n}\n\nfunction dataAttr( elem, key, data ) {\n\tvar name;\n\n\t// If nothing was found internally, try to fetch any\n\t// data from the HTML5 data-* attribute\n\tif ( data === undefined && elem.nodeType === 1 ) {\n\t\tname = \"data-\" + key.replace( rmultiDash, \"-$&\" ).toLowerCase();\n\t\tdata = elem.getAttribute( name );\n\n\t\tif ( typeof data === \"string\" ) {\n\t\t\ttry {\n\t\t\t\tdata = getData( data );\n\t\t\t} catch ( e ) {}\n\n\t\t\t// Make sure we set the data so it isn't changed later\n\t\t\tdataUser.set( elem, key, data );\n\t\t} else {\n\t\t\tdata = undefined;\n\t\t}\n\t}\n\treturn data;\n}\n\njQuery.extend( {\n\thasData: function( elem ) {\n\t\treturn dataUser.hasData( elem ) || dataPriv.hasData( elem );\n\t},\n\n\tdata: function( elem, name, data ) {\n\t\treturn dataUser.access( elem, name, data );\n\t},\n\n\tremoveData: function( elem, name ) {\n\t\tdataUser.remove( elem, name );\n\t},\n\n\t// TODO: Now that all calls to _data and _removeData have been replaced\n\t// with direct calls to dataPriv methods, these can be deprecated.\n\t_data: function( elem, name, data ) {\n\t\treturn dataPriv.access( elem, name, data );\n\t},\n\n\t_removeData: function( elem, name ) {\n\t\tdataPriv.remove( elem, name );\n\t}\n} );\n\njQuery.fn.extend( {\n\tdata: function( key, value ) {\n\t\tvar i, name, data,\n\t\t\telem = this[ 0 ],\n\t\t\tattrs = elem && elem.attributes;\n\n\t\t// Gets all values\n\t\tif ( key === undefined ) {\n\t\t\tif ( this.length ) {\n\t\t\t\tdata = dataUser.get( elem );\n\n\t\t\t\tif ( elem.nodeType === 1 && !dataPriv.get( elem, \"hasDataAttrs\" ) ) {\n\t\t\t\t\ti = attrs.length;\n\t\t\t\t\twhile ( i-- ) {\n\n\t\t\t\t\t\t// Support: IE 11 only\n\t\t\t\t\t\t// The attrs elements can be null (#14894)\n\t\t\t\t\t\tif ( attrs[ i ] ) {\n\t\t\t\t\t\t\tname = attrs[ i ].name;\n\t\t\t\t\t\t\tif ( name.indexOf( \"data-\" ) === 0 ) {\n\t\t\t\t\t\t\t\tname = jQuery.camelCase( name.slice( 5 ) );\n\t\t\t\t\t\t\t\tdataAttr( elem, name, data[ name ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdataPriv.set( elem, \"hasDataAttrs\", true );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn data;\n\t\t}\n\n\t\t// Sets multiple values\n\t\tif ( typeof key === \"object\" ) {\n\t\t\treturn this.each( function() {\n\t\t\t\tdataUser.set( this, key );\n\t\t\t} );\n\t\t}\n\n\t\treturn access( this, function( value ) {\n\t\t\tvar data;\n\n\t\t\t// The calling jQuery object (element matches) is not empty\n\t\t\t// (and therefore has an element appears at this[ 0 ]) and the\n\t\t\t// `value` parameter was not undefined. An empty jQuery object\n\t\t\t// will result in `undefined` for elem = this[ 0 ] which will\n\t\t\t// throw an exception if an attempt to read a data cache is made.\n\t\t\tif ( elem && value === undefined ) {\n\n\t\t\t\t// Attempt to get data from the cache\n\t\t\t\t// The key will always be camelCased in Data\n\t\t\t\tdata = dataUser.get( elem, key );\n\t\t\t\tif ( data !== undefined ) {\n\t\t\t\t\treturn data;\n\t\t\t\t}\n\n\t\t\t\t// Attempt to \"discover\" the data in\n\t\t\t\t// HTML5 custom data-* attrs\n\t\t\t\tdata = dataAttr( elem, key );\n\t\t\t\tif ( data !== undefined ) {\n\t\t\t\t\treturn data;\n\t\t\t\t}\n\n\t\t\t\t// We tried really hard, but the data doesn't exist.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Set the data...\n\t\t\tthis.each( function() {\n\n\t\t\t\t// We always store the camelCased key\n\t\t\t\tdataUser.set( this, key, value );\n\t\t\t} );\n\t\t}, null, value, arguments.length > 1, null, true );\n\t},\n\n\tremoveData: function( key ) {\n\t\treturn this.each( function() {\n\t\t\tdataUser.remove( this, key );\n\t\t} );\n\t}\n} );\n\n\njQuery.extend( {\n\tqueue: function( elem, type, data ) {\n\t\tvar queue;\n\n\t\tif ( elem ) {\n\t\t\ttype = ( type || \"fx\" ) + \"queue\";\n\t\t\tqueue = dataPriv.get( elem, type );\n\n\t\t\t// Speed up dequeue by getting out quickly if this is just a lookup\n\t\t\tif ( data ) {\n\t\t\t\tif ( !queue || jQuery.isArray( data ) ) {\n\t\t\t\t\tqueue = dataPriv.access( elem, type, jQuery.makeArray( data ) );\n\t\t\t\t} else {\n\t\t\t\t\tqueue.push( data );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn queue || [];\n\t\t}\n\t},\n\n\tdequeue: function( elem, type ) {\n\t\ttype = type || \"fx\";\n\n\t\tvar queue = jQuery.queue( elem, type ),\n\t\t\tstartLength = queue.length,\n\t\t\tfn = queue.shift(),\n\t\t\thooks = jQuery._queueHooks( elem, type ),\n\t\t\tnext = function() {\n\t\t\t\tjQuery.dequeue( elem, type );\n\t\t\t};\n\n\t\t// If the fx queue is dequeued, always remove the progress sentinel\n\t\tif ( fn === \"inprogress\" ) {\n\t\t\tfn = queue.shift();\n\t\t\tstartLength--;\n\t\t}\n\n\t\tif ( fn ) {\n\n\t\t\t// Add a progress sentinel to prevent the fx queue from being\n\t\t\t// automatically dequeued\n\t\t\tif ( type === \"fx\" ) {\n\t\t\t\tqueue.unshift( \"inprogress\" );\n\t\t\t}\n\n\t\t\t// Clear up the last queue stop function\n\t\t\tdelete hooks.stop;\n\t\t\tfn.call( elem, next, hooks );\n\t\t}\n\n\t\tif ( !startLength && hooks ) {\n\t\t\thooks.empty.fire();\n\t\t}\n\t},\n\n\t// Not public - generate a queueHooks object, or return the current one\n\t_queueHooks: function( elem, type ) {\n\t\tvar key = type + \"queueHooks\";\n\t\treturn dataPriv.get( elem, key ) || dataPriv.access( elem, key, {\n\t\t\tempty: jQuery.Callbacks( \"once memory\" ).add( function() {\n\t\t\t\tdataPriv.remove( elem, [ type + \"queue\", key ] );\n\t\t\t} )\n\t\t} );\n\t}\n} );\n\njQuery.fn.extend( {\n\tqueue: function( type, data ) {\n\t\tvar setter = 2;\n\n\t\tif ( typeof type !== \"string\" ) {\n\t\t\tdata = type;\n\t\t\ttype = \"fx\";\n\t\t\tsetter--;\n\t\t}\n\n\t\tif ( arguments.length < setter ) {\n\t\t\treturn jQuery.queue( this[ 0 ], type );\n\t\t}\n\n\t\treturn data === undefined ?\n\t\t\tthis :\n\t\t\tthis.each( function() {\n\t\t\t\tvar queue = jQuery.queue( this, type, data );\n\n\t\t\t\t// Ensure a hooks for this queue\n\t\t\t\tjQuery._queueHooks( this, type );\n\n\t\t\t\tif ( type === \"fx\" && queue[ 0 ] !== \"inprogress\" ) {\n\t\t\t\t\tjQuery.dequeue( this, type );\n\t\t\t\t}\n\t\t\t} );\n\t},\n\tdequeue: function( type ) {\n\t\treturn this.each( function() {\n\t\t\tjQuery.dequeue( this, type );\n\t\t} );\n\t},\n\tclearQueue: function( type ) {\n\t\treturn this.queue( type || \"fx\", [] );\n\t},\n\n\t// Get a promise resolved when queues of a certain type\n\t// are emptied (fx is the type by default)\n\tpromise: function( type, obj ) {\n\t\tvar tmp,\n\t\t\tcount = 1,\n\t\t\tdefer = jQuery.Deferred(),\n\t\t\telements = this,\n\t\t\ti = this.length,\n\t\t\tresolve = function() {\n\t\t\t\tif ( !( --count ) ) {\n\t\t\t\t\tdefer.resolveWith( elements, [ elements ] );\n\t\t\t\t}\n\t\t\t};\n\n\t\tif ( typeof type !== \"string\" ) {\n\t\t\tobj = type;\n\t\t\ttype = undefined;\n\t\t}\n\t\ttype = type || \"fx\";\n\n\t\twhile ( i-- ) {\n\t\t\ttmp = dataPriv.get( elements[ i ], type + \"queueHooks\" );\n\t\t\tif ( tmp && tmp.empty ) {\n\t\t\t\tcount++;\n\t\t\t\ttmp.empty.add( resolve );\n\t\t\t}\n\t\t}\n\t\tresolve();\n\t\treturn defer.promise( obj );\n\t}\n} );\nvar pnum = ( /[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/ ).source;\n\nvar rcssNum = new RegExp( \"^(?:([+-])=|)(\" + pnum + \")([a-z%]*)$\", \"i\" );\n\n\nvar cssExpand = [ \"Top\", \"Right\", \"Bottom\", \"Left\" ];\n\nvar isHiddenWithinTree = function( elem, el ) {\n\n\t\t// isHiddenWithinTree might be called from jQuery#filter function;\n\t\t// in that case, element will be second argument\n\t\telem = el || elem;\n\n\t\t// Inline style trumps all\n\t\treturn elem.style.display === \"none\" ||\n\t\t\telem.style.display === \"\" &&\n\n\t\t\t// Otherwise, check computed style\n\t\t\t// Support: Firefox <=43 - 45\n\t\t\t// Disconnected elements can have computed display: none, so first confirm that elem is\n\t\t\t// in the document.\n\t\t\tjQuery.contains( elem.ownerDocument, elem ) &&\n\n\t\t\tjQuery.css( elem, \"display\" ) === \"none\";\n\t};\n\nvar swap = function( elem, options, callback, args ) {\n\tvar ret, name,\n\t\told = {};\n\n\t// Remember the old values, and insert the new ones\n\tfor ( name in options ) {\n\t\told[ name ] = elem.style[ name ];\n\t\telem.style[ name ] = options[ name ];\n\t}\n\n\tret = callback.apply( elem, args || [] );\n\n\t// Revert the old values\n\tfor ( name in options ) {\n\t\telem.style[ name ] = old[ name ];\n\t}\n\n\treturn ret;\n};\n\n\n\n\nfunction adjustCSS( elem, prop, valueParts, tween ) {\n\tvar adjusted,\n\t\tscale = 1,\n\t\tmaxIterations = 20,\n\t\tcurrentValue = tween ?\n\t\t\tfunction() {\n\t\t\t\treturn tween.cur();\n\t\t\t} :\n\t\t\tfunction() {\n\t\t\t\treturn jQuery.css( elem, prop, \"\" );\n\t\t\t},\n\t\tinitial = currentValue(),\n\t\tunit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? \"\" : \"px\" ),\n\n\t\t// Starting value computation is required for potential unit mismatches\n\t\tinitialInUnit = ( jQuery.cssNumber[ prop ] || unit !== \"px\" && +initial ) &&\n\t\t\trcssNum.exec( jQuery.css( elem, prop ) );\n\n\tif ( initialInUnit && initialInUnit[ 3 ] !== unit ) {\n\n\t\t// Trust units reported by jQuery.css\n\t\tunit = unit || initialInUnit[ 3 ];\n\n\t\t// Make sure we update the tween properties later on\n\t\tvalueParts = valueParts || [];\n\n\t\t// Iteratively approximate from a nonzero starting point\n\t\tinitialInUnit = +initial || 1;\n\n\t\tdo {\n\n\t\t\t// If previous iteration zeroed out, double until we get *something*.\n\t\t\t// Use string for doubling so we don't accidentally see scale as unchanged below\n\t\t\tscale = scale || \".5\";\n\n\t\t\t// Adjust and apply\n\t\t\tinitialInUnit = initialInUnit / scale;\n\t\t\tjQuery.style( elem, prop, initialInUnit + unit );\n\n\t\t// Update scale, tolerating zero or NaN from tween.cur()\n\t\t// Break the loop if scale is unchanged or perfect, or if we've just had enough.\n\t\t} while (\n\t\t\tscale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations\n\t\t);\n\t}\n\n\tif ( valueParts ) {\n\t\tinitialInUnit = +initialInUnit || +initial || 0;\n\n\t\t// Apply relative offset (+=/-=) if specified\n\t\tadjusted = valueParts[ 1 ] ?\n\t\t\tinitialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :\n\t\t\t+valueParts[ 2 ];\n\t\tif ( tween ) {\n\t\t\ttween.unit = unit;\n\t\t\ttween.start = initialInUnit;\n\t\t\ttween.end = adjusted;\n\t\t}\n\t}\n\treturn adjusted;\n}\n\n\nvar defaultDisplayMap = {};\n\nfunction getDefaultDisplay( elem ) {\n\tvar temp,\n\t\tdoc = elem.ownerDocument,\n\t\tnodeName = elem.nodeName,\n\t\tdisplay = defaultDisplayMap[ nodeName ];\n\n\tif ( display ) {\n\t\treturn display;\n\t}\n\n\ttemp = doc.body.appendChild( doc.createElement( nodeName ) );\n\tdisplay = jQuery.css( temp, \"display\" );\n\n\ttemp.parentNode.removeChild( temp );\n\n\tif ( display === \"none\" ) {\n\t\tdisplay = \"block\";\n\t}\n\tdefaultDisplayMap[ nodeName ] = display;\n\n\treturn display;\n}\n\nfunction showHide( elements, show ) {\n\tvar display, elem,\n\t\tvalues = [],\n\t\tindex = 0,\n\t\tlength = elements.length;\n\n\t// Determine new display value for elements that need to change\n\tfor ( ; index < length; index++ ) {\n\t\telem = elements[ index ];\n\t\tif ( !elem.style ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tdisplay = elem.style.display;\n\t\tif ( show ) {\n\n\t\t\t// Since we force visibility upon cascade-hidden elements, an immediate (and slow)\n\t\t\t// check is required in this first loop unless we have a nonempty display value (either\n\t\t\t// inline or about-to-be-restored)\n\t\t\tif ( display === \"none\" ) {\n\t\t\t\tvalues[ index ] = dataPriv.get( elem, \"display\" ) || null;\n\t\t\t\tif ( !values[ index ] ) {\n\t\t\t\t\telem.style.display = \"\";\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( elem.style.display === \"\" && isHiddenWithinTree( elem ) ) {\n\t\t\t\tvalues[ index ] = getDefaultDisplay( elem );\n\t\t\t}\n\t\t} else {\n\t\t\tif ( display !== \"none\" ) {\n\t\t\t\tvalues[ index ] = \"none\";\n\n\t\t\t\t// Remember what we're overwriting\n\t\t\t\tdataPriv.set( elem, \"display\", display );\n\t\t\t}\n\t\t}\n\t}\n\n\t// Set the display of the elements in a second loop to avoid constant reflow\n\tfor ( index = 0; index < length; index++ ) {\n\t\tif ( values[ index ] != null ) {\n\t\t\telements[ index ].style.display = values[ index ];\n\t\t}\n\t}\n\n\treturn elements;\n}\n\njQuery.fn.extend( {\n\tshow: function() {\n\t\treturn showHide( this, true );\n\t},\n\thide: function() {\n\t\treturn showHide( this );\n\t},\n\ttoggle: function( state ) {\n\t\tif ( typeof state === \"boolean\" ) {\n\t\t\treturn state ? this.show() : this.hide();\n\t\t}\n\n\t\treturn this.each( function() {\n\t\t\tif ( isHiddenWithinTree( this ) ) {\n\t\t\t\tjQuery( this ).show();\n\t\t\t} else {\n\t\t\t\tjQuery( this ).hide();\n\t\t\t}\n\t\t} );\n\t}\n} );\nvar rcheckableType = ( /^(?:checkbox|radio)$/i );\n\nvar rtagName = ( /<([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]+)/i );\n\nvar rscriptType = ( /^$|\\/(?:java|ecma)script/i );\n\n\n\n// We have to close these tags to support XHTML (#13200)\nvar wrapMap = {\n\n\t// Support: IE <=9 only\n\toption: [ 1, \"<select multiple='multiple'>\", \"</select>\" ],\n\n\t// XHTML parsers do not magically insert elements in the\n\t// same way that tag soup parsers do. So we cannot shorten\n\t// this by omitting <tbody> or other required elements.\n\tthead: [ 1, \"<table>\", \"</table>\" ],\n\tcol: [ 2, \"<table><colgroup>\", \"</colgroup></table>\" ],\n\ttr: [ 2, \"<table><tbody>\", \"</tbody></table>\" ],\n\ttd: [ 3, \"<table><tbody><tr>\", \"</tr></tbody></table>\" ],\n\n\t_default: [ 0, \"\", \"\" ]\n};\n\n// Support: IE <=9 only\nwrapMap.optgroup = wrapMap.option;\n\nwrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\nwrapMap.th = wrapMap.td;\n\n\nfunction getAll( context, tag ) {\n\n\t// Support: IE <=9 - 11 only\n\t// Use typeof to avoid zero-argument method invocation on host objects (#15151)\n\tvar ret;\n\n\tif ( typeof context.getElementsByTagName !== \"undefined\" ) {\n\t\tret = context.getElementsByTagName( tag || \"*\" );\n\n\t} else if ( typeof context.querySelectorAll !== \"undefined\" ) {\n\t\tret = context.querySelectorAll( tag || \"*\" );\n\n\t} else {\n\t\tret = [];\n\t}\n\n\tif ( tag === undefined || tag && jQuery.nodeName( context, tag ) ) {\n\t\treturn jQuery.merge( [ context ], ret );\n\t}\n\n\treturn ret;\n}\n\n\n// Mark scripts as having already been evaluated\nfunction setGlobalEval( elems, refElements ) {\n\tvar i = 0,\n\t\tl = elems.length;\n\n\tfor ( ; i < l; i++ ) {\n\t\tdataPriv.set(\n\t\t\telems[ i ],\n\t\t\t\"globalEval\",\n\t\t\t!refElements || dataPriv.get( refElements[ i ], \"globalEval\" )\n\t\t);\n\t}\n}\n\n\nvar rhtml = /<|&#?\\w+;/;\n\nfunction buildFragment( elems, context, scripts, selection, ignored ) {\n\tvar elem, tmp, tag, wrap, contains, j,\n\t\tfragment = context.createDocumentFragment(),\n\t\tnodes = [],\n\t\ti = 0,\n\t\tl = elems.length;\n\n\tfor ( ; i < l; i++ ) {\n\t\telem = elems[ i ];\n\n\t\tif ( elem || elem === 0 ) {\n\n\t\t\t// Add nodes directly\n\t\t\tif ( jQuery.type( elem ) === \"object\" ) {\n\n\t\t\t\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t\t\t\t// push.apply(_, arraylike) throws on ancient WebKit\n\t\t\t\tjQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );\n\n\t\t\t// Convert non-html into a text node\n\t\t\t} else if ( !rhtml.test( elem ) ) {\n\t\t\t\tnodes.push( context.createTextNode( elem ) );\n\n\t\t\t// Convert html into DOM nodes\n\t\t\t} else {\n\t\t\t\ttmp = tmp || fragment.appendChild( context.createElement( \"div\" ) );\n\n\t\t\t\t// Deserialize a standard representation\n\t\t\t\ttag = ( rtagName.exec( elem ) || [ \"\", \"\" ] )[ 1 ].toLowerCase();\n\t\t\t\twrap = wrapMap[ tag ] || wrapMap._default;\n\t\t\t\ttmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];\n\n\t\t\t\t// Descend through wrappers to the right content\n\t\t\t\tj = wrap[ 0 ];\n\t\t\t\twhile ( j-- ) {\n\t\t\t\t\ttmp = tmp.lastChild;\n\t\t\t\t}\n\n\t\t\t\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t\t\t\t// push.apply(_, arraylike) throws on ancient WebKit\n\t\t\t\tjQuery.merge( nodes, tmp.childNodes );\n\n\t\t\t\t// Remember the top-level container\n\t\t\t\ttmp = fragment.firstChild;\n\n\t\t\t\t// Ensure the created nodes are orphaned (#12392)\n\t\t\t\ttmp.textContent = \"\";\n\t\t\t}\n\t\t}\n\t}\n\n\t// Remove wrapper from fragment\n\tfragment.textContent = \"\";\n\n\ti = 0;\n\twhile ( ( elem = nodes[ i++ ] ) ) {\n\n\t\t// Skip elements already in the context collection (trac-4087)\n\t\tif ( selection && jQuery.inArray( elem, selection ) > -1 ) {\n\t\t\tif ( ignored ) {\n\t\t\t\tignored.push( elem );\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tcontains = jQuery.contains( elem.ownerDocument, elem );\n\n\t\t// Append to fragment\n\t\ttmp = getAll( fragment.appendChild( elem ), \"script\" );\n\n\t\t// Preserve script evaluation history\n\t\tif ( contains ) {\n\t\t\tsetGlobalEval( tmp );\n\t\t}\n\n\t\t// Capture executables\n\t\tif ( scripts ) {\n\t\t\tj = 0;\n\t\t\twhile ( ( elem = tmp[ j++ ] ) ) {\n\t\t\t\tif ( rscriptType.test( elem.type || \"\" ) ) {\n\t\t\t\t\tscripts.push( elem );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn fragment;\n}\n\n\n( function() {\n\tvar fragment = document.createDocumentFragment(),\n\t\tdiv = fragment.appendChild( document.createElement( \"div\" ) ),\n\t\tinput = document.createElement( \"input\" );\n\n\t// Support: Android 4.0 - 4.3 only\n\t// Check state lost if the name is set (#11217)\n\t// Support: Windows Web Apps (WWA)\n\t// `name` and `type` must use .setAttribute for WWA (#14901)\n\tinput.setAttribute( \"type\", \"radio\" );\n\tinput.setAttribute( \"checked\", \"checked\" );\n\tinput.setAttribute( \"name\", \"t\" );\n\n\tdiv.appendChild( input );\n\n\t// Support: Android <=4.1 only\n\t// Older WebKit doesn't clone checked state correctly in fragments\n\tsupport.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;\n\n\t// Support: IE <=11 only\n\t// Make sure textarea (and checkbox) defaultValue is properly cloned\n\tdiv.innerHTML = \"<textarea>x</textarea>\";\n\tsupport.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;\n} )();\nvar documentElement = document.documentElement;\n\n\n\nvar\n\trkeyEvent = /^key/,\n\trmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,\n\trtypenamespace = /^([^.]*)(?:\\.(.+)|)/;\n\nfunction returnTrue() {\n\treturn true;\n}\n\nfunction returnFalse() {\n\treturn false;\n}\n\n// Support: IE <=9 only\n// See #13393 for more info\nfunction safeActiveElement() {\n\ttry {\n\t\treturn document.activeElement;\n\t} catch ( err ) { }\n}\n\nfunction on( elem, types, selector, data, fn, one ) {\n\tvar origFn, type;\n\n\t// Types can be a map of types/handlers\n\tif ( typeof types === \"object\" ) {\n\n\t\t// ( types-Object, selector, data )\n\t\tif ( typeof selector !== \"string\" ) {\n\n\t\t\t// ( types-Object, data )\n\t\t\tdata = data || selector;\n\t\t\tselector = undefined;\n\t\t}\n\t\tfor ( type in types ) {\n\t\t\ton( elem, type, selector, data, types[ type ], one );\n\t\t}\n\t\treturn elem;\n\t}\n\n\tif ( data == null && fn == null ) {\n\n\t\t// ( types, fn )\n\t\tfn = selector;\n\t\tdata = selector = undefined;\n\t} else if ( fn == null ) {\n\t\tif ( typeof selector === \"string\" ) {\n\n\t\t\t// ( types, selector, fn )\n\t\t\tfn = data;\n\t\t\tdata = undefined;\n\t\t} else {\n\n\t\t\t// ( types, data, fn )\n\t\t\tfn = data;\n\t\t\tdata = selector;\n\t\t\tselector = undefined;\n\t\t}\n\t}\n\tif ( fn === false ) {\n\t\tfn = returnFalse;\n\t} else if ( !fn ) {\n\t\treturn elem;\n\t}\n\n\tif ( one === 1 ) {\n\t\torigFn = fn;\n\t\tfn = function( event ) {\n\n\t\t\t// Can use an empty set, since event contains the info\n\t\t\tjQuery().off( event );\n\t\t\treturn origFn.apply( this, arguments );\n\t\t};\n\n\t\t// Use same guid so caller can remove using origFn\n\t\tfn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );\n\t}\n\treturn elem.each( function() {\n\t\tjQuery.event.add( this, types, fn, data, selector );\n\t} );\n}\n\n/*\n * Helper functions for managing events -- not part of the public interface.\n * Props to Dean Edwards' addEvent library for many of the ideas.\n */\njQuery.event = {\n\n\tglobal: {},\n\n\tadd: function( elem, types, handler, data, selector ) {\n\n\t\tvar handleObjIn, eventHandle, tmp,\n\t\t\tevents, t, handleObj,\n\t\t\tspecial, handlers, type, namespaces, origType,\n\t\t\telemData = dataPriv.get( elem );\n\n\t\t// Don't attach events to noData or text/comment nodes (but allow plain objects)\n\t\tif ( !elemData ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Caller can pass in an object of custom data in lieu of the handler\n\t\tif ( handler.handler ) {\n\t\t\thandleObjIn = handler;\n\t\t\thandler = handleObjIn.handler;\n\t\t\tselector = handleObjIn.selector;\n\t\t}\n\n\t\t// Ensure that invalid selectors throw exceptions at attach time\n\t\t// Evaluate against documentElement in case elem is a non-element node (e.g., document)\n\t\tif ( selector ) {\n\t\t\tjQuery.find.matchesSelector( documentElement, selector );\n\t\t}\n\n\t\t// Make sure that the handler has a unique ID, used to find/remove it later\n\t\tif ( !handler.guid ) {\n\t\t\thandler.guid = jQuery.guid++;\n\t\t}\n\n\t\t// Init the element's event structure and main handler, if this is the first\n\t\tif ( !( events = elemData.events ) ) {\n\t\t\tevents = elemData.events = {};\n\t\t}\n\t\tif ( !( eventHandle = elemData.handle ) ) {\n\t\t\teventHandle = elemData.handle = function( e ) {\n\n\t\t\t\t// Discard the second event of a jQuery.event.trigger() and\n\t\t\t\t// when an event is called after a page has unloaded\n\t\t\t\treturn typeof jQuery !== \"undefined\" && jQuery.event.triggered !== e.type ?\n\t\t\t\t\tjQuery.event.dispatch.apply( elem, arguments ) : undefined;\n\t\t\t};\n\t\t}\n\n\t\t// Handle multiple events separated by a space\n\t\ttypes = ( types || \"\" ).match( rnothtmlwhite ) || [ \"\" ];\n\t\tt = types.length;\n\t\twhile ( t-- ) {\n\t\t\ttmp = rtypenamespace.exec( types[ t ] ) || [];\n\t\t\ttype = origType = tmp[ 1 ];\n\t\t\tnamespaces = ( tmp[ 2 ] || \"\" ).split( \".\" ).sort();\n\n\t\t\t// There *must* be a type, no attaching namespace-only handlers\n\t\t\tif ( !type ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// If event changes its type, use the special event handlers for the changed type\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\n\t\t\t// If selector defined, determine special event api type, otherwise given type\n\t\t\ttype = ( selector ? special.delegateType : special.bindType ) || type;\n\n\t\t\t// Update special based on newly reset type\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\n\t\t\t// handleObj is passed to all event handlers\n\t\t\thandleObj = jQuery.extend( {\n\t\t\t\ttype: type,\n\t\t\t\torigType: origType,\n\t\t\t\tdata: data,\n\t\t\t\thandler: handler,\n\t\t\t\tguid: handler.guid,\n\t\t\t\tselector: selector,\n\t\t\t\tneedsContext: selector && jQuery.expr.match.needsContext.test( selector ),\n\t\t\t\tnamespace: namespaces.join( \".\" )\n\t\t\t}, handleObjIn );\n\n\t\t\t// Init the event handler queue if we're the first\n\t\t\tif ( !( handlers = events[ type ] ) ) {\n\t\t\t\thandlers = events[ type ] = [];\n\t\t\t\thandlers.delegateCount = 0;\n\n\t\t\t\t// Only use addEventListener if the special events handler returns false\n\t\t\t\tif ( !special.setup ||\n\t\t\t\t\tspecial.setup.call( elem, data, namespaces, eventHandle ) === false ) {\n\n\t\t\t\t\tif ( elem.addEventListener ) {\n\t\t\t\t\t\telem.addEventListener( type, eventHandle );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( special.add ) {\n\t\t\t\tspecial.add.call( elem, handleObj );\n\n\t\t\t\tif ( !handleObj.handler.guid ) {\n\t\t\t\t\thandleObj.handler.guid = handler.guid;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add to the element's handler list, delegates in front\n\t\t\tif ( selector ) {\n\t\t\t\thandlers.splice( handlers.delegateCount++, 0, handleObj );\n\t\t\t} else {\n\t\t\t\thandlers.push( handleObj );\n\t\t\t}\n\n\t\t\t// Keep track of which events have ever been used, for event optimization\n\t\t\tjQuery.event.global[ type ] = true;\n\t\t}\n\n\t},\n\n\t// Detach an event or set of events from an element\n\tremove: function( elem, types, handler, selector, mappedTypes ) {\n\n\t\tvar j, origCount, tmp,\n\t\t\tevents, t, handleObj,\n\t\t\tspecial, handlers, type, namespaces, origType,\n\t\t\telemData = dataPriv.hasData( elem ) && dataPriv.get( elem );\n\n\t\tif ( !elemData || !( events = elemData.events ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Once for each type.namespace in types; type may be omitted\n\t\ttypes = ( types || \"\" ).match( rnothtmlwhite ) || [ \"\" ];\n\t\tt = types.length;\n\t\twhile ( t-- ) {\n\t\t\ttmp = rtypenamespace.exec( types[ t ] ) || [];\n\t\t\ttype = origType = tmp[ 1 ];\n\t\t\tnamespaces = ( tmp[ 2 ] || \"\" ).split( \".\" ).sort();\n\n\t\t\t// Unbind all events (on this namespace, if provided) for the element\n\t\t\tif ( !type ) {\n\t\t\t\tfor ( type in events ) {\n\t\t\t\t\tjQuery.event.remove( elem, type + types[ t ], handler, selector, true );\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\t\t\ttype = ( selector ? special.delegateType : special.bindType ) || type;\n\t\t\thandlers = events[ type ] || [];\n\t\t\ttmp = tmp[ 2 ] &&\n\t\t\t\tnew RegExp( \"(^|\\\\.)\" + namespaces.join( \"\\\\.(?:.*\\\\.|)\" ) + \"(\\\\.|$)\" );\n\n\t\t\t// Remove matching events\n\t\t\torigCount = j = handlers.length;\n\t\t\twhile ( j-- ) {\n\t\t\t\thandleObj = handlers[ j ];\n\n\t\t\t\tif ( ( mappedTypes || origType === handleObj.origType ) &&\n\t\t\t\t\t( !handler || handler.guid === handleObj.guid ) &&\n\t\t\t\t\t( !tmp || tmp.test( handleObj.namespace ) ) &&\n\t\t\t\t\t( !selector || selector === handleObj.selector ||\n\t\t\t\t\t\tselector === \"**\" && handleObj.selector ) ) {\n\t\t\t\t\thandlers.splice( j, 1 );\n\n\t\t\t\t\tif ( handleObj.selector ) {\n\t\t\t\t\t\thandlers.delegateCount--;\n\t\t\t\t\t}\n\t\t\t\t\tif ( special.remove ) {\n\t\t\t\t\t\tspecial.remove.call( elem, handleObj );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Remove generic event handler if we removed something and no more handlers exist\n\t\t\t// (avoids potential for endless recursion during removal of special event handlers)\n\t\t\tif ( origCount && !handlers.length ) {\n\t\t\t\tif ( !special.teardown ||\n\t\t\t\t\tspecial.teardown.call( elem, namespaces, elemData.handle ) === false ) {\n\n\t\t\t\t\tjQuery.removeEvent( elem, type, elemData.handle );\n\t\t\t\t}\n\n\t\t\t\tdelete events[ type ];\n\t\t\t}\n\t\t}\n\n\t\t// Remove data and the expando if it's no longer used\n\t\tif ( jQuery.isEmptyObject( events ) ) {\n\t\t\tdataPriv.remove( elem, \"handle events\" );\n\t\t}\n\t},\n\n\tdispatch: function( nativeEvent ) {\n\n\t\t// Make a writable jQuery.Event from the native event object\n\t\tvar event = jQuery.event.fix( nativeEvent );\n\n\t\tvar i, j, ret, matched, handleObj, handlerQueue,\n\t\t\targs = new Array( arguments.length ),\n\t\t\thandlers = ( dataPriv.get( this, \"events\" ) || {} )[ event.type ] || [],\n\t\t\tspecial = jQuery.event.special[ event.type ] || {};\n\n\t\t// Use the fix-ed jQuery.Event rather than the (read-only) native event\n\t\targs[ 0 ] = event;\n\n\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\n\t\tevent.delegateTarget = this;\n\n\t\t// Call the preDispatch hook for the mapped type, and let it bail if desired\n\t\tif ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Determine handlers\n\t\thandlerQueue = jQuery.event.handlers.call( this, event, handlers );\n\n\t\t// Run delegates first; they may want to stop propagation beneath us\n\t\ti = 0;\n\t\twhile ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {\n\t\t\tevent.currentTarget = matched.elem;\n\n\t\t\tj = 0;\n\t\t\twhile ( ( handleObj = matched.handlers[ j++ ] ) &&\n\t\t\t\t!event.isImmediatePropagationStopped() ) {\n\n\t\t\t\t// Triggered event must either 1) have no namespace, or 2) have namespace(s)\n\t\t\t\t// a subset or equal to those in the bound event (both can have no namespace).\n\t\t\t\tif ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {\n\n\t\t\t\t\tevent.handleObj = handleObj;\n\t\t\t\t\tevent.data = handleObj.data;\n\n\t\t\t\t\tret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||\n\t\t\t\t\t\thandleObj.handler ).apply( matched.elem, args );\n\n\t\t\t\t\tif ( ret !== undefined ) {\n\t\t\t\t\t\tif ( ( event.result = ret ) === false ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Call the postDispatch hook for the mapped type\n\t\tif ( special.postDispatch ) {\n\t\t\tspecial.postDispatch.call( this, event );\n\t\t}\n\n\t\treturn event.result;\n\t},\n\n\thandlers: function( event, handlers ) {\n\t\tvar i, handleObj, sel, matchedHandlers, matchedSelectors,\n\t\t\thandlerQueue = [],\n\t\t\tdelegateCount = handlers.delegateCount,\n\t\t\tcur = event.target;\n\n\t\t// Find delegate handlers\n\t\tif ( delegateCount &&\n\n\t\t\t// Support: IE <=9\n\t\t\t// Black-hole SVG <use> instance trees (trac-13180)\n\t\t\tcur.nodeType &&\n\n\t\t\t// Support: Firefox <=42\n\t\t\t// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)\n\t\t\t// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click\n\t\t\t// Support: IE 11 only\n\t\t\t// ...but not arrow key \"clicks\" of radio inputs, which can have `button` -1 (gh-2343)\n\t\t\t!( event.type === \"click\" && event.button >= 1 ) ) {\n\n\t\t\tfor ( ; cur !== this; cur = cur.parentNode || this ) {\n\n\t\t\t\t// Don't check non-elements (#13208)\n\t\t\t\t// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)\n\t\t\t\tif ( cur.nodeType === 1 && !( event.type === \"click\" && cur.disabled === true ) ) {\n\t\t\t\t\tmatchedHandlers = [];\n\t\t\t\t\tmatchedSelectors = {};\n\t\t\t\t\tfor ( i = 0; i < delegateCount; i++ ) {\n\t\t\t\t\t\thandleObj = handlers[ i ];\n\n\t\t\t\t\t\t// Don't conflict with Object.prototype properties (#13203)\n\t\t\t\t\t\tsel = handleObj.selector + \" \";\n\n\t\t\t\t\t\tif ( matchedSelectors[ sel ] === undefined ) {\n\t\t\t\t\t\t\tmatchedSelectors[ sel ] = handleObj.needsContext ?\n\t\t\t\t\t\t\t\tjQuery( sel, this ).index( cur ) > -1 :\n\t\t\t\t\t\t\t\tjQuery.find( sel, this, null, [ cur ] ).length;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( matchedSelectors[ sel ] ) {\n\t\t\t\t\t\t\tmatchedHandlers.push( handleObj );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ( matchedHandlers.length ) {\n\t\t\t\t\t\thandlerQueue.push( { elem: cur, handlers: matchedHandlers } );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Add the remaining (directly-bound) handlers\n\t\tcur = this;\n\t\tif ( delegateCount < handlers.length ) {\n\t\t\thandlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );\n\t\t}\n\n\t\treturn handlerQueue;\n\t},\n\n\taddProp: function( name, hook ) {\n\t\tObject.defineProperty( jQuery.Event.prototype, name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\n\t\t\tget: jQuery.isFunction( hook ) ?\n\t\t\t\tfunction() {\n\t\t\t\t\tif ( this.originalEvent ) {\n\t\t\t\t\t\t\treturn hook( this.originalEvent );\n\t\t\t\t\t}\n\t\t\t\t} :\n\t\t\t\tfunction() {\n\t\t\t\t\tif ( this.originalEvent ) {\n\t\t\t\t\t\t\treturn this.originalEvent[ name ];\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\tset: function( value ) {\n\t\t\t\tObject.defineProperty( this, name, {\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\twritable: true,\n\t\t\t\t\tvalue: value\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t},\n\n\tfix: function( originalEvent ) {\n\t\treturn originalEvent[ jQuery.expando ] ?\n\t\t\toriginalEvent :\n\t\t\tnew jQuery.Event( originalEvent );\n\t},\n\n\tspecial: {\n\t\tload: {\n\n\t\t\t// Prevent triggered image.load events from bubbling to window.load\n\t\t\tnoBubble: true\n\t\t},\n\t\tfocus: {\n\n\t\t\t// Fire native event if possible so blur/focus sequence is correct\n\t\t\ttrigger: function() {\n\t\t\t\tif ( this !== safeActiveElement() && this.focus ) {\n\t\t\t\t\tthis.focus();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\t\t\tdelegateType: \"focusin\"\n\t\t},\n\t\tblur: {\n\t\t\ttrigger: function() {\n\t\t\t\tif ( this === safeActiveElement() && this.blur ) {\n\t\t\t\t\tthis.blur();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\t\t\tdelegateType: \"focusout\"\n\t\t},\n\t\tclick: {\n\n\t\t\t// For checkbox, fire native event so checked state will be right\n\t\t\ttrigger: function() {\n\t\t\t\tif ( this.type === \"checkbox\" && this.click && jQuery.nodeName( this, \"input\" ) ) {\n\t\t\t\t\tthis.click();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\n\t\t\t// For cross-browser consistency, don't fire native .click() on links\n\t\t\t_default: function( event ) {\n\t\t\t\treturn jQuery.nodeName( event.target, \"a\" );\n\t\t\t}\n\t\t},\n\n\t\tbeforeunload: {\n\t\t\tpostDispatch: function( event ) {\n\n\t\t\t\t// Support: Firefox 20+\n\t\t\t\t// Firefox doesn't alert if the returnValue field is not set.\n\t\t\t\tif ( event.result !== undefined && event.originalEvent ) {\n\t\t\t\t\tevent.originalEvent.returnValue = event.result;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\njQuery.removeEvent = function( elem, type, handle ) {\n\n\t// This \"if\" is needed for plain objects\n\tif ( elem.removeEventListener ) {\n\t\telem.removeEventListener( type, handle );\n\t}\n};\n\njQuery.Event = function( src, props ) {\n\n\t// Allow instantiation without the 'new' keyword\n\tif ( !( this instanceof jQuery.Event ) ) {\n\t\treturn new jQuery.Event( src, props );\n\t}\n\n\t// Event object\n\tif ( src && src.type ) {\n\t\tthis.originalEvent = src;\n\t\tthis.type = src.type;\n\n\t\t// Events bubbling up the document may have been marked as prevented\n\t\t// by a handler lower down the tree; reflect the correct value.\n\t\tthis.isDefaultPrevented = src.defaultPrevented ||\n\t\t\t\tsrc.defaultPrevented === undefined &&\n\n\t\t\t\t// Support: Android <=2.3 only\n\t\t\t\tsrc.returnValue === false ?\n\t\t\treturnTrue :\n\t\t\treturnFalse;\n\n\t\t// Create target properties\n\t\t// Support: Safari <=6 - 7 only\n\t\t// Target should not be a text node (#504, #13143)\n\t\tthis.target = ( src.target && src.target.nodeType === 3 ) ?\n\t\t\tsrc.target.parentNode :\n\t\t\tsrc.target;\n\n\t\tthis.currentTarget = src.currentTarget;\n\t\tthis.relatedTarget = src.relatedTarget;\n\n\t// Event type\n\t} else {\n\t\tthis.type = src;\n\t}\n\n\t// Put explicitly provided properties onto the event object\n\tif ( props ) {\n\t\tjQuery.extend( this, props );\n\t}\n\n\t// Create a timestamp if incoming event doesn't have one\n\tthis.timeStamp = src && src.timeStamp || jQuery.now();\n\n\t// Mark it as fixed\n\tthis[ jQuery.expando ] = true;\n};\n\n// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding\n// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html\njQuery.Event.prototype = {\n\tconstructor: jQuery.Event,\n\tisDefaultPrevented: returnFalse,\n\tisPropagationStopped: returnFalse,\n\tisImmediatePropagationStopped: returnFalse,\n\tisSimulated: false,\n\n\tpreventDefault: function() {\n\t\tvar e = this.originalEvent;\n\n\t\tthis.isDefaultPrevented = returnTrue;\n\n\t\tif ( e && !this.isSimulated ) {\n\t\t\te.preventDefault();\n\t\t}\n\t},\n\tstopPropagation: function() {\n\t\tvar e = this.originalEvent;\n\n\t\tthis.isPropagationStopped = returnTrue;\n\n\t\tif ( e && !this.isSimulated ) {\n\t\t\te.stopPropagation();\n\t\t}\n\t},\n\tstopImmediatePropagation: function() {\n\t\tvar e = this.originalEvent;\n\n\t\tthis.isImmediatePropagationStopped = returnTrue;\n\n\t\tif ( e && !this.isSimulated ) {\n\t\t\te.stopImmediatePropagation();\n\t\t}\n\n\t\tthis.stopPropagation();\n\t}\n};\n\n// Includes all common event props including KeyEvent and MouseEvent specific props\njQuery.each( {\n\taltKey: true,\n\tbubbles: true,\n\tcancelable: true,\n\tchangedTouches: true,\n\tctrlKey: true,\n\tdetail: true,\n\teventPhase: true,\n\tmetaKey: true,\n\tpageX: true,\n\tpageY: true,\n\tshiftKey: true,\n\tview: true,\n\t\"char\": true,\n\tcharCode: true,\n\tkey: true,\n\tkeyCode: true,\n\tbutton: true,\n\tbuttons: true,\n\tclientX: true,\n\tclientY: true,\n\toffsetX: true,\n\toffsetY: true,\n\tpointerId: true,\n\tpointerType: true,\n\tscreenX: true,\n\tscreenY: true,\n\ttargetTouches: true,\n\ttoElement: true,\n\ttouches: true,\n\n\twhich: function( event ) {\n\t\tvar button = event.button;\n\n\t\t// Add which for key events\n\t\tif ( event.which == null && rkeyEvent.test( event.type ) ) {\n\t\t\treturn event.charCode != null ? event.charCode : event.keyCode;\n\t\t}\n\n\t\t// Add which for click: 1 === left; 2 === middle; 3 === right\n\t\tif ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {\n\t\t\tif ( button & 1 ) {\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\tif ( button & 2 ) {\n\t\t\t\treturn 3;\n\t\t\t}\n\n\t\t\tif ( button & 4 ) {\n\t\t\t\treturn 2;\n\t\t\t}\n\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn event.which;\n\t}\n}, jQuery.event.addProp );\n\n// Create mouseenter/leave events using mouseover/out and event-time checks\n// so that event delegation works in jQuery.\n// Do the same for pointerenter/pointerleave and pointerover/pointerout\n//\n// Support: Safari 7 only\n// Safari sends mouseenter too often; see:\n// https://bugs.chromium.org/p/chromium/issues/detail?id=470258\n// for the description of the bug (it existed in older Chrome versions as well).\njQuery.each( {\n\tmouseenter: \"mouseover\",\n\tmouseleave: \"mouseout\",\n\tpointerenter: \"pointerover\",\n\tpointerleave: \"pointerout\"\n}, function( orig, fix ) {\n\tjQuery.event.special[ orig ] = {\n\t\tdelegateType: fix,\n\t\tbindType: fix,\n\n\t\thandle: function( event ) {\n\t\t\tvar ret,\n\t\t\t\ttarget = this,\n\t\t\t\trelated = event.relatedTarget,\n\t\t\t\thandleObj = event.handleObj;\n\n\t\t\t// For mouseenter/leave call the handler if related is outside the target.\n\t\t\t// NB: No relatedTarget if the mouse left/entered the browser window\n\t\t\tif ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {\n\t\t\t\tevent.type = handleObj.origType;\n\t\t\t\tret = handleObj.handler.apply( this, arguments );\n\t\t\t\tevent.type = fix;\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\t};\n} );\n\njQuery.fn.extend( {\n\n\ton: function( types, selector, data, fn ) {\n\t\treturn on( this, types, selector, data, fn );\n\t},\n\tone: function( types, selector, data, fn ) {\n\t\treturn on( this, types, selector, data, fn, 1 );\n\t},\n\toff: function( types, selector, fn ) {\n\t\tvar handleObj, type;\n\t\tif ( types && types.preventDefault && types.handleObj ) {\n\n\t\t\t// ( event )  dispatched jQuery.Event\n\t\t\thandleObj = types.handleObj;\n\t\t\tjQuery( types.delegateTarget ).off(\n\t\t\t\thandleObj.namespace ?\n\t\t\t\t\thandleObj.origType + \".\" + handleObj.namespace :\n\t\t\t\t\thandleObj.origType,\n\t\t\t\thandleObj.selector,\n\t\t\t\thandleObj.handler\n\t\t\t);\n\t\t\treturn this;\n\t\t}\n\t\tif ( typeof types === \"object\" ) {\n\n\t\t\t// ( types-object [, selector] )\n\t\t\tfor ( type in types ) {\n\t\t\t\tthis.off( type, selector, types[ type ] );\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\t\tif ( selector === false || typeof selector === \"function\" ) {\n\n\t\t\t// ( types [, fn] )\n\t\t\tfn = selector;\n\t\t\tselector = undefined;\n\t\t}\n\t\tif ( fn === false ) {\n\t\t\tfn = returnFalse;\n\t\t}\n\t\treturn this.each( function() {\n\t\t\tjQuery.event.remove( this, types, fn, selector );\n\t\t} );\n\t}\n} );\n\n\nvar\n\n\t/* eslint-disable max-len */\n\n\t// See https://github.com/eslint/eslint/issues/3229\n\trxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]*)[^>]*)\\/>/gi,\n\n\t/* eslint-enable */\n\n\t// Support: IE <=10 - 11, Edge 12 - 13\n\t// In IE/Edge using regex groups here causes severe slowdowns.\n\t// See https://connect.microsoft.com/IE/feedback/details/1736512/\n\trnoInnerhtml = /<script|<style|<link/i,\n\n\t// checked=\"checked\" or checked\n\trchecked = /checked\\s*(?:[^=]|=\\s*.checked.)/i,\n\trscriptTypeMasked = /^true\\/(.*)/,\n\trcleanScript = /^\\s*<!(?:\\[CDATA\\[|--)|(?:\\]\\]|--)>\\s*$/g;\n\nfunction manipulationTarget( elem, content ) {\n\tif ( jQuery.nodeName( elem, \"table\" ) &&\n\t\tjQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, \"tr\" ) ) {\n\n\t\treturn elem.getElementsByTagName( \"tbody\" )[ 0 ] || elem;\n\t}\n\n\treturn elem;\n}\n\n// Replace/restore the type attribute of script elements for safe DOM manipulation\nfunction disableScript( elem ) {\n\telem.type = ( elem.getAttribute( \"type\" ) !== null ) + \"/\" + elem.type;\n\treturn elem;\n}\nfunction restoreScript( elem ) {\n\tvar match = rscriptTypeMasked.exec( elem.type );\n\n\tif ( match ) {\n\t\telem.type = match[ 1 ];\n\t} else {\n\t\telem.removeAttribute( \"type\" );\n\t}\n\n\treturn elem;\n}\n\nfunction cloneCopyEvent( src, dest ) {\n\tvar i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;\n\n\tif ( dest.nodeType !== 1 ) {\n\t\treturn;\n\t}\n\n\t// 1. Copy private data: events, handlers, etc.\n\tif ( dataPriv.hasData( src ) ) {\n\t\tpdataOld = dataPriv.access( src );\n\t\tpdataCur = dataPriv.set( dest, pdataOld );\n\t\tevents = pdataOld.events;\n\n\t\tif ( events ) {\n\t\t\tdelete pdataCur.handle;\n\t\t\tpdataCur.events = {};\n\n\t\t\tfor ( type in events ) {\n\t\t\t\tfor ( i = 0, l = events[ type ].length; i < l; i++ ) {\n\t\t\t\t\tjQuery.event.add( dest, type, events[ type ][ i ] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// 2. Copy user data\n\tif ( dataUser.hasData( src ) ) {\n\t\tudataOld = dataUser.access( src );\n\t\tudataCur = jQuery.extend( {}, udataOld );\n\n\t\tdataUser.set( dest, udataCur );\n\t}\n}\n\n// Fix IE bugs, see support tests\nfunction fixInput( src, dest ) {\n\tvar nodeName = dest.nodeName.toLowerCase();\n\n\t// Fails to persist the checked state of a cloned checkbox or radio button.\n\tif ( nodeName === \"input\" && rcheckableType.test( src.type ) ) {\n\t\tdest.checked = src.checked;\n\n\t// Fails to return the selected option to the default selected state when cloning options\n\t} else if ( nodeName === \"input\" || nodeName === \"textarea\" ) {\n\t\tdest.defaultValue = src.defaultValue;\n\t}\n}\n\nfunction domManip( collection, args, callback, ignored ) {\n\n\t// Flatten any nested arrays\n\targs = concat.apply( [], args );\n\n\tvar fragment, first, scripts, hasScripts, node, doc,\n\t\ti = 0,\n\t\tl = collection.length,\n\t\tiNoClone = l - 1,\n\t\tvalue = args[ 0 ],\n\t\tisFunction = jQuery.isFunction( value );\n\n\t// We can't cloneNode fragments that contain checked, in WebKit\n\tif ( isFunction ||\n\t\t\t( l > 1 && typeof value === \"string\" &&\n\t\t\t\t!support.checkClone && rchecked.test( value ) ) ) {\n\t\treturn collection.each( function( index ) {\n\t\t\tvar self = collection.eq( index );\n\t\t\tif ( isFunction ) {\n\t\t\t\targs[ 0 ] = value.call( this, index, self.html() );\n\t\t\t}\n\t\t\tdomManip( self, args, callback, ignored );\n\t\t} );\n\t}\n\n\tif ( l ) {\n\t\tfragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );\n\t\tfirst = fragment.firstChild;\n\n\t\tif ( fragment.childNodes.length === 1 ) {\n\t\t\tfragment = first;\n\t\t}\n\n\t\t// Require either new content or an interest in ignored elements to invoke the callback\n\t\tif ( first || ignored ) {\n\t\t\tscripts = jQuery.map( getAll( fragment, \"script\" ), disableScript );\n\t\t\thasScripts = scripts.length;\n\n\t\t\t// Use the original fragment for the last item\n\t\t\t// instead of the first because it can end up\n\t\t\t// being emptied incorrectly in certain situations (#8070).\n\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\tnode = fragment;\n\n\t\t\t\tif ( i !== iNoClone ) {\n\t\t\t\t\tnode = jQuery.clone( node, true, true );\n\n\t\t\t\t\t// Keep references to cloned scripts for later restoration\n\t\t\t\t\tif ( hasScripts ) {\n\n\t\t\t\t\t\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t\t\t\t\t\t// push.apply(_, arraylike) throws on ancient WebKit\n\t\t\t\t\t\tjQuery.merge( scripts, getAll( node, \"script\" ) );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcallback.call( collection[ i ], node, i );\n\t\t\t}\n\n\t\t\tif ( hasScripts ) {\n\t\t\t\tdoc = scripts[ scripts.length - 1 ].ownerDocument;\n\n\t\t\t\t// Reenable scripts\n\t\t\t\tjQuery.map( scripts, restoreScript );\n\n\t\t\t\t// Evaluate executable scripts on first document insertion\n\t\t\t\tfor ( i = 0; i < hasScripts; i++ ) {\n\t\t\t\t\tnode = scripts[ i ];\n\t\t\t\t\tif ( rscriptType.test( node.type || \"\" ) &&\n\t\t\t\t\t\t!dataPriv.access( node, \"globalEval\" ) &&\n\t\t\t\t\t\tjQuery.contains( doc, node ) ) {\n\n\t\t\t\t\t\tif ( node.src ) {\n\n\t\t\t\t\t\t\t// Optional AJAX dependency, but won't run scripts if not present\n\t\t\t\t\t\t\tif ( jQuery._evalUrl ) {\n\t\t\t\t\t\t\t\tjQuery._evalUrl( node.src );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tDOMEval( node.textContent.replace( rcleanScript, \"\" ), doc );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn collection;\n}\n\nfunction remove( elem, selector, keepData ) {\n\tvar node,\n\t\tnodes = selector ? jQuery.filter( selector, elem ) : elem,\n\t\ti = 0;\n\n\tfor ( ; ( node = nodes[ i ] ) != null; i++ ) {\n\t\tif ( !keepData && node.nodeType === 1 ) {\n\t\t\tjQuery.cleanData( getAll( node ) );\n\t\t}\n\n\t\tif ( node.parentNode ) {\n\t\t\tif ( keepData && jQuery.contains( node.ownerDocument, node ) ) {\n\t\t\t\tsetGlobalEval( getAll( node, \"script\" ) );\n\t\t\t}\n\t\t\tnode.parentNode.removeChild( node );\n\t\t}\n\t}\n\n\treturn elem;\n}\n\njQuery.extend( {\n\thtmlPrefilter: function( html ) {\n\t\treturn html.replace( rxhtmlTag, \"<$1></$2>\" );\n\t},\n\n\tclone: function( elem, dataAndEvents, deepDataAndEvents ) {\n\t\tvar i, l, srcElements, destElements,\n\t\t\tclone = elem.cloneNode( true ),\n\t\t\tinPage = jQuery.contains( elem.ownerDocument, elem );\n\n\t\t// Fix IE cloning issues\n\t\tif ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&\n\t\t\t\t!jQuery.isXMLDoc( elem ) ) {\n\n\t\t\t// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2\n\t\t\tdestElements = getAll( clone );\n\t\t\tsrcElements = getAll( elem );\n\n\t\t\tfor ( i = 0, l = srcElements.length; i < l; i++ ) {\n\t\t\t\tfixInput( srcElements[ i ], destElements[ i ] );\n\t\t\t}\n\t\t}\n\n\t\t// Copy the events from the original to the clone\n\t\tif ( dataAndEvents ) {\n\t\t\tif ( deepDataAndEvents ) {\n\t\t\t\tsrcElements = srcElements || getAll( elem );\n\t\t\t\tdestElements = destElements || getAll( clone );\n\n\t\t\t\tfor ( i = 0, l = srcElements.length; i < l; i++ ) {\n\t\t\t\t\tcloneCopyEvent( srcElements[ i ], destElements[ i ] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcloneCopyEvent( elem, clone );\n\t\t\t}\n\t\t}\n\n\t\t// Preserve script evaluation history\n\t\tdestElements = getAll( clone, \"script\" );\n\t\tif ( destElements.length > 0 ) {\n\t\t\tsetGlobalEval( destElements, !inPage && getAll( elem, \"script\" ) );\n\t\t}\n\n\t\t// Return the cloned set\n\t\treturn clone;\n\t},\n\n\tcleanData: function( elems ) {\n\t\tvar data, elem, type,\n\t\t\tspecial = jQuery.event.special,\n\t\t\ti = 0;\n\n\t\tfor ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {\n\t\t\tif ( acceptData( elem ) ) {\n\t\t\t\tif ( ( data = elem[ dataPriv.expando ] ) ) {\n\t\t\t\t\tif ( data.events ) {\n\t\t\t\t\t\tfor ( type in data.events ) {\n\t\t\t\t\t\t\tif ( special[ type ] ) {\n\t\t\t\t\t\t\t\tjQuery.event.remove( elem, type );\n\n\t\t\t\t\t\t\t// This is a shortcut to avoid jQuery.event.remove's overhead\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tjQuery.removeEvent( elem, type, data.handle );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Support: Chrome <=35 - 45+\n\t\t\t\t\t// Assign undefined instead of using delete, see Data#remove\n\t\t\t\t\telem[ dataPriv.expando ] = undefined;\n\t\t\t\t}\n\t\t\t\tif ( elem[ dataUser.expando ] ) {\n\n\t\t\t\t\t// Support: Chrome <=35 - 45+\n\t\t\t\t\t// Assign undefined instead of using delete, see Data#remove\n\t\t\t\t\telem[ dataUser.expando ] = undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n} );\n\njQuery.fn.extend( {\n\tdetach: function( selector ) {\n\t\treturn remove( this, selector, true );\n\t},\n\n\tremove: function( selector ) {\n\t\treturn remove( this, selector );\n\t},\n\n\ttext: function( value ) {\n\t\treturn access( this, function( value ) {\n\t\t\treturn value === undefined ?\n\t\t\t\tjQuery.text( this ) :\n\t\t\t\tthis.empty().each( function() {\n\t\t\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {\n\t\t\t\t\t\tthis.textContent = value;\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t}, null, value, arguments.length );\n\t},\n\n\tappend: function() {\n\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {\n\t\t\t\tvar target = manipulationTarget( this, elem );\n\t\t\t\ttarget.appendChild( elem );\n\t\t\t}\n\t\t} );\n\t},\n\n\tprepend: function() {\n\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {\n\t\t\t\tvar target = manipulationTarget( this, elem );\n\t\t\t\ttarget.insertBefore( elem, target.firstChild );\n\t\t\t}\n\t\t} );\n\t},\n\n\tbefore: function() {\n\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\tif ( this.parentNode ) {\n\t\t\t\tthis.parentNode.insertBefore( elem, this );\n\t\t\t}\n\t\t} );\n\t},\n\n\tafter: function() {\n\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\tif ( this.parentNode ) {\n\t\t\t\tthis.parentNode.insertBefore( elem, this.nextSibling );\n\t\t\t}\n\t\t} );\n\t},\n\n\tempty: function() {\n\t\tvar elem,\n\t\t\ti = 0;\n\n\t\tfor ( ; ( elem = this[ i ] ) != null; i++ ) {\n\t\t\tif ( elem.nodeType === 1 ) {\n\n\t\t\t\t// Prevent memory leaks\n\t\t\t\tjQuery.cleanData( getAll( elem, false ) );\n\n\t\t\t\t// Remove any remaining nodes\n\t\t\t\telem.textContent = \"\";\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tclone: function( dataAndEvents, deepDataAndEvents ) {\n\t\tdataAndEvents = dataAndEvents == null ? false : dataAndEvents;\n\t\tdeepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;\n\n\t\treturn this.map( function() {\n\t\t\treturn jQuery.clone( this, dataAndEvents, deepDataAndEvents );\n\t\t} );\n\t},\n\n\thtml: function( value ) {\n\t\treturn access( this, function( value ) {\n\t\t\tvar elem = this[ 0 ] || {},\n\t\t\t\ti = 0,\n\t\t\t\tl = this.length;\n\n\t\t\tif ( value === undefined && elem.nodeType === 1 ) {\n\t\t\t\treturn elem.innerHTML;\n\t\t\t}\n\n\t\t\t// See if we can take a shortcut and just use innerHTML\n\t\t\tif ( typeof value === \"string\" && !rnoInnerhtml.test( value ) &&\n\t\t\t\t!wrapMap[ ( rtagName.exec( value ) || [ \"\", \"\" ] )[ 1 ].toLowerCase() ] ) {\n\n\t\t\t\tvalue = jQuery.htmlPrefilter( value );\n\n\t\t\t\ttry {\n\t\t\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\t\t\telem = this[ i ] || {};\n\n\t\t\t\t\t\t// Remove element nodes and prevent memory leaks\n\t\t\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\t\t\tjQuery.cleanData( getAll( elem, false ) );\n\t\t\t\t\t\t\telem.innerHTML = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\telem = 0;\n\n\t\t\t\t// If using innerHTML throws an exception, use the fallback method\n\t\t\t\t} catch ( e ) {}\n\t\t\t}\n\n\t\t\tif ( elem ) {\n\t\t\t\tthis.empty().append( value );\n\t\t\t}\n\t\t}, null, value, arguments.length );\n\t},\n\n\treplaceWith: function() {\n\t\tvar ignored = [];\n\n\t\t// Make the changes, replacing each non-ignored context element with the new content\n\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\tvar parent = this.parentNode;\n\n\t\t\tif ( jQuery.inArray( this, ignored ) < 0 ) {\n\t\t\t\tjQuery.cleanData( getAll( this ) );\n\t\t\t\tif ( parent ) {\n\t\t\t\t\tparent.replaceChild( elem, this );\n\t\t\t\t}\n\t\t\t}\n\n\t\t// Force callback invocation\n\t\t}, ignored );\n\t}\n} );\n\njQuery.each( {\n\tappendTo: \"append\",\n\tprependTo: \"prepend\",\n\tinsertBefore: \"before\",\n\tinsertAfter: \"after\",\n\treplaceAll: \"replaceWith\"\n}, function( name, original ) {\n\tjQuery.fn[ name ] = function( selector ) {\n\t\tvar elems,\n\t\t\tret = [],\n\t\t\tinsert = jQuery( selector ),\n\t\t\tlast = insert.length - 1,\n\t\t\ti = 0;\n\n\t\tfor ( ; i <= last; i++ ) {\n\t\t\telems = i === last ? this : this.clone( true );\n\t\t\tjQuery( insert[ i ] )[ original ]( elems );\n\n\t\t\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t\t\t// .get() because push.apply(_, arraylike) throws on ancient WebKit\n\t\t\tpush.apply( ret, elems.get() );\n\t\t}\n\n\t\treturn this.pushStack( ret );\n\t};\n} );\nvar rmargin = ( /^margin/ );\n\nvar rnumnonpx = new RegExp( \"^(\" + pnum + \")(?!px)[a-z%]+$\", \"i\" );\n\nvar getStyles = function( elem ) {\n\n\t\t// Support: IE <=11 only, Firefox <=30 (#15098, #14150)\n\t\t// IE throws on elements created in popups\n\t\t// FF meanwhile throws on frame elements through \"defaultView.getComputedStyle\"\n\t\tvar view = elem.ownerDocument.defaultView;\n\n\t\tif ( !view || !view.opener ) {\n\t\t\tview = window;\n\t\t}\n\n\t\treturn view.getComputedStyle( elem );\n\t};\n\n\n\n( function() {\n\n\t// Executing both pixelPosition & boxSizingReliable tests require only one layout\n\t// so they're executed at the same time to save the second computation.\n\tfunction computeStyleTests() {\n\n\t\t// This is a singleton, we need to execute it only once\n\t\tif ( !div ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdiv.style.cssText =\n\t\t\t\"box-sizing:border-box;\" +\n\t\t\t\"position:relative;display:block;\" +\n\t\t\t\"margin:auto;border:1px;padding:1px;\" +\n\t\t\t\"top:1%;width:50%\";\n\t\tdiv.innerHTML = \"\";\n\t\tdocumentElement.appendChild( container );\n\n\t\tvar divStyle = window.getComputedStyle( div );\n\t\tpixelPositionVal = divStyle.top !== \"1%\";\n\n\t\t// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44\n\t\treliableMarginLeftVal = divStyle.marginLeft === \"2px\";\n\t\tboxSizingReliableVal = divStyle.width === \"4px\";\n\n\t\t// Support: Android 4.0 - 4.3 only\n\t\t// Some styles come back with percentage values, even though they shouldn't\n\t\tdiv.style.marginRight = \"50%\";\n\t\tpixelMarginRightVal = divStyle.marginRight === \"4px\";\n\n\t\tdocumentElement.removeChild( container );\n\n\t\t// Nullify the div so it wouldn't be stored in the memory and\n\t\t// it will also be a sign that checks already performed\n\t\tdiv = null;\n\t}\n\n\tvar pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,\n\t\tcontainer = document.createElement( \"div\" ),\n\t\tdiv = document.createElement( \"div\" );\n\n\t// Finish early in limited (non-browser) environments\n\tif ( !div.style ) {\n\t\treturn;\n\t}\n\n\t// Support: IE <=9 - 11 only\n\t// Style of cloned element affects source element cloned (#8908)\n\tdiv.style.backgroundClip = \"content-box\";\n\tdiv.cloneNode( true ).style.backgroundClip = \"\";\n\tsupport.clearCloneStyle = div.style.backgroundClip === \"content-box\";\n\n\tcontainer.style.cssText = \"border:0;width:8px;height:0;top:0;left:-9999px;\" +\n\t\t\"padding:0;margin-top:1px;position:absolute\";\n\tcontainer.appendChild( div );\n\n\tjQuery.extend( support, {\n\t\tpixelPosition: function() {\n\t\t\tcomputeStyleTests();\n\t\t\treturn pixelPositionVal;\n\t\t},\n\t\tboxSizingReliable: function() {\n\t\t\tcomputeStyleTests();\n\t\t\treturn boxSizingReliableVal;\n\t\t},\n\t\tpixelMarginRight: function() {\n\t\t\tcomputeStyleTests();\n\t\t\treturn pixelMarginRightVal;\n\t\t},\n\t\treliableMarginLeft: function() {\n\t\t\tcomputeStyleTests();\n\t\t\treturn reliableMarginLeftVal;\n\t\t}\n\t} );\n} )();\n\n\nfunction curCSS( elem, name, computed ) {\n\tvar width, minWidth, maxWidth, ret,\n\t\tstyle = elem.style;\n\n\tcomputed = computed || getStyles( elem );\n\n\t// Support: IE <=9 only\n\t// getPropertyValue is only needed for .css('filter') (#12537)\n\tif ( computed ) {\n\t\tret = computed.getPropertyValue( name ) || computed[ name ];\n\n\t\tif ( ret === \"\" && !jQuery.contains( elem.ownerDocument, elem ) ) {\n\t\t\tret = jQuery.style( elem, name );\n\t\t}\n\n\t\t// A tribute to the \"awesome hack by Dean Edwards\"\n\t\t// Android Browser returns percentage for some values,\n\t\t// but width seems to be reliably pixels.\n\t\t// This is against the CSSOM draft spec:\n\t\t// https://drafts.csswg.org/cssom/#resolved-values\n\t\tif ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {\n\n\t\t\t// Remember the original values\n\t\t\twidth = style.width;\n\t\t\tminWidth = style.minWidth;\n\t\t\tmaxWidth = style.maxWidth;\n\n\t\t\t// Put in the new values to get a computed value out\n\t\t\tstyle.minWidth = style.maxWidth = style.width = ret;\n\t\t\tret = computed.width;\n\n\t\t\t// Revert the changed values\n\t\t\tstyle.width = width;\n\t\t\tstyle.minWidth = minWidth;\n\t\t\tstyle.maxWidth = maxWidth;\n\t\t}\n\t}\n\n\treturn ret !== undefined ?\n\n\t\t// Support: IE <=9 - 11 only\n\t\t// IE returns zIndex value as an integer.\n\t\tret + \"\" :\n\t\tret;\n}\n\n\nfunction addGetHookIf( conditionFn, hookFn ) {\n\n\t// Define the hook, we'll check on the first run if it's really needed.\n\treturn {\n\t\tget: function() {\n\t\t\tif ( conditionFn() ) {\n\n\t\t\t\t// Hook not needed (or it's not possible to use it due\n\t\t\t\t// to missing dependency), remove it.\n\t\t\t\tdelete this.get;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Hook needed; redefine it so that the support test is not executed again.\n\t\t\treturn ( this.get = hookFn ).apply( this, arguments );\n\t\t}\n\t};\n}\n\n\nvar\n\n\t// Swappable if display is none or starts with table\n\t// except \"table\", \"table-cell\", or \"table-caption\"\n\t// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display\n\trdisplayswap = /^(none|table(?!-c[ea]).+)/,\n\tcssShow = { position: \"absolute\", visibility: \"hidden\", display: \"block\" },\n\tcssNormalTransform = {\n\t\tletterSpacing: \"0\",\n\t\tfontWeight: \"400\"\n\t},\n\n\tcssPrefixes = [ \"Webkit\", \"Moz\", \"ms\" ],\n\temptyStyle = document.createElement( \"div\" ).style;\n\n// Return a css property mapped to a potentially vendor prefixed property\nfunction vendorPropName( name ) {\n\n\t// Shortcut for names that are not vendor prefixed\n\tif ( name in emptyStyle ) {\n\t\treturn name;\n\t}\n\n\t// Check for vendor prefixed names\n\tvar capName = name[ 0 ].toUpperCase() + name.slice( 1 ),\n\t\ti = cssPrefixes.length;\n\n\twhile ( i-- ) {\n\t\tname = cssPrefixes[ i ] + capName;\n\t\tif ( name in emptyStyle ) {\n\t\t\treturn name;\n\t\t}\n\t}\n}\n\nfunction setPositiveNumber( elem, value, subtract ) {\n\n\t// Any relative (+/-) values have already been\n\t// normalized at this point\n\tvar matches = rcssNum.exec( value );\n\treturn matches ?\n\n\t\t// Guard against undefined \"subtract\", e.g., when used as in cssHooks\n\t\tMath.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || \"px\" ) :\n\t\tvalue;\n}\n\nfunction augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {\n\tvar i,\n\t\tval = 0;\n\n\t// If we already have the right measurement, avoid augmentation\n\tif ( extra === ( isBorderBox ? \"border\" : \"content\" ) ) {\n\t\ti = 4;\n\n\t// Otherwise initialize for horizontal or vertical properties\n\t} else {\n\t\ti = name === \"width\" ? 1 : 0;\n\t}\n\n\tfor ( ; i < 4; i += 2 ) {\n\n\t\t// Both box models exclude margin, so add it if we want it\n\t\tif ( extra === \"margin\" ) {\n\t\t\tval += jQuery.css( elem, extra + cssExpand[ i ], true, styles );\n\t\t}\n\n\t\tif ( isBorderBox ) {\n\n\t\t\t// border-box includes padding, so remove it if we want content\n\t\t\tif ( extra === \"content\" ) {\n\t\t\t\tval -= jQuery.css( elem, \"padding\" + cssExpand[ i ], true, styles );\n\t\t\t}\n\n\t\t\t// At this point, extra isn't border nor margin, so remove border\n\t\t\tif ( extra !== \"margin\" ) {\n\t\t\t\tval -= jQuery.css( elem, \"border\" + cssExpand[ i ] + \"Width\", true, styles );\n\t\t\t}\n\t\t} else {\n\n\t\t\t// At this point, extra isn't content, so add padding\n\t\t\tval += jQuery.css( elem, \"padding\" + cssExpand[ i ], true, styles );\n\n\t\t\t// At this point, extra isn't content nor padding, so add border\n\t\t\tif ( extra !== \"padding\" ) {\n\t\t\t\tval += jQuery.css( elem, \"border\" + cssExpand[ i ] + \"Width\", true, styles );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn val;\n}\n\nfunction getWidthOrHeight( elem, name, extra ) {\n\n\t// Start with offset property, which is equivalent to the border-box value\n\tvar val,\n\t\tvalueIsBorderBox = true,\n\t\tstyles = getStyles( elem ),\n\t\tisBorderBox = jQuery.css( elem, \"boxSizing\", false, styles ) === \"border-box\";\n\n\t// Support: IE <=11 only\n\t// Running getBoundingClientRect on a disconnected node\n\t// in IE throws an error.\n\tif ( elem.getClientRects().length ) {\n\t\tval = elem.getBoundingClientRect()[ name ];\n\t}\n\n\t// Some non-html elements return undefined for offsetWidth, so check for null/undefined\n\t// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285\n\t// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668\n\tif ( val <= 0 || val == null ) {\n\n\t\t// Fall back to computed then uncomputed css if necessary\n\t\tval = curCSS( elem, name, styles );\n\t\tif ( val < 0 || val == null ) {\n\t\t\tval = elem.style[ name ];\n\t\t}\n\n\t\t// Computed unit is not pixels. Stop here and return.\n\t\tif ( rnumnonpx.test( val ) ) {\n\t\t\treturn val;\n\t\t}\n\n\t\t// Check for style in case a browser which returns unreliable values\n\t\t// for getComputedStyle silently falls back to the reliable elem.style\n\t\tvalueIsBorderBox = isBorderBox &&\n\t\t\t( support.boxSizingReliable() || val === elem.style[ name ] );\n\n\t\t// Normalize \"\", auto, and prepare for extra\n\t\tval = parseFloat( val ) || 0;\n\t}\n\n\t// Use the active box-sizing model to add/subtract irrelevant styles\n\treturn ( val +\n\t\taugmentWidthOrHeight(\n\t\t\telem,\n\t\t\tname,\n\t\t\textra || ( isBorderBox ? \"border\" : \"content\" ),\n\t\t\tvalueIsBorderBox,\n\t\t\tstyles\n\t\t)\n\t) + \"px\";\n}\n\njQuery.extend( {\n\n\t// Add in style property hooks for overriding the default\n\t// behavior of getting and setting a style property\n\tcssHooks: {\n\t\topacity: {\n\t\t\tget: function( elem, computed ) {\n\t\t\t\tif ( computed ) {\n\n\t\t\t\t\t// We should always get a number back from opacity\n\t\t\t\t\tvar ret = curCSS( elem, \"opacity\" );\n\t\t\t\t\treturn ret === \"\" ? \"1\" : ret;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\t// Don't automatically add \"px\" to these possibly-unitless properties\n\tcssNumber: {\n\t\t\"animationIterationCount\": true,\n\t\t\"columnCount\": true,\n\t\t\"fillOpacity\": true,\n\t\t\"flexGrow\": true,\n\t\t\"flexShrink\": true,\n\t\t\"fontWeight\": true,\n\t\t\"lineHeight\": true,\n\t\t\"opacity\": true,\n\t\t\"order\": true,\n\t\t\"orphans\": true,\n\t\t\"widows\": true,\n\t\t\"zIndex\": true,\n\t\t\"zoom\": true\n\t},\n\n\t// Add in properties whose names you wish to fix before\n\t// setting or getting the value\n\tcssProps: {\n\t\t\"float\": \"cssFloat\"\n\t},\n\n\t// Get and set the style property on a DOM Node\n\tstyle: function( elem, name, value, extra ) {\n\n\t\t// Don't set styles on text and comment nodes\n\t\tif ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Make sure that we're working with the right name\n\t\tvar ret, type, hooks,\n\t\t\torigName = jQuery.camelCase( name ),\n\t\t\tstyle = elem.style;\n\n\t\tname = jQuery.cssProps[ origName ] ||\n\t\t\t( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );\n\n\t\t// Gets hook for the prefixed version, then unprefixed version\n\t\thooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];\n\n\t\t// Check if we're setting a value\n\t\tif ( value !== undefined ) {\n\t\t\ttype = typeof value;\n\n\t\t\t// Convert \"+=\" or \"-=\" to relative numbers (#7345)\n\t\t\tif ( type === \"string\" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {\n\t\t\t\tvalue = adjustCSS( elem, name, ret );\n\n\t\t\t\t// Fixes bug #9237\n\t\t\t\ttype = \"number\";\n\t\t\t}\n\n\t\t\t// Make sure that null and NaN values aren't set (#7116)\n\t\t\tif ( value == null || value !== value ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If a number was passed in, add the unit (except for certain CSS properties)\n\t\t\tif ( type === \"number\" ) {\n\t\t\t\tvalue += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? \"\" : \"px\" );\n\t\t\t}\n\n\t\t\t// background-* props affect original clone's values\n\t\t\tif ( !support.clearCloneStyle && value === \"\" && name.indexOf( \"background\" ) === 0 ) {\n\t\t\t\tstyle[ name ] = \"inherit\";\n\t\t\t}\n\n\t\t\t// If a hook was provided, use that value, otherwise just set the specified value\n\t\t\tif ( !hooks || !( \"set\" in hooks ) ||\n\t\t\t\t( value = hooks.set( elem, value, extra ) ) !== undefined ) {\n\n\t\t\t\tstyle[ name ] = value;\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// If a hook was provided get the non-computed value from there\n\t\t\tif ( hooks && \"get\" in hooks &&\n\t\t\t\t( ret = hooks.get( elem, false, extra ) ) !== undefined ) {\n\n\t\t\t\treturn ret;\n\t\t\t}\n\n\t\t\t// Otherwise just get the value from the style object\n\t\t\treturn style[ name ];\n\t\t}\n\t},\n\n\tcss: function( elem, name, extra, styles ) {\n\t\tvar val, num, hooks,\n\t\t\torigName = jQuery.camelCase( name );\n\n\t\t// Make sure that we're working with the right name\n\t\tname = jQuery.cssProps[ origName ] ||\n\t\t\t( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );\n\n\t\t// Try prefixed name followed by the unprefixed name\n\t\thooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];\n\n\t\t// If a hook was provided get the computed value from there\n\t\tif ( hooks && \"get\" in hooks ) {\n\t\t\tval = hooks.get( elem, true, extra );\n\t\t}\n\n\t\t// Otherwise, if a way to get the computed value exists, use that\n\t\tif ( val === undefined ) {\n\t\t\tval = curCSS( elem, name, styles );\n\t\t}\n\n\t\t// Convert \"normal\" to computed value\n\t\tif ( val === \"normal\" && name in cssNormalTransform ) {\n\t\t\tval = cssNormalTransform[ name ];\n\t\t}\n\n\t\t// Make numeric if forced or a qualifier was provided and val looks numeric\n\t\tif ( extra === \"\" || extra ) {\n\t\t\tnum = parseFloat( val );\n\t\t\treturn extra === true || isFinite( num ) ? num || 0 : val;\n\t\t}\n\t\treturn val;\n\t}\n} );\n\njQuery.each( [ \"height\", \"width\" ], function( i, name ) {\n\tjQuery.cssHooks[ name ] = {\n\t\tget: function( elem, computed, extra ) {\n\t\t\tif ( computed ) {\n\n\t\t\t\t// Certain elements can have dimension info if we invisibly show them\n\t\t\t\t// but it must have a current display style that would benefit\n\t\t\t\treturn rdisplayswap.test( jQuery.css( elem, \"display\" ) ) &&\n\n\t\t\t\t\t// Support: Safari 8+\n\t\t\t\t\t// Table columns in Safari have non-zero offsetWidth & zero\n\t\t\t\t\t// getBoundingClientRect().width unless display is changed.\n\t\t\t\t\t// Support: IE <=11 only\n\t\t\t\t\t// Running getBoundingClientRect on a disconnected node\n\t\t\t\t\t// in IE throws an error.\n\t\t\t\t\t( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?\n\t\t\t\t\t\tswap( elem, cssShow, function() {\n\t\t\t\t\t\t\treturn getWidthOrHeight( elem, name, extra );\n\t\t\t\t\t\t} ) :\n\t\t\t\t\t\tgetWidthOrHeight( elem, name, extra );\n\t\t\t}\n\t\t},\n\n\t\tset: function( elem, value, extra ) {\n\t\t\tvar matches,\n\t\t\t\tstyles = extra && getStyles( elem ),\n\t\t\t\tsubtract = extra && augmentWidthOrHeight(\n\t\t\t\t\telem,\n\t\t\t\t\tname,\n\t\t\t\t\textra,\n\t\t\t\t\tjQuery.css( elem, \"boxSizing\", false, styles ) === \"border-box\",\n\t\t\t\t\tstyles\n\t\t\t\t);\n\n\t\t\t// Convert to pixels if value adjustment is needed\n\t\t\tif ( subtract && ( matches = rcssNum.exec( value ) ) &&\n\t\t\t\t( matches[ 3 ] || \"px\" ) !== \"px\" ) {\n\n\t\t\t\telem.style[ name ] = value;\n\t\t\t\tvalue = jQuery.css( elem, name );\n\t\t\t}\n\n\t\t\treturn setPositiveNumber( elem, value, subtract );\n\t\t}\n\t};\n} );\n\njQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,\n\tfunction( elem, computed ) {\n\t\tif ( computed ) {\n\t\t\treturn ( parseFloat( curCSS( elem, \"marginLeft\" ) ) ||\n\t\t\t\telem.getBoundingClientRect().left -\n\t\t\t\t\tswap( elem, { marginLeft: 0 }, function() {\n\t\t\t\t\t\treturn elem.getBoundingClientRect().left;\n\t\t\t\t\t} )\n\t\t\t\t) + \"px\";\n\t\t}\n\t}\n);\n\n// These hooks are used by animate to expand properties\njQuery.each( {\n\tmargin: \"\",\n\tpadding: \"\",\n\tborder: \"Width\"\n}, function( prefix, suffix ) {\n\tjQuery.cssHooks[ prefix + suffix ] = {\n\t\texpand: function( value ) {\n\t\t\tvar i = 0,\n\t\t\t\texpanded = {},\n\n\t\t\t\t// Assumes a single number if not a string\n\t\t\t\tparts = typeof value === \"string\" ? value.split( \" \" ) : [ value ];\n\n\t\t\tfor ( ; i < 4; i++ ) {\n\t\t\t\texpanded[ prefix + cssExpand[ i ] + suffix ] =\n\t\t\t\t\tparts[ i ] || parts[ i - 2 ] || parts[ 0 ];\n\t\t\t}\n\n\t\t\treturn expanded;\n\t\t}\n\t};\n\n\tif ( !rmargin.test( prefix ) ) {\n\t\tjQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;\n\t}\n} );\n\njQuery.fn.extend( {\n\tcss: function( name, value ) {\n\t\treturn access( this, function( elem, name, value ) {\n\t\t\tvar styles, len,\n\t\t\t\tmap = {},\n\t\t\t\ti = 0;\n\n\t\t\tif ( jQuery.isArray( name ) ) {\n\t\t\t\tstyles = getStyles( elem );\n\t\t\t\tlen = name.length;\n\n\t\t\t\tfor ( ; i < len; i++ ) {\n\t\t\t\t\tmap[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );\n\t\t\t\t}\n\n\t\t\t\treturn map;\n\t\t\t}\n\n\t\t\treturn value !== undefined ?\n\t\t\t\tjQuery.style( elem, name, value ) :\n\t\t\t\tjQuery.css( elem, name );\n\t\t}, name, value, arguments.length > 1 );\n\t}\n} );\n\n\nfunction Tween( elem, options, prop, end, easing ) {\n\treturn new Tween.prototype.init( elem, options, prop, end, easing );\n}\njQuery.Tween = Tween;\n\nTween.prototype = {\n\tconstructor: Tween,\n\tinit: function( elem, options, prop, end, easing, unit ) {\n\t\tthis.elem = elem;\n\t\tthis.prop = prop;\n\t\tthis.easing = easing || jQuery.easing._default;\n\t\tthis.options = options;\n\t\tthis.start = this.now = this.cur();\n\t\tthis.end = end;\n\t\tthis.unit = unit || ( jQuery.cssNumber[ prop ] ? \"\" : \"px\" );\n\t},\n\tcur: function() {\n\t\tvar hooks = Tween.propHooks[ this.prop ];\n\n\t\treturn hooks && hooks.get ?\n\t\t\thooks.get( this ) :\n\t\t\tTween.propHooks._default.get( this );\n\t},\n\trun: function( percent ) {\n\t\tvar eased,\n\t\t\thooks = Tween.propHooks[ this.prop ];\n\n\t\tif ( this.options.duration ) {\n\t\t\tthis.pos = eased = jQuery.easing[ this.easing ](\n\t\t\t\tpercent, this.options.duration * percent, 0, 1, this.options.duration\n\t\t\t);\n\t\t} else {\n\t\t\tthis.pos = eased = percent;\n\t\t}\n\t\tthis.now = ( this.end - this.start ) * eased + this.start;\n\n\t\tif ( this.options.step ) {\n\t\t\tthis.options.step.call( this.elem, this.now, this );\n\t\t}\n\n\t\tif ( hooks && hooks.set ) {\n\t\t\thooks.set( this );\n\t\t} else {\n\t\t\tTween.propHooks._default.set( this );\n\t\t}\n\t\treturn this;\n\t}\n};\n\nTween.prototype.init.prototype = Tween.prototype;\n\nTween.propHooks = {\n\t_default: {\n\t\tget: function( tween ) {\n\t\t\tvar result;\n\n\t\t\t// Use a property on the element directly when it is not a DOM element,\n\t\t\t// or when there is no matching style property that exists.\n\t\t\tif ( tween.elem.nodeType !== 1 ||\n\t\t\t\ttween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {\n\t\t\t\treturn tween.elem[ tween.prop ];\n\t\t\t}\n\n\t\t\t// Passing an empty string as a 3rd parameter to .css will automatically\n\t\t\t// attempt a parseFloat and fallback to a string if the parse fails.\n\t\t\t// Simple values such as \"10px\" are parsed to Float;\n\t\t\t// complex values such as \"rotate(1rad)\" are returned as-is.\n\t\t\tresult = jQuery.css( tween.elem, tween.prop, \"\" );\n\n\t\t\t// Empty strings, null, undefined and \"auto\" are converted to 0.\n\t\t\treturn !result || result === \"auto\" ? 0 : result;\n\t\t},\n\t\tset: function( tween ) {\n\n\t\t\t// Use step hook for back compat.\n\t\t\t// Use cssHook if its there.\n\t\t\t// Use .style if available and use plain properties where available.\n\t\t\tif ( jQuery.fx.step[ tween.prop ] ) {\n\t\t\t\tjQuery.fx.step[ tween.prop ]( tween );\n\t\t\t} else if ( tween.elem.nodeType === 1 &&\n\t\t\t\t( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||\n\t\t\t\t\tjQuery.cssHooks[ tween.prop ] ) ) {\n\t\t\t\tjQuery.style( tween.elem, tween.prop, tween.now + tween.unit );\n\t\t\t} else {\n\t\t\t\ttween.elem[ tween.prop ] = tween.now;\n\t\t\t}\n\t\t}\n\t}\n};\n\n// Support: IE <=9 only\n// Panic based approach to setting things on disconnected nodes\nTween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {\n\tset: function( tween ) {\n\t\tif ( tween.elem.nodeType && tween.elem.parentNode ) {\n\t\t\ttween.elem[ tween.prop ] = tween.now;\n\t\t}\n\t}\n};\n\njQuery.easing = {\n\tlinear: function( p ) {\n\t\treturn p;\n\t},\n\tswing: function( p ) {\n\t\treturn 0.5 - Math.cos( p * Math.PI ) / 2;\n\t},\n\t_default: \"swing\"\n};\n\njQuery.fx = Tween.prototype.init;\n\n// Back compat <1.8 extension point\njQuery.fx.step = {};\n\n\n\n\nvar\n\tfxNow, timerId,\n\trfxtypes = /^(?:toggle|show|hide)$/,\n\trrun = /queueHooks$/;\n\nfunction raf() {\n\tif ( timerId ) {\n\t\twindow.requestAnimationFrame( raf );\n\t\tjQuery.fx.tick();\n\t}\n}\n\n// Animations created synchronously will run synchronously\nfunction createFxNow() {\n\twindow.setTimeout( function() {\n\t\tfxNow = undefined;\n\t} );\n\treturn ( fxNow = jQuery.now() );\n}\n\n// Generate parameters to create a standard animation\nfunction genFx( type, includeWidth ) {\n\tvar which,\n\t\ti = 0,\n\t\tattrs = { height: type };\n\n\t// If we include width, step value is 1 to do all cssExpand values,\n\t// otherwise step value is 2 to skip over Left and Right\n\tincludeWidth = includeWidth ? 1 : 0;\n\tfor ( ; i < 4; i += 2 - includeWidth ) {\n\t\twhich = cssExpand[ i ];\n\t\tattrs[ \"margin\" + which ] = attrs[ \"padding\" + which ] = type;\n\t}\n\n\tif ( includeWidth ) {\n\t\tattrs.opacity = attrs.width = type;\n\t}\n\n\treturn attrs;\n}\n\nfunction createTween( value, prop, animation ) {\n\tvar tween,\n\t\tcollection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ \"*\" ] ),\n\t\tindex = 0,\n\t\tlength = collection.length;\n\tfor ( ; index < length; index++ ) {\n\t\tif ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {\n\n\t\t\t// We're done with this property\n\t\t\treturn tween;\n\t\t}\n\t}\n}\n\nfunction defaultPrefilter( elem, props, opts ) {\n\tvar prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,\n\t\tisBox = \"width\" in props || \"height\" in props,\n\t\tanim = this,\n\t\torig = {},\n\t\tstyle = elem.style,\n\t\thidden = elem.nodeType && isHiddenWithinTree( elem ),\n\t\tdataShow = dataPriv.get( elem, \"fxshow\" );\n\n\t// Queue-skipping animations hijack the fx hooks\n\tif ( !opts.queue ) {\n\t\thooks = jQuery._queueHooks( elem, \"fx\" );\n\t\tif ( hooks.unqueued == null ) {\n\t\t\thooks.unqueued = 0;\n\t\t\toldfire = hooks.empty.fire;\n\t\t\thooks.empty.fire = function() {\n\t\t\t\tif ( !hooks.unqueued ) {\n\t\t\t\t\toldfire();\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\thooks.unqueued++;\n\n\t\tanim.always( function() {\n\n\t\t\t// Ensure the complete handler is called before this completes\n\t\t\tanim.always( function() {\n\t\t\t\thooks.unqueued--;\n\t\t\t\tif ( !jQuery.queue( elem, \"fx\" ).length ) {\n\t\t\t\t\thooks.empty.fire();\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t}\n\n\t// Detect show/hide animations\n\tfor ( prop in props ) {\n\t\tvalue = props[ prop ];\n\t\tif ( rfxtypes.test( value ) ) {\n\t\t\tdelete props[ prop ];\n\t\t\ttoggle = toggle || value === \"toggle\";\n\t\t\tif ( value === ( hidden ? \"hide\" : \"show\" ) ) {\n\n\t\t\t\t// Pretend to be hidden if this is a \"show\" and\n\t\t\t\t// there is still data from a stopped show/hide\n\t\t\t\tif ( value === \"show\" && dataShow && dataShow[ prop ] !== undefined ) {\n\t\t\t\t\thidden = true;\n\n\t\t\t\t// Ignore all other no-op show/hide data\n\t\t\t\t} else {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\torig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );\n\t\t}\n\t}\n\n\t// Bail out if this is a no-op like .hide().hide()\n\tpropTween = !jQuery.isEmptyObject( props );\n\tif ( !propTween && jQuery.isEmptyObject( orig ) ) {\n\t\treturn;\n\t}\n\n\t// Restrict \"overflow\" and \"display\" styles during box animations\n\tif ( isBox && elem.nodeType === 1 ) {\n\n\t\t// Support: IE <=9 - 11, Edge 12 - 13\n\t\t// Record all 3 overflow attributes because IE does not infer the shorthand\n\t\t// from identically-valued overflowX and overflowY\n\t\topts.overflow = [ style.overflow, style.overflowX, style.overflowY ];\n\n\t\t// Identify a display type, preferring old show/hide data over the CSS cascade\n\t\trestoreDisplay = dataShow && dataShow.display;\n\t\tif ( restoreDisplay == null ) {\n\t\t\trestoreDisplay = dataPriv.get( elem, \"display\" );\n\t\t}\n\t\tdisplay = jQuery.css( elem, \"display\" );\n\t\tif ( display === \"none\" ) {\n\t\t\tif ( restoreDisplay ) {\n\t\t\t\tdisplay = restoreDisplay;\n\t\t\t} else {\n\n\t\t\t\t// Get nonempty value(s) by temporarily forcing visibility\n\t\t\t\tshowHide( [ elem ], true );\n\t\t\t\trestoreDisplay = elem.style.display || restoreDisplay;\n\t\t\t\tdisplay = jQuery.css( elem, \"display\" );\n\t\t\t\tshowHide( [ elem ] );\n\t\t\t}\n\t\t}\n\n\t\t// Animate inline elements as inline-block\n\t\tif ( display === \"inline\" || display === \"inline-block\" && restoreDisplay != null ) {\n\t\t\tif ( jQuery.css( elem, \"float\" ) === \"none\" ) {\n\n\t\t\t\t// Restore the original display value at the end of pure show/hide animations\n\t\t\t\tif ( !propTween ) {\n\t\t\t\t\tanim.done( function() {\n\t\t\t\t\t\tstyle.display = restoreDisplay;\n\t\t\t\t\t} );\n\t\t\t\t\tif ( restoreDisplay == null ) {\n\t\t\t\t\t\tdisplay = style.display;\n\t\t\t\t\t\trestoreDisplay = display === \"none\" ? \"\" : display;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tstyle.display = \"inline-block\";\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( opts.overflow ) {\n\t\tstyle.overflow = \"hidden\";\n\t\tanim.always( function() {\n\t\t\tstyle.overflow = opts.overflow[ 0 ];\n\t\t\tstyle.overflowX = opts.overflow[ 1 ];\n\t\t\tstyle.overflowY = opts.overflow[ 2 ];\n\t\t} );\n\t}\n\n\t// Implement show/hide animations\n\tpropTween = false;\n\tfor ( prop in orig ) {\n\n\t\t// General show/hide setup for this element animation\n\t\tif ( !propTween ) {\n\t\t\tif ( dataShow ) {\n\t\t\t\tif ( \"hidden\" in dataShow ) {\n\t\t\t\t\thidden = dataShow.hidden;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdataShow = dataPriv.access( elem, \"fxshow\", { display: restoreDisplay } );\n\t\t\t}\n\n\t\t\t// Store hidden/visible for toggle so `.stop().toggle()` \"reverses\"\n\t\t\tif ( toggle ) {\n\t\t\t\tdataShow.hidden = !hidden;\n\t\t\t}\n\n\t\t\t// Show elements before animating them\n\t\t\tif ( hidden ) {\n\t\t\t\tshowHide( [ elem ], true );\n\t\t\t}\n\n\t\t\t/* eslint-disable no-loop-func */\n\n\t\t\tanim.done( function() {\n\n\t\t\t/* eslint-enable no-loop-func */\n\n\t\t\t\t// The final step of a \"hide\" animation is actually hiding the element\n\t\t\t\tif ( !hidden ) {\n\t\t\t\t\tshowHide( [ elem ] );\n\t\t\t\t}\n\t\t\t\tdataPriv.remove( elem, \"fxshow\" );\n\t\t\t\tfor ( prop in orig ) {\n\t\t\t\t\tjQuery.style( elem, prop, orig[ prop ] );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t// Per-property setup\n\t\tpropTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );\n\t\tif ( !( prop in dataShow ) ) {\n\t\t\tdataShow[ prop ] = propTween.start;\n\t\t\tif ( hidden ) {\n\t\t\t\tpropTween.end = propTween.start;\n\t\t\t\tpropTween.start = 0;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction propFilter( props, specialEasing ) {\n\tvar index, name, easing, value, hooks;\n\n\t// camelCase, specialEasing and expand cssHook pass\n\tfor ( index in props ) {\n\t\tname = jQuery.camelCase( index );\n\t\teasing = specialEasing[ name ];\n\t\tvalue = props[ index ];\n\t\tif ( jQuery.isArray( value ) ) {\n\t\t\teasing = value[ 1 ];\n\t\t\tvalue = props[ index ] = value[ 0 ];\n\t\t}\n\n\t\tif ( index !== name ) {\n\t\t\tprops[ name ] = value;\n\t\t\tdelete props[ index ];\n\t\t}\n\n\t\thooks = jQuery.cssHooks[ name ];\n\t\tif ( hooks && \"expand\" in hooks ) {\n\t\t\tvalue = hooks.expand( value );\n\t\t\tdelete props[ name ];\n\n\t\t\t// Not quite $.extend, this won't overwrite existing keys.\n\t\t\t// Reusing 'index' because we have the correct \"name\"\n\t\t\tfor ( index in value ) {\n\t\t\t\tif ( !( index in props ) ) {\n\t\t\t\t\tprops[ index ] = value[ index ];\n\t\t\t\t\tspecialEasing[ index ] = easing;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tspecialEasing[ name ] = easing;\n\t\t}\n\t}\n}\n\nfunction Animation( elem, properties, options ) {\n\tvar result,\n\t\tstopped,\n\t\tindex = 0,\n\t\tlength = Animation.prefilters.length,\n\t\tdeferred = jQuery.Deferred().always( function() {\n\n\t\t\t// Don't match elem in the :animated selector\n\t\t\tdelete tick.elem;\n\t\t} ),\n\t\ttick = function() {\n\t\t\tif ( stopped ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvar currentTime = fxNow || createFxNow(),\n\t\t\t\tremaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),\n\n\t\t\t\t// Support: Android 2.3 only\n\t\t\t\t// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)\n\t\t\t\ttemp = remaining / animation.duration || 0,\n\t\t\t\tpercent = 1 - temp,\n\t\t\t\tindex = 0,\n\t\t\t\tlength = animation.tweens.length;\n\n\t\t\tfor ( ; index < length; index++ ) {\n\t\t\t\tanimation.tweens[ index ].run( percent );\n\t\t\t}\n\n\t\t\tdeferred.notifyWith( elem, [ animation, percent, remaining ] );\n\n\t\t\tif ( percent < 1 && length ) {\n\t\t\t\treturn remaining;\n\t\t\t} else {\n\t\t\t\tdeferred.resolveWith( elem, [ animation ] );\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\t\tanimation = deferred.promise( {\n\t\t\telem: elem,\n\t\t\tprops: jQuery.extend( {}, properties ),\n\t\t\topts: jQuery.extend( true, {\n\t\t\t\tspecialEasing: {},\n\t\t\t\teasing: jQuery.easing._default\n\t\t\t}, options ),\n\t\t\toriginalProperties: properties,\n\t\t\toriginalOptions: options,\n\t\t\tstartTime: fxNow || createFxNow(),\n\t\t\tduration: options.duration,\n\t\t\ttweens: [],\n\t\t\tcreateTween: function( prop, end ) {\n\t\t\t\tvar tween = jQuery.Tween( elem, animation.opts, prop, end,\n\t\t\t\t\t\tanimation.opts.specialEasing[ prop ] || animation.opts.easing );\n\t\t\t\tanimation.tweens.push( tween );\n\t\t\t\treturn tween;\n\t\t\t},\n\t\t\tstop: function( gotoEnd ) {\n\t\t\t\tvar index = 0,\n\n\t\t\t\t\t// If we are going to the end, we want to run all the tweens\n\t\t\t\t\t// otherwise we skip this part\n\t\t\t\t\tlength = gotoEnd ? animation.tweens.length : 0;\n\t\t\t\tif ( stopped ) {\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\t\t\t\tstopped = true;\n\t\t\t\tfor ( ; index < length; index++ ) {\n\t\t\t\t\tanimation.tweens[ index ].run( 1 );\n\t\t\t\t}\n\n\t\t\t\t// Resolve when we played the last frame; otherwise, reject\n\t\t\t\tif ( gotoEnd ) {\n\t\t\t\t\tdeferred.notifyWith( elem, [ animation, 1, 0 ] );\n\t\t\t\t\tdeferred.resolveWith( elem, [ animation, gotoEnd ] );\n\t\t\t\t} else {\n\t\t\t\t\tdeferred.rejectWith( elem, [ animation, gotoEnd ] );\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t}\n\t\t} ),\n\t\tprops = animation.props;\n\n\tpropFilter( props, animation.opts.specialEasing );\n\n\tfor ( ; index < length; index++ ) {\n\t\tresult = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );\n\t\tif ( result ) {\n\t\t\tif ( jQuery.isFunction( result.stop ) ) {\n\t\t\t\tjQuery._queueHooks( animation.elem, animation.opts.queue ).stop =\n\t\t\t\t\tjQuery.proxy( result.stop, result );\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t}\n\n\tjQuery.map( props, createTween, animation );\n\n\tif ( jQuery.isFunction( animation.opts.start ) ) {\n\t\tanimation.opts.start.call( elem, animation );\n\t}\n\n\tjQuery.fx.timer(\n\t\tjQuery.extend( tick, {\n\t\t\telem: elem,\n\t\t\tanim: animation,\n\t\t\tqueue: animation.opts.queue\n\t\t} )\n\t);\n\n\t// attach callbacks from options\n\treturn animation.progress( animation.opts.progress )\n\t\t.done( animation.opts.done, animation.opts.complete )\n\t\t.fail( animation.opts.fail )\n\t\t.always( animation.opts.always );\n}\n\njQuery.Animation = jQuery.extend( Animation, {\n\n\ttweeners: {\n\t\t\"*\": [ function( prop, value ) {\n\t\t\tvar tween = this.createTween( prop, value );\n\t\t\tadjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );\n\t\t\treturn tween;\n\t\t} ]\n\t},\n\n\ttweener: function( props, callback ) {\n\t\tif ( jQuery.isFunction( props ) ) {\n\t\t\tcallback = props;\n\t\t\tprops = [ \"*\" ];\n\t\t} else {\n\t\t\tprops = props.match( rnothtmlwhite );\n\t\t}\n\n\t\tvar prop,\n\t\t\tindex = 0,\n\t\t\tlength = props.length;\n\n\t\tfor ( ; index < length; index++ ) {\n\t\t\tprop = props[ index ];\n\t\t\tAnimation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];\n\t\t\tAnimation.tweeners[ prop ].unshift( callback );\n\t\t}\n\t},\n\n\tprefilters: [ defaultPrefilter ],\n\n\tprefilter: function( callback, prepend ) {\n\t\tif ( prepend ) {\n\t\t\tAnimation.prefilters.unshift( callback );\n\t\t} else {\n\t\t\tAnimation.prefilters.push( callback );\n\t\t}\n\t}\n} );\n\njQuery.speed = function( speed, easing, fn ) {\n\tvar opt = speed && typeof speed === \"object\" ? jQuery.extend( {}, speed ) : {\n\t\tcomplete: fn || !fn && easing ||\n\t\t\tjQuery.isFunction( speed ) && speed,\n\t\tduration: speed,\n\t\teasing: fn && easing || easing && !jQuery.isFunction( easing ) && easing\n\t};\n\n\t// Go to the end state if fx are off or if document is hidden\n\tif ( jQuery.fx.off || document.hidden ) {\n\t\topt.duration = 0;\n\n\t} else {\n\t\tif ( typeof opt.duration !== \"number\" ) {\n\t\t\tif ( opt.duration in jQuery.fx.speeds ) {\n\t\t\t\topt.duration = jQuery.fx.speeds[ opt.duration ];\n\n\t\t\t} else {\n\t\t\t\topt.duration = jQuery.fx.speeds._default;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Normalize opt.queue - true/undefined/null -> \"fx\"\n\tif ( opt.queue == null || opt.queue === true ) {\n\t\topt.queue = \"fx\";\n\t}\n\n\t// Queueing\n\topt.old = opt.complete;\n\n\topt.complete = function() {\n\t\tif ( jQuery.isFunction( opt.old ) ) {\n\t\t\topt.old.call( this );\n\t\t}\n\n\t\tif ( opt.queue ) {\n\t\t\tjQuery.dequeue( this, opt.queue );\n\t\t}\n\t};\n\n\treturn opt;\n};\n\njQuery.fn.extend( {\n\tfadeTo: function( speed, to, easing, callback ) {\n\n\t\t// Show any hidden elements after setting opacity to 0\n\t\treturn this.filter( isHiddenWithinTree ).css( \"opacity\", 0 ).show()\n\n\t\t\t// Animate to the value specified\n\t\t\t.end().animate( { opacity: to }, speed, easing, callback );\n\t},\n\tanimate: function( prop, speed, easing, callback ) {\n\t\tvar empty = jQuery.isEmptyObject( prop ),\n\t\t\toptall = jQuery.speed( speed, easing, callback ),\n\t\t\tdoAnimation = function() {\n\n\t\t\t\t// Operate on a copy of prop so per-property easing won't be lost\n\t\t\t\tvar anim = Animation( this, jQuery.extend( {}, prop ), optall );\n\n\t\t\t\t// Empty animations, or finishing resolves immediately\n\t\t\t\tif ( empty || dataPriv.get( this, \"finish\" ) ) {\n\t\t\t\t\tanim.stop( true );\n\t\t\t\t}\n\t\t\t};\n\t\t\tdoAnimation.finish = doAnimation;\n\n\t\treturn empty || optall.queue === false ?\n\t\t\tthis.each( doAnimation ) :\n\t\t\tthis.queue( optall.queue, doAnimation );\n\t},\n\tstop: function( type, clearQueue, gotoEnd ) {\n\t\tvar stopQueue = function( hooks ) {\n\t\t\tvar stop = hooks.stop;\n\t\t\tdelete hooks.stop;\n\t\t\tstop( gotoEnd );\n\t\t};\n\n\t\tif ( typeof type !== \"string\" ) {\n\t\t\tgotoEnd = clearQueue;\n\t\t\tclearQueue = type;\n\t\t\ttype = undefined;\n\t\t}\n\t\tif ( clearQueue && type !== false ) {\n\t\t\tthis.queue( type || \"fx\", [] );\n\t\t}\n\n\t\treturn this.each( function() {\n\t\t\tvar dequeue = true,\n\t\t\t\tindex = type != null && type + \"queueHooks\",\n\t\t\t\ttimers = jQuery.timers,\n\t\t\t\tdata = dataPriv.get( this );\n\n\t\t\tif ( index ) {\n\t\t\t\tif ( data[ index ] && data[ index ].stop ) {\n\t\t\t\t\tstopQueue( data[ index ] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor ( index in data ) {\n\t\t\t\t\tif ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {\n\t\t\t\t\t\tstopQueue( data[ index ] );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor ( index = timers.length; index--; ) {\n\t\t\t\tif ( timers[ index ].elem === this &&\n\t\t\t\t\t( type == null || timers[ index ].queue === type ) ) {\n\n\t\t\t\t\ttimers[ index ].anim.stop( gotoEnd );\n\t\t\t\t\tdequeue = false;\n\t\t\t\t\ttimers.splice( index, 1 );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Start the next in the queue if the last step wasn't forced.\n\t\t\t// Timers currently will call their complete callbacks, which\n\t\t\t// will dequeue but only if they were gotoEnd.\n\t\t\tif ( dequeue || !gotoEnd ) {\n\t\t\t\tjQuery.dequeue( this, type );\n\t\t\t}\n\t\t} );\n\t},\n\tfinish: function( type ) {\n\t\tif ( type !== false ) {\n\t\t\ttype = type || \"fx\";\n\t\t}\n\t\treturn this.each( function() {\n\t\t\tvar index,\n\t\t\t\tdata = dataPriv.get( this ),\n\t\t\t\tqueue = data[ type + \"queue\" ],\n\t\t\t\thooks = data[ type + \"queueHooks\" ],\n\t\t\t\ttimers = jQuery.timers,\n\t\t\t\tlength = queue ? queue.length : 0;\n\n\t\t\t// Enable finishing flag on private data\n\t\t\tdata.finish = true;\n\n\t\t\t// Empty the queue first\n\t\t\tjQuery.queue( this, type, [] );\n\n\t\t\tif ( hooks && hooks.stop ) {\n\t\t\t\thooks.stop.call( this, true );\n\t\t\t}\n\n\t\t\t// Look for any active animations, and finish them\n\t\t\tfor ( index = timers.length; index--; ) {\n\t\t\t\tif ( timers[ index ].elem === this && timers[ index ].queue === type ) {\n\t\t\t\t\ttimers[ index ].anim.stop( true );\n\t\t\t\t\ttimers.splice( index, 1 );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Look for any animations in the old queue and finish them\n\t\t\tfor ( index = 0; index < length; index++ ) {\n\t\t\t\tif ( queue[ index ] && queue[ index ].finish ) {\n\t\t\t\t\tqueue[ index ].finish.call( this );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Turn off finishing flag\n\t\t\tdelete data.finish;\n\t\t} );\n\t}\n} );\n\njQuery.each( [ \"toggle\", \"show\", \"hide\" ], function( i, name ) {\n\tvar cssFn = jQuery.fn[ name ];\n\tjQuery.fn[ name ] = function( speed, easing, callback ) {\n\t\treturn speed == null || typeof speed === \"boolean\" ?\n\t\t\tcssFn.apply( this, arguments ) :\n\t\t\tthis.animate( genFx( name, true ), speed, easing, callback );\n\t};\n} );\n\n// Generate shortcuts for custom animations\njQuery.each( {\n\tslideDown: genFx( \"show\" ),\n\tslideUp: genFx( \"hide\" ),\n\tslideToggle: genFx( \"toggle\" ),\n\tfadeIn: { opacity: \"show\" },\n\tfadeOut: { opacity: \"hide\" },\n\tfadeToggle: { opacity: \"toggle\" }\n}, function( name, props ) {\n\tjQuery.fn[ name ] = function( speed, easing, callback ) {\n\t\treturn this.animate( props, speed, easing, callback );\n\t};\n} );\n\njQuery.timers = [];\njQuery.fx.tick = function() {\n\tvar timer,\n\t\ti = 0,\n\t\ttimers = jQuery.timers;\n\n\tfxNow = jQuery.now();\n\n\tfor ( ; i < timers.length; i++ ) {\n\t\ttimer = timers[ i ];\n\n\t\t// Checks the timer has not already been removed\n\t\tif ( !timer() && timers[ i ] === timer ) {\n\t\t\ttimers.splice( i--, 1 );\n\t\t}\n\t}\n\n\tif ( !timers.length ) {\n\t\tjQuery.fx.stop();\n\t}\n\tfxNow = undefined;\n};\n\njQuery.fx.timer = function( timer ) {\n\tjQuery.timers.push( timer );\n\tif ( timer() ) {\n\t\tjQuery.fx.start();\n\t} else {\n\t\tjQuery.timers.pop();\n\t}\n};\n\njQuery.fx.interval = 13;\njQuery.fx.start = function() {\n\tif ( !timerId ) {\n\t\ttimerId = window.requestAnimationFrame ?\n\t\t\twindow.requestAnimationFrame( raf ) :\n\t\t\twindow.setInterval( jQuery.fx.tick, jQuery.fx.interval );\n\t}\n};\n\njQuery.fx.stop = function() {\n\tif ( window.cancelAnimationFrame ) {\n\t\twindow.cancelAnimationFrame( timerId );\n\t} else {\n\t\twindow.clearInterval( timerId );\n\t}\n\n\ttimerId = null;\n};\n\njQuery.fx.speeds = {\n\tslow: 600,\n\tfast: 200,\n\n\t// Default speed\n\t_default: 400\n};\n\n\n// Based off of the plugin by Clint Helfers, with permission.\n// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/\njQuery.fn.delay = function( time, type ) {\n\ttime = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;\n\ttype = type || \"fx\";\n\n\treturn this.queue( type, function( next, hooks ) {\n\t\tvar timeout = window.setTimeout( next, time );\n\t\thooks.stop = function() {\n\t\t\twindow.clearTimeout( timeout );\n\t\t};\n\t} );\n};\n\n\n( function() {\n\tvar input = document.createElement( \"input\" ),\n\t\tselect = document.createElement( \"select\" ),\n\t\topt = select.appendChild( document.createElement( \"option\" ) );\n\n\tinput.type = \"checkbox\";\n\n\t// Support: Android <=4.3 only\n\t// Default value for a checkbox should be \"on\"\n\tsupport.checkOn = input.value !== \"\";\n\n\t// Support: IE <=11 only\n\t// Must access selectedIndex to make default options select\n\tsupport.optSelected = opt.selected;\n\n\t// Support: IE <=11 only\n\t// An input loses its value after becoming a radio\n\tinput = document.createElement( \"input\" );\n\tinput.value = \"t\";\n\tinput.type = \"radio\";\n\tsupport.radioValue = input.value === \"t\";\n} )();\n\n\nvar boolHook,\n\tattrHandle = jQuery.expr.attrHandle;\n\njQuery.fn.extend( {\n\tattr: function( name, value ) {\n\t\treturn access( this, jQuery.attr, name, value, arguments.length > 1 );\n\t},\n\n\tremoveAttr: function( name ) {\n\t\treturn this.each( function() {\n\t\t\tjQuery.removeAttr( this, name );\n\t\t} );\n\t}\n} );\n\njQuery.extend( {\n\tattr: function( elem, name, value ) {\n\t\tvar ret, hooks,\n\t\t\tnType = elem.nodeType;\n\n\t\t// Don't get/set attributes on text, comment and attribute nodes\n\t\tif ( nType === 3 || nType === 8 || nType === 2 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Fallback to prop when attributes are not supported\n\t\tif ( typeof elem.getAttribute === \"undefined\" ) {\n\t\t\treturn jQuery.prop( elem, name, value );\n\t\t}\n\n\t\t// Attribute hooks are determined by the lowercase version\n\t\t// Grab necessary hook if one is defined\n\t\tif ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {\n\t\t\thooks = jQuery.attrHooks[ name.toLowerCase() ] ||\n\t\t\t\t( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );\n\t\t}\n\n\t\tif ( value !== undefined ) {\n\t\t\tif ( value === null ) {\n\t\t\t\tjQuery.removeAttr( elem, name );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( hooks && \"set\" in hooks &&\n\t\t\t\t( ret = hooks.set( elem, value, name ) ) !== undefined ) {\n\t\t\t\treturn ret;\n\t\t\t}\n\n\t\t\telem.setAttribute( name, value + \"\" );\n\t\t\treturn value;\n\t\t}\n\n\t\tif ( hooks && \"get\" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {\n\t\t\treturn ret;\n\t\t}\n\n\t\tret = jQuery.find.attr( elem, name );\n\n\t\t// Non-existent attributes return null, we normalize to undefined\n\t\treturn ret == null ? undefined : ret;\n\t},\n\n\tattrHooks: {\n\t\ttype: {\n\t\t\tset: function( elem, value ) {\n\t\t\t\tif ( !support.radioValue && value === \"radio\" &&\n\t\t\t\t\tjQuery.nodeName( elem, \"input\" ) ) {\n\t\t\t\t\tvar val = elem.value;\n\t\t\t\t\telem.setAttribute( \"type\", value );\n\t\t\t\t\tif ( val ) {\n\t\t\t\t\t\telem.value = val;\n\t\t\t\t\t}\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\tremoveAttr: function( elem, value ) {\n\t\tvar name,\n\t\t\ti = 0,\n\n\t\t\t// Attribute names can contain non-HTML whitespace characters\n\t\t\t// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2\n\t\t\tattrNames = value && value.match( rnothtmlwhite );\n\n\t\tif ( attrNames && elem.nodeType === 1 ) {\n\t\t\twhile ( ( name = attrNames[ i++ ] ) ) {\n\t\t\t\telem.removeAttribute( name );\n\t\t\t}\n\t\t}\n\t}\n} );\n\n// Hooks for boolean attributes\nboolHook = {\n\tset: function( elem, value, name ) {\n\t\tif ( value === false ) {\n\n\t\t\t// Remove boolean attributes when set to false\n\t\t\tjQuery.removeAttr( elem, name );\n\t\t} else {\n\t\t\telem.setAttribute( name, name );\n\t\t}\n\t\treturn name;\n\t}\n};\n\njQuery.each( jQuery.expr.match.bool.source.match( /\\w+/g ), function( i, name ) {\n\tvar getter = attrHandle[ name ] || jQuery.find.attr;\n\n\tattrHandle[ name ] = function( elem, name, isXML ) {\n\t\tvar ret, handle,\n\t\t\tlowercaseName = name.toLowerCase();\n\n\t\tif ( !isXML ) {\n\n\t\t\t// Avoid an infinite loop by temporarily removing this function from the getter\n\t\t\thandle = attrHandle[ lowercaseName ];\n\t\t\tattrHandle[ lowercaseName ] = ret;\n\t\t\tret = getter( elem, name, isXML ) != null ?\n\t\t\t\tlowercaseName :\n\t\t\t\tnull;\n\t\t\tattrHandle[ lowercaseName ] = handle;\n\t\t}\n\t\treturn ret;\n\t};\n} );\n\n\n\n\nvar rfocusable = /^(?:input|select|textarea|button)$/i,\n\trclickable = /^(?:a|area)$/i;\n\njQuery.fn.extend( {\n\tprop: function( name, value ) {\n\t\treturn access( this, jQuery.prop, name, value, arguments.length > 1 );\n\t},\n\n\tremoveProp: function( name ) {\n\t\treturn this.each( function() {\n\t\t\tdelete this[ jQuery.propFix[ name ] || name ];\n\t\t} );\n\t}\n} );\n\njQuery.extend( {\n\tprop: function( elem, name, value ) {\n\t\tvar ret, hooks,\n\t\t\tnType = elem.nodeType;\n\n\t\t// Don't get/set properties on text, comment and attribute nodes\n\t\tif ( nType === 3 || nType === 8 || nType === 2 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {\n\n\t\t\t// Fix name and attach hooks\n\t\t\tname = jQuery.propFix[ name ] || name;\n\t\t\thooks = jQuery.propHooks[ name ];\n\t\t}\n\n\t\tif ( value !== undefined ) {\n\t\t\tif ( hooks && \"set\" in hooks &&\n\t\t\t\t( ret = hooks.set( elem, value, name ) ) !== undefined ) {\n\t\t\t\treturn ret;\n\t\t\t}\n\n\t\t\treturn ( elem[ name ] = value );\n\t\t}\n\n\t\tif ( hooks && \"get\" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {\n\t\t\treturn ret;\n\t\t}\n\n\t\treturn elem[ name ];\n\t},\n\n\tpropHooks: {\n\t\ttabIndex: {\n\t\t\tget: function( elem ) {\n\n\t\t\t\t// Support: IE <=9 - 11 only\n\t\t\t\t// elem.tabIndex doesn't always return the\n\t\t\t\t// correct value when it hasn't been explicitly set\n\t\t\t\t// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/\n\t\t\t\t// Use proper attribute retrieval(#12072)\n\t\t\t\tvar tabindex = jQuery.find.attr( elem, \"tabindex\" );\n\n\t\t\t\tif ( tabindex ) {\n\t\t\t\t\treturn parseInt( tabindex, 10 );\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\trfocusable.test( elem.nodeName ) ||\n\t\t\t\t\trclickable.test( elem.nodeName ) &&\n\t\t\t\t\telem.href\n\t\t\t\t) {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t},\n\n\tpropFix: {\n\t\t\"for\": \"htmlFor\",\n\t\t\"class\": \"className\"\n\t}\n} );\n\n// Support: IE <=11 only\n// Accessing the selectedIndex property\n// forces the browser to respect setting selected\n// on the option\n// The getter ensures a default option is selected\n// when in an optgroup\n// eslint rule \"no-unused-expressions\" is disabled for this code\n// since it considers such accessions noop\nif ( !support.optSelected ) {\n\tjQuery.propHooks.selected = {\n\t\tget: function( elem ) {\n\n\t\t\t/* eslint no-unused-expressions: \"off\" */\n\n\t\t\tvar parent = elem.parentNode;\n\t\t\tif ( parent && parent.parentNode ) {\n\t\t\t\tparent.parentNode.selectedIndex;\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t\tset: function( elem ) {\n\n\t\t\t/* eslint no-unused-expressions: \"off\" */\n\n\t\t\tvar parent = elem.parentNode;\n\t\t\tif ( parent ) {\n\t\t\t\tparent.selectedIndex;\n\n\t\t\t\tif ( parent.parentNode ) {\n\t\t\t\t\tparent.parentNode.selectedIndex;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n}\n\njQuery.each( [\n\t\"tabIndex\",\n\t\"readOnly\",\n\t\"maxLength\",\n\t\"cellSpacing\",\n\t\"cellPadding\",\n\t\"rowSpan\",\n\t\"colSpan\",\n\t\"useMap\",\n\t\"frameBorder\",\n\t\"contentEditable\"\n], function() {\n\tjQuery.propFix[ this.toLowerCase() ] = this;\n} );\n\n\n\n\n\t// Strip and collapse whitespace according to HTML spec\n\t// https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace\n\tfunction stripAndCollapse( value ) {\n\t\tvar tokens = value.match( rnothtmlwhite ) || [];\n\t\treturn tokens.join( \" \" );\n\t}\n\n\nfunction getClass( elem ) {\n\treturn elem.getAttribute && elem.getAttribute( \"class\" ) || \"\";\n}\n\njQuery.fn.extend( {\n\taddClass: function( value ) {\n\t\tvar classes, elem, cur, curValue, clazz, j, finalValue,\n\t\t\ti = 0;\n\n\t\tif ( jQuery.isFunction( value ) ) {\n\t\t\treturn this.each( function( j ) {\n\t\t\t\tjQuery( this ).addClass( value.call( this, j, getClass( this ) ) );\n\t\t\t} );\n\t\t}\n\n\t\tif ( typeof value === \"string\" && value ) {\n\t\t\tclasses = value.match( rnothtmlwhite ) || [];\n\n\t\t\twhile ( ( elem = this[ i++ ] ) ) {\n\t\t\t\tcurValue = getClass( elem );\n\t\t\t\tcur = elem.nodeType === 1 && ( \" \" + stripAndCollapse( curValue ) + \" \" );\n\n\t\t\t\tif ( cur ) {\n\t\t\t\t\tj = 0;\n\t\t\t\t\twhile ( ( clazz = classes[ j++ ] ) ) {\n\t\t\t\t\t\tif ( cur.indexOf( \" \" + clazz + \" \" ) < 0 ) {\n\t\t\t\t\t\t\tcur += clazz + \" \";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Only assign if different to avoid unneeded rendering.\n\t\t\t\t\tfinalValue = stripAndCollapse( cur );\n\t\t\t\t\tif ( curValue !== finalValue ) {\n\t\t\t\t\t\telem.setAttribute( \"class\", finalValue );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tremoveClass: function( value ) {\n\t\tvar classes, elem, cur, curValue, clazz, j, finalValue,\n\t\t\ti = 0;\n\n\t\tif ( jQuery.isFunction( value ) ) {\n\t\t\treturn this.each( function( j ) {\n\t\t\t\tjQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );\n\t\t\t} );\n\t\t}\n\n\t\tif ( !arguments.length ) {\n\t\t\treturn this.attr( \"class\", \"\" );\n\t\t}\n\n\t\tif ( typeof value === \"string\" && value ) {\n\t\t\tclasses = value.match( rnothtmlwhite ) || [];\n\n\t\t\twhile ( ( elem = this[ i++ ] ) ) {\n\t\t\t\tcurValue = getClass( elem );\n\n\t\t\t\t// This expression is here for better compressibility (see addClass)\n\t\t\t\tcur = elem.nodeType === 1 && ( \" \" + stripAndCollapse( curValue ) + \" \" );\n\n\t\t\t\tif ( cur ) {\n\t\t\t\t\tj = 0;\n\t\t\t\t\twhile ( ( clazz = classes[ j++ ] ) ) {\n\n\t\t\t\t\t\t// Remove *all* instances\n\t\t\t\t\t\twhile ( cur.indexOf( \" \" + clazz + \" \" ) > -1 ) {\n\t\t\t\t\t\t\tcur = cur.replace( \" \" + clazz + \" \", \" \" );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Only assign if different to avoid unneeded rendering.\n\t\t\t\t\tfinalValue = stripAndCollapse( cur );\n\t\t\t\t\tif ( curValue !== finalValue ) {\n\t\t\t\t\t\telem.setAttribute( \"class\", finalValue );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\ttoggleClass: function( value, stateVal ) {\n\t\tvar type = typeof value;\n\n\t\tif ( typeof stateVal === \"boolean\" && type === \"string\" ) {\n\t\t\treturn stateVal ? this.addClass( value ) : this.removeClass( value );\n\t\t}\n\n\t\tif ( jQuery.isFunction( value ) ) {\n\t\t\treturn this.each( function( i ) {\n\t\t\t\tjQuery( this ).toggleClass(\n\t\t\t\t\tvalue.call( this, i, getClass( this ), stateVal ),\n\t\t\t\t\tstateVal\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\n\t\treturn this.each( function() {\n\t\t\tvar className, i, self, classNames;\n\n\t\t\tif ( type === \"string\" ) {\n\n\t\t\t\t// Toggle individual class names\n\t\t\t\ti = 0;\n\t\t\t\tself = jQuery( this );\n\t\t\t\tclassNames = value.match( rnothtmlwhite ) || [];\n\n\t\t\t\twhile ( ( className = classNames[ i++ ] ) ) {\n\n\t\t\t\t\t// Check each className given, space separated list\n\t\t\t\t\tif ( self.hasClass( className ) ) {\n\t\t\t\t\t\tself.removeClass( className );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tself.addClass( className );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t// Toggle whole class name\n\t\t\t} else if ( value === undefined || type === \"boolean\" ) {\n\t\t\t\tclassName = getClass( this );\n\t\t\t\tif ( className ) {\n\n\t\t\t\t\t// Store className if set\n\t\t\t\t\tdataPriv.set( this, \"__className__\", className );\n\t\t\t\t}\n\n\t\t\t\t// If the element has a class name or if we're passed `false`,\n\t\t\t\t// then remove the whole classname (if there was one, the above saved it).\n\t\t\t\t// Otherwise bring back whatever was previously saved (if anything),\n\t\t\t\t// falling back to the empty string if nothing was stored.\n\t\t\t\tif ( this.setAttribute ) {\n\t\t\t\t\tthis.setAttribute( \"class\",\n\t\t\t\t\t\tclassName || value === false ?\n\t\t\t\t\t\t\"\" :\n\t\t\t\t\t\tdataPriv.get( this, \"__className__\" ) || \"\"\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t},\n\n\thasClass: function( selector ) {\n\t\tvar className, elem,\n\t\t\ti = 0;\n\n\t\tclassName = \" \" + selector + \" \";\n\t\twhile ( ( elem = this[ i++ ] ) ) {\n\t\t\tif ( elem.nodeType === 1 &&\n\t\t\t\t( \" \" + stripAndCollapse( getClass( elem ) ) + \" \" ).indexOf( className ) > -1 ) {\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n} );\n\n\n\n\nvar rreturn = /\\r/g;\n\njQuery.fn.extend( {\n\tval: function( value ) {\n\t\tvar hooks, ret, isFunction,\n\t\t\telem = this[ 0 ];\n\n\t\tif ( !arguments.length ) {\n\t\t\tif ( elem ) {\n\t\t\t\thooks = jQuery.valHooks[ elem.type ] ||\n\t\t\t\t\tjQuery.valHooks[ elem.nodeName.toLowerCase() ];\n\n\t\t\t\tif ( hooks &&\n\t\t\t\t\t\"get\" in hooks &&\n\t\t\t\t\t( ret = hooks.get( elem, \"value\" ) ) !== undefined\n\t\t\t\t) {\n\t\t\t\t\treturn ret;\n\t\t\t\t}\n\n\t\t\t\tret = elem.value;\n\n\t\t\t\t// Handle most common string cases\n\t\t\t\tif ( typeof ret === \"string\" ) {\n\t\t\t\t\treturn ret.replace( rreturn, \"\" );\n\t\t\t\t}\n\n\t\t\t\t// Handle cases where value is null/undef or number\n\t\t\t\treturn ret == null ? \"\" : ret;\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tisFunction = jQuery.isFunction( value );\n\n\t\treturn this.each( function( i ) {\n\t\t\tvar val;\n\n\t\t\tif ( this.nodeType !== 1 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( isFunction ) {\n\t\t\t\tval = value.call( this, i, jQuery( this ).val() );\n\t\t\t} else {\n\t\t\t\tval = value;\n\t\t\t}\n\n\t\t\t// Treat null/undefined as \"\"; convert numbers to string\n\t\t\tif ( val == null ) {\n\t\t\t\tval = \"\";\n\n\t\t\t} else if ( typeof val === \"number\" ) {\n\t\t\t\tval += \"\";\n\n\t\t\t} else if ( jQuery.isArray( val ) ) {\n\t\t\t\tval = jQuery.map( val, function( value ) {\n\t\t\t\t\treturn value == null ? \"\" : value + \"\";\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\thooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];\n\n\t\t\t// If set returns undefined, fall back to normal setting\n\t\t\tif ( !hooks || !( \"set\" in hooks ) || hooks.set( this, val, \"value\" ) === undefined ) {\n\t\t\t\tthis.value = val;\n\t\t\t}\n\t\t} );\n\t}\n} );\n\njQuery.extend( {\n\tvalHooks: {\n\t\toption: {\n\t\t\tget: function( elem ) {\n\n\t\t\t\tvar val = jQuery.find.attr( elem, \"value\" );\n\t\t\t\treturn val != null ?\n\t\t\t\t\tval :\n\n\t\t\t\t\t// Support: IE <=10 - 11 only\n\t\t\t\t\t// option.text throws exceptions (#14686, #14858)\n\t\t\t\t\t// Strip and collapse whitespace\n\t\t\t\t\t// https://html.spec.whatwg.org/#strip-and-collapse-whitespace\n\t\t\t\t\tstripAndCollapse( jQuery.text( elem ) );\n\t\t\t}\n\t\t},\n\t\tselect: {\n\t\t\tget: function( elem ) {\n\t\t\t\tvar value, option, i,\n\t\t\t\t\toptions = elem.options,\n\t\t\t\t\tindex = elem.selectedIndex,\n\t\t\t\t\tone = elem.type === \"select-one\",\n\t\t\t\t\tvalues = one ? null : [],\n\t\t\t\t\tmax = one ? index + 1 : options.length;\n\n\t\t\t\tif ( index < 0 ) {\n\t\t\t\t\ti = max;\n\n\t\t\t\t} else {\n\t\t\t\t\ti = one ? index : 0;\n\t\t\t\t}\n\n\t\t\t\t// Loop through all the selected options\n\t\t\t\tfor ( ; i < max; i++ ) {\n\t\t\t\t\toption = options[ i ];\n\n\t\t\t\t\t// Support: IE <=9 only\n\t\t\t\t\t// IE8-9 doesn't update selected after form reset (#2551)\n\t\t\t\t\tif ( ( option.selected || i === index ) &&\n\n\t\t\t\t\t\t\t// Don't return options that are disabled or in a disabled optgroup\n\t\t\t\t\t\t\t!option.disabled &&\n\t\t\t\t\t\t\t( !option.parentNode.disabled ||\n\t\t\t\t\t\t\t\t!jQuery.nodeName( option.parentNode, \"optgroup\" ) ) ) {\n\n\t\t\t\t\t\t// Get the specific value for the option\n\t\t\t\t\t\tvalue = jQuery( option ).val();\n\n\t\t\t\t\t\t// We don't need an array for one selects\n\t\t\t\t\t\tif ( one ) {\n\t\t\t\t\t\t\treturn value;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Multi-Selects return an array\n\t\t\t\t\t\tvalues.push( value );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn values;\n\t\t\t},\n\n\t\t\tset: function( elem, value ) {\n\t\t\t\tvar optionSet, option,\n\t\t\t\t\toptions = elem.options,\n\t\t\t\t\tvalues = jQuery.makeArray( value ),\n\t\t\t\t\ti = options.length;\n\n\t\t\t\twhile ( i-- ) {\n\t\t\t\t\toption = options[ i ];\n\n\t\t\t\t\t/* eslint-disable no-cond-assign */\n\n\t\t\t\t\tif ( option.selected =\n\t\t\t\t\t\tjQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1\n\t\t\t\t\t) {\n\t\t\t\t\t\toptionSet = true;\n\t\t\t\t\t}\n\n\t\t\t\t\t/* eslint-enable no-cond-assign */\n\t\t\t\t}\n\n\t\t\t\t// Force browsers to behave consistently when non-matching value is set\n\t\t\t\tif ( !optionSet ) {\n\t\t\t\t\telem.selectedIndex = -1;\n\t\t\t\t}\n\t\t\t\treturn values;\n\t\t\t}\n\t\t}\n\t}\n} );\n\n// Radios and checkboxes getter/setter\njQuery.each( [ \"radio\", \"checkbox\" ], function() {\n\tjQuery.valHooks[ this ] = {\n\t\tset: function( elem, value ) {\n\t\t\tif ( jQuery.isArray( value ) ) {\n\t\t\t\treturn ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );\n\t\t\t}\n\t\t}\n\t};\n\tif ( !support.checkOn ) {\n\t\tjQuery.valHooks[ this ].get = function( elem ) {\n\t\t\treturn elem.getAttribute( \"value\" ) === null ? \"on\" : elem.value;\n\t\t};\n\t}\n} );\n\n\n\n\n// Return jQuery for attributes-only inclusion\n\n\nvar rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;\n\njQuery.extend( jQuery.event, {\n\n\ttrigger: function( event, data, elem, onlyHandlers ) {\n\n\t\tvar i, cur, tmp, bubbleType, ontype, handle, special,\n\t\t\teventPath = [ elem || document ],\n\t\t\ttype = hasOwn.call( event, \"type\" ) ? event.type : event,\n\t\t\tnamespaces = hasOwn.call( event, \"namespace\" ) ? event.namespace.split( \".\" ) : [];\n\n\t\tcur = tmp = elem = elem || document;\n\n\t\t// Don't do events on text and comment nodes\n\t\tif ( elem.nodeType === 3 || elem.nodeType === 8 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// focus/blur morphs to focusin/out; ensure we're not firing them right now\n\t\tif ( rfocusMorph.test( type + jQuery.event.triggered ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( type.indexOf( \".\" ) > -1 ) {\n\n\t\t\t// Namespaced trigger; create a regexp to match event type in handle()\n\t\t\tnamespaces = type.split( \".\" );\n\t\t\ttype = namespaces.shift();\n\t\t\tnamespaces.sort();\n\t\t}\n\t\tontype = type.indexOf( \":\" ) < 0 && \"on\" + type;\n\n\t\t// Caller can pass in a jQuery.Event object, Object, or just an event type string\n\t\tevent = event[ jQuery.expando ] ?\n\t\t\tevent :\n\t\t\tnew jQuery.Event( type, typeof event === \"object\" && event );\n\n\t\t// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)\n\t\tevent.isTrigger = onlyHandlers ? 2 : 3;\n\t\tevent.namespace = namespaces.join( \".\" );\n\t\tevent.rnamespace = event.namespace ?\n\t\t\tnew RegExp( \"(^|\\\\.)\" + namespaces.join( \"\\\\.(?:.*\\\\.|)\" ) + \"(\\\\.|$)\" ) :\n\t\t\tnull;\n\n\t\t// Clean up the event in case it is being reused\n\t\tevent.result = undefined;\n\t\tif ( !event.target ) {\n\t\t\tevent.target = elem;\n\t\t}\n\n\t\t// Clone any incoming data and prepend the event, creating the handler arg list\n\t\tdata = data == null ?\n\t\t\t[ event ] :\n\t\t\tjQuery.makeArray( data, [ event ] );\n\n\t\t// Allow special events to draw outside the lines\n\t\tspecial = jQuery.event.special[ type ] || {};\n\t\tif ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Determine event propagation path in advance, per W3C events spec (#9951)\n\t\t// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)\n\t\tif ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {\n\n\t\t\tbubbleType = special.delegateType || type;\n\t\t\tif ( !rfocusMorph.test( bubbleType + type ) ) {\n\t\t\t\tcur = cur.parentNode;\n\t\t\t}\n\t\t\tfor ( ; cur; cur = cur.parentNode ) {\n\t\t\t\teventPath.push( cur );\n\t\t\t\ttmp = cur;\n\t\t\t}\n\n\t\t\t// Only add window if we got to document (e.g., not plain obj or detached DOM)\n\t\t\tif ( tmp === ( elem.ownerDocument || document ) ) {\n\t\t\t\teventPath.push( tmp.defaultView || tmp.parentWindow || window );\n\t\t\t}\n\t\t}\n\n\t\t// Fire handlers on the event path\n\t\ti = 0;\n\t\twhile ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {\n\n\t\t\tevent.type = i > 1 ?\n\t\t\t\tbubbleType :\n\t\t\t\tspecial.bindType || type;\n\n\t\t\t// jQuery handler\n\t\t\thandle = ( dataPriv.get( cur, \"events\" ) || {} )[ event.type ] &&\n\t\t\t\tdataPriv.get( cur, \"handle\" );\n\t\t\tif ( handle ) {\n\t\t\t\thandle.apply( cur, data );\n\t\t\t}\n\n\t\t\t// Native handler\n\t\t\thandle = ontype && cur[ ontype ];\n\t\t\tif ( handle && handle.apply && acceptData( cur ) ) {\n\t\t\t\tevent.result = handle.apply( cur, data );\n\t\t\t\tif ( event.result === false ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tevent.type = type;\n\n\t\t// If nobody prevented the default action, do it now\n\t\tif ( !onlyHandlers && !event.isDefaultPrevented() ) {\n\n\t\t\tif ( ( !special._default ||\n\t\t\t\tspecial._default.apply( eventPath.pop(), data ) === false ) &&\n\t\t\t\tacceptData( elem ) ) {\n\n\t\t\t\t// Call a native DOM method on the target with the same name as the event.\n\t\t\t\t// Don't do default actions on window, that's where global variables be (#6170)\n\t\t\t\tif ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {\n\n\t\t\t\t\t// Don't re-trigger an onFOO event when we call its FOO() method\n\t\t\t\t\ttmp = elem[ ontype ];\n\n\t\t\t\t\tif ( tmp ) {\n\t\t\t\t\t\telem[ ontype ] = null;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Prevent re-triggering of the same event, since we already bubbled it above\n\t\t\t\t\tjQuery.event.triggered = type;\n\t\t\t\t\telem[ type ]();\n\t\t\t\t\tjQuery.event.triggered = undefined;\n\n\t\t\t\t\tif ( tmp ) {\n\t\t\t\t\t\telem[ ontype ] = tmp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn event.result;\n\t},\n\n\t// Piggyback on a donor event to simulate a different one\n\t// Used only for `focus(in | out)` events\n\tsimulate: function( type, elem, event ) {\n\t\tvar e = jQuery.extend(\n\t\t\tnew jQuery.Event(),\n\t\t\tevent,\n\t\t\t{\n\t\t\t\ttype: type,\n\t\t\t\tisSimulated: true\n\t\t\t}\n\t\t);\n\n\t\tjQuery.event.trigger( e, null, elem );\n\t}\n\n} );\n\njQuery.fn.extend( {\n\n\ttrigger: function( type, data ) {\n\t\treturn this.each( function() {\n\t\t\tjQuery.event.trigger( type, data, this );\n\t\t} );\n\t},\n\ttriggerHandler: function( type, data ) {\n\t\tvar elem = this[ 0 ];\n\t\tif ( elem ) {\n\t\t\treturn jQuery.event.trigger( type, data, elem, true );\n\t\t}\n\t}\n} );\n\n\njQuery.each( ( \"blur focus focusin focusout resize scroll click dblclick \" +\n\t\"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave \" +\n\t\"change select submit keydown keypress keyup contextmenu\" ).split( \" \" ),\n\tfunction( i, name ) {\n\n\t// Handle event binding\n\tjQuery.fn[ name ] = function( data, fn ) {\n\t\treturn arguments.length > 0 ?\n\t\t\tthis.on( name, null, data, fn ) :\n\t\t\tthis.trigger( name );\n\t};\n} );\n\njQuery.fn.extend( {\n\thover: function( fnOver, fnOut ) {\n\t\treturn this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );\n\t}\n} );\n\n\n\n\nsupport.focusin = \"onfocusin\" in window;\n\n\n// Support: Firefox <=44\n// Firefox doesn't have focus(in | out) events\n// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787\n//\n// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1\n// focus(in | out) events fire after focus & blur events,\n// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order\n// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857\nif ( !support.focusin ) {\n\tjQuery.each( { focus: \"focusin\", blur: \"focusout\" }, function( orig, fix ) {\n\n\t\t// Attach a single capturing handler on the document while someone wants focusin/focusout\n\t\tvar handler = function( event ) {\n\t\t\tjQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );\n\t\t};\n\n\t\tjQuery.event.special[ fix ] = {\n\t\t\tsetup: function() {\n\t\t\t\tvar doc = this.ownerDocument || this,\n\t\t\t\t\tattaches = dataPriv.access( doc, fix );\n\n\t\t\t\tif ( !attaches ) {\n\t\t\t\t\tdoc.addEventListener( orig, handler, true );\n\t\t\t\t}\n\t\t\t\tdataPriv.access( doc, fix, ( attaches || 0 ) + 1 );\n\t\t\t},\n\t\t\tteardown: function() {\n\t\t\t\tvar doc = this.ownerDocument || this,\n\t\t\t\t\tattaches = dataPriv.access( doc, fix ) - 1;\n\n\t\t\t\tif ( !attaches ) {\n\t\t\t\t\tdoc.removeEventListener( orig, handler, true );\n\t\t\t\t\tdataPriv.remove( doc, fix );\n\n\t\t\t\t} else {\n\t\t\t\t\tdataPriv.access( doc, fix, attaches );\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t} );\n}\nvar location = window.location;\n\nvar nonce = jQuery.now();\n\nvar rquery = ( /\\?/ );\n\n\n\n// Cross-browser xml parsing\njQuery.parseXML = function( data ) {\n\tvar xml;\n\tif ( !data || typeof data !== \"string\" ) {\n\t\treturn null;\n\t}\n\n\t// Support: IE 9 - 11 only\n\t// IE throws on parseFromString with invalid input.\n\ttry {\n\t\txml = ( new window.DOMParser() ).parseFromString( data, \"text/xml\" );\n\t} catch ( e ) {\n\t\txml = undefined;\n\t}\n\n\tif ( !xml || xml.getElementsByTagName( \"parsererror\" ).length ) {\n\t\tjQuery.error( \"Invalid XML: \" + data );\n\t}\n\treturn xml;\n};\n\n\nvar\n\trbracket = /\\[\\]$/,\n\trCRLF = /\\r?\\n/g,\n\trsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,\n\trsubmittable = /^(?:input|select|textarea|keygen)/i;\n\nfunction buildParams( prefix, obj, traditional, add ) {\n\tvar name;\n\n\tif ( jQuery.isArray( obj ) ) {\n\n\t\t// Serialize array item.\n\t\tjQuery.each( obj, function( i, v ) {\n\t\t\tif ( traditional || rbracket.test( prefix ) ) {\n\n\t\t\t\t// Treat each array item as a scalar.\n\t\t\t\tadd( prefix, v );\n\n\t\t\t} else {\n\n\t\t\t\t// Item is non-scalar (array or object), encode its numeric index.\n\t\t\t\tbuildParams(\n\t\t\t\t\tprefix + \"[\" + ( typeof v === \"object\" && v != null ? i : \"\" ) + \"]\",\n\t\t\t\t\tv,\n\t\t\t\t\ttraditional,\n\t\t\t\t\tadd\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t} else if ( !traditional && jQuery.type( obj ) === \"object\" ) {\n\n\t\t// Serialize object item.\n\t\tfor ( name in obj ) {\n\t\t\tbuildParams( prefix + \"[\" + name + \"]\", obj[ name ], traditional, add );\n\t\t}\n\n\t} else {\n\n\t\t// Serialize scalar item.\n\t\tadd( prefix, obj );\n\t}\n}\n\n// Serialize an array of form elements or a set of\n// key/values into a query string\njQuery.param = function( a, traditional ) {\n\tvar prefix,\n\t\ts = [],\n\t\tadd = function( key, valueOrFunction ) {\n\n\t\t\t// If value is a function, invoke it and use its return value\n\t\t\tvar value = jQuery.isFunction( valueOrFunction ) ?\n\t\t\t\tvalueOrFunction() :\n\t\t\t\tvalueOrFunction;\n\n\t\t\ts[ s.length ] = encodeURIComponent( key ) + \"=\" +\n\t\t\t\tencodeURIComponent( value == null ? \"\" : value );\n\t\t};\n\n\t// If an array was passed in, assume that it is an array of form elements.\n\tif ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {\n\n\t\t// Serialize the form elements\n\t\tjQuery.each( a, function() {\n\t\t\tadd( this.name, this.value );\n\t\t} );\n\n\t} else {\n\n\t\t// If traditional, encode the \"old\" way (the way 1.3.2 or older\n\t\t// did it), otherwise encode params recursively.\n\t\tfor ( prefix in a ) {\n\t\t\tbuildParams( prefix, a[ prefix ], traditional, add );\n\t\t}\n\t}\n\n\t// Return the resulting serialization\n\treturn s.join( \"&\" );\n};\n\njQuery.fn.extend( {\n\tserialize: function() {\n\t\treturn jQuery.param( this.serializeArray() );\n\t},\n\tserializeArray: function() {\n\t\treturn this.map( function() {\n\n\t\t\t// Can add propHook for \"elements\" to filter or add form elements\n\t\t\tvar elements = jQuery.prop( this, \"elements\" );\n\t\t\treturn elements ? jQuery.makeArray( elements ) : this;\n\t\t} )\n\t\t.filter( function() {\n\t\t\tvar type = this.type;\n\n\t\t\t// Use .is( \":disabled\" ) so that fieldset[disabled] works\n\t\t\treturn this.name && !jQuery( this ).is( \":disabled\" ) &&\n\t\t\t\trsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&\n\t\t\t\t( this.checked || !rcheckableType.test( type ) );\n\t\t} )\n\t\t.map( function( i, elem ) {\n\t\t\tvar val = jQuery( this ).val();\n\n\t\t\tif ( val == null ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tif ( jQuery.isArray( val ) ) {\n\t\t\t\treturn jQuery.map( val, function( val ) {\n\t\t\t\t\treturn { name: elem.name, value: val.replace( rCRLF, \"\\r\\n\" ) };\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn { name: elem.name, value: val.replace( rCRLF, \"\\r\\n\" ) };\n\t\t} ).get();\n\t}\n} );\n\n\nvar\n\tr20 = /%20/g,\n\trhash = /#.*$/,\n\trantiCache = /([?&])_=[^&]*/,\n\trheaders = /^(.*?):[ \\t]*([^\\r\\n]*)$/mg,\n\n\t// #7653, #8125, #8152: local protocol detection\n\trlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,\n\trnoContent = /^(?:GET|HEAD)$/,\n\trprotocol = /^\\/\\//,\n\n\t/* Prefilters\n\t * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)\n\t * 2) These are called:\n\t *    - BEFORE asking for a transport\n\t *    - AFTER param serialization (s.data is a string if s.processData is true)\n\t * 3) key is the dataType\n\t * 4) the catchall symbol \"*\" can be used\n\t * 5) execution will start with transport dataType and THEN continue down to \"*\" if needed\n\t */\n\tprefilters = {},\n\n\t/* Transports bindings\n\t * 1) key is the dataType\n\t * 2) the catchall symbol \"*\" can be used\n\t * 3) selection will start with transport dataType and THEN go to \"*\" if needed\n\t */\n\ttransports = {},\n\n\t// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression\n\tallTypes = \"*/\".concat( \"*\" ),\n\n\t// Anchor tag for parsing the document origin\n\toriginAnchor = document.createElement( \"a\" );\n\toriginAnchor.href = location.href;\n\n// Base \"constructor\" for jQuery.ajaxPrefilter and jQuery.ajaxTransport\nfunction addToPrefiltersOrTransports( structure ) {\n\n\t// dataTypeExpression is optional and defaults to \"*\"\n\treturn function( dataTypeExpression, func ) {\n\n\t\tif ( typeof dataTypeExpression !== \"string\" ) {\n\t\t\tfunc = dataTypeExpression;\n\t\t\tdataTypeExpression = \"*\";\n\t\t}\n\n\t\tvar dataType,\n\t\t\ti = 0,\n\t\t\tdataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];\n\n\t\tif ( jQuery.isFunction( func ) ) {\n\n\t\t\t// For each dataType in the dataTypeExpression\n\t\t\twhile ( ( dataType = dataTypes[ i++ ] ) ) {\n\n\t\t\t\t// Prepend if requested\n\t\t\t\tif ( dataType[ 0 ] === \"+\" ) {\n\t\t\t\t\tdataType = dataType.slice( 1 ) || \"*\";\n\t\t\t\t\t( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );\n\n\t\t\t\t// Otherwise append\n\t\t\t\t} else {\n\t\t\t\t\t( structure[ dataType ] = structure[ dataType ] || [] ).push( func );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n}\n\n// Base inspection function for prefilters and transports\nfunction inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {\n\n\tvar inspected = {},\n\t\tseekingTransport = ( structure === transports );\n\n\tfunction inspect( dataType ) {\n\t\tvar selected;\n\t\tinspected[ dataType ] = true;\n\t\tjQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {\n\t\t\tvar dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );\n\t\t\tif ( typeof dataTypeOrTransport === \"string\" &&\n\t\t\t\t!seekingTransport && !inspected[ dataTypeOrTransport ] ) {\n\n\t\t\t\toptions.dataTypes.unshift( dataTypeOrTransport );\n\t\t\t\tinspect( dataTypeOrTransport );\n\t\t\t\treturn false;\n\t\t\t} else if ( seekingTransport ) {\n\t\t\t\treturn !( selected = dataTypeOrTransport );\n\t\t\t}\n\t\t} );\n\t\treturn selected;\n\t}\n\n\treturn inspect( options.dataTypes[ 0 ] ) || !inspected[ \"*\" ] && inspect( \"*\" );\n}\n\n// A special extend for ajax options\n// that takes \"flat\" options (not to be deep extended)\n// Fixes #9887\nfunction ajaxExtend( target, src ) {\n\tvar key, deep,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}\n\n/* Handles responses to an ajax request:\n * - finds the right dataType (mediates between content-type and expected dataType)\n * - returns the corresponding response\n */\nfunction ajaxHandleResponses( s, jqXHR, responses ) {\n\n\tvar ct, type, finalDataType, firstDataType,\n\t\tcontents = s.contents,\n\t\tdataTypes = s.dataTypes;\n\n\t// Remove auto dataType and get content-type in the process\n\twhile ( dataTypes[ 0 ] === \"*\" ) {\n\t\tdataTypes.shift();\n\t\tif ( ct === undefined ) {\n\t\t\tct = s.mimeType || jqXHR.getResponseHeader( \"Content-Type\" );\n\t\t}\n\t}\n\n\t// Check if we're dealing with a known content-type\n\tif ( ct ) {\n\t\tfor ( type in contents ) {\n\t\t\tif ( contents[ type ] && contents[ type ].test( ct ) ) {\n\t\t\t\tdataTypes.unshift( type );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check to see if we have a response for the expected dataType\n\tif ( dataTypes[ 0 ] in responses ) {\n\t\tfinalDataType = dataTypes[ 0 ];\n\t} else {\n\n\t\t// Try convertible dataTypes\n\t\tfor ( type in responses ) {\n\t\t\tif ( !dataTypes[ 0 ] || s.converters[ type + \" \" + dataTypes[ 0 ] ] ) {\n\t\t\t\tfinalDataType = type;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( !firstDataType ) {\n\t\t\t\tfirstDataType = type;\n\t\t\t}\n\t\t}\n\n\t\t// Or just use first one\n\t\tfinalDataType = finalDataType || firstDataType;\n\t}\n\n\t// If we found a dataType\n\t// We add the dataType to the list if needed\n\t// and return the corresponding response\n\tif ( finalDataType ) {\n\t\tif ( finalDataType !== dataTypes[ 0 ] ) {\n\t\t\tdataTypes.unshift( finalDataType );\n\t\t}\n\t\treturn responses[ finalDataType ];\n\t}\n}\n\n/* Chain conversions given the request and the original response\n * Also sets the responseXXX fields on the jqXHR instance\n */\nfunction ajaxConvert( s, response, jqXHR, isSuccess ) {\n\tvar conv2, current, conv, tmp, prev,\n\t\tconverters = {},\n\n\t\t// Work with a copy of dataTypes in case we need to modify it for conversion\n\t\tdataTypes = s.dataTypes.slice();\n\n\t// Create converters map with lowercased keys\n\tif ( dataTypes[ 1 ] ) {\n\t\tfor ( conv in s.converters ) {\n\t\t\tconverters[ conv.toLowerCase() ] = s.converters[ conv ];\n\t\t}\n\t}\n\n\tcurrent = dataTypes.shift();\n\n\t// Convert to each sequential dataType\n\twhile ( current ) {\n\n\t\tif ( s.responseFields[ current ] ) {\n\t\t\tjqXHR[ s.responseFields[ current ] ] = response;\n\t\t}\n\n\t\t// Apply the dataFilter if provided\n\t\tif ( !prev && isSuccess && s.dataFilter ) {\n\t\t\tresponse = s.dataFilter( response, s.dataType );\n\t\t}\n\n\t\tprev = current;\n\t\tcurrent = dataTypes.shift();\n\n\t\tif ( current ) {\n\n\t\t\t// There's only work to do if current dataType is non-auto\n\t\t\tif ( current === \"*\" ) {\n\n\t\t\t\tcurrent = prev;\n\n\t\t\t// Convert response if prev dataType is non-auto and differs from current\n\t\t\t} else if ( prev !== \"*\" && prev !== current ) {\n\n\t\t\t\t// Seek a direct converter\n\t\t\t\tconv = converters[ prev + \" \" + current ] || converters[ \"* \" + current ];\n\n\t\t\t\t// If none found, seek a pair\n\t\t\t\tif ( !conv ) {\n\t\t\t\t\tfor ( conv2 in converters ) {\n\n\t\t\t\t\t\t// If conv2 outputs current\n\t\t\t\t\t\ttmp = conv2.split( \" \" );\n\t\t\t\t\t\tif ( tmp[ 1 ] === current ) {\n\n\t\t\t\t\t\t\t// If prev can be converted to accepted input\n\t\t\t\t\t\t\tconv = converters[ prev + \" \" + tmp[ 0 ] ] ||\n\t\t\t\t\t\t\t\tconverters[ \"* \" + tmp[ 0 ] ];\n\t\t\t\t\t\t\tif ( conv ) {\n\n\t\t\t\t\t\t\t\t// Condense equivalence converters\n\t\t\t\t\t\t\t\tif ( conv === true ) {\n\t\t\t\t\t\t\t\t\tconv = converters[ conv2 ];\n\n\t\t\t\t\t\t\t\t// Otherwise, insert the intermediate dataType\n\t\t\t\t\t\t\t\t} else if ( converters[ conv2 ] !== true ) {\n\t\t\t\t\t\t\t\t\tcurrent = tmp[ 0 ];\n\t\t\t\t\t\t\t\t\tdataTypes.unshift( tmp[ 1 ] );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Apply converter (if not an equivalence)\n\t\t\t\tif ( conv !== true ) {\n\n\t\t\t\t\t// Unless errors are allowed to bubble, catch and return them\n\t\t\t\t\tif ( conv && s.throws ) {\n\t\t\t\t\t\tresponse = conv( response );\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tresponse = conv( response );\n\t\t\t\t\t\t} catch ( e ) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\tstate: \"parsererror\",\n\t\t\t\t\t\t\t\terror: conv ? e : \"No conversion from \" + prev + \" to \" + current\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { state: \"success\", data: response };\n}\n\njQuery.extend( {\n\n\t// Counter for holding the number of active queries\n\tactive: 0,\n\n\t// Last-Modified header cache for next request\n\tlastModified: {},\n\tetag: {},\n\n\tajaxSettings: {\n\t\turl: location.href,\n\t\ttype: \"GET\",\n\t\tisLocal: rlocalProtocol.test( location.protocol ),\n\t\tglobal: true,\n\t\tprocessData: true,\n\t\tasync: true,\n\t\tcontentType: \"application/x-www-form-urlencoded; charset=UTF-8\",\n\n\t\t/*\n\t\ttimeout: 0,\n\t\tdata: null,\n\t\tdataType: null,\n\t\tusername: null,\n\t\tpassword: null,\n\t\tcache: null,\n\t\tthrows: false,\n\t\ttraditional: false,\n\t\theaders: {},\n\t\t*/\n\n\t\taccepts: {\n\t\t\t\"*\": allTypes,\n\t\t\ttext: \"text/plain\",\n\t\t\thtml: \"text/html\",\n\t\t\txml: \"application/xml, text/xml\",\n\t\t\tjson: \"application/json, text/javascript\"\n\t\t},\n\n\t\tcontents: {\n\t\t\txml: /\\bxml\\b/,\n\t\t\thtml: /\\bhtml/,\n\t\t\tjson: /\\bjson\\b/\n\t\t},\n\n\t\tresponseFields: {\n\t\t\txml: \"responseXML\",\n\t\t\ttext: \"responseText\",\n\t\t\tjson: \"responseJSON\"\n\t\t},\n\n\t\t// Data converters\n\t\t// Keys separate source (or catchall \"*\") and destination types with a single space\n\t\tconverters: {\n\n\t\t\t// Convert anything to text\n\t\t\t\"* text\": String,\n\n\t\t\t// Text to html (true = no transformation)\n\t\t\t\"text html\": true,\n\n\t\t\t// Evaluate text as a json expression\n\t\t\t\"text json\": JSON.parse,\n\n\t\t\t// Parse text as xml\n\t\t\t\"text xml\": jQuery.parseXML\n\t\t},\n\n\t\t// For options that shouldn't be deep extended:\n\t\t// you can add your own custom options here if\n\t\t// and when you create one that shouldn't be\n\t\t// deep extended (see ajaxExtend)\n\t\tflatOptions: {\n\t\t\turl: true,\n\t\t\tcontext: true\n\t\t}\n\t},\n\n\t// Creates a full fledged settings object into target\n\t// with both ajaxSettings and settings fields.\n\t// If target is omitted, writes into ajaxSettings.\n\tajaxSetup: function( target, settings ) {\n\t\treturn settings ?\n\n\t\t\t// Building a settings object\n\t\t\tajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :\n\n\t\t\t// Extending ajaxSettings\n\t\t\tajaxExtend( jQuery.ajaxSettings, target );\n\t},\n\n\tajaxPrefilter: addToPrefiltersOrTransports( prefilters ),\n\tajaxTransport: addToPrefiltersOrTransports( transports ),\n\n\t// Main method\n\tajax: function( url, options ) {\n\n\t\t// If url is an object, simulate pre-1.5 signature\n\t\tif ( typeof url === \"object\" ) {\n\t\t\toptions = url;\n\t\t\turl = undefined;\n\t\t}\n\n\t\t// Force options to be an object\n\t\toptions = options || {};\n\n\t\tvar transport,\n\n\t\t\t// URL without anti-cache param\n\t\t\tcacheURL,\n\n\t\t\t// Response headers\n\t\t\tresponseHeadersString,\n\t\t\tresponseHeaders,\n\n\t\t\t// timeout handle\n\t\t\ttimeoutTimer,\n\n\t\t\t// Url cleanup var\n\t\t\turlAnchor,\n\n\t\t\t// Request state (becomes false upon send and true upon completion)\n\t\t\tcompleted,\n\n\t\t\t// To know if global events are to be dispatched\n\t\t\tfireGlobals,\n\n\t\t\t// Loop variable\n\t\t\ti,\n\n\t\t\t// uncached part of the url\n\t\t\tuncached,\n\n\t\t\t// Create the final options object\n\t\t\ts = jQuery.ajaxSetup( {}, options ),\n\n\t\t\t// Callbacks context\n\t\t\tcallbackContext = s.context || s,\n\n\t\t\t// Context for global events is callbackContext if it is a DOM node or jQuery collection\n\t\t\tglobalEventContext = s.context &&\n\t\t\t\t( callbackContext.nodeType || callbackContext.jquery ) ?\n\t\t\t\t\tjQuery( callbackContext ) :\n\t\t\t\t\tjQuery.event,\n\n\t\t\t// Deferreds\n\t\t\tdeferred = jQuery.Deferred(),\n\t\t\tcompleteDeferred = jQuery.Callbacks( \"once memory\" ),\n\n\t\t\t// Status-dependent callbacks\n\t\t\tstatusCode = s.statusCode || {},\n\n\t\t\t// Headers (they are sent all at once)\n\t\t\trequestHeaders = {},\n\t\t\trequestHeadersNames = {},\n\n\t\t\t// Default abort message\n\t\t\tstrAbort = \"canceled\",\n\n\t\t\t// Fake xhr\n\t\t\tjqXHR = {\n\t\t\t\treadyState: 0,\n\n\t\t\t\t// Builds headers hashtable if needed\n\t\t\t\tgetResponseHeader: function( key ) {\n\t\t\t\t\tvar match;\n\t\t\t\t\tif ( completed ) {\n\t\t\t\t\t\tif ( !responseHeaders ) {\n\t\t\t\t\t\t\tresponseHeaders = {};\n\t\t\t\t\t\t\twhile ( ( match = rheaders.exec( responseHeadersString ) ) ) {\n\t\t\t\t\t\t\t\tresponseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmatch = responseHeaders[ key.toLowerCase() ];\n\t\t\t\t\t}\n\t\t\t\t\treturn match == null ? null : match;\n\t\t\t\t},\n\n\t\t\t\t// Raw string\n\t\t\t\tgetAllResponseHeaders: function() {\n\t\t\t\t\treturn completed ? responseHeadersString : null;\n\t\t\t\t},\n\n\t\t\t\t// Caches the header\n\t\t\t\tsetRequestHeader: function( name, value ) {\n\t\t\t\t\tif ( completed == null ) {\n\t\t\t\t\t\tname = requestHeadersNames[ name.toLowerCase() ] =\n\t\t\t\t\t\t\trequestHeadersNames[ name.toLowerCase() ] || name;\n\t\t\t\t\t\trequestHeaders[ name ] = value;\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// Overrides response content-type header\n\t\t\t\toverrideMimeType: function( type ) {\n\t\t\t\t\tif ( completed == null ) {\n\t\t\t\t\t\ts.mimeType = type;\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// Status-dependent callbacks\n\t\t\t\tstatusCode: function( map ) {\n\t\t\t\t\tvar code;\n\t\t\t\t\tif ( map ) {\n\t\t\t\t\t\tif ( completed ) {\n\n\t\t\t\t\t\t\t// Execute the appropriate callbacks\n\t\t\t\t\t\t\tjqXHR.always( map[ jqXHR.status ] );\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// Lazy-add the new callbacks in a way that preserves old ones\n\t\t\t\t\t\t\tfor ( code in map ) {\n\t\t\t\t\t\t\t\tstatusCode[ code ] = [ statusCode[ code ], map[ code ] ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// Cancel the request\n\t\t\t\tabort: function( statusText ) {\n\t\t\t\t\tvar finalText = statusText || strAbort;\n\t\t\t\t\tif ( transport ) {\n\t\t\t\t\t\ttransport.abort( finalText );\n\t\t\t\t\t}\n\t\t\t\t\tdone( 0, finalText );\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\t\t\t};\n\n\t\t// Attach deferreds\n\t\tdeferred.promise( jqXHR );\n\n\t\t// Add protocol if not provided (prefilters might expect it)\n\t\t// Handle falsy url in the settings object (#10093: consistency with old signature)\n\t\t// We also use the url parameter if available\n\t\ts.url = ( ( url || s.url || location.href ) + \"\" )\n\t\t\t.replace( rprotocol, location.protocol + \"//\" );\n\n\t\t// Alias method option to type as per ticket #12004\n\t\ts.type = options.method || options.type || s.method || s.type;\n\n\t\t// Extract dataTypes list\n\t\ts.dataTypes = ( s.dataType || \"*\" ).toLowerCase().match( rnothtmlwhite ) || [ \"\" ];\n\n\t\t// A cross-domain request is in order when the origin doesn't match the current origin.\n\t\tif ( s.crossDomain == null ) {\n\t\t\turlAnchor = document.createElement( \"a\" );\n\n\t\t\t// Support: IE <=8 - 11, Edge 12 - 13\n\t\t\t// IE throws exception on accessing the href property if url is malformed,\n\t\t\t// e.g. http://example.com:80x/\n\t\t\ttry {\n\t\t\t\turlAnchor.href = s.url;\n\n\t\t\t\t// Support: IE <=8 - 11 only\n\t\t\t\t// Anchor's host property isn't correctly set when s.url is relative\n\t\t\t\turlAnchor.href = urlAnchor.href;\n\t\t\t\ts.crossDomain = originAnchor.protocol + \"//\" + originAnchor.host !==\n\t\t\t\t\turlAnchor.protocol + \"//\" + urlAnchor.host;\n\t\t\t} catch ( e ) {\n\n\t\t\t\t// If there is an error parsing the URL, assume it is crossDomain,\n\t\t\t\t// it can be rejected by the transport if it is invalid\n\t\t\t\ts.crossDomain = true;\n\t\t\t}\n\t\t}\n\n\t\t// Convert data if not already a string\n\t\tif ( s.data && s.processData && typeof s.data !== \"string\" ) {\n\t\t\ts.data = jQuery.param( s.data, s.traditional );\n\t\t}\n\n\t\t// Apply prefilters\n\t\tinspectPrefiltersOrTransports( prefilters, s, options, jqXHR );\n\n\t\t// If request was aborted inside a prefilter, stop there\n\t\tif ( completed ) {\n\t\t\treturn jqXHR;\n\t\t}\n\n\t\t// We can fire global events as of now if asked to\n\t\t// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)\n\t\tfireGlobals = jQuery.event && s.global;\n\n\t\t// Watch for a new set of requests\n\t\tif ( fireGlobals && jQuery.active++ === 0 ) {\n\t\t\tjQuery.event.trigger( \"ajaxStart\" );\n\t\t}\n\n\t\t// Uppercase the type\n\t\ts.type = s.type.toUpperCase();\n\n\t\t// Determine if request has content\n\t\ts.hasContent = !rnoContent.test( s.type );\n\n\t\t// Save the URL in case we're toying with the If-Modified-Since\n\t\t// and/or If-None-Match header later on\n\t\t// Remove hash to simplify url manipulation\n\t\tcacheURL = s.url.replace( rhash, \"\" );\n\n\t\t// More options handling for requests with no content\n\t\tif ( !s.hasContent ) {\n\n\t\t\t// Remember the hash so we can put it back\n\t\t\tuncached = s.url.slice( cacheURL.length );\n\n\t\t\t// If data is available, append data to url\n\t\t\tif ( s.data ) {\n\t\t\t\tcacheURL += ( rquery.test( cacheURL ) ? \"&\" : \"?\" ) + s.data;\n\n\t\t\t\t// #9682: remove data so that it's not used in an eventual retry\n\t\t\t\tdelete s.data;\n\t\t\t}\n\n\t\t\t// Add or update anti-cache param if needed\n\t\t\tif ( s.cache === false ) {\n\t\t\t\tcacheURL = cacheURL.replace( rantiCache, \"$1\" );\n\t\t\t\tuncached = ( rquery.test( cacheURL ) ? \"&\" : \"?\" ) + \"_=\" + ( nonce++ ) + uncached;\n\t\t\t}\n\n\t\t\t// Put hash and anti-cache on the URL that will be requested (gh-1732)\n\t\t\ts.url = cacheURL + uncached;\n\n\t\t// Change '%20' to '+' if this is encoded form body content (gh-2658)\n\t\t} else if ( s.data && s.processData &&\n\t\t\t( s.contentType || \"\" ).indexOf( \"application/x-www-form-urlencoded\" ) === 0 ) {\n\t\t\ts.data = s.data.replace( r20, \"+\" );\n\t\t}\n\n\t\t// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n\t\tif ( s.ifModified ) {\n\t\t\tif ( jQuery.lastModified[ cacheURL ] ) {\n\t\t\t\tjqXHR.setRequestHeader( \"If-Modified-Since\", jQuery.lastModified[ cacheURL ] );\n\t\t\t}\n\t\t\tif ( jQuery.etag[ cacheURL ] ) {\n\t\t\t\tjqXHR.setRequestHeader( \"If-None-Match\", jQuery.etag[ cacheURL ] );\n\t\t\t}\n\t\t}\n\n\t\t// Set the correct header, if data is being sent\n\t\tif ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {\n\t\t\tjqXHR.setRequestHeader( \"Content-Type\", s.contentType );\n\t\t}\n\n\t\t// Set the Accepts header for the server, depending on the dataType\n\t\tjqXHR.setRequestHeader(\n\t\t\t\"Accept\",\n\t\t\ts.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?\n\t\t\t\ts.accepts[ s.dataTypes[ 0 ] ] +\n\t\t\t\t\t( s.dataTypes[ 0 ] !== \"*\" ? \", \" + allTypes + \"; q=0.01\" : \"\" ) :\n\t\t\t\ts.accepts[ \"*\" ]\n\t\t);\n\n\t\t// Check for headers option\n\t\tfor ( i in s.headers ) {\n\t\t\tjqXHR.setRequestHeader( i, s.headers[ i ] );\n\t\t}\n\n\t\t// Allow custom headers/mimetypes and early abort\n\t\tif ( s.beforeSend &&\n\t\t\t( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {\n\n\t\t\t// Abort if not done already and return\n\t\t\treturn jqXHR.abort();\n\t\t}\n\n\t\t// Aborting is no longer a cancellation\n\t\tstrAbort = \"abort\";\n\n\t\t// Install callbacks on deferreds\n\t\tcompleteDeferred.add( s.complete );\n\t\tjqXHR.done( s.success );\n\t\tjqXHR.fail( s.error );\n\n\t\t// Get transport\n\t\ttransport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );\n\n\t\t// If no transport, we auto-abort\n\t\tif ( !transport ) {\n\t\t\tdone( -1, \"No Transport\" );\n\t\t} else {\n\t\t\tjqXHR.readyState = 1;\n\n\t\t\t// Send global event\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( \"ajaxSend\", [ jqXHR, s ] );\n\t\t\t}\n\n\t\t\t// If request was aborted inside ajaxSend, stop there\n\t\t\tif ( completed ) {\n\t\t\t\treturn jqXHR;\n\t\t\t}\n\n\t\t\t// Timeout\n\t\t\tif ( s.async && s.timeout > 0 ) {\n\t\t\t\ttimeoutTimer = window.setTimeout( function() {\n\t\t\t\t\tjqXHR.abort( \"timeout\" );\n\t\t\t\t}, s.timeout );\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tcompleted = false;\n\t\t\t\ttransport.send( requestHeaders, done );\n\t\t\t} catch ( e ) {\n\n\t\t\t\t// Rethrow post-completion exceptions\n\t\t\t\tif ( completed ) {\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\n\t\t\t\t// Propagate others as results\n\t\t\t\tdone( -1, e );\n\t\t\t}\n\t\t}\n\n\t\t// Callback for when everything is done\n\t\tfunction done( status, nativeStatusText, responses, headers ) {\n\t\t\tvar isSuccess, success, error, response, modified,\n\t\t\t\tstatusText = nativeStatusText;\n\n\t\t\t// Ignore repeat invocations\n\t\t\tif ( completed ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tcompleted = true;\n\n\t\t\t// Clear timeout if it exists\n\t\t\tif ( timeoutTimer ) {\n\t\t\t\twindow.clearTimeout( timeoutTimer );\n\t\t\t}\n\n\t\t\t// Dereference transport for early garbage collection\n\t\t\t// (no matter how long the jqXHR object will be used)\n\t\t\ttransport = undefined;\n\n\t\t\t// Cache response headers\n\t\t\tresponseHeadersString = headers || \"\";\n\n\t\t\t// Set readyState\n\t\t\tjqXHR.readyState = status > 0 ? 4 : 0;\n\n\t\t\t// Determine if successful\n\t\t\tisSuccess = status >= 200 && status < 300 || status === 304;\n\n\t\t\t// Get response data\n\t\t\tif ( responses ) {\n\t\t\t\tresponse = ajaxHandleResponses( s, jqXHR, responses );\n\t\t\t}\n\n\t\t\t// Convert no matter what (that way responseXXX fields are always set)\n\t\t\tresponse = ajaxConvert( s, response, jqXHR, isSuccess );\n\n\t\t\t// If successful, handle type chaining\n\t\t\tif ( isSuccess ) {\n\n\t\t\t\t// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n\t\t\t\tif ( s.ifModified ) {\n\t\t\t\t\tmodified = jqXHR.getResponseHeader( \"Last-Modified\" );\n\t\t\t\t\tif ( modified ) {\n\t\t\t\t\t\tjQuery.lastModified[ cacheURL ] = modified;\n\t\t\t\t\t}\n\t\t\t\t\tmodified = jqXHR.getResponseHeader( \"etag\" );\n\t\t\t\t\tif ( modified ) {\n\t\t\t\t\t\tjQuery.etag[ cacheURL ] = modified;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// if no content\n\t\t\t\tif ( status === 204 || s.type === \"HEAD\" ) {\n\t\t\t\t\tstatusText = \"nocontent\";\n\n\t\t\t\t// if not modified\n\t\t\t\t} else if ( status === 304 ) {\n\t\t\t\t\tstatusText = \"notmodified\";\n\n\t\t\t\t// If we have data, let's convert it\n\t\t\t\t} else {\n\t\t\t\t\tstatusText = response.state;\n\t\t\t\t\tsuccess = response.data;\n\t\t\t\t\terror = response.error;\n\t\t\t\t\tisSuccess = !error;\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\t// Extract error from statusText and normalize for non-aborts\n\t\t\t\terror = statusText;\n\t\t\t\tif ( status || !statusText ) {\n\t\t\t\t\tstatusText = \"error\";\n\t\t\t\t\tif ( status < 0 ) {\n\t\t\t\t\t\tstatus = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Set data for the fake xhr object\n\t\t\tjqXHR.status = status;\n\t\t\tjqXHR.statusText = ( nativeStatusText || statusText ) + \"\";\n\n\t\t\t// Success/Error\n\t\t\tif ( isSuccess ) {\n\t\t\t\tdeferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );\n\t\t\t} else {\n\t\t\t\tdeferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );\n\t\t\t}\n\n\t\t\t// Status-dependent callbacks\n\t\t\tjqXHR.statusCode( statusCode );\n\t\t\tstatusCode = undefined;\n\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( isSuccess ? \"ajaxSuccess\" : \"ajaxError\",\n\t\t\t\t\t[ jqXHR, s, isSuccess ? success : error ] );\n\t\t\t}\n\n\t\t\t// Complete\n\t\t\tcompleteDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );\n\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( \"ajaxComplete\", [ jqXHR, s ] );\n\n\t\t\t\t// Handle the global AJAX counter\n\t\t\t\tif ( !( --jQuery.active ) ) {\n\t\t\t\t\tjQuery.event.trigger( \"ajaxStop\" );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn jqXHR;\n\t},\n\n\tgetJSON: function( url, data, callback ) {\n\t\treturn jQuery.get( url, data, callback, \"json\" );\n\t},\n\n\tgetScript: function( url, callback ) {\n\t\treturn jQuery.get( url, undefined, callback, \"script\" );\n\t}\n} );\n\njQuery.each( [ \"get\", \"post\" ], function( i, method ) {\n\tjQuery[ method ] = function( url, data, callback, type ) {\n\n\t\t// Shift arguments if data argument was omitted\n\t\tif ( jQuery.isFunction( data ) ) {\n\t\t\ttype = type || callback;\n\t\t\tcallback = data;\n\t\t\tdata = undefined;\n\t\t}\n\n\t\t// The url can be an options object (which then must have .url)\n\t\treturn jQuery.ajax( jQuery.extend( {\n\t\t\turl: url,\n\t\t\ttype: method,\n\t\t\tdataType: type,\n\t\t\tdata: data,\n\t\t\tsuccess: callback\n\t\t}, jQuery.isPlainObject( url ) && url ) );\n\t};\n} );\n\n\njQuery._evalUrl = function( url ) {\n\treturn jQuery.ajax( {\n\t\turl: url,\n\n\t\t// Make this explicit, since user can override this through ajaxSetup (#11264)\n\t\ttype: \"GET\",\n\t\tdataType: \"script\",\n\t\tcache: true,\n\t\tasync: false,\n\t\tglobal: false,\n\t\t\"throws\": true\n\t} );\n};\n\n\njQuery.fn.extend( {\n\twrapAll: function( html ) {\n\t\tvar wrap;\n\n\t\tif ( this[ 0 ] ) {\n\t\t\tif ( jQuery.isFunction( html ) ) {\n\t\t\t\thtml = html.call( this[ 0 ] );\n\t\t\t}\n\n\t\t\t// The elements to wrap the target around\n\t\t\twrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );\n\n\t\t\tif ( this[ 0 ].parentNode ) {\n\t\t\t\twrap.insertBefore( this[ 0 ] );\n\t\t\t}\n\n\t\t\twrap.map( function() {\n\t\t\t\tvar elem = this;\n\n\t\t\t\twhile ( elem.firstElementChild ) {\n\t\t\t\t\telem = elem.firstElementChild;\n\t\t\t\t}\n\n\t\t\t\treturn elem;\n\t\t\t} ).append( this );\n\t\t}\n\n\t\treturn this;\n\t},\n\n\twrapInner: function( html ) {\n\t\tif ( jQuery.isFunction( html ) ) {\n\t\t\treturn this.each( function( i ) {\n\t\t\t\tjQuery( this ).wrapInner( html.call( this, i ) );\n\t\t\t} );\n\t\t}\n\n\t\treturn this.each( function() {\n\t\t\tvar self = jQuery( this ),\n\t\t\t\tcontents = self.contents();\n\n\t\t\tif ( contents.length ) {\n\t\t\t\tcontents.wrapAll( html );\n\n\t\t\t} else {\n\t\t\t\tself.append( html );\n\t\t\t}\n\t\t} );\n\t},\n\n\twrap: function( html ) {\n\t\tvar isFunction = jQuery.isFunction( html );\n\n\t\treturn this.each( function( i ) {\n\t\t\tjQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );\n\t\t} );\n\t},\n\n\tunwrap: function( selector ) {\n\t\tthis.parent( selector ).not( \"body\" ).each( function() {\n\t\t\tjQuery( this ).replaceWith( this.childNodes );\n\t\t} );\n\t\treturn this;\n\t}\n} );\n\n\njQuery.expr.pseudos.hidden = function( elem ) {\n\treturn !jQuery.expr.pseudos.visible( elem );\n};\njQuery.expr.pseudos.visible = function( elem ) {\n\treturn !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );\n};\n\n\n\n\njQuery.ajaxSettings.xhr = function() {\n\ttry {\n\t\treturn new window.XMLHttpRequest();\n\t} catch ( e ) {}\n};\n\nvar xhrSuccessStatus = {\n\n\t\t// File protocol always yields status code 0, assume 200\n\t\t0: 200,\n\n\t\t// Support: IE <=9 only\n\t\t// #1450: sometimes IE returns 1223 when it should be 204\n\t\t1223: 204\n\t},\n\txhrSupported = jQuery.ajaxSettings.xhr();\n\nsupport.cors = !!xhrSupported && ( \"withCredentials\" in xhrSupported );\nsupport.ajax = xhrSupported = !!xhrSupported;\n\njQuery.ajaxTransport( function( options ) {\n\tvar callback, errorCallback;\n\n\t// Cross domain only allowed if supported through XMLHttpRequest\n\tif ( support.cors || xhrSupported && !options.crossDomain ) {\n\t\treturn {\n\t\t\tsend: function( headers, complete ) {\n\t\t\t\tvar i,\n\t\t\t\t\txhr = options.xhr();\n\n\t\t\t\txhr.open(\n\t\t\t\t\toptions.type,\n\t\t\t\t\toptions.url,\n\t\t\t\t\toptions.async,\n\t\t\t\t\toptions.username,\n\t\t\t\t\toptions.password\n\t\t\t\t);\n\n\t\t\t\t// Apply custom fields if provided\n\t\t\t\tif ( options.xhrFields ) {\n\t\t\t\t\tfor ( i in options.xhrFields ) {\n\t\t\t\t\t\txhr[ i ] = options.xhrFields[ i ];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Override mime type if needed\n\t\t\t\tif ( options.mimeType && xhr.overrideMimeType ) {\n\t\t\t\t\txhr.overrideMimeType( options.mimeType );\n\t\t\t\t}\n\n\t\t\t\t// X-Requested-With header\n\t\t\t\t// For cross-domain requests, seeing as conditions for a preflight are\n\t\t\t\t// akin to a jigsaw puzzle, we simply never set it to be sure.\n\t\t\t\t// (it can always be set on a per-request basis or even using ajaxSetup)\n\t\t\t\t// For same-domain requests, won't change header if already provided.\n\t\t\t\tif ( !options.crossDomain && !headers[ \"X-Requested-With\" ] ) {\n\t\t\t\t\theaders[ \"X-Requested-With\" ] = \"XMLHttpRequest\";\n\t\t\t\t}\n\n\t\t\t\t// Set headers\n\t\t\t\tfor ( i in headers ) {\n\t\t\t\t\txhr.setRequestHeader( i, headers[ i ] );\n\t\t\t\t}\n\n\t\t\t\t// Callback\n\t\t\t\tcallback = function( type ) {\n\t\t\t\t\treturn function() {\n\t\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\t\tcallback = errorCallback = xhr.onload =\n\t\t\t\t\t\t\t\txhr.onerror = xhr.onabort = xhr.onreadystatechange = null;\n\n\t\t\t\t\t\t\tif ( type === \"abort\" ) {\n\t\t\t\t\t\t\t\txhr.abort();\n\t\t\t\t\t\t\t} else if ( type === \"error\" ) {\n\n\t\t\t\t\t\t\t\t// Support: IE <=9 only\n\t\t\t\t\t\t\t\t// On a manual native abort, IE9 throws\n\t\t\t\t\t\t\t\t// errors on any property access that is not readyState\n\t\t\t\t\t\t\t\tif ( typeof xhr.status !== \"number\" ) {\n\t\t\t\t\t\t\t\t\tcomplete( 0, \"error\" );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tcomplete(\n\n\t\t\t\t\t\t\t\t\t\t// File: protocol always yields status 0; see #8605, #14207\n\t\t\t\t\t\t\t\t\t\txhr.status,\n\t\t\t\t\t\t\t\t\t\txhr.statusText\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcomplete(\n\t\t\t\t\t\t\t\t\txhrSuccessStatus[ xhr.status ] || xhr.status,\n\t\t\t\t\t\t\t\t\txhr.statusText,\n\n\t\t\t\t\t\t\t\t\t// Support: IE <=9 only\n\t\t\t\t\t\t\t\t\t// IE9 has no XHR2 but throws on binary (trac-11426)\n\t\t\t\t\t\t\t\t\t// For XHR2 non-text, let the caller handle it (gh-2498)\n\t\t\t\t\t\t\t\t\t( xhr.responseType || \"text\" ) !== \"text\"  ||\n\t\t\t\t\t\t\t\t\ttypeof xhr.responseText !== \"string\" ?\n\t\t\t\t\t\t\t\t\t\t{ binary: xhr.response } :\n\t\t\t\t\t\t\t\t\t\t{ text: xhr.responseText },\n\t\t\t\t\t\t\t\t\txhr.getAllResponseHeaders()\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t};\n\n\t\t\t\t// Listen to events\n\t\t\t\txhr.onload = callback();\n\t\t\t\terrorCallback = xhr.onerror = callback( \"error\" );\n\n\t\t\t\t// Support: IE 9 only\n\t\t\t\t// Use onreadystatechange to replace onabort\n\t\t\t\t// to handle uncaught aborts\n\t\t\t\tif ( xhr.onabort !== undefined ) {\n\t\t\t\t\txhr.onabort = errorCallback;\n\t\t\t\t} else {\n\t\t\t\t\txhr.onreadystatechange = function() {\n\n\t\t\t\t\t\t// Check readyState before timeout as it changes\n\t\t\t\t\t\tif ( xhr.readyState === 4 ) {\n\n\t\t\t\t\t\t\t// Allow onerror to be called first,\n\t\t\t\t\t\t\t// but that will not handle a native abort\n\t\t\t\t\t\t\t// Also, save errorCallback to a variable\n\t\t\t\t\t\t\t// as xhr.onerror cannot be accessed\n\t\t\t\t\t\t\twindow.setTimeout( function() {\n\t\t\t\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\t\t\t\terrorCallback();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Create the abort callback\n\t\t\t\tcallback = callback( \"abort\" );\n\n\t\t\t\ttry {\n\n\t\t\t\t\t// Do send the request (this may raise an exception)\n\t\t\t\t\txhr.send( options.hasContent && options.data || null );\n\t\t\t\t} catch ( e ) {\n\n\t\t\t\t\t// #14683: Only rethrow if this hasn't been notified as an error yet\n\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tabort: function() {\n\t\t\t\tif ( callback ) {\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n} );\n\n\n\n\n// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)\njQuery.ajaxPrefilter( function( s ) {\n\tif ( s.crossDomain ) {\n\t\ts.contents.script = false;\n\t}\n} );\n\n// Install script dataType\njQuery.ajaxSetup( {\n\taccepts: {\n\t\tscript: \"text/javascript, application/javascript, \" +\n\t\t\t\"application/ecmascript, application/x-ecmascript\"\n\t},\n\tcontents: {\n\t\tscript: /\\b(?:java|ecma)script\\b/\n\t},\n\tconverters: {\n\t\t\"text script\": function( text ) {\n\t\t\tjQuery.globalEval( text );\n\t\t\treturn text;\n\t\t}\n\t}\n} );\n\n// Handle cache's special case and crossDomain\njQuery.ajaxPrefilter( \"script\", function( s ) {\n\tif ( s.cache === undefined ) {\n\t\ts.cache = false;\n\t}\n\tif ( s.crossDomain ) {\n\t\ts.type = \"GET\";\n\t}\n} );\n\n// Bind script tag hack transport\njQuery.ajaxTransport( \"script\", function( s ) {\n\n\t// This transport only deals with cross domain requests\n\tif ( s.crossDomain ) {\n\t\tvar script, callback;\n\t\treturn {\n\t\t\tsend: function( _, complete ) {\n\t\t\t\tscript = jQuery( \"<script>\" ).prop( {\n\t\t\t\t\tcharset: s.scriptCharset,\n\t\t\t\t\tsrc: s.url\n\t\t\t\t} ).on(\n\t\t\t\t\t\"load error\",\n\t\t\t\t\tcallback = function( evt ) {\n\t\t\t\t\t\tscript.remove();\n\t\t\t\t\t\tcallback = null;\n\t\t\t\t\t\tif ( evt ) {\n\t\t\t\t\t\t\tcomplete( evt.type === \"error\" ? 404 : 200, evt.type );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\t// Use native DOM manipulation to avoid our domManip AJAX trickery\n\t\t\t\tdocument.head.appendChild( script[ 0 ] );\n\t\t\t},\n\t\t\tabort: function() {\n\t\t\t\tif ( callback ) {\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n} );\n\n\n\n\nvar oldCallbacks = [],\n\trjsonp = /(=)\\?(?=&|$)|\\?\\?/;\n\n// Default jsonp settings\njQuery.ajaxSetup( {\n\tjsonp: \"callback\",\n\tjsonpCallback: function() {\n\t\tvar callback = oldCallbacks.pop() || ( jQuery.expando + \"_\" + ( nonce++ ) );\n\t\tthis[ callback ] = true;\n\t\treturn callback;\n\t}\n} );\n\n// Detect, normalize options and install callbacks for jsonp requests\njQuery.ajaxPrefilter( \"json jsonp\", function( s, originalSettings, jqXHR ) {\n\n\tvar callbackName, overwritten, responseContainer,\n\t\tjsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?\n\t\t\t\"url\" :\n\t\t\ttypeof s.data === \"string\" &&\n\t\t\t\t( s.contentType || \"\" )\n\t\t\t\t\t.indexOf( \"application/x-www-form-urlencoded\" ) === 0 &&\n\t\t\t\trjsonp.test( s.data ) && \"data\"\n\t\t);\n\n\t// Handle iff the expected data type is \"jsonp\" or we have a parameter to set\n\tif ( jsonProp || s.dataTypes[ 0 ] === \"jsonp\" ) {\n\n\t\t// Get callback name, remembering preexisting value associated with it\n\t\tcallbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?\n\t\t\ts.jsonpCallback() :\n\t\t\ts.jsonpCallback;\n\n\t\t// Insert callback into url or form data\n\t\tif ( jsonProp ) {\n\t\t\ts[ jsonProp ] = s[ jsonProp ].replace( rjsonp, \"$1\" + callbackName );\n\t\t} else if ( s.jsonp !== false ) {\n\t\t\ts.url += ( rquery.test( s.url ) ? \"&\" : \"?\" ) + s.jsonp + \"=\" + callbackName;\n\t\t}\n\n\t\t// Use data converter to retrieve json after script execution\n\t\ts.converters[ \"script json\" ] = function() {\n\t\t\tif ( !responseContainer ) {\n\t\t\t\tjQuery.error( callbackName + \" was not called\" );\n\t\t\t}\n\t\t\treturn responseContainer[ 0 ];\n\t\t};\n\n\t\t// Force json dataType\n\t\ts.dataTypes[ 0 ] = \"json\";\n\n\t\t// Install callback\n\t\toverwritten = window[ callbackName ];\n\t\twindow[ callbackName ] = function() {\n\t\t\tresponseContainer = arguments;\n\t\t};\n\n\t\t// Clean-up function (fires after converters)\n\t\tjqXHR.always( function() {\n\n\t\t\t// If previous value didn't exist - remove it\n\t\t\tif ( overwritten === undefined ) {\n\t\t\t\tjQuery( window ).removeProp( callbackName );\n\n\t\t\t// Otherwise restore preexisting value\n\t\t\t} else {\n\t\t\t\twindow[ callbackName ] = overwritten;\n\t\t\t}\n\n\t\t\t// Save back as free\n\t\t\tif ( s[ callbackName ] ) {\n\n\t\t\t\t// Make sure that re-using the options doesn't screw things around\n\t\t\t\ts.jsonpCallback = originalSettings.jsonpCallback;\n\n\t\t\t\t// Save the callback name for future use\n\t\t\t\toldCallbacks.push( callbackName );\n\t\t\t}\n\n\t\t\t// Call if it was a function and we have a response\n\t\t\tif ( responseContainer && jQuery.isFunction( overwritten ) ) {\n\t\t\t\toverwritten( responseContainer[ 0 ] );\n\t\t\t}\n\n\t\t\tresponseContainer = overwritten = undefined;\n\t\t} );\n\n\t\t// Delegate to script\n\t\treturn \"script\";\n\t}\n} );\n\n\n\n\n// Support: Safari 8 only\n// In Safari 8 documents created via document.implementation.createHTMLDocument\n// collapse sibling forms: the second one becomes a child of the first one.\n// Because of that, this security measure has to be disabled in Safari 8.\n// https://bugs.webkit.org/show_bug.cgi?id=137337\nsupport.createHTMLDocument = ( function() {\n\tvar body = document.implementation.createHTMLDocument( \"\" ).body;\n\tbody.innerHTML = \"<form></form><form></form>\";\n\treturn body.childNodes.length === 2;\n} )();\n\n\n// Argument \"data\" should be string of html\n// context (optional): If specified, the fragment will be created in this context,\n// defaults to document\n// keepScripts (optional): If true, will include scripts passed in the html string\njQuery.parseHTML = function( data, context, keepScripts ) {\n\tif ( typeof data !== \"string\" ) {\n\t\treturn [];\n\t}\n\tif ( typeof context === \"boolean\" ) {\n\t\tkeepScripts = context;\n\t\tcontext = false;\n\t}\n\n\tvar base, parsed, scripts;\n\n\tif ( !context ) {\n\n\t\t// Stop scripts or inline event handlers from being executed immediately\n\t\t// by using document.implementation\n\t\tif ( support.createHTMLDocument ) {\n\t\t\tcontext = document.implementation.createHTMLDocument( \"\" );\n\n\t\t\t// Set the base href for the created document\n\t\t\t// so any parsed elements with URLs\n\t\t\t// are based on the document's URL (gh-2965)\n\t\t\tbase = context.createElement( \"base\" );\n\t\t\tbase.href = document.location.href;\n\t\t\tcontext.head.appendChild( base );\n\t\t} else {\n\t\t\tcontext = document;\n\t\t}\n\t}\n\n\tparsed = rsingleTag.exec( data );\n\tscripts = !keepScripts && [];\n\n\t// Single tag\n\tif ( parsed ) {\n\t\treturn [ context.createElement( parsed[ 1 ] ) ];\n\t}\n\n\tparsed = buildFragment( [ data ], context, scripts );\n\n\tif ( scripts && scripts.length ) {\n\t\tjQuery( scripts ).remove();\n\t}\n\n\treturn jQuery.merge( [], parsed.childNodes );\n};\n\n\n/**\n * Load a url into a page\n */\njQuery.fn.load = function( url, params, callback ) {\n\tvar selector, type, response,\n\t\tself = this,\n\t\toff = url.indexOf( \" \" );\n\n\tif ( off > -1 ) {\n\t\tselector = stripAndCollapse( url.slice( off ) );\n\t\turl = url.slice( 0, off );\n\t}\n\n\t// If it's a function\n\tif ( jQuery.isFunction( params ) ) {\n\n\t\t// We assume that it's the callback\n\t\tcallback = params;\n\t\tparams = undefined;\n\n\t// Otherwise, build a param string\n\t} else if ( params && typeof params === \"object\" ) {\n\t\ttype = \"POST\";\n\t}\n\n\t// If we have elements to modify, make the request\n\tif ( self.length > 0 ) {\n\t\tjQuery.ajax( {\n\t\t\turl: url,\n\n\t\t\t// If \"type\" variable is undefined, then \"GET\" method will be used.\n\t\t\t// Make value of this field explicit since\n\t\t\t// user can override it through ajaxSetup method\n\t\t\ttype: type || \"GET\",\n\t\t\tdataType: \"html\",\n\t\t\tdata: params\n\t\t} ).done( function( responseText ) {\n\n\t\t\t// Save response for use in complete callback\n\t\t\tresponse = arguments;\n\n\t\t\tself.html( selector ?\n\n\t\t\t\t// If a selector was specified, locate the right elements in a dummy div\n\t\t\t\t// Exclude scripts to avoid IE 'Permission Denied' errors\n\t\t\t\tjQuery( \"<div>\" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :\n\n\t\t\t\t// Otherwise use the full result\n\t\t\t\tresponseText );\n\n\t\t// If the request succeeds, this function gets \"data\", \"status\", \"jqXHR\"\n\t\t// but they are ignored because response was set above.\n\t\t// If it fails, this function gets \"jqXHR\", \"status\", \"error\"\n\t\t} ).always( callback && function( jqXHR, status ) {\n\t\t\tself.each( function() {\n\t\t\t\tcallback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );\n\t\t\t} );\n\t\t} );\n\t}\n\n\treturn this;\n};\n\n\n\n\n// Attach a bunch of functions for handling common AJAX events\njQuery.each( [\n\t\"ajaxStart\",\n\t\"ajaxStop\",\n\t\"ajaxComplete\",\n\t\"ajaxError\",\n\t\"ajaxSuccess\",\n\t\"ajaxSend\"\n], function( i, type ) {\n\tjQuery.fn[ type ] = function( fn ) {\n\t\treturn this.on( type, fn );\n\t};\n} );\n\n\n\n\njQuery.expr.pseudos.animated = function( elem ) {\n\treturn jQuery.grep( jQuery.timers, function( fn ) {\n\t\treturn elem === fn.elem;\n\t} ).length;\n};\n\n\n\n\n/**\n * Gets a window from an element\n */\nfunction getWindow( elem ) {\n\treturn jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;\n}\n\njQuery.offset = {\n\tsetOffset: function( elem, options, i ) {\n\t\tvar curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,\n\t\t\tposition = jQuery.css( elem, \"position\" ),\n\t\t\tcurElem = jQuery( elem ),\n\t\t\tprops = {};\n\n\t\t// Set position first, in-case top/left are set even on static elem\n\t\tif ( position === \"static\" ) {\n\t\t\telem.style.position = \"relative\";\n\t\t}\n\n\t\tcurOffset = curElem.offset();\n\t\tcurCSSTop = jQuery.css( elem, \"top\" );\n\t\tcurCSSLeft = jQuery.css( elem, \"left\" );\n\t\tcalculatePosition = ( position === \"absolute\" || position === \"fixed\" ) &&\n\t\t\t( curCSSTop + curCSSLeft ).indexOf( \"auto\" ) > -1;\n\n\t\t// Need to be able to calculate position if either\n\t\t// top or left is auto and position is either absolute or fixed\n\t\tif ( calculatePosition ) {\n\t\t\tcurPosition = curElem.position();\n\t\t\tcurTop = curPosition.top;\n\t\t\tcurLeft = curPosition.left;\n\n\t\t} else {\n\t\t\tcurTop = parseFloat( curCSSTop ) || 0;\n\t\t\tcurLeft = parseFloat( curCSSLeft ) || 0;\n\t\t}\n\n\t\tif ( jQuery.isFunction( options ) ) {\n\n\t\t\t// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)\n\t\t\toptions = options.call( elem, i, jQuery.extend( {}, curOffset ) );\n\t\t}\n\n\t\tif ( options.top != null ) {\n\t\t\tprops.top = ( options.top - curOffset.top ) + curTop;\n\t\t}\n\t\tif ( options.left != null ) {\n\t\t\tprops.left = ( options.left - curOffset.left ) + curLeft;\n\t\t}\n\n\t\tif ( \"using\" in options ) {\n\t\t\toptions.using.call( elem, props );\n\n\t\t} else {\n\t\t\tcurElem.css( props );\n\t\t}\n\t}\n};\n\njQuery.fn.extend( {\n\toffset: function( options ) {\n\n\t\t// Preserve chaining for setter\n\t\tif ( arguments.length ) {\n\t\t\treturn options === undefined ?\n\t\t\t\tthis :\n\t\t\t\tthis.each( function( i ) {\n\t\t\t\t\tjQuery.offset.setOffset( this, options, i );\n\t\t\t\t} );\n\t\t}\n\n\t\tvar docElem, win, rect, doc,\n\t\t\telem = this[ 0 ];\n\n\t\tif ( !elem ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Support: IE <=11 only\n\t\t// Running getBoundingClientRect on a\n\t\t// disconnected node in IE throws an error\n\t\tif ( !elem.getClientRects().length ) {\n\t\t\treturn { top: 0, left: 0 };\n\t\t}\n\n\t\trect = elem.getBoundingClientRect();\n\n\t\t// Make sure element is not hidden (display: none)\n\t\tif ( rect.width || rect.height ) {\n\t\t\tdoc = elem.ownerDocument;\n\t\t\twin = getWindow( doc );\n\t\t\tdocElem = doc.documentElement;\n\n\t\t\treturn {\n\t\t\t\ttop: rect.top + win.pageYOffset - docElem.clientTop,\n\t\t\t\tleft: rect.left + win.pageXOffset - docElem.clientLeft\n\t\t\t};\n\t\t}\n\n\t\t// Return zeros for disconnected and hidden elements (gh-2310)\n\t\treturn rect;\n\t},\n\n\tposition: function() {\n\t\tif ( !this[ 0 ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar offsetParent, offset,\n\t\t\telem = this[ 0 ],\n\t\t\tparentOffset = { top: 0, left: 0 };\n\n\t\t// Fixed elements are offset from window (parentOffset = {top:0, left: 0},\n\t\t// because it is its only offset parent\n\t\tif ( jQuery.css( elem, \"position\" ) === \"fixed\" ) {\n\n\t\t\t// Assume getBoundingClientRect is there when computed position is fixed\n\t\t\toffset = elem.getBoundingClientRect();\n\n\t\t} else {\n\n\t\t\t// Get *real* offsetParent\n\t\t\toffsetParent = this.offsetParent();\n\n\t\t\t// Get correct offsets\n\t\t\toffset = this.offset();\n\t\t\tif ( !jQuery.nodeName( offsetParent[ 0 ], \"html\" ) ) {\n\t\t\t\tparentOffset = offsetParent.offset();\n\t\t\t}\n\n\t\t\t// Add offsetParent borders\n\t\t\tparentOffset = {\n\t\t\t\ttop: parentOffset.top + jQuery.css( offsetParent[ 0 ], \"borderTopWidth\", true ),\n\t\t\t\tleft: parentOffset.left + jQuery.css( offsetParent[ 0 ], \"borderLeftWidth\", true )\n\t\t\t};\n\t\t}\n\n\t\t// Subtract parent offsets and element margins\n\t\treturn {\n\t\t\ttop: offset.top - parentOffset.top - jQuery.css( elem, \"marginTop\", true ),\n\t\t\tleft: offset.left - parentOffset.left - jQuery.css( elem, \"marginLeft\", true )\n\t\t};\n\t},\n\n\t// This method will return documentElement in the following cases:\n\t// 1) For the element inside the iframe without offsetParent, this method will return\n\t//    documentElement of the parent window\n\t// 2) For the hidden or detached element\n\t// 3) For body or html element, i.e. in case of the html node - it will return itself\n\t//\n\t// but those exceptions were never presented as a real life use-cases\n\t// and might be considered as more preferable results.\n\t//\n\t// This logic, however, is not guaranteed and can change at any point in the future\n\toffsetParent: function() {\n\t\treturn this.map( function() {\n\t\t\tvar offsetParent = this.offsetParent;\n\n\t\t\twhile ( offsetParent && jQuery.css( offsetParent, \"position\" ) === \"static\" ) {\n\t\t\t\toffsetParent = offsetParent.offsetParent;\n\t\t\t}\n\n\t\t\treturn offsetParent || documentElement;\n\t\t} );\n\t}\n} );\n\n// Create scrollLeft and scrollTop methods\njQuery.each( { scrollLeft: \"pageXOffset\", scrollTop: \"pageYOffset\" }, function( method, prop ) {\n\tvar top = \"pageYOffset\" === prop;\n\n\tjQuery.fn[ method ] = function( val ) {\n\t\treturn access( this, function( elem, method, val ) {\n\t\t\tvar win = getWindow( elem );\n\n\t\t\tif ( val === undefined ) {\n\t\t\t\treturn win ? win[ prop ] : elem[ method ];\n\t\t\t}\n\n\t\t\tif ( win ) {\n\t\t\t\twin.scrollTo(\n\t\t\t\t\t!top ? val : win.pageXOffset,\n\t\t\t\t\ttop ? val : win.pageYOffset\n\t\t\t\t);\n\n\t\t\t} else {\n\t\t\t\telem[ method ] = val;\n\t\t\t}\n\t\t}, method, val, arguments.length );\n\t};\n} );\n\n// Support: Safari <=7 - 9.1, Chrome <=37 - 49\n// Add the top/left cssHooks using jQuery.fn.position\n// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084\n// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347\n// getComputedStyle returns percent when specified for top/left/bottom/right;\n// rather than make the css module depend on the offset module, just check for it here\njQuery.each( [ \"top\", \"left\" ], function( i, prop ) {\n\tjQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,\n\t\tfunction( elem, computed ) {\n\t\t\tif ( computed ) {\n\t\t\t\tcomputed = curCSS( elem, prop );\n\n\t\t\t\t// If curCSS returns percentage, fallback to offset\n\t\t\t\treturn rnumnonpx.test( computed ) ?\n\t\t\t\t\tjQuery( elem ).position()[ prop ] + \"px\" :\n\t\t\t\t\tcomputed;\n\t\t\t}\n\t\t}\n\t);\n} );\n\n\n// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods\njQuery.each( { Height: \"height\", Width: \"width\" }, function( name, type ) {\n\tjQuery.each( { padding: \"inner\" + name, content: type, \"\": \"outer\" + name },\n\t\tfunction( defaultExtra, funcName ) {\n\n\t\t// Margin is only for outerHeight, outerWidth\n\t\tjQuery.fn[ funcName ] = function( margin, value ) {\n\t\t\tvar chainable = arguments.length && ( defaultExtra || typeof margin !== \"boolean\" ),\n\t\t\t\textra = defaultExtra || ( margin === true || value === true ? \"margin\" : \"border\" );\n\n\t\t\treturn access( this, function( elem, type, value ) {\n\t\t\t\tvar doc;\n\n\t\t\t\tif ( jQuery.isWindow( elem ) ) {\n\n\t\t\t\t\t// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)\n\t\t\t\t\treturn funcName.indexOf( \"outer\" ) === 0 ?\n\t\t\t\t\t\telem[ \"inner\" + name ] :\n\t\t\t\t\t\telem.document.documentElement[ \"client\" + name ];\n\t\t\t\t}\n\n\t\t\t\t// Get document width or height\n\t\t\t\tif ( elem.nodeType === 9 ) {\n\t\t\t\t\tdoc = elem.documentElement;\n\n\t\t\t\t\t// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],\n\t\t\t\t\t// whichever is greatest\n\t\t\t\t\treturn Math.max(\n\t\t\t\t\t\telem.body[ \"scroll\" + name ], doc[ \"scroll\" + name ],\n\t\t\t\t\t\telem.body[ \"offset\" + name ], doc[ \"offset\" + name ],\n\t\t\t\t\t\tdoc[ \"client\" + name ]\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn value === undefined ?\n\n\t\t\t\t\t// Get width or height on the element, requesting but not forcing parseFloat\n\t\t\t\t\tjQuery.css( elem, type, extra ) :\n\n\t\t\t\t\t// Set width or height on the element\n\t\t\t\t\tjQuery.style( elem, type, value, extra );\n\t\t\t}, type, chainable ? margin : undefined, chainable );\n\t\t};\n\t} );\n} );\n\n\njQuery.fn.extend( {\n\n\tbind: function( types, data, fn ) {\n\t\treturn this.on( types, null, data, fn );\n\t},\n\tunbind: function( types, fn ) {\n\t\treturn this.off( types, null, fn );\n\t},\n\n\tdelegate: function( selector, types, data, fn ) {\n\t\treturn this.on( types, selector, data, fn );\n\t},\n\tundelegate: function( selector, types, fn ) {\n\n\t\t// ( namespace ) or ( selector, types [, fn] )\n\t\treturn arguments.length === 1 ?\n\t\t\tthis.off( selector, \"**\" ) :\n\t\t\tthis.off( types, selector || \"**\", fn );\n\t}\n} );\n\njQuery.parseJSON = JSON.parse;\n\n\n\n\n// Register as a named AMD module, since jQuery can be concatenated with other\n// files that may use define, but not via a proper concatenation script that\n// understands anonymous AMD modules. A named AMD is safest and most robust\n// way to register. Lowercase jquery is used because AMD module names are\n// derived from file names, and jQuery is normally delivered in a lowercase\n// file name. Do this after creating the global so that if an AMD module wants\n// to call noConflict to hide this version of jQuery, it will work.\n\n// Note that for maximum portability, libraries that are not jQuery should\n// declare themselves as anonymous modules, and avoid setting a global if an\n// AMD loader is present. jQuery is a special case. For more information, see\n// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon\n\nif ( typeof define === \"function\" && define.amd ) {\n\tdefine( \"jquery\", [], function() {\n\t\treturn jQuery;\n\t} );\n}\n\n\n\n\nvar\n\n\t// Map over jQuery in case of overwrite\n\t_jQuery = window.jQuery,\n\n\t// Map over the $ in case of overwrite\n\t_$ = window.$;\n\njQuery.noConflict = function( deep ) {\n\tif ( window.$ === jQuery ) {\n\t\twindow.$ = _$;\n\t}\n\n\tif ( deep && window.jQuery === jQuery ) {\n\t\twindow.jQuery = _jQuery;\n\t}\n\n\treturn jQuery;\n};\n\n// Expose jQuery and $ identifiers, even in AMD\n// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)\n// and CommonJS for browser emulators (#13566)\nif ( !noGlobal ) {\n\twindow.jQuery = window.$ = jQuery;\n}\n\n\n\n\n\nreturn jQuery;\n} );\n"},{"col":4,"comment":"null","endLoc":930,"header":"def compress(self, condition, axis=None, out=None)","id":11426,"name":"compress","nodeType":"Function","startLoc":927,"text":"def compress(self, condition, axis=None, out=None):\n        if out is not None:\n            raise NotImplementedError('cannot yet give output')\n        return self._apply('compress', condition, axis=axis)"},{"id":11427,"name":"jquery.dataTables.min.js","nodeType":"TextFile","path":"astropy/extern/jquery/data/js","text":"/*!\n DataTables 1.10.12\n ©2008-2015 SpryMedia Ltd - datatables.net/license\n*/\n(function(h){\"function\"===typeof define&&define.amd?define([\"jquery\"],function(D){return h(D,window,document)}):\"object\"===typeof exports?module.exports=function(D,I){D||(D=window);I||(I=\"undefined\"!==typeof window?require(\"jquery\"):require(\"jquery\")(D));return h(I,D,D.document)}:h(jQuery,window,document)})(function(h,D,I,k){function X(a){var b,c,d={};h.each(a,function(e){if((b=e.match(/^([^A-Z]+?)([A-Z])/))&&-1!==\"a aa ai ao as b fn i m o s \".indexOf(b[1]+\" \"))c=e.replace(b[0],b[2].toLowerCase()),\nd[c]=e,\"o\"===b[1]&&X(a[e])});a._hungarianMap=d}function K(a,b,c){a._hungarianMap||X(a);var d;h.each(b,function(e){d=a._hungarianMap[e];if(d!==k&&(c||b[d]===k))\"o\"===d.charAt(0)?(b[d]||(b[d]={}),h.extend(!0,b[d],b[e]),K(a[d],b[d],c)):b[d]=b[e]})}function Da(a){var b=m.defaults.oLanguage,c=a.sZeroRecords;!a.sEmptyTable&&(c&&\"No data available in table\"===b.sEmptyTable)&&E(a,a,\"sZeroRecords\",\"sEmptyTable\");!a.sLoadingRecords&&(c&&\"Loading...\"===b.sLoadingRecords)&&E(a,a,\"sZeroRecords\",\"sLoadingRecords\");\na.sInfoThousands&&(a.sThousands=a.sInfoThousands);(a=a.sDecimal)&&db(a)}function eb(a){A(a,\"ordering\",\"bSort\");A(a,\"orderMulti\",\"bSortMulti\");A(a,\"orderClasses\",\"bSortClasses\");A(a,\"orderCellsTop\",\"bSortCellsTop\");A(a,\"order\",\"aaSorting\");A(a,\"orderFixed\",\"aaSortingFixed\");A(a,\"paging\",\"bPaginate\");A(a,\"pagingType\",\"sPaginationType\");A(a,\"pageLength\",\"iDisplayLength\");A(a,\"searching\",\"bFilter\");\"boolean\"===typeof a.sScrollX&&(a.sScrollX=a.sScrollX?\"100%\":\"\");\"boolean\"===typeof a.scrollX&&(a.scrollX=\na.scrollX?\"100%\":\"\");if(a=a.aoSearchCols)for(var b=0,c=a.length;b<c;b++)a[b]&&K(m.models.oSearch,a[b])}function fb(a){A(a,\"orderable\",\"bSortable\");A(a,\"orderData\",\"aDataSort\");A(a,\"orderSequence\",\"asSorting\");A(a,\"orderDataType\",\"sortDataType\");var b=a.aDataSort;b&&!h.isArray(b)&&(a.aDataSort=[b])}function gb(a){if(!m.__browser){var b={};m.__browser=b;var c=h(\"<div/>\").css({position:\"fixed\",top:0,left:0,height:1,width:1,overflow:\"hidden\"}).append(h(\"<div/>\").css({position:\"absolute\",top:1,left:1,\nwidth:100,overflow:\"scroll\"}).append(h(\"<div/>\").css({width:\"100%\",height:10}))).appendTo(\"body\"),d=c.children(),e=d.children();b.barWidth=d[0].offsetWidth-d[0].clientWidth;b.bScrollOversize=100===e[0].offsetWidth&&100!==d[0].clientWidth;b.bScrollbarLeft=1!==Math.round(e.offset().left);b.bBounding=c[0].getBoundingClientRect().width?!0:!1;c.remove()}h.extend(a.oBrowser,m.__browser);a.oScroll.iBarWidth=m.__browser.barWidth}function hb(a,b,c,d,e,f){var g,j=!1;c!==k&&(g=c,j=!0);for(;d!==e;)a.hasOwnProperty(d)&&\n(g=j?b(g,a[d],d,a):a[d],j=!0,d+=f);return g}function Ea(a,b){var c=m.defaults.column,d=a.aoColumns.length,c=h.extend({},m.models.oColumn,c,{nTh:b?b:I.createElement(\"th\"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML:\"\",aDataSort:c.aDataSort?c.aDataSort:[d],mData:c.mData?c.mData:d,idx:d});a.aoColumns.push(c);c=a.aoPreSearchCols;c[d]=h.extend({},m.models.oSearch,c[d]);ja(a,d,h(b).data())}function ja(a,b,c){var b=a.aoColumns[b],d=a.oClasses,e=h(b.nTh);if(!b.sWidthOrig){b.sWidthOrig=e.attr(\"width\")||null;var f=\n(e.attr(\"style\")||\"\").match(/width:\\s*(\\d+[pxem%]+)/);f&&(b.sWidthOrig=f[1])}c!==k&&null!==c&&(fb(c),K(m.defaults.column,c),c.mDataProp!==k&&!c.mData&&(c.mData=c.mDataProp),c.sType&&(b._sManualType=c.sType),c.className&&!c.sClass&&(c.sClass=c.className),h.extend(b,c),E(b,c,\"sWidth\",\"sWidthOrig\"),c.iDataSort!==k&&(b.aDataSort=[c.iDataSort]),E(b,c,\"aDataSort\"));var g=b.mData,j=Q(g),i=b.mRender?Q(b.mRender):null,c=function(a){return\"string\"===typeof a&&-1!==a.indexOf(\"@\")};b._bAttrSrc=h.isPlainObject(g)&&\n(c(g.sort)||c(g.type)||c(g.filter));b._setter=null;b.fnGetData=function(a,b,c){var d=j(a,b,k,c);return i&&b?i(d,b,a,c):d};b.fnSetData=function(a,b,c){return R(g)(a,b,c)};\"number\"!==typeof g&&(a._rowReadObject=!0);a.oFeatures.bSort||(b.bSortable=!1,e.addClass(d.sSortableNone));a=-1!==h.inArray(\"asc\",b.asSorting);c=-1!==h.inArray(\"desc\",b.asSorting);!b.bSortable||!a&&!c?(b.sSortingClass=d.sSortableNone,b.sSortingClassJUI=\"\"):a&&!c?(b.sSortingClass=d.sSortableAsc,b.sSortingClassJUI=d.sSortJUIAscAllowed):\n!a&&c?(b.sSortingClass=d.sSortableDesc,b.sSortingClassJUI=d.sSortJUIDescAllowed):(b.sSortingClass=d.sSortable,b.sSortingClassJUI=d.sSortJUI)}function Y(a){if(!1!==a.oFeatures.bAutoWidth){var b=a.aoColumns;Fa(a);for(var c=0,d=b.length;c<d;c++)b[c].nTh.style.width=b[c].sWidth}b=a.oScroll;(\"\"!==b.sY||\"\"!==b.sX)&&ka(a);u(a,null,\"column-sizing\",[a])}function Z(a,b){var c=la(a,\"bVisible\");return\"number\"===typeof c[b]?c[b]:null}function $(a,b){var c=la(a,\"bVisible\"),c=h.inArray(b,c);return-1!==c?c:null}\nfunction aa(a){var b=0;h.each(a.aoColumns,function(a,d){d.bVisible&&\"none\"!==h(d.nTh).css(\"display\")&&b++});return b}function la(a,b){var c=[];h.map(a.aoColumns,function(a,e){a[b]&&c.push(e)});return c}function Ga(a){var b=a.aoColumns,c=a.aoData,d=m.ext.type.detect,e,f,g,j,i,h,l,q,t;e=0;for(f=b.length;e<f;e++)if(l=b[e],t=[],!l.sType&&l._sManualType)l.sType=l._sManualType;else if(!l.sType){g=0;for(j=d.length;g<j;g++){i=0;for(h=c.length;i<h;i++){t[i]===k&&(t[i]=B(a,i,e,\"type\"));q=d[g](t[i],a);if(!q&&\ng!==d.length-1)break;if(\"html\"===q)break}if(q){l.sType=q;break}}l.sType||(l.sType=\"string\")}}function ib(a,b,c,d){var e,f,g,j,i,n,l=a.aoColumns;if(b)for(e=b.length-1;0<=e;e--){n=b[e];var q=n.targets!==k?n.targets:n.aTargets;h.isArray(q)||(q=[q]);f=0;for(g=q.length;f<g;f++)if(\"number\"===typeof q[f]&&0<=q[f]){for(;l.length<=q[f];)Ea(a);d(q[f],n)}else if(\"number\"===typeof q[f]&&0>q[f])d(l.length+q[f],n);else if(\"string\"===typeof q[f]){j=0;for(i=l.length;j<i;j++)(\"_all\"==q[f]||h(l[j].nTh).hasClass(q[f]))&&\nd(j,n)}}if(c){e=0;for(a=c.length;e<a;e++)d(e,c[e])}}function N(a,b,c,d){var e=a.aoData.length,f=h.extend(!0,{},m.models.oRow,{src:c?\"dom\":\"data\",idx:e});f._aData=b;a.aoData.push(f);for(var g=a.aoColumns,j=0,i=g.length;j<i;j++)g[j].sType=null;a.aiDisplayMaster.push(e);b=a.rowIdFn(b);b!==k&&(a.aIds[b]=f);(c||!a.oFeatures.bDeferRender)&&Ha(a,e,c,d);return e}function ma(a,b){var c;b instanceof h||(b=h(b));return b.map(function(b,e){c=Ia(a,e);return N(a,c.data,e,c.cells)})}function B(a,b,c,d){var e=a.iDraw,\nf=a.aoColumns[c],g=a.aoData[b]._aData,j=f.sDefaultContent,i=f.fnGetData(g,d,{settings:a,row:b,col:c});if(i===k)return a.iDrawError!=e&&null===j&&(L(a,0,\"Requested unknown parameter \"+(\"function\"==typeof f.mData?\"{function}\":\"'\"+f.mData+\"'\")+\" for row \"+b+\", column \"+c,4),a.iDrawError=e),j;if((i===g||null===i)&&null!==j&&d!==k)i=j;else if(\"function\"===typeof i)return i.call(g);return null===i&&\"display\"==d?\"\":i}function jb(a,b,c,d){a.aoColumns[c].fnSetData(a.aoData[b]._aData,d,{settings:a,row:b,col:c})}\nfunction Ja(a){return h.map(a.match(/(\\\\.|[^\\.])+/g)||[\"\"],function(a){return a.replace(/\\\\./g,\".\")})}function Q(a){if(h.isPlainObject(a)){var b={};h.each(a,function(a,c){c&&(b[a]=Q(c))});return function(a,c,f,g){var j=b[c]||b._;return j!==k?j(a,c,f,g):a}}if(null===a)return function(a){return a};if(\"function\"===typeof a)return function(b,c,f,g){return a(b,c,f,g)};if(\"string\"===typeof a&&(-1!==a.indexOf(\".\")||-1!==a.indexOf(\"[\")||-1!==a.indexOf(\"(\"))){var c=function(a,b,f){var g,j;if(\"\"!==f){j=Ja(f);\nfor(var i=0,n=j.length;i<n;i++){f=j[i].match(ba);g=j[i].match(U);if(f){j[i]=j[i].replace(ba,\"\");\"\"!==j[i]&&(a=a[j[i]]);g=[];j.splice(0,i+1);j=j.join(\".\");if(h.isArray(a)){i=0;for(n=a.length;i<n;i++)g.push(c(a[i],b,j))}a=f[0].substring(1,f[0].length-1);a=\"\"===a?g:g.join(a);break}else if(g){j[i]=j[i].replace(U,\"\");a=a[j[i]]();continue}if(null===a||a[j[i]]===k)return k;a=a[j[i]]}}return a};return function(b,e){return c(b,e,a)}}return function(b){return b[a]}}function R(a){if(h.isPlainObject(a))return R(a._);\nif(null===a)return function(){};if(\"function\"===typeof a)return function(b,d,e){a(b,\"set\",d,e)};if(\"string\"===typeof a&&(-1!==a.indexOf(\".\")||-1!==a.indexOf(\"[\")||-1!==a.indexOf(\"(\"))){var b=function(a,d,e){var e=Ja(e),f;f=e[e.length-1];for(var g,j,i=0,n=e.length-1;i<n;i++){g=e[i].match(ba);j=e[i].match(U);if(g){e[i]=e[i].replace(ba,\"\");a[e[i]]=[];f=e.slice();f.splice(0,i+1);g=f.join(\".\");if(h.isArray(d)){j=0;for(n=d.length;j<n;j++)f={},b(f,d[j],g),a[e[i]].push(f)}else a[e[i]]=d;return}j&&(e[i]=e[i].replace(U,\n\"\"),a=a[e[i]](d));if(null===a[e[i]]||a[e[i]]===k)a[e[i]]={};a=a[e[i]]}if(f.match(U))a[f.replace(U,\"\")](d);else a[f.replace(ba,\"\")]=d};return function(c,d){return b(c,d,a)}}return function(b,d){b[a]=d}}function Ka(a){return G(a.aoData,\"_aData\")}function na(a){a.aoData.length=0;a.aiDisplayMaster.length=0;a.aiDisplay.length=0;a.aIds={}}function oa(a,b,c){for(var d=-1,e=0,f=a.length;e<f;e++)a[e]==b?d=e:a[e]>b&&a[e]--; -1!=d&&c===k&&a.splice(d,1)}function ca(a,b,c,d){var e=a.aoData[b],f,g=function(c,d){for(;c.childNodes.length;)c.removeChild(c.firstChild);\nc.innerHTML=B(a,b,d,\"display\")};if(\"dom\"===c||(!c||\"auto\"===c)&&\"dom\"===e.src)e._aData=Ia(a,e,d,d===k?k:e._aData).data;else{var j=e.anCells;if(j)if(d!==k)g(j[d],d);else{c=0;for(f=j.length;c<f;c++)g(j[c],c)}}e._aSortData=null;e._aFilterData=null;g=a.aoColumns;if(d!==k)g[d].sType=null;else{c=0;for(f=g.length;c<f;c++)g[c].sType=null;La(a,e)}}function Ia(a,b,c,d){var e=[],f=b.firstChild,g,j,i=0,n,l=a.aoColumns,q=a._rowReadObject,d=d!==k?d:q?{}:[],t=function(a,b){if(\"string\"===typeof a){var c=a.indexOf(\"@\");\n-1!==c&&(c=a.substring(c+1),R(a)(d,b.getAttribute(c)))}},S=function(a){if(c===k||c===i)j=l[i],n=h.trim(a.innerHTML),j&&j._bAttrSrc?(R(j.mData._)(d,n),t(j.mData.sort,a),t(j.mData.type,a),t(j.mData.filter,a)):q?(j._setter||(j._setter=R(j.mData)),j._setter(d,n)):d[i]=n;i++};if(f)for(;f;){g=f.nodeName.toUpperCase();if(\"TD\"==g||\"TH\"==g)S(f),e.push(f);f=f.nextSibling}else{e=b.anCells;f=0;for(g=e.length;f<g;f++)S(e[f])}if(b=b.firstChild?b:b.nTr)(b=b.getAttribute(\"id\"))&&R(a.rowId)(d,b);return{data:d,cells:e}}\nfunction Ha(a,b,c,d){var e=a.aoData[b],f=e._aData,g=[],j,i,n,l,q;if(null===e.nTr){j=c||I.createElement(\"tr\");e.nTr=j;e.anCells=g;j._DT_RowIndex=b;La(a,e);l=0;for(q=a.aoColumns.length;l<q;l++){n=a.aoColumns[l];i=c?d[l]:I.createElement(n.sCellType);i._DT_CellIndex={row:b,column:l};g.push(i);if((!c||n.mRender||n.mData!==l)&&(!h.isPlainObject(n.mData)||n.mData._!==l+\".display\"))i.innerHTML=B(a,b,l,\"display\");n.sClass&&(i.className+=\" \"+n.sClass);n.bVisible&&!c?j.appendChild(i):!n.bVisible&&c&&i.parentNode.removeChild(i);\nn.fnCreatedCell&&n.fnCreatedCell.call(a.oInstance,i,B(a,b,l),f,b,l)}u(a,\"aoRowCreatedCallback\",null,[j,f,b])}e.nTr.setAttribute(\"role\",\"row\")}function La(a,b){var c=b.nTr,d=b._aData;if(c){var e=a.rowIdFn(d);e&&(c.id=e);d.DT_RowClass&&(e=d.DT_RowClass.split(\" \"),b.__rowc=b.__rowc?pa(b.__rowc.concat(e)):e,h(c).removeClass(b.__rowc.join(\" \")).addClass(d.DT_RowClass));d.DT_RowAttr&&h(c).attr(d.DT_RowAttr);d.DT_RowData&&h(c).data(d.DT_RowData)}}function kb(a){var b,c,d,e,f,g=a.nTHead,j=a.nTFoot,i=0===\nh(\"th, td\",g).length,n=a.oClasses,l=a.aoColumns;i&&(e=h(\"<tr/>\").appendTo(g));b=0;for(c=l.length;b<c;b++)f=l[b],d=h(f.nTh).addClass(f.sClass),i&&d.appendTo(e),a.oFeatures.bSort&&(d.addClass(f.sSortingClass),!1!==f.bSortable&&(d.attr(\"tabindex\",a.iTabIndex).attr(\"aria-controls\",a.sTableId),Ma(a,f.nTh,b))),f.sTitle!=d[0].innerHTML&&d.html(f.sTitle),Na(a,\"header\")(a,d,f,n);i&&da(a.aoHeader,g);h(g).find(\">tr\").attr(\"role\",\"row\");h(g).find(\">tr>th, >tr>td\").addClass(n.sHeaderTH);h(j).find(\">tr>th, >tr>td\").addClass(n.sFooterTH);\nif(null!==j){a=a.aoFooter[0];b=0;for(c=a.length;b<c;b++)f=l[b],f.nTf=a[b].cell,f.sClass&&h(f.nTf).addClass(f.sClass)}}function ea(a,b,c){var d,e,f,g=[],j=[],i=a.aoColumns.length,n;if(b){c===k&&(c=!1);d=0;for(e=b.length;d<e;d++){g[d]=b[d].slice();g[d].nTr=b[d].nTr;for(f=i-1;0<=f;f--)!a.aoColumns[f].bVisible&&!c&&g[d].splice(f,1);j.push([])}d=0;for(e=g.length;d<e;d++){if(a=g[d].nTr)for(;f=a.firstChild;)a.removeChild(f);f=0;for(b=g[d].length;f<b;f++)if(n=i=1,j[d][f]===k){a.appendChild(g[d][f].cell);\nfor(j[d][f]=1;g[d+i]!==k&&g[d][f].cell==g[d+i][f].cell;)j[d+i][f]=1,i++;for(;g[d][f+n]!==k&&g[d][f].cell==g[d][f+n].cell;){for(c=0;c<i;c++)j[d+c][f+n]=1;n++}h(g[d][f].cell).attr(\"rowspan\",i).attr(\"colspan\",n)}}}}function O(a){var b=u(a,\"aoPreDrawCallback\",\"preDraw\",[a]);if(-1!==h.inArray(!1,b))C(a,!1);else{var b=[],c=0,d=a.asStripeClasses,e=d.length,f=a.oLanguage,g=a.iInitDisplayStart,j=\"ssp\"==y(a),i=a.aiDisplay;a.bDrawing=!0;g!==k&&-1!==g&&(a._iDisplayStart=j?g:g>=a.fnRecordsDisplay()?0:g,a.iInitDisplayStart=\n-1);var g=a._iDisplayStart,n=a.fnDisplayEnd();if(a.bDeferLoading)a.bDeferLoading=!1,a.iDraw++,C(a,!1);else if(j){if(!a.bDestroying&&!lb(a))return}else a.iDraw++;if(0!==i.length){f=j?a.aoData.length:n;for(j=j?0:g;j<f;j++){var l=i[j],q=a.aoData[l];null===q.nTr&&Ha(a,l);l=q.nTr;if(0!==e){var t=d[c%e];q._sRowStripe!=t&&(h(l).removeClass(q._sRowStripe).addClass(t),q._sRowStripe=t)}u(a,\"aoRowCallback\",null,[l,q._aData,c,j]);b.push(l);c++}}else c=f.sZeroRecords,1==a.iDraw&&\"ajax\"==y(a)?c=f.sLoadingRecords:\nf.sEmptyTable&&0===a.fnRecordsTotal()&&(c=f.sEmptyTable),b[0]=h(\"<tr/>\",{\"class\":e?d[0]:\"\"}).append(h(\"<td />\",{valign:\"top\",colSpan:aa(a),\"class\":a.oClasses.sRowEmpty}).html(c))[0];u(a,\"aoHeaderCallback\",\"header\",[h(a.nTHead).children(\"tr\")[0],Ka(a),g,n,i]);u(a,\"aoFooterCallback\",\"footer\",[h(a.nTFoot).children(\"tr\")[0],Ka(a),g,n,i]);d=h(a.nTBody);d.children().detach();d.append(h(b));u(a,\"aoDrawCallback\",\"draw\",[a]);a.bSorted=!1;a.bFiltered=!1;a.bDrawing=!1}}function T(a,b){var c=a.oFeatures,d=c.bFilter;\nc.bSort&&mb(a);d?fa(a,a.oPreviousSearch):a.aiDisplay=a.aiDisplayMaster.slice();!0!==b&&(a._iDisplayStart=0);a._drawHold=b;O(a);a._drawHold=!1}function nb(a){var b=a.oClasses,c=h(a.nTable),c=h(\"<div/>\").insertBefore(c),d=a.oFeatures,e=h(\"<div/>\",{id:a.sTableId+\"_wrapper\",\"class\":b.sWrapper+(a.nTFoot?\"\":\" \"+b.sNoFooter)});a.nHolding=c[0];a.nTableWrapper=e[0];a.nTableReinsertBefore=a.nTable.nextSibling;for(var f=a.sDom.split(\"\"),g,j,i,n,l,q,t=0;t<f.length;t++){g=null;j=f[t];if(\"<\"==j){i=h(\"<div/>\")[0];\nn=f[t+1];if(\"'\"==n||'\"'==n){l=\"\";for(q=2;f[t+q]!=n;)l+=f[t+q],q++;\"H\"==l?l=b.sJUIHeader:\"F\"==l&&(l=b.sJUIFooter);-1!=l.indexOf(\".\")?(n=l.split(\".\"),i.id=n[0].substr(1,n[0].length-1),i.className=n[1]):\"#\"==l.charAt(0)?i.id=l.substr(1,l.length-1):i.className=l;t+=q}e.append(i);e=h(i)}else if(\">\"==j)e=e.parent();else if(\"l\"==j&&d.bPaginate&&d.bLengthChange)g=ob(a);else if(\"f\"==j&&d.bFilter)g=pb(a);else if(\"r\"==j&&d.bProcessing)g=qb(a);else if(\"t\"==j)g=rb(a);else if(\"i\"==j&&d.bInfo)g=sb(a);else if(\"p\"==\nj&&d.bPaginate)g=tb(a);else if(0!==m.ext.feature.length){i=m.ext.feature;q=0;for(n=i.length;q<n;q++)if(j==i[q].cFeature){g=i[q].fnInit(a);break}}g&&(i=a.aanFeatures,i[j]||(i[j]=[]),i[j].push(g),e.append(g))}c.replaceWith(e);a.nHolding=null}function da(a,b){var c=h(b).children(\"tr\"),d,e,f,g,j,i,n,l,q,t;a.splice(0,a.length);f=0;for(i=c.length;f<i;f++)a.push([]);f=0;for(i=c.length;f<i;f++){d=c[f];for(e=d.firstChild;e;){if(\"TD\"==e.nodeName.toUpperCase()||\"TH\"==e.nodeName.toUpperCase()){l=1*e.getAttribute(\"colspan\");\nq=1*e.getAttribute(\"rowspan\");l=!l||0===l||1===l?1:l;q=!q||0===q||1===q?1:q;g=0;for(j=a[f];j[g];)g++;n=g;t=1===l?!0:!1;for(j=0;j<l;j++)for(g=0;g<q;g++)a[f+g][n+j]={cell:e,unique:t},a[f+g].nTr=d}e=e.nextSibling}}}function qa(a,b,c){var d=[];c||(c=a.aoHeader,b&&(c=[],da(c,b)));for(var b=0,e=c.length;b<e;b++)for(var f=0,g=c[b].length;f<g;f++)if(c[b][f].unique&&(!d[f]||!a.bSortCellsTop))d[f]=c[b][f].cell;return d}function ra(a,b,c){u(a,\"aoServerParams\",\"serverParams\",[b]);if(b&&h.isArray(b)){var d={},\ne=/(.*?)\\[\\]$/;h.each(b,function(a,b){var c=b.name.match(e);c?(c=c[0],d[c]||(d[c]=[]),d[c].push(b.value)):d[b.name]=b.value});b=d}var f,g=a.ajax,j=a.oInstance,i=function(b){u(a,null,\"xhr\",[a,b,a.jqXHR]);c(b)};if(h.isPlainObject(g)&&g.data){f=g.data;var n=h.isFunction(f)?f(b,a):f,b=h.isFunction(f)&&n?n:h.extend(!0,b,n);delete g.data}n={data:b,success:function(b){var c=b.error||b.sError;c&&L(a,0,c);a.json=b;i(b)},dataType:\"json\",cache:!1,type:a.sServerMethod,error:function(b,c){var d=u(a,null,\"xhr\",\n[a,null,a.jqXHR]);-1===h.inArray(!0,d)&&(\"parsererror\"==c?L(a,0,\"Invalid JSON response\",1):4===b.readyState&&L(a,0,\"Ajax error\",7));C(a,!1)}};a.oAjaxData=b;u(a,null,\"preXhr\",[a,b]);a.fnServerData?a.fnServerData.call(j,a.sAjaxSource,h.map(b,function(a,b){return{name:b,value:a}}),i,a):a.sAjaxSource||\"string\"===typeof g?a.jqXHR=h.ajax(h.extend(n,{url:g||a.sAjaxSource})):h.isFunction(g)?a.jqXHR=g.call(j,b,i,a):(a.jqXHR=h.ajax(h.extend(n,g)),g.data=f)}function lb(a){return a.bAjaxDataGet?(a.iDraw++,C(a,\n!0),ra(a,ub(a),function(b){vb(a,b)}),!1):!0}function ub(a){var b=a.aoColumns,c=b.length,d=a.oFeatures,e=a.oPreviousSearch,f=a.aoPreSearchCols,g,j=[],i,n,l,q=V(a);g=a._iDisplayStart;i=!1!==d.bPaginate?a._iDisplayLength:-1;var k=function(a,b){j.push({name:a,value:b})};k(\"sEcho\",a.iDraw);k(\"iColumns\",c);k(\"sColumns\",G(b,\"sName\").join(\",\"));k(\"iDisplayStart\",g);k(\"iDisplayLength\",i);var S={draw:a.iDraw,columns:[],order:[],start:g,length:i,search:{value:e.sSearch,regex:e.bRegex}};for(g=0;g<c;g++)n=b[g],\nl=f[g],i=\"function\"==typeof n.mData?\"function\":n.mData,S.columns.push({data:i,name:n.sName,searchable:n.bSearchable,orderable:n.bSortable,search:{value:l.sSearch,regex:l.bRegex}}),k(\"mDataProp_\"+g,i),d.bFilter&&(k(\"sSearch_\"+g,l.sSearch),k(\"bRegex_\"+g,l.bRegex),k(\"bSearchable_\"+g,n.bSearchable)),d.bSort&&k(\"bSortable_\"+g,n.bSortable);d.bFilter&&(k(\"sSearch\",e.sSearch),k(\"bRegex\",e.bRegex));d.bSort&&(h.each(q,function(a,b){S.order.push({column:b.col,dir:b.dir});k(\"iSortCol_\"+a,b.col);k(\"sSortDir_\"+\na,b.dir)}),k(\"iSortingCols\",q.length));b=m.ext.legacy.ajax;return null===b?a.sAjaxSource?j:S:b?j:S}function vb(a,b){var c=sa(a,b),d=b.sEcho!==k?b.sEcho:b.draw,e=b.iTotalRecords!==k?b.iTotalRecords:b.recordsTotal,f=b.iTotalDisplayRecords!==k?b.iTotalDisplayRecords:b.recordsFiltered;if(d){if(1*d<a.iDraw)return;a.iDraw=1*d}na(a);a._iRecordsTotal=parseInt(e,10);a._iRecordsDisplay=parseInt(f,10);d=0;for(e=c.length;d<e;d++)N(a,c[d]);a.aiDisplay=a.aiDisplayMaster.slice();a.bAjaxDataGet=!1;O(a);a._bInitComplete||\nta(a,b);a.bAjaxDataGet=!0;C(a,!1)}function sa(a,b){var c=h.isPlainObject(a.ajax)&&a.ajax.dataSrc!==k?a.ajax.dataSrc:a.sAjaxDataProp;return\"data\"===c?b.aaData||b[c]:\"\"!==c?Q(c)(b):b}function pb(a){var b=a.oClasses,c=a.sTableId,d=a.oLanguage,e=a.oPreviousSearch,f=a.aanFeatures,g='<input type=\"search\" class=\"'+b.sFilterInput+'\"/>',j=d.sSearch,j=j.match(/_INPUT_/)?j.replace(\"_INPUT_\",g):j+g,b=h(\"<div/>\",{id:!f.f?c+\"_filter\":null,\"class\":b.sFilter}).append(h(\"<label/>\").append(j)),f=function(){var b=!this.value?\n\"\":this.value;b!=e.sSearch&&(fa(a,{sSearch:b,bRegex:e.bRegex,bSmart:e.bSmart,bCaseInsensitive:e.bCaseInsensitive}),a._iDisplayStart=0,O(a))},g=null!==a.searchDelay?a.searchDelay:\"ssp\"===y(a)?400:0,i=h(\"input\",b).val(e.sSearch).attr(\"placeholder\",d.sSearchPlaceholder).bind(\"keyup.DT search.DT input.DT paste.DT cut.DT\",g?Oa(f,g):f).bind(\"keypress.DT\",function(a){if(13==a.keyCode)return!1}).attr(\"aria-controls\",c);h(a.nTable).on(\"search.dt.DT\",function(b,c){if(a===c)try{i[0]!==I.activeElement&&i.val(e.sSearch)}catch(d){}});\nreturn b[0]}function fa(a,b,c){var d=a.oPreviousSearch,e=a.aoPreSearchCols,f=function(a){d.sSearch=a.sSearch;d.bRegex=a.bRegex;d.bSmart=a.bSmart;d.bCaseInsensitive=a.bCaseInsensitive};Ga(a);if(\"ssp\"!=y(a)){wb(a,b.sSearch,c,b.bEscapeRegex!==k?!b.bEscapeRegex:b.bRegex,b.bSmart,b.bCaseInsensitive);f(b);for(b=0;b<e.length;b++)xb(a,e[b].sSearch,b,e[b].bEscapeRegex!==k?!e[b].bEscapeRegex:e[b].bRegex,e[b].bSmart,e[b].bCaseInsensitive);yb(a)}else f(b);a.bFiltered=!0;u(a,null,\"search\",[a])}function yb(a){for(var b=\nm.ext.search,c=a.aiDisplay,d,e,f=0,g=b.length;f<g;f++){for(var j=[],i=0,n=c.length;i<n;i++)e=c[i],d=a.aoData[e],b[f](a,d._aFilterData,e,d._aData,i)&&j.push(e);c.length=0;h.merge(c,j)}}function xb(a,b,c,d,e,f){if(\"\"!==b)for(var g=a.aiDisplay,d=Pa(b,d,e,f),e=g.length-1;0<=e;e--)b=a.aoData[g[e]]._aFilterData[c],d.test(b)||g.splice(e,1)}function wb(a,b,c,d,e,f){var d=Pa(b,d,e,f),e=a.oPreviousSearch.sSearch,f=a.aiDisplayMaster,g;0!==m.ext.search.length&&(c=!0);g=zb(a);if(0>=b.length)a.aiDisplay=f.slice();\nelse{if(g||c||e.length>b.length||0!==b.indexOf(e)||a.bSorted)a.aiDisplay=f.slice();b=a.aiDisplay;for(c=b.length-1;0<=c;c--)d.test(a.aoData[b[c]]._sFilterRow)||b.splice(c,1)}}function Pa(a,b,c,d){a=b?a:Qa(a);c&&(a=\"^(?=.*?\"+h.map(a.match(/\"[^\"]+\"|[^ ]+/g)||[\"\"],function(a){if('\"'===a.charAt(0))var b=a.match(/^\"(.*)\"$/),a=b?b[1]:a;return a.replace('\"',\"\")}).join(\")(?=.*?\")+\").*$\");return RegExp(a,d?\"i\":\"\")}function zb(a){var b=a.aoColumns,c,d,e,f,g,j,i,h,l=m.ext.type.search;c=!1;d=0;for(f=a.aoData.length;d<\nf;d++)if(h=a.aoData[d],!h._aFilterData){j=[];e=0;for(g=b.length;e<g;e++)c=b[e],c.bSearchable?(i=B(a,d,e,\"filter\"),l[c.sType]&&(i=l[c.sType](i)),null===i&&(i=\"\"),\"string\"!==typeof i&&i.toString&&(i=i.toString())):i=\"\",i.indexOf&&-1!==i.indexOf(\"&\")&&(ua.innerHTML=i,i=Zb?ua.textContent:ua.innerText),i.replace&&(i=i.replace(/[\\r\\n]/g,\"\")),j.push(i);h._aFilterData=j;h._sFilterRow=j.join(\"  \");c=!0}return c}function Ab(a){return{search:a.sSearch,smart:a.bSmart,regex:a.bRegex,caseInsensitive:a.bCaseInsensitive}}\nfunction Bb(a){return{sSearch:a.search,bSmart:a.smart,bRegex:a.regex,bCaseInsensitive:a.caseInsensitive}}function sb(a){var b=a.sTableId,c=a.aanFeatures.i,d=h(\"<div/>\",{\"class\":a.oClasses.sInfo,id:!c?b+\"_info\":null});c||(a.aoDrawCallback.push({fn:Cb,sName:\"information\"}),d.attr(\"role\",\"status\").attr(\"aria-live\",\"polite\"),h(a.nTable).attr(\"aria-describedby\",b+\"_info\"));return d[0]}function Cb(a){var b=a.aanFeatures.i;if(0!==b.length){var c=a.oLanguage,d=a._iDisplayStart+1,e=a.fnDisplayEnd(),f=a.fnRecordsTotal(),\ng=a.fnRecordsDisplay(),j=g?c.sInfo:c.sInfoEmpty;g!==f&&(j+=\" \"+c.sInfoFiltered);j+=c.sInfoPostFix;j=Db(a,j);c=c.fnInfoCallback;null!==c&&(j=c.call(a.oInstance,a,d,e,f,g,j));h(b).html(j)}}function Db(a,b){var c=a.fnFormatNumber,d=a._iDisplayStart+1,e=a._iDisplayLength,f=a.fnRecordsDisplay(),g=-1===e;return b.replace(/_START_/g,c.call(a,d)).replace(/_END_/g,c.call(a,a.fnDisplayEnd())).replace(/_MAX_/g,c.call(a,a.fnRecordsTotal())).replace(/_TOTAL_/g,c.call(a,f)).replace(/_PAGE_/g,c.call(a,g?1:Math.ceil(d/\ne))).replace(/_PAGES_/g,c.call(a,g?1:Math.ceil(f/e)))}function ga(a){var b,c,d=a.iInitDisplayStart,e=a.aoColumns,f;c=a.oFeatures;var g=a.bDeferLoading;if(a.bInitialised){nb(a);kb(a);ea(a,a.aoHeader);ea(a,a.aoFooter);C(a,!0);c.bAutoWidth&&Fa(a);b=0;for(c=e.length;b<c;b++)f=e[b],f.sWidth&&(f.nTh.style.width=x(f.sWidth));u(a,null,\"preInit\",[a]);T(a);e=y(a);if(\"ssp\"!=e||g)\"ajax\"==e?ra(a,[],function(c){var f=sa(a,c);for(b=0;b<f.length;b++)N(a,f[b]);a.iInitDisplayStart=d;T(a);C(a,!1);ta(a,c)},a):(C(a,!1),\nta(a))}else setTimeout(function(){ga(a)},200)}function ta(a,b){a._bInitComplete=!0;(b||a.oInit.aaData)&&Y(a);u(a,null,\"plugin-init\",[a,b]);u(a,\"aoInitComplete\",\"init\",[a,b])}function Ra(a,b){var c=parseInt(b,10);a._iDisplayLength=c;Sa(a);u(a,null,\"length\",[a,c])}function ob(a){for(var b=a.oClasses,c=a.sTableId,d=a.aLengthMenu,e=h.isArray(d[0]),f=e?d[0]:d,d=e?d[1]:d,e=h(\"<select/>\",{name:c+\"_length\",\"aria-controls\":c,\"class\":b.sLengthSelect}),g=0,j=f.length;g<j;g++)e[0][g]=new Option(d[g],f[g]);var i=\nh(\"<div><label/></div>\").addClass(b.sLength);a.aanFeatures.l||(i[0].id=c+\"_length\");i.children().append(a.oLanguage.sLengthMenu.replace(\"_MENU_\",e[0].outerHTML));h(\"select\",i).val(a._iDisplayLength).bind(\"change.DT\",function(){Ra(a,h(this).val());O(a)});h(a.nTable).bind(\"length.dt.DT\",function(b,c,d){a===c&&h(\"select\",i).val(d)});return i[0]}function tb(a){var b=a.sPaginationType,c=m.ext.pager[b],d=\"function\"===typeof c,e=function(a){O(a)},b=h(\"<div/>\").addClass(a.oClasses.sPaging+b)[0],f=a.aanFeatures;\nd||c.fnInit(a,b,e);f.p||(b.id=a.sTableId+\"_paginate\",a.aoDrawCallback.push({fn:function(a){if(d){var b=a._iDisplayStart,i=a._iDisplayLength,h=a.fnRecordsDisplay(),l=-1===i,b=l?0:Math.ceil(b/i),i=l?1:Math.ceil(h/i),h=c(b,i),k,l=0;for(k=f.p.length;l<k;l++)Na(a,\"pageButton\")(a,f.p[l],l,h,b,i)}else c.fnUpdate(a,e)},sName:\"pagination\"}));return b}function Ta(a,b,c){var d=a._iDisplayStart,e=a._iDisplayLength,f=a.fnRecordsDisplay();0===f||-1===e?d=0:\"number\"===typeof b?(d=b*e,d>f&&(d=0)):\"first\"==b?d=0:\n\"previous\"==b?(d=0<=e?d-e:0,0>d&&(d=0)):\"next\"==b?d+e<f&&(d+=e):\"last\"==b?d=Math.floor((f-1)/e)*e:L(a,0,\"Unknown paging action: \"+b,5);b=a._iDisplayStart!==d;a._iDisplayStart=d;b&&(u(a,null,\"page\",[a]),c&&O(a));return b}function qb(a){return h(\"<div/>\",{id:!a.aanFeatures.r?a.sTableId+\"_processing\":null,\"class\":a.oClasses.sProcessing}).html(a.oLanguage.sProcessing).insertBefore(a.nTable)[0]}function C(a,b){a.oFeatures.bProcessing&&h(a.aanFeatures.r).css(\"display\",b?\"block\":\"none\");u(a,null,\"processing\",\n[a,b])}function rb(a){var b=h(a.nTable);b.attr(\"role\",\"grid\");var c=a.oScroll;if(\"\"===c.sX&&\"\"===c.sY)return a.nTable;var d=c.sX,e=c.sY,f=a.oClasses,g=b.children(\"caption\"),j=g.length?g[0]._captionSide:null,i=h(b[0].cloneNode(!1)),n=h(b[0].cloneNode(!1)),l=b.children(\"tfoot\");l.length||(l=null);i=h(\"<div/>\",{\"class\":f.sScrollWrapper}).append(h(\"<div/>\",{\"class\":f.sScrollHead}).css({overflow:\"hidden\",position:\"relative\",border:0,width:d?!d?null:x(d):\"100%\"}).append(h(\"<div/>\",{\"class\":f.sScrollHeadInner}).css({\"box-sizing\":\"content-box\",\nwidth:c.sXInner||\"100%\"}).append(i.removeAttr(\"id\").css(\"margin-left\",0).append(\"top\"===j?g:null).append(b.children(\"thead\"))))).append(h(\"<div/>\",{\"class\":f.sScrollBody}).css({position:\"relative\",overflow:\"auto\",width:!d?null:x(d)}).append(b));l&&i.append(h(\"<div/>\",{\"class\":f.sScrollFoot}).css({overflow:\"hidden\",border:0,width:d?!d?null:x(d):\"100%\"}).append(h(\"<div/>\",{\"class\":f.sScrollFootInner}).append(n.removeAttr(\"id\").css(\"margin-left\",0).append(\"bottom\"===j?g:null).append(b.children(\"tfoot\")))));\nvar b=i.children(),k=b[0],f=b[1],t=l?b[2]:null;if(d)h(f).on(\"scroll.DT\",function(){var a=this.scrollLeft;k.scrollLeft=a;l&&(t.scrollLeft=a)});h(f).css(e&&c.bCollapse?\"max-height\":\"height\",e);a.nScrollHead=k;a.nScrollBody=f;a.nScrollFoot=t;a.aoDrawCallback.push({fn:ka,sName:\"scrolling\"});return i[0]}function ka(a){var b=a.oScroll,c=b.sX,d=b.sXInner,e=b.sY,b=b.iBarWidth,f=h(a.nScrollHead),g=f[0].style,j=f.children(\"div\"),i=j[0].style,n=j.children(\"table\"),j=a.nScrollBody,l=h(j),q=j.style,t=h(a.nScrollFoot).children(\"div\"),\nm=t.children(\"table\"),o=h(a.nTHead),F=h(a.nTable),p=F[0],r=p.style,u=a.nTFoot?h(a.nTFoot):null,Eb=a.oBrowser,Ua=Eb.bScrollOversize,s=G(a.aoColumns,\"nTh\"),P,v,w,y,z=[],A=[],B=[],C=[],D,E=function(a){a=a.style;a.paddingTop=\"0\";a.paddingBottom=\"0\";a.borderTopWidth=\"0\";a.borderBottomWidth=\"0\";a.height=0};v=j.scrollHeight>j.clientHeight;if(a.scrollBarVis!==v&&a.scrollBarVis!==k)a.scrollBarVis=v,Y(a);else{a.scrollBarVis=v;F.children(\"thead, tfoot\").remove();u&&(w=u.clone().prependTo(F),P=u.find(\"tr\"),w=\nw.find(\"tr\"));y=o.clone().prependTo(F);o=o.find(\"tr\");v=y.find(\"tr\");y.find(\"th, td\").removeAttr(\"tabindex\");c||(q.width=\"100%\",f[0].style.width=\"100%\");h.each(qa(a,y),function(b,c){D=Z(a,b);c.style.width=a.aoColumns[D].sWidth});u&&J(function(a){a.style.width=\"\"},w);f=F.outerWidth();if(\"\"===c){r.width=\"100%\";if(Ua&&(F.find(\"tbody\").height()>j.offsetHeight||\"scroll\"==l.css(\"overflow-y\")))r.width=x(F.outerWidth()-b);f=F.outerWidth()}else\"\"!==d&&(r.width=x(d),f=F.outerWidth());J(E,v);J(function(a){B.push(a.innerHTML);\nz.push(x(h(a).css(\"width\")))},v);J(function(a,b){if(h.inArray(a,s)!==-1)a.style.width=z[b]},o);h(v).height(0);u&&(J(E,w),J(function(a){C.push(a.innerHTML);A.push(x(h(a).css(\"width\")))},w),J(function(a,b){a.style.width=A[b]},P),h(w).height(0));J(function(a,b){a.innerHTML='<div class=\"dataTables_sizing\" style=\"height:0;overflow:hidden;\">'+B[b]+\"</div>\";a.style.width=z[b]},v);u&&J(function(a,b){a.innerHTML='<div class=\"dataTables_sizing\" style=\"height:0;overflow:hidden;\">'+C[b]+\"</div>\";a.style.width=\nA[b]},w);if(F.outerWidth()<f){P=j.scrollHeight>j.offsetHeight||\"scroll\"==l.css(\"overflow-y\")?f+b:f;if(Ua&&(j.scrollHeight>j.offsetHeight||\"scroll\"==l.css(\"overflow-y\")))r.width=x(P-b);(\"\"===c||\"\"!==d)&&L(a,1,\"Possible column misalignment\",6)}else P=\"100%\";q.width=x(P);g.width=x(P);u&&(a.nScrollFoot.style.width=x(P));!e&&Ua&&(q.height=x(p.offsetHeight+b));c=F.outerWidth();n[0].style.width=x(c);i.width=x(c);d=F.height()>j.clientHeight||\"scroll\"==l.css(\"overflow-y\");e=\"padding\"+(Eb.bScrollbarLeft?\"Left\":\n\"Right\");i[e]=d?b+\"px\":\"0px\";u&&(m[0].style.width=x(c),t[0].style.width=x(c),t[0].style[e]=d?b+\"px\":\"0px\");F.children(\"colgroup\").insertBefore(F.children(\"thead\"));l.scroll();if((a.bSorted||a.bFiltered)&&!a._drawHold)j.scrollTop=0}}function J(a,b,c){for(var d=0,e=0,f=b.length,g,j;e<f;){g=b[e].firstChild;for(j=c?c[e].firstChild:null;g;)1===g.nodeType&&(c?a(g,j,d):a(g,d),d++),g=g.nextSibling,j=c?j.nextSibling:null;e++}}function Fa(a){var b=a.nTable,c=a.aoColumns,d=a.oScroll,e=d.sY,f=d.sX,g=d.sXInner,\nj=c.length,i=la(a,\"bVisible\"),n=h(\"th\",a.nTHead),l=b.getAttribute(\"width\"),k=b.parentNode,t=!1,m,o,p=a.oBrowser,d=p.bScrollOversize;(m=b.style.width)&&-1!==m.indexOf(\"%\")&&(l=m);for(m=0;m<i.length;m++)o=c[i[m]],null!==o.sWidth&&(o.sWidth=Fb(o.sWidthOrig,k),t=!0);if(d||!t&&!f&&!e&&j==aa(a)&&j==n.length)for(m=0;m<j;m++)i=Z(a,m),null!==i&&(c[i].sWidth=x(n.eq(m).width()));else{j=h(b).clone().css(\"visibility\",\"hidden\").removeAttr(\"id\");j.find(\"tbody tr\").remove();var r=h(\"<tr/>\").appendTo(j.find(\"tbody\"));\nj.find(\"thead, tfoot\").remove();j.append(h(a.nTHead).clone()).append(h(a.nTFoot).clone());j.find(\"tfoot th, tfoot td\").css(\"width\",\"\");n=qa(a,j.find(\"thead\")[0]);for(m=0;m<i.length;m++)o=c[i[m]],n[m].style.width=null!==o.sWidthOrig&&\"\"!==o.sWidthOrig?x(o.sWidthOrig):\"\",o.sWidthOrig&&f&&h(n[m]).append(h(\"<div/>\").css({width:o.sWidthOrig,margin:0,padding:0,border:0,height:1}));if(a.aoData.length)for(m=0;m<i.length;m++)t=i[m],o=c[t],h(Gb(a,t)).clone(!1).append(o.sContentPadding).appendTo(r);h(\"[name]\",\nj).removeAttr(\"name\");o=h(\"<div/>\").css(f||e?{position:\"absolute\",top:0,left:0,height:1,right:0,overflow:\"hidden\"}:{}).append(j).appendTo(k);f&&g?j.width(g):f?(j.css(\"width\",\"auto\"),j.removeAttr(\"width\"),j.width()<k.clientWidth&&l&&j.width(k.clientWidth)):e?j.width(k.clientWidth):l&&j.width(l);for(m=e=0;m<i.length;m++)k=h(n[m]),g=k.outerWidth()-k.width(),k=p.bBounding?Math.ceil(n[m].getBoundingClientRect().width):k.outerWidth(),e+=k,c[i[m]].sWidth=x(k-g);b.style.width=x(e);o.remove()}l&&(b.style.width=\nx(l));if((l||f)&&!a._reszEvt)b=function(){h(D).bind(\"resize.DT-\"+a.sInstance,Oa(function(){Y(a)}))},d?setTimeout(b,1E3):b(),a._reszEvt=!0}function Fb(a,b){if(!a)return 0;var c=h(\"<div/>\").css(\"width\",x(a)).appendTo(b||I.body),d=c[0].offsetWidth;c.remove();return d}function Gb(a,b){var c=Hb(a,b);if(0>c)return null;var d=a.aoData[c];return!d.nTr?h(\"<td/>\").html(B(a,c,b,\"display\"))[0]:d.anCells[b]}function Hb(a,b){for(var c,d=-1,e=-1,f=0,g=a.aoData.length;f<g;f++)c=B(a,f,b,\"display\")+\"\",c=c.replace($b,\n\"\"),c=c.replace(/&nbsp;/g,\" \"),c.length>d&&(d=c.length,e=f);return e}function x(a){return null===a?\"0px\":\"number\"==typeof a?0>a?\"0px\":a+\"px\":a.match(/\\d$/)?a+\"px\":a}function V(a){var b,c,d=[],e=a.aoColumns,f,g,j,i;b=a.aaSortingFixed;c=h.isPlainObject(b);var n=[];f=function(a){a.length&&!h.isArray(a[0])?n.push(a):h.merge(n,a)};h.isArray(b)&&f(b);c&&b.pre&&f(b.pre);f(a.aaSorting);c&&b.post&&f(b.post);for(a=0;a<n.length;a++){i=n[a][0];f=e[i].aDataSort;b=0;for(c=f.length;b<c;b++)g=f[b],j=e[g].sType||\n\"string\",n[a]._idx===k&&(n[a]._idx=h.inArray(n[a][1],e[g].asSorting)),d.push({src:i,col:g,dir:n[a][1],index:n[a]._idx,type:j,formatter:m.ext.type.order[j+\"-pre\"]})}return d}function mb(a){var b,c,d=[],e=m.ext.type.order,f=a.aoData,g=0,j,i=a.aiDisplayMaster,h;Ga(a);h=V(a);b=0;for(c=h.length;b<c;b++)j=h[b],j.formatter&&g++,Ib(a,j.col);if(\"ssp\"!=y(a)&&0!==h.length){b=0;for(c=i.length;b<c;b++)d[i[b]]=b;g===h.length?i.sort(function(a,b){var c,e,g,j,i=h.length,k=f[a]._aSortData,m=f[b]._aSortData;for(g=\n0;g<i;g++)if(j=h[g],c=k[j.col],e=m[j.col],c=c<e?-1:c>e?1:0,0!==c)return\"asc\"===j.dir?c:-c;c=d[a];e=d[b];return c<e?-1:c>e?1:0}):i.sort(function(a,b){var c,g,j,i,k=h.length,m=f[a]._aSortData,p=f[b]._aSortData;for(j=0;j<k;j++)if(i=h[j],c=m[i.col],g=p[i.col],i=e[i.type+\"-\"+i.dir]||e[\"string-\"+i.dir],c=i(c,g),0!==c)return c;c=d[a];g=d[b];return c<g?-1:c>g?1:0})}a.bSorted=!0}function Jb(a){for(var b,c,d=a.aoColumns,e=V(a),a=a.oLanguage.oAria,f=0,g=d.length;f<g;f++){c=d[f];var j=c.asSorting;b=c.sTitle.replace(/<.*?>/g,\n\"\");var i=c.nTh;i.removeAttribute(\"aria-sort\");c.bSortable&&(0<e.length&&e[0].col==f?(i.setAttribute(\"aria-sort\",\"asc\"==e[0].dir?\"ascending\":\"descending\"),c=j[e[0].index+1]||j[0]):c=j[0],b+=\"asc\"===c?a.sSortAscending:a.sSortDescending);i.setAttribute(\"aria-label\",b)}}function Va(a,b,c,d){var e=a.aaSorting,f=a.aoColumns[b].asSorting,g=function(a,b){var c=a._idx;c===k&&(c=h.inArray(a[1],f));return c+1<f.length?c+1:b?null:0};\"number\"===typeof e[0]&&(e=a.aaSorting=[e]);c&&a.oFeatures.bSortMulti?(c=h.inArray(b,\nG(e,\"0\")),-1!==c?(b=g(e[c],!0),null===b&&1===e.length&&(b=0),null===b?e.splice(c,1):(e[c][1]=f[b],e[c]._idx=b)):(e.push([b,f[0],0]),e[e.length-1]._idx=0)):e.length&&e[0][0]==b?(b=g(e[0]),e.length=1,e[0][1]=f[b],e[0]._idx=b):(e.length=0,e.push([b,f[0]]),e[0]._idx=0);T(a);\"function\"==typeof d&&d(a)}function Ma(a,b,c,d){var e=a.aoColumns[c];Wa(b,{},function(b){!1!==e.bSortable&&(a.oFeatures.bProcessing?(C(a,!0),setTimeout(function(){Va(a,c,b.shiftKey,d);\"ssp\"!==y(a)&&C(a,!1)},0)):Va(a,c,b.shiftKey,d))})}\nfunction va(a){var b=a.aLastSort,c=a.oClasses.sSortColumn,d=V(a),e=a.oFeatures,f,g;if(e.bSort&&e.bSortClasses){e=0;for(f=b.length;e<f;e++)g=b[e].src,h(G(a.aoData,\"anCells\",g)).removeClass(c+(2>e?e+1:3));e=0;for(f=d.length;e<f;e++)g=d[e].src,h(G(a.aoData,\"anCells\",g)).addClass(c+(2>e?e+1:3))}a.aLastSort=d}function Ib(a,b){var c=a.aoColumns[b],d=m.ext.order[c.sSortDataType],e;d&&(e=d.call(a.oInstance,a,b,$(a,b)));for(var f,g=m.ext.type.order[c.sType+\"-pre\"],j=0,i=a.aoData.length;j<i;j++)if(c=a.aoData[j],\nc._aSortData||(c._aSortData=[]),!c._aSortData[b]||d)f=d?e[j]:B(a,j,b,\"sort\"),c._aSortData[b]=g?g(f):f}function wa(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b={time:+new Date,start:a._iDisplayStart,length:a._iDisplayLength,order:h.extend(!0,[],a.aaSorting),search:Ab(a.oPreviousSearch),columns:h.map(a.aoColumns,function(b,d){return{visible:b.bVisible,search:Ab(a.aoPreSearchCols[d])}})};u(a,\"aoStateSaveParams\",\"stateSaveParams\",[a,b]);a.oSavedState=b;a.fnStateSaveCallback.call(a.oInstance,a,\nb)}}function Kb(a){var b,c,d=a.aoColumns;if(a.oFeatures.bStateSave){var e=a.fnStateLoadCallback.call(a.oInstance,a);if(e&&e.time&&(b=u(a,\"aoStateLoadParams\",\"stateLoadParams\",[a,e]),-1===h.inArray(!1,b)&&(b=a.iStateDuration,!(0<b&&e.time<+new Date-1E3*b)&&d.length===e.columns.length))){a.oLoadedState=h.extend(!0,{},e);e.start!==k&&(a._iDisplayStart=e.start,a.iInitDisplayStart=e.start);e.length!==k&&(a._iDisplayLength=e.length);e.order!==k&&(a.aaSorting=[],h.each(e.order,function(b,c){a.aaSorting.push(c[0]>=\nd.length?[0,c[1]]:c)}));e.search!==k&&h.extend(a.oPreviousSearch,Bb(e.search));b=0;for(c=e.columns.length;b<c;b++){var f=e.columns[b];f.visible!==k&&(d[b].bVisible=f.visible);f.search!==k&&h.extend(a.aoPreSearchCols[b],Bb(f.search))}u(a,\"aoStateLoaded\",\"stateLoaded\",[a,e])}}}function xa(a){var b=m.settings,a=h.inArray(a,G(b,\"nTable\"));return-1!==a?b[a]:null}function L(a,b,c,d){c=\"DataTables warning: \"+(a?\"table id=\"+a.sTableId+\" - \":\"\")+c;d&&(c+=\". For more information about this error, please see http://datatables.net/tn/\"+\nd);if(b)D.console&&console.log&&console.log(c);else if(b=m.ext,b=b.sErrMode||b.errMode,a&&u(a,null,\"error\",[a,d,c]),\"alert\"==b)alert(c);else{if(\"throw\"==b)throw Error(c);\"function\"==typeof b&&b(a,d,c)}}function E(a,b,c,d){h.isArray(c)?h.each(c,function(c,d){h.isArray(d)?E(a,b,d[0],d[1]):E(a,b,d)}):(d===k&&(d=c),b[c]!==k&&(a[d]=b[c]))}function Lb(a,b,c){var d,e;for(e in b)b.hasOwnProperty(e)&&(d=b[e],h.isPlainObject(d)?(h.isPlainObject(a[e])||(a[e]={}),h.extend(!0,a[e],d)):a[e]=c&&\"data\"!==e&&\"aaData\"!==\ne&&h.isArray(d)?d.slice():d);return a}function Wa(a,b,c){h(a).bind(\"click.DT\",b,function(b){a.blur();c(b)}).bind(\"keypress.DT\",b,function(a){13===a.which&&(a.preventDefault(),c(a))}).bind(\"selectstart.DT\",function(){return!1})}function z(a,b,c,d){c&&a[b].push({fn:c,sName:d})}function u(a,b,c,d){var e=[];b&&(e=h.map(a[b].slice().reverse(),function(b){return b.fn.apply(a.oInstance,d)}));null!==c&&(b=h.Event(c+\".dt\"),h(a.nTable).trigger(b,d),e.push(b.result));return e}function Sa(a){var b=a._iDisplayStart,\nc=a.fnDisplayEnd(),d=a._iDisplayLength;b>=c&&(b=c-d);b-=b%d;if(-1===d||0>b)b=0;a._iDisplayStart=b}function Na(a,b){var c=a.renderer,d=m.ext.renderer[b];return h.isPlainObject(c)&&c[b]?d[c[b]]||d._:\"string\"===typeof c?d[c]||d._:d._}function y(a){return a.oFeatures.bServerSide?\"ssp\":a.ajax||a.sAjaxSource?\"ajax\":\"dom\"}function ya(a,b){var c=[],c=Mb.numbers_length,d=Math.floor(c/2);b<=c?c=W(0,b):a<=d?(c=W(0,c-2),c.push(\"ellipsis\"),c.push(b-1)):(a>=b-1-d?c=W(b-(c-2),b):(c=W(a-d+2,a+d-1),c.push(\"ellipsis\"),\nc.push(b-1)),c.splice(0,0,\"ellipsis\"),c.splice(0,0,0));c.DT_el=\"span\";return c}function db(a){h.each({num:function(b){return za(b,a)},\"num-fmt\":function(b){return za(b,a,Xa)},\"html-num\":function(b){return za(b,a,Aa)},\"html-num-fmt\":function(b){return za(b,a,Aa,Xa)}},function(b,c){v.type.order[b+a+\"-pre\"]=c;b.match(/^html\\-/)&&(v.type.search[b+a]=v.type.search.html)})}function Nb(a){return function(){var b=[xa(this[m.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return m.ext.internal[a].apply(this,\nb)}}var m=function(a){this.$=function(a,b){return this.api(!0).$(a,b)};this._=function(a,b){return this.api(!0).rows(a,b).data()};this.api=function(a){return a?new r(xa(this[v.iApiIndex])):new r(this)};this.fnAddData=function(a,b){var c=this.api(!0),d=h.isArray(a)&&(h.isArray(a[0])||h.isPlainObject(a[0]))?c.rows.add(a):c.row.add(a);(b===k||b)&&c.draw();return d.flatten().toArray()};this.fnAdjustColumnSizing=function(a){var b=this.api(!0).columns.adjust(),c=b.settings()[0],d=c.oScroll;a===k||a?b.draw(!1):\n(\"\"!==d.sX||\"\"!==d.sY)&&ka(c)};this.fnClearTable=function(a){var b=this.api(!0).clear();(a===k||a)&&b.draw()};this.fnClose=function(a){this.api(!0).row(a).child.hide()};this.fnDeleteRow=function(a,b,c){var d=this.api(!0),a=d.rows(a),e=a.settings()[0],h=e.aoData[a[0][0]];a.remove();b&&b.call(this,e,h);(c===k||c)&&d.draw();return h};this.fnDestroy=function(a){this.api(!0).destroy(a)};this.fnDraw=function(a){this.api(!0).draw(a)};this.fnFilter=function(a,b,c,d,e,h){e=this.api(!0);null===b||b===k?e.search(a,\nc,d,h):e.column(b).search(a,c,d,h);e.draw()};this.fnGetData=function(a,b){var c=this.api(!0);if(a!==k){var d=a.nodeName?a.nodeName.toLowerCase():\"\";return b!==k||\"td\"==d||\"th\"==d?c.cell(a,b).data():c.row(a).data()||null}return c.data().toArray()};this.fnGetNodes=function(a){var b=this.api(!0);return a!==k?b.row(a).node():b.rows().nodes().flatten().toArray()};this.fnGetPosition=function(a){var b=this.api(!0),c=a.nodeName.toUpperCase();return\"TR\"==c?b.row(a).index():\"TD\"==c||\"TH\"==c?(a=b.cell(a).index(),\n[a.row,a.columnVisible,a.column]):null};this.fnIsOpen=function(a){return this.api(!0).row(a).child.isShown()};this.fnOpen=function(a,b,c){return this.api(!0).row(a).child(b,c).show().child()[0]};this.fnPageChange=function(a,b){var c=this.api(!0).page(a);(b===k||b)&&c.draw(!1)};this.fnSetColumnVis=function(a,b,c){a=this.api(!0).column(a).visible(b);(c===k||c)&&a.columns.adjust().draw()};this.fnSettings=function(){return xa(this[v.iApiIndex])};this.fnSort=function(a){this.api(!0).order(a).draw()};this.fnSortListener=\nfunction(a,b,c){this.api(!0).order.listener(a,b,c)};this.fnUpdate=function(a,b,c,d,e){var h=this.api(!0);c===k||null===c?h.row(b).data(a):h.cell(b,c).data(a);(e===k||e)&&h.columns.adjust();(d===k||d)&&h.draw();return 0};this.fnVersionCheck=v.fnVersionCheck;var b=this,c=a===k,d=this.length;c&&(a={});this.oApi=this.internal=v.internal;for(var e in m.ext.internal)e&&(this[e]=Nb(e));this.each(function(){var e={},e=1<d?Lb(e,a,!0):a,g=0,j,i=this.getAttribute(\"id\"),n=!1,l=m.defaults,q=h(this);if(\"table\"!=\nthis.nodeName.toLowerCase())L(null,0,\"Non-table node initialisation (\"+this.nodeName+\")\",2);else{eb(l);fb(l.column);K(l,l,!0);K(l.column,l.column,!0);K(l,h.extend(e,q.data()));var t=m.settings,g=0;for(j=t.length;g<j;g++){var p=t[g];if(p.nTable==this||p.nTHead.parentNode==this||p.nTFoot&&p.nTFoot.parentNode==this){g=e.bRetrieve!==k?e.bRetrieve:l.bRetrieve;if(c||g)return p.oInstance;if(e.bDestroy!==k?e.bDestroy:l.bDestroy){p.oInstance.fnDestroy();break}else{L(p,0,\"Cannot reinitialise DataTable\",3);\nreturn}}if(p.sTableId==this.id){t.splice(g,1);break}}if(null===i||\"\"===i)this.id=i=\"DataTables_Table_\"+m.ext._unique++;var o=h.extend(!0,{},m.models.oSettings,{sDestroyWidth:q[0].style.width,sInstance:i,sTableId:i});o.nTable=this;o.oApi=b.internal;o.oInit=e;t.push(o);o.oInstance=1===b.length?b:q.dataTable();eb(e);e.oLanguage&&Da(e.oLanguage);e.aLengthMenu&&!e.iDisplayLength&&(e.iDisplayLength=h.isArray(e.aLengthMenu[0])?e.aLengthMenu[0][0]:e.aLengthMenu[0]);e=Lb(h.extend(!0,{},l),e);E(o.oFeatures,\ne,\"bPaginate bLengthChange bFilter bSort bSortMulti bInfo bProcessing bAutoWidth bSortClasses bServerSide bDeferRender\".split(\" \"));E(o,e,[\"asStripeClasses\",\"ajax\",\"fnServerData\",\"fnFormatNumber\",\"sServerMethod\",\"aaSorting\",\"aaSortingFixed\",\"aLengthMenu\",\"sPaginationType\",\"sAjaxSource\",\"sAjaxDataProp\",\"iStateDuration\",\"sDom\",\"bSortCellsTop\",\"iTabIndex\",\"fnStateLoadCallback\",\"fnStateSaveCallback\",\"renderer\",\"searchDelay\",\"rowId\",[\"iCookieDuration\",\"iStateDuration\"],[\"oSearch\",\"oPreviousSearch\"],[\"aoSearchCols\",\n\"aoPreSearchCols\"],[\"iDisplayLength\",\"_iDisplayLength\"],[\"bJQueryUI\",\"bJUI\"]]);E(o.oScroll,e,[[\"sScrollX\",\"sX\"],[\"sScrollXInner\",\"sXInner\"],[\"sScrollY\",\"sY\"],[\"bScrollCollapse\",\"bCollapse\"]]);E(o.oLanguage,e,\"fnInfoCallback\");z(o,\"aoDrawCallback\",e.fnDrawCallback,\"user\");z(o,\"aoServerParams\",e.fnServerParams,\"user\");z(o,\"aoStateSaveParams\",e.fnStateSaveParams,\"user\");z(o,\"aoStateLoadParams\",e.fnStateLoadParams,\"user\");z(o,\"aoStateLoaded\",e.fnStateLoaded,\"user\");z(o,\"aoRowCallback\",e.fnRowCallback,\n\"user\");z(o,\"aoRowCreatedCallback\",e.fnCreatedRow,\"user\");z(o,\"aoHeaderCallback\",e.fnHeaderCallback,\"user\");z(o,\"aoFooterCallback\",e.fnFooterCallback,\"user\");z(o,\"aoInitComplete\",e.fnInitComplete,\"user\");z(o,\"aoPreDrawCallback\",e.fnPreDrawCallback,\"user\");o.rowIdFn=Q(e.rowId);gb(o);i=o.oClasses;e.bJQueryUI?(h.extend(i,m.ext.oJUIClasses,e.oClasses),e.sDom===l.sDom&&\"lfrtip\"===l.sDom&&(o.sDom='<\"H\"lfr>t<\"F\"ip>'),o.renderer)?h.isPlainObject(o.renderer)&&!o.renderer.header&&(o.renderer.header=\"jqueryui\"):\no.renderer=\"jqueryui\":h.extend(i,m.ext.classes,e.oClasses);q.addClass(i.sTable);o.iInitDisplayStart===k&&(o.iInitDisplayStart=e.iDisplayStart,o._iDisplayStart=e.iDisplayStart);null!==e.iDeferLoading&&(o.bDeferLoading=!0,g=h.isArray(e.iDeferLoading),o._iRecordsDisplay=g?e.iDeferLoading[0]:e.iDeferLoading,o._iRecordsTotal=g?e.iDeferLoading[1]:e.iDeferLoading);var r=o.oLanguage;h.extend(!0,r,e.oLanguage);\"\"!==r.sUrl&&(h.ajax({dataType:\"json\",url:r.sUrl,success:function(a){Da(a);K(l.oLanguage,a);h.extend(true,\nr,a);ga(o)},error:function(){ga(o)}}),n=!0);null===e.asStripeClasses&&(o.asStripeClasses=[i.sStripeOdd,i.sStripeEven]);var g=o.asStripeClasses,v=q.children(\"tbody\").find(\"tr\").eq(0);-1!==h.inArray(!0,h.map(g,function(a){return v.hasClass(a)}))&&(h(\"tbody tr\",this).removeClass(g.join(\" \")),o.asDestroyStripes=g.slice());t=[];g=this.getElementsByTagName(\"thead\");0!==g.length&&(da(o.aoHeader,g[0]),t=qa(o));if(null===e.aoColumns){p=[];g=0;for(j=t.length;g<j;g++)p.push(null)}else p=e.aoColumns;g=0;for(j=\np.length;g<j;g++)Ea(o,t?t[g]:null);ib(o,e.aoColumnDefs,p,function(a,b){ja(o,a,b)});if(v.length){var s=function(a,b){return a.getAttribute(\"data-\"+b)!==null?b:null};h(v[0]).children(\"th, td\").each(function(a,b){var c=o.aoColumns[a];if(c.mData===a){var d=s(b,\"sort\")||s(b,\"order\"),e=s(b,\"filter\")||s(b,\"search\");if(d!==null||e!==null){c.mData={_:a+\".display\",sort:d!==null?a+\".@data-\"+d:k,type:d!==null?a+\".@data-\"+d:k,filter:e!==null?a+\".@data-\"+e:k};ja(o,a)}}})}var w=o.oFeatures;e.bStateSave&&(w.bStateSave=\n!0,Kb(o,e),z(o,\"aoDrawCallback\",wa,\"state_save\"));if(e.aaSorting===k){t=o.aaSorting;g=0;for(j=t.length;g<j;g++)t[g][1]=o.aoColumns[g].asSorting[0]}va(o);w.bSort&&z(o,\"aoDrawCallback\",function(){if(o.bSorted){var a=V(o),b={};h.each(a,function(a,c){b[c.src]=c.dir});u(o,null,\"order\",[o,a,b]);Jb(o)}});z(o,\"aoDrawCallback\",function(){(o.bSorted||y(o)===\"ssp\"||w.bDeferRender)&&va(o)},\"sc\");g=q.children(\"caption\").each(function(){this._captionSide=q.css(\"caption-side\")});j=q.children(\"thead\");0===j.length&&\n(j=h(\"<thead/>\").appendTo(this));o.nTHead=j[0];j=q.children(\"tbody\");0===j.length&&(j=h(\"<tbody/>\").appendTo(this));o.nTBody=j[0];j=q.children(\"tfoot\");if(0===j.length&&0<g.length&&(\"\"!==o.oScroll.sX||\"\"!==o.oScroll.sY))j=h(\"<tfoot/>\").appendTo(this);0===j.length||0===j.children().length?q.addClass(i.sNoFooter):0<j.length&&(o.nTFoot=j[0],da(o.aoFooter,o.nTFoot));if(e.aaData)for(g=0;g<e.aaData.length;g++)N(o,e.aaData[g]);else(o.bDeferLoading||\"dom\"==y(o))&&ma(o,h(o.nTBody).children(\"tr\"));o.aiDisplay=\no.aiDisplayMaster.slice();o.bInitialised=!0;!1===n&&ga(o)}});b=null;return this},v,r,p,s,Ya={},Ob=/[\\r\\n]/g,Aa=/<.*?>/g,ac=/^[\\w\\+\\-]/,bc=/[\\w\\+\\-]$/,cc=RegExp(\"(\\\\/|\\\\.|\\\\*|\\\\+|\\\\?|\\\\||\\\\(|\\\\)|\\\\[|\\\\]|\\\\{|\\\\}|\\\\\\\\|\\\\$|\\\\^|\\\\-)\",\"g\"),Xa=/[',$£€¥%\\u2009\\u202F\\u20BD\\u20a9\\u20BArfk]/gi,M=function(a){return!a||!0===a||\"-\"===a?!0:!1},Pb=function(a){var b=parseInt(a,10);return!isNaN(b)&&isFinite(a)?b:null},Qb=function(a,b){Ya[b]||(Ya[b]=RegExp(Qa(b),\"g\"));return\"string\"===typeof a&&\".\"!==b?a.replace(/\\./g,\n\"\").replace(Ya[b],\".\"):a},Za=function(a,b,c){var d=\"string\"===typeof a;if(M(a))return!0;b&&d&&(a=Qb(a,b));c&&d&&(a=a.replace(Xa,\"\"));return!isNaN(parseFloat(a))&&isFinite(a)},Rb=function(a,b,c){return M(a)?!0:!(M(a)||\"string\"===typeof a)?null:Za(a.replace(Aa,\"\"),b,c)?!0:null},G=function(a,b,c){var d=[],e=0,f=a.length;if(c!==k)for(;e<f;e++)a[e]&&a[e][b]&&d.push(a[e][b][c]);else for(;e<f;e++)a[e]&&d.push(a[e][b]);return d},ha=function(a,b,c,d){var e=[],f=0,g=b.length;if(d!==k)for(;f<g;f++)a[b[f]][c]&&\ne.push(a[b[f]][c][d]);else for(;f<g;f++)e.push(a[b[f]][c]);return e},W=function(a,b){var c=[],d;b===k?(b=0,d=a):(d=b,b=a);for(var e=b;e<d;e++)c.push(e);return c},Sb=function(a){for(var b=[],c=0,d=a.length;c<d;c++)a[c]&&b.push(a[c]);return b},pa=function(a){var b=[],c,d,e=a.length,f,g=0;d=0;a:for(;d<e;d++){c=a[d];for(f=0;f<g;f++)if(b[f]===c)continue a;b.push(c);g++}return b};m.util={throttle:function(a,b){var c=b!==k?b:200,d,e;return function(){var b=this,g=+new Date,h=arguments;d&&g<d+c?(clearTimeout(e),\ne=setTimeout(function(){d=k;a.apply(b,h)},c)):(d=g,a.apply(b,h))}},escapeRegex:function(a){return a.replace(cc,\"\\\\$1\")}};var A=function(a,b,c){a[b]!==k&&(a[c]=a[b])},ba=/\\[.*?\\]$/,U=/\\(\\)$/,Qa=m.util.escapeRegex,ua=h(\"<div>\")[0],Zb=ua.textContent!==k,$b=/<.*?>/g,Oa=m.util.throttle,Tb=[],w=Array.prototype,dc=function(a){var b,c,d=m.settings,e=h.map(d,function(a){return a.nTable});if(a){if(a.nTable&&a.oApi)return[a];if(a.nodeName&&\"table\"===a.nodeName.toLowerCase())return b=h.inArray(a,e),-1!==b?[d[b]]:\nnull;if(a&&\"function\"===typeof a.settings)return a.settings().toArray();\"string\"===typeof a?c=h(a):a instanceof h&&(c=a)}else return[];if(c)return c.map(function(){b=h.inArray(this,e);return-1!==b?d[b]:null}).toArray()};r=function(a,b){if(!(this instanceof r))return new r(a,b);var c=[],d=function(a){(a=dc(a))&&(c=c.concat(a))};if(h.isArray(a))for(var e=0,f=a.length;e<f;e++)d(a[e]);else d(a);this.context=pa(c);b&&h.merge(this,b);this.selector={rows:null,cols:null,opts:null};r.extend(this,this,Tb)};\nm.Api=r;h.extend(r.prototype,{any:function(){return 0!==this.count()},concat:w.concat,context:[],count:function(){return this.flatten().length},each:function(a){for(var b=0,c=this.length;b<c;b++)a.call(this,this[b],b,this);return this},eq:function(a){var b=this.context;return b.length>a?new r(b[a],this[a]):null},filter:function(a){var b=[];if(w.filter)b=w.filter.call(this,a,this);else for(var c=0,d=this.length;c<d;c++)a.call(this,this[c],c,this)&&b.push(this[c]);return new r(this.context,b)},flatten:function(){var a=\n[];return new r(this.context,a.concat.apply(a,this.toArray()))},join:w.join,indexOf:w.indexOf||function(a,b){for(var c=b||0,d=this.length;c<d;c++)if(this[c]===a)return c;return-1},iterator:function(a,b,c,d){var e=[],f,g,h,i,n,l=this.context,m,t,p=this.selector;\"string\"===typeof a&&(d=c,c=b,b=a,a=!1);g=0;for(h=l.length;g<h;g++){var o=new r(l[g]);if(\"table\"===b)f=c.call(o,l[g],g),f!==k&&e.push(f);else if(\"columns\"===b||\"rows\"===b)f=c.call(o,l[g],this[g],g),f!==k&&e.push(f);else if(\"column\"===b||\"column-rows\"===\nb||\"row\"===b||\"cell\"===b){t=this[g];\"column-rows\"===b&&(m=Ba(l[g],p.opts));i=0;for(n=t.length;i<n;i++)f=t[i],f=\"cell\"===b?c.call(o,l[g],f.row,f.column,g,i):c.call(o,l[g],f,g,i,m),f!==k&&e.push(f)}}return e.length||d?(a=new r(l,a?e.concat.apply([],e):e),b=a.selector,b.rows=p.rows,b.cols=p.cols,b.opts=p.opts,a):this},lastIndexOf:w.lastIndexOf||function(a,b){return this.indexOf.apply(this.toArray.reverse(),arguments)},length:0,map:function(a){var b=[];if(w.map)b=w.map.call(this,a,this);else for(var c=\n0,d=this.length;c<d;c++)b.push(a.call(this,this[c],c));return new r(this.context,b)},pluck:function(a){return this.map(function(b){return b[a]})},pop:w.pop,push:w.push,reduce:w.reduce||function(a,b){return hb(this,a,b,0,this.length,1)},reduceRight:w.reduceRight||function(a,b){return hb(this,a,b,this.length-1,-1,-1)},reverse:w.reverse,selector:null,shift:w.shift,sort:w.sort,splice:w.splice,toArray:function(){return w.slice.call(this)},to$:function(){return h(this)},toJQuery:function(){return h(this)},\nunique:function(){return new r(this.context,pa(this))},unshift:w.unshift});r.extend=function(a,b,c){if(c.length&&b&&(b instanceof r||b.__dt_wrapper)){var d,e,f,g=function(a,b,c){return function(){var d=b.apply(a,arguments);r.extend(d,d,c.methodExt);return d}};d=0;for(e=c.length;d<e;d++)f=c[d],b[f.name]=\"function\"===typeof f.val?g(a,f.val,f):h.isPlainObject(f.val)?{}:f.val,b[f.name].__dt_wrapper=!0,r.extend(a,b[f.name],f.propExt)}};r.register=p=function(a,b){if(h.isArray(a))for(var c=0,d=a.length;c<\nd;c++)r.register(a[c],b);else for(var e=a.split(\".\"),f=Tb,g,j,c=0,d=e.length;c<d;c++){g=(j=-1!==e[c].indexOf(\"()\"))?e[c].replace(\"()\",\"\"):e[c];var i;a:{i=0;for(var n=f.length;i<n;i++)if(f[i].name===g){i=f[i];break a}i=null}i||(i={name:g,val:{},methodExt:[],propExt:[]},f.push(i));c===d-1?i.val=b:f=j?i.methodExt:i.propExt}};r.registerPlural=s=function(a,b,c){r.register(a,c);r.register(b,function(){var a=c.apply(this,arguments);return a===this?this:a instanceof r?a.length?h.isArray(a[0])?new r(a.context,\na[0]):a[0]:k:a})};p(\"tables()\",function(a){var b;if(a){b=r;var c=this.context;if(\"number\"===typeof a)a=[c[a]];else var d=h.map(c,function(a){return a.nTable}),a=h(d).filter(a).map(function(){var a=h.inArray(this,d);return c[a]}).toArray();b=new b(a)}else b=this;return b});p(\"table()\",function(a){var a=this.tables(a),b=a.context;return b.length?new r(b[0]):a});s(\"tables().nodes()\",\"table().node()\",function(){return this.iterator(\"table\",function(a){return a.nTable},1)});s(\"tables().body()\",\"table().body()\",\nfunction(){return this.iterator(\"table\",function(a){return a.nTBody},1)});s(\"tables().header()\",\"table().header()\",function(){return this.iterator(\"table\",function(a){return a.nTHead},1)});s(\"tables().footer()\",\"table().footer()\",function(){return this.iterator(\"table\",function(a){return a.nTFoot},1)});s(\"tables().containers()\",\"table().container()\",function(){return this.iterator(\"table\",function(a){return a.nTableWrapper},1)});p(\"draw()\",function(a){return this.iterator(\"table\",function(b){\"page\"===\na?O(b):(\"string\"===typeof a&&(a=\"full-hold\"===a?!1:!0),T(b,!1===a))})});p(\"page()\",function(a){return a===k?this.page.info().page:this.iterator(\"table\",function(b){Ta(b,a)})});p(\"page.info()\",function(){if(0===this.context.length)return k;var a=this.context[0],b=a._iDisplayStart,c=a.oFeatures.bPaginate?a._iDisplayLength:-1,d=a.fnRecordsDisplay(),e=-1===c;return{page:e?0:Math.floor(b/c),pages:e?1:Math.ceil(d/c),start:b,end:a.fnDisplayEnd(),length:c,recordsTotal:a.fnRecordsTotal(),recordsDisplay:d,\nserverSide:\"ssp\"===y(a)}});p(\"page.len()\",function(a){return a===k?0!==this.context.length?this.context[0]._iDisplayLength:k:this.iterator(\"table\",function(b){Ra(b,a)})});var Ub=function(a,b,c){if(c){var d=new r(a);d.one(\"draw\",function(){c(d.ajax.json())})}if(\"ssp\"==y(a))T(a,b);else{C(a,!0);var e=a.jqXHR;e&&4!==e.readyState&&e.abort();ra(a,[],function(c){na(a);for(var c=sa(a,c),d=0,e=c.length;d<e;d++)N(a,c[d]);T(a,b);C(a,!1)})}};p(\"ajax.json()\",function(){var a=this.context;if(0<a.length)return a[0].json});\np(\"ajax.params()\",function(){var a=this.context;if(0<a.length)return a[0].oAjaxData});p(\"ajax.reload()\",function(a,b){return this.iterator(\"table\",function(c){Ub(c,!1===b,a)})});p(\"ajax.url()\",function(a){var b=this.context;if(a===k){if(0===b.length)return k;b=b[0];return b.ajax?h.isPlainObject(b.ajax)?b.ajax.url:b.ajax:b.sAjaxSource}return this.iterator(\"table\",function(b){h.isPlainObject(b.ajax)?b.ajax.url=a:b.ajax=a})});p(\"ajax.url().load()\",function(a,b){return this.iterator(\"table\",function(c){Ub(c,\n!1===b,a)})});var $a=function(a,b,c,d,e){var f=[],g,j,i,n,l,m;i=typeof b;if(!b||\"string\"===i||\"function\"===i||b.length===k)b=[b];i=0;for(n=b.length;i<n;i++){j=b[i]&&b[i].split?b[i].split(\",\"):[b[i]];l=0;for(m=j.length;l<m;l++)(g=c(\"string\"===typeof j[l]?h.trim(j[l]):j[l]))&&g.length&&(f=f.concat(g))}a=v.selector[a];if(a.length){i=0;for(n=a.length;i<n;i++)f=a[i](d,e,f)}return pa(f)},ab=function(a){a||(a={});a.filter&&a.search===k&&(a.search=a.filter);return h.extend({search:\"none\",order:\"current\",\npage:\"all\"},a)},bb=function(a){for(var b=0,c=a.length;b<c;b++)if(0<a[b].length)return a[0]=a[b],a[0].length=1,a.length=1,a.context=[a.context[b]],a;a.length=0;return a},Ba=function(a,b){var c,d,e,f=[],g=a.aiDisplay;c=a.aiDisplayMaster;var j=b.search;d=b.order;e=b.page;if(\"ssp\"==y(a))return\"removed\"===j?[]:W(0,c.length);if(\"current\"==e){c=a._iDisplayStart;for(d=a.fnDisplayEnd();c<d;c++)f.push(g[c])}else if(\"current\"==d||\"applied\"==d)f=\"none\"==j?c.slice():\"applied\"==j?g.slice():h.map(c,function(a){return-1===\nh.inArray(a,g)?a:null});else if(\"index\"==d||\"original\"==d){c=0;for(d=a.aoData.length;c<d;c++)\"none\"==j?f.push(c):(e=h.inArray(c,g),(-1===e&&\"removed\"==j||0<=e&&\"applied\"==j)&&f.push(c))}return f};p(\"rows()\",function(a,b){a===k?a=\"\":h.isPlainObject(a)&&(b=a,a=\"\");var b=ab(b),c=this.iterator(\"table\",function(c){var e=b;return $a(\"row\",a,function(a){var b=Pb(a);if(b!==null&&!e)return[b];var j=Ba(c,e);if(b!==null&&h.inArray(b,j)!==-1)return[b];if(!a)return j;if(typeof a===\"function\")return h.map(j,function(b){var e=\nc.aoData[b];return a(b,e._aData,e.nTr)?b:null});b=Sb(ha(c.aoData,j,\"nTr\"));if(a.nodeName){if(a._DT_RowIndex!==k)return[a._DT_RowIndex];if(a._DT_CellIndex)return[a._DT_CellIndex.row];b=h(a).closest(\"*[data-dt-row]\");return b.length?[b.data(\"dt-row\")]:[]}if(typeof a===\"string\"&&a.charAt(0)===\"#\"){j=c.aIds[a.replace(/^#/,\"\")];if(j!==k)return[j.idx]}return h(b).filter(a).map(function(){return this._DT_RowIndex}).toArray()},c,e)},1);c.selector.rows=a;c.selector.opts=b;return c});p(\"rows().nodes()\",function(){return this.iterator(\"row\",\nfunction(a,b){return a.aoData[b].nTr||k},1)});p(\"rows().data()\",function(){return this.iterator(!0,\"rows\",function(a,b){return ha(a.aoData,b,\"_aData\")},1)});s(\"rows().cache()\",\"row().cache()\",function(a){return this.iterator(\"row\",function(b,c){var d=b.aoData[c];return\"search\"===a?d._aFilterData:d._aSortData},1)});s(\"rows().invalidate()\",\"row().invalidate()\",function(a){return this.iterator(\"row\",function(b,c){ca(b,c,a)})});s(\"rows().indexes()\",\"row().index()\",function(){return this.iterator(\"row\",\nfunction(a,b){return b},1)});s(\"rows().ids()\",\"row().id()\",function(a){for(var b=[],c=this.context,d=0,e=c.length;d<e;d++)for(var f=0,g=this[d].length;f<g;f++){var h=c[d].rowIdFn(c[d].aoData[this[d][f]]._aData);b.push((!0===a?\"#\":\"\")+h)}return new r(c,b)});s(\"rows().remove()\",\"row().remove()\",function(){var a=this;this.iterator(\"row\",function(b,c,d){var e=b.aoData,f=e[c],g,h,i,n,l;e.splice(c,1);g=0;for(h=e.length;g<h;g++)if(i=e[g],l=i.anCells,null!==i.nTr&&(i.nTr._DT_RowIndex=g),null!==l){i=0;for(n=\nl.length;i<n;i++)l[i]._DT_CellIndex.row=g}oa(b.aiDisplayMaster,c);oa(b.aiDisplay,c);oa(a[d],c,!1);Sa(b);c=b.rowIdFn(f._aData);c!==k&&delete b.aIds[c]});this.iterator(\"table\",function(a){for(var c=0,d=a.aoData.length;c<d;c++)a.aoData[c].idx=c});return this});p(\"rows.add()\",function(a){var b=this.iterator(\"table\",function(b){var c,f,g,h=[];f=0;for(g=a.length;f<g;f++)c=a[f],c.nodeName&&\"TR\"===c.nodeName.toUpperCase()?h.push(ma(b,c)[0]):h.push(N(b,c));return h},1),c=this.rows(-1);c.pop();h.merge(c,b);\nreturn c});p(\"row()\",function(a,b){return bb(this.rows(a,b))});p(\"row().data()\",function(a){var b=this.context;if(a===k)return b.length&&this.length?b[0].aoData[this[0]]._aData:k;b[0].aoData[this[0]]._aData=a;ca(b[0],this[0],\"data\");return this});p(\"row().node()\",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]].nTr||null:null});p(\"row.add()\",function(a){a instanceof h&&a.length&&(a=a[0]);var b=this.iterator(\"table\",function(b){return a.nodeName&&\"TR\"===a.nodeName.toUpperCase()?\nma(b,a)[0]:N(b,a)});return this.row(b[0])});var cb=function(a,b){var c=a.context;if(c.length&&(c=c[0].aoData[b!==k?b:a[0]])&&c._details)c._details.remove(),c._detailsShow=k,c._details=k},Vb=function(a,b){var c=a.context;if(c.length&&a.length){var d=c[0].aoData[a[0]];if(d._details){(d._detailsShow=b)?d._details.insertAfter(d.nTr):d._details.detach();var e=c[0],f=new r(e),g=e.aoData;f.off(\"draw.dt.DT_details column-visibility.dt.DT_details destroy.dt.DT_details\");0<G(g,\"_details\").length&&(f.on(\"draw.dt.DT_details\",\nfunction(a,b){e===b&&f.rows({page:\"current\"}).eq(0).each(function(a){a=g[a];a._detailsShow&&a._details.insertAfter(a.nTr)})}),f.on(\"column-visibility.dt.DT_details\",function(a,b){if(e===b)for(var c,d=aa(b),f=0,h=g.length;f<h;f++)c=g[f],c._details&&c._details.children(\"td[colspan]\").attr(\"colspan\",d)}),f.on(\"destroy.dt.DT_details\",function(a,b){if(e===b)for(var c=0,d=g.length;c<d;c++)g[c]._details&&cb(f,c)}))}}};p(\"row().child()\",function(a,b){var c=this.context;if(a===k)return c.length&&this.length?\nc[0].aoData[this[0]]._details:k;if(!0===a)this.child.show();else if(!1===a)cb(this);else if(c.length&&this.length){var d=c[0],c=c[0].aoData[this[0]],e=[],f=function(a,b){if(h.isArray(a)||a instanceof h)for(var c=0,k=a.length;c<k;c++)f(a[c],b);else a.nodeName&&\"tr\"===a.nodeName.toLowerCase()?e.push(a):(c=h(\"<tr><td/></tr>\").addClass(b),h(\"td\",c).addClass(b).html(a)[0].colSpan=aa(d),e.push(c[0]))};f(a,b);c._details&&c._details.remove();c._details=h(e);c._detailsShow&&c._details.insertAfter(c.nTr)}return this});\np([\"row().child.show()\",\"row().child().show()\"],function(){Vb(this,!0);return this});p([\"row().child.hide()\",\"row().child().hide()\"],function(){Vb(this,!1);return this});p([\"row().child.remove()\",\"row().child().remove()\"],function(){cb(this);return this});p(\"row().child.isShown()\",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]]._detailsShow||!1:!1});var ec=/^(.+):(name|visIdx|visible)$/,Wb=function(a,b,c,d,e){for(var c=[],d=0,f=e.length;d<f;d++)c.push(B(a,e[d],b));\nreturn c};p(\"columns()\",function(a,b){a===k?a=\"\":h.isPlainObject(a)&&(b=a,a=\"\");var b=ab(b),c=this.iterator(\"table\",function(c){var e=a,f=b,g=c.aoColumns,j=G(g,\"sName\"),i=G(g,\"nTh\");return $a(\"column\",e,function(a){var b=Pb(a);if(a===\"\")return W(g.length);if(b!==null)return[b>=0?b:g.length+b];if(typeof a===\"function\"){var e=Ba(c,f);return h.map(g,function(b,f){return a(f,Wb(c,f,0,0,e),i[f])?f:null})}var k=typeof a===\"string\"?a.match(ec):\"\";if(k)switch(k[2]){case \"visIdx\":case \"visible\":b=parseInt(k[1],\n10);if(b<0){var m=h.map(g,function(a,b){return a.bVisible?b:null});return[m[m.length+b]]}return[Z(c,b)];case \"name\":return h.map(j,function(a,b){return a===k[1]?b:null});default:return[]}if(a.nodeName&&a._DT_CellIndex)return[a._DT_CellIndex.column];b=h(i).filter(a).map(function(){return h.inArray(this,i)}).toArray();if(b.length||!a.nodeName)return b;b=h(a).closest(\"*[data-dt-column]\");return b.length?[b.data(\"dt-column\")]:[]},c,f)},1);c.selector.cols=a;c.selector.opts=b;return c});s(\"columns().header()\",\n\"column().header()\",function(){return this.iterator(\"column\",function(a,b){return a.aoColumns[b].nTh},1)});s(\"columns().footer()\",\"column().footer()\",function(){return this.iterator(\"column\",function(a,b){return a.aoColumns[b].nTf},1)});s(\"columns().data()\",\"column().data()\",function(){return this.iterator(\"column-rows\",Wb,1)});s(\"columns().dataSrc()\",\"column().dataSrc()\",function(){return this.iterator(\"column\",function(a,b){return a.aoColumns[b].mData},1)});s(\"columns().cache()\",\"column().cache()\",\nfunction(a){return this.iterator(\"column-rows\",function(b,c,d,e,f){return ha(b.aoData,f,\"search\"===a?\"_aFilterData\":\"_aSortData\",c)},1)});s(\"columns().nodes()\",\"column().nodes()\",function(){return this.iterator(\"column-rows\",function(a,b,c,d,e){return ha(a.aoData,e,\"anCells\",b)},1)});s(\"columns().visible()\",\"column().visible()\",function(a,b){var c=this.iterator(\"column\",function(b,c){if(a===k)return b.aoColumns[c].bVisible;var f=b.aoColumns,g=f[c],j=b.aoData,i,n,l;if(a!==k&&g.bVisible!==a){if(a){var m=\nh.inArray(!0,G(f,\"bVisible\"),c+1);i=0;for(n=j.length;i<n;i++)l=j[i].nTr,f=j[i].anCells,l&&l.insertBefore(f[c],f[m]||null)}else h(G(b.aoData,\"anCells\",c)).detach();g.bVisible=a;ea(b,b.aoHeader);ea(b,b.aoFooter);wa(b)}});a!==k&&(this.iterator(\"column\",function(c,e){u(c,null,\"column-visibility\",[c,e,a,b])}),(b===k||b)&&this.columns.adjust());return c});s(\"columns().indexes()\",\"column().index()\",function(a){return this.iterator(\"column\",function(b,c){return\"visible\"===a?$(b,c):c},1)});p(\"columns.adjust()\",\nfunction(){return this.iterator(\"table\",function(a){Y(a)},1)});p(\"column.index()\",function(a,b){if(0!==this.context.length){var c=this.context[0];if(\"fromVisible\"===a||\"toData\"===a)return Z(c,b);if(\"fromData\"===a||\"toVisible\"===a)return $(c,b)}});p(\"column()\",function(a,b){return bb(this.columns(a,b))});p(\"cells()\",function(a,b,c){h.isPlainObject(a)&&(a.row===k?(c=a,a=null):(c=b,b=null));h.isPlainObject(b)&&(c=b,b=null);if(null===b||b===k)return this.iterator(\"table\",function(b){var d=a,e=ab(c),f=\nb.aoData,g=Ba(b,e),j=Sb(ha(f,g,\"anCells\")),i=h([].concat.apply([],j)),l,n=b.aoColumns.length,m,p,r,u,v,s;return $a(\"cell\",d,function(a){var c=typeof a===\"function\";if(a===null||a===k||c){m=[];p=0;for(r=g.length;p<r;p++){l=g[p];for(u=0;u<n;u++){v={row:l,column:u};if(c){s=f[l];a(v,B(b,l,u),s.anCells?s.anCells[u]:null)&&m.push(v)}else m.push(v)}}return m}if(h.isPlainObject(a))return[a];c=i.filter(a).map(function(a,b){return{row:b._DT_CellIndex.row,column:b._DT_CellIndex.column}}).toArray();if(c.length||\n!a.nodeName)return c;s=h(a).closest(\"*[data-dt-row]\");return s.length?[{row:s.data(\"dt-row\"),column:s.data(\"dt-column\")}]:[]},b,e)});var d=this.columns(b,c),e=this.rows(a,c),f,g,j,i,n,l=this.iterator(\"table\",function(a,b){f=[];g=0;for(j=e[b].length;g<j;g++){i=0;for(n=d[b].length;i<n;i++)f.push({row:e[b][g],column:d[b][i]})}return f},1);h.extend(l.selector,{cols:b,rows:a,opts:c});return l});s(\"cells().nodes()\",\"cell().node()\",function(){return this.iterator(\"cell\",function(a,b,c){return(a=a.aoData[b])&&\na.anCells?a.anCells[c]:k},1)});p(\"cells().data()\",function(){return this.iterator(\"cell\",function(a,b,c){return B(a,b,c)},1)});s(\"cells().cache()\",\"cell().cache()\",function(a){a=\"search\"===a?\"_aFilterData\":\"_aSortData\";return this.iterator(\"cell\",function(b,c,d){return b.aoData[c][a][d]},1)});s(\"cells().render()\",\"cell().render()\",function(a){return this.iterator(\"cell\",function(b,c,d){return B(b,c,d,a)},1)});s(\"cells().indexes()\",\"cell().index()\",function(){return this.iterator(\"cell\",function(a,\nb,c){return{row:b,column:c,columnVisible:$(a,c)}},1)});s(\"cells().invalidate()\",\"cell().invalidate()\",function(a){return this.iterator(\"cell\",function(b,c,d){ca(b,c,a,d)})});p(\"cell()\",function(a,b,c){return bb(this.cells(a,b,c))});p(\"cell().data()\",function(a){var b=this.context,c=this[0];if(a===k)return b.length&&c.length?B(b[0],c[0].row,c[0].column):k;jb(b[0],c[0].row,c[0].column,a);ca(b[0],c[0].row,\"data\",c[0].column);return this});p(\"order()\",function(a,b){var c=this.context;if(a===k)return 0!==\nc.length?c[0].aaSorting:k;\"number\"===typeof a?a=[[a,b]]:a.length&&!h.isArray(a[0])&&(a=Array.prototype.slice.call(arguments));return this.iterator(\"table\",function(b){b.aaSorting=a.slice()})});p(\"order.listener()\",function(a,b,c){return this.iterator(\"table\",function(d){Ma(d,a,b,c)})});p(\"order.fixed()\",function(a){if(!a){var b=this.context,b=b.length?b[0].aaSortingFixed:k;return h.isArray(b)?{pre:b}:b}return this.iterator(\"table\",function(b){b.aaSortingFixed=h.extend(!0,{},a)})});p([\"columns().order()\",\n\"column().order()\"],function(a){var b=this;return this.iterator(\"table\",function(c,d){var e=[];h.each(b[d],function(b,c){e.push([c,a])});c.aaSorting=e})});p(\"search()\",function(a,b,c,d){var e=this.context;return a===k?0!==e.length?e[0].oPreviousSearch.sSearch:k:this.iterator(\"table\",function(e){e.oFeatures.bFilter&&fa(e,h.extend({},e.oPreviousSearch,{sSearch:a+\"\",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===d?!0:d}),1)})});s(\"columns().search()\",\"column().search()\",function(a,\nb,c,d){return this.iterator(\"column\",function(e,f){var g=e.aoPreSearchCols;if(a===k)return g[f].sSearch;e.oFeatures.bFilter&&(h.extend(g[f],{sSearch:a+\"\",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===d?!0:d}),fa(e,e.oPreviousSearch,1))})});p(\"state()\",function(){return this.context.length?this.context[0].oSavedState:null});p(\"state.clear()\",function(){return this.iterator(\"table\",function(a){a.fnStateSaveCallback.call(a.oInstance,a,{})})});p(\"state.loaded()\",function(){return this.context.length?\nthis.context[0].oLoadedState:null});p(\"state.save()\",function(){return this.iterator(\"table\",function(a){wa(a)})});m.versionCheck=m.fnVersionCheck=function(a){for(var b=m.version.split(\".\"),a=a.split(\".\"),c,d,e=0,f=a.length;e<f;e++)if(c=parseInt(b[e],10)||0,d=parseInt(a[e],10)||0,c!==d)return c>d;return!0};m.isDataTable=m.fnIsDataTable=function(a){var b=h(a).get(0),c=!1;h.each(m.settings,function(a,e){var f=e.nScrollHead?h(\"table\",e.nScrollHead)[0]:null,g=e.nScrollFoot?h(\"table\",e.nScrollFoot)[0]:\nnull;if(e.nTable===b||f===b||g===b)c=!0});return c};m.tables=m.fnTables=function(a){var b=!1;h.isPlainObject(a)&&(b=a.api,a=a.visible);var c=h.map(m.settings,function(b){if(!a||a&&h(b.nTable).is(\":visible\"))return b.nTable});return b?new r(c):c};m.camelToHungarian=K;p(\"$()\",function(a,b){var c=this.rows(b).nodes(),c=h(c);return h([].concat(c.filter(a).toArray(),c.find(a).toArray()))});h.each([\"on\",\"one\",\"off\"],function(a,b){p(b+\"()\",function(){var a=Array.prototype.slice.call(arguments);a[0].match(/\\.dt\\b/)||\n(a[0]+=\".dt\");var d=h(this.tables().nodes());d[b].apply(d,a);return this})});p(\"clear()\",function(){return this.iterator(\"table\",function(a){na(a)})});p(\"settings()\",function(){return new r(this.context,this.context)});p(\"init()\",function(){var a=this.context;return a.length?a[0].oInit:null});p(\"data()\",function(){return this.iterator(\"table\",function(a){return G(a.aoData,\"_aData\")}).flatten()});p(\"destroy()\",function(a){a=a||!1;return this.iterator(\"table\",function(b){var c=b.nTableWrapper.parentNode,\nd=b.oClasses,e=b.nTable,f=b.nTBody,g=b.nTHead,j=b.nTFoot,i=h(e),f=h(f),k=h(b.nTableWrapper),l=h.map(b.aoData,function(a){return a.nTr}),p;b.bDestroying=!0;u(b,\"aoDestroyCallback\",\"destroy\",[b]);a||(new r(b)).columns().visible(!0);k.unbind(\".DT\").find(\":not(tbody *)\").unbind(\".DT\");h(D).unbind(\".DT-\"+b.sInstance);e!=g.parentNode&&(i.children(\"thead\").detach(),i.append(g));j&&e!=j.parentNode&&(i.children(\"tfoot\").detach(),i.append(j));b.aaSorting=[];b.aaSortingFixed=[];va(b);h(l).removeClass(b.asStripeClasses.join(\" \"));\nh(\"th, td\",g).removeClass(d.sSortable+\" \"+d.sSortableAsc+\" \"+d.sSortableDesc+\" \"+d.sSortableNone);b.bJUI&&(h(\"th span.\"+d.sSortIcon+\", td span.\"+d.sSortIcon,g).detach(),h(\"th, td\",g).each(function(){var a=h(\"div.\"+d.sSortJUIWrapper,this);h(this).append(a.contents());a.detach()}));f.children().detach();f.append(l);g=a?\"remove\":\"detach\";i[g]();k[g]();!a&&c&&(c.insertBefore(e,b.nTableReinsertBefore),i.css(\"width\",b.sDestroyWidth).removeClass(d.sTable),(p=b.asDestroyStripes.length)&&f.children().each(function(a){h(this).addClass(b.asDestroyStripes[a%\np])}));c=h.inArray(b,m.settings);-1!==c&&m.settings.splice(c,1)})});h.each([\"column\",\"row\",\"cell\"],function(a,b){p(b+\"s().every()\",function(a){var d=this.selector.opts,e=this;return this.iterator(b,function(f,g,h,i,n){a.call(e[b](g,\"cell\"===b?h:d,\"cell\"===b?d:k),g,h,i,n)})})});p(\"i18n()\",function(a,b,c){var d=this.context[0],a=Q(a)(d.oLanguage);a===k&&(a=b);c!==k&&h.isPlainObject(a)&&(a=a[c]!==k?a[c]:a._);return a.replace(\"%d\",c)});m.version=\"1.10.12\";m.settings=[];m.models={};m.models.oSearch={bCaseInsensitive:!0,\nsSearch:\"\",bRegex:!1,bSmart:!0};m.models.oRow={nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:\"\",src:null,idx:-1};m.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:\"std\",sSortingClass:null,sSortingClassJUI:null,\nsTitle:null,sType:null,sWidth:null,sWidthOrig:null};m.defaults={aaData:null,aaSorting:[[0,\"asc\"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bJQueryUI:!1,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,bServerSide:!1,bSort:!0,bSortMulti:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,\nfnFormatNumber:function(a){return a.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g,this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(a){try{return JSON.parse((-1===a.iStateDuration?sessionStorage:localStorage).getItem(\"DataTables_\"+a.sInstance+\"_\"+location.pathname))}catch(b){}},fnStateLoadParams:null,fnStateLoaded:null,fnStateSaveCallback:function(a,b){try{(-1===\na.iStateDuration?sessionStorage:localStorage).setItem(\"DataTables_\"+a.sInstance+\"_\"+location.pathname,JSON.stringify(b))}catch(c){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:\": activate to sort column ascending\",sSortDescending:\": activate to sort column descending\"},oPaginate:{sFirst:\"First\",sLast:\"Last\",sNext:\"Next\",sPrevious:\"Previous\"},sEmptyTable:\"No data available in table\",sInfo:\"Showing _START_ to _END_ of _TOTAL_ entries\",\nsInfoEmpty:\"Showing 0 to 0 of 0 entries\",sInfoFiltered:\"(filtered from _MAX_ total entries)\",sInfoPostFix:\"\",sDecimal:\"\",sThousands:\",\",sLengthMenu:\"Show _MENU_ entries\",sLoadingRecords:\"Loading...\",sProcessing:\"Processing...\",sSearch:\"Search:\",sSearchPlaceholder:\"\",sUrl:\"\",sZeroRecords:\"No matching records found\"},oSearch:h.extend({},m.models.oSearch),sAjaxDataProp:\"data\",sAjaxSource:null,sDom:\"lfrtip\",searchDelay:null,sPaginationType:\"simple_numbers\",sScrollX:\"\",sScrollXInner:\"\",sScrollY:\"\",sServerMethod:\"GET\",\nrenderer:null,rowId:\"DT_RowId\"};X(m.defaults);m.defaults.column={aDataSort:null,iDataSort:-1,asSorting:[\"asc\",\"desc\"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:\"td\",sClass:\"\",sContentPadding:\"\",sDefaultContent:null,sName:\"\",sSortDataType:\"std\",sTitle:null,sType:null,sWidth:null};X(m.defaults.column);m.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,\nbSort:null,bSortMulti:null,bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null,iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1,bBounding:!1,barWidth:0},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aIds:{},aoColumns:[],aoHeader:[],aoFooter:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],\naoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:\"\",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,searchDelay:null,sPaginationType:\"two_button\",iStateDuration:0,aoStateSave:[],aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:!0,jqXHR:null,json:k,oAjaxData:k,\nfnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,bJUI:null,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return\"ssp\"==y(this)?1*this._iRecordsTotal:this.aiDisplayMaster.length},fnRecordsDisplay:function(){return\"ssp\"==y(this)?1*this._iRecordsDisplay:this.aiDisplay.length},fnDisplayEnd:function(){var a=\nthis._iDisplayLength,b=this._iDisplayStart,c=b+a,d=this.aiDisplay.length,e=this.oFeatures,f=e.bPaginate;return e.bServerSide?!1===f||-1===a?b+d:Math.min(b+a,this._iRecordsDisplay):!f||c>d||-1===a?d:c},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{},rowIdFn:null,rowId:null};m.ext=v={buttons:{},classes:{},builder:\"-source-\",errMode:\"alert\",feature:[],search:[],selector:{cell:[],column:[],row:[]},internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},\nheader:{}},order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:m.fnVersionCheck,iApiIndex:0,oJUIClasses:{},sVersion:m.version};h.extend(v,{afnFiltering:v.search,aTypes:v.type.detect,ofnSearch:v.type.search,oSort:v.type.order,afnSortData:v.order,aoFeatures:v.feature,oApi:v.internal,oStdClasses:v.classes,oPagination:v.pager});h.extend(m.ext.classes,{sTable:\"dataTable\",sNoFooter:\"no-footer\",sPageButton:\"paginate_button\",sPageButtonActive:\"current\",sPageButtonDisabled:\"disabled\",sStripeOdd:\"odd\",\nsStripeEven:\"even\",sRowEmpty:\"dataTables_empty\",sWrapper:\"dataTables_wrapper\",sFilter:\"dataTables_filter\",sInfo:\"dataTables_info\",sPaging:\"dataTables_paginate paging_\",sLength:\"dataTables_length\",sProcessing:\"dataTables_processing\",sSortAsc:\"sorting_asc\",sSortDesc:\"sorting_desc\",sSortable:\"sorting\",sSortableAsc:\"sorting_asc_disabled\",sSortableDesc:\"sorting_desc_disabled\",sSortableNone:\"sorting_disabled\",sSortColumn:\"sorting_\",sFilterInput:\"\",sLengthSelect:\"\",sScrollWrapper:\"dataTables_scroll\",sScrollHead:\"dataTables_scrollHead\",\nsScrollHeadInner:\"dataTables_scrollHeadInner\",sScrollBody:\"dataTables_scrollBody\",sScrollFoot:\"dataTables_scrollFoot\",sScrollFootInner:\"dataTables_scrollFootInner\",sHeaderTH:\"\",sFooterTH:\"\",sSortJUIAsc:\"\",sSortJUIDesc:\"\",sSortJUI:\"\",sSortJUIAscAllowed:\"\",sSortJUIDescAllowed:\"\",sSortJUIWrapper:\"\",sSortIcon:\"\",sJUIHeader:\"\",sJUIFooter:\"\"});var Ca=\"\",Ca=\"\",H=Ca+\"ui-state-default\",ia=Ca+\"css_right ui-icon ui-icon-\",Xb=Ca+\"fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix\";h.extend(m.ext.oJUIClasses,\nm.ext.classes,{sPageButton:\"fg-button ui-button \"+H,sPageButtonActive:\"ui-state-disabled\",sPageButtonDisabled:\"ui-state-disabled\",sPaging:\"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_\",sSortAsc:H+\" sorting_asc\",sSortDesc:H+\" sorting_desc\",sSortable:H+\" sorting\",sSortableAsc:H+\" sorting_asc_disabled\",sSortableDesc:H+\" sorting_desc_disabled\",sSortableNone:H+\" sorting_disabled\",sSortJUIAsc:ia+\"triangle-1-n\",sSortJUIDesc:ia+\"triangle-1-s\",sSortJUI:ia+\"carat-2-n-s\",\nsSortJUIAscAllowed:ia+\"carat-1-n\",sSortJUIDescAllowed:ia+\"carat-1-s\",sSortJUIWrapper:\"DataTables_sort_wrapper\",sSortIcon:\"DataTables_sort_icon\",sScrollHead:\"dataTables_scrollHead \"+H,sScrollFoot:\"dataTables_scrollFoot \"+H,sHeaderTH:H,sFooterTH:H,sJUIHeader:Xb+\" ui-corner-tl ui-corner-tr\",sJUIFooter:Xb+\" ui-corner-bl ui-corner-br\"});var Mb=m.ext.pager;h.extend(Mb,{simple:function(){return[\"previous\",\"next\"]},full:function(){return[\"first\",\"previous\",\"next\",\"last\"]},numbers:function(a,b){return[ya(a,\nb)]},simple_numbers:function(a,b){return[\"previous\",ya(a,b),\"next\"]},full_numbers:function(a,b){return[\"first\",\"previous\",ya(a,b),\"next\",\"last\"]},_numbers:ya,numbers_length:7});h.extend(!0,m.ext.renderer,{pageButton:{_:function(a,b,c,d,e,f){var g=a.oClasses,j=a.oLanguage.oPaginate,i=a.oLanguage.oAria.paginate||{},k,l,m=0,p=function(b,d){var o,r,u,s,v=function(b){Ta(a,b.data.action,true)};o=0;for(r=d.length;o<r;o++){s=d[o];if(h.isArray(s)){u=h(\"<\"+(s.DT_el||\"div\")+\"/>\").appendTo(b);p(u,s)}else{k=null;\nl=\"\";switch(s){case \"ellipsis\":b.append('<span class=\"ellipsis\">&#x2026;</span>');break;case \"first\":k=j.sFirst;l=s+(e>0?\"\":\" \"+g.sPageButtonDisabled);break;case \"previous\":k=j.sPrevious;l=s+(e>0?\"\":\" \"+g.sPageButtonDisabled);break;case \"next\":k=j.sNext;l=s+(e<f-1?\"\":\" \"+g.sPageButtonDisabled);break;case \"last\":k=j.sLast;l=s+(e<f-1?\"\":\" \"+g.sPageButtonDisabled);break;default:k=s+1;l=e===s?g.sPageButtonActive:\"\"}if(k!==null){u=h(\"<a>\",{\"class\":g.sPageButton+\" \"+l,\"aria-controls\":a.sTableId,\"aria-label\":i[s],\n\"data-dt-idx\":m,tabindex:a.iTabIndex,id:c===0&&typeof s===\"string\"?a.sTableId+\"_\"+s:null}).html(k).appendTo(b);Wa(u,{action:s},v);m++}}}},r;try{r=h(b).find(I.activeElement).data(\"dt-idx\")}catch(o){}p(h(b).empty(),d);r&&h(b).find(\"[data-dt-idx=\"+r+\"]\").focus()}}});h.extend(m.ext.type.detect,[function(a,b){var c=b.oLanguage.sDecimal;return Za(a,c)?\"num\"+c:null},function(a){if(a&&!(a instanceof Date)&&(!ac.test(a)||!bc.test(a)))return null;var b=Date.parse(a);return null!==b&&!isNaN(b)||M(a)?\"date\":\nnull},function(a,b){var c=b.oLanguage.sDecimal;return Za(a,c,!0)?\"num-fmt\"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Rb(a,c)?\"html-num\"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Rb(a,c,!0)?\"html-num-fmt\"+c:null},function(a){return M(a)||\"string\"===typeof a&&-1!==a.indexOf(\"<\")?\"html\":null}]);h.extend(m.ext.type.search,{html:function(a){return M(a)?a:\"string\"===typeof a?a.replace(Ob,\" \").replace(Aa,\"\"):\"\"},string:function(a){return M(a)?a:\"string\"===typeof a?a.replace(Ob,\n\" \"):a}});var za=function(a,b,c,d){if(0!==a&&(!a||\"-\"===a))return-Infinity;b&&(a=Qb(a,b));a.replace&&(c&&(a=a.replace(c,\"\")),d&&(a=a.replace(d,\"\")));return 1*a};h.extend(v.type.order,{\"date-pre\":function(a){return Date.parse(a)||0},\"html-pre\":function(a){return M(a)?\"\":a.replace?a.replace(/<.*?>/g,\"\").toLowerCase():a+\"\"},\"string-pre\":function(a){return M(a)?\"\":\"string\"===typeof a?a.toLowerCase():!a.toString?\"\":a.toString()},\"string-asc\":function(a,b){return a<b?-1:a>b?1:0},\"string-desc\":function(a,\nb){return a<b?1:a>b?-1:0}});db(\"\");h.extend(!0,m.ext.renderer,{header:{_:function(a,b,c,d){h(a.nTable).on(\"order.dt.DT\",function(e,f,g,h){if(a===f){e=c.idx;b.removeClass(c.sSortingClass+\" \"+d.sSortAsc+\" \"+d.sSortDesc).addClass(h[e]==\"asc\"?d.sSortAsc:h[e]==\"desc\"?d.sSortDesc:c.sSortingClass)}})},jqueryui:function(a,b,c,d){h(\"<div/>\").addClass(d.sSortJUIWrapper).append(b.contents()).append(h(\"<span/>\").addClass(d.sSortIcon+\" \"+c.sSortingClassJUI)).appendTo(b);h(a.nTable).on(\"order.dt.DT\",function(e,\nf,g,h){if(a===f){e=c.idx;b.removeClass(d.sSortAsc+\" \"+d.sSortDesc).addClass(h[e]==\"asc\"?d.sSortAsc:h[e]==\"desc\"?d.sSortDesc:c.sSortingClass);b.find(\"span.\"+d.sSortIcon).removeClass(d.sSortJUIAsc+\" \"+d.sSortJUIDesc+\" \"+d.sSortJUI+\" \"+d.sSortJUIAscAllowed+\" \"+d.sSortJUIDescAllowed).addClass(h[e]==\"asc\"?d.sSortJUIAsc:h[e]==\"desc\"?d.sSortJUIDesc:c.sSortingClassJUI)}})}}});var Yb=function(a){return\"string\"===typeof a?a.replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\").replace(/\"/g,\"&quot;\"):a};m.render={number:function(a,\nb,c,d,e){return{display:function(f){if(\"number\"!==typeof f&&\"string\"!==typeof f)return f;var g=0>f?\"-\":\"\",h=parseFloat(f);if(isNaN(h))return Yb(f);f=Math.abs(h);h=parseInt(f,10);f=c?b+(f-h).toFixed(c).substring(2):\"\";return g+(d||\"\")+h.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g,a)+f+(e||\"\")}}},text:function(){return{display:Yb}}};h.extend(m.ext.internal,{_fnExternApiFunc:Nb,_fnBuildAjax:ra,_fnAjaxUpdate:lb,_fnAjaxParameters:ub,_fnAjaxUpdateDraw:vb,_fnAjaxDataSrc:sa,_fnAddColumn:Ea,_fnColumnOptions:ja,\n_fnAdjustColumnSizing:Y,_fnVisibleToColumnIndex:Z,_fnColumnIndexToVisible:$,_fnVisbleColumns:aa,_fnGetColumns:la,_fnColumnTypes:Ga,_fnApplyColumnDefs:ib,_fnHungarianMap:X,_fnCamelToHungarian:K,_fnLanguageCompat:Da,_fnBrowserDetect:gb,_fnAddData:N,_fnAddTr:ma,_fnNodeToDataIndex:function(a,b){return b._DT_RowIndex!==k?b._DT_RowIndex:null},_fnNodeToColumnIndex:function(a,b,c){return h.inArray(c,a.aoData[b].anCells)},_fnGetCellData:B,_fnSetCellData:jb,_fnSplitObjNotation:Ja,_fnGetObjectDataFn:Q,_fnSetObjectDataFn:R,\n_fnGetDataMaster:Ka,_fnClearTable:na,_fnDeleteIndex:oa,_fnInvalidate:ca,_fnGetRowElements:Ia,_fnCreateTr:Ha,_fnBuildHead:kb,_fnDrawHead:ea,_fnDraw:O,_fnReDraw:T,_fnAddOptionsHtml:nb,_fnDetectHeader:da,_fnGetUniqueThs:qa,_fnFeatureHtmlFilter:pb,_fnFilterComplete:fa,_fnFilterCustom:yb,_fnFilterColumn:xb,_fnFilter:wb,_fnFilterCreateSearch:Pa,_fnEscapeRegex:Qa,_fnFilterData:zb,_fnFeatureHtmlInfo:sb,_fnUpdateInfo:Cb,_fnInfoMacros:Db,_fnInitialise:ga,_fnInitComplete:ta,_fnLengthChange:Ra,_fnFeatureHtmlLength:ob,\n_fnFeatureHtmlPaginate:tb,_fnPageChange:Ta,_fnFeatureHtmlProcessing:qb,_fnProcessingDisplay:C,_fnFeatureHtmlTable:rb,_fnScrollDraw:ka,_fnApplyToChildren:J,_fnCalculateColumnWidths:Fa,_fnThrottle:Oa,_fnConvertToWidth:Fb,_fnGetWidestNode:Gb,_fnGetMaxLenString:Hb,_fnStringToCss:x,_fnSortFlatten:V,_fnSort:mb,_fnSortAria:Jb,_fnSortListener:Va,_fnSortAttachListener:Ma,_fnSortingClasses:va,_fnSortData:Ib,_fnSaveState:wa,_fnLoadState:Kb,_fnSettingsFromNode:xa,_fnLog:L,_fnMap:E,_fnBindAction:Wa,_fnCallbackReg:z,\n_fnCallbackFire:u,_fnLengthOverflow:Sa,_fnRenderer:Na,_fnDataSource:y,_fnRowAttributes:La,_fnCalculateEnd:function(){}});h.fn.dataTable=m;m.$=h;h.fn.dataTableSettings=m.settings;h.fn.dataTableExt=m.ext;h.fn.DataTable=function(a){return h(this).dataTable(a).api()};h.each(m,function(a,b){h.fn.DataTable[a]=b});return h.fn.dataTable});\n"},{"id":11428,"name":"astropy/extern/jquery/data/css","nodeType":"Package"},{"id":11429,"name":"jquery.dataTables.css","nodeType":"TextFile","path":"astropy/extern/jquery/data/css","text":"/*\n * Table styles\n */\ntable.dataTable {\n  width: 100%;\n  margin: 0 auto;\n  clear: both;\n  border-collapse: separate;\n  border-spacing: 0;\n  /*\n   * Header and footer styles\n   */\n  /*\n   * Body styles\n   */\n}\ntable.dataTable thead th,\ntable.dataTable tfoot th {\n  font-weight: bold;\n}\ntable.dataTable thead th,\ntable.dataTable thead td {\n  padding: 10px 18px;\n  border-bottom: 1px solid #111;\n}\ntable.dataTable thead th:active,\ntable.dataTable thead td:active {\n  outline: none;\n}\ntable.dataTable tfoot th,\ntable.dataTable tfoot td {\n  padding: 10px 18px 6px 18px;\n  border-top: 1px solid #111;\n}\ntable.dataTable thead .sorting,\ntable.dataTable thead .sorting_asc,\ntable.dataTable thead .sorting_desc {\n  cursor: pointer;\n  *cursor: hand;\n}\ntable.dataTable thead .sorting,\ntable.dataTable thead .sorting_asc,\ntable.dataTable thead .sorting_desc,\ntable.dataTable thead .sorting_asc_disabled,\ntable.dataTable thead .sorting_desc_disabled {\n  background-repeat: no-repeat;\n  background-position: center right;\n}\ntable.dataTable thead .sorting {\n  background-image: url(\"../images/sort_both.png\");\n}\ntable.dataTable thead .sorting_asc {\n  background-image: url(\"../images/sort_asc.png\");\n}\ntable.dataTable thead .sorting_desc {\n  background-image: url(\"../images/sort_desc.png\");\n}\ntable.dataTable thead .sorting_asc_disabled {\n  background-image: url(\"../images/sort_asc_disabled.png\");\n}\ntable.dataTable thead .sorting_desc_disabled {\n  background-image: url(\"../images/sort_desc_disabled.png\");\n}\ntable.dataTable tbody tr {\n  background-color: #ffffff;\n}\ntable.dataTable tbody tr.selected {\n  background-color: #B0BED9;\n}\ntable.dataTable tbody th,\ntable.dataTable tbody td {\n  padding: 8px 10px;\n}\ntable.dataTable.row-border tbody th, table.dataTable.row-border tbody td, table.dataTable.display tbody th, table.dataTable.display tbody td {\n  border-top: 1px solid #ddd;\n}\ntable.dataTable.row-border tbody tr:first-child th,\ntable.dataTable.row-border tbody tr:first-child td, table.dataTable.display tbody tr:first-child th,\ntable.dataTable.display tbody tr:first-child td {\n  border-top: none;\n}\ntable.dataTable.cell-border tbody th, table.dataTable.cell-border tbody td {\n  border-top: 1px solid #ddd;\n  border-right: 1px solid #ddd;\n}\ntable.dataTable.cell-border tbody tr th:first-child,\ntable.dataTable.cell-border tbody tr td:first-child {\n  border-left: 1px solid #ddd;\n}\ntable.dataTable.cell-border tbody tr:first-child th,\ntable.dataTable.cell-border tbody tr:first-child td {\n  border-top: none;\n}\ntable.dataTable.stripe tbody tr.odd, table.dataTable.display tbody tr.odd {\n  background-color: #f9f9f9;\n}\ntable.dataTable.stripe tbody tr.odd.selected, table.dataTable.display tbody tr.odd.selected {\n  background-color: #acbad4;\n}\ntable.dataTable.hover tbody tr:hover, table.dataTable.display tbody tr:hover {\n  background-color: #f6f6f6;\n}\ntable.dataTable.hover tbody tr:hover.selected, table.dataTable.display tbody tr:hover.selected {\n  background-color: #aab7d1;\n}\ntable.dataTable.order-column tbody tr > .sorting_1,\ntable.dataTable.order-column tbody tr > .sorting_2,\ntable.dataTable.order-column tbody tr > .sorting_3, table.dataTable.display tbody tr > .sorting_1,\ntable.dataTable.display tbody tr > .sorting_2,\ntable.dataTable.display tbody tr > .sorting_3 {\n  background-color: #fafafa;\n}\ntable.dataTable.order-column tbody tr.selected > .sorting_1,\ntable.dataTable.order-column tbody tr.selected > .sorting_2,\ntable.dataTable.order-column tbody tr.selected > .sorting_3, table.dataTable.display tbody tr.selected > .sorting_1,\ntable.dataTable.display tbody tr.selected > .sorting_2,\ntable.dataTable.display tbody tr.selected > .sorting_3 {\n  background-color: #acbad5;\n}\ntable.dataTable.display tbody tr.odd > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd > .sorting_1 {\n  background-color: #f1f1f1;\n}\ntable.dataTable.display tbody tr.odd > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd > .sorting_2 {\n  background-color: #f3f3f3;\n}\ntable.dataTable.display tbody tr.odd > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd > .sorting_3 {\n  background-color: whitesmoke;\n}\ntable.dataTable.display tbody tr.odd.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_1 {\n  background-color: #a6b4cd;\n}\ntable.dataTable.display tbody tr.odd.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_2 {\n  background-color: #a8b5cf;\n}\ntable.dataTable.display tbody tr.odd.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_3 {\n  background-color: #a9b7d1;\n}\ntable.dataTable.display tbody tr.even > .sorting_1, table.dataTable.order-column.stripe tbody tr.even > .sorting_1 {\n  background-color: #fafafa;\n}\ntable.dataTable.display tbody tr.even > .sorting_2, table.dataTable.order-column.stripe tbody tr.even > .sorting_2 {\n  background-color: #fcfcfc;\n}\ntable.dataTable.display tbody tr.even > .sorting_3, table.dataTable.order-column.stripe tbody tr.even > .sorting_3 {\n  background-color: #fefefe;\n}\ntable.dataTable.display tbody tr.even.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_1 {\n  background-color: #acbad5;\n}\ntable.dataTable.display tbody tr.even.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_2 {\n  background-color: #aebcd6;\n}\ntable.dataTable.display tbody tr.even.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_3 {\n  background-color: #afbdd8;\n}\ntable.dataTable.display tbody tr:hover > .sorting_1, table.dataTable.order-column.hover tbody tr:hover > .sorting_1 {\n  background-color: #eaeaea;\n}\ntable.dataTable.display tbody tr:hover > .sorting_2, table.dataTable.order-column.hover tbody tr:hover > .sorting_2 {\n  background-color: #ececec;\n}\ntable.dataTable.display tbody tr:hover > .sorting_3, table.dataTable.order-column.hover tbody tr:hover > .sorting_3 {\n  background-color: #efefef;\n}\ntable.dataTable.display tbody tr:hover.selected > .sorting_1, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_1 {\n  background-color: #a2aec7;\n}\ntable.dataTable.display tbody tr:hover.selected > .sorting_2, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_2 {\n  background-color: #a3b0c9;\n}\ntable.dataTable.display tbody tr:hover.selected > .sorting_3, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_3 {\n  background-color: #a5b2cb;\n}\ntable.dataTable.no-footer {\n  border-bottom: 1px solid #111;\n}\ntable.dataTable.nowrap th, table.dataTable.nowrap td {\n  white-space: nowrap;\n}\ntable.dataTable.compact thead th,\ntable.dataTable.compact thead td {\n  padding: 4px 17px 4px 4px;\n}\ntable.dataTable.compact tfoot th,\ntable.dataTable.compact tfoot td {\n  padding: 4px;\n}\ntable.dataTable.compact tbody th,\ntable.dataTable.compact tbody td {\n  padding: 4px;\n}\ntable.dataTable th.dt-left,\ntable.dataTable td.dt-left {\n  text-align: left;\n}\ntable.dataTable th.dt-center,\ntable.dataTable td.dt-center,\ntable.dataTable td.dataTables_empty {\n  text-align: center;\n}\ntable.dataTable th.dt-right,\ntable.dataTable td.dt-right {\n  text-align: right;\n}\ntable.dataTable th.dt-justify,\ntable.dataTable td.dt-justify {\n  text-align: justify;\n}\ntable.dataTable th.dt-nowrap,\ntable.dataTable td.dt-nowrap {\n  white-space: nowrap;\n}\ntable.dataTable thead th.dt-head-left,\ntable.dataTable thead td.dt-head-left,\ntable.dataTable tfoot th.dt-head-left,\ntable.dataTable tfoot td.dt-head-left {\n  text-align: left;\n}\ntable.dataTable thead th.dt-head-center,\ntable.dataTable thead td.dt-head-center,\ntable.dataTable tfoot th.dt-head-center,\ntable.dataTable tfoot td.dt-head-center {\n  text-align: center;\n}\ntable.dataTable thead th.dt-head-right,\ntable.dataTable thead td.dt-head-right,\ntable.dataTable tfoot th.dt-head-right,\ntable.dataTable tfoot td.dt-head-right {\n  text-align: right;\n}\ntable.dataTable thead th.dt-head-justify,\ntable.dataTable thead td.dt-head-justify,\ntable.dataTable tfoot th.dt-head-justify,\ntable.dataTable tfoot td.dt-head-justify {\n  text-align: justify;\n}\ntable.dataTable thead th.dt-head-nowrap,\ntable.dataTable thead td.dt-head-nowrap,\ntable.dataTable tfoot th.dt-head-nowrap,\ntable.dataTable tfoot td.dt-head-nowrap {\n  white-space: nowrap;\n}\ntable.dataTable tbody th.dt-body-left,\ntable.dataTable tbody td.dt-body-left {\n  text-align: left;\n}\ntable.dataTable tbody th.dt-body-center,\ntable.dataTable tbody td.dt-body-center {\n  text-align: center;\n}\ntable.dataTable tbody th.dt-body-right,\ntable.dataTable tbody td.dt-body-right {\n  text-align: right;\n}\ntable.dataTable tbody th.dt-body-justify,\ntable.dataTable tbody td.dt-body-justify {\n  text-align: justify;\n}\ntable.dataTable tbody th.dt-body-nowrap,\ntable.dataTable tbody td.dt-body-nowrap {\n  white-space: nowrap;\n}\n\ntable.dataTable,\ntable.dataTable th,\ntable.dataTable td {\n  -webkit-box-sizing: content-box;\n  box-sizing: content-box;\n}\n\n/*\n * Control feature layout\n */\n.dataTables_wrapper {\n  position: relative;\n  clear: both;\n  *zoom: 1;\n  zoom: 1;\n}\n.dataTables_wrapper .dataTables_length {\n  float: left;\n}\n.dataTables_wrapper .dataTables_filter {\n  float: right;\n  text-align: right;\n}\n.dataTables_wrapper .dataTables_filter input {\n  margin-left: 0.5em;\n}\n.dataTables_wrapper .dataTables_info {\n  clear: both;\n  float: left;\n  padding-top: 0.755em;\n}\n.dataTables_wrapper .dataTables_paginate {\n  float: right;\n  text-align: right;\n  padding-top: 0.25em;\n}\n.dataTables_wrapper .dataTables_paginate .paginate_button {\n  box-sizing: border-box;\n  display: inline-block;\n  min-width: 1.5em;\n  padding: 0.5em 1em;\n  margin-left: 2px;\n  text-align: center;\n  text-decoration: none !important;\n  cursor: pointer;\n  *cursor: hand;\n  color: #333 !important;\n  border: 1px solid transparent;\n  border-radius: 2px;\n}\n.dataTables_wrapper .dataTables_paginate .paginate_button.current, .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {\n  color: #333 !important;\n  border: 1px solid #979797;\n  background-color: white;\n  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, white), color-stop(100%, #dcdcdc));\n  /* Chrome,Safari4+ */\n  background: -webkit-linear-gradient(top, white 0%, #dcdcdc 100%);\n  /* Chrome10+,Safari5.1+ */\n  background: -moz-linear-gradient(top, white 0%, #dcdcdc 100%);\n  /* FF3.6+ */\n  background: -ms-linear-gradient(top, white 0%, #dcdcdc 100%);\n  /* IE10+ */\n  background: -o-linear-gradient(top, white 0%, #dcdcdc 100%);\n  /* Opera 11.10+ */\n  background: linear-gradient(to bottom, white 0%, #dcdcdc 100%);\n  /* W3C */\n}\n.dataTables_wrapper .dataTables_paginate .paginate_button.disabled, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active {\n  cursor: default;\n  color: #666 !important;\n  border: 1px solid transparent;\n  background: transparent;\n  box-shadow: none;\n}\n.dataTables_wrapper .dataTables_paginate .paginate_button:hover {\n  color: white !important;\n  border: 1px solid #111;\n  background-color: #585858;\n  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #585858), color-stop(100%, #111));\n  /* Chrome,Safari4+ */\n  background: -webkit-linear-gradient(top, #585858 0%, #111 100%);\n  /* Chrome10+,Safari5.1+ */\n  background: -moz-linear-gradient(top, #585858 0%, #111 100%);\n  /* FF3.6+ */\n  background: -ms-linear-gradient(top, #585858 0%, #111 100%);\n  /* IE10+ */\n  background: -o-linear-gradient(top, #585858 0%, #111 100%);\n  /* Opera 11.10+ */\n  background: linear-gradient(to bottom, #585858 0%, #111 100%);\n  /* W3C */\n}\n.dataTables_wrapper .dataTables_paginate .paginate_button:active {\n  outline: none;\n  background-color: #2b2b2b;\n  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #2b2b2b), color-stop(100%, #0c0c0c));\n  /* Chrome,Safari4+ */\n  background: -webkit-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);\n  /* Chrome10+,Safari5.1+ */\n  background: -moz-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);\n  /* FF3.6+ */\n  background: -ms-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);\n  /* IE10+ */\n  background: -o-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);\n  /* Opera 11.10+ */\n  background: linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%);\n  /* W3C */\n  box-shadow: inset 0 0 3px #111;\n}\n.dataTables_wrapper .dataTables_paginate .ellipsis {\n  padding: 0 1em;\n}\n.dataTables_wrapper .dataTables_processing {\n  position: absolute;\n  top: 50%;\n  left: 50%;\n  width: 100%;\n  height: 40px;\n  margin-left: -50%;\n  margin-top: -25px;\n  padding-top: 20px;\n  text-align: center;\n  font-size: 1.2em;\n  background-color: white;\n  background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255, 255, 255, 0)), color-stop(25%, rgba(255, 255, 255, 0.9)), color-stop(75%, rgba(255, 255, 255, 0.9)), color-stop(100%, rgba(255, 255, 255, 0)));\n  background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);\n  background: -moz-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);\n  background: -ms-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);\n  background: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);\n  background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);\n}\n.dataTables_wrapper .dataTables_length,\n.dataTables_wrapper .dataTables_filter,\n.dataTables_wrapper .dataTables_info,\n.dataTables_wrapper .dataTables_processing,\n.dataTables_wrapper .dataTables_paginate {\n  color: #333;\n}\n.dataTables_wrapper .dataTables_scroll {\n  clear: both;\n}\n.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody {\n  *margin-top: -1px;\n  -webkit-overflow-scrolling: touch;\n}\n.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody th, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody td {\n  vertical-align: middle;\n}\n.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody th > div.dataTables_sizing,\n.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody td > div.dataTables_sizing {\n  height: 0;\n  overflow: hidden;\n  margin: 0 !important;\n  padding: 0 !important;\n}\n.dataTables_wrapper.no-footer .dataTables_scrollBody {\n  border-bottom: 1px solid #111;\n}\n.dataTables_wrapper.no-footer div.dataTables_scrollHead table,\n.dataTables_wrapper.no-footer div.dataTables_scrollBody table {\n  border-bottom: none;\n}\n.dataTables_wrapper:after {\n  visibility: hidden;\n  display: block;\n  content: \"\";\n  clear: both;\n  height: 0;\n}\n\n@media screen and (max-width: 767px) {\n  .dataTables_wrapper .dataTables_info,\n  .dataTables_wrapper .dataTables_paginate {\n    float: none;\n    text-align: center;\n  }\n  .dataTables_wrapper .dataTables_paginate {\n    margin-top: 0.5em;\n  }\n}\n@media screen and (max-width: 640px) {\n  .dataTables_wrapper .dataTables_length,\n  .dataTables_wrapper .dataTables_filter {\n    float: none;\n    text-align: center;\n  }\n  .dataTables_wrapper .dataTables_filter {\n    margin-top: 0.5em;\n  }\n}\n"},{"id":11430,"name":"astropy/extern/configobj","nodeType":"Package"},{"fileName":"validate.py","filePath":"astropy/extern/configobj","id":11431,"nodeType":"File","text":"# validate.py\n# A Validator object\n# Copyright (C) 2005-2014:\n# (name) : (email)\n# Michael Foord: fuzzyman AT voidspace DOT org DOT uk\n# Mark Andrews: mark AT la-la DOT com\n# Nicola Larosa: nico AT tekNico DOT net\n# Rob Dennis: rdennis AT gmail DOT com\n# Eli Courtwright: eli AT courtwright DOT org\n\n# This software is licensed under the terms of the BSD license.\n# http://opensource.org/licenses/BSD-3-Clause\n\n# ConfigObj 5 - main repository for documentation and issue tracking:\n# https://github.com/DiffSK/configobj\n\n\"\"\"\n    The Validator object is used to check that supplied values\n    conform to a specification.\n\n    The value can be supplied as a string - e.g. from a config file.\n    In this case the check will also *convert* the value to\n    the required type. This allows you to add validation\n    as a transparent layer to access data stored as strings.\n    The validation checks that the data is correct *and*\n    converts it to the expected type.\n\n    Some standard checks are provided for basic data types.\n    Additional checks are easy to write. They can be\n    provided when the ``Validator`` is instantiated or\n    added afterwards.\n\n    The standard functions work with the following basic data types :\n\n    * integers\n    * floats\n    * booleans\n    * strings\n    * ip_addr\n\n    plus lists of these datatypes\n\n    Adding additional checks is done through coding simple functions.\n\n    The full set of standard checks are :\n\n    * 'integer': matches integer values (including negative)\n                 Takes optional 'min' and 'max' arguments : ::\n\n                   integer()\n                   integer(3, 9)  # any value from 3 to 9\n                   integer(min=0) # any positive value\n                   integer(max=9)\n\n    * 'float': matches float values\n               Has the same parameters as the integer check.\n\n    * 'boolean': matches boolean values - ``True`` or ``False``\n                 Acceptable string values for True are :\n                   true, on, yes, 1\n                 Acceptable string values for False are :\n                   false, off, no, 0\n\n                 Any other value raises an error.\n\n    * 'ip_addr': matches an Internet Protocol address, v.4, represented\n                 by a dotted-quad string, i.e. '1.2.3.4'.\n\n    * 'string': matches any string.\n                Takes optional keyword args 'min' and 'max'\n                to specify min and max lengths of the string.\n\n    * 'list': matches any list.\n              Takes optional keyword args 'min', and 'max' to specify min and\n              max sizes of the list. (Always returns a list.)\n\n    * 'tuple': matches any tuple.\n              Takes optional keyword args 'min', and 'max' to specify min and\n              max sizes of the tuple. (Always returns a tuple.)\n\n    * 'int_list': Matches a list of integers.\n                  Takes the same arguments as list.\n\n    * 'float_list': Matches a list of floats.\n                    Takes the same arguments as list.\n\n    * 'bool_list': Matches a list of boolean values.\n                   Takes the same arguments as list.\n\n    * 'ip_addr_list': Matches a list of IP addresses.\n                     Takes the same arguments as list.\n\n    * 'string_list': Matches a list of strings.\n                     Takes the same arguments as list.\n\n    * 'mixed_list': Matches a list with different types in\n                    specific positions. List size must match\n                    the number of arguments.\n\n                    Each position can be one of :\n                    'integer', 'float', 'ip_addr', 'string', 'boolean'\n\n                    So to specify a list with two strings followed\n                    by two integers, you write the check as : ::\n\n                      mixed_list('string', 'string', 'integer', 'integer')\n\n    * 'pass': This check matches everything ! It never fails\n              and the value is unchanged.\n\n              It is also the default if no check is specified.\n\n    * 'option': This check matches any from a list of options.\n                You specify this check with : ::\n\n                  option('option 1', 'option 2', 'option 3')\n\n    You can supply a default value (returned if no value is supplied)\n    using the default keyword argument.\n\n    You specify a list argument for default using a list constructor syntax in\n    the check : ::\n\n        checkname(arg1, arg2, default=list('val 1', 'val 2', 'val 3'))\n\n    A badly formatted set of arguments will raise a ``VdtParamError``.\n\"\"\"\n\n__version__ = '1.0.1'\n\n\n__all__ = (\n    '__version__',\n    'dottedQuadToNum',\n    'numToDottedQuad',\n    'ValidateError',\n    'VdtUnknownCheckError',\n    'VdtParamError',\n    'VdtTypeError',\n    'VdtValueError',\n    'VdtValueTooSmallError',\n    'VdtValueTooBigError',\n    'VdtValueTooShortError',\n    'VdtValueTooLongError',\n    'VdtMissingValue',\n    'Validator',\n    'is_integer',\n    'is_float',\n    'is_boolean',\n    'is_list',\n    'is_tuple',\n    'is_ip_addr',\n    'is_string',\n    'is_int_list',\n    'is_bool_list',\n    'is_float_list',\n    'is_string_list',\n    'is_ip_addr_list',\n    'is_mixed_list',\n    'is_option',\n    '__docformat__',\n)\n\n\nimport re\nimport sys\nfrom pprint import pprint\n\n#TODO - #21 - six is part of the repo now, but we didn't switch over to it here\n# this could be replaced if six is used for compatibility, or there are no\n# more assertions about items being a string\nif sys.version_info < (3,):\n    string_type = basestring\nelse:\n    string_type = str\n    # so tests that care about unicode on 2.x can specify unicode, and the same\n    # tests when run on 3.x won't complain about a undefined name \"unicode\"\n    # since all strings are unicode on 3.x we just want to pass it through\n    # unchanged\n    unicode = lambda x: x\n    # in python 3, all ints are equivalent to python 2 longs, and they'll\n    # never show \"L\" in the repr\n    long = int\n\n_list_arg = re.compile(r'''\n    (?:\n        ([a-zA-Z_][a-zA-Z0-9_]*)\\s*=\\s*list\\(\n            (\n                (?:\n                    \\s*\n                    (?:\n                        (?:\".*?\")|              # double quotes\n                        (?:'.*?')|              # single quotes\n                        (?:[^'\",\\s\\)][^,\\)]*?)  # unquoted\n                    )\n                    \\s*,\\s*\n                )*\n                (?:\n                    (?:\".*?\")|              # double quotes\n                    (?:'.*?')|              # single quotes\n                    (?:[^'\",\\s\\)][^,\\)]*?)  # unquoted\n                )?                          # last one\n            )\n        \\)\n    )\n''', re.VERBOSE | re.DOTALL)    # two groups\n\n_list_members = re.compile(r'''\n    (\n        (?:\".*?\")|              # double quotes\n        (?:'.*?')|              # single quotes\n        (?:[^'\",\\s=][^,=]*?)       # unquoted\n    )\n    (?:\n    (?:\\s*,\\s*)|(?:\\s*$)            # comma\n    )\n''', re.VERBOSE | re.DOTALL)    # one group\n\n_paramstring = r'''\n    (?:\n        (\n            (?:\n                [a-zA-Z_][a-zA-Z0-9_]*\\s*=\\s*list\\(\n                    (?:\n                        \\s*\n                        (?:\n                            (?:\".*?\")|              # double quotes\n                            (?:'.*?')|              # single quotes\n                            (?:[^'\",\\s\\)][^,\\)]*?)       # unquoted\n                        )\n                        \\s*,\\s*\n                    )*\n                    (?:\n                        (?:\".*?\")|              # double quotes\n                        (?:'.*?')|              # single quotes\n                        (?:[^'\",\\s\\)][^,\\)]*?)       # unquoted\n                    )?                              # last one\n                \\)\n            )|\n            (?:\n                (?:\".*?\")|              # double quotes\n                (?:'.*?')|              # single quotes\n                (?:[^'\",\\s=][^,=]*?)|       # unquoted\n                (?:                         # keyword argument\n                    [a-zA-Z_][a-zA-Z0-9_]*\\s*=\\s*\n                    (?:\n                        (?:\".*?\")|              # double quotes\n                        (?:'.*?')|              # single quotes\n                        (?:[^'\",\\s=][^,=]*?)       # unquoted\n                    )\n                )\n            )\n        )\n        (?:\n            (?:\\s*,\\s*)|(?:\\s*$)            # comma\n        )\n    )\n    '''\n\n_matchstring = '^%s*' % _paramstring\n\n# Python pre 2.2.1 doesn't have bool\ntry:\n    bool\nexcept NameError:\n    def bool(val):\n        \"\"\"Simple boolean equivalent function. \"\"\"\n        if val:\n            return 1\n        else:\n            return 0\n\n\ndef dottedQuadToNum(ip):\n    \"\"\"\n    Convert decimal dotted quad string to long integer\n\n    >>> int(dottedQuadToNum('1 '))\n    1\n    >>> int(dottedQuadToNum(' 1.2'))\n    16777218\n    >>> int(dottedQuadToNum(' 1.2.3 '))\n    16908291\n    >>> int(dottedQuadToNum('1.2.3.4'))\n    16909060\n    >>> dottedQuadToNum('255.255.255.255')\n    4294967295\n    >>> dottedQuadToNum('255.255.255.256')\n    Traceback (most recent call last):\n    ValueError: Not a good dotted-quad IP: 255.255.255.256\n    \"\"\"\n\n    # import here to avoid it when ip_addr values are not used\n    import socket, struct\n\n    try:\n        return struct.unpack('!L',\n            socket.inet_aton(ip.strip()))[0]\n    except socket.error:\n        raise ValueError('Not a good dotted-quad IP: %s' % ip)\n    return\n\n\ndef numToDottedQuad(num):\n    \"\"\"\n    Convert int or long int to dotted quad string\n\n    >>> numToDottedQuad(long(-1))\n    Traceback (most recent call last):\n    ValueError: Not a good numeric IP: -1\n    >>> numToDottedQuad(long(1))\n    '0.0.0.1'\n    >>> numToDottedQuad(long(16777218))\n    '1.0.0.2'\n    >>> numToDottedQuad(long(16908291))\n    '1.2.0.3'\n    >>> numToDottedQuad(long(16909060))\n    '1.2.3.4'\n    >>> numToDottedQuad(long(4294967295))\n    '255.255.255.255'\n    >>> numToDottedQuad(long(4294967296))\n    Traceback (most recent call last):\n    ValueError: Not a good numeric IP: 4294967296\n    >>> numToDottedQuad(-1)\n    Traceback (most recent call last):\n    ValueError: Not a good numeric IP: -1\n    >>> numToDottedQuad(1)\n    '0.0.0.1'\n    >>> numToDottedQuad(16777218)\n    '1.0.0.2'\n    >>> numToDottedQuad(16908291)\n    '1.2.0.3'\n    >>> numToDottedQuad(16909060)\n    '1.2.3.4'\n    >>> numToDottedQuad(4294967295)\n    '255.255.255.255'\n    >>> numToDottedQuad(4294967296)\n    Traceback (most recent call last):\n    ValueError: Not a good numeric IP: 4294967296\n\n    \"\"\"\n\n    # import here to avoid it when ip_addr values are not used\n    import socket, struct\n\n    # no need to intercept here, 4294967295L is fine\n    if num > long(4294967295) or num < 0:\n        raise ValueError('Not a good numeric IP: %s' % num)\n    try:\n        return socket.inet_ntoa(\n            struct.pack('!L', long(num)))\n    except (socket.error, struct.error, OverflowError):\n        raise ValueError('Not a good numeric IP: %s' % num)\n\n\nclass ValidateError(Exception):\n    \"\"\"\n    This error indicates that the check failed.\n    It can be the base class for more specific errors.\n\n    Any check function that fails ought to raise this error.\n    (or a subclass)\n\n    >>> raise ValidateError\n    Traceback (most recent call last):\n    ValidateError\n    \"\"\"\n\n\nclass VdtMissingValue(ValidateError):\n    \"\"\"No value was supplied to a check that needed one.\"\"\"\n\n\nclass VdtUnknownCheckError(ValidateError):\n    \"\"\"An unknown check function was requested\"\"\"\n\n    def __init__(self, value):\n        \"\"\"\n        >>> raise VdtUnknownCheckError('yoda')\n        Traceback (most recent call last):\n        VdtUnknownCheckError: the check \"yoda\" is unknown.\n        \"\"\"\n        ValidateError.__init__(self, 'the check \"%s\" is unknown.' % (value,))\n\n\nclass VdtParamError(SyntaxError):\n    \"\"\"An incorrect parameter was passed\"\"\"\n\n    def __init__(self, name, value):\n        \"\"\"\n        >>> raise VdtParamError('yoda', 'jedi')\n        Traceback (most recent call last):\n        VdtParamError: passed an incorrect value \"jedi\" for parameter \"yoda\".\n        \"\"\"\n        SyntaxError.__init__(self, 'passed an incorrect value \"%s\" for parameter \"%s\".' % (value, name))\n\n\nclass VdtTypeError(ValidateError):\n    \"\"\"The value supplied was of the wrong type\"\"\"\n\n    def __init__(self, value):\n        \"\"\"\n        >>> raise VdtTypeError('jedi')\n        Traceback (most recent call last):\n        VdtTypeError: the value \"jedi\" is of the wrong type.\n        \"\"\"\n        ValidateError.__init__(self, 'the value \"%s\" is of the wrong type.' % (value,))\n\n\nclass VdtValueError(ValidateError):\n    \"\"\"The value supplied was of the correct type, but was not an allowed value.\"\"\"\n\n    def __init__(self, value):\n        \"\"\"\n        >>> raise VdtValueError('jedi')\n        Traceback (most recent call last):\n        VdtValueError: the value \"jedi\" is unacceptable.\n        \"\"\"\n        ValidateError.__init__(self, 'the value \"%s\" is unacceptable.' % (value,))\n\n\nclass VdtValueTooSmallError(VdtValueError):\n    \"\"\"The value supplied was of the correct type, but was too small.\"\"\"\n\n    def __init__(self, value):\n        \"\"\"\n        >>> raise VdtValueTooSmallError('0')\n        Traceback (most recent call last):\n        VdtValueTooSmallError: the value \"0\" is too small.\n        \"\"\"\n        ValidateError.__init__(self, 'the value \"%s\" is too small.' % (value,))\n\n\nclass VdtValueTooBigError(VdtValueError):\n    \"\"\"The value supplied was of the correct type, but was too big.\"\"\"\n\n    def __init__(self, value):\n        \"\"\"\n        >>> raise VdtValueTooBigError('1')\n        Traceback (most recent call last):\n        VdtValueTooBigError: the value \"1\" is too big.\n        \"\"\"\n        ValidateError.__init__(self, 'the value \"%s\" is too big.' % (value,))\n\n\nclass VdtValueTooShortError(VdtValueError):\n    \"\"\"The value supplied was of the correct type, but was too short.\"\"\"\n\n    def __init__(self, value):\n        \"\"\"\n        >>> raise VdtValueTooShortError('jed')\n        Traceback (most recent call last):\n        VdtValueTooShortError: the value \"jed\" is too short.\n        \"\"\"\n        ValidateError.__init__(\n            self,\n            'the value \"%s\" is too short.' % (value,))\n\n\nclass VdtValueTooLongError(VdtValueError):\n    \"\"\"The value supplied was of the correct type, but was too long.\"\"\"\n\n    def __init__(self, value):\n        \"\"\"\n        >>> raise VdtValueTooLongError('jedie')\n        Traceback (most recent call last):\n        VdtValueTooLongError: the value \"jedie\" is too long.\n        \"\"\"\n        ValidateError.__init__(self, 'the value \"%s\" is too long.' % (value,))\n\n\nclass Validator(object):\n    \"\"\"\n    Validator is an object that allows you to register a set of 'checks'.\n    These checks take input and test that it conforms to the check.\n\n    This can also involve converting the value from a string into\n    the correct datatype.\n\n    The ``check`` method takes an input string which configures which\n    check is to be used and applies that check to a supplied value.\n\n    An example input string would be:\n    'int_range(param1, param2)'\n\n    You would then provide something like:\n\n    >>> def int_range_check(value, min, max):\n    ...     # turn min and max from strings to integers\n    ...     min = int(min)\n    ...     max = int(max)\n    ...     # check that value is of the correct type.\n    ...     # possible valid inputs are integers or strings\n    ...     # that represent integers\n    ...     if not isinstance(value, (int, long, string_type)):\n    ...         raise VdtTypeError(value)\n    ...     elif isinstance(value, string_type):\n    ...         # if we are given a string\n    ...         # attempt to convert to an integer\n    ...         try:\n    ...             value = int(value)\n    ...         except ValueError:\n    ...             raise VdtValueError(value)\n    ...     # check the value is between our constraints\n    ...     if not min <= value:\n    ...          raise VdtValueTooSmallError(value)\n    ...     if not value <= max:\n    ...          raise VdtValueTooBigError(value)\n    ...     return value\n\n    >>> fdict = {'int_range': int_range_check}\n    >>> vtr1 = Validator(fdict)\n    >>> vtr1.check('int_range(20, 40)', '30')\n    30\n    >>> vtr1.check('int_range(20, 40)', '60')\n    Traceback (most recent call last):\n    VdtValueTooBigError: the value \"60\" is too big.\n\n    New functions can be added with : ::\n\n    >>> vtr2 = Validator()\n    >>> vtr2.functions['int_range'] = int_range_check\n\n    Or by passing in a dictionary of functions when Validator\n    is instantiated.\n\n    Your functions *can* use keyword arguments,\n    but the first argument should always be 'value'.\n\n    If the function doesn't take additional arguments,\n    the parentheses are optional in the check.\n    It can be written with either of : ::\n\n        keyword = function_name\n        keyword = function_name()\n\n    The first program to utilise Validator() was Michael Foord's\n    ConfigObj, an alternative to ConfigParser which supports lists and\n    can validate a config file using a config schema.\n    For more details on using Validator with ConfigObj see:\n    https://configobj.readthedocs.org/en/latest/configobj.html\n    \"\"\"\n\n    # this regex does the initial parsing of the checks\n    _func_re = re.compile(r'(.+?)\\((.*)\\)', re.DOTALL)\n\n    # this regex takes apart keyword arguments\n    _key_arg = re.compile(r'^([a-zA-Z_][a-zA-Z0-9_]*)\\s*=\\s*(.*)$',  re.DOTALL)\n\n\n    # this regex finds keyword=list(....) type values\n    _list_arg = _list_arg\n\n    # this regex takes individual values out of lists - in one pass\n    _list_members = _list_members\n\n    # These regexes check a set of arguments for validity\n    # and then pull the members out\n    _paramfinder = re.compile(_paramstring, re.VERBOSE | re.DOTALL)\n    _matchfinder = re.compile(_matchstring, re.VERBOSE | re.DOTALL)\n\n\n    def __init__(self, functions=None):\n        \"\"\"\n        >>> vtri = Validator()\n        \"\"\"\n        self.functions = {\n            '': self._pass,\n            'integer': is_integer,\n            'float': is_float,\n            'boolean': is_boolean,\n            'ip_addr': is_ip_addr,\n            'string': is_string,\n            'list': is_list,\n            'tuple': is_tuple,\n            'int_list': is_int_list,\n            'float_list': is_float_list,\n            'bool_list': is_bool_list,\n            'ip_addr_list': is_ip_addr_list,\n            'string_list': is_string_list,\n            'mixed_list': is_mixed_list,\n            'pass': self._pass,\n            'option': is_option,\n            'force_list': force_list,\n        }\n        if functions is not None:\n            self.functions.update(functions)\n        # tekNico: for use by ConfigObj\n        self.baseErrorClass = ValidateError\n        self._cache = {}\n\n\n    def check(self, check, value, missing=False):\n        \"\"\"\n        Usage: check(check, value)\n\n        Arguments:\n            check: string representing check to apply (including arguments)\n            value: object to be checked\n        Returns value, converted to correct type if necessary\n\n        If the check fails, raises a ``ValidateError`` subclass.\n\n        >>> vtor.check('yoda', '')\n        Traceback (most recent call last):\n        VdtUnknownCheckError: the check \"yoda\" is unknown.\n        >>> vtor.check('yoda()', '')\n        Traceback (most recent call last):\n        VdtUnknownCheckError: the check \"yoda\" is unknown.\n\n        >>> vtor.check('string(default=\"\")', '', missing=True)\n        ''\n        \"\"\"\n        fun_name, fun_args, fun_kwargs, default = self._parse_with_caching(check)\n\n        if missing:\n            if default is None:\n                # no information needed here - to be handled by caller\n                raise VdtMissingValue()\n            value = self._handle_none(default)\n\n        if value is None:\n            return None\n\n        return self._check_value(value, fun_name, fun_args, fun_kwargs)\n\n\n    def _handle_none(self, value):\n        if value == 'None':\n            return None\n        elif value in (\"'None'\", '\"None\"'):\n            # Special case a quoted None\n            value = self._unquote(value)\n        return value\n\n\n    def _parse_with_caching(self, check):\n        if check in self._cache:\n            fun_name, fun_args, fun_kwargs, default = self._cache[check]\n            # We call list and dict below to work with *copies* of the data\n            # rather than the original (which are mutable of course)\n            fun_args = list(fun_args)\n            fun_kwargs = dict(fun_kwargs)\n        else:\n            fun_name, fun_args, fun_kwargs, default = self._parse_check(check)\n            fun_kwargs = dict([(str(key), value) for (key, value) in list(fun_kwargs.items())])\n            self._cache[check] = fun_name, list(fun_args), dict(fun_kwargs), default\n        return fun_name, fun_args, fun_kwargs, default\n\n\n    def _check_value(self, value, fun_name, fun_args, fun_kwargs):\n        try:\n            fun = self.functions[fun_name]\n        except KeyError:\n            raise VdtUnknownCheckError(fun_name)\n        else:\n            return fun(value, *fun_args, **fun_kwargs)\n\n\n    def _parse_check(self, check):\n        fun_match = self._func_re.match(check)\n        if fun_match:\n            fun_name = fun_match.group(1)\n            arg_string = fun_match.group(2)\n            arg_match = self._matchfinder.match(arg_string)\n            if arg_match is None:\n                # Bad syntax\n                raise VdtParamError('Bad syntax in check \"%s\".' % check)\n            fun_args = []\n            fun_kwargs = {}\n            # pull out args of group 2\n            for arg in self._paramfinder.findall(arg_string):\n                # args may need whitespace removing (before removing quotes)\n                arg = arg.strip()\n                listmatch = self._list_arg.match(arg)\n                if listmatch:\n                    key, val = self._list_handle(listmatch)\n                    fun_kwargs[key] = val\n                    continue\n                keymatch = self._key_arg.match(arg)\n                if keymatch:\n                    val = keymatch.group(2)\n                    if not val in (\"'None'\", '\"None\"'):\n                        # Special case a quoted None\n                        val = self._unquote(val)\n                    fun_kwargs[keymatch.group(1)] = val\n                    continue\n\n                fun_args.append(self._unquote(arg))\n        else:\n            # allows for function names without (args)\n            return check, (), {}, None\n\n        # Default must be deleted if the value is specified too,\n        # otherwise the check function will get a spurious \"default\" keyword arg\n        default = fun_kwargs.pop('default', None)\n        return fun_name, fun_args, fun_kwargs, default\n\n\n    def _unquote(self, val):\n        \"\"\"Unquote a value if necessary.\"\"\"\n        if (len(val) >= 2) and (val[0] in (\"'\", '\"')) and (val[0] == val[-1]):\n            val = val[1:-1]\n        return val\n\n\n    def _list_handle(self, listmatch):\n        \"\"\"Take apart a ``keyword=list('val, 'val')`` type string.\"\"\"\n        out = []\n        name = listmatch.group(1)\n        args = listmatch.group(2)\n        for arg in self._list_members.findall(args):\n            out.append(self._unquote(arg))\n        return name, out\n\n\n    def _pass(self, value):\n        \"\"\"\n        Dummy check that always passes\n\n        >>> vtor.check('', 0)\n        0\n        >>> vtor.check('', '0')\n        '0'\n        \"\"\"\n        return value\n\n\n    def get_default_value(self, check):\n        \"\"\"\n        Given a check, return the default value for the check\n        (converted to the right type).\n\n        If the check doesn't specify a default value then a\n        ``KeyError`` will be raised.\n        \"\"\"\n        fun_name, fun_args, fun_kwargs, default = self._parse_with_caching(check)\n        if default is None:\n            raise KeyError('Check \"%s\" has no default value.' % check)\n        value = self._handle_none(default)\n        if value is None:\n            return value\n        return self._check_value(value, fun_name, fun_args, fun_kwargs)\n\n\ndef _is_num_param(names, values, to_float=False):\n    \"\"\"\n    Return numbers from inputs or raise VdtParamError.\n\n    Lets ``None`` pass through.\n    Pass in keyword argument ``to_float=True`` to\n    use float for the conversion rather than int.\n\n    >>> _is_num_param(('', ''), (0, 1.0))\n    [0, 1]\n    >>> _is_num_param(('', ''), (0, 1.0), to_float=True)\n    [0.0, 1.0]\n    >>> _is_num_param(('a'), ('a'))\n    Traceback (most recent call last):\n    VdtParamError: passed an incorrect value \"a\" for parameter \"a\".\n    \"\"\"\n    fun = to_float and float or int\n    out_params = []\n    for (name, val) in zip(names, values):\n        if val is None:\n            out_params.append(val)\n        elif isinstance(val, (int, long, float, string_type)):\n            try:\n                out_params.append(fun(val))\n            except ValueError as e:\n                raise VdtParamError(name, val)\n        else:\n            raise VdtParamError(name, val)\n    return out_params\n\n\n# built in checks\n# you can override these by setting the appropriate name\n# in Validator.functions\n# note: if the params are specified wrongly in your input string,\n#       you will also raise errors.\n\ndef is_integer(value, min=None, max=None):\n    \"\"\"\n    A check that tests that a given value is an integer (int, or long)\n    and optionally, between bounds. A negative value is accepted, while\n    a float will fail.\n\n    If the value is a string, then the conversion is done - if possible.\n    Otherwise a VdtError is raised.\n\n    >>> vtor.check('integer', '-1')\n    -1\n    >>> vtor.check('integer', '0')\n    0\n    >>> vtor.check('integer', 9)\n    9\n    >>> vtor.check('integer', 'a')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"a\" is of the wrong type.\n    >>> vtor.check('integer', '2.2')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"2.2\" is of the wrong type.\n    >>> vtor.check('integer(10)', '20')\n    20\n    >>> vtor.check('integer(max=20)', '15')\n    15\n    >>> vtor.check('integer(10)', '9')\n    Traceback (most recent call last):\n    VdtValueTooSmallError: the value \"9\" is too small.\n    >>> vtor.check('integer(10)', 9)\n    Traceback (most recent call last):\n    VdtValueTooSmallError: the value \"9\" is too small.\n    >>> vtor.check('integer(max=20)', '35')\n    Traceback (most recent call last):\n    VdtValueTooBigError: the value \"35\" is too big.\n    >>> vtor.check('integer(max=20)', 35)\n    Traceback (most recent call last):\n    VdtValueTooBigError: the value \"35\" is too big.\n    >>> vtor.check('integer(0, 9)', False)\n    0\n    \"\"\"\n    (min_val, max_val) = _is_num_param(('min', 'max'), (min, max))\n    if not isinstance(value, (int, long, string_type)):\n        raise VdtTypeError(value)\n    if isinstance(value, string_type):\n        # if it's a string - does it represent an integer ?\n        try:\n            value = int(value)\n        except ValueError:\n            raise VdtTypeError(value)\n    if (min_val is not None) and (value < min_val):\n        raise VdtValueTooSmallError(value)\n    if (max_val is not None) and (value > max_val):\n        raise VdtValueTooBigError(value)\n    return value\n\n\ndef is_float(value, min=None, max=None):\n    \"\"\"\n    A check that tests that a given value is a float\n    (an integer will be accepted), and optionally - that it is between bounds.\n\n    If the value is a string, then the conversion is done - if possible.\n    Otherwise a VdtError is raised.\n\n    This can accept negative values.\n\n    >>> vtor.check('float', '2')\n    2.0\n\n    From now on we multiply the value to avoid comparing decimals\n\n    >>> vtor.check('float', '-6.8') * 10\n    -68.0\n    >>> vtor.check('float', '12.2') * 10\n    122.0\n    >>> vtor.check('float', 8.4) * 10\n    84.0\n    >>> vtor.check('float', 'a')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"a\" is of the wrong type.\n    >>> vtor.check('float(10.1)', '10.2') * 10\n    102.0\n    >>> vtor.check('float(max=20.2)', '15.1') * 10\n    151.0\n    >>> vtor.check('float(10.0)', '9.0')\n    Traceback (most recent call last):\n    VdtValueTooSmallError: the value \"9.0\" is too small.\n    >>> vtor.check('float(max=20.0)', '35.0')\n    Traceback (most recent call last):\n    VdtValueTooBigError: the value \"35.0\" is too big.\n    \"\"\"\n    (min_val, max_val) = _is_num_param(\n        ('min', 'max'), (min, max), to_float=True)\n    if not isinstance(value, (int, long, float, string_type)):\n        raise VdtTypeError(value)\n    if not isinstance(value, float):\n        # if it's a string - does it represent a float ?\n        try:\n            value = float(value)\n        except ValueError:\n            raise VdtTypeError(value)\n    if (min_val is not None) and (value < min_val):\n        raise VdtValueTooSmallError(value)\n    if (max_val is not None) and (value > max_val):\n        raise VdtValueTooBigError(value)\n    return value\n\n\nbool_dict = {\n    True: True, 'on': True, '1': True, 'true': True, 'yes': True,\n    False: False, 'off': False, '0': False, 'false': False, 'no': False,\n}\n\n\ndef is_boolean(value):\n    \"\"\"\n    Check if the value represents a boolean.\n\n    >>> vtor.check('boolean', 0)\n    0\n    >>> vtor.check('boolean', False)\n    0\n    >>> vtor.check('boolean', '0')\n    0\n    >>> vtor.check('boolean', 'off')\n    0\n    >>> vtor.check('boolean', 'false')\n    0\n    >>> vtor.check('boolean', 'no')\n    0\n    >>> vtor.check('boolean', 'nO')\n    0\n    >>> vtor.check('boolean', 'NO')\n    0\n    >>> vtor.check('boolean', 1)\n    1\n    >>> vtor.check('boolean', True)\n    1\n    >>> vtor.check('boolean', '1')\n    1\n    >>> vtor.check('boolean', 'on')\n    1\n    >>> vtor.check('boolean', 'true')\n    1\n    >>> vtor.check('boolean', 'yes')\n    1\n    >>> vtor.check('boolean', 'Yes')\n    1\n    >>> vtor.check('boolean', 'YES')\n    1\n    >>> vtor.check('boolean', '')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"\" is of the wrong type.\n    >>> vtor.check('boolean', 'up')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"up\" is of the wrong type.\n\n    \"\"\"\n    if isinstance(value, string_type):\n        try:\n            return bool_dict[value.lower()]\n        except KeyError:\n            raise VdtTypeError(value)\n    # we do an equality test rather than an identity test\n    # this ensures Python 2.2 compatibilty\n    # and allows 0 and 1 to represent True and False\n    if value == False:\n        return False\n    elif value == True:\n        return True\n    else:\n        raise VdtTypeError(value)\n\n\ndef is_ip_addr(value):\n    \"\"\"\n    Check that the supplied value is an Internet Protocol address, v.4,\n    represented by a dotted-quad string, i.e. '1.2.3.4'.\n\n    >>> vtor.check('ip_addr', '1 ')\n    '1'\n    >>> vtor.check('ip_addr', ' 1.2')\n    '1.2'\n    >>> vtor.check('ip_addr', ' 1.2.3 ')\n    '1.2.3'\n    >>> vtor.check('ip_addr', '1.2.3.4')\n    '1.2.3.4'\n    >>> vtor.check('ip_addr', '0.0.0.0')\n    '0.0.0.0'\n    >>> vtor.check('ip_addr', '255.255.255.255')\n    '255.255.255.255'\n    >>> vtor.check('ip_addr', '255.255.255.256')\n    Traceback (most recent call last):\n    VdtValueError: the value \"255.255.255.256\" is unacceptable.\n    >>> vtor.check('ip_addr', '1.2.3.4.5')\n    Traceback (most recent call last):\n    VdtValueError: the value \"1.2.3.4.5\" is unacceptable.\n    >>> vtor.check('ip_addr', 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n    \"\"\"\n    if not isinstance(value, string_type):\n        raise VdtTypeError(value)\n    value = value.strip()\n    try:\n        dottedQuadToNum(value)\n    except ValueError:\n        raise VdtValueError(value)\n    return value\n\n\ndef is_list(value, min=None, max=None):\n    \"\"\"\n    Check that the value is a list of values.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    It does no check on list members.\n\n    >>> vtor.check('list', ())\n    []\n    >>> vtor.check('list', [])\n    []\n    >>> vtor.check('list', (1, 2))\n    [1, 2]\n    >>> vtor.check('list', [1, 2])\n    [1, 2]\n    >>> vtor.check('list(3)', (1, 2))\n    Traceback (most recent call last):\n    VdtValueTooShortError: the value \"(1, 2)\" is too short.\n    >>> vtor.check('list(max=5)', (1, 2, 3, 4, 5, 6))\n    Traceback (most recent call last):\n    VdtValueTooLongError: the value \"(1, 2, 3, 4, 5, 6)\" is too long.\n    >>> vtor.check('list(min=3, max=5)', (1, 2, 3, 4))\n    [1, 2, 3, 4]\n    >>> vtor.check('list', 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n    >>> vtor.check('list', '12')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"12\" is of the wrong type.\n    \"\"\"\n    (min_len, max_len) = _is_num_param(('min', 'max'), (min, max))\n    if isinstance(value, string_type):\n        raise VdtTypeError(value)\n    try:\n        num_members = len(value)\n    except TypeError:\n        raise VdtTypeError(value)\n    if min_len is not None and num_members < min_len:\n        raise VdtValueTooShortError(value)\n    if max_len is not None and num_members > max_len:\n        raise VdtValueTooLongError(value)\n    return list(value)\n\n\ndef is_tuple(value, min=None, max=None):\n    \"\"\"\n    Check that the value is a tuple of values.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    It does no check on members.\n\n    >>> vtor.check('tuple', ())\n    ()\n    >>> vtor.check('tuple', [])\n    ()\n    >>> vtor.check('tuple', (1, 2))\n    (1, 2)\n    >>> vtor.check('tuple', [1, 2])\n    (1, 2)\n    >>> vtor.check('tuple(3)', (1, 2))\n    Traceback (most recent call last):\n    VdtValueTooShortError: the value \"(1, 2)\" is too short.\n    >>> vtor.check('tuple(max=5)', (1, 2, 3, 4, 5, 6))\n    Traceback (most recent call last):\n    VdtValueTooLongError: the value \"(1, 2, 3, 4, 5, 6)\" is too long.\n    >>> vtor.check('tuple(min=3, max=5)', (1, 2, 3, 4))\n    (1, 2, 3, 4)\n    >>> vtor.check('tuple', 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n    >>> vtor.check('tuple', '12')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"12\" is of the wrong type.\n    \"\"\"\n    return tuple(is_list(value, min, max))\n\n\ndef is_string(value, min=None, max=None):\n    \"\"\"\n    Check that the supplied value is a string.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    >>> vtor.check('string', '0')\n    '0'\n    >>> vtor.check('string', 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n    >>> vtor.check('string(2)', '12')\n    '12'\n    >>> vtor.check('string(2)', '1')\n    Traceback (most recent call last):\n    VdtValueTooShortError: the value \"1\" is too short.\n    >>> vtor.check('string(min=2, max=3)', '123')\n    '123'\n    >>> vtor.check('string(min=2, max=3)', '1234')\n    Traceback (most recent call last):\n    VdtValueTooLongError: the value \"1234\" is too long.\n    \"\"\"\n    if not isinstance(value, string_type):\n        raise VdtTypeError(value)\n    (min_len, max_len) = _is_num_param(('min', 'max'), (min, max))\n    try:\n        num_members = len(value)\n    except TypeError:\n        raise VdtTypeError(value)\n    if min_len is not None and num_members < min_len:\n        raise VdtValueTooShortError(value)\n    if max_len is not None and num_members > max_len:\n        raise VdtValueTooLongError(value)\n    return value\n\n\ndef is_int_list(value, min=None, max=None):\n    \"\"\"\n    Check that the value is a list of integers.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    Each list member is checked that it is an integer.\n\n    >>> vtor.check('int_list', ())\n    []\n    >>> vtor.check('int_list', [])\n    []\n    >>> vtor.check('int_list', (1, 2))\n    [1, 2]\n    >>> vtor.check('int_list', [1, 2])\n    [1, 2]\n    >>> vtor.check('int_list', [1, 'a'])\n    Traceback (most recent call last):\n    VdtTypeError: the value \"a\" is of the wrong type.\n    \"\"\"\n    return [is_integer(mem) for mem in is_list(value, min, max)]\n\n\ndef is_bool_list(value, min=None, max=None):\n    \"\"\"\n    Check that the value is a list of booleans.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    Each list member is checked that it is a boolean.\n\n    >>> vtor.check('bool_list', ())\n    []\n    >>> vtor.check('bool_list', [])\n    []\n    >>> check_res = vtor.check('bool_list', (True, False))\n    >>> check_res == [True, False]\n    1\n    >>> check_res = vtor.check('bool_list', [True, False])\n    >>> check_res == [True, False]\n    1\n    >>> vtor.check('bool_list', [True, 'a'])\n    Traceback (most recent call last):\n    VdtTypeError: the value \"a\" is of the wrong type.\n    \"\"\"\n    return [is_boolean(mem) for mem in is_list(value, min, max)]\n\n\ndef is_float_list(value, min=None, max=None):\n    \"\"\"\n    Check that the value is a list of floats.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    Each list member is checked that it is a float.\n\n    >>> vtor.check('float_list', ())\n    []\n    >>> vtor.check('float_list', [])\n    []\n    >>> vtor.check('float_list', (1, 2.0))\n    [1.0, 2.0]\n    >>> vtor.check('float_list', [1, 2.0])\n    [1.0, 2.0]\n    >>> vtor.check('float_list', [1, 'a'])\n    Traceback (most recent call last):\n    VdtTypeError: the value \"a\" is of the wrong type.\n    \"\"\"\n    return [is_float(mem) for mem in is_list(value, min, max)]\n\n\ndef is_string_list(value, min=None, max=None):\n    \"\"\"\n    Check that the value is a list of strings.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    Each list member is checked that it is a string.\n\n    >>> vtor.check('string_list', ())\n    []\n    >>> vtor.check('string_list', [])\n    []\n    >>> vtor.check('string_list', ('a', 'b'))\n    ['a', 'b']\n    >>> vtor.check('string_list', ['a', 1])\n    Traceback (most recent call last):\n    VdtTypeError: the value \"1\" is of the wrong type.\n    >>> vtor.check('string_list', 'hello')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"hello\" is of the wrong type.\n    \"\"\"\n    if isinstance(value, string_type):\n        raise VdtTypeError(value)\n    return [is_string(mem) for mem in is_list(value, min, max)]\n\n\ndef is_ip_addr_list(value, min=None, max=None):\n    \"\"\"\n    Check that the value is a list of IP addresses.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    Each list member is checked that it is an IP address.\n\n    >>> vtor.check('ip_addr_list', ())\n    []\n    >>> vtor.check('ip_addr_list', [])\n    []\n    >>> vtor.check('ip_addr_list', ('1.2.3.4', '5.6.7.8'))\n    ['1.2.3.4', '5.6.7.8']\n    >>> vtor.check('ip_addr_list', ['a'])\n    Traceback (most recent call last):\n    VdtValueError: the value \"a\" is unacceptable.\n    \"\"\"\n    return [is_ip_addr(mem) for mem in is_list(value, min, max)]\n\n\ndef force_list(value, min=None, max=None):\n    \"\"\"\n    Check that a value is a list, coercing strings into\n    a list with one member. Useful where users forget the\n    trailing comma that turns a single value into a list.\n\n    You can optionally specify the minimum and maximum number of members.\n    A minumum of greater than one will fail if the user only supplies a\n    string.\n\n    >>> vtor.check('force_list', ())\n    []\n    >>> vtor.check('force_list', [])\n    []\n    >>> vtor.check('force_list', 'hello')\n    ['hello']\n    \"\"\"\n    if not isinstance(value, (list, tuple)):\n        value = [value]\n    return is_list(value, min, max)\n\n\n\nfun_dict = {\n    'integer': is_integer,\n    'float': is_float,\n    'ip_addr': is_ip_addr,\n    'string': is_string,\n    'boolean': is_boolean,\n}\n\n\ndef is_mixed_list(value, *args):\n    \"\"\"\n    Check that the value is a list.\n    Allow specifying the type of each member.\n    Work on lists of specific lengths.\n\n    You specify each member as a positional argument specifying type\n\n    Each type should be one of the following strings :\n      'integer', 'float', 'ip_addr', 'string', 'boolean'\n\n    So you can specify a list of two strings, followed by\n    two integers as :\n\n      mixed_list('string', 'string', 'integer', 'integer')\n\n    The length of the list must match the number of positional\n    arguments you supply.\n\n    >>> mix_str = \"mixed_list('integer', 'float', 'ip_addr', 'string', 'boolean')\"\n    >>> check_res = vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a', True))\n    >>> check_res == [1, 2.0, '1.2.3.4', 'a', True]\n    1\n    >>> check_res = vtor.check(mix_str, ('1', '2.0', '1.2.3.4', 'a', 'True'))\n    >>> check_res == [1, 2.0, '1.2.3.4', 'a', True]\n    1\n    >>> vtor.check(mix_str, ('b', 2.0, '1.2.3.4', 'a', True))\n    Traceback (most recent call last):\n    VdtTypeError: the value \"b\" is of the wrong type.\n    >>> vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a'))\n    Traceback (most recent call last):\n    VdtValueTooShortError: the value \"(1, 2.0, '1.2.3.4', 'a')\" is too short.\n    >>> vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a', 1, 'b'))\n    Traceback (most recent call last):\n    VdtValueTooLongError: the value \"(1, 2.0, '1.2.3.4', 'a', 1, 'b')\" is too long.\n    >>> vtor.check(mix_str, 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n\n    >>> vtor.check('mixed_list(\"yoda\")', ('a'))\n    Traceback (most recent call last):\n    VdtParamError: passed an incorrect value \"KeyError('yoda',)\" for parameter \"'mixed_list'\"\n    \"\"\"\n    try:\n        length = len(value)\n    except TypeError:\n        raise VdtTypeError(value)\n    if length < len(args):\n        raise VdtValueTooShortError(value)\n    elif length > len(args):\n        raise VdtValueTooLongError(value)\n    try:\n        return [fun_dict[arg](val) for arg, val in zip(args, value)]\n    except KeyError as e:\n        raise VdtParamError('mixed_list', e)\n\n\ndef is_option(value, *options):\n    \"\"\"\n    This check matches the value to any of a set of options.\n\n    >>> vtor.check('option(\"yoda\", \"jedi\")', 'yoda')\n    'yoda'\n    >>> vtor.check('option(\"yoda\", \"jedi\")', 'jed')\n    Traceback (most recent call last):\n    VdtValueError: the value \"jed\" is unacceptable.\n    >>> vtor.check('option(\"yoda\", \"jedi\")', 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n    \"\"\"\n    if not isinstance(value, string_type):\n        raise VdtTypeError(value)\n    if not value in options:\n        raise VdtValueError(value)\n    return value\n\n\ndef _test(value, *args, **keywargs):\n    \"\"\"\n    A function that exists for test purposes.\n\n    >>> checks = [\n    ...     '3, 6, min=1, max=3, test=list(a, b, c)',\n    ...     '3',\n    ...     '3, 6',\n    ...     '3,',\n    ...     'min=1, test=\"a b c\"',\n    ...     'min=5, test=\"a, b, c\"',\n    ...     'min=1, max=3, test=\"a, b, c\"',\n    ...     'min=-100, test=-99',\n    ...     'min=1, max=3',\n    ...     '3, 6, test=\"36\"',\n    ...     '3, 6, test=\"a, b, c\"',\n    ...     '3, max=3, test=list(\"a\", \"b\", \"c\")',\n    ...     '''3, max=3, test=list(\"'a'\", 'b', \"x=(c)\")''',\n    ...     \"test='x=fish(3)'\",\n    ...    ]\n    >>> v = Validator({'test': _test})\n    >>> for entry in checks:\n    ...     pprint(v.check(('test(%s)' % entry), 3))\n    (3, ('3', '6'), {'max': '3', 'min': '1', 'test': ['a', 'b', 'c']})\n    (3, ('3',), {})\n    (3, ('3', '6'), {})\n    (3, ('3',), {})\n    (3, (), {'min': '1', 'test': 'a b c'})\n    (3, (), {'min': '5', 'test': 'a, b, c'})\n    (3, (), {'max': '3', 'min': '1', 'test': 'a, b, c'})\n    (3, (), {'min': '-100', 'test': '-99'})\n    (3, (), {'max': '3', 'min': '1'})\n    (3, ('3', '6'), {'test': '36'})\n    (3, ('3', '6'), {'test': 'a, b, c'})\n    (3, ('3',), {'max': '3', 'test': ['a', 'b', 'c']})\n    (3, ('3',), {'max': '3', 'test': [\"'a'\", 'b', 'x=(c)']})\n    (3, (), {'test': 'x=fish(3)'})\n\n    >>> v = Validator()\n    >>> v.check('integer(default=6)', '3')\n    3\n    >>> v.check('integer(default=6)', None, True)\n    6\n    >>> v.get_default_value('integer(default=6)')\n    6\n    >>> v.get_default_value('float(default=6)')\n    6.0\n    >>> v.get_default_value('pass(default=None)')\n    >>> v.get_default_value(\"string(default='None')\")\n    'None'\n    >>> v.get_default_value('pass')\n    Traceback (most recent call last):\n    KeyError: 'Check \"pass\" has no default value.'\n    >>> v.get_default_value('pass(default=list(1, 2, 3, 4))')\n    ['1', '2', '3', '4']\n\n    >>> v = Validator()\n    >>> v.check(\"pass(default=None)\", None, True)\n    >>> v.check(\"pass(default='None')\", None, True)\n    'None'\n    >>> v.check('pass(default=\"None\")', None, True)\n    'None'\n    >>> v.check('pass(default=list(1, 2, 3, 4))', None, True)\n    ['1', '2', '3', '4']\n\n    Bug test for unicode arguments\n    >>> v = Validator()\n    >>> v.check(unicode('string(min=4)'), unicode('test')) == unicode('test')\n    True\n\n    >>> v = Validator()\n    >>> v.get_default_value(unicode('string(min=4, default=\"1234\")')) == unicode('1234')\n    True\n    >>> v.check(unicode('string(min=4, default=\"1234\")'), unicode('test')) == unicode('test')\n    True\n\n    >>> v = Validator()\n    >>> default = v.get_default_value('string(default=None)')\n    >>> default == None\n    1\n    \"\"\"\n    return (value, args, keywargs)\n\n\ndef _test2():\n    \"\"\"\n    >>>\n    >>> v = Validator()\n    >>> v.get_default_value('string(default=\"#ff00dd\")')\n    '#ff00dd'\n    >>> v.get_default_value('integer(default=3) # comment')\n    3\n    \"\"\"\n\ndef _test3():\n    r\"\"\"\n    >>> vtor.check('string(default=\"\")', '', missing=True)\n    ''\n    >>> vtor.check('string(default=\"\\n\")', '', missing=True)\n    '\\n'\n    >>> print(vtor.check('string(default=\"\\n\")', '', missing=True))\n    <BLANKLINE>\n    <BLANKLINE>\n    >>> vtor.check('string()', '\\n')\n    '\\n'\n    >>> vtor.check('string(default=\"\\n\\n\\n\")', '', missing=True)\n    '\\n\\n\\n'\n    >>> vtor.check('string()', 'random \\n text goes here\\n\\n')\n    'random \\n text goes here\\n\\n'\n    >>> vtor.check('string(default=\" \\nrandom text\\ngoes \\n here\\n\\n \")',\n    ... '', missing=True)\n    ' \\nrandom text\\ngoes \\n here\\n\\n '\n    >>> vtor.check(\"string(default='\\n\\n\\n')\", '', missing=True)\n    '\\n\\n\\n'\n    >>> vtor.check(\"option('\\n','a','b',default='\\n')\", '', missing=True)\n    '\\n'\n    >>> vtor.check(\"string_list()\", ['foo', '\\n', 'bar'])\n    ['foo', '\\n', 'bar']\n    >>> vtor.check(\"string_list(default=list('\\n'))\", '', missing=True)\n    ['\\n']\n    \"\"\"\n\n\nif __name__ == '__main__':\n    # run the code tests in doctest format\n    import sys\n    import doctest\n    m = sys.modules.get('__main__')\n    globs = m.__dict__.copy()\n    globs.update({\n        'vtor': Validator(),\n    })\n\n    failures, tests = doctest.testmod(\n        m, globs=globs,\n        optionflags=doctest.IGNORE_EXCEPTION_DETAIL | doctest.ELLIPSIS)\n    assert not failures, '{} failures out of {} tests'.format(failures, tests)\n"},{"col":4,"comment":"null","endLoc":933,"header":"def repeat(self, repeats, axis=None)","id":11432,"name":"repeat","nodeType":"Function","startLoc":932,"text":"def repeat(self, repeats, axis=None):\n        return self._apply('repeat', repeats, axis=axis)"},{"col":4,"comment":"null","endLoc":937,"header":"def choose(self, choices, out=None, mode='raise')","id":11433,"name":"choose","nodeType":"Function","startLoc":935,"text":"def choose(self, choices, out=None, mode='raise'):\n        # Let __array_function__ take care since choices can be masked too.\n        return np.choose(self, choices, out=out, mode=mode)"},{"col":4,"comment":"null","endLoc":943,"header":"def argmin(self, axis=None, out=None)","id":11434,"name":"argmin","nodeType":"Function","startLoc":939,"text":"def argmin(self, axis=None, out=None):\n        # Todo: should this return a masked integer array, with masks\n        # if all elements were masked?\n        at_min = self == self.min(axis=axis, keepdims=True)\n        return at_min.filled(False).argmax(axis=axis, out=out)"},{"className":"ValidateError","col":0,"comment":"\n    This error indicates that the check failed.\n    It can be the base class for more specific errors.\n\n    Any check function that fails ought to raise this error.\n    (or a subclass)\n\n    >>> raise ValidateError\n    Traceback (most recent call last):\n    ValidateError\n    ","endLoc":367,"id":11435,"nodeType":"Class","startLoc":356,"text":"class ValidateError(Exception):\n    \"\"\"\n    This error indicates that the check failed.\n    It can be the base class for more specific errors.\n\n    Any check function that fails ought to raise this error.\n    (or a subclass)\n\n    >>> raise ValidateError\n    Traceback (most recent call last):\n    ValidateError\n    \"\"\""},{"className":"VdtMissingValue","col":0,"comment":"No value was supplied to a check that needed one.","endLoc":371,"id":11436,"nodeType":"Class","startLoc":370,"text":"class VdtMissingValue(ValidateError):\n    \"\"\"No value was supplied to a check that needed one.\"\"\""},{"className":"VdtUnknownCheckError","col":0,"comment":"An unknown check function was requested","endLoc":383,"id":11437,"nodeType":"Class","startLoc":374,"text":"class VdtUnknownCheckError(ValidateError):\n    \"\"\"An unknown check function was requested\"\"\"\n\n    def __init__(self, value):\n        \"\"\"\n        >>> raise VdtUnknownCheckError('yoda')\n        Traceback (most recent call last):\n        VdtUnknownCheckError: the check \"yoda\" is unknown.\n        \"\"\"\n        ValidateError.__init__(self, 'the check \"%s\" is unknown.' % (value,))"},{"className":"VdtParamError","col":0,"comment":"An incorrect parameter was passed","endLoc":395,"id":11438,"nodeType":"Class","startLoc":386,"text":"class VdtParamError(SyntaxError):\n    \"\"\"An incorrect parameter was passed\"\"\"\n\n    def __init__(self, name, value):\n        \"\"\"\n        >>> raise VdtParamError('yoda', 'jedi')\n        Traceback (most recent call last):\n        VdtParamError: passed an incorrect value \"jedi\" for parameter \"yoda\".\n        \"\"\"\n        SyntaxError.__init__(self, 'passed an incorrect value \"%s\" for parameter \"%s\".' % (value, name))"},{"className":"VdtTypeError","col":0,"comment":"The value supplied was of the wrong type","endLoc":407,"id":11439,"nodeType":"Class","startLoc":398,"text":"class VdtTypeError(ValidateError):\n    \"\"\"The value supplied was of the wrong type\"\"\"\n\n    def __init__(self, value):\n        \"\"\"\n        >>> raise VdtTypeError('jedi')\n        Traceback (most recent call last):\n        VdtTypeError: the value \"jedi\" is of the wrong type.\n        \"\"\"\n        ValidateError.__init__(self, 'the value \"%s\" is of the wrong type.' % (value,))"},{"col":4,"comment":"\n        >>> raise VdtTypeError('jedi')\n        Traceback (most recent call last):\n        VdtTypeError: the value \"jedi\" is of the wrong type.\n        ","endLoc":407,"header":"def __init__(self, value)","id":11440,"name":"__init__","nodeType":"Function","startLoc":401,"text":"def __init__(self, value):\n        \"\"\"\n        >>> raise VdtTypeError('jedi')\n        Traceback (most recent call last):\n        VdtTypeError: the value \"jedi\" is of the wrong type.\n        \"\"\"\n        ValidateError.__init__(self, 'the value \"%s\" is of the wrong type.' % (value,))"},{"className":"VdtValueError","col":0,"comment":"The value supplied was of the correct type, but was not an allowed value.","endLoc":419,"id":11441,"nodeType":"Class","startLoc":410,"text":"class VdtValueError(ValidateError):\n    \"\"\"The value supplied was of the correct type, but was not an allowed value.\"\"\"\n\n    def __init__(self, value):\n        \"\"\"\n        >>> raise VdtValueError('jedi')\n        Traceback (most recent call last):\n        VdtValueError: the value \"jedi\" is unacceptable.\n        \"\"\"\n        ValidateError.__init__(self, 'the value \"%s\" is unacceptable.' % (value,))"},{"col":4,"comment":"\n        >>> raise VdtValueError('jedi')\n        Traceback (most recent call last):\n        VdtValueError: the value \"jedi\" is unacceptable.\n        ","endLoc":419,"header":"def __init__(self, value)","id":11442,"name":"__init__","nodeType":"Function","startLoc":413,"text":"def __init__(self, value):\n        \"\"\"\n        >>> raise VdtValueError('jedi')\n        Traceback (most recent call last):\n        VdtValueError: the value \"jedi\" is unacceptable.\n        \"\"\"\n        ValidateError.__init__(self, 'the value \"%s\" is unacceptable.' % (value,))"},{"className":"VdtValueTooSmallError","col":0,"comment":"The value supplied was of the correct type, but was too small.","endLoc":431,"id":11443,"nodeType":"Class","startLoc":422,"text":"class VdtValueTooSmallError(VdtValueError):\n    \"\"\"The value supplied was of the correct type, but was too small.\"\"\"\n\n    def __init__(self, value):\n        \"\"\"\n        >>> raise VdtValueTooSmallError('0')\n        Traceback (most recent call last):\n        VdtValueTooSmallError: the value \"0\" is too small.\n        \"\"\"\n        ValidateError.__init__(self, 'the value \"%s\" is too small.' % (value,))"},{"col":4,"comment":"\n        >>> raise VdtValueTooSmallError('0')\n        Traceback (most recent call last):\n        VdtValueTooSmallError: the value \"0\" is too small.\n        ","endLoc":431,"header":"def __init__(self, value)","id":11444,"name":"__init__","nodeType":"Function","startLoc":425,"text":"def __init__(self, value):\n        \"\"\"\n        >>> raise VdtValueTooSmallError('0')\n        Traceback (most recent call last):\n        VdtValueTooSmallError: the value \"0\" is too small.\n        \"\"\"\n        ValidateError.__init__(self, 'the value \"%s\" is too small.' % (value,))"},{"className":"VdtValueTooBigError","col":0,"comment":"The value supplied was of the correct type, but was too big.","endLoc":443,"id":11445,"nodeType":"Class","startLoc":434,"text":"class VdtValueTooBigError(VdtValueError):\n    \"\"\"The value supplied was of the correct type, but was too big.\"\"\"\n\n    def __init__(self, value):\n        \"\"\"\n        >>> raise VdtValueTooBigError('1')\n        Traceback (most recent call last):\n        VdtValueTooBigError: the value \"1\" is too big.\n        \"\"\"\n        ValidateError.__init__(self, 'the value \"%s\" is too big.' % (value,))"},{"col":4,"comment":"\n        >>> raise VdtValueTooBigError('1')\n        Traceback (most recent call last):\n        VdtValueTooBigError: the value \"1\" is too big.\n        ","endLoc":443,"header":"def __init__(self, value)","id":11446,"name":"__init__","nodeType":"Function","startLoc":437,"text":"def __init__(self, value):\n        \"\"\"\n        >>> raise VdtValueTooBigError('1')\n        Traceback (most recent call last):\n        VdtValueTooBigError: the value \"1\" is too big.\n        \"\"\"\n        ValidateError.__init__(self, 'the value \"%s\" is too big.' % (value,))"},{"className":"VdtValueTooShortError","col":0,"comment":"The value supplied was of the correct type, but was too short.","endLoc":457,"id":11447,"nodeType":"Class","startLoc":446,"text":"class VdtValueTooShortError(VdtValueError):\n    \"\"\"The value supplied was of the correct type, but was too short.\"\"\"\n\n    def __init__(self, value):\n        \"\"\"\n        >>> raise VdtValueTooShortError('jed')\n        Traceback (most recent call last):\n        VdtValueTooShortError: the value \"jed\" is too short.\n        \"\"\"\n        ValidateError.__init__(\n            self,\n            'the value \"%s\" is too short.' % (value,))"},{"col":4,"comment":"\n        >>> raise VdtValueTooShortError('jed')\n        Traceback (most recent call last):\n        VdtValueTooShortError: the value \"jed\" is too short.\n        ","endLoc":457,"header":"def __init__(self, value)","id":11448,"name":"__init__","nodeType":"Function","startLoc":449,"text":"def __init__(self, value):\n        \"\"\"\n        >>> raise VdtValueTooShortError('jed')\n        Traceback (most recent call last):\n        VdtValueTooShortError: the value \"jed\" is too short.\n        \"\"\"\n        ValidateError.__init__(\n            self,\n            'the value \"%s\" is too short.' % (value,))"},{"className":"VdtValueTooLongError","col":0,"comment":"The value supplied was of the correct type, but was too long.","endLoc":469,"id":11449,"nodeType":"Class","startLoc":460,"text":"class VdtValueTooLongError(VdtValueError):\n    \"\"\"The value supplied was of the correct type, but was too long.\"\"\"\n\n    def __init__(self, value):\n        \"\"\"\n        >>> raise VdtValueTooLongError('jedie')\n        Traceback (most recent call last):\n        VdtValueTooLongError: the value \"jedie\" is too long.\n        \"\"\"\n        ValidateError.__init__(self, 'the value \"%s\" is too long.' % (value,))"},{"col":4,"comment":"\n        >>> raise VdtValueTooLongError('jedie')\n        Traceback (most recent call last):\n        VdtValueTooLongError: the value \"jedie\" is too long.\n        ","endLoc":469,"header":"def __init__(self, value)","id":11450,"name":"__init__","nodeType":"Function","startLoc":463,"text":"def __init__(self, value):\n        \"\"\"\n        >>> raise VdtValueTooLongError('jedie')\n        Traceback (most recent call last):\n        VdtValueTooLongError: the value \"jedie\" is too long.\n        \"\"\"\n        ValidateError.__init__(self, 'the value \"%s\" is too long.' % (value,))"},{"className":"Validator","col":0,"comment":"\n    Validator is an object that allows you to register a set of 'checks'.\n    These checks take input and test that it conforms to the check.\n\n    This can also involve converting the value from a string into\n    the correct datatype.\n\n    The ``check`` method takes an input string which configures which\n    check is to be used and applies that check to a supplied value.\n\n    An example input string would be:\n    'int_range(param1, param2)'\n\n    You would then provide something like:\n\n    >>> def int_range_check(value, min, max):\n    ...     # turn min and max from strings to integers\n    ...     min = int(min)\n    ...     max = int(max)\n    ...     # check that value is of the correct type.\n    ...     # possible valid inputs are integers or strings\n    ...     # that represent integers\n    ...     if not isinstance(value, (int, long, string_type)):\n    ...         raise VdtTypeError(value)\n    ...     elif isinstance(value, string_type):\n    ...         # if we are given a string\n    ...         # attempt to convert to an integer\n    ...         try:\n    ...             value = int(value)\n    ...         except ValueError:\n    ...             raise VdtValueError(value)\n    ...     # check the value is between our constraints\n    ...     if not min <= value:\n    ...          raise VdtValueTooSmallError(value)\n    ...     if not value <= max:\n    ...          raise VdtValueTooBigError(value)\n    ...     return value\n\n    >>> fdict = {'int_range': int_range_check}\n    >>> vtr1 = Validator(fdict)\n    >>> vtr1.check('int_range(20, 40)', '30')\n    30\n    >>> vtr1.check('int_range(20, 40)', '60')\n    Traceback (most recent call last):\n    VdtValueTooBigError: the value \"60\" is too big.\n\n    New functions can be added with : ::\n\n    >>> vtr2 = Validator()\n    >>> vtr2.functions['int_range'] = int_range_check\n\n    Or by passing in a dictionary of functions when Validator\n    is instantiated.\n\n    Your functions *can* use keyword arguments,\n    but the first argument should always be 'value'.\n\n    If the function doesn't take additional arguments,\n    the parentheses are optional in the check.\n    It can be written with either of : ::\n\n        keyword = function_name\n        keyword = function_name()\n\n    The first program to utilise Validator() was Michael Foord's\n    ConfigObj, an alternative to ConfigParser which supports lists and\n    can validate a config file using a config schema.\n    For more details on using Validator with ConfigObj see:\n    https://configobj.readthedocs.org/en/latest/configobj.html\n    ","endLoc":743,"id":11451,"nodeType":"Class","startLoc":472,"text":"class Validator(object):\n    \"\"\"\n    Validator is an object that allows you to register a set of 'checks'.\n    These checks take input and test that it conforms to the check.\n\n    This can also involve converting the value from a string into\n    the correct datatype.\n\n    The ``check`` method takes an input string which configures which\n    check is to be used and applies that check to a supplied value.\n\n    An example input string would be:\n    'int_range(param1, param2)'\n\n    You would then provide something like:\n\n    >>> def int_range_check(value, min, max):\n    ...     # turn min and max from strings to integers\n    ...     min = int(min)\n    ...     max = int(max)\n    ...     # check that value is of the correct type.\n    ...     # possible valid inputs are integers or strings\n    ...     # that represent integers\n    ...     if not isinstance(value, (int, long, string_type)):\n    ...         raise VdtTypeError(value)\n    ...     elif isinstance(value, string_type):\n    ...         # if we are given a string\n    ...         # attempt to convert to an integer\n    ...         try:\n    ...             value = int(value)\n    ...         except ValueError:\n    ...             raise VdtValueError(value)\n    ...     # check the value is between our constraints\n    ...     if not min <= value:\n    ...          raise VdtValueTooSmallError(value)\n    ...     if not value <= max:\n    ...          raise VdtValueTooBigError(value)\n    ...     return value\n\n    >>> fdict = {'int_range': int_range_check}\n    >>> vtr1 = Validator(fdict)\n    >>> vtr1.check('int_range(20, 40)', '30')\n    30\n    >>> vtr1.check('int_range(20, 40)', '60')\n    Traceback (most recent call last):\n    VdtValueTooBigError: the value \"60\" is too big.\n\n    New functions can be added with : ::\n\n    >>> vtr2 = Validator()\n    >>> vtr2.functions['int_range'] = int_range_check\n\n    Or by passing in a dictionary of functions when Validator\n    is instantiated.\n\n    Your functions *can* use keyword arguments,\n    but the first argument should always be 'value'.\n\n    If the function doesn't take additional arguments,\n    the parentheses are optional in the check.\n    It can be written with either of : ::\n\n        keyword = function_name\n        keyword = function_name()\n\n    The first program to utilise Validator() was Michael Foord's\n    ConfigObj, an alternative to ConfigParser which supports lists and\n    can validate a config file using a config schema.\n    For more details on using Validator with ConfigObj see:\n    https://configobj.readthedocs.org/en/latest/configobj.html\n    \"\"\"\n\n    # this regex does the initial parsing of the checks\n    _func_re = re.compile(r'(.+?)\\((.*)\\)', re.DOTALL)\n\n    # this regex takes apart keyword arguments\n    _key_arg = re.compile(r'^([a-zA-Z_][a-zA-Z0-9_]*)\\s*=\\s*(.*)$',  re.DOTALL)\n\n\n    # this regex finds keyword=list(....) type values\n    _list_arg = _list_arg\n\n    # this regex takes individual values out of lists - in one pass\n    _list_members = _list_members\n\n    # These regexes check a set of arguments for validity\n    # and then pull the members out\n    _paramfinder = re.compile(_paramstring, re.VERBOSE | re.DOTALL)\n    _matchfinder = re.compile(_matchstring, re.VERBOSE | re.DOTALL)\n\n\n    def __init__(self, functions=None):\n        \"\"\"\n        >>> vtri = Validator()\n        \"\"\"\n        self.functions = {\n            '': self._pass,\n            'integer': is_integer,\n            'float': is_float,\n            'boolean': is_boolean,\n            'ip_addr': is_ip_addr,\n            'string': is_string,\n            'list': is_list,\n            'tuple': is_tuple,\n            'int_list': is_int_list,\n            'float_list': is_float_list,\n            'bool_list': is_bool_list,\n            'ip_addr_list': is_ip_addr_list,\n            'string_list': is_string_list,\n            'mixed_list': is_mixed_list,\n            'pass': self._pass,\n            'option': is_option,\n            'force_list': force_list,\n        }\n        if functions is not None:\n            self.functions.update(functions)\n        # tekNico: for use by ConfigObj\n        self.baseErrorClass = ValidateError\n        self._cache = {}\n\n\n    def check(self, check, value, missing=False):\n        \"\"\"\n        Usage: check(check, value)\n\n        Arguments:\n            check: string representing check to apply (including arguments)\n            value: object to be checked\n        Returns value, converted to correct type if necessary\n\n        If the check fails, raises a ``ValidateError`` subclass.\n\n        >>> vtor.check('yoda', '')\n        Traceback (most recent call last):\n        VdtUnknownCheckError: the check \"yoda\" is unknown.\n        >>> vtor.check('yoda()', '')\n        Traceback (most recent call last):\n        VdtUnknownCheckError: the check \"yoda\" is unknown.\n\n        >>> vtor.check('string(default=\"\")', '', missing=True)\n        ''\n        \"\"\"\n        fun_name, fun_args, fun_kwargs, default = self._parse_with_caching(check)\n\n        if missing:\n            if default is None:\n                # no information needed here - to be handled by caller\n                raise VdtMissingValue()\n            value = self._handle_none(default)\n\n        if value is None:\n            return None\n\n        return self._check_value(value, fun_name, fun_args, fun_kwargs)\n\n\n    def _handle_none(self, value):\n        if value == 'None':\n            return None\n        elif value in (\"'None'\", '\"None\"'):\n            # Special case a quoted None\n            value = self._unquote(value)\n        return value\n\n\n    def _parse_with_caching(self, check):\n        if check in self._cache:\n            fun_name, fun_args, fun_kwargs, default = self._cache[check]\n            # We call list and dict below to work with *copies* of the data\n            # rather than the original (which are mutable of course)\n            fun_args = list(fun_args)\n            fun_kwargs = dict(fun_kwargs)\n        else:\n            fun_name, fun_args, fun_kwargs, default = self._parse_check(check)\n            fun_kwargs = dict([(str(key), value) for (key, value) in list(fun_kwargs.items())])\n            self._cache[check] = fun_name, list(fun_args), dict(fun_kwargs), default\n        return fun_name, fun_args, fun_kwargs, default\n\n\n    def _check_value(self, value, fun_name, fun_args, fun_kwargs):\n        try:\n            fun = self.functions[fun_name]\n        except KeyError:\n            raise VdtUnknownCheckError(fun_name)\n        else:\n            return fun(value, *fun_args, **fun_kwargs)\n\n\n    def _parse_check(self, check):\n        fun_match = self._func_re.match(check)\n        if fun_match:\n            fun_name = fun_match.group(1)\n            arg_string = fun_match.group(2)\n            arg_match = self._matchfinder.match(arg_string)\n            if arg_match is None:\n                # Bad syntax\n                raise VdtParamError('Bad syntax in check \"%s\".' % check)\n            fun_args = []\n            fun_kwargs = {}\n            # pull out args of group 2\n            for arg in self._paramfinder.findall(arg_string):\n                # args may need whitespace removing (before removing quotes)\n                arg = arg.strip()\n                listmatch = self._list_arg.match(arg)\n                if listmatch:\n                    key, val = self._list_handle(listmatch)\n                    fun_kwargs[key] = val\n                    continue\n                keymatch = self._key_arg.match(arg)\n                if keymatch:\n                    val = keymatch.group(2)\n                    if not val in (\"'None'\", '\"None\"'):\n                        # Special case a quoted None\n                        val = self._unquote(val)\n                    fun_kwargs[keymatch.group(1)] = val\n                    continue\n\n                fun_args.append(self._unquote(arg))\n        else:\n            # allows for function names without (args)\n            return check, (), {}, None\n\n        # Default must be deleted if the value is specified too,\n        # otherwise the check function will get a spurious \"default\" keyword arg\n        default = fun_kwargs.pop('default', None)\n        return fun_name, fun_args, fun_kwargs, default\n\n\n    def _unquote(self, val):\n        \"\"\"Unquote a value if necessary.\"\"\"\n        if (len(val) >= 2) and (val[0] in (\"'\", '\"')) and (val[0] == val[-1]):\n            val = val[1:-1]\n        return val\n\n\n    def _list_handle(self, listmatch):\n        \"\"\"Take apart a ``keyword=list('val, 'val')`` type string.\"\"\"\n        out = []\n        name = listmatch.group(1)\n        args = listmatch.group(2)\n        for arg in self._list_members.findall(args):\n            out.append(self._unquote(arg))\n        return name, out\n\n\n    def _pass(self, value):\n        \"\"\"\n        Dummy check that always passes\n\n        >>> vtor.check('', 0)\n        0\n        >>> vtor.check('', '0')\n        '0'\n        \"\"\"\n        return value\n\n\n    def get_default_value(self, check):\n        \"\"\"\n        Given a check, return the default value for the check\n        (converted to the right type).\n\n        If the check doesn't specify a default value then a\n        ``KeyError`` will be raised.\n        \"\"\"\n        fun_name, fun_args, fun_kwargs, default = self._parse_with_caching(check)\n        if default is None:\n            raise KeyError('Check \"%s\" has no default value.' % check)\n        value = self._handle_none(default)\n        if value is None:\n            return value\n        return self._check_value(value, fun_name, fun_args, fun_kwargs)"},{"col":4,"comment":"null","endLoc":947,"header":"def argmax(self, axis=None, out=None)","id":11452,"name":"argmax","nodeType":"Function","startLoc":945,"text":"def argmax(self, axis=None, out=None):\n        at_max = self == self.max(axis=axis, keepdims=True)\n        return at_max.filled(False).argmax(axis=axis, out=out)"},{"col":4,"comment":"\n        >>> vtri = Validator()\n        ","endLoc":590,"header":"def __init__(self, functions=None)","id":11453,"name":"__init__","nodeType":"Function","startLoc":563,"text":"def __init__(self, functions=None):\n        \"\"\"\n        >>> vtri = Validator()\n        \"\"\"\n        self.functions = {\n            '': self._pass,\n            'integer': is_integer,\n            'float': is_float,\n            'boolean': is_boolean,\n            'ip_addr': is_ip_addr,\n            'string': is_string,\n            'list': is_list,\n            'tuple': is_tuple,\n            'int_list': is_int_list,\n            'float_list': is_float_list,\n            'bool_list': is_bool_list,\n            'ip_addr_list': is_ip_addr_list,\n            'string_list': is_string_list,\n            'mixed_list': is_mixed_list,\n            'pass': self._pass,\n            'option': is_option,\n            'force_list': force_list,\n        }\n        if functions is not None:\n            self.functions.update(functions)\n        # tekNico: for use by ConfigObj\n        self.baseErrorClass = ValidateError\n        self._cache = {}"},{"col":4,"comment":"\n        Dummy check that always passes\n\n        >>> vtor.check('', 0)\n        0\n        >>> vtor.check('', '0')\n        '0'\n        ","endLoc":726,"header":"def _pass(self, value)","id":11454,"name":"_pass","nodeType":"Function","startLoc":717,"text":"def _pass(self, value):\n        \"\"\"\n        Dummy check that always passes\n\n        >>> vtor.check('', 0)\n        0\n        >>> vtor.check('', '0')\n        '0'\n        \"\"\"\n        return value"},{"col":4,"comment":"\n        Given a check, return the default value for the check\n        (converted to the right type).\n\n        If the check doesn't specify a default value then a\n        ``KeyError`` will be raised.\n        ","endLoc":743,"header":"def get_default_value(self, check)","id":11455,"name":"get_default_value","nodeType":"Function","startLoc":729,"text":"def get_default_value(self, check):\n        \"\"\"\n        Given a check, return the default value for the check\n        (converted to the right type).\n\n        If the check doesn't specify a default value then a\n        ``KeyError`` will be raised.\n        \"\"\"\n        fun_name, fun_args, fun_kwargs, default = self._parse_with_caching(check)\n        if default is None:\n            raise KeyError('Check \"%s\" has no default value.' % check)\n        value = self._handle_none(default)\n        if value is None:\n            return value\n        return self._check_value(value, fun_name, fun_args, fun_kwargs)"},{"attributeType":"null","col":8,"comment":"null","endLoc":288,"id":11456,"name":"defaultvalue","nodeType":"Attribute","startLoc":288,"text":"self.defaultvalue"},{"col":4,"comment":"Returns the indices that would sort an array.\n\n        Perform an indirect sort along the given axis on both the array\n        and the mask, with masked items being sorted to the end.\n\n        Parameters\n        ----------\n        axis : int or None, optional\n            Axis along which to sort.  The default is -1 (the last axis).\n            If None, the flattened array is used.\n        kind : str or None, ignored.\n            The kind of sort.  Present only to allow subclasses to work.\n        order : str or list of str.\n            For an array with fields defined, the fields to compare first,\n            second, etc.  A single field can be specified as a string, and not\n            all fields need be specified, but unspecified fields will still be\n            used, in dtype order, to break ties.\n\n        Returns\n        -------\n        index_array : ndarray, int\n            Array of indices that sorts along the specified ``axis``.  Use\n            ``np.take_along_axis(self, index_array, axis=axis)`` to obtain\n            the sorted array.\n\n        ","endLoc":997,"header":"def argsort(self, axis=-1, kind=None, order=None)","id":11457,"name":"argsort","nodeType":"Function","startLoc":949,"text":"def argsort(self, axis=-1, kind=None, order=None):\n        \"\"\"Returns the indices that would sort an array.\n\n        Perform an indirect sort along the given axis on both the array\n        and the mask, with masked items being sorted to the end.\n\n        Parameters\n        ----------\n        axis : int or None, optional\n            Axis along which to sort.  The default is -1 (the last axis).\n            If None, the flattened array is used.\n        kind : str or None, ignored.\n            The kind of sort.  Present only to allow subclasses to work.\n        order : str or list of str.\n            For an array with fields defined, the fields to compare first,\n            second, etc.  A single field can be specified as a string, and not\n            all fields need be specified, but unspecified fields will still be\n            used, in dtype order, to break ties.\n\n        Returns\n        -------\n        index_array : ndarray, int\n            Array of indices that sorts along the specified ``axis``.  Use\n            ``np.take_along_axis(self, index_array, axis=axis)`` to obtain\n            the sorted array.\n\n        \"\"\"\n        if axis is None:\n            data = self.ravel()\n            axis = -1\n        else:\n            data = self\n\n        if self.dtype.names:\n            # As done inside the argsort implementation in multiarray/methods.c.\n            if order is None:\n                order = self.dtype.names\n            else:\n                order = np.core._internal._newnames(self.dtype, order)\n\n            keys = tuple(data[name] for name in order[::-1])\n\n        elif order is not None:\n            raise ValueError('Cannot specify order when the array has no fields.')\n\n        else:\n            keys = (data,)\n\n        return np.lexsort(keys, axis=axis)"},{"col":4,"comment":"Sort an array in-place. Refer to `numpy.sort` for full documentation.","endLoc":1003,"header":"def sort(self, axis=-1, kind=None, order=None)","id":11458,"name":"sort","nodeType":"Function","startLoc":999,"text":"def sort(self, axis=-1, kind=None, order=None):\n        \"\"\"Sort an array in-place. Refer to `numpy.sort` for full documentation.\"\"\"\n        # TODO: probably possible to do this faster than going through argsort!\n        indices = self.argsort(axis, kind=kind, order=order)\n        self[:] = np.take_along_axis(self, indices, axis=axis)"},{"col":4,"comment":"null","endLoc":862,"header":"def define(self,tokens)","id":11459,"name":"define","nodeType":"Function","startLoc":800,"text":"def define(self,tokens):\n        if isinstance(tokens,STRING_TYPES):\n            tokens = self.tokenize(tokens)\n\n        linetok = tokens\n        try:\n            name = linetok[0]\n            if len(linetok) > 1:\n                mtype = linetok[1]\n            else:\n                mtype = None\n            if not mtype:\n                m = Macro(name.value,[])\n                self.macros[name.value] = m\n            elif mtype.type in self.t_WS:\n                # A normal macro\n                m = Macro(name.value,self.tokenstrip(linetok[2:]))\n                self.macros[name.value] = m\n            elif mtype.value == '(':\n                # A macro with arguments\n                tokcount, args, positions = self.collect_args(linetok[1:])\n                variadic = False\n                for a in args:\n                    if variadic:\n                        print(\"No more arguments may follow a variadic argument\")\n                        break\n                    astr = \"\".join([str(_i.value) for _i in a])\n                    if astr == \"...\":\n                        variadic = True\n                        a[0].type = self.t_ID\n                        a[0].value = '__VA_ARGS__'\n                        variadic = True\n                        del a[1:]\n                        continue\n                    elif astr[-3:] == \"...\" and a[0].type == self.t_ID:\n                        variadic = True\n                        del a[1:]\n                        # If, for some reason, \".\" is part of the identifier, strip off the name for the purposes\n                        # of macro expansion\n                        if a[0].value[-3:] == '...':\n                            a[0].value = a[0].value[:-3]\n                        continue\n                    if len(a) > 1 or a[0].type != self.t_ID:\n                        print(\"Invalid macro argument\")\n                        break\n                else:\n                    mvalue = self.tokenstrip(linetok[1+tokcount:])\n                    i = 0\n                    while i < len(mvalue):\n                        if i+1 < len(mvalue):\n                            if mvalue[i].type in self.t_WS and mvalue[i+1].value == '##':\n                                del mvalue[i]\n                                continue\n                            elif mvalue[i].value == '##' and mvalue[i+1].type in self.t_WS:\n                                del mvalue[i+1]\n                        i += 1\n                    m = Macro(name.value,mvalue,[x[0].value for x in args],variadic)\n                    self.macro_prescan(m)\n                    self.macros[name.value] = m\n            else:\n                print(\"Bad macro definition\")\n        except LookupError:\n            print(\"Bad macro definition\")"},{"col":0,"comment":"Generates a configuration file, from the list of `ConfigItem`\n    objects for each subpackage.\n\n    .. versionadded:: 4.1\n\n    Parameters\n    ----------\n    pkgname : str or None\n        The package for which to retrieve the configuration object.\n    filename : str or file-like or None\n        If None, the default configuration path is taken from `get_config`.\n\n    ","endLoc":684,"header":"def generate_config(pkgname='astropy', filename=None, verbose=False)","id":11460,"name":"generate_config","nodeType":"Function","startLoc":595,"text":"def generate_config(pkgname='astropy', filename=None, verbose=False):\n    \"\"\"Generates a configuration file, from the list of `ConfigItem`\n    objects for each subpackage.\n\n    .. versionadded:: 4.1\n\n    Parameters\n    ----------\n    pkgname : str or None\n        The package for which to retrieve the configuration object.\n    filename : str or file-like or None\n        If None, the default configuration path is taken from `get_config`.\n\n    \"\"\"\n    if verbose:\n        verbosity = nullcontext\n        filter_warnings = AstropyDeprecationWarning\n    else:\n        verbosity = silence\n        filter_warnings = Warning\n\n    package = importlib.import_module(pkgname)\n    with verbosity(), warnings.catch_warnings():\n        warnings.simplefilter('ignore', category=filter_warnings)\n        for mod in pkgutil.walk_packages(path=package.__path__,\n                                         prefix=package.__name__ + '.'):\n\n            if (mod.module_finder.path.endswith(('test', 'tests')) or\n                    mod.name.endswith('setup_package')):\n                # Skip test and setup_package modules\n                continue\n            if mod.name.split('.')[-1].startswith('_'):\n                # Skip private modules\n                continue\n\n            with contextlib.suppress(ImportError):\n                importlib.import_module(mod.name)\n\n    wrapper = TextWrapper(initial_indent=\"## \", subsequent_indent='## ',\n                          width=78)\n\n    if filename is None:\n        filename = get_config_filename(pkgname)\n\n    with contextlib.ExitStack() as stack:\n        if isinstance(filename, (str, os.PathLike)):\n            fp = stack.enter_context(open(filename, 'w'))\n        else:\n            # assume it's a file object, or io.StringIO\n            fp = filename\n\n        # Parse the subclasses, ordered by their module name\n        subclasses = ConfigNamespace.__subclasses__()\n        processed = set()\n\n        for conf in sorted(subclasses, key=lambda x: x.__module__):\n            mod = conf.__module__\n\n            # Skip modules for other packages, e.g. astropy modules that\n            # would be imported when running the function for astroquery.\n            if mod.split('.')[0] != pkgname:\n                continue\n\n            # Check that modules are not processed twice, which can happen\n            # when they are imported in another module.\n            if mod in processed:\n                continue\n            else:\n                processed.add(mod)\n\n            print_module = True\n            for item in conf().values():\n                if print_module:\n                    # If this is the first item of the module, we print the\n                    # module name, but not if this is the root package...\n                    if item.module != pkgname:\n                        modname = item.module.replace(f'{pkgname}.', '')\n                        fp.write(f\"[{modname}]\\n\\n\")\n                    print_module = False\n\n                fp.write(wrapper.fill(item.description) + '\\n')\n                if isinstance(item.defaultvalue, (tuple, list)):\n                    if len(item.defaultvalue) == 0:\n                        fp.write(f'# {item.name} = ,\\n\\n')\n                    elif len(item.defaultvalue) == 1:\n                        fp.write(f'# {item.name} = {item.defaultvalue[0]},\\n\\n')\n                    else:\n                        fp.write(f'# {item.name} = {\",\".join(map(str, item.defaultvalue))}\\n\\n')\n                else:\n                    fp.write(f'# {item.name} = {item.defaultvalue}\\n\\n')"},{"col":4,"comment":"null","endLoc":1007,"header":"def argpartition(self, kth, axis=-1, kind='introselect', order=None)","id":11461,"name":"argpartition","nodeType":"Function","startLoc":1005,"text":"def argpartition(self, kth, axis=-1, kind='introselect', order=None):\n        # TODO: should be possible to do this faster than with a full argsort!\n        return self.argsort(axis=axis, order=order)"},{"col":4,"comment":"null","endLoc":416,"header":"def __iter__(self)","id":11462,"name":"__iter__","nodeType":"Function","startLoc":415,"text":"def __iter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":422,"header":"def next(self)","id":11463,"name":"next","nodeType":"Function","startLoc":418,"text":"def next(self):\n        t = self.token()\n        if t is None:\n            raise StopIteration\n        return t"},{"col":4,"comment":"null","endLoc":1011,"header":"def partition(self, kth, axis=-1, kind='introselect', order=None)","id":11464,"name":"partition","nodeType":"Function","startLoc":1009,"text":"def partition(self, kth, axis=-1, kind='introselect', order=None):\n        # TODO: should be possible to do this faster than with a full argsort!\n        return self.sort(axis=axis, order=None)"},{"col":4,"comment":"null","endLoc":1017,"header":"def cumsum(self, axis=None, dtype=None, out=None)","id":11465,"name":"cumsum","nodeType":"Function","startLoc":1013,"text":"def cumsum(self, axis=None, dtype=None, out=None):\n        if axis is None:\n            self = self.ravel()\n            axis = 0\n        return np.add.accumulate(self, axis=axis, dtype=dtype, out=out)"},{"col":4,"comment":"null","endLoc":189,"header":"def tokenize(self,text)","id":11466,"name":"tokenize","nodeType":"Function","startLoc":182,"text":"def tokenize(self,text):\n        tokens = []\n        self.lexer.input(text)\n        while True:\n            tok = self.lexer.token()\n            if not tok: break\n            tokens.append(tok)\n        return tokens"},{"col":4,"comment":"null","endLoc":993,"header":"def parseopt(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None)","id":11467,"name":"parseopt","nodeType":"Function","startLoc":697,"text":"def parseopt(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None):\n        #--! parseopt-start\n        lookahead = None                         # Current lookahead symbol\n        lookaheadstack = []                      # Stack of lookahead symbols\n        actions = self.action                    # Local reference to action table (to avoid lookup on self.)\n        goto    = self.goto                      # Local reference to goto table (to avoid lookup on self.)\n        prod    = self.productions               # Local reference to production list (to avoid lookup on self.)\n        defaulted_states = self.defaulted_states # Local reference to defaulted states\n        pslice  = YaccProduction(None)           # Production object passed to grammar rules\n        errorcount = 0                           # Used during error recovery\n\n\n        # If no lexer was given, we will try to use the lex module\n        if not lexer:\n            from . import lex\n            lexer = lex.lexer\n\n        # Set up the lexer and parser objects on pslice\n        pslice.lexer = lexer\n        pslice.parser = self\n\n        # If input was supplied, pass to lexer\n        if input is not None:\n            lexer.input(input)\n\n        if tokenfunc is None:\n            # Tokenize function\n            get_token = lexer.token\n        else:\n            get_token = tokenfunc\n\n        # Set the parser() token method (sometimes used in error recovery)\n        self.token = get_token\n\n        # Set up the state and symbol stacks\n\n        statestack = []                # Stack of parsing states\n        self.statestack = statestack\n        symstack   = []                # Stack of grammar symbols\n        self.symstack = symstack\n\n        pslice.stack = symstack         # Put in the production\n        errtoken   = None               # Err token\n\n        # The start state is assumed to be (0,$end)\n\n        statestack.append(0)\n        sym = YaccSymbol()\n        sym.type = '$end'\n        symstack.append(sym)\n        state = 0\n        while True:\n            # Get the next symbol on the input.  If a lookahead symbol\n            # is already set, we just use that. Otherwise, we'll pull\n            # the next token off of the lookaheadstack or from the lexer\n\n\n            if state not in defaulted_states:\n                if not lookahead:\n                    if not lookaheadstack:\n                        lookahead = get_token()     # Get the next token\n                    else:\n                        lookahead = lookaheadstack.pop()\n                    if not lookahead:\n                        lookahead = YaccSymbol()\n                        lookahead.type = '$end'\n\n                # Check the action table\n                ltype = lookahead.type\n                t = actions[state].get(ltype)\n            else:\n                t = defaulted_states[state]\n\n\n            if t is not None:\n                if t > 0:\n                    # shift a symbol on the stack\n                    statestack.append(t)\n                    state = t\n\n\n                    symstack.append(lookahead)\n                    lookahead = None\n\n                    # Decrease error count on successful shift\n                    if errorcount:\n                        errorcount -= 1\n                    continue\n\n                if t < 0:\n                    # reduce a symbol on the stack, emit a production\n                    p = prod[-t]\n                    pname = p.name\n                    plen  = p.len\n\n                    # Get production function\n                    sym = YaccSymbol()\n                    sym.type = pname       # Production name\n                    sym.value = None\n\n\n                    if plen:\n                        targ = symstack[-plen-1:]\n                        targ[0] = sym\n\n                        #--! TRACKING\n                        if tracking:\n                            t1 = targ[1]\n                            sym.lineno = t1.lineno\n                            sym.lexpos = t1.lexpos\n                            t1 = targ[-1]\n                            sym.endlineno = getattr(t1, 'endlineno', t1.lineno)\n                            sym.endlexpos = getattr(t1, 'endlexpos', t1.lexpos)\n                        #--! TRACKING\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # below as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            del symstack[-plen:]\n                            self.state = state\n                            p.callable(pslice)\n                            del statestack[-plen:]\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            symstack.extend(targ[1:-1])         # Put the production slice back on the stack\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                    else:\n\n                        #--! TRACKING\n                        if tracking:\n                            sym.lineno = lexer.lineno\n                            sym.lexpos = lexer.lexpos\n                        #--! TRACKING\n\n                        targ = [sym]\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # above as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            self.state = state\n                            p.callable(pslice)\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                if t == 0:\n                    n = symstack[-1]\n                    result = getattr(n, 'value', None)\n                    return result\n\n            if t is None:\n\n\n                # We have some kind of parsing error here.  To handle\n                # this, we are going to push the current token onto\n                # the tokenstack and replace it with an 'error' token.\n                # If there are any synchronization rules, they may\n                # catch it.\n                #\n                # In addition to pushing the error token, we call call\n                # the user defined p_error() function if this is the\n                # first syntax error.  This function is only called if\n                # errorcount == 0.\n                if errorcount == 0 or self.errorok:\n                    errorcount = error_count\n                    self.errorok = False\n                    errtoken = lookahead\n                    if errtoken.type == '$end':\n                        errtoken = None               # End of file!\n                    if self.errorfunc:\n                        if errtoken and not hasattr(errtoken, 'lexer'):\n                            errtoken.lexer = lexer\n                        self.state = state\n                        tok = call_errorfunc(self.errorfunc, errtoken, self)\n                        if self.errorok:\n                            # User must have done some kind of panic\n                            # mode recovery on their own.  The\n                            # returned token is the next lookahead\n                            lookahead = tok\n                            errtoken = None\n                            continue\n                    else:\n                        if errtoken:\n                            if hasattr(errtoken, 'lineno'):\n                                lineno = lookahead.lineno\n                            else:\n                                lineno = 0\n                            if lineno:\n                                sys.stderr.write('yacc: Syntax error at line %d, token=%s\\n' % (lineno, errtoken.type))\n                            else:\n                                sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type)\n                        else:\n                            sys.stderr.write('yacc: Parse error in input. EOF\\n')\n                            return\n\n                else:\n                    errorcount = error_count\n\n                # case 1:  the statestack only has 1 entry on it.  If we're in this state, the\n                # entire parse has been rolled back and we're completely hosed.   The token is\n                # discarded and we just keep going.\n\n                if len(statestack) <= 1 and lookahead.type != '$end':\n                    lookahead = None\n                    errtoken = None\n                    state = 0\n                    # Nuke the pushback stack\n                    del lookaheadstack[:]\n                    continue\n\n                # case 2: the statestack has a couple of entries on it, but we're\n                # at the end of the file. nuke the top entry and generate an error token\n\n                # Start nuking entries on the stack\n                if lookahead.type == '$end':\n                    # Whoa. We're really hosed here. Bail out\n                    return\n\n                if lookahead.type != 'error':\n                    sym = symstack[-1]\n                    if sym.type == 'error':\n                        # Hmmm. Error is on top of stack, we'll just nuke input\n                        # symbol and continue\n                        #--! TRACKING\n                        if tracking:\n                            sym.endlineno = getattr(lookahead, 'lineno', sym.lineno)\n                            sym.endlexpos = getattr(lookahead, 'lexpos', sym.lexpos)\n                        #--! TRACKING\n                        lookahead = None\n                        continue\n\n                    # Create the error symbol for the first time and make it the new lookahead symbol\n                    t = YaccSymbol()\n                    t.type = 'error'\n\n                    if hasattr(lookahead, 'lineno'):\n                        t.lineno = t.endlineno = lookahead.lineno\n                    if hasattr(lookahead, 'lexpos'):\n                        t.lexpos = t.endlexpos = lookahead.lexpos\n                    t.value = lookahead\n                    lookaheadstack.append(lookahead)\n                    lookahead = t\n                else:\n                    sym = symstack.pop()\n                    #--! TRACKING\n                    if tracking:\n                        lookahead.lineno = sym.lineno\n                        lookahead.lexpos = sym.lexpos\n                    #--! TRACKING\n                    statestack.pop()\n                    state = statestack[-1]\n\n                continue\n\n            # Call an error function here\n            raise RuntimeError('yacc: internal parser error!!!\\n')\n\n        #--! parseopt-end"},{"col":4,"comment":"null","endLoc":1023,"header":"def cumprod(self, axis=None, dtype=None, out=None)","id":11468,"name":"cumprod","nodeType":"Function","startLoc":1019,"text":"def cumprod(self, axis=None, dtype=None, out=None):\n        if axis is None:\n            self = self.ravel()\n            axis = 0\n        return np.multiply.accumulate(self, axis=axis, dtype=dtype, out=out)"},{"col":4,"comment":"Return an array whose values are limited to ``[min, max]``.\n\n        Like `~numpy.clip`, but any masked values in ``min`` and ``max``\n        are ignored for clipping.  The mask of the input array is propagated.\n        ","endLoc":1044,"header":"def clip(self, min=None, max=None, out=None, **kwargs)","id":11469,"name":"clip","nodeType":"Function","startLoc":1025,"text":"def clip(self, min=None, max=None, out=None, **kwargs):\n        \"\"\"Return an array whose values are limited to ``[min, max]``.\n\n        Like `~numpy.clip`, but any masked values in ``min`` and ``max``\n        are ignored for clipping.  The mask of the input array is propagated.\n        \"\"\"\n        # TODO: implement this at the ufunc level.\n        dmin, mmin = self._get_data_and_mask(min)\n        dmax, mmax = self._get_data_and_mask(max)\n        if mmin is None and mmax is None:\n            # Fast path for unmasked max, min.\n            return super().clip(min, max, out=out, **kwargs)\n\n        masked_out = np.positive(self, out=out)\n        out = masked_out.unmasked\n        if dmin is not None:\n            np.maximum(out, dmin, out=out, where=True if mmin is None else ~mmin)\n        if dmax is not None:\n            np.minimum(out, dmax, out=out, where=True if mmax is None else ~mmax)\n        return masked_out"},{"attributeType":"function","col":4,"comment":"null","endLoc":424,"id":11470,"name":"__next__","nodeType":"Attribute","startLoc":424,"text":"__next__"},{"attributeType":"null","col":16,"comment":"null","endLoc":347,"id":11471,"name":"lexmatch","nodeType":"Attribute","startLoc":347,"text":"self.lexmatch"},{"attributeType":"null","col":8,"comment":"null","endLoc":134,"id":11472,"name":"lexlen","nodeType":"Attribute","startLoc":134,"text":"self.lexlen"},{"attributeType":"null","col":8,"comment":"null","endLoc":128,"id":11473,"name":"lexstateignore","nodeType":"Attribute","startLoc":128,"text":"self.lexstateignore"},{"attributeType":"null","col":8,"comment":"null","endLoc":133,"id":11474,"name":"lexpos","nodeType":"Attribute","startLoc":133,"text":"self.lexpos"},{"attributeType":"None","col":8,"comment":"null","endLoc":135,"id":11475,"name":"lexerrorf","nodeType":"Attribute","startLoc":135,"text":"self.lexerrorf"},{"attributeType":"None","col":8,"comment":"null","endLoc":136,"id":11476,"name":"lexeoff","nodeType":"Attribute","startLoc":136,"text":"self.lexeoff"},{"attributeType":"null","col":8,"comment":"null","endLoc":131,"id":11477,"name":"lexreflags","nodeType":"Attribute","startLoc":131,"text":"self.lexreflags"},{"attributeType":"None","col":8,"comment":"null","endLoc":132,"id":11478,"name":"lexdata","nodeType":"Attribute","startLoc":132,"text":"self.lexdata"},{"attributeType":"None","col":8,"comment":"null","endLoc":127,"id":11479,"name":"lexstateinfo","nodeType":"Attribute","startLoc":127,"text":"self.lexstateinfo"},{"attributeType":"None","col":8,"comment":"null","endLoc":121,"id":11480,"name":"lexretext","nodeType":"Attribute","startLoc":121,"text":"self.lexretext"},{"attributeType":"null","col":8,"comment":"null","endLoc":124,"id":11481,"name":"lexstaterenames","nodeType":"Attribute","startLoc":124,"text":"self.lexstaterenames"},{"attributeType":"null","col":8,"comment":"null","endLoc":123,"id":11482,"name":"lexstateretext","nodeType":"Attribute","startLoc":123,"text":"self.lexstateretext"},{"attributeType":"None","col":8,"comment":"null","endLoc":137,"id":11483,"name":"lextokens","nodeType":"Attribute","startLoc":137,"text":"self.lextokens"},{"attributeType":"null","col":8,"comment":"null","endLoc":129,"id":11484,"name":"lexstateerrorf","nodeType":"Attribute","startLoc":129,"text":"self.lexstateerrorf"},{"attributeType":"null","col":8,"comment":"null","endLoc":138,"id":11485,"name":"lexignore","nodeType":"Attribute","startLoc":138,"text":"self.lexignore"},{"attributeType":"None","col":8,"comment":"null","endLoc":140,"id":11486,"name":"lexmodule","nodeType":"Attribute","startLoc":140,"text":"self.lexmodule"},{"attributeType":"null","col":8,"comment":"null","endLoc":139,"id":11487,"name":"lexliterals","nodeType":"Attribute","startLoc":139,"text":"self.lexliterals"},{"col":4,"comment":"null","endLoc":1064,"header":"def mean(self, axis=None, dtype=None, out=None, keepdims=False)","id":11488,"name":"mean","nodeType":"Function","startLoc":1046,"text":"def mean(self, axis=None, dtype=None, out=None, keepdims=False):\n        # Implementation based on that in numpy/core/_methods.py\n        # Cast bool, unsigned int, and int to float64 by default,\n        # and do float16 at higher precision.\n        is_float16_result = False\n        if dtype is None:\n            if issubclass(self.dtype.type, (np.integer, np.bool_)):\n                dtype = np.dtype('f8')\n            elif issubclass(self.dtype.type, np.float16):\n                dtype = np.dtype('f4')\n                is_float16_result = out is None\n\n        result = self.sum(axis=axis, dtype=dtype, out=out,\n                          keepdims=keepdims, where=~self.mask)\n        n = np.add.reduce(~self.mask, axis=axis, keepdims=keepdims)\n        result /= n\n        if is_float16_result:\n            result = result.astype(self.dtype)\n        return result"},{"attributeType":"null","col":8,"comment":"null","endLoc":142,"id":11489,"name":"lexoptimize","nodeType":"Attribute","startLoc":142,"text":"self.lexoptimize"},{"attributeType":"null","col":8,"comment":"null","endLoc":126,"id":11490,"name":"lexstatestack","nodeType":"Attribute","startLoc":126,"text":"self.lexstatestack"},{"attributeType":"null","col":8,"comment":"null","endLoc":130,"id":11491,"name":"lexstateeoff","nodeType":"Attribute","startLoc":130,"text":"self.lexstateeoff"},{"attributeType":"null","col":8,"comment":"null","endLoc":122,"id":11492,"name":"lexstatere","nodeType":"Attribute","startLoc":122,"text":"self.lexstatere"},{"attributeType":"None","col":8,"comment":"null","endLoc":117,"id":11493,"name":"lexre","nodeType":"Attribute","startLoc":117,"text":"self.lexre"},{"attributeType":"null","col":8,"comment":"null","endLoc":141,"id":11494,"name":"lineno","nodeType":"Attribute","startLoc":141,"text":"self.lineno"},{"attributeType":"null","col":8,"comment":"null","endLoc":125,"id":11495,"name":"lexstate","nodeType":"Attribute","startLoc":125,"text":"self.lexstate"},{"attributeType":"null","col":8,"comment":"null","endLoc":224,"id":11496,"name":"lextokens_all","nodeType":"Attribute","startLoc":224,"text":"self.lextokens_all"},{"className":"LexerReflect","col":0,"comment":"null","endLoc":855,"id":11497,"nodeType":"Class","startLoc":557,"text":"class LexerReflect(object):\n    def __init__(self, ldict, log=None, reflags=0):\n        self.ldict      = ldict\n        self.error_func = None\n        self.tokens     = []\n        self.reflags    = reflags\n        self.stateinfo  = {'INITIAL': 'inclusive'}\n        self.modules    = set()\n        self.error      = False\n        self.log        = PlyLogger(sys.stderr) if log is None else log\n\n    # Get all of the basic information\n    def get_all(self):\n        self.get_tokens()\n        self.get_literals()\n        self.get_states()\n        self.get_rules()\n\n    # Validate all of the information\n    def validate_all(self):\n        self.validate_tokens()\n        self.validate_literals()\n        self.validate_rules()\n        return self.error\n\n    # Get the tokens map\n    def get_tokens(self):\n        tokens = self.ldict.get('tokens', None)\n        if not tokens:\n            self.log.error('No token list is defined')\n            self.error = True\n            return\n\n        if not isinstance(tokens, (list, tuple)):\n            self.log.error('tokens must be a list or tuple')\n            self.error = True\n            return\n\n        if not tokens:\n            self.log.error('tokens is empty')\n            self.error = True\n            return\n\n        self.tokens = tokens\n\n    # Validate the tokens\n    def validate_tokens(self):\n        terminals = {}\n        for n in self.tokens:\n            if not _is_identifier.match(n):\n                self.log.error(\"Bad token name '%s'\", n)\n                self.error = True\n            if n in terminals:\n                self.log.warning(\"Token '%s' multiply defined\", n)\n            terminals[n] = 1\n\n    # Get the literals specifier\n    def get_literals(self):\n        self.literals = self.ldict.get('literals', '')\n        if not self.literals:\n            self.literals = ''\n\n    # Validate literals\n    def validate_literals(self):\n        try:\n            for c in self.literals:\n                if not isinstance(c, StringTypes) or len(c) > 1:\n                    self.log.error('Invalid literal %s. Must be a single character', repr(c))\n                    self.error = True\n\n        except TypeError:\n            self.log.error('Invalid literals specification. literals must be a sequence of characters')\n            self.error = True\n\n    def get_states(self):\n        self.states = self.ldict.get('states', None)\n        # Build statemap\n        if self.states:\n            if not isinstance(self.states, (tuple, list)):\n                self.log.error('states must be defined as a tuple or list')\n                self.error = True\n            else:\n                for s in self.states:\n                    if not isinstance(s, tuple) or len(s) != 2:\n                        self.log.error(\"Invalid state specifier %s. Must be a tuple (statename,'exclusive|inclusive')\", repr(s))\n                        self.error = True\n                        continue\n                    name, statetype = s\n                    if not isinstance(name, StringTypes):\n                        self.log.error('State name %s must be a string', repr(name))\n                        self.error = True\n                        continue\n                    if not (statetype == 'inclusive' or statetype == 'exclusive'):\n                        self.log.error(\"State type for state %s must be 'inclusive' or 'exclusive'\", name)\n                        self.error = True\n                        continue\n                    if name in self.stateinfo:\n                        self.log.error(\"State '%s' already defined\", name)\n                        self.error = True\n                        continue\n                    self.stateinfo[name] = statetype\n\n    # Get all of the symbols with a t_ prefix and sort them into various\n    # categories (functions, strings, error functions, and ignore characters)\n\n    def get_rules(self):\n        tsymbols = [f for f in self.ldict if f[:2] == 't_']\n\n        # Now build up a list of functions and a list of strings\n        self.toknames = {}        # Mapping of symbols to token names\n        self.funcsym  = {}        # Symbols defined as functions\n        self.strsym   = {}        # Symbols defined as strings\n        self.ignore   = {}        # Ignore strings by state\n        self.errorf   = {}        # Error functions by state\n        self.eoff     = {}        # EOF functions by state\n\n        for s in self.stateinfo:\n            self.funcsym[s] = []\n            self.strsym[s] = []\n\n        if len(tsymbols) == 0:\n            self.log.error('No rules of the form t_rulename are defined')\n            self.error = True\n            return\n\n        for f in tsymbols:\n            t = self.ldict[f]\n            states, tokname = _statetoken(f, self.stateinfo)\n            self.toknames[f] = tokname\n\n            if hasattr(t, '__call__'):\n                if tokname == 'error':\n                    for s in states:\n                        self.errorf[s] = t\n                elif tokname == 'eof':\n                    for s in states:\n                        self.eoff[s] = t\n                elif tokname == 'ignore':\n                    line = t.__code__.co_firstlineno\n                    file = t.__code__.co_filename\n                    self.log.error(\"%s:%d: Rule '%s' must be defined as a string\", file, line, t.__name__)\n                    self.error = True\n                else:\n                    for s in states:\n                        self.funcsym[s].append((f, t))\n            elif isinstance(t, StringTypes):\n                if tokname == 'ignore':\n                    for s in states:\n                        self.ignore[s] = t\n                    if '\\\\' in t:\n                        self.log.warning(\"%s contains a literal backslash '\\\\'\", f)\n\n                elif tokname == 'error':\n                    self.log.error(\"Rule '%s' must be defined as a function\", f)\n                    self.error = True\n                else:\n                    for s in states:\n                        self.strsym[s].append((f, t))\n            else:\n                self.log.error('%s not defined as a function or string', f)\n                self.error = True\n\n        # Sort the functions by line number\n        for f in self.funcsym.values():\n            f.sort(key=lambda x: x[1].__code__.co_firstlineno)\n\n        # Sort the strings by regular expression length\n        for s in self.strsym.values():\n            s.sort(key=lambda x: len(x[1]), reverse=True)\n\n    # Validate all of the t_rules collected\n    def validate_rules(self):\n        for state in self.stateinfo:\n            # Validate all rules defined by functions\n\n            for fname, f in self.funcsym[state]:\n                line = f.__code__.co_firstlineno\n                file = f.__code__.co_filename\n                module = inspect.getmodule(f)\n                self.modules.add(module)\n\n                tokname = self.toknames[fname]\n                if isinstance(f, types.MethodType):\n                    reqargs = 2\n                else:\n                    reqargs = 1\n                nargs = f.__code__.co_argcount\n                if nargs > reqargs:\n                    self.log.error(\"%s:%d: Rule '%s' has too many arguments\", file, line, f.__name__)\n                    self.error = True\n                    continue\n\n                if nargs < reqargs:\n                    self.log.error(\"%s:%d: Rule '%s' requires an argument\", file, line, f.__name__)\n                    self.error = True\n                    continue\n\n                if not _get_regex(f):\n                    self.log.error(\"%s:%d: No regular expression defined for rule '%s'\", file, line, f.__name__)\n                    self.error = True\n                    continue\n\n                try:\n                    c = re.compile('(?P<%s>%s)' % (fname, _get_regex(f)), self.reflags)\n                    if c.match(''):\n                        self.log.error(\"%s:%d: Regular expression for rule '%s' matches empty string\", file, line, f.__name__)\n                        self.error = True\n                except re.error as e:\n                    self.log.error(\"%s:%d: Invalid regular expression for rule '%s'. %s\", file, line, f.__name__, e)\n                    if '#' in _get_regex(f):\n                        self.log.error(\"%s:%d. Make sure '#' in rule '%s' is escaped with '\\\\#'\", file, line, f.__name__)\n                    self.error = True\n\n            # Validate all rules defined by strings\n            for name, r in self.strsym[state]:\n                tokname = self.toknames[name]\n                if tokname == 'error':\n                    self.log.error(\"Rule '%s' must be defined as a function\", name)\n                    self.error = True\n                    continue\n\n                if tokname not in self.tokens and tokname.find('ignore_') < 0:\n                    self.log.error(\"Rule '%s' defined for an unspecified token %s\", name, tokname)\n                    self.error = True\n                    continue\n\n                try:\n                    c = re.compile('(?P<%s>%s)' % (name, r), self.reflags)\n                    if (c.match('')):\n                        self.log.error(\"Regular expression for rule '%s' matches empty string\", name)\n                        self.error = True\n                except re.error as e:\n                    self.log.error(\"Invalid regular expression for rule '%s'. %s\", name, e)\n                    if '#' in r:\n                        self.log.error(\"Make sure '#' in rule '%s' is escaped with '\\\\#'\", name)\n                    self.error = True\n\n            if not self.funcsym[state] and not self.strsym[state]:\n                self.log.error(\"No rules defined for state '%s'\", state)\n                self.error = True\n\n            # Validate the error function\n            efunc = self.errorf.get(state, None)\n            if efunc:\n                f = efunc\n                line = f.__code__.co_firstlineno\n                file = f.__code__.co_filename\n                module = inspect.getmodule(f)\n                self.modules.add(module)\n\n                if isinstance(f, types.MethodType):\n                    reqargs = 2\n                else:\n                    reqargs = 1\n                nargs = f.__code__.co_argcount\n                if nargs > reqargs:\n                    self.log.error(\"%s:%d: Rule '%s' has too many arguments\", file, line, f.__name__)\n                    self.error = True\n\n                if nargs < reqargs:\n                    self.log.error(\"%s:%d: Rule '%s' requires an argument\", file, line, f.__name__)\n                    self.error = True\n\n        for module in self.modules:\n            self.validate_module(module)\n\n    # -----------------------------------------------------------------------------\n    # validate_module()\n    #\n    # This checks to see if there are duplicated t_rulename() functions or strings\n    # in the parser input file.  This is done using a simple regular expression\n    # match on each line in the source code of the given module.\n    # -----------------------------------------------------------------------------\n\n    def validate_module(self, module):\n        try:\n            lines, linen = inspect.getsourcelines(module)\n        except IOError:\n            return\n\n        fre = re.compile(r'\\s*def\\s+(t_[a-zA-Z_0-9]*)\\(')\n        sre = re.compile(r'\\s*(t_[a-zA-Z_0-9]*)\\s*=')\n\n        counthash = {}\n        linen += 1\n        for line in lines:\n            m = fre.match(line)\n            if not m:\n                m = sre.match(line)\n            if m:\n                name = m.group(1)\n                prev = counthash.get(name)\n                if not prev:\n                    counthash[name] = linen\n                else:\n                    filename = inspect.getsourcefile(module)\n                    self.log.error('%s:%d: Rule %s redefined. Previously defined on line %d', filename, linen, name, prev)\n                    self.error = True\n            linen += 1"},{"col":4,"comment":"null","endLoc":1085,"header":"def var(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False)","id":11498,"name":"var","nodeType":"Function","startLoc":1066,"text":"def var(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False):\n        # Simplified implementation based on that in numpy/core/_methods.py\n        n = np.add.reduce(~self.mask, axis=axis, keepdims=keepdims)[...]\n\n        # Cast bool, unsigned int, and int to float64 by default.\n        if dtype is None and issubclass(self.dtype.type,\n                                        (np.integer, np.bool_)):\n            dtype = np.dtype('f8')\n        mean = self.mean(axis=axis, dtype=dtype, keepdims=True)\n\n        x = self - mean\n        x *= x.conjugate()  # Conjugate just returns x if not complex.\n\n        result = x.sum(axis=axis, dtype=dtype, out=out,\n                       keepdims=keepdims, where=~x.mask)\n        n -= ddof\n        n = np.maximum(n, 0, out=n)\n        result /= n\n        result._mask |= (n == 0)\n        return result"},{"col":4,"comment":"null","endLoc":573,"header":"def get_all(self)","id":11499,"name":"get_all","nodeType":"Function","startLoc":569,"text":"def get_all(self):\n        self.get_tokens()\n        self.get_literals()\n        self.get_states()\n        self.get_rules()"},{"col":4,"comment":"null","endLoc":600,"header":"def get_tokens(self)","id":11500,"name":"get_tokens","nodeType":"Function","startLoc":583,"text":"def get_tokens(self):\n        tokens = self.ldict.get('tokens', None)\n        if not tokens:\n            self.log.error('No token list is defined')\n            self.error = True\n            return\n\n        if not isinstance(tokens, (list, tuple)):\n            self.log.error('tokens must be a list or tuple')\n            self.error = True\n            return\n\n        if not tokens:\n            self.log.error('tokens is empty')\n            self.error = True\n            return\n\n        self.tokens = tokens"},{"col":4,"comment":"null","endLoc":1090,"header":"def std(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False)","id":11501,"name":"std","nodeType":"Function","startLoc":1087,"text":"def std(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False):\n        result = self.var(axis=axis, dtype=dtype, out=out, ddof=ddof,\n                          keepdims=keepdims)\n        return np.sqrt(result, out=result)"},{"col":43,"endLoc":650,"id":11502,"nodeType":"Lambda","startLoc":650,"text":"lambda x: x.__module__"},{"col":4,"comment":"null","endLoc":323,"header":"def tokenstrip(self,tokens)","id":11503,"name":"tokenstrip","nodeType":"Function","startLoc":314,"text":"def tokenstrip(self,tokens):\n        i = 0\n        while i < len(tokens) and tokens[i].type in self.t_WS:\n            i += 1\n        del tokens[:i]\n        i = len(tokens)-1\n        while i >= 0 and tokens[i].type in self.t_WS:\n            i -= 1\n        del tokens[i+1:]\n        return tokens"},{"col":4,"comment":"null","endLoc":617,"header":"def get_literals(self)","id":11504,"name":"get_literals","nodeType":"Function","startLoc":614,"text":"def get_literals(self):\n        self.literals = self.ldict.get('literals', '')\n        if not self.literals:\n            self.literals = ''"},{"col":4,"comment":"null","endLoc":657,"header":"def get_states(self)","id":11505,"name":"get_states","nodeType":"Function","startLoc":631,"text":"def get_states(self):\n        self.states = self.ldict.get('states', None)\n        # Build statemap\n        if self.states:\n            if not isinstance(self.states, (tuple, list)):\n                self.log.error('states must be defined as a tuple or list')\n                self.error = True\n            else:\n                for s in self.states:\n                    if not isinstance(s, tuple) or len(s) != 2:\n                        self.log.error(\"Invalid state specifier %s. Must be a tuple (statename,'exclusive|inclusive')\", repr(s))\n                        self.error = True\n                        continue\n                    name, statetype = s\n                    if not isinstance(name, StringTypes):\n                        self.log.error('State name %s must be a string', repr(name))\n                        self.error = True\n                        continue\n                    if not (statetype == 'inclusive' or statetype == 'exclusive'):\n                        self.log.error(\"State type for state %s must be 'inclusive' or 'exclusive'\", name)\n                        self.error = True\n                        continue\n                    if name in self.stateinfo:\n                        self.log.error(\"State '%s' already defined\", name)\n                        self.error = True\n                        continue\n                    self.stateinfo[name] = statetype"},{"col":4,"comment":"null","endLoc":1095,"header":"def __bool__(self)","id":11506,"name":"__bool__","nodeType":"Function","startLoc":1092,"text":"def __bool__(self):\n        # First get result from array itself; this will error if not a scalar.\n        result = super().__bool__()\n        return result and not self.mask"},{"col":4,"comment":"null","endLoc":1099,"header":"def any(self, axis=None, out=None, keepdims=False)","id":11507,"name":"any","nodeType":"Function","startLoc":1097,"text":"def any(self, axis=None, out=None, keepdims=False):\n        return np.logical_or.reduce(self, axis=axis, out=out,\n                                    keepdims=keepdims, where=~self.mask)"},{"col":4,"comment":"null","endLoc":1103,"header":"def all(self, axis=None, out=None, keepdims=False)","id":11508,"name":"all","nodeType":"Function","startLoc":1101,"text":"def all(self, axis=None, out=None, keepdims=False):\n        return np.logical_and.reduce(self, axis=axis, out=out,\n                                     keepdims=keepdims, where=~self.mask)"},{"col":4,"comment":"null","endLoc":1108,"header":"def __str__(self)","id":11509,"name":"__str__","nodeType":"Function","startLoc":1107,"text":"def __str__(self):\n        return np.array_str(self)"},{"col":4,"comment":"null","endLoc":1111,"header":"def __repr__(self)","id":11510,"name":"__repr__","nodeType":"Function","startLoc":1110,"text":"def __repr__(self):\n        return np.array_repr(self)"},{"col":4,"comment":"null","endLoc":1119,"header":"def __format__(self, format_spec)","id":11511,"name":"__format__","nodeType":"Function","startLoc":1113,"text":"def __format__(self, format_spec):\n        string = super().__format__(format_spec)\n        if self.shape == () and self.mask:\n            n = min(3, max(1, len(string)))\n            return ' ' * (len(string)-n) + '\\u2014' * n\n        else:\n            return string"},{"attributeType":"None","col":4,"comment":"null","endLoc":454,"id":11512,"name":"_mask","nodeType":"Attribute","startLoc":454,"text":"_mask"},{"attributeType":"MaskedNDArrayInfo","col":4,"comment":"null","endLoc":456,"id":11513,"name":"info","nodeType":"Attribute","startLoc":456,"text":"info"},{"col":4,"comment":"null","endLoc":725,"header":"def get_rules(self)","id":11514,"name":"get_rules","nodeType":"Function","startLoc":662,"text":"def get_rules(self):\n        tsymbols = [f for f in self.ldict if f[:2] == 't_']\n\n        # Now build up a list of functions and a list of strings\n        self.toknames = {}        # Mapping of symbols to token names\n        self.funcsym  = {}        # Symbols defined as functions\n        self.strsym   = {}        # Symbols defined as strings\n        self.ignore   = {}        # Ignore strings by state\n        self.errorf   = {}        # Error functions by state\n        self.eoff     = {}        # EOF functions by state\n\n        for s in self.stateinfo:\n            self.funcsym[s] = []\n            self.strsym[s] = []\n\n        if len(tsymbols) == 0:\n            self.log.error('No rules of the form t_rulename are defined')\n            self.error = True\n            return\n\n        for f in tsymbols:\n            t = self.ldict[f]\n            states, tokname = _statetoken(f, self.stateinfo)\n            self.toknames[f] = tokname\n\n            if hasattr(t, '__call__'):\n                if tokname == 'error':\n                    for s in states:\n                        self.errorf[s] = t\n                elif tokname == 'eof':\n                    for s in states:\n                        self.eoff[s] = t\n                elif tokname == 'ignore':\n                    line = t.__code__.co_firstlineno\n                    file = t.__code__.co_filename\n                    self.log.error(\"%s:%d: Rule '%s' must be defined as a string\", file, line, t.__name__)\n                    self.error = True\n                else:\n                    for s in states:\n                        self.funcsym[s].append((f, t))\n            elif isinstance(t, StringTypes):\n                if tokname == 'ignore':\n                    for s in states:\n                        self.ignore[s] = t\n                    if '\\\\' in t:\n                        self.log.warning(\"%s contains a literal backslash '\\\\'\", f)\n\n                elif tokname == 'error':\n                    self.log.error(\"Rule '%s' must be defined as a function\", f)\n                    self.error = True\n                else:\n                    for s in states:\n                        self.strsym[s].append((f, t))\n            else:\n                self.log.error('%s not defined as a function or string', f)\n                self.error = True\n\n        # Sort the functions by line number\n        for f in self.funcsym.values():\n            f.sort(key=lambda x: x[1].__code__.co_firstlineno)\n\n        # Sort the strings by regular expression length\n        for s in self.strsym.values():\n            s.sort(key=lambda x: len(x[1]), reverse=True)"},{"attributeType":"function","col":4,"comment":"null","endLoc":619,"id":11515,"name":"_eq_simple","nodeType":"Attribute","startLoc":619,"text":"_eq_simple"},{"attributeType":"function","col":4,"comment":"null","endLoc":620,"id":11516,"name":"_ne_simple","nodeType":"Attribute","startLoc":620,"text":"_ne_simple"},{"attributeType":"function","col":4,"comment":"null","endLoc":621,"id":11517,"name":"__lt__","nodeType":"Attribute","startLoc":621,"text":"__lt__"},{"col":0,"comment":"\n    Determines if a config file can be safely replaced because it doesn't\n    actually contain any meaningful content, i.e. if it contains only comments\n    or is completely empty.\n    ","endLoc":721,"header":"def is_unedited_config_file(content, template_content=None)","id":11518,"name":"is_unedited_config_file","nodeType":"Function","startLoc":712,"text":"def is_unedited_config_file(content, template_content=None):\n    \"\"\"\n    Determines if a config file can be safely replaced because it doesn't\n    actually contain any meaningful content, i.e. if it contains only comments\n    or is completely empty.\n    \"\"\"\n    buffer = io.StringIO(content)\n    raw_cfg = configobj.ConfigObj(buffer, interpolation=True)\n    # If any of the items is set, return False\n    return not any(len(v) > 0 for v in raw_cfg.values())"},{"attributeType":"function","col":4,"comment":"null","endLoc":622,"id":11519,"name":"__le__","nodeType":"Attribute","startLoc":622,"text":"__le__"},{"col":4,"comment":"null","endLoc":385,"header":"def collect_args(self,tokenlist)","id":11520,"name":"collect_args","nodeType":"Function","startLoc":342,"text":"def collect_args(self,tokenlist):\n        args = []\n        positions = []\n        current_arg = []\n        nesting = 1\n        tokenlen = len(tokenlist)\n\n        # Search for the opening '('.\n        i = 0\n        while (i < tokenlen) and (tokenlist[i].type in self.t_WS):\n            i += 1\n\n        if (i < tokenlen) and (tokenlist[i].value == '('):\n            positions.append(i+1)\n        else:\n            self.error(self.source,tokenlist[0].lineno,\"Missing '(' in macro arguments\")\n            return 0, [], []\n\n        i += 1\n\n        while i < tokenlen:\n            t = tokenlist[i]\n            if t.value == '(':\n                current_arg.append(t)\n                nesting += 1\n            elif t.value == ')':\n                nesting -= 1\n                if nesting == 0:\n                    if current_arg:\n                        args.append(self.tokenstrip(current_arg))\n                        positions.append(i)\n                    return i+1,args,positions\n                current_arg.append(t)\n            elif t.value == ',' and nesting == 1:\n                args.append(self.tokenstrip(current_arg))\n                positions.append(i+1)\n                current_arg = []\n            else:\n                current_arg.append(t)\n            i += 1\n\n        # Missing end argument\n        self.error(self.source,tokenlist[-1].lineno,\"Missing ')' in macro arguments\")\n        return 0, [],[]"},{"col":4,"comment":"D.values() -> list of D's values","endLoc":719,"header":"def values(self)","id":11521,"name":"values","nodeType":"Function","startLoc":717,"text":"def values(self):\n        \"\"\"D.values() -> list of D's values\"\"\"\n        return [self[key] for key in (self.scalars + self.sections)]"},{"col":0,"comment":"\n    Checks if the configuration file for the specified package exists,\n    and if not, copy over the default configuration.  If the\n    configuration file looks like it has already been edited, we do\n    not write over it, but instead write a file alongside it named\n    ``pkg.version.cfg`` as a \"template\" for the user.\n\n    Parameters\n    ----------\n    pkg : str\n        The package to be updated.\n    default_cfg_dir_or_fn : str\n        The filename or directory name where the default configuration file is.\n        If a directory name, ``'pkg.cfg'`` will be used in that directory.\n    version : str, optional\n        The current version of the given package.  If not provided, it will\n        be obtained from ``pkg.__version__``.\n    rootname : str\n        Name of the root configuration directory.\n\n    Returns\n    -------\n    updated : bool\n        If the profile was updated, `True`, otherwise `False`.\n\n    Raises\n    ------\n    AttributeError\n        If the version number of the package could not determined.\n\n    ","endLoc":826,"header":"@deprecated('5.0')\ndef update_default_config(pkg, default_cfg_dir_or_fn, version=None, rootname='astropy')","id":11522,"name":"update_default_config","nodeType":"Function","startLoc":728,"text":"@deprecated('5.0')\ndef update_default_config(pkg, default_cfg_dir_or_fn, version=None, rootname='astropy'):\n    \"\"\"\n    Checks if the configuration file for the specified package exists,\n    and if not, copy over the default configuration.  If the\n    configuration file looks like it has already been edited, we do\n    not write over it, but instead write a file alongside it named\n    ``pkg.version.cfg`` as a \"template\" for the user.\n\n    Parameters\n    ----------\n    pkg : str\n        The package to be updated.\n    default_cfg_dir_or_fn : str\n        The filename or directory name where the default configuration file is.\n        If a directory name, ``'pkg.cfg'`` will be used in that directory.\n    version : str, optional\n        The current version of the given package.  If not provided, it will\n        be obtained from ``pkg.__version__``.\n    rootname : str\n        Name of the root configuration directory.\n\n    Returns\n    -------\n    updated : bool\n        If the profile was updated, `True`, otherwise `False`.\n\n    Raises\n    ------\n    AttributeError\n        If the version number of the package could not determined.\n\n    \"\"\"\n\n    if path.isdir(default_cfg_dir_or_fn):\n        default_cfgfn = path.join(default_cfg_dir_or_fn, pkg + '.cfg')\n    else:\n        default_cfgfn = default_cfg_dir_or_fn\n\n    if not path.isfile(default_cfgfn):\n        # There is no template configuration file, which basically\n        # means the affiliated package is not using the configuration\n        # system, so just return.\n        return False\n\n    cfgfn = get_config(pkg, rootname=rootname).filename\n\n    with open(default_cfgfn, 'rt', encoding='latin-1') as fr:\n        template_content = fr.read()\n\n    doupdate = False\n    if cfgfn is not None:\n        if path.exists(cfgfn):\n            with open(cfgfn, 'rt', encoding='latin-1') as fd:\n                content = fd.read()\n\n            identical = (content == template_content)\n\n            if not identical:\n                doupdate = is_unedited_config_file(\n                    content, template_content)\n        elif path.exists(path.dirname(cfgfn)):\n            doupdate = True\n            identical = False\n\n    if version is None:\n        version = resolve_name(pkg, '__version__')\n\n    # Don't install template files for dev versions, or we'll end up\n    # spamming `~/.astropy/config`.\n    if version and 'dev' not in version and cfgfn is not None:\n        template_path = path.join(\n            get_config_dir(rootname=rootname), f'{pkg}.{version}.cfg')\n        needs_template = not path.exists(template_path)\n    else:\n        needs_template = False\n\n    if doupdate or needs_template:\n        if needs_template:\n            with open(template_path, 'wt', encoding='latin-1') as fw:\n                fw.write(template_content)\n            # If we just installed a new template file and we can't\n            # update the main configuration file because it has user\n            # changes, display a warning.\n            if not identical and not doupdate:\n                warn(\n                    \"The configuration options in {} {} may have changed, \"\n                    \"your configuration file was not updated in order to \"\n                    \"preserve local changes.  A new configuration template \"\n                    \"has been saved to '{}'.\".format(\n                        pkg, version, template_path),\n                    ConfigurationChangedWarning)\n\n        if doupdate and not identical:\n            with open(cfgfn, 'wt', encoding='latin-1') as fw:\n                fw.write(template_content)\n            return True\n\n    return False"},{"col":4,"comment":"null","endLoc":198,"header":"def error(self,file,line,msg)","id":11523,"name":"error","nodeType":"Function","startLoc":197,"text":"def error(self,file,line,msg):\n        print(\"%s:%d %s\" % (file,line,msg))"},{"col":0,"comment":"null","endLoc":548,"header":"def _statetoken(s, names)","id":11524,"name":"_statetoken","nodeType":"Function","startLoc":533,"text":"def _statetoken(s, names):\n    parts = s.split('_')\n    for i, part in enumerate(parts[1:], 1):\n        if part not in names and part != 'ANY':\n            break\n\n    if i > 1:\n        states = tuple(parts[1:i])\n    else:\n        states = ('INITIAL',)\n\n    if 'ANY' in states:\n        states = tuple(names)\n\n    tokenname = '_'.join(parts[i:])\n    return (states, tokenname)"},{"attributeType":"function","col":4,"comment":"null","endLoc":623,"id":11525,"name":"__gt__","nodeType":"Attribute","startLoc":623,"text":"__gt__"},{"col":0,"comment":"\n    Create the default configuration file for the specified package.\n    If the file already exists, it is updated only if it has not been\n    modified.  Otherwise the ``overwrite`` flag is needed to overwrite it.\n\n    Parameters\n    ----------\n    pkg : str\n        The package to be updated.\n    rootname : str\n        Name of the root configuration directory.\n    overwrite : bool\n        Force updating the file if it already exists.\n\n    Returns\n    -------\n    updated : bool\n        If the profile was updated, `True`, otherwise `False`.\n\n    ","endLoc":882,"header":"def create_config_file(pkg, rootname='astropy', overwrite=False)","id":11526,"name":"create_config_file","nodeType":"Function","startLoc":829,"text":"def create_config_file(pkg, rootname='astropy', overwrite=False):\n    \"\"\"\n    Create the default configuration file for the specified package.\n    If the file already exists, it is updated only if it has not been\n    modified.  Otherwise the ``overwrite`` flag is needed to overwrite it.\n\n    Parameters\n    ----------\n    pkg : str\n        The package to be updated.\n    rootname : str\n        Name of the root configuration directory.\n    overwrite : bool\n        Force updating the file if it already exists.\n\n    Returns\n    -------\n    updated : bool\n        If the profile was updated, `True`, otherwise `False`.\n\n    \"\"\"\n\n    # local import to prevent using the logger before it is configured\n    from astropy.logger import log\n\n    cfgfn = get_config_filename(pkg, rootname=rootname)\n\n    # generate the default config template\n    template_content = io.StringIO()\n    generate_config(pkg, template_content)\n    template_content.seek(0)\n    template_content = template_content.read()\n\n    doupdate = True\n\n    # if the file already exists, check that it has not been modified\n    if cfgfn is not None and path.exists(cfgfn):\n        with open(cfgfn, 'rt', encoding='latin-1') as fd:\n            content = fd.read()\n\n        doupdate = is_unedited_config_file(content, template_content)\n\n    if doupdate or overwrite:\n        with open(cfgfn, 'wt', encoding='latin-1') as fw:\n            fw.write(template_content)\n        log.info('The configuration file has been successfully written '\n                 f'to {cfgfn}')\n        return True\n    elif not doupdate:\n        log.warning('The configuration file already exists and seems to '\n                    'have been customized, so it has not been updated. '\n                    'Use overwrite=True if you really want to update it.')\n\n    return False"},{"attributeType":"function","col":4,"comment":"null","endLoc":624,"id":11527,"name":"__ge__","nodeType":"Attribute","startLoc":624,"text":"__ge__"},{"attributeType":"MaskedNDArray","col":8,"comment":"null","endLoc":460,"id":11528,"name":"self","nodeType":"Attribute","startLoc":460,"text":"self"},{"attributeType":"function","col":12,"comment":"null","endLoc":481,"id":11529,"name":"__new__","nodeType":"Attribute","startLoc":481,"text":"cls.__new__"},{"attributeType":"null","col":12,"comment":"null","endLoc":464,"id":11530,"name":"mask","nodeType":"Attribute","startLoc":464,"text":"self.mask"},{"attributeType":"null","col":12,"comment":"null","endLoc":489,"id":11531,"name":"info","nodeType":"Attribute","startLoc":489,"text":"cls.info"},{"className":"MaskedRecarray","col":0,"comment":"null","endLoc":1148,"id":11532,"nodeType":"Class","startLoc":1122,"text":"class MaskedRecarray(np.recarray, MaskedNDArray, data_cls=np.recarray):\n    # Explicit definition since we need to override some methods.\n\n    def __array_finalize__(self, obj):\n        # recarray.__array_finalize__ does not do super, so we do it\n        # explicitly.\n        super().__array_finalize__(obj)\n        super(np.recarray, self).__array_finalize__(obj)\n\n    # __getattribute__, __setattr__, and field use these somewhat\n    # obscrure ndarray methods.  TODO: override in MaskedNDArray?\n    def getfield(self, dtype, offset=0):\n        for field, info in self.dtype.fields.items():\n            if offset == info[1] and dtype == info[0]:\n                return self[field]\n\n        raise NotImplementedError('can only get existing field from '\n                                  'structured dtype.')\n\n    def setfield(self, val, dtype, offset=0):\n        for field, info in self.dtype.fields.items():\n            if offset == info[1] and dtype == info[0]:\n                self[field] = val\n                return\n\n        raise NotImplementedError('can only set existing field from '\n                                  'structured dtype.')"},{"col":4,"comment":"null","endLoc":1129,"header":"def __array_finalize__(self, obj)","id":11533,"name":"__array_finalize__","nodeType":"Function","startLoc":1125,"text":"def __array_finalize__(self, obj):\n        # recarray.__array_finalize__ does not do super, so we do it\n        # explicitly.\n        super().__array_finalize__(obj)\n        super(np.recarray, self).__array_finalize__(obj)"},{"attributeType":"null","col":4,"comment":"null","endLoc":545,"id":11534,"name":"_func_re","nodeType":"Attribute","startLoc":545,"text":"_func_re"},{"attributeType":"null","col":4,"comment":"null","endLoc":548,"id":11535,"name":"_key_arg","nodeType":"Attribute","startLoc":548,"text":"_key_arg"},{"attributeType":"null","col":4,"comment":"null","endLoc":552,"id":11536,"name":"_list_arg","nodeType":"Attribute","startLoc":552,"text":"_list_arg"},{"attributeType":"null","col":4,"comment":"null","endLoc":555,"id":11537,"name":"_list_members","nodeType":"Attribute","startLoc":555,"text":"_list_members"},{"attributeType":"null","col":4,"comment":"null","endLoc":559,"id":11538,"name":"_paramfinder","nodeType":"Attribute","startLoc":559,"text":"_paramfinder"},{"attributeType":"null","col":4,"comment":"null","endLoc":560,"id":11539,"name":"_matchfinder","nodeType":"Attribute","startLoc":560,"text":"_matchfinder"},{"attributeType":"null","col":8,"comment":"null","endLoc":567,"id":11540,"name":"functions","nodeType":"Attribute","startLoc":567,"text":"self.functions"},{"attributeType":"null","col":8,"comment":"null","endLoc":590,"id":11541,"name":"_cache","nodeType":"Attribute","startLoc":590,"text":"self._cache"},{"attributeType":"ValidateError","col":8,"comment":"null","endLoc":589,"id":11542,"name":"baseErrorClass","nodeType":"Attribute","startLoc":589,"text":"self.baseErrorClass"},{"col":4,"comment":"null","endLoc":1139,"header":"def getfield(self, dtype, offset=0)","id":11543,"name":"getfield","nodeType":"Function","startLoc":1133,"text":"def getfield(self, dtype, offset=0):\n        for field, info in self.dtype.fields.items():\n            if offset == info[1] and dtype == info[0]:\n                return self[field]\n\n        raise NotImplementedError('can only get existing field from '\n                                  'structured dtype.')"},{"col":0,"comment":"\n    Convert decimal dotted quad string to long integer\n\n    >>> int(dottedQuadToNum('1 '))\n    1\n    >>> int(dottedQuadToNum(' 1.2'))\n    16777218\n    >>> int(dottedQuadToNum(' 1.2.3 '))\n    16908291\n    >>> int(dottedQuadToNum('1.2.3.4'))\n    16909060\n    >>> dottedQuadToNum('255.255.255.255')\n    4294967295\n    >>> dottedQuadToNum('255.255.255.256')\n    Traceback (most recent call last):\n    ValueError: Not a good dotted-quad IP: 255.255.255.256\n    ","endLoc":301,"header":"def dottedQuadToNum(ip)","id":11544,"name":"dottedQuadToNum","nodeType":"Function","startLoc":274,"text":"def dottedQuadToNum(ip):\n    \"\"\"\n    Convert decimal dotted quad string to long integer\n\n    >>> int(dottedQuadToNum('1 '))\n    1\n    >>> int(dottedQuadToNum(' 1.2'))\n    16777218\n    >>> int(dottedQuadToNum(' 1.2.3 '))\n    16908291\n    >>> int(dottedQuadToNum('1.2.3.4'))\n    16909060\n    >>> dottedQuadToNum('255.255.255.255')\n    4294967295\n    >>> dottedQuadToNum('255.255.255.256')\n    Traceback (most recent call last):\n    ValueError: Not a good dotted-quad IP: 255.255.255.256\n    \"\"\"\n\n    # import here to avoid it when ip_addr values are not used\n    import socket, struct\n\n    try:\n        return struct.unpack('!L',\n            socket.inet_aton(ip.strip()))[0]\n    except socket.error:\n        raise ValueError('Not a good dotted-quad IP: %s' % ip)\n    return"},{"col":4,"comment":"null","endLoc":429,"header":"def macro_prescan(self,macro)","id":11545,"name":"macro_prescan","nodeType":"Function","startLoc":395,"text":"def macro_prescan(self,macro):\n        macro.patch     = []             # Standard macro arguments\n        macro.str_patch = []             # String conversion expansion\n        macro.var_comma_patch = []       # Variadic macro comma patch\n        i = 0\n        while i < len(macro.value):\n            if macro.value[i].type == self.t_ID and macro.value[i].value in macro.arglist:\n                argnum = macro.arglist.index(macro.value[i].value)\n                # Conversion of argument to a string\n                if i > 0 and macro.value[i-1].value == '#':\n                    macro.value[i] = copy.copy(macro.value[i])\n                    macro.value[i].type = self.t_STRING\n                    del macro.value[i-1]\n                    macro.str_patch.append((argnum,i-1))\n                    continue\n                # Concatenation\n                elif (i > 0 and macro.value[i-1].value == '##'):\n                    macro.patch.append(('c',argnum,i-1))\n                    del macro.value[i-1]\n                    i -= 1\n                    continue\n                elif ((i+1) < len(macro.value) and macro.value[i+1].value == '##'):\n                    macro.patch.append(('c',argnum,i))\n                    del macro.value[i + 1]\n                    continue\n                # Standard expansion\n                else:\n                    macro.patch.append(('e',argnum,i))\n            elif macro.value[i].value == '##':\n                if macro.variadic and (i > 0) and (macro.value[i-1].value == ',') and \\\n                        ((i+1) < len(macro.value)) and (macro.value[i+1].type == self.t_ID) and \\\n                        (macro.value[i+1].value == macro.vararg):\n                    macro.var_comma_patch.append(i-1)\n            i += 1\n        macro.patch.sort(key=lambda x: x[2],reverse=True)"},{"col":0,"comment":"\n    Convert int or long int to dotted quad string\n\n    >>> numToDottedQuad(long(-1))\n    Traceback (most recent call last):\n    ValueError: Not a good numeric IP: -1\n    >>> numToDottedQuad(long(1))\n    '0.0.0.1'\n    >>> numToDottedQuad(long(16777218))\n    '1.0.0.2'\n    >>> numToDottedQuad(long(16908291))\n    '1.2.0.3'\n    >>> numToDottedQuad(long(16909060))\n    '1.2.3.4'\n    >>> numToDottedQuad(long(4294967295))\n    '255.255.255.255'\n    >>> numToDottedQuad(long(4294967296))\n    Traceback (most recent call last):\n    ValueError: Not a good numeric IP: 4294967296\n    >>> numToDottedQuad(-1)\n    Traceback (most recent call last):\n    ValueError: Not a good numeric IP: -1\n    >>> numToDottedQuad(1)\n    '0.0.0.1'\n    >>> numToDottedQuad(16777218)\n    '1.0.0.2'\n    >>> numToDottedQuad(16908291)\n    '1.2.0.3'\n    >>> numToDottedQuad(16909060)\n    '1.2.3.4'\n    >>> numToDottedQuad(4294967295)\n    '255.255.255.255'\n    >>> numToDottedQuad(4294967296)\n    Traceback (most recent call last):\n    ValueError: Not a good numeric IP: 4294967296\n\n    ","endLoc":353,"header":"def numToDottedQuad(num)","id":11546,"name":"numToDottedQuad","nodeType":"Function","startLoc":304,"text":"def numToDottedQuad(num):\n    \"\"\"\n    Convert int or long int to dotted quad string\n\n    >>> numToDottedQuad(long(-1))\n    Traceback (most recent call last):\n    ValueError: Not a good numeric IP: -1\n    >>> numToDottedQuad(long(1))\n    '0.0.0.1'\n    >>> numToDottedQuad(long(16777218))\n    '1.0.0.2'\n    >>> numToDottedQuad(long(16908291))\n    '1.2.0.3'\n    >>> numToDottedQuad(long(16909060))\n    '1.2.3.4'\n    >>> numToDottedQuad(long(4294967295))\n    '255.255.255.255'\n    >>> numToDottedQuad(long(4294967296))\n    Traceback (most recent call last):\n    ValueError: Not a good numeric IP: 4294967296\n    >>> numToDottedQuad(-1)\n    Traceback (most recent call last):\n    ValueError: Not a good numeric IP: -1\n    >>> numToDottedQuad(1)\n    '0.0.0.1'\n    >>> numToDottedQuad(16777218)\n    '1.0.0.2'\n    >>> numToDottedQuad(16908291)\n    '1.2.0.3'\n    >>> numToDottedQuad(16909060)\n    '1.2.3.4'\n    >>> numToDottedQuad(4294967295)\n    '255.255.255.255'\n    >>> numToDottedQuad(4294967296)\n    Traceback (most recent call last):\n    ValueError: Not a good numeric IP: 4294967296\n\n    \"\"\"\n\n    # import here to avoid it when ip_addr values are not used\n    import socket, struct\n\n    # no need to intercept here, 4294967295L is fine\n    if num > long(4294967295) or num < 0:\n        raise ValueError('Not a good numeric IP: %s' % num)\n    try:\n        return socket.inet_ntoa(\n            struct.pack('!L', long(num)))\n    except (socket.error, struct.error, OverflowError):\n        raise ValueError('Not a good numeric IP: %s' % num)"},{"col":0,"comment":"\n    Return numbers from inputs or raise VdtParamError.\n\n    Lets ``None`` pass through.\n    Pass in keyword argument ``to_float=True`` to\n    use float for the conversion rather than int.\n\n    >>> _is_num_param(('', ''), (0, 1.0))\n    [0, 1]\n    >>> _is_num_param(('', ''), (0, 1.0), to_float=True)\n    [0.0, 1.0]\n    >>> _is_num_param(('a'), ('a'))\n    Traceback (most recent call last):\n    VdtParamError: passed an incorrect value \"a\" for parameter \"a\".\n    ","endLoc":774,"header":"def _is_num_param(names, values, to_float=False)","id":11547,"name":"_is_num_param","nodeType":"Function","startLoc":746,"text":"def _is_num_param(names, values, to_float=False):\n    \"\"\"\n    Return numbers from inputs or raise VdtParamError.\n\n    Lets ``None`` pass through.\n    Pass in keyword argument ``to_float=True`` to\n    use float for the conversion rather than int.\n\n    >>> _is_num_param(('', ''), (0, 1.0))\n    [0, 1]\n    >>> _is_num_param(('', ''), (0, 1.0), to_float=True)\n    [0.0, 1.0]\n    >>> _is_num_param(('a'), ('a'))\n    Traceback (most recent call last):\n    VdtParamError: passed an incorrect value \"a\" for parameter \"a\".\n    \"\"\"\n    fun = to_float and float or int\n    out_params = []\n    for (name, val) in zip(names, values):\n        if val is None:\n            out_params.append(val)\n        elif isinstance(val, (int, long, float, string_type)):\n            try:\n                out_params.append(fun(val))\n            except ValueError as e:\n                raise VdtParamError(name, val)\n        else:\n            raise VdtParamError(name, val)\n    return out_params"},{"col":4,"comment":"null","endLoc":1148,"header":"def setfield(self, val, dtype, offset=0)","id":11548,"name":"setfield","nodeType":"Function","startLoc":1141,"text":"def setfield(self, val, dtype, offset=0):\n        for field, info in self.dtype.fields.items():\n            if offset == info[1] and dtype == info[0]:\n                self[field] = val\n                return\n\n        raise NotImplementedError('can only set existing field from '\n                                  'structured dtype.')"},{"col":0,"comment":"\n    Create a comparison operator for MaskedNDArray.\n\n    Needed since for string dtypes the base operators bypass __array_ufunc__\n    and hence return unmasked results.\n    ","endLoc":394,"header":"def _comparison_method(op)","id":11549,"name":"_comparison_method","nodeType":"Function","startLoc":379,"text":"def _comparison_method(op):\n    \"\"\"\n    Create a comparison operator for MaskedNDArray.\n\n    Needed since for string dtypes the base operators bypass __array_ufunc__\n    and hence return unmasked results.\n    \"\"\"\n    def _compare(self, other):\n        other_data, other_mask = self._get_data_and_mask(other)\n        result = getattr(self.unmasked, op)(other_data)\n        if result is NotImplemented:\n            return NotImplemented\n        mask = self.mask | (other_mask if other_mask is not None else False)\n        return self._masked_result(result, mask, None)\n\n    return _compare"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":11550,"name":"__all__","nodeType":"Attribute","startLoc":32,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":11551,"name":"get__doc__","nodeType":"Attribute","startLoc":35,"text":"get__doc__"},{"col":0,"comment":"","endLoc":18,"header":"core.py#<anonymous>","id":11552,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nBuilt-in mask mixin class.\n\nThe design uses `Masked` as a factory class which automatically\ngenerates new subclasses for any data class that is itself a\nsubclass of a predefined masked class, with `MaskedNDArray`\nproviding such a predefined class for `~numpy.ndarray`.\n\nGenerally, any new predefined class should override the\n``from_unmasked(data, mask, copy=False)`` class method that\ncreates an instance from unmasked data and a mask, as well as\nthe ``unmasked`` property that returns just the data.\nThe `Masked` class itself provides a base ``mask`` property,\nwhich can also be overridden if needed.\n\n\"\"\"\n\n__all__ = ['Masked', 'MaskedNDArray']\n\nget__doc__ = \"\"\"Masked version of {0.__name__}.\n\nExcept for the ability to pass in a ``mask``, parameters are\nas for `{0.__module__}.{0.__name__}`.\n\"\"\".format"},{"fileName":"__init__.py","filePath":"astropy/extern/configobj","id":11553,"nodeType":"File","text":""},{"fileName":"configobj.py","filePath":"astropy/extern/configobj","id":11554,"nodeType":"File","text":"# configobj.py\n# A config file reader/writer that supports nested sections in config files.\n# Copyright (C) 2005-2014:\n# (name) : (email)\n# Michael Foord: fuzzyman AT voidspace DOT org DOT uk\n# Nicola Larosa: nico AT tekNico DOT net\n# Rob Dennis: rdennis AT gmail DOT com\n# Eli Courtwright: eli AT courtwright DOT org\n\n# This software is licensed under the terms of the BSD license.\n# http://opensource.org/licenses/BSD-3-Clause\n\n# ConfigObj 5 - main repository for documentation and issue tracking:\n# https://github.com/DiffSK/configobj\n\nimport os\nimport re\nimport sys\nfrom collections.abc import Mapping\n\nfrom codecs import BOM_UTF8, BOM_UTF16, BOM_UTF16_BE, BOM_UTF16_LE\n\n# imported lazily to avoid startup performance hit if it isn't used\ncompiler = None\n\n# A dictionary mapping BOM to\n# the encoding to decode with, and what to set the\n# encoding attribute to.\nBOMS = {\n    BOM_UTF8: ('utf_8', None),\n    BOM_UTF16_BE: ('utf16_be', 'utf_16'),\n    BOM_UTF16_LE: ('utf16_le', 'utf_16'),\n    BOM_UTF16: ('utf_16', 'utf_16'),\n    }\n# All legal variants of the BOM codecs.\n# TODO: the list of aliases is not meant to be exhaustive, is there a\n#   better way ?\nBOM_LIST = {\n    'utf_16': 'utf_16',\n    'u16': 'utf_16',\n    'utf16': 'utf_16',\n    'utf-16': 'utf_16',\n    'utf16_be': 'utf16_be',\n    'utf_16_be': 'utf16_be',\n    'utf-16be': 'utf16_be',\n    'utf16_le': 'utf16_le',\n    'utf_16_le': 'utf16_le',\n    'utf-16le': 'utf16_le',\n    'utf_8': 'utf_8',\n    'u8': 'utf_8',\n    'utf': 'utf_8',\n    'utf8': 'utf_8',\n    'utf-8': 'utf_8',\n    }\n\n# Map of encodings to the BOM to write.\nBOM_SET = {\n    'utf_8': BOM_UTF8,\n    'utf_16': BOM_UTF16,\n    'utf16_be': BOM_UTF16_BE,\n    'utf16_le': BOM_UTF16_LE,\n    None: BOM_UTF8\n    }\n\n\ndef match_utf8(encoding):\n    return BOM_LIST.get(encoding.lower()) == 'utf_8'\n\n\n# Quote strings used for writing values\nsquot = \"'%s'\"\ndquot = '\"%s\"'\nnoquot = \"%s\"\nwspace_plus = ' \\r\\n\\v\\t\\'\"'\ntsquot = '\"\"\"%s\"\"\"'\ntdquot = \"'''%s'''\"\n\n# Sentinel for use in getattr calls to replace hasattr\nMISSING = object()\n\n__all__ = (\n    'DEFAULT_INDENT_TYPE',\n    'DEFAULT_INTERPOLATION',\n    'ConfigObjError',\n    'NestingError',\n    'ParseError',\n    'DuplicateError',\n    'ConfigspecError',\n    'ConfigObj',\n    'SimpleVal',\n    'InterpolationError',\n    'InterpolationLoopError',\n    'MissingInterpolationOption',\n    'RepeatSectionError',\n    'ReloadError',\n    'UnreprError',\n    'UnknownType',\n    'flatten_errors',\n    'get_extra_values'\n)\n\nDEFAULT_INTERPOLATION = 'configparser'\nDEFAULT_INDENT_TYPE = '    '\nMAX_INTERPOL_DEPTH = 10\n\nOPTION_DEFAULTS = {\n    'interpolation': True,\n    'raise_errors': False,\n    'list_values': True,\n    'create_empty': False,\n    'file_error': False,\n    'configspec': None,\n    'stringify': True,\n    # option may be set to one of ('', ' ', '\\t')\n    'indent_type': None,\n    'encoding': None,\n    'default_encoding': None,\n    'unrepr': False,\n    'write_empty_values': False,\n}\n\n# this could be replaced if six is used for compatibility, or there are no\n# more assertions about items being a string\n\n\ndef getObj(s):\n    global compiler\n    if compiler is None:\n        import compiler\n    s = \"a=\" + s\n    p = compiler.parse(s)\n    return p.getChildren()[1].getChildren()[0].getChildren()[1]\n\n\nclass UnknownType(Exception):\n    pass\n\n\nclass Builder(object):\n\n    def build(self, o):\n        if m is None:\n            raise UnknownType(o.__class__.__name__)\n        return m(o)\n\n    def build_List(self, o):\n        return list(map(self.build, o.getChildren()))\n\n    def build_Const(self, o):\n        return o.value\n\n    def build_Dict(self, o):\n        d = {}\n        i = iter(map(self.build, o.getChildren()))\n        for el in i:\n            d[el] = next(i)\n        return d\n\n    def build_Tuple(self, o):\n        return tuple(self.build_List(o))\n\n    def build_Name(self, o):\n        if o.name == 'None':\n            return None\n        if o.name == 'True':\n            return True\n        if o.name == 'False':\n            return False\n\n        # An undefined Name\n        raise UnknownType('Undefined Name')\n\n    def build_Add(self, o):\n        real, imag = list(map(self.build_Const, o.getChildren()))\n        try:\n            real = float(real)\n        except TypeError:\n            raise UnknownType('Add')\n        if not isinstance(imag, complex) or imag.real != 0.0:\n            raise UnknownType('Add')\n        return real+imag\n\n    def build_Getattr(self, o):\n        parent = self.build(o.expr)\n        return getattr(parent, o.attrname)\n\n    def build_UnarySub(self, o):\n        return -self.build_Const(o.getChildren()[0])\n\n    def build_UnaryAdd(self, o):\n        return self.build_Const(o.getChildren()[0])\n\n\n_builder = Builder()\n\n\ndef unrepr(s):\n    if not s:\n        return s\n\n    # this is supposed to be safe\n    import ast\n    return ast.literal_eval(s)\n\n\nclass ConfigObjError(SyntaxError):\n    \"\"\"\n    This is the base class for all errors that ConfigObj raises.\n    It is a subclass of SyntaxError.\n    \"\"\"\n    def __init__(self, message='', line_number=None, line=''):\n        self.line = line\n        self.line_number = line_number\n        SyntaxError.__init__(self, message)\n\n\nclass NestingError(ConfigObjError):\n    \"\"\"\n    This error indicates a level of nesting that doesn't match.\n    \"\"\"\n\n\nclass ParseError(ConfigObjError):\n    \"\"\"\n    This error indicates that a line is badly written.\n    It is neither a valid ``key = value`` line,\n    nor a valid section marker line.\n    \"\"\"\n\n\nclass ReloadError(IOError):\n    \"\"\"\n    A 'reload' operation failed.\n    This exception is a subclass of ``IOError``.\n    \"\"\"\n    def __init__(self):\n        IOError.__init__(self, 'reload failed, filename is not set.')\n\n\nclass DuplicateError(ConfigObjError):\n    \"\"\"\n    The keyword or section specified already exists.\n    \"\"\"\n\n\nclass ConfigspecError(ConfigObjError):\n    \"\"\"\n    An error occured whilst parsing a configspec.\n    \"\"\"\n\n\nclass InterpolationError(ConfigObjError):\n    \"\"\"Base class for the two interpolation errors.\"\"\"\n\n\nclass InterpolationLoopError(InterpolationError):\n    \"\"\"Maximum interpolation depth exceeded in string interpolation.\"\"\"\n\n    def __init__(self, option):\n        InterpolationError.__init__(\n            self,\n            'interpolation loop detected in value \"%s\".' % option)\n\n\nclass RepeatSectionError(ConfigObjError):\n    \"\"\"\n    This error indicates additional sections in a section with a\n    ``__many__`` (repeated) section.\n    \"\"\"\n\n\nclass MissingInterpolationOption(InterpolationError):\n    \"\"\"A value specified for interpolation was missing.\"\"\"\n    def __init__(self, option):\n        msg = 'missing option \"%s\" in interpolation.' % option\n        InterpolationError.__init__(self, msg)\n\n\nclass UnreprError(ConfigObjError):\n    \"\"\"An error parsing in unrepr mode.\"\"\"\n\n\n\nclass InterpolationEngine(object):\n    \"\"\"\n    A helper class to help perform string interpolation.\n\n    This class is an abstract base class; its descendants perform\n    the actual work.\n    \"\"\"\n\n    # compiled regexp to use in self.interpolate()\n    _KEYCRE = re.compile(r\"%\\(([^)]*)\\)s\")\n    _cookie = '%'\n\n    def __init__(self, section):\n        # the Section instance that \"owns\" this engine\n        self.section = section\n\n\n    def interpolate(self, key, value):\n        # short-cut\n        if not self._cookie in value:\n            return value\n\n        def recursive_interpolate(key, value, section, backtrail):\n            \"\"\"The function that does the actual work.\n\n            ``value``: the string we're trying to interpolate.\n            ``section``: the section in which that string was found\n            ``backtrail``: a dict to keep track of where we've been,\n            to detect and prevent infinite recursion loops\n\n            This is similar to a depth-first-search algorithm.\n            \"\"\"\n            # Have we been here already?\n            if (key, section.name) in backtrail:\n                # Yes - infinite loop detected\n                raise InterpolationLoopError(key)\n            # Place a marker on our backtrail so we won't come back here again\n            backtrail[(key, section.name)] = 1\n\n            # Now start the actual work\n            match = self._KEYCRE.search(value)\n            while match:\n                # The actual parsing of the match is implementation-dependent,\n                # so delegate to our helper function\n                k, v, s = self._parse_match(match)\n                if k is None:\n                    # That's the signal that no further interpolation is needed\n                    replacement = v\n                else:\n                    # Further interpolation may be needed to obtain final value\n                    replacement = recursive_interpolate(k, v, s, backtrail)\n                # Replace the matched string with its final value\n                start, end = match.span()\n                value = ''.join((value[:start], replacement, value[end:]))\n                new_search_start = start + len(replacement)\n                # Pick up the next interpolation key, if any, for next time\n                # through the while loop\n                match = self._KEYCRE.search(value, new_search_start)\n\n            # Now safe to come back here again; remove marker from backtrail\n            del backtrail[(key, section.name)]\n\n            return value\n\n        # Back in interpolate(), all we have to do is kick off the recursive\n        # function with appropriate starting values\n        value = recursive_interpolate(key, value, self.section, {})\n        return value\n\n\n    def _fetch(self, key):\n        \"\"\"Helper function to fetch values from owning section.\n\n        Returns a 2-tuple: the value, and the section where it was found.\n        \"\"\"\n        # switch off interpolation before we try and fetch anything !\n        save_interp = self.section.main.interpolation\n        self.section.main.interpolation = False\n\n        # Start at section that \"owns\" this InterpolationEngine\n        current_section = self.section\n        while True:\n            # try the current section first\n            val = current_section.get(key)\n            if val is not None and not isinstance(val, Section):\n                break\n            # try \"DEFAULT\" next\n            val = current_section.get('DEFAULT', {}).get(key)\n            if val is not None and not isinstance(val, Section):\n                break\n            # move up to parent and try again\n            # top-level's parent is itself\n            if current_section.parent is current_section:\n                # reached top level, time to give up\n                break\n            current_section = current_section.parent\n\n        # restore interpolation to previous value before returning\n        self.section.main.interpolation = save_interp\n        if val is None:\n            raise MissingInterpolationOption(key)\n        return val, current_section\n\n\n    def _parse_match(self, match):\n        \"\"\"Implementation-dependent helper function.\n\n        Will be passed a match object corresponding to the interpolation\n        key we just found (e.g., \"%(foo)s\" or \"$foo\"). Should look up that\n        key in the appropriate config file section (using the ``_fetch()``\n        helper function) and return a 3-tuple: (key, value, section)\n\n        ``key`` is the name of the key we're looking for\n        ``value`` is the value found for that key\n        ``section`` is a reference to the section where it was found\n\n        ``key`` and ``section`` should be None if no further\n        interpolation should be performed on the resulting value\n        (e.g., if we interpolated \"$$\" and returned \"$\").\n        \"\"\"\n        raise NotImplementedError()\n\n\n\nclass ConfigParserInterpolation(InterpolationEngine):\n    \"\"\"Behaves like ConfigParser.\"\"\"\n    _cookie = '%'\n    _KEYCRE = re.compile(r\"%\\(([^)]*)\\)s\")\n\n    def _parse_match(self, match):\n        key = match.group(1)\n        value, section = self._fetch(key)\n        return key, value, section\n\n\n\nclass TemplateInterpolation(InterpolationEngine):\n    \"\"\"Behaves like string.Template.\"\"\"\n    _cookie = '$'\n    _delimiter = '$'\n    _KEYCRE = re.compile(r\"\"\"\n        \\$(?:\n          (?P<escaped>\\$)              |   # Two $ signs\n          (?P<named>[_a-z][_a-z0-9]*)  |   # $name format\n          {(?P<braced>[^}]*)}              # ${name} format\n        )\n        \"\"\", re.IGNORECASE | re.VERBOSE)\n\n    def _parse_match(self, match):\n        # Valid name (in or out of braces): fetch value from section\n        key = match.group('named') or match.group('braced')\n        if key is not None:\n            value, section = self._fetch(key)\n            return key, value, section\n        # Escaped delimiter (e.g., $$): return single delimiter\n        if match.group('escaped') is not None:\n            # Return None for key and section to indicate it's time to stop\n            return None, self._delimiter, None\n        # Anything else: ignore completely, just return it unchanged\n        return None, match.group(), None\n\n\ninterpolation_engines = {\n    'configparser': ConfigParserInterpolation,\n    'template': TemplateInterpolation,\n}\n\n\ndef __newobj__(cls, *args):\n    # Hack for pickle\n    return cls.__new__(cls, *args)\n\nclass Section(dict):\n    \"\"\"\n    A dictionary-like object that represents a section in a config file.\n\n    It does string interpolation if the 'interpolation' attribute\n    of the 'main' object is set to True.\n\n    Interpolation is tried first from this object, then from the 'DEFAULT'\n    section of this object, next from the parent and its 'DEFAULT' section,\n    and so on until the main object is reached.\n\n    A Section will behave like an ordered dictionary - following the\n    order of the ``scalars`` and ``sections`` attributes.\n    You can use this to change the order of members.\n\n    Iteration follows the order: scalars, then sections.\n    \"\"\"\n\n\n    def __setstate__(self, state):\n        dict.update(self, state[0])\n        self.__dict__.update(state[1])\n\n    def __reduce__(self):\n        state = (dict(self), self.__dict__)\n        return (__newobj__, (self.__class__,), state)\n\n\n    def __init__(self, parent, depth, main, indict=None, name=None):\n        \"\"\"\n        * parent is the section above\n        * depth is the depth level of this section\n        * main is the main ConfigObj\n        * indict is a dictionary to initialise the section with\n        \"\"\"\n        if indict is None:\n            indict = {}\n        dict.__init__(self)\n        # used for nesting level *and* interpolation\n        self.parent = parent\n        # used for the interpolation attribute\n        self.main = main\n        # level of nesting depth of this Section\n        self.depth = depth\n        # purely for information\n        self.name = name\n        #\n        self._initialise()\n        # we do this explicitly so that __setitem__ is used properly\n        # (rather than just passing to ``dict.__init__``)\n        for entry, value in indict.items():\n            self[entry] = value\n\n\n    def _initialise(self):\n        # the sequence of scalar values in this Section\n        self.scalars = []\n        # the sequence of sections in this Section\n        self.sections = []\n        # for comments :-)\n        self.comments = {}\n        self.inline_comments = {}\n        # the configspec\n        self.configspec = None\n        # for defaults\n        self.defaults = []\n        self.default_values = {}\n        self.extra_values = []\n        self._created = False\n\n\n    def _interpolate(self, key, value):\n        try:\n            # do we already have an interpolation engine?\n            engine = self._interpolation_engine\n        except AttributeError:\n            # not yet: first time running _interpolate(), so pick the engine\n            name = self.main.interpolation\n            if name == True:  # note that \"if name:\" would be incorrect here\n                # backwards-compatibility: interpolation=True means use default\n                name = DEFAULT_INTERPOLATION\n            name = name.lower()  # so that \"Template\", \"template\", etc. all work\n            class_ = interpolation_engines.get(name, None)\n            if class_ is None:\n                # invalid value for self.main.interpolation\n                self.main.interpolation = False\n                return value\n            else:\n                # save reference to engine so we don't have to do this again\n                engine = self._interpolation_engine = class_(self)\n        # let the engine do the actual work\n        return engine.interpolate(key, value)\n\n\n    def __getitem__(self, key):\n        \"\"\"Fetch the item and do string interpolation.\"\"\"\n        val = dict.__getitem__(self, key)\n        if self.main.interpolation:\n            if isinstance(val, str):\n                return self._interpolate(key, val)\n            if isinstance(val, list):\n                def _check(entry):\n                    if isinstance(entry, str):\n                        return self._interpolate(key, entry)\n                    return entry\n                new = [_check(entry) for entry in val]\n                if new != val:\n                    return new\n        return val\n\n\n    def __setitem__(self, key, value, unrepr=False):\n        \"\"\"\n        Correctly set a value.\n\n        Making dictionary values Section instances.\n        (We have to special case 'Section' instances - which are also dicts)\n\n        Keys must be strings.\n        Values need only be strings (or lists of strings) if\n        ``main.stringify`` is set.\n\n        ``unrepr`` must be set when setting a value to a dictionary, without\n        creating a new sub-section.\n        \"\"\"\n        if not isinstance(key, str):\n            raise ValueError('The key \"%s\" is not a string.' % key)\n\n        # add the comment\n        if key not in self.comments:\n            self.comments[key] = []\n            self.inline_comments[key] = ''\n        # remove the entry from defaults\n        if key in self.defaults:\n            self.defaults.remove(key)\n        #\n        if isinstance(value, Section):\n            if key not in self:\n                self.sections.append(key)\n            dict.__setitem__(self, key, value)\n        elif isinstance(value, Mapping) and not unrepr:\n            # First create the new depth level,\n            # then create the section\n            if key not in self:\n                self.sections.append(key)\n            new_depth = self.depth + 1\n            dict.__setitem__(\n                self,\n                key,\n                Section(\n                    self,\n                    new_depth,\n                    self.main,\n                    indict=value,\n                    name=key))\n        else:\n            if key not in self:\n                self.scalars.append(key)\n            if not self.main.stringify:\n                if isinstance(value, str):\n                    pass\n                elif isinstance(value, (list, tuple)):\n                    for entry in value:\n                        if not isinstance(entry, str):\n                            raise TypeError('Value is not a string \"%s\".' % entry)\n                else:\n                    raise TypeError('Value is not a string \"%s\".' % value)\n            dict.__setitem__(self, key, value)\n\n\n    def __delitem__(self, key):\n        \"\"\"Remove items from the sequence when deleting.\"\"\"\n        dict. __delitem__(self, key)\n        if key in self.scalars:\n            self.scalars.remove(key)\n        else:\n            self.sections.remove(key)\n        del self.comments[key]\n        del self.inline_comments[key]\n\n\n    def get(self, key, default=None):\n        \"\"\"A version of ``get`` that doesn't bypass string interpolation.\"\"\"\n        try:\n            return self[key]\n        except KeyError:\n            return default\n\n\n    def update(self, indict):\n        \"\"\"\n        A version of update that uses our ``__setitem__``.\n        \"\"\"\n        for entry in indict:\n            self[entry] = indict[entry]\n\n\n    def pop(self, key, default=MISSING):\n        \"\"\"\n        'D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n        If key is not found, d is returned if given, otherwise KeyError is raised'\n        \"\"\"\n        try:\n            val = self[key]\n        except KeyError:\n            if default is MISSING:\n                raise\n            val = default\n        else:\n            del self[key]\n        return val\n\n\n    def popitem(self):\n        \"\"\"Pops the first (key,val)\"\"\"\n        sequence = (self.scalars + self.sections)\n        if not sequence:\n            raise KeyError(\": 'popitem(): dictionary is empty'\")\n        key = sequence[0]\n        val =  self[key]\n        del self[key]\n        return key, val\n\n\n    def clear(self):\n        \"\"\"\n        A version of clear that also affects scalars/sections\n        Also clears comments and configspec.\n\n        Leaves other attributes alone :\n            depth/main/parent are not affected\n        \"\"\"\n        dict.clear(self)\n        self.scalars = []\n        self.sections = []\n        self.comments = {}\n        self.inline_comments = {}\n        self.configspec = None\n        self.defaults = []\n        self.extra_values = []\n\n\n    def setdefault(self, key, default=None):\n        \"\"\"A version of setdefault that sets sequence if appropriate.\"\"\"\n        try:\n            return self[key]\n        except KeyError:\n            self[key] = default\n            return self[key]\n\n\n    def items(self):\n        \"\"\"D.items() -> list of D's (key, value) pairs, as 2-tuples\"\"\"\n        return list(zip((self.scalars + self.sections), list(self.values())))\n\n\n    def keys(self):\n        \"\"\"D.keys() -> list of D's keys\"\"\"\n        return (self.scalars + self.sections)\n\n\n    def values(self):\n        \"\"\"D.values() -> list of D's values\"\"\"\n        return [self[key] for key in (self.scalars + self.sections)]\n\n\n    def iteritems(self):\n        \"\"\"D.iteritems() -> an iterator over the (key, value) items of D\"\"\"\n        return iter(list(self.items()))\n\n\n    def iterkeys(self):\n        \"\"\"D.iterkeys() -> an iterator over the keys of D\"\"\"\n        return iter((self.scalars + self.sections))\n\n    __iter__ = iterkeys\n\n\n    def itervalues(self):\n        \"\"\"D.itervalues() -> an iterator over the values of D\"\"\"\n        return iter(list(self.values()))\n\n\n    def __repr__(self):\n        \"\"\"x.__repr__() <==> repr(x)\"\"\"\n        def _getval(key):\n            try:\n                return self[key]\n            except MissingInterpolationOption:\n                return dict.__getitem__(self, key)\n        return '{%s}' % ', '.join([('%s: %s' % (repr(key), repr(_getval(key))))\n            for key in (self.scalars + self.sections)])\n\n    __str__ = __repr__\n    __str__.__doc__ = \"x.__str__() <==> str(x)\"\n\n\n    # Extra methods - not in a normal dictionary\n\n    def dict(self):\n        \"\"\"\n        Return a deepcopy of self as a dictionary.\n\n        All members that are ``Section`` instances are recursively turned to\n        ordinary dictionaries - by calling their ``dict`` method.\n\n        >>> n = a.dict()\n        >>> n == a\n        1\n        >>> n is a\n        0\n        \"\"\"\n        newdict = {}\n        for entry in self:\n            this_entry = self[entry]\n            if isinstance(this_entry, Section):\n                this_entry = this_entry.dict()\n            elif isinstance(this_entry, list):\n                # create a copy rather than a reference\n                this_entry = list(this_entry)\n            elif isinstance(this_entry, tuple):\n                # create a copy rather than a reference\n                this_entry = tuple(this_entry)\n            newdict[entry] = this_entry\n        return newdict\n\n\n    def merge(self, indict):\n        \"\"\"\n        A recursive update - useful for merging config files.\n\n        >>> a = '''[section1]\n        ...     option1 = True\n        ...     [[subsection]]\n        ...     more_options = False\n        ...     # end of file'''.splitlines()\n        >>> b = '''# File is user.ini\n        ...     [section1]\n        ...     option1 = False\n        ...     # end of file'''.splitlines()\n        >>> c1 = ConfigObj(b)\n        >>> c2 = ConfigObj(a)\n        >>> c2.merge(c1)\n        >>> c2\n        ConfigObj({'section1': {'option1': 'False', 'subsection': {'more_options': 'False'}}})\n        \"\"\"\n        for key, val in list(indict.items()):\n            if (key in self and isinstance(self[key], Mapping) and\n                                isinstance(val, Mapping)):\n                self[key].merge(val)\n            else:\n                self[key] = val\n\n\n    def rename(self, oldkey, newkey):\n        \"\"\"\n        Change a keyname to another, without changing position in sequence.\n\n        Implemented so that transformations can be made on keys,\n        as well as on values. (used by encode and decode)\n\n        Also renames comments.\n        \"\"\"\n        if oldkey in self.scalars:\n            the_list = self.scalars\n        elif oldkey in self.sections:\n            the_list = self.sections\n        else:\n            raise KeyError('Key \"%s\" not found.' % oldkey)\n        pos = the_list.index(oldkey)\n        #\n        val = self[oldkey]\n        dict.__delitem__(self, oldkey)\n        dict.__setitem__(self, newkey, val)\n        the_list.remove(oldkey)\n        the_list.insert(pos, newkey)\n        comm = self.comments[oldkey]\n        inline_comment = self.inline_comments[oldkey]\n        del self.comments[oldkey]\n        del self.inline_comments[oldkey]\n        self.comments[newkey] = comm\n        self.inline_comments[newkey] = inline_comment\n\n\n    def walk(self, function, raise_errors=True,\n            call_on_sections=False, **keywargs):\n        \"\"\"\n        Walk every member and call a function on the keyword and value.\n\n        Return a dictionary of the return values\n\n        If the function raises an exception, raise the errror\n        unless ``raise_errors=False``, in which case set the return value to\n        ``False``.\n\n        Any unrecognized keyword arguments you pass to walk, will be pased on\n        to the function you pass in.\n\n        Note: if ``call_on_sections`` is ``True`` then - on encountering a\n        subsection, *first* the function is called for the *whole* subsection,\n        and then recurses into it's members. This means your function must be\n        able to handle strings, dictionaries and lists. This allows you\n        to change the key of subsections as well as for ordinary members. The\n        return value when called on the whole subsection has to be discarded.\n\n        See  the encode and decode methods for examples, including functions.\n\n        .. admonition:: caution\n\n            You can use ``walk`` to transform the names of members of a section\n            but you mustn't add or delete members.\n\n        >>> config = '''[XXXXsection]\n        ... XXXXkey = XXXXvalue'''.splitlines()\n        >>> cfg = ConfigObj(config)\n        >>> cfg\n        ConfigObj({'XXXXsection': {'XXXXkey': 'XXXXvalue'}})\n        >>> def transform(section, key):\n        ...     val = section[key]\n        ...     newkey = key.replace('XXXX', 'CLIENT1')\n        ...     section.rename(key, newkey)\n        ...     if isinstance(val, (tuple, list, dict)):\n        ...         pass\n        ...     else:\n        ...         val = val.replace('XXXX', 'CLIENT1')\n        ...         section[newkey] = val\n        >>> cfg.walk(transform, call_on_sections=True)\n        {'CLIENT1section': {'CLIENT1key': None}}\n        >>> cfg\n        ConfigObj({'CLIENT1section': {'CLIENT1key': 'CLIENT1value'}})\n        \"\"\"\n        out = {}\n        # scalars first\n        for i in range(len(self.scalars)):\n            entry = self.scalars[i]\n            try:\n                val = function(self, entry, **keywargs)\n                # bound again in case name has changed\n                entry = self.scalars[i]\n                out[entry] = val\n            except Exception:\n                if raise_errors:\n                    raise\n                else:\n                    entry = self.scalars[i]\n                    out[entry] = False\n        # then sections\n        for i in range(len(self.sections)):\n            entry = self.sections[i]\n            if call_on_sections:\n                try:\n                    function(self, entry, **keywargs)\n                except Exception:\n                    if raise_errors:\n                        raise\n                    else:\n                        entry = self.sections[i]\n                        out[entry] = False\n                # bound again in case name has changed\n                entry = self.sections[i]\n            # previous result is discarded\n            out[entry] = self[entry].walk(\n                function,\n                raise_errors=raise_errors,\n                call_on_sections=call_on_sections,\n                **keywargs)\n        return out\n\n\n    def as_bool(self, key):\n        \"\"\"\n        Accepts a key as input. The corresponding value must be a string or\n        the objects (``True`` or 1) or (``False`` or 0). We allow 0 and 1 to\n        retain compatibility with Python 2.2.\n\n        If the string is one of  ``True``, ``On``, ``Yes``, or ``1`` it returns\n        ``True``.\n\n        If the string is one of  ``False``, ``Off``, ``No``, or ``0`` it returns\n        ``False``.\n\n        ``as_bool`` is not case sensitive.\n\n        Any other input will raise a ``ValueError``.\n\n        >>> a = ConfigObj()\n        >>> a['a'] = 'fish'\n        >>> a.as_bool('a')\n        Traceback (most recent call last):\n        ValueError: Value \"fish\" is neither True nor False\n        >>> a['b'] = 'True'\n        >>> a.as_bool('b')\n        1\n        >>> a['b'] = 'off'\n        >>> a.as_bool('b')\n        0\n        \"\"\"\n        val = self[key]\n        if val == True:\n            return True\n        elif val == False:\n            return False\n        else:\n            try:\n                if not isinstance(val, str):\n                    # TODO: Why do we raise a KeyError here?\n                    raise KeyError()\n                else:\n                    return self.main._bools[val.lower()]\n            except KeyError:\n                raise ValueError('Value \"%s\" is neither True nor False' % val)\n\n\n    def as_int(self, key):\n        \"\"\"\n        A convenience method which coerces the specified value to an integer.\n\n        If the value is an invalid literal for ``int``, a ``ValueError`` will\n        be raised.\n\n        >>> a = ConfigObj()\n        >>> a['a'] = 'fish'\n        >>> a.as_int('a')\n        Traceback (most recent call last):\n        ValueError: invalid literal for int() with base 10: 'fish'\n        >>> a['b'] = '1'\n        >>> a.as_int('b')\n        1\n        >>> a['b'] = '3.2'\n        >>> a.as_int('b')\n        Traceback (most recent call last):\n        ValueError: invalid literal for int() with base 10: '3.2'\n        \"\"\"\n        return int(self[key])\n\n\n    def as_float(self, key):\n        \"\"\"\n        A convenience method which coerces the specified value to a float.\n\n        If the value is an invalid literal for ``float``, a ``ValueError`` will\n        be raised.\n\n        >>> a = ConfigObj()\n        >>> a['a'] = 'fish'\n        >>> a.as_float('a')  #doctest: +IGNORE_EXCEPTION_DETAIL\n        Traceback (most recent call last):\n        ValueError: invalid literal for float(): fish\n        >>> a['b'] = '1'\n        >>> a.as_float('b')\n        1.0\n        >>> a['b'] = '3.2'\n        >>> a.as_float('b')  #doctest: +ELLIPSIS\n        3.2...\n        \"\"\"\n        return float(self[key])\n\n\n    def as_list(self, key):\n        \"\"\"\n        A convenience method which fetches the specified value, guaranteeing\n        that it is a list.\n\n        >>> a = ConfigObj()\n        >>> a['a'] = 1\n        >>> a.as_list('a')\n        [1]\n        >>> a['a'] = (1,)\n        >>> a.as_list('a')\n        [1]\n        >>> a['a'] = [1]\n        >>> a.as_list('a')\n        [1]\n        \"\"\"\n        result = self[key]\n        if isinstance(result, (tuple, list)):\n            return list(result)\n        return [result]\n\n\n    def restore_default(self, key):\n        \"\"\"\n        Restore (and return) default value for the specified key.\n\n        This method will only work for a ConfigObj that was created\n        with a configspec and has been validated.\n\n        If there is no default value for this key, ``KeyError`` is raised.\n        \"\"\"\n        default = self.default_values[key]\n        dict.__setitem__(self, key, default)\n        if key not in self.defaults:\n            self.defaults.append(key)\n        return default\n\n\n    def restore_defaults(self):\n        \"\"\"\n        Recursively restore default values to all members\n        that have them.\n\n        This method will only work for a ConfigObj that was created\n        with a configspec and has been validated.\n\n        It doesn't delete or modify entries without default values.\n        \"\"\"\n        for key in self.default_values:\n            self.restore_default(key)\n\n        for section in self.sections:\n            self[section].restore_defaults()\n\n\nclass ConfigObj(Section):\n    \"\"\"An object to read, create, and write config files.\"\"\"\n\n    _keyword = re.compile(r'''^ # line start\n        (\\s*)                   # indentation\n        (                       # keyword\n            (?:\".*?\")|          # double quotes\n            (?:'.*?')|          # single quotes\n            (?:[^'\"=].*?)       # no quotes\n        )\n        \\s*=\\s*                 # divider\n        (.*)                    # value (including list values and comments)\n        $   # line end\n        ''',\n        re.VERBOSE)\n\n    _sectionmarker = re.compile(r'''^\n        (\\s*)                     # 1: indentation\n        ((?:\\[\\s*)+)              # 2: section marker open\n        (                         # 3: section name open\n            (?:\"\\s*\\S.*?\\s*\")|    # at least one non-space with double quotes\n            (?:'\\s*\\S.*?\\s*')|    # at least one non-space with single quotes\n            (?:[^'\"\\s].*?)        # at least one non-space unquoted\n        )                         # section name close\n        ((?:\\s*\\])+)              # 4: section marker close\n        \\s*(\\#.*)?                # 5: optional comment\n        $''',\n        re.VERBOSE)\n\n    # this regexp pulls list values out as a single string\n    # or single values and comments\n    # FIXME: this regex adds a '' to the end of comma terminated lists\n    #   workaround in ``_handle_value``\n    _valueexp = re.compile(r'''^\n        (?:\n            (?:\n                (\n                    (?:\n                        (?:\n                            (?:\".*?\")|              # double quotes\n                            (?:'.*?')|              # single quotes\n                            (?:[^'\",\\#][^,\\#]*?)    # unquoted\n                        )\n                        \\s*,\\s*                     # comma\n                    )*      # match all list items ending in a comma (if any)\n                )\n                (\n                    (?:\".*?\")|                      # double quotes\n                    (?:'.*?')|                      # single quotes\n                    (?:[^'\",\\#\\s][^,]*?)|           # unquoted\n                    (?:(?<!,))                      # Empty value\n                )?          # last item in a list - or string value\n            )|\n            (,)             # alternatively a single comma - empty list\n        )\n        \\s*(\\#.*)?          # optional comment\n        $''',\n        re.VERBOSE)\n\n    # use findall to get the members of a list value\n    _listvalueexp = re.compile(r'''\n        (\n            (?:\".*?\")|          # double quotes\n            (?:'.*?')|          # single quotes\n            (?:[^'\",\\#]?.*?)       # unquoted\n        )\n        \\s*,\\s*                 # comma\n        ''',\n        re.VERBOSE)\n\n    # this regexp is used for the value\n    # when lists are switched off\n    _nolistvalue = re.compile(r'''^\n        (\n            (?:\".*?\")|          # double quotes\n            (?:'.*?')|          # single quotes\n            (?:[^'\"\\#].*?)|     # unquoted\n            (?:)                # Empty value\n        )\n        \\s*(\\#.*)?              # optional comment\n        $''',\n        re.VERBOSE)\n\n    # regexes for finding triple quoted values on one line\n    _single_line_single = re.compile(r\"^'''(.*?)'''\\s*(#.*)?$\")\n    _single_line_double = re.compile(r'^\"\"\"(.*?)\"\"\"\\s*(#.*)?$')\n    _multi_line_single = re.compile(r\"^(.*?)'''\\s*(#.*)?$\")\n    _multi_line_double = re.compile(r'^(.*?)\"\"\"\\s*(#.*)?$')\n\n    _triple_quote = {\n        \"'''\": (_single_line_single, _multi_line_single),\n        '\"\"\"': (_single_line_double, _multi_line_double),\n    }\n\n    # Used by the ``istrue`` Section method\n    _bools = {\n        'yes': True, 'no': False,\n        'on': True, 'off': False,\n        '1': True, '0': False,\n        'true': True, 'false': False,\n        }\n\n\n    def __init__(self, infile=None, options=None, configspec=None, encoding=None,\n                 interpolation=True, raise_errors=False, list_values=True,\n                 create_empty=False, file_error=False, stringify=True,\n                 indent_type=None, default_encoding=None, unrepr=False,\n                 write_empty_values=False, _inspec=False):\n        \"\"\"\n        Parse a config file or create a config file object.\n\n        ``ConfigObj(infile=None, configspec=None, encoding=None,\n                    interpolation=True, raise_errors=False, list_values=True,\n                    create_empty=False, file_error=False, stringify=True,\n                    indent_type=None, default_encoding=None, unrepr=False,\n                    write_empty_values=False, _inspec=False)``\n        \"\"\"\n        self._inspec = _inspec\n        # init the superclass\n        Section.__init__(self, self, 0, self)\n\n        infile = infile or []\n\n        _options = {'configspec': configspec,\n                    'encoding': encoding, 'interpolation': interpolation,\n                    'raise_errors': raise_errors, 'list_values': list_values,\n                    'create_empty': create_empty, 'file_error': file_error,\n                    'stringify': stringify, 'indent_type': indent_type,\n                    'default_encoding': default_encoding, 'unrepr': unrepr,\n                    'write_empty_values': write_empty_values}\n\n        if options is None:\n            options = _options\n        else:\n            import warnings\n            warnings.warn('Passing in an options dictionary to ConfigObj() is '\n                          'deprecated. Use **options instead.',\n                          DeprecationWarning)\n\n            # TODO: check the values too.\n            for entry in options:\n                if entry not in OPTION_DEFAULTS:\n                    raise TypeError('Unrecognized option \"%s\".' % entry)\n            for entry, value in list(OPTION_DEFAULTS.items()):\n                if entry not in options:\n                    options[entry] = value\n                keyword_value = _options[entry]\n                if value != keyword_value:\n                    options[entry] = keyword_value\n\n        # XXXX this ignores an explicit list_values = True in combination\n        # with _inspec. The user should *never* do that anyway, but still...\n        if _inspec:\n            options['list_values'] = False\n\n        self._initialise(options)\n        configspec = options['configspec']\n        self._original_configspec = configspec\n        self._load(infile, configspec)\n\n\n    def _load(self, infile, configspec):\n        if isinstance(infile, str):\n            self.filename = infile\n            if os.path.isfile(infile):\n                with open(infile, 'rb') as h:\n                    content = h.readlines() or []\n            elif self.file_error:\n                # raise an error if the file doesn't exist\n                raise IOError('Config file not found: \"%s\".' % self.filename)\n            else:\n                # file doesn't already exist\n                if self.create_empty:\n                    # this is a good test that the filename specified\n                    # isn't impossible - like on a non-existent device\n                    with open(infile, 'w') as h:\n                        h.write('')\n                content = []\n\n        elif isinstance(infile, (list, tuple)):\n            content = list(infile)\n\n        elif isinstance(infile, dict):\n            # initialise self\n            # the Section class handles creating subsections\n            if isinstance(infile, ConfigObj):\n                # get a copy of our ConfigObj\n                def set_section(in_section, this_section):\n                    for entry in in_section.scalars:\n                        this_section[entry] = in_section[entry]\n                    for section in in_section.sections:\n                        this_section[section] = {}\n                        set_section(in_section[section], this_section[section])\n                set_section(infile, self)\n\n            else:\n                for entry in infile:\n                    self[entry] = infile[entry]\n            del self._errors\n\n            if configspec is not None:\n                self._handle_configspec(configspec)\n            else:\n                self.configspec = None\n            return\n\n        elif getattr(infile, 'read', MISSING) is not MISSING:\n            # This supports file like objects\n            content = infile.read() or []\n            # needs splitting into lines - but needs doing *after* decoding\n            # in case it's not an 8 bit encoding\n        else:\n            raise TypeError('infile must be a filename, file like object, or list of lines.')\n\n        if content:\n            # don't do it for the empty ConfigObj\n            content = self._handle_bom(content)\n            # infile is now *always* a list\n            #\n            # Set the newlines attribute (first line ending it finds)\n            # and strip trailing '\\n' or '\\r' from lines\n            for line in content:\n                if (not line) or (line[-1] not in ('\\r', '\\n')):\n                    continue\n                for end in ('\\r\\n', '\\n', '\\r'):\n                    if line.endswith(end):\n                        self.newlines = end\n                        break\n                break\n\n        assert all(isinstance(line, str) for line in content), repr(content)\n        content = [line.rstrip('\\r\\n') for line in content]\n\n        self._parse(content)\n        # if we had any errors, now is the time to raise them\n        if self._errors:\n            info = \"at line %s.\" % self._errors[0].line_number\n            if len(self._errors) > 1:\n                msg = \"Parsing failed with several errors.\\nFirst error %s\" % info\n                error = ConfigObjError(msg)\n            else:\n                error = self._errors[0]\n            # set the errors attribute; it's a list of tuples:\n            # (error_type, message, line_number)\n            error.errors = self._errors\n            # set the config attribute\n            error.config = self\n            raise error\n        # delete private attributes\n        del self._errors\n\n        if configspec is None:\n            self.configspec = None\n        else:\n            self._handle_configspec(configspec)\n\n\n    def _initialise(self, options=None):\n        if options is None:\n            options = OPTION_DEFAULTS\n\n        # initialise a few variables\n        self.filename = None\n        self._errors = []\n        self.raise_errors = options['raise_errors']\n        self.interpolation = options['interpolation']\n        self.list_values = options['list_values']\n        self.create_empty = options['create_empty']\n        self.file_error = options['file_error']\n        self.stringify = options['stringify']\n        self.indent_type = options['indent_type']\n        self.encoding = options['encoding']\n        self.default_encoding = options['default_encoding']\n        self.BOM = False\n        self.newlines = None\n        self.write_empty_values = options['write_empty_values']\n        self.unrepr = options['unrepr']\n\n        self.initial_comment = []\n        self.final_comment = []\n        self.configspec = None\n\n        if self._inspec:\n            self.list_values = False\n\n        # Clear section attributes as well\n        Section._initialise(self)\n\n\n    def __repr__(self):\n        def _getval(key):\n            try:\n                return self[key]\n            except MissingInterpolationOption:\n                return dict.__getitem__(self, key)\n        return ('%s({%s})' % (self.__class__.__name__,\n                ', '.join([('%s: %s' % (repr(key), repr(_getval(key))))\n                for key in (self.scalars + self.sections)])))\n\n\n    def _handle_bom(self, infile):\n        \"\"\"\n        Handle any BOM, and decode if necessary.\n\n        If an encoding is specified, that *must* be used - but the BOM should\n        still be removed (and the BOM attribute set).\n\n        (If the encoding is wrongly specified, then a BOM for an alternative\n        encoding won't be discovered or removed.)\n\n        If an encoding is not specified, UTF8 or UTF16 BOM will be detected and\n        removed. The BOM attribute will be set. UTF16 will be decoded to\n        unicode.\n\n        NOTE: This method must not be called with an empty ``infile``.\n\n        Specifying the *wrong* encoding is likely to cause a\n        ``UnicodeDecodeError``.\n\n        ``infile`` must always be returned as a list of lines, but may be\n        passed in as a single string.\n        \"\"\"\n\n        if ((self.encoding is not None) and\n            (self.encoding.lower() not in BOM_LIST)):\n            # No need to check for a BOM\n            # the encoding specified doesn't have one\n            # just decode\n            return self._decode(infile, self.encoding)\n\n        if isinstance(infile, (list, tuple)):\n            line = infile[0]\n        else:\n            line = infile\n\n        if isinstance(line, str):\n            # it's already decoded and there's no need to do anything\n            # else, just use the _decode utility method to handle\n            # listifying appropriately\n            return self._decode(infile, self.encoding)\n\n        if self.encoding is not None:\n            # encoding explicitly supplied\n            # And it could have an associated BOM\n            # TODO: if encoding is just UTF16 - we ought to check for both\n            # TODO: big endian and little endian versions.\n            enc = BOM_LIST[self.encoding.lower()]\n            if enc == 'utf_16':\n                # For UTF16 we try big endian and little endian\n                for BOM, (encoding, final_encoding) in list(BOMS.items()):\n                    if not final_encoding:\n                        # skip UTF8\n                        continue\n                    if infile.startswith(BOM):\n                        ### BOM discovered\n                        ##self.BOM = True\n                        # Don't need to remove BOM\n                        return self._decode(infile, encoding)\n\n                # If we get this far, will *probably* raise a DecodeError\n                # As it doesn't appear to start with a BOM\n                return self._decode(infile, self.encoding)\n\n            # Must be UTF8\n            BOM = BOM_SET[enc]\n            if not line.startswith(BOM):\n                return self._decode(infile, self.encoding)\n\n            newline = line[len(BOM):]\n\n            # BOM removed\n            if isinstance(infile, (list, tuple)):\n                infile[0] = newline\n            else:\n                infile = newline\n            self.BOM = True\n            return self._decode(infile, self.encoding)\n\n        # No encoding specified - so we need to check for UTF8/UTF16\n        for BOM, (encoding, final_encoding) in list(BOMS.items()):\n            if not isinstance(line, bytes) or not line.startswith(BOM):\n                # didn't specify a BOM, or it's not a bytestring\n                continue\n            else:\n                # BOM discovered\n                self.encoding = final_encoding\n                if not final_encoding:\n                    self.BOM = True\n                    # UTF8\n                    # remove BOM\n                    newline = line[len(BOM):]\n                    if isinstance(infile, (list, tuple)):\n                        infile[0] = newline\n                    else:\n                        infile = newline\n                    # UTF-8\n                    if isinstance(infile, str):\n                        return infile.splitlines(True)\n                    elif isinstance(infile, bytes):\n                        return infile.decode('utf-8').splitlines(True)\n                    else:\n                        return self._decode(infile, 'utf-8')\n                # UTF16 - have to decode\n                return self._decode(infile, encoding)\n\n        # No BOM discovered and no encoding specified, default to UTF-8\n        if isinstance(infile, bytes):\n            return infile.decode('utf-8').splitlines(True)\n        else:\n            return self._decode(infile, 'utf-8')\n\n\n    def _a_to_u(self, aString):\n        \"\"\"Decode ASCII strings to unicode if a self.encoding is specified.\"\"\"\n        if isinstance(aString, bytes) and self.encoding:\n            return aString.decode(self.encoding)\n        else:\n            return aString\n\n\n    def _decode(self, infile, encoding):\n        \"\"\"\n        Decode infile to unicode. Using the specified encoding.\n\n        if is a string, it also needs converting to a list.\n        \"\"\"\n        if isinstance(infile, str):\n            return infile.splitlines(True)\n        if isinstance(infile, bytes):\n            # NOTE: Could raise a ``UnicodeDecodeError``\n            if encoding:\n                return infile.decode(encoding).splitlines(True)\n            else:\n                return infile.splitlines(True)\n\n        if encoding:\n            for i, line in enumerate(infile):\n                if isinstance(line, bytes):\n                    # NOTE: The isinstance test here handles mixed lists of unicode/string\n                    # NOTE: But the decode will break on any non-string values\n                    # NOTE: Or could raise a ``UnicodeDecodeError``\n                    infile[i] = line.decode(encoding)\n        return infile\n\n\n    def _decode_element(self, line):\n        \"\"\"Decode element to unicode if necessary.\"\"\"\n        if isinstance(line, bytes) and self.default_encoding:\n            return line.decode(self.default_encoding)\n        else:\n            return line\n\n\n    # TODO: this may need to be modified\n    def _str(self, value):\n        \"\"\"\n        Used by ``stringify`` within validate, to turn non-string values\n        into strings.\n        \"\"\"\n        if not isinstance(value, str):\n            # intentially 'str' because it's just whatever the \"normal\"\n            # string type is for the python version we're dealing with\n            return str(value)\n        else:\n            return value\n\n\n    def _parse(self, infile):\n        \"\"\"Actually parse the config file.\"\"\"\n        temp_list_values = self.list_values\n        if self.unrepr:\n            self.list_values = False\n\n        comment_list = []\n        done_start = False\n        this_section = self\n        maxline = len(infile) - 1\n        cur_index = -1\n        reset_comment = False\n\n        while cur_index < maxline:\n            if reset_comment:\n                comment_list = []\n            cur_index += 1\n            line = infile[cur_index]\n            sline = line.strip()\n            # do we have anything on the line ?\n            if not sline or sline.startswith('#'):\n                reset_comment = False\n                comment_list.append(line)\n                continue\n\n            if not done_start:\n                # preserve initial comment\n                self.initial_comment = comment_list\n                comment_list = []\n                done_start = True\n\n            reset_comment = True\n            # first we check if it's a section marker\n            mat = self._sectionmarker.match(line)\n            if mat is not None:\n                # is a section line\n                (indent, sect_open, sect_name, sect_close, comment) = mat.groups()\n                if indent and (self.indent_type is None):\n                    self.indent_type = indent\n                cur_depth = sect_open.count('[')\n                if cur_depth != sect_close.count(']'):\n                    self._handle_error(\"Cannot compute the section depth\",\n                                       NestingError, infile, cur_index)\n                    continue\n\n                if cur_depth < this_section.depth:\n                    # the new section is dropping back to a previous level\n                    try:\n                        parent = self._match_depth(this_section,\n                                                   cur_depth).parent\n                    except SyntaxError:\n                        self._handle_error(\"Cannot compute nesting level\",\n                                           NestingError, infile, cur_index)\n                        continue\n                elif cur_depth == this_section.depth:\n                    # the new section is a sibling of the current section\n                    parent = this_section.parent\n                elif cur_depth == this_section.depth + 1:\n                    # the new section is a child the current section\n                    parent = this_section\n                else:\n                    self._handle_error(\"Section too nested\",\n                                       NestingError, infile, cur_index)\n                    continue\n\n                sect_name = self._unquote(sect_name)\n                if sect_name in parent:\n                    self._handle_error('Duplicate section name',\n                                       DuplicateError, infile, cur_index)\n                    continue\n\n                # create the new section\n                this_section = Section(\n                    parent,\n                    cur_depth,\n                    self,\n                    name=sect_name)\n                parent[sect_name] = this_section\n                parent.inline_comments[sect_name] = comment\n                parent.comments[sect_name] = comment_list\n                continue\n            #\n            # it's not a section marker,\n            # so it should be a valid ``key = value`` line\n            mat = self._keyword.match(line)\n            if mat is None:\n                self._handle_error(\n                    'Invalid line ({0!r}) (matched as neither section nor keyword)'.format(line),\n                    ParseError, infile, cur_index)\n            else:\n                # is a keyword value\n                # value will include any inline comment\n                (indent, key, value) = mat.groups()\n                if indent and (self.indent_type is None):\n                    self.indent_type = indent\n                # check for a multiline value\n                if value[:3] in ['\"\"\"', \"'''\"]:\n                    try:\n                        value, comment, cur_index = self._multiline(\n                            value, infile, cur_index, maxline)\n                    except SyntaxError:\n                        self._handle_error(\n                            'Parse error in multiline value',\n                            ParseError, infile, cur_index)\n                        continue\n                    else:\n                        if self.unrepr:\n                            comment = ''\n                            try:\n                                value = unrepr(value)\n                            except Exception as e:\n                                if type(e) == UnknownType:\n                                    msg = 'Unknown name or type in value'\n                                else:\n                                    msg = 'Parse error from unrepr-ing multiline value'\n                                self._handle_error(msg, UnreprError, infile,\n                                    cur_index)\n                                continue\n                else:\n                    if self.unrepr:\n                        comment = ''\n                        try:\n                            value = unrepr(value)\n                        except Exception as e:\n                            if isinstance(e, UnknownType):\n                                msg = 'Unknown name or type in value'\n                            else:\n                                msg = 'Parse error from unrepr-ing value'\n                            self._handle_error(msg, UnreprError, infile,\n                                cur_index)\n                            continue\n                    else:\n                        # extract comment and lists\n                        try:\n                            (value, comment) = self._handle_value(value)\n                        except SyntaxError:\n                            self._handle_error(\n                                'Parse error in value',\n                                ParseError, infile, cur_index)\n                            continue\n                #\n                key = self._unquote(key)\n                if key in this_section:\n                    self._handle_error(\n                        'Duplicate keyword name',\n                        DuplicateError, infile, cur_index)\n                    continue\n                # add the key.\n                # we set unrepr because if we have got this far we will never\n                # be creating a new section\n                this_section.__setitem__(key, value, unrepr=True)\n                this_section.inline_comments[key] = comment\n                this_section.comments[key] = comment_list\n                continue\n        #\n        if self.indent_type is None:\n            # no indentation used, set the type accordingly\n            self.indent_type = ''\n\n        # preserve the final comment\n        if not self and not self.initial_comment:\n            self.initial_comment = comment_list\n        elif not reset_comment:\n            self.final_comment = comment_list\n        self.list_values = temp_list_values\n\n\n    def _match_depth(self, sect, depth):\n        \"\"\"\n        Given a section and a depth level, walk back through the sections\n        parents to see if the depth level matches a previous section.\n\n        Return a reference to the right section,\n        or raise a SyntaxError.\n        \"\"\"\n        while depth < sect.depth:\n            if sect is sect.parent:\n                # we've reached the top level already\n                raise SyntaxError()\n            sect = sect.parent\n        if sect.depth == depth:\n            return sect\n        # shouldn't get here\n        raise SyntaxError()\n\n\n    def _handle_error(self, text, ErrorClass, infile, cur_index):\n        \"\"\"\n        Handle an error according to the error settings.\n\n        Either raise the error or store it.\n        The error will have occured at ``cur_index``\n        \"\"\"\n        line = infile[cur_index]\n        cur_index += 1\n        message = '{0} at line {1}.'.format(text, cur_index)\n        error = ErrorClass(message, cur_index, line)\n        if self.raise_errors:\n            # raise the error - parsing stops here\n            raise error\n        # store the error\n        # reraise when parsing has finished\n        self._errors.append(error)\n\n\n    def _unquote(self, value):\n        \"\"\"Return an unquoted version of a value\"\"\"\n        if not value:\n            # should only happen during parsing of lists\n            raise SyntaxError\n        if (value[0] == value[-1]) and (value[0] in ('\"', \"'\")):\n            value = value[1:-1]\n        return value\n\n\n    def _quote(self, value, multiline=True):\n        \"\"\"\n        Return a safely quoted version of a value.\n\n        Raise a ConfigObjError if the value cannot be safely quoted.\n        If multiline is ``True`` (default) then use triple quotes\n        if necessary.\n\n        * Don't quote values that don't need it.\n        * Recursively quote members of a list and return a comma joined list.\n        * Multiline is ``False`` for lists.\n        * Obey list syntax for empty and single member lists.\n\n        If ``list_values=False`` then the value is only quoted if it contains\n        a ``\\\\n`` (is multiline) or '#'.\n\n        If ``write_empty_values`` is set, and the value is an empty string, it\n        won't be quoted.\n        \"\"\"\n        if multiline and self.write_empty_values and value == '':\n            # Only if multiline is set, so that it is used for values not\n            # keys, and not values that are part of a list\n            return ''\n\n        if multiline and isinstance(value, (list, tuple)):\n            if not value:\n                return ','\n            elif len(value) == 1:\n                return self._quote(value[0], multiline=False) + ','\n            return ', '.join([self._quote(val, multiline=False)\n                for val in value])\n        if not isinstance(value, str):\n            if self.stringify:\n                # intentially 'str' because it's just whatever the \"normal\"\n                # string type is for the python version we're dealing with\n                value = str(value)\n            else:\n                raise TypeError('Value \"%s\" is not a string.' % value)\n\n        if not value:\n            return '\"\"'\n\n        no_lists_no_quotes = not self.list_values and '\\n' not in value and '#' not in value\n        need_triple = multiline and (((\"'\" in value) and ('\"' in value)) or ('\\n' in value ))\n        hash_triple_quote = multiline and not need_triple and (\"'\" in value) and ('\"' in value) and ('#' in value)\n        check_for_single = (no_lists_no_quotes or not need_triple) and not hash_triple_quote\n\n        if check_for_single:\n            if not self.list_values:\n                # we don't quote if ``list_values=False``\n                quot = noquot\n            # for normal values either single or double quotes will do\n            elif '\\n' in value:\n                # will only happen if multiline is off - e.g. '\\n' in key\n                raise ConfigObjError('Value \"%s\" cannot be safely quoted.' % value)\n            elif ((value[0] not in wspace_plus) and\n                    (value[-1] not in wspace_plus) and\n                    (',' not in value)):\n                quot = noquot\n            else:\n                quot = self._get_single_quote(value)\n        else:\n            # if value has '\\n' or \"'\" *and* '\"', it will need triple quotes\n            quot = self._get_triple_quote(value)\n\n        if quot == noquot and '#' in value and self.list_values:\n            quot = self._get_single_quote(value)\n\n        return quot % value\n\n\n    def _get_single_quote(self, value):\n        if (\"'\" in value) and ('\"' in value):\n            raise ConfigObjError('Value \"%s\" cannot be safely quoted.' % value)\n        elif '\"' in value:\n            quot = squot\n        else:\n            quot = dquot\n        return quot\n\n\n    def _get_triple_quote(self, value):\n        if (value.find('\"\"\"') != -1) and (value.find(\"'''\") != -1):\n            raise ConfigObjError('Value \"%s\" cannot be safely quoted.' % value)\n        if value.find('\"\"\"') == -1:\n            quot = tdquot\n        else:\n            quot = tsquot\n        return quot\n\n\n    def _handle_value(self, value):\n        \"\"\"\n        Given a value string, unquote, remove comment,\n        handle lists. (including empty and single member lists)\n        \"\"\"\n        if self._inspec:\n            # Parsing a configspec so don't handle comments\n            return (value, '')\n        # do we look for lists in values ?\n        if not self.list_values:\n            mat = self._nolistvalue.match(value)\n            if mat is None:\n                raise SyntaxError()\n            # NOTE: we don't unquote here\n            return mat.groups()\n        #\n        mat = self._valueexp.match(value)\n        if mat is None:\n            # the value is badly constructed, probably badly quoted,\n            # or an invalid list\n            raise SyntaxError()\n        (list_values, single, empty_list, comment) = mat.groups()\n        if (list_values == '') and (single is None):\n            # change this if you want to accept empty values\n            raise SyntaxError()\n        # NOTE: note there is no error handling from here if the regex\n        # is wrong: then incorrect values will slip through\n        if empty_list is not None:\n            # the single comma - meaning an empty list\n            return ([], comment)\n        if single is not None:\n            # handle empty values\n            if list_values and not single:\n                # FIXME: the '' is a workaround because our regex now matches\n                #   '' at the end of a list if it has a trailing comma\n                single = None\n            else:\n                single = single or '\"\"'\n                single = self._unquote(single)\n        if list_values == '':\n            # not a list value\n            return (single, comment)\n        the_list = self._listvalueexp.findall(list_values)\n        the_list = [self._unquote(val) for val in the_list]\n        if single is not None:\n            the_list += [single]\n        return (the_list, comment)\n\n\n    def _multiline(self, value, infile, cur_index, maxline):\n        \"\"\"Extract the value, where we are in a multiline situation.\"\"\"\n        quot = value[:3]\n        newvalue = value[3:]\n        single_line = self._triple_quote[quot][0]\n        multi_line = self._triple_quote[quot][1]\n        mat = single_line.match(value)\n        if mat is not None:\n            retval = list(mat.groups())\n            retval.append(cur_index)\n            return retval\n        elif newvalue.find(quot) != -1:\n            # somehow the triple quote is missing\n            raise SyntaxError()\n        #\n        while cur_index < maxline:\n            cur_index += 1\n            newvalue += '\\n'\n            line = infile[cur_index]\n            if line.find(quot) == -1:\n                newvalue += line\n            else:\n                # end of multiline, process it\n                break\n        else:\n            # we've got to the end of the config, oops...\n            raise SyntaxError()\n        mat = multi_line.match(line)\n        if mat is None:\n            # a badly formed line\n            raise SyntaxError()\n        (value, comment) = mat.groups()\n        return (newvalue + value, comment, cur_index)\n\n\n    def _handle_configspec(self, configspec):\n        \"\"\"Parse the configspec.\"\"\"\n        # FIXME: Should we check that the configspec was created with the\n        #        correct settings ? (i.e. ``list_values=False``)\n        if not isinstance(configspec, ConfigObj):\n            try:\n                configspec = ConfigObj(configspec,\n                                       raise_errors=True,\n                                       file_error=True,\n                                       _inspec=True)\n            except ConfigObjError as e:\n                # FIXME: Should these errors have a reference\n                #        to the already parsed ConfigObj ?\n                raise ConfigspecError('Parsing configspec failed: %s' % e)\n            except IOError as e:\n                raise IOError('Reading configspec failed: %s' % e)\n\n        self.configspec = configspec\n\n\n\n    def _set_configspec(self, section, copy):\n        \"\"\"\n        Called by validate. Handles setting the configspec on subsections\n        including sections to be validated by __many__\n        \"\"\"\n        configspec = section.configspec\n        many = configspec.get('__many__')\n        if isinstance(many, dict):\n            for entry in section.sections:\n                if entry not in configspec:\n                    section[entry].configspec = many\n\n        for entry in configspec.sections:\n            if entry == '__many__':\n                continue\n            if entry not in section:\n                section[entry] = {}\n                section[entry]._created = True\n                if copy:\n                    # copy comments\n                    section.comments[entry] = configspec.comments.get(entry, [])\n                    section.inline_comments[entry] = configspec.inline_comments.get(entry, '')\n\n            # Could be a scalar when we expect a section\n            if isinstance(section[entry], Section):\n                section[entry].configspec = configspec[entry]\n\n\n    def _write_line(self, indent_string, entry, this_entry, comment):\n        \"\"\"Write an individual line, for the write method\"\"\"\n        # NOTE: the calls to self._quote here handles non-StringType values.\n        if not self.unrepr:\n            val = self._decode_element(self._quote(this_entry))\n        else:\n            val = repr(this_entry)\n        return '%s%s%s%s%s' % (indent_string,\n                               self._decode_element(self._quote(entry, multiline=False)),\n                               self._a_to_u(' = '),\n                               val,\n                               self._decode_element(comment))\n\n\n    def _write_marker(self, indent_string, depth, entry, comment):\n        \"\"\"Write a section marker line\"\"\"\n        return '%s%s%s%s%s' % (indent_string,\n                               self._a_to_u('[' * depth),\n                               self._quote(self._decode_element(entry), multiline=False),\n                               self._a_to_u(']' * depth),\n                               self._decode_element(comment))\n\n\n    def _handle_comment(self, comment):\n        \"\"\"Deal with a comment.\"\"\"\n        if not comment:\n            return ''\n        start = self.indent_type\n        if not comment.startswith('#'):\n            start += self._a_to_u(' # ')\n        return (start + comment)\n\n\n    # Public methods\n\n    def write(self, outfile=None, section=None):\n        \"\"\"\n        Write the current ConfigObj as a file\n\n        tekNico: FIXME: use StringIO instead of real files\n\n        >>> filename = a.filename\n        >>> a.filename = 'test.ini'\n        >>> a.write()\n        >>> a.filename = filename\n        >>> a == ConfigObj('test.ini', raise_errors=True)\n        1\n        >>> import os\n        >>> os.remove('test.ini')\n        \"\"\"\n        if self.indent_type is None:\n            # this can be true if initialised from a dictionary\n            self.indent_type = DEFAULT_INDENT_TYPE\n\n        out = []\n        cs = self._a_to_u('#')\n        csp = self._a_to_u('# ')\n        if section is None:\n            int_val = self.interpolation\n            self.interpolation = False\n            section = self\n            for line in self.initial_comment:\n                line = self._decode_element(line)\n                stripped_line = line.strip()\n                if stripped_line and not stripped_line.startswith(cs):\n                    line = csp + line\n                out.append(line)\n\n        indent_string = self.indent_type * section.depth\n        for entry in (section.scalars + section.sections):\n            if entry in section.defaults:\n                # don't write out default values\n                continue\n            for comment_line in section.comments[entry]:\n                comment_line = self._decode_element(comment_line.lstrip())\n                if comment_line and not comment_line.startswith(cs):\n                    comment_line = csp + comment_line\n                out.append(indent_string + comment_line)\n            this_entry = section[entry]\n            comment = self._handle_comment(section.inline_comments[entry])\n\n            if isinstance(this_entry, Section):\n                # a section\n                out.append(self._write_marker(\n                    indent_string,\n                    this_entry.depth,\n                    entry,\n                    comment))\n                out.extend(self.write(section=this_entry))\n            else:\n                out.append(self._write_line(\n                    indent_string,\n                    entry,\n                    this_entry,\n                    comment))\n\n        if section is self:\n            for line in self.final_comment:\n                line = self._decode_element(line)\n                stripped_line = line.strip()\n                if stripped_line and not stripped_line.startswith(cs):\n                    line = csp + line\n                out.append(line)\n            self.interpolation = int_val\n\n        if section is not self:\n            return out\n\n        if (self.filename is None) and (outfile is None):\n            # output a list of lines\n            # might need to encode\n            # NOTE: This will *screw* UTF16, each line will start with the BOM\n            if self.encoding:\n                out = [l.encode(self.encoding) for l in out]\n            if (self.BOM and ((self.encoding is None) or\n                (BOM_LIST.get(self.encoding.lower()) == 'utf_8'))):\n                # Add the UTF8 BOM\n                if not out:\n                    out.append('')\n                out[0] = BOM_UTF8 + out[0]\n            return out\n\n        # Turn the list to a string, joined with correct newlines\n        newline = self.newlines or os.linesep\n        if (getattr(outfile, 'mode', None) is not None and outfile.mode == 'w'\n            and sys.platform == 'win32' and newline == '\\r\\n'):\n            # Windows specific hack to avoid writing '\\r\\r\\n'\n            newline = '\\n'\n        output = self._a_to_u(newline).join(out)\n        if not output.endswith(newline):\n            output += newline\n\n        if isinstance(output, bytes):\n            output_bytes = output\n        else:\n            output_bytes = output.encode(self.encoding or\n                                         self.default_encoding or\n                                         'ascii')\n\n        if self.BOM and ((self.encoding is None) or match_utf8(self.encoding)):\n            # Add the UTF8 BOM\n            output_bytes = BOM_UTF8 + output_bytes\n\n        if outfile is not None:\n            outfile.write(output_bytes)\n        else:\n            with open(self.filename, 'wb') as h:\n                h.write(output_bytes)\n\n    def validate(self, validator, preserve_errors=False, copy=False,\n                 section=None):\n        \"\"\"\n        Test the ConfigObj against a configspec.\n\n        It uses the ``validator`` object from *validate.py*.\n\n        To run ``validate`` on the current ConfigObj, call: ::\n\n            test = config.validate(validator)\n\n        (Normally having previously passed in the configspec when the ConfigObj\n        was created - you can dynamically assign a dictionary of checks to the\n        ``configspec`` attribute of a section though).\n\n        It returns ``True`` if everything passes, or a dictionary of\n        pass/fails (True/False). If every member of a subsection passes, it\n        will just have the value ``True``. (It also returns ``False`` if all\n        members fail).\n\n        In addition, it converts the values from strings to their native\n        types if their checks pass (and ``stringify`` is set).\n\n        If ``preserve_errors`` is ``True`` (``False`` is default) then instead\n        of a marking a fail with a ``False``, it will preserve the actual\n        exception object. This can contain info about the reason for failure.\n        For example the ``VdtValueTooSmallError`` indicates that the value\n        supplied was too small. If a value (or section) is missing it will\n        still be marked as ``False``.\n\n        You must have the validate module to use ``preserve_errors=True``.\n\n        You can then use the ``flatten_errors`` function to turn your nested\n        results dictionary into a flattened list of failures - useful for\n        displaying meaningful error messages.\n        \"\"\"\n        if section is None:\n            if self.configspec is None:\n                raise ValueError('No configspec supplied.')\n            if preserve_errors:\n                # We do this once to remove a top level dependency on the validate module\n                # Which makes importing configobj faster\n                from .validate import VdtMissingValue\n                self._vdtMissingValue = VdtMissingValue\n\n            section = self\n\n            if copy:\n                section.initial_comment = section.configspec.initial_comment\n                section.final_comment = section.configspec.final_comment\n                section.encoding = section.configspec.encoding\n                section.BOM = section.configspec.BOM\n                section.newlines = section.configspec.newlines\n                section.indent_type = section.configspec.indent_type\n\n        #\n        # section.default_values.clear() #??\n        configspec = section.configspec\n        self._set_configspec(section, copy)\n\n\n        def validate_entry(entry, spec, val, missing, ret_true, ret_false):\n            section.default_values.pop(entry, None)\n\n            try:\n                section.default_values[entry] = validator.get_default_value(configspec[entry])\n            except (KeyError, AttributeError, validator.baseErrorClass):\n                # No default, bad default or validator has no 'get_default_value'\n                # (e.g. SimpleVal)\n                pass\n\n            try:\n                check = validator.check(spec,\n                                        val,\n                                        missing=missing\n                                        )\n            except validator.baseErrorClass as e:\n                if not preserve_errors or isinstance(e, self._vdtMissingValue):\n                    out[entry] = False\n                else:\n                    # preserve the error\n                    out[entry] = e\n                    ret_false = False\n                ret_true = False\n            else:\n                ret_false = False\n                out[entry] = True\n                if self.stringify or missing:\n                    # if we are doing type conversion\n                    # or the value is a supplied default\n                    if not self.stringify:\n                        if isinstance(check, (list, tuple)):\n                            # preserve lists\n                            check = [self._str(item) for item in check]\n                        elif missing and check is None:\n                            # convert the None from a default to a ''\n                            check = ''\n                        else:\n                            check = self._str(check)\n                    if (check != val) or missing:\n                        section[entry] = check\n                if not copy and missing and entry not in section.defaults:\n                    section.defaults.append(entry)\n            return ret_true, ret_false\n\n        #\n        out = {}\n        ret_true = True\n        ret_false = True\n\n        unvalidated = [k for k in section.scalars if k not in configspec]\n        incorrect_sections = [k for k in configspec.sections if k in section.scalars]\n        incorrect_scalars = [k for k in configspec.scalars if k in section.sections]\n\n        for entry in configspec.scalars:\n            if entry in ('__many__', '___many___'):\n                # reserved names\n                continue\n            if (not entry in section.scalars) or (entry in section.defaults):\n                # missing entries\n                # or entries from defaults\n                missing = True\n                val = None\n                if copy and entry not in section.scalars:\n                    # copy comments\n                    section.comments[entry] = (\n                        configspec.comments.get(entry, []))\n                    section.inline_comments[entry] = (\n                        configspec.inline_comments.get(entry, ''))\n                #\n            else:\n                missing = False\n                val = section[entry]\n\n            ret_true, ret_false = validate_entry(entry, configspec[entry], val,\n                                                 missing, ret_true, ret_false)\n\n        many = None\n        if '__many__' in configspec.scalars:\n            many = configspec['__many__']\n        elif '___many___' in configspec.scalars:\n            many = configspec['___many___']\n\n        if many is not None:\n            for entry in unvalidated:\n                val = section[entry]\n                ret_true, ret_false = validate_entry(entry, many, val, False,\n                                                     ret_true, ret_false)\n            unvalidated = []\n\n        for entry in incorrect_scalars:\n            ret_true = False\n            if not preserve_errors:\n                out[entry] = False\n            else:\n                ret_false = False\n                msg = 'Value %r was provided as a section' % entry\n                out[entry] = validator.baseErrorClass(msg)\n        for entry in incorrect_sections:\n            ret_true = False\n            if not preserve_errors:\n                out[entry] = False\n            else:\n                ret_false = False\n                msg = 'Section %r was provided as a single value' % entry\n                out[entry] = validator.baseErrorClass(msg)\n\n        # Missing sections will have been created as empty ones when the\n        # configspec was read.\n        for entry in section.sections:\n            # FIXME: this means DEFAULT is not copied in copy mode\n            if section is self and entry == 'DEFAULT':\n                continue\n            if section[entry].configspec is None:\n                unvalidated.append(entry)\n                continue\n            if copy:\n                section.comments[entry] = configspec.comments.get(entry, [])\n                section.inline_comments[entry] = configspec.inline_comments.get(entry, '')\n            check = self.validate(validator, preserve_errors=preserve_errors, copy=copy, section=section[entry])\n            out[entry] = check\n            if check == False:\n                ret_true = False\n            elif check == True:\n                ret_false = False\n            else:\n                ret_true = False\n\n        section.extra_values = unvalidated\n        if preserve_errors and not section._created:\n            # If the section wasn't created (i.e. it wasn't missing)\n            # then we can't return False, we need to preserve errors\n            ret_false = False\n        #\n        if ret_false and preserve_errors and out:\n            # If we are preserving errors, but all\n            # the failures are from missing sections / values\n            # then we can return False. Otherwise there is a\n            # real failure that we need to preserve.\n            ret_false = not any(out.values())\n        if ret_true:\n            return True\n        elif ret_false:\n            return False\n        return out\n\n\n    def reset(self):\n        \"\"\"Clear ConfigObj instance and restore to 'freshly created' state.\"\"\"\n        self.clear()\n        self._initialise()\n        # FIXME: Should be done by '_initialise', but ConfigObj constructor (and reload)\n        #        requires an empty dictionary\n        self.configspec = None\n        # Just to be sure ;-)\n        self._original_configspec = None\n\n\n    def reload(self):\n        \"\"\"\n        Reload a ConfigObj from file.\n\n        This method raises a ``ReloadError`` if the ConfigObj doesn't have\n        a filename attribute pointing to a file.\n        \"\"\"\n        if not isinstance(self.filename, str):\n            raise ReloadError()\n\n        filename = self.filename\n        current_options = {}\n        for entry in OPTION_DEFAULTS:\n            if entry == 'configspec':\n                continue\n            current_options[entry] = getattr(self, entry)\n\n        configspec = self._original_configspec\n        current_options['configspec'] = configspec\n\n        self.clear()\n        self._initialise(current_options)\n        self._load(filename, configspec)\n\n\n\nclass SimpleVal(object):\n    \"\"\"\n    A simple validator.\n    Can be used to check that all members expected are present.\n\n    To use it, provide a configspec with all your members in (the value given\n    will be ignored). Pass an instance of ``SimpleVal`` to the ``validate``\n    method of your ``ConfigObj``. ``validate`` will return ``True`` if all\n    members are present, or a dictionary with True/False meaning\n    present/missing. (Whole missing sections will be replaced with ``False``)\n    \"\"\"\n\n    def __init__(self):\n        self.baseErrorClass = ConfigObjError\n\n    def check(self, check, member, missing=False):\n        \"\"\"A dummy check method, always returns the value unchanged.\"\"\"\n        if missing:\n            raise self.baseErrorClass()\n        return member\n\n\ndef flatten_errors(cfg, res, levels=None, results=None):\n    \"\"\"\n    An example function that will turn a nested dictionary of results\n    (as returned by ``ConfigObj.validate``) into a flat list.\n\n    ``cfg`` is the ConfigObj instance being checked, ``res`` is the results\n    dictionary returned by ``validate``.\n\n    (This is a recursive function, so you shouldn't use the ``levels`` or\n    ``results`` arguments - they are used by the function.)\n\n    Returns a list of keys that failed. Each member of the list is a tuple::\n\n        ([list of sections...], key, result)\n\n    If ``validate`` was called with ``preserve_errors=False`` (the default)\n    then ``result`` will always be ``False``.\n\n    *list of sections* is a flattened list of sections that the key was found\n    in.\n\n    If the section was missing (or a section was expected and a scalar provided\n    - or vice-versa) then key will be ``None``.\n\n    If the value (or section) was missing then ``result`` will be ``False``.\n\n    If ``validate`` was called with ``preserve_errors=True`` and a value\n    was present, but failed the check, then ``result`` will be the exception\n    object returned. You can use this as a string that describes the failure.\n\n    For example *The value \"3\" is of the wrong type*.\n    \"\"\"\n    if levels is None:\n        # first time called\n        levels = []\n        results = []\n    if res == True:\n        return sorted(results)\n    if res == False or isinstance(res, Exception):\n        results.append((levels[:], None, res))\n        if levels:\n            levels.pop()\n        return sorted(results)\n    for (key, val) in list(res.items()):\n        if val == True:\n            continue\n        if isinstance(cfg.get(key), Mapping):\n            # Go down one level\n            levels.append(key)\n            flatten_errors(cfg[key], val, levels, results)\n            continue\n        results.append((levels[:], key, val))\n    #\n    # Go up one level\n    if levels:\n        levels.pop()\n    #\n    return sorted(results)\n\n\ndef get_extra_values(conf, _prepend=()):\n    \"\"\"\n    Find all the values and sections not in the configspec from a validated\n    ConfigObj.\n\n    ``get_extra_values`` returns a list of tuples where each tuple represents\n    either an extra section, or an extra value.\n\n    The tuples contain two values, a tuple representing the section the value\n    is in and the name of the extra values. For extra values in the top level\n    section the first member will be an empty tuple. For values in the 'foo'\n    section the first member will be ``('foo',)``. For members in the 'bar'\n    subsection of the 'foo' section the first member will be ``('foo', 'bar')``.\n\n    NOTE: If you call ``get_extra_values`` on a ConfigObj instance that hasn't\n    been validated it will return an empty list.\n    \"\"\"\n    out = []\n\n    out.extend([(_prepend, name) for name in conf.extra_values])\n    for name in conf.sections:\n        if name not in conf.extra_values:\n            out.extend(get_extra_values(conf[name], _prepend + (name,)))\n    return out\n\n\n\"\"\"*A programming language is a medium of expression.* - Paul Graham\"\"\"\n"},{"className":"UnknownType","col":0,"comment":"null","endLoc":136,"id":11555,"nodeType":"Class","startLoc":135,"text":"class UnknownType(Exception):\n    pass"},{"className":"Builder","col":0,"comment":"null","endLoc":191,"id":11556,"nodeType":"Class","startLoc":139,"text":"class Builder(object):\n\n    def build(self, o):\n        if m is None:\n            raise UnknownType(o.__class__.__name__)\n        return m(o)\n\n    def build_List(self, o):\n        return list(map(self.build, o.getChildren()))\n\n    def build_Const(self, o):\n        return o.value\n\n    def build_Dict(self, o):\n        d = {}\n        i = iter(map(self.build, o.getChildren()))\n        for el in i:\n            d[el] = next(i)\n        return d\n\n    def build_Tuple(self, o):\n        return tuple(self.build_List(o))\n\n    def build_Name(self, o):\n        if o.name == 'None':\n            return None\n        if o.name == 'True':\n            return True\n        if o.name == 'False':\n            return False\n\n        # An undefined Name\n        raise UnknownType('Undefined Name')\n\n    def build_Add(self, o):\n        real, imag = list(map(self.build_Const, o.getChildren()))\n        try:\n            real = float(real)\n        except TypeError:\n            raise UnknownType('Add')\n        if not isinstance(imag, complex) or imag.real != 0.0:\n            raise UnknownType('Add')\n        return real+imag\n\n    def build_Getattr(self, o):\n        parent = self.build(o.expr)\n        return getattr(parent, o.attrname)\n\n    def build_UnarySub(self, o):\n        return -self.build_Const(o.getChildren()[0])\n\n    def build_UnaryAdd(self, o):\n        return self.build_Const(o.getChildren()[0])"},{"col":4,"comment":"null","endLoc":144,"header":"def build(self, o)","id":11557,"name":"build","nodeType":"Function","startLoc":141,"text":"def build(self, o):\n        if m is None:\n            raise UnknownType(o.__class__.__name__)\n        return m(o)"},{"col":0,"comment":"\n    A check that tests that a given value is an integer (int, or long)\n    and optionally, between bounds. A negative value is accepted, while\n    a float will fail.\n\n    If the value is a string, then the conversion is done - if possible.\n    Otherwise a VdtError is raised.\n\n    >>> vtor.check('integer', '-1')\n    -1\n    >>> vtor.check('integer', '0')\n    0\n    >>> vtor.check('integer', 9)\n    9\n    >>> vtor.check('integer', 'a')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"a\" is of the wrong type.\n    >>> vtor.check('integer', '2.2')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"2.2\" is of the wrong type.\n    >>> vtor.check('integer(10)', '20')\n    20\n    >>> vtor.check('integer(max=20)', '15')\n    15\n    >>> vtor.check('integer(10)', '9')\n    Traceback (most recent call last):\n    VdtValueTooSmallError: the value \"9\" is too small.\n    >>> vtor.check('integer(10)', 9)\n    Traceback (most recent call last):\n    VdtValueTooSmallError: the value \"9\" is too small.\n    >>> vtor.check('integer(max=20)', '35')\n    Traceback (most recent call last):\n    VdtValueTooBigError: the value \"35\" is too big.\n    >>> vtor.check('integer(max=20)', 35)\n    Traceback (most recent call last):\n    VdtValueTooBigError: the value \"35\" is too big.\n    >>> vtor.check('integer(0, 9)', False)\n    0\n    ","endLoc":836,"header":"def is_integer(value, min=None, max=None)","id":11558,"name":"is_integer","nodeType":"Function","startLoc":783,"text":"def is_integer(value, min=None, max=None):\n    \"\"\"\n    A check that tests that a given value is an integer (int, or long)\n    and optionally, between bounds. A negative value is accepted, while\n    a float will fail.\n\n    If the value is a string, then the conversion is done - if possible.\n    Otherwise a VdtError is raised.\n\n    >>> vtor.check('integer', '-1')\n    -1\n    >>> vtor.check('integer', '0')\n    0\n    >>> vtor.check('integer', 9)\n    9\n    >>> vtor.check('integer', 'a')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"a\" is of the wrong type.\n    >>> vtor.check('integer', '2.2')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"2.2\" is of the wrong type.\n    >>> vtor.check('integer(10)', '20')\n    20\n    >>> vtor.check('integer(max=20)', '15')\n    15\n    >>> vtor.check('integer(10)', '9')\n    Traceback (most recent call last):\n    VdtValueTooSmallError: the value \"9\" is too small.\n    >>> vtor.check('integer(10)', 9)\n    Traceback (most recent call last):\n    VdtValueTooSmallError: the value \"9\" is too small.\n    >>> vtor.check('integer(max=20)', '35')\n    Traceback (most recent call last):\n    VdtValueTooBigError: the value \"35\" is too big.\n    >>> vtor.check('integer(max=20)', 35)\n    Traceback (most recent call last):\n    VdtValueTooBigError: the value \"35\" is too big.\n    >>> vtor.check('integer(0, 9)', False)\n    0\n    \"\"\"\n    (min_val, max_val) = _is_num_param(('min', 'max'), (min, max))\n    if not isinstance(value, (int, long, string_type)):\n        raise VdtTypeError(value)\n    if isinstance(value, string_type):\n        # if it's a string - does it represent an integer ?\n        try:\n            value = int(value)\n        except ValueError:\n            raise VdtTypeError(value)\n    if (min_val is not None) and (value < min_val):\n        raise VdtValueTooSmallError(value)\n    if (max_val is not None) and (value > max_val):\n        raise VdtValueTooBigError(value)\n    return value"},{"col":4,"comment":"null","endLoc":147,"header":"def build_List(self, o)","id":11559,"name":"build_List","nodeType":"Function","startLoc":146,"text":"def build_List(self, o):\n        return list(map(self.build, o.getChildren()))"},{"col":4,"comment":"null","endLoc":150,"header":"def build_Const(self, o)","id":11560,"name":"build_Const","nodeType":"Function","startLoc":149,"text":"def build_Const(self, o):\n        return o.value"},{"col":4,"comment":"null","endLoc":157,"header":"def build_Dict(self, o)","id":11561,"name":"build_Dict","nodeType":"Function","startLoc":152,"text":"def build_Dict(self, o):\n        d = {}\n        i = iter(map(self.build, o.getChildren()))\n        for el in i:\n            d[el] = next(i)\n        return d"},{"col":4,"comment":"null","endLoc":160,"header":"def build_Tuple(self, o)","id":11562,"name":"build_Tuple","nodeType":"Function","startLoc":159,"text":"def build_Tuple(self, o):\n        return tuple(self.build_List(o))"},{"col":4,"comment":"null","endLoc":171,"header":"def build_Name(self, o)","id":11563,"name":"build_Name","nodeType":"Function","startLoc":162,"text":"def build_Name(self, o):\n        if o.name == 'None':\n            return None\n        if o.name == 'True':\n            return True\n        if o.name == 'False':\n            return False\n\n        # An undefined Name\n        raise UnknownType('Undefined Name')"},{"col":4,"comment":"null","endLoc":181,"header":"def build_Add(self, o)","id":11564,"name":"build_Add","nodeType":"Function","startLoc":173,"text":"def build_Add(self, o):\n        real, imag = list(map(self.build_Const, o.getChildren()))\n        try:\n            real = float(real)\n        except TypeError:\n            raise UnknownType('Add')\n        if not isinstance(imag, complex) or imag.real != 0.0:\n            raise UnknownType('Add')\n        return real+imag"},{"col":23,"endLoc":721,"id":11565,"nodeType":"Lambda","startLoc":721,"text":"lambda x: x[1].__code__.co_firstlineno"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":11566,"name":"__all__","nodeType":"Attribute","startLoc":31,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":490,"id":11567,"name":"_cfgobjs","nodeType":"Attribute","startLoc":490,"text":"_cfgobjs"},{"attributeType":"None","col":0,"comment":"null","endLoc":507,"id":11568,"name":"_override_config_file","nodeType":"Attribute","startLoc":507,"text":"_override_config_file"},{"col":0,"comment":"","endLoc":10,"header":"configuration.py#<anonymous>","id":11569,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"This module contains classes and functions to standardize access to\nconfiguration files for Astropy and affiliated packages.\n\n.. note::\n    The configuration system makes use of the 'configobj' package, which stores\n    configuration in a text format like that used in the standard library\n    `ConfigParser`. More information and documentation for configobj can be\n    found at https://configobj.readthedocs.io .\n\"\"\"\n\n__all__ = ('InvalidConfigurationItemWarning', 'ConfigurationMissingWarning',\n           'get_config', 'reload_config', 'ConfigNamespace', 'ConfigItem',\n           'generate_config', 'create_config_file')\n\n_cfgobjs = {}\n\n_override_config_file = None"},{"col":4,"comment":"null","endLoc":185,"header":"def build_Getattr(self, o)","id":11570,"name":"build_Getattr","nodeType":"Function","startLoc":183,"text":"def build_Getattr(self, o):\n        parent = self.build(o.expr)\n        return getattr(parent, o.attrname)"},{"col":4,"comment":"null","endLoc":1275,"header":"def parseopt_notrack(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None)","id":11571,"name":"parseopt_notrack","nodeType":"Function","startLoc":1003,"text":"def parseopt_notrack(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None):\n        #--! parseopt-notrack-start\n        lookahead = None                         # Current lookahead symbol\n        lookaheadstack = []                      # Stack of lookahead symbols\n        actions = self.action                    # Local reference to action table (to avoid lookup on self.)\n        goto    = self.goto                      # Local reference to goto table (to avoid lookup on self.)\n        prod    = self.productions               # Local reference to production list (to avoid lookup on self.)\n        defaulted_states = self.defaulted_states # Local reference to defaulted states\n        pslice  = YaccProduction(None)           # Production object passed to grammar rules\n        errorcount = 0                           # Used during error recovery\n\n\n        # If no lexer was given, we will try to use the lex module\n        if not lexer:\n            from . import lex\n            lexer = lex.lexer\n\n        # Set up the lexer and parser objects on pslice\n        pslice.lexer = lexer\n        pslice.parser = self\n\n        # If input was supplied, pass to lexer\n        if input is not None:\n            lexer.input(input)\n\n        if tokenfunc is None:\n            # Tokenize function\n            get_token = lexer.token\n        else:\n            get_token = tokenfunc\n\n        # Set the parser() token method (sometimes used in error recovery)\n        self.token = get_token\n\n        # Set up the state and symbol stacks\n\n        statestack = []                # Stack of parsing states\n        self.statestack = statestack\n        symstack   = []                # Stack of grammar symbols\n        self.symstack = symstack\n\n        pslice.stack = symstack         # Put in the production\n        errtoken   = None               # Err token\n\n        # The start state is assumed to be (0,$end)\n\n        statestack.append(0)\n        sym = YaccSymbol()\n        sym.type = '$end'\n        symstack.append(sym)\n        state = 0\n        while True:\n            # Get the next symbol on the input.  If a lookahead symbol\n            # is already set, we just use that. Otherwise, we'll pull\n            # the next token off of the lookaheadstack or from the lexer\n\n\n            if state not in defaulted_states:\n                if not lookahead:\n                    if not lookaheadstack:\n                        lookahead = get_token()     # Get the next token\n                    else:\n                        lookahead = lookaheadstack.pop()\n                    if not lookahead:\n                        lookahead = YaccSymbol()\n                        lookahead.type = '$end'\n\n                # Check the action table\n                ltype = lookahead.type\n                t = actions[state].get(ltype)\n            else:\n                t = defaulted_states[state]\n\n\n            if t is not None:\n                if t > 0:\n                    # shift a symbol on the stack\n                    statestack.append(t)\n                    state = t\n\n\n                    symstack.append(lookahead)\n                    lookahead = None\n\n                    # Decrease error count on successful shift\n                    if errorcount:\n                        errorcount -= 1\n                    continue\n\n                if t < 0:\n                    # reduce a symbol on the stack, emit a production\n                    p = prod[-t]\n                    pname = p.name\n                    plen  = p.len\n\n                    # Get production function\n                    sym = YaccSymbol()\n                    sym.type = pname       # Production name\n                    sym.value = None\n\n\n                    if plen:\n                        targ = symstack[-plen-1:]\n                        targ[0] = sym\n\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # below as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            del symstack[-plen:]\n                            self.state = state\n                            p.callable(pslice)\n                            del statestack[-plen:]\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            symstack.extend(targ[1:-1])         # Put the production slice back on the stack\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                    else:\n\n\n                        targ = [sym]\n\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                        # The code enclosed in this section is duplicated\n                        # above as a performance optimization.  Make sure\n                        # changes get made in both locations.\n\n                        pslice.slice = targ\n\n                        try:\n                            # Call the grammar rule with our special slice object\n                            self.state = state\n                            p.callable(pslice)\n                            symstack.append(sym)\n                            state = goto[statestack[-1]][pname]\n                            statestack.append(state)\n                        except SyntaxError:\n                            # If an error was set. Enter error recovery state\n                            lookaheadstack.append(lookahead)    # Save the current lookahead token\n                            statestack.pop()                    # Pop back one state (before the reduce)\n                            state = statestack[-1]\n                            sym.type = 'error'\n                            sym.value = 'error'\n                            lookahead = sym\n                            errorcount = error_count\n                            self.errorok = False\n\n                        continue\n                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                if t == 0:\n                    n = symstack[-1]\n                    result = getattr(n, 'value', None)\n                    return result\n\n            if t is None:\n\n\n                # We have some kind of parsing error here.  To handle\n                # this, we are going to push the current token onto\n                # the tokenstack and replace it with an 'error' token.\n                # If there are any synchronization rules, they may\n                # catch it.\n                #\n                # In addition to pushing the error token, we call call\n                # the user defined p_error() function if this is the\n                # first syntax error.  This function is only called if\n                # errorcount == 0.\n                if errorcount == 0 or self.errorok:\n                    errorcount = error_count\n                    self.errorok = False\n                    errtoken = lookahead\n                    if errtoken.type == '$end':\n                        errtoken = None               # End of file!\n                    if self.errorfunc:\n                        if errtoken and not hasattr(errtoken, 'lexer'):\n                            errtoken.lexer = lexer\n                        self.state = state\n                        tok = call_errorfunc(self.errorfunc, errtoken, self)\n                        if self.errorok:\n                            # User must have done some kind of panic\n                            # mode recovery on their own.  The\n                            # returned token is the next lookahead\n                            lookahead = tok\n                            errtoken = None\n                            continue\n                    else:\n                        if errtoken:\n                            if hasattr(errtoken, 'lineno'):\n                                lineno = lookahead.lineno\n                            else:\n                                lineno = 0\n                            if lineno:\n                                sys.stderr.write('yacc: Syntax error at line %d, token=%s\\n' % (lineno, errtoken.type))\n                            else:\n                                sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type)\n                        else:\n                            sys.stderr.write('yacc: Parse error in input. EOF\\n')\n                            return\n\n                else:\n                    errorcount = error_count\n\n                # case 1:  the statestack only has 1 entry on it.  If we're in this state, the\n                # entire parse has been rolled back and we're completely hosed.   The token is\n                # discarded and we just keep going.\n\n                if len(statestack) <= 1 and lookahead.type != '$end':\n                    lookahead = None\n                    errtoken = None\n                    state = 0\n                    # Nuke the pushback stack\n                    del lookaheadstack[:]\n                    continue\n\n                # case 2: the statestack has a couple of entries on it, but we're\n                # at the end of the file. nuke the top entry and generate an error token\n\n                # Start nuking entries on the stack\n                if lookahead.type == '$end':\n                    # Whoa. We're really hosed here. Bail out\n                    return\n\n                if lookahead.type != 'error':\n                    sym = symstack[-1]\n                    if sym.type == 'error':\n                        # Hmmm. Error is on top of stack, we'll just nuke input\n                        # symbol and continue\n                        lookahead = None\n                        continue\n\n                    # Create the error symbol for the first time and make it the new lookahead symbol\n                    t = YaccSymbol()\n                    t.type = 'error'\n\n                    if hasattr(lookahead, 'lineno'):\n                        t.lineno = t.endlineno = lookahead.lineno\n                    if hasattr(lookahead, 'lexpos'):\n                        t.lexpos = t.endlexpos = lookahead.lexpos\n                    t.value = lookahead\n                    lookaheadstack.append(lookahead)\n                    lookahead = t\n                else:\n                    sym = symstack.pop()\n                    statestack.pop()\n                    state = statestack[-1]\n\n                continue\n\n            # Call an error function here\n            raise RuntimeError('yacc: internal parser error!!!\\n')\n\n        #--! parseopt-notrack-end"},{"col":4,"comment":"null","endLoc":188,"header":"def build_UnarySub(self, o)","id":11572,"name":"build_UnarySub","nodeType":"Function","startLoc":187,"text":"def build_UnarySub(self, o):\n        return -self.build_Const(o.getChildren()[0])"},{"col":4,"comment":"null","endLoc":191,"header":"def build_UnaryAdd(self, o)","id":11573,"name":"build_UnaryAdd","nodeType":"Function","startLoc":190,"text":"def build_UnaryAdd(self, o):\n        return self.build_Const(o.getChildren()[0])"},{"col":0,"comment":"\n    A check that tests that a given value is a float\n    (an integer will be accepted), and optionally - that it is between bounds.\n\n    If the value is a string, then the conversion is done - if possible.\n    Otherwise a VdtError is raised.\n\n    This can accept negative values.\n\n    >>> vtor.check('float', '2')\n    2.0\n\n    From now on we multiply the value to avoid comparing decimals\n\n    >>> vtor.check('float', '-6.8') * 10\n    -68.0\n    >>> vtor.check('float', '12.2') * 10\n    122.0\n    >>> vtor.check('float', 8.4) * 10\n    84.0\n    >>> vtor.check('float', 'a')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"a\" is of the wrong type.\n    >>> vtor.check('float(10.1)', '10.2') * 10\n    102.0\n    >>> vtor.check('float(max=20.2)', '15.1') * 10\n    151.0\n    >>> vtor.check('float(10.0)', '9.0')\n    Traceback (most recent call last):\n    VdtValueTooSmallError: the value \"9.0\" is too small.\n    >>> vtor.check('float(max=20.0)', '35.0')\n    Traceback (most recent call last):\n    VdtValueTooBigError: the value \"35.0\" is too big.\n    ","endLoc":888,"header":"def is_float(value, min=None, max=None)","id":11574,"name":"is_float","nodeType":"Function","startLoc":839,"text":"def is_float(value, min=None, max=None):\n    \"\"\"\n    A check that tests that a given value is a float\n    (an integer will be accepted), and optionally - that it is between bounds.\n\n    If the value is a string, then the conversion is done - if possible.\n    Otherwise a VdtError is raised.\n\n    This can accept negative values.\n\n    >>> vtor.check('float', '2')\n    2.0\n\n    From now on we multiply the value to avoid comparing decimals\n\n    >>> vtor.check('float', '-6.8') * 10\n    -68.0\n    >>> vtor.check('float', '12.2') * 10\n    122.0\n    >>> vtor.check('float', 8.4) * 10\n    84.0\n    >>> vtor.check('float', 'a')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"a\" is of the wrong type.\n    >>> vtor.check('float(10.1)', '10.2') * 10\n    102.0\n    >>> vtor.check('float(max=20.2)', '15.1') * 10\n    151.0\n    >>> vtor.check('float(10.0)', '9.0')\n    Traceback (most recent call last):\n    VdtValueTooSmallError: the value \"9.0\" is too small.\n    >>> vtor.check('float(max=20.0)', '35.0')\n    Traceback (most recent call last):\n    VdtValueTooBigError: the value \"35.0\" is too big.\n    \"\"\"\n    (min_val, max_val) = _is_num_param(\n        ('min', 'max'), (min, max), to_float=True)\n    if not isinstance(value, (int, long, float, string_type)):\n        raise VdtTypeError(value)\n    if not isinstance(value, float):\n        # if it's a string - does it represent a float ?\n        try:\n            value = float(value)\n        except ValueError:\n            raise VdtTypeError(value)\n    if (min_val is not None) and (value < min_val):\n        raise VdtValueTooSmallError(value)\n    if (max_val is not None) and (value > max_val):\n        raise VdtValueTooBigError(value)\n    return value"},{"className":"ConfigObjError","col":0,"comment":"\n    This is the base class for all errors that ConfigObj raises.\n    It is a subclass of SyntaxError.\n    ","endLoc":214,"id":11575,"nodeType":"Class","startLoc":206,"text":"class ConfigObjError(SyntaxError):\n    \"\"\"\n    This is the base class for all errors that ConfigObj raises.\n    It is a subclass of SyntaxError.\n    \"\"\"\n    def __init__(self, message='', line_number=None, line=''):\n        self.line = line\n        self.line_number = line_number\n        SyntaxError.__init__(self, message)"},{"id":11576,"name":"astropy/nddata","nodeType":"Package"},{"fileName":"nddata_base.py","filePath":"astropy/nddata","id":11577,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# This module implements the base NDDataBase class.\n\n\nfrom abc import ABCMeta, abstractmethod\n\n\n__all__ = ['NDDataBase']\n\n\nclass NDDataBase(metaclass=ABCMeta):\n    \"\"\"Base metaclass that defines the interface for N-dimensional datasets\n    with associated meta information used in ``astropy``.\n\n    All properties and ``__init__`` have to be overridden in subclasses. See\n    `NDData` for a subclass that defines this interface on `numpy.ndarray`-like\n    ``data``.\n\n    See also: https://docs.astropy.org/en/stable/nddata/\n\n    \"\"\"\n\n    @abstractmethod\n    def __init__(self):\n        pass\n\n    @property\n    @abstractmethod\n    def data(self):\n        \"\"\"The stored dataset.\n        \"\"\"\n        pass\n\n    @property\n    @abstractmethod\n    def mask(self):\n        \"\"\"Mask for the dataset.\n\n        Masks should follow the ``numpy`` convention that **valid** data points\n        are marked by ``False`` and **invalid** ones with ``True``.\n        \"\"\"\n        return None\n\n    @property\n    @abstractmethod\n    def unit(self):\n        \"\"\"Unit for the dataset.\n        \"\"\"\n        return None\n\n    @property\n    @abstractmethod\n    def wcs(self):\n        \"\"\"World coordinate system (WCS) for the dataset.\n        \"\"\"\n        return None\n\n    @property\n    @abstractmethod\n    def meta(self):\n        \"\"\"Additional meta information about the dataset.\n\n        Should be `dict`-like.\n        \"\"\"\n        return None\n\n    @property\n    @abstractmethod\n    def uncertainty(self):\n        \"\"\"Uncertainty in the dataset.\n\n        Should have an attribute ``uncertainty_type`` that defines what kind of\n        uncertainty is stored, such as ``\"std\"`` for standard deviation or\n        ``\"var\"`` for variance.\n        \"\"\"\n        return None\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":212,"id":11578,"name":"line","nodeType":"Attribute","startLoc":212,"text":"self.line"},{"className":"NDDataBase","col":0,"comment":"Base metaclass that defines the interface for N-dimensional datasets\n    with associated meta information used in ``astropy``.\n\n    All properties and ``__init__`` have to be overridden in subclasses. See\n    `NDData` for a subclass that defines this interface on `numpy.ndarray`-like\n    ``data``.\n\n    See also: https://docs.astropy.org/en/stable/nddata/\n\n    ","endLoc":76,"id":11579,"nodeType":"Class","startLoc":11,"text":"class NDDataBase(metaclass=ABCMeta):\n    \"\"\"Base metaclass that defines the interface for N-dimensional datasets\n    with associated meta information used in ``astropy``.\n\n    All properties and ``__init__`` have to be overridden in subclasses. See\n    `NDData` for a subclass that defines this interface on `numpy.ndarray`-like\n    ``data``.\n\n    See also: https://docs.astropy.org/en/stable/nddata/\n\n    \"\"\"\n\n    @abstractmethod\n    def __init__(self):\n        pass\n\n    @property\n    @abstractmethod\n    def data(self):\n        \"\"\"The stored dataset.\n        \"\"\"\n        pass\n\n    @property\n    @abstractmethod\n    def mask(self):\n        \"\"\"Mask for the dataset.\n\n        Masks should follow the ``numpy`` convention that **valid** data points\n        are marked by ``False`` and **invalid** ones with ``True``.\n        \"\"\"\n        return None\n\n    @property\n    @abstractmethod\n    def unit(self):\n        \"\"\"Unit for the dataset.\n        \"\"\"\n        return None\n\n    @property\n    @abstractmethod\n    def wcs(self):\n        \"\"\"World coordinate system (WCS) for the dataset.\n        \"\"\"\n        return None\n\n    @property\n    @abstractmethod\n    def meta(self):\n        \"\"\"Additional meta information about the dataset.\n\n        Should be `dict`-like.\n        \"\"\"\n        return None\n\n    @property\n    @abstractmethod\n    def uncertainty(self):\n        \"\"\"Uncertainty in the dataset.\n\n        Should have an attribute ``uncertainty_type`` that defines what kind of\n        uncertainty is stored, such as ``\"std\"`` for standard deviation or\n        ``\"var\"`` for variance.\n        \"\"\"\n        return None"},{"col":4,"comment":"null","endLoc":25,"header":"@abstractmethod\n    def __init__(self)","id":11580,"name":"__init__","nodeType":"Function","startLoc":23,"text":"@abstractmethod\n    def __init__(self):\n        pass"},{"col":4,"comment":"The stored dataset.\n        ","endLoc":32,"header":"@property\n    @abstractmethod\n    def data(self)","id":11581,"name":"data","nodeType":"Function","startLoc":27,"text":"@property\n    @abstractmethod\n    def data(self):\n        \"\"\"The stored dataset.\n        \"\"\"\n        pass"},{"col":4,"comment":"Mask for the dataset.\n\n        Masks should follow the ``numpy`` convention that **valid** data points\n        are marked by ``False`` and **invalid** ones with ``True``.\n        ","endLoc":42,"header":"@property\n    @abstractmethod\n    def mask(self)","id":11582,"name":"mask","nodeType":"Function","startLoc":34,"text":"@property\n    @abstractmethod\n    def mask(self):\n        \"\"\"Mask for the dataset.\n\n        Masks should follow the ``numpy`` convention that **valid** data points\n        are marked by ``False`` and **invalid** ones with ``True``.\n        \"\"\"\n        return None"},{"col":4,"comment":"Unit for the dataset.\n        ","endLoc":49,"header":"@property\n    @abstractmethod\n    def unit(self)","id":11583,"name":"unit","nodeType":"Function","startLoc":44,"text":"@property\n    @abstractmethod\n    def unit(self):\n        \"\"\"Unit for the dataset.\n        \"\"\"\n        return None"},{"col":4,"comment":"World coordinate system (WCS) for the dataset.\n        ","endLoc":56,"header":"@property\n    @abstractmethod\n    def wcs(self)","id":11584,"name":"wcs","nodeType":"Function","startLoc":51,"text":"@property\n    @abstractmethod\n    def wcs(self):\n        \"\"\"World coordinate system (WCS) for the dataset.\n        \"\"\"\n        return None"},{"col":4,"comment":"Additional meta information about the dataset.\n\n        Should be `dict`-like.\n        ","endLoc":65,"header":"@property\n    @abstractmethod\n    def meta(self)","id":11585,"name":"meta","nodeType":"Function","startLoc":58,"text":"@property\n    @abstractmethod\n    def meta(self):\n        \"\"\"Additional meta information about the dataset.\n\n        Should be `dict`-like.\n        \"\"\"\n        return None"},{"col":4,"comment":"Uncertainty in the dataset.\n\n        Should have an attribute ``uncertainty_type`` that defines what kind of\n        uncertainty is stored, such as ``\"std\"`` for standard deviation or\n        ``\"var\"`` for variance.\n        ","endLoc":76,"header":"@property\n    @abstractmethod\n    def uncertainty(self)","id":11586,"name":"uncertainty","nodeType":"Function","startLoc":67,"text":"@property\n    @abstractmethod\n    def uncertainty(self):\n        \"\"\"Uncertainty in the dataset.\n\n        Should have an attribute ``uncertainty_type`` that defines what kind of\n        uncertainty is stored, such as ``\"std\"`` for standard deviation or\n        ``\"var\"`` for variance.\n        \"\"\"\n        return None"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":11587,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"nddata_base.py#<anonymous>","id":11588,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"__all__ = ['NDDataBase']"},{"attributeType":"null","col":8,"comment":"null","endLoc":213,"id":11589,"name":"line_number","nodeType":"Attribute","startLoc":213,"text":"self.line_number"},{"col":0,"comment":"\n    Check if the value represents a boolean.\n\n    >>> vtor.check('boolean', 0)\n    0\n    >>> vtor.check('boolean', False)\n    0\n    >>> vtor.check('boolean', '0')\n    0\n    >>> vtor.check('boolean', 'off')\n    0\n    >>> vtor.check('boolean', 'false')\n    0\n    >>> vtor.check('boolean', 'no')\n    0\n    >>> vtor.check('boolean', 'nO')\n    0\n    >>> vtor.check('boolean', 'NO')\n    0\n    >>> vtor.check('boolean', 1)\n    1\n    >>> vtor.check('boolean', True)\n    1\n    >>> vtor.check('boolean', '1')\n    1\n    >>> vtor.check('boolean', 'on')\n    1\n    >>> vtor.check('boolean', 'true')\n    1\n    >>> vtor.check('boolean', 'yes')\n    1\n    >>> vtor.check('boolean', 'Yes')\n    1\n    >>> vtor.check('boolean', 'YES')\n    1\n    >>> vtor.check('boolean', '')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"\" is of the wrong type.\n    >>> vtor.check('boolean', 'up')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"up\" is of the wrong type.\n\n    ","endLoc":954,"header":"def is_boolean(value)","id":11590,"name":"is_boolean","nodeType":"Function","startLoc":897,"text":"def is_boolean(value):\n    \"\"\"\n    Check if the value represents a boolean.\n\n    >>> vtor.check('boolean', 0)\n    0\n    >>> vtor.check('boolean', False)\n    0\n    >>> vtor.check('boolean', '0')\n    0\n    >>> vtor.check('boolean', 'off')\n    0\n    >>> vtor.check('boolean', 'false')\n    0\n    >>> vtor.check('boolean', 'no')\n    0\n    >>> vtor.check('boolean', 'nO')\n    0\n    >>> vtor.check('boolean', 'NO')\n    0\n    >>> vtor.check('boolean', 1)\n    1\n    >>> vtor.check('boolean', True)\n    1\n    >>> vtor.check('boolean', '1')\n    1\n    >>> vtor.check('boolean', 'on')\n    1\n    >>> vtor.check('boolean', 'true')\n    1\n    >>> vtor.check('boolean', 'yes')\n    1\n    >>> vtor.check('boolean', 'Yes')\n    1\n    >>> vtor.check('boolean', 'YES')\n    1\n    >>> vtor.check('boolean', '')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"\" is of the wrong type.\n    >>> vtor.check('boolean', 'up')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"up\" is of the wrong type.\n\n    \"\"\"\n    if isinstance(value, string_type):\n        try:\n            return bool_dict[value.lower()]\n        except KeyError:\n            raise VdtTypeError(value)\n    # we do an equality test rather than an identity test\n    # this ensures Python 2.2 compatibilty\n    # and allows 0 and 1 to represent True and False\n    if value == False:\n        return False\n    elif value == True:\n        return True\n    else:\n        raise VdtTypeError(value)"},{"className":"NestingError","col":0,"comment":"\n    This error indicates a level of nesting that doesn't match.\n    ","endLoc":220,"id":11591,"nodeType":"Class","startLoc":217,"text":"class NestingError(ConfigObjError):\n    \"\"\"\n    This error indicates a level of nesting that doesn't match.\n    \"\"\""},{"className":"ParseError","col":0,"comment":"\n    This error indicates that a line is badly written.\n    It is neither a valid ``key = value`` line,\n    nor a valid section marker line.\n    ","endLoc":228,"id":11592,"nodeType":"Class","startLoc":223,"text":"class ParseError(ConfigObjError):\n    \"\"\"\n    This error indicates that a line is badly written.\n    It is neither a valid ``key = value`` line,\n    nor a valid section marker line.\n    \"\"\""},{"className":"ReloadError","col":0,"comment":"\n    A 'reload' operation failed.\n    This exception is a subclass of ``IOError``.\n    ","endLoc":237,"id":11593,"nodeType":"Class","startLoc":231,"text":"class ReloadError(IOError):\n    \"\"\"\n    A 'reload' operation failed.\n    This exception is a subclass of ``IOError``.\n    \"\"\"\n    def __init__(self):\n        IOError.__init__(self, 'reload failed, filename is not set.')"},{"col":4,"comment":"null","endLoc":237,"header":"def __init__(self)","id":11594,"name":"__init__","nodeType":"Function","startLoc":236,"text":"def __init__(self):\n        IOError.__init__(self, 'reload failed, filename is not set.')"},{"className":"DuplicateError","col":0,"comment":"\n    The keyword or section specified already exists.\n    ","endLoc":243,"id":11595,"nodeType":"Class","startLoc":240,"text":"class DuplicateError(ConfigObjError):\n    \"\"\"\n    The keyword or section specified already exists.\n    \"\"\""},{"className":"ConfigspecError","col":0,"comment":"\n    An error occured whilst parsing a configspec.\n    ","endLoc":249,"id":11596,"nodeType":"Class","startLoc":246,"text":"class ConfigspecError(ConfigObjError):\n    \"\"\"\n    An error occured whilst parsing a configspec.\n    \"\"\""},{"className":"InterpolationError","col":0,"comment":"Base class for the two interpolation errors.","endLoc":253,"id":11597,"nodeType":"Class","startLoc":252,"text":"class InterpolationError(ConfigObjError):\n    \"\"\"Base class for the two interpolation errors.\"\"\""},{"className":"InterpolationLoopError","col":0,"comment":"Maximum interpolation depth exceeded in string interpolation.","endLoc":262,"id":11598,"nodeType":"Class","startLoc":256,"text":"class InterpolationLoopError(InterpolationError):\n    \"\"\"Maximum interpolation depth exceeded in string interpolation.\"\"\"\n\n    def __init__(self, option):\n        InterpolationError.__init__(\n            self,\n            'interpolation loop detected in value \"%s\".' % option)"},{"col":4,"comment":"null","endLoc":262,"header":"def __init__(self, option)","id":11599,"name":"__init__","nodeType":"Function","startLoc":259,"text":"def __init__(self, option):\n        InterpolationError.__init__(\n            self,\n            'interpolation loop detected in value \"%s\".' % option)"},{"fileName":"decorators.py","filePath":"astropy/nddata","id":11600,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nfrom copy import deepcopy\nfrom inspect import signature\nfrom itertools import islice\nimport warnings\nfrom functools import wraps\n\nfrom astropy.utils.exceptions import AstropyUserWarning\n\nfrom .nddata import NDData\n\n__all__ = ['support_nddata']\n\n\n# All supported properties are optional except \"data\" which is mandatory!\nSUPPORTED_PROPERTIES = ['data', 'uncertainty', 'mask', 'meta', 'unit', 'wcs',\n                        'flags']\n\n\ndef support_nddata(_func=None, accepts=NDData,\n                   repack=False, returns=None, keeps=None,\n                   **attribute_argument_mapping):\n    \"\"\"Decorator to wrap functions that could accept an NDData instance with\n    its properties passed as function arguments.\n\n    Parameters\n    ----------\n    _func : callable, None, optional\n        The function to decorate or ``None`` if used as factory. The first\n        positional argument should be ``data`` and take a numpy array. It is\n        possible to overwrite the name, see ``attribute_argument_mapping``\n        argument.\n        Default is ``None``.\n\n    accepts : class, optional\n        The class or subclass of ``NDData`` that should be unpacked before\n        calling the function.\n        Default is ``NDData``\n\n    repack : bool, optional\n        Should be ``True`` if the return should be converted to the input\n        class again after the wrapped function call.\n        Default is ``False``.\n\n        .. note::\n           Must be ``True`` if either one of ``returns`` or ``keeps``\n           is specified.\n\n    returns : iterable, None, optional\n        An iterable containing strings which returned value should be set\n        on the class. For example if a function returns data and mask, this\n        should be ``['data', 'mask']``. If ``None`` assume the function only\n        returns one argument: ``'data'``.\n        Default is ``None``.\n\n        .. note::\n           Must be ``None`` if ``repack=False``.\n\n    keeps : iterable. None, optional\n        An iterable containing strings that indicate which values should be\n        copied from the original input to the returned class. If ``None``\n        assume that no attributes are copied.\n        Default is ``None``.\n\n        .. note::\n           Must be ``None`` if ``repack=False``.\n\n    attribute_argument_mapping :\n        Keyword parameters that optionally indicate which function argument\n        should be interpreted as which attribute on the input. By default\n        it assumes the function takes a ``data`` argument as first argument,\n        but if the first argument is called ``input`` one should pass\n        ``support_nddata(..., data='input')`` to the function.\n\n    Returns\n    -------\n    decorator_factory or decorated_function : callable\n        If ``_func=None`` this returns a decorator, otherwise it returns the\n        decorated ``_func``.\n\n    Notes\n    -----\n    If properties of ``NDData`` are set but have no corresponding function\n    argument a Warning is shown.\n\n    If a property is set of the ``NDData`` are set and an explicit argument is\n    given, the explicitly given argument is used and a Warning is shown.\n\n    The supported properties are:\n\n    - ``mask``\n    - ``unit``\n    - ``wcs``\n    - ``meta``\n    - ``uncertainty``\n    - ``flags``\n\n    Examples\n    --------\n\n    This function takes a Numpy array for the data, and some WCS information\n    with the ``wcs`` keyword argument::\n\n        def downsample(data, wcs=None):\n            # downsample data and optionally WCS here\n            pass\n\n    However, you might have an NDData instance that has the ``wcs`` property\n    set and you would like to be able to call the function with\n    ``downsample(my_nddata)`` and have the WCS information, if present,\n    automatically be passed to the ``wcs`` keyword argument.\n\n    This decorator can be used to make this possible::\n\n        @support_nddata\n        def downsample(data, wcs=None):\n            # downsample data and optionally WCS here\n            pass\n\n    This function can now either be called as before, specifying the data and\n    WCS separately, or an NDData instance can be passed to the ``data``\n    argument.\n    \"\"\"\n    if (returns is not None or keeps is not None) and not repack:\n        raise ValueError('returns or keeps should only be set if repack=True.')\n    elif returns is None and repack:\n        raise ValueError('returns should be set if repack=True.')\n    else:\n        # Use empty lists for returns and keeps so we don't need to check\n        # if any of those is None later on.\n        if returns is None:\n            returns = []\n        if keeps is None:\n            keeps = []\n\n    # Short version to avoid the long variable name later.\n    attr_arg_map = attribute_argument_mapping\n    if any(keep in returns for keep in keeps):\n        raise ValueError(\"cannot specify the same attribute in `returns` and \"\n                         \"`keeps`.\")\n    all_returns = returns + keeps\n\n    def support_nddata_decorator(func):\n        # Find out args and kwargs\n        func_args, func_kwargs = [], []\n        sig = signature(func).parameters\n        for param_name, param in sig.items():\n            if param.kind in (param.VAR_POSITIONAL, param.VAR_KEYWORD):\n                raise ValueError(\"func may not have *args or **kwargs.\")\n            try:\n                if param.default == param.empty:\n                    func_args.append(param_name)\n                else:\n                    func_kwargs.append(param_name)\n            # The comparison to param.empty may fail if the default is a\n            # numpy array or something similar. So if the comparison fails then\n            # it's quite obvious that there was a default and it should be\n            # appended to the \"func_kwargs\".\n            except ValueError as exc:\n                if ('The truth value of an array with more than one element '\n                        'is ambiguous.') in str(exc):\n                    func_kwargs.append(param_name)\n                else:\n                    raise\n\n        # First argument should be data\n        if not func_args or func_args[0] != attr_arg_map.get('data', 'data'):\n            raise ValueError(\"Can only wrap functions whose first positional \"\n                             \"argument is `{}`\"\n                             \"\".format(attr_arg_map.get('data', 'data')))\n\n        @wraps(func)\n        def wrapper(data, *args, **kwargs):\n            bound_args = signature(func).bind(data, *args, **kwargs)\n            unpack = isinstance(data, accepts)\n            input_data = data\n            ignored = []\n            if not unpack and isinstance(data, NDData):\n                raise TypeError(\"Only NDData sub-classes that inherit from {}\"\n                                \" can be used by this function\"\n                                \"\".format(accepts.__name__))\n\n            # If data is an NDData instance, we can try and find properties\n            # that can be passed as kwargs.\n            if unpack:\n                # We loop over a list of pre-defined properties\n                for prop in islice(SUPPORTED_PROPERTIES, 1, None):\n                    # We only need to do something if the property exists on\n                    # the NDData object\n                    try:\n                        value = getattr(data, prop)\n                    except AttributeError:\n                        continue\n                    # Skip if the property exists but is None or empty.\n                    if prop == 'meta' and not value:\n                        continue\n                    elif value is None:\n                        continue\n                    # Warn if the property is set but not used by the function.\n                    propmatch = attr_arg_map.get(prop, prop)\n                    if propmatch not in func_kwargs:\n                        ignored.append(prop)\n                        continue\n\n                    # Check if the property was explicitly given and issue a\n                    # Warning if it is.\n                    if propmatch in bound_args.arguments:\n                        # If it's in the func_args it's trivial but if it was\n                        # in the func_kwargs we need to compare it to the\n                        # default.\n                        # Comparison to the default is done by comparing their\n                        # identity, this works because defaults in function\n                        # signatures are only created once and always reference\n                        # the same item.\n                        # FIXME: Python interns some values, for example the\n                        # integers from -5 to 255 (any maybe some other types\n                        # as well). In that case the default is\n                        # indistinguishable from an explicitly passed kwarg\n                        # and it won't notice that and use the attribute of the\n                        # NDData.\n                        if (propmatch in func_args or\n                                (propmatch in func_kwargs and\n                                 (bound_args.arguments[propmatch] is not\n                                  sig[propmatch].default))):\n                            warnings.warn(\n                                \"Property {} has been passed explicitly and \"\n                                \"as an NDData property{}, using explicitly \"\n                                \"specified value\"\n                                \"\".format(propmatch, '' if prop == propmatch\n                                          else ' ' + prop),\n                                AstropyUserWarning)\n                            continue\n                    # Otherwise use the property as input for the function.\n                    kwargs[propmatch] = value\n                # Finally, replace data by the data attribute\n                data = data.data\n\n                if ignored:\n                    warnings.warn(\"The following attributes were set on the \"\n                                  \"data object, but will be ignored by the \"\n                                  \"function: \" + \", \".join(ignored),\n                                  AstropyUserWarning)\n\n            result = func(data, *args, **kwargs)\n\n            if unpack and repack:\n                # If there are multiple required returned arguments make sure\n                # the result is a tuple (because we don't want to unpack\n                # numpy arrays or compare their length, never!) and has the\n                # same length.\n                if len(returns) > 1:\n                    if (not isinstance(result, tuple) or\n                            len(returns) != len(result)):\n                        raise ValueError(\"Function did not return the \"\n                                         \"expected number of arguments.\")\n                elif len(returns) == 1:\n                    result = [result]\n                if keeps is not None:\n                    for keep in keeps:\n                        result.append(deepcopy(getattr(input_data, keep)))\n                resultdata = result[all_returns.index('data')]\n                resultkwargs = {ret: res\n                                for ret, res in zip(all_returns, result)\n                                if ret != 'data'}\n                return input_data.__class__(resultdata, **resultkwargs)\n            else:\n                return result\n        return wrapper\n\n    # If _func is set, this means that the decorator was used without\n    # parameters so we have to return the result of the\n    # support_nddata_decorator decorator rather than the decorator itself\n    if _func is not None:\n        return support_nddata_decorator(_func)\n    else:\n        return support_nddata_decorator\n"},{"col":23,"endLoc":725,"id":11601,"nodeType":"Lambda","startLoc":725,"text":"lambda x: len(x[1])"},{"col":29,"endLoc":429,"id":11602,"nodeType":"Lambda","startLoc":429,"text":"lambda x: x[2]"},{"col":0,"comment":"\n    Check that the supplied value is an Internet Protocol address, v.4,\n    represented by a dotted-quad string, i.e. '1.2.3.4'.\n\n    >>> vtor.check('ip_addr', '1 ')\n    '1'\n    >>> vtor.check('ip_addr', ' 1.2')\n    '1.2'\n    >>> vtor.check('ip_addr', ' 1.2.3 ')\n    '1.2.3'\n    >>> vtor.check('ip_addr', '1.2.3.4')\n    '1.2.3.4'\n    >>> vtor.check('ip_addr', '0.0.0.0')\n    '0.0.0.0'\n    >>> vtor.check('ip_addr', '255.255.255.255')\n    '255.255.255.255'\n    >>> vtor.check('ip_addr', '255.255.255.256')\n    Traceback (most recent call last):\n    VdtValueError: the value \"255.255.255.256\" is unacceptable.\n    >>> vtor.check('ip_addr', '1.2.3.4.5')\n    Traceback (most recent call last):\n    VdtValueError: the value \"1.2.3.4.5\" is unacceptable.\n    >>> vtor.check('ip_addr', 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n    ","endLoc":991,"header":"def is_ip_addr(value)","id":11603,"name":"is_ip_addr","nodeType":"Function","startLoc":957,"text":"def is_ip_addr(value):\n    \"\"\"\n    Check that the supplied value is an Internet Protocol address, v.4,\n    represented by a dotted-quad string, i.e. '1.2.3.4'.\n\n    >>> vtor.check('ip_addr', '1 ')\n    '1'\n    >>> vtor.check('ip_addr', ' 1.2')\n    '1.2'\n    >>> vtor.check('ip_addr', ' 1.2.3 ')\n    '1.2.3'\n    >>> vtor.check('ip_addr', '1.2.3.4')\n    '1.2.3.4'\n    >>> vtor.check('ip_addr', '0.0.0.0')\n    '0.0.0.0'\n    >>> vtor.check('ip_addr', '255.255.255.255')\n    '255.255.255.255'\n    >>> vtor.check('ip_addr', '255.255.255.256')\n    Traceback (most recent call last):\n    VdtValueError: the value \"255.255.255.256\" is unacceptable.\n    >>> vtor.check('ip_addr', '1.2.3.4.5')\n    Traceback (most recent call last):\n    VdtValueError: the value \"1.2.3.4.5\" is unacceptable.\n    >>> vtor.check('ip_addr', 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n    \"\"\"\n    if not isinstance(value, string_type):\n        raise VdtTypeError(value)\n    value = value.strip()\n    try:\n        dottedQuadToNum(value)\n    except ValueError:\n        raise VdtValueError(value)\n    return value"},{"col":4,"comment":"null","endLoc":580,"header":"def validate_all(self)","id":11604,"name":"validate_all","nodeType":"Function","startLoc":576,"text":"def validate_all(self):\n        self.validate_tokens()\n        self.validate_literals()\n        self.validate_rules()\n        return self.error"},{"col":4,"comment":"null","endLoc":611,"header":"def validate_tokens(self)","id":11605,"name":"validate_tokens","nodeType":"Function","startLoc":603,"text":"def validate_tokens(self):\n        terminals = {}\n        for n in self.tokens:\n            if not _is_identifier.match(n):\n                self.log.error(\"Bad token name '%s'\", n)\n                self.error = True\n            if n in terminals:\n                self.log.warning(\"Token '%s' multiply defined\", n)\n            terminals[n] = 1"},{"className":"RepeatSectionError","col":0,"comment":"\n    This error indicates additional sections in a section with a\n    ``__many__`` (repeated) section.\n    ","endLoc":269,"id":11606,"nodeType":"Class","startLoc":265,"text":"class RepeatSectionError(ConfigObjError):\n    \"\"\"\n    This error indicates additional sections in a section with a\n    ``__many__`` (repeated) section.\n    \"\"\""},{"className":"MissingInterpolationOption","col":0,"comment":"A value specified for interpolation was missing.","endLoc":276,"id":11607,"nodeType":"Class","startLoc":272,"text":"class MissingInterpolationOption(InterpolationError):\n    \"\"\"A value specified for interpolation was missing.\"\"\"\n    def __init__(self, option):\n        msg = 'missing option \"%s\" in interpolation.' % option\n        InterpolationError.__init__(self, msg)"},{"col":4,"comment":"null","endLoc":276,"header":"def __init__(self, option)","id":11608,"name":"__init__","nodeType":"Function","startLoc":274,"text":"def __init__(self, option):\n        msg = 'missing option \"%s\" in interpolation.' % option\n        InterpolationError.__init__(self, msg)"},{"className":"UnreprError","col":0,"comment":"An error parsing in unrepr mode.","endLoc":280,"id":11609,"nodeType":"Class","startLoc":279,"text":"class UnreprError(ConfigObjError):\n    \"\"\"An error parsing in unrepr mode.\"\"\""},{"className":"InterpolationEngine","col":0,"comment":"\n    A helper class to help perform string interpolation.\n\n    This class is an abstract base class; its descendants perform\n    the actual work.\n    ","endLoc":404,"id":11610,"nodeType":"Class","startLoc":284,"text":"class InterpolationEngine(object):\n    \"\"\"\n    A helper class to help perform string interpolation.\n\n    This class is an abstract base class; its descendants perform\n    the actual work.\n    \"\"\"\n\n    # compiled regexp to use in self.interpolate()\n    _KEYCRE = re.compile(r\"%\\(([^)]*)\\)s\")\n    _cookie = '%'\n\n    def __init__(self, section):\n        # the Section instance that \"owns\" this engine\n        self.section = section\n\n\n    def interpolate(self, key, value):\n        # short-cut\n        if not self._cookie in value:\n            return value\n\n        def recursive_interpolate(key, value, section, backtrail):\n            \"\"\"The function that does the actual work.\n\n            ``value``: the string we're trying to interpolate.\n            ``section``: the section in which that string was found\n            ``backtrail``: a dict to keep track of where we've been,\n            to detect and prevent infinite recursion loops\n\n            This is similar to a depth-first-search algorithm.\n            \"\"\"\n            # Have we been here already?\n            if (key, section.name) in backtrail:\n                # Yes - infinite loop detected\n                raise InterpolationLoopError(key)\n            # Place a marker on our backtrail so we won't come back here again\n            backtrail[(key, section.name)] = 1\n\n            # Now start the actual work\n            match = self._KEYCRE.search(value)\n            while match:\n                # The actual parsing of the match is implementation-dependent,\n                # so delegate to our helper function\n                k, v, s = self._parse_match(match)\n                if k is None:\n                    # That's the signal that no further interpolation is needed\n                    replacement = v\n                else:\n                    # Further interpolation may be needed to obtain final value\n                    replacement = recursive_interpolate(k, v, s, backtrail)\n                # Replace the matched string with its final value\n                start, end = match.span()\n                value = ''.join((value[:start], replacement, value[end:]))\n                new_search_start = start + len(replacement)\n                # Pick up the next interpolation key, if any, for next time\n                # through the while loop\n                match = self._KEYCRE.search(value, new_search_start)\n\n            # Now safe to come back here again; remove marker from backtrail\n            del backtrail[(key, section.name)]\n\n            return value\n\n        # Back in interpolate(), all we have to do is kick off the recursive\n        # function with appropriate starting values\n        value = recursive_interpolate(key, value, self.section, {})\n        return value\n\n\n    def _fetch(self, key):\n        \"\"\"Helper function to fetch values from owning section.\n\n        Returns a 2-tuple: the value, and the section where it was found.\n        \"\"\"\n        # switch off interpolation before we try and fetch anything !\n        save_interp = self.section.main.interpolation\n        self.section.main.interpolation = False\n\n        # Start at section that \"owns\" this InterpolationEngine\n        current_section = self.section\n        while True:\n            # try the current section first\n            val = current_section.get(key)\n            if val is not None and not isinstance(val, Section):\n                break\n            # try \"DEFAULT\" next\n            val = current_section.get('DEFAULT', {}).get(key)\n            if val is not None and not isinstance(val, Section):\n                break\n            # move up to parent and try again\n            # top-level's parent is itself\n            if current_section.parent is current_section:\n                # reached top level, time to give up\n                break\n            current_section = current_section.parent\n\n        # restore interpolation to previous value before returning\n        self.section.main.interpolation = save_interp\n        if val is None:\n            raise MissingInterpolationOption(key)\n        return val, current_section\n\n\n    def _parse_match(self, match):\n        \"\"\"Implementation-dependent helper function.\n\n        Will be passed a match object corresponding to the interpolation\n        key we just found (e.g., \"%(foo)s\" or \"$foo\"). Should look up that\n        key in the appropriate config file section (using the ``_fetch()``\n        helper function) and return a 3-tuple: (key, value, section)\n\n        ``key`` is the name of the key we're looking for\n        ``value`` is the value found for that key\n        ``section`` is a reference to the section where it was found\n\n        ``key`` and ``section`` should be None if no further\n        interpolation should be performed on the resulting value\n        (e.g., if we interpolated \"$$\" and returned \"$\").\n        \"\"\"\n        raise NotImplementedError()"},{"col":4,"comment":"null","endLoc":298,"header":"def __init__(self, section)","id":11611,"name":"__init__","nodeType":"Function","startLoc":296,"text":"def __init__(self, section):\n        # the Section instance that \"owns\" this engine\n        self.section = section"},{"col":4,"comment":"null","endLoc":351,"header":"def interpolate(self, key, value)","id":11612,"name":"interpolate","nodeType":"Function","startLoc":301,"text":"def interpolate(self, key, value):\n        # short-cut\n        if not self._cookie in value:\n            return value\n\n        def recursive_interpolate(key, value, section, backtrail):\n            \"\"\"The function that does the actual work.\n\n            ``value``: the string we're trying to interpolate.\n            ``section``: the section in which that string was found\n            ``backtrail``: a dict to keep track of where we've been,\n            to detect and prevent infinite recursion loops\n\n            This is similar to a depth-first-search algorithm.\n            \"\"\"\n            # Have we been here already?\n            if (key, section.name) in backtrail:\n                # Yes - infinite loop detected\n                raise InterpolationLoopError(key)\n            # Place a marker on our backtrail so we won't come back here again\n            backtrail[(key, section.name)] = 1\n\n            # Now start the actual work\n            match = self._KEYCRE.search(value)\n            while match:\n                # The actual parsing of the match is implementation-dependent,\n                # so delegate to our helper function\n                k, v, s = self._parse_match(match)\n                if k is None:\n                    # That's the signal that no further interpolation is needed\n                    replacement = v\n                else:\n                    # Further interpolation may be needed to obtain final value\n                    replacement = recursive_interpolate(k, v, s, backtrail)\n                # Replace the matched string with its final value\n                start, end = match.span()\n                value = ''.join((value[:start], replacement, value[end:]))\n                new_search_start = start + len(replacement)\n                # Pick up the next interpolation key, if any, for next time\n                # through the while loop\n                match = self._KEYCRE.search(value, new_search_start)\n\n            # Now safe to come back here again; remove marker from backtrail\n            del backtrail[(key, section.name)]\n\n            return value\n\n        # Back in interpolate(), all we have to do is kick off the recursive\n        # function with appropriate starting values\n        value = recursive_interpolate(key, value, self.section, {})\n        return value"},{"col":0,"comment":"\n    Check that the value is a list of values.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    It does no check on list members.\n\n    >>> vtor.check('list', ())\n    []\n    >>> vtor.check('list', [])\n    []\n    >>> vtor.check('list', (1, 2))\n    [1, 2]\n    >>> vtor.check('list', [1, 2])\n    [1, 2]\n    >>> vtor.check('list(3)', (1, 2))\n    Traceback (most recent call last):\n    VdtValueTooShortError: the value \"(1, 2)\" is too short.\n    >>> vtor.check('list(max=5)', (1, 2, 3, 4, 5, 6))\n    Traceback (most recent call last):\n    VdtValueTooLongError: the value \"(1, 2, 3, 4, 5, 6)\" is too long.\n    >>> vtor.check('list(min=3, max=5)', (1, 2, 3, 4))\n    [1, 2, 3, 4]\n    >>> vtor.check('list', 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n    >>> vtor.check('list', '12')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"12\" is of the wrong type.\n    ","endLoc":1036,"header":"def is_list(value, min=None, max=None)","id":11613,"name":"is_list","nodeType":"Function","startLoc":994,"text":"def is_list(value, min=None, max=None):\n    \"\"\"\n    Check that the value is a list of values.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    It does no check on list members.\n\n    >>> vtor.check('list', ())\n    []\n    >>> vtor.check('list', [])\n    []\n    >>> vtor.check('list', (1, 2))\n    [1, 2]\n    >>> vtor.check('list', [1, 2])\n    [1, 2]\n    >>> vtor.check('list(3)', (1, 2))\n    Traceback (most recent call last):\n    VdtValueTooShortError: the value \"(1, 2)\" is too short.\n    >>> vtor.check('list(max=5)', (1, 2, 3, 4, 5, 6))\n    Traceback (most recent call last):\n    VdtValueTooLongError: the value \"(1, 2, 3, 4, 5, 6)\" is too long.\n    >>> vtor.check('list(min=3, max=5)', (1, 2, 3, 4))\n    [1, 2, 3, 4]\n    >>> vtor.check('list', 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n    >>> vtor.check('list', '12')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"12\" is of the wrong type.\n    \"\"\"\n    (min_len, max_len) = _is_num_param(('min', 'max'), (min, max))\n    if isinstance(value, string_type):\n        raise VdtTypeError(value)\n    try:\n        num_members = len(value)\n    except TypeError:\n        raise VdtTypeError(value)\n    if min_len is not None and num_members < min_len:\n        raise VdtValueTooShortError(value)\n    if max_len is not None and num_members > max_len:\n        raise VdtValueTooLongError(value)\n    return list(value)"},{"col":4,"comment":"null","endLoc":270,"header":"def add_path(self,path)","id":11614,"name":"add_path","nodeType":"Function","startLoc":269,"text":"def add_path(self,path):\n        self.path.append(path)"},{"col":4,"comment":"null","endLoc":629,"header":"def validate_literals(self)","id":11615,"name":"validate_literals","nodeType":"Function","startLoc":620,"text":"def validate_literals(self):\n        try:\n            for c in self.literals:\n                if not isinstance(c, StringTypes) or len(c) > 1:\n                    self.log.error('Invalid literal %s. Must be a single character', repr(c))\n                    self.error = True\n\n        except TypeError:\n            self.log.error('Invalid literals specification. literals must be a sequence of characters')\n            self.error = True"},{"col":4,"comment":"null","endLoc":821,"header":"def validate_rules(self)","id":11616,"name":"validate_rules","nodeType":"Function","startLoc":728,"text":"def validate_rules(self):\n        for state in self.stateinfo:\n            # Validate all rules defined by functions\n\n            for fname, f in self.funcsym[state]:\n                line = f.__code__.co_firstlineno\n                file = f.__code__.co_filename\n                module = inspect.getmodule(f)\n                self.modules.add(module)\n\n                tokname = self.toknames[fname]\n                if isinstance(f, types.MethodType):\n                    reqargs = 2\n                else:\n                    reqargs = 1\n                nargs = f.__code__.co_argcount\n                if nargs > reqargs:\n                    self.log.error(\"%s:%d: Rule '%s' has too many arguments\", file, line, f.__name__)\n                    self.error = True\n                    continue\n\n                if nargs < reqargs:\n                    self.log.error(\"%s:%d: Rule '%s' requires an argument\", file, line, f.__name__)\n                    self.error = True\n                    continue\n\n                if not _get_regex(f):\n                    self.log.error(\"%s:%d: No regular expression defined for rule '%s'\", file, line, f.__name__)\n                    self.error = True\n                    continue\n\n                try:\n                    c = re.compile('(?P<%s>%s)' % (fname, _get_regex(f)), self.reflags)\n                    if c.match(''):\n                        self.log.error(\"%s:%d: Regular expression for rule '%s' matches empty string\", file, line, f.__name__)\n                        self.error = True\n                except re.error as e:\n                    self.log.error(\"%s:%d: Invalid regular expression for rule '%s'. %s\", file, line, f.__name__, e)\n                    if '#' in _get_regex(f):\n                        self.log.error(\"%s:%d. Make sure '#' in rule '%s' is escaped with '\\\\#'\", file, line, f.__name__)\n                    self.error = True\n\n            # Validate all rules defined by strings\n            for name, r in self.strsym[state]:\n                tokname = self.toknames[name]\n                if tokname == 'error':\n                    self.log.error(\"Rule '%s' must be defined as a function\", name)\n                    self.error = True\n                    continue\n\n                if tokname not in self.tokens and tokname.find('ignore_') < 0:\n                    self.log.error(\"Rule '%s' defined for an unspecified token %s\", name, tokname)\n                    self.error = True\n                    continue\n\n                try:\n                    c = re.compile('(?P<%s>%s)' % (name, r), self.reflags)\n                    if (c.match('')):\n                        self.log.error(\"Regular expression for rule '%s' matches empty string\", name)\n                        self.error = True\n                except re.error as e:\n                    self.log.error(\"Invalid regular expression for rule '%s'. %s\", name, e)\n                    if '#' in r:\n                        self.log.error(\"Make sure '#' in rule '%s' is escaped with '\\\\#'\", name)\n                    self.error = True\n\n            if not self.funcsym[state] and not self.strsym[state]:\n                self.log.error(\"No rules defined for state '%s'\", state)\n                self.error = True\n\n            # Validate the error function\n            efunc = self.errorf.get(state, None)\n            if efunc:\n                f = efunc\n                line = f.__code__.co_firstlineno\n                file = f.__code__.co_filename\n                module = inspect.getmodule(f)\n                self.modules.add(module)\n\n                if isinstance(f, types.MethodType):\n                    reqargs = 2\n                else:\n                    reqargs = 1\n                nargs = f.__code__.co_argcount\n                if nargs > reqargs:\n                    self.log.error(\"%s:%d: Rule '%s' has too many arguments\", file, line, f.__name__)\n                    self.error = True\n\n                if nargs < reqargs:\n                    self.log.error(\"%s:%d: Rule '%s' requires an argument\", file, line, f.__name__)\n                    self.error = True\n\n        for module in self.modules:\n            self.validate_module(module)"},{"col":4,"comment":"null","endLoc":306,"header":"def group_lines(self,input)","id":11617,"name":"group_lines","nodeType":"Function","startLoc":281,"text":"def group_lines(self,input):\n        lex = self.lexer.clone()\n        lines = [x.rstrip() for x in input.splitlines()]\n        for i in xrange(len(lines)):\n            j = i+1\n            while lines[i].endswith('\\\\') and (j < len(lines)):\n                lines[i] = lines[i][:-1]+lines[j]\n                lines[j] = \"\"\n                j += 1\n\n        input = \"\\n\".join(lines)\n        lex.input(input)\n        lex.lineno = 1\n\n        current_line = []\n        while True:\n            tok = lex.token()\n            if not tok:\n                break\n            current_line.append(tok)\n            if tok.type in self.t_WS and '\\n' in tok.value:\n                yield current_line\n                current_line = []\n\n        if current_line:\n            yield current_line"},{"col":4,"comment":"Implementation-dependent helper function.\n\n        Will be passed a match object corresponding to the interpolation\n        key we just found (e.g., \"%(foo)s\" or \"$foo\"). Should look up that\n        key in the appropriate config file section (using the ``_fetch()``\n        helper function) and return a 3-tuple: (key, value, section)\n\n        ``key`` is the name of the key we're looking for\n        ``value`` is the value found for that key\n        ``section`` is a reference to the section where it was found\n\n        ``key`` and ``section`` should be None if no further\n        interpolation should be performed on the resulting value\n        (e.g., if we interpolated \"$$\" and returned \"$\").\n        ","endLoc":404,"header":"def _parse_match(self, match)","id":11618,"name":"_parse_match","nodeType":"Function","startLoc":388,"text":"def _parse_match(self, match):\n        \"\"\"Implementation-dependent helper function.\n\n        Will be passed a match object corresponding to the interpolation\n        key we just found (e.g., \"%(foo)s\" or \"$foo\"). Should look up that\n        key in the appropriate config file section (using the ``_fetch()``\n        helper function) and return a 3-tuple: (key, value, section)\n\n        ``key`` is the name of the key we're looking for\n        ``value`` is the value found for that key\n        ``section`` is a reference to the section where it was found\n\n        ``key`` and ``section`` should be None if no further\n        interpolation should be performed on the resulting value\n        (e.g., if we interpolated \"$$\" and returned \"$\").\n        \"\"\"\n        raise NotImplementedError()"},{"col":4,"comment":"Helper function to fetch values from owning section.\n\n        Returns a 2-tuple: the value, and the section where it was found.\n        ","endLoc":385,"header":"def _fetch(self, key)","id":11620,"name":"_fetch","nodeType":"Function","startLoc":354,"text":"def _fetch(self, key):\n        \"\"\"Helper function to fetch values from owning section.\n\n        Returns a 2-tuple: the value, and the section where it was found.\n        \"\"\"\n        # switch off interpolation before we try and fetch anything !\n        save_interp = self.section.main.interpolation\n        self.section.main.interpolation = False\n\n        # Start at section that \"owns\" this InterpolationEngine\n        current_section = self.section\n        while True:\n            # try the current section first\n            val = current_section.get(key)\n            if val is not None and not isinstance(val, Section):\n                break\n            # try \"DEFAULT\" next\n            val = current_section.get('DEFAULT', {}).get(key)\n            if val is not None and not isinstance(val, Section):\n                break\n            # move up to parent and try again\n            # top-level's parent is itself\n            if current_section.parent is current_section:\n                # reached top level, time to give up\n                break\n            current_section = current_section.parent\n\n        # restore interpolation to previous value before returning\n        self.section.main.interpolation = save_interp\n        if val is None:\n            raise MissingInterpolationOption(key)\n        return val, current_section"},{"className":"NDData","col":0,"comment":"\n    A container for `numpy.ndarray`-based datasets, using the\n    `~astropy.nddata.NDDataBase` interface.\n\n    The key distinction from raw `numpy.ndarray` is the presence of\n    additional metadata such as uncertainty, mask, unit, a coordinate system\n    and/or a dictionary containing further meta information. This class *only*\n    provides a container for *storing* such datasets. For further functionality\n    take a look at the ``See also`` section.\n\n    See also: https://docs.astropy.org/en/stable/nddata/\n\n    Parameters\n    ----------\n    data : `numpy.ndarray`-like or `NDData`-like\n        The dataset.\n\n    uncertainty : any type, optional\n        Uncertainty in the dataset.\n        Should have an attribute ``uncertainty_type`` that defines what kind of\n        uncertainty is stored, for example ``\"std\"`` for standard deviation or\n        ``\"var\"`` for variance. A metaclass defining such an interface is\n        `NDUncertainty` - but isn't mandatory. If the uncertainty has no such\n        attribute the uncertainty is stored as `UnknownUncertainty`.\n        Defaults to ``None``.\n\n    mask : any type, optional\n        Mask for the dataset. Masks should follow the ``numpy`` convention that\n        **valid** data points are marked by ``False`` and **invalid** ones with\n        ``True``.\n        Defaults to ``None``.\n\n    wcs : any type, optional\n        World coordinate system (WCS) for the dataset.\n        Default is ``None``.\n\n    meta : `dict`-like object, optional\n        Additional meta information about the dataset. If no meta is provided\n        an empty `collections.OrderedDict` is created.\n        Default is ``None``.\n\n    unit : unit-like, optional\n        Unit for the dataset. Strings that can be converted to a\n        `~astropy.units.Unit` are allowed.\n        Default is ``None``.\n\n    copy : `bool`, optional\n        Indicates whether to save the arguments as copy. ``True`` copies\n        every attribute before saving it while ``False`` tries to save every\n        parameter as reference.\n        Note however that it is not always possible to save the input as\n        reference.\n        Default is ``False``.\n\n        .. versionadded:: 1.2\n\n    Raises\n    ------\n    TypeError\n        In case ``data`` or ``meta`` don't meet the restrictions.\n\n    Notes\n    -----\n    Each attribute can be accessed through the homonymous instance attribute:\n    ``data`` in a `NDData` object can be accessed through the `data`\n    attribute::\n\n        >>> from astropy.nddata import NDData\n        >>> nd = NDData([1,2,3])\n        >>> nd.data\n        array([1, 2, 3])\n\n    Given a conflicting implicit and an explicit parameter during\n    initialization, for example the ``data`` is a `~astropy.units.Quantity` and\n    the unit parameter is not ``None``, then the implicit parameter is replaced\n    (without conversion) by the explicit one and a warning is issued::\n\n        >>> import numpy as np\n        >>> import astropy.units as u\n        >>> q = np.array([1,2,3,4]) * u.m\n        >>> nd2 = NDData(q, unit=u.cm)\n        INFO: overwriting Quantity's current unit with specified unit. [astropy.nddata.nddata]\n        >>> nd2.data  # doctest: +FLOAT_CMP\n        array([1., 2., 3., 4.])\n        >>> nd2.unit\n        Unit(\"cm\")\n\n    See also\n    --------\n    NDDataRef\n    NDDataArray\n    ","endLoc":333,"id":11621,"nodeType":"Class","startLoc":21,"text":"class NDData(NDDataBase):\n    \"\"\"\n    A container for `numpy.ndarray`-based datasets, using the\n    `~astropy.nddata.NDDataBase` interface.\n\n    The key distinction from raw `numpy.ndarray` is the presence of\n    additional metadata such as uncertainty, mask, unit, a coordinate system\n    and/or a dictionary containing further meta information. This class *only*\n    provides a container for *storing* such datasets. For further functionality\n    take a look at the ``See also`` section.\n\n    See also: https://docs.astropy.org/en/stable/nddata/\n\n    Parameters\n    ----------\n    data : `numpy.ndarray`-like or `NDData`-like\n        The dataset.\n\n    uncertainty : any type, optional\n        Uncertainty in the dataset.\n        Should have an attribute ``uncertainty_type`` that defines what kind of\n        uncertainty is stored, for example ``\"std\"`` for standard deviation or\n        ``\"var\"`` for variance. A metaclass defining such an interface is\n        `NDUncertainty` - but isn't mandatory. If the uncertainty has no such\n        attribute the uncertainty is stored as `UnknownUncertainty`.\n        Defaults to ``None``.\n\n    mask : any type, optional\n        Mask for the dataset. Masks should follow the ``numpy`` convention that\n        **valid** data points are marked by ``False`` and **invalid** ones with\n        ``True``.\n        Defaults to ``None``.\n\n    wcs : any type, optional\n        World coordinate system (WCS) for the dataset.\n        Default is ``None``.\n\n    meta : `dict`-like object, optional\n        Additional meta information about the dataset. If no meta is provided\n        an empty `collections.OrderedDict` is created.\n        Default is ``None``.\n\n    unit : unit-like, optional\n        Unit for the dataset. Strings that can be converted to a\n        `~astropy.units.Unit` are allowed.\n        Default is ``None``.\n\n    copy : `bool`, optional\n        Indicates whether to save the arguments as copy. ``True`` copies\n        every attribute before saving it while ``False`` tries to save every\n        parameter as reference.\n        Note however that it is not always possible to save the input as\n        reference.\n        Default is ``False``.\n\n        .. versionadded:: 1.2\n\n    Raises\n    ------\n    TypeError\n        In case ``data`` or ``meta`` don't meet the restrictions.\n\n    Notes\n    -----\n    Each attribute can be accessed through the homonymous instance attribute:\n    ``data`` in a `NDData` object can be accessed through the `data`\n    attribute::\n\n        >>> from astropy.nddata import NDData\n        >>> nd = NDData([1,2,3])\n        >>> nd.data\n        array([1, 2, 3])\n\n    Given a conflicting implicit and an explicit parameter during\n    initialization, for example the ``data`` is a `~astropy.units.Quantity` and\n    the unit parameter is not ``None``, then the implicit parameter is replaced\n    (without conversion) by the explicit one and a warning is issued::\n\n        >>> import numpy as np\n        >>> import astropy.units as u\n        >>> q = np.array([1,2,3,4]) * u.m\n        >>> nd2 = NDData(q, unit=u.cm)\n        INFO: overwriting Quantity's current unit with specified unit. [astropy.nddata.nddata]\n        >>> nd2.data  # doctest: +FLOAT_CMP\n        array([1., 2., 3., 4.])\n        >>> nd2.unit\n        Unit(\"cm\")\n\n    See also\n    --------\n    NDDataRef\n    NDDataArray\n    \"\"\"\n\n    # Instead of a custom property use the MetaData descriptor also used for\n    # Tables. It will check if the meta is dict-like or raise an exception.\n    meta = MetaData(doc=_meta_doc, copy=False)\n\n    def __init__(self, data, uncertainty=None, mask=None, wcs=None,\n                 meta=None, unit=None, copy=False):\n\n        # Rather pointless since the NDDataBase does not implement any setting\n        # but before the NDDataBase did call the uncertainty\n        # setter. But if anyone wants to alter this behavior again the call\n        # to the superclass NDDataBase should be in here.\n        super().__init__()\n\n        # Check if data is any type from which to collect some implicitly\n        # passed parameters.\n        if isinstance(data, NDData):  # don't use self.__class__ (issue #4137)\n            # Of course we need to check the data because subclasses with other\n            # init-logic might be passed in here. We could skip these\n            # tests if we compared for self.__class__ but that has other\n            # drawbacks.\n\n            # Comparing if there is an explicit and an implicit unit parameter.\n            # If that is the case use the explicit one and issue a warning\n            # that there might be a conflict. In case there is no explicit\n            # unit just overwrite the unit parameter with the NDData.unit\n            # and proceed as if that one was given as parameter. Same for the\n            # other parameters.\n            if (unit is not None and data.unit is not None and\n                    unit != data.unit):\n                log.info(\"overwriting NDData's current \"\n                         \"unit with specified unit.\")\n            elif data.unit is not None:\n                unit = data.unit\n\n            if uncertainty is not None and data.uncertainty is not None:\n                log.info(\"overwriting NDData's current \"\n                         \"uncertainty with specified uncertainty.\")\n            elif data.uncertainty is not None:\n                uncertainty = data.uncertainty\n\n            if mask is not None and data.mask is not None:\n                log.info(\"overwriting NDData's current \"\n                         \"mask with specified mask.\")\n            elif data.mask is not None:\n                mask = data.mask\n\n            if wcs is not None and data.wcs is not None:\n                log.info(\"overwriting NDData's current \"\n                         \"wcs with specified wcs.\")\n            elif data.wcs is not None:\n                wcs = data.wcs\n\n            if meta is not None and data.meta is not None:\n                log.info(\"overwriting NDData's current \"\n                         \"meta with specified meta.\")\n            elif data.meta is not None:\n                meta = data.meta\n\n            data = data.data\n\n        else:\n            if hasattr(data, 'mask') and hasattr(data, 'data'):\n                # Separating data and mask\n                if mask is not None:\n                    log.info(\"overwriting Masked Objects's current \"\n                             \"mask with specified mask.\")\n                else:\n                    mask = data.mask\n\n                # Just save the data for further processing, we could be given\n                # a masked Quantity or something else entirely. Better to check\n                # it first.\n                data = data.data\n\n            if isinstance(data, Quantity):\n                if unit is not None and unit != data.unit:\n                    log.info(\"overwriting Quantity's current \"\n                             \"unit with specified unit.\")\n                else:\n                    unit = data.unit\n                data = data.value\n\n        # Quick check on the parameters if they match the requirements.\n        if (not hasattr(data, 'shape') or not hasattr(data, '__getitem__') or\n                not hasattr(data, '__array__')):\n            # Data doesn't look like a numpy array, try converting it to\n            # one.\n            data = np.array(data, subok=True, copy=False)\n\n        # Another quick check to see if what we got looks like an array\n        # rather than an object (since numpy will convert a\n        # non-numerical/non-string inputs to an array of objects).\n        if data.dtype == 'O':\n            raise TypeError(\"could not convert data to numpy array.\")\n\n        if unit is not None:\n            unit = Unit(unit)\n\n        if copy:\n            # Data might have been copied before but no way of validating\n            # without another variable.\n            data = deepcopy(data)\n            mask = deepcopy(mask)\n            wcs = deepcopy(wcs)\n            meta = deepcopy(meta)\n            uncertainty = deepcopy(uncertainty)\n            # Actually - copying the unit is unnecessary but better safe\n            # than sorry :-)\n            unit = deepcopy(unit)\n\n        # Store the attributes\n        self._data = data\n        self.mask = mask\n        self._wcs = None\n        if wcs is not None:\n            # Validate the wcs\n            self.wcs = wcs\n        self.meta = meta  # TODO: Make this call the setter sometime\n        self._unit = unit\n        # Call the setter for uncertainty to further check the uncertainty\n        self.uncertainty = uncertainty\n\n    def __str__(self):\n        data = str(self.data)\n        unit = f\" {self.unit}\" if self.unit is not None else ''\n\n        return data + unit\n\n    def __repr__(self):\n        prefix = self.__class__.__name__ + '('\n        data = np.array2string(self.data, separator=', ', prefix=prefix)\n        unit = f\", unit='{self.unit}'\" if self.unit is not None else ''\n\n        return ''.join((prefix, data, unit, ')'))\n\n    @property\n    def data(self):\n        \"\"\"\n        `~numpy.ndarray`-like : The stored dataset.\n        \"\"\"\n        return self._data\n\n    @property\n    def mask(self):\n        \"\"\"\n        any type : Mask for the dataset, if any.\n\n        Masks should follow the ``numpy`` convention that valid data points are\n        marked by ``False`` and invalid ones with ``True``.\n        \"\"\"\n        return self._mask\n\n    @mask.setter\n    def mask(self, value):\n        self._mask = value\n\n    @property\n    def unit(self):\n        \"\"\"\n        `~astropy.units.Unit` : Unit for the dataset, if any.\n        \"\"\"\n        return self._unit\n\n    @property\n    def wcs(self):\n        \"\"\"\n        any type : A world coordinate system (WCS) for the dataset, if any.\n        \"\"\"\n        return self._wcs\n\n    @wcs.setter\n    def wcs(self, wcs):\n        if self._wcs is not None and wcs is not None:\n            raise ValueError(\"You can only set the wcs attribute with a WCS if no WCS is present.\")\n\n        if wcs is None or isinstance(wcs, BaseHighLevelWCS):\n            self._wcs = wcs\n        elif isinstance(wcs, BaseLowLevelWCS):\n            self._wcs = HighLevelWCSWrapper(wcs)\n        else:\n            raise TypeError(\"The wcs argument must implement either the high or\"\n                            \" low level WCS API.\")\n\n    @property\n    def uncertainty(self):\n        \"\"\"\n        any type : Uncertainty in the dataset, if any.\n\n        Should have an attribute ``uncertainty_type`` that defines what kind of\n        uncertainty is stored, such as ``'std'`` for standard deviation or\n        ``'var'`` for variance. A metaclass defining such an interface is\n        `~astropy.nddata.NDUncertainty` but isn't mandatory.\n        \"\"\"\n        return self._uncertainty\n\n    @uncertainty.setter\n    def uncertainty(self, value):\n        if value is not None:\n            # There is one requirements on the uncertainty: That\n            # it has an attribute 'uncertainty_type'.\n            # If it does not match this requirement convert it to an unknown\n            # uncertainty.\n            if not hasattr(value, 'uncertainty_type'):\n                log.info('uncertainty should have attribute uncertainty_type.')\n                value = UnknownUncertainty(value, copy=False)\n\n            # If it is a subclass of NDUncertainty we must set the\n            # parent_nddata attribute. (#4152)\n            if isinstance(value, NDUncertainty):\n                # In case the uncertainty already has a parent create a new\n                # instance because we need to assume that we don't want to\n                # steal the uncertainty from another NDData object\n                if value._parent_nddata is not None:\n                    value = value.__class__(value, copy=False)\n                # Then link it to this NDData instance (internally this needs\n                # to be saved as weakref but that's done by NDUncertainty\n                # setter).\n                value.parent_nddata = self\n        self._uncertainty = value"},{"col":0,"comment":"\n    Check that the value is a tuple of values.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    It does no check on members.\n\n    >>> vtor.check('tuple', ())\n    ()\n    >>> vtor.check('tuple', [])\n    ()\n    >>> vtor.check('tuple', (1, 2))\n    (1, 2)\n    >>> vtor.check('tuple', [1, 2])\n    (1, 2)\n    >>> vtor.check('tuple(3)', (1, 2))\n    Traceback (most recent call last):\n    VdtValueTooShortError: the value \"(1, 2)\" is too short.\n    >>> vtor.check('tuple(max=5)', (1, 2, 3, 4, 5, 6))\n    Traceback (most recent call last):\n    VdtValueTooLongError: the value \"(1, 2, 3, 4, 5, 6)\" is too long.\n    >>> vtor.check('tuple(min=3, max=5)', (1, 2, 3, 4))\n    (1, 2, 3, 4)\n    >>> vtor.check('tuple', 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n    >>> vtor.check('tuple', '12')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"12\" is of the wrong type.\n    ","endLoc":1070,"header":"def is_tuple(value, min=None, max=None)","id":11622,"name":"is_tuple","nodeType":"Function","startLoc":1039,"text":"def is_tuple(value, min=None, max=None):\n    \"\"\"\n    Check that the value is a tuple of values.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    It does no check on members.\n\n    >>> vtor.check('tuple', ())\n    ()\n    >>> vtor.check('tuple', [])\n    ()\n    >>> vtor.check('tuple', (1, 2))\n    (1, 2)\n    >>> vtor.check('tuple', [1, 2])\n    (1, 2)\n    >>> vtor.check('tuple(3)', (1, 2))\n    Traceback (most recent call last):\n    VdtValueTooShortError: the value \"(1, 2)\" is too short.\n    >>> vtor.check('tuple(max=5)', (1, 2, 3, 4, 5, 6))\n    Traceback (most recent call last):\n    VdtValueTooLongError: the value \"(1, 2, 3, 4, 5, 6)\" is too long.\n    >>> vtor.check('tuple(min=3, max=5)', (1, 2, 3, 4))\n    (1, 2, 3, 4)\n    >>> vtor.check('tuple', 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n    >>> vtor.check('tuple', '12')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"12\" is of the wrong type.\n    \"\"\"\n    return tuple(is_list(value, min, max))"},{"col":0,"comment":"\n    Check that the supplied value is a string.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    >>> vtor.check('string', '0')\n    '0'\n    >>> vtor.check('string', 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n    >>> vtor.check('string(2)', '12')\n    '12'\n    >>> vtor.check('string(2)', '1')\n    Traceback (most recent call last):\n    VdtValueTooShortError: the value \"1\" is too short.\n    >>> vtor.check('string(min=2, max=3)', '123')\n    '123'\n    >>> vtor.check('string(min=2, max=3)', '1234')\n    Traceback (most recent call last):\n    VdtValueTooLongError: the value \"1234\" is too long.\n    ","endLoc":1106,"header":"def is_string(value, min=None, max=None)","id":11623,"name":"is_string","nodeType":"Function","startLoc":1073,"text":"def is_string(value, min=None, max=None):\n    \"\"\"\n    Check that the supplied value is a string.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    >>> vtor.check('string', '0')\n    '0'\n    >>> vtor.check('string', 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n    >>> vtor.check('string(2)', '12')\n    '12'\n    >>> vtor.check('string(2)', '1')\n    Traceback (most recent call last):\n    VdtValueTooShortError: the value \"1\" is too short.\n    >>> vtor.check('string(min=2, max=3)', '123')\n    '123'\n    >>> vtor.check('string(min=2, max=3)', '1234')\n    Traceback (most recent call last):\n    VdtValueTooLongError: the value \"1234\" is too long.\n    \"\"\"\n    if not isinstance(value, string_type):\n        raise VdtTypeError(value)\n    (min_len, max_len) = _is_num_param(('min', 'max'), (min, max))\n    try:\n        num_members = len(value)\n    except TypeError:\n        raise VdtTypeError(value)\n    if min_len is not None and num_members < min_len:\n        raise VdtValueTooShortError(value)\n    if max_len is not None and num_members > max_len:\n        raise VdtValueTooLongError(value)\n    return value"},{"col":4,"comment":"null","endLoc":478,"header":"def macro_expand_args(self,macro,args)","id":11624,"name":"macro_expand_args","nodeType":"Function","startLoc":439,"text":"def macro_expand_args(self,macro,args):\n        # Make a copy of the macro token sequence\n        rep = [copy.copy(_x) for _x in macro.value]\n\n        # Make string expansion patches.  These do not alter the length of the replacement sequence\n\n        str_expansion = {}\n        for argnum, i in macro.str_patch:\n            if argnum not in str_expansion:\n                str_expansion[argnum] = ('\"%s\"' % \"\".join([x.value for x in args[argnum]])).replace(\"\\\\\",\"\\\\\\\\\")\n            rep[i] = copy.copy(rep[i])\n            rep[i].value = str_expansion[argnum]\n\n        # Make the variadic macro comma patch.  If the variadic macro argument is empty, we get rid\n        comma_patch = False\n        if macro.variadic and not args[-1]:\n            for i in macro.var_comma_patch:\n                rep[i] = None\n                comma_patch = True\n\n        # Make all other patches.   The order of these matters.  It is assumed that the patch list\n        # has been sorted in reverse order of patch location since replacements will cause the\n        # size of the replacement sequence to expand from the patch point.\n\n        expanded = { }\n        for ptype, argnum, i in macro.patch:\n            # Concatenation.   Argument is left unexpanded\n            if ptype == 'c':\n                rep[i:i+1] = args[argnum]\n            # Normal expansion.  Argument is macro expanded first\n            elif ptype == 'e':\n                if argnum not in expanded:\n                    expanded[argnum] = self.expand_macros(args[argnum])\n                rep[i:i+1] = expanded[argnum]\n\n        # Get rid of removed comma if necessary\n        if comma_patch:\n            rep = [_i for _i in rep if _i]\n\n        return rep"},{"attributeType":"null","col":4,"comment":"null","endLoc":293,"id":11625,"name":"_KEYCRE","nodeType":"Attribute","startLoc":293,"text":"_KEYCRE"},{"attributeType":"null","col":4,"comment":"null","endLoc":294,"id":11626,"name":"_cookie","nodeType":"Attribute","startLoc":294,"text":"_cookie"},{"attributeType":"null","col":8,"comment":"null","endLoc":298,"id":11627,"name":"section","nodeType":"Attribute","startLoc":298,"text":"self.section"},{"className":"ConfigParserInterpolation","col":0,"comment":"Behaves like ConfigParser.","endLoc":416,"id":11628,"nodeType":"Class","startLoc":408,"text":"class ConfigParserInterpolation(InterpolationEngine):\n    \"\"\"Behaves like ConfigParser.\"\"\"\n    _cookie = '%'\n    _KEYCRE = re.compile(r\"%\\(([^)]*)\\)s\")\n\n    def _parse_match(self, match):\n        key = match.group(1)\n        value, section = self._fetch(key)\n        return key, value, section"},{"col":4,"comment":"null","endLoc":416,"header":"def _parse_match(self, match)","id":11629,"name":"_parse_match","nodeType":"Function","startLoc":413,"text":"def _parse_match(self, match):\n        key = match.group(1)\n        value, section = self._fetch(key)\n        return key, value, section"},{"col":4,"comment":"null","endLoc":235,"header":"def __init__(self, data, uncertainty=None, mask=None, wcs=None,\n                 meta=None, unit=None, copy=False)","id":11630,"name":"__init__","nodeType":"Function","startLoc":119,"text":"def __init__(self, data, uncertainty=None, mask=None, wcs=None,\n                 meta=None, unit=None, copy=False):\n\n        # Rather pointless since the NDDataBase does not implement any setting\n        # but before the NDDataBase did call the uncertainty\n        # setter. But if anyone wants to alter this behavior again the call\n        # to the superclass NDDataBase should be in here.\n        super().__init__()\n\n        # Check if data is any type from which to collect some implicitly\n        # passed parameters.\n        if isinstance(data, NDData):  # don't use self.__class__ (issue #4137)\n            # Of course we need to check the data because subclasses with other\n            # init-logic might be passed in here. We could skip these\n            # tests if we compared for self.__class__ but that has other\n            # drawbacks.\n\n            # Comparing if there is an explicit and an implicit unit parameter.\n            # If that is the case use the explicit one and issue a warning\n            # that there might be a conflict. In case there is no explicit\n            # unit just overwrite the unit parameter with the NDData.unit\n            # and proceed as if that one was given as parameter. Same for the\n            # other parameters.\n            if (unit is not None and data.unit is not None and\n                    unit != data.unit):\n                log.info(\"overwriting NDData's current \"\n                         \"unit with specified unit.\")\n            elif data.unit is not None:\n                unit = data.unit\n\n            if uncertainty is not None and data.uncertainty is not None:\n                log.info(\"overwriting NDData's current \"\n                         \"uncertainty with specified uncertainty.\")\n            elif data.uncertainty is not None:\n                uncertainty = data.uncertainty\n\n            if mask is not None and data.mask is not None:\n                log.info(\"overwriting NDData's current \"\n                         \"mask with specified mask.\")\n            elif data.mask is not None:\n                mask = data.mask\n\n            if wcs is not None and data.wcs is not None:\n                log.info(\"overwriting NDData's current \"\n                         \"wcs with specified wcs.\")\n            elif data.wcs is not None:\n                wcs = data.wcs\n\n            if meta is not None and data.meta is not None:\n                log.info(\"overwriting NDData's current \"\n                         \"meta with specified meta.\")\n            elif data.meta is not None:\n                meta = data.meta\n\n            data = data.data\n\n        else:\n            if hasattr(data, 'mask') and hasattr(data, 'data'):\n                # Separating data and mask\n                if mask is not None:\n                    log.info(\"overwriting Masked Objects's current \"\n                             \"mask with specified mask.\")\n                else:\n                    mask = data.mask\n\n                # Just save the data for further processing, we could be given\n                # a masked Quantity or something else entirely. Better to check\n                # it first.\n                data = data.data\n\n            if isinstance(data, Quantity):\n                if unit is not None and unit != data.unit:\n                    log.info(\"overwriting Quantity's current \"\n                             \"unit with specified unit.\")\n                else:\n                    unit = data.unit\n                data = data.value\n\n        # Quick check on the parameters if they match the requirements.\n        if (not hasattr(data, 'shape') or not hasattr(data, '__getitem__') or\n                not hasattr(data, '__array__')):\n            # Data doesn't look like a numpy array, try converting it to\n            # one.\n            data = np.array(data, subok=True, copy=False)\n\n        # Another quick check to see if what we got looks like an array\n        # rather than an object (since numpy will convert a\n        # non-numerical/non-string inputs to an array of objects).\n        if data.dtype == 'O':\n            raise TypeError(\"could not convert data to numpy array.\")\n\n        if unit is not None:\n            unit = Unit(unit)\n\n        if copy:\n            # Data might have been copied before but no way of validating\n            # without another variable.\n            data = deepcopy(data)\n            mask = deepcopy(mask)\n            wcs = deepcopy(wcs)\n            meta = deepcopy(meta)\n            uncertainty = deepcopy(uncertainty)\n            # Actually - copying the unit is unnecessary but better safe\n            # than sorry :-)\n            unit = deepcopy(unit)\n\n        # Store the attributes\n        self._data = data\n        self.mask = mask\n        self._wcs = None\n        if wcs is not None:\n            # Validate the wcs\n            self.wcs = wcs\n        self.meta = meta  # TODO: Make this call the setter sometime\n        self._unit = unit\n        # Call the setter for uncertainty to further check the uncertainty\n        self.uncertainty = uncertainty"},{"col":0,"comment":"\n    Check that the value is a list of integers.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    Each list member is checked that it is an integer.\n\n    >>> vtor.check('int_list', ())\n    []\n    >>> vtor.check('int_list', [])\n    []\n    >>> vtor.check('int_list', (1, 2))\n    [1, 2]\n    >>> vtor.check('int_list', [1, 2])\n    [1, 2]\n    >>> vtor.check('int_list', [1, 'a'])\n    Traceback (most recent call last):\n    VdtTypeError: the value \"a\" is of the wrong type.\n    ","endLoc":1129,"header":"def is_int_list(value, min=None, max=None)","id":11631,"name":"is_int_list","nodeType":"Function","startLoc":1109,"text":"def is_int_list(value, min=None, max=None):\n    \"\"\"\n    Check that the value is a list of integers.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    Each list member is checked that it is an integer.\n\n    >>> vtor.check('int_list', ())\n    []\n    >>> vtor.check('int_list', [])\n    []\n    >>> vtor.check('int_list', (1, 2))\n    [1, 2]\n    >>> vtor.check('int_list', [1, 2])\n    [1, 2]\n    >>> vtor.check('int_list', [1, 'a'])\n    Traceback (most recent call last):\n    VdtTypeError: the value \"a\" is of the wrong type.\n    \"\"\"\n    return [is_integer(mem) for mem in is_list(value, min, max)]"},{"col":0,"comment":"\n    Check that the value is a list of booleans.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    Each list member is checked that it is a boolean.\n\n    >>> vtor.check('bool_list', ())\n    []\n    >>> vtor.check('bool_list', [])\n    []\n    >>> check_res = vtor.check('bool_list', (True, False))\n    >>> check_res == [True, False]\n    1\n    >>> check_res = vtor.check('bool_list', [True, False])\n    >>> check_res == [True, False]\n    1\n    >>> vtor.check('bool_list', [True, 'a'])\n    Traceback (most recent call last):\n    VdtTypeError: the value \"a\" is of the wrong type.\n    ","endLoc":1154,"header":"def is_bool_list(value, min=None, max=None)","id":11632,"name":"is_bool_list","nodeType":"Function","startLoc":1132,"text":"def is_bool_list(value, min=None, max=None):\n    \"\"\"\n    Check that the value is a list of booleans.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    Each list member is checked that it is a boolean.\n\n    >>> vtor.check('bool_list', ())\n    []\n    >>> vtor.check('bool_list', [])\n    []\n    >>> check_res = vtor.check('bool_list', (True, False))\n    >>> check_res == [True, False]\n    1\n    >>> check_res = vtor.check('bool_list', [True, False])\n    >>> check_res == [True, False]\n    1\n    >>> vtor.check('bool_list', [True, 'a'])\n    Traceback (most recent call last):\n    VdtTypeError: the value \"a\" is of the wrong type.\n    \"\"\"\n    return [is_boolean(mem) for mem in is_list(value, min, max)]"},{"col":0,"comment":"\n    Check that the value is a list of floats.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    Each list member is checked that it is a float.\n\n    >>> vtor.check('float_list', ())\n    []\n    >>> vtor.check('float_list', [])\n    []\n    >>> vtor.check('float_list', (1, 2.0))\n    [1.0, 2.0]\n    >>> vtor.check('float_list', [1, 2.0])\n    [1.0, 2.0]\n    >>> vtor.check('float_list', [1, 'a'])\n    Traceback (most recent call last):\n    VdtTypeError: the value \"a\" is of the wrong type.\n    ","endLoc":1177,"header":"def is_float_list(value, min=None, max=None)","id":11633,"name":"is_float_list","nodeType":"Function","startLoc":1157,"text":"def is_float_list(value, min=None, max=None):\n    \"\"\"\n    Check that the value is a list of floats.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    Each list member is checked that it is a float.\n\n    >>> vtor.check('float_list', ())\n    []\n    >>> vtor.check('float_list', [])\n    []\n    >>> vtor.check('float_list', (1, 2.0))\n    [1.0, 2.0]\n    >>> vtor.check('float_list', [1, 2.0])\n    [1.0, 2.0]\n    >>> vtor.check('float_list', [1, 'a'])\n    Traceback (most recent call last):\n    VdtTypeError: the value \"a\" is of the wrong type.\n    \"\"\"\n    return [is_float(mem) for mem in is_list(value, min, max)]"},{"col":0,"comment":"\n    Check that the value is a list of strings.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    Each list member is checked that it is a string.\n\n    >>> vtor.check('string_list', ())\n    []\n    >>> vtor.check('string_list', [])\n    []\n    >>> vtor.check('string_list', ('a', 'b'))\n    ['a', 'b']\n    >>> vtor.check('string_list', ['a', 1])\n    Traceback (most recent call last):\n    VdtTypeError: the value \"1\" is of the wrong type.\n    >>> vtor.check('string_list', 'hello')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"hello\" is of the wrong type.\n    ","endLoc":1203,"header":"def is_string_list(value, min=None, max=None)","id":11634,"name":"is_string_list","nodeType":"Function","startLoc":1180,"text":"def is_string_list(value, min=None, max=None):\n    \"\"\"\n    Check that the value is a list of strings.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    Each list member is checked that it is a string.\n\n    >>> vtor.check('string_list', ())\n    []\n    >>> vtor.check('string_list', [])\n    []\n    >>> vtor.check('string_list', ('a', 'b'))\n    ['a', 'b']\n    >>> vtor.check('string_list', ['a', 1])\n    Traceback (most recent call last):\n    VdtTypeError: the value \"1\" is of the wrong type.\n    >>> vtor.check('string_list', 'hello')\n    Traceback (most recent call last):\n    VdtTypeError: the value \"hello\" is of the wrong type.\n    \"\"\"\n    if isinstance(value, string_type):\n        raise VdtTypeError(value)\n    return [is_string(mem) for mem in is_list(value, min, max)]"},{"attributeType":"null","col":4,"comment":"null","endLoc":410,"id":11635,"name":"_cookie","nodeType":"Attribute","startLoc":410,"text":"_cookie"},{"attributeType":"null","col":4,"comment":"null","endLoc":411,"id":11636,"name":"_KEYCRE","nodeType":"Attribute","startLoc":411,"text":"_KEYCRE"},{"className":"TemplateInterpolation","col":0,"comment":"Behaves like string.Template.","endLoc":443,"id":11637,"nodeType":"Class","startLoc":420,"text":"class TemplateInterpolation(InterpolationEngine):\n    \"\"\"Behaves like string.Template.\"\"\"\n    _cookie = '$'\n    _delimiter = '$'\n    _KEYCRE = re.compile(r\"\"\"\n        \\$(?:\n          (?P<escaped>\\$)              |   # Two $ signs\n          (?P<named>[_a-z][_a-z0-9]*)  |   # $name format\n          {(?P<braced>[^}]*)}              # ${name} format\n        )\n        \"\"\", re.IGNORECASE | re.VERBOSE)\n\n    def _parse_match(self, match):\n        # Valid name (in or out of braces): fetch value from section\n        key = match.group('named') or match.group('braced')\n        if key is not None:\n            value, section = self._fetch(key)\n            return key, value, section\n        # Escaped delimiter (e.g., $$): return single delimiter\n        if match.group('escaped') is not None:\n            # Return None for key and section to indicate it's time to stop\n            return None, self._delimiter, None\n        # Anything else: ignore completely, just return it unchanged\n        return None, match.group(), None"},{"col":4,"comment":"null","endLoc":443,"header":"def _parse_match(self, match)","id":11638,"name":"_parse_match","nodeType":"Function","startLoc":432,"text":"def _parse_match(self, match):\n        # Valid name (in or out of braces): fetch value from section\n        key = match.group('named') or match.group('braced')\n        if key is not None:\n            value, section = self._fetch(key)\n            return key, value, section\n        # Escaped delimiter (e.g., $$): return single delimiter\n        if match.group('escaped') is not None:\n            # Return None for key and section to indicate it's time to stop\n            return None, self._delimiter, None\n        # Anything else: ignore completely, just return it unchanged\n        return None, match.group(), None"},{"col":0,"comment":"\n    Check that the value is a list of IP addresses.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    Each list member is checked that it is an IP address.\n\n    >>> vtor.check('ip_addr_list', ())\n    []\n    >>> vtor.check('ip_addr_list', [])\n    []\n    >>> vtor.check('ip_addr_list', ('1.2.3.4', '5.6.7.8'))\n    ['1.2.3.4', '5.6.7.8']\n    >>> vtor.check('ip_addr_list', ['a'])\n    Traceback (most recent call last):\n    VdtValueError: the value \"a\" is unacceptable.\n    ","endLoc":1224,"header":"def is_ip_addr_list(value, min=None, max=None)","id":11639,"name":"is_ip_addr_list","nodeType":"Function","startLoc":1206,"text":"def is_ip_addr_list(value, min=None, max=None):\n    \"\"\"\n    Check that the value is a list of IP addresses.\n\n    You can optionally specify the minimum and maximum number of members.\n\n    Each list member is checked that it is an IP address.\n\n    >>> vtor.check('ip_addr_list', ())\n    []\n    >>> vtor.check('ip_addr_list', [])\n    []\n    >>> vtor.check('ip_addr_list', ('1.2.3.4', '5.6.7.8'))\n    ['1.2.3.4', '5.6.7.8']\n    >>> vtor.check('ip_addr_list', ['a'])\n    Traceback (most recent call last):\n    VdtValueError: the value \"a\" is unacceptable.\n    \"\"\"\n    return [is_ip_addr(mem) for mem in is_list(value, min, max)]"},{"col":0,"comment":"\n    Check that a value is a list, coercing strings into\n    a list with one member. Useful where users forget the\n    trailing comma that turns a single value into a list.\n\n    You can optionally specify the minimum and maximum number of members.\n    A minumum of greater than one will fail if the user only supplies a\n    string.\n\n    >>> vtor.check('force_list', ())\n    []\n    >>> vtor.check('force_list', [])\n    []\n    >>> vtor.check('force_list', 'hello')\n    ['hello']\n    ","endLoc":1246,"header":"def force_list(value, min=None, max=None)","id":11640,"name":"force_list","nodeType":"Function","startLoc":1227,"text":"def force_list(value, min=None, max=None):\n    \"\"\"\n    Check that a value is a list, coercing strings into\n    a list with one member. Useful where users forget the\n    trailing comma that turns a single value into a list.\n\n    You can optionally specify the minimum and maximum number of members.\n    A minumum of greater than one will fail if the user only supplies a\n    string.\n\n    >>> vtor.check('force_list', ())\n    []\n    >>> vtor.check('force_list', [])\n    []\n    >>> vtor.check('force_list', 'hello')\n    ['hello']\n    \"\"\"\n    if not isinstance(value, (list, tuple)):\n        value = [value]\n    return is_list(value, min, max)"},{"col":0,"comment":"\n    Check that the value is a list.\n    Allow specifying the type of each member.\n    Work on lists of specific lengths.\n\n    You specify each member as a positional argument specifying type\n\n    Each type should be one of the following strings :\n      'integer', 'float', 'ip_addr', 'string', 'boolean'\n\n    So you can specify a list of two strings, followed by\n    two integers as :\n\n      mixed_list('string', 'string', 'integer', 'integer')\n\n    The length of the list must match the number of positional\n    arguments you supply.\n\n    >>> mix_str = \"mixed_list('integer', 'float', 'ip_addr', 'string', 'boolean')\"\n    >>> check_res = vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a', True))\n    >>> check_res == [1, 2.0, '1.2.3.4', 'a', True]\n    1\n    >>> check_res = vtor.check(mix_str, ('1', '2.0', '1.2.3.4', 'a', 'True'))\n    >>> check_res == [1, 2.0, '1.2.3.4', 'a', True]\n    1\n    >>> vtor.check(mix_str, ('b', 2.0, '1.2.3.4', 'a', True))\n    Traceback (most recent call last):\n    VdtTypeError: the value \"b\" is of the wrong type.\n    >>> vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a'))\n    Traceback (most recent call last):\n    VdtValueTooShortError: the value \"(1, 2.0, '1.2.3.4', 'a')\" is too short.\n    >>> vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a', 1, 'b'))\n    Traceback (most recent call last):\n    VdtValueTooLongError: the value \"(1, 2.0, '1.2.3.4', 'a', 1, 'b')\" is too long.\n    >>> vtor.check(mix_str, 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n\n    >>> vtor.check('mixed_list(\"yoda\")', ('a'))\n    Traceback (most recent call last):\n    VdtParamError: passed an incorrect value \"KeyError('yoda',)\" for parameter \"'mixed_list'\"\n    ","endLoc":1313,"header":"def is_mixed_list(value, *args)","id":11641,"name":"is_mixed_list","nodeType":"Function","startLoc":1259,"text":"def is_mixed_list(value, *args):\n    \"\"\"\n    Check that the value is a list.\n    Allow specifying the type of each member.\n    Work on lists of specific lengths.\n\n    You specify each member as a positional argument specifying type\n\n    Each type should be one of the following strings :\n      'integer', 'float', 'ip_addr', 'string', 'boolean'\n\n    So you can specify a list of two strings, followed by\n    two integers as :\n\n      mixed_list('string', 'string', 'integer', 'integer')\n\n    The length of the list must match the number of positional\n    arguments you supply.\n\n    >>> mix_str = \"mixed_list('integer', 'float', 'ip_addr', 'string', 'boolean')\"\n    >>> check_res = vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a', True))\n    >>> check_res == [1, 2.0, '1.2.3.4', 'a', True]\n    1\n    >>> check_res = vtor.check(mix_str, ('1', '2.0', '1.2.3.4', 'a', 'True'))\n    >>> check_res == [1, 2.0, '1.2.3.4', 'a', True]\n    1\n    >>> vtor.check(mix_str, ('b', 2.0, '1.2.3.4', 'a', True))\n    Traceback (most recent call last):\n    VdtTypeError: the value \"b\" is of the wrong type.\n    >>> vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a'))\n    Traceback (most recent call last):\n    VdtValueTooShortError: the value \"(1, 2.0, '1.2.3.4', 'a')\" is too short.\n    >>> vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a', 1, 'b'))\n    Traceback (most recent call last):\n    VdtValueTooLongError: the value \"(1, 2.0, '1.2.3.4', 'a', 1, 'b')\" is too long.\n    >>> vtor.check(mix_str, 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n\n    >>> vtor.check('mixed_list(\"yoda\")', ('a'))\n    Traceback (most recent call last):\n    VdtParamError: passed an incorrect value \"KeyError('yoda',)\" for parameter \"'mixed_list'\"\n    \"\"\"\n    try:\n        length = len(value)\n    except TypeError:\n        raise VdtTypeError(value)\n    if length < len(args):\n        raise VdtValueTooShortError(value)\n    elif length > len(args):\n        raise VdtValueTooLongError(value)\n    try:\n        return [fun_dict[arg](val) for arg, val in zip(args, value)]\n    except KeyError as e:\n        raise VdtParamError('mixed_list', e)"},{"col":4,"comment":"null","endLoc":241,"header":"def __str__(self)","id":11642,"name":"__str__","nodeType":"Function","startLoc":237,"text":"def __str__(self):\n        data = str(self.data)\n        unit = f\" {self.unit}\" if self.unit is not None else ''\n\n        return data + unit"},{"col":4,"comment":"null","endLoc":248,"header":"def __repr__(self)","id":11643,"name":"__repr__","nodeType":"Function","startLoc":243,"text":"def __repr__(self):\n        prefix = self.__class__.__name__ + '('\n        data = np.array2string(self.data, separator=', ', prefix=prefix)\n        unit = f\", unit='{self.unit}'\" if self.unit is not None else ''\n\n        return ''.join((prefix, data, unit, ')'))"},{"col":4,"comment":"\n        `~numpy.ndarray`-like : The stored dataset.\n        ","endLoc":255,"header":"@property\n    def data(self)","id":11644,"name":"data","nodeType":"Function","startLoc":250,"text":"@property\n    def data(self):\n        \"\"\"\n        `~numpy.ndarray`-like : The stored dataset.\n        \"\"\"\n        return self._data"},{"col":4,"comment":"\n        any type : Mask for the dataset, if any.\n\n        Masks should follow the ``numpy`` convention that valid data points are\n        marked by ``False`` and invalid ones with ``True``.\n        ","endLoc":265,"header":"@property\n    def mask(self)","id":11645,"name":"mask","nodeType":"Function","startLoc":257,"text":"@property\n    def mask(self):\n        \"\"\"\n        any type : Mask for the dataset, if any.\n\n        Masks should follow the ``numpy`` convention that valid data points are\n        marked by ``False`` and invalid ones with ``True``.\n        \"\"\"\n        return self._mask"},{"col":4,"comment":"null","endLoc":269,"header":"@mask.setter\n    def mask(self, value)","id":11646,"name":"mask","nodeType":"Function","startLoc":267,"text":"@mask.setter\n    def mask(self, value):\n        self._mask = value"},{"col":4,"comment":"\n        `~astropy.units.Unit` : Unit for the dataset, if any.\n        ","endLoc":276,"header":"@property\n    def unit(self)","id":11647,"name":"unit","nodeType":"Function","startLoc":271,"text":"@property\n    def unit(self):\n        \"\"\"\n        `~astropy.units.Unit` : Unit for the dataset, if any.\n        \"\"\"\n        return self._unit"},{"col":4,"comment":"\n        any type : A world coordinate system (WCS) for the dataset, if any.\n        ","endLoc":283,"header":"@property\n    def wcs(self)","id":11648,"name":"wcs","nodeType":"Function","startLoc":278,"text":"@property\n    def wcs(self):\n        \"\"\"\n        any type : A world coordinate system (WCS) for the dataset, if any.\n        \"\"\"\n        return self._wcs"},{"col":4,"comment":"null","endLoc":296,"header":"@wcs.setter\n    def wcs(self, wcs)","id":11649,"name":"wcs","nodeType":"Function","startLoc":285,"text":"@wcs.setter\n    def wcs(self, wcs):\n        if self._wcs is not None and wcs is not None:\n            raise ValueError(\"You can only set the wcs attribute with a WCS if no WCS is present.\")\n\n        if wcs is None or isinstance(wcs, BaseHighLevelWCS):\n            self._wcs = wcs\n        elif isinstance(wcs, BaseLowLevelWCS):\n            self._wcs = HighLevelWCSWrapper(wcs)\n        else:\n            raise TypeError(\"The wcs argument must implement either the high or\"\n                            \" low level WCS API.\")"},{"col":0,"comment":"\n    This check matches the value to any of a set of options.\n\n    >>> vtor.check('option(\"yoda\", \"jedi\")', 'yoda')\n    'yoda'\n    >>> vtor.check('option(\"yoda\", \"jedi\")', 'jed')\n    Traceback (most recent call last):\n    VdtValueError: the value \"jed\" is unacceptable.\n    >>> vtor.check('option(\"yoda\", \"jedi\")', 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n    ","endLoc":1333,"header":"def is_option(value, *options)","id":11650,"name":"is_option","nodeType":"Function","startLoc":1316,"text":"def is_option(value, *options):\n    \"\"\"\n    This check matches the value to any of a set of options.\n\n    >>> vtor.check('option(\"yoda\", \"jedi\")', 'yoda')\n    'yoda'\n    >>> vtor.check('option(\"yoda\", \"jedi\")', 'jed')\n    Traceback (most recent call last):\n    VdtValueError: the value \"jed\" is unacceptable.\n    >>> vtor.check('option(\"yoda\", \"jedi\")', 0)\n    Traceback (most recent call last):\n    VdtTypeError: the value \"0\" is of the wrong type.\n    \"\"\"\n    if not isinstance(value, string_type):\n        raise VdtTypeError(value)\n    if not value in options:\n        raise VdtValueError(value)\n    return value"},{"col":4,"comment":"\n        any type : Uncertainty in the dataset, if any.\n\n        Should have an attribute ``uncertainty_type`` that defines what kind of\n        uncertainty is stored, such as ``'std'`` for standard deviation or\n        ``'var'`` for variance. A metaclass defining such an interface is\n        `~astropy.nddata.NDUncertainty` but isn't mandatory.\n        ","endLoc":308,"header":"@property\n    def uncertainty(self)","id":11651,"name":"uncertainty","nodeType":"Function","startLoc":298,"text":"@property\n    def uncertainty(self):\n        \"\"\"\n        any type : Uncertainty in the dataset, if any.\n\n        Should have an attribute ``uncertainty_type`` that defines what kind of\n        uncertainty is stored, such as ``'std'`` for standard deviation or\n        ``'var'`` for variance. A metaclass defining such an interface is\n        `~astropy.nddata.NDUncertainty` but isn't mandatory.\n        \"\"\"\n        return self._uncertainty"},{"attributeType":"null","col":4,"comment":"null","endLoc":422,"id":11652,"name":"_cookie","nodeType":"Attribute","startLoc":422,"text":"_cookie"},{"col":4,"comment":"null","endLoc":333,"header":"@uncertainty.setter\n    def uncertainty(self, value)","id":11653,"name":"uncertainty","nodeType":"Function","startLoc":310,"text":"@uncertainty.setter\n    def uncertainty(self, value):\n        if value is not None:\n            # There is one requirements on the uncertainty: That\n            # it has an attribute 'uncertainty_type'.\n            # If it does not match this requirement convert it to an unknown\n            # uncertainty.\n            if not hasattr(value, 'uncertainty_type'):\n                log.info('uncertainty should have attribute uncertainty_type.')\n                value = UnknownUncertainty(value, copy=False)\n\n            # If it is a subclass of NDUncertainty we must set the\n            # parent_nddata attribute. (#4152)\n            if isinstance(value, NDUncertainty):\n                # In case the uncertainty already has a parent create a new\n                # instance because we need to assume that we don't want to\n                # steal the uncertainty from another NDData object\n                if value._parent_nddata is not None:\n                    value = value.__class__(value, copy=False)\n                # Then link it to this NDData instance (internally this needs\n                # to be saved as weakref but that's done by NDUncertainty\n                # setter).\n                value.parent_nddata = self\n        self._uncertainty = value"},{"attributeType":"null","col":4,"comment":"null","endLoc":423,"id":11654,"name":"_delimiter","nodeType":"Attribute","startLoc":423,"text":"_delimiter"},{"attributeType":"null","col":4,"comment":"null","endLoc":424,"id":11655,"name":"_KEYCRE","nodeType":"Attribute","startLoc":424,"text":"_KEYCRE"},{"col":0,"comment":"\n    A function that exists for test purposes.\n\n    >>> checks = [\n    ...     '3, 6, min=1, max=3, test=list(a, b, c)',\n    ...     '3',\n    ...     '3, 6',\n    ...     '3,',\n    ...     'min=1, test=\"a b c\"',\n    ...     'min=5, test=\"a, b, c\"',\n    ...     'min=1, max=3, test=\"a, b, c\"',\n    ...     'min=-100, test=-99',\n    ...     'min=1, max=3',\n    ...     '3, 6, test=\"36\"',\n    ...     '3, 6, test=\"a, b, c\"',\n    ...     '3, max=3, test=list(\"a\", \"b\", \"c\")',\n    ...     '''3, max=3, test=list(\"'a'\", 'b', \"x=(c)\")''',\n    ...     \"test='x=fish(3)'\",\n    ...    ]\n    >>> v = Validator({'test': _test})\n    >>> for entry in checks:\n    ...     pprint(v.check(('test(%s)' % entry), 3))\n    (3, ('3', '6'), {'max': '3', 'min': '1', 'test': ['a', 'b', 'c']})\n    (3, ('3',), {})\n    (3, ('3', '6'), {})\n    (3, ('3',), {})\n    (3, (), {'min': '1', 'test': 'a b c'})\n    (3, (), {'min': '5', 'test': 'a, b, c'})\n    (3, (), {'max': '3', 'min': '1', 'test': 'a, b, c'})\n    (3, (), {'min': '-100', 'test': '-99'})\n    (3, (), {'max': '3', 'min': '1'})\n    (3, ('3', '6'), {'test': '36'})\n    (3, ('3', '6'), {'test': 'a, b, c'})\n    (3, ('3',), {'max': '3', 'test': ['a', 'b', 'c']})\n    (3, ('3',), {'max': '3', 'test': [\"'a'\", 'b', 'x=(c)']})\n    (3, (), {'test': 'x=fish(3)'})\n\n    >>> v = Validator()\n    >>> v.check('integer(default=6)', '3')\n    3\n    >>> v.check('integer(default=6)', None, True)\n    6\n    >>> v.get_default_value('integer(default=6)')\n    6\n    >>> v.get_default_value('float(default=6)')\n    6.0\n    >>> v.get_default_value('pass(default=None)')\n    >>> v.get_default_value(\"string(default='None')\")\n    'None'\n    >>> v.get_default_value('pass')\n    Traceback (most recent call last):\n    KeyError: 'Check \"pass\" has no default value.'\n    >>> v.get_default_value('pass(default=list(1, 2, 3, 4))')\n    ['1', '2', '3', '4']\n\n    >>> v = Validator()\n    >>> v.check(\"pass(default=None)\", None, True)\n    >>> v.check(\"pass(default='None')\", None, True)\n    'None'\n    >>> v.check('pass(default=\"None\")', None, True)\n    'None'\n    >>> v.check('pass(default=list(1, 2, 3, 4))', None, True)\n    ['1', '2', '3', '4']\n\n    Bug test for unicode arguments\n    >>> v = Validator()\n    >>> v.check(unicode('string(min=4)'), unicode('test')) == unicode('test')\n    True\n\n    >>> v = Validator()\n    >>> v.get_default_value(unicode('string(min=4, default=\"1234\")')) == unicode('1234')\n    True\n    >>> v.check(unicode('string(min=4, default=\"1234\")'), unicode('test')) == unicode('test')\n    True\n\n    >>> v = Validator()\n    >>> default = v.get_default_value('string(default=None)')\n    >>> default == None\n    1\n    ","endLoc":1417,"header":"def _test(value, *args, **keywargs)","id":11656,"name":"_test","nodeType":"Function","startLoc":1336,"text":"def _test(value, *args, **keywargs):\n    \"\"\"\n    A function that exists for test purposes.\n\n    >>> checks = [\n    ...     '3, 6, min=1, max=3, test=list(a, b, c)',\n    ...     '3',\n    ...     '3, 6',\n    ...     '3,',\n    ...     'min=1, test=\"a b c\"',\n    ...     'min=5, test=\"a, b, c\"',\n    ...     'min=1, max=3, test=\"a, b, c\"',\n    ...     'min=-100, test=-99',\n    ...     'min=1, max=3',\n    ...     '3, 6, test=\"36\"',\n    ...     '3, 6, test=\"a, b, c\"',\n    ...     '3, max=3, test=list(\"a\", \"b\", \"c\")',\n    ...     '''3, max=3, test=list(\"'a'\", 'b', \"x=(c)\")''',\n    ...     \"test='x=fish(3)'\",\n    ...    ]\n    >>> v = Validator({'test': _test})\n    >>> for entry in checks:\n    ...     pprint(v.check(('test(%s)' % entry), 3))\n    (3, ('3', '6'), {'max': '3', 'min': '1', 'test': ['a', 'b', 'c']})\n    (3, ('3',), {})\n    (3, ('3', '6'), {})\n    (3, ('3',), {})\n    (3, (), {'min': '1', 'test': 'a b c'})\n    (3, (), {'min': '5', 'test': 'a, b, c'})\n    (3, (), {'max': '3', 'min': '1', 'test': 'a, b, c'})\n    (3, (), {'min': '-100', 'test': '-99'})\n    (3, (), {'max': '3', 'min': '1'})\n    (3, ('3', '6'), {'test': '36'})\n    (3, ('3', '6'), {'test': 'a, b, c'})\n    (3, ('3',), {'max': '3', 'test': ['a', 'b', 'c']})\n    (3, ('3',), {'max': '3', 'test': [\"'a'\", 'b', 'x=(c)']})\n    (3, (), {'test': 'x=fish(3)'})\n\n    >>> v = Validator()\n    >>> v.check('integer(default=6)', '3')\n    3\n    >>> v.check('integer(default=6)', None, True)\n    6\n    >>> v.get_default_value('integer(default=6)')\n    6\n    >>> v.get_default_value('float(default=6)')\n    6.0\n    >>> v.get_default_value('pass(default=None)')\n    >>> v.get_default_value(\"string(default='None')\")\n    'None'\n    >>> v.get_default_value('pass')\n    Traceback (most recent call last):\n    KeyError: 'Check \"pass\" has no default value.'\n    >>> v.get_default_value('pass(default=list(1, 2, 3, 4))')\n    ['1', '2', '3', '4']\n\n    >>> v = Validator()\n    >>> v.check(\"pass(default=None)\", None, True)\n    >>> v.check(\"pass(default='None')\", None, True)\n    'None'\n    >>> v.check('pass(default=\"None\")', None, True)\n    'None'\n    >>> v.check('pass(default=list(1, 2, 3, 4))', None, True)\n    ['1', '2', '3', '4']\n\n    Bug test for unicode arguments\n    >>> v = Validator()\n    >>> v.check(unicode('string(min=4)'), unicode('test')) == unicode('test')\n    True\n\n    >>> v = Validator()\n    >>> v.get_default_value(unicode('string(min=4, default=\"1234\")')) == unicode('1234')\n    True\n    >>> v.check(unicode('string(min=4, default=\"1234\")'), unicode('test')) == unicode('test')\n    True\n\n    >>> v = Validator()\n    >>> default = v.get_default_value('string(default=None)')\n    >>> default == None\n    1\n    \"\"\"\n    return (value, args, keywargs)"},{"className":"Section","col":0,"comment":"\n    A dictionary-like object that represents a section in a config file.\n\n    It does string interpolation if the 'interpolation' attribute\n    of the 'main' object is set to True.\n\n    Interpolation is tried first from this object, then from the 'DEFAULT'\n    section of this object, next from the parent and its 'DEFAULT' section,\n    and so on until the main object is reached.\n\n    A Section will behave like an ordered dictionary - following the\n    order of the ``scalars`` and ``sections`` attributes.\n    You can use this to change the order of members.\n\n    Iteration follows the order: scalars, then sections.\n    ","endLoc":1066,"id":11657,"nodeType":"Class","startLoc":456,"text":"class Section(dict):\n    \"\"\"\n    A dictionary-like object that represents a section in a config file.\n\n    It does string interpolation if the 'interpolation' attribute\n    of the 'main' object is set to True.\n\n    Interpolation is tried first from this object, then from the 'DEFAULT'\n    section of this object, next from the parent and its 'DEFAULT' section,\n    and so on until the main object is reached.\n\n    A Section will behave like an ordered dictionary - following the\n    order of the ``scalars`` and ``sections`` attributes.\n    You can use this to change the order of members.\n\n    Iteration follows the order: scalars, then sections.\n    \"\"\"\n\n\n    def __setstate__(self, state):\n        dict.update(self, state[0])\n        self.__dict__.update(state[1])\n\n    def __reduce__(self):\n        state = (dict(self), self.__dict__)\n        return (__newobj__, (self.__class__,), state)\n\n\n    def __init__(self, parent, depth, main, indict=None, name=None):\n        \"\"\"\n        * parent is the section above\n        * depth is the depth level of this section\n        * main is the main ConfigObj\n        * indict is a dictionary to initialise the section with\n        \"\"\"\n        if indict is None:\n            indict = {}\n        dict.__init__(self)\n        # used for nesting level *and* interpolation\n        self.parent = parent\n        # used for the interpolation attribute\n        self.main = main\n        # level of nesting depth of this Section\n        self.depth = depth\n        # purely for information\n        self.name = name\n        #\n        self._initialise()\n        # we do this explicitly so that __setitem__ is used properly\n        # (rather than just passing to ``dict.__init__``)\n        for entry, value in indict.items():\n            self[entry] = value\n\n\n    def _initialise(self):\n        # the sequence of scalar values in this Section\n        self.scalars = []\n        # the sequence of sections in this Section\n        self.sections = []\n        # for comments :-)\n        self.comments = {}\n        self.inline_comments = {}\n        # the configspec\n        self.configspec = None\n        # for defaults\n        self.defaults = []\n        self.default_values = {}\n        self.extra_values = []\n        self._created = False\n\n\n    def _interpolate(self, key, value):\n        try:\n            # do we already have an interpolation engine?\n            engine = self._interpolation_engine\n        except AttributeError:\n            # not yet: first time running _interpolate(), so pick the engine\n            name = self.main.interpolation\n            if name == True:  # note that \"if name:\" would be incorrect here\n                # backwards-compatibility: interpolation=True means use default\n                name = DEFAULT_INTERPOLATION\n            name = name.lower()  # so that \"Template\", \"template\", etc. all work\n            class_ = interpolation_engines.get(name, None)\n            if class_ is None:\n                # invalid value for self.main.interpolation\n                self.main.interpolation = False\n                return value\n            else:\n                # save reference to engine so we don't have to do this again\n                engine = self._interpolation_engine = class_(self)\n        # let the engine do the actual work\n        return engine.interpolate(key, value)\n\n\n    def __getitem__(self, key):\n        \"\"\"Fetch the item and do string interpolation.\"\"\"\n        val = dict.__getitem__(self, key)\n        if self.main.interpolation:\n            if isinstance(val, str):\n                return self._interpolate(key, val)\n            if isinstance(val, list):\n                def _check(entry):\n                    if isinstance(entry, str):\n                        return self._interpolate(key, entry)\n                    return entry\n                new = [_check(entry) for entry in val]\n                if new != val:\n                    return new\n        return val\n\n\n    def __setitem__(self, key, value, unrepr=False):\n        \"\"\"\n        Correctly set a value.\n\n        Making dictionary values Section instances.\n        (We have to special case 'Section' instances - which are also dicts)\n\n        Keys must be strings.\n        Values need only be strings (or lists of strings) if\n        ``main.stringify`` is set.\n\n        ``unrepr`` must be set when setting a value to a dictionary, without\n        creating a new sub-section.\n        \"\"\"\n        if not isinstance(key, str):\n            raise ValueError('The key \"%s\" is not a string.' % key)\n\n        # add the comment\n        if key not in self.comments:\n            self.comments[key] = []\n            self.inline_comments[key] = ''\n        # remove the entry from defaults\n        if key in self.defaults:\n            self.defaults.remove(key)\n        #\n        if isinstance(value, Section):\n            if key not in self:\n                self.sections.append(key)\n            dict.__setitem__(self, key, value)\n        elif isinstance(value, Mapping) and not unrepr:\n            # First create the new depth level,\n            # then create the section\n            if key not in self:\n                self.sections.append(key)\n            new_depth = self.depth + 1\n            dict.__setitem__(\n                self,\n                key,\n                Section(\n                    self,\n                    new_depth,\n                    self.main,\n                    indict=value,\n                    name=key))\n        else:\n            if key not in self:\n                self.scalars.append(key)\n            if not self.main.stringify:\n                if isinstance(value, str):\n                    pass\n                elif isinstance(value, (list, tuple)):\n                    for entry in value:\n                        if not isinstance(entry, str):\n                            raise TypeError('Value is not a string \"%s\".' % entry)\n                else:\n                    raise TypeError('Value is not a string \"%s\".' % value)\n            dict.__setitem__(self, key, value)\n\n\n    def __delitem__(self, key):\n        \"\"\"Remove items from the sequence when deleting.\"\"\"\n        dict. __delitem__(self, key)\n        if key in self.scalars:\n            self.scalars.remove(key)\n        else:\n            self.sections.remove(key)\n        del self.comments[key]\n        del self.inline_comments[key]\n\n\n    def get(self, key, default=None):\n        \"\"\"A version of ``get`` that doesn't bypass string interpolation.\"\"\"\n        try:\n            return self[key]\n        except KeyError:\n            return default\n\n\n    def update(self, indict):\n        \"\"\"\n        A version of update that uses our ``__setitem__``.\n        \"\"\"\n        for entry in indict:\n            self[entry] = indict[entry]\n\n\n    def pop(self, key, default=MISSING):\n        \"\"\"\n        'D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n        If key is not found, d is returned if given, otherwise KeyError is raised'\n        \"\"\"\n        try:\n            val = self[key]\n        except KeyError:\n            if default is MISSING:\n                raise\n            val = default\n        else:\n            del self[key]\n        return val\n\n\n    def popitem(self):\n        \"\"\"Pops the first (key,val)\"\"\"\n        sequence = (self.scalars + self.sections)\n        if not sequence:\n            raise KeyError(\": 'popitem(): dictionary is empty'\")\n        key = sequence[0]\n        val =  self[key]\n        del self[key]\n        return key, val\n\n\n    def clear(self):\n        \"\"\"\n        A version of clear that also affects scalars/sections\n        Also clears comments and configspec.\n\n        Leaves other attributes alone :\n            depth/main/parent are not affected\n        \"\"\"\n        dict.clear(self)\n        self.scalars = []\n        self.sections = []\n        self.comments = {}\n        self.inline_comments = {}\n        self.configspec = None\n        self.defaults = []\n        self.extra_values = []\n\n\n    def setdefault(self, key, default=None):\n        \"\"\"A version of setdefault that sets sequence if appropriate.\"\"\"\n        try:\n            return self[key]\n        except KeyError:\n            self[key] = default\n            return self[key]\n\n\n    def items(self):\n        \"\"\"D.items() -> list of D's (key, value) pairs, as 2-tuples\"\"\"\n        return list(zip((self.scalars + self.sections), list(self.values())))\n\n\n    def keys(self):\n        \"\"\"D.keys() -> list of D's keys\"\"\"\n        return (self.scalars + self.sections)\n\n\n    def values(self):\n        \"\"\"D.values() -> list of D's values\"\"\"\n        return [self[key] for key in (self.scalars + self.sections)]\n\n\n    def iteritems(self):\n        \"\"\"D.iteritems() -> an iterator over the (key, value) items of D\"\"\"\n        return iter(list(self.items()))\n\n\n    def iterkeys(self):\n        \"\"\"D.iterkeys() -> an iterator over the keys of D\"\"\"\n        return iter((self.scalars + self.sections))\n\n    __iter__ = iterkeys\n\n\n    def itervalues(self):\n        \"\"\"D.itervalues() -> an iterator over the values of D\"\"\"\n        return iter(list(self.values()))\n\n\n    def __repr__(self):\n        \"\"\"x.__repr__() <==> repr(x)\"\"\"\n        def _getval(key):\n            try:\n                return self[key]\n            except MissingInterpolationOption:\n                return dict.__getitem__(self, key)\n        return '{%s}' % ', '.join([('%s: %s' % (repr(key), repr(_getval(key))))\n            for key in (self.scalars + self.sections)])\n\n    __str__ = __repr__\n    __str__.__doc__ = \"x.__str__() <==> str(x)\"\n\n\n    # Extra methods - not in a normal dictionary\n\n    def dict(self):\n        \"\"\"\n        Return a deepcopy of self as a dictionary.\n\n        All members that are ``Section`` instances are recursively turned to\n        ordinary dictionaries - by calling their ``dict`` method.\n\n        >>> n = a.dict()\n        >>> n == a\n        1\n        >>> n is a\n        0\n        \"\"\"\n        newdict = {}\n        for entry in self:\n            this_entry = self[entry]\n            if isinstance(this_entry, Section):\n                this_entry = this_entry.dict()\n            elif isinstance(this_entry, list):\n                # create a copy rather than a reference\n                this_entry = list(this_entry)\n            elif isinstance(this_entry, tuple):\n                # create a copy rather than a reference\n                this_entry = tuple(this_entry)\n            newdict[entry] = this_entry\n        return newdict\n\n\n    def merge(self, indict):\n        \"\"\"\n        A recursive update - useful for merging config files.\n\n        >>> a = '''[section1]\n        ...     option1 = True\n        ...     [[subsection]]\n        ...     more_options = False\n        ...     # end of file'''.splitlines()\n        >>> b = '''# File is user.ini\n        ...     [section1]\n        ...     option1 = False\n        ...     # end of file'''.splitlines()\n        >>> c1 = ConfigObj(b)\n        >>> c2 = ConfigObj(a)\n        >>> c2.merge(c1)\n        >>> c2\n        ConfigObj({'section1': {'option1': 'False', 'subsection': {'more_options': 'False'}}})\n        \"\"\"\n        for key, val in list(indict.items()):\n            if (key in self and isinstance(self[key], Mapping) and\n                                isinstance(val, Mapping)):\n                self[key].merge(val)\n            else:\n                self[key] = val\n\n\n    def rename(self, oldkey, newkey):\n        \"\"\"\n        Change a keyname to another, without changing position in sequence.\n\n        Implemented so that transformations can be made on keys,\n        as well as on values. (used by encode and decode)\n\n        Also renames comments.\n        \"\"\"\n        if oldkey in self.scalars:\n            the_list = self.scalars\n        elif oldkey in self.sections:\n            the_list = self.sections\n        else:\n            raise KeyError('Key \"%s\" not found.' % oldkey)\n        pos = the_list.index(oldkey)\n        #\n        val = self[oldkey]\n        dict.__delitem__(self, oldkey)\n        dict.__setitem__(self, newkey, val)\n        the_list.remove(oldkey)\n        the_list.insert(pos, newkey)\n        comm = self.comments[oldkey]\n        inline_comment = self.inline_comments[oldkey]\n        del self.comments[oldkey]\n        del self.inline_comments[oldkey]\n        self.comments[newkey] = comm\n        self.inline_comments[newkey] = inline_comment\n\n\n    def walk(self, function, raise_errors=True,\n            call_on_sections=False, **keywargs):\n        \"\"\"\n        Walk every member and call a function on the keyword and value.\n\n        Return a dictionary of the return values\n\n        If the function raises an exception, raise the errror\n        unless ``raise_errors=False``, in which case set the return value to\n        ``False``.\n\n        Any unrecognized keyword arguments you pass to walk, will be pased on\n        to the function you pass in.\n\n        Note: if ``call_on_sections`` is ``True`` then - on encountering a\n        subsection, *first* the function is called for the *whole* subsection,\n        and then recurses into it's members. This means your function must be\n        able to handle strings, dictionaries and lists. This allows you\n        to change the key of subsections as well as for ordinary members. The\n        return value when called on the whole subsection has to be discarded.\n\n        See  the encode and decode methods for examples, including functions.\n\n        .. admonition:: caution\n\n            You can use ``walk`` to transform the names of members of a section\n            but you mustn't add or delete members.\n\n        >>> config = '''[XXXXsection]\n        ... XXXXkey = XXXXvalue'''.splitlines()\n        >>> cfg = ConfigObj(config)\n        >>> cfg\n        ConfigObj({'XXXXsection': {'XXXXkey': 'XXXXvalue'}})\n        >>> def transform(section, key):\n        ...     val = section[key]\n        ...     newkey = key.replace('XXXX', 'CLIENT1')\n        ...     section.rename(key, newkey)\n        ...     if isinstance(val, (tuple, list, dict)):\n        ...         pass\n        ...     else:\n        ...         val = val.replace('XXXX', 'CLIENT1')\n        ...         section[newkey] = val\n        >>> cfg.walk(transform, call_on_sections=True)\n        {'CLIENT1section': {'CLIENT1key': None}}\n        >>> cfg\n        ConfigObj({'CLIENT1section': {'CLIENT1key': 'CLIENT1value'}})\n        \"\"\"\n        out = {}\n        # scalars first\n        for i in range(len(self.scalars)):\n            entry = self.scalars[i]\n            try:\n                val = function(self, entry, **keywargs)\n                # bound again in case name has changed\n                entry = self.scalars[i]\n                out[entry] = val\n            except Exception:\n                if raise_errors:\n                    raise\n                else:\n                    entry = self.scalars[i]\n                    out[entry] = False\n        # then sections\n        for i in range(len(self.sections)):\n            entry = self.sections[i]\n            if call_on_sections:\n                try:\n                    function(self, entry, **keywargs)\n                except Exception:\n                    if raise_errors:\n                        raise\n                    else:\n                        entry = self.sections[i]\n                        out[entry] = False\n                # bound again in case name has changed\n                entry = self.sections[i]\n            # previous result is discarded\n            out[entry] = self[entry].walk(\n                function,\n                raise_errors=raise_errors,\n                call_on_sections=call_on_sections,\n                **keywargs)\n        return out\n\n\n    def as_bool(self, key):\n        \"\"\"\n        Accepts a key as input. The corresponding value must be a string or\n        the objects (``True`` or 1) or (``False`` or 0). We allow 0 and 1 to\n        retain compatibility with Python 2.2.\n\n        If the string is one of  ``True``, ``On``, ``Yes``, or ``1`` it returns\n        ``True``.\n\n        If the string is one of  ``False``, ``Off``, ``No``, or ``0`` it returns\n        ``False``.\n\n        ``as_bool`` is not case sensitive.\n\n        Any other input will raise a ``ValueError``.\n\n        >>> a = ConfigObj()\n        >>> a['a'] = 'fish'\n        >>> a.as_bool('a')\n        Traceback (most recent call last):\n        ValueError: Value \"fish\" is neither True nor False\n        >>> a['b'] = 'True'\n        >>> a.as_bool('b')\n        1\n        >>> a['b'] = 'off'\n        >>> a.as_bool('b')\n        0\n        \"\"\"\n        val = self[key]\n        if val == True:\n            return True\n        elif val == False:\n            return False\n        else:\n            try:\n                if not isinstance(val, str):\n                    # TODO: Why do we raise a KeyError here?\n                    raise KeyError()\n                else:\n                    return self.main._bools[val.lower()]\n            except KeyError:\n                raise ValueError('Value \"%s\" is neither True nor False' % val)\n\n\n    def as_int(self, key):\n        \"\"\"\n        A convenience method which coerces the specified value to an integer.\n\n        If the value is an invalid literal for ``int``, a ``ValueError`` will\n        be raised.\n\n        >>> a = ConfigObj()\n        >>> a['a'] = 'fish'\n        >>> a.as_int('a')\n        Traceback (most recent call last):\n        ValueError: invalid literal for int() with base 10: 'fish'\n        >>> a['b'] = '1'\n        >>> a.as_int('b')\n        1\n        >>> a['b'] = '3.2'\n        >>> a.as_int('b')\n        Traceback (most recent call last):\n        ValueError: invalid literal for int() with base 10: '3.2'\n        \"\"\"\n        return int(self[key])\n\n\n    def as_float(self, key):\n        \"\"\"\n        A convenience method which coerces the specified value to a float.\n\n        If the value is an invalid literal for ``float``, a ``ValueError`` will\n        be raised.\n\n        >>> a = ConfigObj()\n        >>> a['a'] = 'fish'\n        >>> a.as_float('a')  #doctest: +IGNORE_EXCEPTION_DETAIL\n        Traceback (most recent call last):\n        ValueError: invalid literal for float(): fish\n        >>> a['b'] = '1'\n        >>> a.as_float('b')\n        1.0\n        >>> a['b'] = '3.2'\n        >>> a.as_float('b')  #doctest: +ELLIPSIS\n        3.2...\n        \"\"\"\n        return float(self[key])\n\n\n    def as_list(self, key):\n        \"\"\"\n        A convenience method which fetches the specified value, guaranteeing\n        that it is a list.\n\n        >>> a = ConfigObj()\n        >>> a['a'] = 1\n        >>> a.as_list('a')\n        [1]\n        >>> a['a'] = (1,)\n        >>> a.as_list('a')\n        [1]\n        >>> a['a'] = [1]\n        >>> a.as_list('a')\n        [1]\n        \"\"\"\n        result = self[key]\n        if isinstance(result, (tuple, list)):\n            return list(result)\n        return [result]\n\n\n    def restore_default(self, key):\n        \"\"\"\n        Restore (and return) default value for the specified key.\n\n        This method will only work for a ConfigObj that was created\n        with a configspec and has been validated.\n\n        If there is no default value for this key, ``KeyError`` is raised.\n        \"\"\"\n        default = self.default_values[key]\n        dict.__setitem__(self, key, default)\n        if key not in self.defaults:\n            self.defaults.append(key)\n        return default\n\n\n    def restore_defaults(self):\n        \"\"\"\n        Recursively restore default values to all members\n        that have them.\n\n        This method will only work for a ConfigObj that was created\n        with a configspec and has been validated.\n\n        It doesn't delete or modify entries without default values.\n        \"\"\"\n        for key in self.default_values:\n            self.restore_default(key)\n\n        for section in self.sections:\n            self[section].restore_defaults()"},{"col":4,"comment":"null","endLoc":477,"header":"def __setstate__(self, state)","id":11658,"name":"__setstate__","nodeType":"Function","startLoc":475,"text":"def __setstate__(self, state):\n        dict.update(self, state[0])\n        self.__dict__.update(state[1])"},{"col":4,"comment":"null","endLoc":481,"header":"def __reduce__(self)","id":11659,"name":"__reduce__","nodeType":"Function","startLoc":479,"text":"def __reduce__(self):\n        state = (dict(self), self.__dict__)\n        return (__newobj__, (self.__class__,), state)"},{"col":4,"comment":"null","endLoc":547,"header":"def _interpolate(self, key, value)","id":11660,"name":"_interpolate","nodeType":"Function","startLoc":527,"text":"def _interpolate(self, key, value):\n        try:\n            # do we already have an interpolation engine?\n            engine = self._interpolation_engine\n        except AttributeError:\n            # not yet: first time running _interpolate(), so pick the engine\n            name = self.main.interpolation\n            if name == True:  # note that \"if name:\" would be incorrect here\n                # backwards-compatibility: interpolation=True means use default\n                name = DEFAULT_INTERPOLATION\n            name = name.lower()  # so that \"Template\", \"template\", etc. all work\n            class_ = interpolation_engines.get(name, None)\n            if class_ is None:\n                # invalid value for self.main.interpolation\n                self.main.interpolation = False\n                return value\n            else:\n                # save reference to engine so we don't have to do this again\n                engine = self._interpolation_engine = class_(self)\n        # let the engine do the actual work\n        return engine.interpolate(key, value)"},{"col":4,"comment":"null","endLoc":98,"header":"def __init__(self, array=None, copy=True, unit=None)","id":11661,"name":"__init__","nodeType":"Function","startLoc":63,"text":"def __init__(self, array=None, copy=True, unit=None):\n        if isinstance(array, NDUncertainty):\n            # Given an NDUncertainty class or subclass check that the type\n            # is the same.\n            if array.uncertainty_type != self.uncertainty_type:\n                raise IncompatibleUncertaintiesException\n            # Check if two units are given and take the explicit one then.\n            if (unit is not None and unit != array._unit):\n                # TODO : Clarify it (see NDData.init for same problem)?\n                log.info(\"overwriting Uncertainty's current \"\n                         \"unit with specified unit.\")\n            elif array._unit is not None:\n                unit = array.unit\n            array = array.array\n\n        elif isinstance(array, Quantity):\n            # Check if two units are given and take the explicit one then.\n            if (unit is not None and array.unit is not None and\n                    unit != array.unit):\n                log.info(\"overwriting Quantity's current \"\n                         \"unit with specified unit.\")\n            elif array.unit is not None:\n                unit = array.unit\n            array = array.value\n\n        if unit is None:\n            self._unit = None\n        else:\n            self._unit = Unit(unit)\n\n        if copy:\n            array = deepcopy(array)\n            unit = deepcopy(unit)\n\n        self.array = array\n        self.parent_nddata = None  # no associated NDData - until it is set!"},{"col":4,"comment":"Fetch the item and do string interpolation.","endLoc":564,"header":"def __getitem__(self, key)","id":11662,"name":"__getitem__","nodeType":"Function","startLoc":550,"text":"def __getitem__(self, key):\n        \"\"\"Fetch the item and do string interpolation.\"\"\"\n        val = dict.__getitem__(self, key)\n        if self.main.interpolation:\n            if isinstance(val, str):\n                return self._interpolate(key, val)\n            if isinstance(val, list):\n                def _check(entry):\n                    if isinstance(entry, str):\n                        return self._interpolate(key, entry)\n                    return entry\n                new = [_check(entry) for entry in val]\n                if new != val:\n                    return new\n        return val"},{"col":0,"comment":"\n    >>>\n    >>> v = Validator()\n    >>> v.get_default_value('string(default=\"#ff00dd\")')\n    '#ff00dd'\n    >>> v.get_default_value('integer(default=3) # comment')\n    3\n    ","endLoc":1428,"header":"def _test2()","id":11663,"name":"_test2","nodeType":"Function","startLoc":1420,"text":"def _test2():\n    \"\"\"\n    >>>\n    >>> v = Validator()\n    >>> v.get_default_value('string(default=\"#ff00dd\")')\n    '#ff00dd'\n    >>> v.get_default_value('integer(default=3) # comment')\n    3\n    \"\"\""},{"col":0,"comment":"\n    >>> vtor.check('string(default=\"\")', '', missing=True)\n    ''\n    >>> vtor.check('string(default=\"\\n\")', '', missing=True)\n    '\\n'\n    >>> print(vtor.check('string(default=\"\\n\")', '', missing=True))\n    <BLANKLINE>\n    <BLANKLINE>\n    >>> vtor.check('string()', '\\n')\n    '\\n'\n    >>> vtor.check('string(default=\"\\n\\n\\n\")', '', missing=True)\n    '\\n\\n\\n'\n    >>> vtor.check('string()', 'random \\n text goes here\\n\\n')\n    'random \\n text goes here\\n\\n'\n    >>> vtor.check('string(default=\" \\nrandom text\\ngoes \\n here\\n\\n \")',\n    ... '', missing=True)\n    ' \\nrandom text\\ngoes \\n here\\n\\n '\n    >>> vtor.check(\"string(default='\\n\\n\\n')\", '', missing=True)\n    '\\n\\n\\n'\n    >>> vtor.check(\"option('\\n','a','b',default='\\n')\", '', missing=True)\n    '\\n'\n    >>> vtor.check(\"string_list()\", ['foo', '\\n', 'bar'])\n    ['foo', '\\n', 'bar']\n    >>> vtor.check(\"string_list(default=list('\\n'))\", '', missing=True)\n    ['\\n']\n    ","endLoc":1456,"header":"def _test3()","id":11664,"name":"_test3","nodeType":"Function","startLoc":1430,"text":"def _test3():\n    r\"\"\"\n    >>> vtor.check('string(default=\"\")', '', missing=True)\n    ''\n    >>> vtor.check('string(default=\"\\n\")', '', missing=True)\n    '\\n'\n    >>> print(vtor.check('string(default=\"\\n\")', '', missing=True))\n    <BLANKLINE>\n    <BLANKLINE>\n    >>> vtor.check('string()', '\\n')\n    '\\n'\n    >>> vtor.check('string(default=\"\\n\\n\\n\")', '', missing=True)\n    '\\n\\n\\n'\n    >>> vtor.check('string()', 'random \\n text goes here\\n\\n')\n    'random \\n text goes here\\n\\n'\n    >>> vtor.check('string(default=\" \\nrandom text\\ngoes \\n here\\n\\n \")',\n    ... '', missing=True)\n    ' \\nrandom text\\ngoes \\n here\\n\\n '\n    >>> vtor.check(\"string(default='\\n\\n\\n')\", '', missing=True)\n    '\\n\\n\\n'\n    >>> vtor.check(\"option('\\n','a','b',default='\\n')\", '', missing=True)\n    '\\n'\n    >>> vtor.check(\"string_list()\", ['foo', '\\n', 'bar'])\n    ['foo', '\\n', 'bar']\n    >>> vtor.check(\"string_list(default=list('\\n'))\", '', missing=True)\n    ['\\n']\n    \"\"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":129,"id":11665,"name":"__version__","nodeType":"Attribute","startLoc":129,"text":"__version__"},{"attributeType":"null","col":0,"comment":"null","endLoc":132,"id":11666,"name":"__all__","nodeType":"Attribute","startLoc":132,"text":"__all__"},{"attributeType":"null","col":4,"comment":"null","endLoc":173,"id":11667,"name":"string_type","nodeType":"Attribute","startLoc":173,"text":"string_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":175,"id":11668,"name":"string_type","nodeType":"Attribute","startLoc":175,"text":"string_type"},{"attributeType":"function","col":4,"comment":"null","endLoc":180,"id":11669,"name":"unicode","nodeType":"Attribute","startLoc":180,"text":"unicode"},{"attributeType":"null","col":4,"comment":"null","endLoc":183,"id":11670,"name":"long","nodeType":"Attribute","startLoc":183,"text":"long"},{"attributeType":"null","col":0,"comment":"null","endLoc":185,"id":11671,"name":"_list_arg","nodeType":"Attribute","startLoc":185,"text":"_list_arg"},{"attributeType":"null","col":0,"comment":"null","endLoc":208,"id":11672,"name":"_list_members","nodeType":"Attribute","startLoc":208,"text":"_list_members"},{"attributeType":"null","col":0,"comment":"null","endLoc":219,"id":11673,"name":"_paramstring","nodeType":"Attribute","startLoc":219,"text":"_paramstring"},{"attributeType":"null","col":0,"comment":"null","endLoc":260,"id":11674,"name":"_matchstring","nodeType":"Attribute","startLoc":260,"text":"_matchstring"},{"attributeType":"null","col":0,"comment":"null","endLoc":891,"id":11675,"name":"bool_dict","nodeType":"Attribute","startLoc":891,"text":"bool_dict"},{"attributeType":"null","col":0,"comment":"null","endLoc":1250,"id":11676,"name":"fun_dict","nodeType":"Attribute","startLoc":1250,"text":"fun_dict"},{"col":0,"comment":"","endLoc":127,"header":"validate.py#<anonymous>","id":11677,"name":"<anonymous>","nodeType":"Function","startLoc":17,"text":"\"\"\"\n    The Validator object is used to check that supplied values\n    conform to a specification.\n\n    The value can be supplied as a string - e.g. from a config file.\n    In this case the check will also *convert* the value to\n    the required type. This allows you to add validation\n    as a transparent layer to access data stored as strings.\n    The validation checks that the data is correct *and*\n    converts it to the expected type.\n\n    Some standard checks are provided for basic data types.\n    Additional checks are easy to write. They can be\n    provided when the ``Validator`` is instantiated or\n    added afterwards.\n\n    The standard functions work with the following basic data types :\n\n    * integers\n    * floats\n    * booleans\n    * strings\n    * ip_addr\n\n    plus lists of these datatypes\n\n    Adding additional checks is done through coding simple functions.\n\n    The full set of standard checks are :\n\n    * 'integer': matches integer values (including negative)\n                 Takes optional 'min' and 'max' arguments : ::\n\n                   integer()\n                   integer(3, 9)  # any value from 3 to 9\n                   integer(min=0) # any positive value\n                   integer(max=9)\n\n    * 'float': matches float values\n               Has the same parameters as the integer check.\n\n    * 'boolean': matches boolean values - ``True`` or ``False``\n                 Acceptable string values for True are :\n                   true, on, yes, 1\n                 Acceptable string values for False are :\n                   false, off, no, 0\n\n                 Any other value raises an error.\n\n    * 'ip_addr': matches an Internet Protocol address, v.4, represented\n                 by a dotted-quad string, i.e. '1.2.3.4'.\n\n    * 'string': matches any string.\n                Takes optional keyword args 'min' and 'max'\n                to specify min and max lengths of the string.\n\n    * 'list': matches any list.\n              Takes optional keyword args 'min', and 'max' to specify min and\n              max sizes of the list. (Always returns a list.)\n\n    * 'tuple': matches any tuple.\n              Takes optional keyword args 'min', and 'max' to specify min and\n              max sizes of the tuple. (Always returns a tuple.)\n\n    * 'int_list': Matches a list of integers.\n                  Takes the same arguments as list.\n\n    * 'float_list': Matches a list of floats.\n                    Takes the same arguments as list.\n\n    * 'bool_list': Matches a list of boolean values.\n                   Takes the same arguments as list.\n\n    * 'ip_addr_list': Matches a list of IP addresses.\n                     Takes the same arguments as list.\n\n    * 'string_list': Matches a list of strings.\n                     Takes the same arguments as list.\n\n    * 'mixed_list': Matches a list with different types in\n                    specific positions. List size must match\n                    the number of arguments.\n\n                    Each position can be one of :\n                    'integer', 'float', 'ip_addr', 'string', 'boolean'\n\n                    So to specify a list with two strings followed\n                    by two integers, you write the check as : ::\n\n                      mixed_list('string', 'string', 'integer', 'integer')\n\n    * 'pass': This check matches everything ! It never fails\n              and the value is unchanged.\n\n              It is also the default if no check is specified.\n\n    * 'option': This check matches any from a list of options.\n                You specify this check with : ::\n\n                  option('option 1', 'option 2', 'option 3')\n\n    You can supply a default value (returned if no value is supplied)\n    using the default keyword argument.\n\n    You specify a list argument for default using a list constructor syntax in\n    the check : ::\n\n        checkname(arg1, arg2, default=list('val 1', 'val 2', 'val 3'))\n\n    A badly formatted set of arguments will raise a ``VdtParamError``.\n\"\"\"\n\n__version__ = '1.0.1'\n\n__all__ = (\n    '__version__',\n    'dottedQuadToNum',\n    'numToDottedQuad',\n    'ValidateError',\n    'VdtUnknownCheckError',\n    'VdtParamError',\n    'VdtTypeError',\n    'VdtValueError',\n    'VdtValueTooSmallError',\n    'VdtValueTooBigError',\n    'VdtValueTooShortError',\n    'VdtValueTooLongError',\n    'VdtMissingValue',\n    'Validator',\n    'is_integer',\n    'is_float',\n    'is_boolean',\n    'is_list',\n    'is_tuple',\n    'is_ip_addr',\n    'is_string',\n    'is_int_list',\n    'is_bool_list',\n    'is_float_list',\n    'is_string_list',\n    'is_ip_addr_list',\n    'is_mixed_list',\n    'is_option',\n    '__docformat__',\n)\n\nif sys.version_info < (3,):\n    string_type = basestring\nelse:\n    string_type = str\n    # so tests that care about unicode on 2.x can specify unicode, and the same\n    # tests when run on 3.x won't complain about a undefined name \"unicode\"\n    # since all strings are unicode on 3.x we just want to pass it through\n    # unchanged\n    unicode = lambda x: x\n    # in python 3, all ints are equivalent to python 2 longs, and they'll\n    # never show \"L\" in the repr\n    long = int\n\n_list_arg = re.compile(r'''\n    (?:\n        ([a-zA-Z_][a-zA-Z0-9_]*)\\s*=\\s*list\\(\n            (\n                (?:\n                    \\s*\n                    (?:\n                        (?:\".*?\")|              # double quotes\n                        (?:'.*?')|              # single quotes\n                        (?:[^'\",\\s\\)][^,\\)]*?)  # unquoted\n                    )\n                    \\s*,\\s*\n                )*\n                (?:\n                    (?:\".*?\")|              # double quotes\n                    (?:'.*?')|              # single quotes\n                    (?:[^'\",\\s\\)][^,\\)]*?)  # unquoted\n                )?                          # last one\n            )\n        \\)\n    )\n''', re.VERBOSE | re.DOTALL)    # two groups\n\n_list_members = re.compile(r'''\n    (\n        (?:\".*?\")|              # double quotes\n        (?:'.*?')|              # single quotes\n        (?:[^'\",\\s=][^,=]*?)       # unquoted\n    )\n    (?:\n    (?:\\s*,\\s*)|(?:\\s*$)            # comma\n    )\n''', re.VERBOSE | re.DOTALL)    # one group\n\n_paramstring = r'''\n    (?:\n        (\n            (?:\n                [a-zA-Z_][a-zA-Z0-9_]*\\s*=\\s*list\\(\n                    (?:\n                        \\s*\n                        (?:\n                            (?:\".*?\")|              # double quotes\n                            (?:'.*?')|              # single quotes\n                            (?:[^'\",\\s\\)][^,\\)]*?)       # unquoted\n                        )\n                        \\s*,\\s*\n                    )*\n                    (?:\n                        (?:\".*?\")|              # double quotes\n                        (?:'.*?')|              # single quotes\n                        (?:[^'\",\\s\\)][^,\\)]*?)       # unquoted\n                    )?                              # last one\n                \\)\n            )|\n            (?:\n                (?:\".*?\")|              # double quotes\n                (?:'.*?')|              # single quotes\n                (?:[^'\",\\s=][^,=]*?)|       # unquoted\n                (?:                         # keyword argument\n                    [a-zA-Z_][a-zA-Z0-9_]*\\s*=\\s*\n                    (?:\n                        (?:\".*?\")|              # double quotes\n                        (?:'.*?')|              # single quotes\n                        (?:[^'\",\\s=][^,=]*?)       # unquoted\n                    )\n                )\n            )\n        )\n        (?:\n            (?:\\s*,\\s*)|(?:\\s*$)            # comma\n        )\n    )\n    '''\n\n_matchstring = '^%s*' % _paramstring\n\ntry:\n    bool\nexcept NameError:\n    def bool(val):\n        \"\"\"Simple boolean equivalent function. \"\"\"\n        if val:\n            return 1\n        else:\n            return 0\n\nbool_dict = {\n    True: True, 'on': True, '1': True, 'true': True, 'yes': True,\n    False: False, 'off': False, '0': False, 'false': False, 'no': False,\n}\n\nfun_dict = {\n    'integer': is_integer,\n    'float': is_float,\n    'ip_addr': is_ip_addr,\n    'string': is_string,\n    'boolean': is_boolean,\n}\n\nif __name__ == '__main__':\n    # run the code tests in doctest format\n    import sys\n    import doctest\n    m = sys.modules.get('__main__')\n    globs = m.__dict__.copy()\n    globs.update({\n        'vtor': Validator(),\n    })\n\n    failures, tests = doctest.testmod(\n        m, globs=globs,\n        optionflags=doctest.IGNORE_EXCEPTION_DETAIL | doctest.ELLIPSIS)\n    assert not failures, '{} failures out of {} tests'.format(failures, tests)"},{"col":14,"endLoc":180,"id":11678,"nodeType":"Lambda","startLoc":180,"text":"lambda x: x"},{"fileName":"nddata.py","filePath":"astropy/nddata","id":11679,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# This module implements the base NDData class.\n\n\nimport numpy as np\nfrom copy import deepcopy\n\nfrom .nddata_base import NDDataBase\nfrom .nduncertainty import NDUncertainty, UnknownUncertainty\nfrom astropy import log\nfrom astropy.units import Unit, Quantity\nfrom astropy.utils.metadata import MetaData\nfrom astropy.wcs.wcsapi import (BaseLowLevelWCS, BaseHighLevelWCS,\n                                SlicedLowLevelWCS, HighLevelWCSWrapper)\n\n__all__ = ['NDData']\n\n_meta_doc = \"\"\"`dict`-like : Additional meta information about the dataset.\"\"\"\n\n\nclass NDData(NDDataBase):\n    \"\"\"\n    A container for `numpy.ndarray`-based datasets, using the\n    `~astropy.nddata.NDDataBase` interface.\n\n    The key distinction from raw `numpy.ndarray` is the presence of\n    additional metadata such as uncertainty, mask, unit, a coordinate system\n    and/or a dictionary containing further meta information. This class *only*\n    provides a container for *storing* such datasets. For further functionality\n    take a look at the ``See also`` section.\n\n    See also: https://docs.astropy.org/en/stable/nddata/\n\n    Parameters\n    ----------\n    data : `numpy.ndarray`-like or `NDData`-like\n        The dataset.\n\n    uncertainty : any type, optional\n        Uncertainty in the dataset.\n        Should have an attribute ``uncertainty_type`` that defines what kind of\n        uncertainty is stored, for example ``\"std\"`` for standard deviation or\n        ``\"var\"`` for variance. A metaclass defining such an interface is\n        `NDUncertainty` - but isn't mandatory. If the uncertainty has no such\n        attribute the uncertainty is stored as `UnknownUncertainty`.\n        Defaults to ``None``.\n\n    mask : any type, optional\n        Mask for the dataset. Masks should follow the ``numpy`` convention that\n        **valid** data points are marked by ``False`` and **invalid** ones with\n        ``True``.\n        Defaults to ``None``.\n\n    wcs : any type, optional\n        World coordinate system (WCS) for the dataset.\n        Default is ``None``.\n\n    meta : `dict`-like object, optional\n        Additional meta information about the dataset. If no meta is provided\n        an empty `collections.OrderedDict` is created.\n        Default is ``None``.\n\n    unit : unit-like, optional\n        Unit for the dataset. Strings that can be converted to a\n        `~astropy.units.Unit` are allowed.\n        Default is ``None``.\n\n    copy : `bool`, optional\n        Indicates whether to save the arguments as copy. ``True`` copies\n        every attribute before saving it while ``False`` tries to save every\n        parameter as reference.\n        Note however that it is not always possible to save the input as\n        reference.\n        Default is ``False``.\n\n        .. versionadded:: 1.2\n\n    Raises\n    ------\n    TypeError\n        In case ``data`` or ``meta`` don't meet the restrictions.\n\n    Notes\n    -----\n    Each attribute can be accessed through the homonymous instance attribute:\n    ``data`` in a `NDData` object can be accessed through the `data`\n    attribute::\n\n        >>> from astropy.nddata import NDData\n        >>> nd = NDData([1,2,3])\n        >>> nd.data\n        array([1, 2, 3])\n\n    Given a conflicting implicit and an explicit parameter during\n    initialization, for example the ``data`` is a `~astropy.units.Quantity` and\n    the unit parameter is not ``None``, then the implicit parameter is replaced\n    (without conversion) by the explicit one and a warning is issued::\n\n        >>> import numpy as np\n        >>> import astropy.units as u\n        >>> q = np.array([1,2,3,4]) * u.m\n        >>> nd2 = NDData(q, unit=u.cm)\n        INFO: overwriting Quantity's current unit with specified unit. [astropy.nddata.nddata]\n        >>> nd2.data  # doctest: +FLOAT_CMP\n        array([1., 2., 3., 4.])\n        >>> nd2.unit\n        Unit(\"cm\")\n\n    See also\n    --------\n    NDDataRef\n    NDDataArray\n    \"\"\"\n\n    # Instead of a custom property use the MetaData descriptor also used for\n    # Tables. It will check if the meta is dict-like or raise an exception.\n    meta = MetaData(doc=_meta_doc, copy=False)\n\n    def __init__(self, data, uncertainty=None, mask=None, wcs=None,\n                 meta=None, unit=None, copy=False):\n\n        # Rather pointless since the NDDataBase does not implement any setting\n        # but before the NDDataBase did call the uncertainty\n        # setter. But if anyone wants to alter this behavior again the call\n        # to the superclass NDDataBase should be in here.\n        super().__init__()\n\n        # Check if data is any type from which to collect some implicitly\n        # passed parameters.\n        if isinstance(data, NDData):  # don't use self.__class__ (issue #4137)\n            # Of course we need to check the data because subclasses with other\n            # init-logic might be passed in here. We could skip these\n            # tests if we compared for self.__class__ but that has other\n            # drawbacks.\n\n            # Comparing if there is an explicit and an implicit unit parameter.\n            # If that is the case use the explicit one and issue a warning\n            # that there might be a conflict. In case there is no explicit\n            # unit just overwrite the unit parameter with the NDData.unit\n            # and proceed as if that one was given as parameter. Same for the\n            # other parameters.\n            if (unit is not None and data.unit is not None and\n                    unit != data.unit):\n                log.info(\"overwriting NDData's current \"\n                         \"unit with specified unit.\")\n            elif data.unit is not None:\n                unit = data.unit\n\n            if uncertainty is not None and data.uncertainty is not None:\n                log.info(\"overwriting NDData's current \"\n                         \"uncertainty with specified uncertainty.\")\n            elif data.uncertainty is not None:\n                uncertainty = data.uncertainty\n\n            if mask is not None and data.mask is not None:\n                log.info(\"overwriting NDData's current \"\n                         \"mask with specified mask.\")\n            elif data.mask is not None:\n                mask = data.mask\n\n            if wcs is not None and data.wcs is not None:\n                log.info(\"overwriting NDData's current \"\n                         \"wcs with specified wcs.\")\n            elif data.wcs is not None:\n                wcs = data.wcs\n\n            if meta is not None and data.meta is not None:\n                log.info(\"overwriting NDData's current \"\n                         \"meta with specified meta.\")\n            elif data.meta is not None:\n                meta = data.meta\n\n            data = data.data\n\n        else:\n            if hasattr(data, 'mask') and hasattr(data, 'data'):\n                # Separating data and mask\n                if mask is not None:\n                    log.info(\"overwriting Masked Objects's current \"\n                             \"mask with specified mask.\")\n                else:\n                    mask = data.mask\n\n                # Just save the data for further processing, we could be given\n                # a masked Quantity or something else entirely. Better to check\n                # it first.\n                data = data.data\n\n            if isinstance(data, Quantity):\n                if unit is not None and unit != data.unit:\n                    log.info(\"overwriting Quantity's current \"\n                             \"unit with specified unit.\")\n                else:\n                    unit = data.unit\n                data = data.value\n\n        # Quick check on the parameters if they match the requirements.\n        if (not hasattr(data, 'shape') or not hasattr(data, '__getitem__') or\n                not hasattr(data, '__array__')):\n            # Data doesn't look like a numpy array, try converting it to\n            # one.\n            data = np.array(data, subok=True, copy=False)\n\n        # Another quick check to see if what we got looks like an array\n        # rather than an object (since numpy will convert a\n        # non-numerical/non-string inputs to an array of objects).\n        if data.dtype == 'O':\n            raise TypeError(\"could not convert data to numpy array.\")\n\n        if unit is not None:\n            unit = Unit(unit)\n\n        if copy:\n            # Data might have been copied before but no way of validating\n            # without another variable.\n            data = deepcopy(data)\n            mask = deepcopy(mask)\n            wcs = deepcopy(wcs)\n            meta = deepcopy(meta)\n            uncertainty = deepcopy(uncertainty)\n            # Actually - copying the unit is unnecessary but better safe\n            # than sorry :-)\n            unit = deepcopy(unit)\n\n        # Store the attributes\n        self._data = data\n        self.mask = mask\n        self._wcs = None\n        if wcs is not None:\n            # Validate the wcs\n            self.wcs = wcs\n        self.meta = meta  # TODO: Make this call the setter sometime\n        self._unit = unit\n        # Call the setter for uncertainty to further check the uncertainty\n        self.uncertainty = uncertainty\n\n    def __str__(self):\n        data = str(self.data)\n        unit = f\" {self.unit}\" if self.unit is not None else ''\n\n        return data + unit\n\n    def __repr__(self):\n        prefix = self.__class__.__name__ + '('\n        data = np.array2string(self.data, separator=', ', prefix=prefix)\n        unit = f\", unit='{self.unit}'\" if self.unit is not None else ''\n\n        return ''.join((prefix, data, unit, ')'))\n\n    @property\n    def data(self):\n        \"\"\"\n        `~numpy.ndarray`-like : The stored dataset.\n        \"\"\"\n        return self._data\n\n    @property\n    def mask(self):\n        \"\"\"\n        any type : Mask for the dataset, if any.\n\n        Masks should follow the ``numpy`` convention that valid data points are\n        marked by ``False`` and invalid ones with ``True``.\n        \"\"\"\n        return self._mask\n\n    @mask.setter\n    def mask(self, value):\n        self._mask = value\n\n    @property\n    def unit(self):\n        \"\"\"\n        `~astropy.units.Unit` : Unit for the dataset, if any.\n        \"\"\"\n        return self._unit\n\n    @property\n    def wcs(self):\n        \"\"\"\n        any type : A world coordinate system (WCS) for the dataset, if any.\n        \"\"\"\n        return self._wcs\n\n    @wcs.setter\n    def wcs(self, wcs):\n        if self._wcs is not None and wcs is not None:\n            raise ValueError(\"You can only set the wcs attribute with a WCS if no WCS is present.\")\n\n        if wcs is None or isinstance(wcs, BaseHighLevelWCS):\n            self._wcs = wcs\n        elif isinstance(wcs, BaseLowLevelWCS):\n            self._wcs = HighLevelWCSWrapper(wcs)\n        else:\n            raise TypeError(\"The wcs argument must implement either the high or\"\n                            \" low level WCS API.\")\n\n    @property\n    def uncertainty(self):\n        \"\"\"\n        any type : Uncertainty in the dataset, if any.\n\n        Should have an attribute ``uncertainty_type`` that defines what kind of\n        uncertainty is stored, such as ``'std'`` for standard deviation or\n        ``'var'`` for variance. A metaclass defining such an interface is\n        `~astropy.nddata.NDUncertainty` but isn't mandatory.\n        \"\"\"\n        return self._uncertainty\n\n    @uncertainty.setter\n    def uncertainty(self, value):\n        if value is not None:\n            # There is one requirements on the uncertainty: That\n            # it has an attribute 'uncertainty_type'.\n            # If it does not match this requirement convert it to an unknown\n            # uncertainty.\n            if not hasattr(value, 'uncertainty_type'):\n                log.info('uncertainty should have attribute uncertainty_type.')\n                value = UnknownUncertainty(value, copy=False)\n\n            # If it is a subclass of NDUncertainty we must set the\n            # parent_nddata attribute. (#4152)\n            if isinstance(value, NDUncertainty):\n                # In case the uncertainty already has a parent create a new\n                # instance because we need to assume that we don't want to\n                # steal the uncertainty from another NDData object\n                if value._parent_nddata is not None:\n                    value = value.__class__(value, copy=False)\n                # Then link it to this NDData instance (internally this needs\n                # to be saved as weakref but that's done by NDUncertainty\n                # setter).\n                value.parent_nddata = self\n        self._uncertainty = value\n"},{"className":"NDUncertainty","col":0,"comment":"This is the metaclass for uncertainty classes used with `NDData`.\n\n    Parameters\n    ----------\n    array : any type, optional\n        The array or value (the parameter name is due to historical reasons) of\n        the uncertainty. `numpy.ndarray`, `~astropy.units.Quantity` or\n        `NDUncertainty` subclasses are recommended.\n        If the `array` is `list`-like or `numpy.ndarray`-like it will be cast\n        to a plain `numpy.ndarray`.\n        Default is ``None``.\n\n    unit : unit-like, optional\n        Unit for the uncertainty ``array``. Strings that can be converted to a\n        `~astropy.units.Unit` are allowed.\n        Default is ``None``.\n\n    copy : `bool`, optional\n        Indicates whether to save the `array` as a copy. ``True`` copies it\n        before saving, while ``False`` tries to save every parameter as\n        reference. Note however that it is not always possible to save the\n        input as reference.\n        Default is ``True``.\n\n    Raises\n    ------\n    IncompatibleUncertaintiesException\n        If given another `NDUncertainty`-like class as ``array`` if their\n        ``uncertainty_type`` is different.\n    ","endLoc":396,"id":11680,"nodeType":"Class","startLoc":31,"text":"class NDUncertainty(metaclass=ABCMeta):\n    \"\"\"This is the metaclass for uncertainty classes used with `NDData`.\n\n    Parameters\n    ----------\n    array : any type, optional\n        The array or value (the parameter name is due to historical reasons) of\n        the uncertainty. `numpy.ndarray`, `~astropy.units.Quantity` or\n        `NDUncertainty` subclasses are recommended.\n        If the `array` is `list`-like or `numpy.ndarray`-like it will be cast\n        to a plain `numpy.ndarray`.\n        Default is ``None``.\n\n    unit : unit-like, optional\n        Unit for the uncertainty ``array``. Strings that can be converted to a\n        `~astropy.units.Unit` are allowed.\n        Default is ``None``.\n\n    copy : `bool`, optional\n        Indicates whether to save the `array` as a copy. ``True`` copies it\n        before saving, while ``False`` tries to save every parameter as\n        reference. Note however that it is not always possible to save the\n        input as reference.\n        Default is ``True``.\n\n    Raises\n    ------\n    IncompatibleUncertaintiesException\n        If given another `NDUncertainty`-like class as ``array`` if their\n        ``uncertainty_type`` is different.\n    \"\"\"\n\n    def __init__(self, array=None, copy=True, unit=None):\n        if isinstance(array, NDUncertainty):\n            # Given an NDUncertainty class or subclass check that the type\n            # is the same.\n            if array.uncertainty_type != self.uncertainty_type:\n                raise IncompatibleUncertaintiesException\n            # Check if two units are given and take the explicit one then.\n            if (unit is not None and unit != array._unit):\n                # TODO : Clarify it (see NDData.init for same problem)?\n                log.info(\"overwriting Uncertainty's current \"\n                         \"unit with specified unit.\")\n            elif array._unit is not None:\n                unit = array.unit\n            array = array.array\n\n        elif isinstance(array, Quantity):\n            # Check if two units are given and take the explicit one then.\n            if (unit is not None and array.unit is not None and\n                    unit != array.unit):\n                log.info(\"overwriting Quantity's current \"\n                         \"unit with specified unit.\")\n            elif array.unit is not None:\n                unit = array.unit\n            array = array.value\n\n        if unit is None:\n            self._unit = None\n        else:\n            self._unit = Unit(unit)\n\n        if copy:\n            array = deepcopy(array)\n            unit = deepcopy(unit)\n\n        self.array = array\n        self.parent_nddata = None  # no associated NDData - until it is set!\n\n    @property\n    @abstractmethod\n    def uncertainty_type(self):\n        \"\"\"`str` : Short description of the type of uncertainty.\n\n        Defined as abstract property so subclasses *have* to override this.\n        \"\"\"\n        return None\n\n    @property\n    def supports_correlated(self):\n        \"\"\"`bool` : Supports uncertainty propagation with correlated \\\n                 uncertainties?\n\n        .. versionadded:: 1.2\n        \"\"\"\n        return False\n\n    @property\n    def array(self):\n        \"\"\"`numpy.ndarray` : the uncertainty's value.\n        \"\"\"\n        return self._array\n\n    @array.setter\n    def array(self, value):\n        if isinstance(value, (list, np.ndarray)):\n            value = np.array(value, subok=False, copy=False)\n        self._array = value\n\n    @property\n    def unit(self):\n        \"\"\"`~astropy.units.Unit` : The unit of the uncertainty, if any.\n        \"\"\"\n        return self._unit\n\n    @unit.setter\n    def unit(self, value):\n        \"\"\"\n        The unit should be set to a value consistent with the parent NDData\n        unit and the uncertainty type.\n        \"\"\"\n        if value is not None:\n            # Check the hidden attribute below, not the property. The property\n            # raises an exception if there is no parent_nddata.\n            if self._parent_nddata is not None:\n                parent_unit = self.parent_nddata.unit\n                try:\n                    # Check for consistency with the unit of the parent_nddata\n                    self._data_unit_to_uncertainty_unit(parent_unit).to(value)\n                except UnitConversionError:\n                    raise UnitConversionError(\"Unit {} is incompatible \"\n                                              \"with unit {} of parent \"\n                                              \"nddata\".format(value,\n                                                              parent_unit))\n\n            self._unit = Unit(value)\n        else:\n            self._unit = value\n\n    @property\n    def quantity(self):\n        \"\"\"\n        This uncertainty as an `~astropy.units.Quantity` object.\n        \"\"\"\n        return Quantity(self.array, self.unit, copy=False, dtype=self.array.dtype)\n\n    @property\n    def parent_nddata(self):\n        \"\"\"`NDData` : reference to `NDData` instance with this uncertainty.\n\n        In case the reference is not set uncertainty propagation will not be\n        possible since propagation might need the uncertain data besides the\n        uncertainty.\n        \"\"\"\n        no_parent_message = \"uncertainty is not associated with an NDData object\"\n        parent_lost_message = (\n            \"the associated NDData object was deleted and cannot be accessed \"\n            \"anymore. You can prevent the NDData object from being deleted by \"\n            \"assigning it to a variable. If this happened after unpickling \"\n            \"make sure you pickle the parent not the uncertainty directly.\"\n        )\n        try:\n            parent = self._parent_nddata\n        except AttributeError:\n            raise MissingDataAssociationException(no_parent_message)\n        else:\n            if parent is None:\n                raise MissingDataAssociationException(no_parent_message)\n            else:\n                # The NDData is saved as weak reference so we must call it\n                # to get the object the reference points to. However because\n                # we have a weak reference here it's possible that the parent\n                # was deleted because its reference count dropped to zero.\n                if isinstance(self._parent_nddata, weakref.ref):\n                    resolved_parent = self._parent_nddata()\n                    if resolved_parent is None:\n                        log.info(parent_lost_message)\n                    return resolved_parent\n                else:\n                    log.info(\"parent_nddata should be a weakref to an NDData \"\n                             \"object.\")\n                    return self._parent_nddata\n\n    @parent_nddata.setter\n    def parent_nddata(self, value):\n        if value is not None and not isinstance(value, weakref.ref):\n            # Save a weak reference on the uncertainty that points to this\n            # instance of NDData. Direct references should NOT be used:\n            # https://github.com/astropy/astropy/pull/4799#discussion_r61236832\n            value = weakref.ref(value)\n        # Set _parent_nddata here and access below with the property because value\n        # is a weakref\n        self._parent_nddata = value\n        # set uncertainty unit to that of the parent if it was not already set, unless initializing\n        # with empty parent (Value=None)\n        if value is not None:\n            parent_unit = self.parent_nddata.unit\n            if self.unit is None:\n                if parent_unit is None:\n                    self.unit = None\n                else:\n                    # Set the uncertainty's unit to the appropriate value\n                    self.unit = self._data_unit_to_uncertainty_unit(parent_unit)\n            else:\n                # Check that units of uncertainty are compatible with those of\n                # the parent. If they are, no need to change units of the\n                # uncertainty or the data. If they are not, let the user know.\n                unit_from_data = self._data_unit_to_uncertainty_unit(parent_unit)\n                try:\n                    unit_from_data.to(self.unit)\n                except UnitConversionError:\n                    raise UnitConversionError(\"Unit {} of uncertainty \"\n                                              \"incompatible with unit {} of \"\n                                              \"data\".format(self.unit,\n                                                            parent_unit))\n\n    @abstractmethod\n    def _data_unit_to_uncertainty_unit(self, value):\n        \"\"\"\n        Subclasses must override this property. It should take in a data unit\n        and return the correct unit for the uncertainty given the uncertainty\n        type.\n        \"\"\"\n        return None\n\n    def __repr__(self):\n        prefix = self.__class__.__name__ + '('\n        try:\n            body = np.array2string(self.array, separator=', ', prefix=prefix)\n        except AttributeError:\n            # In case it wasn't possible to use array2string\n            body = str(self.array)\n        return ''.join([prefix, body, ')'])\n\n    def __getstate__(self):\n        # Because of the weak reference the class wouldn't be picklable.\n        try:\n            return self._array, self._unit, self.parent_nddata\n        except MissingDataAssociationException:\n            # In case there's no parent\n            return self._array, self._unit, None\n\n    def __setstate__(self, state):\n        if len(state) != 3:\n            raise TypeError('The state should contain 3 items.')\n        self._array = state[0]\n        self._unit = state[1]\n\n        parent = state[2]\n        if parent is not None:\n            parent = weakref.ref(parent)\n        self._parent_nddata = parent\n\n    def __getitem__(self, item):\n        \"\"\"Normal slicing on the array, keep the unit and return a reference.\n        \"\"\"\n        return self.__class__(self.array[item], unit=self.unit, copy=False)\n\n    def propagate(self, operation, other_nddata, result_data, correlation):\n        \"\"\"Calculate the resulting uncertainty given an operation on the data.\n\n        .. versionadded:: 1.2\n\n        Parameters\n        ----------\n        operation : callable\n            The operation that is performed on the `NDData`. Supported are\n            `numpy.add`, `numpy.subtract`, `numpy.multiply` and\n            `numpy.true_divide` (or `numpy.divide`).\n\n        other_nddata : `NDData` instance\n            The second operand in the arithmetic operation.\n\n        result_data : `~astropy.units.Quantity` or ndarray\n            The result of the arithmetic operations on the data.\n\n        correlation : `numpy.ndarray` or number\n            The correlation (rho) is defined between the uncertainties in\n            sigma_AB = sigma_A * sigma_B * rho. A value of ``0`` means\n            uncorrelated operands.\n\n        Returns\n        -------\n        resulting_uncertainty : `NDUncertainty` instance\n            Another instance of the same `NDUncertainty` subclass containing\n            the uncertainty of the result.\n\n        Raises\n        ------\n        ValueError\n            If the ``operation`` is not supported or if correlation is not zero\n            but the subclass does not support correlated uncertainties.\n\n        Notes\n        -----\n        First this method checks if a correlation is given and the subclass\n        implements propagation with correlated uncertainties.\n        Then the second uncertainty is converted (or an Exception is raised)\n        to the same class in order to do the propagation.\n        Then the appropriate propagation method is invoked and the result is\n        returned.\n        \"\"\"\n        # Check if the subclass supports correlation\n        if not self.supports_correlated:\n            if isinstance(correlation, np.ndarray) or correlation != 0:\n                raise ValueError(\"{} does not support uncertainty propagation\"\n                                 \" with correlation.\"\n                                 \"\".format(self.__class__.__name__))\n\n        # Get the other uncertainty (and convert it to a matching one)\n        other_uncert = self._convert_uncertainty(other_nddata.uncertainty)\n\n        if operation.__name__ == 'add':\n            result = self._propagate_add(other_uncert, result_data,\n                                         correlation)\n        elif operation.__name__ == 'subtract':\n            result = self._propagate_subtract(other_uncert, result_data,\n                                              correlation)\n        elif operation.__name__ == 'multiply':\n            result = self._propagate_multiply(other_uncert, result_data,\n                                              correlation)\n        elif operation.__name__ in ['true_divide', 'divide']:\n            result = self._propagate_divide(other_uncert, result_data,\n                                            correlation)\n        else:\n            raise ValueError('unsupported operation')\n\n        return self.__class__(result, copy=False)\n\n    def _convert_uncertainty(self, other_uncert):\n        \"\"\"Checks if the uncertainties are compatible for propagation.\n\n        Checks if the other uncertainty is `NDUncertainty`-like and if so\n        verify that the uncertainty_type is equal. If the latter is not the\n        case try returning ``self.__class__(other_uncert)``.\n\n        Parameters\n        ----------\n        other_uncert : `NDUncertainty` subclass\n            The other uncertainty.\n\n        Returns\n        -------\n        other_uncert : `NDUncertainty` subclass\n            but converted to a compatible `NDUncertainty` subclass if\n            possible and necessary.\n\n        Raises\n        ------\n        IncompatibleUncertaintiesException:\n            If the other uncertainty cannot be converted to a compatible\n            `NDUncertainty` subclass.\n        \"\"\"\n        if isinstance(other_uncert, NDUncertainty):\n            if self.uncertainty_type == other_uncert.uncertainty_type:\n                return other_uncert\n            else:\n                return self.__class__(other_uncert)\n        else:\n            raise IncompatibleUncertaintiesException\n\n    @abstractmethod\n    def _propagate_add(self, other_uncert, result_data, correlation):\n        return None\n\n    @abstractmethod\n    def _propagate_subtract(self, other_uncert, result_data, correlation):\n        return None\n\n    @abstractmethod\n    def _propagate_multiply(self, other_uncert, result_data, correlation):\n        return None\n\n    @abstractmethod\n    def _propagate_divide(self, other_uncert, result_data, correlation):\n        return None"},{"col":4,"comment":"Remove items from the sequence when deleting.","endLoc":634,"header":"def __delitem__(self, key)","id":11682,"name":"__delitem__","nodeType":"Function","startLoc":626,"text":"def __delitem__(self, key):\n        \"\"\"Remove items from the sequence when deleting.\"\"\"\n        dict. __delitem__(self, key)\n        if key in self.scalars:\n            self.scalars.remove(key)\n        else:\n            self.sections.remove(key)\n        del self.comments[key]\n        del self.inline_comments[key]"},{"col":4,"comment":"`str` : Short description of the type of uncertainty.\n\n        Defined as abstract property so subclasses *have* to override this.\n        ","endLoc":107,"header":"@property\n    @abstractmethod\n    def uncertainty_type(self)","id":11683,"name":"uncertainty_type","nodeType":"Function","startLoc":100,"text":"@property\n    @abstractmethod\n    def uncertainty_type(self):\n        \"\"\"`str` : Short description of the type of uncertainty.\n\n        Defined as abstract property so subclasses *have* to override this.\n        \"\"\"\n        return None"},{"col":4,"comment":"`bool` : Supports uncertainty propagation with correlated \n                 uncertainties?\n\n        .. versionadded:: 1.2\n        ","endLoc":116,"header":"@property\n    def supports_correlated(self)","id":11684,"name":"supports_correlated","nodeType":"Function","startLoc":109,"text":"@property\n    def supports_correlated(self):\n        \"\"\"`bool` : Supports uncertainty propagation with correlated \\\n                 uncertainties?\n\n        .. versionadded:: 1.2\n        \"\"\"\n        return False"},{"col":4,"comment":"`numpy.ndarray` : the uncertainty's value.\n        ","endLoc":122,"header":"@property\n    def array(self)","id":11685,"name":"array","nodeType":"Function","startLoc":118,"text":"@property\n    def array(self):\n        \"\"\"`numpy.ndarray` : the uncertainty's value.\n        \"\"\"\n        return self._array"},{"col":4,"comment":"null","endLoc":128,"header":"@array.setter\n    def array(self, value)","id":11686,"name":"array","nodeType":"Function","startLoc":124,"text":"@array.setter\n    def array(self, value):\n        if isinstance(value, (list, np.ndarray)):\n            value = np.array(value, subok=False, copy=False)\n        self._array = value"},{"col":4,"comment":"`~astropy.units.Unit` : The unit of the uncertainty, if any.\n        ","endLoc":134,"header":"@property\n    def unit(self)","id":11687,"name":"unit","nodeType":"Function","startLoc":130,"text":"@property\n    def unit(self):\n        \"\"\"`~astropy.units.Unit` : The unit of the uncertainty, if any.\n        \"\"\"\n        return self._unit"},{"col":4,"comment":"\n        The unit should be set to a value consistent with the parent NDData\n        unit and the uncertainty type.\n        ","endLoc":158,"header":"@unit.setter\n    def unit(self, value)","id":11688,"name":"unit","nodeType":"Function","startLoc":136,"text":"@unit.setter\n    def unit(self, value):\n        \"\"\"\n        The unit should be set to a value consistent with the parent NDData\n        unit and the uncertainty type.\n        \"\"\"\n        if value is not None:\n            # Check the hidden attribute below, not the property. The property\n            # raises an exception if there is no parent_nddata.\n            if self._parent_nddata is not None:\n                parent_unit = self.parent_nddata.unit\n                try:\n                    # Check for consistency with the unit of the parent_nddata\n                    self._data_unit_to_uncertainty_unit(parent_unit).to(value)\n                except UnitConversionError:\n                    raise UnitConversionError(\"Unit {} is incompatible \"\n                                              \"with unit {} of parent \"\n                                              \"nddata\".format(value,\n                                                              parent_unit))\n\n            self._unit = Unit(value)\n        else:\n            self._unit = value"},{"attributeType":"null","col":4,"comment":"null","endLoc":117,"id":11689,"name":"meta","nodeType":"Attribute","startLoc":117,"text":"meta"},{"attributeType":"null","col":8,"comment":"null","endLoc":226,"id":11690,"name":"_data","nodeType":"Attribute","startLoc":226,"text":"self._data"},{"attributeType":"null","col":8,"comment":"null","endLoc":333,"id":11691,"name":"_uncertainty","nodeType":"Attribute","startLoc":333,"text":"self._uncertainty"},{"attributeType":"null","col":8,"comment":"null","endLoc":233,"id":11692,"name":"_unit","nodeType":"Attribute","startLoc":233,"text":"self._unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":228,"id":11693,"name":"_wcs","nodeType":"Attribute","startLoc":228,"text":"self._wcs"},{"attributeType":"null","col":12,"comment":"null","endLoc":231,"id":11694,"name":"wcs","nodeType":"Attribute","startLoc":231,"text":"self.wcs"},{"col":4,"comment":"\n        A version of update that uses our ``__setitem__``.\n        ","endLoc":650,"header":"def update(self, indict)","id":11695,"name":"update","nodeType":"Function","startLoc":645,"text":"def update(self, indict):\n        \"\"\"\n        A version of update that uses our ``__setitem__``.\n        \"\"\"\n        for entry in indict:\n            self[entry] = indict[entry]"},{"col":4,"comment":"\n        'D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n        If key is not found, d is returned if given, otherwise KeyError is raised'\n        ","endLoc":666,"header":"def pop(self, key, default=MISSING)","id":11696,"name":"pop","nodeType":"Function","startLoc":653,"text":"def pop(self, key, default=MISSING):\n        \"\"\"\n        'D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n        If key is not found, d is returned if given, otherwise KeyError is raised'\n        \"\"\"\n        try:\n            val = self[key]\n        except KeyError:\n            if default is MISSING:\n                raise\n            val = default\n        else:\n            del self[key]\n        return val"},{"attributeType":"null","col":8,"comment":"null","endLoc":232,"id":11697,"name":"meta","nodeType":"Attribute","startLoc":232,"text":"self.meta"},{"col":4,"comment":"Pops the first (key,val)","endLoc":677,"header":"def popitem(self)","id":11698,"name":"popitem","nodeType":"Function","startLoc":669,"text":"def popitem(self):\n        \"\"\"Pops the first (key,val)\"\"\"\n        sequence = (self.scalars + self.sections)\n        if not sequence:\n            raise KeyError(\": 'popitem(): dictionary is empty'\")\n        key = sequence[0]\n        val =  self[key]\n        del self[key]\n        return key, val"},{"col":4,"comment":"\n        A version of clear that also affects scalars/sections\n        Also clears comments and configspec.\n\n        Leaves other attributes alone :\n            depth/main/parent are not affected\n        ","endLoc":695,"header":"def clear(self)","id":11699,"name":"clear","nodeType":"Function","startLoc":680,"text":"def clear(self):\n        \"\"\"\n        A version of clear that also affects scalars/sections\n        Also clears comments and configspec.\n\n        Leaves other attributes alone :\n            depth/main/parent are not affected\n        \"\"\"\n        dict.clear(self)\n        self.scalars = []\n        self.sections = []\n        self.comments = {}\n        self.inline_comments = {}\n        self.configspec = None\n        self.defaults = []\n        self.extra_values = []"},{"col":4,"comment":"A version of setdefault that sets sequence if appropriate.","endLoc":704,"header":"def setdefault(self, key, default=None)","id":11700,"name":"setdefault","nodeType":"Function","startLoc":698,"text":"def setdefault(self, key, default=None):\n        \"\"\"A version of setdefault that sets sequence if appropriate.\"\"\"\n        try:\n            return self[key]\n        except KeyError:\n            self[key] = default\n            return self[key]"},{"col":4,"comment":"D.items() -> list of D's (key, value) pairs, as 2-tuples","endLoc":709,"header":"def items(self)","id":11701,"name":"items","nodeType":"Function","startLoc":707,"text":"def items(self):\n        \"\"\"D.items() -> list of D's (key, value) pairs, as 2-tuples\"\"\"\n        return list(zip((self.scalars + self.sections), list(self.values())))"},{"attributeType":"null","col":8,"comment":"null","endLoc":269,"id":11702,"name":"_mask","nodeType":"Attribute","startLoc":269,"text":"self._mask"},{"attributeType":"null","col":8,"comment":"null","endLoc":235,"id":11703,"name":"uncertainty","nodeType":"Attribute","startLoc":235,"text":"self.uncertainty"},{"col":4,"comment":"D.keys() -> list of D's keys","endLoc":714,"header":"def keys(self)","id":11704,"name":"keys","nodeType":"Function","startLoc":712,"text":"def keys(self):\n        \"\"\"D.keys() -> list of D's keys\"\"\"\n        return (self.scalars + self.sections)"},{"col":4,"comment":"D.iteritems() -> an iterator over the (key, value) items of D","endLoc":724,"header":"def iteritems(self)","id":11705,"name":"iteritems","nodeType":"Function","startLoc":722,"text":"def iteritems(self):\n        \"\"\"D.iteritems() -> an iterator over the (key, value) items of D\"\"\"\n        return iter(list(self.items()))"},{"attributeType":"null","col":8,"comment":"null","endLoc":227,"id":11706,"name":"mask","nodeType":"Attribute","startLoc":227,"text":"self.mask"},{"col":4,"comment":"D.iterkeys() -> an iterator over the keys of D","endLoc":729,"header":"def iterkeys(self)","id":11707,"name":"iterkeys","nodeType":"Function","startLoc":727,"text":"def iterkeys(self):\n        \"\"\"D.iterkeys() -> an iterator over the keys of D\"\"\"\n        return iter((self.scalars + self.sections))"},{"col":4,"comment":"D.itervalues() -> an iterator over the values of D","endLoc":736,"header":"def itervalues(self)","id":11708,"name":"itervalues","nodeType":"Function","startLoc":734,"text":"def itervalues(self):\n        \"\"\"D.itervalues() -> an iterator over the values of D\"\"\"\n        return iter(list(self.values()))"},{"col":0,"comment":"Decorator to wrap functions that could accept an NDData instance with\n    its properties passed as function arguments.\n\n    Parameters\n    ----------\n    _func : callable, None, optional\n        The function to decorate or ``None`` if used as factory. The first\n        positional argument should be ``data`` and take a numpy array. It is\n        possible to overwrite the name, see ``attribute_argument_mapping``\n        argument.\n        Default is ``None``.\n\n    accepts : class, optional\n        The class or subclass of ``NDData`` that should be unpacked before\n        calling the function.\n        Default is ``NDData``\n\n    repack : bool, optional\n        Should be ``True`` if the return should be converted to the input\n        class again after the wrapped function call.\n        Default is ``False``.\n\n        .. note::\n           Must be ``True`` if either one of ``returns`` or ``keeps``\n           is specified.\n\n    returns : iterable, None, optional\n        An iterable containing strings which returned value should be set\n        on the class. For example if a function returns data and mask, this\n        should be ``['data', 'mask']``. If ``None`` assume the function only\n        returns one argument: ``'data'``.\n        Default is ``None``.\n\n        .. note::\n           Must be ``None`` if ``repack=False``.\n\n    keeps : iterable. None, optional\n        An iterable containing strings that indicate which values should be\n        copied from the original input to the returned class. If ``None``\n        assume that no attributes are copied.\n        Default is ``None``.\n\n        .. note::\n           Must be ``None`` if ``repack=False``.\n\n    attribute_argument_mapping :\n        Keyword parameters that optionally indicate which function argument\n        should be interpreted as which attribute on the input. By default\n        it assumes the function takes a ``data`` argument as first argument,\n        but if the first argument is called ``input`` one should pass\n        ``support_nddata(..., data='input')`` to the function.\n\n    Returns\n    -------\n    decorator_factory or decorated_function : callable\n        If ``_func=None`` this returns a decorator, otherwise it returns the\n        decorated ``_func``.\n\n    Notes\n    -----\n    If properties of ``NDData`` are set but have no corresponding function\n    argument a Warning is shown.\n\n    If a property is set of the ``NDData`` are set and an explicit argument is\n    given, the explicitly given argument is used and a Warning is shown.\n\n    The supported properties are:\n\n    - ``mask``\n    - ``unit``\n    - ``wcs``\n    - ``meta``\n    - ``uncertainty``\n    - ``flags``\n\n    Examples\n    --------\n\n    This function takes a Numpy array for the data, and some WCS information\n    with the ``wcs`` keyword argument::\n\n        def downsample(data, wcs=None):\n            # downsample data and optionally WCS here\n            pass\n\n    However, you might have an NDData instance that has the ``wcs`` property\n    set and you would like to be able to call the function with\n    ``downsample(my_nddata)`` and have the WCS information, if present,\n    automatically be passed to the ``wcs`` keyword argument.\n\n    This decorator can be used to make this possible::\n\n        @support_nddata\n        def downsample(data, wcs=None):\n            # downsample data and optionally WCS here\n            pass\n\n    This function can now either be called as before, specifying the data and\n    WCS separately, or an NDData instance can be passed to the ``data``\n    argument.\n    ","endLoc":278,"header":"def support_nddata(_func=None, accepts=NDData,\n                   repack=False, returns=None, keeps=None,\n                   **attribute_argument_mapping)","id":11709,"name":"support_nddata","nodeType":"Function","startLoc":22,"text":"def support_nddata(_func=None, accepts=NDData,\n                   repack=False, returns=None, keeps=None,\n                   **attribute_argument_mapping):\n    \"\"\"Decorator to wrap functions that could accept an NDData instance with\n    its properties passed as function arguments.\n\n    Parameters\n    ----------\n    _func : callable, None, optional\n        The function to decorate or ``None`` if used as factory. The first\n        positional argument should be ``data`` and take a numpy array. It is\n        possible to overwrite the name, see ``attribute_argument_mapping``\n        argument.\n        Default is ``None``.\n\n    accepts : class, optional\n        The class or subclass of ``NDData`` that should be unpacked before\n        calling the function.\n        Default is ``NDData``\n\n    repack : bool, optional\n        Should be ``True`` if the return should be converted to the input\n        class again after the wrapped function call.\n        Default is ``False``.\n\n        .. note::\n           Must be ``True`` if either one of ``returns`` or ``keeps``\n           is specified.\n\n    returns : iterable, None, optional\n        An iterable containing strings which returned value should be set\n        on the class. For example if a function returns data and mask, this\n        should be ``['data', 'mask']``. If ``None`` assume the function only\n        returns one argument: ``'data'``.\n        Default is ``None``.\n\n        .. note::\n           Must be ``None`` if ``repack=False``.\n\n    keeps : iterable. None, optional\n        An iterable containing strings that indicate which values should be\n        copied from the original input to the returned class. If ``None``\n        assume that no attributes are copied.\n        Default is ``None``.\n\n        .. note::\n           Must be ``None`` if ``repack=False``.\n\n    attribute_argument_mapping :\n        Keyword parameters that optionally indicate which function argument\n        should be interpreted as which attribute on the input. By default\n        it assumes the function takes a ``data`` argument as first argument,\n        but if the first argument is called ``input`` one should pass\n        ``support_nddata(..., data='input')`` to the function.\n\n    Returns\n    -------\n    decorator_factory or decorated_function : callable\n        If ``_func=None`` this returns a decorator, otherwise it returns the\n        decorated ``_func``.\n\n    Notes\n    -----\n    If properties of ``NDData`` are set but have no corresponding function\n    argument a Warning is shown.\n\n    If a property is set of the ``NDData`` are set and an explicit argument is\n    given, the explicitly given argument is used and a Warning is shown.\n\n    The supported properties are:\n\n    - ``mask``\n    - ``unit``\n    - ``wcs``\n    - ``meta``\n    - ``uncertainty``\n    - ``flags``\n\n    Examples\n    --------\n\n    This function takes a Numpy array for the data, and some WCS information\n    with the ``wcs`` keyword argument::\n\n        def downsample(data, wcs=None):\n            # downsample data and optionally WCS here\n            pass\n\n    However, you might have an NDData instance that has the ``wcs`` property\n    set and you would like to be able to call the function with\n    ``downsample(my_nddata)`` and have the WCS information, if present,\n    automatically be passed to the ``wcs`` keyword argument.\n\n    This decorator can be used to make this possible::\n\n        @support_nddata\n        def downsample(data, wcs=None):\n            # downsample data and optionally WCS here\n            pass\n\n    This function can now either be called as before, specifying the data and\n    WCS separately, or an NDData instance can be passed to the ``data``\n    argument.\n    \"\"\"\n    if (returns is not None or keeps is not None) and not repack:\n        raise ValueError('returns or keeps should only be set if repack=True.')\n    elif returns is None and repack:\n        raise ValueError('returns should be set if repack=True.')\n    else:\n        # Use empty lists for returns and keeps so we don't need to check\n        # if any of those is None later on.\n        if returns is None:\n            returns = []\n        if keeps is None:\n            keeps = []\n\n    # Short version to avoid the long variable name later.\n    attr_arg_map = attribute_argument_mapping\n    if any(keep in returns for keep in keeps):\n        raise ValueError(\"cannot specify the same attribute in `returns` and \"\n                         \"`keeps`.\")\n    all_returns = returns + keeps\n\n    def support_nddata_decorator(func):\n        # Find out args and kwargs\n        func_args, func_kwargs = [], []\n        sig = signature(func).parameters\n        for param_name, param in sig.items():\n            if param.kind in (param.VAR_POSITIONAL, param.VAR_KEYWORD):\n                raise ValueError(\"func may not have *args or **kwargs.\")\n            try:\n                if param.default == param.empty:\n                    func_args.append(param_name)\n                else:\n                    func_kwargs.append(param_name)\n            # The comparison to param.empty may fail if the default is a\n            # numpy array or something similar. So if the comparison fails then\n            # it's quite obvious that there was a default and it should be\n            # appended to the \"func_kwargs\".\n            except ValueError as exc:\n                if ('The truth value of an array with more than one element '\n                        'is ambiguous.') in str(exc):\n                    func_kwargs.append(param_name)\n                else:\n                    raise\n\n        # First argument should be data\n        if not func_args or func_args[0] != attr_arg_map.get('data', 'data'):\n            raise ValueError(\"Can only wrap functions whose first positional \"\n                             \"argument is `{}`\"\n                             \"\".format(attr_arg_map.get('data', 'data')))\n\n        @wraps(func)\n        def wrapper(data, *args, **kwargs):\n            bound_args = signature(func).bind(data, *args, **kwargs)\n            unpack = isinstance(data, accepts)\n            input_data = data\n            ignored = []\n            if not unpack and isinstance(data, NDData):\n                raise TypeError(\"Only NDData sub-classes that inherit from {}\"\n                                \" can be used by this function\"\n                                \"\".format(accepts.__name__))\n\n            # If data is an NDData instance, we can try and find properties\n            # that can be passed as kwargs.\n            if unpack:\n                # We loop over a list of pre-defined properties\n                for prop in islice(SUPPORTED_PROPERTIES, 1, None):\n                    # We only need to do something if the property exists on\n                    # the NDData object\n                    try:\n                        value = getattr(data, prop)\n                    except AttributeError:\n                        continue\n                    # Skip if the property exists but is None or empty.\n                    if prop == 'meta' and not value:\n                        continue\n                    elif value is None:\n                        continue\n                    # Warn if the property is set but not used by the function.\n                    propmatch = attr_arg_map.get(prop, prop)\n                    if propmatch not in func_kwargs:\n                        ignored.append(prop)\n                        continue\n\n                    # Check if the property was explicitly given and issue a\n                    # Warning if it is.\n                    if propmatch in bound_args.arguments:\n                        # If it's in the func_args it's trivial but if it was\n                        # in the func_kwargs we need to compare it to the\n                        # default.\n                        # Comparison to the default is done by comparing their\n                        # identity, this works because defaults in function\n                        # signatures are only created once and always reference\n                        # the same item.\n                        # FIXME: Python interns some values, for example the\n                        # integers from -5 to 255 (any maybe some other types\n                        # as well). In that case the default is\n                        # indistinguishable from an explicitly passed kwarg\n                        # and it won't notice that and use the attribute of the\n                        # NDData.\n                        if (propmatch in func_args or\n                                (propmatch in func_kwargs and\n                                 (bound_args.arguments[propmatch] is not\n                                  sig[propmatch].default))):\n                            warnings.warn(\n                                \"Property {} has been passed explicitly and \"\n                                \"as an NDData property{}, using explicitly \"\n                                \"specified value\"\n                                \"\".format(propmatch, '' if prop == propmatch\n                                          else ' ' + prop),\n                                AstropyUserWarning)\n                            continue\n                    # Otherwise use the property as input for the function.\n                    kwargs[propmatch] = value\n                # Finally, replace data by the data attribute\n                data = data.data\n\n                if ignored:\n                    warnings.warn(\"The following attributes were set on the \"\n                                  \"data object, but will be ignored by the \"\n                                  \"function: \" + \", \".join(ignored),\n                                  AstropyUserWarning)\n\n            result = func(data, *args, **kwargs)\n\n            if unpack and repack:\n                # If there are multiple required returned arguments make sure\n                # the result is a tuple (because we don't want to unpack\n                # numpy arrays or compare their length, never!) and has the\n                # same length.\n                if len(returns) > 1:\n                    if (not isinstance(result, tuple) or\n                            len(returns) != len(result)):\n                        raise ValueError(\"Function did not return the \"\n                                         \"expected number of arguments.\")\n                elif len(returns) == 1:\n                    result = [result]\n                if keeps is not None:\n                    for keep in keeps:\n                        result.append(deepcopy(getattr(input_data, keep)))\n                resultdata = result[all_returns.index('data')]\n                resultkwargs = {ret: res\n                                for ret, res in zip(all_returns, result)\n                                if ret != 'data'}\n                return input_data.__class__(resultdata, **resultkwargs)\n            else:\n                return result\n        return wrapper\n\n    # If _func is set, this means that the decorator was used without\n    # parameters so we have to return the result of the\n    # support_nddata_decorator decorator rather than the decorator itself\n    if _func is not None:\n        return support_nddata_decorator(_func)\n    else:\n        return support_nddata_decorator"},{"col":4,"comment":"\n        Subclasses must override this property. It should take in a data unit\n        and return the correct unit for the uncertainty given the uncertainty\n        type.\n        ","endLoc":244,"header":"@abstractmethod\n    def _data_unit_to_uncertainty_unit(self, value)","id":11710,"name":"_data_unit_to_uncertainty_unit","nodeType":"Function","startLoc":237,"text":"@abstractmethod\n    def _data_unit_to_uncertainty_unit(self, value):\n        \"\"\"\n        Subclasses must override this property. It should take in a data unit\n        and return the correct unit for the uncertainty given the uncertainty\n        type.\n        \"\"\"\n        return None"},{"col":4,"comment":"x.__repr__() <==> repr(x)","endLoc":747,"header":"def __repr__(self)","id":11711,"name":"__repr__","nodeType":"Function","startLoc":739,"text":"def __repr__(self):\n        \"\"\"x.__repr__() <==> repr(x)\"\"\"\n        def _getval(key):\n            try:\n                return self[key]\n            except MissingInterpolationOption:\n                return dict.__getitem__(self, key)\n        return '{%s}' % ', '.join([('%s: %s' % (repr(key), repr(_getval(key))))\n            for key in (self.scalars + self.sections)])"},{"col":4,"comment":"\n        Return a deepcopy of self as a dictionary.\n\n        All members that are ``Section`` instances are recursively turned to\n        ordinary dictionaries - by calling their ``dict`` method.\n\n        >>> n = a.dict()\n        >>> n == a\n        1\n        >>> n is a\n        0\n        ","endLoc":780,"header":"def dict(self)","id":11713,"name":"dict","nodeType":"Function","startLoc":755,"text":"def dict(self):\n        \"\"\"\n        Return a deepcopy of self as a dictionary.\n\n        All members that are ``Section`` instances are recursively turned to\n        ordinary dictionaries - by calling their ``dict`` method.\n\n        >>> n = a.dict()\n        >>> n == a\n        1\n        >>> n is a\n        0\n        \"\"\"\n        newdict = {}\n        for entry in self:\n            this_entry = self[entry]\n            if isinstance(this_entry, Section):\n                this_entry = this_entry.dict()\n            elif isinstance(this_entry, list):\n                # create a copy rather than a reference\n                this_entry = list(this_entry)\n            elif isinstance(this_entry, tuple):\n                # create a copy rather than a reference\n                this_entry = tuple(this_entry)\n            newdict[entry] = this_entry\n        return newdict"},{"col":4,"comment":"\n        A recursive update - useful for merging config files.\n\n        >>> a = '''[section1]\n        ...     option1 = True\n        ...     [[subsection]]\n        ...     more_options = False\n        ...     # end of file'''.splitlines()\n        >>> b = '''# File is user.ini\n        ...     [section1]\n        ...     option1 = False\n        ...     # end of file'''.splitlines()\n        >>> c1 = ConfigObj(b)\n        >>> c2 = ConfigObj(a)\n        >>> c2.merge(c1)\n        >>> c2\n        ConfigObj({'section1': {'option1': 'False', 'subsection': {'more_options': 'False'}}})\n        ","endLoc":807,"header":"def merge(self, indict)","id":11714,"name":"merge","nodeType":"Function","startLoc":783,"text":"def merge(self, indict):\n        \"\"\"\n        A recursive update - useful for merging config files.\n\n        >>> a = '''[section1]\n        ...     option1 = True\n        ...     [[subsection]]\n        ...     more_options = False\n        ...     # end of file'''.splitlines()\n        >>> b = '''# File is user.ini\n        ...     [section1]\n        ...     option1 = False\n        ...     # end of file'''.splitlines()\n        >>> c1 = ConfigObj(b)\n        >>> c2 = ConfigObj(a)\n        >>> c2.merge(c1)\n        >>> c2\n        ConfigObj({'section1': {'option1': 'False', 'subsection': {'more_options': 'False'}}})\n        \"\"\"\n        for key, val in list(indict.items()):\n            if (key in self and isinstance(self[key], Mapping) and\n                                isinstance(val, Mapping)):\n                self[key].merge(val)\n            else:\n                self[key] = val"},{"col":4,"comment":"null","endLoc":552,"header":"def expand_macros(self,tokens,expanded=None)","id":11715,"name":"expand_macros","nodeType":"Function","startLoc":489,"text":"def expand_macros(self,tokens,expanded=None):\n        if expanded is None:\n            expanded = {}\n        i = 0\n        while i < len(tokens):\n            t = tokens[i]\n            if t.type == self.t_ID:\n                if t.value in self.macros and t.value not in expanded:\n                    # Yes, we found a macro match\n                    expanded[t.value] = True\n\n                    m = self.macros[t.value]\n                    if not m.arglist:\n                        # A simple macro\n                        ex = self.expand_macros([copy.copy(_x) for _x in m.value],expanded)\n                        for e in ex:\n                            e.lineno = t.lineno\n                        tokens[i:i+1] = ex\n                        i += len(ex)\n                    else:\n                        # A macro with arguments\n                        j = i + 1\n                        while j < len(tokens) and tokens[j].type in self.t_WS:\n                            j += 1\n                        if j < len(tokens) and tokens[j].value == '(':\n                            tokcount,args,positions = self.collect_args(tokens[j:])\n                            if not m.variadic and len(args) !=  len(m.arglist):\n                                self.error(self.source,t.lineno,\"Macro %s requires %d arguments\" % (t.value,len(m.arglist)))\n                                i = j + tokcount\n                            elif m.variadic and len(args) < len(m.arglist)-1:\n                                if len(m.arglist) > 2:\n                                    self.error(self.source,t.lineno,\"Macro %s must have at least %d arguments\" % (t.value, len(m.arglist)-1))\n                                else:\n                                    self.error(self.source,t.lineno,\"Macro %s must have at least %d argument\" % (t.value, len(m.arglist)-1))\n                                i = j + tokcount\n                            else:\n                                if m.variadic:\n                                    if len(args) == len(m.arglist)-1:\n                                        args.append([])\n                                    else:\n                                        args[len(m.arglist)-1] = tokens[j+positions[len(m.arglist)-1]:j+tokcount-1]\n                                        del args[len(m.arglist):]\n\n                                # Get macro replacement text\n                                rep = self.macro_expand_args(m,args)\n                                rep = self.expand_macros(rep,expanded)\n                                for r in rep:\n                                    r.lineno = t.lineno\n                                tokens[i:j+tokcount] = rep\n                                i += len(rep)\n                        else:\n                            # This is not a macro. It is just a word which\n                            # equals to name of the macro. Hence, go to the\n                            # next token.\n                            i += 1\n\n                    del expanded[t.value]\n                    continue\n                elif t.value == '__LINE__':\n                    t.type = self.t_INTEGER\n                    t.value = self.t_INTEGER_TYPE(t.lineno)\n\n            i += 1\n        return tokens"},{"col":4,"comment":"\n        Change a keyname to another, without changing position in sequence.\n\n        Implemented so that transformations can be made on keys,\n        as well as on values. (used by encode and decode)\n\n        Also renames comments.\n        ","endLoc":837,"header":"def rename(self, oldkey, newkey)","id":11716,"name":"rename","nodeType":"Function","startLoc":810,"text":"def rename(self, oldkey, newkey):\n        \"\"\"\n        Change a keyname to another, without changing position in sequence.\n\n        Implemented so that transformations can be made on keys,\n        as well as on values. (used by encode and decode)\n\n        Also renames comments.\n        \"\"\"\n        if oldkey in self.scalars:\n            the_list = self.scalars\n        elif oldkey in self.sections:\n            the_list = self.sections\n        else:\n            raise KeyError('Key \"%s\" not found.' % oldkey)\n        pos = the_list.index(oldkey)\n        #\n        val = self[oldkey]\n        dict.__delitem__(self, oldkey)\n        dict.__setitem__(self, newkey, val)\n        the_list.remove(oldkey)\n        the_list.insert(pos, newkey)\n        comm = self.comments[oldkey]\n        inline_comment = self.inline_comments[oldkey]\n        del self.comments[oldkey]\n        del self.inline_comments[oldkey]\n        self.comments[newkey] = comm\n        self.inline_comments[newkey] = inline_comment"},{"col":4,"comment":"\n        This uncertainty as an `~astropy.units.Quantity` object.\n        ","endLoc":165,"header":"@property\n    def quantity(self)","id":11717,"name":"quantity","nodeType":"Function","startLoc":160,"text":"@property\n    def quantity(self):\n        \"\"\"\n        This uncertainty as an `~astropy.units.Quantity` object.\n        \"\"\"\n        return Quantity(self.array, self.unit, copy=False, dtype=self.array.dtype)"},{"col":4,"comment":"null","endLoc":855,"header":"def validate_module(self, module)","id":11718,"name":"validate_module","nodeType":"Function","startLoc":831,"text":"def validate_module(self, module):\n        try:\n            lines, linen = inspect.getsourcelines(module)\n        except IOError:\n            return\n\n        fre = re.compile(r'\\s*def\\s+(t_[a-zA-Z_0-9]*)\\(')\n        sre = re.compile(r'\\s*(t_[a-zA-Z_0-9]*)\\s*=')\n\n        counthash = {}\n        linen += 1\n        for line in lines:\n            m = fre.match(line)\n            if not m:\n                m = sre.match(line)\n            if m:\n                name = m.group(1)\n                prev = counthash.get(name)\n                if not prev:\n                    counthash[name] = linen\n                else:\n                    filename = inspect.getsourcefile(module)\n                    self.log.error('%s:%d: Rule %s redefined. Previously defined on line %d', filename, linen, name, prev)\n                    self.error = True\n            linen += 1"},{"col":4,"comment":"\n        Walk every member and call a function on the keyword and value.\n\n        Return a dictionary of the return values\n\n        If the function raises an exception, raise the errror\n        unless ``raise_errors=False``, in which case set the return value to\n        ``False``.\n\n        Any unrecognized keyword arguments you pass to walk, will be pased on\n        to the function you pass in.\n\n        Note: if ``call_on_sections`` is ``True`` then - on encountering a\n        subsection, *first* the function is called for the *whole* subsection,\n        and then recurses into it's members. This means your function must be\n        able to handle strings, dictionaries and lists. This allows you\n        to change the key of subsections as well as for ordinary members. The\n        return value when called on the whole subsection has to be discarded.\n\n        See  the encode and decode methods for examples, including functions.\n\n        .. admonition:: caution\n\n            You can use ``walk`` to transform the names of members of a section\n            but you mustn't add or delete members.\n\n        >>> config = '''[XXXXsection]\n        ... XXXXkey = XXXXvalue'''.splitlines()\n        >>> cfg = ConfigObj(config)\n        >>> cfg\n        ConfigObj({'XXXXsection': {'XXXXkey': 'XXXXvalue'}})\n        >>> def transform(section, key):\n        ...     val = section[key]\n        ...     newkey = key.replace('XXXX', 'CLIENT1')\n        ...     section.rename(key, newkey)\n        ...     if isinstance(val, (tuple, list, dict)):\n        ...         pass\n        ...     else:\n        ...         val = val.replace('XXXX', 'CLIENT1')\n        ...         section[newkey] = val\n        >>> cfg.walk(transform, call_on_sections=True)\n        {'CLIENT1section': {'CLIENT1key': None}}\n        >>> cfg\n        ConfigObj({'CLIENT1section': {'CLIENT1key': 'CLIENT1value'}})\n        ","endLoc":922,"header":"def walk(self, function, raise_errors=True,\n            call_on_sections=False, **keywargs)","id":11719,"name":"walk","nodeType":"Function","startLoc":840,"text":"def walk(self, function, raise_errors=True,\n            call_on_sections=False, **keywargs):\n        \"\"\"\n        Walk every member and call a function on the keyword and value.\n\n        Return a dictionary of the return values\n\n        If the function raises an exception, raise the errror\n        unless ``raise_errors=False``, in which case set the return value to\n        ``False``.\n\n        Any unrecognized keyword arguments you pass to walk, will be pased on\n        to the function you pass in.\n\n        Note: if ``call_on_sections`` is ``True`` then - on encountering a\n        subsection, *first* the function is called for the *whole* subsection,\n        and then recurses into it's members. This means your function must be\n        able to handle strings, dictionaries and lists. This allows you\n        to change the key of subsections as well as for ordinary members. The\n        return value when called on the whole subsection has to be discarded.\n\n        See  the encode and decode methods for examples, including functions.\n\n        .. admonition:: caution\n\n            You can use ``walk`` to transform the names of members of a section\n            but you mustn't add or delete members.\n\n        >>> config = '''[XXXXsection]\n        ... XXXXkey = XXXXvalue'''.splitlines()\n        >>> cfg = ConfigObj(config)\n        >>> cfg\n        ConfigObj({'XXXXsection': {'XXXXkey': 'XXXXvalue'}})\n        >>> def transform(section, key):\n        ...     val = section[key]\n        ...     newkey = key.replace('XXXX', 'CLIENT1')\n        ...     section.rename(key, newkey)\n        ...     if isinstance(val, (tuple, list, dict)):\n        ...         pass\n        ...     else:\n        ...         val = val.replace('XXXX', 'CLIENT1')\n        ...         section[newkey] = val\n        >>> cfg.walk(transform, call_on_sections=True)\n        {'CLIENT1section': {'CLIENT1key': None}}\n        >>> cfg\n        ConfigObj({'CLIENT1section': {'CLIENT1key': 'CLIENT1value'}})\n        \"\"\"\n        out = {}\n        # scalars first\n        for i in range(len(self.scalars)):\n            entry = self.scalars[i]\n            try:\n                val = function(self, entry, **keywargs)\n                # bound again in case name has changed\n                entry = self.scalars[i]\n                out[entry] = val\n            except Exception:\n                if raise_errors:\n                    raise\n                else:\n                    entry = self.scalars[i]\n                    out[entry] = False\n        # then sections\n        for i in range(len(self.sections)):\n            entry = self.sections[i]\n            if call_on_sections:\n                try:\n                    function(self, entry, **keywargs)\n                except Exception:\n                    if raise_errors:\n                        raise\n                    else:\n                        entry = self.sections[i]\n                        out[entry] = False\n                # bound again in case name has changed\n                entry = self.sections[i]\n            # previous result is discarded\n            out[entry] = self[entry].walk(\n                function,\n                raise_errors=raise_errors,\n                call_on_sections=call_on_sections,\n                **keywargs)\n        return out"},{"attributeType":"null","col":8,"comment":"null","endLoc":559,"id":11720,"name":"ldict","nodeType":"Attribute","startLoc":559,"text":"self.ldict"},{"attributeType":"null","col":8,"comment":"null","endLoc":668,"id":11721,"name":"strsym","nodeType":"Attribute","startLoc":668,"text":"self.strsym"},{"attributeType":"PlyLogger","col":8,"comment":"null","endLoc":566,"id":11722,"name":"log","nodeType":"Attribute","startLoc":566,"text":"self.log"},{"attributeType":"null","col":8,"comment":"null","endLoc":671,"id":11723,"name":"eoff","nodeType":"Attribute","startLoc":671,"text":"self.eoff"},{"attributeType":"null","col":8,"comment":"null","endLoc":615,"id":11724,"name":"literals","nodeType":"Attribute","startLoc":615,"text":"self.literals"},{"col":4,"comment":"`NDData` : reference to `NDData` instance with this uncertainty.\n\n        In case the reference is not set uncertainty propagation will not be\n        possible since propagation might need the uncertain data besides the\n        uncertainty.\n        ","endLoc":202,"header":"@property\n    def parent_nddata(self)","id":11725,"name":"parent_nddata","nodeType":"Function","startLoc":167,"text":"@property\n    def parent_nddata(self):\n        \"\"\"`NDData` : reference to `NDData` instance with this uncertainty.\n\n        In case the reference is not set uncertainty propagation will not be\n        possible since propagation might need the uncertain data besides the\n        uncertainty.\n        \"\"\"\n        no_parent_message = \"uncertainty is not associated with an NDData object\"\n        parent_lost_message = (\n            \"the associated NDData object was deleted and cannot be accessed \"\n            \"anymore. You can prevent the NDData object from being deleted by \"\n            \"assigning it to a variable. If this happened after unpickling \"\n            \"make sure you pickle the parent not the uncertainty directly.\"\n        )\n        try:\n            parent = self._parent_nddata\n        except AttributeError:\n            raise MissingDataAssociationException(no_parent_message)\n        else:\n            if parent is None:\n                raise MissingDataAssociationException(no_parent_message)\n            else:\n                # The NDData is saved as weak reference so we must call it\n                # to get the object the reference points to. However because\n                # we have a weak reference here it's possible that the parent\n                # was deleted because its reference count dropped to zero.\n                if isinstance(self._parent_nddata, weakref.ref):\n                    resolved_parent = self._parent_nddata()\n                    if resolved_parent is None:\n                        log.info(parent_lost_message)\n                    return resolved_parent\n                else:\n                    log.info(\"parent_nddata should be a weakref to an NDData \"\n                             \"object.\")\n                    return self._parent_nddata"},{"attributeType":"null","col":8,"comment":"null","endLoc":563,"id":11726,"name":"stateinfo","nodeType":"Attribute","startLoc":563,"text":"self.stateinfo"},{"attributeType":"null","col":8,"comment":"null","endLoc":670,"id":11727,"name":"errorf","nodeType":"Attribute","startLoc":670,"text":"self.errorf"},{"attributeType":"null","col":8,"comment":"null","endLoc":565,"id":11728,"name":"error","nodeType":"Attribute","startLoc":565,"text":"self.error"},{"attributeType":"null","col":8,"comment":"null","endLoc":564,"id":11729,"name":"modules","nodeType":"Attribute","startLoc":564,"text":"self.modules"},{"attributeType":"null","col":8,"comment":"null","endLoc":632,"id":11730,"name":"states","nodeType":"Attribute","startLoc":632,"text":"self.states"},{"attributeType":"null","col":8,"comment":"null","endLoc":666,"id":11731,"name":"toknames","nodeType":"Attribute","startLoc":666,"text":"self.toknames"},{"attributeType":"null","col":8,"comment":"null","endLoc":669,"id":11732,"name":"ignore","nodeType":"Attribute","startLoc":669,"text":"self.ignore"},{"attributeType":"null","col":8,"comment":"null","endLoc":561,"id":11733,"name":"tokens","nodeType":"Attribute","startLoc":561,"text":"self.tokens"},{"attributeType":"None","col":8,"comment":"null","endLoc":560,"id":11734,"name":"error_func","nodeType":"Attribute","startLoc":560,"text":"self.error_func"},{"attributeType":"null","col":8,"comment":"null","endLoc":562,"id":11735,"name":"reflags","nodeType":"Attribute","startLoc":562,"text":"self.reflags"},{"attributeType":"null","col":8,"comment":"null","endLoc":667,"id":11736,"name":"funcsym","nodeType":"Attribute","startLoc":667,"text":"self.funcsym"},{"col":0,"comment":"null","endLoc":1079,"header":"def runmain(lexer=None, data=None)","id":11737,"name":"runmain","nodeType":"Function","startLoc":1054,"text":"def runmain(lexer=None, data=None):\n    if not data:\n        try:\n            filename = sys.argv[1]\n            f = open(filename)\n            data = f.read()\n            f.close()\n        except IndexError:\n            sys.stdout.write('Reading from standard input (type EOF to end):\\n')\n            data = sys.stdin.read()\n\n    if lexer:\n        _input = lexer.input\n    else:\n        _input = input\n    _input(data)\n    if lexer:\n        _token = lexer.token\n    else:\n        _token = token\n\n    while True:\n        tok = _token()\n        if not tok:\n            break\n        sys.stdout.write('(%s,%r,%d,%d)\\n' % (tok.type, tok.value, tok.lineno, tok.lexpos))"},{"col":4,"comment":"null","endLoc":235,"header":"@parent_nddata.setter\n    def parent_nddata(self, value)","id":11738,"name":"parent_nddata","nodeType":"Function","startLoc":204,"text":"@parent_nddata.setter\n    def parent_nddata(self, value):\n        if value is not None and not isinstance(value, weakref.ref):\n            # Save a weak reference on the uncertainty that points to this\n            # instance of NDData. Direct references should NOT be used:\n            # https://github.com/astropy/astropy/pull/4799#discussion_r61236832\n            value = weakref.ref(value)\n        # Set _parent_nddata here and access below with the property because value\n        # is a weakref\n        self._parent_nddata = value\n        # set uncertainty unit to that of the parent if it was not already set, unless initializing\n        # with empty parent (Value=None)\n        if value is not None:\n            parent_unit = self.parent_nddata.unit\n            if self.unit is None:\n                if parent_unit is None:\n                    self.unit = None\n                else:\n                    # Set the uncertainty's unit to the appropriate value\n                    self.unit = self._data_unit_to_uncertainty_unit(parent_unit)\n            else:\n                # Check that units of uncertainty are compatible with those of\n                # the parent. If they are, no need to change units of the\n                # uncertainty or the data. If they are not, let the user know.\n                unit_from_data = self._data_unit_to_uncertainty_unit(parent_unit)\n                try:\n                    unit_from_data.to(self.unit)\n                except UnitConversionError:\n                    raise UnitConversionError(\"Unit {} of uncertainty \"\n                                              \"incompatible with unit {} of \"\n                                              \"data\".format(self.unit,\n                                                            parent_unit))"},{"col":4,"comment":"\n        Accepts a key as input. The corresponding value must be a string or\n        the objects (``True`` or 1) or (``False`` or 0). We allow 0 and 1 to\n        retain compatibility with Python 2.2.\n\n        If the string is one of  ``True``, ``On``, ``Yes``, or ``1`` it returns\n        ``True``.\n\n        If the string is one of  ``False``, ``Off``, ``No``, or ``0`` it returns\n        ``False``.\n\n        ``as_bool`` is not case sensitive.\n\n        Any other input will raise a ``ValueError``.\n\n        >>> a = ConfigObj()\n        >>> a['a'] = 'fish'\n        >>> a.as_bool('a')\n        Traceback (most recent call last):\n        ValueError: Value \"fish\" is neither True nor False\n        >>> a['b'] = 'True'\n        >>> a.as_bool('b')\n        1\n        >>> a['b'] = 'off'\n        >>> a.as_bool('b')\n        0\n        ","endLoc":966,"header":"def as_bool(self, key)","id":11739,"name":"as_bool","nodeType":"Function","startLoc":925,"text":"def as_bool(self, key):\n        \"\"\"\n        Accepts a key as input. The corresponding value must be a string or\n        the objects (``True`` or 1) or (``False`` or 0). We allow 0 and 1 to\n        retain compatibility with Python 2.2.\n\n        If the string is one of  ``True``, ``On``, ``Yes``, or ``1`` it returns\n        ``True``.\n\n        If the string is one of  ``False``, ``Off``, ``No``, or ``0`` it returns\n        ``False``.\n\n        ``as_bool`` is not case sensitive.\n\n        Any other input will raise a ``ValueError``.\n\n        >>> a = ConfigObj()\n        >>> a['a'] = 'fish'\n        >>> a.as_bool('a')\n        Traceback (most recent call last):\n        ValueError: Value \"fish\" is neither True nor False\n        >>> a['b'] = 'True'\n        >>> a.as_bool('b')\n        1\n        >>> a['b'] = 'off'\n        >>> a.as_bool('b')\n        0\n        \"\"\"\n        val = self[key]\n        if val == True:\n            return True\n        elif val == False:\n            return False\n        else:\n            try:\n                if not isinstance(val, str):\n                    # TODO: Why do we raise a KeyError here?\n                    raise KeyError()\n                else:\n                    return self.main._bools[val.lower()]\n            except KeyError:\n                raise ValueError('Value \"%s\" is neither True nor False' % val)"},{"col":4,"comment":"null","endLoc":253,"header":"def __repr__(self)","id":11740,"name":"__repr__","nodeType":"Function","startLoc":246,"text":"def __repr__(self):\n        prefix = self.__class__.__name__ + '('\n        try:\n            body = np.array2string(self.array, separator=', ', prefix=prefix)\n        except AttributeError:\n            # In case it wasn't possible to use array2string\n            body = str(self.array)\n        return ''.join([prefix, body, ')'])"},{"col":4,"comment":"null","endLoc":261,"header":"def __getstate__(self)","id":11741,"name":"__getstate__","nodeType":"Function","startLoc":255,"text":"def __getstate__(self):\n        # Because of the weak reference the class wouldn't be picklable.\n        try:\n            return self._array, self._unit, self.parent_nddata\n        except MissingDataAssociationException:\n            # In case there's no parent\n            return self._array, self._unit, None"},{"col":4,"comment":"null","endLoc":272,"header":"def __setstate__(self, state)","id":11742,"name":"__setstate__","nodeType":"Function","startLoc":263,"text":"def __setstate__(self, state):\n        if len(state) != 3:\n            raise TypeError('The state should contain 3 items.')\n        self._array = state[0]\n        self._unit = state[1]\n\n        parent = state[2]\n        if parent is not None:\n            parent = weakref.ref(parent)\n        self._parent_nddata = parent"},{"col":4,"comment":"Normal slicing on the array, keep the unit and return a reference.\n        ","endLoc":277,"header":"def __getitem__(self, item)","id":11743,"name":"__getitem__","nodeType":"Function","startLoc":274,"text":"def __getitem__(self, item):\n        \"\"\"Normal slicing on the array, keep the unit and return a reference.\n        \"\"\"\n        return self.__class__(self.array[item], unit=self.unit, copy=False)"},{"col":4,"comment":"Calculate the resulting uncertainty given an operation on the data.\n\n        .. versionadded:: 1.2\n\n        Parameters\n        ----------\n        operation : callable\n            The operation that is performed on the `NDData`. Supported are\n            `numpy.add`, `numpy.subtract`, `numpy.multiply` and\n            `numpy.true_divide` (or `numpy.divide`).\n\n        other_nddata : `NDData` instance\n            The second operand in the arithmetic operation.\n\n        result_data : `~astropy.units.Quantity` or ndarray\n            The result of the arithmetic operations on the data.\n\n        correlation : `numpy.ndarray` or number\n            The correlation (rho) is defined between the uncertainties in\n            sigma_AB = sigma_A * sigma_B * rho. A value of ``0`` means\n            uncorrelated operands.\n\n        Returns\n        -------\n        resulting_uncertainty : `NDUncertainty` instance\n            Another instance of the same `NDUncertainty` subclass containing\n            the uncertainty of the result.\n\n        Raises\n        ------\n        ValueError\n            If the ``operation`` is not supported or if correlation is not zero\n            but the subclass does not support correlated uncertainties.\n\n        Notes\n        -----\n        First this method checks if a correlation is given and the subclass\n        implements propagation with correlated uncertainties.\n        Then the second uncertainty is converted (or an Exception is raised)\n        to the same class in order to do the propagation.\n        Then the appropriate propagation method is invoked and the result is\n        returned.\n        ","endLoc":348,"header":"def propagate(self, operation, other_nddata, result_data, correlation)","id":11744,"name":"propagate","nodeType":"Function","startLoc":279,"text":"def propagate(self, operation, other_nddata, result_data, correlation):\n        \"\"\"Calculate the resulting uncertainty given an operation on the data.\n\n        .. versionadded:: 1.2\n\n        Parameters\n        ----------\n        operation : callable\n            The operation that is performed on the `NDData`. Supported are\n            `numpy.add`, `numpy.subtract`, `numpy.multiply` and\n            `numpy.true_divide` (or `numpy.divide`).\n\n        other_nddata : `NDData` instance\n            The second operand in the arithmetic operation.\n\n        result_data : `~astropy.units.Quantity` or ndarray\n            The result of the arithmetic operations on the data.\n\n        correlation : `numpy.ndarray` or number\n            The correlation (rho) is defined between the uncertainties in\n            sigma_AB = sigma_A * sigma_B * rho. A value of ``0`` means\n            uncorrelated operands.\n\n        Returns\n        -------\n        resulting_uncertainty : `NDUncertainty` instance\n            Another instance of the same `NDUncertainty` subclass containing\n            the uncertainty of the result.\n\n        Raises\n        ------\n        ValueError\n            If the ``operation`` is not supported or if correlation is not zero\n            but the subclass does not support correlated uncertainties.\n\n        Notes\n        -----\n        First this method checks if a correlation is given and the subclass\n        implements propagation with correlated uncertainties.\n        Then the second uncertainty is converted (or an Exception is raised)\n        to the same class in order to do the propagation.\n        Then the appropriate propagation method is invoked and the result is\n        returned.\n        \"\"\"\n        # Check if the subclass supports correlation\n        if not self.supports_correlated:\n            if isinstance(correlation, np.ndarray) or correlation != 0:\n                raise ValueError(\"{} does not support uncertainty propagation\"\n                                 \" with correlation.\"\n                                 \"\".format(self.__class__.__name__))\n\n        # Get the other uncertainty (and convert it to a matching one)\n        other_uncert = self._convert_uncertainty(other_nddata.uncertainty)\n\n        if operation.__name__ == 'add':\n            result = self._propagate_add(other_uncert, result_data,\n                                         correlation)\n        elif operation.__name__ == 'subtract':\n            result = self._propagate_subtract(other_uncert, result_data,\n                                              correlation)\n        elif operation.__name__ == 'multiply':\n            result = self._propagate_multiply(other_uncert, result_data,\n                                              correlation)\n        elif operation.__name__ in ['true_divide', 'divide']:\n            result = self._propagate_divide(other_uncert, result_data,\n                                            correlation)\n        else:\n            raise ValueError('unsupported operation')\n\n        return self.__class__(result, copy=False)"},{"col":0,"comment":"null","endLoc":1095,"header":"def TOKEN(r)","id":11745,"name":"TOKEN","nodeType":"Function","startLoc":1088,"text":"def TOKEN(r):\n    def set_regex(f):\n        if hasattr(r, '__call__'):\n            f.regex = _get_regex(r)\n        else:\n            f.regex = r\n        return f\n    return set_regex"},{"attributeType":"null","col":0,"comment":"null","endLoc":34,"id":11746,"name":"__version__","nodeType":"Attribute","startLoc":34,"text":"__version__"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":11747,"name":"__tabversion__","nodeType":"Attribute","startLoc":35,"text":"__tabversion__"},{"attributeType":"null","col":4,"comment":"null","endLoc":47,"id":11748,"name":"StringTypes","nodeType":"Attribute","startLoc":47,"text":"StringTypes"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":11749,"name":"_is_identifier","nodeType":"Attribute","startLoc":53,"text":"_is_identifier"},{"attributeType":"function","col":0,"comment":"null","endLoc":1098,"id":11750,"name":"Token","nodeType":"Attribute","startLoc":1098,"text":"Token"},{"col":4,"comment":"\n        A convenience method which coerces the specified value to an integer.\n\n        If the value is an invalid literal for ``int``, a ``ValueError`` will\n        be raised.\n\n        >>> a = ConfigObj()\n        >>> a['a'] = 'fish'\n        >>> a.as_int('a')\n        Traceback (most recent call last):\n        ValueError: invalid literal for int() with base 10: 'fish'\n        >>> a['b'] = '1'\n        >>> a.as_int('b')\n        1\n        >>> a['b'] = '3.2'\n        >>> a.as_int('b')\n        Traceback (most recent call last):\n        ValueError: invalid literal for int() with base 10: '3.2'\n        ","endLoc":989,"header":"def as_int(self, key)","id":11751,"name":"as_int","nodeType":"Function","startLoc":969,"text":"def as_int(self, key):\n        \"\"\"\n        A convenience method which coerces the specified value to an integer.\n\n        If the value is an invalid literal for ``int``, a ``ValueError`` will\n        be raised.\n\n        >>> a = ConfigObj()\n        >>> a['a'] = 'fish'\n        >>> a.as_int('a')\n        Traceback (most recent call last):\n        ValueError: invalid literal for int() with base 10: 'fish'\n        >>> a['b'] = '1'\n        >>> a.as_int('b')\n        1\n        >>> a['b'] = '3.2'\n        >>> a.as_int('b')\n        Traceback (most recent call last):\n        ValueError: invalid literal for int() with base 10: '3.2'\n        \"\"\"\n        return int(self[key])"},{"col":4,"comment":"\n        A convenience method which coerces the specified value to a float.\n\n        If the value is an invalid literal for ``float``, a ``ValueError`` will\n        be raised.\n\n        >>> a = ConfigObj()\n        >>> a['a'] = 'fish'\n        >>> a.as_float('a')  #doctest: +IGNORE_EXCEPTION_DETAIL\n        Traceback (most recent call last):\n        ValueError: invalid literal for float(): fish\n        >>> a['b'] = '1'\n        >>> a.as_float('b')\n        1.0\n        >>> a['b'] = '3.2'\n        >>> a.as_float('b')  #doctest: +ELLIPSIS\n        3.2...\n        ","endLoc":1011,"header":"def as_float(self, key)","id":11752,"name":"as_float","nodeType":"Function","startLoc":992,"text":"def as_float(self, key):\n        \"\"\"\n        A convenience method which coerces the specified value to a float.\n\n        If the value is an invalid literal for ``float``, a ``ValueError`` will\n        be raised.\n\n        >>> a = ConfigObj()\n        >>> a['a'] = 'fish'\n        >>> a.as_float('a')  #doctest: +IGNORE_EXCEPTION_DETAIL\n        Traceback (most recent call last):\n        ValueError: invalid literal for float(): fish\n        >>> a['b'] = '1'\n        >>> a.as_float('b')\n        1.0\n        >>> a['b'] = '3.2'\n        >>> a.as_float('b')  #doctest: +ELLIPSIS\n        3.2...\n        \"\"\"\n        return float(self[key])"},{"col":0,"comment":"","endLoc":34,"header":"lex.py#<anonymous>","id":11753,"name":"<anonymous>","nodeType":"Function","startLoc":34,"text":"__version__    = '3.11'\n\n__tabversion__ = '3.10'\n\ntry:\n    # Python 2.6\n    StringTypes = (types.StringType, types.UnicodeType)\nexcept AttributeError:\n    # Python 3.0\n    StringTypes = (str, bytes)\n\n_is_identifier = re.compile(r'^[a-zA-Z0-9_]+$')\n\nToken = TOKEN"},{"col":4,"comment":"\n        A convenience method which fetches the specified value, guaranteeing\n        that it is a list.\n\n        >>> a = ConfigObj()\n        >>> a['a'] = 1\n        >>> a.as_list('a')\n        [1]\n        >>> a['a'] = (1,)\n        >>> a.as_list('a')\n        [1]\n        >>> a['a'] = [1]\n        >>> a.as_list('a')\n        [1]\n        ","endLoc":1033,"header":"def as_list(self, key)","id":11754,"name":"as_list","nodeType":"Function","startLoc":1014,"text":"def as_list(self, key):\n        \"\"\"\n        A convenience method which fetches the specified value, guaranteeing\n        that it is a list.\n\n        >>> a = ConfigObj()\n        >>> a['a'] = 1\n        >>> a.as_list('a')\n        [1]\n        >>> a['a'] = (1,)\n        >>> a.as_list('a')\n        [1]\n        >>> a['a'] = [1]\n        >>> a.as_list('a')\n        [1]\n        \"\"\"\n        result = self[key]\n        if isinstance(result, (tuple, list)):\n            return list(result)\n        return [result]"},{"col":4,"comment":"\n        Restore (and return) default value for the specified key.\n\n        This method will only work for a ConfigObj that was created\n        with a configspec and has been validated.\n\n        If there is no default value for this key, ``KeyError`` is raised.\n        ","endLoc":1049,"header":"def restore_default(self, key)","id":11755,"name":"restore_default","nodeType":"Function","startLoc":1036,"text":"def restore_default(self, key):\n        \"\"\"\n        Restore (and return) default value for the specified key.\n\n        This method will only work for a ConfigObj that was created\n        with a configspec and has been validated.\n\n        If there is no default value for this key, ``KeyError`` is raised.\n        \"\"\"\n        default = self.default_values[key]\n        dict.__setitem__(self, key, default)\n        if key not in self.defaults:\n            self.defaults.append(key)\n        return default"},{"fileName":"utils.py","filePath":"astropy/nddata","id":11756,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module includes helper functions for array operations.\n\"\"\"\n\nfrom copy import deepcopy\n\nimport numpy as np\n\nfrom astropy import units as u\nfrom astropy.coordinates import SkyCoord\nfrom astropy.utils import lazyproperty\nfrom astropy.wcs.utils import skycoord_to_pixel, proj_plane_pixel_scales\nfrom astropy.wcs import Sip\n\n__all__ = ['extract_array', 'add_array', 'subpixel_indices',\n           'overlap_slices', 'NoOverlapError', 'PartialOverlapError',\n           'Cutout2D']\n\n\nclass NoOverlapError(ValueError):\n    '''Raised when determining the overlap of non-overlapping arrays.'''\n    pass\n\n\nclass PartialOverlapError(ValueError):\n    '''Raised when arrays only partially overlap.'''\n    pass\n\n\ndef overlap_slices(large_array_shape, small_array_shape, position,\n                   mode='partial'):\n    \"\"\"\n    Get slices for the overlapping part of a small and a large array.\n\n    Given a certain position of the center of the small array, with\n    respect to the large array, tuples of slices are returned which can be\n    used to extract, add or subtract the small array at the given\n    position. This function takes care of the correct behavior at the\n    boundaries, where the small array is cut of appropriately.\n    Integer positions are at the pixel centers.\n\n    Parameters\n    ----------\n    large_array_shape : tuple of int or int\n        The shape of the large array (for 1D arrays, this can be an\n        `int`).\n    small_array_shape : int or tuple thereof\n        The shape of the small array (for 1D arrays, this can be an\n        `int`).  See the ``mode`` keyword for additional details.\n    position : number or tuple thereof\n        The position of the small array's center with respect to the\n        large array.  The pixel coordinates should be in the same order\n        as the array shape.  Integer positions are at the pixel centers.\n        For any axis where ``small_array_shape`` is even, the position\n        is rounded up, e.g. extracting two elements with a center of\n        ``1`` will define the extracted region as ``[0, 1]``.\n    mode : {'partial', 'trim', 'strict'}, optional\n        In ``'partial'`` mode, a partial overlap of the small and the\n        large array is sufficient.  The ``'trim'`` mode is similar to\n        the ``'partial'`` mode, but ``slices_small`` will be adjusted to\n        return only the overlapping elements.  In the ``'strict'`` mode,\n        the small array has to be fully contained in the large array,\n        otherwise an `~astropy.nddata.utils.PartialOverlapError` is\n        raised.  In all modes, non-overlapping arrays will raise a\n        `~astropy.nddata.utils.NoOverlapError`.\n\n    Returns\n    -------\n    slices_large : tuple of slice\n        A tuple of slice objects for each axis of the large array, such\n        that ``large_array[slices_large]`` extracts the region of the\n        large array that overlaps with the small array.\n    slices_small : tuple of slice\n        A tuple of slice objects for each axis of the small array, such\n        that ``small_array[slices_small]`` extracts the region that is\n        inside the large array.\n    \"\"\"\n\n    if mode not in ['partial', 'trim', 'strict']:\n        raise ValueError('Mode can be only \"partial\", \"trim\", or \"strict\".')\n    if np.isscalar(small_array_shape):\n        small_array_shape = (small_array_shape, )\n    if np.isscalar(large_array_shape):\n        large_array_shape = (large_array_shape, )\n    if np.isscalar(position):\n        position = (position, )\n\n    if any(~np.isfinite(position)):\n        raise ValueError('Input position contains invalid values (NaNs or '\n                         'infs).')\n\n    if len(small_array_shape) != len(large_array_shape):\n        raise ValueError('\"large_array_shape\" and \"small_array_shape\" must '\n                         'have the same number of dimensions.')\n\n    if len(small_array_shape) != len(position):\n        raise ValueError('\"position\" must have the same number of dimensions '\n                         'as \"small_array_shape\".')\n\n    # define the min/max pixel indices\n    indices_min = [int(np.ceil(pos - (small_shape / 2.)))\n                   for (pos, small_shape) in zip(position, small_array_shape)]\n    indices_max = [int(np.ceil(pos + (small_shape / 2.)))\n                   for (pos, small_shape) in zip(position, small_array_shape)]\n\n    for e_max in indices_max:\n        if e_max < 0:\n            raise NoOverlapError('Arrays do not overlap.')\n    for e_min, large_shape in zip(indices_min, large_array_shape):\n        if e_min >= large_shape:\n            raise NoOverlapError('Arrays do not overlap.')\n\n    if mode == 'strict':\n        for e_min in indices_min:\n            if e_min < 0:\n                raise PartialOverlapError('Arrays overlap only partially.')\n        for e_max, large_shape in zip(indices_max, large_array_shape):\n            if e_max > large_shape:\n                raise PartialOverlapError('Arrays overlap only partially.')\n\n    # Set up slices\n    slices_large = tuple(slice(max(0, indices_min),\n                               min(large_shape, indices_max))\n                         for (indices_min, indices_max, large_shape) in\n                         zip(indices_min, indices_max, large_array_shape))\n    if mode == 'trim':\n        slices_small = tuple(slice(0, slc.stop - slc.start)\n                             for slc in slices_large)\n    else:\n        slices_small = tuple(slice(max(0, -indices_min),\n                                   min(large_shape - indices_min,\n                                       indices_max - indices_min))\n                             for (indices_min, indices_max, large_shape) in\n                             zip(indices_min, indices_max, large_array_shape))\n\n    return slices_large, slices_small\n\n\ndef extract_array(array_large, shape, position, mode='partial',\n                  fill_value=np.nan, return_position=False):\n    \"\"\"\n    Extract a smaller array of the given shape and position from a\n    larger array.\n\n    Parameters\n    ----------\n    array_large : ndarray\n        The array from which to extract the small array.\n    shape : int or tuple thereof\n        The shape of the extracted array (for 1D arrays, this can be an\n        `int`).  See the ``mode`` keyword for additional details.\n    position : number or tuple thereof\n        The position of the small array's center with respect to the\n        large array.  The pixel coordinates should be in the same order\n        as the array shape.  Integer positions are at the pixel centers\n        (for 1D arrays, this can be a number).\n    mode : {'partial', 'trim', 'strict'}, optional\n        The mode used for extracting the small array.  For the\n        ``'partial'`` and ``'trim'`` modes, a partial overlap of the\n        small array and the large array is sufficient.  For the\n        ``'strict'`` mode, the small array has to be fully contained\n        within the large array, otherwise an\n        `~astropy.nddata.utils.PartialOverlapError` is raised.   In all\n        modes, non-overlapping arrays will raise a\n        `~astropy.nddata.utils.NoOverlapError`.  In ``'partial'`` mode,\n        positions in the small array that do not overlap with the large\n        array will be filled with ``fill_value``.  In ``'trim'`` mode\n        only the overlapping elements are returned, thus the resulting\n        small array may be smaller than the requested ``shape``.\n    fill_value : number, optional\n        If ``mode='partial'``, the value to fill pixels in the extracted\n        small array that do not overlap with the input ``array_large``.\n        ``fill_value`` will be changed to have the same ``dtype`` as the\n        ``array_large`` array, with one exception. If ``array_large``\n        has integer type and ``fill_value`` is ``np.nan``, then a\n        `ValueError` will be raised.\n    return_position : bool, optional\n        If `True`, return the coordinates of ``position`` in the\n        coordinate system of the returned array.\n\n    Returns\n    -------\n    array_small : ndarray\n        The extracted array.\n    new_position : tuple\n        If ``return_position`` is true, this tuple will contain the\n        coordinates of the input ``position`` in the coordinate system\n        of ``array_small``. Note that for partially overlapping arrays,\n        ``new_position`` might actually be outside of the\n        ``array_small``; ``array_small[new_position]`` might give wrong\n        results if any element in ``new_position`` is negative.\n\n    Examples\n    --------\n    We consider a large array with the shape 11x10, from which we extract\n    a small array of shape 3x5:\n\n    >>> import numpy as np\n    >>> from astropy.nddata.utils import extract_array\n    >>> large_array = np.arange(110).reshape((11, 10))\n    >>> extract_array(large_array, (3, 5), (7, 7))\n    array([[65, 66, 67, 68, 69],\n           [75, 76, 77, 78, 79],\n           [85, 86, 87, 88, 89]])\n    \"\"\"\n\n    if np.isscalar(shape):\n        shape = (shape, )\n    if np.isscalar(position):\n        position = (position, )\n\n    if mode not in ['partial', 'trim', 'strict']:\n        raise ValueError(\"Valid modes are 'partial', 'trim', and 'strict'.\")\n\n    large_slices, small_slices = overlap_slices(array_large.shape,\n                                                shape, position, mode=mode)\n    extracted_array = array_large[large_slices]\n    if return_position:\n        new_position = [i - s.start for i, s in zip(position, large_slices)]\n\n    # Extracting on the edges is presumably a rare case, so treat special here\n    if (extracted_array.shape != shape) and (mode == 'partial'):\n        extracted_array = np.zeros(shape, dtype=array_large.dtype)\n        try:\n            extracted_array[:] = fill_value\n        except ValueError as exc:\n            exc.args += ('fill_value is inconsistent with the data type of '\n                         'the input array (e.g., fill_value cannot be set to '\n                         'np.nan if the input array has integer type). Please '\n                         'change either the input array dtype or the '\n                         'fill_value.',)\n            raise exc\n\n        extracted_array[small_slices] = array_large[large_slices]\n        if return_position:\n            new_position = [i + s.start for i, s in zip(new_position,\n                                                        small_slices)]\n    if return_position:\n        return extracted_array, tuple(new_position)\n    else:\n        return extracted_array\n\n\ndef add_array(array_large, array_small, position):\n    \"\"\"\n    Add a smaller array at a given position in a larger array.\n\n    Parameters\n    ----------\n    array_large : ndarray\n        Large array.\n    array_small : ndarray\n        Small array to add. Can be equal to ``array_large`` in size in a given\n        dimension, but not larger.\n    position : tuple\n        Position of the small array's center, with respect to the large array.\n        Coordinates should be in the same order as the array shape.\n\n    Returns\n    -------\n    new_array : ndarray\n        The new array formed from the sum of ``array_large`` and\n        ``array_small``.\n\n    Notes\n    -----\n    The addition is done in-place.\n\n    Examples\n    --------\n    We consider a large array of zeros with the shape 5x5 and a small\n    array of ones with a shape of 3x3:\n\n    >>> import numpy as np\n    >>> from astropy.nddata.utils import add_array\n    >>> large_array = np.zeros((5, 5))\n    >>> small_array = np.ones((3, 3))\n    >>> add_array(large_array, small_array, (1, 2))  # doctest: +FLOAT_CMP\n    array([[0., 1., 1., 1., 0.],\n           [0., 1., 1., 1., 0.],\n           [0., 1., 1., 1., 0.],\n           [0., 0., 0., 0., 0.],\n           [0., 0., 0., 0., 0.]])\n    \"\"\"\n    # Check if large array is not smaller\n    if all(large_shape >= small_shape for (large_shape, small_shape)\n           in zip(array_large.shape, array_small.shape)):\n        large_slices, small_slices = overlap_slices(array_large.shape,\n                                                    array_small.shape,\n                                                    position)\n        array_large[large_slices] += array_small[small_slices]\n        return array_large\n    else:\n        raise ValueError(\"Can't add array. Small array too large.\")\n\n\ndef subpixel_indices(position, subsampling):\n    \"\"\"\n    Convert decimal points to indices, given a subsampling factor.\n\n    This discards the integer part of the position and uses only the decimal\n    place, and converts this to a subpixel position depending on the\n    subsampling specified. The center of a pixel corresponds to an integer\n    position.\n\n    Parameters\n    ----------\n    position : ndarray or array-like\n        Positions in pixels.\n    subsampling : int\n        Subsampling factor per pixel.\n\n    Returns\n    -------\n    indices : ndarray\n        The integer subpixel indices corresponding to the input positions.\n\n    Examples\n    --------\n\n    If no subsampling is used, then the subpixel indices returned are always 0:\n\n    >>> from astropy.nddata.utils import subpixel_indices\n    >>> subpixel_indices([1.2, 3.4, 5.6], 1)  # doctest: +FLOAT_CMP\n    array([0., 0., 0.])\n\n    If instead we use a subsampling of 2, we see that for the two first values\n    (1.1 and 3.4) the subpixel position is 1, while for 5.6 it is 0. This is\n    because the values of 1, 3, and 6 lie in the center of pixels, and 1.1 and\n    3.4 lie in the left part of the pixels and 5.6 lies in the right part.\n\n    >>> subpixel_indices([1.2, 3.4, 5.5], 2)  # doctest: +FLOAT_CMP\n    array([1., 1., 0.])\n    \"\"\"\n    # Get decimal points\n    fractions = np.modf(np.asanyarray(position) + 0.5)[0]\n    return np.floor(fractions * subsampling)\n\n\nclass Cutout2D:\n    \"\"\"\n    Create a cutout object from a 2D array.\n\n    The returned object will contain a 2D cutout array.  If\n    ``copy=False`` (default), the cutout array is a view into the\n    original ``data`` array, otherwise the cutout array will contain a\n    copy of the original data.\n\n    If a `~astropy.wcs.WCS` object is input, then the returned object\n    will also contain a copy of the original WCS, but updated for the\n    cutout array.\n\n    For example usage, see :ref:`astropy:cutout_images`.\n\n    .. warning::\n\n        The cutout WCS object does not currently handle cases where the\n        input WCS object contains distortion lookup tables described in\n        the `FITS WCS distortion paper\n        <https://www.atnf.csiro.au/people/mcalabre/WCS/dcs_20040422.pdf>`__.\n\n    Parameters\n    ----------\n    data : ndarray\n        The 2D data array from which to extract the cutout array.\n\n    position : tuple or `~astropy.coordinates.SkyCoord`\n        The position of the cutout array's center with respect to\n        the ``data`` array.  The position can be specified either as\n        a ``(x, y)`` tuple of pixel coordinates or a\n        `~astropy.coordinates.SkyCoord`, in which case ``wcs`` is a\n        required input.\n\n    size : int, array-like, or `~astropy.units.Quantity`\n        The size of the cutout array along each axis.  If ``size``\n        is a scalar number or a scalar `~astropy.units.Quantity`,\n        then a square cutout of ``size`` will be created.  If\n        ``size`` has two elements, they should be in ``(ny, nx)``\n        order.  Scalar numbers in ``size`` are assumed to be in\n        units of pixels.  ``size`` can also be a\n        `~astropy.units.Quantity` object or contain\n        `~astropy.units.Quantity` objects.  Such\n        `~astropy.units.Quantity` objects must be in pixel or\n        angular units.  For all cases, ``size`` will be converted to\n        an integer number of pixels, rounding the the nearest\n        integer.  See the ``mode`` keyword for additional details on\n        the final cutout size.\n\n        .. note::\n            If ``size`` is in angular units, the cutout size is\n            converted to pixels using the pixel scales along each\n            axis of the image at the ``CRPIX`` location.  Projection\n            and other non-linear distortions are not taken into\n            account.\n\n    wcs : `~astropy.wcs.WCS`, optional\n        A WCS object associated with the input ``data`` array.  If\n        ``wcs`` is not `None`, then the returned cutout object will\n        contain a copy of the updated WCS for the cutout data array.\n\n    mode : {'trim', 'partial', 'strict'}, optional\n        The mode used for creating the cutout data array.  For the\n        ``'partial'`` and ``'trim'`` modes, a partial overlap of the\n        cutout array and the input ``data`` array is sufficient.\n        For the ``'strict'`` mode, the cutout array has to be fully\n        contained within the ``data`` array, otherwise an\n        `~astropy.nddata.utils.PartialOverlapError` is raised.   In\n        all modes, non-overlapping arrays will raise a\n        `~astropy.nddata.utils.NoOverlapError`.  In ``'partial'``\n        mode, positions in the cutout array that do not overlap with\n        the ``data`` array will be filled with ``fill_value``.  In\n        ``'trim'`` mode only the overlapping elements are returned,\n        thus the resulting cutout array may be smaller than the\n        requested ``shape``.\n\n    fill_value : float or int, optional\n        If ``mode='partial'``, the value to fill pixels in the\n        cutout array that do not overlap with the input ``data``.\n        ``fill_value`` must have the same ``dtype`` as the input\n        ``data`` array.\n\n    copy : bool, optional\n        If `False` (default), then the cutout data will be a view\n        into the original ``data`` array.  If `True`, then the\n        cutout data will hold a copy of the original ``data`` array.\n\n    Attributes\n    ----------\n    data : 2D `~numpy.ndarray`\n        The 2D cutout array.\n\n    shape : (2,) tuple\n        The ``(ny, nx)`` shape of the cutout array.\n\n    shape_input : (2,) tuple\n        The ``(ny, nx)`` shape of the input (original) array.\n\n    input_position_cutout : (2,) tuple\n        The (unrounded) ``(x, y)`` position with respect to the cutout\n        array.\n\n    input_position_original : (2,) tuple\n        The original (unrounded) ``(x, y)`` input position (with respect\n        to the original array).\n\n    slices_original : (2,) tuple of slice object\n        A tuple of slice objects for the minimal bounding box of the\n        cutout with respect to the original array.  For\n        ``mode='partial'``, the slices are for the valid (non-filled)\n        cutout values.\n\n    slices_cutout : (2,) tuple of slice object\n        A tuple of slice objects for the minimal bounding box of the\n        cutout with respect to the cutout array.  For\n        ``mode='partial'``, the slices are for the valid (non-filled)\n        cutout values.\n\n    xmin_original, ymin_original, xmax_original, ymax_original : float\n        The minimum and maximum ``x`` and ``y`` indices of the minimal\n        rectangular region of the cutout array with respect to the\n        original array.  For ``mode='partial'``, the bounding box\n        indices are for the valid (non-filled) cutout values.  These\n        values are the same as those in `bbox_original`.\n\n    xmin_cutout, ymin_cutout, xmax_cutout, ymax_cutout : float\n        The minimum and maximum ``x`` and ``y`` indices of the minimal\n        rectangular region of the cutout array with respect to the\n        cutout array.  For ``mode='partial'``, the bounding box indices\n        are for the valid (non-filled) cutout values.  These values are\n        the same as those in `bbox_cutout`.\n\n    wcs : `~astropy.wcs.WCS` or None\n        A WCS object associated with the cutout array if a ``wcs``\n        was input.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.nddata.utils import Cutout2D\n    >>> from astropy import units as u\n    >>> data = np.arange(20.).reshape(5, 4)\n    >>> cutout1 = Cutout2D(data, (2, 2), (3, 3))\n    >>> print(cutout1.data)  # doctest: +FLOAT_CMP\n    [[ 5.  6.  7.]\n     [ 9. 10. 11.]\n     [13. 14. 15.]]\n\n    >>> print(cutout1.center_original)\n    (2.0, 2.0)\n    >>> print(cutout1.center_cutout)\n    (1.0, 1.0)\n    >>> print(cutout1.origin_original)\n    (1, 1)\n\n    >>> cutout2 = Cutout2D(data, (2, 2), 3)\n    >>> print(cutout2.data)  # doctest: +FLOAT_CMP\n    [[ 5.  6.  7.]\n     [ 9. 10. 11.]\n     [13. 14. 15.]]\n\n    >>> size = u.Quantity([3, 3], u.pixel)\n    >>> cutout3 = Cutout2D(data, (0, 0), size)\n    >>> print(cutout3.data)  # doctest: +FLOAT_CMP\n    [[0. 1.]\n     [4. 5.]]\n\n    >>> cutout4 = Cutout2D(data, (0, 0), (3 * u.pixel, 3))\n    >>> print(cutout4.data)  # doctest: +FLOAT_CMP\n    [[0. 1.]\n     [4. 5.]]\n\n    >>> cutout5 = Cutout2D(data, (0, 0), (3, 3), mode='partial')\n    >>> print(cutout5.data)  # doctest: +FLOAT_CMP\n    [[nan nan nan]\n     [nan  0.  1.]\n     [nan  4.  5.]]\n    \"\"\"\n\n    def __init__(self, data, position, size, wcs=None, mode='trim',\n                 fill_value=np.nan, copy=False):\n        if wcs is None:\n            wcs = getattr(data, 'wcs', None)\n\n        if isinstance(position, SkyCoord):\n            if wcs is None:\n                raise ValueError('wcs must be input if position is a '\n                                 'SkyCoord')\n            position = skycoord_to_pixel(position, wcs, mode='all')  # (x, y)\n\n        if np.isscalar(size):\n            size = np.repeat(size, 2)\n\n        # special handling for a scalar Quantity\n        if isinstance(size, u.Quantity):\n            size = np.atleast_1d(size)\n            if len(size) == 1:\n                size = np.repeat(size, 2)\n\n        if len(size) > 2:\n            raise ValueError('size must have at most two elements')\n\n        shape = np.zeros(2).astype(int)\n        pixel_scales = None\n        # ``size`` can have a mixture of int and Quantity (and even units),\n        # so evaluate each axis separately\n        for axis, side in enumerate(size):\n            if not isinstance(side, u.Quantity):\n                shape[axis] = int(np.round(size[axis]))     # pixels\n            else:\n                if side.unit == u.pixel:\n                    shape[axis] = int(np.round(side.value))\n                elif side.unit.physical_type == 'angle':\n                    if wcs is None:\n                        raise ValueError('wcs must be input if any element '\n                                         'of size has angular units')\n                    if pixel_scales is None:\n                        pixel_scales = u.Quantity(\n                            proj_plane_pixel_scales(wcs), wcs.wcs.cunit[axis])\n                    shape[axis] = int(np.round(\n                        (side / pixel_scales[axis]).decompose()))\n                else:\n                    raise ValueError('shape can contain Quantities with only '\n                                     'pixel or angular units')\n\n        data = np.asanyarray(data)\n        # reverse position because extract_array and overlap_slices\n        # use (y, x), but keep the input position\n        pos_yx = position[::-1]\n\n        cutout_data, input_position_cutout = extract_array(\n            data, tuple(shape), pos_yx, mode=mode, fill_value=fill_value,\n            return_position=True)\n        if copy:\n            cutout_data = np.copy(cutout_data)\n        self.data = cutout_data\n\n        self.input_position_cutout = input_position_cutout[::-1]    # (x, y)\n        slices_original, slices_cutout = overlap_slices(\n            data.shape, shape, pos_yx, mode=mode)\n\n        self.slices_original = slices_original\n        self.slices_cutout = slices_cutout\n\n        self.shape = self.data.shape\n        self.input_position_original = position\n        self.shape_input = shape\n\n        ((self.ymin_original, self.ymax_original),\n         (self.xmin_original, self.xmax_original)) = self.bbox_original\n\n        ((self.ymin_cutout, self.ymax_cutout),\n         (self.xmin_cutout, self.xmax_cutout)) = self.bbox_cutout\n\n        # the true origin pixel of the cutout array, including any\n        # filled cutout values\n        self._origin_original_true = (\n            self.origin_original[0] - self.slices_cutout[1].start,\n            self.origin_original[1] - self.slices_cutout[0].start)\n\n        if wcs is not None:\n            self.wcs = deepcopy(wcs)\n            self.wcs.wcs.crpix -= self._origin_original_true\n            self.wcs.array_shape = self.data.shape\n            if wcs.sip is not None:\n                self.wcs.sip = Sip(wcs.sip.a, wcs.sip.b,\n                                   wcs.sip.ap, wcs.sip.bp,\n                                   wcs.sip.crpix - self._origin_original_true)\n        else:\n            self.wcs = None\n\n    def to_original_position(self, cutout_position):\n        \"\"\"\n        Convert an ``(x, y)`` position in the cutout array to the original\n        ``(x, y)`` position in the original large array.\n\n        Parameters\n        ----------\n        cutout_position : tuple\n            The ``(x, y)`` pixel position in the cutout array.\n\n        Returns\n        -------\n        original_position : tuple\n            The corresponding ``(x, y)`` pixel position in the original\n            large array.\n        \"\"\"\n        return tuple(cutout_position[i] + self.origin_original[i]\n                     for i in [0, 1])\n\n    def to_cutout_position(self, original_position):\n        \"\"\"\n        Convert an ``(x, y)`` position in the original large array to\n        the ``(x, y)`` position in the cutout array.\n\n        Parameters\n        ----------\n        original_position : tuple\n            The ``(x, y)`` pixel position in the original large array.\n\n        Returns\n        -------\n        cutout_position : tuple\n            The corresponding ``(x, y)`` pixel position in the cutout\n            array.\n        \"\"\"\n        return tuple(original_position[i] - self.origin_original[i]\n                     for i in [0, 1])\n\n    def plot_on_original(self, ax=None, fill=False, **kwargs):\n        \"\"\"\n        Plot the cutout region on a matplotlib Axes instance.\n\n        Parameters\n        ----------\n        ax : `matplotlib.axes.Axes` instance, optional\n            If `None`, then the current `matplotlib.axes.Axes` instance\n            is used.\n\n        fill : bool, optional\n            Set whether to fill the cutout patch.  The default is\n            `False`.\n\n        kwargs : optional\n            Any keyword arguments accepted by `matplotlib.patches.Patch`.\n\n        Returns\n        -------\n        ax : `matplotlib.axes.Axes` instance\n            The matplotlib Axes instance constructed in the method if\n            ``ax=None``.  Otherwise the output ``ax`` is the same as the\n            input ``ax``.\n        \"\"\"\n\n        import matplotlib.pyplot as plt\n        import matplotlib.patches as mpatches\n\n        kwargs['fill'] = fill\n\n        if ax is None:\n            ax = plt.gca()\n\n        height, width = self.shape\n        hw, hh = width / 2., height / 2.\n        pos_xy = self.position_original - np.array([hw, hh])\n        patch = mpatches.Rectangle(pos_xy, width, height, 0., **kwargs)\n        ax.add_patch(patch)\n        return ax\n\n    @staticmethod\n    def _calc_center(slices):\n        \"\"\"\n        Calculate the center position.  The center position will be\n        fractional for even-sized arrays.  For ``mode='partial'``, the\n        central position is calculated for the valid (non-filled) cutout\n        values.\n        \"\"\"\n        return tuple(0.5 * (slices[i].start + slices[i].stop - 1)\n                     for i in [1, 0])\n\n    @staticmethod\n    def _calc_bbox(slices):\n        \"\"\"\n        Calculate a minimal bounding box in the form ``((ymin, ymax),\n        (xmin, xmax))``.  Note these are pixel locations, not slice\n        indices.  For ``mode='partial'``, the bounding box indices are\n        for the valid (non-filled) cutout values.\n        \"\"\"\n        # (stop - 1) to return the max pixel location, not the slice index\n        return ((slices[0].start, slices[0].stop - 1),\n                (slices[1].start, slices[1].stop - 1))\n\n    @lazyproperty\n    def origin_original(self):\n        \"\"\"\n        The ``(x, y)`` index of the origin pixel of the cutout with\n        respect to the original array.  For ``mode='partial'``, the\n        origin pixel is calculated for the valid (non-filled) cutout\n        values.\n        \"\"\"\n        return (self.slices_original[1].start, self.slices_original[0].start)\n\n    @lazyproperty\n    def origin_cutout(self):\n        \"\"\"\n        The ``(x, y)`` index of the origin pixel of the cutout with\n        respect to the cutout array.  For ``mode='partial'``, the origin\n        pixel is calculated for the valid (non-filled) cutout values.\n        \"\"\"\n        return (self.slices_cutout[1].start, self.slices_cutout[0].start)\n\n    @staticmethod\n    def _round(a):\n        \"\"\"\n        Round the input to the nearest integer.\n\n        If two integers are equally close, the value is rounded up.\n        Note that this is different from `np.round`, which rounds to the\n        nearest even number.\n        \"\"\"\n        return int(np.floor(a + 0.5))\n\n    @lazyproperty\n    def position_original(self):\n        \"\"\"\n        The ``(x, y)`` position index (rounded to the nearest pixel) in\n        the original array.\n        \"\"\"\n        return (self._round(self.input_position_original[0]),\n                self._round(self.input_position_original[1]))\n\n    @lazyproperty\n    def position_cutout(self):\n        \"\"\"\n        The ``(x, y)`` position index (rounded to the nearest pixel) in\n        the cutout array.\n        \"\"\"\n        return (self._round(self.input_position_cutout[0]),\n                self._round(self.input_position_cutout[1]))\n\n    @lazyproperty\n    def center_original(self):\n        \"\"\"\n        The central ``(x, y)`` position of the cutout array with respect\n        to the original array.  For ``mode='partial'``, the central\n        position is calculated for the valid (non-filled) cutout values.\n        \"\"\"\n        return self._calc_center(self.slices_original)\n\n    @lazyproperty\n    def center_cutout(self):\n        \"\"\"\n        The central ``(x, y)`` position of the cutout array with respect\n        to the cutout array.  For ``mode='partial'``, the central\n        position is calculated for the valid (non-filled) cutout values.\n        \"\"\"\n        return self._calc_center(self.slices_cutout)\n\n    @lazyproperty\n    def bbox_original(self):\n        \"\"\"\n        The bounding box ``((ymin, ymax), (xmin, xmax))`` of the minimal\n        rectangular region of the cutout array with respect to the\n        original array.  For ``mode='partial'``, the bounding box\n        indices are for the valid (non-filled) cutout values.\n        \"\"\"\n        return self._calc_bbox(self.slices_original)\n\n    @lazyproperty\n    def bbox_cutout(self):\n        \"\"\"\n        The bounding box ``((ymin, ymax), (xmin, xmax))`` of the minimal\n        rectangular region of the cutout array with respect to the\n        cutout array.  For ``mode='partial'``, the bounding box indices\n        are for the valid (non-filled) cutout values.\n        \"\"\"\n        return self._calc_bbox(self.slices_cutout)\n"},{"className":"NoOverlapError","col":0,"comment":"Raised when determining the overlap of non-overlapping arrays.","endLoc":23,"id":11757,"nodeType":"Class","startLoc":21,"text":"class NoOverlapError(ValueError):\n    '''Raised when determining the overlap of non-overlapping arrays.'''\n    pass"},{"className":"PartialOverlapError","col":0,"comment":"Raised when arrays only partially overlap.","endLoc":28,"id":11758,"nodeType":"Class","startLoc":26,"text":"class PartialOverlapError(ValueError):\n    '''Raised when arrays only partially overlap.'''\n    pass"},{"col":0,"comment":"\n    Convert decimal points to indices, given a subsampling factor.\n\n    This discards the integer part of the position and uses only the decimal\n    place, and converts this to a subpixel position depending on the\n    subsampling specified. The center of a pixel corresponds to an integer\n    position.\n\n    Parameters\n    ----------\n    position : ndarray or array-like\n        Positions in pixels.\n    subsampling : int\n        Subsampling factor per pixel.\n\n    Returns\n    -------\n    indices : ndarray\n        The integer subpixel indices corresponding to the input positions.\n\n    Examples\n    --------\n\n    If no subsampling is used, then the subpixel indices returned are always 0:\n\n    >>> from astropy.nddata.utils import subpixel_indices\n    >>> subpixel_indices([1.2, 3.4, 5.6], 1)  # doctest: +FLOAT_CMP\n    array([0., 0., 0.])\n\n    If instead we use a subsampling of 2, we see that for the two first values\n    (1.1 and 3.4) the subpixel position is 1, while for 5.6 it is 0. This is\n    because the values of 1, 3, and 6 lie in the center of pixels, and 1.1 and\n    3.4 lie in the left part of the pixels and 5.6 lies in the right part.\n\n    >>> subpixel_indices([1.2, 3.4, 5.5], 2)  # doctest: +FLOAT_CMP\n    array([1., 1., 0.])\n    ","endLoc":338,"header":"def subpixel_indices(position, subsampling)","id":11759,"name":"subpixel_indices","nodeType":"Function","startLoc":298,"text":"def subpixel_indices(position, subsampling):\n    \"\"\"\n    Convert decimal points to indices, given a subsampling factor.\n\n    This discards the integer part of the position and uses only the decimal\n    place, and converts this to a subpixel position depending on the\n    subsampling specified. The center of a pixel corresponds to an integer\n    position.\n\n    Parameters\n    ----------\n    position : ndarray or array-like\n        Positions in pixels.\n    subsampling : int\n        Subsampling factor per pixel.\n\n    Returns\n    -------\n    indices : ndarray\n        The integer subpixel indices corresponding to the input positions.\n\n    Examples\n    --------\n\n    If no subsampling is used, then the subpixel indices returned are always 0:\n\n    >>> from astropy.nddata.utils import subpixel_indices\n    >>> subpixel_indices([1.2, 3.4, 5.6], 1)  # doctest: +FLOAT_CMP\n    array([0., 0., 0.])\n\n    If instead we use a subsampling of 2, we see that for the two first values\n    (1.1 and 3.4) the subpixel position is 1, while for 5.6 it is 0. This is\n    because the values of 1, 3, and 6 lie in the center of pixels, and 1.1 and\n    3.4 lie in the left part of the pixels and 5.6 lies in the right part.\n\n    >>> subpixel_indices([1.2, 3.4, 5.5], 2)  # doctest: +FLOAT_CMP\n    array([1., 1., 0.])\n    \"\"\"\n    # Get decimal points\n    fractions = np.modf(np.asanyarray(position) + 0.5)[0]\n    return np.floor(fractions * subsampling)"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":11760,"name":"__all__","nodeType":"Attribute","startLoc":16,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"utils.py#<anonymous>","id":11761,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module includes helper functions for array operations.\n\"\"\"\n\n__all__ = ['extract_array', 'add_array', 'subpixel_indices',\n           'overlap_slices', 'NoOverlapError', 'PartialOverlapError',\n           'Cutout2D']"},{"fileName":"bitmask.py","filePath":"astropy/nddata","id":11762,"nodeType":"File","text":"\"\"\"\nA module that provides functions for manipulating bit masks and data quality\n(DQ) arrays.\n\n\"\"\"\nimport warnings\nimport numbers\nfrom collections import OrderedDict\nimport numpy as np\n\n\n__all__ = ['bitfield_to_boolean_mask', 'interpret_bit_flags',\n           'BitFlagNameMap', 'extend_bit_flag_map', 'InvalidBitFlag']\n\n\n_ENABLE_BITFLAG_CACHING = True\n_MAX_UINT_TYPE = np.maximum_sctype(np.uint)\n_SUPPORTED_FLAGS = int(np.bitwise_not(\n    0, dtype=_MAX_UINT_TYPE, casting='unsafe'\n))\n\n\ndef _is_bit_flag(n):\n    \"\"\"\n    Verifies if the input number is a bit flag (i.e., an integer number that is\n    an integer power of 2).\n\n    Parameters\n    ----------\n    n : int\n        A positive integer number. Non-positive integers are considered not to\n        be \"flags\".\n\n    Returns\n    -------\n    bool\n        ``True`` if input ``n`` is a bit flag and ``False`` if it is not.\n\n    \"\"\"\n    if n < 1:\n        return False\n\n    return bin(n).count('1') == 1\n\n\ndef _is_int(n):\n    return (\n        (isinstance(n, numbers.Integral) and not isinstance(n, bool)) or\n        (isinstance(n, np.generic) and np.issubdtype(n, np.integer))\n    )\n\n\nclass InvalidBitFlag(ValueError):\n    \"\"\" Indicates that a value is not an integer that is a power of 2. \"\"\"\n    pass\n\n\nclass BitFlag(int):\n    \"\"\" Bit flags: integer values that are powers of 2. \"\"\"\n    def __new__(cls, val, doc=None):\n        if isinstance(val, tuple):\n            if doc is not None:\n                raise ValueError(\"Flag's doc string cannot be provided twice.\")\n            val, doc = val\n\n        if not (_is_int(val) and _is_bit_flag(val)):\n            raise InvalidBitFlag(\n                \"Value '{}' is not a valid bit flag: bit flag value must be \"\n                \"an integral power of two.\".format(val)\n            )\n\n        s = int.__new__(cls, val)\n        if doc is not None:\n            s.__doc__ = doc\n        return s\n\n\nclass BitFlagNameMeta(type):\n    def __new__(mcls, name, bases, members):\n        for k, v in members.items():\n            if not k.startswith('_'):\n                v = BitFlag(v)\n\n        attr = [k for k in members.keys() if not k.startswith('_')]\n        attrl = list(map(str.lower, attr))\n\n        if _ENABLE_BITFLAG_CACHING:\n            cache = OrderedDict()\n\n        for b in bases:\n            for k, v in b.__dict__.items():\n                if k.startswith('_'):\n                    continue\n                kl = k.lower()\n                if kl in attrl:\n                    idx = attrl.index(kl)\n                    raise AttributeError(\"Bit flag '{:s}' was already defined.\"\n                                         .format(attr[idx]))\n                if _ENABLE_BITFLAG_CACHING:\n                    cache[kl] = v\n\n        members = {k: v if k.startswith('_') else BitFlag(v)\n                   for k, v in members.items()}\n\n        if _ENABLE_BITFLAG_CACHING:\n            cache.update({k.lower(): v for k, v in members.items()\n                          if not k.startswith('_')})\n            members = {'_locked': True, '__version__': '', **members,\n                       '_cache': cache}\n        else:\n            members = {'_locked': True, '__version__': '', **members}\n\n        return super().__new__(mcls, name, bases, members)\n\n    def __setattr__(cls, name, val):\n        if name == '_locked':\n            return super().__setattr__(name, True)\n\n        else:\n            if name == '__version__':\n                if cls._locked:\n                    raise AttributeError(\"Version cannot be modified.\")\n                return super().__setattr__(name, val)\n\n            err_msg = f\"Bit flags are read-only. Unable to reassign attribute {name}\"\n            if cls._locked:\n                raise AttributeError(err_msg)\n\n        namel = name.lower()\n        if _ENABLE_BITFLAG_CACHING:\n            if not namel.startswith('_') and namel in cls._cache:\n                raise AttributeError(err_msg)\n\n        else:\n            for b in cls.__bases__:\n                if not namel.startswith('_') and namel in list(map(str.lower, b.__dict__)):\n                    raise AttributeError(err_msg)\n            if namel in list(map(str.lower, cls.__dict__)):\n                raise AttributeError(err_msg)\n\n        val = BitFlag(val)\n\n        if _ENABLE_BITFLAG_CACHING and not namel.startswith('_'):\n            cls._cache[namel] = val\n\n        return super().__setattr__(name, val)\n\n    def __getattr__(cls, name):\n        if _ENABLE_BITFLAG_CACHING:\n            flagnames = cls._cache\n        else:\n            flagnames = {k.lower(): v for k, v in cls.__dict__.items()}\n            flagnames.update({k.lower(): v for b in cls.__bases__\n                              for k, v in b.__dict__.items()})\n        try:\n            return flagnames[name.lower()]\n        except KeyError:\n            raise AttributeError(f\"Flag '{name}' not defined\")\n\n    def __getitem__(cls, key):\n        return cls.__getattr__(key)\n\n    def __add__(cls, items):\n        if not isinstance(items, dict):\n            if not isinstance(items[0], (tuple, list)):\n                items = [items]\n            items = dict(items)\n\n        return extend_bit_flag_map(\n            cls.__name__ + '_' + '_'.join([k for k in items]),\n            cls,\n            **items\n        )\n\n    def __iadd__(cls, other):\n        raise NotImplementedError(\n            \"Unary '+' is not supported. Use binary operator instead.\"\n        )\n\n    def __delattr__(cls, name):\n        raise AttributeError(\"{:s}: cannot delete {:s} member.\"\n                             .format(cls.__name__, cls.mro()[-2].__name__))\n\n    def __delitem__(cls, name):\n        raise AttributeError(\"{:s}: cannot delete {:s} member.\"\n                             .format(cls.__name__, cls.mro()[-2].__name__))\n\n    def __repr__(cls):\n        return f\"<{cls.mro()[-2].__name__:s} '{cls.__name__:s}'>\"\n\n\nclass BitFlagNameMap(metaclass=BitFlagNameMeta):\n    \"\"\"\n    A base class for bit flag name maps used to describe data quality (DQ)\n    flags of images by provinding a mapping from a mnemonic flag name to a flag\n    value.\n\n    Mapping for a specific instrument should subclass this class.\n    Subclasses should define flags as class attributes with integer values\n    that are powers of 2. Each bit flag may also contain a string\n    comment following the flag value.\n\n    Examples\n    --------\n\n        >>> from astropy.nddata.bitmask import BitFlagNameMap\n        >>> class ST_DQ(BitFlagNameMap):\n        ...     __version__ = '1.0.0'  # optional\n        ...     CR = 1, 'Cosmic Ray'\n        ...     CLOUDY = 4  # no docstring comment\n        ...     RAINY = 8, 'Dome closed'\n        ...\n        >>> class ST_CAM1_DQ(ST_DQ):\n        ...     HOT = 16\n        ...     DEAD = 32\n\n    \"\"\"\n    pass\n\n\ndef extend_bit_flag_map(cls_name, base_cls=BitFlagNameMap, **kwargs):\n    \"\"\"\n    A convenience function for creating bit flags maps by subclassing an\n    existing map and adding additional flags supplied as keyword arguments.\n\n    Parameters\n    ----------\n    cls_name : str\n        Class name of the bit flag map to be created.\n\n    base_cls : BitFlagNameMap, optional\n        Base class for the new bit flag map.\n\n    **kwargs : int\n        Each supplied keyword argument will be used to define bit flag\n        names in the new map. In addition to bit flag names, ``__version__`` is\n        allowed to indicate the version of the newly created map.\n\n    Examples\n    --------\n\n        >>> from astropy.nddata.bitmask import extend_bit_flag_map\n        >>> ST_DQ = extend_bit_flag_map('ST_DQ', __version__='1.0.0', CR=1, CLOUDY=4, RAINY=8)\n        >>> ST_CAM1_DQ = extend_bit_flag_map('ST_CAM1_DQ', ST_DQ, HOT=16, DEAD=32)\n        >>> ST_CAM1_DQ['HOT']  # <-- Access flags as dictionary keys\n        16\n        >>> ST_CAM1_DQ.HOT  # <-- Access flags as class attributes\n        16\n\n    \"\"\"\n    new_cls = BitFlagNameMeta.__new__(\n        BitFlagNameMeta,\n        cls_name,\n        (base_cls, ),\n        {'_locked': False}\n    )\n    for k, v in kwargs.items():\n        try:\n            setattr(new_cls, k, v)\n        except AttributeError as e:\n            if new_cls[k] != int(v):\n                raise e\n\n    new_cls._locked = True\n    return new_cls\n\n\ndef interpret_bit_flags(bit_flags, flip_bits=None, flag_name_map=None):\n    \"\"\"\n    Converts input bit flags to a single integer value (bit mask) or `None`.\n\n    When input is a list of flags (either a Python list of integer flags or a\n    string of comma-, ``'|'``-, or ``'+'``-separated list of flags),\n    the returned bit mask is obtained by summing input flags.\n\n    .. note::\n        In order to flip the bits of the returned bit mask,\n        for input of `str` type, prepend '~' to the input string. '~' must\n        be prepended to the *entire string* and not to each bit flag! For\n        input that is already a bit mask or a Python list of bit flags, set\n        ``flip_bits`` for `True` in order to flip the bits of the returned\n        bit mask.\n\n    Parameters\n    ----------\n    bit_flags : int, str, list, None\n        An integer bit mask or flag, `None`, a string of comma-, ``'|'``- or\n        ``'+'``-separated list of integer bit flags or mnemonic flag names,\n        or a Python list of integer bit flags. If ``bit_flags`` is a `str`\n        and if it is prepended with '~', then the output bit mask will have\n        its bits flipped (compared to simple sum of input flags).\n        For input ``bit_flags`` that is already a bit mask or a Python list\n        of bit flags, bit-flipping can be controlled through ``flip_bits``\n        parameter.\n\n        .. note::\n            When ``bit_flags`` is a list of flag names, the ``flag_name_map``\n            parameter must be provided.\n\n        .. note::\n            Only one flag separator is supported at a time. ``bit_flags``\n            string should not mix ``','``, ``'+'``, and ``'|'`` separators.\n\n    flip_bits : bool, None\n        Indicates whether or not to flip the bits of the returned bit mask\n        obtained from input bit flags. This parameter must be set to `None`\n        when input ``bit_flags`` is either `None` or a Python list of flags.\n\n    flag_name_map : BitFlagNameMap\n         A `BitFlagNameMap` object that provides mapping from mnemonic\n         bit flag names to integer bit values in order to translate mnemonic\n         flags to numeric values when ``bit_flags`` that are comma- or\n         '+'-separated list of menmonic bit flag names.\n\n    Returns\n    -------\n    bitmask : int or None\n        Returns an integer bit mask formed from the input bit value or `None`\n        if input ``bit_flags`` parameter is `None` or an empty string.\n        If input string value was prepended with '~' (or ``flip_bits`` was set\n        to `True`), then returned value will have its bits flipped\n        (inverse mask).\n\n    Examples\n    --------\n\n        >>> from astropy.nddata.bitmask import interpret_bit_flags, extend_bit_flag_map\n        >>> ST_DQ = extend_bit_flag_map('ST_DQ', CR=1, CLOUDY=4, RAINY=8, HOT=16, DEAD=32)\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags(28))\n        '0000000000011100'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags('4,8,16'))\n        '0000000000011100'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags('CLOUDY,RAINY,HOT', flag_name_map=ST_DQ))\n        '0000000000011100'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags('~4,8,16'))\n        '1111111111100011'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags('~(4+8+16)'))\n        '1111111111100011'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags('~(CLOUDY+RAINY+HOT)',\n        ... flag_name_map=ST_DQ))\n        '1111111111100011'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags([4, 8, 16]))\n        '0000000000011100'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags([4, 8, 16], flip_bits=True))\n        '1111111111100011'\n\n    \"\"\"\n    has_flip_bits = flip_bits is not None\n    flip_bits = bool(flip_bits)\n    allow_non_flags = False\n\n    if _is_int(bit_flags):\n        return (~int(bit_flags) if flip_bits else int(bit_flags))\n\n    elif bit_flags is None:\n        if has_flip_bits:\n            raise TypeError(\n                \"Keyword argument 'flip_bits' must be set to 'None' when \"\n                \"input 'bit_flags' is None.\"\n            )\n        return None\n\n    elif isinstance(bit_flags, str):\n        if has_flip_bits:\n            raise TypeError(\n                \"Keyword argument 'flip_bits' is not permitted for \"\n                \"comma-separated string lists of bit flags. Prepend '~' to \"\n                \"the string to indicate bit-flipping.\"\n            )\n\n        bit_flags = str(bit_flags).strip()\n\n        if bit_flags.upper() in ['', 'NONE', 'INDEF']:\n            return None\n\n        # check whether bitwise-NOT is present and if it is, check that it is\n        # in the first position:\n        bitflip_pos = bit_flags.find('~')\n        if bitflip_pos == 0:\n            flip_bits = True\n            bit_flags = bit_flags[1:].lstrip()\n        else:\n            if bitflip_pos > 0:\n                raise ValueError(\"Bitwise-NOT must precede bit flag list.\")\n            flip_bits = False\n\n        # basic check for correct use of parenthesis:\n        while True:\n            nlpar = bit_flags.count('(')\n            nrpar = bit_flags.count(')')\n\n            if nlpar == 0 and nrpar == 0:\n                break\n\n            if nlpar != nrpar:\n                raise ValueError(\"Unbalanced parentheses in bit flag list.\")\n\n            lpar_pos = bit_flags.find('(')\n            rpar_pos = bit_flags.rfind(')')\n            if lpar_pos > 0 or rpar_pos < (len(bit_flags) - 1):\n                raise ValueError(\"Incorrect syntax (incorrect use of \"\n                                 \"parenthesis) in bit flag list.\")\n\n            bit_flags = bit_flags[1:-1].strip()\n\n        if sum(k in bit_flags for k in '+,|') > 1:\n            raise ValueError(\n                \"Only one type of bit flag separator may be used in one \"\n                \"expression. Allowed separators are: '+', '|', or ','.\"\n            )\n\n        if ',' in bit_flags:\n            bit_flags = bit_flags.split(',')\n\n        elif '+' in bit_flags:\n            bit_flags = bit_flags.split('+')\n\n        elif '|' in bit_flags:\n            bit_flags = bit_flags.split('|')\n\n        else:\n            if bit_flags == '':\n                raise ValueError(\n                    \"Empty bit flag lists not allowed when either bitwise-NOT \"\n                    \"or parenthesis are present.\"\n                )\n            bit_flags = [bit_flags]\n\n        if flag_name_map is not None:\n            try:\n                int(bit_flags[0])\n            except ValueError:\n                bit_flags = [flag_name_map[f] for f in bit_flags]\n\n        allow_non_flags = len(bit_flags) == 1\n\n    elif hasattr(bit_flags, '__iter__'):\n        if not all([_is_int(flag) for flag in bit_flags]):\n            if (flag_name_map is not None and all([isinstance(flag, str)\n                                                   for flag in bit_flags])):\n                bit_flags = [flag_name_map[f] for f in bit_flags]\n            else:\n                raise TypeError(\"Every bit flag in a list must be either an \"\n                                \"integer flag value or a 'str' flag name.\")\n\n    else:\n        raise TypeError(\"Unsupported type for argument 'bit_flags'.\")\n\n    bitset = set(map(int, bit_flags))\n    if len(bitset) != len(bit_flags):\n        warnings.warn(\"Duplicate bit flags will be ignored\")\n\n    bitmask = 0\n    for v in bitset:\n        if not _is_bit_flag(v) and not allow_non_flags:\n            raise ValueError(\"Input list contains invalid (not powers of two) \"\n                             \"bit flag: {:d}\".format(v))\n        bitmask += v\n\n    if flip_bits:\n        bitmask = ~bitmask\n\n    return bitmask\n\n\ndef bitfield_to_boolean_mask(bitfield, ignore_flags=0, flip_bits=None,\n                             good_mask_value=False, dtype=np.bool_,\n                             flag_name_map=None):\n    \"\"\"\n    bitfield_to_boolean_mask(bitfield, ignore_flags=None, flip_bits=None, \\\ngood_mask_value=False, dtype=numpy.bool_)\n    Converts an array of bit fields to a boolean (or integer) mask array\n    according to a bit mask constructed from the supplied bit flags (see\n    ``ignore_flags`` parameter).\n\n    This function is particularly useful to convert data quality arrays to\n    boolean masks with selective filtering of DQ flags.\n\n    Parameters\n    ----------\n    bitfield : ndarray\n        An array of bit flags. By default, values different from zero are\n        interpreted as \"bad\" values and values equal to zero are considered\n        as \"good\" values. However, see ``ignore_flags`` parameter on how to\n        selectively ignore some bits in the ``bitfield`` array data.\n\n    ignore_flags : int, str, list, None (default = 0)\n        An integer bit mask, `None`, a Python list of bit flags, a comma-,\n        or ``'|'``-separated, ``'+'``-separated string list of integer\n        bit flags or mnemonic flag names that indicate what bits in the input\n        ``bitfield`` should be *ignored* (i.e., zeroed), or `None`.\n\n        .. note::\n            When ``bit_flags`` is a list of flag names, the ``flag_name_map``\n            parameter must be provided.\n\n        | Setting ``ignore_flags`` to `None` effectively will make\n          `bitfield_to_boolean_mask` interpret all ``bitfield`` elements\n          as \"good\" regardless of their value.\n\n        | When ``ignore_flags`` argument is an integer bit mask, it will be\n          combined using bitwise-NOT and bitwise-AND with each element of the\n          input ``bitfield`` array (``~ignore_flags & bitfield``). If the\n          resultant bitfield element is non-zero, that element will be\n          interpreted as a \"bad\" in the output boolean mask and it will be\n          interpreted as \"good\" otherwise. ``flip_bits`` parameter may be used\n          to flip the bits (``bitwise-NOT``) of the bit mask thus effectively\n          changing the meaning of the ``ignore_flags`` parameter from \"ignore\"\n          to \"use only\" these flags.\n\n        .. note::\n\n            Setting ``ignore_flags`` to 0 effectively will assume that all\n            non-zero elements in the input ``bitfield`` array are to be\n            interpreted as \"bad\".\n\n        | When ``ignore_flags`` argument is a Python list of integer bit\n          flags, these flags are added together to create an integer bit mask.\n          Each item in the list must be a flag, i.e., an integer that is an\n          integer power of 2. In order to flip the bits of the resultant\n          bit mask, use ``flip_bits`` parameter.\n\n        | Alternatively, ``ignore_flags`` may be a string of comma- or\n          ``'+'``(or ``'|'``)-separated list of integer bit flags that should\n          be added (bitwise OR) together to create an integer bit mask.\n          For example, both ``'4,8'``, ``'4|8'``, and ``'4+8'`` are equivalent\n          and indicate that bit flags 4 and 8 in the input ``bitfield``\n          array should be ignored when generating boolean mask.\n\n        .. note::\n\n            ``'None'``, ``'INDEF'``, and empty (or all white space) strings\n            are special values of string ``ignore_flags`` that are\n            interpreted as `None`.\n\n        .. note::\n\n            Each item in the list must be a flag, i.e., an integer that is an\n            integer power of 2. In addition, for convenience, an arbitrary\n            **single** integer is allowed and it will be interpreted as an\n            integer bit mask. For example, instead of ``'4,8'`` one could\n            simply provide string ``'12'``.\n\n        .. note::\n            Only one flag separator is supported at a time. ``ignore_flags``\n            string should not mix ``','``, ``'+'``, and ``'|'`` separators.\n\n        .. note::\n\n            When ``ignore_flags`` is a `str` and when it is prepended with\n            '~', then the meaning of ``ignore_flags`` parameters will be\n            reversed: now it will be interpreted as a list of bit flags to be\n            *used* (or *not ignored*) when deciding which elements of the\n            input ``bitfield`` array are \"bad\". Following this convention,\n            an ``ignore_flags`` string value of ``'~0'`` would be equivalent\n            to setting ``ignore_flags=None``.\n\n        .. warning::\n\n            Because prepending '~' to a string ``ignore_flags`` is equivalent\n            to setting ``flip_bits`` to `True`, ``flip_bits`` cannot be used\n            with string ``ignore_flags`` and it must be set to `None`.\n\n    flip_bits : bool, None (default = None)\n        Specifies whether or not to invert the bits of the bit mask either\n        supplied directly through ``ignore_flags`` parameter or built from the\n        bit flags passed through ``ignore_flags`` (only when bit flags are\n        passed as Python lists of integer bit flags). Occasionally, it may be\n        useful to *consider only specific bit flags* in the ``bitfield``\n        array when creating a boolean mask as opposed to *ignoring* specific\n        bit flags as ``ignore_flags`` behaves by default. This can be achieved\n        by inverting/flipping the bits of the bit mask created from\n        ``ignore_flags`` flags which effectively changes the meaning of the\n        ``ignore_flags`` parameter from \"ignore\" to \"use only\" these flags.\n        Setting ``flip_bits`` to `None` means that no bit flipping will be\n        performed. Bit flipping for string lists of bit flags must be\n        specified by prepending '~' to string bit flag lists\n        (see documentation for ``ignore_flags`` for more details).\n\n        .. warning::\n            This parameter can be set to either `True` or `False` **ONLY** when\n            ``ignore_flags`` is either an integer bit mask or a Python\n            list of integer bit flags. When ``ignore_flags`` is either\n            `None` or a string list of flags, ``flip_bits`` **MUST** be set\n            to `None`.\n\n    good_mask_value : int, bool (default = False)\n        This parameter is used to derive the values that will be assigned to\n        the elements in the output boolean mask array that correspond to the\n        \"good\" bit fields (that are 0 after zeroing bits specified by\n        ``ignore_flags``) in the input ``bitfield`` array. When\n        ``good_mask_value`` is non-zero or ``numpy.True_`` then values in the\n        output boolean mask array corresponding to \"good\" bit fields in\n        ``bitfield`` will be ``numpy.True_`` (if ``dtype`` is ``numpy.bool_``)\n        or 1 (if ``dtype`` is of numerical type) and values of corresponding\n        to \"bad\" flags will be ``numpy.False_`` (or 0). When\n        ``good_mask_value`` is zero or ``numpy.False_`` then the values\n        in the output boolean mask array corresponding to \"good\" bit fields\n        in ``bitfield`` will be ``numpy.False_`` (if ``dtype`` is\n        ``numpy.bool_``) or 0 (if ``dtype`` is of numerical type) and values\n        of corresponding to \"bad\" flags will be ``numpy.True_`` (or 1).\n\n    dtype : data-type (default = ``numpy.bool_``)\n        The desired data-type for the output binary mask array.\n\n    flag_name_map : BitFlagNameMap\n         A `BitFlagNameMap` object that provides mapping from mnemonic\n         bit flag names to integer bit values in order to translate mnemonic\n         flags to numeric values when ``bit_flags`` that are comma- or\n         '+'-separated list of menmonic bit flag names.\n\n    Returns\n    -------\n    mask : ndarray\n        Returns an array of the same dimensionality as the input ``bitfield``\n        array whose elements can have two possible values,\n        e.g., ``numpy.True_`` or ``numpy.False_`` (or 1 or 0 for integer\n        ``dtype``) according to values of to the input ``bitfield`` elements,\n        ``ignore_flags`` parameter, and the ``good_mask_value`` parameter.\n\n    Examples\n    --------\n\n        >>> from astropy.nddata import bitmask\n        >>> import numpy as np\n        >>> dqarr = np.asarray([[0, 0, 1, 2, 0, 8, 12, 0],\n        ...                     [10, 4, 0, 0, 0, 16, 6, 0]])\n        >>> flag_map = bitmask.extend_bit_flag_map(\n        ...     'ST_DQ', CR=2, CLOUDY=4, RAINY=8, HOT=16, DEAD=32\n        ... )\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=0,\n        ...                                  dtype=int)\n        array([[0, 0, 1, 1, 0, 1, 1, 0],\n               [1, 1, 0, 0, 0, 1, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=0,\n        ...                                  dtype=bool)\n        array([[False, False,  True,  True, False,  True,  True, False],\n               [ True,  True, False, False, False,  True,  True, False]]...)\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=6,\n        ...                                  good_mask_value=0, dtype=int)\n        array([[0, 0, 1, 0, 0, 1, 1, 0],\n               [1, 0, 0, 0, 0, 1, 0, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=~6,\n        ...                                  good_mask_value=0, dtype=int)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=6, dtype=int,\n        ...                                  flip_bits=True, good_mask_value=0)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags='~(2+4)',\n        ...                                  good_mask_value=0, dtype=int)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=[2, 4],\n        ...                                  flip_bits=True, good_mask_value=0,\n        ...                                  dtype=int)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags='~(CR,CLOUDY)',\n        ...                                  good_mask_value=0, dtype=int,\n        ...                                  flag_name_map=flag_map)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags='~(CR+CLOUDY)',\n        ...                                  good_mask_value=0, dtype=int,\n        ...                                  flag_name_map=flag_map)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n\n    \"\"\"\n    bitfield = np.asarray(bitfield)\n    if not np.issubdtype(bitfield.dtype, np.integer):\n        raise TypeError(\"Input bitfield array must be of integer type.\")\n\n    ignore_mask = interpret_bit_flags(ignore_flags, flip_bits=flip_bits,\n                                      flag_name_map=flag_name_map)\n\n    if ignore_mask is None:\n        if good_mask_value:\n            mask = np.ones_like(bitfield, dtype=dtype)\n        else:\n            mask = np.zeros_like(bitfield, dtype=dtype)\n        return mask\n\n    # filter out bits beyond the maximum supported by the data type:\n    ignore_mask = ignore_mask & _SUPPORTED_FLAGS\n\n    # invert the \"ignore\" mask:\n    ignore_mask = np.bitwise_not(ignore_mask, dtype=bitfield.dtype.type,\n                                 casting='unsafe')\n\n    mask = np.empty_like(bitfield, dtype=np.bool_)\n    np.bitwise_and(bitfield, ignore_mask, out=mask, casting='unsafe')\n\n    if good_mask_value:\n        np.logical_not(mask, out=mask)\n\n    return mask.astype(dtype=dtype, subok=False, copy=False)\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":292,"id":11763,"name":"errorfunc","nodeType":"Attribute","startLoc":292,"text":"self.errorfunc"},{"className":"InvalidBitFlag","col":0,"comment":" Indicates that a value is not an integer that is a power of 2. ","endLoc":55,"id":11764,"nodeType":"Class","startLoc":53,"text":"class InvalidBitFlag(ValueError):\n    \"\"\" Indicates that a value is not an integer that is a power of 2. \"\"\"\n    pass"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":11766,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":11767,"name":"SUPPORTED_PROPERTIES","nodeType":"Attribute","startLoc":18,"text":"SUPPORTED_PROPERTIES"},{"attributeType":"null","col":8,"comment":"null","endLoc":291,"id":11768,"name":"goto","nodeType":"Attribute","startLoc":291,"text":"self.goto"},{"col":0,"comment":"","endLoc":4,"header":"decorators.py#<anonymous>","id":11769,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['support_nddata']\n\nSUPPORTED_PROPERTIES = ['data', 'uncertainty', 'mask', 'meta', 'unit', 'wcs',\n                        'flags']"},{"className":"BitFlag","col":0,"comment":" Bit flags: integer values that are powers of 2. ","endLoc":75,"id":11770,"nodeType":"Class","startLoc":58,"text":"class BitFlag(int):\n    \"\"\" Bit flags: integer values that are powers of 2. \"\"\"\n    def __new__(cls, val, doc=None):\n        if isinstance(val, tuple):\n            if doc is not None:\n                raise ValueError(\"Flag's doc string cannot be provided twice.\")\n            val, doc = val\n\n        if not (_is_int(val) and _is_bit_flag(val)):\n            raise InvalidBitFlag(\n                \"Value '{}' is not a valid bit flag: bit flag value must be \"\n                \"an integral power of two.\".format(val)\n            )\n\n        s = int.__new__(cls, val)\n        if doc is not None:\n            s.__doc__ = doc\n        return s"},{"attributeType":"null","col":8,"comment":"null","endLoc":316,"id":11771,"name":"defaulted_states","nodeType":"Attribute","startLoc":316,"text":"self.defaulted_states"},{"col":4,"comment":"null","endLoc":75,"header":"def __new__(cls, val, doc=None)","id":11772,"name":"__new__","nodeType":"Function","startLoc":60,"text":"def __new__(cls, val, doc=None):\n        if isinstance(val, tuple):\n            if doc is not None:\n                raise ValueError(\"Flag's doc string cannot be provided twice.\")\n            val, doc = val\n\n        if not (_is_int(val) and _is_bit_flag(val)):\n            raise InvalidBitFlag(\n                \"Value '{}' is not a valid bit flag: bit flag value must be \"\n                \"an integral power of two.\".format(val)\n            )\n\n        s = int.__new__(cls, val)\n        if doc is not None:\n            s.__doc__ = doc\n        return s"},{"col":4,"comment":"Checks if the uncertainties are compatible for propagation.\n\n        Checks if the other uncertainty is `NDUncertainty`-like and if so\n        verify that the uncertainty_type is equal. If the latter is not the\n        case try returning ``self.__class__(other_uncert)``.\n\n        Parameters\n        ----------\n        other_uncert : `NDUncertainty` subclass\n            The other uncertainty.\n\n        Returns\n        -------\n        other_uncert : `NDUncertainty` subclass\n            but converted to a compatible `NDUncertainty` subclass if\n            possible and necessary.\n\n        Raises\n        ------\n        IncompatibleUncertaintiesException:\n            If the other uncertainty cannot be converted to a compatible\n            `NDUncertainty` subclass.\n        ","endLoc":380,"header":"def _convert_uncertainty(self, other_uncert)","id":11773,"name":"_convert_uncertainty","nodeType":"Function","startLoc":350,"text":"def _convert_uncertainty(self, other_uncert):\n        \"\"\"Checks if the uncertainties are compatible for propagation.\n\n        Checks if the other uncertainty is `NDUncertainty`-like and if so\n        verify that the uncertainty_type is equal. If the latter is not the\n        case try returning ``self.__class__(other_uncert)``.\n\n        Parameters\n        ----------\n        other_uncert : `NDUncertainty` subclass\n            The other uncertainty.\n\n        Returns\n        -------\n        other_uncert : `NDUncertainty` subclass\n            but converted to a compatible `NDUncertainty` subclass if\n            possible and necessary.\n\n        Raises\n        ------\n        IncompatibleUncertaintiesException:\n            If the other uncertainty cannot be converted to a compatible\n            `NDUncertainty` subclass.\n        \"\"\"\n        if isinstance(other_uncert, NDUncertainty):\n            if self.uncertainty_type == other_uncert.uncertainty_type:\n                return other_uncert\n            else:\n                return self.__class__(other_uncert)\n        else:\n            raise IncompatibleUncertaintiesException"},{"fileName":"flag_collection.py","filePath":"astropy/nddata","id":11774,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nfrom collections import OrderedDict\n\nimport numpy as np\n\nfrom astropy.utils.misc import isiterable\n\n__all__ = ['FlagCollection']\n\n\nclass FlagCollection(OrderedDict):\n    \"\"\"\n    The purpose of this class is to provide a dictionary for\n    containing arrays of flags for the `NDData` class. Flags should be\n    stored in Numpy arrays that have the same dimensions as the parent\n    data, so the `FlagCollection` class adds shape checking to an\n    ordered dictionary class.\n\n    The `FlagCollection` should be initialized like an\n    `~collections.OrderedDict`, but with the addition of a ``shape=``\n    keyword argument used to pass the NDData shape.\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n\n        if 'shape' in kwargs:\n            self.shape = kwargs.pop('shape')\n            if not isiterable(self.shape):\n                raise ValueError(\"FlagCollection shape should be \"\n                                 \"an iterable object\")\n        else:\n            raise Exception(\"FlagCollection should be initialized with \"\n                            \"the shape of the data\")\n\n        OrderedDict.__init__(self, *args, **kwargs)\n\n    def __setitem__(self, item, value, **kwargs):\n\n        if isinstance(value, np.ndarray):\n            if value.shape == self.shape:\n                OrderedDict.__setitem__(self, item, value, **kwargs)\n            else:\n                raise ValueError(\"flags array shape {} does not match data \"\n                                 \"shape {}\".format(value.shape, self.shape))\n        else:\n            raise TypeError(\"flags should be given as a Numpy array\")\n"},{"col":0,"comment":"null","endLoc":50,"header":"def _is_int(n)","id":11775,"name":"_is_int","nodeType":"Function","startLoc":46,"text":"def _is_int(n):\n    return (\n        (isinstance(n, numbers.Integral) and not isinstance(n, bool)) or\n        (isinstance(n, np.generic) and np.issubdtype(n, np.integer))\n    )"},{"className":"FlagCollection","col":0,"comment":"\n    The purpose of this class is to provide a dictionary for\n    containing arrays of flags for the `NDData` class. Flags should be\n    stored in Numpy arrays that have the same dimensions as the parent\n    data, so the `FlagCollection` class adds shape checking to an\n    ordered dictionary class.\n\n    The `FlagCollection` should be initialized like an\n    `~collections.OrderedDict`, but with the addition of a ``shape=``\n    keyword argument used to pass the NDData shape.\n    ","endLoc":48,"id":11776,"nodeType":"Class","startLoc":13,"text":"class FlagCollection(OrderedDict):\n    \"\"\"\n    The purpose of this class is to provide a dictionary for\n    containing arrays of flags for the `NDData` class. Flags should be\n    stored in Numpy arrays that have the same dimensions as the parent\n    data, so the `FlagCollection` class adds shape checking to an\n    ordered dictionary class.\n\n    The `FlagCollection` should be initialized like an\n    `~collections.OrderedDict`, but with the addition of a ``shape=``\n    keyword argument used to pass the NDData shape.\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n\n        if 'shape' in kwargs:\n            self.shape = kwargs.pop('shape')\n            if not isiterable(self.shape):\n                raise ValueError(\"FlagCollection shape should be \"\n                                 \"an iterable object\")\n        else:\n            raise Exception(\"FlagCollection should be initialized with \"\n                            \"the shape of the data\")\n\n        OrderedDict.__init__(self, *args, **kwargs)\n\n    def __setitem__(self, item, value, **kwargs):\n\n        if isinstance(value, np.ndarray):\n            if value.shape == self.shape:\n                OrderedDict.__setitem__(self, item, value, **kwargs)\n            else:\n                raise ValueError(\"flags array shape {} does not match data \"\n                                 \"shape {}\".format(value.shape, self.shape))\n        else:\n            raise TypeError(\"flags should be given as a Numpy array\")"},{"col":0,"comment":"\n    Verifies if the input number is a bit flag (i.e., an integer number that is\n    an integer power of 2).\n\n    Parameters\n    ----------\n    n : int\n        A positive integer number. Non-positive integers are considered not to\n        be \"flags\".\n\n    Returns\n    -------\n    bool\n        ``True`` if input ``n`` is a bit flag and ``False`` if it is not.\n\n    ","endLoc":43,"header":"def _is_bit_flag(n)","id":11777,"name":"_is_bit_flag","nodeType":"Function","startLoc":23,"text":"def _is_bit_flag(n):\n    \"\"\"\n    Verifies if the input number is a bit flag (i.e., an integer number that is\n    an integer power of 2).\n\n    Parameters\n    ----------\n    n : int\n        A positive integer number. Non-positive integers are considered not to\n        be \"flags\".\n\n    Returns\n    -------\n    bool\n        ``True`` if input ``n`` is a bit flag and ``False`` if it is not.\n\n    \"\"\"\n    if n < 1:\n        return False\n\n    return bin(n).count('1') == 1"},{"col":4,"comment":"null","endLoc":37,"header":"def __init__(self, *args, **kwargs)","id":11778,"name":"__init__","nodeType":"Function","startLoc":26,"text":"def __init__(self, *args, **kwargs):\n\n        if 'shape' in kwargs:\n            self.shape = kwargs.pop('shape')\n            if not isiterable(self.shape):\n                raise ValueError(\"FlagCollection shape should be \"\n                                 \"an iterable object\")\n        else:\n            raise Exception(\"FlagCollection should be initialized with \"\n                            \"the shape of the data\")\n\n        OrderedDict.__init__(self, *args, **kwargs)"},{"col":4,"comment":"null","endLoc":384,"header":"@abstractmethod\n    def _propagate_add(self, other_uncert, result_data, correlation)","id":11779,"name":"_propagate_add","nodeType":"Function","startLoc":382,"text":"@abstractmethod\n    def _propagate_add(self, other_uncert, result_data, correlation):\n        return None"},{"col":4,"comment":"null","endLoc":48,"header":"def __setitem__(self, item, value, **kwargs)","id":11780,"name":"__setitem__","nodeType":"Function","startLoc":39,"text":"def __setitem__(self, item, value, **kwargs):\n\n        if isinstance(value, np.ndarray):\n            if value.shape == self.shape:\n                OrderedDict.__setitem__(self, item, value, **kwargs)\n            else:\n                raise ValueError(\"flags array shape {} does not match data \"\n                                 \"shape {}\".format(value.shape, self.shape))\n        else:\n            raise TypeError(\"flags should be given as a Numpy array\")"},{"attributeType":"null","col":12,"comment":"null","endLoc":64,"id":11781,"name":"val","nodeType":"Attribute","startLoc":64,"text":"val"},{"col":4,"comment":"null","endLoc":388,"header":"@abstractmethod\n    def _propagate_subtract(self, other_uncert, result_data, correlation)","id":11782,"name":"_propagate_subtract","nodeType":"Function","startLoc":386,"text":"@abstractmethod\n    def _propagate_subtract(self, other_uncert, result_data, correlation):\n        return None"},{"attributeType":"null","col":12,"comment":"null","endLoc":29,"id":11783,"name":"shape","nodeType":"Attribute","startLoc":29,"text":"self.shape"},{"attributeType":"null","col":16,"comment":"null","endLoc":6,"id":11784,"name":"np","nodeType":"Attribute","startLoc":6,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":11785,"name":"__all__","nodeType":"Attribute","startLoc":10,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"flag_collection.py#<anonymous>","id":11786,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['FlagCollection']"},{"col":4,"comment":"null","endLoc":392,"header":"@abstractmethod\n    def _propagate_multiply(self, other_uncert, result_data, correlation)","id":11787,"name":"_propagate_multiply","nodeType":"Function","startLoc":390,"text":"@abstractmethod\n    def _propagate_multiply(self, other_uncert, result_data, correlation):\n        return None"},{"fileName":"compat.py","filePath":"astropy/nddata","id":11788,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# This module contains a class equivalent to pre-1.0 NDData.\n\n\nimport numpy as np\n\nfrom astropy.units import UnitsError, UnitConversionError, Unit\nfrom astropy import log\n\nfrom .nddata import NDData\nfrom .nduncertainty import NDUncertainty\n\nfrom .mixins.ndslicing import NDSlicingMixin\nfrom .mixins.ndarithmetic import NDArithmeticMixin\nfrom .mixins.ndio import NDIOMixin\n\nfrom .flag_collection import FlagCollection\n\n__all__ = ['NDDataArray']\n\n\nclass NDDataArray(NDArithmeticMixin, NDSlicingMixin, NDIOMixin, NDData):\n    \"\"\"\n    An ``NDData`` object with arithmetic. This class is functionally equivalent\n    to ``NDData`` in astropy  versions prior to 1.0.\n\n    The key distinction from raw numpy arrays is the presence of\n    additional metadata such as uncertainties, a mask, units, flags,\n    and/or a coordinate system.\n\n    See also: https://docs.astropy.org/en/stable/nddata/\n\n    Parameters\n    ----------\n    data : ndarray or `NDData`\n        The actual data contained in this `NDData` object. Not that this\n        will always be copies by *reference* , so you should make copy\n        the ``data`` before passing it in if that's the  desired behavior.\n\n    uncertainty : `~astropy.nddata.NDUncertainty`, optional\n        Uncertainties on the data.\n\n    mask : array-like, optional\n        Mask for the data, given as a boolean Numpy array or any object that\n        can be converted to a boolean Numpy array with a shape\n        matching that of the data. The values must be ``False`` where\n        the data is *valid* and ``True`` when it is not (like Numpy\n        masked arrays). If ``data`` is a numpy masked array, providing\n        ``mask`` here will causes the mask from the masked array to be\n        ignored.\n\n    flags : array-like or `~astropy.nddata.FlagCollection`, optional\n        Flags giving information about each pixel. These can be specified\n        either as a Numpy array of any type (or an object which can be converted\n        to a Numpy array) with a shape matching that of the\n        data, or as a `~astropy.nddata.FlagCollection` instance which has a\n        shape matching that of the data.\n\n    wcs : None, optional\n        WCS-object containing the world coordinate system for the data.\n\n        .. warning::\n            This is not yet defined because the discussion of how best to\n            represent this class's WCS system generically is still under\n            consideration. For now just leave it as None\n\n    meta : `dict`-like object, optional\n        Metadata for this object.  \"Metadata\" here means all information that\n        is included with this object but not part of any other attribute\n        of this particular object.  e.g., creation date, unique identifier,\n        simulation parameters, exposure time, telescope name, etc.\n\n    unit : `~astropy.units.UnitBase` instance or str, optional\n        The units of the data.\n\n\n    Raises\n    ------\n    ValueError :\n        If the `uncertainty` or `mask` inputs cannot be broadcast (e.g., match\n        shape) onto ``data``.\n    \"\"\"\n\n    def __init__(self, data, *args, flags=None, **kwargs):\n\n        # Initialize with the parent...\n        super().__init__(data, *args, **kwargs)\n\n        # ...then reset uncertainty to force it to go through the\n        # setter logic below. In base NDData all that is done is to\n        # set self._uncertainty to whatever uncertainty is passed in.\n        self.uncertainty = self._uncertainty\n\n        # Same thing for mask.\n        self.mask = self._mask\n\n        # Initial flags because it is no longer handled in NDData\n        # or NDDataBase.\n        if isinstance(data, NDDataArray):\n            if flags is None:\n                flags = data.flags\n            else:\n                log.info(\"Overwriting NDDataArrays's current \"\n                         \"flags with specified flags\")\n        self.flags = flags\n\n    # Implement uncertainty as NDUncertainty to support propagation of\n    # uncertainties in arithmetic operations\n    @property\n    def uncertainty(self):\n        return self._uncertainty\n\n    @uncertainty.setter\n    def uncertainty(self, value):\n        if value is not None:\n            if isinstance(value, NDUncertainty):\n                class_name = self.__class__.__name__\n                if not self.unit and value._unit:\n                    # Raise an error if uncertainty has unit and data does not\n                    raise ValueError(\"Cannot assign an uncertainty with unit \"\n                                     \"to {} without \"\n                                     \"a unit\".format(class_name))\n                self._uncertainty = value\n                self._uncertainty.parent_nddata = self\n            else:\n                raise TypeError(\"Uncertainty must be an instance of \"\n                                \"a NDUncertainty object\")\n        else:\n            self._uncertainty = value\n\n    # Override unit so that we can add a setter.\n    @property\n    def unit(self):\n        return self._unit\n\n    @unit.setter\n    def unit(self, value):\n        from . import conf\n\n        try:\n            if self._unit is not None and conf.warn_setting_unit_directly:\n                log.info('Setting the unit directly changes the unit without '\n                         'updating the data or uncertainty. Use the '\n                         '.convert_unit_to() method to change the unit and '\n                         'scale values appropriately.')\n        except AttributeError:\n            # raised if self._unit has not been set yet, in which case the\n            # warning is irrelevant\n            pass\n\n        if value is None:\n            self._unit = None\n        else:\n            self._unit = Unit(value)\n\n    # Implement mask in a way that converts nicely to a numpy masked array\n    @property\n    def mask(self):\n        if self._mask is np.ma.nomask:\n            return None\n        else:\n            return self._mask\n\n    @mask.setter\n    def mask(self, value):\n        # Check that value is not either type of null mask.\n        if (value is not None) and (value is not np.ma.nomask):\n            mask = np.array(value, dtype=np.bool_, copy=False)\n            if mask.shape != self.data.shape:\n                raise ValueError(\"dimensions of mask do not match data\")\n            else:\n                self._mask = mask\n        else:\n            # internal representation should be one numpy understands\n            self._mask = np.ma.nomask\n\n    @property\n    def shape(self):\n        \"\"\"\n        shape tuple of this object's data.\n        \"\"\"\n        return self.data.shape\n\n    @property\n    def size(self):\n        \"\"\"\n        integer size of this object's data.\n        \"\"\"\n        return self.data.size\n\n    @property\n    def dtype(self):\n        \"\"\"\n        `numpy.dtype` of this object's data.\n        \"\"\"\n        return self.data.dtype\n\n    @property\n    def ndim(self):\n        \"\"\"\n        integer dimensions of this object's data\n        \"\"\"\n        return self.data.ndim\n\n    @property\n    def flags(self):\n        return self._flags\n\n    @flags.setter\n    def flags(self, value):\n        if value is not None:\n            if isinstance(value, FlagCollection):\n                if value.shape != self.shape:\n                    raise ValueError(\"dimensions of FlagCollection does not match data\")\n                else:\n                    self._flags = value\n            else:\n                flags = np.array(value, copy=False)\n                if flags.shape != self.shape:\n                    raise ValueError(\"dimensions of flags do not match data\")\n                else:\n                    self._flags = flags\n        else:\n            self._flags = value\n\n    def __array__(self):\n        \"\"\"\n        This allows code that requests a Numpy array to use an NDData\n        object as a Numpy array.\n        \"\"\"\n        if self.mask is not None:\n            return np.ma.masked_array(self.data, self.mask)\n        else:\n            return np.array(self.data)\n\n    def __array_prepare__(self, array, context=None):\n        \"\"\"\n        This ensures that a masked array is returned if self is masked.\n        \"\"\"\n        if self.mask is not None:\n            return np.ma.masked_array(array, self.mask)\n        else:\n            return array\n\n    def convert_unit_to(self, unit, equivalencies=[]):\n        \"\"\"\n        Returns a new `NDData` object whose values have been converted\n        to a new unit.\n\n        Parameters\n        ----------\n        unit : `astropy.units.UnitBase` instance or str\n            The unit to convert to.\n\n        equivalencies : list of tuple\n           A list of equivalence pairs to try if the units are not\n           directly convertible.  See :ref:`astropy:unit_equivalencies`.\n\n        Returns\n        -------\n        result : `~astropy.nddata.NDData`\n            The resulting dataset\n\n        Raises\n        ------\n        `~astropy.units.UnitsError`\n            If units are inconsistent.\n\n        \"\"\"\n        if self.unit is None:\n            raise ValueError(\"No unit specified on source data\")\n        data = self.unit.to(unit, self.data, equivalencies=equivalencies)\n        if self.uncertainty is not None:\n            uncertainty_values = self.unit.to(unit, self.uncertainty.array,\n                                              equivalencies=equivalencies)\n            # should work for any uncertainty class\n            uncertainty = self.uncertainty.__class__(uncertainty_values)\n        else:\n            uncertainty = None\n        if self.mask is not None:\n            new_mask = self.mask.copy()\n        else:\n            new_mask = None\n        # Call __class__ in case we are dealing with an inherited type\n        result = self.__class__(data, uncertainty=uncertainty,\n                                mask=new_mask,\n                                wcs=self.wcs,\n                                meta=self.meta, unit=unit)\n\n        return result\n"},{"col":4,"comment":"null","endLoc":613,"header":"def evalexpr(self,tokens)","id":11789,"name":"evalexpr","nodeType":"Function","startLoc":561,"text":"def evalexpr(self,tokens):\n        # tokens = tokenize(line)\n        # Search for defined macros\n        i = 0\n        while i < len(tokens):\n            if tokens[i].type == self.t_ID and tokens[i].value == 'defined':\n                j = i + 1\n                needparen = False\n                result = \"0L\"\n                while j < len(tokens):\n                    if tokens[j].type in self.t_WS:\n                        j += 1\n                        continue\n                    elif tokens[j].type == self.t_ID:\n                        if tokens[j].value in self.macros:\n                            result = \"1L\"\n                        else:\n                            result = \"0L\"\n                        if not needparen: break\n                    elif tokens[j].value == '(':\n                        needparen = True\n                    elif tokens[j].value == ')':\n                        break\n                    else:\n                        self.error(self.source,tokens[i].lineno,\"Malformed defined()\")\n                    j += 1\n                tokens[i].type = self.t_INTEGER\n                tokens[i].value = self.t_INTEGER_TYPE(result)\n                del tokens[i+1:j+1]\n            i += 1\n        tokens = self.expand_macros(tokens)\n        for i,t in enumerate(tokens):\n            if t.type == self.t_ID:\n                tokens[i] = copy.copy(t)\n                tokens[i].type = self.t_INTEGER\n                tokens[i].value = self.t_INTEGER_TYPE(\"0L\")\n            elif t.type == self.t_INTEGER:\n                tokens[i] = copy.copy(t)\n                # Strip off any trailing suffixes\n                tokens[i].value = str(tokens[i].value)\n                while tokens[i].value[-1] not in \"0123456789abcdefABCDEF\":\n                    tokens[i].value = tokens[i].value[:-1]\n\n        expr = \"\".join([str(x.value) for x in tokens])\n        expr = expr.replace(\"&&\",\" and \")\n        expr = expr.replace(\"||\",\" or \")\n        expr = expr.replace(\"!\",\" not \")\n        try:\n            result = eval(expr)\n        except Exception:\n            self.error(self.source,tokens[0].lineno,\"Couldn't evaluate expression\")\n            result = 0\n        return result"},{"className":"NDSlicingMixin","col":0,"comment":"Mixin to provide slicing on objects using the `NDData`\n    interface.\n\n    The ``data``, ``mask``, ``uncertainty`` and ``wcs`` will be sliced, if\n    set and sliceable. The ``unit`` and ``meta`` will be untouched. The return\n    will be a reference and not a copy, if possible.\n\n    Examples\n    --------\n    Using this Mixin with `~astropy.nddata.NDData`:\n\n        >>> from astropy.nddata import NDData, NDSlicingMixin\n        >>> class NDDataSliceable(NDSlicingMixin, NDData):\n        ...     pass\n\n    Slicing an instance containing data::\n\n        >>> nd = NDDataSliceable([1,2,3,4,5])\n        >>> nd[1:3]\n        NDDataSliceable([2, 3])\n\n    Also the other attributes are sliced for example the ``mask``::\n\n        >>> import numpy as np\n        >>> mask = np.array([True, False, True, True, False])\n        >>> nd2 = NDDataSliceable(nd, mask=mask)\n        >>> nd2slc = nd2[1:3]\n        >>> nd2slc[nd2slc.mask]\n        NDDataSliceable([3])\n\n    Be aware that changing values of the sliced instance will change the values\n    of the original::\n\n        >>> nd3 = nd2[1:3]\n        >>> nd3.data[0] = 100\n        >>> nd2\n        NDDataSliceable([  1, 100,   3,   4,   5])\n\n    See also\n    --------\n    NDDataRef\n    NDDataArray\n    ","endLoc":132,"id":11790,"nodeType":"Class","startLoc":12,"text":"class NDSlicingMixin:\n    \"\"\"Mixin to provide slicing on objects using the `NDData`\n    interface.\n\n    The ``data``, ``mask``, ``uncertainty`` and ``wcs`` will be sliced, if\n    set and sliceable. The ``unit`` and ``meta`` will be untouched. The return\n    will be a reference and not a copy, if possible.\n\n    Examples\n    --------\n    Using this Mixin with `~astropy.nddata.NDData`:\n\n        >>> from astropy.nddata import NDData, NDSlicingMixin\n        >>> class NDDataSliceable(NDSlicingMixin, NDData):\n        ...     pass\n\n    Slicing an instance containing data::\n\n        >>> nd = NDDataSliceable([1,2,3,4,5])\n        >>> nd[1:3]\n        NDDataSliceable([2, 3])\n\n    Also the other attributes are sliced for example the ``mask``::\n\n        >>> import numpy as np\n        >>> mask = np.array([True, False, True, True, False])\n        >>> nd2 = NDDataSliceable(nd, mask=mask)\n        >>> nd2slc = nd2[1:3]\n        >>> nd2slc[nd2slc.mask]\n        NDDataSliceable([3])\n\n    Be aware that changing values of the sliced instance will change the values\n    of the original::\n\n        >>> nd3 = nd2[1:3]\n        >>> nd3.data[0] = 100\n        >>> nd2\n        NDDataSliceable([  1, 100,   3,   4,   5])\n\n    See also\n    --------\n    NDDataRef\n    NDDataArray\n    \"\"\"\n    def __getitem__(self, item):\n        # Abort slicing if the data is a single scalar.\n        if self.data.shape == ():\n            raise TypeError('scalars cannot be sliced.')\n\n        # Let the other methods handle slicing.\n        kwargs = self._slice(item)\n        return self.__class__(**kwargs)\n\n    def _slice(self, item):\n        \"\"\"Collects the sliced attributes and passes them back as `dict`.\n\n        It passes uncertainty, mask and wcs to their appropriate ``_slice_*``\n        method, while ``meta`` and ``unit`` are simply taken from the original.\n        The data is assumed to be sliceable and is sliced directly.\n\n        When possible the return should *not* be a copy of the data but a\n        reference.\n\n        Parameters\n        ----------\n        item : slice\n            The slice passed to ``__getitem__``.\n\n        Returns\n        -------\n        dict :\n            Containing all the attributes after slicing - ready to\n            use them to create ``self.__class__.__init__(**kwargs)`` in\n            ``__getitem__``.\n        \"\"\"\n        kwargs = {}\n        kwargs['data'] = self.data[item]\n        # Try to slice some attributes\n        kwargs['uncertainty'] = self._slice_uncertainty(item)\n        kwargs['mask'] = self._slice_mask(item)\n        kwargs['wcs'] = self._slice_wcs(item)\n        # Attributes which are copied and not intended to be sliced\n        kwargs['unit'] = self.unit\n        kwargs['meta'] = self.meta\n        return kwargs\n\n    def _slice_uncertainty(self, item):\n        if self.uncertainty is None:\n            return None\n        try:\n            return self.uncertainty[item]\n        except TypeError:\n            # Catching TypeError in case the object has no __getitem__ method.\n            # But let IndexError raise.\n            log.info(\"uncertainty cannot be sliced.\")\n        return self.uncertainty\n\n    def _slice_mask(self, item):\n        if self.mask is None:\n            return None\n        try:\n            return self.mask[item]\n        except TypeError:\n            log.info(\"mask cannot be sliced.\")\n        return self.mask\n\n    def _slice_wcs(self, item):\n        if self.wcs is None:\n            return None\n\n        try:\n            llwcs = SlicedLowLevelWCS(self.wcs.low_level_wcs, item)\n            return HighLevelWCSWrapper(llwcs)\n        except Exception as err:\n            self._handle_wcs_slicing_error(err, item)\n\n    # Implement this in a method to allow subclasses to customise the error.\n    def _handle_wcs_slicing_error(self, err, item):\n        raise ValueError(f\"Slicing the WCS object with the slice '{item}' \"\n        \"failed, if you want to slice the NDData object without the WCS, you \"\n        \"can remove by setting `NDData.wcs = None` and then retry.\") from err"},{"attributeType":"null","col":8,"comment":"null","endLoc":72,"id":11791,"name":"s","nodeType":"Attribute","startLoc":72,"text":"s"},{"attributeType":"null","col":17,"comment":"null","endLoc":64,"id":11792,"name":"doc","nodeType":"Attribute","startLoc":64,"text":"doc"},{"col":4,"comment":"null","endLoc":396,"header":"@abstractmethod\n    def _propagate_divide(self, other_uncert, result_data, correlation)","id":11793,"name":"_propagate_divide","nodeType":"Function","startLoc":394,"text":"@abstractmethod\n    def _propagate_divide(self, other_uncert, result_data, correlation):\n        return None"},{"col":4,"comment":"null","endLoc":63,"header":"def __getitem__(self, item)","id":11794,"name":"__getitem__","nodeType":"Function","startLoc":56,"text":"def __getitem__(self, item):\n        # Abort slicing if the data is a single scalar.\n        if self.data.shape == ():\n            raise TypeError('scalars cannot be sliced.')\n\n        # Let the other methods handle slicing.\n        kwargs = self._slice(item)\n        return self.__class__(**kwargs)"},{"attributeType":"null","col":12,"comment":"null","endLoc":74,"id":11795,"name":"__doc__","nodeType":"Attribute","startLoc":74,"text":"s.__doc__"},{"attributeType":"null","col":8,"comment":"null","endLoc":213,"id":11796,"name":"_parent_nddata","nodeType":"Attribute","startLoc":213,"text":"self._parent_nddata"},{"attributeType":"null","col":12,"comment":"null","endLoc":91,"id":11797,"name":"_unit","nodeType":"Attribute","startLoc":91,"text":"self._unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":128,"id":11798,"name":"_array","nodeType":"Attribute","startLoc":128,"text":"self._array"},{"col":4,"comment":"\n        Recursively restore default values to all members\n        that have them.\n\n        This method will only work for a ConfigObj that was created\n        with a configspec and has been validated.\n\n        It doesn't delete or modify entries without default values.\n        ","endLoc":1066,"header":"def restore_defaults(self)","id":11799,"name":"restore_defaults","nodeType":"Function","startLoc":1052,"text":"def restore_defaults(self):\n        \"\"\"\n        Recursively restore default values to all members\n        that have them.\n\n        This method will only work for a ConfigObj that was created\n        with a configspec and has been validated.\n\n        It doesn't delete or modify entries without default values.\n        \"\"\"\n        for key in self.default_values:\n            self.restore_default(key)\n\n        for section in self.sections:\n            self[section].restore_defaults()"},{"col":4,"comment":"Collects the sliced attributes and passes them back as `dict`.\n\n        It passes uncertainty, mask and wcs to their appropriate ``_slice_*``\n        method, while ``meta`` and ``unit`` are simply taken from the original.\n        The data is assumed to be sliceable and is sliced directly.\n\n        When possible the return should *not* be a copy of the data but a\n        reference.\n\n        Parameters\n        ----------\n        item : slice\n            The slice passed to ``__getitem__``.\n\n        Returns\n        -------\n        dict :\n            Containing all the attributes after slicing - ready to\n            use them to create ``self.__class__.__init__(**kwargs)`` in\n            ``__getitem__``.\n        ","endLoc":96,"header":"def _slice(self, item)","id":11800,"name":"_slice","nodeType":"Function","startLoc":65,"text":"def _slice(self, item):\n        \"\"\"Collects the sliced attributes and passes them back as `dict`.\n\n        It passes uncertainty, mask and wcs to their appropriate ``_slice_*``\n        method, while ``meta`` and ``unit`` are simply taken from the original.\n        The data is assumed to be sliceable and is sliced directly.\n\n        When possible the return should *not* be a copy of the data but a\n        reference.\n\n        Parameters\n        ----------\n        item : slice\n            The slice passed to ``__getitem__``.\n\n        Returns\n        -------\n        dict :\n            Containing all the attributes after slicing - ready to\n            use them to create ``self.__class__.__init__(**kwargs)`` in\n            ``__getitem__``.\n        \"\"\"\n        kwargs = {}\n        kwargs['data'] = self.data[item]\n        # Try to slice some attributes\n        kwargs['uncertainty'] = self._slice_uncertainty(item)\n        kwargs['mask'] = self._slice_mask(item)\n        kwargs['wcs'] = self._slice_wcs(item)\n        # Attributes which are copied and not intended to be sliced\n        kwargs['unit'] = self.unit\n        kwargs['meta'] = self.meta\n        return kwargs"},{"attributeType":"null","col":8,"comment":"null","endLoc":392,"id":11801,"name":"symstack","nodeType":"Attribute","startLoc":392,"text":"self.symstack"},{"attributeType":"null","col":8,"comment":"null","endLoc":290,"id":11802,"name":"action","nodeType":"Attribute","startLoc":290,"text":"self.action"},{"attributeType":"null","col":8,"comment":"null","endLoc":289,"id":11803,"name":"productions","nodeType":"Attribute","startLoc":289,"text":"self.productions"},{"attributeType":"null","col":28,"comment":"null","endLoc":502,"id":11804,"name":"state","nodeType":"Attribute","startLoc":502,"text":"self.state"},{"className":"BitFlagNameMeta","col":0,"comment":"null","endLoc":189,"id":11805,"nodeType":"Class","startLoc":78,"text":"class BitFlagNameMeta(type):\n    def __new__(mcls, name, bases, members):\n        for k, v in members.items():\n            if not k.startswith('_'):\n                v = BitFlag(v)\n\n        attr = [k for k in members.keys() if not k.startswith('_')]\n        attrl = list(map(str.lower, attr))\n\n        if _ENABLE_BITFLAG_CACHING:\n            cache = OrderedDict()\n\n        for b in bases:\n            for k, v in b.__dict__.items():\n                if k.startswith('_'):\n                    continue\n                kl = k.lower()\n                if kl in attrl:\n                    idx = attrl.index(kl)\n                    raise AttributeError(\"Bit flag '{:s}' was already defined.\"\n                                         .format(attr[idx]))\n                if _ENABLE_BITFLAG_CACHING:\n                    cache[kl] = v\n\n        members = {k: v if k.startswith('_') else BitFlag(v)\n                   for k, v in members.items()}\n\n        if _ENABLE_BITFLAG_CACHING:\n            cache.update({k.lower(): v for k, v in members.items()\n                          if not k.startswith('_')})\n            members = {'_locked': True, '__version__': '', **members,\n                       '_cache': cache}\n        else:\n            members = {'_locked': True, '__version__': '', **members}\n\n        return super().__new__(mcls, name, bases, members)\n\n    def __setattr__(cls, name, val):\n        if name == '_locked':\n            return super().__setattr__(name, True)\n\n        else:\n            if name == '__version__':\n                if cls._locked:\n                    raise AttributeError(\"Version cannot be modified.\")\n                return super().__setattr__(name, val)\n\n            err_msg = f\"Bit flags are read-only. Unable to reassign attribute {name}\"\n            if cls._locked:\n                raise AttributeError(err_msg)\n\n        namel = name.lower()\n        if _ENABLE_BITFLAG_CACHING:\n            if not namel.startswith('_') and namel in cls._cache:\n                raise AttributeError(err_msg)\n\n        else:\n            for b in cls.__bases__:\n                if not namel.startswith('_') and namel in list(map(str.lower, b.__dict__)):\n                    raise AttributeError(err_msg)\n            if namel in list(map(str.lower, cls.__dict__)):\n                raise AttributeError(err_msg)\n\n        val = BitFlag(val)\n\n        if _ENABLE_BITFLAG_CACHING and not namel.startswith('_'):\n            cls._cache[namel] = val\n\n        return super().__setattr__(name, val)\n\n    def __getattr__(cls, name):\n        if _ENABLE_BITFLAG_CACHING:\n            flagnames = cls._cache\n        else:\n            flagnames = {k.lower(): v for k, v in cls.__dict__.items()}\n            flagnames.update({k.lower(): v for b in cls.__bases__\n                              for k, v in b.__dict__.items()})\n        try:\n            return flagnames[name.lower()]\n        except KeyError:\n            raise AttributeError(f\"Flag '{name}' not defined\")\n\n    def __getitem__(cls, key):\n        return cls.__getattr__(key)\n\n    def __add__(cls, items):\n        if not isinstance(items, dict):\n            if not isinstance(items[0], (tuple, list)):\n                items = [items]\n            items = dict(items)\n\n        return extend_bit_flag_map(\n            cls.__name__ + '_' + '_'.join([k for k in items]),\n            cls,\n            **items\n        )\n\n    def __iadd__(cls, other):\n        raise NotImplementedError(\n            \"Unary '+' is not supported. Use binary operator instead.\"\n        )\n\n    def __delattr__(cls, name):\n        raise AttributeError(\"{:s}: cannot delete {:s} member.\"\n                             .format(cls.__name__, cls.mro()[-2].__name__))\n\n    def __delitem__(cls, name):\n        raise AttributeError(\"{:s}: cannot delete {:s} member.\"\n                             .format(cls.__name__, cls.mro()[-2].__name__))\n\n    def __repr__(cls):\n        return f\"<{cls.mro()[-2].__name__:s} '{cls.__name__:s}'>\""},{"col":4,"comment":"null","endLoc":113,"header":"def __new__(mcls, name, bases, members)","id":11806,"name":"__new__","nodeType":"Function","startLoc":79,"text":"def __new__(mcls, name, bases, members):\n        for k, v in members.items():\n            if not k.startswith('_'):\n                v = BitFlag(v)\n\n        attr = [k for k in members.keys() if not k.startswith('_')]\n        attrl = list(map(str.lower, attr))\n\n        if _ENABLE_BITFLAG_CACHING:\n            cache = OrderedDict()\n\n        for b in bases:\n            for k, v in b.__dict__.items():\n                if k.startswith('_'):\n                    continue\n                kl = k.lower()\n                if kl in attrl:\n                    idx = attrl.index(kl)\n                    raise AttributeError(\"Bit flag '{:s}' was already defined.\"\n                                         .format(attr[idx]))\n                if _ENABLE_BITFLAG_CACHING:\n                    cache[kl] = v\n\n        members = {k: v if k.startswith('_') else BitFlag(v)\n                   for k, v in members.items()}\n\n        if _ENABLE_BITFLAG_CACHING:\n            cache.update({k.lower(): v for k, v in members.items()\n                          if not k.startswith('_')})\n            members = {'_locked': True, '__version__': '', **members,\n                       '_cache': cache}\n        else:\n            members = {'_locked': True, '__version__': '', **members}\n\n        return super().__new__(mcls, name, bases, members)"},{"attributeType":"null","col":20,"comment":"null","endLoc":220,"id":11807,"name":"unit","nodeType":"Attribute","startLoc":220,"text":"self.unit"},{"col":4,"comment":"null","endLoc":107,"header":"def _slice_uncertainty(self, item)","id":11808,"name":"_slice_uncertainty","nodeType":"Function","startLoc":98,"text":"def _slice_uncertainty(self, item):\n        if self.uncertainty is None:\n            return None\n        try:\n            return self.uncertainty[item]\n        except TypeError:\n            # Catching TypeError in case the object has no __getitem__ method.\n            # But let IndexError raise.\n            log.info(\"uncertainty cannot be sliced.\")\n        return self.uncertainty"},{"attributeType":"null","col":8,"comment":"null","endLoc":97,"id":11809,"name":"array","nodeType":"Attribute","startLoc":97,"text":"self.array"},{"col":4,"comment":"null","endLoc":116,"header":"def _slice_mask(self, item)","id":11810,"name":"_slice_mask","nodeType":"Function","startLoc":109,"text":"def _slice_mask(self, item):\n        if self.mask is None:\n            return None\n        try:\n            return self.mask[item]\n        except TypeError:\n            log.info(\"mask cannot be sliced.\")\n        return self.mask"},{"attributeType":"null","col":8,"comment":"null","endLoc":98,"id":11811,"name":"parent_nddata","nodeType":"Attribute","startLoc":98,"text":"self.parent_nddata"},{"className":"UnknownUncertainty","col":0,"comment":"This class implements any unknown uncertainty type.\n\n    The main purpose of having an unknown uncertainty class is to prevent\n    uncertainty propagation.\n\n    Parameters\n    ----------\n    args, kwargs :\n        see `NDUncertainty`\n    ","endLoc":449,"id":11812,"nodeType":"Class","startLoc":399,"text":"class UnknownUncertainty(NDUncertainty):\n    \"\"\"This class implements any unknown uncertainty type.\n\n    The main purpose of having an unknown uncertainty class is to prevent\n    uncertainty propagation.\n\n    Parameters\n    ----------\n    args, kwargs :\n        see `NDUncertainty`\n    \"\"\"\n\n    @property\n    def supports_correlated(self):\n        \"\"\"`False` : Uncertainty propagation is *not* possible for this class.\n        \"\"\"\n        return False\n\n    @property\n    def uncertainty_type(self):\n        \"\"\"``\"unknown\"`` : `UnknownUncertainty` implements any unknown \\\n                           uncertainty type.\n        \"\"\"\n        return 'unknown'\n\n    def _data_unit_to_uncertainty_unit(self, value):\n        \"\"\"\n        No way to convert if uncertainty is unknown.\n        \"\"\"\n        return None\n\n    def _convert_uncertainty(self, other_uncert):\n        \"\"\"Raise an Exception because unknown uncertainty types cannot\n        implement propagation.\n        \"\"\"\n        msg = \"Uncertainties of unknown type cannot be propagated.\"\n        raise IncompatibleUncertaintiesException(msg)\n\n    def _propagate_add(self, other_uncert, result_data, correlation):\n        \"\"\"Not possible for unknown uncertainty types.\n        \"\"\"\n        return None\n\n    def _propagate_subtract(self, other_uncert, result_data, correlation):\n        return None\n\n    def _propagate_multiply(self, other_uncert, result_data, correlation):\n        return None\n\n    def _propagate_divide(self, other_uncert, result_data, correlation):\n        return None"},{"col":4,"comment":"`False` : Uncertainty propagation is *not* possible for this class.\n        ","endLoc":415,"header":"@property\n    def supports_correlated(self)","id":11813,"name":"supports_correlated","nodeType":"Function","startLoc":411,"text":"@property\n    def supports_correlated(self):\n        \"\"\"`False` : Uncertainty propagation is *not* possible for this class.\n        \"\"\"\n        return False"},{"col":4,"comment":"``\"unknown\"`` : `UnknownUncertainty` implements any unknown \n                           uncertainty type.\n        ","endLoc":422,"header":"@property\n    def uncertainty_type(self)","id":11814,"name":"uncertainty_type","nodeType":"Function","startLoc":417,"text":"@property\n    def uncertainty_type(self):\n        \"\"\"``\"unknown\"`` : `UnknownUncertainty` implements any unknown \\\n                           uncertainty type.\n        \"\"\"\n        return 'unknown'"},{"col":4,"comment":"\n        No way to convert if uncertainty is unknown.\n        ","endLoc":428,"header":"def _data_unit_to_uncertainty_unit(self, value)","id":11815,"name":"_data_unit_to_uncertainty_unit","nodeType":"Function","startLoc":424,"text":"def _data_unit_to_uncertainty_unit(self, value):\n        \"\"\"\n        No way to convert if uncertainty is unknown.\n        \"\"\"\n        return None"},{"col":4,"comment":"Raise an Exception because unknown uncertainty types cannot\n        implement propagation.\n        ","endLoc":435,"header":"def _convert_uncertainty(self, other_uncert)","id":11816,"name":"_convert_uncertainty","nodeType":"Function","startLoc":430,"text":"def _convert_uncertainty(self, other_uncert):\n        \"\"\"Raise an Exception because unknown uncertainty types cannot\n        implement propagation.\n        \"\"\"\n        msg = \"Uncertainties of unknown type cannot be propagated.\"\n        raise IncompatibleUncertaintiesException(msg)"},{"col":4,"comment":"null","endLoc":126,"header":"def _slice_wcs(self, item)","id":11817,"name":"_slice_wcs","nodeType":"Function","startLoc":118,"text":"def _slice_wcs(self, item):\n        if self.wcs is None:\n            return None\n\n        try:\n            llwcs = SlicedLowLevelWCS(self.wcs.low_level_wcs, item)\n            return HighLevelWCSWrapper(llwcs)\n        except Exception as err:\n            self._handle_wcs_slicing_error(err, item)"},{"col":4,"comment":"Not possible for unknown uncertainty types.\n        ","endLoc":440,"header":"def _propagate_add(self, other_uncert, result_data, correlation)","id":11818,"name":"_propagate_add","nodeType":"Function","startLoc":437,"text":"def _propagate_add(self, other_uncert, result_data, correlation):\n        \"\"\"Not possible for unknown uncertainty types.\n        \"\"\"\n        return None"},{"col":4,"comment":"null","endLoc":443,"header":"def _propagate_subtract(self, other_uncert, result_data, correlation)","id":11819,"name":"_propagate_subtract","nodeType":"Function","startLoc":442,"text":"def _propagate_subtract(self, other_uncert, result_data, correlation):\n        return None"},{"col":4,"comment":"null","endLoc":446,"header":"def _propagate_multiply(self, other_uncert, result_data, correlation)","id":11820,"name":"_propagate_multiply","nodeType":"Function","startLoc":445,"text":"def _propagate_multiply(self, other_uncert, result_data, correlation):\n        return None"},{"col":4,"comment":"null","endLoc":449,"header":"def _propagate_divide(self, other_uncert, result_data, correlation)","id":11821,"name":"_propagate_divide","nodeType":"Function","startLoc":448,"text":"def _propagate_divide(self, other_uncert, result_data, correlation):\n        return None"},{"attributeType":"function","col":4,"comment":"null","endLoc":731,"id":11822,"name":"__iter__","nodeType":"Attribute","startLoc":731,"text":"__iter__"},{"attributeType":"function","col":4,"comment":"null","endLoc":749,"id":11823,"name":"__str__","nodeType":"Attribute","startLoc":749,"text":"__str__"},{"attributeType":"null","col":4,"comment":"null","endLoc":750,"id":11824,"name":"__doc__","nodeType":"Attribute","startLoc":750,"text":"__str__.__doc__"},{"attributeType":"null","col":8,"comment":"null","endLoc":495,"id":11825,"name":"parent","nodeType":"Attribute","startLoc":495,"text":"self.parent"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":11826,"name":"__all__","nodeType":"Attribute","startLoc":16,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":11827,"name":"_meta_doc","nodeType":"Attribute","startLoc":18,"text":"_meta_doc"},{"attributeType":"null","col":8,"comment":"null","endLoc":512,"id":11828,"name":"scalars","nodeType":"Attribute","startLoc":512,"text":"self.scalars"},{"attributeType":"null","col":8,"comment":"null","endLoc":516,"id":11829,"name":"comments","nodeType":"Attribute","startLoc":516,"text":"self.comments"},{"col":4,"comment":"null","endLoc":132,"header":"def _handle_wcs_slicing_error(self, err, item)","id":11830,"name":"_handle_wcs_slicing_error","nodeType":"Function","startLoc":129,"text":"def _handle_wcs_slicing_error(self, err, item):\n        raise ValueError(f\"Slicing the WCS object with the slice '{item}' \"\n        \"failed, if you want to slice the NDData object without the WCS, you \"\n        \"can remove by setting `NDData.wcs = None` and then retry.\") from err"},{"col":0,"comment":"","endLoc":5,"header":"nddata.py#<anonymous>","id":11831,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"__all__ = ['NDData']\n\n_meta_doc = \"\"\"`dict`-like : Additional meta information about the dataset.\"\"\""},{"attributeType":"None","col":8,"comment":"null","endLoc":519,"id":11832,"name":"configspec","nodeType":"Attribute","startLoc":519,"text":"self.configspec"},{"className":"NDArithmeticMixin","col":0,"comment":"\n    Mixin class to add arithmetic to an NDData object.\n\n    When subclassing, be sure to list the superclasses in the correct order\n    so that the subclass sees NDData as the main superclass. See\n    `~astropy.nddata.NDDataArray` for an example.\n\n    Notes\n    -----\n    This class only aims at covering the most common cases so there are certain\n    restrictions on the saved attributes::\n\n        - ``uncertainty`` : has to be something that has a `NDUncertainty`-like\n          interface for uncertainty propagation\n        - ``mask`` : has to be something that can be used by a bitwise ``or``\n          operation.\n        - ``wcs`` : has to implement a way of comparing with ``=`` to allow\n          the operation.\n\n    But there is a workaround that allows to disable handling a specific\n    attribute and to simply set the results attribute to ``None`` or to\n    copy the existing attribute (and neglecting the other).\n    For example for uncertainties not representing an `NDUncertainty`-like\n    interface you can alter the ``propagate_uncertainties`` parameter in\n    :meth:`NDArithmeticMixin.add`. ``None`` means that the result will have no\n    uncertainty, ``False`` means it takes the uncertainty of the first operand\n    (if this does not exist from the second operand) as the result's\n    uncertainty. This behavior is also explained in the docstring for the\n    different arithmetic operations.\n\n    Decomposing the units is not attempted, mainly due to the internal mechanics\n    of `~astropy.units.Quantity`, so the resulting data might have units like\n    ``km/m`` if you divided for example 100km by 5m. So this Mixin has adopted\n    this behavior.\n\n    Examples\n    --------\n    Using this Mixin with `~astropy.nddata.NDData`:\n\n        >>> from astropy.nddata import NDData, NDArithmeticMixin\n        >>> class NDDataWithMath(NDArithmeticMixin, NDData):\n        ...     pass\n\n    Using it with one operand on an instance::\n\n        >>> ndd = NDDataWithMath(100)\n        >>> ndd.add(20)\n        NDDataWithMath(120)\n\n    Using it with two operand on an instance::\n\n        >>> ndd = NDDataWithMath(-4)\n        >>> ndd.divide(1, ndd)\n        NDDataWithMath(-0.25)\n\n    Using it as classmethod requires two operands::\n\n        >>> NDDataWithMath.subtract(5, 4)\n        NDDataWithMath(1)\n\n    ","endLoc":616,"id":11833,"nodeType":"Class","startLoc":101,"text":"class NDArithmeticMixin:\n    \"\"\"\n    Mixin class to add arithmetic to an NDData object.\n\n    When subclassing, be sure to list the superclasses in the correct order\n    so that the subclass sees NDData as the main superclass. See\n    `~astropy.nddata.NDDataArray` for an example.\n\n    Notes\n    -----\n    This class only aims at covering the most common cases so there are certain\n    restrictions on the saved attributes::\n\n        - ``uncertainty`` : has to be something that has a `NDUncertainty`-like\n          interface for uncertainty propagation\n        - ``mask`` : has to be something that can be used by a bitwise ``or``\n          operation.\n        - ``wcs`` : has to implement a way of comparing with ``=`` to allow\n          the operation.\n\n    But there is a workaround that allows to disable handling a specific\n    attribute and to simply set the results attribute to ``None`` or to\n    copy the existing attribute (and neglecting the other).\n    For example for uncertainties not representing an `NDUncertainty`-like\n    interface you can alter the ``propagate_uncertainties`` parameter in\n    :meth:`NDArithmeticMixin.add`. ``None`` means that the result will have no\n    uncertainty, ``False`` means it takes the uncertainty of the first operand\n    (if this does not exist from the second operand) as the result's\n    uncertainty. This behavior is also explained in the docstring for the\n    different arithmetic operations.\n\n    Decomposing the units is not attempted, mainly due to the internal mechanics\n    of `~astropy.units.Quantity`, so the resulting data might have units like\n    ``km/m`` if you divided for example 100km by 5m. So this Mixin has adopted\n    this behavior.\n\n    Examples\n    --------\n    Using this Mixin with `~astropy.nddata.NDData`:\n\n        >>> from astropy.nddata import NDData, NDArithmeticMixin\n        >>> class NDDataWithMath(NDArithmeticMixin, NDData):\n        ...     pass\n\n    Using it with one operand on an instance::\n\n        >>> ndd = NDDataWithMath(100)\n        >>> ndd.add(20)\n        NDDataWithMath(120)\n\n    Using it with two operand on an instance::\n\n        >>> ndd = NDDataWithMath(-4)\n        >>> ndd.divide(1, ndd)\n        NDDataWithMath(-0.25)\n\n    Using it as classmethod requires two operands::\n\n        >>> NDDataWithMath.subtract(5, 4)\n        NDDataWithMath(1)\n\n    \"\"\"\n\n    def _arithmetic(self, operation, operand,\n                    propagate_uncertainties=True, handle_mask=np.logical_or,\n                    handle_meta=None, uncertainty_correlation=0,\n                    compare_wcs='first_found', **kwds):\n        \"\"\"\n        Base method which calculates the result of the arithmetic operation.\n\n        This method determines the result of the arithmetic operation on the\n        ``data`` including their units and then forwards to other methods\n        to calculate the other properties for the result (like uncertainty).\n\n        Parameters\n        ----------\n        operation : callable\n            The operation that is performed on the `NDData`. Supported are\n            `numpy.add`, `numpy.subtract`, `numpy.multiply` and\n            `numpy.true_divide`.\n\n        operand : same type (class) as self\n            see :meth:`NDArithmeticMixin.add`\n\n        propagate_uncertainties : `bool` or ``None``, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        handle_mask : callable, ``'first_found'`` or ``None``, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        handle_meta : callable, ``'first_found'`` or ``None``, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        compare_wcs : callable, ``'first_found'`` or ``None``, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        uncertainty_correlation : ``Number`` or `~numpy.ndarray`, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        kwargs :\n            Any other parameter that should be passed to the\n            different :meth:`NDArithmeticMixin._arithmetic_mask` (or wcs, ...)\n            methods.\n\n        Returns\n        -------\n        result : ndarray or `~astropy.units.Quantity`\n            The resulting data as array (in case both operands were without\n            unit) or as quantity if at least one had a unit.\n\n        kwargs : `dict`\n            The kwargs should contain all the other attributes (besides data\n            and unit) needed to create a new instance for the result. Creating\n            the new instance is up to the calling method, for example\n            :meth:`NDArithmeticMixin.add`.\n\n        \"\"\"\n        # Find the appropriate keywords for the appropriate method (not sure\n        # if data and uncertainty are ever used ...)\n        kwds2 = {'mask': {}, 'meta': {}, 'wcs': {},\n                 'data': {}, 'uncertainty': {}}\n        for i in kwds:\n            splitted = i.split('_', 1)\n            try:\n                kwds2[splitted[0]][splitted[1]] = kwds[i]\n            except KeyError:\n                raise KeyError(f'Unknown prefix {splitted[0]} for parameter {i}')\n\n        kwargs = {}\n\n        # First check that the WCS allows the arithmetic operation\n        if compare_wcs is None:\n            kwargs['wcs'] = None\n        elif compare_wcs in ['ff', 'first_found']:\n            if self.wcs is None:\n                kwargs['wcs'] = deepcopy(operand.wcs)\n            else:\n                kwargs['wcs'] = deepcopy(self.wcs)\n        else:\n            kwargs['wcs'] = self._arithmetic_wcs(operation, operand,\n                                                 compare_wcs, **kwds2['wcs'])\n\n        # Then calculate the resulting data (which can but not needs to be a\n        # quantity)\n        result = self._arithmetic_data(operation, operand, **kwds2['data'])\n\n        # Determine the other properties\n        if propagate_uncertainties is None:\n            kwargs['uncertainty'] = None\n        elif not propagate_uncertainties:\n            if self.uncertainty is None:\n                kwargs['uncertainty'] = deepcopy(operand.uncertainty)\n            else:\n                kwargs['uncertainty'] = deepcopy(self.uncertainty)\n        else:\n            kwargs['uncertainty'] = self._arithmetic_uncertainty(\n                operation, operand, result, uncertainty_correlation,\n                **kwds2['uncertainty'])\n\n        if handle_mask is None:\n            kwargs['mask'] = None\n        elif handle_mask in ['ff', 'first_found']:\n            if self.mask is None:\n                kwargs['mask'] = deepcopy(operand.mask)\n            else:\n                kwargs['mask'] = deepcopy(self.mask)\n        else:\n            kwargs['mask'] = self._arithmetic_mask(operation, operand,\n                                                   handle_mask,\n                                                   **kwds2['mask'])\n\n        if handle_meta is None:\n            kwargs['meta'] = None\n        elif handle_meta in ['ff', 'first_found']:\n            if not self.meta:\n                kwargs['meta'] = deepcopy(operand.meta)\n            else:\n                kwargs['meta'] = deepcopy(self.meta)\n        else:\n            kwargs['meta'] = self._arithmetic_meta(\n                operation, operand, handle_meta, **kwds2['meta'])\n\n        # Wrap the individual results into a new instance of the same class.\n        return result, kwargs\n\n    def _arithmetic_data(self, operation, operand, **kwds):\n        \"\"\"\n        Calculate the resulting data\n\n        Parameters\n        ----------\n        operation : callable\n            see `NDArithmeticMixin._arithmetic` parameter description.\n\n        operand : `NDData`-like instance\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        kwds :\n            Additional parameters.\n\n        Returns\n        -------\n        result_data : ndarray or `~astropy.units.Quantity`\n            If both operands had no unit the resulting data is a simple numpy\n            array, but if any of the operands had a unit the return is a\n            Quantity.\n        \"\"\"\n\n        # Do the calculation with or without units\n        if self.unit is None and operand.unit is None:\n            result = operation(self.data, operand.data)\n        elif self.unit is None:\n            result = operation(self.data << dimensionless_unscaled,\n                               operand.data << operand.unit)\n        elif operand.unit is None:\n            result = operation(self.data << self.unit,\n                               operand.data << dimensionless_unscaled)\n        else:\n            result = operation(self.data << self.unit,\n                               operand.data << operand.unit)\n\n        return result\n\n    def _arithmetic_uncertainty(self, operation, operand, result, correlation,\n                                **kwds):\n        \"\"\"\n        Calculate the resulting uncertainty.\n\n        Parameters\n        ----------\n        operation : callable\n            see :meth:`NDArithmeticMixin._arithmetic` parameter description.\n\n        operand : `NDData`-like instance\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        result : `~astropy.units.Quantity` or `~numpy.ndarray`\n            The result of :meth:`NDArithmeticMixin._arithmetic_data`.\n\n        correlation : number or `~numpy.ndarray`\n            see :meth:`NDArithmeticMixin.add` parameter description.\n\n        kwds :\n            Additional parameters.\n\n        Returns\n        -------\n        result_uncertainty : `NDUncertainty` subclass instance or None\n            The resulting uncertainty already saved in the same `NDUncertainty`\n            subclass that ``self`` had (or ``operand`` if self had no\n            uncertainty). ``None`` only if both had no uncertainty.\n        \"\"\"\n\n        # Make sure these uncertainties are NDUncertainties so this kind of\n        # propagation is possible.\n        if (self.uncertainty is not None and\n                not isinstance(self.uncertainty, NDUncertainty)):\n            raise TypeError(\"Uncertainty propagation is only defined for \"\n                            \"subclasses of NDUncertainty.\")\n        if (operand.uncertainty is not None and\n                not isinstance(operand.uncertainty, NDUncertainty)):\n            raise TypeError(\"Uncertainty propagation is only defined for \"\n                            \"subclasses of NDUncertainty.\")\n\n        # Now do the uncertainty propagation\n        # TODO: There is no enforced requirement that actually forbids the\n        # uncertainty to have negative entries but with correlation the\n        # sign of the uncertainty DOES matter.\n        if self.uncertainty is None and operand.uncertainty is None:\n            # Neither has uncertainties so the result should have none.\n            return None\n        elif self.uncertainty is None:\n            # Create a temporary uncertainty to allow uncertainty propagation\n            # to yield the correct results. (issue #4152)\n            self.uncertainty = operand.uncertainty.__class__(None)\n            result_uncert = self.uncertainty.propagate(operation, operand,\n                                                       result, correlation)\n            # Delete the temporary uncertainty again.\n            self.uncertainty = None\n            return result_uncert\n\n        elif operand.uncertainty is None:\n            # As with self.uncertainty is None but the other way around.\n            operand.uncertainty = self.uncertainty.__class__(None)\n            result_uncert = self.uncertainty.propagate(operation, operand,\n                                                       result, correlation)\n            operand.uncertainty = None\n            return result_uncert\n\n        else:\n            # Both have uncertainties so just propagate.\n            return self.uncertainty.propagate(operation, operand, result,\n                                              correlation)\n\n    def _arithmetic_mask(self, operation, operand, handle_mask, **kwds):\n        \"\"\"\n        Calculate the resulting mask\n\n        This is implemented as the piecewise ``or`` operation if both have a\n        mask.\n\n        Parameters\n        ----------\n        operation : callable\n            see :meth:`NDArithmeticMixin._arithmetic` parameter description.\n            By default, the ``operation`` will be ignored.\n\n        operand : `NDData`-like instance\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        handle_mask : callable\n            see :meth:`NDArithmeticMixin.add`\n\n        kwds :\n            Additional parameters given to ``handle_mask``.\n\n        Returns\n        -------\n        result_mask : any type\n            If only one mask was present this mask is returned.\n            If neither had a mask ``None`` is returned. Otherwise\n            ``handle_mask`` must create (and copy) the returned mask.\n        \"\"\"\n\n        # If only one mask is present we need not bother about any type checks\n        if self.mask is None and operand.mask is None:\n            return None\n        elif self.mask is None:\n            # Make a copy so there is no reference in the result.\n            return deepcopy(operand.mask)\n        elif operand.mask is None:\n            return deepcopy(self.mask)\n        else:\n            # Now lets calculate the resulting mask (operation enforces copy)\n            return handle_mask(self.mask, operand.mask, **kwds)\n\n    def _arithmetic_wcs(self, operation, operand, compare_wcs, **kwds):\n        \"\"\"\n        Calculate the resulting wcs.\n\n        There is actually no calculation involved but it is a good place to\n        compare wcs information of both operands. This is currently not working\n        properly with `~astropy.wcs.WCS` (which is the suggested class for\n        storing as wcs property) but it will not break it neither.\n\n        Parameters\n        ----------\n        operation : callable\n            see :meth:`NDArithmeticMixin._arithmetic` parameter description.\n            By default, the ``operation`` will be ignored.\n\n        operand : `NDData` instance or subclass\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        compare_wcs : callable\n            see :meth:`NDArithmeticMixin.add` parameter description.\n\n        kwds :\n            Additional parameters given to ``compare_wcs``.\n\n        Raises\n        ------\n        ValueError\n            If ``compare_wcs`` returns ``False``.\n\n        Returns\n        -------\n        result_wcs : any type\n            The ``wcs`` of the first operand is returned.\n        \"\"\"\n\n        # ok, not really arithmetics but we need to check which wcs makes sense\n        # for the result and this is an ideal place to compare the two WCS,\n        # too.\n\n        # I'll assume that the comparison returned None or False in case they\n        # are not equal.\n        if not compare_wcs(self.wcs, operand.wcs, **kwds):\n            raise ValueError(\"WCS are not equal.\")\n\n        return deepcopy(self.wcs)\n\n    def _arithmetic_meta(self, operation, operand, handle_meta, **kwds):\n        \"\"\"\n        Calculate the resulting meta.\n\n        Parameters\n        ----------\n        operation : callable\n            see :meth:`NDArithmeticMixin._arithmetic` parameter description.\n            By default, the ``operation`` will be ignored.\n\n        operand : `NDData`-like instance\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        handle_meta : callable\n            see :meth:`NDArithmeticMixin.add`\n\n        kwds :\n            Additional parameters given to ``handle_meta``.\n\n        Returns\n        -------\n        result_meta : any type\n            The result of ``handle_meta``.\n        \"\"\"\n        # Just return what handle_meta does with both of the metas.\n        return handle_meta(self.meta, operand.meta, **kwds)\n\n    @sharedmethod\n    @format_doc(_arit_doc, name='addition', op='+')\n    def add(self, operand, operand2=None, **kwargs):\n        return self._prepare_then_do_arithmetic(np.add, operand, operand2,\n                                                **kwargs)\n\n    @sharedmethod\n    @format_doc(_arit_doc, name='subtraction', op='-')\n    def subtract(self, operand, operand2=None, **kwargs):\n        return self._prepare_then_do_arithmetic(np.subtract, operand, operand2,\n                                                **kwargs)\n\n    @sharedmethod\n    @format_doc(_arit_doc, name=\"multiplication\", op=\"*\")\n    def multiply(self, operand, operand2=None, **kwargs):\n        return self._prepare_then_do_arithmetic(np.multiply, operand, operand2,\n                                                **kwargs)\n\n    @sharedmethod\n    @format_doc(_arit_doc, name=\"division\", op=\"/\")\n    def divide(self, operand, operand2=None, **kwargs):\n        return self._prepare_then_do_arithmetic(np.true_divide, operand,\n                                                operand2, **kwargs)\n\n    @sharedmethod\n    def _prepare_then_do_arithmetic(self_or_cls, operation, operand, operand2,\n                                    **kwargs):\n        \"\"\"Intermediate method called by public arithmetics (i.e. ``add``)\n        before the processing method (``_arithmetic``) is invoked.\n\n        .. warning::\n            Do not override this method in subclasses.\n\n        This method checks if it was called as instance or as class method and\n        then wraps the operands and the result from ``_arithmetics`` in the\n        appropriate subclass.\n\n        Parameters\n        ----------\n        self_or_cls : instance or class\n            ``sharedmethod`` behaves like a normal method if called on the\n            instance (then this parameter is ``self``) but like a classmethod\n            when called on the class (then this parameter is ``cls``).\n\n        operations : callable\n            The operation (normally a numpy-ufunc) that represents the\n            appropriate action.\n\n        operand, operand2, kwargs :\n            See for example ``add``.\n\n        Result\n        ------\n        result : `~astropy.nddata.NDData`-like\n            Depending how this method was called either ``self_or_cls``\n            (called on class) or ``self_or_cls.__class__`` (called on instance)\n            is the NDData-subclass that is used as wrapper for the result.\n        \"\"\"\n        # DO NOT OVERRIDE THIS METHOD IN SUBCLASSES.\n\n        if isinstance(self_or_cls, NDArithmeticMixin):\n            # True means it was called on the instance, so self_or_cls is\n            # a reference to self\n            cls = self_or_cls.__class__\n\n            if operand2 is None:\n                # Only one operand was given. Set operand2 to operand and\n                # operand to self so that we call the appropriate method of the\n                # operand.\n                operand2 = operand\n                operand = self_or_cls\n            else:\n                # Convert the first operand to the class of this method.\n                # This is important so that always the correct _arithmetics is\n                # called later that method.\n                operand = cls(operand)\n\n        else:\n            # It was used as classmethod so self_or_cls represents the cls\n            cls = self_or_cls\n\n            # It was called on the class so we expect two operands!\n            if operand2 is None:\n                raise TypeError(\"operand2 must be given when the method isn't \"\n                                \"called on an instance.\")\n\n            # Convert to this class. See above comment why.\n            operand = cls(operand)\n\n        # At this point operand, operand2, kwargs and cls are determined.\n\n        # Let's try to convert operand2 to the class of operand to allows for\n        # arithmetic operations with numbers, lists, numpy arrays, numpy masked\n        # arrays, astropy quantities, masked quantities and of other subclasses\n        # of NDData.\n        operand2 = cls(operand2)\n\n        # Now call the _arithmetics method to do the arithmetics.\n        result, init_kwds = operand._arithmetic(operation, operand2, **kwargs)\n\n        # Return a new class based on the result\n        return cls(result, **init_kwds)"},{"fileName":"blocks.py","filePath":"astropy/nddata","id":11834,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module includes helper functions for array operations.\n\"\"\"\n\nimport numpy as np\n\nfrom .decorators import support_nddata\n\n__all__ = ['reshape_as_blocks', 'block_reduce', 'block_replicate']\n\n\ndef _process_block_inputs(data, block_size):\n    data = np.asanyarray(data)\n    block_size = np.atleast_1d(block_size)\n\n    if np.any(block_size <= 0):\n        raise ValueError('block_size elements must be strictly positive')\n\n    if data.ndim > 1 and len(block_size) == 1:\n        block_size = np.repeat(block_size, data.ndim)\n\n    if len(block_size) != data.ndim:\n        raise ValueError('block_size must be a scalar or have the same '\n                         'length as the number of data dimensions')\n\n    block_size_int = block_size.astype(int)\n    if np.any(block_size_int != block_size):  # e.g., 2.0 is OK, 2.1 is not\n        raise ValueError('block_size elements must be integers')\n\n    return data, block_size_int\n\n\ndef reshape_as_blocks(data, block_size):\n    \"\"\"\n    Reshape a data array into blocks.\n\n    This is useful to efficiently apply functions on block subsets of\n    the data instead of using loops.  The reshaped array is a view of\n    the input data array.\n\n    .. versionadded:: 4.1\n\n    Parameters\n    ----------\n    data : ndarray\n        The input data array.\n\n    block_size : int or array-like (int)\n        The integer block size along each axis.  If ``block_size`` is a\n        scalar and ``data`` has more than one dimension, then\n        ``block_size`` will be used for for every axis.  Each dimension\n        of ``block_size`` must divide evenly into the corresponding\n        dimension of ``data``.\n\n    Returns\n    -------\n    output : ndarray\n        The reshaped array as a view of the input ``data`` array.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.nddata import reshape_as_blocks\n    >>> data = np.arange(16).reshape(4, 4)\n    >>> data\n    array([[ 0,  1,  2,  3],\n           [ 4,  5,  6,  7],\n           [ 8,  9, 10, 11],\n           [12, 13, 14, 15]])\n    >>> reshape_as_blocks(data, (2, 2))\n    array([[[[ 0,  1],\n             [ 4,  5]],\n            [[ 2,  3],\n             [ 6,  7]]],\n           [[[ 8,  9],\n             [12, 13]],\n            [[10, 11],\n             [14, 15]]]])\n    \"\"\"\n\n    data, block_size = _process_block_inputs(data, block_size)\n\n    if np.any(np.mod(data.shape, block_size) != 0):\n        raise ValueError('Each dimension of block_size must divide evenly '\n                         'into the corresponding dimension of data')\n\n    nblocks = np.array(data.shape) // block_size\n    new_shape = tuple(k for ij in zip(nblocks, block_size) for k in ij)\n    nblocks_idx = tuple(range(0, len(new_shape), 2))  # even indices\n    block_idx = tuple(range(1, len(new_shape), 2))  # odd indices\n\n    return data.reshape(new_shape).transpose(nblocks_idx + block_idx)\n\n\n@support_nddata\ndef block_reduce(data, block_size, func=np.sum):\n    \"\"\"\n    Downsample a data array by applying a function to local blocks.\n\n    If ``data`` is not perfectly divisible by ``block_size`` along a\n    given axis then the data will be trimmed (from the end) along that\n    axis.\n\n    Parameters\n    ----------\n    data : array-like\n        The data to be resampled.\n\n    block_size : int or array-like (int)\n        The integer block size along each axis.  If ``block_size`` is a\n        scalar and ``data`` has more than one dimension, then\n        ``block_size`` will be used for for every axis.\n\n    func : callable, optional\n        The method to use to downsample the data.  Must be a callable\n        that takes in a `~numpy.ndarray` along with an ``axis`` keyword,\n        which defines the axis or axes along which the function is\n        applied.  The ``axis`` keyword must accept multiple axes as a\n        tuple.  The default is `~numpy.sum`, which provides block\n        summation (and conserves the data sum).\n\n    Returns\n    -------\n    output : array-like\n        The resampled data.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.nddata import block_reduce\n    >>> data = np.arange(16).reshape(4, 4)\n    >>> block_reduce(data, 2)  # doctest: +FLOAT_CMP\n    array([[10, 18],\n           [42, 50]])\n\n    >>> block_reduce(data, 2, func=np.mean)  # doctest: +FLOAT_CMP\n    array([[  2.5,   4.5],\n           [ 10.5,  12.5]])\n    \"\"\"\n\n    data, block_size = _process_block_inputs(data, block_size)\n    nblocks = np.array(data.shape) // block_size\n    size_init = nblocks * block_size  # evenly-divisible size\n\n    # trim data if necessary\n    for axis in range(data.ndim):\n        if data.shape[axis] != size_init[axis]:\n            data = data.swapaxes(0, axis)\n            data = data[:size_init[axis]]\n            data = data.swapaxes(0, axis)\n\n    reshaped = reshape_as_blocks(data, block_size)\n    axis = tuple(range(data.ndim, reshaped.ndim))\n\n    return func(reshaped, axis=axis)\n\n\n@support_nddata\ndef block_replicate(data, block_size, conserve_sum=True):\n    \"\"\"\n    Upsample a data array by block replication.\n\n    Parameters\n    ----------\n    data : array-like\n        The data to be block replicated.\n\n    block_size : int or array-like (int)\n        The integer block size along each axis.  If ``block_size`` is a\n        scalar and ``data`` has more than one dimension, then\n        ``block_size`` will be used for for every axis.\n\n    conserve_sum : bool, optional\n        If `True` (the default) then the sum of the output\n        block-replicated data will equal the sum of the input ``data``.\n\n    Returns\n    -------\n    output : array-like\n        The block-replicated data.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.nddata import block_replicate\n    >>> data = np.array([[0., 1.], [2., 3.]])\n    >>> block_replicate(data, 2)  # doctest: +FLOAT_CMP\n    array([[0.  , 0.  , 0.25, 0.25],\n           [0.  , 0.  , 0.25, 0.25],\n           [0.5 , 0.5 , 0.75, 0.75],\n           [0.5 , 0.5 , 0.75, 0.75]])\n\n    >>> block_replicate(data, 2, conserve_sum=False)  # doctest: +FLOAT_CMP\n    array([[0., 0., 1., 1.],\n           [0., 0., 1., 1.],\n           [2., 2., 3., 3.],\n           [2., 2., 3., 3.]])\n    \"\"\"\n\n    data, block_size = _process_block_inputs(data, block_size)\n    for i in range(data.ndim):\n        data = np.repeat(data, block_size[i], axis=i)\n\n    if conserve_sum:\n        data = data / float(np.prod(block_size))\n\n    return data\n"},{"col":0,"comment":"null","endLoc":31,"header":"def _process_block_inputs(data, block_size)","id":11835,"name":"_process_block_inputs","nodeType":"Function","startLoc":13,"text":"def _process_block_inputs(data, block_size):\n    data = np.asanyarray(data)\n    block_size = np.atleast_1d(block_size)\n\n    if np.any(block_size <= 0):\n        raise ValueError('block_size elements must be strictly positive')\n\n    if data.ndim > 1 and len(block_size) == 1:\n        block_size = np.repeat(block_size, data.ndim)\n\n    if len(block_size) != data.ndim:\n        raise ValueError('block_size must be a scalar or have the same '\n                         'length as the number of data dimensions')\n\n    block_size_int = block_size.astype(int)\n    if np.any(block_size_int != block_size):  # e.g., 2.0 is OK, 2.1 is not\n        raise ValueError('block_size elements must be integers')\n\n    return data, block_size_int"},{"attributeType":"null","col":8,"comment":"null","endLoc":523,"id":11836,"name":"extra_values","nodeType":"Attribute","startLoc":523,"text":"self.extra_values"},{"attributeType":"null","col":8,"comment":"null","endLoc":497,"id":11837,"name":"main","nodeType":"Attribute","startLoc":497,"text":"self.main"},{"attributeType":"null","col":8,"comment":"null","endLoc":514,"id":11838,"name":"sections","nodeType":"Attribute","startLoc":514,"text":"self.sections"},{"attributeType":"null","col":8,"comment":"null","endLoc":517,"id":11839,"name":"inline_comments","nodeType":"Attribute","startLoc":517,"text":"self.inline_comments"},{"attributeType":"null","col":8,"comment":"null","endLoc":522,"id":11840,"name":"default_values","nodeType":"Attribute","startLoc":522,"text":"self.default_values"},{"attributeType":"null","col":8,"comment":"null","endLoc":499,"id":11841,"name":"depth","nodeType":"Attribute","startLoc":499,"text":"self.depth"},{"attributeType":"null","col":8,"comment":"null","endLoc":521,"id":11842,"name":"defaults","nodeType":"Attribute","startLoc":521,"text":"self.defaults"},{"attributeType":"null","col":8,"comment":"null","endLoc":524,"id":11843,"name":"_created","nodeType":"Attribute","startLoc":524,"text":"self._created"},{"attributeType":"null","col":8,"comment":"null","endLoc":294,"id":11844,"name":"errorok","nodeType":"Attribute","startLoc":294,"text":"self.errorok"},{"col":4,"comment":"null","endLoc":146,"header":"def __setattr__(cls, name, val)","id":11845,"name":"__setattr__","nodeType":"Function","startLoc":115,"text":"def __setattr__(cls, name, val):\n        if name == '_locked':\n            return super().__setattr__(name, True)\n\n        else:\n            if name == '__version__':\n                if cls._locked:\n                    raise AttributeError(\"Version cannot be modified.\")\n                return super().__setattr__(name, val)\n\n            err_msg = f\"Bit flags are read-only. Unable to reassign attribute {name}\"\n            if cls._locked:\n                raise AttributeError(err_msg)\n\n        namel = name.lower()\n        if _ENABLE_BITFLAG_CACHING:\n            if not namel.startswith('_') and namel in cls._cache:\n                raise AttributeError(err_msg)\n\n        else:\n            for b in cls.__bases__:\n                if not namel.startswith('_') and namel in list(map(str.lower, b.__dict__)):\n                    raise AttributeError(err_msg)\n            if namel in list(map(str.lower, cls.__dict__)):\n                raise AttributeError(err_msg)\n\n        val = BitFlag(val)\n\n        if _ENABLE_BITFLAG_CACHING and not namel.startswith('_'):\n            cls._cache[namel] = val\n\n        return super().__setattr__(name, val)"},{"attributeType":"null","col":8,"comment":"null","endLoc":390,"id":11846,"name":"statestack","nodeType":"Attribute","startLoc":390,"text":"self.statestack"},{"attributeType":"null","col":8,"comment":"null","endLoc":385,"id":11847,"name":"token","nodeType":"Attribute","startLoc":385,"text":"self.token"},{"className":"Production","col":0,"comment":"null","endLoc":1377,"id":11848,"nodeType":"Class","startLoc":1311,"text":"class Production(object):\n    reduced = 0\n    def __init__(self, number, name, prod, precedence=('right', 0), func=None, file='', line=0):\n        self.name     = name\n        self.prod     = tuple(prod)\n        self.number   = number\n        self.func     = func\n        self.callable = None\n        self.file     = file\n        self.line     = line\n        self.prec     = precedence\n\n        # Internal settings used during table construction\n\n        self.len  = len(self.prod)   # Length of the production\n\n        # Create a list of unique production symbols used in the production\n        self.usyms = []\n        for s in self.prod:\n            if s not in self.usyms:\n                self.usyms.append(s)\n\n        # List of all LR items for the production\n        self.lr_items = []\n        self.lr_next = None\n\n        # Create a string representation\n        if self.prod:\n            self.str = '%s -> %s' % (self.name, ' '.join(self.prod))\n        else:\n            self.str = '%s -> <empty>' % self.name\n\n    def __str__(self):\n        return self.str\n\n    def __repr__(self):\n        return 'Production(' + str(self) + ')'\n\n    def __len__(self):\n        return len(self.prod)\n\n    def __nonzero__(self):\n        return 1\n\n    def __getitem__(self, index):\n        return self.prod[index]\n\n    # Return the nth lr_item from the production (or None if at the end)\n    def lr_item(self, n):\n        if n > len(self.prod):\n            return None\n        p = LRItem(self, n)\n        # Precompute the list of productions immediately following.\n        try:\n            p.lr_after = self.Prodnames[p.prod[n+1]]\n        except (IndexError, KeyError):\n            p.lr_after = []\n        try:\n            p.lr_before = p.prod[n-1]\n        except IndexError:\n            p.lr_before = None\n        return p\n\n    # Bind the production function name to a callable\n    def bind(self, pdict):\n        if self.func:\n            self.callable = pdict[self.func]"},{"col":4,"comment":"null","endLoc":1341,"header":"def __init__(self, number, name, prod, precedence=('right', 0), func=None, file='', line=0)","id":11849,"name":"__init__","nodeType":"Function","startLoc":1313,"text":"def __init__(self, number, name, prod, precedence=('right', 0), func=None, file='', line=0):\n        self.name     = name\n        self.prod     = tuple(prod)\n        self.number   = number\n        self.func     = func\n        self.callable = None\n        self.file     = file\n        self.line     = line\n        self.prec     = precedence\n\n        # Internal settings used during table construction\n\n        self.len  = len(self.prod)   # Length of the production\n\n        # Create a list of unique production symbols used in the production\n        self.usyms = []\n        for s in self.prod:\n            if s not in self.usyms:\n                self.usyms.append(s)\n\n        # List of all LR items for the production\n        self.lr_items = []\n        self.lr_next = None\n\n        # Create a string representation\n        if self.prod:\n            self.str = '%s -> %s' % (self.name, ' '.join(self.prod))\n        else:\n            self.str = '%s -> <empty>' % self.name"},{"attributeType":"null","col":8,"comment":"null","endLoc":501,"id":11850,"name":"name","nodeType":"Attribute","startLoc":501,"text":"self.name"},{"attributeType":"null","col":25,"comment":"null","endLoc":545,"id":11851,"name":"_interpolation_engine","nodeType":"Attribute","startLoc":545,"text":"self._interpolation_engine"},{"className":"ConfigObj","col":0,"comment":"An object to read, create, and write config files.","endLoc":2364,"id":11852,"nodeType":"Class","startLoc":1069,"text":"class ConfigObj(Section):\n    \"\"\"An object to read, create, and write config files.\"\"\"\n\n    _keyword = re.compile(r'''^ # line start\n        (\\s*)                   # indentation\n        (                       # keyword\n            (?:\".*?\")|          # double quotes\n            (?:'.*?')|          # single quotes\n            (?:[^'\"=].*?)       # no quotes\n        )\n        \\s*=\\s*                 # divider\n        (.*)                    # value (including list values and comments)\n        $   # line end\n        ''',\n        re.VERBOSE)\n\n    _sectionmarker = re.compile(r'''^\n        (\\s*)                     # 1: indentation\n        ((?:\\[\\s*)+)              # 2: section marker open\n        (                         # 3: section name open\n            (?:\"\\s*\\S.*?\\s*\")|    # at least one non-space with double quotes\n            (?:'\\s*\\S.*?\\s*')|    # at least one non-space with single quotes\n            (?:[^'\"\\s].*?)        # at least one non-space unquoted\n        )                         # section name close\n        ((?:\\s*\\])+)              # 4: section marker close\n        \\s*(\\#.*)?                # 5: optional comment\n        $''',\n        re.VERBOSE)\n\n    # this regexp pulls list values out as a single string\n    # or single values and comments\n    # FIXME: this regex adds a '' to the end of comma terminated lists\n    #   workaround in ``_handle_value``\n    _valueexp = re.compile(r'''^\n        (?:\n            (?:\n                (\n                    (?:\n                        (?:\n                            (?:\".*?\")|              # double quotes\n                            (?:'.*?')|              # single quotes\n                            (?:[^'\",\\#][^,\\#]*?)    # unquoted\n                        )\n                        \\s*,\\s*                     # comma\n                    )*      # match all list items ending in a comma (if any)\n                )\n                (\n                    (?:\".*?\")|                      # double quotes\n                    (?:'.*?')|                      # single quotes\n                    (?:[^'\",\\#\\s][^,]*?)|           # unquoted\n                    (?:(?<!,))                      # Empty value\n                )?          # last item in a list - or string value\n            )|\n            (,)             # alternatively a single comma - empty list\n        )\n        \\s*(\\#.*)?          # optional comment\n        $''',\n        re.VERBOSE)\n\n    # use findall to get the members of a list value\n    _listvalueexp = re.compile(r'''\n        (\n            (?:\".*?\")|          # double quotes\n            (?:'.*?')|          # single quotes\n            (?:[^'\",\\#]?.*?)       # unquoted\n        )\n        \\s*,\\s*                 # comma\n        ''',\n        re.VERBOSE)\n\n    # this regexp is used for the value\n    # when lists are switched off\n    _nolistvalue = re.compile(r'''^\n        (\n            (?:\".*?\")|          # double quotes\n            (?:'.*?')|          # single quotes\n            (?:[^'\"\\#].*?)|     # unquoted\n            (?:)                # Empty value\n        )\n        \\s*(\\#.*)?              # optional comment\n        $''',\n        re.VERBOSE)\n\n    # regexes for finding triple quoted values on one line\n    _single_line_single = re.compile(r\"^'''(.*?)'''\\s*(#.*)?$\")\n    _single_line_double = re.compile(r'^\"\"\"(.*?)\"\"\"\\s*(#.*)?$')\n    _multi_line_single = re.compile(r\"^(.*?)'''\\s*(#.*)?$\")\n    _multi_line_double = re.compile(r'^(.*?)\"\"\"\\s*(#.*)?$')\n\n    _triple_quote = {\n        \"'''\": (_single_line_single, _multi_line_single),\n        '\"\"\"': (_single_line_double, _multi_line_double),\n    }\n\n    # Used by the ``istrue`` Section method\n    _bools = {\n        'yes': True, 'no': False,\n        'on': True, 'off': False,\n        '1': True, '0': False,\n        'true': True, 'false': False,\n        }\n\n\n    def __init__(self, infile=None, options=None, configspec=None, encoding=None,\n                 interpolation=True, raise_errors=False, list_values=True,\n                 create_empty=False, file_error=False, stringify=True,\n                 indent_type=None, default_encoding=None, unrepr=False,\n                 write_empty_values=False, _inspec=False):\n        \"\"\"\n        Parse a config file or create a config file object.\n\n        ``ConfigObj(infile=None, configspec=None, encoding=None,\n                    interpolation=True, raise_errors=False, list_values=True,\n                    create_empty=False, file_error=False, stringify=True,\n                    indent_type=None, default_encoding=None, unrepr=False,\n                    write_empty_values=False, _inspec=False)``\n        \"\"\"\n        self._inspec = _inspec\n        # init the superclass\n        Section.__init__(self, self, 0, self)\n\n        infile = infile or []\n\n        _options = {'configspec': configspec,\n                    'encoding': encoding, 'interpolation': interpolation,\n                    'raise_errors': raise_errors, 'list_values': list_values,\n                    'create_empty': create_empty, 'file_error': file_error,\n                    'stringify': stringify, 'indent_type': indent_type,\n                    'default_encoding': default_encoding, 'unrepr': unrepr,\n                    'write_empty_values': write_empty_values}\n\n        if options is None:\n            options = _options\n        else:\n            import warnings\n            warnings.warn('Passing in an options dictionary to ConfigObj() is '\n                          'deprecated. Use **options instead.',\n                          DeprecationWarning)\n\n            # TODO: check the values too.\n            for entry in options:\n                if entry not in OPTION_DEFAULTS:\n                    raise TypeError('Unrecognized option \"%s\".' % entry)\n            for entry, value in list(OPTION_DEFAULTS.items()):\n                if entry not in options:\n                    options[entry] = value\n                keyword_value = _options[entry]\n                if value != keyword_value:\n                    options[entry] = keyword_value\n\n        # XXXX this ignores an explicit list_values = True in combination\n        # with _inspec. The user should *never* do that anyway, but still...\n        if _inspec:\n            options['list_values'] = False\n\n        self._initialise(options)\n        configspec = options['configspec']\n        self._original_configspec = configspec\n        self._load(infile, configspec)\n\n\n    def _load(self, infile, configspec):\n        if isinstance(infile, str):\n            self.filename = infile\n            if os.path.isfile(infile):\n                with open(infile, 'rb') as h:\n                    content = h.readlines() or []\n            elif self.file_error:\n                # raise an error if the file doesn't exist\n                raise IOError('Config file not found: \"%s\".' % self.filename)\n            else:\n                # file doesn't already exist\n                if self.create_empty:\n                    # this is a good test that the filename specified\n                    # isn't impossible - like on a non-existent device\n                    with open(infile, 'w') as h:\n                        h.write('')\n                content = []\n\n        elif isinstance(infile, (list, tuple)):\n            content = list(infile)\n\n        elif isinstance(infile, dict):\n            # initialise self\n            # the Section class handles creating subsections\n            if isinstance(infile, ConfigObj):\n                # get a copy of our ConfigObj\n                def set_section(in_section, this_section):\n                    for entry in in_section.scalars:\n                        this_section[entry] = in_section[entry]\n                    for section in in_section.sections:\n                        this_section[section] = {}\n                        set_section(in_section[section], this_section[section])\n                set_section(infile, self)\n\n            else:\n                for entry in infile:\n                    self[entry] = infile[entry]\n            del self._errors\n\n            if configspec is not None:\n                self._handle_configspec(configspec)\n            else:\n                self.configspec = None\n            return\n\n        elif getattr(infile, 'read', MISSING) is not MISSING:\n            # This supports file like objects\n            content = infile.read() or []\n            # needs splitting into lines - but needs doing *after* decoding\n            # in case it's not an 8 bit encoding\n        else:\n            raise TypeError('infile must be a filename, file like object, or list of lines.')\n\n        if content:\n            # don't do it for the empty ConfigObj\n            content = self._handle_bom(content)\n            # infile is now *always* a list\n            #\n            # Set the newlines attribute (first line ending it finds)\n            # and strip trailing '\\n' or '\\r' from lines\n            for line in content:\n                if (not line) or (line[-1] not in ('\\r', '\\n')):\n                    continue\n                for end in ('\\r\\n', '\\n', '\\r'):\n                    if line.endswith(end):\n                        self.newlines = end\n                        break\n                break\n\n        assert all(isinstance(line, str) for line in content), repr(content)\n        content = [line.rstrip('\\r\\n') for line in content]\n\n        self._parse(content)\n        # if we had any errors, now is the time to raise them\n        if self._errors:\n            info = \"at line %s.\" % self._errors[0].line_number\n            if len(self._errors) > 1:\n                msg = \"Parsing failed with several errors.\\nFirst error %s\" % info\n                error = ConfigObjError(msg)\n            else:\n                error = self._errors[0]\n            # set the errors attribute; it's a list of tuples:\n            # (error_type, message, line_number)\n            error.errors = self._errors\n            # set the config attribute\n            error.config = self\n            raise error\n        # delete private attributes\n        del self._errors\n\n        if configspec is None:\n            self.configspec = None\n        else:\n            self._handle_configspec(configspec)\n\n\n    def _initialise(self, options=None):\n        if options is None:\n            options = OPTION_DEFAULTS\n\n        # initialise a few variables\n        self.filename = None\n        self._errors = []\n        self.raise_errors = options['raise_errors']\n        self.interpolation = options['interpolation']\n        self.list_values = options['list_values']\n        self.create_empty = options['create_empty']\n        self.file_error = options['file_error']\n        self.stringify = options['stringify']\n        self.indent_type = options['indent_type']\n        self.encoding = options['encoding']\n        self.default_encoding = options['default_encoding']\n        self.BOM = False\n        self.newlines = None\n        self.write_empty_values = options['write_empty_values']\n        self.unrepr = options['unrepr']\n\n        self.initial_comment = []\n        self.final_comment = []\n        self.configspec = None\n\n        if self._inspec:\n            self.list_values = False\n\n        # Clear section attributes as well\n        Section._initialise(self)\n\n\n    def __repr__(self):\n        def _getval(key):\n            try:\n                return self[key]\n            except MissingInterpolationOption:\n                return dict.__getitem__(self, key)\n        return ('%s({%s})' % (self.__class__.__name__,\n                ', '.join([('%s: %s' % (repr(key), repr(_getval(key))))\n                for key in (self.scalars + self.sections)])))\n\n\n    def _handle_bom(self, infile):\n        \"\"\"\n        Handle any BOM, and decode if necessary.\n\n        If an encoding is specified, that *must* be used - but the BOM should\n        still be removed (and the BOM attribute set).\n\n        (If the encoding is wrongly specified, then a BOM for an alternative\n        encoding won't be discovered or removed.)\n\n        If an encoding is not specified, UTF8 or UTF16 BOM will be detected and\n        removed. The BOM attribute will be set. UTF16 will be decoded to\n        unicode.\n\n        NOTE: This method must not be called with an empty ``infile``.\n\n        Specifying the *wrong* encoding is likely to cause a\n        ``UnicodeDecodeError``.\n\n        ``infile`` must always be returned as a list of lines, but may be\n        passed in as a single string.\n        \"\"\"\n\n        if ((self.encoding is not None) and\n            (self.encoding.lower() not in BOM_LIST)):\n            # No need to check for a BOM\n            # the encoding specified doesn't have one\n            # just decode\n            return self._decode(infile, self.encoding)\n\n        if isinstance(infile, (list, tuple)):\n            line = infile[0]\n        else:\n            line = infile\n\n        if isinstance(line, str):\n            # it's already decoded and there's no need to do anything\n            # else, just use the _decode utility method to handle\n            # listifying appropriately\n            return self._decode(infile, self.encoding)\n\n        if self.encoding is not None:\n            # encoding explicitly supplied\n            # And it could have an associated BOM\n            # TODO: if encoding is just UTF16 - we ought to check for both\n            # TODO: big endian and little endian versions.\n            enc = BOM_LIST[self.encoding.lower()]\n            if enc == 'utf_16':\n                # For UTF16 we try big endian and little endian\n                for BOM, (encoding, final_encoding) in list(BOMS.items()):\n                    if not final_encoding:\n                        # skip UTF8\n                        continue\n                    if infile.startswith(BOM):\n                        ### BOM discovered\n                        ##self.BOM = True\n                        # Don't need to remove BOM\n                        return self._decode(infile, encoding)\n\n                # If we get this far, will *probably* raise a DecodeError\n                # As it doesn't appear to start with a BOM\n                return self._decode(infile, self.encoding)\n\n            # Must be UTF8\n            BOM = BOM_SET[enc]\n            if not line.startswith(BOM):\n                return self._decode(infile, self.encoding)\n\n            newline = line[len(BOM):]\n\n            # BOM removed\n            if isinstance(infile, (list, tuple)):\n                infile[0] = newline\n            else:\n                infile = newline\n            self.BOM = True\n            return self._decode(infile, self.encoding)\n\n        # No encoding specified - so we need to check for UTF8/UTF16\n        for BOM, (encoding, final_encoding) in list(BOMS.items()):\n            if not isinstance(line, bytes) or not line.startswith(BOM):\n                # didn't specify a BOM, or it's not a bytestring\n                continue\n            else:\n                # BOM discovered\n                self.encoding = final_encoding\n                if not final_encoding:\n                    self.BOM = True\n                    # UTF8\n                    # remove BOM\n                    newline = line[len(BOM):]\n                    if isinstance(infile, (list, tuple)):\n                        infile[0] = newline\n                    else:\n                        infile = newline\n                    # UTF-8\n                    if isinstance(infile, str):\n                        return infile.splitlines(True)\n                    elif isinstance(infile, bytes):\n                        return infile.decode('utf-8').splitlines(True)\n                    else:\n                        return self._decode(infile, 'utf-8')\n                # UTF16 - have to decode\n                return self._decode(infile, encoding)\n\n        # No BOM discovered and no encoding specified, default to UTF-8\n        if isinstance(infile, bytes):\n            return infile.decode('utf-8').splitlines(True)\n        else:\n            return self._decode(infile, 'utf-8')\n\n\n    def _a_to_u(self, aString):\n        \"\"\"Decode ASCII strings to unicode if a self.encoding is specified.\"\"\"\n        if isinstance(aString, bytes) and self.encoding:\n            return aString.decode(self.encoding)\n        else:\n            return aString\n\n\n    def _decode(self, infile, encoding):\n        \"\"\"\n        Decode infile to unicode. Using the specified encoding.\n\n        if is a string, it also needs converting to a list.\n        \"\"\"\n        if isinstance(infile, str):\n            return infile.splitlines(True)\n        if isinstance(infile, bytes):\n            # NOTE: Could raise a ``UnicodeDecodeError``\n            if encoding:\n                return infile.decode(encoding).splitlines(True)\n            else:\n                return infile.splitlines(True)\n\n        if encoding:\n            for i, line in enumerate(infile):\n                if isinstance(line, bytes):\n                    # NOTE: The isinstance test here handles mixed lists of unicode/string\n                    # NOTE: But the decode will break on any non-string values\n                    # NOTE: Or could raise a ``UnicodeDecodeError``\n                    infile[i] = line.decode(encoding)\n        return infile\n\n\n    def _decode_element(self, line):\n        \"\"\"Decode element to unicode if necessary.\"\"\"\n        if isinstance(line, bytes) and self.default_encoding:\n            return line.decode(self.default_encoding)\n        else:\n            return line\n\n\n    # TODO: this may need to be modified\n    def _str(self, value):\n        \"\"\"\n        Used by ``stringify`` within validate, to turn non-string values\n        into strings.\n        \"\"\"\n        if not isinstance(value, str):\n            # intentially 'str' because it's just whatever the \"normal\"\n            # string type is for the python version we're dealing with\n            return str(value)\n        else:\n            return value\n\n\n    def _parse(self, infile):\n        \"\"\"Actually parse the config file.\"\"\"\n        temp_list_values = self.list_values\n        if self.unrepr:\n            self.list_values = False\n\n        comment_list = []\n        done_start = False\n        this_section = self\n        maxline = len(infile) - 1\n        cur_index = -1\n        reset_comment = False\n\n        while cur_index < maxline:\n            if reset_comment:\n                comment_list = []\n            cur_index += 1\n            line = infile[cur_index]\n            sline = line.strip()\n            # do we have anything on the line ?\n            if not sline or sline.startswith('#'):\n                reset_comment = False\n                comment_list.append(line)\n                continue\n\n            if not done_start:\n                # preserve initial comment\n                self.initial_comment = comment_list\n                comment_list = []\n                done_start = True\n\n            reset_comment = True\n            # first we check if it's a section marker\n            mat = self._sectionmarker.match(line)\n            if mat is not None:\n                # is a section line\n                (indent, sect_open, sect_name, sect_close, comment) = mat.groups()\n                if indent and (self.indent_type is None):\n                    self.indent_type = indent\n                cur_depth = sect_open.count('[')\n                if cur_depth != sect_close.count(']'):\n                    self._handle_error(\"Cannot compute the section depth\",\n                                       NestingError, infile, cur_index)\n                    continue\n\n                if cur_depth < this_section.depth:\n                    # the new section is dropping back to a previous level\n                    try:\n                        parent = self._match_depth(this_section,\n                                                   cur_depth).parent\n                    except SyntaxError:\n                        self._handle_error(\"Cannot compute nesting level\",\n                                           NestingError, infile, cur_index)\n                        continue\n                elif cur_depth == this_section.depth:\n                    # the new section is a sibling of the current section\n                    parent = this_section.parent\n                elif cur_depth == this_section.depth + 1:\n                    # the new section is a child the current section\n                    parent = this_section\n                else:\n                    self._handle_error(\"Section too nested\",\n                                       NestingError, infile, cur_index)\n                    continue\n\n                sect_name = self._unquote(sect_name)\n                if sect_name in parent:\n                    self._handle_error('Duplicate section name',\n                                       DuplicateError, infile, cur_index)\n                    continue\n\n                # create the new section\n                this_section = Section(\n                    parent,\n                    cur_depth,\n                    self,\n                    name=sect_name)\n                parent[sect_name] = this_section\n                parent.inline_comments[sect_name] = comment\n                parent.comments[sect_name] = comment_list\n                continue\n            #\n            # it's not a section marker,\n            # so it should be a valid ``key = value`` line\n            mat = self._keyword.match(line)\n            if mat is None:\n                self._handle_error(\n                    'Invalid line ({0!r}) (matched as neither section nor keyword)'.format(line),\n                    ParseError, infile, cur_index)\n            else:\n                # is a keyword value\n                # value will include any inline comment\n                (indent, key, value) = mat.groups()\n                if indent and (self.indent_type is None):\n                    self.indent_type = indent\n                # check for a multiline value\n                if value[:3] in ['\"\"\"', \"'''\"]:\n                    try:\n                        value, comment, cur_index = self._multiline(\n                            value, infile, cur_index, maxline)\n                    except SyntaxError:\n                        self._handle_error(\n                            'Parse error in multiline value',\n                            ParseError, infile, cur_index)\n                        continue\n                    else:\n                        if self.unrepr:\n                            comment = ''\n                            try:\n                                value = unrepr(value)\n                            except Exception as e:\n                                if type(e) == UnknownType:\n                                    msg = 'Unknown name or type in value'\n                                else:\n                                    msg = 'Parse error from unrepr-ing multiline value'\n                                self._handle_error(msg, UnreprError, infile,\n                                    cur_index)\n                                continue\n                else:\n                    if self.unrepr:\n                        comment = ''\n                        try:\n                            value = unrepr(value)\n                        except Exception as e:\n                            if isinstance(e, UnknownType):\n                                msg = 'Unknown name or type in value'\n                            else:\n                                msg = 'Parse error from unrepr-ing value'\n                            self._handle_error(msg, UnreprError, infile,\n                                cur_index)\n                            continue\n                    else:\n                        # extract comment and lists\n                        try:\n                            (value, comment) = self._handle_value(value)\n                        except SyntaxError:\n                            self._handle_error(\n                                'Parse error in value',\n                                ParseError, infile, cur_index)\n                            continue\n                #\n                key = self._unquote(key)\n                if key in this_section:\n                    self._handle_error(\n                        'Duplicate keyword name',\n                        DuplicateError, infile, cur_index)\n                    continue\n                # add the key.\n                # we set unrepr because if we have got this far we will never\n                # be creating a new section\n                this_section.__setitem__(key, value, unrepr=True)\n                this_section.inline_comments[key] = comment\n                this_section.comments[key] = comment_list\n                continue\n        #\n        if self.indent_type is None:\n            # no indentation used, set the type accordingly\n            self.indent_type = ''\n\n        # preserve the final comment\n        if not self and not self.initial_comment:\n            self.initial_comment = comment_list\n        elif not reset_comment:\n            self.final_comment = comment_list\n        self.list_values = temp_list_values\n\n\n    def _match_depth(self, sect, depth):\n        \"\"\"\n        Given a section and a depth level, walk back through the sections\n        parents to see if the depth level matches a previous section.\n\n        Return a reference to the right section,\n        or raise a SyntaxError.\n        \"\"\"\n        while depth < sect.depth:\n            if sect is sect.parent:\n                # we've reached the top level already\n                raise SyntaxError()\n            sect = sect.parent\n        if sect.depth == depth:\n            return sect\n        # shouldn't get here\n        raise SyntaxError()\n\n\n    def _handle_error(self, text, ErrorClass, infile, cur_index):\n        \"\"\"\n        Handle an error according to the error settings.\n\n        Either raise the error or store it.\n        The error will have occured at ``cur_index``\n        \"\"\"\n        line = infile[cur_index]\n        cur_index += 1\n        message = '{0} at line {1}.'.format(text, cur_index)\n        error = ErrorClass(message, cur_index, line)\n        if self.raise_errors:\n            # raise the error - parsing stops here\n            raise error\n        # store the error\n        # reraise when parsing has finished\n        self._errors.append(error)\n\n\n    def _unquote(self, value):\n        \"\"\"Return an unquoted version of a value\"\"\"\n        if not value:\n            # should only happen during parsing of lists\n            raise SyntaxError\n        if (value[0] == value[-1]) and (value[0] in ('\"', \"'\")):\n            value = value[1:-1]\n        return value\n\n\n    def _quote(self, value, multiline=True):\n        \"\"\"\n        Return a safely quoted version of a value.\n\n        Raise a ConfigObjError if the value cannot be safely quoted.\n        If multiline is ``True`` (default) then use triple quotes\n        if necessary.\n\n        * Don't quote values that don't need it.\n        * Recursively quote members of a list and return a comma joined list.\n        * Multiline is ``False`` for lists.\n        * Obey list syntax for empty and single member lists.\n\n        If ``list_values=False`` then the value is only quoted if it contains\n        a ``\\\\n`` (is multiline) or '#'.\n\n        If ``write_empty_values`` is set, and the value is an empty string, it\n        won't be quoted.\n        \"\"\"\n        if multiline and self.write_empty_values and value == '':\n            # Only if multiline is set, so that it is used for values not\n            # keys, and not values that are part of a list\n            return ''\n\n        if multiline and isinstance(value, (list, tuple)):\n            if not value:\n                return ','\n            elif len(value) == 1:\n                return self._quote(value[0], multiline=False) + ','\n            return ', '.join([self._quote(val, multiline=False)\n                for val in value])\n        if not isinstance(value, str):\n            if self.stringify:\n                # intentially 'str' because it's just whatever the \"normal\"\n                # string type is for the python version we're dealing with\n                value = str(value)\n            else:\n                raise TypeError('Value \"%s\" is not a string.' % value)\n\n        if not value:\n            return '\"\"'\n\n        no_lists_no_quotes = not self.list_values and '\\n' not in value and '#' not in value\n        need_triple = multiline and (((\"'\" in value) and ('\"' in value)) or ('\\n' in value ))\n        hash_triple_quote = multiline and not need_triple and (\"'\" in value) and ('\"' in value) and ('#' in value)\n        check_for_single = (no_lists_no_quotes or not need_triple) and not hash_triple_quote\n\n        if check_for_single:\n            if not self.list_values:\n                # we don't quote if ``list_values=False``\n                quot = noquot\n            # for normal values either single or double quotes will do\n            elif '\\n' in value:\n                # will only happen if multiline is off - e.g. '\\n' in key\n                raise ConfigObjError('Value \"%s\" cannot be safely quoted.' % value)\n            elif ((value[0] not in wspace_plus) and\n                    (value[-1] not in wspace_plus) and\n                    (',' not in value)):\n                quot = noquot\n            else:\n                quot = self._get_single_quote(value)\n        else:\n            # if value has '\\n' or \"'\" *and* '\"', it will need triple quotes\n            quot = self._get_triple_quote(value)\n\n        if quot == noquot and '#' in value and self.list_values:\n            quot = self._get_single_quote(value)\n\n        return quot % value\n\n\n    def _get_single_quote(self, value):\n        if (\"'\" in value) and ('\"' in value):\n            raise ConfigObjError('Value \"%s\" cannot be safely quoted.' % value)\n        elif '\"' in value:\n            quot = squot\n        else:\n            quot = dquot\n        return quot\n\n\n    def _get_triple_quote(self, value):\n        if (value.find('\"\"\"') != -1) and (value.find(\"'''\") != -1):\n            raise ConfigObjError('Value \"%s\" cannot be safely quoted.' % value)\n        if value.find('\"\"\"') == -1:\n            quot = tdquot\n        else:\n            quot = tsquot\n        return quot\n\n\n    def _handle_value(self, value):\n        \"\"\"\n        Given a value string, unquote, remove comment,\n        handle lists. (including empty and single member lists)\n        \"\"\"\n        if self._inspec:\n            # Parsing a configspec so don't handle comments\n            return (value, '')\n        # do we look for lists in values ?\n        if not self.list_values:\n            mat = self._nolistvalue.match(value)\n            if mat is None:\n                raise SyntaxError()\n            # NOTE: we don't unquote here\n            return mat.groups()\n        #\n        mat = self._valueexp.match(value)\n        if mat is None:\n            # the value is badly constructed, probably badly quoted,\n            # or an invalid list\n            raise SyntaxError()\n        (list_values, single, empty_list, comment) = mat.groups()\n        if (list_values == '') and (single is None):\n            # change this if you want to accept empty values\n            raise SyntaxError()\n        # NOTE: note there is no error handling from here if the regex\n        # is wrong: then incorrect values will slip through\n        if empty_list is not None:\n            # the single comma - meaning an empty list\n            return ([], comment)\n        if single is not None:\n            # handle empty values\n            if list_values and not single:\n                # FIXME: the '' is a workaround because our regex now matches\n                #   '' at the end of a list if it has a trailing comma\n                single = None\n            else:\n                single = single or '\"\"'\n                single = self._unquote(single)\n        if list_values == '':\n            # not a list value\n            return (single, comment)\n        the_list = self._listvalueexp.findall(list_values)\n        the_list = [self._unquote(val) for val in the_list]\n        if single is not None:\n            the_list += [single]\n        return (the_list, comment)\n\n\n    def _multiline(self, value, infile, cur_index, maxline):\n        \"\"\"Extract the value, where we are in a multiline situation.\"\"\"\n        quot = value[:3]\n        newvalue = value[3:]\n        single_line = self._triple_quote[quot][0]\n        multi_line = self._triple_quote[quot][1]\n        mat = single_line.match(value)\n        if mat is not None:\n            retval = list(mat.groups())\n            retval.append(cur_index)\n            return retval\n        elif newvalue.find(quot) != -1:\n            # somehow the triple quote is missing\n            raise SyntaxError()\n        #\n        while cur_index < maxline:\n            cur_index += 1\n            newvalue += '\\n'\n            line = infile[cur_index]\n            if line.find(quot) == -1:\n                newvalue += line\n            else:\n                # end of multiline, process it\n                break\n        else:\n            # we've got to the end of the config, oops...\n            raise SyntaxError()\n        mat = multi_line.match(line)\n        if mat is None:\n            # a badly formed line\n            raise SyntaxError()\n        (value, comment) = mat.groups()\n        return (newvalue + value, comment, cur_index)\n\n\n    def _handle_configspec(self, configspec):\n        \"\"\"Parse the configspec.\"\"\"\n        # FIXME: Should we check that the configspec was created with the\n        #        correct settings ? (i.e. ``list_values=False``)\n        if not isinstance(configspec, ConfigObj):\n            try:\n                configspec = ConfigObj(configspec,\n                                       raise_errors=True,\n                                       file_error=True,\n                                       _inspec=True)\n            except ConfigObjError as e:\n                # FIXME: Should these errors have a reference\n                #        to the already parsed ConfigObj ?\n                raise ConfigspecError('Parsing configspec failed: %s' % e)\n            except IOError as e:\n                raise IOError('Reading configspec failed: %s' % e)\n\n        self.configspec = configspec\n\n\n\n    def _set_configspec(self, section, copy):\n        \"\"\"\n        Called by validate. Handles setting the configspec on subsections\n        including sections to be validated by __many__\n        \"\"\"\n        configspec = section.configspec\n        many = configspec.get('__many__')\n        if isinstance(many, dict):\n            for entry in section.sections:\n                if entry not in configspec:\n                    section[entry].configspec = many\n\n        for entry in configspec.sections:\n            if entry == '__many__':\n                continue\n            if entry not in section:\n                section[entry] = {}\n                section[entry]._created = True\n                if copy:\n                    # copy comments\n                    section.comments[entry] = configspec.comments.get(entry, [])\n                    section.inline_comments[entry] = configspec.inline_comments.get(entry, '')\n\n            # Could be a scalar when we expect a section\n            if isinstance(section[entry], Section):\n                section[entry].configspec = configspec[entry]\n\n\n    def _write_line(self, indent_string, entry, this_entry, comment):\n        \"\"\"Write an individual line, for the write method\"\"\"\n        # NOTE: the calls to self._quote here handles non-StringType values.\n        if not self.unrepr:\n            val = self._decode_element(self._quote(this_entry))\n        else:\n            val = repr(this_entry)\n        return '%s%s%s%s%s' % (indent_string,\n                               self._decode_element(self._quote(entry, multiline=False)),\n                               self._a_to_u(' = '),\n                               val,\n                               self._decode_element(comment))\n\n\n    def _write_marker(self, indent_string, depth, entry, comment):\n        \"\"\"Write a section marker line\"\"\"\n        return '%s%s%s%s%s' % (indent_string,\n                               self._a_to_u('[' * depth),\n                               self._quote(self._decode_element(entry), multiline=False),\n                               self._a_to_u(']' * depth),\n                               self._decode_element(comment))\n\n\n    def _handle_comment(self, comment):\n        \"\"\"Deal with a comment.\"\"\"\n        if not comment:\n            return ''\n        start = self.indent_type\n        if not comment.startswith('#'):\n            start += self._a_to_u(' # ')\n        return (start + comment)\n\n\n    # Public methods\n\n    def write(self, outfile=None, section=None):\n        \"\"\"\n        Write the current ConfigObj as a file\n\n        tekNico: FIXME: use StringIO instead of real files\n\n        >>> filename = a.filename\n        >>> a.filename = 'test.ini'\n        >>> a.write()\n        >>> a.filename = filename\n        >>> a == ConfigObj('test.ini', raise_errors=True)\n        1\n        >>> import os\n        >>> os.remove('test.ini')\n        \"\"\"\n        if self.indent_type is None:\n            # this can be true if initialised from a dictionary\n            self.indent_type = DEFAULT_INDENT_TYPE\n\n        out = []\n        cs = self._a_to_u('#')\n        csp = self._a_to_u('# ')\n        if section is None:\n            int_val = self.interpolation\n            self.interpolation = False\n            section = self\n            for line in self.initial_comment:\n                line = self._decode_element(line)\n                stripped_line = line.strip()\n                if stripped_line and not stripped_line.startswith(cs):\n                    line = csp + line\n                out.append(line)\n\n        indent_string = self.indent_type * section.depth\n        for entry in (section.scalars + section.sections):\n            if entry in section.defaults:\n                # don't write out default values\n                continue\n            for comment_line in section.comments[entry]:\n                comment_line = self._decode_element(comment_line.lstrip())\n                if comment_line and not comment_line.startswith(cs):\n                    comment_line = csp + comment_line\n                out.append(indent_string + comment_line)\n            this_entry = section[entry]\n            comment = self._handle_comment(section.inline_comments[entry])\n\n            if isinstance(this_entry, Section):\n                # a section\n                out.append(self._write_marker(\n                    indent_string,\n                    this_entry.depth,\n                    entry,\n                    comment))\n                out.extend(self.write(section=this_entry))\n            else:\n                out.append(self._write_line(\n                    indent_string,\n                    entry,\n                    this_entry,\n                    comment))\n\n        if section is self:\n            for line in self.final_comment:\n                line = self._decode_element(line)\n                stripped_line = line.strip()\n                if stripped_line and not stripped_line.startswith(cs):\n                    line = csp + line\n                out.append(line)\n            self.interpolation = int_val\n\n        if section is not self:\n            return out\n\n        if (self.filename is None) and (outfile is None):\n            # output a list of lines\n            # might need to encode\n            # NOTE: This will *screw* UTF16, each line will start with the BOM\n            if self.encoding:\n                out = [l.encode(self.encoding) for l in out]\n            if (self.BOM and ((self.encoding is None) or\n                (BOM_LIST.get(self.encoding.lower()) == 'utf_8'))):\n                # Add the UTF8 BOM\n                if not out:\n                    out.append('')\n                out[0] = BOM_UTF8 + out[0]\n            return out\n\n        # Turn the list to a string, joined with correct newlines\n        newline = self.newlines or os.linesep\n        if (getattr(outfile, 'mode', None) is not None and outfile.mode == 'w'\n            and sys.platform == 'win32' and newline == '\\r\\n'):\n            # Windows specific hack to avoid writing '\\r\\r\\n'\n            newline = '\\n'\n        output = self._a_to_u(newline).join(out)\n        if not output.endswith(newline):\n            output += newline\n\n        if isinstance(output, bytes):\n            output_bytes = output\n        else:\n            output_bytes = output.encode(self.encoding or\n                                         self.default_encoding or\n                                         'ascii')\n\n        if self.BOM and ((self.encoding is None) or match_utf8(self.encoding)):\n            # Add the UTF8 BOM\n            output_bytes = BOM_UTF8 + output_bytes\n\n        if outfile is not None:\n            outfile.write(output_bytes)\n        else:\n            with open(self.filename, 'wb') as h:\n                h.write(output_bytes)\n\n    def validate(self, validator, preserve_errors=False, copy=False,\n                 section=None):\n        \"\"\"\n        Test the ConfigObj against a configspec.\n\n        It uses the ``validator`` object from *validate.py*.\n\n        To run ``validate`` on the current ConfigObj, call: ::\n\n            test = config.validate(validator)\n\n        (Normally having previously passed in the configspec when the ConfigObj\n        was created - you can dynamically assign a dictionary of checks to the\n        ``configspec`` attribute of a section though).\n\n        It returns ``True`` if everything passes, or a dictionary of\n        pass/fails (True/False). If every member of a subsection passes, it\n        will just have the value ``True``. (It also returns ``False`` if all\n        members fail).\n\n        In addition, it converts the values from strings to their native\n        types if their checks pass (and ``stringify`` is set).\n\n        If ``preserve_errors`` is ``True`` (``False`` is default) then instead\n        of a marking a fail with a ``False``, it will preserve the actual\n        exception object. This can contain info about the reason for failure.\n        For example the ``VdtValueTooSmallError`` indicates that the value\n        supplied was too small. If a value (or section) is missing it will\n        still be marked as ``False``.\n\n        You must have the validate module to use ``preserve_errors=True``.\n\n        You can then use the ``flatten_errors`` function to turn your nested\n        results dictionary into a flattened list of failures - useful for\n        displaying meaningful error messages.\n        \"\"\"\n        if section is None:\n            if self.configspec is None:\n                raise ValueError('No configspec supplied.')\n            if preserve_errors:\n                # We do this once to remove a top level dependency on the validate module\n                # Which makes importing configobj faster\n                from .validate import VdtMissingValue\n                self._vdtMissingValue = VdtMissingValue\n\n            section = self\n\n            if copy:\n                section.initial_comment = section.configspec.initial_comment\n                section.final_comment = section.configspec.final_comment\n                section.encoding = section.configspec.encoding\n                section.BOM = section.configspec.BOM\n                section.newlines = section.configspec.newlines\n                section.indent_type = section.configspec.indent_type\n\n        #\n        # section.default_values.clear() #??\n        configspec = section.configspec\n        self._set_configspec(section, copy)\n\n\n        def validate_entry(entry, spec, val, missing, ret_true, ret_false):\n            section.default_values.pop(entry, None)\n\n            try:\n                section.default_values[entry] = validator.get_default_value(configspec[entry])\n            except (KeyError, AttributeError, validator.baseErrorClass):\n                # No default, bad default or validator has no 'get_default_value'\n                # (e.g. SimpleVal)\n                pass\n\n            try:\n                check = validator.check(spec,\n                                        val,\n                                        missing=missing\n                                        )\n            except validator.baseErrorClass as e:\n                if not preserve_errors or isinstance(e, self._vdtMissingValue):\n                    out[entry] = False\n                else:\n                    # preserve the error\n                    out[entry] = e\n                    ret_false = False\n                ret_true = False\n            else:\n                ret_false = False\n                out[entry] = True\n                if self.stringify or missing:\n                    # if we are doing type conversion\n                    # or the value is a supplied default\n                    if not self.stringify:\n                        if isinstance(check, (list, tuple)):\n                            # preserve lists\n                            check = [self._str(item) for item in check]\n                        elif missing and check is None:\n                            # convert the None from a default to a ''\n                            check = ''\n                        else:\n                            check = self._str(check)\n                    if (check != val) or missing:\n                        section[entry] = check\n                if not copy and missing and entry not in section.defaults:\n                    section.defaults.append(entry)\n            return ret_true, ret_false\n\n        #\n        out = {}\n        ret_true = True\n        ret_false = True\n\n        unvalidated = [k for k in section.scalars if k not in configspec]\n        incorrect_sections = [k for k in configspec.sections if k in section.scalars]\n        incorrect_scalars = [k for k in configspec.scalars if k in section.sections]\n\n        for entry in configspec.scalars:\n            if entry in ('__many__', '___many___'):\n                # reserved names\n                continue\n            if (not entry in section.scalars) or (entry in section.defaults):\n                # missing entries\n                # or entries from defaults\n                missing = True\n                val = None\n                if copy and entry not in section.scalars:\n                    # copy comments\n                    section.comments[entry] = (\n                        configspec.comments.get(entry, []))\n                    section.inline_comments[entry] = (\n                        configspec.inline_comments.get(entry, ''))\n                #\n            else:\n                missing = False\n                val = section[entry]\n\n            ret_true, ret_false = validate_entry(entry, configspec[entry], val,\n                                                 missing, ret_true, ret_false)\n\n        many = None\n        if '__many__' in configspec.scalars:\n            many = configspec['__many__']\n        elif '___many___' in configspec.scalars:\n            many = configspec['___many___']\n\n        if many is not None:\n            for entry in unvalidated:\n                val = section[entry]\n                ret_true, ret_false = validate_entry(entry, many, val, False,\n                                                     ret_true, ret_false)\n            unvalidated = []\n\n        for entry in incorrect_scalars:\n            ret_true = False\n            if not preserve_errors:\n                out[entry] = False\n            else:\n                ret_false = False\n                msg = 'Value %r was provided as a section' % entry\n                out[entry] = validator.baseErrorClass(msg)\n        for entry in incorrect_sections:\n            ret_true = False\n            if not preserve_errors:\n                out[entry] = False\n            else:\n                ret_false = False\n                msg = 'Section %r was provided as a single value' % entry\n                out[entry] = validator.baseErrorClass(msg)\n\n        # Missing sections will have been created as empty ones when the\n        # configspec was read.\n        for entry in section.sections:\n            # FIXME: this means DEFAULT is not copied in copy mode\n            if section is self and entry == 'DEFAULT':\n                continue\n            if section[entry].configspec is None:\n                unvalidated.append(entry)\n                continue\n            if copy:\n                section.comments[entry] = configspec.comments.get(entry, [])\n                section.inline_comments[entry] = configspec.inline_comments.get(entry, '')\n            check = self.validate(validator, preserve_errors=preserve_errors, copy=copy, section=section[entry])\n            out[entry] = check\n            if check == False:\n                ret_true = False\n            elif check == True:\n                ret_false = False\n            else:\n                ret_true = False\n\n        section.extra_values = unvalidated\n        if preserve_errors and not section._created:\n            # If the section wasn't created (i.e. it wasn't missing)\n            # then we can't return False, we need to preserve errors\n            ret_false = False\n        #\n        if ret_false and preserve_errors and out:\n            # If we are preserving errors, but all\n            # the failures are from missing sections / values\n            # then we can return False. Otherwise there is a\n            # real failure that we need to preserve.\n            ret_false = not any(out.values())\n        if ret_true:\n            return True\n        elif ret_false:\n            return False\n        return out\n\n\n    def reset(self):\n        \"\"\"Clear ConfigObj instance and restore to 'freshly created' state.\"\"\"\n        self.clear()\n        self._initialise()\n        # FIXME: Should be done by '_initialise', but ConfigObj constructor (and reload)\n        #        requires an empty dictionary\n        self.configspec = None\n        # Just to be sure ;-)\n        self._original_configspec = None\n\n\n    def reload(self):\n        \"\"\"\n        Reload a ConfigObj from file.\n\n        This method raises a ``ReloadError`` if the ConfigObj doesn't have\n        a filename attribute pointing to a file.\n        \"\"\"\n        if not isinstance(self.filename, str):\n            raise ReloadError()\n\n        filename = self.filename\n        current_options = {}\n        for entry in OPTION_DEFAULTS:\n            if entry == 'configspec':\n                continue\n            current_options[entry] = getattr(self, entry)\n\n        configspec = self._original_configspec\n        current_options['configspec'] = configspec\n\n        self.clear()\n        self._initialise(current_options)\n        self._load(filename, configspec)"},{"col":4,"comment":"null","endLoc":1344,"header":"def __str__(self)","id":11853,"name":"__str__","nodeType":"Function","startLoc":1343,"text":"def __str__(self):\n        return self.str"},{"col":4,"comment":"null","endLoc":1347,"header":"def __repr__(self)","id":11854,"name":"__repr__","nodeType":"Function","startLoc":1346,"text":"def __repr__(self):\n        return 'Production(' + str(self) + ')'"},{"col":4,"comment":"null","endLoc":1350,"header":"def __len__(self)","id":11855,"name":"__len__","nodeType":"Function","startLoc":1349,"text":"def __len__(self):\n        return len(self.prod)"},{"col":0,"comment":"\n    Reshape a data array into blocks.\n\n    This is useful to efficiently apply functions on block subsets of\n    the data instead of using loops.  The reshaped array is a view of\n    the input data array.\n\n    .. versionadded:: 4.1\n\n    Parameters\n    ----------\n    data : ndarray\n        The input data array.\n\n    block_size : int or array-like (int)\n        The integer block size along each axis.  If ``block_size`` is a\n        scalar and ``data`` has more than one dimension, then\n        ``block_size`` will be used for for every axis.  Each dimension\n        of ``block_size`` must divide evenly into the corresponding\n        dimension of ``data``.\n\n    Returns\n    -------\n    output : ndarray\n        The reshaped array as a view of the input ``data`` array.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.nddata import reshape_as_blocks\n    >>> data = np.arange(16).reshape(4, 4)\n    >>> data\n    array([[ 0,  1,  2,  3],\n           [ 4,  5,  6,  7],\n           [ 8,  9, 10, 11],\n           [12, 13, 14, 15]])\n    >>> reshape_as_blocks(data, (2, 2))\n    array([[[[ 0,  1],\n             [ 4,  5]],\n            [[ 2,  3],\n             [ 6,  7]]],\n           [[[ 8,  9],\n             [12, 13]],\n            [[10, 11],\n             [14, 15]]]])\n    ","endLoc":93,"header":"def reshape_as_blocks(data, block_size)","id":11856,"name":"reshape_as_blocks","nodeType":"Function","startLoc":34,"text":"def reshape_as_blocks(data, block_size):\n    \"\"\"\n    Reshape a data array into blocks.\n\n    This is useful to efficiently apply functions on block subsets of\n    the data instead of using loops.  The reshaped array is a view of\n    the input data array.\n\n    .. versionadded:: 4.1\n\n    Parameters\n    ----------\n    data : ndarray\n        The input data array.\n\n    block_size : int or array-like (int)\n        The integer block size along each axis.  If ``block_size`` is a\n        scalar and ``data`` has more than one dimension, then\n        ``block_size`` will be used for for every axis.  Each dimension\n        of ``block_size`` must divide evenly into the corresponding\n        dimension of ``data``.\n\n    Returns\n    -------\n    output : ndarray\n        The reshaped array as a view of the input ``data`` array.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.nddata import reshape_as_blocks\n    >>> data = np.arange(16).reshape(4, 4)\n    >>> data\n    array([[ 0,  1,  2,  3],\n           [ 4,  5,  6,  7],\n           [ 8,  9, 10, 11],\n           [12, 13, 14, 15]])\n    >>> reshape_as_blocks(data, (2, 2))\n    array([[[[ 0,  1],\n             [ 4,  5]],\n            [[ 2,  3],\n             [ 6,  7]]],\n           [[[ 8,  9],\n             [12, 13]],\n            [[10, 11],\n             [14, 15]]]])\n    \"\"\"\n\n    data, block_size = _process_block_inputs(data, block_size)\n\n    if np.any(np.mod(data.shape, block_size) != 0):\n        raise ValueError('Each dimension of block_size must divide evenly '\n                         'into the corresponding dimension of data')\n\n    nblocks = np.array(data.shape) // block_size\n    new_shape = tuple(k for ij in zip(nblocks, block_size) for k in ij)\n    nblocks_idx = tuple(range(0, len(new_shape), 2))  # even indices\n    block_idx = tuple(range(1, len(new_shape), 2))  # odd indices\n\n    return data.reshape(new_shape).transpose(nblocks_idx + block_idx)"},{"col":4,"comment":"null","endLoc":1353,"header":"def __nonzero__(self)","id":11857,"name":"__nonzero__","nodeType":"Function","startLoc":1352,"text":"def __nonzero__(self):\n        return 1"},{"col":4,"comment":"null","endLoc":1356,"header":"def __getitem__(self, index)","id":11858,"name":"__getitem__","nodeType":"Function","startLoc":1355,"text":"def __getitem__(self, index):\n        return self.prod[index]"},{"col":4,"comment":"null","endLoc":1372,"header":"def lr_item(self, n)","id":11859,"name":"lr_item","nodeType":"Function","startLoc":1359,"text":"def lr_item(self, n):\n        if n > len(self.prod):\n            return None\n        p = LRItem(self, n)\n        # Precompute the list of productions immediately following.\n        try:\n            p.lr_after = self.Prodnames[p.prod[n+1]]\n        except (IndexError, KeyError):\n            p.lr_after = []\n        try:\n            p.lr_before = p.prod[n-1]\n        except IndexError:\n            p.lr_before = None\n        return p"},{"col":4,"comment":"null","endLoc":743,"header":"def parsegen(self,input,source=None)","id":11860,"name":"parsegen","nodeType":"Function","startLoc":620,"text":"def parsegen(self,input,source=None):\n\n        # Replace trigraph sequences\n        t = trigraph(input)\n        lines = self.group_lines(t)\n\n        if not source:\n            source = \"\"\n\n        self.define(\"__FILE__ \\\"%s\\\"\" % source)\n\n        self.source = source\n        chunk = []\n        enable = True\n        iftrigger = False\n        ifstack = []\n\n        for x in lines:\n            for i,tok in enumerate(x):\n                if tok.type not in self.t_WS: break\n            if tok.value == '#':\n                # Preprocessor directive\n\n                # insert necessary whitespace instead of eaten tokens\n                for tok in x:\n                    if tok.type in self.t_WS and '\\n' in tok.value:\n                        chunk.append(tok)\n\n                dirtokens = self.tokenstrip(x[i+1:])\n                if dirtokens:\n                    name = dirtokens[0].value\n                    args = self.tokenstrip(dirtokens[1:])\n                else:\n                    name = \"\"\n                    args = []\n\n                if name == 'define':\n                    if enable:\n                        for tok in self.expand_macros(chunk):\n                            yield tok\n                        chunk = []\n                        self.define(args)\n                elif name == 'include':\n                    if enable:\n                        for tok in self.expand_macros(chunk):\n                            yield tok\n                        chunk = []\n                        oldfile = self.macros['__FILE__']\n                        for tok in self.include(args):\n                            yield tok\n                        self.macros['__FILE__'] = oldfile\n                        self.source = source\n                elif name == 'undef':\n                    if enable:\n                        for tok in self.expand_macros(chunk):\n                            yield tok\n                        chunk = []\n                        self.undef(args)\n                elif name == 'ifdef':\n                    ifstack.append((enable,iftrigger))\n                    if enable:\n                        if not args[0].value in self.macros:\n                            enable = False\n                            iftrigger = False\n                        else:\n                            iftrigger = True\n                elif name == 'ifndef':\n                    ifstack.append((enable,iftrigger))\n                    if enable:\n                        if args[0].value in self.macros:\n                            enable = False\n                            iftrigger = False\n                        else:\n                            iftrigger = True\n                elif name == 'if':\n                    ifstack.append((enable,iftrigger))\n                    if enable:\n                        result = self.evalexpr(args)\n                        if not result:\n                            enable = False\n                            iftrigger = False\n                        else:\n                            iftrigger = True\n                elif name == 'elif':\n                    if ifstack:\n                        if ifstack[-1][0]:     # We only pay attention if outer \"if\" allows this\n                            if enable:         # If already true, we flip enable False\n                                enable = False\n                            elif not iftrigger:   # If False, but not triggered yet, we'll check expression\n                                result = self.evalexpr(args)\n                                if result:\n                                    enable  = True\n                                    iftrigger = True\n                    else:\n                        self.error(self.source,dirtokens[0].lineno,\"Misplaced #elif\")\n\n                elif name == 'else':\n                    if ifstack:\n                        if ifstack[-1][0]:\n                            if enable:\n                                enable = False\n                            elif not iftrigger:\n                                enable = True\n                                iftrigger = True\n                    else:\n                        self.error(self.source,dirtokens[0].lineno,\"Misplaced #else\")\n\n                elif name == 'endif':\n                    if ifstack:\n                        enable,iftrigger = ifstack.pop()\n                    else:\n                        self.error(self.source,dirtokens[0].lineno,\"Misplaced #endif\")\n                else:\n                    # Unknown preprocessor directive\n                    pass\n\n            else:\n                # Normal text\n                if enable:\n                    chunk.extend(x)\n\n        for tok in self.expand_macros(chunk):\n            yield tok\n        chunk = []"},{"col":4,"comment":"\n        Base method which calculates the result of the arithmetic operation.\n\n        This method determines the result of the arithmetic operation on the\n        ``data`` including their units and then forwards to other methods\n        to calculate the other properties for the result (like uncertainty).\n\n        Parameters\n        ----------\n        operation : callable\n            The operation that is performed on the `NDData`. Supported are\n            `numpy.add`, `numpy.subtract`, `numpy.multiply` and\n            `numpy.true_divide`.\n\n        operand : same type (class) as self\n            see :meth:`NDArithmeticMixin.add`\n\n        propagate_uncertainties : `bool` or ``None``, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        handle_mask : callable, ``'first_found'`` or ``None``, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        handle_meta : callable, ``'first_found'`` or ``None``, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        compare_wcs : callable, ``'first_found'`` or ``None``, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        uncertainty_correlation : ``Number`` or `~numpy.ndarray`, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        kwargs :\n            Any other parameter that should be passed to the\n            different :meth:`NDArithmeticMixin._arithmetic_mask` (or wcs, ...)\n            methods.\n\n        Returns\n        -------\n        result : ndarray or `~astropy.units.Quantity`\n            The resulting data as array (in case both operands were without\n            unit) or as quantity if at least one had a unit.\n\n        kwargs : `dict`\n            The kwargs should contain all the other attributes (besides data\n            and unit) needed to create a new instance for the result. Creating\n            the new instance is up to the calling method, for example\n            :meth:`NDArithmeticMixin.add`.\n\n        ","endLoc":284,"header":"def _arithmetic(self, operation, operand,\n                    propagate_uncertainties=True, handle_mask=np.logical_or,\n                    handle_meta=None, uncertainty_correlation=0,\n                    compare_wcs='first_found', **kwds)","id":11861,"name":"_arithmetic","nodeType":"Function","startLoc":164,"text":"def _arithmetic(self, operation, operand,\n                    propagate_uncertainties=True, handle_mask=np.logical_or,\n                    handle_meta=None, uncertainty_correlation=0,\n                    compare_wcs='first_found', **kwds):\n        \"\"\"\n        Base method which calculates the result of the arithmetic operation.\n\n        This method determines the result of the arithmetic operation on the\n        ``data`` including their units and then forwards to other methods\n        to calculate the other properties for the result (like uncertainty).\n\n        Parameters\n        ----------\n        operation : callable\n            The operation that is performed on the `NDData`. Supported are\n            `numpy.add`, `numpy.subtract`, `numpy.multiply` and\n            `numpy.true_divide`.\n\n        operand : same type (class) as self\n            see :meth:`NDArithmeticMixin.add`\n\n        propagate_uncertainties : `bool` or ``None``, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        handle_mask : callable, ``'first_found'`` or ``None``, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        handle_meta : callable, ``'first_found'`` or ``None``, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        compare_wcs : callable, ``'first_found'`` or ``None``, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        uncertainty_correlation : ``Number`` or `~numpy.ndarray`, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        kwargs :\n            Any other parameter that should be passed to the\n            different :meth:`NDArithmeticMixin._arithmetic_mask` (or wcs, ...)\n            methods.\n\n        Returns\n        -------\n        result : ndarray or `~astropy.units.Quantity`\n            The resulting data as array (in case both operands were without\n            unit) or as quantity if at least one had a unit.\n\n        kwargs : `dict`\n            The kwargs should contain all the other attributes (besides data\n            and unit) needed to create a new instance for the result. Creating\n            the new instance is up to the calling method, for example\n            :meth:`NDArithmeticMixin.add`.\n\n        \"\"\"\n        # Find the appropriate keywords for the appropriate method (not sure\n        # if data and uncertainty are ever used ...)\n        kwds2 = {'mask': {}, 'meta': {}, 'wcs': {},\n                 'data': {}, 'uncertainty': {}}\n        for i in kwds:\n            splitted = i.split('_', 1)\n            try:\n                kwds2[splitted[0]][splitted[1]] = kwds[i]\n            except KeyError:\n                raise KeyError(f'Unknown prefix {splitted[0]} for parameter {i}')\n\n        kwargs = {}\n\n        # First check that the WCS allows the arithmetic operation\n        if compare_wcs is None:\n            kwargs['wcs'] = None\n        elif compare_wcs in ['ff', 'first_found']:\n            if self.wcs is None:\n                kwargs['wcs'] = deepcopy(operand.wcs)\n            else:\n                kwargs['wcs'] = deepcopy(self.wcs)\n        else:\n            kwargs['wcs'] = self._arithmetic_wcs(operation, operand,\n                                                 compare_wcs, **kwds2['wcs'])\n\n        # Then calculate the resulting data (which can but not needs to be a\n        # quantity)\n        result = self._arithmetic_data(operation, operand, **kwds2['data'])\n\n        # Determine the other properties\n        if propagate_uncertainties is None:\n            kwargs['uncertainty'] = None\n        elif not propagate_uncertainties:\n            if self.uncertainty is None:\n                kwargs['uncertainty'] = deepcopy(operand.uncertainty)\n            else:\n                kwargs['uncertainty'] = deepcopy(self.uncertainty)\n        else:\n            kwargs['uncertainty'] = self._arithmetic_uncertainty(\n                operation, operand, result, uncertainty_correlation,\n                **kwds2['uncertainty'])\n\n        if handle_mask is None:\n            kwargs['mask'] = None\n        elif handle_mask in ['ff', 'first_found']:\n            if self.mask is None:\n                kwargs['mask'] = deepcopy(operand.mask)\n            else:\n                kwargs['mask'] = deepcopy(self.mask)\n        else:\n            kwargs['mask'] = self._arithmetic_mask(operation, operand,\n                                                   handle_mask,\n                                                   **kwds2['mask'])\n\n        if handle_meta is None:\n            kwargs['meta'] = None\n        elif handle_meta in ['ff', 'first_found']:\n            if not self.meta:\n                kwargs['meta'] = deepcopy(operand.meta)\n            else:\n                kwargs['meta'] = deepcopy(self.meta)\n        else:\n            kwargs['meta'] = self._arithmetic_meta(\n                operation, operand, handle_meta, **kwds2['meta'])\n\n        # Wrap the individual results into a new instance of the same class.\n        return result, kwargs"},{"col":4,"comment":"null","endLoc":1366,"header":"def __repr__(self)","id":11862,"name":"__repr__","nodeType":"Function","startLoc":1358,"text":"def __repr__(self):\n        def _getval(key):\n            try:\n                return self[key]\n            except MissingInterpolationOption:\n                return dict.__getitem__(self, key)\n        return ('%s({%s})' % (self.__class__.__name__,\n                ', '.join([('%s: %s' % (repr(key), repr(_getval(key))))\n                for key in (self.scalars + self.sections)])))"},{"col":4,"comment":"Decode ASCII strings to unicode if a self.encoding is specified.","endLoc":1486,"header":"def _a_to_u(self, aString)","id":11864,"name":"_a_to_u","nodeType":"Function","startLoc":1481,"text":"def _a_to_u(self, aString):\n        \"\"\"Decode ASCII strings to unicode if a self.encoding is specified.\"\"\"\n        if isinstance(aString, bytes) and self.encoding:\n            return aString.decode(self.encoding)\n        else:\n            return aString"},{"col":0,"comment":"\n    Downsample a data array by applying a function to local blocks.\n\n    If ``data`` is not perfectly divisible by ``block_size`` along a\n    given axis then the data will be trimmed (from the end) along that\n    axis.\n\n    Parameters\n    ----------\n    data : array-like\n        The data to be resampled.\n\n    block_size : int or array-like (int)\n        The integer block size along each axis.  If ``block_size`` is a\n        scalar and ``data`` has more than one dimension, then\n        ``block_size`` will be used for for every axis.\n\n    func : callable, optional\n        The method to use to downsample the data.  Must be a callable\n        that takes in a `~numpy.ndarray` along with an ``axis`` keyword,\n        which defines the axis or axes along which the function is\n        applied.  The ``axis`` keyword must accept multiple axes as a\n        tuple.  The default is `~numpy.sum`, which provides block\n        summation (and conserves the data sum).\n\n    Returns\n    -------\n    output : array-like\n        The resampled data.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.nddata import block_reduce\n    >>> data = np.arange(16).reshape(4, 4)\n    >>> block_reduce(data, 2)  # doctest: +FLOAT_CMP\n    array([[10, 18],\n           [42, 50]])\n\n    >>> block_reduce(data, 2, func=np.mean)  # doctest: +FLOAT_CMP\n    array([[  2.5,   4.5],\n           [ 10.5,  12.5]])\n    ","endLoc":156,"header":"@support_nddata\ndef block_reduce(data, block_size, func=np.sum)","id":11865,"name":"block_reduce","nodeType":"Function","startLoc":96,"text":"@support_nddata\ndef block_reduce(data, block_size, func=np.sum):\n    \"\"\"\n    Downsample a data array by applying a function to local blocks.\n\n    If ``data`` is not perfectly divisible by ``block_size`` along a\n    given axis then the data will be trimmed (from the end) along that\n    axis.\n\n    Parameters\n    ----------\n    data : array-like\n        The data to be resampled.\n\n    block_size : int or array-like (int)\n        The integer block size along each axis.  If ``block_size`` is a\n        scalar and ``data`` has more than one dimension, then\n        ``block_size`` will be used for for every axis.\n\n    func : callable, optional\n        The method to use to downsample the data.  Must be a callable\n        that takes in a `~numpy.ndarray` along with an ``axis`` keyword,\n        which defines the axis or axes along which the function is\n        applied.  The ``axis`` keyword must accept multiple axes as a\n        tuple.  The default is `~numpy.sum`, which provides block\n        summation (and conserves the data sum).\n\n    Returns\n    -------\n    output : array-like\n        The resampled data.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.nddata import block_reduce\n    >>> data = np.arange(16).reshape(4, 4)\n    >>> block_reduce(data, 2)  # doctest: +FLOAT_CMP\n    array([[10, 18],\n           [42, 50]])\n\n    >>> block_reduce(data, 2, func=np.mean)  # doctest: +FLOAT_CMP\n    array([[  2.5,   4.5],\n           [ 10.5,  12.5]])\n    \"\"\"\n\n    data, block_size = _process_block_inputs(data, block_size)\n    nblocks = np.array(data.shape) // block_size\n    size_init = nblocks * block_size  # evenly-divisible size\n\n    # trim data if necessary\n    for axis in range(data.ndim):\n        if data.shape[axis] != size_init[axis]:\n            data = data.swapaxes(0, axis)\n            data = data[:size_init[axis]]\n            data = data.swapaxes(0, axis)\n\n    reshaped = reshape_as_blocks(data, block_size)\n    axis = tuple(range(data.ndim, reshaped.ndim))\n\n    return func(reshaped, axis=axis)"},{"col":4,"comment":"null","endLoc":158,"header":"def __getattr__(cls, name)","id":11866,"name":"__getattr__","nodeType":"Function","startLoc":148,"text":"def __getattr__(cls, name):\n        if _ENABLE_BITFLAG_CACHING:\n            flagnames = cls._cache\n        else:\n            flagnames = {k.lower(): v for k, v in cls.__dict__.items()}\n            flagnames.update({k.lower(): v for b in cls.__bases__\n                              for k, v in b.__dict__.items()})\n        try:\n            return flagnames[name.lower()]\n        except KeyError:\n            raise AttributeError(f\"Flag '{name}' not defined\")"},{"col":4,"comment":"null","endLoc":1439,"header":"def __init__(self, p, n)","id":11867,"name":"__init__","nodeType":"Function","startLoc":1430,"text":"def __init__(self, p, n):\n        self.name       = p.name\n        self.prod       = list(p.prod)\n        self.number     = p.number\n        self.lr_index   = n\n        self.lookaheads = {}\n        self.prod.insert(n, '.')\n        self.prod       = tuple(self.prod)\n        self.len        = len(self.prod)\n        self.usyms      = p.usyms"},{"col":4,"comment":"null","endLoc":1377,"header":"def bind(self, pdict)","id":11868,"name":"bind","nodeType":"Function","startLoc":1375,"text":"def bind(self, pdict):\n        if self.func:\n            self.callable = pdict[self.func]"},{"attributeType":"null","col":4,"comment":"null","endLoc":1312,"id":11869,"name":"reduced","nodeType":"Attribute","startLoc":1312,"text":"reduced"},{"attributeType":"null","col":8,"comment":"null","endLoc":1315,"id":11870,"name":"prod","nodeType":"Attribute","startLoc":1315,"text":"self.prod"},{"attributeType":"None","col":8,"comment":"null","endLoc":1318,"id":11871,"name":"callable","nodeType":"Attribute","startLoc":1318,"text":"self.callable"},{"col":4,"comment":"\n        Calculate the resulting wcs.\n\n        There is actually no calculation involved but it is a good place to\n        compare wcs information of both operands. This is currently not working\n        properly with `~astropy.wcs.WCS` (which is the suggested class for\n        storing as wcs property) but it will not break it neither.\n\n        Parameters\n        ----------\n        operation : callable\n            see :meth:`NDArithmeticMixin._arithmetic` parameter description.\n            By default, the ``operation`` will be ignored.\n\n        operand : `NDData` instance or subclass\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        compare_wcs : callable\n            see :meth:`NDArithmeticMixin.add` parameter description.\n\n        kwds :\n            Additional parameters given to ``compare_wcs``.\n\n        Raises\n        ------\n        ValueError\n            If ``compare_wcs`` returns ``False``.\n\n        Returns\n        -------\n        result_wcs : any type\n            The ``wcs`` of the first operand is returned.\n        ","endLoc":485,"header":"def _arithmetic_wcs(self, operation, operand, compare_wcs, **kwds)","id":11872,"name":"_arithmetic_wcs","nodeType":"Function","startLoc":440,"text":"def _arithmetic_wcs(self, operation, operand, compare_wcs, **kwds):\n        \"\"\"\n        Calculate the resulting wcs.\n\n        There is actually no calculation involved but it is a good place to\n        compare wcs information of both operands. This is currently not working\n        properly with `~astropy.wcs.WCS` (which is the suggested class for\n        storing as wcs property) but it will not break it neither.\n\n        Parameters\n        ----------\n        operation : callable\n            see :meth:`NDArithmeticMixin._arithmetic` parameter description.\n            By default, the ``operation`` will be ignored.\n\n        operand : `NDData` instance or subclass\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        compare_wcs : callable\n            see :meth:`NDArithmeticMixin.add` parameter description.\n\n        kwds :\n            Additional parameters given to ``compare_wcs``.\n\n        Raises\n        ------\n        ValueError\n            If ``compare_wcs`` returns ``False``.\n\n        Returns\n        -------\n        result_wcs : any type\n            The ``wcs`` of the first operand is returned.\n        \"\"\"\n\n        # ok, not really arithmetics but we need to check which wcs makes sense\n        # for the result and this is an ideal place to compare the two WCS,\n        # too.\n\n        # I'll assume that the comparison returned None or False in case they\n        # are not equal.\n        if not compare_wcs(self.wcs, operand.wcs, **kwds):\n            raise ValueError(\"WCS are not equal.\")\n\n        return deepcopy(self.wcs)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1320,"id":11873,"name":"line","nodeType":"Attribute","startLoc":1320,"text":"self.line"},{"col":4,"comment":"\n        Calculate the resulting data\n\n        Parameters\n        ----------\n        operation : callable\n            see `NDArithmeticMixin._arithmetic` parameter description.\n\n        operand : `NDData`-like instance\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        kwds :\n            Additional parameters.\n\n        Returns\n        -------\n        result_data : ndarray or `~astropy.units.Quantity`\n            If both operands had no unit the resulting data is a simple numpy\n            array, but if any of the operands had a unit the return is a\n            Quantity.\n        ","endLoc":323,"header":"def _arithmetic_data(self, operation, operand, **kwds)","id":11874,"name":"_arithmetic_data","nodeType":"Function","startLoc":286,"text":"def _arithmetic_data(self, operation, operand, **kwds):\n        \"\"\"\n        Calculate the resulting data\n\n        Parameters\n        ----------\n        operation : callable\n            see `NDArithmeticMixin._arithmetic` parameter description.\n\n        operand : `NDData`-like instance\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        kwds :\n            Additional parameters.\n\n        Returns\n        -------\n        result_data : ndarray or `~astropy.units.Quantity`\n            If both operands had no unit the resulting data is a simple numpy\n            array, but if any of the operands had a unit the return is a\n            Quantity.\n        \"\"\"\n\n        # Do the calculation with or without units\n        if self.unit is None and operand.unit is None:\n            result = operation(self.data, operand.data)\n        elif self.unit is None:\n            result = operation(self.data << dimensionless_unscaled,\n                               operand.data << operand.unit)\n        elif operand.unit is None:\n            result = operation(self.data << self.unit,\n                               operand.data << dimensionless_unscaled)\n        else:\n            result = operation(self.data << self.unit,\n                               operand.data << operand.unit)\n\n        return result"},{"col":4,"comment":"Decode element to unicode if necessary.","endLoc":1519,"header":"def _decode_element(self, line)","id":11875,"name":"_decode_element","nodeType":"Function","startLoc":1514,"text":"def _decode_element(self, line):\n        \"\"\"Decode element to unicode if necessary.\"\"\"\n        if isinstance(line, bytes) and self.default_encoding:\n            return line.decode(self.default_encoding)\n        else:\n            return line"},{"attributeType":"null","col":8,"comment":"null","endLoc":1328,"id":11876,"name":"usyms","nodeType":"Attribute","startLoc":1328,"text":"self.usyms"},{"attributeType":"null","col":12,"comment":"null","endLoc":1341,"id":11877,"name":"str","nodeType":"Attribute","startLoc":1341,"text":"self.str"},{"col":4,"comment":"\n        Calculate the resulting uncertainty.\n\n        Parameters\n        ----------\n        operation : callable\n            see :meth:`NDArithmeticMixin._arithmetic` parameter description.\n\n        operand : `NDData`-like instance\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        result : `~astropy.units.Quantity` or `~numpy.ndarray`\n            The result of :meth:`NDArithmeticMixin._arithmetic_data`.\n\n        correlation : number or `~numpy.ndarray`\n            see :meth:`NDArithmeticMixin.add` parameter description.\n\n        kwds :\n            Additional parameters.\n\n        Returns\n        -------\n        result_uncertainty : `NDUncertainty` subclass instance or None\n            The resulting uncertainty already saved in the same `NDUncertainty`\n            subclass that ``self`` had (or ``operand`` if self had no\n            uncertainty). ``None`` only if both had no uncertainty.\n        ","endLoc":395,"header":"def _arithmetic_uncertainty(self, operation, operand, result, correlation,\n                                **kwds)","id":11878,"name":"_arithmetic_uncertainty","nodeType":"Function","startLoc":325,"text":"def _arithmetic_uncertainty(self, operation, operand, result, correlation,\n                                **kwds):\n        \"\"\"\n        Calculate the resulting uncertainty.\n\n        Parameters\n        ----------\n        operation : callable\n            see :meth:`NDArithmeticMixin._arithmetic` parameter description.\n\n        operand : `NDData`-like instance\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        result : `~astropy.units.Quantity` or `~numpy.ndarray`\n            The result of :meth:`NDArithmeticMixin._arithmetic_data`.\n\n        correlation : number or `~numpy.ndarray`\n            see :meth:`NDArithmeticMixin.add` parameter description.\n\n        kwds :\n            Additional parameters.\n\n        Returns\n        -------\n        result_uncertainty : `NDUncertainty` subclass instance or None\n            The resulting uncertainty already saved in the same `NDUncertainty`\n            subclass that ``self`` had (or ``operand`` if self had no\n            uncertainty). ``None`` only if both had no uncertainty.\n        \"\"\"\n\n        # Make sure these uncertainties are NDUncertainties so this kind of\n        # propagation is possible.\n        if (self.uncertainty is not None and\n                not isinstance(self.uncertainty, NDUncertainty)):\n            raise TypeError(\"Uncertainty propagation is only defined for \"\n                            \"subclasses of NDUncertainty.\")\n        if (operand.uncertainty is not None and\n                not isinstance(operand.uncertainty, NDUncertainty)):\n            raise TypeError(\"Uncertainty propagation is only defined for \"\n                            \"subclasses of NDUncertainty.\")\n\n        # Now do the uncertainty propagation\n        # TODO: There is no enforced requirement that actually forbids the\n        # uncertainty to have negative entries but with correlation the\n        # sign of the uncertainty DOES matter.\n        if self.uncertainty is None and operand.uncertainty is None:\n            # Neither has uncertainties so the result should have none.\n            return None\n        elif self.uncertainty is None:\n            # Create a temporary uncertainty to allow uncertainty propagation\n            # to yield the correct results. (issue #4152)\n            self.uncertainty = operand.uncertainty.__class__(None)\n            result_uncert = self.uncertainty.propagate(operation, operand,\n                                                       result, correlation)\n            # Delete the temporary uncertainty again.\n            self.uncertainty = None\n            return result_uncert\n\n        elif operand.uncertainty is None:\n            # As with self.uncertainty is None but the other way around.\n            operand.uncertainty = self.uncertainty.__class__(None)\n            result_uncert = self.uncertainty.propagate(operation, operand,\n                                                       result, correlation)\n            operand.uncertainty = None\n            return result_uncert\n\n        else:\n            # Both have uncertainties so just propagate.\n            return self.uncertainty.propagate(operation, operand, result,\n                                              correlation)"},{"col":4,"comment":"\n        Used by ``stringify`` within validate, to turn non-string values\n        into strings.\n        ","endLoc":1533,"header":"def _str(self, value)","id":11879,"name":"_str","nodeType":"Function","startLoc":1523,"text":"def _str(self, value):\n        \"\"\"\n        Used by ``stringify`` within validate, to turn non-string values\n        into strings.\n        \"\"\"\n        if not isinstance(value, str):\n            # intentially 'str' because it's just whatever the \"normal\"\n            # string type is for the python version we're dealing with\n            return str(value)\n        else:\n            return value"},{"col":4,"comment":"\n        Return a safely quoted version of a value.\n\n        Raise a ConfigObjError if the value cannot be safely quoted.\n        If multiline is ``True`` (default) then use triple quotes\n        if necessary.\n\n        * Don't quote values that don't need it.\n        * Recursively quote members of a list and return a comma joined list.\n        * Multiline is ``False`` for lists.\n        * Obey list syntax for empty and single member lists.\n\n        If ``list_values=False`` then the value is only quoted if it contains\n        a ``\\n`` (is multiline) or '#'.\n\n        If ``write_empty_values`` is set, and the value is an empty string, it\n        won't be quoted.\n        ","endLoc":1819,"header":"def _quote(self, value, multiline=True)","id":11880,"name":"_quote","nodeType":"Function","startLoc":1751,"text":"def _quote(self, value, multiline=True):\n        \"\"\"\n        Return a safely quoted version of a value.\n\n        Raise a ConfigObjError if the value cannot be safely quoted.\n        If multiline is ``True`` (default) then use triple quotes\n        if necessary.\n\n        * Don't quote values that don't need it.\n        * Recursively quote members of a list and return a comma joined list.\n        * Multiline is ``False`` for lists.\n        * Obey list syntax for empty and single member lists.\n\n        If ``list_values=False`` then the value is only quoted if it contains\n        a ``\\\\n`` (is multiline) or '#'.\n\n        If ``write_empty_values`` is set, and the value is an empty string, it\n        won't be quoted.\n        \"\"\"\n        if multiline and self.write_empty_values and value == '':\n            # Only if multiline is set, so that it is used for values not\n            # keys, and not values that are part of a list\n            return ''\n\n        if multiline and isinstance(value, (list, tuple)):\n            if not value:\n                return ','\n            elif len(value) == 1:\n                return self._quote(value[0], multiline=False) + ','\n            return ', '.join([self._quote(val, multiline=False)\n                for val in value])\n        if not isinstance(value, str):\n            if self.stringify:\n                # intentially 'str' because it's just whatever the \"normal\"\n                # string type is for the python version we're dealing with\n                value = str(value)\n            else:\n                raise TypeError('Value \"%s\" is not a string.' % value)\n\n        if not value:\n            return '\"\"'\n\n        no_lists_no_quotes = not self.list_values and '\\n' not in value and '#' not in value\n        need_triple = multiline and (((\"'\" in value) and ('\"' in value)) or ('\\n' in value ))\n        hash_triple_quote = multiline and not need_triple and (\"'\" in value) and ('\"' in value) and ('#' in value)\n        check_for_single = (no_lists_no_quotes or not need_triple) and not hash_triple_quote\n\n        if check_for_single:\n            if not self.list_values:\n                # we don't quote if ``list_values=False``\n                quot = noquot\n            # for normal values either single or double quotes will do\n            elif '\\n' in value:\n                # will only happen if multiline is off - e.g. '\\n' in key\n                raise ConfigObjError('Value \"%s\" cannot be safely quoted.' % value)\n            elif ((value[0] not in wspace_plus) and\n                    (value[-1] not in wspace_plus) and\n                    (',' not in value)):\n                quot = noquot\n            else:\n                quot = self._get_single_quote(value)\n        else:\n            # if value has '\\n' or \"'\" *and* '\"', it will need triple quotes\n            quot = self._get_triple_quote(value)\n\n        if quot == noquot and '#' in value and self.list_values:\n            quot = self._get_single_quote(value)\n\n        return quot % value"},{"attributeType":"null","col":8,"comment":"null","endLoc":1316,"id":11881,"name":"number","nodeType":"Attribute","startLoc":1316,"text":"self.number"},{"attributeType":"null","col":8,"comment":"null","endLoc":1319,"id":11882,"name":"file","nodeType":"Attribute","startLoc":1319,"text":"self.file"},{"col":4,"comment":"null","endLoc":161,"header":"def __getitem__(cls, key)","id":11883,"name":"__getitem__","nodeType":"Function","startLoc":160,"text":"def __getitem__(cls, key):\n        return cls.__getattr__(key)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1317,"id":11884,"name":"func","nodeType":"Attribute","startLoc":1317,"text":"self.func"},{"col":0,"comment":"null","endLoc":124,"header":"def trigraph(input)","id":11885,"name":"trigraph","nodeType":"Function","startLoc":123,"text":"def trigraph(input):\n    return _trigraph_pat.sub(lambda g: _trigraph_rep[g.group()[-1]],input)"},{"col":29,"endLoc":124,"id":11886,"nodeType":"Lambda","startLoc":124,"text":"lambda g: _trigraph_rep[g.group()[-1]]"},{"col":4,"comment":"null","endLoc":173,"header":"def __add__(cls, items)","id":11887,"name":"__add__","nodeType":"Function","startLoc":163,"text":"def __add__(cls, items):\n        if not isinstance(items, dict):\n            if not isinstance(items[0], (tuple, list)):\n                items = [items]\n            items = dict(items)\n\n        return extend_bit_flag_map(\n            cls.__name__ + '_' + '_'.join([k for k in items]),\n            cls,\n            **items\n        )"},{"attributeType":"null","col":8,"comment":"null","endLoc":1321,"id":11888,"name":"prec","nodeType":"Attribute","startLoc":1321,"text":"self.prec"},{"attributeType":"null","col":8,"comment":"null","endLoc":1325,"id":11889,"name":"len","nodeType":"Attribute","startLoc":1325,"text":"self.len"},{"col":0,"comment":"\n    A convenience function for creating bit flags maps by subclassing an\n    existing map and adding additional flags supplied as keyword arguments.\n\n    Parameters\n    ----------\n    cls_name : str\n        Class name of the bit flag map to be created.\n\n    base_cls : BitFlagNameMap, optional\n        Base class for the new bit flag map.\n\n    **kwargs : int\n        Each supplied keyword argument will be used to define bit flag\n        names in the new map. In addition to bit flag names, ``__version__`` is\n        allowed to indicate the version of the newly created map.\n\n    Examples\n    --------\n\n        >>> from astropy.nddata.bitmask import extend_bit_flag_map\n        >>> ST_DQ = extend_bit_flag_map('ST_DQ', __version__='1.0.0', CR=1, CLOUDY=4, RAINY=8)\n        >>> ST_CAM1_DQ = extend_bit_flag_map('ST_CAM1_DQ', ST_DQ, HOT=16, DEAD=32)\n        >>> ST_CAM1_DQ['HOT']  # <-- Access flags as dictionary keys\n        16\n        >>> ST_CAM1_DQ.HOT  # <-- Access flags as class attributes\n        16\n\n    ","endLoc":265,"header":"def extend_bit_flag_map(cls_name, base_cls=BitFlagNameMap, **kwargs)","id":11890,"name":"extend_bit_flag_map","nodeType":"Function","startLoc":221,"text":"def extend_bit_flag_map(cls_name, base_cls=BitFlagNameMap, **kwargs):\n    \"\"\"\n    A convenience function for creating bit flags maps by subclassing an\n    existing map and adding additional flags supplied as keyword arguments.\n\n    Parameters\n    ----------\n    cls_name : str\n        Class name of the bit flag map to be created.\n\n    base_cls : BitFlagNameMap, optional\n        Base class for the new bit flag map.\n\n    **kwargs : int\n        Each supplied keyword argument will be used to define bit flag\n        names in the new map. In addition to bit flag names, ``__version__`` is\n        allowed to indicate the version of the newly created map.\n\n    Examples\n    --------\n\n        >>> from astropy.nddata.bitmask import extend_bit_flag_map\n        >>> ST_DQ = extend_bit_flag_map('ST_DQ', __version__='1.0.0', CR=1, CLOUDY=4, RAINY=8)\n        >>> ST_CAM1_DQ = extend_bit_flag_map('ST_CAM1_DQ', ST_DQ, HOT=16, DEAD=32)\n        >>> ST_CAM1_DQ['HOT']  # <-- Access flags as dictionary keys\n        16\n        >>> ST_CAM1_DQ.HOT  # <-- Access flags as class attributes\n        16\n\n    \"\"\"\n    new_cls = BitFlagNameMeta.__new__(\n        BitFlagNameMeta,\n        cls_name,\n        (base_cls, ),\n        {'_locked': False}\n    )\n    for k, v in kwargs.items():\n        try:\n            setattr(new_cls, k, v)\n        except AttributeError as e:\n            if new_cls[k] != int(v):\n                raise e\n\n    new_cls._locked = True\n    return new_cls"},{"attributeType":"null","col":8,"comment":"null","endLoc":1314,"id":11891,"name":"name","nodeType":"Attribute","startLoc":1314,"text":"self.name"},{"attributeType":"null","col":8,"comment":"null","endLoc":1334,"id":11892,"name":"lr_items","nodeType":"Attribute","startLoc":1334,"text":"self.lr_items"},{"attributeType":"None","col":8,"comment":"null","endLoc":1335,"id":11893,"name":"lr_next","nodeType":"Attribute","startLoc":1335,"text":"self.lr_next"},{"className":"MiniProduction","col":0,"comment":"null","endLoc":1402,"id":11894,"nodeType":"Class","startLoc":1383,"text":"class MiniProduction(object):\n    def __init__(self, str, name, len, func, file, line):\n        self.name     = name\n        self.len      = len\n        self.func     = func\n        self.callable = None\n        self.file     = file\n        self.line     = line\n        self.str      = str\n\n    def __str__(self):\n        return self.str\n\n    def __repr__(self):\n        return 'MiniProduction(%s)' % self.str\n\n    # Bind the production function name to a callable\n    def bind(self, pdict):\n        if self.func:\n            self.callable = pdict[self.func]"},{"col":4,"comment":"null","endLoc":1391,"header":"def __init__(self, str, name, len, func, file, line)","id":11895,"name":"__init__","nodeType":"Function","startLoc":1384,"text":"def __init__(self, str, name, len, func, file, line):\n        self.name     = name\n        self.len      = len\n        self.func     = func\n        self.callable = None\n        self.file     = file\n        self.line     = line\n        self.str      = str"},{"col":4,"comment":"null","endLoc":1394,"header":"def __str__(self)","id":11896,"name":"__str__","nodeType":"Function","startLoc":1393,"text":"def __str__(self):\n        return self.str"},{"col":4,"comment":"null","endLoc":1397,"header":"def __repr__(self)","id":11897,"name":"__repr__","nodeType":"Function","startLoc":1396,"text":"def __repr__(self):\n        return 'MiniProduction(%s)' % self.str"},{"col":4,"comment":"null","endLoc":1402,"header":"def bind(self, pdict)","id":11898,"name":"bind","nodeType":"Function","startLoc":1400,"text":"def bind(self, pdict):\n        if self.func:\n            self.callable = pdict[self.func]"},{"attributeType":"null","col":8,"comment":"null","endLoc":1391,"id":11899,"name":"str","nodeType":"Attribute","startLoc":1391,"text":"self.str"},{"col":0,"comment":"\n    Upsample a data array by block replication.\n\n    Parameters\n    ----------\n    data : array-like\n        The data to be block replicated.\n\n    block_size : int or array-like (int)\n        The integer block size along each axis.  If ``block_size`` is a\n        scalar and ``data`` has more than one dimension, then\n        ``block_size`` will be used for for every axis.\n\n    conserve_sum : bool, optional\n        If `True` (the default) then the sum of the output\n        block-replicated data will equal the sum of the input ``data``.\n\n    Returns\n    -------\n    output : array-like\n        The block-replicated data.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.nddata import block_replicate\n    >>> data = np.array([[0., 1.], [2., 3.]])\n    >>> block_replicate(data, 2)  # doctest: +FLOAT_CMP\n    array([[0.  , 0.  , 0.25, 0.25],\n           [0.  , 0.  , 0.25, 0.25],\n           [0.5 , 0.5 , 0.75, 0.75],\n           [0.5 , 0.5 , 0.75, 0.75]])\n\n    >>> block_replicate(data, 2, conserve_sum=False)  # doctest: +FLOAT_CMP\n    array([[0., 0., 1., 1.],\n           [0., 0., 1., 1.],\n           [2., 2., 3., 3.],\n           [2., 2., 3., 3.]])\n    ","endLoc":208,"header":"@support_nddata\ndef block_replicate(data, block_size, conserve_sum=True)","id":11900,"name":"block_replicate","nodeType":"Function","startLoc":159,"text":"@support_nddata\ndef block_replicate(data, block_size, conserve_sum=True):\n    \"\"\"\n    Upsample a data array by block replication.\n\n    Parameters\n    ----------\n    data : array-like\n        The data to be block replicated.\n\n    block_size : int or array-like (int)\n        The integer block size along each axis.  If ``block_size`` is a\n        scalar and ``data`` has more than one dimension, then\n        ``block_size`` will be used for for every axis.\n\n    conserve_sum : bool, optional\n        If `True` (the default) then the sum of the output\n        block-replicated data will equal the sum of the input ``data``.\n\n    Returns\n    -------\n    output : array-like\n        The block-replicated data.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.nddata import block_replicate\n    >>> data = np.array([[0., 1.], [2., 3.]])\n    >>> block_replicate(data, 2)  # doctest: +FLOAT_CMP\n    array([[0.  , 0.  , 0.25, 0.25],\n           [0.  , 0.  , 0.25, 0.25],\n           [0.5 , 0.5 , 0.75, 0.75],\n           [0.5 , 0.5 , 0.75, 0.75]])\n\n    >>> block_replicate(data, 2, conserve_sum=False)  # doctest: +FLOAT_CMP\n    array([[0., 0., 1., 1.],\n           [0., 0., 1., 1.],\n           [2., 2., 3., 3.],\n           [2., 2., 3., 3.]])\n    \"\"\"\n\n    data, block_size = _process_block_inputs(data, block_size)\n    for i in range(data.ndim):\n        data = np.repeat(data, block_size[i], axis=i)\n\n    if conserve_sum:\n        data = data / float(np.prod(block_size))\n\n    return data"},{"attributeType":"None","col":8,"comment":"null","endLoc":1388,"id":11901,"name":"callable","nodeType":"Attribute","startLoc":1388,"text":"self.callable"},{"attributeType":"null","col":8,"comment":"null","endLoc":1389,"id":11902,"name":"file","nodeType":"Attribute","startLoc":1389,"text":"self.file"},{"attributeType":"null","col":16,"comment":"null","endLoc":6,"id":11903,"name":"np","nodeType":"Attribute","startLoc":6,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":11904,"name":"__all__","nodeType":"Attribute","startLoc":10,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"blocks.py#<anonymous>","id":11905,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module includes helper functions for array operations.\n\"\"\"\n\n__all__ = ['reshape_as_blocks', 'block_reduce', 'block_replicate']"},{"fileName":"ccddata.py","filePath":"astropy/nddata","id":11906,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"This module implements the base CCDData class.\"\"\"\n\nimport itertools\n\nimport numpy as np\n\nfrom .compat import NDDataArray\nfrom .nduncertainty import (\n    StdDevUncertainty, NDUncertainty, VarianceUncertainty, InverseVariance)\nfrom astropy.io import fits, registry\nfrom astropy import units as u\nfrom astropy import log\nfrom astropy.wcs import WCS\nfrom astropy.utils.decorators import sharedmethod\n\n\n__all__ = ['CCDData', 'fits_ccddata_reader', 'fits_ccddata_writer']\n\n_known_uncertainties = (StdDevUncertainty, VarianceUncertainty, InverseVariance)\n_unc_name_to_cls = {cls.__name__: cls for cls in _known_uncertainties}\n_unc_cls_to_name = {cls: cls.__name__ for cls in _known_uncertainties}\n\n# Global value which can turn on/off the unit requirements when creating a\n# CCDData. Should be used with care because several functions actually break\n# if the unit is None!\n_config_ccd_requires_unit = True\n\n\ndef _arithmetic(op):\n    \"\"\"Decorator factory which temporarily disables the need for a unit when\n    creating a new CCDData instance. The final result must have a unit.\n\n    Parameters\n    ----------\n    op : function\n        The function to apply. Supported are:\n\n        - ``np.add``\n        - ``np.subtract``\n        - ``np.multiply``\n        - ``np.true_divide``\n\n    Notes\n    -----\n    Should only be used on CCDData ``add``, ``subtract``, ``divide`` or\n    ``multiply`` because only these methods from NDArithmeticMixin are\n    overwritten.\n    \"\"\"\n    def decorator(func):\n        def inner(self, operand, operand2=None, **kwargs):\n            global _config_ccd_requires_unit\n            _config_ccd_requires_unit = False\n            result = self._prepare_then_do_arithmetic(op, operand,\n                                                      operand2, **kwargs)\n            # Wrap it again as CCDData so it checks the final unit.\n            _config_ccd_requires_unit = True\n            return result.__class__(result)\n        inner.__doc__ = f\"See `astropy.nddata.NDArithmeticMixin.{func.__name__}`.\"\n        return sharedmethod(inner)\n    return decorator\n\n\ndef _uncertainty_unit_equivalent_to_parent(uncertainty_type, unit, parent_unit):\n    if uncertainty_type is StdDevUncertainty:\n        return unit == parent_unit\n    elif uncertainty_type is VarianceUncertainty:\n        return unit == (parent_unit ** 2)\n    elif uncertainty_type is InverseVariance:\n        return unit == (1 / (parent_unit ** 2))\n    raise ValueError(f\"unsupported uncertainty type: {uncertainty_type}\")\n\n\nclass CCDData(NDDataArray):\n    \"\"\"A class describing basic CCD data.\n\n    The CCDData class is based on the NDData object and includes a data array,\n    uncertainty frame, mask frame, flag frame, meta data, units, and WCS\n    information for a single CCD image.\n\n    Parameters\n    ----------\n    data : `~astropy.nddata.CCDData`-like or array-like\n        The actual data contained in this `~astropy.nddata.CCDData` object.\n        Note that the data will always be saved by *reference*, so you should\n        make a copy of the ``data`` before passing it in if that's the desired\n        behavior.\n\n    uncertainty : `~astropy.nddata.StdDevUncertainty`, \\\n            `~astropy.nddata.VarianceUncertainty`, \\\n            `~astropy.nddata.InverseVariance`, `numpy.ndarray` or \\\n            None, optional\n        Uncertainties on the data. If the uncertainty is a `numpy.ndarray`, it\n        it assumed to be, and stored as, a `~astropy.nddata.StdDevUncertainty`.\n        Default is ``None``.\n\n    mask : `numpy.ndarray` or None, optional\n        Mask for the data, given as a boolean Numpy array with a shape\n        matching that of the data. The values must be `False` where\n        the data is *valid* and `True` when it is not (like Numpy\n        masked arrays). If ``data`` is a numpy masked array, providing\n        ``mask`` here will causes the mask from the masked array to be\n        ignored.\n        Default is ``None``.\n\n    flags : `numpy.ndarray` or `~astropy.nddata.FlagCollection` or None, \\\n            optional\n        Flags giving information about each pixel. These can be specified\n        either as a Numpy array of any type with a shape matching that of the\n        data, or as a `~astropy.nddata.FlagCollection` instance which has a\n        shape matching that of the data.\n        Default is ``None``.\n\n    wcs : `~astropy.wcs.WCS` or None, optional\n        WCS-object containing the world coordinate system for the data.\n        Default is ``None``.\n\n    meta : dict-like object or None, optional\n        Metadata for this object. \"Metadata\" here means all information that\n        is included with this object but not part of any other attribute\n        of this particular object, e.g. creation date, unique identifier,\n        simulation parameters, exposure time, telescope name, etc.\n\n    unit : `~astropy.units.Unit` or str, optional\n        The units of the data.\n        Default is ``None``.\n\n        .. warning::\n\n            If the unit is ``None`` or not otherwise specified it will raise a\n            ``ValueError``\n\n    Raises\n    ------\n    ValueError\n        If the ``uncertainty`` or ``mask`` inputs cannot be broadcast (e.g.,\n        match shape) onto ``data``.\n\n    Methods\n    -------\n    read(\\\\*args, \\\\**kwargs)\n        ``Classmethod`` to create an CCDData instance based on a ``FITS`` file.\n        This method uses :func:`fits_ccddata_reader` with the provided\n        parameters.\n    write(\\\\*args, \\\\**kwargs)\n        Writes the contents of the CCDData instance into a new ``FITS`` file.\n        This method uses :func:`fits_ccddata_writer` with the provided\n        parameters.\n\n    Attributes\n    ----------\n    known_invalid_fits_unit_strings\n        A dictionary that maps commonly-used fits unit name strings that are\n        technically invalid to the correct valid unit type (or unit string).\n        This is primarily for variant names like \"ELECTRONS/S\" which are not\n        formally valid, but are unambiguous and frequently enough encountered\n        that it is convenient to map them to the correct unit.\n\n    Notes\n    -----\n    `~astropy.nddata.CCDData` objects can be easily converted to a regular\n     Numpy array using `numpy.asarray`.\n\n    For example::\n\n        >>> from astropy.nddata import CCDData\n        >>> import numpy as np\n        >>> x = CCDData([1,2,3], unit='adu')\n        >>> np.asarray(x)\n        array([1, 2, 3])\n\n    This is useful, for example, when plotting a 2D image using\n    matplotlib.\n\n        >>> from astropy.nddata import CCDData\n        >>> from matplotlib import pyplot as plt   # doctest: +SKIP\n        >>> x = CCDData([[1,2,3], [4,5,6]], unit='adu')\n        >>> plt.imshow(x)   # doctest: +SKIP\n\n    \"\"\"\n\n    def __init__(self, *args, **kwd):\n        if 'meta' not in kwd:\n            kwd['meta'] = kwd.pop('header', None)\n        if 'header' in kwd:\n            raise ValueError(\"can't have both header and meta.\")\n\n        super().__init__(*args, **kwd)\n        if self._wcs is not None:\n            llwcs = self._wcs.low_level_wcs\n            if not isinstance(llwcs, WCS):\n                raise TypeError(\"the wcs must be a WCS instance.\")\n            self._wcs = llwcs\n\n        # Check if a unit is set. This can be temporarily disabled by the\n        # _CCDDataUnit contextmanager.\n        if _config_ccd_requires_unit and self.unit is None:\n            raise ValueError(\"a unit for CCDData must be specified.\")\n\n    def _slice_wcs(self, item):\n        \"\"\"\n        Override the WCS slicing behaviour so that the wcs attribute continues\n        to be an `astropy.wcs.WCS`.\n        \"\"\"\n        if self.wcs is None:\n            return None\n\n        try:\n            return self.wcs[item]\n        except Exception as err:\n            self._handle_wcs_slicing_error(err, item)\n\n    @property\n    def data(self):\n        return self._data\n\n    @data.setter\n    def data(self, value):\n        self._data = value\n\n    @property\n    def wcs(self):\n        return self._wcs\n\n    @wcs.setter\n    def wcs(self, value):\n        if value is not None and not isinstance(value, WCS):\n            raise TypeError(\"the wcs must be a WCS instance.\")\n        self._wcs = value\n\n    @property\n    def unit(self):\n        return self._unit\n\n    @unit.setter\n    def unit(self, value):\n        self._unit = u.Unit(value)\n\n    @property\n    def header(self):\n        return self._meta\n\n    @header.setter\n    def header(self, value):\n        self.meta = value\n\n    @property\n    def uncertainty(self):\n        return self._uncertainty\n\n    @uncertainty.setter\n    def uncertainty(self, value):\n        if value is not None:\n            if isinstance(value, NDUncertainty):\n                if getattr(value, '_parent_nddata', None) is not None:\n                    value = value.__class__(value, copy=False)\n                self._uncertainty = value\n            elif isinstance(value, np.ndarray):\n                if value.shape != self.shape:\n                    raise ValueError(\"uncertainty must have same shape as \"\n                                     \"data.\")\n                self._uncertainty = StdDevUncertainty(value)\n                log.info(\"array provided for uncertainty; assuming it is a \"\n                         \"StdDevUncertainty.\")\n            else:\n                raise TypeError(\"uncertainty must be an instance of a \"\n                                \"NDUncertainty object or a numpy array.\")\n            self._uncertainty.parent_nddata = self\n        else:\n            self._uncertainty = value\n\n    def to_hdu(self, hdu_mask='MASK', hdu_uncertainty='UNCERT',\n               hdu_flags=None, wcs_relax=True, key_uncertainty_type='UTYPE'):\n        \"\"\"Creates an HDUList object from a CCDData object.\n\n        Parameters\n        ----------\n        hdu_mask, hdu_uncertainty, hdu_flags : str or None, optional\n            If it is a string append this attribute to the HDUList as\n            `~astropy.io.fits.ImageHDU` with the string as extension name.\n            Flags are not supported at this time. If ``None`` this attribute\n            is not appended.\n            Default is ``'MASK'`` for mask, ``'UNCERT'`` for uncertainty and\n            ``None`` for flags.\n\n        wcs_relax : bool\n            Value of the ``relax`` parameter to use in converting the WCS to a\n            FITS header using `~astropy.wcs.WCS.to_header`. The common\n            ``CTYPE`` ``RA---TAN-SIP`` and ``DEC--TAN-SIP`` requires\n            ``relax=True`` for the ``-SIP`` part of the ``CTYPE`` to be\n            preserved.\n\n        key_uncertainty_type : str, optional\n            The header key name for the class name of the uncertainty (if any)\n            that is used to store the uncertainty type in the uncertainty hdu.\n            Default is ``UTYPE``.\n\n            .. versionadded:: 3.1\n\n        Raises\n        ------\n        ValueError\n            - If ``self.mask`` is set but not a `numpy.ndarray`.\n            - If ``self.uncertainty`` is set but not a astropy uncertainty type.\n            - If ``self.uncertainty`` is set but has another unit then\n              ``self.data``.\n\n        NotImplementedError\n            Saving flags is not supported.\n\n        Returns\n        -------\n        hdulist : `~astropy.io.fits.HDUList`\n        \"\"\"\n        if isinstance(self.header, fits.Header):\n            # Copy here so that we can modify the HDU header by adding WCS\n            # information without changing the header of the CCDData object.\n            header = self.header.copy()\n        else:\n            # Because _insert_in_metadata_fits_safe is written as a method\n            # we need to create a dummy CCDData instance to hold the FITS\n            # header we are constructing. This probably indicates that\n            # _insert_in_metadata_fits_safe should be rewritten in a more\n            # sensible way...\n            dummy_ccd = CCDData([1], meta=fits.Header(), unit=\"adu\")\n            for k, v in self.header.items():\n                dummy_ccd._insert_in_metadata_fits_safe(k, v)\n            header = dummy_ccd.header\n        if self.unit is not u.dimensionless_unscaled:\n            header['bunit'] = self.unit.to_string()\n        if self.wcs:\n            # Simply extending the FITS header with the WCS can lead to\n            # duplicates of the WCS keywords; iterating over the WCS\n            # header should be safer.\n            #\n            # Turns out if I had read the io.fits.Header.extend docs more\n            # carefully, I would have realized that the keywords exist to\n            # avoid duplicates and preserve, as much as possible, the\n            # structure of the commentary cards.\n            #\n            # Note that until astropy/astropy#3967 is closed, the extend\n            # will fail if there are comment cards in the WCS header but\n            # not header.\n            wcs_header = self.wcs.to_header(relax=wcs_relax)\n            header.extend(wcs_header, useblanks=False, update=True)\n        hdus = [fits.PrimaryHDU(self.data, header)]\n\n        if hdu_mask and self.mask is not None:\n            # Always assuming that the mask is a np.ndarray (check that it has\n            # a 'shape').\n            if not hasattr(self.mask, 'shape'):\n                raise ValueError('only a numpy.ndarray mask can be saved.')\n\n            # Convert boolean mask to uint since io.fits cannot handle bool.\n            hduMask = fits.ImageHDU(self.mask.astype(np.uint8), name=hdu_mask)\n            hdus.append(hduMask)\n\n        if hdu_uncertainty and self.uncertainty is not None:\n            # We need to save some kind of information which uncertainty was\n            # used so that loading the HDUList can infer the uncertainty type.\n            # No idea how this can be done so only allow StdDevUncertainty.\n            uncertainty_cls = self.uncertainty.__class__\n            if uncertainty_cls not in _known_uncertainties:\n                raise ValueError('only uncertainties of type {} can be saved.'\n                                 .format(_known_uncertainties))\n            uncertainty_name = _unc_cls_to_name[uncertainty_cls]\n\n            hdr_uncertainty = fits.Header()\n            hdr_uncertainty[key_uncertainty_type] = uncertainty_name\n\n            # Assuming uncertainty is an StdDevUncertainty save just the array\n            # this might be problematic if the Uncertainty has a unit differing\n            # from the data so abort for different units. This is important for\n            # astropy > 1.2\n            if (hasattr(self.uncertainty, 'unit') and\n                    self.uncertainty.unit is not None):\n                if not _uncertainty_unit_equivalent_to_parent(\n                        uncertainty_cls, self.uncertainty.unit, self.unit):\n                    raise ValueError(\n                        'saving uncertainties with a unit that is not '\n                        'equivalent to the unit from the data unit is not '\n                        'supported.')\n\n            hduUncert = fits.ImageHDU(self.uncertainty.array, hdr_uncertainty,\n                                      name=hdu_uncertainty)\n            hdus.append(hduUncert)\n\n        if hdu_flags and self.flags:\n            raise NotImplementedError('adding the flags to a HDU is not '\n                                      'supported at this time.')\n\n        hdulist = fits.HDUList(hdus)\n\n        return hdulist\n\n    def copy(self):\n        \"\"\"\n        Return a copy of the CCDData object.\n        \"\"\"\n        return self.__class__(self, copy=True)\n\n    add = _arithmetic(np.add)(NDDataArray.add)\n    subtract = _arithmetic(np.subtract)(NDDataArray.subtract)\n    multiply = _arithmetic(np.multiply)(NDDataArray.multiply)\n    divide = _arithmetic(np.true_divide)(NDDataArray.divide)\n\n    def _insert_in_metadata_fits_safe(self, key, value):\n        \"\"\"\n        Insert key/value pair into metadata in a way that FITS can serialize.\n\n        Parameters\n        ----------\n        key : str\n            Key to be inserted in dictionary.\n\n        value : str or None\n            Value to be inserted.\n\n        Notes\n        -----\n        This addresses a shortcoming of the FITS standard. There are length\n        restrictions on both the ``key`` (8 characters) and ``value`` (72\n        characters) in the FITS standard. There is a convention for handling\n        long keywords and a convention for handling long values, but the\n        two conventions cannot be used at the same time.\n\n        This addresses that case by checking the length of the ``key`` and\n        ``value`` and, if necessary, shortening the key.\n        \"\"\"\n\n        if len(key) > 8 and len(value) > 72:\n            short_name = key[:8]\n            self.meta[f'HIERARCH {key.upper()}'] = (\n                short_name, f\"Shortened name for {key}\")\n            self.meta[short_name] = value\n        else:\n            self.meta[key] = value\n\n    # A dictionary mapping \"known\" invalid fits unit\n    known_invalid_fits_unit_strings = {'ELECTRONS/S': u.electron/u.s,\n                                       'ELECTRONS': u.electron,\n                                       'electrons': u.electron}\n\n\n# These need to be importable by the tests...\n_KEEP_THESE_KEYWORDS_IN_HEADER = [\n    'JD-OBS',\n    'MJD-OBS',\n    'DATE-OBS'\n]\n_PCs = set(['PC1_1', 'PC1_2', 'PC2_1', 'PC2_2'])\n_CDs = set(['CD1_1', 'CD1_2', 'CD2_1', 'CD2_2'])\n\n\ndef _generate_wcs_and_update_header(hdr):\n    \"\"\"\n    Generate a WCS object from a header and remove the WCS-specific\n    keywords from the header.\n\n    Parameters\n    ----------\n\n    hdr : astropy.io.fits.header or other dict-like\n\n    Returns\n    -------\n\n    new_header, wcs\n    \"\"\"\n\n    # Try constructing a WCS object.\n    try:\n        wcs = WCS(hdr)\n    except Exception as exc:\n        # Normally WCS only raises Warnings and doesn't fail but in rare\n        # cases (malformed header) it could fail...\n        log.info('An exception happened while extracting WCS information from '\n                 'the Header.\\n{}: {}'.format(type(exc).__name__, str(exc)))\n        return hdr, None\n    # Test for success by checking to see if the wcs ctype has a non-empty\n    # value, return None for wcs if ctype is empty.\n    if not wcs.wcs.ctype[0]:\n        return (hdr, None)\n\n    new_hdr = hdr.copy()\n    # If the keywords below are in the header they are also added to WCS.\n    # It seems like they should *not* be removed from the header, though.\n\n    wcs_header = wcs.to_header(relax=True)\n    for k in wcs_header:\n        if k not in _KEEP_THESE_KEYWORDS_IN_HEADER:\n            new_hdr.remove(k, ignore_missing=True)\n\n    # Check that this does not result in an inconsistent header WCS if the WCS\n    # is converted back to a header.\n\n    if (_PCs & set(wcs_header)) and (_CDs & set(new_hdr)):\n        # The PCi_j representation is used by the astropy.wcs object,\n        # so CDi_j keywords were not removed from new_hdr. Remove them now.\n        for cd in _CDs:\n            new_hdr.remove(cd, ignore_missing=True)\n\n    # The other case -- CD in the header produced by astropy.wcs -- should\n    # never happen based on [1], which computes the matrix in PC form.\n    # [1]: https://github.com/astropy/astropy/blob/1cf277926d3598dd672dd528504767c37531e8c9/cextern/wcslib/C/wcshdr.c#L596\n    #\n    # The test test_ccddata.test_wcs_keyword_removal_for_wcs_test_files() does\n    # check for the possibility that both PC and CD are present in the result\n    # so if the implementation of to_header changes in wcslib in the future\n    # then the tests should catch it, and then this code will need to be\n    # updated.\n\n    # We need to check for any SIP coefficients that got left behind if the\n    # header has SIP.\n    if wcs.sip is not None:\n        keyword = '{}_{}_{}'\n        polynomials = ['A', 'B', 'AP', 'BP']\n        for poly in polynomials:\n            order = wcs.sip.__getattribute__(f'{poly.lower()}_order')\n            for i, j in itertools.product(range(order), repeat=2):\n                new_hdr.remove(keyword.format(poly, i, j),\n                               ignore_missing=True)\n\n    return (new_hdr, wcs)\n\n\ndef fits_ccddata_reader(filename, hdu=0, unit=None, hdu_uncertainty='UNCERT',\n                        hdu_mask='MASK', hdu_flags=None,\n                        key_uncertainty_type='UTYPE', **kwd):\n    \"\"\"\n    Generate a CCDData object from a FITS file.\n\n    Parameters\n    ----------\n    filename : str\n        Name of fits file.\n\n    hdu : int, str, tuple of (str, int), optional\n        Index or other identifier of the Header Data Unit of the FITS\n        file from which CCDData should be initialized. If zero and\n        no data in the primary HDU, it will search for the first\n        extension HDU with data. The header will be added to the primary HDU.\n        Default is ``0``.\n\n    unit : `~astropy.units.Unit`, optional\n        Units of the image data. If this argument is provided and there is a\n        unit for the image in the FITS header (the keyword ``BUNIT`` is used\n        as the unit, if present), this argument is used for the unit.\n        Default is ``None``.\n\n    hdu_uncertainty : str or None, optional\n        FITS extension from which the uncertainty should be initialized. If the\n        extension does not exist the uncertainty of the CCDData is ``None``.\n        Default is ``'UNCERT'``.\n\n    hdu_mask : str or None, optional\n        FITS extension from which the mask should be initialized. If the\n        extension does not exist the mask of the CCDData is ``None``.\n        Default is ``'MASK'``.\n\n    hdu_flags : str or None, optional\n        Currently not implemented.\n        Default is ``None``.\n\n    key_uncertainty_type : str, optional\n        The header key name where the class name of the uncertainty  is stored\n        in the hdu of the uncertainty (if any).\n        Default is ``UTYPE``.\n\n        .. versionadded:: 3.1\n\n    kwd :\n        Any additional keyword parameters are passed through to the FITS reader\n        in :mod:`astropy.io.fits`; see Notes for additional discussion.\n\n    Notes\n    -----\n    FITS files that contained scaled data (e.g. unsigned integer images) will\n    be scaled and the keywords used to manage scaled data in\n    :mod:`astropy.io.fits` are disabled.\n    \"\"\"\n    unsupport_open_keywords = {\n        'do_not_scale_image_data': 'Image data must be scaled.',\n        'scale_back': 'Scale information is not preserved.'\n    }\n    for key, msg in unsupport_open_keywords.items():\n        if key in kwd:\n            prefix = f'unsupported keyword: {key}.'\n            raise TypeError(' '.join([prefix, msg]))\n    with fits.open(filename, **kwd) as hdus:\n        hdr = hdus[hdu].header\n\n        if hdu_uncertainty is not None and hdu_uncertainty in hdus:\n            unc_hdu = hdus[hdu_uncertainty]\n            stored_unc_name = unc_hdu.header.get(key_uncertainty_type, 'None')\n            # For compatibility reasons the default is standard deviation\n            # uncertainty because files could have been created before the\n            # uncertainty type was stored in the header.\n            unc_type = _unc_name_to_cls.get(stored_unc_name, StdDevUncertainty)\n            uncertainty = unc_type(unc_hdu.data)\n        else:\n            uncertainty = None\n\n        if hdu_mask is not None and hdu_mask in hdus:\n            # Mask is saved as uint but we want it to be boolean.\n            mask = hdus[hdu_mask].data.astype(np.bool_)\n        else:\n            mask = None\n\n        if hdu_flags is not None and hdu_flags in hdus:\n            raise NotImplementedError('loading flags is currently not '\n                                      'supported.')\n\n        # search for the first instance with data if\n        # the primary header is empty.\n        if hdu == 0 and hdus[hdu].data is None:\n            for i in range(len(hdus)):\n                if (hdus.info(hdu)[i][3] == 'ImageHDU' and\n                        hdus.fileinfo(i)['datSpan'] > 0):\n                    hdu = i\n                    comb_hdr = hdus[hdu].header.copy()\n                    # Add header values from the primary header that aren't\n                    # present in the extension header.\n                    comb_hdr.extend(hdr, unique=True)\n                    hdr = comb_hdr\n                    log.info(f\"first HDU with data is extension {hdu}.\")\n                    break\n\n        if 'bunit' in hdr:\n            fits_unit_string = hdr['bunit']\n            # patch to handle FITS files using ADU for the unit instead of the\n            # standard version of 'adu'\n            if fits_unit_string.strip().lower() == 'adu':\n                fits_unit_string = fits_unit_string.lower()\n        else:\n            fits_unit_string = None\n\n        if fits_unit_string:\n            if unit is None:\n                # Convert the BUNIT header keyword to a unit and if that's not\n                # possible raise a meaningful error message.\n                try:\n                    kifus = CCDData.known_invalid_fits_unit_strings\n                    if fits_unit_string in kifus:\n                        fits_unit_string = kifus[fits_unit_string]\n                    fits_unit_string = u.Unit(fits_unit_string)\n                except ValueError:\n                    raise ValueError(\n                        'The Header value for the key BUNIT ({}) cannot be '\n                        'interpreted as valid unit. To successfully read the '\n                        'file as CCDData you can pass in a valid `unit` '\n                        'argument explicitly or change the header of the FITS '\n                        'file before reading it.'\n                        .format(fits_unit_string))\n            else:\n                log.info(\"using the unit {} passed to the FITS reader instead \"\n                         \"of the unit {} in the FITS file.\"\n                         .format(unit, fits_unit_string))\n\n        use_unit = unit or fits_unit_string\n        hdr, wcs = _generate_wcs_and_update_header(hdr)\n        ccd_data = CCDData(hdus[hdu].data, meta=hdr, unit=use_unit,\n                           mask=mask, uncertainty=uncertainty, wcs=wcs)\n\n    return ccd_data\n\n\ndef fits_ccddata_writer(\n        ccd_data, filename, hdu_mask='MASK', hdu_uncertainty='UNCERT',\n        hdu_flags=None, key_uncertainty_type='UTYPE', **kwd):\n    \"\"\"\n    Write CCDData object to FITS file.\n\n    Parameters\n    ----------\n    filename : str\n        Name of file.\n\n    hdu_mask, hdu_uncertainty, hdu_flags : str or None, optional\n        If it is a string append this attribute to the HDUList as\n        `~astropy.io.fits.ImageHDU` with the string as extension name.\n        Flags are not supported at this time. If ``None`` this attribute\n        is not appended.\n        Default is ``'MASK'`` for mask, ``'UNCERT'`` for uncertainty and\n        ``None`` for flags.\n\n    key_uncertainty_type : str, optional\n        The header key name for the class name of the uncertainty (if any)\n        that is used to store the uncertainty type in the uncertainty hdu.\n        Default is ``UTYPE``.\n\n        .. versionadded:: 3.1\n\n    kwd :\n        All additional keywords are passed to :py:mod:`astropy.io.fits`\n\n    Raises\n    ------\n    ValueError\n        - If ``self.mask`` is set but not a `numpy.ndarray`.\n        - If ``self.uncertainty`` is set but not a\n          `~astropy.nddata.StdDevUncertainty`.\n        - If ``self.uncertainty`` is set but has another unit then\n          ``self.data``.\n\n    NotImplementedError\n        Saving flags is not supported.\n    \"\"\"\n    hdu = ccd_data.to_hdu(\n        hdu_mask=hdu_mask, hdu_uncertainty=hdu_uncertainty,\n        key_uncertainty_type=key_uncertainty_type, hdu_flags=hdu_flags)\n    hdu.writeto(filename, **kwd)\n\n\nwith registry.delay_doc_updates(CCDData):\n    registry.register_reader('fits', CCDData, fits_ccddata_reader)\n    registry.register_writer('fits', CCDData, fits_ccddata_writer)\n    registry.register_identifier('fits', CCDData, fits.connect.is_fits)\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":1386,"id":11907,"name":"len","nodeType":"Attribute","startLoc":1386,"text":"self.len"},{"attributeType":"null","col":8,"comment":"null","endLoc":1387,"id":11908,"name":"func","nodeType":"Attribute","startLoc":1387,"text":"self.func"},{"col":4,"comment":"null","endLoc":178,"header":"def __iadd__(cls, other)","id":11909,"name":"__iadd__","nodeType":"Function","startLoc":175,"text":"def __iadd__(cls, other):\n        raise NotImplementedError(\n            \"Unary '+' is not supported. Use binary operator instead.\"\n        )"},{"col":4,"comment":"null","endLoc":182,"header":"def __delattr__(cls, name)","id":11910,"name":"__delattr__","nodeType":"Function","startLoc":180,"text":"def __delattr__(cls, name):\n        raise AttributeError(\"{:s}: cannot delete {:s} member.\"\n                             .format(cls.__name__, cls.mro()[-2].__name__))"},{"col":4,"comment":"null","endLoc":186,"header":"def __delitem__(cls, name)","id":11911,"name":"__delitem__","nodeType":"Function","startLoc":184,"text":"def __delitem__(cls, name):\n        raise AttributeError(\"{:s}: cannot delete {:s} member.\"\n                             .format(cls.__name__, cls.mro()[-2].__name__))"},{"col":4,"comment":"null","endLoc":189,"header":"def __repr__(cls)","id":11912,"name":"__repr__","nodeType":"Function","startLoc":188,"text":"def __repr__(cls):\n        return f\"<{cls.mro()[-2].__name__:s} '{cls.__name__:s}'>\""},{"attributeType":"null","col":16,"comment":"null","endLoc":94,"id":11913,"name":"kl","nodeType":"Attribute","startLoc":94,"text":"kl"},{"attributeType":"null","col":8,"comment":"null","endLoc":1390,"id":11914,"name":"line","nodeType":"Attribute","startLoc":1390,"text":"self.line"},{"attributeType":"null","col":12,"comment":"null","endLoc":88,"id":11915,"name":"cache","nodeType":"Attribute","startLoc":88,"text":"cache"},{"attributeType":"BitFlag","col":16,"comment":"null","endLoc":82,"id":11916,"name":"v","nodeType":"Attribute","startLoc":82,"text":"v"},{"attributeType":"null","col":8,"comment":"null","endLoc":85,"id":11917,"name":"attrl","nodeType":"Attribute","startLoc":85,"text":"attrl"},{"attributeType":"null","col":12,"comment":"null","endLoc":111,"id":11918,"name":"members","nodeType":"Attribute","startLoc":111,"text":"members"},{"attributeType":"null","col":8,"comment":"null","endLoc":84,"id":11919,"name":"attr","nodeType":"Attribute","startLoc":84,"text":"attr"},{"attributeType":"null","col":20,"comment":"null","endLoc":96,"id":11920,"name":"idx","nodeType":"Attribute","startLoc":96,"text":"idx"},{"attributeType":"null","col":8,"comment":"null","endLoc":1385,"id":11921,"name":"name","nodeType":"Attribute","startLoc":1385,"text":"self.name"},{"className":"BitFlagNameMap","col":0,"comment":"\n    A base class for bit flag name maps used to describe data quality (DQ)\n    flags of images by provinding a mapping from a mnemonic flag name to a flag\n    value.\n\n    Mapping for a specific instrument should subclass this class.\n    Subclasses should define flags as class attributes with integer values\n    that are powers of 2. Each bit flag may also contain a string\n    comment following the flag value.\n\n    Examples\n    --------\n\n        >>> from astropy.nddata.bitmask import BitFlagNameMap\n        >>> class ST_DQ(BitFlagNameMap):\n        ...     __version__ = '1.0.0'  # optional\n        ...     CR = 1, 'Cosmic Ray'\n        ...     CLOUDY = 4  # no docstring comment\n        ...     RAINY = 8, 'Dome closed'\n        ...\n        >>> class ST_CAM1_DQ(ST_DQ):\n        ...     HOT = 16\n        ...     DEAD = 32\n\n    ","endLoc":218,"id":11922,"nodeType":"Class","startLoc":192,"text":"class BitFlagNameMap(metaclass=BitFlagNameMeta):\n    \"\"\"\n    A base class for bit flag name maps used to describe data quality (DQ)\n    flags of images by provinding a mapping from a mnemonic flag name to a flag\n    value.\n\n    Mapping for a specific instrument should subclass this class.\n    Subclasses should define flags as class attributes with integer values\n    that are powers of 2. Each bit flag may also contain a string\n    comment following the flag value.\n\n    Examples\n    --------\n\n        >>> from astropy.nddata.bitmask import BitFlagNameMap\n        >>> class ST_DQ(BitFlagNameMap):\n        ...     __version__ = '1.0.0'  # optional\n        ...     CR = 1, 'Cosmic Ray'\n        ...     CLOUDY = 4  # no docstring comment\n        ...     RAINY = 8, 'Dome closed'\n        ...\n        >>> class ST_CAM1_DQ(ST_DQ):\n        ...     HOT = 16\n        ...     DEAD = 32\n\n    \"\"\"\n    pass"},{"className":"LRItem","col":0,"comment":"null","endLoc":1449,"id":11923,"nodeType":"Class","startLoc":1429,"text":"class LRItem(object):\n    def __init__(self, p, n):\n        self.name       = p.name\n        self.prod       = list(p.prod)\n        self.number     = p.number\n        self.lr_index   = n\n        self.lookaheads = {}\n        self.prod.insert(n, '.')\n        self.prod       = tuple(self.prod)\n        self.len        = len(self.prod)\n        self.usyms      = p.usyms\n\n    def __str__(self):\n        if self.prod:\n            s = '%s -> %s' % (self.name, ' '.join(self.prod))\n        else:\n            s = '%s -> <empty>' % self.name\n        return s\n\n    def __repr__(self):\n        return 'LRItem(' + str(self) + ')'"},{"col":4,"comment":"null","endLoc":1446,"header":"def __str__(self)","id":11924,"name":"__str__","nodeType":"Function","startLoc":1441,"text":"def __str__(self):\n        if self.prod:\n            s = '%s -> %s' % (self.name, ' '.join(self.prod))\n        else:\n            s = '%s -> <empty>' % self.name\n        return s"},{"col":0,"comment":"\n    Converts input bit flags to a single integer value (bit mask) or `None`.\n\n    When input is a list of flags (either a Python list of integer flags or a\n    string of comma-, ``'|'``-, or ``'+'``-separated list of flags),\n    the returned bit mask is obtained by summing input flags.\n\n    .. note::\n        In order to flip the bits of the returned bit mask,\n        for input of `str` type, prepend '~' to the input string. '~' must\n        be prepended to the *entire string* and not to each bit flag! For\n        input that is already a bit mask or a Python list of bit flags, set\n        ``flip_bits`` for `True` in order to flip the bits of the returned\n        bit mask.\n\n    Parameters\n    ----------\n    bit_flags : int, str, list, None\n        An integer bit mask or flag, `None`, a string of comma-, ``'|'``- or\n        ``'+'``-separated list of integer bit flags or mnemonic flag names,\n        or a Python list of integer bit flags. If ``bit_flags`` is a `str`\n        and if it is prepended with '~', then the output bit mask will have\n        its bits flipped (compared to simple sum of input flags).\n        For input ``bit_flags`` that is already a bit mask or a Python list\n        of bit flags, bit-flipping can be controlled through ``flip_bits``\n        parameter.\n\n        .. note::\n            When ``bit_flags`` is a list of flag names, the ``flag_name_map``\n            parameter must be provided.\n\n        .. note::\n            Only one flag separator is supported at a time. ``bit_flags``\n            string should not mix ``','``, ``'+'``, and ``'|'`` separators.\n\n    flip_bits : bool, None\n        Indicates whether or not to flip the bits of the returned bit mask\n        obtained from input bit flags. This parameter must be set to `None`\n        when input ``bit_flags`` is either `None` or a Python list of flags.\n\n    flag_name_map : BitFlagNameMap\n         A `BitFlagNameMap` object that provides mapping from mnemonic\n         bit flag names to integer bit values in order to translate mnemonic\n         flags to numeric values when ``bit_flags`` that are comma- or\n         '+'-separated list of menmonic bit flag names.\n\n    Returns\n    -------\n    bitmask : int or None\n        Returns an integer bit mask formed from the input bit value or `None`\n        if input ``bit_flags`` parameter is `None` or an empty string.\n        If input string value was prepended with '~' (or ``flip_bits`` was set\n        to `True`), then returned value will have its bits flipped\n        (inverse mask).\n\n    Examples\n    --------\n\n        >>> from astropy.nddata.bitmask import interpret_bit_flags, extend_bit_flag_map\n        >>> ST_DQ = extend_bit_flag_map('ST_DQ', CR=1, CLOUDY=4, RAINY=8, HOT=16, DEAD=32)\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags(28))\n        '0000000000011100'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags('4,8,16'))\n        '0000000000011100'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags('CLOUDY,RAINY,HOT', flag_name_map=ST_DQ))\n        '0000000000011100'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags('~4,8,16'))\n        '1111111111100011'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags('~(4+8+16)'))\n        '1111111111100011'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags('~(CLOUDY+RAINY+HOT)',\n        ... flag_name_map=ST_DQ))\n        '1111111111100011'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags([4, 8, 16]))\n        '0000000000011100'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags([4, 8, 16], flip_bits=True))\n        '1111111111100011'\n\n    ","endLoc":463,"header":"def interpret_bit_flags(bit_flags, flip_bits=None, flag_name_map=None)","id":11925,"name":"interpret_bit_flags","nodeType":"Function","startLoc":268,"text":"def interpret_bit_flags(bit_flags, flip_bits=None, flag_name_map=None):\n    \"\"\"\n    Converts input bit flags to a single integer value (bit mask) or `None`.\n\n    When input is a list of flags (either a Python list of integer flags or a\n    string of comma-, ``'|'``-, or ``'+'``-separated list of flags),\n    the returned bit mask is obtained by summing input flags.\n\n    .. note::\n        In order to flip the bits of the returned bit mask,\n        for input of `str` type, prepend '~' to the input string. '~' must\n        be prepended to the *entire string* and not to each bit flag! For\n        input that is already a bit mask or a Python list of bit flags, set\n        ``flip_bits`` for `True` in order to flip the bits of the returned\n        bit mask.\n\n    Parameters\n    ----------\n    bit_flags : int, str, list, None\n        An integer bit mask or flag, `None`, a string of comma-, ``'|'``- or\n        ``'+'``-separated list of integer bit flags or mnemonic flag names,\n        or a Python list of integer bit flags. If ``bit_flags`` is a `str`\n        and if it is prepended with '~', then the output bit mask will have\n        its bits flipped (compared to simple sum of input flags).\n        For input ``bit_flags`` that is already a bit mask or a Python list\n        of bit flags, bit-flipping can be controlled through ``flip_bits``\n        parameter.\n\n        .. note::\n            When ``bit_flags`` is a list of flag names, the ``flag_name_map``\n            parameter must be provided.\n\n        .. note::\n            Only one flag separator is supported at a time. ``bit_flags``\n            string should not mix ``','``, ``'+'``, and ``'|'`` separators.\n\n    flip_bits : bool, None\n        Indicates whether or not to flip the bits of the returned bit mask\n        obtained from input bit flags. This parameter must be set to `None`\n        when input ``bit_flags`` is either `None` or a Python list of flags.\n\n    flag_name_map : BitFlagNameMap\n         A `BitFlagNameMap` object that provides mapping from mnemonic\n         bit flag names to integer bit values in order to translate mnemonic\n         flags to numeric values when ``bit_flags`` that are comma- or\n         '+'-separated list of menmonic bit flag names.\n\n    Returns\n    -------\n    bitmask : int or None\n        Returns an integer bit mask formed from the input bit value or `None`\n        if input ``bit_flags`` parameter is `None` or an empty string.\n        If input string value was prepended with '~' (or ``flip_bits`` was set\n        to `True`), then returned value will have its bits flipped\n        (inverse mask).\n\n    Examples\n    --------\n\n        >>> from astropy.nddata.bitmask import interpret_bit_flags, extend_bit_flag_map\n        >>> ST_DQ = extend_bit_flag_map('ST_DQ', CR=1, CLOUDY=4, RAINY=8, HOT=16, DEAD=32)\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags(28))\n        '0000000000011100'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags('4,8,16'))\n        '0000000000011100'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags('CLOUDY,RAINY,HOT', flag_name_map=ST_DQ))\n        '0000000000011100'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags('~4,8,16'))\n        '1111111111100011'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags('~(4+8+16)'))\n        '1111111111100011'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags('~(CLOUDY+RAINY+HOT)',\n        ... flag_name_map=ST_DQ))\n        '1111111111100011'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags([4, 8, 16]))\n        '0000000000011100'\n        >>> \"{0:016b}\".format(0xFFFF & interpret_bit_flags([4, 8, 16], flip_bits=True))\n        '1111111111100011'\n\n    \"\"\"\n    has_flip_bits = flip_bits is not None\n    flip_bits = bool(flip_bits)\n    allow_non_flags = False\n\n    if _is_int(bit_flags):\n        return (~int(bit_flags) if flip_bits else int(bit_flags))\n\n    elif bit_flags is None:\n        if has_flip_bits:\n            raise TypeError(\n                \"Keyword argument 'flip_bits' must be set to 'None' when \"\n                \"input 'bit_flags' is None.\"\n            )\n        return None\n\n    elif isinstance(bit_flags, str):\n        if has_flip_bits:\n            raise TypeError(\n                \"Keyword argument 'flip_bits' is not permitted for \"\n                \"comma-separated string lists of bit flags. Prepend '~' to \"\n                \"the string to indicate bit-flipping.\"\n            )\n\n        bit_flags = str(bit_flags).strip()\n\n        if bit_flags.upper() in ['', 'NONE', 'INDEF']:\n            return None\n\n        # check whether bitwise-NOT is present and if it is, check that it is\n        # in the first position:\n        bitflip_pos = bit_flags.find('~')\n        if bitflip_pos == 0:\n            flip_bits = True\n            bit_flags = bit_flags[1:].lstrip()\n        else:\n            if bitflip_pos > 0:\n                raise ValueError(\"Bitwise-NOT must precede bit flag list.\")\n            flip_bits = False\n\n        # basic check for correct use of parenthesis:\n        while True:\n            nlpar = bit_flags.count('(')\n            nrpar = bit_flags.count(')')\n\n            if nlpar == 0 and nrpar == 0:\n                break\n\n            if nlpar != nrpar:\n                raise ValueError(\"Unbalanced parentheses in bit flag list.\")\n\n            lpar_pos = bit_flags.find('(')\n            rpar_pos = bit_flags.rfind(')')\n            if lpar_pos > 0 or rpar_pos < (len(bit_flags) - 1):\n                raise ValueError(\"Incorrect syntax (incorrect use of \"\n                                 \"parenthesis) in bit flag list.\")\n\n            bit_flags = bit_flags[1:-1].strip()\n\n        if sum(k in bit_flags for k in '+,|') > 1:\n            raise ValueError(\n                \"Only one type of bit flag separator may be used in one \"\n                \"expression. Allowed separators are: '+', '|', or ','.\"\n            )\n\n        if ',' in bit_flags:\n            bit_flags = bit_flags.split(',')\n\n        elif '+' in bit_flags:\n            bit_flags = bit_flags.split('+')\n\n        elif '|' in bit_flags:\n            bit_flags = bit_flags.split('|')\n\n        else:\n            if bit_flags == '':\n                raise ValueError(\n                    \"Empty bit flag lists not allowed when either bitwise-NOT \"\n                    \"or parenthesis are present.\"\n                )\n            bit_flags = [bit_flags]\n\n        if flag_name_map is not None:\n            try:\n                int(bit_flags[0])\n            except ValueError:\n                bit_flags = [flag_name_map[f] for f in bit_flags]\n\n        allow_non_flags = len(bit_flags) == 1\n\n    elif hasattr(bit_flags, '__iter__'):\n        if not all([_is_int(flag) for flag in bit_flags]):\n            if (flag_name_map is not None and all([isinstance(flag, str)\n                                                   for flag in bit_flags])):\n                bit_flags = [flag_name_map[f] for f in bit_flags]\n            else:\n                raise TypeError(\"Every bit flag in a list must be either an \"\n                                \"integer flag value or a 'str' flag name.\")\n\n    else:\n        raise TypeError(\"Unsupported type for argument 'bit_flags'.\")\n\n    bitset = set(map(int, bit_flags))\n    if len(bitset) != len(bit_flags):\n        warnings.warn(\"Duplicate bit flags will be ignored\")\n\n    bitmask = 0\n    for v in bitset:\n        if not _is_bit_flag(v) and not allow_non_flags:\n            raise ValueError(\"Input list contains invalid (not powers of two) \"\n                             \"bit flag: {:d}\".format(v))\n        bitmask += v\n\n    if flip_bits:\n        bitmask = ~bitmask\n\n    return bitmask"},{"col":4,"comment":"null","endLoc":1449,"header":"def __repr__(self)","id":11926,"name":"__repr__","nodeType":"Function","startLoc":1448,"text":"def __repr__(self):\n        return 'LRItem(' + str(self) + ')'"},{"attributeType":"null","col":8,"comment":"null","endLoc":1433,"id":11927,"name":"number","nodeType":"Attribute","startLoc":1433,"text":"self.number"},{"attributeType":"null","col":8,"comment":"null","endLoc":1437,"id":11928,"name":"prod","nodeType":"Attribute","startLoc":1437,"text":"self.prod"},{"attributeType":"null","col":8,"comment":"null","endLoc":1438,"id":11929,"name":"len","nodeType":"Attribute","startLoc":1438,"text":"self.len"},{"attributeType":"null","col":8,"comment":"null","endLoc":1434,"id":11930,"name":"lr_index","nodeType":"Attribute","startLoc":1434,"text":"self.lr_index"},{"attributeType":"null","col":8,"comment":"null","endLoc":1435,"id":11931,"name":"lookaheads","nodeType":"Attribute","startLoc":1435,"text":"self.lookaheads"},{"attributeType":"null","col":8,"comment":"null","endLoc":1439,"id":11932,"name":"usyms","nodeType":"Attribute","startLoc":1439,"text":"self.usyms"},{"attributeType":"null","col":8,"comment":"null","endLoc":1431,"id":11933,"name":"name","nodeType":"Attribute","startLoc":1431,"text":"self.name"},{"col":4,"comment":"\n        Calculate the resulting mask\n\n        This is implemented as the piecewise ``or`` operation if both have a\n        mask.\n\n        Parameters\n        ----------\n        operation : callable\n            see :meth:`NDArithmeticMixin._arithmetic` parameter description.\n            By default, the ``operation`` will be ignored.\n\n        operand : `NDData`-like instance\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        handle_mask : callable\n            see :meth:`NDArithmeticMixin.add`\n\n        kwds :\n            Additional parameters given to ``handle_mask``.\n\n        Returns\n        -------\n        result_mask : any type\n            If only one mask was present this mask is returned.\n            If neither had a mask ``None`` is returned. Otherwise\n            ``handle_mask`` must create (and copy) the returned mask.\n        ","endLoc":438,"header":"def _arithmetic_mask(self, operation, operand, handle_mask, **kwds)","id":11934,"name":"_arithmetic_mask","nodeType":"Function","startLoc":397,"text":"def _arithmetic_mask(self, operation, operand, handle_mask, **kwds):\n        \"\"\"\n        Calculate the resulting mask\n\n        This is implemented as the piecewise ``or`` operation if both have a\n        mask.\n\n        Parameters\n        ----------\n        operation : callable\n            see :meth:`NDArithmeticMixin._arithmetic` parameter description.\n            By default, the ``operation`` will be ignored.\n\n        operand : `NDData`-like instance\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        handle_mask : callable\n            see :meth:`NDArithmeticMixin.add`\n\n        kwds :\n            Additional parameters given to ``handle_mask``.\n\n        Returns\n        -------\n        result_mask : any type\n            If only one mask was present this mask is returned.\n            If neither had a mask ``None`` is returned. Otherwise\n            ``handle_mask`` must create (and copy) the returned mask.\n        \"\"\"\n\n        # If only one mask is present we need not bother about any type checks\n        if self.mask is None and operand.mask is None:\n            return None\n        elif self.mask is None:\n            # Make a copy so there is no reference in the result.\n            return deepcopy(operand.mask)\n        elif operand.mask is None:\n            return deepcopy(self.mask)\n        else:\n            # Now lets calculate the resulting mask (operation enforces copy)\n            return handle_mask(self.mask, operand.mask, **kwds)"},{"className":"GrammarError","col":0,"comment":"null","endLoc":1473,"id":11935,"nodeType":"Class","startLoc":1472,"text":"class GrammarError(YaccError):\n    pass"},{"className":"NDDataArray","col":0,"comment":"\n    An ``NDData`` object with arithmetic. This class is functionally equivalent\n    to ``NDData`` in astropy  versions prior to 1.0.\n\n    The key distinction from raw numpy arrays is the presence of\n    additional metadata such as uncertainties, a mask, units, flags,\n    and/or a coordinate system.\n\n    See also: https://docs.astropy.org/en/stable/nddata/\n\n    Parameters\n    ----------\n    data : ndarray or `NDData`\n        The actual data contained in this `NDData` object. Not that this\n        will always be copies by *reference* , so you should make copy\n        the ``data`` before passing it in if that's the  desired behavior.\n\n    uncertainty : `~astropy.nddata.NDUncertainty`, optional\n        Uncertainties on the data.\n\n    mask : array-like, optional\n        Mask for the data, given as a boolean Numpy array or any object that\n        can be converted to a boolean Numpy array with a shape\n        matching that of the data. The values must be ``False`` where\n        the data is *valid* and ``True`` when it is not (like Numpy\n        masked arrays). If ``data`` is a numpy masked array, providing\n        ``mask`` here will causes the mask from the masked array to be\n        ignored.\n\n    flags : array-like or `~astropy.nddata.FlagCollection`, optional\n        Flags giving information about each pixel. These can be specified\n        either as a Numpy array of any type (or an object which can be converted\n        to a Numpy array) with a shape matching that of the\n        data, or as a `~astropy.nddata.FlagCollection` instance which has a\n        shape matching that of the data.\n\n    wcs : None, optional\n        WCS-object containing the world coordinate system for the data.\n\n        .. warning::\n            This is not yet defined because the discussion of how best to\n            represent this class's WCS system generically is still under\n            consideration. For now just leave it as None\n\n    meta : `dict`-like object, optional\n        Metadata for this object.  \"Metadata\" here means all information that\n        is included with this object but not part of any other attribute\n        of this particular object.  e.g., creation date, unique identifier,\n        simulation parameters, exposure time, telescope name, etc.\n\n    unit : `~astropy.units.UnitBase` instance or str, optional\n        The units of the data.\n\n\n    Raises\n    ------\n    ValueError :\n        If the `uncertainty` or `mask` inputs cannot be broadcast (e.g., match\n        shape) onto ``data``.\n    ","endLoc":290,"id":11936,"nodeType":"Class","startLoc":22,"text":"class NDDataArray(NDArithmeticMixin, NDSlicingMixin, NDIOMixin, NDData):\n    \"\"\"\n    An ``NDData`` object with arithmetic. This class is functionally equivalent\n    to ``NDData`` in astropy  versions prior to 1.0.\n\n    The key distinction from raw numpy arrays is the presence of\n    additional metadata such as uncertainties, a mask, units, flags,\n    and/or a coordinate system.\n\n    See also: https://docs.astropy.org/en/stable/nddata/\n\n    Parameters\n    ----------\n    data : ndarray or `NDData`\n        The actual data contained in this `NDData` object. Not that this\n        will always be copies by *reference* , so you should make copy\n        the ``data`` before passing it in if that's the  desired behavior.\n\n    uncertainty : `~astropy.nddata.NDUncertainty`, optional\n        Uncertainties on the data.\n\n    mask : array-like, optional\n        Mask for the data, given as a boolean Numpy array or any object that\n        can be converted to a boolean Numpy array with a shape\n        matching that of the data. The values must be ``False`` where\n        the data is *valid* and ``True`` when it is not (like Numpy\n        masked arrays). If ``data`` is a numpy masked array, providing\n        ``mask`` here will causes the mask from the masked array to be\n        ignored.\n\n    flags : array-like or `~astropy.nddata.FlagCollection`, optional\n        Flags giving information about each pixel. These can be specified\n        either as a Numpy array of any type (or an object which can be converted\n        to a Numpy array) with a shape matching that of the\n        data, or as a `~astropy.nddata.FlagCollection` instance which has a\n        shape matching that of the data.\n\n    wcs : None, optional\n        WCS-object containing the world coordinate system for the data.\n\n        .. warning::\n            This is not yet defined because the discussion of how best to\n            represent this class's WCS system generically is still under\n            consideration. For now just leave it as None\n\n    meta : `dict`-like object, optional\n        Metadata for this object.  \"Metadata\" here means all information that\n        is included with this object but not part of any other attribute\n        of this particular object.  e.g., creation date, unique identifier,\n        simulation parameters, exposure time, telescope name, etc.\n\n    unit : `~astropy.units.UnitBase` instance or str, optional\n        The units of the data.\n\n\n    Raises\n    ------\n    ValueError :\n        If the `uncertainty` or `mask` inputs cannot be broadcast (e.g., match\n        shape) onto ``data``.\n    \"\"\"\n\n    def __init__(self, data, *args, flags=None, **kwargs):\n\n        # Initialize with the parent...\n        super().__init__(data, *args, **kwargs)\n\n        # ...then reset uncertainty to force it to go through the\n        # setter logic below. In base NDData all that is done is to\n        # set self._uncertainty to whatever uncertainty is passed in.\n        self.uncertainty = self._uncertainty\n\n        # Same thing for mask.\n        self.mask = self._mask\n\n        # Initial flags because it is no longer handled in NDData\n        # or NDDataBase.\n        if isinstance(data, NDDataArray):\n            if flags is None:\n                flags = data.flags\n            else:\n                log.info(\"Overwriting NDDataArrays's current \"\n                         \"flags with specified flags\")\n        self.flags = flags\n\n    # Implement uncertainty as NDUncertainty to support propagation of\n    # uncertainties in arithmetic operations\n    @property\n    def uncertainty(self):\n        return self._uncertainty\n\n    @uncertainty.setter\n    def uncertainty(self, value):\n        if value is not None:\n            if isinstance(value, NDUncertainty):\n                class_name = self.__class__.__name__\n                if not self.unit and value._unit:\n                    # Raise an error if uncertainty has unit and data does not\n                    raise ValueError(\"Cannot assign an uncertainty with unit \"\n                                     \"to {} without \"\n                                     \"a unit\".format(class_name))\n                self._uncertainty = value\n                self._uncertainty.parent_nddata = self\n            else:\n                raise TypeError(\"Uncertainty must be an instance of \"\n                                \"a NDUncertainty object\")\n        else:\n            self._uncertainty = value\n\n    # Override unit so that we can add a setter.\n    @property\n    def unit(self):\n        return self._unit\n\n    @unit.setter\n    def unit(self, value):\n        from . import conf\n\n        try:\n            if self._unit is not None and conf.warn_setting_unit_directly:\n                log.info('Setting the unit directly changes the unit without '\n                         'updating the data or uncertainty. Use the '\n                         '.convert_unit_to() method to change the unit and '\n                         'scale values appropriately.')\n        except AttributeError:\n            # raised if self._unit has not been set yet, in which case the\n            # warning is irrelevant\n            pass\n\n        if value is None:\n            self._unit = None\n        else:\n            self._unit = Unit(value)\n\n    # Implement mask in a way that converts nicely to a numpy masked array\n    @property\n    def mask(self):\n        if self._mask is np.ma.nomask:\n            return None\n        else:\n            return self._mask\n\n    @mask.setter\n    def mask(self, value):\n        # Check that value is not either type of null mask.\n        if (value is not None) and (value is not np.ma.nomask):\n            mask = np.array(value, dtype=np.bool_, copy=False)\n            if mask.shape != self.data.shape:\n                raise ValueError(\"dimensions of mask do not match data\")\n            else:\n                self._mask = mask\n        else:\n            # internal representation should be one numpy understands\n            self._mask = np.ma.nomask\n\n    @property\n    def shape(self):\n        \"\"\"\n        shape tuple of this object's data.\n        \"\"\"\n        return self.data.shape\n\n    @property\n    def size(self):\n        \"\"\"\n        integer size of this object's data.\n        \"\"\"\n        return self.data.size\n\n    @property\n    def dtype(self):\n        \"\"\"\n        `numpy.dtype` of this object's data.\n        \"\"\"\n        return self.data.dtype\n\n    @property\n    def ndim(self):\n        \"\"\"\n        integer dimensions of this object's data\n        \"\"\"\n        return self.data.ndim\n\n    @property\n    def flags(self):\n        return self._flags\n\n    @flags.setter\n    def flags(self, value):\n        if value is not None:\n            if isinstance(value, FlagCollection):\n                if value.shape != self.shape:\n                    raise ValueError(\"dimensions of FlagCollection does not match data\")\n                else:\n                    self._flags = value\n            else:\n                flags = np.array(value, copy=False)\n                if flags.shape != self.shape:\n                    raise ValueError(\"dimensions of flags do not match data\")\n                else:\n                    self._flags = flags\n        else:\n            self._flags = value\n\n    def __array__(self):\n        \"\"\"\n        This allows code that requests a Numpy array to use an NDData\n        object as a Numpy array.\n        \"\"\"\n        if self.mask is not None:\n            return np.ma.masked_array(self.data, self.mask)\n        else:\n            return np.array(self.data)\n\n    def __array_prepare__(self, array, context=None):\n        \"\"\"\n        This ensures that a masked array is returned if self is masked.\n        \"\"\"\n        if self.mask is not None:\n            return np.ma.masked_array(array, self.mask)\n        else:\n            return array\n\n    def convert_unit_to(self, unit, equivalencies=[]):\n        \"\"\"\n        Returns a new `NDData` object whose values have been converted\n        to a new unit.\n\n        Parameters\n        ----------\n        unit : `astropy.units.UnitBase` instance or str\n            The unit to convert to.\n\n        equivalencies : list of tuple\n           A list of equivalence pairs to try if the units are not\n           directly convertible.  See :ref:`astropy:unit_equivalencies`.\n\n        Returns\n        -------\n        result : `~astropy.nddata.NDData`\n            The resulting dataset\n\n        Raises\n        ------\n        `~astropy.units.UnitsError`\n            If units are inconsistent.\n\n        \"\"\"\n        if self.unit is None:\n            raise ValueError(\"No unit specified on source data\")\n        data = self.unit.to(unit, self.data, equivalencies=equivalencies)\n        if self.uncertainty is not None:\n            uncertainty_values = self.unit.to(unit, self.uncertainty.array,\n                                              equivalencies=equivalencies)\n            # should work for any uncertainty class\n            uncertainty = self.uncertainty.__class__(uncertainty_values)\n        else:\n            uncertainty = None\n        if self.mask is not None:\n            new_mask = self.mask.copy()\n        else:\n            new_mask = None\n        # Call __class__ in case we are dealing with an inherited type\n        result = self.__class__(data, uncertainty=uncertainty,\n                                mask=new_mask,\n                                wcs=self.wcs,\n                                meta=self.meta, unit=unit)\n\n        return result"},{"className":"Grammar","col":0,"comment":"null","endLoc":1960,"id":11937,"nodeType":"Class","startLoc":1475,"text":"class Grammar(object):\n    def __init__(self, terminals):\n        self.Productions  = [None]  # A list of all of the productions.  The first\n                                    # entry is always reserved for the purpose of\n                                    # building an augmented grammar\n\n        self.Prodnames    = {}      # A dictionary mapping the names of nonterminals to a list of all\n                                    # productions of that nonterminal.\n\n        self.Prodmap      = {}      # A dictionary that is only used to detect duplicate\n                                    # productions.\n\n        self.Terminals    = {}      # A dictionary mapping the names of terminal symbols to a\n                                    # list of the rules where they are used.\n\n        for term in terminals:\n            self.Terminals[term] = []\n\n        self.Terminals['error'] = []\n\n        self.Nonterminals = {}      # A dictionary mapping names of nonterminals to a list\n                                    # of rule numbers where they are used.\n\n        self.First        = {}      # A dictionary of precomputed FIRST(x) symbols\n\n        self.Follow       = {}      # A dictionary of precomputed FOLLOW(x) symbols\n\n        self.Precedence   = {}      # Precedence rules for each terminal. Contains tuples of the\n                                    # form ('right',level) or ('nonassoc', level) or ('left',level)\n\n        self.UsedPrecedence = set() # Precedence rules that were actually used by the grammer.\n                                    # This is only used to provide error checking and to generate\n                                    # a warning about unused precedence rules.\n\n        self.Start = None           # Starting symbol for the grammar\n\n\n    def __len__(self):\n        return len(self.Productions)\n\n    def __getitem__(self, index):\n        return self.Productions[index]\n\n    # -----------------------------------------------------------------------------\n    # set_precedence()\n    #\n    # Sets the precedence for a given terminal. assoc is the associativity such as\n    # 'left','right', or 'nonassoc'.  level is a numeric level.\n    #\n    # -----------------------------------------------------------------------------\n\n    def set_precedence(self, term, assoc, level):\n        assert self.Productions == [None], 'Must call set_precedence() before add_production()'\n        if term in self.Precedence:\n            raise GrammarError('Precedence already specified for terminal %r' % term)\n        if assoc not in ['left', 'right', 'nonassoc']:\n            raise GrammarError(\"Associativity must be one of 'left','right', or 'nonassoc'\")\n        self.Precedence[term] = (assoc, level)\n\n    # -----------------------------------------------------------------------------\n    # add_production()\n    #\n    # Given an action function, this function assembles a production rule and\n    # computes its precedence level.\n    #\n    # The production rule is supplied as a list of symbols.   For example,\n    # a rule such as 'expr : expr PLUS term' has a production name of 'expr' and\n    # symbols ['expr','PLUS','term'].\n    #\n    # Precedence is determined by the precedence of the right-most non-terminal\n    # or the precedence of a terminal specified by %prec.\n    #\n    # A variety of error checks are performed to make sure production symbols\n    # are valid and that %prec is used correctly.\n    # -----------------------------------------------------------------------------\n\n    def add_production(self, prodname, syms, func=None, file='', line=0):\n\n        if prodname in self.Terminals:\n            raise GrammarError('%s:%d: Illegal rule name %r. Already defined as a token' % (file, line, prodname))\n        if prodname == 'error':\n            raise GrammarError('%s:%d: Illegal rule name %r. error is a reserved word' % (file, line, prodname))\n        if not _is_identifier.match(prodname):\n            raise GrammarError('%s:%d: Illegal rule name %r' % (file, line, prodname))\n\n        # Look for literal tokens\n        for n, s in enumerate(syms):\n            if s[0] in \"'\\\"\":\n                try:\n                    c = eval(s)\n                    if (len(c) > 1):\n                        raise GrammarError('%s:%d: Literal token %s in rule %r may only be a single character' %\n                                           (file, line, s, prodname))\n                    if c not in self.Terminals:\n                        self.Terminals[c] = []\n                    syms[n] = c\n                    continue\n                except SyntaxError:\n                    pass\n            if not _is_identifier.match(s) and s != '%prec':\n                raise GrammarError('%s:%d: Illegal name %r in rule %r' % (file, line, s, prodname))\n\n        # Determine the precedence level\n        if '%prec' in syms:\n            if syms[-1] == '%prec':\n                raise GrammarError('%s:%d: Syntax error. Nothing follows %%prec' % (file, line))\n            if syms[-2] != '%prec':\n                raise GrammarError('%s:%d: Syntax error. %%prec can only appear at the end of a grammar rule' %\n                                   (file, line))\n            precname = syms[-1]\n            prodprec = self.Precedence.get(precname)\n            if not prodprec:\n                raise GrammarError('%s:%d: Nothing known about the precedence of %r' % (file, line, precname))\n            else:\n                self.UsedPrecedence.add(precname)\n            del syms[-2:]     # Drop %prec from the rule\n        else:\n            # If no %prec, precedence is determined by the rightmost terminal symbol\n            precname = rightmost_terminal(syms, self.Terminals)\n            prodprec = self.Precedence.get(precname, ('right', 0))\n\n        # See if the rule is already in the rulemap\n        map = '%s -> %s' % (prodname, syms)\n        if map in self.Prodmap:\n            m = self.Prodmap[map]\n            raise GrammarError('%s:%d: Duplicate rule %s. ' % (file, line, m) +\n                               'Previous definition at %s:%d' % (m.file, m.line))\n\n        # From this point on, everything is valid.  Create a new Production instance\n        pnumber  = len(self.Productions)\n        if prodname not in self.Nonterminals:\n            self.Nonterminals[prodname] = []\n\n        # Add the production number to Terminals and Nonterminals\n        for t in syms:\n            if t in self.Terminals:\n                self.Terminals[t].append(pnumber)\n            else:\n                if t not in self.Nonterminals:\n                    self.Nonterminals[t] = []\n                self.Nonterminals[t].append(pnumber)\n\n        # Create a production and add it to the list of productions\n        p = Production(pnumber, prodname, syms, prodprec, func, file, line)\n        self.Productions.append(p)\n        self.Prodmap[map] = p\n\n        # Add to the global productions list\n        try:\n            self.Prodnames[prodname].append(p)\n        except KeyError:\n            self.Prodnames[prodname] = [p]\n\n    # -----------------------------------------------------------------------------\n    # set_start()\n    #\n    # Sets the starting symbol and creates the augmented grammar.  Production\n    # rule 0 is S' -> start where start is the start symbol.\n    # -----------------------------------------------------------------------------\n\n    def set_start(self, start=None):\n        if not start:\n            start = self.Productions[1].name\n        if start not in self.Nonterminals:\n            raise GrammarError('start symbol %s undefined' % start)\n        self.Productions[0] = Production(0, \"S'\", [start])\n        self.Nonterminals[start].append(0)\n        self.Start = start\n\n    # -----------------------------------------------------------------------------\n    # find_unreachable()\n    #\n    # Find all of the nonterminal symbols that can't be reached from the starting\n    # symbol.  Returns a list of nonterminals that can't be reached.\n    # -----------------------------------------------------------------------------\n\n    def find_unreachable(self):\n\n        # Mark all symbols that are reachable from a symbol s\n        def mark_reachable_from(s):\n            if s in reachable:\n                return\n            reachable.add(s)\n            for p in self.Prodnames.get(s, []):\n                for r in p.prod:\n                    mark_reachable_from(r)\n\n        reachable = set()\n        mark_reachable_from(self.Productions[0].prod[0])\n        return [s for s in self.Nonterminals if s not in reachable]\n\n    # -----------------------------------------------------------------------------\n    # infinite_cycles()\n    #\n    # This function looks at the various parsing rules and tries to detect\n    # infinite recursion cycles (grammar rules where there is no possible way\n    # to derive a string of only terminals).\n    # -----------------------------------------------------------------------------\n\n    def infinite_cycles(self):\n        terminates = {}\n\n        # Terminals:\n        for t in self.Terminals:\n            terminates[t] = True\n\n        terminates['$end'] = True\n\n        # Nonterminals:\n\n        # Initialize to false:\n        for n in self.Nonterminals:\n            terminates[n] = False\n\n        # Then propagate termination until no change:\n        while True:\n            some_change = False\n            for (n, pl) in self.Prodnames.items():\n                # Nonterminal n terminates iff any of its productions terminates.\n                for p in pl:\n                    # Production p terminates iff all of its rhs symbols terminate.\n                    for s in p.prod:\n                        if not terminates[s]:\n                            # The symbol s does not terminate,\n                            # so production p does not terminate.\n                            p_terminates = False\n                            break\n                    else:\n                        # didn't break from the loop,\n                        # so every symbol s terminates\n                        # so production p terminates.\n                        p_terminates = True\n\n                    if p_terminates:\n                        # symbol n terminates!\n                        if not terminates[n]:\n                            terminates[n] = True\n                            some_change = True\n                        # Don't need to consider any more productions for this n.\n                        break\n\n            if not some_change:\n                break\n\n        infinite = []\n        for (s, term) in terminates.items():\n            if not term:\n                if s not in self.Prodnames and s not in self.Terminals and s != 'error':\n                    # s is used-but-not-defined, and we've already warned of that,\n                    # so it would be overkill to say that it's also non-terminating.\n                    pass\n                else:\n                    infinite.append(s)\n\n        return infinite\n\n    # -----------------------------------------------------------------------------\n    # undefined_symbols()\n    #\n    # Find all symbols that were used the grammar, but not defined as tokens or\n    # grammar rules.  Returns a list of tuples (sym, prod) where sym in the symbol\n    # and prod is the production where the symbol was used.\n    # -----------------------------------------------------------------------------\n    def undefined_symbols(self):\n        result = []\n        for p in self.Productions:\n            if not p:\n                continue\n\n            for s in p.prod:\n                if s not in self.Prodnames and s not in self.Terminals and s != 'error':\n                    result.append((s, p))\n        return result\n\n    # -----------------------------------------------------------------------------\n    # unused_terminals()\n    #\n    # Find all terminals that were defined, but not used by the grammar.  Returns\n    # a list of all symbols.\n    # -----------------------------------------------------------------------------\n    def unused_terminals(self):\n        unused_tok = []\n        for s, v in self.Terminals.items():\n            if s != 'error' and not v:\n                unused_tok.append(s)\n\n        return unused_tok\n\n    # ------------------------------------------------------------------------------\n    # unused_rules()\n    #\n    # Find all grammar rules that were defined,  but not used (maybe not reachable)\n    # Returns a list of productions.\n    # ------------------------------------------------------------------------------\n\n    def unused_rules(self):\n        unused_prod = []\n        for s, v in self.Nonterminals.items():\n            if not v:\n                p = self.Prodnames[s][0]\n                unused_prod.append(p)\n        return unused_prod\n\n    # -----------------------------------------------------------------------------\n    # unused_precedence()\n    #\n    # Returns a list of tuples (term,precedence) corresponding to precedence\n    # rules that were never used by the grammar.  term is the name of the terminal\n    # on which precedence was applied and precedence is a string such as 'left' or\n    # 'right' corresponding to the type of precedence.\n    # -----------------------------------------------------------------------------\n\n    def unused_precedence(self):\n        unused = []\n        for termname in self.Precedence:\n            if not (termname in self.Terminals or termname in self.UsedPrecedence):\n                unused.append((termname, self.Precedence[termname][0]))\n\n        return unused\n\n    # -------------------------------------------------------------------------\n    # _first()\n    #\n    # Compute the value of FIRST1(beta) where beta is a tuple of symbols.\n    #\n    # During execution of compute_first1, the result may be incomplete.\n    # Afterward (e.g., when called from compute_follow()), it will be complete.\n    # -------------------------------------------------------------------------\n    def _first(self, beta):\n\n        # We are computing First(x1,x2,x3,...,xn)\n        result = []\n        for x in beta:\n            x_produces_empty = False\n\n            # Add all the non-<empty> symbols of First[x] to the result.\n            for f in self.First[x]:\n                if f == '<empty>':\n                    x_produces_empty = True\n                else:\n                    if f not in result:\n                        result.append(f)\n\n            if x_produces_empty:\n                # We have to consider the next x in beta,\n                # i.e. stay in the loop.\n                pass\n            else:\n                # We don't have to consider any further symbols in beta.\n                break\n        else:\n            # There was no 'break' from the loop,\n            # so x_produces_empty was true for all x in beta,\n            # so beta produces empty as well.\n            result.append('<empty>')\n\n        return result\n\n    # -------------------------------------------------------------------------\n    # compute_first()\n    #\n    # Compute the value of FIRST1(X) for all symbols\n    # -------------------------------------------------------------------------\n    def compute_first(self):\n        if self.First:\n            return self.First\n\n        # Terminals:\n        for t in self.Terminals:\n            self.First[t] = [t]\n\n        self.First['$end'] = ['$end']\n\n        # Nonterminals:\n\n        # Initialize to the empty set:\n        for n in self.Nonterminals:\n            self.First[n] = []\n\n        # Then propagate symbols until no change:\n        while True:\n            some_change = False\n            for n in self.Nonterminals:\n                for p in self.Prodnames[n]:\n                    for f in self._first(p.prod):\n                        if f not in self.First[n]:\n                            self.First[n].append(f)\n                            some_change = True\n            if not some_change:\n                break\n\n        return self.First\n\n    # ---------------------------------------------------------------------\n    # compute_follow()\n    #\n    # Computes all of the follow sets for every non-terminal symbol.  The\n    # follow set is the set of all symbols that might follow a given\n    # non-terminal.  See the Dragon book, 2nd Ed. p. 189.\n    # ---------------------------------------------------------------------\n    def compute_follow(self, start=None):\n        # If already computed, return the result\n        if self.Follow:\n            return self.Follow\n\n        # If first sets not computed yet, do that first.\n        if not self.First:\n            self.compute_first()\n\n        # Add '$end' to the follow list of the start symbol\n        for k in self.Nonterminals:\n            self.Follow[k] = []\n\n        if not start:\n            start = self.Productions[1].name\n\n        self.Follow[start] = ['$end']\n\n        while True:\n            didadd = False\n            for p in self.Productions[1:]:\n                # Here is the production set\n                for i, B in enumerate(p.prod):\n                    if B in self.Nonterminals:\n                        # Okay. We got a non-terminal in a production\n                        fst = self._first(p.prod[i+1:])\n                        hasempty = False\n                        for f in fst:\n                            if f != '<empty>' and f not in self.Follow[B]:\n                                self.Follow[B].append(f)\n                                didadd = True\n                            if f == '<empty>':\n                                hasempty = True\n                        if hasempty or i == (len(p.prod)-1):\n                            # Add elements of follow(a) to follow(b)\n                            for f in self.Follow[p.name]:\n                                if f not in self.Follow[B]:\n                                    self.Follow[B].append(f)\n                                    didadd = True\n            if not didadd:\n                break\n        return self.Follow\n\n\n    # -----------------------------------------------------------------------------\n    # build_lritems()\n    #\n    # This function walks the list of productions and builds a complete set of the\n    # LR items.  The LR items are stored in two ways:  First, they are uniquely\n    # numbered and placed in the list _lritems.  Second, a linked list of LR items\n    # is built for each production.  For example:\n    #\n    #   E -> E PLUS E\n    #\n    # Creates the list\n    #\n    #  [E -> . E PLUS E, E -> E . PLUS E, E -> E PLUS . E, E -> E PLUS E . ]\n    # -----------------------------------------------------------------------------\n\n    def build_lritems(self):\n        for p in self.Productions:\n            lastlri = p\n            i = 0\n            lr_items = []\n            while True:\n                if i > len(p):\n                    lri = None\n                else:\n                    lri = LRItem(p, i)\n                    # Precompute the list of productions immediately following\n                    try:\n                        lri.lr_after = self.Prodnames[lri.prod[i+1]]\n                    except (IndexError, KeyError):\n                        lri.lr_after = []\n                    try:\n                        lri.lr_before = lri.prod[i-1]\n                    except IndexError:\n                        lri.lr_before = None\n\n                lastlri.lr_next = lri\n                if not lri:\n                    break\n                lr_items.append(lri)\n                lastlri = lri\n                i += 1\n            p.lr_items = lr_items"},{"col":4,"comment":"\n        Calculate the resulting meta.\n\n        Parameters\n        ----------\n        operation : callable\n            see :meth:`NDArithmeticMixin._arithmetic` parameter description.\n            By default, the ``operation`` will be ignored.\n\n        operand : `NDData`-like instance\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        handle_meta : callable\n            see :meth:`NDArithmeticMixin.add`\n\n        kwds :\n            Additional parameters given to ``handle_meta``.\n\n        Returns\n        -------\n        result_meta : any type\n            The result of ``handle_meta``.\n        ","endLoc":513,"header":"def _arithmetic_meta(self, operation, operand, handle_meta, **kwds)","id":11938,"name":"_arithmetic_meta","nodeType":"Function","startLoc":487,"text":"def _arithmetic_meta(self, operation, operand, handle_meta, **kwds):\n        \"\"\"\n        Calculate the resulting meta.\n\n        Parameters\n        ----------\n        operation : callable\n            see :meth:`NDArithmeticMixin._arithmetic` parameter description.\n            By default, the ``operation`` will be ignored.\n\n        operand : `NDData`-like instance\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        handle_meta : callable\n            see :meth:`NDArithmeticMixin.add`\n\n        kwds :\n            Additional parameters given to ``handle_meta``.\n\n        Returns\n        -------\n        result_meta : any type\n            The result of ``handle_meta``.\n        \"\"\"\n        # Just return what handle_meta does with both of the metas.\n        return handle_meta(self.meta, operand.meta, **kwds)"},{"col":4,"comment":"null","endLoc":519,"header":"@sharedmethod\n    @format_doc(_arit_doc, name='addition', op='+')\n    def add(self, operand, operand2=None, **kwargs)","id":11939,"name":"add","nodeType":"Function","startLoc":515,"text":"@sharedmethod\n    @format_doc(_arit_doc, name='addition', op='+')\n    def add(self, operand, operand2=None, **kwargs):\n        return self._prepare_then_do_arithmetic(np.add, operand, operand2,\n                                                **kwargs)"},{"col":4,"comment":"null","endLoc":1513,"header":"def __len__(self)","id":11940,"name":"__len__","nodeType":"Function","startLoc":1512,"text":"def __len__(self):\n        return len(self.Productions)"},{"col":4,"comment":"null","endLoc":1516,"header":"def __getitem__(self, index)","id":11941,"name":"__getitem__","nodeType":"Function","startLoc":1515,"text":"def __getitem__(self, index):\n        return self.Productions[index]"},{"col":4,"comment":"null","endLoc":1532,"header":"def set_precedence(self, term, assoc, level)","id":11942,"name":"set_precedence","nodeType":"Function","startLoc":1526,"text":"def set_precedence(self, term, assoc, level):\n        assert self.Productions == [None], 'Must call set_precedence() before add_production()'\n        if term in self.Precedence:\n            raise GrammarError('Precedence already specified for terminal %r' % term)\n        if assoc not in ['left', 'right', 'nonassoc']:\n            raise GrammarError(\"Associativity must be one of 'left','right', or 'nonassoc'\")\n        self.Precedence[term] = (assoc, level)"},{"col":4,"comment":"null","endLoc":1626,"header":"def add_production(self, prodname, syms, func=None, file='', line=0)","id":11943,"name":"add_production","nodeType":"Function","startLoc":1551,"text":"def add_production(self, prodname, syms, func=None, file='', line=0):\n\n        if prodname in self.Terminals:\n            raise GrammarError('%s:%d: Illegal rule name %r. Already defined as a token' % (file, line, prodname))\n        if prodname == 'error':\n            raise GrammarError('%s:%d: Illegal rule name %r. error is a reserved word' % (file, line, prodname))\n        if not _is_identifier.match(prodname):\n            raise GrammarError('%s:%d: Illegal rule name %r' % (file, line, prodname))\n\n        # Look for literal tokens\n        for n, s in enumerate(syms):\n            if s[0] in \"'\\\"\":\n                try:\n                    c = eval(s)\n                    if (len(c) > 1):\n                        raise GrammarError('%s:%d: Literal token %s in rule %r may only be a single character' %\n                                           (file, line, s, prodname))\n                    if c not in self.Terminals:\n                        self.Terminals[c] = []\n                    syms[n] = c\n                    continue\n                except SyntaxError:\n                    pass\n            if not _is_identifier.match(s) and s != '%prec':\n                raise GrammarError('%s:%d: Illegal name %r in rule %r' % (file, line, s, prodname))\n\n        # Determine the precedence level\n        if '%prec' in syms:\n            if syms[-1] == '%prec':\n                raise GrammarError('%s:%d: Syntax error. Nothing follows %%prec' % (file, line))\n            if syms[-2] != '%prec':\n                raise GrammarError('%s:%d: Syntax error. %%prec can only appear at the end of a grammar rule' %\n                                   (file, line))\n            precname = syms[-1]\n            prodprec = self.Precedence.get(precname)\n            if not prodprec:\n                raise GrammarError('%s:%d: Nothing known about the precedence of %r' % (file, line, precname))\n            else:\n                self.UsedPrecedence.add(precname)\n            del syms[-2:]     # Drop %prec from the rule\n        else:\n            # If no %prec, precedence is determined by the rightmost terminal symbol\n            precname = rightmost_terminal(syms, self.Terminals)\n            prodprec = self.Precedence.get(precname, ('right', 0))\n\n        # See if the rule is already in the rulemap\n        map = '%s -> %s' % (prodname, syms)\n        if map in self.Prodmap:\n            m = self.Prodmap[map]\n            raise GrammarError('%s:%d: Duplicate rule %s. ' % (file, line, m) +\n                               'Previous definition at %s:%d' % (m.file, m.line))\n\n        # From this point on, everything is valid.  Create a new Production instance\n        pnumber  = len(self.Productions)\n        if prodname not in self.Nonterminals:\n            self.Nonterminals[prodname] = []\n\n        # Add the production number to Terminals and Nonterminals\n        for t in syms:\n            if t in self.Terminals:\n                self.Terminals[t].append(pnumber)\n            else:\n                if t not in self.Nonterminals:\n                    self.Nonterminals[t] = []\n                self.Nonterminals[t].append(pnumber)\n\n        # Create a production and add it to the list of productions\n        p = Production(pnumber, prodname, syms, prodprec, func, file, line)\n        self.Productions.append(p)\n        self.Prodmap[map] = p\n\n        # Add to the global productions list\n        try:\n            self.Prodnames[prodname].append(p)\n        except KeyError:\n            self.Prodnames[prodname] = [p]"},{"col":4,"comment":"null","endLoc":525,"header":"@sharedmethod\n    @format_doc(_arit_doc, name='subtraction', op='-')\n    def subtract(self, operand, operand2=None, **kwargs)","id":11944,"name":"subtract","nodeType":"Function","startLoc":521,"text":"@sharedmethod\n    @format_doc(_arit_doc, name='subtraction', op='-')\n    def subtract(self, operand, operand2=None, **kwargs):\n        return self._prepare_then_do_arithmetic(np.subtract, operand, operand2,\n                                                **kwargs)"},{"className":"NDIOMixin","col":0,"comment":"\n    Mixin class to connect NDData to the astropy input/output registry.\n\n    This mixin adds two methods to its subclasses, ``read`` and ``write``.\n    ","endLoc":113,"id":11945,"nodeType":"Class","startLoc":106,"text":"class NDIOMixin:\n    \"\"\"\n    Mixin class to connect NDData to the astropy input/output registry.\n\n    This mixin adds two methods to its subclasses, ``read`` and ``write``.\n    \"\"\"\n    read = registry.UnifiedReadWriteMethod(NDDataRead)\n    write = registry.UnifiedReadWriteMethod(NDDataWrite)"},{"col":4,"comment":"null","endLoc":531,"header":"@sharedmethod\n    @format_doc(_arit_doc, name=\"multiplication\", op=\"*\")\n    def multiply(self, operand, operand2=None, **kwargs)","id":11946,"name":"multiply","nodeType":"Function","startLoc":527,"text":"@sharedmethod\n    @format_doc(_arit_doc, name=\"multiplication\", op=\"*\")\n    def multiply(self, operand, operand2=None, **kwargs):\n        return self._prepare_then_do_arithmetic(np.multiply, operand, operand2,\n                                                **kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":112,"id":11947,"name":"read","nodeType":"Attribute","startLoc":112,"text":"read"},{"attributeType":"null","col":4,"comment":"null","endLoc":113,"id":11948,"name":"write","nodeType":"Attribute","startLoc":113,"text":"write"},{"col":4,"comment":"null","endLoc":537,"header":"@sharedmethod\n    @format_doc(_arit_doc, name=\"division\", op=\"/\")\n    def divide(self, operand, operand2=None, **kwargs)","id":11949,"name":"divide","nodeType":"Function","startLoc":533,"text":"@sharedmethod\n    @format_doc(_arit_doc, name=\"division\", op=\"/\")\n    def divide(self, operand, operand2=None, **kwargs):\n        return self._prepare_then_do_arithmetic(np.true_divide, operand,\n                                                operand2, **kwargs)"},{"col":4,"comment":"null","endLoc":105,"header":"def __init__(self, data, *args, flags=None, **kwargs)","id":11950,"name":"__init__","nodeType":"Function","startLoc":84,"text":"def __init__(self, data, *args, flags=None, **kwargs):\n\n        # Initialize with the parent...\n        super().__init__(data, *args, **kwargs)\n\n        # ...then reset uncertainty to force it to go through the\n        # setter logic below. In base NDData all that is done is to\n        # set self._uncertainty to whatever uncertainty is passed in.\n        self.uncertainty = self._uncertainty\n\n        # Same thing for mask.\n        self.mask = self._mask\n\n        # Initial flags because it is no longer handled in NDData\n        # or NDDataBase.\n        if isinstance(data, NDDataArray):\n            if flags is None:\n                flags = data.flags\n            else:\n                log.info(\"Overwriting NDDataArrays's current \"\n                         \"flags with specified flags\")\n        self.flags = flags"},{"col":4,"comment":"Intermediate method called by public arithmetics (i.e. ``add``)\n        before the processing method (``_arithmetic``) is invoked.\n\n        .. warning::\n            Do not override this method in subclasses.\n\n        This method checks if it was called as instance or as class method and\n        then wraps the operands and the result from ``_arithmetics`` in the\n        appropriate subclass.\n\n        Parameters\n        ----------\n        self_or_cls : instance or class\n            ``sharedmethod`` behaves like a normal method if called on the\n            instance (then this parameter is ``self``) but like a classmethod\n            when called on the class (then this parameter is ``cls``).\n\n        operations : callable\n            The operation (normally a numpy-ufunc) that represents the\n            appropriate action.\n\n        operand, operand2, kwargs :\n            See for example ``add``.\n\n        Result\n        ------\n        result : `~astropy.nddata.NDData`-like\n            Depending how this method was called either ``self_or_cls``\n            (called on class) or ``self_or_cls.__class__`` (called on instance)\n            is the NDData-subclass that is used as wrapper for the result.\n        ","endLoc":616,"header":"@sharedmethod\n    def _prepare_then_do_arithmetic(self_or_cls, operation, operand, operand2,\n                                    **kwargs)","id":11951,"name":"_prepare_then_do_arithmetic","nodeType":"Function","startLoc":539,"text":"@sharedmethod\n    def _prepare_then_do_arithmetic(self_or_cls, operation, operand, operand2,\n                                    **kwargs):\n        \"\"\"Intermediate method called by public arithmetics (i.e. ``add``)\n        before the processing method (``_arithmetic``) is invoked.\n\n        .. warning::\n            Do not override this method in subclasses.\n\n        This method checks if it was called as instance or as class method and\n        then wraps the operands and the result from ``_arithmetics`` in the\n        appropriate subclass.\n\n        Parameters\n        ----------\n        self_or_cls : instance or class\n            ``sharedmethod`` behaves like a normal method if called on the\n            instance (then this parameter is ``self``) but like a classmethod\n            when called on the class (then this parameter is ``cls``).\n\n        operations : callable\n            The operation (normally a numpy-ufunc) that represents the\n            appropriate action.\n\n        operand, operand2, kwargs :\n            See for example ``add``.\n\n        Result\n        ------\n        result : `~astropy.nddata.NDData`-like\n            Depending how this method was called either ``self_or_cls``\n            (called on class) or ``self_or_cls.__class__`` (called on instance)\n            is the NDData-subclass that is used as wrapper for the result.\n        \"\"\"\n        # DO NOT OVERRIDE THIS METHOD IN SUBCLASSES.\n\n        if isinstance(self_or_cls, NDArithmeticMixin):\n            # True means it was called on the instance, so self_or_cls is\n            # a reference to self\n            cls = self_or_cls.__class__\n\n            if operand2 is None:\n                # Only one operand was given. Set operand2 to operand and\n                # operand to self so that we call the appropriate method of the\n                # operand.\n                operand2 = operand\n                operand = self_or_cls\n            else:\n                # Convert the first operand to the class of this method.\n                # This is important so that always the correct _arithmetics is\n                # called later that method.\n                operand = cls(operand)\n\n        else:\n            # It was used as classmethod so self_or_cls represents the cls\n            cls = self_or_cls\n\n            # It was called on the class so we expect two operands!\n            if operand2 is None:\n                raise TypeError(\"operand2 must be given when the method isn't \"\n                                \"called on an instance.\")\n\n            # Convert to this class. See above comment why.\n            operand = cls(operand)\n\n        # At this point operand, operand2, kwargs and cls are determined.\n\n        # Let's try to convert operand2 to the class of operand to allows for\n        # arithmetic operations with numbers, lists, numpy arrays, numpy masked\n        # arrays, astropy quantities, masked quantities and of other subclasses\n        # of NDData.\n        operand2 = cls(operand2)\n\n        # Now call the _arithmetics method to do the arithmetics.\n        result, init_kwds = operand._arithmetic(operation, operand2, **kwargs)\n\n        # Return a new class based on the result\n        return cls(result, **init_kwds)"},{"attributeType":"null","col":12,"comment":"null","endLoc":377,"id":11952,"name":"uncertainty","nodeType":"Attribute","startLoc":377,"text":"self.uncertainty"},{"attributeType":"null","col":16,"comment":"null","endLoc":5,"id":11953,"name":"np","nodeType":"Attribute","startLoc":5,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":11954,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"compat.py#<anonymous>","id":11955,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"__all__ = ['NDDataArray']"},{"fileName":"__init__.py","filePath":"astropy/nddata","id":11956,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThe `astropy.nddata` subpackage provides the `~astropy.nddata.NDData`\nclass and related tools to manage n-dimensional array-based data (e.g.\nCCD images, IFU Data, grid-based simulation data, ...). This is more than\njust `numpy.ndarray` objects, because it provides metadata that cannot\nbe easily provided by a single array.\n\"\"\"\n\nfrom .nddata import *\nfrom .nddata_base import *\nfrom .nddata_withmixins import *\nfrom .nduncertainty import *\nfrom .flag_collection import *\n\nfrom .decorators import *\n\nfrom .mixins.ndarithmetic import *\nfrom .mixins.ndslicing import *\nfrom .mixins.ndio import *\n\nfrom .blocks import *\nfrom .compat import *\nfrom .utils import *\nfrom .ccddata import *\nfrom .bitmask import *\n\nfrom astropy import config as _config\n\n\nclass Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.nddata`.\n    \"\"\"\n\n    warn_unsupported_correlated = _config.ConfigItem(\n        True,\n        'Whether to issue a warning if `~astropy.nddata.NDData` arithmetic '\n        'is performed with uncertainties and the uncertainties do not '\n        'support the propagation of correlated uncertainties.'\n    )\n\n    warn_setting_unit_directly = _config.ConfigItem(\n        True,\n        'Whether to issue a warning when the `~astropy.nddata.NDData` unit '\n        'attribute is changed from a non-``None`` value to another value '\n        'that data values/uncertainties are not scaled with the unit change.'\n    )\n\n\nconf = Conf()\n"},{"col":4,"comment":"null","endLoc":111,"header":"@property\n    def uncertainty(self)","id":11957,"name":"uncertainty","nodeType":"Function","startLoc":109,"text":"@property\n    def uncertainty(self):\n        return self._uncertainty"},{"col":4,"comment":"null","endLoc":129,"header":"@uncertainty.setter\n    def uncertainty(self, value)","id":11958,"name":"uncertainty","nodeType":"Function","startLoc":113,"text":"@uncertainty.setter\n    def uncertainty(self, value):\n        if value is not None:\n            if isinstance(value, NDUncertainty):\n                class_name = self.__class__.__name__\n                if not self.unit and value._unit:\n                    # Raise an error if uncertainty has unit and data does not\n                    raise ValueError(\"Cannot assign an uncertainty with unit \"\n                                     \"to {} without \"\n                                     \"a unit\".format(class_name))\n                self._uncertainty = value\n                self._uncertainty.parent_nddata = self\n            else:\n                raise TypeError(\"Uncertainty must be an instance of \"\n                                \"a NDUncertainty object\")\n        else:\n            self._uncertainty = value"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.nddata`.\n    ","endLoc":49,"id":11959,"nodeType":"Class","startLoc":32,"text":"class Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.nddata`.\n    \"\"\"\n\n    warn_unsupported_correlated = _config.ConfigItem(\n        True,\n        'Whether to issue a warning if `~astropy.nddata.NDData` arithmetic '\n        'is performed with uncertainties and the uncertainties do not '\n        'support the propagation of correlated uncertainties.'\n    )\n\n    warn_setting_unit_directly = _config.ConfigItem(\n        True,\n        'Whether to issue a warning when the `~astropy.nddata.NDData` unit '\n        'attribute is changed from a non-``None`` value to another value '\n        'that data values/uncertainties are not scaled with the unit change.'\n    )"},{"col":4,"comment":"null","endLoc":134,"header":"@property\n    def unit(self)","id":11960,"name":"unit","nodeType":"Function","startLoc":132,"text":"@property\n    def unit(self):\n        return self._unit"},{"col":4,"comment":"null","endLoc":154,"header":"@unit.setter\n    def unit(self, value)","id":11961,"name":"unit","nodeType":"Function","startLoc":136,"text":"@unit.setter\n    def unit(self, value):\n        from . import conf\n\n        try:\n            if self._unit is not None and conf.warn_setting_unit_directly:\n                log.info('Setting the unit directly changes the unit without '\n                         'updating the data or uncertainty. Use the '\n                         '.convert_unit_to() method to change the unit and '\n                         'scale values appropriately.')\n        except AttributeError:\n            # raised if self._unit has not been set yet, in which case the\n            # warning is irrelevant\n            pass\n\n        if value is None:\n            self._unit = None\n        else:\n            self._unit = Unit(value)"},{"col":4,"comment":"null","endLoc":162,"header":"@property\n    def mask(self)","id":11962,"name":"mask","nodeType":"Function","startLoc":157,"text":"@property\n    def mask(self):\n        if self._mask is np.ma.nomask:\n            return None\n        else:\n            return self._mask"},{"col":4,"comment":"null","endLoc":175,"header":"@mask.setter\n    def mask(self, value)","id":11963,"name":"mask","nodeType":"Function","startLoc":164,"text":"@mask.setter\n    def mask(self, value):\n        # Check that value is not either type of null mask.\n        if (value is not None) and (value is not np.ma.nomask):\n            mask = np.array(value, dtype=np.bool_, copy=False)\n            if mask.shape != self.data.shape:\n                raise ValueError(\"dimensions of mask do not match data\")\n            else:\n                self._mask = mask\n        else:\n            # internal representation should be one numpy understands\n            self._mask = np.ma.nomask"},{"col":4,"comment":"\n        shape tuple of this object's data.\n        ","endLoc":182,"header":"@property\n    def shape(self)","id":11964,"name":"shape","nodeType":"Function","startLoc":177,"text":"@property\n    def shape(self):\n        \"\"\"\n        shape tuple of this object's data.\n        \"\"\"\n        return self.data.shape"},{"col":4,"comment":"\n        integer size of this object's data.\n        ","endLoc":189,"header":"@property\n    def size(self)","id":11965,"name":"size","nodeType":"Function","startLoc":184,"text":"@property\n    def size(self):\n        \"\"\"\n        integer size of this object's data.\n        \"\"\"\n        return self.data.size"},{"col":4,"comment":"\n        `numpy.dtype` of this object's data.\n        ","endLoc":196,"header":"@property\n    def dtype(self)","id":11966,"name":"dtype","nodeType":"Function","startLoc":191,"text":"@property\n    def dtype(self):\n        \"\"\"\n        `numpy.dtype` of this object's data.\n        \"\"\"\n        return self.data.dtype"},{"col":4,"comment":"\n        integer dimensions of this object's data\n        ","endLoc":203,"header":"@property\n    def ndim(self)","id":11967,"name":"ndim","nodeType":"Function","startLoc":198,"text":"@property\n    def ndim(self):\n        \"\"\"\n        integer dimensions of this object's data\n        \"\"\"\n        return self.data.ndim"},{"col":4,"comment":"null","endLoc":207,"header":"@property\n    def flags(self)","id":11968,"name":"flags","nodeType":"Function","startLoc":205,"text":"@property\n    def flags(self):\n        return self._flags"},{"col":4,"comment":"null","endLoc":224,"header":"@flags.setter\n    def flags(self, value)","id":11969,"name":"flags","nodeType":"Function","startLoc":209,"text":"@flags.setter\n    def flags(self, value):\n        if value is not None:\n            if isinstance(value, FlagCollection):\n                if value.shape != self.shape:\n                    raise ValueError(\"dimensions of FlagCollection does not match data\")\n                else:\n                    self._flags = value\n            else:\n                flags = np.array(value, copy=False)\n                if flags.shape != self.shape:\n                    raise ValueError(\"dimensions of flags do not match data\")\n                else:\n                    self._flags = flags\n        else:\n            self._flags = value"},{"col":4,"comment":"\n        This allows code that requests a Numpy array to use an NDData\n        object as a Numpy array.\n        ","endLoc":234,"header":"def __array__(self)","id":11970,"name":"__array__","nodeType":"Function","startLoc":226,"text":"def __array__(self):\n        \"\"\"\n        This allows code that requests a Numpy array to use an NDData\n        object as a Numpy array.\n        \"\"\"\n        if self.mask is not None:\n            return np.ma.masked_array(self.data, self.mask)\n        else:\n            return np.array(self.data)"},{"col":4,"comment":"\n        This ensures that a masked array is returned if self is masked.\n        ","endLoc":243,"header":"def __array_prepare__(self, array, context=None)","id":11971,"name":"__array_prepare__","nodeType":"Function","startLoc":236,"text":"def __array_prepare__(self, array, context=None):\n        \"\"\"\n        This ensures that a masked array is returned if self is masked.\n        \"\"\"\n        if self.mask is not None:\n            return np.ma.masked_array(array, self.mask)\n        else:\n            return array"},{"col":4,"comment":"\n        Returns a new `NDData` object whose values have been converted\n        to a new unit.\n\n        Parameters\n        ----------\n        unit : `astropy.units.UnitBase` instance or str\n            The unit to convert to.\n\n        equivalencies : list of tuple\n           A list of equivalence pairs to try if the units are not\n           directly convertible.  See :ref:`astropy:unit_equivalencies`.\n\n        Returns\n        -------\n        result : `~astropy.nddata.NDData`\n            The resulting dataset\n\n        Raises\n        ------\n        `~astropy.units.UnitsError`\n            If units are inconsistent.\n\n        ","endLoc":290,"header":"def convert_unit_to(self, unit, equivalencies=[])","id":11972,"name":"convert_unit_to","nodeType":"Function","startLoc":245,"text":"def convert_unit_to(self, unit, equivalencies=[]):\n        \"\"\"\n        Returns a new `NDData` object whose values have been converted\n        to a new unit.\n\n        Parameters\n        ----------\n        unit : `astropy.units.UnitBase` instance or str\n            The unit to convert to.\n\n        equivalencies : list of tuple\n           A list of equivalence pairs to try if the units are not\n           directly convertible.  See :ref:`astropy:unit_equivalencies`.\n\n        Returns\n        -------\n        result : `~astropy.nddata.NDData`\n            The resulting dataset\n\n        Raises\n        ------\n        `~astropy.units.UnitsError`\n            If units are inconsistent.\n\n        \"\"\"\n        if self.unit is None:\n            raise ValueError(\"No unit specified on source data\")\n        data = self.unit.to(unit, self.data, equivalencies=equivalencies)\n        if self.uncertainty is not None:\n            uncertainty_values = self.unit.to(unit, self.uncertainty.array,\n                                              equivalencies=equivalencies)\n            # should work for any uncertainty class\n            uncertainty = self.uncertainty.__class__(uncertainty_values)\n        else:\n            uncertainty = None\n        if self.mask is not None:\n            new_mask = self.mask.copy()\n        else:\n            new_mask = None\n        # Call __class__ in case we are dealing with an inherited type\n        result = self.__class__(data, uncertainty=uncertainty,\n                                mask=new_mask,\n                                wcs=self.wcs,\n                                meta=self.meta, unit=unit)\n\n        return result"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":37,"id":11973,"name":"warn_unsupported_correlated","nodeType":"Attribute","startLoc":37,"text":"warn_unsupported_correlated"},{"col":4,"comment":"null","endLoc":1829,"header":"def _get_single_quote(self, value)","id":11974,"name":"_get_single_quote","nodeType":"Function","startLoc":1822,"text":"def _get_single_quote(self, value):\n        if (\"'\" in value) and ('\"' in value):\n            raise ConfigObjError('Value \"%s\" cannot be safely quoted.' % value)\n        elif '\"' in value:\n            quot = squot\n        else:\n            quot = dquot\n        return quot"},{"col":4,"comment":"null","endLoc":1839,"header":"def _get_triple_quote(self, value)","id":11975,"name":"_get_triple_quote","nodeType":"Function","startLoc":1832,"text":"def _get_triple_quote(self, value):\n        if (value.find('\"\"\"') != -1) and (value.find(\"'''\") != -1):\n            raise ConfigObjError('Value \"%s\" cannot be safely quoted.' % value)\n        if value.find('\"\"\"') == -1:\n            quot = tdquot\n        else:\n            quot = tsquot\n        return quot"},{"col":4,"comment":"\n        Called by validate. Handles setting the configspec on subsections\n        including sections to be validated by __many__\n        ","endLoc":1972,"header":"def _set_configspec(self, section, copy)","id":11976,"name":"_set_configspec","nodeType":"Function","startLoc":1947,"text":"def _set_configspec(self, section, copy):\n        \"\"\"\n        Called by validate. Handles setting the configspec on subsections\n        including sections to be validated by __many__\n        \"\"\"\n        configspec = section.configspec\n        many = configspec.get('__many__')\n        if isinstance(many, dict):\n            for entry in section.sections:\n                if entry not in configspec:\n                    section[entry].configspec = many\n\n        for entry in configspec.sections:\n            if entry == '__many__':\n                continue\n            if entry not in section:\n                section[entry] = {}\n                section[entry]._created = True\n                if copy:\n                    # copy comments\n                    section.comments[entry] = configspec.comments.get(entry, [])\n                    section.inline_comments[entry] = configspec.inline_comments.get(entry, '')\n\n            # Could be a scalar when we expect a section\n            if isinstance(section[entry], Section):\n                section[entry].configspec = configspec[entry]"},{"attributeType":"null","col":16,"comment":"null","endLoc":123,"id":11977,"name":"_uncertainty","nodeType":"Attribute","startLoc":123,"text":"self._uncertainty"},{"col":4,"comment":"Write an individual line, for the write method","endLoc":1986,"header":"def _write_line(self, indent_string, entry, this_entry, comment)","id":11978,"name":"_write_line","nodeType":"Function","startLoc":1975,"text":"def _write_line(self, indent_string, entry, this_entry, comment):\n        \"\"\"Write an individual line, for the write method\"\"\"\n        # NOTE: the calls to self._quote here handles non-StringType values.\n        if not self.unrepr:\n            val = self._decode_element(self._quote(this_entry))\n        else:\n            val = repr(this_entry)\n        return '%s%s%s%s%s' % (indent_string,\n                               self._decode_element(self._quote(entry, multiline=False)),\n                               self._a_to_u(' = '),\n                               val,\n                               self._decode_element(comment))"},{"attributeType":"null","col":12,"comment":"null","endLoc":152,"id":11979,"name":"_unit","nodeType":"Attribute","startLoc":152,"text":"self._unit"},{"col":0,"comment":"\n    bitfield_to_boolean_mask(bitfield, ignore_flags=None, flip_bits=None, \ngood_mask_value=False, dtype=numpy.bool_)\n    Converts an array of bit fields to a boolean (or integer) mask array\n    according to a bit mask constructed from the supplied bit flags (see\n    ``ignore_flags`` parameter).\n\n    This function is particularly useful to convert data quality arrays to\n    boolean masks with selective filtering of DQ flags.\n\n    Parameters\n    ----------\n    bitfield : ndarray\n        An array of bit flags. By default, values different from zero are\n        interpreted as \"bad\" values and values equal to zero are considered\n        as \"good\" values. However, see ``ignore_flags`` parameter on how to\n        selectively ignore some bits in the ``bitfield`` array data.\n\n    ignore_flags : int, str, list, None (default = 0)\n        An integer bit mask, `None`, a Python list of bit flags, a comma-,\n        or ``'|'``-separated, ``'+'``-separated string list of integer\n        bit flags or mnemonic flag names that indicate what bits in the input\n        ``bitfield`` should be *ignored* (i.e., zeroed), or `None`.\n\n        .. note::\n            When ``bit_flags`` is a list of flag names, the ``flag_name_map``\n            parameter must be provided.\n\n        | Setting ``ignore_flags`` to `None` effectively will make\n          `bitfield_to_boolean_mask` interpret all ``bitfield`` elements\n          as \"good\" regardless of their value.\n\n        | When ``ignore_flags`` argument is an integer bit mask, it will be\n          combined using bitwise-NOT and bitwise-AND with each element of the\n          input ``bitfield`` array (``~ignore_flags & bitfield``). If the\n          resultant bitfield element is non-zero, that element will be\n          interpreted as a \"bad\" in the output boolean mask and it will be\n          interpreted as \"good\" otherwise. ``flip_bits`` parameter may be used\n          to flip the bits (``bitwise-NOT``) of the bit mask thus effectively\n          changing the meaning of the ``ignore_flags`` parameter from \"ignore\"\n          to \"use only\" these flags.\n\n        .. note::\n\n            Setting ``ignore_flags`` to 0 effectively will assume that all\n            non-zero elements in the input ``bitfield`` array are to be\n            interpreted as \"bad\".\n\n        | When ``ignore_flags`` argument is a Python list of integer bit\n          flags, these flags are added together to create an integer bit mask.\n          Each item in the list must be a flag, i.e., an integer that is an\n          integer power of 2. In order to flip the bits of the resultant\n          bit mask, use ``flip_bits`` parameter.\n\n        | Alternatively, ``ignore_flags`` may be a string of comma- or\n          ``'+'``(or ``'|'``)-separated list of integer bit flags that should\n          be added (bitwise OR) together to create an integer bit mask.\n          For example, both ``'4,8'``, ``'4|8'``, and ``'4+8'`` are equivalent\n          and indicate that bit flags 4 and 8 in the input ``bitfield``\n          array should be ignored when generating boolean mask.\n\n        .. note::\n\n            ``'None'``, ``'INDEF'``, and empty (or all white space) strings\n            are special values of string ``ignore_flags`` that are\n            interpreted as `None`.\n\n        .. note::\n\n            Each item in the list must be a flag, i.e., an integer that is an\n            integer power of 2. In addition, for convenience, an arbitrary\n            **single** integer is allowed and it will be interpreted as an\n            integer bit mask. For example, instead of ``'4,8'`` one could\n            simply provide string ``'12'``.\n\n        .. note::\n            Only one flag separator is supported at a time. ``ignore_flags``\n            string should not mix ``','``, ``'+'``, and ``'|'`` separators.\n\n        .. note::\n\n            When ``ignore_flags`` is a `str` and when it is prepended with\n            '~', then the meaning of ``ignore_flags`` parameters will be\n            reversed: now it will be interpreted as a list of bit flags to be\n            *used* (or *not ignored*) when deciding which elements of the\n            input ``bitfield`` array are \"bad\". Following this convention,\n            an ``ignore_flags`` string value of ``'~0'`` would be equivalent\n            to setting ``ignore_flags=None``.\n\n        .. warning::\n\n            Because prepending '~' to a string ``ignore_flags`` is equivalent\n            to setting ``flip_bits`` to `True`, ``flip_bits`` cannot be used\n            with string ``ignore_flags`` and it must be set to `None`.\n\n    flip_bits : bool, None (default = None)\n        Specifies whether or not to invert the bits of the bit mask either\n        supplied directly through ``ignore_flags`` parameter or built from the\n        bit flags passed through ``ignore_flags`` (only when bit flags are\n        passed as Python lists of integer bit flags). Occasionally, it may be\n        useful to *consider only specific bit flags* in the ``bitfield``\n        array when creating a boolean mask as opposed to *ignoring* specific\n        bit flags as ``ignore_flags`` behaves by default. This can be achieved\n        by inverting/flipping the bits of the bit mask created from\n        ``ignore_flags`` flags which effectively changes the meaning of the\n        ``ignore_flags`` parameter from \"ignore\" to \"use only\" these flags.\n        Setting ``flip_bits`` to `None` means that no bit flipping will be\n        performed. Bit flipping for string lists of bit flags must be\n        specified by prepending '~' to string bit flag lists\n        (see documentation for ``ignore_flags`` for more details).\n\n        .. warning::\n            This parameter can be set to either `True` or `False` **ONLY** when\n            ``ignore_flags`` is either an integer bit mask or a Python\n            list of integer bit flags. When ``ignore_flags`` is either\n            `None` or a string list of flags, ``flip_bits`` **MUST** be set\n            to `None`.\n\n    good_mask_value : int, bool (default = False)\n        This parameter is used to derive the values that will be assigned to\n        the elements in the output boolean mask array that correspond to the\n        \"good\" bit fields (that are 0 after zeroing bits specified by\n        ``ignore_flags``) in the input ``bitfield`` array. When\n        ``good_mask_value`` is non-zero or ``numpy.True_`` then values in the\n        output boolean mask array corresponding to \"good\" bit fields in\n        ``bitfield`` will be ``numpy.True_`` (if ``dtype`` is ``numpy.bool_``)\n        or 1 (if ``dtype`` is of numerical type) and values of corresponding\n        to \"bad\" flags will be ``numpy.False_`` (or 0). When\n        ``good_mask_value`` is zero or ``numpy.False_`` then the values\n        in the output boolean mask array corresponding to \"good\" bit fields\n        in ``bitfield`` will be ``numpy.False_`` (if ``dtype`` is\n        ``numpy.bool_``) or 0 (if ``dtype`` is of numerical type) and values\n        of corresponding to \"bad\" flags will be ``numpy.True_`` (or 1).\n\n    dtype : data-type (default = ``numpy.bool_``)\n        The desired data-type for the output binary mask array.\n\n    flag_name_map : BitFlagNameMap\n         A `BitFlagNameMap` object that provides mapping from mnemonic\n         bit flag names to integer bit values in order to translate mnemonic\n         flags to numeric values when ``bit_flags`` that are comma- or\n         '+'-separated list of menmonic bit flag names.\n\n    Returns\n    -------\n    mask : ndarray\n        Returns an array of the same dimensionality as the input ``bitfield``\n        array whose elements can have two possible values,\n        e.g., ``numpy.True_`` or ``numpy.False_`` (or 1 or 0 for integer\n        ``dtype``) according to values of to the input ``bitfield`` elements,\n        ``ignore_flags`` parameter, and the ``good_mask_value`` parameter.\n\n    Examples\n    --------\n\n        >>> from astropy.nddata import bitmask\n        >>> import numpy as np\n        >>> dqarr = np.asarray([[0, 0, 1, 2, 0, 8, 12, 0],\n        ...                     [10, 4, 0, 0, 0, 16, 6, 0]])\n        >>> flag_map = bitmask.extend_bit_flag_map(\n        ...     'ST_DQ', CR=2, CLOUDY=4, RAINY=8, HOT=16, DEAD=32\n        ... )\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=0,\n        ...                                  dtype=int)\n        array([[0, 0, 1, 1, 0, 1, 1, 0],\n               [1, 1, 0, 0, 0, 1, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=0,\n        ...                                  dtype=bool)\n        array([[False, False,  True,  True, False,  True,  True, False],\n               [ True,  True, False, False, False,  True,  True, False]]...)\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=6,\n        ...                                  good_mask_value=0, dtype=int)\n        array([[0, 0, 1, 0, 0, 1, 1, 0],\n               [1, 0, 0, 0, 0, 1, 0, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=~6,\n        ...                                  good_mask_value=0, dtype=int)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=6, dtype=int,\n        ...                                  flip_bits=True, good_mask_value=0)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags='~(2+4)',\n        ...                                  good_mask_value=0, dtype=int)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=[2, 4],\n        ...                                  flip_bits=True, good_mask_value=0,\n        ...                                  dtype=int)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags='~(CR,CLOUDY)',\n        ...                                  good_mask_value=0, dtype=int,\n        ...                                  flag_name_map=flag_map)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags='~(CR+CLOUDY)',\n        ...                                  good_mask_value=0, dtype=int,\n        ...                                  flag_name_map=flag_map)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n\n    ","endLoc":699,"header":"def bitfield_to_boolean_mask(bitfield, ignore_flags=0, flip_bits=None,\n                             good_mask_value=False, dtype=np.bool_,\n                             flag_name_map=None)","id":11980,"name":"bitfield_to_boolean_mask","nodeType":"Function","startLoc":466,"text":"def bitfield_to_boolean_mask(bitfield, ignore_flags=0, flip_bits=None,\n                             good_mask_value=False, dtype=np.bool_,\n                             flag_name_map=None):\n    \"\"\"\n    bitfield_to_boolean_mask(bitfield, ignore_flags=None, flip_bits=None, \\\ngood_mask_value=False, dtype=numpy.bool_)\n    Converts an array of bit fields to a boolean (or integer) mask array\n    according to a bit mask constructed from the supplied bit flags (see\n    ``ignore_flags`` parameter).\n\n    This function is particularly useful to convert data quality arrays to\n    boolean masks with selective filtering of DQ flags.\n\n    Parameters\n    ----------\n    bitfield : ndarray\n        An array of bit flags. By default, values different from zero are\n        interpreted as \"bad\" values and values equal to zero are considered\n        as \"good\" values. However, see ``ignore_flags`` parameter on how to\n        selectively ignore some bits in the ``bitfield`` array data.\n\n    ignore_flags : int, str, list, None (default = 0)\n        An integer bit mask, `None`, a Python list of bit flags, a comma-,\n        or ``'|'``-separated, ``'+'``-separated string list of integer\n        bit flags or mnemonic flag names that indicate what bits in the input\n        ``bitfield`` should be *ignored* (i.e., zeroed), or `None`.\n\n        .. note::\n            When ``bit_flags`` is a list of flag names, the ``flag_name_map``\n            parameter must be provided.\n\n        | Setting ``ignore_flags`` to `None` effectively will make\n          `bitfield_to_boolean_mask` interpret all ``bitfield`` elements\n          as \"good\" regardless of their value.\n\n        | When ``ignore_flags`` argument is an integer bit mask, it will be\n          combined using bitwise-NOT and bitwise-AND with each element of the\n          input ``bitfield`` array (``~ignore_flags & bitfield``). If the\n          resultant bitfield element is non-zero, that element will be\n          interpreted as a \"bad\" in the output boolean mask and it will be\n          interpreted as \"good\" otherwise. ``flip_bits`` parameter may be used\n          to flip the bits (``bitwise-NOT``) of the bit mask thus effectively\n          changing the meaning of the ``ignore_flags`` parameter from \"ignore\"\n          to \"use only\" these flags.\n\n        .. note::\n\n            Setting ``ignore_flags`` to 0 effectively will assume that all\n            non-zero elements in the input ``bitfield`` array are to be\n            interpreted as \"bad\".\n\n        | When ``ignore_flags`` argument is a Python list of integer bit\n          flags, these flags are added together to create an integer bit mask.\n          Each item in the list must be a flag, i.e., an integer that is an\n          integer power of 2. In order to flip the bits of the resultant\n          bit mask, use ``flip_bits`` parameter.\n\n        | Alternatively, ``ignore_flags`` may be a string of comma- or\n          ``'+'``(or ``'|'``)-separated list of integer bit flags that should\n          be added (bitwise OR) together to create an integer bit mask.\n          For example, both ``'4,8'``, ``'4|8'``, and ``'4+8'`` are equivalent\n          and indicate that bit flags 4 and 8 in the input ``bitfield``\n          array should be ignored when generating boolean mask.\n\n        .. note::\n\n            ``'None'``, ``'INDEF'``, and empty (or all white space) strings\n            are special values of string ``ignore_flags`` that are\n            interpreted as `None`.\n\n        .. note::\n\n            Each item in the list must be a flag, i.e., an integer that is an\n            integer power of 2. In addition, for convenience, an arbitrary\n            **single** integer is allowed and it will be interpreted as an\n            integer bit mask. For example, instead of ``'4,8'`` one could\n            simply provide string ``'12'``.\n\n        .. note::\n            Only one flag separator is supported at a time. ``ignore_flags``\n            string should not mix ``','``, ``'+'``, and ``'|'`` separators.\n\n        .. note::\n\n            When ``ignore_flags`` is a `str` and when it is prepended with\n            '~', then the meaning of ``ignore_flags`` parameters will be\n            reversed: now it will be interpreted as a list of bit flags to be\n            *used* (or *not ignored*) when deciding which elements of the\n            input ``bitfield`` array are \"bad\". Following this convention,\n            an ``ignore_flags`` string value of ``'~0'`` would be equivalent\n            to setting ``ignore_flags=None``.\n\n        .. warning::\n\n            Because prepending '~' to a string ``ignore_flags`` is equivalent\n            to setting ``flip_bits`` to `True`, ``flip_bits`` cannot be used\n            with string ``ignore_flags`` and it must be set to `None`.\n\n    flip_bits : bool, None (default = None)\n        Specifies whether or not to invert the bits of the bit mask either\n        supplied directly through ``ignore_flags`` parameter or built from the\n        bit flags passed through ``ignore_flags`` (only when bit flags are\n        passed as Python lists of integer bit flags). Occasionally, it may be\n        useful to *consider only specific bit flags* in the ``bitfield``\n        array when creating a boolean mask as opposed to *ignoring* specific\n        bit flags as ``ignore_flags`` behaves by default. This can be achieved\n        by inverting/flipping the bits of the bit mask created from\n        ``ignore_flags`` flags which effectively changes the meaning of the\n        ``ignore_flags`` parameter from \"ignore\" to \"use only\" these flags.\n        Setting ``flip_bits`` to `None` means that no bit flipping will be\n        performed. Bit flipping for string lists of bit flags must be\n        specified by prepending '~' to string bit flag lists\n        (see documentation for ``ignore_flags`` for more details).\n\n        .. warning::\n            This parameter can be set to either `True` or `False` **ONLY** when\n            ``ignore_flags`` is either an integer bit mask or a Python\n            list of integer bit flags. When ``ignore_flags`` is either\n            `None` or a string list of flags, ``flip_bits`` **MUST** be set\n            to `None`.\n\n    good_mask_value : int, bool (default = False)\n        This parameter is used to derive the values that will be assigned to\n        the elements in the output boolean mask array that correspond to the\n        \"good\" bit fields (that are 0 after zeroing bits specified by\n        ``ignore_flags``) in the input ``bitfield`` array. When\n        ``good_mask_value`` is non-zero or ``numpy.True_`` then values in the\n        output boolean mask array corresponding to \"good\" bit fields in\n        ``bitfield`` will be ``numpy.True_`` (if ``dtype`` is ``numpy.bool_``)\n        or 1 (if ``dtype`` is of numerical type) and values of corresponding\n        to \"bad\" flags will be ``numpy.False_`` (or 0). When\n        ``good_mask_value`` is zero or ``numpy.False_`` then the values\n        in the output boolean mask array corresponding to \"good\" bit fields\n        in ``bitfield`` will be ``numpy.False_`` (if ``dtype`` is\n        ``numpy.bool_``) or 0 (if ``dtype`` is of numerical type) and values\n        of corresponding to \"bad\" flags will be ``numpy.True_`` (or 1).\n\n    dtype : data-type (default = ``numpy.bool_``)\n        The desired data-type for the output binary mask array.\n\n    flag_name_map : BitFlagNameMap\n         A `BitFlagNameMap` object that provides mapping from mnemonic\n         bit flag names to integer bit values in order to translate mnemonic\n         flags to numeric values when ``bit_flags`` that are comma- or\n         '+'-separated list of menmonic bit flag names.\n\n    Returns\n    -------\n    mask : ndarray\n        Returns an array of the same dimensionality as the input ``bitfield``\n        array whose elements can have two possible values,\n        e.g., ``numpy.True_`` or ``numpy.False_`` (or 1 or 0 for integer\n        ``dtype``) according to values of to the input ``bitfield`` elements,\n        ``ignore_flags`` parameter, and the ``good_mask_value`` parameter.\n\n    Examples\n    --------\n\n        >>> from astropy.nddata import bitmask\n        >>> import numpy as np\n        >>> dqarr = np.asarray([[0, 0, 1, 2, 0, 8, 12, 0],\n        ...                     [10, 4, 0, 0, 0, 16, 6, 0]])\n        >>> flag_map = bitmask.extend_bit_flag_map(\n        ...     'ST_DQ', CR=2, CLOUDY=4, RAINY=8, HOT=16, DEAD=32\n        ... )\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=0,\n        ...                                  dtype=int)\n        array([[0, 0, 1, 1, 0, 1, 1, 0],\n               [1, 1, 0, 0, 0, 1, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=0,\n        ...                                  dtype=bool)\n        array([[False, False,  True,  True, False,  True,  True, False],\n               [ True,  True, False, False, False,  True,  True, False]]...)\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=6,\n        ...                                  good_mask_value=0, dtype=int)\n        array([[0, 0, 1, 0, 0, 1, 1, 0],\n               [1, 0, 0, 0, 0, 1, 0, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=~6,\n        ...                                  good_mask_value=0, dtype=int)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=6, dtype=int,\n        ...                                  flip_bits=True, good_mask_value=0)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags='~(2+4)',\n        ...                                  good_mask_value=0, dtype=int)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags=[2, 4],\n        ...                                  flip_bits=True, good_mask_value=0,\n        ...                                  dtype=int)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags='~(CR,CLOUDY)',\n        ...                                  good_mask_value=0, dtype=int,\n        ...                                  flag_name_map=flag_map)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n        >>> bitmask.bitfield_to_boolean_mask(dqarr, ignore_flags='~(CR+CLOUDY)',\n        ...                                  good_mask_value=0, dtype=int,\n        ...                                  flag_name_map=flag_map)\n        array([[0, 0, 0, 1, 0, 0, 1, 0],\n               [1, 1, 0, 0, 0, 0, 1, 0]])\n\n    \"\"\"\n    bitfield = np.asarray(bitfield)\n    if not np.issubdtype(bitfield.dtype, np.integer):\n        raise TypeError(\"Input bitfield array must be of integer type.\")\n\n    ignore_mask = interpret_bit_flags(ignore_flags, flip_bits=flip_bits,\n                                      flag_name_map=flag_name_map)\n\n    if ignore_mask is None:\n        if good_mask_value:\n            mask = np.ones_like(bitfield, dtype=dtype)\n        else:\n            mask = np.zeros_like(bitfield, dtype=dtype)\n        return mask\n\n    # filter out bits beyond the maximum supported by the data type:\n    ignore_mask = ignore_mask & _SUPPORTED_FLAGS\n\n    # invert the \"ignore\" mask:\n    ignore_mask = np.bitwise_not(ignore_mask, dtype=bitfield.dtype.type,\n                                 casting='unsafe')\n\n    mask = np.empty_like(bitfield, dtype=np.bool_)\n    np.bitwise_and(bitfield, ignore_mask, out=mask, casting='unsafe')\n\n    if good_mask_value:\n        np.logical_not(mask, out=mask)\n\n    return mask.astype(dtype=dtype, subok=False, copy=False)"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":44,"id":11981,"name":"warn_setting_unit_directly","nodeType":"Attribute","startLoc":44,"text":"warn_setting_unit_directly"},{"attributeType":"null","col":20,"comment":"null","endLoc":216,"id":11982,"name":"_flags","nodeType":"Attribute","startLoc":216,"text":"self._flags"},{"attributeType":"null","col":16,"comment":"null","endLoc":9,"id":11983,"name":"np","nodeType":"Attribute","startLoc":9,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":11984,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":11985,"name":"_ENABLE_BITFLAG_CACHING","nodeType":"Attribute","startLoc":16,"text":"_ENABLE_BITFLAG_CACHING"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":11986,"name":"_MAX_UINT_TYPE","nodeType":"Attribute","startLoc":17,"text":"_MAX_UINT_TYPE"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":11987,"name":"_SUPPORTED_FLAGS","nodeType":"Attribute","startLoc":18,"text":"_SUPPORTED_FLAGS"},{"col":0,"comment":"","endLoc":5,"header":"bitmask.py#<anonymous>","id":11988,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nA module that provides functions for manipulating bit masks and data quality\n(DQ) arrays.\n\n\"\"\"\n\n__all__ = ['bitfield_to_boolean_mask', 'interpret_bit_flags',\n           'BitFlagNameMap', 'extend_bit_flag_map', 'InvalidBitFlag']\n\n_ENABLE_BITFLAG_CACHING = True\n\n_MAX_UINT_TYPE = np.maximum_sctype(np.uint)\n\n_SUPPORTED_FLAGS = int(np.bitwise_not(\n    0, dtype=_MAX_UINT_TYPE, casting='unsafe'\n))"},{"attributeType":"null","col":30,"comment":"null","endLoc":29,"id":11989,"name":"_config","nodeType":"Attribute","startLoc":29,"text":"_config"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":52,"id":11990,"name":"conf","nodeType":"Attribute","startLoc":52,"text":"conf"},{"col":0,"comment":"","endLoc":9,"header":"__init__.py#<anonymous>","id":11991,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThe `astropy.nddata` subpackage provides the `~astropy.nddata.NDData`\nclass and related tools to manage n-dimensional array-based data (e.g.\nCCD images, IFU Data, grid-based simulation data, ...). This is more than\njust `numpy.ndarray` objects, because it provides metadata that cannot\nbe easily provided by a single array.\n\"\"\"\n\nconf = Conf()"},{"attributeType":"null","col":16,"comment":"null","endLoc":172,"id":11992,"name":"_mask","nodeType":"Attribute","startLoc":172,"text":"self._mask"},{"attributeType":"null","col":8,"comment":"null","endLoc":105,"id":11993,"name":"flags","nodeType":"Attribute","startLoc":105,"text":"self.flags"},{"col":0,"comment":"null","endLoc":1462,"header":"def rightmost_terminal(symbols, terminals)","id":11994,"name":"rightmost_terminal","nodeType":"Function","startLoc":1456,"text":"def rightmost_terminal(symbols, terminals):\n    i = len(symbols) - 1\n    while i >= 0:\n        if symbols[i] in terminals:\n            return symbols[i]\n        i -= 1\n    return None"},{"attributeType":"null","col":8,"comment":"null","endLoc":92,"id":11995,"name":"uncertainty","nodeType":"Attribute","startLoc":92,"text":"self.uncertainty"},{"col":4,"comment":"Write a section marker line","endLoc":1995,"header":"def _write_marker(self, indent_string, depth, entry, comment)","id":11996,"name":"_write_marker","nodeType":"Function","startLoc":1989,"text":"def _write_marker(self, indent_string, depth, entry, comment):\n        \"\"\"Write a section marker line\"\"\"\n        return '%s%s%s%s%s' % (indent_string,\n                               self._a_to_u('[' * depth),\n                               self._quote(self._decode_element(entry), multiline=False),\n                               self._a_to_u(']' * depth),\n                               self._decode_element(comment))"},{"attributeType":"null","col":8,"comment":"null","endLoc":95,"id":11997,"name":"mask","nodeType":"Attribute","startLoc":95,"text":"self.mask"},{"className":"StdDevUncertainty","col":0,"comment":"Standard deviation uncertainty assuming first order gaussian error\n    propagation.\n\n    This class implements uncertainty propagation for ``addition``,\n    ``subtraction``, ``multiplication`` and ``division`` with other instances\n    of `StdDevUncertainty`. The class can handle if the uncertainty has a\n    unit that differs from (but is convertible to) the parents `NDData` unit.\n    The unit of the resulting uncertainty will have the same unit as the\n    resulting data. Also support for correlation is possible but requires the\n    correlation as input. It cannot handle correlation determination itself.\n\n    Parameters\n    ----------\n    args, kwargs :\n        see `NDUncertainty`\n\n    Examples\n    --------\n    `StdDevUncertainty` should always be associated with an `NDData`-like\n    instance, either by creating it during initialization::\n\n        >>> from astropy.nddata import NDData, StdDevUncertainty\n        >>> ndd = NDData([1,2,3], unit='m',\n        ...              uncertainty=StdDevUncertainty([0.1, 0.1, 0.1]))\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        StdDevUncertainty([0.1, 0.1, 0.1])\n\n    or by setting it manually on the `NDData` instance::\n\n        >>> ndd.uncertainty = StdDevUncertainty([0.2], unit='m', copy=True)\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        StdDevUncertainty([0.2])\n\n    the uncertainty ``array`` can also be set directly::\n\n        >>> ndd.uncertainty.array = 2\n        >>> ndd.uncertainty\n        StdDevUncertainty(2)\n\n    .. note::\n        The unit will not be displayed.\n    ","endLoc":749,"id":11998,"nodeType":"Class","startLoc":656,"text":"class StdDevUncertainty(_VariancePropagationMixin, NDUncertainty):\n    \"\"\"Standard deviation uncertainty assuming first order gaussian error\n    propagation.\n\n    This class implements uncertainty propagation for ``addition``,\n    ``subtraction``, ``multiplication`` and ``division`` with other instances\n    of `StdDevUncertainty`. The class can handle if the uncertainty has a\n    unit that differs from (but is convertible to) the parents `NDData` unit.\n    The unit of the resulting uncertainty will have the same unit as the\n    resulting data. Also support for correlation is possible but requires the\n    correlation as input. It cannot handle correlation determination itself.\n\n    Parameters\n    ----------\n    args, kwargs :\n        see `NDUncertainty`\n\n    Examples\n    --------\n    `StdDevUncertainty` should always be associated with an `NDData`-like\n    instance, either by creating it during initialization::\n\n        >>> from astropy.nddata import NDData, StdDevUncertainty\n        >>> ndd = NDData([1,2,3], unit='m',\n        ...              uncertainty=StdDevUncertainty([0.1, 0.1, 0.1]))\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        StdDevUncertainty([0.1, 0.1, 0.1])\n\n    or by setting it manually on the `NDData` instance::\n\n        >>> ndd.uncertainty = StdDevUncertainty([0.2], unit='m', copy=True)\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        StdDevUncertainty([0.2])\n\n    the uncertainty ``array`` can also be set directly::\n\n        >>> ndd.uncertainty.array = 2\n        >>> ndd.uncertainty\n        StdDevUncertainty(2)\n\n    .. note::\n        The unit will not be displayed.\n    \"\"\"\n\n    @property\n    def supports_correlated(self):\n        \"\"\"`True` : `StdDevUncertainty` allows to propagate correlated \\\n                    uncertainties.\n\n        ``correlation`` must be given, this class does not implement computing\n        it by itself.\n        \"\"\"\n        return True\n\n    @property\n    def uncertainty_type(self):\n        \"\"\"``\"std\"`` : `StdDevUncertainty` implements standard deviation.\n        \"\"\"\n        return 'std'\n\n    def _convert_uncertainty(self, other_uncert):\n        if isinstance(other_uncert, StdDevUncertainty):\n            return other_uncert\n        else:\n            raise IncompatibleUncertaintiesException\n\n    def _propagate_add(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=False,\n                                          to_variance=np.square,\n                                          from_variance=np.sqrt)\n\n    def _propagate_subtract(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=True,\n                                          to_variance=np.square,\n                                          from_variance=np.sqrt)\n\n    def _propagate_multiply(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=False,\n                                                  to_variance=np.square,\n                                                  from_variance=np.sqrt)\n\n    def _propagate_divide(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=True,\n                                                  to_variance=np.square,\n                                                  from_variance=np.sqrt)\n\n    def _data_unit_to_uncertainty_unit(self, value):\n        return value"},{"className":"_VariancePropagationMixin","col":0,"comment":"\n    Propagation of uncertainties for variances, also used to perform error\n    propagation for variance-like uncertainties (standard deviation and inverse\n    variance).\n    ","endLoc":653,"id":11999,"nodeType":"Class","startLoc":452,"text":"class _VariancePropagationMixin:\n    \"\"\"\n    Propagation of uncertainties for variances, also used to perform error\n    propagation for variance-like uncertainties (standard deviation and inverse\n    variance).\n    \"\"\"\n\n    def _propagate_add_sub(self, other_uncert, result_data, correlation,\n                           subtract=False,\n                           to_variance=lambda x: x, from_variance=lambda x: x):\n        \"\"\"\n        Error propagation for addition or subtraction of variance or\n        variance-like uncertainties. Uncertainties are calculated using the\n        formulae for variance but can be used for uncertainty convertible to\n        a variance.\n\n        Parameters\n        ----------\n\n        other_uncert : `~astropy.nddata.NDUncertainty` instance\n            The uncertainty, if any, of the other operand.\n\n        result_data : `~astropy.nddata.NDData` instance\n            The results of the operation on the data.\n\n        correlation : float or array-like\n            Correlation of the uncertainties.\n\n        subtract : bool, optional\n            If ``True``, propagate for subtraction, otherwise propagate for\n            addition.\n\n        to_variance : function, optional\n            Function that will transform the input uncertainties to variance.\n            The default assumes the uncertainty is the variance.\n\n        from_variance : function, optional\n            Function that will convert from variance to the input uncertainty.\n            The default assumes the uncertainty is the variance.\n        \"\"\"\n        if subtract:\n            correlation_sign = -1\n        else:\n            correlation_sign = 1\n\n        try:\n            result_unit_sq = result_data.unit ** 2\n        except AttributeError:\n            result_unit_sq = None\n\n        if other_uncert.array is not None:\n            # Formula: sigma**2 = dB\n            if (other_uncert.unit is not None and\n                    result_unit_sq != to_variance(other_uncert.unit)):\n                # If the other uncertainty has a unit and this unit differs\n                # from the unit of the result convert it to the results unit\n                other = to_variance(other_uncert.array <<\n                                    other_uncert.unit).to(result_unit_sq).value\n            else:\n                other = to_variance(other_uncert.array)\n        else:\n            other = 0\n\n        if self.array is not None:\n            # Formula: sigma**2 = dA\n\n            if self.unit is not None and to_variance(self.unit) != self.parent_nddata.unit**2:\n                # If the uncertainty has a different unit than the result we\n                # need to convert it to the results unit.\n                this = to_variance(self.array << self.unit).to(result_unit_sq).value\n            else:\n                this = to_variance(self.array)\n        else:\n            this = 0\n\n        # Formula: sigma**2 = dA + dB +/- 2*cor*sqrt(dA*dB)\n        # Formula: sigma**2 = sigma_other + sigma_self +/- 2*cor*sqrt(dA*dB)\n        #     (sign depends on whether addition or subtraction)\n\n        # Determine the result depending on the correlation\n        if isinstance(correlation, np.ndarray) or correlation != 0:\n            corr = 2 * correlation * np.sqrt(this * other)\n            result = this + other + correlation_sign * corr\n        else:\n            result = this + other\n\n        return from_variance(result)\n\n    def _propagate_multiply_divide(self, other_uncert, result_data,\n                                   correlation,\n                                   divide=False,\n                                   to_variance=lambda x: x,\n                                   from_variance=lambda x: x):\n        \"\"\"\n        Error propagation for multiplication or division of variance or\n        variance-like uncertainties. Uncertainties are calculated using the\n        formulae for variance but can be used for uncertainty convertible to\n        a variance.\n\n        Parameters\n        ----------\n\n        other_uncert : `~astropy.nddata.NDUncertainty` instance\n            The uncertainty, if any, of the other operand.\n\n        result_data : `~astropy.nddata.NDData` instance\n            The results of the operation on the data.\n\n        correlation : float or array-like\n            Correlation of the uncertainties.\n\n        divide : bool, optional\n            If ``True``, propagate for division, otherwise propagate for\n            multiplication.\n\n        to_variance : function, optional\n            Function that will transform the input uncertainties to variance.\n            The default assumes the uncertainty is the variance.\n\n        from_variance : function, optional\n            Function that will convert from variance to the input uncertainty.\n            The default assumes the uncertainty is the variance.\n        \"\"\"\n        # For multiplication we don't need the result as quantity\n        if isinstance(result_data, Quantity):\n            result_data = result_data.value\n\n        if divide:\n            correlation_sign = -1\n        else:\n            correlation_sign = 1\n\n        if other_uncert.array is not None:\n            # We want the result to have a unit consistent with the parent, so\n            # we only need to convert the unit of the other uncertainty if it\n            # is different from its data's unit.\n            if (other_uncert.unit and\n                to_variance(1 * other_uncert.unit) !=\n                    ((1 * other_uncert.parent_nddata.unit)**2).unit):\n                d_b = to_variance(other_uncert.array << other_uncert.unit).to(\n                    (1 * other_uncert.parent_nddata.unit)**2).value\n            else:\n                d_b = to_variance(other_uncert.array)\n            # Formula: sigma**2 = |A|**2 * d_b\n            right = np.abs(self.parent_nddata.data**2 * d_b)\n        else:\n            right = 0\n\n        if self.array is not None:\n            # Just the reversed case\n            if (self.unit and\n                to_variance(1 * self.unit) !=\n                    ((1 * self.parent_nddata.unit)**2).unit):\n                d_a = to_variance(self.array << self.unit).to(\n                    (1 * self.parent_nddata.unit)**2).value\n            else:\n                d_a = to_variance(self.array)\n            # Formula: sigma**2 = |B|**2 * d_a\n            left = np.abs(other_uncert.parent_nddata.data**2 * d_a)\n        else:\n            left = 0\n\n        # Multiplication\n        #\n        # The fundamental formula is:\n        #   sigma**2 = |AB|**2*(d_a/A**2+d_b/B**2+2*sqrt(d_a)/A*sqrt(d_b)/B*cor)\n        #\n        # This formula is not very handy since it generates NaNs for every\n        # zero in A and B. So we rewrite it:\n        #\n        # Multiplication Formula:\n        #   sigma**2 = (d_a*B**2 + d_b*A**2 + (2 * cor * ABsqrt(dAdB)))\n        #   sigma**2 = (left + right + (2 * cor * ABsqrt(dAdB)))\n        #\n        # Division\n        #\n        # The fundamental formula for division is:\n        #   sigma**2 = |A/B|**2*(d_a/A**2+d_b/B**2-2*sqrt(d_a)/A*sqrt(d_b)/B*cor)\n        #\n        # As with multiplication, it is convenient to rewrite this to avoid\n        # nans where A is zero.\n        #\n        # Division formula (rewritten):\n        #   sigma**2 = d_a/B**2 + (A/B)**2 * d_b/B**2\n        #                   - 2 * cor * A *sqrt(dAdB) / B**3\n        #   sigma**2 = d_a/B**2 + (A/B)**2 * d_b/B**2\n        #                   - 2*cor * sqrt(d_a)/B**2  * sqrt(d_b) * A / B\n        #   sigma**2 = multiplication formula/B**4 (and sign change in\n        #               the correlation)\n\n        if isinstance(correlation, np.ndarray) or correlation != 0:\n            corr = (2 * correlation * np.sqrt(d_a * d_b) *\n                    self.parent_nddata.data *\n                    other_uncert.parent_nddata.data)\n        else:\n            corr = 0\n\n        if divide:\n            return from_variance((left + right + correlation_sign * corr) /\n                                 other_uncert.parent_nddata.data**4)\n        else:\n            return from_variance(left + right + correlation_sign * corr)"},{"col":4,"comment":"\n        Error propagation for addition or subtraction of variance or\n        variance-like uncertainties. Uncertainties are calculated using the\n        formulae for variance but can be used for uncertainty convertible to\n        a variance.\n\n        Parameters\n        ----------\n\n        other_uncert : `~astropy.nddata.NDUncertainty` instance\n            The uncertainty, if any, of the other operand.\n\n        result_data : `~astropy.nddata.NDData` instance\n            The results of the operation on the data.\n\n        correlation : float or array-like\n            Correlation of the uncertainties.\n\n        subtract : bool, optional\n            If ``True``, propagate for subtraction, otherwise propagate for\n            addition.\n\n        to_variance : function, optional\n            Function that will transform the input uncertainties to variance.\n            The default assumes the uncertainty is the variance.\n\n        from_variance : function, optional\n            Function that will convert from variance to the input uncertainty.\n            The default assumes the uncertainty is the variance.\n        ","endLoc":538,"header":"def _propagate_add_sub(self, other_uncert, result_data, correlation,\n                           subtract=False,\n                           to_variance=lambda x: x, from_variance=lambda x: x)","id":12000,"name":"_propagate_add_sub","nodeType":"Function","startLoc":459,"text":"def _propagate_add_sub(self, other_uncert, result_data, correlation,\n                           subtract=False,\n                           to_variance=lambda x: x, from_variance=lambda x: x):\n        \"\"\"\n        Error propagation for addition or subtraction of variance or\n        variance-like uncertainties. Uncertainties are calculated using the\n        formulae for variance but can be used for uncertainty convertible to\n        a variance.\n\n        Parameters\n        ----------\n\n        other_uncert : `~astropy.nddata.NDUncertainty` instance\n            The uncertainty, if any, of the other operand.\n\n        result_data : `~astropy.nddata.NDData` instance\n            The results of the operation on the data.\n\n        correlation : float or array-like\n            Correlation of the uncertainties.\n\n        subtract : bool, optional\n            If ``True``, propagate for subtraction, otherwise propagate for\n            addition.\n\n        to_variance : function, optional\n            Function that will transform the input uncertainties to variance.\n            The default assumes the uncertainty is the variance.\n\n        from_variance : function, optional\n            Function that will convert from variance to the input uncertainty.\n            The default assumes the uncertainty is the variance.\n        \"\"\"\n        if subtract:\n            correlation_sign = -1\n        else:\n            correlation_sign = 1\n\n        try:\n            result_unit_sq = result_data.unit ** 2\n        except AttributeError:\n            result_unit_sq = None\n\n        if other_uncert.array is not None:\n            # Formula: sigma**2 = dB\n            if (other_uncert.unit is not None and\n                    result_unit_sq != to_variance(other_uncert.unit)):\n                # If the other uncertainty has a unit and this unit differs\n                # from the unit of the result convert it to the results unit\n                other = to_variance(other_uncert.array <<\n                                    other_uncert.unit).to(result_unit_sq).value\n            else:\n                other = to_variance(other_uncert.array)\n        else:\n            other = 0\n\n        if self.array is not None:\n            # Formula: sigma**2 = dA\n\n            if self.unit is not None and to_variance(self.unit) != self.parent_nddata.unit**2:\n                # If the uncertainty has a different unit than the result we\n                # need to convert it to the results unit.\n                this = to_variance(self.array << self.unit).to(result_unit_sq).value\n            else:\n                this = to_variance(self.array)\n        else:\n            this = 0\n\n        # Formula: sigma**2 = dA + dB +/- 2*cor*sqrt(dA*dB)\n        # Formula: sigma**2 = sigma_other + sigma_self +/- 2*cor*sqrt(dA*dB)\n        #     (sign depends on whether addition or subtraction)\n\n        # Determine the result depending on the correlation\n        if isinstance(correlation, np.ndarray) or correlation != 0:\n            corr = 2 * correlation * np.sqrt(this * other)\n            result = this + other + correlation_sign * corr\n        else:\n            result = this + other\n\n        return from_variance(result)"},{"col":39,"endLoc":461,"id":12001,"nodeType":"Lambda","startLoc":461,"text":"lambda x: x"},{"col":66,"endLoc":461,"id":12002,"nodeType":"Lambda","startLoc":461,"text":"lambda x: x"},{"col":4,"comment":"Deal with a comment.","endLoc":2005,"header":"def _handle_comment(self, comment)","id":12003,"name":"_handle_comment","nodeType":"Function","startLoc":1998,"text":"def _handle_comment(self, comment):\n        \"\"\"Deal with a comment.\"\"\"\n        if not comment:\n            return ''\n        start = self.indent_type\n        if not comment.startswith('#'):\n            start += self._a_to_u(' # ')\n        return (start + comment)"},{"col":4,"comment":"\n        Error propagation for multiplication or division of variance or\n        variance-like uncertainties. Uncertainties are calculated using the\n        formulae for variance but can be used for uncertainty convertible to\n        a variance.\n\n        Parameters\n        ----------\n\n        other_uncert : `~astropy.nddata.NDUncertainty` instance\n            The uncertainty, if any, of the other operand.\n\n        result_data : `~astropy.nddata.NDData` instance\n            The results of the operation on the data.\n\n        correlation : float or array-like\n            Correlation of the uncertainties.\n\n        divide : bool, optional\n            If ``True``, propagate for division, otherwise propagate for\n            multiplication.\n\n        to_variance : function, optional\n            Function that will transform the input uncertainties to variance.\n            The default assumes the uncertainty is the variance.\n\n        from_variance : function, optional\n            Function that will convert from variance to the input uncertainty.\n            The default assumes the uncertainty is the variance.\n        ","endLoc":653,"header":"def _propagate_multiply_divide(self, other_uncert, result_data,\n                                   correlation,\n                                   divide=False,\n                                   to_variance=lambda x: x,\n                                   from_variance=lambda x: x)","id":12004,"name":"_propagate_multiply_divide","nodeType":"Function","startLoc":540,"text":"def _propagate_multiply_divide(self, other_uncert, result_data,\n                                   correlation,\n                                   divide=False,\n                                   to_variance=lambda x: x,\n                                   from_variance=lambda x: x):\n        \"\"\"\n        Error propagation for multiplication or division of variance or\n        variance-like uncertainties. Uncertainties are calculated using the\n        formulae for variance but can be used for uncertainty convertible to\n        a variance.\n\n        Parameters\n        ----------\n\n        other_uncert : `~astropy.nddata.NDUncertainty` instance\n            The uncertainty, if any, of the other operand.\n\n        result_data : `~astropy.nddata.NDData` instance\n            The results of the operation on the data.\n\n        correlation : float or array-like\n            Correlation of the uncertainties.\n\n        divide : bool, optional\n            If ``True``, propagate for division, otherwise propagate for\n            multiplication.\n\n        to_variance : function, optional\n            Function that will transform the input uncertainties to variance.\n            The default assumes the uncertainty is the variance.\n\n        from_variance : function, optional\n            Function that will convert from variance to the input uncertainty.\n            The default assumes the uncertainty is the variance.\n        \"\"\"\n        # For multiplication we don't need the result as quantity\n        if isinstance(result_data, Quantity):\n            result_data = result_data.value\n\n        if divide:\n            correlation_sign = -1\n        else:\n            correlation_sign = 1\n\n        if other_uncert.array is not None:\n            # We want the result to have a unit consistent with the parent, so\n            # we only need to convert the unit of the other uncertainty if it\n            # is different from its data's unit.\n            if (other_uncert.unit and\n                to_variance(1 * other_uncert.unit) !=\n                    ((1 * other_uncert.parent_nddata.unit)**2).unit):\n                d_b = to_variance(other_uncert.array << other_uncert.unit).to(\n                    (1 * other_uncert.parent_nddata.unit)**2).value\n            else:\n                d_b = to_variance(other_uncert.array)\n            # Formula: sigma**2 = |A|**2 * d_b\n            right = np.abs(self.parent_nddata.data**2 * d_b)\n        else:\n            right = 0\n\n        if self.array is not None:\n            # Just the reversed case\n            if (self.unit and\n                to_variance(1 * self.unit) !=\n                    ((1 * self.parent_nddata.unit)**2).unit):\n                d_a = to_variance(self.array << self.unit).to(\n                    (1 * self.parent_nddata.unit)**2).value\n            else:\n                d_a = to_variance(self.array)\n            # Formula: sigma**2 = |B|**2 * d_a\n            left = np.abs(other_uncert.parent_nddata.data**2 * d_a)\n        else:\n            left = 0\n\n        # Multiplication\n        #\n        # The fundamental formula is:\n        #   sigma**2 = |AB|**2*(d_a/A**2+d_b/B**2+2*sqrt(d_a)/A*sqrt(d_b)/B*cor)\n        #\n        # This formula is not very handy since it generates NaNs for every\n        # zero in A and B. So we rewrite it:\n        #\n        # Multiplication Formula:\n        #   sigma**2 = (d_a*B**2 + d_b*A**2 + (2 * cor * ABsqrt(dAdB)))\n        #   sigma**2 = (left + right + (2 * cor * ABsqrt(dAdB)))\n        #\n        # Division\n        #\n        # The fundamental formula for division is:\n        #   sigma**2 = |A/B|**2*(d_a/A**2+d_b/B**2-2*sqrt(d_a)/A*sqrt(d_b)/B*cor)\n        #\n        # As with multiplication, it is convenient to rewrite this to avoid\n        # nans where A is zero.\n        #\n        # Division formula (rewritten):\n        #   sigma**2 = d_a/B**2 + (A/B)**2 * d_b/B**2\n        #                   - 2 * cor * A *sqrt(dAdB) / B**3\n        #   sigma**2 = d_a/B**2 + (A/B)**2 * d_b/B**2\n        #                   - 2*cor * sqrt(d_a)/B**2  * sqrt(d_b) * A / B\n        #   sigma**2 = multiplication formula/B**4 (and sign change in\n        #               the correlation)\n\n        if isinstance(correlation, np.ndarray) or correlation != 0:\n            corr = (2 * correlation * np.sqrt(d_a * d_b) *\n                    self.parent_nddata.data *\n                    other_uncert.parent_nddata.data)\n        else:\n            corr = 0\n\n        if divide:\n            return from_variance((left + right + correlation_sign * corr) /\n                                 other_uncert.parent_nddata.data**4)\n        else:\n            return from_variance(left + right + correlation_sign * corr)"},{"col":47,"endLoc":543,"id":12005,"nodeType":"Lambda","startLoc":543,"text":"lambda x: x"},{"col":49,"endLoc":544,"id":12006,"nodeType":"Lambda","startLoc":544,"text":"lambda x: x"},{"fileName":"_testing.py","filePath":"astropy/nddata","id":12007,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"Testing utilities. Not part of the public API!\"\"\"\n\nfrom astropy.wcs import WCS\nfrom astropy.wcs.wcsapi import BaseHighLevelWCS\n\n\ndef assert_wcs_seem_equal(wcs1, wcs2):\n    \"\"\"Just checks a few attributes to make sure wcs instances seem to be\n    equal.\n    \"\"\"\n    if wcs1 is None and wcs2 is None:\n        return\n    assert wcs1 is not None\n    assert wcs2 is not None\n    if isinstance(wcs1, BaseHighLevelWCS):\n        wcs1 = wcs1.low_level_wcs\n    if isinstance(wcs2, BaseHighLevelWCS):\n        wcs2 = wcs2.low_level_wcs\n    assert isinstance(wcs1, WCS)\n    assert isinstance(wcs2, WCS)\n    if wcs1 is wcs2:\n        return\n    assert wcs1.wcs.compare(wcs2.wcs)\n\n\ndef _create_wcs_simple(naxis, ctype, crpix, crval, cdelt):\n    wcs = WCS(naxis=naxis)\n    wcs.wcs.crpix = crpix\n    wcs.wcs.crval = crval\n    wcs.wcs.cdelt = cdelt\n    wcs.wcs.ctype = ctype\n    return wcs\n\n\ndef create_two_equal_wcs(naxis):\n    return [\n        _create_wcs_simple(\n            naxis=naxis, ctype=[\"deg\"]*naxis, crpix=[10]*naxis,\n            crval=[10]*naxis, cdelt=[1]*naxis),\n        _create_wcs_simple(\n            naxis=naxis, ctype=[\"deg\"]*naxis, crpix=[10]*naxis,\n            crval=[10]*naxis, cdelt=[1]*naxis)\n    ]\n\n\ndef create_two_unequal_wcs(naxis):\n    return [\n        _create_wcs_simple(\n            naxis=naxis, ctype=[\"deg\"]*naxis, crpix=[10]*naxis,\n            crval=[10]*naxis, cdelt=[1]*naxis),\n        _create_wcs_simple(\n            naxis=naxis, ctype=[\"m\"]*naxis, crpix=[20]*naxis,\n            crval=[20]*naxis, cdelt=[2]*naxis),\n    ]\n"},{"col":4,"comment":"\n        Write the current ConfigObj as a file\n\n        tekNico: FIXME: use StringIO instead of real files\n\n        >>> filename = a.filename\n        >>> a.filename = 'test.ini'\n        >>> a.write()\n        >>> a.filename = filename\n        >>> a == ConfigObj('test.ini', raise_errors=True)\n        1\n        >>> import os\n        >>> os.remove('test.ini')\n        ","endLoc":2122,"header":"def write(self, outfile=None, section=None)","id":12008,"name":"write","nodeType":"Function","startLoc":2010,"text":"def write(self, outfile=None, section=None):\n        \"\"\"\n        Write the current ConfigObj as a file\n\n        tekNico: FIXME: use StringIO instead of real files\n\n        >>> filename = a.filename\n        >>> a.filename = 'test.ini'\n        >>> a.write()\n        >>> a.filename = filename\n        >>> a == ConfigObj('test.ini', raise_errors=True)\n        1\n        >>> import os\n        >>> os.remove('test.ini')\n        \"\"\"\n        if self.indent_type is None:\n            # this can be true if initialised from a dictionary\n            self.indent_type = DEFAULT_INDENT_TYPE\n\n        out = []\n        cs = self._a_to_u('#')\n        csp = self._a_to_u('# ')\n        if section is None:\n            int_val = self.interpolation\n            self.interpolation = False\n            section = self\n            for line in self.initial_comment:\n                line = self._decode_element(line)\n                stripped_line = line.strip()\n                if stripped_line and not stripped_line.startswith(cs):\n                    line = csp + line\n                out.append(line)\n\n        indent_string = self.indent_type * section.depth\n        for entry in (section.scalars + section.sections):\n            if entry in section.defaults:\n                # don't write out default values\n                continue\n            for comment_line in section.comments[entry]:\n                comment_line = self._decode_element(comment_line.lstrip())\n                if comment_line and not comment_line.startswith(cs):\n                    comment_line = csp + comment_line\n                out.append(indent_string + comment_line)\n            this_entry = section[entry]\n            comment = self._handle_comment(section.inline_comments[entry])\n\n            if isinstance(this_entry, Section):\n                # a section\n                out.append(self._write_marker(\n                    indent_string,\n                    this_entry.depth,\n                    entry,\n                    comment))\n                out.extend(self.write(section=this_entry))\n            else:\n                out.append(self._write_line(\n                    indent_string,\n                    entry,\n                    this_entry,\n                    comment))\n\n        if section is self:\n            for line in self.final_comment:\n                line = self._decode_element(line)\n                stripped_line = line.strip()\n                if stripped_line and not stripped_line.startswith(cs):\n                    line = csp + line\n                out.append(line)\n            self.interpolation = int_val\n\n        if section is not self:\n            return out\n\n        if (self.filename is None) and (outfile is None):\n            # output a list of lines\n            # might need to encode\n            # NOTE: This will *screw* UTF16, each line will start with the BOM\n            if self.encoding:\n                out = [l.encode(self.encoding) for l in out]\n            if (self.BOM and ((self.encoding is None) or\n                (BOM_LIST.get(self.encoding.lower()) == 'utf_8'))):\n                # Add the UTF8 BOM\n                if not out:\n                    out.append('')\n                out[0] = BOM_UTF8 + out[0]\n            return out\n\n        # Turn the list to a string, joined with correct newlines\n        newline = self.newlines or os.linesep\n        if (getattr(outfile, 'mode', None) is not None and outfile.mode == 'w'\n            and sys.platform == 'win32' and newline == '\\r\\n'):\n            # Windows specific hack to avoid writing '\\r\\r\\n'\n            newline = '\\n'\n        output = self._a_to_u(newline).join(out)\n        if not output.endswith(newline):\n            output += newline\n\n        if isinstance(output, bytes):\n            output_bytes = output\n        else:\n            output_bytes = output.encode(self.encoding or\n                                         self.default_encoding or\n                                         'ascii')\n\n        if self.BOM and ((self.encoding is None) or match_utf8(self.encoding)):\n            # Add the UTF8 BOM\n            output_bytes = BOM_UTF8 + output_bytes\n\n        if outfile is not None:\n            outfile.write(output_bytes)\n        else:\n            with open(self.filename, 'wb') as h:\n                h.write(output_bytes)"},{"col":4,"comment":"`True` : `StdDevUncertainty` allows to propagate correlated \n                    uncertainties.\n\n        ``correlation`` must be given, this class does not implement computing\n        it by itself.\n        ","endLoc":708,"header":"@property\n    def supports_correlated(self)","id":12009,"name":"supports_correlated","nodeType":"Function","startLoc":700,"text":"@property\n    def supports_correlated(self):\n        \"\"\"`True` : `StdDevUncertainty` allows to propagate correlated \\\n                    uncertainties.\n\n        ``correlation`` must be given, this class does not implement computing\n        it by itself.\n        \"\"\"\n        return True"},{"col":4,"comment":"``\"std\"`` : `StdDevUncertainty` implements standard deviation.\n        ","endLoc":714,"header":"@property\n    def uncertainty_type(self)","id":12010,"name":"uncertainty_type","nodeType":"Function","startLoc":710,"text":"@property\n    def uncertainty_type(self):\n        \"\"\"``\"std\"`` : `StdDevUncertainty` implements standard deviation.\n        \"\"\"\n        return 'std'"},{"col":4,"comment":"null","endLoc":720,"header":"def _convert_uncertainty(self, other_uncert)","id":12011,"name":"_convert_uncertainty","nodeType":"Function","startLoc":716,"text":"def _convert_uncertainty(self, other_uncert):\n        if isinstance(other_uncert, StdDevUncertainty):\n            return other_uncert\n        else:\n            raise IncompatibleUncertaintiesException"},{"col":4,"comment":"null","endLoc":726,"header":"def _propagate_add(self, other_uncert, result_data, correlation)","id":12012,"name":"_propagate_add","nodeType":"Function","startLoc":722,"text":"def _propagate_add(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=False,\n                                          to_variance=np.square,\n                                          from_variance=np.sqrt)"},{"fileName":"nduncertainty.py","filePath":"astropy/nddata","id":12013,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport numpy as np\nfrom abc import ABCMeta, abstractmethod\nfrom copy import deepcopy\nimport weakref\n\n\n# from astropy.utils.compat import ignored\nfrom astropy import log\nfrom astropy.units import Unit, Quantity, UnitConversionError\n\n__all__ = ['MissingDataAssociationException',\n           'IncompatibleUncertaintiesException', 'NDUncertainty',\n           'StdDevUncertainty', 'UnknownUncertainty',\n           'VarianceUncertainty', 'InverseVariance']\n\n\nclass IncompatibleUncertaintiesException(Exception):\n    \"\"\"This exception should be used to indicate cases in which uncertainties\n    with two different classes can not be propagated.\n    \"\"\"\n\n\nclass MissingDataAssociationException(Exception):\n    \"\"\"This exception should be used to indicate that an uncertainty instance\n    has not been associated with a parent `~astropy.nddata.NDData` object.\n    \"\"\"\n\n\nclass NDUncertainty(metaclass=ABCMeta):\n    \"\"\"This is the metaclass for uncertainty classes used with `NDData`.\n\n    Parameters\n    ----------\n    array : any type, optional\n        The array or value (the parameter name is due to historical reasons) of\n        the uncertainty. `numpy.ndarray`, `~astropy.units.Quantity` or\n        `NDUncertainty` subclasses are recommended.\n        If the `array` is `list`-like or `numpy.ndarray`-like it will be cast\n        to a plain `numpy.ndarray`.\n        Default is ``None``.\n\n    unit : unit-like, optional\n        Unit for the uncertainty ``array``. Strings that can be converted to a\n        `~astropy.units.Unit` are allowed.\n        Default is ``None``.\n\n    copy : `bool`, optional\n        Indicates whether to save the `array` as a copy. ``True`` copies it\n        before saving, while ``False`` tries to save every parameter as\n        reference. Note however that it is not always possible to save the\n        input as reference.\n        Default is ``True``.\n\n    Raises\n    ------\n    IncompatibleUncertaintiesException\n        If given another `NDUncertainty`-like class as ``array`` if their\n        ``uncertainty_type`` is different.\n    \"\"\"\n\n    def __init__(self, array=None, copy=True, unit=None):\n        if isinstance(array, NDUncertainty):\n            # Given an NDUncertainty class or subclass check that the type\n            # is the same.\n            if array.uncertainty_type != self.uncertainty_type:\n                raise IncompatibleUncertaintiesException\n            # Check if two units are given and take the explicit one then.\n            if (unit is not None and unit != array._unit):\n                # TODO : Clarify it (see NDData.init for same problem)?\n                log.info(\"overwriting Uncertainty's current \"\n                         \"unit with specified unit.\")\n            elif array._unit is not None:\n                unit = array.unit\n            array = array.array\n\n        elif isinstance(array, Quantity):\n            # Check if two units are given and take the explicit one then.\n            if (unit is not None and array.unit is not None and\n                    unit != array.unit):\n                log.info(\"overwriting Quantity's current \"\n                         \"unit with specified unit.\")\n            elif array.unit is not None:\n                unit = array.unit\n            array = array.value\n\n        if unit is None:\n            self._unit = None\n        else:\n            self._unit = Unit(unit)\n\n        if copy:\n            array = deepcopy(array)\n            unit = deepcopy(unit)\n\n        self.array = array\n        self.parent_nddata = None  # no associated NDData - until it is set!\n\n    @property\n    @abstractmethod\n    def uncertainty_type(self):\n        \"\"\"`str` : Short description of the type of uncertainty.\n\n        Defined as abstract property so subclasses *have* to override this.\n        \"\"\"\n        return None\n\n    @property\n    def supports_correlated(self):\n        \"\"\"`bool` : Supports uncertainty propagation with correlated \\\n                 uncertainties?\n\n        .. versionadded:: 1.2\n        \"\"\"\n        return False\n\n    @property\n    def array(self):\n        \"\"\"`numpy.ndarray` : the uncertainty's value.\n        \"\"\"\n        return self._array\n\n    @array.setter\n    def array(self, value):\n        if isinstance(value, (list, np.ndarray)):\n            value = np.array(value, subok=False, copy=False)\n        self._array = value\n\n    @property\n    def unit(self):\n        \"\"\"`~astropy.units.Unit` : The unit of the uncertainty, if any.\n        \"\"\"\n        return self._unit\n\n    @unit.setter\n    def unit(self, value):\n        \"\"\"\n        The unit should be set to a value consistent with the parent NDData\n        unit and the uncertainty type.\n        \"\"\"\n        if value is not None:\n            # Check the hidden attribute below, not the property. The property\n            # raises an exception if there is no parent_nddata.\n            if self._parent_nddata is not None:\n                parent_unit = self.parent_nddata.unit\n                try:\n                    # Check for consistency with the unit of the parent_nddata\n                    self._data_unit_to_uncertainty_unit(parent_unit).to(value)\n                except UnitConversionError:\n                    raise UnitConversionError(\"Unit {} is incompatible \"\n                                              \"with unit {} of parent \"\n                                              \"nddata\".format(value,\n                                                              parent_unit))\n\n            self._unit = Unit(value)\n        else:\n            self._unit = value\n\n    @property\n    def quantity(self):\n        \"\"\"\n        This uncertainty as an `~astropy.units.Quantity` object.\n        \"\"\"\n        return Quantity(self.array, self.unit, copy=False, dtype=self.array.dtype)\n\n    @property\n    def parent_nddata(self):\n        \"\"\"`NDData` : reference to `NDData` instance with this uncertainty.\n\n        In case the reference is not set uncertainty propagation will not be\n        possible since propagation might need the uncertain data besides the\n        uncertainty.\n        \"\"\"\n        no_parent_message = \"uncertainty is not associated with an NDData object\"\n        parent_lost_message = (\n            \"the associated NDData object was deleted and cannot be accessed \"\n            \"anymore. You can prevent the NDData object from being deleted by \"\n            \"assigning it to a variable. If this happened after unpickling \"\n            \"make sure you pickle the parent not the uncertainty directly.\"\n        )\n        try:\n            parent = self._parent_nddata\n        except AttributeError:\n            raise MissingDataAssociationException(no_parent_message)\n        else:\n            if parent is None:\n                raise MissingDataAssociationException(no_parent_message)\n            else:\n                # The NDData is saved as weak reference so we must call it\n                # to get the object the reference points to. However because\n                # we have a weak reference here it's possible that the parent\n                # was deleted because its reference count dropped to zero.\n                if isinstance(self._parent_nddata, weakref.ref):\n                    resolved_parent = self._parent_nddata()\n                    if resolved_parent is None:\n                        log.info(parent_lost_message)\n                    return resolved_parent\n                else:\n                    log.info(\"parent_nddata should be a weakref to an NDData \"\n                             \"object.\")\n                    return self._parent_nddata\n\n    @parent_nddata.setter\n    def parent_nddata(self, value):\n        if value is not None and not isinstance(value, weakref.ref):\n            # Save a weak reference on the uncertainty that points to this\n            # instance of NDData. Direct references should NOT be used:\n            # https://github.com/astropy/astropy/pull/4799#discussion_r61236832\n            value = weakref.ref(value)\n        # Set _parent_nddata here and access below with the property because value\n        # is a weakref\n        self._parent_nddata = value\n        # set uncertainty unit to that of the parent if it was not already set, unless initializing\n        # with empty parent (Value=None)\n        if value is not None:\n            parent_unit = self.parent_nddata.unit\n            if self.unit is None:\n                if parent_unit is None:\n                    self.unit = None\n                else:\n                    # Set the uncertainty's unit to the appropriate value\n                    self.unit = self._data_unit_to_uncertainty_unit(parent_unit)\n            else:\n                # Check that units of uncertainty are compatible with those of\n                # the parent. If they are, no need to change units of the\n                # uncertainty or the data. If they are not, let the user know.\n                unit_from_data = self._data_unit_to_uncertainty_unit(parent_unit)\n                try:\n                    unit_from_data.to(self.unit)\n                except UnitConversionError:\n                    raise UnitConversionError(\"Unit {} of uncertainty \"\n                                              \"incompatible with unit {} of \"\n                                              \"data\".format(self.unit,\n                                                            parent_unit))\n\n    @abstractmethod\n    def _data_unit_to_uncertainty_unit(self, value):\n        \"\"\"\n        Subclasses must override this property. It should take in a data unit\n        and return the correct unit for the uncertainty given the uncertainty\n        type.\n        \"\"\"\n        return None\n\n    def __repr__(self):\n        prefix = self.__class__.__name__ + '('\n        try:\n            body = np.array2string(self.array, separator=', ', prefix=prefix)\n        except AttributeError:\n            # In case it wasn't possible to use array2string\n            body = str(self.array)\n        return ''.join([prefix, body, ')'])\n\n    def __getstate__(self):\n        # Because of the weak reference the class wouldn't be picklable.\n        try:\n            return self._array, self._unit, self.parent_nddata\n        except MissingDataAssociationException:\n            # In case there's no parent\n            return self._array, self._unit, None\n\n    def __setstate__(self, state):\n        if len(state) != 3:\n            raise TypeError('The state should contain 3 items.')\n        self._array = state[0]\n        self._unit = state[1]\n\n        parent = state[2]\n        if parent is not None:\n            parent = weakref.ref(parent)\n        self._parent_nddata = parent\n\n    def __getitem__(self, item):\n        \"\"\"Normal slicing on the array, keep the unit and return a reference.\n        \"\"\"\n        return self.__class__(self.array[item], unit=self.unit, copy=False)\n\n    def propagate(self, operation, other_nddata, result_data, correlation):\n        \"\"\"Calculate the resulting uncertainty given an operation on the data.\n\n        .. versionadded:: 1.2\n\n        Parameters\n        ----------\n        operation : callable\n            The operation that is performed on the `NDData`. Supported are\n            `numpy.add`, `numpy.subtract`, `numpy.multiply` and\n            `numpy.true_divide` (or `numpy.divide`).\n\n        other_nddata : `NDData` instance\n            The second operand in the arithmetic operation.\n\n        result_data : `~astropy.units.Quantity` or ndarray\n            The result of the arithmetic operations on the data.\n\n        correlation : `numpy.ndarray` or number\n            The correlation (rho) is defined between the uncertainties in\n            sigma_AB = sigma_A * sigma_B * rho. A value of ``0`` means\n            uncorrelated operands.\n\n        Returns\n        -------\n        resulting_uncertainty : `NDUncertainty` instance\n            Another instance of the same `NDUncertainty` subclass containing\n            the uncertainty of the result.\n\n        Raises\n        ------\n        ValueError\n            If the ``operation`` is not supported or if correlation is not zero\n            but the subclass does not support correlated uncertainties.\n\n        Notes\n        -----\n        First this method checks if a correlation is given and the subclass\n        implements propagation with correlated uncertainties.\n        Then the second uncertainty is converted (or an Exception is raised)\n        to the same class in order to do the propagation.\n        Then the appropriate propagation method is invoked and the result is\n        returned.\n        \"\"\"\n        # Check if the subclass supports correlation\n        if not self.supports_correlated:\n            if isinstance(correlation, np.ndarray) or correlation != 0:\n                raise ValueError(\"{} does not support uncertainty propagation\"\n                                 \" with correlation.\"\n                                 \"\".format(self.__class__.__name__))\n\n        # Get the other uncertainty (and convert it to a matching one)\n        other_uncert = self._convert_uncertainty(other_nddata.uncertainty)\n\n        if operation.__name__ == 'add':\n            result = self._propagate_add(other_uncert, result_data,\n                                         correlation)\n        elif operation.__name__ == 'subtract':\n            result = self._propagate_subtract(other_uncert, result_data,\n                                              correlation)\n        elif operation.__name__ == 'multiply':\n            result = self._propagate_multiply(other_uncert, result_data,\n                                              correlation)\n        elif operation.__name__ in ['true_divide', 'divide']:\n            result = self._propagate_divide(other_uncert, result_data,\n                                            correlation)\n        else:\n            raise ValueError('unsupported operation')\n\n        return self.__class__(result, copy=False)\n\n    def _convert_uncertainty(self, other_uncert):\n        \"\"\"Checks if the uncertainties are compatible for propagation.\n\n        Checks if the other uncertainty is `NDUncertainty`-like and if so\n        verify that the uncertainty_type is equal. If the latter is not the\n        case try returning ``self.__class__(other_uncert)``.\n\n        Parameters\n        ----------\n        other_uncert : `NDUncertainty` subclass\n            The other uncertainty.\n\n        Returns\n        -------\n        other_uncert : `NDUncertainty` subclass\n            but converted to a compatible `NDUncertainty` subclass if\n            possible and necessary.\n\n        Raises\n        ------\n        IncompatibleUncertaintiesException:\n            If the other uncertainty cannot be converted to a compatible\n            `NDUncertainty` subclass.\n        \"\"\"\n        if isinstance(other_uncert, NDUncertainty):\n            if self.uncertainty_type == other_uncert.uncertainty_type:\n                return other_uncert\n            else:\n                return self.__class__(other_uncert)\n        else:\n            raise IncompatibleUncertaintiesException\n\n    @abstractmethod\n    def _propagate_add(self, other_uncert, result_data, correlation):\n        return None\n\n    @abstractmethod\n    def _propagate_subtract(self, other_uncert, result_data, correlation):\n        return None\n\n    @abstractmethod\n    def _propagate_multiply(self, other_uncert, result_data, correlation):\n        return None\n\n    @abstractmethod\n    def _propagate_divide(self, other_uncert, result_data, correlation):\n        return None\n\n\nclass UnknownUncertainty(NDUncertainty):\n    \"\"\"This class implements any unknown uncertainty type.\n\n    The main purpose of having an unknown uncertainty class is to prevent\n    uncertainty propagation.\n\n    Parameters\n    ----------\n    args, kwargs :\n        see `NDUncertainty`\n    \"\"\"\n\n    @property\n    def supports_correlated(self):\n        \"\"\"`False` : Uncertainty propagation is *not* possible for this class.\n        \"\"\"\n        return False\n\n    @property\n    def uncertainty_type(self):\n        \"\"\"``\"unknown\"`` : `UnknownUncertainty` implements any unknown \\\n                           uncertainty type.\n        \"\"\"\n        return 'unknown'\n\n    def _data_unit_to_uncertainty_unit(self, value):\n        \"\"\"\n        No way to convert if uncertainty is unknown.\n        \"\"\"\n        return None\n\n    def _convert_uncertainty(self, other_uncert):\n        \"\"\"Raise an Exception because unknown uncertainty types cannot\n        implement propagation.\n        \"\"\"\n        msg = \"Uncertainties of unknown type cannot be propagated.\"\n        raise IncompatibleUncertaintiesException(msg)\n\n    def _propagate_add(self, other_uncert, result_data, correlation):\n        \"\"\"Not possible for unknown uncertainty types.\n        \"\"\"\n        return None\n\n    def _propagate_subtract(self, other_uncert, result_data, correlation):\n        return None\n\n    def _propagate_multiply(self, other_uncert, result_data, correlation):\n        return None\n\n    def _propagate_divide(self, other_uncert, result_data, correlation):\n        return None\n\n\nclass _VariancePropagationMixin:\n    \"\"\"\n    Propagation of uncertainties for variances, also used to perform error\n    propagation for variance-like uncertainties (standard deviation and inverse\n    variance).\n    \"\"\"\n\n    def _propagate_add_sub(self, other_uncert, result_data, correlation,\n                           subtract=False,\n                           to_variance=lambda x: x, from_variance=lambda x: x):\n        \"\"\"\n        Error propagation for addition or subtraction of variance or\n        variance-like uncertainties. Uncertainties are calculated using the\n        formulae for variance but can be used for uncertainty convertible to\n        a variance.\n\n        Parameters\n        ----------\n\n        other_uncert : `~astropy.nddata.NDUncertainty` instance\n            The uncertainty, if any, of the other operand.\n\n        result_data : `~astropy.nddata.NDData` instance\n            The results of the operation on the data.\n\n        correlation : float or array-like\n            Correlation of the uncertainties.\n\n        subtract : bool, optional\n            If ``True``, propagate for subtraction, otherwise propagate for\n            addition.\n\n        to_variance : function, optional\n            Function that will transform the input uncertainties to variance.\n            The default assumes the uncertainty is the variance.\n\n        from_variance : function, optional\n            Function that will convert from variance to the input uncertainty.\n            The default assumes the uncertainty is the variance.\n        \"\"\"\n        if subtract:\n            correlation_sign = -1\n        else:\n            correlation_sign = 1\n\n        try:\n            result_unit_sq = result_data.unit ** 2\n        except AttributeError:\n            result_unit_sq = None\n\n        if other_uncert.array is not None:\n            # Formula: sigma**2 = dB\n            if (other_uncert.unit is not None and\n                    result_unit_sq != to_variance(other_uncert.unit)):\n                # If the other uncertainty has a unit and this unit differs\n                # from the unit of the result convert it to the results unit\n                other = to_variance(other_uncert.array <<\n                                    other_uncert.unit).to(result_unit_sq).value\n            else:\n                other = to_variance(other_uncert.array)\n        else:\n            other = 0\n\n        if self.array is not None:\n            # Formula: sigma**2 = dA\n\n            if self.unit is not None and to_variance(self.unit) != self.parent_nddata.unit**2:\n                # If the uncertainty has a different unit than the result we\n                # need to convert it to the results unit.\n                this = to_variance(self.array << self.unit).to(result_unit_sq).value\n            else:\n                this = to_variance(self.array)\n        else:\n            this = 0\n\n        # Formula: sigma**2 = dA + dB +/- 2*cor*sqrt(dA*dB)\n        # Formula: sigma**2 = sigma_other + sigma_self +/- 2*cor*sqrt(dA*dB)\n        #     (sign depends on whether addition or subtraction)\n\n        # Determine the result depending on the correlation\n        if isinstance(correlation, np.ndarray) or correlation != 0:\n            corr = 2 * correlation * np.sqrt(this * other)\n            result = this + other + correlation_sign * corr\n        else:\n            result = this + other\n\n        return from_variance(result)\n\n    def _propagate_multiply_divide(self, other_uncert, result_data,\n                                   correlation,\n                                   divide=False,\n                                   to_variance=lambda x: x,\n                                   from_variance=lambda x: x):\n        \"\"\"\n        Error propagation for multiplication or division of variance or\n        variance-like uncertainties. Uncertainties are calculated using the\n        formulae for variance but can be used for uncertainty convertible to\n        a variance.\n\n        Parameters\n        ----------\n\n        other_uncert : `~astropy.nddata.NDUncertainty` instance\n            The uncertainty, if any, of the other operand.\n\n        result_data : `~astropy.nddata.NDData` instance\n            The results of the operation on the data.\n\n        correlation : float or array-like\n            Correlation of the uncertainties.\n\n        divide : bool, optional\n            If ``True``, propagate for division, otherwise propagate for\n            multiplication.\n\n        to_variance : function, optional\n            Function that will transform the input uncertainties to variance.\n            The default assumes the uncertainty is the variance.\n\n        from_variance : function, optional\n            Function that will convert from variance to the input uncertainty.\n            The default assumes the uncertainty is the variance.\n        \"\"\"\n        # For multiplication we don't need the result as quantity\n        if isinstance(result_data, Quantity):\n            result_data = result_data.value\n\n        if divide:\n            correlation_sign = -1\n        else:\n            correlation_sign = 1\n\n        if other_uncert.array is not None:\n            # We want the result to have a unit consistent with the parent, so\n            # we only need to convert the unit of the other uncertainty if it\n            # is different from its data's unit.\n            if (other_uncert.unit and\n                to_variance(1 * other_uncert.unit) !=\n                    ((1 * other_uncert.parent_nddata.unit)**2).unit):\n                d_b = to_variance(other_uncert.array << other_uncert.unit).to(\n                    (1 * other_uncert.parent_nddata.unit)**2).value\n            else:\n                d_b = to_variance(other_uncert.array)\n            # Formula: sigma**2 = |A|**2 * d_b\n            right = np.abs(self.parent_nddata.data**2 * d_b)\n        else:\n            right = 0\n\n        if self.array is not None:\n            # Just the reversed case\n            if (self.unit and\n                to_variance(1 * self.unit) !=\n                    ((1 * self.parent_nddata.unit)**2).unit):\n                d_a = to_variance(self.array << self.unit).to(\n                    (1 * self.parent_nddata.unit)**2).value\n            else:\n                d_a = to_variance(self.array)\n            # Formula: sigma**2 = |B|**2 * d_a\n            left = np.abs(other_uncert.parent_nddata.data**2 * d_a)\n        else:\n            left = 0\n\n        # Multiplication\n        #\n        # The fundamental formula is:\n        #   sigma**2 = |AB|**2*(d_a/A**2+d_b/B**2+2*sqrt(d_a)/A*sqrt(d_b)/B*cor)\n        #\n        # This formula is not very handy since it generates NaNs for every\n        # zero in A and B. So we rewrite it:\n        #\n        # Multiplication Formula:\n        #   sigma**2 = (d_a*B**2 + d_b*A**2 + (2 * cor * ABsqrt(dAdB)))\n        #   sigma**2 = (left + right + (2 * cor * ABsqrt(dAdB)))\n        #\n        # Division\n        #\n        # The fundamental formula for division is:\n        #   sigma**2 = |A/B|**2*(d_a/A**2+d_b/B**2-2*sqrt(d_a)/A*sqrt(d_b)/B*cor)\n        #\n        # As with multiplication, it is convenient to rewrite this to avoid\n        # nans where A is zero.\n        #\n        # Division formula (rewritten):\n        #   sigma**2 = d_a/B**2 + (A/B)**2 * d_b/B**2\n        #                   - 2 * cor * A *sqrt(dAdB) / B**3\n        #   sigma**2 = d_a/B**2 + (A/B)**2 * d_b/B**2\n        #                   - 2*cor * sqrt(d_a)/B**2  * sqrt(d_b) * A / B\n        #   sigma**2 = multiplication formula/B**4 (and sign change in\n        #               the correlation)\n\n        if isinstance(correlation, np.ndarray) or correlation != 0:\n            corr = (2 * correlation * np.sqrt(d_a * d_b) *\n                    self.parent_nddata.data *\n                    other_uncert.parent_nddata.data)\n        else:\n            corr = 0\n\n        if divide:\n            return from_variance((left + right + correlation_sign * corr) /\n                                 other_uncert.parent_nddata.data**4)\n        else:\n            return from_variance(left + right + correlation_sign * corr)\n\n\nclass StdDevUncertainty(_VariancePropagationMixin, NDUncertainty):\n    \"\"\"Standard deviation uncertainty assuming first order gaussian error\n    propagation.\n\n    This class implements uncertainty propagation for ``addition``,\n    ``subtraction``, ``multiplication`` and ``division`` with other instances\n    of `StdDevUncertainty`. The class can handle if the uncertainty has a\n    unit that differs from (but is convertible to) the parents `NDData` unit.\n    The unit of the resulting uncertainty will have the same unit as the\n    resulting data. Also support for correlation is possible but requires the\n    correlation as input. It cannot handle correlation determination itself.\n\n    Parameters\n    ----------\n    args, kwargs :\n        see `NDUncertainty`\n\n    Examples\n    --------\n    `StdDevUncertainty` should always be associated with an `NDData`-like\n    instance, either by creating it during initialization::\n\n        >>> from astropy.nddata import NDData, StdDevUncertainty\n        >>> ndd = NDData([1,2,3], unit='m',\n        ...              uncertainty=StdDevUncertainty([0.1, 0.1, 0.1]))\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        StdDevUncertainty([0.1, 0.1, 0.1])\n\n    or by setting it manually on the `NDData` instance::\n\n        >>> ndd.uncertainty = StdDevUncertainty([0.2], unit='m', copy=True)\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        StdDevUncertainty([0.2])\n\n    the uncertainty ``array`` can also be set directly::\n\n        >>> ndd.uncertainty.array = 2\n        >>> ndd.uncertainty\n        StdDevUncertainty(2)\n\n    .. note::\n        The unit will not be displayed.\n    \"\"\"\n\n    @property\n    def supports_correlated(self):\n        \"\"\"`True` : `StdDevUncertainty` allows to propagate correlated \\\n                    uncertainties.\n\n        ``correlation`` must be given, this class does not implement computing\n        it by itself.\n        \"\"\"\n        return True\n\n    @property\n    def uncertainty_type(self):\n        \"\"\"``\"std\"`` : `StdDevUncertainty` implements standard deviation.\n        \"\"\"\n        return 'std'\n\n    def _convert_uncertainty(self, other_uncert):\n        if isinstance(other_uncert, StdDevUncertainty):\n            return other_uncert\n        else:\n            raise IncompatibleUncertaintiesException\n\n    def _propagate_add(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=False,\n                                          to_variance=np.square,\n                                          from_variance=np.sqrt)\n\n    def _propagate_subtract(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=True,\n                                          to_variance=np.square,\n                                          from_variance=np.sqrt)\n\n    def _propagate_multiply(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=False,\n                                                  to_variance=np.square,\n                                                  from_variance=np.sqrt)\n\n    def _propagate_divide(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=True,\n                                                  to_variance=np.square,\n                                                  from_variance=np.sqrt)\n\n    def _data_unit_to_uncertainty_unit(self, value):\n        return value\n\n\nclass VarianceUncertainty(_VariancePropagationMixin, NDUncertainty):\n    \"\"\"\n    Variance uncertainty assuming first order Gaussian error\n    propagation.\n\n    This class implements uncertainty propagation for ``addition``,\n    ``subtraction``, ``multiplication`` and ``division`` with other instances\n    of `VarianceUncertainty`. The class can handle if the uncertainty has a\n    unit that differs from (but is convertible to) the parents `NDData` unit.\n    The unit of the resulting uncertainty will be the square of the unit of the\n    resulting data. Also support for correlation is possible but requires the\n    correlation as input. It cannot handle correlation determination itself.\n\n    Parameters\n    ----------\n    args, kwargs :\n        see `NDUncertainty`\n\n    Examples\n    --------\n    Compare this example to that in `StdDevUncertainty`; the uncertainties\n    in the examples below are equivalent to the uncertainties in\n    `StdDevUncertainty`.\n\n    `VarianceUncertainty` should always be associated with an `NDData`-like\n    instance, either by creating it during initialization::\n\n        >>> from astropy.nddata import NDData, VarianceUncertainty\n        >>> ndd = NDData([1,2,3], unit='m',\n        ...              uncertainty=VarianceUncertainty([0.01, 0.01, 0.01]))\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        VarianceUncertainty([0.01, 0.01, 0.01])\n\n    or by setting it manually on the `NDData` instance::\n\n        >>> ndd.uncertainty = VarianceUncertainty([0.04], unit='m^2', copy=True)\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        VarianceUncertainty([0.04])\n\n    the uncertainty ``array`` can also be set directly::\n\n        >>> ndd.uncertainty.array = 4\n        >>> ndd.uncertainty\n        VarianceUncertainty(4)\n\n    .. note::\n        The unit will not be displayed.\n    \"\"\"\n    @property\n    def uncertainty_type(self):\n        \"\"\"``\"var\"`` : `VarianceUncertainty` implements variance.\n        \"\"\"\n        return 'var'\n\n    @property\n    def supports_correlated(self):\n        \"\"\"`True` : `VarianceUncertainty` allows to propagate correlated \\\n                    uncertainties.\n\n        ``correlation`` must be given, this class does not implement computing\n        it by itself.\n        \"\"\"\n        return True\n\n    def _propagate_add(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=False)\n\n    def _propagate_subtract(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=True)\n\n    def _propagate_multiply(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=False)\n\n    def _propagate_divide(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=True)\n\n    def _data_unit_to_uncertainty_unit(self, value):\n        return value ** 2\n\n\ndef _inverse(x):\n    \"\"\"Just a simple inverse for use in the InverseVariance\"\"\"\n    return 1 / x\n\n\nclass InverseVariance(_VariancePropagationMixin, NDUncertainty):\n    \"\"\"\n    Inverse variance uncertainty assuming first order Gaussian error\n    propagation.\n\n    This class implements uncertainty propagation for ``addition``,\n    ``subtraction``, ``multiplication`` and ``division`` with other instances\n    of `InverseVariance`. The class can handle if the uncertainty has a unit\n    that differs from (but is convertible to) the parents `NDData` unit. The\n    unit of the resulting uncertainty will the inverse square of the unit of\n    the resulting data. Also support for correlation is possible but requires\n    the correlation as input. It cannot handle correlation determination\n    itself.\n\n    Parameters\n    ----------\n    args, kwargs :\n        see `NDUncertainty`\n\n    Examples\n    --------\n    Compare this example to that in `StdDevUncertainty`; the uncertainties\n    in the examples below are equivalent to the uncertainties in\n    `StdDevUncertainty`.\n\n    `InverseVariance` should always be associated with an `NDData`-like\n    instance, either by creating it during initialization::\n\n        >>> from astropy.nddata import NDData, InverseVariance\n        >>> ndd = NDData([1,2,3], unit='m',\n        ...              uncertainty=InverseVariance([100, 100, 100]))\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        InverseVariance([100, 100, 100])\n\n    or by setting it manually on the `NDData` instance::\n\n        >>> ndd.uncertainty = InverseVariance([25], unit='1/m^2', copy=True)\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        InverseVariance([25])\n\n    the uncertainty ``array`` can also be set directly::\n\n        >>> ndd.uncertainty.array = 0.25\n        >>> ndd.uncertainty\n        InverseVariance(0.25)\n\n    .. note::\n        The unit will not be displayed.\n    \"\"\"\n    @property\n    def uncertainty_type(self):\n        \"\"\"``\"ivar\"`` : `InverseVariance` implements inverse variance.\n        \"\"\"\n        return 'ivar'\n\n    @property\n    def supports_correlated(self):\n        \"\"\"`True` : `InverseVariance` allows to propagate correlated \\\n                    uncertainties.\n\n        ``correlation`` must be given, this class does not implement computing\n        it by itself.\n        \"\"\"\n        return True\n\n    def _propagate_add(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=False,\n                                          to_variance=_inverse,\n                                          from_variance=_inverse)\n\n    def _propagate_subtract(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=True,\n                                          to_variance=_inverse,\n                                          from_variance=_inverse)\n\n    def _propagate_multiply(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=False,\n                                                  to_variance=_inverse,\n                                                  from_variance=_inverse)\n\n    def _propagate_divide(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=True,\n                                                  to_variance=_inverse,\n                                                  from_variance=_inverse)\n\n    def _data_unit_to_uncertainty_unit(self, value):\n        return 1 / value ** 2\n"},{"col":4,"comment":"null","endLoc":732,"header":"def _propagate_subtract(self, other_uncert, result_data, correlation)","id":12014,"name":"_propagate_subtract","nodeType":"Function","startLoc":728,"text":"def _propagate_subtract(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=True,\n                                          to_variance=np.square,\n                                          from_variance=np.sqrt)"},{"col":4,"comment":"null","endLoc":739,"header":"def _propagate_multiply(self, other_uncert, result_data, correlation)","id":12015,"name":"_propagate_multiply","nodeType":"Function","startLoc":734,"text":"def _propagate_multiply(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=False,\n                                                  to_variance=np.square,\n                                                  from_variance=np.sqrt)"},{"col":4,"comment":"null","endLoc":746,"header":"def _propagate_divide(self, other_uncert, result_data, correlation)","id":12016,"name":"_propagate_divide","nodeType":"Function","startLoc":741,"text":"def _propagate_divide(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=True,\n                                                  to_variance=np.square,\n                                                  from_variance=np.sqrt)"},{"col":4,"comment":"null","endLoc":749,"header":"def _data_unit_to_uncertainty_unit(self, value)","id":12017,"name":"_data_unit_to_uncertainty_unit","nodeType":"Function","startLoc":748,"text":"def _data_unit_to_uncertainty_unit(self, value):\n        return value"},{"className":"VarianceUncertainty","col":0,"comment":"\n    Variance uncertainty assuming first order Gaussian error\n    propagation.\n\n    This class implements uncertainty propagation for ``addition``,\n    ``subtraction``, ``multiplication`` and ``division`` with other instances\n    of `VarianceUncertainty`. The class can handle if the uncertainty has a\n    unit that differs from (but is convertible to) the parents `NDData` unit.\n    The unit of the resulting uncertainty will be the square of the unit of the\n    resulting data. Also support for correlation is possible but requires the\n    correlation as input. It cannot handle correlation determination itself.\n\n    Parameters\n    ----------\n    args, kwargs :\n        see `NDUncertainty`\n\n    Examples\n    --------\n    Compare this example to that in `StdDevUncertainty`; the uncertainties\n    in the examples below are equivalent to the uncertainties in\n    `StdDevUncertainty`.\n\n    `VarianceUncertainty` should always be associated with an `NDData`-like\n    instance, either by creating it during initialization::\n\n        >>> from astropy.nddata import NDData, VarianceUncertainty\n        >>> ndd = NDData([1,2,3], unit='m',\n        ...              uncertainty=VarianceUncertainty([0.01, 0.01, 0.01]))\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        VarianceUncertainty([0.01, 0.01, 0.01])\n\n    or by setting it manually on the `NDData` instance::\n\n        >>> ndd.uncertainty = VarianceUncertainty([0.04], unit='m^2', copy=True)\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        VarianceUncertainty([0.04])\n\n    the uncertainty ``array`` can also be set directly::\n\n        >>> ndd.uncertainty.array = 4\n        >>> ndd.uncertainty\n        VarianceUncertainty(4)\n\n    .. note::\n        The unit will not be displayed.\n    ","endLoc":835,"id":12018,"nodeType":"Class","startLoc":752,"text":"class VarianceUncertainty(_VariancePropagationMixin, NDUncertainty):\n    \"\"\"\n    Variance uncertainty assuming first order Gaussian error\n    propagation.\n\n    This class implements uncertainty propagation for ``addition``,\n    ``subtraction``, ``multiplication`` and ``division`` with other instances\n    of `VarianceUncertainty`. The class can handle if the uncertainty has a\n    unit that differs from (but is convertible to) the parents `NDData` unit.\n    The unit of the resulting uncertainty will be the square of the unit of the\n    resulting data. Also support for correlation is possible but requires the\n    correlation as input. It cannot handle correlation determination itself.\n\n    Parameters\n    ----------\n    args, kwargs :\n        see `NDUncertainty`\n\n    Examples\n    --------\n    Compare this example to that in `StdDevUncertainty`; the uncertainties\n    in the examples below are equivalent to the uncertainties in\n    `StdDevUncertainty`.\n\n    `VarianceUncertainty` should always be associated with an `NDData`-like\n    instance, either by creating it during initialization::\n\n        >>> from astropy.nddata import NDData, VarianceUncertainty\n        >>> ndd = NDData([1,2,3], unit='m',\n        ...              uncertainty=VarianceUncertainty([0.01, 0.01, 0.01]))\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        VarianceUncertainty([0.01, 0.01, 0.01])\n\n    or by setting it manually on the `NDData` instance::\n\n        >>> ndd.uncertainty = VarianceUncertainty([0.04], unit='m^2', copy=True)\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        VarianceUncertainty([0.04])\n\n    the uncertainty ``array`` can also be set directly::\n\n        >>> ndd.uncertainty.array = 4\n        >>> ndd.uncertainty\n        VarianceUncertainty(4)\n\n    .. note::\n        The unit will not be displayed.\n    \"\"\"\n    @property\n    def uncertainty_type(self):\n        \"\"\"``\"var\"`` : `VarianceUncertainty` implements variance.\n        \"\"\"\n        return 'var'\n\n    @property\n    def supports_correlated(self):\n        \"\"\"`True` : `VarianceUncertainty` allows to propagate correlated \\\n                    uncertainties.\n\n        ``correlation`` must be given, this class does not implement computing\n        it by itself.\n        \"\"\"\n        return True\n\n    def _propagate_add(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=False)\n\n    def _propagate_subtract(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=True)\n\n    def _propagate_multiply(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=False)\n\n    def _propagate_divide(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=True)\n\n    def _data_unit_to_uncertainty_unit(self, value):\n        return value ** 2"},{"className":"IncompatibleUncertaintiesException","col":0,"comment":"This exception should be used to indicate cases in which uncertainties\n    with two different classes can not be propagated.\n    ","endLoc":22,"id":12019,"nodeType":"Class","startLoc":19,"text":"class IncompatibleUncertaintiesException(Exception):\n    \"\"\"This exception should be used to indicate cases in which uncertainties\n    with two different classes can not be propagated.\n    \"\"\""},{"col":4,"comment":"``\"var\"`` : `VarianceUncertainty` implements variance.\n        ","endLoc":804,"header":"@property\n    def uncertainty_type(self)","id":12020,"name":"uncertainty_type","nodeType":"Function","startLoc":800,"text":"@property\n    def uncertainty_type(self):\n        \"\"\"``\"var\"`` : `VarianceUncertainty` implements variance.\n        \"\"\"\n        return 'var'"},{"col":4,"comment":"null","endLoc":1642,"header":"def set_start(self, start=None)","id":12021,"name":"set_start","nodeType":"Function","startLoc":1635,"text":"def set_start(self, start=None):\n        if not start:\n            start = self.Productions[1].name\n        if start not in self.Nonterminals:\n            raise GrammarError('start symbol %s undefined' % start)\n        self.Productions[0] = Production(0, \"S'\", [start])\n        self.Nonterminals[start].append(0)\n        self.Start = start"},{"col":4,"comment":"`True` : `VarianceUncertainty` allows to propagate correlated \n                    uncertainties.\n\n        ``correlation`` must be given, this class does not implement computing\n        it by itself.\n        ","endLoc":814,"header":"@property\n    def supports_correlated(self)","id":12022,"name":"supports_correlated","nodeType":"Function","startLoc":806,"text":"@property\n    def supports_correlated(self):\n        \"\"\"`True` : `VarianceUncertainty` allows to propagate correlated \\\n                    uncertainties.\n\n        ``correlation`` must be given, this class does not implement computing\n        it by itself.\n        \"\"\"\n        return True"},{"col":4,"comment":"null","endLoc":818,"header":"def _propagate_add(self, other_uncert, result_data, correlation)","id":12023,"name":"_propagate_add","nodeType":"Function","startLoc":816,"text":"def _propagate_add(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=False)"},{"col":4,"comment":"null","endLoc":822,"header":"def _propagate_subtract(self, other_uncert, result_data, correlation)","id":12024,"name":"_propagate_subtract","nodeType":"Function","startLoc":820,"text":"def _propagate_subtract(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=True)"},{"col":4,"comment":"null","endLoc":827,"header":"def _propagate_multiply(self, other_uncert, result_data, correlation)","id":12025,"name":"_propagate_multiply","nodeType":"Function","startLoc":824,"text":"def _propagate_multiply(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=False)"},{"col":4,"comment":"null","endLoc":832,"header":"def _propagate_divide(self, other_uncert, result_data, correlation)","id":12026,"name":"_propagate_divide","nodeType":"Function","startLoc":829,"text":"def _propagate_divide(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=True)"},{"col":4,"comment":"null","endLoc":835,"header":"def _data_unit_to_uncertainty_unit(self, value)","id":12027,"name":"_data_unit_to_uncertainty_unit","nodeType":"Function","startLoc":834,"text":"def _data_unit_to_uncertainty_unit(self, value):\n        return value ** 2"},{"className":"InverseVariance","col":0,"comment":"\n    Inverse variance uncertainty assuming first order Gaussian error\n    propagation.\n\n    This class implements uncertainty propagation for ``addition``,\n    ``subtraction``, ``multiplication`` and ``division`` with other instances\n    of `InverseVariance`. The class can handle if the uncertainty has a unit\n    that differs from (but is convertible to) the parents `NDData` unit. The\n    unit of the resulting uncertainty will the inverse square of the unit of\n    the resulting data. Also support for correlation is possible but requires\n    the correlation as input. It cannot handle correlation determination\n    itself.\n\n    Parameters\n    ----------\n    args, kwargs :\n        see `NDUncertainty`\n\n    Examples\n    --------\n    Compare this example to that in `StdDevUncertainty`; the uncertainties\n    in the examples below are equivalent to the uncertainties in\n    `StdDevUncertainty`.\n\n    `InverseVariance` should always be associated with an `NDData`-like\n    instance, either by creating it during initialization::\n\n        >>> from astropy.nddata import NDData, InverseVariance\n        >>> ndd = NDData([1,2,3], unit='m',\n        ...              uncertainty=InverseVariance([100, 100, 100]))\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        InverseVariance([100, 100, 100])\n\n    or by setting it manually on the `NDData` instance::\n\n        >>> ndd.uncertainty = InverseVariance([25], unit='1/m^2', copy=True)\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        InverseVariance([25])\n\n    the uncertainty ``array`` can also be set directly::\n\n        >>> ndd.uncertainty.array = 0.25\n        >>> ndd.uncertainty\n        InverseVariance(0.25)\n\n    .. note::\n        The unit will not be displayed.\n    ","endLoc":935,"id":12028,"nodeType":"Class","startLoc":843,"text":"class InverseVariance(_VariancePropagationMixin, NDUncertainty):\n    \"\"\"\n    Inverse variance uncertainty assuming first order Gaussian error\n    propagation.\n\n    This class implements uncertainty propagation for ``addition``,\n    ``subtraction``, ``multiplication`` and ``division`` with other instances\n    of `InverseVariance`. The class can handle if the uncertainty has a unit\n    that differs from (but is convertible to) the parents `NDData` unit. The\n    unit of the resulting uncertainty will the inverse square of the unit of\n    the resulting data. Also support for correlation is possible but requires\n    the correlation as input. It cannot handle correlation determination\n    itself.\n\n    Parameters\n    ----------\n    args, kwargs :\n        see `NDUncertainty`\n\n    Examples\n    --------\n    Compare this example to that in `StdDevUncertainty`; the uncertainties\n    in the examples below are equivalent to the uncertainties in\n    `StdDevUncertainty`.\n\n    `InverseVariance` should always be associated with an `NDData`-like\n    instance, either by creating it during initialization::\n\n        >>> from astropy.nddata import NDData, InverseVariance\n        >>> ndd = NDData([1,2,3], unit='m',\n        ...              uncertainty=InverseVariance([100, 100, 100]))\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        InverseVariance([100, 100, 100])\n\n    or by setting it manually on the `NDData` instance::\n\n        >>> ndd.uncertainty = InverseVariance([25], unit='1/m^2', copy=True)\n        >>> ndd.uncertainty  # doctest: +FLOAT_CMP\n        InverseVariance([25])\n\n    the uncertainty ``array`` can also be set directly::\n\n        >>> ndd.uncertainty.array = 0.25\n        >>> ndd.uncertainty\n        InverseVariance(0.25)\n\n    .. note::\n        The unit will not be displayed.\n    \"\"\"\n    @property\n    def uncertainty_type(self):\n        \"\"\"``\"ivar\"`` : `InverseVariance` implements inverse variance.\n        \"\"\"\n        return 'ivar'\n\n    @property\n    def supports_correlated(self):\n        \"\"\"`True` : `InverseVariance` allows to propagate correlated \\\n                    uncertainties.\n\n        ``correlation`` must be given, this class does not implement computing\n        it by itself.\n        \"\"\"\n        return True\n\n    def _propagate_add(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=False,\n                                          to_variance=_inverse,\n                                          from_variance=_inverse)\n\n    def _propagate_subtract(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=True,\n                                          to_variance=_inverse,\n                                          from_variance=_inverse)\n\n    def _propagate_multiply(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=False,\n                                                  to_variance=_inverse,\n                                                  from_variance=_inverse)\n\n    def _propagate_divide(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=True,\n                                                  to_variance=_inverse,\n                                                  from_variance=_inverse)\n\n    def _data_unit_to_uncertainty_unit(self, value):\n        return 1 / value ** 2"},{"col":4,"comment":"``\"ivar\"`` : `InverseVariance` implements inverse variance.\n        ","endLoc":896,"header":"@property\n    def uncertainty_type(self)","id":12029,"name":"uncertainty_type","nodeType":"Function","startLoc":892,"text":"@property\n    def uncertainty_type(self):\n        \"\"\"``\"ivar\"`` : `InverseVariance` implements inverse variance.\n        \"\"\"\n        return 'ivar'"},{"col":4,"comment":"`True` : `InverseVariance` allows to propagate correlated \n                    uncertainties.\n\n        ``correlation`` must be given, this class does not implement computing\n        it by itself.\n        ","endLoc":906,"header":"@property\n    def supports_correlated(self)","id":12030,"name":"supports_correlated","nodeType":"Function","startLoc":898,"text":"@property\n    def supports_correlated(self):\n        \"\"\"`True` : `InverseVariance` allows to propagate correlated \\\n                    uncertainties.\n\n        ``correlation`` must be given, this class does not implement computing\n        it by itself.\n        \"\"\"\n        return True"},{"col":4,"comment":"null","endLoc":912,"header":"def _propagate_add(self, other_uncert, result_data, correlation)","id":12031,"name":"_propagate_add","nodeType":"Function","startLoc":908,"text":"def _propagate_add(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=False,\n                                          to_variance=_inverse,\n                                          from_variance=_inverse)"},{"className":"MissingDataAssociationException","col":0,"comment":"This exception should be used to indicate that an uncertainty instance\n    has not been associated with a parent `~astropy.nddata.NDData` object.\n    ","endLoc":28,"id":12032,"nodeType":"Class","startLoc":25,"text":"class MissingDataAssociationException(Exception):\n    \"\"\"This exception should be used to indicate that an uncertainty instance\n    has not been associated with a parent `~astropy.nddata.NDData` object.\n    \"\"\""},{"col":0,"comment":"Just a simple inverse for use in the InverseVariance","endLoc":840,"header":"def _inverse(x)","id":12033,"name":"_inverse","nodeType":"Function","startLoc":838,"text":"def _inverse(x):\n    \"\"\"Just a simple inverse for use in the InverseVariance\"\"\"\n    return 1 / x"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":12034,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"nduncertainty.py#<anonymous>","id":12035,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['MissingDataAssociationException',\n           'IncompatibleUncertaintiesException', 'NDUncertainty',\n           'StdDevUncertainty', 'UnknownUncertainty',\n           'VarianceUncertainty', 'InverseVariance']"},{"col":4,"comment":"null","endLoc":792,"header":"def include(self,tokens)","id":12036,"name":"include","nodeType":"Function","startLoc":751,"text":"def include(self,tokens):\n        # Try to extract the filename and then process an include file\n        if not tokens:\n            return\n        if tokens:\n            if tokens[0].value != '<' and tokens[0].type != self.t_STRING:\n                tokens = self.expand_macros(tokens)\n\n            if tokens[0].value == '<':\n                # Include <...>\n                i = 1\n                while i < len(tokens):\n                    if tokens[i].value == '>':\n                        break\n                    i += 1\n                else:\n                    print(\"Malformed #include <...>\")\n                    return\n                filename = \"\".join([x.value for x in tokens[1:i]])\n                path = self.path + [\"\"] + self.temp_path\n            elif tokens[0].type == self.t_STRING:\n                filename = tokens[0].value[1:-1]\n                path = self.temp_path + [\"\"] + self.path\n            else:\n                print(\"Malformed #include statement\")\n                return\n        for p in path:\n            iname = os.path.join(p,filename)\n            try:\n                data = open(iname,\"r\").read()\n                dname = os.path.dirname(iname)\n                if dname:\n                    self.temp_path.insert(0,dname)\n                for tok in self.parsegen(data,filename):\n                    yield tok\n                if dname:\n                    del self.temp_path[0]\n                break\n            except IOError:\n                pass\n        else:\n            print(\"Couldn't find '%s'\" % filename)"},{"col":4,"comment":"null","endLoc":918,"header":"def _propagate_subtract(self, other_uncert, result_data, correlation)","id":12037,"name":"_propagate_subtract","nodeType":"Function","startLoc":914,"text":"def _propagate_subtract(self, other_uncert, result_data, correlation):\n        return super()._propagate_add_sub(other_uncert, result_data,\n                                          correlation, subtract=True,\n                                          to_variance=_inverse,\n                                          from_variance=_inverse)"},{"col":4,"comment":"null","endLoc":925,"header":"def _propagate_multiply(self, other_uncert, result_data, correlation)","id":12038,"name":"_propagate_multiply","nodeType":"Function","startLoc":920,"text":"def _propagate_multiply(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=False,\n                                                  to_variance=_inverse,\n                                                  from_variance=_inverse)"},{"col":4,"comment":"null","endLoc":932,"header":"def _propagate_divide(self, other_uncert, result_data, correlation)","id":12039,"name":"_propagate_divide","nodeType":"Function","startLoc":927,"text":"def _propagate_divide(self, other_uncert, result_data, correlation):\n        return super()._propagate_multiply_divide(other_uncert,\n                                                  result_data, correlation,\n                                                  divide=True,\n                                                  to_variance=_inverse,\n                                                  from_variance=_inverse)"},{"col":4,"comment":"null","endLoc":935,"header":"def _data_unit_to_uncertainty_unit(self, value)","id":12040,"name":"_data_unit_to_uncertainty_unit","nodeType":"Function","startLoc":934,"text":"def _data_unit_to_uncertainty_unit(self, value):\n        return 1 / value ** 2"},{"className":"CCDData","col":0,"comment":"A class describing basic CCD data.\n\n    The CCDData class is based on the NDData object and includes a data array,\n    uncertainty frame, mask frame, flag frame, meta data, units, and WCS\n    information for a single CCD image.\n\n    Parameters\n    ----------\n    data : `~astropy.nddata.CCDData`-like or array-like\n        The actual data contained in this `~astropy.nddata.CCDData` object.\n        Note that the data will always be saved by *reference*, so you should\n        make a copy of the ``data`` before passing it in if that's the desired\n        behavior.\n\n    uncertainty : `~astropy.nddata.StdDevUncertainty`, \n            `~astropy.nddata.VarianceUncertainty`, \n            `~astropy.nddata.InverseVariance`, `numpy.ndarray` or \n            None, optional\n        Uncertainties on the data. If the uncertainty is a `numpy.ndarray`, it\n        it assumed to be, and stored as, a `~astropy.nddata.StdDevUncertainty`.\n        Default is ``None``.\n\n    mask : `numpy.ndarray` or None, optional\n        Mask for the data, given as a boolean Numpy array with a shape\n        matching that of the data. The values must be `False` where\n        the data is *valid* and `True` when it is not (like Numpy\n        masked arrays). If ``data`` is a numpy masked array, providing\n        ``mask`` here will causes the mask from the masked array to be\n        ignored.\n        Default is ``None``.\n\n    flags : `numpy.ndarray` or `~astropy.nddata.FlagCollection` or None, \n            optional\n        Flags giving information about each pixel. These can be specified\n        either as a Numpy array of any type with a shape matching that of the\n        data, or as a `~astropy.nddata.FlagCollection` instance which has a\n        shape matching that of the data.\n        Default is ``None``.\n\n    wcs : `~astropy.wcs.WCS` or None, optional\n        WCS-object containing the world coordinate system for the data.\n        Default is ``None``.\n\n    meta : dict-like object or None, optional\n        Metadata for this object. \"Metadata\" here means all information that\n        is included with this object but not part of any other attribute\n        of this particular object, e.g. creation date, unique identifier,\n        simulation parameters, exposure time, telescope name, etc.\n\n    unit : `~astropy.units.Unit` or str, optional\n        The units of the data.\n        Default is ``None``.\n\n        .. warning::\n\n            If the unit is ``None`` or not otherwise specified it will raise a\n            ``ValueError``\n\n    Raises\n    ------\n    ValueError\n        If the ``uncertainty`` or ``mask`` inputs cannot be broadcast (e.g.,\n        match shape) onto ``data``.\n\n    Methods\n    -------\n    read(\\*args, \\**kwargs)\n        ``Classmethod`` to create an CCDData instance based on a ``FITS`` file.\n        This method uses :func:`fits_ccddata_reader` with the provided\n        parameters.\n    write(\\*args, \\**kwargs)\n        Writes the contents of the CCDData instance into a new ``FITS`` file.\n        This method uses :func:`fits_ccddata_writer` with the provided\n        parameters.\n\n    Attributes\n    ----------\n    known_invalid_fits_unit_strings\n        A dictionary that maps commonly-used fits unit name strings that are\n        technically invalid to the correct valid unit type (or unit string).\n        This is primarily for variant names like \"ELECTRONS/S\" which are not\n        formally valid, but are unambiguous and frequently enough encountered\n        that it is convenient to map them to the correct unit.\n\n    Notes\n    -----\n    `~astropy.nddata.CCDData` objects can be easily converted to a regular\n     Numpy array using `numpy.asarray`.\n\n    For example::\n\n        >>> from astropy.nddata import CCDData\n        >>> import numpy as np\n        >>> x = CCDData([1,2,3], unit='adu')\n        >>> np.asarray(x)\n        array([1, 2, 3])\n\n    This is useful, for example, when plotting a 2D image using\n    matplotlib.\n\n        >>> from astropy.nddata import CCDData\n        >>> from matplotlib import pyplot as plt   # doctest: +SKIP\n        >>> x = CCDData([[1,2,3], [4,5,6]], unit='adu')\n        >>> plt.imshow(x)   # doctest: +SKIP\n\n    ","endLoc":442,"id":12041,"nodeType":"Class","startLoc":74,"text":"class CCDData(NDDataArray):\n    \"\"\"A class describing basic CCD data.\n\n    The CCDData class is based on the NDData object and includes a data array,\n    uncertainty frame, mask frame, flag frame, meta data, units, and WCS\n    information for a single CCD image.\n\n    Parameters\n    ----------\n    data : `~astropy.nddata.CCDData`-like or array-like\n        The actual data contained in this `~astropy.nddata.CCDData` object.\n        Note that the data will always be saved by *reference*, so you should\n        make a copy of the ``data`` before passing it in if that's the desired\n        behavior.\n\n    uncertainty : `~astropy.nddata.StdDevUncertainty`, \\\n            `~astropy.nddata.VarianceUncertainty`, \\\n            `~astropy.nddata.InverseVariance`, `numpy.ndarray` or \\\n            None, optional\n        Uncertainties on the data. If the uncertainty is a `numpy.ndarray`, it\n        it assumed to be, and stored as, a `~astropy.nddata.StdDevUncertainty`.\n        Default is ``None``.\n\n    mask : `numpy.ndarray` or None, optional\n        Mask for the data, given as a boolean Numpy array with a shape\n        matching that of the data. The values must be `False` where\n        the data is *valid* and `True` when it is not (like Numpy\n        masked arrays). If ``data`` is a numpy masked array, providing\n        ``mask`` here will causes the mask from the masked array to be\n        ignored.\n        Default is ``None``.\n\n    flags : `numpy.ndarray` or `~astropy.nddata.FlagCollection` or None, \\\n            optional\n        Flags giving information about each pixel. These can be specified\n        either as a Numpy array of any type with a shape matching that of the\n        data, or as a `~astropy.nddata.FlagCollection` instance which has a\n        shape matching that of the data.\n        Default is ``None``.\n\n    wcs : `~astropy.wcs.WCS` or None, optional\n        WCS-object containing the world coordinate system for the data.\n        Default is ``None``.\n\n    meta : dict-like object or None, optional\n        Metadata for this object. \"Metadata\" here means all information that\n        is included with this object but not part of any other attribute\n        of this particular object, e.g. creation date, unique identifier,\n        simulation parameters, exposure time, telescope name, etc.\n\n    unit : `~astropy.units.Unit` or str, optional\n        The units of the data.\n        Default is ``None``.\n\n        .. warning::\n\n            If the unit is ``None`` or not otherwise specified it will raise a\n            ``ValueError``\n\n    Raises\n    ------\n    ValueError\n        If the ``uncertainty`` or ``mask`` inputs cannot be broadcast (e.g.,\n        match shape) onto ``data``.\n\n    Methods\n    -------\n    read(\\\\*args, \\\\**kwargs)\n        ``Classmethod`` to create an CCDData instance based on a ``FITS`` file.\n        This method uses :func:`fits_ccddata_reader` with the provided\n        parameters.\n    write(\\\\*args, \\\\**kwargs)\n        Writes the contents of the CCDData instance into a new ``FITS`` file.\n        This method uses :func:`fits_ccddata_writer` with the provided\n        parameters.\n\n    Attributes\n    ----------\n    known_invalid_fits_unit_strings\n        A dictionary that maps commonly-used fits unit name strings that are\n        technically invalid to the correct valid unit type (or unit string).\n        This is primarily for variant names like \"ELECTRONS/S\" which are not\n        formally valid, but are unambiguous and frequently enough encountered\n        that it is convenient to map them to the correct unit.\n\n    Notes\n    -----\n    `~astropy.nddata.CCDData` objects can be easily converted to a regular\n     Numpy array using `numpy.asarray`.\n\n    For example::\n\n        >>> from astropy.nddata import CCDData\n        >>> import numpy as np\n        >>> x = CCDData([1,2,3], unit='adu')\n        >>> np.asarray(x)\n        array([1, 2, 3])\n\n    This is useful, for example, when plotting a 2D image using\n    matplotlib.\n\n        >>> from astropy.nddata import CCDData\n        >>> from matplotlib import pyplot as plt   # doctest: +SKIP\n        >>> x = CCDData([[1,2,3], [4,5,6]], unit='adu')\n        >>> plt.imshow(x)   # doctest: +SKIP\n\n    \"\"\"\n\n    def __init__(self, *args, **kwd):\n        if 'meta' not in kwd:\n            kwd['meta'] = kwd.pop('header', None)\n        if 'header' in kwd:\n            raise ValueError(\"can't have both header and meta.\")\n\n        super().__init__(*args, **kwd)\n        if self._wcs is not None:\n            llwcs = self._wcs.low_level_wcs\n            if not isinstance(llwcs, WCS):\n                raise TypeError(\"the wcs must be a WCS instance.\")\n            self._wcs = llwcs\n\n        # Check if a unit is set. This can be temporarily disabled by the\n        # _CCDDataUnit contextmanager.\n        if _config_ccd_requires_unit and self.unit is None:\n            raise ValueError(\"a unit for CCDData must be specified.\")\n\n    def _slice_wcs(self, item):\n        \"\"\"\n        Override the WCS slicing behaviour so that the wcs attribute continues\n        to be an `astropy.wcs.WCS`.\n        \"\"\"\n        if self.wcs is None:\n            return None\n\n        try:\n            return self.wcs[item]\n        except Exception as err:\n            self._handle_wcs_slicing_error(err, item)\n\n    @property\n    def data(self):\n        return self._data\n\n    @data.setter\n    def data(self, value):\n        self._data = value\n\n    @property\n    def wcs(self):\n        return self._wcs\n\n    @wcs.setter\n    def wcs(self, value):\n        if value is not None and not isinstance(value, WCS):\n            raise TypeError(\"the wcs must be a WCS instance.\")\n        self._wcs = value\n\n    @property\n    def unit(self):\n        return self._unit\n\n    @unit.setter\n    def unit(self, value):\n        self._unit = u.Unit(value)\n\n    @property\n    def header(self):\n        return self._meta\n\n    @header.setter\n    def header(self, value):\n        self.meta = value\n\n    @property\n    def uncertainty(self):\n        return self._uncertainty\n\n    @uncertainty.setter\n    def uncertainty(self, value):\n        if value is not None:\n            if isinstance(value, NDUncertainty):\n                if getattr(value, '_parent_nddata', None) is not None:\n                    value = value.__class__(value, copy=False)\n                self._uncertainty = value\n            elif isinstance(value, np.ndarray):\n                if value.shape != self.shape:\n                    raise ValueError(\"uncertainty must have same shape as \"\n                                     \"data.\")\n                self._uncertainty = StdDevUncertainty(value)\n                log.info(\"array provided for uncertainty; assuming it is a \"\n                         \"StdDevUncertainty.\")\n            else:\n                raise TypeError(\"uncertainty must be an instance of a \"\n                                \"NDUncertainty object or a numpy array.\")\n            self._uncertainty.parent_nddata = self\n        else:\n            self._uncertainty = value\n\n    def to_hdu(self, hdu_mask='MASK', hdu_uncertainty='UNCERT',\n               hdu_flags=None, wcs_relax=True, key_uncertainty_type='UTYPE'):\n        \"\"\"Creates an HDUList object from a CCDData object.\n\n        Parameters\n        ----------\n        hdu_mask, hdu_uncertainty, hdu_flags : str or None, optional\n            If it is a string append this attribute to the HDUList as\n            `~astropy.io.fits.ImageHDU` with the string as extension name.\n            Flags are not supported at this time. If ``None`` this attribute\n            is not appended.\n            Default is ``'MASK'`` for mask, ``'UNCERT'`` for uncertainty and\n            ``None`` for flags.\n\n        wcs_relax : bool\n            Value of the ``relax`` parameter to use in converting the WCS to a\n            FITS header using `~astropy.wcs.WCS.to_header`. The common\n            ``CTYPE`` ``RA---TAN-SIP`` and ``DEC--TAN-SIP`` requires\n            ``relax=True`` for the ``-SIP`` part of the ``CTYPE`` to be\n            preserved.\n\n        key_uncertainty_type : str, optional\n            The header key name for the class name of the uncertainty (if any)\n            that is used to store the uncertainty type in the uncertainty hdu.\n            Default is ``UTYPE``.\n\n            .. versionadded:: 3.1\n\n        Raises\n        ------\n        ValueError\n            - If ``self.mask`` is set but not a `numpy.ndarray`.\n            - If ``self.uncertainty`` is set but not a astropy uncertainty type.\n            - If ``self.uncertainty`` is set but has another unit then\n              ``self.data``.\n\n        NotImplementedError\n            Saving flags is not supported.\n\n        Returns\n        -------\n        hdulist : `~astropy.io.fits.HDUList`\n        \"\"\"\n        if isinstance(self.header, fits.Header):\n            # Copy here so that we can modify the HDU header by adding WCS\n            # information without changing the header of the CCDData object.\n            header = self.header.copy()\n        else:\n            # Because _insert_in_metadata_fits_safe is written as a method\n            # we need to create a dummy CCDData instance to hold the FITS\n            # header we are constructing. This probably indicates that\n            # _insert_in_metadata_fits_safe should be rewritten in a more\n            # sensible way...\n            dummy_ccd = CCDData([1], meta=fits.Header(), unit=\"adu\")\n            for k, v in self.header.items():\n                dummy_ccd._insert_in_metadata_fits_safe(k, v)\n            header = dummy_ccd.header\n        if self.unit is not u.dimensionless_unscaled:\n            header['bunit'] = self.unit.to_string()\n        if self.wcs:\n            # Simply extending the FITS header with the WCS can lead to\n            # duplicates of the WCS keywords; iterating over the WCS\n            # header should be safer.\n            #\n            # Turns out if I had read the io.fits.Header.extend docs more\n            # carefully, I would have realized that the keywords exist to\n            # avoid duplicates and preserve, as much as possible, the\n            # structure of the commentary cards.\n            #\n            # Note that until astropy/astropy#3967 is closed, the extend\n            # will fail if there are comment cards in the WCS header but\n            # not header.\n            wcs_header = self.wcs.to_header(relax=wcs_relax)\n            header.extend(wcs_header, useblanks=False, update=True)\n        hdus = [fits.PrimaryHDU(self.data, header)]\n\n        if hdu_mask and self.mask is not None:\n            # Always assuming that the mask is a np.ndarray (check that it has\n            # a 'shape').\n            if not hasattr(self.mask, 'shape'):\n                raise ValueError('only a numpy.ndarray mask can be saved.')\n\n            # Convert boolean mask to uint since io.fits cannot handle bool.\n            hduMask = fits.ImageHDU(self.mask.astype(np.uint8), name=hdu_mask)\n            hdus.append(hduMask)\n\n        if hdu_uncertainty and self.uncertainty is not None:\n            # We need to save some kind of information which uncertainty was\n            # used so that loading the HDUList can infer the uncertainty type.\n            # No idea how this can be done so only allow StdDevUncertainty.\n            uncertainty_cls = self.uncertainty.__class__\n            if uncertainty_cls not in _known_uncertainties:\n                raise ValueError('only uncertainties of type {} can be saved.'\n                                 .format(_known_uncertainties))\n            uncertainty_name = _unc_cls_to_name[uncertainty_cls]\n\n            hdr_uncertainty = fits.Header()\n            hdr_uncertainty[key_uncertainty_type] = uncertainty_name\n\n            # Assuming uncertainty is an StdDevUncertainty save just the array\n            # this might be problematic if the Uncertainty has a unit differing\n            # from the data so abort for different units. This is important for\n            # astropy > 1.2\n            if (hasattr(self.uncertainty, 'unit') and\n                    self.uncertainty.unit is not None):\n                if not _uncertainty_unit_equivalent_to_parent(\n                        uncertainty_cls, self.uncertainty.unit, self.unit):\n                    raise ValueError(\n                        'saving uncertainties with a unit that is not '\n                        'equivalent to the unit from the data unit is not '\n                        'supported.')\n\n            hduUncert = fits.ImageHDU(self.uncertainty.array, hdr_uncertainty,\n                                      name=hdu_uncertainty)\n            hdus.append(hduUncert)\n\n        if hdu_flags and self.flags:\n            raise NotImplementedError('adding the flags to a HDU is not '\n                                      'supported at this time.')\n\n        hdulist = fits.HDUList(hdus)\n\n        return hdulist\n\n    def copy(self):\n        \"\"\"\n        Return a copy of the CCDData object.\n        \"\"\"\n        return self.__class__(self, copy=True)\n\n    add = _arithmetic(np.add)(NDDataArray.add)\n    subtract = _arithmetic(np.subtract)(NDDataArray.subtract)\n    multiply = _arithmetic(np.multiply)(NDDataArray.multiply)\n    divide = _arithmetic(np.true_divide)(NDDataArray.divide)\n\n    def _insert_in_metadata_fits_safe(self, key, value):\n        \"\"\"\n        Insert key/value pair into metadata in a way that FITS can serialize.\n\n        Parameters\n        ----------\n        key : str\n            Key to be inserted in dictionary.\n\n        value : str or None\n            Value to be inserted.\n\n        Notes\n        -----\n        This addresses a shortcoming of the FITS standard. There are length\n        restrictions on both the ``key`` (8 characters) and ``value`` (72\n        characters) in the FITS standard. There is a convention for handling\n        long keywords and a convention for handling long values, but the\n        two conventions cannot be used at the same time.\n\n        This addresses that case by checking the length of the ``key`` and\n        ``value`` and, if necessary, shortening the key.\n        \"\"\"\n\n        if len(key) > 8 and len(value) > 72:\n            short_name = key[:8]\n            self.meta[f'HIERARCH {key.upper()}'] = (\n                short_name, f\"Shortened name for {key}\")\n            self.meta[short_name] = value\n        else:\n            self.meta[key] = value\n\n    # A dictionary mapping \"known\" invalid fits unit\n    known_invalid_fits_unit_strings = {'ELECTRONS/S': u.electron/u.s,\n                                       'ELECTRONS': u.electron,\n                                       'electrons': u.electron}"},{"col":4,"comment":"null","endLoc":1664,"header":"def find_unreachable(self)","id":12042,"name":"find_unreachable","nodeType":"Function","startLoc":1651,"text":"def find_unreachable(self):\n\n        # Mark all symbols that are reachable from a symbol s\n        def mark_reachable_from(s):\n            if s in reachable:\n                return\n            reachable.add(s)\n            for p in self.Prodnames.get(s, []):\n                for r in p.prod:\n                    mark_reachable_from(r)\n\n        reachable = set()\n        mark_reachable_from(self.Productions[0].prod[0])\n        return [s for s in self.Nonterminals if s not in reachable]"},{"col":4,"comment":"null","endLoc":875,"header":"def undef(self,tokens)","id":12043,"name":"undef","nodeType":"Function","startLoc":870,"text":"def undef(self,tokens):\n        id = tokens[0].value\n        try:\n            del self.macros[id]\n        except LookupError:\n            pass"},{"col":4,"comment":"null","endLoc":1729,"header":"def infinite_cycles(self)","id":12045,"name":"infinite_cycles","nodeType":"Function","startLoc":1674,"text":"def infinite_cycles(self):\n        terminates = {}\n\n        # Terminals:\n        for t in self.Terminals:\n            terminates[t] = True\n\n        terminates['$end'] = True\n\n        # Nonterminals:\n\n        # Initialize to false:\n        for n in self.Nonterminals:\n            terminates[n] = False\n\n        # Then propagate termination until no change:\n        while True:\n            some_change = False\n            for (n, pl) in self.Prodnames.items():\n                # Nonterminal n terminates iff any of its productions terminates.\n                for p in pl:\n                    # Production p terminates iff all of its rhs symbols terminate.\n                    for s in p.prod:\n                        if not terminates[s]:\n                            # The symbol s does not terminate,\n                            # so production p does not terminate.\n                            p_terminates = False\n                            break\n                    else:\n                        # didn't break from the loop,\n                        # so every symbol s terminates\n                        # so production p terminates.\n                        p_terminates = True\n\n                    if p_terminates:\n                        # symbol n terminates!\n                        if not terminates[n]:\n                            terminates[n] = True\n                            some_change = True\n                        # Don't need to consider any more productions for this n.\n                        break\n\n            if not some_change:\n                break\n\n        infinite = []\n        for (s, term) in terminates.items():\n            if not term:\n                if s not in self.Prodnames and s not in self.Terminals and s != 'error':\n                    # s is used-but-not-defined, and we've already warned of that,\n                    # so it would be overkill to say that it's also non-terminating.\n                    pass\n                else:\n                    infinite.append(s)\n\n        return infinite"},{"col":4,"comment":"null","endLoc":198,"header":"def __init__(self, *args, **kwd)","id":12046,"name":"__init__","nodeType":"Function","startLoc":182,"text":"def __init__(self, *args, **kwd):\n        if 'meta' not in kwd:\n            kwd['meta'] = kwd.pop('header', None)\n        if 'header' in kwd:\n            raise ValueError(\"can't have both header and meta.\")\n\n        super().__init__(*args, **kwd)\n        if self._wcs is not None:\n            llwcs = self._wcs.low_level_wcs\n            if not isinstance(llwcs, WCS):\n                raise TypeError(\"the wcs must be a WCS instance.\")\n            self._wcs = llwcs\n\n        # Check if a unit is set. This can be temporarily disabled by the\n        # _CCDDataUnit contextmanager.\n        if _config_ccd_requires_unit and self.unit is None:\n            raise ValueError(\"a unit for CCDData must be specified.\")"},{"col":4,"comment":"null","endLoc":1747,"header":"def undefined_symbols(self)","id":12047,"name":"undefined_symbols","nodeType":"Function","startLoc":1738,"text":"def undefined_symbols(self):\n        result = []\n        for p in self.Productions:\n            if not p:\n                continue\n\n            for s in p.prod:\n                if s not in self.Prodnames and s not in self.Terminals and s != 'error':\n                    result.append((s, p))\n        return result"},{"col":4,"comment":"\n        Override the WCS slicing behaviour so that the wcs attribute continues\n        to be an `astropy.wcs.WCS`.\n        ","endLoc":211,"header":"def _slice_wcs(self, item)","id":12048,"name":"_slice_wcs","nodeType":"Function","startLoc":200,"text":"def _slice_wcs(self, item):\n        \"\"\"\n        Override the WCS slicing behaviour so that the wcs attribute continues\n        to be an `astropy.wcs.WCS`.\n        \"\"\"\n        if self.wcs is None:\n            return None\n\n        try:\n            return self.wcs[item]\n        except Exception as err:\n            self._handle_wcs_slicing_error(err, item)"},{"col":4,"comment":"null","endLoc":1761,"header":"def unused_terminals(self)","id":12049,"name":"unused_terminals","nodeType":"Function","startLoc":1755,"text":"def unused_terminals(self):\n        unused_tok = []\n        for s, v in self.Terminals.items():\n            if s != 'error' and not v:\n                unused_tok.append(s)\n\n        return unused_tok"},{"col":4,"comment":"null","endLoc":1776,"header":"def unused_rules(self)","id":12050,"name":"unused_rules","nodeType":"Function","startLoc":1770,"text":"def unused_rules(self):\n        unused_prod = []\n        for s, v in self.Nonterminals.items():\n            if not v:\n                p = self.Prodnames[s][0]\n                unused_prod.append(p)\n        return unused_prod"},{"col":4,"comment":"null","endLoc":1793,"header":"def unused_precedence(self)","id":12051,"name":"unused_precedence","nodeType":"Function","startLoc":1787,"text":"def unused_precedence(self):\n        unused = []\n        for termname in self.Precedence:\n            if not (termname in self.Terminals or termname in self.UsedPrecedence):\n                unused.append((termname, self.Precedence[termname][0]))\n\n        return unused"},{"col":4,"comment":"null","endLoc":215,"header":"@property\n    def data(self)","id":12052,"name":"data","nodeType":"Function","startLoc":213,"text":"@property\n    def data(self):\n        return self._data"},{"col":4,"comment":"null","endLoc":219,"header":"@data.setter\n    def data(self, value)","id":12053,"name":"data","nodeType":"Function","startLoc":217,"text":"@data.setter\n    def data(self, value):\n        self._data = value"},{"col":4,"comment":"null","endLoc":223,"header":"@property\n    def wcs(self)","id":12054,"name":"wcs","nodeType":"Function","startLoc":221,"text":"@property\n    def wcs(self):\n        return self._wcs"},{"col":4,"comment":"null","endLoc":229,"header":"@wcs.setter\n    def wcs(self, value)","id":12055,"name":"wcs","nodeType":"Function","startLoc":225,"text":"@wcs.setter\n    def wcs(self, value):\n        if value is not None and not isinstance(value, WCS):\n            raise TypeError(\"the wcs must be a WCS instance.\")\n        self._wcs = value"},{"col":4,"comment":"null","endLoc":1831,"header":"def _first(self, beta)","id":12056,"name":"_first","nodeType":"Function","startLoc":1803,"text":"def _first(self, beta):\n\n        # We are computing First(x1,x2,x3,...,xn)\n        result = []\n        for x in beta:\n            x_produces_empty = False\n\n            # Add all the non-<empty> symbols of First[x] to the result.\n            for f in self.First[x]:\n                if f == '<empty>':\n                    x_produces_empty = True\n                else:\n                    if f not in result:\n                        result.append(f)\n\n            if x_produces_empty:\n                # We have to consider the next x in beta,\n                # i.e. stay in the loop.\n                pass\n            else:\n                # We don't have to consider any further symbols in beta.\n                break\n        else:\n            # There was no 'break' from the loop,\n            # so x_produces_empty was true for all x in beta,\n            # so beta produces empty as well.\n            result.append('<empty>')\n\n        return result"},{"col":4,"comment":"null","endLoc":233,"header":"@property\n    def unit(self)","id":12057,"name":"unit","nodeType":"Function","startLoc":231,"text":"@property\n    def unit(self):\n        return self._unit"},{"col":4,"comment":"null","endLoc":237,"header":"@unit.setter\n    def unit(self, value)","id":12058,"name":"unit","nodeType":"Function","startLoc":235,"text":"@unit.setter\n    def unit(self, value):\n        self._unit = u.Unit(value)"},{"col":4,"comment":"null","endLoc":241,"header":"@property\n    def header(self)","id":12059,"name":"header","nodeType":"Function","startLoc":239,"text":"@property\n    def header(self):\n        return self._meta"},{"col":4,"comment":"null","endLoc":245,"header":"@header.setter\n    def header(self, value)","id":12060,"name":"header","nodeType":"Function","startLoc":243,"text":"@header.setter\n    def header(self, value):\n        self.meta = value"},{"col":4,"comment":"null","endLoc":249,"header":"@property\n    def uncertainty(self)","id":12061,"name":"uncertainty","nodeType":"Function","startLoc":247,"text":"@property\n    def uncertainty(self):\n        return self._uncertainty"},{"col":4,"comment":"null","endLoc":270,"header":"@uncertainty.setter\n    def uncertainty(self, value)","id":12062,"name":"uncertainty","nodeType":"Function","startLoc":251,"text":"@uncertainty.setter\n    def uncertainty(self, value):\n        if value is not None:\n            if isinstance(value, NDUncertainty):\n                if getattr(value, '_parent_nddata', None) is not None:\n                    value = value.__class__(value, copy=False)\n                self._uncertainty = value\n            elif isinstance(value, np.ndarray):\n                if value.shape != self.shape:\n                    raise ValueError(\"uncertainty must have same shape as \"\n                                     \"data.\")\n                self._uncertainty = StdDevUncertainty(value)\n                log.info(\"array provided for uncertainty; assuming it is a \"\n                         \"StdDevUncertainty.\")\n            else:\n                raise TypeError(\"uncertainty must be an instance of a \"\n                                \"NDUncertainty object or a numpy array.\")\n            self._uncertainty.parent_nddata = self\n        else:\n            self._uncertainty = value"},{"fileName":"nddata_withmixins.py","filePath":"astropy/nddata","id":12063,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module implements a class based on NDData with all Mixins.\n\"\"\"\n\n\nfrom .nddata import NDData\n\nfrom .mixins.ndslicing import NDSlicingMixin\nfrom .mixins.ndarithmetic import NDArithmeticMixin\nfrom .mixins.ndio import NDIOMixin\n\n__all__ = ['NDDataRef']\n\n\nclass NDDataRef(NDArithmeticMixin, NDIOMixin, NDSlicingMixin, NDData):\n    \"\"\"Implements `NDData` with all Mixins.\n\n    This class implements a `NDData`-like container that supports reading and\n    writing as implemented in the ``astropy.io.registry`` and also slicing\n    (indexing) and simple arithmetics (add, subtract, divide and multiply).\n\n    Notes\n    -----\n    A key distinction from `NDDataArray` is that this class does not attempt\n    to provide anything that was not defined in any of the parent classes.\n\n    See also\n    --------\n    NDData\n    NDArithmeticMixin\n    NDSlicingMixin\n    NDIOMixin\n\n    Examples\n    --------\n    The mixins allow operation that are not possible with `NDData` or\n    `NDDataBase`, i.e. simple arithmetics::\n\n        >>> from astropy.nddata import NDDataRef, StdDevUncertainty\n        >>> import numpy as np\n\n        >>> data = np.ones((3,3), dtype=float)\n        >>> ndd1 = NDDataRef(data, uncertainty=StdDevUncertainty(data))\n        >>> ndd2 = NDDataRef(data, uncertainty=StdDevUncertainty(data))\n\n        >>> ndd3 = ndd1.add(ndd2)\n        >>> ndd3.data  # doctest: +FLOAT_CMP\n        array([[2., 2., 2.],\n               [2., 2., 2.],\n               [2., 2., 2.]])\n        >>> ndd3.uncertainty.array  # doctest: +FLOAT_CMP\n        array([[1.41421356, 1.41421356, 1.41421356],\n               [1.41421356, 1.41421356, 1.41421356],\n               [1.41421356, 1.41421356, 1.41421356]])\n\n    see `NDArithmeticMixin` for a complete list of all supported arithmetic\n    operations.\n\n    But also slicing (indexing) is possible::\n\n        >>> ndd4 = ndd3[1,:]\n        >>> ndd4.data  # doctest: +FLOAT_CMP\n        array([2., 2., 2.])\n        >>> ndd4.uncertainty.array  # doctest: +FLOAT_CMP\n        array([1.41421356, 1.41421356, 1.41421356])\n\n    See `NDSlicingMixin` for a description how slicing works (which attributes)\n    are sliced.\n    \"\"\"\n    pass\n"},{"className":"NDDataRef","col":0,"comment":"Implements `NDData` with all Mixins.\n\n    This class implements a `NDData`-like container that supports reading and\n    writing as implemented in the ``astropy.io.registry`` and also slicing\n    (indexing) and simple arithmetics (add, subtract, divide and multiply).\n\n    Notes\n    -----\n    A key distinction from `NDDataArray` is that this class does not attempt\n    to provide anything that was not defined in any of the parent classes.\n\n    See also\n    --------\n    NDData\n    NDArithmeticMixin\n    NDSlicingMixin\n    NDIOMixin\n\n    Examples\n    --------\n    The mixins allow operation that are not possible with `NDData` or\n    `NDDataBase`, i.e. simple arithmetics::\n\n        >>> from astropy.nddata import NDDataRef, StdDevUncertainty\n        >>> import numpy as np\n\n        >>> data = np.ones((3,3), dtype=float)\n        >>> ndd1 = NDDataRef(data, uncertainty=StdDevUncertainty(data))\n        >>> ndd2 = NDDataRef(data, uncertainty=StdDevUncertainty(data))\n\n        >>> ndd3 = ndd1.add(ndd2)\n        >>> ndd3.data  # doctest: +FLOAT_CMP\n        array([[2., 2., 2.],\n               [2., 2., 2.],\n               [2., 2., 2.]])\n        >>> ndd3.uncertainty.array  # doctest: +FLOAT_CMP\n        array([[1.41421356, 1.41421356, 1.41421356],\n               [1.41421356, 1.41421356, 1.41421356],\n               [1.41421356, 1.41421356, 1.41421356]])\n\n    see `NDArithmeticMixin` for a complete list of all supported arithmetic\n    operations.\n\n    But also slicing (indexing) is possible::\n\n        >>> ndd4 = ndd3[1,:]\n        >>> ndd4.data  # doctest: +FLOAT_CMP\n        array([2., 2., 2.])\n        >>> ndd4.uncertainty.array  # doctest: +FLOAT_CMP\n        array([1.41421356, 1.41421356, 1.41421356])\n\n    See `NDSlicingMixin` for a description how slicing works (which attributes)\n    are sliced.\n    ","endLoc":72,"id":12064,"nodeType":"Class","startLoc":17,"text":"class NDDataRef(NDArithmeticMixin, NDIOMixin, NDSlicingMixin, NDData):\n    \"\"\"Implements `NDData` with all Mixins.\n\n    This class implements a `NDData`-like container that supports reading and\n    writing as implemented in the ``astropy.io.registry`` and also slicing\n    (indexing) and simple arithmetics (add, subtract, divide and multiply).\n\n    Notes\n    -----\n    A key distinction from `NDDataArray` is that this class does not attempt\n    to provide anything that was not defined in any of the parent classes.\n\n    See also\n    --------\n    NDData\n    NDArithmeticMixin\n    NDSlicingMixin\n    NDIOMixin\n\n    Examples\n    --------\n    The mixins allow operation that are not possible with `NDData` or\n    `NDDataBase`, i.e. simple arithmetics::\n\n        >>> from astropy.nddata import NDDataRef, StdDevUncertainty\n        >>> import numpy as np\n\n        >>> data = np.ones((3,3), dtype=float)\n        >>> ndd1 = NDDataRef(data, uncertainty=StdDevUncertainty(data))\n        >>> ndd2 = NDDataRef(data, uncertainty=StdDevUncertainty(data))\n\n        >>> ndd3 = ndd1.add(ndd2)\n        >>> ndd3.data  # doctest: +FLOAT_CMP\n        array([[2., 2., 2.],\n               [2., 2., 2.],\n               [2., 2., 2.]])\n        >>> ndd3.uncertainty.array  # doctest: +FLOAT_CMP\n        array([[1.41421356, 1.41421356, 1.41421356],\n               [1.41421356, 1.41421356, 1.41421356],\n               [1.41421356, 1.41421356, 1.41421356]])\n\n    see `NDArithmeticMixin` for a complete list of all supported arithmetic\n    operations.\n\n    But also slicing (indexing) is possible::\n\n        >>> ndd4 = ndd3[1,:]\n        >>> ndd4.data  # doctest: +FLOAT_CMP\n        array([2., 2., 2.])\n        >>> ndd4.uncertainty.array  # doctest: +FLOAT_CMP\n        array([1.41421356, 1.41421356, 1.41421356])\n\n    See `NDSlicingMixin` for a description how slicing works (which attributes)\n    are sliced.\n    \"\"\"\n    pass"},{"col":0,"comment":"Just checks a few attributes to make sure wcs instances seem to be\n    equal.\n    ","endLoc":24,"header":"def assert_wcs_seem_equal(wcs1, wcs2)","id":12065,"name":"assert_wcs_seem_equal","nodeType":"Function","startLoc":8,"text":"def assert_wcs_seem_equal(wcs1, wcs2):\n    \"\"\"Just checks a few attributes to make sure wcs instances seem to be\n    equal.\n    \"\"\"\n    if wcs1 is None and wcs2 is None:\n        return\n    assert wcs1 is not None\n    assert wcs2 is not None\n    if isinstance(wcs1, BaseHighLevelWCS):\n        wcs1 = wcs1.low_level_wcs\n    if isinstance(wcs2, BaseHighLevelWCS):\n        wcs2 = wcs2.low_level_wcs\n    assert isinstance(wcs1, WCS)\n    assert isinstance(wcs2, WCS)\n    if wcs1 is wcs2:\n        return\n    assert wcs1.wcs.compare(wcs2.wcs)"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":12066,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"nddata_withmixins.py#<anonymous>","id":12067,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module implements a class based on NDData with all Mixins.\n\"\"\"\n\n__all__ = ['NDDataRef']"},{"id":12068,"name":"examples","nodeType":"Package"},{"id":12069,"name":"README.rst","nodeType":"TextFile","path":"examples","text":".. _example-gallery:\n\nExample gallery\n===============\n\nThis gallery of examples shows a variety of relatively small snippets or\nexamples of tasks that can be done with the Astropy core package.\nContributions from the community are encouraged!\n\nLonger-form tutorials (or tutorials for\n`affiliated packages <http://affiliated.astropy.org>`_) belong at\nhttps://learn.astropy.org (and can be submitted at\n`the associated github repository <https://github.com/astropy/astropy-tutorials>`_).\n"},{"id":12070,"name":"astropy/nddata/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/nddata/tests","id":12071,"nodeType":"File","text":""},{"id":12072,"name":"licenses","nodeType":"Package"},{"id":12073,"name":"PYFITS.rst","nodeType":"TextFile","path":"licenses","text":"Copyright (C) 2014 Association of Universities for Research in Astronomy (AURA)\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n    1. Redistributions of source code must retain the above copyright\n       notice, this list of conditions and the following disclaimer.\n\n    2. Redistributions in binary form must reproduce the above\n       copyright notice, this list of conditions and the following\n       disclaimer in the documentation and/or other materials provided\n       with the distribution.\n\n    3. The name of AURA and its representatives may not be used to\n       endorse or promote products derived from this software without\n       specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY AURA ``AS IS'' AND ANY EXPRESS OR IMPLIED\nWARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL AURA BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\nBUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS\nOF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR\nTORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE\nUSE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGE.\n\n"},{"id":12074,"name":"NUMPY_LICENSE.rst","nodeType":"TextFile","path":"licenses","text":"Copyright (c) 2005-2011, NumPy Developers.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n    * Redistributions of source code must retain the above copyright\n       notice, this list of conditions and the following disclaimer.\n\n    * Redistributions in binary form must reproduce the above\n       copyright notice, this list of conditions and the following\n       disclaimer in the documentation and/or other materials provided\n       with the distribution.\n\n    * Neither the name of the NumPy Developers nor the names of any\n       contributors may be used to endorse or promote products derived\n       from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"},{"col":4,"comment":"Creates an HDUList object from a CCDData object.\n\n        Parameters\n        ----------\n        hdu_mask, hdu_uncertainty, hdu_flags : str or None, optional\n            If it is a string append this attribute to the HDUList as\n            `~astropy.io.fits.ImageHDU` with the string as extension name.\n            Flags are not supported at this time. If ``None`` this attribute\n            is not appended.\n            Default is ``'MASK'`` for mask, ``'UNCERT'`` for uncertainty and\n            ``None`` for flags.\n\n        wcs_relax : bool\n            Value of the ``relax`` parameter to use in converting the WCS to a\n            FITS header using `~astropy.wcs.WCS.to_header`. The common\n            ``CTYPE`` ``RA---TAN-SIP`` and ``DEC--TAN-SIP`` requires\n            ``relax=True`` for the ``-SIP`` part of the ``CTYPE`` to be\n            preserved.\n\n        key_uncertainty_type : str, optional\n            The header key name for the class name of the uncertainty (if any)\n            that is used to store the uncertainty type in the uncertainty hdu.\n            Default is ``UTYPE``.\n\n            .. versionadded:: 3.1\n\n        Raises\n        ------\n        ValueError\n            - If ``self.mask`` is set but not a `numpy.ndarray`.\n            - If ``self.uncertainty`` is set but not a astropy uncertainty type.\n            - If ``self.uncertainty`` is set but has another unit then\n              ``self.data``.\n\n        NotImplementedError\n            Saving flags is not supported.\n\n        Returns\n        -------\n        hdulist : `~astropy.io.fits.HDUList`\n        ","endLoc":394,"header":"def to_hdu(self, hdu_mask='MASK', hdu_uncertainty='UNCERT',\n               hdu_flags=None, wcs_relax=True, key_uncertainty_type='UTYPE')","id":12075,"name":"to_hdu","nodeType":"Function","startLoc":272,"text":"def to_hdu(self, hdu_mask='MASK', hdu_uncertainty='UNCERT',\n               hdu_flags=None, wcs_relax=True, key_uncertainty_type='UTYPE'):\n        \"\"\"Creates an HDUList object from a CCDData object.\n\n        Parameters\n        ----------\n        hdu_mask, hdu_uncertainty, hdu_flags : str or None, optional\n            If it is a string append this attribute to the HDUList as\n            `~astropy.io.fits.ImageHDU` with the string as extension name.\n            Flags are not supported at this time. If ``None`` this attribute\n            is not appended.\n            Default is ``'MASK'`` for mask, ``'UNCERT'`` for uncertainty and\n            ``None`` for flags.\n\n        wcs_relax : bool\n            Value of the ``relax`` parameter to use in converting the WCS to a\n            FITS header using `~astropy.wcs.WCS.to_header`. The common\n            ``CTYPE`` ``RA---TAN-SIP`` and ``DEC--TAN-SIP`` requires\n            ``relax=True`` for the ``-SIP`` part of the ``CTYPE`` to be\n            preserved.\n\n        key_uncertainty_type : str, optional\n            The header key name for the class name of the uncertainty (if any)\n            that is used to store the uncertainty type in the uncertainty hdu.\n            Default is ``UTYPE``.\n\n            .. versionadded:: 3.1\n\n        Raises\n        ------\n        ValueError\n            - If ``self.mask`` is set but not a `numpy.ndarray`.\n            - If ``self.uncertainty`` is set but not a astropy uncertainty type.\n            - If ``self.uncertainty`` is set but has another unit then\n              ``self.data``.\n\n        NotImplementedError\n            Saving flags is not supported.\n\n        Returns\n        -------\n        hdulist : `~astropy.io.fits.HDUList`\n        \"\"\"\n        if isinstance(self.header, fits.Header):\n            # Copy here so that we can modify the HDU header by adding WCS\n            # information without changing the header of the CCDData object.\n            header = self.header.copy()\n        else:\n            # Because _insert_in_metadata_fits_safe is written as a method\n            # we need to create a dummy CCDData instance to hold the FITS\n            # header we are constructing. This probably indicates that\n            # _insert_in_metadata_fits_safe should be rewritten in a more\n            # sensible way...\n            dummy_ccd = CCDData([1], meta=fits.Header(), unit=\"adu\")\n            for k, v in self.header.items():\n                dummy_ccd._insert_in_metadata_fits_safe(k, v)\n            header = dummy_ccd.header\n        if self.unit is not u.dimensionless_unscaled:\n            header['bunit'] = self.unit.to_string()\n        if self.wcs:\n            # Simply extending the FITS header with the WCS can lead to\n            # duplicates of the WCS keywords; iterating over the WCS\n            # header should be safer.\n            #\n            # Turns out if I had read the io.fits.Header.extend docs more\n            # carefully, I would have realized that the keywords exist to\n            # avoid duplicates and preserve, as much as possible, the\n            # structure of the commentary cards.\n            #\n            # Note that until astropy/astropy#3967 is closed, the extend\n            # will fail if there are comment cards in the WCS header but\n            # not header.\n            wcs_header = self.wcs.to_header(relax=wcs_relax)\n            header.extend(wcs_header, useblanks=False, update=True)\n        hdus = [fits.PrimaryHDU(self.data, header)]\n\n        if hdu_mask and self.mask is not None:\n            # Always assuming that the mask is a np.ndarray (check that it has\n            # a 'shape').\n            if not hasattr(self.mask, 'shape'):\n                raise ValueError('only a numpy.ndarray mask can be saved.')\n\n            # Convert boolean mask to uint since io.fits cannot handle bool.\n            hduMask = fits.ImageHDU(self.mask.astype(np.uint8), name=hdu_mask)\n            hdus.append(hduMask)\n\n        if hdu_uncertainty and self.uncertainty is not None:\n            # We need to save some kind of information which uncertainty was\n            # used so that loading the HDUList can infer the uncertainty type.\n            # No idea how this can be done so only allow StdDevUncertainty.\n            uncertainty_cls = self.uncertainty.__class__\n            if uncertainty_cls not in _known_uncertainties:\n                raise ValueError('only uncertainties of type {} can be saved.'\n                                 .format(_known_uncertainties))\n            uncertainty_name = _unc_cls_to_name[uncertainty_cls]\n\n            hdr_uncertainty = fits.Header()\n            hdr_uncertainty[key_uncertainty_type] = uncertainty_name\n\n            # Assuming uncertainty is an StdDevUncertainty save just the array\n            # this might be problematic if the Uncertainty has a unit differing\n            # from the data so abort for different units. This is important for\n            # astropy > 1.2\n            if (hasattr(self.uncertainty, 'unit') and\n                    self.uncertainty.unit is not None):\n                if not _uncertainty_unit_equivalent_to_parent(\n                        uncertainty_cls, self.uncertainty.unit, self.unit):\n                    raise ValueError(\n                        'saving uncertainties with a unit that is not '\n                        'equivalent to the unit from the data unit is not '\n                        'supported.')\n\n            hduUncert = fits.ImageHDU(self.uncertainty.array, hdr_uncertainty,\n                                      name=hdu_uncertainty)\n            hdus.append(hduUncert)\n\n        if hdu_flags and self.flags:\n            raise NotImplementedError('adding the flags to a HDU is not '\n                                      'supported at this time.')\n\n        hdulist = fits.HDUList(hdus)\n\n        return hdulist"},{"id":12076,"name":"PLY_LICENSE.rst","nodeType":"TextFile","path":"licenses","text":"PLY (Python Lex-Yacc)                   Version 3.6\n\nCopyright (C) 2001-2015,\nDavid M. Beazley (Dabeaz LLC)\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n* Redistributions of source code must retain the above copyright notice,\n  this list of conditions and the following disclaimer.\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n* Neither the name of the David Beazley or Dabeaz LLC may be used to\n  endorse or promote products derived from this software without\n  specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"},{"id":12077,"name":"JQUERY_LICENSE.rst","nodeType":"TextFile","path":"licenses","text":"Copyright 2014 jQuery Foundation and other contributors\nhttp://jquery.com/\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"},{"id":12078,"name":"CONFIGOBJ_LICENSE.rst","nodeType":"TextFile","path":"licenses","text":"Copyright (c) 2003-2010, Michael Foord\nAll rights reserved.\nE-mail : fuzzyman AT voidspace DOT org DOT uk\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n\n    * Redistributions in binary form must reproduce the above\n      copyright notice, this list of conditions and the following\n      disclaimer in the documentation and/or other materials provided\n      with the distribution.\n\n    * Neither the name of Michael Foord nor the name of Voidspace\n      may be used to endorse or promote products derived from this\n      software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\nAS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"},{"id":12079,"name":"PYTHON.rst","nodeType":"TextFile","path":"licenses","text":"A. HISTORY OF THE SOFTWARE\n==========================\n\nPython was created in the early 1990s by Guido van Rossum at Stichting\nMathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands\nas a successor of a language called ABC.  Guido remains Python's\nprincipal author, although it includes many contributions from others.\n\nIn 1995, Guido continued his work on Python at the Corporation for\nNational Research Initiatives (CNRI, see http://www.cnri.reston.va.us)\nin Reston, Virginia where he released several versions of the\nsoftware.\n\nIn May 2000, Guido and the Python core development team moved to\nBeOpen.com to form the BeOpen PythonLabs team.  In October of the same\nyear, the PythonLabs team moved to Digital Creations, which became\nZope Corporation.  In 2001, the Python Software Foundation (PSF, see\nhttps://www.python.org/psf/) was formed, a non-profit organization\ncreated specifically to own Python-related Intellectual Property.\nZope Corporation was a sponsoring member of the PSF.\n\nAll Python releases are Open Source (see http://www.opensource.org for\nthe Open Source Definition).  Historically, most, but not all, Python\nreleases have also been GPL-compatible; the table below summarizes\nthe various releases.\n\n    Release         Derived     Year        Owner       GPL-\n                    from                                compatible? (1)\n\n    0.9.0 thru 1.2              1991-1995   CWI         yes\n    1.3 thru 1.5.2  1.2         1995-1999   CNRI        yes\n    1.6             1.5.2       2000        CNRI        no\n    2.0             1.6         2000        BeOpen.com  no\n    1.6.1           1.6         2001        CNRI        yes (2)\n    2.1             2.0+1.6.1   2001        PSF         no\n    2.0.1           2.0+1.6.1   2001        PSF         yes\n    2.1.1           2.1+2.0.1   2001        PSF         yes\n    2.1.2           2.1.1       2002        PSF         yes\n    2.1.3           2.1.2       2002        PSF         yes\n    2.2 and above   2.1.1       2001-now    PSF         yes\n\nFootnotes:\n\n(1) GPL-compatible doesn't mean that we're distributing Python under\n    the GPL.  All Python licenses, unlike the GPL, let you distribute\n    a modified version without making your changes open source.  The\n    GPL-compatible licenses make it possible to combine Python with\n    other software that is released under the GPL; the others don't.\n\n(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,\n    because its license has a choice of law clause.  According to\n    CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1\n    is \"not incompatible\" with the GPL.\n\nThanks to the many outside volunteers who have worked under Guido's\ndirection to make these releases possible.\n\n\nB. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON\n===============================================================\n\nPYTHON SOFTWARE FOUNDATION LICENSE VERSION 2\n--------------------------------------------\n\n1. This LICENSE AGREEMENT is between the Python Software Foundation\n(\"PSF\"), and the Individual or Organization (\"Licensee\") accessing and\notherwise using this software (\"Python\") in source or binary form and\nits associated documentation.\n\n2. Subject to the terms and conditions of this License Agreement, PSF hereby\ngrants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,\nanalyze, test, perform and/or display publicly, prepare derivative works,\ndistribute, and otherwise use Python alone or in any derivative version,\nprovided, however, that PSF's License Agreement and PSF's notice of copyright,\ni.e., \"Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,\n2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Python Software Foundation; All\nRights Reserved\" are retained in Python alone or in any derivative version\nprepared by Licensee.\n\n3. In the event Licensee prepares a derivative work that is based on\nor incorporates Python or any part thereof, and wants to make\nthe derivative work available to others as provided herein, then\nLicensee hereby agrees to include in any such work a brief summary of\nthe changes made to Python.\n\n4. PSF is making Python available to Licensee on an \"AS IS\"\nbasis.  PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR\nIMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND\nDISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS\nFOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT\nINFRINGE ANY THIRD PARTY RIGHTS.\n\n5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON\nFOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS\nA RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,\nOR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.\n\n6. This License Agreement will automatically terminate upon a material\nbreach of its terms and conditions.\n\n7. Nothing in this License Agreement shall be deemed to create any\nrelationship of agency, partnership, or joint venture between PSF and\nLicensee.  This License Agreement does not grant permission to use PSF\ntrademarks or trade name in a trademark sense to endorse or promote\nproducts or services of Licensee, or any third party.\n\n8. By copying, installing or otherwise using Python, Licensee\nagrees to be bound by the terms and conditions of this License\nAgreement.\n\n\nBEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0\n-------------------------------------------\n\nBEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1\n\n1. This LICENSE AGREEMENT is between BeOpen.com (\"BeOpen\"), having an\noffice at 160 Saratoga Avenue, Santa Clara, CA 95051, and the\nIndividual or Organization (\"Licensee\") accessing and otherwise using\nthis software in source or binary form and its associated\ndocumentation (\"the Software\").\n\n2. Subject to the terms and conditions of this BeOpen Python License\nAgreement, BeOpen hereby grants Licensee a non-exclusive,\nroyalty-free, world-wide license to reproduce, analyze, test, perform\nand/or display publicly, prepare derivative works, distribute, and\notherwise use the Software alone or in any derivative version,\nprovided, however, that the BeOpen Python License is retained in the\nSoftware, alone or in any derivative version prepared by Licensee.\n\n3. BeOpen is making the Software available to Licensee on an \"AS IS\"\nbasis.  BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR\nIMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND\nDISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS\nFOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT\nINFRINGE ANY THIRD PARTY RIGHTS.\n\n4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE\nSOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS\nAS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY\nDERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.\n\n5. This License Agreement will automatically terminate upon a material\nbreach of its terms and conditions.\n\n6. This License Agreement shall be governed by and interpreted in all\nrespects by the law of the State of California, excluding conflict of\nlaw provisions.  Nothing in this License Agreement shall be deemed to\ncreate any relationship of agency, partnership, or joint venture\nbetween BeOpen and Licensee.  This License Agreement does not grant\npermission to use BeOpen trademarks or trade names in a trademark\nsense to endorse or promote products or services of Licensee, or any\nthird party.  As an exception, the \"BeOpen Python\" logos available at\nhttp://www.pythonlabs.com/logos.html may be used according to the\npermissions granted on that web page.\n\n7. By copying, installing or otherwise using the software, Licensee\nagrees to be bound by the terms and conditions of this License\nAgreement.\n\n\nCNRI LICENSE AGREEMENT FOR PYTHON 1.6.1\n---------------------------------------\n\n1. This LICENSE AGREEMENT is between the Corporation for National\nResearch Initiatives, having an office at 1895 Preston White Drive,\nReston, VA 20191 (\"CNRI\"), and the Individual or Organization\n(\"Licensee\") accessing and otherwise using Python 1.6.1 software in\nsource or binary form and its associated documentation.\n\n2. Subject to the terms and conditions of this License Agreement, CNRI\nhereby grants Licensee a nonexclusive, royalty-free, world-wide\nlicense to reproduce, analyze, test, perform and/or display publicly,\nprepare derivative works, distribute, and otherwise use Python 1.6.1\nalone or in any derivative version, provided, however, that CNRI's\nLicense Agreement and CNRI's notice of copyright, i.e., \"Copyright (c)\n1995-2001 Corporation for National Research Initiatives; All Rights\nReserved\" are retained in Python 1.6.1 alone or in any derivative\nversion prepared by Licensee.  Alternately, in lieu of CNRI's License\nAgreement, Licensee may substitute the following text (omitting the\nquotes): \"Python 1.6.1 is made available subject to the terms and\nconditions in CNRI's License Agreement.  This Agreement together with\nPython 1.6.1 may be located on the Internet using the following\nunique, persistent identifier (known as a handle): 1895.22/1013.  This\nAgreement may also be obtained from a proxy server on the Internet\nusing the following URL: http://hdl.handle.net/1895.22/1013\".\n\n3. In the event Licensee prepares a derivative work that is based on\nor incorporates Python 1.6.1 or any part thereof, and wants to make\nthe derivative work available to others as provided herein, then\nLicensee hereby agrees to include in any such work a brief summary of\nthe changes made to Python 1.6.1.\n\n4. CNRI is making Python 1.6.1 available to Licensee on an \"AS IS\"\nbasis.  CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR\nIMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND\nDISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS\nFOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT\nINFRINGE ANY THIRD PARTY RIGHTS.\n\n5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON\n1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS\nA RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,\nOR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.\n\n6. This License Agreement will automatically terminate upon a material\nbreach of its terms and conditions.\n\n7. This License Agreement shall be governed by the federal\nintellectual property law of the United States, including without\nlimitation the federal copyright law, and, to the extent such\nU.S. federal law does not apply, by the law of the Commonwealth of\nVirginia, excluding Virginia's conflict of law provisions.\nNotwithstanding the foregoing, with regard to derivative works based\non Python 1.6.1 that incorporate non-separable material that was\npreviously distributed under the GNU General Public License (GPL), the\nlaw of the Commonwealth of Virginia shall govern this License\nAgreement only as to issues arising under or with respect to\nParagraphs 4, 5, and 7 of this License Agreement.  Nothing in this\nLicense Agreement shall be deemed to create any relationship of\nagency, partnership, or joint venture between CNRI and Licensee.  This\nLicense Agreement does not grant permission to use CNRI trademarks or\ntrade name in a trademark sense to endorse or promote products or\nservices of Licensee, or any third party.\n\n8. By clicking on the \"ACCEPT\" button where indicated, or by copying,\ninstalling or otherwise using Python 1.6.1, Licensee agrees to be\nbound by the terms and conditions of this License Agreement.\n\n        ACCEPT\n\n\nCWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2\n--------------------------------------------------\n\nCopyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,\nThe Netherlands.  All rights reserved.\n\nPermission to use, copy, modify, and distribute this software and its\ndocumentation for any purpose and without fee is hereby granted,\nprovided that the above copyright notice appear in all copies and that\nboth that copyright notice and this permission notice appear in\nsupporting documentation, and that the name of Stichting Mathematisch\nCentrum or CWI not be used in advertising or publicity pertaining to\ndistribution of the software without specific, written prior\npermission.\n\nSTICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO\nTHIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\nFITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE\nFOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT\nOF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n"},{"id":12080,"name":"EXPAT_LICENSE.rst","nodeType":"TextFile","path":"licenses","text":"Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd\n                               and Clark Cooper\nCopyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"},{"id":12081,"name":"ERFA.rst","nodeType":"TextFile","path":"licenses","text":"Copyright (C) 2013, NumFOCUS Foundation.\nAll rights reserved.\n\nThis library is derived, with permission, from the International\nAstronomical Union's \"Standards of Fundamental Astronomy\" library,\navailable from http://www.iausofa.org.\n\nThe ERFA version is intended to retain identical\nfunctionality to the SOFA library, but made distinct through\ndifferent function and file names, as set out in the SOFA license\nconditions. The SOFA original has a role as a reference standard\nfor the IAU and IERS, and consequently redistribution is permitted only\nin its unaltered state. The ERFA version is not subject to this\nrestriction and therefore can be included in distributions which do not\nsupport the concept of \"read only\" software.\n\nAlthough the intent is to replicate the SOFA API (other than replacement of\nprefix names) and results (with the exception of bugs; any that are\ndiscovered will be fixed), SOFA is not responsible for any errors found\nin this version of the library.\n\nIf you wish to acknowledge the SOFA heritage, please acknowledge that\nyou are using a library derived from SOFA, rather than SOFA itself.\n\n\nTERMS AND CONDITIONS\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1 Redistributions of source code must retain the above copyright\n   notice, this list of conditions and the following disclaimer.\n\n2 Redistributions in binary form must reproduce the above copyright\n   notice, this list of conditions and the following disclaimer in the\n   documentation and/or other materials provided with the distribution.\n\n3 Neither the name of the Standards Of Fundamental Astronomy Board, the\n   International Astronomical Union nor the names of its contributors\n   may be used to endorse or promote products derived from this software\n   without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\nIS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\nTO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\nPARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nHOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\nTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"},{"id":12082,"name":"README.rst","nodeType":"TextFile","path":"licenses","text":"Licenses\n========\n\nThis directory holds license and credit information for works astropy is derived from or distributes, and/or datasets.\n\nThe license file for the astropy package itself is placed in the root directory of this repository.\n"},{"id":12083,"name":"WCSLIB_LICENSE.rst","nodeType":"TextFile","path":"licenses","text":"\t\t   GNU LESSER GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n\n  This version of the GNU Lesser General Public License incorporates\nthe terms and conditions of version 3 of the GNU General Public\nLicense, supplemented by the additional permissions listed below.\n\n  0. Additional Definitions.\n\n  As used herein, \"this License\" refers to version 3 of the GNU Lesser\nGeneral Public License, and the \"GNU GPL\" refers to version 3 of the GNU\nGeneral Public License.\n\n  \"The Library\" refers to a covered work governed by this License,\nother than an Application or a Combined Work as defined below.\n\n  An \"Application\" is any work that makes use of an interface provided\nby the Library, but which is not otherwise based on the Library.\nDefining a subclass of a class defined by the Library is deemed a mode\nof using an interface provided by the Library.\n\n  A \"Combined Work\" is a work produced by combining or linking an\nApplication with the Library.  The particular version of the Library\nwith which the Combined Work was made is also called the \"Linked\nVersion\".\n\n  The \"Minimal Corresponding Source\" for a Combined Work means the\nCorresponding Source for the Combined Work, excluding any source code\nfor portions of the Combined Work that, considered in isolation, are\nbased on the Application, and not on the Linked Version.\n\n  The \"Corresponding Application Code\" for a Combined Work means the\nobject code and/or source code for the Application, including any data\nand utility programs needed for reproducing the Combined Work from the\nApplication, but excluding the System Libraries of the Combined Work.\n\n  1. Exception to Section 3 of the GNU GPL.\n\n  You may convey a covered work under sections 3 and 4 of this License\nwithout being bound by section 3 of the GNU GPL.\n\n  2. Conveying Modified Versions.\n\n  If you modify a copy of the Library, and, in your modifications, a\nfacility refers to a function or data to be supplied by an Application\nthat uses the facility (other than as an argument passed when the\nfacility is invoked), then you may convey a copy of the modified\nversion:\n\n   a) under this License, provided that you make a good faith effort to\n   ensure that, in the event an Application does not supply the\n   function or data, the facility still operates, and performs\n   whatever part of its purpose remains meaningful, or\n\n   b) under the GNU GPL, with none of the additional permissions of\n   this License applicable to that copy.\n\n  3. Object Code Incorporating Material from Library Header Files.\n\n  The object code form of an Application may incorporate material from\na header file that is part of the Library.  You may convey such object\ncode under terms of your choice, provided that, if the incorporated\nmaterial is not limited to numerical parameters, data structure\nlayouts and accessors, or small macros, inline functions and templates\n(ten or fewer lines in length), you do both of the following:\n\n   a) Give prominent notice with each copy of the object code that the\n   Library is used in it and that the Library and its use are\n   covered by this License.\n\n   b) Accompany the object code with a copy of the GNU GPL and this license\n   document.\n\n  4. Combined Works.\n\n  You may convey a Combined Work under terms of your choice that,\ntaken together, effectively do not restrict modification of the\nportions of the Library contained in the Combined Work and reverse\nengineering for debugging such modifications, if you also do each of\nthe following:\n\n   a) Give prominent notice with each copy of the Combined Work that\n   the Library is used in it and that the Library and its use are\n   covered by this License.\n\n   b) Accompany the Combined Work with a copy of the GNU GPL and this license\n   document.\n\n   c) For a Combined Work that displays copyright notices during\n   execution, include the copyright notice for the Library among\n   these notices, as well as a reference directing the user to the\n   copies of the GNU GPL and this license document.\n\n   d) Do one of the following:\n\n       0) Convey the Minimal Corresponding Source under the terms of this\n       License, and the Corresponding Application Code in a form\n       suitable for, and under terms that permit, the user to\n       recombine or relink the Application with a modified version of\n       the Linked Version to produce a modified Combined Work, in the\n       manner specified by section 6 of the GNU GPL for conveying\n       Corresponding Source.\n\n       1) Use a suitable shared library mechanism for linking with the\n       Library.  A suitable mechanism is one that (a) uses at run time\n       a copy of the Library already present on the user's computer\n       system, and (b) will operate properly with a modified version\n       of the Library that is interface-compatible with the Linked\n       Version.\n\n   e) Provide Installation Information, but only if you would otherwise\n   be required to provide such information under section 6 of the\n   GNU GPL, and only to the extent that such information is\n   necessary to install and execute a modified version of the\n   Combined Work produced by recombining or relinking the\n   Application with a modified version of the Linked Version. (If\n   you use option 4d0, the Installation Information must accompany\n   the Minimal Corresponding Source and Corresponding Application\n   Code. If you use option 4d1, you must provide the Installation\n   Information in the manner specified by section 6 of the GNU GPL\n   for conveying Corresponding Source.)\n\n  5. Combined Libraries.\n\n  You may place library facilities that are a work based on the\nLibrary side by side in a single library together with other library\nfacilities that are not Applications and are not covered by this\nLicense, and convey such a combined library under terms of your\nchoice, if you do both of the following:\n\n   a) Accompany the combined library with a copy of the same work based\n   on the Library, uncombined with any other library facilities,\n   conveyed under the terms of this License.\n\n   b) Give prominent notice with the combined library that part of it\n   is a work based on the Library, and explaining where to find the\n   accompanying uncombined form of the same work.\n\n  6. Revised Versions of the GNU Lesser General Public License.\n\n  The Free Software Foundation may publish revised and/or new versions\nof the GNU Lesser General Public License from time to time. Such new\nversions will be similar in spirit to the present version, but may\ndiffer in detail to address new problems or concerns.\n\n  Each version is given a distinguishing version number. If the\nLibrary as you received it specifies that a certain numbered version\nof the GNU Lesser General Public License \"or any later version\"\napplies to it, you have the option of following the terms and\nconditions either of that published version or of any later version\npublished by the Free Software Foundation. If the Library as you\nreceived it does not specify a version number of the GNU Lesser\nGeneral Public License, you may choose any version of the GNU Lesser\nGeneral Public License ever published by the Free Software Foundation.\n\n  If the Library as you received it specifies that a proxy can decide\nwhether future versions of the GNU Lesser General Public License shall\napply, that proxy's public statement of acceptance of any version is\npermanent authorization for you to choose that version for the\nLibrary.\n"},{"id":12084,"name":"AURA_LICENSE.rst","nodeType":"TextFile","path":"licenses","text":"Copyright (C) 2005 Association of Universities for Research in Astronomy (AURA)\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n    1. Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n\n    2. Redistributions in binary form must reproduce the above\n      copyright notice, this list of conditions and the following\n      disclaimer in the documentation and/or other materials provided\n      with the distribution.\n\n    3. The name of AURA and its representatives may not be used to\n      endorse or promote products derived from this software without\n      specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY AURA ``AS IS'' AND ANY EXPRESS OR IMPLIED\nWARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL AURA BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\nBUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS\nOF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR\nTORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE\nUSE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGE.\n\n"},{"id":12085,"name":"DATATABLES_LICENSE.rst","nodeType":"TextFile","path":"licenses","text":"Copyright (c) 2008-2013, Allan Jardine\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\nRedistributions of source code must retain the above copyright notice,\nthis list of conditions and the following disclaimer.\n\nRedistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n\nNeither the name of Allan Jardine nor SpryMedia may be used to endorse\nor promote products derived from this software without specific prior\nwritten permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS \"AS IS\" AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE\nLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\nCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\nSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\nBUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\nOR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\nIF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"},{"id":12086,"name":"astropy/nddata/mixins","nodeType":"Package"},{"fileName":"ndslicing.py","filePath":"astropy/nddata/mixins","id":12087,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# This module implements the Slicing mixin to the NDData class.\n\n\nfrom astropy import log\nfrom astropy.wcs.wcsapi import (BaseLowLevelWCS, BaseHighLevelWCS,\n                                SlicedLowLevelWCS, HighLevelWCSWrapper)\n\n__all__ = ['NDSlicingMixin']\n\n\nclass NDSlicingMixin:\n    \"\"\"Mixin to provide slicing on objects using the `NDData`\n    interface.\n\n    The ``data``, ``mask``, ``uncertainty`` and ``wcs`` will be sliced, if\n    set and sliceable. The ``unit`` and ``meta`` will be untouched. The return\n    will be a reference and not a copy, if possible.\n\n    Examples\n    --------\n    Using this Mixin with `~astropy.nddata.NDData`:\n\n        >>> from astropy.nddata import NDData, NDSlicingMixin\n        >>> class NDDataSliceable(NDSlicingMixin, NDData):\n        ...     pass\n\n    Slicing an instance containing data::\n\n        >>> nd = NDDataSliceable([1,2,3,4,5])\n        >>> nd[1:3]\n        NDDataSliceable([2, 3])\n\n    Also the other attributes are sliced for example the ``mask``::\n\n        >>> import numpy as np\n        >>> mask = np.array([True, False, True, True, False])\n        >>> nd2 = NDDataSliceable(nd, mask=mask)\n        >>> nd2slc = nd2[1:3]\n        >>> nd2slc[nd2slc.mask]\n        NDDataSliceable([3])\n\n    Be aware that changing values of the sliced instance will change the values\n    of the original::\n\n        >>> nd3 = nd2[1:3]\n        >>> nd3.data[0] = 100\n        >>> nd2\n        NDDataSliceable([  1, 100,   3,   4,   5])\n\n    See also\n    --------\n    NDDataRef\n    NDDataArray\n    \"\"\"\n    def __getitem__(self, item):\n        # Abort slicing if the data is a single scalar.\n        if self.data.shape == ():\n            raise TypeError('scalars cannot be sliced.')\n\n        # Let the other methods handle slicing.\n        kwargs = self._slice(item)\n        return self.__class__(**kwargs)\n\n    def _slice(self, item):\n        \"\"\"Collects the sliced attributes and passes them back as `dict`.\n\n        It passes uncertainty, mask and wcs to their appropriate ``_slice_*``\n        method, while ``meta`` and ``unit`` are simply taken from the original.\n        The data is assumed to be sliceable and is sliced directly.\n\n        When possible the return should *not* be a copy of the data but a\n        reference.\n\n        Parameters\n        ----------\n        item : slice\n            The slice passed to ``__getitem__``.\n\n        Returns\n        -------\n        dict :\n            Containing all the attributes after slicing - ready to\n            use them to create ``self.__class__.__init__(**kwargs)`` in\n            ``__getitem__``.\n        \"\"\"\n        kwargs = {}\n        kwargs['data'] = self.data[item]\n        # Try to slice some attributes\n        kwargs['uncertainty'] = self._slice_uncertainty(item)\n        kwargs['mask'] = self._slice_mask(item)\n        kwargs['wcs'] = self._slice_wcs(item)\n        # Attributes which are copied and not intended to be sliced\n        kwargs['unit'] = self.unit\n        kwargs['meta'] = self.meta\n        return kwargs\n\n    def _slice_uncertainty(self, item):\n        if self.uncertainty is None:\n            return None\n        try:\n            return self.uncertainty[item]\n        except TypeError:\n            # Catching TypeError in case the object has no __getitem__ method.\n            # But let IndexError raise.\n            log.info(\"uncertainty cannot be sliced.\")\n        return self.uncertainty\n\n    def _slice_mask(self, item):\n        if self.mask is None:\n            return None\n        try:\n            return self.mask[item]\n        except TypeError:\n            log.info(\"mask cannot be sliced.\")\n        return self.mask\n\n    def _slice_wcs(self, item):\n        if self.wcs is None:\n            return None\n\n        try:\n            llwcs = SlicedLowLevelWCS(self.wcs.low_level_wcs, item)\n            return HighLevelWCSWrapper(llwcs)\n        except Exception as err:\n            self._handle_wcs_slicing_error(err, item)\n\n    # Implement this in a method to allow subclasses to customise the error.\n    def _handle_wcs_slicing_error(self, err, item):\n        raise ValueError(f\"Slicing the WCS object with the slice '{item}' \"\n        \"failed, if you want to slice the NDData object without the WCS, you \"\n        \"can remove by setting `NDData.wcs = None` and then retry.\") from err\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":12088,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"ndslicing.py#<anonymous>","id":12089,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"__all__ = ['NDSlicingMixin']"},{"fileName":"ndarithmetic.py","filePath":"astropy/nddata/mixins","id":12090,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# This module implements the Arithmetic mixin to the NDData class.\n\n\nfrom copy import deepcopy\n\nimport numpy as np\n\nfrom astropy.nddata.nduncertainty import NDUncertainty\nfrom astropy.units import dimensionless_unscaled\nfrom astropy.utils import format_doc, sharedmethod\n\n__all__ = ['NDArithmeticMixin']\n\n# Global so it doesn't pollute the class dict unnecessarily:\n\n# Docstring templates for add, subtract, multiply, divide methods.\n_arit_doc = \"\"\"\n    Performs {name} by evaluating ``self`` {op} ``operand``.\n\n    Parameters\n    ----------\n    operand, operand2 : `NDData`-like instance\n        If ``operand2`` is ``None`` or not given it will perform the operation\n        ``self`` {op} ``operand``.\n        If ``operand2`` is given it will perform ``operand`` {op} ``operand2``.\n        If the method was called on a class rather than on the instance\n        ``operand2`` must be given.\n\n    propagate_uncertainties : `bool` or ``None``, optional\n        If ``None`` the result will have no uncertainty. If ``False`` the\n        result will have a copied version of the first operand that has an\n        uncertainty. If ``True`` the result will have a correctly propagated\n        uncertainty from the uncertainties of the operands but this assumes\n        that the uncertainties are `NDUncertainty`-like. Default is ``True``.\n\n        .. versionchanged:: 1.2\n            This parameter must be given as keyword-parameter. Using it as\n            positional parameter is deprecated.\n            ``None`` was added as valid parameter value.\n\n    handle_mask : callable, ``'first_found'`` or ``None``, optional\n        If ``None`` the result will have no mask. If ``'first_found'`` the\n        result will have a copied version of the first operand that has a\n        mask). If it is a callable then the specified callable must\n        create the results ``mask`` and if necessary provide a copy.\n        Default is `numpy.logical_or`.\n\n        .. versionadded:: 1.2\n\n    handle_meta : callable, ``'first_found'`` or ``None``, optional\n        If ``None`` the result will have no meta. If ``'first_found'`` the\n        result will have a copied version of the first operand that has a\n        (not empty) meta. If it is a callable then the specified callable must\n        create the results ``meta`` and if necessary provide a copy.\n        Default is ``None``.\n\n        .. versionadded:: 1.2\n\n    compare_wcs : callable, ``'first_found'`` or ``None``, optional\n        If ``None`` the result will have no wcs and no comparison between\n        the wcs of the operands is made. If ``'first_found'`` the\n        result will have a copied version of the first operand that has a\n        wcs. If it is a callable then the specified callable must\n        compare the ``wcs``. The resulting ``wcs`` will be like if ``False``\n        was given otherwise it raises a ``ValueError`` if the comparison was\n        not successful. Default is ``'first_found'``.\n\n        .. versionadded:: 1.2\n\n    uncertainty_correlation : number or `~numpy.ndarray`, optional\n        The correlation between the two operands is used for correct error\n        propagation for correlated data as given in:\n        https://en.wikipedia.org/wiki/Propagation_of_uncertainty#Example_formulas\n        Default is 0.\n\n        .. versionadded:: 1.2\n\n\n    kwargs :\n        Any other parameter that should be passed to the callables used.\n\n    Returns\n    -------\n    result : `~astropy.nddata.NDData`-like\n        The resulting dataset\n\n    Notes\n    -----\n    If a ``callable`` is used for ``mask``, ``wcs`` or ``meta`` the\n    callable must accept the corresponding attributes as first two\n    parameters. If the callable also needs additional parameters these can be\n    defined as ``kwargs`` and must start with ``\"wcs_\"`` (for wcs callable) or\n    ``\"meta_\"`` (for meta callable). This startstring is removed before the\n    callable is called.\n\n    ``\"first_found\"`` can also be abbreviated with ``\"ff\"``.\n    \"\"\"\n\n\nclass NDArithmeticMixin:\n    \"\"\"\n    Mixin class to add arithmetic to an NDData object.\n\n    When subclassing, be sure to list the superclasses in the correct order\n    so that the subclass sees NDData as the main superclass. See\n    `~astropy.nddata.NDDataArray` for an example.\n\n    Notes\n    -----\n    This class only aims at covering the most common cases so there are certain\n    restrictions on the saved attributes::\n\n        - ``uncertainty`` : has to be something that has a `NDUncertainty`-like\n          interface for uncertainty propagation\n        - ``mask`` : has to be something that can be used by a bitwise ``or``\n          operation.\n        - ``wcs`` : has to implement a way of comparing with ``=`` to allow\n          the operation.\n\n    But there is a workaround that allows to disable handling a specific\n    attribute and to simply set the results attribute to ``None`` or to\n    copy the existing attribute (and neglecting the other).\n    For example for uncertainties not representing an `NDUncertainty`-like\n    interface you can alter the ``propagate_uncertainties`` parameter in\n    :meth:`NDArithmeticMixin.add`. ``None`` means that the result will have no\n    uncertainty, ``False`` means it takes the uncertainty of the first operand\n    (if this does not exist from the second operand) as the result's\n    uncertainty. This behavior is also explained in the docstring for the\n    different arithmetic operations.\n\n    Decomposing the units is not attempted, mainly due to the internal mechanics\n    of `~astropy.units.Quantity`, so the resulting data might have units like\n    ``km/m`` if you divided for example 100km by 5m. So this Mixin has adopted\n    this behavior.\n\n    Examples\n    --------\n    Using this Mixin with `~astropy.nddata.NDData`:\n\n        >>> from astropy.nddata import NDData, NDArithmeticMixin\n        >>> class NDDataWithMath(NDArithmeticMixin, NDData):\n        ...     pass\n\n    Using it with one operand on an instance::\n\n        >>> ndd = NDDataWithMath(100)\n        >>> ndd.add(20)\n        NDDataWithMath(120)\n\n    Using it with two operand on an instance::\n\n        >>> ndd = NDDataWithMath(-4)\n        >>> ndd.divide(1, ndd)\n        NDDataWithMath(-0.25)\n\n    Using it as classmethod requires two operands::\n\n        >>> NDDataWithMath.subtract(5, 4)\n        NDDataWithMath(1)\n\n    \"\"\"\n\n    def _arithmetic(self, operation, operand,\n                    propagate_uncertainties=True, handle_mask=np.logical_or,\n                    handle_meta=None, uncertainty_correlation=0,\n                    compare_wcs='first_found', **kwds):\n        \"\"\"\n        Base method which calculates the result of the arithmetic operation.\n\n        This method determines the result of the arithmetic operation on the\n        ``data`` including their units and then forwards to other methods\n        to calculate the other properties for the result (like uncertainty).\n\n        Parameters\n        ----------\n        operation : callable\n            The operation that is performed on the `NDData`. Supported are\n            `numpy.add`, `numpy.subtract`, `numpy.multiply` and\n            `numpy.true_divide`.\n\n        operand : same type (class) as self\n            see :meth:`NDArithmeticMixin.add`\n\n        propagate_uncertainties : `bool` or ``None``, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        handle_mask : callable, ``'first_found'`` or ``None``, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        handle_meta : callable, ``'first_found'`` or ``None``, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        compare_wcs : callable, ``'first_found'`` or ``None``, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        uncertainty_correlation : ``Number`` or `~numpy.ndarray`, optional\n            see :meth:`NDArithmeticMixin.add`\n\n        kwargs :\n            Any other parameter that should be passed to the\n            different :meth:`NDArithmeticMixin._arithmetic_mask` (or wcs, ...)\n            methods.\n\n        Returns\n        -------\n        result : ndarray or `~astropy.units.Quantity`\n            The resulting data as array (in case both operands were without\n            unit) or as quantity if at least one had a unit.\n\n        kwargs : `dict`\n            The kwargs should contain all the other attributes (besides data\n            and unit) needed to create a new instance for the result. Creating\n            the new instance is up to the calling method, for example\n            :meth:`NDArithmeticMixin.add`.\n\n        \"\"\"\n        # Find the appropriate keywords for the appropriate method (not sure\n        # if data and uncertainty are ever used ...)\n        kwds2 = {'mask': {}, 'meta': {}, 'wcs': {},\n                 'data': {}, 'uncertainty': {}}\n        for i in kwds:\n            splitted = i.split('_', 1)\n            try:\n                kwds2[splitted[0]][splitted[1]] = kwds[i]\n            except KeyError:\n                raise KeyError(f'Unknown prefix {splitted[0]} for parameter {i}')\n\n        kwargs = {}\n\n        # First check that the WCS allows the arithmetic operation\n        if compare_wcs is None:\n            kwargs['wcs'] = None\n        elif compare_wcs in ['ff', 'first_found']:\n            if self.wcs is None:\n                kwargs['wcs'] = deepcopy(operand.wcs)\n            else:\n                kwargs['wcs'] = deepcopy(self.wcs)\n        else:\n            kwargs['wcs'] = self._arithmetic_wcs(operation, operand,\n                                                 compare_wcs, **kwds2['wcs'])\n\n        # Then calculate the resulting data (which can but not needs to be a\n        # quantity)\n        result = self._arithmetic_data(operation, operand, **kwds2['data'])\n\n        # Determine the other properties\n        if propagate_uncertainties is None:\n            kwargs['uncertainty'] = None\n        elif not propagate_uncertainties:\n            if self.uncertainty is None:\n                kwargs['uncertainty'] = deepcopy(operand.uncertainty)\n            else:\n                kwargs['uncertainty'] = deepcopy(self.uncertainty)\n        else:\n            kwargs['uncertainty'] = self._arithmetic_uncertainty(\n                operation, operand, result, uncertainty_correlation,\n                **kwds2['uncertainty'])\n\n        if handle_mask is None:\n            kwargs['mask'] = None\n        elif handle_mask in ['ff', 'first_found']:\n            if self.mask is None:\n                kwargs['mask'] = deepcopy(operand.mask)\n            else:\n                kwargs['mask'] = deepcopy(self.mask)\n        else:\n            kwargs['mask'] = self._arithmetic_mask(operation, operand,\n                                                   handle_mask,\n                                                   **kwds2['mask'])\n\n        if handle_meta is None:\n            kwargs['meta'] = None\n        elif handle_meta in ['ff', 'first_found']:\n            if not self.meta:\n                kwargs['meta'] = deepcopy(operand.meta)\n            else:\n                kwargs['meta'] = deepcopy(self.meta)\n        else:\n            kwargs['meta'] = self._arithmetic_meta(\n                operation, operand, handle_meta, **kwds2['meta'])\n\n        # Wrap the individual results into a new instance of the same class.\n        return result, kwargs\n\n    def _arithmetic_data(self, operation, operand, **kwds):\n        \"\"\"\n        Calculate the resulting data\n\n        Parameters\n        ----------\n        operation : callable\n            see `NDArithmeticMixin._arithmetic` parameter description.\n\n        operand : `NDData`-like instance\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        kwds :\n            Additional parameters.\n\n        Returns\n        -------\n        result_data : ndarray or `~astropy.units.Quantity`\n            If both operands had no unit the resulting data is a simple numpy\n            array, but if any of the operands had a unit the return is a\n            Quantity.\n        \"\"\"\n\n        # Do the calculation with or without units\n        if self.unit is None and operand.unit is None:\n            result = operation(self.data, operand.data)\n        elif self.unit is None:\n            result = operation(self.data << dimensionless_unscaled,\n                               operand.data << operand.unit)\n        elif operand.unit is None:\n            result = operation(self.data << self.unit,\n                               operand.data << dimensionless_unscaled)\n        else:\n            result = operation(self.data << self.unit,\n                               operand.data << operand.unit)\n\n        return result\n\n    def _arithmetic_uncertainty(self, operation, operand, result, correlation,\n                                **kwds):\n        \"\"\"\n        Calculate the resulting uncertainty.\n\n        Parameters\n        ----------\n        operation : callable\n            see :meth:`NDArithmeticMixin._arithmetic` parameter description.\n\n        operand : `NDData`-like instance\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        result : `~astropy.units.Quantity` or `~numpy.ndarray`\n            The result of :meth:`NDArithmeticMixin._arithmetic_data`.\n\n        correlation : number or `~numpy.ndarray`\n            see :meth:`NDArithmeticMixin.add` parameter description.\n\n        kwds :\n            Additional parameters.\n\n        Returns\n        -------\n        result_uncertainty : `NDUncertainty` subclass instance or None\n            The resulting uncertainty already saved in the same `NDUncertainty`\n            subclass that ``self`` had (or ``operand`` if self had no\n            uncertainty). ``None`` only if both had no uncertainty.\n        \"\"\"\n\n        # Make sure these uncertainties are NDUncertainties so this kind of\n        # propagation is possible.\n        if (self.uncertainty is not None and\n                not isinstance(self.uncertainty, NDUncertainty)):\n            raise TypeError(\"Uncertainty propagation is only defined for \"\n                            \"subclasses of NDUncertainty.\")\n        if (operand.uncertainty is not None and\n                not isinstance(operand.uncertainty, NDUncertainty)):\n            raise TypeError(\"Uncertainty propagation is only defined for \"\n                            \"subclasses of NDUncertainty.\")\n\n        # Now do the uncertainty propagation\n        # TODO: There is no enforced requirement that actually forbids the\n        # uncertainty to have negative entries but with correlation the\n        # sign of the uncertainty DOES matter.\n        if self.uncertainty is None and operand.uncertainty is None:\n            # Neither has uncertainties so the result should have none.\n            return None\n        elif self.uncertainty is None:\n            # Create a temporary uncertainty to allow uncertainty propagation\n            # to yield the correct results. (issue #4152)\n            self.uncertainty = operand.uncertainty.__class__(None)\n            result_uncert = self.uncertainty.propagate(operation, operand,\n                                                       result, correlation)\n            # Delete the temporary uncertainty again.\n            self.uncertainty = None\n            return result_uncert\n\n        elif operand.uncertainty is None:\n            # As with self.uncertainty is None but the other way around.\n            operand.uncertainty = self.uncertainty.__class__(None)\n            result_uncert = self.uncertainty.propagate(operation, operand,\n                                                       result, correlation)\n            operand.uncertainty = None\n            return result_uncert\n\n        else:\n            # Both have uncertainties so just propagate.\n            return self.uncertainty.propagate(operation, operand, result,\n                                              correlation)\n\n    def _arithmetic_mask(self, operation, operand, handle_mask, **kwds):\n        \"\"\"\n        Calculate the resulting mask\n\n        This is implemented as the piecewise ``or`` operation if both have a\n        mask.\n\n        Parameters\n        ----------\n        operation : callable\n            see :meth:`NDArithmeticMixin._arithmetic` parameter description.\n            By default, the ``operation`` will be ignored.\n\n        operand : `NDData`-like instance\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        handle_mask : callable\n            see :meth:`NDArithmeticMixin.add`\n\n        kwds :\n            Additional parameters given to ``handle_mask``.\n\n        Returns\n        -------\n        result_mask : any type\n            If only one mask was present this mask is returned.\n            If neither had a mask ``None`` is returned. Otherwise\n            ``handle_mask`` must create (and copy) the returned mask.\n        \"\"\"\n\n        # If only one mask is present we need not bother about any type checks\n        if self.mask is None and operand.mask is None:\n            return None\n        elif self.mask is None:\n            # Make a copy so there is no reference in the result.\n            return deepcopy(operand.mask)\n        elif operand.mask is None:\n            return deepcopy(self.mask)\n        else:\n            # Now lets calculate the resulting mask (operation enforces copy)\n            return handle_mask(self.mask, operand.mask, **kwds)\n\n    def _arithmetic_wcs(self, operation, operand, compare_wcs, **kwds):\n        \"\"\"\n        Calculate the resulting wcs.\n\n        There is actually no calculation involved but it is a good place to\n        compare wcs information of both operands. This is currently not working\n        properly with `~astropy.wcs.WCS` (which is the suggested class for\n        storing as wcs property) but it will not break it neither.\n\n        Parameters\n        ----------\n        operation : callable\n            see :meth:`NDArithmeticMixin._arithmetic` parameter description.\n            By default, the ``operation`` will be ignored.\n\n        operand : `NDData` instance or subclass\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        compare_wcs : callable\n            see :meth:`NDArithmeticMixin.add` parameter description.\n\n        kwds :\n            Additional parameters given to ``compare_wcs``.\n\n        Raises\n        ------\n        ValueError\n            If ``compare_wcs`` returns ``False``.\n\n        Returns\n        -------\n        result_wcs : any type\n            The ``wcs`` of the first operand is returned.\n        \"\"\"\n\n        # ok, not really arithmetics but we need to check which wcs makes sense\n        # for the result and this is an ideal place to compare the two WCS,\n        # too.\n\n        # I'll assume that the comparison returned None or False in case they\n        # are not equal.\n        if not compare_wcs(self.wcs, operand.wcs, **kwds):\n            raise ValueError(\"WCS are not equal.\")\n\n        return deepcopy(self.wcs)\n\n    def _arithmetic_meta(self, operation, operand, handle_meta, **kwds):\n        \"\"\"\n        Calculate the resulting meta.\n\n        Parameters\n        ----------\n        operation : callable\n            see :meth:`NDArithmeticMixin._arithmetic` parameter description.\n            By default, the ``operation`` will be ignored.\n\n        operand : `NDData`-like instance\n            The second operand wrapped in an instance of the same class as\n            self.\n\n        handle_meta : callable\n            see :meth:`NDArithmeticMixin.add`\n\n        kwds :\n            Additional parameters given to ``handle_meta``.\n\n        Returns\n        -------\n        result_meta : any type\n            The result of ``handle_meta``.\n        \"\"\"\n        # Just return what handle_meta does with both of the metas.\n        return handle_meta(self.meta, operand.meta, **kwds)\n\n    @sharedmethod\n    @format_doc(_arit_doc, name='addition', op='+')\n    def add(self, operand, operand2=None, **kwargs):\n        return self._prepare_then_do_arithmetic(np.add, operand, operand2,\n                                                **kwargs)\n\n    @sharedmethod\n    @format_doc(_arit_doc, name='subtraction', op='-')\n    def subtract(self, operand, operand2=None, **kwargs):\n        return self._prepare_then_do_arithmetic(np.subtract, operand, operand2,\n                                                **kwargs)\n\n    @sharedmethod\n    @format_doc(_arit_doc, name=\"multiplication\", op=\"*\")\n    def multiply(self, operand, operand2=None, **kwargs):\n        return self._prepare_then_do_arithmetic(np.multiply, operand, operand2,\n                                                **kwargs)\n\n    @sharedmethod\n    @format_doc(_arit_doc, name=\"division\", op=\"/\")\n    def divide(self, operand, operand2=None, **kwargs):\n        return self._prepare_then_do_arithmetic(np.true_divide, operand,\n                                                operand2, **kwargs)\n\n    @sharedmethod\n    def _prepare_then_do_arithmetic(self_or_cls, operation, operand, operand2,\n                                    **kwargs):\n        \"\"\"Intermediate method called by public arithmetics (i.e. ``add``)\n        before the processing method (``_arithmetic``) is invoked.\n\n        .. warning::\n            Do not override this method in subclasses.\n\n        This method checks if it was called as instance or as class method and\n        then wraps the operands and the result from ``_arithmetics`` in the\n        appropriate subclass.\n\n        Parameters\n        ----------\n        self_or_cls : instance or class\n            ``sharedmethod`` behaves like a normal method if called on the\n            instance (then this parameter is ``self``) but like a classmethod\n            when called on the class (then this parameter is ``cls``).\n\n        operations : callable\n            The operation (normally a numpy-ufunc) that represents the\n            appropriate action.\n\n        operand, operand2, kwargs :\n            See for example ``add``.\n\n        Result\n        ------\n        result : `~astropy.nddata.NDData`-like\n            Depending how this method was called either ``self_or_cls``\n            (called on class) or ``self_or_cls.__class__`` (called on instance)\n            is the NDData-subclass that is used as wrapper for the result.\n        \"\"\"\n        # DO NOT OVERRIDE THIS METHOD IN SUBCLASSES.\n\n        if isinstance(self_or_cls, NDArithmeticMixin):\n            # True means it was called on the instance, so self_or_cls is\n            # a reference to self\n            cls = self_or_cls.__class__\n\n            if operand2 is None:\n                # Only one operand was given. Set operand2 to operand and\n                # operand to self so that we call the appropriate method of the\n                # operand.\n                operand2 = operand\n                operand = self_or_cls\n            else:\n                # Convert the first operand to the class of this method.\n                # This is important so that always the correct _arithmetics is\n                # called later that method.\n                operand = cls(operand)\n\n        else:\n            # It was used as classmethod so self_or_cls represents the cls\n            cls = self_or_cls\n\n            # It was called on the class so we expect two operands!\n            if operand2 is None:\n                raise TypeError(\"operand2 must be given when the method isn't \"\n                                \"called on an instance.\")\n\n            # Convert to this class. See above comment why.\n            operand = cls(operand)\n\n        # At this point operand, operand2, kwargs and cls are determined.\n\n        # Let's try to convert operand2 to the class of operand to allows for\n        # arithmetic operations with numbers, lists, numpy arrays, numpy masked\n        # arrays, astropy quantities, masked quantities and of other subclasses\n        # of NDData.\n        operand2 = cls(operand2)\n\n        # Now call the _arithmetics method to do the arithmetics.\n        result, init_kwds = operand._arithmetic(operation, operand2, **kwargs)\n\n        # Return a new class based on the result\n        return cls(result, **init_kwds)\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":12091,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":12092,"name":"_arit_doc","nodeType":"Attribute","startLoc":18,"text":"_arit_doc"},{"col":0,"comment":"","endLoc":5,"header":"ndarithmetic.py#<anonymous>","id":12093,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"__all__ = ['NDArithmeticMixin']\n\n_arit_doc = \"\"\"\n    Performs {name} by evaluating ``self`` {op} ``operand``.\n\n    Parameters\n    ----------\n    operand, operand2 : `NDData`-like instance\n        If ``operand2`` is ``None`` or not given it will perform the operation\n        ``self`` {op} ``operand``.\n        If ``operand2`` is given it will perform ``operand`` {op} ``operand2``.\n        If the method was called on a class rather than on the instance\n        ``operand2`` must be given.\n\n    propagate_uncertainties : `bool` or ``None``, optional\n        If ``None`` the result will have no uncertainty. If ``False`` the\n        result will have a copied version of the first operand that has an\n        uncertainty. If ``True`` the result will have a correctly propagated\n        uncertainty from the uncertainties of the operands but this assumes\n        that the uncertainties are `NDUncertainty`-like. Default is ``True``.\n\n        .. versionchanged:: 1.2\n            This parameter must be given as keyword-parameter. Using it as\n            positional parameter is deprecated.\n            ``None`` was added as valid parameter value.\n\n    handle_mask : callable, ``'first_found'`` or ``None``, optional\n        If ``None`` the result will have no mask. If ``'first_found'`` the\n        result will have a copied version of the first operand that has a\n        mask). If it is a callable then the specified callable must\n        create the results ``mask`` and if necessary provide a copy.\n        Default is `numpy.logical_or`.\n\n        .. versionadded:: 1.2\n\n    handle_meta : callable, ``'first_found'`` or ``None``, optional\n        If ``None`` the result will have no meta. If ``'first_found'`` the\n        result will have a copied version of the first operand that has a\n        (not empty) meta. If it is a callable then the specified callable must\n        create the results ``meta`` and if necessary provide a copy.\n        Default is ``None``.\n\n        .. versionadded:: 1.2\n\n    compare_wcs : callable, ``'first_found'`` or ``None``, optional\n        If ``None`` the result will have no wcs and no comparison between\n        the wcs of the operands is made. If ``'first_found'`` the\n        result will have a copied version of the first operand that has a\n        wcs. If it is a callable then the specified callable must\n        compare the ``wcs``. The resulting ``wcs`` will be like if ``False``\n        was given otherwise it raises a ``ValueError`` if the comparison was\n        not successful. Default is ``'first_found'``.\n\n        .. versionadded:: 1.2\n\n    uncertainty_correlation : number or `~numpy.ndarray`, optional\n        The correlation between the two operands is used for correct error\n        propagation for correlated data as given in:\n        https://en.wikipedia.org/wiki/Propagation_of_uncertainty#Example_formulas\n        Default is 0.\n\n        .. versionadded:: 1.2\n\n\n    kwargs :\n        Any other parameter that should be passed to the callables used.\n\n    Returns\n    -------\n    result : `~astropy.nddata.NDData`-like\n        The resulting dataset\n\n    Notes\n    -----\n    If a ``callable`` is used for ``mask``, ``wcs`` or ``meta`` the\n    callable must accept the corresponding attributes as first two\n    parameters. If the callable also needs additional parameters these can be\n    defined as ``kwargs`` and must start with ``\"wcs_\"`` (for wcs callable) or\n    ``\"meta_\"`` (for meta callable). This startstring is removed before the\n    callable is called.\n\n    ``\"first_found\"`` can also be abbreviated with ``\"ff\"``.\n    \"\"\""},{"fileName":"ndio.py","filePath":"astropy/nddata/mixins","id":12094,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# This module implements the I/O mixin to the NDData class.\n\n\nfrom astropy.io import registry\n\n__all__ = ['NDIOMixin']\n__doctest_skip__ = ['NDDataRead', 'NDDataWrite']\n\n\nclass NDDataRead(registry.UnifiedReadWrite):\n    \"\"\"Read and parse gridded N-dimensional data and return as an NDData-derived\n    object.\n\n    This function provides the NDDataBase interface to the astropy unified I/O\n    layer.  This allows easily reading a file in the supported data formats,\n    for example::\n\n      >>> from astropy.nddata import CCDData\n      >>> dat = CCDData.read('image.fits')\n\n    Get help on the available readers for ``CCDData`` using the``help()`` method::\n\n      >>> CCDData.read.help()  # Get help reading CCDData and list supported formats\n      >>> CCDData.read.help('fits')  # Get detailed help on CCDData FITS reader\n      >>> CCDData.read.list_formats()  # Print list of available formats\n\n    See also:\n\n    - https://docs.astropy.org/en/stable/nddata\n    - https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    *args : tuple, optional\n        Positional arguments passed through to data reader. If supplied the\n        first argument is the input filename.\n    format : str, optional\n        File format specifier.\n    cache : bool, optional\n        Caching behavior if file is a URL.\n    **kwargs : dict, optional\n        Keyword arguments passed through to data reader.\n\n    Returns\n    -------\n    out : `NDData` subclass\n        NDData-basd object corresponding to file contents\n\n    Notes\n    -----\n    \"\"\"\n\n    def __init__(self, instance, cls):\n        super().__init__(instance, cls, 'read', registry=None)\n        # uses default global registry\n\n    def __call__(self, *args, **kwargs):\n        return self.registry.read(self._cls, *args, **kwargs)\n\n\nclass NDDataWrite(registry.UnifiedReadWrite):\n    \"\"\"Write this CCDData object out in the specified format.\n\n    This function provides the NDData interface to the astropy unified I/O\n    layer.  This allows easily writing a file in many supported data formats\n    using syntax such as::\n\n      >>> from astropy.nddata import CCDData\n      >>> dat = CCDData(np.zeros((12, 12)), unit='adu')  # 12x12 image of zeros\n      >>> dat.write('zeros.fits')\n\n    Get help on the available writers for ``CCDData`` using the``help()`` method::\n\n      >>> CCDData.write.help()  # Get help writing CCDData and list supported formats\n      >>> CCDData.write.help('fits')  # Get detailed help on CCDData FITS writer\n      >>> CCDData.write.list_formats()  # Print list of available formats\n\n    See also:\n\n    - https://docs.astropy.org/en/stable/nddata\n    - https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    *args : tuple, optional\n        Positional arguments passed through to data writer. If supplied the\n        first argument is the output filename.\n    format : str, optional\n        File format specifier.\n    **kwargs : dict, optional\n        Keyword arguments passed through to data writer.\n\n    Notes\n    -----\n    \"\"\"\n\n    def __init__(self, instance, cls):\n        super().__init__(instance, cls, 'write', registry=None)\n        # uses default global registry\n\n    def __call__(self, *args, **kwargs):\n        self.registry.write(self._instance, *args, **kwargs)\n\n\nclass NDIOMixin:\n    \"\"\"\n    Mixin class to connect NDData to the astropy input/output registry.\n\n    This mixin adds two methods to its subclasses, ``read`` and ``write``.\n    \"\"\"\n    read = registry.UnifiedReadWriteMethod(NDDataRead)\n    write = registry.UnifiedReadWriteMethod(NDDataWrite)\n"},{"className":"NDDataRead","col":0,"comment":"Read and parse gridded N-dimensional data and return as an NDData-derived\n    object.\n\n    This function provides the NDDataBase interface to the astropy unified I/O\n    layer.  This allows easily reading a file in the supported data formats,\n    for example::\n\n      >>> from astropy.nddata import CCDData\n      >>> dat = CCDData.read('image.fits')\n\n    Get help on the available readers for ``CCDData`` using the``help()`` method::\n\n      >>> CCDData.read.help()  # Get help reading CCDData and list supported formats\n      >>> CCDData.read.help('fits')  # Get detailed help on CCDData FITS reader\n      >>> CCDData.read.list_formats()  # Print list of available formats\n\n    See also:\n\n    - https://docs.astropy.org/en/stable/nddata\n    - https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    *args : tuple, optional\n        Positional arguments passed through to data reader. If supplied the\n        first argument is the input filename.\n    format : str, optional\n        File format specifier.\n    cache : bool, optional\n        Caching behavior if file is a URL.\n    **kwargs : dict, optional\n        Keyword arguments passed through to data reader.\n\n    Returns\n    -------\n    out : `NDData` subclass\n        NDData-basd object corresponding to file contents\n\n    Notes\n    -----\n    ","endLoc":59,"id":12095,"nodeType":"Class","startLoc":11,"text":"class NDDataRead(registry.UnifiedReadWrite):\n    \"\"\"Read and parse gridded N-dimensional data and return as an NDData-derived\n    object.\n\n    This function provides the NDDataBase interface to the astropy unified I/O\n    layer.  This allows easily reading a file in the supported data formats,\n    for example::\n\n      >>> from astropy.nddata import CCDData\n      >>> dat = CCDData.read('image.fits')\n\n    Get help on the available readers for ``CCDData`` using the``help()`` method::\n\n      >>> CCDData.read.help()  # Get help reading CCDData and list supported formats\n      >>> CCDData.read.help('fits')  # Get detailed help on CCDData FITS reader\n      >>> CCDData.read.list_formats()  # Print list of available formats\n\n    See also:\n\n    - https://docs.astropy.org/en/stable/nddata\n    - https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    *args : tuple, optional\n        Positional arguments passed through to data reader. If supplied the\n        first argument is the input filename.\n    format : str, optional\n        File format specifier.\n    cache : bool, optional\n        Caching behavior if file is a URL.\n    **kwargs : dict, optional\n        Keyword arguments passed through to data reader.\n\n    Returns\n    -------\n    out : `NDData` subclass\n        NDData-basd object corresponding to file contents\n\n    Notes\n    -----\n    \"\"\"\n\n    def __init__(self, instance, cls):\n        super().__init__(instance, cls, 'read', registry=None)\n        # uses default global registry\n\n    def __call__(self, *args, **kwargs):\n        return self.registry.read(self._cls, *args, **kwargs)"},{"col":4,"comment":"null","endLoc":56,"header":"def __init__(self, instance, cls)","id":12096,"name":"__init__","nodeType":"Function","startLoc":54,"text":"def __init__(self, instance, cls):\n        super().__init__(instance, cls, 'read', registry=None)\n        # uses default global registry"},{"col":4,"comment":"null","endLoc":884,"header":"def parse(self,input,source=None,ignore={})","id":12097,"name":"parse","nodeType":"Function","startLoc":882,"text":"def parse(self,input,source=None,ignore={}):\n        self.ignore = ignore\n        self.parser = self.parsegen(input,source)"},{"col":4,"comment":"null","endLoc":898,"header":"def token(self)","id":12098,"name":"token","nodeType":"Function","startLoc":891,"text":"def token(self):\n        try:\n            while True:\n                tok = next(self.parser)\n                if tok.type not in self.ignore: return tok\n        except StopIteration:\n            self.parser = None\n            return None"},{"attributeType":"null","col":12,"comment":"null","endLoc":225,"id":12099,"name":"t_INTEGER","nodeType":"Attribute","startLoc":225,"text":"self.t_INTEGER"},{"attributeType":"null","col":8,"comment":"null","endLoc":164,"id":12100,"name":"macros","nodeType":"Attribute","startLoc":164,"text":"self.macros"},{"attributeType":"null","col":8,"comment":"null","endLoc":631,"id":12101,"name":"source","nodeType":"Attribute","startLoc":631,"text":"self.source"},{"attributeType":"null","col":8,"comment":"null","endLoc":163,"id":12102,"name":"lexer","nodeType":"Attribute","startLoc":163,"text":"self.lexer"},{"attributeType":"None","col":12,"comment":"null","endLoc":248,"id":12103,"name":"t_NEWLINE","nodeType":"Attribute","startLoc":248,"text":"self.t_NEWLINE"},{"attributeType":"null","col":12,"comment":"null","endLoc":217,"id":12104,"name":"t_ID","nodeType":"Attribute","startLoc":217,"text":"self.t_ID"},{"attributeType":"null","col":8,"comment":"null","endLoc":165,"id":12105,"name":"path","nodeType":"Attribute","startLoc":165,"text":"self.path"},{"attributeType":"null","col":8,"comment":"null","endLoc":253,"id":12106,"name":"t_WS","nodeType":"Attribute","startLoc":253,"text":"self.t_WS"},{"attributeType":"None","col":8,"comment":"null","endLoc":174,"id":12107,"name":"parser","nodeType":"Attribute","startLoc":174,"text":"self.parser"},{"attributeType":"null","col":12,"comment":"null","endLoc":226,"id":12108,"name":"t_INTEGER_TYPE","nodeType":"Attribute","startLoc":226,"text":"self.t_INTEGER_TYPE"},{"attributeType":"null","col":8,"comment":"null","endLoc":883,"id":12109,"name":"ignore","nodeType":"Attribute","startLoc":883,"text":"self.ignore"},{"attributeType":"null","col":12,"comment":"null","endLoc":234,"id":12110,"name":"t_STRING","nodeType":"Attribute","startLoc":234,"text":"self.t_STRING"},{"attributeType":"None","col":12,"comment":"null","endLoc":240,"id":12111,"name":"t_SPACE","nodeType":"Attribute","startLoc":240,"text":"self.t_SPACE"},{"attributeType":"null","col":8,"comment":"null","endLoc":166,"id":12112,"name":"temp_path","nodeType":"Attribute","startLoc":166,"text":"self.temp_path"},{"col":0,"comment":"\\s+","endLoc":36,"header":"def t_CPP_WS(t)","id":12113,"name":"t_CPP_WS","nodeType":"Function","startLoc":33,"text":"def t_CPP_WS(t):\n    r'\\s+'\n    t.lexer.lineno += t.value.count(\"\\n\")\n    return t"},{"col":0,"comment":"(((((0x)|(0X))[0-9a-fA-F]+)|(\\d+))([uU][lL]|[lL][uU]|[uU]|[lL])?)","endLoc":47,"header":"def CPP_INTEGER(t)","id":12114,"name":"CPP_INTEGER","nodeType":"Function","startLoc":45,"text":"def CPP_INTEGER(t):\n    r'(((((0x)|(0X))[0-9a-fA-F]+)|(\\d+))([uU][lL]|[lL][uU]|[uU]|[lL])?)'\n    return t"},{"col":0,"comment":"\\\"([^\\\\\\n]|(\\\\(.|\\n)))*?\\\"","endLoc":58,"header":"def t_CPP_STRING(t)","id":12115,"name":"t_CPP_STRING","nodeType":"Function","startLoc":55,"text":"def t_CPP_STRING(t):\n    r'\\\"([^\\\\\\n]|(\\\\(.|\\n)))*?\\\"'\n    t.lexer.lineno += t.value.count(\"\\n\")\n    return t"},{"col":4,"comment":"\n        Insert key/value pair into metadata in a way that FITS can serialize.\n\n        Parameters\n        ----------\n        key : str\n            Key to be inserted in dictionary.\n\n        value : str or None\n            Value to be inserted.\n\n        Notes\n        -----\n        This addresses a shortcoming of the FITS standard. There are length\n        restrictions on both the ``key`` (8 characters) and ``value`` (72\n        characters) in the FITS standard. There is a convention for handling\n        long keywords and a convention for handling long values, but the\n        two conventions cannot be used at the same time.\n\n        This addresses that case by checking the length of the ``key`` and\n        ``value`` and, if necessary, shortening the key.\n        ","endLoc":437,"header":"def _insert_in_metadata_fits_safe(self, key, value)","id":12116,"name":"_insert_in_metadata_fits_safe","nodeType":"Function","startLoc":407,"text":"def _insert_in_metadata_fits_safe(self, key, value):\n        \"\"\"\n        Insert key/value pair into metadata in a way that FITS can serialize.\n\n        Parameters\n        ----------\n        key : str\n            Key to be inserted in dictionary.\n\n        value : str or None\n            Value to be inserted.\n\n        Notes\n        -----\n        This addresses a shortcoming of the FITS standard. There are length\n        restrictions on both the ``key`` (8 characters) and ``value`` (72\n        characters) in the FITS standard. There is a convention for handling\n        long keywords and a convention for handling long values, but the\n        two conventions cannot be used at the same time.\n\n        This addresses that case by checking the length of the ``key`` and\n        ``value`` and, if necessary, shortening the key.\n        \"\"\"\n\n        if len(key) > 8 and len(value) > 72:\n            short_name = key[:8]\n            self.meta[f'HIERARCH {key.upper()}'] = (\n                short_name, f\"Shortened name for {key}\")\n            self.meta[short_name] = value\n        else:\n            self.meta[key] = value"},{"col":0,"comment":"(L)?\\'([^\\\\\\n]|(\\\\(.|\\n)))*?\\'","endLoc":64,"header":"def t_CPP_CHAR(t)","id":12117,"name":"t_CPP_CHAR","nodeType":"Function","startLoc":61,"text":"def t_CPP_CHAR(t):\n    r'(L)?\\'([^\\\\\\n]|(\\\\(.|\\n)))*?\\''\n    t.lexer.lineno += t.value.count(\"\\n\")\n    return t"},{"col":0,"comment":"null","endLoc":33,"header":"def _create_wcs_simple(naxis, ctype, crpix, crval, cdelt)","id":12118,"name":"_create_wcs_simple","nodeType":"Function","startLoc":27,"text":"def _create_wcs_simple(naxis, ctype, crpix, crval, cdelt):\n    wcs = WCS(naxis=naxis)\n    wcs.wcs.crpix = crpix\n    wcs.wcs.crval = crval\n    wcs.wcs.cdelt = cdelt\n    wcs.wcs.ctype = ctype\n    return wcs"},{"col":0,"comment":"(/\\*(.|\\n)*?\\*/)","endLoc":73,"header":"def t_CPP_COMMENT1(t)","id":12119,"name":"t_CPP_COMMENT1","nodeType":"Function","startLoc":67,"text":"def t_CPP_COMMENT1(t):\n    r'(/\\*(.|\\n)*?\\*/)'\n    ncr = t.value.count(\"\\n\")\n    t.lexer.lineno += ncr\n    # replace with one space or a number of '\\n'\n    t.type = 'CPP_WS'; t.value = '\\n' * ncr if ncr else ' '\n    return t"},{"col":0,"comment":"(//.*?(\\n|$))","endLoc":80,"header":"def t_CPP_COMMENT2(t)","id":12120,"name":"t_CPP_COMMENT2","nodeType":"Function","startLoc":76,"text":"def t_CPP_COMMENT2(t):\n    r'(//.*?(\\n|$))'\n    # replace with '/n'\n    t.type = 'CPP_WS'; t.value = '\\n'\n    return t"},{"col":0,"comment":"null","endLoc":86,"header":"def t_error(t)","id":12121,"name":"t_error","nodeType":"Function","startLoc":82,"text":"def t_error(t):\n    t.type = t.value[0]\n    t.value = t.value[0]\n    t.lexer.skip(1)\n    return t"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":12122,"name":"STRING_TYPES","nodeType":"Attribute","startLoc":16,"text":"STRING_TYPES"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":12123,"name":"STRING_TYPES","nodeType":"Attribute","startLoc":18,"text":"STRING_TYPES"},{"attributeType":"null","col":4,"comment":"null","endLoc":19,"id":12124,"name":"xrange","nodeType":"Attribute","startLoc":19,"text":"xrange"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":12125,"name":"tokens","nodeType":"Attribute","startLoc":26,"text":"tokens"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":12126,"name":"literals","nodeType":"Attribute","startLoc":30,"text":"literals"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":12127,"name":"t_CPP_POUND","nodeType":"Attribute","startLoc":38,"text":"t_CPP_POUND"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":12128,"name":"t_CPP_DPOUND","nodeType":"Attribute","startLoc":39,"text":"t_CPP_DPOUND"},{"attributeType":"null","col":0,"comment":"null","endLoc":42,"id":12129,"name":"t_CPP_ID","nodeType":"Attribute","startLoc":42,"text":"t_CPP_ID"},{"attributeType":"function","col":0,"comment":"null","endLoc":49,"id":12130,"name":"t_CPP_INTEGER","nodeType":"Attribute","startLoc":49,"text":"t_CPP_INTEGER"},{"attributeType":"null","col":0,"comment":"null","endLoc":52,"id":12131,"name":"t_CPP_FLOAT","nodeType":"Attribute","startLoc":52,"text":"t_CPP_FLOAT"},{"attributeType":"null","col":0,"comment":"null","endLoc":110,"id":12132,"name":"_trigraph_pat","nodeType":"Attribute","startLoc":110,"text":"_trigraph_pat"},{"attributeType":"null","col":0,"comment":"null","endLoc":111,"id":12133,"name":"_trigraph_rep","nodeType":"Attribute","startLoc":111,"text":"_trigraph_rep"},{"attributeType":"null","col":22,"comment":"null","endLoc":901,"id":12134,"name":"lex","nodeType":"Attribute","startLoc":901,"text":"lex"},{"attributeType":"null","col":4,"comment":"null","endLoc":902,"id":12135,"name":"lexer","nodeType":"Attribute","startLoc":902,"text":"lexer"},{"attributeType":"null","col":4,"comment":"null","endLoc":906,"id":12136,"name":"f","nodeType":"Attribute","startLoc":906,"text":"f"},{"attributeType":"null","col":4,"comment":"null","endLoc":907,"id":12137,"name":"input","nodeType":"Attribute","startLoc":907,"text":"input"},{"attributeType":"Preprocessor","col":4,"comment":"null","endLoc":909,"id":12138,"name":"p","nodeType":"Attribute","startLoc":909,"text":"p"},{"attributeType":"None","col":8,"comment":"null","endLoc":912,"id":12139,"name":"tok","nodeType":"Attribute","startLoc":912,"text":"tok"},{"col":4,"comment":"null","endLoc":1866,"header":"def compute_first(self)","id":12140,"name":"compute_first","nodeType":"Function","startLoc":1838,"text":"def compute_first(self):\n        if self.First:\n            return self.First\n\n        # Terminals:\n        for t in self.Terminals:\n            self.First[t] = [t]\n\n        self.First['$end'] = ['$end']\n\n        # Nonterminals:\n\n        # Initialize to the empty set:\n        for n in self.Nonterminals:\n            self.First[n] = []\n\n        # Then propagate symbols until no change:\n        while True:\n            some_change = False\n            for n in self.Nonterminals:\n                for p in self.Prodnames[n]:\n                    for f in self._first(p.prod):\n                        if f not in self.First[n]:\n                            self.First[n].append(f)\n                            some_change = True\n            if not some_change:\n                break\n\n        return self.First"},{"col":0,"comment":"","endLoc":10,"header":"cpp.py#<anonymous>","id":12141,"name":"<anonymous>","nodeType":"Function","startLoc":10,"text":"if sys.version_info.major < 3:\n    STRING_TYPES = (str, unicode)\nelse:\n    STRING_TYPES = str\n    xrange = range\n\ntokens = (\n   'CPP_ID','CPP_INTEGER', 'CPP_FLOAT', 'CPP_STRING', 'CPP_CHAR', 'CPP_WS', 'CPP_COMMENT1', 'CPP_COMMENT2', 'CPP_POUND','CPP_DPOUND'\n)\n\nliterals = \"+-*/%|&~^<>=!?()[]{}.,;:\\\\\\'\\\"\"\n\nt_CPP_POUND = r'\\#'\n\nt_CPP_DPOUND = r'\\#\\#'\n\nt_CPP_ID = r'[A-Za-z_][\\w_]*'\n\nt_CPP_INTEGER = CPP_INTEGER\n\nt_CPP_FLOAT = r'((\\d+)(\\.\\d+)(e(\\+|-)?(\\d+))? | (\\d+)e(\\+|-)?(\\d+))([lL]|[fF])?'\n\n_trigraph_pat = re.compile(r'''\\?\\?[=/\\'\\(\\)\\!<>\\-]''')\n\n_trigraph_rep = {\n    '=':'#',\n    '/':'\\\\',\n    \"'\":'^',\n    '(':'[',\n    ')':']',\n    '!':'|',\n    '<':'{',\n    '>':'}',\n    '-':'~'\n}\n\nif __name__ == '__main__':\n    import ply.lex as lex\n    lexer = lex.lex()\n\n    # Run a preprocessor\n    import sys\n    f = open(sys.argv[1])\n    input = f.read()\n\n    p = Preprocessor(lexer)\n    p.parse(input,sys.argv[1])\n    while True:\n        tok = p.token()\n        if not tok: break\n        print(p.source, tok)"},{"fileName":"__init__.py","filePath":"astropy/nddata/mixins","id":12142,"nodeType":"File","text":""},{"col":0,"comment":"null","endLoc":44,"header":"def create_two_equal_wcs(naxis)","id":12143,"name":"create_two_equal_wcs","nodeType":"Function","startLoc":36,"text":"def create_two_equal_wcs(naxis):\n    return [\n        _create_wcs_simple(\n            naxis=naxis, ctype=[\"deg\"]*naxis, crpix=[10]*naxis,\n            crval=[10]*naxis, cdelt=[1]*naxis),\n        _create_wcs_simple(\n            naxis=naxis, ctype=[\"deg\"]*naxis, crpix=[10]*naxis,\n            crval=[10]*naxis, cdelt=[1]*naxis)\n    ]"},{"col":0,"comment":"null","endLoc":55,"header":"def create_two_unequal_wcs(naxis)","id":12144,"name":"create_two_unequal_wcs","nodeType":"Function","startLoc":47,"text":"def create_two_unequal_wcs(naxis):\n    return [\n        _create_wcs_simple(\n            naxis=naxis, ctype=[\"deg\"]*naxis, crpix=[10]*naxis,\n            crval=[10]*naxis, cdelt=[1]*naxis),\n        _create_wcs_simple(\n            naxis=naxis, ctype=[\"m\"]*naxis, crpix=[20]*naxis,\n            crval=[20]*naxis, cdelt=[2]*naxis),\n    ]"},{"col":0,"comment":"","endLoc":2,"header":"_testing.py#<anonymous>","id":12145,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"Testing utilities. Not part of the public API!\"\"\""},{"id":12146,"name":"astropy/nddata/mixins/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/nddata/mixins/tests","id":12147,"nodeType":"File","text":""},{"id":12148,"name":".circleci","nodeType":"Package"},{"id":12149,"name":"config.yml","nodeType":"TextFile","path":".circleci","text":"version: 2\n\n# NOTE: We run these in CircleCI because it has better artifacts support\n# and it is possible to publish image diffs as HTML like pytest-mpl in the future.\njobs:\n\n  image-tests-mpl311:\n    docker:\n      - image: circleci/python:3.9\n    steps:\n      - checkout\n      - run:\n          name: Install dependencies\n          command: |\n              sudo apt install texlive texlive-latex-extra texlive-fonts-recommended dvipng cm-super\n              pip install pip tox --upgrade\n      - run:\n          name: Run tests\n          command: tox -e py39-test-image-mpl311 -- -P visualization --remote-data=astropy --open-files --mpl --mpl-results-path=$PWD/results -W ignore:np.asscalar -W ignore::DeprecationWarning -k \"not test_no_numpy_warnings\"\n      - store_artifacts:\n          path: results\n\n  image-tests-mpldev:\n    docker:\n      - image: circleci/python:3.9\n    steps:\n      - checkout\n      - run:\n          name: Install dependencies\n          command: |\n              sudo apt install texlive texlive-latex-extra texlive-fonts-recommended dvipng cm-super\n              pip install pip tox --upgrade\n      - run:\n          name: Run tests\n          command: tox -e py39-test-image-mpldev -- -P visualization --remote-data=astropy --open-files --mpl-results-path=$PWD/results -W ignore:np.asscalar\n      - store_artifacts:\n          path: results\n\nworkflows:\n  version: 2\n  tests:\n    jobs:\n      - image-tests-mpl311\n      - image-tests-mpldev\n"},{"id":12150,"name":"astropy/modeling","nodeType":"Package"},{"fileName":"separable.py","filePath":"astropy/modeling","id":12151,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nFunctions to determine if a model is separable, i.e.\nif the model outputs are independent.\n\nIt analyzes ``n_inputs``, ``n_outputs`` and the operators\nin a compound model by stepping through the transforms\nand creating a ``coord_matrix`` of shape (``n_outputs``, ``n_inputs``).\n\n\nEach modeling operator is represented by a function which\ntakes two simple models (or two ``coord_matrix`` arrays) and\nreturns an array of shape (``n_outputs``, ``n_inputs``).\n\n\"\"\"\n\nimport numpy as np\n\nfrom .core import Model, ModelDefinitionError, CompoundModel\nfrom .mappings import Mapping\n\n\n__all__ = [\"is_separable\", \"separability_matrix\"]\n\n\ndef is_separable(transform):\n    \"\"\"\n    A separability test for the outputs of a transform.\n\n    Parameters\n    ----------\n    transform : `~astropy.modeling.core.Model`\n        A (compound) model.\n\n    Returns\n    -------\n    is_separable : ndarray\n        A boolean array with size ``transform.n_outputs`` where\n        each element indicates whether the output is independent\n        and the result of a separable transform.\n\n    Examples\n    --------\n    >>> from astropy.modeling.models import Shift, Scale, Rotation2D, Polynomial2D\n    >>> is_separable(Shift(1) & Shift(2) | Scale(1) & Scale(2))\n        array([ True,  True]...)\n    >>> is_separable(Shift(1) & Shift(2) | Rotation2D(2))\n        array([False, False]...)\n    >>> is_separable(Shift(1) & Shift(2) | Mapping([0, 1, 0, 1]) | \\\n        Polynomial2D(1) & Polynomial2D(2))\n        array([False, False]...)\n    >>> is_separable(Shift(1) & Shift(2) | Mapping([0, 1, 0, 1]))\n        array([ True,  True,  True,  True]...)\n\n    \"\"\"\n    if transform.n_inputs == 1 and transform.n_outputs > 1:\n        is_separable = np.array([False] * transform.n_outputs).T\n        return is_separable\n    separable_matrix = _separable(transform)\n    is_separable = separable_matrix.sum(1)\n    is_separable = np.where(is_separable != 1, False, True)\n    return is_separable\n\n\ndef separability_matrix(transform):\n    \"\"\"\n    Compute the correlation between outputs and inputs.\n\n    Parameters\n    ----------\n    transform : `~astropy.modeling.core.Model`\n        A (compound) model.\n\n    Returns\n    -------\n    separable_matrix : ndarray\n        A boolean correlation matrix of shape (n_outputs, n_inputs).\n        Indicates the dependence of outputs on inputs. For completely\n        independent outputs, the diagonal elements are True and\n        off-diagonal elements are False.\n\n    Examples\n    --------\n    >>> from astropy.modeling.models import Shift, Scale, Rotation2D, Polynomial2D\n    >>> separability_matrix(Shift(1) & Shift(2) | Scale(1) & Scale(2))\n        array([[ True, False], [False,  True]]...)\n    >>> separability_matrix(Shift(1) & Shift(2) | Rotation2D(2))\n        array([[ True,  True], [ True,  True]]...)\n    >>> separability_matrix(Shift(1) & Shift(2) | Mapping([0, 1, 0, 1]) | \\\n        Polynomial2D(1) & Polynomial2D(2))\n        array([[ True,  True], [ True,  True]]...)\n    >>> separability_matrix(Shift(1) & Shift(2) | Mapping([0, 1, 0, 1]))\n        array([[ True, False], [False,  True], [ True, False], [False,  True]]...)\n\n    \"\"\"\n    if transform.n_inputs == 1 and transform.n_outputs > 1:\n        return np.ones((transform.n_outputs, transform.n_inputs),\n                       dtype=np.bool_)\n    separable_matrix = _separable(transform)\n    separable_matrix = np.where(separable_matrix != 0, True, False)\n    return separable_matrix\n\n\ndef _compute_n_outputs(left, right):\n    \"\"\"\n    Compute the number of outputs of two models.\n\n    The two models are the left and right model to an operation in\n    the expression tree of a compound model.\n\n    Parameters\n    ----------\n    left, right : `astropy.modeling.Model` or ndarray\n        If input is of an array, it is the output of `coord_matrix`.\n\n    \"\"\"\n    if isinstance(left, Model):\n        lnout = left.n_outputs\n    else:\n        lnout = left.shape[0]\n    if isinstance(right, Model):\n        rnout = right.n_outputs\n    else:\n        rnout = right.shape[0]\n    noutp = lnout + rnout\n    return noutp\n\n\ndef _arith_oper(left, right):\n    \"\"\"\n    Function corresponding to one of the arithmetic operators\n    ['+', '-'. '*', '/', '**'].\n\n    This always returns a nonseparable output.\n\n\n    Parameters\n    ----------\n    left, right : `astropy.modeling.Model` or ndarray\n        If input is of an array, it is the output of `coord_matrix`.\n\n    Returns\n    -------\n    result : ndarray\n        Result from this operation.\n    \"\"\"\n    # models have the same number of inputs and outputs\n    def _n_inputs_outputs(input):\n        if isinstance(input, Model):\n            n_outputs, n_inputs = input.n_outputs, input.n_inputs\n        else:\n            n_outputs, n_inputs = input.shape\n        return n_inputs, n_outputs\n\n    left_inputs, left_outputs = _n_inputs_outputs(left)\n    right_inputs, right_outputs = _n_inputs_outputs(right)\n\n    if left_inputs != right_inputs or left_outputs != right_outputs:\n        raise ModelDefinitionError(\n            \"Unsupported operands for arithmetic operator: left (n_inputs={}, \"\n            \"n_outputs={}) and right (n_inputs={}, n_outputs={}); \"\n            \"models must have the same n_inputs and the same \"\n            \"n_outputs for this operator.\".format(\n                left_inputs, left_outputs, right_inputs, right_outputs))\n\n    result = np.ones((left_outputs, left_inputs))\n    return result\n\n\ndef _coord_matrix(model, pos, noutp):\n    \"\"\"\n    Create an array representing inputs and outputs of a simple model.\n\n    The array has a shape (noutp, model.n_inputs).\n\n    Parameters\n    ----------\n    model : `astropy.modeling.Model`\n        model\n    pos : str\n        Position of this model in the expression tree.\n        One of ['left', 'right'].\n    noutp : int\n        Number of outputs of the compound model of which the input model\n        is a left or right child.\n\n    \"\"\"\n    if isinstance(model, Mapping):\n        axes = []\n        for i in model.mapping:\n            axis = np.zeros((model.n_inputs,))\n            axis[i] = 1\n            axes.append(axis)\n        m = np.vstack(axes)\n        mat = np.zeros((noutp, model.n_inputs))\n        if pos == 'left':\n            mat[: model.n_outputs, :model.n_inputs] = m\n        else:\n            mat[-model.n_outputs:, -model.n_inputs:] = m\n        return mat\n    if not model.separable:\n        # this does not work for more than 2 coordinates\n        mat = np.zeros((noutp, model.n_inputs))\n        if pos == 'left':\n            mat[:model.n_outputs, : model.n_inputs] = 1\n        else:\n            mat[-model.n_outputs:, -model.n_inputs:] = 1\n    else:\n        mat = np.zeros((noutp, model.n_inputs))\n\n        for i in range(model.n_inputs):\n            mat[i, i] = 1\n        if pos == 'right':\n            mat = np.roll(mat, (noutp - model.n_outputs))\n    return mat\n\n\ndef _cstack(left, right):\n    \"\"\"\n    Function corresponding to '&' operation.\n\n    Parameters\n    ----------\n    left, right : `astropy.modeling.Model` or ndarray\n        If input is of an array, it is the output of `coord_matrix`.\n\n    Returns\n    -------\n    result : ndarray\n        Result from this operation.\n\n    \"\"\"\n    noutp = _compute_n_outputs(left, right)\n\n    if isinstance(left, Model):\n        cleft = _coord_matrix(left, 'left', noutp)\n    else:\n        cleft = np.zeros((noutp, left.shape[1]))\n        cleft[: left.shape[0], : left.shape[1]] = left\n    if isinstance(right, Model):\n        cright = _coord_matrix(right, 'right', noutp)\n    else:\n        cright = np.zeros((noutp, right.shape[1]))\n        cright[-right.shape[0]:, -right.shape[1]:] = 1\n\n    return np.hstack([cleft, cright])\n\n\ndef _cdot(left, right):\n    \"\"\"\n    Function corresponding to \"|\" operation.\n\n    Parameters\n    ----------\n    left, right : `astropy.modeling.Model` or ndarray\n        If input is of an array, it is the output of `coord_matrix`.\n\n    Returns\n    -------\n    result : ndarray\n        Result from this operation.\n    \"\"\"\n\n    left, right = right, left\n\n    def _n_inputs_outputs(input, position):\n        \"\"\"\n        Return ``n_inputs``, ``n_outputs`` for a model or coord_matrix.\n        \"\"\"\n        if isinstance(input, Model):\n            coords = _coord_matrix(input, position, input.n_outputs)\n        else:\n            coords = input\n        return coords\n\n    cleft = _n_inputs_outputs(left, 'left')\n    cright = _n_inputs_outputs(right, 'right')\n\n    try:\n        result = np.dot(cleft, cright)\n    except ValueError:\n        raise ModelDefinitionError(\n            'Models cannot be combined with the \"|\" operator; '\n            'left coord_matrix is {}, right coord_matrix is {}'.format(\n                cright, cleft))\n    return result\n\n\ndef _separable(transform):\n    \"\"\"\n    Calculate the separability of outputs.\n\n    Parameters\n    ----------\n    transform : `astropy.modeling.Model`\n        A transform (usually a compound model).\n\n    Returns :\n    is_separable : ndarray of dtype np.bool\n        An array of shape (transform.n_outputs,) of boolean type\n        Each element represents the separablity of the corresponding output.\n    \"\"\"\n    if (transform_matrix := transform._calculate_separability_matrix()) is not NotImplemented:\n        return transform_matrix\n    elif isinstance(transform, CompoundModel):\n        sepleft = _separable(transform.left)\n        sepright = _separable(transform.right)\n        return _operators[transform.op](sepleft, sepright)\n    elif isinstance(transform, Model):\n        return _coord_matrix(transform, 'left', transform.n_outputs)\n\n\n# Maps modeling operators to a function computing and represents the\n# relationship of axes as an array of 0-es and 1-s\n_operators = {'&': _cstack, '|': _cdot, '+': _arith_oper, '-': _arith_oper,\n              '*': _arith_oper, '/': _arith_oper, '**': _arith_oper}\n"},{"fileName":"utils.py","filePath":"astropy/modeling","id":12152,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module provides utility functions for the models package.\n\"\"\"\n# pylint: disable=invalid-name\nfrom collections import UserDict\nfrom collections.abc import MutableMapping\nfrom inspect import signature\n\nimport numpy as np\nimport warnings\n\nfrom astropy import units as u\nfrom astropy.utils.decorators import deprecated\n\n__doctest_skip__ = ['AliasDict']\n__all__ = ['AliasDict', 'poly_map_domain', 'comb', 'ellipse_extent']\n\n\ndeprecation_msg = \"\"\"\nAliasDict is deprecated because it no longer serves a function anywhere\ninside astropy.\n\"\"\"\n\n\n@deprecated('5.0', deprecation_msg)\nclass AliasDict(MutableMapping):\n    \"\"\"\n    Creates a `dict` like object that wraps an existing `dict` or other\n    `MutableMapping`, along with a `dict` of *key aliases* that translate\n    between specific keys in this dict to different keys in the underlying\n    dict.\n\n    In other words, keys that do not have an associated alias are accessed and\n    stored like a normal `dict`.  However, a key that has an alias is accessed\n    and stored to the \"parent\" dict via the alias.\n\n    Parameters\n    ----------\n    parent : dict-like\n        The parent `dict` that aliased keys and accessed from and stored to.\n\n    aliases : dict-like\n        Maps keys in this dict to their associated keys in the parent dict.\n\n    Examples\n    --------\n\n    >>> parent = {'a': 1, 'b': 2, 'c': 3}\n    >>> aliases = {'foo': 'a', 'bar': 'c'}\n    >>> alias_dict = AliasDict(parent, aliases)\n    >>> alias_dict['foo']\n    1\n    >>> alias_dict['bar']\n    3\n\n    Keys in the original parent dict are not visible if they were not\n    aliased:\n\n    >>> alias_dict['b']\n    Traceback (most recent call last):\n    ...\n    KeyError: 'b'\n\n    Likewise, updates to aliased keys are reflected back in the parent dict:\n\n    >>> alias_dict['foo'] = 42\n    >>> alias_dict['foo']\n    42\n    >>> parent['a']\n    42\n\n    However, updates/insertions to keys that are *not* aliased are not\n    reflected in the parent dict:\n\n    >>> alias_dict['qux'] = 99\n    >>> alias_dict['qux']\n    99\n    >>> 'qux' in parent\n    False\n\n    In particular, updates on the `AliasDict` to a key that is equal to\n    one of the aliased keys in the parent dict does *not* update the parent\n    dict.  For example, ``alias_dict`` aliases ``'foo'`` to ``'a'``.  But\n    assigning to a key ``'a'`` on the `AliasDict` does not impact the\n    parent:\n\n    >>> alias_dict['a'] = 'nope'\n    >>> alias_dict['a']\n    'nope'\n    >>> parent['a']\n    42\n    \"\"\"\n\n    _store_type = dict\n    \"\"\"\n    Subclasses may override this to use other mapping types as the underlying\n    storage, for example an `OrderedDict`.  However, even in this case\n    additional work may be needed to get things like the ordering right.\n    \"\"\"\n\n    def __init__(self, parent, aliases):\n        self._parent = parent\n        self._store = self._store_type()\n        self._aliases = dict(aliases)\n\n    def __getitem__(self, key):\n        if key in self._aliases:\n            try:\n                return self._parent[self._aliases[key]]\n            except KeyError:\n                raise KeyError(key)\n\n        return self._store[key]\n\n    def __setitem__(self, key, value):\n        if key in self._aliases:\n            self._parent[self._aliases[key]] = value\n        else:\n            self._store[key] = value\n\n    def __delitem__(self, key):\n        if key in self._aliases:\n            try:\n                del self._parent[self._aliases[key]]\n            except KeyError:\n                raise KeyError(key)\n        else:\n            del self._store[key]\n\n    def __iter__(self):\n        \"\"\"\n        First iterates over keys from the parent dict (if the aliased keys are\n        present in the parent), followed by any keys in the local store.\n        \"\"\"\n\n        for key, alias in self._aliases.items():\n            if alias in self._parent:\n                yield key\n\n        for key in self._store:\n            yield key\n\n    def __len__(self):\n        return len(list(iter(self)))\n\n    def __repr__(self):\n        # repr() just like any other dict--this should look transparent\n        store_copy = self._store_type()\n        for key, alias in self._aliases.items():\n            if alias in self._parent:\n                store_copy[key] = self._parent[alias]\n\n        store_copy.update(self._store)\n\n        return repr(store_copy)\n\n\ndef make_binary_operator_eval(oper, f, g):\n    \"\"\"\n    Given a binary operator (as a callable of two arguments) ``oper`` and\n    two callables ``f`` and ``g`` which accept the same arguments,\n    returns a *new* function that takes the same arguments as ``f`` and ``g``,\n    but passes the outputs of ``f`` and ``g`` in the given ``oper``.\n\n    ``f`` and ``g`` are assumed to return tuples (which may be 1-tuples).  The\n    given operator is applied element-wise to tuple outputs).\n\n    Example\n    -------\n\n    >>> from operator import add\n    >>> def prod(x, y):\n    ...     return (x * y,)\n    ...\n    >>> sum_of_prod = make_binary_operator_eval(add, prod, prod)\n    >>> sum_of_prod(3, 5)\n    (30,)\n    \"\"\"\n\n    return lambda inputs, params: \\\n            tuple(oper(x, y) for x, y in zip(f(inputs, params),\n                                             g(inputs, params)))\n\n\ndef poly_map_domain(oldx, domain, window):\n    \"\"\"\n    Map domain into window by shifting and scaling.\n\n    Parameters\n    ----------\n    oldx : array\n          original coordinates\n    domain : list or tuple of length 2\n          function domain\n    window : list or tuple of length 2\n          range into which to map the domain\n    \"\"\"\n    domain = np.array(domain, dtype=np.float64)\n    window = np.array(window, dtype=np.float64)\n    if domain.shape != (2,) or window.shape != (2,):\n        raise ValueError('Expected \"domain\" and \"window\" to be a tuple of size 2.')\n    scl = (window[1] - window[0]) / (domain[1] - domain[0])\n    off = (window[0] * domain[1] - window[1] * domain[0]) / (domain[1] - domain[0])\n    return off + scl * oldx\n\n\ndef _validate_domain_window(value):\n    if value is not None:\n        if np.asanyarray(value).shape != (2, ):\n            raise ValueError('domain and window should be tuples of size 2.')\n        return tuple(value)\n    return value\n\n\ndef comb(N, k):\n    \"\"\"\n    The number of combinations of N things taken k at a time.\n\n    Parameters\n    ----------\n    N : int, array\n        Number of things.\n    k : int, array\n        Number of elements taken.\n\n    \"\"\"\n    if (k > N) or (N < 0) or (k < 0):\n        return 0\n    val = 1\n    for j in range(min(k, N - k)):\n        val = (val * (N - j)) / (j + 1)\n    return val\n\n\ndef array_repr_oneline(array):\n    \"\"\"\n    Represents a multi-dimensional Numpy array flattened onto a single line.\n    \"\"\"\n    r = np.array2string(array, separator=', ', suppress_small=True)\n    return ' '.join(l.strip() for l in r.splitlines())\n\n\ndef combine_labels(left, right):\n    \"\"\"\n    For use with the join operator &: Combine left input/output labels with\n    right input/output labels.\n\n    If none of the labels conflict then this just returns a sum of tuples.\n    However if *any* of the labels conflict, this appends '0' to the left-hand\n    labels and '1' to the right-hand labels so there is no ambiguity).\n    \"\"\"\n\n    if set(left).intersection(right):\n        left = tuple(l + '0' for l in left)\n        right = tuple(r + '1' for r in right)\n\n    return left + right\n\n\ndef ellipse_extent(a, b, theta):\n    \"\"\"\n    Calculates the extent of a box encapsulating a rotated 2D ellipse.\n\n    Parameters\n    ----------\n    a : float or `~astropy.units.Quantity`\n        Major axis.\n    b : float or `~astropy.units.Quantity`\n        Minor axis.\n    theta : float or `~astropy.units.Quantity` ['angle']\n        Rotation angle. If given as a floating-point value, it is assumed to be\n        in radians.\n\n    Returns\n    -------\n    offsets : tuple\n        The absolute value of the offset distances from the ellipse center that\n        define its bounding box region, ``(dx, dy)``.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n        from astropy.modeling.models import Ellipse2D\n        from astropy.modeling.utils import ellipse_extent, render_model\n\n        amplitude = 1\n        x0 = 50\n        y0 = 50\n        a = 30\n        b = 10\n        theta = np.pi/4\n\n        model = Ellipse2D(amplitude, x0, y0, a, b, theta)\n\n        dx, dy = ellipse_extent(a, b, theta)\n\n        limits = [x0 - dx, x0 + dx, y0 - dy, y0 + dy]\n\n        model.bounding_box = limits\n\n        image = render_model(model)\n\n        plt.imshow(image, cmap='binary', interpolation='nearest', alpha=.5,\n                  extent = limits)\n        plt.show()\n    \"\"\"\n\n    t = np.arctan2(-b * np.tan(theta), a)\n    dx = a * np.cos(t) * np.cos(theta) - b * np.sin(t) * np.sin(theta)\n\n    t = np.arctan2(b, a * np.tan(theta))\n    dy = b * np.sin(t) * np.cos(theta) + a * np.cos(t) * np.sin(theta)\n\n    if isinstance(dx, u.Quantity) or isinstance(dy, u.Quantity):\n        return np.abs(u.Quantity([dx, dy]))\n    return np.abs([dx, dy])\n\n\ndef get_inputs_and_params(func):\n    \"\"\"\n    Given a callable, determine the input variables and the\n    parameters.\n\n    Parameters\n    ----------\n    func : callable\n\n    Returns\n    -------\n    inputs, params : tuple\n        Each entry is a list of inspect.Parameter objects\n    \"\"\"\n    sig = signature(func)\n\n    inputs = []\n    params = []\n    for param in sig.parameters.values():\n        if param.kind in (param.VAR_POSITIONAL, param.VAR_KEYWORD):\n            raise ValueError(\"Signature must not have *args or **kwargs\")\n        if param.default == param.empty:\n            inputs.append(param)\n        else:\n            params.append(param)\n\n    return inputs, params\n\n\ndef _combine_equivalency_dict(keys, eq1=None, eq2=None):\n    # Given two dictionaries that give equivalencies for a set of keys, for\n    # example input value names, return a dictionary that includes all the\n    # equivalencies\n    eq = {}\n    for key in keys:\n        eq[key] = []\n        if eq1 is not None and key in eq1:\n            eq[key].extend(eq1[key])\n        if eq2 is not None and key in eq2:\n            eq[key].extend(eq2[key])\n    return eq\n\n\ndef _to_radian(value):\n    \"\"\" Convert ``value`` to radian. \"\"\"\n    if isinstance(value, u.Quantity):\n        return value.to(u.rad)\n    return np.deg2rad(value)\n\n\ndef _to_orig_unit(value, raw_unit=None, orig_unit=None):\n    \"\"\" Convert value with ``raw_unit`` to ``orig_unit``. \"\"\"\n    if raw_unit is not None:\n        return (value * raw_unit).to(orig_unit)\n    return np.rad2deg(value)\n\n\nclass _ConstraintsDict(UserDict):\n    \"\"\"\n    Wrapper around UserDict to allow updating the constraints\n    on a Parameter when the dictionary is updated.\n    \"\"\"\n    def __init__(self, model, constraint_type):\n        self._model = model\n        self.constraint_type = constraint_type\n        c = {}\n        for name in model.param_names:\n            param = getattr(model, name)\n            c[name] = getattr(param, constraint_type)\n        super().__init__(c)\n\n    def __setitem__(self, key, val):\n        super().__setitem__(key, val)\n        param = getattr(self._model, key)\n        setattr(param, self.constraint_type, val)\n\n\nclass _SpecialOperatorsDict(UserDict):\n    \"\"\"\n    Wrapper around UserDict to allow for better tracking of the Special\n    Operators for CompoundModels. This dictionary is structured so that\n    one cannot inadvertently overwrite an existing special operator.\n\n    Parameters\n    ----------\n    unique_id: int\n        the last used unique_id for a SPECIAL OPERATOR\n    special_operators: dict\n        a dictionary containing the special_operators\n\n    Notes\n    -----\n    Direct setting of operators (`dict[key] = value`) into the\n    dictionary has been deprecated in favor of the `.add(name, value)`\n    method, so that unique dictionary keys can be generated and tracked\n    consistently.\n    \"\"\"\n\n    def __init__(self, unique_id=0, special_operators={}):\n        super().__init__(special_operators)\n        self._unique_id = unique_id\n\n    def _set_value(self, key, val):\n        if key in self:\n            raise ValueError(f'Special operator \"{key}\" already exists')\n        else:\n            super().__setitem__(key, val)\n\n    def __setitem__(self, key, val):\n        self._set_value(key, val)\n        warnings.warn(DeprecationWarning(\n            \"\"\"\n            Special operator dictionary assignment has been deprecated.\n            Please use `.add` instead, so that you can capture a unique\n            key for your operator.\n            \"\"\"\n        ))\n\n    def _get_unique_id(self):\n        self._unique_id += 1\n\n        return self._unique_id\n\n    def add(self, operator_name, operator):\n        \"\"\"\n        Adds a special operator to the dictionary, and then returns the\n        unique key that the operator is stored under for later reference.\n\n        Parameters\n        ----------\n        operator_name: str\n            the name for the operator\n        operator: function\n            the actual operator function which will be used\n\n        Returns\n        -------\n        the unique operator key for the dictionary\n            `(operator_name, unique_id)`\n        \"\"\"\n        key = (operator_name, self._get_unique_id())\n\n        self._set_value(key, operator)\n\n        return key\n"},{"className":"AliasDict","col":0,"comment":"\n    Creates a `dict` like object that wraps an existing `dict` or other\n    `MutableMapping`, along with a `dict` of *key aliases* that translate\n    between specific keys in this dict to different keys in the underlying\n    dict.\n\n    In other words, keys that do not have an associated alias are accessed and\n    stored like a normal `dict`.  However, a key that has an alias is accessed\n    and stored to the \"parent\" dict via the alias.\n\n    Parameters\n    ----------\n    parent : dict-like\n        The parent `dict` that aliased keys and accessed from and stored to.\n\n    aliases : dict-like\n        Maps keys in this dict to their associated keys in the parent dict.\n\n    Examples\n    --------\n\n    >>> parent = {'a': 1, 'b': 2, 'c': 3}\n    >>> aliases = {'foo': 'a', 'bar': 'c'}\n    >>> alias_dict = AliasDict(parent, aliases)\n    >>> alias_dict['foo']\n    1\n    >>> alias_dict['bar']\n    3\n\n    Keys in the original parent dict are not visible if they were not\n    aliased:\n\n    >>> alias_dict['b']\n    Traceback (most recent call last):\n    ...\n    KeyError: 'b'\n\n    Likewise, updates to aliased keys are reflected back in the parent dict:\n\n    >>> alias_dict['foo'] = 42\n    >>> alias_dict['foo']\n    42\n    >>> parent['a']\n    42\n\n    However, updates/insertions to keys that are *not* aliased are not\n    reflected in the parent dict:\n\n    >>> alias_dict['qux'] = 99\n    >>> alias_dict['qux']\n    99\n    >>> 'qux' in parent\n    False\n\n    In particular, updates on the `AliasDict` to a key that is equal to\n    one of the aliased keys in the parent dict does *not* update the parent\n    dict.  For example, ``alias_dict`` aliases ``'foo'`` to ``'a'``.  But\n    assigning to a key ``'a'`` on the `AliasDict` does not impact the\n    parent:\n\n    >>> alias_dict['a'] = 'nope'\n    >>> alias_dict['a']\n    'nope'\n    >>> parent['a']\n    42\n    ","endLoc":157,"id":12153,"nodeType":"Class","startLoc":27,"text":"@deprecated('5.0', deprecation_msg)\nclass AliasDict(MutableMapping):\n    \"\"\"\n    Creates a `dict` like object that wraps an existing `dict` or other\n    `MutableMapping`, along with a `dict` of *key aliases* that translate\n    between specific keys in this dict to different keys in the underlying\n    dict.\n\n    In other words, keys that do not have an associated alias are accessed and\n    stored like a normal `dict`.  However, a key that has an alias is accessed\n    and stored to the \"parent\" dict via the alias.\n\n    Parameters\n    ----------\n    parent : dict-like\n        The parent `dict` that aliased keys and accessed from and stored to.\n\n    aliases : dict-like\n        Maps keys in this dict to their associated keys in the parent dict.\n\n    Examples\n    --------\n\n    >>> parent = {'a': 1, 'b': 2, 'c': 3}\n    >>> aliases = {'foo': 'a', 'bar': 'c'}\n    >>> alias_dict = AliasDict(parent, aliases)\n    >>> alias_dict['foo']\n    1\n    >>> alias_dict['bar']\n    3\n\n    Keys in the original parent dict are not visible if they were not\n    aliased:\n\n    >>> alias_dict['b']\n    Traceback (most recent call last):\n    ...\n    KeyError: 'b'\n\n    Likewise, updates to aliased keys are reflected back in the parent dict:\n\n    >>> alias_dict['foo'] = 42\n    >>> alias_dict['foo']\n    42\n    >>> parent['a']\n    42\n\n    However, updates/insertions to keys that are *not* aliased are not\n    reflected in the parent dict:\n\n    >>> alias_dict['qux'] = 99\n    >>> alias_dict['qux']\n    99\n    >>> 'qux' in parent\n    False\n\n    In particular, updates on the `AliasDict` to a key that is equal to\n    one of the aliased keys in the parent dict does *not* update the parent\n    dict.  For example, ``alias_dict`` aliases ``'foo'`` to ``'a'``.  But\n    assigning to a key ``'a'`` on the `AliasDict` does not impact the\n    parent:\n\n    >>> alias_dict['a'] = 'nope'\n    >>> alias_dict['a']\n    'nope'\n    >>> parent['a']\n    42\n    \"\"\"\n\n    _store_type = dict\n    \"\"\"\n    Subclasses may override this to use other mapping types as the underlying\n    storage, for example an `OrderedDict`.  However, even in this case\n    additional work may be needed to get things like the ordering right.\n    \"\"\"\n\n    def __init__(self, parent, aliases):\n        self._parent = parent\n        self._store = self._store_type()\n        self._aliases = dict(aliases)\n\n    def __getitem__(self, key):\n        if key in self._aliases:\n            try:\n                return self._parent[self._aliases[key]]\n            except KeyError:\n                raise KeyError(key)\n\n        return self._store[key]\n\n    def __setitem__(self, key, value):\n        if key in self._aliases:\n            self._parent[self._aliases[key]] = value\n        else:\n            self._store[key] = value\n\n    def __delitem__(self, key):\n        if key in self._aliases:\n            try:\n                del self._parent[self._aliases[key]]\n            except KeyError:\n                raise KeyError(key)\n        else:\n            del self._store[key]\n\n    def __iter__(self):\n        \"\"\"\n        First iterates over keys from the parent dict (if the aliased keys are\n        present in the parent), followed by any keys in the local store.\n        \"\"\"\n\n        for key, alias in self._aliases.items():\n            if alias in self._parent:\n                yield key\n\n        for key in self._store:\n            yield key\n\n    def __len__(self):\n        return len(list(iter(self)))\n\n    def __repr__(self):\n        # repr() just like any other dict--this should look transparent\n        store_copy = self._store_type()\n        for key, alias in self._aliases.items():\n            if alias in self._parent:\n                store_copy[key] = self._parent[alias]\n\n        store_copy.update(self._store)\n\n        return repr(store_copy)"},{"col":4,"comment":"null","endLoc":106,"header":"def __init__(self, parent, aliases)","id":12154,"name":"__init__","nodeType":"Function","startLoc":103,"text":"def __init__(self, parent, aliases):\n        self._parent = parent\n        self._store = self._store_type()\n        self._aliases = dict(aliases)"},{"col":4,"comment":"null","endLoc":1916,"header":"def compute_follow(self, start=None)","id":12155,"name":"compute_follow","nodeType":"Function","startLoc":1875,"text":"def compute_follow(self, start=None):\n        # If already computed, return the result\n        if self.Follow:\n            return self.Follow\n\n        # If first sets not computed yet, do that first.\n        if not self.First:\n            self.compute_first()\n\n        # Add '$end' to the follow list of the start symbol\n        for k in self.Nonterminals:\n            self.Follow[k] = []\n\n        if not start:\n            start = self.Productions[1].name\n\n        self.Follow[start] = ['$end']\n\n        while True:\n            didadd = False\n            for p in self.Productions[1:]:\n                # Here is the production set\n                for i, B in enumerate(p.prod):\n                    if B in self.Nonterminals:\n                        # Okay. We got a non-terminal in a production\n                        fst = self._first(p.prod[i+1:])\n                        hasempty = False\n                        for f in fst:\n                            if f != '<empty>' and f not in self.Follow[B]:\n                                self.Follow[B].append(f)\n                                didadd = True\n                            if f == '<empty>':\n                                hasempty = True\n                        if hasempty or i == (len(p.prod)-1):\n                            # Add elements of follow(a) to follow(b)\n                            for f in self.Follow[p.name]:\n                                if f not in self.Follow[B]:\n                                    self.Follow[B].append(f)\n                                    didadd = True\n            if not didadd:\n                break\n        return self.Follow"},{"col":4,"comment":"null","endLoc":59,"header":"def __call__(self, *args, **kwargs)","id":12156,"name":"__call__","nodeType":"Function","startLoc":58,"text":"def __call__(self, *args, **kwargs):\n        return self.registry.read(self._cls, *args, **kwargs)"},{"col":0,"comment":"null","endLoc":71,"header":"def _uncertainty_unit_equivalent_to_parent(uncertainty_type, unit, parent_unit)","id":12157,"name":"_uncertainty_unit_equivalent_to_parent","nodeType":"Function","startLoc":64,"text":"def _uncertainty_unit_equivalent_to_parent(uncertainty_type, unit, parent_unit):\n    if uncertainty_type is StdDevUncertainty:\n        return unit == parent_unit\n    elif uncertainty_type is VarianceUncertainty:\n        return unit == (parent_unit ** 2)\n    elif uncertainty_type is InverseVariance:\n        return unit == (1 / (parent_unit ** 2))\n    raise ValueError(f\"unsupported uncertainty type: {uncertainty_type}\")"},{"className":"NDDataWrite","col":0,"comment":"Write this CCDData object out in the specified format.\n\n    This function provides the NDData interface to the astropy unified I/O\n    layer.  This allows easily writing a file in many supported data formats\n    using syntax such as::\n\n      >>> from astropy.nddata import CCDData\n      >>> dat = CCDData(np.zeros((12, 12)), unit='adu')  # 12x12 image of zeros\n      >>> dat.write('zeros.fits')\n\n    Get help on the available writers for ``CCDData`` using the``help()`` method::\n\n      >>> CCDData.write.help()  # Get help writing CCDData and list supported formats\n      >>> CCDData.write.help('fits')  # Get detailed help on CCDData FITS writer\n      >>> CCDData.write.list_formats()  # Print list of available formats\n\n    See also:\n\n    - https://docs.astropy.org/en/stable/nddata\n    - https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    *args : tuple, optional\n        Positional arguments passed through to data writer. If supplied the\n        first argument is the output filename.\n    format : str, optional\n        File format specifier.\n    **kwargs : dict, optional\n        Keyword arguments passed through to data writer.\n\n    Notes\n    -----\n    ","endLoc":103,"id":12158,"nodeType":"Class","startLoc":62,"text":"class NDDataWrite(registry.UnifiedReadWrite):\n    \"\"\"Write this CCDData object out in the specified format.\n\n    This function provides the NDData interface to the astropy unified I/O\n    layer.  This allows easily writing a file in many supported data formats\n    using syntax such as::\n\n      >>> from astropy.nddata import CCDData\n      >>> dat = CCDData(np.zeros((12, 12)), unit='adu')  # 12x12 image of zeros\n      >>> dat.write('zeros.fits')\n\n    Get help on the available writers for ``CCDData`` using the``help()`` method::\n\n      >>> CCDData.write.help()  # Get help writing CCDData and list supported formats\n      >>> CCDData.write.help('fits')  # Get detailed help on CCDData FITS writer\n      >>> CCDData.write.list_formats()  # Print list of available formats\n\n    See also:\n\n    - https://docs.astropy.org/en/stable/nddata\n    - https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    *args : tuple, optional\n        Positional arguments passed through to data writer. If supplied the\n        first argument is the output filename.\n    format : str, optional\n        File format specifier.\n    **kwargs : dict, optional\n        Keyword arguments passed through to data writer.\n\n    Notes\n    -----\n    \"\"\"\n\n    def __init__(self, instance, cls):\n        super().__init__(instance, cls, 'write', registry=None)\n        # uses default global registry\n\n    def __call__(self, *args, **kwargs):\n        self.registry.write(self._instance, *args, **kwargs)"},{"col":4,"comment":"null","endLoc":100,"header":"def __init__(self, instance, cls)","id":12159,"name":"__init__","nodeType":"Function","startLoc":98,"text":"def __init__(self, instance, cls):\n        super().__init__(instance, cls, 'write', registry=None)\n        # uses default global registry"},{"col":4,"comment":"null","endLoc":103,"header":"def __call__(self, *args, **kwargs)","id":12160,"name":"__call__","nodeType":"Function","startLoc":102,"text":"def __call__(self, *args, **kwargs):\n        self.registry.write(self._instance, *args, **kwargs)"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":12161,"name":"__all__","nodeType":"Attribute","startLoc":7,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":12162,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":8,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":5,"header":"ndio.py#<anonymous>","id":12163,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"__all__ = ['NDIOMixin']\n\n__doctest_skip__ = ['NDDataRead', 'NDDataWrite']"},{"fileName":"convolution.py","filePath":"astropy/modeling","id":12164,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"Convolution Model\"\"\"\n# pylint: disable=line-too-long, too-many-lines, too-many-arguments, invalid-name\nimport numpy as np\n\nfrom .core import CompoundModel, SPECIAL_OPERATORS\n\n\nclass Convolution(CompoundModel):\n    \"\"\"\n    Wrapper class for a convolution model.\n\n    Parameters\n    ----------\n    operator: tuple\n        The SPECIAL_OPERATORS entry for the convolution being used.\n    model : Model\n        The model for the convolution.\n    kernel: Model\n        The kernel model for the convolution.\n    bounding_box : tuple\n        A bounding box to define the limits of the integration\n        approximation for the convolution.\n    resolution : float\n        The resolution for the approximation of the convolution.\n    cache : bool, optional\n        Allow convolution computation to be cached for reuse. This is\n        enabled by default.\n\n    Notes\n    -----\n    This is wrapper is necessary to handle the limitations of the\n    pseudospectral convolution binary operator implemented in\n    astropy.convolution under `~astropy.convolution.convolve_fft`. In this `~astropy.convolution.convolve_fft` it\n    is assumed that the inputs ``array`` and ``kernel`` span a sufficient\n    portion of the support of the functions of the convolution.\n    Consequently, the ``Compound`` created by the `~astropy.convolution.convolve_models` function\n    makes the assumption that one should pass an input array that\n    sufficiently spans this space. This means that slightly different\n    input arrays to this model will result in different outputs, even\n    on points of intersection between these arrays.\n\n    This issue is solved by requiring a ``bounding_box`` together with a\n    resolution so that one can pre-calculate the entire domain and then\n    (by default) cache the convolution values. The function then just\n    interpolates the results from this cache.\n    \"\"\"\n\n    def __init__(self, operator, model, kernel, bounding_box, resolution, cache=True):\n        super().__init__(operator, model, kernel)\n\n        self.bounding_box = bounding_box\n        self._resolution = resolution\n\n        self._cache_convolution = cache\n        self._kwargs = None\n        self._convolution = None\n\n    def clear_cache(self):\n        \"\"\"\n        Clears the cached convolution\n        \"\"\"\n\n        self._kwargs = None\n        self._convolution = None\n\n    def _get_convolution(self, **kwargs):\n        if (self._convolution is None) or (self._kwargs != kwargs):\n            domain = self.bounding_box.domain(self._resolution)\n            mesh = np.meshgrid(*domain)\n            data = super().__call__(*mesh, **kwargs)\n\n            from scipy.interpolate import RegularGridInterpolator\n            convolution = RegularGridInterpolator(domain, data)\n\n            if self._cache_convolution:\n                self._kwargs = kwargs\n                self._convolution = convolution\n\n        else:\n            convolution = self._convolution\n\n        return convolution\n\n    @staticmethod\n    def _convolution_inputs(*args):\n        not_scalar = np.where([not np.isscalar(arg) for arg in args])[0]\n\n        if len(not_scalar) == 0:\n            return np.array(args), (1,)\n        else:\n            output_shape = args[not_scalar[0]].shape\n            if not all(args[index].shape == output_shape for index in not_scalar):\n                raise ValueError('Values have differing shapes')\n\n            inputs = []\n            for arg in args:\n                if np.isscalar(arg):\n                    inputs.append(np.full(output_shape, arg))\n                else:\n                    inputs.append(arg)\n\n            return np.reshape(inputs, (len(inputs), -1)).T, output_shape\n\n    @staticmethod\n    def _convolution_outputs(outputs, output_shape):\n        return outputs.reshape(output_shape)\n\n    def __call__(self, *args, **kw):\n        inputs, output_shape = self._convolution_inputs(*args)\n        convolution = self._get_convolution(**kw)\n        outputs = convolution(inputs)\n\n        return self._convolution_outputs(outputs, output_shape)\n"},{"col":4,"comment":"\n        Return a copy of the CCDData object.\n        ","endLoc":400,"header":"def copy(self)","id":12165,"name":"copy","nodeType":"Function","startLoc":396,"text":"def copy(self):\n        \"\"\"\n        Return a copy of the CCDData object.\n        \"\"\"\n        return self.__class__(self, copy=True)"},{"attributeType":"sharedmethod","col":4,"comment":"null","endLoc":402,"id":12166,"name":"add","nodeType":"Attribute","startLoc":402,"text":"add"},{"attributeType":"null","col":0,"comment":"null","endLoc":2887,"id":12167,"name":"SPECIAL_OPERATORS","nodeType":"Attribute","startLoc":2887,"text":"SPECIAL_OPERATORS"},{"className":"Convolution","col":0,"comment":"\n    Wrapper class for a convolution model.\n\n    Parameters\n    ----------\n    operator: tuple\n        The SPECIAL_OPERATORS entry for the convolution being used.\n    model : Model\n        The model for the convolution.\n    kernel: Model\n        The kernel model for the convolution.\n    bounding_box : tuple\n        A bounding box to define the limits of the integration\n        approximation for the convolution.\n    resolution : float\n        The resolution for the approximation of the convolution.\n    cache : bool, optional\n        Allow convolution computation to be cached for reuse. This is\n        enabled by default.\n\n    Notes\n    -----\n    This is wrapper is necessary to handle the limitations of the\n    pseudospectral convolution binary operator implemented in\n    astropy.convolution under `~astropy.convolution.convolve_fft`. In this `~astropy.convolution.convolve_fft` it\n    is assumed that the inputs ``array`` and ``kernel`` span a sufficient\n    portion of the support of the functions of the convolution.\n    Consequently, the ``Compound`` created by the `~astropy.convolution.convolve_models` function\n    makes the assumption that one should pass an input array that\n    sufficiently spans this space. This means that slightly different\n    input arrays to this model will result in different outputs, even\n    on points of intersection between these arrays.\n\n    This issue is solved by requiring a ``bounding_box`` together with a\n    resolution so that one can pre-calculate the entire domain and then\n    (by default) cache the convolution values. The function then just\n    interpolates the results from this cache.\n    ","endLoc":115,"id":12168,"nodeType":"Class","startLoc":10,"text":"class Convolution(CompoundModel):\n    \"\"\"\n    Wrapper class for a convolution model.\n\n    Parameters\n    ----------\n    operator: tuple\n        The SPECIAL_OPERATORS entry for the convolution being used.\n    model : Model\n        The model for the convolution.\n    kernel: Model\n        The kernel model for the convolution.\n    bounding_box : tuple\n        A bounding box to define the limits of the integration\n        approximation for the convolution.\n    resolution : float\n        The resolution for the approximation of the convolution.\n    cache : bool, optional\n        Allow convolution computation to be cached for reuse. This is\n        enabled by default.\n\n    Notes\n    -----\n    This is wrapper is necessary to handle the limitations of the\n    pseudospectral convolution binary operator implemented in\n    astropy.convolution under `~astropy.convolution.convolve_fft`. In this `~astropy.convolution.convolve_fft` it\n    is assumed that the inputs ``array`` and ``kernel`` span a sufficient\n    portion of the support of the functions of the convolution.\n    Consequently, the ``Compound`` created by the `~astropy.convolution.convolve_models` function\n    makes the assumption that one should pass an input array that\n    sufficiently spans this space. This means that slightly different\n    input arrays to this model will result in different outputs, even\n    on points of intersection between these arrays.\n\n    This issue is solved by requiring a ``bounding_box`` together with a\n    resolution so that one can pre-calculate the entire domain and then\n    (by default) cache the convolution values. The function then just\n    interpolates the results from this cache.\n    \"\"\"\n\n    def __init__(self, operator, model, kernel, bounding_box, resolution, cache=True):\n        super().__init__(operator, model, kernel)\n\n        self.bounding_box = bounding_box\n        self._resolution = resolution\n\n        self._cache_convolution = cache\n        self._kwargs = None\n        self._convolution = None\n\n    def clear_cache(self):\n        \"\"\"\n        Clears the cached convolution\n        \"\"\"\n\n        self._kwargs = None\n        self._convolution = None\n\n    def _get_convolution(self, **kwargs):\n        if (self._convolution is None) or (self._kwargs != kwargs):\n            domain = self.bounding_box.domain(self._resolution)\n            mesh = np.meshgrid(*domain)\n            data = super().__call__(*mesh, **kwargs)\n\n            from scipy.interpolate import RegularGridInterpolator\n            convolution = RegularGridInterpolator(domain, data)\n\n            if self._cache_convolution:\n                self._kwargs = kwargs\n                self._convolution = convolution\n\n        else:\n            convolution = self._convolution\n\n        return convolution\n\n    @staticmethod\n    def _convolution_inputs(*args):\n        not_scalar = np.where([not np.isscalar(arg) for arg in args])[0]\n\n        if len(not_scalar) == 0:\n            return np.array(args), (1,)\n        else:\n            output_shape = args[not_scalar[0]].shape\n            if not all(args[index].shape == output_shape for index in not_scalar):\n                raise ValueError('Values have differing shapes')\n\n            inputs = []\n            for arg in args:\n                if np.isscalar(arg):\n                    inputs.append(np.full(output_shape, arg))\n                else:\n                    inputs.append(arg)\n\n            return np.reshape(inputs, (len(inputs), -1)).T, output_shape\n\n    @staticmethod\n    def _convolution_outputs(outputs, output_shape):\n        return outputs.reshape(output_shape)\n\n    def __call__(self, *args, **kw):\n        inputs, output_shape = self._convolution_inputs(*args)\n        convolution = self._get_convolution(**kw)\n        outputs = convolution(inputs)\n\n        return self._convolution_outputs(outputs, output_shape)"},{"col":4,"comment":"null","endLoc":1960,"header":"def build_lritems(self)","id":12169,"name":"build_lritems","nodeType":"Function","startLoc":1934,"text":"def build_lritems(self):\n        for p in self.Productions:\n            lastlri = p\n            i = 0\n            lr_items = []\n            while True:\n                if i > len(p):\n                    lri = None\n                else:\n                    lri = LRItem(p, i)\n                    # Precompute the list of productions immediately following\n                    try:\n                        lri.lr_after = self.Prodnames[lri.prod[i+1]]\n                    except (IndexError, KeyError):\n                        lri.lr_after = []\n                    try:\n                        lri.lr_before = lri.prod[i-1]\n                    except IndexError:\n                        lri.lr_before = None\n\n                lastlri.lr_next = lri\n                if not lri:\n                    break\n                lr_items.append(lri)\n                lastlri = lri\n                i += 1\n            p.lr_items = lr_items"},{"col":4,"comment":"null","endLoc":58,"header":"def __init__(self, operator, model, kernel, bounding_box, resolution, cache=True)","id":12170,"name":"__init__","nodeType":"Function","startLoc":50,"text":"def __init__(self, operator, model, kernel, bounding_box, resolution, cache=True):\n        super().__init__(operator, model, kernel)\n\n        self.bounding_box = bounding_box\n        self._resolution = resolution\n\n        self._cache_convolution = cache\n        self._kwargs = None\n        self._convolution = None"},{"attributeType":"sharedmethod","col":4,"comment":"null","endLoc":403,"id":12171,"name":"subtract","nodeType":"Attribute","startLoc":403,"text":"subtract"},{"attributeType":"sharedmethod","col":4,"comment":"null","endLoc":404,"id":12172,"name":"multiply","nodeType":"Attribute","startLoc":404,"text":"multiply"},{"col":4,"comment":"null","endLoc":115,"header":"def __getitem__(self, key)","id":12173,"name":"__getitem__","nodeType":"Function","startLoc":108,"text":"def __getitem__(self, key):\n        if key in self._aliases:\n            try:\n                return self._parent[self._aliases[key]]\n            except KeyError:\n                raise KeyError(key)\n\n        return self._store[key]"},{"col":4,"comment":"null","endLoc":121,"header":"def __setitem__(self, key, value)","id":12174,"name":"__setitem__","nodeType":"Function","startLoc":117,"text":"def __setitem__(self, key, value):\n        if key in self._aliases:\n            self._parent[self._aliases[key]] = value\n        else:\n            self._store[key] = value"},{"col":4,"comment":"null","endLoc":130,"header":"def __delitem__(self, key)","id":12175,"name":"__delitem__","nodeType":"Function","startLoc":123,"text":"def __delitem__(self, key):\n        if key in self._aliases:\n            try:\n                del self._parent[self._aliases[key]]\n            except KeyError:\n                raise KeyError(key)\n        else:\n            del self._store[key]"},{"col":4,"comment":"\n        First iterates over keys from the parent dict (if the aliased keys are\n        present in the parent), followed by any keys in the local store.\n        ","endLoc":143,"header":"def __iter__(self)","id":12176,"name":"__iter__","nodeType":"Function","startLoc":132,"text":"def __iter__(self):\n        \"\"\"\n        First iterates over keys from the parent dict (if the aliased keys are\n        present in the parent), followed by any keys in the local store.\n        \"\"\"\n\n        for key, alias in self._aliases.items():\n            if alias in self._parent:\n                yield key\n\n        for key in self._store:\n            yield key"},{"attributeType":"sharedmethod","col":4,"comment":"null","endLoc":405,"id":12177,"name":"divide","nodeType":"Attribute","startLoc":405,"text":"divide"},{"attributeType":"null","col":8,"comment":"null","endLoc":1477,"id":12178,"name":"Productions","nodeType":"Attribute","startLoc":1477,"text":"self.Productions"},{"attributeType":"null","col":8,"comment":"null","endLoc":1484,"id":12179,"name":"Prodmap","nodeType":"Attribute","startLoc":1484,"text":"self.Prodmap"},{"attributeType":"null","col":8,"comment":"null","endLoc":1500,"id":12180,"name":"Follow","nodeType":"Attribute","startLoc":1500,"text":"self.Follow"},{"attributeType":"null","col":8,"comment":"null","endLoc":1505,"id":12181,"name":"UsedPrecedence","nodeType":"Attribute","startLoc":1505,"text":"self.UsedPrecedence"},{"attributeType":"None","col":8,"comment":"null","endLoc":1509,"id":12182,"name":"Start","nodeType":"Attribute","startLoc":1509,"text":"self.Start"},{"attributeType":"null","col":4,"comment":"null","endLoc":440,"id":12183,"name":"known_invalid_fits_unit_strings","nodeType":"Attribute","startLoc":440,"text":"known_invalid_fits_unit_strings"},{"attributeType":"null","col":8,"comment":"null","endLoc":219,"id":12184,"name":"_data","nodeType":"Attribute","startLoc":219,"text":"self._data"},{"attributeType":"null","col":8,"comment":"null","endLoc":1495,"id":12185,"name":"Nonterminals","nodeType":"Attribute","startLoc":1495,"text":"self.Nonterminals"},{"attributeType":"null","col":8,"comment":"null","endLoc":1487,"id":12186,"name":"Terminals","nodeType":"Attribute","startLoc":1487,"text":"self.Terminals"},{"attributeType":"null","col":8,"comment":"null","endLoc":1498,"id":12187,"name":"First","nodeType":"Attribute","startLoc":1498,"text":"self.First"},{"attributeType":"null","col":8,"comment":"null","endLoc":1502,"id":12188,"name":"Precedence","nodeType":"Attribute","startLoc":1502,"text":"self.Precedence"},{"attributeType":"null","col":8,"comment":"null","endLoc":1481,"id":12189,"name":"Prodnames","nodeType":"Attribute","startLoc":1481,"text":"self.Prodnames"},{"className":"VersionError","col":0,"comment":"null","endLoc":1971,"id":12190,"nodeType":"Class","startLoc":1970,"text":"class VersionError(YaccError):\n    pass"},{"className":"LRTable","col":0,"comment":"null","endLoc":2030,"id":12191,"nodeType":"Class","startLoc":1973,"text":"class LRTable(object):\n    def __init__(self):\n        self.lr_action = None\n        self.lr_goto = None\n        self.lr_productions = None\n        self.lr_method = None\n\n    def read_table(self, module):\n        if isinstance(module, types.ModuleType):\n            parsetab = module\n        else:\n            exec('import %s' % module)\n            parsetab = sys.modules[module]\n\n        if parsetab._tabversion != __tabversion__:\n            raise VersionError('yacc table file version is out of date')\n\n        self.lr_action = parsetab._lr_action\n        self.lr_goto = parsetab._lr_goto\n\n        self.lr_productions = []\n        for p in parsetab._lr_productions:\n            self.lr_productions.append(MiniProduction(*p))\n\n        self.lr_method = parsetab._lr_method\n        return parsetab._lr_signature\n\n    def read_pickle(self, filename):\n        try:\n            import cPickle as pickle\n        except ImportError:\n            import pickle\n\n        if not os.path.exists(filename):\n          raise ImportError\n\n        in_f = open(filename, 'rb')\n\n        tabversion = pickle.load(in_f)\n        if tabversion != __tabversion__:\n            raise VersionError('yacc table file version is out of date')\n        self.lr_method = pickle.load(in_f)\n        signature      = pickle.load(in_f)\n        self.lr_action = pickle.load(in_f)\n        self.lr_goto   = pickle.load(in_f)\n        productions    = pickle.load(in_f)\n\n        self.lr_productions = []\n        for p in productions:\n            self.lr_productions.append(MiniProduction(*p))\n\n        in_f.close()\n        return signature\n\n    # Bind all production function names to callable objects in pdict\n    def bind_callables(self, pdict):\n        for p in self.lr_productions:\n            p.bind(pdict)"},{"col":4,"comment":"null","endLoc":1998,"header":"def read_table(self, module)","id":12192,"name":"read_table","nodeType":"Function","startLoc":1980,"text":"def read_table(self, module):\n        if isinstance(module, types.ModuleType):\n            parsetab = module\n        else:\n            exec('import %s' % module)\n            parsetab = sys.modules[module]\n\n        if parsetab._tabversion != __tabversion__:\n            raise VersionError('yacc table file version is out of date')\n\n        self.lr_action = parsetab._lr_action\n        self.lr_goto = parsetab._lr_goto\n\n        self.lr_productions = []\n        for p in parsetab._lr_productions:\n            self.lr_productions.append(MiniProduction(*p))\n\n        self.lr_method = parsetab._lr_method\n        return parsetab._lr_signature"},{"attributeType":"NDUncertainty","col":16,"comment":"null","endLoc":257,"id":12193,"name":"_uncertainty","nodeType":"Attribute","startLoc":257,"text":"self._uncertainty"},{"attributeType":"null","col":8,"comment":"null","endLoc":237,"id":12194,"name":"_unit","nodeType":"Attribute","startLoc":237,"text":"self._unit"},{"attributeType":"WCS","col":12,"comment":"null","endLoc":193,"id":12195,"name":"_wcs","nodeType":"Attribute","startLoc":193,"text":"self._wcs"},{"attributeType":"null","col":8,"comment":"null","endLoc":245,"id":12196,"name":"meta","nodeType":"Attribute","startLoc":245,"text":"self.meta"},{"col":4,"comment":"null","endLoc":146,"header":"def __len__(self)","id":12197,"name":"__len__","nodeType":"Function","startLoc":145,"text":"def __len__(self):\n        return len(list(iter(self)))"},{"col":4,"comment":"null","endLoc":2025,"header":"def read_pickle(self, filename)","id":12198,"name":"read_pickle","nodeType":"Function","startLoc":2000,"text":"def read_pickle(self, filename):\n        try:\n            import cPickle as pickle\n        except ImportError:\n            import pickle\n\n        if not os.path.exists(filename):\n          raise ImportError\n\n        in_f = open(filename, 'rb')\n\n        tabversion = pickle.load(in_f)\n        if tabversion != __tabversion__:\n            raise VersionError('yacc table file version is out of date')\n        self.lr_method = pickle.load(in_f)\n        signature      = pickle.load(in_f)\n        self.lr_action = pickle.load(in_f)\n        self.lr_goto   = pickle.load(in_f)\n        productions    = pickle.load(in_f)\n\n        self.lr_productions = []\n        for p in productions:\n            self.lr_productions.append(MiniProduction(*p))\n\n        in_f.close()\n        return signature"},{"col":4,"comment":"null","endLoc":157,"header":"def __repr__(self)","id":12199,"name":"__repr__","nodeType":"Function","startLoc":148,"text":"def __repr__(self):\n        # repr() just like any other dict--this should look transparent\n        store_copy = self._store_type()\n        for key, alias in self._aliases.items():\n            if alias in self._parent:\n                store_copy[key] = self._parent[alias]\n\n        store_copy.update(self._store)\n\n        return repr(store_copy)"},{"attributeType":"null","col":4,"comment":"\n    Subclasses may override this to use other mapping types as the underlying\n    storage, for example an `OrderedDict`.  However, even in this case\n    additional work may be needed to get things like the ordering right.\n    ","endLoc":96,"id":12200,"name":"_store_type","nodeType":"Attribute","startLoc":96,"text":"_store_type"},{"attributeType":"null","col":8,"comment":"null","endLoc":104,"id":12201,"name":"_parent","nodeType":"Attribute","startLoc":104,"text":"self._parent"},{"attributeType":"null","col":8,"comment":"null","endLoc":106,"id":12202,"name":"_aliases","nodeType":"Attribute","startLoc":106,"text":"self._aliases"},{"attributeType":"null","col":8,"comment":"null","endLoc":105,"id":12203,"name":"_store","nodeType":"Attribute","startLoc":105,"text":"self._store"},{"className":"_ConstraintsDict","col":0,"comment":"\n    Wrapper around UserDict to allow updating the constraints\n    on a Parameter when the dictionary is updated.\n    ","endLoc":399,"id":12204,"nodeType":"Class","startLoc":382,"text":"class _ConstraintsDict(UserDict):\n    \"\"\"\n    Wrapper around UserDict to allow updating the constraints\n    on a Parameter when the dictionary is updated.\n    \"\"\"\n    def __init__(self, model, constraint_type):\n        self._model = model\n        self.constraint_type = constraint_type\n        c = {}\n        for name in model.param_names:\n            param = getattr(model, name)\n            c[name] = getattr(param, constraint_type)\n        super().__init__(c)\n\n    def __setitem__(self, key, val):\n        super().__setitem__(key, val)\n        param = getattr(self._model, key)\n        setattr(param, self.constraint_type, val)"},{"col":4,"comment":"null","endLoc":399,"header":"def __setitem__(self, key, val)","id":12205,"name":"__setitem__","nodeType":"Function","startLoc":396,"text":"def __setitem__(self, key, val):\n        super().__setitem__(key, val)\n        param = getattr(self._model, key)\n        setattr(param, self.constraint_type, val)"},{"col":0,"comment":"Decorator factory which temporarily disables the need for a unit when\n    creating a new CCDData instance. The final result must have a unit.\n\n    Parameters\n    ----------\n    op : function\n        The function to apply. Supported are:\n\n        - ``np.add``\n        - ``np.subtract``\n        - ``np.multiply``\n        - ``np.true_divide``\n\n    Notes\n    -----\n    Should only be used on CCDData ``add``, ``subtract``, ``divide`` or\n    ``multiply`` because only these methods from NDArithmeticMixin are\n    overwritten.\n    ","endLoc":61,"header":"def _arithmetic(op)","id":12206,"name":"_arithmetic","nodeType":"Function","startLoc":30,"text":"def _arithmetic(op):\n    \"\"\"Decorator factory which temporarily disables the need for a unit when\n    creating a new CCDData instance. The final result must have a unit.\n\n    Parameters\n    ----------\n    op : function\n        The function to apply. Supported are:\n\n        - ``np.add``\n        - ``np.subtract``\n        - ``np.multiply``\n        - ``np.true_divide``\n\n    Notes\n    -----\n    Should only be used on CCDData ``add``, ``subtract``, ``divide`` or\n    ``multiply`` because only these methods from NDArithmeticMixin are\n    overwritten.\n    \"\"\"\n    def decorator(func):\n        def inner(self, operand, operand2=None, **kwargs):\n            global _config_ccd_requires_unit\n            _config_ccd_requires_unit = False\n            result = self._prepare_then_do_arithmetic(op, operand,\n                                                      operand2, **kwargs)\n            # Wrap it again as CCDData so it checks the final unit.\n            _config_ccd_requires_unit = True\n            return result.__class__(result)\n        inner.__doc__ = f\"See `astropy.nddata.NDArithmeticMixin.{func.__name__}`.\"\n        return sharedmethod(inner)\n    return decorator"},{"attributeType":"null","col":8,"comment":"null","endLoc":389,"id":12207,"name":"constraint_type","nodeType":"Attribute","startLoc":389,"text":"self.constraint_type"},{"col":4,"comment":"\n        Clears the cached convolution\n        ","endLoc":66,"header":"def clear_cache(self)","id":12208,"name":"clear_cache","nodeType":"Function","startLoc":60,"text":"def clear_cache(self):\n        \"\"\"\n        Clears the cached convolution\n        \"\"\"\n\n        self._kwargs = None\n        self._convolution = None"},{"col":4,"comment":"null","endLoc":84,"header":"def _get_convolution(self, **kwargs)","id":12209,"name":"_get_convolution","nodeType":"Function","startLoc":68,"text":"def _get_convolution(self, **kwargs):\n        if (self._convolution is None) or (self._kwargs != kwargs):\n            domain = self.bounding_box.domain(self._resolution)\n            mesh = np.meshgrid(*domain)\n            data = super().__call__(*mesh, **kwargs)\n\n            from scipy.interpolate import RegularGridInterpolator\n            convolution = RegularGridInterpolator(domain, data)\n\n            if self._cache_convolution:\n                self._kwargs = kwargs\n                self._convolution = convolution\n\n        else:\n            convolution = self._convolution\n\n        return convolution"},{"col":0,"comment":"\n    Generate a WCS object from a header and remove the WCS-specific\n    keywords from the header.\n\n    Parameters\n    ----------\n\n    hdr : astropy.io.fits.header or other dict-like\n\n    Returns\n    -------\n\n    new_header, wcs\n    ","endLoc":524,"header":"def _generate_wcs_and_update_header(hdr)","id":12210,"name":"_generate_wcs_and_update_header","nodeType":"Function","startLoc":455,"text":"def _generate_wcs_and_update_header(hdr):\n    \"\"\"\n    Generate a WCS object from a header and remove the WCS-specific\n    keywords from the header.\n\n    Parameters\n    ----------\n\n    hdr : astropy.io.fits.header or other dict-like\n\n    Returns\n    -------\n\n    new_header, wcs\n    \"\"\"\n\n    # Try constructing a WCS object.\n    try:\n        wcs = WCS(hdr)\n    except Exception as exc:\n        # Normally WCS only raises Warnings and doesn't fail but in rare\n        # cases (malformed header) it could fail...\n        log.info('An exception happened while extracting WCS information from '\n                 'the Header.\\n{}: {}'.format(type(exc).__name__, str(exc)))\n        return hdr, None\n    # Test for success by checking to see if the wcs ctype has a non-empty\n    # value, return None for wcs if ctype is empty.\n    if not wcs.wcs.ctype[0]:\n        return (hdr, None)\n\n    new_hdr = hdr.copy()\n    # If the keywords below are in the header they are also added to WCS.\n    # It seems like they should *not* be removed from the header, though.\n\n    wcs_header = wcs.to_header(relax=True)\n    for k in wcs_header:\n        if k not in _KEEP_THESE_KEYWORDS_IN_HEADER:\n            new_hdr.remove(k, ignore_missing=True)\n\n    # Check that this does not result in an inconsistent header WCS if the WCS\n    # is converted back to a header.\n\n    if (_PCs & set(wcs_header)) and (_CDs & set(new_hdr)):\n        # The PCi_j representation is used by the astropy.wcs object,\n        # so CDi_j keywords were not removed from new_hdr. Remove them now.\n        for cd in _CDs:\n            new_hdr.remove(cd, ignore_missing=True)\n\n    # The other case -- CD in the header produced by astropy.wcs -- should\n    # never happen based on [1], which computes the matrix in PC form.\n    # [1]: https://github.com/astropy/astropy/blob/1cf277926d3598dd672dd528504767c37531e8c9/cextern/wcslib/C/wcshdr.c#L596\n    #\n    # The test test_ccddata.test_wcs_keyword_removal_for_wcs_test_files() does\n    # check for the possibility that both PC and CD are present in the result\n    # so if the implementation of to_header changes in wcslib in the future\n    # then the tests should catch it, and then this code will need to be\n    # updated.\n\n    # We need to check for any SIP coefficients that got left behind if the\n    # header has SIP.\n    if wcs.sip is not None:\n        keyword = '{}_{}_{}'\n        polynomials = ['A', 'B', 'AP', 'BP']\n        for poly in polynomials:\n            order = wcs.sip.__getattribute__(f'{poly.lower()}_order')\n            for i, j in itertools.product(range(order), repeat=2):\n                new_hdr.remove(keyword.format(poly, i, j),\n                               ignore_missing=True)\n\n    return (new_hdr, wcs)"},{"attributeType":"{param_names}","col":8,"comment":"null","endLoc":388,"id":12211,"name":"_model","nodeType":"Attribute","startLoc":388,"text":"self._model"},{"className":"_SpecialOperatorsDict","col":0,"comment":"\n    Wrapper around UserDict to allow for better tracking of the Special\n    Operators for CompoundModels. This dictionary is structured so that\n    one cannot inadvertently overwrite an existing special operator.\n\n    Parameters\n    ----------\n    unique_id: int\n        the last used unique_id for a SPECIAL OPERATOR\n    special_operators: dict\n        a dictionary containing the special_operators\n\n    Notes\n    -----\n    Direct setting of operators (`dict[key] = value`) into the\n    dictionary has been deprecated in favor of the `.add(name, value)`\n    method, so that unique dictionary keys can be generated and tracked\n    consistently.\n    ","endLoc":469,"id":12212,"nodeType":"Class","startLoc":402,"text":"class _SpecialOperatorsDict(UserDict):\n    \"\"\"\n    Wrapper around UserDict to allow for better tracking of the Special\n    Operators for CompoundModels. This dictionary is structured so that\n    one cannot inadvertently overwrite an existing special operator.\n\n    Parameters\n    ----------\n    unique_id: int\n        the last used unique_id for a SPECIAL OPERATOR\n    special_operators: dict\n        a dictionary containing the special_operators\n\n    Notes\n    -----\n    Direct setting of operators (`dict[key] = value`) into the\n    dictionary has been deprecated in favor of the `.add(name, value)`\n    method, so that unique dictionary keys can be generated and tracked\n    consistently.\n    \"\"\"\n\n    def __init__(self, unique_id=0, special_operators={}):\n        super().__init__(special_operators)\n        self._unique_id = unique_id\n\n    def _set_value(self, key, val):\n        if key in self:\n            raise ValueError(f'Special operator \"{key}\" already exists')\n        else:\n            super().__setitem__(key, val)\n\n    def __setitem__(self, key, val):\n        self._set_value(key, val)\n        warnings.warn(DeprecationWarning(\n            \"\"\"\n            Special operator dictionary assignment has been deprecated.\n            Please use `.add` instead, so that you can capture a unique\n            key for your operator.\n            \"\"\"\n        ))\n\n    def _get_unique_id(self):\n        self._unique_id += 1\n\n        return self._unique_id\n\n    def add(self, operator_name, operator):\n        \"\"\"\n        Adds a special operator to the dictionary, and then returns the\n        unique key that the operator is stored under for later reference.\n\n        Parameters\n        ----------\n        operator_name: str\n            the name for the operator\n        operator: function\n            the actual operator function which will be used\n\n        Returns\n        -------\n        the unique operator key for the dictionary\n            `(operator_name, unique_id)`\n        \"\"\"\n        key = (operator_name, self._get_unique_id())\n\n        self._set_value(key, operator)\n\n        return key"},{"col":4,"comment":"null","endLoc":2030,"header":"def bind_callables(self, pdict)","id":12213,"name":"bind_callables","nodeType":"Function","startLoc":2028,"text":"def bind_callables(self, pdict):\n        for p in self.lr_productions:\n            p.bind(pdict)"},{"col":4,"comment":"null","endLoc":425,"header":"def __init__(self, unique_id=0, special_operators={})","id":12214,"name":"__init__","nodeType":"Function","startLoc":423,"text":"def __init__(self, unique_id=0, special_operators={}):\n        super().__init__(special_operators)\n        self._unique_id = unique_id"},{"col":4,"comment":"null","endLoc":431,"header":"def _set_value(self, key, val)","id":12215,"name":"_set_value","nodeType":"Function","startLoc":427,"text":"def _set_value(self, key, val):\n        if key in self:\n            raise ValueError(f'Special operator \"{key}\" already exists')\n        else:\n            super().__setitem__(key, val)"},{"col":4,"comment":"null","endLoc":441,"header":"def __setitem__(self, key, val)","id":12216,"name":"__setitem__","nodeType":"Function","startLoc":433,"text":"def __setitem__(self, key, val):\n        self._set_value(key, val)\n        warnings.warn(DeprecationWarning(\n            \"\"\"\n            Special operator dictionary assignment has been deprecated.\n            Please use `.add` instead, so that you can capture a unique\n            key for your operator.\n            \"\"\"\n        ))"},{"col":4,"comment":"null","endLoc":446,"header":"def _get_unique_id(self)","id":12217,"name":"_get_unique_id","nodeType":"Function","startLoc":443,"text":"def _get_unique_id(self):\n        self._unique_id += 1\n\n        return self._unique_id"},{"col":4,"comment":"\n        Adds a special operator to the dictionary, and then returns the\n        unique key that the operator is stored under for later reference.\n\n        Parameters\n        ----------\n        operator_name: str\n            the name for the operator\n        operator: function\n            the actual operator function which will be used\n\n        Returns\n        -------\n        the unique operator key for the dictionary\n            `(operator_name, unique_id)`\n        ","endLoc":469,"header":"def add(self, operator_name, operator)","id":12218,"name":"add","nodeType":"Function","startLoc":448,"text":"def add(self, operator_name, operator):\n        \"\"\"\n        Adds a special operator to the dictionary, and then returns the\n        unique key that the operator is stored under for later reference.\n\n        Parameters\n        ----------\n        operator_name: str\n            the name for the operator\n        operator: function\n            the actual operator function which will be used\n\n        Returns\n        -------\n        the unique operator key for the dictionary\n            `(operator_name, unique_id)`\n        \"\"\"\n        key = (operator_name, self._get_unique_id())\n\n        self._set_value(key, operator)\n\n        return key"},{"attributeType":"None","col":8,"comment":"null","endLoc":1978,"id":12219,"name":"lr_method","nodeType":"Attribute","startLoc":1978,"text":"self.lr_method"},{"attributeType":"None","col":8,"comment":"null","endLoc":1977,"id":12220,"name":"lr_productions","nodeType":"Attribute","startLoc":1977,"text":"self.lr_productions"},{"attributeType":"None","col":8,"comment":"null","endLoc":1976,"id":12221,"name":"lr_goto","nodeType":"Attribute","startLoc":1976,"text":"self.lr_goto"},{"attributeType":"None","col":8,"comment":"null","endLoc":1975,"id":12222,"name":"lr_action","nodeType":"Attribute","startLoc":1975,"text":"self.lr_action"},{"col":0,"comment":"\n    Generate a CCDData object from a FITS file.\n\n    Parameters\n    ----------\n    filename : str\n        Name of fits file.\n\n    hdu : int, str, tuple of (str, int), optional\n        Index or other identifier of the Header Data Unit of the FITS\n        file from which CCDData should be initialized. If zero and\n        no data in the primary HDU, it will search for the first\n        extension HDU with data. The header will be added to the primary HDU.\n        Default is ``0``.\n\n    unit : `~astropy.units.Unit`, optional\n        Units of the image data. If this argument is provided and there is a\n        unit for the image in the FITS header (the keyword ``BUNIT`` is used\n        as the unit, if present), this argument is used for the unit.\n        Default is ``None``.\n\n    hdu_uncertainty : str or None, optional\n        FITS extension from which the uncertainty should be initialized. If the\n        extension does not exist the uncertainty of the CCDData is ``None``.\n        Default is ``'UNCERT'``.\n\n    hdu_mask : str or None, optional\n        FITS extension from which the mask should be initialized. If the\n        extension does not exist the mask of the CCDData is ``None``.\n        Default is ``'MASK'``.\n\n    hdu_flags : str or None, optional\n        Currently not implemented.\n        Default is ``None``.\n\n    key_uncertainty_type : str, optional\n        The header key name where the class name of the uncertainty  is stored\n        in the hdu of the uncertainty (if any).\n        Default is ``UTYPE``.\n\n        .. versionadded:: 3.1\n\n    kwd :\n        Any additional keyword parameters are passed through to the FITS reader\n        in :mod:`astropy.io.fits`; see Notes for additional discussion.\n\n    Notes\n    -----\n    FITS files that contained scaled data (e.g. unsigned integer images) will\n    be scaled and the keywords used to manage scaled data in\n    :mod:`astropy.io.fits` are disabled.\n    ","endLoc":665,"header":"def fits_ccddata_reader(filename, hdu=0, unit=None, hdu_uncertainty='UNCERT',\n                        hdu_mask='MASK', hdu_flags=None,\n                        key_uncertainty_type='UTYPE', **kwd)","id":12223,"name":"fits_ccddata_reader","nodeType":"Function","startLoc":527,"text":"def fits_ccddata_reader(filename, hdu=0, unit=None, hdu_uncertainty='UNCERT',\n                        hdu_mask='MASK', hdu_flags=None,\n                        key_uncertainty_type='UTYPE', **kwd):\n    \"\"\"\n    Generate a CCDData object from a FITS file.\n\n    Parameters\n    ----------\n    filename : str\n        Name of fits file.\n\n    hdu : int, str, tuple of (str, int), optional\n        Index or other identifier of the Header Data Unit of the FITS\n        file from which CCDData should be initialized. If zero and\n        no data in the primary HDU, it will search for the first\n        extension HDU with data. The header will be added to the primary HDU.\n        Default is ``0``.\n\n    unit : `~astropy.units.Unit`, optional\n        Units of the image data. If this argument is provided and there is a\n        unit for the image in the FITS header (the keyword ``BUNIT`` is used\n        as the unit, if present), this argument is used for the unit.\n        Default is ``None``.\n\n    hdu_uncertainty : str or None, optional\n        FITS extension from which the uncertainty should be initialized. If the\n        extension does not exist the uncertainty of the CCDData is ``None``.\n        Default is ``'UNCERT'``.\n\n    hdu_mask : str or None, optional\n        FITS extension from which the mask should be initialized. If the\n        extension does not exist the mask of the CCDData is ``None``.\n        Default is ``'MASK'``.\n\n    hdu_flags : str or None, optional\n        Currently not implemented.\n        Default is ``None``.\n\n    key_uncertainty_type : str, optional\n        The header key name where the class name of the uncertainty  is stored\n        in the hdu of the uncertainty (if any).\n        Default is ``UTYPE``.\n\n        .. versionadded:: 3.1\n\n    kwd :\n        Any additional keyword parameters are passed through to the FITS reader\n        in :mod:`astropy.io.fits`; see Notes for additional discussion.\n\n    Notes\n    -----\n    FITS files that contained scaled data (e.g. unsigned integer images) will\n    be scaled and the keywords used to manage scaled data in\n    :mod:`astropy.io.fits` are disabled.\n    \"\"\"\n    unsupport_open_keywords = {\n        'do_not_scale_image_data': 'Image data must be scaled.',\n        'scale_back': 'Scale information is not preserved.'\n    }\n    for key, msg in unsupport_open_keywords.items():\n        if key in kwd:\n            prefix = f'unsupported keyword: {key}.'\n            raise TypeError(' '.join([prefix, msg]))\n    with fits.open(filename, **kwd) as hdus:\n        hdr = hdus[hdu].header\n\n        if hdu_uncertainty is not None and hdu_uncertainty in hdus:\n            unc_hdu = hdus[hdu_uncertainty]\n            stored_unc_name = unc_hdu.header.get(key_uncertainty_type, 'None')\n            # For compatibility reasons the default is standard deviation\n            # uncertainty because files could have been created before the\n            # uncertainty type was stored in the header.\n            unc_type = _unc_name_to_cls.get(stored_unc_name, StdDevUncertainty)\n            uncertainty = unc_type(unc_hdu.data)\n        else:\n            uncertainty = None\n\n        if hdu_mask is not None and hdu_mask in hdus:\n            # Mask is saved as uint but we want it to be boolean.\n            mask = hdus[hdu_mask].data.astype(np.bool_)\n        else:\n            mask = None\n\n        if hdu_flags is not None and hdu_flags in hdus:\n            raise NotImplementedError('loading flags is currently not '\n                                      'supported.')\n\n        # search for the first instance with data if\n        # the primary header is empty.\n        if hdu == 0 and hdus[hdu].data is None:\n            for i in range(len(hdus)):\n                if (hdus.info(hdu)[i][3] == 'ImageHDU' and\n                        hdus.fileinfo(i)['datSpan'] > 0):\n                    hdu = i\n                    comb_hdr = hdus[hdu].header.copy()\n                    # Add header values from the primary header that aren't\n                    # present in the extension header.\n                    comb_hdr.extend(hdr, unique=True)\n                    hdr = comb_hdr\n                    log.info(f\"first HDU with data is extension {hdu}.\")\n                    break\n\n        if 'bunit' in hdr:\n            fits_unit_string = hdr['bunit']\n            # patch to handle FITS files using ADU for the unit instead of the\n            # standard version of 'adu'\n            if fits_unit_string.strip().lower() == 'adu':\n                fits_unit_string = fits_unit_string.lower()\n        else:\n            fits_unit_string = None\n\n        if fits_unit_string:\n            if unit is None:\n                # Convert the BUNIT header keyword to a unit and if that's not\n                # possible raise a meaningful error message.\n                try:\n                    kifus = CCDData.known_invalid_fits_unit_strings\n                    if fits_unit_string in kifus:\n                        fits_unit_string = kifus[fits_unit_string]\n                    fits_unit_string = u.Unit(fits_unit_string)\n                except ValueError:\n                    raise ValueError(\n                        'The Header value for the key BUNIT ({}) cannot be '\n                        'interpreted as valid unit. To successfully read the '\n                        'file as CCDData you can pass in a valid `unit` '\n                        'argument explicitly or change the header of the FITS '\n                        'file before reading it.'\n                        .format(fits_unit_string))\n            else:\n                log.info(\"using the unit {} passed to the FITS reader instead \"\n                         \"of the unit {} in the FITS file.\"\n                         .format(unit, fits_unit_string))\n\n        use_unit = unit or fits_unit_string\n        hdr, wcs = _generate_wcs_and_update_header(hdr)\n        ccd_data = CCDData(hdus[hdu].data, meta=hdr, unit=use_unit,\n                           mask=mask, uncertainty=uncertainty, wcs=wcs)\n\n    return ccd_data"},{"className":"LALRError","col":0,"comment":"null","endLoc":2092,"id":12224,"nodeType":"Class","startLoc":2091,"text":"class LALRError(YaccError):\n    pass"},{"className":"LRGeneratedTable","col":0,"comment":"null","endLoc":2868,"id":12225,"nodeType":"Class","startLoc":2101,"text":"class LRGeneratedTable(LRTable):\n    def __init__(self, grammar, method='LALR', log=None):\n        if method not in ['SLR', 'LALR']:\n            raise LALRError('Unsupported method %s' % method)\n\n        self.grammar = grammar\n        self.lr_method = method\n\n        # Set up the logger\n        if not log:\n            log = NullLogger()\n        self.log = log\n\n        # Internal attributes\n        self.lr_action     = {}        # Action table\n        self.lr_goto       = {}        # Goto table\n        self.lr_productions  = grammar.Productions    # Copy of grammar Production array\n        self.lr_goto_cache = {}        # Cache of computed gotos\n        self.lr0_cidhash   = {}        # Cache of closures\n\n        self._add_count    = 0         # Internal counter used to detect cycles\n\n        # Diagonistic information filled in by the table generator\n        self.sr_conflict   = 0\n        self.rr_conflict   = 0\n        self.conflicts     = []        # List of conflicts\n\n        self.sr_conflicts  = []\n        self.rr_conflicts  = []\n\n        # Build the tables\n        self.grammar.build_lritems()\n        self.grammar.compute_first()\n        self.grammar.compute_follow()\n        self.lr_parse_table()\n\n    # Compute the LR(0) closure operation on I, where I is a set of LR(0) items.\n\n    def lr0_closure(self, I):\n        self._add_count += 1\n\n        # Add everything in I to J\n        J = I[:]\n        didadd = True\n        while didadd:\n            didadd = False\n            for j in J:\n                for x in j.lr_after:\n                    if getattr(x, 'lr0_added', 0) == self._add_count:\n                        continue\n                    # Add B --> .G to J\n                    J.append(x.lr_next)\n                    x.lr0_added = self._add_count\n                    didadd = True\n\n        return J\n\n    # Compute the LR(0) goto function goto(I,X) where I is a set\n    # of LR(0) items and X is a grammar symbol.   This function is written\n    # in a way that guarantees uniqueness of the generated goto sets\n    # (i.e. the same goto set will never be returned as two different Python\n    # objects).  With uniqueness, we can later do fast set comparisons using\n    # id(obj) instead of element-wise comparison.\n\n    def lr0_goto(self, I, x):\n        # First we look for a previously cached entry\n        g = self.lr_goto_cache.get((id(I), x))\n        if g:\n            return g\n\n        # Now we generate the goto set in a way that guarantees uniqueness\n        # of the result\n\n        s = self.lr_goto_cache.get(x)\n        if not s:\n            s = {}\n            self.lr_goto_cache[x] = s\n\n        gs = []\n        for p in I:\n            n = p.lr_next\n            if n and n.lr_before == x:\n                s1 = s.get(id(n))\n                if not s1:\n                    s1 = {}\n                    s[id(n)] = s1\n                gs.append(n)\n                s = s1\n        g = s.get('$end')\n        if not g:\n            if gs:\n                g = self.lr0_closure(gs)\n                s['$end'] = g\n            else:\n                s['$end'] = gs\n        self.lr_goto_cache[(id(I), x)] = g\n        return g\n\n    # Compute the LR(0) sets of item function\n    def lr0_items(self):\n        C = [self.lr0_closure([self.grammar.Productions[0].lr_next])]\n        i = 0\n        for I in C:\n            self.lr0_cidhash[id(I)] = i\n            i += 1\n\n        # Loop over the items in C and each grammar symbols\n        i = 0\n        while i < len(C):\n            I = C[i]\n            i += 1\n\n            # Collect all of the symbols that could possibly be in the goto(I,X) sets\n            asyms = {}\n            for ii in I:\n                for s in ii.usyms:\n                    asyms[s] = None\n\n            for x in asyms:\n                g = self.lr0_goto(I, x)\n                if not g or id(g) in self.lr0_cidhash:\n                    continue\n                self.lr0_cidhash[id(g)] = len(C)\n                C.append(g)\n\n        return C\n\n    # -----------------------------------------------------------------------------\n    #                       ==== LALR(1) Parsing ====\n    #\n    # LALR(1) parsing is almost exactly the same as SLR except that instead of\n    # relying upon Follow() sets when performing reductions, a more selective\n    # lookahead set that incorporates the state of the LR(0) machine is utilized.\n    # Thus, we mainly just have to focus on calculating the lookahead sets.\n    #\n    # The method used here is due to DeRemer and Pennelo (1982).\n    #\n    # DeRemer, F. L., and T. J. Pennelo: \"Efficient Computation of LALR(1)\n    #     Lookahead Sets\", ACM Transactions on Programming Languages and Systems,\n    #     Vol. 4, No. 4, Oct. 1982, pp. 615-649\n    #\n    # Further details can also be found in:\n    #\n    #  J. Tremblay and P. Sorenson, \"The Theory and Practice of Compiler Writing\",\n    #      McGraw-Hill Book Company, (1985).\n    #\n    # -----------------------------------------------------------------------------\n\n    # -----------------------------------------------------------------------------\n    # compute_nullable_nonterminals()\n    #\n    # Creates a dictionary containing all of the non-terminals that might produce\n    # an empty production.\n    # -----------------------------------------------------------------------------\n\n    def compute_nullable_nonterminals(self):\n        nullable = set()\n        num_nullable = 0\n        while True:\n            for p in self.grammar.Productions[1:]:\n                if p.len == 0:\n                    nullable.add(p.name)\n                    continue\n                for t in p.prod:\n                    if t not in nullable:\n                        break\n                else:\n                    nullable.add(p.name)\n            if len(nullable) == num_nullable:\n                break\n            num_nullable = len(nullable)\n        return nullable\n\n    # -----------------------------------------------------------------------------\n    # find_nonterminal_trans(C)\n    #\n    # Given a set of LR(0) items, this functions finds all of the non-terminal\n    # transitions.    These are transitions in which a dot appears immediately before\n    # a non-terminal.   Returns a list of tuples of the form (state,N) where state\n    # is the state number and N is the nonterminal symbol.\n    #\n    # The input C is the set of LR(0) items.\n    # -----------------------------------------------------------------------------\n\n    def find_nonterminal_transitions(self, C):\n        trans = []\n        for stateno, state in enumerate(C):\n            for p in state:\n                if p.lr_index < p.len - 1:\n                    t = (stateno, p.prod[p.lr_index+1])\n                    if t[1] in self.grammar.Nonterminals:\n                        if t not in trans:\n                            trans.append(t)\n        return trans\n\n    # -----------------------------------------------------------------------------\n    # dr_relation()\n    #\n    # Computes the DR(p,A) relationships for non-terminal transitions.  The input\n    # is a tuple (state,N) where state is a number and N is a nonterminal symbol.\n    #\n    # Returns a list of terminals.\n    # -----------------------------------------------------------------------------\n\n    def dr_relation(self, C, trans, nullable):\n        state, N = trans\n        terms = []\n\n        g = self.lr0_goto(C[state], N)\n        for p in g:\n            if p.lr_index < p.len - 1:\n                a = p.prod[p.lr_index+1]\n                if a in self.grammar.Terminals:\n                    if a not in terms:\n                        terms.append(a)\n\n        # This extra bit is to handle the start state\n        if state == 0 and N == self.grammar.Productions[0].prod[0]:\n            terms.append('$end')\n\n        return terms\n\n    # -----------------------------------------------------------------------------\n    # reads_relation()\n    #\n    # Computes the READS() relation (p,A) READS (t,C).\n    # -----------------------------------------------------------------------------\n\n    def reads_relation(self, C, trans, empty):\n        # Look for empty transitions\n        rel = []\n        state, N = trans\n\n        g = self.lr0_goto(C[state], N)\n        j = self.lr0_cidhash.get(id(g), -1)\n        for p in g:\n            if p.lr_index < p.len - 1:\n                a = p.prod[p.lr_index + 1]\n                if a in empty:\n                    rel.append((j, a))\n\n        return rel\n\n    # -----------------------------------------------------------------------------\n    # compute_lookback_includes()\n    #\n    # Determines the lookback and includes relations\n    #\n    # LOOKBACK:\n    #\n    # This relation is determined by running the LR(0) state machine forward.\n    # For example, starting with a production \"N : . A B C\", we run it forward\n    # to obtain \"N : A B C .\"   We then build a relationship between this final\n    # state and the starting state.   These relationships are stored in a dictionary\n    # lookdict.\n    #\n    # INCLUDES:\n    #\n    # Computes the INCLUDE() relation (p,A) INCLUDES (p',B).\n    #\n    # This relation is used to determine non-terminal transitions that occur\n    # inside of other non-terminal transition states.   (p,A) INCLUDES (p', B)\n    # if the following holds:\n    #\n    #       B -> LAT, where T -> epsilon and p' -L-> p\n    #\n    # L is essentially a prefix (which may be empty), T is a suffix that must be\n    # able to derive an empty string.  State p' must lead to state p with the string L.\n    #\n    # -----------------------------------------------------------------------------\n\n    def compute_lookback_includes(self, C, trans, nullable):\n        lookdict = {}          # Dictionary of lookback relations\n        includedict = {}       # Dictionary of include relations\n\n        # Make a dictionary of non-terminal transitions\n        dtrans = {}\n        for t in trans:\n            dtrans[t] = 1\n\n        # Loop over all transitions and compute lookbacks and includes\n        for state, N in trans:\n            lookb = []\n            includes = []\n            for p in C[state]:\n                if p.name != N:\n                    continue\n\n                # Okay, we have a name match.  We now follow the production all the way\n                # through the state machine until we get the . on the right hand side\n\n                lr_index = p.lr_index\n                j = state\n                while lr_index < p.len - 1:\n                    lr_index = lr_index + 1\n                    t = p.prod[lr_index]\n\n                    # Check to see if this symbol and state are a non-terminal transition\n                    if (j, t) in dtrans:\n                        # Yes.  Okay, there is some chance that this is an includes relation\n                        # the only way to know for certain is whether the rest of the\n                        # production derives empty\n\n                        li = lr_index + 1\n                        while li < p.len:\n                            if p.prod[li] in self.grammar.Terminals:\n                                break      # No forget it\n                            if p.prod[li] not in nullable:\n                                break\n                            li = li + 1\n                        else:\n                            # Appears to be a relation between (j,t) and (state,N)\n                            includes.append((j, t))\n\n                    g = self.lr0_goto(C[j], t)               # Go to next set\n                    j = self.lr0_cidhash.get(id(g), -1)      # Go to next state\n\n                # When we get here, j is the final state, now we have to locate the production\n                for r in C[j]:\n                    if r.name != p.name:\n                        continue\n                    if r.len != p.len:\n                        continue\n                    i = 0\n                    # This look is comparing a production \". A B C\" with \"A B C .\"\n                    while i < r.lr_index:\n                        if r.prod[i] != p.prod[i+1]:\n                            break\n                        i = i + 1\n                    else:\n                        lookb.append((j, r))\n            for i in includes:\n                if i not in includedict:\n                    includedict[i] = []\n                includedict[i].append((state, N))\n            lookdict[(state, N)] = lookb\n\n        return lookdict, includedict\n\n    # -----------------------------------------------------------------------------\n    # compute_read_sets()\n    #\n    # Given a set of LR(0) items, this function computes the read sets.\n    #\n    # Inputs:  C        =  Set of LR(0) items\n    #          ntrans   = Set of nonterminal transitions\n    #          nullable = Set of empty transitions\n    #\n    # Returns a set containing the read sets\n    # -----------------------------------------------------------------------------\n\n    def compute_read_sets(self, C, ntrans, nullable):\n        FP = lambda x: self.dr_relation(C, x, nullable)\n        R =  lambda x: self.reads_relation(C, x, nullable)\n        F = digraph(ntrans, R, FP)\n        return F\n\n    # -----------------------------------------------------------------------------\n    # compute_follow_sets()\n    #\n    # Given a set of LR(0) items, a set of non-terminal transitions, a readset,\n    # and an include set, this function computes the follow sets\n    #\n    # Follow(p,A) = Read(p,A) U U {Follow(p',B) | (p,A) INCLUDES (p',B)}\n    #\n    # Inputs:\n    #            ntrans     = Set of nonterminal transitions\n    #            readsets   = Readset (previously computed)\n    #            inclsets   = Include sets (previously computed)\n    #\n    # Returns a set containing the follow sets\n    # -----------------------------------------------------------------------------\n\n    def compute_follow_sets(self, ntrans, readsets, inclsets):\n        FP = lambda x: readsets[x]\n        R  = lambda x: inclsets.get(x, [])\n        F = digraph(ntrans, R, FP)\n        return F\n\n    # -----------------------------------------------------------------------------\n    # add_lookaheads()\n    #\n    # Attaches the lookahead symbols to grammar rules.\n    #\n    # Inputs:    lookbacks         -  Set of lookback relations\n    #            followset         -  Computed follow set\n    #\n    # This function directly attaches the lookaheads to productions contained\n    # in the lookbacks set\n    # -----------------------------------------------------------------------------\n\n    def add_lookaheads(self, lookbacks, followset):\n        for trans, lb in lookbacks.items():\n            # Loop over productions in lookback\n            for state, p in lb:\n                if state not in p.lookaheads:\n                    p.lookaheads[state] = []\n                f = followset.get(trans, [])\n                for a in f:\n                    if a not in p.lookaheads[state]:\n                        p.lookaheads[state].append(a)\n\n    # -----------------------------------------------------------------------------\n    # add_lalr_lookaheads()\n    #\n    # This function does all of the work of adding lookahead information for use\n    # with LALR parsing\n    # -----------------------------------------------------------------------------\n\n    def add_lalr_lookaheads(self, C):\n        # Determine all of the nullable nonterminals\n        nullable = self.compute_nullable_nonterminals()\n\n        # Find all non-terminal transitions\n        trans = self.find_nonterminal_transitions(C)\n\n        # Compute read sets\n        readsets = self.compute_read_sets(C, trans, nullable)\n\n        # Compute lookback/includes relations\n        lookd, included = self.compute_lookback_includes(C, trans, nullable)\n\n        # Compute LALR FOLLOW sets\n        followsets = self.compute_follow_sets(trans, readsets, included)\n\n        # Add all of the lookaheads\n        self.add_lookaheads(lookd, followsets)\n\n    # -----------------------------------------------------------------------------\n    # lr_parse_table()\n    #\n    # This function constructs the parse tables for SLR or LALR\n    # -----------------------------------------------------------------------------\n    def lr_parse_table(self):\n        Productions = self.grammar.Productions\n        Precedence  = self.grammar.Precedence\n        goto   = self.lr_goto         # Goto array\n        action = self.lr_action       # Action array\n        log    = self.log             # Logger for output\n\n        actionp = {}                  # Action production array (temporary)\n\n        log.info('Parsing method: %s', self.lr_method)\n\n        # Step 1: Construct C = { I0, I1, ... IN}, collection of LR(0) items\n        # This determines the number of states\n\n        C = self.lr0_items()\n\n        if self.lr_method == 'LALR':\n            self.add_lalr_lookaheads(C)\n\n        # Build the parser table, state by state\n        st = 0\n        for I in C:\n            # Loop over each production in I\n            actlist = []              # List of actions\n            st_action  = {}\n            st_actionp = {}\n            st_goto    = {}\n            log.info('')\n            log.info('state %d', st)\n            log.info('')\n            for p in I:\n                log.info('    (%d) %s', p.number, p)\n            log.info('')\n\n            for p in I:\n                    if p.len == p.lr_index + 1:\n                        if p.name == \"S'\":\n                            # Start symbol. Accept!\n                            st_action['$end'] = 0\n                            st_actionp['$end'] = p\n                        else:\n                            # We are at the end of a production.  Reduce!\n                            if self.lr_method == 'LALR':\n                                laheads = p.lookaheads[st]\n                            else:\n                                laheads = self.grammar.Follow[p.name]\n                            for a in laheads:\n                                actlist.append((a, p, 'reduce using rule %d (%s)' % (p.number, p)))\n                                r = st_action.get(a)\n                                if r is not None:\n                                    # Whoa. Have a shift/reduce or reduce/reduce conflict\n                                    if r > 0:\n                                        # Need to decide on shift or reduce here\n                                        # By default we favor shifting. Need to add\n                                        # some precedence rules here.\n\n                                        # Shift precedence comes from the token\n                                        sprec, slevel = Precedence.get(a, ('right', 0))\n\n                                        # Reduce precedence comes from rule being reduced (p)\n                                        rprec, rlevel = Productions[p.number].prec\n\n                                        if (slevel < rlevel) or ((slevel == rlevel) and (rprec == 'left')):\n                                            # We really need to reduce here.\n                                            st_action[a] = -p.number\n                                            st_actionp[a] = p\n                                            if not slevel and not rlevel:\n                                                log.info('  ! shift/reduce conflict for %s resolved as reduce', a)\n                                                self.sr_conflicts.append((st, a, 'reduce'))\n                                            Productions[p.number].reduced += 1\n                                        elif (slevel == rlevel) and (rprec == 'nonassoc'):\n                                            st_action[a] = None\n                                        else:\n                                            # Hmmm. Guess we'll keep the shift\n                                            if not rlevel:\n                                                log.info('  ! shift/reduce conflict for %s resolved as shift', a)\n                                                self.sr_conflicts.append((st, a, 'shift'))\n                                    elif r < 0:\n                                        # Reduce/reduce conflict.   In this case, we favor the rule\n                                        # that was defined first in the grammar file\n                                        oldp = Productions[-r]\n                                        pp = Productions[p.number]\n                                        if oldp.line > pp.line:\n                                            st_action[a] = -p.number\n                                            st_actionp[a] = p\n                                            chosenp, rejectp = pp, oldp\n                                            Productions[p.number].reduced += 1\n                                            Productions[oldp.number].reduced -= 1\n                                        else:\n                                            chosenp, rejectp = oldp, pp\n                                        self.rr_conflicts.append((st, chosenp, rejectp))\n                                        log.info('  ! reduce/reduce conflict for %s resolved using rule %d (%s)',\n                                                 a, st_actionp[a].number, st_actionp[a])\n                                    else:\n                                        raise LALRError('Unknown conflict in state %d' % st)\n                                else:\n                                    st_action[a] = -p.number\n                                    st_actionp[a] = p\n                                    Productions[p.number].reduced += 1\n                    else:\n                        i = p.lr_index\n                        a = p.prod[i+1]       # Get symbol right after the \".\"\n                        if a in self.grammar.Terminals:\n                            g = self.lr0_goto(I, a)\n                            j = self.lr0_cidhash.get(id(g), -1)\n                            if j >= 0:\n                                # We are in a shift state\n                                actlist.append((a, p, 'shift and go to state %d' % j))\n                                r = st_action.get(a)\n                                if r is not None:\n                                    # Whoa have a shift/reduce or shift/shift conflict\n                                    if r > 0:\n                                        if r != j:\n                                            raise LALRError('Shift/shift conflict in state %d' % st)\n                                    elif r < 0:\n                                        # Do a precedence check.\n                                        #   -  if precedence of reduce rule is higher, we reduce.\n                                        #   -  if precedence of reduce is same and left assoc, we reduce.\n                                        #   -  otherwise we shift\n\n                                        # Shift precedence comes from the token\n                                        sprec, slevel = Precedence.get(a, ('right', 0))\n\n                                        # Reduce precedence comes from the rule that could have been reduced\n                                        rprec, rlevel = Productions[st_actionp[a].number].prec\n\n                                        if (slevel > rlevel) or ((slevel == rlevel) and (rprec == 'right')):\n                                            # We decide to shift here... highest precedence to shift\n                                            Productions[st_actionp[a].number].reduced -= 1\n                                            st_action[a] = j\n                                            st_actionp[a] = p\n                                            if not rlevel:\n                                                log.info('  ! shift/reduce conflict for %s resolved as shift', a)\n                                                self.sr_conflicts.append((st, a, 'shift'))\n                                        elif (slevel == rlevel) and (rprec == 'nonassoc'):\n                                            st_action[a] = None\n                                        else:\n                                            # Hmmm. Guess we'll keep the reduce\n                                            if not slevel and not rlevel:\n                                                log.info('  ! shift/reduce conflict for %s resolved as reduce', a)\n                                                self.sr_conflicts.append((st, a, 'reduce'))\n\n                                    else:\n                                        raise LALRError('Unknown conflict in state %d' % st)\n                                else:\n                                    st_action[a] = j\n                                    st_actionp[a] = p\n\n            # Print the actions associated with each terminal\n            _actprint = {}\n            for a, p, m in actlist:\n                if a in st_action:\n                    if p is st_actionp[a]:\n                        log.info('    %-15s %s', a, m)\n                        _actprint[(a, m)] = 1\n            log.info('')\n            # Print the actions that were not used. (debugging)\n            not_used = 0\n            for a, p, m in actlist:\n                if a in st_action:\n                    if p is not st_actionp[a]:\n                        if not (a, m) in _actprint:\n                            log.debug('  ! %-15s [ %s ]', a, m)\n                            not_used = 1\n                            _actprint[(a, m)] = 1\n            if not_used:\n                log.debug('')\n\n            # Construct the goto table for this state\n\n            nkeys = {}\n            for ii in I:\n                for s in ii.usyms:\n                    if s in self.grammar.Nonterminals:\n                        nkeys[s] = None\n            for n in nkeys:\n                g = self.lr0_goto(I, n)\n                j = self.lr0_cidhash.get(id(g), -1)\n                if j >= 0:\n                    st_goto[n] = j\n                    log.info('    %-30s shift and go to state %d', n, j)\n\n            action[st] = st_action\n            actionp[st] = st_actionp\n            goto[st] = st_goto\n            st += 1\n\n    # -----------------------------------------------------------------------------\n    # write()\n    #\n    # This function writes the LR parsing tables to a file\n    # -----------------------------------------------------------------------------\n\n    def write_table(self, tabmodule, outputdir='', signature=''):\n        if isinstance(tabmodule, types.ModuleType):\n            raise IOError(\"Won't overwrite existing tabmodule\")\n\n        basemodulename = tabmodule.split('.')[-1]\n        filename = os.path.join(outputdir, basemodulename) + '.py'\n        try:\n            f = open(filename, 'w')\n\n            f.write('''\n# %s\n# This file is automatically generated. Do not edit.\n# pylint: disable=W,C,R\n_tabversion = %r\n\n_lr_method = %r\n\n_lr_signature = %r\n    ''' % (os.path.basename(filename), __tabversion__, self.lr_method, signature))\n\n            # Change smaller to 0 to go back to original tables\n            smaller = 1\n\n            # Factor out names to try and make smaller\n            if smaller:\n                items = {}\n\n                for s, nd in self.lr_action.items():\n                    for name, v in nd.items():\n                        i = items.get(name)\n                        if not i:\n                            i = ([], [])\n                            items[name] = i\n                        i[0].append(s)\n                        i[1].append(v)\n\n                f.write('\\n_lr_action_items = {')\n                for k, v in items.items():\n                    f.write('%r:([' % k)\n                    for i in v[0]:\n                        f.write('%r,' % i)\n                    f.write('],[')\n                    for i in v[1]:\n                        f.write('%r,' % i)\n\n                    f.write(']),')\n                f.write('}\\n')\n\n                f.write('''\n_lr_action = {}\nfor _k, _v in _lr_action_items.items():\n   for _x,_y in zip(_v[0],_v[1]):\n      if not _x in _lr_action:  _lr_action[_x] = {}\n      _lr_action[_x][_k] = _y\ndel _lr_action_items\n''')\n\n            else:\n                f.write('\\n_lr_action = { ')\n                for k, v in self.lr_action.items():\n                    f.write('(%r,%r):%r,' % (k[0], k[1], v))\n                f.write('}\\n')\n\n            if smaller:\n                # Factor out names to try and make smaller\n                items = {}\n\n                for s, nd in self.lr_goto.items():\n                    for name, v in nd.items():\n                        i = items.get(name)\n                        if not i:\n                            i = ([], [])\n                            items[name] = i\n                        i[0].append(s)\n                        i[1].append(v)\n\n                f.write('\\n_lr_goto_items = {')\n                for k, v in items.items():\n                    f.write('%r:([' % k)\n                    for i in v[0]:\n                        f.write('%r,' % i)\n                    f.write('],[')\n                    for i in v[1]:\n                        f.write('%r,' % i)\n\n                    f.write(']),')\n                f.write('}\\n')\n\n                f.write('''\n_lr_goto = {}\nfor _k, _v in _lr_goto_items.items():\n   for _x, _y in zip(_v[0], _v[1]):\n       if not _x in _lr_goto: _lr_goto[_x] = {}\n       _lr_goto[_x][_k] = _y\ndel _lr_goto_items\n''')\n            else:\n                f.write('\\n_lr_goto = { ')\n                for k, v in self.lr_goto.items():\n                    f.write('(%r,%r):%r,' % (k[0], k[1], v))\n                f.write('}\\n')\n\n            # Write production table\n            f.write('_lr_productions = [\\n')\n            for p in self.lr_productions:\n                if p.func:\n                    f.write('  (%r,%r,%d,%r,%r,%d),\\n' % (p.str, p.name, p.len,\n                                                          p.func, os.path.basename(p.file), p.line))\n                else:\n                    f.write('  (%r,%r,%d,None,None,None),\\n' % (str(p), p.name, p.len))\n            f.write(']\\n')\n            f.close()\n\n        except IOError as e:\n            raise\n\n\n    # -----------------------------------------------------------------------------\n    # pickle_table()\n    #\n    # This function pickles the LR parsing tables to a supplied file object\n    # -----------------------------------------------------------------------------\n\n    def pickle_table(self, filename, signature=''):\n        try:\n            import cPickle as pickle\n        except ImportError:\n            import pickle\n        with open(filename, 'wb') as outf:\n            pickle.dump(__tabversion__, outf, pickle_protocol)\n            pickle.dump(self.lr_method, outf, pickle_protocol)\n            pickle.dump(signature, outf, pickle_protocol)\n            pickle.dump(self.lr_action, outf, pickle_protocol)\n            pickle.dump(self.lr_goto, outf, pickle_protocol)\n\n            outp = []\n            for p in self.lr_productions:\n                if p.func:\n                    outp.append((p.str, p.name, p.len, p.func, os.path.basename(p.file), p.line))\n                else:\n                    outp.append((str(p), p.name, p.len, None, None, None))\n            pickle.dump(outp, outf, pickle_protocol)"},{"className":"ModelDefinitionError","col":0,"comment":"Used for incorrect models definitions.","endLoc":61,"id":12226,"nodeType":"Class","startLoc":60,"text":"class ModelDefinitionError(TypeError):\n    \"\"\"Used for incorrect models definitions.\"\"\""},{"col":0,"comment":"\n    A separability test for the outputs of a transform.\n\n    Parameters\n    ----------\n    transform : `~astropy.modeling.core.Model`\n        A (compound) model.\n\n    Returns\n    -------\n    is_separable : ndarray\n        A boolean array with size ``transform.n_outputs`` where\n        each element indicates whether the output is independent\n        and the result of a separable transform.\n\n    Examples\n    --------\n    >>> from astropy.modeling.models import Shift, Scale, Rotation2D, Polynomial2D\n    >>> is_separable(Shift(1) & Shift(2) | Scale(1) & Scale(2))\n        array([ True,  True]...)\n    >>> is_separable(Shift(1) & Shift(2) | Rotation2D(2))\n        array([False, False]...)\n    >>> is_separable(Shift(1) & Shift(2) | Mapping([0, 1, 0, 1]) | \n        Polynomial2D(1) & Polynomial2D(2))\n        array([False, False]...)\n    >>> is_separable(Shift(1) & Shift(2) | Mapping([0, 1, 0, 1]))\n        array([ True,  True,  True,  True]...)\n\n    ","endLoc":63,"header":"def is_separable(transform)","id":12227,"name":"is_separable","nodeType":"Function","startLoc":27,"text":"def is_separable(transform):\n    \"\"\"\n    A separability test for the outputs of a transform.\n\n    Parameters\n    ----------\n    transform : `~astropy.modeling.core.Model`\n        A (compound) model.\n\n    Returns\n    -------\n    is_separable : ndarray\n        A boolean array with size ``transform.n_outputs`` where\n        each element indicates whether the output is independent\n        and the result of a separable transform.\n\n    Examples\n    --------\n    >>> from astropy.modeling.models import Shift, Scale, Rotation2D, Polynomial2D\n    >>> is_separable(Shift(1) & Shift(2) | Scale(1) & Scale(2))\n        array([ True,  True]...)\n    >>> is_separable(Shift(1) & Shift(2) | Rotation2D(2))\n        array([False, False]...)\n    >>> is_separable(Shift(1) & Shift(2) | Mapping([0, 1, 0, 1]) | \\\n        Polynomial2D(1) & Polynomial2D(2))\n        array([False, False]...)\n    >>> is_separable(Shift(1) & Shift(2) | Mapping([0, 1, 0, 1]))\n        array([ True,  True,  True,  True]...)\n\n    \"\"\"\n    if transform.n_inputs == 1 and transform.n_outputs > 1:\n        is_separable = np.array([False] * transform.n_outputs).T\n        return is_separable\n    separable_matrix = _separable(transform)\n    is_separable = separable_matrix.sum(1)\n    is_separable = np.where(is_separable != 1, False, True)\n    return is_separable"},{"col":4,"comment":"null","endLoc":2841,"header":"def write_table(self, tabmodule, outputdir='', signature='')","id":12228,"name":"write_table","nodeType":"Function","startLoc":2727,"text":"def write_table(self, tabmodule, outputdir='', signature=''):\n        if isinstance(tabmodule, types.ModuleType):\n            raise IOError(\"Won't overwrite existing tabmodule\")\n\n        basemodulename = tabmodule.split('.')[-1]\n        filename = os.path.join(outputdir, basemodulename) + '.py'\n        try:\n            f = open(filename, 'w')\n\n            f.write('''\n# %s\n# This file is automatically generated. Do not edit.\n# pylint: disable=W,C,R\n_tabversion = %r\n\n_lr_method = %r\n\n_lr_signature = %r\n    ''' % (os.path.basename(filename), __tabversion__, self.lr_method, signature))\n\n            # Change smaller to 0 to go back to original tables\n            smaller = 1\n\n            # Factor out names to try and make smaller\n            if smaller:\n                items = {}\n\n                for s, nd in self.lr_action.items():\n                    for name, v in nd.items():\n                        i = items.get(name)\n                        if not i:\n                            i = ([], [])\n                            items[name] = i\n                        i[0].append(s)\n                        i[1].append(v)\n\n                f.write('\\n_lr_action_items = {')\n                for k, v in items.items():\n                    f.write('%r:([' % k)\n                    for i in v[0]:\n                        f.write('%r,' % i)\n                    f.write('],[')\n                    for i in v[1]:\n                        f.write('%r,' % i)\n\n                    f.write(']),')\n                f.write('}\\n')\n\n                f.write('''\n_lr_action = {}\nfor _k, _v in _lr_action_items.items():\n   for _x,_y in zip(_v[0],_v[1]):\n      if not _x in _lr_action:  _lr_action[_x] = {}\n      _lr_action[_x][_k] = _y\ndel _lr_action_items\n''')\n\n            else:\n                f.write('\\n_lr_action = { ')\n                for k, v in self.lr_action.items():\n                    f.write('(%r,%r):%r,' % (k[0], k[1], v))\n                f.write('}\\n')\n\n            if smaller:\n                # Factor out names to try and make smaller\n                items = {}\n\n                for s, nd in self.lr_goto.items():\n                    for name, v in nd.items():\n                        i = items.get(name)\n                        if not i:\n                            i = ([], [])\n                            items[name] = i\n                        i[0].append(s)\n                        i[1].append(v)\n\n                f.write('\\n_lr_goto_items = {')\n                for k, v in items.items():\n                    f.write('%r:([' % k)\n                    for i in v[0]:\n                        f.write('%r,' % i)\n                    f.write('],[')\n                    for i in v[1]:\n                        f.write('%r,' % i)\n\n                    f.write(']),')\n                f.write('}\\n')\n\n                f.write('''\n_lr_goto = {}\nfor _k, _v in _lr_goto_items.items():\n   for _x, _y in zip(_v[0], _v[1]):\n       if not _x in _lr_goto: _lr_goto[_x] = {}\n       _lr_goto[_x][_k] = _y\ndel _lr_goto_items\n''')\n            else:\n                f.write('\\n_lr_goto = { ')\n                for k, v in self.lr_goto.items():\n                    f.write('(%r,%r):%r,' % (k[0], k[1], v))\n                f.write('}\\n')\n\n            # Write production table\n            f.write('_lr_productions = [\\n')\n            for p in self.lr_productions:\n                if p.func:\n                    f.write('  (%r,%r,%d,%r,%r,%d),\\n' % (p.str, p.name, p.len,\n                                                          p.func, os.path.basename(p.file), p.line))\n                else:\n                    f.write('  (%r,%r,%d,None,None,None),\\n' % (str(p), p.name, p.len))\n            f.write(']\\n')\n            f.close()\n\n        except IOError as e:\n            raise"},{"col":0,"comment":"\n    Calculate the separability of outputs.\n\n    Parameters\n    ----------\n    transform : `astropy.modeling.Model`\n        A transform (usually a compound model).\n\n    Returns :\n    is_separable : ndarray of dtype np.bool\n        An array of shape (transform.n_outputs,) of boolean type\n        Each element represents the separablity of the corresponding output.\n    ","endLoc":311,"header":"def _separable(transform)","id":12229,"name":"_separable","nodeType":"Function","startLoc":290,"text":"def _separable(transform):\n    \"\"\"\n    Calculate the separability of outputs.\n\n    Parameters\n    ----------\n    transform : `astropy.modeling.Model`\n        A transform (usually a compound model).\n\n    Returns :\n    is_separable : ndarray of dtype np.bool\n        An array of shape (transform.n_outputs,) of boolean type\n        Each element represents the separablity of the corresponding output.\n    \"\"\"\n    if (transform_matrix := transform._calculate_separability_matrix()) is not NotImplemented:\n        return transform_matrix\n    elif isinstance(transform, CompoundModel):\n        sepleft = _separable(transform.left)\n        sepright = _separable(transform.right)\n        return _operators[transform.op](sepleft, sepright)\n    elif isinstance(transform, Model):\n        return _coord_matrix(transform, 'left', transform.n_outputs)"},{"col":4,"comment":"null","endLoc":104,"header":"@staticmethod\n    def _convolution_inputs(*args)","id":12230,"name":"_convolution_inputs","nodeType":"Function","startLoc":86,"text":"@staticmethod\n    def _convolution_inputs(*args):\n        not_scalar = np.where([not np.isscalar(arg) for arg in args])[0]\n\n        if len(not_scalar) == 0:\n            return np.array(args), (1,)\n        else:\n            output_shape = args[not_scalar[0]].shape\n            if not all(args[index].shape == output_shape for index in not_scalar):\n                raise ValueError('Values have differing shapes')\n\n            inputs = []\n            for arg in args:\n                if np.isscalar(arg):\n                    inputs.append(np.full(output_shape, arg))\n                else:\n                    inputs.append(arg)\n\n            return np.reshape(inputs, (len(inputs), -1)).T, output_shape"},{"attributeType":"null","col":8,"comment":"null","endLoc":425,"id":12231,"name":"_unique_id","nodeType":"Attribute","startLoc":425,"text":"self._unique_id"},{"col":0,"comment":"\n    Given a binary operator (as a callable of two arguments) ``oper`` and\n    two callables ``f`` and ``g`` which accept the same arguments,\n    returns a *new* function that takes the same arguments as ``f`` and ``g``,\n    but passes the outputs of ``f`` and ``g`` in the given ``oper``.\n\n    ``f`` and ``g`` are assumed to return tuples (which may be 1-tuples).  The\n    given operator is applied element-wise to tuple outputs).\n\n    Example\n    -------\n\n    >>> from operator import add\n    >>> def prod(x, y):\n    ...     return (x * y,)\n    ...\n    >>> sum_of_prod = make_binary_operator_eval(add, prod, prod)\n    >>> sum_of_prod(3, 5)\n    (30,)\n    ","endLoc":184,"header":"def make_binary_operator_eval(oper, f, g)","id":12232,"name":"make_binary_operator_eval","nodeType":"Function","startLoc":160,"text":"def make_binary_operator_eval(oper, f, g):\n    \"\"\"\n    Given a binary operator (as a callable of two arguments) ``oper`` and\n    two callables ``f`` and ``g`` which accept the same arguments,\n    returns a *new* function that takes the same arguments as ``f`` and ``g``,\n    but passes the outputs of ``f`` and ``g`` in the given ``oper``.\n\n    ``f`` and ``g`` are assumed to return tuples (which may be 1-tuples).  The\n    given operator is applied element-wise to tuple outputs).\n\n    Example\n    -------\n\n    >>> from operator import add\n    >>> def prod(x, y):\n    ...     return (x * y,)\n    ...\n    >>> sum_of_prod = make_binary_operator_eval(add, prod, prod)\n    >>> sum_of_prod(3, 5)\n    (30,)\n    \"\"\"\n\n    return lambda inputs, params: \\\n            tuple(oper(x, y) for x, y in zip(f(inputs, params),\n                                             g(inputs, params)))"},{"col":11,"endLoc":184,"id":12233,"nodeType":"Lambda","startLoc":182,"text":"lambda inputs, params: \\\n            tuple(oper(x, y) for x, y in zip(f(inputs, params),\n                                             g(inputs, params)))"},{"col":0,"comment":"\n    Map domain into window by shifting and scaling.\n\n    Parameters\n    ----------\n    oldx : array\n          original coordinates\n    domain : list or tuple of length 2\n          function domain\n    window : list or tuple of length 2\n          range into which to map the domain\n    ","endLoc":206,"header":"def poly_map_domain(oldx, domain, window)","id":12234,"name":"poly_map_domain","nodeType":"Function","startLoc":187,"text":"def poly_map_domain(oldx, domain, window):\n    \"\"\"\n    Map domain into window by shifting and scaling.\n\n    Parameters\n    ----------\n    oldx : array\n          original coordinates\n    domain : list or tuple of length 2\n          function domain\n    window : list or tuple of length 2\n          range into which to map the domain\n    \"\"\"\n    domain = np.array(domain, dtype=np.float64)\n    window = np.array(window, dtype=np.float64)\n    if domain.shape != (2,) or window.shape != (2,):\n        raise ValueError('Expected \"domain\" and \"window\" to be a tuple of size 2.')\n    scl = (window[1] - window[0]) / (domain[1] - domain[0])\n    off = (window[0] * domain[1] - window[1] * domain[0]) / (domain[1] - domain[0])\n    return off + scl * oldx"},{"col":0,"comment":"null","endLoc":214,"header":"def _validate_domain_window(value)","id":12235,"name":"_validate_domain_window","nodeType":"Function","startLoc":209,"text":"def _validate_domain_window(value):\n    if value is not None:\n        if np.asanyarray(value).shape != (2, ):\n            raise ValueError('domain and window should be tuples of size 2.')\n        return tuple(value)\n    return value"},{"col":0,"comment":"\n    Calculates the extent of a box encapsulating a rotated 2D ellipse.\n\n    Parameters\n    ----------\n    a : float or `~astropy.units.Quantity`\n        Major axis.\n    b : float or `~astropy.units.Quantity`\n        Minor axis.\n    theta : float or `~astropy.units.Quantity` ['angle']\n        Rotation angle. If given as a floating-point value, it is assumed to be\n        in radians.\n\n    Returns\n    -------\n    offsets : tuple\n        The absolute value of the offset distances from the ellipse center that\n        define its bounding box region, ``(dx, dy)``.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n        from astropy.modeling.models import Ellipse2D\n        from astropy.modeling.utils import ellipse_extent, render_model\n\n        amplitude = 1\n        x0 = 50\n        y0 = 50\n        a = 30\n        b = 10\n        theta = np.pi/4\n\n        model = Ellipse2D(amplitude, x0, y0, a, b, theta)\n\n        dx, dy = ellipse_extent(a, b, theta)\n\n        limits = [x0 - dx, x0 + dx, y0 - dy, y0 + dy]\n\n        model.bounding_box = limits\n\n        image = render_model(model)\n\n        plt.imshow(image, cmap='binary', interpolation='nearest', alpha=.5,\n                  extent = limits)\n        plt.show()\n    ","endLoc":322,"header":"def ellipse_extent(a, b, theta)","id":12236,"name":"ellipse_extent","nodeType":"Function","startLoc":262,"text":"def ellipse_extent(a, b, theta):\n    \"\"\"\n    Calculates the extent of a box encapsulating a rotated 2D ellipse.\n\n    Parameters\n    ----------\n    a : float or `~astropy.units.Quantity`\n        Major axis.\n    b : float or `~astropy.units.Quantity`\n        Minor axis.\n    theta : float or `~astropy.units.Quantity` ['angle']\n        Rotation angle. If given as a floating-point value, it is assumed to be\n        in radians.\n\n    Returns\n    -------\n    offsets : tuple\n        The absolute value of the offset distances from the ellipse center that\n        define its bounding box region, ``(dx, dy)``.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n        from astropy.modeling.models import Ellipse2D\n        from astropy.modeling.utils import ellipse_extent, render_model\n\n        amplitude = 1\n        x0 = 50\n        y0 = 50\n        a = 30\n        b = 10\n        theta = np.pi/4\n\n        model = Ellipse2D(amplitude, x0, y0, a, b, theta)\n\n        dx, dy = ellipse_extent(a, b, theta)\n\n        limits = [x0 - dx, x0 + dx, y0 - dy, y0 + dy]\n\n        model.bounding_box = limits\n\n        image = render_model(model)\n\n        plt.imshow(image, cmap='binary', interpolation='nearest', alpha=.5,\n                  extent = limits)\n        plt.show()\n    \"\"\"\n\n    t = np.arctan2(-b * np.tan(theta), a)\n    dx = a * np.cos(t) * np.cos(theta) - b * np.sin(t) * np.sin(theta)\n\n    t = np.arctan2(b, a * np.tan(theta))\n    dy = b * np.sin(t) * np.cos(theta) + a * np.cos(t) * np.sin(theta)\n\n    if isinstance(dx, u.Quantity) or isinstance(dy, u.Quantity):\n        return np.abs(u.Quantity([dx, dy]))\n    return np.abs([dx, dy])"},{"col":0,"comment":"\n    Create an array representing inputs and outputs of a simple model.\n\n    The array has a shape (noutp, model.n_inputs).\n\n    Parameters\n    ----------\n    model : `astropy.modeling.Model`\n        model\n    pos : str\n        Position of this model in the expression tree.\n        One of ['left', 'right'].\n    noutp : int\n        Number of outputs of the compound model of which the input model\n        is a left or right child.\n\n    ","endLoc":216,"header":"def _coord_matrix(model, pos, noutp)","id":12237,"name":"_coord_matrix","nodeType":"Function","startLoc":171,"text":"def _coord_matrix(model, pos, noutp):\n    \"\"\"\n    Create an array representing inputs and outputs of a simple model.\n\n    The array has a shape (noutp, model.n_inputs).\n\n    Parameters\n    ----------\n    model : `astropy.modeling.Model`\n        model\n    pos : str\n        Position of this model in the expression tree.\n        One of ['left', 'right'].\n    noutp : int\n        Number of outputs of the compound model of which the input model\n        is a left or right child.\n\n    \"\"\"\n    if isinstance(model, Mapping):\n        axes = []\n        for i in model.mapping:\n            axis = np.zeros((model.n_inputs,))\n            axis[i] = 1\n            axes.append(axis)\n        m = np.vstack(axes)\n        mat = np.zeros((noutp, model.n_inputs))\n        if pos == 'left':\n            mat[: model.n_outputs, :model.n_inputs] = m\n        else:\n            mat[-model.n_outputs:, -model.n_inputs:] = m\n        return mat\n    if not model.separable:\n        # this does not work for more than 2 coordinates\n        mat = np.zeros((noutp, model.n_inputs))\n        if pos == 'left':\n            mat[:model.n_outputs, : model.n_inputs] = 1\n        else:\n            mat[-model.n_outputs:, -model.n_inputs:] = 1\n    else:\n        mat = np.zeros((noutp, model.n_inputs))\n\n        for i in range(model.n_inputs):\n            mat[i, i] = 1\n        if pos == 'right':\n            mat = np.roll(mat, (noutp - model.n_outputs))\n    return mat"},{"col":0,"comment":"\n    Write CCDData object to FITS file.\n\n    Parameters\n    ----------\n    filename : str\n        Name of file.\n\n    hdu_mask, hdu_uncertainty, hdu_flags : str or None, optional\n        If it is a string append this attribute to the HDUList as\n        `~astropy.io.fits.ImageHDU` with the string as extension name.\n        Flags are not supported at this time. If ``None`` this attribute\n        is not appended.\n        Default is ``'MASK'`` for mask, ``'UNCERT'`` for uncertainty and\n        ``None`` for flags.\n\n    key_uncertainty_type : str, optional\n        The header key name for the class name of the uncertainty (if any)\n        that is used to store the uncertainty type in the uncertainty hdu.\n        Default is ``UTYPE``.\n\n        .. versionadded:: 3.1\n\n    kwd :\n        All additional keywords are passed to :py:mod:`astropy.io.fits`\n\n    Raises\n    ------\n    ValueError\n        - If ``self.mask`` is set but not a `numpy.ndarray`.\n        - If ``self.uncertainty`` is set but not a\n          `~astropy.nddata.StdDevUncertainty`.\n        - If ``self.uncertainty`` is set but has another unit then\n          ``self.data``.\n\n    NotImplementedError\n        Saving flags is not supported.\n    ","endLoc":712,"header":"def fits_ccddata_writer(\n        ccd_data, filename, hdu_mask='MASK', hdu_uncertainty='UNCERT',\n        hdu_flags=None, key_uncertainty_type='UTYPE', **kwd)","id":12238,"name":"fits_ccddata_writer","nodeType":"Function","startLoc":668,"text":"def fits_ccddata_writer(\n        ccd_data, filename, hdu_mask='MASK', hdu_uncertainty='UNCERT',\n        hdu_flags=None, key_uncertainty_type='UTYPE', **kwd):\n    \"\"\"\n    Write CCDData object to FITS file.\n\n    Parameters\n    ----------\n    filename : str\n        Name of file.\n\n    hdu_mask, hdu_uncertainty, hdu_flags : str or None, optional\n        If it is a string append this attribute to the HDUList as\n        `~astropy.io.fits.ImageHDU` with the string as extension name.\n        Flags are not supported at this time. If ``None`` this attribute\n        is not appended.\n        Default is ``'MASK'`` for mask, ``'UNCERT'`` for uncertainty and\n        ``None`` for flags.\n\n    key_uncertainty_type : str, optional\n        The header key name for the class name of the uncertainty (if any)\n        that is used to store the uncertainty type in the uncertainty hdu.\n        Default is ``UTYPE``.\n\n        .. versionadded:: 3.1\n\n    kwd :\n        All additional keywords are passed to :py:mod:`astropy.io.fits`\n\n    Raises\n    ------\n    ValueError\n        - If ``self.mask`` is set but not a `numpy.ndarray`.\n        - If ``self.uncertainty`` is set but not a\n          `~astropy.nddata.StdDevUncertainty`.\n        - If ``self.uncertainty`` is set but has another unit then\n          ``self.data``.\n\n    NotImplementedError\n        Saving flags is not supported.\n    \"\"\"\n    hdu = ccd_data.to_hdu(\n        hdu_mask=hdu_mask, hdu_uncertainty=hdu_uncertainty,\n        key_uncertainty_type=key_uncertainty_type, hdu_flags=hdu_flags)\n    hdu.writeto(filename, **kwd)"},{"col":4,"comment":"null","endLoc":108,"header":"@staticmethod\n    def _convolution_outputs(outputs, output_shape)","id":12239,"name":"_convolution_outputs","nodeType":"Function","startLoc":106,"text":"@staticmethod\n    def _convolution_outputs(outputs, output_shape):\n        return outputs.reshape(output_shape)"},{"attributeType":"null","col":16,"comment":"null","endLoc":6,"id":12240,"name":"np","nodeType":"Attribute","startLoc":6,"text":"np"},{"attributeType":"null","col":29,"comment":"null","endLoc":12,"id":12241,"name":"u","nodeType":"Attribute","startLoc":12,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":12242,"name":"__all__","nodeType":"Attribute","startLoc":18,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":12243,"name":"_known_uncertainties","nodeType":"Attribute","startLoc":20,"text":"_known_uncertainties"},{"col":0,"comment":" Convert ``value`` to radian. ","endLoc":372,"header":"def _to_radian(value)","id":12244,"name":"_to_radian","nodeType":"Function","startLoc":368,"text":"def _to_radian(value):\n    \"\"\" Convert ``value`` to radian. \"\"\"\n    if isinstance(value, u.Quantity):\n        return value.to(u.rad)\n    return np.deg2rad(value)"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":12245,"name":"_unc_name_to_cls","nodeType":"Attribute","startLoc":21,"text":"_unc_name_to_cls"},{"attributeType":"null","col":42,"comment":"null","endLoc":21,"id":12246,"name":"cls","nodeType":"Attribute","startLoc":21,"text":"cls"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":12247,"name":"_unc_cls_to_name","nodeType":"Attribute","startLoc":22,"text":"_unc_cls_to_name"},{"attributeType":"null","col":42,"comment":"null","endLoc":22,"id":12248,"name":"cls","nodeType":"Attribute","startLoc":22,"text":"cls"},{"col":4,"comment":"null","endLoc":115,"header":"def __call__(self, *args, **kw)","id":12249,"name":"__call__","nodeType":"Function","startLoc":110,"text":"def __call__(self, *args, **kw):\n        inputs, output_shape = self._convolution_inputs(*args)\n        convolution = self._get_convolution(**kw)\n        outputs = convolution(inputs)\n\n        return self._convolution_outputs(outputs, output_shape)"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":12250,"name":"_config_ccd_requires_unit","nodeType":"Attribute","startLoc":27,"text":"_config_ccd_requires_unit"},{"attributeType":"null","col":0,"comment":"null","endLoc":446,"id":12251,"name":"_KEEP_THESE_KEYWORDS_IN_HEADER","nodeType":"Attribute","startLoc":446,"text":"_KEEP_THESE_KEYWORDS_IN_HEADER"},{"attributeType":"null","col":0,"comment":"null","endLoc":451,"id":12252,"name":"_PCs","nodeType":"Attribute","startLoc":451,"text":"_PCs"},{"attributeType":"null","col":0,"comment":"null","endLoc":452,"id":12253,"name":"_CDs","nodeType":"Attribute","startLoc":452,"text":"_CDs"},{"col":0,"comment":"","endLoc":2,"header":"ccddata.py#<anonymous>","id":12254,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"This module implements the base CCDData class.\"\"\"\n\n__all__ = ['CCDData', 'fits_ccddata_reader', 'fits_ccddata_writer']\n\n_known_uncertainties = (StdDevUncertainty, VarianceUncertainty, InverseVariance)\n\n_unc_name_to_cls = {cls.__name__: cls for cls in _known_uncertainties}\n\n_unc_cls_to_name = {cls: cls.__name__ for cls in _known_uncertainties}\n\n_config_ccd_requires_unit = True\n\n_KEEP_THESE_KEYWORDS_IN_HEADER = [\n    'JD-OBS',\n    'MJD-OBS',\n    'DATE-OBS'\n]\n\n_PCs = set(['PC1_1', 'PC1_2', 'PC2_1', 'PC2_2'])\n\n_CDs = set(['CD1_1', 'CD1_2', 'CD2_1', 'CD2_2'])\n\nwith registry.delay_doc_updates(CCDData):\n    registry.register_reader('fits', CCDData, fits_ccddata_reader)\n    registry.register_writer('fits', CCDData, fits_ccddata_writer)\n    registry.register_identifier('fits', CCDData, fits.connect.is_fits)"},{"col":0,"comment":" Convert value with ``raw_unit`` to ``orig_unit``. ","endLoc":379,"header":"def _to_orig_unit(value, raw_unit=None, orig_unit=None)","id":12255,"name":"_to_orig_unit","nodeType":"Function","startLoc":375,"text":"def _to_orig_unit(value, raw_unit=None, orig_unit=None):\n    \"\"\" Convert value with ``raw_unit`` to ``orig_unit``. \"\"\"\n    if raw_unit is not None:\n        return (value * raw_unit).to(orig_unit)\n    return np.rad2deg(value)"},{"fileName":"bounding_box.py","filePath":"astropy/modeling","id":12256,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\n\"\"\"\nThis module is to contain an improved bounding box\n\"\"\"\n\nimport abc\nimport copy\n\nfrom collections import namedtuple\nfrom typing import Dict, List, Tuple, Callable, Any\n\nfrom astropy.utils import isiterable\nfrom astropy.units import Quantity\n\nimport warnings\nimport numpy as np\n\n\n__all__ = ['ModelBoundingBox', 'CompoundBoundingBox']\n\n\n_BaseInterval = namedtuple('_BaseInterval', \"lower upper\")\n\n\nclass _Interval(_BaseInterval):\n    \"\"\"\n    A single input's bounding box interval.\n\n    Parameters\n    ----------\n    lower : float\n        The lower bound of the interval\n\n    upper : float\n        The upper bound of the interval\n\n    Methods\n    -------\n    validate :\n        Contructs a valid interval\n\n    outside :\n        Determine which parts of an input array are outside the interval.\n\n    domain :\n        Contructs a discretization of the points inside the interval.\n    \"\"\"\n\n    def __repr__(self):\n        return f\"Interval(lower={self.lower}, upper={self.upper})\"\n\n    def copy(self):\n        return copy.deepcopy(self)\n\n    @staticmethod\n    def _validate_shape(interval):\n        \"\"\"Validate the shape of an interval representation\"\"\"\n        MESSAGE = \"\"\"An interval must be some sort of sequence of length 2\"\"\"\n\n        try:\n            shape = np.shape(interval)\n        except TypeError:\n            try:\n                # np.shape does not work with lists of Quantities\n                if len(interval) == 1:\n                    interval = interval[0]\n                shape = np.shape([b.to_value() for b in interval])\n            except (ValueError, TypeError, AttributeError):\n                raise ValueError(MESSAGE)\n\n        valid_shape = shape in ((2,), (1, 2), (2, 0))\n        if not valid_shape:\n            valid_shape = (len(shape) > 0) and (shape[0] == 2) and \\\n                all(isinstance(b, np.ndarray) for b in interval)\n\n        if not isiterable(interval) or not valid_shape:\n            raise ValueError(MESSAGE)\n\n    @classmethod\n    def _validate_bounds(cls, lower, upper):\n        \"\"\"Validate the bounds are reasonable and construct an interval from them.\"\"\"\n        if (np.asanyarray(lower) > np.asanyarray(upper)).all():\n            warnings.warn(f\"Invalid interval: upper bound {upper} \"\n                          f\"is strictly less than lower bound {lower}.\", RuntimeWarning)\n\n        return cls(lower, upper)\n\n    @classmethod\n    def validate(cls, interval):\n        \"\"\"\n        Construct and validate an interval\n\n        Parameters\n        ----------\n        interval : iterable\n            A representation of the interval.\n\n        Returns\n        -------\n        A validated interval.\n        \"\"\"\n        cls._validate_shape(interval)\n\n        if len(interval) == 1:\n            interval = tuple(interval[0])\n        else:\n            interval = tuple(interval)\n\n        return cls._validate_bounds(interval[0], interval[1])\n\n    def outside(self, _input: np.ndarray):\n        \"\"\"\n        Parameters\n        ----------\n        _input : np.ndarray\n            The evaluation input in the form of an array.\n\n        Returns\n        -------\n        Boolean array indicating which parts of _input are outside the interval:\n            True  -> position outside interval\n            False -> position inside  interval\n        \"\"\"\n        return np.logical_or(_input < self.lower, _input > self.upper)\n\n    def domain(self, resolution):\n        return np.arange(self.lower, self.upper + resolution, resolution)\n\n\n# The interval where all ignored inputs can be found.\n_ignored_interval = _Interval.validate((-np.inf, np.inf))\n\n\ndef get_index(model, key) -> int:\n    \"\"\"\n    Get the input index corresponding to the given key.\n        Can pass in either:\n            the string name of the input or\n            the input index itself.\n    \"\"\"\n    if isinstance(key, str):\n        if key in model.inputs:\n            index = model.inputs.index(key)\n        else:\n            raise ValueError(f\"'{key}' is not one of the inputs: {model.inputs}.\")\n    elif np.issubdtype(type(key), np.integer):\n        if 0 <= key < len(model.inputs):\n            index = key\n        else:\n            raise IndexError(f\"Integer key: {key} must be non-negative and < {len(model.inputs)}.\")\n    else:\n        raise ValueError(f\"Key value: {key} must be string or integer.\")\n\n    return index\n\n\ndef get_name(model, index: int):\n    \"\"\"Get the input name corresponding to the input index\"\"\"\n    return model.inputs[index]\n\n\nclass _BoundingDomain(abc.ABC):\n    \"\"\"\n    Base class for ModelBoundingBox and CompoundBoundingBox.\n        This is where all the `~astropy.modeling.core.Model` evaluation\n        code for evaluating with a bounding box is because it is common\n        to both types of bounding box.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.Model`\n        The Model this bounding domain is for.\n\n    prepare_inputs :\n        Generates the necessary input information so that model can\n        be evaluated only for input points entirely inside bounding_box.\n        This needs to be implemented by a subclass. Note that most of\n        the implementation is in ModelBoundingBox.\n\n    prepare_outputs :\n        Fills the output values in for any input points outside the\n        bounding_box.\n\n    evaluate :\n        Performs a complete model evaluation while enforcing the bounds\n        on the inputs and returns a complete output.\n    \"\"\"\n\n    def __init__(self, model, ignored: List[int] = None, order: str = 'C'):\n        self._model = model\n        self._ignored = self._validate_ignored(ignored)\n        self._order = self._get_order(order)\n\n    @property\n    def model(self):\n        return self._model\n\n    @property\n    def order(self) -> str:\n        return self._order\n\n    @property\n    def ignored(self) -> List[int]:\n        return self._ignored\n\n    def _get_order(self, order: str = None) -> str:\n        \"\"\"\n        Get if bounding_box is C/python ordered or Fortran/mathematically\n        ordered\n        \"\"\"\n        if order is None:\n            order = self._order\n\n        if order not in ('C', 'F'):\n            raise ValueError(\"order must be either 'C' (C/python order) or \"\n                             f\"'F' (Fortran/mathematical order), got: {order}.\")\n\n        return order\n\n    def _get_index(self, key) -> int:\n        \"\"\"\n        Get the input index corresponding to the given key.\n            Can pass in either:\n                the string name of the input or\n                the input index itself.\n        \"\"\"\n\n        return get_index(self._model, key)\n\n    def _get_name(self, index: int):\n        \"\"\"Get the input name corresponding to the input index\"\"\"\n        return get_name(self._model, index)\n\n    @property\n    def ignored_inputs(self) -> List[str]:\n        return [self._get_name(index) for index in self._ignored]\n\n    def _validate_ignored(self, ignored: list) -> List[int]:\n        if ignored is None:\n            return []\n        else:\n            return [self._get_index(key) for key in ignored]\n\n    def __call__(self, *args, **kwargs):\n        raise NotImplementedError(\n            \"This bounding box is fixed by the model and does not have \"\n            \"adjustable parameters.\")\n\n    @abc.abstractmethod\n    def fix_inputs(self, model, fixed_inputs: dict):\n        \"\"\"\n        Fix the bounding_box for a `fix_inputs` compound model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The new model for which this will be a bounding_box\n        fixed_inputs : dict\n            Dictionary of inputs which have been fixed by this bounding box.\n        \"\"\"\n\n        raise NotImplementedError(\"This should be implemented by a child class.\")\n\n    @abc.abstractmethod\n    def prepare_inputs(self, input_shape, inputs) -> Tuple[Any, Any, Any]:\n        \"\"\"\n        Get prepare the inputs with respect to the bounding box.\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        valid_inputs : list\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : array_like\n            array of all indices inside the bounding box\n        all_out: bool\n            if all of the inputs are outside the bounding_box\n        \"\"\"\n        raise NotImplementedError(\"This has not been implemented for BoundingDomain.\")\n\n    @staticmethod\n    def _base_output(input_shape, fill_value):\n        \"\"\"\n        Create a baseline output, assuming that the entire input is outside\n        the bounding box\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n\n        Returns\n        -------\n        An array of the correct shape containing all fill_value\n        \"\"\"\n        return np.zeros(input_shape) + fill_value\n\n    def _all_out_output(self, input_shape, fill_value):\n        \"\"\"\n        Create output if all inputs are outside the domain\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n\n        Returns\n        -------\n        A full set of outputs for case that all inputs are outside domain.\n        \"\"\"\n\n        return [self._base_output(input_shape, fill_value)\n                for _ in range(self._model.n_outputs)], None\n\n    def _modify_output(self, valid_output, valid_index, input_shape, fill_value):\n        \"\"\"\n        For a single output fill in all the parts corresponding to inputs\n        outside the bounding box.\n\n        Parameters\n        ----------\n        valid_output : numpy array\n            The output from the model corresponding to inputs inside the\n            bounding box\n        valid_index : numpy array\n            array of all indices of inputs inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n\n        Returns\n        -------\n        An output array with all the indices corresponding to inputs\n        outside the bounding box filled in by fill_value\n        \"\"\"\n        output = self._base_output(input_shape, fill_value)\n        if not output.shape:\n            output = np.array(valid_output)\n        else:\n            output[valid_index] = valid_output\n\n        if np.isscalar(valid_output):\n            output = output.item(0)\n\n        return output\n\n    def _prepare_outputs(self, valid_outputs, valid_index, input_shape, fill_value):\n        \"\"\"\n        Fill in all the outputs of the model corresponding to inputs\n        outside the bounding_box.\n\n        Parameters\n        ----------\n        valid_outputs : list of numpy array\n            The list of outputs from the model corresponding to inputs\n            inside the bounding box\n        valid_index : numpy array\n            array of all indices of inputs inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n\n        Returns\n        -------\n        List of filled in output arrays.\n        \"\"\"\n        outputs = []\n        for valid_output in valid_outputs:\n            outputs.append(self._modify_output(valid_output, valid_index, input_shape, fill_value))\n\n        return outputs\n\n    def prepare_outputs(self, valid_outputs, valid_index, input_shape, fill_value):\n        \"\"\"\n        Fill in all the outputs of the model corresponding to inputs\n        outside the bounding_box, adjusting any single output model so that\n        its output becomes a list of containing that output.\n\n        Parameters\n        ----------\n        valid_outputs : list\n            The list of outputs from the model corresponding to inputs\n            inside the bounding box\n        valid_index : array_like\n            array of all indices of inputs inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n        \"\"\"\n        if self._model.n_outputs == 1:\n            valid_outputs = [valid_outputs]\n\n        return self._prepare_outputs(valid_outputs, valid_index, input_shape, fill_value)\n\n    @staticmethod\n    def _get_valid_outputs_unit(valid_outputs, with_units: bool):\n        \"\"\"\n        Get the unit for outputs if one is required.\n\n        Parameters\n        ----------\n        valid_outputs : list of numpy array\n            The list of outputs from the model corresponding to inputs\n            inside the bounding box\n        with_units : bool\n            whether or not a unit is required\n        \"\"\"\n\n        if with_units:\n            return getattr(valid_outputs, 'unit', None)\n\n    def _evaluate_model(self, evaluate: Callable, valid_inputs, valid_index,\n                        input_shape, fill_value, with_units: bool):\n        \"\"\"\n        Evaluate the model using the given evaluate routine\n\n        Parameters\n        ----------\n        evaluate : Callable\n            callable which takes in the valid inputs to evaluate model\n        valid_inputs : list of numpy arrays\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : numpy array\n            array of all indices inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n        with_units : bool\n            whether or not a unit is required\n\n        Returns\n        -------\n        outputs :\n            list containing filled in output values\n        valid_outputs_unit :\n            the unit that will be attached to the outputs\n        \"\"\"\n        valid_outputs = evaluate(valid_inputs)\n        valid_outputs_unit = self._get_valid_outputs_unit(valid_outputs, with_units)\n\n        return self.prepare_outputs(valid_outputs, valid_index,\n                                    input_shape, fill_value), valid_outputs_unit\n\n    def _evaluate(self, evaluate: Callable, inputs, input_shape,\n                  fill_value, with_units: bool):\n        \"\"\"\n        Perform model evaluation steps:\n            prepare_inputs -> evaluate -> prepare_outputs\n\n        Parameters\n        ----------\n        evaluate : Callable\n            callable which takes in the valid inputs to evaluate model\n        valid_inputs : list of numpy arrays\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : numpy array\n            array of all indices inside the bounding box\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n        with_units : bool\n            whether or not a unit is required\n\n        Returns\n        -------\n        outputs :\n            list containing filled in output values\n        valid_outputs_unit :\n            the unit that will be attached to the outputs\n        \"\"\"\n        valid_inputs, valid_index, all_out = self.prepare_inputs(input_shape, inputs)\n\n        if all_out:\n            return self._all_out_output(input_shape, fill_value)\n        else:\n            return self._evaluate_model(evaluate, valid_inputs, valid_index,\n                                        input_shape, fill_value, with_units)\n\n    @staticmethod\n    def _set_outputs_unit(outputs, valid_outputs_unit):\n        \"\"\"\n        Set the units on the outputs\n            prepare_inputs -> evaluate -> prepare_outputs -> set output units\n\n        Parameters\n        ----------\n        outputs :\n            list containing filled in output values\n        valid_outputs_unit :\n            the unit that will be attached to the outputs\n\n        Returns\n        -------\n        List containing filled in output values and units\n        \"\"\"\n\n        if valid_outputs_unit is not None:\n            return Quantity(outputs, valid_outputs_unit, copy=False)\n\n        return outputs\n\n    def evaluate(self, evaluate: Callable, inputs, fill_value):\n        \"\"\"\n        Perform full model evaluation steps:\n            prepare_inputs -> evaluate -> prepare_outputs -> set output units\n\n        Parameters\n        ----------\n        evaluate : callable\n            callable which takes in the valid inputs to evaluate model\n        valid_inputs : list\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : array_like\n            array of all indices inside the bounding box\n        fill_value : float\n            The value which will be assigned to inputs which are outside\n            the bounding box\n        \"\"\"\n        input_shape = self._model.input_shape(inputs)\n\n        # NOTE: CompoundModel does not currently support units during\n        #   evaluation for bounding_box so this feature is turned off\n        #   for CompoundModel(s).\n        outputs, valid_outputs_unit = self._evaluate(evaluate, inputs, input_shape,\n                                                     fill_value, self._model.bbox_with_units)\n        return tuple(self._set_outputs_unit(outputs, valid_outputs_unit))\n\n\nclass ModelBoundingBox(_BoundingDomain):\n    \"\"\"\n    A model's bounding box\n\n    Parameters\n    ----------\n    intervals : dict\n        A dictionary containing all the intervals for each model input\n            keys   -> input index\n            values -> interval for that index\n\n    model : `~astropy.modeling.Model`\n        The Model this bounding_box is for.\n\n    ignored : list\n        A list containing all the inputs (index) which will not be\n        checked for whether or not their elements are in/out of an interval.\n\n    order : optional, str\n        The ordering that is assumed for the tuple representation of this\n        bounding_box. Options: 'C': C/Python order, e.g. z, y, x.\n        (default), 'F': Fortran/mathematical notation order, e.g. x, y, z.\n    \"\"\"\n\n    def __init__(self, intervals: Dict[int, _Interval], model,\n                 ignored: List[int] = None, order: str = 'C'):\n        super().__init__(model, ignored, order)\n\n        self._intervals = {}\n        if intervals != () and intervals != {}:\n            self._validate(intervals, order=order)\n\n    def copy(self, ignored=None):\n        intervals = {index: interval.copy()\n                     for index, interval in self._intervals.items()}\n\n        if ignored is None:\n            ignored = self._ignored.copy()\n\n        return ModelBoundingBox(intervals, self._model,\n                                ignored=ignored,\n                                order=self._order)\n\n    @property\n    def intervals(self) -> Dict[int, _Interval]:\n        \"\"\"Return bounding_box labeled using input positions\"\"\"\n        return self._intervals\n\n    @property\n    def named_intervals(self) -> Dict[str, _Interval]:\n        \"\"\"Return bounding_box labeled using input names\"\"\"\n        return {self._get_name(index): bbox for index, bbox in self._intervals.items()}\n\n    def __repr__(self):\n        parts = [\n            'ModelBoundingBox(',\n            '    intervals={'\n        ]\n\n        for name, interval in self.named_intervals.items():\n            parts.append(f\"        {name}: {interval}\")\n\n        parts.append('    }')\n        if len(self._ignored) > 0:\n            parts.append(f\"    ignored={self.ignored_inputs}\")\n\n        parts.append(f'    model={self._model.__class__.__name__}(inputs={self._model.inputs})')\n        parts.append(f\"    order='{self._order}'\")\n        parts.append(')')\n\n        return '\\n'.join(parts)\n\n    def __len__(self):\n        return len(self._intervals)\n\n    def __contains__(self, key):\n        try:\n            return self._get_index(key) in self._intervals or self._ignored\n        except (IndexError, ValueError):\n            return False\n\n    def has_interval(self, key):\n        return self._get_index(key) in self._intervals\n\n    def __getitem__(self, key):\n        \"\"\"Get bounding_box entries by either input name or input index\"\"\"\n        index = self._get_index(key)\n        if index in self._ignored:\n            return _ignored_interval\n        else:\n            return self._intervals[self._get_index(key)]\n\n    def bounding_box(self, order: str = None):\n        \"\"\"\n        Return the old tuple of tuples representation of the bounding_box\n            order='C' corresponds to the old bounding_box ordering\n            order='F' corresponds to the gwcs bounding_box ordering.\n        \"\"\"\n        if len(self._intervals) == 1:\n            return tuple(list(self._intervals.values())[0])\n        else:\n            order = self._get_order(order)\n            inputs = self._model.inputs\n            if order == 'C':\n                inputs = inputs[::-1]\n\n            bbox = tuple([tuple(self[input_name]) for input_name in inputs])\n            if len(bbox) == 1:\n                bbox = bbox[0]\n\n            return bbox\n\n    def __eq__(self, value):\n        \"\"\"Note equality can be either with old representation or new one.\"\"\"\n        if isinstance(value, tuple):\n            return self.bounding_box() == value\n        elif isinstance(value, ModelBoundingBox):\n            return (self.intervals == value.intervals) and (self.ignored == value.ignored)\n        else:\n            return False\n\n    def __setitem__(self, key, value):\n        \"\"\"Validate and store interval under key (input index or input name).\"\"\"\n        index = self._get_index(key)\n        if index in self._ignored:\n            self._ignored.remove(index)\n\n        self._intervals[index] = _Interval.validate(value)\n\n    def __delitem__(self, key):\n        \"\"\"Delete stored interval\"\"\"\n        index = self._get_index(key)\n        if index in self._ignored:\n            raise RuntimeError(f\"Cannot delete ignored input: {key}!\")\n        del self._intervals[index]\n        self._ignored.append(index)\n\n    def _validate_dict(self, bounding_box: dict):\n        \"\"\"Validate passing dictionary of intervals and setting them.\"\"\"\n        for key, value in bounding_box.items():\n            self[key] = value\n\n    def _validate_sequence(self, bounding_box, order: str = None):\n        \"\"\"Validate passing tuple of tuples representation (or related) and setting them.\"\"\"\n        order = self._get_order(order)\n        if order == 'C':\n            # If bounding_box is C/python ordered, it needs to be reversed\n            # to be in Fortran/mathematical/input order.\n            bounding_box = bounding_box[::-1]\n\n        for index, value in enumerate(bounding_box):\n            self[index] = value\n\n    @property\n    def _n_inputs(self) -> int:\n        n_inputs = self._model.n_inputs - len(self._ignored)\n        if n_inputs > 0:\n            return n_inputs\n        else:\n            return 0\n\n    def _validate_iterable(self, bounding_box, order: str = None):\n        \"\"\"Validate and set any iterable representation\"\"\"\n        if len(bounding_box) != self._n_inputs:\n            raise ValueError(f\"Found {len(bounding_box)} intervals, \"\n                             f\"but must have exactly {self._n_inputs}.\")\n\n        if isinstance(bounding_box, dict):\n            self._validate_dict(bounding_box)\n        else:\n            self._validate_sequence(bounding_box, order)\n\n    def _validate(self, bounding_box, order: str = None):\n        \"\"\"Validate and set any representation\"\"\"\n        if self._n_inputs == 1 and not isinstance(bounding_box, dict):\n            self[0] = bounding_box\n        else:\n            self._validate_iterable(bounding_box, order)\n\n    @classmethod\n    def validate(cls, model, bounding_box,\n                 ignored: list = None, order: str = 'C', _preserve_ignore: bool = False, **kwargs):\n        \"\"\"\n        Construct a valid bounding box for a model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The model for which this will be a bounding_box\n        bounding_box : dict, tuple\n            A possible representation of the bounding box\n        order : optional, str\n            The order that a tuple representation will be assumed to be\n                Default: 'C'\n        \"\"\"\n        if isinstance(bounding_box, ModelBoundingBox):\n            order = bounding_box.order\n            if _preserve_ignore:\n                ignored = bounding_box.ignored\n            bounding_box = bounding_box.intervals\n\n        new = cls({}, model, ignored=ignored, order=order)\n        new._validate(bounding_box)\n\n        return new\n\n    def fix_inputs(self, model, fixed_inputs: dict, _keep_ignored=False):\n        \"\"\"\n        Fix the bounding_box for a `fix_inputs` compound model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The new model for which this will be a bounding_box\n        fixed_inputs : dict\n            Dictionary of inputs which have been fixed by this bounding box.\n        keep_ignored : bool\n            Keep the ignored inputs of the bounding box (internal argument only)\n        \"\"\"\n\n        new = self.copy()\n\n        for _input in fixed_inputs.keys():\n            del new[_input]\n\n        if _keep_ignored:\n            ignored = new.ignored\n        else:\n            ignored = None\n\n        return ModelBoundingBox.validate(model, new.named_intervals,\n                                    ignored=ignored, order=new._order)\n\n    @property\n    def dimension(self):\n        return len(self)\n\n    def domain(self, resolution, order: str = None):\n        inputs = self._model.inputs\n        order = self._get_order(order)\n        if order == 'C':\n            inputs = inputs[::-1]\n\n        return [self[input_name].domain(resolution) for input_name in inputs]\n\n    def _outside(self,  input_shape, inputs):\n        \"\"\"\n        Get all the input positions which are outside the bounding_box,\n        so that the corresponding outputs can be filled with the fill\n        value (default NaN).\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        outside_index : bool-numpy array\n            True  -> position outside bounding_box\n            False -> position inside  bounding_box\n        all_out : bool\n            if all of the inputs are outside the bounding_box\n        \"\"\"\n        all_out = False\n\n        outside_index = np.zeros(input_shape, dtype=bool)\n        for index, _input in enumerate(inputs):\n            _input = np.asanyarray(_input)\n\n            outside = np.broadcast_to(self[index].outside(_input), input_shape)\n            outside_index[outside] = True\n\n            if outside_index.all():\n                all_out = True\n                break\n\n        return outside_index, all_out\n\n    def _valid_index(self, input_shape, inputs):\n        \"\"\"\n        Get the indices of all the inputs inside the bounding_box.\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        valid_index : numpy array\n            array of all indices inside the bounding box\n        all_out : bool\n            if all of the inputs are outside the bounding_box\n        \"\"\"\n        outside_index, all_out = self._outside(input_shape, inputs)\n\n        valid_index = np.atleast_1d(np.logical_not(outside_index)).nonzero()\n        if len(valid_index[0]) == 0:\n            all_out = True\n\n        return valid_index, all_out\n\n    def prepare_inputs(self, input_shape, inputs) -> Tuple[Any, Any, Any]:\n        \"\"\"\n        Get prepare the inputs with respect to the bounding box.\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        valid_inputs : list\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : array_like\n            array of all indices inside the bounding box\n        all_out: bool\n            if all of the inputs are outside the bounding_box\n        \"\"\"\n        valid_index, all_out = self._valid_index(input_shape, inputs)\n\n        valid_inputs = []\n        if not all_out:\n            for _input in inputs:\n                if input_shape:\n                    valid_input = np.broadcast_to(np.atleast_1d(_input), input_shape)[valid_index]\n                    if np.isscalar(_input):\n                        valid_input = valid_input.item(0)\n                    valid_inputs.append(valid_input)\n                else:\n                    valid_inputs.append(_input)\n\n        return tuple(valid_inputs), valid_index, all_out\n\n\n_BaseSelectorArgument = namedtuple('_BaseSelectorArgument', \"index ignore\")\n\n\nclass _SelectorArgument(_BaseSelectorArgument):\n    \"\"\"\n    Contains a single CompoundBoundingBox slicing input.\n\n    Parameters\n    ----------\n    index : int\n        The index of the input in the input list\n\n    ignore : bool\n        Whether or not this input will be ignored by the bounding box.\n\n    Methods\n    -------\n    validate :\n        Returns a valid SelectorArgument for a given model.\n\n    get_selector :\n        Returns the value of the input for use in finding the correct\n        bounding_box.\n\n    get_fixed_value :\n        Gets the slicing value from a fix_inputs set of values.\n    \"\"\"\n\n    def __new__(cls, index, ignore):\n        self = super().__new__(cls, index, ignore)\n\n        return self\n\n    @classmethod\n    def validate(cls, model, argument, ignored: bool = True):\n        \"\"\"\n        Construct a valid selector argument for a CompoundBoundingBox.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The model for which this will be an argument for.\n        argument : int or str\n            A representation of which evaluation input to use\n        ignored : optional, bool\n            Whether or not to ignore this argument in the ModelBoundingBox.\n\n        Returns\n        -------\n        Validated selector_argument\n        \"\"\"\n        return cls(get_index(model, argument), ignored)\n\n    def get_selector(self, *inputs):\n        \"\"\"\n        Get the selector value corresponding to this argument\n\n        Parameters\n        ----------\n        *inputs :\n            All the processed model evaluation inputs.\n        \"\"\"\n        _selector = inputs[self.index]\n        if isiterable(_selector):\n            if len(_selector) == 1:\n                return _selector[0]\n            else:\n                return tuple(_selector)\n        return _selector\n\n    def name(self, model) -> str:\n        \"\"\"\n        Get the name of the input described by this selector argument\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n        \"\"\"\n        return get_name(model, self.index)\n\n    def pretty_repr(self, model):\n        \"\"\"\n        Get a pretty-print representation of this object\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n        \"\"\"\n        return f\"Argument(name='{self.name(model)}', ignore={self.ignore})\"\n\n    def get_fixed_value(self, model, values: dict):\n        \"\"\"\n        Gets the value fixed input corresponding to this argument\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n\n        values : dict\n            Dictionary of fixed inputs.\n        \"\"\"\n        if self.index in values:\n            return values[self.index]\n        else:\n            if self.name(model) in values:\n                return values[self.name(model)]\n            else:\n                raise RuntimeError(f\"{self.pretty_repr(model)} was not found in {values}\")\n\n    def is_argument(self, model, argument) -> bool:\n        \"\"\"\n        Determine if passed argument is described by this selector argument\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n\n        argument : int or str\n            A representation of which evaluation input is being used\n        \"\"\"\n\n        return self.index == get_index(model, argument)\n\n    def named_tuple(self, model):\n        \"\"\"\n        Get a tuple representation of this argument using the input\n        name from the model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n        \"\"\"\n        return (self.name(model), self.ignore)\n\n\nclass _SelectorArguments(tuple):\n    \"\"\"\n    Contains the CompoundBoundingBox slicing description\n\n    Parameters\n    ----------\n    input_ :\n        The SelectorArgument values\n\n    Methods\n    -------\n    validate :\n        Returns a valid SelectorArguments for its model.\n\n    get_selector :\n        Returns the selector a set of inputs corresponds to.\n\n    is_selector :\n        Determines if a selector is correctly formatted for this CompoundBoundingBox.\n\n    get_fixed_value :\n        Gets the selector from a fix_inputs set of values.\n    \"\"\"\n\n    _kept_ignore = None\n\n    def __new__(cls, input_: Tuple[_SelectorArgument], kept_ignore: List = None):\n        self = super().__new__(cls, input_)\n\n        if kept_ignore is None:\n            self._kept_ignore = []\n        else:\n            self._kept_ignore = kept_ignore\n\n        return self\n\n    def pretty_repr(self, model):\n        \"\"\"\n        Get a pretty-print representation of this object\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n        \"\"\"\n        parts = ['SelectorArguments(']\n        for argument in self:\n            parts.append(\n                f\"    {argument.pretty_repr(model)}\"\n            )\n        parts.append(')')\n\n        return '\\n'.join(parts)\n\n    @property\n    def ignore(self):\n        \"\"\"Get the list of ignored inputs\"\"\"\n        ignore = [argument.index for argument in self if argument.ignore]\n        ignore.extend(self._kept_ignore)\n\n        return ignore\n\n    @property\n    def kept_ignore(self):\n        \"\"\"The arguments to persist in ignoring\"\"\"\n        return self._kept_ignore\n\n    @classmethod\n    def validate(cls, model, arguments, kept_ignore: List=None):\n        \"\"\"\n        Construct a valid Selector description for a CompoundBoundingBox.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        arguments :\n            The individual argument informations\n\n        kept_ignore :\n            Arguments to persist as ignored\n        \"\"\"\n        inputs = []\n        for argument in arguments:\n            _input = _SelectorArgument.validate(model, *argument)\n            if _input.index in [this.index for this in inputs]:\n                raise ValueError(f\"Input: '{get_name(model, _input.index)}' has been repeated.\")\n            inputs.append(_input)\n\n        if len(inputs) == 0:\n            raise ValueError(\"There must be at least one selector argument.\")\n\n        if isinstance(arguments, _SelectorArguments):\n            if kept_ignore is None:\n                kept_ignore = []\n\n            kept_ignore.extend(arguments.kept_ignore)\n\n        return cls(tuple(inputs), kept_ignore)\n\n    def get_selector(self, *inputs):\n        \"\"\"\n        Get the selector corresponding to these inputs\n\n        Parameters\n        ----------\n        *inputs :\n            All the processed model evaluation inputs.\n        \"\"\"\n        return tuple([argument.get_selector(*inputs) for argument in self])\n\n    def is_selector(self, _selector):\n        \"\"\"\n        Determine if this is a reasonable selector\n\n        Parameters\n        ----------\n        _selector : tuple\n            The selector to check\n        \"\"\"\n        return isinstance(_selector, tuple) and len(_selector) == len(self)\n\n    def get_fixed_values(self, model, values: dict):\n        \"\"\"\n        Gets the value fixed input corresponding to this argument\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        values : dict\n            Dictionary of fixed inputs.\n        \"\"\"\n        return tuple([argument.get_fixed_value(model, values) for argument in self])\n\n    def is_argument(self, model, argument) -> bool:\n        \"\"\"\n        Determine if passed argument is one of the selector arguments\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        argument : int or str\n            A representation of which evaluation input is being used\n        \"\"\"\n\n        for selector_arg in self:\n            if selector_arg.is_argument(model, argument):\n                return True\n        else:\n            return False\n\n    def selector_index(self, model, argument):\n        \"\"\"\n        Get the index of the argument passed in the selector tuples\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        argument : int or str\n            A representation of which argument is being used\n        \"\"\"\n\n        for index, selector_arg in enumerate(self):\n            if selector_arg.is_argument(model, argument):\n                return index\n        else:\n            raise ValueError(f\"{argument} does not correspond to any selector argument.\")\n\n    def reduce(self, model, argument):\n        \"\"\"\n        Reduce the selector arguments by the argument given\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        argument : int or str\n            A representation of which argument is being used\n        \"\"\"\n\n        arguments = list(self)\n        kept_ignore = [arguments.pop(self.selector_index(model, argument)).index]\n        kept_ignore.extend(self._kept_ignore)\n\n        return _SelectorArguments.validate(model, tuple(arguments), kept_ignore)\n\n    def add_ignore(self, model, argument):\n        \"\"\"\n        Add argument to the kept_ignore list\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        argument : int or str\n            A representation of which argument is being used\n        \"\"\"\n\n        if self.is_argument(model, argument):\n            raise ValueError(f\"{argument}: is a selector argument and cannot be ignored.\")\n\n        kept_ignore = [get_index(model, argument)]\n\n        return _SelectorArguments.validate(model, self, kept_ignore)\n\n    def named_tuple(self, model):\n        \"\"\"\n        Get a tuple of selector argument tuples using input names\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n        \"\"\"\n        return tuple([selector_arg.named_tuple(model) for selector_arg in self])\n\n\nclass CompoundBoundingBox(_BoundingDomain):\n    \"\"\"\n    A model's compound bounding box\n\n    Parameters\n    ----------\n    bounding_boxes : dict\n        A dictionary containing all the ModelBoundingBoxes that are possible\n            keys   -> _selector (extracted from model inputs)\n            values -> ModelBoundingBox\n\n    model : `~astropy.modeling.Model`\n        The Model this compound bounding_box is for.\n\n    selector_args : _SelectorArguments\n        A description of how to extract the selectors from model inputs.\n\n    create_selector : optional\n        A method which takes in the selector and the model to return a\n        valid bounding corresponding to that selector. This can be used\n        to construct new bounding_boxes for previously undefined selectors.\n        These new boxes are then stored for future lookups.\n\n    order : optional, str\n        The ordering that is assumed for the tuple representation of the\n        bounding_boxes.\n    \"\"\"\n    def __init__(self, bounding_boxes: Dict[Any, ModelBoundingBox], model,\n                 selector_args: _SelectorArguments, create_selector: Callable = None,\n                 ignored: List[int] = None, order: str = 'C'):\n        super().__init__(model, ignored, order)\n\n        self._create_selector = create_selector\n        self._selector_args = _SelectorArguments.validate(model, selector_args)\n\n        self._bounding_boxes = {}\n        self._validate(bounding_boxes)\n\n    def copy(self):\n        bounding_boxes = {selector: bbox.copy(self.selector_args.ignore)\n                          for selector, bbox in self._bounding_boxes.items()}\n\n        return CompoundBoundingBox(bounding_boxes, self._model,\n                                   selector_args=self._selector_args,\n                                   create_selector=copy.deepcopy(self._create_selector),\n                                   order=self._order)\n\n    def __repr__(self):\n        parts = ['CompoundBoundingBox(',\n                 '    bounding_boxes={']\n        # bounding_boxes\n        for _selector, bbox in self._bounding_boxes.items():\n            bbox_repr = bbox.__repr__().split('\\n')\n            parts.append(f\"        {_selector} = {bbox_repr.pop(0)}\")\n            for part in bbox_repr:\n                parts.append(f\"            {part}\")\n        parts.append('    }')\n\n        # selector_args\n        selector_args_repr = self.selector_args.pretty_repr(self._model).split('\\n')\n        parts.append(f\"    selector_args = {selector_args_repr.pop(0)}\")\n        for part in selector_args_repr:\n            parts.append(f\"        {part}\")\n        parts.append(')')\n\n        return '\\n'.join(parts)\n\n    @property\n    def bounding_boxes(self) -> Dict[Any, ModelBoundingBox]:\n        return self._bounding_boxes\n\n    @property\n    def selector_args(self) -> _SelectorArguments:\n        return self._selector_args\n\n    @selector_args.setter\n    def selector_args(self, value):\n        self._selector_args = _SelectorArguments.validate(self._model, value)\n\n        warnings.warn(\"Overriding selector_args may cause problems you should re-validate \"\n                      \"the compound bounding box before use!\", RuntimeWarning)\n\n    @property\n    def named_selector_tuple(self) -> tuple:\n        return self._selector_args.named_tuple(self._model)\n\n    @property\n    def create_selector(self):\n        return self._create_selector\n\n    @staticmethod\n    def _get_selector_key(key):\n        if isiterable(key):\n            return tuple(key)\n        else:\n            return (key,)\n\n    def __setitem__(self, key, value):\n        _selector = self._get_selector_key(key)\n        if not self.selector_args.is_selector(_selector):\n            raise ValueError(f\"{_selector} is not a selector!\")\n\n        ignored = self.selector_args.ignore + self.ignored\n        self._bounding_boxes[_selector] = ModelBoundingBox.validate(self._model, value,\n                                                                    ignored,\n                                                                    order=self._order)\n\n    def _validate(self, bounding_boxes: dict):\n        for _selector, bounding_box in bounding_boxes.items():\n            self[_selector] = bounding_box\n\n    def __eq__(self, value):\n        if isinstance(value, CompoundBoundingBox):\n            return (self.bounding_boxes == value.bounding_boxes) and \\\n                (self.selector_args == value.selector_args) and \\\n                (self.create_selector == value.create_selector)\n        else:\n            return False\n\n    @classmethod\n    def validate(cls, model, bounding_box: dict, selector_args=None, create_selector=None,\n                 ignored: list = None, order: str = 'C', _preserve_ignore: bool = False, **kwarg):\n        \"\"\"\n        Construct a valid compound bounding box for a model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The model for which this will be a bounding_box\n        bounding_box : dict\n            Dictionary of possible bounding_box respresentations\n        selector_args : optional\n            Description of the selector arguments\n        create_selector : optional, callable\n            Method for generating new selectors\n        order : optional, str\n            The order that a tuple representation will be assumed to be\n                Default: 'C'\n        \"\"\"\n        if isinstance(bounding_box, CompoundBoundingBox):\n            if selector_args is None:\n                selector_args = bounding_box.selector_args\n            if create_selector is None:\n                create_selector = bounding_box.create_selector\n            order = bounding_box.order\n            if _preserve_ignore:\n                ignored = bounding_box.ignored\n            bounding_box = bounding_box.bounding_boxes\n\n        if selector_args is None:\n            raise ValueError(\"Selector arguments must be provided (can be passed as part of bounding_box argument)!\")\n\n        return cls(bounding_box, model, selector_args,\n                   create_selector=create_selector, ignored=ignored, order=order)\n\n    def __contains__(self, key):\n        return key in self._bounding_boxes\n\n    def _create_bounding_box(self, _selector):\n        self[_selector] = self._create_selector(_selector, model=self._model)\n\n        return self[_selector]\n\n    def __getitem__(self, key):\n        _selector = self._get_selector_key(key)\n        if _selector in self:\n            return self._bounding_boxes[_selector]\n        elif self._create_selector is not None:\n            return self._create_bounding_box(_selector)\n        else:\n            raise RuntimeError(f\"No bounding box is defined for selector: {_selector}.\")\n\n    def _select_bounding_box(self, inputs) -> ModelBoundingBox:\n        _selector = self.selector_args.get_selector(*inputs)\n\n        return self[_selector]\n\n    def prepare_inputs(self, input_shape, inputs) -> Tuple[Any, Any, Any]:\n        \"\"\"\n        Get prepare the inputs with respect to the bounding box.\n\n        Parameters\n        ----------\n        input_shape : tuple\n            The shape that all inputs have be reshaped/broadcasted into\n        inputs : list\n            List of all the model inputs\n\n        Returns\n        -------\n        valid_inputs : list\n            The inputs reduced to just those inputs which are all inside\n            their respective bounding box intervals\n        valid_index : array_like\n            array of all indices inside the bounding box\n        all_out: bool\n            if all of the inputs are outside the bounding_box\n        \"\"\"\n        bounding_box = self._select_bounding_box(inputs)\n        return bounding_box.prepare_inputs(input_shape, inputs)\n\n    def _matching_bounding_boxes(self, argument, value) -> Dict[Any, ModelBoundingBox]:\n        selector_index = self.selector_args.selector_index(self._model, argument)\n        matching = {}\n        for selector_key, bbox in self._bounding_boxes.items():\n            if selector_key[selector_index] == value:\n                new_selector_key = list(selector_key)\n                new_selector_key.pop(selector_index)\n\n                if bbox.has_interval(argument):\n                    new_bbox = bbox.fix_inputs(self._model, {argument: value},\n                                               _keep_ignored=True)\n                else:\n                    new_bbox = bbox.copy()\n\n                matching[tuple(new_selector_key)] = new_bbox\n\n        if len(matching) == 0:\n            raise ValueError(f\"Attempting to fix input {argument}, but there are no \"\n                             f\"bounding boxes for argument value {value}.\")\n\n        return matching\n\n    def _fix_input_selector_arg(self, argument, value):\n        matching_bounding_boxes = self._matching_bounding_boxes(argument, value)\n\n        if len(self.selector_args) == 1:\n            return matching_bounding_boxes[()]\n        else:\n            return CompoundBoundingBox(matching_bounding_boxes, self._model,\n                                       self.selector_args.reduce(self._model, argument))\n\n    def _fix_input_bbox_arg(self, argument, value):\n        bounding_boxes = {}\n        for selector_key, bbox in self._bounding_boxes.items():\n            bounding_boxes[selector_key] = bbox.fix_inputs(self._model, {argument: value},\n                                                        _keep_ignored=True)\n\n        return CompoundBoundingBox(bounding_boxes, self._model,\n                                   self.selector_args.add_ignore(self._model, argument))\n\n    def fix_inputs(self, model, fixed_inputs: dict):\n        \"\"\"\n        Fix the bounding_box for a `fix_inputs` compound model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The new model for which this will be a bounding_box\n        fixed_inputs : dict\n            Dictionary of inputs which have been fixed by this bounding box.\n        \"\"\"\n\n        fixed_input_keys = list(fixed_inputs.keys())\n        argument = fixed_input_keys.pop()\n        value = fixed_inputs[argument]\n\n        if self.selector_args.is_argument(self._model, argument):\n            bbox = self._fix_input_selector_arg(argument, value)\n        else:\n            bbox = self._fix_input_bbox_arg(argument, value)\n\n        if len(fixed_input_keys) > 0:\n            new_fixed_inputs = fixed_inputs.copy()\n            del new_fixed_inputs[argument]\n\n            bbox = bbox.fix_inputs(model, new_fixed_inputs)\n\n        if isinstance(bbox, CompoundBoundingBox):\n            selector_args = bbox.named_selector_tuple\n            bbox_dict = bbox\n        elif isinstance(bbox, ModelBoundingBox):\n            selector_args = None\n            bbox_dict = bbox.named_intervals\n\n        return bbox.__class__.validate(model, bbox_dict,\n                                       order=bbox.order, selector_args=selector_args)\n"},{"className":"_Interval","col":0,"comment":"\n    A single input's bounding box interval.\n\n    Parameters\n    ----------\n    lower : float\n        The lower bound of the interval\n\n    upper : float\n        The upper bound of the interval\n\n    Methods\n    -------\n    validate :\n        Contructs a valid interval\n\n    outside :\n        Determine which parts of an input array are outside the interval.\n\n    domain :\n        Contructs a discretization of the points inside the interval.\n    ","endLoc":129,"id":12257,"nodeType":"Class","startLoc":27,"text":"class _Interval(_BaseInterval):\n    \"\"\"\n    A single input's bounding box interval.\n\n    Parameters\n    ----------\n    lower : float\n        The lower bound of the interval\n\n    upper : float\n        The upper bound of the interval\n\n    Methods\n    -------\n    validate :\n        Contructs a valid interval\n\n    outside :\n        Determine which parts of an input array are outside the interval.\n\n    domain :\n        Contructs a discretization of the points inside the interval.\n    \"\"\"\n\n    def __repr__(self):\n        return f\"Interval(lower={self.lower}, upper={self.upper})\"\n\n    def copy(self):\n        return copy.deepcopy(self)\n\n    @staticmethod\n    def _validate_shape(interval):\n        \"\"\"Validate the shape of an interval representation\"\"\"\n        MESSAGE = \"\"\"An interval must be some sort of sequence of length 2\"\"\"\n\n        try:\n            shape = np.shape(interval)\n        except TypeError:\n            try:\n                # np.shape does not work with lists of Quantities\n                if len(interval) == 1:\n                    interval = interval[0]\n                shape = np.shape([b.to_value() for b in interval])\n            except (ValueError, TypeError, AttributeError):\n                raise ValueError(MESSAGE)\n\n        valid_shape = shape in ((2,), (1, 2), (2, 0))\n        if not valid_shape:\n            valid_shape = (len(shape) > 0) and (shape[0] == 2) and \\\n                all(isinstance(b, np.ndarray) for b in interval)\n\n        if not isiterable(interval) or not valid_shape:\n            raise ValueError(MESSAGE)\n\n    @classmethod\n    def _validate_bounds(cls, lower, upper):\n        \"\"\"Validate the bounds are reasonable and construct an interval from them.\"\"\"\n        if (np.asanyarray(lower) > np.asanyarray(upper)).all():\n            warnings.warn(f\"Invalid interval: upper bound {upper} \"\n                          f\"is strictly less than lower bound {lower}.\", RuntimeWarning)\n\n        return cls(lower, upper)\n\n    @classmethod\n    def validate(cls, interval):\n        \"\"\"\n        Construct and validate an interval\n\n        Parameters\n        ----------\n        interval : iterable\n            A representation of the interval.\n\n        Returns\n        -------\n        A validated interval.\n        \"\"\"\n        cls._validate_shape(interval)\n\n        if len(interval) == 1:\n            interval = tuple(interval[0])\n        else:\n            interval = tuple(interval)\n\n        return cls._validate_bounds(interval[0], interval[1])\n\n    def outside(self, _input: np.ndarray):\n        \"\"\"\n        Parameters\n        ----------\n        _input : np.ndarray\n            The evaluation input in the form of an array.\n\n        Returns\n        -------\n        Boolean array indicating which parts of _input are outside the interval:\n            True  -> position outside interval\n            False -> position inside  interval\n        \"\"\"\n        return np.logical_or(_input < self.lower, _input > self.upper)\n\n    def domain(self, resolution):\n        return np.arange(self.lower, self.upper + resolution, resolution)"},{"col":4,"comment":"null","endLoc":52,"header":"def __repr__(self)","id":12258,"name":"__repr__","nodeType":"Function","startLoc":51,"text":"def __repr__(self):\n        return f\"Interval(lower={self.lower}, upper={self.upper})\""},{"col":4,"comment":"null","endLoc":55,"header":"def copy(self)","id":12259,"name":"copy","nodeType":"Function","startLoc":54,"text":"def copy(self):\n        return copy.deepcopy(self)"},{"col":4,"comment":"\n        Parameters\n        ----------\n        _input : np.ndarray\n            The evaluation input in the form of an array.\n\n        Returns\n        -------\n        Boolean array indicating which parts of _input are outside the interval:\n            True  -> position outside interval\n            False -> position inside  interval\n        ","endLoc":126,"header":"def outside(self, _input: np.ndarray)","id":12260,"name":"outside","nodeType":"Function","startLoc":113,"text":"def outside(self, _input: np.ndarray):\n        \"\"\"\n        Parameters\n        ----------\n        _input : np.ndarray\n            The evaluation input in the form of an array.\n\n        Returns\n        -------\n        Boolean array indicating which parts of _input are outside the interval:\n            True  -> position outside interval\n            False -> position inside  interval\n        \"\"\"\n        return np.logical_or(_input < self.lower, _input > self.upper)"},{"col":4,"comment":"null","endLoc":129,"header":"def domain(self, resolution)","id":12261,"name":"domain","nodeType":"Function","startLoc":128,"text":"def domain(self, resolution):\n        return np.arange(self.lower, self.upper + resolution, resolution)"},{"className":"_SelectorArgument","col":0,"comment":"\n    Contains a single CompoundBoundingBox slicing input.\n\n    Parameters\n    ----------\n    index : int\n        The index of the input in the input list\n\n    ignore : bool\n        Whether or not this input will be ignored by the bounding box.\n\n    Methods\n    -------\n    validate :\n        Returns a valid SelectorArgument for a given model.\n\n    get_selector :\n        Returns the value of the input for use in finding the correct\n        bounding_box.\n\n    get_fixed_value :\n        Gets the slicing value from a fix_inputs set of values.\n    ","endLoc":1038,"id":12262,"nodeType":"Class","startLoc":904,"text":"class _SelectorArgument(_BaseSelectorArgument):\n    \"\"\"\n    Contains a single CompoundBoundingBox slicing input.\n\n    Parameters\n    ----------\n    index : int\n        The index of the input in the input list\n\n    ignore : bool\n        Whether or not this input will be ignored by the bounding box.\n\n    Methods\n    -------\n    validate :\n        Returns a valid SelectorArgument for a given model.\n\n    get_selector :\n        Returns the value of the input for use in finding the correct\n        bounding_box.\n\n    get_fixed_value :\n        Gets the slicing value from a fix_inputs set of values.\n    \"\"\"\n\n    def __new__(cls, index, ignore):\n        self = super().__new__(cls, index, ignore)\n\n        return self\n\n    @classmethod\n    def validate(cls, model, argument, ignored: bool = True):\n        \"\"\"\n        Construct a valid selector argument for a CompoundBoundingBox.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The model for which this will be an argument for.\n        argument : int or str\n            A representation of which evaluation input to use\n        ignored : optional, bool\n            Whether or not to ignore this argument in the ModelBoundingBox.\n\n        Returns\n        -------\n        Validated selector_argument\n        \"\"\"\n        return cls(get_index(model, argument), ignored)\n\n    def get_selector(self, *inputs):\n        \"\"\"\n        Get the selector value corresponding to this argument\n\n        Parameters\n        ----------\n        *inputs :\n            All the processed model evaluation inputs.\n        \"\"\"\n        _selector = inputs[self.index]\n        if isiterable(_selector):\n            if len(_selector) == 1:\n                return _selector[0]\n            else:\n                return tuple(_selector)\n        return _selector\n\n    def name(self, model) -> str:\n        \"\"\"\n        Get the name of the input described by this selector argument\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n        \"\"\"\n        return get_name(model, self.index)\n\n    def pretty_repr(self, model):\n        \"\"\"\n        Get a pretty-print representation of this object\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n        \"\"\"\n        return f\"Argument(name='{self.name(model)}', ignore={self.ignore})\"\n\n    def get_fixed_value(self, model, values: dict):\n        \"\"\"\n        Gets the value fixed input corresponding to this argument\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n\n        values : dict\n            Dictionary of fixed inputs.\n        \"\"\"\n        if self.index in values:\n            return values[self.index]\n        else:\n            if self.name(model) in values:\n                return values[self.name(model)]\n            else:\n                raise RuntimeError(f\"{self.pretty_repr(model)} was not found in {values}\")\n\n    def is_argument(self, model, argument) -> bool:\n        \"\"\"\n        Determine if passed argument is described by this selector argument\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n\n        argument : int or str\n            A representation of which evaluation input is being used\n        \"\"\"\n\n        return self.index == get_index(model, argument)\n\n    def named_tuple(self, model):\n        \"\"\"\n        Get a tuple representation of this argument using the input\n        name from the model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n        \"\"\"\n        return (self.name(model), self.ignore)"},{"col":4,"comment":"\n        Get the selector value corresponding to this argument\n\n        Parameters\n        ----------\n        *inputs :\n            All the processed model evaluation inputs.\n        ","endLoc":969,"header":"def get_selector(self, *inputs)","id":12263,"name":"get_selector","nodeType":"Function","startLoc":954,"text":"def get_selector(self, *inputs):\n        \"\"\"\n        Get the selector value corresponding to this argument\n\n        Parameters\n        ----------\n        *inputs :\n            All the processed model evaluation inputs.\n        \"\"\"\n        _selector = inputs[self.index]\n        if isiterable(_selector):\n            if len(_selector) == 1:\n                return _selector[0]\n            else:\n                return tuple(_selector)\n        return _selector"},{"col":4,"comment":"\n        Get the name of the input described by this selector argument\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n        ","endLoc":980,"header":"def name(self, model) -> str","id":12264,"name":"name","nodeType":"Function","startLoc":971,"text":"def name(self, model) -> str:\n        \"\"\"\n        Get the name of the input described by this selector argument\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n        \"\"\"\n        return get_name(model, self.index)"},{"col":4,"comment":"\n        Get a pretty-print representation of this object\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n        ","endLoc":991,"header":"def pretty_repr(self, model)","id":12265,"name":"pretty_repr","nodeType":"Function","startLoc":982,"text":"def pretty_repr(self, model):\n        \"\"\"\n        Get a pretty-print representation of this object\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n        \"\"\"\n        return f\"Argument(name='{self.name(model)}', ignore={self.ignore})\""},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":12266,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":17,"text":"__doctest_skip__"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":12267,"name":"__all__","nodeType":"Attribute","startLoc":18,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":12268,"name":"deprecation_msg","nodeType":"Attribute","startLoc":21,"text":"deprecation_msg"},{"col":0,"comment":"","endLoc":5,"header":"utils.py#<anonymous>","id":12269,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module provides utility functions for the models package.\n\"\"\"\n\n__doctest_skip__ = ['AliasDict']\n\n__all__ = ['AliasDict', 'poly_map_domain', 'comb', 'ellipse_extent']\n\ndeprecation_msg = \"\"\"\nAliasDict is deprecated because it no longer serves a function anywhere\ninside astropy.\n\"\"\""},{"col":4,"comment":"\n        Gets the value fixed input corresponding to this argument\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n\n        values : dict\n            Dictionary of fixed inputs.\n        ","endLoc":1011,"header":"def get_fixed_value(self, model, values: dict)","id":12270,"name":"get_fixed_value","nodeType":"Function","startLoc":993,"text":"def get_fixed_value(self, model, values: dict):\n        \"\"\"\n        Gets the value fixed input corresponding to this argument\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n\n        values : dict\n            Dictionary of fixed inputs.\n        \"\"\"\n        if self.index in values:\n            return values[self.index]\n        else:\n            if self.name(model) in values:\n                return values[self.name(model)]\n            else:\n                raise RuntimeError(f\"{self.pretty_repr(model)} was not found in {values}\")"},{"fileName":"optimizers.py","filePath":"astropy/modeling","id":12271,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# pylint: disable=invalid-name\n\n\"\"\"\nOptimization algorithms used in `~astropy.modeling.fitting`.\n\"\"\"\n\nimport warnings\nimport abc\nimport numpy as np\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n__all__ = [\"Optimization\", \"SLSQP\", \"Simplex\"]\n\n# Maximum number of iterations\nDEFAULT_MAXITER = 100\n\n# Step for the forward difference approximation of the Jacobian\nDEFAULT_EPS = np.sqrt(np.finfo(float).eps)\n\n# Default requested accuracy\nDEFAULT_ACC = 1e-07\n\nDEFAULT_BOUNDS = (-10 ** 12, 10 ** 12)\n\n\nclass Optimization(metaclass=abc.ABCMeta):\n    \"\"\"\n    Base class for optimizers.\n\n    Parameters\n    ----------\n    opt_method : callable\n        Implements optimization method\n\n    Notes\n    -----\n    The base Optimizer does not support any constraints by default; individual\n    optimizers should explicitly set this list to the specific constraints\n    it supports.\n\n    \"\"\"\n\n    supported_constraints = []\n\n    def __init__(self, opt_method):\n        self._opt_method = opt_method\n        self._maxiter = DEFAULT_MAXITER\n        self._eps = DEFAULT_EPS\n        self._acc = DEFAULT_ACC\n\n    @property\n    def maxiter(self):\n        \"\"\"Maximum number of iterations\"\"\"\n        return self._maxiter\n\n    @maxiter.setter\n    def maxiter(self, val):\n        \"\"\"Set maxiter\"\"\"\n        self._maxiter = val\n\n    @property\n    def eps(self):\n        \"\"\"Step for the forward difference approximation of the Jacobian\"\"\"\n        return self._eps\n\n    @eps.setter\n    def eps(self, val):\n        \"\"\"Set eps value\"\"\"\n        self._eps = val\n\n    @property\n    def acc(self):\n        \"\"\"Requested accuracy\"\"\"\n        return self._acc\n\n    @acc.setter\n    def acc(self, val):\n        \"\"\"Set accuracy\"\"\"\n        self._acc = val\n\n    def __repr__(self):\n        fmt = f\"{self.__class__.__name__}()\"\n        return fmt\n\n    @property\n    def opt_method(self):\n        \"\"\" Return the optimization method.\"\"\"\n        return self._opt_method\n\n    @abc.abstractmethod\n    def __call__(self):\n        raise NotImplementedError(\"Subclasses should implement this method\")\n\n\nclass SLSQP(Optimization):\n    \"\"\"\n    Sequential Least Squares Programming optimization algorithm.\n\n    The algorithm is described in [1]_. It supports tied and fixed\n    parameters, as well as bounded constraints. Uses\n    `scipy.optimize.fmin_slsqp`.\n\n    References\n    ----------\n    .. [1] http://www.netlib.org/toms/733\n    \"\"\"\n    supported_constraints = ['bounds', 'eqcons', 'ineqcons', 'fixed', 'tied']\n\n    def __init__(self):\n        from scipy.optimize import fmin_slsqp\n        super().__init__(fmin_slsqp)\n        self.fit_info = {\n            'final_func_val': None,\n            'numiter': None,\n            'exit_mode': None,\n            'message': None\n        }\n\n    def __call__(self, objfunc, initval, fargs, **kwargs):\n        \"\"\"\n        Run the solver.\n\n        Parameters\n        ----------\n        objfunc : callable\n            objection function\n        initval : iterable\n            initial guess for the parameter values\n        fargs : tuple\n            other arguments to be passed to the statistic function\n        kwargs : dict\n            other keyword arguments to be passed to the solver\n\n        \"\"\"\n        kwargs['iter'] = kwargs.pop('maxiter', self._maxiter)\n\n        if 'epsilon' not in kwargs:\n            kwargs['epsilon'] = self._eps\n        if 'acc' not in kwargs:\n            kwargs['acc'] = self._acc\n        # Get the verbosity level\n        disp = kwargs.pop('verblevel', None)\n\n        # set the values of constraints to match the requirements of fmin_slsqp\n        model = fargs[0]\n        pars = [getattr(model, name) for name in model.param_names]\n        bounds = [par.bounds for par in pars if not (par.fixed or par.tied)]\n        bounds = np.asarray(bounds)\n        for i in bounds:\n            if i[0] is None:\n                i[0] = DEFAULT_BOUNDS[0]\n            if i[1] is None:\n                i[1] = DEFAULT_BOUNDS[1]\n        # older versions of scipy require this array to be float\n        bounds = np.asarray(bounds, dtype=float)\n        eqcons = np.array(model.eqcons)\n        ineqcons = np.array(model.ineqcons)\n        fitparams, final_func_val, numiter, exit_mode, mess = self.opt_method(\n            objfunc, initval, args=fargs, full_output=True, disp=disp,\n            bounds=bounds, eqcons=eqcons, ieqcons=ineqcons,\n            **kwargs)\n\n        self.fit_info['final_func_val'] = final_func_val\n        self.fit_info['numiter'] = numiter\n        self.fit_info['exit_mode'] = exit_mode\n        self.fit_info['message'] = mess\n\n        if exit_mode != 0:\n            warnings.warn(\"The fit may be unsuccessful; check \"\n                          \"fit_info['message'] for more information.\",\n                          AstropyUserWarning)\n\n        return fitparams, self.fit_info\n\n\nclass Simplex(Optimization):\n    \"\"\"\n    Neald-Mead (downhill simplex) algorithm.\n\n    This algorithm [1]_ only uses function values, not derivatives.\n    Uses `scipy.optimize.fmin`.\n\n    References\n    ----------\n    .. [1] Nelder, J.A. and Mead, R. (1965), \"A simplex method for function\n       minimization\", The Computer Journal, 7, pp. 308-313\n    \"\"\"\n\n    supported_constraints = ['bounds', 'fixed', 'tied']\n\n    def __init__(self):\n        from scipy.optimize import fmin as simplex\n        super().__init__(simplex)\n        self.fit_info = {\n            'final_func_val': None,\n            'numiter': None,\n            'exit_mode': None,\n            'num_function_calls': None\n        }\n\n    def __call__(self, objfunc, initval, fargs, **kwargs):\n        \"\"\"\n        Run the solver.\n\n        Parameters\n        ----------\n        objfunc : callable\n            objection function\n        initval : iterable\n            initial guess for the parameter values\n        fargs : tuple\n            other arguments to be passed to the statistic function\n        kwargs : dict\n            other keyword arguments to be passed to the solver\n\n        \"\"\"\n        if 'maxiter' not in kwargs:\n            kwargs['maxiter'] = self._maxiter\n        if 'acc' in kwargs:\n            self._acc = kwargs['acc']\n            kwargs.pop('acc')\n        if 'xtol' in kwargs:\n            self._acc = kwargs['xtol']\n            kwargs.pop('xtol')\n        # Get the verbosity level\n        disp = kwargs.pop('verblevel', None)\n\n        fitparams, final_func_val, numiter, funcalls, exit_mode = self.opt_method(\n            objfunc, initval, args=fargs, xtol=self._acc, disp=disp,\n            full_output=True, **kwargs)\n        self.fit_info['final_func_val'] = final_func_val\n        self.fit_info['numiter'] = numiter\n        self.fit_info['exit_mode'] = exit_mode\n        self.fit_info['num_function_calls'] = funcalls\n        if self.fit_info['exit_mode'] == 1:\n            warnings.warn(\"The fit may be unsuccessful; \"\n                          \"Maximum number of function evaluations reached.\",\n                          AstropyUserWarning)\n        if self.fit_info['exit_mode'] == 2:\n            warnings.warn(\"The fit may be unsuccessful; \"\n                          \"Maximum number of iterations reached.\",\n                          AstropyUserWarning)\n        return fitparams, self.fit_info\n"},{"col":4,"comment":"\n        Determine if passed argument is described by this selector argument\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n\n        argument : int or str\n            A representation of which evaluation input is being used\n        ","endLoc":1026,"header":"def is_argument(self, model, argument) -> bool","id":12272,"name":"is_argument","nodeType":"Function","startLoc":1013,"text":"def is_argument(self, model, argument) -> bool:\n        \"\"\"\n        Determine if passed argument is described by this selector argument\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n\n        argument : int or str\n            A representation of which evaluation input is being used\n        \"\"\"\n\n        return self.index == get_index(model, argument)"},{"col":4,"comment":"\n        Get a tuple representation of this argument using the input\n        name from the model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n        ","endLoc":1038,"header":"def named_tuple(self, model)","id":12273,"name":"named_tuple","nodeType":"Function","startLoc":1028,"text":"def named_tuple(self, model):\n        \"\"\"\n        Get a tuple representation of this argument using the input\n        name from the model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model this selector argument is for.\n        \"\"\"\n        return (self.name(model), self.ignore)"},{"className":"Optimization","col":0,"comment":"\n    Base class for optimizers.\n\n    Parameters\n    ----------\n    opt_method : callable\n        Implements optimization method\n\n    Notes\n    -----\n    The base Optimizer does not support any constraints by default; individual\n    optimizers should explicitly set this list to the specific constraints\n    it supports.\n\n    ","endLoc":93,"id":12274,"nodeType":"Class","startLoc":27,"text":"class Optimization(metaclass=abc.ABCMeta):\n    \"\"\"\n    Base class for optimizers.\n\n    Parameters\n    ----------\n    opt_method : callable\n        Implements optimization method\n\n    Notes\n    -----\n    The base Optimizer does not support any constraints by default; individual\n    optimizers should explicitly set this list to the specific constraints\n    it supports.\n\n    \"\"\"\n\n    supported_constraints = []\n\n    def __init__(self, opt_method):\n        self._opt_method = opt_method\n        self._maxiter = DEFAULT_MAXITER\n        self._eps = DEFAULT_EPS\n        self._acc = DEFAULT_ACC\n\n    @property\n    def maxiter(self):\n        \"\"\"Maximum number of iterations\"\"\"\n        return self._maxiter\n\n    @maxiter.setter\n    def maxiter(self, val):\n        \"\"\"Set maxiter\"\"\"\n        self._maxiter = val\n\n    @property\n    def eps(self):\n        \"\"\"Step for the forward difference approximation of the Jacobian\"\"\"\n        return self._eps\n\n    @eps.setter\n    def eps(self, val):\n        \"\"\"Set eps value\"\"\"\n        self._eps = val\n\n    @property\n    def acc(self):\n        \"\"\"Requested accuracy\"\"\"\n        return self._acc\n\n    @acc.setter\n    def acc(self, val):\n        \"\"\"Set accuracy\"\"\"\n        self._acc = val\n\n    def __repr__(self):\n        fmt = f\"{self.__class__.__name__}()\"\n        return fmt\n\n    @property\n    def opt_method(self):\n        \"\"\" Return the optimization method.\"\"\"\n        return self._opt_method\n\n    @abc.abstractmethod\n    def __call__(self):\n        raise NotImplementedError(\"Subclasses should implement this method\")"},{"col":4,"comment":"null","endLoc":50,"header":"def __init__(self, opt_method)","id":12275,"name":"__init__","nodeType":"Function","startLoc":46,"text":"def __init__(self, opt_method):\n        self._opt_method = opt_method\n        self._maxiter = DEFAULT_MAXITER\n        self._eps = DEFAULT_EPS\n        self._acc = DEFAULT_ACC"},{"col":4,"comment":"Maximum number of iterations","endLoc":55,"header":"@property\n    def maxiter(self)","id":12276,"name":"maxiter","nodeType":"Function","startLoc":52,"text":"@property\n    def maxiter(self):\n        \"\"\"Maximum number of iterations\"\"\"\n        return self._maxiter"},{"col":4,"comment":"Set maxiter","endLoc":60,"header":"@maxiter.setter\n    def maxiter(self, val)","id":12277,"name":"maxiter","nodeType":"Function","startLoc":57,"text":"@maxiter.setter\n    def maxiter(self, val):\n        \"\"\"Set maxiter\"\"\"\n        self._maxiter = val"},{"col":4,"comment":"Step for the forward difference approximation of the Jacobian","endLoc":65,"header":"@property\n    def eps(self)","id":12278,"name":"eps","nodeType":"Function","startLoc":62,"text":"@property\n    def eps(self):\n        \"\"\"Step for the forward difference approximation of the Jacobian\"\"\"\n        return self._eps"},{"col":4,"comment":"Set eps value","endLoc":70,"header":"@eps.setter\n    def eps(self, val)","id":12279,"name":"eps","nodeType":"Function","startLoc":67,"text":"@eps.setter\n    def eps(self, val):\n        \"\"\"Set eps value\"\"\"\n        self._eps = val"},{"col":4,"comment":"Requested accuracy","endLoc":75,"header":"@property\n    def acc(self)","id":12280,"name":"acc","nodeType":"Function","startLoc":72,"text":"@property\n    def acc(self):\n        \"\"\"Requested accuracy\"\"\"\n        return self._acc"},{"col":4,"comment":"Set accuracy","endLoc":80,"header":"@acc.setter\n    def acc(self, val)","id":12281,"name":"acc","nodeType":"Function","startLoc":77,"text":"@acc.setter\n    def acc(self, val):\n        \"\"\"Set accuracy\"\"\"\n        self._acc = val"},{"col":4,"comment":"null","endLoc":84,"header":"def __repr__(self)","id":12282,"name":"__repr__","nodeType":"Function","startLoc":82,"text":"def __repr__(self):\n        fmt = f\"{self.__class__.__name__}()\"\n        return fmt"},{"col":4,"comment":" Return the optimization method.","endLoc":89,"header":"@property\n    def opt_method(self)","id":12283,"name":"opt_method","nodeType":"Function","startLoc":86,"text":"@property\n    def opt_method(self):\n        \"\"\" Return the optimization method.\"\"\"\n        return self._opt_method"},{"col":4,"comment":"null","endLoc":93,"header":"@abc.abstractmethod\n    def __call__(self)","id":12284,"name":"__call__","nodeType":"Function","startLoc":91,"text":"@abc.abstractmethod\n    def __call__(self):\n        raise NotImplementedError(\"Subclasses should implement this method\")"},{"attributeType":"null","col":4,"comment":"null","endLoc":44,"id":12285,"name":"supported_constraints","nodeType":"Attribute","startLoc":44,"text":"supported_constraints"},{"attributeType":"null","col":8,"comment":"null","endLoc":930,"id":12286,"name":"self","nodeType":"Attribute","startLoc":930,"text":"self"},{"attributeType":"null","col":8,"comment":"null","endLoc":48,"id":12287,"name":"_maxiter","nodeType":"Attribute","startLoc":48,"text":"self._maxiter"},{"className":"_SelectorArguments","col":0,"comment":"\n    Contains the CompoundBoundingBox slicing description\n\n    Parameters\n    ----------\n    input_ :\n        The SelectorArgument values\n\n    Methods\n    -------\n    validate :\n        Returns a valid SelectorArguments for its model.\n\n    get_selector :\n        Returns the selector a set of inputs corresponds to.\n\n    is_selector :\n        Determines if a selector is correctly formatted for this CompoundBoundingBox.\n\n    get_fixed_value :\n        Gets the selector from a fix_inputs set of values.\n    ","endLoc":1264,"id":12288,"nodeType":"Class","startLoc":1041,"text":"class _SelectorArguments(tuple):\n    \"\"\"\n    Contains the CompoundBoundingBox slicing description\n\n    Parameters\n    ----------\n    input_ :\n        The SelectorArgument values\n\n    Methods\n    -------\n    validate :\n        Returns a valid SelectorArguments for its model.\n\n    get_selector :\n        Returns the selector a set of inputs corresponds to.\n\n    is_selector :\n        Determines if a selector is correctly formatted for this CompoundBoundingBox.\n\n    get_fixed_value :\n        Gets the selector from a fix_inputs set of values.\n    \"\"\"\n\n    _kept_ignore = None\n\n    def __new__(cls, input_: Tuple[_SelectorArgument], kept_ignore: List = None):\n        self = super().__new__(cls, input_)\n\n        if kept_ignore is None:\n            self._kept_ignore = []\n        else:\n            self._kept_ignore = kept_ignore\n\n        return self\n\n    def pretty_repr(self, model):\n        \"\"\"\n        Get a pretty-print representation of this object\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n        \"\"\"\n        parts = ['SelectorArguments(']\n        for argument in self:\n            parts.append(\n                f\"    {argument.pretty_repr(model)}\"\n            )\n        parts.append(')')\n\n        return '\\n'.join(parts)\n\n    @property\n    def ignore(self):\n        \"\"\"Get the list of ignored inputs\"\"\"\n        ignore = [argument.index for argument in self if argument.ignore]\n        ignore.extend(self._kept_ignore)\n\n        return ignore\n\n    @property\n    def kept_ignore(self):\n        \"\"\"The arguments to persist in ignoring\"\"\"\n        return self._kept_ignore\n\n    @classmethod\n    def validate(cls, model, arguments, kept_ignore: List=None):\n        \"\"\"\n        Construct a valid Selector description for a CompoundBoundingBox.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        arguments :\n            The individual argument informations\n\n        kept_ignore :\n            Arguments to persist as ignored\n        \"\"\"\n        inputs = []\n        for argument in arguments:\n            _input = _SelectorArgument.validate(model, *argument)\n            if _input.index in [this.index for this in inputs]:\n                raise ValueError(f\"Input: '{get_name(model, _input.index)}' has been repeated.\")\n            inputs.append(_input)\n\n        if len(inputs) == 0:\n            raise ValueError(\"There must be at least one selector argument.\")\n\n        if isinstance(arguments, _SelectorArguments):\n            if kept_ignore is None:\n                kept_ignore = []\n\n            kept_ignore.extend(arguments.kept_ignore)\n\n        return cls(tuple(inputs), kept_ignore)\n\n    def get_selector(self, *inputs):\n        \"\"\"\n        Get the selector corresponding to these inputs\n\n        Parameters\n        ----------\n        *inputs :\n            All the processed model evaluation inputs.\n        \"\"\"\n        return tuple([argument.get_selector(*inputs) for argument in self])\n\n    def is_selector(self, _selector):\n        \"\"\"\n        Determine if this is a reasonable selector\n\n        Parameters\n        ----------\n        _selector : tuple\n            The selector to check\n        \"\"\"\n        return isinstance(_selector, tuple) and len(_selector) == len(self)\n\n    def get_fixed_values(self, model, values: dict):\n        \"\"\"\n        Gets the value fixed input corresponding to this argument\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        values : dict\n            Dictionary of fixed inputs.\n        \"\"\"\n        return tuple([argument.get_fixed_value(model, values) for argument in self])\n\n    def is_argument(self, model, argument) -> bool:\n        \"\"\"\n        Determine if passed argument is one of the selector arguments\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        argument : int or str\n            A representation of which evaluation input is being used\n        \"\"\"\n\n        for selector_arg in self:\n            if selector_arg.is_argument(model, argument):\n                return True\n        else:\n            return False\n\n    def selector_index(self, model, argument):\n        \"\"\"\n        Get the index of the argument passed in the selector tuples\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        argument : int or str\n            A representation of which argument is being used\n        \"\"\"\n\n        for index, selector_arg in enumerate(self):\n            if selector_arg.is_argument(model, argument):\n                return index\n        else:\n            raise ValueError(f\"{argument} does not correspond to any selector argument.\")\n\n    def reduce(self, model, argument):\n        \"\"\"\n        Reduce the selector arguments by the argument given\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        argument : int or str\n            A representation of which argument is being used\n        \"\"\"\n\n        arguments = list(self)\n        kept_ignore = [arguments.pop(self.selector_index(model, argument)).index]\n        kept_ignore.extend(self._kept_ignore)\n\n        return _SelectorArguments.validate(model, tuple(arguments), kept_ignore)\n\n    def add_ignore(self, model, argument):\n        \"\"\"\n        Add argument to the kept_ignore list\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        argument : int or str\n            A representation of which argument is being used\n        \"\"\"\n\n        if self.is_argument(model, argument):\n            raise ValueError(f\"{argument}: is a selector argument and cannot be ignored.\")\n\n        kept_ignore = [get_index(model, argument)]\n\n        return _SelectorArguments.validate(model, self, kept_ignore)\n\n    def named_tuple(self, model):\n        \"\"\"\n        Get a tuple of selector argument tuples using input names\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n        \"\"\"\n        return tuple([selector_arg.named_tuple(model) for selector_arg in self])"},{"attributeType":"null","col":8,"comment":"null","endLoc":49,"id":12289,"name":"_eps","nodeType":"Attribute","startLoc":49,"text":"self._eps"},{"col":4,"comment":"\n        Get a pretty-print representation of this object\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n        ","endLoc":1093,"header":"def pretty_repr(self, model)","id":12290,"name":"pretty_repr","nodeType":"Function","startLoc":1077,"text":"def pretty_repr(self, model):\n        \"\"\"\n        Get a pretty-print representation of this object\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n        \"\"\"\n        parts = ['SelectorArguments(']\n        for argument in self:\n            parts.append(\n                f\"    {argument.pretty_repr(model)}\"\n            )\n        parts.append(')')\n\n        return '\\n'.join(parts)"},{"attributeType":"null","col":8,"comment":"null","endLoc":47,"id":12291,"name":"_opt_method","nodeType":"Attribute","startLoc":47,"text":"self._opt_method"},{"attributeType":"null","col":8,"comment":"null","endLoc":50,"id":12292,"name":"_acc","nodeType":"Attribute","startLoc":50,"text":"self._acc"},{"className":"SLSQP","col":0,"comment":"\n    Sequential Least Squares Programming optimization algorithm.\n\n    The algorithm is described in [1]_. It supports tied and fixed\n    parameters, as well as bounded constraints. Uses\n    `scipy.optimize.fmin_slsqp`.\n\n    References\n    ----------\n    .. [1] http://www.netlib.org/toms/733\n    ","endLoc":174,"id":12293,"nodeType":"Class","startLoc":96,"text":"class SLSQP(Optimization):\n    \"\"\"\n    Sequential Least Squares Programming optimization algorithm.\n\n    The algorithm is described in [1]_. It supports tied and fixed\n    parameters, as well as bounded constraints. Uses\n    `scipy.optimize.fmin_slsqp`.\n\n    References\n    ----------\n    .. [1] http://www.netlib.org/toms/733\n    \"\"\"\n    supported_constraints = ['bounds', 'eqcons', 'ineqcons', 'fixed', 'tied']\n\n    def __init__(self):\n        from scipy.optimize import fmin_slsqp\n        super().__init__(fmin_slsqp)\n        self.fit_info = {\n            'final_func_val': None,\n            'numiter': None,\n            'exit_mode': None,\n            'message': None\n        }\n\n    def __call__(self, objfunc, initval, fargs, **kwargs):\n        \"\"\"\n        Run the solver.\n\n        Parameters\n        ----------\n        objfunc : callable\n            objection function\n        initval : iterable\n            initial guess for the parameter values\n        fargs : tuple\n            other arguments to be passed to the statistic function\n        kwargs : dict\n            other keyword arguments to be passed to the solver\n\n        \"\"\"\n        kwargs['iter'] = kwargs.pop('maxiter', self._maxiter)\n\n        if 'epsilon' not in kwargs:\n            kwargs['epsilon'] = self._eps\n        if 'acc' not in kwargs:\n            kwargs['acc'] = self._acc\n        # Get the verbosity level\n        disp = kwargs.pop('verblevel', None)\n\n        # set the values of constraints to match the requirements of fmin_slsqp\n        model = fargs[0]\n        pars = [getattr(model, name) for name in model.param_names]\n        bounds = [par.bounds for par in pars if not (par.fixed or par.tied)]\n        bounds = np.asarray(bounds)\n        for i in bounds:\n            if i[0] is None:\n                i[0] = DEFAULT_BOUNDS[0]\n            if i[1] is None:\n                i[1] = DEFAULT_BOUNDS[1]\n        # older versions of scipy require this array to be float\n        bounds = np.asarray(bounds, dtype=float)\n        eqcons = np.array(model.eqcons)\n        ineqcons = np.array(model.ineqcons)\n        fitparams, final_func_val, numiter, exit_mode, mess = self.opt_method(\n            objfunc, initval, args=fargs, full_output=True, disp=disp,\n            bounds=bounds, eqcons=eqcons, ieqcons=ineqcons,\n            **kwargs)\n\n        self.fit_info['final_func_val'] = final_func_val\n        self.fit_info['numiter'] = numiter\n        self.fit_info['exit_mode'] = exit_mode\n        self.fit_info['message'] = mess\n\n        if exit_mode != 0:\n            warnings.warn(\"The fit may be unsuccessful; check \"\n                          \"fit_info['message'] for more information.\",\n                          AstropyUserWarning)\n\n        return fitparams, self.fit_info"},{"col":4,"comment":"null","endLoc":118,"header":"def __init__(self)","id":12294,"name":"__init__","nodeType":"Function","startLoc":110,"text":"def __init__(self):\n        from scipy.optimize import fmin_slsqp\n        super().__init__(fmin_slsqp)\n        self.fit_info = {\n            'final_func_val': None,\n            'numiter': None,\n            'exit_mode': None,\n            'message': None\n        }"},{"col":4,"comment":"Get the list of ignored inputs","endLoc":1101,"header":"@property\n    def ignore(self)","id":12295,"name":"ignore","nodeType":"Function","startLoc":1095,"text":"@property\n    def ignore(self):\n        \"\"\"Get the list of ignored inputs\"\"\"\n        ignore = [argument.index for argument in self if argument.ignore]\n        ignore.extend(self._kept_ignore)\n\n        return ignore"},{"col":4,"comment":"\n        Run the solver.\n\n        Parameters\n        ----------\n        objfunc : callable\n            objection function\n        initval : iterable\n            initial guess for the parameter values\n        fargs : tuple\n            other arguments to be passed to the statistic function\n        kwargs : dict\n            other keyword arguments to be passed to the solver\n\n        ","endLoc":174,"header":"def __call__(self, objfunc, initval, fargs, **kwargs)","id":12296,"name":"__call__","nodeType":"Function","startLoc":120,"text":"def __call__(self, objfunc, initval, fargs, **kwargs):\n        \"\"\"\n        Run the solver.\n\n        Parameters\n        ----------\n        objfunc : callable\n            objection function\n        initval : iterable\n            initial guess for the parameter values\n        fargs : tuple\n            other arguments to be passed to the statistic function\n        kwargs : dict\n            other keyword arguments to be passed to the solver\n\n        \"\"\"\n        kwargs['iter'] = kwargs.pop('maxiter', self._maxiter)\n\n        if 'epsilon' not in kwargs:\n            kwargs['epsilon'] = self._eps\n        if 'acc' not in kwargs:\n            kwargs['acc'] = self._acc\n        # Get the verbosity level\n        disp = kwargs.pop('verblevel', None)\n\n        # set the values of constraints to match the requirements of fmin_slsqp\n        model = fargs[0]\n        pars = [getattr(model, name) for name in model.param_names]\n        bounds = [par.bounds for par in pars if not (par.fixed or par.tied)]\n        bounds = np.asarray(bounds)\n        for i in bounds:\n            if i[0] is None:\n                i[0] = DEFAULT_BOUNDS[0]\n            if i[1] is None:\n                i[1] = DEFAULT_BOUNDS[1]\n        # older versions of scipy require this array to be float\n        bounds = np.asarray(bounds, dtype=float)\n        eqcons = np.array(model.eqcons)\n        ineqcons = np.array(model.ineqcons)\n        fitparams, final_func_val, numiter, exit_mode, mess = self.opt_method(\n            objfunc, initval, args=fargs, full_output=True, disp=disp,\n            bounds=bounds, eqcons=eqcons, ieqcons=ineqcons,\n            **kwargs)\n\n        self.fit_info['final_func_val'] = final_func_val\n        self.fit_info['numiter'] = numiter\n        self.fit_info['exit_mode'] = exit_mode\n        self.fit_info['message'] = mess\n\n        if exit_mode != 0:\n            warnings.warn(\"The fit may be unsuccessful; check \"\n                          \"fit_info['message'] for more information.\",\n                          AstropyUserWarning)\n\n        return fitparams, self.fit_info"},{"col":4,"comment":"The arguments to persist in ignoring","endLoc":1106,"header":"@property\n    def kept_ignore(self)","id":12297,"name":"kept_ignore","nodeType":"Function","startLoc":1103,"text":"@property\n    def kept_ignore(self):\n        \"\"\"The arguments to persist in ignoring\"\"\"\n        return self._kept_ignore"},{"col":4,"comment":"\n        Get the selector corresponding to these inputs\n\n        Parameters\n        ----------\n        *inputs :\n            All the processed model evaluation inputs.\n        ","endLoc":1151,"header":"def get_selector(self, *inputs)","id":12298,"name":"get_selector","nodeType":"Function","startLoc":1142,"text":"def get_selector(self, *inputs):\n        \"\"\"\n        Get the selector corresponding to these inputs\n\n        Parameters\n        ----------\n        *inputs :\n            All the processed model evaluation inputs.\n        \"\"\"\n        return tuple([argument.get_selector(*inputs) for argument in self])"},{"col":4,"comment":"\n        Determine if this is a reasonable selector\n\n        Parameters\n        ----------\n        _selector : tuple\n            The selector to check\n        ","endLoc":1162,"header":"def is_selector(self, _selector)","id":12299,"name":"is_selector","nodeType":"Function","startLoc":1153,"text":"def is_selector(self, _selector):\n        \"\"\"\n        Determine if this is a reasonable selector\n\n        Parameters\n        ----------\n        _selector : tuple\n            The selector to check\n        \"\"\"\n        return isinstance(_selector, tuple) and len(_selector) == len(self)"},{"col":4,"comment":"\n        Gets the value fixed input corresponding to this argument\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        values : dict\n            Dictionary of fixed inputs.\n        ","endLoc":1176,"header":"def get_fixed_values(self, model, values: dict)","id":12300,"name":"get_fixed_values","nodeType":"Function","startLoc":1164,"text":"def get_fixed_values(self, model, values: dict):\n        \"\"\"\n        Gets the value fixed input corresponding to this argument\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        values : dict\n            Dictionary of fixed inputs.\n        \"\"\"\n        return tuple([argument.get_fixed_value(model, values) for argument in self])"},{"col":0,"comment":"null","endLoc":67,"header":"def match_utf8(encoding)","id":12301,"name":"match_utf8","nodeType":"Function","startLoc":66,"text":"def match_utf8(encoding):\n    return BOM_LIST.get(encoding.lower()) == 'utf_8'"},{"col":4,"comment":"\n        Determine if passed argument is one of the selector arguments\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        argument : int or str\n            A representation of which evaluation input is being used\n        ","endLoc":1195,"header":"def is_argument(self, model, argument) -> bool","id":12302,"name":"is_argument","nodeType":"Function","startLoc":1178,"text":"def is_argument(self, model, argument) -> bool:\n        \"\"\"\n        Determine if passed argument is one of the selector arguments\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        argument : int or str\n            A representation of which evaluation input is being used\n        \"\"\"\n\n        for selector_arg in self:\n            if selector_arg.is_argument(model, argument):\n                return True\n        else:\n            return False"},{"col":4,"comment":"\n        Get the index of the argument passed in the selector tuples\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        argument : int or str\n            A representation of which argument is being used\n        ","endLoc":1214,"header":"def selector_index(self, model, argument)","id":12303,"name":"selector_index","nodeType":"Function","startLoc":1197,"text":"def selector_index(self, model, argument):\n        \"\"\"\n        Get the index of the argument passed in the selector tuples\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        argument : int or str\n            A representation of which argument is being used\n        \"\"\"\n\n        for index, selector_arg in enumerate(self):\n            if selector_arg.is_argument(model, argument):\n                return index\n        else:\n            raise ValueError(f\"{argument} does not correspond to any selector argument.\")"},{"col":4,"comment":"\n        Reduce the selector arguments by the argument given\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        argument : int or str\n            A representation of which argument is being used\n        ","endLoc":1233,"header":"def reduce(self, model, argument)","id":12304,"name":"reduce","nodeType":"Function","startLoc":1216,"text":"def reduce(self, model, argument):\n        \"\"\"\n        Reduce the selector arguments by the argument given\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        argument : int or str\n            A representation of which argument is being used\n        \"\"\"\n\n        arguments = list(self)\n        kept_ignore = [arguments.pop(self.selector_index(model, argument)).index]\n        kept_ignore.extend(self._kept_ignore)\n\n        return _SelectorArguments.validate(model, tuple(arguments), kept_ignore)"},{"attributeType":"null","col":8,"comment":"null","endLoc":56,"id":12305,"name":"_cache_convolution","nodeType":"Attribute","startLoc":56,"text":"self._cache_convolution"},{"attributeType":"null","col":8,"comment":"null","endLoc":53,"id":12306,"name":"bounding_box","nodeType":"Attribute","startLoc":53,"text":"self.bounding_box"},{"attributeType":"null","col":8,"comment":"null","endLoc":54,"id":12307,"name":"_resolution","nodeType":"Attribute","startLoc":54,"text":"self._resolution"},{"col":0,"comment":"\n    Compute the correlation between outputs and inputs.\n\n    Parameters\n    ----------\n    transform : `~astropy.modeling.core.Model`\n        A (compound) model.\n\n    Returns\n    -------\n    separable_matrix : ndarray\n        A boolean correlation matrix of shape (n_outputs, n_inputs).\n        Indicates the dependence of outputs on inputs. For completely\n        independent outputs, the diagonal elements are True and\n        off-diagonal elements are False.\n\n    Examples\n    --------\n    >>> from astropy.modeling.models import Shift, Scale, Rotation2D, Polynomial2D\n    >>> separability_matrix(Shift(1) & Shift(2) | Scale(1) & Scale(2))\n        array([[ True, False], [False,  True]]...)\n    >>> separability_matrix(Shift(1) & Shift(2) | Rotation2D(2))\n        array([[ True,  True], [ True,  True]]...)\n    >>> separability_matrix(Shift(1) & Shift(2) | Mapping([0, 1, 0, 1]) | \n        Polynomial2D(1) & Polynomial2D(2))\n        array([[ True,  True], [ True,  True]]...)\n    >>> separability_matrix(Shift(1) & Shift(2) | Mapping([0, 1, 0, 1]))\n        array([[ True, False], [False,  True], [ True, False], [False,  True]]...)\n\n    ","endLoc":102,"header":"def separability_matrix(transform)","id":12308,"name":"separability_matrix","nodeType":"Function","startLoc":66,"text":"def separability_matrix(transform):\n    \"\"\"\n    Compute the correlation between outputs and inputs.\n\n    Parameters\n    ----------\n    transform : `~astropy.modeling.core.Model`\n        A (compound) model.\n\n    Returns\n    -------\n    separable_matrix : ndarray\n        A boolean correlation matrix of shape (n_outputs, n_inputs).\n        Indicates the dependence of outputs on inputs. For completely\n        independent outputs, the diagonal elements are True and\n        off-diagonal elements are False.\n\n    Examples\n    --------\n    >>> from astropy.modeling.models import Shift, Scale, Rotation2D, Polynomial2D\n    >>> separability_matrix(Shift(1) & Shift(2) | Scale(1) & Scale(2))\n        array([[ True, False], [False,  True]]...)\n    >>> separability_matrix(Shift(1) & Shift(2) | Rotation2D(2))\n        array([[ True,  True], [ True,  True]]...)\n    >>> separability_matrix(Shift(1) & Shift(2) | Mapping([0, 1, 0, 1]) | \\\n        Polynomial2D(1) & Polynomial2D(2))\n        array([[ True,  True], [ True,  True]]...)\n    >>> separability_matrix(Shift(1) & Shift(2) | Mapping([0, 1, 0, 1]))\n        array([[ True, False], [False,  True], [ True, False], [False,  True]]...)\n\n    \"\"\"\n    if transform.n_inputs == 1 and transform.n_outputs > 1:\n        return np.ones((transform.n_outputs, transform.n_inputs),\n                       dtype=np.bool_)\n    separable_matrix = _separable(transform)\n    separable_matrix = np.where(separable_matrix != 0, True, False)\n    return separable_matrix"},{"attributeType":"None","col":8,"comment":"null","endLoc":58,"id":12309,"name":"_convolution","nodeType":"Attribute","startLoc":58,"text":"self._convolution"},{"attributeType":"None","col":8,"comment":"null","endLoc":57,"id":12310,"name":"_kwargs","nodeType":"Attribute","startLoc":57,"text":"self._kwargs"},{"attributeType":"null","col":16,"comment":"null","endLoc":5,"id":12311,"name":"np","nodeType":"Attribute","startLoc":5,"text":"np"},{"col":0,"comment":"\n    Compute the number of outputs of two models.\n\n    The two models are the left and right model to an operation in\n    the expression tree of a compound model.\n\n    Parameters\n    ----------\n    left, right : `astropy.modeling.Model` or ndarray\n        If input is of an array, it is the output of `coord_matrix`.\n\n    ","endLoc":127,"header":"def _compute_n_outputs(left, right)","id":12312,"name":"_compute_n_outputs","nodeType":"Function","startLoc":105,"text":"def _compute_n_outputs(left, right):\n    \"\"\"\n    Compute the number of outputs of two models.\n\n    The two models are the left and right model to an operation in\n    the expression tree of a compound model.\n\n    Parameters\n    ----------\n    left, right : `astropy.modeling.Model` or ndarray\n        If input is of an array, it is the output of `coord_matrix`.\n\n    \"\"\"\n    if isinstance(left, Model):\n        lnout = left.n_outputs\n    else:\n        lnout = left.shape[0]\n    if isinstance(right, Model):\n        rnout = right.n_outputs\n    else:\n        rnout = right.shape[0]\n    noutp = lnout + rnout\n    return noutp"},{"col":0,"comment":"\n    Function corresponding to one of the arithmetic operators\n    ['+', '-'. '*', '/', '**'].\n\n    This always returns a nonseparable output.\n\n\n    Parameters\n    ----------\n    left, right : `astropy.modeling.Model` or ndarray\n        If input is of an array, it is the output of `coord_matrix`.\n\n    Returns\n    -------\n    result : ndarray\n        Result from this operation.\n    ","endLoc":168,"header":"def _arith_oper(left, right)","id":12313,"name":"_arith_oper","nodeType":"Function","startLoc":130,"text":"def _arith_oper(left, right):\n    \"\"\"\n    Function corresponding to one of the arithmetic operators\n    ['+', '-'. '*', '/', '**'].\n\n    This always returns a nonseparable output.\n\n\n    Parameters\n    ----------\n    left, right : `astropy.modeling.Model` or ndarray\n        If input is of an array, it is the output of `coord_matrix`.\n\n    Returns\n    -------\n    result : ndarray\n        Result from this operation.\n    \"\"\"\n    # models have the same number of inputs and outputs\n    def _n_inputs_outputs(input):\n        if isinstance(input, Model):\n            n_outputs, n_inputs = input.n_outputs, input.n_inputs\n        else:\n            n_outputs, n_inputs = input.shape\n        return n_inputs, n_outputs\n\n    left_inputs, left_outputs = _n_inputs_outputs(left)\n    right_inputs, right_outputs = _n_inputs_outputs(right)\n\n    if left_inputs != right_inputs or left_outputs != right_outputs:\n        raise ModelDefinitionError(\n            \"Unsupported operands for arithmetic operator: left (n_inputs={}, \"\n            \"n_outputs={}) and right (n_inputs={}, n_outputs={}); \"\n            \"models must have the same n_inputs and the same \"\n            \"n_outputs for this operator.\".format(\n                left_inputs, left_outputs, right_inputs, right_outputs))\n\n    result = np.ones((left_outputs, left_inputs))\n    return result"},{"col":0,"comment":"","endLoc":3,"header":"convolution.py#<anonymous>","id":12314,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"Convolution Model\"\"\""},{"fileName":"spline.py","filePath":"astropy/modeling","id":12315,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"Spline models and fitters.\"\"\"\n# pylint: disable=line-too-long, too-many-lines, too-many-arguments, invalid-name\n\nimport warnings\n\nimport abc\nimport functools\nimport numpy as np\n\nfrom astropy.utils.exceptions import (AstropyUserWarning,)\nfrom astropy.utils import isiterable\nfrom .core import (FittableModel, ModelDefinitionError)\n\nfrom .parameters import Parameter\n\n\n__all__ = ['Spline1D', 'SplineInterpolateFitter', 'SplineSmoothingFitter',\n           'SplineExactKnotsFitter', 'SplineSplrepFitter']\n__doctest_requires__ = {('Spline1D'): ['scipy']}\n\n\nclass _Spline(FittableModel):\n    \"\"\"Base class for spline models\"\"\"\n    _knot_names = ()\n    _coeff_names = ()\n\n    optional_inputs = {}\n\n    def __init__(self, knots=None, coeffs=None, degree=None, bounds=None,\n                 n_models=None, model_set_axis=None, name=None, meta=None):\n\n        super().__init__(\n            n_models=n_models, model_set_axis=model_set_axis, name=name,\n            meta=meta)\n\n        self._user_knots = False\n        self._init_tck(degree)\n\n        # Hack to allow an optional model argument\n        self._create_optional_inputs()\n\n        if knots is not None:\n            self._init_spline(knots, coeffs, bounds)\n        elif coeffs is not None:\n            raise ValueError(\"If one passes a coeffs vector one needs to also pass knots!\")\n\n    @property\n    def param_names(self):\n        \"\"\"\n        Coefficient names generated based on the spline's degree and\n        number of knots.\n        \"\"\"\n\n        return tuple(list(self._knot_names) + list(self._coeff_names))\n\n    @staticmethod\n    def _optional_arg(arg):\n        return f'_{arg}'\n\n    def _create_optional_inputs(self):\n        for arg in self.optional_inputs:\n            attribute = self._optional_arg(arg)\n            if hasattr(self, attribute):\n                raise ValueError(f'Optional argument {arg} already exists in this class!')\n            else:\n                setattr(self, attribute, None)\n\n    def _intercept_optional_inputs(self, **kwargs):\n        new_kwargs = kwargs\n        for arg in self.optional_inputs:\n            if (arg in kwargs):\n                attribute = self._optional_arg(arg)\n                if getattr(self, attribute) is None:\n                    setattr(self, attribute, kwargs[arg])\n                    del new_kwargs[arg]\n                else:\n                    raise RuntimeError(f'{arg} has already been set, something has gone wrong!')\n\n        return new_kwargs\n\n    def evaluate(self, *args, **kwargs):\n        \"\"\" Extract the optional kwargs passed to call \"\"\"\n\n        optional_inputs = kwargs\n        for arg in self.optional_inputs:\n            attribute = self._optional_arg(arg)\n\n            if arg in kwargs:\n                # Options passed in\n                optional_inputs[arg] = kwargs[arg]\n            elif getattr(self, attribute) is not None:\n                # No options passed in and Options set\n                optional_inputs[arg] = getattr(self, attribute)\n                setattr(self, attribute, None)\n            else:\n                # No options passed in and No options set\n                optional_inputs[arg] = self.optional_inputs[arg]\n\n        return optional_inputs\n\n    def __call__(self, *args, **kwargs):\n        \"\"\"\n        Make model callable to model evaluation\n        \"\"\"\n\n        # Hack to allow an optional model argument\n        kwargs = self._intercept_optional_inputs(**kwargs)\n\n        return super().__call__(*args, **kwargs)\n\n    def _create_parameter(self, name: str, index: int, attr: str, fixed=False):\n        \"\"\"\n        Create a spline parameter linked to an attribute array.\n\n        Parameters\n        ----------\n        name : str\n            Name for the parameter\n        index : int\n            The index of the parameter in the array\n        attr : str\n            The name for the attribute array\n        fixed : optional, bool\n            If the parameter should be fixed or not\n        \"\"\"\n\n        # Hack to allow parameters and attribute array to freely exchange values\n        #   _getter forces reading value from attribute array\n        #   _setter forces setting value to attribute array\n\n        def _getter(value, model: \"_Spline\", index: int, attr: str):\n            return getattr(model, attr)[index]\n\n        def _setter(value, model: \"_Spline\", index: int, attr: str):\n            getattr(model, attr)[index] = value\n            return value\n\n        getter = functools.partial(_getter, index=index, attr=attr)\n        setter = functools.partial(_setter, index=index, attr=attr)\n\n        default = getattr(self, attr)\n        param = Parameter(name=name, default=default[index], fixed=fixed,\n                          getter=getter, setter=setter)\n        # setter/getter wrapper for parameters in this case require the\n        # parameter to have a reference back to its parent model\n        param.model = self\n        param.value = default[index]\n\n        # Add parameter to model\n        self.__dict__[name] = param\n\n    def _create_parameters(self, base_name: str, attr: str, fixed=False):\n        \"\"\"\n        Create a spline parameters linked to an attribute array for all\n        elements in that array\n\n        Parameters\n        ----------\n        base_name : str\n            Base name for the parameters\n        attr : str\n            The name for the attribute array\n        fixed : optional, bool\n            If the parameters should be fixed or not\n        \"\"\"\n        names = []\n        for index in range(len(getattr(self, attr))):\n            name = f\"{base_name}{index}\"\n            names.append(name)\n\n            self._create_parameter(name, index, attr, fixed)\n\n        return tuple(names)\n\n    @abc.abstractmethod\n    def _init_parameters(self):\n        raise NotImplementedError(\"This needs to be implemented\")\n\n    @abc.abstractmethod\n    def _init_data(self, knots, coeffs, bounds=None):\n        raise NotImplementedError(\"This needs to be implemented\")\n\n    def _init_spline(self, knots, coeffs, bounds=None):\n        self._init_data(knots, coeffs, bounds)\n        self._init_parameters()\n\n        # fill _parameters and related attributes\n        self._initialize_parameters((), {})\n        self._initialize_slices()\n\n        # Calling this will properly fill the _parameter vector, which is\n        #   used directly sometimes without being properly filled.\n        _ = self.parameters\n\n    def _init_tck(self, degree):\n        self._c = None\n        self._t = None\n        self._degree = degree\n\n\nclass Spline1D(_Spline):\n    \"\"\"\n    One dimensional Spline Model\n\n    Parameters\n    ----------\n    knots :  optional\n        Define the knots for the spline. Can be 1) the number of interior\n        knots for the spline, 2) the array of all knots for the spline, or\n        3) If both bounds are defined, the interior knots for the spline\n    coeffs : optional\n        The array of knot coefficients for the spline\n    degree : optional\n        The degree of the spline. It must be 1 <= degree <= 5, default is 3.\n    bounds : optional\n        The upper and lower bounds of the spline.\n\n    Notes\n    -----\n    Much of the functionality of this model is provided by\n    `scipy.interpolate.BSpline` which can be directly accessed via the\n    bspline property.\n\n    Fitting for this model is provided by wrappers for:\n    `scipy.interpolate.UnivariateSpline`,\n    `scipy.interpolate.InterpolatedUnivariateSpline`,\n    and `scipy.interpolate.LSQUnivariateSpline`.\n\n    If one fails to define any knots/coefficients, no parameters will\n    be added to this model until a fitter is called. This is because\n    some of the fitters for splines vary the number of parameters and so\n    we cannot define the parameter set until after fitting in these cases.\n\n    Since parameters are not necessarily known at model initialization,\n    setting model parameters directly via the model interface has been\n    disabled.\n\n    Direct constructors are provided for this model which incorporate the\n    fitting to data directly into model construction.\n\n    Knot parameters are declared as \"fixed\" parameters by default to\n    enable the use of other `astropy.modeling` fitters to be used to\n    fit this model.\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from astropy.modeling.models import Spline1D\n    >>> from astropy.modeling import fitting\n    >>> np.random.seed(42)\n    >>> x = np.linspace(-3, 3, 50)\n    >>> y = np.exp(-x**2) + 0.1 * np.random.randn(50)\n    >>> xs = np.linspace(-3, 3, 1000)\n\n    A 1D interpolating spline can be fit to data:\n\n    >>> fitter = fitting.SplineInterpolateFitter()\n    >>> spl = fitter(Spline1D(), x, y)\n\n    Similarly, a smoothing spline can be fit to data:\n\n    >>> fitter = fitting.SplineSmoothingFitter()\n    >>> spl = fitter(Spline1D(), x, y, s=0.5)\n\n    Similarly, a spline can be fit to data using an exact set of interior knots:\n\n    >>> t = [-1, 0, 1]\n    >>> fitter = fitting.SplineExactKnotsFitter()\n    >>> spl = fitter(Spline1D(), x, y, t=t)\n    \"\"\"\n\n    n_inputs = 1\n    n_outputs = 1\n    _separable = True\n\n    optional_inputs = {'nu': 0}\n\n    def __init__(self, knots=None, coeffs=None, degree=3, bounds=None,\n                 n_models=None, model_set_axis=None, name=None, meta=None):\n\n        super().__init__(\n            knots=knots, coeffs=coeffs, degree=degree, bounds=bounds,\n            n_models=n_models, model_set_axis=model_set_axis, name=name, meta=meta\n        )\n\n    @property\n    def t(self):\n        \"\"\"\n        The knots vector\n        \"\"\"\n\n        if self._t is None:\n            return np.concatenate((np.zeros(self._degree + 1), np.ones(self._degree + 1)))\n        else:\n            return self._t\n\n    @t.setter\n    def t(self, value):\n        if self._t is None:\n            raise ValueError(\"The model parameters must be initialized before setting knots.\")\n        elif len(value) == len(self._t):\n            self._t = value\n        else:\n            raise ValueError(\"There must be exactly as many knots as previously defined.\")\n\n    @property\n    def t_interior(self):\n        \"\"\"\n        The interior knots\n        \"\"\"\n\n        return self.t[self.degree + 1: -(self.degree + 1)]\n\n    @property\n    def c(self):\n        \"\"\"\n        The coefficients vector\n        \"\"\"\n\n        if self._c is None:\n            return np.zeros(len(self.t))\n        else:\n            return self._c\n\n    @c.setter\n    def c(self, value):\n        if self._c is None:\n            raise ValueError(\"The model parameters must be initialized before setting coeffs.\")\n        elif len(value) == len(self._c):\n            self._c = value\n        else:\n            raise ValueError(\"There must be exactly as many coeffs as previously defined.\")\n\n    @property\n    def degree(self):\n        \"\"\"\n        The degree of the spline polynomials\n        \"\"\"\n\n        return self._degree\n\n    @property\n    def _initialized(self):\n        return self._t is not None and self._c is not None\n\n    @property\n    def tck(self):\n        \"\"\"\n        Scipy 'tck' tuple representation\n        \"\"\"\n\n        return (self.t, self.c, self.degree)\n\n    @tck.setter\n    def tck(self, value):\n        if self._initialized:\n            if value[2] != self.degree:\n                raise ValueError(\"tck has incompatible degree!\")\n\n            self.t = value[0]\n            self.c = value[1]\n        else:\n            self._init_spline(value[0], value[1])\n\n        # Calling this will properly fill the _parameter vector, which is\n        #   used directly sometimes without being properly filled.\n        _ = self.parameters\n\n    @property\n    def bspline(self):\n        \"\"\"\n        Scipy bspline object representation\n        \"\"\"\n\n        from scipy.interpolate import BSpline\n\n        return BSpline(*self.tck)\n\n    @bspline.setter\n    def bspline(self, value):\n        from scipy.interpolate import BSpline\n\n        if isinstance(value, BSpline):\n            self.tck = value.tck\n        else:\n            self.tck = value\n\n    @property\n    def knots(self):\n        \"\"\"\n        Dictionary of knot parameters\n        \"\"\"\n\n        return [getattr(self, knot) for knot in self._knot_names]\n\n    @property\n    def user_knots(self):\n        \"\"\"If the knots have been supplied by the user\"\"\"\n        return self._user_knots\n\n    @user_knots.setter\n    def user_knots(self, value):\n        self._user_knots = value\n\n    @property\n    def coeffs(self):\n        \"\"\"\n        Dictionary of coefficient parameters\n        \"\"\"\n\n        return [getattr(self, coeff) for coeff in self._coeff_names]\n\n    def _init_parameters(self):\n        self._knot_names = self._create_parameters(\"knot\", \"t\", fixed=True)\n        self._coeff_names = self._create_parameters(\"coeff\", \"c\")\n\n    def _init_bounds(self, bounds=None):\n        if bounds is None:\n            bounds = [None, None]\n\n        if bounds[0] is None:\n            lower = np.zeros(self._degree + 1)\n        else:\n            lower = np.array([bounds[0]] * (self._degree + 1))\n\n        if bounds[1] is None:\n            upper = np.ones(self._degree + 1)\n        else:\n            upper = np.array([bounds[1]] * (self._degree + 1))\n\n        if bounds[0] is not None and bounds[1] is not None:\n            self.bounding_box = bounds\n            has_bounds = True\n        else:\n            has_bounds = False\n\n        return has_bounds, lower, upper\n\n    def _init_knots(self, knots, has_bounds, lower, upper):\n        if np.issubdtype(type(knots), np.integer):\n            self._t = np.concatenate(\n                (lower, np.zeros(knots), upper)\n            )\n        elif isiterable(knots):\n            self._user_knots = True\n            if has_bounds:\n                self._t = np.concatenate(\n                    (lower, np.array(knots), upper)\n                )\n            else:\n                if len(knots) < 2*(self._degree + 1):\n                    raise ValueError(f\"Must have at least {2*(self._degree + 1)} knots.\")\n                self._t = np.array(knots)\n        else:\n            raise ValueError(f\"Knots: {knots} must be iterable or value\")\n\n        # check that knots form a viable spline\n        self.bspline\n\n    def _init_coeffs(self, coeffs=None):\n        if coeffs is None:\n            self._c = np.zeros(len(self._t))\n        else:\n            self._c = np.array(coeffs)\n\n        # check that coeffs form a viable spline\n        self.bspline\n\n    def _init_data(self, knots, coeffs, bounds=None):\n        self._init_knots(knots, *self._init_bounds(bounds))\n        self._init_coeffs(coeffs)\n\n    def evaluate(self, *args, **kwargs):\n        \"\"\"\n        Evaluate the spline.\n\n        Parameters\n        ----------\n        x :\n            (positional) The points where the model is evaluating the spline at\n        nu : optional\n            (kwarg) The derivative of the spline for evaluation, 0 <= nu <= degree + 1.\n            Default: 0.\n        \"\"\"\n        kwargs = super().evaluate(*args, **kwargs)\n        x = args[0]\n\n        if 'nu' in kwargs:\n            if kwargs['nu'] > self.degree + 1:\n                raise RuntimeError(\"Cannot evaluate a derivative of \"\n                                   f\"order higher than {self.degree + 1}\")\n\n        return self.bspline(x, **kwargs)\n\n    def derivative(self, nu=1):\n        \"\"\"\n        Create a spline that is the derivative of this one\n\n        Parameters\n        ----------\n        nu : int, optional\n            Derivative order, default is 1.\n        \"\"\"\n        if nu <= self.degree:\n            bspline = self.bspline.derivative(nu=nu)\n\n            derivative = Spline1D(degree=bspline.k)\n            derivative.bspline = bspline\n\n            return derivative\n        else:\n            raise ValueError(f'Must have nu <= {self.degree}')\n\n    def antiderivative(self, nu=1):\n        \"\"\"\n        Create a spline that is an antiderivative of this one\n\n        Parameters\n        ----------\n        nu : int, optional\n            Antiderivative order, default is 1.\n\n        Notes\n        -----\n        Assumes constant of integration is 0\n        \"\"\"\n        if (nu + self.degree) <= 5:\n            bspline = self.bspline.antiderivative(nu=nu)\n\n            antiderivative = Spline1D(degree=bspline.k)\n            antiderivative.bspline = bspline\n\n            return antiderivative\n        else:\n            raise ValueError(\"Supported splines can have max degree 5, \"\n                             f\"antiderivative degree will be {nu + self.degree}\")\n\n\nclass _SplineFitter(abc.ABC):\n    \"\"\"\n    Base Spline Fitter\n    \"\"\"\n\n    def __init__(self):\n        self.fit_info = {\n            'resid': None,\n            'spline': None\n        }\n\n    def _set_fit_info(self, spline):\n        self.fit_info['resid'] = spline.get_residual()\n        self.fit_info['spline'] = spline\n\n    @abc.abstractmethod\n    def _fit_method(self, model, x, y, **kwargs):\n        raise NotImplementedError(\"This has not been implemented for _SplineFitter.\")\n\n    def __call__(self, model, x, y, z=None, **kwargs):\n        model_copy = model.copy()\n        if isinstance(model_copy, Spline1D):\n            if z is not None:\n                raise ValueError(\"1D model can only have 2 data points.\")\n\n            spline = self._fit_method(model_copy, x, y, **kwargs)\n\n        else:\n            raise ModelDefinitionError(\"Only spline models are compatible with this fitter.\")\n\n        self._set_fit_info(spline)\n\n        return model_copy\n\n\nclass SplineInterpolateFitter(_SplineFitter):\n    \"\"\"\n    Fit an interpolating spline\n    \"\"\"\n\n    def _fit_method(self, model, x, y, **kwargs):\n        weights = kwargs.pop('weights', None)\n        bbox = kwargs.pop('bbox', [None, None])\n\n        if model.user_knots:\n            warnings.warn(\"The current user specified knots maybe ignored for interpolating data\",\n                          AstropyUserWarning)\n            model.user_knots = False\n\n        if bbox != [None, None]:\n            model.bounding_box = bbox\n\n        from scipy.interpolate import InterpolatedUnivariateSpline\n        spline = InterpolatedUnivariateSpline(x, y, w=weights, bbox=bbox, k=model.degree)\n\n        model.tck = spline._eval_args\n        return spline\n\n\nclass SplineSmoothingFitter(_SplineFitter):\n    \"\"\"\n    Fit a smoothing spline\n    \"\"\"\n\n    def _fit_method(self, model, x, y, **kwargs):\n        s = kwargs.pop('s', None)\n        weights = kwargs.pop('weights', None)\n        bbox = kwargs.pop('bbox', [None, None])\n\n        if model.user_knots:\n            warnings.warn(\"The current user specified knots maybe ignored for smoothing data\",\n                          AstropyUserWarning)\n            model.user_knots = False\n\n        if bbox != [None, None]:\n            model.bounding_box = bbox\n\n        from scipy.interpolate import UnivariateSpline\n        spline = UnivariateSpline(x, y, w=weights, bbox=bbox, k=model.degree, s=s)\n\n        model.tck = spline._eval_args\n        return spline\n\n\nclass SplineExactKnotsFitter(_SplineFitter):\n    \"\"\"\n    Fit a spline using least-squares regression.\n    \"\"\"\n\n    def _fit_method(self, model, x, y, **kwargs):\n        t = kwargs.pop('t', None)\n        weights = kwargs.pop('weights', None)\n        bbox = kwargs.pop('bbox', [None, None])\n\n        if t is not None:\n            if model.user_knots:\n                warnings.warn(\"The current user specified knots will be \"\n                              \"overwritten for by knots passed into this function\",\n                              AstropyUserWarning)\n        else:\n            if model.user_knots:\n                t = model.t_interior\n            else:\n                raise RuntimeError(\"No knots have been provided\")\n\n        if bbox != [None, None]:\n            model.bounding_box = bbox\n\n        from scipy.interpolate import LSQUnivariateSpline\n        spline = LSQUnivariateSpline(x, y, t, w=weights, bbox=bbox, k=model.degree)\n\n        model.tck = spline._eval_args\n        return spline\n\n\nclass SplineSplrepFitter(_SplineFitter):\n    \"\"\"\n    Fit a spline using the `scipy.interpolate.splrep` function interface.\n    \"\"\"\n\n    def __init__(self):\n        super().__init__()\n        self.fit_info = {\n            'fp': None,\n            'ier': None,\n            'msg': None\n        }\n\n    def _fit_method(self, model, x, y, **kwargs):\n        t = kwargs.pop('t', None)\n        s = kwargs.pop('s', None)\n        task = kwargs.pop('task', 0)\n        weights = kwargs.pop('weights', None)\n        bbox = kwargs.pop('bbox', [None, None])\n\n        if t is not None:\n            if model.user_knots:\n                warnings.warn(\"The current user specified knots will be \"\n                              \"overwritten for by knots passed into this function\",\n                              AstropyUserWarning)\n        else:\n            if model.user_knots:\n                t = model.t_interior\n\n        if bbox != [None, None]:\n            model.bounding_box = bbox\n\n        from scipy.interpolate import splrep\n        tck, fp, ier, msg = splrep(x, y, w=weights, xb=bbox[0], xe=bbox[1], k=model.degree,\n                                   s=s, t=t, task=task, full_output=1)\n        model.tck = tck\n        return fp, ier, msg\n\n    def _set_fit_info(self, spline):\n        self.fit_info['fp'] = spline[0]\n        self.fit_info['ier'] = spline[1]\n        self.fit_info['msg'] = spline[2]\n"},{"className":"Parameter","col":0,"comment":"\n    Wraps individual parameters.\n\n    Since 4.0 Parameters are no longer descriptors and are based on a new\n    implementation of the Parameter class. Parameters now  (as of 4.0) store\n    values locally (as instead previously in the associated model)\n\n    This class represents a model's parameter (in a somewhat broad sense). It\n    serves a number of purposes:\n\n    1) A type to be recognized by models and treated specially at class\n    initialization (i.e., if it is found that there is a class definition\n    of a Parameter, the model initializer makes a copy at the instance level).\n\n    2) Managing the handling of allowable parameter values and once defined,\n    ensuring updates are consistent with the Parameter definition. This\n    includes the optional use of units and quantities as well as transforming\n    values to an internally consistent representation (e.g., from degrees to\n    radians through the use of getters and setters).\n\n    3) Holding attributes of parameters relevant to fitting, such as whether\n    the parameter may be varied in fitting, or whether there are constraints\n    that must be satisfied.\n\n\n\n    See :ref:`astropy:modeling-parameters` for more details.\n\n    Parameters\n    ----------\n    name : str\n        parameter name\n\n        .. warning::\n\n            The fact that `Parameter` accepts ``name`` as an argument is an\n            implementation detail, and should not be used directly.  When\n            defining a new `Model` class, parameter names are always\n            automatically defined by the class attribute they're assigned to.\n    description : str\n        parameter description\n    default : float or array\n        default value to use for this parameter\n    unit : `~astropy.units.Unit`\n        if specified, the parameter will be in these units, and when the\n        parameter is updated in future, it should be set to a\n        :class:`~astropy.units.Quantity` that has equivalent units.\n    getter : callable\n        a function that wraps the raw (internal) value of the parameter\n        when returning the value through the parameter proxy (eg. a\n        parameter may be stored internally as radians but returned to the\n        user as degrees)\n    setter : callable\n        a function that wraps any values assigned to this parameter; should\n        be the inverse of getter\n    fixed : bool\n        if True the parameter is not varied during fitting\n    tied : callable or False\n        if callable is supplied it provides a way to link the value of this\n        parameter to another parameter (or some other arbitrary function)\n    min : float\n        the lower bound of a parameter\n    max : float\n        the upper bound of a parameter\n    bounds : tuple\n        specify min and max as a single tuple--bounds may not be specified\n        simultaneously with min or max\n    ","endLoc":699,"id":12316,"nodeType":"Class","startLoc":114,"text":"class Parameter:\n    \"\"\"\n    Wraps individual parameters.\n\n    Since 4.0 Parameters are no longer descriptors and are based on a new\n    implementation of the Parameter class. Parameters now  (as of 4.0) store\n    values locally (as instead previously in the associated model)\n\n    This class represents a model's parameter (in a somewhat broad sense). It\n    serves a number of purposes:\n\n    1) A type to be recognized by models and treated specially at class\n    initialization (i.e., if it is found that there is a class definition\n    of a Parameter, the model initializer makes a copy at the instance level).\n\n    2) Managing the handling of allowable parameter values and once defined,\n    ensuring updates are consistent with the Parameter definition. This\n    includes the optional use of units and quantities as well as transforming\n    values to an internally consistent representation (e.g., from degrees to\n    radians through the use of getters and setters).\n\n    3) Holding attributes of parameters relevant to fitting, such as whether\n    the parameter may be varied in fitting, or whether there are constraints\n    that must be satisfied.\n\n\n\n    See :ref:`astropy:modeling-parameters` for more details.\n\n    Parameters\n    ----------\n    name : str\n        parameter name\n\n        .. warning::\n\n            The fact that `Parameter` accepts ``name`` as an argument is an\n            implementation detail, and should not be used directly.  When\n            defining a new `Model` class, parameter names are always\n            automatically defined by the class attribute they're assigned to.\n    description : str\n        parameter description\n    default : float or array\n        default value to use for this parameter\n    unit : `~astropy.units.Unit`\n        if specified, the parameter will be in these units, and when the\n        parameter is updated in future, it should be set to a\n        :class:`~astropy.units.Quantity` that has equivalent units.\n    getter : callable\n        a function that wraps the raw (internal) value of the parameter\n        when returning the value through the parameter proxy (eg. a\n        parameter may be stored internally as radians but returned to the\n        user as degrees)\n    setter : callable\n        a function that wraps any values assigned to this parameter; should\n        be the inverse of getter\n    fixed : bool\n        if True the parameter is not varied during fitting\n    tied : callable or False\n        if callable is supplied it provides a way to link the value of this\n        parameter to another parameter (or some other arbitrary function)\n    min : float\n        the lower bound of a parameter\n    max : float\n        the upper bound of a parameter\n    bounds : tuple\n        specify min and max as a single tuple--bounds may not be specified\n        simultaneously with min or max\n    \"\"\"\n\n    constraints = ('fixed', 'tied', 'bounds')\n    \"\"\"\n    Types of constraints a parameter can have.  Excludes 'min' and 'max'\n    which are just aliases for the first and second elements of the 'bounds'\n    constraint (which is represented as a 2-tuple). 'prior' and 'posterior'\n    are available for use by user fitters but are not used by any built-in\n    fitters as of this writing.\n    \"\"\"\n\n    def __init__(self, name='', description='', default=None, unit=None,\n                 getter=None, setter=None, fixed=False, tied=False, min=None,\n                 max=None, bounds=None, prior=None, posterior=None):\n        super().__init__()\n\n        self._model = None\n        self._model_required = False\n        self._setter = self._create_value_wrapper(setter, None)\n        self._getter = self._create_value_wrapper(getter, None)\n        self._name = name\n        self.__doc__ = self._description = description.strip()\n\n        # We only need to perform this check on unbound parameters\n        if isinstance(default, Quantity):\n            if unit is not None and not unit.is_equivalent(default.unit):\n                raise ParameterDefinitionError(\n                    \"parameter default {0} does not have units equivalent to \"\n                    \"the required unit {1}\".format(default, unit))\n            unit = default.unit\n            default = default.value\n\n        self._default = default\n        self._unit = unit\n        # Internal units correspond to raw_units held by the model in the\n        # previous implementation. The private _getter and _setter methods\n        # use this to convert to and from the public unit defined for the\n        # parameter.\n        self._internal_unit = None\n        if not self._model_required:\n            if self._default is not None:\n                self.value = self._default\n            else:\n                self._value = None\n\n        # NOTE: These are *default* constraints--on model instances constraints\n        # are taken from the model if set, otherwise the defaults set here are\n        # used\n        if bounds is not None:\n            if min is not None or max is not None:\n                raise ValueError(\n                    'bounds may not be specified simultaneously with min or '\n                    'max when instantiating Parameter {}'.format(name))\n        else:\n            bounds = (min, max)\n\n        self._fixed = fixed\n        self._tied = tied\n        self._bounds = bounds\n        self._order = None\n\n        self._validator = None\n        self._prior = prior\n        self._posterior = posterior\n\n        self._std = None\n\n    def __set_name__(self, owner, name):\n        self._name = name\n\n    def __len__(self):\n        val = self.value\n        if val.shape == ():\n            return 1\n        else:\n            return val.shape[0]\n\n    def __getitem__(self, key):\n        value = self.value\n        if len(value.shape) == 0:\n            # Wrap the value in a list so that getitem can work for sensible\n            # indices like [0] and [-1]\n            value = [value]\n        return value[key]\n\n    def __setitem__(self, key, value):\n        # Get the existing value and check whether it even makes sense to\n        # apply this index\n        oldvalue = self.value\n        if isinstance(key, slice):\n            if len(oldvalue[key]) == 0:\n                raise InputParameterError(\n                    \"Slice assignment outside the parameter dimensions for \"\n                    \"'{}'\".format(self.name))\n            for idx, val in zip(range(*key.indices(len(self))), value):\n                self.__setitem__(idx, val)\n        else:\n            try:\n                oldvalue[key] = value\n            except IndexError:\n                raise InputParameterError(\n                    \"Input dimension {} invalid for {!r} parameter with \"\n                    \"dimension {}\".format(key, self.name, value.shape[0]))  # likely wrong\n\n    def __repr__(self):\n        args = f\"'{self._name}'\"\n        args += f', value={self.value}'\n\n        if self.unit is not None:\n            args += f', unit={self.unit}'\n\n        for cons in self.constraints:\n            val = getattr(self, cons)\n            if val not in (None, False, (None, None)):\n                # Maybe non-obvious, but False is the default for the fixed and\n                # tied constraints\n                args += f', {cons}={val}'\n\n        return f\"{self.__class__.__name__}({args})\"\n\n    @property\n    def name(self):\n        \"\"\"Parameter name\"\"\"\n\n        return self._name\n\n    @property\n    def default(self):\n        \"\"\"Parameter default value\"\"\"\n        return self._default\n\n    @property\n    def value(self):\n        \"\"\"The unadorned value proxied by this parameter.\"\"\"\n        if self._getter is None and self._setter is None:\n            return np.float64(self._value)\n        else:\n            # This new implementation uses the names of internal_unit\n            # in place of raw_unit used previously. The contrast between\n            # internal values and units is that between the public\n            # units that the parameter advertises to what it actually\n            # uses internally.\n            if self.internal_unit:\n                return np.float64(self._getter(self._internal_value,\n                                               self.internal_unit,\n                                               self.unit).value)\n            elif self._getter:\n                return np.float64(self._getter(self._internal_value))\n            elif self._setter:\n                return np.float64(self._internal_value)\n\n    @value.setter\n    def value(self, value):\n        if isinstance(value, Quantity):\n            raise TypeError(\"The .value property on parameters should be set\"\n                            \" to unitless values, not Quantity objects. To set\"\n                            \"a parameter to a quantity simply set the \"\n                            \"parameter directly without using .value\")\n        if self._setter is None:\n            self._value = np.array(value, dtype=np.float64)\n        else:\n            self._internal_value = np.array(self._setter(value),\n                                            dtype=np.float64)\n\n    @property\n    def unit(self):\n        \"\"\"\n        The unit attached to this parameter, if any.\n\n        On unbound parameters (i.e. parameters accessed through the\n        model class, rather than a model instance) this is the required/\n        default unit for the parameter.\n        \"\"\"\n\n        return self._unit\n\n    @unit.setter\n    def unit(self, unit):\n        if self.unit is None:\n            raise ValueError('Cannot attach units to parameters that were '\n                             'not initially specified with units')\n        else:\n            raise ValueError('Cannot change the unit attribute directly, '\n                             'instead change the parameter to a new quantity')\n\n    def _set_unit(self, unit, force=False):\n        if force:\n            self._unit = unit\n        else:\n            self.unit = unit\n\n    @property\n    def internal_unit(self):\n        \"\"\"\n        Return the internal unit the parameter uses for the internal value stored\n        \"\"\"\n        return self._internal_unit\n\n    @internal_unit.setter\n    def internal_unit(self, internal_unit):\n        \"\"\"\n        Set the unit the parameter will convert the supplied value to the\n        representation used internally.\n        \"\"\"\n        self._internal_unit = internal_unit\n\n    @property\n    def quantity(self):\n        \"\"\"\n        This parameter, as a :class:`~astropy.units.Quantity` instance.\n        \"\"\"\n        if self.unit is None:\n            return None\n        return self.value * self.unit\n\n    @quantity.setter\n    def quantity(self, quantity):\n        if not isinstance(quantity, Quantity):\n            raise TypeError(\"The .quantity attribute should be set \"\n                            \"to a Quantity object\")\n        self.value = quantity.value\n        self._unit = quantity.unit\n\n    @property\n    def shape(self):\n        \"\"\"The shape of this parameter's value array.\"\"\"\n        if self._setter is None:\n            return self._value.shape\n        return self._internal_value.shape\n\n    @shape.setter\n    def shape(self, value):\n        if isinstance(self.value, np.generic):\n            if value not in ((), (1,)):\n                raise ValueError(\"Cannot assign this shape to a scalar quantity\")\n        else:\n            self.value.shape = value\n\n    @property\n    def size(self):\n        \"\"\"The size of this parameter's value array.\"\"\"\n\n        return np.size(self.value)\n\n    @property\n    def std(self):\n        \"\"\"Standard deviation, if available from fit.\"\"\"\n\n        return self._std\n\n    @std.setter\n    def std(self, value):\n\n        self._std = value\n\n    @property\n    def prior(self):\n        return self._prior\n\n    @prior.setter\n    def prior(self, val):\n        self._prior = val\n\n    @property\n    def posterior(self):\n        return self._posterior\n\n    @posterior.setter\n    def posterior(self, val):\n        self._posterior = val\n\n    @property\n    def fixed(self):\n        \"\"\"\n        Boolean indicating if the parameter is kept fixed during fitting.\n        \"\"\"\n        return self._fixed\n\n    @fixed.setter\n    def fixed(self, value):\n        \"\"\" Fix a parameter. \"\"\"\n        if not isinstance(value, bool):\n            raise ValueError(\"Value must be boolean\")\n        self._fixed = value\n\n    @property\n    def tied(self):\n        \"\"\"\n        Indicates that this parameter is linked to another one.\n\n        A callable which provides the relationship of the two parameters.\n        \"\"\"\n\n        return self._tied\n\n    @tied.setter\n    def tied(self, value):\n        \"\"\"Tie a parameter\"\"\"\n\n        if not callable(value) and value not in (False, None):\n            raise TypeError(\"Tied must be a callable or set to False or None\")\n        self._tied = value\n\n    @property\n    def bounds(self):\n        \"\"\"The minimum and maximum values of a parameter as a tuple\"\"\"\n\n        return self._bounds\n\n    @bounds.setter\n    def bounds(self, value):\n        \"\"\"Set the minimum and maximum values of a parameter from a tuple\"\"\"\n\n        _min, _max = value\n        if _min is not None:\n            if not isinstance(_min, (numbers.Number, Quantity)):\n                raise TypeError(\"Min value must be a number or a Quantity\")\n            if isinstance(_min, Quantity):\n                _min = float(_min.value)\n            else:\n                _min = float(_min)\n\n        if _max is not None:\n            if not isinstance(_max, (numbers.Number, Quantity)):\n                raise TypeError(\"Max value must be a number or a Quantity\")\n            if isinstance(_max, Quantity):\n                _max = float(_max.value)\n            else:\n                _max = float(_max)\n\n        self._bounds = (_min, _max)\n\n    @property\n    def min(self):\n        \"\"\"A value used as a lower bound when fitting a parameter\"\"\"\n\n        return self.bounds[0]\n\n    @min.setter\n    def min(self, value):\n        \"\"\"Set a minimum value of a parameter\"\"\"\n\n        self.bounds = (value, self.max)\n\n    @property\n    def max(self):\n        \"\"\"A value used as an upper bound when fitting a parameter\"\"\"\n\n        return self.bounds[1]\n\n    @max.setter\n    def max(self, value):\n        \"\"\"Set a maximum value of a parameter.\"\"\"\n\n        self.bounds = (self.min, value)\n\n    @property\n    def validator(self):\n        \"\"\"\n        Used as a decorator to set the validator method for a `Parameter`.\n        The validator method validates any value set for that parameter.\n        It takes two arguments--``self``, which refers to the `Model`\n        instance (remember, this is a method defined on a `Model`), and\n        the value being set for this parameter.  The validator method's\n        return value is ignored, but it may raise an exception if the value\n        set on the parameter is invalid (typically an `InputParameterError`\n        should be raised, though this is not currently a requirement).\n\n        \"\"\"\n\n        def validator(func, self=self):\n            if callable(func):\n                self._validator = func\n                return self\n            else:\n                raise ValueError(\"This decorator method expects a callable.\\n\"\n                                 \"The use of this method as a direct validator is\\n\"\n                                 \"deprecated; use the new validate method instead\\n\")\n        return validator\n\n    def validate(self, value):\n        \"\"\" Run the validator on this parameter\"\"\"\n        if self._validator is not None and self._model is not None:\n            self._validator(self._model, value)\n\n    def copy(self, name=None, description=None, default=None, unit=None,\n             getter=None, setter=None, fixed=False, tied=False, min=None,\n             max=None, bounds=None, prior=None, posterior=None):\n        \"\"\"\n        Make a copy of this `Parameter`, overriding any of its core attributes\n        in the process (or an exact copy).\n\n        The arguments to this method are the same as those for the `Parameter`\n        initializer.  This simply returns a new `Parameter` instance with any\n        or all of the attributes overridden, and so returns the equivalent of:\n\n        .. code:: python\n\n            Parameter(self.name, self.description, ...)\n\n        \"\"\"\n\n        kwargs = locals().copy()\n        del kwargs['self']\n\n        for key, value in kwargs.items():\n            if value is None:\n                # Annoying special cases for min/max where are just aliases for\n                # the components of bounds\n                if key in ('min', 'max'):\n                    continue\n                else:\n                    if hasattr(self, key):\n                        value = getattr(self, key)\n                    elif hasattr(self, '_' + key):\n                        value = getattr(self, '_' + key)\n                kwargs[key] = value\n\n        return self.__class__(**kwargs)\n\n    @property\n    def model(self):\n        \"\"\" Return the model this  parameter is associated with.\"\"\"\n        return self._model\n\n    @model.setter\n    def model(self, value):\n        self._model = value\n        self._setter = self._create_value_wrapper(self._setter, value)\n        self._getter = self._create_value_wrapper(self._getter, value)\n        if self._model_required:\n            if self._default is not None:\n                self.value = self._default\n            else:\n                self._value = None\n\n    @property\n    def _raw_value(self):\n        \"\"\"\n        Currently for internal use only.\n\n        Like Parameter.value but does not pass the result through\n        Parameter.getter.  By design this should only be used from bound\n        parameters.\n\n        This will probably be removed are retweaked at some point in the\n        process of rethinking how parameter values are stored/updated.\n        \"\"\"\n        if self._setter:\n            return self._internal_value\n        return self.value\n\n    def _create_value_wrapper(self, wrapper, model):\n        \"\"\"Wraps a getter/setter function to support optionally passing in\n        a reference to the model object as the second argument.\n        If a model is tied to this parameter and its getter/setter supports\n        a second argument then this creates a partial function using the model\n        instance as the second argument.\n        \"\"\"\n\n        if isinstance(wrapper, np.ufunc):\n            if wrapper.nin != 1:\n                raise TypeError(\"A numpy.ufunc used for Parameter \"\n                                \"getter/setter may only take one input \"\n                                \"argument\")\n        elif wrapper is None:\n            # Just allow non-wrappers to fall through silently, for convenience\n            return None\n        else:\n            inputs, _ = get_inputs_and_params(wrapper)\n            nargs = len(inputs)\n\n            if nargs == 1:\n                pass\n            elif nargs == 2:\n                self._model_required = True\n                if model is not None:\n                    # Don't make a partial function unless we're tied to a\n                    # specific model instance\n                    model_arg = inputs[1].name\n                    wrapper = functools.partial(wrapper, **{model_arg: model})\n            else:\n                raise TypeError(\"Parameter getter/setter must be a function \"\n                                \"of either one or two arguments\")\n\n        return wrapper\n\n    def __array__(self, dtype=None):\n        # Make np.asarray(self) work a little more straightforwardly\n        arr = np.asarray(self.value, dtype=dtype)\n\n        if self.unit is not None:\n            arr = Quantity(arr, self.unit, copy=False)\n\n        return arr\n\n    def __bool__(self):\n        return bool(np.all(self.value))\n\n    __add__ = _binary_arithmetic_operation(operator.add)\n    __radd__ = _binary_arithmetic_operation(operator.add, reflected=True)\n    __sub__ = _binary_arithmetic_operation(operator.sub)\n    __rsub__ = _binary_arithmetic_operation(operator.sub, reflected=True)\n    __mul__ = _binary_arithmetic_operation(operator.mul)\n    __rmul__ = _binary_arithmetic_operation(operator.mul, reflected=True)\n    __pow__ = _binary_arithmetic_operation(operator.pow)\n    __rpow__ = _binary_arithmetic_operation(operator.pow, reflected=True)\n    __truediv__ = _binary_arithmetic_operation(operator.truediv)\n    __rtruediv__ = _binary_arithmetic_operation(operator.truediv,\n                                                reflected=True)\n    __eq__ = _binary_comparison_operation(operator.eq)\n    __ne__ = _binary_comparison_operation(operator.ne)\n    __lt__ = _binary_comparison_operation(operator.lt)\n    __gt__ = _binary_comparison_operation(operator.gt)\n    __le__ = _binary_comparison_operation(operator.le)\n    __ge__ = _binary_comparison_operation(operator.ge)\n    __neg__ = _unary_arithmetic_operation(operator.neg)\n    __abs__ = _unary_arithmetic_operation(operator.abs)"},{"col":4,"comment":"null","endLoc":250,"header":"def __set_name__(self, owner, name)","id":12317,"name":"__set_name__","nodeType":"Function","startLoc":249,"text":"def __set_name__(self, owner, name):\n        self._name = name"},{"col":4,"comment":"null","endLoc":257,"header":"def __len__(self)","id":12318,"name":"__len__","nodeType":"Function","startLoc":252,"text":"def __len__(self):\n        val = self.value\n        if val.shape == ():\n            return 1\n        else:\n            return val.shape[0]"},{"col":4,"comment":"null","endLoc":265,"header":"def __getitem__(self, key)","id":12319,"name":"__getitem__","nodeType":"Function","startLoc":259,"text":"def __getitem__(self, key):\n        value = self.value\n        if len(value.shape) == 0:\n            # Wrap the value in a list so that getitem can work for sensible\n            # indices like [0] and [-1]\n            value = [value]\n        return value[key]"},{"col":4,"comment":"null","endLoc":284,"header":"def __setitem__(self, key, value)","id":12320,"name":"__setitem__","nodeType":"Function","startLoc":267,"text":"def __setitem__(self, key, value):\n        # Get the existing value and check whether it even makes sense to\n        # apply this index\n        oldvalue = self.value\n        if isinstance(key, slice):\n            if len(oldvalue[key]) == 0:\n                raise InputParameterError(\n                    \"Slice assignment outside the parameter dimensions for \"\n                    \"'{}'\".format(self.name))\n            for idx, val in zip(range(*key.indices(len(self))), value):\n                self.__setitem__(idx, val)\n        else:\n            try:\n                oldvalue[key] = value\n            except IndexError:\n                raise InputParameterError(\n                    \"Input dimension {} invalid for {!r} parameter with \"\n                    \"dimension {}\".format(key, self.name, value.shape[0]))  # likely wrong"},{"col":4,"comment":"\n        Add argument to the kept_ignore list\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        argument : int or str\n            A representation of which argument is being used\n        ","endLoc":1253,"header":"def add_ignore(self, model, argument)","id":12321,"name":"add_ignore","nodeType":"Function","startLoc":1235,"text":"def add_ignore(self, model, argument):\n        \"\"\"\n        Add argument to the kept_ignore list\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n\n        argument : int or str\n            A representation of which argument is being used\n        \"\"\"\n\n        if self.is_argument(model, argument):\n            raise ValueError(f\"{argument}: is a selector argument and cannot be ignored.\")\n\n        kept_ignore = [get_index(model, argument)]\n\n        return _SelectorArguments.validate(model, self, kept_ignore)"},{"col":4,"comment":"\n        Test the ConfigObj against a configspec.\n\n        It uses the ``validator`` object from *validate.py*.\n\n        To run ``validate`` on the current ConfigObj, call: ::\n\n            test = config.validate(validator)\n\n        (Normally having previously passed in the configspec when the ConfigObj\n        was created - you can dynamically assign a dictionary of checks to the\n        ``configspec`` attribute of a section though).\n\n        It returns ``True`` if everything passes, or a dictionary of\n        pass/fails (True/False). If every member of a subsection passes, it\n        will just have the value ``True``. (It also returns ``False`` if all\n        members fail).\n\n        In addition, it converts the values from strings to their native\n        types if their checks pass (and ``stringify`` is set).\n\n        If ``preserve_errors`` is ``True`` (``False`` is default) then instead\n        of a marking a fail with a ``False``, it will preserve the actual\n        exception object. This can contain info about the reason for failure.\n        For example the ``VdtValueTooSmallError`` indicates that the value\n        supplied was too small. If a value (or section) is missing it will\n        still be marked as ``False``.\n\n        You must have the validate module to use ``preserve_errors=True``.\n\n        You can then use the ``flatten_errors`` function to turn your nested\n        results dictionary into a flattened list of failures - useful for\n        displaying meaningful error messages.\n        ","endLoc":2328,"header":"def validate(self, validator, preserve_errors=False, copy=False,\n                 section=None)","id":12322,"name":"validate","nodeType":"Function","startLoc":2124,"text":"def validate(self, validator, preserve_errors=False, copy=False,\n                 section=None):\n        \"\"\"\n        Test the ConfigObj against a configspec.\n\n        It uses the ``validator`` object from *validate.py*.\n\n        To run ``validate`` on the current ConfigObj, call: ::\n\n            test = config.validate(validator)\n\n        (Normally having previously passed in the configspec when the ConfigObj\n        was created - you can dynamically assign a dictionary of checks to the\n        ``configspec`` attribute of a section though).\n\n        It returns ``True`` if everything passes, or a dictionary of\n        pass/fails (True/False). If every member of a subsection passes, it\n        will just have the value ``True``. (It also returns ``False`` if all\n        members fail).\n\n        In addition, it converts the values from strings to their native\n        types if their checks pass (and ``stringify`` is set).\n\n        If ``preserve_errors`` is ``True`` (``False`` is default) then instead\n        of a marking a fail with a ``False``, it will preserve the actual\n        exception object. This can contain info about the reason for failure.\n        For example the ``VdtValueTooSmallError`` indicates that the value\n        supplied was too small. If a value (or section) is missing it will\n        still be marked as ``False``.\n\n        You must have the validate module to use ``preserve_errors=True``.\n\n        You can then use the ``flatten_errors`` function to turn your nested\n        results dictionary into a flattened list of failures - useful for\n        displaying meaningful error messages.\n        \"\"\"\n        if section is None:\n            if self.configspec is None:\n                raise ValueError('No configspec supplied.')\n            if preserve_errors:\n                # We do this once to remove a top level dependency on the validate module\n                # Which makes importing configobj faster\n                from .validate import VdtMissingValue\n                self._vdtMissingValue = VdtMissingValue\n\n            section = self\n\n            if copy:\n                section.initial_comment = section.configspec.initial_comment\n                section.final_comment = section.configspec.final_comment\n                section.encoding = section.configspec.encoding\n                section.BOM = section.configspec.BOM\n                section.newlines = section.configspec.newlines\n                section.indent_type = section.configspec.indent_type\n\n        #\n        # section.default_values.clear() #??\n        configspec = section.configspec\n        self._set_configspec(section, copy)\n\n\n        def validate_entry(entry, spec, val, missing, ret_true, ret_false):\n            section.default_values.pop(entry, None)\n\n            try:\n                section.default_values[entry] = validator.get_default_value(configspec[entry])\n            except (KeyError, AttributeError, validator.baseErrorClass):\n                # No default, bad default or validator has no 'get_default_value'\n                # (e.g. SimpleVal)\n                pass\n\n            try:\n                check = validator.check(spec,\n                                        val,\n                                        missing=missing\n                                        )\n            except validator.baseErrorClass as e:\n                if not preserve_errors or isinstance(e, self._vdtMissingValue):\n                    out[entry] = False\n                else:\n                    # preserve the error\n                    out[entry] = e\n                    ret_false = False\n                ret_true = False\n            else:\n                ret_false = False\n                out[entry] = True\n                if self.stringify or missing:\n                    # if we are doing type conversion\n                    # or the value is a supplied default\n                    if not self.stringify:\n                        if isinstance(check, (list, tuple)):\n                            # preserve lists\n                            check = [self._str(item) for item in check]\n                        elif missing and check is None:\n                            # convert the None from a default to a ''\n                            check = ''\n                        else:\n                            check = self._str(check)\n                    if (check != val) or missing:\n                        section[entry] = check\n                if not copy and missing and entry not in section.defaults:\n                    section.defaults.append(entry)\n            return ret_true, ret_false\n\n        #\n        out = {}\n        ret_true = True\n        ret_false = True\n\n        unvalidated = [k for k in section.scalars if k not in configspec]\n        incorrect_sections = [k for k in configspec.sections if k in section.scalars]\n        incorrect_scalars = [k for k in configspec.scalars if k in section.sections]\n\n        for entry in configspec.scalars:\n            if entry in ('__many__', '___many___'):\n                # reserved names\n                continue\n            if (not entry in section.scalars) or (entry in section.defaults):\n                # missing entries\n                # or entries from defaults\n                missing = True\n                val = None\n                if copy and entry not in section.scalars:\n                    # copy comments\n                    section.comments[entry] = (\n                        configspec.comments.get(entry, []))\n                    section.inline_comments[entry] = (\n                        configspec.inline_comments.get(entry, ''))\n                #\n            else:\n                missing = False\n                val = section[entry]\n\n            ret_true, ret_false = validate_entry(entry, configspec[entry], val,\n                                                 missing, ret_true, ret_false)\n\n        many = None\n        if '__many__' in configspec.scalars:\n            many = configspec['__many__']\n        elif '___many___' in configspec.scalars:\n            many = configspec['___many___']\n\n        if many is not None:\n            for entry in unvalidated:\n                val = section[entry]\n                ret_true, ret_false = validate_entry(entry, many, val, False,\n                                                     ret_true, ret_false)\n            unvalidated = []\n\n        for entry in incorrect_scalars:\n            ret_true = False\n            if not preserve_errors:\n                out[entry] = False\n            else:\n                ret_false = False\n                msg = 'Value %r was provided as a section' % entry\n                out[entry] = validator.baseErrorClass(msg)\n        for entry in incorrect_sections:\n            ret_true = False\n            if not preserve_errors:\n                out[entry] = False\n            else:\n                ret_false = False\n                msg = 'Section %r was provided as a single value' % entry\n                out[entry] = validator.baseErrorClass(msg)\n\n        # Missing sections will have been created as empty ones when the\n        # configspec was read.\n        for entry in section.sections:\n            # FIXME: this means DEFAULT is not copied in copy mode\n            if section is self and entry == 'DEFAULT':\n                continue\n            if section[entry].configspec is None:\n                unvalidated.append(entry)\n                continue\n            if copy:\n                section.comments[entry] = configspec.comments.get(entry, [])\n                section.inline_comments[entry] = configspec.inline_comments.get(entry, '')\n            check = self.validate(validator, preserve_errors=preserve_errors, copy=copy, section=section[entry])\n            out[entry] = check\n            if check == False:\n                ret_true = False\n            elif check == True:\n                ret_false = False\n            else:\n                ret_true = False\n\n        section.extra_values = unvalidated\n        if preserve_errors and not section._created:\n            # If the section wasn't created (i.e. it wasn't missing)\n            # then we can't return False, we need to preserve errors\n            ret_false = False\n        #\n        if ret_false and preserve_errors and out:\n            # If we are preserving errors, but all\n            # the failures are from missing sections / values\n            # then we can return False. Otherwise there is a\n            # real failure that we need to preserve.\n            ret_false = not any(out.values())\n        if ret_true:\n            return True\n        elif ret_false:\n            return False\n        return out"},{"col":4,"comment":"null","endLoc":300,"header":"def __repr__(self)","id":12323,"name":"__repr__","nodeType":"Function","startLoc":286,"text":"def __repr__(self):\n        args = f\"'{self._name}'\"\n        args += f', value={self.value}'\n\n        if self.unit is not None:\n            args += f', unit={self.unit}'\n\n        for cons in self.constraints:\n            val = getattr(self, cons)\n            if val not in (None, False, (None, None)):\n                # Maybe non-obvious, but False is the default for the fixed and\n                # tied constraints\n                args += f', {cons}={val}'\n\n        return f\"{self.__class__.__name__}({args})\""},{"col":4,"comment":"Parameter name","endLoc":306,"header":"@property\n    def name(self)","id":12324,"name":"name","nodeType":"Function","startLoc":302,"text":"@property\n    def name(self):\n        \"\"\"Parameter name\"\"\"\n\n        return self._name"},{"col":4,"comment":"Parameter default value","endLoc":311,"header":"@property\n    def default(self)","id":12325,"name":"default","nodeType":"Function","startLoc":308,"text":"@property\n    def default(self):\n        \"\"\"Parameter default value\"\"\"\n        return self._default"},{"col":4,"comment":"The unadorned value proxied by this parameter.","endLoc":331,"header":"@property\n    def value(self)","id":12326,"name":"value","nodeType":"Function","startLoc":313,"text":"@property\n    def value(self):\n        \"\"\"The unadorned value proxied by this parameter.\"\"\"\n        if self._getter is None and self._setter is None:\n            return np.float64(self._value)\n        else:\n            # This new implementation uses the names of internal_unit\n            # in place of raw_unit used previously. The contrast between\n            # internal values and units is that between the public\n            # units that the parameter advertises to what it actually\n            # uses internally.\n            if self.internal_unit:\n                return np.float64(self._getter(self._internal_value,\n                                               self.internal_unit,\n                                               self.unit).value)\n            elif self._getter:\n                return np.float64(self._getter(self._internal_value))\n            elif self._setter:\n                return np.float64(self._internal_value)"},{"col":4,"comment":"null","endLoc":344,"header":"@value.setter\n    def value(self, value)","id":12328,"name":"value","nodeType":"Function","startLoc":333,"text":"@value.setter\n    def value(self, value):\n        if isinstance(value, Quantity):\n            raise TypeError(\"The .value property on parameters should be set\"\n                            \" to unitless values, not Quantity objects. To set\"\n                            \"a parameter to a quantity simply set the \"\n                            \"parameter directly without using .value\")\n        if self._setter is None:\n            self._value = np.array(value, dtype=np.float64)\n        else:\n            self._internal_value = np.array(self._setter(value),\n                                            dtype=np.float64)"},{"col":4,"comment":"\n        The unit attached to this parameter, if any.\n\n        On unbound parameters (i.e. parameters accessed through the\n        model class, rather than a model instance) this is the required/\n        default unit for the parameter.\n        ","endLoc":356,"header":"@property\n    def unit(self)","id":12329,"name":"unit","nodeType":"Function","startLoc":346,"text":"@property\n    def unit(self):\n        \"\"\"\n        The unit attached to this parameter, if any.\n\n        On unbound parameters (i.e. parameters accessed through the\n        model class, rather than a model instance) this is the required/\n        default unit for the parameter.\n        \"\"\"\n\n        return self._unit"},{"col":4,"comment":"null","endLoc":365,"header":"@unit.setter\n    def unit(self, unit)","id":12330,"name":"unit","nodeType":"Function","startLoc":358,"text":"@unit.setter\n    def unit(self, unit):\n        if self.unit is None:\n            raise ValueError('Cannot attach units to parameters that were '\n                             'not initially specified with units')\n        else:\n            raise ValueError('Cannot change the unit attribute directly, '\n                             'instead change the parameter to a new quantity')"},{"col":4,"comment":"null","endLoc":371,"header":"def _set_unit(self, unit, force=False)","id":12331,"name":"_set_unit","nodeType":"Function","startLoc":367,"text":"def _set_unit(self, unit, force=False):\n        if force:\n            self._unit = unit\n        else:\n            self.unit = unit"},{"col":4,"comment":"\n        Return the internal unit the parameter uses for the internal value stored\n        ","endLoc":378,"header":"@property\n    def internal_unit(self)","id":12332,"name":"internal_unit","nodeType":"Function","startLoc":373,"text":"@property\n    def internal_unit(self):\n        \"\"\"\n        Return the internal unit the parameter uses for the internal value stored\n        \"\"\"\n        return self._internal_unit"},{"col":4,"comment":"\n        Set the unit the parameter will convert the supplied value to the\n        representation used internally.\n        ","endLoc":386,"header":"@internal_unit.setter\n    def internal_unit(self, internal_unit)","id":12333,"name":"internal_unit","nodeType":"Function","startLoc":380,"text":"@internal_unit.setter\n    def internal_unit(self, internal_unit):\n        \"\"\"\n        Set the unit the parameter will convert the supplied value to the\n        representation used internally.\n        \"\"\"\n        self._internal_unit = internal_unit"},{"col":4,"comment":"\n        This parameter, as a :class:`~astropy.units.Quantity` instance.\n        ","endLoc":395,"header":"@property\n    def quantity(self)","id":12334,"name":"quantity","nodeType":"Function","startLoc":388,"text":"@property\n    def quantity(self):\n        \"\"\"\n        This parameter, as a :class:`~astropy.units.Quantity` instance.\n        \"\"\"\n        if self.unit is None:\n            return None\n        return self.value * self.unit"},{"col":4,"comment":"null","endLoc":403,"header":"@quantity.setter\n    def quantity(self, quantity)","id":12335,"name":"quantity","nodeType":"Function","startLoc":397,"text":"@quantity.setter\n    def quantity(self, quantity):\n        if not isinstance(quantity, Quantity):\n            raise TypeError(\"The .quantity attribute should be set \"\n                            \"to a Quantity object\")\n        self.value = quantity.value\n        self._unit = quantity.unit"},{"col":4,"comment":"The shape of this parameter's value array.","endLoc":410,"header":"@property\n    def shape(self)","id":12336,"name":"shape","nodeType":"Function","startLoc":405,"text":"@property\n    def shape(self):\n        \"\"\"The shape of this parameter's value array.\"\"\"\n        if self._setter is None:\n            return self._value.shape\n        return self._internal_value.shape"},{"col":4,"comment":"null","endLoc":418,"header":"@shape.setter\n    def shape(self, value)","id":12337,"name":"shape","nodeType":"Function","startLoc":412,"text":"@shape.setter\n    def shape(self, value):\n        if isinstance(self.value, np.generic):\n            if value not in ((), (1,)):\n                raise ValueError(\"Cannot assign this shape to a scalar quantity\")\n        else:\n            self.value.shape = value"},{"col":4,"comment":"The size of this parameter's value array.","endLoc":424,"header":"@property\n    def size(self)","id":12338,"name":"size","nodeType":"Function","startLoc":420,"text":"@property\n    def size(self):\n        \"\"\"The size of this parameter's value array.\"\"\"\n\n        return np.size(self.value)"},{"col":4,"comment":"Standard deviation, if available from fit.","endLoc":430,"header":"@property\n    def std(self)","id":12339,"name":"std","nodeType":"Function","startLoc":426,"text":"@property\n    def std(self):\n        \"\"\"Standard deviation, if available from fit.\"\"\"\n\n        return self._std"},{"col":4,"comment":"null","endLoc":435,"header":"@std.setter\n    def std(self, value)","id":12340,"name":"std","nodeType":"Function","startLoc":432,"text":"@std.setter\n    def std(self, value):\n\n        self._std = value"},{"col":4,"comment":"null","endLoc":439,"header":"@property\n    def prior(self)","id":12341,"name":"prior","nodeType":"Function","startLoc":437,"text":"@property\n    def prior(self):\n        return self._prior"},{"col":4,"comment":"null","endLoc":443,"header":"@prior.setter\n    def prior(self, val)","id":12342,"name":"prior","nodeType":"Function","startLoc":441,"text":"@prior.setter\n    def prior(self, val):\n        self._prior = val"},{"col":4,"comment":"null","endLoc":447,"header":"@property\n    def posterior(self)","id":12343,"name":"posterior","nodeType":"Function","startLoc":445,"text":"@property\n    def posterior(self):\n        return self._posterior"},{"col":4,"comment":"null","endLoc":451,"header":"@posterior.setter\n    def posterior(self, val)","id":12344,"name":"posterior","nodeType":"Function","startLoc":449,"text":"@posterior.setter\n    def posterior(self, val):\n        self._posterior = val"},{"col":4,"comment":"\n        Boolean indicating if the parameter is kept fixed during fitting.\n        ","endLoc":458,"header":"@property\n    def fixed(self)","id":12345,"name":"fixed","nodeType":"Function","startLoc":453,"text":"@property\n    def fixed(self):\n        \"\"\"\n        Boolean indicating if the parameter is kept fixed during fitting.\n        \"\"\"\n        return self._fixed"},{"col":4,"comment":" Fix a parameter. ","endLoc":465,"header":"@fixed.setter\n    def fixed(self, value)","id":12346,"name":"fixed","nodeType":"Function","startLoc":460,"text":"@fixed.setter\n    def fixed(self, value):\n        \"\"\" Fix a parameter. \"\"\"\n        if not isinstance(value, bool):\n            raise ValueError(\"Value must be boolean\")\n        self._fixed = value"},{"col":4,"comment":"\n        Indicates that this parameter is linked to another one.\n\n        A callable which provides the relationship of the two parameters.\n        ","endLoc":475,"header":"@property\n    def tied(self)","id":12347,"name":"tied","nodeType":"Function","startLoc":467,"text":"@property\n    def tied(self):\n        \"\"\"\n        Indicates that this parameter is linked to another one.\n\n        A callable which provides the relationship of the two parameters.\n        \"\"\"\n\n        return self._tied"},{"col":4,"comment":"Tie a parameter","endLoc":483,"header":"@tied.setter\n    def tied(self, value)","id":12348,"name":"tied","nodeType":"Function","startLoc":477,"text":"@tied.setter\n    def tied(self, value):\n        \"\"\"Tie a parameter\"\"\"\n\n        if not callable(value) and value not in (False, None):\n            raise TypeError(\"Tied must be a callable or set to False or None\")\n        self._tied = value"},{"col":4,"comment":"The minimum and maximum values of a parameter as a tuple","endLoc":489,"header":"@property\n    def bounds(self)","id":12349,"name":"bounds","nodeType":"Function","startLoc":485,"text":"@property\n    def bounds(self):\n        \"\"\"The minimum and maximum values of a parameter as a tuple\"\"\"\n\n        return self._bounds"},{"col":4,"comment":"Set the minimum and maximum values of a parameter from a tuple","endLoc":512,"header":"@bounds.setter\n    def bounds(self, value)","id":12350,"name":"bounds","nodeType":"Function","startLoc":491,"text":"@bounds.setter\n    def bounds(self, value):\n        \"\"\"Set the minimum and maximum values of a parameter from a tuple\"\"\"\n\n        _min, _max = value\n        if _min is not None:\n            if not isinstance(_min, (numbers.Number, Quantity)):\n                raise TypeError(\"Min value must be a number or a Quantity\")\n            if isinstance(_min, Quantity):\n                _min = float(_min.value)\n            else:\n                _min = float(_min)\n\n        if _max is not None:\n            if not isinstance(_max, (numbers.Number, Quantity)):\n                raise TypeError(\"Max value must be a number or a Quantity\")\n            if isinstance(_max, Quantity):\n                _max = float(_max.value)\n            else:\n                _max = float(_max)\n\n        self._bounds = (_min, _max)"},{"col":4,"comment":"A value used as a lower bound when fitting a parameter","endLoc":518,"header":"@property\n    def min(self)","id":12351,"name":"min","nodeType":"Function","startLoc":514,"text":"@property\n    def min(self):\n        \"\"\"A value used as a lower bound when fitting a parameter\"\"\"\n\n        return self.bounds[0]"},{"col":4,"comment":"Set a minimum value of a parameter","endLoc":524,"header":"@min.setter\n    def min(self, value)","id":12352,"name":"min","nodeType":"Function","startLoc":520,"text":"@min.setter\n    def min(self, value):\n        \"\"\"Set a minimum value of a parameter\"\"\"\n\n        self.bounds = (value, self.max)"},{"col":4,"comment":"A value used as an upper bound when fitting a parameter","endLoc":530,"header":"@property\n    def max(self)","id":12353,"name":"max","nodeType":"Function","startLoc":526,"text":"@property\n    def max(self):\n        \"\"\"A value used as an upper bound when fitting a parameter\"\"\"\n\n        return self.bounds[1]"},{"col":4,"comment":"Set a maximum value of a parameter.","endLoc":536,"header":"@max.setter\n    def max(self, value)","id":12354,"name":"max","nodeType":"Function","startLoc":532,"text":"@max.setter\n    def max(self, value):\n        \"\"\"Set a maximum value of a parameter.\"\"\"\n\n        self.bounds = (self.min, value)"},{"col":4,"comment":"\n        Used as a decorator to set the validator method for a `Parameter`.\n        The validator method validates any value set for that parameter.\n        It takes two arguments--``self``, which refers to the `Model`\n        instance (remember, this is a method defined on a `Model`), and\n        the value being set for this parameter.  The validator method's\n        return value is ignored, but it may raise an exception if the value\n        set on the parameter is invalid (typically an `InputParameterError`\n        should be raised, though this is not currently a requirement).\n\n        ","endLoc":560,"header":"@property\n    def validator(self)","id":12355,"name":"validator","nodeType":"Function","startLoc":538,"text":"@property\n    def validator(self):\n        \"\"\"\n        Used as a decorator to set the validator method for a `Parameter`.\n        The validator method validates any value set for that parameter.\n        It takes two arguments--``self``, which refers to the `Model`\n        instance (remember, this is a method defined on a `Model`), and\n        the value being set for this parameter.  The validator method's\n        return value is ignored, but it may raise an exception if the value\n        set on the parameter is invalid (typically an `InputParameterError`\n        should be raised, though this is not currently a requirement).\n\n        \"\"\"\n\n        def validator(func, self=self):\n            if callable(func):\n                self._validator = func\n                return self\n            else:\n                raise ValueError(\"This decorator method expects a callable.\\n\"\n                                 \"The use of this method as a direct validator is\\n\"\n                                 \"deprecated; use the new validate method instead\\n\")\n        return validator"},{"col":4,"comment":" Run the validator on this parameter","endLoc":565,"header":"def validate(self, value)","id":12356,"name":"validate","nodeType":"Function","startLoc":562,"text":"def validate(self, value):\n        \"\"\" Run the validator on this parameter\"\"\"\n        if self._validator is not None and self._model is not None:\n            self._validator(self._model, value)"},{"col":4,"comment":"\n        Make a copy of this `Parameter`, overriding any of its core attributes\n        in the process (or an exact copy).\n\n        The arguments to this method are the same as those for the `Parameter`\n        initializer.  This simply returns a new `Parameter` instance with any\n        or all of the attributes overridden, and so returns the equivalent of:\n\n        .. code:: python\n\n            Parameter(self.name, self.description, ...)\n\n        ","endLoc":600,"header":"def copy(self, name=None, description=None, default=None, unit=None,\n             getter=None, setter=None, fixed=False, tied=False, min=None,\n             max=None, bounds=None, prior=None, posterior=None)","id":12357,"name":"copy","nodeType":"Function","startLoc":567,"text":"def copy(self, name=None, description=None, default=None, unit=None,\n             getter=None, setter=None, fixed=False, tied=False, min=None,\n             max=None, bounds=None, prior=None, posterior=None):\n        \"\"\"\n        Make a copy of this `Parameter`, overriding any of its core attributes\n        in the process (or an exact copy).\n\n        The arguments to this method are the same as those for the `Parameter`\n        initializer.  This simply returns a new `Parameter` instance with any\n        or all of the attributes overridden, and so returns the equivalent of:\n\n        .. code:: python\n\n            Parameter(self.name, self.description, ...)\n\n        \"\"\"\n\n        kwargs = locals().copy()\n        del kwargs['self']\n\n        for key, value in kwargs.items():\n            if value is None:\n                # Annoying special cases for min/max where are just aliases for\n                # the components of bounds\n                if key in ('min', 'max'):\n                    continue\n                else:\n                    if hasattr(self, key):\n                        value = getattr(self, key)\n                    elif hasattr(self, '_' + key):\n                        value = getattr(self, '_' + key)\n                kwargs[key] = value\n\n        return self.__class__(**kwargs)"},{"col":4,"comment":" Return the model this  parameter is associated with.","endLoc":605,"header":"@property\n    def model(self)","id":12358,"name":"model","nodeType":"Function","startLoc":602,"text":"@property\n    def model(self):\n        \"\"\" Return the model this  parameter is associated with.\"\"\"\n        return self._model"},{"col":4,"comment":"null","endLoc":616,"header":"@model.setter\n    def model(self, value)","id":12359,"name":"model","nodeType":"Function","startLoc":607,"text":"@model.setter\n    def model(self, value):\n        self._model = value\n        self._setter = self._create_value_wrapper(self._setter, value)\n        self._getter = self._create_value_wrapper(self._getter, value)\n        if self._model_required:\n            if self._default is not None:\n                self.value = self._default\n            else:\n                self._value = None"},{"col":4,"comment":"\n        Get a tuple of selector argument tuples using input names\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n        ","endLoc":1264,"header":"def named_tuple(self, model)","id":12360,"name":"named_tuple","nodeType":"Function","startLoc":1255,"text":"def named_tuple(self, model):\n        \"\"\"\n        Get a tuple of selector argument tuples using input names\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.Model`\n            The Model these selector arguments are for.\n        \"\"\"\n        return tuple([selector_arg.named_tuple(model) for selector_arg in self])"},{"attributeType":"None","col":4,"comment":"null","endLoc":1065,"id":12361,"name":"_kept_ignore","nodeType":"Attribute","startLoc":1065,"text":"_kept_ignore"},{"attributeType":"None","col":12,"comment":"null","endLoc":1073,"id":12362,"name":"_kept_ignore","nodeType":"Attribute","startLoc":1073,"text":"self._kept_ignore"},{"col":0,"comment":"\n    Function corresponding to '&' operation.\n\n    Parameters\n    ----------\n    left, right : `astropy.modeling.Model` or ndarray\n        If input is of an array, it is the output of `coord_matrix`.\n\n    Returns\n    -------\n    result : ndarray\n        Result from this operation.\n\n    ","endLoc":247,"header":"def _cstack(left, right)","id":12363,"name":"_cstack","nodeType":"Function","startLoc":219,"text":"def _cstack(left, right):\n    \"\"\"\n    Function corresponding to '&' operation.\n\n    Parameters\n    ----------\n    left, right : `astropy.modeling.Model` or ndarray\n        If input is of an array, it is the output of `coord_matrix`.\n\n    Returns\n    -------\n    result : ndarray\n        Result from this operation.\n\n    \"\"\"\n    noutp = _compute_n_outputs(left, right)\n\n    if isinstance(left, Model):\n        cleft = _coord_matrix(left, 'left', noutp)\n    else:\n        cleft = np.zeros((noutp, left.shape[1]))\n        cleft[: left.shape[0], : left.shape[1]] = left\n    if isinstance(right, Model):\n        cright = _coord_matrix(right, 'right', noutp)\n    else:\n        cright = np.zeros((noutp, right.shape[1]))\n        cright[-right.shape[0]:, -right.shape[1]:] = 1\n\n    return np.hstack([cleft, cright])"},{"attributeType":"null","col":8,"comment":"null","endLoc":1068,"id":12364,"name":"self","nodeType":"Attribute","startLoc":1068,"text":"self"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":12365,"name":"__all__","nodeType":"Attribute","startLoc":21,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":12366,"name":"_BaseInterval","nodeType":"Attribute","startLoc":24,"text":"_BaseInterval"},{"attributeType":"_Interval","col":0,"comment":"null","endLoc":133,"id":12367,"name":"_ignored_interval","nodeType":"Attribute","startLoc":133,"text":"_ignored_interval"},{"col":0,"comment":"\n    Function corresponding to \"|\" operation.\n\n    Parameters\n    ----------\n    left, right : `astropy.modeling.Model` or ndarray\n        If input is of an array, it is the output of `coord_matrix`.\n\n    Returns\n    -------\n    result : ndarray\n        Result from this operation.\n    ","endLoc":287,"header":"def _cdot(left, right)","id":12368,"name":"_cdot","nodeType":"Function","startLoc":250,"text":"def _cdot(left, right):\n    \"\"\"\n    Function corresponding to \"|\" operation.\n\n    Parameters\n    ----------\n    left, right : `astropy.modeling.Model` or ndarray\n        If input is of an array, it is the output of `coord_matrix`.\n\n    Returns\n    -------\n    result : ndarray\n        Result from this operation.\n    \"\"\"\n\n    left, right = right, left\n\n    def _n_inputs_outputs(input, position):\n        \"\"\"\n        Return ``n_inputs``, ``n_outputs`` for a model or coord_matrix.\n        \"\"\"\n        if isinstance(input, Model):\n            coords = _coord_matrix(input, position, input.n_outputs)\n        else:\n            coords = input\n        return coords\n\n    cleft = _n_inputs_outputs(left, 'left')\n    cright = _n_inputs_outputs(right, 'right')\n\n    try:\n        result = np.dot(cleft, cright)\n    except ValueError:\n        raise ModelDefinitionError(\n            'Models cannot be combined with the \"|\" operator; '\n            'left coord_matrix is {}, right coord_matrix is {}'.format(\n                cright, cleft))\n    return result"},{"attributeType":"null","col":4,"comment":"null","endLoc":108,"id":12369,"name":"supported_constraints","nodeType":"Attribute","startLoc":108,"text":"supported_constraints"},{"attributeType":"null","col":8,"comment":"null","endLoc":113,"id":12370,"name":"fit_info","nodeType":"Attribute","startLoc":113,"text":"self.fit_info"},{"className":"Simplex","col":0,"comment":"\n    Neald-Mead (downhill simplex) algorithm.\n\n    This algorithm [1]_ only uses function values, not derivatives.\n    Uses `scipy.optimize.fmin`.\n\n    References\n    ----------\n    .. [1] Nelder, J.A. and Mead, R. (1965), \"A simplex method for function\n       minimization\", The Computer Journal, 7, pp. 308-313\n    ","endLoc":244,"id":12372,"nodeType":"Class","startLoc":177,"text":"class Simplex(Optimization):\n    \"\"\"\n    Neald-Mead (downhill simplex) algorithm.\n\n    This algorithm [1]_ only uses function values, not derivatives.\n    Uses `scipy.optimize.fmin`.\n\n    References\n    ----------\n    .. [1] Nelder, J.A. and Mead, R. (1965), \"A simplex method for function\n       minimization\", The Computer Journal, 7, pp. 308-313\n    \"\"\"\n\n    supported_constraints = ['bounds', 'fixed', 'tied']\n\n    def __init__(self):\n        from scipy.optimize import fmin as simplex\n        super().__init__(simplex)\n        self.fit_info = {\n            'final_func_val': None,\n            'numiter': None,\n            'exit_mode': None,\n            'num_function_calls': None\n        }\n\n    def __call__(self, objfunc, initval, fargs, **kwargs):\n        \"\"\"\n        Run the solver.\n\n        Parameters\n        ----------\n        objfunc : callable\n            objection function\n        initval : iterable\n            initial guess for the parameter values\n        fargs : tuple\n            other arguments to be passed to the statistic function\n        kwargs : dict\n            other keyword arguments to be passed to the solver\n\n        \"\"\"\n        if 'maxiter' not in kwargs:\n            kwargs['maxiter'] = self._maxiter\n        if 'acc' in kwargs:\n            self._acc = kwargs['acc']\n            kwargs.pop('acc')\n        if 'xtol' in kwargs:\n            self._acc = kwargs['xtol']\n            kwargs.pop('xtol')\n        # Get the verbosity level\n        disp = kwargs.pop('verblevel', None)\n\n        fitparams, final_func_val, numiter, funcalls, exit_mode = self.opt_method(\n            objfunc, initval, args=fargs, xtol=self._acc, disp=disp,\n            full_output=True, **kwargs)\n        self.fit_info['final_func_val'] = final_func_val\n        self.fit_info['numiter'] = numiter\n        self.fit_info['exit_mode'] = exit_mode\n        self.fit_info['num_function_calls'] = funcalls\n        if self.fit_info['exit_mode'] == 1:\n            warnings.warn(\"The fit may be unsuccessful; \"\n                          \"Maximum number of function evaluations reached.\",\n                          AstropyUserWarning)\n        if self.fit_info['exit_mode'] == 2:\n            warnings.warn(\"The fit may be unsuccessful; \"\n                          \"Maximum number of iterations reached.\",\n                          AstropyUserWarning)\n        return fitparams, self.fit_info"},{"col":4,"comment":"null","endLoc":200,"header":"def __init__(self)","id":12373,"name":"__init__","nodeType":"Function","startLoc":192,"text":"def __init__(self):\n        from scipy.optimize import fmin as simplex\n        super().__init__(simplex)\n        self.fit_info = {\n            'final_func_val': None,\n            'numiter': None,\n            'exit_mode': None,\n            'num_function_calls': None\n        }"},{"col":4,"comment":"\n        Run the solver.\n\n        Parameters\n        ----------\n        objfunc : callable\n            objection function\n        initval : iterable\n            initial guess for the parameter values\n        fargs : tuple\n            other arguments to be passed to the statistic function\n        kwargs : dict\n            other keyword arguments to be passed to the solver\n\n        ","endLoc":244,"header":"def __call__(self, objfunc, initval, fargs, **kwargs)","id":12374,"name":"__call__","nodeType":"Function","startLoc":202,"text":"def __call__(self, objfunc, initval, fargs, **kwargs):\n        \"\"\"\n        Run the solver.\n\n        Parameters\n        ----------\n        objfunc : callable\n            objection function\n        initval : iterable\n            initial guess for the parameter values\n        fargs : tuple\n            other arguments to be passed to the statistic function\n        kwargs : dict\n            other keyword arguments to be passed to the solver\n\n        \"\"\"\n        if 'maxiter' not in kwargs:\n            kwargs['maxiter'] = self._maxiter\n        if 'acc' in kwargs:\n            self._acc = kwargs['acc']\n            kwargs.pop('acc')\n        if 'xtol' in kwargs:\n            self._acc = kwargs['xtol']\n            kwargs.pop('xtol')\n        # Get the verbosity level\n        disp = kwargs.pop('verblevel', None)\n\n        fitparams, final_func_val, numiter, funcalls, exit_mode = self.opt_method(\n            objfunc, initval, args=fargs, xtol=self._acc, disp=disp,\n            full_output=True, **kwargs)\n        self.fit_info['final_func_val'] = final_func_val\n        self.fit_info['numiter'] = numiter\n        self.fit_info['exit_mode'] = exit_mode\n        self.fit_info['num_function_calls'] = funcalls\n        if self.fit_info['exit_mode'] == 1:\n            warnings.warn(\"The fit may be unsuccessful; \"\n                          \"Maximum number of function evaluations reached.\",\n                          AstropyUserWarning)\n        if self.fit_info['exit_mode'] == 2:\n            warnings.warn(\"The fit may be unsuccessful; \"\n                          \"Maximum number of iterations reached.\",\n                          AstropyUserWarning)\n        return fitparams, self.fit_info"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":12375,"name":"__all__","nodeType":"Attribute","startLoc":24,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":316,"id":12376,"name":"_operators","nodeType":"Attribute","startLoc":316,"text":"_operators"},{"col":0,"comment":"","endLoc":16,"header":"separable.py#<anonymous>","id":12377,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nFunctions to determine if a model is separable, i.e.\nif the model outputs are independent.\n\nIt analyzes ``n_inputs``, ``n_outputs`` and the operators\nin a compound model by stepping through the transforms\nand creating a ``coord_matrix`` of shape (``n_outputs``, ``n_inputs``).\n\n\nEach modeling operator is represented by a function which\ntakes two simple models (or two ``coord_matrix`` arrays) and\nreturns an array of shape (``n_outputs``, ``n_inputs``).\n\n\"\"\"\n\n__all__ = [\"is_separable\", \"separability_matrix\"]\n\n_operators = {'&': _cstack, '|': _cdot, '+': _arith_oper, '-': _arith_oper,\n              '*': _arith_oper, '/': _arith_oper, '**': _arith_oper}"},{"fileName":"core.py","filePath":"astropy/modeling","id":12378,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module defines base classes for all models.  The base class of all\nmodels is `~astropy.modeling.Model`. `~astropy.modeling.FittableModel` is\nthe base class for all fittable models. Fittable models can be linear or\nnonlinear in a regression analysis sense.\n\nAll models provide a `__call__` method which performs the transformation in\na purely mathematical way, i.e. the models are unitless.  Model instances can\nrepresent either a single model, or a \"model set\" representing multiple copies\nof the same type of model, but with potentially different values of the\nparameters in each model making up the set.\n\"\"\"\n# pylint: disable=invalid-name, protected-access, redefined-outer-name\nimport abc\nimport copy\nimport inspect\nimport itertools\nimport functools\nimport operator\nimport types\n\nfrom collections import defaultdict, deque\nfrom inspect import signature\nfrom itertools import chain\n\nimport numpy as np\n\nfrom astropy.utils import indent, metadata\nfrom astropy.table import Table\nfrom astropy.units import Quantity, UnitsError, dimensionless_unscaled\nfrom astropy.units.utils import quantity_asanyarray\nfrom astropy.utils import (sharedmethod, find_current_module,\n                           check_broadcast, IncompatibleShapeError, isiterable)\nfrom astropy.utils.codegen import make_function_with_signature\nfrom astropy.nddata.utils import add_array, extract_array\nfrom .utils import (combine_labels, make_binary_operator_eval,\n                    get_inputs_and_params, _combine_equivalency_dict,\n                    _ConstraintsDict, _SpecialOperatorsDict)\nfrom .bounding_box import ModelBoundingBox, CompoundBoundingBox\nfrom .parameters import (Parameter, InputParameterError,\n                         param_repr_oneline, _tofloat)\n\n\n__all__ = ['Model', 'FittableModel', 'Fittable1DModel', 'Fittable2DModel',\n           'CompoundModel', 'fix_inputs', 'custom_model', 'ModelDefinitionError',\n           'bind_bounding_box', 'bind_compound_bounding_box']\n\n\ndef _model_oper(oper, **kwargs):\n    \"\"\"\n    Returns a function that evaluates a given Python arithmetic operator\n    between two models.  The operator should be given as a string, like ``'+'``\n    or ``'**'``.\n    \"\"\"\n    return lambda left, right: CompoundModel(oper, left, right, **kwargs)\n\n\nclass ModelDefinitionError(TypeError):\n    \"\"\"Used for incorrect models definitions.\"\"\"\n\n\nclass _ModelMeta(abc.ABCMeta):\n    \"\"\"\n    Metaclass for Model.\n\n    Currently just handles auto-generating the param_names list based on\n    Parameter descriptors declared at the class-level of Model subclasses.\n    \"\"\"\n\n    _is_dynamic = False\n    \"\"\"\n    This flag signifies whether this class was created in the \"normal\" way,\n    with a class statement in the body of a module, as opposed to a call to\n    `type` or some other metaclass constructor, such that the resulting class\n    does not belong to a specific module.  This is important for pickling of\n    dynamic classes.\n\n    This flag is always forced to False for new classes, so code that creates\n    dynamic classes should manually set it to True on those classes when\n    creating them.\n    \"\"\"\n\n    # Default empty dict for _parameters_, which will be empty on model\n    # classes that don't have any Parameters\n\n    def __new__(mcls, name, bases, members, **kwds):\n        # See the docstring for _is_dynamic above\n        if '_is_dynamic' not in members:\n            members['_is_dynamic'] = mcls._is_dynamic\n        opermethods = [\n            ('__add__', _model_oper('+')),\n            ('__sub__', _model_oper('-')),\n            ('__mul__', _model_oper('*')),\n            ('__truediv__', _model_oper('/')),\n            ('__pow__', _model_oper('**')),\n            ('__or__', _model_oper('|')),\n            ('__and__', _model_oper('&')),\n            ('_fix_inputs', _model_oper('fix_inputs'))\n        ]\n\n        members['_parameters_'] = {k: v for k, v in members.items()\n                                   if isinstance(v, Parameter)}\n\n        for opermethod, opercall in opermethods:\n            members[opermethod] = opercall\n        cls = super().__new__(mcls, name, bases, members, **kwds)\n\n        param_names = list(members['_parameters_'])\n\n        # Need to walk each base MRO to collect all parameter names\n        for base in bases:\n            for tbase in base.__mro__:\n                if issubclass(tbase, Model):\n                    # Preserve order of definitions\n                    param_names = list(tbase._parameters_) + param_names\n        # Remove duplicates (arising from redefinition in subclass).\n        param_names = list(dict.fromkeys(param_names))\n        if cls._parameters_:\n            if hasattr(cls, '_param_names'):\n                # Slight kludge to support compound models, where\n                # cls.param_names is a property; could be improved with a\n                # little refactoring but fine for now\n                cls._param_names = tuple(param_names)\n            else:\n                cls.param_names = tuple(param_names)\n\n        return cls\n\n    def __init__(cls, name, bases, members, **kwds):\n        super(_ModelMeta, cls).__init__(name, bases, members, **kwds)\n        cls._create_inverse_property(members)\n        cls._create_bounding_box_property(members)\n        pdict = {}\n        for base in bases:\n            for tbase in base.__mro__:\n                if issubclass(tbase, Model):\n                    for parname, val in cls._parameters_.items():\n                        pdict[parname] = val\n        cls._handle_special_methods(members, pdict)\n\n    def __repr__(cls):\n        \"\"\"\n        Custom repr for Model subclasses.\n        \"\"\"\n\n        return cls._format_cls_repr()\n\n    def _repr_pretty_(cls, p, cycle):\n        \"\"\"\n        Repr for IPython's pretty printer.\n\n        By default IPython \"pretty prints\" classes, so we need to implement\n        this so that IPython displays the custom repr for Models.\n        \"\"\"\n\n        p.text(repr(cls))\n\n    def __reduce__(cls):\n        if not cls._is_dynamic:\n            # Just return a string specifying where the class can be imported\n            # from\n            return cls.__name__\n        members = dict(cls.__dict__)\n        # Delete any ABC-related attributes--these will be restored when\n        # the class is reconstructed:\n        for key in list(members):\n            if key.startswith('_abc_'):\n                del members[key]\n\n        # Delete custom __init__ and __call__ if they exist:\n        for key in ('__init__', '__call__'):\n            if key in members:\n                del members[key]\n\n        return (type(cls), (cls.__name__, cls.__bases__, members))\n\n    @property\n    def name(cls):\n        \"\"\"\n        The name of this model class--equivalent to ``cls.__name__``.\n\n        This attribute is provided for symmetry with the `Model.name` attribute\n        of model instances.\n        \"\"\"\n\n        return cls.__name__\n\n    @property\n    def _is_concrete(cls):\n        \"\"\"\n        A class-level property that determines whether the class is a concrete\n        implementation of a Model--i.e. it is not some abstract base class or\n        internal implementation detail (i.e. begins with '_').\n        \"\"\"\n        return not (cls.__name__.startswith('_') or inspect.isabstract(cls))\n\n    def rename(cls, name=None, inputs=None, outputs=None):\n        \"\"\"\n        Creates a copy of this model class with a new name, inputs or outputs.\n\n        The new class is technically a subclass of the original class, so that\n        instance and type checks will still work.  For example::\n\n            >>> from astropy.modeling.models import Rotation2D\n            >>> SkyRotation = Rotation2D.rename('SkyRotation')\n            >>> SkyRotation\n            <class 'astropy.modeling.core.SkyRotation'>\n            Name: SkyRotation (Rotation2D)\n            N_inputs: 2\n            N_outputs: 2\n            Fittable parameters: ('angle',)\n            >>> issubclass(SkyRotation, Rotation2D)\n            True\n            >>> r = SkyRotation(90)\n            >>> isinstance(r, Rotation2D)\n            True\n        \"\"\"\n\n        mod = find_current_module(2)\n        if mod:\n            modname = mod.__name__\n        else:\n            modname = '__main__'\n\n        if name is None:\n            name = cls.name\n        if inputs is None:\n            inputs = cls.inputs\n        else:\n            if not isinstance(inputs, tuple):\n                raise TypeError(\"Expected 'inputs' to be a tuple of strings.\")\n            elif len(inputs) != len(cls.inputs):\n                raise ValueError(f'{cls.name} expects {len(cls.inputs)} inputs')\n        if outputs is None:\n            outputs = cls.outputs\n        else:\n            if not isinstance(outputs, tuple):\n                raise TypeError(\"Expected 'outputs' to be a tuple of strings.\")\n            elif len(outputs) != len(cls.outputs):\n                raise ValueError(f'{cls.name} expects {len(cls.outputs)} outputs')\n        new_cls = type(name, (cls,), {\"inputs\": inputs, \"outputs\": outputs})\n        new_cls.__module__ = modname\n        new_cls.__qualname__ = name\n\n        return new_cls\n\n    def _create_inverse_property(cls, members):\n        inverse = members.get('inverse')\n        if inverse is None or cls.__bases__[0] is object:\n            # The latter clause is the prevent the below code from running on\n            # the Model base class, which implements the default getter and\n            # setter for .inverse\n            return\n\n        if isinstance(inverse, property):\n            # We allow the @property decorator to be omitted entirely from\n            # the class definition, though its use should be encouraged for\n            # clarity\n            inverse = inverse.fget\n\n        # Store the inverse getter internally, then delete the given .inverse\n        # attribute so that cls.inverse resolves to Model.inverse instead\n        cls._inverse = inverse\n        del cls.inverse\n\n    def _create_bounding_box_property(cls, members):\n        \"\"\"\n        Takes any bounding_box defined on a concrete Model subclass (either\n        as a fixed tuple or a property or method) and wraps it in the generic\n        getter/setter interface for the bounding_box attribute.\n        \"\"\"\n\n        # TODO: Much of this is verbatim from _create_inverse_property--I feel\n        # like there could be a way to generify properties that work this way,\n        # but for the time being that would probably only confuse things more.\n        bounding_box = members.get('bounding_box')\n        if bounding_box is None or cls.__bases__[0] is object:\n            return\n\n        if isinstance(bounding_box, property):\n            bounding_box = bounding_box.fget\n\n        if not callable(bounding_box):\n            # See if it's a hard-coded bounding_box (as a sequence) and\n            # normalize it\n            try:\n                bounding_box = ModelBoundingBox.validate(cls, bounding_box, _preserve_ignore=True)\n            except ValueError as exc:\n                raise ModelDefinitionError(exc.args[0])\n        else:\n            sig = signature(bounding_box)\n            # May be a method that only takes 'self' as an argument (like a\n            # property, but the @property decorator was forgotten)\n            #\n            # However, if the method takes additional arguments then this is a\n            # parameterized bounding box and should be callable\n            if len(sig.parameters) > 1:\n                bounding_box = \\\n                        cls._create_bounding_box_subclass(bounding_box, sig)\n\n        # See the Model.bounding_box getter definition for how this attribute\n        # is used\n        cls._bounding_box = bounding_box\n        del cls.bounding_box\n\n    def _create_bounding_box_subclass(cls, func, sig):\n        \"\"\"\n        For Models that take optional arguments for defining their bounding\n        box, we create a subclass of ModelBoundingBox with a ``__call__`` method\n        that supports those additional arguments.\n\n        Takes the function's Signature as an argument since that is already\n        computed in _create_bounding_box_property, so no need to duplicate that\n        effort.\n        \"\"\"\n\n        # TODO: Might be convenient if calling the bounding box also\n        # automatically sets the _user_bounding_box.  So that\n        #\n        #    >>> model.bounding_box(arg=1)\n        #\n        # in addition to returning the computed bbox, also sets it, so that\n        # it's a shortcut for\n        #\n        #    >>> model.bounding_box = model.bounding_box(arg=1)\n        #\n        # Not sure if that would be non-obvious / confusing though...\n\n        def __call__(self, **kwargs):\n            return func(self._model, **kwargs)\n\n        kwargs = []\n        for idx, param in enumerate(sig.parameters.values()):\n            if idx == 0:\n                # Presumed to be a 'self' argument\n                continue\n\n            if param.default is param.empty:\n                raise ModelDefinitionError(\n                    'The bounding_box method for {0} is not correctly '\n                    'defined: If defined as a method all arguments to that '\n                    'method (besides self) must be keyword arguments with '\n                    'default values that can be used to compute a default '\n                    'bounding box.'.format(cls.name))\n\n            kwargs.append((param.name, param.default))\n\n        __call__.__signature__ = sig\n\n        return type(f'{cls.name}ModelBoundingBox', (ModelBoundingBox,),\n                    {'__call__': __call__})\n\n    def _handle_special_methods(cls, members, pdict):\n\n        # Handle init creation from inputs\n        def update_wrapper(wrapper, cls):\n            # Set up the new __call__'s metadata attributes as though it were\n            # manually defined in the class definition\n            # A bit like functools.update_wrapper but uses the class instead of\n            # the wrapped function\n            wrapper.__module__ = cls.__module__\n            wrapper.__doc__ = getattr(cls, wrapper.__name__).__doc__\n            if hasattr(cls, '__qualname__'):\n                wrapper.__qualname__ = f'{cls.__qualname__}.{wrapper.__name__}'\n\n        if ('__call__' not in members and 'n_inputs' in members and\n                isinstance(members['n_inputs'], int) and members['n_inputs'] > 0):\n\n            # Don't create a custom __call__ for classes that already have one\n            # explicitly defined (this includes the Model base class, and any\n            # other classes that manually override __call__\n\n            def __call__(self, *inputs, **kwargs):\n                \"\"\"Evaluate this model on the supplied inputs.\"\"\"\n                return super(cls, self).__call__(*inputs, **kwargs)\n\n            # When called, models can take two optional keyword arguments:\n            #\n            # * model_set_axis, which indicates (for multi-dimensional input)\n            #   which axis is used to indicate different models\n            #\n            # * equivalencies, a dictionary of equivalencies to be applied to\n            #   the input values, where each key should correspond to one of\n            #   the inputs.\n            #\n            # The following code creates the __call__ function with these\n            # two keyword arguments.\n\n            args = ('self',)\n            kwargs = dict([('model_set_axis', None),\n                           ('with_bounding_box', False),\n                           ('fill_value', np.nan),\n                           ('equivalencies', None),\n                           ('inputs_map', None)])\n\n            new_call = make_function_with_signature(\n                __call__, args, kwargs, varargs='inputs', varkwargs='new_inputs')\n\n            # The following makes it look like __call__\n            # was defined in the class\n            update_wrapper(new_call, cls)\n\n            cls.__call__ = new_call\n\n        if ('__init__' not in members and not inspect.isabstract(cls) and\n                cls._parameters_):\n            # Build list of all parameters including inherited ones\n\n            # If *all* the parameters have default values we can make them\n            # keyword arguments; otherwise they must all be positional\n            # arguments\n            if all(p.default is not None for p in pdict.values()):\n                args = ('self',)\n                kwargs = []\n                for param_name, param_val in pdict.items():\n                    default = param_val.default\n                    unit = param_val.unit\n                    # If the unit was specified in the parameter but the\n                    # default is not a Quantity, attach the unit to the\n                    # default.\n                    if unit is not None:\n                        default = Quantity(default, unit, copy=False)\n                    kwargs.append((param_name, default))\n            else:\n                args = ('self',) + tuple(pdict.keys())\n                kwargs = {}\n\n            def __init__(self, *params, **kwargs):\n                return super(cls, self).__init__(*params, **kwargs)\n\n            new_init = make_function_with_signature(\n                __init__, args, kwargs, varkwargs='kwargs')\n            update_wrapper(new_init, cls)\n            cls.__init__ = new_init\n\n    # *** Arithmetic operators for creating compound models ***\n    __add__ = _model_oper('+')\n    __sub__ = _model_oper('-')\n    __mul__ = _model_oper('*')\n    __truediv__ = _model_oper('/')\n    __pow__ = _model_oper('**')\n    __or__ = _model_oper('|')\n    __and__ = _model_oper('&')\n    _fix_inputs = _model_oper('fix_inputs')\n\n    # *** Other utilities ***\n\n    def _format_cls_repr(cls, keywords=[]):\n        \"\"\"\n        Internal implementation of ``__repr__``.\n\n        This is separated out for ease of use by subclasses that wish to\n        override the default ``__repr__`` while keeping the same basic\n        formatting.\n        \"\"\"\n\n        # For the sake of familiarity start the output with the standard class\n        # __repr__\n        parts = [super().__repr__()]\n\n        if not cls._is_concrete:\n            return parts[0]\n\n        def format_inheritance(cls):\n            bases = []\n            for base in cls.mro()[1:]:\n                if not issubclass(base, Model):\n                    continue\n                elif (inspect.isabstract(base) or\n                      base.__name__.startswith('_')):\n                    break\n                bases.append(base.name)\n            if bases:\n                return f\"{cls.name} ({' -> '.join(bases)})\"\n            return cls.name\n\n        try:\n            default_keywords = [\n                ('Name', format_inheritance(cls)),\n                ('N_inputs', cls.n_inputs),\n                ('N_outputs', cls.n_outputs),\n            ]\n\n            if cls.param_names:\n                default_keywords.append(('Fittable parameters',\n                                         cls.param_names))\n\n            for keyword, value in default_keywords + keywords:\n                if value is not None:\n                    parts.append(f'{keyword}: {value}')\n\n            return '\\n'.join(parts)\n        except Exception:\n            # If any of the above formatting fails fall back on the basic repr\n            # (this is particularly useful in debugging)\n            return parts[0]\n\n\nclass Model(metaclass=_ModelMeta):\n    \"\"\"\n    Base class for all models.\n\n    This is an abstract class and should not be instantiated directly.\n\n    The following initialization arguments apply to the majority of Model\n    subclasses by default (exceptions include specialized utility models\n    like `~astropy.modeling.mappings.Mapping`).  Parametric models take all\n    their parameters as arguments, followed by any of the following optional\n    keyword arguments:\n\n    Parameters\n    ----------\n    name : str, optional\n        A human-friendly name associated with this model instance\n        (particularly useful for identifying the individual components of a\n        compound model).\n\n    meta : dict, optional\n        An optional dict of user-defined metadata to attach to this model.\n        How this is used and interpreted is up to the user or individual use\n        case.\n\n    n_models : int, optional\n        If given an integer greater than 1, a *model set* is instantiated\n        instead of a single model.  This affects how the parameter arguments\n        are interpreted.  In this case each parameter must be given as a list\n        or array--elements of this array are taken along the first axis (or\n        ``model_set_axis`` if specified), such that the Nth element is the\n        value of that parameter for the Nth model in the set.\n\n        See the section on model sets in the documentation for more details.\n\n    model_set_axis : int, optional\n        This argument only applies when creating a model set (i.e. ``n_models >\n        1``).  It changes how parameter values are interpreted.  Normally the\n        first axis of each input parameter array (properly the 0th axis) is\n        taken as the axis corresponding to the model sets.  However, any axis\n        of an input array may be taken as this \"model set axis\".  This accepts\n        negative integers as well--for example use ``model_set_axis=-1`` if the\n        last (most rapidly changing) axis should be associated with the model\n        sets. Also, ``model_set_axis=False`` can be used to tell that a given\n        input should be used to evaluate all the models in the model set.\n\n    fixed : dict, optional\n        Dictionary ``{parameter_name: bool}`` setting the fixed constraint\n        for one or more parameters.  `True` means the parameter is held fixed\n        during fitting and is prevented from updates once an instance of the\n        model has been created.\n\n        Alternatively the `~astropy.modeling.Parameter.fixed` property of a\n        parameter may be used to lock or unlock individual parameters.\n\n    tied : dict, optional\n        Dictionary ``{parameter_name: callable}`` of parameters which are\n        linked to some other parameter. The dictionary values are callables\n        providing the linking relationship.\n\n        Alternatively the `~astropy.modeling.Parameter.tied` property of a\n        parameter may be used to set the ``tied`` constraint on individual\n        parameters.\n\n    bounds : dict, optional\n        A dictionary ``{parameter_name: value}`` of lower and upper bounds of\n        parameters. Keys are parameter names. Values are a list or a tuple\n        of length 2 giving the desired range for the parameter.\n\n        Alternatively the `~astropy.modeling.Parameter.min` and\n        `~astropy.modeling.Parameter.max` or\n        ~astropy.modeling.Parameter.bounds` properties of a parameter may be\n        used to set bounds on individual parameters.\n\n    eqcons : list, optional\n        List of functions of length n such that ``eqcons[j](x0, *args) == 0.0``\n        in a successfully optimized problem.\n\n    ineqcons : list, optional\n        List of functions of length n such that ``ieqcons[j](x0, *args) >=\n        0.0`` is a successfully optimized problem.\n\n    Examples\n    --------\n    >>> from astropy.modeling import models\n    >>> def tie_center(model):\n    ...         mean = 50 * model.stddev\n    ...         return mean\n    >>> tied_parameters = {'mean': tie_center}\n\n    Specify that ``'mean'`` is a tied parameter in one of two ways:\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3,\n    ...                        tied=tied_parameters)\n\n    or\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3)\n    >>> g1.mean.tied\n    False\n    >>> g1.mean.tied = tie_center\n    >>> g1.mean.tied\n    <function tie_center at 0x...>\n\n    Fixed parameters:\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3,\n    ...                        fixed={'stddev': True})\n    >>> g1.stddev.fixed\n    True\n\n    or\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3)\n    >>> g1.stddev.fixed\n    False\n    >>> g1.stddev.fixed = True\n    >>> g1.stddev.fixed\n    True\n    \"\"\"\n\n    parameter_constraints = Parameter.constraints\n    \"\"\"\n    Primarily for informational purposes, these are the types of constraints\n    that can be set on a model's parameters.\n    \"\"\"\n\n    model_constraints = ('eqcons', 'ineqcons')\n    \"\"\"\n    Primarily for informational purposes, these are the types of constraints\n    that constrain model evaluation.\n    \"\"\"\n\n    param_names = ()\n    \"\"\"\n    Names of the parameters that describe models of this type.\n\n    The parameters in this tuple are in the same order they should be passed in\n    when initializing a model of a specific type.  Some types of models, such\n    as polynomial models, have a different number of parameters depending on\n    some other property of the model, such as the degree.\n\n    When defining a custom model class the value of this attribute is\n    automatically set by the `~astropy.modeling.Parameter` attributes defined\n    in the class body.\n    \"\"\"\n\n    n_inputs = 0\n    \"\"\"The number of inputs.\"\"\"\n    n_outputs = 0\n    \"\"\" The number of outputs.\"\"\"\n\n    standard_broadcasting = True\n    fittable = False\n    linear = True\n    _separable = None\n    \"\"\" A boolean flag to indicate whether a model is separable.\"\"\"\n    meta = metadata.MetaData()\n    \"\"\"A dict-like object to store optional information.\"\"\"\n\n    # By default models either use their own inverse property or have no\n    # inverse at all, but users may also assign a custom inverse to a model,\n    # optionally; in that case it is of course up to the user to determine\n    # whether their inverse is *actually* an inverse to the model they assign\n    # it to.\n    _inverse = None\n    _user_inverse = None\n\n    _bounding_box = None\n    _user_bounding_box = None\n\n    _has_inverse_bounding_box = False\n\n    # Default n_models attribute, so that __len__ is still defined even when a\n    # model hasn't completed initialization yet\n    _n_models = 1\n\n    # New classes can set this as a boolean value.\n    # It is converted to a dictionary mapping input name to a boolean value.\n    _input_units_strict = False\n\n    # Allow dimensionless input (and corresponding output). If this is True,\n    # input values to evaluate will gain the units specified in input_units. If\n    # this is a dictionary then it should map input name to a bool to allow\n    # dimensionless numbers for that input.\n    # Only has an effect if input_units is defined.\n    _input_units_allow_dimensionless = False\n\n    # Default equivalencies to apply to input values. If set, this should be a\n    # dictionary where each key is a string that corresponds to one of the\n    # model inputs. Only has an effect if input_units is defined.\n    input_units_equivalencies = None\n\n    # Covariance matrix can be set by fitter if available.\n    # If cov_matrix is available, then std will set as well\n    _cov_matrix = None\n    _stds = None\n\n    def __init_subclass__(cls, **kwargs):\n        super().__init_subclass__()\n\n    def __init__(self, *args, meta=None, name=None, **kwargs):\n        super().__init__()\n        self._default_inputs_outputs()\n        if meta is not None:\n            self.meta = meta\n        self._name = name\n        # add parameters to instance level by walking MRO list\n        mro = self.__class__.__mro__\n        for cls in mro:\n            if issubclass(cls, Model):\n                for parname, val in cls._parameters_.items():\n                    newpar = copy.deepcopy(val)\n                    newpar.model = self\n                    if parname not in self.__dict__:\n                        self.__dict__[parname] = newpar\n\n        self._initialize_constraints(kwargs)\n        kwargs = self._initialize_setters(kwargs)\n        # Remaining keyword args are either parameter values or invalid\n        # Parameter values must be passed in as keyword arguments in order to\n        # distinguish them\n        self._initialize_parameters(args, kwargs)\n        self._initialize_slices()\n        self._initialize_unit_support()\n\n    def _default_inputs_outputs(self):\n        if self.n_inputs == 1 and self.n_outputs == 1:\n            self._inputs = (\"x\",)\n            self._outputs = (\"y\",)\n        elif self.n_inputs == 2 and self.n_outputs == 1:\n            self._inputs = (\"x\", \"y\")\n            self._outputs = (\"z\",)\n        else:\n            try:\n                self._inputs = tuple(\"x\" + str(idx) for idx in range(self.n_inputs))\n                self._outputs = tuple(\"x\" + str(idx) for idx in range(self.n_outputs))\n            except TypeError:\n                # self.n_inputs and self.n_outputs are properties\n                # This is the case when subclasses of Model do not define\n                # ``n_inputs``, ``n_outputs``, ``inputs`` or ``outputs``.\n                self._inputs = ()\n                self._outputs = ()\n\n    def _initialize_setters(self, kwargs):\n        \"\"\"\n        This exists to inject defaults for settable properties for models\n        originating from `custom_model`.\n        \"\"\"\n        if hasattr(self, '_settable_properties'):\n            setters = {name: kwargs.pop(name, default)\n                       for name, default in self._settable_properties.items()}\n            for name, value in setters.items():\n                setattr(self, name, value)\n\n        return kwargs\n\n    @property\n    def inputs(self):\n        return self._inputs\n\n    @inputs.setter\n    def inputs(self, val):\n        if len(val) != self.n_inputs:\n            raise ValueError(f\"Expected {self.n_inputs} number of inputs, got {len(val)}.\")\n        self._inputs = val\n        self._initialize_unit_support()\n\n    @property\n    def outputs(self):\n        return self._outputs\n\n    @outputs.setter\n    def outputs(self, val):\n        if len(val) != self.n_outputs:\n            raise ValueError(f\"Expected {self.n_outputs} number of outputs, got {len(val)}.\")\n        self._outputs = val\n\n    @property\n    def n_inputs(self):\n        # TODO: remove the code in the ``if`` block when support\n        # for models with ``inputs`` as class variables is removed.\n        if hasattr(self.__class__, 'n_inputs') and isinstance(self.__class__.n_inputs, property):\n            try:\n                return len(self.__class__.inputs)\n            except TypeError:\n                try:\n                    return len(self.inputs)\n                except AttributeError:\n                    return 0\n\n        return self.__class__.n_inputs\n\n    @property\n    def n_outputs(self):\n        # TODO: remove the code in the ``if`` block when support\n        # for models with ``outputs`` as class variables is removed.\n        if hasattr(self.__class__, 'n_outputs') and isinstance(self.__class__.n_outputs, property):\n            try:\n                return len(self.__class__.outputs)\n            except TypeError:\n                try:\n                    return len(self.outputs)\n                except AttributeError:\n                    return 0\n\n        return self.__class__.n_outputs\n\n    def _calculate_separability_matrix(self):\n        \"\"\"\n        This is a hook which customises the behavior of modeling.separable.\n\n        This allows complex subclasses to customise the separability matrix.\n        If it returns `NotImplemented` the default behavior is used.\n        \"\"\"\n        return NotImplemented\n\n    def _initialize_unit_support(self):\n        \"\"\"\n        Convert self._input_units_strict and\n        self.input_units_allow_dimensionless to dictionaries\n        mapping input name to a boolean value.\n        \"\"\"\n        if isinstance(self._input_units_strict, bool):\n            self._input_units_strict = {key: self._input_units_strict for\n                                        key in self.inputs}\n\n        if isinstance(self._input_units_allow_dimensionless, bool):\n            self._input_units_allow_dimensionless = {key: self._input_units_allow_dimensionless\n                                                     for key in self.inputs}\n\n    @property\n    def input_units_strict(self):\n        \"\"\"\n        Enforce strict units on inputs to evaluate. If this is set to True,\n        input values to evaluate will be in the exact units specified by\n        input_units. If the input quantities are convertible to input_units,\n        they are converted. If this is a dictionary then it should map input\n        name to a bool to set strict input units for that parameter.\n        \"\"\"\n        val = self._input_units_strict\n        if isinstance(val, bool):\n            return {key: val for key in self.inputs}\n        return dict(zip(self.inputs, val.values()))\n\n    @property\n    def input_units_allow_dimensionless(self):\n        \"\"\"\n        Allow dimensionless input (and corresponding output). If this is True,\n        input values to evaluate will gain the units specified in input_units. If\n        this is a dictionary then it should map input name to a bool to allow\n        dimensionless numbers for that input.\n        Only has an effect if input_units is defined.\n        \"\"\"\n\n        val = self._input_units_allow_dimensionless\n        if isinstance(val, bool):\n            return {key: val for key in self.inputs}\n        return dict(zip(self.inputs, val.values()))\n\n    @property\n    def uses_quantity(self):\n        \"\"\"\n        True if this model has been created with `~astropy.units.Quantity`\n        objects or if there are no parameters.\n\n        This can be used to determine if this model should be evaluated with\n        `~astropy.units.Quantity` or regular floats.\n        \"\"\"\n        pisq = [isinstance(p, Quantity) for p in self._param_sets(units=True)]\n        return (len(pisq) == 0) or any(pisq)\n\n    def __repr__(self):\n        return self._format_repr()\n\n    def __str__(self):\n        return self._format_str()\n\n    def __len__(self):\n        return self._n_models\n\n    @staticmethod\n    def _strip_ones(intup):\n        return tuple(item for item in intup if item != 1)\n\n    def __setattr__(self, attr, value):\n        if isinstance(self, CompoundModel):\n            param_names = self._param_names\n        param_names = self.param_names\n\n        if param_names is not None and attr in self.param_names:\n            param = self.__dict__[attr]\n            value = _tofloat(value)\n            if param._validator is not None:\n                param._validator(self, value)\n            # check consistency with previous shape and size\n            eshape = self._param_metrics[attr]['shape']\n            if eshape == ():\n                eshape = (1,)\n            vshape = np.array(value).shape\n            if vshape == ():\n                vshape = (1,)\n            esize = self._param_metrics[attr]['size']\n            if (np.size(value) != esize or\n                    self._strip_ones(vshape) != self._strip_ones(eshape)):\n                raise InputParameterError(\n                    \"Value for parameter {0} does not match shape or size\\n\"\n                    \"expected by model ({1}, {2}) vs ({3}, {4})\".format(\n                        attr, vshape, np.size(value), eshape, esize))\n            if param.unit is None:\n                if isinstance(value, Quantity):\n                    param._unit = value.unit\n                    param.value = value.value\n                else:\n                    param.value = value\n            else:\n                if not isinstance(value, Quantity):\n                    raise UnitsError(f\"The '{param.name}' parameter should be given as a\"\n                                     \" Quantity because it was originally \"\n                                     \"initialized as a Quantity\")\n                param._unit = value.unit\n                param.value = value.value\n        else:\n            if attr in ['fittable', 'linear']:\n                self.__dict__[attr] = value\n            else:\n                super().__setattr__(attr, value)\n\n    def _pre_evaluate(self, *args, **kwargs):\n        \"\"\"\n        Model specific input setup that needs to occur prior to model evaluation\n        \"\"\"\n\n        # Broadcast inputs into common size\n        inputs, broadcasted_shapes = self.prepare_inputs(*args, **kwargs)\n\n        # Setup actual model evaluation method\n        parameters = self._param_sets(raw=True, units=True)\n\n        def evaluate(_inputs):\n            return self.evaluate(*chain(_inputs, parameters))\n\n        return evaluate, inputs, broadcasted_shapes, kwargs\n\n    def get_bounding_box(self, with_bbox=True):\n        \"\"\"\n        Return the ``bounding_box`` of a model if it exists or ``None``\n        otherwise.\n\n        Parameters\n        ----------\n        with_bbox :\n            The value of the ``with_bounding_box`` keyword argument\n            when calling the model. Default is `True` for usage when\n            looking up the model's ``bounding_box`` without risk of error.\n        \"\"\"\n        bbox = None\n\n        if not isinstance(with_bbox, bool) or with_bbox:\n            try:\n                bbox = self.bounding_box\n            except NotImplementedError:\n                pass\n\n            if isinstance(bbox, CompoundBoundingBox) and not isinstance(with_bbox, bool):\n                bbox = bbox[with_bbox]\n\n        return bbox\n\n    @property\n    def _argnames(self):\n        \"\"\"The inputs used to determine input_shape for bounding_box evaluation\"\"\"\n        return self.inputs\n\n    def _validate_input_shape(self, _input, idx, argnames, model_set_axis, check_model_set_axis):\n        \"\"\"\n        Perform basic validation of a single model input's shape\n            -- it has the minimum dimensions for the given model_set_axis\n\n        Returns the shape of the input if validation succeeds.\n        \"\"\"\n        input_shape = np.shape(_input)\n        # Ensure that the input's model_set_axis matches the model's\n        # n_models\n        if input_shape and check_model_set_axis:\n            # Note: Scalar inputs *only* get a pass on this\n            if len(input_shape) < model_set_axis + 1:\n                raise ValueError(\n                    f\"For model_set_axis={model_set_axis}, all inputs must be at \"\n                    f\"least {model_set_axis + 1}-dimensional.\")\n            if input_shape[model_set_axis] != self._n_models:\n                try:\n                    argname = argnames[idx]\n                except IndexError:\n                    # the case of model.inputs = ()\n                    argname = str(idx)\n\n                raise ValueError(\n                    f\"Input argument '{argname}' does not have the correct \"\n                    f\"dimensions in model_set_axis={model_set_axis} for a model set with \"\n                    f\"n_models={self._n_models}.\")\n\n        return input_shape\n\n    def _validate_input_shapes(self, inputs, argnames, model_set_axis):\n        \"\"\"\n        Perform basic validation of model inputs\n            --that they are mutually broadcastable and that they have\n            the minimum dimensions for the given model_set_axis.\n\n        If validation succeeds, returns the total shape that will result from\n        broadcasting the input arrays with each other.\n        \"\"\"\n\n        check_model_set_axis = self._n_models > 1 and model_set_axis is not False\n\n        all_shapes = []\n        for idx, _input in enumerate(inputs):\n            all_shapes.append(self._validate_input_shape(_input, idx, argnames,\n                                                         model_set_axis, check_model_set_axis))\n\n        input_shape = check_broadcast(*all_shapes)\n        if input_shape is None:\n            raise ValueError(\n                \"All inputs must have identical shapes or must be scalars.\")\n\n        return input_shape\n\n    def input_shape(self, inputs):\n        \"\"\"Get input shape for bounding_box evaluation\"\"\"\n        return self._validate_input_shapes(inputs, self._argnames, self.model_set_axis)\n\n    def _generic_evaluate(self, evaluate, _inputs, fill_value, with_bbox):\n        \"\"\"\n        Generic model evaluation routine\n            Selects and evaluates model with or without bounding_box enforcement\n        \"\"\"\n\n        # Evaluate the model using the prepared evaluation method either\n        #   enforcing the bounding_box or not.\n        bbox = self.get_bounding_box(with_bbox)\n        if (not isinstance(with_bbox, bool) or with_bbox) and bbox is not None:\n            outputs = bbox.evaluate(evaluate, _inputs, fill_value)\n        else:\n            outputs = evaluate(_inputs)\n        return outputs\n\n    def _post_evaluate(self, inputs, outputs, broadcasted_shapes, with_bbox, **kwargs):\n        \"\"\"\n        Model specific post evaluation processing of outputs\n        \"\"\"\n        if self.get_bounding_box(with_bbox) is None and self.n_outputs == 1:\n            outputs = (outputs,)\n\n        outputs = self.prepare_outputs(broadcasted_shapes, *outputs, **kwargs)\n        outputs = self._process_output_units(inputs, outputs)\n\n        if self.n_outputs == 1:\n            return outputs[0]\n        return outputs\n\n    @property\n    def bbox_with_units(self):\n        return (not isinstance(self, CompoundModel))\n\n    def __call__(self, *args, **kwargs):\n        \"\"\"\n        Evaluate this model using the given input(s) and the parameter values\n        that were specified when the model was instantiated.\n        \"\"\"\n        # Turn any keyword arguments into positional arguments.\n        args, kwargs = self._get_renamed_inputs_as_positional(*args, **kwargs)\n\n        # Read model evaluation related parameters\n        with_bbox = kwargs.pop('with_bounding_box', False)\n        fill_value = kwargs.pop('fill_value', np.nan)\n\n        # prepare for model evaluation (overridden in CompoundModel)\n        evaluate, inputs, broadcasted_shapes, kwargs = self._pre_evaluate(*args, **kwargs)\n\n        outputs = self._generic_evaluate(evaluate, inputs,\n                                         fill_value, with_bbox)\n\n        # post-process evaluation results (overridden in CompoundModel)\n        return self._post_evaluate(inputs, outputs, broadcasted_shapes, with_bbox, **kwargs)\n\n    def _get_renamed_inputs_as_positional(self, *args, **kwargs):\n        def _keyword2positional(kwargs):\n            # Inputs were passed as keyword (not positional) arguments.\n            # Because the signature of the ``__call__`` is defined at\n            # the class level, the name of the inputs cannot be changed at\n            # the instance level and the old names are always present in the\n            # signature of the method. In order to use the new names of the\n            # inputs, the old names are taken out of ``kwargs``, the input\n            # values are sorted in the order of self.inputs and passed as\n            # positional arguments to ``__call__``.\n\n            # These are the keys that are always present as keyword arguments.\n            keys = ['model_set_axis', 'with_bounding_box', 'fill_value',\n                    'equivalencies', 'inputs_map']\n\n            new_inputs = {}\n            # kwargs contain the names of the new inputs + ``keys``\n            allkeys = list(kwargs.keys())\n            # Remove the names of the new inputs from kwargs and save them\n            # to a dict ``new_inputs``.\n            for key in allkeys:\n                if key not in keys:\n                    new_inputs[key] = kwargs[key]\n                    del kwargs[key]\n            return new_inputs, kwargs\n        n_args = len(args)\n\n        new_inputs, kwargs = _keyword2positional(kwargs)\n        n_all_args = n_args + len(new_inputs)\n\n        if n_all_args < self.n_inputs:\n            raise ValueError(f\"Missing input arguments - expected {self.n_inputs}, got {n_all_args}\")\n        elif n_all_args > self.n_inputs:\n            raise ValueError(f\"Too many input arguments - expected {self.n_inputs}, got {n_all_args}\")\n        if n_args == 0:\n            # Create positional arguments from the keyword arguments in ``new_inputs``.\n            new_args = []\n            for k in self.inputs:\n                new_args.append(new_inputs[k])\n        elif n_args != self.n_inputs:\n            # Some inputs are passed as positional, others as keyword arguments.\n            args = list(args)\n\n            # Create positional arguments from the keyword arguments in ``new_inputs``.\n            new_args = []\n            for k in self.inputs:\n                if k in new_inputs:\n                    new_args.append(new_inputs[k])\n                else:\n                    new_args.append(args[0])\n                    del args[0]\n        else:\n            new_args = args\n        return new_args, kwargs\n\n    # *** Properties ***\n    @property\n    def name(self):\n        \"\"\"User-provided name for this model instance.\"\"\"\n\n        return self._name\n\n    @name.setter\n    def name(self, val):\n        \"\"\"Assign a (new) name to this model.\"\"\"\n\n        self._name = val\n\n    @property\n    def model_set_axis(self):\n        \"\"\"\n        The index of the model set axis--that is the axis of a parameter array\n        that pertains to which model a parameter value pertains to--as\n        specified when the model was initialized.\n\n        See the documentation on :ref:`astropy:modeling-model-sets`\n        for more details.\n        \"\"\"\n\n        return self._model_set_axis\n\n    @property\n    def param_sets(self):\n        \"\"\"\n        Return parameters as a pset.\n\n        This is a list with one item per parameter set, which is an array of\n        that parameter's values across all parameter sets, with the last axis\n        associated with the parameter set.\n        \"\"\"\n\n        return self._param_sets()\n\n    @property\n    def parameters(self):\n        \"\"\"\n        A flattened array of all parameter values in all parameter sets.\n\n        Fittable parameters maintain this list and fitters modify it.\n        \"\"\"\n\n        # Currently the sequence of a model's parameters must be contiguous\n        # within the _parameters array (which may be a view of a larger array,\n        # for example when taking a sub-expression of a compound model), so\n        # the assumption here is reliable:\n        if not self.param_names:\n            # Trivial, but not unheard of\n            return self._parameters\n\n        self._parameters_to_array()\n        start = self._param_metrics[self.param_names[0]]['slice'].start\n        stop = self._param_metrics[self.param_names[-1]]['slice'].stop\n\n        return self._parameters[start:stop]\n\n    @parameters.setter\n    def parameters(self, value):\n        \"\"\"\n        Assigning to this attribute updates the parameters array rather than\n        replacing it.\n        \"\"\"\n\n        if not self.param_names:\n            return\n\n        start = self._param_metrics[self.param_names[0]]['slice'].start\n        stop = self._param_metrics[self.param_names[-1]]['slice'].stop\n\n        try:\n            value = np.array(value).flatten()\n            self._parameters[start:stop] = value\n        except ValueError as e:\n            raise InputParameterError(\n                \"Input parameter values not compatible with the model \"\n                \"parameters array: {0}\".format(e))\n        self._array_to_parameters()\n\n    @property\n    def sync_constraints(self):\n        '''\n        This is a boolean property that indicates whether or not accessing constraints\n        automatically check the constituent models current values. It defaults to True\n        on creation of a model, but for fitting purposes it should be set to False\n        for performance reasons.\n        '''\n        if not hasattr(self, '_sync_constraints'):\n            self._sync_constraints = True\n        return self._sync_constraints\n\n    @sync_constraints.setter\n    def sync_constraints(self, value):\n        if not isinstance(value, bool):\n            raise ValueError('sync_constraints only accepts True or False as values')\n        self._sync_constraints = value\n\n    @property\n    def fixed(self):\n        \"\"\"\n        A ``dict`` mapping parameter names to their fixed constraint.\n        \"\"\"\n        if not hasattr(self, '_fixed') or self.sync_constraints:\n            self._fixed = _ConstraintsDict(self, 'fixed')\n        return self._fixed\n\n    @property\n    def bounds(self):\n        \"\"\"\n        A ``dict`` mapping parameter names to their upper and lower bounds as\n        ``(min, max)`` tuples or ``[min, max]`` lists.\n        \"\"\"\n        if not hasattr(self, '_bounds') or self.sync_constraints:\n            self._bounds = _ConstraintsDict(self, 'bounds')\n        return self._bounds\n\n    @property\n    def tied(self):\n        \"\"\"\n        A ``dict`` mapping parameter names to their tied constraint.\n        \"\"\"\n        if not hasattr(self, '_tied') or self.sync_constraints:\n            self._tied = _ConstraintsDict(self, 'tied')\n        return self._tied\n\n    @property\n    def eqcons(self):\n        \"\"\"List of parameter equality constraints.\"\"\"\n\n        return self._mconstraints['eqcons']\n\n    @property\n    def ineqcons(self):\n        \"\"\"List of parameter inequality constraints.\"\"\"\n\n        return self._mconstraints['ineqcons']\n\n    def has_inverse(self):\n        \"\"\"\n        Returns True if the model has an analytic or user\n        inverse defined.\n        \"\"\"\n        try:\n            self.inverse\n        except NotImplementedError:\n            return False\n\n        return True\n\n    @property\n    def inverse(self):\n        \"\"\"\n        Returns a new `~astropy.modeling.Model` instance which performs the\n        inverse transform, if an analytic inverse is defined for this model.\n\n        Even on models that don't have an inverse defined, this property can be\n        set with a manually-defined inverse, such a pre-computed or\n        experimentally determined inverse (often given as a\n        `~astropy.modeling.polynomial.PolynomialModel`, but not by\n        requirement).\n\n        A custom inverse can be deleted with ``del model.inverse``.  In this\n        case the model's inverse is reset to its default, if a default exists\n        (otherwise the default is to raise `NotImplementedError`).\n\n        Note to authors of `~astropy.modeling.Model` subclasses:  To define an\n        inverse for a model simply override this property to return the\n        appropriate model representing the inverse.  The machinery that will\n        make the inverse manually-overridable is added automatically by the\n        base class.\n        \"\"\"\n        if self._user_inverse is not None:\n            return self._user_inverse\n        elif self._inverse is not None:\n            result = self._inverse()\n            if result is not NotImplemented:\n                if not self._has_inverse_bounding_box:\n                    result.bounding_box = None\n                return result\n\n        raise NotImplementedError(\"No analytical or user-supplied inverse transform \"\n                                  \"has been implemented for this model.\")\n\n    @inverse.setter\n    def inverse(self, value):\n        if not isinstance(value, (Model, type(None))):\n            raise ValueError(\n                \"The ``inverse`` attribute may be assigned a `Model` \"\n                \"instance or `None` (where `None` explicitly forces the \"\n                \"model to have no inverse.\")\n\n        self._user_inverse = value\n\n    @inverse.deleter\n    def inverse(self):\n        \"\"\"\n        Resets the model's inverse to its default (if one exists, otherwise\n        the model will have no inverse).\n        \"\"\"\n\n        try:\n            del self._user_inverse\n        except AttributeError:\n            pass\n\n    @property\n    def has_user_inverse(self):\n        \"\"\"\n        A flag indicating whether or not a custom inverse model has been\n        assigned to this model by a user, via assignment to ``model.inverse``.\n        \"\"\"\n        return self._user_inverse is not None\n\n    @property\n    def bounding_box(self):\n        r\"\"\"\n        A `tuple` of length `n_inputs` defining the bounding box limits, or\n        raise `NotImplementedError` for no bounding_box.\n\n        The default limits are given by a ``bounding_box`` property or method\n        defined in the class body of a specific model.  If not defined then\n        this property just raises `NotImplementedError` by default (but may be\n        assigned a custom value by a user).  ``bounding_box`` can be set\n        manually to an array-like object of shape ``(model.n_inputs, 2)``. For\n        further usage, see :ref:`astropy:bounding-boxes`\n\n        The limits are ordered according to the `numpy` ``'C'`` indexing\n        convention, and are the reverse of the model input order,\n        e.g. for inputs ``('x', 'y', 'z')``, ``bounding_box`` is defined:\n\n        * for 1D: ``(x_low, x_high)``\n        * for 2D: ``((y_low, y_high), (x_low, x_high))``\n        * for 3D: ``((z_low, z_high), (y_low, y_high), (x_low, x_high))``\n\n        Examples\n        --------\n\n        Setting the ``bounding_box`` limits for a 1D and 2D model:\n\n        >>> from astropy.modeling.models import Gaussian1D, Gaussian2D\n        >>> model_1d = Gaussian1D()\n        >>> model_2d = Gaussian2D(x_stddev=1, y_stddev=1)\n        >>> model_1d.bounding_box = (-5, 5)\n        >>> model_2d.bounding_box = ((-6, 6), (-5, 5))\n\n        Setting the bounding_box limits for a user-defined 3D `custom_model`:\n\n        >>> from astropy.modeling.models import custom_model\n        >>> def const3d(x, y, z, amp=1):\n        ...    return amp\n        ...\n        >>> Const3D = custom_model(const3d)\n        >>> model_3d = Const3D()\n        >>> model_3d.bounding_box = ((-6, 6), (-5, 5), (-4, 4))\n\n        To reset ``bounding_box`` to its default limits just delete the\n        user-defined value--this will reset it back to the default defined\n        on the class:\n\n        >>> del model_1d.bounding_box\n\n        To disable the bounding box entirely (including the default),\n        set ``bounding_box`` to `None`:\n\n        >>> model_1d.bounding_box = None\n        >>> model_1d.bounding_box  # doctest: +IGNORE_EXCEPTION_DETAIL\n        Traceback (most recent call last):\n        NotImplementedError: No bounding box is defined for this model\n        (note: the bounding box was explicitly disabled for this model;\n        use `del model.bounding_box` to restore the default bounding box,\n        if one is defined for this model).\n        \"\"\"\n\n        if self._user_bounding_box is not None:\n            if self._user_bounding_box is NotImplemented:\n                raise NotImplementedError(\n                    \"No bounding box is defined for this model (note: the \"\n                    \"bounding box was explicitly disabled for this model; \"\n                    \"use `del model.bounding_box` to restore the default \"\n                    \"bounding box, if one is defined for this model).\")\n            return self._user_bounding_box\n        elif self._bounding_box is None:\n            raise NotImplementedError(\n                \"No bounding box is defined for this model.\")\n        elif isinstance(self._bounding_box, ModelBoundingBox):\n            # This typically implies a hard-coded bounding box.  This will\n            # probably be rare, but it is an option\n            return self._bounding_box\n        elif isinstance(self._bounding_box, types.MethodType):\n            return ModelBoundingBox.validate(self, self._bounding_box())\n        else:\n            # The only other allowed possibility is that it's a ModelBoundingBox\n            # subclass, so we call it with its default arguments and return an\n            # instance of it (that can be called to recompute the bounding box\n            # with any optional parameters)\n            # (In other words, in this case self._bounding_box is a *class*)\n            bounding_box = self._bounding_box((), model=self)()\n            return self._bounding_box(bounding_box, model=self)\n\n    @bounding_box.setter\n    def bounding_box(self, bounding_box):\n        \"\"\"\n        Assigns the bounding box limits.\n        \"\"\"\n\n        if bounding_box is None:\n            cls = None\n            # We use this to explicitly set an unimplemented bounding box (as\n            # opposed to no user bounding box defined)\n            bounding_box = NotImplemented\n        elif (isinstance(bounding_box, CompoundBoundingBox) or\n              isinstance(bounding_box, dict)):\n            cls = CompoundBoundingBox\n        elif (isinstance(self._bounding_box, type) and\n              issubclass(self._bounding_box, ModelBoundingBox)):\n            cls = self._bounding_box\n        else:\n            cls = ModelBoundingBox\n\n        if cls is not None:\n            try:\n                bounding_box = cls.validate(self, bounding_box, _preserve_ignore=True)\n            except ValueError as exc:\n                raise ValueError(exc.args[0])\n\n        self._user_bounding_box = bounding_box\n\n    def set_slice_args(self, *args):\n        if isinstance(self._user_bounding_box, CompoundBoundingBox):\n            self._user_bounding_box.slice_args = args\n        else:\n            raise RuntimeError('The bounding_box for this model is not compound')\n\n    @bounding_box.deleter\n    def bounding_box(self):\n        self._user_bounding_box = None\n\n    @property\n    def has_user_bounding_box(self):\n        \"\"\"\n        A flag indicating whether or not a custom bounding_box has been\n        assigned to this model by a user, via assignment to\n        ``model.bounding_box``.\n        \"\"\"\n\n        return self._user_bounding_box is not None\n\n    @property\n    def cov_matrix(self):\n        \"\"\"\n        Fitter should set covariance matrix, if available.\n        \"\"\"\n        return self._cov_matrix\n\n    @cov_matrix.setter\n    def cov_matrix(self, cov):\n\n        self._cov_matrix = cov\n\n        unfix_untied_params = [p for p in self.param_names if (self.fixed[p] is False)\n                               and (self.tied[p] is False)]\n        if type(cov) == list:  # model set\n            param_stds = []\n            for c in cov:\n                param_stds.append([np.sqrt(x) if x > 0 else None for x in np.diag(c.cov_matrix)])\n            for p, param_name in enumerate(unfix_untied_params):\n                par = getattr(self, param_name)\n                par.std = [item[p] for item in param_stds]\n                setattr(self, param_name, par)\n        else:\n            param_stds = [np.sqrt(x) if x > 0 else None for x in np.diag(cov.cov_matrix)]\n            for param_name in unfix_untied_params:\n                par = getattr(self, param_name)\n                par.std = param_stds.pop(0)\n                setattr(self, param_name, par)\n\n    @property\n    def stds(self):\n        \"\"\"\n        Standard deviation of parameters, if covariance matrix is available.\n        \"\"\"\n        return self._stds\n\n    @stds.setter\n    def stds(self, stds):\n        self._stds = stds\n\n    @property\n    def separable(self):\n        \"\"\" A flag indicating whether a model is separable.\"\"\"\n\n        if self._separable is not None:\n            return self._separable\n        raise NotImplementedError(\n            'The \"separable\" property is not defined for '\n            'model {}'.format(self.__class__.__name__))\n\n    # *** Public methods ***\n\n    def without_units_for_data(self, **kwargs):\n        \"\"\"\n        Return an instance of the model for which the parameter values have\n        been converted to the right units for the data, then the units have\n        been stripped away.\n\n        The input and output Quantity objects should be given as keyword\n        arguments.\n\n        Notes\n        -----\n\n        This method is needed in order to be able to fit models with units in\n        the parameters, since we need to temporarily strip away the units from\n        the model during the fitting (which might be done by e.g. scipy\n        functions).\n\n        The units that the parameters should be converted to are not\n        necessarily the units of the input data, but are derived from them.\n        Model subclasses that want fitting to work in the presence of\n        quantities need to define a ``_parameter_units_for_data_units`` method\n        that takes the input and output units (as two dictionaries) and\n        returns a dictionary giving the target units for each parameter.\n\n        \"\"\"\n        model = self.copy()\n\n        inputs_unit = {inp: getattr(kwargs[inp], 'unit', dimensionless_unscaled)\n                       for inp in self.inputs if kwargs[inp] is not None}\n\n        outputs_unit = {out: getattr(kwargs[out], 'unit', dimensionless_unscaled)\n                        for out in self.outputs if kwargs[out] is not None}\n        parameter_units = self._parameter_units_for_data_units(inputs_unit,\n                                                               outputs_unit)\n        for name, unit in parameter_units.items():\n            parameter = getattr(model, name)\n            if parameter.unit is not None:\n                parameter.value = parameter.quantity.to(unit).value\n                parameter._set_unit(None, force=True)\n\n        if isinstance(model, CompoundModel):\n            model.strip_units_from_tree()\n\n        return model\n\n    def output_units(self, **kwargs):\n        \"\"\"\n        Return a dictionary of output units for this model given a dictionary\n        of fitting inputs and outputs\n\n        The input and output Quantity objects should be given as keyword\n        arguments.\n\n        Notes\n        -----\n\n        This method is needed in order to be able to fit models with units in\n        the parameters, since we need to temporarily strip away the units from\n        the model during the fitting (which might be done by e.g. scipy\n        functions).\n\n        This method will force extra model evaluations, which maybe computationally\n        expensive. To avoid this, one can add a return_units property to the model,\n        see :ref:`astropy:models_return_units`.\n        \"\"\"\n        units = self.return_units\n\n        if units is None or units == {}:\n            inputs = {inp: kwargs[inp] for inp in self.inputs}\n\n            values = self(**inputs)\n            if self.n_outputs == 1:\n                values = (values,)\n\n            units = {out: getattr(values[index], 'unit', dimensionless_unscaled)\n                     for index, out in enumerate(self.outputs)}\n\n        return units\n\n    def strip_units_from_tree(self):\n        for item in self._leaflist:\n            for parname in item.param_names:\n                par = getattr(item, parname)\n                par._set_unit(None, force=True)\n\n    def with_units_from_data(self, **kwargs):\n        \"\"\"\n        Return an instance of the model which has units for which the parameter\n        values are compatible with the data units specified.\n\n        The input and output Quantity objects should be given as keyword\n        arguments.\n\n        Notes\n        -----\n\n        This method is needed in order to be able to fit models with units in\n        the parameters, since we need to temporarily strip away the units from\n        the model during the fitting (which might be done by e.g. scipy\n        functions).\n\n        The units that the parameters will gain are not necessarily the units\n        of the input data, but are derived from them. Model subclasses that\n        want fitting to work in the presence of quantities need to define a\n        ``_parameter_units_for_data_units`` method that takes the input and output\n        units (as two dictionaries) and returns a dictionary giving the target\n        units for each parameter.\n        \"\"\"\n        model = self.copy()\n        inputs_unit = {inp: getattr(kwargs[inp], 'unit', dimensionless_unscaled)\n                       for inp in self.inputs if kwargs[inp] is not None}\n\n        outputs_unit = {out: getattr(kwargs[out], 'unit', dimensionless_unscaled)\n                        for out in self.outputs if kwargs[out] is not None}\n\n        parameter_units = self._parameter_units_for_data_units(inputs_unit,\n                                                               outputs_unit)\n\n        # We are adding units to parameters that already have a value, but we\n        # don't want to convert the parameter, just add the unit directly,\n        # hence the call to ``_set_unit``.\n        for name, unit in parameter_units.items():\n            parameter = getattr(model, name)\n            parameter._set_unit(unit, force=True)\n\n        return model\n\n    @property\n    def _has_units(self):\n        # Returns True if any of the parameters have units\n        for param in self.param_names:\n            if getattr(self, param).unit is not None:\n                return True\n        else:\n            return False\n\n    @property\n    def _supports_unit_fitting(self):\n        # If the model has a ``_parameter_units_for_data_units`` method, this\n        # indicates that we have enough information to strip the units away\n        # and add them back after fitting, when fitting quantities\n        return hasattr(self, '_parameter_units_for_data_units')\n\n    @abc.abstractmethod\n    def evaluate(self, *args, **kwargs):\n        \"\"\"Evaluate the model on some input variables.\"\"\"\n\n    def sum_of_implicit_terms(self, *args, **kwargs):\n        \"\"\"\n        Evaluate the sum of any implicit model terms on some input variables.\n        This includes any fixed terms used in evaluating a linear model that\n        do not have corresponding parameters exposed to the user. The\n        prototypical case is `astropy.modeling.functional_models.Shift`, which\n        corresponds to a function y = a + bx, where b=1 is intrinsically fixed\n        by the type of model, such that sum_of_implicit_terms(x) == x. This\n        method is needed by linear fitters to correct the dependent variable\n        for the implicit term(s) when solving for the remaining terms\n        (ie. a = y - bx).\n        \"\"\"\n\n    def render(self, out=None, coords=None):\n        \"\"\"\n        Evaluate a model at fixed positions, respecting the ``bounding_box``.\n\n        The key difference relative to evaluating the model directly is that\n        this method is limited to a bounding box if the `Model.bounding_box`\n        attribute is set.\n\n        Parameters\n        ----------\n        out : `numpy.ndarray`, optional\n            An array that the evaluated model will be added to.  If this is not\n            given (or given as ``None``), a new array will be created.\n        coords : array-like, optional\n            An array to be used to translate from the model's input coordinates\n            to the ``out`` array. It should have the property that\n            ``self(coords)`` yields the same shape as ``out``.  If ``out`` is\n            not specified, ``coords`` will be used to determine the shape of\n            the returned array. If this is not provided (or None), the model\n            will be evaluated on a grid determined by `Model.bounding_box`.\n\n        Returns\n        -------\n        out : `numpy.ndarray`\n            The model added to ``out`` if  ``out`` is not ``None``, or else a\n            new array from evaluating the model over ``coords``.\n            If ``out`` and ``coords`` are both `None`, the returned array is\n            limited to the `Model.bounding_box` limits. If\n            `Model.bounding_box` is `None`, ``arr`` or ``coords`` must be\n            passed.\n\n        Raises\n        ------\n        ValueError\n            If ``coords`` are not given and the the `Model.bounding_box` of\n            this model is not set.\n\n        Examples\n        --------\n        :ref:`astropy:bounding-boxes`\n        \"\"\"\n\n        try:\n            bbox = self.bounding_box\n        except NotImplementedError:\n            bbox = None\n\n        if isinstance(bbox, ModelBoundingBox):\n            bbox = bbox.bounding_box()\n\n        ndim = self.n_inputs\n\n        if (coords is None) and (out is None) and (bbox is None):\n            raise ValueError('If no bounding_box is set, '\n                             'coords or out must be input.')\n\n        # for consistent indexing\n        if ndim == 1:\n            if coords is not None:\n                coords = [coords]\n            if bbox is not None:\n                bbox = [bbox]\n\n        if coords is not None:\n            coords = np.asanyarray(coords, dtype=float)\n            # Check dimensions match out and model\n            assert len(coords) == ndim\n            if out is not None:\n                if coords[0].shape != out.shape:\n                    raise ValueError('inconsistent shape of the output.')\n            else:\n                out = np.zeros(coords[0].shape)\n\n        if out is not None:\n            out = np.asanyarray(out)\n            if out.ndim != ndim:\n                raise ValueError('the array and model must have the same '\n                                 'number of dimensions.')\n\n        if bbox is not None:\n            # Assures position is at center pixel,\n            # important when using add_array.\n            pd = np.array([(np.mean(bb), np.ceil((bb[1] - bb[0]) / 2))\n                           for bb in bbox]).astype(int).T\n            pos, delta = pd\n\n            if coords is not None:\n                sub_shape = tuple(delta * 2 + 1)\n                sub_coords = np.array([extract_array(c, sub_shape, pos)\n                                       for c in coords])\n            else:\n                limits = [slice(p - d, p + d + 1, 1) for p, d in pd.T]\n                sub_coords = np.mgrid[limits]\n\n            sub_coords = sub_coords[::-1]\n\n            if out is None:\n                out = self(*sub_coords)\n            else:\n                try:\n                    out = add_array(out, self(*sub_coords), pos)\n                except ValueError:\n                    raise ValueError(\n                        'The `bounding_box` is larger than the input out in '\n                        'one or more dimensions. Set '\n                        '`model.bounding_box = None`.')\n        else:\n            if coords is None:\n                im_shape = out.shape\n                limits = [slice(i) for i in im_shape]\n                coords = np.mgrid[limits]\n\n            coords = coords[::-1]\n\n            out += self(*coords)\n\n        return out\n\n    @property\n    def input_units(self):\n        \"\"\"\n        This property is used to indicate what units or sets of units the\n        evaluate method expects, and returns a dictionary mapping inputs to\n        units (or `None` if any units are accepted).\n\n        Model sub-classes can also use function annotations in evaluate to\n        indicate valid input units, in which case this property should\n        not be overridden since it will return the input units based on the\n        annotations.\n        \"\"\"\n        if hasattr(self, '_input_units'):\n            return self._input_units\n        elif hasattr(self.evaluate, '__annotations__'):\n            annotations = self.evaluate.__annotations__.copy()\n            annotations.pop('return', None)\n            if annotations:\n                # If there are not annotations for all inputs this will error.\n                return dict((name, annotations[name]) for name in self.inputs)\n        else:\n            # None means any unit is accepted\n            return None\n\n    @property\n    def return_units(self):\n        \"\"\"\n        This property is used to indicate what units or sets of units the\n        output of evaluate should be in, and returns a dictionary mapping\n        outputs to units (or `None` if any units are accepted).\n\n        Model sub-classes can also use function annotations in evaluate to\n        indicate valid output units, in which case this property should not be\n        overridden since it will return the return units based on the\n        annotations.\n        \"\"\"\n        if hasattr(self, '_return_units'):\n            return self._return_units\n        elif hasattr(self.evaluate, '__annotations__'):\n            return self.evaluate.__annotations__.get('return', None)\n        else:\n            # None means any unit is accepted\n            return None\n\n    def _prepare_inputs_single_model(self, params, inputs, **kwargs):\n        broadcasts = []\n        for idx, _input in enumerate(inputs):\n            input_shape = _input.shape\n\n            # Ensure that array scalars are always upgrade to 1-D arrays for the\n            # sake of consistency with how parameters work.  They will be cast back\n            # to scalars at the end\n            if not input_shape:\n                inputs[idx] = _input.reshape((1,))\n\n            if not params:\n                max_broadcast = input_shape\n            else:\n                max_broadcast = ()\n\n            for param in params:\n                try:\n                    if self.standard_broadcasting:\n                        broadcast = check_broadcast(input_shape, param.shape)\n                    else:\n                        broadcast = input_shape\n                except IncompatibleShapeError:\n                    raise ValueError(\n                        \"self input argument {0!r} of shape {1!r} cannot be \"\n                        \"broadcast with parameter {2!r} of shape \"\n                        \"{3!r}.\".format(self.inputs[idx], input_shape,\n                                        param.name, param.shape))\n\n                if len(broadcast) > len(max_broadcast):\n                    max_broadcast = broadcast\n                elif len(broadcast) == len(max_broadcast):\n                    max_broadcast = max(max_broadcast, broadcast)\n\n            broadcasts.append(max_broadcast)\n\n        if self.n_outputs > self.n_inputs:\n            extra_outputs = self.n_outputs - self.n_inputs\n            if not broadcasts:\n                # If there were no inputs then the broadcasts list is empty\n                # just add a None since there is no broadcasting of outputs and\n                # inputs necessary (see _prepare_outputs_single_self)\n                broadcasts.append(None)\n            broadcasts.extend([broadcasts[0]] * extra_outputs)\n\n        return inputs, (broadcasts,)\n\n    @staticmethod\n    def _remove_axes_from_shape(shape, axis):\n        \"\"\"\n        Given a shape tuple as the first input, construct a new one by  removing\n        that particular axis from the shape and all preceeding axes. Negative axis\n        numbers are permittted, where the axis is relative to the last axis.\n        \"\"\"\n        if len(shape) == 0:\n            return shape\n        if axis < 0:\n            axis = len(shape) + axis\n            return shape[:axis] + shape[axis+1:]\n        if axis >= len(shape):\n            axis = len(shape)-1\n        shape = shape[axis+1:]\n        return shape\n\n    def _prepare_inputs_model_set(self, params, inputs, model_set_axis_input,\n                                  **kwargs):\n        reshaped = []\n        pivots = []\n\n        model_set_axis_param = self.model_set_axis  # needed to reshape param\n        for idx, _input in enumerate(inputs):\n            max_param_shape = ()\n            if self._n_models > 1 and model_set_axis_input is not False:\n                # Use the shape of the input *excluding* the model axis\n                input_shape = (_input.shape[:model_set_axis_input] +\n                               _input.shape[model_set_axis_input + 1:])\n            else:\n                input_shape = _input.shape\n\n            for param in params:\n                try:\n                    check_broadcast(input_shape,\n                                    self._remove_axes_from_shape(param.shape,\n                                                                 model_set_axis_param))\n                except IncompatibleShapeError:\n                    raise ValueError(\n                        \"Model input argument {0!r} of shape {1!r} cannot be \"\n                        \"broadcast with parameter {2!r} of shape \"\n                        \"{3!r}.\".format(self.inputs[idx], input_shape,\n                                        param.name,\n                                        self._remove_axes_from_shape(param.shape,\n                                                                     model_set_axis_param)))\n\n                if len(param.shape) - 1 > len(max_param_shape):\n                    max_param_shape = self._remove_axes_from_shape(param.shape,\n                                                                   model_set_axis_param)\n\n            # We've now determined that, excluding the model_set_axis, the\n            # input can broadcast with all the parameters\n            input_ndim = len(input_shape)\n            if model_set_axis_input is False:\n                if len(max_param_shape) > input_ndim:\n                    # Just needs to prepend new axes to the input\n                    n_new_axes = 1 + len(max_param_shape) - input_ndim\n                    new_axes = (1,) * n_new_axes\n                    new_shape = new_axes + _input.shape\n                    pivot = model_set_axis_param\n                else:\n                    pivot = input_ndim - len(max_param_shape)\n                    new_shape = (_input.shape[:pivot] + (1,) +\n                                 _input.shape[pivot:])\n                new_input = _input.reshape(new_shape)\n            else:\n                if len(max_param_shape) >= input_ndim:\n                    n_new_axes = len(max_param_shape) - input_ndim\n                    pivot = self.model_set_axis\n                    new_axes = (1,) * n_new_axes\n                    new_shape = (_input.shape[:pivot + 1] + new_axes +\n                                 _input.shape[pivot + 1:])\n                    new_input = _input.reshape(new_shape)\n                else:\n                    pivot = _input.ndim - len(max_param_shape) - 1\n                    new_input = np.rollaxis(_input, model_set_axis_input,\n                                            pivot + 1)\n            pivots.append(pivot)\n            reshaped.append(new_input)\n\n        if self.n_inputs < self.n_outputs:\n            pivots.extend([model_set_axis_input] * (self.n_outputs - self.n_inputs))\n\n        return reshaped, (pivots,)\n\n    def prepare_inputs(self, *inputs, model_set_axis=None, equivalencies=None,\n                       **kwargs):\n        \"\"\"\n        This method is used in `~astropy.modeling.Model.__call__` to ensure\n        that all the inputs to the model can be broadcast into compatible\n        shapes (if one or both of them are input as arrays), particularly if\n        there are more than one parameter sets. This also makes sure that (if\n        applicable) the units of the input will be compatible with the evaluate\n        method.\n        \"\"\"\n        # When we instantiate the model class, we make sure that __call__ can\n        # take the following two keyword arguments: model_set_axis and\n        # equivalencies.\n        if model_set_axis is None:\n            # By default the model_set_axis for the input is assumed to be the\n            # same as that for the parameters the model was defined with\n            # TODO: Ensure that negative model_set_axis arguments are respected\n            model_set_axis = self.model_set_axis\n\n        params = [getattr(self, name) for name in self.param_names]\n        inputs = [np.asanyarray(_input, dtype=float) for _input in inputs]\n\n        self._validate_input_shapes(inputs, self.inputs, model_set_axis)\n\n        inputs_map = kwargs.get('inputs_map', None)\n\n        inputs = self._validate_input_units(inputs, equivalencies, inputs_map)\n\n        # The input formatting required for single models versus a multiple\n        # model set are different enough that they've been split into separate\n        # subroutines\n        if self._n_models == 1:\n            return self._prepare_inputs_single_model(params, inputs, **kwargs)\n        else:\n            return self._prepare_inputs_model_set(params, inputs,\n                                                  model_set_axis, **kwargs)\n\n    def _validate_input_units(self, inputs, equivalencies=None, inputs_map=None):\n        inputs = list(inputs)\n        name = self.name or self.__class__.__name__\n        # Check that the units are correct, if applicable\n\n        if self.input_units is not None:\n            # If a leaflist is provided that means this is in the context of\n            # a compound model and it is necessary to create the appropriate\n            # alias for the input coordinate name for the equivalencies dict\n            if inputs_map:\n                edict = {}\n                for mod, mapping in inputs_map:\n                    if self is mod:\n                        edict[mapping[0]] = equivalencies[mapping[1]]\n            else:\n                edict = equivalencies\n            # We combine any instance-level input equivalencies with user\n            # specified ones at call-time.\n            input_units_equivalencies = _combine_equivalency_dict(self.inputs,\n                                                                  edict,\n                                                                  self.input_units_equivalencies)\n\n            # We now iterate over the different inputs and make sure that their\n            # units are consistent with those specified in input_units.\n            for i in range(len(inputs)):\n\n                input_name = self.inputs[i]\n                input_unit = self.input_units.get(input_name, None)\n\n                if input_unit is None:\n                    continue\n\n                if isinstance(inputs[i], Quantity):\n\n                    # We check for consistency of the units with input_units,\n                    # taking into account any equivalencies\n\n                    if inputs[i].unit.is_equivalent(\n                            input_unit,\n                            equivalencies=input_units_equivalencies[input_name]):\n\n                        # If equivalencies have been specified, we need to\n                        # convert the input to the input units - this is\n                        # because some equivalencies are non-linear, and\n                        # we need to be sure that we evaluate the model in\n                        # its own frame of reference. If input_units_strict\n                        # is set, we also need to convert to the input units.\n                        if len(input_units_equivalencies) > 0 or self.input_units_strict[input_name]:\n                            inputs[i] = inputs[i].to(input_unit,\n                                                     equivalencies=input_units_equivalencies[input_name])\n\n                    else:\n\n                        # We consider the following two cases separately so as\n                        # to be able to raise more appropriate/nicer exceptions\n\n                        if input_unit is dimensionless_unscaled:\n                            raise UnitsError(\"{0}: Units of input '{1}', {2} ({3}),\"\n                                             \"could not be converted to \"\n                                             \"required dimensionless \"\n                                             \"input\".format(name,\n                                                            self.inputs[i],\n                                                            inputs[i].unit,\n                                                            inputs[i].unit.physical_type))\n                        else:\n                            raise UnitsError(\"{0}: Units of input '{1}', {2} ({3}),\"\n                                             \" could not be \"\n                                             \"converted to required input\"\n                                             \" units of {4} ({5})\".format(\n                                                 name,\n                                                 self.inputs[i],\n                                                 inputs[i].unit,\n                                                 inputs[i].unit.physical_type,\n                                                 input_unit,\n                                                 input_unit.physical_type))\n                else:\n\n                    # If we allow dimensionless input, we add the units to the\n                    # input values without conversion, otherwise we raise an\n                    # exception.\n\n                    if (not self.input_units_allow_dimensionless[input_name] and\n                        input_unit is not dimensionless_unscaled and\n                        input_unit is not None):\n                        if np.any(inputs[i] != 0):\n                            raise UnitsError(\"{0}: Units of input '{1}', (dimensionless), could not be \"\n                                             \"converted to required input units of \"\n                                             \"{2} ({3})\".format(name, self.inputs[i], input_unit,\n                                                                input_unit.physical_type))\n        return inputs\n\n    def _process_output_units(self, inputs, outputs):\n        inputs_are_quantity = any([isinstance(i, Quantity) for i in inputs])\n        if self.return_units and inputs_are_quantity:\n            # We allow a non-iterable unit only if there is one output\n            if self.n_outputs == 1 and not isiterable(self.return_units):\n                return_units = {self.outputs[0]: self.return_units}\n            else:\n                return_units = self.return_units\n\n            outputs = tuple([Quantity(out, return_units.get(out_name, None), subok=True)\n                             for out, out_name in zip(outputs, self.outputs)])\n        return outputs\n\n    @staticmethod\n    def _prepare_output_single_model(output, broadcast_shape):\n        if broadcast_shape is not None:\n            if not broadcast_shape:\n                return output.item()\n            else:\n                try:\n                    return output.reshape(broadcast_shape)\n                except ValueError:\n                    try:\n                        return output.item()\n                    except ValueError:\n                        return output\n\n        return output\n\n    def _prepare_outputs_single_model(self, outputs, broadcasted_shapes):\n        outputs = list(outputs)\n        for idx, output in enumerate(outputs):\n            try:\n                broadcast_shape = check_broadcast(*broadcasted_shapes[0])\n            except (IndexError, TypeError):\n                broadcast_shape = broadcasted_shapes[0][idx]\n\n            outputs[idx] = self._prepare_output_single_model(output, broadcast_shape)\n\n        return tuple(outputs)\n\n    def _prepare_outputs_model_set(self, outputs, broadcasted_shapes, model_set_axis):\n        pivots = broadcasted_shapes[0]\n        # If model_set_axis = False was passed then use\n        # self._model_set_axis to format the output.\n        if model_set_axis is None or model_set_axis is False:\n            model_set_axis = self.model_set_axis\n        outputs = list(outputs)\n        for idx, output in enumerate(outputs):\n            pivot = pivots[idx]\n            if pivot < output.ndim and pivot != model_set_axis:\n                outputs[idx] = np.rollaxis(output, pivot,\n                                           model_set_axis)\n        return tuple(outputs)\n\n    def prepare_outputs(self, broadcasted_shapes, *outputs, **kwargs):\n        model_set_axis = kwargs.get('model_set_axis', None)\n\n        if len(self) == 1:\n            return self._prepare_outputs_single_model(outputs, broadcasted_shapes)\n        else:\n            return self._prepare_outputs_model_set(outputs, broadcasted_shapes, model_set_axis)\n\n    def copy(self):\n        \"\"\"\n        Return a copy of this model.\n\n        Uses a deep copy so that all model attributes, including parameter\n        values, are copied as well.\n        \"\"\"\n\n        return copy.deepcopy(self)\n\n    def deepcopy(self):\n        \"\"\"\n        Return a deep copy of this model.\n\n        \"\"\"\n\n        return self.copy()\n\n    @sharedmethod\n    def rename(self, name):\n        \"\"\"\n        Return a copy of this model with a new name.\n        \"\"\"\n        new_model = self.copy()\n        new_model._name = name\n        return new_model\n\n    def coerce_units(\n        self,\n        input_units=None,\n        return_units=None,\n        input_units_equivalencies=None,\n        input_units_allow_dimensionless=False\n    ):\n        \"\"\"\n        Attach units to this (unitless) model.\n\n        Parameters\n        ----------\n        input_units : dict or tuple, optional\n            Input units to attach.  If dict, each key is the name of a model input,\n            and the value is the unit to attach.  If tuple, the elements are units\n            to attach in order corresponding to `Model.inputs`.\n        return_units : dict or tuple, optional\n            Output units to attach.  If dict, each key is the name of a model output,\n            and the value is the unit to attach.  If tuple, the elements are units\n            to attach in order corresponding to `Model.outputs`.\n        input_units_equivalencies : dict, optional\n            Default equivalencies to apply to input values.  If set, this should be a\n            dictionary where each key is a string that corresponds to one of the\n            model inputs.\n        input_units_allow_dimensionless : bool or dict, optional\n            Allow dimensionless input. If this is True, input values to evaluate will\n            gain the units specified in input_units. If this is a dictionary then it\n            should map input name to a bool to allow dimensionless numbers for that\n            input.\n\n        Returns\n        -------\n        `CompoundModel`\n            A `CompoundModel` composed of the current model plus\n            `~astropy.modeling.mappings.UnitsMapping` model(s) that attach the units.\n\n        Raises\n        ------\n        ValueError\n            If the current model already has units.\n\n        Examples\n        --------\n\n        Wrapping a unitless model to require and convert units:\n\n        >>> from astropy.modeling.models import Polynomial1D\n        >>> from astropy import units as u\n        >>> poly = Polynomial1D(1, c0=1, c1=2)\n        >>> model = poly.coerce_units((u.m,), (u.s,))\n        >>> model(u.Quantity(10, u.m))  # doctest: +FLOAT_CMP\n        <Quantity 21. s>\n        >>> model(u.Quantity(1000, u.cm))  # doctest: +FLOAT_CMP\n        <Quantity 21. s>\n        >>> model(u.Quantity(10, u.cm))  # doctest: +FLOAT_CMP\n        <Quantity 1.2 s>\n\n        Wrapping a unitless model but still permitting unitless input:\n\n        >>> from astropy.modeling.models import Polynomial1D\n        >>> from astropy import units as u\n        >>> poly = Polynomial1D(1, c0=1, c1=2)\n        >>> model = poly.coerce_units((u.m,), (u.s,), input_units_allow_dimensionless=True)\n        >>> model(u.Quantity(10, u.m))  # doctest: +FLOAT_CMP\n        <Quantity 21. s>\n        >>> model(10)  # doctest: +FLOAT_CMP\n        <Quantity 21. s>\n        \"\"\"\n        from .mappings import UnitsMapping\n\n        result = self\n\n        if input_units is not None:\n            if self.input_units is not None:\n                model_units = self.input_units\n            else:\n                model_units = {}\n\n            for unit in [model_units.get(i) for i in self.inputs]:\n                if unit is not None and unit != dimensionless_unscaled:\n                    raise ValueError(\"Cannot specify input_units for model with existing input units\")\n\n            if isinstance(input_units, dict):\n                if input_units.keys() != set(self.inputs):\n                    message = (\n                        f\"\"\"input_units keys ({\", \".join(input_units.keys())}) \"\"\"\n                        f\"\"\"do not match model inputs ({\", \".join(self.inputs)})\"\"\"\n                    )\n                    raise ValueError(message)\n                input_units = [input_units[i] for i in self.inputs]\n\n            if len(input_units) != self.n_inputs:\n                message = (\n                    \"input_units length does not match n_inputs: \"\n                    f\"expected {self.n_inputs}, received {len(input_units)}\"\n                )\n                raise ValueError(message)\n\n            mapping = tuple((unit, model_units.get(i)) for i, unit in zip(self.inputs, input_units))\n            input_mapping = UnitsMapping(\n                mapping,\n                input_units_equivalencies=input_units_equivalencies,\n                input_units_allow_dimensionless=input_units_allow_dimensionless\n            )\n            input_mapping.inputs = self.inputs\n            input_mapping.outputs = self.inputs\n            result = input_mapping | result\n\n        if return_units is not None:\n            if self.return_units is not None:\n                model_units = self.return_units\n            else:\n                model_units = {}\n\n            for unit in [model_units.get(i) for i in self.outputs]:\n                if unit is not None and unit != dimensionless_unscaled:\n                    raise ValueError(\"Cannot specify return_units for model with existing output units\")\n\n            if isinstance(return_units, dict):\n                if return_units.keys() != set(self.outputs):\n                    message = (\n                        f\"\"\"return_units keys ({\", \".join(return_units.keys())}) \"\"\"\n                        f\"\"\"do not match model outputs ({\", \".join(self.outputs)})\"\"\"\n                    )\n                    raise ValueError(message)\n                return_units = [return_units[i] for i in self.outputs]\n\n            if len(return_units) != self.n_outputs:\n                message = (\n                    \"return_units length does not match n_outputs: \"\n                    f\"expected {self.n_outputs}, received {len(return_units)}\"\n                )\n                raise ValueError(message)\n\n            mapping = tuple((model_units.get(i), unit) for i, unit in zip(self.outputs, return_units))\n            return_mapping = UnitsMapping(mapping)\n            return_mapping.inputs = self.outputs\n            return_mapping.outputs = self.outputs\n            result = result | return_mapping\n\n        return result\n\n    @property\n    def n_submodels(self):\n        \"\"\"\n        Return the number of components in a single model, which is\n        obviously 1.\n        \"\"\"\n        return 1\n\n    def _initialize_constraints(self, kwargs):\n        \"\"\"\n        Pop parameter constraint values off the keyword arguments passed to\n        `Model.__init__` and store them in private instance attributes.\n        \"\"\"\n\n        # Pop any constraints off the keyword arguments\n        for constraint in self.parameter_constraints:\n            values = kwargs.pop(constraint, {})\n            for ckey, cvalue in values.items():\n                param = getattr(self, ckey)\n                setattr(param, constraint, cvalue)\n        self._mconstraints = {}\n        for constraint in self.model_constraints:\n            values = kwargs.pop(constraint, [])\n            self._mconstraints[constraint] = values\n\n    def _initialize_parameters(self, args, kwargs):\n        \"\"\"\n        Initialize the _parameters array that stores raw parameter values for\n        all parameter sets for use with vectorized fitting algorithms; on\n        FittableModels the _param_name attributes actually just reference\n        slices of this array.\n        \"\"\"\n        n_models = kwargs.pop('n_models', None)\n\n        if not (n_models is None or\n                (isinstance(n_models, (int, np.integer)) and n_models >= 1)):\n            raise ValueError(\n                \"n_models must be either None (in which case it is \"\n                \"determined from the model_set_axis of the parameter initial \"\n                \"values) or it must be a positive integer \"\n                \"(got {0!r})\".format(n_models))\n\n        model_set_axis = kwargs.pop('model_set_axis', None)\n        if model_set_axis is None:\n            if n_models is not None and n_models > 1:\n                # Default to zero\n                model_set_axis = 0\n            else:\n                # Otherwise disable\n                model_set_axis = False\n        else:\n            if not (model_set_axis is False or\n                    np.issubdtype(type(model_set_axis), np.integer)):\n                raise ValueError(\n                    \"model_set_axis must be either False or an integer \"\n                    \"specifying the parameter array axis to map to each \"\n                    \"model in a set of models (got {0!r}).\".format(\n                        model_set_axis))\n\n        # Process positional arguments by matching them up with the\n        # corresponding parameters in self.param_names--if any also appear as\n        # keyword arguments this presents a conflict\n        params = set()\n        if len(args) > len(self.param_names):\n            raise TypeError(\n                \"{0}.__init__() takes at most {1} positional arguments ({2} \"\n                \"given)\".format(self.__class__.__name__, len(self.param_names),\n                                len(args)))\n\n        self._model_set_axis = model_set_axis\n        self._param_metrics = defaultdict(dict)\n\n        for idx, arg in enumerate(args):\n            if arg is None:\n                # A value of None implies using the default value, if exists\n                continue\n            # We use quantity_asanyarray here instead of np.asanyarray because\n            # if any of the arguments are quantities, we need to return a\n            # Quantity object not a plain Numpy array.\n            param_name = self.param_names[idx]\n            params.add(param_name)\n            if not isinstance(arg, Parameter):\n                value = quantity_asanyarray(arg, dtype=float)\n            else:\n                value = arg\n            self._initialize_parameter_value(param_name, value)\n\n        # At this point the only remaining keyword arguments should be\n        # parameter names; any others are in error.\n        for param_name in self.param_names:\n            if param_name in kwargs:\n                if param_name in params:\n                    raise TypeError(\n                        \"{0}.__init__() got multiple values for parameter \"\n                        \"{1!r}\".format(self.__class__.__name__, param_name))\n                value = kwargs.pop(param_name)\n                if value is None:\n                    continue\n                # We use quantity_asanyarray here instead of np.asanyarray\n                # because if any of the arguments are quantities, we need\n                # to return a Quantity object not a plain Numpy array.\n                value = quantity_asanyarray(value, dtype=float)\n                params.add(param_name)\n                self._initialize_parameter_value(param_name, value)\n        # Now deal with case where param_name is not supplied by args or kwargs\n        for param_name in self.param_names:\n            if param_name not in params:\n                self._initialize_parameter_value(param_name, None)\n\n        if kwargs:\n            # If any keyword arguments were left over at this point they are\n            # invalid--the base class should only be passed the parameter\n            # values, constraints, and param_dim\n            for kwarg in kwargs:\n                # Just raise an error on the first unrecognized argument\n                raise TypeError(\n                    '{0}.__init__() got an unrecognized parameter '\n                    '{1!r}'.format(self.__class__.__name__, kwarg))\n\n        # Determine the number of model sets: If the model_set_axis is\n        # None then there is just one parameter set; otherwise it is determined\n        # by the size of that axis on the first parameter--if the other\n        # parameters don't have the right number of axes or the sizes of their\n        # model_set_axis don't match an error is raised\n        if model_set_axis is not False and n_models != 1 and params:\n            max_ndim = 0\n            if model_set_axis < 0:\n                min_ndim = abs(model_set_axis)\n            else:\n                min_ndim = model_set_axis + 1\n\n            for name in self.param_names:\n                value = getattr(self, name)\n                param_ndim = np.ndim(value)\n                if param_ndim < min_ndim:\n                    raise InputParameterError(\n                        \"All parameter values must be arrays of dimension \"\n                        \"at least {0} for model_set_axis={1} (the value \"\n                        \"given for {2!r} is only {3}-dimensional)\".format(\n                            min_ndim, model_set_axis, name, param_ndim))\n\n                max_ndim = max(max_ndim, param_ndim)\n\n                if n_models is None:\n                    # Use the dimensions of the first parameter to determine\n                    # the number of model sets\n                    n_models = value.shape[model_set_axis]\n                elif value.shape[model_set_axis] != n_models:\n                    raise InputParameterError(\n                        \"Inconsistent dimensions for parameter {0!r} for \"\n                        \"{1} model sets.  The length of axis {2} must be the \"\n                        \"same for all input parameter values\".format(\n                            name, n_models, model_set_axis))\n\n            self._check_param_broadcast(max_ndim)\n        else:\n            if n_models is None:\n                n_models = 1\n\n            self._check_param_broadcast(None)\n\n        self._n_models = n_models\n        # now validate parameters\n        for name in params:\n            param = getattr(self, name)\n            if param._validator is not None:\n                param._validator(self, param.value)\n\n    def _initialize_parameter_value(self, param_name, value):\n        \"\"\"Mostly deals with consistency checks and determining unit issues.\"\"\"\n        if isinstance(value, Parameter):\n            self.__dict__[param_name] = value\n            return\n        param = getattr(self, param_name)\n        # Use default if value is not provided\n        if value is None:\n            default = param.default\n            if default is None:\n                # No value was supplied for the parameter and the\n                # parameter does not have a default, therefore the model\n                # is underspecified\n                raise TypeError(\"{0}.__init__() requires a value for parameter \"\n                                \"{1!r}\".format(self.__class__.__name__, param_name))\n            value = default\n            unit = param.unit\n        else:\n            if isinstance(value, Quantity):\n                unit = value.unit\n                value = value.value\n            else:\n                unit = None\n        if unit is None and param.unit is not None:\n            raise InputParameterError(\n                \"{0}.__init__() requires a Quantity for parameter \"\n                \"{1!r}\".format(self.__class__.__name__, param_name))\n        param._unit = unit\n        param.internal_unit = None\n        if param._setter is not None:\n            if unit is not None:\n                _val = param._setter(value * unit)\n            else:\n                _val = param._setter(value)\n            if isinstance(_val, Quantity):\n                param.internal_unit = _val.unit\n                param._internal_value = np.array(_val.value)\n            else:\n                param.internal_unit = None\n                param._internal_value = np.array(_val)\n        else:\n            param._value = np.array(value)\n\n    def _initialize_slices(self):\n\n        param_metrics = self._param_metrics\n        total_size = 0\n\n        for name in self.param_names:\n            param = getattr(self, name)\n            value = param.value\n            param_size = np.size(value)\n            param_shape = np.shape(value)\n            param_slice = slice(total_size, total_size + param_size)\n            param_metrics[name]['slice'] = param_slice\n            param_metrics[name]['shape'] = param_shape\n            param_metrics[name]['size'] = param_size\n            total_size += param_size\n        self._parameters = np.empty(total_size, dtype=np.float64)\n\n    def _parameters_to_array(self):\n        # Now set the parameter values (this will also fill\n        # self._parameters)\n        param_metrics = self._param_metrics\n        for name in self.param_names:\n            param = getattr(self, name)\n            value = param.value\n            if not isinstance(value, np.ndarray):\n                value = np.array([value])\n            self._parameters[param_metrics[name]['slice']] = value.ravel()\n\n        # Finally validate all the parameters; we do this last so that\n        # validators that depend on one of the other parameters' values will\n        # work\n\n    def _array_to_parameters(self):\n        param_metrics = self._param_metrics\n        for name in self.param_names:\n            param = getattr(self, name)\n            value = self._parameters[param_metrics[name]['slice']]\n            value.shape = param_metrics[name]['shape']\n            param.value = value\n\n    def _check_param_broadcast(self, max_ndim):\n        \"\"\"\n        This subroutine checks that all parameter arrays can be broadcast\n        against each other, and determines the shapes parameters must have in\n        order to broadcast correctly.\n\n        If model_set_axis is None this merely checks that the parameters\n        broadcast and returns an empty dict if so.  This mode is only used for\n        single model sets.\n        \"\"\"\n        all_shapes = []\n        model_set_axis = self._model_set_axis\n\n        for name in self.param_names:\n            param = getattr(self, name)\n            value = param.value\n            param_shape = np.shape(value)\n            param_ndim = len(param_shape)\n            if max_ndim is not None and param_ndim < max_ndim:\n                # All arrays have the same number of dimensions up to the\n                # model_set_axis dimension, but after that they may have a\n                # different number of trailing axes.  The number of trailing\n                # axes must be extended for mutual compatibility.  For example\n                # if max_ndim = 3 and model_set_axis = 0, an array with the\n                # shape (2, 2) must be extended to (2, 1, 2).  However, an\n                # array with shape (2,) is extended to (2, 1).\n                new_axes = (1,) * (max_ndim - param_ndim)\n\n                if model_set_axis < 0:\n                    # Just need to prepend axes to make up the difference\n                    broadcast_shape = new_axes + param_shape\n                else:\n                    broadcast_shape = (param_shape[:model_set_axis + 1] +\n                                       new_axes +\n                                       param_shape[model_set_axis + 1:])\n                self._param_metrics[name]['broadcast_shape'] = broadcast_shape\n                all_shapes.append(broadcast_shape)\n            else:\n                all_shapes.append(param_shape)\n\n        # Now check mutual broadcastability of all shapes\n        try:\n            check_broadcast(*all_shapes)\n        except IncompatibleShapeError as exc:\n            shape_a, shape_a_idx, shape_b, shape_b_idx = exc.args\n            param_a = self.param_names[shape_a_idx]\n            param_b = self.param_names[shape_b_idx]\n\n            raise InputParameterError(\n                \"Parameter {0!r} of shape {1!r} cannot be broadcast with \"\n                \"parameter {2!r} of shape {3!r}.  All parameter arrays \"\n                \"must have shapes that are mutually compatible according \"\n                \"to the broadcasting rules.\".format(param_a, shape_a,\n                                                    param_b, shape_b))\n\n    def _param_sets(self, raw=False, units=False):\n        \"\"\"\n        Implementation of the Model.param_sets property.\n\n        This internal implementation has a ``raw`` argument which controls\n        whether or not to return the raw parameter values (i.e. the values that\n        are actually stored in the ._parameters array, as opposed to the values\n        displayed to users.  In most cases these are one in the same but there\n        are currently a few exceptions.\n\n        Note: This is notably an overcomplicated device and may be removed\n        entirely in the near future.\n        \"\"\"\n\n        values = []\n        shapes = []\n        for name in self.param_names:\n            param = getattr(self, name)\n\n            if raw and param._setter:\n                value = param._internal_value\n            else:\n                value = param.value\n\n            broadcast_shape = self._param_metrics[name].get('broadcast_shape')\n            if broadcast_shape is not None:\n                value = value.reshape(broadcast_shape)\n\n            shapes.append(np.shape(value))\n\n            if len(self) == 1:\n                # Add a single param set axis to the parameter's value (thus\n                # converting scalars to shape (1,) array values) for\n                # consistency\n                value = np.array([value])\n\n            if units:\n                if raw and param.internal_unit is not None:\n                    unit = param.internal_unit\n                else:\n                    unit = param.unit\n                if unit is not None:\n                    value = Quantity(value, unit)\n\n            values.append(value)\n\n        if len(set(shapes)) != 1 or units:\n            # If the parameters are not all the same shape, converting to an\n            # array is going to produce an object array\n            # However the way Numpy creates object arrays is tricky in that it\n            # will recurse into array objects in the list and break them up\n            # into separate objects.  Doing things this way ensures a 1-D\n            # object array the elements of which are the individual parameter\n            # arrays.  There's not much reason to do this over returning a list\n            # except for consistency\n            psets = np.empty(len(values), dtype=object)\n            psets[:] = values\n            return psets\n\n        return np.array(values)\n\n    def _format_repr(self, args=[], kwargs={}, defaults={}):\n        \"\"\"\n        Internal implementation of ``__repr__``.\n\n        This is separated out for ease of use by subclasses that wish to\n        override the default ``__repr__`` while keeping the same basic\n        formatting.\n        \"\"\"\n\n        parts = [repr(a) for a in args]\n\n        parts.extend(\n            f\"{name}={param_repr_oneline(getattr(self, name))}\"\n            for name in self.param_names)\n\n        if self.name is not None:\n            parts.append(f'name={self.name!r}')\n\n        for kwarg, value in kwargs.items():\n            if kwarg in defaults and defaults[kwarg] == value:\n                continue\n            parts.append(f'{kwarg}={value!r}')\n\n        if len(self) > 1:\n            parts.append(f\"n_models={len(self)}\")\n\n        return f\"<{self.__class__.__name__}({', '.join(parts)})>\"\n\n    def _format_str(self, keywords=[], defaults={}):\n        \"\"\"\n        Internal implementation of ``__str__``.\n\n        This is separated out for ease of use by subclasses that wish to\n        override the default ``__str__`` while keeping the same basic\n        formatting.\n        \"\"\"\n\n        default_keywords = [\n            ('Model', self.__class__.__name__),\n            ('Name', self.name),\n            ('Inputs', self.inputs),\n            ('Outputs', self.outputs),\n            ('Model set size', len(self))\n        ]\n\n        parts = [f'{keyword}: {value}'\n                 for keyword, value in default_keywords\n                 if value is not None]\n\n        for keyword, value in keywords:\n            if keyword.lower() in defaults and defaults[keyword.lower()] == value:\n                continue\n            parts.append(f'{keyword}: {value}')\n        parts.append('Parameters:')\n\n        if len(self) == 1:\n            columns = [[getattr(self, name).value]\n                       for name in self.param_names]\n        else:\n            columns = [getattr(self, name).value\n                       for name in self.param_names]\n\n        if columns:\n            param_table = Table(columns, names=self.param_names)\n            # Set units on the columns\n            for name in self.param_names:\n                param_table[name].unit = getattr(self, name).unit\n            parts.append(indent(str(param_table), width=4))\n\n        return '\\n'.join(parts)\n\n\nclass FittableModel(Model):\n    \"\"\"\n    Base class for models that can be fitted using the built-in fitting\n    algorithms.\n    \"\"\"\n\n    linear = False\n    # derivative with respect to parameters\n    fit_deriv = None\n    \"\"\"\n    Function (similar to the model's `~Model.evaluate`) to compute the\n    derivatives of the model with respect to its parameters, for use by fitting\n    algorithms.  In other words, this computes the Jacobian matrix with respect\n    to the model's parameters.\n    \"\"\"\n    # Flag that indicates if the model derivatives with respect to parameters\n    # are given in columns or rows\n    col_fit_deriv = True\n    fittable = True\n\n\nclass Fittable1DModel(FittableModel):\n    \"\"\"\n    Base class for one-dimensional fittable models.\n\n    This class provides an easier interface to defining new models.\n    Examples can be found in `astropy.modeling.functional_models`.\n    \"\"\"\n    n_inputs = 1\n    n_outputs = 1\n    _separable = True\n\n\nclass Fittable2DModel(FittableModel):\n    \"\"\"\n    Base class for two-dimensional fittable models.\n\n    This class provides an easier interface to defining new models.\n    Examples can be found in `astropy.modeling.functional_models`.\n    \"\"\"\n\n    n_inputs = 2\n    n_outputs = 1\n\n\ndef _make_arithmetic_operator(oper):\n    # We don't bother with tuple unpacking here for efficiency's sake, but for\n    # documentation purposes:\n    #\n    #     f_eval, f_n_inputs, f_n_outputs = f\n    #\n    # and similarly for g\n    def op(f, g):\n        return (make_binary_operator_eval(oper, f[0], g[0]), f[1], f[2])\n\n    return op\n\n\ndef _composition_operator(f, g):\n    # We don't bother with tuple unpacking here for efficiency's sake, but for\n    # documentation purposes:\n    #\n    #     f_eval, f_n_inputs, f_n_outputs = f\n    #\n    # and similarly for g\n    return (lambda inputs, params: g[0](f[0](inputs, params), params),\n            f[1], g[2])\n\n\ndef _join_operator(f, g):\n    # We don't bother with tuple unpacking here for efficiency's sake, but for\n    # documentation purposes:\n    #\n    #     f_eval, f_n_inputs, f_n_outputs = f\n    #\n    # and similarly for g\n    return (lambda inputs, params: (f[0](inputs[:f[1]], params) +\n                                    g[0](inputs[f[1]:], params)),\n            f[1] + g[1], f[2] + g[2])\n\n\nBINARY_OPERATORS = {\n    '+': _make_arithmetic_operator(operator.add),\n    '-': _make_arithmetic_operator(operator.sub),\n    '*': _make_arithmetic_operator(operator.mul),\n    '/': _make_arithmetic_operator(operator.truediv),\n    '**': _make_arithmetic_operator(operator.pow),\n    '|': _composition_operator,\n    '&': _join_operator\n}\n\nSPECIAL_OPERATORS = _SpecialOperatorsDict()\n\n\ndef _add_special_operator(sop_name, sop):\n    return SPECIAL_OPERATORS.add(sop_name, sop)\n\n\nclass CompoundModel(Model):\n    '''\n    Base class for compound models.\n\n    While it can be used directly, the recommended way\n    to combine models is through the model operators.\n    '''\n\n    def __init__(self, op, left, right, name=None):\n        self.__dict__['_param_names'] = None\n        self._n_submodels = None\n        self.op = op\n        self.left = left\n        self.right = right\n        self._bounding_box = None\n        self._user_bounding_box = None\n        self._leaflist = None\n        self._tdict = None\n        self._parameters = None\n        self._parameters_ = None\n        self._param_metrics = None\n\n        if op != 'fix_inputs' and len(left) != len(right):\n            raise ValueError(\n                'Both operands must have equal values for n_models')\n        self._n_models = len(left)\n\n        if op != 'fix_inputs' and ((left.model_set_axis != right.model_set_axis)\n                                   or left.model_set_axis):  # not False and not 0\n            raise ValueError(\"model_set_axis must be False or 0 and consistent for operands\")\n        self._model_set_axis = left.model_set_axis\n\n        if op in ['+', '-', '*', '/', '**'] or op in SPECIAL_OPERATORS:\n            if (left.n_inputs != right.n_inputs) or \\\n               (left.n_outputs != right.n_outputs):\n                raise ModelDefinitionError(\n                    'Both operands must match numbers of inputs and outputs')\n            self.n_inputs = left.n_inputs\n            self.n_outputs = left.n_outputs\n            self.inputs = left.inputs\n            self.outputs = left.outputs\n        elif op == '&':\n            self.n_inputs = left.n_inputs + right.n_inputs\n            self.n_outputs = left.n_outputs + right.n_outputs\n            self.inputs = combine_labels(left.inputs, right.inputs)\n            self.outputs = combine_labels(left.outputs, right.outputs)\n        elif op == '|':\n            if left.n_outputs != right.n_inputs:\n                raise ModelDefinitionError(\n                    \"Unsupported operands for |: {0} (n_inputs={1}, \"\n                    \"n_outputs={2}) and {3} (n_inputs={4}, n_outputs={5}); \"\n                    \"n_outputs for the left-hand model must match n_inputs \"\n                    \"for the right-hand model.\".format(\n                        left.name, left.n_inputs, left.n_outputs, right.name,\n                        right.n_inputs, right.n_outputs))\n\n            self.n_inputs = left.n_inputs\n            self.n_outputs = right.n_outputs\n            self.inputs = left.inputs\n            self.outputs = right.outputs\n        elif op == 'fix_inputs':\n            if not isinstance(left, Model):\n                raise ValueError('First argument to \"fix_inputs\" must be an instance of an astropy Model.')\n            if not isinstance(right, dict):\n                raise ValueError('Expected a dictionary for second argument of \"fix_inputs\".')\n\n            # Dict keys must match either possible indices\n            # for model on left side, or names for inputs.\n            self.n_inputs = left.n_inputs - len(right)\n            # Assign directly to the private attribute (instead of using the setter)\n            # to avoid asserting the new number of outputs matches the old one.\n            self._outputs = left.outputs\n            self.n_outputs = left.n_outputs\n            newinputs = list(left.inputs)\n            keys = right.keys()\n            input_ind = []\n            for key in keys:\n                if np.issubdtype(type(key), np.integer):\n                    if key >= left.n_inputs or key < 0:\n                        raise ValueError(\n                            'Substitution key integer value '\n                            'not among possible input choices.')\n                    if key in input_ind:\n                        raise ValueError(\"Duplicate specification of \"\n                                         \"same input (index/name).\")\n                    input_ind.append(key)\n                elif isinstance(key, str):\n                    if key not in left.inputs:\n                        raise ValueError(\n                            'Substitution key string not among possible '\n                            'input choices.')\n                    # Check to see it doesn't match positional\n                    # specification.\n                    ind = left.inputs.index(key)\n                    if ind in input_ind:\n                        raise ValueError(\"Duplicate specification of \"\n                                         \"same input (index/name).\")\n                    input_ind.append(ind)\n            # Remove substituted inputs\n            input_ind.sort()\n            input_ind.reverse()\n            for ind in input_ind:\n                del newinputs[ind]\n            self.inputs = tuple(newinputs)\n            # Now check to see if the input model has bounding_box defined.\n            # If so, remove the appropriate dimensions and set it for this\n            # instance.\n            try:\n                self.bounding_box = \\\n                    self.left.bounding_box.fix_inputs(self, right)\n            except NotImplementedError:\n                pass\n\n        else:\n            raise ModelDefinitionError('Illegal operator: ', self.op)\n        self.name = name\n        self._fittable = None\n        self.fit_deriv = None\n        self.col_fit_deriv = None\n        if op in ('|', '+', '-'):\n            self.linear = left.linear and right.linear\n        else:\n            self.linear = False\n        self.eqcons = []\n        self.ineqcons = []\n        self.n_left_params = len(self.left.parameters)\n        self._map_parameters()\n\n    def _get_left_inputs_from_args(self, args):\n        return args[:self.left.n_inputs]\n\n    def _get_right_inputs_from_args(self, args):\n        op = self.op\n        if op == '&':\n            # Args expected to look like (*left inputs, *right inputs, *left params, *right params)\n            return args[self.left.n_inputs: self.left.n_inputs + self.right.n_inputs]\n        elif op == '|' or  op == 'fix_inputs':\n            return None\n        else:\n            return args[:self.left.n_inputs]\n\n    def _get_left_params_from_args(self, args):\n        op = self.op\n        if op == '&':\n            # Args expected to look like (*left inputs, *right inputs, *left params, *right params)\n            n_inputs = self.left.n_inputs + self.right.n_inputs\n            return args[n_inputs: n_inputs + self.n_left_params]\n        else:\n            return args[self.left.n_inputs: self.left.n_inputs + self.n_left_params]\n\n    def _get_right_params_from_args(self, args):\n        op = self.op\n        if op == 'fix_inputs':\n            return None\n        if op == '&':\n            # Args expected to look like (*left inputs, *right inputs, *left params, *right params)\n            return args[self.left.n_inputs + self.right.n_inputs + self.n_left_params:]\n        else:\n            return args[self.left.n_inputs + self.n_left_params:]\n\n    def _get_kwarg_model_parameters_as_positional(self, args, kwargs):\n        # could do it with inserts but rebuilding seems like simpilist way\n\n        #TODO: Check if any param names are in kwargs maybe as an intersection of sets?\n        if self.op == \"&\":\n            new_args = list(args[:self.left.n_inputs + self.right.n_inputs])\n            args_pos = self.left.n_inputs + self.right.n_inputs\n        else:\n            new_args = list(args[:self.left.n_inputs])\n            args_pos = self.left.n_inputs\n\n        for param_name in self.param_names:\n            kw_value = kwargs.pop(param_name, None)\n            if kw_value is not None:\n                value = kw_value\n            else:\n                try:\n                    value = args[args_pos]\n                except IndexError:\n                    raise IndexError(\"Missing parameter or input\")\n\n                args_pos += 1\n            new_args.append(value)\n\n        return new_args, kwargs\n\n    def _apply_operators_to_value_lists(self, leftval, rightval, **kw):\n        op = self.op\n        if op == '+':\n            return binary_operation(operator.add, leftval, rightval)\n        elif op == '-':\n            return binary_operation(operator.sub, leftval, rightval)\n        elif op == '*':\n            return binary_operation(operator.mul, leftval, rightval)\n        elif op == '/':\n            return binary_operation(operator.truediv, leftval, rightval)\n        elif op == '**':\n            return binary_operation(operator.pow, leftval, rightval)\n        elif op == '&':\n            if not isinstance(leftval, tuple):\n                leftval = (leftval,)\n            if not isinstance(rightval, tuple):\n                rightval = (rightval,)\n            return leftval + rightval\n        elif op in SPECIAL_OPERATORS:\n            return binary_operation(SPECIAL_OPERATORS[op], leftval, rightval)\n        else:\n            raise ModelDefinitionError('Unrecognized operator {op}')\n\n    def evaluate(self, *args, **kw):\n        op = self.op\n        args, kw = self._get_kwarg_model_parameters_as_positional(args, kw)\n        left_inputs = self._get_left_inputs_from_args(args)\n        left_params = self._get_left_params_from_args(args)\n\n        if op == 'fix_inputs':\n            pos_index = dict(zip(self.left.inputs, range(self.left.n_inputs)))\n            fixed_inputs = {\n                key if np.issubdtype(type(key), np.integer) else pos_index[key]: value\n                for key, value in self.right.items()\n            }\n            left_inputs = [\n                fixed_inputs[ind] if ind in fixed_inputs.keys() else inp\n                for ind, inp in enumerate(left_inputs)\n            ]\n\n        leftval = self.left.evaluate(*itertools.chain(left_inputs, left_params))\n\n        if op == 'fix_inputs':\n            return leftval\n\n        right_inputs = self._get_right_inputs_from_args(args)\n        right_params = self._get_right_params_from_args(args)\n\n        if op == \"|\":\n            if isinstance(leftval, tuple):\n                return self.right.evaluate(*itertools.chain(leftval, right_params))\n            else:\n                return self.right.evaluate(leftval, *right_params)\n        else:\n            rightval = self.right.evaluate(*itertools.chain(right_inputs, right_params))\n\n        return self._apply_operators_to_value_lists(leftval, rightval, **kw)\n\n    @property\n    def n_submodels(self):\n        if self._leaflist is None:\n            self._make_leaflist()\n        return len(self._leaflist)\n\n    @property\n    def submodel_names(self):\n        \"\"\" Return the names of submodels in a ``CompoundModel``.\"\"\"\n        if self._leaflist is None:\n            self._make_leaflist()\n        names = [item.name for item in self._leaflist]\n        nonecount = 0\n        newnames = []\n        for item in names:\n            if item is None:\n                newnames.append(f'None_{nonecount}')\n                nonecount += 1\n            else:\n                newnames.append(item)\n        return tuple(newnames)\n\n    def both_inverses_exist(self):\n        '''\n        if both members of this compound model have inverses return True\n        '''\n        warnings.warn(\n            \"CompoundModel.both_inverses_exist is deprecated. \"\n            \"Use has_inverse instead.\",\n            AstropyDeprecationWarning\n        )\n\n        try:\n            linv = self.left.inverse\n            rinv = self.right.inverse\n        except NotImplementedError:\n            return False\n\n        return True\n\n    def _pre_evaluate(self, *args, **kwargs):\n        \"\"\"\n        CompoundModel specific input setup that needs to occur prior to\n            model evaluation.\n\n        Note\n        ----\n            All of the _pre_evaluate for each component model will be\n            performed at the time that the individual model is evaluated.\n        \"\"\"\n\n        # If equivalencies are provided, necessary to map parameters and pass\n        # the leaflist as a keyword input for use by model evaluation so that\n        # the compound model input names can be matched to the model input\n        # names.\n        if 'equivalencies' in kwargs:\n            # Restructure to be useful for the individual model lookup\n            kwargs['inputs_map'] = [(value[0], (value[1], key)) for\n                                    key, value in self.inputs_map().items()]\n\n        # Setup actual model evaluation method\n        def evaluate(_inputs):\n            return self._evaluate(*_inputs, **kwargs)\n\n        return evaluate, args, None, kwargs\n\n    @property\n    def _argnames(self):\n        \"\"\"No inputs should be used to determine input_shape when handling compound models\"\"\"\n        return ()\n\n    def _post_evaluate(self, inputs, outputs, broadcasted_shapes, with_bbox, **kwargs):\n        \"\"\"\n        CompoundModel specific post evaluation processing of outputs\n\n        Note\n        ----\n            All of the _post_evaluate for each component model will be\n            performed at the time that the individual model is evaluated.\n        \"\"\"\n        if self.get_bounding_box(with_bbox) is not None and self.n_outputs == 1:\n            return outputs[0]\n        return outputs\n\n    def _evaluate(self, *args, **kw):\n        op = self.op\n        if op != 'fix_inputs':\n            if op != '&':\n                leftval = self.left(*args, **kw)\n                if op != '|':\n                    rightval = self.right(*args, **kw)\n                else:\n                    rightval = None\n\n            else:\n                leftval = self.left(*(args[:self.left.n_inputs]), **kw)\n                rightval = self.right(*(args[self.left.n_inputs:]), **kw)\n\n            if op != \"|\":\n                return self._apply_operators_to_value_lists(leftval, rightval, **kw)\n\n            elif op == '|':\n                if isinstance(leftval, tuple):\n                    return self.right(*leftval, **kw)\n                else:\n                    return self.right(leftval, **kw)\n\n        else:\n            subs = self.right\n            newargs = list(args)\n            subinds = []\n            subvals = []\n            for key in subs.keys():\n                if np.issubdtype(type(key), np.integer):\n                    subinds.append(key)\n                elif isinstance(key, str):\n                    ind = self.left.inputs.index(key)\n                    subinds.append(ind)\n                subvals.append(subs[key])\n            # Turn inputs specified in kw into positional indices.\n            # Names for compound inputs do not propagate to sub models.\n            kwind = []\n            kwval = []\n            for kwkey in list(kw.keys()):\n                if kwkey in self.inputs:\n                    ind = self.inputs.index(kwkey)\n                    if ind < len(args):\n                        raise ValueError(\"Keyword argument duplicates \"\n                                         \"positional value supplied.\")\n                    kwind.append(ind)\n                    kwval.append(kw[kwkey])\n                    del kw[kwkey]\n            # Build new argument list\n            # Append keyword specified args first\n            if kwind:\n                kwargs = list(zip(kwind, kwval))\n                kwargs.sort()\n                kwindsorted, kwvalsorted = list(zip(*kwargs))\n                newargs = newargs + list(kwvalsorted)\n            if subinds:\n                subargs = list(zip(subinds, subvals))\n                subargs.sort()\n                # subindsorted, subvalsorted = list(zip(*subargs))\n                # The substitutions must be inserted in order\n                for ind, val in subargs:\n                    newargs.insert(ind, val)\n            return self.left(*newargs, **kw)\n\n    @property\n    def param_names(self):\n        \"\"\" An ordered list of parameter names.\"\"\"\n        return self._param_names\n\n    def _make_leaflist(self):\n        tdict = {}\n        leaflist = []\n        make_subtree_dict(self, '', tdict, leaflist)\n        self._leaflist = leaflist\n        self._tdict = tdict\n\n    def __getattr__(self, name):\n        \"\"\"\n        If someone accesses an attribute not already defined, map the\n        parameters, and then see if the requested attribute is one of\n        the parameters\n        \"\"\"\n        # The following test is needed to avoid infinite recursion\n        # caused by deepcopy. There may be other such cases discovered.\n        if name == '__setstate__':\n            raise AttributeError\n        if name in self._param_names:\n            return self.__dict__[name]\n        else:\n            raise AttributeError(f'Attribute \"{name}\" not found')\n\n    def __getitem__(self, index):\n        if self._leaflist is None:\n            self._make_leaflist()\n        leaflist = self._leaflist\n        tdict = self._tdict\n        if isinstance(index, slice):\n            if index.step:\n                raise ValueError('Steps in slices not supported '\n                                 'for compound models')\n            if index.start is not None:\n                if isinstance(index.start, str):\n                    start = self._str_index_to_int(index.start)\n                else:\n                    start = index.start\n            else:\n                start = 0\n            if index.stop is not None:\n                if isinstance(index.stop, str):\n                    stop = self._str_index_to_int(index.stop)\n                else:\n                    stop = index.stop - 1\n            else:\n                stop = len(leaflist) - 1\n            if index.stop == 0:\n                raise ValueError(\"Slice endpoint cannot be 0\")\n            if start < 0:\n                start = len(leaflist) + start\n            if stop < 0:\n                stop = len(leaflist) + stop\n            # now search for matching node:\n            if stop == start:  # only single value, get leaf instead in code below\n                index = start\n            else:\n                for key in tdict:\n                    node, leftind, rightind = tdict[key]\n                    if leftind == start and rightind == stop:\n                        return node\n                raise IndexError(\"No appropriate subtree matches slice\")\n        if isinstance(index, type(0)):\n            return leaflist[index]\n        elif isinstance(index, type('')):\n            return leaflist[self._str_index_to_int(index)]\n        else:\n            raise TypeError('index must be integer, slice, or model name string')\n\n    def _str_index_to_int(self, str_index):\n        # Search through leaflist for item with that name\n        found = []\n        for nleaf, leaf in enumerate(self._leaflist):\n            if getattr(leaf, 'name', None) == str_index:\n                found.append(nleaf)\n        if len(found) == 0:\n            raise IndexError(f\"No component with name '{str_index}' found\")\n        if len(found) > 1:\n            raise IndexError(\"Multiple components found using '{}' as name\\n\"\n                             \"at indices {}\".format(str_index, found))\n        return found[0]\n\n    @property\n    def n_inputs(self):\n        \"\"\" The number of inputs of a model.\"\"\"\n        return self._n_inputs\n\n    @n_inputs.setter\n    def n_inputs(self, value):\n        self._n_inputs = value\n\n    @property\n    def n_outputs(self):\n        \"\"\" The number of outputs of a model.\"\"\"\n        return self._n_outputs\n\n    @n_outputs.setter\n    def n_outputs(self, value):\n        self._n_outputs = value\n\n    @property\n    def eqcons(self):\n        return self._eqcons\n\n    @eqcons.setter\n    def eqcons(self, value):\n        self._eqcons = value\n\n    @property\n    def ineqcons(self):\n        return self._eqcons\n\n    @ineqcons.setter\n    def ineqcons(self, value):\n        self._eqcons = value\n\n    def traverse_postorder(self, include_operator=False):\n        \"\"\" Postorder traversal of the CompoundModel tree.\"\"\"\n        res = []\n        if isinstance(self.left, CompoundModel):\n            res = res + self.left.traverse_postorder(include_operator)\n        else:\n            res = res + [self.left]\n        if isinstance(self.right, CompoundModel):\n            res = res + self.right.traverse_postorder(include_operator)\n        else:\n            res = res + [self.right]\n        if include_operator:\n            res.append(self.op)\n        else:\n            res.append(self)\n        return res\n\n    def _format_expression(self, format_leaf=None):\n        leaf_idx = 0\n        operands = deque()\n\n        if format_leaf is None:\n            format_leaf = lambda i, l: f'[{i}]'\n\n        for node in self.traverse_postorder():\n            if not isinstance(node, CompoundModel):\n                operands.append(format_leaf(leaf_idx, node))\n                leaf_idx += 1\n                continue\n\n            right = operands.pop()\n            left = operands.pop()\n            if node.op in OPERATOR_PRECEDENCE:\n                oper_order = OPERATOR_PRECEDENCE[node.op]\n\n                if isinstance(node, CompoundModel):\n                    if (isinstance(node.left, CompoundModel) and\n                            OPERATOR_PRECEDENCE[node.left.op] < oper_order):\n                        left = f'({left})'\n                    if (isinstance(node.right, CompoundModel) and\n                            OPERATOR_PRECEDENCE[node.right.op] < oper_order):\n                        right = f'({right})'\n\n                operands.append(' '.join((left, node.op, right)))\n            else:\n                left = f'(({left}),'\n                right = f'({right}))'\n                operands.append(' '.join((node.op[0], left, right)))\n\n        return ''.join(operands)\n\n    def _format_components(self):\n        if self._parameters_ is None:\n            self._map_parameters()\n        return '\\n\\n'.join('[{0}]: {1!r}'.format(idx, m)\n                           for idx, m in enumerate(self._leaflist))\n\n    def __str__(self):\n        expression = self._format_expression()\n        components = self._format_components()\n        keywords = [\n            ('Expression', expression),\n            ('Components', '\\n' + indent(components))\n        ]\n        return super()._format_str(keywords=keywords)\n\n    def rename(self, name):\n        self.name = name\n        return self\n\n    @property\n    def isleaf(self):\n        return False\n\n    @property\n    def inverse(self):\n        if self.op == '|':\n            return self.right.inverse | self.left.inverse\n        elif self.op == '&':\n            return self.left.inverse & self.right.inverse\n        else:\n            return NotImplemented\n\n    @property\n    def fittable(self):\n        \"\"\" Set the fittable attribute on a compound model.\"\"\"\n        if self._fittable is None:\n            if self._leaflist is None:\n                self._map_parameters()\n            self._fittable = all(m.fittable for m in self._leaflist)\n        return self._fittable\n\n    __add__ = _model_oper('+')\n    __sub__ = _model_oper('-')\n    __mul__ = _model_oper('*')\n    __truediv__ = _model_oper('/')\n    __pow__ = _model_oper('**')\n    __or__ = _model_oper('|')\n    __and__ = _model_oper('&')\n\n    def _map_parameters(self):\n        \"\"\"\n        Map all the constituent model parameters to the compound object,\n        renaming as necessary by appending a suffix number.\n\n        This can be an expensive operation, particularly for a complex\n        expression tree.\n\n        All the corresponding parameter attributes are created that one\n        expects for the Model class.\n\n        The parameter objects that the attributes point to are the same\n        objects as in the constiutent models. Changes made to parameter\n        values to either are seen by both.\n\n        Prior to calling this, none of the associated attributes will\n        exist. This method must be called to make the model usable by\n        fitting engines.\n\n        If oldnames=True, then parameters are named as in the original\n        implementation of compound models.\n        \"\"\"\n        if self._parameters is not None:\n            # do nothing\n            return\n        if self._leaflist is None:\n            self._make_leaflist()\n        self._parameters_ = {}\n        param_map = {}\n        self._param_names = []\n        for lindex, leaf in enumerate(self._leaflist):\n            if not isinstance(leaf, dict):\n                for param_name in leaf.param_names:\n                    param = getattr(leaf, param_name)\n                    new_param_name = f\"{param_name}_{lindex}\"\n                    self.__dict__[new_param_name] = param\n                    self._parameters_[new_param_name] = param\n                    self._param_names.append(new_param_name)\n                    param_map[new_param_name] = (lindex, param_name)\n        self._param_metrics = {}\n        self._param_map = param_map\n        self._param_map_inverse = dict((v, k) for k, v in param_map.items())\n        self._initialize_slices()\n        self._param_names = tuple(self._param_names)\n\n    def _initialize_slices(self):\n        param_metrics = self._param_metrics\n        total_size = 0\n\n        for name in self.param_names:\n            param = getattr(self, name)\n            value = param.value\n            param_size = np.size(value)\n            param_shape = np.shape(value)\n            param_slice = slice(total_size, total_size + param_size)\n            param_metrics[name] = {}\n            param_metrics[name]['slice'] = param_slice\n            param_metrics[name]['shape'] = param_shape\n            param_metrics[name]['size'] = param_size\n            total_size += param_size\n        self._parameters = np.empty(total_size, dtype=np.float64)\n\n    @staticmethod\n    def _recursive_lookup(branch, adict, key):\n        if isinstance(branch, CompoundModel):\n            return adict[key]\n        return branch, key\n\n    def inputs_map(self):\n        \"\"\"\n        Map the names of the inputs to this ExpressionTree to the inputs to the leaf models.\n        \"\"\"\n        inputs_map = {}\n        if not isinstance(self.op, str):  # If we don't have an operator the mapping is trivial\n            return {inp: (self, inp) for inp in self.inputs}\n\n        elif self.op == '|':\n            if isinstance(self.left, CompoundModel):\n                l_inputs_map = self.left.inputs_map()\n            for inp in self.inputs:\n                if isinstance(self.left, CompoundModel):\n                    inputs_map[inp] = l_inputs_map[inp]\n                else:\n                    inputs_map[inp] = self.left, inp\n        elif self.op == '&':\n            if isinstance(self.left, CompoundModel):\n                l_inputs_map = self.left.inputs_map()\n            if isinstance(self.right, CompoundModel):\n                r_inputs_map = self.right.inputs_map()\n            for i, inp in enumerate(self.inputs):\n                if i < len(self.left.inputs):  # Get from left\n                    if isinstance(self.left, CompoundModel):\n                        inputs_map[inp] = l_inputs_map[self.left.inputs[i]]\n                    else:\n                        inputs_map[inp] = self.left, self.left.inputs[i]\n                else:  # Get from right\n                    if isinstance(self.right, CompoundModel):\n                        inputs_map[inp] = r_inputs_map[self.right.inputs[i - len(self.left.inputs)]]\n                    else:\n                        inputs_map[inp] = self.right, self.right.inputs[i - len(self.left.inputs)]\n        elif self.op == 'fix_inputs':\n            fixed_ind = list(self.right.keys())\n            ind = [list(self.left.inputs).index(i) if isinstance(i, str) else i for i in fixed_ind]\n            inp_ind = list(range(self.left.n_inputs))\n            for i in ind:\n                inp_ind.remove(i)\n            for i in inp_ind:\n                inputs_map[self.left.inputs[i]] = self.left, self.left.inputs[i]\n        else:\n            if isinstance(self.left, CompoundModel):\n                l_inputs_map = self.left.inputs_map()\n            for inp in self.left.inputs:\n                if isinstance(self.left, CompoundModel):\n                    inputs_map[inp] = l_inputs_map[inp]\n                else:\n                    inputs_map[inp] = self.left, inp\n        return inputs_map\n\n    def _parameter_units_for_data_units(self, input_units, output_units):\n        if self._leaflist is None:\n            self._map_parameters()\n        units_for_data = {}\n        for imodel, model in enumerate(self._leaflist):\n            units_for_data_leaf = model._parameter_units_for_data_units(input_units, output_units)\n            for param_leaf in units_for_data_leaf:\n                param = self._param_map_inverse[(imodel, param_leaf)]\n                units_for_data[param] = units_for_data_leaf[param_leaf]\n        return units_for_data\n\n    @property\n    def input_units(self):\n        inputs_map = self.inputs_map()\n        input_units_dict = {key: inputs_map[key][0].input_units[orig_key]\n                            for key, (mod, orig_key) in inputs_map.items()\n                            if inputs_map[key][0].input_units is not None}\n        if input_units_dict:\n            return input_units_dict\n        return None\n\n    @property\n    def input_units_equivalencies(self):\n        inputs_map = self.inputs_map()\n        input_units_equivalencies_dict = {\n            key: inputs_map[key][0].input_units_equivalencies[orig_key]\n            for key, (mod, orig_key) in inputs_map.items()\n            if inputs_map[key][0].input_units_equivalencies is not None\n        }\n        if not input_units_equivalencies_dict:\n            return None\n\n        return input_units_equivalencies_dict\n\n    @property\n    def input_units_allow_dimensionless(self):\n        inputs_map = self.inputs_map()\n        return {key: inputs_map[key][0].input_units_allow_dimensionless[orig_key]\n                for key, (mod, orig_key) in inputs_map.items()}\n\n    @property\n    def input_units_strict(self):\n        inputs_map = self.inputs_map()\n        return {key: inputs_map[key][0].input_units_strict[orig_key]\n                for key, (mod, orig_key) in inputs_map.items()}\n\n    @property\n    def return_units(self):\n        outputs_map = self.outputs_map()\n        return {key: outputs_map[key][0].return_units[orig_key]\n                for key, (mod, orig_key) in outputs_map.items()\n                if outputs_map[key][0].return_units is not None}\n\n    def outputs_map(self):\n        \"\"\"\n        Map the names of the outputs to this ExpressionTree to the outputs to the leaf models.\n        \"\"\"\n        outputs_map = {}\n        if not isinstance(self.op, str):  # If we don't have an operator the mapping is trivial\n            return {out: (self, out) for out in self.outputs}\n\n        elif self.op == '|':\n            if isinstance(self.right, CompoundModel):\n                r_outputs_map = self.right.outputs_map()\n            for out in self.outputs:\n                if isinstance(self.right, CompoundModel):\n                    outputs_map[out] = r_outputs_map[out]\n                else:\n                    outputs_map[out] = self.right, out\n\n        elif self.op == '&':\n            if isinstance(self.left, CompoundModel):\n                l_outputs_map = self.left.outputs_map()\n            if isinstance(self.right, CompoundModel):\n                r_outputs_map = self.right.outputs_map()\n            for i, out in enumerate(self.outputs):\n                if i < len(self.left.outputs):  # Get from left\n                    if isinstance(self.left, CompoundModel):\n                        outputs_map[out] = l_outputs_map[self.left.outputs[i]]\n                    else:\n                        outputs_map[out] = self.left, self.left.outputs[i]\n                else:  # Get from right\n                    if isinstance(self.right, CompoundModel):\n                        outputs_map[out] = r_outputs_map[self.right.outputs[i - len(self.left.outputs)]]\n                    else:\n                        outputs_map[out] = self.right, self.right.outputs[i - len(self.left.outputs)]\n        elif self.op == 'fix_inputs':\n            return self.left.outputs_map()\n        else:\n            if isinstance(self.left, CompoundModel):\n                l_outputs_map = self.left.outputs_map()\n            for out in self.left.outputs:\n                if isinstance(self.left, CompoundModel):\n                    outputs_map[out] = l_outputs_map()[out]\n                else:\n                    outputs_map[out] = self.left, out\n        return outputs_map\n\n    @property\n    def has_user_bounding_box(self):\n        \"\"\"\n        A flag indicating whether or not a custom bounding_box has been\n        assigned to this model by a user, via assignment to\n        ``model.bounding_box``.\n        \"\"\"\n\n        return self._user_bounding_box is not None\n\n    def render(self, out=None, coords=None):\n        \"\"\"\n        Evaluate a model at fixed positions, respecting the ``bounding_box``.\n\n        The key difference relative to evaluating the model directly is that\n        this method is limited to a bounding box if the `Model.bounding_box`\n        attribute is set.\n\n        Parameters\n        ----------\n        out : `numpy.ndarray`, optional\n            An array that the evaluated model will be added to.  If this is not\n            given (or given as ``None``), a new array will be created.\n        coords : array-like, optional\n            An array to be used to translate from the model's input coordinates\n            to the ``out`` array. It should have the property that\n            ``self(coords)`` yields the same shape as ``out``.  If ``out`` is\n            not specified, ``coords`` will be used to determine the shape of\n            the returned array. If this is not provided (or None), the model\n            will be evaluated on a grid determined by `Model.bounding_box`.\n\n        Returns\n        -------\n        out : `numpy.ndarray`\n            The model added to ``out`` if  ``out`` is not ``None``, or else a\n            new array from evaluating the model over ``coords``.\n            If ``out`` and ``coords`` are both `None`, the returned array is\n            limited to the `Model.bounding_box` limits. If\n            `Model.bounding_box` is `None`, ``arr`` or ``coords`` must be\n            passed.\n\n        Raises\n        ------\n        ValueError\n            If ``coords`` are not given and the the `Model.bounding_box` of\n            this model is not set.\n\n        Examples\n        --------\n        :ref:`astropy:bounding-boxes`\n        \"\"\"\n\n        bbox = self.get_bounding_box()\n\n        ndim = self.n_inputs\n\n        if (coords is None) and (out is None) and (bbox is None):\n            raise ValueError('If no bounding_box is set, '\n                             'coords or out must be input.')\n\n        # for consistent indexing\n        if ndim == 1:\n            if coords is not None:\n                coords = [coords]\n            if bbox is not None:\n                bbox = [bbox]\n\n        if coords is not None:\n            coords = np.asanyarray(coords, dtype=float)\n            # Check dimensions match out and model\n            assert len(coords) == ndim\n            if out is not None:\n                if coords[0].shape != out.shape:\n                    raise ValueError('inconsistent shape of the output.')\n            else:\n                out = np.zeros(coords[0].shape)\n\n        if out is not None:\n            out = np.asanyarray(out)\n            if out.ndim != ndim:\n                raise ValueError('the array and model must have the same '\n                                 'number of dimensions.')\n\n        if bbox is not None:\n            # Assures position is at center pixel, important when using\n            # add_array.\n            pd = np.array([(np.mean(bb), np.ceil((bb[1] - bb[0]) / 2))\n                           for bb in bbox]).astype(int).T\n            pos, delta = pd\n\n            if coords is not None:\n                sub_shape = tuple(delta * 2 + 1)\n                sub_coords = np.array([extract_array(c, sub_shape, pos)\n                                       for c in coords])\n            else:\n                limits = [slice(p - d, p + d + 1, 1) for p, d in pd.T]\n                sub_coords = np.mgrid[limits]\n\n            sub_coords = sub_coords[::-1]\n\n            if out is None:\n                out = self(*sub_coords)\n            else:\n                try:\n                    out = add_array(out, self(*sub_coords), pos)\n                except ValueError:\n                    raise ValueError(\n                        'The `bounding_box` is larger than the input out in '\n                        'one or more dimensions. Set '\n                        '`model.bounding_box = None`.')\n        else:\n            if coords is None:\n                im_shape = out.shape\n                limits = [slice(i) for i in im_shape]\n                coords = np.mgrid[limits]\n\n            coords = coords[::-1]\n\n            out += self(*coords)\n\n        return out\n\n    def replace_submodel(self, name, model):\n        \"\"\"\n        Construct a new `~astropy.modeling.CompoundModel` instance from an\n        existing CompoundModel, replacing the named submodel with a new model.\n\n        In order to ensure that inverses and names are kept/reconstructed, it's\n        necessary to rebuild the CompoundModel from the replaced node all the\n        way back to the base. The original CompoundModel is left untouched.\n\n        Parameters\n        ----------\n        name : str\n            name of submodel to be replaced\n        model : `~astropy.modeling.Model`\n            replacement model\n        \"\"\"\n        submodels = [m for m in self.traverse_postorder()\n                     if getattr(m, 'name', None) == name]\n        if submodels:\n            if len(submodels) > 1:\n                raise ValueError(f\"More than one submodel named {name}\")\n\n            old_model = submodels.pop()\n            if len(old_model) != len(model):\n                raise ValueError(\"New and old models must have equal values \"\n                                 \"for n_models\")\n\n            # Do this check first in order to raise a more helpful Exception,\n            # although it would fail trying to construct the new CompoundModel\n            if (old_model.n_inputs != model.n_inputs or\n                        old_model.n_outputs != model.n_outputs):\n                raise ValueError(\"New model must match numbers of inputs and \"\n                                 \"outputs of existing model\")\n\n            tree = _get_submodel_path(self, name)\n            while tree:\n                branch = self.copy()\n                for node in tree[:-1]:\n                    branch = getattr(branch, node)\n                setattr(branch, tree[-1], model)\n                model = CompoundModel(branch.op, branch.left, branch.right,\n                                      name=branch.name)\n                tree = tree[:-1]\n            return model\n\n        else:\n            raise ValueError(f\"No submodels found named {name}\")\n\n    def _set_sub_models_and_parameter_units(self, left, right):\n        \"\"\"\n        Provides a work-around to properly set the sub models and respective\n        parameters's units/values when using ``without_units_for_data``\n        or ``without_units_for_data`` methods.\n        \"\"\"\n        model = CompoundModel(self.op, left, right)\n\n        self.left = left\n        self.right = right\n\n        for name in model.param_names:\n            model_parameter = getattr(model, name)\n            parameter = getattr(self, name)\n\n            parameter.value = model_parameter.value\n            parameter._set_unit(model_parameter.unit, force=True)\n\n    def without_units_for_data(self, **kwargs):\n        \"\"\"\n        See `~astropy.modeling.Model.without_units_for_data` for overview\n        of this method.\n\n        Notes\n        -----\n        This modifies the behavior of the base method to account for the\n        case where the sub-models of a compound model have different output\n        units. This is only valid for compound * and / compound models as\n        in that case it is reasonable to mix the output units. It does this\n        by modifying the output units of each sub model by using the output\n        units of the other sub model so that we can apply the original function\n        and get the desired result.\n\n        Additional data has to be output in the mixed output unit case\n        so that the units can be properly rebuilt by\n        `~astropy.modeling.CompoundModel.with_units_from_data`.\n\n        Outside the mixed output units, this method is identical to the\n        base method.\n        \"\"\"\n        if self.op in ['*', '/']:\n            model = self.copy()\n            inputs = {inp: kwargs[inp] for inp in self.inputs}\n\n            left_units = self.left.output_units(**kwargs)\n            right_units = self.right.output_units(**kwargs)\n\n            if self.op == '*':\n                left_kwargs = {out: kwargs[out] / right_units[out]\n                               for out in self.left.outputs if kwargs[out] is not None}\n                right_kwargs = {out: kwargs[out] / left_units[out]\n                                for out in self.right.outputs if kwargs[out] is not None}\n            else:\n                left_kwargs = {out: kwargs[out] * right_units[out]\n                               for out in self.left.outputs if kwargs[out] is not None}\n                right_kwargs = {out: 1 / kwargs[out] * left_units[out]\n                                for out in self.right.outputs if kwargs[out] is not None}\n\n            left_kwargs.update(inputs.copy())\n            right_kwargs.update(inputs.copy())\n\n            left = self.left.without_units_for_data(**left_kwargs)\n            if isinstance(left, tuple):\n                left_kwargs['_left_kwargs'] = left[1]\n                left_kwargs['_right_kwargs'] = left[2]\n                left = left[0]\n\n            right = self.right.without_units_for_data(**right_kwargs)\n            if isinstance(right, tuple):\n                right_kwargs['_left_kwargs'] = right[1]\n                right_kwargs['_right_kwargs'] = right[2]\n                right = right[0]\n\n            model._set_sub_models_and_parameter_units(left, right)\n\n            return model, left_kwargs, right_kwargs\n        else:\n            return super().without_units_for_data(**kwargs)\n\n    def with_units_from_data(self, **kwargs):\n        \"\"\"\n        See `~astropy.modeling.Model.with_units_from_data` for overview\n        of this method.\n\n        Notes\n        -----\n        This modifies the behavior of the base method to account for the\n        case where the sub-models of a compound model have different output\n        units. This is only valid for compound * and / compound models as\n        in that case it is reasonable to mix the output units. In order to\n        do this it requires some additional information output by\n        `~astropy.modeling.CompoundModel.without_units_for_data` passed as\n        keyword arguments under the keywords ``_left_kwargs`` and ``_right_kwargs``.\n\n        Outside the mixed output units, this method is identical to the\n        base method.\n        \"\"\"\n\n        if self.op in ['*', '/']:\n            left_kwargs = kwargs.pop('_left_kwargs')\n            right_kwargs = kwargs.pop('_right_kwargs')\n\n            left = self.left.with_units_from_data(**left_kwargs)\n            right = self.right.with_units_from_data(**right_kwargs)\n\n            model = self.copy()\n            model._set_sub_models_and_parameter_units(left, right)\n\n            return model\n        else:\n            return super().with_units_from_data(**kwargs)\n\n\ndef _get_submodel_path(model, name):\n    \"\"\"Find the route down a CompoundModel's tree to the model with the\n    specified name (whether it's a leaf or not)\"\"\"\n    if getattr(model, 'name', None) == name:\n        return []\n    try:\n        return ['left'] + _get_submodel_path(model.left, name)\n    except (AttributeError, TypeError):\n        pass\n    try:\n        return ['right'] + _get_submodel_path(model.right, name)\n    except (AttributeError, TypeError):\n        pass\n\n\ndef binary_operation(binoperator, left, right):\n    '''\n    Perform binary operation. Operands may be matching tuples of operands.\n    '''\n    if isinstance(left, tuple) and isinstance(right, tuple):\n        return tuple([binoperator(item[0], item[1])\n                      for item in zip(left, right)])\n    return binoperator(left, right)\n\n\ndef get_ops(tree, opset):\n    \"\"\"\n    Recursive function to collect operators used.\n    \"\"\"\n    if isinstance(tree, CompoundModel):\n        opset.add(tree.op)\n        get_ops(tree.left, opset)\n        get_ops(tree.right, opset)\n    else:\n        return\n\n\ndef make_subtree_dict(tree, nodepath, tdict, leaflist):\n    '''\n    Traverse a tree noting each node by a key that indicates all the\n    left/right choices necessary to reach that node. Each key will\n    reference a tuple that contains:\n\n    - reference to the compound model for that node.\n    - left most index contained within that subtree\n       (relative to all indices for the whole tree)\n    - right most index contained within that subtree\n    '''\n    # if this is a leaf, just append it to the leaflist\n    if not hasattr(tree, 'isleaf'):\n        leaflist.append(tree)\n    else:\n        leftmostind = len(leaflist)\n        make_subtree_dict(tree.left, nodepath+'l', tdict, leaflist)\n        make_subtree_dict(tree.right, nodepath+'r', tdict, leaflist)\n        rightmostind = len(leaflist)-1\n        tdict[nodepath] = (tree, leftmostind, rightmostind)\n\n\n_ORDER_OF_OPERATORS = [('fix_inputs',), ('|',), ('&',), ('+', '-'), ('*', '/'), ('**',)]\nOPERATOR_PRECEDENCE = {}\nfor idx, ops in enumerate(_ORDER_OF_OPERATORS):\n    for op in ops:\n        OPERATOR_PRECEDENCE[op] = idx\ndel idx, op, ops\n\n\ndef fix_inputs(modelinstance, values, bounding_boxes=None, selector_args=None):\n    \"\"\"\n    This function creates a compound model with one or more of the input\n    values of the input model assigned fixed values (scalar or array).\n\n    Parameters\n    ----------\n    modelinstance : `~astropy.modeling.Model` instance\n        This is the model that one or more of the\n        model input values will be fixed to some constant value.\n    values : dict\n        A dictionary where the key identifies which input to fix\n        and its value is the value to fix it at. The key may either be the\n        name of the input or a number reflecting its order in the inputs.\n\n    Examples\n    --------\n\n    >>> from astropy.modeling.models import Gaussian2D\n    >>> g = Gaussian2D(1, 2, 3, 4, 5)\n    >>> gv = fix_inputs(g, {0: 2.5})\n\n    Results in a 1D function equivalent to Gaussian2D(1, 2, 3, 4, 5)(x=2.5, y)\n    \"\"\"\n    model = CompoundModel('fix_inputs', modelinstance, values)\n    if bounding_boxes is not None:\n        if selector_args is None:\n            selector_args = tuple([(key, True) for key in values.keys()])\n        bbox = CompoundBoundingBox.validate(modelinstance, bounding_boxes, selector_args)\n        _selector = bbox.selector_args.get_fixed_values(modelinstance, values)\n\n        new_bbox = bbox[_selector]\n        new_bbox = new_bbox.__class__.validate(model, new_bbox)\n\n        model.bounding_box = new_bbox\n    return model\n\n\ndef bind_bounding_box(modelinstance, bounding_box, ignored=None, order='C'):\n    \"\"\"\n    Set a validated bounding box to a model instance.\n\n    Parameters\n    ----------\n    modelinstance : `~astropy.modeling.Model` instance\n        This is the model that the validated bounding box will be set on.\n    bounding_box : tuple\n        A bounding box tuple, see :ref:`astropy:bounding-boxes` for details\n    ignored : list\n        List of the inputs to be ignored by the bounding box.\n    order : str, optional\n        The ordering of the bounding box tuple, can be either ``'C'`` or\n        ``'F'``.\n    \"\"\"\n    modelinstance.bounding_box = ModelBoundingBox.validate(modelinstance,\n                                                           bounding_box,\n                                                           ignored=ignored,\n                                                           order=order)\n\n\ndef bind_compound_bounding_box(modelinstance, bounding_boxes, selector_args,\n                               create_selector=None, ignored=None, order='C'):\n    \"\"\"\n    Add a validated compound bounding box to a model instance.\n\n    Parameters\n    ----------\n    modelinstance : `~astropy.modeling.Model` instance\n        This is the model that the validated compound bounding box will be set on.\n    bounding_boxes : dict\n        A dictionary of bounding box tuples, see :ref:`astropy:bounding-boxes`\n        for details.\n    selector_args : list\n        List of selector argument tuples to define selection for compound\n        bounding box, see :ref:`astropy:bounding-boxes` for details.\n    create_selector : callable, optional\n        An optional callable with interface (selector_value, model) which\n        can generate a bounding box based on a selector value and model if\n        there is no bounding box in the compound bounding box listed under\n        that selector value. Default is ``None``, meaning new bounding\n        box entries will not be automatically generated.\n    ignored : list\n        List of the inputs to be ignored by the bounding box.\n    order : str, optional\n        The ordering of the bounding box tuple, can be either ``'C'`` or\n        ``'F'``.\n    \"\"\"\n    modelinstance.bounding_box = CompoundBoundingBox.validate(modelinstance,\n                                                              bounding_boxes, selector_args,\n                                                              create_selector=create_selector,\n                                                              ignored=ignored,\n                                                              order=order)\n\n\ndef custom_model(*args, fit_deriv=None):\n    \"\"\"\n    Create a model from a user defined function. The inputs and parameters of\n    the model will be inferred from the arguments of the function.\n\n    This can be used either as a function or as a decorator.  See below for\n    examples of both usages.\n\n    The model is separable only if there is a single input.\n\n    .. note::\n\n        All model parameters have to be defined as keyword arguments with\n        default values in the model function.  Use `None` as a default argument\n        value if you do not want to have a default value for that parameter.\n\n        The standard settable model properties can be configured by default\n        using keyword arguments matching the name of the property; however,\n        these values are not set as model \"parameters\". Moreover, users\n        cannot use keyword arguments matching non-settable model properties,\n        with the exception of ``n_outputs`` which should be set to the number of\n        outputs of your function.\n\n    Parameters\n    ----------\n    func : function\n        Function which defines the model.  It should take N positional\n        arguments where ``N`` is dimensions of the model (the number of\n        independent variable in the model), and any number of keyword arguments\n        (the parameters).  It must return the value of the model (typically as\n        an array, but can also be a scalar for scalar inputs).  This\n        corresponds to the `~astropy.modeling.Model.evaluate` method.\n    fit_deriv : function, optional\n        Function which defines the Jacobian derivative of the model. I.e., the\n        derivative with respect to the *parameters* of the model.  It should\n        have the same argument signature as ``func``, but should return a\n        sequence where each element of the sequence is the derivative\n        with respect to the corresponding argument. This corresponds to the\n        :meth:`~astropy.modeling.FittableModel.fit_deriv` method.\n\n    Examples\n    --------\n    Define a sinusoidal model function as a custom 1D model::\n\n        >>> from astropy.modeling.models import custom_model\n        >>> import numpy as np\n        >>> def sine_model(x, amplitude=1., frequency=1.):\n        ...     return amplitude * np.sin(2 * np.pi * frequency * x)\n        >>> def sine_deriv(x, amplitude=1., frequency=1.):\n        ...     return 2 * np.pi * amplitude * np.cos(2 * np.pi * frequency * x)\n        >>> SineModel = custom_model(sine_model, fit_deriv=sine_deriv)\n\n    Create an instance of the custom model and evaluate it::\n\n        >>> model = SineModel()\n        >>> model(0.25)\n        1.0\n\n    This model instance can now be used like a usual astropy model.\n\n    The next example demonstrates a 2D Moffat function model, and also\n    demonstrates the support for docstrings (this example could also include\n    a derivative, but it has been omitted for simplicity)::\n\n        >>> @custom_model\n        ... def Moffat2D(x, y, amplitude=1.0, x_0=0.0, y_0=0.0, gamma=1.0,\n        ...            alpha=1.0):\n        ...     \\\"\\\"\\\"Two dimensional Moffat function.\\\"\\\"\\\"\n        ...     rr_gg = ((x - x_0) ** 2 + (y - y_0) ** 2) / gamma ** 2\n        ...     return amplitude * (1 + rr_gg) ** (-alpha)\n        ...\n        >>> print(Moffat2D.__doc__)\n        Two dimensional Moffat function.\n        >>> model = Moffat2D()\n        >>> model(1, 1)  # doctest: +FLOAT_CMP\n        0.3333333333333333\n    \"\"\"\n\n    if len(args) == 1 and callable(args[0]):\n        return _custom_model_wrapper(args[0], fit_deriv=fit_deriv)\n    elif not args:\n        return functools.partial(_custom_model_wrapper, fit_deriv=fit_deriv)\n    else:\n        raise TypeError(\n            \"{0} takes at most one positional argument (the callable/\"\n            \"function to be turned into a model.  When used as a decorator \"\n            \"it should be passed keyword arguments only (if \"\n            \"any).\".format(__name__))\n\n\ndef _custom_model_inputs(func):\n    \"\"\"\n    Processes the inputs to the `custom_model`'s function into the appropriate\n    categories.\n\n    Parameters\n    ----------\n    func : callable\n\n    Returns\n    -------\n    inputs : list\n        list of evaluation inputs\n    special_params : dict\n        dictionary of model properties which require special treatment\n    settable_params : dict\n        dictionary of defaults for settable model properties\n    params : dict\n        dictionary of model parameters set by `custom_model`'s function\n    \"\"\"\n    inputs, parameters = get_inputs_and_params(func)\n\n    special = ['n_outputs']\n    settable = [attr for attr, value in vars(Model).items()\n                if isinstance(value, property) and value.fset is not None]\n    properties = [attr for attr, value in vars(Model).items()\n                  if isinstance(value, property) and value.fset is None and attr not in special]\n\n    special_params = {}\n    settable_params = {}\n    params = {}\n    for param in parameters:\n        if param.name in special:\n            special_params[param.name] = param.default\n        elif param.name in settable:\n            settable_params[param.name] = param.default\n        elif param.name in properties:\n            raise ValueError(f\"Parameter '{param.name}' cannot be a model property: {properties}.\")\n        else:\n            params[param.name] = param.default\n\n    return inputs, special_params, settable_params, params\n\n\ndef _custom_model_wrapper(func, fit_deriv=None):\n    \"\"\"\n    Internal implementation `custom_model`.\n\n    When `custom_model` is called as a function its arguments are passed to\n    this function, and the result of this function is returned.\n\n    When `custom_model` is used as a decorator a partial evaluation of this\n    function is returned by `custom_model`.\n    \"\"\"\n\n    if not callable(func):\n        raise ModelDefinitionError(\n            \"func is not callable; it must be a function or other callable \"\n            \"object\")\n\n    if fit_deriv is not None and not callable(fit_deriv):\n        raise ModelDefinitionError(\n            \"fit_deriv not callable; it must be a function or other \"\n            \"callable object\")\n\n    model_name = func.__name__\n\n    inputs, special_params, settable_params, params = _custom_model_inputs(func)\n\n    if (fit_deriv is not None and\n            len(fit_deriv.__defaults__) != len(params)):\n        raise ModelDefinitionError(\"derivative function should accept \"\n                                   \"same number of parameters as func.\")\n\n    params = {param: Parameter(param, default=default)\n              for param, default in params.items()}\n\n    mod = find_current_module(2)\n    if mod:\n        modname = mod.__name__\n    else:\n        modname = '__main__'\n\n    members = {\n        '__module__': str(modname),\n        '__doc__': func.__doc__,\n        'n_inputs': len(inputs),\n        'n_outputs': special_params.pop('n_outputs', 1),\n        'evaluate': staticmethod(func),\n        '_settable_properties': settable_params\n    }\n\n    if fit_deriv is not None:\n        members['fit_deriv'] = staticmethod(fit_deriv)\n\n    members.update(params)\n\n    cls = type(model_name, (FittableModel,), members)\n    cls._separable = True if (len(inputs) == 1) else False\n    return cls\n\n\ndef render_model(model, arr=None, coords=None):\n    \"\"\"\n    Evaluates a model on an input array. Evaluation is limited to\n    a bounding box if the `Model.bounding_box` attribute is set.\n\n    Parameters\n    ----------\n    model : `Model`\n        Model to be evaluated.\n    arr : `numpy.ndarray`, optional\n        Array on which the model is evaluated.\n    coords : array-like, optional\n        Coordinate arrays mapping to ``arr``, such that\n        ``arr[coords] == arr``.\n\n    Returns\n    -------\n    array : `numpy.ndarray`\n        The model evaluated on the input ``arr`` or a new array from\n        ``coords``.\n        If ``arr`` and ``coords`` are both `None`, the returned array is\n        limited to the `Model.bounding_box` limits. If\n        `Model.bounding_box` is `None`, ``arr`` or ``coords`` must be passed.\n\n    Examples\n    --------\n    :ref:`astropy:bounding-boxes`\n    \"\"\"\n\n    bbox = model.bounding_box\n\n    if (coords is None) & (arr is None) & (bbox is None):\n        raise ValueError('If no bounding_box is set,'\n                         'coords or arr must be input.')\n\n    # for consistent indexing\n    if model.n_inputs == 1:\n        if coords is not None:\n            coords = [coords]\n        if bbox is not None:\n            bbox = [bbox]\n\n    if arr is not None:\n        arr = arr.copy()\n        # Check dimensions match model\n        if arr.ndim != model.n_inputs:\n            raise ValueError('number of array dimensions inconsistent with '\n                             'number of model inputs.')\n    if coords is not None:\n        # Check dimensions match arr and model\n        coords = np.array(coords)\n        if len(coords) != model.n_inputs:\n            raise ValueError('coordinate length inconsistent with the number '\n                             'of model inputs.')\n        if arr is not None:\n            if coords[0].shape != arr.shape:\n                raise ValueError('coordinate shape inconsistent with the '\n                                 'array shape.')\n        else:\n            arr = np.zeros(coords[0].shape)\n\n    if bbox is not None:\n        # assures position is at center pixel, important when using add_array\n        pd = pos, delta = np.array([(np.mean(bb), np.ceil((bb[1] - bb[0]) / 2))\n                                    for bb in bbox]).astype(int).T\n\n        if coords is not None:\n            sub_shape = tuple(delta * 2 + 1)\n            sub_coords = np.array([extract_array(c, sub_shape, pos)\n                                   for c in coords])\n        else:\n            limits = [slice(p - d, p + d + 1, 1) for p, d in pd.T]\n            sub_coords = np.mgrid[limits]\n\n        sub_coords = sub_coords[::-1]\n\n        if arr is None:\n            arr = model(*sub_coords)\n        else:\n            try:\n                arr = add_array(arr, model(*sub_coords), pos)\n            except ValueError:\n                raise ValueError('The `bounding_box` is larger than the input'\n                                 ' arr in one or more dimensions. Set '\n                                 '`model.bounding_box = None`.')\n    else:\n\n        if coords is None:\n            im_shape = arr.shape\n            limits = [slice(i) for i in im_shape]\n            coords = np.mgrid[limits]\n\n        arr += model(*coords[::-1])\n\n    return arr\n\n\ndef hide_inverse(model):\n    \"\"\"\n    This is a convenience function intended to disable automatic generation\n    of the inverse in compound models by disabling one of the constituent\n    model's inverse. This is to handle cases where user provided inverse\n    functions are not compatible within an expression.\n\n    Example:\n        compound_model.inverse = hide_inverse(m1) + m2 + m3\n\n    This will insure that the defined inverse itself won't attempt to\n    build its own inverse, which would otherwise fail in this example\n    (e.g., m = m1 + m2 + m3 happens to raises an exception for this\n    reason.)\n\n    Note that this permanently disables it. To prevent that either copy\n    the model or restore the inverse later.\n    \"\"\"\n    del model.inverse\n    return model\n"},{"className":"InputParameterError","col":0,"comment":"Used for incorrect input parameter values and definitions.","endLoc":32,"id":12379,"nodeType":"Class","startLoc":31,"text":"class InputParameterError(ValueError, ParameterError):\n    \"\"\"Used for incorrect input parameter values and definitions.\"\"\""},{"className":"ParameterError","col":0,"comment":"Generic exception class for all exceptions pertaining to Parameters.","endLoc":28,"id":12380,"nodeType":"Class","startLoc":27,"text":"class ParameterError(Exception):\n    \"\"\"Generic exception class for all exceptions pertaining to Parameters.\"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":190,"id":12381,"name":"supported_constraints","nodeType":"Attribute","startLoc":190,"text":"supported_constraints"},{"attributeType":"null","col":8,"comment":"null","endLoc":195,"id":12382,"name":"fit_info","nodeType":"Attribute","startLoc":195,"text":"self.fit_info"},{"attributeType":"null","col":12,"comment":"null","endLoc":221,"id":12383,"name":"_acc","nodeType":"Attribute","startLoc":221,"text":"self._acc"},{"className":"_ModelMeta","col":0,"comment":"\n    Metaclass for Model.\n\n    Currently just handles auto-generating the param_names list based on\n    Parameter descriptors declared at the class-level of Model subclasses.\n    ","endLoc":498,"id":12384,"nodeType":"Class","startLoc":64,"text":"class _ModelMeta(abc.ABCMeta):\n    \"\"\"\n    Metaclass for Model.\n\n    Currently just handles auto-generating the param_names list based on\n    Parameter descriptors declared at the class-level of Model subclasses.\n    \"\"\"\n\n    _is_dynamic = False\n    \"\"\"\n    This flag signifies whether this class was created in the \"normal\" way,\n    with a class statement in the body of a module, as opposed to a call to\n    `type` or some other metaclass constructor, such that the resulting class\n    does not belong to a specific module.  This is important for pickling of\n    dynamic classes.\n\n    This flag is always forced to False for new classes, so code that creates\n    dynamic classes should manually set it to True on those classes when\n    creating them.\n    \"\"\"\n\n    # Default empty dict for _parameters_, which will be empty on model\n    # classes that don't have any Parameters\n\n    def __new__(mcls, name, bases, members, **kwds):\n        # See the docstring for _is_dynamic above\n        if '_is_dynamic' not in members:\n            members['_is_dynamic'] = mcls._is_dynamic\n        opermethods = [\n            ('__add__', _model_oper('+')),\n            ('__sub__', _model_oper('-')),\n            ('__mul__', _model_oper('*')),\n            ('__truediv__', _model_oper('/')),\n            ('__pow__', _model_oper('**')),\n            ('__or__', _model_oper('|')),\n            ('__and__', _model_oper('&')),\n            ('_fix_inputs', _model_oper('fix_inputs'))\n        ]\n\n        members['_parameters_'] = {k: v for k, v in members.items()\n                                   if isinstance(v, Parameter)}\n\n        for opermethod, opercall in opermethods:\n            members[opermethod] = opercall\n        cls = super().__new__(mcls, name, bases, members, **kwds)\n\n        param_names = list(members['_parameters_'])\n\n        # Need to walk each base MRO to collect all parameter names\n        for base in bases:\n            for tbase in base.__mro__:\n                if issubclass(tbase, Model):\n                    # Preserve order of definitions\n                    param_names = list(tbase._parameters_) + param_names\n        # Remove duplicates (arising from redefinition in subclass).\n        param_names = list(dict.fromkeys(param_names))\n        if cls._parameters_:\n            if hasattr(cls, '_param_names'):\n                # Slight kludge to support compound models, where\n                # cls.param_names is a property; could be improved with a\n                # little refactoring but fine for now\n                cls._param_names = tuple(param_names)\n            else:\n                cls.param_names = tuple(param_names)\n\n        return cls\n\n    def __init__(cls, name, bases, members, **kwds):\n        super(_ModelMeta, cls).__init__(name, bases, members, **kwds)\n        cls._create_inverse_property(members)\n        cls._create_bounding_box_property(members)\n        pdict = {}\n        for base in bases:\n            for tbase in base.__mro__:\n                if issubclass(tbase, Model):\n                    for parname, val in cls._parameters_.items():\n                        pdict[parname] = val\n        cls._handle_special_methods(members, pdict)\n\n    def __repr__(cls):\n        \"\"\"\n        Custom repr for Model subclasses.\n        \"\"\"\n\n        return cls._format_cls_repr()\n\n    def _repr_pretty_(cls, p, cycle):\n        \"\"\"\n        Repr for IPython's pretty printer.\n\n        By default IPython \"pretty prints\" classes, so we need to implement\n        this so that IPython displays the custom repr for Models.\n        \"\"\"\n\n        p.text(repr(cls))\n\n    def __reduce__(cls):\n        if not cls._is_dynamic:\n            # Just return a string specifying where the class can be imported\n            # from\n            return cls.__name__\n        members = dict(cls.__dict__)\n        # Delete any ABC-related attributes--these will be restored when\n        # the class is reconstructed:\n        for key in list(members):\n            if key.startswith('_abc_'):\n                del members[key]\n\n        # Delete custom __init__ and __call__ if they exist:\n        for key in ('__init__', '__call__'):\n            if key in members:\n                del members[key]\n\n        return (type(cls), (cls.__name__, cls.__bases__, members))\n\n    @property\n    def name(cls):\n        \"\"\"\n        The name of this model class--equivalent to ``cls.__name__``.\n\n        This attribute is provided for symmetry with the `Model.name` attribute\n        of model instances.\n        \"\"\"\n\n        return cls.__name__\n\n    @property\n    def _is_concrete(cls):\n        \"\"\"\n        A class-level property that determines whether the class is a concrete\n        implementation of a Model--i.e. it is not some abstract base class or\n        internal implementation detail (i.e. begins with '_').\n        \"\"\"\n        return not (cls.__name__.startswith('_') or inspect.isabstract(cls))\n\n    def rename(cls, name=None, inputs=None, outputs=None):\n        \"\"\"\n        Creates a copy of this model class with a new name, inputs or outputs.\n\n        The new class is technically a subclass of the original class, so that\n        instance and type checks will still work.  For example::\n\n            >>> from astropy.modeling.models import Rotation2D\n            >>> SkyRotation = Rotation2D.rename('SkyRotation')\n            >>> SkyRotation\n            <class 'astropy.modeling.core.SkyRotation'>\n            Name: SkyRotation (Rotation2D)\n            N_inputs: 2\n            N_outputs: 2\n            Fittable parameters: ('angle',)\n            >>> issubclass(SkyRotation, Rotation2D)\n            True\n            >>> r = SkyRotation(90)\n            >>> isinstance(r, Rotation2D)\n            True\n        \"\"\"\n\n        mod = find_current_module(2)\n        if mod:\n            modname = mod.__name__\n        else:\n            modname = '__main__'\n\n        if name is None:\n            name = cls.name\n        if inputs is None:\n            inputs = cls.inputs\n        else:\n            if not isinstance(inputs, tuple):\n                raise TypeError(\"Expected 'inputs' to be a tuple of strings.\")\n            elif len(inputs) != len(cls.inputs):\n                raise ValueError(f'{cls.name} expects {len(cls.inputs)} inputs')\n        if outputs is None:\n            outputs = cls.outputs\n        else:\n            if not isinstance(outputs, tuple):\n                raise TypeError(\"Expected 'outputs' to be a tuple of strings.\")\n            elif len(outputs) != len(cls.outputs):\n                raise ValueError(f'{cls.name} expects {len(cls.outputs)} outputs')\n        new_cls = type(name, (cls,), {\"inputs\": inputs, \"outputs\": outputs})\n        new_cls.__module__ = modname\n        new_cls.__qualname__ = name\n\n        return new_cls\n\n    def _create_inverse_property(cls, members):\n        inverse = members.get('inverse')\n        if inverse is None or cls.__bases__[0] is object:\n            # The latter clause is the prevent the below code from running on\n            # the Model base class, which implements the default getter and\n            # setter for .inverse\n            return\n\n        if isinstance(inverse, property):\n            # We allow the @property decorator to be omitted entirely from\n            # the class definition, though its use should be encouraged for\n            # clarity\n            inverse = inverse.fget\n\n        # Store the inverse getter internally, then delete the given .inverse\n        # attribute so that cls.inverse resolves to Model.inverse instead\n        cls._inverse = inverse\n        del cls.inverse\n\n    def _create_bounding_box_property(cls, members):\n        \"\"\"\n        Takes any bounding_box defined on a concrete Model subclass (either\n        as a fixed tuple or a property or method) and wraps it in the generic\n        getter/setter interface for the bounding_box attribute.\n        \"\"\"\n\n        # TODO: Much of this is verbatim from _create_inverse_property--I feel\n        # like there could be a way to generify properties that work this way,\n        # but for the time being that would probably only confuse things more.\n        bounding_box = members.get('bounding_box')\n        if bounding_box is None or cls.__bases__[0] is object:\n            return\n\n        if isinstance(bounding_box, property):\n            bounding_box = bounding_box.fget\n\n        if not callable(bounding_box):\n            # See if it's a hard-coded bounding_box (as a sequence) and\n            # normalize it\n            try:\n                bounding_box = ModelBoundingBox.validate(cls, bounding_box, _preserve_ignore=True)\n            except ValueError as exc:\n                raise ModelDefinitionError(exc.args[0])\n        else:\n            sig = signature(bounding_box)\n            # May be a method that only takes 'self' as an argument (like a\n            # property, but the @property decorator was forgotten)\n            #\n            # However, if the method takes additional arguments then this is a\n            # parameterized bounding box and should be callable\n            if len(sig.parameters) > 1:\n                bounding_box = \\\n                        cls._create_bounding_box_subclass(bounding_box, sig)\n\n        # See the Model.bounding_box getter definition for how this attribute\n        # is used\n        cls._bounding_box = bounding_box\n        del cls.bounding_box\n\n    def _create_bounding_box_subclass(cls, func, sig):\n        \"\"\"\n        For Models that take optional arguments for defining their bounding\n        box, we create a subclass of ModelBoundingBox with a ``__call__`` method\n        that supports those additional arguments.\n\n        Takes the function's Signature as an argument since that is already\n        computed in _create_bounding_box_property, so no need to duplicate that\n        effort.\n        \"\"\"\n\n        # TODO: Might be convenient if calling the bounding box also\n        # automatically sets the _user_bounding_box.  So that\n        #\n        #    >>> model.bounding_box(arg=1)\n        #\n        # in addition to returning the computed bbox, also sets it, so that\n        # it's a shortcut for\n        #\n        #    >>> model.bounding_box = model.bounding_box(arg=1)\n        #\n        # Not sure if that would be non-obvious / confusing though...\n\n        def __call__(self, **kwargs):\n            return func(self._model, **kwargs)\n\n        kwargs = []\n        for idx, param in enumerate(sig.parameters.values()):\n            if idx == 0:\n                # Presumed to be a 'self' argument\n                continue\n\n            if param.default is param.empty:\n                raise ModelDefinitionError(\n                    'The bounding_box method for {0} is not correctly '\n                    'defined: If defined as a method all arguments to that '\n                    'method (besides self) must be keyword arguments with '\n                    'default values that can be used to compute a default '\n                    'bounding box.'.format(cls.name))\n\n            kwargs.append((param.name, param.default))\n\n        __call__.__signature__ = sig\n\n        return type(f'{cls.name}ModelBoundingBox', (ModelBoundingBox,),\n                    {'__call__': __call__})\n\n    def _handle_special_methods(cls, members, pdict):\n\n        # Handle init creation from inputs\n        def update_wrapper(wrapper, cls):\n            # Set up the new __call__'s metadata attributes as though it were\n            # manually defined in the class definition\n            # A bit like functools.update_wrapper but uses the class instead of\n            # the wrapped function\n            wrapper.__module__ = cls.__module__\n            wrapper.__doc__ = getattr(cls, wrapper.__name__).__doc__\n            if hasattr(cls, '__qualname__'):\n                wrapper.__qualname__ = f'{cls.__qualname__}.{wrapper.__name__}'\n\n        if ('__call__' not in members and 'n_inputs' in members and\n                isinstance(members['n_inputs'], int) and members['n_inputs'] > 0):\n\n            # Don't create a custom __call__ for classes that already have one\n            # explicitly defined (this includes the Model base class, and any\n            # other classes that manually override __call__\n\n            def __call__(self, *inputs, **kwargs):\n                \"\"\"Evaluate this model on the supplied inputs.\"\"\"\n                return super(cls, self).__call__(*inputs, **kwargs)\n\n            # When called, models can take two optional keyword arguments:\n            #\n            # * model_set_axis, which indicates (for multi-dimensional input)\n            #   which axis is used to indicate different models\n            #\n            # * equivalencies, a dictionary of equivalencies to be applied to\n            #   the input values, where each key should correspond to one of\n            #   the inputs.\n            #\n            # The following code creates the __call__ function with these\n            # two keyword arguments.\n\n            args = ('self',)\n            kwargs = dict([('model_set_axis', None),\n                           ('with_bounding_box', False),\n                           ('fill_value', np.nan),\n                           ('equivalencies', None),\n                           ('inputs_map', None)])\n\n            new_call = make_function_with_signature(\n                __call__, args, kwargs, varargs='inputs', varkwargs='new_inputs')\n\n            # The following makes it look like __call__\n            # was defined in the class\n            update_wrapper(new_call, cls)\n\n            cls.__call__ = new_call\n\n        if ('__init__' not in members and not inspect.isabstract(cls) and\n                cls._parameters_):\n            # Build list of all parameters including inherited ones\n\n            # If *all* the parameters have default values we can make them\n            # keyword arguments; otherwise they must all be positional\n            # arguments\n            if all(p.default is not None for p in pdict.values()):\n                args = ('self',)\n                kwargs = []\n                for param_name, param_val in pdict.items():\n                    default = param_val.default\n                    unit = param_val.unit\n                    # If the unit was specified in the parameter but the\n                    # default is not a Quantity, attach the unit to the\n                    # default.\n                    if unit is not None:\n                        default = Quantity(default, unit, copy=False)\n                    kwargs.append((param_name, default))\n            else:\n                args = ('self',) + tuple(pdict.keys())\n                kwargs = {}\n\n            def __init__(self, *params, **kwargs):\n                return super(cls, self).__init__(*params, **kwargs)\n\n            new_init = make_function_with_signature(\n                __init__, args, kwargs, varkwargs='kwargs')\n            update_wrapper(new_init, cls)\n            cls.__init__ = new_init\n\n    # *** Arithmetic operators for creating compound models ***\n    __add__ = _model_oper('+')\n    __sub__ = _model_oper('-')\n    __mul__ = _model_oper('*')\n    __truediv__ = _model_oper('/')\n    __pow__ = _model_oper('**')\n    __or__ = _model_oper('|')\n    __and__ = _model_oper('&')\n    _fix_inputs = _model_oper('fix_inputs')\n\n    # *** Other utilities ***\n\n    def _format_cls_repr(cls, keywords=[]):\n        \"\"\"\n        Internal implementation of ``__repr__``.\n\n        This is separated out for ease of use by subclasses that wish to\n        override the default ``__repr__`` while keeping the same basic\n        formatting.\n        \"\"\"\n\n        # For the sake of familiarity start the output with the standard class\n        # __repr__\n        parts = [super().__repr__()]\n\n        if not cls._is_concrete:\n            return parts[0]\n\n        def format_inheritance(cls):\n            bases = []\n            for base in cls.mro()[1:]:\n                if not issubclass(base, Model):\n                    continue\n                elif (inspect.isabstract(base) or\n                      base.__name__.startswith('_')):\n                    break\n                bases.append(base.name)\n            if bases:\n                return f\"{cls.name} ({' -> '.join(bases)})\"\n            return cls.name\n\n        try:\n            default_keywords = [\n                ('Name', format_inheritance(cls)),\n                ('N_inputs', cls.n_inputs),\n                ('N_outputs', cls.n_outputs),\n            ]\n\n            if cls.param_names:\n                default_keywords.append(('Fittable parameters',\n                                         cls.param_names))\n\n            for keyword, value in default_keywords + keywords:\n                if value is not None:\n                    parts.append(f'{keyword}: {value}')\n\n            return '\\n'.join(parts)\n        except Exception:\n            # If any of the above formatting fails fall back on the basic repr\n            # (this is particularly useful in debugging)\n            return parts[0]"},{"attributeType":"null","col":16,"comment":"null","endLoc":10,"id":12385,"name":"np","nodeType":"Attribute","startLoc":10,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":12386,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":12387,"name":"DEFAULT_MAXITER","nodeType":"Attribute","startLoc":16,"text":"DEFAULT_MAXITER"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":12388,"name":"DEFAULT_EPS","nodeType":"Attribute","startLoc":19,"text":"DEFAULT_EPS"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":12389,"name":"DEFAULT_ACC","nodeType":"Attribute","startLoc":22,"text":"DEFAULT_ACC"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":12390,"name":"DEFAULT_BOUNDS","nodeType":"Attribute","startLoc":24,"text":"DEFAULT_BOUNDS"},{"col":0,"comment":"","endLoc":6,"header":"optimizers.py#<anonymous>","id":12391,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nOptimization algorithms used in `~astropy.modeling.fitting`.\n\"\"\"\n\n__all__ = [\"Optimization\", \"SLSQP\", \"Simplex\"]\n\nDEFAULT_MAXITER = 100\n\nDEFAULT_EPS = np.sqrt(np.finfo(float).eps)\n\nDEFAULT_ACC = 1e-07\n\nDEFAULT_BOUNDS = (-10 ** 12, 10 ** 12)"},{"fileName":"math_functions.py","filePath":"astropy/modeling","id":12392,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nDefine Numpy Ufuncs as Models.\n\"\"\"\nimport numpy as np\n\nfrom astropy.modeling.core import Model\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n\ntrig_ufuncs = [\"sin\", \"cos\", \"tan\", \"arcsin\", \"arccos\", \"arctan\", \"arctan2\",\n               \"hypot\", \"sinh\", \"cosh\", \"tanh\", \"arcsinh\", \"arccosh\",\n               \"arctanh\", \"deg2rad\", \"rad2deg\"]\n\n\nmath_ops = [\"add\", \"subtract\", \"multiply\", \"logaddexp\", \"logaddexp2\",\n            \"true_divide\", \"floor_divide\", \"negative\", \"positive\", \"power\",\n            \"remainder\", \"fmod\", \"divmod\", \"absolute\", \"fabs\", \"rint\",\n            \"exp\", \"exp2\", \"log\", \"log2\", \"log10\", \"expm1\", \"log1p\", \"sqrt\",\n            \"square\", \"cbrt\", \"reciprocal\", \"divide\", \"mod\"]\n\n\nsupported_ufuncs = trig_ufuncs + math_ops\n\n\n# These names are just aliases for other ufunc objects\n# in the numpy API.  The alias name must occur later\n# in the lists above.\nalias_ufuncs = {\n    \"divide\": \"true_divide\",\n    \"mod\": \"remainder\",\n}\n\n\nclass _NPUfuncModel(Model):\n    _is_dynamic = True\n\n    def __init__(self, **kwargs):\n        super().__init__(**kwargs)\n\n\ndef _make_class_name(name):\n    \"\"\" Make a ufunc model class name from the name of the ufunc. \"\"\"\n    return name[0].upper() + name[1:] + 'Ufunc'\n\n\ndef ufunc_model(name):\n    \"\"\" Define a Model from a Numpy ufunc name.\"\"\"\n    ufunc = getattr(np, name)\n    nin = ufunc.nin\n    nout = ufunc.nout\n    if nin == 1:\n        separable = True\n\n        def evaluate(self, x):\n            return self.func(x)\n    else:\n        separable = False\n\n        def evaluate(self, x, y):\n            return self.func(x, y)\n\n    klass_name = _make_class_name(name)\n\n    members = {'n_inputs': nin, 'n_outputs': nout, 'func': ufunc,\n               'linear': False, 'fittable': False, '_separable': separable,\n               '_is_dynamic': True, 'evaluate': evaluate}\n\n    klass = type(str(klass_name), (_NPUfuncModel,), members)\n    klass.__module__ = 'astropy.modeling.math_functions'\n    return klass\n\n\n__all__ = []\n\nfor name in supported_ufuncs:\n    if name in alias_ufuncs:\n        klass_name = _make_class_name(name)\n        alias_klass_name = _make_class_name(alias_ufuncs[name])\n        globals()[klass_name] = globals()[alias_klass_name]\n        __all__.append(klass_name)\n    else:\n        m = ufunc_model(name)\n        klass_name = m.__name__\n        globals()[klass_name] = m\n        __all__.append(klass_name)\n"},{"col":4,"comment":"null","endLoc":129,"header":"def __new__(mcls, name, bases, members, **kwds)","id":12393,"name":"__new__","nodeType":"Function","startLoc":88,"text":"def __new__(mcls, name, bases, members, **kwds):\n        # See the docstring for _is_dynamic above\n        if '_is_dynamic' not in members:\n            members['_is_dynamic'] = mcls._is_dynamic\n        opermethods = [\n            ('__add__', _model_oper('+')),\n            ('__sub__', _model_oper('-')),\n            ('__mul__', _model_oper('*')),\n            ('__truediv__', _model_oper('/')),\n            ('__pow__', _model_oper('**')),\n            ('__or__', _model_oper('|')),\n            ('__and__', _model_oper('&')),\n            ('_fix_inputs', _model_oper('fix_inputs'))\n        ]\n\n        members['_parameters_'] = {k: v for k, v in members.items()\n                                   if isinstance(v, Parameter)}\n\n        for opermethod, opercall in opermethods:\n            members[opermethod] = opercall\n        cls = super().__new__(mcls, name, bases, members, **kwds)\n\n        param_names = list(members['_parameters_'])\n\n        # Need to walk each base MRO to collect all parameter names\n        for base in bases:\n            for tbase in base.__mro__:\n                if issubclass(tbase, Model):\n                    # Preserve order of definitions\n                    param_names = list(tbase._parameters_) + param_names\n        # Remove duplicates (arising from redefinition in subclass).\n        param_names = list(dict.fromkeys(param_names))\n        if cls._parameters_:\n            if hasattr(cls, '_param_names'):\n                # Slight kludge to support compound models, where\n                # cls.param_names is a property; could be improved with a\n                # little refactoring but fine for now\n                cls._param_names = tuple(param_names)\n            else:\n                cls.param_names = tuple(param_names)\n\n        return cls"},{"className":"_NPUfuncModel","col":0,"comment":"null","endLoc":39,"id":12394,"nodeType":"Class","startLoc":35,"text":"class _NPUfuncModel(Model):\n    _is_dynamic = True\n\n    def __init__(self, **kwargs):\n        super().__init__(**kwargs)"},{"col":4,"comment":"null","endLoc":39,"header":"def __init__(self, **kwargs)","id":12395,"name":"__init__","nodeType":"Function","startLoc":38,"text":"def __init__(self, **kwargs):\n        super().__init__(**kwargs)"},{"col":0,"comment":"\n    Returns a function that evaluates a given Python arithmetic operator\n    between two models.  The operator should be given as a string, like ``'+'``\n    or ``'**'``.\n    ","endLoc":57,"header":"def _model_oper(oper, **kwargs)","id":12396,"name":"_model_oper","nodeType":"Function","startLoc":51,"text":"def _model_oper(oper, **kwargs):\n    \"\"\"\n    Returns a function that evaluates a given Python arithmetic operator\n    between two models.  The operator should be given as a string, like ``'+'``\n    or ``'**'``.\n    \"\"\"\n    return lambda left, right: CompoundModel(oper, left, right, **kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":36,"id":12397,"name":"_is_dynamic","nodeType":"Attribute","startLoc":36,"text":"_is_dynamic"},{"col":0,"comment":" Define a Model from a Numpy ufunc name.","endLoc":71,"header":"def ufunc_model(name)","id":12398,"name":"ufunc_model","nodeType":"Function","startLoc":47,"text":"def ufunc_model(name):\n    \"\"\" Define a Model from a Numpy ufunc name.\"\"\"\n    ufunc = getattr(np, name)\n    nin = ufunc.nin\n    nout = ufunc.nout\n    if nin == 1:\n        separable = True\n\n        def evaluate(self, x):\n            return self.func(x)\n    else:\n        separable = False\n\n        def evaluate(self, x, y):\n            return self.func(x, y)\n\n    klass_name = _make_class_name(name)\n\n    members = {'n_inputs': nin, 'n_outputs': nout, 'func': ufunc,\n               'linear': False, 'fittable': False, '_separable': separable,\n               '_is_dynamic': True, 'evaluate': evaluate}\n\n    klass = type(str(klass_name), (_NPUfuncModel,), members)\n    klass.__module__ = 'astropy.modeling.math_functions'\n    return klass"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":12399,"name":"trig_ufuncs","nodeType":"Attribute","startLoc":11,"text":"trig_ufuncs"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":12400,"name":"math_ops","nodeType":"Attribute","startLoc":16,"text":"math_ops"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":12401,"name":"supported_ufuncs","nodeType":"Attribute","startLoc":23,"text":"supported_ufuncs"},{"attributeType":"null","col":0,"comment":"null","endLoc":29,"id":12402,"name":"alias_ufuncs","nodeType":"Attribute","startLoc":29,"text":"alias_ufuncs"},{"attributeType":"null","col":4,"comment":"null","endLoc":76,"id":12403,"name":"name","nodeType":"Attribute","startLoc":76,"text":"name"},{"attributeType":"null","col":8,"comment":"null","endLoc":78,"id":12404,"name":"klass_name","nodeType":"Attribute","startLoc":78,"text":"klass_name"},{"attributeType":"null","col":0,"comment":"null","endLoc":901,"id":12405,"name":"_BaseSelectorArgument","nodeType":"Attribute","startLoc":901,"text":"_BaseSelectorArgument"},{"col":0,"comment":"","endLoc":6,"header":"bounding_box.py#<anonymous>","id":12406,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nThis module is to contain an improved bounding box\n\"\"\"\n\n__all__ = ['ModelBoundingBox', 'CompoundBoundingBox']\n\n_BaseInterval = namedtuple('_BaseInterval', \"lower upper\")\n\n_ignored_interval = _Interval.validate((-np.inf, np.inf))\n\n_BaseSelectorArgument = namedtuple('_BaseSelectorArgument', \"index ignore\")"},{"attributeType":"null","col":8,"comment":"null","endLoc":79,"id":12407,"name":"alias_klass_name","nodeType":"Attribute","startLoc":79,"text":"alias_klass_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":83,"id":12408,"name":"m","nodeType":"Attribute","startLoc":83,"text":"m"},{"attributeType":"null","col":8,"comment":"null","endLoc":84,"id":12409,"name":"klass_name","nodeType":"Attribute","startLoc":84,"text":"klass_name"},{"col":0,"comment":"","endLoc":4,"header":"math_functions.py#<anonymous>","id":12410,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nDefine Numpy Ufuncs as Models.\n\"\"\"\n\ntrig_ufuncs = [\"sin\", \"cos\", \"tan\", \"arcsin\", \"arccos\", \"arctan\", \"arctan2\",\n               \"hypot\", \"sinh\", \"cosh\", \"tanh\", \"arcsinh\", \"arccosh\",\n               \"arctanh\", \"deg2rad\", \"rad2deg\"]\n\nmath_ops = [\"add\", \"subtract\", \"multiply\", \"logaddexp\", \"logaddexp2\",\n            \"true_divide\", \"floor_divide\", \"negative\", \"positive\", \"power\",\n            \"remainder\", \"fmod\", \"divmod\", \"absolute\", \"fabs\", \"rint\",\n            \"exp\", \"exp2\", \"log\", \"log2\", \"log10\", \"expm1\", \"log1p\", \"sqrt\",\n            \"square\", \"cbrt\", \"reciprocal\", \"divide\", \"mod\"]\n\nsupported_ufuncs = trig_ufuncs + math_ops\n\nalias_ufuncs = {\n    \"divide\": \"true_divide\",\n    \"mod\": \"remainder\",\n}\n\n__all__ = []\n\nfor name in supported_ufuncs:\n    if name in alias_ufuncs:\n        klass_name = _make_class_name(name)\n        alias_klass_name = _make_class_name(alias_ufuncs[name])\n        globals()[klass_name] = globals()[alias_klass_name]\n        __all__.append(klass_name)\n    else:\n        m = ufunc_model(name)\n        klass_name = m.__name__\n        globals()[klass_name] = m\n        __all__.append(klass_name)"},{"col":4,"comment":"null","endLoc":2868,"header":"def pickle_table(self, filename, signature='')","id":12411,"name":"pickle_table","nodeType":"Function","startLoc":2850,"text":"def pickle_table(self, filename, signature=''):\n        try:\n            import cPickle as pickle\n        except ImportError:\n            import pickle\n        with open(filename, 'wb') as outf:\n            pickle.dump(__tabversion__, outf, pickle_protocol)\n            pickle.dump(self.lr_method, outf, pickle_protocol)\n            pickle.dump(signature, outf, pickle_protocol)\n            pickle.dump(self.lr_action, outf, pickle_protocol)\n            pickle.dump(self.lr_goto, outf, pickle_protocol)\n\n            outp = []\n            for p in self.lr_productions:\n                if p.func:\n                    outp.append((p.str, p.name, p.len, p.func, os.path.basename(p.file), p.line))\n                else:\n                    outp.append((str(p), p.name, p.len, None, None, None))\n            pickle.dump(outp, outf, pickle_protocol)"},{"fileName":"__init__.py","filePath":"astropy/modeling","id":12412,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis subpackage provides a framework for representing models and\nperforming model evaluation and fitting. It supports 1D and 2D models\nand fitting with parameter constraints. It has some predefined models\nand fitting routines.\n\"\"\"\n\nfrom . import fitting\nfrom . import models\nfrom .core import *\nfrom .parameters import *\nfrom .separable import *\n"},{"fileName":"physical_models.py","filePath":"astropy/modeling","id":12413,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nModels that have physical origins.\n\"\"\"\n# pylint: disable=invalid-name, no-member\n\nimport warnings\n\nimport numpy as np\n\nfrom astropy import constants as const\nfrom astropy import units as u\nfrom astropy.utils.exceptions import AstropyUserWarning\nfrom .core import Fittable1DModel\nfrom .parameters import Parameter, InputParameterError\n\n__all__ = [\"BlackBody\", \"Drude1D\", \"Plummer1D\", \"NFW\"]\n\n\nclass BlackBody(Fittable1DModel):\n    \"\"\"\n    Blackbody model using the Planck function.\n\n    Parameters\n    ----------\n    temperature : `~astropy.units.Quantity` ['temperature']\n        Blackbody temperature.\n\n    scale : float or `~astropy.units.Quantity` ['dimensionless']\n        Scale factor\n\n    Notes\n    -----\n\n    Model formula:\n\n        .. math:: B_{\\\\nu}(T) = A \\\\frac{2 h \\\\nu^{3} / c^{2}}{exp(h \\\\nu / k T) - 1}\n\n    Examples\n    --------\n    >>> from astropy.modeling import models\n    >>> from astropy import units as u\n    >>> bb = models.BlackBody(temperature=5000*u.K)\n    >>> bb(6000 * u.AA)  # doctest: +FLOAT_CMP\n    <Quantity 1.53254685e-05 erg / (cm2 Hz s sr)>\n\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import BlackBody\n        from astropy import units as u\n        from astropy.visualization import quantity_support\n\n        bb = BlackBody(temperature=5778*u.K)\n        wav = np.arange(1000, 110000) * u.AA\n        flux = bb(wav)\n\n        with quantity_support():\n            plt.figure()\n            plt.semilogx(wav, flux)\n            plt.axvline(bb.nu_max.to(u.AA, equivalencies=u.spectral()).value, ls='--')\n            plt.show()\n    \"\"\"\n\n    # We parametrize this model with a temperature and a scale.\n    temperature = Parameter(default=5000.0, min=0, unit=u.K, description=\"Blackbody temperature\")\n    scale = Parameter(default=1.0, min=0, description=\"Scale factor\")\n\n    # We allow values without units to be passed when evaluating the model, and\n    # in this case the input x values are assumed to be frequencies in Hz.\n    _input_units_allow_dimensionless = True\n\n    # We enable the spectral equivalency by default for the spectral axis\n    input_units_equivalencies = {'x': u.spectral()}\n\n    def evaluate(self, x, temperature, scale):\n        \"\"\"Evaluate the model.\n\n        Parameters\n        ----------\n        x : float, `~numpy.ndarray`, or `~astropy.units.Quantity` ['frequency']\n            Frequency at which to compute the blackbody. If no units are given,\n            this defaults to Hz.\n\n        temperature : float, `~numpy.ndarray`, or `~astropy.units.Quantity`\n            Temperature of the blackbody. If no units are given, this defaults\n            to Kelvin.\n\n        scale : float, `~numpy.ndarray`, or `~astropy.units.Quantity` ['dimensionless']\n            Desired scale for the blackbody.\n\n        Returns\n        -------\n        y : number or ndarray\n            Blackbody spectrum. The units are determined from the units of\n            ``scale``.\n\n        .. note::\n\n            Use `numpy.errstate` to suppress Numpy warnings, if desired.\n\n        .. warning::\n\n            Output values might contain ``nan`` and ``inf``.\n\n        Raises\n        ------\n        ValueError\n            Invalid temperature.\n\n        ZeroDivisionError\n            Wavelength is zero (when converting to frequency).\n        \"\"\"\n        if not isinstance(temperature, u.Quantity):\n            in_temp = u.Quantity(temperature, u.K)\n        else:\n            in_temp = temperature\n\n        # Convert to units for calculations, also force double precision\n        with u.add_enabled_equivalencies(u.spectral() + u.temperature()):\n            freq = u.Quantity(x, u.Hz, dtype=np.float64)\n            temp = u.Quantity(in_temp, u.K)\n\n        # check the units of scale and setup the output units\n        bb_unit = u.erg / (u.cm ** 2 * u.s * u.Hz * u.sr)  # default unit\n        # use the scale that was used at initialization for determining the units to return\n        # to support returning the right units when fitting where units are stripped\n        if hasattr(self.scale, \"unit\") and self.scale.unit is not None:\n            # check that the units on scale are covertable to surface brightness units\n            if not self.scale.unit.is_equivalent(bb_unit, u.spectral_density(x)):\n                raise ValueError(\n                    f\"scale units not surface brightness: {self.scale.unit}\"\n                )\n            # use the scale passed to get the value for scaling\n            if hasattr(scale, \"unit\"):\n                mult_scale = scale.value\n            else:\n                mult_scale = scale\n            bb_unit = self.scale.unit\n        else:\n            mult_scale = scale\n\n        # Check if input values are physically possible\n        if np.any(temp < 0):\n            raise ValueError(f\"Temperature should be positive: {temp}\")\n        if not np.all(np.isfinite(freq)) or np.any(freq <= 0):\n            warnings.warn(\n                \"Input contains invalid wavelength/frequency value(s)\",\n                AstropyUserWarning,\n            )\n\n        log_boltz = const.h * freq / (const.k_B * temp)\n        boltzm1 = np.expm1(log_boltz)\n\n        # Calculate blackbody flux\n        bb_nu = 2.0 * const.h * freq ** 3 / (const.c ** 2 * boltzm1) / u.sr\n\n        y = mult_scale * bb_nu.to(bb_unit, u.spectral_density(freq))\n\n        # If the temperature parameter has no unit, we should return a unitless\n        # value. This occurs for instance during fitting, since we drop the\n        # units temporarily.\n        if hasattr(temperature, \"unit\"):\n            return y\n        return y.value\n\n    @property\n    def input_units(self):\n        # The input units are those of the 'x' value, which should always be\n        # Hz. Because we do this, and because input_units_allow_dimensionless\n        # is set to True, dimensionless values are assumed to be in Hz.\n        return {self.inputs[0]: u.Hz}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {\"temperature\": u.K}\n\n    @property\n    def bolometric_flux(self):\n        \"\"\"Bolometric flux.\"\"\"\n        # bolometric flux in the native units of the planck function\n        native_bolflux = (\n            self.scale.value * const.sigma_sb * self.temperature ** 4 / np.pi\n        )\n        # return in more \"astro\" units\n        return native_bolflux.to(u.erg / (u.cm ** 2 * u.s))\n\n    @property\n    def lambda_max(self):\n        \"\"\"Peak wavelength when the curve is expressed as power density.\"\"\"\n        return const.b_wien / self.temperature\n\n    @property\n    def nu_max(self):\n        \"\"\"Peak frequency when the curve is expressed as power density.\"\"\"\n        return 2.8214391 * const.k_B * self.temperature / const.h\n\n\nclass Drude1D(Fittable1DModel):\n    \"\"\"\n    Drude model based one the behavior of electons in materials (esp. metals).\n\n    Parameters\n    ----------\n    amplitude : float\n        Peak value\n    x_0 : float\n        Position of the peak\n    fwhm : float\n        Full width at half maximum\n\n    Model formula:\n\n        .. math:: f(x) = A \\\\frac{(fwhm/x_0)^2}{((x/x_0 - x_0/x)^2 + (fwhm/x_0)^2}\n\n    Examples\n    --------\n\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Drude1D\n\n        fig, ax = plt.subplots()\n\n        # generate the curves and plot them\n        x = np.arange(7.5 , 12.5 , 0.1)\n\n        dmodel = Drude1D(amplitude=1.0, fwhm=1.0, x_0=10.0)\n        ax.plot(x, dmodel(x))\n\n        ax.set_xlabel('x')\n        ax.set_ylabel('F(x)')\n\n        plt.show()\n    \"\"\"\n\n    amplitude = Parameter(default=1.0, description=\"Peak Value\")\n    x_0 = Parameter(default=1.0, description=\"Position of the peak\")\n    fwhm = Parameter(default=1.0, description=\"Full width at half maximum\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, fwhm):\n        \"\"\"\n        One dimensional Drude model function\n        \"\"\"\n        return (\n            amplitude\n            * ((fwhm / x_0) ** 2)\n            / ((x / x_0 - x_0 / x) ** 2 + (fwhm / x_0) ** 2)\n        )\n\n    @staticmethod\n    def fit_deriv(x, amplitude, x_0, fwhm):\n        \"\"\"\n        Drude1D model function derivatives.\n        \"\"\"\n        d_amplitude = (fwhm / x_0) ** 2 / ((x / x_0 - x_0 / x) ** 2 + (fwhm / x_0) ** 2)\n        d_x_0 = (\n            -2\n            * amplitude\n            * d_amplitude\n            * (\n                (1 / x_0)\n                + d_amplitude\n                * (x_0 ** 2 / fwhm ** 2)\n                * (\n                    (-x / x_0 - 1 / x) * (x / x_0 - x_0 / x)\n                    - (2 * fwhm ** 2 / x_0 ** 3)\n                )\n            )\n        )\n        d_fwhm = (2 * amplitude * d_amplitude / fwhm) * (1 - d_amplitude)\n        return [d_amplitude, d_x_0, d_fwhm]\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {\n            \"x_0\": inputs_unit[self.inputs[0]],\n            \"fwhm\": inputs_unit[self.inputs[0]],\n            \"amplitude\": outputs_unit[self.outputs[0]],\n        }\n\n    @property\n    def return_units(self):\n        if self.amplitude.unit is None:\n            return None\n        return {self.outputs[0]: self.amplitude.unit}\n\n    @x_0.validator\n    def x_0(self, val):\n        \"\"\" Ensure `x_0` is not 0.\"\"\"\n        if np.any(val == 0):\n            raise InputParameterError(\"0 is not an allowed value for x_0\")\n\n    def bounding_box(self, factor=50):\n        \"\"\"Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``.\n\n        Parameters\n        ----------\n        factor : float\n            The multiple of FWHM used to define the limits.\n        \"\"\"\n        x0 = self.x_0\n        dx = factor * self.fwhm\n\n        return (x0 - dx, x0 + dx)\n\n\nclass Plummer1D(Fittable1DModel):\n    r\"\"\"One dimensional Plummer density profile model.\n\n    Parameters\n    ----------\n    mass : float\n        Total mass of cluster.\n    r_plum : float\n        Scale parameter which sets the size of the cluster core.\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        \\rho(r)=\\frac{3M}{4\\pi a^3}(1+\\frac{r^2}{a^2})^{-5/2}\n\n    References\n    ----------\n    .. [1] https://ui.adsabs.harvard.edu/abs/1911MNRAS..71..460P\n    \"\"\"\n\n    mass = Parameter(default=1.0, description=\"Total mass of cluster\")\n    r_plum = Parameter(default=1.0, description=\"Scale parameter which sets the size of the cluster core\")\n\n    @staticmethod\n    def evaluate(x, mass, r_plum):\n        \"\"\"\n        Evaluate plummer density profile model.\n        \"\"\"\n        return (3*mass)/(4 * np.pi * r_plum**3) * (1+(x/r_plum)**2)**(-5/2)\n\n    @staticmethod\n    def fit_deriv(x, mass, r_plum):\n        \"\"\"\n        Plummer1D model derivatives.\n        \"\"\"\n        d_mass = 3 / ((4*np.pi*r_plum**3) * (((x/r_plum)**2 + 1)**(5/2)))\n        d_r_plum = (6*mass*x**2-9*mass*r_plum**2) / ((4*np.pi * r_plum**6) *\n                                                     (1+(x/r_plum)**2)**(7/2))\n        return [d_mass, d_r_plum]\n\n    @property\n    def input_units(self):\n        if self.mass.unit is None and self.r_plum.unit is None:\n            return None\n        else:\n            return {self.inputs[0]: self.r_plum.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'mass': outputs_unit[self.outputs[0]] * inputs_unit[self.inputs[0]] ** 3,\n                'r_plum': inputs_unit[self.inputs[0]]}\n\n\nclass NFW(Fittable1DModel):\n    r\"\"\"\n    Navarro–Frenk–White (NFW) profile - model for radial distribution of dark matter.\n\n    Parameters\n    ----------\n    mass : float or `~astropy.units.Quantity` ['mass']\n        Mass of NFW peak within specified overdensity radius.\n    concentration : float\n        Concentration of the NFW profile.\n    redshift : float\n        Redshift of the NFW profile.\n    massfactor : tuple or str\n        Mass overdensity factor and type for provided profiles:\n            Tuple version:\n                (\"virial\",) : virial radius\n\n                (\"critical\", N)  : radius where density is N times that of the critical density\n\n                (\"mean\", N)  : radius where density is N times that of the mean density\n\n            String version:\n                \"virial\" : virial radius\n\n                \"Nc\"  : radius where density is N times that of the critical density (e.g. \"200c\")\n\n                \"Nm\"  : radius where density is N times that of the mean density (e.g. \"500m\")\n    cosmo : :class:`~astropy.cosmology.Cosmology`\n        Background cosmology for density calculation. If None, the default cosmology will be used.\n\n    Notes\n    -----\n\n    Model formula:\n\n    .. math:: \\rho(r)=\\frac{\\delta_c\\rho_{c}}{r/r_s(1+r/r_s)^2}\n\n    References\n    ----------\n    .. [1] https://arxiv.org/pdf/astro-ph/9508025\n    .. [2] https://en.wikipedia.org/wiki/Navarro%E2%80%93Frenk%E2%80%93White_profile\n    .. [3] https://en.wikipedia.org/wiki/Virial_mass\n    \"\"\"\n\n    # Model Parameters\n\n    # NFW Profile mass\n    mass = Parameter(default=1.0, min=1.0, unit=u.M_sun,\n           description=\"Peak mass within specified overdensity radius\")\n\n    # NFW profile concentration\n    concentration = Parameter(default=1.0, min=1.0, description=\"Concentration\")\n\n    # NFW Profile redshift\n    redshift = Parameter(default=0.0, min=0.0, description=\"Redshift\")\n\n    # We allow values without units to be passed when evaluating the model, and\n    # in this case the input r values are assumed to be lengths / positions in kpc.\n    _input_units_allow_dimensionless = True\n\n    def __init__(self, mass=u.Quantity(mass.default, mass.unit),\n                 concentration=concentration.default, redshift=redshift.default,\n                 massfactor=(\"critical\", 200), cosmo=None,  **kwargs):\n        # Set default cosmology\n        if cosmo is None:\n            # LOCAL\n            from astropy.cosmology import default_cosmology\n\n            cosmo = default_cosmology.get()\n\n        # Set mass overdensity type and factor\n        self._density_delta(massfactor, cosmo, redshift)\n\n        # Establish mass units for density calculation (default solar masses)\n        if not isinstance(mass, u.Quantity):\n            in_mass = u.Quantity(mass, u.M_sun)\n        else:\n            in_mass = mass\n\n        # Obtain scale radius\n        self._radius_s(mass, concentration)\n\n        # Obtain scale density\n        self._density_s(mass, concentration)\n\n        super().__init__(mass=in_mass, concentration=concentration, redshift=redshift, **kwargs)\n\n    def evaluate(self, r, mass, concentration, redshift):\n        \"\"\"\n        One dimensional NFW profile function\n\n        Parameters\n        ----------\n        r : float or `~astropy.units.Quantity` ['length']\n            Radial position of density to be calculated for the NFW profile.\n        mass : float or `~astropy.units.Quantity` ['mass']\n            Mass of NFW peak within specified overdensity radius.\n        concentration : float\n            Concentration of the NFW profile.\n        redshift : float\n            Redshift of the NFW profile.\n\n        Returns\n        -------\n        density : float or `~astropy.units.Quantity` ['density']\n            NFW profile mass density at location ``r``. The density units are:\n            [``mass`` / ``r`` ^3]\n\n        Notes\n        -----\n        .. warning::\n\n            Output values might contain ``nan`` and ``inf``.\n        \"\"\"\n        # Create radial version of input with dimension\n        if hasattr(r, \"unit\"):\n            in_r = r\n        else:\n            in_r = u.Quantity(r, u.kpc)\n\n        # Define reduced radius (r / r_{\\\\rm s})\n        #   also update scale radius\n        radius_reduced = in_r / self._radius_s(mass, concentration).to(in_r.unit)\n\n        # Density distribution\n        # \\rho (r)=\\frac{\\rho_0}{\\frac{r}{R_s}\\left(1~+~\\frac{r}{R_s}\\right)^2}\n        #   also update scale density\n        density = self._density_s(mass, concentration) / (radius_reduced *\n                                                          (u.Quantity(1.0) + radius_reduced) ** 2)\n\n        if hasattr(mass, \"unit\"):\n            return density\n        else:\n            return density.value\n\n    def _density_delta(self, massfactor, cosmo, redshift):\n        \"\"\"\n        Calculate density delta.\n        \"\"\"\n        # Set mass overdensity type and factor\n        if isinstance(massfactor, tuple):\n            # Tuple options\n            #   (\"virial\")       : virial radius\n            #   (\"critical\", N)  : radius where density is N that of the critical density\n            #   (\"mean\", N)      : radius where density is N that of the mean density\n            if massfactor[0].lower() == \"virial\":\n                # Virial Mass\n                delta = None\n                masstype = massfactor[0].lower()\n            elif massfactor[0].lower() == \"critical\":\n                # Critical or Mean Overdensity Mass\n                delta = float(massfactor[1])\n                masstype = 'c'\n            elif massfactor[0].lower() == \"mean\":\n                # Critical or Mean Overdensity Mass\n                delta = float(massfactor[1])\n                masstype = 'm'\n            else:\n                raise ValueError(\"Massfactor '\" + str(massfactor[0]) + \"' not one of 'critical', \"\n                                                                       \"'mean', or 'virial'\")\n        else:\n            try:\n                # String options\n                #   virial : virial radius\n                #   Nc  : radius where density is N that of the critical density\n                #   Nm  : radius where density is N that of the mean density\n                if massfactor.lower() == \"virial\":\n                    # Virial Mass\n                    delta = None\n                    masstype = massfactor.lower()\n                elif massfactor[-1].lower() == 'c' or massfactor[-1].lower() == 'm':\n                    # Critical or Mean Overdensity Mass\n                    delta = float(massfactor[0:-1])\n                    masstype = massfactor[-1].lower()\n                else:\n                    raise ValueError(\"Massfactor \" + str(massfactor) + \" string not of the form \"\n                                                                       \"'#m', '#c', or 'virial'\")\n            except (AttributeError, TypeError):\n                raise TypeError(\"Massfactor \" + str(\n                    massfactor) + \" not a tuple or string\")\n\n        # Set density from masstype specification\n        if masstype == \"virial\":\n            Om_c = cosmo.Om(redshift) - 1.0\n            d_c = 18.0 * np.pi ** 2 + 82.0 * Om_c - 39.0 * Om_c ** 2\n            self.density_delta = d_c * cosmo.critical_density(redshift)\n        elif masstype == 'c':\n            self.density_delta = delta * cosmo.critical_density(redshift)\n        elif masstype == 'm':\n            self.density_delta = delta * cosmo.critical_density(redshift) * cosmo.Om(redshift)\n\n        return self.density_delta\n\n    @staticmethod\n    def A_NFW(y):\n        r\"\"\"\n        Dimensionless volume integral of the NFW profile, used as an intermediate step in some\n        calculations for this model.\n\n        Notes\n        -----\n\n        Model formula:\n\n        .. math:: A_{NFW} = [\\ln(1+y) - \\frac{y}{1+y}]\n        \"\"\"\n        return np.log(1.0 + y) - (y / (1.0 + y))\n\n    def _density_s(self, mass, concentration):\n        \"\"\"\n        Calculate scale density of the NFW profile.\n        \"\"\"\n        # Enforce default units\n        if not isinstance(mass, u.Quantity):\n            in_mass = u.Quantity(mass, u.M_sun)\n        else:\n            in_mass = mass\n\n        # Calculate scale density\n        # M_{200} = 4\\pi \\rho_{s} R_{s}^3 \\left[\\ln(1+c) - \\frac{c}{1+c}\\right].\n        self.density_s = in_mass / (4.0 * np.pi * self._radius_s(in_mass, concentration) ** 3 *\n                                    self.A_NFW(concentration))\n\n        return self.density_s\n\n    @property\n    def rho_scale(self):\n        r\"\"\"\n        Scale density of the NFW profile. Often written in the literature as :math:`\\rho_s`\n        \"\"\"\n        return self.density_s\n\n    def _radius_s(self, mass, concentration):\n        \"\"\"\n        Calculate scale radius of the NFW profile.\n        \"\"\"\n        # Enforce default units\n        if not isinstance(mass, u.Quantity):\n            in_mass = u.Quantity(mass, u.M_sun)\n        else:\n            in_mass = mass\n\n        # Delta Mass is related to delta radius by\n        # M_{200}=\\frac{4}{3}\\pi r_{200}^3 200 \\rho_{c}\n        # And delta radius is related to the NFW scale radius by\n        # c = R / r_{\\\\rm s}\n        self.radius_s = (((3.0 * in_mass) / (4.0 * np.pi * self.density_delta)) ** (\n                          1.0 / 3.0)) / concentration\n\n        # Set radial units to kiloparsec by default (unit will be rescaled by units of radius\n        # in evaluate)\n        return self.radius_s.to(u.kpc)\n\n    @property\n    def r_s(self):\n        \"\"\"\n        Scale radius of the NFW profile.\n        \"\"\"\n        return self.radius_s\n\n    @property\n    def r_virial(self):\n        \"\"\"\n        Mass factor defined virial radius of the NFW profile (R200c for M200c, Rvir for Mvir, etc.).\n        \"\"\"\n        return self.r_s * self.concentration\n\n    @property\n    def r_max(self):\n        \"\"\"\n        Radius of maximum circular velocity.\n        \"\"\"\n        return self.r_s * 2.16258\n\n    @property\n    def v_max(self):\n        \"\"\"\n        Maximum circular velocity.\n        \"\"\"\n        return self.circular_velocity(self.r_max)\n\n    def circular_velocity(self, r):\n        r\"\"\"\n        Circular velocities of the NFW profile.\n\n        Parameters\n        ----------\n        r : float or `~astropy.units.Quantity` ['length']\n            Radial position of velocity to be calculated for the NFW profile.\n\n        Returns\n        -------\n        velocity : float or `~astropy.units.Quantity` ['speed']\n            NFW profile circular velocity at location ``r``. The velocity units are:\n            [km / s]\n\n        Notes\n        -----\n\n        Model formula:\n\n        .. math:: v_{circ}(r)^2 = \\frac{1}{x}\\frac{\\ln(1+cx)-(cx)/(1+cx)}{\\ln(1+c)-c/(1+c)}\n\n        .. math:: x = r/r_s\n\n        .. warning::\n\n            Output values might contain ``nan`` and ``inf``.\n        \"\"\"\n        # Enforce default units (if parameters are without units)\n        if hasattr(r, \"unit\"):\n            in_r = r\n        else:\n            in_r = u.Quantity(r, u.kpc)\n\n        # Mass factor defined velocity (i.e. V200c for M200c, Rvir for Mvir)\n        v_profile = np.sqrt(self.mass * const.G.to(in_r.unit**3 / (self.mass.unit * u.s**2)) /\n                            self.r_virial)\n\n        # Define reduced radius (r / r_{\\\\rm s})\n        reduced_radius = in_r / self.r_virial.to(in_r.unit)\n\n        # Circular velocity given by:\n        # v^2=\\frac{1}{x}\\frac{\\ln(1+cx)-(cx)/(1+cx)}{\\ln(1+c)-c/(1+c)}\n        # where x=r/r_{200}\n        velocity = np.sqrt((v_profile**2 * self.A_NFW(self.concentration * reduced_radius)) /\n                           (reduced_radius * self.A_NFW(self.concentration)))\n\n        return velocity.to(u.km / u.s)\n\n    @property\n    def input_units(self):\n        # The units for the 'r' variable should be a length (default kpc)\n        return {self.inputs[0]: u.kpc}\n\n    @property\n    def return_units(self):\n        # The units for the 'density' variable should be a matter density (default M_sun / kpc^3)\n\n        if (self.mass.unit is None):\n            return {self.outputs[0]: u.M_sun / self.input_units[self.inputs[0]] ** 3}\n        else:\n            return {self.outputs[0]: self.mass.unit / self.input_units[self.inputs[0]] ** 3}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'mass': u.M_sun,\n                \"concentration\": None,\n                \"redshift\": None}\n"},{"col":0,"comment":"","endLoc":8,"header":"__init__.py#<anonymous>","id":12414,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis subpackage provides a framework for representing models and\nperforming model evaluation and fitting. It supports 1D and 2D models\nand fitting with parameter constraints. It has some predefined models\nand fitting routines.\n\"\"\""},{"fileName":"setup_package.py","filePath":"astropy/modeling","id":12415,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\nfrom os.path import join\nfrom collections import defaultdict\n\nfrom setuptools import Extension\n\nfrom extension_helpers import import_file\n\n\n# This defines the set of projection functions that we want to wrap.\n# The key is the projection name, and the value is the number of\n# parameters.\n\n# (These are in the order that the appear in the WCS coordinate\n# systems paper).\nprojections = {\n    'azp': 2,\n    'szp': 3,\n    'tan': 0,\n    'stg': 0,\n    'sin': 2,\n    'arc': 0,\n    'zea': 0,\n    'air': 1,\n    'cyp': 2,\n    'cea': 1,\n    'mer': 0,\n    'sfl': 0,\n    'par': 0,\n    'mol': 0,\n    'ait': 0,\n    'cop': 2,\n    'coe': 2,\n    'cod': 2,\n    'coo': 2,\n    'bon': 1,\n    'pco': 0,\n    'tsc': 0,\n    'csc': 0,\n    'qsc': 0,\n    'hpx': 2,\n    'xph': 0,\n}\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":12416,"name":"projections","nodeType":"Attribute","startLoc":18,"text":"projections"},{"col":0,"comment":"","endLoc":3,"header":"setup_package.py#<anonymous>","id":12417,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"projections = {\n    'azp': 2,\n    'szp': 3,\n    'tan': 0,\n    'stg': 0,\n    'sin': 2,\n    'arc': 0,\n    'zea': 0,\n    'air': 1,\n    'cyp': 2,\n    'cea': 1,\n    'mer': 0,\n    'sfl': 0,\n    'par': 0,\n    'mol': 0,\n    'ait': 0,\n    'cop': 2,\n    'coe': 2,\n    'cod': 2,\n    'coo': 2,\n    'bon': 1,\n    'pco': 0,\n    'tsc': 0,\n    'csc': 0,\n    'qsc': 0,\n    'hpx': 2,\n    'xph': 0,\n}"},{"fileName":"mappings.py","filePath":"astropy/modeling","id":12418,"nodeType":"File","text":"\"\"\"\nSpecial models useful for complex compound models where control is needed over\nwhich outputs from a source model are mapped to which inputs of a target model.\n\"\"\"\n# pylint: disable=invalid-name\n\nfrom .core import FittableModel, Model\nfrom astropy.units import Quantity\n\n\n__all__ = ['Mapping', 'Identity', 'UnitsMapping']\n\n\nclass Mapping(FittableModel):\n    \"\"\"\n    Allows inputs to be reordered, duplicated or dropped.\n\n    Parameters\n    ----------\n    mapping : tuple\n        A tuple of integers representing indices of the inputs to this model\n        to return and in what order to return them.  See\n        :ref:`astropy:compound-model-mappings` for more details.\n    n_inputs : int\n        Number of inputs; if `None` (default) then ``max(mapping) + 1`` is\n        used (i.e. the highest input index used in the mapping).\n    name : str, optional\n        A human-friendly name associated with this model instance\n        (particularly useful for identifying the individual components of a\n        compound model).\n    meta : dict-like\n        Free-form metadata to associate with this model.\n\n    Raises\n    ------\n    TypeError\n        Raised when number of inputs is less that ``max(mapping)``.\n\n    Examples\n    --------\n\n    >>> from astropy.modeling.models import Polynomial2D, Shift, Mapping\n    >>> poly1 = Polynomial2D(1, c0_0=1, c1_0=2, c0_1=3)\n    >>> poly2 = Polynomial2D(1, c0_0=1, c1_0=2.4, c0_1=2.1)\n    >>> model = (Shift(1) & Shift(2)) | Mapping((0, 1, 0, 1)) | (poly1 & poly2)\n    >>> model(1, 2)  # doctest: +FLOAT_CMP\n    (17.0, 14.2)\n    \"\"\"\n    linear = True  # FittableModel is non-linear by default\n\n    def __init__(self, mapping, n_inputs=None, name=None, meta=None):\n        self._inputs = ()\n        self._outputs = ()\n        if n_inputs is None:\n            self._n_inputs = max(mapping) + 1\n        else:\n            self._n_inputs = n_inputs\n\n        self._n_outputs = len(mapping)\n        super().__init__(name=name, meta=meta)\n\n        self.inputs = tuple('x' + str(idx) for idx in range(self._n_inputs))\n        self.outputs = tuple('x' + str(idx) for idx in range(self._n_outputs))\n\n        self._mapping = mapping\n        self._input_units_strict = {key: False for key in self._inputs}\n        self._input_units_allow_dimensionless = {key: False for key in self._inputs}\n\n    @property\n    def n_inputs(self):\n        return self._n_inputs\n\n    @property\n    def n_outputs(self):\n        return self._n_outputs\n\n    @property\n    def mapping(self):\n        \"\"\"Integers representing indices of the inputs.\"\"\"\n        return self._mapping\n\n    def __repr__(self):\n        if self.name is None:\n            return f'<Mapping({self.mapping})>'\n        return f'<Mapping({self.mapping}, name={self.name!r})>'\n\n    def evaluate(self, *args):\n        if len(args) != self.n_inputs:\n            name = self.name if self.name is not None else \"Mapping\"\n\n            raise TypeError(f'{name} expects {self.n_inputs} inputs; got {len(args)}')\n\n        result = tuple(args[idx] for idx in self._mapping)\n\n        if self.n_outputs == 1:\n            return result[0]\n\n        return result\n\n    @property\n    def inverse(self):\n        \"\"\"\n        A `Mapping` representing the inverse of the current mapping.\n\n        Raises\n        ------\n        `NotImplementedError`\n            An inverse does no exist on mappings that drop some of its inputs\n            (there is then no way to reconstruct the inputs that were dropped).\n        \"\"\"\n\n        try:\n            mapping = tuple(self.mapping.index(idx)\n                            for idx in range(self.n_inputs))\n        except ValueError:\n            raise NotImplementedError(\n                \"Mappings such as {} that drop one or more of their inputs \"\n                \"are not invertible at this time.\".format(self.mapping))\n\n        inv = self.__class__(mapping)\n        inv._inputs = self._outputs\n        inv._outputs = self._inputs\n        inv._n_inputs = len(inv._inputs)\n        inv._n_outputs = len(inv._outputs)\n        return inv\n\n\nclass Identity(Mapping):\n    \"\"\"\n    Returns inputs unchanged.\n\n    This class is useful in compound models when some of the inputs must be\n    passed unchanged to the next model.\n\n    Parameters\n    ----------\n    n_inputs : int\n        Specifies the number of inputs this identity model accepts.\n    name : str, optional\n        A human-friendly name associated with this model instance\n        (particularly useful for identifying the individual components of a\n        compound model).\n    meta : dict-like\n        Free-form metadata to associate with this model.\n\n    Examples\n    --------\n\n    Transform ``(x, y)`` by a shift in x, followed by scaling the two inputs::\n\n        >>> from astropy.modeling.models import (Polynomial1D, Shift, Scale,\n        ...                                      Identity)\n        >>> model = (Shift(1) & Identity(1)) | Scale(1.2) & Scale(2)\n        >>> model(1,1)  # doctest: +FLOAT_CMP\n        (2.4, 2.0)\n        >>> model.inverse(2.4, 2) # doctest: +FLOAT_CMP\n        (1.0, 1.0)\n    \"\"\"\n    linear = True  # FittableModel is non-linear by default\n\n    def __init__(self, n_inputs, name=None, meta=None):\n        mapping = tuple(range(n_inputs))\n        super().__init__(mapping, name=name, meta=meta)\n\n    def __repr__(self):\n        if self.name is None:\n            return f'<Identity({self.n_inputs})>'\n        return f'<Identity({self.n_inputs}, name={self.name!r})>'\n\n    @property\n    def inverse(self):\n        \"\"\"\n        The inverse transformation.\n\n        In this case of `Identity`, ``self.inverse is self``.\n        \"\"\"\n\n        return self\n\n\nclass UnitsMapping(Model):\n    \"\"\"\n    Mapper that operates on the units of the input, first converting to\n    canonical units, then assigning new units without further conversion.\n    Used by Model.coerce_units to support units on otherwise unitless models\n    such as Polynomial1D.\n\n    Parameters\n    ----------\n    mapping : tuple\n        A tuple of (input_unit, output_unit) pairs, one per input, matched to the\n        inputs by position.  The first element of the each pair is the unit that\n        the model will accept (specify ``dimensionless_unscaled``\n        to accept dimensionless input).  The second element is the unit that the\n        model will return.  Specify ``dimensionless_unscaled``\n        to return dimensionless Quantity, and `None` to return raw values without\n        Quantity.\n    input_units_equivalencies : dict, optional\n        Default equivalencies to apply to input values.  If set, this should be a\n        dictionary where each key is a string that corresponds to one of the\n        model inputs.\n    input_units_allow_dimensionless : dict or bool, optional\n        Allow dimensionless input. If this is True, input values to evaluate will\n        gain the units specified in input_units. If this is a dictionary then it\n        should map input name to a bool to allow dimensionless numbers for that\n        input.\n    name : str, optional\n        A human-friendly name associated with this model instance\n        (particularly useful for identifying the individual components of a\n        compound model).\n    meta : dict-like, optional\n        Free-form metadata to associate with this model.\n\n    Examples\n    --------\n\n    Wrapping a unitless model to require and convert units:\n\n    >>> from astropy.modeling.models import Polynomial1D, UnitsMapping\n    >>> from astropy import units as u\n    >>> poly = Polynomial1D(1, c0=1, c1=2)\n    >>> model = UnitsMapping(((u.m, None),)) | poly\n    >>> model = model | UnitsMapping(((None, u.s),))\n    >>> model(u.Quantity(10, u.m))  # doctest: +FLOAT_CMP\n    <Quantity 21. s>\n    >>> model(u.Quantity(1000, u.cm)) # doctest: +FLOAT_CMP\n    <Quantity 21. s>\n    >>> model(u.Quantity(10, u.cm)) # doctest: +FLOAT_CMP\n    <Quantity 1.2 s>\n\n    Wrapping a unitless model but still permitting unitless input:\n\n    >>> from astropy.modeling.models import Polynomial1D, UnitsMapping\n    >>> from astropy import units as u\n    >>> poly = Polynomial1D(1, c0=1, c1=2)\n    >>> model = UnitsMapping(((u.m, None),), input_units_allow_dimensionless=True) | poly\n    >>> model = model | UnitsMapping(((None, u.s),))\n    >>> model(u.Quantity(10, u.m))  # doctest: +FLOAT_CMP\n    <Quantity 21. s>\n    >>> model(10)  # doctest: +FLOAT_CMP\n    <Quantity 21. s>\n    \"\"\"\n    def __init__(\n        self,\n        mapping,\n        input_units_equivalencies=None,\n        input_units_allow_dimensionless=False,\n        name=None,\n        meta=None\n    ):\n        self._mapping = mapping\n\n        none_mapping_count = len([m for m in mapping if m[-1] is None])\n        if none_mapping_count > 0 and none_mapping_count != len(mapping):\n            raise ValueError(\"If one return unit is None, then all must be None\")\n\n        # These attributes are read and handled by Model\n        self._input_units_strict = True\n        self.input_units_equivalencies = input_units_equivalencies\n        self._input_units_allow_dimensionless = input_units_allow_dimensionless\n\n        super().__init__(name=name, meta=meta)\n\n        # Can't invoke this until after super().__init__, since\n        # we need self.inputs and self.outputs to be populated.\n        self._rebuild_units()\n\n    def _rebuild_units(self):\n        self._input_units = {input_name: input_unit for input_name, (input_unit, _) in zip(self.inputs, self.mapping)}\n\n    @property\n    def n_inputs(self):\n        return len(self._mapping)\n\n    @property\n    def n_outputs(self):\n        return len(self._mapping)\n\n    @property\n    def inputs(self):\n        return super().inputs\n\n    @inputs.setter\n    def inputs(self, value):\n        super(UnitsMapping, self.__class__).inputs.fset(self, value)\n        self._rebuild_units()\n\n    @property\n    def outputs(self):\n        return super().outputs\n\n    @outputs.setter\n    def outputs(self, value):\n        super(UnitsMapping, self.__class__).outputs.fset(self, value)\n        self._rebuild_units()\n\n    @property\n    def input_units(self):\n        return self._input_units\n\n    @property\n    def mapping(self):\n        return self._mapping\n\n    def evaluate(self, *args):\n        result = []\n        for arg, (_, return_unit) in zip(args, self.mapping):\n            if isinstance(arg, Quantity):\n                value = arg.value\n            else:\n                value = arg\n            if return_unit is None:\n                result.append(value)\n            else:\n                result.append(Quantity(value, return_unit, subok=True))\n\n        if self.n_outputs == 1:\n            return result[0]\n        else:\n            return tuple(result)\n\n    def __repr__(self):\n        if self.name is None:\n            return f\"<UnitsMapping({self.mapping})>\"\n        else:\n            return f\"<UnitsMapping({self.mapping}, name={self.name!r})>\"\n"},{"className":"BlackBody","col":0,"comment":"\n    Blackbody model using the Planck function.\n\n    Parameters\n    ----------\n    temperature : `~astropy.units.Quantity` ['temperature']\n        Blackbody temperature.\n\n    scale : float or `~astropy.units.Quantity` ['dimensionless']\n        Scale factor\n\n    Notes\n    -----\n\n    Model formula:\n\n        .. math:: B_{\\nu}(T) = A \\frac{2 h \\nu^{3} / c^{2}}{exp(h \\nu / k T) - 1}\n\n    Examples\n    --------\n    >>> from astropy.modeling import models\n    >>> from astropy import units as u\n    >>> bb = models.BlackBody(temperature=5000*u.K)\n    >>> bb(6000 * u.AA)  # doctest: +FLOAT_CMP\n    <Quantity 1.53254685e-05 erg / (cm2 Hz s sr)>\n\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import BlackBody\n        from astropy import units as u\n        from astropy.visualization import quantity_support\n\n        bb = BlackBody(temperature=5778*u.K)\n        wav = np.arange(1000, 110000) * u.AA\n        flux = bb(wav)\n\n        with quantity_support():\n            plt.figure()\n            plt.semilogx(wav, flux)\n            plt.axvline(bb.nu_max.to(u.AA, equivalencies=u.spectral()).value, ls='--')\n            plt.show()\n    ","endLoc":198,"id":12419,"nodeType":"Class","startLoc":20,"text":"class BlackBody(Fittable1DModel):\n    \"\"\"\n    Blackbody model using the Planck function.\n\n    Parameters\n    ----------\n    temperature : `~astropy.units.Quantity` ['temperature']\n        Blackbody temperature.\n\n    scale : float or `~astropy.units.Quantity` ['dimensionless']\n        Scale factor\n\n    Notes\n    -----\n\n    Model formula:\n\n        .. math:: B_{\\\\nu}(T) = A \\\\frac{2 h \\\\nu^{3} / c^{2}}{exp(h \\\\nu / k T) - 1}\n\n    Examples\n    --------\n    >>> from astropy.modeling import models\n    >>> from astropy import units as u\n    >>> bb = models.BlackBody(temperature=5000*u.K)\n    >>> bb(6000 * u.AA)  # doctest: +FLOAT_CMP\n    <Quantity 1.53254685e-05 erg / (cm2 Hz s sr)>\n\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import BlackBody\n        from astropy import units as u\n        from astropy.visualization import quantity_support\n\n        bb = BlackBody(temperature=5778*u.K)\n        wav = np.arange(1000, 110000) * u.AA\n        flux = bb(wav)\n\n        with quantity_support():\n            plt.figure()\n            plt.semilogx(wav, flux)\n            plt.axvline(bb.nu_max.to(u.AA, equivalencies=u.spectral()).value, ls='--')\n            plt.show()\n    \"\"\"\n\n    # We parametrize this model with a temperature and a scale.\n    temperature = Parameter(default=5000.0, min=0, unit=u.K, description=\"Blackbody temperature\")\n    scale = Parameter(default=1.0, min=0, description=\"Scale factor\")\n\n    # We allow values without units to be passed when evaluating the model, and\n    # in this case the input x values are assumed to be frequencies in Hz.\n    _input_units_allow_dimensionless = True\n\n    # We enable the spectral equivalency by default for the spectral axis\n    input_units_equivalencies = {'x': u.spectral()}\n\n    def evaluate(self, x, temperature, scale):\n        \"\"\"Evaluate the model.\n\n        Parameters\n        ----------\n        x : float, `~numpy.ndarray`, or `~astropy.units.Quantity` ['frequency']\n            Frequency at which to compute the blackbody. If no units are given,\n            this defaults to Hz.\n\n        temperature : float, `~numpy.ndarray`, or `~astropy.units.Quantity`\n            Temperature of the blackbody. If no units are given, this defaults\n            to Kelvin.\n\n        scale : float, `~numpy.ndarray`, or `~astropy.units.Quantity` ['dimensionless']\n            Desired scale for the blackbody.\n\n        Returns\n        -------\n        y : number or ndarray\n            Blackbody spectrum. The units are determined from the units of\n            ``scale``.\n\n        .. note::\n\n            Use `numpy.errstate` to suppress Numpy warnings, if desired.\n\n        .. warning::\n\n            Output values might contain ``nan`` and ``inf``.\n\n        Raises\n        ------\n        ValueError\n            Invalid temperature.\n\n        ZeroDivisionError\n            Wavelength is zero (when converting to frequency).\n        \"\"\"\n        if not isinstance(temperature, u.Quantity):\n            in_temp = u.Quantity(temperature, u.K)\n        else:\n            in_temp = temperature\n\n        # Convert to units for calculations, also force double precision\n        with u.add_enabled_equivalencies(u.spectral() + u.temperature()):\n            freq = u.Quantity(x, u.Hz, dtype=np.float64)\n            temp = u.Quantity(in_temp, u.K)\n\n        # check the units of scale and setup the output units\n        bb_unit = u.erg / (u.cm ** 2 * u.s * u.Hz * u.sr)  # default unit\n        # use the scale that was used at initialization for determining the units to return\n        # to support returning the right units when fitting where units are stripped\n        if hasattr(self.scale, \"unit\") and self.scale.unit is not None:\n            # check that the units on scale are covertable to surface brightness units\n            if not self.scale.unit.is_equivalent(bb_unit, u.spectral_density(x)):\n                raise ValueError(\n                    f\"scale units not surface brightness: {self.scale.unit}\"\n                )\n            # use the scale passed to get the value for scaling\n            if hasattr(scale, \"unit\"):\n                mult_scale = scale.value\n            else:\n                mult_scale = scale\n            bb_unit = self.scale.unit\n        else:\n            mult_scale = scale\n\n        # Check if input values are physically possible\n        if np.any(temp < 0):\n            raise ValueError(f\"Temperature should be positive: {temp}\")\n        if not np.all(np.isfinite(freq)) or np.any(freq <= 0):\n            warnings.warn(\n                \"Input contains invalid wavelength/frequency value(s)\",\n                AstropyUserWarning,\n            )\n\n        log_boltz = const.h * freq / (const.k_B * temp)\n        boltzm1 = np.expm1(log_boltz)\n\n        # Calculate blackbody flux\n        bb_nu = 2.0 * const.h * freq ** 3 / (const.c ** 2 * boltzm1) / u.sr\n\n        y = mult_scale * bb_nu.to(bb_unit, u.spectral_density(freq))\n\n        # If the temperature parameter has no unit, we should return a unitless\n        # value. This occurs for instance during fitting, since we drop the\n        # units temporarily.\n        if hasattr(temperature, \"unit\"):\n            return y\n        return y.value\n\n    @property\n    def input_units(self):\n        # The input units are those of the 'x' value, which should always be\n        # Hz. Because we do this, and because input_units_allow_dimensionless\n        # is set to True, dimensionless values are assumed to be in Hz.\n        return {self.inputs[0]: u.Hz}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {\"temperature\": u.K}\n\n    @property\n    def bolometric_flux(self):\n        \"\"\"Bolometric flux.\"\"\"\n        # bolometric flux in the native units of the planck function\n        native_bolflux = (\n            self.scale.value * const.sigma_sb * self.temperature ** 4 / np.pi\n        )\n        # return in more \"astro\" units\n        return native_bolflux.to(u.erg / (u.cm ** 2 * u.s))\n\n    @property\n    def lambda_max(self):\n        \"\"\"Peak wavelength when the curve is expressed as power density.\"\"\"\n        return const.b_wien / self.temperature\n\n    @property\n    def nu_max(self):\n        \"\"\"Peak frequency when the curve is expressed as power density.\"\"\"\n        return 2.8214391 * const.k_B * self.temperature / const.h"},{"className":"UnitsMapping","col":0,"comment":"\n    Mapper that operates on the units of the input, first converting to\n    canonical units, then assigning new units without further conversion.\n    Used by Model.coerce_units to support units on otherwise unitless models\n    such as Polynomial1D.\n\n    Parameters\n    ----------\n    mapping : tuple\n        A tuple of (input_unit, output_unit) pairs, one per input, matched to the\n        inputs by position.  The first element of the each pair is the unit that\n        the model will accept (specify ``dimensionless_unscaled``\n        to accept dimensionless input).  The second element is the unit that the\n        model will return.  Specify ``dimensionless_unscaled``\n        to return dimensionless Quantity, and `None` to return raw values without\n        Quantity.\n    input_units_equivalencies : dict, optional\n        Default equivalencies to apply to input values.  If set, this should be a\n        dictionary where each key is a string that corresponds to one of the\n        model inputs.\n    input_units_allow_dimensionless : dict or bool, optional\n        Allow dimensionless input. If this is True, input values to evaluate will\n        gain the units specified in input_units. If this is a dictionary then it\n        should map input name to a bool to allow dimensionless numbers for that\n        input.\n    name : str, optional\n        A human-friendly name associated with this model instance\n        (particularly useful for identifying the individual components of a\n        compound model).\n    meta : dict-like, optional\n        Free-form metadata to associate with this model.\n\n    Examples\n    --------\n\n    Wrapping a unitless model to require and convert units:\n\n    >>> from astropy.modeling.models import Polynomial1D, UnitsMapping\n    >>> from astropy import units as u\n    >>> poly = Polynomial1D(1, c0=1, c1=2)\n    >>> model = UnitsMapping(((u.m, None),)) | poly\n    >>> model = model | UnitsMapping(((None, u.s),))\n    >>> model(u.Quantity(10, u.m))  # doctest: +FLOAT_CMP\n    <Quantity 21. s>\n    >>> model(u.Quantity(1000, u.cm)) # doctest: +FLOAT_CMP\n    <Quantity 21. s>\n    >>> model(u.Quantity(10, u.cm)) # doctest: +FLOAT_CMP\n    <Quantity 1.2 s>\n\n    Wrapping a unitless model but still permitting unitless input:\n\n    >>> from astropy.modeling.models import Polynomial1D, UnitsMapping\n    >>> from astropy import units as u\n    >>> poly = Polynomial1D(1, c0=1, c1=2)\n    >>> model = UnitsMapping(((u.m, None),), input_units_allow_dimensionless=True) | poly\n    >>> model = model | UnitsMapping(((None, u.s),))\n    >>> model(u.Quantity(10, u.m))  # doctest: +FLOAT_CMP\n    <Quantity 21. s>\n    >>> model(10)  # doctest: +FLOAT_CMP\n    <Quantity 21. s>\n    ","endLoc":326,"id":12420,"nodeType":"Class","startLoc":181,"text":"class UnitsMapping(Model):\n    \"\"\"\n    Mapper that operates on the units of the input, first converting to\n    canonical units, then assigning new units without further conversion.\n    Used by Model.coerce_units to support units on otherwise unitless models\n    such as Polynomial1D.\n\n    Parameters\n    ----------\n    mapping : tuple\n        A tuple of (input_unit, output_unit) pairs, one per input, matched to the\n        inputs by position.  The first element of the each pair is the unit that\n        the model will accept (specify ``dimensionless_unscaled``\n        to accept dimensionless input).  The second element is the unit that the\n        model will return.  Specify ``dimensionless_unscaled``\n        to return dimensionless Quantity, and `None` to return raw values without\n        Quantity.\n    input_units_equivalencies : dict, optional\n        Default equivalencies to apply to input values.  If set, this should be a\n        dictionary where each key is a string that corresponds to one of the\n        model inputs.\n    input_units_allow_dimensionless : dict or bool, optional\n        Allow dimensionless input. If this is True, input values to evaluate will\n        gain the units specified in input_units. If this is a dictionary then it\n        should map input name to a bool to allow dimensionless numbers for that\n        input.\n    name : str, optional\n        A human-friendly name associated with this model instance\n        (particularly useful for identifying the individual components of a\n        compound model).\n    meta : dict-like, optional\n        Free-form metadata to associate with this model.\n\n    Examples\n    --------\n\n    Wrapping a unitless model to require and convert units:\n\n    >>> from astropy.modeling.models import Polynomial1D, UnitsMapping\n    >>> from astropy import units as u\n    >>> poly = Polynomial1D(1, c0=1, c1=2)\n    >>> model = UnitsMapping(((u.m, None),)) | poly\n    >>> model = model | UnitsMapping(((None, u.s),))\n    >>> model(u.Quantity(10, u.m))  # doctest: +FLOAT_CMP\n    <Quantity 21. s>\n    >>> model(u.Quantity(1000, u.cm)) # doctest: +FLOAT_CMP\n    <Quantity 21. s>\n    >>> model(u.Quantity(10, u.cm)) # doctest: +FLOAT_CMP\n    <Quantity 1.2 s>\n\n    Wrapping a unitless model but still permitting unitless input:\n\n    >>> from astropy.modeling.models import Polynomial1D, UnitsMapping\n    >>> from astropy import units as u\n    >>> poly = Polynomial1D(1, c0=1, c1=2)\n    >>> model = UnitsMapping(((u.m, None),), input_units_allow_dimensionless=True) | poly\n    >>> model = model | UnitsMapping(((None, u.s),))\n    >>> model(u.Quantity(10, u.m))  # doctest: +FLOAT_CMP\n    <Quantity 21. s>\n    >>> model(10)  # doctest: +FLOAT_CMP\n    <Quantity 21. s>\n    \"\"\"\n    def __init__(\n        self,\n        mapping,\n        input_units_equivalencies=None,\n        input_units_allow_dimensionless=False,\n        name=None,\n        meta=None\n    ):\n        self._mapping = mapping\n\n        none_mapping_count = len([m for m in mapping if m[-1] is None])\n        if none_mapping_count > 0 and none_mapping_count != len(mapping):\n            raise ValueError(\"If one return unit is None, then all must be None\")\n\n        # These attributes are read and handled by Model\n        self._input_units_strict = True\n        self.input_units_equivalencies = input_units_equivalencies\n        self._input_units_allow_dimensionless = input_units_allow_dimensionless\n\n        super().__init__(name=name, meta=meta)\n\n        # Can't invoke this until after super().__init__, since\n        # we need self.inputs and self.outputs to be populated.\n        self._rebuild_units()\n\n    def _rebuild_units(self):\n        self._input_units = {input_name: input_unit for input_name, (input_unit, _) in zip(self.inputs, self.mapping)}\n\n    @property\n    def n_inputs(self):\n        return len(self._mapping)\n\n    @property\n    def n_outputs(self):\n        return len(self._mapping)\n\n    @property\n    def inputs(self):\n        return super().inputs\n\n    @inputs.setter\n    def inputs(self, value):\n        super(UnitsMapping, self.__class__).inputs.fset(self, value)\n        self._rebuild_units()\n\n    @property\n    def outputs(self):\n        return super().outputs\n\n    @outputs.setter\n    def outputs(self, value):\n        super(UnitsMapping, self.__class__).outputs.fset(self, value)\n        self._rebuild_units()\n\n    @property\n    def input_units(self):\n        return self._input_units\n\n    @property\n    def mapping(self):\n        return self._mapping\n\n    def evaluate(self, *args):\n        result = []\n        for arg, (_, return_unit) in zip(args, self.mapping):\n            if isinstance(arg, Quantity):\n                value = arg.value\n            else:\n                value = arg\n            if return_unit is None:\n                result.append(value)\n            else:\n                result.append(Quantity(value, return_unit, subok=True))\n\n        if self.n_outputs == 1:\n            return result[0]\n        else:\n            return tuple(result)\n\n    def __repr__(self):\n        if self.name is None:\n            return f\"<UnitsMapping({self.mapping})>\"\n        else:\n            return f\"<UnitsMapping({self.mapping}, name={self.name!r})>\""},{"col":4,"comment":"null","endLoc":273,"header":"@property\n    def n_inputs(self)","id":12421,"name":"n_inputs","nodeType":"Function","startLoc":271,"text":"@property\n    def n_inputs(self):\n        return len(self._mapping)"},{"col":4,"comment":"null","endLoc":277,"header":"@property\n    def n_outputs(self)","id":12422,"name":"n_outputs","nodeType":"Function","startLoc":275,"text":"@property\n    def n_outputs(self):\n        return len(self._mapping)"},{"col":11,"endLoc":57,"id":12423,"nodeType":"Lambda","startLoc":57,"text":"lambda left, right: CompoundModel(oper, left, right, **kwargs)"},{"col":4,"comment":"null","endLoc":281,"header":"@property\n    def inputs(self)","id":12424,"name":"inputs","nodeType":"Function","startLoc":279,"text":"@property\n    def inputs(self):\n        return super().inputs"},{"col":4,"comment":"Evaluate the model.\n\n        Parameters\n        ----------\n        x : float, `~numpy.ndarray`, or `~astropy.units.Quantity` ['frequency']\n            Frequency at which to compute the blackbody. If no units are given,\n            this defaults to Hz.\n\n        temperature : float, `~numpy.ndarray`, or `~astropy.units.Quantity`\n            Temperature of the blackbody. If no units are given, this defaults\n            to Kelvin.\n\n        scale : float, `~numpy.ndarray`, or `~astropy.units.Quantity` ['dimensionless']\n            Desired scale for the blackbody.\n\n        Returns\n        -------\n        y : number or ndarray\n            Blackbody spectrum. The units are determined from the units of\n            ``scale``.\n\n        .. note::\n\n            Use `numpy.errstate` to suppress Numpy warnings, if desired.\n\n        .. warning::\n\n            Output values might contain ``nan`` and ``inf``.\n\n        Raises\n        ------\n        ValueError\n            Invalid temperature.\n\n        ZeroDivisionError\n            Wavelength is zero (when converting to frequency).\n        ","endLoc":168,"header":"def evaluate(self, x, temperature, scale)","id":12425,"name":"evaluate","nodeType":"Function","startLoc":79,"text":"def evaluate(self, x, temperature, scale):\n        \"\"\"Evaluate the model.\n\n        Parameters\n        ----------\n        x : float, `~numpy.ndarray`, or `~astropy.units.Quantity` ['frequency']\n            Frequency at which to compute the blackbody. If no units are given,\n            this defaults to Hz.\n\n        temperature : float, `~numpy.ndarray`, or `~astropy.units.Quantity`\n            Temperature of the blackbody. If no units are given, this defaults\n            to Kelvin.\n\n        scale : float, `~numpy.ndarray`, or `~astropy.units.Quantity` ['dimensionless']\n            Desired scale for the blackbody.\n\n        Returns\n        -------\n        y : number or ndarray\n            Blackbody spectrum. The units are determined from the units of\n            ``scale``.\n\n        .. note::\n\n            Use `numpy.errstate` to suppress Numpy warnings, if desired.\n\n        .. warning::\n\n            Output values might contain ``nan`` and ``inf``.\n\n        Raises\n        ------\n        ValueError\n            Invalid temperature.\n\n        ZeroDivisionError\n            Wavelength is zero (when converting to frequency).\n        \"\"\"\n        if not isinstance(temperature, u.Quantity):\n            in_temp = u.Quantity(temperature, u.K)\n        else:\n            in_temp = temperature\n\n        # Convert to units for calculations, also force double precision\n        with u.add_enabled_equivalencies(u.spectral() + u.temperature()):\n            freq = u.Quantity(x, u.Hz, dtype=np.float64)\n            temp = u.Quantity(in_temp, u.K)\n\n        # check the units of scale and setup the output units\n        bb_unit = u.erg / (u.cm ** 2 * u.s * u.Hz * u.sr)  # default unit\n        # use the scale that was used at initialization for determining the units to return\n        # to support returning the right units when fitting where units are stripped\n        if hasattr(self.scale, \"unit\") and self.scale.unit is not None:\n            # check that the units on scale are covertable to surface brightness units\n            if not self.scale.unit.is_equivalent(bb_unit, u.spectral_density(x)):\n                raise ValueError(\n                    f\"scale units not surface brightness: {self.scale.unit}\"\n                )\n            # use the scale passed to get the value for scaling\n            if hasattr(scale, \"unit\"):\n                mult_scale = scale.value\n            else:\n                mult_scale = scale\n            bb_unit = self.scale.unit\n        else:\n            mult_scale = scale\n\n        # Check if input values are physically possible\n        if np.any(temp < 0):\n            raise ValueError(f\"Temperature should be positive: {temp}\")\n        if not np.all(np.isfinite(freq)) or np.any(freq <= 0):\n            warnings.warn(\n                \"Input contains invalid wavelength/frequency value(s)\",\n                AstropyUserWarning,\n            )\n\n        log_boltz = const.h * freq / (const.k_B * temp)\n        boltzm1 = np.expm1(log_boltz)\n\n        # Calculate blackbody flux\n        bb_nu = 2.0 * const.h * freq ** 3 / (const.c ** 2 * boltzm1) / u.sr\n\n        y = mult_scale * bb_nu.to(bb_unit, u.spectral_density(freq))\n\n        # If the temperature parameter has no unit, we should return a unitless\n        # value. This occurs for instance during fitting, since we drop the\n        # units temporarily.\n        if hasattr(temperature, \"unit\"):\n            return y\n        return y.value"},{"col":4,"comment":"null","endLoc":286,"header":"@inputs.setter\n    def inputs(self, value)","id":12426,"name":"inputs","nodeType":"Function","startLoc":283,"text":"@inputs.setter\n    def inputs(self, value):\n        super(UnitsMapping, self.__class__).inputs.fset(self, value)\n        self._rebuild_units()"},{"col":4,"comment":"null","endLoc":290,"header":"@property\n    def outputs(self)","id":12427,"name":"outputs","nodeType":"Function","startLoc":288,"text":"@property\n    def outputs(self):\n        return super().outputs"},{"col":4,"comment":"null","endLoc":295,"header":"@outputs.setter\n    def outputs(self, value)","id":12428,"name":"outputs","nodeType":"Function","startLoc":292,"text":"@outputs.setter\n    def outputs(self, value):\n        super(UnitsMapping, self.__class__).outputs.fset(self, value)\n        self._rebuild_units()"},{"attributeType":"null","col":8,"comment":"null","endLoc":2107,"id":12429,"name":"lr_method","nodeType":"Attribute","startLoc":2107,"text":"self.lr_method"},{"col":4,"comment":"\n        Currently for internal use only.\n\n        Like Parameter.value but does not pass the result through\n        Parameter.getter.  By design this should only be used from bound\n        parameters.\n\n        This will probably be removed are retweaked at some point in the\n        process of rethinking how parameter values are stored/updated.\n        ","endLoc":632,"header":"@property\n    def _raw_value(self)","id":12430,"name":"_raw_value","nodeType":"Function","startLoc":618,"text":"@property\n    def _raw_value(self):\n        \"\"\"\n        Currently for internal use only.\n\n        Like Parameter.value but does not pass the result through\n        Parameter.getter.  By design this should only be used from bound\n        parameters.\n\n        This will probably be removed are retweaked at some point in the\n        process of rethinking how parameter values are stored/updated.\n        \"\"\"\n        if self._setter:\n            return self._internal_value\n        return self.value"},{"col":4,"comment":"null","endLoc":676,"header":"def __array__(self, dtype=None)","id":12431,"name":"__array__","nodeType":"Function","startLoc":669,"text":"def __array__(self, dtype=None):\n        # Make np.asarray(self) work a little more straightforwardly\n        arr = np.asarray(self.value, dtype=dtype)\n\n        if self.unit is not None:\n            arr = Quantity(arr, self.unit, copy=False)\n\n        return arr"},{"attributeType":"NullLogger","col":8,"comment":"null","endLoc":2112,"id":12432,"name":"log","nodeType":"Attribute","startLoc":2112,"text":"self.log"},{"attributeType":"null","col":8,"comment":"null","endLoc":2121,"id":12433,"name":"_add_count","nodeType":"Attribute","startLoc":2121,"text":"self._add_count"},{"col":4,"comment":"null","endLoc":299,"header":"@property\n    def input_units(self)","id":12434,"name":"input_units","nodeType":"Function","startLoc":297,"text":"@property\n    def input_units(self):\n        return self._input_units"},{"col":4,"comment":"null","endLoc":303,"header":"@property\n    def mapping(self)","id":12435,"name":"mapping","nodeType":"Function","startLoc":301,"text":"@property\n    def mapping(self):\n        return self._mapping"},{"col":4,"comment":"null","endLoc":320,"header":"def evaluate(self, *args)","id":12436,"name":"evaluate","nodeType":"Function","startLoc":305,"text":"def evaluate(self, *args):\n        result = []\n        for arg, (_, return_unit) in zip(args, self.mapping):\n            if isinstance(arg, Quantity):\n                value = arg.value\n            else:\n                value = arg\n            if return_unit is None:\n                result.append(value)\n            else:\n                result.append(Quantity(value, return_unit, subok=True))\n\n        if self.n_outputs == 1:\n            return result[0]\n        else:\n            return tuple(result)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2116,"id":12437,"name":"lr_goto","nodeType":"Attribute","startLoc":2116,"text":"self.lr_goto"},{"attributeType":"null","col":8,"comment":"null","endLoc":2115,"id":12438,"name":"lr_action","nodeType":"Attribute","startLoc":2115,"text":"self.lr_action"},{"attributeType":"null","col":8,"comment":"null","endLoc":2119,"id":12439,"name":"lr0_cidhash","nodeType":"Attribute","startLoc":2119,"text":"self.lr0_cidhash"},{"attributeType":"null","col":8,"comment":"null","endLoc":2118,"id":12440,"name":"lr_goto_cache","nodeType":"Attribute","startLoc":2118,"text":"self.lr_goto_cache"},{"attributeType":"null","col":8,"comment":"null","endLoc":2129,"id":12441,"name":"rr_conflicts","nodeType":"Attribute","startLoc":2129,"text":"self.rr_conflicts"},{"attributeType":"null","col":8,"comment":"null","endLoc":2125,"id":12442,"name":"rr_conflict","nodeType":"Attribute","startLoc":2125,"text":"self.rr_conflict"},{"attributeType":"null","col":8,"comment":"null","endLoc":2124,"id":12443,"name":"sr_conflict","nodeType":"Attribute","startLoc":2124,"text":"self.sr_conflict"},{"attributeType":"{Productions}","col":8,"comment":"null","endLoc":2106,"id":12444,"name":"grammar","nodeType":"Attribute","startLoc":2106,"text":"self.grammar"},{"attributeType":"null","col":8,"comment":"null","endLoc":2117,"id":12445,"name":"lr_productions","nodeType":"Attribute","startLoc":2117,"text":"self.lr_productions"},{"attributeType":"null","col":8,"comment":"null","endLoc":2126,"id":12446,"name":"conflicts","nodeType":"Attribute","startLoc":2126,"text":"self.conflicts"},{"attributeType":"null","col":8,"comment":"null","endLoc":2128,"id":12447,"name":"sr_conflicts","nodeType":"Attribute","startLoc":2128,"text":"self.sr_conflicts"},{"className":"ParserReflect","col":0,"comment":"null","endLoc":3208,"id":12448,"nodeType":"Class","startLoc":2938,"text":"class ParserReflect(object):\n    def __init__(self, pdict, log=None):\n        self.pdict      = pdict\n        self.start      = None\n        self.error_func = None\n        self.tokens     = None\n        self.modules    = set()\n        self.grammar    = []\n        self.error      = False\n\n        if log is None:\n            self.log = PlyLogger(sys.stderr)\n        else:\n            self.log = log\n\n    # Get all of the basic information\n    def get_all(self):\n        self.get_start()\n        self.get_error_func()\n        self.get_tokens()\n        self.get_precedence()\n        self.get_pfunctions()\n\n    # Validate all of the information\n    def validate_all(self):\n        self.validate_start()\n        self.validate_error_func()\n        self.validate_tokens()\n        self.validate_precedence()\n        self.validate_pfunctions()\n        self.validate_modules()\n        return self.error\n\n    # Compute a signature over the grammar\n    def signature(self):\n        parts = []\n        try:\n            if self.start:\n                parts.append(self.start)\n            if self.prec:\n                parts.append(''.join([''.join(p) for p in self.prec]))\n            if self.tokens:\n                parts.append(' '.join(self.tokens))\n            for f in self.pfuncs:\n                if f[3]:\n                    parts.append(f[3])\n        except (TypeError, ValueError):\n            pass\n        return ''.join(parts)\n\n    # -----------------------------------------------------------------------------\n    # validate_modules()\n    #\n    # This method checks to see if there are duplicated p_rulename() functions\n    # in the parser module file.  Without this function, it is really easy for\n    # users to make mistakes by cutting and pasting code fragments (and it's a real\n    # bugger to try and figure out why the resulting parser doesn't work).  Therefore,\n    # we just do a little regular expression pattern matching of def statements\n    # to try and detect duplicates.\n    # -----------------------------------------------------------------------------\n\n    def validate_modules(self):\n        # Match def p_funcname(\n        fre = re.compile(r'\\s*def\\s+(p_[a-zA-Z_0-9]*)\\(')\n\n        for module in self.modules:\n            try:\n                lines, linen = inspect.getsourcelines(module)\n            except IOError:\n                continue\n\n            counthash = {}\n            for linen, line in enumerate(lines):\n                linen += 1\n                m = fre.match(line)\n                if m:\n                    name = m.group(1)\n                    prev = counthash.get(name)\n                    if not prev:\n                        counthash[name] = linen\n                    else:\n                        filename = inspect.getsourcefile(module)\n                        self.log.warning('%s:%d: Function %s redefined. Previously defined on line %d',\n                                         filename, linen, name, prev)\n\n    # Get the start symbol\n    def get_start(self):\n        self.start = self.pdict.get('start')\n\n    # Validate the start symbol\n    def validate_start(self):\n        if self.start is not None:\n            if not isinstance(self.start, string_types):\n                self.log.error(\"'start' must be a string\")\n\n    # Look for error handler\n    def get_error_func(self):\n        self.error_func = self.pdict.get('p_error')\n\n    # Validate the error function\n    def validate_error_func(self):\n        if self.error_func:\n            if isinstance(self.error_func, types.FunctionType):\n                ismethod = 0\n            elif isinstance(self.error_func, types.MethodType):\n                ismethod = 1\n            else:\n                self.log.error(\"'p_error' defined, but is not a function or method\")\n                self.error = True\n                return\n\n            eline = self.error_func.__code__.co_firstlineno\n            efile = self.error_func.__code__.co_filename\n            module = inspect.getmodule(self.error_func)\n            self.modules.add(module)\n\n            argcount = self.error_func.__code__.co_argcount - ismethod\n            if argcount != 1:\n                self.log.error('%s:%d: p_error() requires 1 argument', efile, eline)\n                self.error = True\n\n    # Get the tokens map\n    def get_tokens(self):\n        tokens = self.pdict.get('tokens')\n        if not tokens:\n            self.log.error('No token list is defined')\n            self.error = True\n            return\n\n        if not isinstance(tokens, (list, tuple)):\n            self.log.error('tokens must be a list or tuple')\n            self.error = True\n            return\n\n        if not tokens:\n            self.log.error('tokens is empty')\n            self.error = True\n            return\n\n        self.tokens = sorted(tokens)\n\n    # Validate the tokens\n    def validate_tokens(self):\n        # Validate the tokens.\n        if 'error' in self.tokens:\n            self.log.error(\"Illegal token name 'error'. Is a reserved word\")\n            self.error = True\n            return\n\n        terminals = set()\n        for n in self.tokens:\n            if n in terminals:\n                self.log.warning('Token %r multiply defined', n)\n            terminals.add(n)\n\n    # Get the precedence map (if any)\n    def get_precedence(self):\n        self.prec = self.pdict.get('precedence')\n\n    # Validate and parse the precedence map\n    def validate_precedence(self):\n        preclist = []\n        if self.prec:\n            if not isinstance(self.prec, (list, tuple)):\n                self.log.error('precedence must be a list or tuple')\n                self.error = True\n                return\n            for level, p in enumerate(self.prec):\n                if not isinstance(p, (list, tuple)):\n                    self.log.error('Bad precedence table')\n                    self.error = True\n                    return\n\n                if len(p) < 2:\n                    self.log.error('Malformed precedence entry %s. Must be (assoc, term, ..., term)', p)\n                    self.error = True\n                    return\n                assoc = p[0]\n                if not isinstance(assoc, string_types):\n                    self.log.error('precedence associativity must be a string')\n                    self.error = True\n                    return\n                for term in p[1:]:\n                    if not isinstance(term, string_types):\n                        self.log.error('precedence items must be strings')\n                        self.error = True\n                        return\n                    preclist.append((term, assoc, level+1))\n        self.preclist = preclist\n\n    # Get all p_functions from the grammar\n    def get_pfunctions(self):\n        p_functions = []\n        for name, item in self.pdict.items():\n            if not name.startswith('p_') or name == 'p_error':\n                continue\n            if isinstance(item, (types.FunctionType, types.MethodType)):\n                line = getattr(item, 'co_firstlineno', item.__code__.co_firstlineno)\n                module = inspect.getmodule(item)\n                p_functions.append((line, module, name, item.__doc__))\n\n        # Sort all of the actions by line number; make sure to stringify\n        # modules to make them sortable, since `line` may not uniquely sort all\n        # p functions\n        p_functions.sort(key=lambda p_function: (\n            p_function[0],\n            str(p_function[1]),\n            p_function[2],\n            p_function[3]))\n        self.pfuncs = p_functions\n\n    # Validate all of the p_functions\n    def validate_pfunctions(self):\n        grammar = []\n        # Check for non-empty symbols\n        if len(self.pfuncs) == 0:\n            self.log.error('no rules of the form p_rulename are defined')\n            self.error = True\n            return\n\n        for line, module, name, doc in self.pfuncs:\n            file = inspect.getsourcefile(module)\n            func = self.pdict[name]\n            if isinstance(func, types.MethodType):\n                reqargs = 2\n            else:\n                reqargs = 1\n            if func.__code__.co_argcount > reqargs:\n                self.log.error('%s:%d: Rule %r has too many arguments', file, line, func.__name__)\n                self.error = True\n            elif func.__code__.co_argcount < reqargs:\n                self.log.error('%s:%d: Rule %r requires an argument', file, line, func.__name__)\n                self.error = True\n            elif not func.__doc__:\n                self.log.warning('%s:%d: No documentation string specified in function %r (ignored)',\n                                 file, line, func.__name__)\n            else:\n                try:\n                    parsed_g = parse_grammar(doc, file, line)\n                    for g in parsed_g:\n                        grammar.append((name, g))\n                except SyntaxError as e:\n                    self.log.error(str(e))\n                    self.error = True\n\n                # Looks like a valid grammar rule\n                # Mark the file in which defined.\n                self.modules.add(module)\n\n        # Secondary validation step that looks for p_ definitions that are not functions\n        # or functions that look like they might be grammar rules.\n\n        for n, v in self.pdict.items():\n            if n.startswith('p_') and isinstance(v, (types.FunctionType, types.MethodType)):\n                continue\n            if n.startswith('t_'):\n                continue\n            if n.startswith('p_') and n != 'p_error':\n                self.log.warning('%r not defined as a function', n)\n            if ((isinstance(v, types.FunctionType) and v.__code__.co_argcount == 1) or\n                   (isinstance(v, types.MethodType) and v.__func__.__code__.co_argcount == 2)):\n                if v.__doc__:\n                    try:\n                        doc = v.__doc__.split(' ')\n                        if doc[1] == ':':\n                            self.log.warning('%s:%d: Possible grammar rule %r defined without p_ prefix',\n                                             v.__code__.co_filename, v.__code__.co_firstlineno, n)\n                    except IndexError:\n                        pass\n\n        self.grammar = grammar"},{"col":4,"comment":"null","endLoc":2959,"header":"def get_all(self)","id":12449,"name":"get_all","nodeType":"Function","startLoc":2954,"text":"def get_all(self):\n        self.get_start()\n        self.get_error_func()\n        self.get_tokens()\n        self.get_precedence()\n        self.get_pfunctions()"},{"col":4,"comment":"null","endLoc":3025,"header":"def get_start(self)","id":12450,"name":"get_start","nodeType":"Function","startLoc":3024,"text":"def get_start(self):\n        self.start = self.pdict.get('start')"},{"col":4,"comment":"null","endLoc":679,"header":"def __bool__(self)","id":12451,"name":"__bool__","nodeType":"Function","startLoc":678,"text":"def __bool__(self):\n        return bool(np.all(self.value))"},{"col":4,"comment":"null","endLoc":326,"header":"def __repr__(self)","id":12452,"name":"__repr__","nodeType":"Function","startLoc":322,"text":"def __repr__(self):\n        if self.name is None:\n            return f\"<UnitsMapping({self.mapping})>\"\n        else:\n            return f\"<UnitsMapping({self.mapping}, name={self.name!r})>\""},{"attributeType":"null","col":8,"comment":"null","endLoc":251,"id":12453,"name":"_mapping","nodeType":"Attribute","startLoc":251,"text":"self._mapping"},{"attributeType":"null","col":4,"comment":"\n    Types of constraints a parameter can have.  Excludes 'min' and 'max'\n    which are just aliases for the first and second elements of the 'bounds'\n    constraint (which is represented as a 2-tuple). 'prior' and 'posterior'\n    are available for use by user fitters but are not used by any built-in\n    fitters as of this writing.\n    ","endLoc":184,"id":12454,"name":"constraints","nodeType":"Attribute","startLoc":184,"text":"constraints"},{"col":4,"comment":"null","endLoc":3035,"header":"def get_error_func(self)","id":12455,"name":"get_error_func","nodeType":"Function","startLoc":3034,"text":"def get_error_func(self):\n        self.error_func = self.pdict.get('p_error')"},{"col":4,"comment":"null","endLoc":3077,"header":"def get_tokens(self)","id":12456,"name":"get_tokens","nodeType":"Function","startLoc":3060,"text":"def get_tokens(self):\n        tokens = self.pdict.get('tokens')\n        if not tokens:\n            self.log.error('No token list is defined')\n            self.error = True\n            return\n\n        if not isinstance(tokens, (list, tuple)):\n            self.log.error('tokens must be a list or tuple')\n            self.error = True\n            return\n\n        if not tokens:\n            self.log.error('tokens is empty')\n            self.error = True\n            return\n\n        self.tokens = sorted(tokens)"},{"attributeType":"null","col":4,"comment":"null","endLoc":681,"id":12457,"name":"__add__","nodeType":"Attribute","startLoc":681,"text":"__add__"},{"attributeType":"null","col":8,"comment":"null","endLoc":260,"id":12458,"name":"_input_units_allow_dimensionless","nodeType":"Attribute","startLoc":260,"text":"self._input_units_allow_dimensionless"},{"attributeType":"null","col":4,"comment":"null","endLoc":682,"id":12459,"name":"__radd__","nodeType":"Attribute","startLoc":682,"text":"__radd__"},{"attributeType":"null","col":4,"comment":"null","endLoc":683,"id":12460,"name":"__sub__","nodeType":"Attribute","startLoc":683,"text":"__sub__"},{"attributeType":"null","col":8,"comment":"null","endLoc":258,"id":12461,"name":"_input_units_strict","nodeType":"Attribute","startLoc":258,"text":"self._input_units_strict"},{"col":4,"comment":"null","endLoc":3095,"header":"def get_precedence(self)","id":12462,"name":"get_precedence","nodeType":"Function","startLoc":3094,"text":"def get_precedence(self):\n        self.prec = self.pdict.get('precedence')"},{"attributeType":"null","col":8,"comment":"null","endLoc":259,"id":12463,"name":"input_units_equivalencies","nodeType":"Attribute","startLoc":259,"text":"self.input_units_equivalencies"},{"col":4,"comment":"null","endLoc":3147,"header":"def get_pfunctions(self)","id":12464,"name":"get_pfunctions","nodeType":"Function","startLoc":3129,"text":"def get_pfunctions(self):\n        p_functions = []\n        for name, item in self.pdict.items():\n            if not name.startswith('p_') or name == 'p_error':\n                continue\n            if isinstance(item, (types.FunctionType, types.MethodType)):\n                line = getattr(item, 'co_firstlineno', item.__code__.co_firstlineno)\n                module = inspect.getmodule(item)\n                p_functions.append((line, module, name, item.__doc__))\n\n        # Sort all of the actions by line number; make sure to stringify\n        # modules to make them sortable, since `line` may not uniquely sort all\n        # p functions\n        p_functions.sort(key=lambda p_function: (\n            p_function[0],\n            str(p_function[1]),\n            p_function[2],\n            p_function[3]))\n        self.pfuncs = p_functions"},{"attributeType":"null","col":8,"comment":"null","endLoc":269,"id":12465,"name":"_input_units","nodeType":"Attribute","startLoc":269,"text":"self._input_units"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":12466,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"mappings.py#<anonymous>","id":12467,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nSpecial models useful for complex compound models where control is needed over\nwhich outputs from a source model are mapped to which inputs of a target model.\n\"\"\"\n\n__all__ = ['Mapping', 'Identity', 'UnitsMapping']"},{"col":29,"endLoc":3146,"id":12468,"nodeType":"Lambda","startLoc":3142,"text":"lambda p_function: (\n            p_function[0],\n            str(p_function[1]),\n            p_function[2],\n            p_function[3])"},{"fileName":"rotations.py","filePath":"astropy/modeling","id":12469,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nImplements rotations, including spherical rotations as defined in WCS Paper II\n[1]_\n\n`RotateNative2Celestial` and `RotateCelestial2Native` follow the convention in\nWCS Paper II to rotate to/from a native sphere and the celestial sphere.\n\nThe implementation uses `EulerAngleRotation`. The model parameters are\nthree angles: the longitude (``lon``) and latitude (``lat``) of the fiducial point\nin the celestial system (``CRVAL`` keywords in FITS), and the longitude of the celestial\npole in the native system (``lon_pole``). The Euler angles are ``lon+90``, ``90-lat``\nand ``-(lon_pole-90)``.\n\n\nReferences\n----------\n.. [1] Calabretta, M.R., Greisen, E.W., 2002, A&A, 395, 1077 (Paper II)\n\"\"\"\n# pylint: disable=invalid-name, too-many-arguments, no-member\n\nimport math\n\nimport numpy as np\n\nfrom astropy.coordinates.matrix_utilities import rotation_matrix, matrix_product\nfrom astropy import units as u\nfrom .core import Model\nfrom .parameters import Parameter\nfrom .utils import _to_radian, _to_orig_unit\n\n__all__ = ['RotateCelestial2Native', 'RotateNative2Celestial', 'Rotation2D',\n           'EulerAngleRotation', 'RotationSequence3D', 'SphericalRotationSequence']\n\n\ndef _create_matrix(angles, axes_order):\n    matrices = []\n    for angle, axis in zip(angles, axes_order):\n        if isinstance(angle, u.Quantity):\n            angle = angle.value\n        angle = angle.item()\n        matrices.append(rotation_matrix(angle, axis, unit=u.rad))\n    result = matrix_product(*matrices[::-1])\n    return result\n\n\ndef spherical2cartesian(alpha, delta):\n    alpha = np.deg2rad(alpha)\n    delta = np.deg2rad(delta)\n    x = np.cos(alpha) * np.cos(delta)\n    y = np.cos(delta) * np.sin(alpha)\n    z = np.sin(delta)\n    return np.array([x, y, z])\n\n\ndef cartesian2spherical(x, y, z):\n    h = np.hypot(x, y)\n    alpha = np.rad2deg(np.arctan2(y, x))\n    delta = np.rad2deg(np.arctan2(z, h))\n    return alpha, delta\n\n\nclass RotationSequence3D(Model):\n    \"\"\"\n    Perform a series of rotations about different axis in 3D space.\n\n    Positive angles represent a counter-clockwise rotation.\n\n    Parameters\n    ----------\n    angles : array-like\n        Angles of rotation in deg in the order of axes_order.\n    axes_order : str\n        A sequence of 'x', 'y', 'z' corresponding to axis of rotation.\n\n    Examples\n    --------\n    >>> model = RotationSequence3D([1.1, 2.1, 3.1, 4.1], axes_order='xyzx')\n\n    \"\"\"\n    standard_broadcasting = False\n    _separable = False\n    n_inputs = 3\n    n_outputs = 3\n\n    angles = Parameter(default=[], getter=_to_orig_unit, setter=_to_radian, description=\"Angles of rotation in deg in the order of axes_order\")\n\n    def __init__(self, angles, axes_order, name=None):\n        self.axes = ['x', 'y', 'z']\n        unrecognized = set(axes_order).difference(self.axes)\n        if unrecognized:\n            raise ValueError(\"Unrecognized axis label {0}; \"\n                             \"should be one of {1} \".format(unrecognized,\n                                                            self.axes))\n        self.axes_order = axes_order\n        if len(angles) != len(axes_order):\n            raise ValueError(\"The number of angles {0} should match the number of axes {1}.\"\n                             .format(len(angles), len(axes_order)))\n        super().__init__(angles, name=name)\n        self._inputs = ('x', 'y', 'z')\n        self._outputs = ('x', 'y', 'z')\n\n    @property\n    def inverse(self):\n        \"\"\"Inverse rotation.\"\"\"\n        angles = self.angles.value[::-1] * -1\n        return self.__class__(angles, axes_order=self.axes_order[::-1])\n\n    def evaluate(self, x, y, z, angles):\n        \"\"\"\n        Apply the rotation to a set of 3D Cartesian coordinates.\n        \"\"\"\n        if x.shape != y.shape or x.shape != z.shape:\n            raise ValueError(\"Expected input arrays to have the same shape\")\n        # Note: If the original shape was () (an array scalar) convert to a\n        # 1-element 1-D array on output for consistency with most other models\n        orig_shape = x.shape or (1,)\n        inarr = np.array([x.flatten(), y.flatten(), z.flatten()])\n        result = np.dot(_create_matrix(angles[0], self.axes_order), inarr)\n        x, y, z = result[0], result[1], result[2]\n        x.shape = y.shape = z.shape = orig_shape\n        return x, y, z\n\n\nclass SphericalRotationSequence(RotationSequence3D):\n    \"\"\"\n    Perform a sequence of rotations about arbitrary number of axes\n    in spherical coordinates.\n\n    Parameters\n    ----------\n    angles : list\n        A sequence of angles (in deg).\n    axes_order : str\n        A sequence of characters ('x', 'y', or 'z') corresponding to the\n        axis of rotation and matching the order in ``angles``.\n\n    \"\"\"\n    def __init__(self, angles, axes_order, name=None, **kwargs):\n        self._n_inputs = 2\n        self._n_outputs = 2\n        super().__init__(angles, axes_order=axes_order, name=name, **kwargs)\n        self._inputs = (\"lon\", \"lat\")\n        self._outputs = (\"lon\", \"lat\")\n\n    @property\n    def n_inputs(self):\n        return self._n_inputs\n\n    @property\n    def n_outputs(self):\n        return self._n_outputs\n\n    def evaluate(self, lon, lat, angles):\n        x, y, z = spherical2cartesian(lon, lat)\n        x1, y1, z1 = super().evaluate(x, y, z, angles)\n        lon, lat = cartesian2spherical(x1, y1, z1)\n        return lon, lat\n\n\nclass _EulerRotation:\n    \"\"\"\n    Base class which does the actual computation.\n    \"\"\"\n\n    _separable = False\n\n    def evaluate(self, alpha, delta, phi, theta, psi, axes_order):\n        shape = None\n        if isinstance(alpha, np.ndarray):\n            alpha = alpha.flatten()\n            delta = delta.flatten()\n            shape = alpha.shape\n        inp = spherical2cartesian(alpha, delta)\n        matrix = _create_matrix([phi, theta, psi], axes_order)\n        result = np.dot(matrix, inp)\n        a, b = cartesian2spherical(*result)\n        if shape is not None:\n            a.shape = shape\n            b.shape = shape\n        return a, b\n\n    _input_units_strict = True\n\n    _input_units_allow_dimensionless = True\n\n    @property\n    def input_units(self):\n        \"\"\" Input units. \"\"\"\n        return {self.inputs[0]: u.deg,\n                self.inputs[1]: u.deg}\n\n    @property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {self.outputs[0]: u.deg,\n                self.outputs[1]: u.deg}\n\n\nclass EulerAngleRotation(_EulerRotation, Model):\n    \"\"\"\n    Implements Euler angle intrinsic rotations.\n\n    Rotates one coordinate system into another (fixed) coordinate system.\n    All coordinate systems are right-handed. The sign of the angles is\n    determined by the right-hand rule..\n\n    Parameters\n    ----------\n    phi, theta, psi : float or `~astropy.units.Quantity` ['angle']\n        \"proper\" Euler angles in deg.\n        If floats, they should be in deg.\n    axes_order : str\n        A 3 character string, a combination of 'x', 'y' and 'z',\n        where each character denotes an axis in 3D space.\n    \"\"\"\n\n    n_inputs = 2\n    n_outputs = 2\n\n    phi = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian,\n    description=\"1st Euler angle (Quantity or value in deg)\")\n    theta = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian,\n    description=\"2nd Euler angle (Quantity or value in deg)\")\n    psi = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian,\n    description=\"3rd Euler angle (Quantity or value in deg)\")\n\n    def __init__(self, phi, theta, psi, axes_order, **kwargs):\n        self.axes = ['x', 'y', 'z']\n        if len(axes_order) != 3:\n            raise TypeError(\n                \"Expected axes_order to be a character sequence of length 3, \"\n                \"got {}\".format(axes_order))\n        unrecognized = set(axes_order).difference(self.axes)\n        if unrecognized:\n            raise ValueError(\"Unrecognized axis label {}; \"\n                             \"should be one of {} \".format(unrecognized, self.axes))\n        self.axes_order = axes_order\n        qs = [isinstance(par, u.Quantity) for par in [phi, theta, psi]]\n        if any(qs) and not all(qs):\n            raise TypeError(\"All parameters should be of the same type - float or Quantity.\")\n\n        super().__init__(phi=phi, theta=theta, psi=psi, **kwargs)\n        self._inputs = ('alpha', 'delta')\n        self._outputs = ('alpha', 'delta')\n\n    @property\n    def inverse(self):\n        return self.__class__(phi=-self.psi,\n                              theta=-self.theta,\n                              psi=-self.phi,\n                              axes_order=self.axes_order[::-1])\n\n    def evaluate(self, alpha, delta, phi, theta, psi):\n        a, b = super().evaluate(alpha, delta, phi, theta, psi, self.axes_order)\n        return a, b\n\n\nclass _SkyRotation(_EulerRotation, Model):\n    \"\"\"\n    Base class for RotateNative2Celestial and RotateCelestial2Native.\n    \"\"\"\n\n    lon = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian, description=\"Latitude\")\n    lat = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian, description=\"Longtitude\")\n    lon_pole = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian, description=\"Longitude of a pole\")\n\n    def __init__(self, lon, lat, lon_pole, **kwargs):\n        qs = [isinstance(par, u.Quantity) for par in [lon, lat, lon_pole]]\n        if any(qs) and not all(qs):\n            raise TypeError(\"All parameters should be of the same type - float or Quantity.\")\n        super().__init__(lon, lat, lon_pole, **kwargs)\n        self.axes_order = 'zxz'\n\n    def _evaluate(self, phi, theta, lon, lat, lon_pole):\n        alpha, delta = super().evaluate(phi, theta, lon, lat, lon_pole,\n                                        self.axes_order)\n        mask = alpha < 0\n        if isinstance(mask, np.ndarray):\n            alpha[mask] += 360\n        else:\n            alpha += 360\n        return alpha, delta\n\n\nclass RotateNative2Celestial(_SkyRotation):\n    \"\"\"\n    Transform from Native to Celestial Spherical Coordinates.\n\n    Parameters\n    ----------\n    lon : float or `~astropy.units.Quantity` ['angle']\n        Celestial longitude of the fiducial point.\n    lat : float or `~astropy.units.Quantity` ['angle']\n        Celestial latitude of the fiducial point.\n    lon_pole : float or `~astropy.units.Quantity` ['angle']\n        Longitude of the celestial pole in the native system.\n\n    Notes\n    -----\n    If ``lon``, ``lat`` and ``lon_pole`` are numerical values they\n    should be in units of deg. Inputs are angles on the native sphere.\n    Outputs are angles on the celestial sphere.\n    \"\"\"\n\n    n_inputs = 2\n    n_outputs = 2\n\n    @property\n    def input_units(self):\n        \"\"\" Input units. \"\"\"\n        return {self.inputs[0]: u.deg,\n                self.inputs[1]: u.deg}\n\n    @property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {self.outputs[0]: u.deg, self.outputs[1]: u.deg}\n\n    def __init__(self, lon, lat, lon_pole, **kwargs):\n        super().__init__(lon, lat, lon_pole, **kwargs)\n        self.inputs = ('phi_N', 'theta_N')\n        self.outputs = ('alpha_C', 'delta_C')\n\n    def evaluate(self, phi_N, theta_N, lon, lat, lon_pole):\n        \"\"\"\n        Parameters\n        ----------\n        phi_N, theta_N : float or `~astropy.units.Quantity` ['angle']\n            Angles in the Native coordinate system.\n            it is assumed that numerical only inputs are in degrees.\n            If float, assumed in degrees.\n        lon, lat, lon_pole : float or `~astropy.units.Quantity` ['angle']\n            Parameter values when the model was initialized.\n            If float, assumed in degrees.\n\n        Returns\n        -------\n        alpha_C, delta_C : float or `~astropy.units.Quantity` ['angle']\n            Angles on the Celestial sphere.\n            If float, in degrees.\n        \"\"\"\n        # The values are in radians since they have already been through the setter.\n        if isinstance(lon, u.Quantity):\n            lon = lon.value\n            lat = lat.value\n            lon_pole = lon_pole.value\n        # Convert to Euler angles\n        phi = lon_pole - np.pi / 2\n        theta = - (np.pi / 2 - lat)\n        psi = -(np.pi / 2 + lon)\n        alpha_C, delta_C = super()._evaluate(phi_N, theta_N, phi, theta, psi)\n        return alpha_C, delta_C\n\n    @property\n    def inverse(self):\n        # convert to angles on the celestial sphere\n        return RotateCelestial2Native(self.lon, self.lat, self.lon_pole)\n\n\nclass RotateCelestial2Native(_SkyRotation):\n    \"\"\"\n    Transform from Celestial to Native Spherical Coordinates.\n\n    Parameters\n    ----------\n    lon : float or `~astropy.units.Quantity` ['angle']\n        Celestial longitude of the fiducial point.\n    lat : float or `~astropy.units.Quantity` ['angle']\n        Celestial latitude of the fiducial point.\n    lon_pole : float or `~astropy.units.Quantity` ['angle']\n        Longitude of the celestial pole in the native system.\n\n    Notes\n    -----\n    If ``lon``, ``lat`` and ``lon_pole`` are numerical values they should be\n    in units of deg. Inputs are angles on the celestial sphere.\n    Outputs are angles on the native sphere.\n    \"\"\"\n    n_inputs = 2\n    n_outputs = 2\n\n    @property\n    def input_units(self):\n        \"\"\" Input units. \"\"\"\n        return {self.inputs[0]: u.deg,\n                self.inputs[1]: u.deg}\n\n    @property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {self.outputs[0]: u.deg,\n                self.outputs[1]: u.deg}\n\n    def __init__(self, lon, lat, lon_pole, **kwargs):\n        super().__init__(lon, lat, lon_pole, **kwargs)\n\n        # Inputs are angles on the celestial sphere\n        self.inputs = ('alpha_C', 'delta_C')\n        # Outputs are angles on the native sphere\n        self.outputs = ('phi_N', 'theta_N')\n\n    def evaluate(self, alpha_C, delta_C, lon, lat, lon_pole):\n        \"\"\"\n        Parameters\n        ----------\n        alpha_C, delta_C : float or `~astropy.units.Quantity` ['angle']\n            Angles in the Celestial coordinate frame.\n            If float, assumed in degrees.\n        lon, lat, lon_pole : float or `~astropy.units.Quantity` ['angle']\n            Parameter values when the model was initialized.\n            If float, assumed in degrees.\n\n        Returns\n        -------\n        phi_N, theta_N : float or `~astropy.units.Quantity` ['angle']\n            Angles on the Native sphere.\n            If float, in degrees.\n\n        \"\"\"\n        if isinstance(lon, u.Quantity):\n            lon = lon.value\n            lat = lat.value\n            lon_pole = lon_pole.value\n        # Convert to Euler angles\n        phi = (np.pi / 2 + lon)\n        theta = (np.pi / 2 - lat)\n        psi = -(lon_pole - np.pi / 2)\n        phi_N, theta_N = super()._evaluate(alpha_C, delta_C, phi, theta, psi)\n\n        return phi_N, theta_N\n\n    @property\n    def inverse(self):\n        return RotateNative2Celestial(self.lon, self.lat, self.lon_pole)\n\n\nclass Rotation2D(Model):\n    \"\"\"\n    Perform a 2D rotation given an angle.\n\n    Positive angles represent a counter-clockwise rotation and vice-versa.\n\n    Parameters\n    ----------\n    angle : float or `~astropy.units.Quantity` ['angle']\n        Angle of rotation (if float it should be in deg).\n    \"\"\"\n    n_inputs = 2\n    n_outputs = 2\n\n    _separable = False\n\n    angle = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian,\n    description=\"Angle of rotation (Quantity or value in deg)\")\n\n    def __init__(self, angle=angle, **kwargs):\n        super().__init__(angle=angle, **kwargs)\n        self._inputs = (\"x\", \"y\")\n        self._outputs = (\"x\", \"y\")\n\n    @property\n    def inverse(self):\n        \"\"\"Inverse rotation.\"\"\"\n\n        return self.__class__(angle=-self.angle)\n\n    @classmethod\n    def evaluate(cls, x, y, angle):\n        \"\"\"\n        Rotate (x, y) about ``angle``.\n\n        Parameters\n        ----------\n        x, y : array-like\n            Input quantities\n        angle : float or `~astropy.units.Quantity` ['angle']\n            Angle of rotations.\n            If float, assumed in degrees.\n\n        \"\"\"\n\n        if x.shape != y.shape:\n            raise ValueError(\"Expected input arrays to have the same shape\")\n\n        # If one argument has units, enforce they both have units and they are compatible.\n        x_unit = getattr(x, 'unit', None)\n        y_unit = getattr(y, 'unit', None)\n        has_units = x_unit is not None and y_unit is not None\n        if x_unit != y_unit:\n            if has_units and y_unit.is_equivalent(x_unit):\n                y = y.to(x_unit)\n                y_unit = x_unit\n            else:\n                raise u.UnitsError(\"x and y must have compatible units\")\n\n        # Note: If the original shape was () (an array scalar) convert to a\n        # 1-element 1-D array on output for consistency with most other models\n        orig_shape = x.shape or (1,)\n        inarr = np.array([x.flatten(), y.flatten()])\n        if isinstance(angle, u.Quantity):\n            angle = angle.to_value(u.rad)\n        result = np.dot(cls._compute_matrix(angle), inarr)\n        x, y = result[0], result[1]\n        x.shape = y.shape = orig_shape\n        if has_units:\n            return u.Quantity(x, unit=x_unit), u.Quantity(y, unit=y_unit)\n        return x, y\n\n    @staticmethod\n    def _compute_matrix(angle):\n        return np.array([[math.cos(angle), -math.sin(angle)],\n                         [math.sin(angle), math.cos(angle)]],\n                        dtype=np.float64)\n"},{"col":4,"comment":"null","endLoc":2969,"header":"def validate_all(self)","id":12470,"name":"validate_all","nodeType":"Function","startLoc":2962,"text":"def validate_all(self):\n        self.validate_start()\n        self.validate_error_func()\n        self.validate_tokens()\n        self.validate_precedence()\n        self.validate_pfunctions()\n        self.validate_modules()\n        return self.error"},{"col":4,"comment":"null","endLoc":3031,"header":"def validate_start(self)","id":12471,"name":"validate_start","nodeType":"Function","startLoc":3028,"text":"def validate_start(self):\n        if self.start is not None:\n            if not isinstance(self.start, string_types):\n                self.log.error(\"'start' must be a string\")"},{"col":4,"comment":"null","endLoc":3057,"header":"def validate_error_func(self)","id":12472,"name":"validate_error_func","nodeType":"Function","startLoc":3038,"text":"def validate_error_func(self):\n        if self.error_func:\n            if isinstance(self.error_func, types.FunctionType):\n                ismethod = 0\n            elif isinstance(self.error_func, types.MethodType):\n                ismethod = 1\n            else:\n                self.log.error(\"'p_error' defined, but is not a function or method\")\n                self.error = True\n                return\n\n            eline = self.error_func.__code__.co_firstlineno\n            efile = self.error_func.__code__.co_filename\n            module = inspect.getmodule(self.error_func)\n            self.modules.add(module)\n\n            argcount = self.error_func.__code__.co_argcount - ismethod\n            if argcount != 1:\n                self.log.error('%s:%d: p_error() requires 1 argument', efile, eline)\n                self.error = True"},{"col":0,"comment":"Matrix multiply all arguments together.\n\n    Arguments should have dimension 2 or larger. Larger dimensional objects\n    are interpreted as stacks of matrices residing in the last two dimensions.\n\n    This function mostly exists for readability: using `~numpy.matmul`\n    directly, one would have ``matmul(matmul(m1, m2), m3)``, etc. For even\n    better readability, one might consider using `~numpy.matrix` for the\n    arguments (so that one could write ``m1 * m2 * m3``), but then it is not\n    possible to handle stacks of matrices. Once only python >=3.5 is supported,\n    this function can be replaced by ``m1 @ m2 @ m3``.\n    ","endLoc":27,"header":"def matrix_product(*matrices)","id":12473,"name":"matrix_product","nodeType":"Function","startLoc":14,"text":"def matrix_product(*matrices):\n    \"\"\"Matrix multiply all arguments together.\n\n    Arguments should have dimension 2 or larger. Larger dimensional objects\n    are interpreted as stacks of matrices residing in the last two dimensions.\n\n    This function mostly exists for readability: using `~numpy.matmul`\n    directly, one would have ``matmul(matmul(m1, m2), m3)``, etc. For even\n    better readability, one might consider using `~numpy.matrix` for the\n    arguments (so that one could write ``m1 * m2 * m3``), but then it is not\n    possible to handle stacks of matrices. Once only python >=3.5 is supported,\n    this function can be replaced by ``m1 @ m2 @ m3``.\n    \"\"\"\n    return reduce(np.matmul, matrices)"},{"className":"RotationSequence3D","col":0,"comment":"\n    Perform a series of rotations about different axis in 3D space.\n\n    Positive angles represent a counter-clockwise rotation.\n\n    Parameters\n    ----------\n    angles : array-like\n        Angles of rotation in deg in the order of axes_order.\n    axes_order : str\n        A sequence of 'x', 'y', 'z' corresponding to axis of rotation.\n\n    Examples\n    --------\n    >>> model = RotationSequence3D([1.1, 2.1, 3.1, 4.1], axes_order='xyzx')\n\n    ","endLoc":123,"id":12474,"nodeType":"Class","startLoc":64,"text":"class RotationSequence3D(Model):\n    \"\"\"\n    Perform a series of rotations about different axis in 3D space.\n\n    Positive angles represent a counter-clockwise rotation.\n\n    Parameters\n    ----------\n    angles : array-like\n        Angles of rotation in deg in the order of axes_order.\n    axes_order : str\n        A sequence of 'x', 'y', 'z' corresponding to axis of rotation.\n\n    Examples\n    --------\n    >>> model = RotationSequence3D([1.1, 2.1, 3.1, 4.1], axes_order='xyzx')\n\n    \"\"\"\n    standard_broadcasting = False\n    _separable = False\n    n_inputs = 3\n    n_outputs = 3\n\n    angles = Parameter(default=[], getter=_to_orig_unit, setter=_to_radian, description=\"Angles of rotation in deg in the order of axes_order\")\n\n    def __init__(self, angles, axes_order, name=None):\n        self.axes = ['x', 'y', 'z']\n        unrecognized = set(axes_order).difference(self.axes)\n        if unrecognized:\n            raise ValueError(\"Unrecognized axis label {0}; \"\n                             \"should be one of {1} \".format(unrecognized,\n                                                            self.axes))\n        self.axes_order = axes_order\n        if len(angles) != len(axes_order):\n            raise ValueError(\"The number of angles {0} should match the number of axes {1}.\"\n                             .format(len(angles), len(axes_order)))\n        super().__init__(angles, name=name)\n        self._inputs = ('x', 'y', 'z')\n        self._outputs = ('x', 'y', 'z')\n\n    @property\n    def inverse(self):\n        \"\"\"Inverse rotation.\"\"\"\n        angles = self.angles.value[::-1] * -1\n        return self.__class__(angles, axes_order=self.axes_order[::-1])\n\n    def evaluate(self, x, y, z, angles):\n        \"\"\"\n        Apply the rotation to a set of 3D Cartesian coordinates.\n        \"\"\"\n        if x.shape != y.shape or x.shape != z.shape:\n            raise ValueError(\"Expected input arrays to have the same shape\")\n        # Note: If the original shape was () (an array scalar) convert to a\n        # 1-element 1-D array on output for consistency with most other models\n        orig_shape = x.shape or (1,)\n        inarr = np.array([x.flatten(), y.flatten(), z.flatten()])\n        result = np.dot(_create_matrix(angles[0], self.axes_order), inarr)\n        x, y, z = result[0], result[1], result[2]\n        x.shape = y.shape = z.shape = orig_shape\n        return x, y, z"},{"col":4,"comment":"null","endLoc":102,"header":"def __init__(self, angles, axes_order, name=None)","id":12476,"name":"__init__","nodeType":"Function","startLoc":89,"text":"def __init__(self, angles, axes_order, name=None):\n        self.axes = ['x', 'y', 'z']\n        unrecognized = set(axes_order).difference(self.axes)\n        if unrecognized:\n            raise ValueError(\"Unrecognized axis label {0}; \"\n                             \"should be one of {1} \".format(unrecognized,\n                                                            self.axes))\n        self.axes_order = axes_order\n        if len(angles) != len(axes_order):\n            raise ValueError(\"The number of angles {0} should match the number of axes {1}.\"\n                             .format(len(angles), len(axes_order)))\n        super().__init__(angles, name=name)\n        self._inputs = ('x', 'y', 'z')\n        self._outputs = ('x', 'y', 'z')"},{"col":4,"comment":"null","endLoc":3091,"header":"def validate_tokens(self)","id":12477,"name":"validate_tokens","nodeType":"Function","startLoc":3080,"text":"def validate_tokens(self):\n        # Validate the tokens.\n        if 'error' in self.tokens:\n            self.log.error(\"Illegal token name 'error'. Is a reserved word\")\n            self.error = True\n            return\n\n        terminals = set()\n        for n in self.tokens:\n            if n in terminals:\n                self.log.warning('Token %r multiply defined', n)\n            terminals.add(n)"},{"col":4,"comment":"Clear ConfigObj instance and restore to 'freshly created' state.","endLoc":2339,"header":"def reset(self)","id":12478,"name":"reset","nodeType":"Function","startLoc":2331,"text":"def reset(self):\n        \"\"\"Clear ConfigObj instance and restore to 'freshly created' state.\"\"\"\n        self.clear()\n        self._initialise()\n        # FIXME: Should be done by '_initialise', but ConfigObj constructor (and reload)\n        #        requires an empty dictionary\n        self.configspec = None\n        # Just to be sure ;-)\n        self._original_configspec = None"},{"col":4,"comment":"null","endLoc":3126,"header":"def validate_precedence(self)","id":12479,"name":"validate_precedence","nodeType":"Function","startLoc":3098,"text":"def validate_precedence(self):\n        preclist = []\n        if self.prec:\n            if not isinstance(self.prec, (list, tuple)):\n                self.log.error('precedence must be a list or tuple')\n                self.error = True\n                return\n            for level, p in enumerate(self.prec):\n                if not isinstance(p, (list, tuple)):\n                    self.log.error('Bad precedence table')\n                    self.error = True\n                    return\n\n                if len(p) < 2:\n                    self.log.error('Malformed precedence entry %s. Must be (assoc, term, ..., term)', p)\n                    self.error = True\n                    return\n                assoc = p[0]\n                if not isinstance(assoc, string_types):\n                    self.log.error('precedence associativity must be a string')\n                    self.error = True\n                    return\n                for term in p[1:]:\n                    if not isinstance(term, string_types):\n                        self.log.error('precedence items must be strings')\n                        self.error = True\n                        return\n                    preclist.append((term, assoc, level+1))\n        self.preclist = preclist"},{"col":4,"comment":"\n        Reload a ConfigObj from file.\n\n        This method raises a ``ReloadError`` if the ConfigObj doesn't have\n        a filename attribute pointing to a file.\n        ","endLoc":2364,"header":"def reload(self)","id":12480,"name":"reload","nodeType":"Function","startLoc":2342,"text":"def reload(self):\n        \"\"\"\n        Reload a ConfigObj from file.\n\n        This method raises a ``ReloadError`` if the ConfigObj doesn't have\n        a filename attribute pointing to a file.\n        \"\"\"\n        if not isinstance(self.filename, str):\n            raise ReloadError()\n\n        filename = self.filename\n        current_options = {}\n        for entry in OPTION_DEFAULTS:\n            if entry == 'configspec':\n                continue\n            current_options[entry] = getattr(self, entry)\n\n        configspec = self._original_configspec\n        current_options['configspec'] = configspec\n\n        self.clear()\n        self._initialise(current_options)\n        self._load(filename, configspec)"},{"attributeType":"null","col":4,"comment":"null","endLoc":684,"id":12481,"name":"__rsub__","nodeType":"Attribute","startLoc":684,"text":"__rsub__"},{"attributeType":"null","col":4,"comment":"null","endLoc":685,"id":12482,"name":"__mul__","nodeType":"Attribute","startLoc":685,"text":"__mul__"},{"col":4,"comment":"Inverse rotation.","endLoc":108,"header":"@property\n    def inverse(self)","id":12483,"name":"inverse","nodeType":"Function","startLoc":104,"text":"@property\n    def inverse(self):\n        \"\"\"Inverse rotation.\"\"\"\n        angles = self.angles.value[::-1] * -1\n        return self.__class__(angles, axes_order=self.axes_order[::-1])"},{"attributeType":"null","col":4,"comment":"null","endLoc":686,"id":12484,"name":"__rmul__","nodeType":"Attribute","startLoc":686,"text":"__rmul__"},{"attributeType":"null","col":4,"comment":"null","endLoc":687,"id":12485,"name":"__pow__","nodeType":"Attribute","startLoc":687,"text":"__pow__"},{"col":4,"comment":"null","endLoc":3208,"header":"def validate_pfunctions(self)","id":12486,"name":"validate_pfunctions","nodeType":"Function","startLoc":3150,"text":"def validate_pfunctions(self):\n        grammar = []\n        # Check for non-empty symbols\n        if len(self.pfuncs) == 0:\n            self.log.error('no rules of the form p_rulename are defined')\n            self.error = True\n            return\n\n        for line, module, name, doc in self.pfuncs:\n            file = inspect.getsourcefile(module)\n            func = self.pdict[name]\n            if isinstance(func, types.MethodType):\n                reqargs = 2\n            else:\n                reqargs = 1\n            if func.__code__.co_argcount > reqargs:\n                self.log.error('%s:%d: Rule %r has too many arguments', file, line, func.__name__)\n                self.error = True\n            elif func.__code__.co_argcount < reqargs:\n                self.log.error('%s:%d: Rule %r requires an argument', file, line, func.__name__)\n                self.error = True\n            elif not func.__doc__:\n                self.log.warning('%s:%d: No documentation string specified in function %r (ignored)',\n                                 file, line, func.__name__)\n            else:\n                try:\n                    parsed_g = parse_grammar(doc, file, line)\n                    for g in parsed_g:\n                        grammar.append((name, g))\n                except SyntaxError as e:\n                    self.log.error(str(e))\n                    self.error = True\n\n                # Looks like a valid grammar rule\n                # Mark the file in which defined.\n                self.modules.add(module)\n\n        # Secondary validation step that looks for p_ definitions that are not functions\n        # or functions that look like they might be grammar rules.\n\n        for n, v in self.pdict.items():\n            if n.startswith('p_') and isinstance(v, (types.FunctionType, types.MethodType)):\n                continue\n            if n.startswith('t_'):\n                continue\n            if n.startswith('p_') and n != 'p_error':\n                self.log.warning('%r not defined as a function', n)\n            if ((isinstance(v, types.FunctionType) and v.__code__.co_argcount == 1) or\n                   (isinstance(v, types.MethodType) and v.__func__.__code__.co_argcount == 2)):\n                if v.__doc__:\n                    try:\n                        doc = v.__doc__.split(' ')\n                        if doc[1] == ':':\n                            self.log.warning('%s:%d: Possible grammar rule %r defined without p_ prefix',\n                                             v.__code__.co_filename, v.__code__.co_firstlineno, n)\n                    except IndexError:\n                        pass\n\n        self.grammar = grammar"},{"attributeType":"null","col":4,"comment":"null","endLoc":688,"id":12487,"name":"__rpow__","nodeType":"Attribute","startLoc":688,"text":"__rpow__"},{"col":4,"comment":"null","endLoc":141,"header":"def __init__(cls, name, bases, members, **kwds)","id":12488,"name":"__init__","nodeType":"Function","startLoc":131,"text":"def __init__(cls, name, bases, members, **kwds):\n        super(_ModelMeta, cls).__init__(name, bases, members, **kwds)\n        cls._create_inverse_property(members)\n        cls._create_bounding_box_property(members)\n        pdict = {}\n        for base in bases:\n            for tbase in base.__mro__:\n                if issubclass(tbase, Model):\n                    for parname, val in cls._parameters_.items():\n                        pdict[parname] = val\n        cls._handle_special_methods(members, pdict)"},{"col":4,"comment":"null","endLoc":175,"header":"@property\n    def input_units(self)","id":12489,"name":"input_units","nodeType":"Function","startLoc":170,"text":"@property\n    def input_units(self):\n        # The input units are those of the 'x' value, which should always be\n        # Hz. Because we do this, and because input_units_allow_dimensionless\n        # is set to True, dimensionless values are assumed to be in Hz.\n        return {self.inputs[0]: u.Hz}"},{"col":4,"comment":"null","endLoc":178,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":12490,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":177,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {\"temperature\": u.K}"},{"col":4,"comment":"Bolometric flux.","endLoc":188,"header":"@property\n    def bolometric_flux(self)","id":12491,"name":"bolometric_flux","nodeType":"Function","startLoc":180,"text":"@property\n    def bolometric_flux(self):\n        \"\"\"Bolometric flux.\"\"\"\n        # bolometric flux in the native units of the planck function\n        native_bolflux = (\n            self.scale.value * const.sigma_sb * self.temperature ** 4 / np.pi\n        )\n        # return in more \"astro\" units\n        return native_bolflux.to(u.erg / (u.cm ** 2 * u.s))"},{"attributeType":"null","col":4,"comment":"null","endLoc":689,"id":12492,"name":"__truediv__","nodeType":"Attribute","startLoc":689,"text":"__truediv__"},{"attributeType":"null","col":4,"comment":"null","endLoc":690,"id":12493,"name":"__rtruediv__","nodeType":"Attribute","startLoc":690,"text":"__rtruediv__"},{"attributeType":"null","col":4,"comment":"null","endLoc":692,"id":12494,"name":"__eq__","nodeType":"Attribute","startLoc":692,"text":"__eq__"},{"attributeType":"null","col":4,"comment":"null","endLoc":693,"id":12495,"name":"__ne__","nodeType":"Attribute","startLoc":693,"text":"__ne__"},{"attributeType":"null","col":4,"comment":"null","endLoc":694,"id":12496,"name":"__lt__","nodeType":"Attribute","startLoc":694,"text":"__lt__"},{"attributeType":"null","col":4,"comment":"null","endLoc":695,"id":12497,"name":"__gt__","nodeType":"Attribute","startLoc":695,"text":"__gt__"},{"attributeType":"null","col":4,"comment":"null","endLoc":696,"id":12498,"name":"__le__","nodeType":"Attribute","startLoc":696,"text":"__le__"},{"attributeType":"null","col":4,"comment":"null","endLoc":697,"id":12499,"name":"__ge__","nodeType":"Attribute","startLoc":697,"text":"__ge__"},{"col":4,"comment":"null","endLoc":266,"header":"def _create_inverse_property(cls, members)","id":12500,"name":"_create_inverse_property","nodeType":"Function","startLoc":249,"text":"def _create_inverse_property(cls, members):\n        inverse = members.get('inverse')\n        if inverse is None or cls.__bases__[0] is object:\n            # The latter clause is the prevent the below code from running on\n            # the Model base class, which implements the default getter and\n            # setter for .inverse\n            return\n\n        if isinstance(inverse, property):\n            # We allow the @property decorator to be omitted entirely from\n            # the class definition, though its use should be encouraged for\n            # clarity\n            inverse = inverse.fget\n\n        # Store the inverse getter internally, then delete the given .inverse\n        # attribute so that cls.inverse resolves to Model.inverse instead\n        cls._inverse = inverse\n        del cls.inverse"},{"attributeType":"null","col":4,"comment":"null","endLoc":698,"id":12501,"name":"__neg__","nodeType":"Attribute","startLoc":698,"text":"__neg__"},{"attributeType":"null","col":4,"comment":"null","endLoc":699,"id":12502,"name":"__abs__","nodeType":"Attribute","startLoc":699,"text":"__abs__"},{"attributeType":"null","col":8,"comment":"null","endLoc":214,"id":12503,"name":"_default","nodeType":"Attribute","startLoc":214,"text":"self._default"},{"attributeType":"null","col":8,"comment":"null","endLoc":239,"id":12504,"name":"_tied","nodeType":"Attribute","startLoc":239,"text":"self._tied"},{"attributeType":"null","col":8,"comment":"null","endLoc":241,"id":12505,"name":"_order","nodeType":"Attribute","startLoc":241,"text":"self._order"},{"attributeType":"null","col":8,"comment":"null","endLoc":202,"id":12506,"name":"_name","nodeType":"Attribute","startLoc":202,"text":"self._name"},{"col":4,"comment":"\n        Takes any bounding_box defined on a concrete Model subclass (either\n        as a fixed tuple or a property or method) and wraps it in the generic\n        getter/setter interface for the bounding_box attribute.\n        ","endLoc":306,"header":"def _create_bounding_box_property(cls, members)","id":12507,"name":"_create_bounding_box_property","nodeType":"Function","startLoc":268,"text":"def _create_bounding_box_property(cls, members):\n        \"\"\"\n        Takes any bounding_box defined on a concrete Model subclass (either\n        as a fixed tuple or a property or method) and wraps it in the generic\n        getter/setter interface for the bounding_box attribute.\n        \"\"\"\n\n        # TODO: Much of this is verbatim from _create_inverse_property--I feel\n        # like there could be a way to generify properties that work this way,\n        # but for the time being that would probably only confuse things more.\n        bounding_box = members.get('bounding_box')\n        if bounding_box is None or cls.__bases__[0] is object:\n            return\n\n        if isinstance(bounding_box, property):\n            bounding_box = bounding_box.fget\n\n        if not callable(bounding_box):\n            # See if it's a hard-coded bounding_box (as a sequence) and\n            # normalize it\n            try:\n                bounding_box = ModelBoundingBox.validate(cls, bounding_box, _preserve_ignore=True)\n            except ValueError as exc:\n                raise ModelDefinitionError(exc.args[0])\n        else:\n            sig = signature(bounding_box)\n            # May be a method that only takes 'self' as an argument (like a\n            # property, but the @property decorator was forgotten)\n            #\n            # However, if the method takes additional arguments then this is a\n            # parameterized bounding box and should be callable\n            if len(sig.parameters) > 1:\n                bounding_box = \\\n                        cls._create_bounding_box_subclass(bounding_box, sig)\n\n        # See the Model.bounding_box getter definition for how this attribute\n        # is used\n        cls._bounding_box = bounding_box\n        del cls.bounding_box"},{"attributeType":"null","col":8,"comment":"null","endLoc":199,"id":12508,"name":"_model_required","nodeType":"Attribute","startLoc":199,"text":"self._model_required"},{"attributeType":"null","col":8,"comment":"null","endLoc":220,"id":12509,"name":"_internal_unit","nodeType":"Attribute","startLoc":220,"text":"self._internal_unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":243,"id":12510,"name":"_validator","nodeType":"Attribute","startLoc":243,"text":"self._validator"},{"attributeType":"null","col":8,"comment":"null","endLoc":247,"id":12511,"name":"_std","nodeType":"Attribute","startLoc":247,"text":"self._std"},{"attributeType":"null","col":8,"comment":"null","endLoc":240,"id":12512,"name":"_bounds","nodeType":"Attribute","startLoc":240,"text":"self._bounds"},{"attributeType":"null","col":4,"comment":"null","endLoc":1072,"id":12513,"name":"_keyword","nodeType":"Attribute","startLoc":1072,"text":"_keyword"},{"attributeType":"null","col":12,"comment":"null","endLoc":343,"id":12514,"name":"_internal_value","nodeType":"Attribute","startLoc":343,"text":"self._internal_value"},{"attributeType":"null","col":8,"comment":"null","endLoc":200,"id":12515,"name":"_setter","nodeType":"Attribute","startLoc":200,"text":"self._setter"},{"attributeType":"null","col":8,"comment":"null","endLoc":201,"id":12516,"name":"_getter","nodeType":"Attribute","startLoc":201,"text":"self._getter"},{"attributeType":"null","col":8,"comment":"null","endLoc":215,"id":12517,"name":"_unit","nodeType":"Attribute","startLoc":215,"text":"self._unit"},{"col":4,"comment":"\n        For Models that take optional arguments for defining their bounding\n        box, we create a subclass of ModelBoundingBox with a ``__call__`` method\n        that supports those additional arguments.\n\n        Takes the function's Signature as an argument since that is already\n        computed in _create_bounding_box_property, so no need to duplicate that\n        effort.\n        ","endLoc":353,"header":"def _create_bounding_box_subclass(cls, func, sig)","id":12518,"name":"_create_bounding_box_subclass","nodeType":"Function","startLoc":308,"text":"def _create_bounding_box_subclass(cls, func, sig):\n        \"\"\"\n        For Models that take optional arguments for defining their bounding\n        box, we create a subclass of ModelBoundingBox with a ``__call__`` method\n        that supports those additional arguments.\n\n        Takes the function's Signature as an argument since that is already\n        computed in _create_bounding_box_property, so no need to duplicate that\n        effort.\n        \"\"\"\n\n        # TODO: Might be convenient if calling the bounding box also\n        # automatically sets the _user_bounding_box.  So that\n        #\n        #    >>> model.bounding_box(arg=1)\n        #\n        # in addition to returning the computed bbox, also sets it, so that\n        # it's a shortcut for\n        #\n        #    >>> model.bounding_box = model.bounding_box(arg=1)\n        #\n        # Not sure if that would be non-obvious / confusing though...\n\n        def __call__(self, **kwargs):\n            return func(self._model, **kwargs)\n\n        kwargs = []\n        for idx, param in enumerate(sig.parameters.values()):\n            if idx == 0:\n                # Presumed to be a 'self' argument\n                continue\n\n            if param.default is param.empty:\n                raise ModelDefinitionError(\n                    'The bounding_box method for {0} is not correctly '\n                    'defined: If defined as a method all arguments to that '\n                    'method (besides self) must be keyword arguments with '\n                    'default values that can be used to compute a default '\n                    'bounding box.'.format(cls.name))\n\n            kwargs.append((param.name, param.default))\n\n        __call__.__signature__ = sig\n\n        return type(f'{cls.name}ModelBoundingBox', (ModelBoundingBox,),\n                    {'__call__': __call__})"},{"attributeType":"null","col":4,"comment":"null","endLoc":1085,"id":12519,"name":"_sectionmarker","nodeType":"Attribute","startLoc":1085,"text":"_sectionmarker"},{"attributeType":"null","col":12,"comment":"null","endLoc":371,"id":12520,"name":"unit","nodeType":"Attribute","startLoc":371,"text":"self.unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":244,"id":12521,"name":"_prior","nodeType":"Attribute","startLoc":244,"text":"self._prior"},{"attributeType":"null","col":8,"comment":"null","endLoc":245,"id":12522,"name":"_posterior","nodeType":"Attribute","startLoc":245,"text":"self._posterior"},{"col":4,"comment":"\n        Apply the rotation to a set of 3D Cartesian coordinates.\n        ","endLoc":123,"header":"def evaluate(self, x, y, z, angles)","id":12523,"name":"evaluate","nodeType":"Function","startLoc":110,"text":"def evaluate(self, x, y, z, angles):\n        \"\"\"\n        Apply the rotation to a set of 3D Cartesian coordinates.\n        \"\"\"\n        if x.shape != y.shape or x.shape != z.shape:\n            raise ValueError(\"Expected input arrays to have the same shape\")\n        # Note: If the original shape was () (an array scalar) convert to a\n        # 1-element 1-D array on output for consistency with most other models\n        orig_shape = x.shape or (1,)\n        inarr = np.array([x.flatten(), y.flatten(), z.flatten()])\n        result = np.dot(_create_matrix(angles[0], self.axes_order), inarr)\n        x, y, z = result[0], result[1], result[2]\n        x.shape = y.shape = z.shape = orig_shape\n        return x, y, z"},{"attributeType":"null","col":8,"comment":"null","endLoc":524,"id":12524,"name":"bounds","nodeType":"Attribute","startLoc":524,"text":"self.bounds"},{"attributeType":"null","col":8,"comment":"null","endLoc":203,"id":12525,"name":"__doc__","nodeType":"Attribute","startLoc":203,"text":"self.__doc__"},{"col":4,"comment":"Peak wavelength when the curve is expressed as power density.","endLoc":193,"header":"@property\n    def lambda_max(self)","id":12526,"name":"lambda_max","nodeType":"Function","startLoc":190,"text":"@property\n    def lambda_max(self):\n        \"\"\"Peak wavelength when the curve is expressed as power density.\"\"\"\n        return const.b_wien / self.temperature"},{"col":4,"comment":"Peak frequency when the curve is expressed as power density.","endLoc":198,"header":"@property\n    def nu_max(self)","id":12527,"name":"nu_max","nodeType":"Function","startLoc":195,"text":"@property\n    def nu_max(self):\n        \"\"\"Peak frequency when the curve is expressed as power density.\"\"\"\n        return 2.8214391 * const.k_B * self.temperature / const.h"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":69,"id":12528,"name":"temperature","nodeType":"Attribute","startLoc":69,"text":"temperature"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":70,"id":12529,"name":"scale","nodeType":"Attribute","startLoc":70,"text":"scale"},{"attributeType":"null","col":4,"comment":"null","endLoc":74,"id":12530,"name":"_input_units_allow_dimensionless","nodeType":"Attribute","startLoc":74,"text":"_input_units_allow_dimensionless"},{"attributeType":"null","col":4,"comment":"null","endLoc":77,"id":12531,"name":"input_units_equivalencies","nodeType":"Attribute","startLoc":77,"text":"input_units_equivalencies"},{"col":0,"comment":"null","endLoc":45,"header":"def _create_matrix(angles, axes_order)","id":12532,"name":"_create_matrix","nodeType":"Function","startLoc":37,"text":"def _create_matrix(angles, axes_order):\n    matrices = []\n    for angle, axis in zip(angles, axes_order):\n        if isinstance(angle, u.Quantity):\n            angle = angle.value\n        angle = angle.item()\n        matrices.append(rotation_matrix(angle, axis, unit=u.rad))\n    result = matrix_product(*matrices[::-1])\n    return result"},{"className":"Drude1D","col":0,"comment":"\n    Drude model based one the behavior of electons in materials (esp. metals).\n\n    Parameters\n    ----------\n    amplitude : float\n        Peak value\n    x_0 : float\n        Position of the peak\n    fwhm : float\n        Full width at half maximum\n\n    Model formula:\n\n        .. math:: f(x) = A \\frac{(fwhm/x_0)^2}{((x/x_0 - x_0/x)^2 + (fwhm/x_0)^2}\n\n    Examples\n    --------\n\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Drude1D\n\n        fig, ax = plt.subplots()\n\n        # generate the curves and plot them\n        x = np.arange(7.5 , 12.5 , 0.1)\n\n        dmodel = Drude1D(amplitude=1.0, fwhm=1.0, x_0=10.0)\n        ax.plot(x, dmodel(x))\n\n        ax.set_xlabel('x')\n        ax.set_ylabel('F(x)')\n\n        plt.show()\n    ","endLoc":318,"id":12533,"nodeType":"Class","startLoc":201,"text":"class Drude1D(Fittable1DModel):\n    \"\"\"\n    Drude model based one the behavior of electons in materials (esp. metals).\n\n    Parameters\n    ----------\n    amplitude : float\n        Peak value\n    x_0 : float\n        Position of the peak\n    fwhm : float\n        Full width at half maximum\n\n    Model formula:\n\n        .. math:: f(x) = A \\\\frac{(fwhm/x_0)^2}{((x/x_0 - x_0/x)^2 + (fwhm/x_0)^2}\n\n    Examples\n    --------\n\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Drude1D\n\n        fig, ax = plt.subplots()\n\n        # generate the curves and plot them\n        x = np.arange(7.5 , 12.5 , 0.1)\n\n        dmodel = Drude1D(amplitude=1.0, fwhm=1.0, x_0=10.0)\n        ax.plot(x, dmodel(x))\n\n        ax.set_xlabel('x')\n        ax.set_ylabel('F(x)')\n\n        plt.show()\n    \"\"\"\n\n    amplitude = Parameter(default=1.0, description=\"Peak Value\")\n    x_0 = Parameter(default=1.0, description=\"Position of the peak\")\n    fwhm = Parameter(default=1.0, description=\"Full width at half maximum\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, fwhm):\n        \"\"\"\n        One dimensional Drude model function\n        \"\"\"\n        return (\n            amplitude\n            * ((fwhm / x_0) ** 2)\n            / ((x / x_0 - x_0 / x) ** 2 + (fwhm / x_0) ** 2)\n        )\n\n    @staticmethod\n    def fit_deriv(x, amplitude, x_0, fwhm):\n        \"\"\"\n        Drude1D model function derivatives.\n        \"\"\"\n        d_amplitude = (fwhm / x_0) ** 2 / ((x / x_0 - x_0 / x) ** 2 + (fwhm / x_0) ** 2)\n        d_x_0 = (\n            -2\n            * amplitude\n            * d_amplitude\n            * (\n                (1 / x_0)\n                + d_amplitude\n                * (x_0 ** 2 / fwhm ** 2)\n                * (\n                    (-x / x_0 - 1 / x) * (x / x_0 - x_0 / x)\n                    - (2 * fwhm ** 2 / x_0 ** 3)\n                )\n            )\n        )\n        d_fwhm = (2 * amplitude * d_amplitude / fwhm) * (1 - d_amplitude)\n        return [d_amplitude, d_x_0, d_fwhm]\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {\n            \"x_0\": inputs_unit[self.inputs[0]],\n            \"fwhm\": inputs_unit[self.inputs[0]],\n            \"amplitude\": outputs_unit[self.outputs[0]],\n        }\n\n    @property\n    def return_units(self):\n        if self.amplitude.unit is None:\n            return None\n        return {self.outputs[0]: self.amplitude.unit}\n\n    @x_0.validator\n    def x_0(self, val):\n        \"\"\" Ensure `x_0` is not 0.\"\"\"\n        if np.any(val == 0):\n            raise InputParameterError(\"0 is not an allowed value for x_0\")\n\n    def bounding_box(self, factor=50):\n        \"\"\"Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``.\n\n        Parameters\n        ----------\n        factor : float\n            The multiple of FWHM used to define the limits.\n        \"\"\"\n        x0 = self.x_0\n        dx = factor * self.fwhm\n\n        return (x0 - dx, x0 + dx)"},{"col":4,"comment":"null","endLoc":436,"header":"def _handle_special_methods(cls, members, pdict)","id":12534,"name":"_handle_special_methods","nodeType":"Function","startLoc":355,"text":"def _handle_special_methods(cls, members, pdict):\n\n        # Handle init creation from inputs\n        def update_wrapper(wrapper, cls):\n            # Set up the new __call__'s metadata attributes as though it were\n            # manually defined in the class definition\n            # A bit like functools.update_wrapper but uses the class instead of\n            # the wrapped function\n            wrapper.__module__ = cls.__module__\n            wrapper.__doc__ = getattr(cls, wrapper.__name__).__doc__\n            if hasattr(cls, '__qualname__'):\n                wrapper.__qualname__ = f'{cls.__qualname__}.{wrapper.__name__}'\n\n        if ('__call__' not in members and 'n_inputs' in members and\n                isinstance(members['n_inputs'], int) and members['n_inputs'] > 0):\n\n            # Don't create a custom __call__ for classes that already have one\n            # explicitly defined (this includes the Model base class, and any\n            # other classes that manually override __call__\n\n            def __call__(self, *inputs, **kwargs):\n                \"\"\"Evaluate this model on the supplied inputs.\"\"\"\n                return super(cls, self).__call__(*inputs, **kwargs)\n\n            # When called, models can take two optional keyword arguments:\n            #\n            # * model_set_axis, which indicates (for multi-dimensional input)\n            #   which axis is used to indicate different models\n            #\n            # * equivalencies, a dictionary of equivalencies to be applied to\n            #   the input values, where each key should correspond to one of\n            #   the inputs.\n            #\n            # The following code creates the __call__ function with these\n            # two keyword arguments.\n\n            args = ('self',)\n            kwargs = dict([('model_set_axis', None),\n                           ('with_bounding_box', False),\n                           ('fill_value', np.nan),\n                           ('equivalencies', None),\n                           ('inputs_map', None)])\n\n            new_call = make_function_with_signature(\n                __call__, args, kwargs, varargs='inputs', varkwargs='new_inputs')\n\n            # The following makes it look like __call__\n            # was defined in the class\n            update_wrapper(new_call, cls)\n\n            cls.__call__ = new_call\n\n        if ('__init__' not in members and not inspect.isabstract(cls) and\n                cls._parameters_):\n            # Build list of all parameters including inherited ones\n\n            # If *all* the parameters have default values we can make them\n            # keyword arguments; otherwise they must all be positional\n            # arguments\n            if all(p.default is not None for p in pdict.values()):\n                args = ('self',)\n                kwargs = []\n                for param_name, param_val in pdict.items():\n                    default = param_val.default\n                    unit = param_val.unit\n                    # If the unit was specified in the parameter but the\n                    # default is not a Quantity, attach the unit to the\n                    # default.\n                    if unit is not None:\n                        default = Quantity(default, unit, copy=False)\n                    kwargs.append((param_name, default))\n            else:\n                args = ('self',) + tuple(pdict.keys())\n                kwargs = {}\n\n            def __init__(self, *params, **kwargs):\n                return super(cls, self).__init__(*params, **kwargs)\n\n            new_init = make_function_with_signature(\n                __init__, args, kwargs, varkwargs='kwargs')\n            update_wrapper(new_init, cls)\n            cls.__init__ = new_init"},{"col":4,"comment":" Ensure `x_0` is not 0.","endLoc":304,"header":"@x_0.validator\n    def x_0(self, val)","id":12535,"name":"x_0","nodeType":"Function","startLoc":300,"text":"@x_0.validator\n    def x_0(self, val):\n        \"\"\" Ensure `x_0` is not 0.\"\"\"\n        if np.any(val == 0):\n            raise InputParameterError(\"0 is not an allowed value for x_0\")"},{"col":4,"comment":"\n        One dimensional Drude model function\n        ","endLoc":256,"header":"@staticmethod\n    def evaluate(x, amplitude, x_0, fwhm)","id":12536,"name":"evaluate","nodeType":"Function","startLoc":247,"text":"@staticmethod\n    def evaluate(x, amplitude, x_0, fwhm):\n        \"\"\"\n        One dimensional Drude model function\n        \"\"\"\n        return (\n            amplitude\n            * ((fwhm / x_0) ** 2)\n            / ((x / x_0 - x_0 / x) ** 2 + (fwhm / x_0) ** 2)\n        )"},{"col":4,"comment":"\n        Drude1D model function derivatives.\n        ","endLoc":279,"header":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, fwhm)","id":12537,"name":"fit_deriv","nodeType":"Function","startLoc":258,"text":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, fwhm):\n        \"\"\"\n        Drude1D model function derivatives.\n        \"\"\"\n        d_amplitude = (fwhm / x_0) ** 2 / ((x / x_0 - x_0 / x) ** 2 + (fwhm / x_0) ** 2)\n        d_x_0 = (\n            -2\n            * amplitude\n            * d_amplitude\n            * (\n                (1 / x_0)\n                + d_amplitude\n                * (x_0 ** 2 / fwhm ** 2)\n                * (\n                    (-x / x_0 - 1 / x) * (x / x_0 - x_0 / x)\n                    - (2 * fwhm ** 2 / x_0 ** 3)\n                )\n            )\n        )\n        d_fwhm = (2 * amplitude * d_amplitude / fwhm) * (1 - d_amplitude)\n        return [d_amplitude, d_x_0, d_fwhm]"},{"col":4,"comment":"null","endLoc":285,"header":"@property\n    def input_units(self)","id":12538,"name":"input_units","nodeType":"Function","startLoc":281,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}"},{"col":4,"comment":"null","endLoc":292,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":12539,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":287,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {\n            \"x_0\": inputs_unit[self.inputs[0]],\n            \"fwhm\": inputs_unit[self.inputs[0]],\n            \"amplitude\": outputs_unit[self.outputs[0]],\n        }"},{"col":4,"comment":"null","endLoc":298,"header":"@property\n    def return_units(self)","id":12540,"name":"return_units","nodeType":"Function","startLoc":294,"text":"@property\n    def return_units(self):\n        if self.amplitude.unit is None:\n            return None\n        return {self.outputs[0]: self.amplitude.unit}"},{"col":4,"comment":"Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``.\n\n        Parameters\n        ----------\n        factor : float\n            The multiple of FWHM used to define the limits.\n        ","endLoc":318,"header":"def bounding_box(self, factor=50)","id":12541,"name":"bounding_box","nodeType":"Function","startLoc":306,"text":"def bounding_box(self, factor=50):\n        \"\"\"Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``.\n\n        Parameters\n        ----------\n        factor : float\n            The multiple of FWHM used to define the limits.\n        \"\"\"\n        x0 = self.x_0\n        dx = factor * self.fwhm\n\n        return (x0 - dx, x0 + dx)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":243,"id":12542,"name":"amplitude","nodeType":"Attribute","startLoc":243,"text":"amplitude"},{"attributeType":"null","col":8,"comment":"null","endLoc":198,"id":12543,"name":"_model","nodeType":"Attribute","startLoc":198,"text":"self._model"},{"col":0,"comment":"null","endLoc":2929,"header":"def parse_grammar(doc, file, line)","id":12544,"name":"parse_grammar","nodeType":"Function","startLoc":2897,"text":"def parse_grammar(doc, file, line):\n    grammar = []\n    # Split the doc string into lines\n    pstrings = doc.splitlines()\n    lastp = None\n    dline = line\n    for ps in pstrings:\n        dline += 1\n        p = ps.split()\n        if not p:\n            continue\n        try:\n            if p[0] == '|':\n                # This is a continuation of a previous rule\n                if not lastp:\n                    raise SyntaxError(\"%s:%d: Misplaced '|'\" % (file, dline))\n                prodname = lastp\n                syms = p[1:]\n            else:\n                prodname = p[0]\n                lastp = prodname\n                syms   = p[2:]\n                assign = p[1]\n                if assign != ':' and assign != '::=':\n                    raise SyntaxError(\"%s:%d: Syntax error. Expected ':'\" % (file, dline))\n\n            grammar.append((file, dline, prodname, syms))\n        except SyntaxError:\n            raise\n        except Exception:\n            raise SyntaxError('%s:%d: Syntax error in rule %r' % (file, dline, ps.strip()))\n\n    return grammar"},{"attributeType":"null","col":16,"comment":"null","endLoc":225,"id":12545,"name":"_value","nodeType":"Attribute","startLoc":225,"text":"self._value"},{"attributeType":"null","col":23,"comment":"null","endLoc":203,"id":12547,"name":"_description","nodeType":"Attribute","startLoc":203,"text":"self._description"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":244,"id":12548,"name":"x_0","nodeType":"Attribute","startLoc":244,"text":"x_0"},{"attributeType":"null","col":16,"comment":"null","endLoc":223,"id":12549,"name":"value","nodeType":"Attribute","startLoc":223,"text":"self.value"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":245,"id":12550,"name":"fwhm","nodeType":"Attribute","startLoc":245,"text":"fwhm"},{"className":"Plummer1D","col":0,"comment":"One dimensional Plummer density profile model.\n\n    Parameters\n    ----------\n    mass : float\n        Total mass of cluster.\n    r_plum : float\n        Scale parameter which sets the size of the cluster core.\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        \\rho(r)=\\frac{3M}{4\\pi a^3}(1+\\frac{r^2}{a^2})^{-5/2}\n\n    References\n    ----------\n    .. [1] https://ui.adsabs.harvard.edu/abs/1911MNRAS..71..460P\n    ","endLoc":373,"id":12551,"nodeType":"Class","startLoc":321,"text":"class Plummer1D(Fittable1DModel):\n    r\"\"\"One dimensional Plummer density profile model.\n\n    Parameters\n    ----------\n    mass : float\n        Total mass of cluster.\n    r_plum : float\n        Scale parameter which sets the size of the cluster core.\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        \\rho(r)=\\frac{3M}{4\\pi a^3}(1+\\frac{r^2}{a^2})^{-5/2}\n\n    References\n    ----------\n    .. [1] https://ui.adsabs.harvard.edu/abs/1911MNRAS..71..460P\n    \"\"\"\n\n    mass = Parameter(default=1.0, description=\"Total mass of cluster\")\n    r_plum = Parameter(default=1.0, description=\"Scale parameter which sets the size of the cluster core\")\n\n    @staticmethod\n    def evaluate(x, mass, r_plum):\n        \"\"\"\n        Evaluate plummer density profile model.\n        \"\"\"\n        return (3*mass)/(4 * np.pi * r_plum**3) * (1+(x/r_plum)**2)**(-5/2)\n\n    @staticmethod\n    def fit_deriv(x, mass, r_plum):\n        \"\"\"\n        Plummer1D model derivatives.\n        \"\"\"\n        d_mass = 3 / ((4*np.pi*r_plum**3) * (((x/r_plum)**2 + 1)**(5/2)))\n        d_r_plum = (6*mass*x**2-9*mass*r_plum**2) / ((4*np.pi * r_plum**6) *\n                                                     (1+(x/r_plum)**2)**(7/2))\n        return [d_mass, d_r_plum]\n\n    @property\n    def input_units(self):\n        if self.mass.unit is None and self.r_plum.unit is None:\n            return None\n        else:\n            return {self.inputs[0]: self.r_plum.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'mass': outputs_unit[self.outputs[0]] * inputs_unit[self.inputs[0]] ** 3,\n                'r_plum': inputs_unit[self.inputs[0]]}"},{"col":4,"comment":"\n        Evaluate plummer density profile model.\n        ","endLoc":352,"header":"@staticmethod\n    def evaluate(x, mass, r_plum)","id":12552,"name":"evaluate","nodeType":"Function","startLoc":347,"text":"@staticmethod\n    def evaluate(x, mass, r_plum):\n        \"\"\"\n        Evaluate plummer density profile model.\n        \"\"\"\n        return (3*mass)/(4 * np.pi * r_plum**3) * (1+(x/r_plum)**2)**(-5/2)"},{"col":4,"comment":"\n        Plummer1D model derivatives.\n        ","endLoc":362,"header":"@staticmethod\n    def fit_deriv(x, mass, r_plum)","id":12553,"name":"fit_deriv","nodeType":"Function","startLoc":354,"text":"@staticmethod\n    def fit_deriv(x, mass, r_plum):\n        \"\"\"\n        Plummer1D model derivatives.\n        \"\"\"\n        d_mass = 3 / ((4*np.pi*r_plum**3) * (((x/r_plum)**2 + 1)**(5/2)))\n        d_r_plum = (6*mass*x**2-9*mass*r_plum**2) / ((4*np.pi * r_plum**6) *\n                                                     (1+(x/r_plum)**2)**(7/2))\n        return [d_mass, d_r_plum]"},{"col":4,"comment":"null","endLoc":369,"header":"@property\n    def input_units(self)","id":12554,"name":"input_units","nodeType":"Function","startLoc":364,"text":"@property\n    def input_units(self):\n        if self.mass.unit is None and self.r_plum.unit is None:\n            return None\n        else:\n            return {self.inputs[0]: self.r_plum.unit}"},{"col":4,"comment":"null","endLoc":373,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":12555,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":371,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'mass': outputs_unit[self.outputs[0]] * inputs_unit[self.inputs[0]] ** 3,\n                'r_plum': inputs_unit[self.inputs[0]]}"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":344,"id":12556,"name":"mass","nodeType":"Attribute","startLoc":344,"text":"mass"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":345,"id":12557,"name":"r_plum","nodeType":"Attribute","startLoc":345,"text":"r_plum"},{"col":4,"comment":"\n        Custom repr for Model subclasses.\n        ","endLoc":148,"header":"def __repr__(cls)","id":12558,"name":"__repr__","nodeType":"Function","startLoc":143,"text":"def __repr__(cls):\n        \"\"\"\n        Custom repr for Model subclasses.\n        \"\"\"\n\n        return cls._format_cls_repr()"},{"className":"NFW","col":0,"comment":"\n    Navarro–Frenk–White (NFW) profile - model for radial distribution of dark matter.\n\n    Parameters\n    ----------\n    mass : float or `~astropy.units.Quantity` ['mass']\n        Mass of NFW peak within specified overdensity radius.\n    concentration : float\n        Concentration of the NFW profile.\n    redshift : float\n        Redshift of the NFW profile.\n    massfactor : tuple or str\n        Mass overdensity factor and type for provided profiles:\n            Tuple version:\n                (\"virial\",) : virial radius\n\n                (\"critical\", N)  : radius where density is N times that of the critical density\n\n                (\"mean\", N)  : radius where density is N times that of the mean density\n\n            String version:\n                \"virial\" : virial radius\n\n                \"Nc\"  : radius where density is N times that of the critical density (e.g. \"200c\")\n\n                \"Nm\"  : radius where density is N times that of the mean density (e.g. \"500m\")\n    cosmo : :class:`~astropy.cosmology.Cosmology`\n        Background cosmology for density calculation. If None, the default cosmology will be used.\n\n    Notes\n    -----\n\n    Model formula:\n\n    .. math:: \\rho(r)=\\frac{\\delta_c\\rho_{c}}{r/r_s(1+r/r_s)^2}\n\n    References\n    ----------\n    .. [1] https://arxiv.org/pdf/astro-ph/9508025\n    .. [2] https://en.wikipedia.org/wiki/Navarro%E2%80%93Frenk%E2%80%93White_profile\n    .. [3] https://en.wikipedia.org/wiki/Virial_mass\n    ","endLoc":723,"id":12559,"nodeType":"Class","startLoc":376,"text":"class NFW(Fittable1DModel):\n    r\"\"\"\n    Navarro–Frenk–White (NFW) profile - model for radial distribution of dark matter.\n\n    Parameters\n    ----------\n    mass : float or `~astropy.units.Quantity` ['mass']\n        Mass of NFW peak within specified overdensity radius.\n    concentration : float\n        Concentration of the NFW profile.\n    redshift : float\n        Redshift of the NFW profile.\n    massfactor : tuple or str\n        Mass overdensity factor and type for provided profiles:\n            Tuple version:\n                (\"virial\",) : virial radius\n\n                (\"critical\", N)  : radius where density is N times that of the critical density\n\n                (\"mean\", N)  : radius where density is N times that of the mean density\n\n            String version:\n                \"virial\" : virial radius\n\n                \"Nc\"  : radius where density is N times that of the critical density (e.g. \"200c\")\n\n                \"Nm\"  : radius where density is N times that of the mean density (e.g. \"500m\")\n    cosmo : :class:`~astropy.cosmology.Cosmology`\n        Background cosmology for density calculation. If None, the default cosmology will be used.\n\n    Notes\n    -----\n\n    Model formula:\n\n    .. math:: \\rho(r)=\\frac{\\delta_c\\rho_{c}}{r/r_s(1+r/r_s)^2}\n\n    References\n    ----------\n    .. [1] https://arxiv.org/pdf/astro-ph/9508025\n    .. [2] https://en.wikipedia.org/wiki/Navarro%E2%80%93Frenk%E2%80%93White_profile\n    .. [3] https://en.wikipedia.org/wiki/Virial_mass\n    \"\"\"\n\n    # Model Parameters\n\n    # NFW Profile mass\n    mass = Parameter(default=1.0, min=1.0, unit=u.M_sun,\n           description=\"Peak mass within specified overdensity radius\")\n\n    # NFW profile concentration\n    concentration = Parameter(default=1.0, min=1.0, description=\"Concentration\")\n\n    # NFW Profile redshift\n    redshift = Parameter(default=0.0, min=0.0, description=\"Redshift\")\n\n    # We allow values without units to be passed when evaluating the model, and\n    # in this case the input r values are assumed to be lengths / positions in kpc.\n    _input_units_allow_dimensionless = True\n\n    def __init__(self, mass=u.Quantity(mass.default, mass.unit),\n                 concentration=concentration.default, redshift=redshift.default,\n                 massfactor=(\"critical\", 200), cosmo=None,  **kwargs):\n        # Set default cosmology\n        if cosmo is None:\n            # LOCAL\n            from astropy.cosmology import default_cosmology\n\n            cosmo = default_cosmology.get()\n\n        # Set mass overdensity type and factor\n        self._density_delta(massfactor, cosmo, redshift)\n\n        # Establish mass units for density calculation (default solar masses)\n        if not isinstance(mass, u.Quantity):\n            in_mass = u.Quantity(mass, u.M_sun)\n        else:\n            in_mass = mass\n\n        # Obtain scale radius\n        self._radius_s(mass, concentration)\n\n        # Obtain scale density\n        self._density_s(mass, concentration)\n\n        super().__init__(mass=in_mass, concentration=concentration, redshift=redshift, **kwargs)\n\n    def evaluate(self, r, mass, concentration, redshift):\n        \"\"\"\n        One dimensional NFW profile function\n\n        Parameters\n        ----------\n        r : float or `~astropy.units.Quantity` ['length']\n            Radial position of density to be calculated for the NFW profile.\n        mass : float or `~astropy.units.Quantity` ['mass']\n            Mass of NFW peak within specified overdensity radius.\n        concentration : float\n            Concentration of the NFW profile.\n        redshift : float\n            Redshift of the NFW profile.\n\n        Returns\n        -------\n        density : float or `~astropy.units.Quantity` ['density']\n            NFW profile mass density at location ``r``. The density units are:\n            [``mass`` / ``r`` ^3]\n\n        Notes\n        -----\n        .. warning::\n\n            Output values might contain ``nan`` and ``inf``.\n        \"\"\"\n        # Create radial version of input with dimension\n        if hasattr(r, \"unit\"):\n            in_r = r\n        else:\n            in_r = u.Quantity(r, u.kpc)\n\n        # Define reduced radius (r / r_{\\\\rm s})\n        #   also update scale radius\n        radius_reduced = in_r / self._radius_s(mass, concentration).to(in_r.unit)\n\n        # Density distribution\n        # \\rho (r)=\\frac{\\rho_0}{\\frac{r}{R_s}\\left(1~+~\\frac{r}{R_s}\\right)^2}\n        #   also update scale density\n        density = self._density_s(mass, concentration) / (radius_reduced *\n                                                          (u.Quantity(1.0) + radius_reduced) ** 2)\n\n        if hasattr(mass, \"unit\"):\n            return density\n        else:\n            return density.value\n\n    def _density_delta(self, massfactor, cosmo, redshift):\n        \"\"\"\n        Calculate density delta.\n        \"\"\"\n        # Set mass overdensity type and factor\n        if isinstance(massfactor, tuple):\n            # Tuple options\n            #   (\"virial\")       : virial radius\n            #   (\"critical\", N)  : radius where density is N that of the critical density\n            #   (\"mean\", N)      : radius where density is N that of the mean density\n            if massfactor[0].lower() == \"virial\":\n                # Virial Mass\n                delta = None\n                masstype = massfactor[0].lower()\n            elif massfactor[0].lower() == \"critical\":\n                # Critical or Mean Overdensity Mass\n                delta = float(massfactor[1])\n                masstype = 'c'\n            elif massfactor[0].lower() == \"mean\":\n                # Critical or Mean Overdensity Mass\n                delta = float(massfactor[1])\n                masstype = 'm'\n            else:\n                raise ValueError(\"Massfactor '\" + str(massfactor[0]) + \"' not one of 'critical', \"\n                                                                       \"'mean', or 'virial'\")\n        else:\n            try:\n                # String options\n                #   virial : virial radius\n                #   Nc  : radius where density is N that of the critical density\n                #   Nm  : radius where density is N that of the mean density\n                if massfactor.lower() == \"virial\":\n                    # Virial Mass\n                    delta = None\n                    masstype = massfactor.lower()\n                elif massfactor[-1].lower() == 'c' or massfactor[-1].lower() == 'm':\n                    # Critical or Mean Overdensity Mass\n                    delta = float(massfactor[0:-1])\n                    masstype = massfactor[-1].lower()\n                else:\n                    raise ValueError(\"Massfactor \" + str(massfactor) + \" string not of the form \"\n                                                                       \"'#m', '#c', or 'virial'\")\n            except (AttributeError, TypeError):\n                raise TypeError(\"Massfactor \" + str(\n                    massfactor) + \" not a tuple or string\")\n\n        # Set density from masstype specification\n        if masstype == \"virial\":\n            Om_c = cosmo.Om(redshift) - 1.0\n            d_c = 18.0 * np.pi ** 2 + 82.0 * Om_c - 39.0 * Om_c ** 2\n            self.density_delta = d_c * cosmo.critical_density(redshift)\n        elif masstype == 'c':\n            self.density_delta = delta * cosmo.critical_density(redshift)\n        elif masstype == 'm':\n            self.density_delta = delta * cosmo.critical_density(redshift) * cosmo.Om(redshift)\n\n        return self.density_delta\n\n    @staticmethod\n    def A_NFW(y):\n        r\"\"\"\n        Dimensionless volume integral of the NFW profile, used as an intermediate step in some\n        calculations for this model.\n\n        Notes\n        -----\n\n        Model formula:\n\n        .. math:: A_{NFW} = [\\ln(1+y) - \\frac{y}{1+y}]\n        \"\"\"\n        return np.log(1.0 + y) - (y / (1.0 + y))\n\n    def _density_s(self, mass, concentration):\n        \"\"\"\n        Calculate scale density of the NFW profile.\n        \"\"\"\n        # Enforce default units\n        if not isinstance(mass, u.Quantity):\n            in_mass = u.Quantity(mass, u.M_sun)\n        else:\n            in_mass = mass\n\n        # Calculate scale density\n        # M_{200} = 4\\pi \\rho_{s} R_{s}^3 \\left[\\ln(1+c) - \\frac{c}{1+c}\\right].\n        self.density_s = in_mass / (4.0 * np.pi * self._radius_s(in_mass, concentration) ** 3 *\n                                    self.A_NFW(concentration))\n\n        return self.density_s\n\n    @property\n    def rho_scale(self):\n        r\"\"\"\n        Scale density of the NFW profile. Often written in the literature as :math:`\\rho_s`\n        \"\"\"\n        return self.density_s\n\n    def _radius_s(self, mass, concentration):\n        \"\"\"\n        Calculate scale radius of the NFW profile.\n        \"\"\"\n        # Enforce default units\n        if not isinstance(mass, u.Quantity):\n            in_mass = u.Quantity(mass, u.M_sun)\n        else:\n            in_mass = mass\n\n        # Delta Mass is related to delta radius by\n        # M_{200}=\\frac{4}{3}\\pi r_{200}^3 200 \\rho_{c}\n        # And delta radius is related to the NFW scale radius by\n        # c = R / r_{\\\\rm s}\n        self.radius_s = (((3.0 * in_mass) / (4.0 * np.pi * self.density_delta)) ** (\n                          1.0 / 3.0)) / concentration\n\n        # Set radial units to kiloparsec by default (unit will be rescaled by units of radius\n        # in evaluate)\n        return self.radius_s.to(u.kpc)\n\n    @property\n    def r_s(self):\n        \"\"\"\n        Scale radius of the NFW profile.\n        \"\"\"\n        return self.radius_s\n\n    @property\n    def r_virial(self):\n        \"\"\"\n        Mass factor defined virial radius of the NFW profile (R200c for M200c, Rvir for Mvir, etc.).\n        \"\"\"\n        return self.r_s * self.concentration\n\n    @property\n    def r_max(self):\n        \"\"\"\n        Radius of maximum circular velocity.\n        \"\"\"\n        return self.r_s * 2.16258\n\n    @property\n    def v_max(self):\n        \"\"\"\n        Maximum circular velocity.\n        \"\"\"\n        return self.circular_velocity(self.r_max)\n\n    def circular_velocity(self, r):\n        r\"\"\"\n        Circular velocities of the NFW profile.\n\n        Parameters\n        ----------\n        r : float or `~astropy.units.Quantity` ['length']\n            Radial position of velocity to be calculated for the NFW profile.\n\n        Returns\n        -------\n        velocity : float or `~astropy.units.Quantity` ['speed']\n            NFW profile circular velocity at location ``r``. The velocity units are:\n            [km / s]\n\n        Notes\n        -----\n\n        Model formula:\n\n        .. math:: v_{circ}(r)^2 = \\frac{1}{x}\\frac{\\ln(1+cx)-(cx)/(1+cx)}{\\ln(1+c)-c/(1+c)}\n\n        .. math:: x = r/r_s\n\n        .. warning::\n\n            Output values might contain ``nan`` and ``inf``.\n        \"\"\"\n        # Enforce default units (if parameters are without units)\n        if hasattr(r, \"unit\"):\n            in_r = r\n        else:\n            in_r = u.Quantity(r, u.kpc)\n\n        # Mass factor defined velocity (i.e. V200c for M200c, Rvir for Mvir)\n        v_profile = np.sqrt(self.mass * const.G.to(in_r.unit**3 / (self.mass.unit * u.s**2)) /\n                            self.r_virial)\n\n        # Define reduced radius (r / r_{\\\\rm s})\n        reduced_radius = in_r / self.r_virial.to(in_r.unit)\n\n        # Circular velocity given by:\n        # v^2=\\frac{1}{x}\\frac{\\ln(1+cx)-(cx)/(1+cx)}{\\ln(1+c)-c/(1+c)}\n        # where x=r/r_{200}\n        velocity = np.sqrt((v_profile**2 * self.A_NFW(self.concentration * reduced_radius)) /\n                           (reduced_radius * self.A_NFW(self.concentration)))\n\n        return velocity.to(u.km / u.s)\n\n    @property\n    def input_units(self):\n        # The units for the 'r' variable should be a length (default kpc)\n        return {self.inputs[0]: u.kpc}\n\n    @property\n    def return_units(self):\n        # The units for the 'density' variable should be a matter density (default M_sun / kpc^3)\n\n        if (self.mass.unit is None):\n            return {self.outputs[0]: u.M_sun / self.input_units[self.inputs[0]] ** 3}\n        else:\n            return {self.outputs[0]: self.mass.unit / self.input_units[self.inputs[0]] ** 3}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'mass': u.M_sun,\n                \"concentration\": None,\n                \"redshift\": None}"},{"attributeType":"null","col":8,"comment":"null","endLoc":238,"id":12560,"name":"_fixed","nodeType":"Attribute","startLoc":238,"text":"self._fixed"},{"col":4,"comment":"null","endLoc":461,"header":"def __init__(self, mass=u.Quantity(mass.default, mass.unit),\n                 concentration=concentration.default, redshift=redshift.default,\n                 massfactor=(\"critical\", 200), cosmo=None,  **kwargs)","id":12561,"name":"__init__","nodeType":"Function","startLoc":436,"text":"def __init__(self, mass=u.Quantity(mass.default, mass.unit),\n                 concentration=concentration.default, redshift=redshift.default,\n                 massfactor=(\"critical\", 200), cosmo=None,  **kwargs):\n        # Set default cosmology\n        if cosmo is None:\n            # LOCAL\n            from astropy.cosmology import default_cosmology\n\n            cosmo = default_cosmology.get()\n\n        # Set mass overdensity type and factor\n        self._density_delta(massfactor, cosmo, redshift)\n\n        # Establish mass units for density calculation (default solar masses)\n        if not isinstance(mass, u.Quantity):\n            in_mass = u.Quantity(mass, u.M_sun)\n        else:\n            in_mass = mass\n\n        # Obtain scale radius\n        self._radius_s(mass, concentration)\n\n        # Obtain scale density\n        self._density_s(mass, concentration)\n\n        super().__init__(mass=in_mass, concentration=concentration, redshift=redshift, **kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1102,"id":12562,"name":"_valueexp","nodeType":"Attribute","startLoc":1102,"text":"_valueexp"},{"attributeType":"null","col":4,"comment":"null","endLoc":82,"id":12563,"name":"standard_broadcasting","nodeType":"Attribute","startLoc":82,"text":"standard_broadcasting"},{"className":"_SplineFitter","col":0,"comment":"\n    Base Spline Fitter\n    ","endLoc":573,"id":12564,"nodeType":"Class","startLoc":541,"text":"class _SplineFitter(abc.ABC):\n    \"\"\"\n    Base Spline Fitter\n    \"\"\"\n\n    def __init__(self):\n        self.fit_info = {\n            'resid': None,\n            'spline': None\n        }\n\n    def _set_fit_info(self, spline):\n        self.fit_info['resid'] = spline.get_residual()\n        self.fit_info['spline'] = spline\n\n    @abc.abstractmethod\n    def _fit_method(self, model, x, y, **kwargs):\n        raise NotImplementedError(\"This has not been implemented for _SplineFitter.\")\n\n    def __call__(self, model, x, y, z=None, **kwargs):\n        model_copy = model.copy()\n        if isinstance(model_copy, Spline1D):\n            if z is not None:\n                raise ValueError(\"1D model can only have 2 data points.\")\n\n            spline = self._fit_method(model_copy, x, y, **kwargs)\n\n        else:\n            raise ModelDefinitionError(\"Only spline models are compatible with this fitter.\")\n\n        self._set_fit_info(spline)\n\n        return model_copy"},{"attributeType":"null","col":4,"comment":"null","endLoc":83,"id":12565,"name":"_separable","nodeType":"Attribute","startLoc":83,"text":"_separable"},{"col":4,"comment":"null","endLoc":550,"header":"def __init__(self)","id":12566,"name":"__init__","nodeType":"Function","startLoc":546,"text":"def __init__(self):\n        self.fit_info = {\n            'resid': None,\n            'spline': None\n        }"},{"col":4,"comment":"null","endLoc":554,"header":"def _set_fit_info(self, spline)","id":12567,"name":"_set_fit_info","nodeType":"Function","startLoc":552,"text":"def _set_fit_info(self, spline):\n        self.fit_info['resid'] = spline.get_residual()\n        self.fit_info['spline'] = spline"},{"attributeType":"null","col":4,"comment":"null","endLoc":84,"id":12568,"name":"n_inputs","nodeType":"Attribute","startLoc":84,"text":"n_inputs"},{"col":4,"comment":"null","endLoc":558,"header":"@abc.abstractmethod\n    def _fit_method(self, model, x, y, **kwargs)","id":12569,"name":"_fit_method","nodeType":"Function","startLoc":556,"text":"@abc.abstractmethod\n    def _fit_method(self, model, x, y, **kwargs):\n        raise NotImplementedError(\"This has not been implemented for _SplineFitter.\")"},{"col":4,"comment":"null","endLoc":573,"header":"def __call__(self, model, x, y, z=None, **kwargs)","id":12570,"name":"__call__","nodeType":"Function","startLoc":560,"text":"def __call__(self, model, x, y, z=None, **kwargs):\n        model_copy = model.copy()\n        if isinstance(model_copy, Spline1D):\n            if z is not None:\n                raise ValueError(\"1D model can only have 2 data points.\")\n\n            spline = self._fit_method(model_copy, x, y, **kwargs)\n\n        else:\n            raise ModelDefinitionError(\"Only spline models are compatible with this fitter.\")\n\n        self._set_fit_info(spline)\n\n        return model_copy"},{"attributeType":"null","col":4,"comment":"null","endLoc":85,"id":12571,"name":"n_outputs","nodeType":"Attribute","startLoc":85,"text":"n_outputs"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":87,"id":12572,"name":"angles","nodeType":"Attribute","startLoc":87,"text":"angles"},{"attributeType":"null","col":4,"comment":"null","endLoc":1129,"id":12573,"name":"_listvalueexp","nodeType":"Attribute","startLoc":1129,"text":"_listvalueexp"},{"attributeType":"null","col":4,"comment":"null","endLoc":1141,"id":12574,"name":"_nolistvalue","nodeType":"Attribute","startLoc":1141,"text":"_nolistvalue"},{"attributeType":"null","col":4,"comment":"null","endLoc":1153,"id":12575,"name":"_single_line_single","nodeType":"Attribute","startLoc":1153,"text":"_single_line_single"},{"attributeType":"null","col":4,"comment":"null","endLoc":1154,"id":12576,"name":"_single_line_double","nodeType":"Attribute","startLoc":1154,"text":"_single_line_double"},{"attributeType":"null","col":4,"comment":"null","endLoc":1155,"id":12577,"name":"_multi_line_single","nodeType":"Attribute","startLoc":1155,"text":"_multi_line_single"},{"attributeType":"null","col":4,"comment":"null","endLoc":1156,"id":12578,"name":"_multi_line_double","nodeType":"Attribute","startLoc":1156,"text":"_multi_line_double"},{"attributeType":"null","col":4,"comment":"null","endLoc":1158,"id":12579,"name":"_triple_quote","nodeType":"Attribute","startLoc":1158,"text":"_triple_quote"},{"attributeType":"null","col":4,"comment":"null","endLoc":1164,"id":12580,"name":"_bools","nodeType":"Attribute","startLoc":1164,"text":"_bools"},{"attributeType":"null","col":8,"comment":"null","endLoc":1342,"id":12581,"name":"BOM","nodeType":"Attribute","startLoc":1342,"text":"self.BOM"},{"attributeType":"null","col":8,"comment":"null","endLoc":547,"id":12582,"name":"fit_info","nodeType":"Attribute","startLoc":547,"text":"self.fit_info"},{"className":"SplineInterpolateFitter","col":0,"comment":"\n    Fit an interpolating spline\n    ","endLoc":597,"id":12583,"nodeType":"Class","startLoc":576,"text":"class SplineInterpolateFitter(_SplineFitter):\n    \"\"\"\n    Fit an interpolating spline\n    \"\"\"\n\n    def _fit_method(self, model, x, y, **kwargs):\n        weights = kwargs.pop('weights', None)\n        bbox = kwargs.pop('bbox', [None, None])\n\n        if model.user_knots:\n            warnings.warn(\"The current user specified knots maybe ignored for interpolating data\",\n                          AstropyUserWarning)\n            model.user_knots = False\n\n        if bbox != [None, None]:\n            model.bounding_box = bbox\n\n        from scipy.interpolate import InterpolatedUnivariateSpline\n        spline = InterpolatedUnivariateSpline(x, y, w=weights, bbox=bbox, k=model.degree)\n\n        model.tck = spline._eval_args\n        return spline"},{"col":4,"comment":"null","endLoc":597,"header":"def _fit_method(self, model, x, y, **kwargs)","id":12584,"name":"_fit_method","nodeType":"Function","startLoc":581,"text":"def _fit_method(self, model, x, y, **kwargs):\n        weights = kwargs.pop('weights', None)\n        bbox = kwargs.pop('bbox', [None, None])\n\n        if model.user_knots:\n            warnings.warn(\"The current user specified knots maybe ignored for interpolating data\",\n                          AstropyUserWarning)\n            model.user_knots = False\n\n        if bbox != [None, None]:\n            model.bounding_box = bbox\n\n        from scipy.interpolate import InterpolatedUnivariateSpline\n        spline = InterpolatedUnivariateSpline(x, y, w=weights, bbox=bbox, k=model.degree)\n\n        model.tck = spline._eval_args\n        return spline"},{"attributeType":"VdtMissingValue","col":16,"comment":"null","endLoc":2167,"id":12585,"name":"_vdtMissingValue","nodeType":"Attribute","startLoc":2167,"text":"self._vdtMissingValue"},{"attributeType":"null","col":8,"comment":"null","endLoc":1333,"id":12586,"name":"raise_errors","nodeType":"Attribute","startLoc":1333,"text":"self.raise_errors"},{"className":"SplineSmoothingFitter","col":0,"comment":"\n    Fit a smoothing spline\n    ","endLoc":622,"id":12587,"nodeType":"Class","startLoc":600,"text":"class SplineSmoothingFitter(_SplineFitter):\n    \"\"\"\n    Fit a smoothing spline\n    \"\"\"\n\n    def _fit_method(self, model, x, y, **kwargs):\n        s = kwargs.pop('s', None)\n        weights = kwargs.pop('weights', None)\n        bbox = kwargs.pop('bbox', [None, None])\n\n        if model.user_knots:\n            warnings.warn(\"The current user specified knots maybe ignored for smoothing data\",\n                          AstropyUserWarning)\n            model.user_knots = False\n\n        if bbox != [None, None]:\n            model.bounding_box = bbox\n\n        from scipy.interpolate import UnivariateSpline\n        spline = UnivariateSpline(x, y, w=weights, bbox=bbox, k=model.degree, s=s)\n\n        model.tck = spline._eval_args\n        return spline"},{"col":4,"comment":"null","endLoc":622,"header":"def _fit_method(self, model, x, y, **kwargs)","id":12588,"name":"_fit_method","nodeType":"Function","startLoc":605,"text":"def _fit_method(self, model, x, y, **kwargs):\n        s = kwargs.pop('s', None)\n        weights = kwargs.pop('weights', None)\n        bbox = kwargs.pop('bbox', [None, None])\n\n        if model.user_knots:\n            warnings.warn(\"The current user specified knots maybe ignored for smoothing data\",\n                          AstropyUserWarning)\n            model.user_knots = False\n\n        if bbox != [None, None]:\n            model.bounding_box = bbox\n\n        from scipy.interpolate import UnivariateSpline\n        spline = UnivariateSpline(x, y, w=weights, bbox=bbox, k=model.degree, s=s)\n\n        model.tck = spline._eval_args\n        return spline"},{"attributeType":"None","col":16,"comment":"null","endLoc":1272,"id":12589,"name":"configspec","nodeType":"Attribute","startLoc":1272,"text":"self.configspec"},{"attributeType":"null","col":8,"comment":"null","endLoc":1336,"id":12590,"name":"create_empty","nodeType":"Attribute","startLoc":1336,"text":"self.create_empty"},{"attributeType":"null","col":8,"comment":"null","endLoc":1345,"id":12591,"name":"unrepr","nodeType":"Attribute","startLoc":1345,"text":"self.unrepr"},{"attributeType":"null","col":8,"comment":"null","endLoc":1344,"id":12592,"name":"write_empty_values","nodeType":"Attribute","startLoc":1344,"text":"self.write_empty_values"},{"attributeType":"null","col":8,"comment":"null","endLoc":1348,"id":12593,"name":"final_comment","nodeType":"Attribute","startLoc":1348,"text":"self.final_comment"},{"attributeType":"null","col":8,"comment":"null","endLoc":1226,"id":12594,"name":"_original_configspec","nodeType":"Attribute","startLoc":1226,"text":"self._original_configspec"},{"className":"SplineExactKnotsFitter","col":0,"comment":"\n    Fit a spline using least-squares regression.\n    ","endLoc":653,"id":12595,"nodeType":"Class","startLoc":625,"text":"class SplineExactKnotsFitter(_SplineFitter):\n    \"\"\"\n    Fit a spline using least-squares regression.\n    \"\"\"\n\n    def _fit_method(self, model, x, y, **kwargs):\n        t = kwargs.pop('t', None)\n        weights = kwargs.pop('weights', None)\n        bbox = kwargs.pop('bbox', [None, None])\n\n        if t is not None:\n            if model.user_knots:\n                warnings.warn(\"The current user specified knots will be \"\n                              \"overwritten for by knots passed into this function\",\n                              AstropyUserWarning)\n        else:\n            if model.user_knots:\n                t = model.t_interior\n            else:\n                raise RuntimeError(\"No knots have been provided\")\n\n        if bbox != [None, None]:\n            model.bounding_box = bbox\n\n        from scipy.interpolate import LSQUnivariateSpline\n        spline = LSQUnivariateSpline(x, y, t, w=weights, bbox=bbox, k=model.degree)\n\n        model.tck = spline._eval_args\n        return spline"},{"col":4,"comment":"null","endLoc":653,"header":"def _fit_method(self, model, x, y, **kwargs)","id":12596,"name":"_fit_method","nodeType":"Function","startLoc":630,"text":"def _fit_method(self, model, x, y, **kwargs):\n        t = kwargs.pop('t', None)\n        weights = kwargs.pop('weights', None)\n        bbox = kwargs.pop('bbox', [None, None])\n\n        if t is not None:\n            if model.user_knots:\n                warnings.warn(\"The current user specified knots will be \"\n                              \"overwritten for by knots passed into this function\",\n                              AstropyUserWarning)\n        else:\n            if model.user_knots:\n                t = model.t_interior\n            else:\n                raise RuntimeError(\"No knots have been provided\")\n\n        if bbox != [None, None]:\n            model.bounding_box = bbox\n\n        from scipy.interpolate import LSQUnivariateSpline\n        spline = LSQUnivariateSpline(x, y, t, w=weights, bbox=bbox, k=model.degree)\n\n        model.tck = spline._eval_args\n        return spline"},{"className":"SplineSplrepFitter","col":0,"comment":"\n    Fit a spline using the `scipy.interpolate.splrep` function interface.\n    ","endLoc":697,"id":12597,"nodeType":"Class","startLoc":656,"text":"class SplineSplrepFitter(_SplineFitter):\n    \"\"\"\n    Fit a spline using the `scipy.interpolate.splrep` function interface.\n    \"\"\"\n\n    def __init__(self):\n        super().__init__()\n        self.fit_info = {\n            'fp': None,\n            'ier': None,\n            'msg': None\n        }\n\n    def _fit_method(self, model, x, y, **kwargs):\n        t = kwargs.pop('t', None)\n        s = kwargs.pop('s', None)\n        task = kwargs.pop('task', 0)\n        weights = kwargs.pop('weights', None)\n        bbox = kwargs.pop('bbox', [None, None])\n\n        if t is not None:\n            if model.user_knots:\n                warnings.warn(\"The current user specified knots will be \"\n                              \"overwritten for by knots passed into this function\",\n                              AstropyUserWarning)\n        else:\n            if model.user_knots:\n                t = model.t_interior\n\n        if bbox != [None, None]:\n            model.bounding_box = bbox\n\n        from scipy.interpolate import splrep\n        tck, fp, ier, msg = splrep(x, y, w=weights, xb=bbox[0], xe=bbox[1], k=model.degree,\n                                   s=s, t=t, task=task, full_output=1)\n        model.tck = tck\n        return fp, ier, msg\n\n    def _set_fit_info(self, spline):\n        self.fit_info['fp'] = spline[0]\n        self.fit_info['ier'] = spline[1]\n        self.fit_info['msg'] = spline[2]"},{"col":4,"comment":"null","endLoc":667,"header":"def __init__(self)","id":12598,"name":"__init__","nodeType":"Function","startLoc":661,"text":"def __init__(self):\n        super().__init__()\n        self.fit_info = {\n            'fp': None,\n            'ier': None,\n            'msg': None\n        }"},{"col":4,"comment":"null","endLoc":692,"header":"def _fit_method(self, model, x, y, **kwargs)","id":12599,"name":"_fit_method","nodeType":"Function","startLoc":669,"text":"def _fit_method(self, model, x, y, **kwargs):\n        t = kwargs.pop('t', None)\n        s = kwargs.pop('s', None)\n        task = kwargs.pop('task', 0)\n        weights = kwargs.pop('weights', None)\n        bbox = kwargs.pop('bbox', [None, None])\n\n        if t is not None:\n            if model.user_knots:\n                warnings.warn(\"The current user specified knots will be \"\n                              \"overwritten for by knots passed into this function\",\n                              AstropyUserWarning)\n        else:\n            if model.user_knots:\n                t = model.t_interior\n\n        if bbox != [None, None]:\n            model.bounding_box = bbox\n\n        from scipy.interpolate import splrep\n        tck, fp, ier, msg = splrep(x, y, w=weights, xb=bbox[0], xe=bbox[1], k=model.degree,\n                                   s=s, t=t, task=task, full_output=1)\n        model.tck = tck\n        return fp, ier, msg"},{"col":4,"comment":"null","endLoc":3021,"header":"def validate_modules(self)","id":12600,"name":"validate_modules","nodeType":"Function","startLoc":2999,"text":"def validate_modules(self):\n        # Match def p_funcname(\n        fre = re.compile(r'\\s*def\\s+(p_[a-zA-Z_0-9]*)\\(')\n\n        for module in self.modules:\n            try:\n                lines, linen = inspect.getsourcelines(module)\n            except IOError:\n                continue\n\n            counthash = {}\n            for linen, line in enumerate(lines):\n                linen += 1\n                m = fre.match(line)\n                if m:\n                    name = m.group(1)\n                    prev = counthash.get(name)\n                    if not prev:\n                        counthash[name] = linen\n                    else:\n                        filename = inspect.getsourcefile(module)\n                        self.log.warning('%s:%d: Function %s redefined. Previously defined on line %d',\n                                         filename, linen, name, prev)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1340,"id":12601,"name":"encoding","nodeType":"Attribute","startLoc":1340,"text":"self.encoding"},{"attributeType":"null","col":8,"comment":"null","endLoc":1332,"id":12602,"name":"_errors","nodeType":"Attribute","startLoc":1332,"text":"self._errors"},{"col":4,"comment":"null","endLoc":697,"header":"def _set_fit_info(self, spline)","id":12603,"name":"_set_fit_info","nodeType":"Function","startLoc":694,"text":"def _set_fit_info(self, spline):\n        self.fit_info['fp'] = spline[0]\n        self.fit_info['ier'] = spline[1]\n        self.fit_info['msg'] = spline[2]"},{"attributeType":"null","col":8,"comment":"null","endLoc":1337,"id":12604,"name":"file_error","nodeType":"Attribute","startLoc":1337,"text":"self.file_error"},{"attributeType":"null","col":8,"comment":"null","endLoc":663,"id":12605,"name":"fit_info","nodeType":"Attribute","startLoc":663,"text":"self.fit_info"},{"attributeType":"null","col":8,"comment":"null","endLoc":102,"id":12606,"name":"_outputs","nodeType":"Attribute","startLoc":102,"text":"self._outputs"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":12607,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":12608,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":21,"text":"__doctest_requires__"},{"col":0,"comment":"","endLoc":3,"header":"spline.py#<anonymous>","id":12609,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"Spline models and fitters.\"\"\"\n\n__all__ = ['Spline1D', 'SplineInterpolateFitter', 'SplineSmoothingFitter',\n           'SplineExactKnotsFitter', 'SplineSplrepFitter']\n\n__doctest_requires__ = {('Spline1D'): ['scipy']}"},{"attributeType":"null","col":8,"comment":"null","endLoc":1334,"id":12610,"name":"interpolation","nodeType":"Attribute","startLoc":1334,"text":"self.interpolation"},{"attributeType":"null","col":12,"comment":"null","endLoc":1232,"id":12611,"name":"filename","nodeType":"Attribute","startLoc":1232,"text":"self.filename"},{"col":4,"comment":"null","endLoc":2986,"header":"def signature(self)","id":12612,"name":"signature","nodeType":"Function","startLoc":2972,"text":"def signature(self):\n        parts = []\n        try:\n            if self.start:\n                parts.append(self.start)\n            if self.prec:\n                parts.append(''.join([''.join(p) for p in self.prec]))\n            if self.tokens:\n                parts.append(' '.join(self.tokens))\n            for f in self.pfuncs:\n                if f[3]:\n                    parts.append(f[3])\n        except (TypeError, ValueError):\n            pass\n        return ''.join(parts)"},{"attributeType":"null","col":8,"comment":"null","endLoc":101,"id":12613,"name":"_inputs","nodeType":"Attribute","startLoc":101,"text":"self._inputs"},{"attributeType":"null","col":8,"comment":"null","endLoc":1339,"id":12614,"name":"indent_type","nodeType":"Attribute","startLoc":1339,"text":"self.indent_type"},{"attributeType":"null","col":24,"comment":"null","endLoc":1295,"id":12615,"name":"newlines","nodeType":"Attribute","startLoc":1295,"text":"self.newlines"},{"attributeType":"null","col":8,"comment":"null","endLoc":90,"id":12616,"name":"axes","nodeType":"Attribute","startLoc":90,"text":"self.axes"},{"fileName":"powerlaws.py","filePath":"astropy/modeling","id":12617,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nPower law model variants\n\"\"\"\n# pylint: disable=invalid-name\nimport numpy as np\n\nfrom astropy.units import Quantity\nfrom .core import Fittable1DModel\nfrom .parameters import Parameter, InputParameterError\n\n\n__all__ = ['PowerLaw1D', 'BrokenPowerLaw1D', 'SmoothlyBrokenPowerLaw1D',\n           'ExponentialCutoffPowerLaw1D', 'LogParabola1D']\n\n\nclass PowerLaw1D(Fittable1DModel):\n    \"\"\"\n    One dimensional power law model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Model amplitude at the reference point\n    x_0 : float\n        Reference point\n    alpha : float\n        Power law index\n\n    See Also\n    --------\n    BrokenPowerLaw1D, ExponentialCutoffPowerLaw1D, LogParabola1D\n\n    Notes\n    -----\n    Model formula (with :math:`A` for ``amplitude`` and :math:`\\\\alpha` for ``alpha``):\n\n        .. math:: f(x) = A (x / x_0) ^ {-\\\\alpha}\n\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Peak value at the reference point\")\n    x_0 = Parameter(default=1, description=\"Reference point\")\n    alpha = Parameter(default=1, description=\"Power law index\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, alpha):\n        \"\"\"One dimensional power law model function\"\"\"\n        xx = x / x_0\n        return amplitude * xx ** (-alpha)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, x_0, alpha):\n        \"\"\"One dimensional power law derivative with respect to parameters\"\"\"\n\n        xx = x / x_0\n\n        d_amplitude = xx ** (-alpha)\n        d_x_0 = amplitude * alpha * d_amplitude / x_0\n        d_alpha = -amplitude * d_amplitude * np.log(xx)\n\n        return [d_amplitude, d_x_0, d_alpha]\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass BrokenPowerLaw1D(Fittable1DModel):\n    \"\"\"\n    One dimensional power law model with a break.\n\n    Parameters\n    ----------\n    amplitude : float\n        Model amplitude at the break point.\n    x_break : float\n        Break point.\n    alpha_1 : float\n        Power law index for x < x_break.\n    alpha_2 : float\n        Power law index for x > x_break.\n\n    See Also\n    --------\n    PowerLaw1D, ExponentialCutoffPowerLaw1D, LogParabola1D\n\n    Notes\n    -----\n    Model formula (with :math:`A` for ``amplitude`` and :math:`\\\\alpha_1`\n    for ``alpha_1`` and :math:`\\\\alpha_2` for ``alpha_2``):\n\n        .. math::\n\n            f(x) = \\\\left \\\\{\n                     \\\\begin{array}{ll}\n                       A (x / x_{break}) ^ {-\\\\alpha_1} & : x < x_{break} \\\\\\\\\n                       A (x / x_{break}) ^ {-\\\\alpha_2} & :  x > x_{break} \\\\\\\\\n                     \\\\end{array}\n                   \\\\right.\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Peak value at break point\")\n    x_break = Parameter(default=1, description=\"Break point\")\n    alpha_1 = Parameter(default=1, description=\"Power law index before break point\")\n    alpha_2 = Parameter(default=1, description=\"Power law index after break point\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_break, alpha_1, alpha_2):\n        \"\"\"One dimensional broken power law model function\"\"\"\n\n        alpha = np.where(x < x_break, alpha_1, alpha_2)\n        xx = x / x_break\n        return amplitude * xx ** (-alpha)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, x_break, alpha_1, alpha_2):\n        \"\"\"One dimensional broken power law derivative with respect to parameters\"\"\"\n\n        alpha = np.where(x < x_break, alpha_1, alpha_2)\n        xx = x / x_break\n\n        d_amplitude = xx ** (-alpha)\n        d_x_break = amplitude * alpha * d_amplitude / x_break\n        d_alpha = -amplitude * d_amplitude * np.log(xx)\n        d_alpha_1 = np.where(x < x_break, d_alpha, 0)\n        d_alpha_2 = np.where(x >= x_break, d_alpha, 0)\n\n        return [d_amplitude, d_x_break, d_alpha_1, d_alpha_2]\n\n    @property\n    def input_units(self):\n        if self.x_break.unit is None:\n            return None\n        return {self.inputs[0]: self.x_break.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_break': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass SmoothlyBrokenPowerLaw1D(Fittable1DModel):\n    \"\"\"One dimensional smoothly broken power law model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Model amplitude at the break point.\n    x_break : float\n        Break point.\n    alpha_1 : float\n        Power law index for ``x << x_break``.\n    alpha_2 : float\n        Power law index for ``x >> x_break``.\n    delta : float\n        Smoothness parameter.\n\n    See Also\n    --------\n    BrokenPowerLaw1D\n\n    Notes\n    -----\n    Model formula (with :math:`A` for ``amplitude``, :math:`x_b` for\n    ``x_break``, :math:`\\\\alpha_1` for ``alpha_1``,\n    :math:`\\\\alpha_2` for ``alpha_2`` and :math:`\\\\Delta` for\n    ``delta``):\n\n        .. math::\n\n            f(x) = A \\\\left( \\\\frac{x}{x_b} \\\\right) ^ {-\\\\alpha_1}\n                   \\\\left\\\\{\n                      \\\\frac{1}{2}\n                      \\\\left[\n                        1 + \\\\left( \\\\frac{x}{x_b}\\\\right)^{1 / \\\\Delta}\n                      \\\\right]\n                   \\\\right\\\\}^{(\\\\alpha_1 - \\\\alpha_2) \\\\Delta}\n\n\n    The change of slope occurs between the values :math:`x_1`\n    and :math:`x_2` such that:\n\n        .. math::\n            \\\\log_{10} \\\\frac{x_2}{x_b} = \\\\log_{10} \\\\frac{x_b}{x_1}\n            \\\\sim \\\\Delta\n\n\n    At values :math:`x \\\\lesssim x_1` and :math:`x \\\\gtrsim x_2` the\n    model is approximately a simple power law with index\n    :math:`\\\\alpha_1` and :math:`\\\\alpha_2` respectively.  The two\n    power laws are smoothly joined at values :math:`x_1 < x < x_2`,\n    hence the :math:`\\\\Delta` parameter sets the \"smoothness\" of the\n    slope change.\n\n    The ``delta`` parameter is bounded to values greater than 1e-3\n    (corresponding to :math:`x_2 / x_1 \\\\gtrsim 1.002`) to avoid\n    overflow errors.\n\n    The ``amplitude`` parameter is bounded to positive values since\n    this model is typically used to represent positive quantities.\n\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n        from astropy.modeling import models\n\n        x = np.logspace(0.7, 2.3, 500)\n        f = models.SmoothlyBrokenPowerLaw1D(amplitude=1, x_break=20,\n                                            alpha_1=-2, alpha_2=2)\n\n        plt.figure()\n        plt.title(\"amplitude=1, x_break=20, alpha_1=-2, alpha_2=2\")\n\n        f.delta = 0.5\n        plt.loglog(x, f(x), '--', label='delta=0.5')\n\n        f.delta = 0.3\n        plt.loglog(x, f(x), '-.', label='delta=0.3')\n\n        f.delta = 0.1\n        plt.loglog(x, f(x), label='delta=0.1')\n\n        plt.axis([x.min(), x.max(), 0.1, 1.1])\n        plt.legend(loc='lower center')\n        plt.grid(True)\n        plt.show()\n\n    \"\"\"\n\n    amplitude = Parameter(default=1, min=0, description=\"Peak value at break point\")\n    x_break = Parameter(default=1, description=\"Break point\")\n    alpha_1 = Parameter(default=-2, description=\"Power law index before break point\")\n    alpha_2 = Parameter(default=2, description=\"Power law index after break point\")\n    delta = Parameter(default=1, min=1.e-3, description=\"Smoothness Parameter\")\n\n    @amplitude.validator\n    def amplitude(self, value):\n        if np.any(value <= 0):\n            raise InputParameterError(\n                \"amplitude parameter must be > 0\")\n\n    @delta.validator\n    def delta(self, value):\n        if np.any(value < 0.001):\n            raise InputParameterError(\n                \"delta parameter must be >= 0.001\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_break, alpha_1, alpha_2, delta):\n        \"\"\"One dimensional smoothly broken power law model function\"\"\"\n\n        # Pre-calculate `x/x_b`\n        xx = x / x_break\n\n        # Initialize the return value\n        f = np.zeros_like(xx, subok=False)\n\n        if isinstance(amplitude, Quantity):\n            return_unit = amplitude.unit\n            amplitude = amplitude.value\n        else:\n            return_unit = None\n\n        # The quantity `t = (x / x_b)^(1 / delta)` can become quite\n        # large.  To avoid overflow errors we will start by calculating\n        # its natural logarithm:\n        logt = np.log(xx) / delta\n\n        # When `t >> 1` or `t << 1` we don't actually need to compute\n        # the `t` value since the main formula (see docstring) can be\n        # significantly simplified by neglecting `1` or `t`\n        # respectively.  In the following we will check whether `t` is\n        # much greater, much smaller, or comparable to 1 by comparing\n        # the `logt` value with an appropriate threshold.\n        threshold = 30  # corresponding to exp(30) ~ 1e13\n        i = logt > threshold\n        if i.max():\n            # In this case the main formula reduces to a simple power\n            # law with index `alpha_2`.\n            f[i] = amplitude * xx[i] ** (-alpha_2) \\\n                   / (2. ** ((alpha_1 - alpha_2) * delta))\n\n        i = logt < -threshold\n        if i.max():\n            # In this case the main formula reduces to a simple power\n            # law with index `alpha_1`.\n            f[i] = amplitude * xx[i] ** (-alpha_1) \\\n                   / (2. ** ((alpha_1 - alpha_2) * delta))\n\n        i = np.abs(logt) <= threshold\n        if i.max():\n            # In this case the `t` value is \"comparable\" to 1, hence we\n            # we will evaluate the whole formula.\n            t = np.exp(logt[i])\n            r = (1. + t) / 2.\n            f[i] = amplitude * xx[i] ** (-alpha_1) \\\n                   * r ** ((alpha_1 - alpha_2) * delta)\n\n        if return_unit:\n            return Quantity(f, unit=return_unit, copy=False)\n        return f\n\n    @staticmethod\n    def fit_deriv(x, amplitude, x_break, alpha_1, alpha_2, delta):\n        \"\"\"One dimensional smoothly broken power law derivative with respect\n           to parameters\"\"\"\n\n        # Pre-calculate `x_b` and `x/x_b` and `logt` (see comments in\n        # SmoothlyBrokenPowerLaw1D.evaluate)\n        xx = x / x_break\n        logt = np.log(xx) / delta\n\n        # Initialize the return values\n        f = np.zeros_like(xx)\n        d_amplitude = np.zeros_like(xx)\n        d_x_break = np.zeros_like(xx)\n        d_alpha_1 = np.zeros_like(xx)\n        d_alpha_2 = np.zeros_like(xx)\n        d_delta = np.zeros_like(xx)\n\n        threshold = 30  # (see comments in SmoothlyBrokenPowerLaw1D.evaluate)\n        i = logt > threshold\n        if i.max():\n            f[i] = amplitude * xx[i] ** (-alpha_2) \\\n                   / (2. ** ((alpha_1 - alpha_2) * delta))\n\n            d_amplitude[i] = f[i] / amplitude\n            d_x_break[i] = f[i] * alpha_2 / x_break\n            d_alpha_1[i] = f[i] * (-delta * np.log(2))\n            d_alpha_2[i] = f[i] * (-np.log(xx[i]) + delta * np.log(2))\n            d_delta[i] = f[i] * (-(alpha_1 - alpha_2) * np.log(2))\n\n        i = logt < -threshold\n        if i.max():\n            f[i] = amplitude * xx[i] ** (-alpha_1) \\\n                   / (2. ** ((alpha_1 - alpha_2) * delta))\n\n            d_amplitude[i] = f[i] / amplitude\n            d_x_break[i] = f[i] * alpha_1 / x_break\n            d_alpha_1[i] = f[i] * (-np.log(xx[i]) - delta * np.log(2))\n            d_alpha_2[i] = f[i] * delta * np.log(2)\n            d_delta[i] = f[i] * (-(alpha_1 - alpha_2) * np.log(2))\n\n        i = np.abs(logt) <= threshold\n        if i.max():\n            t = np.exp(logt[i])\n            r = (1. + t) / 2.\n            f[i] = amplitude * xx[i] ** (-alpha_1) \\\n                   * r ** ((alpha_1 - alpha_2) * delta)\n\n            d_amplitude[i] = f[i] / amplitude\n            d_x_break[i] = f[i] * (alpha_1 - (alpha_1 - alpha_2) * t / 2. / r) / x_break\n            d_alpha_1[i] = f[i] * (-np.log(xx[i]) + delta * np.log(r))\n            d_alpha_2[i] = f[i] * (-delta * np.log(r))\n            d_delta[i] = f[i] * (alpha_1 - alpha_2) \\\n                         * (np.log(r) - t / (1. + t) / delta * np.log(xx[i]))\n\n        return [d_amplitude, d_x_break, d_alpha_1, d_alpha_2, d_delta]\n\n    @property\n    def input_units(self):\n        if self.x_break.unit is None:\n            return None\n        return {self.inputs[0]: self.x_break.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_break': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass ExponentialCutoffPowerLaw1D(Fittable1DModel):\n    \"\"\"\n    One dimensional power law model with an exponential cutoff.\n\n    Parameters\n    ----------\n    amplitude : float\n        Model amplitude\n    x_0 : float\n        Reference point\n    alpha : float\n        Power law index\n    x_cutoff : float\n        Cutoff point\n\n    See Also\n    --------\n    PowerLaw1D, BrokenPowerLaw1D, LogParabola1D\n\n    Notes\n    -----\n    Model formula (with :math:`A` for ``amplitude`` and :math:`\\\\alpha` for ``alpha``):\n\n        .. math:: f(x) = A (x / x_0) ^ {-\\\\alpha} \\\\exp (-x / x_{cutoff})\n\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Peak value of model\")\n    x_0 = Parameter(default=1, description=\"Reference point\")\n    alpha = Parameter(default=1, description=\"Power law index\")\n    x_cutoff = Parameter(default=1, description=\"Cutoff point\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, alpha, x_cutoff):\n        \"\"\"One dimensional exponential cutoff power law model function\"\"\"\n\n        xx = x / x_0\n        return amplitude * xx ** (-alpha) * np.exp(-x / x_cutoff)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, x_0, alpha, x_cutoff):\n        \"\"\"One dimensional exponential cutoff power law derivative with respect to parameters\"\"\"\n\n        xx = x / x_0\n        xc = x / x_cutoff\n\n        d_amplitude = xx ** (-alpha) * np.exp(-xc)\n        d_x_0 = alpha * amplitude * d_amplitude / x_0\n        d_alpha = -amplitude * d_amplitude * np.log(xx)\n        d_x_cutoff = amplitude * x * d_amplitude / x_cutoff ** 2\n\n        return [d_amplitude, d_x_0, d_alpha, d_x_cutoff]\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'x_cutoff': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass LogParabola1D(Fittable1DModel):\n    \"\"\"\n    One dimensional log parabola model (sometimes called curved power law).\n\n    Parameters\n    ----------\n    amplitude : float\n        Model amplitude\n    x_0 : float\n        Reference point\n    alpha : float\n        Power law index\n    beta : float\n        Power law curvature\n\n    See Also\n    --------\n    PowerLaw1D, BrokenPowerLaw1D, ExponentialCutoffPowerLaw1D\n\n    Notes\n    -----\n    Model formula (with :math:`A` for ``amplitude`` and :math:`\\\\alpha` for ``alpha`` and :math:`\\\\beta` for ``beta``):\n\n        .. math:: f(x) = A \\\\left(\\\\frac{x}{x_{0}}\\\\right)^{- \\\\alpha - \\\\beta \\\\log{\\\\left (\\\\frac{x}{x_{0}} \\\\right )}}\n\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Peak value of model\")\n    x_0 = Parameter(default=1, description=\"Reference point\")\n    alpha = Parameter(default=1, description=\"Power law index\")\n    beta = Parameter(default=0, description=\"Power law curvature\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, alpha, beta):\n        \"\"\"One dimensional log parabola model function\"\"\"\n\n        xx = x / x_0\n        exponent = -alpha - beta * np.log(xx)\n        return amplitude * xx ** exponent\n\n    @staticmethod\n    def fit_deriv(x, amplitude, x_0, alpha, beta):\n        \"\"\"One dimensional log parabola derivative with respect to parameters\"\"\"\n\n        xx = x / x_0\n        log_xx = np.log(xx)\n        exponent = -alpha - beta * log_xx\n\n        d_amplitude = xx ** exponent\n        d_beta = -amplitude * d_amplitude * log_xx ** 2\n        d_x_0 = amplitude * d_amplitude * (beta * log_xx / x_0 - exponent / x_0)\n        d_alpha = -amplitude * d_amplitude * log_xx\n        return [d_amplitude, d_x_0, d_alpha, d_beta]\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":1335,"id":12618,"name":"list_values","nodeType":"Attribute","startLoc":1335,"text":"self.list_values"},{"attributeType":"null","col":8,"comment":"null","endLoc":96,"id":12619,"name":"axes_order","nodeType":"Attribute","startLoc":96,"text":"self.axes_order"},{"attributeType":"null","col":8,"comment":"null","endLoc":1341,"id":12620,"name":"default_encoding","nodeType":"Attribute","startLoc":1341,"text":"self.default_encoding"},{"attributeType":"null","col":8,"comment":"null","endLoc":1347,"id":12621,"name":"initial_comment","nodeType":"Attribute","startLoc":1347,"text":"self.initial_comment"},{"attributeType":"null","col":8,"comment":"null","endLoc":1338,"id":12622,"name":"stringify","nodeType":"Attribute","startLoc":1338,"text":"self.stringify"},{"attributeType":"null","col":8,"comment":"null","endLoc":1186,"id":12623,"name":"_inspec","nodeType":"Attribute","startLoc":1186,"text":"self._inspec"},{"className":"SphericalRotationSequence","col":0,"comment":"\n    Perform a sequence of rotations about arbitrary number of axes\n    in spherical coordinates.\n\n    Parameters\n    ----------\n    angles : list\n        A sequence of angles (in deg).\n    axes_order : str\n        A sequence of characters ('x', 'y', or 'z') corresponding to the\n        axis of rotation and matching the order in ``angles``.\n\n    ","endLoc":159,"id":12624,"nodeType":"Class","startLoc":126,"text":"class SphericalRotationSequence(RotationSequence3D):\n    \"\"\"\n    Perform a sequence of rotations about arbitrary number of axes\n    in spherical coordinates.\n\n    Parameters\n    ----------\n    angles : list\n        A sequence of angles (in deg).\n    axes_order : str\n        A sequence of characters ('x', 'y', or 'z') corresponding to the\n        axis of rotation and matching the order in ``angles``.\n\n    \"\"\"\n    def __init__(self, angles, axes_order, name=None, **kwargs):\n        self._n_inputs = 2\n        self._n_outputs = 2\n        super().__init__(angles, axes_order=axes_order, name=name, **kwargs)\n        self._inputs = (\"lon\", \"lat\")\n        self._outputs = (\"lon\", \"lat\")\n\n    @property\n    def n_inputs(self):\n        return self._n_inputs\n\n    @property\n    def n_outputs(self):\n        return self._n_outputs\n\n    def evaluate(self, lon, lat, angles):\n        x, y, z = spherical2cartesian(lon, lat)\n        x1, y1, z1 = super().evaluate(x, y, z, angles)\n        lon, lat = cartesian2spherical(x1, y1, z1)\n        return lon, lat"},{"className":"SimpleVal","col":0,"comment":"\n    A simple validator.\n    Can be used to check that all members expected are present.\n\n    To use it, provide a configspec with all your members in (the value given\n    will be ignored). Pass an instance of ``SimpleVal`` to the ``validate``\n    method of your ``ConfigObj``. ``validate`` will return ``True`` if all\n    members are present, or a dictionary with True/False meaning\n    present/missing. (Whole missing sections will be replaced with ``False``)\n    ","endLoc":2387,"id":12625,"nodeType":"Class","startLoc":2368,"text":"class SimpleVal(object):\n    \"\"\"\n    A simple validator.\n    Can be used to check that all members expected are present.\n\n    To use it, provide a configspec with all your members in (the value given\n    will be ignored). Pass an instance of ``SimpleVal`` to the ``validate``\n    method of your ``ConfigObj``. ``validate`` will return ``True`` if all\n    members are present, or a dictionary with True/False meaning\n    present/missing. (Whole missing sections will be replaced with ``False``)\n    \"\"\"\n\n    def __init__(self):\n        self.baseErrorClass = ConfigObjError\n\n    def check(self, check, member, missing=False):\n        \"\"\"A dummy check method, always returns the value unchanged.\"\"\"\n        if missing:\n            raise self.baseErrorClass()\n        return member"},{"col":4,"comment":"null","endLoc":2381,"header":"def __init__(self)","id":12626,"name":"__init__","nodeType":"Function","startLoc":2380,"text":"def __init__(self):\n        self.baseErrorClass = ConfigObjError"},{"col":4,"comment":"A dummy check method, always returns the value unchanged.","endLoc":2387,"header":"def check(self, check, member, missing=False)","id":12627,"name":"check","nodeType":"Function","startLoc":2383,"text":"def check(self, check, member, missing=False):\n        \"\"\"A dummy check method, always returns the value unchanged.\"\"\"\n        if missing:\n            raise self.baseErrorClass()\n        return member"},{"col":4,"comment":"null","endLoc":145,"header":"def __init__(self, angles, axes_order, name=None, **kwargs)","id":12628,"name":"__init__","nodeType":"Function","startLoc":140,"text":"def __init__(self, angles, axes_order, name=None, **kwargs):\n        self._n_inputs = 2\n        self._n_outputs = 2\n        super().__init__(angles, axes_order=axes_order, name=name, **kwargs)\n        self._inputs = (\"lon\", \"lat\")\n        self._outputs = (\"lon\", \"lat\")"},{"attributeType":"ConfigObjError","col":8,"comment":"null","endLoc":2381,"id":12629,"name":"baseErrorClass","nodeType":"Attribute","startLoc":2381,"text":"self.baseErrorClass"},{"col":0,"comment":"null","endLoc":132,"header":"def getObj(s)","id":12630,"name":"getObj","nodeType":"Function","startLoc":126,"text":"def getObj(s):\n    global compiler\n    if compiler is None:\n        import compiler\n    s = \"a=\" + s\n    p = compiler.parse(s)\n    return p.getChildren()[1].getChildren()[0].getChildren()[1]"},{"className":"PowerLaw1D","col":0,"comment":"\n    One dimensional power law model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Model amplitude at the reference point\n    x_0 : float\n        Reference point\n    alpha : float\n        Power law index\n\n    See Also\n    --------\n    BrokenPowerLaw1D, ExponentialCutoffPowerLaw1D, LogParabola1D\n\n    Notes\n    -----\n    Model formula (with :math:`A` for ``amplitude`` and :math:`\\alpha` for ``alpha``):\n\n        .. math:: f(x) = A (x / x_0) ^ {-\\alpha}\n\n    ","endLoc":72,"id":12631,"nodeType":"Class","startLoc":17,"text":"class PowerLaw1D(Fittable1DModel):\n    \"\"\"\n    One dimensional power law model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Model amplitude at the reference point\n    x_0 : float\n        Reference point\n    alpha : float\n        Power law index\n\n    See Also\n    --------\n    BrokenPowerLaw1D, ExponentialCutoffPowerLaw1D, LogParabola1D\n\n    Notes\n    -----\n    Model formula (with :math:`A` for ``amplitude`` and :math:`\\\\alpha` for ``alpha``):\n\n        .. math:: f(x) = A (x / x_0) ^ {-\\\\alpha}\n\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Peak value at the reference point\")\n    x_0 = Parameter(default=1, description=\"Reference point\")\n    alpha = Parameter(default=1, description=\"Power law index\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, alpha):\n        \"\"\"One dimensional power law model function\"\"\"\n        xx = x / x_0\n        return amplitude * xx ** (-alpha)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, x_0, alpha):\n        \"\"\"One dimensional power law derivative with respect to parameters\"\"\"\n\n        xx = x / x_0\n\n        d_amplitude = xx ** (-alpha)\n        d_x_0 = amplitude * alpha * d_amplitude / x_0\n        d_alpha = -amplitude * d_amplitude * np.log(xx)\n\n        return [d_amplitude, d_x_0, d_alpha]\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":8,"comment":"null","endLoc":2945,"id":12632,"name":"grammar","nodeType":"Attribute","startLoc":2945,"text":"self.grammar"},{"col":4,"comment":"null","endLoc":149,"header":"@property\n    def n_inputs(self)","id":12633,"name":"n_inputs","nodeType":"Function","startLoc":147,"text":"@property\n    def n_inputs(self):\n        return self._n_inputs"},{"col":4,"comment":"null","endLoc":153,"header":"@property\n    def n_outputs(self)","id":12634,"name":"n_outputs","nodeType":"Function","startLoc":151,"text":"@property\n    def n_outputs(self):\n        return self._n_outputs"},{"col":4,"comment":"null","endLoc":159,"header":"def evaluate(self, lon, lat, angles)","id":12635,"name":"evaluate","nodeType":"Function","startLoc":155,"text":"def evaluate(self, lon, lat, angles):\n        x, y, z = spherical2cartesian(lon, lat)\n        x1, y1, z1 = super().evaluate(x, y, z, angles)\n        lon, lat = cartesian2spherical(x1, y1, z1)\n        return lon, lat"},{"col":0,"comment":"null","endLoc":454,"header":"def __newobj__(cls, *args)","id":12636,"name":"__newobj__","nodeType":"Function","startLoc":452,"text":"def __newobj__(cls, *args):\n    # Hack for pickle\n    return cls.__new__(cls, *args)"},{"col":0,"comment":"\n    An example function that will turn a nested dictionary of results\n    (as returned by ``ConfigObj.validate``) into a flat list.\n\n    ``cfg`` is the ConfigObj instance being checked, ``res`` is the results\n    dictionary returned by ``validate``.\n\n    (This is a recursive function, so you shouldn't use the ``levels`` or\n    ``results`` arguments - they are used by the function.)\n\n    Returns a list of keys that failed. Each member of the list is a tuple::\n\n        ([list of sections...], key, result)\n\n    If ``validate`` was called with ``preserve_errors=False`` (the default)\n    then ``result`` will always be ``False``.\n\n    *list of sections* is a flattened list of sections that the key was found\n    in.\n\n    If the section was missing (or a section was expected and a scalar provided\n    - or vice-versa) then key will be ``None``.\n\n    If the value (or section) was missing then ``result`` will be ``False``.\n\n    If ``validate`` was called with ``preserve_errors=True`` and a value\n    was present, but failed the check, then ``result`` will be the exception\n    object returned. You can use this as a string that describes the failure.\n\n    For example *The value \"3\" is of the wrong type*.\n    ","endLoc":2447,"header":"def flatten_errors(cfg, res, levels=None, results=None)","id":12637,"name":"flatten_errors","nodeType":"Function","startLoc":2390,"text":"def flatten_errors(cfg, res, levels=None, results=None):\n    \"\"\"\n    An example function that will turn a nested dictionary of results\n    (as returned by ``ConfigObj.validate``) into a flat list.\n\n    ``cfg`` is the ConfigObj instance being checked, ``res`` is the results\n    dictionary returned by ``validate``.\n\n    (This is a recursive function, so you shouldn't use the ``levels`` or\n    ``results`` arguments - they are used by the function.)\n\n    Returns a list of keys that failed. Each member of the list is a tuple::\n\n        ([list of sections...], key, result)\n\n    If ``validate`` was called with ``preserve_errors=False`` (the default)\n    then ``result`` will always be ``False``.\n\n    *list of sections* is a flattened list of sections that the key was found\n    in.\n\n    If the section was missing (or a section was expected and a scalar provided\n    - or vice-versa) then key will be ``None``.\n\n    If the value (or section) was missing then ``result`` will be ``False``.\n\n    If ``validate`` was called with ``preserve_errors=True`` and a value\n    was present, but failed the check, then ``result`` will be the exception\n    object returned. You can use this as a string that describes the failure.\n\n    For example *The value \"3\" is of the wrong type*.\n    \"\"\"\n    if levels is None:\n        # first time called\n        levels = []\n        results = []\n    if res == True:\n        return sorted(results)\n    if res == False or isinstance(res, Exception):\n        results.append((levels[:], None, res))\n        if levels:\n            levels.pop()\n        return sorted(results)\n    for (key, val) in list(res.items()):\n        if val == True:\n            continue\n        if isinstance(cfg.get(key), Mapping):\n            # Go down one level\n            levels.append(key)\n            flatten_errors(cfg[key], val, levels, results)\n            continue\n        results.append((levels[:], key, val))\n    #\n    # Go up one level\n    if levels:\n        levels.pop()\n    #\n    return sorted(results)"},{"col":0,"comment":"null","endLoc":54,"header":"def spherical2cartesian(alpha, delta)","id":12638,"name":"spherical2cartesian","nodeType":"Function","startLoc":48,"text":"def spherical2cartesian(alpha, delta):\n    alpha = np.deg2rad(alpha)\n    delta = np.deg2rad(delta)\n    x = np.cos(alpha) * np.cos(delta)\n    y = np.cos(delta) * np.sin(alpha)\n    z = np.sin(delta)\n    return np.array([x, y, z])"},{"col":0,"comment":"null","endLoc":61,"header":"def cartesian2spherical(x, y, z)","id":12639,"name":"cartesian2spherical","nodeType":"Function","startLoc":57,"text":"def cartesian2spherical(x, y, z):\n    h = np.hypot(x, y)\n    alpha = np.rad2deg(np.arctan2(y, x))\n    delta = np.rad2deg(np.arctan2(z, h))\n    return alpha, delta"},{"attributeType":"null","col":8,"comment":"null","endLoc":145,"id":12640,"name":"_outputs","nodeType":"Attribute","startLoc":145,"text":"self._outputs"},{"col":0,"comment":"\n    Find all the values and sections not in the configspec from a validated\n    ConfigObj.\n\n    ``get_extra_values`` returns a list of tuples where each tuple represents\n    either an extra section, or an extra value.\n\n    The tuples contain two values, a tuple representing the section the value\n    is in and the name of the extra values. For extra values in the top level\n    section the first member will be an empty tuple. For values in the 'foo'\n    section the first member will be ``('foo',)``. For members in the 'bar'\n    subsection of the 'foo' section the first member will be ``('foo', 'bar')``.\n\n    NOTE: If you call ``get_extra_values`` on a ConfigObj instance that hasn't\n    been validated it will return an empty list.\n    ","endLoc":2473,"header":"def get_extra_values(conf, _prepend=())","id":12641,"name":"get_extra_values","nodeType":"Function","startLoc":2450,"text":"def get_extra_values(conf, _prepend=()):\n    \"\"\"\n    Find all the values and sections not in the configspec from a validated\n    ConfigObj.\n\n    ``get_extra_values`` returns a list of tuples where each tuple represents\n    either an extra section, or an extra value.\n\n    The tuples contain two values, a tuple representing the section the value\n    is in and the name of the extra values. For extra values in the top level\n    section the first member will be an empty tuple. For values in the 'foo'\n    section the first member will be ``('foo',)``. For members in the 'bar'\n    subsection of the 'foo' section the first member will be ``('foo', 'bar')``.\n\n    NOTE: If you call ``get_extra_values`` on a ConfigObj instance that hasn't\n    been validated it will return an empty list.\n    \"\"\"\n    out = []\n\n    out.extend([(_prepend, name) for name in conf.extra_values])\n    for name in conf.sections:\n        if name not in conf.extra_values:\n            out.extend(get_extra_values(conf[name], _prepend + (name,)))\n    return out"},{"attributeType":"null","col":8,"comment":"null","endLoc":144,"id":12642,"name":"_inputs","nodeType":"Attribute","startLoc":144,"text":"self._inputs"},{"attributeType":"None","col":0,"comment":"null","endLoc":24,"id":12643,"name":"compiler","nodeType":"Attribute","startLoc":24,"text":"compiler"},{"attributeType":"null","col":0,"comment":"null","endLoc":29,"id":12644,"name":"BOMS","nodeType":"Attribute","startLoc":29,"text":"BOMS"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":12645,"name":"BOM_LIST","nodeType":"Attribute","startLoc":38,"text":"BOM_LIST"},{"attributeType":"null","col":0,"comment":"null","endLoc":57,"id":12646,"name":"BOM_SET","nodeType":"Attribute","startLoc":57,"text":"BOM_SET"},{"attributeType":"null","col":0,"comment":"null","endLoc":71,"id":12647,"name":"squot","nodeType":"Attribute","startLoc":71,"text":"squot"},{"attributeType":"null","col":0,"comment":"null","endLoc":72,"id":12648,"name":"dquot","nodeType":"Attribute","startLoc":72,"text":"dquot"},{"attributeType":"null","col":0,"comment":"null","endLoc":73,"id":12649,"name":"noquot","nodeType":"Attribute","startLoc":73,"text":"noquot"},{"attributeType":"null","col":0,"comment":"null","endLoc":74,"id":12650,"name":"wspace_plus","nodeType":"Attribute","startLoc":74,"text":"wspace_plus"},{"attributeType":"null","col":8,"comment":"null","endLoc":142,"id":12651,"name":"_n_outputs","nodeType":"Attribute","startLoc":142,"text":"self._n_outputs"},{"attributeType":"null","col":0,"comment":"null","endLoc":75,"id":12652,"name":"tsquot","nodeType":"Attribute","startLoc":75,"text":"tsquot"},{"attributeType":"null","col":0,"comment":"null","endLoc":76,"id":12653,"name":"tdquot","nodeType":"Attribute","startLoc":76,"text":"tdquot"},{"attributeType":"null","col":0,"comment":"null","endLoc":79,"id":12654,"name":"MISSING","nodeType":"Attribute","startLoc":79,"text":"MISSING"},{"attributeType":"null","col":8,"comment":"null","endLoc":141,"id":12655,"name":"_n_inputs","nodeType":"Attribute","startLoc":141,"text":"self._n_inputs"},{"attributeType":"null","col":0,"comment":"null","endLoc":81,"id":12656,"name":"__all__","nodeType":"Attribute","startLoc":81,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":102,"id":12657,"name":"DEFAULT_INTERPOLATION","nodeType":"Attribute","startLoc":102,"text":"DEFAULT_INTERPOLATION"},{"attributeType":"null","col":0,"comment":"null","endLoc":103,"id":12658,"name":"DEFAULT_INDENT_TYPE","nodeType":"Attribute","startLoc":103,"text":"DEFAULT_INDENT_TYPE"},{"attributeType":"null","col":0,"comment":"null","endLoc":104,"id":12659,"name":"MAX_INTERPOL_DEPTH","nodeType":"Attribute","startLoc":104,"text":"MAX_INTERPOL_DEPTH"},{"className":"_EulerRotation","col":0,"comment":"\n    Base class which does the actual computation.\n    ","endLoc":198,"id":12660,"nodeType":"Class","startLoc":162,"text":"class _EulerRotation:\n    \"\"\"\n    Base class which does the actual computation.\n    \"\"\"\n\n    _separable = False\n\n    def evaluate(self, alpha, delta, phi, theta, psi, axes_order):\n        shape = None\n        if isinstance(alpha, np.ndarray):\n            alpha = alpha.flatten()\n            delta = delta.flatten()\n            shape = alpha.shape\n        inp = spherical2cartesian(alpha, delta)\n        matrix = _create_matrix([phi, theta, psi], axes_order)\n        result = np.dot(matrix, inp)\n        a, b = cartesian2spherical(*result)\n        if shape is not None:\n            a.shape = shape\n            b.shape = shape\n        return a, b\n\n    _input_units_strict = True\n\n    _input_units_allow_dimensionless = True\n\n    @property\n    def input_units(self):\n        \"\"\" Input units. \"\"\"\n        return {self.inputs[0]: u.deg,\n                self.inputs[1]: u.deg}\n\n    @property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {self.outputs[0]: u.deg,\n                self.outputs[1]: u.deg}"},{"col":4,"comment":"null","endLoc":182,"header":"def evaluate(self, alpha, delta, phi, theta, psi, axes_order)","id":12661,"name":"evaluate","nodeType":"Function","startLoc":169,"text":"def evaluate(self, alpha, delta, phi, theta, psi, axes_order):\n        shape = None\n        if isinstance(alpha, np.ndarray):\n            alpha = alpha.flatten()\n            delta = delta.flatten()\n            shape = alpha.shape\n        inp = spherical2cartesian(alpha, delta)\n        matrix = _create_matrix([phi, theta, psi], axes_order)\n        result = np.dot(matrix, inp)\n        a, b = cartesian2spherical(*result)\n        if shape is not None:\n            a.shape = shape\n            b.shape = shape\n        return a, b"},{"attributeType":"null","col":0,"comment":"null","endLoc":106,"id":12662,"name":"OPTION_DEFAULTS","nodeType":"Attribute","startLoc":106,"text":"OPTION_DEFAULTS"},{"attributeType":"Builder","col":0,"comment":"null","endLoc":194,"id":12663,"name":"_builder","nodeType":"Attribute","startLoc":194,"text":"_builder"},{"attributeType":"null","col":0,"comment":"null","endLoc":446,"id":12664,"name":"interpolation_engines","nodeType":"Attribute","startLoc":446,"text":"interpolation_engines"},{"col":0,"comment":"","endLoc":16,"header":"configobj.py#<anonymous>","id":12665,"name":"<anonymous>","nodeType":"Function","startLoc":16,"text":"compiler = None\n\nBOMS = {\n    BOM_UTF8: ('utf_8', None),\n    BOM_UTF16_BE: ('utf16_be', 'utf_16'),\n    BOM_UTF16_LE: ('utf16_le', 'utf_16'),\n    BOM_UTF16: ('utf_16', 'utf_16'),\n    }\n\nBOM_LIST = {\n    'utf_16': 'utf_16',\n    'u16': 'utf_16',\n    'utf16': 'utf_16',\n    'utf-16': 'utf_16',\n    'utf16_be': 'utf16_be',\n    'utf_16_be': 'utf16_be',\n    'utf-16be': 'utf16_be',\n    'utf16_le': 'utf16_le',\n    'utf_16_le': 'utf16_le',\n    'utf-16le': 'utf16_le',\n    'utf_8': 'utf_8',\n    'u8': 'utf_8',\n    'utf': 'utf_8',\n    'utf8': 'utf_8',\n    'utf-8': 'utf_8',\n    }\n\nBOM_SET = {\n    'utf_8': BOM_UTF8,\n    'utf_16': BOM_UTF16,\n    'utf16_be': BOM_UTF16_BE,\n    'utf16_le': BOM_UTF16_LE,\n    None: BOM_UTF8\n    }\n\nsquot = \"'%s'\"\n\ndquot = '\"%s\"'\n\nnoquot = \"%s\"\n\nwspace_plus = ' \\r\\n\\v\\t\\'\"'\n\ntsquot = '\"\"\"%s\"\"\"'\n\ntdquot = \"'''%s'''\"\n\nMISSING = object()\n\n__all__ = (\n    'DEFAULT_INDENT_TYPE',\n    'DEFAULT_INTERPOLATION',\n    'ConfigObjError',\n    'NestingError',\n    'ParseError',\n    'DuplicateError',\n    'ConfigspecError',\n    'ConfigObj',\n    'SimpleVal',\n    'InterpolationError',\n    'InterpolationLoopError',\n    'MissingInterpolationOption',\n    'RepeatSectionError',\n    'ReloadError',\n    'UnreprError',\n    'UnknownType',\n    'flatten_errors',\n    'get_extra_values'\n)\n\nDEFAULT_INTERPOLATION = 'configparser'\n\nDEFAULT_INDENT_TYPE = '    '\n\nMAX_INTERPOL_DEPTH = 10\n\nOPTION_DEFAULTS = {\n    'interpolation': True,\n    'raise_errors': False,\n    'list_values': True,\n    'create_empty': False,\n    'file_error': False,\n    'configspec': None,\n    'stringify': True,\n    # option may be set to one of ('', ' ', '\\t')\n    'indent_type': None,\n    'encoding': None,\n    'default_encoding': None,\n    'unrepr': False,\n    'write_empty_values': False,\n}\n\n_builder = Builder()\n\ninterpolation_engines = {\n    'configparser': ConfigParserInterpolation,\n    'template': TemplateInterpolation,\n}\n\n\"\"\"*A programming language is a medium of expression.* - Paul Graham\"\"\""},{"fileName":"models.py","filePath":"astropy/modeling","id":12666,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nCreates a common namespace for all pre-defined models.\n\"\"\"\n\n# pylint: disable=unused-wildcard-import, unused-import, wildcard-import\n\nfrom .core import custom_model, hide_inverse, fix_inputs # pylint: disable=W0611\nfrom .mappings import *\nfrom .projections import *\nfrom .rotations import *\nfrom .polynomial import *\nfrom .functional_models import *\nfrom .physical_models import *\nfrom .powerlaws import *\nfrom .spline import *\nfrom .tabular import *\nfrom . import math_functions as math\n\n\n# Attach a docstring explaining constraints to all models which support them.\n# Note: add new models to this list\n\nCONSTRAINTS_DOC = \"\"\"\n    Other Parameters\n    ----------------\n    fixed : a dict, optional\n        A dictionary ``{parameter_name: boolean}`` of parameters to not be\n        varied during fitting. True means the parameter is held fixed.\n        Alternatively the `~astropy.modeling.Parameter.fixed`\n        property of a parameter may be used.\n    tied : dict, optional\n        A dictionary ``{parameter_name: callable}`` of parameters which are\n        linked to some other parameter. The dictionary values are callables\n        providing the linking relationship.  Alternatively the\n        `~astropy.modeling.Parameter.tied` property of a parameter\n        may be used.\n    bounds : dict, optional\n        A dictionary ``{parameter_name: value}`` of lower and upper bounds of\n        parameters. Keys are parameter names. Values are a list or a tuple\n        of length 2 giving the desired range for the parameter.\n        Alternatively, the\n        `~astropy.modeling.Parameter.min` and\n        `~astropy.modeling.Parameter.max` properties of a parameter\n        may be used.\n    eqcons : list, optional\n        A list of functions of length ``n`` such that ``eqcons[j](x0,*args) ==\n        0.0`` in a successfully optimized problem.\n    ineqcons : list, optional\n        A list of functions of length ``n`` such that ``ieqcons[j](x0,*args) >=\n        0.0`` is a successfully optimized problem.\n\"\"\"\n\n\nMODELS_WITH_CONSTRAINTS = [\n    AiryDisk2D, Moffat1D, Moffat2D, Box1D, Box2D,\n    Const1D, Const2D, Ellipse2D, Disk2D,\n    Gaussian1D, Gaussian2D,\n    Linear1D, Lorentz1D, RickerWavelet1D, RickerWavelet2D,\n    PowerLaw1D, Sersic1D, Sersic2D,\n    Sine1D, Cosine1D, Tangent1D, ArcSine1D, ArcCosine1D, ArcTangent1D,\n    Trapezoid1D, TrapezoidDisk2D,\n    Chebyshev1D, Chebyshev2D, Hermite1D, Hermite2D, Legendre2D, Legendre1D,\n    Polynomial1D, Polynomial2D, Voigt1D, KingProjectedAnalytic1D,\n    NFW\n]\n\n\nfor item in MODELS_WITH_CONSTRAINTS:\n    if isinstance(item.__doc__, str):\n        item.__doc__ += CONSTRAINTS_DOC\n"},{"col":4,"comment":" Input units. ","endLoc":192,"header":"@property\n    def input_units(self)","id":12667,"name":"input_units","nodeType":"Function","startLoc":188,"text":"@property\n    def input_units(self):\n        \"\"\" Input units. \"\"\"\n        return {self.inputs[0]: u.deg,\n                self.inputs[1]: u.deg}"},{"col":4,"comment":" Output units. ","endLoc":198,"header":"@property\n    def return_units(self)","id":12668,"name":"return_units","nodeType":"Function","startLoc":194,"text":"@property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {self.outputs[0]: u.deg,\n                self.outputs[1]: u.deg}"},{"attributeType":"null","col":4,"comment":"null","endLoc":167,"id":12669,"name":"_separable","nodeType":"Attribute","startLoc":167,"text":"_separable"},{"attributeType":"null","col":4,"comment":"null","endLoc":184,"id":12670,"name":"_input_units_strict","nodeType":"Attribute","startLoc":184,"text":"_input_units_strict"},{"attributeType":"null","col":4,"comment":"null","endLoc":186,"id":12671,"name":"_input_units_allow_dimensionless","nodeType":"Attribute","startLoc":186,"text":"_input_units_allow_dimensionless"},{"className":"EulerAngleRotation","col":0,"comment":"\n    Implements Euler angle intrinsic rotations.\n\n    Rotates one coordinate system into another (fixed) coordinate system.\n    All coordinate systems are right-handed. The sign of the angles is\n    determined by the right-hand rule..\n\n    Parameters\n    ----------\n    phi, theta, psi : float or `~astropy.units.Quantity` ['angle']\n        \"proper\" Euler angles in deg.\n        If floats, they should be in deg.\n    axes_order : str\n        A 3 character string, a combination of 'x', 'y' and 'z',\n        where each character denotes an axis in 3D space.\n    ","endLoc":257,"id":12672,"nodeType":"Class","startLoc":201,"text":"class EulerAngleRotation(_EulerRotation, Model):\n    \"\"\"\n    Implements Euler angle intrinsic rotations.\n\n    Rotates one coordinate system into another (fixed) coordinate system.\n    All coordinate systems are right-handed. The sign of the angles is\n    determined by the right-hand rule..\n\n    Parameters\n    ----------\n    phi, theta, psi : float or `~astropy.units.Quantity` ['angle']\n        \"proper\" Euler angles in deg.\n        If floats, they should be in deg.\n    axes_order : str\n        A 3 character string, a combination of 'x', 'y' and 'z',\n        where each character denotes an axis in 3D space.\n    \"\"\"\n\n    n_inputs = 2\n    n_outputs = 2\n\n    phi = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian,\n    description=\"1st Euler angle (Quantity or value in deg)\")\n    theta = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian,\n    description=\"2nd Euler angle (Quantity or value in deg)\")\n    psi = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian,\n    description=\"3rd Euler angle (Quantity or value in deg)\")\n\n    def __init__(self, phi, theta, psi, axes_order, **kwargs):\n        self.axes = ['x', 'y', 'z']\n        if len(axes_order) != 3:\n            raise TypeError(\n                \"Expected axes_order to be a character sequence of length 3, \"\n                \"got {}\".format(axes_order))\n        unrecognized = set(axes_order).difference(self.axes)\n        if unrecognized:\n            raise ValueError(\"Unrecognized axis label {}; \"\n                             \"should be one of {} \".format(unrecognized, self.axes))\n        self.axes_order = axes_order\n        qs = [isinstance(par, u.Quantity) for par in [phi, theta, psi]]\n        if any(qs) and not all(qs):\n            raise TypeError(\"All parameters should be of the same type - float or Quantity.\")\n\n        super().__init__(phi=phi, theta=theta, psi=psi, **kwargs)\n        self._inputs = ('alpha', 'delta')\n        self._outputs = ('alpha', 'delta')\n\n    @property\n    def inverse(self):\n        return self.__class__(phi=-self.psi,\n                              theta=-self.theta,\n                              psi=-self.phi,\n                              axes_order=self.axes_order[::-1])\n\n    def evaluate(self, alpha, delta, phi, theta, psi):\n        a, b = super().evaluate(alpha, delta, phi, theta, psi, self.axes_order)\n        return a, b"},{"col":4,"comment":"null","endLoc":246,"header":"def __init__(self, phi, theta, psi, axes_order, **kwargs)","id":12673,"name":"__init__","nodeType":"Function","startLoc":229,"text":"def __init__(self, phi, theta, psi, axes_order, **kwargs):\n        self.axes = ['x', 'y', 'z']\n        if len(axes_order) != 3:\n            raise TypeError(\n                \"Expected axes_order to be a character sequence of length 3, \"\n                \"got {}\".format(axes_order))\n        unrecognized = set(axes_order).difference(self.axes)\n        if unrecognized:\n            raise ValueError(\"Unrecognized axis label {}; \"\n                             \"should be one of {} \".format(unrecognized, self.axes))\n        self.axes_order = axes_order\n        qs = [isinstance(par, u.Quantity) for par in [phi, theta, psi]]\n        if any(qs) and not all(qs):\n            raise TypeError(\"All parameters should be of the same type - float or Quantity.\")\n\n        super().__init__(phi=phi, theta=theta, psi=psi, **kwargs)\n        self._inputs = ('alpha', 'delta')\n        self._outputs = ('alpha', 'delta')"},{"col":0,"comment":"\n    Create a model from a user defined function. The inputs and parameters of\n    the model will be inferred from the arguments of the function.\n\n    This can be used either as a function or as a decorator.  See below for\n    examples of both usages.\n\n    The model is separable only if there is a single input.\n\n    .. note::\n\n        All model parameters have to be defined as keyword arguments with\n        default values in the model function.  Use `None` as a default argument\n        value if you do not want to have a default value for that parameter.\n\n        The standard settable model properties can be configured by default\n        using keyword arguments matching the name of the property; however,\n        these values are not set as model \"parameters\". Moreover, users\n        cannot use keyword arguments matching non-settable model properties,\n        with the exception of ``n_outputs`` which should be set to the number of\n        outputs of your function.\n\n    Parameters\n    ----------\n    func : function\n        Function which defines the model.  It should take N positional\n        arguments where ``N`` is dimensions of the model (the number of\n        independent variable in the model), and any number of keyword arguments\n        (the parameters).  It must return the value of the model (typically as\n        an array, but can also be a scalar for scalar inputs).  This\n        corresponds to the `~astropy.modeling.Model.evaluate` method.\n    fit_deriv : function, optional\n        Function which defines the Jacobian derivative of the model. I.e., the\n        derivative with respect to the *parameters* of the model.  It should\n        have the same argument signature as ``func``, but should return a\n        sequence where each element of the sequence is the derivative\n        with respect to the corresponding argument. This corresponds to the\n        :meth:`~astropy.modeling.FittableModel.fit_deriv` method.\n\n    Examples\n    --------\n    Define a sinusoidal model function as a custom 1D model::\n\n        >>> from astropy.modeling.models import custom_model\n        >>> import numpy as np\n        >>> def sine_model(x, amplitude=1., frequency=1.):\n        ...     return amplitude * np.sin(2 * np.pi * frequency * x)\n        >>> def sine_deriv(x, amplitude=1., frequency=1.):\n        ...     return 2 * np.pi * amplitude * np.cos(2 * np.pi * frequency * x)\n        >>> SineModel = custom_model(sine_model, fit_deriv=sine_deriv)\n\n    Create an instance of the custom model and evaluate it::\n\n        >>> model = SineModel()\n        >>> model(0.25)\n        1.0\n\n    This model instance can now be used like a usual astropy model.\n\n    The next example demonstrates a 2D Moffat function model, and also\n    demonstrates the support for docstrings (this example could also include\n    a derivative, but it has been omitted for simplicity)::\n\n        >>> @custom_model\n        ... def Moffat2D(x, y, amplitude=1.0, x_0=0.0, y_0=0.0, gamma=1.0,\n        ...            alpha=1.0):\n        ...     \"\"\"Two dimensional Moffat function.\"\"\"\n        ...     rr_gg = ((x - x_0) ** 2 + (y - y_0) ** 2) / gamma ** 2\n        ...     return amplitude * (1 + rr_gg) ** (-alpha)\n        ...\n        >>> print(Moffat2D.__doc__)\n        Two dimensional Moffat function.\n        >>> model = Moffat2D()\n        >>> model(1, 1)  # doctest: +FLOAT_CMP\n        0.3333333333333333\n    ","endLoc":4252,"header":"def custom_model(*args, fit_deriv=None)","id":12674,"name":"custom_model","nodeType":"Function","startLoc":4165,"text":"def custom_model(*args, fit_deriv=None):\n    \"\"\"\n    Create a model from a user defined function. The inputs and parameters of\n    the model will be inferred from the arguments of the function.\n\n    This can be used either as a function or as a decorator.  See below for\n    examples of both usages.\n\n    The model is separable only if there is a single input.\n\n    .. note::\n\n        All model parameters have to be defined as keyword arguments with\n        default values in the model function.  Use `None` as a default argument\n        value if you do not want to have a default value for that parameter.\n\n        The standard settable model properties can be configured by default\n        using keyword arguments matching the name of the property; however,\n        these values are not set as model \"parameters\". Moreover, users\n        cannot use keyword arguments matching non-settable model properties,\n        with the exception of ``n_outputs`` which should be set to the number of\n        outputs of your function.\n\n    Parameters\n    ----------\n    func : function\n        Function which defines the model.  It should take N positional\n        arguments where ``N`` is dimensions of the model (the number of\n        independent variable in the model), and any number of keyword arguments\n        (the parameters).  It must return the value of the model (typically as\n        an array, but can also be a scalar for scalar inputs).  This\n        corresponds to the `~astropy.modeling.Model.evaluate` method.\n    fit_deriv : function, optional\n        Function which defines the Jacobian derivative of the model. I.e., the\n        derivative with respect to the *parameters* of the model.  It should\n        have the same argument signature as ``func``, but should return a\n        sequence where each element of the sequence is the derivative\n        with respect to the corresponding argument. This corresponds to the\n        :meth:`~astropy.modeling.FittableModel.fit_deriv` method.\n\n    Examples\n    --------\n    Define a sinusoidal model function as a custom 1D model::\n\n        >>> from astropy.modeling.models import custom_model\n        >>> import numpy as np\n        >>> def sine_model(x, amplitude=1., frequency=1.):\n        ...     return amplitude * np.sin(2 * np.pi * frequency * x)\n        >>> def sine_deriv(x, amplitude=1., frequency=1.):\n        ...     return 2 * np.pi * amplitude * np.cos(2 * np.pi * frequency * x)\n        >>> SineModel = custom_model(sine_model, fit_deriv=sine_deriv)\n\n    Create an instance of the custom model and evaluate it::\n\n        >>> model = SineModel()\n        >>> model(0.25)\n        1.0\n\n    This model instance can now be used like a usual astropy model.\n\n    The next example demonstrates a 2D Moffat function model, and also\n    demonstrates the support for docstrings (this example could also include\n    a derivative, but it has been omitted for simplicity)::\n\n        >>> @custom_model\n        ... def Moffat2D(x, y, amplitude=1.0, x_0=0.0, y_0=0.0, gamma=1.0,\n        ...            alpha=1.0):\n        ...     \\\"\\\"\\\"Two dimensional Moffat function.\\\"\\\"\\\"\n        ...     rr_gg = ((x - x_0) ** 2 + (y - y_0) ** 2) / gamma ** 2\n        ...     return amplitude * (1 + rr_gg) ** (-alpha)\n        ...\n        >>> print(Moffat2D.__doc__)\n        Two dimensional Moffat function.\n        >>> model = Moffat2D()\n        >>> model(1, 1)  # doctest: +FLOAT_CMP\n        0.3333333333333333\n    \"\"\"\n\n    if len(args) == 1 and callable(args[0]):\n        return _custom_model_wrapper(args[0], fit_deriv=fit_deriv)\n    elif not args:\n        return functools.partial(_custom_model_wrapper, fit_deriv=fit_deriv)\n    else:\n        raise TypeError(\n            \"{0} takes at most one positional argument (the callable/\"\n            \"function to be turned into a model.  When used as a decorator \"\n            \"it should be passed keyword arguments only (if \"\n            \"any).\".format(__name__))"},{"col":0,"comment":"\n    Internal implementation `custom_model`.\n\n    When `custom_model` is called as a function its arguments are passed to\n    this function, and the result of this function is returned.\n\n    When `custom_model` is used as a decorator a partial evaluation of this\n    function is returned by `custom_model`.\n    ","endLoc":4354,"header":"def _custom_model_wrapper(func, fit_deriv=None)","id":12675,"name":"_custom_model_wrapper","nodeType":"Function","startLoc":4299,"text":"def _custom_model_wrapper(func, fit_deriv=None):\n    \"\"\"\n    Internal implementation `custom_model`.\n\n    When `custom_model` is called as a function its arguments are passed to\n    this function, and the result of this function is returned.\n\n    When `custom_model` is used as a decorator a partial evaluation of this\n    function is returned by `custom_model`.\n    \"\"\"\n\n    if not callable(func):\n        raise ModelDefinitionError(\n            \"func is not callable; it must be a function or other callable \"\n            \"object\")\n\n    if fit_deriv is not None and not callable(fit_deriv):\n        raise ModelDefinitionError(\n            \"fit_deriv not callable; it must be a function or other \"\n            \"callable object\")\n\n    model_name = func.__name__\n\n    inputs, special_params, settable_params, params = _custom_model_inputs(func)\n\n    if (fit_deriv is not None and\n            len(fit_deriv.__defaults__) != len(params)):\n        raise ModelDefinitionError(\"derivative function should accept \"\n                                   \"same number of parameters as func.\")\n\n    params = {param: Parameter(param, default=default)\n              for param, default in params.items()}\n\n    mod = find_current_module(2)\n    if mod:\n        modname = mod.__name__\n    else:\n        modname = '__main__'\n\n    members = {\n        '__module__': str(modname),\n        '__doc__': func.__doc__,\n        'n_inputs': len(inputs),\n        'n_outputs': special_params.pop('n_outputs', 1),\n        'evaluate': staticmethod(func),\n        '_settable_properties': settable_params\n    }\n\n    if fit_deriv is not None:\n        members['fit_deriv'] = staticmethod(fit_deriv)\n\n    members.update(params)\n\n    cls = type(model_name, (FittableModel,), members)\n    cls._separable = True if (len(inputs) == 1) else False\n    return cls"},{"col":4,"comment":"null","endLoc":253,"header":"@property\n    def inverse(self)","id":12676,"name":"inverse","nodeType":"Function","startLoc":248,"text":"@property\n    def inverse(self):\n        return self.__class__(phi=-self.psi,\n                              theta=-self.theta,\n                              psi=-self.phi,\n                              axes_order=self.axes_order[::-1])"},{"col":4,"comment":"\n        Calculate density delta.\n        ","endLoc":567,"header":"def _density_delta(self, massfactor, cosmo, redshift)","id":12677,"name":"_density_delta","nodeType":"Function","startLoc":511,"text":"def _density_delta(self, massfactor, cosmo, redshift):\n        \"\"\"\n        Calculate density delta.\n        \"\"\"\n        # Set mass overdensity type and factor\n        if isinstance(massfactor, tuple):\n            # Tuple options\n            #   (\"virial\")       : virial radius\n            #   (\"critical\", N)  : radius where density is N that of the critical density\n            #   (\"mean\", N)      : radius where density is N that of the mean density\n            if massfactor[0].lower() == \"virial\":\n                # Virial Mass\n                delta = None\n                masstype = massfactor[0].lower()\n            elif massfactor[0].lower() == \"critical\":\n                # Critical or Mean Overdensity Mass\n                delta = float(massfactor[1])\n                masstype = 'c'\n            elif massfactor[0].lower() == \"mean\":\n                # Critical or Mean Overdensity Mass\n                delta = float(massfactor[1])\n                masstype = 'm'\n            else:\n                raise ValueError(\"Massfactor '\" + str(massfactor[0]) + \"' not one of 'critical', \"\n                                                                       \"'mean', or 'virial'\")\n        else:\n            try:\n                # String options\n                #   virial : virial radius\n                #   Nc  : radius where density is N that of the critical density\n                #   Nm  : radius where density is N that of the mean density\n                if massfactor.lower() == \"virial\":\n                    # Virial Mass\n                    delta = None\n                    masstype = massfactor.lower()\n                elif massfactor[-1].lower() == 'c' or massfactor[-1].lower() == 'm':\n                    # Critical or Mean Overdensity Mass\n                    delta = float(massfactor[0:-1])\n                    masstype = massfactor[-1].lower()\n                else:\n                    raise ValueError(\"Massfactor \" + str(massfactor) + \" string not of the form \"\n                                                                       \"'#m', '#c', or 'virial'\")\n            except (AttributeError, TypeError):\n                raise TypeError(\"Massfactor \" + str(\n                    massfactor) + \" not a tuple or string\")\n\n        # Set density from masstype specification\n        if masstype == \"virial\":\n            Om_c = cosmo.Om(redshift) - 1.0\n            d_c = 18.0 * np.pi ** 2 + 82.0 * Om_c - 39.0 * Om_c ** 2\n            self.density_delta = d_c * cosmo.critical_density(redshift)\n        elif masstype == 'c':\n            self.density_delta = delta * cosmo.critical_density(redshift)\n        elif masstype == 'm':\n            self.density_delta = delta * cosmo.critical_density(redshift) * cosmo.Om(redshift)\n\n        return self.density_delta"},{"col":0,"comment":"\n    Processes the inputs to the `custom_model`'s function into the appropriate\n    categories.\n\n    Parameters\n    ----------\n    func : callable\n\n    Returns\n    -------\n    inputs : list\n        list of evaluation inputs\n    special_params : dict\n        dictionary of model properties which require special treatment\n    settable_params : dict\n        dictionary of defaults for settable model properties\n    params : dict\n        dictionary of model parameters set by `custom_model`'s function\n    ","endLoc":4296,"header":"def _custom_model_inputs(func)","id":12678,"name":"_custom_model_inputs","nodeType":"Function","startLoc":4255,"text":"def _custom_model_inputs(func):\n    \"\"\"\n    Processes the inputs to the `custom_model`'s function into the appropriate\n    categories.\n\n    Parameters\n    ----------\n    func : callable\n\n    Returns\n    -------\n    inputs : list\n        list of evaluation inputs\n    special_params : dict\n        dictionary of model properties which require special treatment\n    settable_params : dict\n        dictionary of defaults for settable model properties\n    params : dict\n        dictionary of model parameters set by `custom_model`'s function\n    \"\"\"\n    inputs, parameters = get_inputs_and_params(func)\n\n    special = ['n_outputs']\n    settable = [attr for attr, value in vars(Model).items()\n                if isinstance(value, property) and value.fset is not None]\n    properties = [attr for attr, value in vars(Model).items()\n                  if isinstance(value, property) and value.fset is None and attr not in special]\n\n    special_params = {}\n    settable_params = {}\n    params = {}\n    for param in parameters:\n        if param.name in special:\n            special_params[param.name] = param.default\n        elif param.name in settable:\n            settable_params[param.name] = param.default\n        elif param.name in properties:\n            raise ValueError(f\"Parameter '{param.name}' cannot be a model property: {properties}.\")\n        else:\n            params[param.name] = param.default\n\n    return inputs, special_params, settable_params, params"},{"col":4,"comment":"null","endLoc":257,"header":"def evaluate(self, alpha, delta, phi, theta, psi)","id":12679,"name":"evaluate","nodeType":"Function","startLoc":255,"text":"def evaluate(self, alpha, delta, phi, theta, psi):\n        a, b = super().evaluate(alpha, delta, phi, theta, psi, self.axes_order)\n        return a, b"},{"col":4,"comment":"\n        Internal implementation of ``__repr__``.\n\n        This is separated out for ease of use by subclasses that wish to\n        override the default ``__repr__`` while keeping the same basic\n        formatting.\n        ","endLoc":498,"header":"def _format_cls_repr(cls, keywords=[])","id":12680,"name":"_format_cls_repr","nodeType":"Function","startLoc":450,"text":"def _format_cls_repr(cls, keywords=[]):\n        \"\"\"\n        Internal implementation of ``__repr__``.\n\n        This is separated out for ease of use by subclasses that wish to\n        override the default ``__repr__`` while keeping the same basic\n        formatting.\n        \"\"\"\n\n        # For the sake of familiarity start the output with the standard class\n        # __repr__\n        parts = [super().__repr__()]\n\n        if not cls._is_concrete:\n            return parts[0]\n\n        def format_inheritance(cls):\n            bases = []\n            for base in cls.mro()[1:]:\n                if not issubclass(base, Model):\n                    continue\n                elif (inspect.isabstract(base) or\n                      base.__name__.startswith('_')):\n                    break\n                bases.append(base.name)\n            if bases:\n                return f\"{cls.name} ({' -> '.join(bases)})\"\n            return cls.name\n\n        try:\n            default_keywords = [\n                ('Name', format_inheritance(cls)),\n                ('N_inputs', cls.n_inputs),\n                ('N_outputs', cls.n_outputs),\n            ]\n\n            if cls.param_names:\n                default_keywords.append(('Fittable parameters',\n                                         cls.param_names))\n\n            for keyword, value in default_keywords + keywords:\n                if value is not None:\n                    parts.append(f'{keyword}: {value}')\n\n            return '\\n'.join(parts)\n        except Exception:\n            # If any of the above formatting fails fall back on the basic repr\n            # (this is particularly useful in debugging)\n            return parts[0]"},{"attributeType":"null","col":4,"comment":"null","endLoc":219,"id":12681,"name":"n_inputs","nodeType":"Attribute","startLoc":219,"text":"n_inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":220,"id":12682,"name":"n_outputs","nodeType":"Attribute","startLoc":220,"text":"n_outputs"},{"col":4,"comment":"One dimensional power law model function","endLoc":50,"header":"@staticmethod\n    def evaluate(x, amplitude, x_0, alpha)","id":12683,"name":"evaluate","nodeType":"Function","startLoc":46,"text":"@staticmethod\n    def evaluate(x, amplitude, x_0, alpha):\n        \"\"\"One dimensional power law model function\"\"\"\n        xx = x / x_0\n        return amplitude * xx ** (-alpha)"},{"col":4,"comment":"One dimensional power law derivative with respect to parameters","endLoc":62,"header":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, alpha)","id":12684,"name":"fit_deriv","nodeType":"Function","startLoc":52,"text":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, alpha):\n        \"\"\"One dimensional power law derivative with respect to parameters\"\"\"\n\n        xx = x / x_0\n\n        d_amplitude = xx ** (-alpha)\n        d_x_0 = amplitude * alpha * d_amplitude / x_0\n        d_alpha = -amplitude * d_amplitude * np.log(xx)\n\n        return [d_amplitude, d_x_0, d_alpha]"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":222,"id":12685,"name":"phi","nodeType":"Attribute","startLoc":222,"text":"phi"},{"col":4,"comment":"null","endLoc":68,"header":"@property\n    def input_units(self)","id":12686,"name":"input_units","nodeType":"Function","startLoc":64,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}"},{"col":4,"comment":"null","endLoc":72,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":12687,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":70,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":42,"id":12688,"name":"amplitude","nodeType":"Attribute","startLoc":42,"text":"amplitude"},{"col":0,"comment":"\n    This is a convenience function intended to disable automatic generation\n    of the inverse in compound models by disabling one of the constituent\n    model's inverse. This is to handle cases where user provided inverse\n    functions are not compatible within an expression.\n\n    Example:\n        compound_model.inverse = hide_inverse(m1) + m2 + m3\n\n    This will insure that the defined inverse itself won't attempt to\n    build its own inverse, which would otherwise fail in this example\n    (e.g., m = m1 + m2 + m3 happens to raises an exception for this\n    reason.)\n\n    Note that this permanently disables it. To prevent that either copy\n    the model or restore the inverse later.\n    ","endLoc":4473,"header":"def hide_inverse(model)","id":12689,"name":"hide_inverse","nodeType":"Function","startLoc":4454,"text":"def hide_inverse(model):\n    \"\"\"\n    This is a convenience function intended to disable automatic generation\n    of the inverse in compound models by disabling one of the constituent\n    model's inverse. This is to handle cases where user provided inverse\n    functions are not compatible within an expression.\n\n    Example:\n        compound_model.inverse = hide_inverse(m1) + m2 + m3\n\n    This will insure that the defined inverse itself won't attempt to\n    build its own inverse, which would otherwise fail in this example\n    (e.g., m = m1 + m2 + m3 happens to raises an exception for this\n    reason.)\n\n    Note that this permanently disables it. To prevent that either copy\n    the model or restore the inverse later.\n    \"\"\"\n    del model.inverse\n    return model"},{"col":0,"comment":"\n    This function creates a compound model with one or more of the input\n    values of the input model assigned fixed values (scalar or array).\n\n    Parameters\n    ----------\n    modelinstance : `~astropy.modeling.Model` instance\n        This is the model that one or more of the\n        model input values will be fixed to some constant value.\n    values : dict\n        A dictionary where the key identifies which input to fix\n        and its value is the value to fix it at. The key may either be the\n        name of the input or a number reflecting its order in the inputs.\n\n    Examples\n    --------\n\n    >>> from astropy.modeling.models import Gaussian2D\n    >>> g = Gaussian2D(1, 2, 3, 4, 5)\n    >>> gv = fix_inputs(g, {0: 2.5})\n\n    Results in a 1D function equivalent to Gaussian2D(1, 2, 3, 4, 5)(x=2.5, y)\n    ","endLoc":4106,"header":"def fix_inputs(modelinstance, values, bounding_boxes=None, selector_args=None)","id":12690,"name":"fix_inputs","nodeType":"Function","startLoc":4071,"text":"def fix_inputs(modelinstance, values, bounding_boxes=None, selector_args=None):\n    \"\"\"\n    This function creates a compound model with one or more of the input\n    values of the input model assigned fixed values (scalar or array).\n\n    Parameters\n    ----------\n    modelinstance : `~astropy.modeling.Model` instance\n        This is the model that one or more of the\n        model input values will be fixed to some constant value.\n    values : dict\n        A dictionary where the key identifies which input to fix\n        and its value is the value to fix it at. The key may either be the\n        name of the input or a number reflecting its order in the inputs.\n\n    Examples\n    --------\n\n    >>> from astropy.modeling.models import Gaussian2D\n    >>> g = Gaussian2D(1, 2, 3, 4, 5)\n    >>> gv = fix_inputs(g, {0: 2.5})\n\n    Results in a 1D function equivalent to Gaussian2D(1, 2, 3, 4, 5)(x=2.5, y)\n    \"\"\"\n    model = CompoundModel('fix_inputs', modelinstance, values)\n    if bounding_boxes is not None:\n        if selector_args is None:\n            selector_args = tuple([(key, True) for key in values.keys()])\n        bbox = CompoundBoundingBox.validate(modelinstance, bounding_boxes, selector_args)\n        _selector = bbox.selector_args.get_fixed_values(modelinstance, values)\n\n        new_bbox = bbox[_selector]\n        new_bbox = new_bbox.__class__.validate(model, new_bbox)\n\n        model.bounding_box = new_bbox\n    return model"},{"col":4,"comment":"\n        Calculate scale radius of the NFW profile.\n        ","endLoc":627,"header":"def _radius_s(self, mass, concentration)","id":12691,"name":"_radius_s","nodeType":"Function","startLoc":608,"text":"def _radius_s(self, mass, concentration):\n        \"\"\"\n        Calculate scale radius of the NFW profile.\n        \"\"\"\n        # Enforce default units\n        if not isinstance(mass, u.Quantity):\n            in_mass = u.Quantity(mass, u.M_sun)\n        else:\n            in_mass = mass\n\n        # Delta Mass is related to delta radius by\n        # M_{200}=\\frac{4}{3}\\pi r_{200}^3 200 \\rho_{c}\n        # And delta radius is related to the NFW scale radius by\n        # c = R / r_{\\\\rm s}\n        self.radius_s = (((3.0 * in_mass) / (4.0 * np.pi * self.density_delta)) ** (\n                          1.0 / 3.0)) / concentration\n\n        # Set radial units to kiloparsec by default (unit will be rescaled by units of radius\n        # in evaluate)\n        return self.radius_s.to(u.kpc)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":224,"id":12692,"name":"theta","nodeType":"Attribute","startLoc":224,"text":"theta"},{"col":4,"comment":"\n        Repr for IPython's pretty printer.\n\n        By default IPython \"pretty prints\" classes, so we need to implement\n        this so that IPython displays the custom repr for Models.\n        ","endLoc":158,"header":"def _repr_pretty_(cls, p, cycle)","id":12694,"name":"_repr_pretty_","nodeType":"Function","startLoc":150,"text":"def _repr_pretty_(cls, p, cycle):\n        \"\"\"\n        Repr for IPython's pretty printer.\n\n        By default IPython \"pretty prints\" classes, so we need to implement\n        this so that IPython displays the custom repr for Models.\n        \"\"\"\n\n        p.text(repr(cls))"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":226,"id":12695,"name":"psi","nodeType":"Attribute","startLoc":226,"text":"psi"},{"attributeType":"null","col":8,"comment":"null","endLoc":246,"id":12696,"name":"_outputs","nodeType":"Attribute","startLoc":246,"text":"self._outputs"},{"col":4,"comment":"null","endLoc":177,"header":"def __reduce__(cls)","id":12697,"name":"__reduce__","nodeType":"Function","startLoc":160,"text":"def __reduce__(cls):\n        if not cls._is_dynamic:\n            # Just return a string specifying where the class can be imported\n            # from\n            return cls.__name__\n        members = dict(cls.__dict__)\n        # Delete any ABC-related attributes--these will be restored when\n        # the class is reconstructed:\n        for key in list(members):\n            if key.startswith('_abc_'):\n                del members[key]\n\n        # Delete custom __init__ and __call__ if they exist:\n        for key in ('__init__', '__call__'):\n            if key in members:\n                del members[key]\n\n        return (type(cls), (cls.__name__, cls.__bases__, members))"},{"attributeType":"null","col":8,"comment":"null","endLoc":245,"id":12698,"name":"_inputs","nodeType":"Attribute","startLoc":245,"text":"self._inputs"},{"attributeType":"null","col":8,"comment":"null","endLoc":230,"id":12699,"name":"axes","nodeType":"Attribute","startLoc":230,"text":"self.axes"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":43,"id":12700,"name":"x_0","nodeType":"Attribute","startLoc":43,"text":"x_0"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":12701,"name":"CONSTRAINTS_DOC","nodeType":"Attribute","startLoc":25,"text":"CONSTRAINTS_DOC"},{"attributeType":"null","col":0,"comment":"null","endLoc":56,"id":12702,"name":"MODELS_WITH_CONSTRAINTS","nodeType":"Attribute","startLoc":56,"text":"MODELS_WITH_CONSTRAINTS"},{"attributeType":"null","col":4,"comment":"null","endLoc":70,"id":12703,"name":"item","nodeType":"Attribute","startLoc":70,"text":"item"},{"col":0,"comment":"","endLoc":5,"header":"models.py#<anonymous>","id":12704,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nCreates a common namespace for all pre-defined models.\n\"\"\"\n\nCONSTRAINTS_DOC = \"\"\"\n    Other Parameters\n    ----------------\n    fixed : a dict, optional\n        A dictionary ``{parameter_name: boolean}`` of parameters to not be\n        varied during fitting. True means the parameter is held fixed.\n        Alternatively the `~astropy.modeling.Parameter.fixed`\n        property of a parameter may be used.\n    tied : dict, optional\n        A dictionary ``{parameter_name: callable}`` of parameters which are\n        linked to some other parameter. The dictionary values are callables\n        providing the linking relationship.  Alternatively the\n        `~astropy.modeling.Parameter.tied` property of a parameter\n        may be used.\n    bounds : dict, optional\n        A dictionary ``{parameter_name: value}`` of lower and upper bounds of\n        parameters. Keys are parameter names. Values are a list or a tuple\n        of length 2 giving the desired range for the parameter.\n        Alternatively, the\n        `~astropy.modeling.Parameter.min` and\n        `~astropy.modeling.Parameter.max` properties of a parameter\n        may be used.\n    eqcons : list, optional\n        A list of functions of length ``n`` such that ``eqcons[j](x0,*args) ==\n        0.0`` in a successfully optimized problem.\n    ineqcons : list, optional\n        A list of functions of length ``n`` such that ``ieqcons[j](x0,*args) >=\n        0.0`` is a successfully optimized problem.\n\"\"\"\n\nMODELS_WITH_CONSTRAINTS = [\n    AiryDisk2D, Moffat1D, Moffat2D, Box1D, Box2D,\n    Const1D, Const2D, Ellipse2D, Disk2D,\n    Gaussian1D, Gaussian2D,\n    Linear1D, Lorentz1D, RickerWavelet1D, RickerWavelet2D,\n    PowerLaw1D, Sersic1D, Sersic2D,\n    Sine1D, Cosine1D, Tangent1D, ArcSine1D, ArcCosine1D, ArcTangent1D,\n    Trapezoid1D, TrapezoidDisk2D,\n    Chebyshev1D, Chebyshev2D, Hermite1D, Hermite2D, Legendre2D, Legendre1D,\n    Polynomial1D, Polynomial2D, Voigt1D, KingProjectedAnalytic1D,\n    NFW\n]\n\nfor item in MODELS_WITH_CONSTRAINTS:\n    if isinstance(item.__doc__, str):\n        item.__doc__ += CONSTRAINTS_DOC"},{"attributeType":"null","col":8,"comment":"null","endLoc":239,"id":12705,"name":"axes_order","nodeType":"Attribute","startLoc":239,"text":"self.axes_order"},{"fileName":"parameters.py","filePath":"astropy/modeling","id":12706,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# pylint: disable=invalid-name\n\n\"\"\"\nThis module defines classes that deal with parameters.\n\nIt is unlikely users will need to work with these classes directly,\nunless they define their own models.\n\"\"\"\n\n\nimport functools\nimport numbers\nimport operator\n\nimport numpy as np\n\nfrom astropy.units import Quantity\nfrom astropy.utils import isiterable\nfrom .utils import array_repr_oneline\nfrom .utils import get_inputs_and_params\n\n\n__all__ = ['Parameter', 'InputParameterError', 'ParameterError']\n\n\nclass ParameterError(Exception):\n    \"\"\"Generic exception class for all exceptions pertaining to Parameters.\"\"\"\n\n\nclass InputParameterError(ValueError, ParameterError):\n    \"\"\"Used for incorrect input parameter values and definitions.\"\"\"\n\n\nclass ParameterDefinitionError(ParameterError):\n    \"\"\"Exception in declaration of class-level Parameters.\"\"\"\n\n\ndef _tofloat(value):\n    \"\"\"Convert a parameter to float or float array\"\"\"\n\n    if isiterable(value):\n        try:\n            value = np.asanyarray(value, dtype=float)\n        except (TypeError, ValueError):\n            # catch arrays with strings or user errors like different\n            # types of parameters in a parameter set\n            raise InputParameterError(\n                f\"Parameter of {type(value)} could not be converted to float\")\n    elif isinstance(value, Quantity):\n        # Quantities are fine as is\n        pass\n    elif isinstance(value, np.ndarray):\n        # A scalar/dimensionless array\n        value = float(value.item())\n    elif isinstance(value, (numbers.Number, np.number)) and not isinstance(value, bool):\n        value = float(value)\n    elif isinstance(value, bool):\n        raise InputParameterError(\n            \"Expected parameter to be of numerical type, not boolean\")\n    else:\n        raise InputParameterError(\n            f\"Don't know how to convert parameter of {type(value)} to float\")\n    return value\n\n\n# Helpers for implementing operator overloading on Parameter\n\ndef _binary_arithmetic_operation(op, reflected=False):\n    @functools.wraps(op)\n    def wrapper(self, val):\n\n        if self.unit is not None:\n            self_value = Quantity(self.value, self.unit)\n        else:\n            self_value = self.value\n\n        if reflected:\n            return op(val, self_value)\n        else:\n            return op(self_value, val)\n\n    return wrapper\n\n\ndef _binary_comparison_operation(op):\n    @functools.wraps(op)\n    def wrapper(self, val):\n\n        if self.unit is not None:\n            self_value = Quantity(self.value, self.unit)\n        else:\n            self_value = self.value\n\n        return op(self_value, val)\n\n    return wrapper\n\n\ndef _unary_arithmetic_operation(op):\n    @functools.wraps(op)\n    def wrapper(self):\n\n        if self.unit is not None:\n            self_value = Quantity(self.value, self.unit)\n        else:\n            self_value = self.value\n\n        return op(self_value)\n\n    return wrapper\n\n\nclass Parameter:\n    \"\"\"\n    Wraps individual parameters.\n\n    Since 4.0 Parameters are no longer descriptors and are based on a new\n    implementation of the Parameter class. Parameters now  (as of 4.0) store\n    values locally (as instead previously in the associated model)\n\n    This class represents a model's parameter (in a somewhat broad sense). It\n    serves a number of purposes:\n\n    1) A type to be recognized by models and treated specially at class\n    initialization (i.e., if it is found that there is a class definition\n    of a Parameter, the model initializer makes a copy at the instance level).\n\n    2) Managing the handling of allowable parameter values and once defined,\n    ensuring updates are consistent with the Parameter definition. This\n    includes the optional use of units and quantities as well as transforming\n    values to an internally consistent representation (e.g., from degrees to\n    radians through the use of getters and setters).\n\n    3) Holding attributes of parameters relevant to fitting, such as whether\n    the parameter may be varied in fitting, or whether there are constraints\n    that must be satisfied.\n\n\n\n    See :ref:`astropy:modeling-parameters` for more details.\n\n    Parameters\n    ----------\n    name : str\n        parameter name\n\n        .. warning::\n\n            The fact that `Parameter` accepts ``name`` as an argument is an\n            implementation detail, and should not be used directly.  When\n            defining a new `Model` class, parameter names are always\n            automatically defined by the class attribute they're assigned to.\n    description : str\n        parameter description\n    default : float or array\n        default value to use for this parameter\n    unit : `~astropy.units.Unit`\n        if specified, the parameter will be in these units, and when the\n        parameter is updated in future, it should be set to a\n        :class:`~astropy.units.Quantity` that has equivalent units.\n    getter : callable\n        a function that wraps the raw (internal) value of the parameter\n        when returning the value through the parameter proxy (eg. a\n        parameter may be stored internally as radians but returned to the\n        user as degrees)\n    setter : callable\n        a function that wraps any values assigned to this parameter; should\n        be the inverse of getter\n    fixed : bool\n        if True the parameter is not varied during fitting\n    tied : callable or False\n        if callable is supplied it provides a way to link the value of this\n        parameter to another parameter (or some other arbitrary function)\n    min : float\n        the lower bound of a parameter\n    max : float\n        the upper bound of a parameter\n    bounds : tuple\n        specify min and max as a single tuple--bounds may not be specified\n        simultaneously with min or max\n    \"\"\"\n\n    constraints = ('fixed', 'tied', 'bounds')\n    \"\"\"\n    Types of constraints a parameter can have.  Excludes 'min' and 'max'\n    which are just aliases for the first and second elements of the 'bounds'\n    constraint (which is represented as a 2-tuple). 'prior' and 'posterior'\n    are available for use by user fitters but are not used by any built-in\n    fitters as of this writing.\n    \"\"\"\n\n    def __init__(self, name='', description='', default=None, unit=None,\n                 getter=None, setter=None, fixed=False, tied=False, min=None,\n                 max=None, bounds=None, prior=None, posterior=None):\n        super().__init__()\n\n        self._model = None\n        self._model_required = False\n        self._setter = self._create_value_wrapper(setter, None)\n        self._getter = self._create_value_wrapper(getter, None)\n        self._name = name\n        self.__doc__ = self._description = description.strip()\n\n        # We only need to perform this check on unbound parameters\n        if isinstance(default, Quantity):\n            if unit is not None and not unit.is_equivalent(default.unit):\n                raise ParameterDefinitionError(\n                    \"parameter default {0} does not have units equivalent to \"\n                    \"the required unit {1}\".format(default, unit))\n            unit = default.unit\n            default = default.value\n\n        self._default = default\n        self._unit = unit\n        # Internal units correspond to raw_units held by the model in the\n        # previous implementation. The private _getter and _setter methods\n        # use this to convert to and from the public unit defined for the\n        # parameter.\n        self._internal_unit = None\n        if not self._model_required:\n            if self._default is not None:\n                self.value = self._default\n            else:\n                self._value = None\n\n        # NOTE: These are *default* constraints--on model instances constraints\n        # are taken from the model if set, otherwise the defaults set here are\n        # used\n        if bounds is not None:\n            if min is not None or max is not None:\n                raise ValueError(\n                    'bounds may not be specified simultaneously with min or '\n                    'max when instantiating Parameter {}'.format(name))\n        else:\n            bounds = (min, max)\n\n        self._fixed = fixed\n        self._tied = tied\n        self._bounds = bounds\n        self._order = None\n\n        self._validator = None\n        self._prior = prior\n        self._posterior = posterior\n\n        self._std = None\n\n    def __set_name__(self, owner, name):\n        self._name = name\n\n    def __len__(self):\n        val = self.value\n        if val.shape == ():\n            return 1\n        else:\n            return val.shape[0]\n\n    def __getitem__(self, key):\n        value = self.value\n        if len(value.shape) == 0:\n            # Wrap the value in a list so that getitem can work for sensible\n            # indices like [0] and [-1]\n            value = [value]\n        return value[key]\n\n    def __setitem__(self, key, value):\n        # Get the existing value and check whether it even makes sense to\n        # apply this index\n        oldvalue = self.value\n        if isinstance(key, slice):\n            if len(oldvalue[key]) == 0:\n                raise InputParameterError(\n                    \"Slice assignment outside the parameter dimensions for \"\n                    \"'{}'\".format(self.name))\n            for idx, val in zip(range(*key.indices(len(self))), value):\n                self.__setitem__(idx, val)\n        else:\n            try:\n                oldvalue[key] = value\n            except IndexError:\n                raise InputParameterError(\n                    \"Input dimension {} invalid for {!r} parameter with \"\n                    \"dimension {}\".format(key, self.name, value.shape[0]))  # likely wrong\n\n    def __repr__(self):\n        args = f\"'{self._name}'\"\n        args += f', value={self.value}'\n\n        if self.unit is not None:\n            args += f', unit={self.unit}'\n\n        for cons in self.constraints:\n            val = getattr(self, cons)\n            if val not in (None, False, (None, None)):\n                # Maybe non-obvious, but False is the default for the fixed and\n                # tied constraints\n                args += f', {cons}={val}'\n\n        return f\"{self.__class__.__name__}({args})\"\n\n    @property\n    def name(self):\n        \"\"\"Parameter name\"\"\"\n\n        return self._name\n\n    @property\n    def default(self):\n        \"\"\"Parameter default value\"\"\"\n        return self._default\n\n    @property\n    def value(self):\n        \"\"\"The unadorned value proxied by this parameter.\"\"\"\n        if self._getter is None and self._setter is None:\n            return np.float64(self._value)\n        else:\n            # This new implementation uses the names of internal_unit\n            # in place of raw_unit used previously. The contrast between\n            # internal values and units is that between the public\n            # units that the parameter advertises to what it actually\n            # uses internally.\n            if self.internal_unit:\n                return np.float64(self._getter(self._internal_value,\n                                               self.internal_unit,\n                                               self.unit).value)\n            elif self._getter:\n                return np.float64(self._getter(self._internal_value))\n            elif self._setter:\n                return np.float64(self._internal_value)\n\n    @value.setter\n    def value(self, value):\n        if isinstance(value, Quantity):\n            raise TypeError(\"The .value property on parameters should be set\"\n                            \" to unitless values, not Quantity objects. To set\"\n                            \"a parameter to a quantity simply set the \"\n                            \"parameter directly without using .value\")\n        if self._setter is None:\n            self._value = np.array(value, dtype=np.float64)\n        else:\n            self._internal_value = np.array(self._setter(value),\n                                            dtype=np.float64)\n\n    @property\n    def unit(self):\n        \"\"\"\n        The unit attached to this parameter, if any.\n\n        On unbound parameters (i.e. parameters accessed through the\n        model class, rather than a model instance) this is the required/\n        default unit for the parameter.\n        \"\"\"\n\n        return self._unit\n\n    @unit.setter\n    def unit(self, unit):\n        if self.unit is None:\n            raise ValueError('Cannot attach units to parameters that were '\n                             'not initially specified with units')\n        else:\n            raise ValueError('Cannot change the unit attribute directly, '\n                             'instead change the parameter to a new quantity')\n\n    def _set_unit(self, unit, force=False):\n        if force:\n            self._unit = unit\n        else:\n            self.unit = unit\n\n    @property\n    def internal_unit(self):\n        \"\"\"\n        Return the internal unit the parameter uses for the internal value stored\n        \"\"\"\n        return self._internal_unit\n\n    @internal_unit.setter\n    def internal_unit(self, internal_unit):\n        \"\"\"\n        Set the unit the parameter will convert the supplied value to the\n        representation used internally.\n        \"\"\"\n        self._internal_unit = internal_unit\n\n    @property\n    def quantity(self):\n        \"\"\"\n        This parameter, as a :class:`~astropy.units.Quantity` instance.\n        \"\"\"\n        if self.unit is None:\n            return None\n        return self.value * self.unit\n\n    @quantity.setter\n    def quantity(self, quantity):\n        if not isinstance(quantity, Quantity):\n            raise TypeError(\"The .quantity attribute should be set \"\n                            \"to a Quantity object\")\n        self.value = quantity.value\n        self._unit = quantity.unit\n\n    @property\n    def shape(self):\n        \"\"\"The shape of this parameter's value array.\"\"\"\n        if self._setter is None:\n            return self._value.shape\n        return self._internal_value.shape\n\n    @shape.setter\n    def shape(self, value):\n        if isinstance(self.value, np.generic):\n            if value not in ((), (1,)):\n                raise ValueError(\"Cannot assign this shape to a scalar quantity\")\n        else:\n            self.value.shape = value\n\n    @property\n    def size(self):\n        \"\"\"The size of this parameter's value array.\"\"\"\n\n        return np.size(self.value)\n\n    @property\n    def std(self):\n        \"\"\"Standard deviation, if available from fit.\"\"\"\n\n        return self._std\n\n    @std.setter\n    def std(self, value):\n\n        self._std = value\n\n    @property\n    def prior(self):\n        return self._prior\n\n    @prior.setter\n    def prior(self, val):\n        self._prior = val\n\n    @property\n    def posterior(self):\n        return self._posterior\n\n    @posterior.setter\n    def posterior(self, val):\n        self._posterior = val\n\n    @property\n    def fixed(self):\n        \"\"\"\n        Boolean indicating if the parameter is kept fixed during fitting.\n        \"\"\"\n        return self._fixed\n\n    @fixed.setter\n    def fixed(self, value):\n        \"\"\" Fix a parameter. \"\"\"\n        if not isinstance(value, bool):\n            raise ValueError(\"Value must be boolean\")\n        self._fixed = value\n\n    @property\n    def tied(self):\n        \"\"\"\n        Indicates that this parameter is linked to another one.\n\n        A callable which provides the relationship of the two parameters.\n        \"\"\"\n\n        return self._tied\n\n    @tied.setter\n    def tied(self, value):\n        \"\"\"Tie a parameter\"\"\"\n\n        if not callable(value) and value not in (False, None):\n            raise TypeError(\"Tied must be a callable or set to False or None\")\n        self._tied = value\n\n    @property\n    def bounds(self):\n        \"\"\"The minimum and maximum values of a parameter as a tuple\"\"\"\n\n        return self._bounds\n\n    @bounds.setter\n    def bounds(self, value):\n        \"\"\"Set the minimum and maximum values of a parameter from a tuple\"\"\"\n\n        _min, _max = value\n        if _min is not None:\n            if not isinstance(_min, (numbers.Number, Quantity)):\n                raise TypeError(\"Min value must be a number or a Quantity\")\n            if isinstance(_min, Quantity):\n                _min = float(_min.value)\n            else:\n                _min = float(_min)\n\n        if _max is not None:\n            if not isinstance(_max, (numbers.Number, Quantity)):\n                raise TypeError(\"Max value must be a number or a Quantity\")\n            if isinstance(_max, Quantity):\n                _max = float(_max.value)\n            else:\n                _max = float(_max)\n\n        self._bounds = (_min, _max)\n\n    @property\n    def min(self):\n        \"\"\"A value used as a lower bound when fitting a parameter\"\"\"\n\n        return self.bounds[0]\n\n    @min.setter\n    def min(self, value):\n        \"\"\"Set a minimum value of a parameter\"\"\"\n\n        self.bounds = (value, self.max)\n\n    @property\n    def max(self):\n        \"\"\"A value used as an upper bound when fitting a parameter\"\"\"\n\n        return self.bounds[1]\n\n    @max.setter\n    def max(self, value):\n        \"\"\"Set a maximum value of a parameter.\"\"\"\n\n        self.bounds = (self.min, value)\n\n    @property\n    def validator(self):\n        \"\"\"\n        Used as a decorator to set the validator method for a `Parameter`.\n        The validator method validates any value set for that parameter.\n        It takes two arguments--``self``, which refers to the `Model`\n        instance (remember, this is a method defined on a `Model`), and\n        the value being set for this parameter.  The validator method's\n        return value is ignored, but it may raise an exception if the value\n        set on the parameter is invalid (typically an `InputParameterError`\n        should be raised, though this is not currently a requirement).\n\n        \"\"\"\n\n        def validator(func, self=self):\n            if callable(func):\n                self._validator = func\n                return self\n            else:\n                raise ValueError(\"This decorator method expects a callable.\\n\"\n                                 \"The use of this method as a direct validator is\\n\"\n                                 \"deprecated; use the new validate method instead\\n\")\n        return validator\n\n    def validate(self, value):\n        \"\"\" Run the validator on this parameter\"\"\"\n        if self._validator is not None and self._model is not None:\n            self._validator(self._model, value)\n\n    def copy(self, name=None, description=None, default=None, unit=None,\n             getter=None, setter=None, fixed=False, tied=False, min=None,\n             max=None, bounds=None, prior=None, posterior=None):\n        \"\"\"\n        Make a copy of this `Parameter`, overriding any of its core attributes\n        in the process (or an exact copy).\n\n        The arguments to this method are the same as those for the `Parameter`\n        initializer.  This simply returns a new `Parameter` instance with any\n        or all of the attributes overridden, and so returns the equivalent of:\n\n        .. code:: python\n\n            Parameter(self.name, self.description, ...)\n\n        \"\"\"\n\n        kwargs = locals().copy()\n        del kwargs['self']\n\n        for key, value in kwargs.items():\n            if value is None:\n                # Annoying special cases for min/max where are just aliases for\n                # the components of bounds\n                if key in ('min', 'max'):\n                    continue\n                else:\n                    if hasattr(self, key):\n                        value = getattr(self, key)\n                    elif hasattr(self, '_' + key):\n                        value = getattr(self, '_' + key)\n                kwargs[key] = value\n\n        return self.__class__(**kwargs)\n\n    @property\n    def model(self):\n        \"\"\" Return the model this  parameter is associated with.\"\"\"\n        return self._model\n\n    @model.setter\n    def model(self, value):\n        self._model = value\n        self._setter = self._create_value_wrapper(self._setter, value)\n        self._getter = self._create_value_wrapper(self._getter, value)\n        if self._model_required:\n            if self._default is not None:\n                self.value = self._default\n            else:\n                self._value = None\n\n    @property\n    def _raw_value(self):\n        \"\"\"\n        Currently for internal use only.\n\n        Like Parameter.value but does not pass the result through\n        Parameter.getter.  By design this should only be used from bound\n        parameters.\n\n        This will probably be removed are retweaked at some point in the\n        process of rethinking how parameter values are stored/updated.\n        \"\"\"\n        if self._setter:\n            return self._internal_value\n        return self.value\n\n    def _create_value_wrapper(self, wrapper, model):\n        \"\"\"Wraps a getter/setter function to support optionally passing in\n        a reference to the model object as the second argument.\n        If a model is tied to this parameter and its getter/setter supports\n        a second argument then this creates a partial function using the model\n        instance as the second argument.\n        \"\"\"\n\n        if isinstance(wrapper, np.ufunc):\n            if wrapper.nin != 1:\n                raise TypeError(\"A numpy.ufunc used for Parameter \"\n                                \"getter/setter may only take one input \"\n                                \"argument\")\n        elif wrapper is None:\n            # Just allow non-wrappers to fall through silently, for convenience\n            return None\n        else:\n            inputs, _ = get_inputs_and_params(wrapper)\n            nargs = len(inputs)\n\n            if nargs == 1:\n                pass\n            elif nargs == 2:\n                self._model_required = True\n                if model is not None:\n                    # Don't make a partial function unless we're tied to a\n                    # specific model instance\n                    model_arg = inputs[1].name\n                    wrapper = functools.partial(wrapper, **{model_arg: model})\n            else:\n                raise TypeError(\"Parameter getter/setter must be a function \"\n                                \"of either one or two arguments\")\n\n        return wrapper\n\n    def __array__(self, dtype=None):\n        # Make np.asarray(self) work a little more straightforwardly\n        arr = np.asarray(self.value, dtype=dtype)\n\n        if self.unit is not None:\n            arr = Quantity(arr, self.unit, copy=False)\n\n        return arr\n\n    def __bool__(self):\n        return bool(np.all(self.value))\n\n    __add__ = _binary_arithmetic_operation(operator.add)\n    __radd__ = _binary_arithmetic_operation(operator.add, reflected=True)\n    __sub__ = _binary_arithmetic_operation(operator.sub)\n    __rsub__ = _binary_arithmetic_operation(operator.sub, reflected=True)\n    __mul__ = _binary_arithmetic_operation(operator.mul)\n    __rmul__ = _binary_arithmetic_operation(operator.mul, reflected=True)\n    __pow__ = _binary_arithmetic_operation(operator.pow)\n    __rpow__ = _binary_arithmetic_operation(operator.pow, reflected=True)\n    __truediv__ = _binary_arithmetic_operation(operator.truediv)\n    __rtruediv__ = _binary_arithmetic_operation(operator.truediv,\n                                                reflected=True)\n    __eq__ = _binary_comparison_operation(operator.eq)\n    __ne__ = _binary_comparison_operation(operator.ne)\n    __lt__ = _binary_comparison_operation(operator.lt)\n    __gt__ = _binary_comparison_operation(operator.gt)\n    __le__ = _binary_comparison_operation(operator.le)\n    __ge__ = _binary_comparison_operation(operator.ge)\n    __neg__ = _unary_arithmetic_operation(operator.neg)\n    __abs__ = _unary_arithmetic_operation(operator.abs)\n\n\ndef param_repr_oneline(param):\n    \"\"\"\n    Like array_repr_oneline but works on `Parameter` objects and supports\n    rendering parameters with units like quantities.\n    \"\"\"\n\n    out = array_repr_oneline(param.value)\n    if param.unit is not None:\n        out = f'{out} {param.unit!s}'\n    return out\n"},{"className":"_SkyRotation","col":0,"comment":"\n    Base class for RotateNative2Celestial and RotateCelestial2Native.\n    ","endLoc":284,"id":12707,"nodeType":"Class","startLoc":260,"text":"class _SkyRotation(_EulerRotation, Model):\n    \"\"\"\n    Base class for RotateNative2Celestial and RotateCelestial2Native.\n    \"\"\"\n\n    lon = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian, description=\"Latitude\")\n    lat = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian, description=\"Longtitude\")\n    lon_pole = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian, description=\"Longitude of a pole\")\n\n    def __init__(self, lon, lat, lon_pole, **kwargs):\n        qs = [isinstance(par, u.Quantity) for par in [lon, lat, lon_pole]]\n        if any(qs) and not all(qs):\n            raise TypeError(\"All parameters should be of the same type - float or Quantity.\")\n        super().__init__(lon, lat, lon_pole, **kwargs)\n        self.axes_order = 'zxz'\n\n    def _evaluate(self, phi, theta, lon, lat, lon_pole):\n        alpha, delta = super().evaluate(phi, theta, lon, lat, lon_pole,\n                                        self.axes_order)\n        mask = alpha < 0\n        if isinstance(mask, np.ndarray):\n            alpha[mask] += 360\n        else:\n            alpha += 360\n        return alpha, delta"},{"col":4,"comment":"null","endLoc":274,"header":"def __init__(self, lon, lat, lon_pole, **kwargs)","id":12708,"name":"__init__","nodeType":"Function","startLoc":269,"text":"def __init__(self, lon, lat, lon_pole, **kwargs):\n        qs = [isinstance(par, u.Quantity) for par in [lon, lat, lon_pole]]\n        if any(qs) and not all(qs):\n            raise TypeError(\"All parameters should be of the same type - float or Quantity.\")\n        super().__init__(lon, lat, lon_pole, **kwargs)\n        self.axes_order = 'zxz'"},{"className":"ParameterDefinitionError","col":0,"comment":"Exception in declaration of class-level Parameters.","endLoc":36,"id":12709,"nodeType":"Class","startLoc":35,"text":"class ParameterDefinitionError(ParameterError):\n    \"\"\"Exception in declaration of class-level Parameters.\"\"\""},{"col":0,"comment":"null","endLoc":83,"header":"def _binary_arithmetic_operation(op, reflected=False)","id":12710,"name":"_binary_arithmetic_operation","nodeType":"Function","startLoc":69,"text":"def _binary_arithmetic_operation(op, reflected=False):\n    @functools.wraps(op)\n    def wrapper(self, val):\n\n        if self.unit is not None:\n            self_value = Quantity(self.value, self.unit)\n        else:\n            self_value = self.value\n\n        if reflected:\n            return op(val, self_value)\n        else:\n            return op(self_value, val)\n\n    return wrapper"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":44,"id":12711,"name":"alpha","nodeType":"Attribute","startLoc":44,"text":"alpha"},{"attributeType":"null","col":8,"comment":"null","endLoc":3095,"id":12712,"name":"prec","nodeType":"Attribute","startLoc":3095,"text":"self.prec"},{"attributeType":"null","col":12,"comment":"null","endLoc":2951,"id":12713,"name":"log","nodeType":"Attribute","startLoc":2951,"text":"self.log"},{"attributeType":"null","col":8,"comment":"null","endLoc":3126,"id":12714,"name":"preclist","nodeType":"Attribute","startLoc":3126,"text":"self.preclist"},{"attributeType":"None","col":8,"comment":"null","endLoc":2941,"id":12715,"name":"start","nodeType":"Attribute","startLoc":2941,"text":"self.start"},{"attributeType":"None","col":8,"comment":"null","endLoc":2943,"id":12716,"name":"tokens","nodeType":"Attribute","startLoc":2943,"text":"self.tokens"},{"attributeType":"None","col":8,"comment":"null","endLoc":2942,"id":12717,"name":"error_func","nodeType":"Attribute","startLoc":2942,"text":"self.error_func"},{"attributeType":"null","col":8,"comment":"null","endLoc":2946,"id":12718,"name":"error","nodeType":"Attribute","startLoc":2946,"text":"self.error"},{"attributeType":"null","col":8,"comment":"null","endLoc":3147,"id":12719,"name":"pfuncs","nodeType":"Attribute","startLoc":3147,"text":"self.pfuncs"},{"attributeType":"null","col":8,"comment":"null","endLoc":2944,"id":12720,"name":"modules","nodeType":"Attribute","startLoc":2944,"text":"self.modules"},{"attributeType":"null","col":8,"comment":"null","endLoc":2940,"id":12721,"name":"pdict","nodeType":"Attribute","startLoc":2940,"text":"self.pdict"},{"col":0,"comment":"null","endLoc":176,"header":"def errok()","id":12722,"name":"errok","nodeType":"Function","startLoc":174,"text":"def errok():\n    warnings.warn(_warnmsg)\n    return _errok()"},{"col":4,"comment":"null","endLoc":284,"header":"def _evaluate(self, phi, theta, lon, lat, lon_pole)","id":12723,"name":"_evaluate","nodeType":"Function","startLoc":276,"text":"def _evaluate(self, phi, theta, lon, lat, lon_pole):\n        alpha, delta = super().evaluate(phi, theta, lon, lat, lon_pole,\n                                        self.axes_order)\n        mask = alpha < 0\n        if isinstance(mask, np.ndarray):\n            alpha[mask] += 360\n        else:\n            alpha += 360\n        return alpha, delta"},{"className":"BrokenPowerLaw1D","col":0,"comment":"\n    One dimensional power law model with a break.\n\n    Parameters\n    ----------\n    amplitude : float\n        Model amplitude at the break point.\n    x_break : float\n        Break point.\n    alpha_1 : float\n        Power law index for x < x_break.\n    alpha_2 : float\n        Power law index for x > x_break.\n\n    See Also\n    --------\n    PowerLaw1D, ExponentialCutoffPowerLaw1D, LogParabola1D\n\n    Notes\n    -----\n    Model formula (with :math:`A` for ``amplitude`` and :math:`\\alpha_1`\n    for ``alpha_1`` and :math:`\\alpha_2` for ``alpha_2``):\n\n        .. math::\n\n            f(x) = \\left \\{\n                     \\begin{array}{ll}\n                       A (x / x_{break}) ^ {-\\alpha_1} & : x < x_{break} \\\\\n                       A (x / x_{break}) ^ {-\\alpha_2} & :  x > x_{break} \\\\\n                     \\end{array}\n                   \\right.\n    ","endLoc":145,"id":12724,"nodeType":"Class","startLoc":75,"text":"class BrokenPowerLaw1D(Fittable1DModel):\n    \"\"\"\n    One dimensional power law model with a break.\n\n    Parameters\n    ----------\n    amplitude : float\n        Model amplitude at the break point.\n    x_break : float\n        Break point.\n    alpha_1 : float\n        Power law index for x < x_break.\n    alpha_2 : float\n        Power law index for x > x_break.\n\n    See Also\n    --------\n    PowerLaw1D, ExponentialCutoffPowerLaw1D, LogParabola1D\n\n    Notes\n    -----\n    Model formula (with :math:`A` for ``amplitude`` and :math:`\\\\alpha_1`\n    for ``alpha_1`` and :math:`\\\\alpha_2` for ``alpha_2``):\n\n        .. math::\n\n            f(x) = \\\\left \\\\{\n                     \\\\begin{array}{ll}\n                       A (x / x_{break}) ^ {-\\\\alpha_1} & : x < x_{break} \\\\\\\\\n                       A (x / x_{break}) ^ {-\\\\alpha_2} & :  x > x_{break} \\\\\\\\\n                     \\\\end{array}\n                   \\\\right.\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Peak value at break point\")\n    x_break = Parameter(default=1, description=\"Break point\")\n    alpha_1 = Parameter(default=1, description=\"Power law index before break point\")\n    alpha_2 = Parameter(default=1, description=\"Power law index after break point\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_break, alpha_1, alpha_2):\n        \"\"\"One dimensional broken power law model function\"\"\"\n\n        alpha = np.where(x < x_break, alpha_1, alpha_2)\n        xx = x / x_break\n        return amplitude * xx ** (-alpha)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, x_break, alpha_1, alpha_2):\n        \"\"\"One dimensional broken power law derivative with respect to parameters\"\"\"\n\n        alpha = np.where(x < x_break, alpha_1, alpha_2)\n        xx = x / x_break\n\n        d_amplitude = xx ** (-alpha)\n        d_x_break = amplitude * alpha * d_amplitude / x_break\n        d_alpha = -amplitude * d_amplitude * np.log(xx)\n        d_alpha_1 = np.where(x < x_break, d_alpha, 0)\n        d_alpha_2 = np.where(x >= x_break, d_alpha, 0)\n\n        return [d_amplitude, d_x_break, d_alpha_1, d_alpha_2]\n\n    @property\n    def input_units(self):\n        if self.x_break.unit is None:\n            return None\n        return {self.inputs[0]: self.x_break.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_break': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"col":4,"comment":"One dimensional broken power law model function","endLoc":120,"header":"@staticmethod\n    def evaluate(x, amplitude, x_break, alpha_1, alpha_2)","id":12725,"name":"evaluate","nodeType":"Function","startLoc":114,"text":"@staticmethod\n    def evaluate(x, amplitude, x_break, alpha_1, alpha_2):\n        \"\"\"One dimensional broken power law model function\"\"\"\n\n        alpha = np.where(x < x_break, alpha_1, alpha_2)\n        xx = x / x_break\n        return amplitude * xx ** (-alpha)"},{"col":4,"comment":"\n        Calculate scale density of the NFW profile.\n        ","endLoc":599,"header":"def _density_s(self, mass, concentration)","id":12726,"name":"_density_s","nodeType":"Function","startLoc":584,"text":"def _density_s(self, mass, concentration):\n        \"\"\"\n        Calculate scale density of the NFW profile.\n        \"\"\"\n        # Enforce default units\n        if not isinstance(mass, u.Quantity):\n            in_mass = u.Quantity(mass, u.M_sun)\n        else:\n            in_mass = mass\n\n        # Calculate scale density\n        # M_{200} = 4\\pi \\rho_{s} R_{s}^3 \\left[\\ln(1+c) - \\frac{c}{1+c}\\right].\n        self.density_s = in_mass / (4.0 * np.pi * self._radius_s(in_mass, concentration) ** 3 *\n                                    self.A_NFW(concentration))\n\n        return self.density_s"},{"col":4,"comment":"\n        Dimensionless volume integral of the NFW profile, used as an intermediate step in some\n        calculations for this model.\n\n        Notes\n        -----\n\n        Model formula:\n\n        .. math:: A_{NFW} = [\\ln(1+y) - \\frac{y}{1+y}]\n        ","endLoc":582,"header":"@staticmethod\n    def A_NFW(y)","id":12727,"name":"A_NFW","nodeType":"Function","startLoc":569,"text":"@staticmethod\n    def A_NFW(y):\n        r\"\"\"\n        Dimensionless volume integral of the NFW profile, used as an intermediate step in some\n        calculations for this model.\n\n        Notes\n        -----\n\n        Model formula:\n\n        .. math:: A_{NFW} = [\\ln(1+y) - \\frac{y}{1+y}]\n        \"\"\"\n        return np.log(1.0 + y) - (y / (1.0 + y))"},{"col":4,"comment":"One dimensional broken power law derivative with respect to parameters","endLoc":135,"header":"@staticmethod\n    def fit_deriv(x, amplitude, x_break, alpha_1, alpha_2)","id":12728,"name":"fit_deriv","nodeType":"Function","startLoc":122,"text":"@staticmethod\n    def fit_deriv(x, amplitude, x_break, alpha_1, alpha_2):\n        \"\"\"One dimensional broken power law derivative with respect to parameters\"\"\"\n\n        alpha = np.where(x < x_break, alpha_1, alpha_2)\n        xx = x / x_break\n\n        d_amplitude = xx ** (-alpha)\n        d_x_break = amplitude * alpha * d_amplitude / x_break\n        d_alpha = -amplitude * d_amplitude * np.log(xx)\n        d_alpha_1 = np.where(x < x_break, d_alpha, 0)\n        d_alpha_2 = np.where(x >= x_break, d_alpha, 0)\n\n        return [d_amplitude, d_x_break, d_alpha_1, d_alpha_2]"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":265,"id":12729,"name":"lon","nodeType":"Attribute","startLoc":265,"text":"lon"},{"col":4,"comment":"null","endLoc":141,"header":"@property\n    def input_units(self)","id":12730,"name":"input_units","nodeType":"Function","startLoc":137,"text":"@property\n    def input_units(self):\n        if self.x_break.unit is None:\n            return None\n        return {self.inputs[0]: self.x_break.unit}"},{"col":4,"comment":"null","endLoc":145,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":12731,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":143,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_break': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":109,"id":12732,"name":"amplitude","nodeType":"Attribute","startLoc":109,"text":"amplitude"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":110,"id":12733,"name":"x_break","nodeType":"Attribute","startLoc":110,"text":"x_break"},{"col":0,"comment":"null","endLoc":180,"header":"def restart()","id":12734,"name":"restart","nodeType":"Function","startLoc":178,"text":"def restart():\n    warnings.warn(_warnmsg)\n    return _restart()"},{"col":0,"comment":"null","endLoc":184,"header":"def token()","id":12735,"name":"token","nodeType":"Function","startLoc":182,"text":"def token():\n    warnings.warn(_warnmsg)\n    return _token()"},{"col":4,"comment":"\n        The name of this model class--equivalent to ``cls.__name__``.\n\n        This attribute is provided for symmetry with the `Model.name` attribute\n        of model instances.\n        ","endLoc":188,"header":"@property\n    def name(cls)","id":12736,"name":"name","nodeType":"Function","startLoc":179,"text":"@property\n    def name(cls):\n        \"\"\"\n        The name of this model class--equivalent to ``cls.__name__``.\n\n        This attribute is provided for symmetry with the `Model.name` attribute\n        of model instances.\n        \"\"\"\n\n        return cls.__name__"},{"col":4,"comment":"\n        A class-level property that determines whether the class is a concrete\n        implementation of a Model--i.e. it is not some abstract base class or\n        internal implementation detail (i.e. begins with '_').\n        ","endLoc":197,"header":"@property\n    def _is_concrete(cls)","id":12737,"name":"_is_concrete","nodeType":"Function","startLoc":190,"text":"@property\n    def _is_concrete(cls):\n        \"\"\"\n        A class-level property that determines whether the class is a concrete\n        implementation of a Model--i.e. it is not some abstract base class or\n        internal implementation detail (i.e. begins with '_').\n        \"\"\"\n        return not (cls.__name__.startswith('_') or inspect.isabstract(cls))"},{"col":4,"comment":"\n        Creates a copy of this model class with a new name, inputs or outputs.\n\n        The new class is technically a subclass of the original class, so that\n        instance and type checks will still work.  For example::\n\n            >>> from astropy.modeling.models import Rotation2D\n            >>> SkyRotation = Rotation2D.rename('SkyRotation')\n            >>> SkyRotation\n            <class 'astropy.modeling.core.SkyRotation'>\n            Name: SkyRotation (Rotation2D)\n            N_inputs: 2\n            N_outputs: 2\n            Fittable parameters: ('angle',)\n            >>> issubclass(SkyRotation, Rotation2D)\n            True\n            >>> r = SkyRotation(90)\n            >>> isinstance(r, Rotation2D)\n            True\n        ","endLoc":247,"header":"def rename(cls, name=None, inputs=None, outputs=None)","id":12738,"name":"rename","nodeType":"Function","startLoc":199,"text":"def rename(cls, name=None, inputs=None, outputs=None):\n        \"\"\"\n        Creates a copy of this model class with a new name, inputs or outputs.\n\n        The new class is technically a subclass of the original class, so that\n        instance and type checks will still work.  For example::\n\n            >>> from astropy.modeling.models import Rotation2D\n            >>> SkyRotation = Rotation2D.rename('SkyRotation')\n            >>> SkyRotation\n            <class 'astropy.modeling.core.SkyRotation'>\n            Name: SkyRotation (Rotation2D)\n            N_inputs: 2\n            N_outputs: 2\n            Fittable parameters: ('angle',)\n            >>> issubclass(SkyRotation, Rotation2D)\n            True\n            >>> r = SkyRotation(90)\n            >>> isinstance(r, Rotation2D)\n            True\n        \"\"\"\n\n        mod = find_current_module(2)\n        if mod:\n            modname = mod.__name__\n        else:\n            modname = '__main__'\n\n        if name is None:\n            name = cls.name\n        if inputs is None:\n            inputs = cls.inputs\n        else:\n            if not isinstance(inputs, tuple):\n                raise TypeError(\"Expected 'inputs' to be a tuple of strings.\")\n            elif len(inputs) != len(cls.inputs):\n                raise ValueError(f'{cls.name} expects {len(cls.inputs)} inputs')\n        if outputs is None:\n            outputs = cls.outputs\n        else:\n            if not isinstance(outputs, tuple):\n                raise TypeError(\"Expected 'outputs' to be a tuple of strings.\")\n            elif len(outputs) != len(cls.outputs):\n                raise ValueError(f'{cls.name} expects {len(cls.outputs)} outputs')\n        new_cls = type(name, (cls,), {\"inputs\": inputs, \"outputs\": outputs})\n        new_cls.__module__ = modname\n        new_cls.__qualname__ = name\n\n        return new_cls"},{"attributeType":"null","col":0,"comment":"null","endLoc":69,"id":12739,"name":"__version__","nodeType":"Attribute","startLoc":69,"text":"__version__"},{"attributeType":"null","col":0,"comment":"null","endLoc":70,"id":12740,"name":"__tabversion__","nodeType":"Attribute","startLoc":70,"text":"__tabversion__"},{"attributeType":"null","col":0,"comment":"null","endLoc":78,"id":12741,"name":"yaccdebug","nodeType":"Attribute","startLoc":78,"text":"yaccdebug"},{"attributeType":"null","col":0,"comment":"null","endLoc":81,"id":12742,"name":"debug_file","nodeType":"Attribute","startLoc":81,"text":"debug_file"},{"attributeType":"null","col":0,"comment":"null","endLoc":82,"id":12743,"name":"tab_module","nodeType":"Attribute","startLoc":82,"text":"tab_module"},{"attributeType":"null","col":0,"comment":"null","endLoc":83,"id":12744,"name":"default_lr","nodeType":"Attribute","startLoc":83,"text":"default_lr"},{"attributeType":"null","col":0,"comment":"null","endLoc":85,"id":12745,"name":"error_count","nodeType":"Attribute","startLoc":85,"text":"error_count"},{"attributeType":"null","col":0,"comment":"null","endLoc":87,"id":12746,"name":"yaccdevel","nodeType":"Attribute","startLoc":87,"text":"yaccdevel"},{"attributeType":"null","col":0,"comment":"null","endLoc":90,"id":12747,"name":"resultlimit","nodeType":"Attribute","startLoc":90,"text":"resultlimit"},{"attributeType":"null","col":0,"comment":"null","endLoc":92,"id":12748,"name":"pickle_protocol","nodeType":"Attribute","startLoc":92,"text":"pickle_protocol"},{"attributeType":"null","col":4,"comment":"null","endLoc":96,"id":12749,"name":"string_types","nodeType":"Attribute","startLoc":96,"text":"string_types"},{"attributeType":"null","col":4,"comment":"null","endLoc":98,"id":12750,"name":"string_types","nodeType":"Attribute","startLoc":98,"text":"string_types"},{"attributeType":"null","col":0,"comment":"null","endLoc":100,"id":12751,"name":"MAXINT","nodeType":"Attribute","startLoc":100,"text":"MAXINT"},{"attributeType":"None","col":0,"comment":"null","endLoc":160,"id":12752,"name":"_errok","nodeType":"Attribute","startLoc":160,"text":"_errok"},{"attributeType":"None","col":0,"comment":"null","endLoc":161,"id":12753,"name":"_token","nodeType":"Attribute","startLoc":161,"text":"_token"},{"attributeType":"None","col":0,"comment":"null","endLoc":162,"id":12754,"name":"_restart","nodeType":"Attribute","startLoc":162,"text":"_restart"},{"attributeType":"null","col":0,"comment":"null","endLoc":163,"id":12755,"name":"_warnmsg","nodeType":"Attribute","startLoc":163,"text":"_warnmsg"},{"attributeType":"null","col":0,"comment":"null","endLoc":1285,"id":12756,"name":"_is_identifier","nodeType":"Attribute","startLoc":1285,"text":"_is_identifier"},{"col":0,"comment":"","endLoc":62,"header":"yacc.py#<anonymous>","id":12757,"name":"<anonymous>","nodeType":"Function","startLoc":62,"text":"__version__    = '3.11'\n\n__tabversion__ = '3.10'\n\nyaccdebug   = True             # Debugging mode.  If set, yacc generates a\n\ndebug_file  = 'parser.out'     # Default name of the debugging file\n\ntab_module  = 'parsetab'       # Default name of the table module\n\ndefault_lr  = 'LALR'           # Default LR table generation method\n\nerror_count = 3                # Number of symbols that must be shifted to leave recovery mode\n\nyaccdevel   = False            # Set to True if developing yacc.  This turns off optimized\n\nresultlimit = 40               # Size limit of results when running in debug mode.\n\npickle_protocol = 0            # Protocol to use when writing pickle files\n\nif sys.version_info[0] < 3:\n    string_types = basestring\nelse:\n    string_types = str\n\nMAXINT = sys.maxsize\n\n_errok = None\n\n_token = None\n\n_restart = None\n\n_warnmsg = '''PLY: Don't use global functions errok(), token(), and restart() in p_error().\nInstead, invoke the methods on the associated parser instance:\n\n    def p_error(p):\n        ...\n        # Use parser.errok(), parser.token(), parser.restart()\n        ...\n\n    parser = yacc.yacc()\n'''\n\n_is_identifier = re.compile(r'^[a-zA-Z0-9_-]+$')"},{"attributeType":"null","col":4,"comment":"\n    This flag signifies whether this class was created in the \"normal\" way,\n    with a class statement in the body of a module, as opposed to a call to\n    `type` or some other metaclass constructor, such that the resulting class\n    does not belong to a specific module.  This is important for pickling of\n    dynamic classes.\n\n    This flag is always forced to False for new classes, so code that creates\n    dynamic classes should manually set it to True on those classes when\n    creating them.\n    ","endLoc":72,"id":12758,"name":"_is_dynamic","nodeType":"Attribute","startLoc":72,"text":"_is_dynamic"},{"fileName":"functional_models.py","filePath":"astropy/modeling","id":12759,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"Mathematical models.\"\"\"\n# pylint: disable=line-too-long, too-many-lines, too-many-arguments, invalid-name\nimport numpy as np\n\nfrom astropy import units as u\nfrom astropy.units import Quantity, UnitsError\nfrom .core import (Fittable1DModel, Fittable2DModel)\n\nfrom .parameters import Parameter, InputParameterError\nfrom .utils import ellipse_extent\n\n\n__all__ = ['AiryDisk2D', 'Moffat1D', 'Moffat2D', 'Box1D', 'Box2D', 'Const1D',\n           'Const2D', 'Ellipse2D', 'Disk2D', 'Gaussian1D', 'Gaussian2D',\n           'Linear1D', 'Lorentz1D', 'RickerWavelet1D', 'RickerWavelet2D',\n           'RedshiftScaleFactor', 'Multiply', 'Planar2D', 'Scale',\n           'Sersic1D', 'Sersic2D', 'Shift',\n           'Sine1D', 'Cosine1D', 'Tangent1D',\n           'ArcSine1D', 'ArcCosine1D', 'ArcTangent1D',\n           'Trapezoid1D', 'TrapezoidDisk2D', 'Ring2D', 'Voigt1D',\n           'KingProjectedAnalytic1D', 'Exponential1D', 'Logarithmic1D']\n\nTWOPI = 2 * np.pi\nFLOAT_EPSILON = float(np.finfo(np.float32).tiny)\n\n# Note that we define this here rather than using the value defined in\n# astropy.stats to avoid importing astropy.stats every time astropy.modeling\n# is loaded.\nGAUSSIAN_SIGMA_TO_FWHM = 2.0 * np.sqrt(2.0 * np.log(2.0))\n\n\nclass Gaussian1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Gaussian model.\n\n    Parameters\n    ----------\n    amplitude : float or `~astropy.units.Quantity`.\n        Amplitude (peak value) of the Gaussian - for a normalized profile\n        (integrating to 1), set amplitude = 1 / (stddev * np.sqrt(2 * np.pi))\n    mean : float or `~astropy.units.Quantity`.\n        Mean of the Gaussian.\n    stddev : float or `~astropy.units.Quantity`.\n        Standard deviation of the Gaussian with FWHM = 2 * stddev * np.sqrt(2 * np.log(2)).\n\n    Notes\n    -----\n    Either all or none of input ``x``, ``mean`` and ``stddev`` must be provided\n    consistently with compatible units or as unitless numbers.\n\n    Model formula:\n\n        .. math:: f(x) = A e^{- \\\\frac{\\\\left(x - x_{0}\\\\right)^{2}}{2 \\\\sigma^{2}}}\n\n    Examples\n    --------\n    >>> from astropy.modeling import models\n    >>> def tie_center(model):\n    ...         mean = 50 * model.stddev\n    ...         return mean\n    >>> tied_parameters = {'mean': tie_center}\n\n    Specify that 'mean' is a tied parameter in one of two ways:\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3,\n    ...                             tied=tied_parameters)\n\n    or\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3)\n    >>> g1.mean.tied\n    False\n    >>> g1.mean.tied = tie_center\n    >>> g1.mean.tied\n    <function tie_center at 0x...>\n\n    Fixed parameters:\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3,\n    ...                        fixed={'stddev': True})\n    >>> g1.stddev.fixed\n    True\n\n    or\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3)\n    >>> g1.stddev.fixed\n    False\n    >>> g1.stddev.fixed = True\n    >>> g1.stddev.fixed\n    True\n\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Gaussian1D\n\n        plt.figure()\n        s1 = Gaussian1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n\n    See Also\n    --------\n    Gaussian2D, Box1D, Moffat1D, Lorentz1D\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude (peak value) of the Gaussian\")\n    mean = Parameter(default=0, description=\"Position of peak (Gaussian)\")\n\n    # Ensure stddev makes sense if its bounds are not explicitly set.\n    # stddev must be non-zero and positive.\n    stddev = Parameter(default=1, bounds=(FLOAT_EPSILON, None), description=\"Standard deviation of the Gaussian\")\n\n    def bounding_box(self, factor=5.5):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``\n\n        Parameters\n        ----------\n        factor : float\n            The multiple of `stddev` used to define the limits.\n            The default is 5.5, corresponding to a relative error < 1e-7.\n\n        Examples\n        --------\n        >>> from astropy.modeling.models import Gaussian1D\n        >>> model = Gaussian1D(mean=0, stddev=2)\n        >>> model.bounding_box\n        (-11.0, 11.0)\n\n        This range can be set directly (see: `Model.bounding_box\n        <astropy.modeling.Model.bounding_box>`) or by using a different factor,\n        like:\n\n        >>> model.bounding_box = model.bounding_box(factor=2)\n        >>> model.bounding_box\n        (-4.0, 4.0)\n        \"\"\"\n\n        x0 = self.mean\n        dx = factor * self.stddev\n\n        return (x0 - dx, x0 + dx)\n\n    @property\n    def fwhm(self):\n        \"\"\"Gaussian full width at half maximum.\"\"\"\n        return self.stddev * GAUSSIAN_SIGMA_TO_FWHM\n\n    @staticmethod\n    def evaluate(x, amplitude, mean, stddev):\n        \"\"\"\n        Gaussian1D model function.\n        \"\"\"\n        return amplitude * np.exp(- 0.5 * (x - mean) ** 2 / stddev ** 2)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, mean, stddev):\n        \"\"\"\n        Gaussian1D model function derivatives.\n        \"\"\"\n\n        d_amplitude = np.exp(-0.5 / stddev ** 2 * (x - mean) ** 2)\n        d_mean = amplitude * d_amplitude * (x - mean) / stddev ** 2\n        d_stddev = amplitude * d_amplitude * (x - mean) ** 2 / stddev ** 3\n        return [d_amplitude, d_mean, d_stddev]\n\n    @property\n    def input_units(self):\n        if self.mean.unit is None:\n            return None\n        return {self.inputs[0]: self.mean.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'mean': inputs_unit[self.inputs[0]],\n                'stddev': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass Gaussian2D(Fittable2DModel):\n    r\"\"\"\n    Two dimensional Gaussian model.\n\n    Parameters\n    ----------\n    amplitude : float or `~astropy.units.Quantity`.\n        Amplitude (peak value) of the Gaussian.\n    x_mean : float or `~astropy.units.Quantity`.\n        Mean of the Gaussian in x.\n    y_mean : float or `~astropy.units.Quantity`.\n        Mean of the Gaussian in y.\n    x_stddev : float or `~astropy.units.Quantity` or None.\n        Standard deviation of the Gaussian in x before rotating by theta. Must\n        be None if a covariance matrix (``cov_matrix``) is provided. If no\n        ``cov_matrix`` is given, ``None`` means the default value (1).\n    y_stddev : float or `~astropy.units.Quantity` or None.\n        Standard deviation of the Gaussian in y before rotating by theta. Must\n        be None if a covariance matrix (``cov_matrix``) is provided. If no\n        ``cov_matrix`` is given, ``None`` means the default value (1).\n    theta : float or `~astropy.units.Quantity`, optional.\n        Rotation angle (value in radians). The rotation angle increases\n        counterclockwise.  Must be None if a covariance matrix (``cov_matrix``)\n        is provided. If no ``cov_matrix`` is given, ``None`` means the default\n        value (0).\n    cov_matrix : ndarray, optional\n        A 2x2 covariance matrix. If specified, overrides the ``x_stddev``,\n        ``y_stddev``, and ``theta`` defaults.\n\n    Notes\n    -----\n    Either all or none of input ``x, y``, ``[x,y]_mean`` and ``[x,y]_stddev``\n    must be provided consistently with compatible units or as unitless numbers.\n\n    Model formula:\n\n        .. math::\n\n            f(x, y) = A e^{-a\\left(x - x_{0}\\right)^{2}  -b\\left(x - x_{0}\\right)\n            \\left(y - y_{0}\\right)  -c\\left(y - y_{0}\\right)^{2}}\n\n    Using the following definitions:\n\n        .. math::\n            a = \\left(\\frac{\\cos^{2}{\\left (\\theta \\right )}}{2 \\sigma_{x}^{2}} +\n            \\frac{\\sin^{2}{\\left (\\theta \\right )}}{2 \\sigma_{y}^{2}}\\right)\n\n            b = \\left(\\frac{\\sin{\\left (2 \\theta \\right )}}{2 \\sigma_{x}^{2}} -\n            \\frac{\\sin{\\left (2 \\theta \\right )}}{2 \\sigma_{y}^{2}}\\right)\n\n            c = \\left(\\frac{\\sin^{2}{\\left (\\theta \\right )}}{2 \\sigma_{x}^{2}} +\n            \\frac{\\cos^{2}{\\left (\\theta \\right )}}{2 \\sigma_{y}^{2}}\\right)\n\n    If using a ``cov_matrix``, the model is of the form:\n        .. math::\n            f(x, y) = A e^{-0.5 \\left(\\vec{x} - \\vec{x}_{0}\\right)^{T} \\Sigma^{-1} \\left(\\vec{x} - \\vec{x}_{0}\\right)}\n\n    where :math:`\\vec{x} = [x, y]`, :math:`\\vec{x}_{0} = [x_{0}, y_{0}]`,\n    and :math:`\\Sigma` is the covariance matrix:\n\n        .. math::\n            \\Sigma = \\left(\\begin{array}{ccc}\n            \\sigma_x^2               & \\rho \\sigma_x \\sigma_y \\\\\n            \\rho \\sigma_x \\sigma_y   & \\sigma_y^2\n            \\end{array}\\right)\n\n    :math:`\\rho` is the correlation between ``x`` and ``y``, which should\n    be between -1 and +1.  Positive correlation corresponds to a\n    ``theta`` in the range 0 to 90 degrees.  Negative correlation\n    corresponds to a ``theta`` in the range of 0 to -90 degrees.\n\n    See [1]_ for more details about the 2D Gaussian function.\n\n    See Also\n    --------\n    Gaussian1D, Box2D, Moffat2D\n\n    References\n    ----------\n    .. [1] https://en.wikipedia.org/wiki/Gaussian_function\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude of the Gaussian\")\n    x_mean = Parameter(default=0, description=\"Peak position (along x axis) of Gaussian\")\n    y_mean = Parameter(default=0, description=\"Peak position (along y axis) of Gaussian\")\n    x_stddev = Parameter(default=1, description=\"Standard deviation of the Gaussian (along x axis)\")\n    y_stddev = Parameter(default=1, description=\"Standard deviation of the Gaussian (along y axis)\")\n    theta = Parameter(default=0.0, description=\"Rotation angle [in radians] (Optional parameter)\")\n\n    def __init__(self, amplitude=amplitude.default, x_mean=x_mean.default,\n                 y_mean=y_mean.default, x_stddev=None, y_stddev=None,\n                 theta=None, cov_matrix=None, **kwargs):\n        if cov_matrix is None:\n            if x_stddev is None:\n                x_stddev = self.__class__.x_stddev.default\n            if y_stddev is None:\n                y_stddev = self.__class__.y_stddev.default\n            if theta is None:\n                theta = self.__class__.theta.default\n        else:\n            if x_stddev is not None or y_stddev is not None or theta is not None:\n                raise InputParameterError(\"Cannot specify both cov_matrix and \"\n                                          \"x/y_stddev/theta\")\n            # Compute principle coordinate system transformation\n            cov_matrix = np.array(cov_matrix)\n\n            if cov_matrix.shape != (2, 2):\n                raise ValueError(\"Covariance matrix must be 2x2\")\n\n            eig_vals, eig_vecs = np.linalg.eig(cov_matrix)\n            x_stddev, y_stddev = np.sqrt(eig_vals)\n            y_vec = eig_vecs[:, 0]\n            theta = np.arctan2(y_vec[1], y_vec[0])\n\n        # Ensure stddev makes sense if its bounds are not explicitly set.\n        # stddev must be non-zero and positive.\n        # TODO: Investigate why setting this in Parameter above causes\n        #       convolution tests to hang.\n        kwargs.setdefault('bounds', {})\n        kwargs['bounds'].setdefault('x_stddev', (FLOAT_EPSILON, None))\n        kwargs['bounds'].setdefault('y_stddev', (FLOAT_EPSILON, None))\n\n        super().__init__(\n            amplitude=amplitude, x_mean=x_mean, y_mean=y_mean,\n            x_stddev=x_stddev, y_stddev=y_stddev, theta=theta, **kwargs)\n\n    @property\n    def x_fwhm(self):\n        \"\"\"Gaussian full width at half maximum in X.\"\"\"\n        return self.x_stddev * GAUSSIAN_SIGMA_TO_FWHM\n\n    @property\n    def y_fwhm(self):\n        \"\"\"Gaussian full width at half maximum in Y.\"\"\"\n        return self.y_stddev * GAUSSIAN_SIGMA_TO_FWHM\n\n    def bounding_box(self, factor=5.5):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits in each dimension,\n        ``((y_low, y_high), (x_low, x_high))``\n\n        The default offset from the mean is 5.5-sigma, corresponding\n        to a relative error < 1e-7. The limits are adjusted for rotation.\n\n        Parameters\n        ----------\n        factor : float, optional\n            The multiple of `x_stddev` and `y_stddev` used to define the limits.\n            The default is 5.5.\n\n        Examples\n        --------\n        >>> from astropy.modeling.models import Gaussian2D\n        >>> model = Gaussian2D(x_mean=0, y_mean=0, x_stddev=1, y_stddev=2)\n        >>> model.bounding_box\n        ((-11.0, 11.0), (-5.5, 5.5))\n\n        This range can be set directly (see: `Model.bounding_box\n        <astropy.modeling.Model.bounding_box>`) or by using a different factor\n        like:\n\n        >>> model.bounding_box = model.bounding_box(factor=2)\n        >>> model.bounding_box\n        ((-4.0, 4.0), (-2.0, 2.0))\n        \"\"\"\n\n        a = factor * self.x_stddev\n        b = factor * self.y_stddev\n        theta = self.theta.value\n        dx, dy = ellipse_extent(a, b, theta)\n\n        return ((self.y_mean - dy, self.y_mean + dy),\n                (self.x_mean - dx, self.x_mean + dx))\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_mean, y_mean, x_stddev, y_stddev, theta):\n        \"\"\"Two dimensional Gaussian function\"\"\"\n\n        cost2 = np.cos(theta) ** 2\n        sint2 = np.sin(theta) ** 2\n        sin2t = np.sin(2. * theta)\n        xstd2 = x_stddev ** 2\n        ystd2 = y_stddev ** 2\n        xdiff = x - x_mean\n        ydiff = y - y_mean\n        a = 0.5 * ((cost2 / xstd2) + (sint2 / ystd2))\n        b = 0.5 * ((sin2t / xstd2) - (sin2t / ystd2))\n        c = 0.5 * ((sint2 / xstd2) + (cost2 / ystd2))\n        return amplitude * np.exp(-((a * xdiff ** 2) + (b * xdiff * ydiff) +\n                                    (c * ydiff ** 2)))\n\n    @staticmethod\n    def fit_deriv(x, y, amplitude, x_mean, y_mean, x_stddev, y_stddev, theta):\n        \"\"\"Two dimensional Gaussian function derivative with respect to parameters\"\"\"\n\n        cost = np.cos(theta)\n        sint = np.sin(theta)\n        cost2 = np.cos(theta) ** 2\n        sint2 = np.sin(theta) ** 2\n        cos2t = np.cos(2. * theta)\n        sin2t = np.sin(2. * theta)\n        xstd2 = x_stddev ** 2\n        ystd2 = y_stddev ** 2\n        xstd3 = x_stddev ** 3\n        ystd3 = y_stddev ** 3\n        xdiff = x - x_mean\n        ydiff = y - y_mean\n        xdiff2 = xdiff ** 2\n        ydiff2 = ydiff ** 2\n        a = 0.5 * ((cost2 / xstd2) + (sint2 / ystd2))\n        b = 0.5 * ((sin2t / xstd2) - (sin2t / ystd2))\n        c = 0.5 * ((sint2 / xstd2) + (cost2 / ystd2))\n        g = amplitude * np.exp(-((a * xdiff2) + (b * xdiff * ydiff) +\n                                 (c * ydiff2)))\n        da_dtheta = (sint * cost * ((1. / ystd2) - (1. / xstd2)))\n        da_dx_stddev = -cost2 / xstd3\n        da_dy_stddev = -sint2 / ystd3\n        db_dtheta = (cos2t / xstd2) - (cos2t / ystd2)\n        db_dx_stddev = -sin2t / xstd3\n        db_dy_stddev = sin2t / ystd3\n        dc_dtheta = -da_dtheta\n        dc_dx_stddev = -sint2 / xstd3\n        dc_dy_stddev = -cost2 / ystd3\n        dg_dA = g / amplitude\n        dg_dx_mean = g * ((2. * a * xdiff) + (b * ydiff))\n        dg_dy_mean = g * ((b * xdiff) + (2. * c * ydiff))\n        dg_dx_stddev = g * (-(da_dx_stddev * xdiff2 +\n                              db_dx_stddev * xdiff * ydiff +\n                              dc_dx_stddev * ydiff2))\n        dg_dy_stddev = g * (-(da_dy_stddev * xdiff2 +\n                              db_dy_stddev * xdiff * ydiff +\n                              dc_dy_stddev * ydiff2))\n        dg_dtheta = g * (-(da_dtheta * xdiff2 +\n                           db_dtheta * xdiff * ydiff +\n                           dc_dtheta * ydiff2))\n        return [dg_dA, dg_dx_mean, dg_dy_mean, dg_dx_stddev, dg_dy_stddev,\n                dg_dtheta]\n\n    @property\n    def input_units(self):\n        if self.x_mean.unit is None and self.y_mean.unit is None:\n            return None\n        return {self.inputs[0]: self.x_mean.unit,\n                self.inputs[1]: self.y_mean.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_mean': inputs_unit[self.inputs[0]],\n                'y_mean': inputs_unit[self.inputs[0]],\n                'x_stddev': inputs_unit[self.inputs[0]],\n                'y_stddev': inputs_unit[self.inputs[0]],\n                'theta': u.rad,\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass Shift(Fittable1DModel):\n    \"\"\"\n    Shift a coordinate.\n\n    Parameters\n    ----------\n    offset : float\n        Offset to add to a coordinate.\n    \"\"\"\n\n    offset = Parameter(default=0, description=\"Offset to add to a model\")\n    linear = True\n\n    _has_inverse_bounding_box = True\n\n    @property\n    def input_units(self):\n        if self.offset.unit is None:\n            return None\n        return {self.inputs[0]: self.offset.unit}\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse Shift model function\"\"\"\n\n        inv = self.copy()\n        inv.offset *= -1\n\n        try:\n            self.bounding_box\n        except NotImplementedError:\n            pass\n        else:\n            inv.bounding_box = tuple(self.evaluate(x, self.offset) for x in self.bounding_box)\n\n        return inv\n\n    @staticmethod\n    def evaluate(x, offset):\n        \"\"\"One dimensional Shift model function\"\"\"\n        return x + offset\n\n    @staticmethod\n    def sum_of_implicit_terms(x):\n        \"\"\"Evaluate the implicit term (x) of one dimensional Shift model\"\"\"\n        return x\n\n    @staticmethod\n    def fit_deriv(x, *params):\n        \"\"\"One dimensional Shift model derivative with respect to parameter\"\"\"\n\n        d_offset = np.ones_like(x)\n        return [d_offset]\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'offset': outputs_unit[self.outputs[0]]}\n\n\nclass Scale(Fittable1DModel):\n    \"\"\"\n    Multiply a model by a dimensionless factor.\n\n    Parameters\n    ----------\n    factor : float\n        Factor by which to scale a coordinate.\n\n    Notes\n    -----\n\n    If ``factor`` is a `~astropy.units.Quantity` then the units will be\n    stripped before the scaling operation.\n\n    \"\"\"\n\n    factor = Parameter(default=1, description=\"Factor by which to scale a model\")\n    linear = True\n    fittable = True\n\n    _input_units_strict = True\n    _input_units_allow_dimensionless = True\n\n    _has_inverse_bounding_box = True\n\n    @property\n    def input_units(self):\n        if self.factor.unit is None:\n            return None\n        return {self.inputs[0]: self.factor.unit}\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse Scale model function\"\"\"\n        inv = self.copy()\n        inv.factor = 1 / self.factor\n\n        try:\n            self.bounding_box\n        except NotImplementedError:\n            pass\n        else:\n            inv.bounding_box = tuple(self.evaluate(x, self.factor) for x in self.bounding_box.bounding_box())\n\n        return inv\n\n    @staticmethod\n    def evaluate(x, factor):\n        \"\"\"One dimensional Scale model function\"\"\"\n        if isinstance(factor, u.Quantity):\n            factor = factor.value\n\n        return factor * x\n\n    @staticmethod\n    def fit_deriv(x, *params):\n        \"\"\"One dimensional Scale model derivative with respect to parameter\"\"\"\n\n        d_factor = x\n        return [d_factor]\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'factor': outputs_unit[self.outputs[0]]}\n\n\nclass Multiply(Fittable1DModel):\n    \"\"\"\n    Multiply a model by a quantity or number.\n\n    Parameters\n    ----------\n    factor : float\n        Factor by which to multiply a coordinate.\n    \"\"\"\n\n    factor = Parameter(default=1, description=\"Factor by which to multiply a model\")\n    linear = True\n    fittable = True\n\n    _has_inverse_bounding_box = True\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse multiply model function\"\"\"\n        inv = self.copy()\n        inv.factor = 1 / self.factor\n\n        try:\n            self.bounding_box\n        except NotImplementedError:\n            pass\n        else:\n            inv.bounding_box = tuple(self.evaluate(x, self.factor) for x in self.bounding_box.bounding_box())\n\n        return inv\n\n    @staticmethod\n    def evaluate(x, factor):\n        \"\"\"One dimensional multiply model function\"\"\"\n        return factor * x\n\n    @staticmethod\n    def fit_deriv(x, *params):\n        \"\"\"One dimensional multiply model derivative with respect to parameter\"\"\"\n\n        d_factor = x\n        return [d_factor]\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'factor': outputs_unit[self.outputs[0]]}\n\n\nclass RedshiftScaleFactor(Fittable1DModel):\n    \"\"\"\n    One dimensional redshift scale factor model.\n\n    Parameters\n    ----------\n    z : float\n        Redshift value.\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = x (1 + z)\n    \"\"\"\n\n    z = Parameter(description='Redshift', default=0)\n\n    _has_inverse_bounding_box = True\n\n    @staticmethod\n    def evaluate(x, z):\n        \"\"\"One dimensional RedshiftScaleFactor model function\"\"\"\n\n        return (1 + z) * x\n\n    @staticmethod\n    def fit_deriv(x, z):\n        \"\"\"One dimensional RedshiftScaleFactor model derivative\"\"\"\n\n        d_z = x\n        return [d_z]\n\n    @property\n    def inverse(self):\n        \"\"\"Inverse RedshiftScaleFactor model\"\"\"\n\n        inv = self.copy()\n        inv.z = 1.0 / (1.0 + self.z) - 1.0\n\n        try:\n            self.bounding_box\n        except NotImplementedError:\n            pass\n        else:\n            inv.bounding_box = tuple(self.evaluate(x, self.z) for x in self.bounding_box.bounding_box())\n\n        return inv\n\n\nclass Sersic1D(Fittable1DModel):\n    r\"\"\"\n    One dimensional Sersic surface brightness profile.\n\n    Parameters\n    ----------\n    amplitude : float\n        Surface brightness at r_eff.\n    r_eff : float\n        Effective (half-light) radius\n    n : float\n        Sersic Index.\n\n    See Also\n    --------\n    Gaussian1D, Moffat1D, Lorentz1D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        I(r)=I_e\\exp\\left\\{-b_n\\left[\\left(\\frac{r}{r_{e}}\\right)^{(1/n)}-1\\right]\\right\\}\n\n    The constant :math:`b_n` is defined such that :math:`r_e` contains half the total\n    luminosity, and can be solved for numerically.\n\n    .. math::\n\n        \\Gamma(2n) = 2\\gamma (b_n,2n)\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        from astropy.modeling.models import Sersic1D\n        import matplotlib.pyplot as plt\n\n        plt.figure()\n        plt.subplot(111, xscale='log', yscale='log')\n        s1 = Sersic1D(amplitude=1, r_eff=5)\n        r=np.arange(0, 100, .01)\n\n        for n in range(1, 10):\n             s1.n = n\n             plt.plot(r, s1(r), color=str(float(n) / 15))\n\n        plt.axis([1e-1, 30, 1e-2, 1e3])\n        plt.xlabel('log Radius')\n        plt.ylabel('log Surface Brightness')\n        plt.text(.25, 1.5, 'n=1')\n        plt.text(.25, 300, 'n=10')\n        plt.xticks([])\n        plt.yticks([])\n        plt.show()\n\n    References\n    ----------\n    .. [1] http://ned.ipac.caltech.edu/level5/March05/Graham/Graham2.html\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Surface brightness at r_eff\")\n    r_eff = Parameter(default=1, description=\"Effective (half-light) radius\")\n    n = Parameter(default=4, description=\"Sersic Index\")\n    _gammaincinv = None\n\n    @classmethod\n    def evaluate(cls, r, amplitude, r_eff, n):\n        \"\"\"One dimensional Sersic profile function.\"\"\"\n\n        if cls._gammaincinv is None:\n            from scipy.special import gammaincinv\n            cls._gammaincinv = gammaincinv\n\n        return (amplitude * np.exp(\n            -cls._gammaincinv(2 * n, 0.5) * ((r / r_eff) ** (1 / n) - 1)))\n\n    @property\n    def input_units(self):\n        if self.r_eff.unit is None:\n            return None\n        return {self.inputs[0]: self.r_eff.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'r_eff': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass _Trigonometric1D(Fittable1DModel):\n    \"\"\"\n    Base class for one dimensional trigonometric and inverse trigonometric models\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude\n    frequency : float\n        Oscillation frequency\n    phase : float\n        Oscillation phase\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Oscillation amplitude\")\n    frequency = Parameter(default=1, description=\"Oscillation frequency\")\n    phase = Parameter(default=0, description=\"Oscillation phase\")\n\n    @property\n    def input_units(self):\n        if self.frequency.unit is None:\n            return None\n        return {self.inputs[0]: 1. / self.frequency.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'frequency': inputs_unit[self.inputs[0]] ** -1,\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass Sine1D(_Trigonometric1D):\n    \"\"\"\n    One dimensional Sine model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude\n    frequency : float\n        Oscillation frequency\n    phase : float\n        Oscillation phase\n\n    See Also\n    --------\n    ArcSine1D, Cosine1D, Tangent1D, Const1D, Linear1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = A \\\\sin(2 \\\\pi f x + 2 \\\\pi p)\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Sine1D\n\n        plt.figure()\n        s1 = Sine1D(amplitude=1, frequency=.25)\n        r=np.arange(0, 10, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([0, 10, -5, 5])\n        plt.show()\n    \"\"\"\n\n    @staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Sine model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n        argument = TWOPI * (frequency * x + phase)\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        return amplitude * np.sin(argument)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Sine model derivative\"\"\"\n\n        d_amplitude = np.sin(TWOPI * frequency * x + TWOPI * phase)\n        d_frequency = (TWOPI * x * amplitude *\n                       np.cos(TWOPI * frequency * x + TWOPI * phase))\n        d_phase = (TWOPI * amplitude *\n                   np.cos(TWOPI * frequency * x + TWOPI * phase))\n        return [d_amplitude, d_frequency, d_phase]\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse of Sine\"\"\"\n\n        return ArcSine1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)\n\n\nclass Cosine1D(_Trigonometric1D):\n    \"\"\"\n    One dimensional Cosine model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude\n    frequency : float\n        Oscillation frequency\n    phase : float\n        Oscillation phase\n\n    See Also\n    --------\n    ArcCosine1D, Sine1D, Tangent1D, Const1D, Linear1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = A \\\\cos(2 \\\\pi f x + 2 \\\\pi p)\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Cosine1D\n\n        plt.figure()\n        s1 = Cosine1D(amplitude=1, frequency=.25)\n        r=np.arange(0, 10, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([0, 10, -5, 5])\n        plt.show()\n    \"\"\"\n\n    @staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Cosine model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n        argument = TWOPI * (frequency * x + phase)\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        return amplitude * np.cos(argument)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Cosine model derivative\"\"\"\n\n        d_amplitude = np.cos(TWOPI * frequency * x + TWOPI * phase)\n        d_frequency = - (TWOPI * x * amplitude *\n                         np.sin(TWOPI * frequency * x + TWOPI * phase))\n        d_phase = - (TWOPI * amplitude *\n                     np.sin(TWOPI * frequency * x + TWOPI * phase))\n        return [d_amplitude, d_frequency, d_phase]\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse of Cosine\"\"\"\n\n        return ArcCosine1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)\n\n\nclass Tangent1D(_Trigonometric1D):\n    \"\"\"\n    One dimensional Tangent model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude\n    frequency : float\n        Oscillation frequency\n    phase : float\n        Oscillation phase\n\n    See Also\n    --------\n    Sine1D, Cosine1D, Const1D, Linear1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = A \\\\tan(2 \\\\pi f x + 2 \\\\pi p)\n\n    Note that the tangent function is undefined for inputs of the form\n    pi/2 + n*pi for all integers n. Thus thus the default bounding box\n    has been restricted to:\n\n        .. math:: [(-1/4 - p)/f, (1/4 - p)/f]\n\n    which is the smallest interval for the tangent function to be continuous\n    on.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Tangent1D\n\n        plt.figure()\n        s1 = Tangent1D(amplitude=1, frequency=.25)\n        r=np.arange(0, 10, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([0, 10, -5, 5])\n        plt.show()\n    \"\"\"\n\n    @staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Tangent model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n        argument = TWOPI * (frequency * x + phase)\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        return amplitude * np.tan(argument)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Tangent model derivative\"\"\"\n\n        sec = 1 / (np.cos(TWOPI * frequency * x + TWOPI * phase))**2\n\n        d_amplitude = np.tan(TWOPI * frequency * x + TWOPI * phase)\n        d_frequency = TWOPI * x * amplitude * sec\n        d_phase = TWOPI * amplitude * sec\n        return [d_amplitude, d_frequency, d_phase]\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse of Tangent\"\"\"\n\n        return ArcTangent1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)\n\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``\n        \"\"\"\n\n        bbox = [(-1/4 - self.phase) / self.frequency, (1/4 - self.phase) / self.frequency]\n\n        if self.frequency.unit is not None:\n            bbox = bbox / self.frequency.unit\n\n        return bbox\n\n\nclass _InverseTrigonometric1D(_Trigonometric1D):\n    \"\"\"\n    Base class for one dimensional inverse trigonometric models\n    \"\"\"\n\n    @property\n    def input_units(self):\n        if self.amplitude.unit is None:\n            return None\n        return {self.inputs[0]: self.amplitude.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'frequency': outputs_unit[self.outputs[0]] ** -1,\n                'amplitude': inputs_unit[self.inputs[0]]}\n\n\nclass ArcSine1D(_InverseTrigonometric1D):\n    \"\"\"\n    One dimensional ArcSine model returning values between -pi/2 and pi/2\n    only.\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude for corresponding Sine\n    frequency : float\n        Oscillation frequency for corresponding Sine\n    phase : float\n        Oscillation phase for corresponding Sine\n\n    See Also\n    --------\n    Sine1D, ArcCosine1D, ArcTangent1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = ((arcsin(x / A) / 2pi) - p) / f\n\n    The arcsin function being used for this model will only accept inputs\n    in [-A, A]; otherwise, a runtime warning will be thrown and the result\n    will be NaN. To avoid this, the bounding_box has been properly set to\n    accommodate this; therefore, it is recommended that this model always\n    be evaluated with the ``with_bounding_box=True`` option.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import ArcSine1D\n\n        plt.figure()\n        s1 = ArcSine1D(amplitude=1, frequency=.25)\n        r=np.arange(-1, 1, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([-1, 1, -np.pi/2, np.pi/2])\n        plt.show()\n    \"\"\"\n\n    @staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcSine model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n\n        argument = x / amplitude\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        arc_sine = np.arcsin(argument) / TWOPI\n\n        return (arc_sine - phase) / frequency\n\n    @staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcSine model derivative\"\"\"\n\n        d_amplitude = - x / (TWOPI * frequency * amplitude**2 * np.sqrt(1 - (x / amplitude)**2))\n        d_frequency = (phase - (np.arcsin(x / amplitude) / TWOPI)) / frequency**2\n        d_phase = - 1 / frequency * np.ones(x.shape)\n        return [d_amplitude, d_frequency, d_phase]\n\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``\n        \"\"\"\n\n        return -1 * self.amplitude, 1 * self.amplitude\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse of ArcSine\"\"\"\n\n        return Sine1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)\n\n\nclass ArcCosine1D(_InverseTrigonometric1D):\n    \"\"\"\n    One dimensional ArcCosine returning values between 0 and pi only.\n\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude for corresponding Cosine\n    frequency : float\n        Oscillation frequency for corresponding Cosine\n    phase : float\n        Oscillation phase for corresponding Cosine\n\n    See Also\n    --------\n    Cosine1D, ArcSine1D, ArcTangent1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = ((arccos(x / A) / 2pi) - p) / f\n\n    The arccos function being used for this model will only accept inputs\n    in [-A, A]; otherwise, a runtime warning will be thrown and the result\n    will be NaN. To avoid this, the bounding_box has been properly set to\n    accommodate this; therefore, it is recommended that this model always\n    be evaluated with the ``with_bounding_box=True`` option.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import ArcCosine1D\n\n        plt.figure()\n        s1 = ArcCosine1D(amplitude=1, frequency=.25)\n        r=np.arange(-1, 1, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([-1, 1, 0, np.pi])\n        plt.show()\n    \"\"\"\n\n    @staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcCosine model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n\n        argument = x / amplitude\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        arc_cos = np.arccos(argument) / TWOPI\n\n        return (arc_cos - phase) / frequency\n\n    @staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcCosine model derivative\"\"\"\n\n        d_amplitude = x / (TWOPI * frequency * amplitude**2 * np.sqrt(1 - (x / amplitude)**2))\n        d_frequency = (phase - (np.arccos(x / amplitude) / TWOPI)) / frequency**2\n        d_phase = - 1 / frequency * np.ones(x.shape)\n        return [d_amplitude, d_frequency, d_phase]\n\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``\n        \"\"\"\n\n        return -1 * self.amplitude, 1 * self.amplitude\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse of ArcCosine\"\"\"\n\n        return Cosine1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)\n\n\nclass ArcTangent1D(_InverseTrigonometric1D):\n    \"\"\"\n    One dimensional ArcTangent model returning values between -pi/2 and\n    pi/2 only.\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude for corresponding Tangent\n    frequency : float\n        Oscillation frequency for corresponding Tangent\n    phase : float\n        Oscillation phase for corresponding Tangent\n\n    See Also\n    --------\n    Tangent1D, ArcSine1D, ArcCosine1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = ((arctan(x / A) / 2pi) - p) / f\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import ArcTangent1D\n\n        plt.figure()\n        s1 = ArcTangent1D(amplitude=1, frequency=.25)\n        r=np.arange(-10, 10, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([-10, 10, -np.pi/2, np.pi/2])\n        plt.show()\n    \"\"\"\n\n    @staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcTangent model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n\n        argument = x / amplitude\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        arc_cos = np.arctan(argument) / TWOPI\n\n        return (arc_cos - phase) / frequency\n\n    @staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcTangent model derivative\"\"\"\n\n        d_amplitude = - x / (TWOPI * frequency * amplitude**2 * (1 + (x / amplitude)**2))\n        d_frequency = (phase - (np.arctan(x / amplitude) / TWOPI)) / frequency**2\n        d_phase = - 1 / frequency * np.ones(x.shape)\n        return [d_amplitude, d_frequency, d_phase]\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse of ArcTangent\"\"\"\n\n        return Tangent1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)\n\n\nclass Linear1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Line model.\n\n    Parameters\n    ----------\n    slope : float\n        Slope of the straight line\n\n    intercept : float\n        Intercept of the straight line\n\n    See Also\n    --------\n    Const1D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = a x + b\n    \"\"\"\n    slope = Parameter(default=1, description=\"Slope of the straight line\")\n    intercept = Parameter(default=0, description=\"Intercept of the straight line\")\n    linear = True\n\n    @staticmethod\n    def evaluate(x, slope, intercept):\n        \"\"\"One dimensional Line model function\"\"\"\n\n        return slope * x + intercept\n\n    @staticmethod\n    def fit_deriv(x, *params):\n        \"\"\"One dimensional Line model derivative with respect to parameters\"\"\"\n\n        d_slope = x\n        d_intercept = np.ones_like(x)\n        return [d_slope, d_intercept]\n\n    @property\n    def inverse(self):\n        new_slope = self.slope ** -1\n        new_intercept = -self.intercept / self.slope\n        return self.__class__(slope=new_slope, intercept=new_intercept)\n\n    @property\n    def input_units(self):\n        if self.intercept.unit is None and self.slope.unit is None:\n            return None\n        return {self.inputs[0]: self.intercept.unit / self.slope.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'intercept': outputs_unit[self.outputs[0]],\n                'slope': outputs_unit[self.outputs[0]] / inputs_unit[self.inputs[0]]}\n\n\nclass Planar2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional Plane model.\n\n    Parameters\n    ----------\n    slope_x : float\n        Slope of the plane in X\n\n    slope_y : float\n        Slope of the plane in Y\n\n    intercept : float\n        Z-intercept of the plane\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x, y) = a x + b y + c\n    \"\"\"\n\n    slope_x = Parameter(default=1, description=\"Slope of the plane in X\")\n    slope_y = Parameter(default=1, description=\"Slope of the plane in Y\")\n    intercept = Parameter(default=0, description=\"Z-intercept of the plane\")\n    linear = True\n\n    @staticmethod\n    def evaluate(x, y, slope_x, slope_y, intercept):\n        \"\"\"Two dimensional Plane model function\"\"\"\n\n        return slope_x * x + slope_y * y + intercept\n\n    @staticmethod\n    def fit_deriv(x, y, *params):\n        \"\"\"Two dimensional Plane model derivative with respect to parameters\"\"\"\n\n        d_slope_x = x\n        d_slope_y = y\n        d_intercept = np.ones_like(x)\n        return [d_slope_x, d_slope_y, d_intercept]\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'intercept': outputs_unit['z'],\n                'slope_x': outputs_unit['z'] / inputs_unit['x'],\n                'slope_y': outputs_unit['z'] / inputs_unit['y']}\n\n\nclass Lorentz1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Lorentzian model.\n\n    Parameters\n    ----------\n    amplitude : float or `~astropy.units.Quantity`.\n        Peak value - for a normalized profile (integrating to 1),\n        set amplitude = 2 / (np.pi * fwhm)\n    x_0 : float or `~astropy.units.Quantity`.\n        Position of the peak\n    fwhm : float or `~astropy.units.Quantity`.\n        Full width at half maximum (FWHM)\n\n    See Also\n    --------\n    Gaussian1D, Box1D, RickerWavelet1D\n\n    Notes\n    -----\n    Either all or none of input ``x``, position ``x_0`` and ``fwhm`` must be provided\n    consistently with compatible units or as unitless numbers.\n\n    Model formula:\n\n    .. math::\n\n        f(x) = \\\\frac{A \\\\gamma^{2}}{\\\\gamma^{2} + \\\\left(x - x_{0}\\\\right)^{2}}\n\n    where :math:`\\\\gamma` is half of given FWHM.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Lorentz1D\n\n        plt.figure()\n        s1 = Lorentz1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Peak value\")\n    x_0 = Parameter(default=0, description=\"Position of the peak\")\n    fwhm = Parameter(default=1, description=\"Full width at half maximum\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, fwhm):\n        \"\"\"One dimensional Lorentzian model function\"\"\"\n\n        return (amplitude * ((fwhm / 2.) ** 2) / ((x - x_0) ** 2 +\n                                                  (fwhm / 2.) ** 2))\n\n    @staticmethod\n    def fit_deriv(x, amplitude, x_0, fwhm):\n        \"\"\"One dimensional Lorentzian model derivative with respect to parameters\"\"\"\n\n        d_amplitude = fwhm ** 2 / (fwhm ** 2 + (x - x_0) ** 2)\n        d_x_0 = (amplitude * d_amplitude * (2 * x - 2 * x_0) /\n                 (fwhm ** 2 + (x - x_0) ** 2))\n        d_fwhm = 2 * amplitude * d_amplitude / fwhm * (1 - d_amplitude)\n        return [d_amplitude, d_x_0, d_fwhm]\n\n    def bounding_box(self, factor=25):\n        \"\"\"Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``.\n\n        Parameters\n        ----------\n        factor : float\n            The multiple of FWHM used to define the limits.\n            Default is chosen to include most (99%) of the\n            area under the curve, while still showing the\n            central feature of interest.\n\n        \"\"\"\n        x0 = self.x_0\n        dx = factor * self.fwhm\n\n        return (x0 - dx, x0 + dx)\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'fwhm': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass Voigt1D(Fittable1DModel):\n    \"\"\"\n    One dimensional model for the Voigt profile.\n\n    Parameters\n    ----------\n    x_0 : float or `~astropy.units.Quantity`\n        Position of the peak\n    amplitude_L : float or `~astropy.units.Quantity`.\n        The Lorentzian amplitude (peak of the associated Lorentz function)\n        - for a normalized profile (integrating to 1), set\n        amplitude_L = 2 / (np.pi * fwhm_L)\n    fwhm_L : float or `~astropy.units.Quantity`\n        The Lorentzian full width at half maximum\n    fwhm_G : float or `~astropy.units.Quantity`.\n        The Gaussian full width at half maximum\n    method : str, optional\n        Algorithm for computing the complex error function; one of\n        'Humlicek2' (default, fast and generally more accurate than ``rtol=3.e-5``) or\n        'Scipy', alternatively 'wofz' (requires ``scipy``, almost as fast and\n        reference in accuracy).\n\n    See Also\n    --------\n    Gaussian1D, Lorentz1D\n\n    Notes\n    -----\n    Either all or none of input ``x``, position ``x_0`` and the ``fwhm_*`` must be provided\n    consistently with compatible units or as unitless numbers.\n    Voigt function is calculated as real part of the complex error function computed from either\n    Humlicek's rational approximations (JQSRT 21:309, 1979; 27:437, 1982) following\n    Schreier 2018 (MNRAS 479, 3068; and ``hum2zpf16m`` from his cpfX.py module); or\n    `~scipy.special.wofz` (implementing 'Faddeeva.cc').\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        from astropy.modeling.models import Voigt1D\n        import matplotlib.pyplot as plt\n\n        plt.figure()\n        x = np.arange(0, 10, 0.01)\n        v1 = Voigt1D(x_0=5, amplitude_L=10, fwhm_L=0.5, fwhm_G=0.9)\n        plt.plot(x, v1(x))\n        plt.show()\n    \"\"\"\n\n    x_0 = Parameter(default=0,\n                    description=\"Position of the peak\")\n    amplitude_L = Parameter(default=1,     # noqa: N815\n                            description=\"The Lorentzian amplitude\")\n    fwhm_L = Parameter(default=2/np.pi,    # noqa: N815\n                       description=\"The Lorentzian full width at half maximum\")\n    fwhm_G = Parameter(default=np.log(2),  # noqa: N815\n                       description=\"The Gaussian full width at half maximum\")\n\n    sqrt_pi = np.sqrt(np.pi)\n    sqrt_ln2 = np.sqrt(np.log(2))\n    sqrt_ln2pi = np.sqrt(np.log(2) * np.pi)\n    _last_z = np.zeros(1, dtype=complex)\n    _last_w = np.zeros(1, dtype=float)\n    _faddeeva = None\n\n    def __init__(self, x_0=x_0.default, amplitude_L=amplitude_L.default,            # noqa: N803\n                 fwhm_L=fwhm_L.default, fwhm_G=fwhm_G.default, method='humlicek2',  # noqa: N803\n                 **kwargs):\n        if str(method).lower() in ('wofz', 'scipy'):\n            from scipy.special import wofz\n            self._faddeeva = wofz\n        elif str(method).lower() == 'humlicek2':\n            self._faddeeva = self._hum2zpf16c\n        else:\n            raise ValueError(f'Not a valid method for Voigt1D Faddeeva function: {method}.')\n        self.method = self._faddeeva.__name__\n\n        super().__init__(x_0=x_0, amplitude_L=amplitude_L, fwhm_L=fwhm_L, fwhm_G=fwhm_G, **kwargs)\n\n    def _wrap_wofz(self, z):\n        \"\"\"Call complex error (Faddeeva) function w(z) implemented by algorithm `method`;\n        cache results for consecutive calls from `evaluate`, `fit_deriv`.\"\"\"\n\n        if (z.shape == self._last_z.shape and\n                np.allclose(z, self._last_z, rtol=1.e-14, atol=1.e-15)):\n            return self._last_w\n\n        self._last_w = self._faddeeva(z)\n        self._last_z = z\n        return self._last_w\n\n    def evaluate(self, x, x_0, amplitude_L, fwhm_L, fwhm_G):  # noqa: N803\n        \"\"\"One dimensional Voigt function scaled to Lorentz peak amplitude.\"\"\"\n\n        z = np.atleast_1d(2 * (x - x_0) + 1j * fwhm_L) * self.sqrt_ln2 / fwhm_G\n        # The normalised Voigt profile is w.real * self.sqrt_ln2 / (self.sqrt_pi * fwhm_G) * 2 ;\n        # for the legacy definition we multiply with np.pi * fwhm_L / 2 * amplitude_L\n        return self._wrap_wofz(z).real * self.sqrt_ln2pi / fwhm_G * fwhm_L * amplitude_L\n\n    def fit_deriv(self, x, x_0, amplitude_L, fwhm_L, fwhm_G):  # noqa: N803\n        \"\"\"Derivative of the one dimensional Voigt function with respect to parameters.\"\"\"\n\n        s = self.sqrt_ln2 / fwhm_G\n        z = np.atleast_1d(2 * (x - x_0) + 1j * fwhm_L) * s\n        # V * constant from McLean implementation (== their Voigt function)\n        w = self._wrap_wofz(z) * s * fwhm_L * amplitude_L * self.sqrt_pi\n\n        # Schreier (2018) Eq. 6 == (dvdx + 1j * dvdy) / (sqrt(pi) * fwhm_L * amplitude_L)\n        dwdz = -2 * z * w + 2j * s * fwhm_L * amplitude_L\n\n        return [-dwdz.real * 2 * s,\n                w.real / amplitude_L,\n                w.real / fwhm_L - dwdz.imag * s,\n                (-w.real - s * (2 * (x - x_0) * dwdz.real - fwhm_L * dwdz.imag)) / fwhm_G]\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'fwhm_L': inputs_unit[self.inputs[0]],\n                'fwhm_G': inputs_unit[self.inputs[0]],\n                'amplitude_L': outputs_unit[self.outputs[0]]}\n\n    @staticmethod\n    def _hum2zpf16c(z, s=10.0):\n        \"\"\"Complex error function w(z) for z = x + iy combining Humlicek's rational approximations:\n\n        |x| + y > 10:  Humlicek (JQSRT, 1982) rational approximation for region II;\n        else:          Humlicek (JQSRT, 1979) rational approximation with n=16 and delta=y0=1.35\n\n        Version using a mask and np.place;\n        single complex argument version of Franz Schreier's cpfX.hum2zpf16m.\n        Originally licensed under a 3-clause BSD style license - see\n        https://atmos.eoc.dlr.de/tools/lbl4IR/cpfX.py\n        \"\"\"\n\n        # Optimized (single fraction) Humlicek region I rational approximation for n=16, delta=1.35\n\n        AA = np.array([+46236.3358828121,   -147726.58393079657j,   # noqa: N806\n                       -206562.80451354137,  281369.1590631087j,\n                       +183092.74968253175, -184787.96830696272j,\n                       -66155.39578477248,   57778.05827983565j,\n                       +11682.770904216826, -9442.402767960672j,\n                       -1052.8438624933142,  814.0996198624186j,\n                       +45.94499030751872,  -34.59751573708725j,\n                       -0.7616559377907136,  0.5641895835476449j])  # 1j/sqrt(pi) to the 12. digit\n\n        bb = np.array([+7918.06640624997, 0.0,\n                       -126689.0625,      0.0,\n                       +295607.8125,      0.0,\n                       -236486.25,        0.0,\n                       +84459.375,        0.0,\n                       -15015.0,          0.0,\n                       +1365.0,           0.0,\n                       -60.0,             0.0,\n                       +1.0])\n\n        sqrt_piinv = 1.0 / np.sqrt(np.pi)\n\n        zz = z * z\n        w  = 1j * (z * (zz * sqrt_piinv - 1.410474)) / (0.75 + zz*(zz - 3.0))\n\n        if np.any(z.imag < s):\n            mask  = abs(z.real) + z.imag < s  # returns true for interior points\n            # returns small complex array covering only the interior region\n            Z     = z[np.where(mask)] + 1.35j\n            ZZ    = Z * Z\n            numer = (((((((((((((((AA[15]*Z + AA[14])*Z + AA[13])*Z + AA[12])*Z + AA[11])*Z +\n                               AA[10])*Z + AA[9])*Z + AA[8])*Z + AA[7])*Z + AA[6])*Z +\n                          AA[5])*Z + AA[4])*Z+AA[3])*Z + AA[2])*Z + AA[1])*Z + AA[0])\n            denom = (((((((ZZ + bb[14])*ZZ + bb[12])*ZZ + bb[10])*ZZ+bb[8])*ZZ + bb[6])*ZZ +\n                      bb[4])*ZZ + bb[2])*ZZ + bb[0]\n            np.place(w, mask, numer / denom)\n\n        return w\n\n\nclass Const1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Constant model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Value of the constant function\n\n    See Also\n    --------\n    Const2D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = A\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Const1D\n\n        plt.figure()\n        s1 = Const1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Value of the constant function\")\n    linear = True\n\n    @staticmethod\n    def evaluate(x, amplitude):\n        \"\"\"One dimensional Constant model function\"\"\"\n\n        if amplitude.size == 1:\n            # This is slightly faster than using ones_like and multiplying\n            x = np.empty_like(x, subok=False)\n            x.fill(amplitude.item())\n        else:\n            # This case is less likely but could occur if the amplitude\n            # parameter is given an array-like value\n            x = amplitude * np.ones_like(x, subok=False)\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(x, unit=amplitude.unit, copy=False)\n        return x\n\n    @staticmethod\n    def fit_deriv(x, amplitude):\n        \"\"\"One dimensional Constant model derivative with respect to parameters\"\"\"\n\n        d_amplitude = np.ones_like(x)\n        return [d_amplitude]\n\n    @property\n    def input_units(self):\n        return None\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass Const2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional Constant model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Value of the constant function\n\n    See Also\n    --------\n    Const1D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x, y) = A\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Value of the constant function\")\n    linear = True\n\n    @staticmethod\n    def evaluate(x, y, amplitude):\n        \"\"\"Two dimensional Constant model function\"\"\"\n\n        if amplitude.size == 1:\n            # This is slightly faster than using ones_like and multiplying\n            x = np.empty_like(x, subok=False)\n            x.fill(amplitude.item())\n        else:\n            # This case is less likely but could occur if the amplitude\n            # parameter is given an array-like value\n            x = amplitude * np.ones_like(x, subok=False)\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(x, unit=amplitude.unit, copy=False)\n        return x\n\n    @property\n    def input_units(self):\n        return None\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass Ellipse2D(Fittable2DModel):\n    \"\"\"\n    A 2D Ellipse model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Value of the ellipse.\n\n    x_0 : float\n        x position of the center of the disk.\n\n    y_0 : float\n        y position of the center of the disk.\n\n    a : float\n        The length of the semimajor axis.\n\n    b : float\n        The length of the semiminor axis.\n\n    theta : float\n        The rotation angle in radians of the semimajor axis.  The\n        rotation angle increases counterclockwise from the positive x\n        axis.\n\n    See Also\n    --------\n    Disk2D, Box2D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        f(x, y) = \\\\left \\\\{\n                    \\\\begin{array}{ll}\n                      \\\\mathrm{amplitude} & : \\\\left[\\\\frac{(x - x_0) \\\\cos\n                        \\\\theta + (y - y_0) \\\\sin \\\\theta}{a}\\\\right]^2 +\n                        \\\\left[\\\\frac{-(x - x_0) \\\\sin \\\\theta + (y - y_0)\n                        \\\\cos \\\\theta}{b}\\\\right]^2  \\\\leq 1 \\\\\\\\\n                      0 & : \\\\mathrm{otherwise}\n                    \\\\end{array}\n                  \\\\right.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        from astropy.modeling.models import Ellipse2D\n        from astropy.coordinates import Angle\n        import matplotlib.pyplot as plt\n        import matplotlib.patches as mpatches\n        x0, y0 = 25, 25\n        a, b = 20, 10\n        theta = Angle(30, 'deg')\n        e = Ellipse2D(amplitude=100., x_0=x0, y_0=y0, a=a, b=b,\n                      theta=theta.radian)\n        y, x = np.mgrid[0:50, 0:50]\n        fig, ax = plt.subplots(1, 1)\n        ax.imshow(e(x, y), origin='lower', interpolation='none', cmap='Greys_r')\n        e2 = mpatches.Ellipse((x0, y0), 2*a, 2*b, theta.degree, edgecolor='red',\n                              facecolor='none')\n        ax.add_patch(e2)\n        plt.show()\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Value of the ellipse\")\n    x_0 = Parameter(default=0, description=\"X position of the center of the disk.\")\n    y_0 = Parameter(default=0, description=\"Y position of the center of the disk.\")\n    a = Parameter(default=1, description=\"The length of the semimajor axis\")\n    b = Parameter(default=1, description=\"The length of the semiminor axis\")\n    theta = Parameter(default=0, description=\"The rotation angle in radians of the semimajor axis (Positive - counterclockwise)\")\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, a, b, theta):\n        \"\"\"Two dimensional Ellipse model function.\"\"\"\n\n        xx = x - x_0\n        yy = y - y_0\n        cost = np.cos(theta)\n        sint = np.sin(theta)\n        numerator1 = (xx * cost) + (yy * sint)\n        numerator2 = -(xx * sint) + (yy * cost)\n        in_ellipse = (((numerator1 / a) ** 2 + (numerator2 / b) ** 2) <= 1.)\n        result = np.select([in_ellipse], [amplitude])\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        \"\"\"\n\n        a = self.a\n        b = self.b\n        theta = self.theta.value\n        dx, dy = ellipse_extent(a, b, theta)\n\n        return ((self.y_0 - dy, self.y_0 + dy),\n                (self.x_0 - dx, self.x_0 + dx))\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'a': inputs_unit[self.inputs[0]],\n                'b': inputs_unit[self.inputs[0]],\n                'theta': u.rad,\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass Disk2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional radial symmetric Disk model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Value of the disk function\n    x_0 : float\n        x position center of the disk\n    y_0 : float\n        y position center of the disk\n    R_0 : float\n        Radius of the disk\n\n    See Also\n    --------\n    Box2D, TrapezoidDisk2D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math::\n\n            f(r) = \\\\left \\\\{\n                     \\\\begin{array}{ll}\n                       A & : r \\\\leq R_0 \\\\\\\\\n                       0 & : r > R_0\n                     \\\\end{array}\n                   \\\\right.\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Value of disk function\")\n    x_0 = Parameter(default=0, description=\"X position of center of the disk\")\n    y_0 = Parameter(default=0, description=\"Y position of center of the disk\")\n    R_0 = Parameter(default=1, description=\"Radius of the disk\")\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, R_0):\n        \"\"\"Two dimensional Disk model function\"\"\"\n\n        rr = (x - x_0) ** 2 + (y - y_0) ** 2\n        result = np.select([rr <= R_0 ** 2], [amplitude])\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        \"\"\"\n\n        return ((self.y_0 - self.R_0, self.y_0 + self.R_0),\n                (self.x_0 - self.R_0, self.x_0 + self.R_0))\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None and self.y_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'R_0': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass Ring2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional radial symmetric Ring model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Value of the disk function\n    x_0 : float\n        x position center of the disk\n    y_0 : float\n        y position center of the disk\n    r_in : float\n        Inner radius of the ring\n    width : float\n        Width of the ring.\n    r_out : float\n        Outer Radius of the ring. Can be specified instead of width.\n\n    See Also\n    --------\n    Disk2D, TrapezoidDisk2D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math::\n\n            f(r) = \\\\left \\\\{\n                     \\\\begin{array}{ll}\n                       A & : r_{in} \\\\leq r \\\\leq r_{out} \\\\\\\\\n                       0 & : \\\\text{else}\n                     \\\\end{array}\n                   \\\\right.\n\n    Where :math:`r_{out} = r_{in} + r_{width}`.\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Value of the disk function\")\n    x_0 = Parameter(default=0, description=\"X position of center of disc\")\n    y_0 = Parameter(default=0, description=\"Y position of center of disc\")\n    r_in = Parameter(default=1, description=\"Inner radius of the ring\")\n    width = Parameter(default=1, description=\"Width of the ring\")\n\n    def __init__(self, amplitude=amplitude.default, x_0=x_0.default,\n                 y_0=y_0.default, r_in=None, width=None,\n                 r_out=None, **kwargs):\n        if (r_in is None) and (r_out is None) and (width is None):\n            r_in = self.r_in.default\n            width = self.width.default\n        elif (r_in is not None) and (r_out is None) and (width is None):\n            width = self.width.default\n        elif (r_in is None) and (r_out is not None) and (width is None):\n            r_in = self.r_in.default\n            width = r_out - r_in\n        elif (r_in is None) and (r_out is None) and (width is not None):\n            r_in = self.r_in.default\n        elif (r_in is not None) and (r_out is not None) and (width is None):\n            width = r_out - r_in\n        elif (r_in is None) and (r_out is not None) and (width is not None):\n            r_in = r_out - width\n        elif (r_in is not None) and (r_out is not None) and (width is not None):\n            if np.any(width != (r_out - r_in)):\n                raise InputParameterError(\"Width must be r_out - r_in\")\n\n        if np.any(r_in < 0) or np.any(width < 0):\n            raise InputParameterError(f\"{r_in=} and {width=} must both be >=0\")\n\n        super().__init__(\n            amplitude=amplitude, x_0=x_0, y_0=y_0, r_in=r_in, width=width,\n            **kwargs)\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, r_in, width):\n        \"\"\"Two dimensional Ring model function.\"\"\"\n\n        rr = (x - x_0) ** 2 + (y - y_0) ** 2\n        r_range = np.logical_and(rr >= r_in ** 2, rr <= (r_in + width) ** 2)\n        result = np.select([r_range], [amplitude])\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box``.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        \"\"\"\n\n        dr = self.r_in + self.width\n\n        return ((self.y_0 - dr, self.y_0 + dr),\n                (self.x_0 - dr, self.x_0 + dr))\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'r_in': inputs_unit[self.inputs[0]],\n                'width': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass Box1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Box model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude A\n    x_0 : float\n        Position of the center of the box function\n    width : float\n        Width of the box\n\n    See Also\n    --------\n    Box2D, TrapezoidDisk2D\n\n    Notes\n    -----\n    Model formula:\n\n      .. math::\n\n            f(x) = \\\\left \\\\{\n                     \\\\begin{array}{ll}\n                       A & : x_0 - w/2 \\\\leq x \\\\leq x_0 + w/2 \\\\\\\\\n                       0 & : \\\\text{else}\n                     \\\\end{array}\n                   \\\\right.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Box1D\n\n        plt.figure()\n        s1 = Box1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            s1.width = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude A\")\n    x_0 = Parameter(default=0, description=\"Position of center of box function\")\n    width = Parameter(default=1, description=\"Width of the box\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, width):\n        \"\"\"One dimensional Box model function\"\"\"\n\n        inside = np.logical_and(x >= x_0 - width / 2., x <= x_0 + width / 2.)\n        return np.select([inside], [amplitude], 0)\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``(x_low, x_high))``\n        \"\"\"\n\n        dx = self.width / 2\n\n        return (self.x_0 - dx, self.x_0 + dx)\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    @property\n    def return_units(self):\n        if self.amplitude.unit is None:\n            return None\n        return {self.outputs[0]: self.amplitude.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'width': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass Box2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional Box model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude\n    x_0 : float\n        x position of the center of the box function\n    x_width : float\n        Width in x direction of the box\n    y_0 : float\n        y position of the center of the box function\n    y_width : float\n        Width in y direction of the box\n\n    See Also\n    --------\n    Box1D, Gaussian2D, Moffat2D\n\n    Notes\n    -----\n    Model formula:\n\n      .. math::\n\n            f(x, y) = \\\\left \\\\{\n                     \\\\begin{array}{ll}\n            A : & x_0 - w_x/2 \\\\leq x \\\\leq x_0 + w_x/2 \\\\text{ and} \\\\\\\\\n                & y_0 - w_y/2 \\\\leq y \\\\leq y_0 + w_y/2 \\\\\\\\\n            0 : & \\\\text{else}\n                     \\\\end{array}\n                   \\\\right.\n\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude\")\n    x_0 = Parameter(default=0, description=\"X position of the center of the box function\")\n    y_0 = Parameter(default=0, description=\"Y position of the center of the box function\")\n    x_width = Parameter(default=1, description=\"Width in x direction of the box\")\n    y_width = Parameter(default=1, description=\"Width in y direction of the box\")\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, x_width, y_width):\n        \"\"\"Two dimensional Box model function\"\"\"\n\n        x_range = np.logical_and(x >= x_0 - x_width / 2.,\n                                 x <= x_0 + x_width / 2.)\n        y_range = np.logical_and(y >= y_0 - y_width / 2.,\n                                 y <= y_0 + y_width / 2.)\n\n        result = np.select([np.logical_and(x_range, y_range)], [amplitude], 0)\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box``.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        \"\"\"\n\n        dx = self.x_width / 2\n        dy = self.y_width / 2\n\n        return ((self.y_0 - dy, self.y_0 + dy),\n                (self.x_0 - dx, self.x_0 + dx))\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[1]],\n                'x_width': inputs_unit[self.inputs[0]],\n                'y_width': inputs_unit[self.inputs[1]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass Trapezoid1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Trapezoid model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the trapezoid\n    x_0 : float\n        Center position of the trapezoid\n    width : float\n        Width of the constant part of the trapezoid.\n    slope : float\n        Slope of the tails of the trapezoid\n\n    See Also\n    --------\n    Box1D, Gaussian1D, Moffat1D\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Trapezoid1D\n\n        plt.figure()\n        s1 = Trapezoid1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            s1.width = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude of the trapezoid\")\n    x_0 = Parameter(default=0, description=\"Center position of the trapezoid\")\n    width = Parameter(default=1, description=\"Width of constant part of the trapezoid\")\n    slope = Parameter(default=1, description=\"Slope of the tails of trapezoid\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, width, slope):\n        \"\"\"One dimensional Trapezoid model function\"\"\"\n\n        # Compute the four points where the trapezoid changes slope\n        # x1 <= x2 <= x3 <= x4\n        x2 = x_0 - width / 2.\n        x3 = x_0 + width / 2.\n        x1 = x2 - amplitude / slope\n        x4 = x3 + amplitude / slope\n\n        # Compute model values in pieces between the change points\n        range_a = np.logical_and(x >= x1, x < x2)\n        range_b = np.logical_and(x >= x2, x < x3)\n        range_c = np.logical_and(x >= x3, x < x4)\n        val_a = slope * (x - x1)\n        val_b = amplitude\n        val_c = slope * (x4 - x)\n        result = np.select([range_a, range_b, range_c], [val_a, val_b, val_c])\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``(x_low, x_high))``\n        \"\"\"\n\n        dx = self.width / 2 + self.amplitude / self.slope\n\n        return (self.x_0 - dx, self.x_0 + dx)\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'width': inputs_unit[self.inputs[0]],\n                'slope': outputs_unit[self.outputs[0]] / inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass TrapezoidDisk2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional circular Trapezoid model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the trapezoid\n    x_0 : float\n        x position of the center of the trapezoid\n    y_0 : float\n        y position of the center of the trapezoid\n    R_0 : float\n        Radius of the constant part of the trapezoid.\n    slope : float\n        Slope of the tails of the trapezoid in x direction.\n\n    See Also\n    --------\n    Disk2D, Box2D\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude of the trapezoid\")\n    x_0 = Parameter(default=0, description=\"X position of the center of the trapezoid\")\n    y_0 = Parameter(default=0, description=\"Y position of the center of the trapezoid\")\n    R_0 = Parameter(default=1, description=\"Radius of constant part of trapezoid\")\n    slope = Parameter(default=1, description=\"Slope of tails of trapezoid in x direction\")\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, R_0, slope):\n        \"\"\"Two dimensional Trapezoid Disk model function\"\"\"\n\n        r = np.sqrt((x - x_0) ** 2 + (y - y_0) ** 2)\n        range_1 = r <= R_0\n        range_2 = np.logical_and(r > R_0, r <= R_0 + amplitude / slope)\n        val_1 = amplitude\n        val_2 = amplitude + slope * (R_0 - r)\n        result = np.select([range_1, range_2], [val_1, val_2])\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box``.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        \"\"\"\n\n        dr = self.R_0 + self.amplitude / self.slope\n\n        return ((self.y_0 - dr, self.y_0 + dr),\n                (self.x_0 - dr, self.x_0 + dr))\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None and self.y_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit['x'] != inputs_unit['y']:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'R_0': inputs_unit[self.inputs[0]],\n                'slope': outputs_unit[self.outputs[0]] / inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass RickerWavelet1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Ricker Wavelet model (sometimes known as a \"Mexican Hat\"\n    model).\n\n    .. note::\n\n        See https://github.com/astropy/astropy/pull/9445 for discussions\n        related to renaming of this model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude\n    x_0 : float\n        Position of the peak\n    sigma : float\n        Width of the Ricker wavelet\n\n    See Also\n    --------\n    RickerWavelet2D, Box1D, Gaussian1D, Trapezoid1D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        f(x) = {A \\\\left(1 - \\\\frac{\\\\left(x - x_{0}\\\\right)^{2}}{\\\\sigma^{2}}\\\\right)\n        e^{- \\\\frac{\\\\left(x - x_{0}\\\\right)^{2}}{2 \\\\sigma^{2}}}}\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import RickerWavelet1D\n\n        plt.figure()\n        s1 = RickerWavelet1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            s1.width = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -2, 4])\n        plt.show()\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude (peak) value\")\n    x_0 = Parameter(default=0, description=\"Position of the peak\")\n    sigma = Parameter(default=1, description=\"Width of the Ricker wavelet\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, sigma):\n        \"\"\"One dimensional Ricker Wavelet model function\"\"\"\n\n        xx_ww = (x - x_0) ** 2 / (2 * sigma ** 2)\n        return amplitude * (1 - 2 * xx_ww) * np.exp(-xx_ww)\n\n    def bounding_box(self, factor=10.0):\n        \"\"\"Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``.\n\n        Parameters\n        ----------\n        factor : float\n            The multiple of sigma used to define the limits.\n\n        \"\"\"\n        x0 = self.x_0\n        dx = factor * self.sigma\n\n        return (x0 - dx, x0 + dx)\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'sigma': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass RickerWavelet2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional Ricker Wavelet model (sometimes known as a \"Mexican Hat\"\n    model).\n\n    .. note::\n\n        See https://github.com/astropy/astropy/pull/9445 for discussions\n        related to renaming of this model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude\n    x_0 : float\n        x position of the peak\n    y_0 : float\n        y position of the peak\n    sigma : float\n        Width of the Ricker wavelet\n\n    See Also\n    --------\n    RickerWavelet1D, Gaussian2D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        f(x, y) = A \\\\left(1 - \\\\frac{\\\\left(x - x_{0}\\\\right)^{2}\n        + \\\\left(y - y_{0}\\\\right)^{2}}{\\\\sigma^{2}}\\\\right)\n        e^{\\\\frac{- \\\\left(x - x_{0}\\\\right)^{2}\n        - \\\\left(y - y_{0}\\\\right)^{2}}{2 \\\\sigma^{2}}}\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude (peak) value\")\n    x_0 = Parameter(default=0, description=\"X position of the peak\")\n    y_0 = Parameter(default=0, description=\"Y position of the peak\")\n    sigma = Parameter(default=1, description=\"Width of the Ricker wavelet\")\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, sigma):\n        \"\"\"Two dimensional Ricker Wavelet model function\"\"\"\n\n        rr_ww = ((x - x_0) ** 2 + (y - y_0) ** 2) / (2 * sigma ** 2)\n        return amplitude * (1 - rr_ww) * np.exp(- rr_ww)\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'sigma': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass AiryDisk2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional Airy disk model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the Airy function.\n    x_0 : float\n        x position of the maximum of the Airy function.\n    y_0 : float\n        y position of the maximum of the Airy function.\n    radius : float\n        The radius of the Airy disk (radius of the first zero).\n\n    See Also\n    --------\n    Box2D, TrapezoidDisk2D, Gaussian2D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(r) = A \\\\left[\\\\frac{2 J_1(\\\\frac{\\\\pi r}{R/R_z})}{\\\\frac{\\\\pi r}{R/R_z}}\\\\right]^2\n\n    Where :math:`J_1` is the first order Bessel function of the first\n    kind, :math:`r` is radial distance from the maximum of the Airy\n    function (:math:`r = \\\\sqrt{(x - x_0)^2 + (y - y_0)^2}`), :math:`R`\n    is the input ``radius`` parameter, and :math:`R_z =\n    1.2196698912665045`).\n\n    For an optical system, the radius of the first zero represents the\n    limiting angular resolution and is approximately 1.22 * lambda / D,\n    where lambda is the wavelength of the light and D is the diameter of\n    the aperture.\n\n    See [1]_ for more details about the Airy disk.\n\n    References\n    ----------\n    .. [1] https://en.wikipedia.org/wiki/Airy_disk\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude (peak value) of the Airy function\")\n    x_0 = Parameter(default=0, description=\"X position of the peak\")\n    y_0 = Parameter(default=0, description=\"Y position of the peak\")\n    radius = Parameter(default=1,\n                       description=\"The radius of the Airy disk (radius of first zero crossing)\")\n    _rz = None\n    _j1 = None\n\n    @classmethod\n    def evaluate(cls, x, y, amplitude, x_0, y_0, radius):\n        \"\"\"Two dimensional Airy model function\"\"\"\n\n        if cls._rz is None:\n            from scipy.special import j1, jn_zeros\n            cls._rz = jn_zeros(1, 1)[0] / np.pi\n            cls._j1 = j1\n\n        r = np.sqrt((x - x_0) ** 2 + (y - y_0) ** 2) / (radius / cls._rz)\n\n        if isinstance(r, Quantity):\n            # scipy function cannot handle Quantity, so turn into array.\n            r = r.to_value(u.dimensionless_unscaled)\n\n        # Since r can be zero, we have to take care to treat that case\n        # separately so as not to raise a numpy warning\n        z = np.ones(r.shape)\n        rt = np.pi * r[r > 0]\n        z[r > 0] = (2.0 * cls._j1(rt) / rt) ** 2\n\n        if isinstance(amplitude, Quantity):\n            # make z quantity too, otherwise in-place multiplication fails.\n            z = Quantity(z, u.dimensionless_unscaled, copy=False)\n\n        z *= amplitude\n        return z\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'radius': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass Moffat1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Moffat model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the model.\n    x_0 : float\n        x position of the maximum of the Moffat model.\n    gamma : float\n        Core width of the Moffat model.\n    alpha : float\n        Power index of the Moffat model.\n\n    See Also\n    --------\n    Gaussian1D, Box1D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        f(x) = A \\\\left(1 + \\\\frac{\\\\left(x - x_{0}\\\\right)^{2}}{\\\\gamma^{2}}\\\\right)^{- \\\\alpha}\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Moffat1D\n\n        plt.figure()\n        s1 = Moffat1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            s1.width = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude of the model\")\n    x_0 = Parameter(default=0, description=\"X position of maximum of Moffat model\")\n    gamma = Parameter(default=1, description=\"Core width of Moffat model\")\n    alpha = Parameter(default=1, description=\"Power index of the Moffat model\")\n\n    @property\n    def fwhm(self):\n        \"\"\"\n        Moffat full width at half maximum.\n        Derivation of the formula is available in\n        `this notebook by Yoonsoo Bach <https://nbviewer.jupyter.org/github/ysbach/AO_2017/blob/master/04_Ground_Based_Concept.ipynb#1.2.-Moffat>`_.\n        \"\"\"\n        return 2.0 * np.abs(self.gamma) * np.sqrt(2.0 ** (1.0 / self.alpha) - 1.0)\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, gamma, alpha):\n        \"\"\"One dimensional Moffat model function\"\"\"\n\n        return amplitude * (1 + ((x - x_0) / gamma) ** 2) ** (-alpha)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, x_0, gamma, alpha):\n        \"\"\"One dimensional Moffat model derivative with respect to parameters\"\"\"\n\n        fac = (1 + (x - x_0) ** 2 / gamma ** 2)\n        d_A = fac ** (-alpha)\n        d_x_0 = (2 * amplitude * alpha * (x - x_0) * d_A / (fac * gamma ** 2))\n        d_gamma = (2 * amplitude * alpha * (x - x_0) ** 2 * d_A /\n                   (fac * gamma ** 3))\n        d_alpha = -amplitude * d_A * np.log(fac)\n        return [d_A, d_x_0, d_gamma, d_alpha]\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'gamma': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass Moffat2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional Moffat model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the model.\n    x_0 : float\n        x position of the maximum of the Moffat model.\n    y_0 : float\n        y position of the maximum of the Moffat model.\n    gamma : float\n        Core width of the Moffat model.\n    alpha : float\n        Power index of the Moffat model.\n\n    See Also\n    --------\n    Gaussian2D, Box2D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        f(x, y) = A \\\\left(1 + \\\\frac{\\\\left(x - x_{0}\\\\right)^{2} +\n        \\\\left(y - y_{0}\\\\right)^{2}}{\\\\gamma^{2}}\\\\right)^{- \\\\alpha}\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude (peak value) of the model\")\n    x_0 = Parameter(default=0, description=\"X position of the maximum of the Moffat model\")\n    y_0 = Parameter(default=0, description=\"Y position of the maximum of the Moffat model\")\n    gamma = Parameter(default=1, description=\"Core width of the Moffat model\")\n    alpha = Parameter(default=1, description=\"Power index of the Moffat model\")\n\n    @property\n    def fwhm(self):\n        \"\"\"\n        Moffat full width at half maximum.\n        Derivation of the formula is available in\n        `this notebook by Yoonsoo Bach <https://nbviewer.jupyter.org/github/ysbach/AO_2017/blob/master/04_Ground_Based_Concept.ipynb#1.2.-Moffat>`_.\n        \"\"\"\n        return 2.0 * np.abs(self.gamma) * np.sqrt(2.0 ** (1.0 / self.alpha) - 1.0)\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, gamma, alpha):\n        \"\"\"Two dimensional Moffat model function\"\"\"\n\n        rr_gg = ((x - x_0) ** 2 + (y - y_0) ** 2) / gamma ** 2\n        return amplitude * (1 + rr_gg) ** (-alpha)\n\n    @staticmethod\n    def fit_deriv(x, y, amplitude, x_0, y_0, gamma, alpha):\n        \"\"\"Two dimensional Moffat model derivative with respect to parameters\"\"\"\n\n        rr_gg = ((x - x_0) ** 2 + (y - y_0) ** 2) / gamma ** 2\n        d_A = (1 + rr_gg) ** (-alpha)\n        d_x_0 = (2 * amplitude * alpha * d_A * (x - x_0) /\n                 (gamma ** 2 * (1 + rr_gg)))\n        d_y_0 = (2 * amplitude * alpha * d_A * (y - y_0) /\n                 (gamma ** 2 * (1 + rr_gg)))\n        d_alpha = -amplitude * d_A * np.log(1 + rr_gg)\n        d_gamma = (2 * amplitude * alpha * d_A * rr_gg /\n                   (gamma * (1 + rr_gg)))\n        return [d_A, d_x_0, d_y_0, d_gamma, d_alpha]\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {self.inputs[0]: self.x_0.unit,\n                    self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'gamma': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass Sersic2D(Fittable2DModel):\n    r\"\"\"\n    Two dimensional Sersic surface brightness profile.\n\n    Parameters\n    ----------\n    amplitude : float\n        Surface brightness at r_eff.\n    r_eff : float\n        Effective (half-light) radius\n    n : float\n        Sersic Index.\n    x_0 : float, optional\n        x position of the center.\n    y_0 : float, optional\n        y position of the center.\n    ellip : float, optional\n        Ellipticity.\n    theta : float, optional\n        Rotation angle in radians, counterclockwise from\n        the positive x-axis.\n\n    See Also\n    --------\n    Gaussian2D, Moffat2D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        I(x,y) = I(r) = I_e\\exp\\left\\{-b_n\\left[\\left(\\frac{r}{r_{e}}\\right)^{(1/n)}-1\\right]\\right\\}\n\n    The constant :math:`b_n` is defined such that :math:`r_e` contains half the total\n    luminosity, and can be solved for numerically.\n\n    .. math::\n\n        \\Gamma(2n) = 2\\gamma (2n,b_n)\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        from astropy.modeling.models import Sersic2D\n        import matplotlib.pyplot as plt\n\n        x,y = np.meshgrid(np.arange(100), np.arange(100))\n\n        mod = Sersic2D(amplitude = 1, r_eff = 25, n=4, x_0=50, y_0=50,\n                       ellip=.5, theta=-1)\n        img = mod(x, y)\n        log_img = np.log10(img)\n\n\n        plt.figure()\n        plt.imshow(log_img, origin='lower', interpolation='nearest',\n                   vmin=-1, vmax=2)\n        plt.xlabel('x')\n        plt.ylabel('y')\n        cbar = plt.colorbar()\n        cbar.set_label('Log Brightness', rotation=270, labelpad=25)\n        cbar.set_ticks([-1, 0, 1, 2], update_ticks=True)\n        plt.show()\n\n    References\n    ----------\n    .. [1] http://ned.ipac.caltech.edu/level5/March05/Graham/Graham2.html\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Surface brightness at r_eff\")\n    r_eff = Parameter(default=1, description=\"Effective (half-light) radius\")\n    n = Parameter(default=4, description=\"Sersic Index\")\n    x_0 = Parameter(default=0, description=\"X position of the center\")\n    y_0 = Parameter(default=0, description=\"Y position of the center\")\n    ellip = Parameter(default=0, description=\"Ellipticity\")\n    theta = Parameter(default=0, description=\"Rotation angle in radians (counterclockwise-positive)\")\n    _gammaincinv = None\n\n    @classmethod\n    def evaluate(cls, x, y, amplitude, r_eff, n, x_0, y_0, ellip, theta):\n        \"\"\"Two dimensional Sersic profile function.\"\"\"\n\n        if cls._gammaincinv is None:\n            from scipy.special import gammaincinv\n            cls._gammaincinv = gammaincinv\n\n        bn = cls._gammaincinv(2. * n, 0.5)\n        a, b = r_eff, (1 - ellip) * r_eff\n        cos_theta, sin_theta = np.cos(theta), np.sin(theta)\n        x_maj = (x - x_0) * cos_theta + (y - y_0) * sin_theta\n        x_min = -(x - x_0) * sin_theta + (y - y_0) * cos_theta\n        z = np.sqrt((x_maj / a) ** 2 + (x_min / b) ** 2)\n\n        return amplitude * np.exp(-bn * (z ** (1 / n) - 1))\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'r_eff': inputs_unit[self.inputs[0]],\n                'theta': u.rad,\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass KingProjectedAnalytic1D(Fittable1DModel):\n    \"\"\"\n    Projected (surface density) analytic King Model.\n\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude or scaling factor.\n    r_core : float\n        Core radius (f(r_c) ~ 0.5 f_0)\n    r_tide : float\n        Tidal radius.\n\n\n    Notes\n    -----\n\n    This model approximates a King model with an analytic function. The derivation of this\n    equation can be found in King '62 (equation 14). This is just an approximation of the\n    full model and the parameters derived from this model should be taken with caution.\n    It usually works for models with a concentration (c = log10(r_t/r_c) parameter < 2.\n\n    Model formula:\n\n    .. math::\n\n        f(x) = A r_c^2  \\\\left(\\\\frac{1}{\\\\sqrt{(x^2 + r_c^2)}} -\n        \\\\frac{1}{\\\\sqrt{(r_t^2 + r_c^2)}}\\\\right)^2\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        from astropy.modeling.models import KingProjectedAnalytic1D\n        import matplotlib.pyplot as plt\n\n        plt.figure()\n        rt_list = [1, 2, 5, 10, 20]\n        for rt in rt_list:\n            r = np.linspace(0.1, rt, 100)\n\n            mod = KingProjectedAnalytic1D(amplitude = 1, r_core = 1., r_tide = rt)\n            sig = mod(r)\n\n\n            plt.loglog(r, sig/sig[0], label='c ~ {:0.2f}'.format(mod.concentration))\n\n        plt.xlabel(\"r\")\n        plt.ylabel(r\"$\\\\sigma/\\\\sigma_0$\")\n        plt.legend()\n        plt.show()\n\n    References\n    ----------\n    .. [1] https://ui.adsabs.harvard.edu/abs/1962AJ.....67..471K\n    \"\"\"\n\n    amplitude = Parameter(default=1, bounds=(FLOAT_EPSILON, None), description=\"Amplitude or scaling factor\")\n    r_core = Parameter(default=1, bounds=(FLOAT_EPSILON, None), description=\"Core Radius\")\n    r_tide = Parameter(default=2, bounds=(FLOAT_EPSILON, None), description=\"Tidal Radius\")\n\n    @property\n    def concentration(self):\n        \"\"\"Concentration parameter of the king model\"\"\"\n        return np.log10(np.abs(self.r_tide/self.r_core))\n\n    @staticmethod\n    def evaluate(x, amplitude, r_core, r_tide):\n        \"\"\"\n        Analytic King model function.\n        \"\"\"\n\n        result = amplitude * r_core ** 2 * (1/np.sqrt(x ** 2 + r_core ** 2) -\n                                            1/np.sqrt(r_tide ** 2 + r_core ** 2)) ** 2\n\n        # Set invalid r values to 0\n        bounds = (x >= r_tide) | (x < 0)\n        result[bounds] = result[bounds] * 0.\n\n        return result\n\n    @staticmethod\n    def fit_deriv(x, amplitude, r_core, r_tide):\n        \"\"\"\n        Analytic King model function derivatives.\n        \"\"\"\n        d_amplitude = r_core ** 2 * (1/np.sqrt(x ** 2 + r_core ** 2) -\n                                     1/np.sqrt(r_tide ** 2 + r_core ** 2)) ** 2\n\n        d_r_core = 2 * amplitude * r_core ** 2 * (r_core/(r_core ** 2 + r_tide ** 2) ** (3/2) -\n                                                  r_core/(r_core ** 2 + x ** 2) ** (3/2)) * \\\n                   (1./np.sqrt(r_core ** 2 + x ** 2) - 1./np.sqrt(r_core ** 2 + r_tide ** 2)) + \\\n                   2 * amplitude * r_core * (1./np.sqrt(r_core ** 2 + x ** 2) -\n                                             1./np.sqrt(r_core ** 2 + r_tide ** 2)) ** 2\n\n        d_r_tide = (2 * amplitude * r_core ** 2 * r_tide *\n                    (1./np.sqrt(r_core ** 2 + x ** 2) -\n                     1./np.sqrt(r_core ** 2 + r_tide ** 2)))/(r_core ** 2 + r_tide ** 2) ** (3/2)\n\n        # Set invalid r values to 0\n        bounds = (x >= r_tide) | (x < 0)\n        d_amplitude[bounds] = d_amplitude[bounds]*0\n        d_r_core[bounds] = d_r_core[bounds]*0\n        d_r_tide[bounds] = d_r_tide[bounds]*0\n\n        return [d_amplitude, d_r_core, d_r_tide]\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits.\n\n        The model is not defined for r > r_tide.\n\n        ``(r_low, r_high)``\n        \"\"\"\n\n        return (0 * self.r_tide, 1 * self.r_tide)\n\n    @property\n    def input_units(self):\n        if self.r_core.unit is None:\n            return None\n        return {self.inputs[0]: self.r_core.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'r_core': inputs_unit[self.inputs[0]],\n                'r_tide': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass Logarithmic1D(Fittable1DModel):\n    \"\"\"\n    One dimensional logarithmic model.\n\n    Parameters\n    ----------\n    amplitude : float, optional\n    tau : float, optional\n\n    See Also\n    --------\n    Exponential1D, Gaussian1D\n    \"\"\"\n\n    amplitude = Parameter(default=1)\n    tau = Parameter(default=1)\n\n    @staticmethod\n    def evaluate(x, amplitude, tau):\n        return amplitude * np.log(x / tau)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, tau):\n        d_amplitude = np.log(x / tau)\n        d_tau = np.zeros(x.shape) - (amplitude / tau)\n        return [d_amplitude, d_tau]\n\n    @property\n    def inverse(self):\n        new_amplitude = self.tau\n        new_tau = self.amplitude\n        return Exponential1D(amplitude=new_amplitude, tau=new_tau)\n\n    @tau.validator\n    def tau(self, val):\n        if np.all(val == 0):\n            raise ValueError(\"0 is not an allowed value for tau\")\n\n    @property\n    def input_units(self):\n        if self.tau.unit is None:\n            return None\n        return {self.inputs[0]: self.tau.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'tau': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n\n\nclass Exponential1D(Fittable1DModel):\n    \"\"\"\n    One dimensional exponential model.\n\n    Parameters\n    ----------\n    amplitude : float, optional\n    tau : float, optional\n\n    See Also\n    --------\n    Logarithmic1D, Gaussian1D\n    \"\"\"\n    amplitude = Parameter(default=1)\n    tau = Parameter(default=1)\n\n    @staticmethod\n    def evaluate(x, amplitude, tau):\n        return amplitude * np.exp(x / tau)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, tau):\n        ''' Derivative with respect to parameters'''\n        d_amplitude = np.exp(x / tau)\n        d_tau = -amplitude * (x / tau**2) * np.exp(x / tau)\n        return [d_amplitude, d_tau]\n\n    @property\n    def inverse(self):\n        new_amplitude = self.tau\n        new_tau = self.amplitude\n        return Logarithmic1D(amplitude=new_amplitude, tau=new_tau)\n\n    @tau.validator\n    def tau(self, val):\n        ''' tau cannot be 0'''\n        if np.all(val == 0):\n            raise ValueError(\"0 is not an allowed value for tau\")\n\n    @property\n    def input_units(self):\n        if self.tau.unit is None:\n            return None\n        return {self.inputs[0]: self.tau.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'tau': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}\n"},{"attributeType":"function","col":4,"comment":"null","endLoc":439,"id":12760,"name":"__add__","nodeType":"Attribute","startLoc":439,"text":"__add__"},{"className":"Fittable2DModel","col":0,"comment":"\n    Base class for two-dimensional fittable models.\n\n    This class provides an easier interface to defining new models.\n    Examples can be found in `astropy.modeling.functional_models`.\n    ","endLoc":2838,"id":12761,"nodeType":"Class","startLoc":2829,"text":"class Fittable2DModel(FittableModel):\n    \"\"\"\n    Base class for two-dimensional fittable models.\n\n    This class provides an easier interface to defining new models.\n    Examples can be found in `astropy.modeling.functional_models`.\n    \"\"\"\n\n    n_inputs = 2\n    n_outputs = 1"},{"attributeType":"null","col":4,"comment":"null","endLoc":2837,"id":12762,"name":"n_inputs","nodeType":"Attribute","startLoc":2837,"text":"n_inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":2838,"id":12763,"name":"n_outputs","nodeType":"Attribute","startLoc":2838,"text":"n_outputs"},{"className":"Gaussian1D","col":0,"comment":"\n    One dimensional Gaussian model.\n\n    Parameters\n    ----------\n    amplitude : float or `~astropy.units.Quantity`.\n        Amplitude (peak value) of the Gaussian - for a normalized profile\n        (integrating to 1), set amplitude = 1 / (stddev * np.sqrt(2 * np.pi))\n    mean : float or `~astropy.units.Quantity`.\n        Mean of the Gaussian.\n    stddev : float or `~astropy.units.Quantity`.\n        Standard deviation of the Gaussian with FWHM = 2 * stddev * np.sqrt(2 * np.log(2)).\n\n    Notes\n    -----\n    Either all or none of input ``x``, ``mean`` and ``stddev`` must be provided\n    consistently with compatible units or as unitless numbers.\n\n    Model formula:\n\n        .. math:: f(x) = A e^{- \\frac{\\left(x - x_{0}\\right)^{2}}{2 \\sigma^{2}}}\n\n    Examples\n    --------\n    >>> from astropy.modeling import models\n    >>> def tie_center(model):\n    ...         mean = 50 * model.stddev\n    ...         return mean\n    >>> tied_parameters = {'mean': tie_center}\n\n    Specify that 'mean' is a tied parameter in one of two ways:\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3,\n    ...                             tied=tied_parameters)\n\n    or\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3)\n    >>> g1.mean.tied\n    False\n    >>> g1.mean.tied = tie_center\n    >>> g1.mean.tied\n    <function tie_center at 0x...>\n\n    Fixed parameters:\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3,\n    ...                        fixed={'stddev': True})\n    >>> g1.stddev.fixed\n    True\n\n    or\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3)\n    >>> g1.stddev.fixed\n    False\n    >>> g1.stddev.fixed = True\n    >>> g1.stddev.fixed\n    True\n\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Gaussian1D\n\n        plt.figure()\n        s1 = Gaussian1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n\n    See Also\n    --------\n    Gaussian2D, Box1D, Moffat1D, Lorentz1D\n    ","endLoc":190,"id":12764,"nodeType":"Class","startLoc":34,"text":"class Gaussian1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Gaussian model.\n\n    Parameters\n    ----------\n    amplitude : float or `~astropy.units.Quantity`.\n        Amplitude (peak value) of the Gaussian - for a normalized profile\n        (integrating to 1), set amplitude = 1 / (stddev * np.sqrt(2 * np.pi))\n    mean : float or `~astropy.units.Quantity`.\n        Mean of the Gaussian.\n    stddev : float or `~astropy.units.Quantity`.\n        Standard deviation of the Gaussian with FWHM = 2 * stddev * np.sqrt(2 * np.log(2)).\n\n    Notes\n    -----\n    Either all or none of input ``x``, ``mean`` and ``stddev`` must be provided\n    consistently with compatible units or as unitless numbers.\n\n    Model formula:\n\n        .. math:: f(x) = A e^{- \\\\frac{\\\\left(x - x_{0}\\\\right)^{2}}{2 \\\\sigma^{2}}}\n\n    Examples\n    --------\n    >>> from astropy.modeling import models\n    >>> def tie_center(model):\n    ...         mean = 50 * model.stddev\n    ...         return mean\n    >>> tied_parameters = {'mean': tie_center}\n\n    Specify that 'mean' is a tied parameter in one of two ways:\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3,\n    ...                             tied=tied_parameters)\n\n    or\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3)\n    >>> g1.mean.tied\n    False\n    >>> g1.mean.tied = tie_center\n    >>> g1.mean.tied\n    <function tie_center at 0x...>\n\n    Fixed parameters:\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3,\n    ...                        fixed={'stddev': True})\n    >>> g1.stddev.fixed\n    True\n\n    or\n\n    >>> g1 = models.Gaussian1D(amplitude=10, mean=5, stddev=.3)\n    >>> g1.stddev.fixed\n    False\n    >>> g1.stddev.fixed = True\n    >>> g1.stddev.fixed\n    True\n\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Gaussian1D\n\n        plt.figure()\n        s1 = Gaussian1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n\n    See Also\n    --------\n    Gaussian2D, Box1D, Moffat1D, Lorentz1D\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude (peak value) of the Gaussian\")\n    mean = Parameter(default=0, description=\"Position of peak (Gaussian)\")\n\n    # Ensure stddev makes sense if its bounds are not explicitly set.\n    # stddev must be non-zero and positive.\n    stddev = Parameter(default=1, bounds=(FLOAT_EPSILON, None), description=\"Standard deviation of the Gaussian\")\n\n    def bounding_box(self, factor=5.5):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``\n\n        Parameters\n        ----------\n        factor : float\n            The multiple of `stddev` used to define the limits.\n            The default is 5.5, corresponding to a relative error < 1e-7.\n\n        Examples\n        --------\n        >>> from astropy.modeling.models import Gaussian1D\n        >>> model = Gaussian1D(mean=0, stddev=2)\n        >>> model.bounding_box\n        (-11.0, 11.0)\n\n        This range can be set directly (see: `Model.bounding_box\n        <astropy.modeling.Model.bounding_box>`) or by using a different factor,\n        like:\n\n        >>> model.bounding_box = model.bounding_box(factor=2)\n        >>> model.bounding_box\n        (-4.0, 4.0)\n        \"\"\"\n\n        x0 = self.mean\n        dx = factor * self.stddev\n\n        return (x0 - dx, x0 + dx)\n\n    @property\n    def fwhm(self):\n        \"\"\"Gaussian full width at half maximum.\"\"\"\n        return self.stddev * GAUSSIAN_SIGMA_TO_FWHM\n\n    @staticmethod\n    def evaluate(x, amplitude, mean, stddev):\n        \"\"\"\n        Gaussian1D model function.\n        \"\"\"\n        return amplitude * np.exp(- 0.5 * (x - mean) ** 2 / stddev ** 2)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, mean, stddev):\n        \"\"\"\n        Gaussian1D model function derivatives.\n        \"\"\"\n\n        d_amplitude = np.exp(-0.5 / stddev ** 2 * (x - mean) ** 2)\n        d_mean = amplitude * d_amplitude * (x - mean) / stddev ** 2\n        d_stddev = amplitude * d_amplitude * (x - mean) ** 2 / stddev ** 3\n        return [d_amplitude, d_mean, d_stddev]\n\n    @property\n    def input_units(self):\n        if self.mean.unit is None:\n            return None\n        return {self.inputs[0]: self.mean.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'mean': inputs_unit[self.inputs[0]],\n                'stddev': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``\n\n        Parameters\n        ----------\n        factor : float\n            The multiple of `stddev` used to define the limits.\n            The default is 5.5, corresponding to a relative error < 1e-7.\n\n        Examples\n        --------\n        >>> from astropy.modeling.models import Gaussian1D\n        >>> model = Gaussian1D(mean=0, stddev=2)\n        >>> model.bounding_box\n        (-11.0, 11.0)\n\n        This range can be set directly (see: `Model.bounding_box\n        <astropy.modeling.Model.bounding_box>`) or by using a different factor,\n        like:\n\n        >>> model.bounding_box = model.bounding_box(factor=2)\n        >>> model.bounding_box\n        (-4.0, 4.0)\n        ","endLoc":156,"header":"def bounding_box(self, factor=5.5)","id":12765,"name":"bounding_box","nodeType":"Function","startLoc":126,"text":"def bounding_box(self, factor=5.5):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``\n\n        Parameters\n        ----------\n        factor : float\n            The multiple of `stddev` used to define the limits.\n            The default is 5.5, corresponding to a relative error < 1e-7.\n\n        Examples\n        --------\n        >>> from astropy.modeling.models import Gaussian1D\n        >>> model = Gaussian1D(mean=0, stddev=2)\n        >>> model.bounding_box\n        (-11.0, 11.0)\n\n        This range can be set directly (see: `Model.bounding_box\n        <astropy.modeling.Model.bounding_box>`) or by using a different factor,\n        like:\n\n        >>> model.bounding_box = model.bounding_box(factor=2)\n        >>> model.bounding_box\n        (-4.0, 4.0)\n        \"\"\"\n\n        x0 = self.mean\n        dx = factor * self.stddev\n\n        return (x0 - dx, x0 + dx)"},{"col":4,"comment":"Gaussian full width at half maximum.","endLoc":161,"header":"@property\n    def fwhm(self)","id":12766,"name":"fwhm","nodeType":"Function","startLoc":158,"text":"@property\n    def fwhm(self):\n        \"\"\"Gaussian full width at half maximum.\"\"\"\n        return self.stddev * GAUSSIAN_SIGMA_TO_FWHM"},{"col":4,"comment":"\n        Gaussian1D model function.\n        ","endLoc":168,"header":"@staticmethod\n    def evaluate(x, amplitude, mean, stddev)","id":12767,"name":"evaluate","nodeType":"Function","startLoc":163,"text":"@staticmethod\n    def evaluate(x, amplitude, mean, stddev):\n        \"\"\"\n        Gaussian1D model function.\n        \"\"\"\n        return amplitude * np.exp(- 0.5 * (x - mean) ** 2 / stddev ** 2)"},{"attributeType":"function","col":4,"comment":"null","endLoc":440,"id":12768,"name":"__sub__","nodeType":"Attribute","startLoc":440,"text":"__sub__"},{"col":4,"comment":"\n        Gaussian1D model function derivatives.\n        ","endLoc":179,"header":"@staticmethod\n    def fit_deriv(x, amplitude, mean, stddev)","id":12769,"name":"fit_deriv","nodeType":"Function","startLoc":170,"text":"@staticmethod\n    def fit_deriv(x, amplitude, mean, stddev):\n        \"\"\"\n        Gaussian1D model function derivatives.\n        \"\"\"\n\n        d_amplitude = np.exp(-0.5 / stddev ** 2 * (x - mean) ** 2)\n        d_mean = amplitude * d_amplitude * (x - mean) / stddev ** 2\n        d_stddev = amplitude * d_amplitude * (x - mean) ** 2 / stddev ** 3\n        return [d_amplitude, d_mean, d_stddev]"},{"attributeType":"function","col":4,"comment":"null","endLoc":441,"id":12770,"name":"__mul__","nodeType":"Attribute","startLoc":441,"text":"__mul__"},{"col":4,"comment":"null","endLoc":185,"header":"@property\n    def input_units(self)","id":12771,"name":"input_units","nodeType":"Function","startLoc":181,"text":"@property\n    def input_units(self):\n        if self.mean.unit is None:\n            return None\n        return {self.inputs[0]: self.mean.unit}"},{"col":4,"comment":"null","endLoc":190,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":12772,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":187,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'mean': inputs_unit[self.inputs[0]],\n                'stddev': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":119,"id":12773,"name":"amplitude","nodeType":"Attribute","startLoc":119,"text":"amplitude"},{"attributeType":"function","col":4,"comment":"null","endLoc":442,"id":12774,"name":"__truediv__","nodeType":"Attribute","startLoc":442,"text":"__truediv__"},{"attributeType":"function","col":4,"comment":"null","endLoc":443,"id":12775,"name":"__pow__","nodeType":"Attribute","startLoc":443,"text":"__pow__"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":120,"id":12776,"name":"mean","nodeType":"Attribute","startLoc":120,"text":"mean"},{"attributeType":"function","col":4,"comment":"null","endLoc":444,"id":12777,"name":"__or__","nodeType":"Attribute","startLoc":444,"text":"__or__"},{"attributeType":"function","col":4,"comment":"null","endLoc":445,"id":12778,"name":"__and__","nodeType":"Attribute","startLoc":445,"text":"__and__"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":124,"id":12779,"name":"stddev","nodeType":"Attribute","startLoc":124,"text":"stddev"},{"attributeType":"function","col":4,"comment":"null","endLoc":446,"id":12780,"name":"_fix_inputs","nodeType":"Attribute","startLoc":446,"text":"_fix_inputs"},{"attributeType":"null","col":8,"comment":"null","endLoc":265,"id":12781,"name":"_inverse","nodeType":"Attribute","startLoc":265,"text":"cls._inverse"},{"col":0,"comment":"null","endLoc":97,"header":"def _binary_comparison_operation(op)","id":12782,"name":"_binary_comparison_operation","nodeType":"Function","startLoc":86,"text":"def _binary_comparison_operation(op):\n    @functools.wraps(op)\n    def wrapper(self, val):\n\n        if self.unit is not None:\n            self_value = Quantity(self.value, self.unit)\n        else:\n            self_value = self.value\n\n        return op(self_value, val)\n\n    return wrapper"},{"className":"Gaussian2D","col":0,"comment":"\n    Two dimensional Gaussian model.\n\n    Parameters\n    ----------\n    amplitude : float or `~astropy.units.Quantity`.\n        Amplitude (peak value) of the Gaussian.\n    x_mean : float or `~astropy.units.Quantity`.\n        Mean of the Gaussian in x.\n    y_mean : float or `~astropy.units.Quantity`.\n        Mean of the Gaussian in y.\n    x_stddev : float or `~astropy.units.Quantity` or None.\n        Standard deviation of the Gaussian in x before rotating by theta. Must\n        be None if a covariance matrix (``cov_matrix``) is provided. If no\n        ``cov_matrix`` is given, ``None`` means the default value (1).\n    y_stddev : float or `~astropy.units.Quantity` or None.\n        Standard deviation of the Gaussian in y before rotating by theta. Must\n        be None if a covariance matrix (``cov_matrix``) is provided. If no\n        ``cov_matrix`` is given, ``None`` means the default value (1).\n    theta : float or `~astropy.units.Quantity`, optional.\n        Rotation angle (value in radians). The rotation angle increases\n        counterclockwise.  Must be None if a covariance matrix (``cov_matrix``)\n        is provided. If no ``cov_matrix`` is given, ``None`` means the default\n        value (0).\n    cov_matrix : ndarray, optional\n        A 2x2 covariance matrix. If specified, overrides the ``x_stddev``,\n        ``y_stddev``, and ``theta`` defaults.\n\n    Notes\n    -----\n    Either all or none of input ``x, y``, ``[x,y]_mean`` and ``[x,y]_stddev``\n    must be provided consistently with compatible units or as unitless numbers.\n\n    Model formula:\n\n        .. math::\n\n            f(x, y) = A e^{-a\\left(x - x_{0}\\right)^{2}  -b\\left(x - x_{0}\\right)\n            \\left(y - y_{0}\\right)  -c\\left(y - y_{0}\\right)^{2}}\n\n    Using the following definitions:\n\n        .. math::\n            a = \\left(\\frac{\\cos^{2}{\\left (\\theta \\right )}}{2 \\sigma_{x}^{2}} +\n            \\frac{\\sin^{2}{\\left (\\theta \\right )}}{2 \\sigma_{y}^{2}}\\right)\n\n            b = \\left(\\frac{\\sin{\\left (2 \\theta \\right )}}{2 \\sigma_{x}^{2}} -\n            \\frac{\\sin{\\left (2 \\theta \\right )}}{2 \\sigma_{y}^{2}}\\right)\n\n            c = \\left(\\frac{\\sin^{2}{\\left (\\theta \\right )}}{2 \\sigma_{x}^{2}} +\n            \\frac{\\cos^{2}{\\left (\\theta \\right )}}{2 \\sigma_{y}^{2}}\\right)\n\n    If using a ``cov_matrix``, the model is of the form:\n        .. math::\n            f(x, y) = A e^{-0.5 \\left(\\vec{x} - \\vec{x}_{0}\\right)^{T} \\Sigma^{-1} \\left(\\vec{x} - \\vec{x}_{0}\\right)}\n\n    where :math:`\\vec{x} = [x, y]`, :math:`\\vec{x}_{0} = [x_{0}, y_{0}]`,\n    and :math:`\\Sigma` is the covariance matrix:\n\n        .. math::\n            \\Sigma = \\left(\\begin{array}{ccc}\n            \\sigma_x^2               & \\rho \\sigma_x \\sigma_y \\\\\n            \\rho \\sigma_x \\sigma_y   & \\sigma_y^2\n            \\end{array}\\right)\n\n    :math:`\\rho` is the correlation between ``x`` and ``y``, which should\n    be between -1 and +1.  Positive correlation corresponds to a\n    ``theta`` in the range 0 to 90 degrees.  Negative correlation\n    corresponds to a ``theta`` in the range of 0 to -90 degrees.\n\n    See [1]_ for more details about the 2D Gaussian function.\n\n    See Also\n    --------\n    Gaussian1D, Box2D, Moffat2D\n\n    References\n    ----------\n    .. [1] https://en.wikipedia.org/wiki/Gaussian_function\n    ","endLoc":449,"id":12783,"nodeType":"Class","startLoc":193,"text":"class Gaussian2D(Fittable2DModel):\n    r\"\"\"\n    Two dimensional Gaussian model.\n\n    Parameters\n    ----------\n    amplitude : float or `~astropy.units.Quantity`.\n        Amplitude (peak value) of the Gaussian.\n    x_mean : float or `~astropy.units.Quantity`.\n        Mean of the Gaussian in x.\n    y_mean : float or `~astropy.units.Quantity`.\n        Mean of the Gaussian in y.\n    x_stddev : float or `~astropy.units.Quantity` or None.\n        Standard deviation of the Gaussian in x before rotating by theta. Must\n        be None if a covariance matrix (``cov_matrix``) is provided. If no\n        ``cov_matrix`` is given, ``None`` means the default value (1).\n    y_stddev : float or `~astropy.units.Quantity` or None.\n        Standard deviation of the Gaussian in y before rotating by theta. Must\n        be None if a covariance matrix (``cov_matrix``) is provided. If no\n        ``cov_matrix`` is given, ``None`` means the default value (1).\n    theta : float or `~astropy.units.Quantity`, optional.\n        Rotation angle (value in radians). The rotation angle increases\n        counterclockwise.  Must be None if a covariance matrix (``cov_matrix``)\n        is provided. If no ``cov_matrix`` is given, ``None`` means the default\n        value (0).\n    cov_matrix : ndarray, optional\n        A 2x2 covariance matrix. If specified, overrides the ``x_stddev``,\n        ``y_stddev``, and ``theta`` defaults.\n\n    Notes\n    -----\n    Either all or none of input ``x, y``, ``[x,y]_mean`` and ``[x,y]_stddev``\n    must be provided consistently with compatible units or as unitless numbers.\n\n    Model formula:\n\n        .. math::\n\n            f(x, y) = A e^{-a\\left(x - x_{0}\\right)^{2}  -b\\left(x - x_{0}\\right)\n            \\left(y - y_{0}\\right)  -c\\left(y - y_{0}\\right)^{2}}\n\n    Using the following definitions:\n\n        .. math::\n            a = \\left(\\frac{\\cos^{2}{\\left (\\theta \\right )}}{2 \\sigma_{x}^{2}} +\n            \\frac{\\sin^{2}{\\left (\\theta \\right )}}{2 \\sigma_{y}^{2}}\\right)\n\n            b = \\left(\\frac{\\sin{\\left (2 \\theta \\right )}}{2 \\sigma_{x}^{2}} -\n            \\frac{\\sin{\\left (2 \\theta \\right )}}{2 \\sigma_{y}^{2}}\\right)\n\n            c = \\left(\\frac{\\sin^{2}{\\left (\\theta \\right )}}{2 \\sigma_{x}^{2}} +\n            \\frac{\\cos^{2}{\\left (\\theta \\right )}}{2 \\sigma_{y}^{2}}\\right)\n\n    If using a ``cov_matrix``, the model is of the form:\n        .. math::\n            f(x, y) = A e^{-0.5 \\left(\\vec{x} - \\vec{x}_{0}\\right)^{T} \\Sigma^{-1} \\left(\\vec{x} - \\vec{x}_{0}\\right)}\n\n    where :math:`\\vec{x} = [x, y]`, :math:`\\vec{x}_{0} = [x_{0}, y_{0}]`,\n    and :math:`\\Sigma` is the covariance matrix:\n\n        .. math::\n            \\Sigma = \\left(\\begin{array}{ccc}\n            \\sigma_x^2               & \\rho \\sigma_x \\sigma_y \\\\\n            \\rho \\sigma_x \\sigma_y   & \\sigma_y^2\n            \\end{array}\\right)\n\n    :math:`\\rho` is the correlation between ``x`` and ``y``, which should\n    be between -1 and +1.  Positive correlation corresponds to a\n    ``theta`` in the range 0 to 90 degrees.  Negative correlation\n    corresponds to a ``theta`` in the range of 0 to -90 degrees.\n\n    See [1]_ for more details about the 2D Gaussian function.\n\n    See Also\n    --------\n    Gaussian1D, Box2D, Moffat2D\n\n    References\n    ----------\n    .. [1] https://en.wikipedia.org/wiki/Gaussian_function\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude of the Gaussian\")\n    x_mean = Parameter(default=0, description=\"Peak position (along x axis) of Gaussian\")\n    y_mean = Parameter(default=0, description=\"Peak position (along y axis) of Gaussian\")\n    x_stddev = Parameter(default=1, description=\"Standard deviation of the Gaussian (along x axis)\")\n    y_stddev = Parameter(default=1, description=\"Standard deviation of the Gaussian (along y axis)\")\n    theta = Parameter(default=0.0, description=\"Rotation angle [in radians] (Optional parameter)\")\n\n    def __init__(self, amplitude=amplitude.default, x_mean=x_mean.default,\n                 y_mean=y_mean.default, x_stddev=None, y_stddev=None,\n                 theta=None, cov_matrix=None, **kwargs):\n        if cov_matrix is None:\n            if x_stddev is None:\n                x_stddev = self.__class__.x_stddev.default\n            if y_stddev is None:\n                y_stddev = self.__class__.y_stddev.default\n            if theta is None:\n                theta = self.__class__.theta.default\n        else:\n            if x_stddev is not None or y_stddev is not None or theta is not None:\n                raise InputParameterError(\"Cannot specify both cov_matrix and \"\n                                          \"x/y_stddev/theta\")\n            # Compute principle coordinate system transformation\n            cov_matrix = np.array(cov_matrix)\n\n            if cov_matrix.shape != (2, 2):\n                raise ValueError(\"Covariance matrix must be 2x2\")\n\n            eig_vals, eig_vecs = np.linalg.eig(cov_matrix)\n            x_stddev, y_stddev = np.sqrt(eig_vals)\n            y_vec = eig_vecs[:, 0]\n            theta = np.arctan2(y_vec[1], y_vec[0])\n\n        # Ensure stddev makes sense if its bounds are not explicitly set.\n        # stddev must be non-zero and positive.\n        # TODO: Investigate why setting this in Parameter above causes\n        #       convolution tests to hang.\n        kwargs.setdefault('bounds', {})\n        kwargs['bounds'].setdefault('x_stddev', (FLOAT_EPSILON, None))\n        kwargs['bounds'].setdefault('y_stddev', (FLOAT_EPSILON, None))\n\n        super().__init__(\n            amplitude=amplitude, x_mean=x_mean, y_mean=y_mean,\n            x_stddev=x_stddev, y_stddev=y_stddev, theta=theta, **kwargs)\n\n    @property\n    def x_fwhm(self):\n        \"\"\"Gaussian full width at half maximum in X.\"\"\"\n        return self.x_stddev * GAUSSIAN_SIGMA_TO_FWHM\n\n    @property\n    def y_fwhm(self):\n        \"\"\"Gaussian full width at half maximum in Y.\"\"\"\n        return self.y_stddev * GAUSSIAN_SIGMA_TO_FWHM\n\n    def bounding_box(self, factor=5.5):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits in each dimension,\n        ``((y_low, y_high), (x_low, x_high))``\n\n        The default offset from the mean is 5.5-sigma, corresponding\n        to a relative error < 1e-7. The limits are adjusted for rotation.\n\n        Parameters\n        ----------\n        factor : float, optional\n            The multiple of `x_stddev` and `y_stddev` used to define the limits.\n            The default is 5.5.\n\n        Examples\n        --------\n        >>> from astropy.modeling.models import Gaussian2D\n        >>> model = Gaussian2D(x_mean=0, y_mean=0, x_stddev=1, y_stddev=2)\n        >>> model.bounding_box\n        ((-11.0, 11.0), (-5.5, 5.5))\n\n        This range can be set directly (see: `Model.bounding_box\n        <astropy.modeling.Model.bounding_box>`) or by using a different factor\n        like:\n\n        >>> model.bounding_box = model.bounding_box(factor=2)\n        >>> model.bounding_box\n        ((-4.0, 4.0), (-2.0, 2.0))\n        \"\"\"\n\n        a = factor * self.x_stddev\n        b = factor * self.y_stddev\n        theta = self.theta.value\n        dx, dy = ellipse_extent(a, b, theta)\n\n        return ((self.y_mean - dy, self.y_mean + dy),\n                (self.x_mean - dx, self.x_mean + dx))\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_mean, y_mean, x_stddev, y_stddev, theta):\n        \"\"\"Two dimensional Gaussian function\"\"\"\n\n        cost2 = np.cos(theta) ** 2\n        sint2 = np.sin(theta) ** 2\n        sin2t = np.sin(2. * theta)\n        xstd2 = x_stddev ** 2\n        ystd2 = y_stddev ** 2\n        xdiff = x - x_mean\n        ydiff = y - y_mean\n        a = 0.5 * ((cost2 / xstd2) + (sint2 / ystd2))\n        b = 0.5 * ((sin2t / xstd2) - (sin2t / ystd2))\n        c = 0.5 * ((sint2 / xstd2) + (cost2 / ystd2))\n        return amplitude * np.exp(-((a * xdiff ** 2) + (b * xdiff * ydiff) +\n                                    (c * ydiff ** 2)))\n\n    @staticmethod\n    def fit_deriv(x, y, amplitude, x_mean, y_mean, x_stddev, y_stddev, theta):\n        \"\"\"Two dimensional Gaussian function derivative with respect to parameters\"\"\"\n\n        cost = np.cos(theta)\n        sint = np.sin(theta)\n        cost2 = np.cos(theta) ** 2\n        sint2 = np.sin(theta) ** 2\n        cos2t = np.cos(2. * theta)\n        sin2t = np.sin(2. * theta)\n        xstd2 = x_stddev ** 2\n        ystd2 = y_stddev ** 2\n        xstd3 = x_stddev ** 3\n        ystd3 = y_stddev ** 3\n        xdiff = x - x_mean\n        ydiff = y - y_mean\n        xdiff2 = xdiff ** 2\n        ydiff2 = ydiff ** 2\n        a = 0.5 * ((cost2 / xstd2) + (sint2 / ystd2))\n        b = 0.5 * ((sin2t / xstd2) - (sin2t / ystd2))\n        c = 0.5 * ((sint2 / xstd2) + (cost2 / ystd2))\n        g = amplitude * np.exp(-((a * xdiff2) + (b * xdiff * ydiff) +\n                                 (c * ydiff2)))\n        da_dtheta = (sint * cost * ((1. / ystd2) - (1. / xstd2)))\n        da_dx_stddev = -cost2 / xstd3\n        da_dy_stddev = -sint2 / ystd3\n        db_dtheta = (cos2t / xstd2) - (cos2t / ystd2)\n        db_dx_stddev = -sin2t / xstd3\n        db_dy_stddev = sin2t / ystd3\n        dc_dtheta = -da_dtheta\n        dc_dx_stddev = -sint2 / xstd3\n        dc_dy_stddev = -cost2 / ystd3\n        dg_dA = g / amplitude\n        dg_dx_mean = g * ((2. * a * xdiff) + (b * ydiff))\n        dg_dy_mean = g * ((b * xdiff) + (2. * c * ydiff))\n        dg_dx_stddev = g * (-(da_dx_stddev * xdiff2 +\n                              db_dx_stddev * xdiff * ydiff +\n                              dc_dx_stddev * ydiff2))\n        dg_dy_stddev = g * (-(da_dy_stddev * xdiff2 +\n                              db_dy_stddev * xdiff * ydiff +\n                              dc_dy_stddev * ydiff2))\n        dg_dtheta = g * (-(da_dtheta * xdiff2 +\n                           db_dtheta * xdiff * ydiff +\n                           dc_dtheta * ydiff2))\n        return [dg_dA, dg_dx_mean, dg_dy_mean, dg_dx_stddev, dg_dy_stddev,\n                dg_dtheta]\n\n    @property\n    def input_units(self):\n        if self.x_mean.unit is None and self.y_mean.unit is None:\n            return None\n        return {self.inputs[0]: self.x_mean.unit,\n                self.inputs[1]: self.y_mean.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_mean': inputs_unit[self.inputs[0]],\n                'y_mean': inputs_unit[self.inputs[0]],\n                'x_stddev': inputs_unit[self.inputs[0]],\n                'y_stddev': inputs_unit[self.inputs[0]],\n                'theta': u.rad,\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":111,"id":12784,"name":"alpha_1","nodeType":"Attribute","startLoc":111,"text":"alpha_1"},{"col":4,"comment":"Gaussian full width at half maximum in X.","endLoc":322,"header":"@property\n    def x_fwhm(self)","id":12785,"name":"x_fwhm","nodeType":"Function","startLoc":319,"text":"@property\n    def x_fwhm(self):\n        \"\"\"Gaussian full width at half maximum in X.\"\"\"\n        return self.x_stddev * GAUSSIAN_SIGMA_TO_FWHM"},{"col":4,"comment":"Gaussian full width at half maximum in Y.","endLoc":327,"header":"@property\n    def y_fwhm(self)","id":12786,"name":"y_fwhm","nodeType":"Function","startLoc":324,"text":"@property\n    def y_fwhm(self):\n        \"\"\"Gaussian full width at half maximum in Y.\"\"\"\n        return self.y_stddev * GAUSSIAN_SIGMA_TO_FWHM"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box`` limits in each dimension,\n        ``((y_low, y_high), (x_low, x_high))``\n\n        The default offset from the mean is 5.5-sigma, corresponding\n        to a relative error < 1e-7. The limits are adjusted for rotation.\n\n        Parameters\n        ----------\n        factor : float, optional\n            The multiple of `x_stddev` and `y_stddev` used to define the limits.\n            The default is 5.5.\n\n        Examples\n        --------\n        >>> from astropy.modeling.models import Gaussian2D\n        >>> model = Gaussian2D(x_mean=0, y_mean=0, x_stddev=1, y_stddev=2)\n        >>> model.bounding_box\n        ((-11.0, 11.0), (-5.5, 5.5))\n\n        This range can be set directly (see: `Model.bounding_box\n        <astropy.modeling.Model.bounding_box>`) or by using a different factor\n        like:\n\n        >>> model.bounding_box = model.bounding_box(factor=2)\n        >>> model.bounding_box\n        ((-4.0, 4.0), (-2.0, 2.0))\n        ","endLoc":365,"header":"def bounding_box(self, factor=5.5)","id":12787,"name":"bounding_box","nodeType":"Function","startLoc":329,"text":"def bounding_box(self, factor=5.5):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits in each dimension,\n        ``((y_low, y_high), (x_low, x_high))``\n\n        The default offset from the mean is 5.5-sigma, corresponding\n        to a relative error < 1e-7. The limits are adjusted for rotation.\n\n        Parameters\n        ----------\n        factor : float, optional\n            The multiple of `x_stddev` and `y_stddev` used to define the limits.\n            The default is 5.5.\n\n        Examples\n        --------\n        >>> from astropy.modeling.models import Gaussian2D\n        >>> model = Gaussian2D(x_mean=0, y_mean=0, x_stddev=1, y_stddev=2)\n        >>> model.bounding_box\n        ((-11.0, 11.0), (-5.5, 5.5))\n\n        This range can be set directly (see: `Model.bounding_box\n        <astropy.modeling.Model.bounding_box>`) or by using a different factor\n        like:\n\n        >>> model.bounding_box = model.bounding_box(factor=2)\n        >>> model.bounding_box\n        ((-4.0, 4.0), (-2.0, 2.0))\n        \"\"\"\n\n        a = factor * self.x_stddev\n        b = factor * self.y_stddev\n        theta = self.theta.value\n        dx, dy = ellipse_extent(a, b, theta)\n\n        return ((self.y_mean - dy, self.y_mean + dy),\n                (self.x_mean - dx, self.x_mean + dx))"},{"col":4,"comment":"Two dimensional Gaussian function","endLoc":382,"header":"@staticmethod\n    def evaluate(x, y, amplitude, x_mean, y_mean, x_stddev, y_stddev, theta)","id":12788,"name":"evaluate","nodeType":"Function","startLoc":367,"text":"@staticmethod\n    def evaluate(x, y, amplitude, x_mean, y_mean, x_stddev, y_stddev, theta):\n        \"\"\"Two dimensional Gaussian function\"\"\"\n\n        cost2 = np.cos(theta) ** 2\n        sint2 = np.sin(theta) ** 2\n        sin2t = np.sin(2. * theta)\n        xstd2 = x_stddev ** 2\n        ystd2 = y_stddev ** 2\n        xdiff = x - x_mean\n        ydiff = y - y_mean\n        a = 0.5 * ((cost2 / xstd2) + (sint2 / ystd2))\n        b = 0.5 * ((sin2t / xstd2) - (sin2t / ystd2))\n        c = 0.5 * ((sint2 / xstd2) + (cost2 / ystd2))\n        return amplitude * np.exp(-((a * xdiff ** 2) + (b * xdiff * ydiff) +\n                                    (c * ydiff ** 2)))"},{"attributeType":"null","col":8,"comment":"null","endLoc":92,"id":12789,"name":"opermethods","nodeType":"Attribute","startLoc":92,"text":"opermethods"},{"attributeType":"null","col":12,"comment":"null","endLoc":405,"id":12790,"name":"__call__","nodeType":"Attribute","startLoc":405,"text":"cls.__call__"},{"col":4,"comment":"Two dimensional Gaussian function derivative with respect to parameters","endLoc":429,"header":"@staticmethod\n    def fit_deriv(x, y, amplitude, x_mean, y_mean, x_stddev, y_stddev, theta)","id":12791,"name":"fit_deriv","nodeType":"Function","startLoc":384,"text":"@staticmethod\n    def fit_deriv(x, y, amplitude, x_mean, y_mean, x_stddev, y_stddev, theta):\n        \"\"\"Two dimensional Gaussian function derivative with respect to parameters\"\"\"\n\n        cost = np.cos(theta)\n        sint = np.sin(theta)\n        cost2 = np.cos(theta) ** 2\n        sint2 = np.sin(theta) ** 2\n        cos2t = np.cos(2. * theta)\n        sin2t = np.sin(2. * theta)\n        xstd2 = x_stddev ** 2\n        ystd2 = y_stddev ** 2\n        xstd3 = x_stddev ** 3\n        ystd3 = y_stddev ** 3\n        xdiff = x - x_mean\n        ydiff = y - y_mean\n        xdiff2 = xdiff ** 2\n        ydiff2 = ydiff ** 2\n        a = 0.5 * ((cost2 / xstd2) + (sint2 / ystd2))\n        b = 0.5 * ((sin2t / xstd2) - (sin2t / ystd2))\n        c = 0.5 * ((sint2 / xstd2) + (cost2 / ystd2))\n        g = amplitude * np.exp(-((a * xdiff2) + (b * xdiff * ydiff) +\n                                 (c * ydiff2)))\n        da_dtheta = (sint * cost * ((1. / ystd2) - (1. / xstd2)))\n        da_dx_stddev = -cost2 / xstd3\n        da_dy_stddev = -sint2 / ystd3\n        db_dtheta = (cos2t / xstd2) - (cos2t / ystd2)\n        db_dx_stddev = -sin2t / xstd3\n        db_dy_stddev = sin2t / ystd3\n        dc_dtheta = -da_dtheta\n        dc_dx_stddev = -sint2 / xstd3\n        dc_dy_stddev = -cost2 / ystd3\n        dg_dA = g / amplitude\n        dg_dx_mean = g * ((2. * a * xdiff) + (b * ydiff))\n        dg_dy_mean = g * ((b * xdiff) + (2. * c * ydiff))\n        dg_dx_stddev = g * (-(da_dx_stddev * xdiff2 +\n                              db_dx_stddev * xdiff * ydiff +\n                              dc_dx_stddev * ydiff2))\n        dg_dy_stddev = g * (-(da_dy_stddev * xdiff2 +\n                              db_dy_stddev * xdiff * ydiff +\n                              dc_dy_stddev * ydiff2))\n        dg_dtheta = g * (-(da_dtheta * xdiff2 +\n                           db_dtheta * xdiff * ydiff +\n                           dc_dtheta * ydiff2))\n        return [dg_dA, dg_dx_mean, dg_dy_mean, dg_dx_stddev, dg_dy_stddev,\n                dg_dtheta]"},{"attributeType":"null","col":16,"comment":"null","endLoc":127,"id":12792,"name":"param_names","nodeType":"Attribute","startLoc":127,"text":"cls.param_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":108,"id":12793,"name":"cls","nodeType":"Attribute","startLoc":108,"text":"cls"},{"attributeType":"Callable | Callable | Callable | Callable","col":8,"comment":"null","endLoc":305,"id":12794,"name":"_bounding_box","nodeType":"Attribute","startLoc":305,"text":"cls._bounding_box"},{"col":4,"comment":"null","endLoc":436,"header":"@property\n    def input_units(self)","id":12795,"name":"input_units","nodeType":"Function","startLoc":431,"text":"@property\n    def input_units(self):\n        if self.x_mean.unit is None and self.y_mean.unit is None:\n            return None\n        return {self.inputs[0]: self.x_mean.unit,\n                self.inputs[1]: self.y_mean.unit}"},{"col":4,"comment":"null","endLoc":449,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":12796,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":438,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_mean': inputs_unit[self.inputs[0]],\n                'y_mean': inputs_unit[self.inputs[0]],\n                'x_stddev': inputs_unit[self.inputs[0]],\n                'y_stddev': inputs_unit[self.inputs[0]],\n                'theta': u.rad,\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":12,"comment":"null","endLoc":436,"id":12797,"name":"__init__","nodeType":"Attribute","startLoc":436,"text":"cls.__init__"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":275,"id":12798,"name":"amplitude","nodeType":"Attribute","startLoc":275,"text":"amplitude"},{"attributeType":"null","col":16,"comment":"null","endLoc":125,"id":12799,"name":"_param_names","nodeType":"Attribute","startLoc":125,"text":"cls._param_names"},{"col":0,"comment":"null","endLoc":2851,"header":"def _make_arithmetic_operator(oper)","id":12800,"name":"_make_arithmetic_operator","nodeType":"Function","startLoc":2841,"text":"def _make_arithmetic_operator(oper):\n    # We don't bother with tuple unpacking here for efficiency's sake, but for\n    # documentation purposes:\n    #\n    #     f_eval, f_n_inputs, f_n_outputs = f\n    #\n    # and similarly for g\n    def op(f, g):\n        return (make_binary_operator_eval(oper, f[0], g[0]), f[1], f[2])\n\n    return op"},{"col":0,"comment":"null","endLoc":2862,"header":"def _composition_operator(f, g)","id":12801,"name":"_composition_operator","nodeType":"Function","startLoc":2854,"text":"def _composition_operator(f, g):\n    # We don't bother with tuple unpacking here for efficiency's sake, but for\n    # documentation purposes:\n    #\n    #     f_eval, f_n_inputs, f_n_outputs = f\n    #\n    # and similarly for g\n    return (lambda inputs, params: g[0](f[0](inputs, params), params),\n            f[1], g[2])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":112,"id":12802,"name":"alpha_2","nodeType":"Attribute","startLoc":112,"text":"alpha_2"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":266,"id":12803,"name":"lat","nodeType":"Attribute","startLoc":266,"text":"lat"},{"col":12,"endLoc":2861,"id":12804,"nodeType":"Lambda","startLoc":2861,"text":"lambda inputs, params: g[0](f[0](inputs, params), params)"},{"col":0,"comment":"null","endLoc":2874,"header":"def _join_operator(f, g)","id":12805,"name":"_join_operator","nodeType":"Function","startLoc":2865,"text":"def _join_operator(f, g):\n    # We don't bother with tuple unpacking here for efficiency's sake, but for\n    # documentation purposes:\n    #\n    #     f_eval, f_n_inputs, f_n_outputs = f\n    #\n    # and similarly for g\n    return (lambda inputs, params: (f[0](inputs[:f[1]], params) +\n                                    g[0](inputs[f[1]:], params)),\n            f[1] + g[1], f[2] + g[2])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":267,"id":12806,"name":"lon_pole","nodeType":"Attribute","startLoc":267,"text":"lon_pole"},{"col":12,"endLoc":2873,"id":12807,"nodeType":"Lambda","startLoc":2872,"text":"lambda inputs, params: (f[0](inputs[:f[1]], params) +\n                                    g[0](inputs[f[1]:], params))"},{"col":0,"comment":"null","endLoc":2891,"header":"def _add_special_operator(sop_name, sop)","id":12808,"name":"_add_special_operator","nodeType":"Function","startLoc":2890,"text":"def _add_special_operator(sop_name, sop):\n    return SPECIAL_OPERATORS.add(sop_name, sop)"},{"col":0,"comment":"null","endLoc":111,"header":"def _unary_arithmetic_operation(op)","id":12809,"name":"_unary_arithmetic_operation","nodeType":"Function","startLoc":100,"text":"def _unary_arithmetic_operation(op):\n    @functools.wraps(op)\n    def wrapper(self):\n\n        if self.unit is not None:\n            self_value = Quantity(self.value, self.unit)\n        else:\n            self_value = self.value\n\n        return op(self_value)\n\n    return wrapper"},{"className":"SmoothlyBrokenPowerLaw1D","col":0,"comment":"One dimensional smoothly broken power law model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Model amplitude at the break point.\n    x_break : float\n        Break point.\n    alpha_1 : float\n        Power law index for ``x << x_break``.\n    alpha_2 : float\n        Power law index for ``x >> x_break``.\n    delta : float\n        Smoothness parameter.\n\n    See Also\n    --------\n    BrokenPowerLaw1D\n\n    Notes\n    -----\n    Model formula (with :math:`A` for ``amplitude``, :math:`x_b` for\n    ``x_break``, :math:`\\alpha_1` for ``alpha_1``,\n    :math:`\\alpha_2` for ``alpha_2`` and :math:`\\Delta` for\n    ``delta``):\n\n        .. math::\n\n            f(x) = A \\left( \\frac{x}{x_b} \\right) ^ {-\\alpha_1}\n                   \\left\\{\n                      \\frac{1}{2}\n                      \\left[\n                        1 + \\left( \\frac{x}{x_b}\\right)^{1 / \\Delta}\n                      \\right]\n                   \\right\\}^{(\\alpha_1 - \\alpha_2) \\Delta}\n\n\n    The change of slope occurs between the values :math:`x_1`\n    and :math:`x_2` such that:\n\n        .. math::\n            \\log_{10} \\frac{x_2}{x_b} = \\log_{10} \\frac{x_b}{x_1}\n            \\sim \\Delta\n\n\n    At values :math:`x \\lesssim x_1` and :math:`x \\gtrsim x_2` the\n    model is approximately a simple power law with index\n    :math:`\\alpha_1` and :math:`\\alpha_2` respectively.  The two\n    power laws are smoothly joined at values :math:`x_1 < x < x_2`,\n    hence the :math:`\\Delta` parameter sets the \"smoothness\" of the\n    slope change.\n\n    The ``delta`` parameter is bounded to values greater than 1e-3\n    (corresponding to :math:`x_2 / x_1 \\gtrsim 1.002`) to avoid\n    overflow errors.\n\n    The ``amplitude`` parameter is bounded to positive values since\n    this model is typically used to represent positive quantities.\n\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n        from astropy.modeling import models\n\n        x = np.logspace(0.7, 2.3, 500)\n        f = models.SmoothlyBrokenPowerLaw1D(amplitude=1, x_break=20,\n                                            alpha_1=-2, alpha_2=2)\n\n        plt.figure()\n        plt.title(\"amplitude=1, x_break=20, alpha_1=-2, alpha_2=2\")\n\n        f.delta = 0.5\n        plt.loglog(x, f(x), '--', label='delta=0.5')\n\n        f.delta = 0.3\n        plt.loglog(x, f(x), '-.', label='delta=0.3')\n\n        f.delta = 0.1\n        plt.loglog(x, f(x), label='delta=0.1')\n\n        plt.axis([x.min(), x.max(), 0.1, 1.1])\n        plt.legend(loc='lower center')\n        plt.grid(True)\n        plt.show()\n\n    ","endLoc":379,"id":12810,"nodeType":"Class","startLoc":148,"text":"class SmoothlyBrokenPowerLaw1D(Fittable1DModel):\n    \"\"\"One dimensional smoothly broken power law model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Model amplitude at the break point.\n    x_break : float\n        Break point.\n    alpha_1 : float\n        Power law index for ``x << x_break``.\n    alpha_2 : float\n        Power law index for ``x >> x_break``.\n    delta : float\n        Smoothness parameter.\n\n    See Also\n    --------\n    BrokenPowerLaw1D\n\n    Notes\n    -----\n    Model formula (with :math:`A` for ``amplitude``, :math:`x_b` for\n    ``x_break``, :math:`\\\\alpha_1` for ``alpha_1``,\n    :math:`\\\\alpha_2` for ``alpha_2`` and :math:`\\\\Delta` for\n    ``delta``):\n\n        .. math::\n\n            f(x) = A \\\\left( \\\\frac{x}{x_b} \\\\right) ^ {-\\\\alpha_1}\n                   \\\\left\\\\{\n                      \\\\frac{1}{2}\n                      \\\\left[\n                        1 + \\\\left( \\\\frac{x}{x_b}\\\\right)^{1 / \\\\Delta}\n                      \\\\right]\n                   \\\\right\\\\}^{(\\\\alpha_1 - \\\\alpha_2) \\\\Delta}\n\n\n    The change of slope occurs between the values :math:`x_1`\n    and :math:`x_2` such that:\n\n        .. math::\n            \\\\log_{10} \\\\frac{x_2}{x_b} = \\\\log_{10} \\\\frac{x_b}{x_1}\n            \\\\sim \\\\Delta\n\n\n    At values :math:`x \\\\lesssim x_1` and :math:`x \\\\gtrsim x_2` the\n    model is approximately a simple power law with index\n    :math:`\\\\alpha_1` and :math:`\\\\alpha_2` respectively.  The two\n    power laws are smoothly joined at values :math:`x_1 < x < x_2`,\n    hence the :math:`\\\\Delta` parameter sets the \"smoothness\" of the\n    slope change.\n\n    The ``delta`` parameter is bounded to values greater than 1e-3\n    (corresponding to :math:`x_2 / x_1 \\\\gtrsim 1.002`) to avoid\n    overflow errors.\n\n    The ``amplitude`` parameter is bounded to positive values since\n    this model is typically used to represent positive quantities.\n\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n        from astropy.modeling import models\n\n        x = np.logspace(0.7, 2.3, 500)\n        f = models.SmoothlyBrokenPowerLaw1D(amplitude=1, x_break=20,\n                                            alpha_1=-2, alpha_2=2)\n\n        plt.figure()\n        plt.title(\"amplitude=1, x_break=20, alpha_1=-2, alpha_2=2\")\n\n        f.delta = 0.5\n        plt.loglog(x, f(x), '--', label='delta=0.5')\n\n        f.delta = 0.3\n        plt.loglog(x, f(x), '-.', label='delta=0.3')\n\n        f.delta = 0.1\n        plt.loglog(x, f(x), label='delta=0.1')\n\n        plt.axis([x.min(), x.max(), 0.1, 1.1])\n        plt.legend(loc='lower center')\n        plt.grid(True)\n        plt.show()\n\n    \"\"\"\n\n    amplitude = Parameter(default=1, min=0, description=\"Peak value at break point\")\n    x_break = Parameter(default=1, description=\"Break point\")\n    alpha_1 = Parameter(default=-2, description=\"Power law index before break point\")\n    alpha_2 = Parameter(default=2, description=\"Power law index after break point\")\n    delta = Parameter(default=1, min=1.e-3, description=\"Smoothness Parameter\")\n\n    @amplitude.validator\n    def amplitude(self, value):\n        if np.any(value <= 0):\n            raise InputParameterError(\n                \"amplitude parameter must be > 0\")\n\n    @delta.validator\n    def delta(self, value):\n        if np.any(value < 0.001):\n            raise InputParameterError(\n                \"delta parameter must be >= 0.001\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_break, alpha_1, alpha_2, delta):\n        \"\"\"One dimensional smoothly broken power law model function\"\"\"\n\n        # Pre-calculate `x/x_b`\n        xx = x / x_break\n\n        # Initialize the return value\n        f = np.zeros_like(xx, subok=False)\n\n        if isinstance(amplitude, Quantity):\n            return_unit = amplitude.unit\n            amplitude = amplitude.value\n        else:\n            return_unit = None\n\n        # The quantity `t = (x / x_b)^(1 / delta)` can become quite\n        # large.  To avoid overflow errors we will start by calculating\n        # its natural logarithm:\n        logt = np.log(xx) / delta\n\n        # When `t >> 1` or `t << 1` we don't actually need to compute\n        # the `t` value since the main formula (see docstring) can be\n        # significantly simplified by neglecting `1` or `t`\n        # respectively.  In the following we will check whether `t` is\n        # much greater, much smaller, or comparable to 1 by comparing\n        # the `logt` value with an appropriate threshold.\n        threshold = 30  # corresponding to exp(30) ~ 1e13\n        i = logt > threshold\n        if i.max():\n            # In this case the main formula reduces to a simple power\n            # law with index `alpha_2`.\n            f[i] = amplitude * xx[i] ** (-alpha_2) \\\n                   / (2. ** ((alpha_1 - alpha_2) * delta))\n\n        i = logt < -threshold\n        if i.max():\n            # In this case the main formula reduces to a simple power\n            # law with index `alpha_1`.\n            f[i] = amplitude * xx[i] ** (-alpha_1) \\\n                   / (2. ** ((alpha_1 - alpha_2) * delta))\n\n        i = np.abs(logt) <= threshold\n        if i.max():\n            # In this case the `t` value is \"comparable\" to 1, hence we\n            # we will evaluate the whole formula.\n            t = np.exp(logt[i])\n            r = (1. + t) / 2.\n            f[i] = amplitude * xx[i] ** (-alpha_1) \\\n                   * r ** ((alpha_1 - alpha_2) * delta)\n\n        if return_unit:\n            return Quantity(f, unit=return_unit, copy=False)\n        return f\n\n    @staticmethod\n    def fit_deriv(x, amplitude, x_break, alpha_1, alpha_2, delta):\n        \"\"\"One dimensional smoothly broken power law derivative with respect\n           to parameters\"\"\"\n\n        # Pre-calculate `x_b` and `x/x_b` and `logt` (see comments in\n        # SmoothlyBrokenPowerLaw1D.evaluate)\n        xx = x / x_break\n        logt = np.log(xx) / delta\n\n        # Initialize the return values\n        f = np.zeros_like(xx)\n        d_amplitude = np.zeros_like(xx)\n        d_x_break = np.zeros_like(xx)\n        d_alpha_1 = np.zeros_like(xx)\n        d_alpha_2 = np.zeros_like(xx)\n        d_delta = np.zeros_like(xx)\n\n        threshold = 30  # (see comments in SmoothlyBrokenPowerLaw1D.evaluate)\n        i = logt > threshold\n        if i.max():\n            f[i] = amplitude * xx[i] ** (-alpha_2) \\\n                   / (2. ** ((alpha_1 - alpha_2) * delta))\n\n            d_amplitude[i] = f[i] / amplitude\n            d_x_break[i] = f[i] * alpha_2 / x_break\n            d_alpha_1[i] = f[i] * (-delta * np.log(2))\n            d_alpha_2[i] = f[i] * (-np.log(xx[i]) + delta * np.log(2))\n            d_delta[i] = f[i] * (-(alpha_1 - alpha_2) * np.log(2))\n\n        i = logt < -threshold\n        if i.max():\n            f[i] = amplitude * xx[i] ** (-alpha_1) \\\n                   / (2. ** ((alpha_1 - alpha_2) * delta))\n\n            d_amplitude[i] = f[i] / amplitude\n            d_x_break[i] = f[i] * alpha_1 / x_break\n            d_alpha_1[i] = f[i] * (-np.log(xx[i]) - delta * np.log(2))\n            d_alpha_2[i] = f[i] * delta * np.log(2)\n            d_delta[i] = f[i] * (-(alpha_1 - alpha_2) * np.log(2))\n\n        i = np.abs(logt) <= threshold\n        if i.max():\n            t = np.exp(logt[i])\n            r = (1. + t) / 2.\n            f[i] = amplitude * xx[i] ** (-alpha_1) \\\n                   * r ** ((alpha_1 - alpha_2) * delta)\n\n            d_amplitude[i] = f[i] / amplitude\n            d_x_break[i] = f[i] * (alpha_1 - (alpha_1 - alpha_2) * t / 2. / r) / x_break\n            d_alpha_1[i] = f[i] * (-np.log(xx[i]) + delta * np.log(r))\n            d_alpha_2[i] = f[i] * (-delta * np.log(r))\n            d_delta[i] = f[i] * (alpha_1 - alpha_2) \\\n                         * (np.log(r) - t / (1. + t) / delta * np.log(xx[i]))\n\n        return [d_amplitude, d_x_break, d_alpha_1, d_alpha_2, d_delta]\n\n    @property\n    def input_units(self):\n        if self.x_break.unit is None:\n            return None\n        return {self.inputs[0]: self.x_break.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_break': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"col":4,"comment":"null","endLoc":251,"header":"@amplitude.validator\n    def amplitude(self, value)","id":12811,"name":"amplitude","nodeType":"Function","startLoc":247,"text":"@amplitude.validator\n    def amplitude(self, value):\n        if np.any(value <= 0):\n            raise InputParameterError(\n                \"amplitude parameter must be > 0\")"},{"col":4,"comment":"null","endLoc":257,"header":"@delta.validator\n    def delta(self, value)","id":12812,"name":"delta","nodeType":"Function","startLoc":253,"text":"@delta.validator\n    def delta(self, value):\n        if np.any(value < 0.001):\n            raise InputParameterError(\n                \"delta parameter must be >= 0.001\")"},{"col":4,"comment":"One dimensional smoothly broken power law model function","endLoc":312,"header":"@staticmethod\n    def evaluate(x, amplitude, x_break, alpha_1, alpha_2, delta)","id":12813,"name":"evaluate","nodeType":"Function","startLoc":259,"text":"@staticmethod\n    def evaluate(x, amplitude, x_break, alpha_1, alpha_2, delta):\n        \"\"\"One dimensional smoothly broken power law model function\"\"\"\n\n        # Pre-calculate `x/x_b`\n        xx = x / x_break\n\n        # Initialize the return value\n        f = np.zeros_like(xx, subok=False)\n\n        if isinstance(amplitude, Quantity):\n            return_unit = amplitude.unit\n            amplitude = amplitude.value\n        else:\n            return_unit = None\n\n        # The quantity `t = (x / x_b)^(1 / delta)` can become quite\n        # large.  To avoid overflow errors we will start by calculating\n        # its natural logarithm:\n        logt = np.log(xx) / delta\n\n        # When `t >> 1` or `t << 1` we don't actually need to compute\n        # the `t` value since the main formula (see docstring) can be\n        # significantly simplified by neglecting `1` or `t`\n        # respectively.  In the following we will check whether `t` is\n        # much greater, much smaller, or comparable to 1 by comparing\n        # the `logt` value with an appropriate threshold.\n        threshold = 30  # corresponding to exp(30) ~ 1e13\n        i = logt > threshold\n        if i.max():\n            # In this case the main formula reduces to a simple power\n            # law with index `alpha_2`.\n            f[i] = amplitude * xx[i] ** (-alpha_2) \\\n                   / (2. ** ((alpha_1 - alpha_2) * delta))\n\n        i = logt < -threshold\n        if i.max():\n            # In this case the main formula reduces to a simple power\n            # law with index `alpha_1`.\n            f[i] = amplitude * xx[i] ** (-alpha_1) \\\n                   / (2. ** ((alpha_1 - alpha_2) * delta))\n\n        i = np.abs(logt) <= threshold\n        if i.max():\n            # In this case the `t` value is \"comparable\" to 1, hence we\n            # we will evaluate the whole formula.\n            t = np.exp(logt[i])\n            r = (1. + t) / 2.\n            f[i] = amplitude * xx[i] ** (-alpha_1) \\\n                   * r ** ((alpha_1 - alpha_2) * delta)\n\n        if return_unit:\n            return Quantity(f, unit=return_unit, copy=False)\n        return f"},{"attributeType":"null","col":8,"comment":"null","endLoc":274,"id":12814,"name":"axes_order","nodeType":"Attribute","startLoc":274,"text":"self.axes_order"},{"className":"RotateNative2Celestial","col":0,"comment":"\n    Transform from Native to Celestial Spherical Coordinates.\n\n    Parameters\n    ----------\n    lon : float or `~astropy.units.Quantity` ['angle']\n        Celestial longitude of the fiducial point.\n    lat : float or `~astropy.units.Quantity` ['angle']\n        Celestial latitude of the fiducial point.\n    lon_pole : float or `~astropy.units.Quantity` ['angle']\n        Longitude of the celestial pole in the native system.\n\n    Notes\n    -----\n    If ``lon``, ``lat`` and ``lon_pole`` are numerical values they\n    should be in units of deg. Inputs are angles on the native sphere.\n    Outputs are angles on the celestial sphere.\n    ","endLoc":359,"id":12815,"nodeType":"Class","startLoc":287,"text":"class RotateNative2Celestial(_SkyRotation):\n    \"\"\"\n    Transform from Native to Celestial Spherical Coordinates.\n\n    Parameters\n    ----------\n    lon : float or `~astropy.units.Quantity` ['angle']\n        Celestial longitude of the fiducial point.\n    lat : float or `~astropy.units.Quantity` ['angle']\n        Celestial latitude of the fiducial point.\n    lon_pole : float or `~astropy.units.Quantity` ['angle']\n        Longitude of the celestial pole in the native system.\n\n    Notes\n    -----\n    If ``lon``, ``lat`` and ``lon_pole`` are numerical values they\n    should be in units of deg. Inputs are angles on the native sphere.\n    Outputs are angles on the celestial sphere.\n    \"\"\"\n\n    n_inputs = 2\n    n_outputs = 2\n\n    @property\n    def input_units(self):\n        \"\"\" Input units. \"\"\"\n        return {self.inputs[0]: u.deg,\n                self.inputs[1]: u.deg}\n\n    @property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {self.outputs[0]: u.deg, self.outputs[1]: u.deg}\n\n    def __init__(self, lon, lat, lon_pole, **kwargs):\n        super().__init__(lon, lat, lon_pole, **kwargs)\n        self.inputs = ('phi_N', 'theta_N')\n        self.outputs = ('alpha_C', 'delta_C')\n\n    def evaluate(self, phi_N, theta_N, lon, lat, lon_pole):\n        \"\"\"\n        Parameters\n        ----------\n        phi_N, theta_N : float or `~astropy.units.Quantity` ['angle']\n            Angles in the Native coordinate system.\n            it is assumed that numerical only inputs are in degrees.\n            If float, assumed in degrees.\n        lon, lat, lon_pole : float or `~astropy.units.Quantity` ['angle']\n            Parameter values when the model was initialized.\n            If float, assumed in degrees.\n\n        Returns\n        -------\n        alpha_C, delta_C : float or `~astropy.units.Quantity` ['angle']\n            Angles on the Celestial sphere.\n            If float, in degrees.\n        \"\"\"\n        # The values are in radians since they have already been through the setter.\n        if isinstance(lon, u.Quantity):\n            lon = lon.value\n            lat = lat.value\n            lon_pole = lon_pole.value\n        # Convert to Euler angles\n        phi = lon_pole - np.pi / 2\n        theta = - (np.pi / 2 - lat)\n        psi = -(np.pi / 2 + lon)\n        alpha_C, delta_C = super()._evaluate(phi_N, theta_N, phi, theta, psi)\n        return alpha_C, delta_C\n\n    @property\n    def inverse(self):\n        # convert to angles on the celestial sphere\n        return RotateCelestial2Native(self.lon, self.lat, self.lon_pole)"},{"col":4,"comment":" Input units. ","endLoc":314,"header":"@property\n    def input_units(self)","id":12816,"name":"input_units","nodeType":"Function","startLoc":310,"text":"@property\n    def input_units(self):\n        \"\"\" Input units. \"\"\"\n        return {self.inputs[0]: u.deg,\n                self.inputs[1]: u.deg}"},{"col":4,"comment":" Output units. ","endLoc":319,"header":"@property\n    def return_units(self)","id":12817,"name":"return_units","nodeType":"Function","startLoc":316,"text":"@property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {self.outputs[0]: u.deg, self.outputs[1]: u.deg}"},{"col":4,"comment":"null","endLoc":324,"header":"def __init__(self, lon, lat, lon_pole, **kwargs)","id":12818,"name":"__init__","nodeType":"Function","startLoc":321,"text":"def __init__(self, lon, lat, lon_pole, **kwargs):\n        super().__init__(lon, lat, lon_pole, **kwargs)\n        self.inputs = ('phi_N', 'theta_N')\n        self.outputs = ('alpha_C', 'delta_C')"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":12819,"name":"__all__","nodeType":"Attribute","startLoc":24,"text":"__all__"},{"col":0,"comment":"","endLoc":9,"header":"parameters.py#<anonymous>","id":12820,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nThis module defines classes that deal with parameters.\n\nIt is unlikely users will need to work with these classes directly,\nunless they define their own models.\n\"\"\"\n\n__all__ = ['Parameter', 'InputParameterError', 'ParameterError']"},{"fileName":"fitting.py","filePath":"astropy/modeling","id":12821,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module implements classes (called Fitters) which combine optimization\nalgorithms (typically from `scipy.optimize`) with statistic functions to perform\nfitting. Fitters are implemented as callable classes. In addition to the data\nto fit, the ``__call__`` method takes an instance of\n`~astropy.modeling.core.FittableModel` as input, and returns a copy of the\nmodel with its parameters determined by the optimizer.\n\nOptimization algorithms, called \"optimizers\" are implemented in\n`~astropy.modeling.optimizers` and statistic functions are in\n`~astropy.modeling.statistic`. The goal is to provide an easy to extend\nframework and allow users to easily create new fitters by combining statistics\nwith optimizers.\n\nThere are two exceptions to the above scheme.\n`~astropy.modeling.fitting.LinearLSQFitter` uses Numpy's `~numpy.linalg.lstsq`\nfunction.  `~astropy.modeling.fitting.LevMarLSQFitter` uses\n`~scipy.optimize.leastsq` which combines optimization and statistic in one\nimplementation.\n\"\"\"\n# pylint: disable=invalid-name\n\nimport abc\nimport inspect\nimport operator\nimport warnings\nfrom importlib.metadata import entry_points\n\nfrom functools import reduce, wraps\n\nimport numpy as np\n\nfrom astropy.units import Quantity\nfrom astropy.utils.exceptions import AstropyUserWarning\nfrom astropy.utils.decorators import deprecated\nfrom .utils import poly_map_domain, _combine_equivalency_dict\nfrom .optimizers import (SLSQP, Simplex)\nfrom .statistic import (leastsquare)\nfrom .optimizers import (DEFAULT_MAXITER, DEFAULT_EPS, DEFAULT_ACC)\nfrom .spline import (SplineInterpolateFitter, SplineSmoothingFitter,\n                     SplineExactKnotsFitter, SplineSplrepFitter)\n\n__all__ = ['LinearLSQFitter', 'LevMarLSQFitter', 'FittingWithOutlierRemoval',\n           'SLSQPLSQFitter', 'SimplexLSQFitter', 'JointFitter', 'Fitter',\n           \"ModelLinearityError\", \"ModelsError\"]\n\n\n# Statistic functions implemented in `astropy.modeling.statistic.py\nSTATISTICS = [leastsquare]\n\n# Optimizers implemented in `astropy.modeling.optimizers.py\nOPTIMIZERS = [Simplex, SLSQP]\n\n\nclass Covariance():\n    \"\"\"Class for covariance matrix calculated by fitter. \"\"\"\n\n    def __init__(self, cov_matrix, param_names):\n        self.cov_matrix = cov_matrix\n        self.param_names = param_names\n\n    def pprint(self, max_lines, round_val):\n        # Print and label lower triangle of covariance matrix\n        # Print rows for params up to `max_lines`, round floats to 'round_val'\n        longest_name = max([len(x) for x in self.param_names])\n        ret_str = 'parameter variances / covariances \\n'\n        fstring = f'{\"\": <{longest_name}}| {{0}}\\n'\n        for i, row in enumerate(self.cov_matrix):\n            if i <= max_lines-1:\n                param = self.param_names[i]\n                ret_str += fstring.replace(' '*len(param), param, 1).\\\n                           format(repr(np.round(row[:i+1], round_val))[7:-2])\n            else:\n                ret_str += '...'\n        return(ret_str.rstrip())\n\n    def __repr__(self):\n        return(self.pprint(max_lines=10, round_val=3))\n\n    def __getitem__(self, params):\n        # index covariance matrix by parameter names or indices\n        if len(params) != 2:\n            raise ValueError('Covariance must be indexed by two values.')\n        if all(isinstance(item, str) for item in params):\n            i1, i2 = self.param_names.index(params[0]), self.param_names.index(params[1])\n        elif all(isinstance(item, int) for item in params):\n            i1, i2 = params\n        else:\n            raise TypeError('Covariance can be indexed by two parameter names or integer indices.')\n        return(self.cov_matrix[i1][i2])\n\n\nclass StandardDeviations():\n    \"\"\" Class for fitting uncertainties.\"\"\"\n\n    def __init__(self, cov_matrix, param_names):\n        self.param_names = param_names\n        self.stds = self._calc_stds(cov_matrix)\n\n    def _calc_stds(self, cov_matrix):\n        # sometimes scipy lstsq returns a non-sensical negative vals in the\n        # diagonals of the cov_x it computes.\n        stds = [np.sqrt(x) if x > 0 else None for x in np.diag(cov_matrix)]\n        return stds\n\n    def pprint(self, max_lines, round_val):\n        longest_name = max([len(x) for x in self.param_names])\n        ret_str = 'standard deviations\\n'\n        fstring = '{0}{1}| {2}\\n'\n        for i, std in enumerate(self.stds):\n            if i <= max_lines-1:\n                param = self.param_names[i]\n                ret_str += fstring.format(param,\n                                          ' ' * (longest_name - len(param)),\n                                          str(np.round(std, round_val)))\n            else:\n                ret_str += '...'\n        return(ret_str.rstrip())\n\n    def __repr__(self):\n        return(self.pprint(max_lines=10, round_val=3))\n\n    def __getitem__(self, param):\n        if isinstance(param, str):\n            i = self.param_names.index(param)\n        elif isinstance(param, int):\n            i = param\n        else:\n            raise TypeError('Standard deviation can be indexed by parameter name or integer.')\n        return(self.stds[i])\n\n\nclass ModelsError(Exception):\n    \"\"\"Base class for model exceptions\"\"\"\n\n\nclass ModelLinearityError(ModelsError):\n    \"\"\" Raised when a non-linear model is passed to a linear fitter.\"\"\"\n\n\nclass UnsupportedConstraintError(ModelsError, ValueError):\n    \"\"\"\n    Raised when a fitter does not support a type of constraint.\n    \"\"\"\n\n\nclass _FitterMeta(abc.ABCMeta):\n    \"\"\"\n    Currently just provides a registry for all Fitter classes.\n    \"\"\"\n\n    registry = set()\n\n    def __new__(mcls, name, bases, members):\n        cls = super().__new__(mcls, name, bases, members)\n\n        if not inspect.isabstract(cls) and not name.startswith('_'):\n            mcls.registry.add(cls)\n\n        return cls\n\n\ndef fitter_unit_support(func):\n    \"\"\"\n    This is a decorator that can be used to add support for dealing with\n    quantities to any __call__ method on a fitter which may not support\n    quantities itself. This is done by temporarily removing units from all\n    parameters then adding them back once the fitting has completed.\n    \"\"\"\n    @wraps(func)\n    def wrapper(self, model, x, y, z=None, **kwargs):\n        equivalencies = kwargs.pop('equivalencies', None)\n\n        data_has_units = (isinstance(x, Quantity) or\n                          isinstance(y, Quantity) or\n                          isinstance(z, Quantity))\n\n        model_has_units = model._has_units\n\n        if data_has_units or model_has_units:\n\n            if model._supports_unit_fitting:\n\n                # We now combine any instance-level input equivalencies with user\n                # specified ones at call-time.\n\n                input_units_equivalencies = _combine_equivalency_dict(\n                    model.inputs, equivalencies, model.input_units_equivalencies)\n\n                # If input_units is defined, we transform the input data into those\n                # expected by the model. We hard-code the input names 'x', and 'y'\n                # here since FittableModel instances have input names ('x',) or\n                # ('x', 'y')\n\n                if model.input_units is not None:\n                    if isinstance(x, Quantity):\n                        x = x.to(model.input_units[model.inputs[0]],\n                                 equivalencies=input_units_equivalencies[model.inputs[0]])\n                    if isinstance(y, Quantity) and z is not None:\n                        y = y.to(model.input_units[model.inputs[1]],\n                                 equivalencies=input_units_equivalencies[model.inputs[1]])\n\n                # Create a dictionary mapping the real model inputs and outputs\n                # names to the data. This remapping of names must be done here, after\n                # the input data is converted to the correct units.\n                rename_data = {model.inputs[0]: x}\n                if z is not None:\n                    rename_data[model.outputs[0]] = z\n                    rename_data[model.inputs[1]] = y\n                else:\n                    rename_data[model.outputs[0]] = y\n                    rename_data['z'] = None\n\n                # We now strip away the units from the parameters, taking care to\n                # first convert any parameters to the units that correspond to the\n                # input units (to make sure that initial guesses on the parameters)\n                # are in the right unit system\n                model = model.without_units_for_data(**rename_data)\n                if isinstance(model, tuple):\n                    rename_data['_left_kwargs'] = model[1]\n                    rename_data['_right_kwargs'] = model[2]\n                    model = model[0]\n\n                # We strip away the units from the input itself\n                add_back_units = False\n\n                if isinstance(x, Quantity):\n                    add_back_units = True\n                    xdata = x.value\n                else:\n                    xdata = np.asarray(x)\n\n                if isinstance(y, Quantity):\n                    add_back_units = True\n                    ydata = y.value\n                else:\n                    ydata = np.asarray(y)\n\n                if z is not None:\n                    if isinstance(z, Quantity):\n                        add_back_units = True\n                        zdata = z.value\n                    else:\n                        zdata = np.asarray(z)\n                # We run the fitting\n                if z is None:\n                    model_new = func(self, model, xdata, ydata, **kwargs)\n                else:\n                    model_new = func(self, model, xdata, ydata, zdata, **kwargs)\n\n                # And finally we add back units to the parameters\n                if add_back_units:\n                    model_new = model_new.with_units_from_data(**rename_data)\n                return model_new\n\n            else:\n\n                raise NotImplementedError(\"This model does not support being \"\n                                          \"fit to data with units.\")\n\n        else:\n\n            return func(self, model, x, y, z=z, **kwargs)\n\n    return wrapper\n\n\nclass Fitter(metaclass=_FitterMeta):\n    \"\"\"\n    Base class for all fitters.\n\n    Parameters\n    ----------\n    optimizer : callable\n        A callable implementing an optimization algorithm\n    statistic : callable\n        Statistic function\n\n    \"\"\"\n\n    supported_constraints = []\n\n    def __init__(self, optimizer, statistic):\n        if optimizer is None:\n            raise ValueError(\"Expected an optimizer.\")\n        if statistic is None:\n            raise ValueError(\"Expected a statistic function.\")\n        if inspect.isclass(optimizer):\n            # a callable class\n            self._opt_method = optimizer()\n        elif inspect.isfunction(optimizer):\n            self._opt_method = optimizer\n        else:\n            raise ValueError(\"Expected optimizer to be a callable class or a function.\")\n        if inspect.isclass(statistic):\n            self._stat_method = statistic()\n        else:\n            self._stat_method = statistic\n\n    def objective_function(self, fps, *args):\n        \"\"\"\n        Function to minimize.\n\n        Parameters\n        ----------\n        fps : list\n            parameters returned by the fitter\n        args : list\n            [model, [other_args], [input coordinates]]\n            other_args may include weights or any other quantities specific for\n            a statistic\n\n        Notes\n        -----\n        The list of arguments (args) is set in the `__call__` method.\n        Fitters may overwrite this method, e.g. when statistic functions\n        require other arguments.\n\n        \"\"\"\n        model = args[0]\n        meas = args[-1]\n        fitter_to_model_params(model, fps)\n        res = self._stat_method(meas, model, *args[1:-1])\n        return res\n\n    @staticmethod\n    def _add_fitting_uncertainties(*args):\n        \"\"\"\n        When available, calculate and sets the parameter covariance matrix\n        (model.cov_matrix) and standard deviations (model.stds).\n        \"\"\"\n        return None\n\n    @abc.abstractmethod\n    def __call__(self):\n        \"\"\"\n        This method performs the actual fitting and modifies the parameter list\n        of a model.\n        Fitter subclasses should implement this method.\n        \"\"\"\n\n        raise NotImplementedError(\"Subclasses should implement this method.\")\n\n\n# TODO: I have ongoing branch elsewhere that's refactoring this module so that\n# all the fitter classes in here are Fitter subclasses.  In the meantime we\n# need to specify that _FitterMeta is its metaclass.\nclass LinearLSQFitter(metaclass=_FitterMeta):\n    \"\"\"\n    A class performing a linear least square fitting.\n    Uses `numpy.linalg.lstsq` to do the fitting.\n    Given a model and data, fits the model to the data and changes the\n    model's parameters. Keeps a dictionary of auxiliary fitting information.\n    Notes\n    -----\n    Note that currently LinearLSQFitter does not support compound models.\n    \"\"\"\n\n    supported_constraints = ['fixed']\n    supports_masked_input = True\n\n    def __init__(self, calc_uncertainties=False):\n        self.fit_info = {'residuals': None,\n                         'rank': None,\n                         'singular_values': None,\n                         'params': None\n                         }\n        self._calc_uncertainties=calc_uncertainties\n\n    @staticmethod\n    def _is_invertible(m):\n        \"\"\"Check if inverse of matrix can be obtained.\"\"\"\n        if m.shape[0] != m.shape[1]:\n            return False\n        if np.linalg.matrix_rank(m) < m.shape[0]:\n            return False\n        return True\n\n    def _add_fitting_uncertainties(self, model, a, n_coeff, x, y, z=None,\n                                   resids=None):\n        \"\"\"\n        Calculate and parameter covariance matrix and standard deviations\n        and set `cov_matrix` and `stds` attributes.\n        \"\"\"\n        x_dot_x_prime = np.dot(a.T, a)\n        masked = False or hasattr(y, 'mask')\n\n        # check if invertible. if not, can't calc covariance.\n        if not self._is_invertible(x_dot_x_prime):\n            return(model)\n        inv_x_dot_x_prime = np.linalg.inv(x_dot_x_prime)\n\n        if z is None:  # 1D models\n            if len(model) == 1:  # single model\n                mask = None\n                if masked:\n                    mask = y.mask\n                xx = np.ma.array(x, mask=mask)\n                RSS = [(1/(xx.count()-n_coeff)) * resids]\n\n            if len(model) > 1:  # model sets\n                RSS = []   # collect sum residuals squared for each model in set\n                for j in range(len(model)):\n                    mask = None\n                    if masked:\n                        mask = y.mask[..., j].flatten()\n                    xx = np.ma.array(x, mask=mask)\n                    eval_y = model(xx, model_set_axis=False)\n                    eval_y = np.rollaxis(eval_y, model.model_set_axis)[j]\n                    RSS.append((1/(xx.count()-n_coeff)) * np.sum((y[..., j] - eval_y)**2))\n\n        else:  # 2D model\n            if len(model) == 1:\n                mask = None\n                if masked:\n                    warnings.warn('Calculation of fitting uncertainties '\n                                  'for 2D models with masked values not '\n                                  'currently supported.\\n',\n                                  AstropyUserWarning)\n                    return\n                xx, yy = np.ma.array(x, mask=mask), np.ma.array(y, mask=mask)\n                # len(xx) instead of xx.count. this will break if values are masked?\n                RSS = [(1/(len(xx)-n_coeff)) * resids]\n            else:\n                RSS = []\n                for j in range(len(model)):\n                    eval_z = model(x, y, model_set_axis=False)\n                    mask = None  # need to figure out how to deal w/ masking here.\n                    if model.model_set_axis == 1:\n                        # model_set_axis passed when evaluating only refers to input shapes\n                        # so output must be reshaped for model_set_axis=1.\n                        eval_z = np.rollaxis(eval_z, 1)\n                    eval_z = eval_z[j]\n                    RSS.append([(1/(len(x)-n_coeff)) * np.sum((z[j] - eval_z)**2)])\n\n        covs = [inv_x_dot_x_prime * r for r in RSS]\n        free_param_names = [x for x in model.fixed if (model.fixed[x] is False)\n                            and (model.tied[x] is False)]\n\n        if len(covs) == 1:\n            model.cov_matrix = Covariance(covs[0], model.param_names)\n            model.stds = StandardDeviations(covs[0], free_param_names)\n        else:\n            model.cov_matrix = [Covariance(cov, model.param_names) for cov in covs]\n            model.stds = [StandardDeviations(cov, free_param_names) for cov in covs]\n\n    @staticmethod\n    def _deriv_with_constraints(model, param_indices, x=None, y=None):\n        if y is None:\n            d = np.array(model.fit_deriv(x, *model.parameters))\n        else:\n            d = np.array(model.fit_deriv(x, y, *model.parameters))\n\n        if model.col_fit_deriv:\n            return d[param_indices]\n        else:\n            return d[..., param_indices]\n\n    def _map_domain_window(self, model, x, y=None):\n        \"\"\"\n        Maps domain into window for a polynomial model which has these\n        attributes.\n        \"\"\"\n\n        if y is None:\n            if hasattr(model, 'domain') and model.domain is None:\n                model.domain = [x.min(), x.max()]\n            if hasattr(model, 'window') and model.window is None:\n                model.window = [-1, 1]\n            return poly_map_domain(x, model.domain, model.window)\n        else:\n            if hasattr(model, 'x_domain') and model.x_domain is None:\n                model.x_domain = [x.min(), x.max()]\n            if hasattr(model, 'y_domain') and model.y_domain is None:\n                model.y_domain = [y.min(), y.max()]\n            if hasattr(model, 'x_window') and model.x_window is None:\n                model.x_window = [-1., 1.]\n            if hasattr(model, 'y_window') and model.y_window is None:\n                model.y_window = [-1., 1.]\n\n            xnew = poly_map_domain(x, model.x_domain, model.x_window)\n            ynew = poly_map_domain(y, model.y_domain, model.y_window)\n            return xnew, ynew\n\n    @fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None, rcond=None):\n        \"\"\"\n        Fit data to this model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            model to fit to x, y, z\n        x : array\n            Input coordinates\n        y : array-like\n            Input coordinates\n        z : array-like, optional\n            Input coordinates.\n            If the dependent (``y`` or ``z``) coordinate values are provided\n            as a `numpy.ma.MaskedArray`, any masked points are ignored when\n            fitting. Note that model set fitting is significantly slower when\n            there are masked points (not just an empty mask), as the matrix\n            equation has to be solved for each model separately when their\n            coordinate grids differ.\n        weights : array, optional\n            Weights for fitting.\n            For data with Gaussian uncertainties, the weights should be\n            1/sigma.\n        rcond :  float, optional\n            Cut-off ratio for small singular values of ``a``.\n            Singular values are set to zero if they are smaller than ``rcond``\n            times the largest singular value of ``a``.\n        equivalencies : list or None, optional, keyword-only\n            List of *additional* equivalencies that are should be applied in\n            case x, y and/or z have units. Default is None.\n\n        Returns\n        -------\n        model_copy : `~astropy.modeling.FittableModel`\n            a copy of the input model with parameters set by the fitter\n\n        \"\"\"\n\n        if not model.fittable:\n            raise ValueError(\"Model must be a subclass of FittableModel\")\n\n        if not model.linear:\n            raise ModelLinearityError('Model is not linear in parameters, '\n                                      'linear fit methods should not be used.')\n\n        if hasattr(model, \"submodel_names\"):\n            raise ValueError(\"Model must be simple, not compound\")\n\n        _validate_constraints(self.supported_constraints, model)\n\n        model_copy = model.copy()\n        model_copy.sync_constraints = False\n        _, fitparam_indices = model_to_fit_params(model_copy)\n\n        if model_copy.n_inputs == 2 and z is None:\n            raise ValueError(\"Expected x, y and z for a 2 dimensional model.\")\n\n        farg = _convert_input(x, y, z, n_models=len(model_copy),\n                              model_set_axis=model_copy.model_set_axis)\n\n        has_fixed = any(model_copy.fixed.values())\n\n        # This is also done by _convert_inputs, but we need it here to allow\n        # checking the array dimensionality before that gets called:\n        if weights is not None:\n            weights = np.asarray(weights, dtype=float)\n\n        if has_fixed:\n\n            # The list of fixed params is the complement of those being fitted:\n            fixparam_indices = [idx for idx in\n                                range(len(model_copy.param_names))\n                                if idx not in fitparam_indices]\n\n            # Construct matrix of user-fixed parameters that can be dotted with\n            # the corresponding fit_deriv() terms, to evaluate corrections to\n            # the dependent variable in order to fit only the remaining terms:\n            fixparams = np.asarray([getattr(model_copy,\n                                            model_copy.param_names[idx]).value\n                                    for idx in fixparam_indices])\n\n        if len(farg) == 2:\n            x, y = farg\n\n            if weights is not None:\n                # If we have separate weights for each model, apply the same\n                # conversion as for the data, otherwise check common weights\n                # as if for a single model:\n                _, weights = _convert_input(\n                    x, weights,\n                    n_models=len(model_copy) if weights.ndim == y.ndim else 1,\n                    model_set_axis=model_copy.model_set_axis\n                )\n\n            # map domain into window\n            if hasattr(model_copy, 'domain'):\n                x = self._map_domain_window(model_copy, x)\n            if has_fixed:\n                lhs = np.asarray(self._deriv_with_constraints(model_copy,\n                                                              fitparam_indices,\n                                                              x=x))\n                fixderivs = self._deriv_with_constraints(model_copy, fixparam_indices, x=x)\n            else:\n                lhs = np.asarray(model_copy.fit_deriv(x, *model_copy.parameters))\n            sum_of_implicit_terms = model_copy.sum_of_implicit_terms(x)\n            rhs = y\n        else:\n            x, y, z = farg\n\n            if weights is not None:\n                # If we have separate weights for each model, apply the same\n                # conversion as for the data, otherwise check common weights\n                # as if for a single model:\n                _, _, weights = _convert_input(\n                    x, y, weights,\n                    n_models=len(model_copy) if weights.ndim == z.ndim else 1,\n                    model_set_axis=model_copy.model_set_axis\n                )\n\n            # map domain into window\n            if hasattr(model_copy, 'x_domain'):\n                x, y = self._map_domain_window(model_copy, x, y)\n\n            if has_fixed:\n                lhs = np.asarray(self._deriv_with_constraints(model_copy,\n                                                              fitparam_indices, x=x, y=y))\n                fixderivs = self._deriv_with_constraints(model_copy,\n                                                         fixparam_indices,\n                                                         x=x, y=y)\n            else:\n                lhs = np.asanyarray(model_copy.fit_deriv(x, y, *model_copy.parameters))\n            sum_of_implicit_terms = model_copy.sum_of_implicit_terms(x, y)\n\n            if len(model_copy) > 1:\n\n                # Just to be explicit (rather than baking in False == 0):\n                model_axis = model_copy.model_set_axis or 0\n\n                if z.ndim > 2:\n                    # For higher-dimensional z, flatten all the axes except the\n                    # dimension along which models are stacked and transpose so\n                    # the model axis is *last* (I think this resolves Erik's\n                    # pending generalization from 80a6f25a):\n                    rhs = np.rollaxis(z, model_axis, z.ndim)\n                    rhs = rhs.reshape(-1, rhs.shape[-1])\n                else:\n                    # This \"else\" seems to handle the corner case where the\n                    # user has already flattened x/y before attempting a 2D fit\n                    # but z has a second axis for the model set. NB. This is\n                    # ~5-10x faster than using rollaxis.\n                    rhs = z.T if model_axis == 0 else z\n\n                if weights is not None:\n                    # Same for weights\n                    if weights.ndim > 2:\n                        # Separate 2D weights for each model:\n                        weights = np.rollaxis(weights, model_axis, weights.ndim)\n                        weights = weights.reshape(-1, weights.shape[-1])\n                    elif weights.ndim == z.ndim:\n                        # Separate, flattened weights for each model:\n                        weights = weights.T if model_axis == 0 else weights\n                    else:\n                        # Common weights for all the models:\n                        weights = weights.flatten()\n            else:\n                rhs = z.flatten()\n                if weights is not None:\n                    weights = weights.flatten()\n\n        # If the derivative is defined along rows (as with non-linear models)\n        if model_copy.col_fit_deriv:\n            lhs = np.asarray(lhs).T\n\n        # Some models (eg. Polynomial1D) don't flatten multi-dimensional inputs\n        # when constructing their Vandermonde matrix, which can lead to obscure\n        # failures below. Ultimately, np.linalg.lstsq can't handle >2D matrices,\n        # so just raise a slightly more informative error when this happens:\n        if np.asanyarray(lhs).ndim > 2:\n            raise ValueError('{} gives unsupported >2D derivative matrix for '\n                             'this x/y'.format(type(model_copy).__name__))\n\n        # Subtract any terms fixed by the user from (a copy of) the RHS, in\n        # order to fit the remaining terms correctly:\n        if has_fixed:\n            if model_copy.col_fit_deriv:\n                fixderivs = np.asarray(fixderivs).T  # as for lhs above\n            rhs = rhs - fixderivs.dot(fixparams)  # evaluate user-fixed terms\n\n        # Subtract any terms implicit in the model from the RHS, which, like\n        # user-fixed terms, affect the dependent variable but are not fitted:\n        if sum_of_implicit_terms is not None:\n            # If we have a model set, the extra axis must be added to\n            # sum_of_implicit_terms as its innermost dimension, to match the\n            # dimensionality of rhs after _convert_input \"rolls\" it as needed\n            # by np.linalg.lstsq. The vector then gets broadcast to the right\n            # number of sets (columns). This assumes all the models share the\n            # same input coordinates, as is currently the case.\n            if len(model_copy) > 1:\n                sum_of_implicit_terms = sum_of_implicit_terms[..., np.newaxis]\n            rhs = rhs - sum_of_implicit_terms\n\n        if weights is not None:\n\n            if rhs.ndim == 2:\n                if weights.shape == rhs.shape:\n                    # separate weights for multiple models case: broadcast\n                    # lhs to have more dimension (for each model)\n                    lhs = lhs[..., np.newaxis] * weights[:, np.newaxis]\n                    rhs = rhs * weights\n                else:\n                    lhs *= weights[:, np.newaxis]\n                    # Don't modify in-place in case rhs was the original\n                    # dependent variable array\n                    rhs = rhs * weights[:, np.newaxis]\n            else:\n                lhs *= weights[:, np.newaxis]\n                rhs = rhs * weights\n\n        scl = (lhs * lhs).sum(0)\n        lhs /= scl\n\n        masked = np.any(np.ma.getmask(rhs))\n        if weights is not None and not masked and np.any(np.isnan(lhs)):\n            raise ValueError('Found NaNs in the coefficient matrix, which '\n                             'should not happen and would crash the lapack '\n                             'routine. Maybe check that weights are not null.')\n\n        a = None  # need for calculating covarience\n\n        if ((masked and len(model_copy) > 1) or\n                (weights is not None and weights.ndim > 1)):\n\n            # Separate masks or weights for multiple models case: Numpy's\n            # lstsq supports multiple dimensions only for rhs, so we need to\n            # loop manually on the models. This may be fixed in the future\n            # with https://github.com/numpy/numpy/pull/15777.\n\n            # Initialize empty array of coefficients and populate it one model\n            # at a time. The shape matches the number of coefficients from the\n            # Vandermonde matrix and the number of models from the RHS:\n            lacoef = np.zeros(lhs.shape[1:2] + rhs.shape[-1:], dtype=rhs.dtype)\n\n            # Arrange the lhs as a stack of 2D matrices that we can iterate\n            # over to get the correctly-orientated lhs for each model:\n            if lhs.ndim > 2:\n                lhs_stack = np.rollaxis(lhs, -1, 0)\n            else:\n                lhs_stack = np.broadcast_to(lhs, rhs.shape[-1:] + lhs.shape)\n\n            # Loop over the models and solve for each one. By this point, the\n            # model set axis is the second of two. Transpose rather than using,\n            # say, np.moveaxis(array, -1, 0), since it's slightly faster and\n            # lstsq can't handle >2D arrays anyway. This could perhaps be\n            # optimized by collecting together models with identical masks\n            # (eg. those with no rejected points) into one operation, though it\n            # will still be relatively slow when calling lstsq repeatedly.\n            for model_lhs, model_rhs, model_lacoef in zip(lhs_stack, rhs.T, lacoef.T):\n\n                # Cull masked points on both sides of the matrix equation:\n                good = ~model_rhs.mask if masked else slice(None)\n                model_lhs = model_lhs[good]\n                model_rhs = model_rhs[good][..., np.newaxis]\n                a = model_lhs\n\n                # Solve for this model:\n                t_coef, resids, rank, sval = np.linalg.lstsq(model_lhs,\n                                                             model_rhs, rcond)\n                model_lacoef[:] = t_coef.T\n\n        else:\n\n            # If we're fitting one or more models over a common set of points,\n            # we only have to solve a single matrix equation, which is an order\n            # of magnitude faster than calling lstsq() once per model below:\n\n            good = ~rhs.mask if masked else slice(None)  # latter is a no-op\n            a = lhs[good]\n            # Solve for one or more models:\n            lacoef, resids, rank, sval = np.linalg.lstsq(lhs[good],\n                                                         rhs[good], rcond)\n\n        self.fit_info['residuals'] = resids\n        self.fit_info['rank'] = rank\n        self.fit_info['singular_values'] = sval\n\n        lacoef /= scl[:, np.newaxis] if scl.ndim < rhs.ndim else scl\n        self.fit_info['params'] = lacoef\n\n        fitter_to_model_params(model_copy, lacoef.flatten())\n\n        # TODO: Only Polynomial models currently have an _order attribute;\n        # maybe change this to read isinstance(model, PolynomialBase)\n        if hasattr(model_copy, '_order') and len(model_copy) == 1 \\\n                and not has_fixed and rank != model_copy._order:\n            warnings.warn(\"The fit may be poorly conditioned\\n\",\n                          AstropyUserWarning)\n\n        # calculate and set covariance matrix and standard devs. on model\n        if self._calc_uncertainties:\n            if len(y) > len(lacoef):\n                self._add_fitting_uncertainties(model_copy, a*scl,\n                                               len(lacoef), x, y, z, resids)\n        model_copy.sync_constraints = True\n        return model_copy\n\n\nclass FittingWithOutlierRemoval:\n    \"\"\"\n    This class combines an outlier removal technique with a fitting procedure.\n    Basically, given a maximum number of iterations ``niter``, outliers are\n    removed and fitting is performed for each iteration, until no new outliers\n    are found or ``niter`` is reached.\n\n    Parameters\n    ----------\n    fitter : `Fitter`\n        An instance of any Astropy fitter, i.e., LinearLSQFitter,\n        LevMarLSQFitter, SLSQPLSQFitter, SimplexLSQFitter, JointFitter. For\n        model set fitting, this must understand masked input data (as\n        indicated by the fitter class attribute ``supports_masked_input``).\n    outlier_func : callable\n        A function for outlier removal.\n        If this accepts an ``axis`` parameter like the `numpy` functions, the\n        appropriate value will be supplied automatically when fitting model\n        sets (unless overridden in ``outlier_kwargs``), to find outliers for\n        each model separately; otherwise, the same filtering must be performed\n        in a loop over models, which is almost an order of magnitude slower.\n    niter : int, optional\n        Maximum number of iterations.\n    outlier_kwargs : dict, optional\n        Keyword arguments for outlier_func.\n\n    Attributes\n    ----------\n    fit_info : dict\n        The ``fit_info`` (if any) from the last iteration of the wrapped\n        ``fitter`` during the most recent fit. An entry is also added with the\n        keyword ``niter`` that records the actual number of fitting iterations\n        performed (as opposed to the user-specified maximum).\n    \"\"\"\n\n    def __init__(self, fitter, outlier_func, niter=3, **outlier_kwargs):\n        self.fitter = fitter\n        self.outlier_func = outlier_func\n        self.niter = niter\n        self.outlier_kwargs = outlier_kwargs\n        self.fit_info = {'niter': None}\n\n    def __str__(self):\n        return (\"Fitter: {0}\\nOutlier function: {1}\\nNum. of iterations: {2}\" +\n                (\"\\nOutlier func. args.: {3}\"))\\\n                .format(self.fitter.__class__.__name__,\n                        self.outlier_func.__name__, self.niter,\n                        self.outlier_kwargs)\n\n    def __repr__(self):\n        return (\"{0}(fitter: {1}, outlier_func: {2},\" +\n                \" niter: {3}, outlier_kwargs: {4})\")\\\n                 .format(self.__class__.__name__,\n                         self.fitter.__class__.__name__,\n                         self.outlier_func.__name__, self.niter,\n                         self.outlier_kwargs)\n\n    def __call__(self, model, x, y, z=None, weights=None, **kwargs):\n        \"\"\"\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            An analytic model which will be fit to the provided data.\n            This also contains the initial guess for an optimization\n            algorithm.\n        x : array-like\n            Input coordinates.\n        y : array-like\n            Data measurements (1D case) or input coordinates (2D case).\n        z : array-like, optional\n            Data measurements (2D case).\n        weights : array-like, optional\n            Weights to be passed to the fitter.\n        kwargs : dict, optional\n            Keyword arguments to be passed to the fitter.\n        Returns\n        -------\n        fitted_model : `~astropy.modeling.FittableModel`\n            Fitted model after outlier removal.\n        mask : `numpy.ndarray`\n            Boolean mask array, identifying which points were used in the final\n            fitting iteration (False) and which were found to be outliers or\n            were masked in the input (True).\n        \"\"\"\n\n        # For single models, the data get filtered here at each iteration and\n        # then passed to the fitter, which is the historical behavior and\n        # works even for fitters that don't understand masked arrays. For model\n        # sets, the fitter must be able to filter masked data internally,\n        # because fitters require a single set of x/y coordinates whereas the\n        # eliminated points can vary between models. To avoid this limitation,\n        # we could fall back to looping over individual model fits, but it\n        # would likely be fiddly and involve even more overhead (and the\n        # non-linear fitters don't work with model sets anyway, as of writing).\n\n        if len(model) == 1:\n            model_set_axis = None\n        else:\n            if not hasattr(self.fitter, 'supports_masked_input') or \\\n               self.fitter.supports_masked_input is not True:\n                raise ValueError(\"{} cannot fit model sets with masked \"\n                                 \"values\".format(type(self.fitter).__name__))\n\n            # Fitters use their input model's model_set_axis to determine how\n            # their input data are stacked:\n            model_set_axis = model.model_set_axis\n        # Construct input coordinate tuples for fitters & models that are\n        # appropriate for the dimensionality being fitted:\n        if z is None:\n            coords = (x, )\n            data = y\n        else:\n            coords = x, y\n            data = z\n\n        # For model sets, construct a numpy-standard \"axis\" tuple for the\n        # outlier function, to treat each model separately (if supported):\n        if model_set_axis is not None:\n\n            if model_set_axis < 0:\n                model_set_axis += data.ndim\n\n            if 'axis' not in self.outlier_kwargs:  # allow user override\n                # This also works for False (like model instantiation):\n                self.outlier_kwargs['axis'] = tuple(\n                    n for n in range(data.ndim) if n != model_set_axis\n                )\n\n        loop = False\n\n        # Starting fit, prior to any iteration and masking:\n        fitted_model = self.fitter(model, x, y, z, weights=weights, **kwargs)\n        filtered_data = np.ma.masked_array(data)\n        if filtered_data.mask is np.ma.nomask:\n            filtered_data.mask = False\n        filtered_weights = weights\n        last_n_masked = filtered_data.mask.sum()\n        n = 0  # (allow recording no. of iterations when 0)\n\n        # Perform the iterative fitting:\n        for n in range(1, self.niter + 1):\n\n            # (Re-)evaluate the last model:\n            model_vals = fitted_model(*coords, model_set_axis=False)\n\n            # Determine the outliers:\n            if not loop:\n\n                # Pass axis parameter if outlier_func accepts it, otherwise\n                # prepare for looping over models:\n                try:\n                    filtered_data = self.outlier_func(\n                        filtered_data - model_vals, **self.outlier_kwargs\n                    )\n                # If this happens to catch an error with a parameter other\n                # than axis, the next attempt will fail accordingly:\n                except TypeError:\n                    if model_set_axis is None:\n                        raise\n                    else:\n                        self.outlier_kwargs.pop('axis', None)\n                        loop = True\n\n                        # Construct MaskedArray to hold filtered values:\n                        filtered_data = np.ma.masked_array(\n                            filtered_data,\n                            dtype=np.result_type(filtered_data, model_vals),\n                            copy=True\n                        )\n                        # Make sure the mask is an array, not just nomask:\n                        if filtered_data.mask is np.ma.nomask:\n                            filtered_data.mask = False\n\n                        # Get views transposed appropriately for iteration\n                        # over the set (handling data & mask separately due to\n                        # NumPy issue #8506):\n                        data_T = np.rollaxis(filtered_data, model_set_axis, 0)\n                        mask_T = np.rollaxis(filtered_data.mask,\n                                             model_set_axis, 0)\n\n            if loop:\n                model_vals_T = np.rollaxis(model_vals, model_set_axis, 0)\n                for row_data, row_mask, row_mod_vals in zip(data_T, mask_T,\n                                                            model_vals_T):\n                    masked_residuals = self.outlier_func(\n                        row_data - row_mod_vals, **self.outlier_kwargs\n                    )\n                    row_data.data[:] = masked_residuals.data\n                    row_mask[:] = masked_residuals.mask\n\n                # Issue speed warning after the fact, so it only shows up when\n                # the TypeError is genuinely due to the axis argument.\n                warnings.warn('outlier_func did not accept axis argument; '\n                              'reverted to slow loop over models.',\n                              AstropyUserWarning)\n\n            # Recombine newly-masked residuals with model to get masked values:\n            filtered_data += model_vals\n\n            # Re-fit the data after filtering, passing masked/unmasked values\n            # for single models / sets, respectively:\n            if model_set_axis is None:\n\n                good = ~filtered_data.mask\n\n                if weights is not None:\n                    filtered_weights = weights[good]\n\n                fitted_model = self.fitter(fitted_model,\n                                           *(c[good] for c in coords),\n                                           filtered_data.data[good],\n                                           weights=filtered_weights, **kwargs)\n            else:\n                fitted_model = self.fitter(fitted_model, *coords,\n                                           filtered_data,\n                                           weights=filtered_weights, **kwargs)\n\n            # Stop iteration if the masked points are no longer changing (with\n            # cumulative rejection we only need to compare how many there are):\n            this_n_masked = filtered_data.mask.sum()  # (minimal overhead)\n            if this_n_masked == last_n_masked:\n                break\n            last_n_masked = this_n_masked\n\n        self.fit_info = {'niter': n}\n        self.fit_info.update(getattr(self.fitter, 'fit_info', {}))\n\n        return fitted_model, filtered_data.mask\n\n\nclass LevMarLSQFitter(metaclass=_FitterMeta):\n    \"\"\"\n    Levenberg-Marquardt algorithm and least squares statistic.\n\n    Attributes\n    ----------\n    fit_info : dict\n        The `scipy.optimize.leastsq` result for the most recent fit (see\n        notes).\n\n    Notes\n    -----\n    The ``fit_info`` dictionary contains the values returned by\n    `scipy.optimize.leastsq` for the most recent fit, including the values from\n    the ``infodict`` dictionary it returns. See the `scipy.optimize.leastsq`\n    documentation for details on the meaning of these values. Note that the\n    ``x`` return value is *not* included (as it is instead the parameter values\n    of the returned model).\n    Additionally, one additional element of ``fit_info`` is computed whenever a\n    model is fit, with the key 'param_cov'. The corresponding value is the\n    covariance matrix of the parameters as a 2D numpy array.  The order of the\n    matrix elements matches the order of the parameters in the fitted model\n    (i.e., the same order as ``model.param_names``).\n\n    \"\"\"\n\n    supported_constraints = ['fixed', 'tied', 'bounds']\n    \"\"\"\n    The constraint types supported by this fitter type.\n    \"\"\"\n\n    def __init__(self, calc_uncertainties=False):\n        self.fit_info = {'nfev': None,\n                         'fvec': None,\n                         'fjac': None,\n                         'ipvt': None,\n                         'qtf': None,\n                         'message': None,\n                         'ierr': None,\n                         'param_jac': None,\n                         'param_cov': None}\n        self._calc_uncertainties=calc_uncertainties\n        super().__init__()\n\n    def objective_function(self, fps, *args):\n        \"\"\"\n        Function to minimize.\n\n        Parameters\n        ----------\n        fps : list\n            parameters returned by the fitter\n        args : list\n            [model, [weights], [input coordinates]]\n\n        \"\"\"\n\n        model = args[0]\n        weights = args[1]\n        fitter_to_model_params(model, fps)\n        meas = args[-1]\n        if weights is None:\n            return np.ravel(model(*args[2: -1]) - meas)\n        else:\n            return np.ravel(weights * (model(*args[2: -1]) - meas))\n\n    @staticmethod\n    def _add_fitting_uncertainties(model, cov_matrix):\n        \"\"\"\n        Set ``cov_matrix`` and ``stds`` attributes on model with parameter\n        covariance matrix returned by ``optimize.leastsq``.\n        \"\"\"\n\n        free_param_names = [x for x in model.fixed if (model.fixed[x] is False)\n                            and (model.tied[x] is False)]\n\n        model.cov_matrix = Covariance(cov_matrix, free_param_names)\n        model.stds = StandardDeviations(cov_matrix, free_param_names)\n\n    @fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None,\n                 maxiter=DEFAULT_MAXITER, acc=DEFAULT_ACC,\n                 epsilon=DEFAULT_EPS, estimate_jacobian=False):\n        \"\"\"\n        Fit data to this model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            model to fit to x, y, z\n        x : array\n           input coordinates\n        y : array\n           input coordinates\n        z : array, optional\n           input coordinates\n        weights : array, optional\n            Weights for fitting.\n            For data with Gaussian uncertainties, the weights should be\n            1/sigma.\n        maxiter : int\n            maximum number of iterations\n        acc : float\n            Relative error desired in the approximate solution\n        epsilon : float\n            A suitable step length for the forward-difference\n            approximation of the Jacobian (if model.fjac=None). If\n            epsfcn is less than the machine precision, it is\n            assumed that the relative errors in the functions are\n            of the order of the machine precision.\n        estimate_jacobian : bool\n            If False (default) and if the model has a fit_deriv method,\n            it will be used. Otherwise the Jacobian will be estimated.\n            If True, the Jacobian will be estimated in any case.\n        equivalencies : list or None, optional, keyword-only\n            List of *additional* equivalencies that are should be applied in\n            case x, y and/or z have units. Default is None.\n\n        Returns\n        -------\n        model_copy : `~astropy.modeling.FittableModel`\n            a copy of the input model with parameters set by the fitter\n\n        \"\"\"\n\n        from scipy import optimize\n\n        model_copy = _validate_model(model, self.supported_constraints)\n        model_copy.sync_constraints = False\n        farg = (model_copy, weights, ) + _convert_input(x, y, z)\n        if model_copy.fit_deriv is None or estimate_jacobian:\n            dfunc = None\n        else:\n            dfunc = self._wrap_deriv\n        init_values, _ = model_to_fit_params(model_copy)\n        fitparams, cov_x, dinfo, mess, ierr = optimize.leastsq(\n            self.objective_function, init_values, args=farg, Dfun=dfunc,\n            col_deriv=model_copy.col_fit_deriv, maxfev=maxiter, epsfcn=epsilon,\n            xtol=acc, full_output=True)\n        fitter_to_model_params(model_copy, fitparams)\n        self.fit_info.update(dinfo)\n        self.fit_info['cov_x'] = cov_x\n        self.fit_info['message'] = mess\n        self.fit_info['ierr'] = ierr\n        if ierr not in [1, 2, 3, 4]:\n            warnings.warn(\"The fit may be unsuccessful; check \"\n                          \"fit_info['message'] for more information.\",\n                          AstropyUserWarning)\n\n        # now try to compute the true covariance matrix\n        if (len(y) > len(init_values)) and cov_x is not None:\n            sum_sqrs = np.sum(self.objective_function(fitparams, *farg)**2)\n            dof = len(y) - len(init_values)\n            self.fit_info['param_cov'] = cov_x * sum_sqrs / dof\n        else:\n            self.fit_info['param_cov'] = None\n\n        if self._calc_uncertainties is True:\n            if self.fit_info['param_cov'] is not None:\n                self._add_fitting_uncertainties(model_copy,\n                                               self.fit_info['param_cov'])\n\n        model_copy.sync_constraints = True\n        return model_copy\n\n    @staticmethod\n    def _wrap_deriv(params, model, weights, x, y, z=None):\n        \"\"\"\n        Wraps the method calculating the Jacobian of the function to account\n        for model constraints.\n        `scipy.optimize.leastsq` expects the function derivative to have the\n        above signature (parlist, (argtuple)). In order to accommodate model\n        constraints, instead of using p directly, we set the parameter list in\n        this function.\n        \"\"\"\n\n        if weights is None:\n            weights = 1.0\n\n        if any(model.fixed.values()) or any(model.tied.values()):\n            # update the parameters with the current values from the fitter\n            fitter_to_model_params(model, params)\n            if z is None:\n                full = np.array(model.fit_deriv(x, *model.parameters))\n                if not model.col_fit_deriv:\n                    full_deriv = np.ravel(weights) * full.T\n                else:\n                    full_deriv = np.ravel(weights) * full\n            else:\n                full = np.array([np.ravel(_) for _ in model.fit_deriv(x, y, *model.parameters)])\n                if not model.col_fit_deriv:\n                    full_deriv = np.ravel(weights) * full.T\n                else:\n                    full_deriv = np.ravel(weights) * full\n\n            pars = [getattr(model, name) for name in model.param_names]\n            fixed = [par.fixed for par in pars]\n            tied = [par.tied for par in pars]\n            tied = list(np.where([par.tied is not False for par in pars],\n                                 True, tied))\n            fix_and_tie = np.logical_or(fixed, tied)\n            ind = np.logical_not(fix_and_tie)\n\n            if not model.col_fit_deriv:\n                residues = np.asarray(full_deriv[np.nonzero(ind)]).T\n            else:\n                residues = full_deriv[np.nonzero(ind)]\n\n            return [np.ravel(_) for _ in residues]\n        else:\n            if z is None:\n                try:\n                    return np.array([np.ravel(_) for _ in np.array(weights) *\n                                     np.array(model.fit_deriv(x, *params))])\n                except ValueError:\n                    return np.array([np.ravel(_) for _ in np.array(weights) *\n                                     np.moveaxis(\n                                         np.array(model.fit_deriv(x, *params)),\n                                         -1, 0)]).transpose()\n            else:\n                if not model.col_fit_deriv:\n                    return [np.ravel(_) for _ in\n                            (np.ravel(weights) * np.array(model.fit_deriv(x, y, *params)).T).T]\n                return [np.ravel(_) for _ in weights * np.array(model.fit_deriv(x, y, *params))]\n\n\nclass SLSQPLSQFitter(Fitter):\n    \"\"\"\n    Sequential Least Squares Programming (SLSQP) optimization algorithm and\n    least squares statistic.\n\n    Raises\n    ------\n    ModelLinearityError\n        A linear model is passed to a nonlinear fitter\n\n    Notes\n    -----\n    See also the `~astropy.modeling.optimizers.SLSQP` optimizer.\n\n    \"\"\"\n\n    supported_constraints = SLSQP.supported_constraints\n\n    def __init__(self):\n        super().__init__(optimizer=SLSQP, statistic=leastsquare)\n        self.fit_info = {}\n\n    @fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None, **kwargs):\n        \"\"\"\n        Fit data to this model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            model to fit to x, y, z\n        x : array\n            input coordinates\n        y : array\n            input coordinates\n        z : array, optional\n            input coordinates\n        weights : array, optional\n            Weights for fitting.\n            For data with Gaussian uncertainties, the weights should be\n            1/sigma.\n        kwargs : dict\n            optional keyword arguments to be passed to the optimizer or the statistic\n        verblevel : int\n            0-silent\n            1-print summary upon completion,\n            2-print summary after each iteration\n        maxiter : int\n            maximum number of iterations\n        epsilon : float\n            the step size for finite-difference derivative estimates\n        acc : float\n            Requested accuracy\n        equivalencies : list or None, optional, keyword-only\n            List of *additional* equivalencies that are should be applied in\n            case x, y and/or z have units. Default is None.\n\n        Returns\n        -------\n        model_copy : `~astropy.modeling.FittableModel`\n            a copy of the input model with parameters set by the fitter\n\n        \"\"\"\n\n        model_copy = _validate_model(model, self._opt_method.supported_constraints)\n        model_copy.sync_constraints = False\n        farg = _convert_input(x, y, z)\n        farg = (model_copy, weights, ) + farg\n        init_values, _ = model_to_fit_params(model_copy)\n        fitparams, self.fit_info = self._opt_method(\n            self.objective_function, init_values, farg, **kwargs)\n        fitter_to_model_params(model_copy, fitparams)\n\n        model_copy.sync_constraints = True\n        return model_copy\n\n\nclass SimplexLSQFitter(Fitter):\n    \"\"\"\n    Simplex algorithm and least squares statistic.\n\n    Raises\n    ------\n    `ModelLinearityError`\n        A linear model is passed to a nonlinear fitter\n\n    \"\"\"\n\n    supported_constraints = Simplex.supported_constraints\n\n    def __init__(self):\n        super().__init__(optimizer=Simplex, statistic=leastsquare)\n        self.fit_info = {}\n\n    @fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None, **kwargs):\n        \"\"\"\n        Fit data to this model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            model to fit to x, y, z\n        x : array\n            input coordinates\n        y : array\n            input coordinates\n        z : array, optional\n            input coordinates\n        weights : array, optional\n            Weights for fitting.\n            For data with Gaussian uncertainties, the weights should be\n            1/sigma.\n        kwargs : dict\n            optional keyword arguments to be passed to the optimizer or the statistic\n        maxiter : int\n            maximum number of iterations\n        acc : float\n            Relative error in approximate solution\n        equivalencies : list or None, optional, keyword-only\n            List of *additional* equivalencies that are should be applied in\n            case x, y and/or z have units. Default is None.\n\n        Returns\n        -------\n        model_copy : `~astropy.modeling.FittableModel`\n            a copy of the input model with parameters set by the fitter\n\n        \"\"\"\n\n        model_copy = _validate_model(model,\n                                     self._opt_method.supported_constraints)\n        model_copy.sync_constraints = False\n        farg = _convert_input(x, y, z)\n        farg = (model_copy, weights, ) + farg\n\n        init_values, _ = model_to_fit_params(model_copy)\n\n        fitparams, self.fit_info = self._opt_method(\n            self.objective_function, init_values, farg, **kwargs)\n        fitter_to_model_params(model_copy, fitparams)\n        model_copy.sync_constraints = True\n        return model_copy\n\n\nclass JointFitter(metaclass=_FitterMeta):\n    \"\"\"\n    Fit models which share a parameter.\n    For example, fit two gaussians to two data sets but keep\n    the FWHM the same.\n\n    Parameters\n    ----------\n    models : list\n        a list of model instances\n    jointparameters : list\n        a list of joint parameters\n    initvals : list\n        a list of initial values\n\n    \"\"\"\n\n    def __init__(self, models, jointparameters, initvals):\n        self.models = list(models)\n        self.initvals = list(initvals)\n        self.jointparams = jointparameters\n        self._verify_input()\n        self.fitparams = self.model_to_fit_params()\n\n        # a list of model.n_inputs\n        self.modeldims = [m.n_inputs for m in self.models]\n        # sum all model dimensions\n        self.ndim = np.sum(self.modeldims)\n\n    def model_to_fit_params(self):\n        fparams = []\n        fparams.extend(self.initvals)\n        for model in self.models:\n            params = model.parameters.tolist()\n            joint_params = self.jointparams[model]\n            param_metrics = model._param_metrics\n            for param_name in joint_params:\n                slice_ = param_metrics[param_name]['slice']\n                del params[slice_]\n            fparams.extend(params)\n        return fparams\n\n    def objective_function(self, fps, *args):\n        \"\"\"\n        Function to minimize.\n\n        Parameters\n        ----------\n        fps : list\n            the fitted parameters - result of an one iteration of the\n            fitting algorithm\n        args : dict\n            tuple of measured and input coordinates\n            args is always passed as a tuple from optimize.leastsq\n\n        \"\"\"\n\n        lstsqargs = list(args)\n        fitted = []\n        fitparams = list(fps)\n        numjp = len(self.initvals)\n        # make a separate list of the joint fitted parameters\n        jointfitparams = fitparams[:numjp]\n        del fitparams[:numjp]\n\n        for model in self.models:\n            joint_params = self.jointparams[model]\n            margs = lstsqargs[:model.n_inputs + 1]\n            del lstsqargs[:model.n_inputs + 1]\n            # separate each model separately fitted parameters\n            numfp = len(model._parameters) - len(joint_params)\n            mfparams = fitparams[:numfp]\n\n            del fitparams[:numfp]\n            # recreate the model parameters\n            mparams = []\n            param_metrics = model._param_metrics\n            for param_name in model.param_names:\n                if param_name in joint_params:\n                    index = joint_params.index(param_name)\n                    # should do this with slices in case the\n                    # parameter is not a number\n                    mparams.extend([jointfitparams[index]])\n                else:\n                    slice_ = param_metrics[param_name]['slice']\n                    plen = slice_.stop - slice_.start\n                    mparams.extend(mfparams[:plen])\n                    del mfparams[:plen]\n            modelfit = model.evaluate(margs[:-1], *mparams)\n            fitted.extend(modelfit - margs[-1])\n        return np.ravel(fitted)\n\n    def _verify_input(self):\n        if len(self.models) <= 1:\n            raise TypeError(f\"Expected >1 models, {len(self.models)} is given\")\n        if len(self.jointparams.keys()) < 2:\n            raise TypeError(\"At least two parameters are expected, \"\n                            \"{} is given\".format(len(self.jointparams.keys())))\n        for j in self.jointparams.keys():\n            if len(self.jointparams[j]) != len(self.initvals):\n                raise TypeError(\"{} parameter(s) provided but {} expected\".format(\n                    len(self.jointparams[j]), len(self.initvals)))\n\n    def __call__(self, *args):\n        \"\"\"\n        Fit data to these models keeping some of the parameters common to the\n        two models.\n        \"\"\"\n\n        from scipy import optimize\n\n        if len(args) != reduce(lambda x, y: x + 1 + y + 1, self.modeldims):\n            raise ValueError(\"Expected {} coordinates in args but {} provided\"\n                             .format(reduce(lambda x, y: x + 1 + y + 1,\n                                            self.modeldims), len(args)))\n\n        self.fitparams[:], _ = optimize.leastsq(self.objective_function,\n                                                self.fitparams, args=args)\n\n        fparams = self.fitparams[:]\n        numjp = len(self.initvals)\n        # make a separate list of the joint fitted parameters\n        jointfitparams = fparams[:numjp]\n        del fparams[:numjp]\n\n        for model in self.models:\n            # extract each model's fitted parameters\n            joint_params = self.jointparams[model]\n            numfp = len(model._parameters) - len(joint_params)\n            mfparams = fparams[:numfp]\n\n            del fparams[:numfp]\n            # recreate the model parameters\n            mparams = []\n            param_metrics = model._param_metrics\n            for param_name in model.param_names:\n                if param_name in joint_params:\n                    index = joint_params.index(param_name)\n                    # should do this with slices in case the parameter\n                    # is not a number\n                    mparams.extend([jointfitparams[index]])\n                else:\n                    slice_ = param_metrics[param_name]['slice']\n                    plen = slice_.stop - slice_.start\n                    mparams.extend(mfparams[:plen])\n                    del mfparams[:plen]\n            model.parameters = np.array(mparams)\n\n\ndef _convert_input(x, y, z=None, n_models=1, model_set_axis=0):\n    \"\"\"Convert inputs to float arrays.\"\"\"\n\n    x = np.asanyarray(x, dtype=float)\n    y = np.asanyarray(y, dtype=float)\n\n    if z is not None:\n        z = np.asanyarray(z, dtype=float)\n        data_ndim, data_shape = z.ndim, z.shape\n    else:\n        data_ndim, data_shape = y.ndim, y.shape\n\n    # For compatibility with how the linear fitter code currently expects to\n    # work, shift the dependent variable's axes to the expected locations\n    if n_models > 1 or data_ndim > x.ndim:\n        if (model_set_axis or 0) >= data_ndim:\n            raise ValueError(\"model_set_axis out of range\")\n        if data_shape[model_set_axis] != n_models:\n            raise ValueError(\n                \"Number of data sets (y or z array) is expected to equal \"\n                \"the number of parameter sets\"\n            )\n        if z is None:\n            # For a 1-D model the y coordinate's model-set-axis is expected to\n            # be last, so that its first dimension is the same length as the x\n            # coordinates.  This is in line with the expectations of\n            # numpy.linalg.lstsq:\n            # https://numpy.org/doc/stable/reference/generated/numpy.linalg.lstsq.html\n            # That is, each model should be represented by a column.  TODO:\n            # Obviously this is a detail of np.linalg.lstsq and should be\n            # handled specifically by any fitters that use it...\n            y = np.rollaxis(y, model_set_axis, y.ndim)\n            data_shape = y.shape[:-1]\n        else:\n            # Shape of z excluding model_set_axis\n            data_shape = (z.shape[:model_set_axis] +\n                          z.shape[model_set_axis + 1:])\n\n    if z is None:\n        if data_shape != x.shape:\n            raise ValueError(\"x and y should have the same shape\")\n        farg = (x, y)\n    else:\n        if not (x.shape == y.shape == data_shape):\n            raise ValueError(\"x, y and z should have the same shape\")\n        farg = (x, y, z)\n    return farg\n\n\n# TODO: These utility functions are really particular to handling\n# bounds/tied/fixed constraints for scipy.optimize optimizers that do not\n# support them inherently; this needs to be reworked to be clear about this\n# distinction (and the fact that these are not necessarily applicable to any\n# arbitrary fitter--as evidenced for example by the fact that JointFitter has\n# its own versions of these)\n# TODO: Most of this code should be entirely rewritten; it should not be as\n# inefficient as it is.\ndef fitter_to_model_params(model, fps):\n    \"\"\"\n    Constructs the full list of model parameters from the fitted and\n    constrained parameters.\n    \"\"\"\n\n    _, fit_param_indices = model_to_fit_params(model)\n\n    has_tied = any(model.tied.values())\n    has_fixed = any(model.fixed.values())\n    has_bound = any(b != (None, None) for b in model.bounds.values())\n    parameters = model.parameters\n\n    if not (has_tied or has_fixed or has_bound):\n        # We can just assign directly\n        model.parameters = fps\n        return\n\n    fit_param_indices = set(fit_param_indices)\n    offset = 0\n    param_metrics = model._param_metrics\n    for idx, name in enumerate(model.param_names):\n        if idx not in fit_param_indices:\n            continue\n\n        slice_ = param_metrics[name]['slice']\n        shape = param_metrics[name]['shape']\n        # This is determining which range of fps (the fitted parameters) maps\n        # to parameters of the model\n        size = reduce(operator.mul, shape, 1)\n\n        values = fps[offset:offset + size]\n\n        # Check bounds constraints\n        if model.bounds[name] != (None, None):\n            _min, _max = model.bounds[name]\n            if _min is not None:\n                values = np.fmax(values, _min)\n            if _max is not None:\n                values = np.fmin(values, _max)\n\n        parameters[slice_] = values\n        offset += size\n\n    # Update model parameters before calling ``tied`` constraints.\n    model._array_to_parameters()\n\n    # This has to be done in a separate loop due to how tied parameters are\n    # currently evaluated (the fitted parameters need to actually be *set* on\n    # the model first, for use in evaluating the \"tied\" expression--it might be\n    # better to change this at some point\n    if has_tied:\n        for idx, name in enumerate(model.param_names):\n            if model.tied[name]:\n                value = model.tied[name](model)\n                slice_ = param_metrics[name]['slice']\n\n                # To handle multiple tied constraints, model parameters\n                # need to be updated after each iteration.\n                parameters[slice_] = value\n                model._array_to_parameters()\n\n\n@deprecated('5.1', 'private method: _fitter_to_model_params has been made public now')\ndef _fitter_to_model_params(model, fps):\n    return fitter_to_model_params(model, fps)\n\n\ndef model_to_fit_params(model):\n    \"\"\"\n    Convert a model instance's parameter array to an array that can be used\n    with a fitter that doesn't natively support fixed or tied parameters.\n    In particular, it removes fixed/tied parameters from the parameter\n    array.\n    These may be a subset of the model parameters, if some of them are held\n    constant or tied.\n    \"\"\"\n\n    fitparam_indices = list(range(len(model.param_names)))\n    if any(model.fixed.values()) or any(model.tied.values()):\n        params = list(model.parameters)\n        param_metrics = model._param_metrics\n        for idx, name in list(enumerate(model.param_names))[::-1]:\n            if model.fixed[name] or model.tied[name]:\n                slice_ = param_metrics[name]['slice']\n                del params[slice_]\n                del fitparam_indices[idx]\n        return (np.array(params), fitparam_indices)\n    return (model.parameters, fitparam_indices)\n\n\n@deprecated('5.1', 'private method: _model_to_fit_params has been made public now')\ndef _model_to_fit_params(model):\n    return model_to_fit_params(model)\n\n\ndef _validate_constraints(supported_constraints, model):\n    \"\"\"Make sure model constraints are supported by the current fitter.\"\"\"\n\n    message = 'Optimizer cannot handle {0} constraints.'\n\n    if (any(model.fixed.values()) and\n            'fixed' not in supported_constraints):\n        raise UnsupportedConstraintError(\n            message.format('fixed parameter'))\n\n    if any(model.tied.values()) and 'tied' not in supported_constraints:\n        raise UnsupportedConstraintError(\n            message.format('tied parameter'))\n\n    if (any(tuple(b) != (None, None) for b in model.bounds.values()) and\n            'bounds' not in supported_constraints):\n        raise UnsupportedConstraintError(\n            message.format('bound parameter'))\n\n    if model.eqcons and 'eqcons' not in supported_constraints:\n        raise UnsupportedConstraintError(message.format('equality'))\n\n    if model.ineqcons and 'ineqcons' not in supported_constraints:\n        raise UnsupportedConstraintError(message.format('inequality'))\n\n\ndef _validate_model(model, supported_constraints):\n    \"\"\"\n    Check that model and fitter are compatible and return a copy of the model.\n    \"\"\"\n\n    if not model.fittable:\n        raise ValueError(\"Model does not appear to be fittable.\")\n    if model.linear:\n        warnings.warn('Model is linear in parameters; '\n                      'consider using linear fitting methods.',\n                      AstropyUserWarning)\n    elif len(model) != 1:\n        # for now only single data sets ca be fitted\n        raise ValueError(\"Non-linear fitters can only fit \"\n                         \"one data set at a time.\")\n    _validate_constraints(supported_constraints, model)\n\n    model_copy = model.copy()\n    return model_copy\n\n\ndef populate_entry_points(entry_points):\n    \"\"\"\n    This injects entry points into the `astropy.modeling.fitting` namespace.\n    This provides a means of inserting a fitting routine without requirement\n    of it being merged into astropy's core.\n\n    Parameters\n    ----------\n    entry_points : list of `~importlib.metadata.EntryPoint`\n        entry_points are objects which encapsulate importable objects and\n        are defined on the installation of a package.\n\n    Notes\n    -----\n    An explanation of entry points can be found `here <http://setuptools.readthedocs.io/en/latest/setuptools.html#dynamic-discovery-of-services-and-plugins>`\n    \"\"\"\n\n    for entry_point in entry_points:\n        name = entry_point.name\n        try:\n            entry_point = entry_point.load()\n        except Exception as e:\n            # This stops the fitting from choking if an entry_point produces an error.\n            warnings.warn(AstropyUserWarning(\n                f'{type(e).__name__} error occurred in entry point {name}.'))\n        else:\n            if not inspect.isclass(entry_point):\n                warnings.warn(AstropyUserWarning(\n                    f'Modeling entry point {name} expected to be a Class.'))\n            else:\n                if issubclass(entry_point, Fitter):\n                    name = entry_point.__name__\n                    globals()[name] = entry_point\n                    __all__.append(name)\n                else:\n                    warnings.warn(AstropyUserWarning(\n                        'Modeling entry point {} expected to extend '\n                        'astropy.modeling.Fitter' .format(name)))\n\n\ndef _populate_ep():\n    # TODO: Exclusively use select when Python minversion is 3.10\n    ep = entry_points()\n    if hasattr(ep, 'select'):\n        populate_entry_points(ep.select(group='astropy.modeling'))\n    else:\n        populate_entry_points(ep.get('astropy.modeling', []))\n\n\n_populate_ep()\n"},{"col":0,"comment":"\n    Recursive function to collect operators used.\n    ","endLoc":4038,"header":"def get_ops(tree, opset)","id":12822,"name":"get_ops","nodeType":"Function","startLoc":4029,"text":"def get_ops(tree, opset):\n    \"\"\"\n    Recursive function to collect operators used.\n    \"\"\"\n    if isinstance(tree, CompoundModel):\n        opset.add(tree.op)\n        get_ops(tree.left, opset)\n        get_ops(tree.right, opset)\n    else:\n        return"},{"col":0,"comment":"\n    Set a validated bounding box to a model instance.\n\n    Parameters\n    ----------\n    modelinstance : `~astropy.modeling.Model` instance\n        This is the model that the validated bounding box will be set on.\n    bounding_box : tuple\n        A bounding box tuple, see :ref:`astropy:bounding-boxes` for details\n    ignored : list\n        List of the inputs to be ignored by the bounding box.\n    order : str, optional\n        The ordering of the bounding box tuple, can be either ``'C'`` or\n        ``'F'``.\n    ","endLoc":4128,"header":"def bind_bounding_box(modelinstance, bounding_box, ignored=None, order='C')","id":12823,"name":"bind_bounding_box","nodeType":"Function","startLoc":4109,"text":"def bind_bounding_box(modelinstance, bounding_box, ignored=None, order='C'):\n    \"\"\"\n    Set a validated bounding box to a model instance.\n\n    Parameters\n    ----------\n    modelinstance : `~astropy.modeling.Model` instance\n        This is the model that the validated bounding box will be set on.\n    bounding_box : tuple\n        A bounding box tuple, see :ref:`astropy:bounding-boxes` for details\n    ignored : list\n        List of the inputs to be ignored by the bounding box.\n    order : str, optional\n        The ordering of the bounding box tuple, can be either ``'C'`` or\n        ``'F'``.\n    \"\"\"\n    modelinstance.bounding_box = ModelBoundingBox.validate(modelinstance,\n                                                           bounding_box,\n                                                           ignored=ignored,\n                                                           order=order)"},{"col":0,"comment":"\n    Add a validated compound bounding box to a model instance.\n\n    Parameters\n    ----------\n    modelinstance : `~astropy.modeling.Model` instance\n        This is the model that the validated compound bounding box will be set on.\n    bounding_boxes : dict\n        A dictionary of bounding box tuples, see :ref:`astropy:bounding-boxes`\n        for details.\n    selector_args : list\n        List of selector argument tuples to define selection for compound\n        bounding box, see :ref:`astropy:bounding-boxes` for details.\n    create_selector : callable, optional\n        An optional callable with interface (selector_value, model) which\n        can generate a bounding box based on a selector value and model if\n        there is no bounding box in the compound bounding box listed under\n        that selector value. Default is ``None``, meaning new bounding\n        box entries will not be automatically generated.\n    ignored : list\n        List of the inputs to be ignored by the bounding box.\n    order : str, optional\n        The ordering of the bounding box tuple, can be either ``'C'`` or\n        ``'F'``.\n    ","endLoc":4162,"header":"def bind_compound_bounding_box(modelinstance, bounding_boxes, selector_args,\n                               create_selector=None, ignored=None, order='C')","id":12824,"name":"bind_compound_bounding_box","nodeType":"Function","startLoc":4131,"text":"def bind_compound_bounding_box(modelinstance, bounding_boxes, selector_args,\n                               create_selector=None, ignored=None, order='C'):\n    \"\"\"\n    Add a validated compound bounding box to a model instance.\n\n    Parameters\n    ----------\n    modelinstance : `~astropy.modeling.Model` instance\n        This is the model that the validated compound bounding box will be set on.\n    bounding_boxes : dict\n        A dictionary of bounding box tuples, see :ref:`astropy:bounding-boxes`\n        for details.\n    selector_args : list\n        List of selector argument tuples to define selection for compound\n        bounding box, see :ref:`astropy:bounding-boxes` for details.\n    create_selector : callable, optional\n        An optional callable with interface (selector_value, model) which\n        can generate a bounding box based on a selector value and model if\n        there is no bounding box in the compound bounding box listed under\n        that selector value. Default is ``None``, meaning new bounding\n        box entries will not be automatically generated.\n    ignored : list\n        List of the inputs to be ignored by the bounding box.\n    order : str, optional\n        The ordering of the bounding box tuple, can be either ``'C'`` or\n        ``'F'``.\n    \"\"\"\n    modelinstance.bounding_box = CompoundBoundingBox.validate(modelinstance,\n                                                              bounding_boxes, selector_args,\n                                                              create_selector=create_selector,\n                                                              ignored=ignored,\n                                                              order=order)"},{"col":4,"comment":"One dimensional smoothly broken power law derivative with respect\n           to parameters","endLoc":369,"header":"@staticmethod\n    def fit_deriv(x, amplitude, x_break, alpha_1, alpha_2, delta)","id":12825,"name":"fit_deriv","nodeType":"Function","startLoc":314,"text":"@staticmethod\n    def fit_deriv(x, amplitude, x_break, alpha_1, alpha_2, delta):\n        \"\"\"One dimensional smoothly broken power law derivative with respect\n           to parameters\"\"\"\n\n        # Pre-calculate `x_b` and `x/x_b` and `logt` (see comments in\n        # SmoothlyBrokenPowerLaw1D.evaluate)\n        xx = x / x_break\n        logt = np.log(xx) / delta\n\n        # Initialize the return values\n        f = np.zeros_like(xx)\n        d_amplitude = np.zeros_like(xx)\n        d_x_break = np.zeros_like(xx)\n        d_alpha_1 = np.zeros_like(xx)\n        d_alpha_2 = np.zeros_like(xx)\n        d_delta = np.zeros_like(xx)\n\n        threshold = 30  # (see comments in SmoothlyBrokenPowerLaw1D.evaluate)\n        i = logt > threshold\n        if i.max():\n            f[i] = amplitude * xx[i] ** (-alpha_2) \\\n                   / (2. ** ((alpha_1 - alpha_2) * delta))\n\n            d_amplitude[i] = f[i] / amplitude\n            d_x_break[i] = f[i] * alpha_2 / x_break\n            d_alpha_1[i] = f[i] * (-delta * np.log(2))\n            d_alpha_2[i] = f[i] * (-np.log(xx[i]) + delta * np.log(2))\n            d_delta[i] = f[i] * (-(alpha_1 - alpha_2) * np.log(2))\n\n        i = logt < -threshold\n        if i.max():\n            f[i] = amplitude * xx[i] ** (-alpha_1) \\\n                   / (2. ** ((alpha_1 - alpha_2) * delta))\n\n            d_amplitude[i] = f[i] / amplitude\n            d_x_break[i] = f[i] * alpha_1 / x_break\n            d_alpha_1[i] = f[i] * (-np.log(xx[i]) - delta * np.log(2))\n            d_alpha_2[i] = f[i] * delta * np.log(2)\n            d_delta[i] = f[i] * (-(alpha_1 - alpha_2) * np.log(2))\n\n        i = np.abs(logt) <= threshold\n        if i.max():\n            t = np.exp(logt[i])\n            r = (1. + t) / 2.\n            f[i] = amplitude * xx[i] ** (-alpha_1) \\\n                   * r ** ((alpha_1 - alpha_2) * delta)\n\n            d_amplitude[i] = f[i] / amplitude\n            d_x_break[i] = f[i] * (alpha_1 - (alpha_1 - alpha_2) * t / 2. / r) / x_break\n            d_alpha_1[i] = f[i] * (-np.log(xx[i]) + delta * np.log(r))\n            d_alpha_2[i] = f[i] * (-delta * np.log(r))\n            d_delta[i] = f[i] * (alpha_1 - alpha_2) \\\n                         * (np.log(r) - t / (1. + t) / delta * np.log(xx[i]))\n\n        return [d_amplitude, d_x_break, d_alpha_1, d_alpha_2, d_delta]"},{"col":0,"comment":"\n    Evaluates a model on an input array. Evaluation is limited to\n    a bounding box if the `Model.bounding_box` attribute is set.\n\n    Parameters\n    ----------\n    model : `Model`\n        Model to be evaluated.\n    arr : `numpy.ndarray`, optional\n        Array on which the model is evaluated.\n    coords : array-like, optional\n        Coordinate arrays mapping to ``arr``, such that\n        ``arr[coords] == arr``.\n\n    Returns\n    -------\n    array : `numpy.ndarray`\n        The model evaluated on the input ``arr`` or a new array from\n        ``coords``.\n        If ``arr`` and ``coords`` are both `None`, the returned array is\n        limited to the `Model.bounding_box` limits. If\n        `Model.bounding_box` is `None`, ``arr`` or ``coords`` must be passed.\n\n    Examples\n    --------\n    :ref:`astropy:bounding-boxes`\n    ","endLoc":4451,"header":"def render_model(model, arr=None, coords=None)","id":12826,"name":"render_model","nodeType":"Function","startLoc":4357,"text":"def render_model(model, arr=None, coords=None):\n    \"\"\"\n    Evaluates a model on an input array. Evaluation is limited to\n    a bounding box if the `Model.bounding_box` attribute is set.\n\n    Parameters\n    ----------\n    model : `Model`\n        Model to be evaluated.\n    arr : `numpy.ndarray`, optional\n        Array on which the model is evaluated.\n    coords : array-like, optional\n        Coordinate arrays mapping to ``arr``, such that\n        ``arr[coords] == arr``.\n\n    Returns\n    -------\n    array : `numpy.ndarray`\n        The model evaluated on the input ``arr`` or a new array from\n        ``coords``.\n        If ``arr`` and ``coords`` are both `None`, the returned array is\n        limited to the `Model.bounding_box` limits. If\n        `Model.bounding_box` is `None`, ``arr`` or ``coords`` must be passed.\n\n    Examples\n    --------\n    :ref:`astropy:bounding-boxes`\n    \"\"\"\n\n    bbox = model.bounding_box\n\n    if (coords is None) & (arr is None) & (bbox is None):\n        raise ValueError('If no bounding_box is set,'\n                         'coords or arr must be input.')\n\n    # for consistent indexing\n    if model.n_inputs == 1:\n        if coords is not None:\n            coords = [coords]\n        if bbox is not None:\n            bbox = [bbox]\n\n    if arr is not None:\n        arr = arr.copy()\n        # Check dimensions match model\n        if arr.ndim != model.n_inputs:\n            raise ValueError('number of array dimensions inconsistent with '\n                             'number of model inputs.')\n    if coords is not None:\n        # Check dimensions match arr and model\n        coords = np.array(coords)\n        if len(coords) != model.n_inputs:\n            raise ValueError('coordinate length inconsistent with the number '\n                             'of model inputs.')\n        if arr is not None:\n            if coords[0].shape != arr.shape:\n                raise ValueError('coordinate shape inconsistent with the '\n                                 'array shape.')\n        else:\n            arr = np.zeros(coords[0].shape)\n\n    if bbox is not None:\n        # assures position is at center pixel, important when using add_array\n        pd = pos, delta = np.array([(np.mean(bb), np.ceil((bb[1] - bb[0]) / 2))\n                                    for bb in bbox]).astype(int).T\n\n        if coords is not None:\n            sub_shape = tuple(delta * 2 + 1)\n            sub_coords = np.array([extract_array(c, sub_shape, pos)\n                                   for c in coords])\n        else:\n            limits = [slice(p - d, p + d + 1, 1) for p, d in pd.T]\n            sub_coords = np.mgrid[limits]\n\n        sub_coords = sub_coords[::-1]\n\n        if arr is None:\n            arr = model(*sub_coords)\n        else:\n            try:\n                arr = add_array(arr, model(*sub_coords), pos)\n            except ValueError:\n                raise ValueError('The `bounding_box` is larger than the input'\n                                 ' arr in one or more dimensions. Set '\n                                 '`model.bounding_box = None`.')\n    else:\n\n        if coords is None:\n            im_shape = arr.shape\n            limits = [slice(i) for i in im_shape]\n            coords = np.mgrid[limits]\n\n        arr += model(*coords[::-1])\n\n    return arr"},{"col":4,"comment":"\n        Parameters\n        ----------\n        phi_N, theta_N : float or `~astropy.units.Quantity` ['angle']\n            Angles in the Native coordinate system.\n            it is assumed that numerical only inputs are in degrees.\n            If float, assumed in degrees.\n        lon, lat, lon_pole : float or `~astropy.units.Quantity` ['angle']\n            Parameter values when the model was initialized.\n            If float, assumed in degrees.\n\n        Returns\n        -------\n        alpha_C, delta_C : float or `~astropy.units.Quantity` ['angle']\n            Angles on the Celestial sphere.\n            If float, in degrees.\n        ","endLoc":354,"header":"def evaluate(self, phi_N, theta_N, lon, lat, lon_pole)","id":12827,"name":"evaluate","nodeType":"Function","startLoc":326,"text":"def evaluate(self, phi_N, theta_N, lon, lat, lon_pole):\n        \"\"\"\n        Parameters\n        ----------\n        phi_N, theta_N : float or `~astropy.units.Quantity` ['angle']\n            Angles in the Native coordinate system.\n            it is assumed that numerical only inputs are in degrees.\n            If float, assumed in degrees.\n        lon, lat, lon_pole : float or `~astropy.units.Quantity` ['angle']\n            Parameter values when the model was initialized.\n            If float, assumed in degrees.\n\n        Returns\n        -------\n        alpha_C, delta_C : float or `~astropy.units.Quantity` ['angle']\n            Angles on the Celestial sphere.\n            If float, in degrees.\n        \"\"\"\n        # The values are in radians since they have already been through the setter.\n        if isinstance(lon, u.Quantity):\n            lon = lon.value\n            lat = lat.value\n            lon_pole = lon_pole.value\n        # Convert to Euler angles\n        phi = lon_pole - np.pi / 2\n        theta = - (np.pi / 2 - lat)\n        psi = -(np.pi / 2 + lon)\n        alpha_C, delta_C = super()._evaluate(phi_N, theta_N, phi, theta, psi)\n        return alpha_C, delta_C"},{"col":4,"comment":"\n        One dimensional NFW profile function\n\n        Parameters\n        ----------\n        r : float or `~astropy.units.Quantity` ['length']\n            Radial position of density to be calculated for the NFW profile.\n        mass : float or `~astropy.units.Quantity` ['mass']\n            Mass of NFW peak within specified overdensity radius.\n        concentration : float\n            Concentration of the NFW profile.\n        redshift : float\n            Redshift of the NFW profile.\n\n        Returns\n        -------\n        density : float or `~astropy.units.Quantity` ['density']\n            NFW profile mass density at location ``r``. The density units are:\n            [``mass`` / ``r`` ^3]\n\n        Notes\n        -----\n        .. warning::\n\n            Output values might contain ``nan`` and ``inf``.\n        ","endLoc":509,"header":"def evaluate(self, r, mass, concentration, redshift)","id":12828,"name":"evaluate","nodeType":"Function","startLoc":463,"text":"def evaluate(self, r, mass, concentration, redshift):\n        \"\"\"\n        One dimensional NFW profile function\n\n        Parameters\n        ----------\n        r : float or `~astropy.units.Quantity` ['length']\n            Radial position of density to be calculated for the NFW profile.\n        mass : float or `~astropy.units.Quantity` ['mass']\n            Mass of NFW peak within specified overdensity radius.\n        concentration : float\n            Concentration of the NFW profile.\n        redshift : float\n            Redshift of the NFW profile.\n\n        Returns\n        -------\n        density : float or `~astropy.units.Quantity` ['density']\n            NFW profile mass density at location ``r``. The density units are:\n            [``mass`` / ``r`` ^3]\n\n        Notes\n        -----\n        .. warning::\n\n            Output values might contain ``nan`` and ``inf``.\n        \"\"\"\n        # Create radial version of input with dimension\n        if hasattr(r, \"unit\"):\n            in_r = r\n        else:\n            in_r = u.Quantity(r, u.kpc)\n\n        # Define reduced radius (r / r_{\\\\rm s})\n        #   also update scale radius\n        radius_reduced = in_r / self._radius_s(mass, concentration).to(in_r.unit)\n\n        # Density distribution\n        # \\rho (r)=\\frac{\\rho_0}{\\frac{r}{R_s}\\left(1~+~\\frac{r}{R_s}\\right)^2}\n        #   also update scale density\n        density = self._density_s(mass, concentration) / (radius_reduced *\n                                                          (u.Quantity(1.0) + radius_reduced) ** 2)\n\n        if hasattr(mass, \"unit\"):\n            return density\n        else:\n            return density.value"},{"col":4,"comment":"null","endLoc":359,"header":"@property\n    def inverse(self)","id":12829,"name":"inverse","nodeType":"Function","startLoc":356,"text":"@property\n    def inverse(self):\n        # convert to angles on the celestial sphere\n        return RotateCelestial2Native(self.lon, self.lat, self.lon_pole)"},{"col":0,"comment":"Least square statistic, with optional weights, in N-dimensions.\n\n    Parameters\n    ----------\n    measured_vals : ndarray or sequence\n        Measured data values. Will be cast to array whose\n        shape must match the array-cast of the evaluated model.\n    updated_model : :class:`~astropy.modeling.Model` instance\n        Model with parameters set by the current iteration of the optimizer.\n        when evaluated on \"x\", must return array of shape \"measured_vals\"\n    weights : ndarray or None\n        Array of weights to apply to each residual.\n    *x : ndarray\n        Independent variables on which to evaluate the model.\n\n    Returns\n    -------\n    res : float\n        The sum of least squares.\n\n    See Also\n    --------\n    :func:`~astropy.modeling.statistic.leastsquare_1d`\n    :func:`~astropy.modeling.statistic.leastsquare_2d`\n    :func:`~astropy.modeling.statistic.leastsquare_3d`\n\n    Notes\n    -----\n    Models in :mod:`~astropy.modeling` have broadcasting rules that try to\n    match inputs with outputs with Model shapes. Numpy arrays have flexible\n    broadcasting rules, so mismatched shapes can often be made compatible. To\n    ensure data matches the model we must perform shape comparison and leverage\n    the Numpy arithmetic functions. This can obfuscate arithmetic computation\n    overrides, like with Quantities. Implement a custom statistic for more\n    direct control.\n\n    ","endLoc":64,"header":"def leastsquare(measured_vals, updated_model, weights, *x)","id":12830,"name":"leastsquare","nodeType":"Function","startLoc":14,"text":"def leastsquare(measured_vals, updated_model, weights, *x):\n    \"\"\"Least square statistic, with optional weights, in N-dimensions.\n\n    Parameters\n    ----------\n    measured_vals : ndarray or sequence\n        Measured data values. Will be cast to array whose\n        shape must match the array-cast of the evaluated model.\n    updated_model : :class:`~astropy.modeling.Model` instance\n        Model with parameters set by the current iteration of the optimizer.\n        when evaluated on \"x\", must return array of shape \"measured_vals\"\n    weights : ndarray or None\n        Array of weights to apply to each residual.\n    *x : ndarray\n        Independent variables on which to evaluate the model.\n\n    Returns\n    -------\n    res : float\n        The sum of least squares.\n\n    See Also\n    --------\n    :func:`~astropy.modeling.statistic.leastsquare_1d`\n    :func:`~astropy.modeling.statistic.leastsquare_2d`\n    :func:`~astropy.modeling.statistic.leastsquare_3d`\n\n    Notes\n    -----\n    Models in :mod:`~astropy.modeling` have broadcasting rules that try to\n    match inputs with outputs with Model shapes. Numpy arrays have flexible\n    broadcasting rules, so mismatched shapes can often be made compatible. To\n    ensure data matches the model we must perform shape comparison and leverage\n    the Numpy arithmetic functions. This can obfuscate arithmetic computation\n    overrides, like with Quantities. Implement a custom statistic for more\n    direct control.\n\n    \"\"\"\n\n    model_vals = updated_model(*x)\n\n    if np.shape(model_vals) != np.shape(measured_vals):\n        message = \"Shape mismatch between model ({}) and measured ({})\"\n        raise ValueError(\n            message.format(np.shape(model_vals), np.shape(measured_vals))\n        )\n\n    if weights is None:\n        weights = 1.0\n\n    return np.sum(np.square(weights * np.subtract(model_vals, measured_vals)))"},{"col":4,"comment":"null","endLoc":402,"header":"def __init__(self, lon, lat, lon_pole, **kwargs)","id":12831,"name":"__init__","nodeType":"Function","startLoc":396,"text":"def __init__(self, lon, lat, lon_pole, **kwargs):\n        super().__init__(lon, lat, lon_pole, **kwargs)\n\n        # Inputs are angles on the celestial sphere\n        self.inputs = ('alpha_C', 'delta_C')\n        # Outputs are angles on the native sphere\n        self.outputs = ('phi_N', 'theta_N')"},{"attributeType":"null","col":4,"comment":"null","endLoc":307,"id":12832,"name":"n_inputs","nodeType":"Attribute","startLoc":307,"text":"n_inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":308,"id":12833,"name":"n_outputs","nodeType":"Attribute","startLoc":308,"text":"n_outputs"},{"attributeType":"null","col":8,"comment":"null","endLoc":324,"id":12834,"name":"outputs","nodeType":"Attribute","startLoc":324,"text":"self.outputs"},{"col":4,"comment":"null","endLoc":375,"header":"@property\n    def input_units(self)","id":12835,"name":"input_units","nodeType":"Function","startLoc":371,"text":"@property\n    def input_units(self):\n        if self.x_break.unit is None:\n            return None\n        return {self.inputs[0]: self.x_break.unit}"},{"attributeType":"null","col":8,"comment":"null","endLoc":323,"id":12836,"name":"inputs","nodeType":"Attribute","startLoc":323,"text":"self.inputs"},{"className":"RotateCelestial2Native","col":0,"comment":"\n    Transform from Celestial to Native Spherical Coordinates.\n\n    Parameters\n    ----------\n    lon : float or `~astropy.units.Quantity` ['angle']\n        Celestial longitude of the fiducial point.\n    lat : float or `~astropy.units.Quantity` ['angle']\n        Celestial latitude of the fiducial point.\n    lon_pole : float or `~astropy.units.Quantity` ['angle']\n        Longitude of the celestial pole in the native system.\n\n    Notes\n    -----\n    If ``lon``, ``lat`` and ``lon_pole`` are numerical values they should be\n    in units of deg. Inputs are angles on the celestial sphere.\n    Outputs are angles on the native sphere.\n    ","endLoc":436,"id":12837,"nodeType":"Class","startLoc":362,"text":"class RotateCelestial2Native(_SkyRotation):\n    \"\"\"\n    Transform from Celestial to Native Spherical Coordinates.\n\n    Parameters\n    ----------\n    lon : float or `~astropy.units.Quantity` ['angle']\n        Celestial longitude of the fiducial point.\n    lat : float or `~astropy.units.Quantity` ['angle']\n        Celestial latitude of the fiducial point.\n    lon_pole : float or `~astropy.units.Quantity` ['angle']\n        Longitude of the celestial pole in the native system.\n\n    Notes\n    -----\n    If ``lon``, ``lat`` and ``lon_pole`` are numerical values they should be\n    in units of deg. Inputs are angles on the celestial sphere.\n    Outputs are angles on the native sphere.\n    \"\"\"\n    n_inputs = 2\n    n_outputs = 2\n\n    @property\n    def input_units(self):\n        \"\"\" Input units. \"\"\"\n        return {self.inputs[0]: u.deg,\n                self.inputs[1]: u.deg}\n\n    @property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {self.outputs[0]: u.deg,\n                self.outputs[1]: u.deg}\n\n    def __init__(self, lon, lat, lon_pole, **kwargs):\n        super().__init__(lon, lat, lon_pole, **kwargs)\n\n        # Inputs are angles on the celestial sphere\n        self.inputs = ('alpha_C', 'delta_C')\n        # Outputs are angles on the native sphere\n        self.outputs = ('phi_N', 'theta_N')\n\n    def evaluate(self, alpha_C, delta_C, lon, lat, lon_pole):\n        \"\"\"\n        Parameters\n        ----------\n        alpha_C, delta_C : float or `~astropy.units.Quantity` ['angle']\n            Angles in the Celestial coordinate frame.\n            If float, assumed in degrees.\n        lon, lat, lon_pole : float or `~astropy.units.Quantity` ['angle']\n            Parameter values when the model was initialized.\n            If float, assumed in degrees.\n\n        Returns\n        -------\n        phi_N, theta_N : float or `~astropy.units.Quantity` ['angle']\n            Angles on the Native sphere.\n            If float, in degrees.\n\n        \"\"\"\n        if isinstance(lon, u.Quantity):\n            lon = lon.value\n            lat = lat.value\n            lon_pole = lon_pole.value\n        # Convert to Euler angles\n        phi = (np.pi / 2 + lon)\n        theta = (np.pi / 2 - lat)\n        psi = -(lon_pole - np.pi / 2)\n        phi_N, theta_N = super()._evaluate(alpha_C, delta_C, phi, theta, psi)\n\n        return phi_N, theta_N\n\n    @property\n    def inverse(self):\n        return RotateNative2Celestial(self.lon, self.lat, self.lon_pole)"},{"col":4,"comment":" Input units. ","endLoc":388,"header":"@property\n    def input_units(self)","id":12838,"name":"input_units","nodeType":"Function","startLoc":384,"text":"@property\n    def input_units(self):\n        \"\"\" Input units. \"\"\"\n        return {self.inputs[0]: u.deg,\n                self.inputs[1]: u.deg}"},{"col":4,"comment":" Output units. ","endLoc":394,"header":"@property\n    def return_units(self)","id":12839,"name":"return_units","nodeType":"Function","startLoc":390,"text":"@property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {self.outputs[0]: u.deg,\n                self.outputs[1]: u.deg}"},{"col":4,"comment":"\n        Parameters\n        ----------\n        alpha_C, delta_C : float or `~astropy.units.Quantity` ['angle']\n            Angles in the Celestial coordinate frame.\n            If float, assumed in degrees.\n        lon, lat, lon_pole : float or `~astropy.units.Quantity` ['angle']\n            Parameter values when the model was initialized.\n            If float, assumed in degrees.\n\n        Returns\n        -------\n        phi_N, theta_N : float or `~astropy.units.Quantity` ['angle']\n            Angles on the Native sphere.\n            If float, in degrees.\n\n        ","endLoc":432,"header":"def evaluate(self, alpha_C, delta_C, lon, lat, lon_pole)","id":12840,"name":"evaluate","nodeType":"Function","startLoc":404,"text":"def evaluate(self, alpha_C, delta_C, lon, lat, lon_pole):\n        \"\"\"\n        Parameters\n        ----------\n        alpha_C, delta_C : float or `~astropy.units.Quantity` ['angle']\n            Angles in the Celestial coordinate frame.\n            If float, assumed in degrees.\n        lon, lat, lon_pole : float or `~astropy.units.Quantity` ['angle']\n            Parameter values when the model was initialized.\n            If float, assumed in degrees.\n\n        Returns\n        -------\n        phi_N, theta_N : float or `~astropy.units.Quantity` ['angle']\n            Angles on the Native sphere.\n            If float, in degrees.\n\n        \"\"\"\n        if isinstance(lon, u.Quantity):\n            lon = lon.value\n            lat = lat.value\n            lon_pole = lon_pole.value\n        # Convert to Euler angles\n        phi = (np.pi / 2 + lon)\n        theta = (np.pi / 2 - lat)\n        psi = -(lon_pole - np.pi / 2)\n        phi_N, theta_N = super()._evaluate(alpha_C, delta_C, phi, theta, psi)\n\n        return phi_N, theta_N"},{"col":4,"comment":"\n        Scale density of the NFW profile. Often written in the literature as :math:`\\rho_s`\n        ","endLoc":606,"header":"@property\n    def rho_scale(self)","id":12841,"name":"rho_scale","nodeType":"Function","startLoc":601,"text":"@property\n    def rho_scale(self):\n        r\"\"\"\n        Scale density of the NFW profile. Often written in the literature as :math:`\\rho_s`\n        \"\"\"\n        return self.density_s"},{"col":4,"comment":"null","endLoc":379,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":12842,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":377,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_break': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"col":4,"comment":"\n        Scale radius of the NFW profile.\n        ","endLoc":634,"header":"@property\n    def r_s(self)","id":12843,"name":"r_s","nodeType":"Function","startLoc":629,"text":"@property\n    def r_s(self):\n        \"\"\"\n        Scale radius of the NFW profile.\n        \"\"\"\n        return self.radius_s"},{"col":4,"comment":"\n        Mass factor defined virial radius of the NFW profile (R200c for M200c, Rvir for Mvir, etc.).\n        ","endLoc":641,"header":"@property\n    def r_virial(self)","id":12844,"name":"r_virial","nodeType":"Function","startLoc":636,"text":"@property\n    def r_virial(self):\n        \"\"\"\n        Mass factor defined virial radius of the NFW profile (R200c for M200c, Rvir for Mvir, etc.).\n        \"\"\"\n        return self.r_s * self.concentration"},{"col":4,"comment":"null","endLoc":436,"header":"@property\n    def inverse(self)","id":12845,"name":"inverse","nodeType":"Function","startLoc":434,"text":"@property\n    def inverse(self):\n        return RotateNative2Celestial(self.lon, self.lat, self.lon_pole)"},{"col":4,"comment":"\n        Radius of maximum circular velocity.\n        ","endLoc":648,"header":"@property\n    def r_max(self)","id":12846,"name":"r_max","nodeType":"Function","startLoc":643,"text":"@property\n    def r_max(self):\n        \"\"\"\n        Radius of maximum circular velocity.\n        \"\"\"\n        return self.r_s * 2.16258"},{"col":4,"comment":"\n        Maximum circular velocity.\n        ","endLoc":655,"header":"@property\n    def v_max(self)","id":12847,"name":"v_max","nodeType":"Function","startLoc":650,"text":"@property\n    def v_max(self):\n        \"\"\"\n        Maximum circular velocity.\n        \"\"\"\n        return self.circular_velocity(self.r_max)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":276,"id":12848,"name":"x_mean","nodeType":"Attribute","startLoc":276,"text":"x_mean"},{"className":"Covariance","col":0,"comment":"Class for covariance matrix calculated by fitter. ","endLoc":92,"id":12849,"nodeType":"Class","startLoc":57,"text":"class Covariance():\n    \"\"\"Class for covariance matrix calculated by fitter. \"\"\"\n\n    def __init__(self, cov_matrix, param_names):\n        self.cov_matrix = cov_matrix\n        self.param_names = param_names\n\n    def pprint(self, max_lines, round_val):\n        # Print and label lower triangle of covariance matrix\n        # Print rows for params up to `max_lines`, round floats to 'round_val'\n        longest_name = max([len(x) for x in self.param_names])\n        ret_str = 'parameter variances / covariances \\n'\n        fstring = f'{\"\": <{longest_name}}| {{0}}\\n'\n        for i, row in enumerate(self.cov_matrix):\n            if i <= max_lines-1:\n                param = self.param_names[i]\n                ret_str += fstring.replace(' '*len(param), param, 1).\\\n                           format(repr(np.round(row[:i+1], round_val))[7:-2])\n            else:\n                ret_str += '...'\n        return(ret_str.rstrip())\n\n    def __repr__(self):\n        return(self.pprint(max_lines=10, round_val=3))\n\n    def __getitem__(self, params):\n        # index covariance matrix by parameter names or indices\n        if len(params) != 2:\n            raise ValueError('Covariance must be indexed by two values.')\n        if all(isinstance(item, str) for item in params):\n            i1, i2 = self.param_names.index(params[0]), self.param_names.index(params[1])\n        elif all(isinstance(item, int) for item in params):\n            i1, i2 = params\n        else:\n            raise TypeError('Covariance can be indexed by two parameter names or integer indices.')\n        return(self.cov_matrix[i1][i2])"},{"col":4,"comment":"null","endLoc":62,"header":"def __init__(self, cov_matrix, param_names)","id":12850,"name":"__init__","nodeType":"Function","startLoc":60,"text":"def __init__(self, cov_matrix, param_names):\n        self.cov_matrix = cov_matrix\n        self.param_names = param_names"},{"col":4,"comment":"null","endLoc":77,"header":"def pprint(self, max_lines, round_val)","id":12851,"name":"pprint","nodeType":"Function","startLoc":64,"text":"def pprint(self, max_lines, round_val):\n        # Print and label lower triangle of covariance matrix\n        # Print rows for params up to `max_lines`, round floats to 'round_val'\n        longest_name = max([len(x) for x in self.param_names])\n        ret_str = 'parameter variances / covariances \\n'\n        fstring = f'{\"\": <{longest_name}}| {{0}}\\n'\n        for i, row in enumerate(self.cov_matrix):\n            if i <= max_lines-1:\n                param = self.param_names[i]\n                ret_str += fstring.replace(' '*len(param), param, 1).\\\n                           format(repr(np.round(row[:i+1], round_val))[7:-2])\n            else:\n                ret_str += '...'\n        return(ret_str.rstrip())"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":241,"id":12852,"name":"amplitude","nodeType":"Attribute","startLoc":241,"text":"amplitude"},{"attributeType":"null","col":4,"comment":"null","endLoc":381,"id":12853,"name":"n_inputs","nodeType":"Attribute","startLoc":381,"text":"n_inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":382,"id":12854,"name":"n_outputs","nodeType":"Attribute","startLoc":382,"text":"n_outputs"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":277,"id":12855,"name":"y_mean","nodeType":"Attribute","startLoc":277,"text":"y_mean"},{"attributeType":"null","col":8,"comment":"null","endLoc":402,"id":12856,"name":"outputs","nodeType":"Attribute","startLoc":402,"text":"self.outputs"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":242,"id":12857,"name":"x_break","nodeType":"Attribute","startLoc":242,"text":"x_break"},{"attributeType":"null","col":8,"comment":"null","endLoc":400,"id":12858,"name":"inputs","nodeType":"Attribute","startLoc":400,"text":"self.inputs"},{"className":"Rotation2D","col":0,"comment":"\n    Perform a 2D rotation given an angle.\n\n    Positive angles represent a counter-clockwise rotation and vice-versa.\n\n    Parameters\n    ----------\n    angle : float or `~astropy.units.Quantity` ['angle']\n        Angle of rotation (if float it should be in deg).\n    ","endLoc":515,"id":12859,"nodeType":"Class","startLoc":439,"text":"class Rotation2D(Model):\n    \"\"\"\n    Perform a 2D rotation given an angle.\n\n    Positive angles represent a counter-clockwise rotation and vice-versa.\n\n    Parameters\n    ----------\n    angle : float or `~astropy.units.Quantity` ['angle']\n        Angle of rotation (if float it should be in deg).\n    \"\"\"\n    n_inputs = 2\n    n_outputs = 2\n\n    _separable = False\n\n    angle = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian,\n    description=\"Angle of rotation (Quantity or value in deg)\")\n\n    def __init__(self, angle=angle, **kwargs):\n        super().__init__(angle=angle, **kwargs)\n        self._inputs = (\"x\", \"y\")\n        self._outputs = (\"x\", \"y\")\n\n    @property\n    def inverse(self):\n        \"\"\"Inverse rotation.\"\"\"\n\n        return self.__class__(angle=-self.angle)\n\n    @classmethod\n    def evaluate(cls, x, y, angle):\n        \"\"\"\n        Rotate (x, y) about ``angle``.\n\n        Parameters\n        ----------\n        x, y : array-like\n            Input quantities\n        angle : float or `~astropy.units.Quantity` ['angle']\n            Angle of rotations.\n            If float, assumed in degrees.\n\n        \"\"\"\n\n        if x.shape != y.shape:\n            raise ValueError(\"Expected input arrays to have the same shape\")\n\n        # If one argument has units, enforce they both have units and they are compatible.\n        x_unit = getattr(x, 'unit', None)\n        y_unit = getattr(y, 'unit', None)\n        has_units = x_unit is not None and y_unit is not None\n        if x_unit != y_unit:\n            if has_units and y_unit.is_equivalent(x_unit):\n                y = y.to(x_unit)\n                y_unit = x_unit\n            else:\n                raise u.UnitsError(\"x and y must have compatible units\")\n\n        # Note: If the original shape was () (an array scalar) convert to a\n        # 1-element 1-D array on output for consistency with most other models\n        orig_shape = x.shape or (1,)\n        inarr = np.array([x.flatten(), y.flatten()])\n        if isinstance(angle, u.Quantity):\n            angle = angle.to_value(u.rad)\n        result = np.dot(cls._compute_matrix(angle), inarr)\n        x, y = result[0], result[1]\n        x.shape = y.shape = orig_shape\n        if has_units:\n            return u.Quantity(x, unit=x_unit), u.Quantity(y, unit=y_unit)\n        return x, y\n\n    @staticmethod\n    def _compute_matrix(angle):\n        return np.array([[math.cos(angle), -math.sin(angle)],\n                         [math.sin(angle), math.cos(angle)]],\n                        dtype=np.float64)"},{"col":4,"comment":"null","endLoc":461,"header":"def __init__(self, angle=angle, **kwargs)","id":12860,"name":"__init__","nodeType":"Function","startLoc":458,"text":"def __init__(self, angle=angle, **kwargs):\n        super().__init__(angle=angle, **kwargs)\n        self._inputs = (\"x\", \"y\")\n        self._outputs = (\"x\", \"y\")"},{"col":4,"comment":"Inverse rotation.","endLoc":467,"header":"@property\n    def inverse(self)","id":12861,"name":"inverse","nodeType":"Function","startLoc":463,"text":"@property\n    def inverse(self):\n        \"\"\"Inverse rotation.\"\"\"\n\n        return self.__class__(angle=-self.angle)"},{"col":4,"comment":"\n        Circular velocities of the NFW profile.\n\n        Parameters\n        ----------\n        r : float or `~astropy.units.Quantity` ['length']\n            Radial position of velocity to be calculated for the NFW profile.\n\n        Returns\n        -------\n        velocity : float or `~astropy.units.Quantity` ['speed']\n            NFW profile circular velocity at location ``r``. The velocity units are:\n            [km / s]\n\n        Notes\n        -----\n\n        Model formula:\n\n        .. math:: v_{circ}(r)^2 = \\frac{1}{x}\\frac{\\ln(1+cx)-(cx)/(1+cx)}{\\ln(1+c)-c/(1+c)}\n\n        .. math:: x = r/r_s\n\n        .. warning::\n\n            Output values might contain ``nan`` and ``inf``.\n        ","endLoc":704,"header":"def circular_velocity(self, r)","id":12862,"name":"circular_velocity","nodeType":"Function","startLoc":657,"text":"def circular_velocity(self, r):\n        r\"\"\"\n        Circular velocities of the NFW profile.\n\n        Parameters\n        ----------\n        r : float or `~astropy.units.Quantity` ['length']\n            Radial position of velocity to be calculated for the NFW profile.\n\n        Returns\n        -------\n        velocity : float or `~astropy.units.Quantity` ['speed']\n            NFW profile circular velocity at location ``r``. The velocity units are:\n            [km / s]\n\n        Notes\n        -----\n\n        Model formula:\n\n        .. math:: v_{circ}(r)^2 = \\frac{1}{x}\\frac{\\ln(1+cx)-(cx)/(1+cx)}{\\ln(1+c)-c/(1+c)}\n\n        .. math:: x = r/r_s\n\n        .. warning::\n\n            Output values might contain ``nan`` and ``inf``.\n        \"\"\"\n        # Enforce default units (if parameters are without units)\n        if hasattr(r, \"unit\"):\n            in_r = r\n        else:\n            in_r = u.Quantity(r, u.kpc)\n\n        # Mass factor defined velocity (i.e. V200c for M200c, Rvir for Mvir)\n        v_profile = np.sqrt(self.mass * const.G.to(in_r.unit**3 / (self.mass.unit * u.s**2)) /\n                            self.r_virial)\n\n        # Define reduced radius (r / r_{\\\\rm s})\n        reduced_radius = in_r / self.r_virial.to(in_r.unit)\n\n        # Circular velocity given by:\n        # v^2=\\frac{1}{x}\\frac{\\ln(1+cx)-(cx)/(1+cx)}{\\ln(1+c)-c/(1+c)}\n        # where x=r/r_{200}\n        velocity = np.sqrt((v_profile**2 * self.A_NFW(self.concentration * reduced_radius)) /\n                           (reduced_radius * self.A_NFW(self.concentration)))\n\n        return velocity.to(u.km / u.s)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":243,"id":12863,"name":"alpha_1","nodeType":"Attribute","startLoc":243,"text":"alpha_1"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":278,"id":12864,"name":"x_stddev","nodeType":"Attribute","startLoc":278,"text":"x_stddev"},{"col":4,"comment":"\n        Rotate (x, y) about ``angle``.\n\n        Parameters\n        ----------\n        x, y : array-like\n            Input quantities\n        angle : float or `~astropy.units.Quantity` ['angle']\n            Angle of rotations.\n            If float, assumed in degrees.\n\n        ","endLoc":509,"header":"@classmethod\n    def evaluate(cls, x, y, angle)","id":12865,"name":"evaluate","nodeType":"Function","startLoc":469,"text":"@classmethod\n    def evaluate(cls, x, y, angle):\n        \"\"\"\n        Rotate (x, y) about ``angle``.\n\n        Parameters\n        ----------\n        x, y : array-like\n            Input quantities\n        angle : float or `~astropy.units.Quantity` ['angle']\n            Angle of rotations.\n            If float, assumed in degrees.\n\n        \"\"\"\n\n        if x.shape != y.shape:\n            raise ValueError(\"Expected input arrays to have the same shape\")\n\n        # If one argument has units, enforce they both have units and they are compatible.\n        x_unit = getattr(x, 'unit', None)\n        y_unit = getattr(y, 'unit', None)\n        has_units = x_unit is not None and y_unit is not None\n        if x_unit != y_unit:\n            if has_units and y_unit.is_equivalent(x_unit):\n                y = y.to(x_unit)\n                y_unit = x_unit\n            else:\n                raise u.UnitsError(\"x and y must have compatible units\")\n\n        # Note: If the original shape was () (an array scalar) convert to a\n        # 1-element 1-D array on output for consistency with most other models\n        orig_shape = x.shape or (1,)\n        inarr = np.array([x.flatten(), y.flatten()])\n        if isinstance(angle, u.Quantity):\n            angle = angle.to_value(u.rad)\n        result = np.dot(cls._compute_matrix(angle), inarr)\n        x, y = result[0], result[1]\n        x.shape = y.shape = orig_shape\n        if has_units:\n            return u.Quantity(x, unit=x_unit), u.Quantity(y, unit=y_unit)\n        return x, y"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":279,"id":12866,"name":"y_stddev","nodeType":"Attribute","startLoc":279,"text":"y_stddev"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":244,"id":12867,"name":"alpha_2","nodeType":"Attribute","startLoc":244,"text":"alpha_2"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":245,"id":12868,"name":"delta","nodeType":"Attribute","startLoc":245,"text":"delta"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":280,"id":12869,"name":"theta","nodeType":"Attribute","startLoc":280,"text":"theta"},{"className":"Shift","col":0,"comment":"\n    Shift a coordinate.\n\n    Parameters\n    ----------\n    offset : float\n        Offset to add to a coordinate.\n    ","endLoc":507,"id":12870,"nodeType":"Class","startLoc":452,"text":"class Shift(Fittable1DModel):\n    \"\"\"\n    Shift a coordinate.\n\n    Parameters\n    ----------\n    offset : float\n        Offset to add to a coordinate.\n    \"\"\"\n\n    offset = Parameter(default=0, description=\"Offset to add to a model\")\n    linear = True\n\n    _has_inverse_bounding_box = True\n\n    @property\n    def input_units(self):\n        if self.offset.unit is None:\n            return None\n        return {self.inputs[0]: self.offset.unit}\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse Shift model function\"\"\"\n\n        inv = self.copy()\n        inv.offset *= -1\n\n        try:\n            self.bounding_box\n        except NotImplementedError:\n            pass\n        else:\n            inv.bounding_box = tuple(self.evaluate(x, self.offset) for x in self.bounding_box)\n\n        return inv\n\n    @staticmethod\n    def evaluate(x, offset):\n        \"\"\"One dimensional Shift model function\"\"\"\n        return x + offset\n\n    @staticmethod\n    def sum_of_implicit_terms(x):\n        \"\"\"Evaluate the implicit term (x) of one dimensional Shift model\"\"\"\n        return x\n\n    @staticmethod\n    def fit_deriv(x, *params):\n        \"\"\"One dimensional Shift model derivative with respect to parameter\"\"\"\n\n        d_offset = np.ones_like(x)\n        return [d_offset]\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'offset': outputs_unit[self.outputs[0]]}"},{"col":4,"comment":"null","endLoc":471,"header":"@property\n    def input_units(self)","id":12871,"name":"input_units","nodeType":"Function","startLoc":467,"text":"@property\n    def input_units(self):\n        if self.offset.unit is None:\n            return None\n        return {self.inputs[0]: self.offset.unit}"},{"col":4,"comment":"One dimensional inverse Shift model function","endLoc":487,"header":"@property\n    def inverse(self)","id":12872,"name":"inverse","nodeType":"Function","startLoc":473,"text":"@property\n    def inverse(self):\n        \"\"\"One dimensional inverse Shift model function\"\"\"\n\n        inv = self.copy()\n        inv.offset *= -1\n\n        try:\n            self.bounding_box\n        except NotImplementedError:\n            pass\n        else:\n            inv.bounding_box = tuple(self.evaluate(x, self.offset) for x in self.bounding_box)\n\n        return inv"},{"col":4,"comment":"One dimensional Shift model function","endLoc":492,"header":"@staticmethod\n    def evaluate(x, offset)","id":12873,"name":"evaluate","nodeType":"Function","startLoc":489,"text":"@staticmethod\n    def evaluate(x, offset):\n        \"\"\"One dimensional Shift model function\"\"\"\n        return x + offset"},{"col":4,"comment":"Evaluate the implicit term (x) of one dimensional Shift model","endLoc":497,"header":"@staticmethod\n    def sum_of_implicit_terms(x)","id":12874,"name":"sum_of_implicit_terms","nodeType":"Function","startLoc":494,"text":"@staticmethod\n    def sum_of_implicit_terms(x):\n        \"\"\"Evaluate the implicit term (x) of one dimensional Shift model\"\"\"\n        return x"},{"col":4,"comment":"One dimensional Shift model derivative with respect to parameter","endLoc":504,"header":"@staticmethod\n    def fit_deriv(x, *params)","id":12875,"name":"fit_deriv","nodeType":"Function","startLoc":499,"text":"@staticmethod\n    def fit_deriv(x, *params):\n        \"\"\"One dimensional Shift model derivative with respect to parameter\"\"\"\n\n        d_offset = np.ones_like(x)\n        return [d_offset]"},{"col":4,"comment":"null","endLoc":507,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":12876,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":506,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'offset': outputs_unit[self.outputs[0]]}"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":462,"id":12877,"name":"offset","nodeType":"Attribute","startLoc":462,"text":"offset"},{"attributeType":"null","col":0,"comment":"null","endLoc":46,"id":12878,"name":"__all__","nodeType":"Attribute","startLoc":46,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":2877,"id":12879,"name":"BINARY_OPERATORS","nodeType":"Attribute","startLoc":2877,"text":"BINARY_OPERATORS"},{"attributeType":"null","col":0,"comment":"null","endLoc":4063,"id":12880,"name":"_ORDER_OF_OPERATORS","nodeType":"Attribute","startLoc":4063,"text":"_ORDER_OF_OPERATORS"},{"attributeType":"null","col":0,"comment":"null","endLoc":4064,"id":12881,"name":"OPERATOR_PRECEDENCE","nodeType":"Attribute","startLoc":4064,"text":"OPERATOR_PRECEDENCE"},{"attributeType":"null","col":4,"comment":"null","endLoc":4065,"id":12882,"name":"idx","nodeType":"Attribute","startLoc":4065,"text":"idx"},{"attributeType":"null","col":9,"comment":"null","endLoc":4065,"id":12883,"name":"ops","nodeType":"Attribute","startLoc":4065,"text":"ops"},{"attributeType":"null","col":8,"comment":"null","endLoc":4066,"id":12884,"name":"op","nodeType":"Attribute","startLoc":4066,"text":"op"},{"col":0,"comment":"","endLoc":14,"header":"core.py#<anonymous>","id":12885,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module defines base classes for all models.  The base class of all\nmodels is `~astropy.modeling.Model`. `~astropy.modeling.FittableModel` is\nthe base class for all fittable models. Fittable models can be linear or\nnonlinear in a regression analysis sense.\n\nAll models provide a `__call__` method which performs the transformation in\na purely mathematical way, i.e. the models are unitless.  Model instances can\nrepresent either a single model, or a \"model set\" representing multiple copies\nof the same type of model, but with potentially different values of the\nparameters in each model making up the set.\n\"\"\"\n\n__all__ = ['Model', 'FittableModel', 'Fittable1DModel', 'Fittable2DModel',\n           'CompoundModel', 'fix_inputs', 'custom_model', 'ModelDefinitionError',\n           'bind_bounding_box', 'bind_compound_bounding_box']\n\nBINARY_OPERATORS = {\n    '+': _make_arithmetic_operator(operator.add),\n    '-': _make_arithmetic_operator(operator.sub),\n    '*': _make_arithmetic_operator(operator.mul),\n    '/': _make_arithmetic_operator(operator.truediv),\n    '**': _make_arithmetic_operator(operator.pow),\n    '|': _composition_operator,\n    '&': _join_operator\n}\n\nSPECIAL_OPERATORS = _SpecialOperatorsDict()\n\n_ORDER_OF_OPERATORS = [('fix_inputs',), ('|',), ('&',), ('+', '-'), ('*', '/'), ('**',)]\n\nOPERATOR_PRECEDENCE = {}\n\nfor idx, ops in enumerate(_ORDER_OF_OPERATORS):\n    for op in ops:\n        OPERATOR_PRECEDENCE[op] = idx\n\ndel idx, op, ops"},{"attributeType":"null","col":4,"comment":"null","endLoc":463,"id":12886,"name":"linear","nodeType":"Attribute","startLoc":463,"text":"linear"},{"attributeType":"null","col":4,"comment":"null","endLoc":465,"id":12887,"name":"_has_inverse_bounding_box","nodeType":"Attribute","startLoc":465,"text":"_has_inverse_bounding_box"},{"className":"Scale","col":0,"comment":"\n    Multiply a model by a dimensionless factor.\n\n    Parameters\n    ----------\n    factor : float\n        Factor by which to scale a coordinate.\n\n    Notes\n    -----\n\n    If ``factor`` is a `~astropy.units.Quantity` then the units will be\n    stripped before the scaling operation.\n\n    ","endLoc":573,"id":12888,"nodeType":"Class","startLoc":510,"text":"class Scale(Fittable1DModel):\n    \"\"\"\n    Multiply a model by a dimensionless factor.\n\n    Parameters\n    ----------\n    factor : float\n        Factor by which to scale a coordinate.\n\n    Notes\n    -----\n\n    If ``factor`` is a `~astropy.units.Quantity` then the units will be\n    stripped before the scaling operation.\n\n    \"\"\"\n\n    factor = Parameter(default=1, description=\"Factor by which to scale a model\")\n    linear = True\n    fittable = True\n\n    _input_units_strict = True\n    _input_units_allow_dimensionless = True\n\n    _has_inverse_bounding_box = True\n\n    @property\n    def input_units(self):\n        if self.factor.unit is None:\n            return None\n        return {self.inputs[0]: self.factor.unit}\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse Scale model function\"\"\"\n        inv = self.copy()\n        inv.factor = 1 / self.factor\n\n        try:\n            self.bounding_box\n        except NotImplementedError:\n            pass\n        else:\n            inv.bounding_box = tuple(self.evaluate(x, self.factor) for x in self.bounding_box.bounding_box())\n\n        return inv\n\n    @staticmethod\n    def evaluate(x, factor):\n        \"\"\"One dimensional Scale model function\"\"\"\n        if isinstance(factor, u.Quantity):\n            factor = factor.value\n\n        return factor * x\n\n    @staticmethod\n    def fit_deriv(x, *params):\n        \"\"\"One dimensional Scale model derivative with respect to parameter\"\"\"\n\n        d_factor = x\n        return [d_factor]\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'factor': outputs_unit[self.outputs[0]]}"},{"col":4,"comment":"null","endLoc":540,"header":"@property\n    def input_units(self)","id":12889,"name":"input_units","nodeType":"Function","startLoc":536,"text":"@property\n    def input_units(self):\n        if self.factor.unit is None:\n            return None\n        return {self.inputs[0]: self.factor.unit}"},{"col":4,"comment":"One dimensional inverse Scale model function","endLoc":555,"header":"@property\n    def inverse(self)","id":12890,"name":"inverse","nodeType":"Function","startLoc":542,"text":"@property\n    def inverse(self):\n        \"\"\"One dimensional inverse Scale model function\"\"\"\n        inv = self.copy()\n        inv.factor = 1 / self.factor\n\n        try:\n            self.bounding_box\n        except NotImplementedError:\n            pass\n        else:\n            inv.bounding_box = tuple(self.evaluate(x, self.factor) for x in self.bounding_box.bounding_box())\n\n        return inv"},{"col":4,"comment":"null","endLoc":709,"header":"@property\n    def input_units(self)","id":12891,"name":"input_units","nodeType":"Function","startLoc":706,"text":"@property\n    def input_units(self):\n        # The units for the 'r' variable should be a length (default kpc)\n        return {self.inputs[0]: u.kpc}"},{"col":4,"comment":"null","endLoc":718,"header":"@property\n    def return_units(self)","id":12892,"name":"return_units","nodeType":"Function","startLoc":711,"text":"@property\n    def return_units(self):\n        # The units for the 'density' variable should be a matter density (default M_sun / kpc^3)\n\n        if (self.mass.unit is None):\n            return {self.outputs[0]: u.M_sun / self.input_units[self.inputs[0]] ** 3}\n        else:\n            return {self.outputs[0]: self.mass.unit / self.input_units[self.inputs[0]] ** 3}"},{"col":4,"comment":"null","endLoc":723,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":12893,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":720,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'mass': u.M_sun,\n                \"concentration\": None,\n                \"redshift\": None}"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":423,"id":12894,"name":"mass","nodeType":"Attribute","startLoc":423,"text":"mass"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":427,"id":12895,"name":"concentration","nodeType":"Attribute","startLoc":427,"text":"concentration"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":430,"id":12896,"name":"redshift","nodeType":"Attribute","startLoc":430,"text":"redshift"},{"col":4,"comment":"One dimensional Scale model function","endLoc":563,"header":"@staticmethod\n    def evaluate(x, factor)","id":12897,"name":"evaluate","nodeType":"Function","startLoc":557,"text":"@staticmethod\n    def evaluate(x, factor):\n        \"\"\"One dimensional Scale model function\"\"\"\n        if isinstance(factor, u.Quantity):\n            factor = factor.value\n\n        return factor * x"},{"col":4,"comment":"One dimensional Scale model derivative with respect to parameter","endLoc":570,"header":"@staticmethod\n    def fit_deriv(x, *params)","id":12898,"name":"fit_deriv","nodeType":"Function","startLoc":565,"text":"@staticmethod\n    def fit_deriv(x, *params):\n        \"\"\"One dimensional Scale model derivative with respect to parameter\"\"\"\n\n        d_factor = x\n        return [d_factor]"},{"col":4,"comment":"null","endLoc":573,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":12899,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":572,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'factor': outputs_unit[self.outputs[0]]}"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":527,"id":12900,"name":"factor","nodeType":"Attribute","startLoc":527,"text":"factor"},{"attributeType":"null","col":4,"comment":"null","endLoc":434,"id":12901,"name":"_input_units_allow_dimensionless","nodeType":"Attribute","startLoc":434,"text":"_input_units_allow_dimensionless"},{"attributeType":"null","col":12,"comment":"null","endLoc":561,"id":12902,"name":"density_delta","nodeType":"Attribute","startLoc":561,"text":"self.density_delta"},{"attributeType":"null","col":8,"comment":"null","endLoc":622,"id":12903,"name":"radius_s","nodeType":"Attribute","startLoc":622,"text":"self.radius_s"},{"attributeType":"null","col":8,"comment":"null","endLoc":596,"id":12904,"name":"density_s","nodeType":"Attribute","startLoc":596,"text":"self.density_s"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":12905,"name":"__all__","nodeType":"Attribute","startLoc":17,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"physical_models.py#<anonymous>","id":12906,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nModels that have physical origins.\n\"\"\"\n\n__all__ = [\"BlackBody\", \"Drude1D\", \"Plummer1D\", \"NFW\"]"},{"fileName":"polynomial.py","filePath":"astropy/modeling","id":12907,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module contains models representing polynomials and polynomial series.\n\n\"\"\"\n# pylint: disable=invalid-name\nimport numpy as np\n\nfrom astropy.utils import indent, check_broadcast\nfrom .core import FittableModel, Model\nfrom .functional_models import Shift\nfrom .parameters import Parameter\nfrom .utils import poly_map_domain, comb, _validate_domain_window\n\n\n__all__ = [\n    'Chebyshev1D', 'Chebyshev2D', 'Hermite1D', 'Hermite2D',\n    'InverseSIP', 'Legendre1D', 'Legendre2D', 'Polynomial1D',\n    'Polynomial2D', 'SIP', 'OrthoPolynomialBase',\n    'PolynomialModel'\n]\n\n\nclass PolynomialBase(FittableModel):\n    \"\"\"\n    Base class for all polynomial-like models with an arbitrary number of\n    parameters in the form of coefficients.\n\n    In this case Parameter instances are returned through the class's\n    ``__getattr__`` rather than through class descriptors.\n    \"\"\"\n\n    # Default _param_names list; this will be filled in by the implementation's\n    # __init__\n    _param_names = ()\n\n    linear = True\n    col_fit_deriv = False\n\n    @property\n    def param_names(self):\n        \"\"\"Coefficient names generated based on the model's polynomial degree\n        and number of dimensions.\n\n        Subclasses should implement this to return parameter names in the\n        desired format.\n\n        On most `Model` classes this is a class attribute, but for polynomial\n        models it is an instance attribute since each polynomial model instance\n        can have different parameters depending on the degree of the polynomial\n        and the number of dimensions, for example.\n        \"\"\"\n\n        return self._param_names\n\n\nclass PolynomialModel(PolynomialBase):\n    \"\"\"\n    Base class for polynomial models.\n\n    Its main purpose is to determine how many coefficients are needed\n    based on the polynomial order and dimension and to provide their\n    default values, names and ordering.\n    \"\"\"\n\n    def __init__(self, degree, n_models=None, model_set_axis=None,\n                 name=None, meta=None, **params):\n        self._degree = degree\n        self._order = self.get_num_coeff(self.n_inputs)\n        self._param_names = self._generate_coeff_names(self.n_inputs)\n        if n_models:\n            if model_set_axis is None:\n                model_set_axis = 0\n            minshape = (1,) * model_set_axis + (n_models,)\n        else:\n            minshape = ()\n        for param_name in self._param_names:\n            self._parameters_[param_name] = \\\n                Parameter(param_name, default=np.zeros(minshape))\n\n        super().__init__(\n            n_models=n_models, model_set_axis=model_set_axis, name=name,\n            meta=meta, **params)\n\n    @property\n    def degree(self):\n        \"\"\"Degree of polynomial.\"\"\"\n\n        return self._degree\n\n    def get_num_coeff(self, ndim):\n        \"\"\"\n        Return the number of coefficients in one parameter set\n        \"\"\"\n\n        if self.degree < 0:\n            raise ValueError(\"Degree of polynomial must be positive or null\")\n        # deg+1 is used to account for the difference between iraf using\n        # degree and numpy using exact degree\n        if ndim != 1:\n            nmixed = comb(self.degree, ndim)\n        else:\n            nmixed = 0\n        numc = self.degree * ndim + nmixed + 1\n        return numc\n\n    def _invlex(self):\n        c = []\n        lencoeff = self.degree + 1\n        for i in range(lencoeff):\n            for j in range(lencoeff):\n                if i + j <= self.degree:\n                    c.append((j, i))\n        return c[::-1]\n\n    def _generate_coeff_names(self, ndim):\n        names = []\n        if ndim == 1:\n            for n in range(self._order):\n                names.append(f'c{n}')\n        else:\n            for i in range(self.degree + 1):\n                names.append(f'c{i}_{0}')\n            for i in range(1, self.degree + 1):\n                names.append(f'c{0}_{i}')\n            for i in range(1, self.degree):\n                for j in range(1, self.degree):\n                    if i + j < self.degree + 1:\n                        names.append(f'c{i}_{j}')\n        return tuple(names)\n\n\nclass _PolyDomainWindow1D(PolynomialModel):\n    \"\"\"\n    This class sets ``domain`` and ``window`` of 1D polynomials.\n    \"\"\"\n    def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            degree, n_models, model_set_axis, name=name, meta=meta, **params)\n\n        self._set_default_domain_window(domain, window)\n\n    @property\n    def window(self):\n        return self._window\n\n    @window.setter\n    def window(self, val):\n        self._window = _validate_domain_window(val)\n\n    @property\n    def domain(self):\n        return self._domain\n\n    @domain.setter\n    def domain(self, val):\n        self._domain = _validate_domain_window(val)\n\n    def _set_default_domain_window(self, domain, window):\n        \"\"\"\n        This method sets the ``domain`` and ``window`` attributes on 1D subclasses.\n\n        \"\"\"\n\n        self._default_domain_window = {'domain': None,\n                                       'window': (-1, 1)\n                                       }\n        self.window = window or (-1, 1)\n        self.domain = domain\n\n    def __repr__(self):\n        return self._format_repr([self.degree],\n                                 kwargs={'domain': self.domain, 'window': self.window},\n                                 defaults=self._default_domain_window\n                                 )\n\n    def __str__(self):\n        return self._format_str([('Degree', self.degree),\n                                 ('Domain', self.domain),\n                                 ('Window', self.window)],\n                                 self._default_domain_window)\n\n\nclass OrthoPolynomialBase(PolynomialBase):\n    \"\"\"\n    This is a base class for the 2D Chebyshev and Legendre models.\n\n    The polynomials implemented here require a maximum degree in x and y.\n\n    For explanation of ``x_domain``, ``y_domain``, ```x_window`` and ```y_window``\n    see :ref:`Notes regarding usage of domain and window <astropy:domain-window-note>`.\n\n\n    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : tuple or None, optional\n        domain of the x independent variable\n    x_window : tuple or None, optional\n        range of the x independent variable\n    y_domain : tuple or None, optional\n        domain of the y independent variable\n    y_window : tuple or None, optional\n        range of the y independent variable\n    **params : dict\n        {keyword: value} pairs, representing {parameter_name: value}\n    \"\"\"\n\n    n_inputs = 2\n    n_outputs = 1\n\n    def __init__(self, x_degree, y_degree, x_domain=None, x_window=None,\n                 y_domain=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.x_degree = x_degree\n        self.y_degree = y_degree\n        self._order = self.get_num_coeff()\n        # Set the ``x/y_domain`` and ``x/y_wndow`` attributes in subclasses.\n        self._default_domain_window = {\n            'x_window': (-1, 1),\n            'y_window': (-1, 1),\n            'x_domain': None,\n            'y_domain': None\n            }\n\n        self.x_window = x_window or self._default_domain_window['x_window']\n        self.y_window = y_window or self._default_domain_window['y_window']\n        self.x_domain = x_domain\n        self.y_domain = y_domain\n\n        self._param_names = self._generate_coeff_names()\n        if n_models:\n            if model_set_axis is None:\n                model_set_axis = 0\n            minshape = (1,) * model_set_axis + (n_models,)\n        else:\n            minshape = ()\n\n        for param_name in self._param_names:\n            self._parameters_[param_name] = \\\n                Parameter(param_name, default=np.zeros(minshape))\n        super().__init__(\n            n_models=n_models, model_set_axis=model_set_axis,\n            name=name, meta=meta, **params)\n\n    @property\n    def x_domain(self):\n        return self._x_domain\n\n    @x_domain.setter\n    def x_domain(self, val):\n        self._x_domain = _validate_domain_window(val)\n\n    @property\n    def y_domain(self):\n        return self._y_domain\n\n    @y_domain.setter\n    def y_domain(self, val):\n        self._y_domain = _validate_domain_window(val)\n\n    @property\n    def x_window(self):\n        return self._x_window\n\n    @x_window.setter\n    def x_window(self, val):\n        self._x_window = _validate_domain_window(val)\n\n    @property\n    def y_window(self):\n        return self._y_window\n\n    @y_window.setter\n    def y_window(self, val):\n        self._y_window = _validate_domain_window(val)\n\n    def __repr__(self):\n        return self._format_repr([self.x_degree, self.y_degree],\n                                 kwargs={'x_domain': self.x_domain,\n                                         'y_domain': self.y_domain,\n                                         'x_window': self.x_window,\n                                         'y_window': self.y_window},\n                                 defaults=self._default_domain_window)\n\n    def __str__(self):\n        return self._format_str(\n            [('X_Degree', self.x_degree),\n             ('Y_Degree', self.y_degree),\n             ('X_Domain', self.x_domain),\n             ('Y_Domain', self.y_domain),\n             ('X_Window', self.x_window),\n             ('Y_Window', self.y_window)],\n             self._default_domain_window)\n\n    def get_num_coeff(self):\n        \"\"\"\n        Determine how many coefficients are needed\n\n        Returns\n        -------\n        numc : int\n            number of coefficients\n        \"\"\"\n\n        if self.x_degree < 0 or self.y_degree < 0:\n            raise ValueError(\"Degree of polynomial must be positive or null\")\n\n        return (self.x_degree + 1) * (self.y_degree + 1)\n\n    def _invlex(self):\n        # TODO: This is a very slow way to do this; fix it and related methods\n        # like _alpha\n        c = []\n        xvar = np.arange(self.x_degree + 1)\n        yvar = np.arange(self.y_degree + 1)\n        for j in yvar:\n            for i in xvar:\n                c.append((i, j))\n        return np.array(c[::-1])\n\n    def invlex_coeff(self, coeffs):\n        invlex_coeffs = []\n        xvar = np.arange(self.x_degree + 1)\n        yvar = np.arange(self.y_degree + 1)\n        for j in yvar:\n            for i in xvar:\n                name = f'c{i}_{j}'\n                coeff = coeffs[self.param_names.index(name)]\n                invlex_coeffs.append(coeff)\n        return np.array(invlex_coeffs[::-1])\n\n    def _alpha(self):\n        invlexdeg = self._invlex()\n        invlexdeg[:, 1] = invlexdeg[:, 1] + self.x_degree + 1\n        nx = self.x_degree + 1\n        ny = self.y_degree + 1\n        alpha = np.zeros((ny * nx + 3, ny + nx))\n        for n in range(len(invlexdeg)):\n            alpha[n][invlexdeg[n]] = [1, 1]\n            alpha[-2, 0] = 1\n            alpha[-3, nx] = 1\n        return alpha\n\n    def imhorner(self, x, y, coeff):\n        _coeff = list(coeff)\n        _coeff.extend([0, 0, 0])\n        alpha = self._alpha()\n        r0 = _coeff[0]\n        nalpha = len(alpha)\n\n        karr = np.diff(alpha, axis=0)\n        kfunc = self._fcache(x, y)\n        x_terms = self.x_degree + 1\n        y_terms = self.y_degree + 1\n        nterms = x_terms + y_terms\n        for n in range(1, nterms + 1 + 3):\n            setattr(self, 'r' + str(n), 0.)\n\n        for n in range(1, nalpha):\n            k = karr[n - 1].nonzero()[0].max() + 1\n            rsum = 0\n            for i in range(1, k + 1):\n                rsum = rsum + getattr(self, 'r' + str(i))\n            val = kfunc[k - 1] * (r0 + rsum)\n            setattr(self, 'r' + str(k), val)\n            r0 = _coeff[n]\n            for i in range(1, k):\n                setattr(self, 'r' + str(i), 0.)\n        result = r0\n        for i in range(1, nterms + 1 + 3):\n            result = result + getattr(self, 'r' + str(i))\n        return result\n\n    def _generate_coeff_names(self):\n        names = []\n        for j in range(self.y_degree + 1):\n            for i in range(self.x_degree + 1):\n                names.append(f'c{i}_{j}')\n        return tuple(names)\n\n    def _fcache(self, x, y):\n        \"\"\"\n        Computation and store the individual functions.\n\n        To be implemented by subclasses\"\n        \"\"\"\n\n        raise NotImplementedError(\"Subclasses should implement this\")\n\n    def evaluate(self, x, y, *coeffs):\n        if self.x_domain is not None:\n            x = poly_map_domain(x, self.x_domain, self.x_window)\n        if self.y_domain is not None:\n            y = poly_map_domain(y, self.y_domain, self.y_window)\n        invcoeff = self.invlex_coeff(coeffs)\n        return self.imhorner(x, y, invcoeff)\n\n    def prepare_inputs(self, x, y, **kwargs):\n        inputs, broadcasted_shapes = super().prepare_inputs(x, y, **kwargs)\n\n        x, y = inputs\n\n        if x.shape != y.shape:\n            raise ValueError(\"Expected input arrays to have the same shape\")\n\n        return (x, y), broadcasted_shapes\n\n\nclass Chebyshev1D(_PolyDomainWindow1D):\n    r\"\"\"\n    Univariate Chebyshev series.\n\n    It is defined as:\n\n    .. math::\n\n        P(x) = \\sum_{i=0}^{i=n}C_{i} * T_{i}(x)\n\n    where ``T_i(x)`` is the corresponding Chebyshev polynomial of the 1st kind.\n\n    For explanation of ```domain``, and ``window`` see\n    :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : tuple or None, optional\n    window : tuple or None, optional\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window.\n    **params : dict\n        keyword : value pairs, representing parameter_name: value\n\n    Notes\n    -----\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Chebyshev polynomials is a polynomial in x - since the\n    coefficients within each Chebyshev polynomial are fixed, we can't use\n    quantities for x since the units would not be compatible. For example, the\n    third Chebyshev polynomial (T2) is 2x^2-1, but if x was specified with\n    units, 2x^2 and -1 would have incompatible units.\n    \"\"\"\n    n_inputs = 1\n    n_outputs = 1\n\n    _separable = True\n\n    def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n\n        super().__init__(degree, domain=domain, window=window, n_models=n_models,\n                         model_set_axis=model_set_axis, name=name, meta=meta, **params)\n\n    def fit_deriv(self, x, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        v = np.empty((self.degree + 1,) + x.shape, dtype=x.dtype)\n        v[0] = 1\n        if self.degree > 0:\n            x2 = 2 * x\n            v[1] = x\n            for i in range(2, self.degree + 1):\n                v[i] = v[i - 1] * x2 - v[i - 2]\n        return np.rollaxis(v, 0, v.ndim)\n\n    def prepare_inputs(self, x, **kwargs):\n        inputs, broadcasted_shapes = super().prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), broadcasted_shapes\n\n    def evaluate(self, x, *coeffs):\n        if self.domain is not None:\n            x = poly_map_domain(x, self.domain, self.window)\n        return self.clenshaw(x, coeffs)\n\n    @staticmethod\n    def clenshaw(x, coeffs):\n        \"\"\"Evaluates the polynomial using Clenshaw's algorithm.\"\"\"\n\n        if len(coeffs) == 1:\n            c0 = coeffs[0]\n            c1 = 0\n        elif len(coeffs) == 2:\n            c0 = coeffs[0]\n            c1 = coeffs[1]\n        else:\n            x2 = 2 * x\n            c0 = coeffs[-2]\n            c1 = coeffs[-1]\n            for i in range(3, len(coeffs) + 1):\n                tmp = c0\n                c0 = coeffs[-i] - c1\n                c1 = tmp + c1 * x2\n        return c0 + c1 * x\n\n\nclass Hermite1D(_PolyDomainWindow1D):\n    r\"\"\"\n    Univariate Hermite series.\n\n    It is defined as:\n\n    .. math::\n\n        P(x) = \\sum_{i=0}^{i=n}C_{i} * H_{i}(x)\n\n    where ``H_i(x)`` is the corresponding Hermite polynomial (\"Physicist's kind\").\n\n    For explanation of ``domain``, and ``window`` see\n    :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : tuple or None, optional\n    window : tuple or None, optional\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    **params : dict\n        keyword : value pairs, representing parameter_name: value\n\n    Notes\n    -----\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Hermite polynomials is a polynomial in x - since the\n    coefficients within each Hermite polynomial are fixed, we can't use\n    quantities for x since the units would not be compatible. For example, the\n    third Hermite polynomial (H2) is 4x^2-2, but if x was specified with units,\n    4x^2 and -2 would have incompatible units.\n    \"\"\"\n    n_inputs = 1\n    n_outputs = 1\n\n    _separable = True\n\n    def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            degree, domain, window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)\n\n    def fit_deriv(self, x, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        v = np.empty((self.degree + 1,) + x.shape, dtype=x.dtype)\n        v[0] = 1\n        if self.degree > 0:\n            x2 = 2 * x\n            v[1] = 2 * x\n            for i in range(2, self.degree + 1):\n                v[i] = x2 * v[i - 1] - 2 * (i - 1) * v[i - 2]\n        return np.rollaxis(v, 0, v.ndim)\n\n    def prepare_inputs(self, x, **kwargs):\n        inputs, broadcasted_shapes = super().prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), broadcasted_shapes\n\n    def evaluate(self, x, *coeffs):\n        if self.domain is not None:\n            x = poly_map_domain(x, self.domain, self.window)\n        return self.clenshaw(x, coeffs)\n\n    @staticmethod\n    def clenshaw(x, coeffs):\n        x2 = x * 2\n        if len(coeffs) == 1:\n            c0 = coeffs[0]\n            c1 = 0\n        elif len(coeffs) == 2:\n            c0 = coeffs[0]\n            c1 = coeffs[1]\n        else:\n            nd = len(coeffs)\n            c0 = coeffs[-2]\n            c1 = coeffs[-1]\n            for i in range(3, len(coeffs) + 1):\n                temp = c0\n                nd = nd - 1\n                c0 = coeffs[-i] - c1 * (2 * (nd - 1))\n                c1 = temp + c1 * x2\n        return c0 + c1 * x2\n\n\nclass Hermite2D(OrthoPolynomialBase):\n    r\"\"\"\n    Bivariate Hermite series.\n\n    It is defined as\n\n    .. math:: P_{nm}(x,y) = \\sum_{n,m=0}^{n=d,m=d}C_{nm} H_n(x) H_m(y)\n\n    where ``H_n(x)`` and ``H_m(y)`` are Hermite polynomials.\n\n    For explanation of ``x_domain``, ``y_domain``, ``x_window`` and ``y_window``\n    see :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : tuple or None, optional\n        domain of the x independent variable\n    y_domain : tuple or None, optional\n        domain of the y independent variable\n    x_window : tuple or None, optional\n        range of the x independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    y_window : tuple or None, optional\n        range of the y independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n\n    Notes\n    -----\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Hermite polynomials is a polynomial in x and/or y - since the\n    coefficients within each Hermite polynomial are fixed, we can't use\n    quantities for x and/or y since the units would not be compatible. For\n    example, the third Hermite polynomial (H2) is 4x^2-2, but if x was\n    specified with units, 4x^2 and -2 would have incompatible units.\n    \"\"\"\n    _separable = False\n\n    def __init__(self, x_degree, y_degree, x_domain=None, x_window=None,\n                 y_domain=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            x_degree, y_degree, x_domain=x_domain, y_domain=y_domain,\n            x_window=x_window, y_window=y_window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)\n\n    def _fcache(self, x, y):\n        \"\"\"\n        Calculate the individual Hermite functions once and store them in a\n        dictionary to be reused.\n        \"\"\"\n\n        x_terms = self.x_degree + 1\n        y_terms = self.y_degree + 1\n        kfunc = {}\n        kfunc[0] = np.ones(x.shape)\n        kfunc[1] = 2 * x.copy()\n        kfunc[x_terms] = np.ones(y.shape)\n        kfunc[x_terms + 1] = 2 * y.copy()\n        for n in range(2, x_terms):\n            kfunc[n] = 2 * x * kfunc[n - 1] - 2 * (n - 1) * kfunc[n - 2]\n        for n in range(x_terms + 2, x_terms + y_terms):\n            kfunc[n] = 2 * y * kfunc[n - 1] - 2 * (n - 1) * kfunc[n - 2]\n        return kfunc\n\n    def fit_deriv(self, x, y, *params):\n        \"\"\"\n        Derivatives with respect to the coefficients.\n\n        This is an array with Hermite polynomials:\n\n        .. math::\n\n            H_{x_0}H_{y_0}, H_{x_1}H_{y_0}...H_{x_n}H_{y_0}...H_{x_n}H_{y_m}\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        y : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        if x.shape != y.shape:\n            raise ValueError(\"x and y must have the same shape\")\n\n        x = x.flatten()\n        y = y.flatten()\n        x_deriv = self._hermderiv1d(x, self.x_degree + 1).T\n        y_deriv = self._hermderiv1d(y, self.y_degree + 1).T\n\n        ij = []\n        for i in range(self.y_degree + 1):\n            for j in range(self.x_degree + 1):\n                ij.append(x_deriv[j] * y_deriv[i])\n\n        v = np.array(ij)\n        return v.T\n\n    def _hermderiv1d(self, x, deg):\n        \"\"\"\n        Derivative of 1D Hermite series\n        \"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        d = np.empty((deg + 1, len(x)), dtype=x.dtype)\n        d[0] = x * 0 + 1\n        if deg > 0:\n            x2 = 2 * x\n            d[1] = x2\n            for i in range(2, deg + 1):\n                d[i] = x2 * d[i - 1] - 2 * (i - 1) * d[i - 2]\n        return np.rollaxis(d, 0, d.ndim)\n\n\nclass Legendre1D(_PolyDomainWindow1D):\n    r\"\"\"\n    Univariate Legendre series.\n\n    It is defined as:\n\n    .. math::\n\n        P(x) = \\sum_{i=0}^{i=n}C_{i} * L_{i}(x)\n\n    where ``L_i(x)`` is the corresponding Legendre polynomial.\n\n    For explanation of ``domain``, and ``window`` see\n    :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : tuple or None, optional\n    window : tuple or None, optional\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n\n\n    Notes\n    -----\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Legendre polynomials is a polynomial in x - since the\n    coefficients within each Legendre polynomial are fixed, we can't use\n    quantities for x since the units would not be compatible. For example, the\n    third Legendre polynomial (P2) is 1.5x^2-0.5, but if x was specified with\n    units, 1.5x^2 and -0.5 would have incompatible units.\n    \"\"\"\n\n    n_inputs = 1\n    n_outputs = 1\n\n    _separable = True\n\n    def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            degree, domain, window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)\n\n    def prepare_inputs(self, x, **kwargs):\n        inputs, broadcasted_shapes = super().prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), broadcasted_shapes\n\n    def evaluate(self, x, *coeffs):\n        if self.domain is not None:\n            x = poly_map_domain(x, self.domain, self.window)\n        return self.clenshaw(x, coeffs)\n\n    def fit_deriv(self, x, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        v = np.empty((self.degree + 1,) + x.shape, dtype=x.dtype)\n        v[0] = 1\n        if self.degree > 0:\n            v[1] = x\n            for i in range(2, self.degree + 1):\n                v[i] = (v[i - 1] * x * (2 * i - 1) - v[i - 2] * (i - 1)) / i\n        return np.rollaxis(v, 0, v.ndim)\n\n    @staticmethod\n    def clenshaw(x, coeffs):\n        if len(coeffs) == 1:\n            c0 = coeffs[0]\n            c1 = 0\n        elif len(coeffs) == 2:\n            c0 = coeffs[0]\n            c1 = coeffs[1]\n        else:\n            nd = len(coeffs)\n            c0 = coeffs[-2]\n            c1 = coeffs[-1]\n            for i in range(3, len(coeffs) + 1):\n                tmp = c0\n                nd = nd - 1\n                c0 = coeffs[-i] - (c1 * (nd - 1)) / nd\n                c1 = tmp + (c1 * x * (2 * nd - 1)) / nd\n        return c0 + c1 * x\n\n\nclass Polynomial1D(_PolyDomainWindow1D):\n    r\"\"\"\n    1D Polynomial model.\n\n    It is defined as:\n\n    .. math::\n\n        P = \\sum_{i=0}^{i=n}C_{i} * x^{i}\n\n    For explanation of ``domain``, and ``window`` see\n    :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : tuple or None, optional\n        If None, it is set to (-1, 1)\n    window : tuple or None, optional\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n\n    \"\"\"\n\n    n_inputs = 1\n    n_outputs = 1\n\n    _separable = True\n\n    def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            degree, domain, window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)\n\n        # Set domain separately because it's different from\n        # the orthogonal polynomials.\n        self._default_domain_window = {'domain': (-1, 1),\n                                       'window': (-1, 1),\n                                       }\n        self.domain = domain or self._default_domain_window['domain']\n        self.window = window or self._default_domain_window['window']\n\n    def prepare_inputs(self, x, **kwargs):\n        inputs, broadcasted_shapes = super().prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n        return (x,), broadcasted_shapes\n\n    def evaluate(self, x, *coeffs):\n        if self.domain is not None:\n            x = poly_map_domain(x, self.domain, self.window)\n        return self.horner(x, coeffs)\n\n    def fit_deriv(self, x, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        v = np.empty((self.degree + 1,) + x.shape, dtype=float)\n        v[0] = 1\n        if self.degree > 0:\n            v[1] = x\n            for i in range(2, self.degree + 1):\n                v[i] = v[i - 1] * x\n        return np.rollaxis(v, 0, v.ndim)\n\n    @staticmethod\n    def horner(x, coeffs):\n        if len(coeffs) == 1:\n            c0 = coeffs[-1] * np.ones_like(x, subok=False)\n        else:\n            c0 = coeffs[-1]\n            for i in range(2, len(coeffs) + 1):\n                c0 = coeffs[-i] + c0 * x\n        return c0\n\n    @property\n    def input_units(self):\n        if self.degree == 0 or self.c1.unit is None:\n            return None\n        else:\n            return {self.inputs[0]: self.c0.unit / self.c1.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        mapping = {}\n        for i in range(self.degree + 1):\n            par = getattr(self, f'c{i}')\n            mapping[par.name] = outputs_unit[self.outputs[0]] / inputs_unit[self.inputs[0]] ** i\n        return mapping\n\n\nclass Polynomial2D(PolynomialModel):\n    r\"\"\"\n    2D Polynomial  model.\n\n    Represents a general polynomial of degree n:\n\n    .. math::\n\n        P(x,y) = c_{00} + c_{10}x + ...+ c_{n0}x^n + c_{01}y + ...+ c_{0n}y^n\n        + c_{11}xy + c_{12}xy^2 + ... + c_{1(n-1)}xy^{n-1}+ ... + c_{(n-1)1}x^{n-1}y\n\n    For explanation of ``x_domain``, ``y_domain``, ``x_window`` and ``y_window``\n    see :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n    degree : int\n        Polynomial degree: largest sum of exponents (:math:`i + j`) of\n        variables in each monomial term of the form :math:`x^i y^j`. The\n        number of terms in a 2D polynomial of degree ``n`` is given by binomial\n        coefficient :math:`C(n + 2, 2) = (n + 2)! / (2!\\,n!) = (n + 1)(n + 2) / 2`.\n    x_domain : tuple or None, optional\n        domain of the x independent variable\n        If None, it is set to (-1, 1)\n    y_domain : tuple or None, optional\n        domain of the y independent variable\n        If None, it is set to (-1, 1)\n    x_window : tuple or None, optional\n        range of the x independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the x_domain to x_window\n    y_window : tuple or None, optional\n        range of the y independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the y_domain to y_window\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n    \"\"\"\n\n    n_inputs = 2\n    n_outputs = 1\n\n    _separable = False\n\n    def __init__(self, degree, x_domain=None, y_domain=None,\n                 x_window=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            degree, n_models=n_models, model_set_axis=model_set_axis,\n            name=name, meta=meta, **params)\n\n        self._default_domain_window = {\n            'x_domain': (-1, 1),\n            'y_domain': (-1, 1),\n            'x_window': (-1, 1),\n            'y_window': (-1, 1)\n            }\n\n        self.x_domain = x_domain or self._default_domain_window['x_domain']\n        self.y_domain = y_domain or self._default_domain_window['y_domain']\n        self.x_window = x_window or self._default_domain_window['x_window']\n        self.y_window = y_window or self._default_domain_window['y_window']\n\n    def prepare_inputs(self, x, y, **kwargs):\n\n        inputs, broadcasted_shapes = super().prepare_inputs(x, y, **kwargs)\n\n        x, y = inputs\n        return (x, y), broadcasted_shapes\n\n    def evaluate(self, x, y, *coeffs):\n        if self.x_domain is not None:\n            x = poly_map_domain(x, self.x_domain, self.x_window)\n        if self.y_domain is not None:\n            y = poly_map_domain(y, self.y_domain, self.y_window)\n        invcoeff = self.invlex_coeff(coeffs)\n        result = self.multivariate_horner(x, y, invcoeff)\n\n        # Special case for degree==0 to ensure that the shape of the output is\n        # still as expected by the broadcasting rules, even though the x and y\n        # inputs are not used in the evaluation\n        if self.degree == 0:\n            output_shape = check_broadcast(np.shape(coeffs[0]), x.shape)\n            if output_shape:\n                new_result = np.empty(output_shape)\n                new_result[:] = result\n                result = new_result\n\n        return result\n\n    def __repr__(self):\n        return self._format_repr([self.degree],\n                                 kwargs={'x_domain': self.x_domain,\n                                         'y_domain': self.y_domain,\n                                         'x_window': self.x_window,\n                                         'y_window': self.y_window},\n                                 defaults=self._default_domain_window)\n\n    def __str__(self):\n        return self._format_str([('Degree', self.degree),\n                                 ('X_Domain', self.x_domain),\n                                 ('Y_Domain', self.y_domain),\n                                 ('X_Window', self.x_window),\n                                 ('Y_Window', self.y_window)],\n                                 self._default_domain_window)\n\n    def fit_deriv(self, x, y, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        y : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        if x.ndim == 2:\n            x = x.flatten()\n        if y.ndim == 2:\n            y = y.flatten()\n        if x.size != y.size:\n            raise ValueError('Expected x and y to be of equal size')\n\n        designx = x[:, None] ** np.arange(self.degree + 1)\n        designy = y[:, None] ** np.arange(1, self.degree + 1)\n\n        designmixed = []\n        for i in range(1, self.degree):\n            for j in range(1, self.degree):\n                if i + j <= self.degree:\n                    designmixed.append((x ** i) * (y ** j))\n        designmixed = np.array(designmixed).T\n        if designmixed.any():\n            v = np.hstack([designx, designy, designmixed])\n        else:\n            v = np.hstack([designx, designy])\n        return v\n\n    def invlex_coeff(self, coeffs):\n        invlex_coeffs = []\n        lencoeff = range(self.degree + 1)\n        for i in lencoeff:\n            for j in lencoeff:\n                if i + j <= self.degree:\n                    name = f'c{j}_{i}'\n                    coeff = coeffs[self.param_names.index(name)]\n                    invlex_coeffs.append(coeff)\n        return invlex_coeffs[::-1]\n\n    def multivariate_horner(self, x, y, coeffs):\n        \"\"\"\n        Multivariate Horner's scheme\n\n        Parameters\n        ----------\n        x, y : array\n        coeffs : array\n            Coefficients in inverse lexical order.\n        \"\"\"\n\n        alpha = self._invlex()\n        r0 = coeffs[0]\n        r1 = r0 * 0.0\n        r2 = r0 * 0.0\n        karr = np.diff(alpha, axis=0)\n\n        for n in range(len(karr)):\n            if karr[n, 1] != 0:\n                r2 = y * (r0 + r1 + r2)\n                r1 = np.zeros_like(coeffs[0], subok=False)\n            else:\n                r1 = x * (r0 + r1)\n            r0 = coeffs[n + 1]\n        return r0 + r1 + r2\n\n    @property\n    def input_units(self):\n        if self.degree == 0 or (self.c1_0.unit is None and self.c0_1.unit is None):\n            return None\n        return {self.inputs[0]: self.c0_0.unit / self.c1_0.unit,\n                self.inputs[1]: self.c0_0.unit / self.c0_1.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        mapping = {}\n        for i in range(self.degree + 1):\n            for j in range(self.degree + 1):\n                if i + j > 2:\n                    continue\n                par = getattr(self, f'c{i}_{j}')\n                mapping[par.name] = outputs_unit[self.outputs[0]] / inputs_unit[self.inputs[0]] ** i / inputs_unit[self.inputs[1]] ** j  # noqa\n        return mapping\n\n    @property\n    def x_domain(self):\n        return self._x_domain\n\n    @x_domain.setter\n    def x_domain(self, val):\n        self._x_domain = _validate_domain_window(val)\n\n    @property\n    def y_domain(self):\n        return self._y_domain\n\n    @y_domain.setter\n    def y_domain(self, val):\n        self._y_domain = _validate_domain_window(val)\n\n    @property\n    def x_window(self):\n        return self._x_window\n\n    @x_window.setter\n    def x_window(self, val):\n        self._x_window = _validate_domain_window(val)\n\n    @property\n    def y_window(self):\n        return self._y_window\n\n    @y_window.setter\n    def y_window(self, val):\n        self._y_window = _validate_domain_window(val)\n\n\nclass Chebyshev2D(OrthoPolynomialBase):\n    r\"\"\"\n    Bivariate Chebyshev series..\n\n    It is defined as\n\n    .. math:: P_{nm}(x,y) = \\sum_{n,m=0}^{n=d,m=d}C_{nm}  T_n(x ) T_m(y)\n\n    where ``T_n(x)`` and ``T_m(y)`` are Chebyshev polynomials of the first kind.\n\n    For explanation of ``x_domain``, ``y_domain``, ``x_window`` and ``y_window``\n    see :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : tuple or None, optional\n        domain of the x independent variable\n    y_domain : tuple or None, optional\n        domain of the y independent variable\n    x_window : tuple or None, optional\n        range of the x independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    y_window : tuple or None, optional\n        range of the y independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n\n    Notes\n    -----\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Chebyshev polynomials is a polynomial in x and/or y - since\n    the coefficients within each Chebyshev polynomial are fixed, we can't use\n    quantities for x and/or y since the units would not be compatible. For\n    example, the third Chebyshev polynomial (T2) is 2x^2-1, but if x was\n    specified with units, 2x^2 and -1 would have incompatible units.\n    \"\"\"\n    _separable = False\n\n    def __init__(self, x_degree, y_degree, x_domain=None, x_window=None,\n                 y_domain=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n\n        super().__init__(\n            x_degree, y_degree, x_domain=x_domain, y_domain=y_domain,\n            x_window=x_window, y_window=y_window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)\n\n    def _fcache(self, x, y):\n        \"\"\"\n        Calculate the individual Chebyshev functions once and store them in a\n        dictionary to be reused.\n        \"\"\"\n\n        x_terms = self.x_degree + 1\n        y_terms = self.y_degree + 1\n        kfunc = {}\n        kfunc[0] = np.ones(x.shape)\n        kfunc[1] = x.copy()\n        kfunc[x_terms] = np.ones(y.shape)\n        kfunc[x_terms + 1] = y.copy()\n        for n in range(2, x_terms):\n            kfunc[n] = 2 * x * kfunc[n - 1] - kfunc[n - 2]\n        for n in range(x_terms + 2, x_terms + y_terms):\n            kfunc[n] = 2 * y * kfunc[n - 1] - kfunc[n - 2]\n        return kfunc\n\n    def fit_deriv(self, x, y, *params):\n        \"\"\"\n        Derivatives with respect to the coefficients.\n\n        This is an array with Chebyshev polynomials:\n\n        .. math::\n\n            T_{x_0}T_{y_0}, T_{x_1}T_{y_0}...T_{x_n}T_{y_0}...T_{x_n}T_{y_m}\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        y : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        if x.shape != y.shape:\n            raise ValueError(\"x and y must have the same shape\")\n\n        x = x.flatten()\n        y = y.flatten()\n        x_deriv = self._chebderiv1d(x, self.x_degree + 1).T\n        y_deriv = self._chebderiv1d(y, self.y_degree + 1).T\n\n        ij = []\n        for i in range(self.y_degree + 1):\n            for j in range(self.x_degree + 1):\n                ij.append(x_deriv[j] * y_deriv[i])\n\n        v = np.array(ij)\n        return v.T\n\n    def _chebderiv1d(self, x, deg):\n        \"\"\"\n        Derivative of 1D Chebyshev series\n        \"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        d = np.empty((deg + 1, len(x)), dtype=x.dtype)\n        d[0] = x * 0 + 1\n        if deg > 0:\n            x2 = 2 * x\n            d[1] = x\n            for i in range(2, deg + 1):\n                d[i] = d[i - 1] * x2 - d[i - 2]\n        return np.rollaxis(d, 0, d.ndim)\n\n\nclass Legendre2D(OrthoPolynomialBase):\n    r\"\"\"\n    Bivariate Legendre series.\n\n    Defined as:\n\n    .. math:: P_{n_m}(x,y) = \\sum_{n,m=0}^{n=d,m=d}C_{nm}  L_n(x ) L_m(y)\n\n    where ``L_n(x)`` and ``L_m(y)`` are Legendre polynomials.\n\n    For explanation of ``x_domain``, ``y_domain``, ``x_window`` and ``y_window``\n    see :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : tuple or None, optional\n        domain of the x independent variable\n    y_domain : tuple or None, optional\n        domain of the y independent variable\n    x_window : tuple or None, optional\n        range of the x independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    y_window : tuple or None, optional\n        range of the y independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        P(x) = \\sum_{i=0}^{i=n}C_{i} * L_{i}(x)\n\n    where ``L_{i}`` is the corresponding Legendre polynomial.\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Legendre polynomials is a polynomial in x - since the\n    coefficients within each Legendre polynomial are fixed, we can't use\n    quantities for x since the units would not be compatible. For example, the\n    third Legendre polynomial (P2) is 1.5x^2-0.5, but if x was specified with\n    units, 1.5x^2 and -0.5 would have incompatible units.\n    \"\"\"\n    _separable = False\n\n    def __init__(self, x_degree, y_degree, x_domain=None, x_window=None,\n                 y_domain=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n\n        super().__init__(\n            x_degree, y_degree, x_domain=x_domain, y_domain=y_domain,\n            x_window=x_window, y_window=y_window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)\n\n    def _fcache(self, x, y):\n        \"\"\"\n        Calculate the individual Legendre functions once and store them in a\n        dictionary to be reused.\n        \"\"\"\n\n        x_terms = self.x_degree + 1\n        y_terms = self.y_degree + 1\n        kfunc = {}\n        kfunc[0] = np.ones(x.shape)\n        kfunc[1] = x.copy()\n        kfunc[x_terms] = np.ones(y.shape)\n        kfunc[x_terms + 1] = y.copy()\n        for n in range(2, x_terms):\n            kfunc[n] = (((2 * (n - 1) + 1) * x * kfunc[n - 1] -\n                         (n - 1) * kfunc[n - 2]) / n)\n        for n in range(2, y_terms):\n            kfunc[n + x_terms] = ((2 * (n - 1) + 1) * y * kfunc[n + x_terms - 1] -\n                                  (n - 1) * kfunc[n + x_terms - 2]) / (n)\n        return kfunc\n\n    def fit_deriv(self, x, y, *params):\n        \"\"\"\n        Derivatives with respect to the coefficients.\n        This is an array with Legendre polynomials:\n\n        Lx0Ly0  Lx1Ly0...LxnLy0...LxnLym\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        y : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n        if x.shape != y.shape:\n            raise ValueError(\"x and y must have the same shape\")\n        x = x.flatten()\n        y = y.flatten()\n        x_deriv = self._legendderiv1d(x, self.x_degree + 1).T\n        y_deriv = self._legendderiv1d(y, self.y_degree + 1).T\n\n        ij = []\n        for i in range(self.y_degree + 1):\n            for j in range(self.x_degree + 1):\n                ij.append(x_deriv[j] * y_deriv[i])\n\n        v = np.array(ij)\n        return v.T\n\n    def _legendderiv1d(self, x, deg):\n        \"\"\"Derivative of 1D Legendre polynomial\"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        d = np.empty((deg + 1,) + x.shape, dtype=x.dtype)\n        d[0] = x * 0 + 1\n        if deg > 0:\n            d[1] = x\n            for i in range(2, deg + 1):\n                d[i] = (d[i - 1] * x * (2 * i - 1) - d[i - 2] * (i - 1)) / i\n        return np.rollaxis(d, 0, d.ndim)\n\n\nclass _SIP1D(PolynomialBase):\n    \"\"\"\n    This implements the Simple Imaging Polynomial Model (SIP) in 1D.\n\n    It's unlikely it will be used in 1D so this class is private\n    and SIP should be used instead.\n    \"\"\"\n\n    n_inputs = 2\n    n_outputs = 1\n\n    _separable = False\n\n    def __init__(self, order, coeff_prefix, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.order = order\n        self.coeff_prefix = coeff_prefix\n        self._param_names = self._generate_coeff_names(coeff_prefix)\n\n        if n_models:\n            if model_set_axis is None:\n                model_set_axis = 0\n            minshape = (1,) * model_set_axis + (n_models,)\n        else:\n            minshape = ()\n        for param_name in self._param_names:\n            self._parameters_[param_name] = \\\n                Parameter(param_name, default=np.zeros(minshape))\n        super().__init__(n_models=n_models, model_set_axis=model_set_axis,\n                         name=name, meta=meta, **params)\n\n    def __repr__(self):\n        return self._format_repr(args=[self.order, self.coeff_prefix])\n\n    def __str__(self):\n        return self._format_str(\n            [('Order', self.order),\n             ('Coeff. Prefix', self.coeff_prefix)])\n\n    def evaluate(self, x, y, *coeffs):\n        # TODO: Rewrite this so that it uses a simpler method of determining\n        # the matrix based on the number of given coefficients.\n        mcoef = self._coeff_matrix(self.coeff_prefix, coeffs)\n        return self._eval_sip(x, y, mcoef)\n\n    def get_num_coeff(self, ndim):\n        \"\"\"\n        Return the number of coefficients in one param set\n        \"\"\"\n\n        if self.order < 2 or self.order > 9:\n            raise ValueError(\"Degree of polynomial must be 2< deg < 9\")\n\n        nmixed = comb(self.order, ndim)\n        # remove 3 terms because SIP deg >= 2\n        numc = self.order * ndim + nmixed - 2\n        return numc\n\n    def _generate_coeff_names(self, coeff_prefix):\n        names = []\n        for i in range(2, self.order + 1):\n            names.append(f'{coeff_prefix}_{i}_{0}')\n        for i in range(2, self.order + 1):\n            names.append(f'{coeff_prefix}_{0}_{i}')\n        for i in range(1, self.order):\n            for j in range(1, self.order):\n                if i + j < self.order + 1:\n                    names.append(f'{coeff_prefix}_{i}_{j}')\n        return tuple(names)\n\n    def _coeff_matrix(self, coeff_prefix, coeffs):\n        mat = np.zeros((self.order + 1, self.order + 1))\n        for i in range(2, self.order + 1):\n            attr = f'{coeff_prefix}_{i}_{0}'\n            mat[i, 0] = coeffs[self.param_names.index(attr)]\n        for i in range(2, self.order + 1):\n            attr = f'{coeff_prefix}_{0}_{i}'\n            mat[0, i] = coeffs[self.param_names.index(attr)]\n        for i in range(1, self.order):\n            for j in range(1, self.order):\n                if i + j < self.order + 1:\n                    attr = f'{coeff_prefix}_{i}_{j}'\n                    mat[i, j] = coeffs[self.param_names.index(attr)]\n        return mat\n\n    def _eval_sip(self, x, y, coef):\n        x = np.asarray(x, dtype=np.float64)\n        y = np.asarray(y, dtype=np.float64)\n        if self.coeff_prefix == 'A':\n            result = np.zeros(x.shape)\n        else:\n            result = np.zeros(y.shape)\n\n        for i in range(coef.shape[0]):\n            for j in range(coef.shape[1]):\n                if 1 < i + j < self.order + 1:\n                    result = result + coef[i, j] * x ** i * y ** j\n        return result\n\n\nclass SIP(Model):\n    \"\"\"\n    Simple Imaging Polynomial (SIP) model.\n\n    The SIP convention is used to represent distortions in FITS image headers.\n    See [1]_ for a description of the SIP convention.\n\n    Parameters\n    ----------\n    crpix : list or (2,) ndarray\n        CRPIX values\n    a_order : int\n        SIP polynomial order for first axis\n    b_order : int\n        SIP order for second axis\n    a_coeff : dict\n        SIP coefficients for first axis\n    b_coeff : dict\n        SIP coefficients for the second axis\n    ap_order : int\n        order for the inverse transformation (AP coefficients)\n    bp_order : int\n        order for the inverse transformation (BP coefficients)\n    ap_coeff : dict\n        coefficients for the inverse transform\n    bp_coeff : dict\n        coefficients for the inverse transform\n\n    References\n    ----------\n    .. [1] `David Shupe, et al, ADASS, ASP Conference Series, Vol. 347, 2005 <https://ui.adsabs.harvard.edu/abs/2005ASPC..347..491S>`_\n    \"\"\"\n\n    n_inputs = 2\n    n_outputs = 2\n\n    _separable = False\n\n    def __init__(self, crpix, a_order, b_order, a_coeff={}, b_coeff={},\n                 ap_order=None, bp_order=None, ap_coeff={}, bp_coeff={},\n                 n_models=None, model_set_axis=None, name=None, meta=None):\n        self._crpix = crpix\n        self._a_order = a_order\n        self._b_order = b_order\n        self._a_coeff = a_coeff\n        self._b_coeff = b_coeff\n        self._ap_order = ap_order\n        self._bp_order = bp_order\n        self._ap_coeff = ap_coeff\n        self._bp_coeff = bp_coeff\n        self.shift_a = Shift(-crpix[0])\n        self.shift_b = Shift(-crpix[1])\n        self.sip1d_a = _SIP1D(a_order, coeff_prefix='A', n_models=n_models,\n                              model_set_axis=model_set_axis, **a_coeff)\n        self.sip1d_b = _SIP1D(b_order, coeff_prefix='B', n_models=n_models,\n                              model_set_axis=model_set_axis, **b_coeff)\n        super().__init__(n_models=n_models, model_set_axis=model_set_axis,\n                         name=name, meta=meta)\n        self._inputs = (\"u\", \"v\")\n        self._outputs = (\"x\", \"y\")\n\n    def __repr__(self):\n        return '<{}({!r})>'.format(self.__class__.__name__,\n                                   [self.shift_a, self.shift_b, self.sip1d_a, self.sip1d_b])\n\n    def __str__(self):\n        parts = [f'Model: {self.__class__.__name__}']\n        for model in [self.shift_a, self.shift_b, self.sip1d_a, self.sip1d_b]:\n            parts.append(indent(str(model), width=4))\n            parts.append('')\n\n        return '\\n'.join(parts)\n\n    @property\n    def inverse(self):\n        if (self._ap_order is not None and self._bp_order is not None):\n            return InverseSIP(self._ap_order, self._bp_order,\n                              self._ap_coeff, self._bp_coeff)\n        else:\n            raise NotImplementedError(\"SIP inverse coefficients are not available.\")\n\n    def evaluate(self, x, y):\n        u = self.shift_a.evaluate(x, *self.shift_a.param_sets)\n        v = self.shift_b.evaluate(y, *self.shift_b.param_sets)\n        f = self.sip1d_a.evaluate(u, v, *self.sip1d_a.param_sets)\n        g = self.sip1d_b.evaluate(u, v, *self.sip1d_b.param_sets)\n        return f, g\n\n\nclass InverseSIP(Model):\n    \"\"\"\n    Inverse Simple Imaging Polynomial\n\n    Parameters\n    ----------\n    ap_order : int\n        order for the inverse transformation (AP coefficients)\n    bp_order : int\n        order for the inverse transformation (BP coefficients)\n    ap_coeff : dict\n        coefficients for the inverse transform\n    bp_coeff : dict\n        coefficients for the inverse transform\n\n    \"\"\"\n\n    n_inputs = 2\n    n_outputs = 2\n\n    _separable = False\n\n    def __init__(self, ap_order, bp_order, ap_coeff={}, bp_coeff={},\n                 n_models=None, model_set_axis=None, name=None, meta=None):\n        self._ap_order = ap_order\n        self._bp_order = bp_order\n        self._ap_coeff = ap_coeff\n        self._bp_coeff = bp_coeff\n\n        # define the 0th term in order to use Polynomial2D\n        ap_coeff.setdefault('AP_0_0', 0)\n        bp_coeff.setdefault('BP_0_0', 0)\n\n        ap_coeff_params = dict((k.replace('AP_', 'c'), v)\n                               for k, v in ap_coeff.items())\n        bp_coeff_params = dict((k.replace('BP_', 'c'), v)\n                               for k, v in bp_coeff.items())\n\n        self.sip1d_ap = Polynomial2D(degree=ap_order,\n                                     model_set_axis=model_set_axis,\n                                     **ap_coeff_params)\n        self.sip1d_bp = Polynomial2D(degree=bp_order,\n                                     model_set_axis=model_set_axis,\n                                     **bp_coeff_params)\n        super().__init__(n_models=n_models, model_set_axis=model_set_axis,\n                         name=name, meta=meta)\n\n    def __repr__(self):\n        return f'<{self.__class__.__name__}({[self.sip1d_ap, self.sip1d_bp]!r})>'\n\n    def __str__(self):\n        parts = [f'Model: {self.__class__.__name__}']\n        for model in [self.sip1d_ap, self.sip1d_bp]:\n            parts.append(indent(str(model), width=4))\n            parts.append('')\n\n        return '\\n'.join(parts)\n\n    def evaluate(self, x, y):\n        x1 = self.sip1d_ap.evaluate(x, y, *self.sip1d_ap.param_sets)\n        y1 = self.sip1d_bp.evaluate(x, y, *self.sip1d_bp.param_sets)\n        return x1, y1\n"},{"fileName":"projections.py","filePath":"astropy/modeling","id":12908,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n# pylint: disable=invalid-name\n\"\"\"\nImplements projections--particularly sky projections defined in WCS Paper II\n[1]_.\n\nAll angles are set and and displayed in degrees but internally computations are\nperformed in radians. All functions expect inputs and outputs degrees.\n\nReferences\n----------\n.. [1] Calabretta, M.R., Greisen, E.W., 2002, A&A, 395, 1077 (Paper II)\n\"\"\"\n\n\nimport abc\nfrom itertools import chain, product\n\nimport numpy as np\n\nfrom astropy import units as u\nfrom astropy import wcs\n\nfrom .core import Model\nfrom .parameters import Parameter, InputParameterError\nfrom .utils import _to_radian, _to_orig_unit\n\n\n# List of tuples of the form\n# (long class name without suffix, short WCSLIB projection code):\n_PROJ_NAME_CODE = [\n    ('ZenithalPerspective', 'AZP'),\n    ('SlantZenithalPerspective', 'SZP'),\n    ('Gnomonic', 'TAN'),\n    ('Stereographic', 'STG'),\n    ('SlantOrthographic', 'SIN'),\n    ('ZenithalEquidistant', 'ARC'),\n    ('ZenithalEqualArea', 'ZEA'),\n    ('Airy', 'AIR'),\n    ('CylindricalPerspective', 'CYP'),\n    ('CylindricalEqualArea', 'CEA'),\n    ('PlateCarree', 'CAR'),\n    ('Mercator', 'MER'),\n    ('SansonFlamsteed', 'SFL'),\n    ('Parabolic', 'PAR'),\n    ('Molleweide', 'MOL'),\n    ('HammerAitoff', 'AIT'),\n    ('ConicPerspective', 'COP'),\n    ('ConicEqualArea', 'COE'),\n    ('ConicEquidistant', 'COD'),\n    ('ConicOrthomorphic', 'COO'),\n    ('BonneEqualArea', 'BON'),\n    ('Polyconic', 'PCO'),\n    ('TangentialSphericalCube', 'TSC'),\n    ('COBEQuadSphericalCube', 'CSC'),\n    ('QuadSphericalCube', 'QSC'),\n    ('HEALPix', 'HPX'),\n    ('HEALPixPolar', 'XPH'),\n]\n\n_NOT_SUPPORTED_PROJ_CODES = ['ZPN']\n\n_PROJ_NAME_CODE_MAP = dict(_PROJ_NAME_CODE)\n\nprojcodes = [code for _, code in _PROJ_NAME_CODE]\n\n\n__all__ = [\n    'Projection', 'Pix2SkyProjection', 'Sky2PixProjection', 'Zenithal',\n    'Cylindrical', 'PseudoCylindrical', 'Conic', 'PseudoConic', 'QuadCube',\n    'HEALPix', 'AffineTransformation2D', 'projcodes'\n] + list(map('_'.join, product(['Pix2Sky', 'Sky2Pix'], chain(*_PROJ_NAME_CODE))))\n\n\nclass _ParameterDS(Parameter):\n    \"\"\"\n    Same as `Parameter` but can indicate its modified status via the ``dirty``\n    property. This flag also gets set automatically when a parameter is\n    modified.\n\n    This ability to track parameter's modified status is needed for automatic\n    update of WCSLIB's prjprm structure (which may be a more-time intensive\n    operation) *only as required*.\n\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.dirty = True\n\n    def validate(self, value):\n        super().validate(value)\n        self.dirty = True\n\n\nclass Projection(Model):\n    \"\"\"Base class for all sky projections.\"\"\"\n\n    # Radius of the generating sphere.\n    # This sets the circumference to 360 deg so that arc length is measured in deg.\n    r0 = 180 * u.deg / np.pi\n\n    _separable = False\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        self._prj = wcs.Prjprm()\n\n    @property\n    @abc.abstractmethod\n    def inverse(self):\n        \"\"\"\n        Inverse projection--all projection models must provide an inverse.\n        \"\"\"\n\n    @property\n    def prjprm(self):\n        \"\"\" WCSLIB ``prjprm`` structure. \"\"\"\n        self._update_prj()\n        return self._prj\n\n    def _update_prj(self):\n        \"\"\"\n        A default updater for projection's pv.\n\n        .. warning::\n            This method assumes that PV0 is never modified. If a projection\n            that uses PV0 is ever implemented in this module, that projection\n            class should override this method.\n\n        .. warning::\n            This method assumes that the order in which PVi values (i>0)\n            are to be asigned is identical to the order of model parameters\n            in ``param_names``. That is, pv[1] = model.parameters[0], ...\n\n        \"\"\"\n        if not self.param_names:\n            return\n\n        pv = []\n        dirty = False\n\n        for p in self.param_names:\n            param = getattr(self, p)\n            pv.append(float(param.value))\n            dirty |= param.dirty\n            param.dirty = False\n\n        if dirty:\n            self._prj.pv = None, *pv\n            self._prj.set()\n\n\nclass Pix2SkyProjection(Projection):\n    \"\"\"Base class for all Pix2Sky projections.\"\"\"\n\n    n_inputs = 2\n    n_outputs = 2\n\n    _input_units_strict = True\n    _input_units_allow_dimensionless = True\n\n    def __new__(cls, *args, **kwargs):\n        long_name = cls.name.split('_')[1]\n        cls.prj_code = _PROJ_NAME_CODE_MAP[long_name]\n        return super(Pix2SkyProjection, cls).__new__(cls)\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n        self._prj.code = self.prj_code\n        self._update_prj()\n        if not self.param_names:\n            # force initial call to Prjprm.set() for projections\n            # with no parameters:\n            self._prj.set()\n\n        self.inputs = ('x', 'y')\n        self.outputs = ('phi', 'theta')\n\n    @property\n    def input_units(self):\n        return {self.inputs[0]: u.deg,\n                self.inputs[1]: u.deg}\n\n    @property\n    def return_units(self):\n        return {self.outputs[0]: u.deg,\n                self.outputs[1]: u.deg}\n\n    def evaluate(self, x, y, *args, **kwargs):\n        self._update_prj()\n        return self._prj.prjx2s(x, y)\n\n    @property\n    def inverse(self):\n        pv = [getattr(self, param).value for param in self.param_names]\n        return self._inv_cls(*pv)\n\n\nclass Sky2PixProjection(Projection):\n    \"\"\"Base class for all Sky2Pix projections.\"\"\"\n\n    n_inputs = 2\n    n_outputs = 2\n\n    _input_units_strict = True\n    _input_units_allow_dimensionless = True\n\n    def __new__(cls, *args, **kwargs):\n        long_name = cls.name.split('_')[1]\n        cls.prj_code = _PROJ_NAME_CODE_MAP[long_name]\n        return super(Sky2PixProjection, cls).__new__(cls)\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n        self._prj.code = self.prj_code\n        self._update_prj()\n        if not self.param_names:\n            # force initial call to Prjprm.set() for projections\n            # without parameters:\n            self._prj.set()\n\n        self.inputs = ('phi', 'theta')\n        self.outputs = ('x', 'y')\n\n    @property\n    def input_units(self):\n        return {self.inputs[0]: u.deg,\n                self.inputs[1]: u.deg}\n\n    @property\n    def return_units(self):\n        return {self.outputs[0]: u.deg,\n                self.outputs[1]: u.deg}\n\n    def evaluate(self, phi, theta, *args, **kwargs):\n        self._update_prj()\n        return self._prj.prjs2x(phi, theta)\n\n    @property\n    def inverse(self):\n        pv = [getattr(self, param).value for param in self.param_names]\n        return self._inv_cls(*pv)\n\n\nclass Zenithal(Projection):\n    r\"\"\"Base class for all Zenithal projections.\n\n    Zenithal (or azimuthal) projections map the sphere directly onto a\n    plane.  All zenithal projections are specified by defining the\n    radius as a function of native latitude, :math:`R_\\theta`.\n\n    The pixel-to-sky transformation is defined as:\n\n    .. math::\n        \\phi &= \\arg(-y, x) \\\\\n        R_\\theta &= \\sqrt{x^2 + y^2}\n\n    and the inverse (sky-to-pixel) is defined as:\n\n    .. math::\n        x &= R_\\theta \\sin \\phi \\\\\n        y &= R_\\theta \\cos \\phi\n    \"\"\"\n\n\nclass Pix2Sky_ZenithalPerspective(Pix2SkyProjection, Zenithal):\n    r\"\"\"\n    Zenithal perspective projection - pixel to sky.\n\n    Corresponds to the ``AZP`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= \\arg(-y \\cos \\gamma, x) \\\\\n        \\theta &= \\left\\{\\genfrac{}{}{0pt}{}{\\psi - \\omega}{\\psi + \\omega + 180^{\\circ}}\\right.\n\n    where:\n\n    .. math::\n        \\psi &= \\arg(\\rho, 1) \\\\\n        \\omega &= \\sin^{-1}\\left(\\frac{\\rho \\mu}{\\sqrt{\\rho^2 + 1}}\\right) \\\\\n        \\rho &= \\frac{R}{\\frac{180^{\\circ}}{\\pi}(\\mu + 1) + y \\sin \\gamma} \\\\\n        R &= \\sqrt{x^2 + y^2 \\cos^2 \\gamma}\n\n    Parameters\n    ----------\n    mu : float\n        Distance from point of projection to center of sphere\n        in spherical radii, μ.  Default is 0.\n\n    gamma : float\n        Look angle γ in degrees.  Default is 0°.\n\n    \"\"\"\n    mu = _ParameterDS(\n        default=0.0, description=\"Distance from point of projection to center of sphere\"\n    )\n    gamma = _ParameterDS(default=0.0, getter=_to_orig_unit, setter=_to_radian,\n                         description=\"Look angle γ in degrees (Default = 0°)\")\n\n    @mu.validator\n    def mu(self, value):\n        if np.any(np.equal(value, -1.0)):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")\n\n\nclass Sky2Pix_ZenithalPerspective(Sky2PixProjection, Zenithal):\n    r\"\"\"\n    Zenithal perspective projection - sky to pixel.\n\n    Corresponds to the ``AZP`` projection in FITS WCS.\n\n    .. math::\n        x &= R \\sin \\phi \\\\\n        y &= -R \\sec \\gamma \\cos \\theta\n\n    where:\n\n    .. math::\n        R = \\frac{180^{\\circ}}{\\pi} \\frac{(\\mu + 1) \\cos \\theta}{(\\mu + \\sin \\theta) + \\cos \\theta \\cos \\phi \\tan \\gamma}\n\n    Parameters\n    ----------\n    mu : float\n        Distance from point of projection to center of sphere\n        in spherical radii, μ. Default is 0.\n\n    gamma : float\n        Look angle γ in degrees. Default is 0°.\n\n    \"\"\"\n    mu = _ParameterDS(\n        default=0.0,\n        description=\"Distance from point of projection to center of sphere\"\n    )\n    gamma = _ParameterDS(default=0.0, getter=_to_orig_unit, setter=_to_radian,\n                         description=\"Look angle γ in degrees (Default=0°)\")\n\n    @mu.validator\n    def mu(self, value):\n        if np.any(np.equal(value, -1.0)):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")\n\n\nclass Pix2Sky_SlantZenithalPerspective(Pix2SkyProjection, Zenithal):\n    r\"\"\"\n    Slant zenithal perspective projection - pixel to sky.\n\n    Corresponds to the ``SZP`` projection in FITS WCS.\n\n    Parameters\n    ----------\n    mu : float\n        Distance from point of projection to center of sphere\n        in spherical radii, μ.  Default is 0.\n\n    phi0 : float\n        The longitude φ₀ of the reference point, in degrees.  Default\n        is 0°.\n\n    theta0 : float\n        The latitude θ₀ of the reference point, in degrees.  Default\n        is 90°.\n\n    \"\"\"\n    mu = _ParameterDS(\n        default=0.0,\n        description=\"Distance from point of projection to center of sphere\"\n    )\n    phi0 = _ParameterDS(\n        default=0.0, getter=_to_orig_unit, setter=_to_radian,\n        description=\"The longitude φ₀ of the reference point in degrees (Default=0°)\"\n    )\n    theta0 = _ParameterDS(\n        default=90.0, getter=_to_orig_unit, setter=_to_radian,\n        description=\"The latitude θ₀ of the reference point, in degrees (Default=0°)\"\n    )\n\n    @mu.validator\n    def mu(self, value):\n        if np.any(np.equal(value, -1.0)):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")\n\n\nclass Sky2Pix_SlantZenithalPerspective(Sky2PixProjection, Zenithal):\n    r\"\"\"\n    Zenithal perspective projection - sky to pixel.\n\n    Corresponds to the ``SZP`` projection in FITS WCS.\n\n    Parameters\n    ----------\n    mu : float\n        distance from point of projection to center of sphere\n        in spherical radii, μ.  Default is 0.\n\n    phi0 : float\n        The longitude φ₀ of the reference point, in degrees.  Default\n        is 0°.\n\n    theta0 : float\n        The latitude θ₀ of the reference point, in degrees.  Default\n        is 90°.\n\n    \"\"\"\n    mu = _ParameterDS(\n        default=0.0, description=\"Distance from point of projection to center of sphere\"\n    )\n    phi0 = _ParameterDS(\n        default=0.0, getter=_to_orig_unit, setter=_to_radian,\n        description=\"The longitude φ₀ of the reference point in degrees\"\n    )\n    theta0 = _ParameterDS(\n        default=0.0, getter=_to_orig_unit, setter=_to_radian,\n        description=\"The latitude θ₀ of the reference point, in degrees\"\n    )\n\n    @mu.validator\n    def mu(self, value):\n        if np.any(np.equal(value, -1.0)):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")\n\n\nclass Pix2Sky_Gnomonic(Pix2SkyProjection, Zenithal):\n    r\"\"\"\n    Gnomonic projection - pixel to sky.\n\n    Corresponds to the ``TAN`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        \\theta = \\tan^{-1}\\left(\\frac{180^{\\circ}}{\\pi R_\\theta}\\right)\n    \"\"\"\n\n\nclass Sky2Pix_Gnomonic(Sky2PixProjection, Zenithal):\n    r\"\"\"\n    Gnomonic Projection - sky to pixel.\n\n    Corresponds to the ``TAN`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        R_\\theta = \\frac{180^{\\circ}}{\\pi}\\cot \\theta\n    \"\"\"\n\n\nclass Pix2Sky_Stereographic(Pix2SkyProjection, Zenithal):\n    r\"\"\"\n    Stereographic Projection - pixel to sky.\n\n    Corresponds to the ``STG`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        \\theta = 90^{\\circ} - 2 \\tan^{-1}\\left(\\frac{\\pi R_\\theta}{360^{\\circ}}\\right)\n    \"\"\"\n\n\nclass Sky2Pix_Stereographic(Sky2PixProjection, Zenithal):\n    r\"\"\"\n    Stereographic Projection - sky to pixel.\n\n    Corresponds to the ``STG`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        R_\\theta = \\frac{180^{\\circ}}{\\pi}\\frac{2 \\cos \\theta}{1 + \\sin \\theta}\n    \"\"\"\n\n\nclass Pix2Sky_SlantOrthographic(Pix2SkyProjection, Zenithal):\n    r\"\"\"\n    Slant orthographic projection - pixel to sky.\n\n    Corresponds to the ``SIN`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    The following transformation applies when :math:`\\xi` and\n    :math:`\\eta` are both zero.\n\n    .. math::\n        \\theta = \\cos^{-1}\\left(\\frac{\\pi}{180^{\\circ}}R_\\theta\\right)\n\n    The parameters :math:`\\xi` and :math:`\\eta` are defined from the\n    reference point :math:`(\\phi_c, \\theta_c)` as:\n\n    .. math::\n        \\xi &= \\cot \\theta_c \\sin \\phi_c \\\\\n        \\eta &= - \\cot \\theta_c \\cos \\phi_c\n\n    Parameters\n    ----------\n    xi : float\n        Obliqueness parameter, ξ.  Default is 0.0.\n\n    eta : float\n        Obliqueness parameter, η.  Default is 0.0.\n\n    \"\"\"\n    xi = _ParameterDS(default=0.0, description=\"Obliqueness parameter\")\n    eta = _ParameterDS(default=0.0, description=\"Obliqueness parameter\")\n\n\nclass Sky2Pix_SlantOrthographic(Sky2PixProjection, Zenithal):\n    r\"\"\"\n    Slant orthographic projection - sky to pixel.\n\n    Corresponds to the ``SIN`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    The following transformation applies when :math:`\\xi` and\n    :math:`\\eta` are both zero.\n\n    .. math::\n        R_\\theta = \\frac{180^{\\circ}}{\\pi}\\cos \\theta\n\n    But more specifically are:\n\n    .. math::\n        x &= \\frac{180^\\circ}{\\pi}[\\cos \\theta \\sin \\phi + \\xi(1 - \\sin \\theta)] \\\\\n        y &= \\frac{180^\\circ}{\\pi}[\\cos \\theta \\cos \\phi + \\eta(1 - \\sin \\theta)]\n\n    \"\"\"\n    xi = _ParameterDS(default=0.0)\n    eta = _ParameterDS(default=0.0)\n\n\nclass Pix2Sky_ZenithalEquidistant(Pix2SkyProjection, Zenithal):\n    r\"\"\"\n    Zenithal equidistant projection - pixel to sky.\n\n    Corresponds to the ``ARC`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        \\theta = 90^\\circ - R_\\theta\n    \"\"\"\n\n\nclass Sky2Pix_ZenithalEquidistant(Sky2PixProjection, Zenithal):\n    r\"\"\"\n    Zenithal equidistant projection - sky to pixel.\n\n    Corresponds to the ``ARC`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        R_\\theta = 90^\\circ - \\theta\n    \"\"\"\n\n\nclass Pix2Sky_ZenithalEqualArea(Pix2SkyProjection, Zenithal):\n    r\"\"\"\n    Zenithal equidistant projection - pixel to sky.\n\n    Corresponds to the ``ZEA`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        \\theta = 90^\\circ - 2 \\sin^{-1} \\left(\\frac{\\pi R_\\theta}{360^\\circ}\\right)\n    \"\"\"\n\n\nclass Sky2Pix_ZenithalEqualArea(Sky2PixProjection, Zenithal):\n    r\"\"\"\n    Zenithal equidistant projection - sky to pixel.\n\n    Corresponds to the ``ZEA`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        R_\\theta &= \\frac{180^\\circ}{\\pi} \\sqrt{2(1 - \\sin\\theta)} \\\\\n                 &= \\frac{360^\\circ}{\\pi} \\sin\\left(\\frac{90^\\circ - \\theta}{2}\\right)\n    \"\"\"\n\n\nclass Pix2Sky_Airy(Pix2SkyProjection, Zenithal):\n    r\"\"\"\n    Airy projection - pixel to sky.\n\n    Corresponds to the ``AIR`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    Parameters\n    ----------\n    theta_b : float\n        The latitude :math:`\\theta_b` at which to minimize the error,\n        in degrees.  Default is 90°.\n    \"\"\"\n    theta_b = _ParameterDS(default=90.0)\n\n\nclass Sky2Pix_Airy(Sky2PixProjection, Zenithal):\n    r\"\"\"\n    Airy - sky to pixel.\n\n    Corresponds to the ``AIR`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        R_\\theta = -2 \\frac{180^\\circ}{\\pi}\\left(\\frac{\\ln(\\cos \\xi)}{\\tan \\xi} + \\frac{\\ln(\\cos \\xi_b)}{\\tan^2 \\xi_b} \\tan \\xi \\right)\n\n    where:\n\n    .. math::\n        \\xi &= \\frac{90^\\circ - \\theta}{2} \\\\\n        \\xi_b &= \\frac{90^\\circ - \\theta_b}{2}\n\n    Parameters\n    ----------\n    theta_b : float\n        The latitude :math:`\\theta_b` at which to minimize the error,\n        in degrees.  Default is 90°.\n\n    \"\"\"\n    theta_b = _ParameterDS(default=90.0, description=\"The latitude at which to minimize the error,in degrees\")\n\n\nclass Cylindrical(Projection):\n    r\"\"\"Base class for Cylindrical projections.\n\n    Cylindrical projections are so-named because the surface of\n    projection is a cylinder.\n    \"\"\"\n    _separable = True\n\n\nclass Pix2Sky_CylindricalPerspective(Pix2SkyProjection, Cylindrical):\n    r\"\"\"\n    Cylindrical perspective - pixel to sky.\n\n    Corresponds to the ``CYP`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= \\frac{x}{\\lambda} \\\\\n        \\theta &= \\arg(1, \\eta) + \\sin{-1}\\left(\\frac{\\eta \\mu}{\\sqrt{\\eta^2 + 1}}\\right)\n\n    where:\n\n    .. math::\n        \\eta = \\frac{\\pi}{180^{\\circ}}\\frac{y}{\\mu + \\lambda}\n\n    Parameters\n    ----------\n    mu : float\n        Distance from center of sphere in the direction opposite the\n        projected surface, in spherical radii, μ. Default is 1.\n\n    lam : float\n        Radius of the cylinder in spherical radii, λ. Default is 1.\n\n    \"\"\"\n    mu = _ParameterDS(default=1.0)\n    lam = _ParameterDS(default=1.0)\n\n    @mu.validator\n    def mu(self, value):\n        if np.any(value == -self.lam):\n            raise InputParameterError(\n                \"CYP projection is not defined for mu = -lambda\")\n\n    @lam.validator\n    def lam(self, value):\n        if np.any(value == -self.mu):\n            raise InputParameterError(\n                \"CYP projection is not defined for lambda = -mu\")\n\n\nclass Sky2Pix_CylindricalPerspective(Sky2PixProjection, Cylindrical):\n    r\"\"\"\n    Cylindrical Perspective - sky to pixel.\n\n    Corresponds to the ``CYP`` projection in FITS WCS.\n\n    .. math::\n        x &= \\lambda \\phi \\\\\n        y &= \\frac{180^{\\circ}}{\\pi}\\left(\\frac{\\mu + \\lambda}{\\mu + \\cos \\theta}\\right)\\sin \\theta\n\n    Parameters\n    ----------\n    mu : float\n        Distance from center of sphere in the direction opposite the\n        projected surface, in spherical radii, μ.  Default is 0.\n\n    lam : float\n        Radius of the cylinder in spherical radii, λ.  Default is 0.\n\n    \"\"\"\n    mu = _ParameterDS(default=1.0, description=\"Distance from center of sphere in spherical radii\")\n    lam = _ParameterDS(default=1.0, description=\"Radius of the cylinder in spherical radii\")\n\n    @mu.validator\n    def mu(self, value):\n        if np.any(value == -self.lam):\n            raise InputParameterError(\n                \"CYP projection is not defined for mu = -lambda\")\n\n    @lam.validator\n    def lam(self, value):\n        if np.any(value == -self.mu):\n            raise InputParameterError(\n                \"CYP projection is not defined for lambda = -mu\")\n\n\nclass Pix2Sky_CylindricalEqualArea(Pix2SkyProjection, Cylindrical):\n    r\"\"\"\n    Cylindrical equal area projection - pixel to sky.\n\n    Corresponds to the ``CEA`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= x \\\\\n        \\theta &= \\sin^{-1}\\left(\\frac{\\pi}{180^{\\circ}}\\lambda y\\right)\n\n    Parameters\n    ----------\n    lam : float\n        Radius of the cylinder in spherical radii, λ.  Default is 1.\n    \"\"\"\n    lam = _ParameterDS(default=1)\n\n\nclass Sky2Pix_CylindricalEqualArea(Sky2PixProjection, Cylindrical):\n    r\"\"\"\n    Cylindrical equal area projection - sky to pixel.\n\n    Corresponds to the ``CEA`` projection in FITS WCS.\n\n    .. math::\n        x &= \\phi \\\\\n        y &= \\frac{180^{\\circ}}{\\pi}\\frac{\\sin \\theta}{\\lambda}\n\n    Parameters\n    ----------\n    lam : float\n        Radius of the cylinder in spherical radii, λ.  Default is 0.\n    \"\"\"\n    lam = _ParameterDS(default=1)\n\n\nclass Pix2Sky_PlateCarree(Pix2SkyProjection, Cylindrical):\n    r\"\"\"\n    Plate carrée projection - pixel to sky.\n\n    Corresponds to the ``CAR`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= x \\\\\n        \\theta &= y\n    \"\"\"\n\n    @staticmethod\n    def evaluate(x, y):\n        # The intermediate variables are only used here for clarity\n        phi = np.array(x)\n        theta = np.array(y)\n        return phi, theta\n\n\nclass Sky2Pix_PlateCarree(Sky2PixProjection, Cylindrical):\n    r\"\"\"\n    Plate carrée projection - sky to pixel.\n\n    Corresponds to the ``CAR`` projection in FITS WCS.\n\n    .. math::\n        x &= \\phi \\\\\n        y &= \\theta\n    \"\"\"\n\n    @staticmethod\n    def evaluate(phi, theta):\n        # The intermediate variables are only used here for clarity\n        x = np.array(phi)\n        y = np.array(theta)\n        return x, y\n\n\nclass Pix2Sky_Mercator(Pix2SkyProjection, Cylindrical):\n    r\"\"\"\n    Mercator - pixel to sky.\n\n    Corresponds to the ``MER`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= x \\\\\n        \\theta &= 2 \\tan^{-1}\\left(e^{y \\pi / 180^{\\circ}}\\right)-90^{\\circ}\n    \"\"\"\n\n\nclass Sky2Pix_Mercator(Sky2PixProjection, Cylindrical):\n    r\"\"\"\n    Mercator - sky to pixel.\n\n    Corresponds to the ``MER`` projection in FITS WCS.\n\n    .. math::\n        x &= \\phi \\\\\n        y &= \\frac{180^{\\circ}}{\\pi}\\ln \\tan \\left(\\frac{90^{\\circ} + \\theta}{2}\\right)\n    \"\"\"\n\n\nclass PseudoCylindrical(Projection):\n    r\"\"\"Base class for pseudocylindrical projections.\n\n    Pseudocylindrical projections are like cylindrical projections\n    except the parallels of latitude are projected at diminishing\n    lengths toward the polar regions in order to reduce lateral\n    distortion there.  Consequently, the meridians are curved.\n    \"\"\"\n    _separable = True\n\n\nclass Pix2Sky_SansonFlamsteed(Pix2SkyProjection, PseudoCylindrical):\n    r\"\"\"\n    Sanson-Flamsteed projection - pixel to sky.\n\n    Corresponds to the ``SFL`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= \\frac{x}{\\cos y} \\\\\n        \\theta &= y\n    \"\"\"\n\n\nclass Sky2Pix_SansonFlamsteed(Sky2PixProjection, PseudoCylindrical):\n    r\"\"\"\n    Sanson-Flamsteed projection - sky to pixel.\n\n    Corresponds to the ``SFL`` projection in FITS WCS.\n\n    .. math::\n        x &= \\phi \\cos \\theta \\\\\n        y &= \\theta\n    \"\"\"\n\n\nclass Pix2Sky_Parabolic(Pix2SkyProjection, PseudoCylindrical):\n    r\"\"\"\n    Parabolic projection - pixel to sky.\n\n    Corresponds to the ``PAR`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= \\frac{180^\\circ}{\\pi} \\frac{x}{1 - 4(y / 180^\\circ)^2} \\\\\n        \\theta &= 3 \\sin^{-1}\\left(\\frac{y}{180^\\circ}\\right)\n    \"\"\"\n\n\nclass Sky2Pix_Parabolic(Sky2PixProjection, PseudoCylindrical):\n    r\"\"\"\n    Parabolic projection - sky to pixel.\n\n    Corresponds to the ``PAR`` projection in FITS WCS.\n\n    .. math::\n        x &= \\phi \\left(2\\cos\\frac{2\\theta}{3} - 1\\right) \\\\\n        y &= 180^\\circ \\sin \\frac{\\theta}{3}\n    \"\"\"\n\n\nclass Pix2Sky_Molleweide(Pix2SkyProjection, PseudoCylindrical):\n    r\"\"\"\n    Molleweide's projection - pixel to sky.\n\n    Corresponds to the ``MOL`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= \\frac{\\pi x}{2 \\sqrt{2 - \\left(\\frac{\\pi}{180^\\circ}y\\right)^2}} \\\\\n        \\theta &= \\sin^{-1}\\left(\\frac{1}{90^\\circ}\\sin^{-1}\\left(\\frac{\\pi}{180^\\circ}\\frac{y}{\\sqrt{2}}\\right) + \\frac{y}{180^\\circ}\\sqrt{2 - \\left(\\frac{\\pi}{180^\\circ}y\\right)^2}\\right)\n    \"\"\"\n\n\nclass Sky2Pix_Molleweide(Sky2PixProjection, PseudoCylindrical):\n    r\"\"\"\n    Molleweide's projection - sky to pixel.\n\n    Corresponds to the ``MOL`` projection in FITS WCS.\n\n    .. math::\n        x &= \\frac{2 \\sqrt{2}}{\\pi} \\phi \\cos \\gamma \\\\\n        y &= \\sqrt{2} \\frac{180^\\circ}{\\pi} \\sin \\gamma\n\n    where :math:`\\gamma` is defined as the solution of the\n    transcendental equation:\n\n    .. math::\n\n        \\sin \\theta = \\frac{\\gamma}{90^\\circ} + \\frac{\\sin 2 \\gamma}{\\pi}\n    \"\"\"\n\n\nclass Pix2Sky_HammerAitoff(Pix2SkyProjection, PseudoCylindrical):\n    r\"\"\"\n    Hammer-Aitoff projection - pixel to sky.\n\n    Corresponds to the ``AIT`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= 2 \\arg \\left(2Z^2 - 1, \\frac{\\pi}{180^\\circ} \\frac{Z}{2}x\\right) \\\\\n        \\theta &= \\sin^{-1}\\left(\\frac{\\pi}{180^\\circ}yZ\\right)\n    \"\"\"\n\n\nclass Sky2Pix_HammerAitoff(Sky2PixProjection, PseudoCylindrical):\n    r\"\"\"\n    Hammer-Aitoff projection - sky to pixel.\n\n    Corresponds to the ``AIT`` projection in FITS WCS.\n\n    .. math::\n        x &= 2 \\gamma \\cos \\theta \\sin \\frac{\\phi}{2} \\\\\n        y &= \\gamma \\sin \\theta\n\n    where:\n\n    .. math::\n        \\gamma = \\frac{180^\\circ}{\\pi} \\sqrt{\\frac{2}{1 + \\cos \\theta \\cos(\\phi / 2)}}\n    \"\"\"\n\n\nclass Conic(Projection):\n    r\"\"\"Base class for conic projections.\n\n    In conic projections, the sphere is thought to be projected onto\n    the surface of a cone which is then opened out.\n\n    In a general sense, the pixel-to-sky transformation is defined as:\n\n    .. math::\n\n        \\phi &= \\arg\\left(\\frac{Y_0 - y}{R_\\theta}, \\frac{x}{R_\\theta}\\right) / C \\\\\n        R_\\theta &= \\mathrm{sign} \\theta_a \\sqrt{x^2 + (Y_0 - y)^2}\n\n    and the inverse (sky-to-pixel) is defined as:\n\n    .. math::\n        x &= R_\\theta \\sin (C \\phi) \\\\\n        y &= R_\\theta \\cos (C \\phi) + Y_0\n\n    where :math:`C` is the \"constant of the cone\":\n\n    .. math::\n        C = \\frac{180^\\circ \\cos \\theta}{\\pi R_\\theta}\n    \"\"\"\n    sigma = _ParameterDS(default=90.0, getter=_to_orig_unit, setter=_to_radian)\n    delta = _ParameterDS(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n\n\nclass Pix2Sky_ConicPerspective(Pix2SkyProjection, Conic):\n    r\"\"\"\n    Colles' conic perspective projection - pixel to sky.\n\n    Corresponds to the ``COP`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n        C &= \\sin \\theta_a \\\\\n        R_\\theta &= \\frac{180^\\circ}{\\pi} \\cos \\eta [ \\cot \\theta_a - \\tan(\\theta - \\theta_a)] \\\\\n        Y_0 &= \\frac{180^\\circ}{\\pi} \\cos \\eta \\cot \\theta_a\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    \"\"\"\n\n\nclass Sky2Pix_ConicPerspective(Sky2PixProjection, Conic):\n    r\"\"\"\n    Colles' conic perspective projection - sky to pixel.\n\n    Corresponds to the ``COP`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n        C &= \\sin \\theta_a \\\\\n        R_\\theta &= \\frac{180^\\circ}{\\pi} \\cos \\eta [ \\cot \\theta_a - \\tan(\\theta - \\theta_a)] \\\\\n        Y_0 &= \\frac{180^\\circ}{\\pi} \\cos \\eta \\cot \\theta_a\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    \"\"\"\n\n\nclass Pix2Sky_ConicEqualArea(Pix2SkyProjection, Conic):\n    r\"\"\"\n    Alber's conic equal area projection - pixel to sky.\n\n    Corresponds to the ``COE`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n        C &= \\gamma / 2 \\\\\n        R_\\theta &= \\frac{180^\\circ}{\\pi} \\frac{2}{\\gamma} \\sqrt{1 + \\sin \\theta_1 \\sin \\theta_2 - \\gamma \\sin \\theta} \\\\\n        Y_0 &= \\frac{180^\\circ}{\\pi} \\frac{2}{\\gamma} \\sqrt{1 + \\sin \\theta_1 \\sin \\theta_2 - \\gamma \\sin((\\theta_1 + \\theta_2)/2)}\n\n    where:\n\n    .. math::\n        \\gamma = \\sin \\theta_1 + \\sin \\theta_2\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    \"\"\"\n\n\nclass Sky2Pix_ConicEqualArea(Sky2PixProjection, Conic):\n    r\"\"\"\n    Alber's conic equal area projection - sky to pixel.\n\n    Corresponds to the ``COE`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n        C &= \\gamma / 2 \\\\\n        R_\\theta &= \\frac{180^\\circ}{\\pi} \\frac{2}{\\gamma} \\sqrt{1 + \\sin \\theta_1 \\sin \\theta_2 - \\gamma \\sin \\theta} \\\\\n        Y_0 &= \\frac{180^\\circ}{\\pi} \\frac{2}{\\gamma} \\sqrt{1 + \\sin \\theta_1 \\sin \\theta_2 - \\gamma \\sin((\\theta_1 + \\theta_2)/2)}\n\n    where:\n\n    .. math::\n        \\gamma = \\sin \\theta_1 + \\sin \\theta_2\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    \"\"\"\n\n\nclass Pix2Sky_ConicEquidistant(Pix2SkyProjection, Conic):\n    r\"\"\"\n    Conic equidistant projection - pixel to sky.\n\n    Corresponds to the ``COD`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n\n        C &= \\frac{180^\\circ}{\\pi} \\frac{\\sin\\theta_a\\sin\\eta}{\\eta} \\\\\n        R_\\theta &= \\theta_a - \\theta + \\eta\\cot\\eta\\cot\\theta_a \\\\\n        Y_0 = \\eta\\cot\\eta\\cot\\theta_a\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    \"\"\"\n\n\nclass Sky2Pix_ConicEquidistant(Sky2PixProjection, Conic):\n    r\"\"\"\n    Conic equidistant projection - sky to pixel.\n\n    Corresponds to the ``COD`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n\n        C &= \\frac{180^\\circ}{\\pi} \\frac{\\sin\\theta_a\\sin\\eta}{\\eta} \\\\\n        R_\\theta &= \\theta_a - \\theta + \\eta\\cot\\eta\\cot\\theta_a \\\\\n        Y_0 = \\eta\\cot\\eta\\cot\\theta_a\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    \"\"\"\n\n\nclass Pix2Sky_ConicOrthomorphic(Pix2SkyProjection, Conic):\n    r\"\"\"\n    Conic orthomorphic projection - pixel to sky.\n\n    Corresponds to the ``COO`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n\n        C &= \\frac{\\ln \\left( \\frac{\\cos\\theta_2}{\\cos\\theta_1} \\right)}\n                  {\\ln \\left[ \\frac{\\tan\\left(\\frac{90^\\circ-\\theta_2}{2}\\right)}\n                                   {\\tan\\left(\\frac{90^\\circ-\\theta_1}{2}\\right)} \\right] } \\\\\n        R_\\theta &= \\psi \\left[ \\tan \\left( \\frac{90^\\circ - \\theta}{2} \\right) \\right]^C \\\\\n        Y_0 &= \\psi \\left[ \\tan \\left( \\frac{90^\\circ - \\theta_a}{2} \\right) \\right]^C\n\n    where:\n\n    .. math::\n\n        \\psi = \\frac{180^\\circ}{\\pi} \\frac{\\cos \\theta}\n               {C\\left[\\tan\\left(\\frac{90^\\circ-\\theta}{2}\\right)\\right]^C}\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    \"\"\"\n\n\nclass Sky2Pix_ConicOrthomorphic(Sky2PixProjection, Conic):\n    r\"\"\"\n    Conic orthomorphic projection - sky to pixel.\n\n    Corresponds to the ``COO`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n\n        C &= \\frac{\\ln \\left( \\frac{\\cos\\theta_2}{\\cos\\theta_1} \\right)}\n                  {\\ln \\left[ \\frac{\\tan\\left(\\frac{90^\\circ-\\theta_2}{2}\\right)}\n                                   {\\tan\\left(\\frac{90^\\circ-\\theta_1}{2}\\right)} \\right] } \\\\\n        R_\\theta &= \\psi \\left[ \\tan \\left( \\frac{90^\\circ - \\theta}{2} \\right) \\right]^C \\\\\n        Y_0 &= \\psi \\left[ \\tan \\left( \\frac{90^\\circ - \\theta_a}{2} \\right) \\right]^C\n\n    where:\n\n    .. math::\n\n        \\psi = \\frac{180^\\circ}{\\pi} \\frac{\\cos \\theta}\n               {C\\left[\\tan\\left(\\frac{90^\\circ-\\theta}{2}\\right)\\right]^C}\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    \"\"\"\n\n\nclass PseudoConic(Projection):\n    r\"\"\"Base class for pseudoconic projections.\n\n    Pseudoconics are a subclass of conics with concentric parallels.\n    \"\"\"\n\n\nclass Pix2Sky_BonneEqualArea(Pix2SkyProjection, PseudoConic):\n    r\"\"\"\n    Bonne's equal area pseudoconic projection - pixel to sky.\n\n    Corresponds to the ``BON`` projection in FITS WCS.\n\n    .. math::\n\n        \\phi &= \\frac{\\pi}{180^\\circ} A_\\phi R_\\theta / \\cos \\theta \\\\\n        \\theta &= Y_0 - R_\\theta\n\n    where:\n\n    .. math::\n\n        R_\\theta &= \\mathrm{sign} \\theta_1 \\sqrt{x^2 + (Y_0 - y)^2} \\\\\n        A_\\phi &= \\arg\\left(\\frac{Y_0 - y}{R_\\theta}, \\frac{x}{R_\\theta}\\right)\n\n    Parameters\n    ----------\n    theta1 : float\n        Bonne conformal latitude, in degrees.\n    \"\"\"\n    _separable = True\n\n    theta1 = _ParameterDS(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n\n\nclass Sky2Pix_BonneEqualArea(Sky2PixProjection, PseudoConic):\n    r\"\"\"\n    Bonne's equal area pseudoconic projection - sky to pixel.\n\n    Corresponds to the ``BON`` projection in FITS WCS.\n\n    .. math::\n        x &= R_\\theta \\sin A_\\phi \\\\\n        y &= -R_\\theta \\cos A_\\phi + Y_0\n\n    where:\n\n    .. math::\n        A_\\phi &= \\frac{180^\\circ}{\\pi R_\\theta} \\phi \\cos \\theta \\\\\n        R_\\theta &= Y_0 - \\theta \\\\\n        Y_0 &= \\frac{180^\\circ}{\\pi} \\cot \\theta_1 + \\theta_1\n\n    Parameters\n    ----------\n    theta1 : float\n        Bonne conformal latitude, in degrees.\n    \"\"\"\n    _separable = True\n\n    theta1 = _ParameterDS(default=0.0, getter=_to_orig_unit, setter=_to_radian,\n                          description=\"Bonne conformal latitude, in degrees\")\n\n\nclass Pix2Sky_Polyconic(Pix2SkyProjection, PseudoConic):\n    r\"\"\"\n    Polyconic projection - pixel to sky.\n\n    Corresponds to the ``PCO`` projection in FITS WCS.\n    \"\"\"\n\n\nclass Sky2Pix_Polyconic(Sky2PixProjection, PseudoConic):\n    r\"\"\"\n    Polyconic projection - sky to pixel.\n\n    Corresponds to the ``PCO`` projection in FITS WCS.\n    \"\"\"\n\n\nclass QuadCube(Projection):\n    r\"\"\"Base class for quad cube projections.\n\n    Quadrilateralized spherical cube (quad-cube) projections belong to\n    the class of polyhedral projections in which the sphere is\n    projected onto the surface of an enclosing polyhedron.\n\n    The six faces of the quad-cube projections are numbered and laid\n    out as::\n\n              0\n        4 3 2 1 4 3 2\n              5\n\n    \"\"\"\n\n\nclass Pix2Sky_TangentialSphericalCube(Pix2SkyProjection, QuadCube):\n    r\"\"\"\n    Tangential spherical cube projection - pixel to sky.\n\n    Corresponds to the ``TSC`` projection in FITS WCS.\n    \"\"\"\n\n\nclass Sky2Pix_TangentialSphericalCube(Sky2PixProjection, QuadCube):\n    r\"\"\"\n    Tangential spherical cube projection - sky to pixel.\n\n    Corresponds to the ``TSC`` projection in FITS WCS.\n    \"\"\"\n\n\nclass Pix2Sky_COBEQuadSphericalCube(Pix2SkyProjection, QuadCube):\n    r\"\"\"\n    COBE quadrilateralized spherical cube projection - pixel to sky.\n\n    Corresponds to the ``CSC`` projection in FITS WCS.\n    \"\"\"\n\n\nclass Sky2Pix_COBEQuadSphericalCube(Sky2PixProjection, QuadCube):\n    r\"\"\"\n    COBE quadrilateralized spherical cube projection - sky to pixel.\n\n    Corresponds to the ``CSC`` projection in FITS WCS.\n    \"\"\"\n\n\nclass Pix2Sky_QuadSphericalCube(Pix2SkyProjection, QuadCube):\n    r\"\"\"\n    Quadrilateralized spherical cube projection - pixel to sky.\n\n    Corresponds to the ``QSC`` projection in FITS WCS.\n    \"\"\"\n\n\nclass Sky2Pix_QuadSphericalCube(Sky2PixProjection, QuadCube):\n    r\"\"\"\n    Quadrilateralized spherical cube projection - sky to pixel.\n\n    Corresponds to the ``QSC`` projection in FITS WCS.\n    \"\"\"\n\n\nclass HEALPix(Projection):\n    r\"\"\"Base class for HEALPix projections.\n    \"\"\"\n\n\nclass Pix2Sky_HEALPix(Pix2SkyProjection, HEALPix):\n    r\"\"\"\n    HEALPix - pixel to sky.\n\n    Corresponds to the ``HPX`` projection in FITS WCS.\n\n    Parameters\n    ----------\n    H : float\n        The number of facets in longitude direction.\n\n    X : float\n        The number of facets in latitude direction.\n\n    \"\"\"\n    _separable = True\n\n    H = _ParameterDS(default=4.0, description=\"The number of facets in longitude direction.\")\n    X = _ParameterDS(default=3.0, description=\"The number of facets in latitude direction.\")\n\n\nclass Sky2Pix_HEALPix(Sky2PixProjection, HEALPix):\n    r\"\"\"\n    HEALPix projection - sky to pixel.\n\n    Corresponds to the ``HPX`` projection in FITS WCS.\n\n    Parameters\n    ----------\n    H : float\n        The number of facets in longitude direction.\n\n    X : float\n        The number of facets in latitude direction.\n\n    \"\"\"\n    _separable = True\n\n    H = _ParameterDS(default=4.0, description=\"The number of facets in longitude direction.\")\n    X = _ParameterDS(default=3.0, description=\"The number of facets in latitude direction.\")\n\n\nclass Pix2Sky_HEALPixPolar(Pix2SkyProjection, HEALPix):\n    r\"\"\"\n    HEALPix polar, aka \"butterfly\" projection - pixel to sky.\n\n    Corresponds to the ``XPH`` projection in FITS WCS.\n    \"\"\"\n\n\nclass Sky2Pix_HEALPixPolar(Sky2PixProjection, HEALPix):\n    r\"\"\"\n    HEALPix polar, aka \"butterfly\" projection - pixel to sky.\n\n    Corresponds to the ``XPH`` projection in FITS WCS.\n    \"\"\"\n\n\nclass AffineTransformation2D(Model):\n    \"\"\"\n    Perform an affine transformation in 2 dimensions.\n\n    Parameters\n    ----------\n    matrix : array\n        A 2x2 matrix specifying the linear transformation to apply to the\n        inputs\n\n    translation : array\n        A 2D vector (given as either a 2x1 or 1x2 array) specifying a\n        translation to apply to the inputs\n\n    \"\"\"\n    n_inputs = 2\n    n_outputs = 2\n\n    standard_broadcasting = False\n\n    _separable = False\n\n    matrix = Parameter(default=[[1.0, 0.0], [0.0, 1.0]])\n    translation = Parameter(default=[0.0, 0.0])\n\n    @matrix.validator\n    def matrix(self, value):\n        \"\"\"Validates that the input matrix is a 2x2 2D array.\"\"\"\n\n        if np.shape(value) != (2, 2):\n            raise InputParameterError(\n                \"Expected transformation matrix to be a 2x2 array\")\n\n    @translation.validator\n    def translation(self, value):\n        \"\"\"\n        Validates that the translation vector is a 2D vector.  This allows\n        either a \"row\" vector or a \"column\" vector where in the latter case the\n        resultant Numpy array has ``ndim=2`` but the shape is ``(1, 2)``.\n        \"\"\"\n\n        if not ((np.ndim(value) == 1 and np.shape(value) == (2,)) or\n                (np.ndim(value) == 2 and np.shape(value) == (1, 2))):\n            raise InputParameterError(\n                \"Expected translation vector to be a 2 element row or column \"\n                \"vector array\")\n\n    def __init__(self, matrix=matrix, translation=translation, **kwargs):\n        super().__init__(matrix=matrix, translation=translation, **kwargs)\n        self.inputs = (\"x\", \"y\")\n        self.outputs = (\"x\", \"y\")\n\n    @property\n    def inverse(self):\n        \"\"\"\n        Inverse transformation.\n\n        Raises `~astropy.modeling.InputParameterError` if the transformation cannot be inverted.\n        \"\"\"\n\n        det = np.linalg.det(self.matrix.value)\n\n        if det == 0:\n            raise InputParameterError(\n                \"Transformation matrix is singular; {} model does not \"\n                \"have an inverse\".format(self.__class__.__name__))\n\n        matrix = np.linalg.inv(self.matrix.value)\n        if self.matrix.unit is not None:\n            matrix = matrix * self.matrix.unit\n        # If matrix has unit then translation has unit, so no need to assign it.\n        translation = -np.dot(matrix, self.translation.value)\n        return self.__class__(matrix=matrix, translation=translation)\n\n    @classmethod\n    def evaluate(cls, x, y, matrix, translation):\n        \"\"\"\n        Apply the transformation to a set of 2D Cartesian coordinates given as\n        two lists--one for the x coordinates and one for a y coordinates--or a\n        single coordinate pair.\n\n        Parameters\n        ----------\n        x, y : array, float\n              x and y coordinates\n        \"\"\"\n        if x.shape != y.shape:\n            raise ValueError(\"Expected input arrays to have the same shape\")\n\n        shape = x.shape or (1,)\n        # Use asarray to ensure loose the units.\n        inarr = np.vstack([np.asarray(x).ravel(),\n                           np.asarray(y).ravel(),\n                           np.ones(x.size, x.dtype)])\n\n        if inarr.shape[0] != 3 or inarr.ndim != 2:\n            raise ValueError(\"Incompatible input shapes\")\n\n        augmented_matrix = cls._create_augmented_matrix(matrix, translation)\n        result = np.dot(augmented_matrix, inarr)\n        x, y = result[0], result[1]\n        x.shape = y.shape = shape\n\n        return x, y\n\n    @staticmethod\n    def _create_augmented_matrix(matrix, translation):\n        unit = None\n        if any([hasattr(translation, 'unit'), hasattr(matrix, 'unit')]):\n            if not all([hasattr(translation, 'unit'), hasattr(matrix, 'unit')]):\n                raise ValueError(\"To use AffineTransformation with quantities, \"\n                                 \"both matrix and unit need to be quantities.\")\n            unit = translation.unit\n            # matrix should have the same units as translation\n            if not (matrix.unit / translation.unit) == u.dimensionless_unscaled:\n                raise ValueError(\"matrix and translation must have the same units.\")\n\n        augmented_matrix = np.empty((3, 3), dtype=float)\n        augmented_matrix[0:2, 0:2] = matrix\n        augmented_matrix[0:2, 2:].flat = translation\n        augmented_matrix[2] = [0, 0, 1]\n        if unit is not None:\n            return augmented_matrix * unit\n        return augmented_matrix\n\n    @property\n    def input_units(self):\n        if self.translation.unit is None and self.matrix.unit is None:\n            return None\n        elif self.translation.unit is not None:\n            return dict(zip(self.inputs, [self.translation.unit] * 2))\n        else:\n            return dict(zip(self.inputs, [self.matrix.unit] * 2))\n\n\nfor long_name, short_name in _PROJ_NAME_CODE:\n    # define short-name projection equivalent classes:\n    globals()['Pix2Sky_' + short_name] = globals()['Pix2Sky_' + long_name]\n    globals()['Sky2Pix_' + short_name] = globals()['Sky2Pix_' + long_name]\n    # set inverse classes:\n    globals()['Pix2Sky_' + long_name]._inv_cls = globals()['Sky2Pix_' + long_name]\n    globals()['Sky2Pix_' + long_name]._inv_cls = globals()['Pix2Sky_' + long_name]\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":528,"id":12909,"name":"linear","nodeType":"Attribute","startLoc":528,"text":"linear"},{"className":"PolynomialBase","col":0,"comment":"\n    Base class for all polynomial-like models with an arbitrary number of\n    parameters in the form of coefficients.\n\n    In this case Parameter instances are returned through the class's\n    ``__getattr__`` rather than through class descriptors.\n    ","endLoc":54,"id":12910,"nodeType":"Class","startLoc":24,"text":"class PolynomialBase(FittableModel):\n    \"\"\"\n    Base class for all polynomial-like models with an arbitrary number of\n    parameters in the form of coefficients.\n\n    In this case Parameter instances are returned through the class's\n    ``__getattr__`` rather than through class descriptors.\n    \"\"\"\n\n    # Default _param_names list; this will be filled in by the implementation's\n    # __init__\n    _param_names = ()\n\n    linear = True\n    col_fit_deriv = False\n\n    @property\n    def param_names(self):\n        \"\"\"Coefficient names generated based on the model's polynomial degree\n        and number of dimensions.\n\n        Subclasses should implement this to return parameter names in the\n        desired format.\n\n        On most `Model` classes this is a class attribute, but for polynomial\n        models it is an instance attribute since each polynomial model instance\n        can have different parameters depending on the degree of the polynomial\n        and the number of dimensions, for example.\n        \"\"\"\n\n        return self._param_names"},{"col":4,"comment":"Coefficient names generated based on the model's polynomial degree\n        and number of dimensions.\n\n        Subclasses should implement this to return parameter names in the\n        desired format.\n\n        On most `Model` classes this is a class attribute, but for polynomial\n        models it is an instance attribute since each polynomial model instance\n        can have different parameters depending on the degree of the polynomial\n        and the number of dimensions, for example.\n        ","endLoc":54,"header":"@property\n    def param_names(self)","id":12911,"name":"param_names","nodeType":"Function","startLoc":40,"text":"@property\n    def param_names(self):\n        \"\"\"Coefficient names generated based on the model's polynomial degree\n        and number of dimensions.\n\n        Subclasses should implement this to return parameter names in the\n        desired format.\n\n        On most `Model` classes this is a class attribute, but for polynomial\n        models it is an instance attribute since each polynomial model instance\n        can have different parameters depending on the degree of the polynomial\n        and the number of dimensions, for example.\n        \"\"\"\n\n        return self._param_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":35,"id":12912,"name":"_param_names","nodeType":"Attribute","startLoc":35,"text":"_param_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":37,"id":12913,"name":"linear","nodeType":"Attribute","startLoc":37,"text":"linear"},{"attributeType":"null","col":4,"comment":"null","endLoc":38,"id":12914,"name":"col_fit_deriv","nodeType":"Attribute","startLoc":38,"text":"col_fit_deriv"},{"className":"PolynomialModel","col":0,"comment":"\n    Base class for polynomial models.\n\n    Its main purpose is to determine how many coefficients are needed\n    based on the polynomial order and dimension and to provide their\n    default values, names and ordering.\n    ","endLoc":130,"id":12915,"nodeType":"Class","startLoc":57,"text":"class PolynomialModel(PolynomialBase):\n    \"\"\"\n    Base class for polynomial models.\n\n    Its main purpose is to determine how many coefficients are needed\n    based on the polynomial order and dimension and to provide their\n    default values, names and ordering.\n    \"\"\"\n\n    def __init__(self, degree, n_models=None, model_set_axis=None,\n                 name=None, meta=None, **params):\n        self._degree = degree\n        self._order = self.get_num_coeff(self.n_inputs)\n        self._param_names = self._generate_coeff_names(self.n_inputs)\n        if n_models:\n            if model_set_axis is None:\n                model_set_axis = 0\n            minshape = (1,) * model_set_axis + (n_models,)\n        else:\n            minshape = ()\n        for param_name in self._param_names:\n            self._parameters_[param_name] = \\\n                Parameter(param_name, default=np.zeros(minshape))\n\n        super().__init__(\n            n_models=n_models, model_set_axis=model_set_axis, name=name,\n            meta=meta, **params)\n\n    @property\n    def degree(self):\n        \"\"\"Degree of polynomial.\"\"\"\n\n        return self._degree\n\n    def get_num_coeff(self, ndim):\n        \"\"\"\n        Return the number of coefficients in one parameter set\n        \"\"\"\n\n        if self.degree < 0:\n            raise ValueError(\"Degree of polynomial must be positive or null\")\n        # deg+1 is used to account for the difference between iraf using\n        # degree and numpy using exact degree\n        if ndim != 1:\n            nmixed = comb(self.degree, ndim)\n        else:\n            nmixed = 0\n        numc = self.degree * ndim + nmixed + 1\n        return numc\n\n    def _invlex(self):\n        c = []\n        lencoeff = self.degree + 1\n        for i in range(lencoeff):\n            for j in range(lencoeff):\n                if i + j <= self.degree:\n                    c.append((j, i))\n        return c[::-1]\n\n    def _generate_coeff_names(self, ndim):\n        names = []\n        if ndim == 1:\n            for n in range(self._order):\n                names.append(f'c{n}')\n        else:\n            for i in range(self.degree + 1):\n                names.append(f'c{i}_{0}')\n            for i in range(1, self.degree + 1):\n                names.append(f'c{0}_{i}')\n            for i in range(1, self.degree):\n                for j in range(1, self.degree):\n                    if i + j < self.degree + 1:\n                        names.append(f'c{i}_{j}')\n        return tuple(names)"},{"col":4,"comment":"Degree of polynomial.","endLoc":89,"header":"@property\n    def degree(self)","id":12916,"name":"degree","nodeType":"Function","startLoc":85,"text":"@property\n    def degree(self):\n        \"\"\"Degree of polynomial.\"\"\"\n\n        return self._degree"},{"col":4,"comment":"null","endLoc":114,"header":"def _invlex(self)","id":12917,"name":"_invlex","nodeType":"Function","startLoc":107,"text":"def _invlex(self):\n        c = []\n        lencoeff = self.degree + 1\n        for i in range(lencoeff):\n            for j in range(lencoeff):\n                if i + j <= self.degree:\n                    c.append((j, i))\n        return c[::-1]"},{"col":4,"comment":"null","endLoc":80,"header":"def __repr__(self)","id":12918,"name":"__repr__","nodeType":"Function","startLoc":79,"text":"def __repr__(self):\n        return(self.pprint(max_lines=10, round_val=3))"},{"className":"ExponentialCutoffPowerLaw1D","col":0,"comment":"\n    One dimensional power law model with an exponential cutoff.\n\n    Parameters\n    ----------\n    amplitude : float\n        Model amplitude\n    x_0 : float\n        Reference point\n    alpha : float\n        Power law index\n    x_cutoff : float\n        Cutoff point\n\n    See Also\n    --------\n    PowerLaw1D, BrokenPowerLaw1D, LogParabola1D\n\n    Notes\n    -----\n    Model formula (with :math:`A` for ``amplitude`` and :math:`\\alpha` for ``alpha``):\n\n        .. math:: f(x) = A (x / x_0) ^ {-\\alpha} \\exp (-x / x_{cutoff})\n\n    ","endLoc":444,"id":12919,"nodeType":"Class","startLoc":382,"text":"class ExponentialCutoffPowerLaw1D(Fittable1DModel):\n    \"\"\"\n    One dimensional power law model with an exponential cutoff.\n\n    Parameters\n    ----------\n    amplitude : float\n        Model amplitude\n    x_0 : float\n        Reference point\n    alpha : float\n        Power law index\n    x_cutoff : float\n        Cutoff point\n\n    See Also\n    --------\n    PowerLaw1D, BrokenPowerLaw1D, LogParabola1D\n\n    Notes\n    -----\n    Model formula (with :math:`A` for ``amplitude`` and :math:`\\\\alpha` for ``alpha``):\n\n        .. math:: f(x) = A (x / x_0) ^ {-\\\\alpha} \\\\exp (-x / x_{cutoff})\n\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Peak value of model\")\n    x_0 = Parameter(default=1, description=\"Reference point\")\n    alpha = Parameter(default=1, description=\"Power law index\")\n    x_cutoff = Parameter(default=1, description=\"Cutoff point\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, alpha, x_cutoff):\n        \"\"\"One dimensional exponential cutoff power law model function\"\"\"\n\n        xx = x / x_0\n        return amplitude * xx ** (-alpha) * np.exp(-x / x_cutoff)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, x_0, alpha, x_cutoff):\n        \"\"\"One dimensional exponential cutoff power law derivative with respect to parameters\"\"\"\n\n        xx = x / x_0\n        xc = x / x_cutoff\n\n        d_amplitude = xx ** (-alpha) * np.exp(-xc)\n        d_x_0 = alpha * amplitude * d_amplitude / x_0\n        d_alpha = -amplitude * d_amplitude * np.log(xx)\n        d_x_cutoff = amplitude * x * d_amplitude / x_cutoff ** 2\n\n        return [d_amplitude, d_x_0, d_alpha, d_x_cutoff]\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'x_cutoff': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":529,"id":12920,"name":"fittable","nodeType":"Attribute","startLoc":529,"text":"fittable"},{"col":4,"comment":"null","endLoc":92,"header":"def __getitem__(self, params)","id":12921,"name":"__getitem__","nodeType":"Function","startLoc":82,"text":"def __getitem__(self, params):\n        # index covariance matrix by parameter names or indices\n        if len(params) != 2:\n            raise ValueError('Covariance must be indexed by two values.')\n        if all(isinstance(item, str) for item in params):\n            i1, i2 = self.param_names.index(params[0]), self.param_names.index(params[1])\n        elif all(isinstance(item, int) for item in params):\n            i1, i2 = params\n        else:\n            raise TypeError('Covariance can be indexed by two parameter names or integer indices.')\n        return(self.cov_matrix[i1][i2])"},{"col":4,"comment":"One dimensional exponential cutoff power law model function","endLoc":419,"header":"@staticmethod\n    def evaluate(x, amplitude, x_0, alpha, x_cutoff)","id":12922,"name":"evaluate","nodeType":"Function","startLoc":414,"text":"@staticmethod\n    def evaluate(x, amplitude, x_0, alpha, x_cutoff):\n        \"\"\"One dimensional exponential cutoff power law model function\"\"\"\n\n        xx = x / x_0\n        return amplitude * xx ** (-alpha) * np.exp(-x / x_cutoff)"},{"attributeType":"null","col":4,"comment":"null","endLoc":531,"id":12923,"name":"_input_units_strict","nodeType":"Attribute","startLoc":531,"text":"_input_units_strict"},{"attributeType":"null","col":4,"comment":"null","endLoc":532,"id":12924,"name":"_input_units_allow_dimensionless","nodeType":"Attribute","startLoc":532,"text":"_input_units_allow_dimensionless"},{"col":4,"comment":"One dimensional exponential cutoff power law derivative with respect to parameters","endLoc":433,"header":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, alpha, x_cutoff)","id":12925,"name":"fit_deriv","nodeType":"Function","startLoc":421,"text":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, alpha, x_cutoff):\n        \"\"\"One dimensional exponential cutoff power law derivative with respect to parameters\"\"\"\n\n        xx = x / x_0\n        xc = x / x_cutoff\n\n        d_amplitude = xx ** (-alpha) * np.exp(-xc)\n        d_x_0 = alpha * amplitude * d_amplitude / x_0\n        d_alpha = -amplitude * d_amplitude * np.log(xx)\n        d_x_cutoff = amplitude * x * d_amplitude / x_cutoff ** 2\n\n        return [d_amplitude, d_x_0, d_alpha, d_x_cutoff]"},{"className":"_ParameterDS","col":0,"comment":"\n    Same as `Parameter` but can indicate its modified status via the ``dirty``\n    property. This flag also gets set automatically when a parameter is\n    modified.\n\n    This ability to track parameter's modified status is needed for automatic\n    update of WCSLIB's prjprm structure (which may be a more-time intensive\n    operation) *only as required*.\n\n    ","endLoc":93,"id":12926,"nodeType":"Class","startLoc":76,"text":"class _ParameterDS(Parameter):\n    \"\"\"\n    Same as `Parameter` but can indicate its modified status via the ``dirty``\n    property. This flag also gets set automatically when a parameter is\n    modified.\n\n    This ability to track parameter's modified status is needed for automatic\n    update of WCSLIB's prjprm structure (which may be a more-time intensive\n    operation) *only as required*.\n\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.dirty = True\n\n    def validate(self, value):\n        super().validate(value)\n        self.dirty = True"},{"attributeType":"null","col":4,"comment":"null","endLoc":534,"id":12927,"name":"_has_inverse_bounding_box","nodeType":"Attribute","startLoc":534,"text":"_has_inverse_bounding_box"},{"className":"Multiply","col":0,"comment":"\n    Multiply a model by a quantity or number.\n\n    Parameters\n    ----------\n    factor : float\n        Factor by which to multiply a coordinate.\n    ","endLoc":620,"id":12928,"nodeType":"Class","startLoc":576,"text":"class Multiply(Fittable1DModel):\n    \"\"\"\n    Multiply a model by a quantity or number.\n\n    Parameters\n    ----------\n    factor : float\n        Factor by which to multiply a coordinate.\n    \"\"\"\n\n    factor = Parameter(default=1, description=\"Factor by which to multiply a model\")\n    linear = True\n    fittable = True\n\n    _has_inverse_bounding_box = True\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse multiply model function\"\"\"\n        inv = self.copy()\n        inv.factor = 1 / self.factor\n\n        try:\n            self.bounding_box\n        except NotImplementedError:\n            pass\n        else:\n            inv.bounding_box = tuple(self.evaluate(x, self.factor) for x in self.bounding_box.bounding_box())\n\n        return inv\n\n    @staticmethod\n    def evaluate(x, factor):\n        \"\"\"One dimensional multiply model function\"\"\"\n        return factor * x\n\n    @staticmethod\n    def fit_deriv(x, *params):\n        \"\"\"One dimensional multiply model derivative with respect to parameter\"\"\"\n\n        d_factor = x\n        return [d_factor]\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'factor': outputs_unit[self.outputs[0]]}"},{"col":4,"comment":"One dimensional inverse multiply model function","endLoc":605,"header":"@property\n    def inverse(self)","id":12929,"name":"inverse","nodeType":"Function","startLoc":592,"text":"@property\n    def inverse(self):\n        \"\"\"One dimensional inverse multiply model function\"\"\"\n        inv = self.copy()\n        inv.factor = 1 / self.factor\n\n        try:\n            self.bounding_box\n        except NotImplementedError:\n            pass\n        else:\n            inv.bounding_box = tuple(self.evaluate(x, self.factor) for x in self.bounding_box.bounding_box())\n\n        return inv"},{"col":4,"comment":"null","endLoc":439,"header":"@property\n    def input_units(self)","id":12930,"name":"input_units","nodeType":"Function","startLoc":435,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}"},{"col":4,"comment":"null","endLoc":444,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":12931,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":441,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'x_cutoff': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":409,"id":12932,"name":"amplitude","nodeType":"Attribute","startLoc":409,"text":"amplitude"},{"attributeType":"null","col":8,"comment":"null","endLoc":69,"id":12933,"name":"_order","nodeType":"Attribute","startLoc":69,"text":"self._order"},{"col":4,"comment":"null","endLoc":89,"header":"def __init__(self, *args, **kwargs)","id":12934,"name":"__init__","nodeType":"Function","startLoc":87,"text":"def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.dirty = True"},{"col":4,"comment":"null","endLoc":515,"header":"@staticmethod\n    def _compute_matrix(angle)","id":12935,"name":"_compute_matrix","nodeType":"Function","startLoc":511,"text":"@staticmethod\n    def _compute_matrix(angle):\n        return np.array([[math.cos(angle), -math.sin(angle)],\n                         [math.sin(angle), math.cos(angle)]],\n                        dtype=np.float64)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":410,"id":12936,"name":"x_0","nodeType":"Attribute","startLoc":410,"text":"x_0"},{"attributeType":"null","col":8,"comment":"null","endLoc":70,"id":12937,"name":"_param_names","nodeType":"Attribute","startLoc":70,"text":"self._param_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":68,"id":12938,"name":"_degree","nodeType":"Attribute","startLoc":68,"text":"self._degree"},{"className":"_PolyDomainWindow1D","col":0,"comment":"\n    This class sets ``domain`` and ``window`` of 1D polynomials.\n    ","endLoc":182,"id":12939,"nodeType":"Class","startLoc":133,"text":"class _PolyDomainWindow1D(PolynomialModel):\n    \"\"\"\n    This class sets ``domain`` and ``window`` of 1D polynomials.\n    \"\"\"\n    def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            degree, n_models, model_set_axis, name=name, meta=meta, **params)\n\n        self._set_default_domain_window(domain, window)\n\n    @property\n    def window(self):\n        return self._window\n\n    @window.setter\n    def window(self, val):\n        self._window = _validate_domain_window(val)\n\n    @property\n    def domain(self):\n        return self._domain\n\n    @domain.setter\n    def domain(self, val):\n        self._domain = _validate_domain_window(val)\n\n    def _set_default_domain_window(self, domain, window):\n        \"\"\"\n        This method sets the ``domain`` and ``window`` attributes on 1D subclasses.\n\n        \"\"\"\n\n        self._default_domain_window = {'domain': None,\n                                       'window': (-1, 1)\n                                       }\n        self.window = window or (-1, 1)\n        self.domain = domain\n\n    def __repr__(self):\n        return self._format_repr([self.degree],\n                                 kwargs={'domain': self.domain, 'window': self.window},\n                                 defaults=self._default_domain_window\n                                 )\n\n    def __str__(self):\n        return self._format_str([('Degree', self.degree),\n                                 ('Domain', self.domain),\n                                 ('Window', self.window)],\n                                 self._default_domain_window)"},{"col":4,"comment":"null","endLoc":146,"header":"@property\n    def window(self)","id":12940,"name":"window","nodeType":"Function","startLoc":144,"text":"@property\n    def window(self):\n        return self._window"},{"col":4,"comment":"null","endLoc":150,"header":"@window.setter\n    def window(self, val)","id":12941,"name":"window","nodeType":"Function","startLoc":148,"text":"@window.setter\n    def window(self, val):\n        self._window = _validate_domain_window(val)"},{"col":4,"comment":"null","endLoc":154,"header":"@property\n    def domain(self)","id":12942,"name":"domain","nodeType":"Function","startLoc":152,"text":"@property\n    def domain(self):\n        return self._domain"},{"col":4,"comment":"null","endLoc":158,"header":"@domain.setter\n    def domain(self, val)","id":12943,"name":"domain","nodeType":"Function","startLoc":156,"text":"@domain.setter\n    def domain(self, val):\n        self._domain = _validate_domain_window(val)"},{"col":4,"comment":"null","endLoc":176,"header":"def __repr__(self)","id":12944,"name":"__repr__","nodeType":"Function","startLoc":172,"text":"def __repr__(self):\n        return self._format_repr([self.degree],\n                                 kwargs={'domain': self.domain, 'window': self.window},\n                                 defaults=self._default_domain_window\n                                 )"},{"attributeType":"null","col":8,"comment":"null","endLoc":62,"id":12945,"name":"param_names","nodeType":"Attribute","startLoc":62,"text":"self.param_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":61,"id":12946,"name":"cov_matrix","nodeType":"Attribute","startLoc":61,"text":"self.cov_matrix"},{"col":4,"comment":"null","endLoc":182,"header":"def __str__(self)","id":12947,"name":"__str__","nodeType":"Function","startLoc":178,"text":"def __str__(self):\n        return self._format_str([('Degree', self.degree),\n                                 ('Domain', self.domain),\n                                 ('Window', self.window)],\n                                 self._default_domain_window)"},{"attributeType":"null","col":8,"comment":"null","endLoc":158,"id":12948,"name":"_domain","nodeType":"Attribute","startLoc":158,"text":"self._domain"},{"className":"StandardDeviations","col":0,"comment":" Class for fitting uncertainties.","endLoc":132,"id":12949,"nodeType":"Class","startLoc":95,"text":"class StandardDeviations():\n    \"\"\" Class for fitting uncertainties.\"\"\"\n\n    def __init__(self, cov_matrix, param_names):\n        self.param_names = param_names\n        self.stds = self._calc_stds(cov_matrix)\n\n    def _calc_stds(self, cov_matrix):\n        # sometimes scipy lstsq returns a non-sensical negative vals in the\n        # diagonals of the cov_x it computes.\n        stds = [np.sqrt(x) if x > 0 else None for x in np.diag(cov_matrix)]\n        return stds\n\n    def pprint(self, max_lines, round_val):\n        longest_name = max([len(x) for x in self.param_names])\n        ret_str = 'standard deviations\\n'\n        fstring = '{0}{1}| {2}\\n'\n        for i, std in enumerate(self.stds):\n            if i <= max_lines-1:\n                param = self.param_names[i]\n                ret_str += fstring.format(param,\n                                          ' ' * (longest_name - len(param)),\n                                          str(np.round(std, round_val)))\n            else:\n                ret_str += '...'\n        return(ret_str.rstrip())\n\n    def __repr__(self):\n        return(self.pprint(max_lines=10, round_val=3))\n\n    def __getitem__(self, param):\n        if isinstance(param, str):\n            i = self.param_names.index(param)\n        elif isinstance(param, int):\n            i = param\n        else:\n            raise TypeError('Standard deviation can be indexed by parameter name or integer.')\n        return(self.stds[i])"},{"col":4,"comment":"null","endLoc":100,"header":"def __init__(self, cov_matrix, param_names)","id":12950,"name":"__init__","nodeType":"Function","startLoc":98,"text":"def __init__(self, cov_matrix, param_names):\n        self.param_names = param_names\n        self.stds = self._calc_stds(cov_matrix)"},{"attributeType":"null","col":8,"comment":"null","endLoc":150,"id":12951,"name":"_window","nodeType":"Attribute","startLoc":150,"text":"self._window"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":411,"id":12952,"name":"alpha","nodeType":"Attribute","startLoc":411,"text":"alpha"},{"attributeType":"null","col":8,"comment":"null","endLoc":170,"id":12953,"name":"domain","nodeType":"Attribute","startLoc":170,"text":"self.domain"},{"attributeType":"null","col":8,"comment":"null","endLoc":169,"id":12954,"name":"window","nodeType":"Attribute","startLoc":169,"text":"self.window"},{"attributeType":"null","col":8,"comment":"null","endLoc":166,"id":12955,"name":"_default_domain_window","nodeType":"Attribute","startLoc":166,"text":"self._default_domain_window"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":412,"id":12956,"name":"x_cutoff","nodeType":"Attribute","startLoc":412,"text":"x_cutoff"},{"className":"OrthoPolynomialBase","col":0,"comment":"\n    This is a base class for the 2D Chebyshev and Legendre models.\n\n    The polynomials implemented here require a maximum degree in x and y.\n\n    For explanation of ``x_domain``, ``y_domain``, ```x_window`` and ```y_window``\n    see :ref:`Notes regarding usage of domain and window <astropy:domain-window-note>`.\n\n\n    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : tuple or None, optional\n        domain of the x independent variable\n    x_window : tuple or None, optional\n        range of the x independent variable\n    y_domain : tuple or None, optional\n        domain of the y independent variable\n    y_window : tuple or None, optional\n        range of the y independent variable\n    **params : dict\n        {keyword: value} pairs, representing {parameter_name: value}\n    ","endLoc":412,"id":12957,"nodeType":"Class","startLoc":185,"text":"class OrthoPolynomialBase(PolynomialBase):\n    \"\"\"\n    This is a base class for the 2D Chebyshev and Legendre models.\n\n    The polynomials implemented here require a maximum degree in x and y.\n\n    For explanation of ``x_domain``, ``y_domain``, ```x_window`` and ```y_window``\n    see :ref:`Notes regarding usage of domain and window <astropy:domain-window-note>`.\n\n\n    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : tuple or None, optional\n        domain of the x independent variable\n    x_window : tuple or None, optional\n        range of the x independent variable\n    y_domain : tuple or None, optional\n        domain of the y independent variable\n    y_window : tuple or None, optional\n        range of the y independent variable\n    **params : dict\n        {keyword: value} pairs, representing {parameter_name: value}\n    \"\"\"\n\n    n_inputs = 2\n    n_outputs = 1\n\n    def __init__(self, x_degree, y_degree, x_domain=None, x_window=None,\n                 y_domain=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.x_degree = x_degree\n        self.y_degree = y_degree\n        self._order = self.get_num_coeff()\n        # Set the ``x/y_domain`` and ``x/y_wndow`` attributes in subclasses.\n        self._default_domain_window = {\n            'x_window': (-1, 1),\n            'y_window': (-1, 1),\n            'x_domain': None,\n            'y_domain': None\n            }\n\n        self.x_window = x_window or self._default_domain_window['x_window']\n        self.y_window = y_window or self._default_domain_window['y_window']\n        self.x_domain = x_domain\n        self.y_domain = y_domain\n\n        self._param_names = self._generate_coeff_names()\n        if n_models:\n            if model_set_axis is None:\n                model_set_axis = 0\n            minshape = (1,) * model_set_axis + (n_models,)\n        else:\n            minshape = ()\n\n        for param_name in self._param_names:\n            self._parameters_[param_name] = \\\n                Parameter(param_name, default=np.zeros(minshape))\n        super().__init__(\n            n_models=n_models, model_set_axis=model_set_axis,\n            name=name, meta=meta, **params)\n\n    @property\n    def x_domain(self):\n        return self._x_domain\n\n    @x_domain.setter\n    def x_domain(self, val):\n        self._x_domain = _validate_domain_window(val)\n\n    @property\n    def y_domain(self):\n        return self._y_domain\n\n    @y_domain.setter\n    def y_domain(self, val):\n        self._y_domain = _validate_domain_window(val)\n\n    @property\n    def x_window(self):\n        return self._x_window\n\n    @x_window.setter\n    def x_window(self, val):\n        self._x_window = _validate_domain_window(val)\n\n    @property\n    def y_window(self):\n        return self._y_window\n\n    @y_window.setter\n    def y_window(self, val):\n        self._y_window = _validate_domain_window(val)\n\n    def __repr__(self):\n        return self._format_repr([self.x_degree, self.y_degree],\n                                 kwargs={'x_domain': self.x_domain,\n                                         'y_domain': self.y_domain,\n                                         'x_window': self.x_window,\n                                         'y_window': self.y_window},\n                                 defaults=self._default_domain_window)\n\n    def __str__(self):\n        return self._format_str(\n            [('X_Degree', self.x_degree),\n             ('Y_Degree', self.y_degree),\n             ('X_Domain', self.x_domain),\n             ('Y_Domain', self.y_domain),\n             ('X_Window', self.x_window),\n             ('Y_Window', self.y_window)],\n             self._default_domain_window)\n\n    def get_num_coeff(self):\n        \"\"\"\n        Determine how many coefficients are needed\n\n        Returns\n        -------\n        numc : int\n            number of coefficients\n        \"\"\"\n\n        if self.x_degree < 0 or self.y_degree < 0:\n            raise ValueError(\"Degree of polynomial must be positive or null\")\n\n        return (self.x_degree + 1) * (self.y_degree + 1)\n\n    def _invlex(self):\n        # TODO: This is a very slow way to do this; fix it and related methods\n        # like _alpha\n        c = []\n        xvar = np.arange(self.x_degree + 1)\n        yvar = np.arange(self.y_degree + 1)\n        for j in yvar:\n            for i in xvar:\n                c.append((i, j))\n        return np.array(c[::-1])\n\n    def invlex_coeff(self, coeffs):\n        invlex_coeffs = []\n        xvar = np.arange(self.x_degree + 1)\n        yvar = np.arange(self.y_degree + 1)\n        for j in yvar:\n            for i in xvar:\n                name = f'c{i}_{j}'\n                coeff = coeffs[self.param_names.index(name)]\n                invlex_coeffs.append(coeff)\n        return np.array(invlex_coeffs[::-1])\n\n    def _alpha(self):\n        invlexdeg = self._invlex()\n        invlexdeg[:, 1] = invlexdeg[:, 1] + self.x_degree + 1\n        nx = self.x_degree + 1\n        ny = self.y_degree + 1\n        alpha = np.zeros((ny * nx + 3, ny + nx))\n        for n in range(len(invlexdeg)):\n            alpha[n][invlexdeg[n]] = [1, 1]\n            alpha[-2, 0] = 1\n            alpha[-3, nx] = 1\n        return alpha\n\n    def imhorner(self, x, y, coeff):\n        _coeff = list(coeff)\n        _coeff.extend([0, 0, 0])\n        alpha = self._alpha()\n        r0 = _coeff[0]\n        nalpha = len(alpha)\n\n        karr = np.diff(alpha, axis=0)\n        kfunc = self._fcache(x, y)\n        x_terms = self.x_degree + 1\n        y_terms = self.y_degree + 1\n        nterms = x_terms + y_terms\n        for n in range(1, nterms + 1 + 3):\n            setattr(self, 'r' + str(n), 0.)\n\n        for n in range(1, nalpha):\n            k = karr[n - 1].nonzero()[0].max() + 1\n            rsum = 0\n            for i in range(1, k + 1):\n                rsum = rsum + getattr(self, 'r' + str(i))\n            val = kfunc[k - 1] * (r0 + rsum)\n            setattr(self, 'r' + str(k), val)\n            r0 = _coeff[n]\n            for i in range(1, k):\n                setattr(self, 'r' + str(i), 0.)\n        result = r0\n        for i in range(1, nterms + 1 + 3):\n            result = result + getattr(self, 'r' + str(i))\n        return result\n\n    def _generate_coeff_names(self):\n        names = []\n        for j in range(self.y_degree + 1):\n            for i in range(self.x_degree + 1):\n                names.append(f'c{i}_{j}')\n        return tuple(names)\n\n    def _fcache(self, x, y):\n        \"\"\"\n        Computation and store the individual functions.\n\n        To be implemented by subclasses\"\n        \"\"\"\n\n        raise NotImplementedError(\"Subclasses should implement this\")\n\n    def evaluate(self, x, y, *coeffs):\n        if self.x_domain is not None:\n            x = poly_map_domain(x, self.x_domain, self.x_window)\n        if self.y_domain is not None:\n            y = poly_map_domain(y, self.y_domain, self.y_window)\n        invcoeff = self.invlex_coeff(coeffs)\n        return self.imhorner(x, y, invcoeff)\n\n    def prepare_inputs(self, x, y, **kwargs):\n        inputs, broadcasted_shapes = super().prepare_inputs(x, y, **kwargs)\n\n        x, y = inputs\n\n        if x.shape != y.shape:\n            raise ValueError(\"Expected input arrays to have the same shape\")\n\n        return (x, y), broadcasted_shapes"},{"attributeType":"null","col":4,"comment":"null","endLoc":450,"id":12958,"name":"n_inputs","nodeType":"Attribute","startLoc":450,"text":"n_inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":451,"id":12959,"name":"n_outputs","nodeType":"Attribute","startLoc":451,"text":"n_outputs"},{"col":4,"comment":"One dimensional multiply model function","endLoc":610,"header":"@staticmethod\n    def evaluate(x, factor)","id":12960,"name":"evaluate","nodeType":"Function","startLoc":607,"text":"@staticmethod\n    def evaluate(x, factor):\n        \"\"\"One dimensional multiply model function\"\"\"\n        return factor * x"},{"attributeType":"null","col":4,"comment":"null","endLoc":453,"id":12961,"name":"_separable","nodeType":"Attribute","startLoc":453,"text":"_separable"},{"col":4,"comment":"null","endLoc":249,"header":"def __init__(self, x_degree, y_degree, x_domain=None, x_window=None,\n                 y_domain=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":12962,"name":"__init__","nodeType":"Function","startLoc":217,"text":"def __init__(self, x_degree, y_degree, x_domain=None, x_window=None,\n                 y_domain=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.x_degree = x_degree\n        self.y_degree = y_degree\n        self._order = self.get_num_coeff()\n        # Set the ``x/y_domain`` and ``x/y_wndow`` attributes in subclasses.\n        self._default_domain_window = {\n            'x_window': (-1, 1),\n            'y_window': (-1, 1),\n            'x_domain': None,\n            'y_domain': None\n            }\n\n        self.x_window = x_window or self._default_domain_window['x_window']\n        self.y_window = y_window or self._default_domain_window['y_window']\n        self.x_domain = x_domain\n        self.y_domain = y_domain\n\n        self._param_names = self._generate_coeff_names()\n        if n_models:\n            if model_set_axis is None:\n                model_set_axis = 0\n            minshape = (1,) * model_set_axis + (n_models,)\n        else:\n            minshape = ()\n\n        for param_name in self._param_names:\n            self._parameters_[param_name] = \\\n                Parameter(param_name, default=np.zeros(minshape))\n        super().__init__(\n            n_models=n_models, model_set_axis=model_set_axis,\n            name=name, meta=meta, **params)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":455,"id":12963,"name":"angle","nodeType":"Attribute","startLoc":455,"text":"angle"},{"className":"LogParabola1D","col":0,"comment":"\n    One dimensional log parabola model (sometimes called curved power law).\n\n    Parameters\n    ----------\n    amplitude : float\n        Model amplitude\n    x_0 : float\n        Reference point\n    alpha : float\n        Power law index\n    beta : float\n        Power law curvature\n\n    See Also\n    --------\n    PowerLaw1D, BrokenPowerLaw1D, ExponentialCutoffPowerLaw1D\n\n    Notes\n    -----\n    Model formula (with :math:`A` for ``amplitude`` and :math:`\\alpha` for ``alpha`` and :math:`\\beta` for ``beta``):\n\n        .. math:: f(x) = A \\left(\\frac{x}{x_{0}}\\right)^{- \\alpha - \\beta \\log{\\left (\\frac{x}{x_{0}} \\right )}}\n\n    ","endLoc":509,"id":12964,"nodeType":"Class","startLoc":447,"text":"class LogParabola1D(Fittable1DModel):\n    \"\"\"\n    One dimensional log parabola model (sometimes called curved power law).\n\n    Parameters\n    ----------\n    amplitude : float\n        Model amplitude\n    x_0 : float\n        Reference point\n    alpha : float\n        Power law index\n    beta : float\n        Power law curvature\n\n    See Also\n    --------\n    PowerLaw1D, BrokenPowerLaw1D, ExponentialCutoffPowerLaw1D\n\n    Notes\n    -----\n    Model formula (with :math:`A` for ``amplitude`` and :math:`\\\\alpha` for ``alpha`` and :math:`\\\\beta` for ``beta``):\n\n        .. math:: f(x) = A \\\\left(\\\\frac{x}{x_{0}}\\\\right)^{- \\\\alpha - \\\\beta \\\\log{\\\\left (\\\\frac{x}{x_{0}} \\\\right )}}\n\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Peak value of model\")\n    x_0 = Parameter(default=1, description=\"Reference point\")\n    alpha = Parameter(default=1, description=\"Power law index\")\n    beta = Parameter(default=0, description=\"Power law curvature\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, alpha, beta):\n        \"\"\"One dimensional log parabola model function\"\"\"\n\n        xx = x / x_0\n        exponent = -alpha - beta * np.log(xx)\n        return amplitude * xx ** exponent\n\n    @staticmethod\n    def fit_deriv(x, amplitude, x_0, alpha, beta):\n        \"\"\"One dimensional log parabola derivative with respect to parameters\"\"\"\n\n        xx = x / x_0\n        log_xx = np.log(xx)\n        exponent = -alpha - beta * log_xx\n\n        d_amplitude = xx ** exponent\n        d_beta = -amplitude * d_amplitude * log_xx ** 2\n        d_x_0 = amplitude * d_amplitude * (beta * log_xx / x_0 - exponent / x_0)\n        d_alpha = -amplitude * d_amplitude * log_xx\n        return [d_amplitude, d_x_0, d_alpha, d_beta]\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"col":4,"comment":"null","endLoc":106,"header":"def _calc_stds(self, cov_matrix)","id":12965,"name":"_calc_stds","nodeType":"Function","startLoc":102,"text":"def _calc_stds(self, cov_matrix):\n        # sometimes scipy lstsq returns a non-sensical negative vals in the\n        # diagonals of the cov_x it computes.\n        stds = [np.sqrt(x) if x > 0 else None for x in np.diag(cov_matrix)]\n        return stds"},{"col":4,"comment":"One dimensional multiply model derivative with respect to parameter","endLoc":617,"header":"@staticmethod\n    def fit_deriv(x, *params)","id":12966,"name":"fit_deriv","nodeType":"Function","startLoc":612,"text":"@staticmethod\n    def fit_deriv(x, *params):\n        \"\"\"One dimensional multiply model derivative with respect to parameter\"\"\"\n\n        d_factor = x\n        return [d_factor]"},{"col":4,"comment":"One dimensional log parabola model function","endLoc":485,"header":"@staticmethod\n    def evaluate(x, amplitude, x_0, alpha, beta)","id":12967,"name":"evaluate","nodeType":"Function","startLoc":479,"text":"@staticmethod\n    def evaluate(x, amplitude, x_0, alpha, beta):\n        \"\"\"One dimensional log parabola model function\"\"\"\n\n        xx = x / x_0\n        exponent = -alpha - beta * np.log(xx)\n        return amplitude * xx ** exponent"},{"col":4,"comment":"null","endLoc":620,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":12968,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":619,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'factor': outputs_unit[self.outputs[0]]}"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":586,"id":12969,"name":"factor","nodeType":"Attribute","startLoc":586,"text":"factor"},{"col":4,"comment":"One dimensional log parabola derivative with respect to parameters","endLoc":499,"header":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, alpha, beta)","id":12970,"name":"fit_deriv","nodeType":"Function","startLoc":487,"text":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, alpha, beta):\n        \"\"\"One dimensional log parabola derivative with respect to parameters\"\"\"\n\n        xx = x / x_0\n        log_xx = np.log(xx)\n        exponent = -alpha - beta * log_xx\n\n        d_amplitude = xx ** exponent\n        d_beta = -amplitude * d_amplitude * log_xx ** 2\n        d_x_0 = amplitude * d_amplitude * (beta * log_xx / x_0 - exponent / x_0)\n        d_alpha = -amplitude * d_amplitude * log_xx\n        return [d_amplitude, d_x_0, d_alpha, d_beta]"},{"col":4,"comment":"null","endLoc":120,"header":"def pprint(self, max_lines, round_val)","id":12971,"name":"pprint","nodeType":"Function","startLoc":108,"text":"def pprint(self, max_lines, round_val):\n        longest_name = max([len(x) for x in self.param_names])\n        ret_str = 'standard deviations\\n'\n        fstring = '{0}{1}| {2}\\n'\n        for i, std in enumerate(self.stds):\n            if i <= max_lines-1:\n                param = self.param_names[i]\n                ret_str += fstring.format(param,\n                                          ' ' * (longest_name - len(param)),\n                                          str(np.round(std, round_val)))\n            else:\n                ret_str += '...'\n        return(ret_str.rstrip())"},{"col":4,"comment":"null","endLoc":505,"header":"@property\n    def input_units(self)","id":12972,"name":"input_units","nodeType":"Function","startLoc":501,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}"},{"col":4,"comment":"null","endLoc":509,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":12973,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":507,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":474,"id":12974,"name":"amplitude","nodeType":"Attribute","startLoc":474,"text":"amplitude"},{"attributeType":"null","col":8,"comment":"null","endLoc":461,"id":12975,"name":"_outputs","nodeType":"Attribute","startLoc":461,"text":"self._outputs"},{"col":4,"comment":"\n        Determine how many coefficients are needed\n\n        Returns\n        -------\n        numc : int\n            number of coefficients\n        ","endLoc":314,"header":"def get_num_coeff(self)","id":12976,"name":"get_num_coeff","nodeType":"Function","startLoc":301,"text":"def get_num_coeff(self):\n        \"\"\"\n        Determine how many coefficients are needed\n\n        Returns\n        -------\n        numc : int\n            number of coefficients\n        \"\"\"\n\n        if self.x_degree < 0 or self.y_degree < 0:\n            raise ValueError(\"Degree of polynomial must be positive or null\")\n\n        return (self.x_degree + 1) * (self.y_degree + 1)"},{"attributeType":"null","col":4,"comment":"null","endLoc":587,"id":12977,"name":"linear","nodeType":"Attribute","startLoc":587,"text":"linear"},{"attributeType":"null","col":4,"comment":"null","endLoc":588,"id":12978,"name":"fittable","nodeType":"Attribute","startLoc":588,"text":"fittable"},{"attributeType":"null","col":4,"comment":"null","endLoc":590,"id":12979,"name":"_has_inverse_bounding_box","nodeType":"Attribute","startLoc":590,"text":"_has_inverse_bounding_box"},{"className":"RedshiftScaleFactor","col":0,"comment":"\n    One dimensional redshift scale factor model.\n\n    Parameters\n    ----------\n    z : float\n        Redshift value.\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = x (1 + z)\n    ","endLoc":670,"id":12980,"nodeType":"Class","startLoc":623,"text":"class RedshiftScaleFactor(Fittable1DModel):\n    \"\"\"\n    One dimensional redshift scale factor model.\n\n    Parameters\n    ----------\n    z : float\n        Redshift value.\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = x (1 + z)\n    \"\"\"\n\n    z = Parameter(description='Redshift', default=0)\n\n    _has_inverse_bounding_box = True\n\n    @staticmethod\n    def evaluate(x, z):\n        \"\"\"One dimensional RedshiftScaleFactor model function\"\"\"\n\n        return (1 + z) * x\n\n    @staticmethod\n    def fit_deriv(x, z):\n        \"\"\"One dimensional RedshiftScaleFactor model derivative\"\"\"\n\n        d_z = x\n        return [d_z]\n\n    @property\n    def inverse(self):\n        \"\"\"Inverse RedshiftScaleFactor model\"\"\"\n\n        inv = self.copy()\n        inv.z = 1.0 / (1.0 + self.z) - 1.0\n\n        try:\n            self.bounding_box\n        except NotImplementedError:\n            pass\n        else:\n            inv.bounding_box = tuple(self.evaluate(x, self.z) for x in self.bounding_box.bounding_box())\n\n        return inv"},{"col":4,"comment":"One dimensional RedshiftScaleFactor model function","endLoc":647,"header":"@staticmethod\n    def evaluate(x, z)","id":12981,"name":"evaluate","nodeType":"Function","startLoc":643,"text":"@staticmethod\n    def evaluate(x, z):\n        \"\"\"One dimensional RedshiftScaleFactor model function\"\"\"\n\n        return (1 + z) * x"},{"col":4,"comment":"One dimensional RedshiftScaleFactor model derivative","endLoc":654,"header":"@staticmethod\n    def fit_deriv(x, z)","id":12982,"name":"fit_deriv","nodeType":"Function","startLoc":649,"text":"@staticmethod\n    def fit_deriv(x, z):\n        \"\"\"One dimensional RedshiftScaleFactor model derivative\"\"\"\n\n        d_z = x\n        return [d_z]"},{"col":4,"comment":"Inverse RedshiftScaleFactor model","endLoc":670,"header":"@property\n    def inverse(self)","id":12983,"name":"inverse","nodeType":"Function","startLoc":656,"text":"@property\n    def inverse(self):\n        \"\"\"Inverse RedshiftScaleFactor model\"\"\"\n\n        inv = self.copy()\n        inv.z = 1.0 / (1.0 + self.z) - 1.0\n\n        try:\n            self.bounding_box\n        except NotImplementedError:\n            pass\n        else:\n            inv.bounding_box = tuple(self.evaluate(x, self.z) for x in self.bounding_box.bounding_box())\n\n        return inv"},{"attributeType":"null","col":8,"comment":"null","endLoc":460,"id":12984,"name":"_inputs","nodeType":"Attribute","startLoc":460,"text":"self._inputs"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":475,"id":12985,"name":"x_0","nodeType":"Attribute","startLoc":475,"text":"x_0"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":12986,"name":"__all__","nodeType":"Attribute","startLoc":33,"text":"__all__"},{"col":0,"comment":"","endLoc":20,"header":"rotations.py#<anonymous>","id":12987,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nImplements rotations, including spherical rotations as defined in WCS Paper II\n[1]_\n\n`RotateNative2Celestial` and `RotateCelestial2Native` follow the convention in\nWCS Paper II to rotate to/from a native sphere and the celestial sphere.\n\nThe implementation uses `EulerAngleRotation`. The model parameters are\nthree angles: the longitude (``lon``) and latitude (``lat``) of the fiducial point\nin the celestial system (``CRVAL`` keywords in FITS), and the longitude of the celestial\npole in the native system (``lon_pole``). The Euler angles are ``lon+90``, ``90-lat``\nand ``-(lon_pole-90)``.\n\n\nReferences\n----------\n.. [1] Calabretta, M.R., Greisen, E.W., 2002, A&A, 395, 1077 (Paper II)\n\"\"\"\n\n__all__ = ['RotateCelestial2Native', 'RotateNative2Celestial', 'Rotation2D',\n           'EulerAngleRotation', 'RotationSequence3D', 'SphericalRotationSequence']"},{"fileName":"statistic.py","filePath":"astropy/modeling","id":12988,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nStatistic functions used in `~astropy.modeling.fitting`.\n\"\"\"\n# pylint: disable=invalid-name\nimport numpy as np\n\nfrom astropy.utils.decorators import format_doc\n\n__all__ = [\"leastsquare\", \"leastsquare_1d\", \"leastsquare_2d\", \"leastsquare_3d\"]\n\n\ndef leastsquare(measured_vals, updated_model, weights, *x):\n    \"\"\"Least square statistic, with optional weights, in N-dimensions.\n\n    Parameters\n    ----------\n    measured_vals : ndarray or sequence\n        Measured data values. Will be cast to array whose\n        shape must match the array-cast of the evaluated model.\n    updated_model : :class:`~astropy.modeling.Model` instance\n        Model with parameters set by the current iteration of the optimizer.\n        when evaluated on \"x\", must return array of shape \"measured_vals\"\n    weights : ndarray or None\n        Array of weights to apply to each residual.\n    *x : ndarray\n        Independent variables on which to evaluate the model.\n\n    Returns\n    -------\n    res : float\n        The sum of least squares.\n\n    See Also\n    --------\n    :func:`~astropy.modeling.statistic.leastsquare_1d`\n    :func:`~astropy.modeling.statistic.leastsquare_2d`\n    :func:`~astropy.modeling.statistic.leastsquare_3d`\n\n    Notes\n    -----\n    Models in :mod:`~astropy.modeling` have broadcasting rules that try to\n    match inputs with outputs with Model shapes. Numpy arrays have flexible\n    broadcasting rules, so mismatched shapes can often be made compatible. To\n    ensure data matches the model we must perform shape comparison and leverage\n    the Numpy arithmetic functions. This can obfuscate arithmetic computation\n    overrides, like with Quantities. Implement a custom statistic for more\n    direct control.\n\n    \"\"\"\n\n    model_vals = updated_model(*x)\n\n    if np.shape(model_vals) != np.shape(measured_vals):\n        message = \"Shape mismatch between model ({}) and measured ({})\"\n        raise ValueError(\n            message.format(np.shape(model_vals), np.shape(measured_vals))\n        )\n\n    if weights is None:\n        weights = 1.0\n\n    return np.sum(np.square(weights * np.subtract(model_vals, measured_vals)))\n\n\n# -------------------------------------------------------------------\n\ndef leastsquare_1d(measured_vals, updated_model, weights, x):\n    \"\"\"\n    Least square statistic with optional weights.\n    Safer than the general :func:`~astropy.modeling.statistic.leastsquare`\n    for 1D models by avoiding numpy methods that support broadcasting.\n\n    Parameters\n    ----------\n    measured_vals : ndarray\n        Measured data values.\n    updated_model : `~astropy.modeling.Model`\n        Model with parameters set by the current iteration of the optimizer.\n    weights : ndarray or None\n        Array of weights to apply to each residual.\n    x : ndarray\n        Independent variable \"x\" on which to evaluate the model.\n\n    Returns\n    -------\n    res : float\n        The sum of least squares.\n\n    See Also\n    --------\n    :func:`~astropy.modeling.statistic.leastsquare`\n\n    \"\"\"\n    model_vals = updated_model(x)\n\n    if weights is None:\n        return np.sum((model_vals - measured_vals) ** 2)\n    return np.sum((weights * (model_vals - measured_vals)) ** 2)\n\n\ndef leastsquare_2d(measured_vals, updated_model, weights, x, y):\n    \"\"\"\n    Least square statistic with optional weights.\n    Safer than the general :func:`~astropy.modeling.statistic.leastsquare`\n    for 2D models by avoiding numpy methods that support broadcasting.\n\n    Parameters\n    ----------\n    measured_vals : ndarray\n        Measured data values.\n    updated_model : `~astropy.modeling.Model`\n        Model with parameters set by the current iteration of the optimizer.\n    weights : ndarray or None\n        Array of weights to apply to each residual.\n    x : ndarray\n        Independent variable \"x\" on which to evaluate the model.\n    y : ndarray\n        Independent variable \"y\" on which to evaluate the model.\n\n    Returns\n    -------\n    res : float\n        The sum of least squares.\n\n    See Also\n    --------\n    :func:`~astropy.modeling.statistic.leastsquare`\n\n    \"\"\"\n    model_vals = updated_model(x, y)\n\n    if weights is None:\n        return np.sum((model_vals - measured_vals) ** 2)\n    return np.sum((weights * (model_vals - measured_vals)) ** 2)\n\n\ndef leastsquare_3d(measured_vals, updated_model, weights, x, y, z):\n    \"\"\"\n    Least square statistic with optional weights.\n    Safer than the general :func:`~astropy.modeling.statistic.leastsquare`\n    for 3D models by avoiding numpy methods that support broadcasting.\n\n    Parameters\n    ----------\n    measured_vals : ndarray\n        Measured data values.\n    updated_model : `~astropy.modeling.Model`\n        Model with parameters set by the current iteration of the optimizer.\n    weights : ndarray or None\n        Array of weights to apply to each residual.\n    x : ndarray\n        Independent variable \"x\" on which to evaluate the model.\n    y : ndarray\n        Independent variable \"y\" on which to evaluate the model.\n    z : ndarray\n        Independent variable \"z\" on which to evaluate the model.\n\n    Returns\n    -------\n    res : float\n        The sum of least squares.\n\n    See Also\n    --------\n    :func:`~astropy.modeling.statistic.leastsquare`\n\n    \"\"\"\n    model_vals = updated_model(x, y, z)\n\n    if weights is None:\n        return np.sum((model_vals - measured_vals) ** 2)\n    return np.sum((weights * (model_vals - measured_vals)) ** 2)\n"},{"col":4,"comment":"null","endLoc":385,"header":"def _generate_coeff_names(self)","id":12989,"name":"_generate_coeff_names","nodeType":"Function","startLoc":380,"text":"def _generate_coeff_names(self):\n        names = []\n        for j in range(self.y_degree + 1):\n            for i in range(self.x_degree + 1):\n                names.append(f'c{i}_{j}')\n        return tuple(names)"},{"col":0,"comment":"\n    Least square statistic with optional weights.\n    Safer than the general :func:`~astropy.modeling.statistic.leastsquare`\n    for 1D models by avoiding numpy methods that support broadcasting.\n\n    Parameters\n    ----------\n    measured_vals : ndarray\n        Measured data values.\n    updated_model : `~astropy.modeling.Model`\n        Model with parameters set by the current iteration of the optimizer.\n    weights : ndarray or None\n        Array of weights to apply to each residual.\n    x : ndarray\n        Independent variable \"x\" on which to evaluate the model.\n\n    Returns\n    -------\n    res : float\n        The sum of least squares.\n\n    See Also\n    --------\n    :func:`~astropy.modeling.statistic.leastsquare`\n\n    ","endLoc":100,"header":"def leastsquare_1d(measured_vals, updated_model, weights, x)","id":12990,"name":"leastsquare_1d","nodeType":"Function","startLoc":69,"text":"def leastsquare_1d(measured_vals, updated_model, weights, x):\n    \"\"\"\n    Least square statistic with optional weights.\n    Safer than the general :func:`~astropy.modeling.statistic.leastsquare`\n    for 1D models by avoiding numpy methods that support broadcasting.\n\n    Parameters\n    ----------\n    measured_vals : ndarray\n        Measured data values.\n    updated_model : `~astropy.modeling.Model`\n        Model with parameters set by the current iteration of the optimizer.\n    weights : ndarray or None\n        Array of weights to apply to each residual.\n    x : ndarray\n        Independent variable \"x\" on which to evaluate the model.\n\n    Returns\n    -------\n    res : float\n        The sum of least squares.\n\n    See Also\n    --------\n    :func:`~astropy.modeling.statistic.leastsquare`\n\n    \"\"\"\n    model_vals = updated_model(x)\n\n    if weights is None:\n        return np.sum((model_vals - measured_vals) ** 2)\n    return np.sum((weights * (model_vals - measured_vals)) ** 2)"},{"col":0,"comment":"\n    Least square statistic with optional weights.\n    Safer than the general :func:`~astropy.modeling.statistic.leastsquare`\n    for 2D models by avoiding numpy methods that support broadcasting.\n\n    Parameters\n    ----------\n    measured_vals : ndarray\n        Measured data values.\n    updated_model : `~astropy.modeling.Model`\n        Model with parameters set by the current iteration of the optimizer.\n    weights : ndarray or None\n        Array of weights to apply to each residual.\n    x : ndarray\n        Independent variable \"x\" on which to evaluate the model.\n    y : ndarray\n        Independent variable \"y\" on which to evaluate the model.\n\n    Returns\n    -------\n    res : float\n        The sum of least squares.\n\n    See Also\n    --------\n    :func:`~astropy.modeling.statistic.leastsquare`\n\n    ","endLoc":136,"header":"def leastsquare_2d(measured_vals, updated_model, weights, x, y)","id":12991,"name":"leastsquare_2d","nodeType":"Function","startLoc":103,"text":"def leastsquare_2d(measured_vals, updated_model, weights, x, y):\n    \"\"\"\n    Least square statistic with optional weights.\n    Safer than the general :func:`~astropy.modeling.statistic.leastsquare`\n    for 2D models by avoiding numpy methods that support broadcasting.\n\n    Parameters\n    ----------\n    measured_vals : ndarray\n        Measured data values.\n    updated_model : `~astropy.modeling.Model`\n        Model with parameters set by the current iteration of the optimizer.\n    weights : ndarray or None\n        Array of weights to apply to each residual.\n    x : ndarray\n        Independent variable \"x\" on which to evaluate the model.\n    y : ndarray\n        Independent variable \"y\" on which to evaluate the model.\n\n    Returns\n    -------\n    res : float\n        The sum of least squares.\n\n    See Also\n    --------\n    :func:`~astropy.modeling.statistic.leastsquare`\n\n    \"\"\"\n    model_vals = updated_model(x, y)\n\n    if weights is None:\n        return np.sum((model_vals - measured_vals) ** 2)\n    return np.sum((weights * (model_vals - measured_vals)) ** 2)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":639,"id":12992,"name":"z","nodeType":"Attribute","startLoc":639,"text":"z"},{"col":0,"comment":"\n    Least square statistic with optional weights.\n    Safer than the general :func:`~astropy.modeling.statistic.leastsquare`\n    for 3D models by avoiding numpy methods that support broadcasting.\n\n    Parameters\n    ----------\n    measured_vals : ndarray\n        Measured data values.\n    updated_model : `~astropy.modeling.Model`\n        Model with parameters set by the current iteration of the optimizer.\n    weights : ndarray or None\n        Array of weights to apply to each residual.\n    x : ndarray\n        Independent variable \"x\" on which to evaluate the model.\n    y : ndarray\n        Independent variable \"y\" on which to evaluate the model.\n    z : ndarray\n        Independent variable \"z\" on which to evaluate the model.\n\n    Returns\n    -------\n    res : float\n        The sum of least squares.\n\n    See Also\n    --------\n    :func:`~astropy.modeling.statistic.leastsquare`\n\n    ","endLoc":174,"header":"def leastsquare_3d(measured_vals, updated_model, weights, x, y, z)","id":12993,"name":"leastsquare_3d","nodeType":"Function","startLoc":139,"text":"def leastsquare_3d(measured_vals, updated_model, weights, x, y, z):\n    \"\"\"\n    Least square statistic with optional weights.\n    Safer than the general :func:`~astropy.modeling.statistic.leastsquare`\n    for 3D models by avoiding numpy methods that support broadcasting.\n\n    Parameters\n    ----------\n    measured_vals : ndarray\n        Measured data values.\n    updated_model : `~astropy.modeling.Model`\n        Model with parameters set by the current iteration of the optimizer.\n    weights : ndarray or None\n        Array of weights to apply to each residual.\n    x : ndarray\n        Independent variable \"x\" on which to evaluate the model.\n    y : ndarray\n        Independent variable \"y\" on which to evaluate the model.\n    z : ndarray\n        Independent variable \"z\" on which to evaluate the model.\n\n    Returns\n    -------\n    res : float\n        The sum of least squares.\n\n    See Also\n    --------\n    :func:`~astropy.modeling.statistic.leastsquare`\n\n    \"\"\"\n    model_vals = updated_model(x, y, z)\n\n    if weights is None:\n        return np.sum((model_vals - measured_vals) ** 2)\n    return np.sum((weights * (model_vals - measured_vals)) ** 2)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":476,"id":12994,"name":"alpha","nodeType":"Attribute","startLoc":476,"text":"alpha"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":12995,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"statistic.py#<anonymous>","id":12996,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nStatistic functions used in `~astropy.modeling.fitting`.\n\"\"\"\n\n__all__ = [\"leastsquare\", \"leastsquare_1d\", \"leastsquare_2d\", \"leastsquare_3d\"]"},{"attributeType":"null","col":4,"comment":"null","endLoc":641,"id":12997,"name":"_has_inverse_bounding_box","nodeType":"Attribute","startLoc":641,"text":"_has_inverse_bounding_box"},{"className":"Sersic1D","col":0,"comment":"\n    One dimensional Sersic surface brightness profile.\n\n    Parameters\n    ----------\n    amplitude : float\n        Surface brightness at r_eff.\n    r_eff : float\n        Effective (half-light) radius\n    n : float\n        Sersic Index.\n\n    See Also\n    --------\n    Gaussian1D, Moffat1D, Lorentz1D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        I(r)=I_e\\exp\\left\\{-b_n\\left[\\left(\\frac{r}{r_{e}}\\right)^{(1/n)}-1\\right]\\right\\}\n\n    The constant :math:`b_n` is defined such that :math:`r_e` contains half the total\n    luminosity, and can be solved for numerically.\n\n    .. math::\n\n        \\Gamma(2n) = 2\\gamma (b_n,2n)\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        from astropy.modeling.models import Sersic1D\n        import matplotlib.pyplot as plt\n\n        plt.figure()\n        plt.subplot(111, xscale='log', yscale='log')\n        s1 = Sersic1D(amplitude=1, r_eff=5)\n        r=np.arange(0, 100, .01)\n\n        for n in range(1, 10):\n             s1.n = n\n             plt.plot(r, s1(r), color=str(float(n) / 15))\n\n        plt.axis([1e-1, 30, 1e-2, 1e3])\n        plt.xlabel('log Radius')\n        plt.ylabel('log Surface Brightness')\n        plt.text(.25, 1.5, 'n=1')\n        plt.text(.25, 300, 'n=10')\n        plt.xticks([])\n        plt.yticks([])\n        plt.show()\n\n    References\n    ----------\n    .. [1] http://ned.ipac.caltech.edu/level5/March05/Graham/Graham2.html\n    ","endLoc":761,"id":12998,"nodeType":"Class","startLoc":673,"text":"class Sersic1D(Fittable1DModel):\n    r\"\"\"\n    One dimensional Sersic surface brightness profile.\n\n    Parameters\n    ----------\n    amplitude : float\n        Surface brightness at r_eff.\n    r_eff : float\n        Effective (half-light) radius\n    n : float\n        Sersic Index.\n\n    See Also\n    --------\n    Gaussian1D, Moffat1D, Lorentz1D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        I(r)=I_e\\exp\\left\\{-b_n\\left[\\left(\\frac{r}{r_{e}}\\right)^{(1/n)}-1\\right]\\right\\}\n\n    The constant :math:`b_n` is defined such that :math:`r_e` contains half the total\n    luminosity, and can be solved for numerically.\n\n    .. math::\n\n        \\Gamma(2n) = 2\\gamma (b_n,2n)\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        from astropy.modeling.models import Sersic1D\n        import matplotlib.pyplot as plt\n\n        plt.figure()\n        plt.subplot(111, xscale='log', yscale='log')\n        s1 = Sersic1D(amplitude=1, r_eff=5)\n        r=np.arange(0, 100, .01)\n\n        for n in range(1, 10):\n             s1.n = n\n             plt.plot(r, s1(r), color=str(float(n) / 15))\n\n        plt.axis([1e-1, 30, 1e-2, 1e3])\n        plt.xlabel('log Radius')\n        plt.ylabel('log Surface Brightness')\n        plt.text(.25, 1.5, 'n=1')\n        plt.text(.25, 300, 'n=10')\n        plt.xticks([])\n        plt.yticks([])\n        plt.show()\n\n    References\n    ----------\n    .. [1] http://ned.ipac.caltech.edu/level5/March05/Graham/Graham2.html\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Surface brightness at r_eff\")\n    r_eff = Parameter(default=1, description=\"Effective (half-light) radius\")\n    n = Parameter(default=4, description=\"Sersic Index\")\n    _gammaincinv = None\n\n    @classmethod\n    def evaluate(cls, r, amplitude, r_eff, n):\n        \"\"\"One dimensional Sersic profile function.\"\"\"\n\n        if cls._gammaincinv is None:\n            from scipy.special import gammaincinv\n            cls._gammaincinv = gammaincinv\n\n        return (amplitude * np.exp(\n            -cls._gammaincinv(2 * n, 0.5) * ((r / r_eff) ** (1 / n) - 1)))\n\n    @property\n    def input_units(self):\n        if self.r_eff.unit is None:\n            return None\n        return {self.inputs[0]: self.r_eff.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'r_eff': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"fileName":"tabular.py","filePath":"astropy/modeling","id":12999,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nTabular models.\n\nTabular models of any dimension can be created using `tabular_model`.\nFor convenience `Tabular1D` and `Tabular2D` are provided.\n\nExamples\n--------\n>>> table = np.array([[ 3.,  0.,  0.],\n...                  [ 0.,  2.,  0.],\n...                  [ 0.,  0.,  0.]])\n>>> points = ([1, 2, 3], [1, 2, 3])\n>>> t2 = Tabular2D(points, lookup_table=table, bounds_error=False,\n...                fill_value=None, method='nearest')\n\n\"\"\"\n# pylint: disable=invalid-name\nimport abc\n\nimport numpy as np\n\nfrom astropy import units as u\nfrom .core import Model\n\ntry:\n    from scipy.interpolate import interpn\n    has_scipy = True\nexcept ImportError:\n    has_scipy = False\n\n__all__ = ['tabular_model', 'Tabular1D', 'Tabular2D']\n\n__doctest_requires__ = {('tabular_model'): ['scipy']}\n\n\nclass _Tabular(Model):\n    \"\"\"\n    Returns an interpolated lookup table value.\n\n    Parameters\n    ----------\n    points : tuple of ndarray of float, optional\n        The points defining the regular grid in n dimensions.\n        ndarray must have shapes (m1, ), ..., (mn, ),\n    lookup_table : array-like\n        The data on a regular grid in n dimensions.\n        Must have shapes (m1, ..., mn, ...)\n    method : str, optional\n        The method of interpolation to perform. Supported are \"linear\" and\n        \"nearest\", and \"splinef2d\". \"splinef2d\" is only supported for\n        2-dimensional data. Default is \"linear\".\n    bounds_error : bool, optional\n        If True, when interpolated values are requested outside of the\n        domain of the input data, a ValueError is raised.\n        If False, then ``fill_value`` is used.\n    fill_value : float or `~astropy.units.Quantity`, optional\n        If provided, the value to use for points outside of the\n        interpolation domain. If None, values outside\n        the domain are extrapolated.  Extrapolation is not supported by method\n        \"splinef2d\". If Quantity is given, it will be converted to the unit of\n        ``lookup_table``, if applicable.\n\n    Returns\n    -------\n    value : ndarray\n        Interpolated values at input coordinates.\n\n    Raises\n    ------\n    ImportError\n        Scipy is not installed.\n\n    Notes\n    -----\n    Uses `scipy.interpolate.interpn`.\n\n    \"\"\"\n\n    linear = False\n    fittable = False\n\n    standard_broadcasting = False\n\n    _is_dynamic = True\n\n    _id = 0\n\n    def __init__(self, points=None, lookup_table=None, method='linear',\n                 bounds_error=True, fill_value=np.nan, **kwargs):\n\n        n_models = kwargs.get('n_models', 1)\n        if n_models > 1:\n            raise NotImplementedError('Only n_models=1 is supported.')\n        super().__init__(**kwargs)\n        self.outputs = (\"y\",)\n        if lookup_table is None:\n            raise ValueError('Must provide a lookup table.')\n\n        if not isinstance(lookup_table, u.Quantity):\n            lookup_table = np.asarray(lookup_table)\n\n        if self.lookup_table.ndim != lookup_table.ndim:\n            raise ValueError(\"lookup_table should be an array with \"\n                             \"{} dimensions.\".format(self.lookup_table.ndim))\n\n        if points is None:\n            points = tuple(np.arange(x, dtype=float)\n                           for x in lookup_table.shape)\n        else:\n            if lookup_table.ndim == 1 and not isinstance(points, tuple):\n                points = (points,)\n            npts = len(points)\n            if npts != lookup_table.ndim:\n                raise ValueError(\n                    \"Expected grid points in \"\n                    \"{} directions, got {}.\".format(lookup_table.ndim, npts))\n            if (npts > 1 and isinstance(points[0], u.Quantity) and\n                    len(set([getattr(p, 'unit', None) for p in points])) > 1):\n                raise ValueError('points must all have the same unit.')\n\n        if isinstance(fill_value, u.Quantity):\n            if not isinstance(lookup_table, u.Quantity):\n                raise ValueError('fill value is in {} but expected to be '\n                                 'unitless.'.format(fill_value.unit))\n            fill_value = fill_value.to(lookup_table.unit).value\n\n        self.points = points\n        self.lookup_table = lookup_table\n        self.bounds_error = bounds_error\n        self.method = method\n        self.fill_value = fill_value\n\n    def __repr__(self):\n        return \"<{}(points={}, lookup_table={})>\".format(\n            self.__class__.__name__, self.points, self.lookup_table)\n\n    def __str__(self):\n        default_keywords = [\n            ('Model', self.__class__.__name__),\n            ('Name', self.name),\n            ('N_inputs', self.n_inputs),\n            ('N_outputs', self.n_outputs),\n            ('Parameters', \"\"),\n            ('  points', self.points),\n            ('  lookup_table', self.lookup_table),\n            ('  method', self.method),\n            ('  fill_value', self.fill_value),\n            ('  bounds_error', self.bounds_error)\n        ]\n\n        parts = [f'{keyword}: {value}'\n                 for keyword, value in default_keywords\n                 if value is not None]\n\n        return '\\n'.join(parts)\n\n    @property\n    def input_units(self):\n        pts = self.points[0]\n        if not isinstance(pts, u.Quantity):\n            return None\n        return dict([(x, pts.unit) for x in self.inputs])\n\n    @property\n    def return_units(self):\n        if not isinstance(self.lookup_table, u.Quantity):\n            return None\n        return {self.outputs[0]: self.lookup_table.unit}\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(points_low, points_high)``.\n\n        Examples\n        --------\n        >>> from astropy.modeling.models import Tabular1D, Tabular2D\n        >>> t1 = Tabular1D(points=[1, 2, 3], lookup_table=[10, 20, 30])\n        >>> t1.bounding_box\n        ModelBoundingBox(\n            intervals={\n                x: Interval(lower=1, upper=3)\n            }\n            model=Tabular1D(inputs=('x',))\n            order='C'\n        )\n        >>> t2 = Tabular2D(points=[[1, 2, 3], [2, 3, 4]],\n        ...                lookup_table=[[10, 20, 30], [20, 30, 40]])\n        >>> t2.bounding_box\n        ModelBoundingBox(\n            intervals={\n                x: Interval(lower=1, upper=3)\n                y: Interval(lower=2, upper=4)\n            }\n            model=Tabular2D(inputs=('x', 'y'))\n            order='C'\n        )\n\n        \"\"\"\n        bbox = [(min(p), max(p)) for p in self.points][::-1]\n        if len(bbox) == 1:\n            bbox = bbox[0]\n        return bbox\n\n    def evaluate(self, *inputs):\n        \"\"\"\n        Return the interpolated values at the input coordinates.\n\n        Parameters\n        ----------\n        inputs : list of scalar or list of ndarray\n            Input coordinates. The number of inputs must be equal\n            to the dimensions of the lookup table.\n        \"\"\"\n        inputs = np.broadcast_arrays(*inputs)\n\n        shape = inputs[0].shape\n        inputs = [inp.flatten() for inp in inputs[: self.n_inputs]]\n        inputs = np.array(inputs).T\n        if not has_scipy:  # pragma: no cover\n            raise ImportError(\"Tabular model requires scipy.\")\n        result = interpn(self.points, self.lookup_table, inputs,\n                         method=self.method, bounds_error=self.bounds_error,\n                         fill_value=self.fill_value)\n\n        # return_units not respected when points has no units\n        if (isinstance(self.lookup_table, u.Quantity) and\n                not isinstance(self.points[0], u.Quantity)):\n            result = result * self.lookup_table.unit\n\n        if self.n_outputs == 1:\n            result = result.reshape(shape)\n        else:\n            result = [r.reshape(shape) for r in result]\n        return result\n\n    @property\n    def inverse(self):\n        if self.n_inputs == 1:\n            # If the wavelength array is descending instead of ascending, both\n            # points and lookup_table need to be reversed in the inverse transform\n            # for scipy.interpolate to work properly\n            if np.all(np.diff(self.lookup_table) > 0):\n                # ascending case\n                points = self.lookup_table\n                lookup_table = self.points[0]\n            elif np.all(np.diff(self.lookup_table) < 0):\n                # descending case, reverse order\n                points = self.lookup_table[::-1]\n                lookup_table = self.points[0][::-1]\n            else:\n                # equal-valued or double-valued lookup_table\n                raise NotImplementedError\n            return Tabular1D(points=points, lookup_table=lookup_table, method=self.method,\n                             bounds_error=self.bounds_error, fill_value=self.fill_value)\n        raise NotImplementedError(\"An analytical inverse transform \"\n                                  \"has not been implemented for this model.\")\n\n\ndef tabular_model(dim, name=None):\n    \"\"\"\n    Make a ``Tabular`` model where ``n_inputs`` is\n    based on the dimension of the lookup_table.\n\n    This model has to be further initialized and when evaluated\n    returns the interpolated values.\n\n    Parameters\n    ----------\n    dim : int\n        Dimensions of the lookup table.\n    name : str\n        Name for the class.\n\n    Examples\n    --------\n    >>> table = np.array([[3., 0., 0.],\n    ...                   [0., 2., 0.],\n    ...                   [0., 0., 0.]])\n\n    >>> tab = tabular_model(2, name='Tabular2D')\n    >>> print(tab)\n    <class 'astropy.modeling.tabular.Tabular2D'>\n    Name: Tabular2D\n    N_inputs: 2\n    N_outputs: 1\n\n    >>> points = ([1, 2, 3], [1, 2, 3])\n\n    Setting fill_value to None, allows extrapolation.\n    >>> m = tab(points, lookup_table=table, name='my_table',\n    ...         bounds_error=False, fill_value=None, method='nearest')\n\n    >>> xinterp = [0, 1, 1.5, 2.72, 3.14]\n    >>> m(xinterp, xinterp)  # doctest: +FLOAT_CMP\n    array([3., 3., 3., 0., 0.])\n\n    \"\"\"\n    if dim < 1:\n        raise ValueError('Lookup table must have at least one dimension.')\n\n    table = np.zeros([2] * dim)\n    members = {'lookup_table': table, 'n_inputs': dim, 'n_outputs': 1}\n\n    if dim == 1:\n        members['_separable'] = True\n    else:\n        members['_separable'] = False\n\n    if name is None:\n        model_id = _Tabular._id\n        _Tabular._id += 1\n        name = f'Tabular{model_id}'\n\n    model_class = type(str(name), (_Tabular,), members)\n    model_class.__module__ = 'astropy.modeling.tabular'\n    return model_class\n\n\nTabular1D = tabular_model(1, name='Tabular1D')\n\nTabular2D = tabular_model(2, name='Tabular2D')\n\n_tab_docs = \"\"\"\n    method : str, optional\n        The method of interpolation to perform. Supported are \"linear\" and\n        \"nearest\", and \"splinef2d\". \"splinef2d\" is only supported for\n        2-dimensional data. Default is \"linear\".\n    bounds_error : bool, optional\n        If True, when interpolated values are requested outside of the\n        domain of the input data, a ValueError is raised.\n        If False, then ``fill_value`` is used.\n    fill_value : float, optional\n        If provided, the value to use for points outside of the\n        interpolation domain. If None, values outside\n        the domain are extrapolated.  Extrapolation is not supported by method\n        \"splinef2d\".\n\n    Returns\n    -------\n    value : ndarray\n        Interpolated values at input coordinates.\n\n    Raises\n    ------\n    ImportError\n        Scipy is not installed.\n\n    Notes\n    -----\n    Uses `scipy.interpolate.interpn`.\n\"\"\"\n\nTabular1D.__doc__ = \"\"\"\n    Tabular model in 1D.\n    Returns an interpolated lookup table value.\n\n    Parameters\n    ----------\n    points : array-like of float of ndim=1.\n        The points defining the regular grid in n dimensions.\n    lookup_table : array-like, of ndim=1.\n        The data in one dimensions.\n\"\"\" + _tab_docs\n\nTabular2D.__doc__ = \"\"\"\n    Tabular model in 2D.\n    Returns an interpolated lookup table value.\n\n    Parameters\n    ----------\n    points : tuple of ndarray of float, optional\n        The points defining the regular grid in n dimensions.\n        ndarray with shapes (m1, m2).\n    lookup_table : array-like\n        The data on a regular grid in 2 dimensions.\n        Shape (m1, m2).\n\n\"\"\" + _tab_docs\n"},{"col":4,"comment":"One dimensional Sersic profile function.","endLoc":751,"header":"@classmethod\n    def evaluate(cls, r, amplitude, r_eff, n)","id":13000,"name":"evaluate","nodeType":"Function","startLoc":742,"text":"@classmethod\n    def evaluate(cls, r, amplitude, r_eff, n):\n        \"\"\"One dimensional Sersic profile function.\"\"\"\n\n        if cls._gammaincinv is None:\n            from scipy.special import gammaincinv\n            cls._gammaincinv = gammaincinv\n\n        return (amplitude * np.exp(\n            -cls._gammaincinv(2 * n, 0.5) * ((r / r_eff) ** (1 / n) - 1)))"},{"className":"_Tabular","col":0,"comment":"\n    Returns an interpolated lookup table value.\n\n    Parameters\n    ----------\n    points : tuple of ndarray of float, optional\n        The points defining the regular grid in n dimensions.\n        ndarray must have shapes (m1, ), ..., (mn, ),\n    lookup_table : array-like\n        The data on a regular grid in n dimensions.\n        Must have shapes (m1, ..., mn, ...)\n    method : str, optional\n        The method of interpolation to perform. Supported are \"linear\" and\n        \"nearest\", and \"splinef2d\". \"splinef2d\" is only supported for\n        2-dimensional data. Default is \"linear\".\n    bounds_error : bool, optional\n        If True, when interpolated values are requested outside of the\n        domain of the input data, a ValueError is raised.\n        If False, then ``fill_value`` is used.\n    fill_value : float or `~astropy.units.Quantity`, optional\n        If provided, the value to use for points outside of the\n        interpolation domain. If None, values outside\n        the domain are extrapolated.  Extrapolation is not supported by method\n        \"splinef2d\". If Quantity is given, it will be converted to the unit of\n        ``lookup_table``, if applicable.\n\n    Returns\n    -------\n    value : ndarray\n        Interpolated values at input coordinates.\n\n    Raises\n    ------\n    ImportError\n        Scipy is not installed.\n\n    Notes\n    -----\n    Uses `scipy.interpolate.interpn`.\n\n    ","endLoc":260,"id":13001,"nodeType":"Class","startLoc":38,"text":"class _Tabular(Model):\n    \"\"\"\n    Returns an interpolated lookup table value.\n\n    Parameters\n    ----------\n    points : tuple of ndarray of float, optional\n        The points defining the regular grid in n dimensions.\n        ndarray must have shapes (m1, ), ..., (mn, ),\n    lookup_table : array-like\n        The data on a regular grid in n dimensions.\n        Must have shapes (m1, ..., mn, ...)\n    method : str, optional\n        The method of interpolation to perform. Supported are \"linear\" and\n        \"nearest\", and \"splinef2d\". \"splinef2d\" is only supported for\n        2-dimensional data. Default is \"linear\".\n    bounds_error : bool, optional\n        If True, when interpolated values are requested outside of the\n        domain of the input data, a ValueError is raised.\n        If False, then ``fill_value`` is used.\n    fill_value : float or `~astropy.units.Quantity`, optional\n        If provided, the value to use for points outside of the\n        interpolation domain. If None, values outside\n        the domain are extrapolated.  Extrapolation is not supported by method\n        \"splinef2d\". If Quantity is given, it will be converted to the unit of\n        ``lookup_table``, if applicable.\n\n    Returns\n    -------\n    value : ndarray\n        Interpolated values at input coordinates.\n\n    Raises\n    ------\n    ImportError\n        Scipy is not installed.\n\n    Notes\n    -----\n    Uses `scipy.interpolate.interpn`.\n\n    \"\"\"\n\n    linear = False\n    fittable = False\n\n    standard_broadcasting = False\n\n    _is_dynamic = True\n\n    _id = 0\n\n    def __init__(self, points=None, lookup_table=None, method='linear',\n                 bounds_error=True, fill_value=np.nan, **kwargs):\n\n        n_models = kwargs.get('n_models', 1)\n        if n_models > 1:\n            raise NotImplementedError('Only n_models=1 is supported.')\n        super().__init__(**kwargs)\n        self.outputs = (\"y\",)\n        if lookup_table is None:\n            raise ValueError('Must provide a lookup table.')\n\n        if not isinstance(lookup_table, u.Quantity):\n            lookup_table = np.asarray(lookup_table)\n\n        if self.lookup_table.ndim != lookup_table.ndim:\n            raise ValueError(\"lookup_table should be an array with \"\n                             \"{} dimensions.\".format(self.lookup_table.ndim))\n\n        if points is None:\n            points = tuple(np.arange(x, dtype=float)\n                           for x in lookup_table.shape)\n        else:\n            if lookup_table.ndim == 1 and not isinstance(points, tuple):\n                points = (points,)\n            npts = len(points)\n            if npts != lookup_table.ndim:\n                raise ValueError(\n                    \"Expected grid points in \"\n                    \"{} directions, got {}.\".format(lookup_table.ndim, npts))\n            if (npts > 1 and isinstance(points[0], u.Quantity) and\n                    len(set([getattr(p, 'unit', None) for p in points])) > 1):\n                raise ValueError('points must all have the same unit.')\n\n        if isinstance(fill_value, u.Quantity):\n            if not isinstance(lookup_table, u.Quantity):\n                raise ValueError('fill value is in {} but expected to be '\n                                 'unitless.'.format(fill_value.unit))\n            fill_value = fill_value.to(lookup_table.unit).value\n\n        self.points = points\n        self.lookup_table = lookup_table\n        self.bounds_error = bounds_error\n        self.method = method\n        self.fill_value = fill_value\n\n    def __repr__(self):\n        return \"<{}(points={}, lookup_table={})>\".format(\n            self.__class__.__name__, self.points, self.lookup_table)\n\n    def __str__(self):\n        default_keywords = [\n            ('Model', self.__class__.__name__),\n            ('Name', self.name),\n            ('N_inputs', self.n_inputs),\n            ('N_outputs', self.n_outputs),\n            ('Parameters', \"\"),\n            ('  points', self.points),\n            ('  lookup_table', self.lookup_table),\n            ('  method', self.method),\n            ('  fill_value', self.fill_value),\n            ('  bounds_error', self.bounds_error)\n        ]\n\n        parts = [f'{keyword}: {value}'\n                 for keyword, value in default_keywords\n                 if value is not None]\n\n        return '\\n'.join(parts)\n\n    @property\n    def input_units(self):\n        pts = self.points[0]\n        if not isinstance(pts, u.Quantity):\n            return None\n        return dict([(x, pts.unit) for x in self.inputs])\n\n    @property\n    def return_units(self):\n        if not isinstance(self.lookup_table, u.Quantity):\n            return None\n        return {self.outputs[0]: self.lookup_table.unit}\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(points_low, points_high)``.\n\n        Examples\n        --------\n        >>> from astropy.modeling.models import Tabular1D, Tabular2D\n        >>> t1 = Tabular1D(points=[1, 2, 3], lookup_table=[10, 20, 30])\n        >>> t1.bounding_box\n        ModelBoundingBox(\n            intervals={\n                x: Interval(lower=1, upper=3)\n            }\n            model=Tabular1D(inputs=('x',))\n            order='C'\n        )\n        >>> t2 = Tabular2D(points=[[1, 2, 3], [2, 3, 4]],\n        ...                lookup_table=[[10, 20, 30], [20, 30, 40]])\n        >>> t2.bounding_box\n        ModelBoundingBox(\n            intervals={\n                x: Interval(lower=1, upper=3)\n                y: Interval(lower=2, upper=4)\n            }\n            model=Tabular2D(inputs=('x', 'y'))\n            order='C'\n        )\n\n        \"\"\"\n        bbox = [(min(p), max(p)) for p in self.points][::-1]\n        if len(bbox) == 1:\n            bbox = bbox[0]\n        return bbox\n\n    def evaluate(self, *inputs):\n        \"\"\"\n        Return the interpolated values at the input coordinates.\n\n        Parameters\n        ----------\n        inputs : list of scalar or list of ndarray\n            Input coordinates. The number of inputs must be equal\n            to the dimensions of the lookup table.\n        \"\"\"\n        inputs = np.broadcast_arrays(*inputs)\n\n        shape = inputs[0].shape\n        inputs = [inp.flatten() for inp in inputs[: self.n_inputs]]\n        inputs = np.array(inputs).T\n        if not has_scipy:  # pragma: no cover\n            raise ImportError(\"Tabular model requires scipy.\")\n        result = interpn(self.points, self.lookup_table, inputs,\n                         method=self.method, bounds_error=self.bounds_error,\n                         fill_value=self.fill_value)\n\n        # return_units not respected when points has no units\n        if (isinstance(self.lookup_table, u.Quantity) and\n                not isinstance(self.points[0], u.Quantity)):\n            result = result * self.lookup_table.unit\n\n        if self.n_outputs == 1:\n            result = result.reshape(shape)\n        else:\n            result = [r.reshape(shape) for r in result]\n        return result\n\n    @property\n    def inverse(self):\n        if self.n_inputs == 1:\n            # If the wavelength array is descending instead of ascending, both\n            # points and lookup_table need to be reversed in the inverse transform\n            # for scipy.interpolate to work properly\n            if np.all(np.diff(self.lookup_table) > 0):\n                # ascending case\n                points = self.lookup_table\n                lookup_table = self.points[0]\n            elif np.all(np.diff(self.lookup_table) < 0):\n                # descending case, reverse order\n                points = self.lookup_table[::-1]\n                lookup_table = self.points[0][::-1]\n            else:\n                # equal-valued or double-valued lookup_table\n                raise NotImplementedError\n            return Tabular1D(points=points, lookup_table=lookup_table, method=self.method,\n                             bounds_error=self.bounds_error, fill_value=self.fill_value)\n        raise NotImplementedError(\"An analytical inverse transform \"\n                                  \"has not been implemented for this model.\")"},{"col":4,"comment":"null","endLoc":133,"header":"def __init__(self, points=None, lookup_table=None, method='linear',\n                 bounds_error=True, fill_value=np.nan, **kwargs)","id":13002,"name":"__init__","nodeType":"Function","startLoc":90,"text":"def __init__(self, points=None, lookup_table=None, method='linear',\n                 bounds_error=True, fill_value=np.nan, **kwargs):\n\n        n_models = kwargs.get('n_models', 1)\n        if n_models > 1:\n            raise NotImplementedError('Only n_models=1 is supported.')\n        super().__init__(**kwargs)\n        self.outputs = (\"y\",)\n        if lookup_table is None:\n            raise ValueError('Must provide a lookup table.')\n\n        if not isinstance(lookup_table, u.Quantity):\n            lookup_table = np.asarray(lookup_table)\n\n        if self.lookup_table.ndim != lookup_table.ndim:\n            raise ValueError(\"lookup_table should be an array with \"\n                             \"{} dimensions.\".format(self.lookup_table.ndim))\n\n        if points is None:\n            points = tuple(np.arange(x, dtype=float)\n                           for x in lookup_table.shape)\n        else:\n            if lookup_table.ndim == 1 and not isinstance(points, tuple):\n                points = (points,)\n            npts = len(points)\n            if npts != lookup_table.ndim:\n                raise ValueError(\n                    \"Expected grid points in \"\n                    \"{} directions, got {}.\".format(lookup_table.ndim, npts))\n            if (npts > 1 and isinstance(points[0], u.Quantity) and\n                    len(set([getattr(p, 'unit', None) for p in points])) > 1):\n                raise ValueError('points must all have the same unit.')\n\n        if isinstance(fill_value, u.Quantity):\n            if not isinstance(lookup_table, u.Quantity):\n                raise ValueError('fill value is in {} but expected to be '\n                                 'unitless.'.format(fill_value.unit))\n            fill_value = fill_value.to(lookup_table.unit).value\n\n        self.points = points\n        self.lookup_table = lookup_table\n        self.bounds_error = bounds_error\n        self.method = method\n        self.fill_value = fill_value"},{"col":4,"comment":"null","endLoc":123,"header":"def __repr__(self)","id":13003,"name":"__repr__","nodeType":"Function","startLoc":122,"text":"def __repr__(self):\n        return(self.pprint(max_lines=10, round_val=3))"},{"col":4,"comment":"null","endLoc":93,"header":"def validate(self, value)","id":13004,"name":"validate","nodeType":"Function","startLoc":91,"text":"def validate(self, value):\n        super().validate(value)\n        self.dirty = True"},{"col":4,"comment":"null","endLoc":757,"header":"@property\n    def input_units(self)","id":13005,"name":"input_units","nodeType":"Function","startLoc":753,"text":"@property\n    def input_units(self):\n        if self.r_eff.unit is None:\n            return None\n        return {self.inputs[0]: self.r_eff.unit}"},{"col":4,"comment":"null","endLoc":761,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13006,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":759,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'r_eff': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":737,"id":13007,"name":"amplitude","nodeType":"Attribute","startLoc":737,"text":"amplitude"},{"attributeType":"null","col":8,"comment":"null","endLoc":89,"id":13008,"name":"dirty","nodeType":"Attribute","startLoc":89,"text":"self.dirty"},{"className":"Projection","col":0,"comment":"Base class for all sky projections.","endLoc":151,"id":13009,"nodeType":"Class","startLoc":96,"text":"class Projection(Model):\n    \"\"\"Base class for all sky projections.\"\"\"\n\n    # Radius of the generating sphere.\n    # This sets the circumference to 360 deg so that arc length is measured in deg.\n    r0 = 180 * u.deg / np.pi\n\n    _separable = False\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        self._prj = wcs.Prjprm()\n\n    @property\n    @abc.abstractmethod\n    def inverse(self):\n        \"\"\"\n        Inverse projection--all projection models must provide an inverse.\n        \"\"\"\n\n    @property\n    def prjprm(self):\n        \"\"\" WCSLIB ``prjprm`` structure. \"\"\"\n        self._update_prj()\n        return self._prj\n\n    def _update_prj(self):\n        \"\"\"\n        A default updater for projection's pv.\n\n        .. warning::\n            This method assumes that PV0 is never modified. If a projection\n            that uses PV0 is ever implemented in this module, that projection\n            class should override this method.\n\n        .. warning::\n            This method assumes that the order in which PVi values (i>0)\n            are to be asigned is identical to the order of model parameters\n            in ``param_names``. That is, pv[1] = model.parameters[0], ...\n\n        \"\"\"\n        if not self.param_names:\n            return\n\n        pv = []\n        dirty = False\n\n        for p in self.param_names:\n            param = getattr(self, p)\n            pv.append(float(param.value))\n            dirty |= param.dirty\n            param.dirty = False\n\n        if dirty:\n            self._prj.pv = None, *pv\n            self._prj.set()"},{"col":4,"comment":"null","endLoc":107,"header":"def __init__(self, *args, **kwargs)","id":13010,"name":"__init__","nodeType":"Function","startLoc":105,"text":"def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        self._prj = wcs.Prjprm()"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":738,"id":13011,"name":"r_eff","nodeType":"Attribute","startLoc":738,"text":"r_eff"},{"col":4,"comment":"null","endLoc":132,"header":"def __getitem__(self, param)","id":13012,"name":"__getitem__","nodeType":"Function","startLoc":125,"text":"def __getitem__(self, param):\n        if isinstance(param, str):\n            i = self.param_names.index(param)\n        elif isinstance(param, int):\n            i = param\n        else:\n            raise TypeError('Standard deviation can be indexed by parameter name or integer.')\n        return(self.stds[i])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":477,"id":13013,"name":"beta","nodeType":"Attribute","startLoc":477,"text":"beta"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":739,"id":13014,"name":"n","nodeType":"Attribute","startLoc":739,"text":"n"},{"attributeType":"null","col":8,"comment":"null","endLoc":100,"id":13015,"name":"stds","nodeType":"Attribute","startLoc":100,"text":"self.stds"},{"attributeType":"null","col":8,"comment":"null","endLoc":99,"id":13016,"name":"param_names","nodeType":"Attribute","startLoc":99,"text":"self.param_names"},{"className":"ModelsError","col":0,"comment":"Base class for model exceptions","endLoc":136,"id":13017,"nodeType":"Class","startLoc":135,"text":"class ModelsError(Exception):\n    \"\"\"Base class for model exceptions\"\"\""},{"className":"ModelLinearityError","col":0,"comment":" Raised when a non-linear model is passed to a linear fitter.","endLoc":140,"id":13018,"nodeType":"Class","startLoc":139,"text":"class ModelLinearityError(ModelsError):\n    \"\"\" Raised when a non-linear model is passed to a linear fitter.\"\"\""},{"attributeType":"None","col":4,"comment":"null","endLoc":740,"id":13019,"name":"_gammaincinv","nodeType":"Attribute","startLoc":740,"text":"_gammaincinv"},{"attributeType":"null","col":12,"comment":"null","endLoc":748,"id":13020,"name":"_gammaincinv","nodeType":"Attribute","startLoc":748,"text":"cls._gammaincinv"},{"className":"_Trigonometric1D","col":0,"comment":"\n    Base class for one dimensional trigonometric and inverse trigonometric models\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude\n    frequency : float\n        Oscillation frequency\n    phase : float\n        Oscillation phase\n    ","endLoc":790,"id":13021,"nodeType":"Class","startLoc":764,"text":"class _Trigonometric1D(Fittable1DModel):\n    \"\"\"\n    Base class for one dimensional trigonometric and inverse trigonometric models\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude\n    frequency : float\n        Oscillation frequency\n    phase : float\n        Oscillation phase\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Oscillation amplitude\")\n    frequency = Parameter(default=1, description=\"Oscillation frequency\")\n    phase = Parameter(default=0, description=\"Oscillation phase\")\n\n    @property\n    def input_units(self):\n        if self.frequency.unit is None:\n            return None\n        return {self.inputs[0]: 1. / self.frequency.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'frequency': inputs_unit[self.inputs[0]] ** -1,\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"className":"UnsupportedConstraintError","col":0,"comment":"\n    Raised when a fitter does not support a type of constraint.\n    ","endLoc":146,"id":13022,"nodeType":"Class","startLoc":143,"text":"class UnsupportedConstraintError(ModelsError, ValueError):\n    \"\"\"\n    Raised when a fitter does not support a type of constraint.\n    \"\"\""},{"col":4,"comment":"null","endLoc":786,"header":"@property\n    def input_units(self)","id":13023,"name":"input_units","nodeType":"Function","startLoc":782,"text":"@property\n    def input_units(self):\n        if self.frequency.unit is None:\n            return None\n        return {self.inputs[0]: 1. / self.frequency.unit}"},{"col":4,"comment":"null","endLoc":790,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13024,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":788,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'frequency': inputs_unit[self.inputs[0]] ** -1,\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"className":"_FitterMeta","col":0,"comment":"\n    Currently just provides a registry for all Fitter classes.\n    ","endLoc":162,"id":13025,"nodeType":"Class","startLoc":149,"text":"class _FitterMeta(abc.ABCMeta):\n    \"\"\"\n    Currently just provides a registry for all Fitter classes.\n    \"\"\"\n\n    registry = set()\n\n    def __new__(mcls, name, bases, members):\n        cls = super().__new__(mcls, name, bases, members)\n\n        if not inspect.isabstract(cls) and not name.startswith('_'):\n            mcls.registry.add(cls)\n\n        return cls"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":778,"id":13026,"name":"amplitude","nodeType":"Attribute","startLoc":778,"text":"amplitude"},{"col":4,"comment":"null","endLoc":162,"header":"def __new__(mcls, name, bases, members)","id":13027,"name":"__new__","nodeType":"Function","startLoc":156,"text":"def __new__(mcls, name, bases, members):\n        cls = super().__new__(mcls, name, bases, members)\n\n        if not inspect.isabstract(cls) and not name.startswith('_'):\n            mcls.registry.add(cls)\n\n        return cls"},{"col":4,"comment":"\n        Inverse projection--all projection models must provide an inverse.\n        ","endLoc":114,"header":"@property\n    @abc.abstractmethod\n    def inverse(self)","id":13028,"name":"inverse","nodeType":"Function","startLoc":109,"text":"@property\n    @abc.abstractmethod\n    def inverse(self):\n        \"\"\"\n        Inverse projection--all projection models must provide an inverse.\n        \"\"\""},{"col":4,"comment":" WCSLIB ``prjprm`` structure. ","endLoc":120,"header":"@property\n    def prjprm(self)","id":13029,"name":"prjprm","nodeType":"Function","startLoc":116,"text":"@property\n    def prjprm(self):\n        \"\"\" WCSLIB ``prjprm`` structure. \"\"\"\n        self._update_prj()\n        return self._prj"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":779,"id":13030,"name":"frequency","nodeType":"Attribute","startLoc":779,"text":"frequency"},{"attributeType":"null","col":4,"comment":"null","endLoc":154,"id":13031,"name":"registry","nodeType":"Attribute","startLoc":154,"text":"registry"},{"col":4,"comment":"\n        A default updater for projection's pv.\n\n        .. warning::\n            This method assumes that PV0 is never modified. If a projection\n            that uses PV0 is ever implemented in this module, that projection\n            class should override this method.\n\n        .. warning::\n            This method assumes that the order in which PVi values (i>0)\n            are to be asigned is identical to the order of model parameters\n            in ``param_names``. That is, pv[1] = model.parameters[0], ...\n\n        ","endLoc":151,"header":"def _update_prj(self)","id":13032,"name":"_update_prj","nodeType":"Function","startLoc":122,"text":"def _update_prj(self):\n        \"\"\"\n        A default updater for projection's pv.\n\n        .. warning::\n            This method assumes that PV0 is never modified. If a projection\n            that uses PV0 is ever implemented in this module, that projection\n            class should override this method.\n\n        .. warning::\n            This method assumes that the order in which PVi values (i>0)\n            are to be asigned is identical to the order of model parameters\n            in ``param_names``. That is, pv[1] = model.parameters[0], ...\n\n        \"\"\"\n        if not self.param_names:\n            return\n\n        pv = []\n        dirty = False\n\n        for p in self.param_names:\n            param = getattr(self, p)\n            pv.append(float(param.value))\n            dirty |= param.dirty\n            param.dirty = False\n\n        if dirty:\n            self._prj.pv = None, *pv\n            self._prj.set()"},{"attributeType":"null","col":8,"comment":"null","endLoc":157,"id":13033,"name":"cls","nodeType":"Attribute","startLoc":157,"text":"cls"},{"className":"Fitter","col":0,"comment":"\n    Base class for all fitters.\n\n    Parameters\n    ----------\n    optimizer : callable\n        A callable implementing an optimization algorithm\n    statistic : callable\n        Statistic function\n\n    ","endLoc":344,"id":13034,"nodeType":"Class","startLoc":270,"text":"class Fitter(metaclass=_FitterMeta):\n    \"\"\"\n    Base class for all fitters.\n\n    Parameters\n    ----------\n    optimizer : callable\n        A callable implementing an optimization algorithm\n    statistic : callable\n        Statistic function\n\n    \"\"\"\n\n    supported_constraints = []\n\n    def __init__(self, optimizer, statistic):\n        if optimizer is None:\n            raise ValueError(\"Expected an optimizer.\")\n        if statistic is None:\n            raise ValueError(\"Expected a statistic function.\")\n        if inspect.isclass(optimizer):\n            # a callable class\n            self._opt_method = optimizer()\n        elif inspect.isfunction(optimizer):\n            self._opt_method = optimizer\n        else:\n            raise ValueError(\"Expected optimizer to be a callable class or a function.\")\n        if inspect.isclass(statistic):\n            self._stat_method = statistic()\n        else:\n            self._stat_method = statistic\n\n    def objective_function(self, fps, *args):\n        \"\"\"\n        Function to minimize.\n\n        Parameters\n        ----------\n        fps : list\n            parameters returned by the fitter\n        args : list\n            [model, [other_args], [input coordinates]]\n            other_args may include weights or any other quantities specific for\n            a statistic\n\n        Notes\n        -----\n        The list of arguments (args) is set in the `__call__` method.\n        Fitters may overwrite this method, e.g. when statistic functions\n        require other arguments.\n\n        \"\"\"\n        model = args[0]\n        meas = args[-1]\n        fitter_to_model_params(model, fps)\n        res = self._stat_method(meas, model, *args[1:-1])\n        return res\n\n    @staticmethod\n    def _add_fitting_uncertainties(*args):\n        \"\"\"\n        When available, calculate and sets the parameter covariance matrix\n        (model.cov_matrix) and standard deviations (model.stds).\n        \"\"\"\n        return None\n\n    @abc.abstractmethod\n    def __call__(self):\n        \"\"\"\n        This method performs the actual fitting and modifies the parameter list\n        of a model.\n        Fitter subclasses should implement this method.\n        \"\"\"\n\n        raise NotImplementedError(\"Subclasses should implement this method.\")"},{"col":4,"comment":"null","endLoc":300,"header":"def __init__(self, optimizer, statistic)","id":13035,"name":"__init__","nodeType":"Function","startLoc":285,"text":"def __init__(self, optimizer, statistic):\n        if optimizer is None:\n            raise ValueError(\"Expected an optimizer.\")\n        if statistic is None:\n            raise ValueError(\"Expected a statistic function.\")\n        if inspect.isclass(optimizer):\n            # a callable class\n            self._opt_method = optimizer()\n        elif inspect.isfunction(optimizer):\n            self._opt_method = optimizer\n        else:\n            raise ValueError(\"Expected optimizer to be a callable class or a function.\")\n        if inspect.isclass(statistic):\n            self._stat_method = statistic()\n        else:\n            self._stat_method = statistic"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":780,"id":13036,"name":"phase","nodeType":"Attribute","startLoc":780,"text":"phase"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":13037,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"powerlaws.py#<anonymous>","id":13038,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nPower law model variants\n\"\"\"\n\n__all__ = ['PowerLaw1D', 'BrokenPowerLaw1D', 'SmoothlyBrokenPowerLaw1D',\n           'ExponentialCutoffPowerLaw1D', 'LogParabola1D']"},{"col":4,"comment":"\n        Function to minimize.\n\n        Parameters\n        ----------\n        fps : list\n            parameters returned by the fitter\n        args : list\n            [model, [other_args], [input coordinates]]\n            other_args may include weights or any other quantities specific for\n            a statistic\n\n        Notes\n        -----\n        The list of arguments (args) is set in the `__call__` method.\n        Fitters may overwrite this method, e.g. when statistic functions\n        require other arguments.\n\n        ","endLoc":326,"header":"def objective_function(self, fps, *args)","id":13039,"name":"objective_function","nodeType":"Function","startLoc":302,"text":"def objective_function(self, fps, *args):\n        \"\"\"\n        Function to minimize.\n\n        Parameters\n        ----------\n        fps : list\n            parameters returned by the fitter\n        args : list\n            [model, [other_args], [input coordinates]]\n            other_args may include weights or any other quantities specific for\n            a statistic\n\n        Notes\n        -----\n        The list of arguments (args) is set in the `__call__` method.\n        Fitters may overwrite this method, e.g. when statistic functions\n        require other arguments.\n\n        \"\"\"\n        model = args[0]\n        meas = args[-1]\n        fitter_to_model_params(model, fps)\n        res = self._stat_method(meas, model, *args[1:-1])\n        return res"},{"col":0,"comment":"\n    Constructs the full list of model parameters from the fitted and\n    constrained parameters.\n    ","endLoc":1662,"header":"def fitter_to_model_params(model, fps)","id":13040,"name":"fitter_to_model_params","nodeType":"Function","startLoc":1602,"text":"def fitter_to_model_params(model, fps):\n    \"\"\"\n    Constructs the full list of model parameters from the fitted and\n    constrained parameters.\n    \"\"\"\n\n    _, fit_param_indices = model_to_fit_params(model)\n\n    has_tied = any(model.tied.values())\n    has_fixed = any(model.fixed.values())\n    has_bound = any(b != (None, None) for b in model.bounds.values())\n    parameters = model.parameters\n\n    if not (has_tied or has_fixed or has_bound):\n        # We can just assign directly\n        model.parameters = fps\n        return\n\n    fit_param_indices = set(fit_param_indices)\n    offset = 0\n    param_metrics = model._param_metrics\n    for idx, name in enumerate(model.param_names):\n        if idx not in fit_param_indices:\n            continue\n\n        slice_ = param_metrics[name]['slice']\n        shape = param_metrics[name]['shape']\n        # This is determining which range of fps (the fitted parameters) maps\n        # to parameters of the model\n        size = reduce(operator.mul, shape, 1)\n\n        values = fps[offset:offset + size]\n\n        # Check bounds constraints\n        if model.bounds[name] != (None, None):\n            _min, _max = model.bounds[name]\n            if _min is not None:\n                values = np.fmax(values, _min)\n            if _max is not None:\n                values = np.fmin(values, _max)\n\n        parameters[slice_] = values\n        offset += size\n\n    # Update model parameters before calling ``tied`` constraints.\n    model._array_to_parameters()\n\n    # This has to be done in a separate loop due to how tied parameters are\n    # currently evaluated (the fitted parameters need to actually be *set* on\n    # the model first, for use in evaluating the \"tied\" expression--it might be\n    # better to change this at some point\n    if has_tied:\n        for idx, name in enumerate(model.param_names):\n            if model.tied[name]:\n                value = model.tied[name](model)\n                slice_ = param_metrics[name]['slice']\n\n                # To handle multiple tied constraints, model parameters\n                # need to be updated after each iteration.\n                parameters[slice_] = value\n                model._array_to_parameters()"},{"attributeType":"null","col":4,"comment":"null","endLoc":101,"id":13041,"name":"r0","nodeType":"Attribute","startLoc":101,"text":"r0"},{"col":0,"comment":"\n    Convert a model instance's parameter array to an array that can be used\n    with a fitter that doesn't natively support fixed or tied parameters.\n    In particular, it removes fixed/tied parameters from the parameter\n    array.\n    These may be a subset of the model parameters, if some of them are held\n    constant or tied.\n    ","endLoc":1690,"header":"def model_to_fit_params(model)","id":13042,"name":"model_to_fit_params","nodeType":"Function","startLoc":1670,"text":"def model_to_fit_params(model):\n    \"\"\"\n    Convert a model instance's parameter array to an array that can be used\n    with a fitter that doesn't natively support fixed or tied parameters.\n    In particular, it removes fixed/tied parameters from the parameter\n    array.\n    These may be a subset of the model parameters, if some of them are held\n    constant or tied.\n    \"\"\"\n\n    fitparam_indices = list(range(len(model.param_names)))\n    if any(model.fixed.values()) or any(model.tied.values()):\n        params = list(model.parameters)\n        param_metrics = model._param_metrics\n        for idx, name in list(enumerate(model.param_names))[::-1]:\n            if model.fixed[name] or model.tied[name]:\n                slice_ = param_metrics[name]['slice']\n                del params[slice_]\n                del fitparam_indices[idx]\n        return (np.array(params), fitparam_indices)\n    return (model.parameters, fitparam_indices)"},{"col":4,"comment":"null","endLoc":253,"header":"@property\n    def x_domain(self)","id":13043,"name":"x_domain","nodeType":"Function","startLoc":251,"text":"@property\n    def x_domain(self):\n        return self._x_domain"},{"col":4,"comment":"null","endLoc":257,"header":"@x_domain.setter\n    def x_domain(self, val)","id":13044,"name":"x_domain","nodeType":"Function","startLoc":255,"text":"@x_domain.setter\n    def x_domain(self, val):\n        self._x_domain = _validate_domain_window(val)"},{"col":4,"comment":"null","endLoc":261,"header":"@property\n    def y_domain(self)","id":13045,"name":"y_domain","nodeType":"Function","startLoc":259,"text":"@property\n    def y_domain(self):\n        return self._y_domain"},{"col":4,"comment":"null","endLoc":265,"header":"@y_domain.setter\n    def y_domain(self, val)","id":13046,"name":"y_domain","nodeType":"Function","startLoc":263,"text":"@y_domain.setter\n    def y_domain(self, val):\n        self._y_domain = _validate_domain_window(val)"},{"col":4,"comment":"null","endLoc":269,"header":"@property\n    def x_window(self)","id":13047,"name":"x_window","nodeType":"Function","startLoc":267,"text":"@property\n    def x_window(self):\n        return self._x_window"},{"col":4,"comment":"null","endLoc":273,"header":"@x_window.setter\n    def x_window(self, val)","id":13048,"name":"x_window","nodeType":"Function","startLoc":271,"text":"@x_window.setter\n    def x_window(self, val):\n        self._x_window = _validate_domain_window(val)"},{"attributeType":"null","col":4,"comment":"null","endLoc":103,"id":13049,"name":"_separable","nodeType":"Attribute","startLoc":103,"text":"_separable"},{"col":4,"comment":"null","endLoc":277,"header":"@property\n    def y_window(self)","id":13050,"name":"y_window","nodeType":"Function","startLoc":275,"text":"@property\n    def y_window(self):\n        return self._y_window"},{"col":4,"comment":"null","endLoc":281,"header":"@y_window.setter\n    def y_window(self, val)","id":13051,"name":"y_window","nodeType":"Function","startLoc":279,"text":"@y_window.setter\n    def y_window(self, val):\n        self._y_window = _validate_domain_window(val)"},{"col":4,"comment":"null","endLoc":289,"header":"def __repr__(self)","id":13052,"name":"__repr__","nodeType":"Function","startLoc":283,"text":"def __repr__(self):\n        return self._format_repr([self.x_degree, self.y_degree],\n                                 kwargs={'x_domain': self.x_domain,\n                                         'y_domain': self.y_domain,\n                                         'x_window': self.x_window,\n                                         'y_window': self.y_window},\n                                 defaults=self._default_domain_window)"},{"className":"Sine1D","col":0,"comment":"\n    One dimensional Sine model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude\n    frequency : float\n        Oscillation frequency\n    phase : float\n        Oscillation phase\n\n    See Also\n    --------\n    ArcSine1D, Cosine1D, Tangent1D, Const1D, Linear1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = A \\sin(2 \\pi f x + 2 \\pi p)\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Sine1D\n\n        plt.figure()\n        s1 = Sine1D(amplitude=1, frequency=.25)\n        r=np.arange(0, 10, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([0, 10, -5, 5])\n        plt.show()\n    ","endLoc":867,"id":13053,"nodeType":"Class","startLoc":793,"text":"class Sine1D(_Trigonometric1D):\n    \"\"\"\n    One dimensional Sine model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude\n    frequency : float\n        Oscillation frequency\n    phase : float\n        Oscillation phase\n\n    See Also\n    --------\n    ArcSine1D, Cosine1D, Tangent1D, Const1D, Linear1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = A \\\\sin(2 \\\\pi f x + 2 \\\\pi p)\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Sine1D\n\n        plt.figure()\n        s1 = Sine1D(amplitude=1, frequency=.25)\n        r=np.arange(0, 10, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([0, 10, -5, 5])\n        plt.show()\n    \"\"\"\n\n    @staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Sine model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n        argument = TWOPI * (frequency * x + phase)\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        return amplitude * np.sin(argument)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Sine model derivative\"\"\"\n\n        d_amplitude = np.sin(TWOPI * frequency * x + TWOPI * phase)\n        d_frequency = (TWOPI * x * amplitude *\n                       np.cos(TWOPI * frequency * x + TWOPI * phase))\n        d_phase = (TWOPI * amplitude *\n                   np.cos(TWOPI * frequency * x + TWOPI * phase))\n        return [d_amplitude, d_frequency, d_phase]\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse of Sine\"\"\"\n\n        return ArcSine1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)"},{"col":4,"comment":"One dimensional Sine model function","endLoc":850,"header":"@staticmethod\n    def evaluate(x, amplitude, frequency, phase)","id":13054,"name":"evaluate","nodeType":"Function","startLoc":839,"text":"@staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Sine model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n        argument = TWOPI * (frequency * x + phase)\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        return amplitude * np.sin(argument)"},{"col":4,"comment":"null","endLoc":299,"header":"def __str__(self)","id":13055,"name":"__str__","nodeType":"Function","startLoc":291,"text":"def __str__(self):\n        return self._format_str(\n            [('X_Degree', self.x_degree),\n             ('Y_Degree', self.y_degree),\n             ('X_Domain', self.x_domain),\n             ('Y_Domain', self.y_domain),\n             ('X_Window', self.x_window),\n             ('Y_Window', self.y_window)],\n             self._default_domain_window)"},{"attributeType":"null","col":8,"comment":"null","endLoc":107,"id":13056,"name":"_prj","nodeType":"Attribute","startLoc":107,"text":"self._prj"},{"className":"Pix2SkyProjection","col":0,"comment":"Base class for all Pix2Sky projections.","endLoc":198,"id":13057,"nodeType":"Class","startLoc":154,"text":"class Pix2SkyProjection(Projection):\n    \"\"\"Base class for all Pix2Sky projections.\"\"\"\n\n    n_inputs = 2\n    n_outputs = 2\n\n    _input_units_strict = True\n    _input_units_allow_dimensionless = True\n\n    def __new__(cls, *args, **kwargs):\n        long_name = cls.name.split('_')[1]\n        cls.prj_code = _PROJ_NAME_CODE_MAP[long_name]\n        return super(Pix2SkyProjection, cls).__new__(cls)\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n        self._prj.code = self.prj_code\n        self._update_prj()\n        if not self.param_names:\n            # force initial call to Prjprm.set() for projections\n            # with no parameters:\n            self._prj.set()\n\n        self.inputs = ('x', 'y')\n        self.outputs = ('phi', 'theta')\n\n    @property\n    def input_units(self):\n        return {self.inputs[0]: u.deg,\n                self.inputs[1]: u.deg}\n\n    @property\n    def return_units(self):\n        return {self.outputs[0]: u.deg,\n                self.outputs[1]: u.deg}\n\n    def evaluate(self, x, y, *args, **kwargs):\n        self._update_prj()\n        return self._prj.prjx2s(x, y)\n\n    @property\n    def inverse(self):\n        pv = [getattr(self, param).value for param in self.param_names]\n        return self._inv_cls(*pv)"},{"col":4,"comment":"One dimensional Sine model derivative","endLoc":861,"header":"@staticmethod\n    def fit_deriv(x, amplitude, frequency, phase)","id":13058,"name":"fit_deriv","nodeType":"Function","startLoc":852,"text":"@staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Sine model derivative\"\"\"\n\n        d_amplitude = np.sin(TWOPI * frequency * x + TWOPI * phase)\n        d_frequency = (TWOPI * x * amplitude *\n                       np.cos(TWOPI * frequency * x + TWOPI * phase))\n        d_phase = (TWOPI * amplitude *\n                   np.cos(TWOPI * frequency * x + TWOPI * phase))\n        return [d_amplitude, d_frequency, d_phase]"},{"col":4,"comment":"One dimensional inverse of Sine","endLoc":867,"header":"@property\n    def inverse(self)","id":13059,"name":"inverse","nodeType":"Function","startLoc":863,"text":"@property\n    def inverse(self):\n        \"\"\"One dimensional inverse of Sine\"\"\"\n\n        return ArcSine1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)"},{"col":4,"comment":"null","endLoc":325,"header":"def _invlex(self)","id":13060,"name":"_invlex","nodeType":"Function","startLoc":316,"text":"def _invlex(self):\n        # TODO: This is a very slow way to do this; fix it and related methods\n        # like _alpha\n        c = []\n        xvar = np.arange(self.x_degree + 1)\n        yvar = np.arange(self.y_degree + 1)\n        for j in yvar:\n            for i in xvar:\n                c.append((i, j))\n        return np.array(c[::-1])"},{"col":4,"comment":"null","endLoc":336,"header":"def invlex_coeff(self, coeffs)","id":13061,"name":"invlex_coeff","nodeType":"Function","startLoc":327,"text":"def invlex_coeff(self, coeffs):\n        invlex_coeffs = []\n        xvar = np.arange(self.x_degree + 1)\n        yvar = np.arange(self.y_degree + 1)\n        for j in yvar:\n            for i in xvar:\n                name = f'c{i}_{j}'\n                coeff = coeffs[self.param_names.index(name)]\n                invlex_coeffs.append(coeff)\n        return np.array(invlex_coeffs[::-1])"},{"col":4,"comment":"\n        When available, calculate and sets the parameter covariance matrix\n        (model.cov_matrix) and standard deviations (model.stds).\n        ","endLoc":334,"header":"@staticmethod\n    def _add_fitting_uncertainties(*args)","id":13062,"name":"_add_fitting_uncertainties","nodeType":"Function","startLoc":328,"text":"@staticmethod\n    def _add_fitting_uncertainties(*args):\n        \"\"\"\n        When available, calculate and sets the parameter covariance matrix\n        (model.cov_matrix) and standard deviations (model.stds).\n        \"\"\"\n        return None"},{"col":4,"comment":"\n        This method performs the actual fitting and modifies the parameter list\n        of a model.\n        Fitter subclasses should implement this method.\n        ","endLoc":344,"header":"@abc.abstractmethod\n    def __call__(self)","id":13063,"name":"__call__","nodeType":"Function","startLoc":336,"text":"@abc.abstractmethod\n    def __call__(self):\n        \"\"\"\n        This method performs the actual fitting and modifies the parameter list\n        of a model.\n        Fitter subclasses should implement this method.\n        \"\"\"\n\n        raise NotImplementedError(\"Subclasses should implement this method.\")"},{"attributeType":"null","col":4,"comment":"null","endLoc":283,"id":13064,"name":"supported_constraints","nodeType":"Attribute","startLoc":283,"text":"supported_constraints"},{"attributeType":"null","col":12,"comment":"null","endLoc":300,"id":13065,"name":"_stat_method","nodeType":"Attribute","startLoc":300,"text":"self._stat_method"},{"attributeType":"null","col":12,"comment":"null","endLoc":294,"id":13066,"name":"_opt_method","nodeType":"Attribute","startLoc":294,"text":"self._opt_method"},{"id":13067,"name":"astropy/modeling/tests","nodeType":"Package"},{"fileName":"irafutil.py","filePath":"astropy/modeling/tests","id":13068,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module provides functions to help with testing against iraf tasks\n\"\"\"\n\n\nfrom astropy.logger import log\nimport numpy as np\n\n\niraf_models_map = {1.: 'Chebyshev',\n                   2.: 'Legendre',\n                   3.: 'Spline3',\n                   4.: 'Spline1'}\n\n\ndef get_records(fname):\n    \"\"\"\n    Read the records of an IRAF database file into a python list\n\n    Parameters\n    ----------\n    fname : str\n           name of an IRAF database file\n\n    Returns\n    -------\n        A list of records\n    \"\"\"\n    f = open(fname)\n    dtb = f.read()\n    f.close()\n    recs = dtb.split('begin')[1:]\n    records = [Record(r) for r in recs]\n    return records\n\n\ndef get_database_string(fname):\n    \"\"\"\n    Read an IRAF database file\n\n    Parameters\n    ----------\n    fname : str\n          name of an IRAF database file\n\n    Returns\n    -------\n        the database file as a string\n    \"\"\"\n    f = open(fname)\n    dtb = f.read()\n    f.close()\n    return dtb\n\n\nclass Record:\n\n    \"\"\"\n    A base class for all records - represents an IRAF database record\n\n    Attributes\n    ----------\n    recstr: string\n            the record as a string\n    fields: dict\n            the fields in the record\n    taskname: string\n            the name of the task which created the database file\n    \"\"\"\n    def __init__(self, recstr):\n        self.recstr = recstr\n        self.fields = self.get_fields()\n        self.taskname = self.get_task_name()\n\n    def aslist(self):\n        reclist = self.recstr.split('\\n')\n        reclist = [l.strip() for l in reclist]\n        [reclist.remove(l) for l in reclist if len(l) == 0]\n        return reclist\n\n    def get_fields(self):\n        # read record fields as an array\n        fields = {}\n        flist = self.aslist()\n        numfields = len(flist)\n        for i in range(numfields):\n            line = flist[i]\n            if line and line[0].isalpha():\n                field = line.split()\n                if i + 1 < numfields:\n                    if not flist[i + 1][0].isalpha():\n                        fields[field[0]] = self.read_array_field(\n                            flist[i:i + int(field[1]) + 1])\n                    else:\n                        fields[field[0]] = \" \".join(s for s in field[1:])\n                else:\n                    fields[field[0]] = \" \".join(s for s in field[1:])\n            else:\n                continue\n        return fields\n\n    def get_task_name(self):\n        try:\n            return self.fields['task']\n        except KeyError:\n            return None\n\n    def read_array_field(self, fieldlist):\n        # Turn an iraf record array field into a numpy array\n        fieldline = [l.split() for l in fieldlist[1:]]\n        # take only the first 3 columns\n        # identify writes also strings at the end of some field lines\n        xyz = [l[:3] for l in fieldline]\n        try:\n            farr = np.array(xyz)\n        except Exception:\n            log.debug(f\"Could not read array field {fieldlist[0].split()[0]}\")\n        return farr.astype(np.float64)\n\n\nclass IdentifyRecord(Record):\n\n    \"\"\"\n    Represents a database record for the onedspec.identify task\n\n    Attributes\n    ----------\n    x: array\n       the X values of the identified features\n       this represents values on axis1 (image rows)\n    y: int\n       the Y values of the identified features\n       (image columns)\n    z: array\n       the values which X maps into\n    modelname: string\n        the function used to fit the data\n    nterms: int\n        degree of the polynomial which was fit to the data\n        in IRAF this is the number of coefficients, not the order\n    mrange: list\n        the range of the data\n    coeff: array\n        function (modelname) coefficients\n    \"\"\"\n    def __init__(self, recstr):\n        super().__init__(recstr)\n        self._flatcoeff = self.fields['coefficients'].flatten()\n        self.x = self.fields['features'][:, 0]\n        self.y = self.get_ydata()\n        self.z = self.fields['features'][:, 1]\n        self.modelname = self.get_model_name()\n        self.nterms = self.get_nterms()\n        self.mrange = self.get_range()\n        self.coeff = self.get_coeff()\n\n    def get_model_name(self):\n        return iraf_models_map[self._flatcoeff[0]]\n\n    def get_nterms(self):\n        return self._flatcoeff[1]\n\n    def get_range(self):\n        low = self._flatcoeff[2]\n        high = self._flatcoeff[3]\n        return [low, high]\n\n    def get_coeff(self):\n        return self._flatcoeff[4:]\n\n    def get_ydata(self):\n        image = self.fields['image']\n        left = image.find('[') + 1\n        right = image.find(']')\n        section = image[left:right]\n        if ',' in section:\n            yind = image.find(',') + 1\n            return int(image[yind:-1])\n        else:\n            return int(section)\n\n\nclass FitcoordsRecord(Record):\n\n    \"\"\"\n    Represents a database record for the longslit.fitccords task\n\n    Attributes\n    ----------\n    modelname: string\n        the function used to fit the data\n    xorder: int\n        number of terms in x\n    yorder: int\n        number of terms in y\n    xbounds: list\n        data range in x\n    ybounds: list\n        data range in y\n    coeff: array\n        function coefficients\n\n    \"\"\"\n    def __init__(self, recstr):\n        super().__init__(recstr)\n        self._surface = self.fields['surface'].flatten()\n        self.modelname = iraf_models_map[self._surface[0]]\n        self.xorder = self._surface[1]\n        self.yorder = self._surface[2]\n        self.xbounds = [self._surface[4], self._surface[5]]\n        self.ybounds = [self._surface[6], self._surface[7]]\n        self.coeff = self.get_coeff()\n\n    def get_coeff(self):\n        return self._surface[8:]\n\n\nclass IDB:\n\n    \"\"\"\n    Base class for an IRAF identify database\n\n    Attributes\n    ----------\n    records: list\n             a list of all `IdentifyRecord` in the database\n    numrecords: int\n             number of records\n    \"\"\"\n    def __init__(self, dtbstr):\n        self.records = [IdentifyRecord(rstr) for rstr in self.aslist(dtbstr)]\n        self.numrecords = len(self.records)\n\n    def aslist(self, dtb):\n        # return a list of records\n        # if the first one is a comment remove it from the list\n        rl = dtb.split('begin')\n        try:\n            rl0 = rl[0].split('\\n')\n        except Exception:\n            return rl\n        if len(rl0) == 2 and rl0[0].startswith('#') and not rl0[1].strip():\n            return rl[1:]\n        else:\n            return rl\n\n\nclass ReidentifyRecord(IDB):\n\n    \"\"\"\n    Represents a database record for the onedspec.reidentify task\n    \"\"\"\n    def __init__(self, databasestr):\n        super().__init__(databasestr)\n        self.x = np.array([r.x for r in self.records])\n        self.y = self.get_ydata()\n        self.z = np.array([r.z for r in self.records])\n\n    def get_ydata(self):\n        y = np.ones(self.x.shape)\n        y = y * np.array([r.y for r in self.records])[:, np.newaxis]\n        return y\n"},{"className":"LinearLSQFitter","col":0,"comment":"\n    A class performing a linear least square fitting.\n    Uses `numpy.linalg.lstsq` to do the fitting.\n    Given a model and data, fits the model to the data and changes the\n    model's parameters. Keeps a dictionary of auxiliary fitting information.\n    Notes\n    -----\n    Note that currently LinearLSQFitter does not support compound models.\n    ","endLoc":792,"id":13069,"nodeType":"Class","startLoc":350,"text":"class LinearLSQFitter(metaclass=_FitterMeta):\n    \"\"\"\n    A class performing a linear least square fitting.\n    Uses `numpy.linalg.lstsq` to do the fitting.\n    Given a model and data, fits the model to the data and changes the\n    model's parameters. Keeps a dictionary of auxiliary fitting information.\n    Notes\n    -----\n    Note that currently LinearLSQFitter does not support compound models.\n    \"\"\"\n\n    supported_constraints = ['fixed']\n    supports_masked_input = True\n\n    def __init__(self, calc_uncertainties=False):\n        self.fit_info = {'residuals': None,\n                         'rank': None,\n                         'singular_values': None,\n                         'params': None\n                         }\n        self._calc_uncertainties=calc_uncertainties\n\n    @staticmethod\n    def _is_invertible(m):\n        \"\"\"Check if inverse of matrix can be obtained.\"\"\"\n        if m.shape[0] != m.shape[1]:\n            return False\n        if np.linalg.matrix_rank(m) < m.shape[0]:\n            return False\n        return True\n\n    def _add_fitting_uncertainties(self, model, a, n_coeff, x, y, z=None,\n                                   resids=None):\n        \"\"\"\n        Calculate and parameter covariance matrix and standard deviations\n        and set `cov_matrix` and `stds` attributes.\n        \"\"\"\n        x_dot_x_prime = np.dot(a.T, a)\n        masked = False or hasattr(y, 'mask')\n\n        # check if invertible. if not, can't calc covariance.\n        if not self._is_invertible(x_dot_x_prime):\n            return(model)\n        inv_x_dot_x_prime = np.linalg.inv(x_dot_x_prime)\n\n        if z is None:  # 1D models\n            if len(model) == 1:  # single model\n                mask = None\n                if masked:\n                    mask = y.mask\n                xx = np.ma.array(x, mask=mask)\n                RSS = [(1/(xx.count()-n_coeff)) * resids]\n\n            if len(model) > 1:  # model sets\n                RSS = []   # collect sum residuals squared for each model in set\n                for j in range(len(model)):\n                    mask = None\n                    if masked:\n                        mask = y.mask[..., j].flatten()\n                    xx = np.ma.array(x, mask=mask)\n                    eval_y = model(xx, model_set_axis=False)\n                    eval_y = np.rollaxis(eval_y, model.model_set_axis)[j]\n                    RSS.append((1/(xx.count()-n_coeff)) * np.sum((y[..., j] - eval_y)**2))\n\n        else:  # 2D model\n            if len(model) == 1:\n                mask = None\n                if masked:\n                    warnings.warn('Calculation of fitting uncertainties '\n                                  'for 2D models with masked values not '\n                                  'currently supported.\\n',\n                                  AstropyUserWarning)\n                    return\n                xx, yy = np.ma.array(x, mask=mask), np.ma.array(y, mask=mask)\n                # len(xx) instead of xx.count. this will break if values are masked?\n                RSS = [(1/(len(xx)-n_coeff)) * resids]\n            else:\n                RSS = []\n                for j in range(len(model)):\n                    eval_z = model(x, y, model_set_axis=False)\n                    mask = None  # need to figure out how to deal w/ masking here.\n                    if model.model_set_axis == 1:\n                        # model_set_axis passed when evaluating only refers to input shapes\n                        # so output must be reshaped for model_set_axis=1.\n                        eval_z = np.rollaxis(eval_z, 1)\n                    eval_z = eval_z[j]\n                    RSS.append([(1/(len(x)-n_coeff)) * np.sum((z[j] - eval_z)**2)])\n\n        covs = [inv_x_dot_x_prime * r for r in RSS]\n        free_param_names = [x for x in model.fixed if (model.fixed[x] is False)\n                            and (model.tied[x] is False)]\n\n        if len(covs) == 1:\n            model.cov_matrix = Covariance(covs[0], model.param_names)\n            model.stds = StandardDeviations(covs[0], free_param_names)\n        else:\n            model.cov_matrix = [Covariance(cov, model.param_names) for cov in covs]\n            model.stds = [StandardDeviations(cov, free_param_names) for cov in covs]\n\n    @staticmethod\n    def _deriv_with_constraints(model, param_indices, x=None, y=None):\n        if y is None:\n            d = np.array(model.fit_deriv(x, *model.parameters))\n        else:\n            d = np.array(model.fit_deriv(x, y, *model.parameters))\n\n        if model.col_fit_deriv:\n            return d[param_indices]\n        else:\n            return d[..., param_indices]\n\n    def _map_domain_window(self, model, x, y=None):\n        \"\"\"\n        Maps domain into window for a polynomial model which has these\n        attributes.\n        \"\"\"\n\n        if y is None:\n            if hasattr(model, 'domain') and model.domain is None:\n                model.domain = [x.min(), x.max()]\n            if hasattr(model, 'window') and model.window is None:\n                model.window = [-1, 1]\n            return poly_map_domain(x, model.domain, model.window)\n        else:\n            if hasattr(model, 'x_domain') and model.x_domain is None:\n                model.x_domain = [x.min(), x.max()]\n            if hasattr(model, 'y_domain') and model.y_domain is None:\n                model.y_domain = [y.min(), y.max()]\n            if hasattr(model, 'x_window') and model.x_window is None:\n                model.x_window = [-1., 1.]\n            if hasattr(model, 'y_window') and model.y_window is None:\n                model.y_window = [-1., 1.]\n\n            xnew = poly_map_domain(x, model.x_domain, model.x_window)\n            ynew = poly_map_domain(y, model.y_domain, model.y_window)\n            return xnew, ynew\n\n    @fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None, rcond=None):\n        \"\"\"\n        Fit data to this model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            model to fit to x, y, z\n        x : array\n            Input coordinates\n        y : array-like\n            Input coordinates\n        z : array-like, optional\n            Input coordinates.\n            If the dependent (``y`` or ``z``) coordinate values are provided\n            as a `numpy.ma.MaskedArray`, any masked points are ignored when\n            fitting. Note that model set fitting is significantly slower when\n            there are masked points (not just an empty mask), as the matrix\n            equation has to be solved for each model separately when their\n            coordinate grids differ.\n        weights : array, optional\n            Weights for fitting.\n            For data with Gaussian uncertainties, the weights should be\n            1/sigma.\n        rcond :  float, optional\n            Cut-off ratio for small singular values of ``a``.\n            Singular values are set to zero if they are smaller than ``rcond``\n            times the largest singular value of ``a``.\n        equivalencies : list or None, optional, keyword-only\n            List of *additional* equivalencies that are should be applied in\n            case x, y and/or z have units. Default is None.\n\n        Returns\n        -------\n        model_copy : `~astropy.modeling.FittableModel`\n            a copy of the input model with parameters set by the fitter\n\n        \"\"\"\n\n        if not model.fittable:\n            raise ValueError(\"Model must be a subclass of FittableModel\")\n\n        if not model.linear:\n            raise ModelLinearityError('Model is not linear in parameters, '\n                                      'linear fit methods should not be used.')\n\n        if hasattr(model, \"submodel_names\"):\n            raise ValueError(\"Model must be simple, not compound\")\n\n        _validate_constraints(self.supported_constraints, model)\n\n        model_copy = model.copy()\n        model_copy.sync_constraints = False\n        _, fitparam_indices = model_to_fit_params(model_copy)\n\n        if model_copy.n_inputs == 2 and z is None:\n            raise ValueError(\"Expected x, y and z for a 2 dimensional model.\")\n\n        farg = _convert_input(x, y, z, n_models=len(model_copy),\n                              model_set_axis=model_copy.model_set_axis)\n\n        has_fixed = any(model_copy.fixed.values())\n\n        # This is also done by _convert_inputs, but we need it here to allow\n        # checking the array dimensionality before that gets called:\n        if weights is not None:\n            weights = np.asarray(weights, dtype=float)\n\n        if has_fixed:\n\n            # The list of fixed params is the complement of those being fitted:\n            fixparam_indices = [idx for idx in\n                                range(len(model_copy.param_names))\n                                if idx not in fitparam_indices]\n\n            # Construct matrix of user-fixed parameters that can be dotted with\n            # the corresponding fit_deriv() terms, to evaluate corrections to\n            # the dependent variable in order to fit only the remaining terms:\n            fixparams = np.asarray([getattr(model_copy,\n                                            model_copy.param_names[idx]).value\n                                    for idx in fixparam_indices])\n\n        if len(farg) == 2:\n            x, y = farg\n\n            if weights is not None:\n                # If we have separate weights for each model, apply the same\n                # conversion as for the data, otherwise check common weights\n                # as if for a single model:\n                _, weights = _convert_input(\n                    x, weights,\n                    n_models=len(model_copy) if weights.ndim == y.ndim else 1,\n                    model_set_axis=model_copy.model_set_axis\n                )\n\n            # map domain into window\n            if hasattr(model_copy, 'domain'):\n                x = self._map_domain_window(model_copy, x)\n            if has_fixed:\n                lhs = np.asarray(self._deriv_with_constraints(model_copy,\n                                                              fitparam_indices,\n                                                              x=x))\n                fixderivs = self._deriv_with_constraints(model_copy, fixparam_indices, x=x)\n            else:\n                lhs = np.asarray(model_copy.fit_deriv(x, *model_copy.parameters))\n            sum_of_implicit_terms = model_copy.sum_of_implicit_terms(x)\n            rhs = y\n        else:\n            x, y, z = farg\n\n            if weights is not None:\n                # If we have separate weights for each model, apply the same\n                # conversion as for the data, otherwise check common weights\n                # as if for a single model:\n                _, _, weights = _convert_input(\n                    x, y, weights,\n                    n_models=len(model_copy) if weights.ndim == z.ndim else 1,\n                    model_set_axis=model_copy.model_set_axis\n                )\n\n            # map domain into window\n            if hasattr(model_copy, 'x_domain'):\n                x, y = self._map_domain_window(model_copy, x, y)\n\n            if has_fixed:\n                lhs = np.asarray(self._deriv_with_constraints(model_copy,\n                                                              fitparam_indices, x=x, y=y))\n                fixderivs = self._deriv_with_constraints(model_copy,\n                                                         fixparam_indices,\n                                                         x=x, y=y)\n            else:\n                lhs = np.asanyarray(model_copy.fit_deriv(x, y, *model_copy.parameters))\n            sum_of_implicit_terms = model_copy.sum_of_implicit_terms(x, y)\n\n            if len(model_copy) > 1:\n\n                # Just to be explicit (rather than baking in False == 0):\n                model_axis = model_copy.model_set_axis or 0\n\n                if z.ndim > 2:\n                    # For higher-dimensional z, flatten all the axes except the\n                    # dimension along which models are stacked and transpose so\n                    # the model axis is *last* (I think this resolves Erik's\n                    # pending generalization from 80a6f25a):\n                    rhs = np.rollaxis(z, model_axis, z.ndim)\n                    rhs = rhs.reshape(-1, rhs.shape[-1])\n                else:\n                    # This \"else\" seems to handle the corner case where the\n                    # user has already flattened x/y before attempting a 2D fit\n                    # but z has a second axis for the model set. NB. This is\n                    # ~5-10x faster than using rollaxis.\n                    rhs = z.T if model_axis == 0 else z\n\n                if weights is not None:\n                    # Same for weights\n                    if weights.ndim > 2:\n                        # Separate 2D weights for each model:\n                        weights = np.rollaxis(weights, model_axis, weights.ndim)\n                        weights = weights.reshape(-1, weights.shape[-1])\n                    elif weights.ndim == z.ndim:\n                        # Separate, flattened weights for each model:\n                        weights = weights.T if model_axis == 0 else weights\n                    else:\n                        # Common weights for all the models:\n                        weights = weights.flatten()\n            else:\n                rhs = z.flatten()\n                if weights is not None:\n                    weights = weights.flatten()\n\n        # If the derivative is defined along rows (as with non-linear models)\n        if model_copy.col_fit_deriv:\n            lhs = np.asarray(lhs).T\n\n        # Some models (eg. Polynomial1D) don't flatten multi-dimensional inputs\n        # when constructing their Vandermonde matrix, which can lead to obscure\n        # failures below. Ultimately, np.linalg.lstsq can't handle >2D matrices,\n        # so just raise a slightly more informative error when this happens:\n        if np.asanyarray(lhs).ndim > 2:\n            raise ValueError('{} gives unsupported >2D derivative matrix for '\n                             'this x/y'.format(type(model_copy).__name__))\n\n        # Subtract any terms fixed by the user from (a copy of) the RHS, in\n        # order to fit the remaining terms correctly:\n        if has_fixed:\n            if model_copy.col_fit_deriv:\n                fixderivs = np.asarray(fixderivs).T  # as for lhs above\n            rhs = rhs - fixderivs.dot(fixparams)  # evaluate user-fixed terms\n\n        # Subtract any terms implicit in the model from the RHS, which, like\n        # user-fixed terms, affect the dependent variable but are not fitted:\n        if sum_of_implicit_terms is not None:\n            # If we have a model set, the extra axis must be added to\n            # sum_of_implicit_terms as its innermost dimension, to match the\n            # dimensionality of rhs after _convert_input \"rolls\" it as needed\n            # by np.linalg.lstsq. The vector then gets broadcast to the right\n            # number of sets (columns). This assumes all the models share the\n            # same input coordinates, as is currently the case.\n            if len(model_copy) > 1:\n                sum_of_implicit_terms = sum_of_implicit_terms[..., np.newaxis]\n            rhs = rhs - sum_of_implicit_terms\n\n        if weights is not None:\n\n            if rhs.ndim == 2:\n                if weights.shape == rhs.shape:\n                    # separate weights for multiple models case: broadcast\n                    # lhs to have more dimension (for each model)\n                    lhs = lhs[..., np.newaxis] * weights[:, np.newaxis]\n                    rhs = rhs * weights\n                else:\n                    lhs *= weights[:, np.newaxis]\n                    # Don't modify in-place in case rhs was the original\n                    # dependent variable array\n                    rhs = rhs * weights[:, np.newaxis]\n            else:\n                lhs *= weights[:, np.newaxis]\n                rhs = rhs * weights\n\n        scl = (lhs * lhs).sum(0)\n        lhs /= scl\n\n        masked = np.any(np.ma.getmask(rhs))\n        if weights is not None and not masked and np.any(np.isnan(lhs)):\n            raise ValueError('Found NaNs in the coefficient matrix, which '\n                             'should not happen and would crash the lapack '\n                             'routine. Maybe check that weights are not null.')\n\n        a = None  # need for calculating covarience\n\n        if ((masked and len(model_copy) > 1) or\n                (weights is not None and weights.ndim > 1)):\n\n            # Separate masks or weights for multiple models case: Numpy's\n            # lstsq supports multiple dimensions only for rhs, so we need to\n            # loop manually on the models. This may be fixed in the future\n            # with https://github.com/numpy/numpy/pull/15777.\n\n            # Initialize empty array of coefficients and populate it one model\n            # at a time. The shape matches the number of coefficients from the\n            # Vandermonde matrix and the number of models from the RHS:\n            lacoef = np.zeros(lhs.shape[1:2] + rhs.shape[-1:], dtype=rhs.dtype)\n\n            # Arrange the lhs as a stack of 2D matrices that we can iterate\n            # over to get the correctly-orientated lhs for each model:\n            if lhs.ndim > 2:\n                lhs_stack = np.rollaxis(lhs, -1, 0)\n            else:\n                lhs_stack = np.broadcast_to(lhs, rhs.shape[-1:] + lhs.shape)\n\n            # Loop over the models and solve for each one. By this point, the\n            # model set axis is the second of two. Transpose rather than using,\n            # say, np.moveaxis(array, -1, 0), since it's slightly faster and\n            # lstsq can't handle >2D arrays anyway. This could perhaps be\n            # optimized by collecting together models with identical masks\n            # (eg. those with no rejected points) into one operation, though it\n            # will still be relatively slow when calling lstsq repeatedly.\n            for model_lhs, model_rhs, model_lacoef in zip(lhs_stack, rhs.T, lacoef.T):\n\n                # Cull masked points on both sides of the matrix equation:\n                good = ~model_rhs.mask if masked else slice(None)\n                model_lhs = model_lhs[good]\n                model_rhs = model_rhs[good][..., np.newaxis]\n                a = model_lhs\n\n                # Solve for this model:\n                t_coef, resids, rank, sval = np.linalg.lstsq(model_lhs,\n                                                             model_rhs, rcond)\n                model_lacoef[:] = t_coef.T\n\n        else:\n\n            # If we're fitting one or more models over a common set of points,\n            # we only have to solve a single matrix equation, which is an order\n            # of magnitude faster than calling lstsq() once per model below:\n\n            good = ~rhs.mask if masked else slice(None)  # latter is a no-op\n            a = lhs[good]\n            # Solve for one or more models:\n            lacoef, resids, rank, sval = np.linalg.lstsq(lhs[good],\n                                                         rhs[good], rcond)\n\n        self.fit_info['residuals'] = resids\n        self.fit_info['rank'] = rank\n        self.fit_info['singular_values'] = sval\n\n        lacoef /= scl[:, np.newaxis] if scl.ndim < rhs.ndim else scl\n        self.fit_info['params'] = lacoef\n\n        fitter_to_model_params(model_copy, lacoef.flatten())\n\n        # TODO: Only Polynomial models currently have an _order attribute;\n        # maybe change this to read isinstance(model, PolynomialBase)\n        if hasattr(model_copy, '_order') and len(model_copy) == 1 \\\n                and not has_fixed and rank != model_copy._order:\n            warnings.warn(\"The fit may be poorly conditioned\\n\",\n                          AstropyUserWarning)\n\n        # calculate and set covariance matrix and standard devs. on model\n        if self._calc_uncertainties:\n            if len(y) > len(lacoef):\n                self._add_fitting_uncertainties(model_copy, a*scl,\n                                               len(lacoef), x, y, z, resids)\n        model_copy.sync_constraints = True\n        return model_copy"},{"col":4,"comment":"null","endLoc":370,"header":"def __init__(self, calc_uncertainties=False)","id":13070,"name":"__init__","nodeType":"Function","startLoc":364,"text":"def __init__(self, calc_uncertainties=False):\n        self.fit_info = {'residuals': None,\n                         'rank': None,\n                         'singular_values': None,\n                         'params': None\n                         }\n        self._calc_uncertainties=calc_uncertainties"},{"col":4,"comment":"Check if inverse of matrix can be obtained.","endLoc":379,"header":"@staticmethod\n    def _is_invertible(m)","id":13071,"name":"_is_invertible","nodeType":"Function","startLoc":372,"text":"@staticmethod\n    def _is_invertible(m):\n        \"\"\"Check if inverse of matrix can be obtained.\"\"\"\n        if m.shape[0] != m.shape[1]:\n            return False\n        if np.linalg.matrix_rank(m) < m.shape[0]:\n            return False\n        return True"},{"col":4,"comment":"\n        Calculate and parameter covariance matrix and standard deviations\n        and set `cov_matrix` and `stds` attributes.\n        ","endLoc":447,"header":"def _add_fitting_uncertainties(self, model, a, n_coeff, x, y, z=None,\n                                   resids=None)","id":13072,"name":"_add_fitting_uncertainties","nodeType":"Function","startLoc":381,"text":"def _add_fitting_uncertainties(self, model, a, n_coeff, x, y, z=None,\n                                   resids=None):\n        \"\"\"\n        Calculate and parameter covariance matrix and standard deviations\n        and set `cov_matrix` and `stds` attributes.\n        \"\"\"\n        x_dot_x_prime = np.dot(a.T, a)\n        masked = False or hasattr(y, 'mask')\n\n        # check if invertible. if not, can't calc covariance.\n        if not self._is_invertible(x_dot_x_prime):\n            return(model)\n        inv_x_dot_x_prime = np.linalg.inv(x_dot_x_prime)\n\n        if z is None:  # 1D models\n            if len(model) == 1:  # single model\n                mask = None\n                if masked:\n                    mask = y.mask\n                xx = np.ma.array(x, mask=mask)\n                RSS = [(1/(xx.count()-n_coeff)) * resids]\n\n            if len(model) > 1:  # model sets\n                RSS = []   # collect sum residuals squared for each model in set\n                for j in range(len(model)):\n                    mask = None\n                    if masked:\n                        mask = y.mask[..., j].flatten()\n                    xx = np.ma.array(x, mask=mask)\n                    eval_y = model(xx, model_set_axis=False)\n                    eval_y = np.rollaxis(eval_y, model.model_set_axis)[j]\n                    RSS.append((1/(xx.count()-n_coeff)) * np.sum((y[..., j] - eval_y)**2))\n\n        else:  # 2D model\n            if len(model) == 1:\n                mask = None\n                if masked:\n                    warnings.warn('Calculation of fitting uncertainties '\n                                  'for 2D models with masked values not '\n                                  'currently supported.\\n',\n                                  AstropyUserWarning)\n                    return\n                xx, yy = np.ma.array(x, mask=mask), np.ma.array(y, mask=mask)\n                # len(xx) instead of xx.count. this will break if values are masked?\n                RSS = [(1/(len(xx)-n_coeff)) * resids]\n            else:\n                RSS = []\n                for j in range(len(model)):\n                    eval_z = model(x, y, model_set_axis=False)\n                    mask = None  # need to figure out how to deal w/ masking here.\n                    if model.model_set_axis == 1:\n                        # model_set_axis passed when evaluating only refers to input shapes\n                        # so output must be reshaped for model_set_axis=1.\n                        eval_z = np.rollaxis(eval_z, 1)\n                    eval_z = eval_z[j]\n                    RSS.append([(1/(len(x)-n_coeff)) * np.sum((z[j] - eval_z)**2)])\n\n        covs = [inv_x_dot_x_prime * r for r in RSS]\n        free_param_names = [x for x in model.fixed if (model.fixed[x] is False)\n                            and (model.tied[x] is False)]\n\n        if len(covs) == 1:\n            model.cov_matrix = Covariance(covs[0], model.param_names)\n            model.stds = StandardDeviations(covs[0], free_param_names)\n        else:\n            model.cov_matrix = [Covariance(cov, model.param_names) for cov in covs]\n            model.stds = [StandardDeviations(cov, free_param_names) for cov in covs]"},{"col":4,"comment":"null","endLoc":137,"header":"def __repr__(self)","id":13073,"name":"__repr__","nodeType":"Function","startLoc":135,"text":"def __repr__(self):\n        return \"<{}(points={}, lookup_table={})>\".format(\n            self.__class__.__name__, self.points, self.lookup_table)"},{"col":4,"comment":"null","endLoc":157,"header":"def __str__(self)","id":13074,"name":"__str__","nodeType":"Function","startLoc":139,"text":"def __str__(self):\n        default_keywords = [\n            ('Model', self.__class__.__name__),\n            ('Name', self.name),\n            ('N_inputs', self.n_inputs),\n            ('N_outputs', self.n_outputs),\n            ('Parameters', \"\"),\n            ('  points', self.points),\n            ('  lookup_table', self.lookup_table),\n            ('  method', self.method),\n            ('  fill_value', self.fill_value),\n            ('  bounds_error', self.bounds_error)\n        ]\n\n        parts = [f'{keyword}: {value}'\n                 for keyword, value in default_keywords\n                 if value is not None]\n\n        return '\\n'.join(parts)"},{"col":4,"comment":"null","endLoc":164,"header":"@property\n    def input_units(self)","id":13075,"name":"input_units","nodeType":"Function","startLoc":159,"text":"@property\n    def input_units(self):\n        pts = self.points[0]\n        if not isinstance(pts, u.Quantity):\n            return None\n        return dict([(x, pts.unit) for x in self.inputs])"},{"className":"Record","col":0,"comment":"\n    A base class for all records - represents an IRAF database record\n\n    Attributes\n    ----------\n    recstr: string\n            the record as a string\n    fields: dict\n            the fields in the record\n    taskname: string\n            the name of the task which created the database file\n    ","endLoc":119,"id":13076,"nodeType":"Class","startLoc":57,"text":"class Record:\n\n    \"\"\"\n    A base class for all records - represents an IRAF database record\n\n    Attributes\n    ----------\n    recstr: string\n            the record as a string\n    fields: dict\n            the fields in the record\n    taskname: string\n            the name of the task which created the database file\n    \"\"\"\n    def __init__(self, recstr):\n        self.recstr = recstr\n        self.fields = self.get_fields()\n        self.taskname = self.get_task_name()\n\n    def aslist(self):\n        reclist = self.recstr.split('\\n')\n        reclist = [l.strip() for l in reclist]\n        [reclist.remove(l) for l in reclist if len(l) == 0]\n        return reclist\n\n    def get_fields(self):\n        # read record fields as an array\n        fields = {}\n        flist = self.aslist()\n        numfields = len(flist)\n        for i in range(numfields):\n            line = flist[i]\n            if line and line[0].isalpha():\n                field = line.split()\n                if i + 1 < numfields:\n                    if not flist[i + 1][0].isalpha():\n                        fields[field[0]] = self.read_array_field(\n                            flist[i:i + int(field[1]) + 1])\n                    else:\n                        fields[field[0]] = \" \".join(s for s in field[1:])\n                else:\n                    fields[field[0]] = \" \".join(s for s in field[1:])\n            else:\n                continue\n        return fields\n\n    def get_task_name(self):\n        try:\n            return self.fields['task']\n        except KeyError:\n            return None\n\n    def read_array_field(self, fieldlist):\n        # Turn an iraf record array field into a numpy array\n        fieldline = [l.split() for l in fieldlist[1:]]\n        # take only the first 3 columns\n        # identify writes also strings at the end of some field lines\n        xyz = [l[:3] for l in fieldline]\n        try:\n            farr = np.array(xyz)\n        except Exception:\n            log.debug(f\"Could not read array field {fieldlist[0].split()[0]}\")\n        return farr.astype(np.float64)"},{"col":4,"comment":"null","endLoc":170,"header":"@property\n    def return_units(self)","id":13077,"name":"return_units","nodeType":"Function","startLoc":166,"text":"@property\n    def return_units(self):\n        if not isinstance(self.lookup_table, u.Quantity):\n            return None\n        return {self.outputs[0]: self.lookup_table.unit}"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(points_low, points_high)``.\n\n        Examples\n        --------\n        >>> from astropy.modeling.models import Tabular1D, Tabular2D\n        >>> t1 = Tabular1D(points=[1, 2, 3], lookup_table=[10, 20, 30])\n        >>> t1.bounding_box\n        ModelBoundingBox(\n            intervals={\n                x: Interval(lower=1, upper=3)\n            }\n            model=Tabular1D(inputs=('x',))\n            order='C'\n        )\n        >>> t2 = Tabular2D(points=[[1, 2, 3], [2, 3, 4]],\n        ...                lookup_table=[[10, 20, 30], [20, 30, 40]])\n        >>> t2.bounding_box\n        ModelBoundingBox(\n            intervals={\n                x: Interval(lower=1, upper=3)\n                y: Interval(lower=2, upper=4)\n            }\n            model=Tabular2D(inputs=('x', 'y'))\n            order='C'\n        )\n\n        ","endLoc":206,"header":"@property\n    def bounding_box(self)","id":13078,"name":"bounding_box","nodeType":"Function","startLoc":172,"text":"@property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(points_low, points_high)``.\n\n        Examples\n        --------\n        >>> from astropy.modeling.models import Tabular1D, Tabular2D\n        >>> t1 = Tabular1D(points=[1, 2, 3], lookup_table=[10, 20, 30])\n        >>> t1.bounding_box\n        ModelBoundingBox(\n            intervals={\n                x: Interval(lower=1, upper=3)\n            }\n            model=Tabular1D(inputs=('x',))\n            order='C'\n        )\n        >>> t2 = Tabular2D(points=[[1, 2, 3], [2, 3, 4]],\n        ...                lookup_table=[[10, 20, 30], [20, 30, 40]])\n        >>> t2.bounding_box\n        ModelBoundingBox(\n            intervals={\n                x: Interval(lower=1, upper=3)\n                y: Interval(lower=2, upper=4)\n            }\n            model=Tabular2D(inputs=('x', 'y'))\n            order='C'\n        )\n\n        \"\"\"\n        bbox = [(min(p), max(p)) for p in self.points][::-1]\n        if len(bbox) == 1:\n            bbox = bbox[0]\n        return bbox"},{"col":4,"comment":"null","endLoc":166,"header":"def __new__(cls, *args, **kwargs)","id":13079,"name":"__new__","nodeType":"Function","startLoc":163,"text":"def __new__(cls, *args, **kwargs):\n        long_name = cls.name.split('_')[1]\n        cls.prj_code = _PROJ_NAME_CODE_MAP[long_name]\n        return super(Pix2SkyProjection, cls).__new__(cls)"},{"col":4,"comment":"null","endLoc":74,"header":"def __init__(self, recstr)","id":13080,"name":"__init__","nodeType":"Function","startLoc":71,"text":"def __init__(self, recstr):\n        self.recstr = recstr\n        self.fields = self.get_fields()\n        self.taskname = self.get_task_name()"},{"col":4,"comment":"\n        Return the interpolated values at the input coordinates.\n\n        Parameters\n        ----------\n        inputs : list of scalar or list of ndarray\n            Input coordinates. The number of inputs must be equal\n            to the dimensions of the lookup table.\n        ","endLoc":238,"header":"def evaluate(self, *inputs)","id":13081,"name":"evaluate","nodeType":"Function","startLoc":208,"text":"def evaluate(self, *inputs):\n        \"\"\"\n        Return the interpolated values at the input coordinates.\n\n        Parameters\n        ----------\n        inputs : list of scalar or list of ndarray\n            Input coordinates. The number of inputs must be equal\n            to the dimensions of the lookup table.\n        \"\"\"\n        inputs = np.broadcast_arrays(*inputs)\n\n        shape = inputs[0].shape\n        inputs = [inp.flatten() for inp in inputs[: self.n_inputs]]\n        inputs = np.array(inputs).T\n        if not has_scipy:  # pragma: no cover\n            raise ImportError(\"Tabular model requires scipy.\")\n        result = interpn(self.points, self.lookup_table, inputs,\n                         method=self.method, bounds_error=self.bounds_error,\n                         fill_value=self.fill_value)\n\n        # return_units not respected when points has no units\n        if (isinstance(self.lookup_table, u.Quantity) and\n                not isinstance(self.points[0], u.Quantity)):\n            result = result * self.lookup_table.unit\n\n        if self.n_outputs == 1:\n            result = result.reshape(shape)\n        else:\n            result = [r.reshape(shape) for r in result]\n        return result"},{"col":4,"comment":"null","endLoc":179,"header":"def __init__(self, *args, **kwargs)","id":13082,"name":"__init__","nodeType":"Function","startLoc":168,"text":"def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n        self._prj.code = self.prj_code\n        self._update_prj()\n        if not self.param_names:\n            # force initial call to Prjprm.set() for projections\n            # with no parameters:\n            self._prj.set()\n\n        self.inputs = ('x', 'y')\n        self.outputs = ('phi', 'theta')"},{"col":4,"comment":"null","endLoc":348,"header":"def _alpha(self)","id":13083,"name":"_alpha","nodeType":"Function","startLoc":338,"text":"def _alpha(self):\n        invlexdeg = self._invlex()\n        invlexdeg[:, 1] = invlexdeg[:, 1] + self.x_degree + 1\n        nx = self.x_degree + 1\n        ny = self.y_degree + 1\n        alpha = np.zeros((ny * nx + 3, ny + nx))\n        for n in range(len(invlexdeg)):\n            alpha[n][invlexdeg[n]] = [1, 1]\n            alpha[-2, 0] = 1\n            alpha[-3, nx] = 1\n        return alpha"},{"col":4,"comment":"null","endLoc":184,"header":"@property\n    def input_units(self)","id":13084,"name":"input_units","nodeType":"Function","startLoc":181,"text":"@property\n    def input_units(self):\n        return {self.inputs[0]: u.deg,\n                self.inputs[1]: u.deg}"},{"col":4,"comment":"null","endLoc":189,"header":"@property\n    def return_units(self)","id":13085,"name":"return_units","nodeType":"Function","startLoc":186,"text":"@property\n    def return_units(self):\n        return {self.outputs[0]: u.deg,\n                self.outputs[1]: u.deg}"},{"col":4,"comment":"null","endLoc":193,"header":"def evaluate(self, x, y, *args, **kwargs)","id":13086,"name":"evaluate","nodeType":"Function","startLoc":191,"text":"def evaluate(self, x, y, *args, **kwargs):\n        self._update_prj()\n        return self._prj.prjx2s(x, y)"},{"col":4,"comment":"null","endLoc":198,"header":"@property\n    def inverse(self)","id":13087,"name":"inverse","nodeType":"Function","startLoc":195,"text":"@property\n    def inverse(self):\n        pv = [getattr(self, param).value for param in self.param_names]\n        return self._inv_cls(*pv)"},{"attributeType":"null","col":4,"comment":"null","endLoc":157,"id":13088,"name":"n_inputs","nodeType":"Attribute","startLoc":157,"text":"n_inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":158,"id":13089,"name":"n_outputs","nodeType":"Attribute","startLoc":158,"text":"n_outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":160,"id":13090,"name":"_input_units_strict","nodeType":"Attribute","startLoc":160,"text":"_input_units_strict"},{"attributeType":"null","col":4,"comment":"null","endLoc":161,"id":13091,"name":"_input_units_allow_dimensionless","nodeType":"Attribute","startLoc":161,"text":"_input_units_allow_dimensionless"},{"attributeType":"null","col":8,"comment":"null","endLoc":179,"id":13092,"name":"outputs","nodeType":"Attribute","startLoc":179,"text":"self.outputs"},{"attributeType":"null","col":8,"comment":"null","endLoc":165,"id":13093,"name":"prj_code","nodeType":"Attribute","startLoc":165,"text":"cls.prj_code"},{"attributeType":"null","col":8,"comment":"null","endLoc":178,"id":13094,"name":"inputs","nodeType":"Attribute","startLoc":178,"text":"self.inputs"},{"attributeType":"null","col":8,"comment":"null","endLoc":164,"id":13095,"name":"long_name","nodeType":"Attribute","startLoc":164,"text":"long_name"},{"className":"Sky2PixProjection","col":0,"comment":"Base class for all Sky2Pix projections.","endLoc":245,"id":13096,"nodeType":"Class","startLoc":201,"text":"class Sky2PixProjection(Projection):\n    \"\"\"Base class for all Sky2Pix projections.\"\"\"\n\n    n_inputs = 2\n    n_outputs = 2\n\n    _input_units_strict = True\n    _input_units_allow_dimensionless = True\n\n    def __new__(cls, *args, **kwargs):\n        long_name = cls.name.split('_')[1]\n        cls.prj_code = _PROJ_NAME_CODE_MAP[long_name]\n        return super(Sky2PixProjection, cls).__new__(cls)\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n        self._prj.code = self.prj_code\n        self._update_prj()\n        if not self.param_names:\n            # force initial call to Prjprm.set() for projections\n            # without parameters:\n            self._prj.set()\n\n        self.inputs = ('phi', 'theta')\n        self.outputs = ('x', 'y')\n\n    @property\n    def input_units(self):\n        return {self.inputs[0]: u.deg,\n                self.inputs[1]: u.deg}\n\n    @property\n    def return_units(self):\n        return {self.outputs[0]: u.deg,\n                self.outputs[1]: u.deg}\n\n    def evaluate(self, phi, theta, *args, **kwargs):\n        self._update_prj()\n        return self._prj.prjs2x(phi, theta)\n\n    @property\n    def inverse(self):\n        pv = [getattr(self, param).value for param in self.param_names]\n        return self._inv_cls(*pv)"},{"col":4,"comment":"null","endLoc":213,"header":"def __new__(cls, *args, **kwargs)","id":13097,"name":"__new__","nodeType":"Function","startLoc":210,"text":"def __new__(cls, *args, **kwargs):\n        long_name = cls.name.split('_')[1]\n        cls.prj_code = _PROJ_NAME_CODE_MAP[long_name]\n        return super(Sky2PixProjection, cls).__new__(cls)"},{"col":4,"comment":"null","endLoc":260,"header":"@property\n    def inverse(self)","id":13098,"name":"inverse","nodeType":"Function","startLoc":240,"text":"@property\n    def inverse(self):\n        if self.n_inputs == 1:\n            # If the wavelength array is descending instead of ascending, both\n            # points and lookup_table need to be reversed in the inverse transform\n            # for scipy.interpolate to work properly\n            if np.all(np.diff(self.lookup_table) > 0):\n                # ascending case\n                points = self.lookup_table\n                lookup_table = self.points[0]\n            elif np.all(np.diff(self.lookup_table) < 0):\n                # descending case, reverse order\n                points = self.lookup_table[::-1]\n                lookup_table = self.points[0][::-1]\n            else:\n                # equal-valued or double-valued lookup_table\n                raise NotImplementedError\n            return Tabular1D(points=points, lookup_table=lookup_table, method=self.method,\n                             bounds_error=self.bounds_error, fill_value=self.fill_value)\n        raise NotImplementedError(\"An analytical inverse transform \"\n                                  \"has not been implemented for this model.\")"},{"col":4,"comment":"null","endLoc":226,"header":"def __init__(self, *args, **kwargs)","id":13099,"name":"__init__","nodeType":"Function","startLoc":215,"text":"def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n        self._prj.code = self.prj_code\n        self._update_prj()\n        if not self.param_names:\n            # force initial call to Prjprm.set() for projections\n            # without parameters:\n            self._prj.set()\n\n        self.inputs = ('phi', 'theta')\n        self.outputs = ('x', 'y')"},{"col":4,"comment":"null","endLoc":378,"header":"def imhorner(self, x, y, coeff)","id":13100,"name":"imhorner","nodeType":"Function","startLoc":350,"text":"def imhorner(self, x, y, coeff):\n        _coeff = list(coeff)\n        _coeff.extend([0, 0, 0])\n        alpha = self._alpha()\n        r0 = _coeff[0]\n        nalpha = len(alpha)\n\n        karr = np.diff(alpha, axis=0)\n        kfunc = self._fcache(x, y)\n        x_terms = self.x_degree + 1\n        y_terms = self.y_degree + 1\n        nterms = x_terms + y_terms\n        for n in range(1, nterms + 1 + 3):\n            setattr(self, 'r' + str(n), 0.)\n\n        for n in range(1, nalpha):\n            k = karr[n - 1].nonzero()[0].max() + 1\n            rsum = 0\n            for i in range(1, k + 1):\n                rsum = rsum + getattr(self, 'r' + str(i))\n            val = kfunc[k - 1] * (r0 + rsum)\n            setattr(self, 'r' + str(k), val)\n            r0 = _coeff[n]\n            for i in range(1, k):\n                setattr(self, 'r' + str(i), 0.)\n        result = r0\n        for i in range(1, nterms + 1 + 3):\n            result = result + getattr(self, 'r' + str(i))\n        return result"},{"col":4,"comment":"null","endLoc":231,"header":"@property\n    def input_units(self)","id":13101,"name":"input_units","nodeType":"Function","startLoc":228,"text":"@property\n    def input_units(self):\n        return {self.inputs[0]: u.deg,\n                self.inputs[1]: u.deg}"},{"col":4,"comment":"null","endLoc":236,"header":"@property\n    def return_units(self)","id":13102,"name":"return_units","nodeType":"Function","startLoc":233,"text":"@property\n    def return_units(self):\n        return {self.outputs[0]: u.deg,\n                self.outputs[1]: u.deg}"},{"col":4,"comment":"null","endLoc":240,"header":"def evaluate(self, phi, theta, *args, **kwargs)","id":13103,"name":"evaluate","nodeType":"Function","startLoc":238,"text":"def evaluate(self, phi, theta, *args, **kwargs):\n        self._update_prj()\n        return self._prj.prjs2x(phi, theta)"},{"col":4,"comment":"null","endLoc":245,"header":"@property\n    def inverse(self)","id":13104,"name":"inverse","nodeType":"Function","startLoc":242,"text":"@property\n    def inverse(self):\n        pv = [getattr(self, param).value for param in self.param_names]\n        return self._inv_cls(*pv)"},{"attributeType":"null","col":4,"comment":"null","endLoc":204,"id":13105,"name":"n_inputs","nodeType":"Attribute","startLoc":204,"text":"n_inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":205,"id":13106,"name":"n_outputs","nodeType":"Attribute","startLoc":205,"text":"n_outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":207,"id":13107,"name":"_input_units_strict","nodeType":"Attribute","startLoc":207,"text":"_input_units_strict"},{"attributeType":"null","col":4,"comment":"null","endLoc":208,"id":13108,"name":"_input_units_allow_dimensionless","nodeType":"Attribute","startLoc":208,"text":"_input_units_allow_dimensionless"},{"attributeType":"null","col":8,"comment":"null","endLoc":226,"id":13109,"name":"outputs","nodeType":"Attribute","startLoc":226,"text":"self.outputs"},{"attributeType":"null","col":8,"comment":"null","endLoc":212,"id":13110,"name":"prj_code","nodeType":"Attribute","startLoc":212,"text":"cls.prj_code"},{"attributeType":"null","col":8,"comment":"null","endLoc":225,"id":13111,"name":"inputs","nodeType":"Attribute","startLoc":225,"text":"self.inputs"},{"attributeType":"null","col":8,"comment":"null","endLoc":211,"id":13112,"name":"long_name","nodeType":"Attribute","startLoc":211,"text":"long_name"},{"className":"Zenithal","col":0,"comment":"Base class for all Zenithal projections.\n\n    Zenithal (or azimuthal) projections map the sphere directly onto a\n    plane.  All zenithal projections are specified by defining the\n    radius as a function of native latitude, :math:`R_\\theta`.\n\n    The pixel-to-sky transformation is defined as:\n\n    .. math::\n        \\phi &= \\arg(-y, x) \\\\\n        R_\\theta &= \\sqrt{x^2 + y^2}\n\n    and the inverse (sky-to-pixel) is defined as:\n\n    .. math::\n        x &= R_\\theta \\sin \\phi \\\\\n        y &= R_\\theta \\cos \\phi\n    ","endLoc":266,"id":13113,"nodeType":"Class","startLoc":248,"text":"class Zenithal(Projection):\n    r\"\"\"Base class for all Zenithal projections.\n\n    Zenithal (or azimuthal) projections map the sphere directly onto a\n    plane.  All zenithal projections are specified by defining the\n    radius as a function of native latitude, :math:`R_\\theta`.\n\n    The pixel-to-sky transformation is defined as:\n\n    .. math::\n        \\phi &= \\arg(-y, x) \\\\\n        R_\\theta &= \\sqrt{x^2 + y^2}\n\n    and the inverse (sky-to-pixel) is defined as:\n\n    .. math::\n        x &= R_\\theta \\sin \\phi \\\\\n        y &= R_\\theta \\cos \\phi\n    \"\"\""},{"className":"Pix2Sky_ZenithalPerspective","col":0,"comment":"\n    Zenithal perspective projection - pixel to sky.\n\n    Corresponds to the ``AZP`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= \\arg(-y \\cos \\gamma, x) \\\\\n        \\theta &= \\left\\{\\genfrac{}{}{0pt}{}{\\psi - \\omega}{\\psi + \\omega + 180^{\\circ}}\\right.\n\n    where:\n\n    .. math::\n        \\psi &= \\arg(\\rho, 1) \\\\\n        \\omega &= \\sin^{-1}\\left(\\frac{\\rho \\mu}{\\sqrt{\\rho^2 + 1}}\\right) \\\\\n        \\rho &= \\frac{R}{\\frac{180^{\\circ}}{\\pi}(\\mu + 1) + y \\sin \\gamma} \\\\\n        R &= \\sqrt{x^2 + y^2 \\cos^2 \\gamma}\n\n    Parameters\n    ----------\n    mu : float\n        Distance from point of projection to center of sphere\n        in spherical radii, μ.  Default is 0.\n\n    gamma : float\n        Look angle γ in degrees.  Default is 0°.\n\n    ","endLoc":307,"id":13114,"nodeType":"Class","startLoc":269,"text":"class Pix2Sky_ZenithalPerspective(Pix2SkyProjection, Zenithal):\n    r\"\"\"\n    Zenithal perspective projection - pixel to sky.\n\n    Corresponds to the ``AZP`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= \\arg(-y \\cos \\gamma, x) \\\\\n        \\theta &= \\left\\{\\genfrac{}{}{0pt}{}{\\psi - \\omega}{\\psi + \\omega + 180^{\\circ}}\\right.\n\n    where:\n\n    .. math::\n        \\psi &= \\arg(\\rho, 1) \\\\\n        \\omega &= \\sin^{-1}\\left(\\frac{\\rho \\mu}{\\sqrt{\\rho^2 + 1}}\\right) \\\\\n        \\rho &= \\frac{R}{\\frac{180^{\\circ}}{\\pi}(\\mu + 1) + y \\sin \\gamma} \\\\\n        R &= \\sqrt{x^2 + y^2 \\cos^2 \\gamma}\n\n    Parameters\n    ----------\n    mu : float\n        Distance from point of projection to center of sphere\n        in spherical radii, μ.  Default is 0.\n\n    gamma : float\n        Look angle γ in degrees.  Default is 0°.\n\n    \"\"\"\n    mu = _ParameterDS(\n        default=0.0, description=\"Distance from point of projection to center of sphere\"\n    )\n    gamma = _ParameterDS(default=0.0, getter=_to_orig_unit, setter=_to_radian,\n                         description=\"Look angle γ in degrees (Default = 0°)\")\n\n    @mu.validator\n    def mu(self, value):\n        if np.any(np.equal(value, -1.0)):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")"},{"col":4,"comment":"null","endLoc":307,"header":"@mu.validator\n    def mu(self, value)","id":13115,"name":"mu","nodeType":"Function","startLoc":303,"text":"@mu.validator\n    def mu(self, value):\n        if np.any(np.equal(value, -1.0)):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")"},{"col":4,"comment":"\n        Computation and store the individual functions.\n\n        To be implemented by subclasses\"\n        ","endLoc":394,"header":"def _fcache(self, x, y)","id":13116,"name":"_fcache","nodeType":"Function","startLoc":387,"text":"def _fcache(self, x, y):\n        \"\"\"\n        Computation and store the individual functions.\n\n        To be implemented by subclasses\"\n        \"\"\"\n\n        raise NotImplementedError(\"Subclasses should implement this\")"},{"col":4,"comment":"null","endLoc":402,"header":"def evaluate(self, x, y, *coeffs)","id":13117,"name":"evaluate","nodeType":"Function","startLoc":396,"text":"def evaluate(self, x, y, *coeffs):\n        if self.x_domain is not None:\n            x = poly_map_domain(x, self.x_domain, self.x_window)\n        if self.y_domain is not None:\n            y = poly_map_domain(y, self.y_domain, self.y_window)\n        invcoeff = self.invlex_coeff(coeffs)\n        return self.imhorner(x, y, invcoeff)"},{"className":"Cosine1D","col":0,"comment":"\n    One dimensional Cosine model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude\n    frequency : float\n        Oscillation frequency\n    phase : float\n        Oscillation phase\n\n    See Also\n    --------\n    ArcCosine1D, Sine1D, Tangent1D, Const1D, Linear1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = A \\cos(2 \\pi f x + 2 \\pi p)\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Cosine1D\n\n        plt.figure()\n        s1 = Cosine1D(amplitude=1, frequency=.25)\n        r=np.arange(0, 10, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([0, 10, -5, 5])\n        plt.show()\n    ","endLoc":944,"id":13118,"nodeType":"Class","startLoc":870,"text":"class Cosine1D(_Trigonometric1D):\n    \"\"\"\n    One dimensional Cosine model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude\n    frequency : float\n        Oscillation frequency\n    phase : float\n        Oscillation phase\n\n    See Also\n    --------\n    ArcCosine1D, Sine1D, Tangent1D, Const1D, Linear1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = A \\\\cos(2 \\\\pi f x + 2 \\\\pi p)\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Cosine1D\n\n        plt.figure()\n        s1 = Cosine1D(amplitude=1, frequency=.25)\n        r=np.arange(0, 10, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([0, 10, -5, 5])\n        plt.show()\n    \"\"\"\n\n    @staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Cosine model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n        argument = TWOPI * (frequency * x + phase)\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        return amplitude * np.cos(argument)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Cosine model derivative\"\"\"\n\n        d_amplitude = np.cos(TWOPI * frequency * x + TWOPI * phase)\n        d_frequency = - (TWOPI * x * amplitude *\n                         np.sin(TWOPI * frequency * x + TWOPI * phase))\n        d_phase = - (TWOPI * amplitude *\n                     np.sin(TWOPI * frequency * x + TWOPI * phase))\n        return [d_amplitude, d_frequency, d_phase]\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse of Cosine\"\"\"\n\n        return ArcCosine1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)"},{"col":4,"comment":"null","endLoc":101,"header":"def get_fields(self)","id":13119,"name":"get_fields","nodeType":"Function","startLoc":82,"text":"def get_fields(self):\n        # read record fields as an array\n        fields = {}\n        flist = self.aslist()\n        numfields = len(flist)\n        for i in range(numfields):\n            line = flist[i]\n            if line and line[0].isalpha():\n                field = line.split()\n                if i + 1 < numfields:\n                    if not flist[i + 1][0].isalpha():\n                        fields[field[0]] = self.read_array_field(\n                            flist[i:i + int(field[1]) + 1])\n                    else:\n                        fields[field[0]] = \" \".join(s for s in field[1:])\n                else:\n                    fields[field[0]] = \" \".join(s for s in field[1:])\n            else:\n                continue\n        return fields"},{"col":4,"comment":"null","endLoc":80,"header":"def aslist(self)","id":13120,"name":"aslist","nodeType":"Function","startLoc":76,"text":"def aslist(self):\n        reclist = self.recstr.split('\\n')\n        reclist = [l.strip() for l in reclist]\n        [reclist.remove(l) for l in reclist if len(l) == 0]\n        return reclist"},{"col":4,"comment":"null","endLoc":119,"header":"def read_array_field(self, fieldlist)","id":13121,"name":"read_array_field","nodeType":"Function","startLoc":109,"text":"def read_array_field(self, fieldlist):\n        # Turn an iraf record array field into a numpy array\n        fieldline = [l.split() for l in fieldlist[1:]]\n        # take only the first 3 columns\n        # identify writes also strings at the end of some field lines\n        xyz = [l[:3] for l in fieldline]\n        try:\n            farr = np.array(xyz)\n        except Exception:\n            log.debug(f\"Could not read array field {fieldlist[0].split()[0]}\")\n        return farr.astype(np.float64)"},{"col":4,"comment":"One dimensional Cosine model function","endLoc":927,"header":"@staticmethod\n    def evaluate(x, amplitude, frequency, phase)","id":13122,"name":"evaluate","nodeType":"Function","startLoc":916,"text":"@staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Cosine model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n        argument = TWOPI * (frequency * x + phase)\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        return amplitude * np.cos(argument)"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":297,"id":13123,"name":"mu","nodeType":"Attribute","startLoc":297,"text":"mu"},{"col":4,"comment":"null","endLoc":107,"header":"def get_task_name(self)","id":13124,"name":"get_task_name","nodeType":"Function","startLoc":103,"text":"def get_task_name(self):\n        try:\n            return self.fields['task']\n        except KeyError:\n            return None"},{"attributeType":"null","col":8,"comment":"null","endLoc":72,"id":13125,"name":"recstr","nodeType":"Attribute","startLoc":72,"text":"self.recstr"},{"attributeType":"None","col":8,"comment":"null","endLoc":74,"id":13126,"name":"taskname","nodeType":"Attribute","startLoc":74,"text":"self.taskname"},{"attributeType":"null","col":4,"comment":"null","endLoc":81,"id":13127,"name":"linear","nodeType":"Attribute","startLoc":81,"text":"linear"},{"attributeType":"null","col":8,"comment":"null","endLoc":73,"id":13128,"name":"fields","nodeType":"Attribute","startLoc":73,"text":"self.fields"},{"className":"IdentifyRecord","col":0,"comment":"\n    Represents a database record for the onedspec.identify task\n\n    Attributes\n    ----------\n    x: array\n       the X values of the identified features\n       this represents values on axis1 (image rows)\n    y: int\n       the Y values of the identified features\n       (image columns)\n    z: array\n       the values which X maps into\n    modelname: string\n        the function used to fit the data\n    nterms: int\n        degree of the polynomial which was fit to the data\n        in IRAF this is the number of coefficients, not the order\n    mrange: list\n        the range of the data\n    coeff: array\n        function (modelname) coefficients\n    ","endLoc":181,"id":13129,"nodeType":"Class","startLoc":122,"text":"class IdentifyRecord(Record):\n\n    \"\"\"\n    Represents a database record for the onedspec.identify task\n\n    Attributes\n    ----------\n    x: array\n       the X values of the identified features\n       this represents values on axis1 (image rows)\n    y: int\n       the Y values of the identified features\n       (image columns)\n    z: array\n       the values which X maps into\n    modelname: string\n        the function used to fit the data\n    nterms: int\n        degree of the polynomial which was fit to the data\n        in IRAF this is the number of coefficients, not the order\n    mrange: list\n        the range of the data\n    coeff: array\n        function (modelname) coefficients\n    \"\"\"\n    def __init__(self, recstr):\n        super().__init__(recstr)\n        self._flatcoeff = self.fields['coefficients'].flatten()\n        self.x = self.fields['features'][:, 0]\n        self.y = self.get_ydata()\n        self.z = self.fields['features'][:, 1]\n        self.modelname = self.get_model_name()\n        self.nterms = self.get_nterms()\n        self.mrange = self.get_range()\n        self.coeff = self.get_coeff()\n\n    def get_model_name(self):\n        return iraf_models_map[self._flatcoeff[0]]\n\n    def get_nterms(self):\n        return self._flatcoeff[1]\n\n    def get_range(self):\n        low = self._flatcoeff[2]\n        high = self._flatcoeff[3]\n        return [low, high]\n\n    def get_coeff(self):\n        return self._flatcoeff[4:]\n\n    def get_ydata(self):\n        image = self.fields['image']\n        left = image.find('[') + 1\n        right = image.find(']')\n        section = image[left:right]\n        if ',' in section:\n            yind = image.find(',') + 1\n            return int(image[yind:-1])\n        else:\n            return int(section)"},{"col":4,"comment":"One dimensional Cosine model derivative","endLoc":938,"header":"@staticmethod\n    def fit_deriv(x, amplitude, frequency, phase)","id":13130,"name":"fit_deriv","nodeType":"Function","startLoc":929,"text":"@staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Cosine model derivative\"\"\"\n\n        d_amplitude = np.cos(TWOPI * frequency * x + TWOPI * phase)\n        d_frequency = - (TWOPI * x * amplitude *\n                         np.sin(TWOPI * frequency * x + TWOPI * phase))\n        d_phase = - (TWOPI * amplitude *\n                     np.sin(TWOPI * frequency * x + TWOPI * phase))\n        return [d_amplitude, d_frequency, d_phase]"},{"col":4,"comment":"null","endLoc":156,"header":"def __init__(self, recstr)","id":13131,"name":"__init__","nodeType":"Function","startLoc":147,"text":"def __init__(self, recstr):\n        super().__init__(recstr)\n        self._flatcoeff = self.fields['coefficients'].flatten()\n        self.x = self.fields['features'][:, 0]\n        self.y = self.get_ydata()\n        self.z = self.fields['features'][:, 1]\n        self.modelname = self.get_model_name()\n        self.nterms = self.get_nterms()\n        self.mrange = self.get_range()\n        self.coeff = self.get_coeff()"},{"attributeType":"null","col":4,"comment":"null","endLoc":82,"id":13132,"name":"fittable","nodeType":"Attribute","startLoc":82,"text":"fittable"},{"col":4,"comment":"One dimensional inverse of Cosine","endLoc":944,"header":"@property\n    def inverse(self)","id":13133,"name":"inverse","nodeType":"Function","startLoc":940,"text":"@property\n    def inverse(self):\n        \"\"\"One dimensional inverse of Cosine\"\"\"\n\n        return ArcCosine1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)"},{"attributeType":"null","col":4,"comment":"null","endLoc":84,"id":13134,"name":"standard_broadcasting","nodeType":"Attribute","startLoc":84,"text":"standard_broadcasting"},{"attributeType":"null","col":4,"comment":"null","endLoc":86,"id":13135,"name":"_is_dynamic","nodeType":"Attribute","startLoc":86,"text":"_is_dynamic"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":300,"id":13136,"name":"gamma","nodeType":"Attribute","startLoc":300,"text":"gamma"},{"attributeType":"null","col":4,"comment":"null","endLoc":88,"id":13137,"name":"_id","nodeType":"Attribute","startLoc":88,"text":"_id"},{"attributeType":"null","col":8,"comment":"null","endLoc":97,"id":13138,"name":"outputs","nodeType":"Attribute","startLoc":97,"text":"self.outputs"},{"col":4,"comment":"null","endLoc":181,"header":"def get_ydata(self)","id":13139,"name":"get_ydata","nodeType":"Function","startLoc":172,"text":"def get_ydata(self):\n        image = self.fields['image']\n        left = image.find('[') + 1\n        right = image.find(']')\n        section = image[left:right]\n        if ',' in section:\n            yind = image.find(',') + 1\n            return int(image[yind:-1])\n        else:\n            return int(section)"},{"attributeType":"Quantity","col":8,"comment":"null","endLoc":130,"id":13140,"name":"lookup_table","nodeType":"Attribute","startLoc":130,"text":"self.lookup_table"},{"attributeType":"null","col":8,"comment":"null","endLoc":132,"id":13141,"name":"method","nodeType":"Attribute","startLoc":132,"text":"self.method"},{"className":"Tangent1D","col":0,"comment":"\n    One dimensional Tangent model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude\n    frequency : float\n        Oscillation frequency\n    phase : float\n        Oscillation phase\n\n    See Also\n    --------\n    Sine1D, Cosine1D, Const1D, Linear1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = A \\tan(2 \\pi f x + 2 \\pi p)\n\n    Note that the tangent function is undefined for inputs of the form\n    pi/2 + n*pi for all integers n. Thus thus the default bounding box\n    has been restricted to:\n\n        .. math:: [(-1/4 - p)/f, (1/4 - p)/f]\n\n    which is the smallest interval for the tangent function to be continuous\n    on.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Tangent1D\n\n        plt.figure()\n        s1 = Tangent1D(amplitude=1, frequency=.25)\n        r=np.arange(0, 10, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([0, 10, -5, 5])\n        plt.show()\n    ","endLoc":1043,"id":13142,"nodeType":"Class","startLoc":947,"text":"class Tangent1D(_Trigonometric1D):\n    \"\"\"\n    One dimensional Tangent model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude\n    frequency : float\n        Oscillation frequency\n    phase : float\n        Oscillation phase\n\n    See Also\n    --------\n    Sine1D, Cosine1D, Const1D, Linear1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = A \\\\tan(2 \\\\pi f x + 2 \\\\pi p)\n\n    Note that the tangent function is undefined for inputs of the form\n    pi/2 + n*pi for all integers n. Thus thus the default bounding box\n    has been restricted to:\n\n        .. math:: [(-1/4 - p)/f, (1/4 - p)/f]\n\n    which is the smallest interval for the tangent function to be continuous\n    on.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Tangent1D\n\n        plt.figure()\n        s1 = Tangent1D(amplitude=1, frequency=.25)\n        r=np.arange(0, 10, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([0, 10, -5, 5])\n        plt.show()\n    \"\"\"\n\n    @staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Tangent model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n        argument = TWOPI * (frequency * x + phase)\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        return amplitude * np.tan(argument)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Tangent model derivative\"\"\"\n\n        sec = 1 / (np.cos(TWOPI * frequency * x + TWOPI * phase))**2\n\n        d_amplitude = np.tan(TWOPI * frequency * x + TWOPI * phase)\n        d_frequency = TWOPI * x * amplitude * sec\n        d_phase = TWOPI * amplitude * sec\n        return [d_amplitude, d_frequency, d_phase]\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse of Tangent\"\"\"\n\n        return ArcTangent1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)\n\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``\n        \"\"\"\n\n        bbox = [(-1/4 - self.phase) / self.frequency, (1/4 - self.phase) / self.frequency]\n\n        if self.frequency.unit is not None:\n            bbox = bbox / self.frequency.unit\n\n        return bbox"},{"col":4,"comment":"One dimensional Tangent model function","endLoc":1013,"header":"@staticmethod\n    def evaluate(x, amplitude, frequency, phase)","id":13143,"name":"evaluate","nodeType":"Function","startLoc":1002,"text":"@staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Tangent model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n        argument = TWOPI * (frequency * x + phase)\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        return amplitude * np.tan(argument)"},{"col":4,"comment":"One dimensional Tangent model derivative","endLoc":1024,"header":"@staticmethod\n    def fit_deriv(x, amplitude, frequency, phase)","id":13144,"name":"fit_deriv","nodeType":"Function","startLoc":1015,"text":"@staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional Tangent model derivative\"\"\"\n\n        sec = 1 / (np.cos(TWOPI * frequency * x + TWOPI * phase))**2\n\n        d_amplitude = np.tan(TWOPI * frequency * x + TWOPI * phase)\n        d_frequency = TWOPI * x * amplitude * sec\n        d_phase = TWOPI * amplitude * sec\n        return [d_amplitude, d_frequency, d_phase]"},{"col":4,"comment":"One dimensional inverse of Tangent","endLoc":1030,"header":"@property\n    def inverse(self)","id":13145,"name":"inverse","nodeType":"Function","startLoc":1026,"text":"@property\n    def inverse(self):\n        \"\"\"One dimensional inverse of Tangent\"\"\"\n\n        return ArcTangent1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)"},{"col":4,"comment":"null","endLoc":159,"header":"def get_model_name(self)","id":13146,"name":"get_model_name","nodeType":"Function","startLoc":158,"text":"def get_model_name(self):\n        return iraf_models_map[self._flatcoeff[0]]"},{"attributeType":"null","col":8,"comment":"null","endLoc":131,"id":13147,"name":"bounds_error","nodeType":"Attribute","startLoc":131,"text":"self.bounds_error"},{"className":"Sky2Pix_ZenithalPerspective","col":0,"comment":"\n    Zenithal perspective projection - sky to pixel.\n\n    Corresponds to the ``AZP`` projection in FITS WCS.\n\n    .. math::\n        x &= R \\sin \\phi \\\\\n        y &= -R \\sec \\gamma \\cos \\theta\n\n    where:\n\n    .. math::\n        R = \\frac{180^{\\circ}}{\\pi} \\frac{(\\mu + 1) \\cos \\theta}{(\\mu + \\sin \\theta) + \\cos \\theta \\cos \\phi \\tan \\gamma}\n\n    Parameters\n    ----------\n    mu : float\n        Distance from point of projection to center of sphere\n        in spherical radii, μ. Default is 0.\n\n    gamma : float\n        Look angle γ in degrees. Default is 0°.\n\n    ","endLoc":346,"id":13148,"nodeType":"Class","startLoc":310,"text":"class Sky2Pix_ZenithalPerspective(Sky2PixProjection, Zenithal):\n    r\"\"\"\n    Zenithal perspective projection - sky to pixel.\n\n    Corresponds to the ``AZP`` projection in FITS WCS.\n\n    .. math::\n        x &= R \\sin \\phi \\\\\n        y &= -R \\sec \\gamma \\cos \\theta\n\n    where:\n\n    .. math::\n        R = \\frac{180^{\\circ}}{\\pi} \\frac{(\\mu + 1) \\cos \\theta}{(\\mu + \\sin \\theta) + \\cos \\theta \\cos \\phi \\tan \\gamma}\n\n    Parameters\n    ----------\n    mu : float\n        Distance from point of projection to center of sphere\n        in spherical radii, μ. Default is 0.\n\n    gamma : float\n        Look angle γ in degrees. Default is 0°.\n\n    \"\"\"\n    mu = _ParameterDS(\n        default=0.0,\n        description=\"Distance from point of projection to center of sphere\"\n    )\n    gamma = _ParameterDS(default=0.0, getter=_to_orig_unit, setter=_to_radian,\n                         description=\"Look angle γ in degrees (Default=0°)\")\n\n    @mu.validator\n    def mu(self, value):\n        if np.any(np.equal(value, -1.0)):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")"},{"col":4,"comment":"null","endLoc":162,"header":"def get_nterms(self)","id":13149,"name":"get_nterms","nodeType":"Function","startLoc":161,"text":"def get_nterms(self):\n        return self._flatcoeff[1]"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``\n        ","endLoc":1043,"header":"def bounding_box(self)","id":13150,"name":"bounding_box","nodeType":"Function","startLoc":1032,"text":"def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``\n        \"\"\"\n\n        bbox = [(-1/4 - self.phase) / self.frequency, (1/4 - self.phase) / self.frequency]\n\n        if self.frequency.unit is not None:\n            bbox = bbox / self.frequency.unit\n\n        return bbox"},{"col":4,"comment":"null","endLoc":346,"header":"@mu.validator\n    def mu(self, value)","id":13151,"name":"mu","nodeType":"Function","startLoc":342,"text":"@mu.validator\n    def mu(self, value):\n        if np.any(np.equal(value, -1.0)):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")"},{"className":"_InverseTrigonometric1D","col":0,"comment":"\n    Base class for one dimensional inverse trigonometric models\n    ","endLoc":1059,"id":13152,"nodeType":"Class","startLoc":1046,"text":"class _InverseTrigonometric1D(_Trigonometric1D):\n    \"\"\"\n    Base class for one dimensional inverse trigonometric models\n    \"\"\"\n\n    @property\n    def input_units(self):\n        if self.amplitude.unit is None:\n            return None\n        return {self.inputs[0]: self.amplitude.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'frequency': outputs_unit[self.outputs[0]] ** -1,\n                'amplitude': inputs_unit[self.inputs[0]]}"},{"col":4,"comment":"null","endLoc":1055,"header":"@property\n    def input_units(self)","id":13153,"name":"input_units","nodeType":"Function","startLoc":1051,"text":"@property\n    def input_units(self):\n        if self.amplitude.unit is None:\n            return None\n        return {self.inputs[0]: self.amplitude.unit}"},{"col":4,"comment":"null","endLoc":1059,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13154,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1057,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'frequency': outputs_unit[self.outputs[0]] ** -1,\n                'amplitude': inputs_unit[self.inputs[0]]}"},{"className":"ArcSine1D","col":0,"comment":"\n    One dimensional ArcSine model returning values between -pi/2 and pi/2\n    only.\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude for corresponding Sine\n    frequency : float\n        Oscillation frequency for corresponding Sine\n    phase : float\n        Oscillation phase for corresponding Sine\n\n    See Also\n    --------\n    Sine1D, ArcCosine1D, ArcTangent1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = ((arcsin(x / A) / 2pi) - p) / f\n\n    The arcsin function being used for this model will only accept inputs\n    in [-A, A]; otherwise, a runtime warning will be thrown and the result\n    will be NaN. To avoid this, the bounding_box has been properly set to\n    accommodate this; therefore, it is recommended that this model always\n    be evaluated with the ``with_bounding_box=True`` option.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import ArcSine1D\n\n        plt.figure()\n        s1 = ArcSine1D(amplitude=1, frequency=.25)\n        r=np.arange(-1, 1, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([-1, 1, -np.pi/2, np.pi/2])\n        plt.show()\n    ","endLoc":1152,"id":13155,"nodeType":"Class","startLoc":1062,"text":"class ArcSine1D(_InverseTrigonometric1D):\n    \"\"\"\n    One dimensional ArcSine model returning values between -pi/2 and pi/2\n    only.\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude for corresponding Sine\n    frequency : float\n        Oscillation frequency for corresponding Sine\n    phase : float\n        Oscillation phase for corresponding Sine\n\n    See Also\n    --------\n    Sine1D, ArcCosine1D, ArcTangent1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = ((arcsin(x / A) / 2pi) - p) / f\n\n    The arcsin function being used for this model will only accept inputs\n    in [-A, A]; otherwise, a runtime warning will be thrown and the result\n    will be NaN. To avoid this, the bounding_box has been properly set to\n    accommodate this; therefore, it is recommended that this model always\n    be evaluated with the ``with_bounding_box=True`` option.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import ArcSine1D\n\n        plt.figure()\n        s1 = ArcSine1D(amplitude=1, frequency=.25)\n        r=np.arange(-1, 1, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([-1, 1, -np.pi/2, np.pi/2])\n        plt.show()\n    \"\"\"\n\n    @staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcSine model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n\n        argument = x / amplitude\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        arc_sine = np.arcsin(argument) / TWOPI\n\n        return (arc_sine - phase) / frequency\n\n    @staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcSine model derivative\"\"\"\n\n        d_amplitude = - x / (TWOPI * frequency * amplitude**2 * np.sqrt(1 - (x / amplitude)**2))\n        d_frequency = (phase - (np.arcsin(x / amplitude) / TWOPI)) / frequency**2\n        d_phase = - 1 / frequency * np.ones(x.shape)\n        return [d_amplitude, d_frequency, d_phase]\n\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``\n        \"\"\"\n\n        return -1 * self.amplitude, 1 * self.amplitude\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse of ArcSine\"\"\"\n\n        return Sine1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)"},{"col":4,"comment":"null","endLoc":167,"header":"def get_range(self)","id":13156,"name":"get_range","nodeType":"Function","startLoc":164,"text":"def get_range(self):\n        low = self._flatcoeff[2]\n        high = self._flatcoeff[3]\n        return [low, high]"},{"col":4,"comment":"One dimensional ArcSine model function","endLoc":1129,"header":"@staticmethod\n    def evaluate(x, amplitude, frequency, phase)","id":13157,"name":"evaluate","nodeType":"Function","startLoc":1115,"text":"@staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcSine model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n\n        argument = x / amplitude\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        arc_sine = np.arcsin(argument) / TWOPI\n\n        return (arc_sine - phase) / frequency"},{"col":4,"comment":"One dimensional ArcSine model derivative","endLoc":1138,"header":"@staticmethod\n    def fit_deriv(x, amplitude, frequency, phase)","id":13158,"name":"fit_deriv","nodeType":"Function","startLoc":1131,"text":"@staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcSine model derivative\"\"\"\n\n        d_amplitude = - x / (TWOPI * frequency * amplitude**2 * np.sqrt(1 - (x / amplitude)**2))\n        d_frequency = (phase - (np.arcsin(x / amplitude) / TWOPI)) / frequency**2\n        d_phase = - 1 / frequency * np.ones(x.shape)\n        return [d_amplitude, d_frequency, d_phase]"},{"col":4,"comment":"null","endLoc":170,"header":"def get_coeff(self)","id":13159,"name":"get_coeff","nodeType":"Function","startLoc":169,"text":"def get_coeff(self):\n        return self._flatcoeff[4:]"},{"attributeType":"null","col":8,"comment":"null","endLoc":155,"id":13160,"name":"mrange","nodeType":"Attribute","startLoc":155,"text":"self.mrange"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``\n        ","endLoc":1146,"header":"def bounding_box(self)","id":13161,"name":"bounding_box","nodeType":"Function","startLoc":1140,"text":"def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``\n        \"\"\"\n\n        return -1 * self.amplitude, 1 * self.amplitude"},{"col":4,"comment":"One dimensional inverse of ArcSine","endLoc":1152,"header":"@property\n    def inverse(self)","id":13162,"name":"inverse","nodeType":"Function","startLoc":1148,"text":"@property\n    def inverse(self):\n        \"\"\"One dimensional inverse of ArcSine\"\"\"\n\n        return Sine1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)"},{"attributeType":"null","col":8,"comment":"null","endLoc":153,"id":13163,"name":"modelname","nodeType":"Attribute","startLoc":153,"text":"self.modelname"},{"attributeType":"null","col":8,"comment":"null","endLoc":149,"id":13164,"name":"_flatcoeff","nodeType":"Attribute","startLoc":149,"text":"self._flatcoeff"},{"attributeType":"null","col":8,"comment":"null","endLoc":150,"id":13165,"name":"x","nodeType":"Attribute","startLoc":150,"text":"self.x"},{"attributeType":"null","col":8,"comment":"null","endLoc":133,"id":13166,"name":"fill_value","nodeType":"Attribute","startLoc":133,"text":"self.fill_value"},{"attributeType":"null","col":8,"comment":"null","endLoc":151,"id":13167,"name":"y","nodeType":"Attribute","startLoc":151,"text":"self.y"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":335,"id":13168,"name":"mu","nodeType":"Attribute","startLoc":335,"text":"mu"},{"attributeType":"null","col":8,"comment":"null","endLoc":152,"id":13169,"name":"z","nodeType":"Attribute","startLoc":152,"text":"self.z"},{"attributeType":"null","col":8,"comment":"null","endLoc":129,"id":13170,"name":"points","nodeType":"Attribute","startLoc":129,"text":"self.points"},{"attributeType":"null","col":8,"comment":"null","endLoc":154,"id":13171,"name":"nterms","nodeType":"Attribute","startLoc":154,"text":"self.nterms"},{"attributeType":"null","col":8,"comment":"null","endLoc":156,"id":13172,"name":"coeff","nodeType":"Attribute","startLoc":156,"text":"self.coeff"},{"className":"FitcoordsRecord","col":0,"comment":"\n    Represents a database record for the longslit.fitccords task\n\n    Attributes\n    ----------\n    modelname: string\n        the function used to fit the data\n    xorder: int\n        number of terms in x\n    yorder: int\n        number of terms in y\n    xbounds: list\n        data range in x\n    ybounds: list\n        data range in y\n    coeff: array\n        function coefficients\n\n    ","endLoc":216,"id":13173,"nodeType":"Class","startLoc":184,"text":"class FitcoordsRecord(Record):\n\n    \"\"\"\n    Represents a database record for the longslit.fitccords task\n\n    Attributes\n    ----------\n    modelname: string\n        the function used to fit the data\n    xorder: int\n        number of terms in x\n    yorder: int\n        number of terms in y\n    xbounds: list\n        data range in x\n    ybounds: list\n        data range in y\n    coeff: array\n        function coefficients\n\n    \"\"\"\n    def __init__(self, recstr):\n        super().__init__(recstr)\n        self._surface = self.fields['surface'].flatten()\n        self.modelname = iraf_models_map[self._surface[0]]\n        self.xorder = self._surface[1]\n        self.yorder = self._surface[2]\n        self.xbounds = [self._surface[4], self._surface[5]]\n        self.ybounds = [self._surface[6], self._surface[7]]\n        self.coeff = self.get_coeff()\n\n    def get_coeff(self):\n        return self._surface[8:]"},{"col":4,"comment":"null","endLoc":213,"header":"def __init__(self, recstr)","id":13174,"name":"__init__","nodeType":"Function","startLoc":205,"text":"def __init__(self, recstr):\n        super().__init__(recstr)\n        self._surface = self.fields['surface'].flatten()\n        self.modelname = iraf_models_map[self._surface[0]]\n        self.xorder = self._surface[1]\n        self.yorder = self._surface[2]\n        self.xbounds = [self._surface[4], self._surface[5]]\n        self.ybounds = [self._surface[6], self._surface[7]]\n        self.coeff = self.get_coeff()"},{"className":"ArcCosine1D","col":0,"comment":"\n    One dimensional ArcCosine returning values between 0 and pi only.\n\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude for corresponding Cosine\n    frequency : float\n        Oscillation frequency for corresponding Cosine\n    phase : float\n        Oscillation phase for corresponding Cosine\n\n    See Also\n    --------\n    Cosine1D, ArcSine1D, ArcTangent1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = ((arccos(x / A) / 2pi) - p) / f\n\n    The arccos function being used for this model will only accept inputs\n    in [-A, A]; otherwise, a runtime warning will be thrown and the result\n    will be NaN. To avoid this, the bounding_box has been properly set to\n    accommodate this; therefore, it is recommended that this model always\n    be evaluated with the ``with_bounding_box=True`` option.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import ArcCosine1D\n\n        plt.figure()\n        s1 = ArcCosine1D(amplitude=1, frequency=.25)\n        r=np.arange(-1, 1, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([-1, 1, 0, np.pi])\n        plt.show()\n    ","endLoc":1245,"id":13175,"nodeType":"Class","startLoc":1155,"text":"class ArcCosine1D(_InverseTrigonometric1D):\n    \"\"\"\n    One dimensional ArcCosine returning values between 0 and pi only.\n\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude for corresponding Cosine\n    frequency : float\n        Oscillation frequency for corresponding Cosine\n    phase : float\n        Oscillation phase for corresponding Cosine\n\n    See Also\n    --------\n    Cosine1D, ArcSine1D, ArcTangent1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = ((arccos(x / A) / 2pi) - p) / f\n\n    The arccos function being used for this model will only accept inputs\n    in [-A, A]; otherwise, a runtime warning will be thrown and the result\n    will be NaN. To avoid this, the bounding_box has been properly set to\n    accommodate this; therefore, it is recommended that this model always\n    be evaluated with the ``with_bounding_box=True`` option.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import ArcCosine1D\n\n        plt.figure()\n        s1 = ArcCosine1D(amplitude=1, frequency=.25)\n        r=np.arange(-1, 1, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([-1, 1, 0, np.pi])\n        plt.show()\n    \"\"\"\n\n    @staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcCosine model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n\n        argument = x / amplitude\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        arc_cos = np.arccos(argument) / TWOPI\n\n        return (arc_cos - phase) / frequency\n\n    @staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcCosine model derivative\"\"\"\n\n        d_amplitude = x / (TWOPI * frequency * amplitude**2 * np.sqrt(1 - (x / amplitude)**2))\n        d_frequency = (phase - (np.arccos(x / amplitude) / TWOPI)) / frequency**2\n        d_phase = - 1 / frequency * np.ones(x.shape)\n        return [d_amplitude, d_frequency, d_phase]\n\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``\n        \"\"\"\n\n        return -1 * self.amplitude, 1 * self.amplitude\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse of ArcCosine\"\"\"\n\n        return Cosine1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)"},{"col":4,"comment":"One dimensional ArcCosine model function","endLoc":1222,"header":"@staticmethod\n    def evaluate(x, amplitude, frequency, phase)","id":13176,"name":"evaluate","nodeType":"Function","startLoc":1208,"text":"@staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcCosine model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n\n        argument = x / amplitude\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        arc_cos = np.arccos(argument) / TWOPI\n\n        return (arc_cos - phase) / frequency"},{"col":4,"comment":"One dimensional ArcCosine model derivative","endLoc":1231,"header":"@staticmethod\n    def fit_deriv(x, amplitude, frequency, phase)","id":13177,"name":"fit_deriv","nodeType":"Function","startLoc":1224,"text":"@staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcCosine model derivative\"\"\"\n\n        d_amplitude = x / (TWOPI * frequency * amplitude**2 * np.sqrt(1 - (x / amplitude)**2))\n        d_frequency = (phase - (np.arccos(x / amplitude) / TWOPI)) / frequency**2\n        d_phase = - 1 / frequency * np.ones(x.shape)\n        return [d_amplitude, d_frequency, d_phase]"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":339,"id":13178,"name":"gamma","nodeType":"Attribute","startLoc":339,"text":"gamma"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``\n        ","endLoc":1239,"header":"def bounding_box(self)","id":13179,"name":"bounding_box","nodeType":"Function","startLoc":1233,"text":"def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``\n        \"\"\"\n\n        return -1 * self.amplitude, 1 * self.amplitude"},{"col":4,"comment":"One dimensional inverse of ArcCosine","endLoc":1245,"header":"@property\n    def inverse(self)","id":13180,"name":"inverse","nodeType":"Function","startLoc":1241,"text":"@property\n    def inverse(self):\n        \"\"\"One dimensional inverse of ArcCosine\"\"\"\n\n        return Cosine1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)"},{"className":"Pix2Sky_SlantZenithalPerspective","col":0,"comment":"\n    Slant zenithal perspective projection - pixel to sky.\n\n    Corresponds to the ``SZP`` projection in FITS WCS.\n\n    Parameters\n    ----------\n    mu : float\n        Distance from point of projection to center of sphere\n        in spherical radii, μ.  Default is 0.\n\n    phi0 : float\n        The longitude φ₀ of the reference point, in degrees.  Default\n        is 0°.\n\n    theta0 : float\n        The latitude θ₀ of the reference point, in degrees.  Default\n        is 90°.\n\n    ","endLoc":387,"id":13181,"nodeType":"Class","startLoc":349,"text":"class Pix2Sky_SlantZenithalPerspective(Pix2SkyProjection, Zenithal):\n    r\"\"\"\n    Slant zenithal perspective projection - pixel to sky.\n\n    Corresponds to the ``SZP`` projection in FITS WCS.\n\n    Parameters\n    ----------\n    mu : float\n        Distance from point of projection to center of sphere\n        in spherical radii, μ.  Default is 0.\n\n    phi0 : float\n        The longitude φ₀ of the reference point, in degrees.  Default\n        is 0°.\n\n    theta0 : float\n        The latitude θ₀ of the reference point, in degrees.  Default\n        is 90°.\n\n    \"\"\"\n    mu = _ParameterDS(\n        default=0.0,\n        description=\"Distance from point of projection to center of sphere\"\n    )\n    phi0 = _ParameterDS(\n        default=0.0, getter=_to_orig_unit, setter=_to_radian,\n        description=\"The longitude φ₀ of the reference point in degrees (Default=0°)\"\n    )\n    theta0 = _ParameterDS(\n        default=90.0, getter=_to_orig_unit, setter=_to_radian,\n        description=\"The latitude θ₀ of the reference point, in degrees (Default=0°)\"\n    )\n\n    @mu.validator\n    def mu(self, value):\n        if np.any(np.equal(value, -1.0)):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")"},{"col":4,"comment":"null","endLoc":387,"header":"@mu.validator\n    def mu(self, value)","id":13182,"name":"mu","nodeType":"Function","startLoc":383,"text":"@mu.validator\n    def mu(self, value):\n        if np.any(np.equal(value, -1.0)):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")"},{"className":"ArcTangent1D","col":0,"comment":"\n    One dimensional ArcTangent model returning values between -pi/2 and\n    pi/2 only.\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude for corresponding Tangent\n    frequency : float\n        Oscillation frequency for corresponding Tangent\n    phase : float\n        Oscillation phase for corresponding Tangent\n\n    See Also\n    --------\n    Tangent1D, ArcSine1D, ArcCosine1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = ((arctan(x / A) / 2pi) - p) / f\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import ArcTangent1D\n\n        plt.figure()\n        s1 = ArcTangent1D(amplitude=1, frequency=.25)\n        r=np.arange(-10, 10, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([-10, 10, -np.pi/2, np.pi/2])\n        plt.show()\n    ","endLoc":1324,"id":13183,"nodeType":"Class","startLoc":1248,"text":"class ArcTangent1D(_InverseTrigonometric1D):\n    \"\"\"\n    One dimensional ArcTangent model returning values between -pi/2 and\n    pi/2 only.\n\n    Parameters\n    ----------\n    amplitude : float\n        Oscillation amplitude for corresponding Tangent\n    frequency : float\n        Oscillation frequency for corresponding Tangent\n    phase : float\n        Oscillation phase for corresponding Tangent\n\n    See Also\n    --------\n    Tangent1D, ArcSine1D, ArcCosine1D\n\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = ((arctan(x / A) / 2pi) - p) / f\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import ArcTangent1D\n\n        plt.figure()\n        s1 = ArcTangent1D(amplitude=1, frequency=.25)\n        r=np.arange(-10, 10, .01)\n\n        for amplitude in range(1,4):\n             s1.amplitude = amplitude\n             plt.plot(r, s1(r), color=str(0.25 * amplitude), lw=2)\n\n        plt.axis([-10, 10, -np.pi/2, np.pi/2])\n        plt.show()\n    \"\"\"\n\n    @staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcTangent model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n\n        argument = x / amplitude\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        arc_cos = np.arctan(argument) / TWOPI\n\n        return (arc_cos - phase) / frequency\n\n    @staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcTangent model derivative\"\"\"\n\n        d_amplitude = - x / (TWOPI * frequency * amplitude**2 * (1 + (x / amplitude)**2))\n        d_frequency = (phase - (np.arctan(x / amplitude) / TWOPI)) / frequency**2\n        d_phase = - 1 / frequency * np.ones(x.shape)\n        return [d_amplitude, d_frequency, d_phase]\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse of ArcTangent\"\"\"\n\n        return Tangent1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)"},{"attributeType":"null","col":4,"comment":"null","endLoc":29,"id":13184,"name":"has_scipy","nodeType":"Attribute","startLoc":29,"text":"has_scipy"},{"col":4,"comment":"One dimensional ArcTangent model function","endLoc":1309,"header":"@staticmethod\n    def evaluate(x, amplitude, frequency, phase)","id":13185,"name":"evaluate","nodeType":"Function","startLoc":1295,"text":"@staticmethod\n    def evaluate(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcTangent model function\"\"\"\n        # Note: If frequency and x are quantities, they should normally have\n        # inverse units, so that argument ends up being dimensionless. However,\n        # np.sin of a dimensionless quantity will crash, so we remove the\n        # quantity-ness from argument in this case (another option would be to\n        # multiply by * u.rad but this would be slower overall).\n\n        argument = x / amplitude\n        if isinstance(argument, Quantity):\n            argument = argument.value\n        arc_cos = np.arctan(argument) / TWOPI\n\n        return (arc_cos - phase) / frequency"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":370,"id":13186,"name":"mu","nodeType":"Attribute","startLoc":370,"text":"mu"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":13187,"name":"__all__","nodeType":"Attribute","startLoc":33,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":13188,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":35,"text":"__doctest_requires__"},{"col":4,"comment":"One dimensional ArcTangent model derivative","endLoc":1318,"header":"@staticmethod\n    def fit_deriv(x, amplitude, frequency, phase)","id":13189,"name":"fit_deriv","nodeType":"Function","startLoc":1311,"text":"@staticmethod\n    def fit_deriv(x, amplitude, frequency, phase):\n        \"\"\"One dimensional ArcTangent model derivative\"\"\"\n\n        d_amplitude = - x / (TWOPI * frequency * amplitude**2 * (1 + (x / amplitude)**2))\n        d_frequency = (phase - (np.arctan(x / amplitude) / TWOPI)) / frequency**2\n        d_phase = - 1 / frequency * np.ones(x.shape)\n        return [d_amplitude, d_frequency, d_phase]"},{"col":4,"comment":"null","endLoc":216,"header":"def get_coeff(self)","id":13190,"name":"get_coeff","nodeType":"Function","startLoc":215,"text":"def get_coeff(self):\n        return self._surface[8:]"},{"attributeType":"null","col":8,"comment":"null","endLoc":209,"id":13191,"name":"xorder","nodeType":"Attribute","startLoc":209,"text":"self.xorder"},{"attributeType":"null","col":0,"comment":"null","endLoc":323,"id":13192,"name":"Tabular1D","nodeType":"Attribute","startLoc":323,"text":"Tabular1D"},{"attributeType":"null","col":0,"comment":"null","endLoc":325,"id":13193,"name":"Tabular2D","nodeType":"Attribute","startLoc":325,"text":"Tabular2D"},{"col":4,"comment":"One dimensional inverse of ArcTangent","endLoc":1324,"header":"@property\n    def inverse(self)","id":13194,"name":"inverse","nodeType":"Function","startLoc":1320,"text":"@property\n    def inverse(self):\n        \"\"\"One dimensional inverse of ArcTangent\"\"\"\n\n        return Tangent1D(amplitude=self.amplitude, frequency=self.frequency, phase=self.phase)"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":374,"id":13195,"name":"phi0","nodeType":"Attribute","startLoc":374,"text":"phi0"},{"col":4,"comment":"null","endLoc":459,"header":"@staticmethod\n    def _deriv_with_constraints(model, param_indices, x=None, y=None)","id":13196,"name":"_deriv_with_constraints","nodeType":"Function","startLoc":449,"text":"@staticmethod\n    def _deriv_with_constraints(model, param_indices, x=None, y=None):\n        if y is None:\n            d = np.array(model.fit_deriv(x, *model.parameters))\n        else:\n            d = np.array(model.fit_deriv(x, y, *model.parameters))\n\n        if model.col_fit_deriv:\n            return d[param_indices]\n        else:\n            return d[..., param_indices]"},{"className":"Linear1D","col":0,"comment":"\n    One dimensional Line model.\n\n    Parameters\n    ----------\n    slope : float\n        Slope of the straight line\n\n    intercept : float\n        Intercept of the straight line\n\n    See Also\n    --------\n    Const1D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = a x + b\n    ","endLoc":1381,"id":13197,"nodeType":"Class","startLoc":1327,"text":"class Linear1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Line model.\n\n    Parameters\n    ----------\n    slope : float\n        Slope of the straight line\n\n    intercept : float\n        Intercept of the straight line\n\n    See Also\n    --------\n    Const1D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x) = a x + b\n    \"\"\"\n    slope = Parameter(default=1, description=\"Slope of the straight line\")\n    intercept = Parameter(default=0, description=\"Intercept of the straight line\")\n    linear = True\n\n    @staticmethod\n    def evaluate(x, slope, intercept):\n        \"\"\"One dimensional Line model function\"\"\"\n\n        return slope * x + intercept\n\n    @staticmethod\n    def fit_deriv(x, *params):\n        \"\"\"One dimensional Line model derivative with respect to parameters\"\"\"\n\n        d_slope = x\n        d_intercept = np.ones_like(x)\n        return [d_slope, d_intercept]\n\n    @property\n    def inverse(self):\n        new_slope = self.slope ** -1\n        new_intercept = -self.intercept / self.slope\n        return self.__class__(slope=new_slope, intercept=new_intercept)\n\n    @property\n    def input_units(self):\n        if self.intercept.unit is None and self.slope.unit is None:\n            return None\n        return {self.inputs[0]: self.intercept.unit / self.slope.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'intercept': outputs_unit[self.outputs[0]],\n                'slope': outputs_unit[self.outputs[0]] / inputs_unit[self.inputs[0]]}"},{"attributeType":"null","col":8,"comment":"null","endLoc":212,"id":13198,"name":"ybounds","nodeType":"Attribute","startLoc":212,"text":"self.ybounds"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":378,"id":13199,"name":"theta0","nodeType":"Attribute","startLoc":378,"text":"theta0"},{"col":4,"comment":"One dimensional Line model function","endLoc":1357,"header":"@staticmethod\n    def evaluate(x, slope, intercept)","id":13200,"name":"evaluate","nodeType":"Function","startLoc":1353,"text":"@staticmethod\n    def evaluate(x, slope, intercept):\n        \"\"\"One dimensional Line model function\"\"\"\n\n        return slope * x + intercept"},{"col":4,"comment":"One dimensional Line model derivative with respect to parameters","endLoc":1365,"header":"@staticmethod\n    def fit_deriv(x, *params)","id":13201,"name":"fit_deriv","nodeType":"Function","startLoc":1359,"text":"@staticmethod\n    def fit_deriv(x, *params):\n        \"\"\"One dimensional Line model derivative with respect to parameters\"\"\"\n\n        d_slope = x\n        d_intercept = np.ones_like(x)\n        return [d_slope, d_intercept]"},{"col":4,"comment":"null","endLoc":1371,"header":"@property\n    def inverse(self)","id":13202,"name":"inverse","nodeType":"Function","startLoc":1367,"text":"@property\n    def inverse(self):\n        new_slope = self.slope ** -1\n        new_intercept = -self.intercept / self.slope\n        return self.__class__(slope=new_slope, intercept=new_intercept)"},{"className":"Sky2Pix_SlantZenithalPerspective","col":0,"comment":"\n    Zenithal perspective projection - sky to pixel.\n\n    Corresponds to the ``SZP`` projection in FITS WCS.\n\n    Parameters\n    ----------\n    mu : float\n        distance from point of projection to center of sphere\n        in spherical radii, μ.  Default is 0.\n\n    phi0 : float\n        The longitude φ₀ of the reference point, in degrees.  Default\n        is 0°.\n\n    theta0 : float\n        The latitude θ₀ of the reference point, in degrees.  Default\n        is 90°.\n\n    ","endLoc":427,"id":13203,"nodeType":"Class","startLoc":390,"text":"class Sky2Pix_SlantZenithalPerspective(Sky2PixProjection, Zenithal):\n    r\"\"\"\n    Zenithal perspective projection - sky to pixel.\n\n    Corresponds to the ``SZP`` projection in FITS WCS.\n\n    Parameters\n    ----------\n    mu : float\n        distance from point of projection to center of sphere\n        in spherical radii, μ.  Default is 0.\n\n    phi0 : float\n        The longitude φ₀ of the reference point, in degrees.  Default\n        is 0°.\n\n    theta0 : float\n        The latitude θ₀ of the reference point, in degrees.  Default\n        is 90°.\n\n    \"\"\"\n    mu = _ParameterDS(\n        default=0.0, description=\"Distance from point of projection to center of sphere\"\n    )\n    phi0 = _ParameterDS(\n        default=0.0, getter=_to_orig_unit, setter=_to_radian,\n        description=\"The longitude φ₀ of the reference point in degrees\"\n    )\n    theta0 = _ParameterDS(\n        default=0.0, getter=_to_orig_unit, setter=_to_radian,\n        description=\"The latitude θ₀ of the reference point, in degrees\"\n    )\n\n    @mu.validator\n    def mu(self, value):\n        if np.any(np.equal(value, -1.0)):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")"},{"attributeType":"null","col":8,"comment":"null","endLoc":211,"id":13204,"name":"xbounds","nodeType":"Attribute","startLoc":211,"text":"self.xbounds"},{"attributeType":"null","col":0,"comment":"null","endLoc":327,"id":13205,"name":"_tab_docs","nodeType":"Attribute","startLoc":327,"text":"_tab_docs"},{"col":0,"comment":"","endLoc":18,"header":"tabular.py#<anonymous>","id":13206,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nTabular models.\n\nTabular models of any dimension can be created using `tabular_model`.\nFor convenience `Tabular1D` and `Tabular2D` are provided.\n\nExamples\n--------\n>>> table = np.array([[ 3.,  0.,  0.],\n...                  [ 0.,  2.,  0.],\n...                  [ 0.,  0.,  0.]])\n>>> points = ([1, 2, 3], [1, 2, 3])\n>>> t2 = Tabular2D(points, lookup_table=table, bounds_error=False,\n...                fill_value=None, method='nearest')\n\n\"\"\"\n\ntry:\n    from scipy.interpolate import interpn\n    has_scipy = True\nexcept ImportError:\n    has_scipy = False\n\n__all__ = ['tabular_model', 'Tabular1D', 'Tabular2D']\n\n__doctest_requires__ = {('tabular_model'): ['scipy']}\n\nTabular1D = tabular_model(1, name='Tabular1D')\n\nTabular2D = tabular_model(2, name='Tabular2D')\n\n_tab_docs = \"\"\"\n    method : str, optional\n        The method of interpolation to perform. Supported are \"linear\" and\n        \"nearest\", and \"splinef2d\". \"splinef2d\" is only supported for\n        2-dimensional data. Default is \"linear\".\n    bounds_error : bool, optional\n        If True, when interpolated values are requested outside of the\n        domain of the input data, a ValueError is raised.\n        If False, then ``fill_value`` is used.\n    fill_value : float, optional\n        If provided, the value to use for points outside of the\n        interpolation domain. If None, values outside\n        the domain are extrapolated.  Extrapolation is not supported by method\n        \"splinef2d\".\n\n    Returns\n    -------\n    value : ndarray\n        Interpolated values at input coordinates.\n\n    Raises\n    ------\n    ImportError\n        Scipy is not installed.\n\n    Notes\n    -----\n    Uses `scipy.interpolate.interpn`.\n\"\"\"\n\nTabular1D.__doc__ = \"\"\"\n    Tabular model in 1D.\n    Returns an interpolated lookup table value.\n\n    Parameters\n    ----------\n    points : array-like of float of ndim=1.\n        The points defining the regular grid in n dimensions.\n    lookup_table : array-like, of ndim=1.\n        The data in one dimensions.\n\"\"\" + _tab_docs\n\nTabular2D.__doc__ = \"\"\"\n    Tabular model in 2D.\n    Returns an interpolated lookup table value.\n\n    Parameters\n    ----------\n    points : tuple of ndarray of float, optional\n        The points defining the regular grid in n dimensions.\n        ndarray with shapes (m1, m2).\n    lookup_table : array-like\n        The data on a regular grid in 2 dimensions.\n        Shape (m1, m2).\n\n\"\"\" + _tab_docs"},{"attributeType":"null","col":8,"comment":"null","endLoc":207,"id":13207,"name":"_surface","nodeType":"Attribute","startLoc":207,"text":"self._surface"},{"attributeType":"null","col":8,"comment":"null","endLoc":208,"id":13208,"name":"modelname","nodeType":"Attribute","startLoc":208,"text":"self.modelname"},{"attributeType":"null","col":8,"comment":"null","endLoc":210,"id":13209,"name":"yorder","nodeType":"Attribute","startLoc":210,"text":"self.yorder"},{"col":4,"comment":"null","endLoc":1377,"header":"@property\n    def input_units(self)","id":13210,"name":"input_units","nodeType":"Function","startLoc":1373,"text":"@property\n    def input_units(self):\n        if self.intercept.unit is None and self.slope.unit is None:\n            return None\n        return {self.inputs[0]: self.intercept.unit / self.slope.unit}"},{"col":4,"comment":"null","endLoc":1381,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13211,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1379,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'intercept': outputs_unit[self.outputs[0]],\n                'slope': outputs_unit[self.outputs[0]] / inputs_unit[self.inputs[0]]}"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1349,"id":13212,"name":"slope","nodeType":"Attribute","startLoc":1349,"text":"slope"},{"attributeType":"null","col":8,"comment":"null","endLoc":213,"id":13213,"name":"coeff","nodeType":"Attribute","startLoc":213,"text":"self.coeff"},{"col":4,"comment":"\n        Maps domain into window for a polynomial model which has these\n        attributes.\n        ","endLoc":485,"header":"def _map_domain_window(self, model, x, y=None)","id":13214,"name":"_map_domain_window","nodeType":"Function","startLoc":461,"text":"def _map_domain_window(self, model, x, y=None):\n        \"\"\"\n        Maps domain into window for a polynomial model which has these\n        attributes.\n        \"\"\"\n\n        if y is None:\n            if hasattr(model, 'domain') and model.domain is None:\n                model.domain = [x.min(), x.max()]\n            if hasattr(model, 'window') and model.window is None:\n                model.window = [-1, 1]\n            return poly_map_domain(x, model.domain, model.window)\n        else:\n            if hasattr(model, 'x_domain') and model.x_domain is None:\n                model.x_domain = [x.min(), x.max()]\n            if hasattr(model, 'y_domain') and model.y_domain is None:\n                model.y_domain = [y.min(), y.max()]\n            if hasattr(model, 'x_window') and model.x_window is None:\n                model.x_window = [-1., 1.]\n            if hasattr(model, 'y_window') and model.y_window is None:\n                model.y_window = [-1., 1.]\n\n            xnew = poly_map_domain(x, model.x_domain, model.x_window)\n            ynew = poly_map_domain(y, model.y_domain, model.y_window)\n            return xnew, ynew"},{"className":"IDB","col":0,"comment":"\n    Base class for an IRAF identify database\n\n    Attributes\n    ----------\n    records: list\n             a list of all `IdentifyRecord` in the database\n    numrecords: int\n             number of records\n    ","endLoc":246,"id":13215,"nodeType":"Class","startLoc":219,"text":"class IDB:\n\n    \"\"\"\n    Base class for an IRAF identify database\n\n    Attributes\n    ----------\n    records: list\n             a list of all `IdentifyRecord` in the database\n    numrecords: int\n             number of records\n    \"\"\"\n    def __init__(self, dtbstr):\n        self.records = [IdentifyRecord(rstr) for rstr in self.aslist(dtbstr)]\n        self.numrecords = len(self.records)\n\n    def aslist(self, dtb):\n        # return a list of records\n        # if the first one is a comment remove it from the list\n        rl = dtb.split('begin')\n        try:\n            rl0 = rl[0].split('\\n')\n        except Exception:\n            return rl\n        if len(rl0) == 2 and rl0[0].startswith('#') and not rl0[1].strip():\n            return rl[1:]\n        else:\n            return rl"},{"col":4,"comment":"null","endLoc":233,"header":"def __init__(self, dtbstr)","id":13216,"name":"__init__","nodeType":"Function","startLoc":231,"text":"def __init__(self, dtbstr):\n        self.records = [IdentifyRecord(rstr) for rstr in self.aslist(dtbstr)]\n        self.numrecords = len(self.records)"},{"fileName":"example_models.py","filePath":"astropy/modeling/tests","id":13217,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nHere are all the test parameters and values for the each\n`~astropy.modeling.FittableModel` defined. There is a dictionary for 1D and a\ndictionary for 2D models.\n\nExplanation of keywords of the dictionaries:\n\n\"parameters\" : list or dict\n    Model parameters, the model is tested with. Make sure you keep the right\n    order.  For polynomials you can also use a dict to specify the\n    coefficients. See examples below.\n\n\"x_values\" : list\n    x values where the model is evaluated.\n\n\"y_values\" : list\n    Reference y values for the in x_values given positions.\n\n\"z_values\" : list\n    Reference z values for the in x_values and y_values given positions.\n    (2D model option)\n\n\"x_lim\" : list\n    x test range for the model fitter. Depending on the model this can differ\n    e.g. the PowerLaw model should be tested over a few magnitudes.\n\n\"y_lim\" : list\n    y test range for the model fitter. Depending on the model this can differ\n    e.g. the PowerLaw model should be tested over a few magnitudes.  (2D model\n    option)\n\n\"log_fit\" : bool\n    PowerLaw models should be tested over a few magnitudes. So log_fit should\n    be true.\n\n\"requires_scipy\" : bool\n    If a model requires scipy (Bessel functions etc.) set this flag.\n\n\"integral\" : float\n    Approximate value of the integral in the range x_lim (and y_lim).\n\n\"deriv_parameters\" : list\n    If given the test of the derivative will use these parameters to create a\n    model (optional)\n\n\"deriv_initial\" : list\n    If given the test of the derivative will use these parameters as initial\n    values for the fit (optional)\n\"\"\"\n\n\nfrom astropy.modeling.functional_models import (\n    Gaussian1D,\n    Sine1D, Cosine1D, Tangent1D, ArcSine1D, ArcCosine1D, ArcTangent1D,\n    Box1D, Linear1D, Lorentz1D,\n    RickerWavelet1D, Trapezoid1D, Const1D, Moffat1D,\n    Gaussian2D, Const2D, Box2D, RickerWavelet2D,\n    TrapezoidDisk2D, AiryDisk2D, Moffat2D, Disk2D,\n    Ring2D, Sersic1D, Sersic2D, Voigt1D, Planar2D, KingProjectedAnalytic1D,\n    Exponential1D, Logarithmic1D)\nfrom astropy.modeling.physical_models import Drude1D, Plummer1D\nfrom astropy.modeling.polynomial import Polynomial1D, Polynomial2D\nfrom astropy.modeling.powerlaws import (\n    PowerLaw1D, BrokenPowerLaw1D, SmoothlyBrokenPowerLaw1D, ExponentialCutoffPowerLaw1D,\n    LogParabola1D)\nimport numpy as np\n\n# 1D Models\nmodels_1D = {\n    Gaussian1D: {\n        'parameters': [1, 0, 1],\n        'x_values': [0, np.sqrt(2), -np.sqrt(2)],\n        'y_values': [1.0, 0.367879, 0.367879],\n        'x_lim': [-10, 10],\n        'integral': np.sqrt(2 * np.pi),\n        'bbox_peak': True\n    },\n\n    Sine1D: {\n        'parameters': [1, 0.1, 0],\n        'x_values': [0, 2.5],\n        'y_values': [0, 1],\n        'x_lim': [-10, 10],\n        'integral': 0\n    },\n\n    Cosine1D: {\n        'parameters': [1, 0.1, 0],\n        'x_values': [0, 2.5],\n        'y_values': [1, 0],\n        'x_lim': [-10, 10],\n        'integral': 0\n    },\n\n    Tangent1D: {\n        'parameters': [1, 0.1, 0],\n        'x_values': [0, 1.25],\n        'y_values': [0, 1],\n        'x_lim': [-10, 10],\n        'integral': 0\n    },\n\n    ArcSine1D: {\n        'parameters': [1, 0.1, 0],\n        'x_values': [0, 1],\n        'y_values': [0, 2.5],\n        'x_lim': [-0.5, 0.5],\n        'integral': 0\n    },\n\n    ArcCosine1D: {\n        'parameters': [1, 0.1, 0],\n        'x_values': [1, 0],\n        'y_values': [0, 2.5],\n        'x_lim': [-0.5, 0.5],\n        'integral': 0\n    },\n\n    ArcTangent1D: {\n        'parameters': [1, 0.1, 0],\n        'x_values': [0, 1],\n        'y_values': [0, 1.25],\n        'x_lim': [-10, 10],\n        'integral': 0\n    },\n\n    Box1D: {\n        'parameters': [1, 0, 10],\n        'x_values': [-5, 5, 0, -10, 10],\n        'y_values': [1, 1, 1, 0, 0],\n        'x_lim': [-10, 10],\n        'integral': 10,\n        'bbox_peak': True\n    },\n\n    Linear1D: {\n        'parameters': [1, 0],\n        'x_values': [0, np.pi, 42, -1],\n        'y_values': [0, np.pi, 42, -1],\n        'x_lim': [-10, 10],\n        'integral': 0\n    },\n\n    Lorentz1D: {\n        'parameters': [1, 0, 1],\n        'x_values': [0, -1, 1, 0.5, -0.5],\n        'y_values': [1., 0.2, 0.2, 0.5, 0.5],\n        'x_lim': [-10, 10],\n        'integral': 1,\n        'bbox_peak': True\n    },\n\n    RickerWavelet1D: {\n        'parameters': [1, 0, 1],\n        'x_values': [0, 1, -1, 3, -3],\n        'y_values': [1.0, 0.0, 0.0, -0.088872, -0.088872],\n        'x_lim': [-20, 20],\n        'integral': 0,\n        'bbox_peak': True\n    },\n\n    Trapezoid1D: {\n        'parameters': [1, 0, 2, 1],\n        'x_values': [0, 1, -1, 1.5, -1.5, 2, 2],\n        'y_values': [1, 1, 1, 0.5, 0.5, 0, 0],\n        'x_lim': [-10, 10],\n        'integral': 3,\n        'bbox_peak': True\n    },\n\n    Const1D: {\n        'parameters': [1],\n        'x_values': [-1, 1, np.pi, -42., 0],\n        'y_values': [1, 1, 1, 1, 1],\n        'x_lim': [-10, 10],\n        'integral': 20\n    },\n\n    Moffat1D: {\n        'parameters': [1, 0, 1, 2],\n        'x_values': [0, 1, -1, 3, -3],\n        'y_values': [1.0, 0.25, 0.25, 0.01, 0.01],\n        'x_lim': [-10, 10],\n        'integral': 1,\n        'deriv_parameters': [23.4, 1.2, 2.1, 2.3],\n        'deriv_initial': [10, 1, 1, 1]\n    },\n\n    PowerLaw1D: {\n        'parameters': [1, 1, 2],\n        'constraints': {'fixed': {'x_0': True}},\n        'x_values': [1, 10, 100],\n        'y_values': [1.0, 0.01, 0.0001],\n        'x_lim': [1, 10],\n        'log_fit': True,\n        'integral': 0.99\n    },\n\n    BrokenPowerLaw1D: {\n        'parameters': [1, 1, 2, 3],\n        'constraints': {'fixed': {'x_break': True}},\n        'x_values': [0.1, 1, 10, 100],\n        'y_values': [1e2, 1.0, 1e-3, 1e-6],\n        'x_lim': [0.1, 100],\n        'log_fit': True\n    },\n\n    SmoothlyBrokenPowerLaw1D: {\n        'parameters': [1, 1, -2, 2, 0.5],\n        'constraints': {'fixed': {'x_break': True, 'delta': True}},\n        'x_values': [0.01, 1, 100],\n        'y_values': [3.99920012e-04, 1.0, 3.99920012e-04],\n        'x_lim': [0.01, 100],\n        'log_fit': True\n    },\n\n    ExponentialCutoffPowerLaw1D: {\n        'parameters': [1, 1, 2, 3],\n        'constraints': {'fixed': {'x_0': True}},\n        'x_values': [0.1, 1, 10, 100],\n        'y_values': [9.67216100e+01, 7.16531311e-01, 3.56739933e-04,\n                     3.33823780e-19],\n        'x_lim': [0.01, 100],\n        'log_fit': True\n    },\n\n    LogParabola1D: {\n        'parameters': [1, 2, 3, 0.1],\n        'constraints': {'fixed': {'x_0': True}},\n        'x_values': [0.1, 1, 10, 100],\n        'y_values': [3.26089063e+03, 7.62472488e+00, 6.17440488e-03,\n                     1.73160572e-06],\n        'x_lim': [0.1, 100],\n        'log_fit': True\n    },\n\n    Polynomial1D: {\n        'parameters': {'degree': 2, 'c0': 1., 'c1': 1., 'c2': 1.},\n        'x_values': [1, 10, 100],\n        'y_values': [3, 111, 10101],\n        'x_lim': [-3, 3]\n     },\n\n    Sersic1D: {\n        'parameters': [1, 20, 4],\n        'x_values': [0.1, 1, 10, 100],\n        'y_values': [2.78629391e+02, 5.69791430e+01, 3.38788244e+00,\n                     2.23941982e-02],\n        'requires_scipy': True,\n        'x_lim': [0, 10],\n        'log_fit': True\n    },\n\n    Voigt1D: {\n        'parameters': [0, 1, 0.5, 0.9],\n        'x_values': [0, 0.2, 0.5, 1, 2, 4, 8, 20],\n        'y_values': [0.52092360, 0.479697445, 0.317550374, 0.0988079347,\n                     1.73876624e-2, 4.00173216e-3, 9.82351731e-4, 1.56396993e-4],\n        'x_lim': [-3, 3]\n     },\n\n    KingProjectedAnalytic1D: {\n        'parameters': [1, 1, 2],\n        'x_values': [0, 0.1, 0.5, 0.8],\n        'y_values': [0.30557281, 0.30011069, 0.2, 0.1113258],\n        'x_lim': [0, 10],\n        'y_lim': [0, 10],\n        'bbox_peak': True\n    },\n\n    Drude1D: {\n        'parameters': [1.0, 8.0, 1.0],\n        'x_values': [7.0, 8.0, 9.0, 10.0],\n        'y_values': [0.17883212, 1.0, 0.21891892, 0.07163324],\n        'x_lim': [1.0, 20.0],\n        'y_lim': [0.0, 10.0],\n        'bbox_peak': True\n    },\n\n    Plummer1D: {\n        'parameters': [10., 0.5],\n        'x_values': [1.0000e-03, 2.5005e+00, 5.0000e+00],\n        'y_values': [1.90984022e+01, 5.53541843e-03, 1.86293603e-04],\n        'x_lim': [0.001, 100]\n    },\n\n    Exponential1D: {\n        'parameters': [1, 1],\n        'x_values': [0, 0.5, 1],\n        'y_values': [1, np.sqrt(np.e), np.e],\n        'x_lim': [0, 2],\n        'integral': (np.e**2 - 1.),\n    },\n\n    Logarithmic1D: {\n        'parameters': [1, 1],\n        'x_values': [1, np.e, np.e**2],\n        'y_values': [0, 1, 2],\n        'x_lim': [1, np.e**2],\n        'integral': (np.e**2 + 1),\n    }\n}\n\n\n# 2D Models\nmodels_2D = {\n    Gaussian2D: {\n        'parameters': [1, 0, 0, 1, 1],\n        'constraints': {'fixed': {'theta': True}},\n        'x_values': [0, np.sqrt(2), -np.sqrt(2)],\n        'y_values': [0, np.sqrt(2), -np.sqrt(2)],\n        'z_values': [1, 1. / np.exp(1) ** 2, 1. / np.exp(1) ** 2],\n        'x_lim': [-10, 10],\n        'y_lim': [-10, 10],\n        'integral': 2 * np.pi,\n        'deriv_parameters': [137., 5.1, 5.4, 1.5, 2., np.pi/4],\n        'deriv_initial': [10, 5, 5, 4, 4, .5],\n        'bbox_peak': True\n    },\n\n    Const2D: {\n        'parameters': [1],\n        'x_values': [-1, 1, np.pi, -42., 0],\n        'y_values': [0, 1, 42, np.pi, -1],\n        'z_values': [1, 1, 1, 1, 1],\n        'x_lim': [-10, 10],\n        'y_lim': [-10, 10],\n        'integral': 400\n    },\n\n    Box2D: {\n        'parameters': [1, 0, 0, 10, 10],\n        'x_values': [-5, 5, -5, 5, 0, -10, 10],\n        'y_values': [-5, 5, 0, 0, 0, -10, 10],\n        'z_values': [1, 1, 1, 1, 1, 0, 0],\n        'x_lim': [-10, 10],\n        'y_lim': [-10, 10],\n        'integral': 100,\n        'bbox_peak': True\n    },\n\n    RickerWavelet2D: {\n        'parameters': [1, 0, 0, 1],\n        'x_values': [0, 0, 0, 0, 0, 1, -1, 3, -3],\n        'y_values': [0, 1, -1, 3, -3, 0, 0, 0, 0],\n        'z_values': [1.0, 0.303265, 0.303265, -0.038881, -0.038881,\n                     0.303265, 0.303265, -0.038881, -0.038881],\n        'x_lim': [-10, 11],\n        'y_lim': [-10, 11],\n        'integral': 0\n    },\n\n    TrapezoidDisk2D: {\n        'parameters': [1, 0, 0, 1, 1],\n        'x_values': [0, 0.5, 0, 1.5],\n        'y_values': [0, 0.5, 1.5, 0],\n        'z_values': [1, 1, 0.5, 0.5],\n        'x_lim': [-3, 3],\n        'y_lim': [-3, 3],\n        'bbox_peak': True\n    },\n\n    AiryDisk2D: {\n        'parameters': [7, 0, 0, 10],\n        'x_values': [0, 1, -1, -0.5, -0.5],\n        'y_values': [0, -1, 0.5, 0.5, -0.5],\n        'z_values': [7., 6.50158267, 6.68490643, 6.87251093, 6.87251093],\n        'x_lim': [-10, 10],\n        'y_lim': [-10, 10],\n        'requires_scipy': True\n    },\n\n    Moffat2D: {\n        'parameters': [1, 0, 0, 1, 2],\n        'x_values': [0, 1, -1, 3, -3],\n        'y_values': [0, -1, 3, 1, -3],\n        'z_values': [1.0, 0.111111, 0.008264, 0.008264, 0.00277],\n        'x_lim': [-3, 3],\n        'y_lim': [-3, 3]\n    },\n\n    Polynomial2D: {\n        'parameters': {'degree': 1, 'c0_0': 1., 'c1_0': 1., 'c0_1': 1.},\n        'x_values': [1, 2, 3],\n        'y_values': [1, 3, 2],\n        'z_values': [3, 6, 6],\n        'x_lim': [1, 100],\n        'y_lim': [1, 100]\n    },\n\n    Disk2D: {\n        'parameters': [1, 0, 0, 5],\n        'x_values': [-5, 5, -5, 5, 0, -10, 10],\n        'y_values': [-5, 5, 0, 0, 0, -10, 10],\n        'z_values': [0, 0, 1, 1, 1, 0, 0],\n        'x_lim': [-10, 10],\n        'y_lim': [-10, 10],\n        'integral': np.pi * 5 ** 2,\n        'bbox_peak': True\n    },\n\n    Ring2D: {\n        'parameters': [1, 0, 0, 5, 5],\n        'x_values': [-5, 5, -5, 5, 0, -10, 10],\n        'y_values': [-5, 5, 0, 0, 0, -10, 10],\n        'z_values': [1, 1, 1, 1, 0, 0, 0],\n        'x_lim': [-10, 10],\n        'y_lim': [-10, 10],\n        'integral': np.pi * (10 ** 2 - 5 ** 2),\n        'bbox_peak': True\n    },\n\n    Sersic2D: {\n        'parameters': [1, 25, 4, 50, 50, 0.5, -1],\n        'x_values': [0.0, 1, 10, 100],\n        'y_values': [1, 100, 0.0, 10],\n        'z_values': [1.686398e-02, 9.095221e-02, 2.341879e-02, 9.419231e-02],\n        'requires_scipy': True,\n        'x_lim': [1, 1e10],\n        'y_lim': [1, 1e10]\n    },\n\n    Planar2D: {\n        'parameters': [1, 1, 0],\n        'x_values': [0, np.pi, 42, -1],\n        'y_values': [np.pi, 0, -1, 42],\n        'z_values': [np.pi, np.pi, 41, 41],\n        'x_lim': [-10, 10],\n        'y_lim': [-10, 10],\n        'integral': 0\n    }\n}\n"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1350,"id":13218,"name":"intercept","nodeType":"Attribute","startLoc":1350,"text":"intercept"},{"col":4,"comment":"null","endLoc":427,"header":"@mu.validator\n    def mu(self, value)","id":13219,"name":"mu","nodeType":"Function","startLoc":423,"text":"@mu.validator\n    def mu(self, value):\n        if np.any(np.equal(value, -1.0)):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":411,"id":13220,"name":"mu","nodeType":"Attribute","startLoc":411,"text":"mu"},{"className":"Box1D","col":0,"comment":"\n    One dimensional Box model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude A\n    x_0 : float\n        Position of the center of the box function\n    width : float\n        Width of the box\n\n    See Also\n    --------\n    Box2D, TrapezoidDisk2D\n\n    Notes\n    -----\n    Model formula:\n\n      .. math::\n\n            f(x) = \\left \\{\n                     \\begin{array}{ll}\n                       A & : x_0 - w/2 \\leq x \\leq x_0 + w/2 \\\\\n                       0 & : \\text{else}\n                     \\end{array}\n                   \\right.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Box1D\n\n        plt.figure()\n        s1 = Box1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            s1.width = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n    ","endLoc":2262,"id":13221,"nodeType":"Class","startLoc":2171,"text":"class Box1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Box model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude A\n    x_0 : float\n        Position of the center of the box function\n    width : float\n        Width of the box\n\n    See Also\n    --------\n    Box2D, TrapezoidDisk2D\n\n    Notes\n    -----\n    Model formula:\n\n      .. math::\n\n            f(x) = \\\\left \\\\{\n                     \\\\begin{array}{ll}\n                       A & : x_0 - w/2 \\\\leq x \\\\leq x_0 + w/2 \\\\\\\\\n                       0 & : \\\\text{else}\n                     \\\\end{array}\n                   \\\\right.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Box1D\n\n        plt.figure()\n        s1 = Box1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            s1.width = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude A\")\n    x_0 = Parameter(default=0, description=\"Position of center of box function\")\n    width = Parameter(default=1, description=\"Width of the box\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, width):\n        \"\"\"One dimensional Box model function\"\"\"\n\n        inside = np.logical_and(x >= x_0 - width / 2., x <= x_0 + width / 2.)\n        return np.select([inside], [amplitude], 0)\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``(x_low, x_high))``\n        \"\"\"\n\n        dx = self.width / 2\n\n        return (self.x_0 - dx, self.x_0 + dx)\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    @property\n    def return_units(self):\n        if self.amplitude.unit is None:\n            return None\n        return {self.outputs[0]: self.amplitude.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'width': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"col":4,"comment":"One dimensional Box model function","endLoc":2233,"header":"@staticmethod\n    def evaluate(x, amplitude, x_0, width)","id":13222,"name":"evaluate","nodeType":"Function","startLoc":2228,"text":"@staticmethod\n    def evaluate(x, amplitude, x_0, width):\n        \"\"\"One dimensional Box model function\"\"\"\n\n        inside = np.logical_and(x >= x_0 - width / 2., x <= x_0 + width / 2.)\n        return np.select([inside], [amplitude], 0)"},{"col":4,"comment":"\n        Fit data to this model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            model to fit to x, y, z\n        x : array\n            Input coordinates\n        y : array-like\n            Input coordinates\n        z : array-like, optional\n            Input coordinates.\n            If the dependent (``y`` or ``z``) coordinate values are provided\n            as a `numpy.ma.MaskedArray`, any masked points are ignored when\n            fitting. Note that model set fitting is significantly slower when\n            there are masked points (not just an empty mask), as the matrix\n            equation has to be solved for each model separately when their\n            coordinate grids differ.\n        weights : array, optional\n            Weights for fitting.\n            For data with Gaussian uncertainties, the weights should be\n            1/sigma.\n        rcond :  float, optional\n            Cut-off ratio for small singular values of ``a``.\n            Singular values are set to zero if they are smaller than ``rcond``\n            times the largest singular value of ``a``.\n        equivalencies : list or None, optional, keyword-only\n            List of *additional* equivalencies that are should be applied in\n            case x, y and/or z have units. Default is None.\n\n        Returns\n        -------\n        model_copy : `~astropy.modeling.FittableModel`\n            a copy of the input model with parameters set by the fitter\n\n        ","endLoc":792,"header":"@fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None, rcond=None)","id":13223,"name":"__call__","nodeType":"Function","startLoc":487,"text":"@fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None, rcond=None):\n        \"\"\"\n        Fit data to this model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            model to fit to x, y, z\n        x : array\n            Input coordinates\n        y : array-like\n            Input coordinates\n        z : array-like, optional\n            Input coordinates.\n            If the dependent (``y`` or ``z``) coordinate values are provided\n            as a `numpy.ma.MaskedArray`, any masked points are ignored when\n            fitting. Note that model set fitting is significantly slower when\n            there are masked points (not just an empty mask), as the matrix\n            equation has to be solved for each model separately when their\n            coordinate grids differ.\n        weights : array, optional\n            Weights for fitting.\n            For data with Gaussian uncertainties, the weights should be\n            1/sigma.\n        rcond :  float, optional\n            Cut-off ratio for small singular values of ``a``.\n            Singular values are set to zero if they are smaller than ``rcond``\n            times the largest singular value of ``a``.\n        equivalencies : list or None, optional, keyword-only\n            List of *additional* equivalencies that are should be applied in\n            case x, y and/or z have units. Default is None.\n\n        Returns\n        -------\n        model_copy : `~astropy.modeling.FittableModel`\n            a copy of the input model with parameters set by the fitter\n\n        \"\"\"\n\n        if not model.fittable:\n            raise ValueError(\"Model must be a subclass of FittableModel\")\n\n        if not model.linear:\n            raise ModelLinearityError('Model is not linear in parameters, '\n                                      'linear fit methods should not be used.')\n\n        if hasattr(model, \"submodel_names\"):\n            raise ValueError(\"Model must be simple, not compound\")\n\n        _validate_constraints(self.supported_constraints, model)\n\n        model_copy = model.copy()\n        model_copy.sync_constraints = False\n        _, fitparam_indices = model_to_fit_params(model_copy)\n\n        if model_copy.n_inputs == 2 and z is None:\n            raise ValueError(\"Expected x, y and z for a 2 dimensional model.\")\n\n        farg = _convert_input(x, y, z, n_models=len(model_copy),\n                              model_set_axis=model_copy.model_set_axis)\n\n        has_fixed = any(model_copy.fixed.values())\n\n        # This is also done by _convert_inputs, but we need it here to allow\n        # checking the array dimensionality before that gets called:\n        if weights is not None:\n            weights = np.asarray(weights, dtype=float)\n\n        if has_fixed:\n\n            # The list of fixed params is the complement of those being fitted:\n            fixparam_indices = [idx for idx in\n                                range(len(model_copy.param_names))\n                                if idx not in fitparam_indices]\n\n            # Construct matrix of user-fixed parameters that can be dotted with\n            # the corresponding fit_deriv() terms, to evaluate corrections to\n            # the dependent variable in order to fit only the remaining terms:\n            fixparams = np.asarray([getattr(model_copy,\n                                            model_copy.param_names[idx]).value\n                                    for idx in fixparam_indices])\n\n        if len(farg) == 2:\n            x, y = farg\n\n            if weights is not None:\n                # If we have separate weights for each model, apply the same\n                # conversion as for the data, otherwise check common weights\n                # as if for a single model:\n                _, weights = _convert_input(\n                    x, weights,\n                    n_models=len(model_copy) if weights.ndim == y.ndim else 1,\n                    model_set_axis=model_copy.model_set_axis\n                )\n\n            # map domain into window\n            if hasattr(model_copy, 'domain'):\n                x = self._map_domain_window(model_copy, x)\n            if has_fixed:\n                lhs = np.asarray(self._deriv_with_constraints(model_copy,\n                                                              fitparam_indices,\n                                                              x=x))\n                fixderivs = self._deriv_with_constraints(model_copy, fixparam_indices, x=x)\n            else:\n                lhs = np.asarray(model_copy.fit_deriv(x, *model_copy.parameters))\n            sum_of_implicit_terms = model_copy.sum_of_implicit_terms(x)\n            rhs = y\n        else:\n            x, y, z = farg\n\n            if weights is not None:\n                # If we have separate weights for each model, apply the same\n                # conversion as for the data, otherwise check common weights\n                # as if for a single model:\n                _, _, weights = _convert_input(\n                    x, y, weights,\n                    n_models=len(model_copy) if weights.ndim == z.ndim else 1,\n                    model_set_axis=model_copy.model_set_axis\n                )\n\n            # map domain into window\n            if hasattr(model_copy, 'x_domain'):\n                x, y = self._map_domain_window(model_copy, x, y)\n\n            if has_fixed:\n                lhs = np.asarray(self._deriv_with_constraints(model_copy,\n                                                              fitparam_indices, x=x, y=y))\n                fixderivs = self._deriv_with_constraints(model_copy,\n                                                         fixparam_indices,\n                                                         x=x, y=y)\n            else:\n                lhs = np.asanyarray(model_copy.fit_deriv(x, y, *model_copy.parameters))\n            sum_of_implicit_terms = model_copy.sum_of_implicit_terms(x, y)\n\n            if len(model_copy) > 1:\n\n                # Just to be explicit (rather than baking in False == 0):\n                model_axis = model_copy.model_set_axis or 0\n\n                if z.ndim > 2:\n                    # For higher-dimensional z, flatten all the axes except the\n                    # dimension along which models are stacked and transpose so\n                    # the model axis is *last* (I think this resolves Erik's\n                    # pending generalization from 80a6f25a):\n                    rhs = np.rollaxis(z, model_axis, z.ndim)\n                    rhs = rhs.reshape(-1, rhs.shape[-1])\n                else:\n                    # This \"else\" seems to handle the corner case where the\n                    # user has already flattened x/y before attempting a 2D fit\n                    # but z has a second axis for the model set. NB. This is\n                    # ~5-10x faster than using rollaxis.\n                    rhs = z.T if model_axis == 0 else z\n\n                if weights is not None:\n                    # Same for weights\n                    if weights.ndim > 2:\n                        # Separate 2D weights for each model:\n                        weights = np.rollaxis(weights, model_axis, weights.ndim)\n                        weights = weights.reshape(-1, weights.shape[-1])\n                    elif weights.ndim == z.ndim:\n                        # Separate, flattened weights for each model:\n                        weights = weights.T if model_axis == 0 else weights\n                    else:\n                        # Common weights for all the models:\n                        weights = weights.flatten()\n            else:\n                rhs = z.flatten()\n                if weights is not None:\n                    weights = weights.flatten()\n\n        # If the derivative is defined along rows (as with non-linear models)\n        if model_copy.col_fit_deriv:\n            lhs = np.asarray(lhs).T\n\n        # Some models (eg. Polynomial1D) don't flatten multi-dimensional inputs\n        # when constructing their Vandermonde matrix, which can lead to obscure\n        # failures below. Ultimately, np.linalg.lstsq can't handle >2D matrices,\n        # so just raise a slightly more informative error when this happens:\n        if np.asanyarray(lhs).ndim > 2:\n            raise ValueError('{} gives unsupported >2D derivative matrix for '\n                             'this x/y'.format(type(model_copy).__name__))\n\n        # Subtract any terms fixed by the user from (a copy of) the RHS, in\n        # order to fit the remaining terms correctly:\n        if has_fixed:\n            if model_copy.col_fit_deriv:\n                fixderivs = np.asarray(fixderivs).T  # as for lhs above\n            rhs = rhs - fixderivs.dot(fixparams)  # evaluate user-fixed terms\n\n        # Subtract any terms implicit in the model from the RHS, which, like\n        # user-fixed terms, affect the dependent variable but are not fitted:\n        if sum_of_implicit_terms is not None:\n            # If we have a model set, the extra axis must be added to\n            # sum_of_implicit_terms as its innermost dimension, to match the\n            # dimensionality of rhs after _convert_input \"rolls\" it as needed\n            # by np.linalg.lstsq. The vector then gets broadcast to the right\n            # number of sets (columns). This assumes all the models share the\n            # same input coordinates, as is currently the case.\n            if len(model_copy) > 1:\n                sum_of_implicit_terms = sum_of_implicit_terms[..., np.newaxis]\n            rhs = rhs - sum_of_implicit_terms\n\n        if weights is not None:\n\n            if rhs.ndim == 2:\n                if weights.shape == rhs.shape:\n                    # separate weights for multiple models case: broadcast\n                    # lhs to have more dimension (for each model)\n                    lhs = lhs[..., np.newaxis] * weights[:, np.newaxis]\n                    rhs = rhs * weights\n                else:\n                    lhs *= weights[:, np.newaxis]\n                    # Don't modify in-place in case rhs was the original\n                    # dependent variable array\n                    rhs = rhs * weights[:, np.newaxis]\n            else:\n                lhs *= weights[:, np.newaxis]\n                rhs = rhs * weights\n\n        scl = (lhs * lhs).sum(0)\n        lhs /= scl\n\n        masked = np.any(np.ma.getmask(rhs))\n        if weights is not None and not masked and np.any(np.isnan(lhs)):\n            raise ValueError('Found NaNs in the coefficient matrix, which '\n                             'should not happen and would crash the lapack '\n                             'routine. Maybe check that weights are not null.')\n\n        a = None  # need for calculating covarience\n\n        if ((masked and len(model_copy) > 1) or\n                (weights is not None and weights.ndim > 1)):\n\n            # Separate masks or weights for multiple models case: Numpy's\n            # lstsq supports multiple dimensions only for rhs, so we need to\n            # loop manually on the models. This may be fixed in the future\n            # with https://github.com/numpy/numpy/pull/15777.\n\n            # Initialize empty array of coefficients and populate it one model\n            # at a time. The shape matches the number of coefficients from the\n            # Vandermonde matrix and the number of models from the RHS:\n            lacoef = np.zeros(lhs.shape[1:2] + rhs.shape[-1:], dtype=rhs.dtype)\n\n            # Arrange the lhs as a stack of 2D matrices that we can iterate\n            # over to get the correctly-orientated lhs for each model:\n            if lhs.ndim > 2:\n                lhs_stack = np.rollaxis(lhs, -1, 0)\n            else:\n                lhs_stack = np.broadcast_to(lhs, rhs.shape[-1:] + lhs.shape)\n\n            # Loop over the models and solve for each one. By this point, the\n            # model set axis is the second of two. Transpose rather than using,\n            # say, np.moveaxis(array, -1, 0), since it's slightly faster and\n            # lstsq can't handle >2D arrays anyway. This could perhaps be\n            # optimized by collecting together models with identical masks\n            # (eg. those with no rejected points) into one operation, though it\n            # will still be relatively slow when calling lstsq repeatedly.\n            for model_lhs, model_rhs, model_lacoef in zip(lhs_stack, rhs.T, lacoef.T):\n\n                # Cull masked points on both sides of the matrix equation:\n                good = ~model_rhs.mask if masked else slice(None)\n                model_lhs = model_lhs[good]\n                model_rhs = model_rhs[good][..., np.newaxis]\n                a = model_lhs\n\n                # Solve for this model:\n                t_coef, resids, rank, sval = np.linalg.lstsq(model_lhs,\n                                                             model_rhs, rcond)\n                model_lacoef[:] = t_coef.T\n\n        else:\n\n            # If we're fitting one or more models over a common set of points,\n            # we only have to solve a single matrix equation, which is an order\n            # of magnitude faster than calling lstsq() once per model below:\n\n            good = ~rhs.mask if masked else slice(None)  # latter is a no-op\n            a = lhs[good]\n            # Solve for one or more models:\n            lacoef, resids, rank, sval = np.linalg.lstsq(lhs[good],\n                                                         rhs[good], rcond)\n\n        self.fit_info['residuals'] = resids\n        self.fit_info['rank'] = rank\n        self.fit_info['singular_values'] = sval\n\n        lacoef /= scl[:, np.newaxis] if scl.ndim < rhs.ndim else scl\n        self.fit_info['params'] = lacoef\n\n        fitter_to_model_params(model_copy, lacoef.flatten())\n\n        # TODO: Only Polynomial models currently have an _order attribute;\n        # maybe change this to read isinstance(model, PolynomialBase)\n        if hasattr(model_copy, '_order') and len(model_copy) == 1 \\\n                and not has_fixed and rank != model_copy._order:\n            warnings.warn(\"The fit may be poorly conditioned\\n\",\n                          AstropyUserWarning)\n\n        # calculate and set covariance matrix and standard devs. on model\n        if self._calc_uncertainties:\n            if len(y) > len(lacoef):\n                self._add_fitting_uncertainties(model_copy, a*scl,\n                                               len(lacoef), x, y, z, resids)\n        model_copy.sync_constraints = True\n        return model_copy"},{"col":4,"comment":"null","endLoc":246,"header":"def aslist(self, dtb)","id":13224,"name":"aslist","nodeType":"Function","startLoc":235,"text":"def aslist(self, dtb):\n        # return a list of records\n        # if the first one is a comment remove it from the list\n        rl = dtb.split('begin')\n        try:\n            rl0 = rl[0].split('\\n')\n        except Exception:\n            return rl\n        if len(rl0) == 2 and rl0[0].startswith('#') and not rl0[1].strip():\n            return rl[1:]\n        else:\n            return rl"},{"col":4,"comment":"null","endLoc":412,"header":"def prepare_inputs(self, x, y, **kwargs)","id":13225,"name":"prepare_inputs","nodeType":"Function","startLoc":404,"text":"def prepare_inputs(self, x, y, **kwargs):\n        inputs, broadcasted_shapes = super().prepare_inputs(x, y, **kwargs)\n\n        x, y = inputs\n\n        if x.shape != y.shape:\n            raise ValueError(\"Expected input arrays to have the same shape\")\n\n        return (x, y), broadcasted_shapes"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``(x_low, x_high))``\n        ","endLoc":2245,"header":"@property\n    def bounding_box(self)","id":13226,"name":"bounding_box","nodeType":"Function","startLoc":2235,"text":"@property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``(x_low, x_high))``\n        \"\"\"\n\n        dx = self.width / 2\n\n        return (self.x_0 - dx, self.x_0 + dx)"},{"attributeType":"null","col":8,"comment":"null","endLoc":233,"id":13227,"name":"numrecords","nodeType":"Attribute","startLoc":233,"text":"self.numrecords"},{"col":4,"comment":"null","endLoc":2251,"header":"@property\n    def input_units(self)","id":13228,"name":"input_units","nodeType":"Function","startLoc":2247,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}"},{"col":4,"comment":"null","endLoc":2257,"header":"@property\n    def return_units(self)","id":13229,"name":"return_units","nodeType":"Function","startLoc":2253,"text":"@property\n    def return_units(self):\n        if self.amplitude.unit is None:\n            return None\n        return {self.outputs[0]: self.amplitude.unit}"},{"col":4,"comment":"null","endLoc":2262,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13230,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2259,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'width': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":2224,"id":13231,"name":"amplitude","nodeType":"Attribute","startLoc":2224,"text":"amplitude"},{"attributeType":"null","col":8,"comment":"null","endLoc":232,"id":13232,"name":"records","nodeType":"Attribute","startLoc":232,"text":"self.records"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":414,"id":13233,"name":"phi0","nodeType":"Attribute","startLoc":414,"text":"phi0"},{"className":"ReidentifyRecord","col":0,"comment":"\n    Represents a database record for the onedspec.reidentify task\n    ","endLoc":263,"id":13234,"nodeType":"Class","startLoc":249,"text":"class ReidentifyRecord(IDB):\n\n    \"\"\"\n    Represents a database record for the onedspec.reidentify task\n    \"\"\"\n    def __init__(self, databasestr):\n        super().__init__(databasestr)\n        self.x = np.array([r.x for r in self.records])\n        self.y = self.get_ydata()\n        self.z = np.array([r.z for r in self.records])\n\n    def get_ydata(self):\n        y = np.ones(self.x.shape)\n        y = y * np.array([r.y for r in self.records])[:, np.newaxis]\n        return y"},{"col":4,"comment":"null","endLoc":258,"header":"def __init__(self, databasestr)","id":13235,"name":"__init__","nodeType":"Function","startLoc":254,"text":"def __init__(self, databasestr):\n        super().__init__(databasestr)\n        self.x = np.array([r.x for r in self.records])\n        self.y = self.get_ydata()\n        self.z = np.array([r.z for r in self.records])"},{"attributeType":"null","col":4,"comment":"null","endLoc":214,"id":13236,"name":"n_inputs","nodeType":"Attribute","startLoc":214,"text":"n_inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":215,"id":13237,"name":"n_outputs","nodeType":"Attribute","startLoc":215,"text":"n_outputs"},{"attributeType":"null","col":8,"comment":"null","endLoc":222,"id":13238,"name":"_order","nodeType":"Attribute","startLoc":222,"text":"self._order"},{"attributeType":"null","col":4,"comment":"null","endLoc":2225,"id":13239,"name":"x_0","nodeType":"Attribute","startLoc":2225,"text":"x_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":2226,"id":13240,"name":"width","nodeType":"Attribute","startLoc":2226,"text":"width"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":418,"id":13241,"name":"theta0","nodeType":"Attribute","startLoc":418,"text":"theta0"},{"className":"Lorentz1D","col":0,"comment":"\n    One dimensional Lorentzian model.\n\n    Parameters\n    ----------\n    amplitude : float or `~astropy.units.Quantity`.\n        Peak value - for a normalized profile (integrating to 1),\n        set amplitude = 2 / (np.pi * fwhm)\n    x_0 : float or `~astropy.units.Quantity`.\n        Position of the peak\n    fwhm : float or `~astropy.units.Quantity`.\n        Full width at half maximum (FWHM)\n\n    See Also\n    --------\n    Gaussian1D, Box1D, RickerWavelet1D\n\n    Notes\n    -----\n    Either all or none of input ``x``, position ``x_0`` and ``fwhm`` must be provided\n    consistently with compatible units or as unitless numbers.\n\n    Model formula:\n\n    .. math::\n\n        f(x) = \\frac{A \\gamma^{2}}{\\gamma^{2} + \\left(x - x_{0}\\right)^{2}}\n\n    where :math:`\\gamma` is half of given FWHM.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Lorentz1D\n\n        plt.figure()\n        s1 = Lorentz1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n    ","endLoc":1533,"id":13242,"nodeType":"Class","startLoc":1432,"text":"class Lorentz1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Lorentzian model.\n\n    Parameters\n    ----------\n    amplitude : float or `~astropy.units.Quantity`.\n        Peak value - for a normalized profile (integrating to 1),\n        set amplitude = 2 / (np.pi * fwhm)\n    x_0 : float or `~astropy.units.Quantity`.\n        Position of the peak\n    fwhm : float or `~astropy.units.Quantity`.\n        Full width at half maximum (FWHM)\n\n    See Also\n    --------\n    Gaussian1D, Box1D, RickerWavelet1D\n\n    Notes\n    -----\n    Either all or none of input ``x``, position ``x_0`` and ``fwhm`` must be provided\n    consistently with compatible units or as unitless numbers.\n\n    Model formula:\n\n    .. math::\n\n        f(x) = \\\\frac{A \\\\gamma^{2}}{\\\\gamma^{2} + \\\\left(x - x_{0}\\\\right)^{2}}\n\n    where :math:`\\\\gamma` is half of given FWHM.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Lorentz1D\n\n        plt.figure()\n        s1 = Lorentz1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Peak value\")\n    x_0 = Parameter(default=0, description=\"Position of the peak\")\n    fwhm = Parameter(default=1, description=\"Full width at half maximum\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, fwhm):\n        \"\"\"One dimensional Lorentzian model function\"\"\"\n\n        return (amplitude * ((fwhm / 2.) ** 2) / ((x - x_0) ** 2 +\n                                                  (fwhm / 2.) ** 2))\n\n    @staticmethod\n    def fit_deriv(x, amplitude, x_0, fwhm):\n        \"\"\"One dimensional Lorentzian model derivative with respect to parameters\"\"\"\n\n        d_amplitude = fwhm ** 2 / (fwhm ** 2 + (x - x_0) ** 2)\n        d_x_0 = (amplitude * d_amplitude * (2 * x - 2 * x_0) /\n                 (fwhm ** 2 + (x - x_0) ** 2))\n        d_fwhm = 2 * amplitude * d_amplitude / fwhm * (1 - d_amplitude)\n        return [d_amplitude, d_x_0, d_fwhm]\n\n    def bounding_box(self, factor=25):\n        \"\"\"Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``.\n\n        Parameters\n        ----------\n        factor : float\n            The multiple of FWHM used to define the limits.\n            Default is chosen to include most (99%) of the\n            area under the curve, while still showing the\n            central feature of interest.\n\n        \"\"\"\n        x0 = self.x_0\n        dx = factor * self.fwhm\n\n        return (x0 - dx, x0 + dx)\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'fwhm': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"className":"Pix2Sky_Gnomonic","col":0,"comment":"\n    Gnomonic projection - pixel to sky.\n\n    Corresponds to the ``TAN`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        \\theta = \\tan^{-1}\\left(\\frac{180^{\\circ}}{\\pi R_\\theta}\\right)\n    ","endLoc":440,"id":13243,"nodeType":"Class","startLoc":430,"text":"class Pix2Sky_Gnomonic(Pix2SkyProjection, Zenithal):\n    r\"\"\"\n    Gnomonic projection - pixel to sky.\n\n    Corresponds to the ``TAN`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        \\theta = \\tan^{-1}\\left(\\frac{180^{\\circ}}{\\pi R_\\theta}\\right)\n    \"\"\""},{"className":"Sky2Pix_Gnomonic","col":0,"comment":"\n    Gnomonic Projection - sky to pixel.\n\n    Corresponds to the ``TAN`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        R_\\theta = \\frac{180^{\\circ}}{\\pi}\\cot \\theta\n    ","endLoc":453,"id":13244,"nodeType":"Class","startLoc":443,"text":"class Sky2Pix_Gnomonic(Sky2PixProjection, Zenithal):\n    r\"\"\"\n    Gnomonic Projection - sky to pixel.\n\n    Corresponds to the ``TAN`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        R_\\theta = \\frac{180^{\\circ}}{\\pi}\\cot \\theta\n    \"\"\""},{"className":"Pix2Sky_Stereographic","col":0,"comment":"\n    Stereographic Projection - pixel to sky.\n\n    Corresponds to the ``STG`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        \\theta = 90^{\\circ} - 2 \\tan^{-1}\\left(\\frac{\\pi R_\\theta}{360^{\\circ}}\\right)\n    ","endLoc":466,"id":13245,"nodeType":"Class","startLoc":456,"text":"class Pix2Sky_Stereographic(Pix2SkyProjection, Zenithal):\n    r\"\"\"\n    Stereographic Projection - pixel to sky.\n\n    Corresponds to the ``STG`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        \\theta = 90^{\\circ} - 2 \\tan^{-1}\\left(\\frac{\\pi R_\\theta}{360^{\\circ}}\\right)\n    \"\"\""},{"className":"Sky2Pix_Stereographic","col":0,"comment":"\n    Stereographic Projection - sky to pixel.\n\n    Corresponds to the ``STG`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        R_\\theta = \\frac{180^{\\circ}}{\\pi}\\frac{2 \\cos \\theta}{1 + \\sin \\theta}\n    ","endLoc":479,"id":13246,"nodeType":"Class","startLoc":469,"text":"class Sky2Pix_Stereographic(Sky2PixProjection, Zenithal):\n    r\"\"\"\n    Stereographic Projection - sky to pixel.\n\n    Corresponds to the ``STG`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        R_\\theta = \\frac{180^{\\circ}}{\\pi}\\frac{2 \\cos \\theta}{1 + \\sin \\theta}\n    \"\"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":236,"id":13247,"name":"_param_names","nodeType":"Attribute","startLoc":236,"text":"self._param_names"},{"className":"Pix2Sky_SlantOrthographic","col":0,"comment":"\n    Slant orthographic projection - pixel to sky.\n\n    Corresponds to the ``SIN`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    The following transformation applies when :math:`\\xi` and\n    :math:`\\eta` are both zero.\n\n    .. math::\n        \\theta = \\cos^{-1}\\left(\\frac{\\pi}{180^{\\circ}}R_\\theta\\right)\n\n    The parameters :math:`\\xi` and :math:`\\eta` are defined from the\n    reference point :math:`(\\phi_c, \\theta_c)` as:\n\n    .. math::\n        \\xi &= \\cot \\theta_c \\sin \\phi_c \\\\\n        \\eta &= - \\cot \\theta_c \\cos \\phi_c\n\n    Parameters\n    ----------\n    xi : float\n        Obliqueness parameter, ξ.  Default is 0.0.\n\n    eta : float\n        Obliqueness parameter, η.  Default is 0.0.\n\n    ","endLoc":513,"id":13248,"nodeType":"Class","startLoc":482,"text":"class Pix2Sky_SlantOrthographic(Pix2SkyProjection, Zenithal):\n    r\"\"\"\n    Slant orthographic projection - pixel to sky.\n\n    Corresponds to the ``SIN`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    The following transformation applies when :math:`\\xi` and\n    :math:`\\eta` are both zero.\n\n    .. math::\n        \\theta = \\cos^{-1}\\left(\\frac{\\pi}{180^{\\circ}}R_\\theta\\right)\n\n    The parameters :math:`\\xi` and :math:`\\eta` are defined from the\n    reference point :math:`(\\phi_c, \\theta_c)` as:\n\n    .. math::\n        \\xi &= \\cot \\theta_c \\sin \\phi_c \\\\\n        \\eta &= - \\cot \\theta_c \\cos \\phi_c\n\n    Parameters\n    ----------\n    xi : float\n        Obliqueness parameter, ξ.  Default is 0.0.\n\n    eta : float\n        Obliqueness parameter, η.  Default is 0.0.\n\n    \"\"\"\n    xi = _ParameterDS(default=0.0, description=\"Obliqueness parameter\")\n    eta = _ParameterDS(default=0.0, description=\"Obliqueness parameter\")"},{"col":4,"comment":"One dimensional Lorentzian model function","endLoc":1494,"header":"@staticmethod\n    def evaluate(x, amplitude, x_0, fwhm)","id":13249,"name":"evaluate","nodeType":"Function","startLoc":1489,"text":"@staticmethod\n    def evaluate(x, amplitude, x_0, fwhm):\n        \"\"\"One dimensional Lorentzian model function\"\"\"\n\n        return (amplitude * ((fwhm / 2.) ** 2) / ((x - x_0) ** 2 +\n                                                  (fwhm / 2.) ** 2))"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":512,"id":13250,"name":"xi","nodeType":"Attribute","startLoc":512,"text":"xi"},{"col":4,"comment":"One dimensional Lorentzian model derivative with respect to parameters","endLoc":1504,"header":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, fwhm)","id":13251,"name":"fit_deriv","nodeType":"Function","startLoc":1496,"text":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, fwhm):\n        \"\"\"One dimensional Lorentzian model derivative with respect to parameters\"\"\"\n\n        d_amplitude = fwhm ** 2 / (fwhm ** 2 + (x - x_0) ** 2)\n        d_x_0 = (amplitude * d_amplitude * (2 * x - 2 * x_0) /\n                 (fwhm ** 2 + (x - x_0) ** 2))\n        d_fwhm = 2 * amplitude * d_amplitude / fwhm * (1 - d_amplitude)\n        return [d_amplitude, d_x_0, d_fwhm]"},{"col":4,"comment":"Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``.\n\n        Parameters\n        ----------\n        factor : float\n            The multiple of FWHM used to define the limits.\n            Default is chosen to include most (99%) of the\n            area under the curve, while still showing the\n            central feature of interest.\n\n        ","endLoc":1522,"header":"def bounding_box(self, factor=25)","id":13252,"name":"bounding_box","nodeType":"Function","startLoc":1506,"text":"def bounding_box(self, factor=25):\n        \"\"\"Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``.\n\n        Parameters\n        ----------\n        factor : float\n            The multiple of FWHM used to define the limits.\n            Default is chosen to include most (99%) of the\n            area under the curve, while still showing the\n            central feature of interest.\n\n        \"\"\"\n        x0 = self.x_0\n        dx = factor * self.fwhm\n\n        return (x0 - dx, x0 + dx)"},{"col":4,"comment":"null","endLoc":1528,"header":"@property\n    def input_units(self)","id":13253,"name":"input_units","nodeType":"Function","startLoc":1524,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}"},{"col":4,"comment":"null","endLoc":1533,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13254,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1530,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'fwhm': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":1485,"id":13255,"name":"amplitude","nodeType":"Attribute","startLoc":1485,"text":"amplitude"},{"attributeType":"null","col":4,"comment":"null","endLoc":1486,"id":13256,"name":"x_0","nodeType":"Attribute","startLoc":1486,"text":"x_0"},{"attributeType":"null","col":8,"comment":"null","endLoc":224,"id":13257,"name":"_default_domain_window","nodeType":"Attribute","startLoc":224,"text":"self._default_domain_window"},{"attributeType":"null","col":8,"comment":"null","endLoc":221,"id":13258,"name":"y_degree","nodeType":"Attribute","startLoc":221,"text":"self.y_degree"},{"attributeType":"null","col":4,"comment":"null","endLoc":1487,"id":13259,"name":"fwhm","nodeType":"Attribute","startLoc":1487,"text":"fwhm"},{"col":4,"comment":"null","endLoc":263,"header":"def get_ydata(self)","id":13260,"name":"get_ydata","nodeType":"Function","startLoc":260,"text":"def get_ydata(self):\n        y = np.ones(self.x.shape)\n        y = y * np.array([r.y for r in self.records])[:, np.newaxis]\n        return y"},{"className":"RickerWavelet1D","col":0,"comment":"\n    One dimensional Ricker Wavelet model (sometimes known as a \"Mexican Hat\"\n    model).\n\n    .. note::\n\n        See https://github.com/astropy/astropy/pull/9445 for discussions\n        related to renaming of this model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude\n    x_0 : float\n        Position of the peak\n    sigma : float\n        Width of the Ricker wavelet\n\n    See Also\n    --------\n    RickerWavelet2D, Box1D, Gaussian1D, Trapezoid1D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        f(x) = {A \\left(1 - \\frac{\\left(x - x_{0}\\right)^{2}}{\\sigma^{2}}\\right)\n        e^{- \\frac{\\left(x - x_{0}\\right)^{2}}{2 \\sigma^{2}}}}\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import RickerWavelet1D\n\n        plt.figure()\n        s1 = RickerWavelet1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            s1.width = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -2, 4])\n        plt.show()\n    ","endLoc":2614,"id":13261,"nodeType":"Class","startLoc":2524,"text":"class RickerWavelet1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Ricker Wavelet model (sometimes known as a \"Mexican Hat\"\n    model).\n\n    .. note::\n\n        See https://github.com/astropy/astropy/pull/9445 for discussions\n        related to renaming of this model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude\n    x_0 : float\n        Position of the peak\n    sigma : float\n        Width of the Ricker wavelet\n\n    See Also\n    --------\n    RickerWavelet2D, Box1D, Gaussian1D, Trapezoid1D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        f(x) = {A \\\\left(1 - \\\\frac{\\\\left(x - x_{0}\\\\right)^{2}}{\\\\sigma^{2}}\\\\right)\n        e^{- \\\\frac{\\\\left(x - x_{0}\\\\right)^{2}}{2 \\\\sigma^{2}}}}\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import RickerWavelet1D\n\n        plt.figure()\n        s1 = RickerWavelet1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            s1.width = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -2, 4])\n        plt.show()\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude (peak) value\")\n    x_0 = Parameter(default=0, description=\"Position of the peak\")\n    sigma = Parameter(default=1, description=\"Width of the Ricker wavelet\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, sigma):\n        \"\"\"One dimensional Ricker Wavelet model function\"\"\"\n\n        xx_ww = (x - x_0) ** 2 / (2 * sigma ** 2)\n        return amplitude * (1 - 2 * xx_ww) * np.exp(-xx_ww)\n\n    def bounding_box(self, factor=10.0):\n        \"\"\"Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``.\n\n        Parameters\n        ----------\n        factor : float\n            The multiple of sigma used to define the limits.\n\n        \"\"\"\n        x0 = self.x_0\n        dx = factor * self.sigma\n\n        return (x0 - dx, x0 + dx)\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'sigma': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"col":0,"comment":"Make sure model constraints are supported by the current fitter.","endLoc":1721,"header":"def _validate_constraints(supported_constraints, model)","id":13262,"name":"_validate_constraints","nodeType":"Function","startLoc":1698,"text":"def _validate_constraints(supported_constraints, model):\n    \"\"\"Make sure model constraints are supported by the current fitter.\"\"\"\n\n    message = 'Optimizer cannot handle {0} constraints.'\n\n    if (any(model.fixed.values()) and\n            'fixed' not in supported_constraints):\n        raise UnsupportedConstraintError(\n            message.format('fixed parameter'))\n\n    if any(model.tied.values()) and 'tied' not in supported_constraints:\n        raise UnsupportedConstraintError(\n            message.format('tied parameter'))\n\n    if (any(tuple(b) != (None, None) for b in model.bounds.values()) and\n            'bounds' not in supported_constraints):\n        raise UnsupportedConstraintError(\n            message.format('bound parameter'))\n\n    if model.eqcons and 'eqcons' not in supported_constraints:\n        raise UnsupportedConstraintError(message.format('equality'))\n\n    if model.ineqcons and 'ineqcons' not in supported_constraints:\n        raise UnsupportedConstraintError(message.format('inequality'))"},{"attributeType":"null","col":8,"comment":"null","endLoc":256,"id":13263,"name":"x","nodeType":"Attribute","startLoc":256,"text":"self.x"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":513,"id":13264,"name":"eta","nodeType":"Attribute","startLoc":513,"text":"eta"},{"attributeType":"null","col":8,"comment":"null","endLoc":257,"id":13265,"name":"y","nodeType":"Attribute","startLoc":257,"text":"self.y"},{"attributeType":"null","col":4,"comment":"null","endLoc":1351,"id":13266,"name":"linear","nodeType":"Attribute","startLoc":1351,"text":"linear"},{"attributeType":"null","col":8,"comment":"null","endLoc":258,"id":13267,"name":"z","nodeType":"Attribute","startLoc":258,"text":"self.z"},{"className":"Planar2D","col":0,"comment":"\n    Two dimensional Plane model.\n\n    Parameters\n    ----------\n    slope_x : float\n        Slope of the plane in X\n\n    slope_y : float\n        Slope of the plane in Y\n\n    intercept : float\n        Z-intercept of the plane\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x, y) = a x + b y + c\n    ","endLoc":1429,"id":13268,"nodeType":"Class","startLoc":1384,"text":"class Planar2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional Plane model.\n\n    Parameters\n    ----------\n    slope_x : float\n        Slope of the plane in X\n\n    slope_y : float\n        Slope of the plane in Y\n\n    intercept : float\n        Z-intercept of the plane\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x, y) = a x + b y + c\n    \"\"\"\n\n    slope_x = Parameter(default=1, description=\"Slope of the plane in X\")\n    slope_y = Parameter(default=1, description=\"Slope of the plane in Y\")\n    intercept = Parameter(default=0, description=\"Z-intercept of the plane\")\n    linear = True\n\n    @staticmethod\n    def evaluate(x, y, slope_x, slope_y, intercept):\n        \"\"\"Two dimensional Plane model function\"\"\"\n\n        return slope_x * x + slope_y * y + intercept\n\n    @staticmethod\n    def fit_deriv(x, y, *params):\n        \"\"\"Two dimensional Plane model derivative with respect to parameters\"\"\"\n\n        d_slope_x = x\n        d_slope_y = y\n        d_intercept = np.ones_like(x)\n        return [d_slope_x, d_slope_y, d_intercept]\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'intercept': outputs_unit['z'],\n                'slope_x': outputs_unit['z'] / inputs_unit['x'],\n                'slope_y': outputs_unit['z'] / inputs_unit['y']}"},{"col":0,"comment":"\n    Read the records of an IRAF database file into a python list\n\n    Parameters\n    ----------\n    fname : str\n           name of an IRAF database file\n\n    Returns\n    -------\n        A list of records\n    ","endLoc":35,"header":"def get_records(fname)","id":13269,"name":"get_records","nodeType":"Function","startLoc":17,"text":"def get_records(fname):\n    \"\"\"\n    Read the records of an IRAF database file into a python list\n\n    Parameters\n    ----------\n    fname : str\n           name of an IRAF database file\n\n    Returns\n    -------\n        A list of records\n    \"\"\"\n    f = open(fname)\n    dtb = f.read()\n    f.close()\n    recs = dtb.split('begin')[1:]\n    records = [Record(r) for r in recs]\n    return records"},{"col":4,"comment":"One dimensional Ricker Wavelet model function","endLoc":2588,"header":"@staticmethod\n    def evaluate(x, amplitude, x_0, sigma)","id":13270,"name":"evaluate","nodeType":"Function","startLoc":2583,"text":"@staticmethod\n    def evaluate(x, amplitude, x_0, sigma):\n        \"\"\"One dimensional Ricker Wavelet model function\"\"\"\n\n        xx_ww = (x - x_0) ** 2 / (2 * sigma ** 2)\n        return amplitude * (1 - 2 * xx_ww) * np.exp(-xx_ww)"},{"attributeType":"null","col":8,"comment":"null","endLoc":220,"id":13271,"name":"x_degree","nodeType":"Attribute","startLoc":220,"text":"self.x_degree"},{"col":4,"comment":"Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``.\n\n        Parameters\n        ----------\n        factor : float\n            The multiple of sigma used to define the limits.\n\n        ","endLoc":2603,"header":"def bounding_box(self, factor=10.0)","id":13272,"name":"bounding_box","nodeType":"Function","startLoc":2590,"text":"def bounding_box(self, factor=10.0):\n        \"\"\"Tuple defining the default ``bounding_box`` limits,\n        ``(x_low, x_high)``.\n\n        Parameters\n        ----------\n        factor : float\n            The multiple of sigma used to define the limits.\n\n        \"\"\"\n        x0 = self.x_0\n        dx = factor * self.sigma\n\n        return (x0 - dx, x0 + dx)"},{"col":4,"comment":"null","endLoc":2609,"header":"@property\n    def input_units(self)","id":13273,"name":"input_units","nodeType":"Function","startLoc":2605,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}"},{"col":4,"comment":"null","endLoc":2614,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13274,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2611,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'sigma': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":2579,"id":13275,"name":"amplitude","nodeType":"Attribute","startLoc":2579,"text":"amplitude"},{"className":"Sky2Pix_SlantOrthographic","col":0,"comment":"\n    Slant orthographic projection - sky to pixel.\n\n    Corresponds to the ``SIN`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    The following transformation applies when :math:`\\xi` and\n    :math:`\\eta` are both zero.\n\n    .. math::\n        R_\\theta = \\frac{180^{\\circ}}{\\pi}\\cos \\theta\n\n    But more specifically are:\n\n    .. math::\n        x &= \\frac{180^\\circ}{\\pi}[\\cos \\theta \\sin \\phi + \\xi(1 - \\sin \\theta)] \\\\\n        y &= \\frac{180^\\circ}{\\pi}[\\cos \\theta \\cos \\phi + \\eta(1 - \\sin \\theta)]\n\n    ","endLoc":538,"id":13276,"nodeType":"Class","startLoc":516,"text":"class Sky2Pix_SlantOrthographic(Sky2PixProjection, Zenithal):\n    r\"\"\"\n    Slant orthographic projection - sky to pixel.\n\n    Corresponds to the ``SIN`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    The following transformation applies when :math:`\\xi` and\n    :math:`\\eta` are both zero.\n\n    .. math::\n        R_\\theta = \\frac{180^{\\circ}}{\\pi}\\cos \\theta\n\n    But more specifically are:\n\n    .. math::\n        x &= \\frac{180^\\circ}{\\pi}[\\cos \\theta \\sin \\phi + \\xi(1 - \\sin \\theta)] \\\\\n        y &= \\frac{180^\\circ}{\\pi}[\\cos \\theta \\cos \\phi + \\eta(1 - \\sin \\theta)]\n\n    \"\"\"\n    xi = _ParameterDS(default=0.0)\n    eta = _ParameterDS(default=0.0)"},{"attributeType":"null","col":8,"comment":"null","endLoc":234,"id":13277,"name":"y_domain","nodeType":"Attribute","startLoc":234,"text":"self.y_domain"},{"attributeType":"null","col":4,"comment":"null","endLoc":2580,"id":13278,"name":"x_0","nodeType":"Attribute","startLoc":2580,"text":"x_0"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":537,"id":13279,"name":"xi","nodeType":"Attribute","startLoc":537,"text":"xi"},{"attributeType":"null","col":4,"comment":"null","endLoc":2581,"id":13280,"name":"sigma","nodeType":"Attribute","startLoc":2581,"text":"sigma"},{"col":0,"comment":"\n    Read an IRAF database file\n\n    Parameters\n    ----------\n    fname : str\n          name of an IRAF database file\n\n    Returns\n    -------\n        the database file as a string\n    ","endLoc":54,"header":"def get_database_string(fname)","id":13281,"name":"get_database_string","nodeType":"Function","startLoc":38,"text":"def get_database_string(fname):\n    \"\"\"\n    Read an IRAF database file\n\n    Parameters\n    ----------\n    fname : str\n          name of an IRAF database file\n\n    Returns\n    -------\n        the database file as a string\n    \"\"\"\n    f = open(fname)\n    dtb = f.read()\n    f.close()\n    return dtb"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":538,"id":13282,"name":"eta","nodeType":"Attribute","startLoc":538,"text":"eta"},{"attributeType":"null","col":16,"comment":"null","endLoc":8,"id":13283,"name":"np","nodeType":"Attribute","startLoc":8,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":13284,"name":"iraf_models_map","nodeType":"Attribute","startLoc":11,"text":"iraf_models_map"},{"col":0,"comment":"","endLoc":4,"header":"irafutil.py#<anonymous>","id":13285,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module provides functions to help with testing against iraf tasks\n\"\"\"\n\niraf_models_map = {1.: 'Chebyshev',\n                   2.: 'Legendre',\n                   3.: 'Spline3',\n                   4.: 'Spline1'}"},{"className":"Pix2Sky_ZenithalEquidistant","col":0,"comment":"\n    Zenithal equidistant projection - pixel to sky.\n\n    Corresponds to the ``ARC`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        \\theta = 90^\\circ - R_\\theta\n    ","endLoc":551,"id":13286,"nodeType":"Class","startLoc":541,"text":"class Pix2Sky_ZenithalEquidistant(Pix2SkyProjection, Zenithal):\n    r\"\"\"\n    Zenithal equidistant projection - pixel to sky.\n\n    Corresponds to the ``ARC`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        \\theta = 90^\\circ - R_\\theta\n    \"\"\""},{"className":"Sky2Pix_ZenithalEquidistant","col":0,"comment":"\n    Zenithal equidistant projection - sky to pixel.\n\n    Corresponds to the ``ARC`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        R_\\theta = 90^\\circ - \\theta\n    ","endLoc":564,"id":13287,"nodeType":"Class","startLoc":554,"text":"class Sky2Pix_ZenithalEquidistant(Sky2PixProjection, Zenithal):\n    r\"\"\"\n    Zenithal equidistant projection - sky to pixel.\n\n    Corresponds to the ``ARC`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        R_\\theta = 90^\\circ - \\theta\n    \"\"\""},{"className":"Pix2Sky_ZenithalEqualArea","col":0,"comment":"\n    Zenithal equidistant projection - pixel to sky.\n\n    Corresponds to the ``ZEA`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        \\theta = 90^\\circ - 2 \\sin^{-1} \\left(\\frac{\\pi R_\\theta}{360^\\circ}\\right)\n    ","endLoc":577,"id":13288,"nodeType":"Class","startLoc":567,"text":"class Pix2Sky_ZenithalEqualArea(Pix2SkyProjection, Zenithal):\n    r\"\"\"\n    Zenithal equidistant projection - pixel to sky.\n\n    Corresponds to the ``ZEA`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        \\theta = 90^\\circ - 2 \\sin^{-1} \\left(\\frac{\\pi R_\\theta}{360^\\circ}\\right)\n    \"\"\""},{"className":"Sky2Pix_ZenithalEqualArea","col":0,"comment":"\n    Zenithal equidistant projection - sky to pixel.\n\n    Corresponds to the ``ZEA`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        R_\\theta &= \\frac{180^\\circ}{\\pi} \\sqrt{2(1 - \\sin\\theta)} \\\\\n                 &= \\frac{360^\\circ}{\\pi} \\sin\\left(\\frac{90^\\circ - \\theta}{2}\\right)\n    ","endLoc":591,"id":13289,"nodeType":"Class","startLoc":580,"text":"class Sky2Pix_ZenithalEqualArea(Sky2PixProjection, Zenithal):\n    r\"\"\"\n    Zenithal equidistant projection - sky to pixel.\n\n    Corresponds to the ``ZEA`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        R_\\theta &= \\frac{180^\\circ}{\\pi} \\sqrt{2(1 - \\sin\\theta)} \\\\\n                 &= \\frac{360^\\circ}{\\pi} \\sin\\left(\\frac{90^\\circ - \\theta}{2}\\right)\n    \"\"\""},{"className":"Pix2Sky_Airy","col":0,"comment":"\n    Airy projection - pixel to sky.\n\n    Corresponds to the ``AIR`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    Parameters\n    ----------\n    theta_b : float\n        The latitude :math:`\\theta_b` at which to minimize the error,\n        in degrees.  Default is 90°.\n    ","endLoc":608,"id":13290,"nodeType":"Class","startLoc":594,"text":"class Pix2Sky_Airy(Pix2SkyProjection, Zenithal):\n    r\"\"\"\n    Airy projection - pixel to sky.\n\n    Corresponds to the ``AIR`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    Parameters\n    ----------\n    theta_b : float\n        The latitude :math:`\\theta_b` at which to minimize the error,\n        in degrees.  Default is 90°.\n    \"\"\"\n    theta_b = _ParameterDS(default=90.0)"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":608,"id":13291,"name":"theta_b","nodeType":"Attribute","startLoc":608,"text":"theta_b"},{"className":"Sky2Pix_Airy","col":0,"comment":"\n    Airy - sky to pixel.\n\n    Corresponds to the ``AIR`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        R_\\theta = -2 \\frac{180^\\circ}{\\pi}\\left(\\frac{\\ln(\\cos \\xi)}{\\tan \\xi} + \\frac{\\ln(\\cos \\xi_b)}{\\tan^2 \\xi_b} \\tan \\xi \\right)\n\n    where:\n\n    .. math::\n        \\xi &= \\frac{90^\\circ - \\theta}{2} \\\\\n        \\xi_b &= \\frac{90^\\circ - \\theta_b}{2}\n\n    Parameters\n    ----------\n    theta_b : float\n        The latitude :math:`\\theta_b` at which to minimize the error,\n        in degrees.  Default is 90°.\n\n    ","endLoc":635,"id":13292,"nodeType":"Class","startLoc":611,"text":"class Sky2Pix_Airy(Sky2PixProjection, Zenithal):\n    r\"\"\"\n    Airy - sky to pixel.\n\n    Corresponds to the ``AIR`` projection in FITS WCS.\n\n    See `Zenithal` for a definition of the full transformation.\n\n    .. math::\n        R_\\theta = -2 \\frac{180^\\circ}{\\pi}\\left(\\frac{\\ln(\\cos \\xi)}{\\tan \\xi} + \\frac{\\ln(\\cos \\xi_b)}{\\tan^2 \\xi_b} \\tan \\xi \\right)\n\n    where:\n\n    .. math::\n        \\xi &= \\frac{90^\\circ - \\theta}{2} \\\\\n        \\xi_b &= \\frac{90^\\circ - \\theta_b}{2}\n\n    Parameters\n    ----------\n    theta_b : float\n        The latitude :math:`\\theta_b` at which to minimize the error,\n        in degrees.  Default is 90°.\n\n    \"\"\"\n    theta_b = _ParameterDS(default=90.0, description=\"The latitude at which to minimize the error,in degrees\")"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":635,"id":13293,"name":"theta_b","nodeType":"Attribute","startLoc":635,"text":"theta_b"},{"attributeType":"null","col":8,"comment":"null","endLoc":273,"id":13294,"name":"_x_window","nodeType":"Attribute","startLoc":273,"text":"self._x_window"},{"className":"Cylindrical","col":0,"comment":"Base class for Cylindrical projections.\n\n    Cylindrical projections are so-named because the surface of\n    projection is a cylinder.\n    ","endLoc":644,"id":13295,"nodeType":"Class","startLoc":638,"text":"class Cylindrical(Projection):\n    r\"\"\"Base class for Cylindrical projections.\n\n    Cylindrical projections are so-named because the surface of\n    projection is a cylinder.\n    \"\"\"\n    _separable = True"},{"attributeType":"null","col":4,"comment":"null","endLoc":644,"id":13296,"name":"_separable","nodeType":"Attribute","startLoc":644,"text":"_separable"},{"className":"Pix2Sky_CylindricalPerspective","col":0,"comment":"\n    Cylindrical perspective - pixel to sky.\n\n    Corresponds to the ``CYP`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= \\frac{x}{\\lambda} \\\\\n        \\theta &= \\arg(1, \\eta) + \\sin{-1}\\left(\\frac{\\eta \\mu}{\\sqrt{\\eta^2 + 1}}\\right)\n\n    where:\n\n    .. math::\n        \\eta = \\frac{\\pi}{180^{\\circ}}\\frac{y}{\\mu + \\lambda}\n\n    Parameters\n    ----------\n    mu : float\n        Distance from center of sphere in the direction opposite the\n        projected surface, in spherical radii, μ. Default is 1.\n\n    lam : float\n        Radius of the cylinder in spherical radii, λ. Default is 1.\n\n    ","endLoc":685,"id":13297,"nodeType":"Class","startLoc":647,"text":"class Pix2Sky_CylindricalPerspective(Pix2SkyProjection, Cylindrical):\n    r\"\"\"\n    Cylindrical perspective - pixel to sky.\n\n    Corresponds to the ``CYP`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= \\frac{x}{\\lambda} \\\\\n        \\theta &= \\arg(1, \\eta) + \\sin{-1}\\left(\\frac{\\eta \\mu}{\\sqrt{\\eta^2 + 1}}\\right)\n\n    where:\n\n    .. math::\n        \\eta = \\frac{\\pi}{180^{\\circ}}\\frac{y}{\\mu + \\lambda}\n\n    Parameters\n    ----------\n    mu : float\n        Distance from center of sphere in the direction opposite the\n        projected surface, in spherical radii, μ. Default is 1.\n\n    lam : float\n        Radius of the cylinder in spherical radii, λ. Default is 1.\n\n    \"\"\"\n    mu = _ParameterDS(default=1.0)\n    lam = _ParameterDS(default=1.0)\n\n    @mu.validator\n    def mu(self, value):\n        if np.any(value == -self.lam):\n            raise InputParameterError(\n                \"CYP projection is not defined for mu = -lambda\")\n\n    @lam.validator\n    def lam(self, value):\n        if np.any(value == -self.mu):\n            raise InputParameterError(\n                \"CYP projection is not defined for lambda = -mu\")"},{"col":0,"comment":"Convert inputs to float arrays.","endLoc":1591,"header":"def _convert_input(x, y, z=None, n_models=1, model_set_axis=0)","id":13298,"name":"_convert_input","nodeType":"Function","startLoc":1545,"text":"def _convert_input(x, y, z=None, n_models=1, model_set_axis=0):\n    \"\"\"Convert inputs to float arrays.\"\"\"\n\n    x = np.asanyarray(x, dtype=float)\n    y = np.asanyarray(y, dtype=float)\n\n    if z is not None:\n        z = np.asanyarray(z, dtype=float)\n        data_ndim, data_shape = z.ndim, z.shape\n    else:\n        data_ndim, data_shape = y.ndim, y.shape\n\n    # For compatibility with how the linear fitter code currently expects to\n    # work, shift the dependent variable's axes to the expected locations\n    if n_models > 1 or data_ndim > x.ndim:\n        if (model_set_axis or 0) >= data_ndim:\n            raise ValueError(\"model_set_axis out of range\")\n        if data_shape[model_set_axis] != n_models:\n            raise ValueError(\n                \"Number of data sets (y or z array) is expected to equal \"\n                \"the number of parameter sets\"\n            )\n        if z is None:\n            # For a 1-D model the y coordinate's model-set-axis is expected to\n            # be last, so that its first dimension is the same length as the x\n            # coordinates.  This is in line with the expectations of\n            # numpy.linalg.lstsq:\n            # https://numpy.org/doc/stable/reference/generated/numpy.linalg.lstsq.html\n            # That is, each model should be represented by a column.  TODO:\n            # Obviously this is a detail of np.linalg.lstsq and should be\n            # handled specifically by any fitters that use it...\n            y = np.rollaxis(y, model_set_axis, y.ndim)\n            data_shape = y.shape[:-1]\n        else:\n            # Shape of z excluding model_set_axis\n            data_shape = (z.shape[:model_set_axis] +\n                          z.shape[model_set_axis + 1:])\n\n    if z is None:\n        if data_shape != x.shape:\n            raise ValueError(\"x and y should have the same shape\")\n        farg = (x, y)\n    else:\n        if not (x.shape == y.shape == data_shape):\n            raise ValueError(\"x, y and z should have the same shape\")\n        farg = (x, y, z)\n    return farg"},{"col":4,"comment":"null","endLoc":679,"header":"@mu.validator\n    def mu(self, value)","id":13299,"name":"mu","nodeType":"Function","startLoc":675,"text":"@mu.validator\n    def mu(self, value):\n        if np.any(value == -self.lam):\n            raise InputParameterError(\n                \"CYP projection is not defined for mu = -lambda\")"},{"col":4,"comment":"null","endLoc":685,"header":"@lam.validator\n    def lam(self, value)","id":13300,"name":"lam","nodeType":"Function","startLoc":681,"text":"@lam.validator\n    def lam(self, value):\n        if np.any(value == -self.mu):\n            raise InputParameterError(\n                \"CYP projection is not defined for lambda = -mu\")"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":672,"id":13301,"name":"mu","nodeType":"Attribute","startLoc":672,"text":"mu"},{"attributeType":"null","col":8,"comment":"null","endLoc":281,"id":13302,"name":"_y_window","nodeType":"Attribute","startLoc":281,"text":"self._y_window"},{"fileName":"__init__.py","filePath":"astropy/modeling/tests","id":13303,"nodeType":"File","text":""},{"attributeType":"null","col":8,"comment":"null","endLoc":233,"id":13304,"name":"x_domain","nodeType":"Attribute","startLoc":233,"text":"self.x_domain"},{"attributeType":"null","col":8,"comment":"null","endLoc":232,"id":13305,"name":"y_window","nodeType":"Attribute","startLoc":232,"text":"self.y_window"},{"attributeType":"null","col":8,"comment":"null","endLoc":257,"id":13306,"name":"_x_domain","nodeType":"Attribute","startLoc":257,"text":"self._x_domain"},{"className":"Trapezoid1D","col":0,"comment":"\n    One dimensional Trapezoid model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the trapezoid\n    x_0 : float\n        Center position of the trapezoid\n    width : float\n        Width of the constant part of the trapezoid.\n    slope : float\n        Slope of the tails of the trapezoid\n\n    See Also\n    --------\n    Box1D, Gaussian1D, Moffat1D\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Trapezoid1D\n\n        plt.figure()\n        s1 = Trapezoid1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            s1.width = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n    ","endLoc":2445,"id":13307,"nodeType":"Class","startLoc":2352,"text":"class Trapezoid1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Trapezoid model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the trapezoid\n    x_0 : float\n        Center position of the trapezoid\n    width : float\n        Width of the constant part of the trapezoid.\n    slope : float\n        Slope of the tails of the trapezoid\n\n    See Also\n    --------\n    Box1D, Gaussian1D, Moffat1D\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Trapezoid1D\n\n        plt.figure()\n        s1 = Trapezoid1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            s1.width = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude of the trapezoid\")\n    x_0 = Parameter(default=0, description=\"Center position of the trapezoid\")\n    width = Parameter(default=1, description=\"Width of constant part of the trapezoid\")\n    slope = Parameter(default=1, description=\"Slope of the tails of trapezoid\")\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, width, slope):\n        \"\"\"One dimensional Trapezoid model function\"\"\"\n\n        # Compute the four points where the trapezoid changes slope\n        # x1 <= x2 <= x3 <= x4\n        x2 = x_0 - width / 2.\n        x3 = x_0 + width / 2.\n        x1 = x2 - amplitude / slope\n        x4 = x3 + amplitude / slope\n\n        # Compute model values in pieces between the change points\n        range_a = np.logical_and(x >= x1, x < x2)\n        range_b = np.logical_and(x >= x2, x < x3)\n        range_c = np.logical_and(x >= x3, x < x4)\n        val_a = slope * (x - x1)\n        val_b = amplitude\n        val_c = slope * (x4 - x)\n        result = np.select([range_a, range_b, range_c], [val_a, val_b, val_c])\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``(x_low, x_high))``\n        \"\"\"\n\n        dx = self.width / 2 + self.amplitude / self.slope\n\n        return (self.x_0 - dx, self.x_0 + dx)\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'width': inputs_unit[self.inputs[0]],\n                'slope': outputs_unit[self.outputs[0]] / inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"col":4,"comment":"One dimensional Trapezoid model function","endLoc":2421,"header":"@staticmethod\n    def evaluate(x, amplitude, x_0, width, slope)","id":13308,"name":"evaluate","nodeType":"Function","startLoc":2399,"text":"@staticmethod\n    def evaluate(x, amplitude, x_0, width, slope):\n        \"\"\"One dimensional Trapezoid model function\"\"\"\n\n        # Compute the four points where the trapezoid changes slope\n        # x1 <= x2 <= x3 <= x4\n        x2 = x_0 - width / 2.\n        x3 = x_0 + width / 2.\n        x1 = x2 - amplitude / slope\n        x4 = x3 + amplitude / slope\n\n        # Compute model values in pieces between the change points\n        range_a = np.logical_and(x >= x1, x < x2)\n        range_b = np.logical_and(x >= x2, x < x3)\n        range_c = np.logical_and(x >= x3, x < x4)\n        val_a = slope * (x - x1)\n        val_b = amplitude\n        val_c = slope * (x4 - x)\n        result = np.select([range_a, range_b, range_c], [val_a, val_b, val_c])\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result"},{"attributeType":"null","col":8,"comment":"null","endLoc":265,"id":13309,"name":"_y_domain","nodeType":"Attribute","startLoc":265,"text":"self._y_domain"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":673,"id":13310,"name":"lam","nodeType":"Attribute","startLoc":673,"text":"lam"},{"id":13311,"name":"astropy/modeling/tests/data","nodeType":"Package"},{"id":13312,"name":"idcompspec.fits","nodeType":"TextFile","path":"astropy/modeling/tests/data","text":"# Thu 16:08:18 31-Mar-2011\nbegin\tidentify compspec.fits[1] - Ap 1\n\tid\tcompspec.fits[1]\n\ttask\tidentify\n\timage\tcompspec.fits[1] - Ap 1\n\taperture\t1\n\taplow\tINDEF\n\taphigh\tINDEF\n\tunits\tAngstroms\n\tfeatures\t7\n\t        404.10 3888.54757   3888.646   4.0 1 1 HeI\n\t        544.09 4045.50261   4044.418   4.0 1 1 AI(4)\n\t        571.51 4076.76389    4077.81   4.0 1 1 \n\t        813.59 4358.40117    4358.34   4.0 1 1 \n\t       1720.36 5460.75353    5460.75   4.0 1 1 \n\t       1966.66 5769.52138    5769.59   4.0 1 1 \n\t       1983.41 5790.75384    5790.69   4.0 1 1 \n\tfunction chebyshev\n\torder 5\n\tsample *\n\tnaverage 1\n\tniterate 0\n\tlow_reject 3.\n\thigh_reject 3.\n\tgrow 0.\n\tcoefficients\t9\n\t\t1.\n\t\t5.\n\t\t404.0984802246094\n\t\t1983.410888671875\n\t\t4826.104189057136\n\t\t952.8936304314716\n\t\t12.6431161257298\n\t\t-1.790494280706627\n\t\t0.9034001474192017\n\n"},{"className":"Sky2Pix_CylindricalPerspective","col":0,"comment":"\n    Cylindrical Perspective - sky to pixel.\n\n    Corresponds to the ``CYP`` projection in FITS WCS.\n\n    .. math::\n        x &= \\lambda \\phi \\\\\n        y &= \\frac{180^{\\circ}}{\\pi}\\left(\\frac{\\mu + \\lambda}{\\mu + \\cos \\theta}\\right)\\sin \\theta\n\n    Parameters\n    ----------\n    mu : float\n        Distance from center of sphere in the direction opposite the\n        projected surface, in spherical radii, μ.  Default is 0.\n\n    lam : float\n        Radius of the cylinder in spherical radii, λ.  Default is 0.\n\n    ","endLoc":721,"id":13313,"nodeType":"Class","startLoc":688,"text":"class Sky2Pix_CylindricalPerspective(Sky2PixProjection, Cylindrical):\n    r\"\"\"\n    Cylindrical Perspective - sky to pixel.\n\n    Corresponds to the ``CYP`` projection in FITS WCS.\n\n    .. math::\n        x &= \\lambda \\phi \\\\\n        y &= \\frac{180^{\\circ}}{\\pi}\\left(\\frac{\\mu + \\lambda}{\\mu + \\cos \\theta}\\right)\\sin \\theta\n\n    Parameters\n    ----------\n    mu : float\n        Distance from center of sphere in the direction opposite the\n        projected surface, in spherical radii, μ.  Default is 0.\n\n    lam : float\n        Radius of the cylinder in spherical radii, λ.  Default is 0.\n\n    \"\"\"\n    mu = _ParameterDS(default=1.0, description=\"Distance from center of sphere in spherical radii\")\n    lam = _ParameterDS(default=1.0, description=\"Radius of the cylinder in spherical radii\")\n\n    @mu.validator\n    def mu(self, value):\n        if np.any(value == -self.lam):\n            raise InputParameterError(\n                \"CYP projection is not defined for mu = -lambda\")\n\n    @lam.validator\n    def lam(self, value):\n        if np.any(value == -self.mu):\n            raise InputParameterError(\n                \"CYP projection is not defined for lambda = -mu\")"},{"col":4,"comment":"null","endLoc":715,"header":"@mu.validator\n    def mu(self, value)","id":13314,"name":"mu","nodeType":"Function","startLoc":711,"text":"@mu.validator\n    def mu(self, value):\n        if np.any(value == -self.lam):\n            raise InputParameterError(\n                \"CYP projection is not defined for mu = -lambda\")"},{"id":13315,"name":"hst_sip.hdr","nodeType":"TextFile","path":"astropy/modeling/tests/data","text":"SIMPLE  =                    T / \nBITPIX  =                  -32 / Bits per pixel                                 \nNAXIS   =                    2 / Number of axes                                 \nNAXIS1  =                 4096 / Axis length                                    \nNAXIS2  =                 2048 / Axis length                                    \nWCSAXES =                    2 / number of World Coordinate System axes         \nCRPIX1  =               2048.0 / x-coordinate of reference pixel                \nCRPIX2  =               1024.0 / y-coordinate of reference pixel                \nCRVAL1  =        5.63056810618 / first axis value at reference pixel            \nCRVAL2  =      -72.05457184279 / second axis value at reference pixel           \nCTYPE1  = 'RA---TAN-SIP'       / the coordinate type for the first axis         \nCTYPE2  = 'DEC--TAN-SIP'       / the coordinate type for the second axis        \nCD1_1   = 1.290562563339972E-05 / partial of first axis coordinate w.r.t. x     \nCD1_2   = 5.953091234198029E-06 / partial of first axis coordinate w.r.t. y     \nCD2_1   =  5.0220581265601E-06 / partial of second axis coordinate w.r.t. x     \nCD2_2   = -1.26447741482017E-05 / partial of second axis coordinate w.r.t. y    \nA_0_2   = 2.166159529762128E-06                                                 \nB_0_2   = -7.21688145077445E-06                                                 \nA_1_1   = -5.197457646683463E-06                                                \nB_1_1   = 6.184432357744779E-06                                                 \nA_2_0   = 8.551277582556502E-06                                                 \nB_2_0   = -1.746491877058669E-06                                                \nA_0_3   = 1.081935198202655E-11                                                 \nB_0_3   = -4.175472049274932E-10                                                \nA_1_2   = -5.234870743692412E-10                                                \nB_1_2   = -6.169265268681388E-11                                                \nA_2_1   = -3.977154774728729E-11                                                \nB_2_1   = -5.085716167386211E-10                                                \nA_3_0   = -4.730444829222791E-10                                                \nB_3_0   = 8.567635427816317E-11                                                 \nA_0_4   = 1.493561711660489E-14                                                 \nB_0_4   = -9.957049065547884E-15                                                \nA_1_3   = -2.456997553774615E-14                                                \nB_1_3   = 1.217430115688482E-14                                                 \nA_2_2   = 3.467912671043782E-14                                                 \nB_2_2   = -3.66143259286574E-14                                                 \nA_3_1   = 1.971022971660309E-15                                                 \nB_3_1   = -3.779506805487476E-15                                                \nA_4_0   = 2.374301062402314E-14                                                 \nB_4_0   = -1.768765382600471E-14                                                \nA_ORDER =                    4                                                  \nB_ORDER =                    4 "},{"col":4,"comment":"null","endLoc":721,"header":"@lam.validator\n    def lam(self, value)","id":13316,"name":"lam","nodeType":"Function","startLoc":717,"text":"@lam.validator\n    def lam(self, value):\n        if np.any(value == -self.mu):\n            raise InputParameterError(\n                \"CYP projection is not defined for lambda = -mu\")"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``(x_low, x_high))``\n        ","endLoc":2433,"header":"@property\n    def bounding_box(self)","id":13317,"name":"bounding_box","nodeType":"Function","startLoc":2423,"text":"@property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``(x_low, x_high))``\n        \"\"\"\n\n        dx = self.width / 2 + self.amplitude / self.slope\n\n        return (self.x_0 - dx, self.x_0 + dx)"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":708,"id":13318,"name":"mu","nodeType":"Attribute","startLoc":708,"text":"mu"},{"attributeType":"null","col":8,"comment":"null","endLoc":231,"id":13319,"name":"x_window","nodeType":"Attribute","startLoc":231,"text":"self.x_window"},{"col":4,"comment":"null","endLoc":2439,"header":"@property\n    def input_units(self)","id":13320,"name":"input_units","nodeType":"Function","startLoc":2435,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}"},{"id":13321,"name":"irac_sip.hdr","nodeType":"TextFile","path":"astropy/modeling/tests/data","text":"SIMPLE  =                    T                                                  \nBITPIX  =                  -32 / FOUR-BYTE SINGLE PRECISION FLOATING POINT      \nNAXIS   =                    2 / STANDARD FITS FORMAT                           \nNAXIS1  =                  256 / STANDARD FITS FORMAT                           \nNAXIS2  =                  256 / STANDARD FITS FORMAT                           \nEXTEND  =                    T / TAPE MAY HAVE STANDARD FITS EXTENSIONS         \nORIGIN  = 'SIRTF Science Center' / Organization generating this FITS file       \nCREATOR = 'S8.9.0'             / SW version used to create this FITS file       \nTELESCOP= 'SIRTF   '           / SIRTF spacecraft                               \nINSTRUME= 'IRAC    '           / SIRTF instrument ID                            \nCOMMENT   Controlled data files (CDFs) used:                                    \nCOMMENT   w_bqd_files_to_copy_to_sandbox.nl, fileID = 2                         \nCOMMENT   w_bqd_pointrefine.nl, fileID = 120903                                 \nCHNLNUM =                    1 / 1 digit instrument channel number              \nEXPTYPE = 'sci     '           / Exposure Type                                  \nREQTYPE = 'AOR     '           / Request type (AOR, IER, or  SER)               \nAOT_TYPE= 'IracMap '           / Observation template type                      \nAORLABEL= 'NSMLT-0013 HP'      / AOR Label                                      \nFOVID   =                   74 / Field of View ID                               \nFOVNAME = 'IRAC_Center_of_4.5&8.0umArray' / Field of View Name                  \n                                                                                \n          / PROPOSAL INFORMATION                                                \n                                                                                \nOBSRVR  = 'Giovanni Fazio'     / Observer Name (Last, First)                    \nOBSRVRID=                    2 / Observer ID of Principal Investigator          \nPROCYCL =                    1 / Proposal Cycle                                 \nPROGID  =                   35 / Program ID                                     \nPROTITLE= 'MULTIPLICTY AND INFRARED COLORS OF NEARBY MLT DWARFS' / Program Title\nPROGCAT =                   29 / Program Category                               \n                                                                                \n          / TIME AND EXPOSURE INFORMATION                                       \n                                                                                \nDATE_OBS= '2003-12-06T10:46:35.021' / Date & time at DCE start                  \nMJD_OBS =            52979.449 / [days] MJD at DCE start (,JD-2400000.05)       \nUTCS_OBS=        123979595.021 / [sec] J2000 ephem. time at DCE start           \nSCLK_OBS=        755174834.035 / [sec] SCLK time (since 1/1/1980) at DCE start  \nSAMPTIME=                  0.2 / [sec] Sample integration time                  \nFRAMTIME=                  30. / [sec] Time spent integrating (whole array)     \nCOMMENT   Photons in Well = Flux[photons/sec/pixel] * FRAMTIME                  \nEXPTIME =                 26.8 / [sec] Effective integration time per pixel     \nCOMMENT   DN per pixel = Flux[photons/sec/pixel] / GAIN * EXPTIME               \nAINTBEG =            43146779. / [Secs since IRAC turn-on] Time of integ. start \nATIMEEND=            431497.75 / [Secs since IRAC turn-on] Time of integ. end   \nAFOWLNUM=                   16 / Fowler number                                  \nAWAITPER=                  118 / [0.2 sec] Wait period                          \nANUMREPS=                    1 / Number of repeat integrations                  \nAREADMOD=                    0 / Full (0) or subarray (1)                       \nABARREL =                    4 / Barrel shift                                   \nAPEDSIG =                    0 / 0=Normal, 1=Pedestal, 2=Signal                 \n                                                                                \n          / TARGET AND POINTING INFORMATION                                     \n                                                                                \nOBJECT  = 'BRI0021-02'         / Target Name                                    \nOBJTYPE = 'TargetFixedSingle'  / Object Type                                    \nCRVAL1  =     6.15501347619052 / [deg] RA at CRPIX1,CRPIX2 averaged over DCE    \nCRVAL2  =    -2.07230798888938 / [deg] DEC at CRPIX1,CRPIX2 averaged over DCE   \nRA_HMS  = '00h24m37.2s'        / [hh:mm:ss.s] CRVAL1 as sexagesimal             \nDEC_DMS = '-02d04m20s'         / [dd:mm:ss] CRVAL2 as sexagesimal               \nRADESYS = 'ICRS    '           / International Celestial Reference System       \nEQUINOX =  2000.               / Equinox for ICRF celestial coord. system       \nCD1_1   = -0.000147943581033529                                                 \nCD1_2   = 0.000305150643914974                                                  \nCD2_1   = 0.000305100010374518                                                  \nCD2_2   = 0.000147710276207053                                                  \nCTYPE1  = 'RA---TAN-SIP'       / RA---TAN with distortion in pixel space        \nCTYPE2  = 'DEC--TAN-SIP'       / DEC--TAN with distortion in pixel space        \nCRPIX1  =                 128. / Reference pixel along axis 1                   \nCRPIX2  =                 128. / Reference pixel along axis 2                   \nCRDER1  = 0.000630078723280563 / [deg] Uncertainty in CRVAL1                    \nCRDER2  = 0.000630066308654874 / [deg] Uncertainty in CRVAL2                    \nUNCRTPA =  0.00186634833181778 / [deg] Uncertainty in position angle            \nCSDRADEC= 5.27382080384386E-06 / [deg] Costandard deviation in RA and Dec       \nSIGRA   =    0.141175326515381 / [arcsec] RMS dispersion of RA over DCE         \nSIGDEC  =   0.0260011516228373 / [arcsec] RMS dispersion of DEC over DCE        \nSIGPA   =    0.786707814443969 / [arcsec] RMS dispersion of PA over DCE         \nPA      =      64.170376337596 / [deg] Position angle of axis 2 (E of N) (was OR\nRA_RQST =     6.15510111508666 / [deg] Requested RA at CRPIX1, CRPIX2           \nDEC_RQST=    -2.07249338178042 / [deg] Requested Dec at CRPIX1, CRPIX2          \nPM_RA   =              -1.4108 / [arcsec/yr] Proper Motion in RA (J2000)        \nPM_DEC  =              1.50775 / [arcsec/yr] Proper Motion in Dec (J200)        \nRMS_JIT =  0.00840644136311876 / [arcsec] RMS jitter during DCE                 \nRMS_JITY=  0.00544908399993541 / [arcsec] RMS jitter during DCE along Y         \nRMS_JITZ=  0.00640122956573203 / [arcsec] RMS jitter during DCE along Z         \nSIG_JTYZ=  0.00350446005496643 / [arcsec] Costadard deviation of jitter in YZ   \nPTGDIFF =    0.738140521808859 / [arcsec] Offset btwn actual and rqsted pntng   \nRA_REF  =     6.10241222222221 / [deg] Commanded RA (J2000) of ref. position    \nDEC_REF =    -1.97235500000001 / [deg] Commanded Dec (J2000) of ref. position   \nUSEDBPHF=                    T / T if Boresight Pointing History File was used  \n                                                                                \n          / DISTORTION KEYWORDS                                                 \n                                                                                \nA_ORDER =                    2 / polynomial order, axis 1, detector to sky      \nA_0_2   =            6.666E-06 / distortion coefficient                         \nA_1_1   =            1.801E-05 / distortion coefficient                         \nA_2_0   =           -2.353E-05 / distortion coefficient                         \nA_DMAX  =                 0.58 / [pixel] maximum correction                     \nB_ORDER =                    2 / polynomial order, axis 2, detector to sky      \nB_0_2   =            2.601E-05 / distortion coefficient                         \nB_1_1   =           -2.944E-05 / distortion coefficient                         \nB_2_0   =           -1.226E-06 / distortion coefficient                         \nB_DMAX  =                0.902 / [pixel] maximum correction                     \nAP_ORDER=                    2 / polynomial order, axis 1, sky to detector      \nAP_0_1  =           -5.463E-06 / distortion coefficient                         \nAP_0_2  =           -6.666E-06 / distortion coefficient                         \nAP_1_0  =             1.14E-05 / distortion coefficient                         \nAP_1_1  =           -1.801E-05 / distortion coefficient                         \nAP_2_0  =            2.353E-05 / distortion coefficient                         \nBP_ORDER=                    2 / polynomial order, axis 2, sky to detector      \nBP_0_1  =            1.975E-05 / distortion coefficient                         \nBP_0_2  =           -2.601E-05 / distortion coefficient                         \nBP_1_0  =           -1.495E-05 / distortion coefficient                         \nBP_1_1  =            2.944E-05 / distortion coefficient                         \nBP_2_0  =            1.225E-06 / distortion coefficient                         \n                                                                                \n          / PHOTOMETRY                                                          \n                                                                                \nBUNIT   = 'MJy/sr  '           / Units of image data                            \nFLUXCONV=                0.111 / Flux Conv. factor (MJy/Str per DN/sec)         \nGAIN    =                  3.3 / e/DN conversion                                \n                                                                                \n          / GENERAL MAPPING KEYWORDS                                            \n                                                                                \nCYCLENUM=                    6 / Current cycle number                           \nDITHPOS =                    1 / Current dither position                        \n                                                                                \n          / IRAC MAPPING KEYWORDS                                               \n                                                                                \nREADMODE= 'FULL    '           / Readout mode                                   \nDITHSCAL= 'small   '           / Dither scale (small, medium, large)            \n                                                                                \n          / INSTRUMENT TELEMETRY DATA                                           \n                                                                                \nASHTCON =                    2 / Shutter condition (1:closed, 2: open)          \nAWEASIDE=                    0 / WEA side in use (0:B, 1:A)                     \nACTXSTAT=                    0 / Cmded transcal status                          \nATXSTAT =                    0 / transcal status                                \nACFLSTAT=                    0 / Cmded floodcal status                          \nAFLSTAT =                    0 / floodcal status                                \nAVRSTUCC=                 -3.5 / [Volts] Cmded VRSTUC Bias                      \nAVRSTBEG=          -3.51078391 / [Volts] VRSTUC Bias at start integration       \nAVDETC  =                -2.75 / [Volts] Cmded VDET Bias                        \nAVDETBEG=          -2.75721574 / [Volts] VDET Bias at start of integration      \nAVGG1C  =           -3.6500001 / [Volts] Cmded VGG1 Bias                        \nAVGG1BEG=           -3.2065742 / [Volts] VGG1 Bias at start of integration      \nAVDDUCC =                   -3 / [Volts] Cmded VDDUC Bias                       \nAVDDUBEG=                   -3 / [Volts] VDDUC Bias at start integration        \nAVGGCLC =                    1 / [Volts] Cmnded VGGCL clock rail voltage        \nAVGGCBEG=                    1 / [Volts] VGGCL clock rail voltage               \nAHTRIBEG=         204.70100403 / [uAmps] Heater current at start of integ       \nAHTRVBEG=           2.39006352 / [Volts] Heater Voltage at start integ.         \nAFPAT2B =          15.02370644 / [Deg_K] FPA Temp sensor #2 at start integ.     \nAFPAT2BT=          431446.8125 / [Sec] FPA Temp sensor #2 time tag              \nAFPAT2E =          15.02312088 / [Deg_K] FPA temp sensor #2, end integ.         \nAFPAT2ET=          431476.9375 / [Sec] FPA temp sensor #2 time tag              \nACTENDT =          20.46821594 / [Deg_C] C&T board thermistor                   \nAFPECTE =          18.34936523 / [Deg_C] FPE control board thermistor           \nAFPEATE =          21.90242577 / [Deg_C] FPE analog board thermistor            \nASHTEMPE=          21.59600639 / [Deg_C] Shutter board thermistor               \nATCTEMPE=          22.81523895 / [Deg_C] Temp. controller board thermistor      \nACETEMPE=          20.49869537 / [Deg_C] Calib. electronics board thermistor    \nAPDTEMPE=          21.47408295 / [Deg_C] PDU board thermistor                   \nACATMP1E=           1.31549275 / [Deg_K] CA Temp, end integration for temp1     \nACATMP2E=           1.29850066 / [Deg_K] CA Temp, end integration for temp2     \nACATMP3E=           1.33064687 / [Deg_K] CA Temp, end integration for temp3     \nACATMP4E=            1.3274169 / [Deg_K] CA Temp, end integration for temp4     \nACATMP5E=            1.3255291 / [Deg_K] CA Temp, end integration for temp5     \nACATMP6E=           1.32403958 / [Deg_K] CA Temp, end integration for temp6     \nACATMP7E=           1.32282794 / [Deg_K] CA Temp, end integration for temp7     \nACATMP8E=           1.31592035 / [Deg_K] CA Temp, end integration for temp8     \n                                                                                \n          / DATA FLOW KEYWORDS                                                  \n                                                                                \nORIGIN0 = 'JPL_FOS '           / Site where RAW FITS file was written           \nCREATOR0= 'J5.1.0  '           / SW system that created RAW FITS                \nDATE    = '2003-12-17T00:52:57' / [YYYY-MM-DDThh:mm:ss UTC] file creation date  \nAORKEY  =              3937792 / AOR or EIR key. Astrnmy Obs Req/Instr Eng Req  \nEXPID   =                   11 / Exposure ID (0-9999)                           \nDCENUM  =                    0 / DCE number (0-9999)                            \nTLMGRPS =                    1 / expected number of groups                      \nFILE_VER=                    1 / Version of the raw file made by SIS            \nRAWFILE = 'IRAC.1.0003937792.0011.0000.01.mipl.fits' / Raw data file name       \nCPT_VER = '3.0.94  '           / Channel Param Table FOS versioN                \nCTD_VER = '3.0.94S '           / Cmded telemetry data version                   \nEXPDFLAG=                    F / (T/F) expedited DCE                            \nMISS_LCT=                    0 / Total Missed Line Cnt in this FITS             \nMANCPKT =                    F / T if this FITS is Missing Ancillary Data       \nMISSDATA=                    F / T if this FITS is Missing Image Data           \nPAONUM  =                  206 / PAO Number                                     \nCAMPAIGN= 'IRAC003500'         / Campaign                                       \nDCEID   =              6086781 / Data-Collection-Event ID                       \nDCEINSID=               626089 / DCE Instance ID                                \nDPID    =              2631728 / Data Product Instance ID                       \nPIPENUM =                  107 / Pipeline Script Number                         \nSOS_VER =                    2 / Data-Product Version                           \nPLVID   =                    4 / Pipeline Version ID                            \nCALID   =                    6 / CalTrans Version ID                            \n                                                                                \nSDRKEPID=                28809 / Sky Dark ensemble product ID                   \n                                                                                \nPMSKFBID=                  341 / Pixel mask ID                                  \nLINCFBID=                  357 / Fall-back Linearity correction ID              \nFLATFBID=                  718 / Fall-back flat ID                              \nFLXCFBID=                  349 / Flux conversion ID                             \nMBLTFBID=                  696 / Muxbleed Lookup Table ID                       \nMBCFFBID=                  704 / Muxbleed Coefficients ID                       \n                                                                                \n          / PROCESSING HISTORY                                                  \n                                                                                \nHISTORY job.c ver: 1.000000                                                     \nHISTORY TRANHEAD                  v.         11.9, ran Tue Dec 16 16:52:35 2003 \nHISTORY CALTRANS                 v.        2.7, ran Tue Dec 16 16:52:44 2003    \nHISTORY cvti2r4           v.  1.25 A30501, generated 12/16/03 at 16:52:44       \nHISTORY FFCORR                 v. 1.000, ran Tue Dec 16 16:52:46 2003           \nHISTORY MUXBLEEDCORR              v.        1.600, ran Tue Dec 16 16:52:50 2003 \nHISTORY FOWLINEARIZE              v.     4.800000, ran Tue Dec 16 16:52:50 2003 \nHISTORY DARKSUBNG                 v. 1.000, ran Tue Dec 16 16:52:51 2003        \nHISTORY DARKDRIFT                 v.          3.5, ran Tue Dec 16 16:52:52 2003 \nHISTORY FLATAP                    v. 1.300   Tue Dec 16 16:52:53 2003           \nHISTORY DNTOFLUX                  v.          3.7, ran Tue Dec 16 16:52:57 2003 \nHISTORY PREDICTSAT                v.     3.500000, ran Tue Dec 16 16:57:59 2003 \nHISTORY CALTRANS                 v.        2.7, ran Tue Dec 16 17:07:31 2003    \nHISTORY PTNTRAN                   v.          1.2, ran Tue Dec 16 17:07:32 2003 \nHISTORY FPGen                     v.         1.22, ran Tue Dec 16 17:07:33 2003 \nHISTORY CALTRANS                 v.        2.7, ran Wed Dec 17 06:14:18 2003    \nSOFTWARE= 'pointingrefine'     / Pointing refinement using pnt-src correlation  \nPTGVERSN=                  5.3 / Version number of pointingrefine program       \nRARFND  =     6.15526023786181 / [deg] Refined RA                               \nDECRFND =    -2.07244250543341 / [deg] Refined DEC                              \nCT2RFND =    -64.5569826743286 / [deg] Refined CROTA2                           \nPA_RFND =     64.5569826743286 / [deg] Refined PA (= -CROTA2_refined)           \nERARFND = 0.000535377007940228 / [deg] Error in refined RA                      \nEDECRFND=  0.00123072014833503 / [deg] Error in refined DEC                     \nEPA_RFND=     2.28015678741471 / [deg] Error in refined PA or CROTA2            \nNASTROM =                    6 / # Astrometric sources for absolute refinement  \nRARESID =   -0.887761029918005 / [arcsec] Residual: Observed-Refined RA         \nDECRESID=    0.484259558515454 / [arcsec] Residual: Observed-Refined DEC        \nPA_RESID=     -1391.7828122373 / [arcsec] Residual: Observed-Refined PA         \nCD11RFND= -0.000145881550132727 / [deg/pix] Refined CD matrix element 1_1       \nCD12RFND= 0.000306140372692502 / [deg/pix] Refined CD matrix element 1_2        \nCD21RFND=  0.00030609131452955 / [deg/pix] Refined CD matrix element 2_1        \nCD22RFND= 0.000145647908967425 / [deg/pix] Refined CD matrix element 2_2        "},{"col":4,"comment":"null","endLoc":2445,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13322,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2441,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'width': inputs_unit[self.inputs[0]],\n                'slope': outputs_unit[self.outputs[0]] / inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":2394,"id":13323,"name":"amplitude","nodeType":"Attribute","startLoc":2394,"text":"amplitude"},{"className":"Chebyshev1D","col":0,"comment":"\n    Univariate Chebyshev series.\n\n    It is defined as:\n\n    .. math::\n\n        P(x) = \\sum_{i=0}^{i=n}C_{i} * T_{i}(x)\n\n    where ``T_i(x)`` is the corresponding Chebyshev polynomial of the 1st kind.\n\n    For explanation of ```domain``, and ``window`` see\n    :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : tuple or None, optional\n    window : tuple or None, optional\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window.\n    **params : dict\n        keyword : value pairs, representing parameter_name: value\n\n    Notes\n    -----\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Chebyshev polynomials is a polynomial in x - since the\n    coefficients within each Chebyshev polynomial are fixed, we can't use\n    quantities for x since the units would not be compatible. For example, the\n    third Chebyshev polynomial (T2) is 2x^2-1, but if x was specified with\n    units, 2x^2 and -1 would have incompatible units.\n    ","endLoc":519,"id":13324,"nodeType":"Class","startLoc":415,"text":"class Chebyshev1D(_PolyDomainWindow1D):\n    r\"\"\"\n    Univariate Chebyshev series.\n\n    It is defined as:\n\n    .. math::\n\n        P(x) = \\sum_{i=0}^{i=n}C_{i} * T_{i}(x)\n\n    where ``T_i(x)`` is the corresponding Chebyshev polynomial of the 1st kind.\n\n    For explanation of ```domain``, and ``window`` see\n    :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : tuple or None, optional\n    window : tuple or None, optional\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window.\n    **params : dict\n        keyword : value pairs, representing parameter_name: value\n\n    Notes\n    -----\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Chebyshev polynomials is a polynomial in x - since the\n    coefficients within each Chebyshev polynomial are fixed, we can't use\n    quantities for x since the units would not be compatible. For example, the\n    third Chebyshev polynomial (T2) is 2x^2-1, but if x was specified with\n    units, 2x^2 and -1 would have incompatible units.\n    \"\"\"\n    n_inputs = 1\n    n_outputs = 1\n\n    _separable = True\n\n    def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n\n        super().__init__(degree, domain=domain, window=window, n_models=n_models,\n                         model_set_axis=model_set_axis, name=name, meta=meta, **params)\n\n    def fit_deriv(self, x, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        v = np.empty((self.degree + 1,) + x.shape, dtype=x.dtype)\n        v[0] = 1\n        if self.degree > 0:\n            x2 = 2 * x\n            v[1] = x\n            for i in range(2, self.degree + 1):\n                v[i] = v[i - 1] * x2 - v[i - 2]\n        return np.rollaxis(v, 0, v.ndim)\n\n    def prepare_inputs(self, x, **kwargs):\n        inputs, broadcasted_shapes = super().prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), broadcasted_shapes\n\n    def evaluate(self, x, *coeffs):\n        if self.domain is not None:\n            x = poly_map_domain(x, self.domain, self.window)\n        return self.clenshaw(x, coeffs)\n\n    @staticmethod\n    def clenshaw(x, coeffs):\n        \"\"\"Evaluates the polynomial using Clenshaw's algorithm.\"\"\"\n\n        if len(coeffs) == 1:\n            c0 = coeffs[0]\n            c1 = 0\n        elif len(coeffs) == 2:\n            c0 = coeffs[0]\n            c1 = coeffs[1]\n        else:\n            x2 = 2 * x\n            c0 = coeffs[-2]\n            c1 = coeffs[-1]\n            for i in range(3, len(coeffs) + 1):\n                tmp = c0\n                c0 = coeffs[-i] - c1\n                c1 = tmp + c1 * x2\n        return c0 + c1 * x"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":709,"id":13325,"name":"lam","nodeType":"Attribute","startLoc":709,"text":"lam"},{"fileName":"__init__.py","filePath":"astropy/modeling/tests/data","id":13326,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\n\ndpath = os.path.split(os.path.abspath(__file__))[0]\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":2395,"id":13327,"name":"x_0","nodeType":"Attribute","startLoc":2395,"text":"x_0"},{"col":4,"comment":"null","endLoc":460,"header":"def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":13328,"name":"__init__","nodeType":"Function","startLoc":456,"text":"def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n\n        super().__init__(degree, domain=domain, window=window, n_models=n_models,\n                         model_set_axis=model_set_axis, name=name, meta=meta, **params)"},{"attributeType":"null","col":4,"comment":"null","endLoc":2396,"id":13329,"name":"width","nodeType":"Attribute","startLoc":2396,"text":"width"},{"className":"Pix2Sky_CylindricalEqualArea","col":0,"comment":"\n    Cylindrical equal area projection - pixel to sky.\n\n    Corresponds to the ``CEA`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= x \\\\\n        \\theta &= \\sin^{-1}\\left(\\frac{\\pi}{180^{\\circ}}\\lambda y\\right)\n\n    Parameters\n    ----------\n    lam : float\n        Radius of the cylinder in spherical radii, λ.  Default is 1.\n    ","endLoc":739,"id":13330,"nodeType":"Class","startLoc":724,"text":"class Pix2Sky_CylindricalEqualArea(Pix2SkyProjection, Cylindrical):\n    r\"\"\"\n    Cylindrical equal area projection - pixel to sky.\n\n    Corresponds to the ``CEA`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= x \\\\\n        \\theta &= \\sin^{-1}\\left(\\frac{\\pi}{180^{\\circ}}\\lambda y\\right)\n\n    Parameters\n    ----------\n    lam : float\n        Radius of the cylinder in spherical radii, λ.  Default is 1.\n    \"\"\"\n    lam = _ParameterDS(default=1)"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":739,"id":13331,"name":"lam","nodeType":"Attribute","startLoc":739,"text":"lam"},{"attributeType":"null","col":4,"comment":"null","endLoc":2397,"id":13332,"name":"slope","nodeType":"Attribute","startLoc":2397,"text":"slope"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":13333,"name":"dpath","nodeType":"Attribute","startLoc":5,"text":"dpath"},{"className":"Moffat1D","col":0,"comment":"\n    One dimensional Moffat model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the model.\n    x_0 : float\n        x position of the maximum of the Moffat model.\n    gamma : float\n        Core width of the Moffat model.\n    alpha : float\n        Power index of the Moffat model.\n\n    See Also\n    --------\n    Gaussian1D, Box1D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        f(x) = A \\left(1 + \\frac{\\left(x - x_{0}\\right)^{2}}{\\gamma^{2}}\\right)^{- \\alpha}\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Moffat1D\n\n        plt.figure()\n        s1 = Moffat1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            s1.width = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n    ","endLoc":2874,"id":13334,"nodeType":"Class","startLoc":2783,"text":"class Moffat1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Moffat model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the model.\n    x_0 : float\n        x position of the maximum of the Moffat model.\n    gamma : float\n        Core width of the Moffat model.\n    alpha : float\n        Power index of the Moffat model.\n\n    See Also\n    --------\n    Gaussian1D, Box1D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        f(x) = A \\\\left(1 + \\\\frac{\\\\left(x - x_{0}\\\\right)^{2}}{\\\\gamma^{2}}\\\\right)^{- \\\\alpha}\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n\n        from astropy.modeling.models import Moffat1D\n\n        plt.figure()\n        s1 = Moffat1D()\n        r = np.arange(-5, 5, .01)\n\n        for factor in range(1, 4):\n            s1.amplitude = factor\n            s1.width = factor\n            plt.plot(r, s1(r), color=str(0.25 * factor), lw=2)\n\n        plt.axis([-5, 5, -1, 4])\n        plt.show()\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude of the model\")\n    x_0 = Parameter(default=0, description=\"X position of maximum of Moffat model\")\n    gamma = Parameter(default=1, description=\"Core width of Moffat model\")\n    alpha = Parameter(default=1, description=\"Power index of the Moffat model\")\n\n    @property\n    def fwhm(self):\n        \"\"\"\n        Moffat full width at half maximum.\n        Derivation of the formula is available in\n        `this notebook by Yoonsoo Bach <https://nbviewer.jupyter.org/github/ysbach/AO_2017/blob/master/04_Ground_Based_Concept.ipynb#1.2.-Moffat>`_.\n        \"\"\"\n        return 2.0 * np.abs(self.gamma) * np.sqrt(2.0 ** (1.0 / self.alpha) - 1.0)\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, gamma, alpha):\n        \"\"\"One dimensional Moffat model function\"\"\"\n\n        return amplitude * (1 + ((x - x_0) / gamma) ** 2) ** (-alpha)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, x_0, gamma, alpha):\n        \"\"\"One dimensional Moffat model derivative with respect to parameters\"\"\"\n\n        fac = (1 + (x - x_0) ** 2 / gamma ** 2)\n        d_A = fac ** (-alpha)\n        d_x_0 = (2 * amplitude * alpha * (x - x_0) * d_A / (fac * gamma ** 2))\n        d_gamma = (2 * amplitude * alpha * (x - x_0) ** 2 * d_A /\n                   (fac * gamma ** 3))\n        d_alpha = -amplitude * d_A * np.log(fac)\n        return [d_A, d_x_0, d_gamma, d_alpha]\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'gamma': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"className":"Sky2Pix_CylindricalEqualArea","col":0,"comment":"\n    Cylindrical equal area projection - sky to pixel.\n\n    Corresponds to the ``CEA`` projection in FITS WCS.\n\n    .. math::\n        x &= \\phi \\\\\n        y &= \\frac{180^{\\circ}}{\\pi}\\frac{\\sin \\theta}{\\lambda}\n\n    Parameters\n    ----------\n    lam : float\n        Radius of the cylinder in spherical radii, λ.  Default is 0.\n    ","endLoc":757,"id":13335,"nodeType":"Class","startLoc":742,"text":"class Sky2Pix_CylindricalEqualArea(Sky2PixProjection, Cylindrical):\n    r\"\"\"\n    Cylindrical equal area projection - sky to pixel.\n\n    Corresponds to the ``CEA`` projection in FITS WCS.\n\n    .. math::\n        x &= \\phi \\\\\n        y &= \\frac{180^{\\circ}}{\\pi}\\frac{\\sin \\theta}{\\lambda}\n\n    Parameters\n    ----------\n    lam : float\n        Radius of the cylinder in spherical radii, λ.  Default is 0.\n    \"\"\"\n    lam = _ParameterDS(default=1)"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":757,"id":13336,"name":"lam","nodeType":"Attribute","startLoc":757,"text":"lam"},{"col":4,"comment":"\n        Moffat full width at half maximum.\n        Derivation of the formula is available in\n        `this notebook by Yoonsoo Bach <https://nbviewer.jupyter.org/github/ysbach/AO_2017/blob/master/04_Ground_Based_Concept.ipynb#1.2.-Moffat>`_.\n        ","endLoc":2845,"header":"@property\n    def fwhm(self)","id":13337,"name":"fwhm","nodeType":"Function","startLoc":2838,"text":"@property\n    def fwhm(self):\n        \"\"\"\n        Moffat full width at half maximum.\n        Derivation of the formula is available in\n        `this notebook by Yoonsoo Bach <https://nbviewer.jupyter.org/github/ysbach/AO_2017/blob/master/04_Ground_Based_Concept.ipynb#1.2.-Moffat>`_.\n        \"\"\"\n        return 2.0 * np.abs(self.gamma) * np.sqrt(2.0 ** (1.0 / self.alpha) - 1.0)"},{"col":4,"comment":"One dimensional Moffat model function","endLoc":2851,"header":"@staticmethod\n    def evaluate(x, amplitude, x_0, gamma, alpha)","id":13338,"name":"evaluate","nodeType":"Function","startLoc":2847,"text":"@staticmethod\n    def evaluate(x, amplitude, x_0, gamma, alpha):\n        \"\"\"One dimensional Moffat model function\"\"\"\n\n        return amplitude * (1 + ((x - x_0) / gamma) ** 2) ** (-alpha)"},{"col":4,"comment":"One dimensional Moffat model derivative with respect to parameters","endLoc":2863,"header":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, gamma, alpha)","id":13339,"name":"fit_deriv","nodeType":"Function","startLoc":2853,"text":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, gamma, alpha):\n        \"\"\"One dimensional Moffat model derivative with respect to parameters\"\"\"\n\n        fac = (1 + (x - x_0) ** 2 / gamma ** 2)\n        d_A = fac ** (-alpha)\n        d_x_0 = (2 * amplitude * alpha * (x - x_0) * d_A / (fac * gamma ** 2))\n        d_gamma = (2 * amplitude * alpha * (x - x_0) ** 2 * d_A /\n                   (fac * gamma ** 3))\n        d_alpha = -amplitude * d_A * np.log(fac)\n        return [d_A, d_x_0, d_gamma, d_alpha]"},{"col":4,"comment":"null","endLoc":2869,"header":"@property\n    def input_units(self)","id":13340,"name":"input_units","nodeType":"Function","startLoc":2865,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}"},{"col":4,"comment":"null","endLoc":2874,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13341,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2871,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'gamma': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":2833,"id":13342,"name":"amplitude","nodeType":"Attribute","startLoc":2833,"text":"amplitude"},{"col":0,"comment":"","endLoc":3,"header":"__init__.py#<anonymous>","id":13343,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"dpath = os.path.split(os.path.abspath(__file__))[0]"},{"className":"Pix2Sky_PlateCarree","col":0,"comment":"\n    Plate carrée projection - pixel to sky.\n\n    Corresponds to the ``CAR`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= x \\\\\n        \\theta &= y\n    ","endLoc":776,"id":13344,"nodeType":"Class","startLoc":760,"text":"class Pix2Sky_PlateCarree(Pix2SkyProjection, Cylindrical):\n    r\"\"\"\n    Plate carrée projection - pixel to sky.\n\n    Corresponds to the ``CAR`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= x \\\\\n        \\theta &= y\n    \"\"\"\n\n    @staticmethod\n    def evaluate(x, y):\n        # The intermediate variables are only used here for clarity\n        phi = np.array(x)\n        theta = np.array(y)\n        return phi, theta"},{"col":4,"comment":"null","endLoc":776,"header":"@staticmethod\n    def evaluate(x, y)","id":13345,"name":"evaluate","nodeType":"Function","startLoc":771,"text":"@staticmethod\n    def evaluate(x, y):\n        # The intermediate variables are only used here for clarity\n        phi = np.array(x)\n        theta = np.array(y)\n        return phi, theta"},{"className":"Sky2Pix_PlateCarree","col":0,"comment":"\n    Plate carrée projection - sky to pixel.\n\n    Corresponds to the ``CAR`` projection in FITS WCS.\n\n    .. math::\n        x &= \\phi \\\\\n        y &= \\theta\n    ","endLoc":795,"id":13346,"nodeType":"Class","startLoc":779,"text":"class Sky2Pix_PlateCarree(Sky2PixProjection, Cylindrical):\n    r\"\"\"\n    Plate carrée projection - sky to pixel.\n\n    Corresponds to the ``CAR`` projection in FITS WCS.\n\n    .. math::\n        x &= \\phi \\\\\n        y &= \\theta\n    \"\"\"\n\n    @staticmethod\n    def evaluate(phi, theta):\n        # The intermediate variables are only used here for clarity\n        x = np.array(phi)\n        y = np.array(theta)\n        return x, y"},{"col":4,"comment":"null","endLoc":795,"header":"@staticmethod\n    def evaluate(phi, theta)","id":13347,"name":"evaluate","nodeType":"Function","startLoc":790,"text":"@staticmethod\n    def evaluate(phi, theta):\n        # The intermediate variables are only used here for clarity\n        x = np.array(phi)\n        y = np.array(theta)\n        return x, y"},{"id":13348,"name":"spec.txt","nodeType":"TextFile","path":"astropy/modeling/tests/data","text":"# angstroms ergs^-1cm^-2a^-1 ergs^-1cm^-2a^-1 none\nlambda flux\n3637.39 0.314\n3638.227 0.717\n3639.065 1.482\n3639.903 0.798\n3640.741 0.506\n3641.58 7.678\n3642.418 17.648\n3643.257 -12.945\n3644.096 1.054\n3644.936 0.641\n3645.775 -0.744\n3646.614 -1.74\n3647.454 -1.654\n3648.294 2.189\n3649.134 -4.783\n3649.975 0.269\n3650.815 -3.744\n3651.656 -1.321\n3652.497 5.611\n3653.338 -1.354\n3654.179 -7.667\n3655.021 -6.947\n3655.862 -3.444\n3656.704 0.458\n3657.546 10.121\n3658.388 2.692\n3659.231 6.183\n3660.074 1.47\n3660.917 0.522\n3661.76 -1.336\n3662.603 -3.938\n3663.446 0.36\n3664.29 -0.833\n3665.134 -6.548\n3665.978 4.517\n3666.822 -3.443\n3667.667 4.133\n3668.511 3.1\n3669.356 -2.28\n3670.201 -0.07\n3671.046 0.996\n3671.891 4.899\n3672.737 6.552\n3673.583 0.147\n3674.429 8.811\n3675.275 -13.819\n3676.121 -4.138\n3676.968 4.642\n3677.815 -5.991\n3678.662 -8.608\n3679.509 -5.226\n3680.356 -6.709\n3681.204 3.912\n3682.051 -3.479\n3682.899 6.333\n3683.747 1.952\n3684.595 0.582\n3685.444 5.096\n3686.293 5.637\n3687.142 7.014\n3687.991 7.219\n3688.84 1.413\n3689.689 -8.288\n3690.539 -10.228\n3691.389 5.535\n3692.239 4.68\n3693.09 -4.491\n3693.94 -3.655\n3694.791 0.226\n3695.641 -6.117\n3696.493 -3.321\n3697.344 -2.776\n3698.195 -5.208\n3699.047 0.225\n3699.899 2.508\n3700.75 3.653\n3701.603 3.357\n3702.455 0.342\n3703.308 1.233\n3704.161 2.898\n3705.014 -3.089\n3705.867 -7.025\n3706.72 -4.984\n3707.574 -3.697\n3708.428 -4.908\n3709.282 -10.345\n3710.136 -6.962\n3710.99 -0.417\n3711.845 0.208\n3712.7 -0.621\n3713.554 0.688\n3714.41 0.711\n3715.265 -5.798\n3716.121 -4.503\n3716.977 -5.182\n3717.833 -4.525\n3718.689 0.451\n3719.545 0.349\n3720.402 -4.15\n3721.258 3.035\n3722.115 -2.784\n3722.972 -10.298\n3723.83 5.089\n3724.687 7.036\n3725.545 7.128\n3726.403 16.655\n3727.261 21.481\n3728.12 23.281\n3728.978 29.284\n3729.837 36.02\n3730.696 27.616\n3731.555 19.612\n3732.414 10.053\n3733.274 -1.323\n3734.134 -7.332\n3734.993 -5.413\n3735.854 1.421\n3736.714 5.509\n3737.574 -0.392\n3738.435 -7.417\n3739.296 -3.618\n3740.157 2.14\n3741.018 -2.062\n3741.88 -1.297\n3742.741 -0.744\n3743.604 -5.949\n3744.466 -3.639\n3745.328 -5.393\n3746.19 -2.587\n3747.053 -5.777\n3747.916 -10.713\n3748.779 -2.807\n3749.642 -0.631\n3750.506 -0.286\n3751.369 -0.857\n3752.233 -5.617\n3753.097 -3.3\n3753.961 -5.894\n3754.826 -1.156\n3755.691 1.629\n3756.555 -0.11\n3757.421 1.791\n3758.286 2.915\n3759.151 3.542\n3760.017 5.358\n3760.883 3.494\n3761.749 5.006\n3762.615 -1.772\n3763.482 0.258\n3764.348 -4.344\n3765.216 8.354\n3766.083 -0.446\n3766.949 -10.779\n3767.817 -3.798\n3768.685 -0.951\n3769.553 0.229\n3770.421 -2.939\n3771.289 -7.07\n3772.157 -8.387\n3773.026 -6.25\n3773.895 -7.979\n3774.764 -8.773\n3775.633 -8.617\n3776.503 -7.372\n3777.373 -10.774\n3778.242 -3.158\n3779.113 -2.58\n3779.983 -7.275\n3780.853 -6.884\n3781.724 -5.344\n3782.595 -1.868\n3783.466 -0.435\n3784.337 -4.829\n3785.209 -9.714\n3786.08 -7.378\n3786.952 -7.247\n3787.824 -11.254\n3788.697 -13.877\n3789.569 -6.008\n3790.442 -5.157\n3791.315 -8.827\n3792.188 -11.46\n3793.061 -11.651\n3793.935 -7.044\n3794.808 -13.651\n3795.682 -14.702\n3796.556 -9.771\n3797.43 -8.333\n3798.305 -6.82\n3799.179 -5.427\n3800.054 -4.901\n3800.929 -7.101\n3801.805 1.909\n3802.68 5.997\n3803.556 1.92\n3804.432 -0.179\n3805.308 5.629\n3806.184 2.622\n3807.061 4.183\n3807.938 2.053\n3808.815 -0.398\n3809.692 3.115\n3810.569 6.1\n3811.446 7.631\n3812.324 2.685\n3813.202 6.071\n3814.08 2.488\n3814.958 3.836\n3815.837 4.549\n3816.716 0.983\n3817.595 0.16\n3818.474 1.995\n3819.353 0.481\n3820.233 2.509\n3821.113 7.105\n3821.992 6.228\n3822.873 1.339\n3823.753 0.635\n3824.634 0.744\n3825.514 -3.975\n3826.395 -1.634\n3827.276 -0.191\n3828.158 -5.059\n3829.039 -3.439\n3829.921 -6.59\n3830.803 -4.915\n3831.685 -2.842\n3832.567 -1.924\n3833.45 -6.765\n3834.333 -10.013\n3835.216 -7.002\n3836.099 -4.385\n3836.982 -2.533\n3837.866 -2.341\n3838.75 0.323\n3839.634 -2.66\n3840.518 -4.691\n3841.403 0.843\n3842.287 5.419\n3843.172 0.38\n3844.057 0.443\n3844.942 2.676\n3845.828 -4.706\n3846.713 -0.74\n3847.599 -0.48\n3848.485 -3.89\n3849.372 0.651\n3850.258 7.508\n3851.145 -2.033\n3852.031 -2.013\n3852.918 2.734\n3853.806 0.155\n3854.693 -1.402\n3855.581 -5.445\n3856.469 1.026\n3857.357 2.453\n3858.245 4.949\n3859.134 6.945\n3860.022 7.117\n3860.911 5.119\n3861.801 4.669\n3862.69 3.608\n3863.579 3.568\n3864.469 7.186\n3865.359 3.266\n3866.249 6.231\n3867.139 12.176\n3868.03 17.612\n3868.921 22.511\n3869.812 25.755\n3870.703 26.305\n3871.594 18.296\n3872.486 1.866\n3873.377 7.24\n3874.27 5.516\n3875.162 -1.317\n3876.054 4.102\n3876.947 1.852\n3877.84 -2.888\n3878.732 -1.414\n3879.625 2.28\n3880.519 2.961\n3881.413 -0.003\n3882.307 -4.052\n3883.201 -3.367\n3884.095 -1.457\n3884.989 -4.975\n3885.884 2.129\n3886.779 3.514\n3887.674 -0.541\n3888.569 1.33\n3889.465 6.26\n3890.36 3.928\n3891.256 1.173\n3892.152 2.854\n3893.049 0.09\n3893.945 3.939\n3894.842 0.169\n3895.739 1.095\n3896.636 0.91\n3897.533 3.827\n3898.431 4.436\n3899.329 2.371\n3900.226 2.517\n3901.125 -0.812\n3902.023 2.704\n3902.921 3.621\n3903.821 3.298\n3904.719 3.108\n3905.618 -0.214\n3906.518 2.495\n3907.417 4.342\n3908.317 -0.244\n3909.218 4.866\n3910.118 4.261\n3911.018 3.618\n3911.919 1.684\n3912.82 1.997\n3913.72 1.887\n3914.622 0.085\n3915.523 0.095\n3916.425 3.26\n3917.327 3.987\n3918.229 0.073\n3919.131 3.603\n3920.034 3.563\n3920.937 6.926\n3921.84 4.587\n3922.743 6.765\n3923.646 8.337\n3924.55 5.343\n3925.453 2.06\n3926.357 0.84\n3927.262 2.173\n3928.166 5.425\n3929.071 2.699\n3929.975 5.152\n3930.88 0.853\n3931.785 -2.151\n3932.691 -5.933\n3933.597 -7.783\n3934.502 -4.402\n3935.408 -0.705\n3936.315 -2.736\n3937.221 -0.97\n3938.128 -0.632\n3939.034 2.698\n3939.942 -0.279\n3940.85 -1.189\n3941.757 4.96\n3942.664 1.86\n3943.572 -0.217\n3944.48 2.847\n3945.388 3.223\n3946.297 3.586\n3947.206 4.627\n3948.115 1.729\n3949.024 1.351\n3949.934 6.281\n3950.844 4.331\n3951.753 6.514\n3952.663 5.416\n3953.573 3.208\n3954.483 1.706\n3955.394 6.378\n3956.305 4.831\n3957.217 -0.069\n3958.128 -5.831\n3959.04 -0.846\n3959.951 1.173\n3960.863 -4.042\n3961.775 -0.524\n3962.688 2.694\n3963.6 1.589\n3964.512 -1.631\n3965.425 -0.938\n3966.338 -4.003\n3967.252 -4.35\n3968.166 3.345\n3969.08 -0.385\n3969.994 -1.361\n3970.908 1.998\n3971.822 3.661\n3972.737 1.281\n3973.652 -2.011\n3974.567 -2.785\n3975.482 -1.73\n3976.397 -1.752\n3977.314 -3.238\n3978.23 2.488\n3979.145 0.386\n3980.062 -1.084\n3980.978 -5.157\n3981.895 -2.678\n3982.812 2.117\n3983.729 0.639\n3984.647 -2.301\n3985.564 1.483\n3986.482 -1.703\n3987.4 -4.999\n3988.318 0.592\n3989.237 5.67\n3990.156 5.565\n3991.074 -1.585\n3991.994 -0.614\n3992.913 0.894\n3993.832 1.402\n3994.751 2.14\n3995.671 -2.091\n3996.592 3.312\n3997.512 -0.064\n3998.433 -3.265\n3999.354 0.654\n4000.275 1.858\n4001.196 -1.827\n4002.117 -0.297\n4003.039 1.328\n4003.96 -0.085\n4004.883 2.043\n4005.805 0.967\n4006.727 -0.418\n4007.65 -1.598\n4008.573 1.58\n4009.496 8.77\n4010.42 0.585\n4011.343 -1.109\n4012.267 -1.852\n4013.19 -3.213\n4014.115 -0.906\n4015.04 -0.598\n4015.964 5.873\n4016.889 0.743\n4017.814 0.495\n4018.739 3.083\n4019.665 1.974\n4020.59 -0.466\n4021.516 -1.472\n4022.442 1.125\n4023.368 -0.587\n4024.295 -1.993\n4025.222 3.828\n4026.148 -1.972\n4027.076 -4.705\n4028.003 2.367\n4028.931 -0.978\n4029.859 -1.044\n4030.787 -4.606\n4031.714 -3.573\n4032.643 -0.932\n4033.572 -0.419\n4034.501 1.984\n4035.429 -0.954\n4036.359 -5.983\n4037.289 -1.507\n4038.218 -4.948\n4039.148 -3.936\n4040.079 0.352\n4041.009 -0.631\n4041.94 0.171\n4042.871 -1.492\n4043.801 -2.872\n4044.733 -1.401\n4045.664 -0.135\n4046.596 -4.038\n4047.527 -3.944\n4048.459 -4.432\n4049.392 0.635\n4050.324 -0.562\n4051.257 1.476\n4052.19 1.557\n4053.124 -2.458\n4054.057 -2.195\n4054.99 -3.15\n4055.924 -3.317\n4056.858 4.908\n4057.792 -1.647\n4058.727 -1.705\n4059.662 -2.414\n4060.596 -1.457\n4061.531 2.202\n4062.467 0.608\n4063.402 -0.783\n4064.337 -1.289\n4065.274 -2.828\n4066.21 -0.392\n4067.146 1.486\n4068.083 2.039\n4069.02 7.148\n4069.957 3.25\n4070.894 -1.378\n4071.832 0.751\n4072.77 2.399\n4073.707 2.391\n4074.645 4.748\n4075.584 3.986\n4076.522 2.717\n4077.461 3.601\n4078.4 -0.193\n4079.339 0.037\n4080.279 2.097\n4081.218 1.628\n4082.158 0.045\n4083.098 -1.109\n4084.038 0.434\n4084.979 -2.298\n4085.919 -1.238\n4086.86 5.928\n4087.802 -2.162\n4088.743 -0.975\n4089.684 2.926\n4090.626 3.232\n4091.568 -0.908\n4092.51 -3.339\n4093.453 -1.647\n4094.396 0.327\n4095.339 -0.948\n4096.282 -0.282\n4097.225 -0.312\n4098.168 -0.228\n4099.112 -2.407\n4100.056 -6.751\n4101.001 -4.687\n4101.945 0.007\n4102.89 -4.043\n4103.834 1.003\n4104.779 -2.087\n4105.725 -3.786\n4106.67 1.23\n4107.615 -1.544\n4108.562 -2.72\n4109.508 -3.499\n4110.454 0.432\n4111.4 1.533\n4112.347 -0.658\n4113.294 -0.418\n4114.241 -4.039\n4115.189 -0.947\n4116.137 -2.912\n4117.085 1.429\n4118.033 2.211\n4118.98 -2.678\n4119.93 -2.757\n4120.878 -0.459\n4121.827 -2.906\n4122.776 0.533\n4123.726 -0.68\n4124.675 -3.316\n4125.625 0.115\n4126.576 -1.442\n4127.526 -0.543\n4128.477 -1.076\n4129.428 -3.127\n4130.378 -1.142\n4131.33 1.005\n4132.281 -1.927\n4133.232 -2.746\n4134.185 0.332\n4135.136 2.07\n4136.088 0.182\n4137.041 2.284\n4137.994 0.421\n4138.947 0.714\n4139.899 0.053\n4140.853 -2.266\n4141.807 -0.295\n4142.76 -0.158\n4143.714 -1.205\n4144.669 -2.018\n4145.623 -4.131\n4146.578 -0.186\n4147.533 -1.812\n4148.488 -3.561\n4149.443 -3.014\n4150.398 2.549\n4151.354 2.668\n4152.311 -1.215\n4153.267 -4.913\n4154.223 -2.923\n4155.18 2.406\n4156.137 -0.429\n4157.093 -1.409\n4158.051 2.482\n4159.008 -0.791\n4159.966 -3.941\n4160.924 -1.345\n4161.882 -1.171\n4162.841 -1.498\n4163.8 0.376\n4164.758 4.12\n4165.718 -0.002\n4166.677 1.065\n4167.636 -2.171\n4168.596 -1.95\n4169.556 -2.293\n4170.517 -3.316\n4171.477 -1.475\n4172.437 -1.235\n4173.398 -5.485\n4174.359 -3.345\n4175.321 -3.279\n4176.282 -5.516\n4177.244 -2.194\n4178.206 0.323\n4179.167 3.773\n4180.13 -1.794\n4181.093 -7.754\n4182.056 -2.259\n4183.019 -1.325\n4183.982 -4.992\n4184.945 -3.826\n4185.91 -1.95\n4186.873 0.928\n4187.837 0.108\n4188.802 -2.822\n4189.767 -0.681\n4190.731 -2.352\n4191.696 -1.155\n4192.662 -2.868\n4193.627 -5.617\n4194.593 -3.513\n4195.559 0.688\n4196.525 0.342\n4197.491 -8.29\n4198.458 -3.194\n4199.425 4.455\n4200.392 -1.602\n4201.359 -1.586\n4202.327 0.765\n4203.295 -3.043\n4204.263 0.914\n4205.23 1.881\n4206.199 0.164\n4207.168 0.703\n4208.136 -3.824\n4209.105 2.102\n4210.075 2.398\n4211.043 -2.4\n4212.014 0.376\n4212.983 1.752\n4213.954 5.34\n4214.925 -2.136\n4215.895 0.827\n4216.866 -3.143\n4217.837 -3.413\n4218.809 -1.666\n4219.78 -2.894\n4220.751 -1.154\n4221.724 -0.764\n4222.696 0.317\n4223.668 -0.532\n4224.641 -2.641\n4225.614 -5.801\n4226.587 -3.447\n4227.56 1.06\n4228.534 -1.078\n4229.507 -1.763\n4230.481 4.949\n4231.456 -5.676\n4232.43 -1.492\n4233.405 1.853\n4234.379 -5.191\n4235.355 -2.422\n4236.331 2.542\n4237.306 -0.64\n4238.282 -1.123\n4239.258 2.091\n4240.234 -0.175\n4241.21 -1.725\n4242.187 -1.421\n4243.164 0.091\n4244.141 0.338\n4245.118 0.741\n4246.096 -0.088\n4247.074 -2.024\n4248.052 -0.009\n4249.03 -1.75\n4250.009 -3.826\n4250.987 -3.372\n4251.966 -2.367\n4252.945 -2.52\n4253.925 0.182\n4254.905 4.495\n4255.884 -3.594\n4256.865 -1.811\n4257.845 -2.905\n4258.825 2.201\n4259.806 2.414\n4260.787 0.234\n4261.768 -2.389\n4262.75 -3.498\n4263.731 -0.152\n4264.713 2.049\n4265.695 -2.123\n4266.677 2.033\n4267.66 2.134\n4268.643 -3.086\n4269.625 -1.385\n4270.608 1.134\n4271.592 0.057\n4272.576 -1.692\n4273.56 -1.839\n4274.544 -0.348\n4275.528 1.138\n4276.513 -0.727\n4277.498 -1.987\n4278.483 2.592\n4279.468 1.262\n4280.454 -4.087\n4281.439 -2.778\n4282.426 -2.333\n4283.412 0.158\n4284.398 -2.393\n4285.384 2.421\n4286.371 1.416\n4287.358 -0.195\n4288.346 1.894\n4289.333 -0.066\n4290.321 -0.897\n4291.31 1.261\n4292.297 -1.194\n4293.286 -0.449\n4294.274 -0.135\n4295.264 2.852\n4296.252 0.073\n4297.242 -0.147\n4298.232 -4.22\n4299.222 -4.691\n4300.211 -2.046\n4301.202 1.332\n4302.192 -0.206\n4303.183 0.359\n4304.174 1.746\n4305.165 -2.111\n4306.156 -0.951\n4307.148 0.112\n4308.14 1.302\n4309.132 2.943\n4310.125 4.478\n4311.117 0.432\n4312.11 -3.082\n4313.103 1.618\n4314.096 4.595\n4315.09 4.715\n4316.083 3.512\n4317.077 3.97\n4318.071 4.781\n4319.065 7.264\n4320.06 7.263\n4321.055 3.426\n4322.05 7.347\n4323.045 4.369\n4324.041 3.697\n4325.037 5.947\n4326.033 5.944\n4327.029 4.296\n4328.026 4.151\n4329.022 2.796\n4330.019 2.334\n4331.016 3.339\n4332.013 6.877\n4333.011 7.366\n4334.009 2.265\n4335.007 3.015\n4336.005 4.359\n4337.004 6.277\n4338.002 1.539\n4339.002 3.047\n4340.001 5.855\n4341.0 4.863\n4342.0 10.848\n4343.0 12.159\n4344.0 8.138\n4345.0 5.56\n4346.0 1.135\n4347.001 0.891\n4348.003 3.956\n4349.004 6.201\n4350.005 1.482\n4351.007 4.675\n4352.009 5.206\n4353.012 6.14\n4354.014 7.268\n4355.016 1.666\n4356.019 7.681\n4357.022 8.007\n4358.026 9.549\n4359.029 11.518\n4360.033 7.575\n4361.038 8.993\n4362.042 10.166\n4363.046 10.661\n4364.051 16.325\n4365.056 12.669\n4366.061 11.407\n4367.066 6.941\n4368.072 7.766\n4369.078 6.891\n4370.084 4.134\n4371.091 5.727\n4372.098 5.436\n4373.104 4.006\n4374.111 3.151\n4375.118 4.985\n4376.125 2.739\n4377.133 4.162\n4378.141 7.15\n4379.15 0.139\n4380.159 4.257\n4381.167 4.094\n4382.176 2.482\n4383.186 0.647\n4384.195 -0.643\n4385.204 6.406\n4386.214 1.886\n4387.224 -1.034\n4388.234 -2.461\n4389.245 2.676\n4390.255 3.236\n4391.267 0.577\n4392.278 3.009\n4393.289 3.745\n4394.301 0.011\n4395.313 -1.275\n4396.325 -0.176\n4397.337 1.744\n4398.35 2.697\n4399.363 1.875\n4400.376 2.72\n4401.39 0.266\n4402.403 1.614\n4403.417 2.205\n4404.431 0.527\n4405.445 -2.316\n4406.46 -2.348\n4407.474 1.795\n4408.49 2.12\n4409.504 -1.397\n4410.521 -0.764\n4411.536 0.336\n4412.551 -0.149\n4413.568 1.381\n4414.584 -0.054\n4415.601 1.487\n4416.618 -0.591\n4417.635 -1.476\n4418.652 0.873\n4419.67 -5.968\n4420.688 -3.881\n4421.705 4.247\n4422.724 2.902\n4423.742 -0.022\n4424.761 -0.882\n4425.78 0.441\n4426.799 2.063\n4427.818 -3.459\n4428.838 -4.853\n4429.858 -1.057\n4430.878 -2.779\n4431.898 -2.042\n4432.919 -1.823\n4433.94 -3.19\n4434.961 -0.854\n4435.982 -3.599\n4437.003 -2.056\n4438.025 -0.673\n4439.048 -0.582\n4440.07 -1.539\n4441.093 1.297\n4442.115 1.244\n4443.138 -4.372\n4444.162 -3.668\n4445.185 -2.658\n4446.208 1.769\n4447.232 4.42\n4448.256 1.688\n4449.281 -1.656\n4450.305 2.716\n4451.33 3.895\n4452.355 0.476\n4453.38 0.318\n4454.406 -0.506\n4455.432 0.268\n4456.458 1.774\n4457.484 -1.132\n4458.511 -1.533\n4459.538 0.669\n4460.564 -2.292\n4461.591 -3.881\n4462.619 -1.84\n4463.646 -4.018\n4464.675 -3.985\n4465.703 0.627\n4466.731 -0.576\n4467.76 -1.15\n4468.788 -3.338\n4469.818 -3.594\n4470.847 -3.786\n4471.876 -2.128\n4472.906 3.533\n4473.937 0.951\n4474.967 0.616\n4475.997 -1.131\n4477.028 -1.032\n4478.059 0.601\n4479.09 -0.213\n4480.122 1.758\n4481.153 1.376\n4482.185 -0.467\n4483.217 -2.854\n4484.25 -1.779\n4485.283 -1.774\n4486.315 2.679\n4487.349 -0.067\n4488.382 3.708\n4489.416 2.096\n4490.45 3.661\n4491.484 1.519\n4492.518 -0.555\n4493.552 1.273\n4494.587 -0.75\n4495.622 1.786\n4496.657 1.666\n4497.693 -1.901\n4498.729 3.331\n4499.765 -0.78\n4500.801 1.272\n4501.837 3.227\n4502.874 3.23\n4503.911 3.321\n4504.948 1.231\n4505.985 0.913\n4507.023 4.279\n4508.061 3.066\n4509.1 5.29\n4510.138 -0.614\n4511.177 1.358\n4512.215 3.092\n4513.254 1.416\n4514.293 -0.764\n4515.333 -0.823\n4516.373 1.907\n4517.414 1.594\n4518.454 0.626\n4519.494 -2.018\n4520.535 0.294\n4521.576 2.23\n4522.617 -2.243\n4523.658 0.723\n4524.7 -4.77\n4525.743 2.935\n4526.784 -0.869\n4527.827 0.476\n4528.87 2.771\n4529.913 -2.9\n4530.956 -0.929\n4531.999 4.568\n4533.042 0.276\n4534.086 -1.723\n4535.131 4.347\n4536.175 3.557\n4537.22 -0.774\n4538.264 4.237\n4539.31 6.016\n4540.355 2.542\n4541.401 2.199\n4542.446 1.231\n4543.493 5.551\n4544.539 3.973\n4545.585 -1.371\n4546.632 2.604\n4547.679 -2.096\n4548.727 1.1\n4549.774 3.215\n4550.821 -0.168\n4551.87 2.356\n4552.918 2.006\n4553.966 1.431\n4555.015 -1.053\n4556.064 -0.829\n4557.113 3.553\n4558.163 0.651\n4559.212 -0.864\n4560.262 2.253\n4561.312 -0.167\n4562.363 1.943\n4563.413 5.344\n4564.464 1.149\n4565.515 1.313\n4566.567 2.892\n4567.618 6.082\n4568.67 -0.389\n4569.722 2.991\n4570.775 0.814\n4571.827 2.209\n4572.88 2.104\n4573.933 0.289\n4574.987 2.122\n4576.04 5.562\n4577.094 2.726\n4578.147 1.966\n4579.202 3.484\n4580.256 1.509\n4581.312 1.347\n4582.366 -1.15\n4583.421 -0.679\n4584.477 0.957\n4585.533 1.507\n4586.589 1.0\n4587.645 -0.607\n4588.701 2.753\n4589.758 1.501\n4590.815 -0.049\n4591.873 1.009\n4592.93 -1.09\n4593.987 0.594\n4595.045 3.319\n4596.104 -0.408\n4597.162 1.798\n4598.22 0.912\n4599.279 -1.281\n4600.339 3.526\n4601.398 1.438\n4602.458 -1.308\n4603.518 1.468\n4604.577 1.815\n4605.638 2.478\n4606.699 2.586\n4607.76 3.397\n4608.821 3.054\n4609.882 3.802\n4610.943 0.137\n4612.005 1.38\n4613.068 0.965\n4614.129 -0.553\n4615.192 1.218\n4616.255 -0.171\n4617.318 2.851\n4618.381 -0.069\n4619.445 -0.352\n4620.509 -3.197\n4621.573 1.15\n4622.637 1.757\n4623.702 0.724\n4624.766 0.322\n4625.832 0.971\n4626.897 1.447\n4627.962 1.412\n4629.028 1.495\n4630.094 3.081\n4631.161 0.121\n4632.227 -0.972\n4633.293 7.672\n4634.36 5.121\n4635.428 4.329\n4636.496 1.801\n4637.562 0.893\n4638.631 -0.522\n4639.699 2.466\n4640.768 -0.007\n4641.836 -0.412\n4642.905 1.091\n4643.974 2.233\n4645.044 0.364\n4646.114 -1.059\n4647.183 0.708\n4648.253 1.306\n4649.324 -4.804\n4650.395 0.571\n4651.465 4.964\n4652.537 2.346\n4653.608 1.733\n4654.68 -1.409\n4655.752 -0.509\n4656.824 1.683\n4657.896 1.773\n4658.969 1.156\n4660.042 2.537\n4661.114 0.89\n4662.188 1.986\n4663.262 1.31\n4664.335 2.254\n4665.41 3.097\n4666.484 1.154\n4667.559 -1.428\n4668.634 -2.592\n4669.708 -2.393\n4670.784 -2.315\n4671.86 -0.534\n4672.936 -0.591\n4674.012 0.494\n4675.088 -0.12\n4676.165 2.222\n4677.242 0.745\n4678.319 -2.181\n4679.396 2.905\n4680.474 0.966\n4681.551 1.945\n4682.629 3.177\n4683.708 -0.117\n4684.787 5.939\n4685.865 6.202\n4686.944 2.819\n4688.023 6.281\n4689.104 1.753\n4690.184 -1.009\n4691.264 1.203\n4692.344 0.337\n4693.424 1.784\n4694.505 -3.719\n4695.586 -2.464\n4696.667 -2.397\n4697.749 -0.841\n4698.831 -0.814\n4699.913 -2.371\n4700.995 -3.028\n4702.078 -0.917\n4703.161 -5.644\n4704.244 -0.059\n4705.327 0.369\n4706.411 -0.289\n4707.495 -1.107\n4708.578 1.172\n4709.663 2.053\n4710.747 0.55\n4711.832 -0.997\n4712.917 0.531\n4714.002 1.03\n4715.088 -2.167\n4716.174 -1.744\n4717.26 0.196\n4718.346 0.967\n4719.433 -0.957\n4720.52 0.723\n4721.606 -0.384\n4722.694 1.785\n4723.782 0.96\n4724.87 -1.789\n4725.957 -1.757\n4727.046 0.111\n4728.134 0.284\n4729.223 3.027\n4730.312 -4.128\n4731.402 1.272\n4732.491 -3.979\n4733.581 -3.621\n4734.671 1.088\n4735.762 -0.615\n4736.853 -0.86\n4737.942 -3.237\n4739.034 2.729\n4740.125 -0.316\n4741.216 -1.071\n4742.309 2.235\n4743.401 5.176\n4744.493 0.215\n4745.585 -1.344\n4746.679 0.415\n4747.771 -2.266\n4748.865 -2.505\n4749.958 -0.35\n4751.052 -1.152\n4752.147 -2.159\n4753.241 1.029\n4754.335 -1.01\n4755.431 -1.853\n4756.525 -2.189\n4757.621 -4.696\n4758.716 -1.666\n4759.812 1.245\n4760.908 0.706\n4762.004 1.998\n4763.101 -3.25\n4764.198 -3.893\n4765.295 -5.455\n4766.393 -1.238\n4767.49 -4.043\n4768.587 -4.46\n4769.686 -3.186\n4770.785 -1.291\n4771.883 1.636\n4772.982 -1.048\n4774.081 -2.772\n4775.181 0.965\n4776.28 -0.946\n4777.38 1.367\n4778.48 -0.727\n4779.581 -3.005\n4780.681 2.063\n4781.783 0.805\n4782.884 -0.52\n4783.985 0.285\n4785.087 -1.67\n4786.188 -2.15\n4787.291 -0.515\n4788.393 -1.247\n4789.497 0.34\n4790.599 3.958\n4791.702 -0.738\n4792.806 -0.652\n4793.91 1.642\n4795.013 0.725\n4796.118 1.596\n4797.222 2.303\n4798.327 4.527\n4799.432 0.454\n4800.537 -5.022\n4801.642 -1.78\n4802.748 1.701\n4803.854 -3.178\n4804.96 -0.187\n4806.067 2.05\n4807.174 -2.357\n4808.281 -1.714\n4809.388 -0.521\n4810.496 1.167\n4811.604 0.436\n4812.711 -0.075\n4813.819 2.745\n4814.928 1.071\n4816.037 3.433\n4817.146 4.72\n4818.255 6.613\n4819.365 6.619\n4820.475 4.309\n4821.585 3.71\n4822.695 3.416\n4823.805 6.356\n4824.916 3.168\n4826.028 4.389\n4827.139 6.513\n4828.25 6.668\n4829.363 5.294\n4830.475 2.875\n4831.587 7.068\n4832.7 7.873\n4833.812 6.217\n4834.926 7.356\n4836.039 7.551\n4837.152 10.122\n4838.267 10.257\n4839.381 8.121\n4840.496 9.398\n4841.61 10.001\n4842.725 7.203\n4843.84 11.422\n4844.956 12.426\n4846.071 11.009\n4847.188 11.696\n4848.304 11.818\n4849.42 15.916\n4850.537 14.838\n4851.653 15.866\n4852.771 18.49\n4853.889 15.597\n4855.006 14.215\n4856.125 16.355\n4857.243 15.354\n4858.361 14.795\n4859.48 21.71\n4860.599 20.251\n4861.718 26.362\n4862.838 32.545\n4863.958 34.956\n4865.078 31.034\n4866.198 22.091\n4867.319 17.645\n4868.44 16.196\n4869.561 13.399\n4870.683 17.611\n4871.804 13.098\n4872.926 15.44\n4874.048 13.014\n4875.17 15.402\n4876.293 14.598\n4877.417 15.44\n4878.539 12.718\n4879.663 16.148\n4880.787 16.231\n4881.91 16.103\n4883.034 15.514\n4884.159 13.382\n4885.284 14.174\n4886.409 13.452\n4887.534 10.62\n4888.66 9.968\n4889.786 11.136\n4890.911 13.203\n4892.038 6.747\n4893.165 6.438\n4894.291 9.283\n4895.418 7.848\n4896.545 11.767\n4897.673 12.055\n4898.801 9.395\n4899.929 8.574\n4901.058 5.946\n4902.186 5.129\n4903.315 9.071\n4904.444 7.33\n4905.574 6.84\n4906.704 6.856\n4907.833 6.675\n4908.964 7.431\n4910.094 2.062\n4911.225 8.269\n4912.355 8.017\n4913.487 5.59\n4914.618 6.262\n4915.75 5.71\n4916.882 4.002\n4918.015 6.783\n4919.147 4.239\n4920.28 1.609\n4921.413 0.699\n4922.546 0.461\n4923.68 4.249\n4924.813 5.598\n4925.947 2.944\n4927.082 4.052\n4928.217 7.203\n4929.352 4.818\n4930.487 3.125\n4931.623 4.198\n4932.758 5.949\n4933.894 3.617\n4935.03 2.8\n4936.167 3.934\n4937.303 2.701\n4938.44 5.99\n4939.578 2.685\n4940.715 3.388\n4941.853 3.689\n4942.991 0.009\n4944.129 1.377\n4945.268 2.864\n4946.406 3.129\n4947.545 3.297\n4948.685 1.387\n4949.825 3.87\n4950.964 0.667\n4952.104 1.608\n4953.245 2.463\n4954.385 4.046\n4955.527 5.297\n4956.667 7.822\n4957.81 17.655\n4958.951 29.602\n4960.093 49.751\n4961.235 60.094\n4962.377 49.4\n4963.52 27.867\n4964.664 11.378\n4965.806 6.369\n4966.951 3.965\n4968.094 1.355\n4969.238 1.177\n4970.383 1.756\n4971.527 2.091\n4972.672 5.839\n4973.817 2.972\n4974.962 -0.285\n4976.108 2.727\n4977.254 1.771\n4978.4 2.382\n4979.547 3.138\n4980.693 -1.381\n4981.841 -3.13\n4982.988 -0.905\n4984.135 1.196\n4985.283 -1.634\n4986.431 -0.123\n4987.58 0.679\n4988.728 0.735\n4989.876 3.978\n4991.026 1.268\n4992.175 -0.443\n4993.325 -0.952\n4994.475 0.81\n4995.625 -0.665\n4996.775 1.402\n4997.926 -1.263\n4999.077 3.807\n5000.228 4.772\n5001.379 5.694\n5002.532 9.678\n5003.683 19.115\n5004.835 34.998\n5005.988 58.197\n5007.141 96.829\n5008.294 160.137\n5009.447 177.573\n5010.601 128.659\n5011.754 59.709\n5012.909 23.014\n5014.063 12.35\n5015.218 5.366\n5016.373 4.67\n5017.528 2.011\n5018.683 -0.346\n5019.839 -1.196\n5020.995 -4.942\n5022.151 -1.204\n5023.308 -1.321\n5024.465 0.6\n5025.622 1.421\n5026.779 2.915\n5027.937 -1.431\n5029.094 -1.515\n5030.252 5.795\n5031.412 2.709\n5032.57 1.309\n5033.729 4.798\n5034.888 3.77\n5036.047 -2.491\n5037.208 -0.321\n5038.367 -1.641\n5039.528 -2.459\n5040.688 3.377\n5041.849 -0.6\n5043.009 -1.476\n5044.171 -2.093\n5045.333 1.372\n5046.495 0.49\n5047.657 -0.067\n5048.819 4.06\n5049.981 1.086\n5051.145 -1.206\n5052.308 -0.11\n5053.471 -1.925\n5054.635 -1.767\n5055.799 0.983\n5056.963 -0.481\n5058.128 -1.039\n5059.292 1.732\n5060.458 0.545\n5061.624 1.249\n5062.789 2.781\n5063.955 -0.934\n5065.121 -3.043\n5066.287 -2.827\n5067.454 -0.559\n5068.621 0.061\n5069.788 -2.078\n5070.956 -0.856\n5072.124 -1.047\n5073.291 -0.863\n5074.46 0.198\n5075.628 -1.275\n5076.797 0.243\n5077.966 0.141\n5079.136 -1.97\n5080.306 -2.567\n5081.475 -2.67\n5082.646 -0.894\n5083.815 -2.58\n5084.986 -3.087\n5086.158 -1.476\n5087.329 -0.817\n5088.5 -1.643\n5089.672 0.75\n5090.844 0.779\n5092.017 0.257\n5093.189 -1.886\n5094.362 -0.316\n5095.535 -1.882\n5096.709 0.769\n5097.882 0.954\n5099.057 -2.072\n5100.23 -1.679\n5101.405 -3.199\n5102.58 -3.214\n5103.755 -1.137\n5104.93 -0.2\n5106.106 -1.679\n5107.282 -1.703\n5108.458 -2.959\n5109.634 -1.485\n5110.811 -2.131\n5111.988 -0.195\n5113.165 1.735\n5114.343 1.643\n5115.52 1.157\n5116.699 -0.65\n5117.876 0.002\n5119.055 1.003\n5120.234 -0.935\n5121.413 1.739\n5122.593 1.19\n5123.772 0.781\n5124.953 3.261\n5126.132 -2.247\n5127.313 -0.656\n5128.494 -4.628\n5129.675 -0.81\n5130.855 0.403\n5132.038 1.185\n5133.219 -2.212\n5134.401 0.488\n5135.583 -2.935\n5136.766 -1.308\n5137.949 1.885\n5139.132 -0.684\n5140.316 -3.025\n5141.5 -2.482\n5142.684 -1.983\n5143.868 0.041\n5145.053 -1.569\n5146.237 0.818\n5147.422 2.608\n5148.607 -0.172\n5149.793 0.046\n5150.979 0.332\n5152.166 -0.074\n5153.352 0.481\n5154.539 -0.331\n5155.726 -0.147\n5156.913 -0.929\n5158.101 2.356\n5159.289 0.503\n5160.477 -0.391\n5161.665 2.569\n5162.854 -0.709\n5164.042 -0.86\n5165.232 2.63\n5166.421 0.343\n5167.611 -4.387\n5168.801 -3.737\n5169.991 -2.763\n5171.182 -2.904\n5172.373 -2.066\n5173.563 -1.27\n5174.755 0.027\n5175.947 -2.876\n5177.139 0.331\n5178.331 1.438\n5179.524 4.164\n5180.716 -0.381\n5181.909 4.686\n5183.103 2.224\n5184.296 -3.361\n5185.49 -0.106\n5186.684 0.593\n5187.878 2.04\n5189.073 2.425\n5190.269 -0.057\n5191.463 3.579\n5192.659 -0.915\n5193.855 -0.582\n5195.051 0.227\n5196.247 1.963\n5197.444 0.022\n5198.641 -0.283\n5199.838 2.106\n5201.036 7.456\n5202.233 4.855\n5203.431 3.409\n5204.629 1.685\n5205.828 1.639\n5207.027 -0.997\n5208.226 -2.105\n5209.425 1.343\n5210.625 -0.679\n5211.825 -2.442\n5213.025 3.581\n5214.226 2.174\n5215.426 -1.161\n5216.627 0.464\n5217.829 -0.431\n5219.031 1.061\n5220.232 -1.165\n5221.435 0.735\n5222.636 3.443\n5223.839 -0.035\n5225.042 1.545\n5226.246 -1.455\n5227.449 -1.206\n5228.653 -1.71\n5229.857 -2.132\n5231.062 0.565\n5232.266 0.707\n5233.471 -2.213\n5234.676 1.576\n5235.881 0.042\n5237.087 1.359\n5238.293 0.322\n5239.5 -0.431\n5240.706 3.972\n5241.913 2.639\n5243.12 1.687\n5244.328 -1.99\n5245.535 0.071\n5246.744 2.203\n5247.951 0.468\n5249.16 0.369\n5250.369 -1.078\n5251.578 0.985\n5252.787 1.679\n5253.997 0.724\n5255.207 -0.997\n5256.417 1.985\n5257.627 1.877\n5258.839 3.442\n5260.049 6.304\n5261.261 3.559\n5262.472 4.361\n5263.684 1.064\n5264.896 -0.002\n5266.108 -0.862\n5267.321 -2.982\n5268.534 3.633\n5269.748 -2.421\n5270.96 -1.115\n5272.175 -1.306\n5273.389 0.305\n5274.603 0.834\n5275.818 0.379\n5277.033 1.088\n5278.248 3.008\n5279.463 3.174\n5280.679 2.699\n5281.896 3.782\n5283.112 1.101\n5284.329 -0.468\n5285.545 -1.773\n5286.763 1.154\n5287.98 3.309\n5289.198 2.445\n5290.416 3.148\n5291.634 3.822\n5292.853 5.029\n5294.072 2.596\n5295.291 4.992\n5296.51 2.54\n5297.73 4.077\n5298.95 3.974\n5300.17 0.901\n5301.391 -0.407\n5302.611 -1.078\n5303.833 5.145\n5305.054 3.473\n5306.276 1.024\n5307.498 1.247\n5308.72 7.255\n5309.942 0.752\n5311.166 3.764\n5312.388 3.865\n5313.612 1.315\n5314.835 4.604\n5316.059 2.655\n5317.283 2.828\n5318.508 -1.319\n5319.733 -1.143\n5320.958 0.462\n5322.183 -1.037\n5323.409 1.765\n5324.634 1.771\n5325.861 -1.009\n5327.087 -0.489\n5328.314 -4.232\n5329.541 -2.789\n5330.769 -2.599\n5331.996 -0.235\n5333.224 -0.857\n5334.452 0.725\n5335.68 0.963\n5336.909 4.745\n5338.138 5.193\n5339.368 0.892\n5340.597 0.442\n5341.827 -0.842\n5343.057 0.591\n5344.288 1.88\n5345.518 -0.22\n5346.749 -0.925\n5347.98 2.196\n5349.212 1.17\n5350.444 -1.046\n5351.676 23.226\n5352.909 8.941\n5354.141 -8.754\n5355.374 -8.656\n5356.607 1.754\n5357.84 0.158\n5359.075 3.259\n5360.309 1.205\n5361.543 1.089\n5362.778 -0.116\n5364.013 1.017\n5365.248 1.774\n5366.484 0.248\n5367.719 -0.461\n5368.956 -0.805\n5370.192 -0.543\n5371.429 -1.944\n5372.666 -1.278\n5373.903 -0.397\n5375.141 -1.025\n5376.378 -2.137\n5377.616 0.302\n5378.854 1.172\n5380.094 1.966\n5381.332 -2.692\n5382.572 0.775\n5383.811 -0.842\n5385.051 1.861\n5386.291 -1.897\n5387.531 -0.595\n5388.772 -2.576\n5390.013 2.165\n5391.254 -0.242\n5392.496 -3.684\n5393.737 1.569\n5394.979 -1.339\n5396.222 -2.779\n5397.465 -0.956\n5398.708 0.438\n5399.951 -1.206\n5401.194 -3.036\n5402.438 2.15\n5403.683 -0.451\n5404.927 -0.864\n5406.172 -2.194\n5407.417 -4.412\n5408.661 -3.026\n5409.907 -3.125\n5411.153 -4.218\n5412.399 -1.197\n5413.646 -4.823\n5414.892 -1.215\n5416.139 0.331\n5417.386 -1.684\n5418.634 -0.033\n5419.882 0.009\n5421.129 -0.088\n5422.378 -0.113\n5423.627 -2.775\n5424.876 -1.287\n5426.125 -3.798\n5427.375 2.072\n5428.625 -1.444\n5429.875 1.797\n5431.125 1.114\n5432.376 -3.479\n5433.627 0.29\n5434.878 -4.404\n5436.13 -0.147\n5437.381 -4.033\n5438.634 -2.183\n5439.886 -1.695\n5441.139 0.642\n5442.392 0.901\n5443.645 1.07\n5444.899 0.096\n5446.153 -2.022\n5447.407 0.763\n5448.661 -2.118\n5449.916 -1.872\n5451.171 -1.925\n5452.427 -0.679\n5453.682 -2.312\n5454.938 -2.648\n5456.194 -6.164\n5457.45 -2.442\n5458.708 -2.574\n5459.964 -0.572\n5461.222 2.446\n5462.479 -0.009\n5463.737 1.756\n5464.996 0.257\n5466.253 -1.51\n5467.513 0.276\n5468.771 0.427\n5470.031 -1.611\n5471.291 -1.037\n5472.55 0.279\n5473.812 -2.833\n5475.072 -1.552\n5476.332 -1.03\n5477.594 0.765\n5478.855 -1.617\n5480.117 0.475\n5481.378 -1.143\n5482.641 -0.186\n5483.904 0.328\n5485.167 -2.261\n5486.429 -0.848\n5487.693 -2.987\n5488.957 -0.475\n5490.221 -2.753\n5491.485 -0.334\n5492.75 -1.424\n5494.015 -3.2\n5495.28 4.043\n5496.545 0.011\n5497.811 -2.514\n5499.077 -2.046\n5500.343 -3.538\n5501.61 -3.038\n5502.877 -0.008\n5504.144 -1.961\n5505.412 -1.219\n5506.68 -0.531\n5507.948 -2.835\n5509.216 -2.648\n5510.485 -1.17\n5511.753 -1.552\n5513.023 0.828\n5514.292 -4.392\n5515.562 0.296\n5516.833 -0.326\n5518.103 -0.842\n5519.374 -1.404\n5520.645 4.019\n5521.916 -0.562\n5523.188 -2.211\n5524.46 0.355\n5525.731 -2.323\n5527.005 -5.125\n5528.277 0.201\n5529.55 -1.829\n5530.824 -0.405\n5532.097 0.405\n5533.371 0.136\n5534.646 0.437\n5535.92 -4.218\n5537.195 -2.476\n5538.47 -1.844\n5539.745 -2.203\n5541.021 -1.217\n5542.297 -1.429\n5543.574 -1.207\n5544.85 -0.892\n5546.127 4.187\n5547.404 -0.151\n5548.682 -1.523\n5549.96 0.834\n5551.237 0.415\n5552.516 0.323\n5553.794 0.572\n5555.073 -0.506\n5556.353 -1.873\n5557.632 -1.293\n5558.912 0.607\n5560.193 2.797\n5561.473 -3.505\n5562.753 -2.521\n5564.035 -2.5\n5565.316 2.381\n5566.597 0.409\n5567.879 -2.704\n5569.161 -2.022\n5570.444 -0.274\n5571.727 0.116\n5573.01 1.354\n5574.293 -1.917\n5575.577 0.376\n5576.861 1.225\n5578.145 -0.255\n5579.43 1.952\n5580.714 1.411\n5582.0 -1.277\n5583.285 -1.568\n5584.571 -1.923\n5585.857 -2.461\n5587.143 -1.771\n5588.43 -2.462\n5589.717 -3.822\n5591.004 -2.603\n5592.292 -1.136\n5593.579 -2.538\n5594.868 -1.374\n5596.156 0.863\n5597.445 -0.418\n5598.733 -1.277\n5600.023 -0.746\n5601.312 -0.723\n5602.603 -0.8\n5603.893 -1.472\n5605.183 -2.851\n5606.474 -1.988\n5607.765 0.242\n5609.057 1.133\n5610.348 -0.292\n5611.641 -2.24\n5612.933 -1.872\n5614.225 -0.329\n5615.518 -2.911\n5616.812 -1.296\n5618.104 -1.456\n5619.398 0.915\n5620.692 -1.324\n5621.987 -2.438\n5623.281 -1.362\n5624.576 -0.801\n5625.872 -2.192\n5627.167 -4.879\n5628.463 -4.076\n5629.759 -0.411\n5631.055 -4.477\n5632.353 -1.24\n5633.649 0.03\n5634.947 1.655\n5636.245 -1.031\n5637.542 -2.927\n5638.841 -1.525\n5640.139 -1.765\n5641.438 -3.479\n5642.737 -3.114\n5644.037 -0.622\n5645.336 -1.892\n5646.636 -2.378\n5647.937 -3.613\n5649.238 -1.818\n5650.538 -3.565\n5651.839 -3.021\n5653.141 -4.887\n5654.443 -6.891\n5655.745 -4.262\n5657.047 -4.244\n5658.35 -1.777\n5659.653 -4.129\n5660.957 -4.573\n5662.26 -5.944\n5663.564 -4.68\n5664.868 -3.206\n5666.173 -3.542\n5667.478 -2.385\n5668.782 -3.392\n5670.088 -3.634\n5671.394 0.079\n5672.7 -4.266\n5674.006 -2.189\n5675.313 0.25\n5676.62 -1.444\n5677.927 -0.555\n5679.234 -0.398\n5680.542 -2.24\n5681.851 -5.932\n5683.159 -4.022\n5684.468 -1.205\n5685.777 -1.229\n5687.086 -0.723\n5688.396 -1.302\n5689.706 -0.117\n5691.016 -1.703\n5692.327 -2.396\n5693.637 0.021\n5694.949 -0.342\n5696.26 -0.303\n5697.572 -0.3\n5698.883 -1.586\n5700.197 -3.971\n5701.509 -4.46\n5702.822 -1.578\n5704.135 -0.631\n5705.449 -4.27\n5706.763 -2.906\n5708.076 -2.134\n5709.392 -5.276\n5710.706 -0.586\n5712.021 -1.56\n5713.336 -3.198\n5714.652 1.066\n5715.969 -1.006\n5717.284 -1.215\n5718.601 2.277\n5719.918 -0.101\n5721.235 1.76\n5722.553 6.784\n5723.871 4.355\n5725.189 2.137\n5726.507 1.511\n5727.825 -0.505\n5729.145 -1.765\n5730.464 0.752\n5731.784 1.112\n5733.104 0.51\n5734.424 -0.539\n5735.745 -1.501\n5737.066 0.939\n5738.387 -2.216\n5739.708 2.442\n5741.03 2.259\n5742.352 1.535\n5743.674 -0.8\n5744.997 -0.279\n5746.32 -0.738\n5747.644 -3.308\n5748.967 0.036\n5750.291 -0.103\n5751.615 -1.476\n5752.939 1.817\n5754.265 -2.543\n5755.589 2.112\n5756.915 -0.031\n5758.241 -0.893\n5759.567 0.95\n5760.893 0.759\n5762.22 0.866\n5763.547 -0.969\n5764.874 -2.57\n5766.202 -1.117\n5767.529 -1.583\n5768.858 -1.154\n5770.186 -1.827\n5771.515 -1.279\n5772.844 -0.037\n5774.173 -1.357\n5775.503 -0.89\n5776.833 0.097\n5778.163 -2.285\n5779.494 -3.103\n5780.825 -1.665\n5782.156 -4.194\n5783.488 -0.922\n5784.819 -5.302\n5786.151 -3.6\n5787.484 -2.941\n5788.817 -2.83\n5790.15 -1.464\n5791.483 -0.358\n5792.817 0.073\n5794.151 0.629\n5795.485 -1.731\n5796.819 0.102\n5798.155 1.656\n5799.49 0.189\n5800.826 3.725\n5802.162 -0.96\n5803.498 0.219\n5804.834 -0.01\n5806.171 1.173\n5807.508 -0.923\n5808.845 -0.848\n5810.183 1.732\n5811.521 0.029\n5812.859 -2.018\n5814.198 -0.246\n5815.537 -0.628\n5816.876 1.343\n5818.216 0.387\n5819.556 4.49\n5820.896 1.163\n5822.236 2.254\n5823.577 2.183\n5824.918 -0.285\n5826.259 -1.787\n5827.601 -1.818\n5828.943 -0.601\n5830.286 1.942\n5831.628 -2.053\n5832.971 0.933\n5834.314 1.874\n5835.658 3.015\n5837.002 2.957\n5838.346 2.552\n5839.69 2.458\n5841.035 1.041\n5842.38 1.461\n5843.726 1.921\n5845.071 -0.299\n5846.417 1.504\n5847.764 2.332\n5849.11 0.72\n5850.458 -0.238\n5851.804 1.39\n5853.152 2.418\n5854.5 2.572\n5855.848 0.417\n5857.197 2.245\n5858.546 4.694\n5859.895 2.367\n5861.244 0.495\n5862.594 0.465\n5863.944 1.285\n5865.294 3.666\n5866.646 1.916\n5867.996 5.253\n5869.347 2.918\n5870.699 2.281\n5872.051 4.038\n5873.403 2.541\n5874.755 5.344\n5876.109 7.804\n5877.461 5.415\n5878.815 6.092\n5880.169 6.278\n5881.523 4.783\n5882.877 2.377\n5884.232 2.384\n5885.587 2.65\n5886.943 2.963\n5888.299 -0.382\n5889.655 0.34\n5891.011 0.03\n5892.367 0.818\n5893.724 0.821\n5895.082 -1.574\n5896.439 -0.494\n5897.797 1.874\n5899.155 0.481\n5900.514 0.106\n5901.872 -0.725\n5903.231 -0.599\n5904.591 2.561\n5905.951 1.134\n5907.31 -0.814\n5908.671 1.986\n5910.031 3.129\n5911.393 1.647\n5912.754 3.713\n5914.116 2.36\n5915.478 -0.257\n5916.84 2.134\n5918.202 3.162\n5919.565 1.86\n5920.928 1.093\n5922.292 2.87\n5923.656 3.845\n5925.02 0.952\n5926.384 0.896\n5927.749 -0.249\n5929.114 1.71\n5930.48 1.886\n5931.845 -1.084\n5933.211 -0.031\n5934.577 0.926\n5935.944 2.174\n5937.312 0.511\n5938.679 0.774\n5940.046 1.689\n5941.414 0.512\n5942.782 2.2\n5944.15 2.4\n5945.519 -0.844\n5946.889 0.597\n5948.258 1.277\n5949.628 3.681\n5950.998 3.288\n5952.368 1.128\n5953.739 1.81\n5955.11 -0.661\n5956.482 0.384\n5957.854 -0.518\n5959.226 -1.442\n5960.598 -2.347\n5961.97 0.075\n5963.343 -0.433\n5964.717 -2.492\n5966.09 -1.563\n5967.464 -0.395\n5968.838 -0.33\n5970.213 -1.207\n5971.588 0.24\n5972.963 -0.55\n5974.338 -1.074\n5975.714 2.003\n5977.09 -1.886\n5978.467 -1.961\n5979.843 -2.037\n5981.221 1.689\n5982.598 -0.433\n5983.976 -0.289\n5985.354 -1.602\n5986.732 -3.262\n5988.111 -1.106\n5989.49 1.791\n5990.869 0.242\n5992.249 -1.784\n5993.628 0.667\n5995.009 -0.036\n5996.389 0.938\n5997.771 0.832\n5999.151 -2.251\n6000.533 -1.763\n6001.915 -0.388\n"},{"className":"Pix2Sky_Mercator","col":0,"comment":"\n    Mercator - pixel to sky.\n\n    Corresponds to the ``MER`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= x \\\\\n        \\theta &= 2 \\tan^{-1}\\left(e^{y \\pi / 180^{\\circ}}\\right)-90^{\\circ}\n    ","endLoc":807,"id":13349,"nodeType":"Class","startLoc":798,"text":"class Pix2Sky_Mercator(Pix2SkyProjection, Cylindrical):\n    r\"\"\"\n    Mercator - pixel to sky.\n\n    Corresponds to the ``MER`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= x \\\\\n        \\theta &= 2 \\tan^{-1}\\left(e^{y \\pi / 180^{\\circ}}\\right)-90^{\\circ}\n    \"\"\""},{"id":13350,"name":"astropy/constants","nodeType":"Package"},{"fileName":"si.py","filePath":"astropy/constants","id":13351,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nAstronomical and physics constants in SI units.  See :mod:`astropy.constants`\nfor a complete listing of constants defined in Astropy.\n\"\"\"\nimport itertools\n\nfrom .config import codata, iaudata\nfrom .constant import Constant\n\nfor _nm, _c in itertools.chain(sorted(vars(codata).items()),\n                               sorted(vars(iaudata).items())):\n    if (isinstance(_c, Constant) and _c.abbrev not in locals()\n            and _c.system == 'si'):\n        locals()[_c.abbrev] = _c\n"},{"col":4,"comment":"Two dimensional Plane model function","endLoc":1415,"header":"@staticmethod\n    def evaluate(x, y, slope_x, slope_y, intercept)","id":13352,"name":"evaluate","nodeType":"Function","startLoc":1411,"text":"@staticmethod\n    def evaluate(x, y, slope_x, slope_y, intercept):\n        \"\"\"Two dimensional Plane model function\"\"\"\n\n        return slope_x * x + slope_y * y + intercept"},{"col":4,"comment":"Two dimensional Plane model derivative with respect to parameters","endLoc":1424,"header":"@staticmethod\n    def fit_deriv(x, y, *params)","id":13353,"name":"fit_deriv","nodeType":"Function","startLoc":1417,"text":"@staticmethod\n    def fit_deriv(x, y, *params):\n        \"\"\"Two dimensional Plane model derivative with respect to parameters\"\"\"\n\n        d_slope_x = x\n        d_slope_y = y\n        d_intercept = np.ones_like(x)\n        return [d_slope_x, d_slope_y, d_intercept]"},{"attributeType":"null","col":4,"comment":"null","endLoc":2834,"id":13354,"name":"x_0","nodeType":"Attribute","startLoc":2834,"text":"x_0"},{"className":"Sky2Pix_Mercator","col":0,"comment":"\n    Mercator - sky to pixel.\n\n    Corresponds to the ``MER`` projection in FITS WCS.\n\n    .. math::\n        x &= \\phi \\\\\n        y &= \\frac{180^{\\circ}}{\\pi}\\ln \\tan \\left(\\frac{90^{\\circ} + \\theta}{2}\\right)\n    ","endLoc":819,"id":13355,"nodeType":"Class","startLoc":810,"text":"class Sky2Pix_Mercator(Sky2PixProjection, Cylindrical):\n    r\"\"\"\n    Mercator - sky to pixel.\n\n    Corresponds to the ``MER`` projection in FITS WCS.\n\n    .. math::\n        x &= \\phi \\\\\n        y &= \\frac{180^{\\circ}}{\\pi}\\ln \\tan \\left(\\frac{90^{\\circ} + \\theta}{2}\\right)\n    \"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":2835,"id":13356,"name":"gamma","nodeType":"Attribute","startLoc":2835,"text":"gamma"},{"className":"PseudoCylindrical","col":0,"comment":"Base class for pseudocylindrical projections.\n\n    Pseudocylindrical projections are like cylindrical projections\n    except the parallels of latitude are projected at diminishing\n    lengths toward the polar regions in order to reduce lateral\n    distortion there.  Consequently, the meridians are curved.\n    ","endLoc":830,"id":13357,"nodeType":"Class","startLoc":822,"text":"class PseudoCylindrical(Projection):\n    r\"\"\"Base class for pseudocylindrical projections.\n\n    Pseudocylindrical projections are like cylindrical projections\n    except the parallels of latitude are projected at diminishing\n    lengths toward the polar regions in order to reduce lateral\n    distortion there.  Consequently, the meridians are curved.\n    \"\"\"\n    _separable = True"},{"attributeType":"null","col":4,"comment":"null","endLoc":830,"id":13358,"name":"_separable","nodeType":"Attribute","startLoc":830,"text":"_separable"},{"className":"Pix2Sky_SansonFlamsteed","col":0,"comment":"\n    Sanson-Flamsteed projection - pixel to sky.\n\n    Corresponds to the ``SFL`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= \\frac{x}{\\cos y} \\\\\n        \\theta &= y\n    ","endLoc":842,"id":13359,"nodeType":"Class","startLoc":833,"text":"class Pix2Sky_SansonFlamsteed(Pix2SkyProjection, PseudoCylindrical):\n    r\"\"\"\n    Sanson-Flamsteed projection - pixel to sky.\n\n    Corresponds to the ``SFL`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= \\frac{x}{\\cos y} \\\\\n        \\theta &= y\n    \"\"\""},{"className":"Sky2Pix_SansonFlamsteed","col":0,"comment":"\n    Sanson-Flamsteed projection - sky to pixel.\n\n    Corresponds to the ``SFL`` projection in FITS WCS.\n\n    .. math::\n        x &= \\phi \\cos \\theta \\\\\n        y &= \\theta\n    ","endLoc":854,"id":13360,"nodeType":"Class","startLoc":845,"text":"class Sky2Pix_SansonFlamsteed(Sky2PixProjection, PseudoCylindrical):\n    r\"\"\"\n    Sanson-Flamsteed projection - sky to pixel.\n\n    Corresponds to the ``SFL`` projection in FITS WCS.\n\n    .. math::\n        x &= \\phi \\cos \\theta \\\\\n        y &= \\theta\n    \"\"\""},{"className":"Pix2Sky_Parabolic","col":0,"comment":"\n    Parabolic projection - pixel to sky.\n\n    Corresponds to the ``PAR`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= \\frac{180^\\circ}{\\pi} \\frac{x}{1 - 4(y / 180^\\circ)^2} \\\\\n        \\theta &= 3 \\sin^{-1}\\left(\\frac{y}{180^\\circ}\\right)\n    ","endLoc":866,"id":13361,"nodeType":"Class","startLoc":857,"text":"class Pix2Sky_Parabolic(Pix2SkyProjection, PseudoCylindrical):\n    r\"\"\"\n    Parabolic projection - pixel to sky.\n\n    Corresponds to the ``PAR`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= \\frac{180^\\circ}{\\pi} \\frac{x}{1 - 4(y / 180^\\circ)^2} \\\\\n        \\theta &= 3 \\sin^{-1}\\left(\\frac{y}{180^\\circ}\\right)\n    \"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":2836,"id":13362,"name":"alpha","nodeType":"Attribute","startLoc":2836,"text":"alpha"},{"className":"Sky2Pix_Parabolic","col":0,"comment":"\n    Parabolic projection - sky to pixel.\n\n    Corresponds to the ``PAR`` projection in FITS WCS.\n\n    .. math::\n        x &= \\phi \\left(2\\cos\\frac{2\\theta}{3} - 1\\right) \\\\\n        y &= 180^\\circ \\sin \\frac{\\theta}{3}\n    ","endLoc":878,"id":13363,"nodeType":"Class","startLoc":869,"text":"class Sky2Pix_Parabolic(Sky2PixProjection, PseudoCylindrical):\n    r\"\"\"\n    Parabolic projection - sky to pixel.\n\n    Corresponds to the ``PAR`` projection in FITS WCS.\n\n    .. math::\n        x &= \\phi \\left(2\\cos\\frac{2\\theta}{3} - 1\\right) \\\\\n        y &= 180^\\circ \\sin \\frac{\\theta}{3}\n    \"\"\""},{"className":"Pix2Sky_Molleweide","col":0,"comment":"\n    Molleweide's projection - pixel to sky.\n\n    Corresponds to the ``MOL`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= \\frac{\\pi x}{2 \\sqrt{2 - \\left(\\frac{\\pi}{180^\\circ}y\\right)^2}} \\\\\n        \\theta &= \\sin^{-1}\\left(\\frac{1}{90^\\circ}\\sin^{-1}\\left(\\frac{\\pi}{180^\\circ}\\frac{y}{\\sqrt{2}}\\right) + \\frac{y}{180^\\circ}\\sqrt{2 - \\left(\\frac{\\pi}{180^\\circ}y\\right)^2}\\right)\n    ","endLoc":890,"id":13364,"nodeType":"Class","startLoc":881,"text":"class Pix2Sky_Molleweide(Pix2SkyProjection, PseudoCylindrical):\n    r\"\"\"\n    Molleweide's projection - pixel to sky.\n\n    Corresponds to the ``MOL`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= \\frac{\\pi x}{2 \\sqrt{2 - \\left(\\frac{\\pi}{180^\\circ}y\\right)^2}} \\\\\n        \\theta &= \\sin^{-1}\\left(\\frac{1}{90^\\circ}\\sin^{-1}\\left(\\frac{\\pi}{180^\\circ}\\frac{y}{\\sqrt{2}}\\right) + \\frac{y}{180^\\circ}\\sqrt{2 - \\left(\\frac{\\pi}{180^\\circ}y\\right)^2}\\right)\n    \"\"\""},{"className":"Sky2Pix_Molleweide","col":0,"comment":"\n    Molleweide's projection - sky to pixel.\n\n    Corresponds to the ``MOL`` projection in FITS WCS.\n\n    .. math::\n        x &= \\frac{2 \\sqrt{2}}{\\pi} \\phi \\cos \\gamma \\\\\n        y &= \\sqrt{2} \\frac{180^\\circ}{\\pi} \\sin \\gamma\n\n    where :math:`\\gamma` is defined as the solution of the\n    transcendental equation:\n\n    .. math::\n\n        \\sin \\theta = \\frac{\\gamma}{90^\\circ} + \\frac{\\sin 2 \\gamma}{\\pi}\n    ","endLoc":909,"id":13365,"nodeType":"Class","startLoc":893,"text":"class Sky2Pix_Molleweide(Sky2PixProjection, PseudoCylindrical):\n    r\"\"\"\n    Molleweide's projection - sky to pixel.\n\n    Corresponds to the ``MOL`` projection in FITS WCS.\n\n    .. math::\n        x &= \\frac{2 \\sqrt{2}}{\\pi} \\phi \\cos \\gamma \\\\\n        y &= \\sqrt{2} \\frac{180^\\circ}{\\pi} \\sin \\gamma\n\n    where :math:`\\gamma` is defined as the solution of the\n    transcendental equation:\n\n    .. math::\n\n        \\sin \\theta = \\frac{\\gamma}{90^\\circ} + \\frac{\\sin 2 \\gamma}{\\pi}\n    \"\"\""},{"className":"Pix2Sky_HammerAitoff","col":0,"comment":"\n    Hammer-Aitoff projection - pixel to sky.\n\n    Corresponds to the ``AIT`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= 2 \\arg \\left(2Z^2 - 1, \\frac{\\pi}{180^\\circ} \\frac{Z}{2}x\\right) \\\\\n        \\theta &= \\sin^{-1}\\left(\\frac{\\pi}{180^\\circ}yZ\\right)\n    ","endLoc":921,"id":13366,"nodeType":"Class","startLoc":912,"text":"class Pix2Sky_HammerAitoff(Pix2SkyProjection, PseudoCylindrical):\n    r\"\"\"\n    Hammer-Aitoff projection - pixel to sky.\n\n    Corresponds to the ``AIT`` projection in FITS WCS.\n\n    .. math::\n        \\phi &= 2 \\arg \\left(2Z^2 - 1, \\frac{\\pi}{180^\\circ} \\frac{Z}{2}x\\right) \\\\\n        \\theta &= \\sin^{-1}\\left(\\frac{\\pi}{180^\\circ}yZ\\right)\n    \"\"\""},{"className":"Sky2Pix_HammerAitoff","col":0,"comment":"\n    Hammer-Aitoff projection - sky to pixel.\n\n    Corresponds to the ``AIT`` projection in FITS WCS.\n\n    .. math::\n        x &= 2 \\gamma \\cos \\theta \\sin \\frac{\\phi}{2} \\\\\n        y &= \\gamma \\sin \\theta\n\n    where:\n\n    .. math::\n        \\gamma = \\frac{180^\\circ}{\\pi} \\sqrt{\\frac{2}{1 + \\cos \\theta \\cos(\\phi / 2)}}\n    ","endLoc":938,"id":13367,"nodeType":"Class","startLoc":924,"text":"class Sky2Pix_HammerAitoff(Sky2PixProjection, PseudoCylindrical):\n    r\"\"\"\n    Hammer-Aitoff projection - sky to pixel.\n\n    Corresponds to the ``AIT`` projection in FITS WCS.\n\n    .. math::\n        x &= 2 \\gamma \\cos \\theta \\sin \\frac{\\phi}{2} \\\\\n        y &= \\gamma \\sin \\theta\n\n    where:\n\n    .. math::\n        \\gamma = \\frac{180^\\circ}{\\pi} \\sqrt{\\frac{2}{1 + \\cos \\theta \\cos(\\phi / 2)}}\n    \"\"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":13368,"name":"codata","nodeType":"Attribute","startLoc":14,"text":"codata"},{"className":"Const2D","col":0,"comment":"\n    Two dimensional Constant model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Value of the constant function\n\n    See Also\n    --------\n    Const1D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x, y) = A\n    ","endLoc":1840,"id":13369,"nodeType":"Class","startLoc":1795,"text":"class Const2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional Constant model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Value of the constant function\n\n    See Also\n    --------\n    Const1D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x, y) = A\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Value of the constant function\")\n    linear = True\n\n    @staticmethod\n    def evaluate(x, y, amplitude):\n        \"\"\"Two dimensional Constant model function\"\"\"\n\n        if amplitude.size == 1:\n            # This is slightly faster than using ones_like and multiplying\n            x = np.empty_like(x, subok=False)\n            x.fill(amplitude.item())\n        else:\n            # This case is less likely but could occur if the amplitude\n            # parameter is given an array-like value\n            x = amplitude * np.ones_like(x, subok=False)\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(x, unit=amplitude.unit, copy=False)\n        return x\n\n    @property\n    def input_units(self):\n        return None\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'amplitude': outputs_unit[self.outputs[0]]}"},{"className":"Conic","col":0,"comment":"Base class for conic projections.\n\n    In conic projections, the sphere is thought to be projected onto\n    the surface of a cone which is then opened out.\n\n    In a general sense, the pixel-to-sky transformation is defined as:\n\n    .. math::\n\n        \\phi &= \\arg\\left(\\frac{Y_0 - y}{R_\\theta}, \\frac{x}{R_\\theta}\\right) / C \\\\\n        R_\\theta &= \\mathrm{sign} \\theta_a \\sqrt{x^2 + (Y_0 - y)^2}\n\n    and the inverse (sky-to-pixel) is defined as:\n\n    .. math::\n        x &= R_\\theta \\sin (C \\phi) \\\\\n        y &= R_\\theta \\cos (C \\phi) + Y_0\n\n    where :math:`C` is the \"constant of the cone\":\n\n    .. math::\n        C = \\frac{180^\\circ \\cos \\theta}{\\pi R_\\theta}\n    ","endLoc":966,"id":13370,"nodeType":"Class","startLoc":941,"text":"class Conic(Projection):\n    r\"\"\"Base class for conic projections.\n\n    In conic projections, the sphere is thought to be projected onto\n    the surface of a cone which is then opened out.\n\n    In a general sense, the pixel-to-sky transformation is defined as:\n\n    .. math::\n\n        \\phi &= \\arg\\left(\\frac{Y_0 - y}{R_\\theta}, \\frac{x}{R_\\theta}\\right) / C \\\\\n        R_\\theta &= \\mathrm{sign} \\theta_a \\sqrt{x^2 + (Y_0 - y)^2}\n\n    and the inverse (sky-to-pixel) is defined as:\n\n    .. math::\n        x &= R_\\theta \\sin (C \\phi) \\\\\n        y &= R_\\theta \\cos (C \\phi) + Y_0\n\n    where :math:`C` is the \"constant of the cone\":\n\n    .. math::\n        C = \\frac{180^\\circ \\cos \\theta}{\\pi R_\\theta}\n    \"\"\"\n    sigma = _ParameterDS(default=90.0, getter=_to_orig_unit, setter=_to_radian)\n    delta = _ParameterDS(default=0.0, getter=_to_orig_unit, setter=_to_radian)"},{"col":4,"comment":"Two dimensional Constant model function","endLoc":1833,"header":"@staticmethod\n    def evaluate(x, y, amplitude)","id":13371,"name":"evaluate","nodeType":"Function","startLoc":1818,"text":"@staticmethod\n    def evaluate(x, y, amplitude):\n        \"\"\"Two dimensional Constant model function\"\"\"\n\n        if amplitude.size == 1:\n            # This is slightly faster than using ones_like and multiplying\n            x = np.empty_like(x, subok=False)\n            x.fill(amplitude.item())\n        else:\n            # This case is less likely but could occur if the amplitude\n            # parameter is given an array-like value\n            x = amplitude * np.ones_like(x, subok=False)\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(x, unit=amplitude.unit, copy=False)\n        return x"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":965,"id":13372,"name":"sigma","nodeType":"Attribute","startLoc":965,"text":"sigma"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":13373,"name":"iaudata","nodeType":"Attribute","startLoc":15,"text":"iaudata"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":966,"id":13374,"name":"delta","nodeType":"Attribute","startLoc":966,"text":"delta"},{"className":"Constant","col":0,"comment":"A physical or astronomical constant.\n\n    These objects are quantities that are meant to represent physical\n    constants.\n    ","endLoc":218,"id":13375,"nodeType":"Class","startLoc":77,"text":"class Constant(Quantity, metaclass=ConstantMeta):\n    \"\"\"A physical or astronomical constant.\n\n    These objects are quantities that are meant to represent physical\n    constants.\n    \"\"\"\n    _registry = {}\n    _has_incompatible_units = set()\n\n    def __new__(cls, abbrev, name, value, unit, uncertainty,\n                reference=None, system=None):\n        if reference is None:\n            reference = getattr(cls, 'default_reference', None)\n            if reference is None:\n                raise TypeError(f\"{cls} requires a reference.\")\n        name_lower = name.lower()\n        instances = cls._registry.setdefault(name_lower, {})\n        # By-pass Quantity initialization, since units may not yet be\n        # initialized here, and we store the unit in string form.\n        inst = np.array(value).view(cls)\n\n        if system in instances:\n                warnings.warn('Constant {!r} already has a definition in the '\n                              '{!r} system from {!r} reference'.format(\n                              name, system, reference), AstropyUserWarning)\n        for c in instances.values():\n            if system is not None and not hasattr(c.__class__, system):\n                setattr(c, system, inst)\n            if c.system is not None and not hasattr(inst.__class__, c.system):\n                setattr(inst, c.system, c)\n\n        instances[system] = inst\n\n        inst._abbrev = abbrev\n        inst._name = name\n        inst._value = value\n        inst._unit_string = unit\n        inst._uncertainty = uncertainty\n        inst._reference = reference\n        inst._system = system\n\n        inst._checked_units = False\n        return inst\n\n    def __repr__(self):\n        return ('<{} name={!r} value={} uncertainty={} unit={!r} '\n                'reference={!r}>'.format(self.__class__, self.name, self.value,\n                                          self.uncertainty, str(self.unit),\n                                          self.reference))\n\n    def __str__(self):\n        return ('  Name   = {}\\n'\n                '  Value  = {}\\n'\n                '  Uncertainty  = {}\\n'\n                '  Unit  = {}\\n'\n                '  Reference = {}'.format(self.name, self.value,\n                                           self.uncertainty, self.unit,\n                                           self.reference))\n\n    def __quantity_subclass__(self, unit):\n        return super().__quantity_subclass__(unit)[0], False\n\n    def copy(self):\n        \"\"\"\n        Return a copy of this `Constant` instance.  Since they are by\n        definition immutable, this merely returns another reference to\n        ``self``.\n        \"\"\"\n        return self\n    __deepcopy__ = __copy__ = copy\n\n    @property\n    def abbrev(self):\n        \"\"\"A typical ASCII text abbreviation of the constant, also generally\n        the same as the Python variable used for this constant.\n        \"\"\"\n\n        return self._abbrev\n\n    @property\n    def name(self):\n        \"\"\"The full name of the constant.\"\"\"\n\n        return self._name\n\n    @lazyproperty\n    def _unit(self):\n        \"\"\"The unit(s) in which this constant is defined.\"\"\"\n\n        return Unit(self._unit_string)\n\n    @property\n    def uncertainty(self):\n        \"\"\"The known absolute uncertainty in this constant's value.\"\"\"\n\n        return self._uncertainty\n\n    @property\n    def reference(self):\n        \"\"\"The source used for the value of this constant.\"\"\"\n\n        return self._reference\n\n    @property\n    def system(self):\n        \"\"\"The system of units in which this constant is defined (typically\n        `None` so long as the constant's units can be directly converted\n        between systems).\n        \"\"\"\n\n        return self._system\n\n    def _instance_or_super(self, key):\n        instances = self._registry[self.name.lower()]\n        inst = instances.get(key)\n        if inst is not None:\n            return inst\n        else:\n            return getattr(super(), key)\n\n    @property\n    def si(self):\n        \"\"\"If the Constant is defined in the SI system return that instance of\n        the constant, else convert to a Quantity in the appropriate SI units.\n        \"\"\"\n\n        return self._instance_or_super('si')\n\n    @property\n    def cgs(self):\n        \"\"\"If the Constant is defined in the CGS system return that instance of\n        the constant, else convert to a Quantity in the appropriate CGS units.\n        \"\"\"\n\n        return self._instance_or_super('cgs')\n\n    def __array_finalize__(self, obj):\n        for attr in ('_abbrev', '_name', '_value', '_unit_string',\n                     '_uncertainty', '_reference', '_system'):\n            setattr(self, attr, getattr(obj, attr, None))\n\n        self._checked_units = getattr(obj, '_checked_units', False)"},{"className":"Pix2Sky_ConicPerspective","col":0,"comment":"\n    Colles' conic perspective projection - pixel to sky.\n\n    Corresponds to the ``COP`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n        C &= \\sin \\theta_a \\\\\n        R_\\theta &= \\frac{180^\\circ}{\\pi} \\cos \\eta [ \\cot \\theta_a - \\tan(\\theta - \\theta_a)] \\\\\n        Y_0 &= \\frac{180^\\circ}{\\pi} \\cos \\eta \\cot \\theta_a\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    ","endLoc":995,"id":13376,"nodeType":"Class","startLoc":969,"text":"class Pix2Sky_ConicPerspective(Pix2SkyProjection, Conic):\n    r\"\"\"\n    Colles' conic perspective projection - pixel to sky.\n\n    Corresponds to the ``COP`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n        C &= \\sin \\theta_a \\\\\n        R_\\theta &= \\frac{180^\\circ}{\\pi} \\cos \\eta [ \\cot \\theta_a - \\tan(\\theta - \\theta_a)] \\\\\n        Y_0 &= \\frac{180^\\circ}{\\pi} \\cos \\eta \\cot \\theta_a\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    \"\"\""},{"className":"Sky2Pix_ConicPerspective","col":0,"comment":"\n    Colles' conic perspective projection - sky to pixel.\n\n    Corresponds to the ``COP`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n        C &= \\sin \\theta_a \\\\\n        R_\\theta &= \\frac{180^\\circ}{\\pi} \\cos \\eta [ \\cot \\theta_a - \\tan(\\theta - \\theta_a)] \\\\\n        Y_0 &= \\frac{180^\\circ}{\\pi} \\cos \\eta \\cot \\theta_a\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    ","endLoc":1024,"id":13377,"nodeType":"Class","startLoc":998,"text":"class Sky2Pix_ConicPerspective(Sky2PixProjection, Conic):\n    r\"\"\"\n    Colles' conic perspective projection - sky to pixel.\n\n    Corresponds to the ``COP`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n        C &= \\sin \\theta_a \\\\\n        R_\\theta &= \\frac{180^\\circ}{\\pi} \\cos \\eta [ \\cot \\theta_a - \\tan(\\theta - \\theta_a)] \\\\\n        Y_0 &= \\frac{180^\\circ}{\\pi} \\cos \\eta \\cot \\theta_a\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    \"\"\""},{"className":"Pix2Sky_ConicEqualArea","col":0,"comment":"\n    Alber's conic equal area projection - pixel to sky.\n\n    Corresponds to the ``COE`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n        C &= \\gamma / 2 \\\\\n        R_\\theta &= \\frac{180^\\circ}{\\pi} \\frac{2}{\\gamma} \\sqrt{1 + \\sin \\theta_1 \\sin \\theta_2 - \\gamma \\sin \\theta} \\\\\n        Y_0 &= \\frac{180^\\circ}{\\pi} \\frac{2}{\\gamma} \\sqrt{1 + \\sin \\theta_1 \\sin \\theta_2 - \\gamma \\sin((\\theta_1 + \\theta_2)/2)}\n\n    where:\n\n    .. math::\n        \\gamma = \\sin \\theta_1 + \\sin \\theta_2\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    ","endLoc":1058,"id":13378,"nodeType":"Class","startLoc":1027,"text":"class Pix2Sky_ConicEqualArea(Pix2SkyProjection, Conic):\n    r\"\"\"\n    Alber's conic equal area projection - pixel to sky.\n\n    Corresponds to the ``COE`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n        C &= \\gamma / 2 \\\\\n        R_\\theta &= \\frac{180^\\circ}{\\pi} \\frac{2}{\\gamma} \\sqrt{1 + \\sin \\theta_1 \\sin \\theta_2 - \\gamma \\sin \\theta} \\\\\n        Y_0 &= \\frac{180^\\circ}{\\pi} \\frac{2}{\\gamma} \\sqrt{1 + \\sin \\theta_1 \\sin \\theta_2 - \\gamma \\sin((\\theta_1 + \\theta_2)/2)}\n\n    where:\n\n    .. math::\n        \\gamma = \\sin \\theta_1 + \\sin \\theta_2\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    \"\"\""},{"className":"Sky2Pix_ConicEqualArea","col":0,"comment":"\n    Alber's conic equal area projection - sky to pixel.\n\n    Corresponds to the ``COE`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n        C &= \\gamma / 2 \\\\\n        R_\\theta &= \\frac{180^\\circ}{\\pi} \\frac{2}{\\gamma} \\sqrt{1 + \\sin \\theta_1 \\sin \\theta_2 - \\gamma \\sin \\theta} \\\\\n        Y_0 &= \\frac{180^\\circ}{\\pi} \\frac{2}{\\gamma} \\sqrt{1 + \\sin \\theta_1 \\sin \\theta_2 - \\gamma \\sin((\\theta_1 + \\theta_2)/2)}\n\n    where:\n\n    .. math::\n        \\gamma = \\sin \\theta_1 + \\sin \\theta_2\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    ","endLoc":1092,"id":13379,"nodeType":"Class","startLoc":1061,"text":"class Sky2Pix_ConicEqualArea(Sky2PixProjection, Conic):\n    r\"\"\"\n    Alber's conic equal area projection - sky to pixel.\n\n    Corresponds to the ``COE`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n        C &= \\gamma / 2 \\\\\n        R_\\theta &= \\frac{180^\\circ}{\\pi} \\frac{2}{\\gamma} \\sqrt{1 + \\sin \\theta_1 \\sin \\theta_2 - \\gamma \\sin \\theta} \\\\\n        Y_0 &= \\frac{180^\\circ}{\\pi} \\frac{2}{\\gamma} \\sqrt{1 + \\sin \\theta_1 \\sin \\theta_2 - \\gamma \\sin((\\theta_1 + \\theta_2)/2)}\n\n    where:\n\n    .. math::\n        \\gamma = \\sin \\theta_1 + \\sin \\theta_2\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    \"\"\""},{"col":4,"comment":"null","endLoc":1837,"header":"@property\n    def input_units(self)","id":13380,"name":"input_units","nodeType":"Function","startLoc":1835,"text":"@property\n    def input_units(self):\n        return None"},{"col":4,"comment":"null","endLoc":1840,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13381,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1839,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":1815,"id":13382,"name":"amplitude","nodeType":"Attribute","startLoc":1815,"text":"amplitude"},{"attributeType":"null","col":4,"comment":"null","endLoc":1816,"id":13383,"name":"linear","nodeType":"Attribute","startLoc":1816,"text":"linear"},{"className":"Pix2Sky_ConicEquidistant","col":0,"comment":"\n    Conic equidistant projection - pixel to sky.\n\n    Corresponds to the ``COD`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n\n        C &= \\frac{180^\\circ}{\\pi} \\frac{\\sin\\theta_a\\sin\\eta}{\\eta} \\\\\n        R_\\theta &= \\theta_a - \\theta + \\eta\\cot\\eta\\cot\\theta_a \\\\\n        Y_0 = \\eta\\cot\\eta\\cot\\theta_a\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    ","endLoc":1122,"id":13384,"nodeType":"Class","startLoc":1095,"text":"class Pix2Sky_ConicEquidistant(Pix2SkyProjection, Conic):\n    r\"\"\"\n    Conic equidistant projection - pixel to sky.\n\n    Corresponds to the ``COD`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n\n        C &= \\frac{180^\\circ}{\\pi} \\frac{\\sin\\theta_a\\sin\\eta}{\\eta} \\\\\n        R_\\theta &= \\theta_a - \\theta + \\eta\\cot\\eta\\cot\\theta_a \\\\\n        Y_0 = \\eta\\cot\\eta\\cot\\theta_a\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    \"\"\""},{"className":"Box2D","col":0,"comment":"\n    Two dimensional Box model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude\n    x_0 : float\n        x position of the center of the box function\n    x_width : float\n        Width in x direction of the box\n    y_0 : float\n        y position of the center of the box function\n    y_width : float\n        Width in y direction of the box\n\n    See Also\n    --------\n    Box1D, Gaussian2D, Moffat2D\n\n    Notes\n    -----\n    Model formula:\n\n      .. math::\n\n            f(x, y) = \\left \\{\n                     \\begin{array}{ll}\n            A : & x_0 - w_x/2 \\leq x \\leq x_0 + w_x/2 \\text{ and} \\\\\n                & y_0 - w_y/2 \\leq y \\leq y_0 + w_y/2 \\\\\n            0 : & \\text{else}\n                     \\end{array}\n                   \\right.\n\n    ","endLoc":2349,"id":13385,"nodeType":"Class","startLoc":2265,"text":"class Box2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional Box model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude\n    x_0 : float\n        x position of the center of the box function\n    x_width : float\n        Width in x direction of the box\n    y_0 : float\n        y position of the center of the box function\n    y_width : float\n        Width in y direction of the box\n\n    See Also\n    --------\n    Box1D, Gaussian2D, Moffat2D\n\n    Notes\n    -----\n    Model formula:\n\n      .. math::\n\n            f(x, y) = \\\\left \\\\{\n                     \\\\begin{array}{ll}\n            A : & x_0 - w_x/2 \\\\leq x \\\\leq x_0 + w_x/2 \\\\text{ and} \\\\\\\\\n                & y_0 - w_y/2 \\\\leq y \\\\leq y_0 + w_y/2 \\\\\\\\\n            0 : & \\\\text{else}\n                     \\\\end{array}\n                   \\\\right.\n\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude\")\n    x_0 = Parameter(default=0, description=\"X position of the center of the box function\")\n    y_0 = Parameter(default=0, description=\"Y position of the center of the box function\")\n    x_width = Parameter(default=1, description=\"Width in x direction of the box\")\n    y_width = Parameter(default=1, description=\"Width in y direction of the box\")\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, x_width, y_width):\n        \"\"\"Two dimensional Box model function\"\"\"\n\n        x_range = np.logical_and(x >= x_0 - x_width / 2.,\n                                 x <= x_0 + x_width / 2.)\n        y_range = np.logical_and(y >= y_0 - y_width / 2.,\n                                 y <= y_0 + y_width / 2.)\n\n        result = np.select([np.logical_and(x_range, y_range)], [amplitude], 0)\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box``.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        \"\"\"\n\n        dx = self.x_width / 2\n        dy = self.y_width / 2\n\n        return ((self.y_0 - dy, self.y_0 + dy),\n                (self.x_0 - dx, self.x_0 + dx))\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[1]],\n                'x_width': inputs_unit[self.inputs[0]],\n                'y_width': inputs_unit[self.inputs[1]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"className":"Sky2Pix_ConicEquidistant","col":0,"comment":"\n    Conic equidistant projection - sky to pixel.\n\n    Corresponds to the ``COD`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n\n        C &= \\frac{180^\\circ}{\\pi} \\frac{\\sin\\theta_a\\sin\\eta}{\\eta} \\\\\n        R_\\theta &= \\theta_a - \\theta + \\eta\\cot\\eta\\cot\\theta_a \\\\\n        Y_0 = \\eta\\cot\\eta\\cot\\theta_a\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    ","endLoc":1152,"id":13386,"nodeType":"Class","startLoc":1125,"text":"class Sky2Pix_ConicEquidistant(Sky2PixProjection, Conic):\n    r\"\"\"\n    Conic equidistant projection - sky to pixel.\n\n    Corresponds to the ``COD`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n\n        C &= \\frac{180^\\circ}{\\pi} \\frac{\\sin\\theta_a\\sin\\eta}{\\eta} \\\\\n        R_\\theta &= \\theta_a - \\theta + \\eta\\cot\\eta\\cot\\theta_a \\\\\n        Y_0 = \\eta\\cot\\eta\\cot\\theta_a\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    \"\"\""},{"className":"Pix2Sky_ConicOrthomorphic","col":0,"comment":"\n    Conic orthomorphic projection - pixel to sky.\n\n    Corresponds to the ``COO`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n\n        C &= \\frac{\\ln \\left( \\frac{\\cos\\theta_2}{\\cos\\theta_1} \\right)}\n                  {\\ln \\left[ \\frac{\\tan\\left(\\frac{90^\\circ-\\theta_2}{2}\\right)}\n                                   {\\tan\\left(\\frac{90^\\circ-\\theta_1}{2}\\right)} \\right] } \\\\\n        R_\\theta &= \\psi \\left[ \\tan \\left( \\frac{90^\\circ - \\theta}{2} \\right) \\right]^C \\\\\n        Y_0 &= \\psi \\left[ \\tan \\left( \\frac{90^\\circ - \\theta_a}{2} \\right) \\right]^C\n\n    where:\n\n    .. math::\n\n        \\psi = \\frac{180^\\circ}{\\pi} \\frac{\\cos \\theta}\n               {C\\left[\\tan\\left(\\frac{90^\\circ-\\theta}{2}\\right)\\right]^C}\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    ","endLoc":1191,"id":13387,"nodeType":"Class","startLoc":1155,"text":"class Pix2Sky_ConicOrthomorphic(Pix2SkyProjection, Conic):\n    r\"\"\"\n    Conic orthomorphic projection - pixel to sky.\n\n    Corresponds to the ``COO`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n\n        C &= \\frac{\\ln \\left( \\frac{\\cos\\theta_2}{\\cos\\theta_1} \\right)}\n                  {\\ln \\left[ \\frac{\\tan\\left(\\frac{90^\\circ-\\theta_2}{2}\\right)}\n                                   {\\tan\\left(\\frac{90^\\circ-\\theta_1}{2}\\right)} \\right] } \\\\\n        R_\\theta &= \\psi \\left[ \\tan \\left( \\frac{90^\\circ - \\theta}{2} \\right) \\right]^C \\\\\n        Y_0 &= \\psi \\left[ \\tan \\left( \\frac{90^\\circ - \\theta_a}{2} \\right) \\right]^C\n\n    where:\n\n    .. math::\n\n        \\psi = \\frac{180^\\circ}{\\pi} \\frac{\\cos \\theta}\n               {C\\left[\\tan\\left(\\frac{90^\\circ-\\theta}{2}\\right)\\right]^C}\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    \"\"\""},{"className":"Sky2Pix_ConicOrthomorphic","col":0,"comment":"\n    Conic orthomorphic projection - sky to pixel.\n\n    Corresponds to the ``COO`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n\n        C &= \\frac{\\ln \\left( \\frac{\\cos\\theta_2}{\\cos\\theta_1} \\right)}\n                  {\\ln \\left[ \\frac{\\tan\\left(\\frac{90^\\circ-\\theta_2}{2}\\right)}\n                                   {\\tan\\left(\\frac{90^\\circ-\\theta_1}{2}\\right)} \\right] } \\\\\n        R_\\theta &= \\psi \\left[ \\tan \\left( \\frac{90^\\circ - \\theta}{2} \\right) \\right]^C \\\\\n        Y_0 &= \\psi \\left[ \\tan \\left( \\frac{90^\\circ - \\theta_a}{2} \\right) \\right]^C\n\n    where:\n\n    .. math::\n\n        \\psi = \\frac{180^\\circ}{\\pi} \\frac{\\cos \\theta}\n               {C\\left[\\tan\\left(\\frac{90^\\circ-\\theta}{2}\\right)\\right]^C}\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    ","endLoc":1230,"id":13388,"nodeType":"Class","startLoc":1194,"text":"class Sky2Pix_ConicOrthomorphic(Sky2PixProjection, Conic):\n    r\"\"\"\n    Conic orthomorphic projection - sky to pixel.\n\n    Corresponds to the ``COO`` projection in FITS WCS.\n\n    See `Conic` for a description of the entire equation.\n\n    The projection formulae are:\n\n    .. math::\n\n        C &= \\frac{\\ln \\left( \\frac{\\cos\\theta_2}{\\cos\\theta_1} \\right)}\n                  {\\ln \\left[ \\frac{\\tan\\left(\\frac{90^\\circ-\\theta_2}{2}\\right)}\n                                   {\\tan\\left(\\frac{90^\\circ-\\theta_1}{2}\\right)} \\right] } \\\\\n        R_\\theta &= \\psi \\left[ \\tan \\left( \\frac{90^\\circ - \\theta}{2} \\right) \\right]^C \\\\\n        Y_0 &= \\psi \\left[ \\tan \\left( \\frac{90^\\circ - \\theta_a}{2} \\right) \\right]^C\n\n    where:\n\n    .. math::\n\n        \\psi = \\frac{180^\\circ}{\\pi} \\frac{\\cos \\theta}\n               {C\\left[\\tan\\left(\\frac{90^\\circ-\\theta}{2}\\right)\\right]^C}\n\n    Parameters\n    ----------\n    sigma : float\n        :math:`(\\theta_1 + \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 90.\n\n    delta : float\n        :math:`(\\theta_1 - \\theta_2) / 2`, where :math:`\\theta_1` and\n        :math:`\\theta_2` are the latitudes of the standard parallels,\n        in degrees.  Default is 0.\n    \"\"\""},{"className":"PseudoConic","col":0,"comment":"Base class for pseudoconic projections.\n\n    Pseudoconics are a subclass of conics with concentric parallels.\n    ","endLoc":1237,"id":13389,"nodeType":"Class","startLoc":1233,"text":"class PseudoConic(Projection):\n    r\"\"\"Base class for pseudoconic projections.\n\n    Pseudoconics are a subclass of conics with concentric parallels.\n    \"\"\""},{"className":"Pix2Sky_BonneEqualArea","col":0,"comment":"\n    Bonne's equal area pseudoconic projection - pixel to sky.\n\n    Corresponds to the ``BON`` projection in FITS WCS.\n\n    .. math::\n\n        \\phi &= \\frac{\\pi}{180^\\circ} A_\\phi R_\\theta / \\cos \\theta \\\\\n        \\theta &= Y_0 - R_\\theta\n\n    where:\n\n    .. math::\n\n        R_\\theta &= \\mathrm{sign} \\theta_1 \\sqrt{x^2 + (Y_0 - y)^2} \\\\\n        A_\\phi &= \\arg\\left(\\frac{Y_0 - y}{R_\\theta}, \\frac{x}{R_\\theta}\\right)\n\n    Parameters\n    ----------\n    theta1 : float\n        Bonne conformal latitude, in degrees.\n    ","endLoc":1265,"id":13390,"nodeType":"Class","startLoc":1240,"text":"class Pix2Sky_BonneEqualArea(Pix2SkyProjection, PseudoConic):\n    r\"\"\"\n    Bonne's equal area pseudoconic projection - pixel to sky.\n\n    Corresponds to the ``BON`` projection in FITS WCS.\n\n    .. math::\n\n        \\phi &= \\frac{\\pi}{180^\\circ} A_\\phi R_\\theta / \\cos \\theta \\\\\n        \\theta &= Y_0 - R_\\theta\n\n    where:\n\n    .. math::\n\n        R_\\theta &= \\mathrm{sign} \\theta_1 \\sqrt{x^2 + (Y_0 - y)^2} \\\\\n        A_\\phi &= \\arg\\left(\\frac{Y_0 - y}{R_\\theta}, \\frac{x}{R_\\theta}\\right)\n\n    Parameters\n    ----------\n    theta1 : float\n        Bonne conformal latitude, in degrees.\n    \"\"\"\n    _separable = True\n\n    theta1 = _ParameterDS(default=0.0, getter=_to_orig_unit, setter=_to_radian)"},{"col":4,"comment":"Two dimensional Box model function","endLoc":2321,"header":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, x_width, y_width)","id":13391,"name":"evaluate","nodeType":"Function","startLoc":2308,"text":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, x_width, y_width):\n        \"\"\"Two dimensional Box model function\"\"\"\n\n        x_range = np.logical_and(x >= x_0 - x_width / 2.,\n                                 x <= x_0 + x_width / 2.)\n        y_range = np.logical_and(y >= y_0 - y_width / 2.,\n                                 y <= y_0 + y_width / 2.)\n\n        result = np.select([np.logical_and(x_range, y_range)], [amplitude], 0)\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result"},{"attributeType":"null","col":4,"comment":"null","endLoc":1263,"id":13392,"name":"_separable","nodeType":"Attribute","startLoc":1263,"text":"_separable"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":1265,"id":13393,"name":"theta1","nodeType":"Attribute","startLoc":1265,"text":"theta1"},{"col":4,"comment":"null","endLoc":119,"header":"def __new__(cls, abbrev, name, value, unit, uncertainty,\n                reference=None, system=None)","id":13394,"name":"__new__","nodeType":"Function","startLoc":86,"text":"def __new__(cls, abbrev, name, value, unit, uncertainty,\n                reference=None, system=None):\n        if reference is None:\n            reference = getattr(cls, 'default_reference', None)\n            if reference is None:\n                raise TypeError(f\"{cls} requires a reference.\")\n        name_lower = name.lower()\n        instances = cls._registry.setdefault(name_lower, {})\n        # By-pass Quantity initialization, since units may not yet be\n        # initialized here, and we store the unit in string form.\n        inst = np.array(value).view(cls)\n\n        if system in instances:\n                warnings.warn('Constant {!r} already has a definition in the '\n                              '{!r} system from {!r} reference'.format(\n                              name, system, reference), AstropyUserWarning)\n        for c in instances.values():\n            if system is not None and not hasattr(c.__class__, system):\n                setattr(c, system, inst)\n            if c.system is not None and not hasattr(inst.__class__, c.system):\n                setattr(inst, c.system, c)\n\n        instances[system] = inst\n\n        inst._abbrev = abbrev\n        inst._name = name\n        inst._value = value\n        inst._unit_string = unit\n        inst._uncertainty = uncertainty\n        inst._reference = reference\n        inst._system = system\n\n        inst._checked_units = False\n        return inst"},{"className":"Sky2Pix_BonneEqualArea","col":0,"comment":"\n    Bonne's equal area pseudoconic projection - sky to pixel.\n\n    Corresponds to the ``BON`` projection in FITS WCS.\n\n    .. math::\n        x &= R_\\theta \\sin A_\\phi \\\\\n        y &= -R_\\theta \\cos A_\\phi + Y_0\n\n    where:\n\n    .. math::\n        A_\\phi &= \\frac{180^\\circ}{\\pi R_\\theta} \\phi \\cos \\theta \\\\\n        R_\\theta &= Y_0 - \\theta \\\\\n        Y_0 &= \\frac{180^\\circ}{\\pi} \\cot \\theta_1 + \\theta_1\n\n    Parameters\n    ----------\n    theta1 : float\n        Bonne conformal latitude, in degrees.\n    ","endLoc":1293,"id":13395,"nodeType":"Class","startLoc":1268,"text":"class Sky2Pix_BonneEqualArea(Sky2PixProjection, PseudoConic):\n    r\"\"\"\n    Bonne's equal area pseudoconic projection - sky to pixel.\n\n    Corresponds to the ``BON`` projection in FITS WCS.\n\n    .. math::\n        x &= R_\\theta \\sin A_\\phi \\\\\n        y &= -R_\\theta \\cos A_\\phi + Y_0\n\n    where:\n\n    .. math::\n        A_\\phi &= \\frac{180^\\circ}{\\pi R_\\theta} \\phi \\cos \\theta \\\\\n        R_\\theta &= Y_0 - \\theta \\\\\n        Y_0 &= \\frac{180^\\circ}{\\pi} \\cot \\theta_1 + \\theta_1\n\n    Parameters\n    ----------\n    theta1 : float\n        Bonne conformal latitude, in degrees.\n    \"\"\"\n    _separable = True\n\n    theta1 = _ParameterDS(default=0.0, getter=_to_orig_unit, setter=_to_radian,\n                          description=\"Bonne conformal latitude, in degrees\")"},{"attributeType":"null","col":4,"comment":"null","endLoc":1290,"id":13396,"name":"_separable","nodeType":"Attribute","startLoc":1290,"text":"_separable"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box``.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        ","endLoc":2335,"header":"@property\n    def bounding_box(self)","id":13397,"name":"bounding_box","nodeType":"Function","startLoc":2323,"text":"@property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box``.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        \"\"\"\n\n        dx = self.x_width / 2\n        dy = self.y_width / 2\n\n        return ((self.y_0 - dy, self.y_0 + dy),\n                (self.x_0 - dx, self.x_0 + dx))"},{"col":4,"comment":"null","endLoc":2342,"header":"@property\n    def input_units(self)","id":13398,"name":"input_units","nodeType":"Function","startLoc":2337,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}"},{"col":4,"comment":"null","endLoc":2349,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13399,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2344,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[1]],\n                'x_width': inputs_unit[self.inputs[0]],\n                'y_width': inputs_unit[self.inputs[1]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":2302,"id":13400,"name":"amplitude","nodeType":"Attribute","startLoc":2302,"text":"amplitude"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":1292,"id":13401,"name":"theta1","nodeType":"Attribute","startLoc":1292,"text":"theta1"},{"col":4,"comment":"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        ","endLoc":487,"header":"def fit_deriv(self, x, *params)","id":13402,"name":"fit_deriv","nodeType":"Function","startLoc":462,"text":"def fit_deriv(self, x, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        v = np.empty((self.degree + 1,) + x.shape, dtype=x.dtype)\n        v[0] = 1\n        if self.degree > 0:\n            x2 = 2 * x\n            v[1] = x\n            for i in range(2, self.degree + 1):\n                v[i] = v[i - 1] * x2 - v[i - 2]\n        return np.rollaxis(v, 0, v.ndim)"},{"col":4,"comment":"null","endLoc":494,"header":"def prepare_inputs(self, x, **kwargs)","id":13403,"name":"prepare_inputs","nodeType":"Function","startLoc":489,"text":"def prepare_inputs(self, x, **kwargs):\n        inputs, broadcasted_shapes = super().prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), broadcasted_shapes"},{"attributeType":"null","col":4,"comment":"null","endLoc":2303,"id":13404,"name":"x_0","nodeType":"Attribute","startLoc":2303,"text":"x_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":2304,"id":13405,"name":"y_0","nodeType":"Attribute","startLoc":2304,"text":"y_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":2305,"id":13406,"name":"x_width","nodeType":"Attribute","startLoc":2305,"text":"x_width"},{"col":4,"comment":"null","endLoc":499,"header":"def evaluate(self, x, *coeffs)","id":13407,"name":"evaluate","nodeType":"Function","startLoc":496,"text":"def evaluate(self, x, *coeffs):\n        if self.domain is not None:\n            x = poly_map_domain(x, self.domain, self.window)\n        return self.clenshaw(x, coeffs)"},{"className":"Pix2Sky_Polyconic","col":0,"comment":"\n    Polyconic projection - pixel to sky.\n\n    Corresponds to the ``PCO`` projection in FITS WCS.\n    ","endLoc":1301,"id":13408,"nodeType":"Class","startLoc":1296,"text":"class Pix2Sky_Polyconic(Pix2SkyProjection, PseudoConic):\n    r\"\"\"\n    Polyconic projection - pixel to sky.\n\n    Corresponds to the ``PCO`` projection in FITS WCS.\n    \"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":2306,"id":13409,"name":"y_width","nodeType":"Attribute","startLoc":2306,"text":"y_width"},{"className":"Sky2Pix_Polyconic","col":0,"comment":"\n    Polyconic projection - sky to pixel.\n\n    Corresponds to the ``PCO`` projection in FITS WCS.\n    ","endLoc":1309,"id":13410,"nodeType":"Class","startLoc":1304,"text":"class Sky2Pix_Polyconic(Sky2PixProjection, PseudoConic):\n    r\"\"\"\n    Polyconic projection - sky to pixel.\n\n    Corresponds to the ``PCO`` projection in FITS WCS.\n    \"\"\""},{"className":"QuadCube","col":0,"comment":"Base class for quad cube projections.\n\n    Quadrilateralized spherical cube (quad-cube) projections belong to\n    the class of polyhedral projections in which the sphere is\n    projected onto the surface of an enclosing polyhedron.\n\n    The six faces of the quad-cube projections are numbered and laid\n    out as::\n\n              0\n        4 3 2 1 4 3 2\n              5\n\n    ","endLoc":1326,"id":13411,"nodeType":"Class","startLoc":1312,"text":"class QuadCube(Projection):\n    r\"\"\"Base class for quad cube projections.\n\n    Quadrilateralized spherical cube (quad-cube) projections belong to\n    the class of polyhedral projections in which the sphere is\n    projected onto the surface of an enclosing polyhedron.\n\n    The six faces of the quad-cube projections are numbered and laid\n    out as::\n\n              0\n        4 3 2 1 4 3 2\n              5\n\n    \"\"\""},{"className":"Pix2Sky_TangentialSphericalCube","col":0,"comment":"\n    Tangential spherical cube projection - pixel to sky.\n\n    Corresponds to the ``TSC`` projection in FITS WCS.\n    ","endLoc":1334,"id":13412,"nodeType":"Class","startLoc":1329,"text":"class Pix2Sky_TangentialSphericalCube(Pix2SkyProjection, QuadCube):\n    r\"\"\"\n    Tangential spherical cube projection - pixel to sky.\n\n    Corresponds to the ``TSC`` projection in FITS WCS.\n    \"\"\""},{"className":"Sky2Pix_TangentialSphericalCube","col":0,"comment":"\n    Tangential spherical cube projection - sky to pixel.\n\n    Corresponds to the ``TSC`` projection in FITS WCS.\n    ","endLoc":1342,"id":13413,"nodeType":"Class","startLoc":1337,"text":"class Sky2Pix_TangentialSphericalCube(Sky2PixProjection, QuadCube):\n    r\"\"\"\n    Tangential spherical cube projection - sky to pixel.\n\n    Corresponds to the ``TSC`` projection in FITS WCS.\n    \"\"\""},{"className":"Pix2Sky_COBEQuadSphericalCube","col":0,"comment":"\n    COBE quadrilateralized spherical cube projection - pixel to sky.\n\n    Corresponds to the ``CSC`` projection in FITS WCS.\n    ","endLoc":1350,"id":13414,"nodeType":"Class","startLoc":1345,"text":"class Pix2Sky_COBEQuadSphericalCube(Pix2SkyProjection, QuadCube):\n    r\"\"\"\n    COBE quadrilateralized spherical cube projection - pixel to sky.\n\n    Corresponds to the ``CSC`` projection in FITS WCS.\n    \"\"\""},{"className":"RickerWavelet2D","col":0,"comment":"\n    Two dimensional Ricker Wavelet model (sometimes known as a \"Mexican Hat\"\n    model).\n\n    .. note::\n\n        See https://github.com/astropy/astropy/pull/9445 for discussions\n        related to renaming of this model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude\n    x_0 : float\n        x position of the peak\n    y_0 : float\n        y position of the peak\n    sigma : float\n        Width of the Ricker wavelet\n\n    See Also\n    --------\n    RickerWavelet1D, Gaussian2D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        f(x, y) = A \\left(1 - \\frac{\\left(x - x_{0}\\right)^{2}\n        + \\left(y - y_{0}\\right)^{2}}{\\sigma^{2}}\\right)\n        e^{\\frac{- \\left(x - x_{0}\\right)^{2}\n        - \\left(y - y_{0}\\right)^{2}}{2 \\sigma^{2}}}\n    ","endLoc":2682,"id":13415,"nodeType":"Class","startLoc":2617,"text":"class RickerWavelet2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional Ricker Wavelet model (sometimes known as a \"Mexican Hat\"\n    model).\n\n    .. note::\n\n        See https://github.com/astropy/astropy/pull/9445 for discussions\n        related to renaming of this model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude\n    x_0 : float\n        x position of the peak\n    y_0 : float\n        y position of the peak\n    sigma : float\n        Width of the Ricker wavelet\n\n    See Also\n    --------\n    RickerWavelet1D, Gaussian2D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        f(x, y) = A \\\\left(1 - \\\\frac{\\\\left(x - x_{0}\\\\right)^{2}\n        + \\\\left(y - y_{0}\\\\right)^{2}}{\\\\sigma^{2}}\\\\right)\n        e^{\\\\frac{- \\\\left(x - x_{0}\\\\right)^{2}\n        - \\\\left(y - y_{0}\\\\right)^{2}}{2 \\\\sigma^{2}}}\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude (peak) value\")\n    x_0 = Parameter(default=0, description=\"X position of the peak\")\n    y_0 = Parameter(default=0, description=\"Y position of the peak\")\n    sigma = Parameter(default=1, description=\"Width of the Ricker wavelet\")\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, sigma):\n        \"\"\"Two dimensional Ricker Wavelet model function\"\"\"\n\n        rr_ww = ((x - x_0) ** 2 + (y - y_0) ** 2) / (2 * sigma ** 2)\n        return amplitude * (1 - rr_ww) * np.exp(- rr_ww)\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'sigma': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"className":"Sky2Pix_COBEQuadSphericalCube","col":0,"comment":"\n    COBE quadrilateralized spherical cube projection - sky to pixel.\n\n    Corresponds to the ``CSC`` projection in FITS WCS.\n    ","endLoc":1358,"id":13416,"nodeType":"Class","startLoc":1353,"text":"class Sky2Pix_COBEQuadSphericalCube(Sky2PixProjection, QuadCube):\n    r\"\"\"\n    COBE quadrilateralized spherical cube projection - sky to pixel.\n\n    Corresponds to the ``CSC`` projection in FITS WCS.\n    \"\"\""},{"className":"Pix2Sky_QuadSphericalCube","col":0,"comment":"\n    Quadrilateralized spherical cube projection - pixel to sky.\n\n    Corresponds to the ``QSC`` projection in FITS WCS.\n    ","endLoc":1366,"id":13417,"nodeType":"Class","startLoc":1361,"text":"class Pix2Sky_QuadSphericalCube(Pix2SkyProjection, QuadCube):\n    r\"\"\"\n    Quadrilateralized spherical cube projection - pixel to sky.\n\n    Corresponds to the ``QSC`` projection in FITS WCS.\n    \"\"\""},{"className":"Sky2Pix_QuadSphericalCube","col":0,"comment":"\n    Quadrilateralized spherical cube projection - sky to pixel.\n\n    Corresponds to the ``QSC`` projection in FITS WCS.\n    ","endLoc":1374,"id":13418,"nodeType":"Class","startLoc":1369,"text":"class Sky2Pix_QuadSphericalCube(Sky2PixProjection, QuadCube):\n    r\"\"\"\n    Quadrilateralized spherical cube projection - sky to pixel.\n\n    Corresponds to the ``QSC`` projection in FITS WCS.\n    \"\"\""},{"col":4,"comment":"Two dimensional Ricker Wavelet model function","endLoc":2664,"header":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, sigma)","id":13419,"name":"evaluate","nodeType":"Function","startLoc":2659,"text":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, sigma):\n        \"\"\"Two dimensional Ricker Wavelet model function\"\"\"\n\n        rr_ww = ((x - x_0) ** 2 + (y - y_0) ** 2) / (2 * sigma ** 2)\n        return amplitude * (1 - rr_ww) * np.exp(- rr_ww)"},{"className":"HEALPix","col":0,"comment":"Base class for HEALPix projections.\n    ","endLoc":1379,"id":13420,"nodeType":"Class","startLoc":1377,"text":"class HEALPix(Projection):\n    r\"\"\"Base class for HEALPix projections.\n    \"\"\""},{"col":4,"comment":"null","endLoc":125,"header":"def __repr__(self)","id":13421,"name":"__repr__","nodeType":"Function","startLoc":121,"text":"def __repr__(self):\n        return ('<{} name={!r} value={} uncertainty={} unit={!r} '\n                'reference={!r}>'.format(self.__class__, self.name, self.value,\n                                          self.uncertainty, str(self.unit),\n                                          self.reference))"},{"col":4,"comment":"null","endLoc":2671,"header":"@property\n    def input_units(self)","id":13422,"name":"input_units","nodeType":"Function","startLoc":2666,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}"},{"col":4,"comment":"null","endLoc":2682,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13423,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2673,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'sigma': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"className":"Pix2Sky_HEALPix","col":0,"comment":"\n    HEALPix - pixel to sky.\n\n    Corresponds to the ``HPX`` projection in FITS WCS.\n\n    Parameters\n    ----------\n    H : float\n        The number of facets in longitude direction.\n\n    X : float\n        The number of facets in latitude direction.\n\n    ","endLoc":1400,"id":13424,"nodeType":"Class","startLoc":1382,"text":"class Pix2Sky_HEALPix(Pix2SkyProjection, HEALPix):\n    r\"\"\"\n    HEALPix - pixel to sky.\n\n    Corresponds to the ``HPX`` projection in FITS WCS.\n\n    Parameters\n    ----------\n    H : float\n        The number of facets in longitude direction.\n\n    X : float\n        The number of facets in latitude direction.\n\n    \"\"\"\n    _separable = True\n\n    H = _ParameterDS(default=4.0, description=\"The number of facets in longitude direction.\")\n    X = _ParameterDS(default=3.0, description=\"The number of facets in latitude direction.\")"},{"attributeType":"null","col":4,"comment":"null","endLoc":2654,"id":13425,"name":"amplitude","nodeType":"Attribute","startLoc":2654,"text":"amplitude"},{"attributeType":"null","col":4,"comment":"null","endLoc":1397,"id":13426,"name":"_separable","nodeType":"Attribute","startLoc":1397,"text":"_separable"},{"attributeType":"null","col":4,"comment":"null","endLoc":2655,"id":13427,"name":"x_0","nodeType":"Attribute","startLoc":2655,"text":"x_0"},{"col":4,"comment":"null","endLoc":134,"header":"def __str__(self)","id":13428,"name":"__str__","nodeType":"Function","startLoc":127,"text":"def __str__(self):\n        return ('  Name   = {}\\n'\n                '  Value  = {}\\n'\n                '  Uncertainty  = {}\\n'\n                '  Unit  = {}\\n'\n                '  Reference = {}'.format(self.name, self.value,\n                                           self.uncertainty, self.unit,\n                                           self.reference))"},{"col":4,"comment":"null","endLoc":137,"header":"def __quantity_subclass__(self, unit)","id":13429,"name":"__quantity_subclass__","nodeType":"Function","startLoc":136,"text":"def __quantity_subclass__(self, unit):\n        return super().__quantity_subclass__(unit)[0], False"},{"attributeType":"null","col":4,"comment":"null","endLoc":2656,"id":13430,"name":"y_0","nodeType":"Attribute","startLoc":2656,"text":"y_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":2657,"id":13431,"name":"sigma","nodeType":"Attribute","startLoc":2657,"text":"sigma"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":1399,"id":13432,"name":"H","nodeType":"Attribute","startLoc":1399,"text":"H"},{"col":4,"comment":"\n        Return a copy of this `Constant` instance.  Since they are by\n        definition immutable, this merely returns another reference to\n        ``self``.\n        ","endLoc":145,"header":"def copy(self)","id":13433,"name":"copy","nodeType":"Function","startLoc":139,"text":"def copy(self):\n        \"\"\"\n        Return a copy of this `Constant` instance.  Since they are by\n        definition immutable, this merely returns another reference to\n        ``self``.\n        \"\"\"\n        return self"},{"col":4,"comment":"A typical ASCII text abbreviation of the constant, also generally\n        the same as the Python variable used for this constant.\n        ","endLoc":154,"header":"@property\n    def abbrev(self)","id":13434,"name":"abbrev","nodeType":"Function","startLoc":148,"text":"@property\n    def abbrev(self):\n        \"\"\"A typical ASCII text abbreviation of the constant, also generally\n        the same as the Python variable used for this constant.\n        \"\"\"\n\n        return self._abbrev"},{"col":4,"comment":"The full name of the constant.","endLoc":160,"header":"@property\n    def name(self)","id":13435,"name":"name","nodeType":"Function","startLoc":156,"text":"@property\n    def name(self):\n        \"\"\"The full name of the constant.\"\"\"\n\n        return self._name"},{"col":4,"comment":"The unit(s) in which this constant is defined.","endLoc":166,"header":"@lazyproperty\n    def _unit(self)","id":13436,"name":"_unit","nodeType":"Function","startLoc":162,"text":"@lazyproperty\n    def _unit(self):\n        \"\"\"The unit(s) in which this constant is defined.\"\"\"\n\n        return Unit(self._unit_string)"},{"className":"TrapezoidDisk2D","col":0,"comment":"\n    Two dimensional circular Trapezoid model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the trapezoid\n    x_0 : float\n        x position of the center of the trapezoid\n    y_0 : float\n        y position of the center of the trapezoid\n    R_0 : float\n        Radius of the constant part of the trapezoid.\n    slope : float\n        Slope of the tails of the trapezoid in x direction.\n\n    See Also\n    --------\n    Disk2D, Box2D\n    ","endLoc":2521,"id":13437,"nodeType":"Class","startLoc":2448,"text":"class TrapezoidDisk2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional circular Trapezoid model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the trapezoid\n    x_0 : float\n        x position of the center of the trapezoid\n    y_0 : float\n        y position of the center of the trapezoid\n    R_0 : float\n        Radius of the constant part of the trapezoid.\n    slope : float\n        Slope of the tails of the trapezoid in x direction.\n\n    See Also\n    --------\n    Disk2D, Box2D\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude of the trapezoid\")\n    x_0 = Parameter(default=0, description=\"X position of the center of the trapezoid\")\n    y_0 = Parameter(default=0, description=\"Y position of the center of the trapezoid\")\n    R_0 = Parameter(default=1, description=\"Radius of constant part of trapezoid\")\n    slope = Parameter(default=1, description=\"Slope of tails of trapezoid in x direction\")\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, R_0, slope):\n        \"\"\"Two dimensional Trapezoid Disk model function\"\"\"\n\n        r = np.sqrt((x - x_0) ** 2 + (y - y_0) ** 2)\n        range_1 = r <= R_0\n        range_2 = np.logical_and(r > R_0, r <= R_0 + amplitude / slope)\n        val_1 = amplitude\n        val_2 = amplitude + slope * (R_0 - r)\n        result = np.select([range_1, range_2], [val_1, val_2])\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box``.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        \"\"\"\n\n        dr = self.R_0 + self.amplitude / self.slope\n\n        return ((self.y_0 - dr, self.y_0 + dr),\n                (self.x_0 - dr, self.x_0 + dr))\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None and self.y_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit['x'] != inputs_unit['y']:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'R_0': inputs_unit[self.inputs[0]],\n                'slope': outputs_unit[self.outputs[0]] / inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"col":4,"comment":"Two dimensional Trapezoid Disk model function","endLoc":2489,"header":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, R_0, slope)","id":13438,"name":"evaluate","nodeType":"Function","startLoc":2476,"text":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, R_0, slope):\n        \"\"\"Two dimensional Trapezoid Disk model function\"\"\"\n\n        r = np.sqrt((x - x_0) ** 2 + (y - y_0) ** 2)\n        range_1 = r <= R_0\n        range_2 = np.logical_and(r > R_0, r <= R_0 + amplitude / slope)\n        val_1 = amplitude\n        val_2 = amplitude + slope * (R_0 - r)\n        result = np.select([range_1, range_2], [val_1, val_2])\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":1400,"id":13439,"name":"X","nodeType":"Attribute","startLoc":1400,"text":"X"},{"col":4,"comment":"The known absolute uncertainty in this constant's value.","endLoc":172,"header":"@property\n    def uncertainty(self)","id":13440,"name":"uncertainty","nodeType":"Function","startLoc":168,"text":"@property\n    def uncertainty(self):\n        \"\"\"The known absolute uncertainty in this constant's value.\"\"\"\n\n        return self._uncertainty"},{"col":4,"comment":"The source used for the value of this constant.","endLoc":178,"header":"@property\n    def reference(self)","id":13441,"name":"reference","nodeType":"Function","startLoc":174,"text":"@property\n    def reference(self):\n        \"\"\"The source used for the value of this constant.\"\"\"\n\n        return self._reference"},{"col":4,"comment":"The system of units in which this constant is defined (typically\n        `None` so long as the constant's units can be directly converted\n        between systems).\n        ","endLoc":187,"header":"@property\n    def system(self)","id":13442,"name":"system","nodeType":"Function","startLoc":180,"text":"@property\n    def system(self):\n        \"\"\"The system of units in which this constant is defined (typically\n        `None` so long as the constant's units can be directly converted\n        between systems).\n        \"\"\"\n\n        return self._system"},{"col":4,"comment":"null","endLoc":195,"header":"def _instance_or_super(self, key)","id":13443,"name":"_instance_or_super","nodeType":"Function","startLoc":189,"text":"def _instance_or_super(self, key):\n        instances = self._registry[self.name.lower()]\n        inst = instances.get(key)\n        if inst is not None:\n            return inst\n        else:\n            return getattr(super(), key)"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box``.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        ","endLoc":2502,"header":"@property\n    def bounding_box(self)","id":13444,"name":"bounding_box","nodeType":"Function","startLoc":2491,"text":"@property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box``.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        \"\"\"\n\n        dr = self.R_0 + self.amplitude / self.slope\n\n        return ((self.y_0 - dr, self.y_0 + dr),\n                (self.x_0 - dr, self.x_0 + dr))"},{"col":4,"comment":"null","endLoc":2509,"header":"@property\n    def input_units(self)","id":13445,"name":"input_units","nodeType":"Function","startLoc":2504,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None and self.y_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}"},{"col":4,"comment":"null","endLoc":2521,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13446,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2511,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit['x'] != inputs_unit['y']:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'R_0': inputs_unit[self.inputs[0]],\n                'slope': outputs_unit[self.outputs[0]] / inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"className":"Sky2Pix_HEALPix","col":0,"comment":"\n    HEALPix projection - sky to pixel.\n\n    Corresponds to the ``HPX`` projection in FITS WCS.\n\n    Parameters\n    ----------\n    H : float\n        The number of facets in longitude direction.\n\n    X : float\n        The number of facets in latitude direction.\n\n    ","endLoc":1421,"id":13447,"nodeType":"Class","startLoc":1403,"text":"class Sky2Pix_HEALPix(Sky2PixProjection, HEALPix):\n    r\"\"\"\n    HEALPix projection - sky to pixel.\n\n    Corresponds to the ``HPX`` projection in FITS WCS.\n\n    Parameters\n    ----------\n    H : float\n        The number of facets in longitude direction.\n\n    X : float\n        The number of facets in latitude direction.\n\n    \"\"\"\n    _separable = True\n\n    H = _ParameterDS(default=4.0, description=\"The number of facets in longitude direction.\")\n    X = _ParameterDS(default=3.0, description=\"The number of facets in latitude direction.\")"},{"attributeType":"null","col":4,"comment":"null","endLoc":1418,"id":13448,"name":"_separable","nodeType":"Attribute","startLoc":1418,"text":"_separable"},{"col":4,"comment":"If the Constant is defined in the SI system return that instance of\n        the constant, else convert to a Quantity in the appropriate SI units.\n        ","endLoc":203,"header":"@property\n    def si(self)","id":13449,"name":"si","nodeType":"Function","startLoc":197,"text":"@property\n    def si(self):\n        \"\"\"If the Constant is defined in the SI system return that instance of\n        the constant, else convert to a Quantity in the appropriate SI units.\n        \"\"\"\n\n        return self._instance_or_super('si')"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":1420,"id":13450,"name":"H","nodeType":"Attribute","startLoc":1420,"text":"H"},{"attributeType":"null","col":4,"comment":"null","endLoc":2470,"id":13451,"name":"amplitude","nodeType":"Attribute","startLoc":2470,"text":"amplitude"},{"col":4,"comment":"Evaluates the polynomial using Clenshaw's algorithm.","endLoc":519,"header":"@staticmethod\n    def clenshaw(x, coeffs)","id":13452,"name":"clenshaw","nodeType":"Function","startLoc":501,"text":"@staticmethod\n    def clenshaw(x, coeffs):\n        \"\"\"Evaluates the polynomial using Clenshaw's algorithm.\"\"\"\n\n        if len(coeffs) == 1:\n            c0 = coeffs[0]\n            c1 = 0\n        elif len(coeffs) == 2:\n            c0 = coeffs[0]\n            c1 = coeffs[1]\n        else:\n            x2 = 2 * x\n            c0 = coeffs[-2]\n            c1 = coeffs[-1]\n            for i in range(3, len(coeffs) + 1):\n                tmp = c0\n                c0 = coeffs[-i] - c1\n                c1 = tmp + c1 * x2\n        return c0 + c1 * x"},{"attributeType":"null","col":4,"comment":"null","endLoc":451,"id":13453,"name":"n_inputs","nodeType":"Attribute","startLoc":451,"text":"n_inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":452,"id":13454,"name":"n_outputs","nodeType":"Attribute","startLoc":452,"text":"n_outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":2471,"id":13455,"name":"x_0","nodeType":"Attribute","startLoc":2471,"text":"x_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":454,"id":13456,"name":"_separable","nodeType":"Attribute","startLoc":454,"text":"_separable"},{"className":"Hermite1D","col":0,"comment":"\n    Univariate Hermite series.\n\n    It is defined as:\n\n    .. math::\n\n        P(x) = \\sum_{i=0}^{i=n}C_{i} * H_{i}(x)\n\n    where ``H_i(x)`` is the corresponding Hermite polynomial (\"Physicist's kind\").\n\n    For explanation of ``domain``, and ``window`` see\n    :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : tuple or None, optional\n    window : tuple or None, optional\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    **params : dict\n        keyword : value pairs, representing parameter_name: value\n\n    Notes\n    -----\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Hermite polynomials is a polynomial in x - since the\n    coefficients within each Hermite polynomial are fixed, we can't use\n    quantities for x since the units would not be compatible. For example, the\n    third Hermite polynomial (H2) is 4x^2-2, but if x was specified with units,\n    4x^2 and -2 would have incompatible units.\n    ","endLoc":626,"id":13457,"nodeType":"Class","startLoc":522,"text":"class Hermite1D(_PolyDomainWindow1D):\n    r\"\"\"\n    Univariate Hermite series.\n\n    It is defined as:\n\n    .. math::\n\n        P(x) = \\sum_{i=0}^{i=n}C_{i} * H_{i}(x)\n\n    where ``H_i(x)`` is the corresponding Hermite polynomial (\"Physicist's kind\").\n\n    For explanation of ``domain``, and ``window`` see\n    :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : tuple or None, optional\n    window : tuple or None, optional\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    **params : dict\n        keyword : value pairs, representing parameter_name: value\n\n    Notes\n    -----\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Hermite polynomials is a polynomial in x - since the\n    coefficients within each Hermite polynomial are fixed, we can't use\n    quantities for x since the units would not be compatible. For example, the\n    third Hermite polynomial (H2) is 4x^2-2, but if x was specified with units,\n    4x^2 and -2 would have incompatible units.\n    \"\"\"\n    n_inputs = 1\n    n_outputs = 1\n\n    _separable = True\n\n    def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            degree, domain, window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)\n\n    def fit_deriv(self, x, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        v = np.empty((self.degree + 1,) + x.shape, dtype=x.dtype)\n        v[0] = 1\n        if self.degree > 0:\n            x2 = 2 * x\n            v[1] = 2 * x\n            for i in range(2, self.degree + 1):\n                v[i] = x2 * v[i - 1] - 2 * (i - 1) * v[i - 2]\n        return np.rollaxis(v, 0, v.ndim)\n\n    def prepare_inputs(self, x, **kwargs):\n        inputs, broadcasted_shapes = super().prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), broadcasted_shapes\n\n    def evaluate(self, x, *coeffs):\n        if self.domain is not None:\n            x = poly_map_domain(x, self.domain, self.window)\n        return self.clenshaw(x, coeffs)\n\n    @staticmethod\n    def clenshaw(x, coeffs):\n        x2 = x * 2\n        if len(coeffs) == 1:\n            c0 = coeffs[0]\n            c1 = 0\n        elif len(coeffs) == 2:\n            c0 = coeffs[0]\n            c1 = coeffs[1]\n        else:\n            nd = len(coeffs)\n            c0 = coeffs[-2]\n            c1 = coeffs[-1]\n            for i in range(3, len(coeffs) + 1):\n                temp = c0\n                nd = nd - 1\n                c0 = coeffs[-i] - c1 * (2 * (nd - 1))\n                c1 = temp + c1 * x2\n        return c0 + c1 * x2"},{"col":4,"comment":"null","endLoc":567,"header":"def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":13458,"name":"__init__","nodeType":"Function","startLoc":563,"text":"def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            degree, domain, window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)"},{"attributeType":"null","col":4,"comment":"null","endLoc":2472,"id":13459,"name":"y_0","nodeType":"Attribute","startLoc":2472,"text":"y_0"},{"attributeType":"_ParameterDS","col":4,"comment":"null","endLoc":1421,"id":13460,"name":"X","nodeType":"Attribute","startLoc":1421,"text":"X"},{"col":4,"comment":"If the Constant is defined in the CGS system return that instance of\n        the constant, else convert to a Quantity in the appropriate CGS units.\n        ","endLoc":211,"header":"@property\n    def cgs(self)","id":13461,"name":"cgs","nodeType":"Function","startLoc":205,"text":"@property\n    def cgs(self):\n        \"\"\"If the Constant is defined in the CGS system return that instance of\n        the constant, else convert to a Quantity in the appropriate CGS units.\n        \"\"\"\n\n        return self._instance_or_super('cgs')"},{"attributeType":"null","col":4,"comment":"null","endLoc":2473,"id":13462,"name":"R_0","nodeType":"Attribute","startLoc":2473,"text":"R_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":2474,"id":13463,"name":"slope","nodeType":"Attribute","startLoc":2474,"text":"slope"},{"className":"Pix2Sky_HEALPixPolar","col":0,"comment":"\n    HEALPix polar, aka \"butterfly\" projection - pixel to sky.\n\n    Corresponds to the ``XPH`` projection in FITS WCS.\n    ","endLoc":1429,"id":13464,"nodeType":"Class","startLoc":1424,"text":"class Pix2Sky_HEALPixPolar(Pix2SkyProjection, HEALPix):\n    r\"\"\"\n    HEALPix polar, aka \"butterfly\" projection - pixel to sky.\n\n    Corresponds to the ``XPH`` projection in FITS WCS.\n    \"\"\""},{"className":"AiryDisk2D","col":0,"comment":"\n    Two dimensional Airy disk model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the Airy function.\n    x_0 : float\n        x position of the maximum of the Airy function.\n    y_0 : float\n        y position of the maximum of the Airy function.\n    radius : float\n        The radius of the Airy disk (radius of the first zero).\n\n    See Also\n    --------\n    Box2D, TrapezoidDisk2D, Gaussian2D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(r) = A \\left[\\frac{2 J_1(\\frac{\\pi r}{R/R_z})}{\\frac{\\pi r}{R/R_z}}\\right]^2\n\n    Where :math:`J_1` is the first order Bessel function of the first\n    kind, :math:`r` is radial distance from the maximum of the Airy\n    function (:math:`r = \\sqrt{(x - x_0)^2 + (y - y_0)^2}`), :math:`R`\n    is the input ``radius`` parameter, and :math:`R_z =\n    1.2196698912665045`).\n\n    For an optical system, the radius of the first zero represents the\n    limiting angular resolution and is approximately 1.22 * lambda / D,\n    where lambda is the wavelength of the light and D is the diameter of\n    the aperture.\n\n    See [1]_ for more details about the Airy disk.\n\n    References\n    ----------\n    .. [1] https://en.wikipedia.org/wiki/Airy_disk\n    ","endLoc":2780,"id":13465,"nodeType":"Class","startLoc":2685,"text":"class AiryDisk2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional Airy disk model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the Airy function.\n    x_0 : float\n        x position of the maximum of the Airy function.\n    y_0 : float\n        y position of the maximum of the Airy function.\n    radius : float\n        The radius of the Airy disk (radius of the first zero).\n\n    See Also\n    --------\n    Box2D, TrapezoidDisk2D, Gaussian2D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(r) = A \\\\left[\\\\frac{2 J_1(\\\\frac{\\\\pi r}{R/R_z})}{\\\\frac{\\\\pi r}{R/R_z}}\\\\right]^2\n\n    Where :math:`J_1` is the first order Bessel function of the first\n    kind, :math:`r` is radial distance from the maximum of the Airy\n    function (:math:`r = \\\\sqrt{(x - x_0)^2 + (y - y_0)^2}`), :math:`R`\n    is the input ``radius`` parameter, and :math:`R_z =\n    1.2196698912665045`).\n\n    For an optical system, the radius of the first zero represents the\n    limiting angular resolution and is approximately 1.22 * lambda / D,\n    where lambda is the wavelength of the light and D is the diameter of\n    the aperture.\n\n    See [1]_ for more details about the Airy disk.\n\n    References\n    ----------\n    .. [1] https://en.wikipedia.org/wiki/Airy_disk\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude (peak value) of the Airy function\")\n    x_0 = Parameter(default=0, description=\"X position of the peak\")\n    y_0 = Parameter(default=0, description=\"Y position of the peak\")\n    radius = Parameter(default=1,\n                       description=\"The radius of the Airy disk (radius of first zero crossing)\")\n    _rz = None\n    _j1 = None\n\n    @classmethod\n    def evaluate(cls, x, y, amplitude, x_0, y_0, radius):\n        \"\"\"Two dimensional Airy model function\"\"\"\n\n        if cls._rz is None:\n            from scipy.special import j1, jn_zeros\n            cls._rz = jn_zeros(1, 1)[0] / np.pi\n            cls._j1 = j1\n\n        r = np.sqrt((x - x_0) ** 2 + (y - y_0) ** 2) / (radius / cls._rz)\n\n        if isinstance(r, Quantity):\n            # scipy function cannot handle Quantity, so turn into array.\n            r = r.to_value(u.dimensionless_unscaled)\n\n        # Since r can be zero, we have to take care to treat that case\n        # separately so as not to raise a numpy warning\n        z = np.ones(r.shape)\n        rt = np.pi * r[r > 0]\n        z[r > 0] = (2.0 * cls._j1(rt) / rt) ** 2\n\n        if isinstance(amplitude, Quantity):\n            # make z quantity too, otherwise in-place multiplication fails.\n            z = Quantity(z, u.dimensionless_unscaled, copy=False)\n\n        z *= amplitude\n        return z\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'radius': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"col":4,"comment":"Two dimensional Airy model function","endLoc":2762,"header":"@classmethod\n    def evaluate(cls, x, y, amplitude, x_0, y_0, radius)","id":13466,"name":"evaluate","nodeType":"Function","startLoc":2736,"text":"@classmethod\n    def evaluate(cls, x, y, amplitude, x_0, y_0, radius):\n        \"\"\"Two dimensional Airy model function\"\"\"\n\n        if cls._rz is None:\n            from scipy.special import j1, jn_zeros\n            cls._rz = jn_zeros(1, 1)[0] / np.pi\n            cls._j1 = j1\n\n        r = np.sqrt((x - x_0) ** 2 + (y - y_0) ** 2) / (radius / cls._rz)\n\n        if isinstance(r, Quantity):\n            # scipy function cannot handle Quantity, so turn into array.\n            r = r.to_value(u.dimensionless_unscaled)\n\n        # Since r can be zero, we have to take care to treat that case\n        # separately so as not to raise a numpy warning\n        z = np.ones(r.shape)\n        rt = np.pi * r[r > 0]\n        z[r > 0] = (2.0 * cls._j1(rt) / rt) ** 2\n\n        if isinstance(amplitude, Quantity):\n            # make z quantity too, otherwise in-place multiplication fails.\n            z = Quantity(z, u.dimensionless_unscaled, copy=False)\n\n        z *= amplitude\n        return z"},{"className":"Sky2Pix_HEALPixPolar","col":0,"comment":"\n    HEALPix polar, aka \"butterfly\" projection - pixel to sky.\n\n    Corresponds to the ``XPH`` projection in FITS WCS.\n    ","endLoc":1437,"id":13467,"nodeType":"Class","startLoc":1432,"text":"class Sky2Pix_HEALPixPolar(Sky2PixProjection, HEALPix):\n    r\"\"\"\n    HEALPix polar, aka \"butterfly\" projection - pixel to sky.\n\n    Corresponds to the ``XPH`` projection in FITS WCS.\n    \"\"\""},{"col":4,"comment":"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        ","endLoc":594,"header":"def fit_deriv(self, x, *params)","id":13468,"name":"fit_deriv","nodeType":"Function","startLoc":569,"text":"def fit_deriv(self, x, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        v = np.empty((self.degree + 1,) + x.shape, dtype=x.dtype)\n        v[0] = 1\n        if self.degree > 0:\n            x2 = 2 * x\n            v[1] = 2 * x\n            for i in range(2, self.degree + 1):\n                v[i] = x2 * v[i - 1] - 2 * (i - 1) * v[i - 2]\n        return np.rollaxis(v, 0, v.ndim)"},{"className":"AffineTransformation2D","col":0,"comment":"\n    Perform an affine transformation in 2 dimensions.\n\n    Parameters\n    ----------\n    matrix : array\n        A 2x2 matrix specifying the linear transformation to apply to the\n        inputs\n\n    translation : array\n        A 2D vector (given as either a 2x1 or 1x2 array) specifying a\n        translation to apply to the inputs\n\n    ","endLoc":1572,"id":13469,"nodeType":"Class","startLoc":1440,"text":"class AffineTransformation2D(Model):\n    \"\"\"\n    Perform an affine transformation in 2 dimensions.\n\n    Parameters\n    ----------\n    matrix : array\n        A 2x2 matrix specifying the linear transformation to apply to the\n        inputs\n\n    translation : array\n        A 2D vector (given as either a 2x1 or 1x2 array) specifying a\n        translation to apply to the inputs\n\n    \"\"\"\n    n_inputs = 2\n    n_outputs = 2\n\n    standard_broadcasting = False\n\n    _separable = False\n\n    matrix = Parameter(default=[[1.0, 0.0], [0.0, 1.0]])\n    translation = Parameter(default=[0.0, 0.0])\n\n    @matrix.validator\n    def matrix(self, value):\n        \"\"\"Validates that the input matrix is a 2x2 2D array.\"\"\"\n\n        if np.shape(value) != (2, 2):\n            raise InputParameterError(\n                \"Expected transformation matrix to be a 2x2 array\")\n\n    @translation.validator\n    def translation(self, value):\n        \"\"\"\n        Validates that the translation vector is a 2D vector.  This allows\n        either a \"row\" vector or a \"column\" vector where in the latter case the\n        resultant Numpy array has ``ndim=2`` but the shape is ``(1, 2)``.\n        \"\"\"\n\n        if not ((np.ndim(value) == 1 and np.shape(value) == (2,)) or\n                (np.ndim(value) == 2 and np.shape(value) == (1, 2))):\n            raise InputParameterError(\n                \"Expected translation vector to be a 2 element row or column \"\n                \"vector array\")\n\n    def __init__(self, matrix=matrix, translation=translation, **kwargs):\n        super().__init__(matrix=matrix, translation=translation, **kwargs)\n        self.inputs = (\"x\", \"y\")\n        self.outputs = (\"x\", \"y\")\n\n    @property\n    def inverse(self):\n        \"\"\"\n        Inverse transformation.\n\n        Raises `~astropy.modeling.InputParameterError` if the transformation cannot be inverted.\n        \"\"\"\n\n        det = np.linalg.det(self.matrix.value)\n\n        if det == 0:\n            raise InputParameterError(\n                \"Transformation matrix is singular; {} model does not \"\n                \"have an inverse\".format(self.__class__.__name__))\n\n        matrix = np.linalg.inv(self.matrix.value)\n        if self.matrix.unit is not None:\n            matrix = matrix * self.matrix.unit\n        # If matrix has unit then translation has unit, so no need to assign it.\n        translation = -np.dot(matrix, self.translation.value)\n        return self.__class__(matrix=matrix, translation=translation)\n\n    @classmethod\n    def evaluate(cls, x, y, matrix, translation):\n        \"\"\"\n        Apply the transformation to a set of 2D Cartesian coordinates given as\n        two lists--one for the x coordinates and one for a y coordinates--or a\n        single coordinate pair.\n\n        Parameters\n        ----------\n        x, y : array, float\n              x and y coordinates\n        \"\"\"\n        if x.shape != y.shape:\n            raise ValueError(\"Expected input arrays to have the same shape\")\n\n        shape = x.shape or (1,)\n        # Use asarray to ensure loose the units.\n        inarr = np.vstack([np.asarray(x).ravel(),\n                           np.asarray(y).ravel(),\n                           np.ones(x.size, x.dtype)])\n\n        if inarr.shape[0] != 3 or inarr.ndim != 2:\n            raise ValueError(\"Incompatible input shapes\")\n\n        augmented_matrix = cls._create_augmented_matrix(matrix, translation)\n        result = np.dot(augmented_matrix, inarr)\n        x, y = result[0], result[1]\n        x.shape = y.shape = shape\n\n        return x, y\n\n    @staticmethod\n    def _create_augmented_matrix(matrix, translation):\n        unit = None\n        if any([hasattr(translation, 'unit'), hasattr(matrix, 'unit')]):\n            if not all([hasattr(translation, 'unit'), hasattr(matrix, 'unit')]):\n                raise ValueError(\"To use AffineTransformation with quantities, \"\n                                 \"both matrix and unit need to be quantities.\")\n            unit = translation.unit\n            # matrix should have the same units as translation\n            if not (matrix.unit / translation.unit) == u.dimensionless_unscaled:\n                raise ValueError(\"matrix and translation must have the same units.\")\n\n        augmented_matrix = np.empty((3, 3), dtype=float)\n        augmented_matrix[0:2, 0:2] = matrix\n        augmented_matrix[0:2, 2:].flat = translation\n        augmented_matrix[2] = [0, 0, 1]\n        if unit is not None:\n            return augmented_matrix * unit\n        return augmented_matrix\n\n    @property\n    def input_units(self):\n        if self.translation.unit is None and self.matrix.unit is None:\n            return None\n        elif self.translation.unit is not None:\n            return dict(zip(self.inputs, [self.translation.unit] * 2))\n        else:\n            return dict(zip(self.inputs, [self.matrix.unit] * 2))"},{"col":4,"comment":"null","endLoc":218,"header":"def __array_finalize__(self, obj)","id":13470,"name":"__array_finalize__","nodeType":"Function","startLoc":213,"text":"def __array_finalize__(self, obj):\n        for attr in ('_abbrev', '_name', '_value', '_unit_string',\n                     '_uncertainty', '_reference', '_system'):\n            setattr(self, attr, getattr(obj, attr, None))\n\n        self._checked_units = getattr(obj, '_checked_units', False)"},{"attributeType":"null","col":4,"comment":"null","endLoc":83,"id":13471,"name":"_registry","nodeType":"Attribute","startLoc":83,"text":"_registry"},{"attributeType":"null","col":4,"comment":"null","endLoc":84,"id":13472,"name":"_has_incompatible_units","nodeType":"Attribute","startLoc":84,"text":"_has_incompatible_units"},{"col":4,"comment":"Validates that the input matrix is a 2x2 2D array.","endLoc":1471,"header":"@matrix.validator\n    def matrix(self, value)","id":13473,"name":"matrix","nodeType":"Function","startLoc":1465,"text":"@matrix.validator\n    def matrix(self, value):\n        \"\"\"Validates that the input matrix is a 2x2 2D array.\"\"\"\n\n        if np.shape(value) != (2, 2):\n            raise InputParameterError(\n                \"Expected transformation matrix to be a 2x2 array\")"},{"attributeType":"function","col":4,"comment":"null","endLoc":146,"id":13474,"name":"__deepcopy__","nodeType":"Attribute","startLoc":146,"text":"__deepcopy__"},{"col":4,"comment":"null","endLoc":601,"header":"def prepare_inputs(self, x, **kwargs)","id":13475,"name":"prepare_inputs","nodeType":"Function","startLoc":596,"text":"def prepare_inputs(self, x, **kwargs):\n        inputs, broadcasted_shapes = super().prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), broadcasted_shapes"},{"attributeType":"function","col":19,"comment":"null","endLoc":146,"id":13476,"name":"__copy__","nodeType":"Attribute","startLoc":146,"text":"__copy__"},{"col":4,"comment":"null","endLoc":606,"header":"def evaluate(self, x, *coeffs)","id":13477,"name":"evaluate","nodeType":"Function","startLoc":603,"text":"def evaluate(self, x, *coeffs):\n        if self.domain is not None:\n            x = poly_map_domain(x, self.domain, self.window)\n        return self.clenshaw(x, coeffs)"},{"attributeType":"null","col":12,"comment":"null","endLoc":89,"id":13478,"name":"reference","nodeType":"Attribute","startLoc":89,"text":"reference"},{"attributeType":"null","col":8,"comment":"null","endLoc":114,"id":13479,"name":"_uncertainty","nodeType":"Attribute","startLoc":114,"text":"inst._uncertainty"},{"col":4,"comment":"\n        Validates that the translation vector is a 2D vector.  This allows\n        either a \"row\" vector or a \"column\" vector where in the latter case the\n        resultant Numpy array has ``ndim=2`` but the shape is ``(1, 2)``.\n        ","endLoc":1485,"header":"@translation.validator\n    def translation(self, value)","id":13480,"name":"translation","nodeType":"Function","startLoc":1473,"text":"@translation.validator\n    def translation(self, value):\n        \"\"\"\n        Validates that the translation vector is a 2D vector.  This allows\n        either a \"row\" vector or a \"column\" vector where in the latter case the\n        resultant Numpy array has ``ndim=2`` but the shape is ``(1, 2)``.\n        \"\"\"\n\n        if not ((np.ndim(value) == 1 and np.shape(value) == (2,)) or\n                (np.ndim(value) == 2 and np.shape(value) == (1, 2))):\n            raise InputParameterError(\n                \"Expected translation vector to be a 2 element row or column \"\n                \"vector array\")"},{"attributeType":"null","col":8,"comment":"null","endLoc":115,"id":13481,"name":"_reference","nodeType":"Attribute","startLoc":115,"text":"inst._reference"},{"attributeType":"null","col":8,"comment":"null","endLoc":113,"id":13482,"name":"_unit_string","nodeType":"Attribute","startLoc":113,"text":"inst._unit_string"},{"attributeType":"null","col":8,"comment":"null","endLoc":116,"id":13483,"name":"_system","nodeType":"Attribute","startLoc":116,"text":"inst._system"},{"attributeType":"null","col":8,"comment":"null","endLoc":111,"id":13484,"name":"_name","nodeType":"Attribute","startLoc":111,"text":"inst._name"},{"attributeType":"null","col":8,"comment":"null","endLoc":93,"id":13485,"name":"instances","nodeType":"Attribute","startLoc":93,"text":"instances"},{"attributeType":"null","col":8,"comment":"null","endLoc":96,"id":13486,"name":"inst","nodeType":"Attribute","startLoc":96,"text":"inst"},{"attributeType":"null","col":8,"comment":"null","endLoc":110,"id":13487,"name":"_abbrev","nodeType":"Attribute","startLoc":110,"text":"inst._abbrev"},{"attributeType":"null","col":8,"comment":"null","endLoc":92,"id":13488,"name":"name_lower","nodeType":"Attribute","startLoc":92,"text":"name_lower"},{"attributeType":"null","col":8,"comment":"null","endLoc":112,"id":13489,"name":"_value","nodeType":"Attribute","startLoc":112,"text":"inst._value"},{"col":4,"comment":"null","endLoc":626,"header":"@staticmethod\n    def clenshaw(x, coeffs)","id":13490,"name":"clenshaw","nodeType":"Function","startLoc":608,"text":"@staticmethod\n    def clenshaw(x, coeffs):\n        x2 = x * 2\n        if len(coeffs) == 1:\n            c0 = coeffs[0]\n            c1 = 0\n        elif len(coeffs) == 2:\n            c0 = coeffs[0]\n            c1 = coeffs[1]\n        else:\n            nd = len(coeffs)\n            c0 = coeffs[-2]\n            c1 = coeffs[-1]\n            for i in range(3, len(coeffs) + 1):\n                temp = c0\n                nd = nd - 1\n                c0 = coeffs[-i] - c1 * (2 * (nd - 1))\n                c1 = temp + c1 * x2\n        return c0 + c1 * x2"},{"attributeType":"null","col":4,"comment":"null","endLoc":558,"id":13491,"name":"n_inputs","nodeType":"Attribute","startLoc":558,"text":"n_inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":559,"id":13492,"name":"n_outputs","nodeType":"Attribute","startLoc":559,"text":"n_outputs"},{"col":4,"comment":"null","endLoc":1490,"header":"def __init__(self, matrix=matrix, translation=translation, **kwargs)","id":13493,"name":"__init__","nodeType":"Function","startLoc":1487,"text":"def __init__(self, matrix=matrix, translation=translation, **kwargs):\n        super().__init__(matrix=matrix, translation=translation, **kwargs)\n        self.inputs = (\"x\", \"y\")\n        self.outputs = (\"x\", \"y\")"},{"attributeType":"null","col":4,"comment":"null","endLoc":561,"id":13494,"name":"_separable","nodeType":"Attribute","startLoc":561,"text":"_separable"},{"className":"Hermite2D","col":0,"comment":"\n    Bivariate Hermite series.\n\n    It is defined as\n\n    .. math:: P_{nm}(x,y) = \\sum_{n,m=0}^{n=d,m=d}C_{nm} H_n(x) H_m(y)\n\n    where ``H_n(x)`` and ``H_m(y)`` are Hermite polynomials.\n\n    For explanation of ``x_domain``, ``y_domain``, ``x_window`` and ``y_window``\n    see :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : tuple or None, optional\n        domain of the x independent variable\n    y_domain : tuple or None, optional\n        domain of the y independent variable\n    x_window : tuple or None, optional\n        range of the x independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    y_window : tuple or None, optional\n        range of the y independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n\n    Notes\n    -----\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Hermite polynomials is a polynomial in x and/or y - since the\n    coefficients within each Hermite polynomial are fixed, we can't use\n    quantities for x and/or y since the units would not be compatible. For\n    example, the third Hermite polynomial (H2) is 4x^2-2, but if x was\n    specified with units, 4x^2 and -2 would have incompatible units.\n    ","endLoc":757,"id":13495,"nodeType":"Class","startLoc":629,"text":"class Hermite2D(OrthoPolynomialBase):\n    r\"\"\"\n    Bivariate Hermite series.\n\n    It is defined as\n\n    .. math:: P_{nm}(x,y) = \\sum_{n,m=0}^{n=d,m=d}C_{nm} H_n(x) H_m(y)\n\n    where ``H_n(x)`` and ``H_m(y)`` are Hermite polynomials.\n\n    For explanation of ``x_domain``, ``y_domain``, ``x_window`` and ``y_window``\n    see :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : tuple or None, optional\n        domain of the x independent variable\n    y_domain : tuple or None, optional\n        domain of the y independent variable\n    x_window : tuple or None, optional\n        range of the x independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    y_window : tuple or None, optional\n        range of the y independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n\n    Notes\n    -----\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Hermite polynomials is a polynomial in x and/or y - since the\n    coefficients within each Hermite polynomial are fixed, we can't use\n    quantities for x and/or y since the units would not be compatible. For\n    example, the third Hermite polynomial (H2) is 4x^2-2, but if x was\n    specified with units, 4x^2 and -2 would have incompatible units.\n    \"\"\"\n    _separable = False\n\n    def __init__(self, x_degree, y_degree, x_domain=None, x_window=None,\n                 y_domain=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            x_degree, y_degree, x_domain=x_domain, y_domain=y_domain,\n            x_window=x_window, y_window=y_window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)\n\n    def _fcache(self, x, y):\n        \"\"\"\n        Calculate the individual Hermite functions once and store them in a\n        dictionary to be reused.\n        \"\"\"\n\n        x_terms = self.x_degree + 1\n        y_terms = self.y_degree + 1\n        kfunc = {}\n        kfunc[0] = np.ones(x.shape)\n        kfunc[1] = 2 * x.copy()\n        kfunc[x_terms] = np.ones(y.shape)\n        kfunc[x_terms + 1] = 2 * y.copy()\n        for n in range(2, x_terms):\n            kfunc[n] = 2 * x * kfunc[n - 1] - 2 * (n - 1) * kfunc[n - 2]\n        for n in range(x_terms + 2, x_terms + y_terms):\n            kfunc[n] = 2 * y * kfunc[n - 1] - 2 * (n - 1) * kfunc[n - 2]\n        return kfunc\n\n    def fit_deriv(self, x, y, *params):\n        \"\"\"\n        Derivatives with respect to the coefficients.\n\n        This is an array with Hermite polynomials:\n\n        .. math::\n\n            H_{x_0}H_{y_0}, H_{x_1}H_{y_0}...H_{x_n}H_{y_0}...H_{x_n}H_{y_m}\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        y : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        if x.shape != y.shape:\n            raise ValueError(\"x and y must have the same shape\")\n\n        x = x.flatten()\n        y = y.flatten()\n        x_deriv = self._hermderiv1d(x, self.x_degree + 1).T\n        y_deriv = self._hermderiv1d(y, self.y_degree + 1).T\n\n        ij = []\n        for i in range(self.y_degree + 1):\n            for j in range(self.x_degree + 1):\n                ij.append(x_deriv[j] * y_deriv[i])\n\n        v = np.array(ij)\n        return v.T\n\n    def _hermderiv1d(self, x, deg):\n        \"\"\"\n        Derivative of 1D Hermite series\n        \"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        d = np.empty((deg + 1, len(x)), dtype=x.dtype)\n        d[0] = x * 0 + 1\n        if deg > 0:\n            x2 = 2 * x\n            d[1] = x2\n            for i in range(2, deg + 1):\n                d[i] = x2 * d[i - 1] - 2 * (i - 1) * d[i - 2]\n        return np.rollaxis(d, 0, d.ndim)"},{"col":4,"comment":"null","endLoc":682,"header":"def __init__(self, x_degree, y_degree, x_domain=None, x_window=None,\n                 y_domain=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":13496,"name":"__init__","nodeType":"Function","startLoc":676,"text":"def __init__(self, x_degree, y_degree, x_domain=None, x_window=None,\n                 y_domain=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            x_degree, y_degree, x_domain=x_domain, y_domain=y_domain,\n            x_window=x_window, y_window=y_window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)"},{"attributeType":"null","col":8,"comment":"null","endLoc":118,"id":13497,"name":"_checked_units","nodeType":"Attribute","startLoc":118,"text":"inst._checked_units"},{"attributeType":"null","col":4,"comment":"null","endLoc":11,"id":13498,"name":"_nm","nodeType":"Attribute","startLoc":11,"text":"_nm"},{"col":4,"comment":"null","endLoc":2769,"header":"@property\n    def input_units(self)","id":13499,"name":"input_units","nodeType":"Function","startLoc":2764,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}"},{"col":4,"comment":"null","endLoc":2780,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13500,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2771,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'radius': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":9,"comment":"null","endLoc":11,"id":13501,"name":"_c","nodeType":"Attribute","startLoc":11,"text":"_c"},{"col":0,"comment":"","endLoc":5,"header":"si.py#<anonymous>","id":13502,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nAstronomical and physics constants in SI units.  See :mod:`astropy.constants`\nfor a complete listing of constants defined in Astropy.\n\"\"\"\n\nfor _nm, _c in itertools.chain(sorted(vars(codata).items()),\n                               sorted(vars(iaudata).items())):\n    if (isinstance(_c, Constant) and _c.abbrev not in locals()\n            and _c.system == 'si'):\n        locals()[_c.abbrev] = _c"},{"col":4,"comment":"\n        Calculate the individual Hermite functions once and store them in a\n        dictionary to be reused.\n        ","endLoc":701,"header":"def _fcache(self, x, y)","id":13503,"name":"_fcache","nodeType":"Function","startLoc":684,"text":"def _fcache(self, x, y):\n        \"\"\"\n        Calculate the individual Hermite functions once and store them in a\n        dictionary to be reused.\n        \"\"\"\n\n        x_terms = self.x_degree + 1\n        y_terms = self.y_degree + 1\n        kfunc = {}\n        kfunc[0] = np.ones(x.shape)\n        kfunc[1] = 2 * x.copy()\n        kfunc[x_terms] = np.ones(y.shape)\n        kfunc[x_terms + 1] = 2 * y.copy()\n        for n in range(2, x_terms):\n            kfunc[n] = 2 * x * kfunc[n - 1] - 2 * (n - 1) * kfunc[n - 2]\n        for n in range(x_terms + 2, x_terms + y_terms):\n            kfunc[n] = 2 * y * kfunc[n - 1] - 2 * (n - 1) * kfunc[n - 2]\n        return kfunc"},{"attributeType":"null","col":4,"comment":"null","endLoc":2728,"id":13504,"name":"amplitude","nodeType":"Attribute","startLoc":2728,"text":"amplitude"},{"attributeType":"null","col":4,"comment":"null","endLoc":2729,"id":13505,"name":"x_0","nodeType":"Attribute","startLoc":2729,"text":"x_0"},{"fileName":"cgs.py","filePath":"astropy/constants","id":13506,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nAstronomical and physics constants in cgs units.  See :mod:`astropy.constants`\nfor a complete listing of constants defined in Astropy.\n\"\"\"\nimport itertools\n\nfrom .config import codata, iaudata\nfrom .constant import Constant\n\nfor _nm, _c in itertools.chain(sorted(vars(codata).items()),\n                               sorted(vars(iaudata).items())):\n    if (isinstance(_c, Constant) and _c.abbrev not in locals()\n            and _c.system in ['esu', 'gauss', 'emu']):\n        locals()[_c.abbrev] = _c\n"},{"col":4,"comment":"\n        Derivatives with respect to the coefficients.\n\n        This is an array with Hermite polynomials:\n\n        .. math::\n\n            H_{x_0}H_{y_0}, H_{x_1}H_{y_0}...H_{x_n}H_{y_0}...H_{x_n}H_{y_m}\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        y : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        ","endLoc":742,"header":"def fit_deriv(self, x, y, *params)","id":13507,"name":"fit_deriv","nodeType":"Function","startLoc":703,"text":"def fit_deriv(self, x, y, *params):\n        \"\"\"\n        Derivatives with respect to the coefficients.\n\n        This is an array with Hermite polynomials:\n\n        .. math::\n\n            H_{x_0}H_{y_0}, H_{x_1}H_{y_0}...H_{x_n}H_{y_0}...H_{x_n}H_{y_m}\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        y : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        if x.shape != y.shape:\n            raise ValueError(\"x and y must have the same shape\")\n\n        x = x.flatten()\n        y = y.flatten()\n        x_deriv = self._hermderiv1d(x, self.x_degree + 1).T\n        y_deriv = self._hermderiv1d(y, self.y_degree + 1).T\n\n        ij = []\n        for i in range(self.y_degree + 1):\n            for j in range(self.x_degree + 1):\n                ij.append(x_deriv[j] * y_deriv[i])\n\n        v = np.array(ij)\n        return v.T"},{"attributeType":"null","col":4,"comment":"null","endLoc":2730,"id":13508,"name":"y_0","nodeType":"Attribute","startLoc":2730,"text":"y_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":2731,"id":13509,"name":"radius","nodeType":"Attribute","startLoc":2731,"text":"radius"},{"col":4,"comment":"\n        Inverse transformation.\n\n        Raises `~astropy.modeling.InputParameterError` if the transformation cannot be inverted.\n        ","endLoc":1512,"header":"@property\n    def inverse(self)","id":13510,"name":"inverse","nodeType":"Function","startLoc":1492,"text":"@property\n    def inverse(self):\n        \"\"\"\n        Inverse transformation.\n\n        Raises `~astropy.modeling.InputParameterError` if the transformation cannot be inverted.\n        \"\"\"\n\n        det = np.linalg.det(self.matrix.value)\n\n        if det == 0:\n            raise InputParameterError(\n                \"Transformation matrix is singular; {} model does not \"\n                \"have an inverse\".format(self.__class__.__name__))\n\n        matrix = np.linalg.inv(self.matrix.value)\n        if self.matrix.unit is not None:\n            matrix = matrix * self.matrix.unit\n        # If matrix has unit then translation has unit, so no need to assign it.\n        translation = -np.dot(matrix, self.translation.value)\n        return self.__class__(matrix=matrix, translation=translation)"},{"attributeType":"null","col":4,"comment":"null","endLoc":2733,"id":13511,"name":"_rz","nodeType":"Attribute","startLoc":2733,"text":"_rz"},{"attributeType":"null","col":4,"comment":"null","endLoc":11,"id":13512,"name":"_nm","nodeType":"Attribute","startLoc":11,"text":"_nm"},{"attributeType":"null","col":4,"comment":"null","endLoc":2734,"id":13513,"name":"_j1","nodeType":"Attribute","startLoc":2734,"text":"_j1"},{"col":4,"comment":"null","endLoc":1429,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13514,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1426,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'intercept': outputs_unit['z'],\n                'slope_x': outputs_unit['z'] / inputs_unit['x'],\n                'slope_y': outputs_unit['z'] / inputs_unit['y']}"},{"attributeType":"null","col":12,"comment":"null","endLoc":2742,"id":13515,"name":"_rz","nodeType":"Attribute","startLoc":2742,"text":"cls._rz"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1406,"id":13516,"name":"slope_x","nodeType":"Attribute","startLoc":1406,"text":"slope_x"},{"attributeType":"null","col":12,"comment":"null","endLoc":2743,"id":13517,"name":"_j1","nodeType":"Attribute","startLoc":2743,"text":"cls._j1"},{"attributeType":"null","col":9,"comment":"null","endLoc":11,"id":13518,"name":"_c","nodeType":"Attribute","startLoc":11,"text":"_c"},{"col":0,"comment":"","endLoc":5,"header":"cgs.py#<anonymous>","id":13519,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nAstronomical and physics constants in cgs units.  See :mod:`astropy.constants`\nfor a complete listing of constants defined in Astropy.\n\"\"\"\n\nfor _nm, _c in itertools.chain(sorted(vars(codata).items()),\n                               sorted(vars(iaudata).items())):\n    if (isinstance(_c, Constant) and _c.abbrev not in locals()\n            and _c.system in ['esu', 'gauss', 'emu']):\n        locals()[_c.abbrev] = _c"},{"className":"Moffat2D","col":0,"comment":"\n    Two dimensional Moffat model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the model.\n    x_0 : float\n        x position of the maximum of the Moffat model.\n    y_0 : float\n        y position of the maximum of the Moffat model.\n    gamma : float\n        Core width of the Moffat model.\n    alpha : float\n        Power index of the Moffat model.\n\n    See Also\n    --------\n    Gaussian2D, Box2D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        f(x, y) = A \\left(1 + \\frac{\\left(x - x_{0}\\right)^{2} +\n        \\left(y - y_{0}\\right)^{2}}{\\gamma^{2}}\\right)^{- \\alpha}\n    ","endLoc":2962,"id":13520,"nodeType":"Class","startLoc":2877,"text":"class Moffat2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional Moffat model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the model.\n    x_0 : float\n        x position of the maximum of the Moffat model.\n    y_0 : float\n        y position of the maximum of the Moffat model.\n    gamma : float\n        Core width of the Moffat model.\n    alpha : float\n        Power index of the Moffat model.\n\n    See Also\n    --------\n    Gaussian2D, Box2D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        f(x, y) = A \\\\left(1 + \\\\frac{\\\\left(x - x_{0}\\\\right)^{2} +\n        \\\\left(y - y_{0}\\\\right)^{2}}{\\\\gamma^{2}}\\\\right)^{- \\\\alpha}\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Amplitude (peak value) of the model\")\n    x_0 = Parameter(default=0, description=\"X position of the maximum of the Moffat model\")\n    y_0 = Parameter(default=0, description=\"Y position of the maximum of the Moffat model\")\n    gamma = Parameter(default=1, description=\"Core width of the Moffat model\")\n    alpha = Parameter(default=1, description=\"Power index of the Moffat model\")\n\n    @property\n    def fwhm(self):\n        \"\"\"\n        Moffat full width at half maximum.\n        Derivation of the formula is available in\n        `this notebook by Yoonsoo Bach <https://nbviewer.jupyter.org/github/ysbach/AO_2017/blob/master/04_Ground_Based_Concept.ipynb#1.2.-Moffat>`_.\n        \"\"\"\n        return 2.0 * np.abs(self.gamma) * np.sqrt(2.0 ** (1.0 / self.alpha) - 1.0)\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, gamma, alpha):\n        \"\"\"Two dimensional Moffat model function\"\"\"\n\n        rr_gg = ((x - x_0) ** 2 + (y - y_0) ** 2) / gamma ** 2\n        return amplitude * (1 + rr_gg) ** (-alpha)\n\n    @staticmethod\n    def fit_deriv(x, y, amplitude, x_0, y_0, gamma, alpha):\n        \"\"\"Two dimensional Moffat model derivative with respect to parameters\"\"\"\n\n        rr_gg = ((x - x_0) ** 2 + (y - y_0) ** 2) / gamma ** 2\n        d_A = (1 + rr_gg) ** (-alpha)\n        d_x_0 = (2 * amplitude * alpha * d_A * (x - x_0) /\n                 (gamma ** 2 * (1 + rr_gg)))\n        d_y_0 = (2 * amplitude * alpha * d_A * (y - y_0) /\n                 (gamma ** 2 * (1 + rr_gg)))\n        d_alpha = -amplitude * d_A * np.log(1 + rr_gg)\n        d_gamma = (2 * amplitude * alpha * d_A * rr_gg /\n                   (gamma * (1 + rr_gg)))\n        return [d_A, d_x_0, d_y_0, d_gamma, d_alpha]\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {self.inputs[0]: self.x_0.unit,\n                    self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'gamma': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"col":4,"comment":"\n        Moffat full width at half maximum.\n        Derivation of the formula is available in\n        `this notebook by Yoonsoo Bach <https://nbviewer.jupyter.org/github/ysbach/AO_2017/blob/master/04_Ground_Based_Concept.ipynb#1.2.-Moffat>`_.\n        ","endLoc":2921,"header":"@property\n    def fwhm(self)","id":13521,"name":"fwhm","nodeType":"Function","startLoc":2914,"text":"@property\n    def fwhm(self):\n        \"\"\"\n        Moffat full width at half maximum.\n        Derivation of the formula is available in\n        `this notebook by Yoonsoo Bach <https://nbviewer.jupyter.org/github/ysbach/AO_2017/blob/master/04_Ground_Based_Concept.ipynb#1.2.-Moffat>`_.\n        \"\"\"\n        return 2.0 * np.abs(self.gamma) * np.sqrt(2.0 ** (1.0 / self.alpha) - 1.0)"},{"col":4,"comment":"Two dimensional Moffat model function","endLoc":2928,"header":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, gamma, alpha)","id":13522,"name":"evaluate","nodeType":"Function","startLoc":2923,"text":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, gamma, alpha):\n        \"\"\"Two dimensional Moffat model function\"\"\"\n\n        rr_gg = ((x - x_0) ** 2 + (y - y_0) ** 2) / gamma ** 2\n        return amplitude * (1 + rr_gg) ** (-alpha)"},{"col":4,"comment":"Two dimensional Moffat model derivative with respect to parameters","endLoc":2943,"header":"@staticmethod\n    def fit_deriv(x, y, amplitude, x_0, y_0, gamma, alpha)","id":13523,"name":"fit_deriv","nodeType":"Function","startLoc":2930,"text":"@staticmethod\n    def fit_deriv(x, y, amplitude, x_0, y_0, gamma, alpha):\n        \"\"\"Two dimensional Moffat model derivative with respect to parameters\"\"\"\n\n        rr_gg = ((x - x_0) ** 2 + (y - y_0) ** 2) / gamma ** 2\n        d_A = (1 + rr_gg) ** (-alpha)\n        d_x_0 = (2 * amplitude * alpha * d_A * (x - x_0) /\n                 (gamma ** 2 * (1 + rr_gg)))\n        d_y_0 = (2 * amplitude * alpha * d_A * (y - y_0) /\n                 (gamma ** 2 * (1 + rr_gg)))\n        d_alpha = -amplitude * d_A * np.log(1 + rr_gg)\n        d_gamma = (2 * amplitude * alpha * d_A * rr_gg /\n                   (gamma * (1 + rr_gg)))\n        return [d_A, d_x_0, d_y_0, d_gamma, d_alpha]"},{"col":4,"comment":"null","endLoc":2951,"header":"@property\n    def input_units(self)","id":13524,"name":"input_units","nodeType":"Function","startLoc":2945,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {self.inputs[0]: self.x_0.unit,\n                    self.inputs[1]: self.y_0.unit}"},{"col":4,"comment":"null","endLoc":2962,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13525,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2953,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'gamma': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"fileName":"codata2018.py","filePath":"astropy/constants","id":13526,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nAstronomical and physics constants in SI units.  See :mod:`astropy.constants`\nfor a complete listing of constants defined in Astropy.\n\"\"\"\nimport math\n\nfrom .constant import Constant, EMConstant\n\n# PHYSICAL CONSTANTS\n# https://en.wikipedia.org/wiki/2019_redefinition_of_SI_base_units\n\nclass CODATA2018(Constant):\n    default_reference = 'CODATA 2018'\n    _registry = {}\n    _has_incompatible_units = set()\n\n\nclass EMCODATA2018(CODATA2018, EMConstant):\n    _registry = CODATA2018._registry\n\n\nh = CODATA2018('h', \"Planck constant\", 6.62607015e-34,\n               'J s', 0.0, system='si')\n\nhbar = CODATA2018('hbar', \"Reduced Planck constant\", h.value / (2 * math.pi),\n                  'J s', 0.0, system='si')\n\nk_B = CODATA2018('k_B', \"Boltzmann constant\", 1.380649e-23,\n                 'J / (K)', 0.0, system='si')\n\nc = CODATA2018('c', \"Speed of light in vacuum\", 299792458.,\n               'm / (s)', 0.0, system='si')\n\n\nG = CODATA2018('G', \"Gravitational constant\", 6.67430e-11,\n               'm3 / (kg s2)', 0.00015e-11, system='si')\n\ng0 = CODATA2018('g0', \"Standard acceleration of gravity\", 9.80665,\n                'm / s2', 0.0, system='si')\n\nm_p = CODATA2018('m_p', \"Proton mass\", 1.67262192369e-27,\n                 'kg', 0.00000000051e-27, system='si')\n\nm_n = CODATA2018('m_n', \"Neutron mass\", 1.67492749804e-27,\n                 'kg', 0.00000000095e-27, system='si')\n\nm_e = CODATA2018('m_e', \"Electron mass\", 9.1093837015e-31,\n                 'kg', 0.0000000028e-31, system='si')\n\nu = CODATA2018('u', \"Atomic mass\", 1.66053906660e-27,\n               'kg', 0.00000000050e-27, system='si')\n\nsigma_sb = CODATA2018(\n    'sigma_sb', \"Stefan-Boltzmann constant\",\n    2 * math.pi ** 5 * k_B.value ** 4 / (15 * h.value ** 3 * c.value ** 2),\n    'W / (K4 m2)', 0.0, system='si')\n\ne = EMCODATA2018('e', 'Electron charge', 1.602176634e-19,\n                 'C', 0.0, system='si')\n\neps0 = EMCODATA2018('eps0', 'Vacuum electric permittivity', 8.8541878128e-12,\n                    'F/m', 0.0000000013e-12, system='si')\n\nN_A = CODATA2018('N_A', \"Avogadro's number\", 6.02214076e23,\n                 '1 / (mol)', 0.0, system='si')\n\nR = CODATA2018('R', \"Gas constant\", k_B.value * N_A.value,\n               'J / (K mol)', 0.0, system='si')\n\nRyd = CODATA2018('Ryd', 'Rydberg constant', 10973731.568160,\n                 '1 / (m)', 0.000021, system='si')\n\na0 = CODATA2018('a0', \"Bohr radius\", 5.29177210903e-11,\n                'm', 0.00000000080e-11, system='si')\n\nmuB = CODATA2018('muB', \"Bohr magneton\", 9.2740100783e-24,\n                 'J/T', 0.0000000028e-24, system='si')\n\nalpha = CODATA2018('alpha', \"Fine-structure constant\", 7.2973525693e-3,\n                   '', 0.0000000011e-3, system='si')\n\natm = CODATA2018('atm', \"Standard atmosphere\", 101325,\n                 'Pa', 0.0, system='si')\n\nmu0 = CODATA2018('mu0', \"Vacuum magnetic permeability\", 1.25663706212e-6,\n                 'N/A2', 0.00000000019e-6, system='si')\n\nsigma_T = CODATA2018('sigma_T', \"Thomson scattering cross-section\",\n                     6.6524587321e-29, 'm2', 0.0000000060e-29,\n                     system='si')\n\n# Formula taken from NIST wall chart.\n# The numerical factor is from a numerical solution to the equation for the\n# maximum. See https://en.wikipedia.org/wiki/Wien%27s_displacement_law\nb_wien = CODATA2018('b_wien', 'Wien wavelength displacement law constant',\n                    h.value * c.value / (k_B.value * 4.965114231744276), 'm K',\n                    0.0, system='si')\n\n# CGS constants.\n# Only constants that cannot be converted directly from S.I. are defined here.\n# Because both e and c are exact, these are also exact by definition.\n\ne_esu = EMCODATA2018(e.abbrev, e.name, e.value * c.value * 10.0,\n                     'statC', 0.0, system='esu')\n\ne_emu = EMCODATA2018(e.abbrev, e.name, e.value / 10, 'abC',\n                     0.0, system='emu')\n\ne_gauss = EMCODATA2018(e.abbrev, e.name, e.value * c.value * 10.0,\n                       'Fr', 0.0, system='gauss')\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":2908,"id":13527,"name":"amplitude","nodeType":"Attribute","startLoc":2908,"text":"amplitude"},{"attributeType":"null","col":4,"comment":"null","endLoc":2909,"id":13528,"name":"x_0","nodeType":"Attribute","startLoc":2909,"text":"x_0"},{"className":"EMConstant","col":0,"comment":"An electromagnetic constant.","endLoc":234,"id":13529,"nodeType":"Class","startLoc":221,"text":"class EMConstant(Constant):\n    \"\"\"An electromagnetic constant.\"\"\"\n\n    @property\n    def cgs(self):\n        \"\"\"Overridden for EMConstant to raise a `TypeError`\n        emphasizing that there are multiple EM extensions to CGS.\n        \"\"\"\n\n        raise TypeError(\"Cannot convert EM constants to cgs because there \"\n                        \"are different systems for E.M constants within the \"\n                        \"c.g.s system (ESU, Gaussian, etc.). Instead, \"\n                        \"directly use the constant with the appropriate \"\n                        \"suffix (e.g. e.esu, e.gauss, etc.).\")"},{"col":4,"comment":"Overridden for EMConstant to raise a `TypeError`\n        emphasizing that there are multiple EM extensions to CGS.\n        ","endLoc":234,"header":"@property\n    def cgs(self)","id":13530,"name":"cgs","nodeType":"Function","startLoc":224,"text":"@property\n    def cgs(self):\n        \"\"\"Overridden for EMConstant to raise a `TypeError`\n        emphasizing that there are multiple EM extensions to CGS.\n        \"\"\"\n\n        raise TypeError(\"Cannot convert EM constants to cgs because there \"\n                        \"are different systems for E.M constants within the \"\n                        \"c.g.s system (ESU, Gaussian, etc.). Instead, \"\n                        \"directly use the constant with the appropriate \"\n                        \"suffix (e.g. e.esu, e.gauss, etc.).\")"},{"className":"CODATA2018","col":0,"comment":"null","endLoc":16,"id":13531,"nodeType":"Class","startLoc":13,"text":"class CODATA2018(Constant):\n    default_reference = 'CODATA 2018'\n    _registry = {}\n    _has_incompatible_units = set()"},{"attributeType":"null","col":4,"comment":"null","endLoc":2910,"id":13532,"name":"y_0","nodeType":"Attribute","startLoc":2910,"text":"y_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":2911,"id":13533,"name":"gamma","nodeType":"Attribute","startLoc":2911,"text":"gamma"},{"col":4,"comment":"\n        Apply the transformation to a set of 2D Cartesian coordinates given as\n        two lists--one for the x coordinates and one for a y coordinates--or a\n        single coordinate pair.\n\n        Parameters\n        ----------\n        x, y : array, float\n              x and y coordinates\n        ","endLoc":1543,"header":"@classmethod\n    def evaluate(cls, x, y, matrix, translation)","id":13534,"name":"evaluate","nodeType":"Function","startLoc":1514,"text":"@classmethod\n    def evaluate(cls, x, y, matrix, translation):\n        \"\"\"\n        Apply the transformation to a set of 2D Cartesian coordinates given as\n        two lists--one for the x coordinates and one for a y coordinates--or a\n        single coordinate pair.\n\n        Parameters\n        ----------\n        x, y : array, float\n              x and y coordinates\n        \"\"\"\n        if x.shape != y.shape:\n            raise ValueError(\"Expected input arrays to have the same shape\")\n\n        shape = x.shape or (1,)\n        # Use asarray to ensure loose the units.\n        inarr = np.vstack([np.asarray(x).ravel(),\n                           np.asarray(y).ravel(),\n                           np.ones(x.size, x.dtype)])\n\n        if inarr.shape[0] != 3 or inarr.ndim != 2:\n            raise ValueError(\"Incompatible input shapes\")\n\n        augmented_matrix = cls._create_augmented_matrix(matrix, translation)\n        result = np.dot(augmented_matrix, inarr)\n        x, y = result[0], result[1]\n        x.shape = y.shape = shape\n\n        return x, y"},{"attributeType":"null","col":4,"comment":"null","endLoc":14,"id":13535,"name":"default_reference","nodeType":"Attribute","startLoc":14,"text":"default_reference"},{"attributeType":"null","col":4,"comment":"null","endLoc":2912,"id":13536,"name":"alpha","nodeType":"Attribute","startLoc":2912,"text":"alpha"},{"attributeType":"null","col":4,"comment":"null","endLoc":15,"id":13537,"name":"_registry","nodeType":"Attribute","startLoc":15,"text":"_registry"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":13538,"name":"_has_incompatible_units","nodeType":"Attribute","startLoc":16,"text":"_has_incompatible_units"},{"className":"EMCODATA2018","col":0,"comment":"null","endLoc":20,"id":13539,"nodeType":"Class","startLoc":19,"text":"class EMCODATA2018(CODATA2018, EMConstant):\n    _registry = CODATA2018._registry"},{"className":"Disk2D","col":0,"comment":"\n    Two dimensional radial symmetric Disk model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Value of the disk function\n    x_0 : float\n        x position center of the disk\n    y_0 : float\n        y position center of the disk\n    R_0 : float\n        Radius of the disk\n\n    See Also\n    --------\n    Box2D, TrapezoidDisk2D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math::\n\n            f(r) = \\left \\{\n                     \\begin{array}{ll}\n                       A & : r \\leq R_0 \\\\\n                       0 & : r > R_0\n                     \\end{array}\n                   \\right.\n    ","endLoc":2050,"id":13540,"nodeType":"Class","startLoc":1974,"text":"class Disk2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional radial symmetric Disk model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Value of the disk function\n    x_0 : float\n        x position center of the disk\n    y_0 : float\n        y position center of the disk\n    R_0 : float\n        Radius of the disk\n\n    See Also\n    --------\n    Box2D, TrapezoidDisk2D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math::\n\n            f(r) = \\\\left \\\\{\n                     \\\\begin{array}{ll}\n                       A & : r \\\\leq R_0 \\\\\\\\\n                       0 & : r > R_0\n                     \\\\end{array}\n                   \\\\right.\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Value of disk function\")\n    x_0 = Parameter(default=0, description=\"X position of center of the disk\")\n    y_0 = Parameter(default=0, description=\"Y position of center of the disk\")\n    R_0 = Parameter(default=1, description=\"Radius of the disk\")\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, R_0):\n        \"\"\"Two dimensional Disk model function\"\"\"\n\n        rr = (x - x_0) ** 2 + (y - y_0) ** 2\n        result = np.select([rr <= R_0 ** 2], [amplitude])\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        \"\"\"\n\n        return ((self.y_0 - self.R_0, self.y_0 + self.R_0),\n                (self.x_0 - self.R_0, self.x_0 + self.R_0))\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None and self.y_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'R_0': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":20,"id":13541,"name":"_registry","nodeType":"Attribute","startLoc":20,"text":"_registry"},{"col":4,"comment":"Two dimensional Disk model function","endLoc":2021,"header":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, R_0)","id":13542,"name":"evaluate","nodeType":"Function","startLoc":2012,"text":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, R_0):\n        \"\"\"Two dimensional Disk model function\"\"\"\n\n        rr = (x - x_0) ** 2 + (y - y_0) ** 2\n        result = np.select([rr <= R_0 ** 2], [amplitude])\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":23,"id":13543,"name":"h","nodeType":"Attribute","startLoc":23,"text":"h"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        ","endLoc":2032,"header":"@property\n    def bounding_box(self)","id":13544,"name":"bounding_box","nodeType":"Function","startLoc":2023,"text":"@property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        \"\"\"\n\n        return ((self.y_0 - self.R_0, self.y_0 + self.R_0),\n                (self.x_0 - self.R_0, self.x_0 + self.R_0))"},{"col":4,"comment":"null","endLoc":2039,"header":"@property\n    def input_units(self)","id":13545,"name":"input_units","nodeType":"Function","startLoc":2034,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None and self.y_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}"},{"col":4,"comment":"null","endLoc":2050,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13546,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2041,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'R_0': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":2007,"id":13547,"name":"amplitude","nodeType":"Attribute","startLoc":2007,"text":"amplitude"},{"attributeType":"null","col":4,"comment":"null","endLoc":2008,"id":13548,"name":"x_0","nodeType":"Attribute","startLoc":2008,"text":"x_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":2009,"id":13549,"name":"y_0","nodeType":"Attribute","startLoc":2009,"text":"y_0"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":26,"id":13550,"name":"hbar","nodeType":"Attribute","startLoc":26,"text":"hbar"},{"attributeType":"null","col":4,"comment":"null","endLoc":2010,"id":13551,"name":"R_0","nodeType":"Attribute","startLoc":2010,"text":"R_0"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":29,"id":13552,"name":"k_B","nodeType":"Attribute","startLoc":29,"text":"k_B"},{"col":4,"comment":"null","endLoc":1563,"header":"@staticmethod\n    def _create_augmented_matrix(matrix, translation)","id":13553,"name":"_create_augmented_matrix","nodeType":"Function","startLoc":1545,"text":"@staticmethod\n    def _create_augmented_matrix(matrix, translation):\n        unit = None\n        if any([hasattr(translation, 'unit'), hasattr(matrix, 'unit')]):\n            if not all([hasattr(translation, 'unit'), hasattr(matrix, 'unit')]):\n                raise ValueError(\"To use AffineTransformation with quantities, \"\n                                 \"both matrix and unit need to be quantities.\")\n            unit = translation.unit\n            # matrix should have the same units as translation\n            if not (matrix.unit / translation.unit) == u.dimensionless_unscaled:\n                raise ValueError(\"matrix and translation must have the same units.\")\n\n        augmented_matrix = np.empty((3, 3), dtype=float)\n        augmented_matrix[0:2, 0:2] = matrix\n        augmented_matrix[0:2, 2:].flat = translation\n        augmented_matrix[2] = [0, 0, 1]\n        if unit is not None:\n            return augmented_matrix * unit\n        return augmented_matrix"},{"col":4,"comment":"null","endLoc":1572,"header":"@property\n    def input_units(self)","id":13554,"name":"input_units","nodeType":"Function","startLoc":1565,"text":"@property\n    def input_units(self):\n        if self.translation.unit is None and self.matrix.unit is None:\n            return None\n        elif self.translation.unit is not None:\n            return dict(zip(self.inputs, [self.translation.unit] * 2))\n        else:\n            return dict(zip(self.inputs, [self.matrix.unit] * 2))"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":32,"id":13555,"name":"c","nodeType":"Attribute","startLoc":32,"text":"c"},{"className":"Ring2D","col":0,"comment":"\n    Two dimensional radial symmetric Ring model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Value of the disk function\n    x_0 : float\n        x position center of the disk\n    y_0 : float\n        y position center of the disk\n    r_in : float\n        Inner radius of the ring\n    width : float\n        Width of the ring.\n    r_out : float\n        Outer Radius of the ring. Can be specified instead of width.\n\n    See Also\n    --------\n    Disk2D, TrapezoidDisk2D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math::\n\n            f(r) = \\left \\{\n                     \\begin{array}{ll}\n                       A & : r_{in} \\leq r \\leq r_{out} \\\\\n                       0 & : \\text{else}\n                     \\end{array}\n                   \\right.\n\n    Where :math:`r_{out} = r_{in} + r_{width}`.\n    ","endLoc":2168,"id":13556,"nodeType":"Class","startLoc":2053,"text":"class Ring2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional radial symmetric Ring model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Value of the disk function\n    x_0 : float\n        x position center of the disk\n    y_0 : float\n        y position center of the disk\n    r_in : float\n        Inner radius of the ring\n    width : float\n        Width of the ring.\n    r_out : float\n        Outer Radius of the ring. Can be specified instead of width.\n\n    See Also\n    --------\n    Disk2D, TrapezoidDisk2D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math::\n\n            f(r) = \\\\left \\\\{\n                     \\\\begin{array}{ll}\n                       A & : r_{in} \\\\leq r \\\\leq r_{out} \\\\\\\\\n                       0 & : \\\\text{else}\n                     \\\\end{array}\n                   \\\\right.\n\n    Where :math:`r_{out} = r_{in} + r_{width}`.\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Value of the disk function\")\n    x_0 = Parameter(default=0, description=\"X position of center of disc\")\n    y_0 = Parameter(default=0, description=\"Y position of center of disc\")\n    r_in = Parameter(default=1, description=\"Inner radius of the ring\")\n    width = Parameter(default=1, description=\"Width of the ring\")\n\n    def __init__(self, amplitude=amplitude.default, x_0=x_0.default,\n                 y_0=y_0.default, r_in=None, width=None,\n                 r_out=None, **kwargs):\n        if (r_in is None) and (r_out is None) and (width is None):\n            r_in = self.r_in.default\n            width = self.width.default\n        elif (r_in is not None) and (r_out is None) and (width is None):\n            width = self.width.default\n        elif (r_in is None) and (r_out is not None) and (width is None):\n            r_in = self.r_in.default\n            width = r_out - r_in\n        elif (r_in is None) and (r_out is None) and (width is not None):\n            r_in = self.r_in.default\n        elif (r_in is not None) and (r_out is not None) and (width is None):\n            width = r_out - r_in\n        elif (r_in is None) and (r_out is not None) and (width is not None):\n            r_in = r_out - width\n        elif (r_in is not None) and (r_out is not None) and (width is not None):\n            if np.any(width != (r_out - r_in)):\n                raise InputParameterError(\"Width must be r_out - r_in\")\n\n        if np.any(r_in < 0) or np.any(width < 0):\n            raise InputParameterError(f\"{r_in=} and {width=} must both be >=0\")\n\n        super().__init__(\n            amplitude=amplitude, x_0=x_0, y_0=y_0, r_in=r_in, width=width,\n            **kwargs)\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, r_in, width):\n        \"\"\"Two dimensional Ring model function.\"\"\"\n\n        rr = (x - x_0) ** 2 + (y - y_0) ** 2\n        r_range = np.logical_and(rr >= r_in ** 2, rr <= (r_in + width) ** 2)\n        result = np.select([r_range], [amplitude])\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box``.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        \"\"\"\n\n        dr = self.r_in + self.width\n\n        return ((self.y_0 - dr, self.y_0 + dr),\n                (self.x_0 - dr, self.x_0 + dr))\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'r_in': inputs_unit[self.inputs[0]],\n                'width': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":1455,"id":13557,"name":"n_inputs","nodeType":"Attribute","startLoc":1455,"text":"n_inputs"},{"col":4,"comment":"Two dimensional Ring model function.","endLoc":2136,"header":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, r_in, width)","id":13558,"name":"evaluate","nodeType":"Function","startLoc":2126,"text":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, r_in, width):\n        \"\"\"Two dimensional Ring model function.\"\"\"\n\n        rr = (x - x_0) ** 2 + (y - y_0) ** 2\n        r_range = np.logical_and(rr >= r_in ** 2, rr <= (r_in + width) ** 2)\n        result = np.select([r_range], [amplitude])\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result"},{"attributeType":"null","col":4,"comment":"null","endLoc":1456,"id":13559,"name":"n_outputs","nodeType":"Attribute","startLoc":1456,"text":"n_outputs"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":36,"id":13560,"name":"G","nodeType":"Attribute","startLoc":36,"text":"G"},{"attributeType":"null","col":4,"comment":"null","endLoc":1458,"id":13561,"name":"standard_broadcasting","nodeType":"Attribute","startLoc":1458,"text":"standard_broadcasting"},{"attributeType":"null","col":4,"comment":"null","endLoc":1460,"id":13562,"name":"_separable","nodeType":"Attribute","startLoc":1460,"text":"_separable"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1462,"id":13563,"name":"matrix","nodeType":"Attribute","startLoc":1462,"text":"matrix"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1407,"id":13564,"name":"slope_y","nodeType":"Attribute","startLoc":1407,"text":"slope_y"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":39,"id":13565,"name":"g0","nodeType":"Attribute","startLoc":39,"text":"g0"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box``.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        ","endLoc":2149,"header":"@property\n    def bounding_box(self)","id":13566,"name":"bounding_box","nodeType":"Function","startLoc":2138,"text":"@property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box``.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        \"\"\"\n\n        dr = self.r_in + self.width\n\n        return ((self.y_0 - dr, self.y_0 + dr),\n                (self.x_0 - dr, self.x_0 + dr))"},{"col":4,"comment":"null","endLoc":2156,"header":"@property\n    def input_units(self)","id":13567,"name":"input_units","nodeType":"Function","startLoc":2151,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}"},{"col":4,"comment":"null","endLoc":2168,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13568,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2158,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'r_in': inputs_unit[self.inputs[0]],\n                'width': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":2092,"id":13569,"name":"amplitude","nodeType":"Attribute","startLoc":2092,"text":"amplitude"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":42,"id":13570,"name":"m_p","nodeType":"Attribute","startLoc":42,"text":"m_p"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":45,"id":13571,"name":"m_n","nodeType":"Attribute","startLoc":45,"text":"m_n"},{"attributeType":"null","col":4,"comment":"null","endLoc":2093,"id":13572,"name":"x_0","nodeType":"Attribute","startLoc":2093,"text":"x_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":2094,"id":13573,"name":"y_0","nodeType":"Attribute","startLoc":2094,"text":"y_0"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1463,"id":13574,"name":"translation","nodeType":"Attribute","startLoc":1463,"text":"translation"},{"attributeType":"null","col":4,"comment":"null","endLoc":2095,"id":13575,"name":"r_in","nodeType":"Attribute","startLoc":2095,"text":"r_in"},{"attributeType":"null","col":4,"comment":"null","endLoc":2096,"id":13576,"name":"width","nodeType":"Attribute","startLoc":2096,"text":"width"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":48,"id":13577,"name":"m_e","nodeType":"Attribute","startLoc":48,"text":"m_e"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":51,"id":13578,"name":"u","nodeType":"Attribute","startLoc":51,"text":"u"},{"className":"Sersic2D","col":0,"comment":"\n    Two dimensional Sersic surface brightness profile.\n\n    Parameters\n    ----------\n    amplitude : float\n        Surface brightness at r_eff.\n    r_eff : float\n        Effective (half-light) radius\n    n : float\n        Sersic Index.\n    x_0 : float, optional\n        x position of the center.\n    y_0 : float, optional\n        y position of the center.\n    ellip : float, optional\n        Ellipticity.\n    theta : float, optional\n        Rotation angle in radians, counterclockwise from\n        the positive x-axis.\n\n    See Also\n    --------\n    Gaussian2D, Moffat2D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        I(x,y) = I(r) = I_e\\exp\\left\\{-b_n\\left[\\left(\\frac{r}{r_{e}}\\right)^{(1/n)}-1\\right]\\right\\}\n\n    The constant :math:`b_n` is defined such that :math:`r_e` contains half the total\n    luminosity, and can be solved for numerically.\n\n    .. math::\n\n        \\Gamma(2n) = 2\\gamma (2n,b_n)\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        from astropy.modeling.models import Sersic2D\n        import matplotlib.pyplot as plt\n\n        x,y = np.meshgrid(np.arange(100), np.arange(100))\n\n        mod = Sersic2D(amplitude = 1, r_eff = 25, n=4, x_0=50, y_0=50,\n                       ellip=.5, theta=-1)\n        img = mod(x, y)\n        log_img = np.log10(img)\n\n\n        plt.figure()\n        plt.imshow(log_img, origin='lower', interpolation='nearest',\n                   vmin=-1, vmax=2)\n        plt.xlabel('x')\n        plt.ylabel('y')\n        cbar = plt.colorbar()\n        cbar.set_label('Log Brightness', rotation=270, labelpad=25)\n        cbar.set_ticks([-1, 0, 1, 2], update_ticks=True)\n        plt.show()\n\n    References\n    ----------\n    .. [1] http://ned.ipac.caltech.edu/level5/March05/Graham/Graham2.html\n    ","endLoc":3081,"id":13579,"nodeType":"Class","startLoc":2965,"text":"class Sersic2D(Fittable2DModel):\n    r\"\"\"\n    Two dimensional Sersic surface brightness profile.\n\n    Parameters\n    ----------\n    amplitude : float\n        Surface brightness at r_eff.\n    r_eff : float\n        Effective (half-light) radius\n    n : float\n        Sersic Index.\n    x_0 : float, optional\n        x position of the center.\n    y_0 : float, optional\n        y position of the center.\n    ellip : float, optional\n        Ellipticity.\n    theta : float, optional\n        Rotation angle in radians, counterclockwise from\n        the positive x-axis.\n\n    See Also\n    --------\n    Gaussian2D, Moffat2D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        I(x,y) = I(r) = I_e\\exp\\left\\{-b_n\\left[\\left(\\frac{r}{r_{e}}\\right)^{(1/n)}-1\\right]\\right\\}\n\n    The constant :math:`b_n` is defined such that :math:`r_e` contains half the total\n    luminosity, and can be solved for numerically.\n\n    .. math::\n\n        \\Gamma(2n) = 2\\gamma (2n,b_n)\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        from astropy.modeling.models import Sersic2D\n        import matplotlib.pyplot as plt\n\n        x,y = np.meshgrid(np.arange(100), np.arange(100))\n\n        mod = Sersic2D(amplitude = 1, r_eff = 25, n=4, x_0=50, y_0=50,\n                       ellip=.5, theta=-1)\n        img = mod(x, y)\n        log_img = np.log10(img)\n\n\n        plt.figure()\n        plt.imshow(log_img, origin='lower', interpolation='nearest',\n                   vmin=-1, vmax=2)\n        plt.xlabel('x')\n        plt.ylabel('y')\n        cbar = plt.colorbar()\n        cbar.set_label('Log Brightness', rotation=270, labelpad=25)\n        cbar.set_ticks([-1, 0, 1, 2], update_ticks=True)\n        plt.show()\n\n    References\n    ----------\n    .. [1] http://ned.ipac.caltech.edu/level5/March05/Graham/Graham2.html\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Surface brightness at r_eff\")\n    r_eff = Parameter(default=1, description=\"Effective (half-light) radius\")\n    n = Parameter(default=4, description=\"Sersic Index\")\n    x_0 = Parameter(default=0, description=\"X position of the center\")\n    y_0 = Parameter(default=0, description=\"Y position of the center\")\n    ellip = Parameter(default=0, description=\"Ellipticity\")\n    theta = Parameter(default=0, description=\"Rotation angle in radians (counterclockwise-positive)\")\n    _gammaincinv = None\n\n    @classmethod\n    def evaluate(cls, x, y, amplitude, r_eff, n, x_0, y_0, ellip, theta):\n        \"\"\"Two dimensional Sersic profile function.\"\"\"\n\n        if cls._gammaincinv is None:\n            from scipy.special import gammaincinv\n            cls._gammaincinv = gammaincinv\n\n        bn = cls._gammaincinv(2. * n, 0.5)\n        a, b = r_eff, (1 - ellip) * r_eff\n        cos_theta, sin_theta = np.cos(theta), np.sin(theta)\n        x_maj = (x - x_0) * cos_theta + (y - y_0) * sin_theta\n        x_min = -(x - x_0) * sin_theta + (y - y_0) * cos_theta\n        z = np.sqrt((x_maj / a) ** 2 + (x_min / b) ** 2)\n\n        return amplitude * np.exp(-bn * (z ** (1 / n) - 1))\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'r_eff': inputs_unit[self.inputs[0]],\n                'theta': u.rad,\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":8,"comment":"null","endLoc":1490,"id":13580,"name":"outputs","nodeType":"Attribute","startLoc":1490,"text":"self.outputs"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":54,"id":13581,"name":"sigma_sb","nodeType":"Attribute","startLoc":54,"text":"sigma_sb"},{"col":4,"comment":"Two dimensional Sersic profile function.","endLoc":3062,"header":"@classmethod\n    def evaluate(cls, x, y, amplitude, r_eff, n, x_0, y_0, ellip, theta)","id":13582,"name":"evaluate","nodeType":"Function","startLoc":3047,"text":"@classmethod\n    def evaluate(cls, x, y, amplitude, r_eff, n, x_0, y_0, ellip, theta):\n        \"\"\"Two dimensional Sersic profile function.\"\"\"\n\n        if cls._gammaincinv is None:\n            from scipy.special import gammaincinv\n            cls._gammaincinv = gammaincinv\n\n        bn = cls._gammaincinv(2. * n, 0.5)\n        a, b = r_eff, (1 - ellip) * r_eff\n        cos_theta, sin_theta = np.cos(theta), np.sin(theta)\n        x_maj = (x - x_0) * cos_theta + (y - y_0) * sin_theta\n        x_min = -(x - x_0) * sin_theta + (y - y_0) * cos_theta\n        z = np.sqrt((x_maj / a) ** 2 + (x_min / b) ** 2)\n\n        return amplitude * np.exp(-bn * (z ** (1 / n) - 1))"},{"attributeType":"null","col":8,"comment":"null","endLoc":1489,"id":13583,"name":"inputs","nodeType":"Attribute","startLoc":1489,"text":"self.inputs"},{"attributeType":"EMCODATA2018","col":0,"comment":"null","endLoc":59,"id":13584,"name":"e","nodeType":"Attribute","startLoc":59,"text":"e"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":13585,"name":"_PROJ_NAME_CODE","nodeType":"Attribute","startLoc":32,"text":"_PROJ_NAME_CODE"},{"attributeType":"null","col":0,"comment":"null","endLoc":62,"id":13586,"name":"_NOT_SUPPORTED_PROJ_CODES","nodeType":"Attribute","startLoc":62,"text":"_NOT_SUPPORTED_PROJ_CODES"},{"attributeType":"null","col":0,"comment":"null","endLoc":64,"id":13587,"name":"_PROJ_NAME_CODE_MAP","nodeType":"Attribute","startLoc":64,"text":"_PROJ_NAME_CODE_MAP"},{"attributeType":"EMCODATA2018","col":0,"comment":"null","endLoc":62,"id":13588,"name":"eps0","nodeType":"Attribute","startLoc":62,"text":"eps0"},{"attributeType":"null","col":0,"comment":"null","endLoc":66,"id":13589,"name":"projcodes","nodeType":"Attribute","startLoc":66,"text":"projcodes"},{"attributeType":"null","col":0,"comment":"null","endLoc":69,"id":13590,"name":"__all__","nodeType":"Attribute","startLoc":69,"text":"__all__"},{"attributeType":"null","col":4,"comment":"null","endLoc":1575,"id":13591,"name":"long_name","nodeType":"Attribute","startLoc":1575,"text":"long_name"},{"attributeType":"null","col":15,"comment":"null","endLoc":1575,"id":13592,"name":"short_name","nodeType":"Attribute","startLoc":1575,"text":"short_name"},{"col":0,"comment":"","endLoc":14,"header":"projections.py#<anonymous>","id":13593,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nImplements projections--particularly sky projections defined in WCS Paper II\n[1]_.\n\nAll angles are set and and displayed in degrees but internally computations are\nperformed in radians. All functions expect inputs and outputs degrees.\n\nReferences\n----------\n.. [1] Calabretta, M.R., Greisen, E.W., 2002, A&A, 395, 1077 (Paper II)\n\"\"\"\n\n_PROJ_NAME_CODE = [\n    ('ZenithalPerspective', 'AZP'),\n    ('SlantZenithalPerspective', 'SZP'),\n    ('Gnomonic', 'TAN'),\n    ('Stereographic', 'STG'),\n    ('SlantOrthographic', 'SIN'),\n    ('ZenithalEquidistant', 'ARC'),\n    ('ZenithalEqualArea', 'ZEA'),\n    ('Airy', 'AIR'),\n    ('CylindricalPerspective', 'CYP'),\n    ('CylindricalEqualArea', 'CEA'),\n    ('PlateCarree', 'CAR'),\n    ('Mercator', 'MER'),\n    ('SansonFlamsteed', 'SFL'),\n    ('Parabolic', 'PAR'),\n    ('Molleweide', 'MOL'),\n    ('HammerAitoff', 'AIT'),\n    ('ConicPerspective', 'COP'),\n    ('ConicEqualArea', 'COE'),\n    ('ConicEquidistant', 'COD'),\n    ('ConicOrthomorphic', 'COO'),\n    ('BonneEqualArea', 'BON'),\n    ('Polyconic', 'PCO'),\n    ('TangentialSphericalCube', 'TSC'),\n    ('COBEQuadSphericalCube', 'CSC'),\n    ('QuadSphericalCube', 'QSC'),\n    ('HEALPix', 'HPX'),\n    ('HEALPixPolar', 'XPH'),\n]\n\n_NOT_SUPPORTED_PROJ_CODES = ['ZPN']\n\n_PROJ_NAME_CODE_MAP = dict(_PROJ_NAME_CODE)\n\nprojcodes = [code for _, code in _PROJ_NAME_CODE]\n\n__all__ = [\n    'Projection', 'Pix2SkyProjection', 'Sky2PixProjection', 'Zenithal',\n    'Cylindrical', 'PseudoCylindrical', 'Conic', 'PseudoConic', 'QuadCube',\n    'HEALPix', 'AffineTransformation2D', 'projcodes'\n] + list(map('_'.join, product(['Pix2Sky', 'Sky2Pix'], chain(*_PROJ_NAME_CODE))))\n\nfor long_name, short_name in _PROJ_NAME_CODE:\n    # define short-name projection equivalent classes:\n    globals()['Pix2Sky_' + short_name] = globals()['Pix2Sky_' + long_name]\n    globals()['Sky2Pix_' + short_name] = globals()['Sky2Pix_' + long_name]\n    # set inverse classes:\n    globals()['Pix2Sky_' + long_name]._inv_cls = globals()['Sky2Pix_' + long_name]\n    globals()['Sky2Pix_' + long_name]._inv_cls = globals()['Pix2Sky_' + long_name]"},{"col":4,"comment":"null","endLoc":3069,"header":"@property\n    def input_units(self)","id":13594,"name":"input_units","nodeType":"Function","startLoc":3064,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}"},{"col":4,"comment":"null","endLoc":3081,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13595,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":3071,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'r_eff': inputs_unit[self.inputs[0]],\n                'theta': u.rad,\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":3038,"id":13596,"name":"amplitude","nodeType":"Attribute","startLoc":3038,"text":"amplitude"},{"attributeType":"null","col":4,"comment":"null","endLoc":3039,"id":13597,"name":"r_eff","nodeType":"Attribute","startLoc":3039,"text":"r_eff"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":65,"id":13598,"name":"N_A","nodeType":"Attribute","startLoc":65,"text":"N_A"},{"fileName":"utils.py","filePath":"astropy/constants","id":13599,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"Utility functions for ``constants`` sub-package.\"\"\"\nimport itertools\n\n__all__ = []\n\n\ndef _get_c(codata, iaudata, module, not_in_module_only=True):\n    \"\"\"\n    Generator to return a Constant object.\n\n    Parameters\n    ----------\n    codata, iaudata : obj\n        Modules containing CODATA and IAU constants of interest.\n\n    module : obj\n        Namespace module of interest.\n\n    not_in_module_only : bool\n        If ``True``, ignore constants that are already in the\n        namespace of ``module``.\n\n    Returns\n    -------\n    _c : Constant\n        Constant object to process.\n\n    \"\"\"\n    from .constant import Constant\n\n    for _nm, _c in itertools.chain(sorted(vars(codata).items()),\n                                   sorted(vars(iaudata).items())):\n        if not isinstance(_c, Constant):\n            continue\n        elif (not not_in_module_only) or (_c.abbrev not in module.__dict__):\n            yield _c\n\n\ndef _set_c(codata, iaudata, module, not_in_module_only=True, doclines=None,\n           set_class=False):\n    \"\"\"\n    Set constants in a given module namespace.\n\n    Parameters\n    ----------\n    codata, iaudata : obj\n        Modules containing CODATA and IAU constants of interest.\n\n    module : obj\n        Namespace module to modify with the given ``codata`` and ``iaudata``.\n\n    not_in_module_only : bool\n        If ``True``, constants that are already in the namespace\n        of ``module`` will not be modified.\n\n    doclines : list or None\n        If a list is given, this list will be modified in-place to include\n        documentation of modified constants. This can be used to update\n        docstring of ``module``.\n\n    set_class : bool\n        Namespace of ``module`` is populated with ``_c.__class__``\n        instead of just ``_c`` from :func:`_get_c`.\n\n    \"\"\"\n    for _c in _get_c(codata, iaudata, module,\n                     not_in_module_only=not_in_module_only):\n        if set_class:\n            value = _c.__class__(_c.abbrev, _c.name, _c.value,\n                                 _c._unit_string, _c.uncertainty,\n                                 _c.reference)\n        else:\n            value = _c\n\n        setattr(module, _c.abbrev, value)\n\n        if doclines is not None:\n            doclines.append('{:^10} {:^14.9g} {:^16} {}'.format(\n                _c.abbrev, _c.value, _c._unit_string, _c.name))\n"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":68,"id":13600,"name":"R","nodeType":"Attribute","startLoc":68,"text":"R"},{"attributeType":"null","col":4,"comment":"null","endLoc":3040,"id":13601,"name":"n","nodeType":"Attribute","startLoc":3040,"text":"n"},{"col":0,"comment":"\n    Generator to return a Constant object.\n\n    Parameters\n    ----------\n    codata, iaudata : obj\n        Modules containing CODATA and IAU constants of interest.\n\n    module : obj\n        Namespace module of interest.\n\n    not_in_module_only : bool\n        If ``True``, ignore constants that are already in the\n        namespace of ``module``.\n\n    Returns\n    -------\n    _c : Constant\n        Constant object to process.\n\n    ","endLoc":37,"header":"def _get_c(codata, iaudata, module, not_in_module_only=True)","id":13602,"name":"_get_c","nodeType":"Function","startLoc":8,"text":"def _get_c(codata, iaudata, module, not_in_module_only=True):\n    \"\"\"\n    Generator to return a Constant object.\n\n    Parameters\n    ----------\n    codata, iaudata : obj\n        Modules containing CODATA and IAU constants of interest.\n\n    module : obj\n        Namespace module of interest.\n\n    not_in_module_only : bool\n        If ``True``, ignore constants that are already in the\n        namespace of ``module``.\n\n    Returns\n    -------\n    _c : Constant\n        Constant object to process.\n\n    \"\"\"\n    from .constant import Constant\n\n    for _nm, _c in itertools.chain(sorted(vars(codata).items()),\n                                   sorted(vars(iaudata).items())):\n        if not isinstance(_c, Constant):\n            continue\n        elif (not not_in_module_only) or (_c.abbrev not in module.__dict__):\n            yield _c"},{"col":0,"comment":"\n    Set constants in a given module namespace.\n\n    Parameters\n    ----------\n    codata, iaudata : obj\n        Modules containing CODATA and IAU constants of interest.\n\n    module : obj\n        Namespace module to modify with the given ``codata`` and ``iaudata``.\n\n    not_in_module_only : bool\n        If ``True``, constants that are already in the namespace\n        of ``module`` will not be modified.\n\n    doclines : list or None\n        If a list is given, this list will be modified in-place to include\n        documentation of modified constants. This can be used to update\n        docstring of ``module``.\n\n    set_class : bool\n        Namespace of ``module`` is populated with ``_c.__class__``\n        instead of just ``_c`` from :func:`_get_c`.\n\n    ","endLoc":80,"header":"def _set_c(codata, iaudata, module, not_in_module_only=True, doclines=None,\n           set_class=False)","id":13603,"name":"_set_c","nodeType":"Function","startLoc":40,"text":"def _set_c(codata, iaudata, module, not_in_module_only=True, doclines=None,\n           set_class=False):\n    \"\"\"\n    Set constants in a given module namespace.\n\n    Parameters\n    ----------\n    codata, iaudata : obj\n        Modules containing CODATA and IAU constants of interest.\n\n    module : obj\n        Namespace module to modify with the given ``codata`` and ``iaudata``.\n\n    not_in_module_only : bool\n        If ``True``, constants that are already in the namespace\n        of ``module`` will not be modified.\n\n    doclines : list or None\n        If a list is given, this list will be modified in-place to include\n        documentation of modified constants. This can be used to update\n        docstring of ``module``.\n\n    set_class : bool\n        Namespace of ``module`` is populated with ``_c.__class__``\n        instead of just ``_c`` from :func:`_get_c`.\n\n    \"\"\"\n    for _c in _get_c(codata, iaudata, module,\n                     not_in_module_only=not_in_module_only):\n        if set_class:\n            value = _c.__class__(_c.abbrev, _c.name, _c.value,\n                                 _c._unit_string, _c.uncertainty,\n                                 _c.reference)\n        else:\n            value = _c\n\n        setattr(module, _c.abbrev, value)\n\n        if doclines is not None:\n            doclines.append('{:^10} {:^14.9g} {:^16} {}'.format(\n                _c.abbrev, _c.value, _c._unit_string, _c.name))"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":71,"id":13604,"name":"Ryd","nodeType":"Attribute","startLoc":71,"text":"Ryd"},{"attributeType":"null","col":4,"comment":"null","endLoc":3041,"id":13605,"name":"x_0","nodeType":"Attribute","startLoc":3041,"text":"x_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":3042,"id":13606,"name":"y_0","nodeType":"Attribute","startLoc":3042,"text":"y_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":3043,"id":13607,"name":"ellip","nodeType":"Attribute","startLoc":3043,"text":"ellip"},{"attributeType":"null","col":4,"comment":"null","endLoc":3044,"id":13608,"name":"theta","nodeType":"Attribute","startLoc":3044,"text":"theta"},{"attributeType":"null","col":4,"comment":"null","endLoc":3045,"id":13609,"name":"_gammaincinv","nodeType":"Attribute","startLoc":3045,"text":"_gammaincinv"},{"attributeType":"null","col":12,"comment":"null","endLoc":3053,"id":13610,"name":"_gammaincinv","nodeType":"Attribute","startLoc":3053,"text":"cls._gammaincinv"},{"className":"Voigt1D","col":0,"comment":"\n    One dimensional model for the Voigt profile.\n\n    Parameters\n    ----------\n    x_0 : float or `~astropy.units.Quantity`\n        Position of the peak\n    amplitude_L : float or `~astropy.units.Quantity`.\n        The Lorentzian amplitude (peak of the associated Lorentz function)\n        - for a normalized profile (integrating to 1), set\n        amplitude_L = 2 / (np.pi * fwhm_L)\n    fwhm_L : float or `~astropy.units.Quantity`\n        The Lorentzian full width at half maximum\n    fwhm_G : float or `~astropy.units.Quantity`.\n        The Gaussian full width at half maximum\n    method : str, optional\n        Algorithm for computing the complex error function; one of\n        'Humlicek2' (default, fast and generally more accurate than ``rtol=3.e-5``) or\n        'Scipy', alternatively 'wofz' (requires ``scipy``, almost as fast and\n        reference in accuracy).\n\n    See Also\n    --------\n    Gaussian1D, Lorentz1D\n\n    Notes\n    -----\n    Either all or none of input ``x``, position ``x_0`` and the ``fwhm_*`` must be provided\n    consistently with compatible units or as unitless numbers.\n    Voigt function is calculated as real part of the complex error function computed from either\n    Humlicek's rational approximations (JQSRT 21:309, 1979; 27:437, 1982) following\n    Schreier 2018 (MNRAS 479, 3068; and ``hum2zpf16m`` from his cpfX.py module); or\n    `~scipy.special.wofz` (implementing 'Faddeeva.cc').\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        from astropy.modeling.models import Voigt1D\n        import matplotlib.pyplot as plt\n\n        plt.figure()\n        x = np.arange(0, 10, 0.01)\n        v1 = Voigt1D(x_0=5, amplitude_L=10, fwhm_L=0.5, fwhm_G=0.9)\n        plt.plot(x, v1(x))\n        plt.show()\n    ","endLoc":1716,"id":13611,"nodeType":"Class","startLoc":1536,"text":"class Voigt1D(Fittable1DModel):\n    \"\"\"\n    One dimensional model for the Voigt profile.\n\n    Parameters\n    ----------\n    x_0 : float or `~astropy.units.Quantity`\n        Position of the peak\n    amplitude_L : float or `~astropy.units.Quantity`.\n        The Lorentzian amplitude (peak of the associated Lorentz function)\n        - for a normalized profile (integrating to 1), set\n        amplitude_L = 2 / (np.pi * fwhm_L)\n    fwhm_L : float or `~astropy.units.Quantity`\n        The Lorentzian full width at half maximum\n    fwhm_G : float or `~astropy.units.Quantity`.\n        The Gaussian full width at half maximum\n    method : str, optional\n        Algorithm for computing the complex error function; one of\n        'Humlicek2' (default, fast and generally more accurate than ``rtol=3.e-5``) or\n        'Scipy', alternatively 'wofz' (requires ``scipy``, almost as fast and\n        reference in accuracy).\n\n    See Also\n    --------\n    Gaussian1D, Lorentz1D\n\n    Notes\n    -----\n    Either all or none of input ``x``, position ``x_0`` and the ``fwhm_*`` must be provided\n    consistently with compatible units or as unitless numbers.\n    Voigt function is calculated as real part of the complex error function computed from either\n    Humlicek's rational approximations (JQSRT 21:309, 1979; 27:437, 1982) following\n    Schreier 2018 (MNRAS 479, 3068; and ``hum2zpf16m`` from his cpfX.py module); or\n    `~scipy.special.wofz` (implementing 'Faddeeva.cc').\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        from astropy.modeling.models import Voigt1D\n        import matplotlib.pyplot as plt\n\n        plt.figure()\n        x = np.arange(0, 10, 0.01)\n        v1 = Voigt1D(x_0=5, amplitude_L=10, fwhm_L=0.5, fwhm_G=0.9)\n        plt.plot(x, v1(x))\n        plt.show()\n    \"\"\"\n\n    x_0 = Parameter(default=0,\n                    description=\"Position of the peak\")\n    amplitude_L = Parameter(default=1,     # noqa: N815\n                            description=\"The Lorentzian amplitude\")\n    fwhm_L = Parameter(default=2/np.pi,    # noqa: N815\n                       description=\"The Lorentzian full width at half maximum\")\n    fwhm_G = Parameter(default=np.log(2),  # noqa: N815\n                       description=\"The Gaussian full width at half maximum\")\n\n    sqrt_pi = np.sqrt(np.pi)\n    sqrt_ln2 = np.sqrt(np.log(2))\n    sqrt_ln2pi = np.sqrt(np.log(2) * np.pi)\n    _last_z = np.zeros(1, dtype=complex)\n    _last_w = np.zeros(1, dtype=float)\n    _faddeeva = None\n\n    def __init__(self, x_0=x_0.default, amplitude_L=amplitude_L.default,            # noqa: N803\n                 fwhm_L=fwhm_L.default, fwhm_G=fwhm_G.default, method='humlicek2',  # noqa: N803\n                 **kwargs):\n        if str(method).lower() in ('wofz', 'scipy'):\n            from scipy.special import wofz\n            self._faddeeva = wofz\n        elif str(method).lower() == 'humlicek2':\n            self._faddeeva = self._hum2zpf16c\n        else:\n            raise ValueError(f'Not a valid method for Voigt1D Faddeeva function: {method}.')\n        self.method = self._faddeeva.__name__\n\n        super().__init__(x_0=x_0, amplitude_L=amplitude_L, fwhm_L=fwhm_L, fwhm_G=fwhm_G, **kwargs)\n\n    def _wrap_wofz(self, z):\n        \"\"\"Call complex error (Faddeeva) function w(z) implemented by algorithm `method`;\n        cache results for consecutive calls from `evaluate`, `fit_deriv`.\"\"\"\n\n        if (z.shape == self._last_z.shape and\n                np.allclose(z, self._last_z, rtol=1.e-14, atol=1.e-15)):\n            return self._last_w\n\n        self._last_w = self._faddeeva(z)\n        self._last_z = z\n        return self._last_w\n\n    def evaluate(self, x, x_0, amplitude_L, fwhm_L, fwhm_G):  # noqa: N803\n        \"\"\"One dimensional Voigt function scaled to Lorentz peak amplitude.\"\"\"\n\n        z = np.atleast_1d(2 * (x - x_0) + 1j * fwhm_L) * self.sqrt_ln2 / fwhm_G\n        # The normalised Voigt profile is w.real * self.sqrt_ln2 / (self.sqrt_pi * fwhm_G) * 2 ;\n        # for the legacy definition we multiply with np.pi * fwhm_L / 2 * amplitude_L\n        return self._wrap_wofz(z).real * self.sqrt_ln2pi / fwhm_G * fwhm_L * amplitude_L\n\n    def fit_deriv(self, x, x_0, amplitude_L, fwhm_L, fwhm_G):  # noqa: N803\n        \"\"\"Derivative of the one dimensional Voigt function with respect to parameters.\"\"\"\n\n        s = self.sqrt_ln2 / fwhm_G\n        z = np.atleast_1d(2 * (x - x_0) + 1j * fwhm_L) * s\n        # V * constant from McLean implementation (== their Voigt function)\n        w = self._wrap_wofz(z) * s * fwhm_L * amplitude_L * self.sqrt_pi\n\n        # Schreier (2018) Eq. 6 == (dvdx + 1j * dvdy) / (sqrt(pi) * fwhm_L * amplitude_L)\n        dwdz = -2 * z * w + 2j * s * fwhm_L * amplitude_L\n\n        return [-dwdz.real * 2 * s,\n                w.real / amplitude_L,\n                w.real / fwhm_L - dwdz.imag * s,\n                (-w.real - s * (2 * (x - x_0) * dwdz.real - fwhm_L * dwdz.imag)) / fwhm_G]\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'fwhm_L': inputs_unit[self.inputs[0]],\n                'fwhm_G': inputs_unit[self.inputs[0]],\n                'amplitude_L': outputs_unit[self.outputs[0]]}\n\n    @staticmethod\n    def _hum2zpf16c(z, s=10.0):\n        \"\"\"Complex error function w(z) for z = x + iy combining Humlicek's rational approximations:\n\n        |x| + y > 10:  Humlicek (JQSRT, 1982) rational approximation for region II;\n        else:          Humlicek (JQSRT, 1979) rational approximation with n=16 and delta=y0=1.35\n\n        Version using a mask and np.place;\n        single complex argument version of Franz Schreier's cpfX.hum2zpf16m.\n        Originally licensed under a 3-clause BSD style license - see\n        https://atmos.eoc.dlr.de/tools/lbl4IR/cpfX.py\n        \"\"\"\n\n        # Optimized (single fraction) Humlicek region I rational approximation for n=16, delta=1.35\n\n        AA = np.array([+46236.3358828121,   -147726.58393079657j,   # noqa: N806\n                       -206562.80451354137,  281369.1590631087j,\n                       +183092.74968253175, -184787.96830696272j,\n                       -66155.39578477248,   57778.05827983565j,\n                       +11682.770904216826, -9442.402767960672j,\n                       -1052.8438624933142,  814.0996198624186j,\n                       +45.94499030751872,  -34.59751573708725j,\n                       -0.7616559377907136,  0.5641895835476449j])  # 1j/sqrt(pi) to the 12. digit\n\n        bb = np.array([+7918.06640624997, 0.0,\n                       -126689.0625,      0.0,\n                       +295607.8125,      0.0,\n                       -236486.25,        0.0,\n                       +84459.375,        0.0,\n                       -15015.0,          0.0,\n                       +1365.0,           0.0,\n                       -60.0,             0.0,\n                       +1.0])\n\n        sqrt_piinv = 1.0 / np.sqrt(np.pi)\n\n        zz = z * z\n        w  = 1j * (z * (zz * sqrt_piinv - 1.410474)) / (0.75 + zz*(zz - 3.0))\n\n        if np.any(z.imag < s):\n            mask  = abs(z.real) + z.imag < s  # returns true for interior points\n            # returns small complex array covering only the interior region\n            Z     = z[np.where(mask)] + 1.35j\n            ZZ    = Z * Z\n            numer = (((((((((((((((AA[15]*Z + AA[14])*Z + AA[13])*Z + AA[12])*Z + AA[11])*Z +\n                               AA[10])*Z + AA[9])*Z + AA[8])*Z + AA[7])*Z + AA[6])*Z +\n                          AA[5])*Z + AA[4])*Z+AA[3])*Z + AA[2])*Z + AA[1])*Z + AA[0])\n            denom = (((((((ZZ + bb[14])*ZZ + bb[12])*ZZ + bb[10])*ZZ+bb[8])*ZZ + bb[6])*ZZ +\n                      bb[4])*ZZ + bb[2])*ZZ + bb[0]\n            np.place(w, mask, numer / denom)\n\n        return w"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":74,"id":13612,"name":"a0","nodeType":"Attribute","startLoc":74,"text":"a0"},{"col":4,"comment":"Call complex error (Faddeeva) function w(z) implemented by algorithm `method`;\n        cache results for consecutive calls from `evaluate`, `fit_deriv`.","endLoc":1627,"header":"def _wrap_wofz(self, z)","id":13613,"name":"_wrap_wofz","nodeType":"Function","startLoc":1617,"text":"def _wrap_wofz(self, z):\n        \"\"\"Call complex error (Faddeeva) function w(z) implemented by algorithm `method`;\n        cache results for consecutive calls from `evaluate`, `fit_deriv`.\"\"\"\n\n        if (z.shape == self._last_z.shape and\n                np.allclose(z, self._last_z, rtol=1.e-14, atol=1.e-15)):\n            return self._last_w\n\n        self._last_w = self._faddeeva(z)\n        self._last_z = z\n        return self._last_w"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":13614,"name":"__all__","nodeType":"Attribute","startLoc":5,"text":"__all__"},{"col":0,"comment":"","endLoc":2,"header":"utils.py#<anonymous>","id":13615,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"Utility functions for ``constants`` sub-package.\"\"\"\n\n__all__ = []"},{"fileName":"config.py","filePath":"astropy/constants","id":13616,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nConfigures the codata and iaudata used, possibly using user configuration.\n\"\"\"\n# Note: doing this in __init__ causes import problems with units,\n# as si.py and cgs.py have to import the result.\nimport importlib\n\nimport astropy\n\nphys_version = astropy.physical_constants.get()\nastro_version = astropy.astronomical_constants.get()\n\ncodata = importlib.import_module('.constants.' + phys_version, 'astropy')\niaudata = importlib.import_module('.constants.' + astro_version, 'astropy')\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":13617,"name":"phys_version","nodeType":"Attribute","startLoc":11,"text":"phys_version"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":13618,"name":"astro_version","nodeType":"Attribute","startLoc":12,"text":"astro_version"},{"col":4,"comment":"Complex error function w(z) for z = x + iy combining Humlicek's rational approximations:\n\n        |x| + y > 10:  Humlicek (JQSRT, 1982) rational approximation for region II;\n        else:          Humlicek (JQSRT, 1979) rational approximation with n=16 and delta=y0=1.35\n\n        Version using a mask and np.place;\n        single complex argument version of Franz Schreier's cpfX.hum2zpf16m.\n        Originally licensed under a 3-clause BSD style license - see\n        https://atmos.eoc.dlr.de/tools/lbl4IR/cpfX.py\n        ","endLoc":1716,"header":"@staticmethod\n    def _hum2zpf16c(z, s=10.0)","id":13619,"name":"_hum2zpf16c","nodeType":"Function","startLoc":1665,"text":"@staticmethod\n    def _hum2zpf16c(z, s=10.0):\n        \"\"\"Complex error function w(z) for z = x + iy combining Humlicek's rational approximations:\n\n        |x| + y > 10:  Humlicek (JQSRT, 1982) rational approximation for region II;\n        else:          Humlicek (JQSRT, 1979) rational approximation with n=16 and delta=y0=1.35\n\n        Version using a mask and np.place;\n        single complex argument version of Franz Schreier's cpfX.hum2zpf16m.\n        Originally licensed under a 3-clause BSD style license - see\n        https://atmos.eoc.dlr.de/tools/lbl4IR/cpfX.py\n        \"\"\"\n\n        # Optimized (single fraction) Humlicek region I rational approximation for n=16, delta=1.35\n\n        AA = np.array([+46236.3358828121,   -147726.58393079657j,   # noqa: N806\n                       -206562.80451354137,  281369.1590631087j,\n                       +183092.74968253175, -184787.96830696272j,\n                       -66155.39578477248,   57778.05827983565j,\n                       +11682.770904216826, -9442.402767960672j,\n                       -1052.8438624933142,  814.0996198624186j,\n                       +45.94499030751872,  -34.59751573708725j,\n                       -0.7616559377907136,  0.5641895835476449j])  # 1j/sqrt(pi) to the 12. digit\n\n        bb = np.array([+7918.06640624997, 0.0,\n                       -126689.0625,      0.0,\n                       +295607.8125,      0.0,\n                       -236486.25,        0.0,\n                       +84459.375,        0.0,\n                       -15015.0,          0.0,\n                       +1365.0,           0.0,\n                       -60.0,             0.0,\n                       +1.0])\n\n        sqrt_piinv = 1.0 / np.sqrt(np.pi)\n\n        zz = z * z\n        w  = 1j * (z * (zz * sqrt_piinv - 1.410474)) / (0.75 + zz*(zz - 3.0))\n\n        if np.any(z.imag < s):\n            mask  = abs(z.real) + z.imag < s  # returns true for interior points\n            # returns small complex array covering only the interior region\n            Z     = z[np.where(mask)] + 1.35j\n            ZZ    = Z * Z\n            numer = (((((((((((((((AA[15]*Z + AA[14])*Z + AA[13])*Z + AA[12])*Z + AA[11])*Z +\n                               AA[10])*Z + AA[9])*Z + AA[8])*Z + AA[7])*Z + AA[6])*Z +\n                          AA[5])*Z + AA[4])*Z+AA[3])*Z + AA[2])*Z + AA[1])*Z + AA[0])\n            denom = (((((((ZZ + bb[14])*ZZ + bb[12])*ZZ + bb[10])*ZZ+bb[8])*ZZ + bb[6])*ZZ +\n                      bb[4])*ZZ + bb[2])*ZZ + bb[0]\n            np.place(w, mask, numer / denom)\n\n        return w"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":77,"id":13620,"name":"muB","nodeType":"Attribute","startLoc":77,"text":"muB"},{"col":0,"comment":"","endLoc":4,"header":"config.py#<anonymous>","id":13621,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nConfigures the codata and iaudata used, possibly using user configuration.\n\"\"\"\n\nphys_version = astropy.physical_constants.get()\n\nastro_version = astropy.astronomical_constants.get()\n\ncodata = importlib.import_module('.constants.' + phys_version, 'astropy')\n\niaudata = importlib.import_module('.constants.' + astro_version, 'astropy')"},{"col":4,"comment":"One dimensional Voigt function scaled to Lorentz peak amplitude.","endLoc":1635,"header":"def evaluate(self, x, x_0, amplitude_L, fwhm_L, fwhm_G)","id":13622,"name":"evaluate","nodeType":"Function","startLoc":1629,"text":"def evaluate(self, x, x_0, amplitude_L, fwhm_L, fwhm_G):  # noqa: N803\n        \"\"\"One dimensional Voigt function scaled to Lorentz peak amplitude.\"\"\"\n\n        z = np.atleast_1d(2 * (x - x_0) + 1j * fwhm_L) * self.sqrt_ln2 / fwhm_G\n        # The normalised Voigt profile is w.real * self.sqrt_ln2 / (self.sqrt_pi * fwhm_G) * 2 ;\n        # for the legacy definition we multiply with np.pi * fwhm_L / 2 * amplitude_L\n        return self._wrap_wofz(z).real * self.sqrt_ln2pi / fwhm_G * fwhm_L * amplitude_L"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":80,"id":13623,"name":"alpha","nodeType":"Attribute","startLoc":80,"text":"alpha"},{"fileName":"iau2012.py","filePath":"astropy/constants","id":13624,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nAstronomical and physics constants in SI units.  See :mod:`astropy.constants`\nfor a complete listing of constants defined in Astropy.\n\"\"\"\n\nimport numpy as np\n\nfrom .constant import Constant\n\n# ASTRONOMICAL CONSTANTS\n\n\nclass IAU2012(Constant):\n    default_reference = 'IAU 2012'\n    _registry = {}\n    _has_incompatible_units = set()\n\n\n# DISTANCE\n\n# Astronomical Unit\nau = IAU2012('au', \"Astronomical Unit\", 1.49597870700e11, 'm', 0.0,\n             \"IAU 2012 Resolution B2\", system='si')\n\n# Parsec\n\npc = IAU2012('pc', \"Parsec\", au.value / np.tan(np.radians(1. / 3600.)), 'm',\n             au.uncertainty / np.tan(np.radians(1. / 3600.)),\n             \"Derived from au\", system='si')\n\n# Kiloparsec\nkpc = IAU2012('kpc', \"Kiloparsec\",\n              1000. * au.value / np.tan(np.radians(1. / 3600.)), 'm',\n              1000. * au.uncertainty / np.tan(np.radians(1. / 3600.)),\n              \"Derived from au\", system='si')\n\n# Luminosity not defined till 2015 (https://arxiv.org/abs/1510.06262)\nL_bol0 = IAU2012('L_bol0', \"Luminosity for absolute bolometric magnitude 0\",\n                 3.0128e28, \"W\", 0.0, \"IAU 2015 Resolution B 2\", system='si')\n\n\n# SOLAR QUANTITIES\n\n# Solar luminosity\nL_sun = IAU2012('L_sun', \"Solar luminosity\", 3.846e26, 'W', 0.0005e26,\n                \"Allen's Astrophysical Quantities 4th Ed.\", system='si')\n\n# Solar mass\nM_sun = IAU2012('M_sun', \"Solar mass\", 1.9891e30, 'kg', 0.00005e30,\n                \"Allen's Astrophysical Quantities 4th Ed.\", system='si')\n\n# Solar radius\nR_sun = IAU2012('R_sun', \"Solar radius\", 6.95508e8, 'm', 0.00026e8,\n                \"Allen's Astrophysical Quantities 4th Ed.\", system='si')\n\n\n# OTHER SOLAR SYSTEM QUANTITIES\n\n# Jupiter mass\nM_jup = IAU2012('M_jup', \"Jupiter mass\", 1.8987e27, 'kg', 0.00005e27,\n                \"Allen's Astrophysical Quantities 4th Ed.\", system='si')\n\n# Jupiter equatorial radius\nR_jup = IAU2012('R_jup', \"Jupiter equatorial radius\", 7.1492e7, 'm',\n                0.00005e7, \"Allen's Astrophysical Quantities 4th Ed.\",\n                system='si')\n\n# Earth mass\nM_earth = IAU2012('M_earth', \"Earth mass\", 5.9742e24, 'kg', 0.00005e24,\n                  \"Allen's Astrophysical Quantities 4th Ed.\", system='si')\n\n# Earth equatorial radius\nR_earth = IAU2012('R_earth', \"Earth equatorial radius\", 6.378136e6, 'm',\n                  0.0000005e6, \"Allen's Astrophysical Quantities 4th Ed.\",\n                  system='si')\n"},{"className":"IAU2012","col":0,"comment":"null","endLoc":17,"id":13625,"nodeType":"Class","startLoc":14,"text":"class IAU2012(Constant):\n    default_reference = 'IAU 2012'\n    _registry = {}\n    _has_incompatible_units = set()"},{"col":4,"comment":"Derivative of the one dimensional Voigt function with respect to parameters.","endLoc":1651,"header":"def fit_deriv(self, x, x_0, amplitude_L, fwhm_L, fwhm_G)","id":13626,"name":"fit_deriv","nodeType":"Function","startLoc":1637,"text":"def fit_deriv(self, x, x_0, amplitude_L, fwhm_L, fwhm_G):  # noqa: N803\n        \"\"\"Derivative of the one dimensional Voigt function with respect to parameters.\"\"\"\n\n        s = self.sqrt_ln2 / fwhm_G\n        z = np.atleast_1d(2 * (x - x_0) + 1j * fwhm_L) * s\n        # V * constant from McLean implementation (== their Voigt function)\n        w = self._wrap_wofz(z) * s * fwhm_L * amplitude_L * self.sqrt_pi\n\n        # Schreier (2018) Eq. 6 == (dvdx + 1j * dvdy) / (sqrt(pi) * fwhm_L * amplitude_L)\n        dwdz = -2 * z * w + 2j * s * fwhm_L * amplitude_L\n\n        return [-dwdz.real * 2 * s,\n                w.real / amplitude_L,\n                w.real / fwhm_L - dwdz.imag * s,\n                (-w.real - s * (2 * (x - x_0) * dwdz.real - fwhm_L * dwdz.imag)) / fwhm_G]"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":83,"id":13627,"name":"atm","nodeType":"Attribute","startLoc":83,"text":"atm"},{"col":4,"comment":"null","endLoc":1657,"header":"@property\n    def input_units(self)","id":13628,"name":"input_units","nodeType":"Function","startLoc":1653,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit}"},{"attributeType":"null","col":4,"comment":"null","endLoc":15,"id":13629,"name":"default_reference","nodeType":"Attribute","startLoc":15,"text":"default_reference"},{"col":4,"comment":"null","endLoc":1663,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13630,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1659,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'fwhm_L': inputs_unit[self.inputs[0]],\n                'fwhm_G': inputs_unit[self.inputs[0]],\n                'amplitude_L': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":1587,"id":13631,"name":"x_0","nodeType":"Attribute","startLoc":1587,"text":"x_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":1589,"id":13632,"name":"amplitude_L","nodeType":"Attribute","startLoc":1589,"text":"amplitude_L"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":13633,"name":"_registry","nodeType":"Attribute","startLoc":16,"text":"_registry"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":13634,"name":"_has_incompatible_units","nodeType":"Attribute","startLoc":17,"text":"_has_incompatible_units"},{"attributeType":"null","col":16,"comment":"null","endLoc":7,"id":13635,"name":"np","nodeType":"Attribute","startLoc":7,"text":"np"},{"attributeType":"null","col":4,"comment":"null","endLoc":1591,"id":13636,"name":"fwhm_L","nodeType":"Attribute","startLoc":1591,"text":"fwhm_L"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":23,"id":13637,"name":"au","nodeType":"Attribute","startLoc":23,"text":"au"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1408,"id":13638,"name":"intercept","nodeType":"Attribute","startLoc":1408,"text":"intercept"},{"attributeType":"null","col":4,"comment":"null","endLoc":1593,"id":13639,"name":"fwhm_G","nodeType":"Attribute","startLoc":1593,"text":"fwhm_G"},{"attributeType":"null","col":4,"comment":"null","endLoc":1596,"id":13640,"name":"sqrt_pi","nodeType":"Attribute","startLoc":1596,"text":"sqrt_pi"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":86,"id":13641,"name":"mu0","nodeType":"Attribute","startLoc":86,"text":"mu0"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":89,"id":13642,"name":"sigma_T","nodeType":"Attribute","startLoc":89,"text":"sigma_T"},{"attributeType":"null","col":4,"comment":"null","endLoc":1597,"id":13643,"name":"sqrt_ln2","nodeType":"Attribute","startLoc":1597,"text":"sqrt_ln2"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":28,"id":13644,"name":"pc","nodeType":"Attribute","startLoc":28,"text":"pc"},{"attributeType":"CODATA2018","col":0,"comment":"null","endLoc":96,"id":13645,"name":"b_wien","nodeType":"Attribute","startLoc":96,"text":"b_wien"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":33,"id":13646,"name":"kpc","nodeType":"Attribute","startLoc":33,"text":"kpc"},{"attributeType":"null","col":4,"comment":"null","endLoc":1409,"id":13647,"name":"linear","nodeType":"Attribute","startLoc":1409,"text":"linear"},{"className":"Ellipse2D","col":0,"comment":"\n    A 2D Ellipse model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Value of the ellipse.\n\n    x_0 : float\n        x position of the center of the disk.\n\n    y_0 : float\n        y position of the center of the disk.\n\n    a : float\n        The length of the semimajor axis.\n\n    b : float\n        The length of the semiminor axis.\n\n    theta : float\n        The rotation angle in radians of the semimajor axis.  The\n        rotation angle increases counterclockwise from the positive x\n        axis.\n\n    See Also\n    --------\n    Disk2D, Box2D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        f(x, y) = \\left \\{\n                    \\begin{array}{ll}\n                      \\mathrm{amplitude} & : \\left[\\frac{(x - x_0) \\cos\n                        \\theta + (y - y_0) \\sin \\theta}{a}\\right]^2 +\n                        \\left[\\frac{-(x - x_0) \\sin \\theta + (y - y_0)\n                        \\cos \\theta}{b}\\right]^2  \\leq 1 \\\\\n                      0 & : \\mathrm{otherwise}\n                    \\end{array}\n                  \\right.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        from astropy.modeling.models import Ellipse2D\n        from astropy.coordinates import Angle\n        import matplotlib.pyplot as plt\n        import matplotlib.patches as mpatches\n        x0, y0 = 25, 25\n        a, b = 20, 10\n        theta = Angle(30, 'deg')\n        e = Ellipse2D(amplitude=100., x_0=x0, y_0=y0, a=a, b=b,\n                      theta=theta.radian)\n        y, x = np.mgrid[0:50, 0:50]\n        fig, ax = plt.subplots(1, 1)\n        ax.imshow(e(x, y), origin='lower', interpolation='none', cmap='Greys_r')\n        e2 = mpatches.Ellipse((x0, y0), 2*a, 2*b, theta.degree, edgecolor='red',\n                              facecolor='none')\n        ax.add_patch(e2)\n        plt.show()\n    ","endLoc":1971,"id":13648,"nodeType":"Class","startLoc":1843,"text":"class Ellipse2D(Fittable2DModel):\n    \"\"\"\n    A 2D Ellipse model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Value of the ellipse.\n\n    x_0 : float\n        x position of the center of the disk.\n\n    y_0 : float\n        y position of the center of the disk.\n\n    a : float\n        The length of the semimajor axis.\n\n    b : float\n        The length of the semiminor axis.\n\n    theta : float\n        The rotation angle in radians of the semimajor axis.  The\n        rotation angle increases counterclockwise from the positive x\n        axis.\n\n    See Also\n    --------\n    Disk2D, Box2D\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        f(x, y) = \\\\left \\\\{\n                    \\\\begin{array}{ll}\n                      \\\\mathrm{amplitude} & : \\\\left[\\\\frac{(x - x_0) \\\\cos\n                        \\\\theta + (y - y_0) \\\\sin \\\\theta}{a}\\\\right]^2 +\n                        \\\\left[\\\\frac{-(x - x_0) \\\\sin \\\\theta + (y - y_0)\n                        \\\\cos \\\\theta}{b}\\\\right]^2  \\\\leq 1 \\\\\\\\\n                      0 & : \\\\mathrm{otherwise}\n                    \\\\end{array}\n                  \\\\right.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        from astropy.modeling.models import Ellipse2D\n        from astropy.coordinates import Angle\n        import matplotlib.pyplot as plt\n        import matplotlib.patches as mpatches\n        x0, y0 = 25, 25\n        a, b = 20, 10\n        theta = Angle(30, 'deg')\n        e = Ellipse2D(amplitude=100., x_0=x0, y_0=y0, a=a, b=b,\n                      theta=theta.radian)\n        y, x = np.mgrid[0:50, 0:50]\n        fig, ax = plt.subplots(1, 1)\n        ax.imshow(e(x, y), origin='lower', interpolation='none', cmap='Greys_r')\n        e2 = mpatches.Ellipse((x0, y0), 2*a, 2*b, theta.degree, edgecolor='red',\n                              facecolor='none')\n        ax.add_patch(e2)\n        plt.show()\n    \"\"\"\n\n    amplitude = Parameter(default=1, description=\"Value of the ellipse\")\n    x_0 = Parameter(default=0, description=\"X position of the center of the disk.\")\n    y_0 = Parameter(default=0, description=\"Y position of the center of the disk.\")\n    a = Parameter(default=1, description=\"The length of the semimajor axis\")\n    b = Parameter(default=1, description=\"The length of the semiminor axis\")\n    theta = Parameter(default=0, description=\"The rotation angle in radians of the semimajor axis (Positive - counterclockwise)\")\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, a, b, theta):\n        \"\"\"Two dimensional Ellipse model function.\"\"\"\n\n        xx = x - x_0\n        yy = y - y_0\n        cost = np.cos(theta)\n        sint = np.sin(theta)\n        numerator1 = (xx * cost) + (yy * sint)\n        numerator2 = -(xx * sint) + (yy * cost)\n        in_ellipse = (((numerator1 / a) ** 2 + (numerator2 / b) ** 2) <= 1.)\n        result = np.select([in_ellipse], [amplitude])\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        \"\"\"\n\n        a = self.a\n        b = self.b\n        theta = self.theta.value\n        dx, dy = ellipse_extent(a, b, theta)\n\n        return ((self.y_0 - dy, self.y_0 + dy),\n                (self.x_0 - dx, self.x_0 + dx))\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'a': inputs_unit[self.inputs[0]],\n                'b': inputs_unit[self.inputs[0]],\n                'theta': u.rad,\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":1598,"id":13649,"name":"sqrt_ln2pi","nodeType":"Attribute","startLoc":1598,"text":"sqrt_ln2pi"},{"col":4,"comment":"Two dimensional Ellipse model function.","endLoc":1935,"header":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, a, b, theta)","id":13650,"name":"evaluate","nodeType":"Function","startLoc":1920,"text":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, a, b, theta):\n        \"\"\"Two dimensional Ellipse model function.\"\"\"\n\n        xx = x - x_0\n        yy = y - y_0\n        cost = np.cos(theta)\n        sint = np.sin(theta)\n        numerator1 = (xx * cost) + (yy * sint)\n        numerator2 = -(xx * sint) + (yy * cost)\n        in_ellipse = (((numerator1 / a) ** 2 + (numerator2 / b) ** 2) <= 1.)\n        result = np.select([in_ellipse], [amplitude])\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        return result"},{"attributeType":"null","col":4,"comment":"null","endLoc":1599,"id":13651,"name":"_last_z","nodeType":"Attribute","startLoc":1599,"text":"_last_z"},{"attributeType":"null","col":4,"comment":"null","endLoc":1600,"id":13652,"name":"_last_w","nodeType":"Attribute","startLoc":1600,"text":"_last_w"},{"attributeType":"null","col":4,"comment":"null","endLoc":1601,"id":13653,"name":"_faddeeva","nodeType":"Attribute","startLoc":1601,"text":"_faddeeva"},{"attributeType":"null","col":8,"comment":"null","endLoc":1613,"id":13654,"name":"method","nodeType":"Attribute","startLoc":1613,"text":"self.method"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":39,"id":13655,"name":"L_bol0","nodeType":"Attribute","startLoc":39,"text":"L_bol0"},{"attributeType":"null","col":8,"comment":"null","endLoc":1625,"id":13656,"name":"_last_w","nodeType":"Attribute","startLoc":1625,"text":"self._last_w"},{"attributeType":"null","col":8,"comment":"null","endLoc":1626,"id":13657,"name":"_last_z","nodeType":"Attribute","startLoc":1626,"text":"self._last_z"},{"attributeType":"function","col":12,"comment":"null","endLoc":1610,"id":13658,"name":"_faddeeva","nodeType":"Attribute","startLoc":1610,"text":"self._faddeeva"},{"className":"KingProjectedAnalytic1D","col":0,"comment":"\n    Projected (surface density) analytic King Model.\n\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude or scaling factor.\n    r_core : float\n        Core radius (f(r_c) ~ 0.5 f_0)\n    r_tide : float\n        Tidal radius.\n\n\n    Notes\n    -----\n\n    This model approximates a King model with an analytic function. The derivation of this\n    equation can be found in King '62 (equation 14). This is just an approximation of the\n    full model and the parameters derived from this model should be taken with caution.\n    It usually works for models with a concentration (c = log10(r_t/r_c) parameter < 2.\n\n    Model formula:\n\n    .. math::\n\n        f(x) = A r_c^2  \\left(\\frac{1}{\\sqrt{(x^2 + r_c^2)}} -\n        \\frac{1}{\\sqrt{(r_t^2 + r_c^2)}}\\right)^2\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        from astropy.modeling.models import KingProjectedAnalytic1D\n        import matplotlib.pyplot as plt\n\n        plt.figure()\n        rt_list = [1, 2, 5, 10, 20]\n        for rt in rt_list:\n            r = np.linspace(0.1, rt, 100)\n\n            mod = KingProjectedAnalytic1D(amplitude = 1, r_core = 1., r_tide = rt)\n            sig = mod(r)\n\n\n            plt.loglog(r, sig/sig[0], label='c ~ {:0.2f}'.format(mod.concentration))\n\n        plt.xlabel(\"r\")\n        plt.ylabel(r\"$\\sigma/\\sigma_0$\")\n        plt.legend()\n        plt.show()\n\n    References\n    ----------\n    .. [1] https://ui.adsabs.harvard.edu/abs/1962AJ.....67..471K\n    ","endLoc":3215,"id":13659,"nodeType":"Class","startLoc":3084,"text":"class KingProjectedAnalytic1D(Fittable1DModel):\n    \"\"\"\n    Projected (surface density) analytic King Model.\n\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude or scaling factor.\n    r_core : float\n        Core radius (f(r_c) ~ 0.5 f_0)\n    r_tide : float\n        Tidal radius.\n\n\n    Notes\n    -----\n\n    This model approximates a King model with an analytic function. The derivation of this\n    equation can be found in King '62 (equation 14). This is just an approximation of the\n    full model and the parameters derived from this model should be taken with caution.\n    It usually works for models with a concentration (c = log10(r_t/r_c) parameter < 2.\n\n    Model formula:\n\n    .. math::\n\n        f(x) = A r_c^2  \\\\left(\\\\frac{1}{\\\\sqrt{(x^2 + r_c^2)}} -\n        \\\\frac{1}{\\\\sqrt{(r_t^2 + r_c^2)}}\\\\right)^2\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        from astropy.modeling.models import KingProjectedAnalytic1D\n        import matplotlib.pyplot as plt\n\n        plt.figure()\n        rt_list = [1, 2, 5, 10, 20]\n        for rt in rt_list:\n            r = np.linspace(0.1, rt, 100)\n\n            mod = KingProjectedAnalytic1D(amplitude = 1, r_core = 1., r_tide = rt)\n            sig = mod(r)\n\n\n            plt.loglog(r, sig/sig[0], label='c ~ {:0.2f}'.format(mod.concentration))\n\n        plt.xlabel(\"r\")\n        plt.ylabel(r\"$\\\\sigma/\\\\sigma_0$\")\n        plt.legend()\n        plt.show()\n\n    References\n    ----------\n    .. [1] https://ui.adsabs.harvard.edu/abs/1962AJ.....67..471K\n    \"\"\"\n\n    amplitude = Parameter(default=1, bounds=(FLOAT_EPSILON, None), description=\"Amplitude or scaling factor\")\n    r_core = Parameter(default=1, bounds=(FLOAT_EPSILON, None), description=\"Core Radius\")\n    r_tide = Parameter(default=2, bounds=(FLOAT_EPSILON, None), description=\"Tidal Radius\")\n\n    @property\n    def concentration(self):\n        \"\"\"Concentration parameter of the king model\"\"\"\n        return np.log10(np.abs(self.r_tide/self.r_core))\n\n    @staticmethod\n    def evaluate(x, amplitude, r_core, r_tide):\n        \"\"\"\n        Analytic King model function.\n        \"\"\"\n\n        result = amplitude * r_core ** 2 * (1/np.sqrt(x ** 2 + r_core ** 2) -\n                                            1/np.sqrt(r_tide ** 2 + r_core ** 2)) ** 2\n\n        # Set invalid r values to 0\n        bounds = (x >= r_tide) | (x < 0)\n        result[bounds] = result[bounds] * 0.\n\n        return result\n\n    @staticmethod\n    def fit_deriv(x, amplitude, r_core, r_tide):\n        \"\"\"\n        Analytic King model function derivatives.\n        \"\"\"\n        d_amplitude = r_core ** 2 * (1/np.sqrt(x ** 2 + r_core ** 2) -\n                                     1/np.sqrt(r_tide ** 2 + r_core ** 2)) ** 2\n\n        d_r_core = 2 * amplitude * r_core ** 2 * (r_core/(r_core ** 2 + r_tide ** 2) ** (3/2) -\n                                                  r_core/(r_core ** 2 + x ** 2) ** (3/2)) * \\\n                   (1./np.sqrt(r_core ** 2 + x ** 2) - 1./np.sqrt(r_core ** 2 + r_tide ** 2)) + \\\n                   2 * amplitude * r_core * (1./np.sqrt(r_core ** 2 + x ** 2) -\n                                             1./np.sqrt(r_core ** 2 + r_tide ** 2)) ** 2\n\n        d_r_tide = (2 * amplitude * r_core ** 2 * r_tide *\n                    (1./np.sqrt(r_core ** 2 + x ** 2) -\n                     1./np.sqrt(r_core ** 2 + r_tide ** 2)))/(r_core ** 2 + r_tide ** 2) ** (3/2)\n\n        # Set invalid r values to 0\n        bounds = (x >= r_tide) | (x < 0)\n        d_amplitude[bounds] = d_amplitude[bounds]*0\n        d_r_core[bounds] = d_r_core[bounds]*0\n        d_r_tide[bounds] = d_r_tide[bounds]*0\n\n        return [d_amplitude, d_r_core, d_r_tide]\n\n    @property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits.\n\n        The model is not defined for r > r_tide.\n\n        ``(r_low, r_high)``\n        \"\"\"\n\n        return (0 * self.r_tide, 1 * self.r_tide)\n\n    @property\n    def input_units(self):\n        if self.r_core.unit is None:\n            return None\n        return {self.inputs[0]: self.r_core.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'r_core': inputs_unit[self.inputs[0]],\n                'r_tide': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"col":4,"comment":"\n        Derivative of 1D Hermite series\n        ","endLoc":757,"header":"def _hermderiv1d(self, x, deg)","id":13660,"name":"_hermderiv1d","nodeType":"Function","startLoc":744,"text":"def _hermderiv1d(self, x, deg):\n        \"\"\"\n        Derivative of 1D Hermite series\n        \"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        d = np.empty((deg + 1, len(x)), dtype=x.dtype)\n        d[0] = x * 0 + 1\n        if deg > 0:\n            x2 = 2 * x\n            d[1] = x2\n            for i in range(2, deg + 1):\n                d[i] = x2 * d[i - 1] - 2 * (i - 1) * d[i - 2]\n        return np.rollaxis(d, 0, d.ndim)"},{"col":4,"comment":"Concentration parameter of the king model","endLoc":3151,"header":"@property\n    def concentration(self)","id":13661,"name":"concentration","nodeType":"Function","startLoc":3148,"text":"@property\n    def concentration(self):\n        \"\"\"Concentration parameter of the king model\"\"\"\n        return np.log10(np.abs(self.r_tide/self.r_core))"},{"col":4,"comment":"\n        Analytic King model function.\n        ","endLoc":3166,"header":"@staticmethod\n    def evaluate(x, amplitude, r_core, r_tide)","id":13662,"name":"evaluate","nodeType":"Function","startLoc":3153,"text":"@staticmethod\n    def evaluate(x, amplitude, r_core, r_tide):\n        \"\"\"\n        Analytic King model function.\n        \"\"\"\n\n        result = amplitude * r_core ** 2 * (1/np.sqrt(x ** 2 + r_core ** 2) -\n                                            1/np.sqrt(r_tide ** 2 + r_core ** 2)) ** 2\n\n        # Set invalid r values to 0\n        bounds = (x >= r_tide) | (x < 0)\n        result[bounds] = result[bounds] * 0.\n\n        return result"},{"col":4,"comment":"\n        Analytic King model function derivatives.\n        ","endLoc":3192,"header":"@staticmethod\n    def fit_deriv(x, amplitude, r_core, r_tide)","id":13663,"name":"fit_deriv","nodeType":"Function","startLoc":3168,"text":"@staticmethod\n    def fit_deriv(x, amplitude, r_core, r_tide):\n        \"\"\"\n        Analytic King model function derivatives.\n        \"\"\"\n        d_amplitude = r_core ** 2 * (1/np.sqrt(x ** 2 + r_core ** 2) -\n                                     1/np.sqrt(r_tide ** 2 + r_core ** 2)) ** 2\n\n        d_r_core = 2 * amplitude * r_core ** 2 * (r_core/(r_core ** 2 + r_tide ** 2) ** (3/2) -\n                                                  r_core/(r_core ** 2 + x ** 2) ** (3/2)) * \\\n                   (1./np.sqrt(r_core ** 2 + x ** 2) - 1./np.sqrt(r_core ** 2 + r_tide ** 2)) + \\\n                   2 * amplitude * r_core * (1./np.sqrt(r_core ** 2 + x ** 2) -\n                                             1./np.sqrt(r_core ** 2 + r_tide ** 2)) ** 2\n\n        d_r_tide = (2 * amplitude * r_core ** 2 * r_tide *\n                    (1./np.sqrt(r_core ** 2 + x ** 2) -\n                     1./np.sqrt(r_core ** 2 + r_tide ** 2)))/(r_core ** 2 + r_tide ** 2) ** (3/2)\n\n        # Set invalid r values to 0\n        bounds = (x >= r_tide) | (x < 0)\n        d_amplitude[bounds] = d_amplitude[bounds]*0\n        d_r_core[bounds] = d_r_core[bounds]*0\n        d_r_tide[bounds] = d_r_tide[bounds]*0\n\n        return [d_amplitude, d_r_core, d_r_tide]"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box`` limits.\n\n        The model is not defined for r > r_tide.\n\n        ``(r_low, r_high)``\n        ","endLoc":3204,"header":"@property\n    def bounding_box(self)","id":13664,"name":"bounding_box","nodeType":"Function","startLoc":3194,"text":"@property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits.\n\n        The model is not defined for r > r_tide.\n\n        ``(r_low, r_high)``\n        \"\"\"\n\n        return (0 * self.r_tide, 1 * self.r_tide)"},{"col":4,"comment":"null","endLoc":3210,"header":"@property\n    def input_units(self)","id":13665,"name":"input_units","nodeType":"Function","startLoc":3206,"text":"@property\n    def input_units(self):\n        if self.r_core.unit is None:\n            return None\n        return {self.inputs[0]: self.r_core.unit}"},{"col":4,"comment":"null","endLoc":3215,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13666,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":3212,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'r_core': inputs_unit[self.inputs[0]],\n                'r_tide': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":3144,"id":13667,"name":"amplitude","nodeType":"Attribute","startLoc":3144,"text":"amplitude"},{"attributeType":"null","col":4,"comment":"null","endLoc":674,"id":13668,"name":"_separable","nodeType":"Attribute","startLoc":674,"text":"_separable"},{"attributeType":"null","col":4,"comment":"null","endLoc":3145,"id":13669,"name":"r_core","nodeType":"Attribute","startLoc":3145,"text":"r_core"},{"className":"Legendre1D","col":0,"comment":"\n    Univariate Legendre series.\n\n    It is defined as:\n\n    .. math::\n\n        P(x) = \\sum_{i=0}^{i=n}C_{i} * L_{i}(x)\n\n    where ``L_i(x)`` is the corresponding Legendre polynomial.\n\n    For explanation of ``domain``, and ``window`` see\n    :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : tuple or None, optional\n    window : tuple or None, optional\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n\n\n    Notes\n    -----\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Legendre polynomials is a polynomial in x - since the\n    coefficients within each Legendre polynomial are fixed, we can't use\n    quantities for x since the units would not be compatible. For example, the\n    third Legendre polynomial (P2) is 1.5x^2-0.5, but if x was specified with\n    units, 1.5x^2 and -0.5 would have incompatible units.\n    ","endLoc":864,"id":13670,"nodeType":"Class","startLoc":760,"text":"class Legendre1D(_PolyDomainWindow1D):\n    r\"\"\"\n    Univariate Legendre series.\n\n    It is defined as:\n\n    .. math::\n\n        P(x) = \\sum_{i=0}^{i=n}C_{i} * L_{i}(x)\n\n    where ``L_i(x)`` is the corresponding Legendre polynomial.\n\n    For explanation of ``domain``, and ``window`` see\n    :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : tuple or None, optional\n    window : tuple or None, optional\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n\n\n    Notes\n    -----\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Legendre polynomials is a polynomial in x - since the\n    coefficients within each Legendre polynomial are fixed, we can't use\n    quantities for x since the units would not be compatible. For example, the\n    third Legendre polynomial (P2) is 1.5x^2-0.5, but if x was specified with\n    units, 1.5x^2 and -0.5 would have incompatible units.\n    \"\"\"\n\n    n_inputs = 1\n    n_outputs = 1\n\n    _separable = True\n\n    def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            degree, domain, window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)\n\n    def prepare_inputs(self, x, **kwargs):\n        inputs, broadcasted_shapes = super().prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), broadcasted_shapes\n\n    def evaluate(self, x, *coeffs):\n        if self.domain is not None:\n            x = poly_map_domain(x, self.domain, self.window)\n        return self.clenshaw(x, coeffs)\n\n    def fit_deriv(self, x, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        v = np.empty((self.degree + 1,) + x.shape, dtype=x.dtype)\n        v[0] = 1\n        if self.degree > 0:\n            v[1] = x\n            for i in range(2, self.degree + 1):\n                v[i] = (v[i - 1] * x * (2 * i - 1) - v[i - 2] * (i - 1)) / i\n        return np.rollaxis(v, 0, v.ndim)\n\n    @staticmethod\n    def clenshaw(x, coeffs):\n        if len(coeffs) == 1:\n            c0 = coeffs[0]\n            c1 = 0\n        elif len(coeffs) == 2:\n            c0 = coeffs[0]\n            c1 = coeffs[1]\n        else:\n            nd = len(coeffs)\n            c0 = coeffs[-2]\n            c1 = coeffs[-1]\n            for i in range(3, len(coeffs) + 1):\n                tmp = c0\n                nd = nd - 1\n                c0 = coeffs[-i] - (c1 * (nd - 1)) / nd\n                c1 = tmp + (c1 * x * (2 * nd - 1)) / nd\n        return c0 + c1 * x"},{"col":4,"comment":"null","endLoc":807,"header":"def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":13671,"name":"__init__","nodeType":"Function","startLoc":803,"text":"def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            degree, domain, window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)"},{"attributeType":"null","col":4,"comment":"null","endLoc":3146,"id":13672,"name":"r_tide","nodeType":"Attribute","startLoc":3146,"text":"r_tide"},{"className":"Exponential1D","col":0,"comment":"\n    One dimensional exponential model.\n\n    Parameters\n    ----------\n    amplitude : float, optional\n    tau : float, optional\n\n    See Also\n    --------\n    Logarithmic1D, Gaussian1D\n    ","endLoc":3314,"id":13673,"nodeType":"Class","startLoc":3267,"text":"class Exponential1D(Fittable1DModel):\n    \"\"\"\n    One dimensional exponential model.\n\n    Parameters\n    ----------\n    amplitude : float, optional\n    tau : float, optional\n\n    See Also\n    --------\n    Logarithmic1D, Gaussian1D\n    \"\"\"\n    amplitude = Parameter(default=1)\n    tau = Parameter(default=1)\n\n    @staticmethod\n    def evaluate(x, amplitude, tau):\n        return amplitude * np.exp(x / tau)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, tau):\n        ''' Derivative with respect to parameters'''\n        d_amplitude = np.exp(x / tau)\n        d_tau = -amplitude * (x / tau**2) * np.exp(x / tau)\n        return [d_amplitude, d_tau]\n\n    @property\n    def inverse(self):\n        new_amplitude = self.tau\n        new_tau = self.amplitude\n        return Logarithmic1D(amplitude=new_amplitude, tau=new_tau)\n\n    @tau.validator\n    def tau(self, val):\n        ''' tau cannot be 0'''\n        if np.all(val == 0):\n            raise ValueError(\"0 is not an allowed value for tau\")\n\n    @property\n    def input_units(self):\n        if self.tau.unit is None:\n            return None\n        return {self.inputs[0]: self.tau.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'tau': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"EMCODATA2018","col":0,"comment":"null","endLoc":104,"id":13674,"name":"e_esu","nodeType":"Attribute","startLoc":104,"text":"e_esu"},{"col":4,"comment":"null","endLoc":814,"header":"def prepare_inputs(self, x, **kwargs)","id":13675,"name":"prepare_inputs","nodeType":"Function","startLoc":809,"text":"def prepare_inputs(self, x, **kwargs):\n        inputs, broadcasted_shapes = super().prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), broadcasted_shapes"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":46,"id":13676,"name":"L_sun","nodeType":"Attribute","startLoc":46,"text":"L_sun"},{"attributeType":"EMCODATA2018","col":0,"comment":"null","endLoc":107,"id":13677,"name":"e_emu","nodeType":"Attribute","startLoc":107,"text":"e_emu"},{"col":4,"comment":"null","endLoc":819,"header":"def evaluate(self, x, *coeffs)","id":13678,"name":"evaluate","nodeType":"Function","startLoc":816,"text":"def evaluate(self, x, *coeffs):\n        if self.domain is not None:\n            x = poly_map_domain(x, self.domain, self.window)\n        return self.clenshaw(x, coeffs)"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        ","endLoc":1951,"header":"@property\n    def bounding_box(self)","id":13679,"name":"bounding_box","nodeType":"Function","startLoc":1937,"text":"@property\n    def bounding_box(self):\n        \"\"\"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        \"\"\"\n\n        a = self.a\n        b = self.b\n        theta = self.theta.value\n        dx, dy = ellipse_extent(a, b, theta)\n\n        return ((self.y_0 - dy, self.y_0 + dy),\n                (self.x_0 - dx, self.x_0 + dx))"},{"attributeType":"EMCODATA2018","col":0,"comment":"null","endLoc":110,"id":13680,"name":"e_gauss","nodeType":"Attribute","startLoc":110,"text":"e_gauss"},{"col":0,"comment":"","endLoc":5,"header":"codata2018.py#<anonymous>","id":13681,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nAstronomical and physics constants in SI units.  See :mod:`astropy.constants`\nfor a complete listing of constants defined in Astropy.\n\"\"\"\n\nh = CODATA2018('h', \"Planck constant\", 6.62607015e-34,\n               'J s', 0.0, system='si')\n\nhbar = CODATA2018('hbar', \"Reduced Planck constant\", h.value / (2 * math.pi),\n                  'J s', 0.0, system='si')\n\nk_B = CODATA2018('k_B', \"Boltzmann constant\", 1.380649e-23,\n                 'J / (K)', 0.0, system='si')\n\nc = CODATA2018('c', \"Speed of light in vacuum\", 299792458.,\n               'm / (s)', 0.0, system='si')\n\nG = CODATA2018('G', \"Gravitational constant\", 6.67430e-11,\n               'm3 / (kg s2)', 0.00015e-11, system='si')\n\ng0 = CODATA2018('g0', \"Standard acceleration of gravity\", 9.80665,\n                'm / s2', 0.0, system='si')\n\nm_p = CODATA2018('m_p', \"Proton mass\", 1.67262192369e-27,\n                 'kg', 0.00000000051e-27, system='si')\n\nm_n = CODATA2018('m_n', \"Neutron mass\", 1.67492749804e-27,\n                 'kg', 0.00000000095e-27, system='si')\n\nm_e = CODATA2018('m_e', \"Electron mass\", 9.1093837015e-31,\n                 'kg', 0.0000000028e-31, system='si')\n\nu = CODATA2018('u', \"Atomic mass\", 1.66053906660e-27,\n               'kg', 0.00000000050e-27, system='si')\n\nsigma_sb = CODATA2018(\n    'sigma_sb', \"Stefan-Boltzmann constant\",\n    2 * math.pi ** 5 * k_B.value ** 4 / (15 * h.value ** 3 * c.value ** 2),\n    'W / (K4 m2)', 0.0, system='si')\n\ne = EMCODATA2018('e', 'Electron charge', 1.602176634e-19,\n                 'C', 0.0, system='si')\n\neps0 = EMCODATA2018('eps0', 'Vacuum electric permittivity', 8.8541878128e-12,\n                    'F/m', 0.0000000013e-12, system='si')\n\nN_A = CODATA2018('N_A', \"Avogadro's number\", 6.02214076e23,\n                 '1 / (mol)', 0.0, system='si')\n\nR = CODATA2018('R', \"Gas constant\", k_B.value * N_A.value,\n               'J / (K mol)', 0.0, system='si')\n\nRyd = CODATA2018('Ryd', 'Rydberg constant', 10973731.568160,\n                 '1 / (m)', 0.000021, system='si')\n\na0 = CODATA2018('a0', \"Bohr radius\", 5.29177210903e-11,\n                'm', 0.00000000080e-11, system='si')\n\nmuB = CODATA2018('muB', \"Bohr magneton\", 9.2740100783e-24,\n                 'J/T', 0.0000000028e-24, system='si')\n\nalpha = CODATA2018('alpha', \"Fine-structure constant\", 7.2973525693e-3,\n                   '', 0.0000000011e-3, system='si')\n\natm = CODATA2018('atm', \"Standard atmosphere\", 101325,\n                 'Pa', 0.0, system='si')\n\nmu0 = CODATA2018('mu0', \"Vacuum magnetic permeability\", 1.25663706212e-6,\n                 'N/A2', 0.00000000019e-6, system='si')\n\nsigma_T = CODATA2018('sigma_T', \"Thomson scattering cross-section\",\n                     6.6524587321e-29, 'm2', 0.0000000060e-29,\n                     system='si')\n\nb_wien = CODATA2018('b_wien', 'Wien wavelength displacement law constant',\n                    h.value * c.value / (k_B.value * 4.965114231744276), 'm K',\n                    0.0, system='si')\n\ne_esu = EMCODATA2018(e.abbrev, e.name, e.value * c.value * 10.0,\n                     'statC', 0.0, system='esu')\n\ne_emu = EMCODATA2018(e.abbrev, e.name, e.value / 10, 'abC',\n                     0.0, system='emu')\n\ne_gauss = EMCODATA2018(e.abbrev, e.name, e.value * c.value * 10.0,\n                       'Fr', 0.0, system='gauss')"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":50,"id":13682,"name":"M_sun","nodeType":"Attribute","startLoc":50,"text":"M_sun"},{"fileName":"astropyconst40.py","filePath":"astropy/constants","id":13683,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nAstronomical and physics constants for Astropy v4.0.\nSee :mod:`astropy.constants` for a complete listing of constants defined\nin Astropy.\n\"\"\"\nimport warnings\n\nfrom astropy.utils import find_current_module\n\nfrom . import codata2018, iau2015\nfrom . import utils as _utils\n\ncodata = codata2018\niaudata = iau2015\n\n_utils._set_c(codata, iaudata, find_current_module())\n\n# Overwrite the following for consistency.\n# https://github.com/astropy/astropy/issues/8920\nwith warnings.catch_warnings():\n    warnings.filterwarnings('ignore', 'Constant .*already has a definition')\n\n    # Solar mass (derived from mass parameter and gravitational constant)\n    M_sun = iau2015.IAU2015(\n        'M_sun', \"Solar mass\", iau2015.GM_sun.value / codata2018.G.value,\n        'kg', ((codata2018.G.uncertainty / codata2018.G.value) *\n               (iau2015.GM_sun.value / codata2018.G.value)),\n        f\"IAU 2015 Resolution B 3 + {codata2018.G.reference}\", system='si')\n\n    # Jupiter mass (derived from mass parameter and gravitational constant)\n    M_jup = iau2015.IAU2015(\n        'M_jup', \"Jupiter mass\", iau2015.GM_jup.value / codata2018.G.value,\n        'kg', ((codata2018.G.uncertainty / codata2018.G.value) *\n               (iau2015.GM_jup.value / codata2018.G.value)),\n        f\"IAU 2015 Resolution B 3 + {codata2018.G.reference}\", system='si')\n\n    # Earth mass (derived from mass parameter and gravitational constant)\n    M_earth = iau2015.IAU2015(\n        'M_earth', \"Earth mass\",\n        iau2015.GM_earth.value / codata2018.G.value,\n        'kg', ((codata2018.G.uncertainty / codata2018.G.value) *\n               (iau2015.GM_earth.value / codata2018.G.value)),\n        f\"IAU 2015 Resolution B 3 + {codata2018.G.reference}\", system='si')\n\n# Clean up namespace\ndel warnings\ndel find_current_module\ndel _utils\n"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":54,"id":13684,"name":"R_sun","nodeType":"Attribute","startLoc":54,"text":"R_sun"},{"col":4,"comment":" tau cannot be 0","endLoc":3304,"header":"@tau.validator\n    def tau(self, val)","id":13685,"name":"tau","nodeType":"Function","startLoc":3300,"text":"@tau.validator\n    def tau(self, val):\n        ''' tau cannot be 0'''\n        if np.all(val == 0):\n            raise ValueError(\"0 is not an allowed value for tau\")"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":61,"id":13686,"name":"M_jup","nodeType":"Attribute","startLoc":61,"text":"M_jup"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":65,"id":13687,"name":"R_jup","nodeType":"Attribute","startLoc":65,"text":"R_jup"},{"col":4,"comment":"null","endLoc":3285,"header":"@staticmethod\n    def evaluate(x, amplitude, tau)","id":13688,"name":"evaluate","nodeType":"Function","startLoc":3283,"text":"@staticmethod\n    def evaluate(x, amplitude, tau):\n        return amplitude * np.exp(x / tau)"},{"col":4,"comment":" Derivative with respect to parameters","endLoc":3292,"header":"@staticmethod\n    def fit_deriv(x, amplitude, tau)","id":13689,"name":"fit_deriv","nodeType":"Function","startLoc":3287,"text":"@staticmethod\n    def fit_deriv(x, amplitude, tau):\n        ''' Derivative with respect to parameters'''\n        d_amplitude = np.exp(x / tau)\n        d_tau = -amplitude * (x / tau**2) * np.exp(x / tau)\n        return [d_amplitude, d_tau]"},{"col":4,"comment":"null","endLoc":3298,"header":"@property\n    def inverse(self)","id":13690,"name":"inverse","nodeType":"Function","startLoc":3294,"text":"@property\n    def inverse(self):\n        new_amplitude = self.tau\n        new_tau = self.amplitude\n        return Logarithmic1D(amplitude=new_amplitude, tau=new_tau)"},{"col":4,"comment":"null","endLoc":1958,"header":"@property\n    def input_units(self)","id":13691,"name":"input_units","nodeType":"Function","startLoc":1953,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        return {self.inputs[0]: self.x_0.unit,\n                self.inputs[1]: self.y_0.unit}"},{"col":4,"comment":"null","endLoc":1971,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13692,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1960,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        # Note that here we need to make sure that x and y are in the same\n        # units otherwise this can lead to issues since rotation is not well\n        # defined.\n        if inputs_unit[self.inputs[0]] != inputs_unit[self.inputs[1]]:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return {'x_0': inputs_unit[self.inputs[0]],\n                'y_0': inputs_unit[self.inputs[0]],\n                'a': inputs_unit[self.inputs[0]],\n                'b': inputs_unit[self.inputs[0]],\n                'theta': u.rad,\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":23,"comment":"null","endLoc":12,"id":13693,"name":"_utils","nodeType":"Attribute","startLoc":12,"text":"_utils"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1913,"id":13694,"name":"amplitude","nodeType":"Attribute","startLoc":1913,"text":"amplitude"},{"attributeType":"codata2018.py","col":0,"comment":"null","endLoc":14,"id":13695,"name":"codata","nodeType":"Attribute","startLoc":14,"text":"codata"},{"attributeType":"iau2015.py","col":0,"comment":"null","endLoc":15,"id":13696,"name":"iaudata","nodeType":"Attribute","startLoc":15,"text":"iaudata"},{"attributeType":"IAU2015","col":4,"comment":"null","endLoc":25,"id":13697,"name":"M_sun","nodeType":"Attribute","startLoc":25,"text":"M_sun"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":70,"id":13698,"name":"M_earth","nodeType":"Attribute","startLoc":70,"text":"M_earth"},{"col":4,"comment":"null","endLoc":3310,"header":"@property\n    def input_units(self)","id":13699,"name":"input_units","nodeType":"Function","startLoc":3306,"text":"@property\n    def input_units(self):\n        if self.tau.unit is None:\n            return None\n        return {self.inputs[0]: self.tau.unit}"},{"col":4,"comment":"null","endLoc":3314,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13700,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":3312,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'tau': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":3280,"id":13701,"name":"amplitude","nodeType":"Attribute","startLoc":3280,"text":"amplitude"},{"attributeType":"null","col":4,"comment":"null","endLoc":3281,"id":13702,"name":"tau","nodeType":"Attribute","startLoc":3281,"text":"tau"},{"className":"Logarithmic1D","col":0,"comment":"\n    One dimensional logarithmic model.\n\n    Parameters\n    ----------\n    amplitude : float, optional\n    tau : float, optional\n\n    See Also\n    --------\n    Exponential1D, Gaussian1D\n    ","endLoc":3264,"id":13703,"nodeType":"Class","startLoc":3218,"text":"class Logarithmic1D(Fittable1DModel):\n    \"\"\"\n    One dimensional logarithmic model.\n\n    Parameters\n    ----------\n    amplitude : float, optional\n    tau : float, optional\n\n    See Also\n    --------\n    Exponential1D, Gaussian1D\n    \"\"\"\n\n    amplitude = Parameter(default=1)\n    tau = Parameter(default=1)\n\n    @staticmethod\n    def evaluate(x, amplitude, tau):\n        return amplitude * np.log(x / tau)\n\n    @staticmethod\n    def fit_deriv(x, amplitude, tau):\n        d_amplitude = np.log(x / tau)\n        d_tau = np.zeros(x.shape) - (amplitude / tau)\n        return [d_amplitude, d_tau]\n\n    @property\n    def inverse(self):\n        new_amplitude = self.tau\n        new_tau = self.amplitude\n        return Exponential1D(amplitude=new_amplitude, tau=new_tau)\n\n    @tau.validator\n    def tau(self, val):\n        if np.all(val == 0):\n            raise ValueError(\"0 is not an allowed value for tau\")\n\n    @property\n    def input_units(self):\n        if self.tau.unit is None:\n            return None\n        return {self.inputs[0]: self.tau.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'tau': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"col":4,"comment":"null","endLoc":3254,"header":"@tau.validator\n    def tau(self, val)","id":13704,"name":"tau","nodeType":"Function","startLoc":3251,"text":"@tau.validator\n    def tau(self, val):\n        if np.all(val == 0):\n            raise ValueError(\"0 is not an allowed value for tau\")"},{"col":4,"comment":"null","endLoc":3237,"header":"@staticmethod\n    def evaluate(x, amplitude, tau)","id":13705,"name":"evaluate","nodeType":"Function","startLoc":3235,"text":"@staticmethod\n    def evaluate(x, amplitude, tau):\n        return amplitude * np.log(x / tau)"},{"col":4,"comment":"null","endLoc":3243,"header":"@staticmethod\n    def fit_deriv(x, amplitude, tau)","id":13706,"name":"fit_deriv","nodeType":"Function","startLoc":3239,"text":"@staticmethod\n    def fit_deriv(x, amplitude, tau):\n        d_amplitude = np.log(x / tau)\n        d_tau = np.zeros(x.shape) - (amplitude / tau)\n        return [d_amplitude, d_tau]"},{"col":4,"comment":"null","endLoc":3249,"header":"@property\n    def inverse(self)","id":13707,"name":"inverse","nodeType":"Function","startLoc":3245,"text":"@property\n    def inverse(self):\n        new_amplitude = self.tau\n        new_tau = self.amplitude\n        return Exponential1D(amplitude=new_amplitude, tau=new_tau)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1914,"id":13708,"name":"x_0","nodeType":"Attribute","startLoc":1914,"text":"x_0"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":74,"id":13709,"name":"R_earth","nodeType":"Attribute","startLoc":74,"text":"R_earth"},{"col":4,"comment":"null","endLoc":3260,"header":"@property\n    def input_units(self)","id":13710,"name":"input_units","nodeType":"Function","startLoc":3256,"text":"@property\n    def input_units(self):\n        if self.tau.unit is None:\n            return None\n        return {self.inputs[0]: self.tau.unit}"},{"col":4,"comment":"null","endLoc":3264,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13711,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":3262,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return {'tau': inputs_unit[self.inputs[0]],\n                'amplitude': outputs_unit[self.outputs[0]]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":3232,"id":13712,"name":"amplitude","nodeType":"Attribute","startLoc":3232,"text":"amplitude"},{"attributeType":"null","col":4,"comment":"null","endLoc":3233,"id":13713,"name":"tau","nodeType":"Attribute","startLoc":3233,"text":"tau"},{"className":"Polynomial1D","col":0,"comment":"\n    1D Polynomial model.\n\n    It is defined as:\n\n    .. math::\n\n        P = \\sum_{i=0}^{i=n}C_{i} * x^{i}\n\n    For explanation of ``domain``, and ``window`` see\n    :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : tuple or None, optional\n        If None, it is set to (-1, 1)\n    window : tuple or None, optional\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n\n    ","endLoc":971,"id":13714,"nodeType":"Class","startLoc":867,"text":"class Polynomial1D(_PolyDomainWindow1D):\n    r\"\"\"\n    1D Polynomial model.\n\n    It is defined as:\n\n    .. math::\n\n        P = \\sum_{i=0}^{i=n}C_{i} * x^{i}\n\n    For explanation of ``domain``, and ``window`` see\n    :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : tuple or None, optional\n        If None, it is set to (-1, 1)\n    window : tuple or None, optional\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n\n    \"\"\"\n\n    n_inputs = 1\n    n_outputs = 1\n\n    _separable = True\n\n    def __init__(self, degree, domain=None, window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            degree, domain, window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)\n\n        # Set domain separately because it's different from\n        # the orthogonal polynomials.\n        self._default_domain_window = {'domain': (-1, 1),\n                                       'window': (-1, 1),\n                                       }\n        self.domain = domain or self._default_domain_window['domain']\n        self.window = window or self._default_domain_window['window']\n\n    def prepare_inputs(self, x, **kwargs):\n        inputs, broadcasted_shapes = super().prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n        return (x,), broadcasted_shapes\n\n    def evaluate(self, x, *coeffs):\n        if self.domain is not None:\n            x = poly_map_domain(x, self.domain, self.window)\n        return self.horner(x, coeffs)\n\n    def fit_deriv(self, x, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        v = np.empty((self.degree + 1,) + x.shape, dtype=float)\n        v[0] = 1\n        if self.degree > 0:\n            v[1] = x\n            for i in range(2, self.degree + 1):\n                v[i] = v[i - 1] * x\n        return np.rollaxis(v, 0, v.ndim)\n\n    @staticmethod\n    def horner(x, coeffs):\n        if len(coeffs) == 1:\n            c0 = coeffs[-1] * np.ones_like(x, subok=False)\n        else:\n            c0 = coeffs[-1]\n            for i in range(2, len(coeffs) + 1):\n                c0 = coeffs[-i] + c0 * x\n        return c0\n\n    @property\n    def input_units(self):\n        if self.degree == 0 or self.c1.unit is None:\n            return None\n        else:\n            return {self.inputs[0]: self.c0.unit / self.c1.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        mapping = {}\n        for i in range(self.degree + 1):\n            par = getattr(self, f'c{i}')\n            mapping[par.name] = outputs_unit[self.outputs[0]] / inputs_unit[self.inputs[0]] ** i\n        return mapping"},{"col":4,"comment":"null","endLoc":917,"header":"def prepare_inputs(self, x, **kwargs)","id":13715,"name":"prepare_inputs","nodeType":"Function","startLoc":913,"text":"def prepare_inputs(self, x, **kwargs):\n        inputs, broadcasted_shapes = super().prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n        return (x,), broadcasted_shapes"},{"attributeType":"IAU2015","col":4,"comment":"null","endLoc":32,"id":13716,"name":"M_jup","nodeType":"Attribute","startLoc":32,"text":"M_jup"},{"col":4,"comment":"null","endLoc":922,"header":"def evaluate(self, x, *coeffs)","id":13717,"name":"evaluate","nodeType":"Function","startLoc":919,"text":"def evaluate(self, x, *coeffs):\n        if self.domain is not None:\n            x = poly_map_domain(x, self.domain, self.window)\n        return self.horner(x, coeffs)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1915,"id":13718,"name":"y_0","nodeType":"Attribute","startLoc":1915,"text":"y_0"},{"col":0,"comment":"","endLoc":5,"header":"iau2012.py#<anonymous>","id":13719,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nAstronomical and physics constants in SI units.  See :mod:`astropy.constants`\nfor a complete listing of constants defined in Astropy.\n\"\"\"\n\nau = IAU2012('au', \"Astronomical Unit\", 1.49597870700e11, 'm', 0.0,\n             \"IAU 2012 Resolution B2\", system='si')\n\npc = IAU2012('pc', \"Parsec\", au.value / np.tan(np.radians(1. / 3600.)), 'm',\n             au.uncertainty / np.tan(np.radians(1. / 3600.)),\n             \"Derived from au\", system='si')\n\nkpc = IAU2012('kpc', \"Kiloparsec\",\n              1000. * au.value / np.tan(np.radians(1. / 3600.)), 'm',\n              1000. * au.uncertainty / np.tan(np.radians(1. / 3600.)),\n              \"Derived from au\", system='si')\n\nL_bol0 = IAU2012('L_bol0', \"Luminosity for absolute bolometric magnitude 0\",\n                 3.0128e28, \"W\", 0.0, \"IAU 2015 Resolution B 2\", system='si')\n\nL_sun = IAU2012('L_sun', \"Solar luminosity\", 3.846e26, 'W', 0.0005e26,\n                \"Allen's Astrophysical Quantities 4th Ed.\", system='si')\n\nM_sun = IAU2012('M_sun', \"Solar mass\", 1.9891e30, 'kg', 0.00005e30,\n                \"Allen's Astrophysical Quantities 4th Ed.\", system='si')\n\nR_sun = IAU2012('R_sun', \"Solar radius\", 6.95508e8, 'm', 0.00026e8,\n                \"Allen's Astrophysical Quantities 4th Ed.\", system='si')\n\nM_jup = IAU2012('M_jup', \"Jupiter mass\", 1.8987e27, 'kg', 0.00005e27,\n                \"Allen's Astrophysical Quantities 4th Ed.\", system='si')\n\nR_jup = IAU2012('R_jup', \"Jupiter equatorial radius\", 7.1492e7, 'm',\n                0.00005e7, \"Allen's Astrophysical Quantities 4th Ed.\",\n                system='si')\n\nM_earth = IAU2012('M_earth', \"Earth mass\", 5.9742e24, 'kg', 0.00005e24,\n                  \"Allen's Astrophysical Quantities 4th Ed.\", system='si')\n\nR_earth = IAU2012('R_earth', \"Earth equatorial radius\", 6.378136e6, 'm',\n                  0.0000005e6, \"Allen's Astrophysical Quantities 4th Ed.\",\n                  system='si')"},{"attributeType":"null","col":4,"comment":"null","endLoc":361,"id":13720,"name":"supported_constraints","nodeType":"Attribute","startLoc":361,"text":"supported_constraints"},{"attributeType":"null","col":4,"comment":"null","endLoc":362,"id":13721,"name":"supports_masked_input","nodeType":"Attribute","startLoc":362,"text":"supports_masked_input"},{"attributeType":"null","col":8,"comment":"null","endLoc":370,"id":13722,"name":"_calc_uncertainties","nodeType":"Attribute","startLoc":370,"text":"self._calc_uncertainties"},{"attributeType":"IAU2015","col":4,"comment":"null","endLoc":39,"id":13723,"name":"M_earth","nodeType":"Attribute","startLoc":39,"text":"M_earth"},{"attributeType":"null","col":8,"comment":"null","endLoc":365,"id":13724,"name":"fit_info","nodeType":"Attribute","startLoc":365,"text":"self.fit_info"},{"className":"FittingWithOutlierRemoval","col":0,"comment":"\n    This class combines an outlier removal technique with a fitting procedure.\n    Basically, given a maximum number of iterations ``niter``, outliers are\n    removed and fitting is performed for each iteration, until no new outliers\n    are found or ``niter`` is reached.\n\n    Parameters\n    ----------\n    fitter : `Fitter`\n        An instance of any Astropy fitter, i.e., LinearLSQFitter,\n        LevMarLSQFitter, SLSQPLSQFitter, SimplexLSQFitter, JointFitter. For\n        model set fitting, this must understand masked input data (as\n        indicated by the fitter class attribute ``supports_masked_input``).\n    outlier_func : callable\n        A function for outlier removal.\n        If this accepts an ``axis`` parameter like the `numpy` functions, the\n        appropriate value will be supplied automatically when fitting model\n        sets (unless overridden in ``outlier_kwargs``), to find outliers for\n        each model separately; otherwise, the same filtering must be performed\n        in a loop over models, which is almost an order of magnitude slower.\n    niter : int, optional\n        Maximum number of iterations.\n    outlier_kwargs : dict, optional\n        Keyword arguments for outlier_func.\n\n    Attributes\n    ----------\n    fit_info : dict\n        The ``fit_info`` (if any) from the last iteration of the wrapped\n        ``fitter`` during the most recent fit. An entry is also added with the\n        keyword ``niter`` that records the actual number of fitting iterations\n        performed (as opposed to the user-specified maximum).\n    ","endLoc":1022,"id":13725,"nodeType":"Class","startLoc":795,"text":"class FittingWithOutlierRemoval:\n    \"\"\"\n    This class combines an outlier removal technique with a fitting procedure.\n    Basically, given a maximum number of iterations ``niter``, outliers are\n    removed and fitting is performed for each iteration, until no new outliers\n    are found or ``niter`` is reached.\n\n    Parameters\n    ----------\n    fitter : `Fitter`\n        An instance of any Astropy fitter, i.e., LinearLSQFitter,\n        LevMarLSQFitter, SLSQPLSQFitter, SimplexLSQFitter, JointFitter. For\n        model set fitting, this must understand masked input data (as\n        indicated by the fitter class attribute ``supports_masked_input``).\n    outlier_func : callable\n        A function for outlier removal.\n        If this accepts an ``axis`` parameter like the `numpy` functions, the\n        appropriate value will be supplied automatically when fitting model\n        sets (unless overridden in ``outlier_kwargs``), to find outliers for\n        each model separately; otherwise, the same filtering must be performed\n        in a loop over models, which is almost an order of magnitude slower.\n    niter : int, optional\n        Maximum number of iterations.\n    outlier_kwargs : dict, optional\n        Keyword arguments for outlier_func.\n\n    Attributes\n    ----------\n    fit_info : dict\n        The ``fit_info`` (if any) from the last iteration of the wrapped\n        ``fitter`` during the most recent fit. An entry is also added with the\n        keyword ``niter`` that records the actual number of fitting iterations\n        performed (as opposed to the user-specified maximum).\n    \"\"\"\n\n    def __init__(self, fitter, outlier_func, niter=3, **outlier_kwargs):\n        self.fitter = fitter\n        self.outlier_func = outlier_func\n        self.niter = niter\n        self.outlier_kwargs = outlier_kwargs\n        self.fit_info = {'niter': None}\n\n    def __str__(self):\n        return (\"Fitter: {0}\\nOutlier function: {1}\\nNum. of iterations: {2}\" +\n                (\"\\nOutlier func. args.: {3}\"))\\\n                .format(self.fitter.__class__.__name__,\n                        self.outlier_func.__name__, self.niter,\n                        self.outlier_kwargs)\n\n    def __repr__(self):\n        return (\"{0}(fitter: {1}, outlier_func: {2},\" +\n                \" niter: {3}, outlier_kwargs: {4})\")\\\n                 .format(self.__class__.__name__,\n                         self.fitter.__class__.__name__,\n                         self.outlier_func.__name__, self.niter,\n                         self.outlier_kwargs)\n\n    def __call__(self, model, x, y, z=None, weights=None, **kwargs):\n        \"\"\"\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            An analytic model which will be fit to the provided data.\n            This also contains the initial guess for an optimization\n            algorithm.\n        x : array-like\n            Input coordinates.\n        y : array-like\n            Data measurements (1D case) or input coordinates (2D case).\n        z : array-like, optional\n            Data measurements (2D case).\n        weights : array-like, optional\n            Weights to be passed to the fitter.\n        kwargs : dict, optional\n            Keyword arguments to be passed to the fitter.\n        Returns\n        -------\n        fitted_model : `~astropy.modeling.FittableModel`\n            Fitted model after outlier removal.\n        mask : `numpy.ndarray`\n            Boolean mask array, identifying which points were used in the final\n            fitting iteration (False) and which were found to be outliers or\n            were masked in the input (True).\n        \"\"\"\n\n        # For single models, the data get filtered here at each iteration and\n        # then passed to the fitter, which is the historical behavior and\n        # works even for fitters that don't understand masked arrays. For model\n        # sets, the fitter must be able to filter masked data internally,\n        # because fitters require a single set of x/y coordinates whereas the\n        # eliminated points can vary between models. To avoid this limitation,\n        # we could fall back to looping over individual model fits, but it\n        # would likely be fiddly and involve even more overhead (and the\n        # non-linear fitters don't work with model sets anyway, as of writing).\n\n        if len(model) == 1:\n            model_set_axis = None\n        else:\n            if not hasattr(self.fitter, 'supports_masked_input') or \\\n               self.fitter.supports_masked_input is not True:\n                raise ValueError(\"{} cannot fit model sets with masked \"\n                                 \"values\".format(type(self.fitter).__name__))\n\n            # Fitters use their input model's model_set_axis to determine how\n            # their input data are stacked:\n            model_set_axis = model.model_set_axis\n        # Construct input coordinate tuples for fitters & models that are\n        # appropriate for the dimensionality being fitted:\n        if z is None:\n            coords = (x, )\n            data = y\n        else:\n            coords = x, y\n            data = z\n\n        # For model sets, construct a numpy-standard \"axis\" tuple for the\n        # outlier function, to treat each model separately (if supported):\n        if model_set_axis is not None:\n\n            if model_set_axis < 0:\n                model_set_axis += data.ndim\n\n            if 'axis' not in self.outlier_kwargs:  # allow user override\n                # This also works for False (like model instantiation):\n                self.outlier_kwargs['axis'] = tuple(\n                    n for n in range(data.ndim) if n != model_set_axis\n                )\n\n        loop = False\n\n        # Starting fit, prior to any iteration and masking:\n        fitted_model = self.fitter(model, x, y, z, weights=weights, **kwargs)\n        filtered_data = np.ma.masked_array(data)\n        if filtered_data.mask is np.ma.nomask:\n            filtered_data.mask = False\n        filtered_weights = weights\n        last_n_masked = filtered_data.mask.sum()\n        n = 0  # (allow recording no. of iterations when 0)\n\n        # Perform the iterative fitting:\n        for n in range(1, self.niter + 1):\n\n            # (Re-)evaluate the last model:\n            model_vals = fitted_model(*coords, model_set_axis=False)\n\n            # Determine the outliers:\n            if not loop:\n\n                # Pass axis parameter if outlier_func accepts it, otherwise\n                # prepare for looping over models:\n                try:\n                    filtered_data = self.outlier_func(\n                        filtered_data - model_vals, **self.outlier_kwargs\n                    )\n                # If this happens to catch an error with a parameter other\n                # than axis, the next attempt will fail accordingly:\n                except TypeError:\n                    if model_set_axis is None:\n                        raise\n                    else:\n                        self.outlier_kwargs.pop('axis', None)\n                        loop = True\n\n                        # Construct MaskedArray to hold filtered values:\n                        filtered_data = np.ma.masked_array(\n                            filtered_data,\n                            dtype=np.result_type(filtered_data, model_vals),\n                            copy=True\n                        )\n                        # Make sure the mask is an array, not just nomask:\n                        if filtered_data.mask is np.ma.nomask:\n                            filtered_data.mask = False\n\n                        # Get views transposed appropriately for iteration\n                        # over the set (handling data & mask separately due to\n                        # NumPy issue #8506):\n                        data_T = np.rollaxis(filtered_data, model_set_axis, 0)\n                        mask_T = np.rollaxis(filtered_data.mask,\n                                             model_set_axis, 0)\n\n            if loop:\n                model_vals_T = np.rollaxis(model_vals, model_set_axis, 0)\n                for row_data, row_mask, row_mod_vals in zip(data_T, mask_T,\n                                                            model_vals_T):\n                    masked_residuals = self.outlier_func(\n                        row_data - row_mod_vals, **self.outlier_kwargs\n                    )\n                    row_data.data[:] = masked_residuals.data\n                    row_mask[:] = masked_residuals.mask\n\n                # Issue speed warning after the fact, so it only shows up when\n                # the TypeError is genuinely due to the axis argument.\n                warnings.warn('outlier_func did not accept axis argument; '\n                              'reverted to slow loop over models.',\n                              AstropyUserWarning)\n\n            # Recombine newly-masked residuals with model to get masked values:\n            filtered_data += model_vals\n\n            # Re-fit the data after filtering, passing masked/unmasked values\n            # for single models / sets, respectively:\n            if model_set_axis is None:\n\n                good = ~filtered_data.mask\n\n                if weights is not None:\n                    filtered_weights = weights[good]\n\n                fitted_model = self.fitter(fitted_model,\n                                           *(c[good] for c in coords),\n                                           filtered_data.data[good],\n                                           weights=filtered_weights, **kwargs)\n            else:\n                fitted_model = self.fitter(fitted_model, *coords,\n                                           filtered_data,\n                                           weights=filtered_weights, **kwargs)\n\n            # Stop iteration if the masked points are no longer changing (with\n            # cumulative rejection we only need to compare how many there are):\n            this_n_masked = filtered_data.mask.sum()  # (minimal overhead)\n            if this_n_masked == last_n_masked:\n                break\n            last_n_masked = this_n_masked\n\n        self.fit_info = {'niter': n}\n        self.fit_info.update(getattr(self.fitter, 'fit_info', {}))\n\n        return fitted_model, filtered_data.mask"},{"col":4,"comment":"null","endLoc":835,"header":"def __init__(self, fitter, outlier_func, niter=3, **outlier_kwargs)","id":13726,"name":"__init__","nodeType":"Function","startLoc":830,"text":"def __init__(self, fitter, outlier_func, niter=3, **outlier_kwargs):\n        self.fitter = fitter\n        self.outlier_func = outlier_func\n        self.niter = niter\n        self.outlier_kwargs = outlier_kwargs\n        self.fit_info = {'niter': None}"},{"col":4,"comment":"null","endLoc":842,"header":"def __str__(self)","id":13727,"name":"__str__","nodeType":"Function","startLoc":837,"text":"def __str__(self):\n        return (\"Fitter: {0}\\nOutlier function: {1}\\nNum. of iterations: {2}\" +\n                (\"\\nOutlier func. args.: {3}\"))\\\n                .format(self.fitter.__class__.__name__,\n                        self.outlier_func.__name__, self.niter,\n                        self.outlier_kwargs)"},{"col":4,"comment":"null","endLoc":850,"header":"def __repr__(self)","id":13728,"name":"__repr__","nodeType":"Function","startLoc":844,"text":"def __repr__(self):\n        return (\"{0}(fitter: {1}, outlier_func: {2},\" +\n                \" niter: {3}, outlier_kwargs: {4})\")\\\n                 .format(self.__class__.__name__,\n                         self.fitter.__class__.__name__,\n                         self.outlier_func.__name__, self.niter,\n                         self.outlier_kwargs)"},{"col":4,"comment":"\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            An analytic model which will be fit to the provided data.\n            This also contains the initial guess for an optimization\n            algorithm.\n        x : array-like\n            Input coordinates.\n        y : array-like\n            Data measurements (1D case) or input coordinates (2D case).\n        z : array-like, optional\n            Data measurements (2D case).\n        weights : array-like, optional\n            Weights to be passed to the fitter.\n        kwargs : dict, optional\n            Keyword arguments to be passed to the fitter.\n        Returns\n        -------\n        fitted_model : `~astropy.modeling.FittableModel`\n            Fitted model after outlier removal.\n        mask : `numpy.ndarray`\n            Boolean mask array, identifying which points were used in the final\n            fitting iteration (False) and which were found to be outliers or\n            were masked in the input (True).\n        ","endLoc":1022,"header":"def __call__(self, model, x, y, z=None, weights=None, **kwargs)","id":13729,"name":"__call__","nodeType":"Function","startLoc":852,"text":"def __call__(self, model, x, y, z=None, weights=None, **kwargs):\n        \"\"\"\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            An analytic model which will be fit to the provided data.\n            This also contains the initial guess for an optimization\n            algorithm.\n        x : array-like\n            Input coordinates.\n        y : array-like\n            Data measurements (1D case) or input coordinates (2D case).\n        z : array-like, optional\n            Data measurements (2D case).\n        weights : array-like, optional\n            Weights to be passed to the fitter.\n        kwargs : dict, optional\n            Keyword arguments to be passed to the fitter.\n        Returns\n        -------\n        fitted_model : `~astropy.modeling.FittableModel`\n            Fitted model after outlier removal.\n        mask : `numpy.ndarray`\n            Boolean mask array, identifying which points were used in the final\n            fitting iteration (False) and which were found to be outliers or\n            were masked in the input (True).\n        \"\"\"\n\n        # For single models, the data get filtered here at each iteration and\n        # then passed to the fitter, which is the historical behavior and\n        # works even for fitters that don't understand masked arrays. For model\n        # sets, the fitter must be able to filter masked data internally,\n        # because fitters require a single set of x/y coordinates whereas the\n        # eliminated points can vary between models. To avoid this limitation,\n        # we could fall back to looping over individual model fits, but it\n        # would likely be fiddly and involve even more overhead (and the\n        # non-linear fitters don't work with model sets anyway, as of writing).\n\n        if len(model) == 1:\n            model_set_axis = None\n        else:\n            if not hasattr(self.fitter, 'supports_masked_input') or \\\n               self.fitter.supports_masked_input is not True:\n                raise ValueError(\"{} cannot fit model sets with masked \"\n                                 \"values\".format(type(self.fitter).__name__))\n\n            # Fitters use their input model's model_set_axis to determine how\n            # their input data are stacked:\n            model_set_axis = model.model_set_axis\n        # Construct input coordinate tuples for fitters & models that are\n        # appropriate for the dimensionality being fitted:\n        if z is None:\n            coords = (x, )\n            data = y\n        else:\n            coords = x, y\n            data = z\n\n        # For model sets, construct a numpy-standard \"axis\" tuple for the\n        # outlier function, to treat each model separately (if supported):\n        if model_set_axis is not None:\n\n            if model_set_axis < 0:\n                model_set_axis += data.ndim\n\n            if 'axis' not in self.outlier_kwargs:  # allow user override\n                # This also works for False (like model instantiation):\n                self.outlier_kwargs['axis'] = tuple(\n                    n for n in range(data.ndim) if n != model_set_axis\n                )\n\n        loop = False\n\n        # Starting fit, prior to any iteration and masking:\n        fitted_model = self.fitter(model, x, y, z, weights=weights, **kwargs)\n        filtered_data = np.ma.masked_array(data)\n        if filtered_data.mask is np.ma.nomask:\n            filtered_data.mask = False\n        filtered_weights = weights\n        last_n_masked = filtered_data.mask.sum()\n        n = 0  # (allow recording no. of iterations when 0)\n\n        # Perform the iterative fitting:\n        for n in range(1, self.niter + 1):\n\n            # (Re-)evaluate the last model:\n            model_vals = fitted_model(*coords, model_set_axis=False)\n\n            # Determine the outliers:\n            if not loop:\n\n                # Pass axis parameter if outlier_func accepts it, otherwise\n                # prepare for looping over models:\n                try:\n                    filtered_data = self.outlier_func(\n                        filtered_data - model_vals, **self.outlier_kwargs\n                    )\n                # If this happens to catch an error with a parameter other\n                # than axis, the next attempt will fail accordingly:\n                except TypeError:\n                    if model_set_axis is None:\n                        raise\n                    else:\n                        self.outlier_kwargs.pop('axis', None)\n                        loop = True\n\n                        # Construct MaskedArray to hold filtered values:\n                        filtered_data = np.ma.masked_array(\n                            filtered_data,\n                            dtype=np.result_type(filtered_data, model_vals),\n                            copy=True\n                        )\n                        # Make sure the mask is an array, not just nomask:\n                        if filtered_data.mask is np.ma.nomask:\n                            filtered_data.mask = False\n\n                        # Get views transposed appropriately for iteration\n                        # over the set (handling data & mask separately due to\n                        # NumPy issue #8506):\n                        data_T = np.rollaxis(filtered_data, model_set_axis, 0)\n                        mask_T = np.rollaxis(filtered_data.mask,\n                                             model_set_axis, 0)\n\n            if loop:\n                model_vals_T = np.rollaxis(model_vals, model_set_axis, 0)\n                for row_data, row_mask, row_mod_vals in zip(data_T, mask_T,\n                                                            model_vals_T):\n                    masked_residuals = self.outlier_func(\n                        row_data - row_mod_vals, **self.outlier_kwargs\n                    )\n                    row_data.data[:] = masked_residuals.data\n                    row_mask[:] = masked_residuals.mask\n\n                # Issue speed warning after the fact, so it only shows up when\n                # the TypeError is genuinely due to the axis argument.\n                warnings.warn('outlier_func did not accept axis argument; '\n                              'reverted to slow loop over models.',\n                              AstropyUserWarning)\n\n            # Recombine newly-masked residuals with model to get masked values:\n            filtered_data += model_vals\n\n            # Re-fit the data after filtering, passing masked/unmasked values\n            # for single models / sets, respectively:\n            if model_set_axis is None:\n\n                good = ~filtered_data.mask\n\n                if weights is not None:\n                    filtered_weights = weights[good]\n\n                fitted_model = self.fitter(fitted_model,\n                                           *(c[good] for c in coords),\n                                           filtered_data.data[good],\n                                           weights=filtered_weights, **kwargs)\n            else:\n                fitted_model = self.fitter(fitted_model, *coords,\n                                           filtered_data,\n                                           weights=filtered_weights, **kwargs)\n\n            # Stop iteration if the masked points are no longer changing (with\n            # cumulative rejection we only need to compare how many there are):\n            this_n_masked = filtered_data.mask.sum()  # (minimal overhead)\n            if this_n_masked == last_n_masked:\n                break\n            last_n_masked = this_n_masked\n\n        self.fit_info = {'niter': n}\n        self.fit_info.update(getattr(self.fitter, 'fit_info', {}))\n\n        return fitted_model, filtered_data.mask"},{"col":0,"comment":"","endLoc":6,"header":"astropyconst40.py#<anonymous>","id":13730,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nAstronomical and physics constants for Astropy v4.0.\nSee :mod:`astropy.constants` for a complete listing of constants defined\nin Astropy.\n\"\"\"\n\ncodata = codata2018\n\niaudata = iau2015\n\n_utils._set_c(codata, iaudata, find_current_module())\n\nwith warnings.catch_warnings():\n    warnings.filterwarnings('ignore', 'Constant .*already has a definition')\n\n    # Solar mass (derived from mass parameter and gravitational constant)\n    M_sun = iau2015.IAU2015(\n        'M_sun', \"Solar mass\", iau2015.GM_sun.value / codata2018.G.value,\n        'kg', ((codata2018.G.uncertainty / codata2018.G.value) *\n               (iau2015.GM_sun.value / codata2018.G.value)),\n        f\"IAU 2015 Resolution B 3 + {codata2018.G.reference}\", system='si')\n\n    # Jupiter mass (derived from mass parameter and gravitational constant)\n    M_jup = iau2015.IAU2015(\n        'M_jup', \"Jupiter mass\", iau2015.GM_jup.value / codata2018.G.value,\n        'kg', ((codata2018.G.uncertainty / codata2018.G.value) *\n               (iau2015.GM_jup.value / codata2018.G.value)),\n        f\"IAU 2015 Resolution B 3 + {codata2018.G.reference}\", system='si')\n\n    # Earth mass (derived from mass parameter and gravitational constant)\n    M_earth = iau2015.IAU2015(\n        'M_earth', \"Earth mass\",\n        iau2015.GM_earth.value / codata2018.G.value,\n        'kg', ((codata2018.G.uncertainty / codata2018.G.value) *\n               (iau2015.GM_earth.value / codata2018.G.value)),\n        f\"IAU 2015 Resolution B 3 + {codata2018.G.reference}\", system='si')\n\ndel warnings\n\ndel find_current_module\n\ndel _utils"},{"fileName":"iau2015.py","filePath":"astropy/constants","id":13731,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nAstronomical and physics constants in SI units.  See :mod:`astropy.constants`\nfor a complete listing of constants defined in Astropy.\n\"\"\"\n\nimport numpy as np\n\nfrom .config import codata\nfrom .constant import Constant\n\n# ASTRONOMICAL CONSTANTS\n\n\nclass IAU2015(Constant):\n    default_reference = 'IAU 2015'\n    _registry = {}\n    _has_incompatible_units = set()\n\n\n# DISTANCE\n\n# Astronomical Unit (did not change from 2012)\nau = IAU2015('au', \"Astronomical Unit\", 1.49597870700e11, 'm', 0.0,\n             \"IAU 2012 Resolution B2\", system='si')\n\n# Parsec\n\npc = IAU2015('pc', \"Parsec\", au.value / np.radians(1. / 3600.), 'm',\n             au.uncertainty / np.radians(1. / 3600.),\n             \"Derived from au + IAU 2015 Resolution B 2 note [4]\", system='si')\n\n# Kiloparsec\nkpc = IAU2015('kpc', \"Kiloparsec\",\n              1000. * au.value / np.radians(1. / 3600.), 'm',\n              1000. * au.uncertainty / np.radians(1. / 3600.),\n              \"Derived from au + IAU 2015 Resolution B 2 note [4]\", system='si')\n\n# Luminosity\nL_bol0 = IAU2015('L_bol0', \"Luminosity for absolute bolometric magnitude 0\",\n                 3.0128e28, \"W\", 0.0, \"IAU 2015 Resolution B 2\", system='si')\n\n\n# SOLAR QUANTITIES\n\n# Solar luminosity\nL_sun = IAU2015('L_sun', \"Nominal solar luminosity\", 3.828e26,\n                'W', 0.0, \"IAU 2015 Resolution B 3\", system='si')\n\n# Solar mass parameter\nGM_sun = IAU2015('GM_sun', 'Nominal solar mass parameter', 1.3271244e20,\n                 'm3 / (s2)', 0.0, \"IAU 2015 Resolution B 3\", system='si')\n\n# Solar mass (derived from mass parameter and gravitational constant)\nM_sun = IAU2015('M_sun', \"Solar mass\", GM_sun.value / codata.G.value,\n                'kg', ((codata.G.uncertainty / codata.G.value) *\n                       (GM_sun.value / codata.G.value)),\n                f\"IAU 2015 Resolution B 3 + {codata.G.reference}\",\n                system='si')\n\n# Solar radius\nR_sun = IAU2015('R_sun', \"Nominal solar radius\", 6.957e8, 'm', 0.0,\n                \"IAU 2015 Resolution B 3\", system='si')\n\n\n# OTHER SOLAR SYSTEM QUANTITIES\n\n# Jupiter mass parameter\nGM_jup = IAU2015('GM_jup', 'Nominal Jupiter mass parameter', 1.2668653e17,\n                 'm3 / (s2)', 0.0, \"IAU 2015 Resolution B 3\", system='si')\n\n# Jupiter mass (derived from mass parameter and gravitational constant)\nM_jup = IAU2015('M_jup', \"Jupiter mass\", GM_jup.value / codata.G.value,\n                'kg', ((codata.G.uncertainty / codata.G.value) *\n                       (GM_jup.value / codata.G.value)),\n                f\"IAU 2015 Resolution B 3 + {codata.G.reference}\",\n                system='si')\n\n# Jupiter equatorial radius\nR_jup = IAU2015('R_jup', \"Nominal Jupiter equatorial radius\", 7.1492e7,\n                'm', 0.0, \"IAU 2015 Resolution B 3\", system='si')\n\n# Earth mass parameter\nGM_earth = IAU2015('GM_earth', 'Nominal Earth mass parameter', 3.986004e14,\n                   'm3 / (s2)', 0.0, \"IAU 2015 Resolution B 3\", system='si')\n\n# Earth mass (derived from mass parameter and gravitational constant)\nM_earth = IAU2015('M_earth', \"Earth mass\",\n                  GM_earth.value / codata.G.value,\n                  'kg', ((codata.G.uncertainty / codata.G.value) *\n                         (GM_earth.value / codata.G.value)),\n                  f\"IAU 2015 Resolution B 3 + {codata.G.reference}\",\n                  system='si')\n\n# Earth equatorial radius\nR_earth = IAU2015('R_earth', \"Nominal Earth equatorial radius\", 6.3781e6,\n                  'm', 0.0, \"IAU 2015 Resolution B 3\", system='si')\n"},{"col":4,"comment":"null","endLoc":957,"header":"@staticmethod\n    def horner(x, coeffs)","id":13732,"name":"horner","nodeType":"Function","startLoc":949,"text":"@staticmethod\n    def horner(x, coeffs):\n        if len(coeffs) == 1:\n            c0 = coeffs[-1] * np.ones_like(x, subok=False)\n        else:\n            c0 = coeffs[-1]\n            for i in range(2, len(coeffs) + 1):\n                c0 = coeffs[-i] + c0 * x\n        return c0"},{"fileName":"codata2010.py","filePath":"astropy/constants","id":13733,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nAstronomical and physics constants in SI units.  See :mod:`astropy.constants`\nfor a complete listing of constants defined in Astropy.\n\"\"\"\n\nimport numpy as np\n\nfrom .constant import Constant, EMConstant\n\n# PHYSICAL CONSTANTS\n\nclass CODATA2010(Constant):\n    default_reference = 'CODATA 2010'\n    _registry = {}\n    _has_incompatible_units = set()\n\n    def __new__(cls, abbrev, name, value, unit, uncertainty,\n                reference=default_reference, system=None):\n        return super().__new__(\n            cls, abbrev, name, value, unit, uncertainty, reference, system)\n\n\nclass EMCODATA2010(CODATA2010, EMConstant):\n    _registry = CODATA2010._registry\n\n\nh = CODATA2010('h', \"Planck constant\", 6.62606957e-34, 'J s',\n                    0.00000029e-34, system='si')\n\nhbar = CODATA2010('hbar', \"Reduced Planck constant\",\n                  h.value * 0.5 / np.pi, 'J s',\n                  h.uncertainty * 0.5 / np.pi,\n                  h.reference, system='si')\n\nk_B = CODATA2010('k_B', \"Boltzmann constant\", 1.3806488e-23, 'J / (K)',\n                 0.0000013e-23, system='si')\n\nc = CODATA2010('c', \"Speed of light in vacuum\", 2.99792458e8, 'm / (s)', 0.,\n               system='si')\n\nG = CODATA2010('G', \"Gravitational constant\", 6.67384e-11, 'm3 / (kg s2)',\n               0.00080e-11, system='si')\n\ng0 = CODATA2010('g0', \"Standard acceleration of gravity\", 9.80665, 'm / s2',\n                0.0, system='si')\n\nm_p = CODATA2010('m_p', \"Proton mass\", 1.672621777e-27, 'kg', 0.000000074e-27,\n                 system='si')\n\nm_n = CODATA2010('m_n', \"Neutron mass\", 1.674927351e-27, 'kg', 0.000000074e-27,\n                 system='si')\n\nm_e = CODATA2010('m_e', \"Electron mass\", 9.10938291e-31, 'kg', 0.00000040e-31,\n                 system='si')\n\nu = CODATA2010('u', \"Atomic mass\", 1.660538921e-27, 'kg', 0.000000073e-27,\n               system='si')\n\nsigma_sb = CODATA2010('sigma_sb', \"Stefan-Boltzmann constant\", 5.670373e-8,\n                      'W / (K4 m2)', 0.000021e-8, system='si')\n\ne = EMCODATA2010('e', 'Electron charge', 1.602176565e-19, 'C', 0.000000035e-19,\n                 system='si')\n\neps0 = EMCODATA2010('eps0', 'Electric constant', 8.854187817e-12, 'F/m', 0.0,\n                    system='si')\n\nN_A = CODATA2010('N_A', \"Avogadro's number\", 6.02214129e23, '1 / (mol)',\n                 0.00000027e23, system='si')\n\nR = CODATA2010('R', \"Gas constant\", 8.3144621, 'J / (K mol)', 0.0000075,\n               system='si')\n\nRyd = CODATA2010('Ryd', 'Rydberg constant', 10973731.568539, '1 / (m)',\n                 0.000055, system='si')\n\na0 = CODATA2010('a0', \"Bohr radius\", 0.52917721092e-10, 'm', 0.00000000017e-10,\n                system='si')\n\nmuB = CODATA2010('muB', \"Bohr magneton\", 927.400968e-26, 'J/T', 0.00002e-26,\n                 system='si')\n\nalpha = CODATA2010('alpha', \"Fine-structure constant\", 7.2973525698e-3,\n                   '', 0.0000000024e-3, system='si')\n\natm = CODATA2010('atm', \"Standard atmosphere\", 101325, 'Pa', 0.0,\n                 system='si')\n\nmu0 = CODATA2010('mu0', \"Magnetic constant\", 4.0e-7 * np.pi, 'N/A2', 0.0,\n                 system='si')\n\nsigma_T = CODATA2010('sigma_T', \"Thomson scattering cross-section\",\n                     0.6652458734e-28, 'm2', 0.0000000013e-28, system='si')\n\nb_wien = Constant('b_wien', 'Wien wavelength displacement law constant',\n                  2.8977721e-3, 'm K', 0.0000026e-3, 'CODATA 2010', system='si')\n\n# cgs constants\n# Only constants that cannot be converted directly from S.I. are defined here.\n\ne_esu = EMCODATA2010(e.abbrev, e.name, e.value * c.value * 10.0,\n                     'statC', e.uncertainty * c.value * 10.0, system='esu')\n\ne_emu = EMCODATA2010(e.abbrev, e.name, e.value / 10, 'abC',\n                     e.uncertainty / 10, system='emu')\n\ne_gauss = EMCODATA2010(e.abbrev, e.name, e.value * c.value * 10.0,\n                       'Fr', e.uncertainty * c.value * 10.0, system='gauss')\n"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1916,"id":13734,"name":"a","nodeType":"Attribute","startLoc":1916,"text":"a"},{"col":4,"comment":"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        ","endLoc":947,"header":"def fit_deriv(self, x, *params)","id":13735,"name":"fit_deriv","nodeType":"Function","startLoc":924,"text":"def fit_deriv(self, x, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        v = np.empty((self.degree + 1,) + x.shape, dtype=float)\n        v[0] = 1\n        if self.degree > 0:\n            v[1] = x\n            for i in range(2, self.degree + 1):\n                v[i] = v[i - 1] * x\n        return np.rollaxis(v, 0, v.ndim)"},{"col":4,"comment":"null","endLoc":964,"header":"@property\n    def input_units(self)","id":13736,"name":"input_units","nodeType":"Function","startLoc":959,"text":"@property\n    def input_units(self):\n        if self.degree == 0 or self.c1.unit is None:\n            return None\n        else:\n            return {self.inputs[0]: self.c0.unit / self.c1.unit}"},{"className":"CODATA2010","col":0,"comment":"null","endLoc":21,"id":13737,"nodeType":"Class","startLoc":13,"text":"class CODATA2010(Constant):\n    default_reference = 'CODATA 2010'\n    _registry = {}\n    _has_incompatible_units = set()\n\n    def __new__(cls, abbrev, name, value, unit, uncertainty,\n                reference=default_reference, system=None):\n        return super().__new__(\n            cls, abbrev, name, value, unit, uncertainty, reference, system)"},{"col":4,"comment":"null","endLoc":971,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13738,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":966,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        mapping = {}\n        for i in range(self.degree + 1):\n            par = getattr(self, f'c{i}')\n            mapping[par.name] = outputs_unit[self.outputs[0]] / inputs_unit[self.inputs[0]] ** i\n        return mapping"},{"col":4,"comment":"null","endLoc":864,"header":"@staticmethod\n    def clenshaw(x, coeffs)","id":13739,"name":"clenshaw","nodeType":"Function","startLoc":847,"text":"@staticmethod\n    def clenshaw(x, coeffs):\n        if len(coeffs) == 1:\n            c0 = coeffs[0]\n            c1 = 0\n        elif len(coeffs) == 2:\n            c0 = coeffs[0]\n            c1 = coeffs[1]\n        else:\n            nd = len(coeffs)\n            c0 = coeffs[-2]\n            c1 = coeffs[-1]\n            for i in range(3, len(coeffs) + 1):\n                tmp = c0\n                nd = nd - 1\n                c0 = coeffs[-i] - (c1 * (nd - 1)) / nd\n                c1 = tmp + (c1 * x * (2 * nd - 1)) / nd\n        return c0 + c1 * x"},{"col":4,"comment":"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        ","endLoc":845,"header":"def fit_deriv(self, x, *params)","id":13740,"name":"fit_deriv","nodeType":"Function","startLoc":821,"text":"def fit_deriv(self, x, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        v = np.empty((self.degree + 1,) + x.shape, dtype=x.dtype)\n        v[0] = 1\n        if self.degree > 0:\n            v[1] = x\n            for i in range(2, self.degree + 1):\n                v[i] = (v[i - 1] * x * (2 * i - 1) - v[i - 2] * (i - 1)) / i\n        return np.rollaxis(v, 0, v.ndim)"},{"className":"IAU2015","col":0,"comment":"null","endLoc":18,"id":13741,"nodeType":"Class","startLoc":15,"text":"class IAU2015(Constant):\n    default_reference = 'IAU 2015'\n    _registry = {}\n    _has_incompatible_units = set()"},{"attributeType":"null","col":4,"comment":"null","endLoc":894,"id":13742,"name":"n_inputs","nodeType":"Attribute","startLoc":894,"text":"n_inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":895,"id":13743,"name":"n_outputs","nodeType":"Attribute","startLoc":895,"text":"n_outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":897,"id":13744,"name":"_separable","nodeType":"Attribute","startLoc":897,"text":"_separable"},{"attributeType":"null","col":8,"comment":"null","endLoc":910,"id":13745,"name":"domain","nodeType":"Attribute","startLoc":910,"text":"self.domain"},{"col":4,"comment":"null","endLoc":21,"header":"def __new__(cls, abbrev, name, value, unit, uncertainty,\n                reference=default_reference, system=None)","id":13746,"name":"__new__","nodeType":"Function","startLoc":18,"text":"def __new__(cls, abbrev, name, value, unit, uncertainty,\n                reference=default_reference, system=None):\n        return super().__new__(\n            cls, abbrev, name, value, unit, uncertainty, reference, system)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1917,"id":13747,"name":"b","nodeType":"Attribute","startLoc":1917,"text":"b"},{"attributeType":"null","col":8,"comment":"null","endLoc":911,"id":13748,"name":"window","nodeType":"Attribute","startLoc":911,"text":"self.window"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":13749,"name":"default_reference","nodeType":"Attribute","startLoc":16,"text":"default_reference"},{"attributeType":"null","col":8,"comment":"null","endLoc":907,"id":13750,"name":"_default_domain_window","nodeType":"Attribute","startLoc":907,"text":"self._default_domain_window"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":13751,"name":"_registry","nodeType":"Attribute","startLoc":17,"text":"_registry"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":13752,"name":"_has_incompatible_units","nodeType":"Attribute","startLoc":18,"text":"_has_incompatible_units"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":24,"id":13753,"name":"au","nodeType":"Attribute","startLoc":24,"text":"au"},{"className":"Polynomial2D","col":0,"comment":"\n    2D Polynomial  model.\n\n    Represents a general polynomial of degree n:\n\n    .. math::\n\n        P(x,y) = c_{00} + c_{10}x + ...+ c_{n0}x^n + c_{01}y + ...+ c_{0n}y^n\n        + c_{11}xy + c_{12}xy^2 + ... + c_{1(n-1)}xy^{n-1}+ ... + c_{(n-1)1}x^{n-1}y\n\n    For explanation of ``x_domain``, ``y_domain``, ``x_window`` and ``y_window``\n    see :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n    degree : int\n        Polynomial degree: largest sum of exponents (:math:`i + j`) of\n        variables in each monomial term of the form :math:`x^i y^j`. The\n        number of terms in a 2D polynomial of degree ``n`` is given by binomial\n        coefficient :math:`C(n + 2, 2) = (n + 2)! / (2!\\,n!) = (n + 1)(n + 2) / 2`.\n    x_domain : tuple or None, optional\n        domain of the x independent variable\n        If None, it is set to (-1, 1)\n    y_domain : tuple or None, optional\n        domain of the y independent variable\n        If None, it is set to (-1, 1)\n    x_window : tuple or None, optional\n        range of the x independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the x_domain to x_window\n    y_window : tuple or None, optional\n        range of the y independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the y_domain to y_window\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n    ","endLoc":1205,"id":13754,"nodeType":"Class","startLoc":974,"text":"class Polynomial2D(PolynomialModel):\n    r\"\"\"\n    2D Polynomial  model.\n\n    Represents a general polynomial of degree n:\n\n    .. math::\n\n        P(x,y) = c_{00} + c_{10}x + ...+ c_{n0}x^n + c_{01}y + ...+ c_{0n}y^n\n        + c_{11}xy + c_{12}xy^2 + ... + c_{1(n-1)}xy^{n-1}+ ... + c_{(n-1)1}x^{n-1}y\n\n    For explanation of ``x_domain``, ``y_domain``, ``x_window`` and ``y_window``\n    see :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n    degree : int\n        Polynomial degree: largest sum of exponents (:math:`i + j`) of\n        variables in each monomial term of the form :math:`x^i y^j`. The\n        number of terms in a 2D polynomial of degree ``n`` is given by binomial\n        coefficient :math:`C(n + 2, 2) = (n + 2)! / (2!\\,n!) = (n + 1)(n + 2) / 2`.\n    x_domain : tuple or None, optional\n        domain of the x independent variable\n        If None, it is set to (-1, 1)\n    y_domain : tuple or None, optional\n        domain of the y independent variable\n        If None, it is set to (-1, 1)\n    x_window : tuple or None, optional\n        range of the x independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the x_domain to x_window\n    y_window : tuple or None, optional\n        range of the y independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the y_domain to y_window\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n    \"\"\"\n\n    n_inputs = 2\n    n_outputs = 1\n\n    _separable = False\n\n    def __init__(self, degree, x_domain=None, y_domain=None,\n                 x_window=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        super().__init__(\n            degree, n_models=n_models, model_set_axis=model_set_axis,\n            name=name, meta=meta, **params)\n\n        self._default_domain_window = {\n            'x_domain': (-1, 1),\n            'y_domain': (-1, 1),\n            'x_window': (-1, 1),\n            'y_window': (-1, 1)\n            }\n\n        self.x_domain = x_domain or self._default_domain_window['x_domain']\n        self.y_domain = y_domain or self._default_domain_window['y_domain']\n        self.x_window = x_window or self._default_domain_window['x_window']\n        self.y_window = y_window or self._default_domain_window['y_window']\n\n    def prepare_inputs(self, x, y, **kwargs):\n\n        inputs, broadcasted_shapes = super().prepare_inputs(x, y, **kwargs)\n\n        x, y = inputs\n        return (x, y), broadcasted_shapes\n\n    def evaluate(self, x, y, *coeffs):\n        if self.x_domain is not None:\n            x = poly_map_domain(x, self.x_domain, self.x_window)\n        if self.y_domain is not None:\n            y = poly_map_domain(y, self.y_domain, self.y_window)\n        invcoeff = self.invlex_coeff(coeffs)\n        result = self.multivariate_horner(x, y, invcoeff)\n\n        # Special case for degree==0 to ensure that the shape of the output is\n        # still as expected by the broadcasting rules, even though the x and y\n        # inputs are not used in the evaluation\n        if self.degree == 0:\n            output_shape = check_broadcast(np.shape(coeffs[0]), x.shape)\n            if output_shape:\n                new_result = np.empty(output_shape)\n                new_result[:] = result\n                result = new_result\n\n        return result\n\n    def __repr__(self):\n        return self._format_repr([self.degree],\n                                 kwargs={'x_domain': self.x_domain,\n                                         'y_domain': self.y_domain,\n                                         'x_window': self.x_window,\n                                         'y_window': self.y_window},\n                                 defaults=self._default_domain_window)\n\n    def __str__(self):\n        return self._format_str([('Degree', self.degree),\n                                 ('X_Domain', self.x_domain),\n                                 ('Y_Domain', self.y_domain),\n                                 ('X_Window', self.x_window),\n                                 ('Y_Window', self.y_window)],\n                                 self._default_domain_window)\n\n    def fit_deriv(self, x, y, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        y : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        if x.ndim == 2:\n            x = x.flatten()\n        if y.ndim == 2:\n            y = y.flatten()\n        if x.size != y.size:\n            raise ValueError('Expected x and y to be of equal size')\n\n        designx = x[:, None] ** np.arange(self.degree + 1)\n        designy = y[:, None] ** np.arange(1, self.degree + 1)\n\n        designmixed = []\n        for i in range(1, self.degree):\n            for j in range(1, self.degree):\n                if i + j <= self.degree:\n                    designmixed.append((x ** i) * (y ** j))\n        designmixed = np.array(designmixed).T\n        if designmixed.any():\n            v = np.hstack([designx, designy, designmixed])\n        else:\n            v = np.hstack([designx, designy])\n        return v\n\n    def invlex_coeff(self, coeffs):\n        invlex_coeffs = []\n        lencoeff = range(self.degree + 1)\n        for i in lencoeff:\n            for j in lencoeff:\n                if i + j <= self.degree:\n                    name = f'c{j}_{i}'\n                    coeff = coeffs[self.param_names.index(name)]\n                    invlex_coeffs.append(coeff)\n        return invlex_coeffs[::-1]\n\n    def multivariate_horner(self, x, y, coeffs):\n        \"\"\"\n        Multivariate Horner's scheme\n\n        Parameters\n        ----------\n        x, y : array\n        coeffs : array\n            Coefficients in inverse lexical order.\n        \"\"\"\n\n        alpha = self._invlex()\n        r0 = coeffs[0]\n        r1 = r0 * 0.0\n        r2 = r0 * 0.0\n        karr = np.diff(alpha, axis=0)\n\n        for n in range(len(karr)):\n            if karr[n, 1] != 0:\n                r2 = y * (r0 + r1 + r2)\n                r1 = np.zeros_like(coeffs[0], subok=False)\n            else:\n                r1 = x * (r0 + r1)\n            r0 = coeffs[n + 1]\n        return r0 + r1 + r2\n\n    @property\n    def input_units(self):\n        if self.degree == 0 or (self.c1_0.unit is None and self.c0_1.unit is None):\n            return None\n        return {self.inputs[0]: self.c0_0.unit / self.c1_0.unit,\n                self.inputs[1]: self.c0_0.unit / self.c0_1.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        mapping = {}\n        for i in range(self.degree + 1):\n            for j in range(self.degree + 1):\n                if i + j > 2:\n                    continue\n                par = getattr(self, f'c{i}_{j}')\n                mapping[par.name] = outputs_unit[self.outputs[0]] / inputs_unit[self.inputs[0]] ** i / inputs_unit[self.inputs[1]] ** j  # noqa\n        return mapping\n\n    @property\n    def x_domain(self):\n        return self._x_domain\n\n    @x_domain.setter\n    def x_domain(self, val):\n        self._x_domain = _validate_domain_window(val)\n\n    @property\n    def y_domain(self):\n        return self._y_domain\n\n    @y_domain.setter\n    def y_domain(self, val):\n        self._y_domain = _validate_domain_window(val)\n\n    @property\n    def x_window(self):\n        return self._x_window\n\n    @x_window.setter\n    def x_window(self, val):\n        self._x_window = _validate_domain_window(val)\n\n    @property\n    def y_window(self):\n        return self._y_window\n\n    @y_window.setter\n    def y_window(self, val):\n        self._y_window = _validate_domain_window(val)"},{"col":4,"comment":"null","endLoc":1042,"header":"def prepare_inputs(self, x, y, **kwargs)","id":13755,"name":"prepare_inputs","nodeType":"Function","startLoc":1037,"text":"def prepare_inputs(self, x, y, **kwargs):\n\n        inputs, broadcasted_shapes = super().prepare_inputs(x, y, **kwargs)\n\n        x, y = inputs\n        return (x, y), broadcasted_shapes"},{"col":4,"comment":"null","endLoc":1062,"header":"def evaluate(self, x, y, *coeffs)","id":13756,"name":"evaluate","nodeType":"Function","startLoc":1044,"text":"def evaluate(self, x, y, *coeffs):\n        if self.x_domain is not None:\n            x = poly_map_domain(x, self.x_domain, self.x_window)\n        if self.y_domain is not None:\n            y = poly_map_domain(y, self.y_domain, self.y_window)\n        invcoeff = self.invlex_coeff(coeffs)\n        result = self.multivariate_horner(x, y, invcoeff)\n\n        # Special case for degree==0 to ensure that the shape of the output is\n        # still as expected by the broadcasting rules, even though the x and y\n        # inputs are not used in the evaluation\n        if self.degree == 0:\n            output_shape = check_broadcast(np.shape(coeffs[0]), x.shape)\n            if output_shape:\n                new_result = np.empty(output_shape)\n                new_result[:] = result\n                result = new_result\n\n        return result"},{"attributeType":"null","col":4,"comment":"null","endLoc":798,"id":13757,"name":"n_inputs","nodeType":"Attribute","startLoc":798,"text":"n_inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":799,"id":13758,"name":"n_outputs","nodeType":"Attribute","startLoc":799,"text":"n_outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":801,"id":13759,"name":"_separable","nodeType":"Attribute","startLoc":801,"text":"_separable"},{"className":"Chebyshev2D","col":0,"comment":"\n    Bivariate Chebyshev series..\n\n    It is defined as\n\n    .. math:: P_{nm}(x,y) = \\sum_{n,m=0}^{n=d,m=d}C_{nm}  T_n(x ) T_m(y)\n\n    where ``T_n(x)`` and ``T_m(y)`` are Chebyshev polynomials of the first kind.\n\n    For explanation of ``x_domain``, ``y_domain``, ``x_window`` and ``y_window``\n    see :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : tuple or None, optional\n        domain of the x independent variable\n    y_domain : tuple or None, optional\n        domain of the y independent variable\n    x_window : tuple or None, optional\n        range of the x independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    y_window : tuple or None, optional\n        range of the y independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n\n    Notes\n    -----\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Chebyshev polynomials is a polynomial in x and/or y - since\n    the coefficients within each Chebyshev polynomial are fixed, we can't use\n    quantities for x and/or y since the units would not be compatible. For\n    example, the third Chebyshev polynomial (T2) is 2x^2-1, but if x was\n    specified with units, 2x^2 and -1 would have incompatible units.\n    ","endLoc":1338,"id":13760,"nodeType":"Class","startLoc":1208,"text":"class Chebyshev2D(OrthoPolynomialBase):\n    r\"\"\"\n    Bivariate Chebyshev series..\n\n    It is defined as\n\n    .. math:: P_{nm}(x,y) = \\sum_{n,m=0}^{n=d,m=d}C_{nm}  T_n(x ) T_m(y)\n\n    where ``T_n(x)`` and ``T_m(y)`` are Chebyshev polynomials of the first kind.\n\n    For explanation of ``x_domain``, ``y_domain``, ``x_window`` and ``y_window``\n    see :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : tuple or None, optional\n        domain of the x independent variable\n    y_domain : tuple or None, optional\n        domain of the y independent variable\n    x_window : tuple or None, optional\n        range of the x independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    y_window : tuple or None, optional\n        range of the y independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n\n    Notes\n    -----\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Chebyshev polynomials is a polynomial in x and/or y - since\n    the coefficients within each Chebyshev polynomial are fixed, we can't use\n    quantities for x and/or y since the units would not be compatible. For\n    example, the third Chebyshev polynomial (T2) is 2x^2-1, but if x was\n    specified with units, 2x^2 and -1 would have incompatible units.\n    \"\"\"\n    _separable = False\n\n    def __init__(self, x_degree, y_degree, x_domain=None, x_window=None,\n                 y_domain=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n\n        super().__init__(\n            x_degree, y_degree, x_domain=x_domain, y_domain=y_domain,\n            x_window=x_window, y_window=y_window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)\n\n    def _fcache(self, x, y):\n        \"\"\"\n        Calculate the individual Chebyshev functions once and store them in a\n        dictionary to be reused.\n        \"\"\"\n\n        x_terms = self.x_degree + 1\n        y_terms = self.y_degree + 1\n        kfunc = {}\n        kfunc[0] = np.ones(x.shape)\n        kfunc[1] = x.copy()\n        kfunc[x_terms] = np.ones(y.shape)\n        kfunc[x_terms + 1] = y.copy()\n        for n in range(2, x_terms):\n            kfunc[n] = 2 * x * kfunc[n - 1] - kfunc[n - 2]\n        for n in range(x_terms + 2, x_terms + y_terms):\n            kfunc[n] = 2 * y * kfunc[n - 1] - kfunc[n - 2]\n        return kfunc\n\n    def fit_deriv(self, x, y, *params):\n        \"\"\"\n        Derivatives with respect to the coefficients.\n\n        This is an array with Chebyshev polynomials:\n\n        .. math::\n\n            T_{x_0}T_{y_0}, T_{x_1}T_{y_0}...T_{x_n}T_{y_0}...T_{x_n}T_{y_m}\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        y : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        if x.shape != y.shape:\n            raise ValueError(\"x and y must have the same shape\")\n\n        x = x.flatten()\n        y = y.flatten()\n        x_deriv = self._chebderiv1d(x, self.x_degree + 1).T\n        y_deriv = self._chebderiv1d(y, self.y_degree + 1).T\n\n        ij = []\n        for i in range(self.y_degree + 1):\n            for j in range(self.x_degree + 1):\n                ij.append(x_deriv[j] * y_deriv[i])\n\n        v = np.array(ij)\n        return v.T\n\n    def _chebderiv1d(self, x, deg):\n        \"\"\"\n        Derivative of 1D Chebyshev series\n        \"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        d = np.empty((deg + 1, len(x)), dtype=x.dtype)\n        d[0] = x * 0 + 1\n        if deg > 0:\n            x2 = 2 * x\n            d[1] = x\n            for i in range(2, deg + 1):\n                d[i] = d[i - 1] * x2 - d[i - 2]\n        return np.rollaxis(d, 0, d.ndim)"},{"col":4,"comment":"null","endLoc":1263,"header":"def __init__(self, x_degree, y_degree, x_domain=None, x_window=None,\n                 y_domain=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":13761,"name":"__init__","nodeType":"Function","startLoc":1256,"text":"def __init__(self, x_degree, y_degree, x_domain=None, x_window=None,\n                 y_domain=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n\n        super().__init__(\n            x_degree, y_degree, x_domain=x_domain, y_domain=y_domain,\n            x_window=x_window, y_window=y_window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)"},{"col":4,"comment":"\n        Calculate the individual Chebyshev functions once and store them in a\n        dictionary to be reused.\n        ","endLoc":1282,"header":"def _fcache(self, x, y)","id":13762,"name":"_fcache","nodeType":"Function","startLoc":1265,"text":"def _fcache(self, x, y):\n        \"\"\"\n        Calculate the individual Chebyshev functions once and store them in a\n        dictionary to be reused.\n        \"\"\"\n\n        x_terms = self.x_degree + 1\n        y_terms = self.y_degree + 1\n        kfunc = {}\n        kfunc[0] = np.ones(x.shape)\n        kfunc[1] = x.copy()\n        kfunc[x_terms] = np.ones(y.shape)\n        kfunc[x_terms + 1] = y.copy()\n        for n in range(2, x_terms):\n            kfunc[n] = 2 * x * kfunc[n - 1] - kfunc[n - 2]\n        for n in range(x_terms + 2, x_terms + y_terms):\n            kfunc[n] = 2 * y * kfunc[n - 1] - kfunc[n - 2]\n        return kfunc"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1918,"id":13763,"name":"theta","nodeType":"Attribute","startLoc":1918,"text":"theta"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":29,"id":13764,"name":"pc","nodeType":"Attribute","startLoc":29,"text":"pc"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":34,"id":13765,"name":"kpc","nodeType":"Attribute","startLoc":34,"text":"kpc"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":13766,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":13767,"name":"TWOPI","nodeType":"Attribute","startLoc":25,"text":"TWOPI"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":13768,"name":"FLOAT_EPSILON","nodeType":"Attribute","startLoc":26,"text":"FLOAT_EPSILON"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":13769,"name":"GAUSSIAN_SIGMA_TO_FWHM","nodeType":"Attribute","startLoc":31,"text":"GAUSSIAN_SIGMA_TO_FWHM"},{"col":4,"comment":"\n        Derivatives with respect to the coefficients.\n\n        This is an array with Chebyshev polynomials:\n\n        .. math::\n\n            T_{x_0}T_{y_0}, T_{x_1}T_{y_0}...T_{x_n}T_{y_0}...T_{x_n}T_{y_m}\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        y : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        ","endLoc":1323,"header":"def fit_deriv(self, x, y, *params)","id":13770,"name":"fit_deriv","nodeType":"Function","startLoc":1284,"text":"def fit_deriv(self, x, y, *params):\n        \"\"\"\n        Derivatives with respect to the coefficients.\n\n        This is an array with Chebyshev polynomials:\n\n        .. math::\n\n            T_{x_0}T_{y_0}, T_{x_1}T_{y_0}...T_{x_n}T_{y_0}...T_{x_n}T_{y_m}\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        y : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        if x.shape != y.shape:\n            raise ValueError(\"x and y must have the same shape\")\n\n        x = x.flatten()\n        y = y.flatten()\n        x_deriv = self._chebderiv1d(x, self.x_degree + 1).T\n        y_deriv = self._chebderiv1d(y, self.y_degree + 1).T\n\n        ij = []\n        for i in range(self.y_degree + 1):\n            for j in range(self.x_degree + 1):\n                ij.append(x_deriv[j] * y_deriv[i])\n\n        v = np.array(ij)\n        return v.T"},{"col":0,"comment":"","endLoc":3,"header":"functional_models.py#<anonymous>","id":13771,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"Mathematical models.\"\"\"\n\n__all__ = ['AiryDisk2D', 'Moffat1D', 'Moffat2D', 'Box1D', 'Box2D', 'Const1D',\n           'Const2D', 'Ellipse2D', 'Disk2D', 'Gaussian1D', 'Gaussian2D',\n           'Linear1D', 'Lorentz1D', 'RickerWavelet1D', 'RickerWavelet2D',\n           'RedshiftScaleFactor', 'Multiply', 'Planar2D', 'Scale',\n           'Sersic1D', 'Sersic2D', 'Shift',\n           'Sine1D', 'Cosine1D', 'Tangent1D',\n           'ArcSine1D', 'ArcCosine1D', 'ArcTangent1D',\n           'Trapezoid1D', 'TrapezoidDisk2D', 'Ring2D', 'Voigt1D',\n           'KingProjectedAnalytic1D', 'Exponential1D', 'Logarithmic1D']\n\nTWOPI = 2 * np.pi\n\nFLOAT_EPSILON = float(np.finfo(np.float32).tiny)\n\nGAUSSIAN_SIGMA_TO_FWHM = 2.0 * np.sqrt(2.0 * np.log(2.0))"},{"fileName":"codata2014.py","filePath":"astropy/constants","id":13772,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nAstronomical and physics constants in SI units.  See :mod:`astropy.constants`\nfor a complete listing of constants defined in Astropy.\n\"\"\"\n\nimport numpy as np\n\nfrom .constant import Constant, EMConstant\n\n# PHYSICAL CONSTANTS\n\nclass CODATA2014(Constant):\n    default_reference = 'CODATA 2014'\n    _registry = {}\n    _has_incompatible_units = set()\n\n\nclass EMCODATA2014(CODATA2014, EMConstant):\n    _registry = CODATA2014._registry\n\n\nh = CODATA2014('h', \"Planck constant\", 6.626070040e-34,\n               'J s', 0.000000081e-34, system='si')\n\nhbar = CODATA2014('hbar', \"Reduced Planck constant\", 1.054571800e-34,\n                  'J s', 0.000000013e-34, system='si')\n\nk_B = CODATA2014('k_B', \"Boltzmann constant\", 1.38064852e-23,\n                 'J / (K)', 0.00000079e-23, system='si')\n\nc = CODATA2014('c', \"Speed of light in vacuum\", 299792458.,\n               'm / (s)', 0.0, system='si')\n\n\nG = CODATA2014('G', \"Gravitational constant\", 6.67408e-11,\n               'm3 / (kg s2)', 0.00031e-11, system='si')\n\ng0 = CODATA2014('g0', \"Standard acceleration of gravity\", 9.80665,\n                'm / s2', 0.0, system='si')\n\nm_p = CODATA2014('m_p', \"Proton mass\", 1.672621898e-27,\n                 'kg', 0.000000021e-27, system='si')\n\nm_n = CODATA2014('m_n', \"Neutron mass\", 1.674927471e-27,\n                 'kg', 0.000000021e-27, system='si')\n\nm_e = CODATA2014('m_e', \"Electron mass\", 9.10938356e-31,\n                 'kg', 0.00000011e-31, system='si')\n\nu = CODATA2014('u', \"Atomic mass\", 1.660539040e-27,\n               'kg', 0.000000020e-27, system='si')\n\nsigma_sb = CODATA2014('sigma_sb', \"Stefan-Boltzmann constant\", 5.670367e-8,\n                      'W / (K4 m2)', 0.000013e-8, system='si')\n\ne = EMCODATA2014('e', 'Electron charge', 1.6021766208e-19,\n                 'C', 0.0000000098e-19, system='si')\n\neps0 = EMCODATA2014('eps0', 'Electric constant', 8.854187817e-12,\n                    'F/m', 0.0, system='si')\n\nN_A = CODATA2014('N_A', \"Avogadro's number\", 6.022140857e23,\n                 '1 / (mol)', 0.000000074e23, system='si')\n\nR = CODATA2014('R', \"Gas constant\", 8.3144598,\n               'J / (K mol)', 0.0000048, system='si')\n\nRyd = CODATA2014('Ryd', 'Rydberg constant', 10973731.568508,\n                 '1 / (m)', 0.000065, system='si')\n\na0 = CODATA2014('a0', \"Bohr radius\", 0.52917721067e-10,\n                'm', 0.00000000012e-10, system='si')\n\nmuB = CODATA2014('muB', \"Bohr magneton\", 927.4009994e-26,\n                 'J/T', 0.00002e-26, system='si')\n\nalpha = CODATA2014('alpha', \"Fine-structure constant\", 7.2973525664e-3,\n                   '', 0.0000000017e-3, system='si')\n\natm = CODATA2014('atm', \"Standard atmosphere\", 101325,\n                 'Pa', 0.0, system='si')\n\nmu0 = CODATA2014('mu0', \"Magnetic constant\", 4.0e-7 * np.pi, 'N/A2', 0.0,\n                 system='si')\n\nsigma_T = CODATA2014('sigma_T', \"Thomson scattering cross-section\",\n                     0.66524587158e-28, 'm2', 0.00000000091e-28,\n                     system='si')\n\nb_wien = CODATA2014('b_wien', 'Wien wavelength displacement law constant',\n                    2.8977729e-3, 'm K', 0.0000017e-3, system='si')\n\n# cgs constants\n# Only constants that cannot be converted directly from S.I. are defined here.\n\ne_esu = EMCODATA2014(e.abbrev, e.name, e.value * c.value * 10.0,\n                     'statC', e.uncertainty * c.value * 10.0, system='esu')\n\ne_emu = EMCODATA2014(e.abbrev, e.name, e.value / 10, 'abC',\n                     e.uncertainty / 10, system='emu')\n\ne_gauss = EMCODATA2014(e.abbrev, e.name, e.value * c.value * 10.0,\n                       'Fr', e.uncertainty * c.value * 10.0, system='gauss')\n"},{"className":"CODATA2014","col":0,"comment":"null","endLoc":16,"id":13773,"nodeType":"Class","startLoc":13,"text":"class CODATA2014(Constant):\n    default_reference = 'CODATA 2014'\n    _registry = {}\n    _has_incompatible_units = set()"},{"attributeType":"null","col":4,"comment":"null","endLoc":14,"id":13774,"name":"default_reference","nodeType":"Attribute","startLoc":14,"text":"default_reference"},{"attributeType":"null","col":4,"comment":"null","endLoc":14,"id":13775,"name":"default_reference","nodeType":"Attribute","startLoc":14,"text":"default_reference"},{"attributeType":"null","col":4,"comment":"null","endLoc":15,"id":13776,"name":"_registry","nodeType":"Attribute","startLoc":15,"text":"_registry"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":13777,"name":"_has_incompatible_units","nodeType":"Attribute","startLoc":16,"text":"_has_incompatible_units"},{"attributeType":"null","col":4,"comment":"null","endLoc":15,"id":13778,"name":"_registry","nodeType":"Attribute","startLoc":15,"text":"_registry"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":13779,"name":"_has_incompatible_units","nodeType":"Attribute","startLoc":16,"text":"_has_incompatible_units"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":40,"id":13780,"name":"L_bol0","nodeType":"Attribute","startLoc":40,"text":"L_bol0"},{"className":"EMCODATA2014","col":0,"comment":"null","endLoc":20,"id":13781,"nodeType":"Class","startLoc":19,"text":"class EMCODATA2014(CODATA2014, EMConstant):\n    _registry = CODATA2014._registry"},{"col":4,"comment":"null","endLoc":1130,"header":"def invlex_coeff(self, coeffs)","id":13782,"name":"invlex_coeff","nodeType":"Function","startLoc":1121,"text":"def invlex_coeff(self, coeffs):\n        invlex_coeffs = []\n        lencoeff = range(self.degree + 1)\n        for i in lencoeff:\n            for j in lencoeff:\n                if i + j <= self.degree:\n                    name = f'c{j}_{i}'\n                    coeff = coeffs[self.param_names.index(name)]\n                    invlex_coeffs.append(coeff)\n        return invlex_coeffs[::-1]"},{"attributeType":"null","col":4,"comment":"null","endLoc":20,"id":13783,"name":"_registry","nodeType":"Attribute","startLoc":20,"text":"_registry"},{"col":4,"comment":"\n        Multivariate Horner's scheme\n\n        Parameters\n        ----------\n        x, y : array\n        coeffs : array\n            Coefficients in inverse lexical order.\n        ","endLoc":1156,"header":"def multivariate_horner(self, x, y, coeffs)","id":13784,"name":"multivariate_horner","nodeType":"Function","startLoc":1132,"text":"def multivariate_horner(self, x, y, coeffs):\n        \"\"\"\n        Multivariate Horner's scheme\n\n        Parameters\n        ----------\n        x, y : array\n        coeffs : array\n            Coefficients in inverse lexical order.\n        \"\"\"\n\n        alpha = self._invlex()\n        r0 = coeffs[0]\n        r1 = r0 * 0.0\n        r2 = r0 * 0.0\n        karr = np.diff(alpha, axis=0)\n\n        for n in range(len(karr)):\n            if karr[n, 1] != 0:\n                r2 = y * (r0 + r1 + r2)\n                r1 = np.zeros_like(coeffs[0], subok=False)\n            else:\n                r1 = x * (r0 + r1)\n            r0 = coeffs[n + 1]\n        return r0 + r1 + r2"},{"col":4,"comment":"\n        Derivative of 1D Chebyshev series\n        ","endLoc":1338,"header":"def _chebderiv1d(self, x, deg)","id":13785,"name":"_chebderiv1d","nodeType":"Function","startLoc":1325,"text":"def _chebderiv1d(self, x, deg):\n        \"\"\"\n        Derivative of 1D Chebyshev series\n        \"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        d = np.empty((deg + 1, len(x)), dtype=x.dtype)\n        d[0] = x * 0 + 1\n        if deg > 0:\n            x2 = 2 * x\n            d[1] = x\n            for i in range(2, deg + 1):\n                d[i] = d[i - 1] * x2 - d[i - 2]\n        return np.rollaxis(d, 0, d.ndim)"},{"attributeType":"null","col":16,"comment":"null","endLoc":7,"id":13786,"name":"np","nodeType":"Attribute","startLoc":7,"text":"np"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":23,"id":13787,"name":"h","nodeType":"Attribute","startLoc":23,"text":"h"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":47,"id":13788,"name":"L_sun","nodeType":"Attribute","startLoc":47,"text":"L_sun"},{"col":4,"comment":"null","endLoc":1070,"header":"def __repr__(self)","id":13789,"name":"__repr__","nodeType":"Function","startLoc":1064,"text":"def __repr__(self):\n        return self._format_repr([self.degree],\n                                 kwargs={'x_domain': self.x_domain,\n                                         'y_domain': self.y_domain,\n                                         'x_window': self.x_window,\n                                         'y_window': self.y_window},\n                                 defaults=self._default_domain_window)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1254,"id":13790,"name":"_separable","nodeType":"Attribute","startLoc":1254,"text":"_separable"},{"col":4,"comment":"null","endLoc":1078,"header":"def __str__(self)","id":13791,"name":"__str__","nodeType":"Function","startLoc":1072,"text":"def __str__(self):\n        return self._format_str([('Degree', self.degree),\n                                 ('X_Domain', self.x_domain),\n                                 ('Y_Domain', self.y_domain),\n                                 ('X_Window', self.x_window),\n                                 ('Y_Window', self.y_window)],\n                                 self._default_domain_window)"},{"className":"Legendre2D","col":0,"comment":"\n    Bivariate Legendre series.\n\n    Defined as:\n\n    .. math:: P_{n_m}(x,y) = \\sum_{n,m=0}^{n=d,m=d}C_{nm}  L_n(x ) L_m(y)\n\n    where ``L_n(x)`` and ``L_m(y)`` are Legendre polynomials.\n\n    For explanation of ``x_domain``, ``y_domain``, ``x_window`` and ``y_window``\n    see :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : tuple or None, optional\n        domain of the x independent variable\n    y_domain : tuple or None, optional\n        domain of the y independent variable\n    x_window : tuple or None, optional\n        range of the x independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    y_window : tuple or None, optional\n        range of the y independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        P(x) = \\sum_{i=0}^{i=n}C_{i} * L_{i}(x)\n\n    where ``L_{i}`` is the corresponding Legendre polynomial.\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Legendre polynomials is a polynomial in x - since the\n    coefficients within each Legendre polynomial are fixed, we can't use\n    quantities for x since the units would not be compatible. For example, the\n    third Legendre polynomial (P2) is 1.5x^2-0.5, but if x was specified with\n    units, 1.5x^2 and -0.5 would have incompatible units.\n    ","endLoc":1471,"id":13792,"nodeType":"Class","startLoc":1341,"text":"class Legendre2D(OrthoPolynomialBase):\n    r\"\"\"\n    Bivariate Legendre series.\n\n    Defined as:\n\n    .. math:: P_{n_m}(x,y) = \\sum_{n,m=0}^{n=d,m=d}C_{nm}  L_n(x ) L_m(y)\n\n    where ``L_n(x)`` and ``L_m(y)`` are Legendre polynomials.\n\n    For explanation of ``x_domain``, ``y_domain``, ``x_window`` and ``y_window``\n    see :ref:`Notes regarding usage of domain and window <domain-window-note>`.\n\n    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : tuple or None, optional\n        domain of the x independent variable\n    y_domain : tuple or None, optional\n        domain of the y independent variable\n    x_window : tuple or None, optional\n        range of the x independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    y_window : tuple or None, optional\n        range of the y independent variable\n        If None, it is set to (-1, 1)\n        Fitters will remap the domain to this window\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n\n    Notes\n    -----\n    Model formula:\n\n    .. math::\n\n        P(x) = \\sum_{i=0}^{i=n}C_{i} * L_{i}(x)\n\n    where ``L_{i}`` is the corresponding Legendre polynomial.\n\n    This model does not support the use of units/quantities, because each term\n    in the sum of Legendre polynomials is a polynomial in x - since the\n    coefficients within each Legendre polynomial are fixed, we can't use\n    quantities for x since the units would not be compatible. For example, the\n    third Legendre polynomial (P2) is 1.5x^2-0.5, but if x was specified with\n    units, 1.5x^2 and -0.5 would have incompatible units.\n    \"\"\"\n    _separable = False\n\n    def __init__(self, x_degree, y_degree, x_domain=None, x_window=None,\n                 y_domain=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n\n        super().__init__(\n            x_degree, y_degree, x_domain=x_domain, y_domain=y_domain,\n            x_window=x_window, y_window=y_window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)\n\n    def _fcache(self, x, y):\n        \"\"\"\n        Calculate the individual Legendre functions once and store them in a\n        dictionary to be reused.\n        \"\"\"\n\n        x_terms = self.x_degree + 1\n        y_terms = self.y_degree + 1\n        kfunc = {}\n        kfunc[0] = np.ones(x.shape)\n        kfunc[1] = x.copy()\n        kfunc[x_terms] = np.ones(y.shape)\n        kfunc[x_terms + 1] = y.copy()\n        for n in range(2, x_terms):\n            kfunc[n] = (((2 * (n - 1) + 1) * x * kfunc[n - 1] -\n                         (n - 1) * kfunc[n - 2]) / n)\n        for n in range(2, y_terms):\n            kfunc[n + x_terms] = ((2 * (n - 1) + 1) * y * kfunc[n + x_terms - 1] -\n                                  (n - 1) * kfunc[n + x_terms - 2]) / (n)\n        return kfunc\n\n    def fit_deriv(self, x, y, *params):\n        \"\"\"\n        Derivatives with respect to the coefficients.\n        This is an array with Legendre polynomials:\n\n        Lx0Ly0  Lx1Ly0...LxnLy0...LxnLym\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        y : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n        if x.shape != y.shape:\n            raise ValueError(\"x and y must have the same shape\")\n        x = x.flatten()\n        y = y.flatten()\n        x_deriv = self._legendderiv1d(x, self.x_degree + 1).T\n        y_deriv = self._legendderiv1d(y, self.y_degree + 1).T\n\n        ij = []\n        for i in range(self.y_degree + 1):\n            for j in range(self.x_degree + 1):\n                ij.append(x_deriv[j] * y_deriv[i])\n\n        v = np.array(ij)\n        return v.T\n\n    def _legendderiv1d(self, x, deg):\n        \"\"\"Derivative of 1D Legendre polynomial\"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        d = np.empty((deg + 1,) + x.shape, dtype=x.dtype)\n        d[0] = x * 0 + 1\n        if deg > 0:\n            d[1] = x\n            for i in range(2, deg + 1):\n                d[i] = (d[i - 1] * x * (2 * i - 1) - d[i - 2] * (i - 1)) / i\n        return np.rollaxis(d, 0, d.ndim)"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":51,"id":13793,"name":"GM_sun","nodeType":"Attribute","startLoc":51,"text":"GM_sun"},{"col":4,"comment":"null","endLoc":1402,"header":"def __init__(self, x_degree, y_degree, x_domain=None, x_window=None,\n                 y_domain=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":13794,"name":"__init__","nodeType":"Function","startLoc":1395,"text":"def __init__(self, x_degree, y_degree, x_domain=None, x_window=None,\n                 y_domain=None, y_window=None, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n\n        super().__init__(\n            x_degree, y_degree, x_domain=x_domain, y_domain=y_domain,\n            x_window=x_window, y_window=y_window, n_models=n_models,\n            model_set_axis=model_set_axis, name=name, meta=meta, **params)"},{"col":4,"comment":"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        y : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        ","endLoc":1119,"header":"def fit_deriv(self, x, y, *params)","id":13795,"name":"fit_deriv","nodeType":"Function","startLoc":1080,"text":"def fit_deriv(self, x, y, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        y : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n\n        if x.ndim == 2:\n            x = x.flatten()\n        if y.ndim == 2:\n            y = y.flatten()\n        if x.size != y.size:\n            raise ValueError('Expected x and y to be of equal size')\n\n        designx = x[:, None] ** np.arange(self.degree + 1)\n        designy = y[:, None] ** np.arange(1, self.degree + 1)\n\n        designmixed = []\n        for i in range(1, self.degree):\n            for j in range(1, self.degree):\n                if i + j <= self.degree:\n                    designmixed.append((x ** i) * (y ** j))\n        designmixed = np.array(designmixed).T\n        if designmixed.any():\n            v = np.hstack([designx, designy, designmixed])\n        else:\n            v = np.hstack([designx, designy])\n        return v"},{"col":4,"comment":"\n        Calculate the individual Legendre functions once and store them in a\n        dictionary to be reused.\n        ","endLoc":1423,"header":"def _fcache(self, x, y)","id":13796,"name":"_fcache","nodeType":"Function","startLoc":1404,"text":"def _fcache(self, x, y):\n        \"\"\"\n        Calculate the individual Legendre functions once and store them in a\n        dictionary to be reused.\n        \"\"\"\n\n        x_terms = self.x_degree + 1\n        y_terms = self.y_degree + 1\n        kfunc = {}\n        kfunc[0] = np.ones(x.shape)\n        kfunc[1] = x.copy()\n        kfunc[x_terms] = np.ones(y.shape)\n        kfunc[x_terms + 1] = y.copy()\n        for n in range(2, x_terms):\n            kfunc[n] = (((2 * (n - 1) + 1) * x * kfunc[n - 1] -\n                         (n - 1) * kfunc[n - 2]) / n)\n        for n in range(2, y_terms):\n            kfunc[n + x_terms] = ((2 * (n - 1) + 1) * y * kfunc[n + x_terms - 1] -\n                                  (n - 1) * kfunc[n + x_terms - 2]) / (n)\n        return kfunc"},{"col":4,"comment":"null","endLoc":1163,"header":"@property\n    def input_units(self)","id":13797,"name":"input_units","nodeType":"Function","startLoc":1158,"text":"@property\n    def input_units(self):\n        if self.degree == 0 or (self.c1_0.unit is None and self.c0_1.unit is None):\n            return None\n        return {self.inputs[0]: self.c0_0.unit / self.c1_0.unit,\n                self.inputs[1]: self.c0_0.unit / self.c0_1.unit}"},{"col":4,"comment":"null","endLoc":1173,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":13798,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1165,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        mapping = {}\n        for i in range(self.degree + 1):\n            for j in range(self.degree + 1):\n                if i + j > 2:\n                    continue\n                par = getattr(self, f'c{i}_{j}')\n                mapping[par.name] = outputs_unit[self.outputs[0]] / inputs_unit[self.inputs[0]] ** i / inputs_unit[self.inputs[1]] ** j  # noqa\n        return mapping"},{"col":4,"comment":"null","endLoc":1177,"header":"@property\n    def x_domain(self)","id":13799,"name":"x_domain","nodeType":"Function","startLoc":1175,"text":"@property\n    def x_domain(self):\n        return self._x_domain"},{"col":4,"comment":"null","endLoc":1181,"header":"@x_domain.setter\n    def x_domain(self, val)","id":13800,"name":"x_domain","nodeType":"Function","startLoc":1179,"text":"@x_domain.setter\n    def x_domain(self, val):\n        self._x_domain = _validate_domain_window(val)"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":55,"id":13801,"name":"M_sun","nodeType":"Attribute","startLoc":55,"text":"M_sun"},{"col":4,"comment":"\n        Derivatives with respect to the coefficients.\n        This is an array with Legendre polynomials:\n\n        Lx0Ly0  Lx1Ly0...LxnLy0...LxnLym\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        y : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        ","endLoc":1459,"header":"def fit_deriv(self, x, y, *params)","id":13802,"name":"fit_deriv","nodeType":"Function","startLoc":1425,"text":"def fit_deriv(self, x, y, *params):\n        \"\"\"\n        Derivatives with respect to the coefficients.\n        This is an array with Legendre polynomials:\n\n        Lx0Ly0  Lx1Ly0...LxnLy0...LxnLym\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        y : ndarray\n            input\n        *params\n            throw-away parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        \"\"\"\n        if x.shape != y.shape:\n            raise ValueError(\"x and y must have the same shape\")\n        x = x.flatten()\n        y = y.flatten()\n        x_deriv = self._legendderiv1d(x, self.x_degree + 1).T\n        y_deriv = self._legendderiv1d(y, self.y_degree + 1).T\n\n        ij = []\n        for i in range(self.y_degree + 1):\n            for j in range(self.x_degree + 1):\n                ij.append(x_deriv[j] * y_deriv[i])\n\n        v = np.array(ij)\n        return v.T"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":62,"id":13803,"name":"R_sun","nodeType":"Attribute","startLoc":62,"text":"R_sun"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":69,"id":13804,"name":"GM_jup","nodeType":"Attribute","startLoc":69,"text":"GM_jup"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":26,"id":13805,"name":"hbar","nodeType":"Attribute","startLoc":26,"text":"hbar"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":73,"id":13806,"name":"M_jup","nodeType":"Attribute","startLoc":73,"text":"M_jup"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":29,"id":13807,"name":"k_B","nodeType":"Attribute","startLoc":29,"text":"k_B"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":80,"id":13808,"name":"R_jup","nodeType":"Attribute","startLoc":80,"text":"R_jup"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":84,"id":13809,"name":"GM_earth","nodeType":"Attribute","startLoc":84,"text":"GM_earth"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":32,"id":13810,"name":"c","nodeType":"Attribute","startLoc":32,"text":"c"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":88,"id":13811,"name":"M_earth","nodeType":"Attribute","startLoc":88,"text":"M_earth"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":36,"id":13812,"name":"G","nodeType":"Attribute","startLoc":36,"text":"G"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":39,"id":13813,"name":"g0","nodeType":"Attribute","startLoc":39,"text":"g0"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":96,"id":13814,"name":"R_earth","nodeType":"Attribute","startLoc":96,"text":"R_earth"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":42,"id":13815,"name":"m_p","nodeType":"Attribute","startLoc":42,"text":"m_p"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":45,"id":13816,"name":"m_n","nodeType":"Attribute","startLoc":45,"text":"m_n"},{"col":0,"comment":"","endLoc":5,"header":"iau2015.py#<anonymous>","id":13817,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nAstronomical and physics constants in SI units.  See :mod:`astropy.constants`\nfor a complete listing of constants defined in Astropy.\n\"\"\"\n\nau = IAU2015('au', \"Astronomical Unit\", 1.49597870700e11, 'm', 0.0,\n             \"IAU 2012 Resolution B2\", system='si')\n\npc = IAU2015('pc', \"Parsec\", au.value / np.radians(1. / 3600.), 'm',\n             au.uncertainty / np.radians(1. / 3600.),\n             \"Derived from au + IAU 2015 Resolution B 2 note [4]\", system='si')\n\nkpc = IAU2015('kpc', \"Kiloparsec\",\n              1000. * au.value / np.radians(1. / 3600.), 'm',\n              1000. * au.uncertainty / np.radians(1. / 3600.),\n              \"Derived from au + IAU 2015 Resolution B 2 note [4]\", system='si')\n\nL_bol0 = IAU2015('L_bol0', \"Luminosity for absolute bolometric magnitude 0\",\n                 3.0128e28, \"W\", 0.0, \"IAU 2015 Resolution B 2\", system='si')\n\nL_sun = IAU2015('L_sun', \"Nominal solar luminosity\", 3.828e26,\n                'W', 0.0, \"IAU 2015 Resolution B 3\", system='si')\n\nGM_sun = IAU2015('GM_sun', 'Nominal solar mass parameter', 1.3271244e20,\n                 'm3 / (s2)', 0.0, \"IAU 2015 Resolution B 3\", system='si')\n\nM_sun = IAU2015('M_sun', \"Solar mass\", GM_sun.value / codata.G.value,\n                'kg', ((codata.G.uncertainty / codata.G.value) *\n                       (GM_sun.value / codata.G.value)),\n                f\"IAU 2015 Resolution B 3 + {codata.G.reference}\",\n                system='si')\n\nR_sun = IAU2015('R_sun', \"Nominal solar radius\", 6.957e8, 'm', 0.0,\n                \"IAU 2015 Resolution B 3\", system='si')\n\nGM_jup = IAU2015('GM_jup', 'Nominal Jupiter mass parameter', 1.2668653e17,\n                 'm3 / (s2)', 0.0, \"IAU 2015 Resolution B 3\", system='si')\n\nM_jup = IAU2015('M_jup', \"Jupiter mass\", GM_jup.value / codata.G.value,\n                'kg', ((codata.G.uncertainty / codata.G.value) *\n                       (GM_jup.value / codata.G.value)),\n                f\"IAU 2015 Resolution B 3 + {codata.G.reference}\",\n                system='si')\n\nR_jup = IAU2015('R_jup', \"Nominal Jupiter equatorial radius\", 7.1492e7,\n                'm', 0.0, \"IAU 2015 Resolution B 3\", system='si')\n\nGM_earth = IAU2015('GM_earth', 'Nominal Earth mass parameter', 3.986004e14,\n                   'm3 / (s2)', 0.0, \"IAU 2015 Resolution B 3\", system='si')\n\nM_earth = IAU2015('M_earth', \"Earth mass\",\n                  GM_earth.value / codata.G.value,\n                  'kg', ((codata.G.uncertainty / codata.G.value) *\n                         (GM_earth.value / codata.G.value)),\n                  f\"IAU 2015 Resolution B 3 + {codata.G.reference}\",\n                  system='si')\n\nR_earth = IAU2015('R_earth', \"Nominal Earth equatorial radius\", 6.3781e6,\n                  'm', 0.0, \"IAU 2015 Resolution B 3\", system='si')"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":48,"id":13818,"name":"m_e","nodeType":"Attribute","startLoc":48,"text":"m_e"},{"col":4,"comment":"Derivative of 1D Legendre polynomial","endLoc":1471,"header":"def _legendderiv1d(self, x, deg)","id":13819,"name":"_legendderiv1d","nodeType":"Function","startLoc":1461,"text":"def _legendderiv1d(self, x, deg):\n        \"\"\"Derivative of 1D Legendre polynomial\"\"\"\n\n        x = np.array(x, dtype=float, copy=False, ndmin=1)\n        d = np.empty((deg + 1,) + x.shape, dtype=x.dtype)\n        d[0] = x * 0 + 1\n        if deg > 0:\n            d[1] = x\n            for i in range(2, deg + 1):\n                d[i] = (d[i - 1] * x * (2 * i - 1) - d[i - 2] * (i - 1)) / i\n        return np.rollaxis(d, 0, d.ndim)"},{"className":"EMCODATA2010","col":0,"comment":"null","endLoc":25,"id":13820,"nodeType":"Class","startLoc":24,"text":"class EMCODATA2010(CODATA2010, EMConstant):\n    _registry = CODATA2010._registry"},{"attributeType":"null","col":4,"comment":"null","endLoc":25,"id":13821,"name":"_registry","nodeType":"Attribute","startLoc":25,"text":"_registry"},{"attributeType":"null","col":4,"comment":"null","endLoc":1393,"id":13822,"name":"_separable","nodeType":"Attribute","startLoc":1393,"text":"_separable"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":51,"id":13823,"name":"u","nodeType":"Attribute","startLoc":51,"text":"u"},{"fileName":"astropyconst13.py","filePath":"astropy/constants","id":13824,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nAstronomical and physics constants for Astropy v1.3 and earlier.\nSee :mod:`astropy.constants` for a complete listing of constants\ndefined in Astropy.\n\"\"\"\nfrom astropy.utils import find_current_module\n\nfrom . import codata2010, iau2012\nfrom . import utils as _utils\n\ncodata = codata2010\niaudata = iau2012\n\n_utils._set_c(codata, iaudata, find_current_module())\n\n# Clean up namespace\ndel find_current_module\ndel _utils\n"},{"attributeType":"null","col":16,"comment":"null","endLoc":7,"id":13825,"name":"np","nodeType":"Attribute","startLoc":7,"text":"np"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":28,"id":13826,"name":"h","nodeType":"Attribute","startLoc":28,"text":"h"},{"className":"_SIP1D","col":0,"comment":"\n    This implements the Simple Imaging Polynomial Model (SIP) in 1D.\n\n    It's unlikely it will be used in 1D so this class is private\n    and SIP should be used instead.\n    ","endLoc":1571,"id":13827,"nodeType":"Class","startLoc":1474,"text":"class _SIP1D(PolynomialBase):\n    \"\"\"\n    This implements the Simple Imaging Polynomial Model (SIP) in 1D.\n\n    It's unlikely it will be used in 1D so this class is private\n    and SIP should be used instead.\n    \"\"\"\n\n    n_inputs = 2\n    n_outputs = 1\n\n    _separable = False\n\n    def __init__(self, order, coeff_prefix, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.order = order\n        self.coeff_prefix = coeff_prefix\n        self._param_names = self._generate_coeff_names(coeff_prefix)\n\n        if n_models:\n            if model_set_axis is None:\n                model_set_axis = 0\n            minshape = (1,) * model_set_axis + (n_models,)\n        else:\n            minshape = ()\n        for param_name in self._param_names:\n            self._parameters_[param_name] = \\\n                Parameter(param_name, default=np.zeros(minshape))\n        super().__init__(n_models=n_models, model_set_axis=model_set_axis,\n                         name=name, meta=meta, **params)\n\n    def __repr__(self):\n        return self._format_repr(args=[self.order, self.coeff_prefix])\n\n    def __str__(self):\n        return self._format_str(\n            [('Order', self.order),\n             ('Coeff. Prefix', self.coeff_prefix)])\n\n    def evaluate(self, x, y, *coeffs):\n        # TODO: Rewrite this so that it uses a simpler method of determining\n        # the matrix based on the number of given coefficients.\n        mcoef = self._coeff_matrix(self.coeff_prefix, coeffs)\n        return self._eval_sip(x, y, mcoef)\n\n    def get_num_coeff(self, ndim):\n        \"\"\"\n        Return the number of coefficients in one param set\n        \"\"\"\n\n        if self.order < 2 or self.order > 9:\n            raise ValueError(\"Degree of polynomial must be 2< deg < 9\")\n\n        nmixed = comb(self.order, ndim)\n        # remove 3 terms because SIP deg >= 2\n        numc = self.order * ndim + nmixed - 2\n        return numc\n\n    def _generate_coeff_names(self, coeff_prefix):\n        names = []\n        for i in range(2, self.order + 1):\n            names.append(f'{coeff_prefix}_{i}_{0}')\n        for i in range(2, self.order + 1):\n            names.append(f'{coeff_prefix}_{0}_{i}')\n        for i in range(1, self.order):\n            for j in range(1, self.order):\n                if i + j < self.order + 1:\n                    names.append(f'{coeff_prefix}_{i}_{j}')\n        return tuple(names)\n\n    def _coeff_matrix(self, coeff_prefix, coeffs):\n        mat = np.zeros((self.order + 1, self.order + 1))\n        for i in range(2, self.order + 1):\n            attr = f'{coeff_prefix}_{i}_{0}'\n            mat[i, 0] = coeffs[self.param_names.index(attr)]\n        for i in range(2, self.order + 1):\n            attr = f'{coeff_prefix}_{0}_{i}'\n            mat[0, i] = coeffs[self.param_names.index(attr)]\n        for i in range(1, self.order):\n            for j in range(1, self.order):\n                if i + j < self.order + 1:\n                    attr = f'{coeff_prefix}_{i}_{j}'\n                    mat[i, j] = coeffs[self.param_names.index(attr)]\n        return mat\n\n    def _eval_sip(self, x, y, coef):\n        x = np.asarray(x, dtype=np.float64)\n        y = np.asarray(y, dtype=np.float64)\n        if self.coeff_prefix == 'A':\n            result = np.zeros(x.shape)\n        else:\n            result = np.zeros(y.shape)\n\n        for i in range(coef.shape[0]):\n            for j in range(coef.shape[1]):\n                if 1 < i + j < self.order + 1:\n                    result = result + coef[i, j] * x ** i * y ** j\n        return result"},{"col":4,"comment":"null","endLoc":1506,"header":"def __repr__(self)","id":13828,"name":"__repr__","nodeType":"Function","startLoc":1505,"text":"def __repr__(self):\n        return self._format_repr(args=[self.order, self.coeff_prefix])"},{"attributeType":"null","col":23,"comment":"null","endLoc":10,"id":13829,"name":"_utils","nodeType":"Attribute","startLoc":10,"text":"_utils"},{"attributeType":"codata2010.py","col":0,"comment":"null","endLoc":12,"id":13830,"name":"codata","nodeType":"Attribute","startLoc":12,"text":"codata"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":54,"id":13831,"name":"sigma_sb","nodeType":"Attribute","startLoc":54,"text":"sigma_sb"},{"col":4,"comment":"null","endLoc":1185,"header":"@property\n    def y_domain(self)","id":13832,"name":"y_domain","nodeType":"Function","startLoc":1183,"text":"@property\n    def y_domain(self):\n        return self._y_domain"},{"attributeType":"iau2012.py","col":0,"comment":"null","endLoc":13,"id":13833,"name":"iaudata","nodeType":"Attribute","startLoc":13,"text":"iaudata"},{"col":4,"comment":"null","endLoc":1189,"header":"@y_domain.setter\n    def y_domain(self, val)","id":13834,"name":"y_domain","nodeType":"Function","startLoc":1187,"text":"@y_domain.setter\n    def y_domain(self, val):\n        self._y_domain = _validate_domain_window(val)"},{"col":0,"comment":"","endLoc":6,"header":"astropyconst13.py#<anonymous>","id":13835,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nAstronomical and physics constants for Astropy v1.3 and earlier.\nSee :mod:`astropy.constants` for a complete listing of constants\ndefined in Astropy.\n\"\"\"\n\ncodata = codata2010\n\niaudata = iau2012\n\n_utils._set_c(codata, iaudata, find_current_module())\n\ndel find_current_module\n\ndel _utils"},{"attributeType":"EMCODATA2014","col":0,"comment":"null","endLoc":57,"id":13836,"name":"e","nodeType":"Attribute","startLoc":57,"text":"e"},{"col":4,"comment":"null","endLoc":1193,"header":"@property\n    def x_window(self)","id":13837,"name":"x_window","nodeType":"Function","startLoc":1191,"text":"@property\n    def x_window(self):\n        return self._x_window"},{"col":4,"comment":"null","endLoc":1197,"header":"@x_window.setter\n    def x_window(self, val)","id":13838,"name":"x_window","nodeType":"Function","startLoc":1195,"text":"@x_window.setter\n    def x_window(self, val):\n        self._x_window = _validate_domain_window(val)"},{"col":4,"comment":"null","endLoc":1511,"header":"def __str__(self)","id":13839,"name":"__str__","nodeType":"Function","startLoc":1508,"text":"def __str__(self):\n        return self._format_str(\n            [('Order', self.order),\n             ('Coeff. Prefix', self.coeff_prefix)])"},{"attributeType":"EMCODATA2014","col":0,"comment":"null","endLoc":60,"id":13840,"name":"eps0","nodeType":"Attribute","startLoc":60,"text":"eps0"},{"col":4,"comment":"null","endLoc":1201,"header":"@property\n    def y_window(self)","id":13841,"name":"y_window","nodeType":"Function","startLoc":1199,"text":"@property\n    def y_window(self):\n        return self._y_window"},{"col":4,"comment":"null","endLoc":1205,"header":"@y_window.setter\n    def y_window(self, val)","id":13842,"name":"y_window","nodeType":"Function","startLoc":1203,"text":"@y_window.setter\n    def y_window(self, val):\n        self._y_window = _validate_domain_window(val)"},{"col":4,"comment":"null","endLoc":1517,"header":"def evaluate(self, x, y, *coeffs)","id":13843,"name":"evaluate","nodeType":"Function","startLoc":1513,"text":"def evaluate(self, x, y, *coeffs):\n        # TODO: Rewrite this so that it uses a simpler method of determining\n        # the matrix based on the number of given coefficients.\n        mcoef = self._coeff_matrix(self.coeff_prefix, coeffs)\n        return self._eval_sip(x, y, mcoef)"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":63,"id":13844,"name":"N_A","nodeType":"Attribute","startLoc":63,"text":"N_A"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":31,"id":13845,"name":"hbar","nodeType":"Attribute","startLoc":31,"text":"hbar"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":66,"id":13846,"name":"R","nodeType":"Attribute","startLoc":66,"text":"R"},{"attributeType":"null","col":4,"comment":"null","endLoc":1013,"id":13847,"name":"n_inputs","nodeType":"Attribute","startLoc":1013,"text":"n_inputs"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":36,"id":13848,"name":"k_B","nodeType":"Attribute","startLoc":36,"text":"k_B"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":69,"id":13849,"name":"Ryd","nodeType":"Attribute","startLoc":69,"text":"Ryd"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":72,"id":13850,"name":"a0","nodeType":"Attribute","startLoc":72,"text":"a0"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":39,"id":13851,"name":"c","nodeType":"Attribute","startLoc":39,"text":"c"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":75,"id":13852,"name":"muB","nodeType":"Attribute","startLoc":75,"text":"muB"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":42,"id":13853,"name":"G","nodeType":"Attribute","startLoc":42,"text":"G"},{"attributeType":"null","col":4,"comment":"null","endLoc":1014,"id":13854,"name":"n_outputs","nodeType":"Attribute","startLoc":1014,"text":"n_outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":1016,"id":13855,"name":"_separable","nodeType":"Attribute","startLoc":1016,"text":"_separable"},{"attributeType":"null","col":8,"comment":"null","endLoc":1033,"id":13856,"name":"y_domain","nodeType":"Attribute","startLoc":1033,"text":"self.y_domain"},{"attributeType":"null","col":8,"comment":"null","endLoc":1197,"id":13857,"name":"_x_window","nodeType":"Attribute","startLoc":1197,"text":"self._x_window"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":45,"id":13858,"name":"g0","nodeType":"Attribute","startLoc":45,"text":"g0"},{"attributeType":"null","col":8,"comment":"null","endLoc":1205,"id":13859,"name":"_y_window","nodeType":"Attribute","startLoc":1205,"text":"self._y_window"},{"attributeType":"null","col":8,"comment":"null","endLoc":1032,"id":13860,"name":"x_domain","nodeType":"Attribute","startLoc":1032,"text":"self.x_domain"},{"attributeType":"null","col":8,"comment":"null","endLoc":1035,"id":13861,"name":"y_window","nodeType":"Attribute","startLoc":1035,"text":"self.y_window"},{"attributeType":"null","col":8,"comment":"null","endLoc":1181,"id":13862,"name":"_x_domain","nodeType":"Attribute","startLoc":1181,"text":"self._x_domain"},{"attributeType":"null","col":8,"comment":"null","endLoc":1189,"id":13863,"name":"_y_domain","nodeType":"Attribute","startLoc":1189,"text":"self._y_domain"},{"attributeType":"null","col":8,"comment":"null","endLoc":1025,"id":13864,"name":"_default_domain_window","nodeType":"Attribute","startLoc":1025,"text":"self._default_domain_window"},{"attributeType":"null","col":8,"comment":"null","endLoc":1034,"id":13865,"name":"x_window","nodeType":"Attribute","startLoc":1034,"text":"self.x_window"},{"attributeType":"null","col":16,"comment":"null","endLoc":67,"id":13866,"name":"np","nodeType":"Attribute","startLoc":67,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":70,"id":13867,"name":"models_1D","nodeType":"Attribute","startLoc":70,"text":"models_1D"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":48,"id":13868,"name":"m_p","nodeType":"Attribute","startLoc":48,"text":"m_p"},{"fileName":"constant.py","filePath":"astropy/constants","id":13869,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport functools\nimport types\nimport warnings\n\nimport numpy as np\n\nfrom astropy.units.core import Unit, UnitsError\nfrom astropy.units.quantity import Quantity\nfrom astropy.utils import lazyproperty\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n__all__ = ['Constant', 'EMConstant']\n\n\nclass ConstantMeta(type):\n    \"\"\"Metaclass for `~astropy.constants.Constant`. The primary purpose of this\n    is to wrap the double-underscore methods of `~astropy.units.Quantity`\n    which is the superclass of `~astropy.constants.Constant`.\n\n    In particular this wraps the operator overloads such as `__add__` to\n    prevent their use with constants such as ``e`` from being used in\n    expressions without specifying a system.  The wrapper checks to see if the\n    constant is listed (by name) in ``Constant._has_incompatible_units``, a set\n    of those constants that are defined in different systems of units are\n    physically incompatible.  It also performs this check on each `Constant` if\n    it hasn't already been performed (the check is deferred until the\n    `Constant` is actually used in an expression to speed up import times,\n    among other reasons).\n    \"\"\"\n\n    def __new__(mcls, name, bases, d):\n        def wrap(meth):\n            @functools.wraps(meth)\n            def wrapper(self, *args, **kwargs):\n                name_lower = self.name.lower()\n                instances = self._registry[name_lower]\n                if not self._checked_units:\n                    for inst in instances.values():\n                        try:\n                            self.unit.to(inst.unit)\n                        except UnitsError:\n                            self._has_incompatible_units.add(name_lower)\n                    self._checked_units = True\n\n                if (not self.system and\n                        name_lower in self._has_incompatible_units):\n                    systems = sorted([x for x in instances if x])\n                    raise TypeError(\n                        'Constant {!r} does not have physically compatible '\n                        'units across all systems of units and cannot be '\n                        'combined with other values without specifying a '\n                        'system (eg. {}.{})'.format(self.abbrev, self.abbrev,\n                                                      systems[0]))\n\n                return meth(self, *args, **kwargs)\n\n            return wrapper\n\n        # The wrapper applies to so many of the __ methods that it's easier to\n        # just exclude the ones it doesn't apply to\n        exclude = set(['__new__', '__array_finalize__', '__array_wrap__',\n                       '__dir__', '__getattr__', '__init__', '__str__',\n                       '__repr__', '__hash__', '__iter__', '__getitem__',\n                       '__len__', '__bool__', '__quantity_subclass__',\n                       '__setstate__'])\n        for attr, value in vars(Quantity).items():\n            if (isinstance(value, types.FunctionType) and\n                    attr.startswith('__') and attr.endswith('__') and\n                    attr not in exclude):\n                d[attr] = wrap(value)\n\n        return super().__new__(mcls, name, bases, d)\n\n\nclass Constant(Quantity, metaclass=ConstantMeta):\n    \"\"\"A physical or astronomical constant.\n\n    These objects are quantities that are meant to represent physical\n    constants.\n    \"\"\"\n    _registry = {}\n    _has_incompatible_units = set()\n\n    def __new__(cls, abbrev, name, value, unit, uncertainty,\n                reference=None, system=None):\n        if reference is None:\n            reference = getattr(cls, 'default_reference', None)\n            if reference is None:\n                raise TypeError(f\"{cls} requires a reference.\")\n        name_lower = name.lower()\n        instances = cls._registry.setdefault(name_lower, {})\n        # By-pass Quantity initialization, since units may not yet be\n        # initialized here, and we store the unit in string form.\n        inst = np.array(value).view(cls)\n\n        if system in instances:\n                warnings.warn('Constant {!r} already has a definition in the '\n                              '{!r} system from {!r} reference'.format(\n                              name, system, reference), AstropyUserWarning)\n        for c in instances.values():\n            if system is not None and not hasattr(c.__class__, system):\n                setattr(c, system, inst)\n            if c.system is not None and not hasattr(inst.__class__, c.system):\n                setattr(inst, c.system, c)\n\n        instances[system] = inst\n\n        inst._abbrev = abbrev\n        inst._name = name\n        inst._value = value\n        inst._unit_string = unit\n        inst._uncertainty = uncertainty\n        inst._reference = reference\n        inst._system = system\n\n        inst._checked_units = False\n        return inst\n\n    def __repr__(self):\n        return ('<{} name={!r} value={} uncertainty={} unit={!r} '\n                'reference={!r}>'.format(self.__class__, self.name, self.value,\n                                          self.uncertainty, str(self.unit),\n                                          self.reference))\n\n    def __str__(self):\n        return ('  Name   = {}\\n'\n                '  Value  = {}\\n'\n                '  Uncertainty  = {}\\n'\n                '  Unit  = {}\\n'\n                '  Reference = {}'.format(self.name, self.value,\n                                           self.uncertainty, self.unit,\n                                           self.reference))\n\n    def __quantity_subclass__(self, unit):\n        return super().__quantity_subclass__(unit)[0], False\n\n    def copy(self):\n        \"\"\"\n        Return a copy of this `Constant` instance.  Since they are by\n        definition immutable, this merely returns another reference to\n        ``self``.\n        \"\"\"\n        return self\n    __deepcopy__ = __copy__ = copy\n\n    @property\n    def abbrev(self):\n        \"\"\"A typical ASCII text abbreviation of the constant, also generally\n        the same as the Python variable used for this constant.\n        \"\"\"\n\n        return self._abbrev\n\n    @property\n    def name(self):\n        \"\"\"The full name of the constant.\"\"\"\n\n        return self._name\n\n    @lazyproperty\n    def _unit(self):\n        \"\"\"The unit(s) in which this constant is defined.\"\"\"\n\n        return Unit(self._unit_string)\n\n    @property\n    def uncertainty(self):\n        \"\"\"The known absolute uncertainty in this constant's value.\"\"\"\n\n        return self._uncertainty\n\n    @property\n    def reference(self):\n        \"\"\"The source used for the value of this constant.\"\"\"\n\n        return self._reference\n\n    @property\n    def system(self):\n        \"\"\"The system of units in which this constant is defined (typically\n        `None` so long as the constant's units can be directly converted\n        between systems).\n        \"\"\"\n\n        return self._system\n\n    def _instance_or_super(self, key):\n        instances = self._registry[self.name.lower()]\n        inst = instances.get(key)\n        if inst is not None:\n            return inst\n        else:\n            return getattr(super(), key)\n\n    @property\n    def si(self):\n        \"\"\"If the Constant is defined in the SI system return that instance of\n        the constant, else convert to a Quantity in the appropriate SI units.\n        \"\"\"\n\n        return self._instance_or_super('si')\n\n    @property\n    def cgs(self):\n        \"\"\"If the Constant is defined in the CGS system return that instance of\n        the constant, else convert to a Quantity in the appropriate CGS units.\n        \"\"\"\n\n        return self._instance_or_super('cgs')\n\n    def __array_finalize__(self, obj):\n        for attr in ('_abbrev', '_name', '_value', '_unit_string',\n                     '_uncertainty', '_reference', '_system'):\n            setattr(self, attr, getattr(obj, attr, None))\n\n        self._checked_units = getattr(obj, '_checked_units', False)\n\n\nclass EMConstant(Constant):\n    \"\"\"An electromagnetic constant.\"\"\"\n\n    @property\n    def cgs(self):\n        \"\"\"Overridden for EMConstant to raise a `TypeError`\n        emphasizing that there are multiple EM extensions to CGS.\n        \"\"\"\n\n        raise TypeError(\"Cannot convert EM constants to cgs because there \"\n                        \"are different systems for E.M constants within the \"\n                        \"c.g.s system (ESU, Gaussian, etc.). Instead, \"\n                        \"directly use the constant with the appropriate \"\n                        \"suffix (e.g. e.esu, e.gauss, etc.).\")\n"},{"col":4,"comment":"null","endLoc":1557,"header":"def _coeff_matrix(self, coeff_prefix, coeffs)","id":13870,"name":"_coeff_matrix","nodeType":"Function","startLoc":1544,"text":"def _coeff_matrix(self, coeff_prefix, coeffs):\n        mat = np.zeros((self.order + 1, self.order + 1))\n        for i in range(2, self.order + 1):\n            attr = f'{coeff_prefix}_{i}_{0}'\n            mat[i, 0] = coeffs[self.param_names.index(attr)]\n        for i in range(2, self.order + 1):\n            attr = f'{coeff_prefix}_{0}_{i}'\n            mat[0, i] = coeffs[self.param_names.index(attr)]\n        for i in range(1, self.order):\n            for j in range(1, self.order):\n                if i + j < self.order + 1:\n                    attr = f'{coeff_prefix}_{i}_{j}'\n                    mat[i, j] = coeffs[self.param_names.index(attr)]\n        return mat"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":78,"id":13871,"name":"alpha","nodeType":"Attribute","startLoc":78,"text":"alpha"},{"attributeType":"null","col":0,"comment":"null","endLoc":307,"id":13872,"name":"models_2D","nodeType":"Attribute","startLoc":307,"text":"models_2D"},{"className":"ConstantMeta","col":0,"comment":"Metaclass for `~astropy.constants.Constant`. The primary purpose of this\n    is to wrap the double-underscore methods of `~astropy.units.Quantity`\n    which is the superclass of `~astropy.constants.Constant`.\n\n    In particular this wraps the operator overloads such as `__add__` to\n    prevent their use with constants such as ``e`` from being used in\n    expressions without specifying a system.  The wrapper checks to see if the\n    constant is listed (by name) in ``Constant._has_incompatible_units``, a set\n    of those constants that are defined in different systems of units are\n    physically incompatible.  It also performs this check on each `Constant` if\n    it hasn't already been performed (the check is deferred until the\n    `Constant` is actually used in an expression to speed up import times,\n    among other reasons).\n    ","endLoc":74,"id":13873,"nodeType":"Class","startLoc":17,"text":"class ConstantMeta(type):\n    \"\"\"Metaclass for `~astropy.constants.Constant`. The primary purpose of this\n    is to wrap the double-underscore methods of `~astropy.units.Quantity`\n    which is the superclass of `~astropy.constants.Constant`.\n\n    In particular this wraps the operator overloads such as `__add__` to\n    prevent their use with constants such as ``e`` from being used in\n    expressions without specifying a system.  The wrapper checks to see if the\n    constant is listed (by name) in ``Constant._has_incompatible_units``, a set\n    of those constants that are defined in different systems of units are\n    physically incompatible.  It also performs this check on each `Constant` if\n    it hasn't already been performed (the check is deferred until the\n    `Constant` is actually used in an expression to speed up import times,\n    among other reasons).\n    \"\"\"\n\n    def __new__(mcls, name, bases, d):\n        def wrap(meth):\n            @functools.wraps(meth)\n            def wrapper(self, *args, **kwargs):\n                name_lower = self.name.lower()\n                instances = self._registry[name_lower]\n                if not self._checked_units:\n                    for inst in instances.values():\n                        try:\n                            self.unit.to(inst.unit)\n                        except UnitsError:\n                            self._has_incompatible_units.add(name_lower)\n                    self._checked_units = True\n\n                if (not self.system and\n                        name_lower in self._has_incompatible_units):\n                    systems = sorted([x for x in instances if x])\n                    raise TypeError(\n                        'Constant {!r} does not have physically compatible '\n                        'units across all systems of units and cannot be '\n                        'combined with other values without specifying a '\n                        'system (eg. {}.{})'.format(self.abbrev, self.abbrev,\n                                                      systems[0]))\n\n                return meth(self, *args, **kwargs)\n\n            return wrapper\n\n        # The wrapper applies to so many of the __ methods that it's easier to\n        # just exclude the ones it doesn't apply to\n        exclude = set(['__new__', '__array_finalize__', '__array_wrap__',\n                       '__dir__', '__getattr__', '__init__', '__str__',\n                       '__repr__', '__hash__', '__iter__', '__getitem__',\n                       '__len__', '__bool__', '__quantity_subclass__',\n                       '__setstate__'])\n        for attr, value in vars(Quantity).items():\n            if (isinstance(value, types.FunctionType) and\n                    attr.startswith('__') and attr.endswith('__') and\n                    attr not in exclude):\n                d[attr] = wrap(value)\n\n        return super().__new__(mcls, name, bases, d)"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":81,"id":13874,"name":"atm","nodeType":"Attribute","startLoc":81,"text":"atm"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":51,"id":13875,"name":"m_n","nodeType":"Attribute","startLoc":51,"text":"m_n"},{"col":4,"comment":"null","endLoc":74,"header":"def __new__(mcls, name, bases, d)","id":13876,"name":"__new__","nodeType":"Function","startLoc":33,"text":"def __new__(mcls, name, bases, d):\n        def wrap(meth):\n            @functools.wraps(meth)\n            def wrapper(self, *args, **kwargs):\n                name_lower = self.name.lower()\n                instances = self._registry[name_lower]\n                if not self._checked_units:\n                    for inst in instances.values():\n                        try:\n                            self.unit.to(inst.unit)\n                        except UnitsError:\n                            self._has_incompatible_units.add(name_lower)\n                    self._checked_units = True\n\n                if (not self.system and\n                        name_lower in self._has_incompatible_units):\n                    systems = sorted([x for x in instances if x])\n                    raise TypeError(\n                        'Constant {!r} does not have physically compatible '\n                        'units across all systems of units and cannot be '\n                        'combined with other values without specifying a '\n                        'system (eg. {}.{})'.format(self.abbrev, self.abbrev,\n                                                      systems[0]))\n\n                return meth(self, *args, **kwargs)\n\n            return wrapper\n\n        # The wrapper applies to so many of the __ methods that it's easier to\n        # just exclude the ones it doesn't apply to\n        exclude = set(['__new__', '__array_finalize__', '__array_wrap__',\n                       '__dir__', '__getattr__', '__init__', '__str__',\n                       '__repr__', '__hash__', '__iter__', '__getitem__',\n                       '__len__', '__bool__', '__quantity_subclass__',\n                       '__setstate__'])\n        for attr, value in vars(Quantity).items():\n            if (isinstance(value, types.FunctionType) and\n                    attr.startswith('__') and attr.endswith('__') and\n                    attr not in exclude):\n                d[attr] = wrap(value)\n\n        return super().__new__(mcls, name, bases, d)"},{"col":0,"comment":"","endLoc":50,"header":"example_models.py#<anonymous>","id":13877,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nHere are all the test parameters and values for the each\n`~astropy.modeling.FittableModel` defined. There is a dictionary for 1D and a\ndictionary for 2D models.\n\nExplanation of keywords of the dictionaries:\n\n\"parameters\" : list or dict\n    Model parameters, the model is tested with. Make sure you keep the right\n    order.  For polynomials you can also use a dict to specify the\n    coefficients. See examples below.\n\n\"x_values\" : list\n    x values where the model is evaluated.\n\n\"y_values\" : list\n    Reference y values for the in x_values given positions.\n\n\"z_values\" : list\n    Reference z values for the in x_values and y_values given positions.\n    (2D model option)\n\n\"x_lim\" : list\n    x test range for the model fitter. Depending on the model this can differ\n    e.g. the PowerLaw model should be tested over a few magnitudes.\n\n\"y_lim\" : list\n    y test range for the model fitter. Depending on the model this can differ\n    e.g. the PowerLaw model should be tested over a few magnitudes.  (2D model\n    option)\n\n\"log_fit\" : bool\n    PowerLaw models should be tested over a few magnitudes. So log_fit should\n    be true.\n\n\"requires_scipy\" : bool\n    If a model requires scipy (Bessel functions etc.) set this flag.\n\n\"integral\" : float\n    Approximate value of the integral in the range x_lim (and y_lim).\n\n\"deriv_parameters\" : list\n    If given the test of the derivative will use these parameters to create a\n    model (optional)\n\n\"deriv_initial\" : list\n    If given the test of the derivative will use these parameters as initial\n    values for the fit (optional)\n\"\"\"\n\nmodels_1D = {\n    Gaussian1D: {\n        'parameters': [1, 0, 1],\n        'x_values': [0, np.sqrt(2), -np.sqrt(2)],\n        'y_values': [1.0, 0.367879, 0.367879],\n        'x_lim': [-10, 10],\n        'integral': np.sqrt(2 * np.pi),\n        'bbox_peak': True\n    },\n\n    Sine1D: {\n        'parameters': [1, 0.1, 0],\n        'x_values': [0, 2.5],\n        'y_values': [0, 1],\n        'x_lim': [-10, 10],\n        'integral': 0\n    },\n\n    Cosine1D: {\n        'parameters': [1, 0.1, 0],\n        'x_values': [0, 2.5],\n        'y_values': [1, 0],\n        'x_lim': [-10, 10],\n        'integral': 0\n    },\n\n    Tangent1D: {\n        'parameters': [1, 0.1, 0],\n        'x_values': [0, 1.25],\n        'y_values': [0, 1],\n        'x_lim': [-10, 10],\n        'integral': 0\n    },\n\n    ArcSine1D: {\n        'parameters': [1, 0.1, 0],\n        'x_values': [0, 1],\n        'y_values': [0, 2.5],\n        'x_lim': [-0.5, 0.5],\n        'integral': 0\n    },\n\n    ArcCosine1D: {\n        'parameters': [1, 0.1, 0],\n        'x_values': [1, 0],\n        'y_values': [0, 2.5],\n        'x_lim': [-0.5, 0.5],\n        'integral': 0\n    },\n\n    ArcTangent1D: {\n        'parameters': [1, 0.1, 0],\n        'x_values': [0, 1],\n        'y_values': [0, 1.25],\n        'x_lim': [-10, 10],\n        'integral': 0\n    },\n\n    Box1D: {\n        'parameters': [1, 0, 10],\n        'x_values': [-5, 5, 0, -10, 10],\n        'y_values': [1, 1, 1, 0, 0],\n        'x_lim': [-10, 10],\n        'integral': 10,\n        'bbox_peak': True\n    },\n\n    Linear1D: {\n        'parameters': [1, 0],\n        'x_values': [0, np.pi, 42, -1],\n        'y_values': [0, np.pi, 42, -1],\n        'x_lim': [-10, 10],\n        'integral': 0\n    },\n\n    Lorentz1D: {\n        'parameters': [1, 0, 1],\n        'x_values': [0, -1, 1, 0.5, -0.5],\n        'y_values': [1., 0.2, 0.2, 0.5, 0.5],\n        'x_lim': [-10, 10],\n        'integral': 1,\n        'bbox_peak': True\n    },\n\n    RickerWavelet1D: {\n        'parameters': [1, 0, 1],\n        'x_values': [0, 1, -1, 3, -3],\n        'y_values': [1.0, 0.0, 0.0, -0.088872, -0.088872],\n        'x_lim': [-20, 20],\n        'integral': 0,\n        'bbox_peak': True\n    },\n\n    Trapezoid1D: {\n        'parameters': [1, 0, 2, 1],\n        'x_values': [0, 1, -1, 1.5, -1.5, 2, 2],\n        'y_values': [1, 1, 1, 0.5, 0.5, 0, 0],\n        'x_lim': [-10, 10],\n        'integral': 3,\n        'bbox_peak': True\n    },\n\n    Const1D: {\n        'parameters': [1],\n        'x_values': [-1, 1, np.pi, -42., 0],\n        'y_values': [1, 1, 1, 1, 1],\n        'x_lim': [-10, 10],\n        'integral': 20\n    },\n\n    Moffat1D: {\n        'parameters': [1, 0, 1, 2],\n        'x_values': [0, 1, -1, 3, -3],\n        'y_values': [1.0, 0.25, 0.25, 0.01, 0.01],\n        'x_lim': [-10, 10],\n        'integral': 1,\n        'deriv_parameters': [23.4, 1.2, 2.1, 2.3],\n        'deriv_initial': [10, 1, 1, 1]\n    },\n\n    PowerLaw1D: {\n        'parameters': [1, 1, 2],\n        'constraints': {'fixed': {'x_0': True}},\n        'x_values': [1, 10, 100],\n        'y_values': [1.0, 0.01, 0.0001],\n        'x_lim': [1, 10],\n        'log_fit': True,\n        'integral': 0.99\n    },\n\n    BrokenPowerLaw1D: {\n        'parameters': [1, 1, 2, 3],\n        'constraints': {'fixed': {'x_break': True}},\n        'x_values': [0.1, 1, 10, 100],\n        'y_values': [1e2, 1.0, 1e-3, 1e-6],\n        'x_lim': [0.1, 100],\n        'log_fit': True\n    },\n\n    SmoothlyBrokenPowerLaw1D: {\n        'parameters': [1, 1, -2, 2, 0.5],\n        'constraints': {'fixed': {'x_break': True, 'delta': True}},\n        'x_values': [0.01, 1, 100],\n        'y_values': [3.99920012e-04, 1.0, 3.99920012e-04],\n        'x_lim': [0.01, 100],\n        'log_fit': True\n    },\n\n    ExponentialCutoffPowerLaw1D: {\n        'parameters': [1, 1, 2, 3],\n        'constraints': {'fixed': {'x_0': True}},\n        'x_values': [0.1, 1, 10, 100],\n        'y_values': [9.67216100e+01, 7.16531311e-01, 3.56739933e-04,\n                     3.33823780e-19],\n        'x_lim': [0.01, 100],\n        'log_fit': True\n    },\n\n    LogParabola1D: {\n        'parameters': [1, 2, 3, 0.1],\n        'constraints': {'fixed': {'x_0': True}},\n        'x_values': [0.1, 1, 10, 100],\n        'y_values': [3.26089063e+03, 7.62472488e+00, 6.17440488e-03,\n                     1.73160572e-06],\n        'x_lim': [0.1, 100],\n        'log_fit': True\n    },\n\n    Polynomial1D: {\n        'parameters': {'degree': 2, 'c0': 1., 'c1': 1., 'c2': 1.},\n        'x_values': [1, 10, 100],\n        'y_values': [3, 111, 10101],\n        'x_lim': [-3, 3]\n     },\n\n    Sersic1D: {\n        'parameters': [1, 20, 4],\n        'x_values': [0.1, 1, 10, 100],\n        'y_values': [2.78629391e+02, 5.69791430e+01, 3.38788244e+00,\n                     2.23941982e-02],\n        'requires_scipy': True,\n        'x_lim': [0, 10],\n        'log_fit': True\n    },\n\n    Voigt1D: {\n        'parameters': [0, 1, 0.5, 0.9],\n        'x_values': [0, 0.2, 0.5, 1, 2, 4, 8, 20],\n        'y_values': [0.52092360, 0.479697445, 0.317550374, 0.0988079347,\n                     1.73876624e-2, 4.00173216e-3, 9.82351731e-4, 1.56396993e-4],\n        'x_lim': [-3, 3]\n     },\n\n    KingProjectedAnalytic1D: {\n        'parameters': [1, 1, 2],\n        'x_values': [0, 0.1, 0.5, 0.8],\n        'y_values': [0.30557281, 0.30011069, 0.2, 0.1113258],\n        'x_lim': [0, 10],\n        'y_lim': [0, 10],\n        'bbox_peak': True\n    },\n\n    Drude1D: {\n        'parameters': [1.0, 8.0, 1.0],\n        'x_values': [7.0, 8.0, 9.0, 10.0],\n        'y_values': [0.17883212, 1.0, 0.21891892, 0.07163324],\n        'x_lim': [1.0, 20.0],\n        'y_lim': [0.0, 10.0],\n        'bbox_peak': True\n    },\n\n    Plummer1D: {\n        'parameters': [10., 0.5],\n        'x_values': [1.0000e-03, 2.5005e+00, 5.0000e+00],\n        'y_values': [1.90984022e+01, 5.53541843e-03, 1.86293603e-04],\n        'x_lim': [0.001, 100]\n    },\n\n    Exponential1D: {\n        'parameters': [1, 1],\n        'x_values': [0, 0.5, 1],\n        'y_values': [1, np.sqrt(np.e), np.e],\n        'x_lim': [0, 2],\n        'integral': (np.e**2 - 1.),\n    },\n\n    Logarithmic1D: {\n        'parameters': [1, 1],\n        'x_values': [1, np.e, np.e**2],\n        'y_values': [0, 1, 2],\n        'x_lim': [1, np.e**2],\n        'integral': (np.e**2 + 1),\n    }\n}\n\nmodels_2D = {\n    Gaussian2D: {\n        'parameters': [1, 0, 0, 1, 1],\n        'constraints': {'fixed': {'theta': True}},\n        'x_values': [0, np.sqrt(2), -np.sqrt(2)],\n        'y_values': [0, np.sqrt(2), -np.sqrt(2)],\n        'z_values': [1, 1. / np.exp(1) ** 2, 1. / np.exp(1) ** 2],\n        'x_lim': [-10, 10],\n        'y_lim': [-10, 10],\n        'integral': 2 * np.pi,\n        'deriv_parameters': [137., 5.1, 5.4, 1.5, 2., np.pi/4],\n        'deriv_initial': [10, 5, 5, 4, 4, .5],\n        'bbox_peak': True\n    },\n\n    Const2D: {\n        'parameters': [1],\n        'x_values': [-1, 1, np.pi, -42., 0],\n        'y_values': [0, 1, 42, np.pi, -1],\n        'z_values': [1, 1, 1, 1, 1],\n        'x_lim': [-10, 10],\n        'y_lim': [-10, 10],\n        'integral': 400\n    },\n\n    Box2D: {\n        'parameters': [1, 0, 0, 10, 10],\n        'x_values': [-5, 5, -5, 5, 0, -10, 10],\n        'y_values': [-5, 5, 0, 0, 0, -10, 10],\n        'z_values': [1, 1, 1, 1, 1, 0, 0],\n        'x_lim': [-10, 10],\n        'y_lim': [-10, 10],\n        'integral': 100,\n        'bbox_peak': True\n    },\n\n    RickerWavelet2D: {\n        'parameters': [1, 0, 0, 1],\n        'x_values': [0, 0, 0, 0, 0, 1, -1, 3, -3],\n        'y_values': [0, 1, -1, 3, -3, 0, 0, 0, 0],\n        'z_values': [1.0, 0.303265, 0.303265, -0.038881, -0.038881,\n                     0.303265, 0.303265, -0.038881, -0.038881],\n        'x_lim': [-10, 11],\n        'y_lim': [-10, 11],\n        'integral': 0\n    },\n\n    TrapezoidDisk2D: {\n        'parameters': [1, 0, 0, 1, 1],\n        'x_values': [0, 0.5, 0, 1.5],\n        'y_values': [0, 0.5, 1.5, 0],\n        'z_values': [1, 1, 0.5, 0.5],\n        'x_lim': [-3, 3],\n        'y_lim': [-3, 3],\n        'bbox_peak': True\n    },\n\n    AiryDisk2D: {\n        'parameters': [7, 0, 0, 10],\n        'x_values': [0, 1, -1, -0.5, -0.5],\n        'y_values': [0, -1, 0.5, 0.5, -0.5],\n        'z_values': [7., 6.50158267, 6.68490643, 6.87251093, 6.87251093],\n        'x_lim': [-10, 10],\n        'y_lim': [-10, 10],\n        'requires_scipy': True\n    },\n\n    Moffat2D: {\n        'parameters': [1, 0, 0, 1, 2],\n        'x_values': [0, 1, -1, 3, -3],\n        'y_values': [0, -1, 3, 1, -3],\n        'z_values': [1.0, 0.111111, 0.008264, 0.008264, 0.00277],\n        'x_lim': [-3, 3],\n        'y_lim': [-3, 3]\n    },\n\n    Polynomial2D: {\n        'parameters': {'degree': 1, 'c0_0': 1., 'c1_0': 1., 'c0_1': 1.},\n        'x_values': [1, 2, 3],\n        'y_values': [1, 3, 2],\n        'z_values': [3, 6, 6],\n        'x_lim': [1, 100],\n        'y_lim': [1, 100]\n    },\n\n    Disk2D: {\n        'parameters': [1, 0, 0, 5],\n        'x_values': [-5, 5, -5, 5, 0, -10, 10],\n        'y_values': [-5, 5, 0, 0, 0, -10, 10],\n        'z_values': [0, 0, 1, 1, 1, 0, 0],\n        'x_lim': [-10, 10],\n        'y_lim': [-10, 10],\n        'integral': np.pi * 5 ** 2,\n        'bbox_peak': True\n    },\n\n    Ring2D: {\n        'parameters': [1, 0, 0, 5, 5],\n        'x_values': [-5, 5, -5, 5, 0, -10, 10],\n        'y_values': [-5, 5, 0, 0, 0, -10, 10],\n        'z_values': [1, 1, 1, 1, 0, 0, 0],\n        'x_lim': [-10, 10],\n        'y_lim': [-10, 10],\n        'integral': np.pi * (10 ** 2 - 5 ** 2),\n        'bbox_peak': True\n    },\n\n    Sersic2D: {\n        'parameters': [1, 25, 4, 50, 50, 0.5, -1],\n        'x_values': [0.0, 1, 10, 100],\n        'y_values': [1, 100, 0.0, 10],\n        'z_values': [1.686398e-02, 9.095221e-02, 2.341879e-02, 9.419231e-02],\n        'requires_scipy': True,\n        'x_lim': [1, 1e10],\n        'y_lim': [1, 1e10]\n    },\n\n    Planar2D: {\n        'parameters': [1, 1, 0],\n        'x_values': [0, np.pi, 42, -1],\n        'y_values': [np.pi, 0, -1, 42],\n        'z_values': [np.pi, np.pi, 41, 41],\n        'x_lim': [-10, 10],\n        'y_lim': [-10, 10],\n        'integral': 0\n    }\n}"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":84,"id":13878,"name":"mu0","nodeType":"Attribute","startLoc":84,"text":"mu0"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":54,"id":13879,"name":"m_e","nodeType":"Attribute","startLoc":54,"text":"m_e"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":87,"id":13880,"name":"sigma_T","nodeType":"Attribute","startLoc":87,"text":"sigma_T"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":57,"id":13881,"name":"u","nodeType":"Attribute","startLoc":57,"text":"u"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":60,"id":13882,"name":"sigma_sb","nodeType":"Attribute","startLoc":60,"text":"sigma_sb"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":91,"id":13883,"name":"b_wien","nodeType":"Attribute","startLoc":91,"text":"b_wien"},{"attributeType":"EMCODATA2014","col":0,"comment":"null","endLoc":97,"id":13884,"name":"e_esu","nodeType":"Attribute","startLoc":97,"text":"e_esu"},{"attributeType":"EMCODATA2010","col":0,"comment":"null","endLoc":63,"id":13885,"name":"e","nodeType":"Attribute","startLoc":63,"text":"e"},{"attributeType":"EMCODATA2014","col":0,"comment":"null","endLoc":100,"id":13886,"name":"e_emu","nodeType":"Attribute","startLoc":100,"text":"e_emu"},{"attributeType":"EMCODATA2014","col":0,"comment":"null","endLoc":103,"id":13887,"name":"e_gauss","nodeType":"Attribute","startLoc":103,"text":"e_gauss"},{"fileName":"__init__.py","filePath":"astropy/constants","id":13888,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nContains astronomical and physical constants for use in Astropy or other\nplaces.\n\nA typical use case might be::\n\n    >>> from astropy.constants import c, m_e\n    >>> # ... define the mass of something you want the rest energy of as m ...\n    >>> m = m_e\n    >>> E = m * c**2\n    >>> E.to('MeV')  # doctest: +FLOAT_CMP\n    <Quantity 0.510998927603161 MeV>\n\n\"\"\"\nimport warnings\n\nfrom astropy.utils import find_current_module\n\n# Hack to make circular imports with units work\n# isort: split\nfrom astropy import units\n\ndel units\n\nfrom . import cgs  # noqa\nfrom . import si  # noqa\nfrom . import utils as _utils  # noqa\nfrom .config import codata, iaudata  # noqa\nfrom .constant import Constant, EMConstant  # noqa\n\n# for updating the constants module docstring\n_lines = [\n    'The following constants are available:\\n',\n    '========== ============== ================ =========================',\n    '   Name        Value            Unit       Description',\n    '========== ============== ================ =========================',\n]\n\n# Catch warnings about \"already has a definition in the None system\"\nwith warnings.catch_warnings():\n    warnings.filterwarnings('ignore', 'Constant .*already has a definition')\n    _utils._set_c(codata, iaudata, find_current_module(),\n                  not_in_module_only=True, doclines=_lines, set_class=True)\n\n_lines.append(_lines[1])\n\nif __doc__ is not None:\n    __doc__ += '\\n'.join(_lines)\n\n\n# Clean up namespace\ndel find_current_module\ndel warnings\ndel _utils\ndel _lines\n"},{"col":0,"comment":"","endLoc":5,"header":"codata2014.py#<anonymous>","id":13890,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nAstronomical and physics constants in SI units.  See :mod:`astropy.constants`\nfor a complete listing of constants defined in Astropy.\n\"\"\"\n\nh = CODATA2014('h', \"Planck constant\", 6.626070040e-34,\n               'J s', 0.000000081e-34, system='si')\n\nhbar = CODATA2014('hbar', \"Reduced Planck constant\", 1.054571800e-34,\n                  'J s', 0.000000013e-34, system='si')\n\nk_B = CODATA2014('k_B', \"Boltzmann constant\", 1.38064852e-23,\n                 'J / (K)', 0.00000079e-23, system='si')\n\nc = CODATA2014('c', \"Speed of light in vacuum\", 299792458.,\n               'm / (s)', 0.0, system='si')\n\nG = CODATA2014('G', \"Gravitational constant\", 6.67408e-11,\n               'm3 / (kg s2)', 0.00031e-11, system='si')\n\ng0 = CODATA2014('g0', \"Standard acceleration of gravity\", 9.80665,\n                'm / s2', 0.0, system='si')\n\nm_p = CODATA2014('m_p', \"Proton mass\", 1.672621898e-27,\n                 'kg', 0.000000021e-27, system='si')\n\nm_n = CODATA2014('m_n', \"Neutron mass\", 1.674927471e-27,\n                 'kg', 0.000000021e-27, system='si')\n\nm_e = CODATA2014('m_e', \"Electron mass\", 9.10938356e-31,\n                 'kg', 0.00000011e-31, system='si')\n\nu = CODATA2014('u', \"Atomic mass\", 1.660539040e-27,\n               'kg', 0.000000020e-27, system='si')\n\nsigma_sb = CODATA2014('sigma_sb', \"Stefan-Boltzmann constant\", 5.670367e-8,\n                      'W / (K4 m2)', 0.000013e-8, system='si')\n\ne = EMCODATA2014('e', 'Electron charge', 1.6021766208e-19,\n                 'C', 0.0000000098e-19, system='si')\n\neps0 = EMCODATA2014('eps0', 'Electric constant', 8.854187817e-12,\n                    'F/m', 0.0, system='si')\n\nN_A = CODATA2014('N_A', \"Avogadro's number\", 6.022140857e23,\n                 '1 / (mol)', 0.000000074e23, system='si')\n\nR = CODATA2014('R', \"Gas constant\", 8.3144598,\n               'J / (K mol)', 0.0000048, system='si')\n\nRyd = CODATA2014('Ryd', 'Rydberg constant', 10973731.568508,\n                 '1 / (m)', 0.000065, system='si')\n\na0 = CODATA2014('a0', \"Bohr radius\", 0.52917721067e-10,\n                'm', 0.00000000012e-10, system='si')\n\nmuB = CODATA2014('muB', \"Bohr magneton\", 927.4009994e-26,\n                 'J/T', 0.00002e-26, system='si')\n\nalpha = CODATA2014('alpha', \"Fine-structure constant\", 7.2973525664e-3,\n                   '', 0.0000000017e-3, system='si')\n\natm = CODATA2014('atm', \"Standard atmosphere\", 101325,\n                 'Pa', 0.0, system='si')\n\nmu0 = CODATA2014('mu0', \"Magnetic constant\", 4.0e-7 * np.pi, 'N/A2', 0.0,\n                 system='si')\n\nsigma_T = CODATA2014('sigma_T', \"Thomson scattering cross-section\",\n                     0.66524587158e-28, 'm2', 0.00000000091e-28,\n                     system='si')\n\nb_wien = CODATA2014('b_wien', 'Wien wavelength displacement law constant',\n                    2.8977729e-3, 'm K', 0.0000017e-3, system='si')\n\ne_esu = EMCODATA2014(e.abbrev, e.name, e.value * c.value * 10.0,\n                     'statC', e.uncertainty * c.value * 10.0, system='esu')\n\ne_emu = EMCODATA2014(e.abbrev, e.name, e.value / 10, 'abC',\n                     e.uncertainty / 10, system='emu')\n\ne_gauss = EMCODATA2014(e.abbrev, e.name, e.value * c.value * 10.0,\n                       'Fr', e.uncertainty * c.value * 10.0, system='gauss')"},{"attributeType":"null","col":16,"comment":"null","endLoc":38,"id":13891,"name":"instances","nodeType":"Attribute","startLoc":38,"text":"instances"},{"attributeType":"null","col":20,"comment":"null","endLoc":49,"id":13892,"name":"systems","nodeType":"Attribute","startLoc":49,"text":"systems"},{"attributeType":"null","col":16,"comment":"null","endLoc":37,"id":13893,"name":"name_lower","nodeType":"Attribute","startLoc":37,"text":"name_lower"},{"attributeType":"null","col":8,"comment":"null","endLoc":63,"id":13894,"name":"exclude","nodeType":"Attribute","startLoc":63,"text":"exclude"},{"attributeType":"null","col":20,"comment":"null","endLoc":45,"id":13895,"name":"_checked_units","nodeType":"Attribute","startLoc":45,"text":"self._checked_units"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":13896,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"constant.py#<anonymous>","id":13897,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['Constant', 'EMConstant']"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":13898,"name":"_lines","nodeType":"Attribute","startLoc":33,"text":"_lines"},{"fileName":"astropyconst20.py","filePath":"astropy/constants","id":13899,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nAstronomical and physics constants for Astropy v2.0.\nSee :mod:`astropy.constants` for a complete listing of constants defined\nin Astropy.\n\"\"\"\nimport warnings\n\nfrom astropy.utils import find_current_module\n\nfrom . import codata2014, iau2015\nfrom . import utils as _utils\n\ncodata = codata2014\niaudata = iau2015\n\n_utils._set_c(codata, iaudata, find_current_module())\n\n# Overwrite the following for consistency.\n# https://github.com/astropy/astropy/issues/8920\nwith warnings.catch_warnings():\n    warnings.filterwarnings('ignore', 'Constant .*already has a definition')\n\n    # Solar mass (derived from mass parameter and gravitational constant)\n    M_sun = iau2015.IAU2015(\n        'M_sun', \"Solar mass\", iau2015.GM_sun.value / codata2014.G.value,\n        'kg', ((codata2014.G.uncertainty / codata2014.G.value) *\n               (iau2015.GM_sun.value / codata2014.G.value)),\n        f\"IAU 2015 Resolution B 3 + {codata2014.G.reference}\", system='si')\n\n    # Jupiter mass (derived from mass parameter and gravitational constant)\n    M_jup = iau2015.IAU2015(\n        'M_jup', \"Jupiter mass\", iau2015.GM_jup.value / codata2014.G.value,\n        'kg', ((codata2014.G.uncertainty / codata2014.G.value) *\n               (iau2015.GM_jup.value / codata2014.G.value)),\n        f\"IAU 2015 Resolution B 3 + {codata2014.G.reference}\", system='si')\n\n    # Earth mass (derived from mass parameter and gravitational constant)\n    M_earth = iau2015.IAU2015(\n        'M_earth', \"Earth mass\",\n        iau2015.GM_earth.value / codata2014.G.value,\n        'kg', ((codata2014.G.uncertainty / codata2014.G.value) *\n               (iau2015.GM_earth.value / codata2014.G.value)),\n        f\"IAU 2015 Resolution B 3 + {codata2014.G.reference}\", system='si')\n\n# Clean up namespace\ndel warnings\ndel find_current_module\ndel _utils\n"},{"col":0,"comment":"","endLoc":15,"header":"__init__.py#<anonymous>","id":13900,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nContains astronomical and physical constants for use in Astropy or other\nplaces.\n\nA typical use case might be::\n\n    >>> from astropy.constants import c, m_e\n    >>> # ... define the mass of something you want the rest energy of as m ...\n    >>> m = m_e\n    >>> E = m * c**2\n    >>> E.to('MeV')  # doctest: +FLOAT_CMP\n    <Quantity 0.510998927603161 MeV>\n\n\"\"\"\n\ndel units\n\n_lines = [\n    'The following constants are available:\\n',\n    '========== ============== ================ =========================',\n    '   Name        Value            Unit       Description',\n    '========== ============== ================ =========================',\n]\n\nwith warnings.catch_warnings():\n    warnings.filterwarnings('ignore', 'Constant .*already has a definition')\n    _utils._set_c(codata, iaudata, find_current_module(),\n                  not_in_module_only=True, doclines=_lines, set_class=True)\n\n_lines.append(_lines[1])\n\nif __doc__ is not None:\n    __doc__ += '\\n'.join(_lines)\n\ndel find_current_module\n\ndel warnings\n\ndel _utils\n\ndel _lines"},{"id":13901,"name":"astropy/constants/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/constants/tests","id":13902,"nodeType":"File","text":""},{"attributeType":"EMCODATA2010","col":0,"comment":"null","endLoc":66,"id":13903,"name":"eps0","nodeType":"Attribute","startLoc":66,"text":"eps0"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":69,"id":13904,"name":"N_A","nodeType":"Attribute","startLoc":69,"text":"N_A"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":72,"id":13905,"name":"R","nodeType":"Attribute","startLoc":72,"text":"R"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":75,"id":13906,"name":"Ryd","nodeType":"Attribute","startLoc":75,"text":"Ryd"},{"attributeType":"null","col":23,"comment":"null","endLoc":12,"id":13907,"name":"_utils","nodeType":"Attribute","startLoc":12,"text":"_utils"},{"attributeType":"codata2014.py","col":0,"comment":"null","endLoc":14,"id":13908,"name":"codata","nodeType":"Attribute","startLoc":14,"text":"codata"},{"attributeType":"iau2015.py","col":0,"comment":"null","endLoc":15,"id":13909,"name":"iaudata","nodeType":"Attribute","startLoc":15,"text":"iaudata"},{"attributeType":"IAU2015","col":4,"comment":"null","endLoc":25,"id":13910,"name":"M_sun","nodeType":"Attribute","startLoc":25,"text":"M_sun"},{"attributeType":"null","col":8,"comment":"null","endLoc":835,"id":13911,"name":"fit_info","nodeType":"Attribute","startLoc":835,"text":"self.fit_info"},{"attributeType":"null","col":8,"comment":"null","endLoc":833,"id":13912,"name":"niter","nodeType":"Attribute","startLoc":833,"text":"self.niter"},{"attributeType":"Fitter","col":8,"comment":"null","endLoc":831,"id":13913,"name":"fitter","nodeType":"Attribute","startLoc":831,"text":"self.fitter"},{"attributeType":"null","col":8,"comment":"null","endLoc":832,"id":13914,"name":"outlier_func","nodeType":"Attribute","startLoc":832,"text":"self.outlier_func"},{"attributeType":"null","col":8,"comment":"null","endLoc":834,"id":13915,"name":"outlier_kwargs","nodeType":"Attribute","startLoc":834,"text":"self.outlier_kwargs"},{"className":"LevMarLSQFitter","col":0,"comment":"\n    Levenberg-Marquardt algorithm and least squares statistic.\n\n    Attributes\n    ----------\n    fit_info : dict\n        The `scipy.optimize.leastsq` result for the most recent fit (see\n        notes).\n\n    Notes\n    -----\n    The ``fit_info`` dictionary contains the values returned by\n    `scipy.optimize.leastsq` for the most recent fit, including the values from\n    the ``infodict`` dictionary it returns. See the `scipy.optimize.leastsq`\n    documentation for details on the meaning of these values. Note that the\n    ``x`` return value is *not* included (as it is instead the parameter values\n    of the returned model).\n    Additionally, one additional element of ``fit_info`` is computed whenever a\n    model is fit, with the key 'param_cov'. The corresponding value is the\n    covariance matrix of the parameters as a 2D numpy array.  The order of the\n    matrix elements matches the order of the parameters in the fitted model\n    (i.e., the same order as ``model.param_names``).\n\n    ","endLoc":1248,"id":13916,"nodeType":"Class","startLoc":1025,"text":"class LevMarLSQFitter(metaclass=_FitterMeta):\n    \"\"\"\n    Levenberg-Marquardt algorithm and least squares statistic.\n\n    Attributes\n    ----------\n    fit_info : dict\n        The `scipy.optimize.leastsq` result for the most recent fit (see\n        notes).\n\n    Notes\n    -----\n    The ``fit_info`` dictionary contains the values returned by\n    `scipy.optimize.leastsq` for the most recent fit, including the values from\n    the ``infodict`` dictionary it returns. See the `scipy.optimize.leastsq`\n    documentation for details on the meaning of these values. Note that the\n    ``x`` return value is *not* included (as it is instead the parameter values\n    of the returned model).\n    Additionally, one additional element of ``fit_info`` is computed whenever a\n    model is fit, with the key 'param_cov'. The corresponding value is the\n    covariance matrix of the parameters as a 2D numpy array.  The order of the\n    matrix elements matches the order of the parameters in the fitted model\n    (i.e., the same order as ``model.param_names``).\n\n    \"\"\"\n\n    supported_constraints = ['fixed', 'tied', 'bounds']\n    \"\"\"\n    The constraint types supported by this fitter type.\n    \"\"\"\n\n    def __init__(self, calc_uncertainties=False):\n        self.fit_info = {'nfev': None,\n                         'fvec': None,\n                         'fjac': None,\n                         'ipvt': None,\n                         'qtf': None,\n                         'message': None,\n                         'ierr': None,\n                         'param_jac': None,\n                         'param_cov': None}\n        self._calc_uncertainties=calc_uncertainties\n        super().__init__()\n\n    def objective_function(self, fps, *args):\n        \"\"\"\n        Function to minimize.\n\n        Parameters\n        ----------\n        fps : list\n            parameters returned by the fitter\n        args : list\n            [model, [weights], [input coordinates]]\n\n        \"\"\"\n\n        model = args[0]\n        weights = args[1]\n        fitter_to_model_params(model, fps)\n        meas = args[-1]\n        if weights is None:\n            return np.ravel(model(*args[2: -1]) - meas)\n        else:\n            return np.ravel(weights * (model(*args[2: -1]) - meas))\n\n    @staticmethod\n    def _add_fitting_uncertainties(model, cov_matrix):\n        \"\"\"\n        Set ``cov_matrix`` and ``stds`` attributes on model with parameter\n        covariance matrix returned by ``optimize.leastsq``.\n        \"\"\"\n\n        free_param_names = [x for x in model.fixed if (model.fixed[x] is False)\n                            and (model.tied[x] is False)]\n\n        model.cov_matrix = Covariance(cov_matrix, free_param_names)\n        model.stds = StandardDeviations(cov_matrix, free_param_names)\n\n    @fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None,\n                 maxiter=DEFAULT_MAXITER, acc=DEFAULT_ACC,\n                 epsilon=DEFAULT_EPS, estimate_jacobian=False):\n        \"\"\"\n        Fit data to this model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            model to fit to x, y, z\n        x : array\n           input coordinates\n        y : array\n           input coordinates\n        z : array, optional\n           input coordinates\n        weights : array, optional\n            Weights for fitting.\n            For data with Gaussian uncertainties, the weights should be\n            1/sigma.\n        maxiter : int\n            maximum number of iterations\n        acc : float\n            Relative error desired in the approximate solution\n        epsilon : float\n            A suitable step length for the forward-difference\n            approximation of the Jacobian (if model.fjac=None). If\n            epsfcn is less than the machine precision, it is\n            assumed that the relative errors in the functions are\n            of the order of the machine precision.\n        estimate_jacobian : bool\n            If False (default) and if the model has a fit_deriv method,\n            it will be used. Otherwise the Jacobian will be estimated.\n            If True, the Jacobian will be estimated in any case.\n        equivalencies : list or None, optional, keyword-only\n            List of *additional* equivalencies that are should be applied in\n            case x, y and/or z have units. Default is None.\n\n        Returns\n        -------\n        model_copy : `~astropy.modeling.FittableModel`\n            a copy of the input model with parameters set by the fitter\n\n        \"\"\"\n\n        from scipy import optimize\n\n        model_copy = _validate_model(model, self.supported_constraints)\n        model_copy.sync_constraints = False\n        farg = (model_copy, weights, ) + _convert_input(x, y, z)\n        if model_copy.fit_deriv is None or estimate_jacobian:\n            dfunc = None\n        else:\n            dfunc = self._wrap_deriv\n        init_values, _ = model_to_fit_params(model_copy)\n        fitparams, cov_x, dinfo, mess, ierr = optimize.leastsq(\n            self.objective_function, init_values, args=farg, Dfun=dfunc,\n            col_deriv=model_copy.col_fit_deriv, maxfev=maxiter, epsfcn=epsilon,\n            xtol=acc, full_output=True)\n        fitter_to_model_params(model_copy, fitparams)\n        self.fit_info.update(dinfo)\n        self.fit_info['cov_x'] = cov_x\n        self.fit_info['message'] = mess\n        self.fit_info['ierr'] = ierr\n        if ierr not in [1, 2, 3, 4]:\n            warnings.warn(\"The fit may be unsuccessful; check \"\n                          \"fit_info['message'] for more information.\",\n                          AstropyUserWarning)\n\n        # now try to compute the true covariance matrix\n        if (len(y) > len(init_values)) and cov_x is not None:\n            sum_sqrs = np.sum(self.objective_function(fitparams, *farg)**2)\n            dof = len(y) - len(init_values)\n            self.fit_info['param_cov'] = cov_x * sum_sqrs / dof\n        else:\n            self.fit_info['param_cov'] = None\n\n        if self._calc_uncertainties is True:\n            if self.fit_info['param_cov'] is not None:\n                self._add_fitting_uncertainties(model_copy,\n                                               self.fit_info['param_cov'])\n\n        model_copy.sync_constraints = True\n        return model_copy\n\n    @staticmethod\n    def _wrap_deriv(params, model, weights, x, y, z=None):\n        \"\"\"\n        Wraps the method calculating the Jacobian of the function to account\n        for model constraints.\n        `scipy.optimize.leastsq` expects the function derivative to have the\n        above signature (parlist, (argtuple)). In order to accommodate model\n        constraints, instead of using p directly, we set the parameter list in\n        this function.\n        \"\"\"\n\n        if weights is None:\n            weights = 1.0\n\n        if any(model.fixed.values()) or any(model.tied.values()):\n            # update the parameters with the current values from the fitter\n            fitter_to_model_params(model, params)\n            if z is None:\n                full = np.array(model.fit_deriv(x, *model.parameters))\n                if not model.col_fit_deriv:\n                    full_deriv = np.ravel(weights) * full.T\n                else:\n                    full_deriv = np.ravel(weights) * full\n            else:\n                full = np.array([np.ravel(_) for _ in model.fit_deriv(x, y, *model.parameters)])\n                if not model.col_fit_deriv:\n                    full_deriv = np.ravel(weights) * full.T\n                else:\n                    full_deriv = np.ravel(weights) * full\n\n            pars = [getattr(model, name) for name in model.param_names]\n            fixed = [par.fixed for par in pars]\n            tied = [par.tied for par in pars]\n            tied = list(np.where([par.tied is not False for par in pars],\n                                 True, tied))\n            fix_and_tie = np.logical_or(fixed, tied)\n            ind = np.logical_not(fix_and_tie)\n\n            if not model.col_fit_deriv:\n                residues = np.asarray(full_deriv[np.nonzero(ind)]).T\n            else:\n                residues = full_deriv[np.nonzero(ind)]\n\n            return [np.ravel(_) for _ in residues]\n        else:\n            if z is None:\n                try:\n                    return np.array([np.ravel(_) for _ in np.array(weights) *\n                                     np.array(model.fit_deriv(x, *params))])\n                except ValueError:\n                    return np.array([np.ravel(_) for _ in np.array(weights) *\n                                     np.moveaxis(\n                                         np.array(model.fit_deriv(x, *params)),\n                                         -1, 0)]).transpose()\n            else:\n                if not model.col_fit_deriv:\n                    return [np.ravel(_) for _ in\n                            (np.ravel(weights) * np.array(model.fit_deriv(x, y, *params)).T).T]\n                return [np.ravel(_) for _ in weights * np.array(model.fit_deriv(x, y, *params))]"},{"col":4,"comment":"null","endLoc":1067,"header":"def __init__(self, calc_uncertainties=False)","id":13917,"name":"__init__","nodeType":"Function","startLoc":1056,"text":"def __init__(self, calc_uncertainties=False):\n        self.fit_info = {'nfev': None,\n                         'fvec': None,\n                         'fjac': None,\n                         'ipvt': None,\n                         'qtf': None,\n                         'message': None,\n                         'ierr': None,\n                         'param_jac': None,\n                         'param_cov': None}\n        self._calc_uncertainties=calc_uncertainties\n        super().__init__()"},{"id":13918,"name":"astropy/cosmology","nodeType":"Package"},{"fileName":"funcs.py","filePath":"astropy/cosmology","id":13919,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nConvenience functions for `astropy.cosmology`.\n\"\"\"\n\nimport warnings\n\nimport numpy as np\n\nfrom astropy.units import Quantity\nfrom astropy.utils.exceptions import AstropyUserWarning\n\nfrom . import units as cu\nfrom .core import CosmologyError\n\n__all__ = ['z_at_value']\n\n__doctest_requires__ = {'*': ['scipy']}\n\n\ndef _z_at_scalar_value(func, fval, zmin=1e-8, zmax=1000, ztol=1e-8, maxfun=500,\n                      method='Brent', bracket=None, verbose=False):\n    \"\"\"\n    Find the redshift ``z`` at which ``func(z) = fval``.\n    See :func:`astropy.cosmology.funcs.z_at_value`.\n    \"\"\"\n    from scipy.optimize import minimize_scalar\n\n    opt = {'maxiter': maxfun}\n    # Assume custom methods support the same options as default; otherwise user\n    # will see warnings.\n    if str(method).lower() == 'bounded':\n        opt['xatol'] = ztol\n        if bracket is not None:\n            warnings.warn(f\"Option 'bracket' is ignored by method {method}.\")\n            bracket = None\n    else:\n        opt['xtol'] = ztol\n\n    # fval falling inside the interval of bracketing function values does not\n    # guarantee it has a unique solution, but for Standard Cosmological\n    # quantities normally should (being monotonic or having a single extremum).\n    # In these cases keep solver from returning solutions outside of bracket.\n    fval_zmin, fval_zmax = func(zmin), func(zmax)\n    nobracket = False\n    if np.sign(fval - fval_zmin) != np.sign(fval_zmax - fval):\n        if bracket is None:\n            nobracket = True\n        else:\n            fval_brac = func(np.asanyarray(bracket))\n            if np.sign(fval - fval_brac[0]) != np.sign(fval_brac[-1] - fval):\n                nobracket = True\n            else:\n                zmin, zmax = bracket[0], bracket[-1]\n                fval_zmin, fval_zmax = fval_brac[[0, -1]]\n    if nobracket:\n        warnings.warn(f\"fval is not bracketed by func(zmin)={fval_zmin} and \"\n                      f\"func(zmax)={fval_zmax}. This means either there is no \"\n                      \"solution, or that there is more than one solution \"\n                      \"between zmin and zmax satisfying fval = func(z).\",\n                      AstropyUserWarning)\n\n    if isinstance(fval_zmin, Quantity):\n        val = fval.to_value(fval_zmin.unit)\n    else:\n        val = fval\n\n    # 'Brent' and 'Golden' ignore `bounds`, force solution inside zlim\n    def f(z):\n        if z > zmax:\n            return 1.e300 * (1.0 + z - zmax)\n        elif z < zmin:\n            return 1.e300 * (1.0 + zmin - z)\n        elif isinstance(fval_zmin, Quantity):\n            return abs(func(z).value - val)\n        else:\n            return abs(func(z) - val)\n\n    res = minimize_scalar(f, method=method, bounds=(zmin, zmax),\n                          bracket=bracket, options=opt)\n\n    # Scipy docs state that `OptimizeResult` always has 'status' and 'message'\n    # attributes, but only `_minimize_scalar_bounded()` seems to have really\n    # implemented them.\n    if not res.success:\n        warnings.warn(f\"Solver returned {res.get('status')}: {res.get('message', 'Unsuccessful')}\\n\"\n                      f\"Precision {res.fun} reached after {res.nfev} function calls.\",\n                      AstropyUserWarning)\n\n    if verbose:\n        print(res)\n\n    if np.allclose(res.x, zmax):\n        raise CosmologyError(\n            f\"Best guess z={res.x} is very close to the upper z limit {zmax}.\"\n            \"\\nTry re-running with a different zmax.\")\n    elif np.allclose(res.x, zmin):\n        raise CosmologyError(\n            f\"Best guess z={res.x} is very close to the lower z limit {zmin}.\"\n            \"\\nTry re-running with a different zmin.\")\n    return res.x\n\n\ndef z_at_value(func, fval, zmin=1e-8, zmax=1000, ztol=1e-8, maxfun=500,\n               method='Brent', bracket=None, verbose=False):\n    \"\"\"Find the redshift ``z`` at which ``func(z) = fval``.\n\n    This finds the redshift at which one of the cosmology functions or\n    methods (for example Planck13.distmod) is equal to a known value.\n\n    .. warning::\n       Make sure you understand the behavior of the function that you are\n       trying to invert! Depending on the cosmology, there may not be a\n       unique solution. For example, in the standard Lambda CDM cosmology,\n       there are two redshifts which give an angular diameter distance of\n       1500 Mpc, z ~ 0.7 and z ~ 3.8. To force ``z_at_value`` to find the\n       solution you are interested in, use the ``zmin`` and ``zmax`` keywords\n       to limit the search range (see the example below).\n\n    Parameters\n    ----------\n    func : function or method\n        A function that takes a redshift as input.\n\n    fval : `~astropy.units.Quantity`\n        The (scalar or array) value of ``func(z)`` to recover.\n\n    zmin : float or array-like['dimensionless'] or quantity-like, optional\n        The lower search limit for ``z``.  Beware of divergences\n        in some cosmological functions, such as distance moduli,\n        at z=0 (default 1e-8).\n\n    zmax : float or array-like['dimensionless'] or quantity-like, optional\n        The upper search limit for ``z`` (default 1000).\n\n    ztol : float or array-like['dimensionless'], optional\n        The relative error in ``z`` acceptable for convergence.\n\n    maxfun : int or array-like, optional\n        The maximum number of function evaluations allowed in the\n        optimization routine (default 500).\n\n    method : str or callable, optional\n        Type of solver to pass to the minimizer. The built-in options provided\n        by :func:`~scipy.optimize.minimize_scalar` are 'Brent' (default),\n        'Golden' and 'Bounded' with names case insensitive - see documentation\n        there for details. It also accepts a custom solver by passing any\n        user-provided callable object that meets the requirements listed\n        therein under the Notes on \"Custom minimizers\" - or in more detail in\n        :doc:`scipy:tutorial/optimize` - although their use is currently\n        untested.\n\n        .. versionadded:: 4.3\n\n    bracket : sequence or object array[sequence], optional\n        For methods 'Brent' and 'Golden', ``bracket`` defines the bracketing\n        interval and can either have three items (z1, z2, z3) so that\n        z1 < z2 < z3 and ``func(z2) < func (z1), func(z3)`` or two items z1\n        and z3 which are assumed to be a starting interval for a downhill\n        bracket search. For non-monotonic functions such as angular diameter\n        distance this may be used to start the search on the desired side of\n        the maximum, but see Examples below for usage notes.\n\n        .. versionadded:: 4.3\n\n    verbose : bool, optional\n        Print diagnostic output from solver (default `False`).\n\n        .. versionadded:: 4.3\n\n    Returns\n    -------\n    z : `~astropy.units.Quantity` ['redshift']\n        The redshift ``z`` satisfying ``zmin < z < zmax`` and ``func(z) =\n        fval`` within ``ztol``. Has units of cosmological redshift.\n\n    Warns\n    -----\n    :class:`~astropy.utils.exceptions.AstropyUserWarning`\n        If ``fval`` is not bracketed by ``func(zmin)=fval(zmin)`` and\n        ``func(zmax)=fval(zmax)``.\n\n        If the solver was not successful.\n\n    Raises\n    ------\n    :class:`astropy.cosmology.CosmologyError`\n        If the result is very close to either ``zmin`` or ``zmax``.\n    ValueError\n        If ``bracket`` is not an array nor a 2 (or 3) element sequence.\n    TypeError\n        If ``bracket`` is not an object array. 2 (or 3) element sequences will\n        be turned into object arrays, so this error should only occur if a\n        non-object array is used for ``bracket``.\n\n    Notes\n    -----\n    This works for any arbitrary input cosmology, but is inefficient if you\n    want to invert a large number of values for the same cosmology. In this\n    case, it is faster to instead generate an array of values at many\n    closely-spaced redshifts that cover the relevant redshift range, and then\n    use interpolation to find the redshift at each value you are interested\n    in. For example, to efficiently find the redshifts corresponding to 10^6\n    values of the distance modulus in a Planck13 cosmology, you could do the\n    following:\n\n    >>> import astropy.units as u\n    >>> from astropy.cosmology import Planck13, z_at_value\n\n    Generate 10^6 distance moduli between 24 and 44 for which we\n    want to find the corresponding redshifts:\n\n    >>> Dvals = (24 + np.random.rand(1000000) * 20) * u.mag\n\n    Make a grid of distance moduli covering the redshift range we\n    need using 50 equally log-spaced values between zmin and\n    zmax. We use log spacing to adequately sample the steep part of\n    the curve at low distance moduli:\n\n    >>> zmin = z_at_value(Planck13.distmod, Dvals.min())\n    >>> zmax = z_at_value(Planck13.distmod, Dvals.max())\n    >>> zgrid = np.geomspace(zmin, zmax, 50)\n    >>> Dgrid = Planck13.distmod(zgrid)\n\n    Finally interpolate to find the redshift at each distance modulus:\n\n    >>> zvals = np.interp(Dvals.value, Dgrid.value, zgrid)\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> from astropy.cosmology import Planck13, Planck18, z_at_value\n\n    The age and lookback time are monotonic with redshift, and so a\n    unique solution can be found:\n\n    >>> z_at_value(Planck13.age, 2 * u.Gyr)               # doctest: +FLOAT_CMP\n    <Quantity 3.19812268 redshift>\n\n    The angular diameter is not monotonic however, and there are two\n    redshifts that give a value of 1500 Mpc. You can use the zmin and\n    zmax keywords to find the one you are interested in:\n\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, zmax=1.5)                # doctest: +FLOAT_CMP\n    <Quantity 0.68044452 redshift>\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, zmin=2.5)                # doctest: +FLOAT_CMP\n    <Quantity 3.7823268 redshift>\n\n    Alternatively the ``bracket`` option may be used to initialize the\n    function solver on a desired region, but one should be aware that this\n    does not guarantee it will remain close to this starting bracket.\n    For the example of angular diameter distance, which has a maximum near\n    a redshift of 1.6 in this cosmology, defining a bracket on either side\n    of this maximum will often return a solution on the same side:\n\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, bracket=(1.0, 1.2))  # doctest: +FLOAT_CMP +IGNORE_WARNINGS\n    <Quantity 0.68044452 redshift>\n\n    But this is not ascertained especially if the bracket is chosen too wide\n    and/or too close to the turning point:\n\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, bracket=(0.1, 1.5))           # doctest: +SKIP\n    <Quantity 3.7823268 redshift>                              # doctest: +SKIP\n\n    Likewise, even for the same minimizer and same starting conditions different\n    results can be found depending on architecture or library versions:\n\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, bracket=(2.0, 2.5))           # doctest: +SKIP\n    <Quantity 3.7823268 redshift>                              # doctest: +SKIP\n\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, bracket=(2.0, 2.5))           # doctest: +SKIP\n    <Quantity 0.68044452 redshift>                             # doctest: +SKIP\n\n    It is therefore generally safer to use the 3-parameter variant to ensure\n    the solution stays within the bracketing limits:\n\n    >>> z_at_value(Planck18.angular_diameter_distance, 1500 * u.Mpc,\n    ...            bracket=(0.1, 1.0, 1.5))               # doctest: +FLOAT_CMP\n    <Quantity 0.68044452 redshift>\n\n    Also note that the luminosity distance and distance modulus (two\n    other commonly inverted quantities) are monotonic in flat and open\n    universes, but not in closed universes.\n\n    All the arguments except ``func``, ``method`` and ``verbose`` accept array\n    inputs. This does NOT use interpolation tables or any method to speed up\n    evaluations, rather providing a convenient means to broadcast arguments\n    over an element-wise scalar evaluation.\n\n    The most common use case for non-scalar input is to evaluate 'func' for an\n    array of ``fval``:\n\n    >>> z_at_value(Planck13.age, [2, 7] * u.Gyr)          # doctest: +FLOAT_CMP\n    <Quantity [3.19812061, 0.75620443] redshift>\n\n    ``fval`` can be any shape:\n\n    >>> z_at_value(Planck13.age, [[2, 7], [1, 3]]*u.Gyr)  # doctest: +FLOAT_CMP\n    <Quantity [[3.19812061, 0.75620443],\n               [5.67661227, 2.19131955]] redshift>\n\n    Other arguments can be arrays. For non-monotic functions  -- for example,\n    the angular diameter distance -- this can be useful to find all solutions.\n\n    >>> z_at_value(Planck13.angular_diameter_distance, 1500 * u.Mpc,\n    ...            zmin=[0, 2.5], zmax=[2, 4])            # doctest: +FLOAT_CMP\n    <Quantity [0.68127747, 3.79149062] redshift>\n\n    The ``bracket`` argument can likewise be be an array. However, since\n    bracket must already be a sequence (or None), it MUST be given as an\n    object `numpy.ndarray`. Importantly, the depth of the array must be such\n    that each bracket subsequence is an object. Errors or unexpected results\n    will happen otherwise. A convenient means to ensure the right depth is by\n    including a length-0 tuple as a bracket and then truncating the object\n    array to remove the placeholder. This can be seen in the following\n    example:\n\n    >>> bracket=np.array([(1.0, 1.2),(2.0, 2.5), ()], dtype=object)[:-1]\n    >>> z_at_value(Planck18.angular_diameter_distance, 1500 * u.Mpc,\n    ...            bracket=bracket)  # doctest: +SKIP\n    <Quantity [0.68044452, 3.7823268] redshift>\n    \"\"\"\n    # `fval` can be a Quantity, which isn't (yet) compatible w/ `numpy.nditer`\n    # so we strip it of units for broadcasting and restore the units when\n    # passing the elements to `_z_at_scalar_value`.\n    fval = np.asanyarray(fval)\n    unit = getattr(fval, 'unit', 1)  # can be unitless\n    zmin = Quantity(zmin, cu.redshift).value  # must be unitless\n    zmax = Quantity(zmax, cu.redshift).value\n\n    # bracket must be an object array (assumed to be correct) or a 'scalar'\n    # bracket: 2 or 3 elt sequence\n    if not isinstance(bracket, np.ndarray):  # 'scalar' bracket\n        if bracket is not None and len(bracket) not in (2, 3):\n            raise ValueError(\"`bracket` is not an array \"\n                             \"nor a 2 (or 3) element sequence.\")\n        else:  # munge bracket into a 1-elt object array\n            bracket = np.array([bracket, ()], dtype=object)[:1].squeeze()\n    if bracket.dtype != np.object_:\n        raise TypeError(f\"`bracket` has dtype {bracket.dtype}, not 'O'\")\n\n    # make multi-dimensional iterator for all but `method`, `verbose`\n    with np.nditer(\n        [fval, zmin, zmax, ztol, maxfun, bracket, None],\n        flags = ['refs_ok'],\n        op_flags = [*[['readonly']] * 6,  # ← inputs  output ↓\n                    ['writeonly', 'allocate', 'no_subtype']],\n        op_dtypes = (*(None,)*6, fval.dtype),\n        casting=\"no\",\n    ) as it:\n        for fv, zmn, zmx, zt, mfe, bkt, zs in it:  # ← eltwise unpack & eval ↓\n            zs[...] = _z_at_scalar_value(func, fv * unit, zmin=zmn, zmax=zmx,\n                                         ztol=zt, maxfun=mfe, bracket=bkt.item(),\n                                         # not broadcasted\n                                         method=method, verbose=verbose)\n        # since bracket is an object array, the output will be too, so it is\n        # cast to the same type as the function value.\n        result = it.operands[-1]  # zs\n\n    return result << cu.redshift\n"},{"col":4,"comment":"\n        Function to minimize.\n\n        Parameters\n        ----------\n        fps : list\n            parameters returned by the fitter\n        args : list\n            [model, [weights], [input coordinates]]\n\n        ","endLoc":1089,"header":"def objective_function(self, fps, *args)","id":13920,"name":"objective_function","nodeType":"Function","startLoc":1069,"text":"def objective_function(self, fps, *args):\n        \"\"\"\n        Function to minimize.\n\n        Parameters\n        ----------\n        fps : list\n            parameters returned by the fitter\n        args : list\n            [model, [weights], [input coordinates]]\n\n        \"\"\"\n\n        model = args[0]\n        weights = args[1]\n        fitter_to_model_params(model, fps)\n        meas = args[-1]\n        if weights is None:\n            return np.ravel(model(*args[2: -1]) - meas)\n        else:\n            return np.ravel(weights * (model(*args[2: -1]) - meas))"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":78,"id":13921,"name":"a0","nodeType":"Attribute","startLoc":78,"text":"a0"},{"fileName":"flrw.py","filePath":"astropy/cosmology","id":13922,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport warnings\nfrom abc import abstractmethod\nfrom math import acos, cos, exp, floor, inf, log, pi, sin, sqrt\nfrom numbers import Number\n\nimport numpy as np\n\nimport astropy.constants as const\nimport astropy.units as u\nfrom astropy.utils.compat.optional_deps import HAS_SCIPY\nfrom astropy.utils.decorators import lazyproperty\nfrom astropy.utils.exceptions import AstropyUserWarning\n\nfrom . import scalar_inv_efuncs\nfrom . import units as cu\nfrom .core import Cosmology, FlatCosmologyMixin, Parameter\nfrom .parameter import _validate_non_negative, _validate_with_unit\nfrom .utils import aszarr, vectorize_redshift_method\n\n# isort: split\nif HAS_SCIPY:\n    from scipy.integrate import quad\n    from scipy.special import ellipkinc, hyp2f1\nelse:\n    def quad(*args, **kwargs):\n        raise ModuleNotFoundError(\"No module named 'scipy.integrate'\")\n\n    def ellipkinc(*args, **kwargs):\n        raise ModuleNotFoundError(\"No module named 'scipy.special'\")\n\n    def hyp2f1(*args, **kwargs):\n        raise ModuleNotFoundError(\"No module named 'scipy.special'\")\n\n\n__all__ = [\"FLRW\", \"LambdaCDM\", \"FlatLambdaCDM\", \"wCDM\", \"FlatwCDM\",\n           \"w0waCDM\", \"Flatw0waCDM\", \"wpwaCDM\", \"w0wzCDM\", \"FlatFLRWMixin\"]\n\n__doctest_requires__ = {'*': ['scipy']}\n\n\n# Some conversion constants -- useful to compute them once here and reuse in\n# the initialization rather than have every object do them.\nH0units_to_invs = (u.km / (u.s * u.Mpc)).to(1.0 / u.s)\nsec_to_Gyr = u.s.to(u.Gyr)\n# const in critical density in cgs units (g cm^-3)\ncritdens_const = (3 / (8 * pi * const.G)).cgs.value\n# angle conversions\nradian_in_arcsec = (1 * u.rad).to(u.arcsec)\nradian_in_arcmin = (1 * u.rad).to(u.arcmin)\n# Radiation parameter over c^2 in cgs (g cm^-3 K^-4)\na_B_c2 = (4 * const.sigma_sb / const.c ** 3).cgs.value\n# Boltzmann constant in eV / K\nkB_evK = const.k_B.to(u.eV / u.K)\n\n\nclass FLRW(Cosmology):\n    \"\"\"\n    A class describing an isotropic and homogeneous\n    (Friedmann-Lemaitre-Robertson-Walker) cosmology.\n\n    This is an abstract base class -- you cannot instantiate examples of this\n    class, but must work with one of its subclasses, such as\n    :class:`~astropy.cosmology.LambdaCDM` or :class:`~astropy.cosmology.wCDM`.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0.  If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0. Note that this does not include massive\n        neutrinos.\n\n    Ode0 : float\n        Omega dark energy: density of dark energy in units of the critical\n        density at z=0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Notes\n    -----\n    Class instances are immutable -- you cannot change the parameters' values.\n    That is, all of the above attributes (except meta) are read only.\n\n    For details on how to create performant custom subclasses, see the\n    documentation on :ref:`astropy-cosmology-fast-integrals`.\n    \"\"\"\n\n    H0 = Parameter(doc=\"Hubble constant as an `~astropy.units.Quantity` at z=0.\",\n                   unit=\"km/(s Mpc)\", fvalidate=\"scalar\")\n    Om0 = Parameter(doc=\"Omega matter; matter density/critical density at z=0.\",\n                    fvalidate=\"non-negative\")\n    Ode0 = Parameter(doc=\"Omega dark energy; dark energy density/critical density at z=0.\",\n                     fvalidate=\"float\")\n    Tcmb0 = Parameter(doc=\"Temperature of the CMB as `~astropy.units.Quantity` at z=0.\",\n                      unit=\"Kelvin\", fvalidate=\"scalar\")\n    Neff = Parameter(doc=\"Number of effective neutrino species.\", fvalidate=\"non-negative\")\n    m_nu = Parameter(doc=\"Mass of neutrino species.\",\n                     unit=\"eV\", equivalencies=u.mass_energy())\n    Ob0 = Parameter(doc=\"Omega baryon; baryonic matter density/critical density at z=0.\")\n\n    def __init__(self, H0, Om0, Ode0, Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV,\n                 Ob0=None, *, name=None, meta=None):\n        super().__init__(name=name, meta=meta)\n\n        # Assign (and validate) Parameters\n        self.H0 = H0\n        self.Om0 = Om0\n        self.Ode0 = Ode0\n        self.Tcmb0 = Tcmb0\n        self.Neff = Neff\n        self.m_nu = m_nu  # (reset later, this is just for unit validation)\n        self.Ob0 = Ob0  # (must be after Om0)\n\n        # Derived quantities:\n        # Dark matter density; matter - baryons, if latter is not None.\n        self._Odm0 = None if Ob0 is None else (self._Om0 - self._Ob0)\n\n        # 100 km/s/Mpc * h = H0 (so h is dimensionless)\n        self._h = self._H0.value / 100.0\n        # Hubble distance\n        self._hubble_distance = (const.c / self._H0).to(u.Mpc)\n        # H0 in s^-1\n        H0_s = self._H0.value * H0units_to_invs\n        # Hubble time\n        self._hubble_time = (sec_to_Gyr / H0_s) << u.Gyr\n\n        # Critical density at z=0 (grams per cubic cm)\n        cd0value = critdens_const * H0_s ** 2\n        self._critical_density0 = cd0value << u.g / u.cm ** 3\n\n        # Compute photon density from Tcmb\n        self._Ogamma0 = a_B_c2 * self._Tcmb0.value ** 4 / self._critical_density0.value\n\n        # Compute Neutrino temperature:\n        # The constant in front is (4/11)^1/3 -- see any cosmology book for an\n        # explanation -- for example, Weinberg 'Cosmology' p 154 eq (3.1.21).\n        self._Tnu0 = 0.7137658555036082 * self._Tcmb0\n\n        # Compute neutrino parameters:\n        if self._m_nu is None:\n            self._nneutrinos = 0\n            self._neff_per_nu = None\n            self._massivenu = False\n            self._massivenu_mass = None\n            self._nmassivenu = self._nmasslessnu = None\n        else:\n            self._nneutrinos = floor(self._Neff)\n\n            # We are going to share Neff between the neutrinos equally. In\n            # detail this is not correct, but it is a standard assumption\n            # because properly calculating it is a) complicated b) depends on\n            # the details of the massive neutrinos (e.g., their weak\n            # interactions, which could be unusual if one is considering\n            # sterile neutrinos).\n            self._neff_per_nu = self._Neff / self._nneutrinos\n\n            # Now figure out if we have massive neutrinos to deal with, and if\n            # so, get the right number of masses. It is worth keeping track of\n            # massless ones separately (since they are easy to deal with, and a\n            # common use case is to have only one massive neutrino).\n            massive = np.nonzero(self._m_nu.value > 0)[0]\n            self._massivenu = massive.size > 0\n            self._nmassivenu = len(massive)\n            self._massivenu_mass = self._m_nu[massive].value if self._massivenu else None\n            self._nmasslessnu = self._nneutrinos - self._nmassivenu\n\n        # Compute Neutrino Omega and total relativistic component for massive\n        # neutrinos. We also store a list version, since that is more efficient\n        # to do integrals with (perhaps surprisingly! But small python lists\n        # are more efficient than small NumPy arrays).\n        if self._massivenu:  # (`_massivenu` set in `m_nu`)\n            nu_y = self._massivenu_mass / (kB_evK * self._Tnu0)\n            self._nu_y = nu_y.value\n            self._nu_y_list = self._nu_y.tolist()\n            self._Onu0 = self._Ogamma0 * self.nu_relative_density(0)\n        else:\n            # This case is particularly simple, so do it directly The 0.2271...\n            # is 7/8 (4/11)^(4/3) -- the temperature bit ^4 (blackbody energy\n            # density) times 7/8 for FD vs. BE statistics.\n            self._Onu0 = 0.22710731766 * self._Neff * self._Ogamma0\n            self._nu_y = self._nu_y_list = None\n\n        # Compute curvature density\n        self._Ok0 = 1.0 - self._Om0 - self._Ode0 - self._Ogamma0 - self._Onu0\n\n        # Subclasses should override this reference if they provide\n        #  more efficient scalar versions of inv_efunc.\n        self._inv_efunc_scalar = self.inv_efunc\n        self._inv_efunc_scalar_args = ()\n\n    # ---------------------------------------------------------------\n    # Parameter details\n\n    @Ob0.validator\n    def Ob0(self, param, value):\n        \"\"\"Validate baryon density to None or positive float > matter density.\"\"\"\n        if value is None:\n            return value\n\n        value = _validate_non_negative(self, param, value)\n        if value > self.Om0:\n            raise ValueError(\"baryonic density can not be larger than total matter density.\")\n        return value\n\n    @m_nu.validator\n    def m_nu(self, param, value):\n        \"\"\"Validate neutrino masses to right value, units, and shape.\n\n        There are no neutrinos if floor(Neff) or Tcmb0 are 0.\n        The number of neutrinos must match floor(Neff).\n        Neutrino masses cannot be negative.\n        \"\"\"\n        # Check if there are any neutrinos\n        if (nneutrinos := floor(self._Neff)) == 0 or self._Tcmb0.value == 0:\n            return None  # None, regardless of input\n\n        # Validate / set units\n        value = _validate_with_unit(self, param, value)\n\n        # Check values and data shapes\n        if value.shape not in ((), (nneutrinos,)):\n            raise ValueError(\"unexpected number of neutrino masses — \"\n                             f\"expected {nneutrinos}, got {len(value)}.\")\n        elif np.any(value.value < 0):\n            raise ValueError(\"invalid (negative) neutrino mass encountered.\")\n\n        # scalar -> array\n        if value.isscalar:\n            value = np.full_like(value, value, shape=nneutrinos)\n\n        return value\n\n    # ---------------------------------------------------------------\n    # properties\n\n    @property\n    def is_flat(self):\n        \"\"\"Return bool; `True` if the cosmology is flat.\"\"\"\n        return bool((self._Ok0 == 0.0) and (self.Otot0 == 1.0))\n\n    @property\n    def Otot0(self):\n        \"\"\"Omega total; the total density/critical density at z=0.\"\"\"\n        return self._Om0 + self._Ogamma0 + self._Onu0 + self._Ode0 + self._Ok0\n\n    @property\n    def Odm0(self):\n        \"\"\"Omega dark matter; dark matter density/critical density at z=0.\"\"\"\n        return self._Odm0\n\n    @property\n    def Ok0(self):\n        \"\"\"Omega curvature; the effective curvature density/critical density at z=0.\"\"\"\n        return self._Ok0\n\n    @property\n    def Tnu0(self):\n        \"\"\"Temperature of the neutrino background as `~astropy.units.Quantity` at z=0.\"\"\"\n        return self._Tnu0\n\n    @property\n    def has_massive_nu(self):\n        \"\"\"Does this cosmology have at least one massive neutrino species?\"\"\"\n        if self._Tnu0.value == 0:\n            return False\n        return self._massivenu\n\n    @property\n    def h(self):\n        \"\"\"Dimensionless Hubble constant: h = H_0 / 100 [km/sec/Mpc].\"\"\"\n        return self._h\n\n    @property\n    def hubble_time(self):\n        \"\"\"Hubble time as `~astropy.units.Quantity`.\"\"\"\n        return self._hubble_time\n\n    @property\n    def hubble_distance(self):\n        \"\"\"Hubble distance as `~astropy.units.Quantity`.\"\"\"\n        return self._hubble_distance\n\n    @property\n    def critical_density0(self):\n        \"\"\"Critical density as `~astropy.units.Quantity` at z=0.\"\"\"\n        return self._critical_density0\n\n    @property\n    def Ogamma0(self):\n        \"\"\"Omega gamma; the density/critical density of photons at z=0.\"\"\"\n        return self._Ogamma0\n\n    @property\n    def Onu0(self):\n        \"\"\"Omega nu; the density/critical density of neutrinos at z=0.\"\"\"\n        return self._Onu0\n\n    # ---------------------------------------------------------------\n\n    @abstractmethod\n    def w(self, z):\n        r\"\"\"The dark energy equation of state.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state.\n            `float` if scalar input.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1.\n\n        This must be overridden by subclasses.\n        \"\"\"\n        raise NotImplementedError(\"w(z) is not implemented\")\n\n    def Otot(self, z):\n        \"\"\"The total density parameter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        Otot : ndarray or float\n            The total density relative to the critical density at each redshift.\n            Returns float if input scalar.\n        \"\"\"\n        return self.Om(z) + self.Ogamma(z) + self.Onu(z) + self.Ode(z) + self.Ok(z)\n\n    def Om(self, z):\n        \"\"\"\n        Return the density parameter for non-relativistic matter\n        at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Om : ndarray or float\n            The density of non-relativistic matter relative to the critical\n            density at each redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        This does not include neutrinos, even if non-relativistic at the\n        redshift of interest; see `Onu`.\n        \"\"\"\n        z = aszarr(z)\n        return self._Om0 * (z + 1.0) ** 3 * self.inv_efunc(z) ** 2\n\n    def Ob(self, z):\n        \"\"\"Return the density parameter for baryonic matter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Ob : ndarray or float\n            The density of baryonic matter relative to the critical density at\n            each redshift.\n            Returns `float` if the input is scalar.\n\n        Raises\n        ------\n        ValueError\n            If ``Ob0`` is `None`.\n        \"\"\"\n        if self._Ob0 is None:\n            raise ValueError(\"Baryon density not set for this cosmology\")\n        z = aszarr(z)\n        return self._Ob0 * (z + 1.0) ** 3 * self.inv_efunc(z) ** 2\n\n    def Odm(self, z):\n        \"\"\"Return the density parameter for dark matter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Odm : ndarray or float\n            The density of non-relativistic dark matter relative to the\n            critical density at each redshift.\n            Returns `float` if the input is scalar.\n\n        Raises\n        ------\n        ValueError\n            If ``Ob0`` is `None`.\n\n        Notes\n        -----\n        This does not include neutrinos, even if non-relativistic at the\n        redshift of interest.\n        \"\"\"\n        if self._Odm0 is None:\n            raise ValueError(\"Baryonic density not set for this cosmology, \"\n                             \"unclear meaning of dark matter density\")\n        z = aszarr(z)\n        return self._Odm0 * (z + 1.0) ** 3 * self.inv_efunc(z) ** 2\n\n    def Ok(self, z):\n        \"\"\"\n        Return the equivalent density parameter for curvature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Ok : ndarray or float\n            The equivalent density parameter for curvature at each redshift.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        z = aszarr(z)\n        if self._Ok0 == 0:  # Common enough to be worth checking explicitly\n            return np.zeros(z.shape) if hasattr(z, \"shape\") else 0.0\n        return self._Ok0 * (z + 1.0) ** 2 * self.inv_efunc(z) ** 2\n\n    def Ode(self, z):\n        \"\"\"Return the density parameter for dark energy at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Ode : ndarray or float\n            The density of non-relativistic matter relative to the critical\n            density at each redshift.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        z = aszarr(z)\n        if self._Ode0 == 0:  # Common enough to be worth checking explicitly\n            return np.zeros(z.shape) if hasattr(z, \"shape\") else 0.0\n        return self._Ode0 * self.de_density_scale(z) * self.inv_efunc(z) ** 2\n\n    def Ogamma(self, z):\n        \"\"\"Return the density parameter for photons at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Ogamma : ndarray or float\n            The energy density of photons relative to the critical density at\n            each redshift.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        z = aszarr(z)\n        return self._Ogamma0 * (z + 1.0) ** 4 * self.inv_efunc(z) ** 2\n\n    def Onu(self, z):\n        r\"\"\"Return the density parameter for neutrinos at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Onu : ndarray or float\n            The energy density of neutrinos relative to the critical density at\n            each redshift. Note that this includes their kinetic energy (if\n            they have mass), so it is not equal to the commonly used\n            :math:`\\sum \\frac{m_{\\nu}}{94 eV}`, which does not include\n            kinetic energy.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        z = aszarr(z)\n        if self._Onu0 == 0:  # Common enough to be worth checking explicitly\n            return np.zeros(z.shape) if hasattr(z, \"shape\") else 0.0\n        return self.Ogamma(z) * self.nu_relative_density(z)\n\n    def Tcmb(self, z):\n        \"\"\"Return the CMB temperature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Tcmb : `~astropy.units.Quantity` ['temperature']\n            The temperature of the CMB in K.\n        \"\"\"\n        return self._Tcmb0 * (aszarr(z) + 1.0)\n\n    def Tnu(self, z):\n        \"\"\"Return the neutrino temperature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Tnu : `~astropy.units.Quantity` ['temperature']\n            The temperature of the cosmic neutrino background in K.\n        \"\"\"\n        return self._Tnu0 * (aszarr(z) + 1.0)\n\n    def nu_relative_density(self, z):\n        r\"\"\"Neutrino density function relative to the energy density in photons.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        f : ndarray or float\n            The neutrino density scaling factor relative to the density in\n            photons at each redshift.\n            Only returns `float` if z is scalar.\n\n        Notes\n        -----\n        The density in neutrinos is given by\n\n        .. math::\n\n           \\rho_{\\nu} \\left(a\\right) = 0.2271 \\, N_{eff} \\,\n           f\\left(m_{\\nu} a / T_{\\nu 0} \\right) \\,\n           \\rho_{\\gamma} \\left( a \\right)\n\n        where\n\n        .. math::\n\n           f \\left(y\\right) = \\frac{120}{7 \\pi^4}\n           \\int_0^{\\infty} \\, dx \\frac{x^2 \\sqrt{x^2 + y^2}}\n           {e^x + 1}\n\n        assuming that all neutrino species have the same mass.\n        If they have different masses, a similar term is calculated for each\n        one. Note that ``f`` has the asymptotic behavior :math:`f(0) = 1`. This\n        method returns :math:`0.2271 f` using an analytical fitting formula\n        given in Komatsu et al. 2011, ApJS 192, 18.\n        \"\"\"\n        # Note that there is also a scalar-z-only cython implementation of\n        # this in scalar_inv_efuncs.pyx, so if you find a problem in this\n        # you need to update there too.\n\n        # See Komatsu et al. 2011, eq 26 and the surrounding discussion\n        # for an explanation of what we are doing here.\n        # However, this is modified to handle multiple neutrino masses\n        # by computing the above for each mass, then summing\n        prefac = 0.22710731766  # 7/8 (4/11)^4/3 -- see any cosmo book\n\n        # The massive and massless contribution must be handled separately\n        # But check for common cases first\n        z = aszarr(z)\n        if not self._massivenu:\n            return prefac * self._Neff * (np.ones(z.shape) if hasattr(z, \"shape\") else 1.0)\n\n        # These are purely fitting constants -- see the Komatsu paper\n        p = 1.83\n        invp = 0.54644808743  # 1.0 / p\n        k = 0.3173\n\n        curr_nu_y = self._nu_y / (1. + np.expand_dims(z, axis=-1))\n        rel_mass_per = (1.0 + (k * curr_nu_y) ** p) ** invp\n        rel_mass = rel_mass_per.sum(-1) + self._nmasslessnu\n\n        return prefac * self._neff_per_nu * rel_mass\n\n    def _w_integrand(self, ln1pz):\n        \"\"\"Internal convenience function for w(z) integral (eq. 5 of [1]_).\n\n        Parameters\n        ----------\n        ln1pz : `~numbers.Number` or scalar ndarray\n            Assumes scalar input, since this should only be called inside an\n            integral.\n\n        References\n        ----------\n        .. [1] Linder, E. (2003). Exploring the Expansion History of the\n               Universe. Phys. Rev. Lett., 90, 091301.\n        \"\"\"\n        return 1.0 + self.w(exp(ln1pz) - 1.0)\n\n    def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and is given by\n\n        .. math::\n\n           I = \\exp \\left( 3 \\int_{a}^1 \\frac{ da^{\\prime} }{ a^{\\prime} }\n                          \\left[ 1 + w\\left( a^{\\prime} \\right) \\right] \\right)\n\n        The actual integral used is rewritten from [1]_ to be in terms of z.\n\n        It will generally helpful for subclasses to overload this method if\n        the integral can be done analytically for the particular dark\n        energy equation of state that they implement.\n\n        References\n        ----------\n        .. [1] Linder, E. (2003). Exploring the Expansion History of the\n               Universe. Phys. Rev. Lett., 90, 091301.\n        \"\"\"\n        # This allows for an arbitrary w(z) following eq (5) of\n        # Linder 2003, PRL 90, 91301.  The code here evaluates\n        # the integral numerically.  However, most popular\n        # forms of w(z) are designed to make this integral analytic,\n        # so it is probably a good idea for subclasses to overload this\n        # method if an analytic form is available.\n        z = aszarr(z)\n        if not isinstance(z, (Number, np.generic)):  # array/Quantity\n            ival = np.array([quad(self._w_integrand, 0, log(1 + redshift))[0]\n                             for redshift in z])\n            return np.exp(3 * ival)\n        else:  # scalar\n            ival = quad(self._w_integrand, 0, log(z + 1.0))[0]\n            return exp(3 * ival)\n\n    def efunc(self, z):\n        \"\"\"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n\n        Notes\n        -----\n        It is not necessary to override this method, but if de_density_scale\n        takes a particularly simple form, it may be advantageous to.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) +\n                       self._Ode0 * self.de_density_scale(z))\n\n    def inv_efunc(self, z):\n        \"\"\"Inverse of ``efunc``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the inverse Hubble constant.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        # Avoid the function overhead by repeating code\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return (zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) +\n                self._Ode0 * self.de_density_scale(z))**(-0.5)\n\n    def _lookback_time_integrand_scalar(self, z):\n        \"\"\"Integrand of the lookback time (equation 30 of [1]_).\n\n        Parameters\n        ----------\n        z : float\n            Input redshift.\n\n        Returns\n        -------\n        I : float\n            The integrand for the lookback time.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        \"\"\"\n        return self._inv_efunc_scalar(z, *self._inv_efunc_scalar_args) / (z + 1.0)\n\n    def lookback_time_integrand(self, z):\n        \"\"\"Integrand of the lookback time (equation 30 of [1]_).\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : float or array\n            The integrand for the lookback time.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        \"\"\"\n        z = aszarr(z)\n        return self.inv_efunc(z) / (z + 1.0)\n\n    def _abs_distance_integrand_scalar(self, z):\n        \"\"\"Integrand of the absorption distance [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        X : float\n            The integrand for the absorption distance.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        \"\"\"\n        args = self._inv_efunc_scalar_args\n        return (z + 1.0) ** 2 * self._inv_efunc_scalar(z, *args)\n\n    def abs_distance_integrand(self, z):\n        \"\"\"Integrand of the absorption distance [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        X : float or array\n            The integrand for the absorption distance.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        \"\"\"\n        z = aszarr(z)\n        return (z + 1.0) ** 2 * self.inv_efunc(z)\n\n    def H(self, z):\n        \"\"\"Hubble parameter (km/s/Mpc) at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        H : `~astropy.units.Quantity` ['frequency']\n            Hubble parameter at each input redshift.\n        \"\"\"\n        return self._H0 * self.efunc(z)\n\n    def scale_factor(self, z):\n        \"\"\"Scale factor at redshift ``z``.\n\n        The scale factor is defined as :math:`a = 1 / (1 + z)`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        a : ndarray or float\n            Scale factor at each input redshift.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        return 1.0 / (aszarr(z) + 1.0)\n\n    def lookback_time(self, z):\n        \"\"\"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to a lookback time.\n        \"\"\"\n        return self._lookback_time(z)\n\n    def _lookback_time(self, z):\n        \"\"\"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n        \"\"\"\n        return self._hubble_time * self._integral_lookback_time(z)\n\n    @vectorize_redshift_method\n    def _integral_lookback_time(self, z, /):\n        \"\"\"Lookback time to redshift ``z``. Value in units of Hubble time.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : float or ndarray\n            Lookback time to each input redshift in Hubble time units.\n            Returns `float` if input scalar, `~numpy.ndarray` otherwise.\n        \"\"\"\n        return quad(self._lookback_time_integrand_scalar, 0, z)[0]\n\n    def lookback_distance(self, z):\n        \"\"\"\n        The lookback distance is the light travel time distance to a given\n        redshift. It is simply c * lookback_time. It may be used to calculate\n        the proper distance between two redshifts, e.g. for the mean free path\n        to ionizing radiation.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Lookback distance in Mpc\n        \"\"\"\n        return (self.lookback_time(z) * const.c).to(u.Mpc)\n\n    def age(self, z):\n        \"\"\"Age of the universe in Gyr at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to an age.\n        \"\"\"\n        return self._age(z)\n\n    def _age(self, z):\n        \"\"\"Age of the universe in Gyr at redshift ``z``.\n\n        This internal function exists to be re-defined for optimizations.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n        \"\"\"\n        return self._hubble_time * self._integral_age(z)\n\n    @vectorize_redshift_method\n    def _integral_age(self, z, /):\n        \"\"\"Age of the universe at redshift ``z``. Value in units of Hubble time.\n\n        Calculated using explicit integration.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : float or ndarray\n            The age of the universe at each input redshift in Hubble time units.\n            Returns `float` if input scalar, `~numpy.ndarray` otherwise.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to an age.\n        \"\"\"\n        return quad(self._lookback_time_integrand_scalar, z, np.inf)[0]\n\n    def critical_density(self, z):\n        \"\"\"Critical density in grams per cubic cm at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        rho : `~astropy.units.Quantity`\n            Critical density in g/cm^3 at each input redshift.\n        \"\"\"\n\n        return self._critical_density0 * (self.efunc(z)) ** 2\n\n    def comoving_distance(self, z):\n        \"\"\"Comoving line-of-sight distance in Mpc at a given redshift.\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc to each input redshift.\n        \"\"\"\n        return self._comoving_distance_z1z2(0, z)\n\n    def _comoving_distance_z1z2(self, z1, z2):\n        \"\"\"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2``.\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n        \"\"\"\n        return self._integral_comoving_distance_z1z2(z1, z2)\n\n    @vectorize_redshift_method(nin=2)\n    def _integral_comoving_distance_z1z2_scalar(self, z1, z2, /):\n        \"\"\"\n        Comoving line-of-sight distance between objects at redshifts ``z1`` and\n        ``z2``. Value in Mpc.\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : float or ndarray\n            Comoving distance in Mpc between each input redshift.\n            Returns `float` if input scalar, `~numpy.ndarray` otherwise.\n        \"\"\"\n        return quad(self._inv_efunc_scalar, z1, z2, args=self._inv_efunc_scalar_args)[0]\n\n    def _integral_comoving_distance_z1z2(self, z1, z2):\n        \"\"\"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2``. The comoving distance along the line-of-sight\n        between two objects remains constant with time for objects in the\n        Hubble flow.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'] or array-like\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n        \"\"\"\n        return self._hubble_distance * self._integral_comoving_distance_z1z2_scalar(z1, z2)\n\n    def comoving_transverse_distance(self, z):\n        r\"\"\"Comoving transverse distance in Mpc at a given redshift.\n\n        This value is the transverse comoving distance at redshift ``z``\n        corresponding to an angular separation of 1 radian. This is the same as\n        the comoving distance if :math:`\\Omega_k` is zero (as in the current\n        concordance Lambda-CDM model).\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving transverse distance in Mpc at each input redshift.\n\n        Notes\n        -----\n        This quantity is also called the 'proper motion distance' in some texts.\n        \"\"\"\n        return self._comoving_transverse_distance_z1z2(0, z)\n\n    def _comoving_transverse_distance_z1z2(self, z1, z2):\n        r\"\"\"Comoving transverse distance in Mpc between two redshifts.\n\n        This value is the transverse comoving distance at redshift ``z2`` as\n        seen from redshift ``z1`` corresponding to an angular separation of\n        1 radian. This is the same as the comoving distance if :math:`\\Omega_k`\n        is zero (as in the current concordance Lambda-CDM model).\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving transverse distance in Mpc between input redshift.\n\n        Notes\n        -----\n        This quantity is also called the 'proper motion distance' in some texts.\n        \"\"\"\n        Ok0 = self._Ok0\n        dc = self._comoving_distance_z1z2(z1, z2)\n        if Ok0 == 0:\n            return dc\n        sqrtOk0 = sqrt(abs(Ok0))\n        dh = self._hubble_distance\n        if Ok0 > 0:\n            return dh / sqrtOk0 * np.sinh(sqrtOk0 * dc.value / dh.value)\n        else:\n            return dh / sqrtOk0 * np.sin(sqrtOk0 * dc.value / dh.value)\n\n    def angular_diameter_distance(self, z):\n        \"\"\"Angular diameter distance in Mpc at a given redshift.\n\n        This gives the proper (sometimes called 'physical') transverse\n        distance corresponding to an angle of 1 radian for an object\n        at redshift ``z`` ([1]_, [2]_, [3]_).\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Angular diameter distance in Mpc at each input redshift.\n\n        References\n        ----------\n        .. [1] Weinberg, 1972, pp 420-424; Weedman, 1986, pp 421-424.\n        .. [2] Weedman, D. (1986). Quasar astronomy, pp 65-67.\n        .. [3] Peebles, P. (1993). Principles of Physical Cosmology, pp 325-327.\n        \"\"\"\n        z = aszarr(z)\n        return self.comoving_transverse_distance(z) / (z + 1.0)\n\n    def luminosity_distance(self, z):\n        \"\"\"Luminosity distance in Mpc at redshift ``z``.\n\n        This is the distance to use when converting between the bolometric flux\n        from an object at redshift ``z`` and its bolometric luminosity [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Luminosity distance in Mpc at each input redshift.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to a luminosity distance.\n\n        References\n        ----------\n        .. [1] Weinberg, 1972, pp 420-424; Weedman, 1986, pp 60-62.\n        \"\"\"\n        z = aszarr(z)\n        return (z + 1.0) * self.comoving_transverse_distance(z)\n\n    def angular_diameter_distance_z1z2(self, z1, z2):\n        \"\"\"Angular diameter distance between objects at 2 redshifts.\n\n        Useful for gravitational lensing, for example computing the angular\n        diameter distance between a lensed galaxy and the foreground lens.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts. For most practical applications such as\n            gravitational lensing, ``z2`` should be larger than ``z1``. The\n            method will work for ``z2 < z1``; however, this will return\n            negative distances.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n            The angular diameter distance between each input redshift pair.\n            Returns scalar if input is scalar, array else-wise.\n        \"\"\"\n        z1, z2 = aszarr(z1), aszarr(z2)\n        if np.any(z2 < z1):\n            warnings.warn(f\"Second redshift(s) z2 ({z2}) is less than first \"\n                          f\"redshift(s) z1 ({z1}).\", AstropyUserWarning)\n        return self._comoving_transverse_distance_z1z2(z1, z2) / (z2 + 1.0)\n\n    @vectorize_redshift_method\n    def absorption_distance(self, z, /):\n        \"\"\"Absorption distance at redshift ``z``.\n\n        This is used to calculate the number of objects with some cross section\n        of absorption and number density intersecting a sightline per unit\n        redshift path ([1]_, [2]_).\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : float or ndarray\n            Absorption distance (dimensionless) at each input redshift.\n            Returns `float` if input scalar, `~numpy.ndarray` otherwise.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        .. [2] Bahcall, John N. and Peebles, P.J.E. 1969, ApJ, 156L, 7B\n        \"\"\"\n        return quad(self._abs_distance_integrand_scalar, 0, z)[0]\n\n    def distmod(self, z):\n        \"\"\"Distance modulus at redshift ``z``.\n\n        The distance modulus is defined as the (apparent magnitude - absolute\n        magnitude) for an object at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        distmod : `~astropy.units.Quantity` ['length']\n            Distance modulus at each input redshift, in magnitudes.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to a distance modulus.\n        \"\"\"\n        # Remember that the luminosity distance is in Mpc\n        # Abs is necessary because in certain obscure closed cosmologies\n        #  the distance modulus can be negative -- which is okay because\n        #  it enters as the square.\n        val = 5. * np.log10(abs(self.luminosity_distance(z).value)) + 25.0\n        return u.Quantity(val, u.mag)\n\n    def comoving_volume(self, z):\n        r\"\"\"Comoving volume in cubic Mpc at redshift ``z``.\n\n        This is the volume of the universe encompassed by redshifts less than\n        ``z``. For the case of :math:`\\Omega_k = 0` it is a sphere of radius\n        `comoving_distance` but it is less intuitive if :math:`\\Omega_k` is not.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        V : `~astropy.units.Quantity`\n            Comoving volume in :math:`Mpc^3` at each input redshift.\n        \"\"\"\n        Ok0 = self._Ok0\n        if Ok0 == 0:\n            return 4.0 / 3.0 * pi * self.comoving_distance(z) ** 3\n\n        dh = self._hubble_distance.value  # .value for speed\n        dm = self.comoving_transverse_distance(z).value\n        term1 = 4.0 * pi * dh ** 3 / (2.0 * Ok0) * u.Mpc ** 3\n        term2 = dm / dh * np.sqrt(1 + Ok0 * (dm / dh) ** 2)\n        term3 = sqrt(abs(Ok0)) * dm / dh\n\n        if Ok0 > 0:\n            return term1 * (term2 - 1. / sqrt(abs(Ok0)) * np.arcsinh(term3))\n        else:\n            return term1 * (term2 - 1. / sqrt(abs(Ok0)) * np.arcsin(term3))\n\n    def differential_comoving_volume(self, z):\n        \"\"\"Differential comoving volume at redshift z.\n\n        Useful for calculating the effective comoving volume.\n        For example, allows for integration over a comoving volume that has a\n        sensitivity function that changes with redshift. The total comoving\n        volume is given by integrating ``differential_comoving_volume`` to\n        redshift ``z`` and multiplying by a solid angle.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        dV : `~astropy.units.Quantity`\n            Differential comoving volume per redshift per steradian at each\n            input redshift.\n        \"\"\"\n        dm = self.comoving_transverse_distance(z)\n        return self._hubble_distance * (dm ** 2.0) / (self.efunc(z) << u.steradian)\n\n    def kpc_comoving_per_arcmin(self, z):\n        \"\"\"\n        Separation in transverse comoving kpc corresponding to an arcminute at\n        redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            The distance in comoving kpc corresponding to an arcmin at each\n            input redshift.\n        \"\"\"\n        return self.comoving_transverse_distance(z).to(u.kpc) / radian_in_arcmin\n\n    def kpc_proper_per_arcmin(self, z):\n        \"\"\"\n        Separation in transverse proper kpc corresponding to an arcminute at\n        redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            The distance in proper kpc corresponding to an arcmin at each input\n            redshift.\n        \"\"\"\n        return self.angular_diameter_distance(z).to(u.kpc) / radian_in_arcmin\n\n    def arcsec_per_kpc_comoving(self, z):\n        \"\"\"\n        Angular separation in arcsec corresponding to a comoving kpc at\n        redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        theta : `~astropy.units.Quantity` ['angle']\n            The angular separation in arcsec corresponding to a comoving kpc at\n            each input redshift.\n        \"\"\"\n        return radian_in_arcsec / self.comoving_transverse_distance(z).to(u.kpc)\n\n    def arcsec_per_kpc_proper(self, z):\n        \"\"\"\n        Angular separation in arcsec corresponding to a proper kpc at redshift\n        ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        theta : `~astropy.units.Quantity` ['angle']\n            The angular separation in arcsec corresponding to a proper kpc at\n            each input redshift.\n        \"\"\"\n        return radian_in_arcsec / self.angular_diameter_distance(z).to(u.kpc)\n\n\nclass FlatFLRWMixin(FlatCosmologyMixin):\n    \"\"\"\n    Mixin class for flat FLRW cosmologies. Do NOT instantiate directly.\n    Must precede the base class in the multiple-inheritance so that this\n    mixin's ``__init__`` proceeds the base class'.\n    Note that all instances of ``FlatFLRWMixin`` are flat, but not all\n    flat cosmologies are instances of ``FlatFLRWMixin``. As example,\n    ``LambdaCDM`` **may** be flat (for the a specific set of parameter values),\n    but ``FlatLambdaCDM`` **will** be flat.\n    \"\"\"\n\n    Ode0 = FLRW.Ode0.clone(derived=True)  # same as FLRW, but now a derived param.\n\n    def __init_subclass__(cls):\n        super().__init_subclass__()\n        if \"Ode0\" in cls._init_signature.parameters:\n            raise TypeError(\"subclasses of `FlatFLRWMixin` cannot have `Ode0` in `__init__`\")\n\n    def __init__(self, *args, **kw):\n        super().__init__(*args, **kw)  # guaranteed not to have `Ode0`\n        # Do some twiddling after the fact to get flatness\n        self._Ok0 = 0.0\n        self._Ode0 = 1.0 - (self._Om0 + self._Ogamma0 + self._Onu0 + self._Ok0)\n\n    @property\n    def Otot0(self):\n        \"\"\"Omega total; the total density/critical density at z=0.\"\"\"\n        return 1.0\n\n    def Otot(self, z):\n        \"\"\"The total density parameter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        Otot : ndarray or float\n            Returns float if input scalar. Value of 1.\n        \"\"\"\n        return 1.0 if isinstance(z, (Number, np.generic)) else np.ones_like(z, subok=False)\n\n    def __equiv__(self, other):\n        \"\"\"flat-FLRW equivalence. Use ``.is_equivalent()`` for actual check!\n\n        Parameters\n        ----------\n        other : `~astropy.cosmology.FLRW` subclass instance\n            The object in which to compare.\n\n        Returns\n        -------\n        bool or `NotImplemented`\n            `True` if 'other' is of the same class / non-flat class (e.g.\n            ``FlatLambdaCDM`` and ``LambdaCDM``) has matching parameters\n            and parameter values. `False` if 'other' is of the same class but\n            has different parameters. `NotImplemented` otherwise.\n        \"\"\"\n        # check if case (1): same class & parameters\n        if isinstance(other, FlatFLRWMixin):\n            return super().__equiv__(other)\n\n        # check cases (3, 4), if other is the non-flat version of this class\n        # this makes the assumption that any further subclass of a flat cosmo\n        # keeps the same physics.\n        comparable_classes = [c for c in self.__class__.mro()[1:]\n                              if (issubclass(c, FLRW) and c is not FLRW)]\n        if other.__class__ not in comparable_classes:\n            return NotImplemented\n\n        # check if have equivalent parameters\n        # check all parameters in other match those in 'self' and 'other' has\n        # no extra parameters (case (2)) except for 'Ode0' and that other\n        params_eq = (\n            set(self.__all_parameters__) == set(other.__all_parameters__) # no extra\n            and all(np.all(getattr(self, k) == getattr(other, k))  # equal\n                    for k in self.__parameters__)\n            and other.is_flat\n        )\n\n        return params_eq\n\n\nclass LambdaCDM(FLRW):\n    \"\"\"FLRW cosmology with a cosmological constant and curvature.\n\n    This has no additional attributes beyond those of FLRW.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0.  If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Ode0 : float\n        Omega dark energy: density of the cosmological constant in units of\n        the critical density at z=0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import LambdaCDM\n    >>> cosmo = LambdaCDM(H0=70, Om0=0.3, Ode0=0.7)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n    \"\"\"\n\n    def __init__(self, H0, Om0, Ode0, Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV,\n                 Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=Ode0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.lcdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0)\n            if self._Ok0 == 0:\n                self._optimize_flat_norad()\n            else:\n                self._comoving_distance_z1z2 = self._elliptic_comoving_distance_z1z2\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.lcdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0 + self._Onu0)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.lcdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list)\n\n    def _optimize_flat_norad(self):\n        \"\"\"Set optimizations for flat LCDM cosmologies with no radiation.\"\"\"\n        # Call out the Om0=0 (de Sitter) and Om0=1 (Einstein-de Sitter)\n        # The dS case is required because the hypergeometric case\n        #    for Omega_M=0 would lead to an infinity in its argument.\n        # The EdS case is three times faster than the hypergeometric.\n        if self._Om0 == 0:\n            self._comoving_distance_z1z2 = self._dS_comoving_distance_z1z2\n            self._age = self._dS_age\n            self._lookback_time = self._dS_lookback_time\n        elif self._Om0 == 1:\n            self._comoving_distance_z1z2 = self._EdS_comoving_distance_z1z2\n            self._age = self._EdS_age\n            self._lookback_time = self._EdS_lookback_time\n        else:\n            self._comoving_distance_z1z2 = self._hypergeometric_comoving_distance_z1z2\n            self._age = self._flat_age\n            self._lookback_time = self._flat_lookback_time\n\n    def w(self, z):\n        r\"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is :math:`w(z) = -1`.\n        \"\"\"\n        z = aszarr(z)\n        return -1.0 * (np.ones(z.shape) if hasattr(z, \"shape\") else 1.0)\n\n    def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by :math:`I = 1`.\n        \"\"\"\n        z = aszarr(z)\n        return np.ones(z.shape) if hasattr(z, \"shape\") else 1.0\n\n    def _elliptic_comoving_distance_z1z2(self, z1, z2):\n        r\"\"\"Comoving transverse distance in Mpc between two redshifts.\n\n        This value is the transverse comoving distance at redshift ``z``\n        corresponding to an angular separation of 1 radian. This is the same as\n        the comoving distance if :math:`\\Omega_k` is zero.\n\n        For :math:`\\Omega_{rad} = 0` the comoving distance can be directly\n        calculated as an elliptic integral [1]_.\n\n        Not valid or appropriate for flat cosmologies (Ok0=0).\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n\n        References\n        ----------\n        .. [1] Kantowski, R., Kao, J., & Thomas, R. (2000). Distance-Redshift\n               in Inhomogeneous FLRW. arXiv e-prints, astro-ph/0002334.\n        \"\"\"\n        try:\n            z1, z2 = np.broadcast_arrays(z1, z2)\n        except ValueError as e:\n            raise ValueError(\"z1 and z2 have different shapes\") from e\n\n        # The analytic solution is not valid for any of Om0, Ode0, Ok0 == 0.\n        # Use the explicit integral solution for these cases.\n        if self._Om0 == 0 or self._Ode0 == 0 or self._Ok0 == 0:\n            return self._integral_comoving_distance_z1z2(z1, z2)\n\n        b = -(27. / 2) * self._Om0**2 * self._Ode0 / self._Ok0**3\n        kappa = b / abs(b)\n        if (b < 0) or (2 < b):\n            def phi_z(Om0, Ok0, kappa, y1, A, z):\n                return np.arccos(((z + 1.0) * Om0 / abs(Ok0) + kappa * y1 - A) /\n                                 ((z + 1.0) * Om0 / abs(Ok0) + kappa * y1 + A))\n\n            v_k = pow(kappa * (b - 1) + sqrt(b * (b - 2)), 1. / 3)\n            y1 = (-1 + kappa * (v_k + 1 / v_k)) / 3\n            A = sqrt(y1 * (3 * y1 + 2))\n            g = 1 / sqrt(A)\n            k2 = (2 * A + kappa * (1 + 3 * y1)) / (4 * A)\n\n            phi_z1 = phi_z(self._Om0, self._Ok0, kappa, y1, A, z1)\n            phi_z2 = phi_z(self._Om0, self._Ok0, kappa, y1, A, z2)\n        # Get lower-right 0<b<2 solution in Om0, Ode0 plane.\n        # Fot the upper-left 0<b<2 solution the Big Bang didn't happen.\n        elif (0 < b) and (b < 2) and self._Om0 > self._Ode0:\n            def phi_z(Om0, Ok0, y1, y2, z):\n                return np.arcsin(np.sqrt((y1 - y2) /\n                                         ((z + 1.0) * Om0 / abs(Ok0) + y1)))\n\n            yb = cos(acos(1 - b) / 3)\n            yc = sqrt(3) * sin(acos(1 - b) / 3)\n            y1 = (1. / 3) * (-1 + yb + yc)\n            y2 = (1. / 3) * (-1 - 2 * yb)\n            y3 = (1. / 3) * (-1 + yb - yc)\n            g = 2 / sqrt(y1 - y2)\n            k2 = (y1 - y3) / (y1 - y2)\n            phi_z1 = phi_z(self._Om0, self._Ok0, y1, y2, z1)\n            phi_z2 = phi_z(self._Om0, self._Ok0, y1, y2, z2)\n        else:\n            return self._integral_comoving_distance_z1z2(z1, z2)\n\n        prefactor = self._hubble_distance / sqrt(abs(self._Ok0))\n        return prefactor * g * (ellipkinc(phi_z1, k2) - ellipkinc(phi_z2, k2))\n\n    def _dS_comoving_distance_z1z2(self, z1, z2):\n        r\"\"\"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2`` in a flat, :math:`\\Omega_{\\Lambda}=1` cosmology\n        (de Sitter).\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        The de Sitter case has an analytic solution.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts. Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n        \"\"\"\n        try:\n            z1, z2 = np.broadcast_arrays(z1, z2)\n        except ValueError as e:\n            raise ValueError(\"z1 and z2 have different shapes\") from e\n\n        return self._hubble_distance * (z2 - z1)\n\n    def _EdS_comoving_distance_z1z2(self, z1, z2):\n        r\"\"\"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2`` in a flat, :math:`\\Omega_M=1` cosmology\n        (Einstein - de Sitter).\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        For :math:`\\Omega_M=1`, :math:`\\Omega_{rad}=0` the comoving distance\n        has an analytic solution.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts. Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n        \"\"\"\n        try:\n            z1, z2 = np.broadcast_arrays(z1, z2)\n        except ValueError as e:\n            raise ValueError(\"z1 and z2 have different shapes\") from e\n\n        prefactor = 2 * self._hubble_distance\n        return prefactor * ((z1 + 1.0)**(-1./2) - (z2 + 1.0)**(-1./2))\n\n    def _hypergeometric_comoving_distance_z1z2(self, z1, z2):\n        r\"\"\"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2``.\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        For :math:`\\Omega_{rad} = 0` the comoving distance can be directly\n        calculated as a hypergeometric function [1]_.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n\n        References\n        ----------\n        .. [1] Baes, M., Camps, P., & Van De Putte, D. (2017). Analytical\n               expressions and numerical evaluation of the luminosity distance\n               in a flat cosmology. MNRAS, 468(1), 927-930.\n        \"\"\"\n        try:\n            z1, z2 = np.broadcast_arrays(z1, z2)\n        except ValueError as e:\n            raise ValueError(\"z1 and z2 have different shapes\") from e\n\n        s = ((1 - self._Om0) / self._Om0) ** (1./3)\n        # Use np.sqrt here to handle negative s (Om0>1).\n        prefactor = self._hubble_distance / np.sqrt(s * self._Om0)\n        return prefactor * (self._T_hypergeometric(s / (z1 + 1.0)) -\n                            self._T_hypergeometric(s / (z2 + 1.0)))\n\n    def _T_hypergeometric(self, x):\n        r\"\"\"Compute value using Gauss Hypergeometric function 2F1.\n\n        .. math::\n\n           T(x) = 2 \\sqrt(x) _{2}F_{1}\\left(\\frac{1}{6}, \\frac{1}{2};\n                                            \\frac{7}{6}; -x^3 \\right)\n\n        Notes\n        -----\n        The :func:`scipy.special.hyp2f1` code already implements the\n        hypergeometric transformation suggested by Baes et al. [1]_ for use in\n        actual numerical evaulations.\n\n        References\n        ----------\n        .. [1] Baes, M., Camps, P., & Van De Putte, D. (2017). Analytical\n           expressions and numerical evaluation of the luminosity distance\n           in a flat cosmology. MNRAS, 468(1), 927-930.\n        \"\"\"\n        return 2 * np.sqrt(x) * hyp2f1(1./6, 1./2, 7./6, -x**3)\n\n    def _dS_age(self, z):\n        \"\"\"Age of the universe in Gyr at redshift ``z``.\n\n        The age of a de Sitter Universe is infinite.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n        \"\"\"\n        t = (inf if isinstance(z, Number) else np.full_like(z, inf, dtype=float))\n        return self._hubble_time * t\n\n    def _EdS_age(self, z):\n        r\"\"\"Age of the universe in Gyr at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated as an elliptic integral [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n\n        References\n        ----------\n        .. [1] Thomas, R., & Kantowski, R. (2000). Age-redshift relation for\n               standard cosmology. PRD, 62(10), 103507.\n        \"\"\"\n        return (2./3) * self._hubble_time * (aszarr(z) + 1.0) ** (-1.5)\n\n    def _flat_age(self, z):\n        r\"\"\"Age of the universe in Gyr at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated as an elliptic integral [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n\n        References\n        ----------\n        .. [1] Thomas, R., & Kantowski, R. (2000). Age-redshift relation for\n               standard cosmology. PRD, 62(10), 103507.\n        \"\"\"\n        # Use np.sqrt, np.arcsinh instead of math.sqrt, math.asinh\n        # to handle properly the complex numbers for 1 - Om0 < 0\n        prefactor = (2./3) * self._hubble_time / np.emath.sqrt(1 - self._Om0)\n        arg = np.arcsinh(np.emath.sqrt((1 / self._Om0 - 1 + 0j) / (aszarr(z) + 1.0)**3))\n        return (prefactor * arg).real\n\n    def _EdS_lookback_time(self, z):\n        r\"\"\"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated as an elliptic integral.\n        The lookback time is here calculated based on the ``age(0) - age(z)``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n        \"\"\"\n        return self._EdS_age(0) - self._EdS_age(z)\n\n    def _dS_lookback_time(self, z):\n        r\"\"\"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated.\n\n        .. math::\n\n           a = exp(H * t) \\  \\text{where t=0 at z=0}\n\n           t = (1/H) (ln 1 - ln a) = (1/H) (0 - ln (1/(1+z))) = (1/H) ln(1+z)\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n        \"\"\"\n        return self._hubble_time * np.log(aszarr(z) + 1.0)\n\n    def _flat_lookback_time(self, z):\n        r\"\"\"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated.\n        The lookback time is here calculated based on the ``age(0) - age(z)``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n        \"\"\"\n        return self._flat_age(0) - self._flat_age(z)\n\n    def efunc(self, z):\n        \"\"\"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        \"\"\"\n        # We override this because it takes a particularly simple\n        # form for a cosmological constant\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) + self._Ode0)\n\n    def inv_efunc(self, z):\n        r\"\"\"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The inverse redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return (zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) + self._Ode0)**(-0.5)\n\n\nclass FlatLambdaCDM(FlatFLRWMixin, LambdaCDM):\n    \"\"\"FLRW cosmology with a cosmological constant and no curvature.\n\n    This has no additional attributes beyond those of FLRW.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import FlatLambdaCDM\n    >>> cosmo = FlatLambdaCDM(H0=70, Om0=0.3)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n    \"\"\"\n\n    def __init__(self, H0, Om0, Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV,\n                 Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=0.0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.flcdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0)\n            # Repeat the optimization reassignments here because the init\n            # of the LambaCDM above didn't actually create a flat cosmology.\n            # That was done through the explicit tweak setting self._Ok0.\n            self._optimize_flat_norad()\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.flcdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0 + self._Onu0)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.flcdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list)\n\n    def efunc(self, z):\n        \"\"\"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        \"\"\"\n        # We override this because it takes a particularly simple\n        # form for a cosmological constant\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return np.sqrt(zp1 ** 3 * (Or * zp1 + self._Om0) + self._Ode0)\n\n    def inv_efunc(self, z):\n        r\"\"\"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The inverse redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n        return (zp1 ** 3 * (Or * zp1 + self._Om0) + self._Ode0)**(-0.5)\n\n\nclass wCDM(FLRW):\n    \"\"\"\n    FLRW cosmology with a constant dark energy equation of state and curvature.\n\n    This has one additional attribute beyond those of FLRW.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Ode0 : float\n        Omega dark energy: density of dark energy in units of the critical\n        density at z=0.\n\n    w0 : float, optional\n        Dark energy equation of state at all redshifts. This is\n        pressure/density for dark energy in units where c=1. A cosmological\n        constant has w0=-1.0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import wCDM\n    >>> cosmo = wCDM(H0=70, Om0=0.3, Ode0=0.7, w0=-0.9)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n    \"\"\"\n\n    w0 = Parameter(doc=\"Dark energy equation of state.\", fvalidate=\"float\")\n\n    def __init__(self, H0, Om0, Ode0, w0=-1.0, Tcmb0=0.0*u.K, Neff=3.04,\n                 m_nu=0.0*u.eV, Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=Ode0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n        self.w0 = w0\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wcdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._w0)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wcdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._w0)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wcdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._w0)\n\n    def w(self, z):\n        r\"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is :math:`w(z) = w_0`.\n        \"\"\"\n        z = aszarr(z)\n        return self._w0 * (np.ones(z.shape) if hasattr(z, \"shape\") else 1.0)\n\n    def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by\n        :math:`I = \\left(1 + z\\right)^{3\\left(1 + w_0\\right)}`\n        \"\"\"\n        return (aszarr(z) + 1.0) ** (3.0 * (1. + self._w0))\n\n    def efunc(self, z):\n        \"\"\"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) +\n                       self._Ode0 * zp1 ** (3. * (1. + self._w0)))\n\n    def inv_efunc(self, z):\n        r\"\"\"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The inverse redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return (zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) +\n                self._Ode0 * zp1 ** (3. * (1. + self._w0)))**(-0.5)\n\n\nclass FlatwCDM(FlatFLRWMixin, wCDM):\n    \"\"\"\n    FLRW cosmology with a constant dark energy equation of state and no spatial\n    curvature.\n\n    This has one additional attribute beyond those of FLRW.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    w0 : float, optional\n        Dark energy equation of state at all redshifts. This is\n        pressure/density for dark energy in units where c=1. A cosmological\n        constant has w0=-1.0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import FlatwCDM\n    >>> cosmo = FlatwCDM(H0=70, Om0=0.3, w0=-0.9)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n    \"\"\"\n\n    def __init__(self, H0, Om0, w0=-1.0, Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV,\n                 Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=0.0, w0=w0, Tcmb0=Tcmb0,\n                         Neff=Neff, m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fwcdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._w0)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fwcdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._w0)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fwcdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._w0)\n\n    def efunc(self, z):\n        \"\"\"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return np.sqrt(zp1 ** 3 * (Or * zp1 + self._Om0) +\n                       self._Ode0 * zp1 ** (3. * (1 + self._w0)))\n\n    def inv_efunc(self, z):\n        r\"\"\"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The inverse redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return (zp1 ** 3 * (Or * zp1 + self._Om0) +\n                self._Ode0 * zp1 ** (3. * (1. + self._w0)))**(-0.5)\n\n\nclass w0waCDM(FLRW):\n    r\"\"\"FLRW cosmology with a CPL dark energy equation of state and curvature.\n\n    The equation for the dark energy equation of state uses the\n    CPL form as described in Chevallier & Polarski [1]_ and Linder [2]_:\n    :math:`w(z) = w_0 + w_a (1-a) = w_0 + w_a z / (1+z)`.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Ode0 : float\n        Omega dark energy: density of dark energy in units of the critical\n        density at z=0.\n\n    w0 : float, optional\n        Dark energy equation of state at z=0 (a=1). This is pressure/density\n        for dark energy in units where c=1.\n\n    wa : float, optional\n        Negative derivative of the dark energy equation of state with respect\n        to the scale factor. A cosmological constant has w0=-1.0 and wa=0.0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import w0waCDM\n    >>> cosmo = w0waCDM(H0=70, Om0=0.3, Ode0=0.7, w0=-0.9, wa=0.2)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n\n    References\n    ----------\n    .. [1] Chevallier, M., & Polarski, D. (2001). Accelerating Universes with\n           Scaling Dark Matter. International Journal of Modern Physics D,\n           10(2), 213-223.\n    .. [2] Linder, E. (2003). Exploring the Expansion History of the\n           Universe. Phys. Rev. Lett., 90, 091301.\n    \"\"\"\n\n    w0 = Parameter(doc=\"Dark energy equation of state at z=0.\", fvalidate=\"float\")\n    wa = Parameter(doc=\"Negative derivative of dark energy equation of state w.r.t. a.\",\n                   fvalidate=\"float\")\n\n    def __init__(self, H0, Om0, Ode0, w0=-1.0, wa=0.0, Tcmb0=0.0*u.K, Neff=3.04,\n                 m_nu=0.0*u.eV, Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=Ode0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n        self.w0 = w0\n        self.wa = wa\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wacdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._w0, self._wa)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wacdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._w0, self._wa)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wacdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._w0,\n                                           self._wa)\n\n    def w(self, z):\n        r\"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is\n        :math:`w(z) = w_0 + w_a (1 - a) = w_0 + w_a \\frac{z}{1+z}`.\n        \"\"\"\n        z = aszarr(z)\n        return self._w0 + self._wa * z / (z + 1.0)\n\n    def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by\n\n        .. math::\n\n           I = \\left(1 + z\\right)^{3 \\left(1 + w_0 + w_a\\right)}\n                     \\exp \\left(-3 w_a \\frac{z}{1+z}\\right)\n        \"\"\"\n        z = aszarr(z)\n        zp1 = z + 1.0  # (converts z [unit] -> z [dimensionless])\n        return zp1 ** (3 * (1 + self._w0 + self._wa)) * np.exp(-3 * self._wa * z / zp1)\n\n\nclass Flatw0waCDM(FlatFLRWMixin, w0waCDM):\n    \"\"\"FLRW cosmology with a CPL dark energy equation of state and no\n    curvature.\n\n    The equation for the dark energy equation of state uses the CPL form as\n    described in Chevallier & Polarski [1]_ and Linder [2]_:\n    :math:`w(z) = w_0 + w_a (1-a) = w_0 + w_a z / (1+z)`.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    w0 : float, optional\n        Dark energy equation of state at z=0 (a=1). This is pressure/density\n        for dark energy in units where c=1.\n\n    wa : float, optional\n        Negative derivative of the dark energy equation of state with respect\n        to the scale factor. A cosmological constant has w0=-1.0 and wa=0.0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import Flatw0waCDM\n    >>> cosmo = Flatw0waCDM(H0=70, Om0=0.3, w0=-0.9, wa=0.2)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n\n    References\n    ----------\n    .. [1] Chevallier, M., & Polarski, D. (2001). Accelerating Universes with\n           Scaling Dark Matter. International Journal of Modern Physics D,\n           10(2), 213-223.\n    .. [2] Linder, E. (2003). Exploring the Expansion History of the\n           Universe. Phys. Rev. Lett., 90, 091301.\n    \"\"\"\n\n    def __init__(self, H0, Om0, w0=-1.0, wa=0.0, Tcmb0=0.0*u.K, Neff=3.04,\n                 m_nu=0.0*u.eV, Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=0.0, w0=w0, wa=wa, Tcmb0=Tcmb0,\n                         Neff=Neff, m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fw0wacdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._w0, self._wa)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fw0wacdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._w0, self._wa)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fw0wacdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._w0,\n                                           self._wa)\n\n\nclass wpwaCDM(FLRW):\n    r\"\"\"\n    FLRW cosmology with a CPL dark energy equation of state, a pivot redshift,\n    and curvature.\n\n    The equation for the dark energy equation of state uses the CPL form as\n    described in Chevallier & Polarski [1]_ and Linder [2]_, but modified to\n    have a pivot redshift as in the findings of the Dark Energy Task Force\n    [3]_: :math:`w(a) = w_p + w_a (a_p - a) = w_p + w_a( 1/(1+zp) - 1/(1+z) )`.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Ode0 : float\n        Omega dark energy: density of dark energy in units of the critical\n        density at z=0.\n\n    wp : float, optional\n        Dark energy equation of state at the pivot redshift zp. This is\n        pressure/density for dark energy in units where c=1.\n\n    wa : float, optional\n        Negative derivative of the dark energy equation of state with respect\n        to the scale factor. A cosmological constant has wp=-1.0 and wa=0.0.\n\n    zp : float or quantity-like ['redshift'], optional\n        Pivot redshift -- the redshift where w(z) = wp\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import wpwaCDM\n    >>> cosmo = wpwaCDM(H0=70, Om0=0.3, Ode0=0.7, wp=-0.9, wa=0.2, zp=0.4)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n\n    References\n    ----------\n    .. [1] Chevallier, M., & Polarski, D. (2001). Accelerating Universes with\n           Scaling Dark Matter. International Journal of Modern Physics D,\n           10(2), 213-223.\n    .. [2] Linder, E. (2003). Exploring the Expansion History of the\n           Universe. Phys. Rev. Lett., 90, 091301.\n    .. [3] Albrecht, A., Amendola, L., Bernstein, G., Clowe, D., Eisenstein,\n           D., Guzzo, L., Hirata, C., Huterer, D., Kirshner, R., Kolb, E., &\n           Nichol, R. (2009). Findings of the Joint Dark Energy Mission Figure\n           of Merit Science Working Group. arXiv e-prints, arXiv:0901.0721.\n    \"\"\"\n\n    wp = Parameter(doc=\"Dark energy equation of state at the pivot redshift zp.\", fvalidate=\"float\")\n    wa = Parameter(doc=\"Negative derivative of dark energy equation of state w.r.t. a.\",\n                   fvalidate=\"float\")\n    zp = Parameter(doc=\"The pivot redshift, where w(z) = wp.\", unit=cu.redshift)\n\n    def __init__(self, H0, Om0, Ode0, wp=-1.0, wa=0.0, zp=0.0 * cu.redshift,\n                 Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV, Ob0=None, *,\n                 name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=Ode0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n        self.wp = wp\n        self.wa = wa\n        self.zp = zp\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        apiv = 1.0 / (1.0 + self._zp.value)\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wpwacdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._wp, apiv, self._wa)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wpwacdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._wp, apiv, self._wa)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wpwacdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._wp,\n                                           apiv, self._wa)\n\n    def w(self, z):\n        r\"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is :math:`w(z) = w_p + w_a (a_p - a)` where\n        :math:`a = 1/1+z` and :math:`a_p = 1 / 1 + z_p`.\n        \"\"\"\n        apiv = 1.0 / (1.0 + self._zp.value)\n        return self._wp + self._wa * (apiv - 1.0 / (aszarr(z) + 1.0))\n\n    def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by\n\n        .. math::\n\n           a_p = \\frac{1}{1 + z_p}\n\n           I = \\left(1 + z\\right)^{3 \\left(1 + w_p + a_p w_a\\right)}\n                     \\exp \\left(-3 w_a \\frac{z}{1+z}\\right)\n        \"\"\"\n        z = aszarr(z)\n        zp1 = z + 1.0  # (converts z [unit] -> z [dimensionless])\n        apiv = 1. / (1. + self._zp.value)\n        return zp1 ** (3. * (1. + self._wp + apiv * self._wa)) * \\\n            np.exp(-3. * self._wa * z / zp1)\n\n\nclass w0wzCDM(FLRW):\n    \"\"\"\n    FLRW cosmology with a variable dark energy equation of state and curvature.\n\n    The equation for the dark energy equation of state uses the simple form:\n    :math:`w(z) = w_0 + w_z z`.\n\n    This form is not recommended for z > 1.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Ode0 : float\n        Omega dark energy: density of dark energy in units of the critical\n        density at z=0.\n\n    w0 : float, optional\n        Dark energy equation of state at z=0. This is pressure/density for\n        dark energy in units where c=1.\n\n    wz : float, optional\n        Derivative of the dark energy equation of state with respect to z.\n        A cosmological constant has w0=-1.0 and wz=0.0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import w0wzCDM\n    >>> cosmo = w0wzCDM(H0=70, Om0=0.3, Ode0=0.7, w0=-0.9, wz=0.2)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n    \"\"\"\n\n    w0 = Parameter(doc=\"Dark energy equation of state at z=0.\", fvalidate=\"float\")\n    wz = Parameter(doc=\"Derivative of the dark energy equation of state w.r.t. z.\", fvalidate=\"float\")\n\n    def __init__(self, H0, Om0, Ode0, w0=-1.0, wz=0.0, Tcmb0=0.0*u.K, Neff=3.04,\n                 m_nu=0.0*u.eV, Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=Ode0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n        self.w0 = w0\n        self.wz = wz\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wzcdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._w0, self._wz)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wzcdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._w0, self._wz)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wzcdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._w0,\n                                           self._wz)\n\n    def w(self, z):\n        r\"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is given by :math:`w(z) = w_0 + w_z z`.\n        \"\"\"\n        return self._w0 + self._wz * aszarr(z)\n\n    def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by\n\n        .. math::\n\n           I = \\left(1 + z\\right)^{3 \\left(1 + w_0 - w_z\\right)}\n                     \\exp \\left(-3 w_z z\\right)\n        \"\"\"\n        z = aszarr(z)\n        zp1 = z + 1.0  # (converts z [unit] -> z [dimensionless])\n        return zp1 ** (3. * (1. + self._w0 - self._wz)) * np.exp(-3. * self._wz * z)\n"},{"attributeType":"IAU2015","col":4,"comment":"null","endLoc":32,"id":13923,"name":"M_jup","nodeType":"Attribute","startLoc":32,"text":"M_jup"},{"col":4,"comment":"\n        Set ``cov_matrix`` and ``stds`` attributes on model with parameter\n        covariance matrix returned by ``optimize.leastsq``.\n        ","endLoc":1102,"header":"@staticmethod\n    def _add_fitting_uncertainties(model, cov_matrix)","id":13924,"name":"_add_fitting_uncertainties","nodeType":"Function","startLoc":1091,"text":"@staticmethod\n    def _add_fitting_uncertainties(model, cov_matrix):\n        \"\"\"\n        Set ``cov_matrix`` and ``stds`` attributes on model with parameter\n        covariance matrix returned by ``optimize.leastsq``.\n        \"\"\"\n\n        free_param_names = [x for x in model.fixed if (model.fixed[x] is False)\n                            and (model.tied[x] is False)]\n\n        model.cov_matrix = Covariance(cov_matrix, free_param_names)\n        model.stds = StandardDeviations(cov_matrix, free_param_names)"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":81,"id":13925,"name":"muB","nodeType":"Attribute","startLoc":81,"text":"muB"},{"attributeType":"IAU2015","col":4,"comment":"null","endLoc":39,"id":13926,"name":"M_earth","nodeType":"Attribute","startLoc":39,"text":"M_earth"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":84,"id":13927,"name":"alpha","nodeType":"Attribute","startLoc":84,"text":"alpha"},{"col":0,"comment":"","endLoc":6,"header":"astropyconst20.py#<anonymous>","id":13928,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nAstronomical and physics constants for Astropy v2.0.\nSee :mod:`astropy.constants` for a complete listing of constants defined\nin Astropy.\n\"\"\"\n\ncodata = codata2014\n\niaudata = iau2015\n\n_utils._set_c(codata, iaudata, find_current_module())\n\nwith warnings.catch_warnings():\n    warnings.filterwarnings('ignore', 'Constant .*already has a definition')\n\n    # Solar mass (derived from mass parameter and gravitational constant)\n    M_sun = iau2015.IAU2015(\n        'M_sun', \"Solar mass\", iau2015.GM_sun.value / codata2014.G.value,\n        'kg', ((codata2014.G.uncertainty / codata2014.G.value) *\n               (iau2015.GM_sun.value / codata2014.G.value)),\n        f\"IAU 2015 Resolution B 3 + {codata2014.G.reference}\", system='si')\n\n    # Jupiter mass (derived from mass parameter and gravitational constant)\n    M_jup = iau2015.IAU2015(\n        'M_jup', \"Jupiter mass\", iau2015.GM_jup.value / codata2014.G.value,\n        'kg', ((codata2014.G.uncertainty / codata2014.G.value) *\n               (iau2015.GM_jup.value / codata2014.G.value)),\n        f\"IAU 2015 Resolution B 3 + {codata2014.G.reference}\", system='si')\n\n    # Earth mass (derived from mass parameter and gravitational constant)\n    M_earth = iau2015.IAU2015(\n        'M_earth', \"Earth mass\",\n        iau2015.GM_earth.value / codata2014.G.value,\n        'kg', ((codata2014.G.uncertainty / codata2014.G.value) *\n               (iau2015.GM_earth.value / codata2014.G.value)),\n        f\"IAU 2015 Resolution B 3 + {codata2014.G.reference}\", system='si')\n\ndel warnings\n\ndel find_current_module\n\ndel _utils"},{"col":4,"comment":"\n        Fit data to this model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            model to fit to x, y, z\n        x : array\n           input coordinates\n        y : array\n           input coordinates\n        z : array, optional\n           input coordinates\n        weights : array, optional\n            Weights for fitting.\n            For data with Gaussian uncertainties, the weights should be\n            1/sigma.\n        maxiter : int\n            maximum number of iterations\n        acc : float\n            Relative error desired in the approximate solution\n        epsilon : float\n            A suitable step length for the forward-difference\n            approximation of the Jacobian (if model.fjac=None). If\n            epsfcn is less than the machine precision, it is\n            assumed that the relative errors in the functions are\n            of the order of the machine precision.\n        estimate_jacobian : bool\n            If False (default) and if the model has a fit_deriv method,\n            it will be used. Otherwise the Jacobian will be estimated.\n            If True, the Jacobian will be estimated in any case.\n        equivalencies : list or None, optional, keyword-only\n            List of *additional* equivalencies that are should be applied in\n            case x, y and/or z have units. Default is None.\n\n        Returns\n        -------\n        model_copy : `~astropy.modeling.FittableModel`\n            a copy of the input model with parameters set by the fitter\n\n        ","endLoc":1188,"header":"@fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None,\n                 maxiter=DEFAULT_MAXITER, acc=DEFAULT_ACC,\n                 epsilon=DEFAULT_EPS, estimate_jacobian=False)","id":13929,"name":"__call__","nodeType":"Function","startLoc":1104,"text":"@fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None,\n                 maxiter=DEFAULT_MAXITER, acc=DEFAULT_ACC,\n                 epsilon=DEFAULT_EPS, estimate_jacobian=False):\n        \"\"\"\n        Fit data to this model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            model to fit to x, y, z\n        x : array\n           input coordinates\n        y : array\n           input coordinates\n        z : array, optional\n           input coordinates\n        weights : array, optional\n            Weights for fitting.\n            For data with Gaussian uncertainties, the weights should be\n            1/sigma.\n        maxiter : int\n            maximum number of iterations\n        acc : float\n            Relative error desired in the approximate solution\n        epsilon : float\n            A suitable step length for the forward-difference\n            approximation of the Jacobian (if model.fjac=None). If\n            epsfcn is less than the machine precision, it is\n            assumed that the relative errors in the functions are\n            of the order of the machine precision.\n        estimate_jacobian : bool\n            If False (default) and if the model has a fit_deriv method,\n            it will be used. Otherwise the Jacobian will be estimated.\n            If True, the Jacobian will be estimated in any case.\n        equivalencies : list or None, optional, keyword-only\n            List of *additional* equivalencies that are should be applied in\n            case x, y and/or z have units. Default is None.\n\n        Returns\n        -------\n        model_copy : `~astropy.modeling.FittableModel`\n            a copy of the input model with parameters set by the fitter\n\n        \"\"\"\n\n        from scipy import optimize\n\n        model_copy = _validate_model(model, self.supported_constraints)\n        model_copy.sync_constraints = False\n        farg = (model_copy, weights, ) + _convert_input(x, y, z)\n        if model_copy.fit_deriv is None or estimate_jacobian:\n            dfunc = None\n        else:\n            dfunc = self._wrap_deriv\n        init_values, _ = model_to_fit_params(model_copy)\n        fitparams, cov_x, dinfo, mess, ierr = optimize.leastsq(\n            self.objective_function, init_values, args=farg, Dfun=dfunc,\n            col_deriv=model_copy.col_fit_deriv, maxfev=maxiter, epsfcn=epsilon,\n            xtol=acc, full_output=True)\n        fitter_to_model_params(model_copy, fitparams)\n        self.fit_info.update(dinfo)\n        self.fit_info['cov_x'] = cov_x\n        self.fit_info['message'] = mess\n        self.fit_info['ierr'] = ierr\n        if ierr not in [1, 2, 3, 4]:\n            warnings.warn(\"The fit may be unsuccessful; check \"\n                          \"fit_info['message'] for more information.\",\n                          AstropyUserWarning)\n\n        # now try to compute the true covariance matrix\n        if (len(y) > len(init_values)) and cov_x is not None:\n            sum_sqrs = np.sum(self.objective_function(fitparams, *farg)**2)\n            dof = len(y) - len(init_values)\n            self.fit_info['param_cov'] = cov_x * sum_sqrs / dof\n        else:\n            self.fit_info['param_cov'] = None\n\n        if self._calc_uncertainties is True:\n            if self.fit_info['param_cov'] is not None:\n                self._add_fitting_uncertainties(model_copy,\n                                               self.fit_info['param_cov'])\n\n        model_copy.sync_constraints = True\n        return model_copy"},{"col":0,"comment":"\n    Check that model and fitter are compatible and return a copy of the model.\n    ","endLoc":1742,"header":"def _validate_model(model, supported_constraints)","id":13930,"name":"_validate_model","nodeType":"Function","startLoc":1724,"text":"def _validate_model(model, supported_constraints):\n    \"\"\"\n    Check that model and fitter are compatible and return a copy of the model.\n    \"\"\"\n\n    if not model.fittable:\n        raise ValueError(\"Model does not appear to be fittable.\")\n    if model.linear:\n        warnings.warn('Model is linear in parameters; '\n                      'consider using linear fitting methods.',\n                      AstropyUserWarning)\n    elif len(model) != 1:\n        # for now only single data sets ca be fitted\n        raise ValueError(\"Non-linear fitters can only fit \"\n                         \"one data set at a time.\")\n    _validate_constraints(supported_constraints, model)\n\n    model_copy = model.copy()\n    return model_copy"},{"id":13931,"name":"scalar_inv_efuncs.pyx","nodeType":"TextFile","path":"astropy/cosmology","text":"#cython: language_level=3, boundscheck=False\n\"\"\" Cython inverse efuncs for cosmology integrals\"\"\"\n\ncimport cython\nfrom libc.math cimport exp, pow\n\n## Inverse efunc methods for various dark energy subclasses\n## These take only scalar arguments since that is what the integral\n## routines give them.\n\n## Implementation notes:\n##  * Using a python list for nu_y seems to be faster than a ndarray,\n##     given that nu_y generally has a small number of elements,\n##     even when you turn off bounds checking, etc.\n##  * Using pow(x, -0.5) is slightly faster than x**(-0.5) and\n##    even more so than 1.0 / sqrt(x)\n##  * Hardwiring in the p, 1/p, k, prefac values in nufunc is\n##       nontrivially faster than declaring them with cdef\n\n######### LambdaCDM\n# No relativistic species\ndef lcdm_inv_efunc_norel(double z, double Om0, double Ode0, double Ok0):\n  cdef double opz = 1.0 + z\n  return pow(opz**2 * (opz * Om0 + Ok0) + Ode0, -0.5)\n\n# Massless neutrinos\ndef lcdm_inv_efunc_nomnu(double z, double Om0, double Ode0, double Ok0,\n    double Or0):\n  cdef double opz = 1.0 + z\n  return pow((((opz * Or0 + Om0) * opz) + Ok0) * opz**2 + Ode0, -0.5)\n\n# With massive neutrinos\ndef lcdm_inv_efunc(double z, double Om0, double Ode0, double Ok0,\n    double Ogamma0, double NeffPerNu, int nmasslessnu, list nu_y):\n\n  cdef double opz = 1.0 + z\n  cdef double Or0 = Ogamma0 * (1.0 + nufunc(opz, NeffPerNu, nmasslessnu, nu_y))\n  return pow((((opz * Or0 + Om0) * opz) + Ok0) * opz**2 + Ode0, -0.5)\n\n######## FlatLambdaCDM\n# No relativistic species\ndef flcdm_inv_efunc_norel(double z, double Om0, double Ode0):\n  return pow((1. + z)**3 * Om0 + Ode0, -0.5)\n\n# Massless neutrinos\ndef flcdm_inv_efunc_nomnu(double z, double Om0, double Ode0, double Or0):\n  cdef double opz = 1.0 + z\n  return pow(opz**3 * (opz * Or0 + Om0) + Ode0, -0.5)\n\n# With massive neutrinos\ndef flcdm_inv_efunc(double z, double Om0, double Ode0, double Ogamma0,\n    double NeffPerNu, int nmasslessnu, list nu_y):\n\n  cdef double opz = 1.0 + z\n  cdef double Or0 = Ogamma0 * (1.0 + nufunc(opz, NeffPerNu, nmasslessnu, nu_y))\n  return pow(opz**3 * (opz * Or0 + Om0) + Ode0, -0.5)\n\n######## wCDM\n# No relativistic species\ndef wcdm_inv_efunc_norel(double z, double Om0, double Ode0,\n    double Ok0, double w0):\n  cdef double opz = 1.0 + z\n  return pow(opz**2 * (opz * Om0 + Ok0) +\n            Ode0 * opz**(3. * (1.0 + w0)), -0.5)\n\n# Massless neutrinos\ndef wcdm_inv_efunc_nomnu(double z, double Om0, double Ode0, double Ok0,\n    double Or0, double w0):\n  cdef double opz = 1.0 + z\n  return pow((((opz * Or0 + Om0) * opz) + Ok0) * opz**2 +\n          Ode0 * opz**(3. * (1.0 + w0)), -0.5)\n\n# With massive neutrinos\ndef wcdm_inv_efunc(double z, double Om0, double Ode0, double Ok0,\n    double Ogamma0, double NeffPerNu, int nmasslessnu, list nu_y, double w0):\n\n  cdef double opz = 1.0 + z\n  cdef double Or0 = Ogamma0 * (1.0 + nufunc(opz, NeffPerNu, nmasslessnu, nu_y))\n  return pow((((opz * Or0 + Om0) * opz) + Ok0) * opz**2 +\n          Ode0 * opz**(3. * (1.0 + w0)), -0.5)\n\n######## Flat wCDM\n# No relativistic species\ndef fwcdm_inv_efunc_norel(double z, double Om0, double Ode0, double w0):\n  cdef double opz = 1.0 + z\n  return pow(opz**3 * Om0 + Ode0 * opz**(3. * (1.0 + w0)), -0.5)\n\n# Massless neutrinos\ndef fwcdm_inv_efunc_nomnu(double z, double Om0, double Ode0,\n    double Or0, double w0):\n  cdef double opz = 1.0 + z\n  return pow(opz**3 * (opz * Or0 + Om0) +\n            Ode0 * opz**(3. * (1.0 + w0)), -0.5)\n\n# With massive neutrinos\ndef fwcdm_inv_efunc(double z, double Om0, double Ode0,\n    double Ogamma0, double NeffPerNu, int nmasslessnu, list nu_y, double w0):\n\n  cdef double opz = 1.0 + z\n  cdef double Or0 = Ogamma0 * (1.0 + nufunc(opz, NeffPerNu, nmasslessnu, nu_y))\n  return pow(opz**3 * (opz * Or0 + Om0) + Ode0 * opz**(3. * (1.0 + w0)), -0.5)\n\n######## w0waCDM\n# No relativistic species\ndef w0wacdm_inv_efunc_norel(double z, double Om0, double Ode0, double Ok0,\n    double w0, double wa):\n  cdef double opz = 1.0 + z\n  cdef Odescl = opz**(3. * (1 + w0 + wa)) * exp(-3.0 * wa * z / opz)\n  return pow(opz**2 * (opz * Om0 + Ok0) + Ode0 * Odescl, -0.5)\n\n# Massless neutrinos\ndef w0wacdm_inv_efunc_nomnu(double z, double Om0, double Ode0, double Ok0,\n    double Or0, double w0, double wa):\n  cdef double opz = 1.0 + z\n  cdef Odescl = opz**(3. * (1 + w0 + wa)) * exp(-3.0 * wa * z / opz)\n  return pow((((opz * Or0 + Om0) * opz) + Ok0) * opz**2 +\n          Ode0 * Odescl, -0.5)\n\ndef w0wacdm_inv_efunc(double z, double Om0, double Ode0, double Ok0,\n    double Ogamma0, double NeffPerNu, int nmasslessnu, list nu_y, double w0,\n    double wa):\n\n  cdef double opz = 1.0 + z\n  cdef double Or0 = Ogamma0 * (1.0 + nufunc(opz, NeffPerNu, nmasslessnu, nu_y))\n  cdef Odescl = opz**(3. * (1 + w0 + wa)) * exp(-3.0 * wa * z / opz)\n  return pow((((opz * Or0 + Om0) * opz) + Ok0) * opz**2 + Ode0 * Odescl, -0.5)\n\n######## Flatw0waCDM\n# No relativistic species\ndef fw0wacdm_inv_efunc_norel(double z, double Om0, double Ode0,\n    double w0, double wa):\n  cdef double opz = 1.0 + z\n  cdef Odescl = opz**(3. * (1 + w0 + wa)) * exp(-3.0 * wa * z / opz)\n  return pow(opz**3 * Om0 + Ode0 * Odescl, -0.5)\n\n# Massless neutrinos\ndef fw0wacdm_inv_efunc_nomnu(double z, double Om0, double Ode0,\n    double Or0, double w0, double wa):\n  cdef double opz = 1.0 + z\n  cdef Odescl = opz**(3. * (1 + w0 + wa)) * exp(-3.0 * wa * z / opz)\n  return pow((opz * Or0 + Om0) * opz**3 + Ode0 * Odescl, -0.5)\n\n# With massive neutrinos\ndef fw0wacdm_inv_efunc(double z, double Om0, double Ode0,\n    double Ogamma0, double NeffPerNu, int nmasslessnu, list nu_y, double w0,\n    double wa):\n\n  cdef double opz = 1.0 + z\n  cdef double Or0 = Ogamma0 * (1.0 + nufunc(opz, NeffPerNu, nmasslessnu, nu_y))\n  cdef Odescl = opz**(3. * (1 + w0 + wa)) * exp(-3.0 * wa * z / opz)\n  return pow((opz * Or0 + Om0) * opz**3 + Ode0 * Odescl, -0.5)\n\n######## wpwaCDM\n# No relativistic species\ndef wpwacdm_inv_efunc_norel(double z, double Om0, double Ode0, double Ok0,\n    double wp, double apiv, double wa):\n  cdef double opz = 1.0 + z\n  cdef Odescl = opz**(3. * (1. + wp + apiv * wa)) * exp(-3. * wa * z / opz)\n  return pow(opz**2 * (opz * Om0 + Ok0) + Ode0 * Odescl, -0.5)\n\n# Massless neutrinos\ndef wpwacdm_inv_efunc_nomnu(double z, double Om0, double Ode0, double Ok0,\n    double Or0, double wp, double apiv, double wa):\n  cdef double opz = 1.0 + z\n  cdef Odescl = opz**(3. * (1. + wp + apiv * wa)) * exp(-3. * wa * z / opz)\n  return pow((((opz * Or0 + Om0) * opz) + Ok0) * opz**2 +\n          Ode0 * Odescl, -0.5)\n\n# With massive neutrinos\ndef wpwacdm_inv_efunc(double z, double Om0, double Ode0, double Ok0,\n    double Ogamma0, double NeffPerNu, int nmasslessnu, list nu_y, double wp,\n    double apiv, double wa):\n\n  cdef double opz = 1.0 + z\n  cdef double Or0 = Ogamma0 * (1.0 + nufunc(opz, NeffPerNu, nmasslessnu, nu_y))\n  cdef Odescl = opz**(3. * (1. + wp + apiv * wa)) * exp(-3. * wa * z / opz)\n  return pow((((opz * Or0 + Om0) * opz) + Ok0) * opz**2 + Ode0 * Odescl, -0.5)\n\n######## w0wzCDM\n# No relativistic species\ndef w0wzcdm_inv_efunc_norel(double z, double Om0, double Ode0, double Ok0,\n    double w0, double wz):\n  cdef double opz = 1.0 + z\n  cdef Odescl = opz**(3. * (1. + w0 - wz)) * exp(-3. * wz * z)\n  return pow(opz**2 * (opz * Om0 + Ok0) + Ode0 * Odescl, -0.5)\n\n# Massless neutrinos\ndef w0wzcdm_inv_efunc_nomnu(double z, double Om0, double Ode0, double Ok0,\n    double Or0, double w0, double wz):\n  cdef double opz = 1.0 + z\n  cdef Odescl = opz**(3. * (1. + w0 - wz)) * exp(-3. * wz * z)\n  return pow((((opz * Or0 + Om0) * opz) + Ok0) * opz**2 +\n          Ode0 * Odescl, -0.5)\n\n# With massive neutrinos\ndef w0wzcdm_inv_efunc(double z, double Om0, double Ode0, double Ok0,\n    double Ogamma0, double NeffPerNu, int nmasslessnu, list nu_y, double w0,\n    double wz):\n\n  cdef double opz = 1.0 + z\n  cdef double Or0 = Ogamma0 * (1.0 + nufunc(opz, NeffPerNu, nmasslessnu, nu_y))\n  cdef Odescl = opz**(3. * (1. + w0 - wz)) * exp(-3. * wz * z)\n  return pow((((opz * Or0 + Om0) * opz) + Ok0) * opz**2 + Ode0 * Odescl, -0.5)\n\n######## Neutrino relative density function\n# Scalar equivalent to FLRW.nu_realative_density in core.py\n#  Please see that for further discussion.\n# This should only be called with massive neutrinos (e.g., nu_y is not empty)\n# Briefly, this is just a numerical fitting function to the true relationship,\n#  which is too expensive to want to evaluate directly.  The\n#  constants which appear are:\n#    p = 1.83  -> numerical fitting constant from Komatsu et al.\n#  1/p = 0.54644... -> same constant\n#    k = 0.3173 -> another fitting constant\n#  7/8 (4/11)^(4/3) = 0.2271... -> fermion/boson constant for neutrino\n#                                   contribution -- see any cosmology book\n#  The Komatsu reference is: Komatsu et al. 2011, ApJS 192, 18\ncdef nufunc(double opz, double NeffPerNu, int nmasslessnu, list nu_y):\n  cdef int N = len(nu_y)\n  cdef double k = 0.3173 / opz\n  cdef double rel_mass_sum = nmasslessnu\n  cdef unsigned int i\n  for i in range(N):\n    rel_mass_sum += pow(1.0 + (k * <double>nu_y[i])**1.83, 0.54644808743)\n  return 0.22710731766 * NeffPerNu * rel_mass_sum\n"},{"fileName":"utils.py","filePath":"astropy/cosmology","id":13932,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport functools\nfrom math import inf\nfrom numbers import Number\n\nimport numpy as np\n\nfrom astropy.units import Quantity\nfrom astropy.utils import isiterable\nfrom astropy.utils.decorators import deprecated\n\nfrom . import units as cu\n\n__all__ = []  # nothing is publicly scoped\n\n__doctest_skip__ = [\"inf_like\", \"vectorize_if_needed\"]\n\n\ndef vectorize_redshift_method(func=None, nin=1):\n    \"\"\"Vectorize a method of redshift(s).\n\n    Parameters\n    ----------\n    func : callable or None\n        method to wrap. If `None` returns a :func:`functools.partial`\n        with ``nin`` loaded.\n    nin : int\n        Number of positional redshift arguments.\n\n    Returns\n    -------\n    wrapper : callable\n        :func:`functools.wraps` of ``func`` where the first ``nin``\n        arguments are converted from |Quantity| to :class:`numpy.ndarray`.\n    \"\"\"\n    # allow for pie-syntax & setting nin\n    if func is None:\n        return functools.partial(vectorize_redshift_method, nin=nin)\n\n    @functools.wraps(func)\n    def wrapper(self, *args, **kwargs):\n        \"\"\"\n        :func:`functools.wraps` of ``func`` where the first ``nin``\n        arguments are converted from |Quantity| to `numpy.ndarray` or scalar.\n        \"\"\"\n        # process inputs\n        # TODO! quantity-aware vectorization can simplify this.\n        zs = [z if not isinstance(z, Quantity) else z.to_value(cu.redshift)\n              for z in args[:nin]]\n        # scalar inputs\n        if all(isinstance(z, (Number, np.generic)) for z in zs):\n            return func(self, *zs, *args[nin:], **kwargs)\n        # non-scalar. use vectorized func\n        return wrapper.__vectorized__(self, *zs, *args[nin:], **kwargs)\n\n    wrapper.__vectorized__ = np.vectorize(func)  # attach vectorized function\n    # TODO! use frompyfunc when can solve return type errors\n\n    return wrapper\n\n\n@deprecated(\n    since=\"5.0\",\n    message=\"vectorize_if_needed has been removed because it constructs a new ufunc on each call\",\n    alternative=\"use a pre-vectorized function instead for a target array 'z'\"\n)\ndef vectorize_if_needed(f, *x, **vkw):\n    \"\"\"Helper function to vectorize scalar functions on array inputs.\n\n    Parameters\n    ----------\n    f : callable\n        'f' must accept positional arguments and no mandatory keyword\n        arguments.\n    *x\n        Arguments into ``f``.\n    **vkw\n        Keyword arguments into :class:`numpy.vectorize`.\n\n    Examples\n    --------\n    >>> func = lambda x: x ** 2\n    >>> vectorize_if_needed(func, 2)\n    4\n    >>> vectorize_if_needed(func, [2, 3])\n    array([4, 9])\n    \"\"\"\n    return np.vectorize(f, **vkw)(*x) if any(map(isiterable, x)) else f(*x)\n\n\n@deprecated(\n    since=\"5.0\",\n    message=\"inf_like has been removed because it duplicates functionality provided by numpy.full_like()\",\n    alternative=\"Use numpy.full_like(z, numpy.inf) instead for a target array 'z'\"\n)\ndef inf_like(x):\n    \"\"\"Return the shape of x with value infinity and dtype='float'.\n\n    Preserves 'shape' for both array and scalar inputs.\n    But always returns a float array, even if x is of integer type.\n\n    Parameters\n    ----------\n    x : scalar or array-like\n        Must work with functions `numpy.isscalar` and `numpy.full_like` (if `x`\n        is not a scalar`\n\n    Returns\n    -------\n    `math.inf` or ndarray[float] thereof\n        Returns a scalar `~math.inf` if `x` is a scalar, an array of floats\n        otherwise.\n\n    Examples\n    --------\n    >>> inf_like(0.)  # float scalar\n    inf\n    >>> inf_like(1)  # integer scalar should give float output\n    inf\n    >>> inf_like([0., 1., 2., 3.])  # float list\n    array([inf, inf, inf, inf])\n    >>> inf_like([0, 1, 2, 3])  # integer list should give float output\n    array([inf, inf, inf, inf])\n    \"\"\"\n    return inf if np.isscalar(x) else np.full_like(x, inf, dtype=float)\n\n\ndef aszarr(z):\n    \"\"\"\n    Redshift as a `~numbers.Number` or `~numpy.ndarray` / |Quantity| / |Column|.\n    Allows for any ndarray ducktype by checking for attribute \"shape\".\n    \"\"\"\n    if isinstance(z, (Number, np.generic)):  # scalars\n        return z\n    elif hasattr(z, \"shape\"):  # ducktypes NumPy array\n        if hasattr(z, \"unit\"):  # Quantity Column\n            return (z << cu.redshift).value  # for speed only use enabled equivs\n        return z\n    # not one of the preferred types: Number / array ducktype\n    return Quantity(z, cu.redshift).value\n"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":87,"id":13933,"name":"atm","nodeType":"Attribute","startLoc":87,"text":"atm"},{"col":0,"comment":"Vectorize a method of redshift(s).\n\n    Parameters\n    ----------\n    func : callable or None\n        method to wrap. If `None` returns a :func:`functools.partial`\n        with ``nin`` loaded.\n    nin : int\n        Number of positional redshift arguments.\n\n    Returns\n    -------\n    wrapper : callable\n        :func:`functools.wraps` of ``func`` where the first ``nin``\n        arguments are converted from |Quantity| to :class:`numpy.ndarray`.\n    ","endLoc":60,"header":"def vectorize_redshift_method(func=None, nin=1)","id":13934,"name":"vectorize_redshift_method","nodeType":"Function","startLoc":20,"text":"def vectorize_redshift_method(func=None, nin=1):\n    \"\"\"Vectorize a method of redshift(s).\n\n    Parameters\n    ----------\n    func : callable or None\n        method to wrap. If `None` returns a :func:`functools.partial`\n        with ``nin`` loaded.\n    nin : int\n        Number of positional redshift arguments.\n\n    Returns\n    -------\n    wrapper : callable\n        :func:`functools.wraps` of ``func`` where the first ``nin``\n        arguments are converted from |Quantity| to :class:`numpy.ndarray`.\n    \"\"\"\n    # allow for pie-syntax & setting nin\n    if func is None:\n        return functools.partial(vectorize_redshift_method, nin=nin)\n\n    @functools.wraps(func)\n    def wrapper(self, *args, **kwargs):\n        \"\"\"\n        :func:`functools.wraps` of ``func`` where the first ``nin``\n        arguments are converted from |Quantity| to `numpy.ndarray` or scalar.\n        \"\"\"\n        # process inputs\n        # TODO! quantity-aware vectorization can simplify this.\n        zs = [z if not isinstance(z, Quantity) else z.to_value(cu.redshift)\n              for z in args[:nin]]\n        # scalar inputs\n        if all(isinstance(z, (Number, np.generic)) for z in zs):\n            return func(self, *zs, *args[nin:], **kwargs)\n        # non-scalar. use vectorized func\n        return wrapper.__vectorized__(self, *zs, *args[nin:], **kwargs)\n\n    wrapper.__vectorized__ = np.vectorize(func)  # attach vectorized function\n    # TODO! use frompyfunc when can solve return type errors\n\n    return wrapper"},{"className":"CosmologyError","col":0,"comment":"null","endLoc":34,"id":13935,"nodeType":"Class","startLoc":33,"text":"class CosmologyError(Exception):\n    pass"},{"col":0,"comment":"Helper function to vectorize scalar functions on array inputs.\n\n    Parameters\n    ----------\n    f : callable\n        'f' must accept positional arguments and no mandatory keyword\n        arguments.\n    *x\n        Arguments into ``f``.\n    **vkw\n        Keyword arguments into :class:`numpy.vectorize`.\n\n    Examples\n    --------\n    >>> func = lambda x: x ** 2\n    >>> vectorize_if_needed(func, 2)\n    4\n    >>> vectorize_if_needed(func, [2, 3])\n    array([4, 9])\n    ","endLoc":89,"header":"@deprecated(\n    since=\"5.0\",\n    message=\"vectorize_if_needed has been removed because it constructs a new ufunc on each call\",\n    alternative=\"use a pre-vectorized function instead for a target array 'z'\"\n)\ndef vectorize_if_needed(f, *x, **vkw)","id":13936,"name":"vectorize_if_needed","nodeType":"Function","startLoc":63,"text":"@deprecated(\n    since=\"5.0\",\n    message=\"vectorize_if_needed has been removed because it constructs a new ufunc on each call\",\n    alternative=\"use a pre-vectorized function instead for a target array 'z'\"\n)\ndef vectorize_if_needed(f, *x, **vkw):\n    \"\"\"Helper function to vectorize scalar functions on array inputs.\n\n    Parameters\n    ----------\n    f : callable\n        'f' must accept positional arguments and no mandatory keyword\n        arguments.\n    *x\n        Arguments into ``f``.\n    **vkw\n        Keyword arguments into :class:`numpy.vectorize`.\n\n    Examples\n    --------\n    >>> func = lambda x: x ** 2\n    >>> vectorize_if_needed(func, 2)\n    4\n    >>> vectorize_if_needed(func, [2, 3])\n    array([4, 9])\n    \"\"\"\n    return np.vectorize(f, **vkw)(*x) if any(map(isiterable, x)) else f(*x)"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":90,"id":13937,"name":"mu0","nodeType":"Attribute","startLoc":90,"text":"mu0"},{"col":0,"comment":"\n    Find the redshift ``z`` at which ``func(z) = fval``.\n    See :func:`astropy.cosmology.funcs.z_at_value`.\n    ","endLoc":101,"header":"def _z_at_scalar_value(func, fval, zmin=1e-8, zmax=1000, ztol=1e-8, maxfun=500,\n                      method='Brent', bracket=None, verbose=False)","id":13938,"name":"_z_at_scalar_value","nodeType":"Function","startLoc":21,"text":"def _z_at_scalar_value(func, fval, zmin=1e-8, zmax=1000, ztol=1e-8, maxfun=500,\n                      method='Brent', bracket=None, verbose=False):\n    \"\"\"\n    Find the redshift ``z`` at which ``func(z) = fval``.\n    See :func:`astropy.cosmology.funcs.z_at_value`.\n    \"\"\"\n    from scipy.optimize import minimize_scalar\n\n    opt = {'maxiter': maxfun}\n    # Assume custom methods support the same options as default; otherwise user\n    # will see warnings.\n    if str(method).lower() == 'bounded':\n        opt['xatol'] = ztol\n        if bracket is not None:\n            warnings.warn(f\"Option 'bracket' is ignored by method {method}.\")\n            bracket = None\n    else:\n        opt['xtol'] = ztol\n\n    # fval falling inside the interval of bracketing function values does not\n    # guarantee it has a unique solution, but for Standard Cosmological\n    # quantities normally should (being monotonic or having a single extremum).\n    # In these cases keep solver from returning solutions outside of bracket.\n    fval_zmin, fval_zmax = func(zmin), func(zmax)\n    nobracket = False\n    if np.sign(fval - fval_zmin) != np.sign(fval_zmax - fval):\n        if bracket is None:\n            nobracket = True\n        else:\n            fval_brac = func(np.asanyarray(bracket))\n            if np.sign(fval - fval_brac[0]) != np.sign(fval_brac[-1] - fval):\n                nobracket = True\n            else:\n                zmin, zmax = bracket[0], bracket[-1]\n                fval_zmin, fval_zmax = fval_brac[[0, -1]]\n    if nobracket:\n        warnings.warn(f\"fval is not bracketed by func(zmin)={fval_zmin} and \"\n                      f\"func(zmax)={fval_zmax}. This means either there is no \"\n                      \"solution, or that there is more than one solution \"\n                      \"between zmin and zmax satisfying fval = func(z).\",\n                      AstropyUserWarning)\n\n    if isinstance(fval_zmin, Quantity):\n        val = fval.to_value(fval_zmin.unit)\n    else:\n        val = fval\n\n    # 'Brent' and 'Golden' ignore `bounds`, force solution inside zlim\n    def f(z):\n        if z > zmax:\n            return 1.e300 * (1.0 + z - zmax)\n        elif z < zmin:\n            return 1.e300 * (1.0 + zmin - z)\n        elif isinstance(fval_zmin, Quantity):\n            return abs(func(z).value - val)\n        else:\n            return abs(func(z) - val)\n\n    res = minimize_scalar(f, method=method, bounds=(zmin, zmax),\n                          bracket=bracket, options=opt)\n\n    # Scipy docs state that `OptimizeResult` always has 'status' and 'message'\n    # attributes, but only `_minimize_scalar_bounded()` seems to have really\n    # implemented them.\n    if not res.success:\n        warnings.warn(f\"Solver returned {res.get('status')}: {res.get('message', 'Unsuccessful')}\\n\"\n                      f\"Precision {res.fun} reached after {res.nfev} function calls.\",\n                      AstropyUserWarning)\n\n    if verbose:\n        print(res)\n\n    if np.allclose(res.x, zmax):\n        raise CosmologyError(\n            f\"Best guess z={res.x} is very close to the upper z limit {zmax}.\"\n            \"\\nTry re-running with a different zmax.\")\n    elif np.allclose(res.x, zmin):\n        raise CosmologyError(\n            f\"Best guess z={res.x} is very close to the lower z limit {zmin}.\"\n            \"\\nTry re-running with a different zmin.\")\n    return res.x"},{"col":0,"comment":"Return the shape of x with value infinity and dtype='float'.\n\n    Preserves 'shape' for both array and scalar inputs.\n    But always returns a float array, even if x is of integer type.\n\n    Parameters\n    ----------\n    x : scalar or array-like\n        Must work with functions `numpy.isscalar` and `numpy.full_like` (if `x`\n        is not a scalar`\n\n    Returns\n    -------\n    `math.inf` or ndarray[float] thereof\n        Returns a scalar `~math.inf` if `x` is a scalar, an array of floats\n        otherwise.\n\n    Examples\n    --------\n    >>> inf_like(0.)  # float scalar\n    inf\n    >>> inf_like(1)  # integer scalar should give float output\n    inf\n    >>> inf_like([0., 1., 2., 3.])  # float list\n    array([inf, inf, inf, inf])\n    >>> inf_like([0, 1, 2, 3])  # integer list should give float output\n    array([inf, inf, inf, inf])\n    ","endLoc":126,"header":"@deprecated(\n    since=\"5.0\",\n    message=\"inf_like has been removed because it duplicates functionality provided by numpy.full_like()\",\n    alternative=\"Use numpy.full_like(z, numpy.inf) instead for a target array 'z'\"\n)\ndef inf_like(x)","id":13939,"name":"inf_like","nodeType":"Function","startLoc":92,"text":"@deprecated(\n    since=\"5.0\",\n    message=\"inf_like has been removed because it duplicates functionality provided by numpy.full_like()\",\n    alternative=\"Use numpy.full_like(z, numpy.inf) instead for a target array 'z'\"\n)\ndef inf_like(x):\n    \"\"\"Return the shape of x with value infinity and dtype='float'.\n\n    Preserves 'shape' for both array and scalar inputs.\n    But always returns a float array, even if x is of integer type.\n\n    Parameters\n    ----------\n    x : scalar or array-like\n        Must work with functions `numpy.isscalar` and `numpy.full_like` (if `x`\n        is not a scalar`\n\n    Returns\n    -------\n    `math.inf` or ndarray[float] thereof\n        Returns a scalar `~math.inf` if `x` is a scalar, an array of floats\n        otherwise.\n\n    Examples\n    --------\n    >>> inf_like(0.)  # float scalar\n    inf\n    >>> inf_like(1)  # integer scalar should give float output\n    inf\n    >>> inf_like([0., 1., 2., 3.])  # float list\n    array([inf, inf, inf, inf])\n    >>> inf_like([0, 1, 2, 3])  # integer list should give float output\n    array([inf, inf, inf, inf])\n    \"\"\"\n    return inf if np.isscalar(x) else np.full_like(x, inf, dtype=float)"},{"col":0,"comment":"\n    Redshift as a `~numbers.Number` or `~numpy.ndarray` / |Quantity| / |Column|.\n    Allows for any ndarray ducktype by checking for attribute \"shape\".\n    ","endLoc":141,"header":"def aszarr(z)","id":13940,"name":"aszarr","nodeType":"Function","startLoc":129,"text":"def aszarr(z):\n    \"\"\"\n    Redshift as a `~numbers.Number` or `~numpy.ndarray` / |Quantity| / |Column|.\n    Allows for any ndarray ducktype by checking for attribute \"shape\".\n    \"\"\"\n    if isinstance(z, (Number, np.generic)):  # scalars\n        return z\n    elif hasattr(z, \"shape\"):  # ducktypes NumPy array\n        if hasattr(z, \"unit\"):  # Quantity Column\n            return (z << cu.redshift).value  # for speed only use enabled equivs\n        return z\n    # not one of the preferred types: Number / array ducktype\n    return Quantity(z, cu.redshift).value"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":93,"id":13941,"name":"sigma_T","nodeType":"Attribute","startLoc":93,"text":"sigma_T"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":96,"id":13942,"name":"b_wien","nodeType":"Attribute","startLoc":96,"text":"b_wien"},{"col":4,"comment":"null","endLoc":1571,"header":"def _eval_sip(self, x, y, coef)","id":13943,"name":"_eval_sip","nodeType":"Function","startLoc":1559,"text":"def _eval_sip(self, x, y, coef):\n        x = np.asarray(x, dtype=np.float64)\n        y = np.asarray(y, dtype=np.float64)\n        if self.coeff_prefix == 'A':\n            result = np.zeros(x.shape)\n        else:\n            result = np.zeros(y.shape)\n\n        for i in range(coef.shape[0]):\n            for j in range(coef.shape[1]):\n                if 1 < i + j < self.order + 1:\n                    result = result + coef[i, j] * x ** i * y ** j\n        return result"},{"col":4,"comment":"\n        Return the number of coefficients in one param set\n        ","endLoc":1530,"header":"def get_num_coeff(self, ndim)","id":13944,"name":"get_num_coeff","nodeType":"Function","startLoc":1519,"text":"def get_num_coeff(self, ndim):\n        \"\"\"\n        Return the number of coefficients in one param set\n        \"\"\"\n\n        if self.order < 2 or self.order > 9:\n            raise ValueError(\"Degree of polynomial must be 2< deg < 9\")\n\n        nmixed = comb(self.order, ndim)\n        # remove 3 terms because SIP deg >= 2\n        numc = self.order * ndim + nmixed - 2\n        return numc"},{"attributeType":"EMCODATA2010","col":0,"comment":"null","endLoc":102,"id":13945,"name":"e_esu","nodeType":"Attribute","startLoc":102,"text":"e_esu"},{"attributeType":"null","col":4,"comment":"null","endLoc":1482,"id":13946,"name":"n_inputs","nodeType":"Attribute","startLoc":1482,"text":"n_inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":1483,"id":13947,"name":"n_outputs","nodeType":"Attribute","startLoc":1483,"text":"n_outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":1485,"id":13948,"name":"_separable","nodeType":"Attribute","startLoc":1485,"text":"_separable"},{"attributeType":"null","col":8,"comment":"null","endLoc":1490,"id":13949,"name":"coeff_prefix","nodeType":"Attribute","startLoc":1490,"text":"self.coeff_prefix"},{"attributeType":"null","col":8,"comment":"null","endLoc":1491,"id":13950,"name":"_param_names","nodeType":"Attribute","startLoc":1491,"text":"self._param_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":1489,"id":13951,"name":"order","nodeType":"Attribute","startLoc":1489,"text":"self.order"},{"className":"SIP","col":0,"comment":"\n    Simple Imaging Polynomial (SIP) model.\n\n    The SIP convention is used to represent distortions in FITS image headers.\n    See [1]_ for a description of the SIP convention.\n\n    Parameters\n    ----------\n    crpix : list or (2,) ndarray\n        CRPIX values\n    a_order : int\n        SIP polynomial order for first axis\n    b_order : int\n        SIP order for second axis\n    a_coeff : dict\n        SIP coefficients for first axis\n    b_coeff : dict\n        SIP coefficients for the second axis\n    ap_order : int\n        order for the inverse transformation (AP coefficients)\n    bp_order : int\n        order for the inverse transformation (BP coefficients)\n    ap_coeff : dict\n        coefficients for the inverse transform\n    bp_coeff : dict\n        coefficients for the inverse transform\n\n    References\n    ----------\n    .. [1] `David Shupe, et al, ADASS, ASP Conference Series, Vol. 347, 2005 <https://ui.adsabs.harvard.edu/abs/2005ASPC..347..491S>`_\n    ","endLoc":1660,"id":13952,"nodeType":"Class","startLoc":1574,"text":"class SIP(Model):\n    \"\"\"\n    Simple Imaging Polynomial (SIP) model.\n\n    The SIP convention is used to represent distortions in FITS image headers.\n    See [1]_ for a description of the SIP convention.\n\n    Parameters\n    ----------\n    crpix : list or (2,) ndarray\n        CRPIX values\n    a_order : int\n        SIP polynomial order for first axis\n    b_order : int\n        SIP order for second axis\n    a_coeff : dict\n        SIP coefficients for first axis\n    b_coeff : dict\n        SIP coefficients for the second axis\n    ap_order : int\n        order for the inverse transformation (AP coefficients)\n    bp_order : int\n        order for the inverse transformation (BP coefficients)\n    ap_coeff : dict\n        coefficients for the inverse transform\n    bp_coeff : dict\n        coefficients for the inverse transform\n\n    References\n    ----------\n    .. [1] `David Shupe, et al, ADASS, ASP Conference Series, Vol. 347, 2005 <https://ui.adsabs.harvard.edu/abs/2005ASPC..347..491S>`_\n    \"\"\"\n\n    n_inputs = 2\n    n_outputs = 2\n\n    _separable = False\n\n    def __init__(self, crpix, a_order, b_order, a_coeff={}, b_coeff={},\n                 ap_order=None, bp_order=None, ap_coeff={}, bp_coeff={},\n                 n_models=None, model_set_axis=None, name=None, meta=None):\n        self._crpix = crpix\n        self._a_order = a_order\n        self._b_order = b_order\n        self._a_coeff = a_coeff\n        self._b_coeff = b_coeff\n        self._ap_order = ap_order\n        self._bp_order = bp_order\n        self._ap_coeff = ap_coeff\n        self._bp_coeff = bp_coeff\n        self.shift_a = Shift(-crpix[0])\n        self.shift_b = Shift(-crpix[1])\n        self.sip1d_a = _SIP1D(a_order, coeff_prefix='A', n_models=n_models,\n                              model_set_axis=model_set_axis, **a_coeff)\n        self.sip1d_b = _SIP1D(b_order, coeff_prefix='B', n_models=n_models,\n                              model_set_axis=model_set_axis, **b_coeff)\n        super().__init__(n_models=n_models, model_set_axis=model_set_axis,\n                         name=name, meta=meta)\n        self._inputs = (\"u\", \"v\")\n        self._outputs = (\"x\", \"y\")\n\n    def __repr__(self):\n        return '<{}({!r})>'.format(self.__class__.__name__,\n                                   [self.shift_a, self.shift_b, self.sip1d_a, self.sip1d_b])\n\n    def __str__(self):\n        parts = [f'Model: {self.__class__.__name__}']\n        for model in [self.shift_a, self.shift_b, self.sip1d_a, self.sip1d_b]:\n            parts.append(indent(str(model), width=4))\n            parts.append('')\n\n        return '\\n'.join(parts)\n\n    @property\n    def inverse(self):\n        if (self._ap_order is not None and self._bp_order is not None):\n            return InverseSIP(self._ap_order, self._bp_order,\n                              self._ap_coeff, self._bp_coeff)\n        else:\n            raise NotImplementedError(\"SIP inverse coefficients are not available.\")\n\n    def evaluate(self, x, y):\n        u = self.shift_a.evaluate(x, *self.shift_a.param_sets)\n        v = self.shift_b.evaluate(y, *self.shift_b.param_sets)\n        f = self.sip1d_a.evaluate(u, v, *self.sip1d_a.param_sets)\n        g = self.sip1d_b.evaluate(u, v, *self.sip1d_b.param_sets)\n        return f, g"},{"col":4,"comment":"null","endLoc":1637,"header":"def __repr__(self)","id":13953,"name":"__repr__","nodeType":"Function","startLoc":1635,"text":"def __repr__(self):\n        return '<{}({!r})>'.format(self.__class__.__name__,\n                                   [self.shift_a, self.shift_b, self.sip1d_a, self.sip1d_b])"},{"col":4,"comment":"null","endLoc":1645,"header":"def __str__(self)","id":13954,"name":"__str__","nodeType":"Function","startLoc":1639,"text":"def __str__(self):\n        parts = [f'Model: {self.__class__.__name__}']\n        for model in [self.shift_a, self.shift_b, self.sip1d_a, self.sip1d_b]:\n            parts.append(indent(str(model), width=4))\n            parts.append('')\n\n        return '\\n'.join(parts)"},{"attributeType":"EMCODATA2010","col":0,"comment":"null","endLoc":105,"id":13955,"name":"e_emu","nodeType":"Attribute","startLoc":105,"text":"e_emu"},{"col":4,"comment":"null","endLoc":1653,"header":"@property\n    def inverse(self)","id":13956,"name":"inverse","nodeType":"Function","startLoc":1647,"text":"@property\n    def inverse(self):\n        if (self._ap_order is not None and self._bp_order is not None):\n            return InverseSIP(self._ap_order, self._bp_order,\n                              self._ap_coeff, self._bp_coeff)\n        else:\n            raise NotImplementedError(\"SIP inverse coefficients are not available.\")"},{"attributeType":"EMCODATA2010","col":0,"comment":"null","endLoc":108,"id":13957,"name":"e_gauss","nodeType":"Attribute","startLoc":108,"text":"e_gauss"},{"col":0,"comment":"","endLoc":5,"header":"codata2010.py#<anonymous>","id":13958,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nAstronomical and physics constants in SI units.  See :mod:`astropy.constants`\nfor a complete listing of constants defined in Astropy.\n\"\"\"\n\nh = CODATA2010('h', \"Planck constant\", 6.62606957e-34, 'J s',\n                    0.00000029e-34, system='si')\n\nhbar = CODATA2010('hbar', \"Reduced Planck constant\",\n                  h.value * 0.5 / np.pi, 'J s',\n                  h.uncertainty * 0.5 / np.pi,\n                  h.reference, system='si')\n\nk_B = CODATA2010('k_B', \"Boltzmann constant\", 1.3806488e-23, 'J / (K)',\n                 0.0000013e-23, system='si')\n\nc = CODATA2010('c', \"Speed of light in vacuum\", 2.99792458e8, 'm / (s)', 0.,\n               system='si')\n\nG = CODATA2010('G', \"Gravitational constant\", 6.67384e-11, 'm3 / (kg s2)',\n               0.00080e-11, system='si')\n\ng0 = CODATA2010('g0', \"Standard acceleration of gravity\", 9.80665, 'm / s2',\n                0.0, system='si')\n\nm_p = CODATA2010('m_p', \"Proton mass\", 1.672621777e-27, 'kg', 0.000000074e-27,\n                 system='si')\n\nm_n = CODATA2010('m_n', \"Neutron mass\", 1.674927351e-27, 'kg', 0.000000074e-27,\n                 system='si')\n\nm_e = CODATA2010('m_e', \"Electron mass\", 9.10938291e-31, 'kg', 0.00000040e-31,\n                 system='si')\n\nu = CODATA2010('u', \"Atomic mass\", 1.660538921e-27, 'kg', 0.000000073e-27,\n               system='si')\n\nsigma_sb = CODATA2010('sigma_sb', \"Stefan-Boltzmann constant\", 5.670373e-8,\n                      'W / (K4 m2)', 0.000021e-8, system='si')\n\ne = EMCODATA2010('e', 'Electron charge', 1.602176565e-19, 'C', 0.000000035e-19,\n                 system='si')\n\neps0 = EMCODATA2010('eps0', 'Electric constant', 8.854187817e-12, 'F/m', 0.0,\n                    system='si')\n\nN_A = CODATA2010('N_A', \"Avogadro's number\", 6.02214129e23, '1 / (mol)',\n                 0.00000027e23, system='si')\n\nR = CODATA2010('R', \"Gas constant\", 8.3144621, 'J / (K mol)', 0.0000075,\n               system='si')\n\nRyd = CODATA2010('Ryd', 'Rydberg constant', 10973731.568539, '1 / (m)',\n                 0.000055, system='si')\n\na0 = CODATA2010('a0', \"Bohr radius\", 0.52917721092e-10, 'm', 0.00000000017e-10,\n                system='si')\n\nmuB = CODATA2010('muB', \"Bohr magneton\", 927.400968e-26, 'J/T', 0.00002e-26,\n                 system='si')\n\nalpha = CODATA2010('alpha', \"Fine-structure constant\", 7.2973525698e-3,\n                   '', 0.0000000024e-3, system='si')\n\natm = CODATA2010('atm', \"Standard atmosphere\", 101325, 'Pa', 0.0,\n                 system='si')\n\nmu0 = CODATA2010('mu0', \"Magnetic constant\", 4.0e-7 * np.pi, 'N/A2', 0.0,\n                 system='si')\n\nsigma_T = CODATA2010('sigma_T', \"Thomson scattering cross-section\",\n                     0.6652458734e-28, 'm2', 0.0000000013e-28, system='si')\n\nb_wien = Constant('b_wien', 'Wien wavelength displacement law constant',\n                  2.8977721e-3, 'm K', 0.0000026e-3, 'CODATA 2010', system='si')\n\ne_esu = EMCODATA2010(e.abbrev, e.name, e.value * c.value * 10.0,\n                     'statC', e.uncertainty * c.value * 10.0, system='esu')\n\ne_emu = EMCODATA2010(e.abbrev, e.name, e.value / 10, 'abC',\n                     e.uncertainty / 10, system='emu')\n\ne_gauss = EMCODATA2010(e.abbrev, e.name, e.value * c.value * 10.0,\n                       'Fr', e.uncertainty * c.value * 10.0, system='gauss')"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":13959,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":13960,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":17,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":3,"header":"utils.py#<anonymous>","id":13961,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = []  # nothing is publicly scoped\n\n__doctest_skip__ = [\"inf_like\", \"vectorize_if_needed\"]"},{"fileName":"units.py","filePath":"astropy/cosmology","id":13962,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"Cosmological units and equivalencies.\n\"\"\"  # (newline needed for unit summary)\n\nimport astropy.units as u\nfrom astropy.units.utils import generate_unit_summary as _generate_unit_summary\n\n__all__ = [\"littleh\", \"redshift\",\n           # redshift equivalencies\n           \"dimensionless_redshift\", \"with_redshift\",\n           \"redshift_distance\", \"redshift_hubble\", \"redshift_temperature\",\n           # other equivalencies\n           \"with_H0\"]\n\n__doctest_requires__ = {('with_redshift', 'redshift_distance'): ['scipy']}\n\n_ns = globals()\n\n\n###############################################################################\n# Cosmological Units\n\n# This is not formally a unit, but is used in that way in many contexts, and\n# an appropriate equivalency is only possible if it's treated as a unit.\nredshift = u.def_unit(['redshift'], prefixes=False, namespace=_ns,\n                      doc=\"Cosmological redshift.\", format={'latex': r''})\n\n# This is not formally a unit, but is used in that way in many contexts, and\n# an appropriate equivalency is only possible if it's treated as a unit (see\n# https://arxiv.org/pdf/1308.4150.pdf for more)\n# Also note that h or h100 or h_100 would be a better name, but they either\n# conflict or have numbers in them, which is disallowed\nlittleh = u.def_unit(['littleh'], namespace=_ns, prefixes=False,\n                     doc='Reduced/\"dimensionless\" Hubble constant',\n                     format={'latex': r'h_{100}'})\n\n\n###############################################################################\n# Equivalencies\n\n\ndef dimensionless_redshift():\n    \"\"\"Allow redshift to be 1-to-1 equivalent to dimensionless.\n\n    It is special compared to other equivalency pairs in that it\n    allows this independent of the power to which the redshift is raised,\n    and independent of whether it is part of a more complicated unit.\n    It is similar to u.dimensionless_angles() in this respect.\n    \"\"\"\n    return u.Equivalency([(redshift, None)], \"dimensionless_redshift\")\n\n\ndef redshift_distance(cosmology=None, kind=\"comoving\", **atzkw):\n    \"\"\"Convert quantities between redshift and distance.\n\n    Care should be taken to not misinterpret a relativistic, gravitational, etc\n    redshift as a cosmological one.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology`, str, or None, optional\n        A cosmology realization or built-in cosmology's name (e.g. 'Planck18').\n        If None, will use the default cosmology\n        (controlled by :class:`~astropy.cosmology.default_cosmology`).\n    kind : {'comoving', 'lookback', 'luminosity'} or None, optional\n        The distance type for the Equivalency.\n        Note this does NOT include the angular diameter distance as this\n        distance measure is not monotonic.\n    **atzkw\n        keyword arguments for :func:`~astropy.cosmology.z_at_value`\n\n    Returns\n    -------\n    `~astropy.units.equivalencies.Equivalency`\n        Equivalency between redshift and temperature.\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> import astropy.cosmology.units as cu\n    >>> from astropy.cosmology import WMAP9\n\n    >>> z = 1100 * cu.redshift\n    >>> z.to(u.Mpc, cu.redshift_distance(WMAP9, kind=\"comoving\"))  # doctest: +FLOAT_CMP\n    <Quantity 14004.03157418 Mpc>\n    \"\"\"\n    from astropy.cosmology import default_cosmology, z_at_value\n\n    # get cosmology: None -> default and process str / class\n    cosmology = cosmology if cosmology is not None else default_cosmology.get()\n    with default_cosmology.set(cosmology):  # if already cosmo, passes through\n        cosmology = default_cosmology.get()\n\n    allowed_kinds = ('comoving', 'lookback', 'luminosity')\n    if kind not in allowed_kinds:\n        raise ValueError(f\"`kind` is not one of {allowed_kinds}\")\n\n    method = getattr(cosmology, kind + \"_distance\")\n\n    def z_to_distance(z):\n        \"\"\"Redshift to distance.\"\"\"\n        return method(z)\n\n    def distance_to_z(d):\n        \"\"\"Distance to redshift.\"\"\"\n        return z_at_value(method, d << u.Mpc, **atzkw)\n\n    return u.Equivalency([(redshift, u.Mpc, z_to_distance, distance_to_z)],\n                         \"redshift_distance\",\n                         {'cosmology': cosmology, \"distance\": kind})\n\n\ndef redshift_hubble(cosmology=None, **atzkw):\n    \"\"\"Convert quantities between redshift and Hubble parameter and little-h.\n\n    Care should be taken to not misinterpret a relativistic, gravitational, etc\n    redshift as a cosmological one.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology`, str, or None, optional\n        A cosmology realization or built-in cosmology's name (e.g. 'Planck18').\n        If None, will use the default cosmology\n        (controlled by :class:`~astropy.cosmology.default_cosmology`).\n    **atzkw\n        keyword arguments for :func:`~astropy.cosmology.z_at_value`\n\n    Returns\n    -------\n    `~astropy.units.equivalencies.Equivalency`\n        Equivalency between redshift and Hubble parameter and little-h unit.\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> import astropy.cosmology.units as cu\n    >>> from astropy.cosmology import WMAP9\n\n    >>> z = 1100 * cu.redshift\n    >>> equivalency = cu.redshift_hubble(WMAP9)  # construct equivalency\n\n    >>> z.to(u.km / u.s / u.Mpc, equivalency)  # doctest: +FLOAT_CMP\n    <Quantity 1565637.40154275 km / (Mpc s)>\n\n    >>> z.to(cu.littleh, equivalency)  # doctest: +FLOAT_CMP\n    <Quantity 15656.37401543 littleh>\n    \"\"\"\n    from astropy.cosmology import default_cosmology, z_at_value\n\n    # get cosmology: None -> default and process str / class\n    cosmology = cosmology if cosmology is not None else default_cosmology.get()\n    with default_cosmology.set(cosmology):  # if already cosmo, passes through\n        cosmology = default_cosmology.get()\n\n    def z_to_hubble(z):\n        \"\"\"Redshift to Hubble parameter.\"\"\"\n        return cosmology.H(z)\n\n    def hubble_to_z(H):\n        \"\"\"Hubble parameter to redshift.\"\"\"\n        return z_at_value(cosmology.H, H << (u.km / u.s / u.Mpc), **atzkw)\n\n    def z_to_littleh(z):\n        \"\"\"Redshift to :math:`h`-unit Quantity.\"\"\"\n        return z_to_hubble(z).to_value(u.km / u.s / u.Mpc) / 100 * littleh\n\n    def littleh_to_z(h):\n        \"\"\":math:`h`-unit Quantity to redshift.\"\"\"\n        return hubble_to_z(h * 100)\n\n    return u.Equivalency([(redshift, u.km / u.s / u.Mpc, z_to_hubble, hubble_to_z),\n                          (redshift, littleh, z_to_littleh, littleh_to_z)],\n                         \"redshift_hubble\",\n                         {'cosmology': cosmology})\n\n\ndef redshift_temperature(cosmology=None, **atzkw):\n    \"\"\"Convert quantities between redshift and CMB temperature.\n\n    Care should be taken to not misinterpret a relativistic, gravitational, etc\n    redshift as a cosmological one.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology`, str, or None, optional\n        A cosmology realization or built-in cosmology's name (e.g. 'Planck18').\n        If None, will use the default cosmology\n        (controlled by :class:`~astropy.cosmology.default_cosmology`).\n    **atzkw\n        keyword arguments for :func:`~astropy.cosmology.z_at_value`\n\n    Returns\n    -------\n    `~astropy.units.equivalencies.Equivalency`\n        Equivalency between redshift and temperature.\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> import astropy.cosmology.units as cu\n    >>> from astropy.cosmology import WMAP9\n\n    >>> z = 1100 * cu.redshift\n    >>> z.to(u.K, cu.redshift_temperature(WMAP9))\n    <Quantity 3000.225 K>\n    \"\"\"\n    from astropy.cosmology import default_cosmology, z_at_value\n\n    # get cosmology: None -> default and process str / class\n    cosmology = cosmology if cosmology is not None else default_cosmology.get()\n    with default_cosmology.set(cosmology):  # if already cosmo, passes through\n        cosmology = default_cosmology.get()\n\n    def z_to_Tcmb(z):\n        return cosmology.Tcmb(z)\n\n    def Tcmb_to_z(T):\n        return z_at_value(cosmology.Tcmb, T << u.K, **atzkw)\n\n    return u.Equivalency([(redshift, u.K, z_to_Tcmb, Tcmb_to_z)],\n                         \"redshift_temperature\",\n                         {'cosmology': cosmology})\n\n\ndef with_redshift(cosmology=None, *,\n                  distance=\"comoving\", hubble=True, Tcmb=True,\n                  atzkw=None):\n    \"\"\"Convert quantities between measures of cosmological distance.\n\n    Note: by default all equivalencies are on and must be explicitly turned off.\n    Care should be taken to not misinterpret a relativistic, gravitational, etc\n    redshift as a cosmological one.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology`, str, or None, optional\n        A cosmology realization or built-in cosmology's name (e.g. 'Planck18').\n        If `None`, will use the default cosmology\n        (controlled by :class:`~astropy.cosmology.default_cosmology`).\n\n    distance : {'comoving', 'lookback', 'luminosity'} or None (optional, keyword-only)\n        The type of distance equivalency to create or `None`.\n        Default is 'comoving'.\n    hubble : bool (optional, keyword-only)\n        Whether to create a Hubble parameter <-> redshift equivalency, using\n        ``Cosmology.H``. Default is `True`.\n    Tcmb : bool (optional, keyword-only)\n        Whether to create a CMB temperature <-> redshift equivalency, using\n        ``Cosmology.Tcmb``. Default is `True`.\n\n    atzkw : dict or None (optional, keyword-only)\n        keyword arguments for :func:`~astropy.cosmology.z_at_value`\n\n    Returns\n    -------\n    `~astropy.units.equivalencies.Equivalency`\n        With equivalencies between redshift and distance / Hubble / temperature.\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> import astropy.cosmology.units as cu\n    >>> from astropy.cosmology import WMAP9\n\n    >>> equivalency = cu.with_redshift(WMAP9)\n    >>> z = 1100 * cu.redshift\n\n    Redshift to (comoving) distance:\n\n    >>> z.to(u.Mpc, equivalency)  # doctest: +FLOAT_CMP\n    <Quantity 14004.03157418 Mpc>\n\n    Redshift to the Hubble parameter:\n\n    >>> z.to(u.km / u.s / u.Mpc, equivalency)  # doctest: +FLOAT_CMP\n    <Quantity 1565637.40154275 km / (Mpc s)>\n\n    >>> z.to(cu.littleh, equivalency)  # doctest: +FLOAT_CMP\n    <Quantity 15656.37401543 littleh>\n\n    Redshift to CMB temperature:\n\n    >>> z.to(u.K, equivalency)\n    <Quantity 3000.225 K>\n    \"\"\"\n    from astropy.cosmology import default_cosmology, z_at_value\n\n    # get cosmology: None -> default and process str / class\n    cosmology = cosmology if cosmology is not None else default_cosmology.get()\n    with default_cosmology.set(cosmology):  # if already cosmo, passes through\n        cosmology = default_cosmology.get()\n\n    atzkw = atzkw if atzkw is not None else {}\n    equivs = []  # will append as built\n\n    # Hubble <-> Redshift\n    if hubble:\n        equivs.extend(redshift_hubble(cosmology, **atzkw))\n\n    # CMB Temperature <-> Redshift\n    if Tcmb:\n        equivs.extend(redshift_temperature(cosmology, **atzkw))\n\n    # Distance <-> Redshift, but need to choose which distance\n    if distance is not None:\n        equivs.extend(redshift_distance(cosmology, kind=distance, **atzkw))\n\n    # -----------\n    return u.Equivalency(equivs, \"with_redshift\",\n                         {'cosmology': cosmology,\n                          'distance': distance, 'hubble': hubble, 'Tcmb': Tcmb})\n\n\n# ===================================================================\n\ndef with_H0(H0=None):\n    \"\"\"\n    Convert between quantities with little-h and the equivalent physical units.\n\n    Parameters\n    ----------\n    H0 : None or `~astropy.units.Quantity` ['frequency']\n        The value of the Hubble constant to assume. If a\n        `~astropy.units.Quantity`, will assume the quantity *is* ``H0``. If\n        `None` (default), use the ``H0`` attribute from\n        :mod:`~astropy.cosmology.default_cosmology`.\n\n    References\n    ----------\n    For an illuminating discussion on why you may or may not want to use\n    little-h at all, see https://arxiv.org/pdf/1308.4150.pdf\n    \"\"\"\n    if H0 is None:\n        from .realizations import default_cosmology\n        H0 = default_cosmology.get().H0\n\n    h100_val_unit = u.Unit(100/(H0.to_value(u.km / u.s / u.Mpc)) * littleh)\n\n    return u.Equivalency([(h100_val_unit, None)], \"with_H0\", kwargs={\"H0\": H0})\n\n\n# ===================================================================\n# Enable the set of default equivalencies.\n# If the cosmology package is imported, this is added to the list astropy-wide.\n\nu.add_enabled_equivalencies(dimensionless_redshift())\n\n\n# =============================================================================\n# DOCSTRING\n\n# This generates a docstring for this module that describes all of the\n# standard units defined here.\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(_ns)\n"},{"fileName":"parameter.py","filePath":"astropy/cosmology","id":13963,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport astropy.units as u\nfrom astropy.utils.decorators import classproperty\n\n__all__ = [\"Parameter\"]\n\n\nclass Parameter:\n    r\"\"\"Cosmological parameter (descriptor).\n\n    Should only be used with a :class:`~astropy.cosmology.Cosmology` subclass.\n\n    Parameters\n    ----------\n    derived : bool (optional, keyword-only)\n        Whether the Parameter is 'derived', default `False`.\n        Derived parameters behave similarly to normal parameters, but are not\n        sorted by the |Cosmology| signature (probably not there) and are not\n        included in all methods. For reference, see ``Ode0`` in\n        ``FlatFLRWMixin``, which removes :math:`\\Omega_{de,0}`` as an\n        independent parameter (:math:`\\Omega_{de,0} \\equiv 1 - \\Omega_{tot}`).\n    unit : unit-like or None (optional, keyword-only)\n        The `~astropy.units.Unit` for the Parameter. If None (default) no\n        unit as assumed.\n    equivalencies : `~astropy.units.Equivalency` or sequence thereof\n        Unit equivalencies for this Parameter.\n    fvalidate : callable[[object, object, Any], Any] or str (optional, keyword-only)\n        Function to validate the Parameter value from instances of the\n        cosmology class. If \"default\", uses default validator to assign units\n        (with equivalencies), if Parameter has units.\n        For other valid string options, see ``Parameter._registry_validators``.\n        'fvalidate' can also be set through a decorator with\n        :meth:`~astropy.cosmology.Parameter.validator`.\n    fmt : str (optional, keyword-only)\n        `format` specification, used when making string representation\n        of the containing Cosmology.\n        See https://docs.python.org/3/library/string.html#formatspec\n    doc : str or None (optional, keyword-only)\n        Parameter description.\n\n    Examples\n    --------\n    For worked examples see :class:`~astropy.cosmology.FLRW`.\n    \"\"\"\n\n    _registry_validators = {}\n\n    def __init__(self, *, derived=False, unit=None, equivalencies=[],\n                 fvalidate=\"default\", fmt=\"\", doc=None):\n\n        # attribute name on container cosmology class.\n        # really set in __set_name__, but if Parameter is not init'ed as a\n        # descriptor this ensures that the attributes exist.\n        self._attr_name = self._attr_name_private = None\n\n        self._derived = derived\n        self._fmt = str(fmt)  # @property is `format_spec`\n        self.__doc__ = doc\n\n        # units stuff\n        self._unit = u.Unit(unit) if unit is not None else None\n        self._equivalencies = equivalencies\n\n        # Parse registered `fvalidate`\n        self._fvalidate_in = fvalidate  # Always store input fvalidate.\n        if callable(fvalidate):\n            pass\n        elif fvalidate in self._registry_validators:\n            fvalidate = self._registry_validators[fvalidate]\n        elif isinstance(fvalidate, str):\n            raise ValueError(\"`fvalidate`, if str, must be in \"\n                             f\"{self._registry_validators.keys()}\")\n        else:\n            raise TypeError(\"`fvalidate` must be a function or \"\n                            f\"{self._registry_validators.keys()}\")\n        self._fvalidate = fvalidate\n\n    def __set_name__(self, cosmo_cls, name):\n        # attribute name on container cosmology class\n        self._attr_name = name\n        self._attr_name_private = \"_\" + name\n\n    @property\n    def name(self):\n        \"\"\"Parameter name.\"\"\"\n        return self._attr_name\n\n    @property\n    def unit(self):\n        \"\"\"Parameter unit.\"\"\"\n        return self._unit\n\n    @property\n    def equivalencies(self):\n        \"\"\"Equivalencies used when initializing Parameter.\"\"\"\n        return self._equivalencies\n\n    @property\n    def format_spec(self):\n        \"\"\"String format specification.\"\"\"\n        return self._fmt\n\n    @property\n    def derived(self):\n        \"\"\"Whether the Parameter is derived; true parameters are not.\"\"\"\n        return self._derived\n\n    # -------------------------------------------\n    # descriptor and property-like methods\n\n    def __get__(self, cosmology, cosmo_cls=None):\n        # get from class\n        if cosmology is None:\n            return self\n        return getattr(cosmology, self._attr_name_private)\n\n    def __set__(self, cosmology, value):\n        \"\"\"Allows attribute setting once. Raises AttributeError subsequently.\"\"\"\n        # raise error if setting 2nd time.\n        if hasattr(cosmology, self._attr_name_private):\n            raise AttributeError(\"can't set attribute\")\n\n        # validate value, generally setting units if present\n        value = self.validate(cosmology, value)\n        setattr(cosmology, self._attr_name_private, value)\n\n    # -------------------------------------------\n    # validate value\n\n    @property\n    def fvalidate(self):\n        \"\"\"Function to validate a potential value of this Parameter..\"\"\"\n        return self._fvalidate\n\n    def validator(self, fvalidate):\n        \"\"\"Make new Parameter with custom ``fvalidate``.\n\n        Note: ``Parameter.fvalidator`` must be the top-most descriptor decorator.\n\n        Parameters\n        ----------\n        fvalidate : callable[[type, type, Any], Any]\n\n        Returns\n        -------\n        `~astropy.cosmology.Parameter`\n            Copy of this Parameter but with custom ``fvalidate``.\n        \"\"\"\n        return self.clone(fvalidate=fvalidate)\n\n    def validate(self, cosmology, value):\n        \"\"\"Run the validator on this Parameter.\n\n        Parameters\n        ----------\n        cosmology : `~astropy.cosmology.Cosmology` instance\n        value : Any\n            The object to validate.\n\n        Returns\n        -------\n        Any\n            The output of calling ``fvalidate(cosmology, self, value)``\n            (yes, that parameter order).\n        \"\"\"\n        return self.fvalidate(cosmology, self, value)\n\n    @classmethod\n    def register_validator(cls, key, fvalidate=None):\n        \"\"\"Decorator to register a new kind of validator function.\n\n        Parameters\n        ----------\n        key : str\n        fvalidate : callable[[object, object, Any], Any] or None, optional\n            Value validation function.\n\n        Returns\n        -------\n        ``validator`` or callable[``validator``]\n            if validator is None returns a function that takes and registers a\n            validator. This allows ``register_validator`` to be used as a\n            decorator.\n        \"\"\"\n        if key in cls._registry_validators:\n            raise KeyError(f\"validator {key!r} already registered with Parameter.\")\n\n        # fvalidate directly passed\n        if fvalidate is not None:\n            cls._registry_validators[key] = fvalidate\n            return fvalidate\n\n        # for use as a decorator\n        def register(fvalidate):\n            \"\"\"Register validator function.\n\n            Parameters\n            ----------\n            fvalidate : callable[[object, object, Any], Any]\n                Validation function.\n\n            Returns\n            -------\n            ``validator``\n            \"\"\"\n            cls._registry_validators[key] = fvalidate\n            return fvalidate\n\n        return register\n\n    # -------------------------------------------\n\n    def _get_init_arguments(self, processed=False):\n        \"\"\"Initialization arguments.\n\n        Parameters\n        ----------\n        processed : bool\n            Whether to more closely reproduce the input arguments (`False`,\n            default) or the processed arguments (`True`). The former is better\n            for string representations and round-tripping with ``eval(repr())``.\n\n        Returns\n        -------\n        dict[str, Any]\n        \"\"\"\n        # The keys are added in this order because `repr` prints them in order.\n        kw = {\"derived\": self.derived,\n              \"unit\": self.unit,\n              \"equivalencies\": self.equivalencies,\n              # Validator is always turned into a function, but for ``repr`` it's nice\n              # to know if it was originally a string.\n              \"fvalidate\": self.fvalidate if processed else self._fvalidate_in,\n              \"fmt\": self.format_spec,\n              \"doc\": self.__doc__}\n        return kw\n\n    def clone(self, **kw):\n        \"\"\"Clone this `Parameter`, changing any constructor argument.\n\n        Parameters\n        ----------\n        **kw\n            Passed to constructor. The current values, eg. ``fvalidate`` are\n            used as the default values, so an empty ``**kw`` is an exact copy.\n\n        Examples\n        --------\n        >>> p = Parameter()\n        >>> p\n        Parameter(derived=False, unit=None, equivalencies=[],\n                  fvalidate='default', fmt='', doc=None)\n\n        >>> p.clone(unit=\"km\")\n        Parameter(derived=False, unit=Unit(\"km\"), equivalencies=[],\n                  fvalidate='default', fmt='', doc=None)\n        \"\"\"\n        # Start with defaults, update from kw.\n        kwargs = {**self._get_init_arguments(), **kw}\n        # All initialization failures, like incorrect input are handled by init\n        cloned = type(self)(**kwargs)\n        # Transfer over the __set_name__ stuff. If `clone` is used to make a\n        # new descriptor, __set_name__ will be called again, overwriting this.\n        cloned._attr_name = self._attr_name\n        cloned._attr_name_private = self._attr_name_private\n\n        return cloned\n\n    def __eq__(self, other):\n        \"\"\"Check Parameter equality. Only equal to other Parameter objects.\n\n        Returns\n        -------\n        NotImplemented or True\n            `True` if equal, `NotImplemented` otherwise. This allows `other` to\n            be check for equality with ``other.__eq__``.\n\n        Examples\n        --------\n        >>> p1, p2 = Parameter(unit=\"km\"), Parameter(unit=\"km\")\n        >>> p1 == p2\n        True\n\n        >>> p3 = Parameter(unit=\"km / s\")\n        >>> p3 == p1\n        False\n\n        >>> p1 != 2\n        True\n        \"\"\"\n        if not isinstance(other, Parameter):\n            return NotImplemented\n        # Check equality on all `_init_arguments` & `name`.\n        # Need to compare the processed arguments because the inputs are many-\n        # to-one, e.g. `fvalidate` can be a string or the equivalent function.\n        return ((self._get_init_arguments(True) == other._get_init_arguments(True))\n                and (self.name == other.name))\n\n    def __repr__(self):\n        \"\"\"String representation.\n\n        ``eval(repr())`` should work, depending if contents like ``fvalidate``\n        can be similarly round-tripped.\n        \"\"\"\n        return \"Parameter({})\".format(\", \".join(f\"{k}={v!r}\" for k, v in\n                                                self._get_init_arguments().items()))\n\n\n# ===================================================================\n# Built-in validators\n\n\n@Parameter.register_validator(\"default\")\ndef _validate_with_unit(cosmology, param, value):\n    \"\"\"\n    Default Parameter value validator.\n    Adds/converts units if Parameter has a unit.\n    \"\"\"\n    if param.unit is not None:\n        with u.add_enabled_equivalencies(param.equivalencies):\n            value = u.Quantity(value, param.unit)\n    return value\n\n\n@Parameter.register_validator(\"float\")\ndef _validate_to_float(cosmology, param, value):\n    \"\"\"Parameter value validator with units, and converted to float.\"\"\"\n    value = _validate_with_unit(cosmology, param, value)\n    return float(value)\n\n\n@Parameter.register_validator(\"scalar\")\ndef _validate_to_scalar(cosmology, param, value):\n    \"\"\"\"\"\"\n    value = _validate_with_unit(cosmology, param, value)\n    if not value.isscalar:\n        raise ValueError(f\"{param.name} is a non-scalar quantity\")\n    return value\n\n\n@Parameter.register_validator(\"non-negative\")\ndef _validate_non_negative(cosmology, param, value):\n    \"\"\"Parameter value validator where value is a positive float.\"\"\"\n    value = _validate_to_float(cosmology, param, value)\n    if value < 0.0:\n        raise ValueError(f\"{param.name} cannot be negative.\")\n    return value\n"},{"col":0,"comment":"Allow redshift to be 1-to-1 equivalent to dimensionless.\n\n    It is special compared to other equivalency pairs in that it\n    allows this independent of the power to which the redshift is raised,\n    and independent of whether it is part of a more complicated unit.\n    It is similar to u.dimensionless_angles() in this respect.\n    ","endLoc":52,"header":"def dimensionless_redshift()","id":13964,"name":"dimensionless_redshift","nodeType":"Function","startLoc":44,"text":"def dimensionless_redshift():\n    \"\"\"Allow redshift to be 1-to-1 equivalent to dimensionless.\n\n    It is special compared to other equivalency pairs in that it\n    allows this independent of the power to which the redshift is raised,\n    and independent of whether it is part of a more complicated unit.\n    It is similar to u.dimensionless_angles() in this respect.\n    \"\"\"\n    return u.Equivalency([(redshift, None)], \"dimensionless_redshift\")"},{"className":"Parameter","col":0,"comment":"Cosmological parameter (descriptor).\n\n    Should only be used with a :class:`~astropy.cosmology.Cosmology` subclass.\n\n    Parameters\n    ----------\n    derived : bool (optional, keyword-only)\n        Whether the Parameter is 'derived', default `False`.\n        Derived parameters behave similarly to normal parameters, but are not\n        sorted by the |Cosmology| signature (probably not there) and are not\n        included in all methods. For reference, see ``Ode0`` in\n        ``FlatFLRWMixin``, which removes :math:`\\Omega_{de,0}`` as an\n        independent parameter (:math:`\\Omega_{de,0} \\equiv 1 - \\Omega_{tot}`).\n    unit : unit-like or None (optional, keyword-only)\n        The `~astropy.units.Unit` for the Parameter. If None (default) no\n        unit as assumed.\n    equivalencies : `~astropy.units.Equivalency` or sequence thereof\n        Unit equivalencies for this Parameter.\n    fvalidate : callable[[object, object, Any], Any] or str (optional, keyword-only)\n        Function to validate the Parameter value from instances of the\n        cosmology class. If \"default\", uses default validator to assign units\n        (with equivalencies), if Parameter has units.\n        For other valid string options, see ``Parameter._registry_validators``.\n        'fvalidate' can also be set through a decorator with\n        :meth:`~astropy.cosmology.Parameter.validator`.\n    fmt : str (optional, keyword-only)\n        `format` specification, used when making string representation\n        of the containing Cosmology.\n        See https://docs.python.org/3/library/string.html#formatspec\n    doc : str or None (optional, keyword-only)\n        Parameter description.\n\n    Examples\n    --------\n    For worked examples see :class:`~astropy.cosmology.FLRW`.\n    ","endLoc":307,"id":13965,"nodeType":"Class","startLoc":9,"text":"class Parameter:\n    r\"\"\"Cosmological parameter (descriptor).\n\n    Should only be used with a :class:`~astropy.cosmology.Cosmology` subclass.\n\n    Parameters\n    ----------\n    derived : bool (optional, keyword-only)\n        Whether the Parameter is 'derived', default `False`.\n        Derived parameters behave similarly to normal parameters, but are not\n        sorted by the |Cosmology| signature (probably not there) and are not\n        included in all methods. For reference, see ``Ode0`` in\n        ``FlatFLRWMixin``, which removes :math:`\\Omega_{de,0}`` as an\n        independent parameter (:math:`\\Omega_{de,0} \\equiv 1 - \\Omega_{tot}`).\n    unit : unit-like or None (optional, keyword-only)\n        The `~astropy.units.Unit` for the Parameter. If None (default) no\n        unit as assumed.\n    equivalencies : `~astropy.units.Equivalency` or sequence thereof\n        Unit equivalencies for this Parameter.\n    fvalidate : callable[[object, object, Any], Any] or str (optional, keyword-only)\n        Function to validate the Parameter value from instances of the\n        cosmology class. If \"default\", uses default validator to assign units\n        (with equivalencies), if Parameter has units.\n        For other valid string options, see ``Parameter._registry_validators``.\n        'fvalidate' can also be set through a decorator with\n        :meth:`~astropy.cosmology.Parameter.validator`.\n    fmt : str (optional, keyword-only)\n        `format` specification, used when making string representation\n        of the containing Cosmology.\n        See https://docs.python.org/3/library/string.html#formatspec\n    doc : str or None (optional, keyword-only)\n        Parameter description.\n\n    Examples\n    --------\n    For worked examples see :class:`~astropy.cosmology.FLRW`.\n    \"\"\"\n\n    _registry_validators = {}\n\n    def __init__(self, *, derived=False, unit=None, equivalencies=[],\n                 fvalidate=\"default\", fmt=\"\", doc=None):\n\n        # attribute name on container cosmology class.\n        # really set in __set_name__, but if Parameter is not init'ed as a\n        # descriptor this ensures that the attributes exist.\n        self._attr_name = self._attr_name_private = None\n\n        self._derived = derived\n        self._fmt = str(fmt)  # @property is `format_spec`\n        self.__doc__ = doc\n\n        # units stuff\n        self._unit = u.Unit(unit) if unit is not None else None\n        self._equivalencies = equivalencies\n\n        # Parse registered `fvalidate`\n        self._fvalidate_in = fvalidate  # Always store input fvalidate.\n        if callable(fvalidate):\n            pass\n        elif fvalidate in self._registry_validators:\n            fvalidate = self._registry_validators[fvalidate]\n        elif isinstance(fvalidate, str):\n            raise ValueError(\"`fvalidate`, if str, must be in \"\n                             f\"{self._registry_validators.keys()}\")\n        else:\n            raise TypeError(\"`fvalidate` must be a function or \"\n                            f\"{self._registry_validators.keys()}\")\n        self._fvalidate = fvalidate\n\n    def __set_name__(self, cosmo_cls, name):\n        # attribute name on container cosmology class\n        self._attr_name = name\n        self._attr_name_private = \"_\" + name\n\n    @property\n    def name(self):\n        \"\"\"Parameter name.\"\"\"\n        return self._attr_name\n\n    @property\n    def unit(self):\n        \"\"\"Parameter unit.\"\"\"\n        return self._unit\n\n    @property\n    def equivalencies(self):\n        \"\"\"Equivalencies used when initializing Parameter.\"\"\"\n        return self._equivalencies\n\n    @property\n    def format_spec(self):\n        \"\"\"String format specification.\"\"\"\n        return self._fmt\n\n    @property\n    def derived(self):\n        \"\"\"Whether the Parameter is derived; true parameters are not.\"\"\"\n        return self._derived\n\n    # -------------------------------------------\n    # descriptor and property-like methods\n\n    def __get__(self, cosmology, cosmo_cls=None):\n        # get from class\n        if cosmology is None:\n            return self\n        return getattr(cosmology, self._attr_name_private)\n\n    def __set__(self, cosmology, value):\n        \"\"\"Allows attribute setting once. Raises AttributeError subsequently.\"\"\"\n        # raise error if setting 2nd time.\n        if hasattr(cosmology, self._attr_name_private):\n            raise AttributeError(\"can't set attribute\")\n\n        # validate value, generally setting units if present\n        value = self.validate(cosmology, value)\n        setattr(cosmology, self._attr_name_private, value)\n\n    # -------------------------------------------\n    # validate value\n\n    @property\n    def fvalidate(self):\n        \"\"\"Function to validate a potential value of this Parameter..\"\"\"\n        return self._fvalidate\n\n    def validator(self, fvalidate):\n        \"\"\"Make new Parameter with custom ``fvalidate``.\n\n        Note: ``Parameter.fvalidator`` must be the top-most descriptor decorator.\n\n        Parameters\n        ----------\n        fvalidate : callable[[type, type, Any], Any]\n\n        Returns\n        -------\n        `~astropy.cosmology.Parameter`\n            Copy of this Parameter but with custom ``fvalidate``.\n        \"\"\"\n        return self.clone(fvalidate=fvalidate)\n\n    def validate(self, cosmology, value):\n        \"\"\"Run the validator on this Parameter.\n\n        Parameters\n        ----------\n        cosmology : `~astropy.cosmology.Cosmology` instance\n        value : Any\n            The object to validate.\n\n        Returns\n        -------\n        Any\n            The output of calling ``fvalidate(cosmology, self, value)``\n            (yes, that parameter order).\n        \"\"\"\n        return self.fvalidate(cosmology, self, value)\n\n    @classmethod\n    def register_validator(cls, key, fvalidate=None):\n        \"\"\"Decorator to register a new kind of validator function.\n\n        Parameters\n        ----------\n        key : str\n        fvalidate : callable[[object, object, Any], Any] or None, optional\n            Value validation function.\n\n        Returns\n        -------\n        ``validator`` or callable[``validator``]\n            if validator is None returns a function that takes and registers a\n            validator. This allows ``register_validator`` to be used as a\n            decorator.\n        \"\"\"\n        if key in cls._registry_validators:\n            raise KeyError(f\"validator {key!r} already registered with Parameter.\")\n\n        # fvalidate directly passed\n        if fvalidate is not None:\n            cls._registry_validators[key] = fvalidate\n            return fvalidate\n\n        # for use as a decorator\n        def register(fvalidate):\n            \"\"\"Register validator function.\n\n            Parameters\n            ----------\n            fvalidate : callable[[object, object, Any], Any]\n                Validation function.\n\n            Returns\n            -------\n            ``validator``\n            \"\"\"\n            cls._registry_validators[key] = fvalidate\n            return fvalidate\n\n        return register\n\n    # -------------------------------------------\n\n    def _get_init_arguments(self, processed=False):\n        \"\"\"Initialization arguments.\n\n        Parameters\n        ----------\n        processed : bool\n            Whether to more closely reproduce the input arguments (`False`,\n            default) or the processed arguments (`True`). The former is better\n            for string representations and round-tripping with ``eval(repr())``.\n\n        Returns\n        -------\n        dict[str, Any]\n        \"\"\"\n        # The keys are added in this order because `repr` prints them in order.\n        kw = {\"derived\": self.derived,\n              \"unit\": self.unit,\n              \"equivalencies\": self.equivalencies,\n              # Validator is always turned into a function, but for ``repr`` it's nice\n              # to know if it was originally a string.\n              \"fvalidate\": self.fvalidate if processed else self._fvalidate_in,\n              \"fmt\": self.format_spec,\n              \"doc\": self.__doc__}\n        return kw\n\n    def clone(self, **kw):\n        \"\"\"Clone this `Parameter`, changing any constructor argument.\n\n        Parameters\n        ----------\n        **kw\n            Passed to constructor. The current values, eg. ``fvalidate`` are\n            used as the default values, so an empty ``**kw`` is an exact copy.\n\n        Examples\n        --------\n        >>> p = Parameter()\n        >>> p\n        Parameter(derived=False, unit=None, equivalencies=[],\n                  fvalidate='default', fmt='', doc=None)\n\n        >>> p.clone(unit=\"km\")\n        Parameter(derived=False, unit=Unit(\"km\"), equivalencies=[],\n                  fvalidate='default', fmt='', doc=None)\n        \"\"\"\n        # Start with defaults, update from kw.\n        kwargs = {**self._get_init_arguments(), **kw}\n        # All initialization failures, like incorrect input are handled by init\n        cloned = type(self)(**kwargs)\n        # Transfer over the __set_name__ stuff. If `clone` is used to make a\n        # new descriptor, __set_name__ will be called again, overwriting this.\n        cloned._attr_name = self._attr_name\n        cloned._attr_name_private = self._attr_name_private\n\n        return cloned\n\n    def __eq__(self, other):\n        \"\"\"Check Parameter equality. Only equal to other Parameter objects.\n\n        Returns\n        -------\n        NotImplemented or True\n            `True` if equal, `NotImplemented` otherwise. This allows `other` to\n            be check for equality with ``other.__eq__``.\n\n        Examples\n        --------\n        >>> p1, p2 = Parameter(unit=\"km\"), Parameter(unit=\"km\")\n        >>> p1 == p2\n        True\n\n        >>> p3 = Parameter(unit=\"km / s\")\n        >>> p3 == p1\n        False\n\n        >>> p1 != 2\n        True\n        \"\"\"\n        if not isinstance(other, Parameter):\n            return NotImplemented\n        # Check equality on all `_init_arguments` & `name`.\n        # Need to compare the processed arguments because the inputs are many-\n        # to-one, e.g. `fvalidate` can be a string or the equivalent function.\n        return ((self._get_init_arguments(True) == other._get_init_arguments(True))\n                and (self.name == other.name))\n\n    def __repr__(self):\n        \"\"\"String representation.\n\n        ``eval(repr())`` should work, depending if contents like ``fvalidate``\n        can be similarly round-tripped.\n        \"\"\"\n        return \"Parameter({})\".format(\", \".join(f\"{k}={v!r}\" for k, v in\n                                                self._get_init_arguments().items()))"},{"col":4,"comment":"null","endLoc":77,"header":"def __init__(self, *, derived=False, unit=None, equivalencies=[],\n                 fvalidate=\"default\", fmt=\"\", doc=None)","id":13966,"name":"__init__","nodeType":"Function","startLoc":49,"text":"def __init__(self, *, derived=False, unit=None, equivalencies=[],\n                 fvalidate=\"default\", fmt=\"\", doc=None):\n\n        # attribute name on container cosmology class.\n        # really set in __set_name__, but if Parameter is not init'ed as a\n        # descriptor this ensures that the attributes exist.\n        self._attr_name = self._attr_name_private = None\n\n        self._derived = derived\n        self._fmt = str(fmt)  # @property is `format_spec`\n        self.__doc__ = doc\n\n        # units stuff\n        self._unit = u.Unit(unit) if unit is not None else None\n        self._equivalencies = equivalencies\n\n        # Parse registered `fvalidate`\n        self._fvalidate_in = fvalidate  # Always store input fvalidate.\n        if callable(fvalidate):\n            pass\n        elif fvalidate in self._registry_validators:\n            fvalidate = self._registry_validators[fvalidate]\n        elif isinstance(fvalidate, str):\n            raise ValueError(\"`fvalidate`, if str, must be in \"\n                             f\"{self._registry_validators.keys()}\")\n        else:\n            raise TypeError(\"`fvalidate` must be a function or \"\n                            f\"{self._registry_validators.keys()}\")\n        self._fvalidate = fvalidate"},{"col":0,"comment":"Convert quantities between redshift and distance.\n\n    Care should be taken to not misinterpret a relativistic, gravitational, etc\n    redshift as a cosmological one.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology`, str, or None, optional\n        A cosmology realization or built-in cosmology's name (e.g. 'Planck18').\n        If None, will use the default cosmology\n        (controlled by :class:`~astropy.cosmology.default_cosmology`).\n    kind : {'comoving', 'lookback', 'luminosity'} or None, optional\n        The distance type for the Equivalency.\n        Note this does NOT include the angular diameter distance as this\n        distance measure is not monotonic.\n    **atzkw\n        keyword arguments for :func:`~astropy.cosmology.z_at_value`\n\n    Returns\n    -------\n    `~astropy.units.equivalencies.Equivalency`\n        Equivalency between redshift and temperature.\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> import astropy.cosmology.units as cu\n    >>> from astropy.cosmology import WMAP9\n\n    >>> z = 1100 * cu.redshift\n    >>> z.to(u.Mpc, cu.redshift_distance(WMAP9, kind=\"comoving\"))  # doctest: +FLOAT_CMP\n    <Quantity 14004.03157418 Mpc>\n    ","endLoc":112,"header":"def redshift_distance(cosmology=None, kind=\"comoving\", **atzkw)","id":13967,"name":"redshift_distance","nodeType":"Function","startLoc":55,"text":"def redshift_distance(cosmology=None, kind=\"comoving\", **atzkw):\n    \"\"\"Convert quantities between redshift and distance.\n\n    Care should be taken to not misinterpret a relativistic, gravitational, etc\n    redshift as a cosmological one.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology`, str, or None, optional\n        A cosmology realization or built-in cosmology's name (e.g. 'Planck18').\n        If None, will use the default cosmology\n        (controlled by :class:`~astropy.cosmology.default_cosmology`).\n    kind : {'comoving', 'lookback', 'luminosity'} or None, optional\n        The distance type for the Equivalency.\n        Note this does NOT include the angular diameter distance as this\n        distance measure is not monotonic.\n    **atzkw\n        keyword arguments for :func:`~astropy.cosmology.z_at_value`\n\n    Returns\n    -------\n    `~astropy.units.equivalencies.Equivalency`\n        Equivalency between redshift and temperature.\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> import astropy.cosmology.units as cu\n    >>> from astropy.cosmology import WMAP9\n\n    >>> z = 1100 * cu.redshift\n    >>> z.to(u.Mpc, cu.redshift_distance(WMAP9, kind=\"comoving\"))  # doctest: +FLOAT_CMP\n    <Quantity 14004.03157418 Mpc>\n    \"\"\"\n    from astropy.cosmology import default_cosmology, z_at_value\n\n    # get cosmology: None -> default and process str / class\n    cosmology = cosmology if cosmology is not None else default_cosmology.get()\n    with default_cosmology.set(cosmology):  # if already cosmo, passes through\n        cosmology = default_cosmology.get()\n\n    allowed_kinds = ('comoving', 'lookback', 'luminosity')\n    if kind not in allowed_kinds:\n        raise ValueError(f\"`kind` is not one of {allowed_kinds}\")\n\n    method = getattr(cosmology, kind + \"_distance\")\n\n    def z_to_distance(z):\n        \"\"\"Redshift to distance.\"\"\"\n        return method(z)\n\n    def distance_to_z(d):\n        \"\"\"Distance to redshift.\"\"\"\n        return z_at_value(method, d << u.Mpc, **atzkw)\n\n    return u.Equivalency([(redshift, u.Mpc, z_to_distance, distance_to_z)],\n                         \"redshift_distance\",\n                         {'cosmology': cosmology, \"distance\": kind})"},{"col":0,"comment":"Find the redshift ``z`` at which ``func(z) = fval``.\n\n    This finds the redshift at which one of the cosmology functions or\n    methods (for example Planck13.distmod) is equal to a known value.\n\n    .. warning::\n       Make sure you understand the behavior of the function that you are\n       trying to invert! Depending on the cosmology, there may not be a\n       unique solution. For example, in the standard Lambda CDM cosmology,\n       there are two redshifts which give an angular diameter distance of\n       1500 Mpc, z ~ 0.7 and z ~ 3.8. To force ``z_at_value`` to find the\n       solution you are interested in, use the ``zmin`` and ``zmax`` keywords\n       to limit the search range (see the example below).\n\n    Parameters\n    ----------\n    func : function or method\n        A function that takes a redshift as input.\n\n    fval : `~astropy.units.Quantity`\n        The (scalar or array) value of ``func(z)`` to recover.\n\n    zmin : float or array-like['dimensionless'] or quantity-like, optional\n        The lower search limit for ``z``.  Beware of divergences\n        in some cosmological functions, such as distance moduli,\n        at z=0 (default 1e-8).\n\n    zmax : float or array-like['dimensionless'] or quantity-like, optional\n        The upper search limit for ``z`` (default 1000).\n\n    ztol : float or array-like['dimensionless'], optional\n        The relative error in ``z`` acceptable for convergence.\n\n    maxfun : int or array-like, optional\n        The maximum number of function evaluations allowed in the\n        optimization routine (default 500).\n\n    method : str or callable, optional\n        Type of solver to pass to the minimizer. The built-in options provided\n        by :func:`~scipy.optimize.minimize_scalar` are 'Brent' (default),\n        'Golden' and 'Bounded' with names case insensitive - see documentation\n        there for details. It also accepts a custom solver by passing any\n        user-provided callable object that meets the requirements listed\n        therein under the Notes on \"Custom minimizers\" - or in more detail in\n        :doc:`scipy:tutorial/optimize` - although their use is currently\n        untested.\n\n        .. versionadded:: 4.3\n\n    bracket : sequence or object array[sequence], optional\n        For methods 'Brent' and 'Golden', ``bracket`` defines the bracketing\n        interval and can either have three items (z1, z2, z3) so that\n        z1 < z2 < z3 and ``func(z2) < func (z1), func(z3)`` or two items z1\n        and z3 which are assumed to be a starting interval for a downhill\n        bracket search. For non-monotonic functions such as angular diameter\n        distance this may be used to start the search on the desired side of\n        the maximum, but see Examples below for usage notes.\n\n        .. versionadded:: 4.3\n\n    verbose : bool, optional\n        Print diagnostic output from solver (default `False`).\n\n        .. versionadded:: 4.3\n\n    Returns\n    -------\n    z : `~astropy.units.Quantity` ['redshift']\n        The redshift ``z`` satisfying ``zmin < z < zmax`` and ``func(z) =\n        fval`` within ``ztol``. Has units of cosmological redshift.\n\n    Warns\n    -----\n    :class:`~astropy.utils.exceptions.AstropyUserWarning`\n        If ``fval`` is not bracketed by ``func(zmin)=fval(zmin)`` and\n        ``func(zmax)=fval(zmax)``.\n\n        If the solver was not successful.\n\n    Raises\n    ------\n    :class:`astropy.cosmology.CosmologyError`\n        If the result is very close to either ``zmin`` or ``zmax``.\n    ValueError\n        If ``bracket`` is not an array nor a 2 (or 3) element sequence.\n    TypeError\n        If ``bracket`` is not an object array. 2 (or 3) element sequences will\n        be turned into object arrays, so this error should only occur if a\n        non-object array is used for ``bracket``.\n\n    Notes\n    -----\n    This works for any arbitrary input cosmology, but is inefficient if you\n    want to invert a large number of values for the same cosmology. In this\n    case, it is faster to instead generate an array of values at many\n    closely-spaced redshifts that cover the relevant redshift range, and then\n    use interpolation to find the redshift at each value you are interested\n    in. For example, to efficiently find the redshifts corresponding to 10^6\n    values of the distance modulus in a Planck13 cosmology, you could do the\n    following:\n\n    >>> import astropy.units as u\n    >>> from astropy.cosmology import Planck13, z_at_value\n\n    Generate 10^6 distance moduli between 24 and 44 for which we\n    want to find the corresponding redshifts:\n\n    >>> Dvals = (24 + np.random.rand(1000000) * 20) * u.mag\n\n    Make a grid of distance moduli covering the redshift range we\n    need using 50 equally log-spaced values between zmin and\n    zmax. We use log spacing to adequately sample the steep part of\n    the curve at low distance moduli:\n\n    >>> zmin = z_at_value(Planck13.distmod, Dvals.min())\n    >>> zmax = z_at_value(Planck13.distmod, Dvals.max())\n    >>> zgrid = np.geomspace(zmin, zmax, 50)\n    >>> Dgrid = Planck13.distmod(zgrid)\n\n    Finally interpolate to find the redshift at each distance modulus:\n\n    >>> zvals = np.interp(Dvals.value, Dgrid.value, zgrid)\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> from astropy.cosmology import Planck13, Planck18, z_at_value\n\n    The age and lookback time are monotonic with redshift, and so a\n    unique solution can be found:\n\n    >>> z_at_value(Planck13.age, 2 * u.Gyr)               # doctest: +FLOAT_CMP\n    <Quantity 3.19812268 redshift>\n\n    The angular diameter is not monotonic however, and there are two\n    redshifts that give a value of 1500 Mpc. You can use the zmin and\n    zmax keywords to find the one you are interested in:\n\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, zmax=1.5)                # doctest: +FLOAT_CMP\n    <Quantity 0.68044452 redshift>\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, zmin=2.5)                # doctest: +FLOAT_CMP\n    <Quantity 3.7823268 redshift>\n\n    Alternatively the ``bracket`` option may be used to initialize the\n    function solver on a desired region, but one should be aware that this\n    does not guarantee it will remain close to this starting bracket.\n    For the example of angular diameter distance, which has a maximum near\n    a redshift of 1.6 in this cosmology, defining a bracket on either side\n    of this maximum will often return a solution on the same side:\n\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, bracket=(1.0, 1.2))  # doctest: +FLOAT_CMP +IGNORE_WARNINGS\n    <Quantity 0.68044452 redshift>\n\n    But this is not ascertained especially if the bracket is chosen too wide\n    and/or too close to the turning point:\n\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, bracket=(0.1, 1.5))           # doctest: +SKIP\n    <Quantity 3.7823268 redshift>                              # doctest: +SKIP\n\n    Likewise, even for the same minimizer and same starting conditions different\n    results can be found depending on architecture or library versions:\n\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, bracket=(2.0, 2.5))           # doctest: +SKIP\n    <Quantity 3.7823268 redshift>                              # doctest: +SKIP\n\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, bracket=(2.0, 2.5))           # doctest: +SKIP\n    <Quantity 0.68044452 redshift>                             # doctest: +SKIP\n\n    It is therefore generally safer to use the 3-parameter variant to ensure\n    the solution stays within the bracketing limits:\n\n    >>> z_at_value(Planck18.angular_diameter_distance, 1500 * u.Mpc,\n    ...            bracket=(0.1, 1.0, 1.5))               # doctest: +FLOAT_CMP\n    <Quantity 0.68044452 redshift>\n\n    Also note that the luminosity distance and distance modulus (two\n    other commonly inverted quantities) are monotonic in flat and open\n    universes, but not in closed universes.\n\n    All the arguments except ``func``, ``method`` and ``verbose`` accept array\n    inputs. This does NOT use interpolation tables or any method to speed up\n    evaluations, rather providing a convenient means to broadcast arguments\n    over an element-wise scalar evaluation.\n\n    The most common use case for non-scalar input is to evaluate 'func' for an\n    array of ``fval``:\n\n    >>> z_at_value(Planck13.age, [2, 7] * u.Gyr)          # doctest: +FLOAT_CMP\n    <Quantity [3.19812061, 0.75620443] redshift>\n\n    ``fval`` can be any shape:\n\n    >>> z_at_value(Planck13.age, [[2, 7], [1, 3]]*u.Gyr)  # doctest: +FLOAT_CMP\n    <Quantity [[3.19812061, 0.75620443],\n               [5.67661227, 2.19131955]] redshift>\n\n    Other arguments can be arrays. For non-monotic functions  -- for example,\n    the angular diameter distance -- this can be useful to find all solutions.\n\n    >>> z_at_value(Planck13.angular_diameter_distance, 1500 * u.Mpc,\n    ...            zmin=[0, 2.5], zmax=[2, 4])            # doctest: +FLOAT_CMP\n    <Quantity [0.68127747, 3.79149062] redshift>\n\n    The ``bracket`` argument can likewise be be an array. However, since\n    bracket must already be a sequence (or None), it MUST be given as an\n    object `numpy.ndarray`. Importantly, the depth of the array must be such\n    that each bracket subsequence is an object. Errors or unexpected results\n    will happen otherwise. A convenient means to ensure the right depth is by\n    including a length-0 tuple as a bracket and then truncating the object\n    array to remove the placeholder. This can be seen in the following\n    example:\n\n    >>> bracket=np.array([(1.0, 1.2),(2.0, 2.5), ()], dtype=object)[:-1]\n    >>> z_at_value(Planck18.angular_diameter_distance, 1500 * u.Mpc,\n    ...            bracket=bracket)  # doctest: +SKIP\n    <Quantity [0.68044452, 3.7823268] redshift>\n    ","endLoc":366,"header":"def z_at_value(func, fval, zmin=1e-8, zmax=1000, ztol=1e-8, maxfun=500,\n               method='Brent', bracket=None, verbose=False)","id":13968,"name":"z_at_value","nodeType":"Function","startLoc":104,"text":"def z_at_value(func, fval, zmin=1e-8, zmax=1000, ztol=1e-8, maxfun=500,\n               method='Brent', bracket=None, verbose=False):\n    \"\"\"Find the redshift ``z`` at which ``func(z) = fval``.\n\n    This finds the redshift at which one of the cosmology functions or\n    methods (for example Planck13.distmod) is equal to a known value.\n\n    .. warning::\n       Make sure you understand the behavior of the function that you are\n       trying to invert! Depending on the cosmology, there may not be a\n       unique solution. For example, in the standard Lambda CDM cosmology,\n       there are two redshifts which give an angular diameter distance of\n       1500 Mpc, z ~ 0.7 and z ~ 3.8. To force ``z_at_value`` to find the\n       solution you are interested in, use the ``zmin`` and ``zmax`` keywords\n       to limit the search range (see the example below).\n\n    Parameters\n    ----------\n    func : function or method\n        A function that takes a redshift as input.\n\n    fval : `~astropy.units.Quantity`\n        The (scalar or array) value of ``func(z)`` to recover.\n\n    zmin : float or array-like['dimensionless'] or quantity-like, optional\n        The lower search limit for ``z``.  Beware of divergences\n        in some cosmological functions, such as distance moduli,\n        at z=0 (default 1e-8).\n\n    zmax : float or array-like['dimensionless'] or quantity-like, optional\n        The upper search limit for ``z`` (default 1000).\n\n    ztol : float or array-like['dimensionless'], optional\n        The relative error in ``z`` acceptable for convergence.\n\n    maxfun : int or array-like, optional\n        The maximum number of function evaluations allowed in the\n        optimization routine (default 500).\n\n    method : str or callable, optional\n        Type of solver to pass to the minimizer. The built-in options provided\n        by :func:`~scipy.optimize.minimize_scalar` are 'Brent' (default),\n        'Golden' and 'Bounded' with names case insensitive - see documentation\n        there for details. It also accepts a custom solver by passing any\n        user-provided callable object that meets the requirements listed\n        therein under the Notes on \"Custom minimizers\" - or in more detail in\n        :doc:`scipy:tutorial/optimize` - although their use is currently\n        untested.\n\n        .. versionadded:: 4.3\n\n    bracket : sequence or object array[sequence], optional\n        For methods 'Brent' and 'Golden', ``bracket`` defines the bracketing\n        interval and can either have three items (z1, z2, z3) so that\n        z1 < z2 < z3 and ``func(z2) < func (z1), func(z3)`` or two items z1\n        and z3 which are assumed to be a starting interval for a downhill\n        bracket search. For non-monotonic functions such as angular diameter\n        distance this may be used to start the search on the desired side of\n        the maximum, but see Examples below for usage notes.\n\n        .. versionadded:: 4.3\n\n    verbose : bool, optional\n        Print diagnostic output from solver (default `False`).\n\n        .. versionadded:: 4.3\n\n    Returns\n    -------\n    z : `~astropy.units.Quantity` ['redshift']\n        The redshift ``z`` satisfying ``zmin < z < zmax`` and ``func(z) =\n        fval`` within ``ztol``. Has units of cosmological redshift.\n\n    Warns\n    -----\n    :class:`~astropy.utils.exceptions.AstropyUserWarning`\n        If ``fval`` is not bracketed by ``func(zmin)=fval(zmin)`` and\n        ``func(zmax)=fval(zmax)``.\n\n        If the solver was not successful.\n\n    Raises\n    ------\n    :class:`astropy.cosmology.CosmologyError`\n        If the result is very close to either ``zmin`` or ``zmax``.\n    ValueError\n        If ``bracket`` is not an array nor a 2 (or 3) element sequence.\n    TypeError\n        If ``bracket`` is not an object array. 2 (or 3) element sequences will\n        be turned into object arrays, so this error should only occur if a\n        non-object array is used for ``bracket``.\n\n    Notes\n    -----\n    This works for any arbitrary input cosmology, but is inefficient if you\n    want to invert a large number of values for the same cosmology. In this\n    case, it is faster to instead generate an array of values at many\n    closely-spaced redshifts that cover the relevant redshift range, and then\n    use interpolation to find the redshift at each value you are interested\n    in. For example, to efficiently find the redshifts corresponding to 10^6\n    values of the distance modulus in a Planck13 cosmology, you could do the\n    following:\n\n    >>> import astropy.units as u\n    >>> from astropy.cosmology import Planck13, z_at_value\n\n    Generate 10^6 distance moduli between 24 and 44 for which we\n    want to find the corresponding redshifts:\n\n    >>> Dvals = (24 + np.random.rand(1000000) * 20) * u.mag\n\n    Make a grid of distance moduli covering the redshift range we\n    need using 50 equally log-spaced values between zmin and\n    zmax. We use log spacing to adequately sample the steep part of\n    the curve at low distance moduli:\n\n    >>> zmin = z_at_value(Planck13.distmod, Dvals.min())\n    >>> zmax = z_at_value(Planck13.distmod, Dvals.max())\n    >>> zgrid = np.geomspace(zmin, zmax, 50)\n    >>> Dgrid = Planck13.distmod(zgrid)\n\n    Finally interpolate to find the redshift at each distance modulus:\n\n    >>> zvals = np.interp(Dvals.value, Dgrid.value, zgrid)\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> from astropy.cosmology import Planck13, Planck18, z_at_value\n\n    The age and lookback time are monotonic with redshift, and so a\n    unique solution can be found:\n\n    >>> z_at_value(Planck13.age, 2 * u.Gyr)               # doctest: +FLOAT_CMP\n    <Quantity 3.19812268 redshift>\n\n    The angular diameter is not monotonic however, and there are two\n    redshifts that give a value of 1500 Mpc. You can use the zmin and\n    zmax keywords to find the one you are interested in:\n\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, zmax=1.5)                # doctest: +FLOAT_CMP\n    <Quantity 0.68044452 redshift>\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, zmin=2.5)                # doctest: +FLOAT_CMP\n    <Quantity 3.7823268 redshift>\n\n    Alternatively the ``bracket`` option may be used to initialize the\n    function solver on a desired region, but one should be aware that this\n    does not guarantee it will remain close to this starting bracket.\n    For the example of angular diameter distance, which has a maximum near\n    a redshift of 1.6 in this cosmology, defining a bracket on either side\n    of this maximum will often return a solution on the same side:\n\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, bracket=(1.0, 1.2))  # doctest: +FLOAT_CMP +IGNORE_WARNINGS\n    <Quantity 0.68044452 redshift>\n\n    But this is not ascertained especially if the bracket is chosen too wide\n    and/or too close to the turning point:\n\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, bracket=(0.1, 1.5))           # doctest: +SKIP\n    <Quantity 3.7823268 redshift>                              # doctest: +SKIP\n\n    Likewise, even for the same minimizer and same starting conditions different\n    results can be found depending on architecture or library versions:\n\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, bracket=(2.0, 2.5))           # doctest: +SKIP\n    <Quantity 3.7823268 redshift>                              # doctest: +SKIP\n\n    >>> z_at_value(Planck18.angular_diameter_distance,\n    ...            1500 * u.Mpc, bracket=(2.0, 2.5))           # doctest: +SKIP\n    <Quantity 0.68044452 redshift>                             # doctest: +SKIP\n\n    It is therefore generally safer to use the 3-parameter variant to ensure\n    the solution stays within the bracketing limits:\n\n    >>> z_at_value(Planck18.angular_diameter_distance, 1500 * u.Mpc,\n    ...            bracket=(0.1, 1.0, 1.5))               # doctest: +FLOAT_CMP\n    <Quantity 0.68044452 redshift>\n\n    Also note that the luminosity distance and distance modulus (two\n    other commonly inverted quantities) are monotonic in flat and open\n    universes, but not in closed universes.\n\n    All the arguments except ``func``, ``method`` and ``verbose`` accept array\n    inputs. This does NOT use interpolation tables or any method to speed up\n    evaluations, rather providing a convenient means to broadcast arguments\n    over an element-wise scalar evaluation.\n\n    The most common use case for non-scalar input is to evaluate 'func' for an\n    array of ``fval``:\n\n    >>> z_at_value(Planck13.age, [2, 7] * u.Gyr)          # doctest: +FLOAT_CMP\n    <Quantity [3.19812061, 0.75620443] redshift>\n\n    ``fval`` can be any shape:\n\n    >>> z_at_value(Planck13.age, [[2, 7], [1, 3]]*u.Gyr)  # doctest: +FLOAT_CMP\n    <Quantity [[3.19812061, 0.75620443],\n               [5.67661227, 2.19131955]] redshift>\n\n    Other arguments can be arrays. For non-monotic functions  -- for example,\n    the angular diameter distance -- this can be useful to find all solutions.\n\n    >>> z_at_value(Planck13.angular_diameter_distance, 1500 * u.Mpc,\n    ...            zmin=[0, 2.5], zmax=[2, 4])            # doctest: +FLOAT_CMP\n    <Quantity [0.68127747, 3.79149062] redshift>\n\n    The ``bracket`` argument can likewise be be an array. However, since\n    bracket must already be a sequence (or None), it MUST be given as an\n    object `numpy.ndarray`. Importantly, the depth of the array must be such\n    that each bracket subsequence is an object. Errors or unexpected results\n    will happen otherwise. A convenient means to ensure the right depth is by\n    including a length-0 tuple as a bracket and then truncating the object\n    array to remove the placeholder. This can be seen in the following\n    example:\n\n    >>> bracket=np.array([(1.0, 1.2),(2.0, 2.5), ()], dtype=object)[:-1]\n    >>> z_at_value(Planck18.angular_diameter_distance, 1500 * u.Mpc,\n    ...            bracket=bracket)  # doctest: +SKIP\n    <Quantity [0.68044452, 3.7823268] redshift>\n    \"\"\"\n    # `fval` can be a Quantity, which isn't (yet) compatible w/ `numpy.nditer`\n    # so we strip it of units for broadcasting and restore the units when\n    # passing the elements to `_z_at_scalar_value`.\n    fval = np.asanyarray(fval)\n    unit = getattr(fval, 'unit', 1)  # can be unitless\n    zmin = Quantity(zmin, cu.redshift).value  # must be unitless\n    zmax = Quantity(zmax, cu.redshift).value\n\n    # bracket must be an object array (assumed to be correct) or a 'scalar'\n    # bracket: 2 or 3 elt sequence\n    if not isinstance(bracket, np.ndarray):  # 'scalar' bracket\n        if bracket is not None and len(bracket) not in (2, 3):\n            raise ValueError(\"`bracket` is not an array \"\n                             \"nor a 2 (or 3) element sequence.\")\n        else:  # munge bracket into a 1-elt object array\n            bracket = np.array([bracket, ()], dtype=object)[:1].squeeze()\n    if bracket.dtype != np.object_:\n        raise TypeError(f\"`bracket` has dtype {bracket.dtype}, not 'O'\")\n\n    # make multi-dimensional iterator for all but `method`, `verbose`\n    with np.nditer(\n        [fval, zmin, zmax, ztol, maxfun, bracket, None],\n        flags = ['refs_ok'],\n        op_flags = [*[['readonly']] * 6,  # ← inputs  output ↓\n                    ['writeonly', 'allocate', 'no_subtype']],\n        op_dtypes = (*(None,)*6, fval.dtype),\n        casting=\"no\",\n    ) as it:\n        for fv, zmn, zmx, zt, mfe, bkt, zs in it:  # ← eltwise unpack & eval ↓\n            zs[...] = _z_at_scalar_value(func, fv * unit, zmin=zmn, zmax=zmx,\n                                         ztol=zt, maxfun=mfe, bracket=bkt.item(),\n                                         # not broadcasted\n                                         method=method, verbose=verbose)\n        # since bracket is an object array, the output will be too, so it is\n        # cast to the same type as the function value.\n        result = it.operands[-1]  # zs\n\n    return result << cu.redshift"},{"col":4,"comment":"null","endLoc":82,"header":"def __set_name__(self, cosmo_cls, name)","id":13969,"name":"__set_name__","nodeType":"Function","startLoc":79,"text":"def __set_name__(self, cosmo_cls, name):\n        # attribute name on container cosmology class\n        self._attr_name = name\n        self._attr_name_private = \"_\" + name"},{"col":4,"comment":"Parameter name.","endLoc":87,"header":"@property\n    def name(self)","id":13970,"name":"name","nodeType":"Function","startLoc":84,"text":"@property\n    def name(self):\n        \"\"\"Parameter name.\"\"\"\n        return self._attr_name"},{"col":4,"comment":"Parameter unit.","endLoc":92,"header":"@property\n    def unit(self)","id":13971,"name":"unit","nodeType":"Function","startLoc":89,"text":"@property\n    def unit(self):\n        \"\"\"Parameter unit.\"\"\"\n        return self._unit"},{"col":4,"comment":"Equivalencies used when initializing Parameter.","endLoc":97,"header":"@property\n    def equivalencies(self)","id":13972,"name":"equivalencies","nodeType":"Function","startLoc":94,"text":"@property\n    def equivalencies(self):\n        \"\"\"Equivalencies used when initializing Parameter.\"\"\"\n        return self._equivalencies"},{"col":4,"comment":"String format specification.","endLoc":102,"header":"@property\n    def format_spec(self)","id":13973,"name":"format_spec","nodeType":"Function","startLoc":99,"text":"@property\n    def format_spec(self):\n        \"\"\"String format specification.\"\"\"\n        return self._fmt"},{"col":4,"comment":"Whether the Parameter is derived; true parameters are not.","endLoc":107,"header":"@property\n    def derived(self)","id":13974,"name":"derived","nodeType":"Function","startLoc":104,"text":"@property\n    def derived(self):\n        \"\"\"Whether the Parameter is derived; true parameters are not.\"\"\"\n        return self._derived"},{"col":4,"comment":"null","endLoc":116,"header":"def __get__(self, cosmology, cosmo_cls=None)","id":13975,"name":"__get__","nodeType":"Function","startLoc":112,"text":"def __get__(self, cosmology, cosmo_cls=None):\n        # get from class\n        if cosmology is None:\n            return self\n        return getattr(cosmology, self._attr_name_private)"},{"col":4,"comment":"Allows attribute setting once. Raises AttributeError subsequently.","endLoc":126,"header":"def __set__(self, cosmology, value)","id":13976,"name":"__set__","nodeType":"Function","startLoc":118,"text":"def __set__(self, cosmology, value):\n        \"\"\"Allows attribute setting once. Raises AttributeError subsequently.\"\"\"\n        # raise error if setting 2nd time.\n        if hasattr(cosmology, self._attr_name_private):\n            raise AttributeError(\"can't set attribute\")\n\n        # validate value, generally setting units if present\n        value = self.validate(cosmology, value)\n        setattr(cosmology, self._attr_name_private, value)"},{"col":4,"comment":"Run the validator on this Parameter.\n\n        Parameters\n        ----------\n        cosmology : `~astropy.cosmology.Cosmology` instance\n        value : Any\n            The object to validate.\n\n        Returns\n        -------\n        Any\n            The output of calling ``fvalidate(cosmology, self, value)``\n            (yes, that parameter order).\n        ","endLoc":167,"header":"def validate(self, cosmology, value)","id":13977,"name":"validate","nodeType":"Function","startLoc":152,"text":"def validate(self, cosmology, value):\n        \"\"\"Run the validator on this Parameter.\n\n        Parameters\n        ----------\n        cosmology : `~astropy.cosmology.Cosmology` instance\n        value : Any\n            The object to validate.\n\n        Returns\n        -------\n        Any\n            The output of calling ``fvalidate(cosmology, self, value)``\n            (yes, that parameter order).\n        \"\"\"\n        return self.fvalidate(cosmology, self, value)"},{"className":"Cosmology","col":0,"comment":"Base-class for all Cosmologies.\n\n    Parameters\n    ----------\n    *args\n        Arguments into the cosmology; used by subclasses, not this base class.\n    name : str or None (optional, keyword-only)\n        The name of the cosmology.\n    meta : dict or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n    **kwargs\n        Arguments into the cosmology; used by subclasses, not this base class.\n\n    Notes\n    -----\n    Class instances are static -- you cannot (and should not) change the values\n    of the parameters.  That is, all of the above attributes (except meta) are\n    read only.\n\n    For details on how to create performant custom subclasses, see the\n    documentation on :ref:`astropy-cosmology-fast-integrals`.\n    ","endLoc":369,"id":13978,"nodeType":"Class","startLoc":37,"text":"class Cosmology(metaclass=abc.ABCMeta):\n    \"\"\"Base-class for all Cosmologies.\n\n    Parameters\n    ----------\n    *args\n        Arguments into the cosmology; used by subclasses, not this base class.\n    name : str or None (optional, keyword-only)\n        The name of the cosmology.\n    meta : dict or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n    **kwargs\n        Arguments into the cosmology; used by subclasses, not this base class.\n\n    Notes\n    -----\n    Class instances are static -- you cannot (and should not) change the values\n    of the parameters.  That is, all of the above attributes (except meta) are\n    read only.\n\n    For details on how to create performant custom subclasses, see the\n    documentation on :ref:`astropy-cosmology-fast-integrals`.\n    \"\"\"\n\n    meta = MetaData()\n\n    # Unified I/O object interchange methods\n    from_format = UnifiedReadWriteMethod(CosmologyFromFormat)\n    to_format = UnifiedReadWriteMethod(CosmologyToFormat)\n\n    # Unified I/O read and write methods\n    read = UnifiedReadWriteMethod(CosmologyRead)\n    write = UnifiedReadWriteMethod(CosmologyWrite)\n\n    # Parameters\n    __parameters__ = ()\n    __all_parameters__ = ()\n\n    # ---------------------------------------------------------------\n\n    def __init_subclass__(cls):\n        super().__init_subclass__()\n\n        # -------------------\n        # Parameters\n\n        # Get parameters that are still Parameters, either in this class or above.\n        parameters = []\n        derived_parameters = []\n        for n in cls.__parameters__:\n            p = getattr(cls, n)\n            if isinstance(p, Parameter):\n                derived_parameters.append(n) if p.derived else parameters.append(n)\n\n        # Add new parameter definitions\n        for n, v in cls.__dict__.items():\n            if n in parameters or n.startswith(\"_\") or not isinstance(v, Parameter):\n                continue\n            derived_parameters.append(n) if v.derived else parameters.append(n)\n\n        # reorder to match signature\n        ordered = [parameters.pop(parameters.index(n))\n                   for n in cls._init_signature.parameters.keys()\n                   if n in parameters]\n        parameters = ordered + parameters  # place \"unordered\" at the end\n        cls.__parameters__ = tuple(parameters)\n        cls.__all_parameters__ = cls.__parameters__ + tuple(derived_parameters)\n\n        # -------------------\n        # register as a Cosmology subclass\n        _COSMOLOGY_CLASSES[cls.__qualname__] = cls\n\n    @classproperty(lazy=True)\n    def _init_signature(cls):\n        \"\"\"Initialization signature (without 'self').\"\"\"\n        # get signature, dropping \"self\" by taking arguments [1:]\n        sig = inspect.signature(cls.__init__)\n        sig = sig.replace(parameters=list(sig.parameters.values())[1:])\n        return sig\n\n    # ---------------------------------------------------------------\n\n    def __init__(self, name=None, meta=None):\n        self._name = str(name) if name is not None else name\n        self.meta.update(meta or {})\n\n    @property\n    def name(self):\n        \"\"\"The name of the Cosmology instance.\"\"\"\n        return self._name\n\n    @property\n    @abc.abstractmethod\n    def is_flat(self):\n        \"\"\"\n        Return bool; `True` if the cosmology is flat.\n        This is abstract and must be defined in subclasses.\n        \"\"\"\n        raise NotImplementedError(\"is_flat is not implemented\")\n\n    def clone(self, *, meta=None, **kwargs):\n        \"\"\"Returns a copy of this object with updated parameters, as specified.\n\n        This cannot be used to change the type of the cosmology, so ``clone()``\n        cannot be used to change between flat and non-flat cosmologies.\n\n        Parameters\n        ----------\n        meta : mapping or None (optional, keyword-only)\n            Metadata that will update the current metadata.\n        **kwargs\n            Cosmology parameter (and name) modifications.\n            If any parameter is changed and a new name is not given, the name\n            will be set to \"[old name] (modified)\".\n\n        Returns\n        -------\n        newcosmo : `~astropy.cosmology.Cosmology` subclass instance\n            A new instance of this class with updated parameters as specified.\n            If no modifications are requested, then a reference to this object\n            is returned instead of copy.\n\n        Examples\n        --------\n        To make a copy of the ``Planck13`` cosmology with a different matter\n        density (``Om0``), and a new name:\n\n            >>> from astropy.cosmology import Planck13\n            >>> newcosmo = Planck13.clone(name=\"Modified Planck 2013\", Om0=0.35)\n\n        If no name is specified, the new name will note the modification.\n\n            >>> Planck13.clone(Om0=0.35).name\n            'Planck13 (modified)'\n        \"\"\"\n        # Quick return check, taking advantage of the Cosmology immutability.\n        if meta is None and not kwargs:\n            return self\n\n        # There are changed parameter or metadata values.\n        # The name needs to be changed accordingly, if it wasn't already.\n        kwargs.setdefault(\"name\", (self.name + \" (modified)\"\n                                   if self.name is not None else None))\n\n        # mix new meta into existing, preferring the former.\n        new_meta = {**self.meta, **(meta or {})}\n        # Mix kwargs into initial arguments, preferring the former.\n        new_init = {**self._init_arguments, \"meta\": new_meta, **kwargs}\n        # Create BoundArgument to handle args versus kwargs.\n        # This also handles all errors from mismatched arguments\n        ba = self._init_signature.bind_partial(**new_init)\n        # Return new instance, respecting args vs kwargs\n        return self.__class__(*ba.args, **ba.kwargs)\n\n    @property\n    def _init_arguments(self):\n        # parameters\n        kw = {n: getattr(self, n) for n in self.__parameters__}\n\n        # other info\n        kw[\"name\"] = self.name\n        kw[\"meta\"] = self.meta\n\n        return kw\n\n    # ---------------------------------------------------------------\n    # comparison methods\n\n    def is_equivalent(self, other, *, format=False):\n        r\"\"\"Check equivalence between Cosmologies.\n\n        Two cosmologies may be equivalent even if not the same class.\n        For example, an instance of ``LambdaCDM`` might have :math:`\\Omega_0=1`\n        and :math:`\\Omega_k=0` and therefore be flat, like ``FlatLambdaCDM``.\n\n        Parameters\n        ----------\n        other : `~astropy.cosmology.Cosmology` subclass instance\n            The object in which to compare.\n        format : bool or None or str, optional keyword-only\n            Whether to allow, before equivalence is checked, the object to be\n            converted to a |Cosmology|. This allows, e.g. a |Table| to be\n            equivalent to a Cosmology.\n            `False` (default) will not allow conversion. `True` or `None` will,\n            and will use the auto-identification to try to infer the correct\n            format. A `str` is assumed to be the correct format to use when\n            converting.\n\n        Returns\n        -------\n        bool\n            True if cosmologies are equivalent, False otherwise.\n\n        Examples\n        --------\n        Two cosmologies may be equivalent even if not of the same class.\n        In this examples the ``LambdaCDM`` has ``Ode0`` set to the same value\n        calculated in ``FlatLambdaCDM``.\n\n            >>> import astropy.units as u\n            >>> from astropy.cosmology import LambdaCDM, FlatLambdaCDM\n            >>> cosmo1 = LambdaCDM(70 * (u.km/u.s/u.Mpc), 0.3, 0.7)\n            >>> cosmo2 = FlatLambdaCDM(70 * (u.km/u.s/u.Mpc), 0.3)\n            >>> cosmo1.is_equivalent(cosmo2)\n            True\n\n        While in this example, the cosmologies are not equivalent.\n\n            >>> cosmo3 = FlatLambdaCDM(70 * (u.km/u.s/u.Mpc), 0.3, Tcmb0=3 * u.K)\n            >>> cosmo3.is_equivalent(cosmo2)\n            False\n\n        Also, using the keyword argument, the notion of equivalence is extended\n        to any Python object that can be converted to a |Cosmology|.\n\n            >>> from astropy.cosmology import Planck18\n            >>> tbl = Planck18.to_format(\"astropy.table\")\n            >>> Planck18.is_equivalent(tbl, format=True)\n            True\n\n        The list of valid formats, e.g. the |Table| in this example, may be\n        checked with ``Cosmology.from_format.list_formats()``.\n\n        As can be seen in the list of formats, not all formats can be\n        auto-identified by ``Cosmology.from_format.registry``. Objects of\n        these kinds can still be checked for equivalence, but the correct\n        format string must be used.\n\n            >>> tbl = Planck18.to_format(\"yaml\")\n            >>> Planck18.is_equivalent(tbl, format=\"yaml\")\n            True\n        \"\"\"\n        # Allow for different formats to be considered equivalent.\n        if format is not False:\n            format = None if format is True else format  # str->str, None/True->None\n            try:\n                other = Cosmology.from_format(other, format=format)\n            except Exception:  # TODO! should enforce only TypeError\n                return False\n\n        # The options are: 1) same class & parameters; 2) same class, different\n        # parameters; 3) different classes, equivalent parameters; 4) different\n        # classes, different parameters. (1) & (3) => True, (2) & (4) => False.\n        equiv = self.__equiv__(other)\n        if equiv is NotImplemented and hasattr(other, \"__equiv__\"):\n            equiv = other.__equiv__(self)  # that failed, try from 'other'\n\n        return equiv if equiv is not NotImplemented else False\n\n    def __equiv__(self, other):\n        \"\"\"Cosmology equivalence. Use ``.is_equivalent()`` for actual check!\n\n        Parameters\n        ----------\n        other : `~astropy.cosmology.Cosmology` subclass instance\n            The object in which to compare.\n\n        Returns\n        -------\n        bool or `NotImplemented`\n            `NotImplemented` if 'other' is from a different class.\n            `True` if 'other' is of the same class and has matching parameters\n            and parameter values. `False` otherwise.\n        \"\"\"\n        if other.__class__ is not self.__class__:\n            return NotImplemented  # allows other.__equiv__\n\n        # check all parameters in 'other' match those in 'self' and 'other' has\n        # no extra parameters (latter part should never happen b/c same class)\n        params_eq = (set(self.__all_parameters__) == set(other.__all_parameters__)\n                     and all(np.all(getattr(self, k) == getattr(other, k))\n                             for k in self.__all_parameters__))\n        return params_eq\n\n    def __eq__(self, other):\n        \"\"\"Check equality between Cosmologies.\n\n        Checks the Parameters and immutable fields (i.e. not \"meta\").\n\n        Parameters\n        ----------\n        other : `~astropy.cosmology.Cosmology` subclass instance\n            The object in which to compare.\n\n        Returns\n        -------\n        bool\n            `True` if Parameters and names are the same, `False` otherwise.\n        \"\"\"\n        if other.__class__ is not self.__class__:\n            return NotImplemented  # allows other.__eq__\n\n        # check all parameters in 'other' match those in 'self'\n        equivalent = self.__equiv__(other)\n        # non-Parameter checks: name\n        name_eq = (self.name == other.name)\n\n        return equivalent and name_eq\n\n    # ---------------------------------------------------------------\n\n    def __repr__(self):\n        ps = {k: getattr(self, k) for k in self.__parameters__}  # values\n        cps = {k: getattr(self.__class__, k) for k in self.__parameters__}  # Parameter objects\n\n        namelead = f\"{self.__class__.__qualname__}(\"\n        if self.name is not None:\n            namelead += f\"name=\\\"{self.name}\\\", \"\n        # nicely formatted parameters\n        fmtps = (k + '=' + format(v, cps[k].format_spec if v is not None else '')\n                 for k, v in ps.items())\n\n        return namelead + \", \".join(fmtps) + \")\"\n\n    def __astropy_table__(self, cls, copy, **kwargs):\n        \"\"\"Return a `~astropy.table.Table` of type ``cls``.\n\n        Parameters\n        ----------\n        cls : type\n            Astropy ``Table`` class or subclass.\n        copy : bool\n            Ignored.\n        **kwargs : dict, optional\n            Additional keyword arguments. Passed to ``self.to_format()``.\n            See ``Cosmology.to_format.help(\"astropy.table\")`` for allowed kwargs.\n\n        Returns\n        -------\n        `astropy.table.Table` or subclass instance\n            Instance of type ``cls``.\n        \"\"\"\n        return self.to_format(\"astropy.table\", cls=cls, **kwargs)"},{"col":4,"comment":"Function to validate a potential value of this Parameter..","endLoc":134,"header":"@property\n    def fvalidate(self)","id":13979,"name":"fvalidate","nodeType":"Function","startLoc":131,"text":"@property\n    def fvalidate(self):\n        \"\"\"Function to validate a potential value of this Parameter..\"\"\"\n        return self._fvalidate"},{"col":4,"comment":"null","endLoc":107,"header":"def __init_subclass__(cls)","id":13980,"name":"__init_subclass__","nodeType":"Function","startLoc":77,"text":"def __init_subclass__(cls):\n        super().__init_subclass__()\n\n        # -------------------\n        # Parameters\n\n        # Get parameters that are still Parameters, either in this class or above.\n        parameters = []\n        derived_parameters = []\n        for n in cls.__parameters__:\n            p = getattr(cls, n)\n            if isinstance(p, Parameter):\n                derived_parameters.append(n) if p.derived else parameters.append(n)\n\n        # Add new parameter definitions\n        for n, v in cls.__dict__.items():\n            if n in parameters or n.startswith(\"_\") or not isinstance(v, Parameter):\n                continue\n            derived_parameters.append(n) if v.derived else parameters.append(n)\n\n        # reorder to match signature\n        ordered = [parameters.pop(parameters.index(n))\n                   for n in cls._init_signature.parameters.keys()\n                   if n in parameters]\n        parameters = ordered + parameters  # place \"unordered\" at the end\n        cls.__parameters__ = tuple(parameters)\n        cls.__all_parameters__ = cls.__parameters__ + tuple(derived_parameters)\n\n        # -------------------\n        # register as a Cosmology subclass\n        _COSMOLOGY_CLASSES[cls.__qualname__] = cls"},{"col":4,"comment":"Make new Parameter with custom ``fvalidate``.\n\n        Note: ``Parameter.fvalidator`` must be the top-most descriptor decorator.\n\n        Parameters\n        ----------\n        fvalidate : callable[[type, type, Any], Any]\n\n        Returns\n        -------\n        `~astropy.cosmology.Parameter`\n            Copy of this Parameter but with custom ``fvalidate``.\n        ","endLoc":150,"header":"def validator(self, fvalidate)","id":13981,"name":"validator","nodeType":"Function","startLoc":136,"text":"def validator(self, fvalidate):\n        \"\"\"Make new Parameter with custom ``fvalidate``.\n\n        Note: ``Parameter.fvalidator`` must be the top-most descriptor decorator.\n\n        Parameters\n        ----------\n        fvalidate : callable[[type, type, Any], Any]\n\n        Returns\n        -------\n        `~astropy.cosmology.Parameter`\n            Copy of this Parameter but with custom ``fvalidate``.\n        \"\"\"\n        return self.clone(fvalidate=fvalidate)"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":13982,"name":"__all__","nodeType":"Attribute","startLoc":16,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":13983,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":18,"text":"__doctest_requires__"},{"col":0,"comment":"","endLoc":4,"header":"funcs.py#<anonymous>","id":13984,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nConvenience functions for `astropy.cosmology`.\n\"\"\"\n\n__all__ = ['z_at_value']\n\n__doctest_requires__ = {'*': ['scipy']}"},{"col":4,"comment":"Clone this `Parameter`, changing any constructor argument.\n\n        Parameters\n        ----------\n        **kw\n            Passed to constructor. The current values, eg. ``fvalidate`` are\n            used as the default values, so an empty ``**kw`` is an exact copy.\n\n        Examples\n        --------\n        >>> p = Parameter()\n        >>> p\n        Parameter(derived=False, unit=None, equivalencies=[],\n                  fvalidate='default', fmt='', doc=None)\n\n        >>> p.clone(unit=\"km\")\n        Parameter(derived=False, unit=Unit(\"km\"), equivalencies=[],\n                  fvalidate='default', fmt='', doc=None)\n        ","endLoc":268,"header":"def clone(self, **kw)","id":13985,"name":"clone","nodeType":"Function","startLoc":239,"text":"def clone(self, **kw):\n        \"\"\"Clone this `Parameter`, changing any constructor argument.\n\n        Parameters\n        ----------\n        **kw\n            Passed to constructor. The current values, eg. ``fvalidate`` are\n            used as the default values, so an empty ``**kw`` is an exact copy.\n\n        Examples\n        --------\n        >>> p = Parameter()\n        >>> p\n        Parameter(derived=False, unit=None, equivalencies=[],\n                  fvalidate='default', fmt='', doc=None)\n\n        >>> p.clone(unit=\"km\")\n        Parameter(derived=False, unit=Unit(\"km\"), equivalencies=[],\n                  fvalidate='default', fmt='', doc=None)\n        \"\"\"\n        # Start with defaults, update from kw.\n        kwargs = {**self._get_init_arguments(), **kw}\n        # All initialization failures, like incorrect input are handled by init\n        cloned = type(self)(**kwargs)\n        # Transfer over the __set_name__ stuff. If `clone` is used to make a\n        # new descriptor, __set_name__ will be called again, overwriting this.\n        cloned._attr_name = self._attr_name\n        cloned._attr_name_private = self._attr_name_private\n\n        return cloned"},{"col":4,"comment":"Initialization arguments.\n\n        Parameters\n        ----------\n        processed : bool\n            Whether to more closely reproduce the input arguments (`False`,\n            default) or the processed arguments (`True`). The former is better\n            for string representations and round-tripping with ``eval(repr())``.\n\n        Returns\n        -------\n        dict[str, Any]\n        ","endLoc":237,"header":"def _get_init_arguments(self, processed=False)","id":13986,"name":"_get_init_arguments","nodeType":"Function","startLoc":214,"text":"def _get_init_arguments(self, processed=False):\n        \"\"\"Initialization arguments.\n\n        Parameters\n        ----------\n        processed : bool\n            Whether to more closely reproduce the input arguments (`False`,\n            default) or the processed arguments (`True`). The former is better\n            for string representations and round-tripping with ``eval(repr())``.\n\n        Returns\n        -------\n        dict[str, Any]\n        \"\"\"\n        # The keys are added in this order because `repr` prints them in order.\n        kw = {\"derived\": self.derived,\n              \"unit\": self.unit,\n              \"equivalencies\": self.equivalencies,\n              # Validator is always turned into a function, but for ``repr`` it's nice\n              # to know if it was originally a string.\n              \"fvalidate\": self.fvalidate if processed else self._fvalidate_in,\n              \"fmt\": self.format_spec,\n              \"doc\": self.__doc__}\n        return kw"},{"col":4,"comment":"Decorator to register a new kind of validator function.\n\n        Parameters\n        ----------\n        key : str\n        fvalidate : callable[[object, object, Any], Any] or None, optional\n            Value validation function.\n\n        Returns\n        -------\n        ``validator`` or callable[``validator``]\n            if validator is None returns a function that takes and registers a\n            validator. This allows ``register_validator`` to be used as a\n            decorator.\n        ","endLoc":210,"header":"@classmethod\n    def register_validator(cls, key, fvalidate=None)","id":13987,"name":"register_validator","nodeType":"Function","startLoc":169,"text":"@classmethod\n    def register_validator(cls, key, fvalidate=None):\n        \"\"\"Decorator to register a new kind of validator function.\n\n        Parameters\n        ----------\n        key : str\n        fvalidate : callable[[object, object, Any], Any] or None, optional\n            Value validation function.\n\n        Returns\n        -------\n        ``validator`` or callable[``validator``]\n            if validator is None returns a function that takes and registers a\n            validator. This allows ``register_validator`` to be used as a\n            decorator.\n        \"\"\"\n        if key in cls._registry_validators:\n            raise KeyError(f\"validator {key!r} already registered with Parameter.\")\n\n        # fvalidate directly passed\n        if fvalidate is not None:\n            cls._registry_validators[key] = fvalidate\n            return fvalidate\n\n        # for use as a decorator\n        def register(fvalidate):\n            \"\"\"Register validator function.\n\n            Parameters\n            ----------\n            fvalidate : callable[[object, object, Any], Any]\n                Validation function.\n\n            Returns\n            -------\n            ``validator``\n            \"\"\"\n            cls._registry_validators[key] = fvalidate\n            return fvalidate\n\n        return register"},{"col":4,"comment":"Check Parameter equality. Only equal to other Parameter objects.\n\n        Returns\n        -------\n        NotImplemented or True\n            `True` if equal, `NotImplemented` otherwise. This allows `other` to\n            be check for equality with ``other.__eq__``.\n\n        Examples\n        --------\n        >>> p1, p2 = Parameter(unit=\"km\"), Parameter(unit=\"km\")\n        >>> p1 == p2\n        True\n\n        >>> p3 = Parameter(unit=\"km / s\")\n        >>> p3 == p1\n        False\n\n        >>> p1 != 2\n        True\n        ","endLoc":298,"header":"def __eq__(self, other)","id":13988,"name":"__eq__","nodeType":"Function","startLoc":270,"text":"def __eq__(self, other):\n        \"\"\"Check Parameter equality. Only equal to other Parameter objects.\n\n        Returns\n        -------\n        NotImplemented or True\n            `True` if equal, `NotImplemented` otherwise. This allows `other` to\n            be check for equality with ``other.__eq__``.\n\n        Examples\n        --------\n        >>> p1, p2 = Parameter(unit=\"km\"), Parameter(unit=\"km\")\n        >>> p1 == p2\n        True\n\n        >>> p3 = Parameter(unit=\"km / s\")\n        >>> p3 == p1\n        False\n\n        >>> p1 != 2\n        True\n        \"\"\"\n        if not isinstance(other, Parameter):\n            return NotImplemented\n        # Check equality on all `_init_arguments` & `name`.\n        # Need to compare the processed arguments because the inputs are many-\n        # to-one, e.g. `fvalidate` can be a string or the equivalent function.\n        return ((self._get_init_arguments(True) == other._get_init_arguments(True))\n                and (self.name == other.name))"},{"col":4,"comment":"String representation.\n\n        ``eval(repr())`` should work, depending if contents like ``fvalidate``\n        can be similarly round-tripped.\n        ","endLoc":307,"header":"def __repr__(self)","id":13989,"name":"__repr__","nodeType":"Function","startLoc":300,"text":"def __repr__(self):\n        \"\"\"String representation.\n\n        ``eval(repr())`` should work, depending if contents like ``fvalidate``\n        can be similarly round-tripped.\n        \"\"\"\n        return \"Parameter({})\".format(\", \".join(f\"{k}={v!r}\" for k, v in\n                                                self._get_init_arguments().items()))"},{"attributeType":"null","col":4,"comment":"null","endLoc":47,"id":13990,"name":"_registry_validators","nodeType":"Attribute","startLoc":47,"text":"_registry_validators"},{"attributeType":"null","col":8,"comment":"null","endLoc":66,"id":13991,"name":"_fvalidate_in","nodeType":"Attribute","startLoc":66,"text":"self._fvalidate_in"},{"col":4,"comment":"\n        Wraps the method calculating the Jacobian of the function to account\n        for model constraints.\n        `scipy.optimize.leastsq` expects the function derivative to have the\n        above signature (parlist, (argtuple)). In order to accommodate model\n        constraints, instead of using p directly, we set the parameter list in\n        this function.\n        ","endLoc":1248,"header":"@staticmethod\n    def _wrap_deriv(params, model, weights, x, y, z=None)","id":13992,"name":"_wrap_deriv","nodeType":"Function","startLoc":1190,"text":"@staticmethod\n    def _wrap_deriv(params, model, weights, x, y, z=None):\n        \"\"\"\n        Wraps the method calculating the Jacobian of the function to account\n        for model constraints.\n        `scipy.optimize.leastsq` expects the function derivative to have the\n        above signature (parlist, (argtuple)). In order to accommodate model\n        constraints, instead of using p directly, we set the parameter list in\n        this function.\n        \"\"\"\n\n        if weights is None:\n            weights = 1.0\n\n        if any(model.fixed.values()) or any(model.tied.values()):\n            # update the parameters with the current values from the fitter\n            fitter_to_model_params(model, params)\n            if z is None:\n                full = np.array(model.fit_deriv(x, *model.parameters))\n                if not model.col_fit_deriv:\n                    full_deriv = np.ravel(weights) * full.T\n                else:\n                    full_deriv = np.ravel(weights) * full\n            else:\n                full = np.array([np.ravel(_) for _ in model.fit_deriv(x, y, *model.parameters)])\n                if not model.col_fit_deriv:\n                    full_deriv = np.ravel(weights) * full.T\n                else:\n                    full_deriv = np.ravel(weights) * full\n\n            pars = [getattr(model, name) for name in model.param_names]\n            fixed = [par.fixed for par in pars]\n            tied = [par.tied for par in pars]\n            tied = list(np.where([par.tied is not False for par in pars],\n                                 True, tied))\n            fix_and_tie = np.logical_or(fixed, tied)\n            ind = np.logical_not(fix_and_tie)\n\n            if not model.col_fit_deriv:\n                residues = np.asarray(full_deriv[np.nonzero(ind)]).T\n            else:\n                residues = full_deriv[np.nonzero(ind)]\n\n            return [np.ravel(_) for _ in residues]\n        else:\n            if z is None:\n                try:\n                    return np.array([np.ravel(_) for _ in np.array(weights) *\n                                     np.array(model.fit_deriv(x, *params))])\n                except ValueError:\n                    return np.array([np.ravel(_) for _ in np.array(weights) *\n                                     np.moveaxis(\n                                         np.array(model.fit_deriv(x, *params)),\n                                         -1, 0)]).transpose()\n            else:\n                if not model.col_fit_deriv:\n                    return [np.ravel(_) for _ in\n                            (np.ravel(weights) * np.array(model.fit_deriv(x, y, *params)).T).T]\n                return [np.ravel(_) for _ in weights * np.array(model.fit_deriv(x, y, *params))]"},{"attributeType":"null","col":8,"comment":"null","endLoc":58,"id":13993,"name":"_fmt","nodeType":"Attribute","startLoc":58,"text":"self._fmt"},{"attributeType":"None","col":8,"comment":"null","endLoc":62,"id":13994,"name":"_unit","nodeType":"Attribute","startLoc":62,"text":"self._unit"},{"fileName":"__init__.py","filePath":"astropy/cosmology","id":13995,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\" astropy.cosmology contains classes and functions for cosmological\ndistance measures and other cosmology-related calculations.\n\nSee the `Astropy documentation\n<https://docs.astropy.org/en/latest/cosmology/index.html>`_ for more\ndetailed usage examples and references.\n\n\"\"\"\n\nfrom . import core, flrw, funcs, parameter, units, utils\n\nfrom . import io  # needed before 'realizations'  # isort: split\nfrom . import realizations\nfrom .core import *\nfrom .flrw import *\nfrom .funcs import *\nfrom .parameter import *\nfrom .realizations import available, default_cosmology\nfrom .utils import *\n\n__all__ = (core.__all__ + flrw.__all__       # cosmology classes\n           + realizations.__all__            # instances thereof\n           + [\"units\"]\n           + funcs.__all__ + parameter.__all__ + utils.__all__)  # utils\n\n\ndef __getattr__(name):\n    \"\"\"Get realizations using lazy import from\n    `PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_.\n\n    Raises\n    ------\n    AttributeError\n        If \"name\" is not in :mod:`astropy.cosmology.realizations`\n    \"\"\"\n    if name not in realizations.available:\n        raise AttributeError(f\"module {__name__!r} has no attribute {name!r}.\")\n\n    return getattr(realizations, name)\n\n\ndef __dir__():\n    \"\"\"Directory, including lazily-imported objects.\"\"\"\n    return __all__\n"},{"attributeType":"Callable | Callable","col":8,"comment":"null","endLoc":77,"id":13996,"name":"_fvalidate","nodeType":"Attribute","startLoc":77,"text":"self._fvalidate"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":13997,"name":"available","nodeType":"Attribute","startLoc":16,"text":"available"},{"attributeType":"None","col":26,"comment":"null","endLoc":55,"id":13998,"name":"_attr_name_private","nodeType":"Attribute","startLoc":55,"text":"self._attr_name_private"},{"className":"default_cosmology","col":0,"comment":"The default cosmology to use.\n\n    To change it::\n\n        >>> from astropy.cosmology import default_cosmology, WMAP7\n        >>> with default_cosmology.set(WMAP7):\n        ...     # WMAP7 cosmology in effect\n        ...     pass\n\n    Or, you may use a string::\n\n        >>> with default_cosmology.set('WMAP7'):\n        ...     # WMAP7 cosmology in effect\n        ...     pass\n\n    To get the default cosmology:\n\n        >>> default_cosmology.get()\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966, ...\n\n    To get a specific cosmology:\n\n        >>> default_cosmology.get(\"Planck13\")\n        FlatLambdaCDM(name=\"Planck13\", H0=67.77 km / (Mpc s), Om0=0.30712, ...\n    ","endLoc":176,"id":13999,"nodeType":"Class","startLoc":56,"text":"class default_cosmology(ScienceState):\n    \"\"\"The default cosmology to use.\n\n    To change it::\n\n        >>> from astropy.cosmology import default_cosmology, WMAP7\n        >>> with default_cosmology.set(WMAP7):\n        ...     # WMAP7 cosmology in effect\n        ...     pass\n\n    Or, you may use a string::\n\n        >>> with default_cosmology.set('WMAP7'):\n        ...     # WMAP7 cosmology in effect\n        ...     pass\n\n    To get the default cosmology:\n\n        >>> default_cosmology.get()\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966, ...\n\n    To get a specific cosmology:\n\n        >>> default_cosmology.get(\"Planck13\")\n        FlatLambdaCDM(name=\"Planck13\", H0=67.77 km / (Mpc s), Om0=0.30712, ...\n    \"\"\"\n\n    _default_value = \"Planck18\"\n    _value = \"Planck18\"\n\n    @classmethod\n    def get(cls, key=None):\n        \"\"\"Get the science state value of ``key``.\n\n        Parameters\n        ----------\n        key : str or None\n            The built-in |Cosmology| realization to retrieve.\n            If None (default) get the current value.\n\n        Returns\n        -------\n        `astropy.cosmology.Cosmology` or None\n            `None` only if ``key`` is \"no_default\"\n\n        Raises\n        ------\n        TypeError\n            If ``key`` is not a str, |Cosmology|, or None.\n        ValueError\n            If ``key`` is a str, but not for a built-in Cosmology\n\n        Examples\n        --------\n        To get the default cosmology:\n\n        >>> default_cosmology.get()\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966, ...\n\n        To get a specific cosmology:\n\n        >>> default_cosmology.get(\"Planck13\")\n        FlatLambdaCDM(name=\"Planck13\", H0=67.77 km / (Mpc s), Om0=0.30712, ...\n        \"\"\"\n        if key is None:\n            key = cls._value\n\n        if isinstance(key, str):\n            # special-case one string\n            if key == \"no_default\":\n                return None\n            # all other options should be built-in realizations\n            try:\n                value = getattr(sys.modules[__name__], key)\n            except AttributeError:\n                raise ValueError(f\"Unknown cosmology {key!r}. \"\n                                 f\"Valid cosmologies:\\n{available}\")\n        elif isinstance(key, Cosmology):\n            value = key\n        else:\n            raise TypeError(\"'key' must be must be None, a string, \"\n                            f\"or Cosmology instance, not {type(key)}.\")\n\n        # validate value to `Cosmology`, if not already\n        return cls.validate(value)\n\n    @deprecated(\"5.0\", alternative=\"get\")\n    @classmethod\n    def get_cosmology_from_string(cls, arg):\n        \"\"\"Return a cosmology instance from a string.\"\"\"\n        return cls.get(arg)\n\n    @classmethod\n    def validate(cls, value):\n        \"\"\"Return a Cosmology given a value.\n\n        Parameters\n        ----------\n        value : None, str, or `~astropy.cosmology.Cosmology`\n\n        Returns\n        -------\n        `~astropy.cosmology.Cosmology` instance\n\n        Raises\n        ------\n        TypeError\n            If ``value`` is not a string or |Cosmology|.\n        \"\"\"\n        # None -> default\n        if value is None:\n            value = cls._default_value\n\n        # Parse to Cosmology. Error if cannot.\n        if isinstance(value, str):\n            value = cls.get(value)\n        elif not isinstance(value, Cosmology):\n            raise TypeError(\"default_cosmology must be a string or Cosmology instance, \"\n                            f\"not {value}.\")\n\n        return value"},{"col":4,"comment":"Return a cosmology instance from a string.","endLoc":146,"header":"@deprecated(\"5.0\", alternative=\"get\")\n    @classmethod\n    def get_cosmology_from_string(cls, arg)","id":14000,"name":"get_cosmology_from_string","nodeType":"Function","startLoc":142,"text":"@deprecated(\"5.0\", alternative=\"get\")\n    @classmethod\n    def get_cosmology_from_string(cls, arg):\n        \"\"\"Return a cosmology instance from a string.\"\"\"\n        return cls.get(arg)"},{"attributeType":"null","col":4,"comment":"null","endLoc":83,"id":14001,"name":"_default_value","nodeType":"Attribute","startLoc":83,"text":"_default_value"},{"attributeType":"null","col":4,"comment":"null","endLoc":84,"id":14002,"name":"_value","nodeType":"Attribute","startLoc":84,"text":"_value"},{"col":0,"comment":"Get realizations using lazy import from\n    `PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_.\n\n    Raises\n    ------\n    AttributeError\n        If \"name\" is not in :mod:`astropy.cosmology.realizations`\n    ","endLoc":40,"header":"def __getattr__(name)","id":14003,"name":"__getattr__","nodeType":"Function","startLoc":28,"text":"def __getattr__(name):\n    \"\"\"Get realizations using lazy import from\n    `PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_.\n\n    Raises\n    ------\n    AttributeError\n        If \"name\" is not in :mod:`astropy.cosmology.realizations`\n    \"\"\"\n    if name not in realizations.available:\n        raise AttributeError(f\"module {__name__!r} has no attribute {name!r}.\")\n\n    return getattr(realizations, name)"},{"col":4,"comment":"Initialization signature (without 'self').","endLoc":115,"header":"@classproperty(lazy=True)\n    def _init_signature(cls)","id":14004,"name":"_init_signature","nodeType":"Function","startLoc":109,"text":"@classproperty(lazy=True)\n    def _init_signature(cls):\n        \"\"\"Initialization signature (without 'self').\"\"\"\n        # get signature, dropping \"self\" by taking arguments [1:]\n        sig = inspect.signature(cls.__init__)\n        sig = sig.replace(parameters=list(sig.parameters.values())[1:])\n        return sig"},{"col":4,"comment":"null","endLoc":1708,"header":"def __init__(self, ap_order, bp_order, ap_coeff={}, bp_coeff={},\n                 n_models=None, model_set_axis=None, name=None, meta=None)","id":14005,"name":"__init__","nodeType":"Function","startLoc":1685,"text":"def __init__(self, ap_order, bp_order, ap_coeff={}, bp_coeff={},\n                 n_models=None, model_set_axis=None, name=None, meta=None):\n        self._ap_order = ap_order\n        self._bp_order = bp_order\n        self._ap_coeff = ap_coeff\n        self._bp_coeff = bp_coeff\n\n        # define the 0th term in order to use Polynomial2D\n        ap_coeff.setdefault('AP_0_0', 0)\n        bp_coeff.setdefault('BP_0_0', 0)\n\n        ap_coeff_params = dict((k.replace('AP_', 'c'), v)\n                               for k, v in ap_coeff.items())\n        bp_coeff_params = dict((k.replace('BP_', 'c'), v)\n                               for k, v in bp_coeff.items())\n\n        self.sip1d_ap = Polynomial2D(degree=ap_order,\n                                     model_set_axis=model_set_axis,\n                                     **ap_coeff_params)\n        self.sip1d_bp = Polynomial2D(degree=bp_order,\n                                     model_set_axis=model_set_axis,\n                                     **bp_coeff_params)\n        super().__init__(n_models=n_models, model_set_axis=model_set_axis,\n                         name=name, meta=meta)"},{"attributeType":"null","col":8,"comment":"null","endLoc":59,"id":14006,"name":"__doc__","nodeType":"Attribute","startLoc":59,"text":"self.__doc__"},{"col":0,"comment":"Directory, including lazily-imported objects.","endLoc":45,"header":"def __dir__()","id":14007,"name":"__dir__","nodeType":"Function","startLoc":43,"text":"def __dir__():\n    \"\"\"Directory, including lazily-imported objects.\"\"\"\n    return __all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":14008,"name":"__all__","nodeType":"Attribute","startLoc":22,"text":"__all__"},{"col":0,"comment":"","endLoc":9,"header":"__init__.py#<anonymous>","id":14009,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\" astropy.cosmology contains classes and functions for cosmological\ndistance measures and other cosmology-related calculations.\n\nSee the `Astropy documentation\n<https://docs.astropy.org/en/latest/cosmology/index.html>`_ for more\ndetailed usage examples and references.\n\n\"\"\"\n\n__all__ = (core.__all__ + flrw.__all__       # cosmology classes\n           + realizations.__all__            # instances thereof\n           + [\"units\"]\n           + funcs.__all__ + parameter.__all__ + utils.__all__)  # utils"},{"col":4,"comment":"null","endLoc":121,"header":"def __init__(self, name=None, meta=None)","id":14010,"name":"__init__","nodeType":"Function","startLoc":119,"text":"def __init__(self, name=None, meta=None):\n        self._name = str(name) if name is not None else name\n        self.meta.update(meta or {})"},{"col":4,"comment":"null","endLoc":1660,"header":"def evaluate(self, x, y)","id":14011,"name":"evaluate","nodeType":"Function","startLoc":1655,"text":"def evaluate(self, x, y):\n        u = self.shift_a.evaluate(x, *self.shift_a.param_sets)\n        v = self.shift_b.evaluate(y, *self.shift_b.param_sets)\n        f = self.sip1d_a.evaluate(u, v, *self.sip1d_a.param_sets)\n        g = self.sip1d_b.evaluate(u, v, *self.sip1d_b.param_sets)\n        return f, g"},{"col":4,"comment":"The name of the Cosmology instance.","endLoc":126,"header":"@property\n    def name(self)","id":14012,"name":"name","nodeType":"Function","startLoc":123,"text":"@property\n    def name(self):\n        \"\"\"The name of the Cosmology instance.\"\"\"\n        return self._name"},{"col":4,"comment":"\n        Return bool; `True` if the cosmology is flat.\n        This is abstract and must be defined in subclasses.\n        ","endLoc":135,"header":"@property\n    @abc.abstractmethod\n    def is_flat(self)","id":14013,"name":"is_flat","nodeType":"Function","startLoc":128,"text":"@property\n    @abc.abstractmethod\n    def is_flat(self):\n        \"\"\"\n        Return bool; `True` if the cosmology is flat.\n        This is abstract and must be defined in subclasses.\n        \"\"\"\n        raise NotImplementedError(\"is_flat is not implemented\")"},{"col":4,"comment":"Returns a copy of this object with updated parameters, as specified.\n\n        This cannot be used to change the type of the cosmology, so ``clone()``\n        cannot be used to change between flat and non-flat cosmologies.\n\n        Parameters\n        ----------\n        meta : mapping or None (optional, keyword-only)\n            Metadata that will update the current metadata.\n        **kwargs\n            Cosmology parameter (and name) modifications.\n            If any parameter is changed and a new name is not given, the name\n            will be set to \"[old name] (modified)\".\n\n        Returns\n        -------\n        newcosmo : `~astropy.cosmology.Cosmology` subclass instance\n            A new instance of this class with updated parameters as specified.\n            If no modifications are requested, then a reference to this object\n            is returned instead of copy.\n\n        Examples\n        --------\n        To make a copy of the ``Planck13`` cosmology with a different matter\n        density (``Om0``), and a new name:\n\n            >>> from astropy.cosmology import Planck13\n            >>> newcosmo = Planck13.clone(name=\"Modified Planck 2013\", Om0=0.35)\n\n        If no name is specified, the new name will note the modification.\n\n            >>> Planck13.clone(Om0=0.35).name\n            'Planck13 (modified)'\n        ","endLoc":189,"header":"def clone(self, *, meta=None, **kwargs)","id":14014,"name":"clone","nodeType":"Function","startLoc":137,"text":"def clone(self, *, meta=None, **kwargs):\n        \"\"\"Returns a copy of this object with updated parameters, as specified.\n\n        This cannot be used to change the type of the cosmology, so ``clone()``\n        cannot be used to change between flat and non-flat cosmologies.\n\n        Parameters\n        ----------\n        meta : mapping or None (optional, keyword-only)\n            Metadata that will update the current metadata.\n        **kwargs\n            Cosmology parameter (and name) modifications.\n            If any parameter is changed and a new name is not given, the name\n            will be set to \"[old name] (modified)\".\n\n        Returns\n        -------\n        newcosmo : `~astropy.cosmology.Cosmology` subclass instance\n            A new instance of this class with updated parameters as specified.\n            If no modifications are requested, then a reference to this object\n            is returned instead of copy.\n\n        Examples\n        --------\n        To make a copy of the ``Planck13`` cosmology with a different matter\n        density (``Om0``), and a new name:\n\n            >>> from astropy.cosmology import Planck13\n            >>> newcosmo = Planck13.clone(name=\"Modified Planck 2013\", Om0=0.35)\n\n        If no name is specified, the new name will note the modification.\n\n            >>> Planck13.clone(Om0=0.35).name\n            'Planck13 (modified)'\n        \"\"\"\n        # Quick return check, taking advantage of the Cosmology immutability.\n        if meta is None and not kwargs:\n            return self\n\n        # There are changed parameter or metadata values.\n        # The name needs to be changed accordingly, if it wasn't already.\n        kwargs.setdefault(\"name\", (self.name + \" (modified)\"\n                                   if self.name is not None else None))\n\n        # mix new meta into existing, preferring the former.\n        new_meta = {**self.meta, **(meta or {})}\n        # Mix kwargs into initial arguments, preferring the former.\n        new_init = {**self._init_arguments, \"meta\": new_meta, **kwargs}\n        # Create BoundArgument to handle args versus kwargs.\n        # This also handles all errors from mismatched arguments\n        ba = self._init_signature.bind_partial(**new_init)\n        # Return new instance, respecting args vs kwargs\n        return self.__class__(*ba.args, **ba.kwargs)"},{"fileName":"parameters.py","filePath":"astropy/cosmology","id":14015,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"This module contains dictionaries with sets of parameters for a\ngiven cosmology.\n\nEach cosmology has the following parameters defined:\n\n    ==========  =====================================\n    Oc0         Omega cold dark matter at z=0\n    Ob0         Omega baryon at z=0\n    Om0         Omega matter at z=0\n    flat        Is this assumed flat?  If not, Ode0 must be specified\n    Ode0        Omega dark energy at z=0 if flat is False\n    H0          Hubble parameter at z=0 in km/s/Mpc\n    n           Density perturbation spectral index\n    Tcmb0       Current temperature of the CMB\n    Neff        Effective number of neutrino species\n    m_nu        Assumed mass of neutrino species, in eV.\n    sigma8      Density perturbation amplitude\n    tau         Ionisation optical depth\n    z_reion     Redshift of hydrogen reionisation\n    t0          Age of the universe in Gyr\n    reference   Reference for the parameters\n    ==========  =====================================\n\nThe list of cosmologies available are given by the tuple\n`available`. Current cosmologies available:\n\nPlanck 2018 (Planck18) parameters from Planck Collaboration 2020,\n A&A, 641, A6 (Paper VI), Table 2 (TT, TE, EE + lowE + lensing + BAO)\n\nPlanck 2015 (Planck15) parameters from Planck Collaboration 2016, A&A, 594, A13\n (Paper XIII), Table 4 (TT, TE, EE + lowP + lensing + ext)\n\nPlanck 2013 (Planck13) parameters from Planck Collaboration 2014, A&A, 571, A16\n (Paper XVI), Table 5 (Planck + WP + highL + BAO)\n\nWMAP 9 year (WMAP9) parameters from Hinshaw et al. 2013, ApJS, 208, 19,\ndoi: 10.1088/0067-0049/208/2/19. Table 4 (WMAP9 + eCMB + BAO + H0)\n\nWMAP 7 year (WMAP7) parameters from Komatsu et al. 2011, ApJS, 192, 18,\ndoi: 10.1088/0067-0049/192/2/18. Table 1 (WMAP + BAO + H0 ML).\n\nWMAP 5 year (WMAP5) parameters from Komatsu et al. 2009, ApJS, 180, 330,\ndoi: 10.1088/0067-0049/180/2/330. Table 1 (WMAP + BAO + SN ML).\n\nWMAP 3 year (WMAP3) parameters from Spergel et al. 2007, ApJS, 170, 377,\ndoi:  10.1086/513700. Table 6. (WMAP + SNGold) Obtained from https://lambda.gsfc.nasa.gov/product/map/dr2/params/lcdm_wmap_sngold.cfm\nTcmb0 and Neff are the standard values as also used for WMAP5, 7, 9.\nPending WMAP team approval and subject to change.\n\nWMAP 1 year (WMAP1) parameters from Spergel et al. 2003, ApJS, 148, 175,\ndoi:  10.1086/377226. Table 7 (WMAP + CBI + ACBAR + 2dFGRS + Lya)\nTcmb0 and Neff are the standard values as also used for WMAP5, 7, 9.\nPending WMAP team approval and subject to change.\n\n\"\"\"\n\n# STDLIB\nimport sys\nfrom types import MappingProxyType\n\n# LOCAL\nfrom .realizations import available\n\n__all__ = [\"available\"] + list(available)\n\n\ndef __getattr__(name):\n    \"\"\"Get parameters of cosmology representations with lazy import from\n    `PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_.\n    \"\"\"\n    from astropy.cosmology import realizations\n\n    cosmo = getattr(realizations, name)\n    m = cosmo.to_format(\"mapping\", cosmology_as_str=True, move_from_meta=True)\n    proxy = MappingProxyType(m)\n\n    # Cache in this module so `__getattr__` is only called once per `name`.\n    setattr(sys.modules[__name__], name, proxy)\n\n    return proxy\n\n\ndef __dir__():\n    \"\"\"Directory, including lazily-imported objects.\"\"\"\n    return __all__\n"},{"col":0,"comment":"Convert quantities between redshift and Hubble parameter and little-h.\n\n    Care should be taken to not misinterpret a relativistic, gravitational, etc\n    redshift as a cosmological one.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology`, str, or None, optional\n        A cosmology realization or built-in cosmology's name (e.g. 'Planck18').\n        If None, will use the default cosmology\n        (controlled by :class:`~astropy.cosmology.default_cosmology`).\n    **atzkw\n        keyword arguments for :func:`~astropy.cosmology.z_at_value`\n\n    Returns\n    -------\n    `~astropy.units.equivalencies.Equivalency`\n        Equivalency between redshift and Hubble parameter and little-h unit.\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> import astropy.cosmology.units as cu\n    >>> from astropy.cosmology import WMAP9\n\n    >>> z = 1100 * cu.redshift\n    >>> equivalency = cu.redshift_hubble(WMAP9)  # construct equivalency\n\n    >>> z.to(u.km / u.s / u.Mpc, equivalency)  # doctest: +FLOAT_CMP\n    <Quantity 1565637.40154275 km / (Mpc s)>\n\n    >>> z.to(cu.littleh, equivalency)  # doctest: +FLOAT_CMP\n    <Quantity 15656.37401543 littleh>\n    ","endLoc":176,"header":"def redshift_hubble(cosmology=None, **atzkw)","id":14016,"name":"redshift_hubble","nodeType":"Function","startLoc":115,"text":"def redshift_hubble(cosmology=None, **atzkw):\n    \"\"\"Convert quantities between redshift and Hubble parameter and little-h.\n\n    Care should be taken to not misinterpret a relativistic, gravitational, etc\n    redshift as a cosmological one.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology`, str, or None, optional\n        A cosmology realization or built-in cosmology's name (e.g. 'Planck18').\n        If None, will use the default cosmology\n        (controlled by :class:`~astropy.cosmology.default_cosmology`).\n    **atzkw\n        keyword arguments for :func:`~astropy.cosmology.z_at_value`\n\n    Returns\n    -------\n    `~astropy.units.equivalencies.Equivalency`\n        Equivalency between redshift and Hubble parameter and little-h unit.\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> import astropy.cosmology.units as cu\n    >>> from astropy.cosmology import WMAP9\n\n    >>> z = 1100 * cu.redshift\n    >>> equivalency = cu.redshift_hubble(WMAP9)  # construct equivalency\n\n    >>> z.to(u.km / u.s / u.Mpc, equivalency)  # doctest: +FLOAT_CMP\n    <Quantity 1565637.40154275 km / (Mpc s)>\n\n    >>> z.to(cu.littleh, equivalency)  # doctest: +FLOAT_CMP\n    <Quantity 15656.37401543 littleh>\n    \"\"\"\n    from astropy.cosmology import default_cosmology, z_at_value\n\n    # get cosmology: None -> default and process str / class\n    cosmology = cosmology if cosmology is not None else default_cosmology.get()\n    with default_cosmology.set(cosmology):  # if already cosmo, passes through\n        cosmology = default_cosmology.get()\n\n    def z_to_hubble(z):\n        \"\"\"Redshift to Hubble parameter.\"\"\"\n        return cosmology.H(z)\n\n    def hubble_to_z(H):\n        \"\"\"Hubble parameter to redshift.\"\"\"\n        return z_at_value(cosmology.H, H << (u.km / u.s / u.Mpc), **atzkw)\n\n    def z_to_littleh(z):\n        \"\"\"Redshift to :math:`h`-unit Quantity.\"\"\"\n        return z_to_hubble(z).to_value(u.km / u.s / u.Mpc) / 100 * littleh\n\n    def littleh_to_z(h):\n        \"\"\":math:`h`-unit Quantity to redshift.\"\"\"\n        return hubble_to_z(h * 100)\n\n    return u.Equivalency([(redshift, u.km / u.s / u.Mpc, z_to_hubble, hubble_to_z),\n                          (redshift, littleh, z_to_littleh, littleh_to_z)],\n                         \"redshift_hubble\",\n                         {'cosmology': cosmology})"},{"col":0,"comment":"Get parameters of cosmology representations with lazy import from\n    `PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_.\n    ","endLoc":81,"header":"def __getattr__(name)","id":14017,"name":"__getattr__","nodeType":"Function","startLoc":68,"text":"def __getattr__(name):\n    \"\"\"Get parameters of cosmology representations with lazy import from\n    `PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_.\n    \"\"\"\n    from astropy.cosmology import realizations\n\n    cosmo = getattr(realizations, name)\n    m = cosmo.to_format(\"mapping\", cosmology_as_str=True, move_from_meta=True)\n    proxy = MappingProxyType(m)\n\n    # Cache in this module so `__getattr__` is only called once per `name`.\n    setattr(sys.modules[__name__], name, proxy)\n\n    return proxy"},{"attributeType":"None","col":8,"comment":"null","endLoc":55,"id":14018,"name":"_attr_name","nodeType":"Attribute","startLoc":55,"text":"self._attr_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":63,"id":14019,"name":"_equivalencies","nodeType":"Attribute","startLoc":63,"text":"self._equivalencies"},{"attributeType":"null","col":8,"comment":"null","endLoc":57,"id":14020,"name":"_derived","nodeType":"Attribute","startLoc":57,"text":"self._derived"},{"col":0,"comment":"\n    Default Parameter value validator.\n    Adds/converts units if Parameter has a unit.\n    ","endLoc":323,"header":"@Parameter.register_validator(\"default\")\ndef _validate_with_unit(cosmology, param, value)","id":14021,"name":"_validate_with_unit","nodeType":"Function","startLoc":314,"text":"@Parameter.register_validator(\"default\")\ndef _validate_with_unit(cosmology, param, value):\n    \"\"\"\n    Default Parameter value validator.\n    Adds/converts units if Parameter has a unit.\n    \"\"\"\n    if param.unit is not None:\n        with u.add_enabled_equivalencies(param.equivalencies):\n            value = u.Quantity(value, param.unit)\n    return value"},{"col":0,"comment":"Directory, including lazily-imported objects.","endLoc":86,"header":"def __dir__()","id":14023,"name":"__dir__","nodeType":"Function","startLoc":84,"text":"def __dir__():\n    \"\"\"Directory, including lazily-imported objects.\"\"\"\n    return __all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":65,"id":14024,"name":"__all__","nodeType":"Attribute","startLoc":65,"text":"__all__"},{"col":0,"comment":"","endLoc":56,"header":"parameters.py#<anonymous>","id":14025,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"This module contains dictionaries with sets of parameters for a\ngiven cosmology.\n\nEach cosmology has the following parameters defined:\n\n    ==========  =====================================\n    Oc0         Omega cold dark matter at z=0\n    Ob0         Omega baryon at z=0\n    Om0         Omega matter at z=0\n    flat        Is this assumed flat?  If not, Ode0 must be specified\n    Ode0        Omega dark energy at z=0 if flat is False\n    H0          Hubble parameter at z=0 in km/s/Mpc\n    n           Density perturbation spectral index\n    Tcmb0       Current temperature of the CMB\n    Neff        Effective number of neutrino species\n    m_nu        Assumed mass of neutrino species, in eV.\n    sigma8      Density perturbation amplitude\n    tau         Ionisation optical depth\n    z_reion     Redshift of hydrogen reionisation\n    t0          Age of the universe in Gyr\n    reference   Reference for the parameters\n    ==========  =====================================\n\nThe list of cosmologies available are given by the tuple\n`available`. Current cosmologies available:\n\nPlanck 2018 (Planck18) parameters from Planck Collaboration 2020,\n A&A, 641, A6 (Paper VI), Table 2 (TT, TE, EE + lowE + lensing + BAO)\n\nPlanck 2015 (Planck15) parameters from Planck Collaboration 2016, A&A, 594, A13\n (Paper XIII), Table 4 (TT, TE, EE + lowP + lensing + ext)\n\nPlanck 2013 (Planck13) parameters from Planck Collaboration 2014, A&A, 571, A16\n (Paper XVI), Table 5 (Planck + WP + highL + BAO)\n\nWMAP 9 year (WMAP9) parameters from Hinshaw et al. 2013, ApJS, 208, 19,\ndoi: 10.1088/0067-0049/208/2/19. Table 4 (WMAP9 + eCMB + BAO + H0)\n\nWMAP 7 year (WMAP7) parameters from Komatsu et al. 2011, ApJS, 192, 18,\ndoi: 10.1088/0067-0049/192/2/18. Table 1 (WMAP + BAO + H0 ML).\n\nWMAP 5 year (WMAP5) parameters from Komatsu et al. 2009, ApJS, 180, 330,\ndoi: 10.1088/0067-0049/180/2/330. Table 1 (WMAP + BAO + SN ML).\n\nWMAP 3 year (WMAP3) parameters from Spergel et al. 2007, ApJS, 170, 377,\ndoi:  10.1086/513700. Table 6. (WMAP + SNGold) Obtained from https://lambda.gsfc.nasa.gov/product/map/dr2/params/lcdm_wmap_sngold.cfm\nTcmb0 and Neff are the standard values as also used for WMAP5, 7, 9.\nPending WMAP team approval and subject to change.\n\nWMAP 1 year (WMAP1) parameters from Spergel et al. 2003, ApJS, 148, 175,\ndoi:  10.1086/377226. Table 7 (WMAP + CBI + ACBAR + 2dFGRS + Lya)\nTcmb0 and Neff are the standard values as also used for WMAP5, 7, 9.\nPending WMAP team approval and subject to change.\n\n\"\"\"\n\n__all__ = [\"available\"] + list(available)"},{"col":4,"comment":"null","endLoc":200,"header":"@property\n    def _init_arguments(self)","id":14026,"name":"_init_arguments","nodeType":"Function","startLoc":191,"text":"@property\n    def _init_arguments(self):\n        # parameters\n        kw = {n: getattr(self, n) for n in self.__parameters__}\n\n        # other info\n        kw[\"name\"] = self.name\n        kw[\"meta\"] = self.meta\n\n        return kw"},{"attributeType":"null","col":4,"comment":"\n    The constraint types supported by this fitter type.\n    ","endLoc":1051,"id":14027,"name":"supported_constraints","nodeType":"Attribute","startLoc":1051,"text":"supported_constraints"},{"col":4,"comment":"Check equivalence between Cosmologies.\n\n        Two cosmologies may be equivalent even if not the same class.\n        For example, an instance of ``LambdaCDM`` might have :math:`\\Omega_0=1`\n        and :math:`\\Omega_k=0` and therefore be flat, like ``FlatLambdaCDM``.\n\n        Parameters\n        ----------\n        other : `~astropy.cosmology.Cosmology` subclass instance\n            The object in which to compare.\n        format : bool or None or str, optional keyword-only\n            Whether to allow, before equivalence is checked, the object to be\n            converted to a |Cosmology|. This allows, e.g. a |Table| to be\n            equivalent to a Cosmology.\n            `False` (default) will not allow conversion. `True` or `None` will,\n            and will use the auto-identification to try to infer the correct\n            format. A `str` is assumed to be the correct format to use when\n            converting.\n\n        Returns\n        -------\n        bool\n            True if cosmologies are equivalent, False otherwise.\n\n        Examples\n        --------\n        Two cosmologies may be equivalent even if not of the same class.\n        In this examples the ``LambdaCDM`` has ``Ode0`` set to the same value\n        calculated in ``FlatLambdaCDM``.\n\n            >>> import astropy.units as u\n            >>> from astropy.cosmology import LambdaCDM, FlatLambdaCDM\n            >>> cosmo1 = LambdaCDM(70 * (u.km/u.s/u.Mpc), 0.3, 0.7)\n            >>> cosmo2 = FlatLambdaCDM(70 * (u.km/u.s/u.Mpc), 0.3)\n            >>> cosmo1.is_equivalent(cosmo2)\n            True\n\n        While in this example, the cosmologies are not equivalent.\n\n            >>> cosmo3 = FlatLambdaCDM(70 * (u.km/u.s/u.Mpc), 0.3, Tcmb0=3 * u.K)\n            >>> cosmo3.is_equivalent(cosmo2)\n            False\n\n        Also, using the keyword argument, the notion of equivalence is extended\n        to any Python object that can be converted to a |Cosmology|.\n\n            >>> from astropy.cosmology import Planck18\n            >>> tbl = Planck18.to_format(\"astropy.table\")\n            >>> Planck18.is_equivalent(tbl, format=True)\n            True\n\n        The list of valid formats, e.g. the |Table| in this example, may be\n        checked with ``Cosmology.from_format.list_formats()``.\n\n        As can be seen in the list of formats, not all formats can be\n        auto-identified by ``Cosmology.from_format.registry``. Objects of\n        these kinds can still be checked for equivalence, but the correct\n        format string must be used.\n\n            >>> tbl = Planck18.to_format(\"yaml\")\n            >>> Planck18.is_equivalent(tbl, format=\"yaml\")\n            True\n        ","endLoc":284,"header":"def is_equivalent(self, other, *, format=False)","id":14028,"name":"is_equivalent","nodeType":"Function","startLoc":205,"text":"def is_equivalent(self, other, *, format=False):\n        r\"\"\"Check equivalence between Cosmologies.\n\n        Two cosmologies may be equivalent even if not the same class.\n        For example, an instance of ``LambdaCDM`` might have :math:`\\Omega_0=1`\n        and :math:`\\Omega_k=0` and therefore be flat, like ``FlatLambdaCDM``.\n\n        Parameters\n        ----------\n        other : `~astropy.cosmology.Cosmology` subclass instance\n            The object in which to compare.\n        format : bool or None or str, optional keyword-only\n            Whether to allow, before equivalence is checked, the object to be\n            converted to a |Cosmology|. This allows, e.g. a |Table| to be\n            equivalent to a Cosmology.\n            `False` (default) will not allow conversion. `True` or `None` will,\n            and will use the auto-identification to try to infer the correct\n            format. A `str` is assumed to be the correct format to use when\n            converting.\n\n        Returns\n        -------\n        bool\n            True if cosmologies are equivalent, False otherwise.\n\n        Examples\n        --------\n        Two cosmologies may be equivalent even if not of the same class.\n        In this examples the ``LambdaCDM`` has ``Ode0`` set to the same value\n        calculated in ``FlatLambdaCDM``.\n\n            >>> import astropy.units as u\n            >>> from astropy.cosmology import LambdaCDM, FlatLambdaCDM\n            >>> cosmo1 = LambdaCDM(70 * (u.km/u.s/u.Mpc), 0.3, 0.7)\n            >>> cosmo2 = FlatLambdaCDM(70 * (u.km/u.s/u.Mpc), 0.3)\n            >>> cosmo1.is_equivalent(cosmo2)\n            True\n\n        While in this example, the cosmologies are not equivalent.\n\n            >>> cosmo3 = FlatLambdaCDM(70 * (u.km/u.s/u.Mpc), 0.3, Tcmb0=3 * u.K)\n            >>> cosmo3.is_equivalent(cosmo2)\n            False\n\n        Also, using the keyword argument, the notion of equivalence is extended\n        to any Python object that can be converted to a |Cosmology|.\n\n            >>> from astropy.cosmology import Planck18\n            >>> tbl = Planck18.to_format(\"astropy.table\")\n            >>> Planck18.is_equivalent(tbl, format=True)\n            True\n\n        The list of valid formats, e.g. the |Table| in this example, may be\n        checked with ``Cosmology.from_format.list_formats()``.\n\n        As can be seen in the list of formats, not all formats can be\n        auto-identified by ``Cosmology.from_format.registry``. Objects of\n        these kinds can still be checked for equivalence, but the correct\n        format string must be used.\n\n            >>> tbl = Planck18.to_format(\"yaml\")\n            >>> Planck18.is_equivalent(tbl, format=\"yaml\")\n            True\n        \"\"\"\n        # Allow for different formats to be considered equivalent.\n        if format is not False:\n            format = None if format is True else format  # str->str, None/True->None\n            try:\n                other = Cosmology.from_format(other, format=format)\n            except Exception:  # TODO! should enforce only TypeError\n                return False\n\n        # The options are: 1) same class & parameters; 2) same class, different\n        # parameters; 3) different classes, equivalent parameters; 4) different\n        # classes, different parameters. (1) & (3) => True, (2) & (4) => False.\n        equiv = self.__equiv__(other)\n        if equiv is NotImplemented and hasattr(other, \"__equiv__\"):\n            equiv = other.__equiv__(self)  # that failed, try from 'other'\n\n        return equiv if equiv is not NotImplemented else False"},{"attributeType":"null","col":8,"comment":"null","endLoc":1066,"id":14029,"name":"_calc_uncertainties","nodeType":"Attribute","startLoc":1066,"text":"self._calc_uncertainties"},{"attributeType":"StandardDeviations","col":8,"comment":"null","endLoc":1102,"id":14030,"name":"stds","nodeType":"Attribute","startLoc":1102,"text":"model.stds"},{"attributeType":"null","col":8,"comment":"null","endLoc":1057,"id":14031,"name":"fit_info","nodeType":"Attribute","startLoc":1057,"text":"self.fit_info"},{"attributeType":"Covariance","col":8,"comment":"null","endLoc":1101,"id":14032,"name":"cov_matrix","nodeType":"Attribute","startLoc":1101,"text":"model.cov_matrix"},{"fileName":"core.py","filePath":"astropy/cosmology","id":14033,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport abc\nimport functools\nimport inspect\nfrom types import FunctionType, MappingProxyType\n\nimport numpy as np\n\nimport astropy.units as u\nfrom astropy.io.registry import UnifiedReadWriteMethod\nfrom astropy.utils.decorators import classproperty\nfrom astropy.utils.metadata import MetaData\n\nfrom .connect import CosmologyFromFormat, CosmologyRead, CosmologyToFormat, CosmologyWrite\nfrom .parameter import Parameter\n\n# Originally authored by Andrew Becker (becker@astro.washington.edu),\n# and modified by Neil Crighton (neilcrighton@gmail.com), Roban Kramer\n# (robanhk@gmail.com), and Nathaniel Starkman (n.starkman@mail.utoronto.ca).\n\n# Many of these adapted from Hogg 1999, astro-ph/9905116\n# and Linder 2003, PRL 90, 91301\n\n__all__ = [\"Cosmology\", \"CosmologyError\", \"FlatCosmologyMixin\"]\n\n__doctest_requires__ = {}  # needed until __getattr__ removed\n\n# registry of cosmology classes with {key=name : value=class}\n_COSMOLOGY_CLASSES = dict()\n\n\nclass CosmologyError(Exception):\n    pass\n\n\nclass Cosmology(metaclass=abc.ABCMeta):\n    \"\"\"Base-class for all Cosmologies.\n\n    Parameters\n    ----------\n    *args\n        Arguments into the cosmology; used by subclasses, not this base class.\n    name : str or None (optional, keyword-only)\n        The name of the cosmology.\n    meta : dict or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n    **kwargs\n        Arguments into the cosmology; used by subclasses, not this base class.\n\n    Notes\n    -----\n    Class instances are static -- you cannot (and should not) change the values\n    of the parameters.  That is, all of the above attributes (except meta) are\n    read only.\n\n    For details on how to create performant custom subclasses, see the\n    documentation on :ref:`astropy-cosmology-fast-integrals`.\n    \"\"\"\n\n    meta = MetaData()\n\n    # Unified I/O object interchange methods\n    from_format = UnifiedReadWriteMethod(CosmologyFromFormat)\n    to_format = UnifiedReadWriteMethod(CosmologyToFormat)\n\n    # Unified I/O read and write methods\n    read = UnifiedReadWriteMethod(CosmologyRead)\n    write = UnifiedReadWriteMethod(CosmologyWrite)\n\n    # Parameters\n    __parameters__ = ()\n    __all_parameters__ = ()\n\n    # ---------------------------------------------------------------\n\n    def __init_subclass__(cls):\n        super().__init_subclass__()\n\n        # -------------------\n        # Parameters\n\n        # Get parameters that are still Parameters, either in this class or above.\n        parameters = []\n        derived_parameters = []\n        for n in cls.__parameters__:\n            p = getattr(cls, n)\n            if isinstance(p, Parameter):\n                derived_parameters.append(n) if p.derived else parameters.append(n)\n\n        # Add new parameter definitions\n        for n, v in cls.__dict__.items():\n            if n in parameters or n.startswith(\"_\") or not isinstance(v, Parameter):\n                continue\n            derived_parameters.append(n) if v.derived else parameters.append(n)\n\n        # reorder to match signature\n        ordered = [parameters.pop(parameters.index(n))\n                   for n in cls._init_signature.parameters.keys()\n                   if n in parameters]\n        parameters = ordered + parameters  # place \"unordered\" at the end\n        cls.__parameters__ = tuple(parameters)\n        cls.__all_parameters__ = cls.__parameters__ + tuple(derived_parameters)\n\n        # -------------------\n        # register as a Cosmology subclass\n        _COSMOLOGY_CLASSES[cls.__qualname__] = cls\n\n    @classproperty(lazy=True)\n    def _init_signature(cls):\n        \"\"\"Initialization signature (without 'self').\"\"\"\n        # get signature, dropping \"self\" by taking arguments [1:]\n        sig = inspect.signature(cls.__init__)\n        sig = sig.replace(parameters=list(sig.parameters.values())[1:])\n        return sig\n\n    # ---------------------------------------------------------------\n\n    def __init__(self, name=None, meta=None):\n        self._name = str(name) if name is not None else name\n        self.meta.update(meta or {})\n\n    @property\n    def name(self):\n        \"\"\"The name of the Cosmology instance.\"\"\"\n        return self._name\n\n    @property\n    @abc.abstractmethod\n    def is_flat(self):\n        \"\"\"\n        Return bool; `True` if the cosmology is flat.\n        This is abstract and must be defined in subclasses.\n        \"\"\"\n        raise NotImplementedError(\"is_flat is not implemented\")\n\n    def clone(self, *, meta=None, **kwargs):\n        \"\"\"Returns a copy of this object with updated parameters, as specified.\n\n        This cannot be used to change the type of the cosmology, so ``clone()``\n        cannot be used to change between flat and non-flat cosmologies.\n\n        Parameters\n        ----------\n        meta : mapping or None (optional, keyword-only)\n            Metadata that will update the current metadata.\n        **kwargs\n            Cosmology parameter (and name) modifications.\n            If any parameter is changed and a new name is not given, the name\n            will be set to \"[old name] (modified)\".\n\n        Returns\n        -------\n        newcosmo : `~astropy.cosmology.Cosmology` subclass instance\n            A new instance of this class with updated parameters as specified.\n            If no modifications are requested, then a reference to this object\n            is returned instead of copy.\n\n        Examples\n        --------\n        To make a copy of the ``Planck13`` cosmology with a different matter\n        density (``Om0``), and a new name:\n\n            >>> from astropy.cosmology import Planck13\n            >>> newcosmo = Planck13.clone(name=\"Modified Planck 2013\", Om0=0.35)\n\n        If no name is specified, the new name will note the modification.\n\n            >>> Planck13.clone(Om0=0.35).name\n            'Planck13 (modified)'\n        \"\"\"\n        # Quick return check, taking advantage of the Cosmology immutability.\n        if meta is None and not kwargs:\n            return self\n\n        # There are changed parameter or metadata values.\n        # The name needs to be changed accordingly, if it wasn't already.\n        kwargs.setdefault(\"name\", (self.name + \" (modified)\"\n                                   if self.name is not None else None))\n\n        # mix new meta into existing, preferring the former.\n        new_meta = {**self.meta, **(meta or {})}\n        # Mix kwargs into initial arguments, preferring the former.\n        new_init = {**self._init_arguments, \"meta\": new_meta, **kwargs}\n        # Create BoundArgument to handle args versus kwargs.\n        # This also handles all errors from mismatched arguments\n        ba = self._init_signature.bind_partial(**new_init)\n        # Return new instance, respecting args vs kwargs\n        return self.__class__(*ba.args, **ba.kwargs)\n\n    @property\n    def _init_arguments(self):\n        # parameters\n        kw = {n: getattr(self, n) for n in self.__parameters__}\n\n        # other info\n        kw[\"name\"] = self.name\n        kw[\"meta\"] = self.meta\n\n        return kw\n\n    # ---------------------------------------------------------------\n    # comparison methods\n\n    def is_equivalent(self, other, *, format=False):\n        r\"\"\"Check equivalence between Cosmologies.\n\n        Two cosmologies may be equivalent even if not the same class.\n        For example, an instance of ``LambdaCDM`` might have :math:`\\Omega_0=1`\n        and :math:`\\Omega_k=0` and therefore be flat, like ``FlatLambdaCDM``.\n\n        Parameters\n        ----------\n        other : `~astropy.cosmology.Cosmology` subclass instance\n            The object in which to compare.\n        format : bool or None or str, optional keyword-only\n            Whether to allow, before equivalence is checked, the object to be\n            converted to a |Cosmology|. This allows, e.g. a |Table| to be\n            equivalent to a Cosmology.\n            `False` (default) will not allow conversion. `True` or `None` will,\n            and will use the auto-identification to try to infer the correct\n            format. A `str` is assumed to be the correct format to use when\n            converting.\n\n        Returns\n        -------\n        bool\n            True if cosmologies are equivalent, False otherwise.\n\n        Examples\n        --------\n        Two cosmologies may be equivalent even if not of the same class.\n        In this examples the ``LambdaCDM`` has ``Ode0`` set to the same value\n        calculated in ``FlatLambdaCDM``.\n\n            >>> import astropy.units as u\n            >>> from astropy.cosmology import LambdaCDM, FlatLambdaCDM\n            >>> cosmo1 = LambdaCDM(70 * (u.km/u.s/u.Mpc), 0.3, 0.7)\n            >>> cosmo2 = FlatLambdaCDM(70 * (u.km/u.s/u.Mpc), 0.3)\n            >>> cosmo1.is_equivalent(cosmo2)\n            True\n\n        While in this example, the cosmologies are not equivalent.\n\n            >>> cosmo3 = FlatLambdaCDM(70 * (u.km/u.s/u.Mpc), 0.3, Tcmb0=3 * u.K)\n            >>> cosmo3.is_equivalent(cosmo2)\n            False\n\n        Also, using the keyword argument, the notion of equivalence is extended\n        to any Python object that can be converted to a |Cosmology|.\n\n            >>> from astropy.cosmology import Planck18\n            >>> tbl = Planck18.to_format(\"astropy.table\")\n            >>> Planck18.is_equivalent(tbl, format=True)\n            True\n\n        The list of valid formats, e.g. the |Table| in this example, may be\n        checked with ``Cosmology.from_format.list_formats()``.\n\n        As can be seen in the list of formats, not all formats can be\n        auto-identified by ``Cosmology.from_format.registry``. Objects of\n        these kinds can still be checked for equivalence, but the correct\n        format string must be used.\n\n            >>> tbl = Planck18.to_format(\"yaml\")\n            >>> Planck18.is_equivalent(tbl, format=\"yaml\")\n            True\n        \"\"\"\n        # Allow for different formats to be considered equivalent.\n        if format is not False:\n            format = None if format is True else format  # str->str, None/True->None\n            try:\n                other = Cosmology.from_format(other, format=format)\n            except Exception:  # TODO! should enforce only TypeError\n                return False\n\n        # The options are: 1) same class & parameters; 2) same class, different\n        # parameters; 3) different classes, equivalent parameters; 4) different\n        # classes, different parameters. (1) & (3) => True, (2) & (4) => False.\n        equiv = self.__equiv__(other)\n        if equiv is NotImplemented and hasattr(other, \"__equiv__\"):\n            equiv = other.__equiv__(self)  # that failed, try from 'other'\n\n        return equiv if equiv is not NotImplemented else False\n\n    def __equiv__(self, other):\n        \"\"\"Cosmology equivalence. Use ``.is_equivalent()`` for actual check!\n\n        Parameters\n        ----------\n        other : `~astropy.cosmology.Cosmology` subclass instance\n            The object in which to compare.\n\n        Returns\n        -------\n        bool or `NotImplemented`\n            `NotImplemented` if 'other' is from a different class.\n            `True` if 'other' is of the same class and has matching parameters\n            and parameter values. `False` otherwise.\n        \"\"\"\n        if other.__class__ is not self.__class__:\n            return NotImplemented  # allows other.__equiv__\n\n        # check all parameters in 'other' match those in 'self' and 'other' has\n        # no extra parameters (latter part should never happen b/c same class)\n        params_eq = (set(self.__all_parameters__) == set(other.__all_parameters__)\n                     and all(np.all(getattr(self, k) == getattr(other, k))\n                             for k in self.__all_parameters__))\n        return params_eq\n\n    def __eq__(self, other):\n        \"\"\"Check equality between Cosmologies.\n\n        Checks the Parameters and immutable fields (i.e. not \"meta\").\n\n        Parameters\n        ----------\n        other : `~astropy.cosmology.Cosmology` subclass instance\n            The object in which to compare.\n\n        Returns\n        -------\n        bool\n            `True` if Parameters and names are the same, `False` otherwise.\n        \"\"\"\n        if other.__class__ is not self.__class__:\n            return NotImplemented  # allows other.__eq__\n\n        # check all parameters in 'other' match those in 'self'\n        equivalent = self.__equiv__(other)\n        # non-Parameter checks: name\n        name_eq = (self.name == other.name)\n\n        return equivalent and name_eq\n\n    # ---------------------------------------------------------------\n\n    def __repr__(self):\n        ps = {k: getattr(self, k) for k in self.__parameters__}  # values\n        cps = {k: getattr(self.__class__, k) for k in self.__parameters__}  # Parameter objects\n\n        namelead = f\"{self.__class__.__qualname__}(\"\n        if self.name is not None:\n            namelead += f\"name=\\\"{self.name}\\\", \"\n        # nicely formatted parameters\n        fmtps = (k + '=' + format(v, cps[k].format_spec if v is not None else '')\n                 for k, v in ps.items())\n\n        return namelead + \", \".join(fmtps) + \")\"\n\n    def __astropy_table__(self, cls, copy, **kwargs):\n        \"\"\"Return a `~astropy.table.Table` of type ``cls``.\n\n        Parameters\n        ----------\n        cls : type\n            Astropy ``Table`` class or subclass.\n        copy : bool\n            Ignored.\n        **kwargs : dict, optional\n            Additional keyword arguments. Passed to ``self.to_format()``.\n            See ``Cosmology.to_format.help(\"astropy.table\")`` for allowed kwargs.\n\n        Returns\n        -------\n        `astropy.table.Table` or subclass instance\n            Instance of type ``cls``.\n        \"\"\"\n        return self.to_format(\"astropy.table\", cls=cls, **kwargs)\n\n\nclass FlatCosmologyMixin(metaclass=abc.ABCMeta):\n    \"\"\"\n    Mixin class for flat cosmologies. Do NOT instantiate directly.\n    Note that all instances of ``FlatCosmologyMixin`` are flat, but not all\n    flat cosmologies are instances of ``FlatCosmologyMixin``. As example,\n    ``LambdaCDM`` **may** be flat (for the a specific set of parameter values),\n    but ``FlatLambdaCDM`` **will** be flat.\n    \"\"\"\n\n    @property\n    def is_flat(self):\n        \"\"\"Return `True`, the cosmology is flat.\"\"\"\n        return True\n\n\n# -----------------------------------------------------------------------------\n\n\ndef __getattr__(attr):\n    from . import flrw\n\n    if hasattr(flrw, attr):\n        import warnings\n\n        from astropy.utils.exceptions import AstropyDeprecationWarning\n\n        warnings.warn(\n            f\"`astropy.cosmology.core.{attr}` has been moved (since v5.0) and \"\n            f\"should be imported as ``from astropy.cosmology import {attr}``.\"\n            \" In future this will raise an exception.\",\n            AstropyDeprecationWarning\n        )\n\n        return getattr(flrw, attr)\n\n    raise AttributeError(f\"module {__name__!r} has no attribute {attr!r}.\")\n"},{"col":4,"comment":"Cosmology equivalence. Use ``.is_equivalent()`` for actual check!\n\n        Parameters\n        ----------\n        other : `~astropy.cosmology.Cosmology` subclass instance\n            The object in which to compare.\n\n        Returns\n        -------\n        bool or `NotImplemented`\n            `NotImplemented` if 'other' is from a different class.\n            `True` if 'other' is of the same class and has matching parameters\n            and parameter values. `False` otherwise.\n        ","endLoc":309,"header":"def __equiv__(self, other)","id":14034,"name":"__equiv__","nodeType":"Function","startLoc":286,"text":"def __equiv__(self, other):\n        \"\"\"Cosmology equivalence. Use ``.is_equivalent()`` for actual check!\n\n        Parameters\n        ----------\n        other : `~astropy.cosmology.Cosmology` subclass instance\n            The object in which to compare.\n\n        Returns\n        -------\n        bool or `NotImplemented`\n            `NotImplemented` if 'other' is from a different class.\n            `True` if 'other' is of the same class and has matching parameters\n            and parameter values. `False` otherwise.\n        \"\"\"\n        if other.__class__ is not self.__class__:\n            return NotImplemented  # allows other.__equiv__\n\n        # check all parameters in 'other' match those in 'self' and 'other' has\n        # no extra parameters (latter part should never happen b/c same class)\n        params_eq = (set(self.__all_parameters__) == set(other.__all_parameters__)\n                     and all(np.all(getattr(self, k) == getattr(other, k))\n                             for k in self.__all_parameters__))\n        return params_eq"},{"className":"CosmologyFromFormat","col":0,"comment":"Transform object to a `~astropy.cosmology.Cosmology`.\n\n    This function provides the Cosmology interface to the Astropy unified I/O\n    layer. This allows easily parsing supported data formats using\n    syntax such as::\n\n      >>> from astropy.cosmology import Cosmology\n      >>> cosmo1 = Cosmology.from_format(cosmo_mapping, format='mapping')\n\n    When the ``from_format`` method is called from a subclass the subclass will\n    provide a keyword argument ``cosmology=<class>`` to the registered parser.\n    The method uses this cosmology class, regardless of the class indicated in\n    the data, and sets parameters' default values from the class' signature.\n\n    Get help on the available readers using the ``help()`` method::\n\n      >>> Cosmology.from_format.help()  # Get help and list supported formats\n      >>> Cosmology.from_format.help('<format>')  # Get detailed help on a format\n      >>> Cosmology.from_format.list_formats()  # Print list of available formats\n\n    See also: https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    obj : object\n        The object to parse according to 'format'\n    *args\n        Positional arguments passed through to data parser.\n    format : str or None, optional keyword-only\n        Object format specifier. For `None` (default) CosmologyFromFormat tries\n        to identify the correct format.\n    **kwargs\n        Keyword arguments passed through to data parser.\n        Parsers should accept the following keyword arguments:\n\n        - cosmology : the class (or string name thereof) to use / check when\n                      constructing the cosmology instance.\n\n    Returns\n    -------\n    out : `~astropy.cosmology.Cosmology` subclass instance\n        `~astropy.cosmology.Cosmology` corresponding to ``obj`` contents.\n\n    ","endLoc":203,"id":14035,"nodeType":"Class","startLoc":135,"text":"class CosmologyFromFormat(io_registry.UnifiedReadWrite):\n    \"\"\"Transform object to a `~astropy.cosmology.Cosmology`.\n\n    This function provides the Cosmology interface to the Astropy unified I/O\n    layer. This allows easily parsing supported data formats using\n    syntax such as::\n\n      >>> from astropy.cosmology import Cosmology\n      >>> cosmo1 = Cosmology.from_format(cosmo_mapping, format='mapping')\n\n    When the ``from_format`` method is called from a subclass the subclass will\n    provide a keyword argument ``cosmology=<class>`` to the registered parser.\n    The method uses this cosmology class, regardless of the class indicated in\n    the data, and sets parameters' default values from the class' signature.\n\n    Get help on the available readers using the ``help()`` method::\n\n      >>> Cosmology.from_format.help()  # Get help and list supported formats\n      >>> Cosmology.from_format.help('<format>')  # Get detailed help on a format\n      >>> Cosmology.from_format.list_formats()  # Print list of available formats\n\n    See also: https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    obj : object\n        The object to parse according to 'format'\n    *args\n        Positional arguments passed through to data parser.\n    format : str or None, optional keyword-only\n        Object format specifier. For `None` (default) CosmologyFromFormat tries\n        to identify the correct format.\n    **kwargs\n        Keyword arguments passed through to data parser.\n        Parsers should accept the following keyword arguments:\n\n        - cosmology : the class (or string name thereof) to use / check when\n                      constructing the cosmology instance.\n\n    Returns\n    -------\n    out : `~astropy.cosmology.Cosmology` subclass instance\n        `~astropy.cosmology.Cosmology` corresponding to ``obj`` contents.\n\n    \"\"\"\n\n    def __init__(self, instance, cosmo_cls):\n        super().__init__(instance, cosmo_cls, \"read\", registry=convert_registry)\n\n    def __call__(self, obj, *args, format=None, **kwargs):\n        from astropy.cosmology.core import Cosmology\n\n        # so subclasses can override, also pass the class as a kwarg.\n        # allows for `FlatLambdaCDM.read` and\n        # `Cosmology.read(..., cosmology=FlatLambdaCDM)`\n        if self._cls is not Cosmology:\n            kwargs.setdefault(\"cosmology\", self._cls)  # set, if not present\n            # check that it is the correct cosmology, can be wrong if user\n            # passes in e.g. `w0wzCDM.read(..., cosmology=FlatLambdaCDM)`\n            valid = (self._cls, self._cls.__qualname__)\n            if kwargs[\"cosmology\"] not in valid:\n                raise ValueError(\n                    \"keyword argument `cosmology` must be either the class \"\n                    f\"{valid[0]} or its qualified name '{valid[1]}'\")\n\n        with add_enabled_units(cu):\n            cosmo = self.registry.read(self._cls, obj, *args, format=format, **kwargs)\n\n        return cosmo"},{"className":"SLSQPLSQFitter","col":0,"comment":"\n    Sequential Least Squares Programming (SLSQP) optimization algorithm and\n    least squares statistic.\n\n    Raises\n    ------\n    ModelLinearityError\n        A linear model is passed to a nonlinear fitter\n\n    Notes\n    -----\n    See also the `~astropy.modeling.optimizers.SLSQP` optimizer.\n\n    ","endLoc":1325,"id":14036,"nodeType":"Class","startLoc":1251,"text":"class SLSQPLSQFitter(Fitter):\n    \"\"\"\n    Sequential Least Squares Programming (SLSQP) optimization algorithm and\n    least squares statistic.\n\n    Raises\n    ------\n    ModelLinearityError\n        A linear model is passed to a nonlinear fitter\n\n    Notes\n    -----\n    See also the `~astropy.modeling.optimizers.SLSQP` optimizer.\n\n    \"\"\"\n\n    supported_constraints = SLSQP.supported_constraints\n\n    def __init__(self):\n        super().__init__(optimizer=SLSQP, statistic=leastsquare)\n        self.fit_info = {}\n\n    @fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None, **kwargs):\n        \"\"\"\n        Fit data to this model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            model to fit to x, y, z\n        x : array\n            input coordinates\n        y : array\n            input coordinates\n        z : array, optional\n            input coordinates\n        weights : array, optional\n            Weights for fitting.\n            For data with Gaussian uncertainties, the weights should be\n            1/sigma.\n        kwargs : dict\n            optional keyword arguments to be passed to the optimizer or the statistic\n        verblevel : int\n            0-silent\n            1-print summary upon completion,\n            2-print summary after each iteration\n        maxiter : int\n            maximum number of iterations\n        epsilon : float\n            the step size for finite-difference derivative estimates\n        acc : float\n            Requested accuracy\n        equivalencies : list or None, optional, keyword-only\n            List of *additional* equivalencies that are should be applied in\n            case x, y and/or z have units. Default is None.\n\n        Returns\n        -------\n        model_copy : `~astropy.modeling.FittableModel`\n            a copy of the input model with parameters set by the fitter\n\n        \"\"\"\n\n        model_copy = _validate_model(model, self._opt_method.supported_constraints)\n        model_copy.sync_constraints = False\n        farg = _convert_input(x, y, z)\n        farg = (model_copy, weights, ) + farg\n        init_values, _ = model_to_fit_params(model_copy)\n        fitparams, self.fit_info = self._opt_method(\n            self.objective_function, init_values, farg, **kwargs)\n        fitter_to_model_params(model_copy, fitparams)\n\n        model_copy.sync_constraints = True\n        return model_copy"},{"col":4,"comment":"null","endLoc":1271,"header":"def __init__(self)","id":14037,"name":"__init__","nodeType":"Function","startLoc":1269,"text":"def __init__(self):\n        super().__init__(optimizer=SLSQP, statistic=leastsquare)\n        self.fit_info = {}"},{"col":4,"comment":"Check equality between Cosmologies.\n\n        Checks the Parameters and immutable fields (i.e. not \"meta\").\n\n        Parameters\n        ----------\n        other : `~astropy.cosmology.Cosmology` subclass instance\n            The object in which to compare.\n\n        Returns\n        -------\n        bool\n            `True` if Parameters and names are the same, `False` otherwise.\n        ","endLoc":334,"header":"def __eq__(self, other)","id":14038,"name":"__eq__","nodeType":"Function","startLoc":311,"text":"def __eq__(self, other):\n        \"\"\"Check equality between Cosmologies.\n\n        Checks the Parameters and immutable fields (i.e. not \"meta\").\n\n        Parameters\n        ----------\n        other : `~astropy.cosmology.Cosmology` subclass instance\n            The object in which to compare.\n\n        Returns\n        -------\n        bool\n            `True` if Parameters and names are the same, `False` otherwise.\n        \"\"\"\n        if other.__class__ is not self.__class__:\n            return NotImplemented  # allows other.__eq__\n\n        # check all parameters in 'other' match those in 'self'\n        equivalent = self.__equiv__(other)\n        # non-Parameter checks: name\n        name_eq = (self.name == other.name)\n\n        return equivalent and name_eq"},{"col":4,"comment":"null","endLoc":349,"header":"def __repr__(self)","id":14040,"name":"__repr__","nodeType":"Function","startLoc":338,"text":"def __repr__(self):\n        ps = {k: getattr(self, k) for k in self.__parameters__}  # values\n        cps = {k: getattr(self.__class__, k) for k in self.__parameters__}  # Parameter objects\n\n        namelead = f\"{self.__class__.__qualname__}(\"\n        if self.name is not None:\n            namelead += f\"name=\\\"{self.name}\\\", \"\n        # nicely formatted parameters\n        fmtps = (k + '=' + format(v, cps[k].format_spec if v is not None else '')\n                 for k, v in ps.items())\n\n        return namelead + \", \".join(fmtps) + \")\""},{"col":0,"comment":"Convert quantities between redshift and CMB temperature.\n\n    Care should be taken to not misinterpret a relativistic, gravitational, etc\n    redshift as a cosmological one.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology`, str, or None, optional\n        A cosmology realization or built-in cosmology's name (e.g. 'Planck18').\n        If None, will use the default cosmology\n        (controlled by :class:`~astropy.cosmology.default_cosmology`).\n    **atzkw\n        keyword arguments for :func:`~astropy.cosmology.z_at_value`\n\n    Returns\n    -------\n    `~astropy.units.equivalencies.Equivalency`\n        Equivalency between redshift and temperature.\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> import astropy.cosmology.units as cu\n    >>> from astropy.cosmology import WMAP9\n\n    >>> z = 1100 * cu.redshift\n    >>> z.to(u.K, cu.redshift_temperature(WMAP9))\n    <Quantity 3000.225 K>\n    ","endLoc":224,"header":"def redshift_temperature(cosmology=None, **atzkw)","id":14041,"name":"redshift_temperature","nodeType":"Function","startLoc":179,"text":"def redshift_temperature(cosmology=None, **atzkw):\n    \"\"\"Convert quantities between redshift and CMB temperature.\n\n    Care should be taken to not misinterpret a relativistic, gravitational, etc\n    redshift as a cosmological one.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology`, str, or None, optional\n        A cosmology realization or built-in cosmology's name (e.g. 'Planck18').\n        If None, will use the default cosmology\n        (controlled by :class:`~astropy.cosmology.default_cosmology`).\n    **atzkw\n        keyword arguments for :func:`~astropy.cosmology.z_at_value`\n\n    Returns\n    -------\n    `~astropy.units.equivalencies.Equivalency`\n        Equivalency between redshift and temperature.\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> import astropy.cosmology.units as cu\n    >>> from astropy.cosmology import WMAP9\n\n    >>> z = 1100 * cu.redshift\n    >>> z.to(u.K, cu.redshift_temperature(WMAP9))\n    <Quantity 3000.225 K>\n    \"\"\"\n    from astropy.cosmology import default_cosmology, z_at_value\n\n    # get cosmology: None -> default and process str / class\n    cosmology = cosmology if cosmology is not None else default_cosmology.get()\n    with default_cosmology.set(cosmology):  # if already cosmo, passes through\n        cosmology = default_cosmology.get()\n\n    def z_to_Tcmb(z):\n        return cosmology.Tcmb(z)\n\n    def Tcmb_to_z(T):\n        return z_at_value(cosmology.Tcmb, T << u.K, **atzkw)\n\n    return u.Equivalency([(redshift, u.K, z_to_Tcmb, Tcmb_to_z)],\n                         \"redshift_temperature\",\n                         {'cosmology': cosmology})"},{"col":4,"comment":"null","endLoc":182,"header":"def __init__(self, instance, cosmo_cls)","id":14042,"name":"__init__","nodeType":"Function","startLoc":181,"text":"def __init__(self, instance, cosmo_cls):\n        super().__init__(instance, cosmo_cls, \"read\", registry=convert_registry)"},{"col":4,"comment":"Return a `~astropy.table.Table` of type ``cls``.\n\n        Parameters\n        ----------\n        cls : type\n            Astropy ``Table`` class or subclass.\n        copy : bool\n            Ignored.\n        **kwargs : dict, optional\n            Additional keyword arguments. Passed to ``self.to_format()``.\n            See ``Cosmology.to_format.help(\"astropy.table\")`` for allowed kwargs.\n\n        Returns\n        -------\n        `astropy.table.Table` or subclass instance\n            Instance of type ``cls``.\n        ","endLoc":369,"header":"def __astropy_table__(self, cls, copy, **kwargs)","id":14043,"name":"__astropy_table__","nodeType":"Function","startLoc":351,"text":"def __astropy_table__(self, cls, copy, **kwargs):\n        \"\"\"Return a `~astropy.table.Table` of type ``cls``.\n\n        Parameters\n        ----------\n        cls : type\n            Astropy ``Table`` class or subclass.\n        copy : bool\n            Ignored.\n        **kwargs : dict, optional\n            Additional keyword arguments. Passed to ``self.to_format()``.\n            See ``Cosmology.to_format.help(\"astropy.table\")`` for allowed kwargs.\n\n        Returns\n        -------\n        `astropy.table.Table` or subclass instance\n            Instance of type ``cls``.\n        \"\"\"\n        return self.to_format(\"astropy.table\", cls=cls, **kwargs)"},{"col":4,"comment":"\n        Fit data to this model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            model to fit to x, y, z\n        x : array\n            input coordinates\n        y : array\n            input coordinates\n        z : array, optional\n            input coordinates\n        weights : array, optional\n            Weights for fitting.\n            For data with Gaussian uncertainties, the weights should be\n            1/sigma.\n        kwargs : dict\n            optional keyword arguments to be passed to the optimizer or the statistic\n        verblevel : int\n            0-silent\n            1-print summary upon completion,\n            2-print summary after each iteration\n        maxiter : int\n            maximum number of iterations\n        epsilon : float\n            the step size for finite-difference derivative estimates\n        acc : float\n            Requested accuracy\n        equivalencies : list or None, optional, keyword-only\n            List of *additional* equivalencies that are should be applied in\n            case x, y and/or z have units. Default is None.\n\n        Returns\n        -------\n        model_copy : `~astropy.modeling.FittableModel`\n            a copy of the input model with parameters set by the fitter\n\n        ","endLoc":1325,"header":"@fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None, **kwargs)","id":14044,"name":"__call__","nodeType":"Function","startLoc":1273,"text":"@fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None, **kwargs):\n        \"\"\"\n        Fit data to this model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            model to fit to x, y, z\n        x : array\n            input coordinates\n        y : array\n            input coordinates\n        z : array, optional\n            input coordinates\n        weights : array, optional\n            Weights for fitting.\n            For data with Gaussian uncertainties, the weights should be\n            1/sigma.\n        kwargs : dict\n            optional keyword arguments to be passed to the optimizer or the statistic\n        verblevel : int\n            0-silent\n            1-print summary upon completion,\n            2-print summary after each iteration\n        maxiter : int\n            maximum number of iterations\n        epsilon : float\n            the step size for finite-difference derivative estimates\n        acc : float\n            Requested accuracy\n        equivalencies : list or None, optional, keyword-only\n            List of *additional* equivalencies that are should be applied in\n            case x, y and/or z have units. Default is None.\n\n        Returns\n        -------\n        model_copy : `~astropy.modeling.FittableModel`\n            a copy of the input model with parameters set by the fitter\n\n        \"\"\"\n\n        model_copy = _validate_model(model, self._opt_method.supported_constraints)\n        model_copy.sync_constraints = False\n        farg = _convert_input(x, y, z)\n        farg = (model_copy, weights, ) + farg\n        init_values, _ = model_to_fit_params(model_copy)\n        fitparams, self.fit_info = self._opt_method(\n            self.objective_function, init_values, farg, **kwargs)\n        fitter_to_model_params(model_copy, fitparams)\n\n        model_copy.sync_constraints = True\n        return model_copy"},{"col":4,"comment":"null","endLoc":203,"header":"def __call__(self, obj, *args, format=None, **kwargs)","id":14045,"name":"__call__","nodeType":"Function","startLoc":184,"text":"def __call__(self, obj, *args, format=None, **kwargs):\n        from astropy.cosmology.core import Cosmology\n\n        # so subclasses can override, also pass the class as a kwarg.\n        # allows for `FlatLambdaCDM.read` and\n        # `Cosmology.read(..., cosmology=FlatLambdaCDM)`\n        if self._cls is not Cosmology:\n            kwargs.setdefault(\"cosmology\", self._cls)  # set, if not present\n            # check that it is the correct cosmology, can be wrong if user\n            # passes in e.g. `w0wzCDM.read(..., cosmology=FlatLambdaCDM)`\n            valid = (self._cls, self._cls.__qualname__)\n            if kwargs[\"cosmology\"] not in valid:\n                raise ValueError(\n                    \"keyword argument `cosmology` must be either the class \"\n                    f\"{valid[0]} or its qualified name '{valid[1]}'\")\n\n        with add_enabled_units(cu):\n            cosmo = self.registry.read(self._cls, obj, *args, format=format, **kwargs)\n\n        return cosmo"},{"attributeType":"null","col":4,"comment":"null","endLoc":61,"id":14046,"name":"meta","nodeType":"Attribute","startLoc":61,"text":"meta"},{"attributeType":"null","col":4,"comment":"null","endLoc":64,"id":14047,"name":"from_format","nodeType":"Attribute","startLoc":64,"text":"from_format"},{"attributeType":"null","col":4,"comment":"null","endLoc":65,"id":14048,"name":"to_format","nodeType":"Attribute","startLoc":65,"text":"to_format"},{"attributeType":"null","col":4,"comment":"null","endLoc":68,"id":14049,"name":"read","nodeType":"Attribute","startLoc":68,"text":"read"},{"className":"CosmologyRead","col":0,"comment":"Read and parse data to a `~astropy.cosmology.Cosmology`.\n\n    This function provides the Cosmology interface to the Astropy unified I/O\n    layer. This allows easily reading a file in supported data formats using\n    syntax such as::\n\n        >>> from astropy.cosmology import Cosmology\n        >>> cosmo1 = Cosmology.read('<file name>')\n\n    When the ``read`` method is called from a subclass the subclass will\n    provide a keyword argument ``cosmology=<class>`` to the registered read\n    method. The method uses this cosmology class, regardless of the class\n    indicated in the file, and sets parameters' default values from the class'\n    signature.\n\n    Get help on the available readers using the ``help()`` method::\n\n      >>> Cosmology.read.help()  # Get help reading and list supported formats\n      >>> Cosmology.read.help(format='<format>')  # Get detailed help on a format\n      >>> Cosmology.read.list_formats()  # Print list of available formats\n\n    See also: https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    *args\n        Positional arguments passed through to data reader. If supplied the\n        first argument is typically the input filename.\n    format : str (optional, keyword-only)\n        File format specifier.\n    **kwargs\n        Keyword arguments passed through to data reader.\n\n    Returns\n    -------\n    out : `~astropy.cosmology.Cosmology` subclass instance\n        `~astropy.cosmology.Cosmology` corresponding to file contents.\n\n    Notes\n    -----\n    ","endLoc":87,"id":14050,"nodeType":"Class","startLoc":22,"text":"class CosmologyRead(io_registry.UnifiedReadWrite):\n    \"\"\"Read and parse data to a `~astropy.cosmology.Cosmology`.\n\n    This function provides the Cosmology interface to the Astropy unified I/O\n    layer. This allows easily reading a file in supported data formats using\n    syntax such as::\n\n        >>> from astropy.cosmology import Cosmology\n        >>> cosmo1 = Cosmology.read('<file name>')\n\n    When the ``read`` method is called from a subclass the subclass will\n    provide a keyword argument ``cosmology=<class>`` to the registered read\n    method. The method uses this cosmology class, regardless of the class\n    indicated in the file, and sets parameters' default values from the class'\n    signature.\n\n    Get help on the available readers using the ``help()`` method::\n\n      >>> Cosmology.read.help()  # Get help reading and list supported formats\n      >>> Cosmology.read.help(format='<format>')  # Get detailed help on a format\n      >>> Cosmology.read.list_formats()  # Print list of available formats\n\n    See also: https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    *args\n        Positional arguments passed through to data reader. If supplied the\n        first argument is typically the input filename.\n    format : str (optional, keyword-only)\n        File format specifier.\n    **kwargs\n        Keyword arguments passed through to data reader.\n\n    Returns\n    -------\n    out : `~astropy.cosmology.Cosmology` subclass instance\n        `~astropy.cosmology.Cosmology` corresponding to file contents.\n\n    Notes\n    -----\n    \"\"\"\n\n    def __init__(self, instance, cosmo_cls):\n        super().__init__(instance, cosmo_cls, \"read\", registry=readwrite_registry)\n\n    def __call__(self, *args, **kwargs):\n        from astropy.cosmology.core import Cosmology\n\n        # so subclasses can override, also pass the class as a kwarg.\n        # allows for `FlatLambdaCDM.read` and\n        # `Cosmology.read(..., cosmology=FlatLambdaCDM)`\n        if self._cls is not Cosmology:\n            kwargs.setdefault(\"cosmology\", self._cls)  # set, if not present\n            # check that it is the correct cosmology, can be wrong if user\n            # passes in e.g. `w0wzCDM.read(..., cosmology=FlatLambdaCDM)`\n            valid = (self._cls, self._cls.__qualname__)\n            if kwargs[\"cosmology\"] not in valid:\n                raise ValueError(\n                    \"keyword argument `cosmology` must be either the class \"\n                    f\"{valid[0]} or its qualified name '{valid[1]}'\")\n\n        with add_enabled_units(cu):\n            cosmo = self.registry.read(self._cls, *args, **kwargs)\n\n        return cosmo"},{"attributeType":"null","col":4,"comment":"null","endLoc":69,"id":14051,"name":"write","nodeType":"Attribute","startLoc":69,"text":"write"},{"attributeType":"null","col":4,"comment":"null","endLoc":72,"id":14052,"name":"__parameters__","nodeType":"Attribute","startLoc":72,"text":"__parameters__"},{"col":4,"comment":"null","endLoc":66,"header":"def __init__(self, instance, cosmo_cls)","id":14053,"name":"__init__","nodeType":"Function","startLoc":65,"text":"def __init__(self, instance, cosmo_cls):\n        super().__init__(instance, cosmo_cls, \"read\", registry=readwrite_registry)"},{"attributeType":"null","col":4,"comment":"null","endLoc":73,"id":14054,"name":"__all_parameters__","nodeType":"Attribute","startLoc":73,"text":"__all_parameters__"},{"attributeType":"null","col":8,"comment":"null","endLoc":120,"id":14055,"name":"_name","nodeType":"Attribute","startLoc":120,"text":"self._name"},{"col":4,"comment":"null","endLoc":87,"header":"def __call__(self, *args, **kwargs)","id":14056,"name":"__call__","nodeType":"Function","startLoc":68,"text":"def __call__(self, *args, **kwargs):\n        from astropy.cosmology.core import Cosmology\n\n        # so subclasses can override, also pass the class as a kwarg.\n        # allows for `FlatLambdaCDM.read` and\n        # `Cosmology.read(..., cosmology=FlatLambdaCDM)`\n        if self._cls is not Cosmology:\n            kwargs.setdefault(\"cosmology\", self._cls)  # set, if not present\n            # check that it is the correct cosmology, can be wrong if user\n            # passes in e.g. `w0wzCDM.read(..., cosmology=FlatLambdaCDM)`\n            valid = (self._cls, self._cls.__qualname__)\n            if kwargs[\"cosmology\"] not in valid:\n                raise ValueError(\n                    \"keyword argument `cosmology` must be either the class \"\n                    f\"{valid[0]} or its qualified name '{valid[1]}'\")\n\n        with add_enabled_units(cu):\n            cosmo = self.registry.read(self._cls, *args, **kwargs)\n\n        return cosmo"},{"col":0,"comment":"Parameter value validator with units, and converted to float.","endLoc":330,"header":"@Parameter.register_validator(\"float\")\ndef _validate_to_float(cosmology, param, value)","id":14057,"name":"_validate_to_float","nodeType":"Function","startLoc":326,"text":"@Parameter.register_validator(\"float\")\ndef _validate_to_float(cosmology, param, value):\n    \"\"\"Parameter value validator with units, and converted to float.\"\"\"\n    value = _validate_with_unit(cosmology, param, value)\n    return float(value)"},{"className":"CosmologyToFormat","col":0,"comment":"Transform this Cosmology to another format.\n\n    This function provides the Cosmology interface to the astropy unified I/O\n    layer. This allows easily transforming to supported data formats\n    using syntax such as::\n\n      >>> from astropy.cosmology import Planck18\n      >>> Planck18.to_format(\"mapping\")\n      {'cosmology': astropy.cosmology.core.FlatLambdaCDM,\n       'name': 'Planck18',\n       'H0': <Quantity 67.66 km / (Mpc s)>,\n       'Om0': 0.30966,\n       ...\n\n    Get help on the available representations for ``Cosmology`` using the\n    ``help()`` method::\n\n      >>> Cosmology.to_format.help()  # Get help and list supported formats\n      >>> Cosmology.to_format.help('<format>')  # Get detailed help on format\n      >>> Cosmology.to_format.list_formats()  # Print list of available formats\n\n    Parameters\n    ----------\n    format : str\n        Format specifier.\n    *args\n        Positional arguments passed through to data writer. If supplied the\n        first argument is the output filename.\n    **kwargs\n        Keyword arguments passed through to data writer.\n\n    ","endLoc":245,"id":14058,"nodeType":"Class","startLoc":206,"text":"class CosmologyToFormat(io_registry.UnifiedReadWrite):\n    \"\"\"Transform this Cosmology to another format.\n\n    This function provides the Cosmology interface to the astropy unified I/O\n    layer. This allows easily transforming to supported data formats\n    using syntax such as::\n\n      >>> from astropy.cosmology import Planck18\n      >>> Planck18.to_format(\"mapping\")\n      {'cosmology': astropy.cosmology.core.FlatLambdaCDM,\n       'name': 'Planck18',\n       'H0': <Quantity 67.66 km / (Mpc s)>,\n       'Om0': 0.30966,\n       ...\n\n    Get help on the available representations for ``Cosmology`` using the\n    ``help()`` method::\n\n      >>> Cosmology.to_format.help()  # Get help and list supported formats\n      >>> Cosmology.to_format.help('<format>')  # Get detailed help on format\n      >>> Cosmology.to_format.list_formats()  # Print list of available formats\n\n    Parameters\n    ----------\n    format : str\n        Format specifier.\n    *args\n        Positional arguments passed through to data writer. If supplied the\n        first argument is the output filename.\n    **kwargs\n        Keyword arguments passed through to data writer.\n\n    \"\"\"\n\n    def __init__(self, instance, cls):\n        super().__init__(instance, cls, \"write\", registry=convert_registry)\n\n    def __call__(self, format, *args, **kwargs):\n        return self.registry.write(self._instance, None, *args, format=format,\n                                    **kwargs)"},{"col":0,"comment":"","endLoc":339,"header":"@Parameter.register_validator(\"scalar\")\ndef _validate_to_scalar(cosmology, param, value)","id":14059,"name":"_validate_to_scalar","nodeType":"Function","startLoc":333,"text":"@Parameter.register_validator(\"scalar\")\ndef _validate_to_scalar(cosmology, param, value):\n    \"\"\"\"\"\"\n    value = _validate_with_unit(cosmology, param, value)\n    if not value.isscalar:\n        raise ValueError(f\"{param.name} is a non-scalar quantity\")\n    return value"},{"col":0,"comment":"Convert quantities between measures of cosmological distance.\n\n    Note: by default all equivalencies are on and must be explicitly turned off.\n    Care should be taken to not misinterpret a relativistic, gravitational, etc\n    redshift as a cosmological one.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology`, str, or None, optional\n        A cosmology realization or built-in cosmology's name (e.g. 'Planck18').\n        If `None`, will use the default cosmology\n        (controlled by :class:`~astropy.cosmology.default_cosmology`).\n\n    distance : {'comoving', 'lookback', 'luminosity'} or None (optional, keyword-only)\n        The type of distance equivalency to create or `None`.\n        Default is 'comoving'.\n    hubble : bool (optional, keyword-only)\n        Whether to create a Hubble parameter <-> redshift equivalency, using\n        ``Cosmology.H``. Default is `True`.\n    Tcmb : bool (optional, keyword-only)\n        Whether to create a CMB temperature <-> redshift equivalency, using\n        ``Cosmology.Tcmb``. Default is `True`.\n\n    atzkw : dict or None (optional, keyword-only)\n        keyword arguments for :func:`~astropy.cosmology.z_at_value`\n\n    Returns\n    -------\n    `~astropy.units.equivalencies.Equivalency`\n        With equivalencies between redshift and distance / Hubble / temperature.\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> import astropy.cosmology.units as cu\n    >>> from astropy.cosmology import WMAP9\n\n    >>> equivalency = cu.with_redshift(WMAP9)\n    >>> z = 1100 * cu.redshift\n\n    Redshift to (comoving) distance:\n\n    >>> z.to(u.Mpc, equivalency)  # doctest: +FLOAT_CMP\n    <Quantity 14004.03157418 Mpc>\n\n    Redshift to the Hubble parameter:\n\n    >>> z.to(u.km / u.s / u.Mpc, equivalency)  # doctest: +FLOAT_CMP\n    <Quantity 1565637.40154275 km / (Mpc s)>\n\n    >>> z.to(cu.littleh, equivalency)  # doctest: +FLOAT_CMP\n    <Quantity 15656.37401543 littleh>\n\n    Redshift to CMB temperature:\n\n    >>> z.to(u.K, equivalency)\n    <Quantity 3000.225 K>\n    ","endLoc":313,"header":"def with_redshift(cosmology=None, *,\n                  distance=\"comoving\", hubble=True, Tcmb=True,\n                  atzkw=None)","id":14060,"name":"with_redshift","nodeType":"Function","startLoc":227,"text":"def with_redshift(cosmology=None, *,\n                  distance=\"comoving\", hubble=True, Tcmb=True,\n                  atzkw=None):\n    \"\"\"Convert quantities between measures of cosmological distance.\n\n    Note: by default all equivalencies are on and must be explicitly turned off.\n    Care should be taken to not misinterpret a relativistic, gravitational, etc\n    redshift as a cosmological one.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology`, str, or None, optional\n        A cosmology realization or built-in cosmology's name (e.g. 'Planck18').\n        If `None`, will use the default cosmology\n        (controlled by :class:`~astropy.cosmology.default_cosmology`).\n\n    distance : {'comoving', 'lookback', 'luminosity'} or None (optional, keyword-only)\n        The type of distance equivalency to create or `None`.\n        Default is 'comoving'.\n    hubble : bool (optional, keyword-only)\n        Whether to create a Hubble parameter <-> redshift equivalency, using\n        ``Cosmology.H``. Default is `True`.\n    Tcmb : bool (optional, keyword-only)\n        Whether to create a CMB temperature <-> redshift equivalency, using\n        ``Cosmology.Tcmb``. Default is `True`.\n\n    atzkw : dict or None (optional, keyword-only)\n        keyword arguments for :func:`~astropy.cosmology.z_at_value`\n\n    Returns\n    -------\n    `~astropy.units.equivalencies.Equivalency`\n        With equivalencies between redshift and distance / Hubble / temperature.\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> import astropy.cosmology.units as cu\n    >>> from astropy.cosmology import WMAP9\n\n    >>> equivalency = cu.with_redshift(WMAP9)\n    >>> z = 1100 * cu.redshift\n\n    Redshift to (comoving) distance:\n\n    >>> z.to(u.Mpc, equivalency)  # doctest: +FLOAT_CMP\n    <Quantity 14004.03157418 Mpc>\n\n    Redshift to the Hubble parameter:\n\n    >>> z.to(u.km / u.s / u.Mpc, equivalency)  # doctest: +FLOAT_CMP\n    <Quantity 1565637.40154275 km / (Mpc s)>\n\n    >>> z.to(cu.littleh, equivalency)  # doctest: +FLOAT_CMP\n    <Quantity 15656.37401543 littleh>\n\n    Redshift to CMB temperature:\n\n    >>> z.to(u.K, equivalency)\n    <Quantity 3000.225 K>\n    \"\"\"\n    from astropy.cosmology import default_cosmology, z_at_value\n\n    # get cosmology: None -> default and process str / class\n    cosmology = cosmology if cosmology is not None else default_cosmology.get()\n    with default_cosmology.set(cosmology):  # if already cosmo, passes through\n        cosmology = default_cosmology.get()\n\n    atzkw = atzkw if atzkw is not None else {}\n    equivs = []  # will append as built\n\n    # Hubble <-> Redshift\n    if hubble:\n        equivs.extend(redshift_hubble(cosmology, **atzkw))\n\n    # CMB Temperature <-> Redshift\n    if Tcmb:\n        equivs.extend(redshift_temperature(cosmology, **atzkw))\n\n    # Distance <-> Redshift, but need to choose which distance\n    if distance is not None:\n        equivs.extend(redshift_distance(cosmology, kind=distance, **atzkw))\n\n    # -----------\n    return u.Equivalency(equivs, \"with_redshift\",\n                         {'cosmology': cosmology,\n                          'distance': distance, 'hubble': hubble, 'Tcmb': Tcmb})"},{"attributeType":"null","col":8,"comment":"null","endLoc":102,"id":14061,"name":"__parameters__","nodeType":"Attribute","startLoc":102,"text":"cls.__parameters__"},{"col":4,"comment":"null","endLoc":241,"header":"def __init__(self, instance, cls)","id":14062,"name":"__init__","nodeType":"Function","startLoc":240,"text":"def __init__(self, instance, cls):\n        super().__init__(instance, cls, \"write\", registry=convert_registry)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1267,"id":14063,"name":"supported_constraints","nodeType":"Attribute","startLoc":1267,"text":"supported_constraints"},{"attributeType":"null","col":8,"comment":"null","endLoc":103,"id":14064,"name":"__all_parameters__","nodeType":"Attribute","startLoc":103,"text":"cls.__all_parameters__"},{"attributeType":"null","col":8,"comment":"null","endLoc":1271,"id":14065,"name":"fit_info","nodeType":"Attribute","startLoc":1271,"text":"self.fit_info"},{"col":0,"comment":"Parameter value validator where value is a positive float.","endLoc":348,"header":"@Parameter.register_validator(\"non-negative\")\ndef _validate_non_negative(cosmology, param, value)","id":14066,"name":"_validate_non_negative","nodeType":"Function","startLoc":342,"text":"@Parameter.register_validator(\"non-negative\")\ndef _validate_non_negative(cosmology, param, value):\n    \"\"\"Parameter value validator where value is a positive float.\"\"\"\n    value = _validate_to_float(cosmology, param, value)\n    if value < 0.0:\n        raise ValueError(f\"{param.name} cannot be negative.\")\n    return value"},{"className":"FlatCosmologyMixin","col":0,"comment":"\n    Mixin class for flat cosmologies. Do NOT instantiate directly.\n    Note that all instances of ``FlatCosmologyMixin`` are flat, but not all\n    flat cosmologies are instances of ``FlatCosmologyMixin``. As example,\n    ``LambdaCDM`` **may** be flat (for the a specific set of parameter values),\n    but ``FlatLambdaCDM`` **will** be flat.\n    ","endLoc":384,"id":14067,"nodeType":"Class","startLoc":372,"text":"class FlatCosmologyMixin(metaclass=abc.ABCMeta):\n    \"\"\"\n    Mixin class for flat cosmologies. Do NOT instantiate directly.\n    Note that all instances of ``FlatCosmologyMixin`` are flat, but not all\n    flat cosmologies are instances of ``FlatCosmologyMixin``. As example,\n    ``LambdaCDM`` **may** be flat (for the a specific set of parameter values),\n    but ``FlatLambdaCDM`` **will** be flat.\n    \"\"\"\n\n    @property\n    def is_flat(self):\n        \"\"\"Return `True`, the cosmology is flat.\"\"\"\n        return True"},{"className":"SimplexLSQFitter","col":0,"comment":"\n    Simplex algorithm and least squares statistic.\n\n    Raises\n    ------\n    `ModelLinearityError`\n        A linear model is passed to a nonlinear fitter\n\n    ","endLoc":1393,"id":14068,"nodeType":"Class","startLoc":1328,"text":"class SimplexLSQFitter(Fitter):\n    \"\"\"\n    Simplex algorithm and least squares statistic.\n\n    Raises\n    ------\n    `ModelLinearityError`\n        A linear model is passed to a nonlinear fitter\n\n    \"\"\"\n\n    supported_constraints = Simplex.supported_constraints\n\n    def __init__(self):\n        super().__init__(optimizer=Simplex, statistic=leastsquare)\n        self.fit_info = {}\n\n    @fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None, **kwargs):\n        \"\"\"\n        Fit data to this model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            model to fit to x, y, z\n        x : array\n            input coordinates\n        y : array\n            input coordinates\n        z : array, optional\n            input coordinates\n        weights : array, optional\n            Weights for fitting.\n            For data with Gaussian uncertainties, the weights should be\n            1/sigma.\n        kwargs : dict\n            optional keyword arguments to be passed to the optimizer or the statistic\n        maxiter : int\n            maximum number of iterations\n        acc : float\n            Relative error in approximate solution\n        equivalencies : list or None, optional, keyword-only\n            List of *additional* equivalencies that are should be applied in\n            case x, y and/or z have units. Default is None.\n\n        Returns\n        -------\n        model_copy : `~astropy.modeling.FittableModel`\n            a copy of the input model with parameters set by the fitter\n\n        \"\"\"\n\n        model_copy = _validate_model(model,\n                                     self._opt_method.supported_constraints)\n        model_copy.sync_constraints = False\n        farg = _convert_input(x, y, z)\n        farg = (model_copy, weights, ) + farg\n\n        init_values, _ = model_to_fit_params(model_copy)\n\n        fitparams, self.fit_info = self._opt_method(\n            self.objective_function, init_values, farg, **kwargs)\n        fitter_to_model_params(model_copy, fitparams)\n        model_copy.sync_constraints = True\n        return model_copy"},{"col":4,"comment":"Return `True`, the cosmology is flat.","endLoc":384,"header":"@property\n    def is_flat(self)","id":14069,"name":"is_flat","nodeType":"Function","startLoc":381,"text":"@property\n    def is_flat(self):\n        \"\"\"Return `True`, the cosmology is flat.\"\"\"\n        return True"},{"col":4,"comment":"null","endLoc":1343,"header":"def __init__(self)","id":14070,"name":"__init__","nodeType":"Function","startLoc":1341,"text":"def __init__(self):\n        super().__init__(optimizer=Simplex, statistic=leastsquare)\n        self.fit_info = {}"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":14071,"name":"__all__","nodeType":"Attribute","startLoc":6,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"parameter.py#<anonymous>","id":14072,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = [\"Parameter\"]"},{"className":"FLRW","col":0,"comment":"\n    A class describing an isotropic and homogeneous\n    (Friedmann-Lemaitre-Robertson-Walker) cosmology.\n\n    This is an abstract base class -- you cannot instantiate examples of this\n    class, but must work with one of its subclasses, such as\n    :class:`~astropy.cosmology.LambdaCDM` or :class:`~astropy.cosmology.wCDM`.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0.  If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0. Note that this does not include massive\n        neutrinos.\n\n    Ode0 : float\n        Omega dark energy: density of dark energy in units of the critical\n        density at z=0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Notes\n    -----\n    Class instances are immutable -- you cannot change the parameters' values.\n    That is, all of the above attributes (except meta) are read only.\n\n    For details on how to create performant custom subclasses, see the\n    documentation on :ref:`astropy-cosmology-fast-integrals`.\n    ","endLoc":1409,"id":14073,"nodeType":"Class","startLoc":58,"text":"class FLRW(Cosmology):\n    \"\"\"\n    A class describing an isotropic and homogeneous\n    (Friedmann-Lemaitre-Robertson-Walker) cosmology.\n\n    This is an abstract base class -- you cannot instantiate examples of this\n    class, but must work with one of its subclasses, such as\n    :class:`~astropy.cosmology.LambdaCDM` or :class:`~astropy.cosmology.wCDM`.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0.  If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0. Note that this does not include massive\n        neutrinos.\n\n    Ode0 : float\n        Omega dark energy: density of dark energy in units of the critical\n        density at z=0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Notes\n    -----\n    Class instances are immutable -- you cannot change the parameters' values.\n    That is, all of the above attributes (except meta) are read only.\n\n    For details on how to create performant custom subclasses, see the\n    documentation on :ref:`astropy-cosmology-fast-integrals`.\n    \"\"\"\n\n    H0 = Parameter(doc=\"Hubble constant as an `~astropy.units.Quantity` at z=0.\",\n                   unit=\"km/(s Mpc)\", fvalidate=\"scalar\")\n    Om0 = Parameter(doc=\"Omega matter; matter density/critical density at z=0.\",\n                    fvalidate=\"non-negative\")\n    Ode0 = Parameter(doc=\"Omega dark energy; dark energy density/critical density at z=0.\",\n                     fvalidate=\"float\")\n    Tcmb0 = Parameter(doc=\"Temperature of the CMB as `~astropy.units.Quantity` at z=0.\",\n                      unit=\"Kelvin\", fvalidate=\"scalar\")\n    Neff = Parameter(doc=\"Number of effective neutrino species.\", fvalidate=\"non-negative\")\n    m_nu = Parameter(doc=\"Mass of neutrino species.\",\n                     unit=\"eV\", equivalencies=u.mass_energy())\n    Ob0 = Parameter(doc=\"Omega baryon; baryonic matter density/critical density at z=0.\")\n\n    def __init__(self, H0, Om0, Ode0, Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV,\n                 Ob0=None, *, name=None, meta=None):\n        super().__init__(name=name, meta=meta)\n\n        # Assign (and validate) Parameters\n        self.H0 = H0\n        self.Om0 = Om0\n        self.Ode0 = Ode0\n        self.Tcmb0 = Tcmb0\n        self.Neff = Neff\n        self.m_nu = m_nu  # (reset later, this is just for unit validation)\n        self.Ob0 = Ob0  # (must be after Om0)\n\n        # Derived quantities:\n        # Dark matter density; matter - baryons, if latter is not None.\n        self._Odm0 = None if Ob0 is None else (self._Om0 - self._Ob0)\n\n        # 100 km/s/Mpc * h = H0 (so h is dimensionless)\n        self._h = self._H0.value / 100.0\n        # Hubble distance\n        self._hubble_distance = (const.c / self._H0).to(u.Mpc)\n        # H0 in s^-1\n        H0_s = self._H0.value * H0units_to_invs\n        # Hubble time\n        self._hubble_time = (sec_to_Gyr / H0_s) << u.Gyr\n\n        # Critical density at z=0 (grams per cubic cm)\n        cd0value = critdens_const * H0_s ** 2\n        self._critical_density0 = cd0value << u.g / u.cm ** 3\n\n        # Compute photon density from Tcmb\n        self._Ogamma0 = a_B_c2 * self._Tcmb0.value ** 4 / self._critical_density0.value\n\n        # Compute Neutrino temperature:\n        # The constant in front is (4/11)^1/3 -- see any cosmology book for an\n        # explanation -- for example, Weinberg 'Cosmology' p 154 eq (3.1.21).\n        self._Tnu0 = 0.7137658555036082 * self._Tcmb0\n\n        # Compute neutrino parameters:\n        if self._m_nu is None:\n            self._nneutrinos = 0\n            self._neff_per_nu = None\n            self._massivenu = False\n            self._massivenu_mass = None\n            self._nmassivenu = self._nmasslessnu = None\n        else:\n            self._nneutrinos = floor(self._Neff)\n\n            # We are going to share Neff between the neutrinos equally. In\n            # detail this is not correct, but it is a standard assumption\n            # because properly calculating it is a) complicated b) depends on\n            # the details of the massive neutrinos (e.g., their weak\n            # interactions, which could be unusual if one is considering\n            # sterile neutrinos).\n            self._neff_per_nu = self._Neff / self._nneutrinos\n\n            # Now figure out if we have massive neutrinos to deal with, and if\n            # so, get the right number of masses. It is worth keeping track of\n            # massless ones separately (since they are easy to deal with, and a\n            # common use case is to have only one massive neutrino).\n            massive = np.nonzero(self._m_nu.value > 0)[0]\n            self._massivenu = massive.size > 0\n            self._nmassivenu = len(massive)\n            self._massivenu_mass = self._m_nu[massive].value if self._massivenu else None\n            self._nmasslessnu = self._nneutrinos - self._nmassivenu\n\n        # Compute Neutrino Omega and total relativistic component for massive\n        # neutrinos. We also store a list version, since that is more efficient\n        # to do integrals with (perhaps surprisingly! But small python lists\n        # are more efficient than small NumPy arrays).\n        if self._massivenu:  # (`_massivenu` set in `m_nu`)\n            nu_y = self._massivenu_mass / (kB_evK * self._Tnu0)\n            self._nu_y = nu_y.value\n            self._nu_y_list = self._nu_y.tolist()\n            self._Onu0 = self._Ogamma0 * self.nu_relative_density(0)\n        else:\n            # This case is particularly simple, so do it directly The 0.2271...\n            # is 7/8 (4/11)^(4/3) -- the temperature bit ^4 (blackbody energy\n            # density) times 7/8 for FD vs. BE statistics.\n            self._Onu0 = 0.22710731766 * self._Neff * self._Ogamma0\n            self._nu_y = self._nu_y_list = None\n\n        # Compute curvature density\n        self._Ok0 = 1.0 - self._Om0 - self._Ode0 - self._Ogamma0 - self._Onu0\n\n        # Subclasses should override this reference if they provide\n        #  more efficient scalar versions of inv_efunc.\n        self._inv_efunc_scalar = self.inv_efunc\n        self._inv_efunc_scalar_args = ()\n\n    # ---------------------------------------------------------------\n    # Parameter details\n\n    @Ob0.validator\n    def Ob0(self, param, value):\n        \"\"\"Validate baryon density to None or positive float > matter density.\"\"\"\n        if value is None:\n            return value\n\n        value = _validate_non_negative(self, param, value)\n        if value > self.Om0:\n            raise ValueError(\"baryonic density can not be larger than total matter density.\")\n        return value\n\n    @m_nu.validator\n    def m_nu(self, param, value):\n        \"\"\"Validate neutrino masses to right value, units, and shape.\n\n        There are no neutrinos if floor(Neff) or Tcmb0 are 0.\n        The number of neutrinos must match floor(Neff).\n        Neutrino masses cannot be negative.\n        \"\"\"\n        # Check if there are any neutrinos\n        if (nneutrinos := floor(self._Neff)) == 0 or self._Tcmb0.value == 0:\n            return None  # None, regardless of input\n\n        # Validate / set units\n        value = _validate_with_unit(self, param, value)\n\n        # Check values and data shapes\n        if value.shape not in ((), (nneutrinos,)):\n            raise ValueError(\"unexpected number of neutrino masses — \"\n                             f\"expected {nneutrinos}, got {len(value)}.\")\n        elif np.any(value.value < 0):\n            raise ValueError(\"invalid (negative) neutrino mass encountered.\")\n\n        # scalar -> array\n        if value.isscalar:\n            value = np.full_like(value, value, shape=nneutrinos)\n\n        return value\n\n    # ---------------------------------------------------------------\n    # properties\n\n    @property\n    def is_flat(self):\n        \"\"\"Return bool; `True` if the cosmology is flat.\"\"\"\n        return bool((self._Ok0 == 0.0) and (self.Otot0 == 1.0))\n\n    @property\n    def Otot0(self):\n        \"\"\"Omega total; the total density/critical density at z=0.\"\"\"\n        return self._Om0 + self._Ogamma0 + self._Onu0 + self._Ode0 + self._Ok0\n\n    @property\n    def Odm0(self):\n        \"\"\"Omega dark matter; dark matter density/critical density at z=0.\"\"\"\n        return self._Odm0\n\n    @property\n    def Ok0(self):\n        \"\"\"Omega curvature; the effective curvature density/critical density at z=0.\"\"\"\n        return self._Ok0\n\n    @property\n    def Tnu0(self):\n        \"\"\"Temperature of the neutrino background as `~astropy.units.Quantity` at z=0.\"\"\"\n        return self._Tnu0\n\n    @property\n    def has_massive_nu(self):\n        \"\"\"Does this cosmology have at least one massive neutrino species?\"\"\"\n        if self._Tnu0.value == 0:\n            return False\n        return self._massivenu\n\n    @property\n    def h(self):\n        \"\"\"Dimensionless Hubble constant: h = H_0 / 100 [km/sec/Mpc].\"\"\"\n        return self._h\n\n    @property\n    def hubble_time(self):\n        \"\"\"Hubble time as `~astropy.units.Quantity`.\"\"\"\n        return self._hubble_time\n\n    @property\n    def hubble_distance(self):\n        \"\"\"Hubble distance as `~astropy.units.Quantity`.\"\"\"\n        return self._hubble_distance\n\n    @property\n    def critical_density0(self):\n        \"\"\"Critical density as `~astropy.units.Quantity` at z=0.\"\"\"\n        return self._critical_density0\n\n    @property\n    def Ogamma0(self):\n        \"\"\"Omega gamma; the density/critical density of photons at z=0.\"\"\"\n        return self._Ogamma0\n\n    @property\n    def Onu0(self):\n        \"\"\"Omega nu; the density/critical density of neutrinos at z=0.\"\"\"\n        return self._Onu0\n\n    # ---------------------------------------------------------------\n\n    @abstractmethod\n    def w(self, z):\n        r\"\"\"The dark energy equation of state.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state.\n            `float` if scalar input.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1.\n\n        This must be overridden by subclasses.\n        \"\"\"\n        raise NotImplementedError(\"w(z) is not implemented\")\n\n    def Otot(self, z):\n        \"\"\"The total density parameter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        Otot : ndarray or float\n            The total density relative to the critical density at each redshift.\n            Returns float if input scalar.\n        \"\"\"\n        return self.Om(z) + self.Ogamma(z) + self.Onu(z) + self.Ode(z) + self.Ok(z)\n\n    def Om(self, z):\n        \"\"\"\n        Return the density parameter for non-relativistic matter\n        at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Om : ndarray or float\n            The density of non-relativistic matter relative to the critical\n            density at each redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        This does not include neutrinos, even if non-relativistic at the\n        redshift of interest; see `Onu`.\n        \"\"\"\n        z = aszarr(z)\n        return self._Om0 * (z + 1.0) ** 3 * self.inv_efunc(z) ** 2\n\n    def Ob(self, z):\n        \"\"\"Return the density parameter for baryonic matter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Ob : ndarray or float\n            The density of baryonic matter relative to the critical density at\n            each redshift.\n            Returns `float` if the input is scalar.\n\n        Raises\n        ------\n        ValueError\n            If ``Ob0`` is `None`.\n        \"\"\"\n        if self._Ob0 is None:\n            raise ValueError(\"Baryon density not set for this cosmology\")\n        z = aszarr(z)\n        return self._Ob0 * (z + 1.0) ** 3 * self.inv_efunc(z) ** 2\n\n    def Odm(self, z):\n        \"\"\"Return the density parameter for dark matter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Odm : ndarray or float\n            The density of non-relativistic dark matter relative to the\n            critical density at each redshift.\n            Returns `float` if the input is scalar.\n\n        Raises\n        ------\n        ValueError\n            If ``Ob0`` is `None`.\n\n        Notes\n        -----\n        This does not include neutrinos, even if non-relativistic at the\n        redshift of interest.\n        \"\"\"\n        if self._Odm0 is None:\n            raise ValueError(\"Baryonic density not set for this cosmology, \"\n                             \"unclear meaning of dark matter density\")\n        z = aszarr(z)\n        return self._Odm0 * (z + 1.0) ** 3 * self.inv_efunc(z) ** 2\n\n    def Ok(self, z):\n        \"\"\"\n        Return the equivalent density parameter for curvature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Ok : ndarray or float\n            The equivalent density parameter for curvature at each redshift.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        z = aszarr(z)\n        if self._Ok0 == 0:  # Common enough to be worth checking explicitly\n            return np.zeros(z.shape) if hasattr(z, \"shape\") else 0.0\n        return self._Ok0 * (z + 1.0) ** 2 * self.inv_efunc(z) ** 2\n\n    def Ode(self, z):\n        \"\"\"Return the density parameter for dark energy at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Ode : ndarray or float\n            The density of non-relativistic matter relative to the critical\n            density at each redshift.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        z = aszarr(z)\n        if self._Ode0 == 0:  # Common enough to be worth checking explicitly\n            return np.zeros(z.shape) if hasattr(z, \"shape\") else 0.0\n        return self._Ode0 * self.de_density_scale(z) * self.inv_efunc(z) ** 2\n\n    def Ogamma(self, z):\n        \"\"\"Return the density parameter for photons at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Ogamma : ndarray or float\n            The energy density of photons relative to the critical density at\n            each redshift.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        z = aszarr(z)\n        return self._Ogamma0 * (z + 1.0) ** 4 * self.inv_efunc(z) ** 2\n\n    def Onu(self, z):\n        r\"\"\"Return the density parameter for neutrinos at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Onu : ndarray or float\n            The energy density of neutrinos relative to the critical density at\n            each redshift. Note that this includes their kinetic energy (if\n            they have mass), so it is not equal to the commonly used\n            :math:`\\sum \\frac{m_{\\nu}}{94 eV}`, which does not include\n            kinetic energy.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        z = aszarr(z)\n        if self._Onu0 == 0:  # Common enough to be worth checking explicitly\n            return np.zeros(z.shape) if hasattr(z, \"shape\") else 0.0\n        return self.Ogamma(z) * self.nu_relative_density(z)\n\n    def Tcmb(self, z):\n        \"\"\"Return the CMB temperature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Tcmb : `~astropy.units.Quantity` ['temperature']\n            The temperature of the CMB in K.\n        \"\"\"\n        return self._Tcmb0 * (aszarr(z) + 1.0)\n\n    def Tnu(self, z):\n        \"\"\"Return the neutrino temperature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Tnu : `~astropy.units.Quantity` ['temperature']\n            The temperature of the cosmic neutrino background in K.\n        \"\"\"\n        return self._Tnu0 * (aszarr(z) + 1.0)\n\n    def nu_relative_density(self, z):\n        r\"\"\"Neutrino density function relative to the energy density in photons.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        f : ndarray or float\n            The neutrino density scaling factor relative to the density in\n            photons at each redshift.\n            Only returns `float` if z is scalar.\n\n        Notes\n        -----\n        The density in neutrinos is given by\n\n        .. math::\n\n           \\rho_{\\nu} \\left(a\\right) = 0.2271 \\, N_{eff} \\,\n           f\\left(m_{\\nu} a / T_{\\nu 0} \\right) \\,\n           \\rho_{\\gamma} \\left( a \\right)\n\n        where\n\n        .. math::\n\n           f \\left(y\\right) = \\frac{120}{7 \\pi^4}\n           \\int_0^{\\infty} \\, dx \\frac{x^2 \\sqrt{x^2 + y^2}}\n           {e^x + 1}\n\n        assuming that all neutrino species have the same mass.\n        If they have different masses, a similar term is calculated for each\n        one. Note that ``f`` has the asymptotic behavior :math:`f(0) = 1`. This\n        method returns :math:`0.2271 f` using an analytical fitting formula\n        given in Komatsu et al. 2011, ApJS 192, 18.\n        \"\"\"\n        # Note that there is also a scalar-z-only cython implementation of\n        # this in scalar_inv_efuncs.pyx, so if you find a problem in this\n        # you need to update there too.\n\n        # See Komatsu et al. 2011, eq 26 and the surrounding discussion\n        # for an explanation of what we are doing here.\n        # However, this is modified to handle multiple neutrino masses\n        # by computing the above for each mass, then summing\n        prefac = 0.22710731766  # 7/8 (4/11)^4/3 -- see any cosmo book\n\n        # The massive and massless contribution must be handled separately\n        # But check for common cases first\n        z = aszarr(z)\n        if not self._massivenu:\n            return prefac * self._Neff * (np.ones(z.shape) if hasattr(z, \"shape\") else 1.0)\n\n        # These are purely fitting constants -- see the Komatsu paper\n        p = 1.83\n        invp = 0.54644808743  # 1.0 / p\n        k = 0.3173\n\n        curr_nu_y = self._nu_y / (1. + np.expand_dims(z, axis=-1))\n        rel_mass_per = (1.0 + (k * curr_nu_y) ** p) ** invp\n        rel_mass = rel_mass_per.sum(-1) + self._nmasslessnu\n\n        return prefac * self._neff_per_nu * rel_mass\n\n    def _w_integrand(self, ln1pz):\n        \"\"\"Internal convenience function for w(z) integral (eq. 5 of [1]_).\n\n        Parameters\n        ----------\n        ln1pz : `~numbers.Number` or scalar ndarray\n            Assumes scalar input, since this should only be called inside an\n            integral.\n\n        References\n        ----------\n        .. [1] Linder, E. (2003). Exploring the Expansion History of the\n               Universe. Phys. Rev. Lett., 90, 091301.\n        \"\"\"\n        return 1.0 + self.w(exp(ln1pz) - 1.0)\n\n    def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and is given by\n\n        .. math::\n\n           I = \\exp \\left( 3 \\int_{a}^1 \\frac{ da^{\\prime} }{ a^{\\prime} }\n                          \\left[ 1 + w\\left( a^{\\prime} \\right) \\right] \\right)\n\n        The actual integral used is rewritten from [1]_ to be in terms of z.\n\n        It will generally helpful for subclasses to overload this method if\n        the integral can be done analytically for the particular dark\n        energy equation of state that they implement.\n\n        References\n        ----------\n        .. [1] Linder, E. (2003). Exploring the Expansion History of the\n               Universe. Phys. Rev. Lett., 90, 091301.\n        \"\"\"\n        # This allows for an arbitrary w(z) following eq (5) of\n        # Linder 2003, PRL 90, 91301.  The code here evaluates\n        # the integral numerically.  However, most popular\n        # forms of w(z) are designed to make this integral analytic,\n        # so it is probably a good idea for subclasses to overload this\n        # method if an analytic form is available.\n        z = aszarr(z)\n        if not isinstance(z, (Number, np.generic)):  # array/Quantity\n            ival = np.array([quad(self._w_integrand, 0, log(1 + redshift))[0]\n                             for redshift in z])\n            return np.exp(3 * ival)\n        else:  # scalar\n            ival = quad(self._w_integrand, 0, log(z + 1.0))[0]\n            return exp(3 * ival)\n\n    def efunc(self, z):\n        \"\"\"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n\n        Notes\n        -----\n        It is not necessary to override this method, but if de_density_scale\n        takes a particularly simple form, it may be advantageous to.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) +\n                       self._Ode0 * self.de_density_scale(z))\n\n    def inv_efunc(self, z):\n        \"\"\"Inverse of ``efunc``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the inverse Hubble constant.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        # Avoid the function overhead by repeating code\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return (zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) +\n                self._Ode0 * self.de_density_scale(z))**(-0.5)\n\n    def _lookback_time_integrand_scalar(self, z):\n        \"\"\"Integrand of the lookback time (equation 30 of [1]_).\n\n        Parameters\n        ----------\n        z : float\n            Input redshift.\n\n        Returns\n        -------\n        I : float\n            The integrand for the lookback time.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        \"\"\"\n        return self._inv_efunc_scalar(z, *self._inv_efunc_scalar_args) / (z + 1.0)\n\n    def lookback_time_integrand(self, z):\n        \"\"\"Integrand of the lookback time (equation 30 of [1]_).\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : float or array\n            The integrand for the lookback time.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        \"\"\"\n        z = aszarr(z)\n        return self.inv_efunc(z) / (z + 1.0)\n\n    def _abs_distance_integrand_scalar(self, z):\n        \"\"\"Integrand of the absorption distance [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        X : float\n            The integrand for the absorption distance.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        \"\"\"\n        args = self._inv_efunc_scalar_args\n        return (z + 1.0) ** 2 * self._inv_efunc_scalar(z, *args)\n\n    def abs_distance_integrand(self, z):\n        \"\"\"Integrand of the absorption distance [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        X : float or array\n            The integrand for the absorption distance.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        \"\"\"\n        z = aszarr(z)\n        return (z + 1.0) ** 2 * self.inv_efunc(z)\n\n    def H(self, z):\n        \"\"\"Hubble parameter (km/s/Mpc) at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        H : `~astropy.units.Quantity` ['frequency']\n            Hubble parameter at each input redshift.\n        \"\"\"\n        return self._H0 * self.efunc(z)\n\n    def scale_factor(self, z):\n        \"\"\"Scale factor at redshift ``z``.\n\n        The scale factor is defined as :math:`a = 1 / (1 + z)`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        a : ndarray or float\n            Scale factor at each input redshift.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        return 1.0 / (aszarr(z) + 1.0)\n\n    def lookback_time(self, z):\n        \"\"\"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to a lookback time.\n        \"\"\"\n        return self._lookback_time(z)\n\n    def _lookback_time(self, z):\n        \"\"\"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n        \"\"\"\n        return self._hubble_time * self._integral_lookback_time(z)\n\n    @vectorize_redshift_method\n    def _integral_lookback_time(self, z, /):\n        \"\"\"Lookback time to redshift ``z``. Value in units of Hubble time.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : float or ndarray\n            Lookback time to each input redshift in Hubble time units.\n            Returns `float` if input scalar, `~numpy.ndarray` otherwise.\n        \"\"\"\n        return quad(self._lookback_time_integrand_scalar, 0, z)[0]\n\n    def lookback_distance(self, z):\n        \"\"\"\n        The lookback distance is the light travel time distance to a given\n        redshift. It is simply c * lookback_time. It may be used to calculate\n        the proper distance between two redshifts, e.g. for the mean free path\n        to ionizing radiation.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Lookback distance in Mpc\n        \"\"\"\n        return (self.lookback_time(z) * const.c).to(u.Mpc)\n\n    def age(self, z):\n        \"\"\"Age of the universe in Gyr at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to an age.\n        \"\"\"\n        return self._age(z)\n\n    def _age(self, z):\n        \"\"\"Age of the universe in Gyr at redshift ``z``.\n\n        This internal function exists to be re-defined for optimizations.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n        \"\"\"\n        return self._hubble_time * self._integral_age(z)\n\n    @vectorize_redshift_method\n    def _integral_age(self, z, /):\n        \"\"\"Age of the universe at redshift ``z``. Value in units of Hubble time.\n\n        Calculated using explicit integration.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : float or ndarray\n            The age of the universe at each input redshift in Hubble time units.\n            Returns `float` if input scalar, `~numpy.ndarray` otherwise.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to an age.\n        \"\"\"\n        return quad(self._lookback_time_integrand_scalar, z, np.inf)[0]\n\n    def critical_density(self, z):\n        \"\"\"Critical density in grams per cubic cm at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        rho : `~astropy.units.Quantity`\n            Critical density in g/cm^3 at each input redshift.\n        \"\"\"\n\n        return self._critical_density0 * (self.efunc(z)) ** 2\n\n    def comoving_distance(self, z):\n        \"\"\"Comoving line-of-sight distance in Mpc at a given redshift.\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc to each input redshift.\n        \"\"\"\n        return self._comoving_distance_z1z2(0, z)\n\n    def _comoving_distance_z1z2(self, z1, z2):\n        \"\"\"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2``.\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n        \"\"\"\n        return self._integral_comoving_distance_z1z2(z1, z2)\n\n    @vectorize_redshift_method(nin=2)\n    def _integral_comoving_distance_z1z2_scalar(self, z1, z2, /):\n        \"\"\"\n        Comoving line-of-sight distance between objects at redshifts ``z1`` and\n        ``z2``. Value in Mpc.\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : float or ndarray\n            Comoving distance in Mpc between each input redshift.\n            Returns `float` if input scalar, `~numpy.ndarray` otherwise.\n        \"\"\"\n        return quad(self._inv_efunc_scalar, z1, z2, args=self._inv_efunc_scalar_args)[0]\n\n    def _integral_comoving_distance_z1z2(self, z1, z2):\n        \"\"\"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2``. The comoving distance along the line-of-sight\n        between two objects remains constant with time for objects in the\n        Hubble flow.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'] or array-like\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n        \"\"\"\n        return self._hubble_distance * self._integral_comoving_distance_z1z2_scalar(z1, z2)\n\n    def comoving_transverse_distance(self, z):\n        r\"\"\"Comoving transverse distance in Mpc at a given redshift.\n\n        This value is the transverse comoving distance at redshift ``z``\n        corresponding to an angular separation of 1 radian. This is the same as\n        the comoving distance if :math:`\\Omega_k` is zero (as in the current\n        concordance Lambda-CDM model).\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving transverse distance in Mpc at each input redshift.\n\n        Notes\n        -----\n        This quantity is also called the 'proper motion distance' in some texts.\n        \"\"\"\n        return self._comoving_transverse_distance_z1z2(0, z)\n\n    def _comoving_transverse_distance_z1z2(self, z1, z2):\n        r\"\"\"Comoving transverse distance in Mpc between two redshifts.\n\n        This value is the transverse comoving distance at redshift ``z2`` as\n        seen from redshift ``z1`` corresponding to an angular separation of\n        1 radian. This is the same as the comoving distance if :math:`\\Omega_k`\n        is zero (as in the current concordance Lambda-CDM model).\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving transverse distance in Mpc between input redshift.\n\n        Notes\n        -----\n        This quantity is also called the 'proper motion distance' in some texts.\n        \"\"\"\n        Ok0 = self._Ok0\n        dc = self._comoving_distance_z1z2(z1, z2)\n        if Ok0 == 0:\n            return dc\n        sqrtOk0 = sqrt(abs(Ok0))\n        dh = self._hubble_distance\n        if Ok0 > 0:\n            return dh / sqrtOk0 * np.sinh(sqrtOk0 * dc.value / dh.value)\n        else:\n            return dh / sqrtOk0 * np.sin(sqrtOk0 * dc.value / dh.value)\n\n    def angular_diameter_distance(self, z):\n        \"\"\"Angular diameter distance in Mpc at a given redshift.\n\n        This gives the proper (sometimes called 'physical') transverse\n        distance corresponding to an angle of 1 radian for an object\n        at redshift ``z`` ([1]_, [2]_, [3]_).\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Angular diameter distance in Mpc at each input redshift.\n\n        References\n        ----------\n        .. [1] Weinberg, 1972, pp 420-424; Weedman, 1986, pp 421-424.\n        .. [2] Weedman, D. (1986). Quasar astronomy, pp 65-67.\n        .. [3] Peebles, P. (1993). Principles of Physical Cosmology, pp 325-327.\n        \"\"\"\n        z = aszarr(z)\n        return self.comoving_transverse_distance(z) / (z + 1.0)\n\n    def luminosity_distance(self, z):\n        \"\"\"Luminosity distance in Mpc at redshift ``z``.\n\n        This is the distance to use when converting between the bolometric flux\n        from an object at redshift ``z`` and its bolometric luminosity [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Luminosity distance in Mpc at each input redshift.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to a luminosity distance.\n\n        References\n        ----------\n        .. [1] Weinberg, 1972, pp 420-424; Weedman, 1986, pp 60-62.\n        \"\"\"\n        z = aszarr(z)\n        return (z + 1.0) * self.comoving_transverse_distance(z)\n\n    def angular_diameter_distance_z1z2(self, z1, z2):\n        \"\"\"Angular diameter distance between objects at 2 redshifts.\n\n        Useful for gravitational lensing, for example computing the angular\n        diameter distance between a lensed galaxy and the foreground lens.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts. For most practical applications such as\n            gravitational lensing, ``z2`` should be larger than ``z1``. The\n            method will work for ``z2 < z1``; however, this will return\n            negative distances.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n            The angular diameter distance between each input redshift pair.\n            Returns scalar if input is scalar, array else-wise.\n        \"\"\"\n        z1, z2 = aszarr(z1), aszarr(z2)\n        if np.any(z2 < z1):\n            warnings.warn(f\"Second redshift(s) z2 ({z2}) is less than first \"\n                          f\"redshift(s) z1 ({z1}).\", AstropyUserWarning)\n        return self._comoving_transverse_distance_z1z2(z1, z2) / (z2 + 1.0)\n\n    @vectorize_redshift_method\n    def absorption_distance(self, z, /):\n        \"\"\"Absorption distance at redshift ``z``.\n\n        This is used to calculate the number of objects with some cross section\n        of absorption and number density intersecting a sightline per unit\n        redshift path ([1]_, [2]_).\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : float or ndarray\n            Absorption distance (dimensionless) at each input redshift.\n            Returns `float` if input scalar, `~numpy.ndarray` otherwise.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        .. [2] Bahcall, John N. and Peebles, P.J.E. 1969, ApJ, 156L, 7B\n        \"\"\"\n        return quad(self._abs_distance_integrand_scalar, 0, z)[0]\n\n    def distmod(self, z):\n        \"\"\"Distance modulus at redshift ``z``.\n\n        The distance modulus is defined as the (apparent magnitude - absolute\n        magnitude) for an object at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        distmod : `~astropy.units.Quantity` ['length']\n            Distance modulus at each input redshift, in magnitudes.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to a distance modulus.\n        \"\"\"\n        # Remember that the luminosity distance is in Mpc\n        # Abs is necessary because in certain obscure closed cosmologies\n        #  the distance modulus can be negative -- which is okay because\n        #  it enters as the square.\n        val = 5. * np.log10(abs(self.luminosity_distance(z).value)) + 25.0\n        return u.Quantity(val, u.mag)\n\n    def comoving_volume(self, z):\n        r\"\"\"Comoving volume in cubic Mpc at redshift ``z``.\n\n        This is the volume of the universe encompassed by redshifts less than\n        ``z``. For the case of :math:`\\Omega_k = 0` it is a sphere of radius\n        `comoving_distance` but it is less intuitive if :math:`\\Omega_k` is not.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        V : `~astropy.units.Quantity`\n            Comoving volume in :math:`Mpc^3` at each input redshift.\n        \"\"\"\n        Ok0 = self._Ok0\n        if Ok0 == 0:\n            return 4.0 / 3.0 * pi * self.comoving_distance(z) ** 3\n\n        dh = self._hubble_distance.value  # .value for speed\n        dm = self.comoving_transverse_distance(z).value\n        term1 = 4.0 * pi * dh ** 3 / (2.0 * Ok0) * u.Mpc ** 3\n        term2 = dm / dh * np.sqrt(1 + Ok0 * (dm / dh) ** 2)\n        term3 = sqrt(abs(Ok0)) * dm / dh\n\n        if Ok0 > 0:\n            return term1 * (term2 - 1. / sqrt(abs(Ok0)) * np.arcsinh(term3))\n        else:\n            return term1 * (term2 - 1. / sqrt(abs(Ok0)) * np.arcsin(term3))\n\n    def differential_comoving_volume(self, z):\n        \"\"\"Differential comoving volume at redshift z.\n\n        Useful for calculating the effective comoving volume.\n        For example, allows for integration over a comoving volume that has a\n        sensitivity function that changes with redshift. The total comoving\n        volume is given by integrating ``differential_comoving_volume`` to\n        redshift ``z`` and multiplying by a solid angle.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        dV : `~astropy.units.Quantity`\n            Differential comoving volume per redshift per steradian at each\n            input redshift.\n        \"\"\"\n        dm = self.comoving_transverse_distance(z)\n        return self._hubble_distance * (dm ** 2.0) / (self.efunc(z) << u.steradian)\n\n    def kpc_comoving_per_arcmin(self, z):\n        \"\"\"\n        Separation in transverse comoving kpc corresponding to an arcminute at\n        redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            The distance in comoving kpc corresponding to an arcmin at each\n            input redshift.\n        \"\"\"\n        return self.comoving_transverse_distance(z).to(u.kpc) / radian_in_arcmin\n\n    def kpc_proper_per_arcmin(self, z):\n        \"\"\"\n        Separation in transverse proper kpc corresponding to an arcminute at\n        redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            The distance in proper kpc corresponding to an arcmin at each input\n            redshift.\n        \"\"\"\n        return self.angular_diameter_distance(z).to(u.kpc) / radian_in_arcmin\n\n    def arcsec_per_kpc_comoving(self, z):\n        \"\"\"\n        Angular separation in arcsec corresponding to a comoving kpc at\n        redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        theta : `~astropy.units.Quantity` ['angle']\n            The angular separation in arcsec corresponding to a comoving kpc at\n            each input redshift.\n        \"\"\"\n        return radian_in_arcsec / self.comoving_transverse_distance(z).to(u.kpc)\n\n    def arcsec_per_kpc_proper(self, z):\n        \"\"\"\n        Angular separation in arcsec corresponding to a proper kpc at redshift\n        ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        theta : `~astropy.units.Quantity` ['angle']\n            The angular separation in arcsec corresponding to a proper kpc at\n            each input redshift.\n        \"\"\"\n        return radian_in_arcsec / self.angular_diameter_distance(z).to(u.kpc)"},{"col":4,"comment":"\n        Fit data to this model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            model to fit to x, y, z\n        x : array\n            input coordinates\n        y : array\n            input coordinates\n        z : array, optional\n            input coordinates\n        weights : array, optional\n            Weights for fitting.\n            For data with Gaussian uncertainties, the weights should be\n            1/sigma.\n        kwargs : dict\n            optional keyword arguments to be passed to the optimizer or the statistic\n        maxiter : int\n            maximum number of iterations\n        acc : float\n            Relative error in approximate solution\n        equivalencies : list or None, optional, keyword-only\n            List of *additional* equivalencies that are should be applied in\n            case x, y and/or z have units. Default is None.\n\n        Returns\n        -------\n        model_copy : `~astropy.modeling.FittableModel`\n            a copy of the input model with parameters set by the fitter\n\n        ","endLoc":1393,"header":"@fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None, **kwargs)","id":14074,"name":"__call__","nodeType":"Function","startLoc":1345,"text":"@fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None, **kwargs):\n        \"\"\"\n        Fit data to this model.\n\n        Parameters\n        ----------\n        model : `~astropy.modeling.FittableModel`\n            model to fit to x, y, z\n        x : array\n            input coordinates\n        y : array\n            input coordinates\n        z : array, optional\n            input coordinates\n        weights : array, optional\n            Weights for fitting.\n            For data with Gaussian uncertainties, the weights should be\n            1/sigma.\n        kwargs : dict\n            optional keyword arguments to be passed to the optimizer or the statistic\n        maxiter : int\n            maximum number of iterations\n        acc : float\n            Relative error in approximate solution\n        equivalencies : list or None, optional, keyword-only\n            List of *additional* equivalencies that are should be applied in\n            case x, y and/or z have units. Default is None.\n\n        Returns\n        -------\n        model_copy : `~astropy.modeling.FittableModel`\n            a copy of the input model with parameters set by the fitter\n\n        \"\"\"\n\n        model_copy = _validate_model(model,\n                                     self._opt_method.supported_constraints)\n        model_copy.sync_constraints = False\n        farg = _convert_input(x, y, z)\n        farg = (model_copy, weights, ) + farg\n\n        init_values, _ = model_to_fit_params(model_copy)\n\n        fitparams, self.fit_info = self._opt_method(\n            self.objective_function, init_values, farg, **kwargs)\n        fitter_to_model_params(model_copy, fitparams)\n        model_copy.sync_constraints = True\n        return model_copy"},{"fileName":"realizations.py","filePath":"astropy/cosmology","id":14075,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# STDLIB\nimport pathlib\nimport sys\n\n# LOCAL\nfrom astropy.utils.data import get_pkg_data_path\nfrom astropy.utils.decorators import deprecated\nfrom astropy.utils.state import ScienceState\n\nfrom .core import Cosmology\n\n\n_COSMOLOGY_DATA_DIR = pathlib.Path(get_pkg_data_path(\"cosmology\", \"data\", package=\"astropy\"))\navailable = tuple(sorted([p.stem for p in _COSMOLOGY_DATA_DIR.glob(\"*.ecsv\")]))\n\n\n__all__ = [\"available\", \"default_cosmology\"] + list(available)\n\n__doctest_requires__ = {\"*\": [\"scipy\"]}\n\n\ndef __getattr__(name):\n    \"\"\"Make specific realizations from data files with lazy import from\n    `PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_.\n\n    Raises\n    ------\n    AttributeError\n        If \"name\" is not in :mod:`astropy.cosmology.realizations`\n    \"\"\"\n    if name not in available:\n        raise AttributeError(f\"module {__name__!r} has no attribute {name!r}.\")\n\n    cosmo = Cosmology.read(str(_COSMOLOGY_DATA_DIR / name) + \".ecsv\", format=\"ascii.ecsv\")\n    cosmo.__doc__ = (f\"{name} instance of {cosmo.__class__.__qualname__} \"\n                     f\"cosmology\\n(from {cosmo.meta['reference']})\")\n\n    # Cache in this module so `__getattr__` is only called once per `name`.\n    setattr(sys.modules[__name__], name, cosmo)\n\n    return cosmo\n\n\ndef __dir__():\n    \"\"\"Directory, including lazily-imported objects.\"\"\"\n    return __all__\n\n\n#########################################################################\n# The science state below contains the current cosmology.\n#########################################################################\n\n\nclass default_cosmology(ScienceState):\n    \"\"\"The default cosmology to use.\n\n    To change it::\n\n        >>> from astropy.cosmology import default_cosmology, WMAP7\n        >>> with default_cosmology.set(WMAP7):\n        ...     # WMAP7 cosmology in effect\n        ...     pass\n\n    Or, you may use a string::\n\n        >>> with default_cosmology.set('WMAP7'):\n        ...     # WMAP7 cosmology in effect\n        ...     pass\n\n    To get the default cosmology:\n\n        >>> default_cosmology.get()\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966, ...\n\n    To get a specific cosmology:\n\n        >>> default_cosmology.get(\"Planck13\")\n        FlatLambdaCDM(name=\"Planck13\", H0=67.77 km / (Mpc s), Om0=0.30712, ...\n    \"\"\"\n\n    _default_value = \"Planck18\"\n    _value = \"Planck18\"\n\n    @classmethod\n    def get(cls, key=None):\n        \"\"\"Get the science state value of ``key``.\n\n        Parameters\n        ----------\n        key : str or None\n            The built-in |Cosmology| realization to retrieve.\n            If None (default) get the current value.\n\n        Returns\n        -------\n        `astropy.cosmology.Cosmology` or None\n            `None` only if ``key`` is \"no_default\"\n\n        Raises\n        ------\n        TypeError\n            If ``key`` is not a str, |Cosmology|, or None.\n        ValueError\n            If ``key`` is a str, but not for a built-in Cosmology\n\n        Examples\n        --------\n        To get the default cosmology:\n\n        >>> default_cosmology.get()\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966, ...\n\n        To get a specific cosmology:\n\n        >>> default_cosmology.get(\"Planck13\")\n        FlatLambdaCDM(name=\"Planck13\", H0=67.77 km / (Mpc s), Om0=0.30712, ...\n        \"\"\"\n        if key is None:\n            key = cls._value\n\n        if isinstance(key, str):\n            # special-case one string\n            if key == \"no_default\":\n                return None\n            # all other options should be built-in realizations\n            try:\n                value = getattr(sys.modules[__name__], key)\n            except AttributeError:\n                raise ValueError(f\"Unknown cosmology {key!r}. \"\n                                 f\"Valid cosmologies:\\n{available}\")\n        elif isinstance(key, Cosmology):\n            value = key\n        else:\n            raise TypeError(\"'key' must be must be None, a string, \"\n                            f\"or Cosmology instance, not {type(key)}.\")\n\n        # validate value to `Cosmology`, if not already\n        return cls.validate(value)\n\n    @deprecated(\"5.0\", alternative=\"get\")\n    @classmethod\n    def get_cosmology_from_string(cls, arg):\n        \"\"\"Return a cosmology instance from a string.\"\"\"\n        return cls.get(arg)\n\n    @classmethod\n    def validate(cls, value):\n        \"\"\"Return a Cosmology given a value.\n\n        Parameters\n        ----------\n        value : None, str, or `~astropy.cosmology.Cosmology`\n\n        Returns\n        -------\n        `~astropy.cosmology.Cosmology` instance\n\n        Raises\n        ------\n        TypeError\n            If ``value`` is not a string or |Cosmology|.\n        \"\"\"\n        # None -> default\n        if value is None:\n            value = cls._default_value\n\n        # Parse to Cosmology. Error if cannot.\n        if isinstance(value, str):\n            value = cls.get(value)\n        elif not isinstance(value, Cosmology):\n            raise TypeError(\"default_cosmology must be a string or Cosmology instance, \"\n                            f\"not {value}.\")\n\n        return value\n"},{"col":0,"comment":"Make specific realizations from data files with lazy import from\n    `PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_.\n\n    Raises\n    ------\n    AttributeError\n        If \"name\" is not in :mod:`astropy.cosmology.realizations`\n    ","endLoc":43,"header":"def __getattr__(name)","id":14076,"name":"__getattr__","nodeType":"Function","startLoc":24,"text":"def __getattr__(name):\n    \"\"\"Make specific realizations from data files with lazy import from\n    `PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_.\n\n    Raises\n    ------\n    AttributeError\n        If \"name\" is not in :mod:`astropy.cosmology.realizations`\n    \"\"\"\n    if name not in available:\n        raise AttributeError(f\"module {__name__!r} has no attribute {name!r}.\")\n\n    cosmo = Cosmology.read(str(_COSMOLOGY_DATA_DIR / name) + \".ecsv\", format=\"ascii.ecsv\")\n    cosmo.__doc__ = (f\"{name} instance of {cosmo.__class__.__qualname__} \"\n                     f\"cosmology\\n(from {cosmo.meta['reference']})\")\n\n    # Cache in this module so `__getattr__` is only called once per `name`.\n    setattr(sys.modules[__name__], name, cosmo)\n\n    return cosmo"},{"col":4,"comment":"null","endLoc":245,"header":"def __call__(self, format, *args, **kwargs)","id":14077,"name":"__call__","nodeType":"Function","startLoc":243,"text":"def __call__(self, format, *args, **kwargs):\n        return self.registry.write(self._instance, None, *args, format=format,\n                                    **kwargs)"},{"col":0,"comment":"Directory, including lazily-imported objects.","endLoc":48,"header":"def __dir__()","id":14078,"name":"__dir__","nodeType":"Function","startLoc":46,"text":"def __dir__():\n    \"\"\"Directory, including lazily-imported objects.\"\"\"\n    return __all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":14079,"name":"_COSMOLOGY_DATA_DIR","nodeType":"Attribute","startLoc":15,"text":"_COSMOLOGY_DATA_DIR"},{"col":0,"comment":"\n    Convert between quantities with little-h and the equivalent physical units.\n\n    Parameters\n    ----------\n    H0 : None or `~astropy.units.Quantity` ['frequency']\n        The value of the Hubble constant to assume. If a\n        `~astropy.units.Quantity`, will assume the quantity *is* ``H0``. If\n        `None` (default), use the ``H0`` attribute from\n        :mod:`~astropy.cosmology.default_cosmology`.\n\n    References\n    ----------\n    For an illuminating discussion on why you may or may not want to use\n    little-h at all, see https://arxiv.org/pdf/1308.4150.pdf\n    ","endLoc":341,"header":"def with_H0(H0=None)","id":14080,"name":"with_H0","nodeType":"Function","startLoc":318,"text":"def with_H0(H0=None):\n    \"\"\"\n    Convert between quantities with little-h and the equivalent physical units.\n\n    Parameters\n    ----------\n    H0 : None or `~astropy.units.Quantity` ['frequency']\n        The value of the Hubble constant to assume. If a\n        `~astropy.units.Quantity`, will assume the quantity *is* ``H0``. If\n        `None` (default), use the ``H0`` attribute from\n        :mod:`~astropy.cosmology.default_cosmology`.\n\n    References\n    ----------\n    For an illuminating discussion on why you may or may not want to use\n    little-h at all, see https://arxiv.org/pdf/1308.4150.pdf\n    \"\"\"\n    if H0 is None:\n        from .realizations import default_cosmology\n        H0 = default_cosmology.get().H0\n\n    h100_val_unit = u.Unit(100/(H0.to_value(u.km / u.s / u.Mpc)) * littleh)\n\n    return u.Equivalency([(h100_val_unit, None)], \"with_H0\", kwargs={\"H0\": H0})"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":14081,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":14082,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":21,"text":"__doctest_requires__"},{"col":0,"comment":"","endLoc":4,"header":"realizations.py#<anonymous>","id":14083,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"_COSMOLOGY_DATA_DIR = pathlib.Path(get_pkg_data_path(\"cosmology\", \"data\", package=\"astropy\"))\n\navailable = tuple(sorted([p.stem for p in _COSMOLOGY_DATA_DIR.glob(\"*.ecsv\")]))\n\n__all__ = [\"available\", \"default_cosmology\"] + list(available)\n\n__doctest_requires__ = {\"*\": [\"scipy\"]}"},{"attributeType":"null","col":4,"comment":"null","endLoc":1339,"id":14084,"name":"supported_constraints","nodeType":"Attribute","startLoc":1339,"text":"supported_constraints"},{"attributeType":"null","col":8,"comment":"null","endLoc":1343,"id":14085,"name":"fit_info","nodeType":"Attribute","startLoc":1343,"text":"self.fit_info"},{"className":"JointFitter","col":0,"comment":"\n    Fit models which share a parameter.\n    For example, fit two gaussians to two data sets but keep\n    the FWHM the same.\n\n    Parameters\n    ----------\n    models : list\n        a list of model instances\n    jointparameters : list\n        a list of joint parameters\n    initvals : list\n        a list of initial values\n\n    ","endLoc":1542,"id":14086,"nodeType":"Class","startLoc":1396,"text":"class JointFitter(metaclass=_FitterMeta):\n    \"\"\"\n    Fit models which share a parameter.\n    For example, fit two gaussians to two data sets but keep\n    the FWHM the same.\n\n    Parameters\n    ----------\n    models : list\n        a list of model instances\n    jointparameters : list\n        a list of joint parameters\n    initvals : list\n        a list of initial values\n\n    \"\"\"\n\n    def __init__(self, models, jointparameters, initvals):\n        self.models = list(models)\n        self.initvals = list(initvals)\n        self.jointparams = jointparameters\n        self._verify_input()\n        self.fitparams = self.model_to_fit_params()\n\n        # a list of model.n_inputs\n        self.modeldims = [m.n_inputs for m in self.models]\n        # sum all model dimensions\n        self.ndim = np.sum(self.modeldims)\n\n    def model_to_fit_params(self):\n        fparams = []\n        fparams.extend(self.initvals)\n        for model in self.models:\n            params = model.parameters.tolist()\n            joint_params = self.jointparams[model]\n            param_metrics = model._param_metrics\n            for param_name in joint_params:\n                slice_ = param_metrics[param_name]['slice']\n                del params[slice_]\n            fparams.extend(params)\n        return fparams\n\n    def objective_function(self, fps, *args):\n        \"\"\"\n        Function to minimize.\n\n        Parameters\n        ----------\n        fps : list\n            the fitted parameters - result of an one iteration of the\n            fitting algorithm\n        args : dict\n            tuple of measured and input coordinates\n            args is always passed as a tuple from optimize.leastsq\n\n        \"\"\"\n\n        lstsqargs = list(args)\n        fitted = []\n        fitparams = list(fps)\n        numjp = len(self.initvals)\n        # make a separate list of the joint fitted parameters\n        jointfitparams = fitparams[:numjp]\n        del fitparams[:numjp]\n\n        for model in self.models:\n            joint_params = self.jointparams[model]\n            margs = lstsqargs[:model.n_inputs + 1]\n            del lstsqargs[:model.n_inputs + 1]\n            # separate each model separately fitted parameters\n            numfp = len(model._parameters) - len(joint_params)\n            mfparams = fitparams[:numfp]\n\n            del fitparams[:numfp]\n            # recreate the model parameters\n            mparams = []\n            param_metrics = model._param_metrics\n            for param_name in model.param_names:\n                if param_name in joint_params:\n                    index = joint_params.index(param_name)\n                    # should do this with slices in case the\n                    # parameter is not a number\n                    mparams.extend([jointfitparams[index]])\n                else:\n                    slice_ = param_metrics[param_name]['slice']\n                    plen = slice_.stop - slice_.start\n                    mparams.extend(mfparams[:plen])\n                    del mfparams[:plen]\n            modelfit = model.evaluate(margs[:-1], *mparams)\n            fitted.extend(modelfit - margs[-1])\n        return np.ravel(fitted)\n\n    def _verify_input(self):\n        if len(self.models) <= 1:\n            raise TypeError(f\"Expected >1 models, {len(self.models)} is given\")\n        if len(self.jointparams.keys()) < 2:\n            raise TypeError(\"At least two parameters are expected, \"\n                            \"{} is given\".format(len(self.jointparams.keys())))\n        for j in self.jointparams.keys():\n            if len(self.jointparams[j]) != len(self.initvals):\n                raise TypeError(\"{} parameter(s) provided but {} expected\".format(\n                    len(self.jointparams[j]), len(self.initvals)))\n\n    def __call__(self, *args):\n        \"\"\"\n        Fit data to these models keeping some of the parameters common to the\n        two models.\n        \"\"\"\n\n        from scipy import optimize\n\n        if len(args) != reduce(lambda x, y: x + 1 + y + 1, self.modeldims):\n            raise ValueError(\"Expected {} coordinates in args but {} provided\"\n                             .format(reduce(lambda x, y: x + 1 + y + 1,\n                                            self.modeldims), len(args)))\n\n        self.fitparams[:], _ = optimize.leastsq(self.objective_function,\n                                                self.fitparams, args=args)\n\n        fparams = self.fitparams[:]\n        numjp = len(self.initvals)\n        # make a separate list of the joint fitted parameters\n        jointfitparams = fparams[:numjp]\n        del fparams[:numjp]\n\n        for model in self.models:\n            # extract each model's fitted parameters\n            joint_params = self.jointparams[model]\n            numfp = len(model._parameters) - len(joint_params)\n            mfparams = fparams[:numfp]\n\n            del fparams[:numfp]\n            # recreate the model parameters\n            mparams = []\n            param_metrics = model._param_metrics\n            for param_name in model.param_names:\n                if param_name in joint_params:\n                    index = joint_params.index(param_name)\n                    # should do this with slices in case the parameter\n                    # is not a number\n                    mparams.extend([jointfitparams[index]])\n                else:\n                    slice_ = param_metrics[param_name]['slice']\n                    plen = slice_.stop - slice_.start\n                    mparams.extend(mfparams[:plen])\n                    del mfparams[:plen]\n            model.parameters = np.array(mparams)"},{"col":4,"comment":"null","endLoc":1423,"header":"def __init__(self, models, jointparameters, initvals)","id":14087,"name":"__init__","nodeType":"Function","startLoc":1413,"text":"def __init__(self, models, jointparameters, initvals):\n        self.models = list(models)\n        self.initvals = list(initvals)\n        self.jointparams = jointparameters\n        self._verify_input()\n        self.fitparams = self.model_to_fit_params()\n\n        # a list of model.n_inputs\n        self.modeldims = [m.n_inputs for m in self.models]\n        # sum all model dimensions\n        self.ndim = np.sum(self.modeldims)"},{"fileName":"connect.py","filePath":"astropy/cosmology","id":14088,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport copy\nimport warnings\n\nfrom astropy.cosmology import units as cu\nfrom astropy.io import registry as io_registry\nfrom astropy.units import add_enabled_units\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n__all__ = [\"CosmologyRead\", \"CosmologyWrite\",\n           \"CosmologyFromFormat\", \"CosmologyToFormat\"]\n__doctest_skip__ = __all__\n\n\n# ==============================================================================\n# Read / Write\n\nreadwrite_registry = io_registry.UnifiedIORegistry()\n\n\nclass CosmologyRead(io_registry.UnifiedReadWrite):\n    \"\"\"Read and parse data to a `~astropy.cosmology.Cosmology`.\n\n    This function provides the Cosmology interface to the Astropy unified I/O\n    layer. This allows easily reading a file in supported data formats using\n    syntax such as::\n\n        >>> from astropy.cosmology import Cosmology\n        >>> cosmo1 = Cosmology.read('<file name>')\n\n    When the ``read`` method is called from a subclass the subclass will\n    provide a keyword argument ``cosmology=<class>`` to the registered read\n    method. The method uses this cosmology class, regardless of the class\n    indicated in the file, and sets parameters' default values from the class'\n    signature.\n\n    Get help on the available readers using the ``help()`` method::\n\n      >>> Cosmology.read.help()  # Get help reading and list supported formats\n      >>> Cosmology.read.help(format='<format>')  # Get detailed help on a format\n      >>> Cosmology.read.list_formats()  # Print list of available formats\n\n    See also: https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    *args\n        Positional arguments passed through to data reader. If supplied the\n        first argument is typically the input filename.\n    format : str (optional, keyword-only)\n        File format specifier.\n    **kwargs\n        Keyword arguments passed through to data reader.\n\n    Returns\n    -------\n    out : `~astropy.cosmology.Cosmology` subclass instance\n        `~astropy.cosmology.Cosmology` corresponding to file contents.\n\n    Notes\n    -----\n    \"\"\"\n\n    def __init__(self, instance, cosmo_cls):\n        super().__init__(instance, cosmo_cls, \"read\", registry=readwrite_registry)\n\n    def __call__(self, *args, **kwargs):\n        from astropy.cosmology.core import Cosmology\n\n        # so subclasses can override, also pass the class as a kwarg.\n        # allows for `FlatLambdaCDM.read` and\n        # `Cosmology.read(..., cosmology=FlatLambdaCDM)`\n        if self._cls is not Cosmology:\n            kwargs.setdefault(\"cosmology\", self._cls)  # set, if not present\n            # check that it is the correct cosmology, can be wrong if user\n            # passes in e.g. `w0wzCDM.read(..., cosmology=FlatLambdaCDM)`\n            valid = (self._cls, self._cls.__qualname__)\n            if kwargs[\"cosmology\"] not in valid:\n                raise ValueError(\n                    \"keyword argument `cosmology` must be either the class \"\n                    f\"{valid[0]} or its qualified name '{valid[1]}'\")\n\n        with add_enabled_units(cu):\n            cosmo = self.registry.read(self._cls, *args, **kwargs)\n\n        return cosmo\n\n\nclass CosmologyWrite(io_registry.UnifiedReadWrite):\n    \"\"\"Write this Cosmology object out in the specified format.\n\n    This function provides the Cosmology interface to the astropy unified I/O\n    layer. This allows easily writing a file in supported data formats\n    using syntax such as::\n\n      >>> from astropy.cosmology import Planck18\n      >>> Planck18.write('<file name>')\n\n    Get help on the available writers for ``Cosmology`` using the ``help()``\n    method::\n\n      >>> Cosmology.write.help()  # Get help writing and list supported formats\n      >>> Cosmology.write.help(format='<format>')  # Get detailed help on format\n      >>> Cosmology.write.list_formats()  # Print list of available formats\n\n    Parameters\n    ----------\n    *args\n        Positional arguments passed through to data writer. If supplied the\n        first argument is the output filename.\n    format : str (optional, keyword-only)\n        File format specifier.\n    **kwargs\n        Keyword arguments passed through to data writer.\n\n    Notes\n    -----\n    \"\"\"\n\n    def __init__(self, instance, cls):\n        super().__init__(instance, cls, \"write\", registry=readwrite_registry)\n\n    def __call__(self, *args, **kwargs):\n        self.registry.write(self._instance, *args, **kwargs)\n\n\n# ==============================================================================\n# Format Interchange\n# for transforming instances, e.g. Cosmology <-> dict\n\nconvert_registry = io_registry.UnifiedIORegistry()\n\n\nclass CosmologyFromFormat(io_registry.UnifiedReadWrite):\n    \"\"\"Transform object to a `~astropy.cosmology.Cosmology`.\n\n    This function provides the Cosmology interface to the Astropy unified I/O\n    layer. This allows easily parsing supported data formats using\n    syntax such as::\n\n      >>> from astropy.cosmology import Cosmology\n      >>> cosmo1 = Cosmology.from_format(cosmo_mapping, format='mapping')\n\n    When the ``from_format`` method is called from a subclass the subclass will\n    provide a keyword argument ``cosmology=<class>`` to the registered parser.\n    The method uses this cosmology class, regardless of the class indicated in\n    the data, and sets parameters' default values from the class' signature.\n\n    Get help on the available readers using the ``help()`` method::\n\n      >>> Cosmology.from_format.help()  # Get help and list supported formats\n      >>> Cosmology.from_format.help('<format>')  # Get detailed help on a format\n      >>> Cosmology.from_format.list_formats()  # Print list of available formats\n\n    See also: https://docs.astropy.org/en/stable/io/unified.html\n\n    Parameters\n    ----------\n    obj : object\n        The object to parse according to 'format'\n    *args\n        Positional arguments passed through to data parser.\n    format : str or None, optional keyword-only\n        Object format specifier. For `None` (default) CosmologyFromFormat tries\n        to identify the correct format.\n    **kwargs\n        Keyword arguments passed through to data parser.\n        Parsers should accept the following keyword arguments:\n\n        - cosmology : the class (or string name thereof) to use / check when\n                      constructing the cosmology instance.\n\n    Returns\n    -------\n    out : `~astropy.cosmology.Cosmology` subclass instance\n        `~astropy.cosmology.Cosmology` corresponding to ``obj`` contents.\n\n    \"\"\"\n\n    def __init__(self, instance, cosmo_cls):\n        super().__init__(instance, cosmo_cls, \"read\", registry=convert_registry)\n\n    def __call__(self, obj, *args, format=None, **kwargs):\n        from astropy.cosmology.core import Cosmology\n\n        # so subclasses can override, also pass the class as a kwarg.\n        # allows for `FlatLambdaCDM.read` and\n        # `Cosmology.read(..., cosmology=FlatLambdaCDM)`\n        if self._cls is not Cosmology:\n            kwargs.setdefault(\"cosmology\", self._cls)  # set, if not present\n            # check that it is the correct cosmology, can be wrong if user\n            # passes in e.g. `w0wzCDM.read(..., cosmology=FlatLambdaCDM)`\n            valid = (self._cls, self._cls.__qualname__)\n            if kwargs[\"cosmology\"] not in valid:\n                raise ValueError(\n                    \"keyword argument `cosmology` must be either the class \"\n                    f\"{valid[0]} or its qualified name '{valid[1]}'\")\n\n        with add_enabled_units(cu):\n            cosmo = self.registry.read(self._cls, obj, *args, format=format, **kwargs)\n\n        return cosmo\n\n\nclass CosmologyToFormat(io_registry.UnifiedReadWrite):\n    \"\"\"Transform this Cosmology to another format.\n\n    This function provides the Cosmology interface to the astropy unified I/O\n    layer. This allows easily transforming to supported data formats\n    using syntax such as::\n\n      >>> from astropy.cosmology import Planck18\n      >>> Planck18.to_format(\"mapping\")\n      {'cosmology': astropy.cosmology.core.FlatLambdaCDM,\n       'name': 'Planck18',\n       'H0': <Quantity 67.66 km / (Mpc s)>,\n       'Om0': 0.30966,\n       ...\n\n    Get help on the available representations for ``Cosmology`` using the\n    ``help()`` method::\n\n      >>> Cosmology.to_format.help()  # Get help and list supported formats\n      >>> Cosmology.to_format.help('<format>')  # Get detailed help on format\n      >>> Cosmology.to_format.list_formats()  # Print list of available formats\n\n    Parameters\n    ----------\n    format : str\n        Format specifier.\n    *args\n        Positional arguments passed through to data writer. If supplied the\n        first argument is the output filename.\n    **kwargs\n        Keyword arguments passed through to data writer.\n\n    \"\"\"\n\n    def __init__(self, instance, cls):\n        super().__init__(instance, cls, \"write\", registry=convert_registry)\n\n    def __call__(self, format, *args, **kwargs):\n        return self.registry.write(self._instance, None, *args, format=format,\n                                    **kwargs)\n"},{"className":"CosmologyWrite","col":0,"comment":"Write this Cosmology object out in the specified format.\n\n    This function provides the Cosmology interface to the astropy unified I/O\n    layer. This allows easily writing a file in supported data formats\n    using syntax such as::\n\n      >>> from astropy.cosmology import Planck18\n      >>> Planck18.write('<file name>')\n\n    Get help on the available writers for ``Cosmology`` using the ``help()``\n    method::\n\n      >>> Cosmology.write.help()  # Get help writing and list supported formats\n      >>> Cosmology.write.help(format='<format>')  # Get detailed help on format\n      >>> Cosmology.write.list_formats()  # Print list of available formats\n\n    Parameters\n    ----------\n    *args\n        Positional arguments passed through to data writer. If supplied the\n        first argument is the output filename.\n    format : str (optional, keyword-only)\n        File format specifier.\n    **kwargs\n        Keyword arguments passed through to data writer.\n\n    Notes\n    -----\n    ","endLoc":125,"id":14089,"nodeType":"Class","startLoc":90,"text":"class CosmologyWrite(io_registry.UnifiedReadWrite):\n    \"\"\"Write this Cosmology object out in the specified format.\n\n    This function provides the Cosmology interface to the astropy unified I/O\n    layer. This allows easily writing a file in supported data formats\n    using syntax such as::\n\n      >>> from astropy.cosmology import Planck18\n      >>> Planck18.write('<file name>')\n\n    Get help on the available writers for ``Cosmology`` using the ``help()``\n    method::\n\n      >>> Cosmology.write.help()  # Get help writing and list supported formats\n      >>> Cosmology.write.help(format='<format>')  # Get detailed help on format\n      >>> Cosmology.write.list_formats()  # Print list of available formats\n\n    Parameters\n    ----------\n    *args\n        Positional arguments passed through to data writer. If supplied the\n        first argument is the output filename.\n    format : str (optional, keyword-only)\n        File format specifier.\n    **kwargs\n        Keyword arguments passed through to data writer.\n\n    Notes\n    -----\n    \"\"\"\n\n    def __init__(self, instance, cls):\n        super().__init__(instance, cls, \"write\", registry=readwrite_registry)\n\n    def __call__(self, *args, **kwargs):\n        self.registry.write(self._instance, *args, **kwargs)"},{"col":4,"comment":"null","endLoc":122,"header":"def __init__(self, instance, cls)","id":14090,"name":"__init__","nodeType":"Function","startLoc":121,"text":"def __init__(self, instance, cls):\n        super().__init__(instance, cls, \"write\", registry=readwrite_registry)"},{"attributeType":"null","col":24,"comment":"null","endLoc":7,"id":14091,"name":"u","nodeType":"Attribute","startLoc":7,"text":"u"},{"attributeType":"null","col":57,"comment":"null","endLoc":8,"id":14092,"name":"_generate_unit_summary","nodeType":"Attribute","startLoc":8,"text":"_generate_unit_summary"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":14093,"name":"__all__","nodeType":"Attribute","startLoc":10,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":14094,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":17,"text":"__doctest_requires__"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":14095,"name":"_ns","nodeType":"Attribute","startLoc":19,"text":"_ns"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":14096,"name":"redshift","nodeType":"Attribute","startLoc":27,"text":"redshift"},{"col":4,"comment":"null","endLoc":1497,"header":"def _verify_input(self)","id":14097,"name":"_verify_input","nodeType":"Function","startLoc":1488,"text":"def _verify_input(self):\n        if len(self.models) <= 1:\n            raise TypeError(f\"Expected >1 models, {len(self.models)} is given\")\n        if len(self.jointparams.keys()) < 2:\n            raise TypeError(\"At least two parameters are expected, \"\n                            \"{} is given\".format(len(self.jointparams.keys())))\n        for j in self.jointparams.keys():\n            if len(self.jointparams[j]) != len(self.initvals):\n                raise TypeError(\"{} parameter(s) provided but {} expected\".format(\n                    len(self.jointparams[j]), len(self.initvals)))"},{"col":0,"comment":"null","endLoc":407,"header":"def __getattr__(attr)","id":14098,"name":"__getattr__","nodeType":"Function","startLoc":390,"text":"def __getattr__(attr):\n    from . import flrw\n\n    if hasattr(flrw, attr):\n        import warnings\n\n        from astropy.utils.exceptions import AstropyDeprecationWarning\n\n        warnings.warn(\n            f\"`astropy.cosmology.core.{attr}` has been moved (since v5.0) and \"\n            f\"should be imported as ``from astropy.cosmology import {attr}``.\"\n            \" In future this will raise an exception.\",\n            AstropyDeprecationWarning\n        )\n\n        return getattr(flrw, attr)\n\n    raise AttributeError(f\"module {__name__!r} has no attribute {attr!r}.\")"},{"col":4,"comment":"null","endLoc":125,"header":"def __call__(self, *args, **kwargs)","id":14099,"name":"__call__","nodeType":"Function","startLoc":124,"text":"def __call__(self, *args, **kwargs):\n        self.registry.write(self._instance, *args, **kwargs)"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":14100,"name":"littleh","nodeType":"Attribute","startLoc":35,"text":"littleh"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":14101,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":14102,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":13,"text":"__doctest_skip__"},{"attributeType":"UnifiedIORegistry","col":0,"comment":"null","endLoc":19,"id":14103,"name":"readwrite_registry","nodeType":"Attribute","startLoc":19,"text":"readwrite_registry"},{"col":0,"comment":"","endLoc":5,"header":"units.py#<anonymous>","id":14104,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"Cosmological units and equivalencies.\n\"\"\"  # (newline needed for unit summary)\n\n__all__ = [\"littleh\", \"redshift\",\n           # redshift equivalencies\n           \"dimensionless_redshift\", \"with_redshift\",\n           \"redshift_distance\", \"redshift_hubble\", \"redshift_temperature\",\n           # other equivalencies\n           \"with_H0\"]\n\n__doctest_requires__ = {('with_redshift', 'redshift_distance'): ['scipy']}\n\n_ns = globals()\n\nredshift = u.def_unit(['redshift'], prefixes=False, namespace=_ns,\n                      doc=\"Cosmological redshift.\", format={'latex': r''})\n\nlittleh = u.def_unit(['littleh'], namespace=_ns, prefixes=False,\n                     doc='Reduced/\"dimensionless\" Hubble constant',\n                     format={'latex': r'h_{100}'})\n\nu.add_enabled_equivalencies(dimensionless_redshift())\n\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(_ns)"},{"attributeType":"UnifiedIORegistry","col":0,"comment":"null","endLoc":132,"id":14105,"name":"convert_registry","nodeType":"Attribute","startLoc":132,"text":"convert_registry"},{"col":0,"comment":"","endLoc":3,"header":"connect.py#<anonymous>","id":14106,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = [\"CosmologyRead\", \"CosmologyWrite\",\n           \"CosmologyFromFormat\", \"CosmologyToFormat\"]\n\n__doctest_skip__ = __all__\n\nreadwrite_registry = io_registry.UnifiedIORegistry()\n\nconvert_registry = io_registry.UnifiedIORegistry()"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":14107,"name":"__all__","nodeType":"Attribute","startLoc":25,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":14108,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":27,"text":"__doctest_requires__"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":14109,"name":"_COSMOLOGY_CLASSES","nodeType":"Attribute","startLoc":30,"text":"_COSMOLOGY_CLASSES"},{"col":0,"comment":"","endLoc":3,"header":"core.py#<anonymous>","id":14110,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = [\"Cosmology\", \"CosmologyError\", \"FlatCosmologyMixin\"]\n\n__doctest_requires__ = {}  # needed until __getattr__ removed\n\n_COSMOLOGY_CLASSES = dict()"},{"id":14111,"name":"astropy/cosmology/io","nodeType":"Package"},{"fileName":"row.py","filePath":"astropy/cosmology/io","id":14112,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport copy\nfrom collections import defaultdict\n\nimport numpy as np\n\nfrom astropy.table import Row, QTable\nfrom astropy.cosmology.connect import convert_registry\nfrom astropy.cosmology.core import Cosmology\n\nfrom .mapping import from_mapping\n\n\ndef from_row(row, *, move_to_meta=False, cosmology=None):\n    \"\"\"Instantiate a `~astropy.cosmology.Cosmology` from a `~astropy.table.Row`.\n\n    Parameters\n    ----------\n    row : `~astropy.table.Row`\n        The object containing the Cosmology information.\n    move_to_meta : bool (optional, keyword-only)\n        Whether to move keyword arguments that are not in the Cosmology class'\n        signature to the Cosmology's metadata. This will only be applied if the\n        Cosmology does NOT have a keyword-only argument (e.g. ``**kwargs``).\n        Arguments moved to the metadata will be merged with existing metadata,\n        preferring specified metadata in the case of a merge conflict\n        (e.g. for ``Cosmology(meta={'key':10}, key=42)``, the ``Cosmology.meta``\n        will be ``{'key': 10}``).\n\n    cosmology : str, `~astropy.cosmology.Cosmology` class, or None (optional, keyword-only)\n        The cosmology class (or string name thereof) to use when constructing\n        the cosmology instance. The class also provides default parameter values,\n        filling in any non-mandatory arguments missing in 'table'.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n\n    Examples\n    --------\n    To see loading a `~astropy.cosmology.Cosmology` from a Row with\n    ``from_row``, we will first make a `~astropy.table.Row` using\n    :func:`~astropy.cosmology.Cosmology.to_format`.\n\n        >>> from astropy.cosmology import Cosmology, Planck18\n        >>> cr = Planck18.to_format(\"astropy.row\")\n        >>> cr\n        <Row index=0>\n          cosmology     name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                               km / (Mpc s)            K                 eV\n            str13       str8     float64    float64 float64 float64   float64   float64\n        ------------- -------- ------------ ------- ------- ------- ----------- -------\n        FlatLambdaCDM Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\n    Now this row can be used to load a new cosmological instance identical\n    to the ``Planck18`` cosmology from which it was generated.\n\n        >>> cosmo = Cosmology.from_format(cr, format=\"astropy.row\")\n        >>> cosmo\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                      Tcmb0=2.7255 K, Neff=3.046, m_nu=[0. 0. 0.06] eV, Ob0=0.04897)\n    \"\"\"\n    # special values\n    name = row['name'] if 'name' in row.columns else None  # get name from column\n\n    meta = defaultdict(dict, copy.deepcopy(row.meta))\n    # Now need to add the Columnar metadata. This is only available on the\n    # parent table. If Row is ever separated from Table, this should be moved\n    # to ``to_table``.\n    for col in row._table.itercols():\n        if col.info.meta:  # Only add metadata if not empty\n            meta[col.name].update(col.info.meta)\n\n    # turn row into mapping, filling cosmo if not in a column\n    mapping = dict(row)\n    mapping[\"name\"] = name\n    mapping.setdefault(\"cosmology\", meta.pop(\"cosmology\", None))\n    mapping[\"meta\"] = dict(meta)\n\n    # build cosmology from map\n    return from_mapping(mapping, move_to_meta=move_to_meta, cosmology=cosmology)\n\n\ndef to_row(cosmology, *args, cosmology_in_meta=False, table_cls=QTable):\n    \"\"\"Serialize the cosmology into a `~astropy.table.Row`.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    *args\n        Not used. Needed for compatibility with\n        `~astropy.io.registry.UnifiedReadWriteMethod`\n    table_cls : type (optional, keyword-only)\n        Astropy :class:`~astropy.table.Table` class or subclass type to use.\n        Default is :class:`~astropy.table.QTable`.\n    cosmology_in_meta : bool\n        Whether to put the cosmology class in the Table metadata (if `True`) or\n        as the first column (if `False`, default).\n\n    Returns\n    -------\n    `~astropy.table.Row`\n        With columns for the cosmology parameters, and metadata in the Table's\n        ``meta`` attribute. The cosmology class name will either be a column\n        or in ``meta``, depending on 'cosmology_in_meta'.\n\n    Examples\n    --------\n    A Cosmology as a `~astropy.table.Row` will have the cosmology's name and\n    parameters as columns.\n\n        >>> from astropy.cosmology import Planck18\n        >>> cr = Planck18.to_format(\"astropy.row\")\n        >>> cr\n        <Row index=0>\n          cosmology     name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                               km / (Mpc s)            K                 eV\n            str13       str8     float64    float64 float64 float64   float64   float64\n        ------------- -------- ------------ ------- ------- ------- ----------- -------\n        FlatLambdaCDM Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\n    The cosmological class and other metadata, e.g. a paper reference, are in\n    the Table's metadata.\n    \"\"\"\n    from .table import to_table\n\n    table = to_table(cosmology, cls=table_cls, cosmology_in_meta=cosmology_in_meta)\n    return table[0]  # extract row from table\n\n\ndef row_identify(origin, format, *args, **kwargs):\n    \"\"\"Identify if object uses the `~astropy.table.Row` format.\n\n    Returns\n    -------\n    bool\n    \"\"\"\n    itis = False\n    if origin == \"read\":\n        itis = isinstance(args[1], Row) and (format in (None, \"astropy.row\"))\n    return itis\n\n\n# ===================================================================\n# Register\n\nconvert_registry.register_reader(\"astropy.row\", Cosmology, from_row)\nconvert_registry.register_writer(\"astropy.row\", Cosmology, to_row)\nconvert_registry.register_identifier(\"astropy.row\", Cosmology, row_identify)\n"},{"fileName":"cosmology.py","filePath":"astropy/cosmology/io","id":14113,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThe following are private functions. These functions are registered into\n:meth:`~astropy.cosmology.Cosmology.to_format` and\n:meth:`~astropy.cosmology.Cosmology.from_format` and should only be accessed\nvia these methods.\n\"\"\"\n\nfrom astropy.cosmology.core import _COSMOLOGY_CLASSES, Cosmology\nfrom astropy.cosmology.connect import convert_registry\n\n__all__ = []  # nothing is publicly scoped\n\n\ndef from_cosmology(cosmo, /, **kwargs):\n    \"\"\"Return the |Cosmology| unchanged.\n\n    Parameters\n    ----------\n    cosmo : `~astropy.cosmology.Cosmology`\n        The cosmology to return.\n    **kwargs\n        This argument is required for compatibility with the standard set of\n        keyword arguments in format `~astropy.cosmology.Cosmology.from_format`,\n        e.g. \"cosmology\". If \"cosmology\" is included and is not `None`,\n        ``cosmo`` is checked for correctness.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n        Just ``cosmo`` passed through.\n\n    Raises\n    ------\n    TypeError\n        If the |Cosmology| object is not an instance of ``cosmo`` (and\n        ``cosmology`` is not `None`).\n    \"\"\"\n    # Check argument `cosmology`\n    cosmology = kwargs.get(\"cosmology\")\n    if isinstance(cosmology, str):\n        cosmology = _COSMOLOGY_CLASSES[cosmology]\n    if cosmology is not None and not isinstance(cosmo, cosmology):\n        raise TypeError(f\"cosmology {cosmo} is not an {cosmology} instance.\")\n\n    return cosmo\n\n\ndef to_cosmology(cosmo, *args):\n    \"\"\"Return the |Cosmology| unchanged.\n\n    Parameters\n    ----------\n    cosmo : `~astropy.cosmology.Cosmology`\n        The cosmology to return.\n    *args\n        Not used.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n        Just ``cosmo`` passed through.\n    \"\"\"\n    return cosmo\n\n\ndef cosmology_identify(origin, format, *args, **kwargs):\n    \"\"\"Identify if object is a `~astropy.cosmology.Cosmology`.\n\n    Returns\n    -------\n    bool\n    \"\"\"\n    itis = False\n    if origin == \"read\":\n        itis = isinstance(args[1], Cosmology) and (format in (None, \"astropy.cosmology\"))\n    return itis\n\n\n# ===================================================================\n# Register\n\nconvert_registry.register_reader(\"astropy.cosmology\", Cosmology, from_cosmology)\nconvert_registry.register_writer(\"astropy.cosmology\", Cosmology, to_cosmology)\nconvert_registry.register_identifier(\"astropy.cosmology\", Cosmology, cosmology_identify)\n"},{"fileName":"ecsv.py","filePath":"astropy/cosmology/io","id":14114,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport astropy.cosmology.units as cu\nimport astropy.units as u\nfrom astropy.table import QTable\nfrom astropy.cosmology.connect import readwrite_registry\nfrom astropy.cosmology.core import Cosmology\n\nfrom .table import from_table, to_table\n\n\ndef read_ecsv(filename, index=None, *, move_to_meta=False, cosmology=None, **kwargs):\n    \"\"\"Read a `~astropy.cosmology.Cosmology` from an ECSV file.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        From where to read the Cosmology.\n    index : int, str, or None, optional\n        Needed to select the row in tables with multiple rows. ``index`` can be\n        an integer for the row number or, if the table is indexed by a column,\n        the value of that column. If the table is not indexed and ``index``\n        is a string, the \"name\" column is used as the indexing column.\n\n    move_to_meta : bool (optional, keyword-only)\n        Whether to move keyword arguments that are not in the Cosmology class'\n        signature to the Cosmology's metadata. This will only be applied if the\n        Cosmology does NOT have a keyword-only argument (e.g. ``**kwargs``).\n        Arguments moved to the metadata will be merged with existing metadata,\n        preferring specified metadata in the case of a merge conflict\n        (e.g. for ``Cosmology(meta={'key':10}, key=42)``, the ``Cosmology.meta``\n        will be ``{'key': 10}``).\n\n    cosmology : str, `~astropy.cosmology.Cosmology` class, or None (optional, keyword-only)\n        The cosmology class (or string name thereof) to use when constructing\n        the cosmology instance. The class also provides default parameter values,\n        filling in any non-mandatory arguments missing in 'table'.\n\n    **kwargs\n        Passed to :attr:`astropy.table.QTable.read`\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n    \"\"\"\n    kwargs[\"format\"] = \"ascii.ecsv\"\n    with u.add_enabled_units(cu):\n        table = QTable.read(filename, **kwargs)\n\n    # build cosmology from table\n    return from_table(table, index=index, move_to_meta=move_to_meta, cosmology=cosmology)\n\n\ndef write_ecsv(cosmology, file, *, overwrite=False, cls=QTable, cosmology_in_meta=True, **kwargs):\n    \"\"\"Serialize the cosmology into a ECSV.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    file : path-like or file-like\n        Location to save the serialized cosmology.\n\n    overwrite : bool\n        Whether to overwrite the file, if it exists.\n    cls : type (optional, keyword-only)\n        Astropy :class:`~astropy.table.Table` (sub)class to use when writing.\n        Default is :class:`~astropy.table.QTable`.\n    cosmology_in_meta : bool\n        Whether to put the cosmology class in the Table metadata (if `True`,\n        default) or as the first column (if `False`).\n    **kwargs\n        Passed to ``cls.write``\n\n    Raises\n    ------\n    TypeError\n        If kwarg (optional) 'cls' is not a subclass of `astropy.table.Table`\n    \"\"\"\n    table = to_table(cosmology, cls=cls, cosmology_in_meta=cosmology_in_meta)\n\n    kwargs[\"format\"] = \"ascii.ecsv\"\n    table.write(file, overwrite=overwrite, **kwargs)\n\n\ndef ecsv_identify(origin, filepath, fileobj, *args, **kwargs):\n    \"\"\"Identify if object uses the Table format.\n\n    Returns\n    -------\n    bool\n    \"\"\"\n    return filepath is not None and filepath.endswith(\".ecsv\")\n\n\n# ===================================================================\n# Register\n\nreadwrite_registry.register_reader(\"ascii.ecsv\", Cosmology, read_ecsv)\nreadwrite_registry.register_writer(\"ascii.ecsv\", Cosmology, write_ecsv)\nreadwrite_registry.register_identifier(\"ascii.ecsv\", Cosmology, ecsv_identify)\n"},{"col":0,"comment":"Return the |Cosmology| unchanged.\n\n    Parameters\n    ----------\n    cosmo : `~astropy.cosmology.Cosmology`\n        The cosmology to return.\n    **kwargs\n        This argument is required for compatibility with the standard set of\n        keyword arguments in format `~astropy.cosmology.Cosmology.from_format`,\n        e.g. \"cosmology\". If \"cosmology\" is included and is not `None`,\n        ``cosmo`` is checked for correctness.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n        Just ``cosmo`` passed through.\n\n    Raises\n    ------\n    TypeError\n        If the |Cosmology| object is not an instance of ``cosmo`` (and\n        ``cosmology`` is not `None`).\n    ","endLoc":47,"header":"def from_cosmology(cosmo, /, **kwargs)","id":14115,"name":"from_cosmology","nodeType":"Function","startLoc":16,"text":"def from_cosmology(cosmo, /, **kwargs):\n    \"\"\"Return the |Cosmology| unchanged.\n\n    Parameters\n    ----------\n    cosmo : `~astropy.cosmology.Cosmology`\n        The cosmology to return.\n    **kwargs\n        This argument is required for compatibility with the standard set of\n        keyword arguments in format `~astropy.cosmology.Cosmology.from_format`,\n        e.g. \"cosmology\". If \"cosmology\" is included and is not `None`,\n        ``cosmo`` is checked for correctness.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n        Just ``cosmo`` passed through.\n\n    Raises\n    ------\n    TypeError\n        If the |Cosmology| object is not an instance of ``cosmo`` (and\n        ``cosmology`` is not `None`).\n    \"\"\"\n    # Check argument `cosmology`\n    cosmology = kwargs.get(\"cosmology\")\n    if isinstance(cosmology, str):\n        cosmology = _COSMOLOGY_CLASSES[cosmology]\n    if cosmology is not None and not isinstance(cosmo, cosmology):\n        raise TypeError(f\"cosmology {cosmo} is not an {cosmology} instance.\")\n\n    return cosmo"},{"col":0,"comment":"Load `~astropy.cosmology.Cosmology` from mapping object.\n\n    Parameters\n    ----------\n    map : mapping\n        Arguments into the class -- like \"name\" or \"meta\".\n        If 'cosmology' is None, must have field \"cosmology\" which can be either\n        the string name of the cosmology class (e.g. \"FlatLambdaCDM\") or the\n        class itself.\n\n    move_to_meta : bool (optional, keyword-only)\n        Whether to move keyword arguments that are not in the Cosmology class'\n        signature to the Cosmology's metadata. This will only be applied if the\n        Cosmology does NOT have a keyword-only argument (e.g. ``**kwargs``).\n        Arguments moved to the metadata will be merged with existing metadata,\n        preferring specified metadata in the case of a merge conflict\n        (e.g. for ``Cosmology(meta={'key':10}, key=42)``, the ``Cosmology.meta``\n        will be ``{'key': 10}``).\n\n    cosmology : str, `~astropy.cosmology.Cosmology` class, or None (optional, keyword-only)\n        The cosmology class (or string name thereof) to use when constructing\n        the cosmology instance. The class also provides default parameter values,\n        filling in any non-mandatory arguments missing in 'map'.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n\n    Examples\n    --------\n    To see loading a `~astropy.cosmology.Cosmology` from a dictionary with\n    ``from_mapping``, we will first make a mapping using\n    :meth:`~astropy.cosmology.Cosmology.to_format`.\n\n        >>> from astropy.cosmology import Cosmology, Planck18\n        >>> cm = Planck18.to_format('mapping')\n        >>> cm\n        {'cosmology': <class 'astropy.cosmology.flrw.FlatLambdaCDM'>,\n         'name': 'Planck18', 'H0': <Quantity 67.66 km / (Mpc s)>, 'Om0': 0.30966,\n         'Tcmb0': <Quantity 2.7255 K>, 'Neff': 3.046,\n         'm_nu': <Quantity [0. , 0. , 0.06] eV>, 'Ob0': 0.04897,\n         'meta': ...\n\n    Now this dict can be used to load a new cosmological instance identical\n    to the ``Planck18`` cosmology from which it was generated.\n\n        >>> cosmo = Cosmology.from_format(cm, format=\"mapping\")\n        >>> cosmo\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                      Tcmb0=2.7255 K, Neff=3.046, m_nu=[0. 0. 0.06] eV, Ob0=0.04897)\n\n    Specific cosmology classes can be used to parse the data. The class'\n    default parameter values are used to fill in any information missing in the\n    data.\n\n        >>> from astropy.cosmology import FlatLambdaCDM\n        >>> del cm[\"Tcmb0\"]  # show FlatLambdaCDM provides default\n        >>> FlatLambdaCDM.from_format(cm)\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                      Tcmb0=0.0 K, Neff=3.046, m_nu=None, Ob0=0.04897)\n    ","endLoc":116,"header":"def from_mapping(map, *, move_to_meta=False, cosmology=None)","id":14116,"name":"from_mapping","nodeType":"Function","startLoc":22,"text":"def from_mapping(map, *, move_to_meta=False, cosmology=None):\n    \"\"\"Load `~astropy.cosmology.Cosmology` from mapping object.\n\n    Parameters\n    ----------\n    map : mapping\n        Arguments into the class -- like \"name\" or \"meta\".\n        If 'cosmology' is None, must have field \"cosmology\" which can be either\n        the string name of the cosmology class (e.g. \"FlatLambdaCDM\") or the\n        class itself.\n\n    move_to_meta : bool (optional, keyword-only)\n        Whether to move keyword arguments that are not in the Cosmology class'\n        signature to the Cosmology's metadata. This will only be applied if the\n        Cosmology does NOT have a keyword-only argument (e.g. ``**kwargs``).\n        Arguments moved to the metadata will be merged with existing metadata,\n        preferring specified metadata in the case of a merge conflict\n        (e.g. for ``Cosmology(meta={'key':10}, key=42)``, the ``Cosmology.meta``\n        will be ``{'key': 10}``).\n\n    cosmology : str, `~astropy.cosmology.Cosmology` class, or None (optional, keyword-only)\n        The cosmology class (or string name thereof) to use when constructing\n        the cosmology instance. The class also provides default parameter values,\n        filling in any non-mandatory arguments missing in 'map'.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n\n    Examples\n    --------\n    To see loading a `~astropy.cosmology.Cosmology` from a dictionary with\n    ``from_mapping``, we will first make a mapping using\n    :meth:`~astropy.cosmology.Cosmology.to_format`.\n\n        >>> from astropy.cosmology import Cosmology, Planck18\n        >>> cm = Planck18.to_format('mapping')\n        >>> cm\n        {'cosmology': <class 'astropy.cosmology.flrw.FlatLambdaCDM'>,\n         'name': 'Planck18', 'H0': <Quantity 67.66 km / (Mpc s)>, 'Om0': 0.30966,\n         'Tcmb0': <Quantity 2.7255 K>, 'Neff': 3.046,\n         'm_nu': <Quantity [0. , 0. , 0.06] eV>, 'Ob0': 0.04897,\n         'meta': ...\n\n    Now this dict can be used to load a new cosmological instance identical\n    to the ``Planck18`` cosmology from which it was generated.\n\n        >>> cosmo = Cosmology.from_format(cm, format=\"mapping\")\n        >>> cosmo\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                      Tcmb0=2.7255 K, Neff=3.046, m_nu=[0. 0. 0.06] eV, Ob0=0.04897)\n\n    Specific cosmology classes can be used to parse the data. The class'\n    default parameter values are used to fill in any information missing in the\n    data.\n\n        >>> from astropy.cosmology import FlatLambdaCDM\n        >>> del cm[\"Tcmb0\"]  # show FlatLambdaCDM provides default\n        >>> FlatLambdaCDM.from_format(cm)\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                      Tcmb0=0.0 K, Neff=3.046, m_nu=None, Ob0=0.04897)\n    \"\"\"\n    params = dict(map)  # so we are guaranteed to have a poppable map\n\n    # get cosmology\n    # 1st from argument. Allows for override of the cosmology, if on file.\n    # 2nd from params. This MUST have the cosmology if 'kwargs' did not.\n    if cosmology is None:\n        cosmology = params.pop(\"cosmology\")\n    else:\n        params.pop(\"cosmology\", None)  # pop, but don't use\n    # if string, parse to class\n    if isinstance(cosmology, str):\n        cosmology = _COSMOLOGY_CLASSES[cosmology]\n\n    # select arguments from mapping that are in the cosmo's signature.\n    ba = cosmology._init_signature.bind_partial()  # blank set of args\n    ba.apply_defaults()  # fill in the defaults\n    for k in cosmology._init_signature.parameters.keys():\n        if k in params:  # transfer argument, if in params\n            ba.arguments[k] = params.pop(k)\n\n    # deal with remaining params. If there is a **kwargs use that, else\n    # allow to transfer to metadata. Raise TypeError if can't.\n    lastp = tuple(cosmology._init_signature.parameters.values())[-1]\n    if lastp.kind == 4:  # variable keyword-only\n        ba.arguments[lastp.name] = params\n    elif move_to_meta:  # prefers current meta, which was explicitly set\n        meta = ba.arguments[\"meta\"] or {}  # (None -> dict)\n        ba.arguments[\"meta\"] = {**params, **meta}\n    elif params:\n        raise TypeError(f\"there are unused parameters {params}.\")\n    # else: pass  # no kwargs, no move-to-meta, and all the params are used\n\n    return cosmology(*ba.args, **ba.kwargs)"},{"col":4,"comment":"null","endLoc":1436,"header":"def model_to_fit_params(self)","id":14117,"name":"model_to_fit_params","nodeType":"Function","startLoc":1425,"text":"def model_to_fit_params(self):\n        fparams = []\n        fparams.extend(self.initvals)\n        for model in self.models:\n            params = model.parameters.tolist()\n            joint_params = self.jointparams[model]\n            param_metrics = model._param_metrics\n            for param_name in joint_params:\n                slice_ = param_metrics[param_name]['slice']\n                del params[slice_]\n            fparams.extend(params)\n        return fparams"},{"col":4,"comment":"\n        Function to minimize.\n\n        Parameters\n        ----------\n        fps : list\n            the fitted parameters - result of an one iteration of the\n            fitting algorithm\n        args : dict\n            tuple of measured and input coordinates\n            args is always passed as a tuple from optimize.leastsq\n\n        ","endLoc":1486,"header":"def objective_function(self, fps, *args)","id":14118,"name":"objective_function","nodeType":"Function","startLoc":1438,"text":"def objective_function(self, fps, *args):\n        \"\"\"\n        Function to minimize.\n\n        Parameters\n        ----------\n        fps : list\n            the fitted parameters - result of an one iteration of the\n            fitting algorithm\n        args : dict\n            tuple of measured and input coordinates\n            args is always passed as a tuple from optimize.leastsq\n\n        \"\"\"\n\n        lstsqargs = list(args)\n        fitted = []\n        fitparams = list(fps)\n        numjp = len(self.initvals)\n        # make a separate list of the joint fitted parameters\n        jointfitparams = fitparams[:numjp]\n        del fitparams[:numjp]\n\n        for model in self.models:\n            joint_params = self.jointparams[model]\n            margs = lstsqargs[:model.n_inputs + 1]\n            del lstsqargs[:model.n_inputs + 1]\n            # separate each model separately fitted parameters\n            numfp = len(model._parameters) - len(joint_params)\n            mfparams = fitparams[:numfp]\n\n            del fitparams[:numfp]\n            # recreate the model parameters\n            mparams = []\n            param_metrics = model._param_metrics\n            for param_name in model.param_names:\n                if param_name in joint_params:\n                    index = joint_params.index(param_name)\n                    # should do this with slices in case the\n                    # parameter is not a number\n                    mparams.extend([jointfitparams[index]])\n                else:\n                    slice_ = param_metrics[param_name]['slice']\n                    plen = slice_.stop - slice_.start\n                    mparams.extend(mfparams[:plen])\n                    del mfparams[:plen]\n            modelfit = model.evaluate(margs[:-1], *mparams)\n            fitted.extend(modelfit - margs[-1])\n        return np.ravel(fitted)"},{"col":0,"comment":"Instantiate a `~astropy.cosmology.Cosmology` from a |QTable|.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        The object to parse into a |Cosmology|.\n    index : int, str, or None, optional\n        Needed to select the row in tables with multiple rows. ``index`` can be\n        an integer for the row number or, if the table is indexed by a column,\n        the value of that column. If the table is not indexed and ``index``\n        is a string, the \"name\" column is used as the indexing column.\n\n    move_to_meta : bool (optional, keyword-only)\n        Whether to move keyword arguments that are not in the Cosmology class'\n        signature to the Cosmology's metadata. This will only be applied if the\n        Cosmology does NOT have a keyword-only argument (e.g. ``**kwargs``).\n        Arguments moved to the metadata will be merged with existing metadata,\n        preferring specified metadata in the case of a merge conflict\n        (e.g. for ``Cosmology(meta={'key':10}, key=42)``, the ``Cosmology.meta``\n        will be ``{'key': 10}``).\n\n    cosmology : str, `~astropy.cosmology.Cosmology` class, or None (optional, keyword-only)\n        The cosmology class (or string name thereof) to use when constructing\n        the cosmology instance. The class also provides default parameter values,\n        filling in any non-mandatory arguments missing in 'table'.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n\n    Examples\n    --------\n    To see loading a `~astropy.cosmology.Cosmology` from a Table with\n    ``from_table``, we will first make a |QTable| using\n    :func:`~astropy.cosmology.Cosmology.to_format`.\n\n        >>> from astropy.cosmology import Cosmology, Planck18\n        >>> ct = Planck18.to_format(\"astropy.table\")\n        >>> ct\n        <QTable length=1>\n          name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                 km / (Mpc s)            K                 eV\n          str8     float64    float64 float64 float64   float64   float64\n        -------- ------------ ------- ------- ------- ----------- -------\n        Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\n    Now this table can be used to load a new cosmological instance identical\n    to the ``Planck18`` cosmology from which it was generated.\n\n        >>> cosmo = Cosmology.from_format(ct, format=\"astropy.table\")\n        >>> cosmo\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                      Tcmb0=2.7255 K, Neff=3.046, m_nu=[0. 0. 0.06] eV, Ob0=0.04897)\n\n    Specific cosmology classes can be used to parse the data. The class'\n    default parameter values are used to fill in any information missing in the\n    data.\n\n        >>> from astropy.cosmology import FlatLambdaCDM\n        >>> del ct[\"Tcmb0\"]  # show FlatLambdaCDM provides default\n        >>> FlatLambdaCDM.from_format(ct)\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                      Tcmb0=0.0 K, Neff=3.046, m_nu=None, Ob0=0.04897)\n\n    For tables with multiple rows of cosmological parameters, the ``index``\n    argument is needed to select the correct row. The index can be an integer\n    for the row number or, if the table is indexed by a column, the value of\n    that column. If the table is not indexed and ``index`` is a string, the\n    \"name\" column is used as the indexing column.\n\n    Here is an example where ``index`` is needed and can be either an integer\n    (for the row number) or the name of one of the cosmologies, e.g. 'Planck15'.\n\n        >>> from astropy.cosmology import Planck13, Planck15, Planck18\n        >>> from astropy.table import vstack\n        >>> cts = vstack([c.to_format(\"astropy.table\")\n        ...               for c in (Planck13, Planck15, Planck18)],\n        ...              metadata_conflicts='silent')\n        >>> cts\n        <QTable length=3>\n          name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                 km / (Mpc s)            K                 eV\n          str8     float64    float64 float64 float64   float64   float64\n        -------- ------------ ------- ------- ------- ----------- --------\n        Planck13        67.77 0.30712  2.7255   3.046 0.0 .. 0.06 0.048252\n        Planck15        67.74  0.3075  2.7255   3.046 0.0 .. 0.06   0.0486\n        Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06  0.04897\n\n        >>> cosmo = Cosmology.from_format(cts, index=1, format=\"astropy.table\")\n        >>> cosmo == Planck15\n        True\n\n    For further examples, see :doc:`astropy:cosmology/io`.\n    ","endLoc":138,"header":"def from_table(table, index=None, *, move_to_meta=False, cosmology=None)","id":14119,"name":"from_table","nodeType":"Function","startLoc":16,"text":"def from_table(table, index=None, *, move_to_meta=False, cosmology=None):\n    \"\"\"Instantiate a `~astropy.cosmology.Cosmology` from a |QTable|.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        The object to parse into a |Cosmology|.\n    index : int, str, or None, optional\n        Needed to select the row in tables with multiple rows. ``index`` can be\n        an integer for the row number or, if the table is indexed by a column,\n        the value of that column. If the table is not indexed and ``index``\n        is a string, the \"name\" column is used as the indexing column.\n\n    move_to_meta : bool (optional, keyword-only)\n        Whether to move keyword arguments that are not in the Cosmology class'\n        signature to the Cosmology's metadata. This will only be applied if the\n        Cosmology does NOT have a keyword-only argument (e.g. ``**kwargs``).\n        Arguments moved to the metadata will be merged with existing metadata,\n        preferring specified metadata in the case of a merge conflict\n        (e.g. for ``Cosmology(meta={'key':10}, key=42)``, the ``Cosmology.meta``\n        will be ``{'key': 10}``).\n\n    cosmology : str, `~astropy.cosmology.Cosmology` class, or None (optional, keyword-only)\n        The cosmology class (or string name thereof) to use when constructing\n        the cosmology instance. The class also provides default parameter values,\n        filling in any non-mandatory arguments missing in 'table'.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n\n    Examples\n    --------\n    To see loading a `~astropy.cosmology.Cosmology` from a Table with\n    ``from_table``, we will first make a |QTable| using\n    :func:`~astropy.cosmology.Cosmology.to_format`.\n\n        >>> from astropy.cosmology import Cosmology, Planck18\n        >>> ct = Planck18.to_format(\"astropy.table\")\n        >>> ct\n        <QTable length=1>\n          name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                 km / (Mpc s)            K                 eV\n          str8     float64    float64 float64 float64   float64   float64\n        -------- ------------ ------- ------- ------- ----------- -------\n        Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\n    Now this table can be used to load a new cosmological instance identical\n    to the ``Planck18`` cosmology from which it was generated.\n\n        >>> cosmo = Cosmology.from_format(ct, format=\"astropy.table\")\n        >>> cosmo\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                      Tcmb0=2.7255 K, Neff=3.046, m_nu=[0. 0. 0.06] eV, Ob0=0.04897)\n\n    Specific cosmology classes can be used to parse the data. The class'\n    default parameter values are used to fill in any information missing in the\n    data.\n\n        >>> from astropy.cosmology import FlatLambdaCDM\n        >>> del ct[\"Tcmb0\"]  # show FlatLambdaCDM provides default\n        >>> FlatLambdaCDM.from_format(ct)\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                      Tcmb0=0.0 K, Neff=3.046, m_nu=None, Ob0=0.04897)\n\n    For tables with multiple rows of cosmological parameters, the ``index``\n    argument is needed to select the correct row. The index can be an integer\n    for the row number or, if the table is indexed by a column, the value of\n    that column. If the table is not indexed and ``index`` is a string, the\n    \"name\" column is used as the indexing column.\n\n    Here is an example where ``index`` is needed and can be either an integer\n    (for the row number) or the name of one of the cosmologies, e.g. 'Planck15'.\n\n        >>> from astropy.cosmology import Planck13, Planck15, Planck18\n        >>> from astropy.table import vstack\n        >>> cts = vstack([c.to_format(\"astropy.table\")\n        ...               for c in (Planck13, Planck15, Planck18)],\n        ...              metadata_conflicts='silent')\n        >>> cts\n        <QTable length=3>\n          name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                 km / (Mpc s)            K                 eV\n          str8     float64    float64 float64 float64   float64   float64\n        -------- ------------ ------- ------- ------- ----------- --------\n        Planck13        67.77 0.30712  2.7255   3.046 0.0 .. 0.06 0.048252\n        Planck15        67.74  0.3075  2.7255   3.046 0.0 .. 0.06   0.0486\n        Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06  0.04897\n\n        >>> cosmo = Cosmology.from_format(cts, index=1, format=\"astropy.table\")\n        >>> cosmo == Planck15\n        True\n\n    For further examples, see :doc:`astropy:cosmology/io`.\n    \"\"\"\n    # Get row from table\n    # string index uses the indexed column on the table to find the row index.\n    if isinstance(index, str):\n        if not table.indices:  # no indexing column, find by string match\n            indices = np.where(table['name'] == index)[0]\n        else:  # has indexing column\n            indices = table.loc_indices[index]  # need to convert to row index (int)\n\n        if isinstance(indices, (int, np.integer)):  # loc_indices\n            index = indices\n        elif len(indices) == 1:  # only happens w/ np.where\n            index = indices[0]\n        elif len(indices) == 0:  # matches from loc_indices\n            raise KeyError(f\"No matches found for key {indices}\")\n        else:  # like the Highlander, there can be only 1 Cosmology\n            raise ValueError(f\"more than one cosmology found for key {indices}\")\n\n    # no index is needed for a 1-row table. For a multi-row table...\n    if index is None:\n        if len(table) != 1:  # multi-row table and no index\n            raise ValueError(\"need to select a specific row (e.g. index=1) when \"\n                             \"constructing a Cosmology from a multi-row table.\")\n        else:  # single-row table\n            index = 0\n    row = table[index]  # index is now the row index (int)\n\n    # parse row to cosmo\n    return from_row(row, move_to_meta=move_to_meta, cosmology=cosmology)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1607,"id":14120,"name":"n_inputs","nodeType":"Attribute","startLoc":1607,"text":"n_inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":1608,"id":14121,"name":"n_outputs","nodeType":"Attribute","startLoc":1608,"text":"n_outputs"},{"col":0,"comment":"Return the |Cosmology| unchanged.\n\n    Parameters\n    ----------\n    cosmo : `~astropy.cosmology.Cosmology`\n        The cosmology to return.\n    *args\n        Not used.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n        Just ``cosmo`` passed through.\n    ","endLoc":65,"header":"def to_cosmology(cosmo, *args)","id":14122,"name":"to_cosmology","nodeType":"Function","startLoc":50,"text":"def to_cosmology(cosmo, *args):\n    \"\"\"Return the |Cosmology| unchanged.\n\n    Parameters\n    ----------\n    cosmo : `~astropy.cosmology.Cosmology`\n        The cosmology to return.\n    *args\n        Not used.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n        Just ``cosmo`` passed through.\n    \"\"\"\n    return cosmo"},{"col":0,"comment":"Identify if object is a `~astropy.cosmology.Cosmology`.\n\n    Returns\n    -------\n    bool\n    ","endLoc":78,"header":"def cosmology_identify(origin, format, *args, **kwargs)","id":14123,"name":"cosmology_identify","nodeType":"Function","startLoc":68,"text":"def cosmology_identify(origin, format, *args, **kwargs):\n    \"\"\"Identify if object is a `~astropy.cosmology.Cosmology`.\n\n    Returns\n    -------\n    bool\n    \"\"\"\n    itis = False\n    if origin == \"read\":\n        itis = isinstance(args[1], Cosmology) and (format in (None, \"astropy.cosmology\"))\n    return itis"},{"attributeType":"null","col":4,"comment":"null","endLoc":1610,"id":14124,"name":"_separable","nodeType":"Attribute","startLoc":1610,"text":"_separable"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":14125,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":8,"header":"cosmology.py#<anonymous>","id":14126,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThe following are private functions. These functions are registered into\n:meth:`~astropy.cosmology.Cosmology.to_format` and\n:meth:`~astropy.cosmology.Cosmology.from_format` and should only be accessed\nvia these methods.\n\"\"\"\n\n__all__ = []  # nothing is publicly scoped\n\nconvert_registry.register_reader(\"astropy.cosmology\", Cosmology, from_cosmology)\n\nconvert_registry.register_writer(\"astropy.cosmology\", Cosmology, to_cosmology)\n\nconvert_registry.register_identifier(\"astropy.cosmology\", Cosmology, cosmology_identify)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1620,"id":14127,"name":"_ap_order","nodeType":"Attribute","startLoc":1620,"text":"self._ap_order"},{"col":4,"comment":"\n        Fit data to these models keeping some of the parameters common to the\n        two models.\n        ","endLoc":1542,"header":"def __call__(self, *args)","id":14128,"name":"__call__","nodeType":"Function","startLoc":1499,"text":"def __call__(self, *args):\n        \"\"\"\n        Fit data to these models keeping some of the parameters common to the\n        two models.\n        \"\"\"\n\n        from scipy import optimize\n\n        if len(args) != reduce(lambda x, y: x + 1 + y + 1, self.modeldims):\n            raise ValueError(\"Expected {} coordinates in args but {} provided\"\n                             .format(reduce(lambda x, y: x + 1 + y + 1,\n                                            self.modeldims), len(args)))\n\n        self.fitparams[:], _ = optimize.leastsq(self.objective_function,\n                                                self.fitparams, args=args)\n\n        fparams = self.fitparams[:]\n        numjp = len(self.initvals)\n        # make a separate list of the joint fitted parameters\n        jointfitparams = fparams[:numjp]\n        del fparams[:numjp]\n\n        for model in self.models:\n            # extract each model's fitted parameters\n            joint_params = self.jointparams[model]\n            numfp = len(model._parameters) - len(joint_params)\n            mfparams = fparams[:numfp]\n\n            del fparams[:numfp]\n            # recreate the model parameters\n            mparams = []\n            param_metrics = model._param_metrics\n            for param_name in model.param_names:\n                if param_name in joint_params:\n                    index = joint_params.index(param_name)\n                    # should do this with slices in case the parameter\n                    # is not a number\n                    mparams.extend([jointfitparams[index]])\n                else:\n                    slice_ = param_metrics[param_name]['slice']\n                    plen = slice_.stop - slice_.start\n                    mparams.extend(mfparams[:plen])\n                    del mfparams[:plen]\n            model.parameters = np.array(mparams)"},{"col":31,"endLoc":1507,"id":14129,"nodeType":"Lambda","startLoc":1507,"text":"lambda x, y: x + 1 + y + 1"},{"col":44,"endLoc":1509,"id":14130,"nodeType":"Lambda","startLoc":1509,"text":"lambda x, y: x + 1 + y + 1"},{"attributeType":"null","col":8,"comment":"null","endLoc":1619,"id":14131,"name":"_b_coeff","nodeType":"Attribute","startLoc":1619,"text":"self._b_coeff"},{"attributeType":"null","col":8,"comment":"null","endLoc":1616,"id":14132,"name":"_a_order","nodeType":"Attribute","startLoc":1616,"text":"self._a_order"},{"fileName":"yaml.py","filePath":"astropy/cosmology/io","id":14133,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThe following are private functions, included here **FOR REFERENCE ONLY** since\nthe io registry cannot be displayed. These functions are registered into\n:meth:`~astropy.cosmology.Cosmology.to_format` and\n:meth:`~astropy.cosmology.Cosmology.from_format` and should only be accessed\nvia these methods.\n\"\"\"  # this is shown in the docs.\n\nimport astropy.cosmology.units as cu\nimport astropy.units as u\nfrom astropy.cosmology.core import _COSMOLOGY_CLASSES, Cosmology\nfrom astropy.cosmology.connect import convert_registry\nfrom astropy.io.misc.yaml import AstropyDumper, AstropyLoader, dump, load\n\nfrom .mapping import from_mapping\n\n__all__ = []  # nothing is publicly scoped\n\n\n##############################################################################\n# Serializer Functions\n# these do Cosmology <-> YAML through a modified dictionary representation of\n# the Cosmology object. The Unified-I/O functions are just wrappers to the YAML\n# that calls these functions.\n\n\ndef yaml_representer(tag):\n    \"\"\":mod:`yaml` representation of |Cosmology| object.\n\n    Parameters\n    ----------\n    tag : str\n        The class tag, e.g. '!astropy.cosmology.LambdaCDM'\n\n    Returns\n    -------\n    representer : callable[[`~astropy.io.misc.yaml.AstropyDumper`, |Cosmology|], str]\n        Function to construct :mod:`yaml` representation of |Cosmology| object.\n    \"\"\"\n    def representer(dumper, obj):\n        \"\"\"Cosmology yaml representer function for {}.\n\n        Parameters\n        ----------\n        dumper : `~astropy.io.misc.yaml.AstropyDumper`\n        obj : `~astropy.cosmology.Cosmology`\n\n        Returns\n        -------\n        str\n            :mod:`yaml` representation of |Cosmology| object.\n        \"\"\"\n        # convert to mapping\n        map = obj.to_format(\"mapping\")\n        # remove the cosmology class info. It's already recorded in `tag`\n        map.pop(\"cosmology\")\n        # make the metadata serializable in an order-preserving way.\n        map[\"meta\"] = tuple(map[\"meta\"].items())\n\n        return dumper.represent_mapping(tag, map)\n\n    representer.__doc__ = representer.__doc__.format(tag)\n\n    return representer\n\n\ndef yaml_constructor(cls):\n    \"\"\"Cosmology| object from :mod:`yaml` representation.\n\n    Parameters\n    ----------\n    cls : type\n        The class type, e.g. `~astropy.cosmology.LambdaCDM`.\n\n    Returns\n    -------\n    constructor : callable\n        Function to construct |Cosmology| object from :mod:`yaml` representation.\n    \"\"\"\n    def constructor(loader, node):\n        \"\"\"Cosmology yaml constructor function.\n\n        Parameters\n        ----------\n        loader : `~astropy.io.misc.yaml.AstropyLoader`\n        node : `yaml.nodes.MappingNode`\n            yaml representation of |Cosmology| object.\n\n        Returns\n        -------\n        `~astropy.cosmology.Cosmology` subclass instance\n        \"\"\"\n        # create mapping from YAML node\n        map = loader.construct_mapping(node)\n        # restore metadata to dict\n        map[\"meta\"] = dict(map[\"meta\"])\n        # get cosmology class qualified name from node\n        cosmology = str(node.tag).split(\".\")[-1]\n        # create Cosmology from mapping\n        return from_mapping(map, move_to_meta=False, cosmology=cosmology)\n\n    return constructor\n\n\ndef register_cosmology_yaml(cosmo_cls):\n    \"\"\"Register :mod:`yaml` for Cosmology class.\n\n    Parameters\n    ----------\n    cosmo_cls : `~astropy.cosmology.Cosmology` class\n    \"\"\"\n    tag = f\"!{cosmo_cls.__module__}.{cosmo_cls.__qualname__}\"\n\n    AstropyDumper.add_representer(cosmo_cls, yaml_representer(tag))\n    AstropyLoader.add_constructor(tag, yaml_constructor(cosmo_cls))\n\n\n##############################################################################\n# Unified-I/O Functions\n\n\ndef from_yaml(yml, *, cosmology=None):\n    \"\"\"Load `~astropy.cosmology.Cosmology` from :mod:`yaml` object.\n\n    Parameters\n    ----------\n    yml : str\n        :mod:`yaml` representation of |Cosmology| object\n    cosmology : str, `~astropy.cosmology.Cosmology` class, or None (optional, keyword-only)\n        The expected cosmology class (or string name thereof). This argument is\n        is only checked for correctness if not `None`.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n\n    Raises\n    ------\n    TypeError\n        If the |Cosmology| object loaded from ``yml`` is not an instance of\n        the ``cosmology`` (and ``cosmology`` is not `None`).\n    \"\"\"\n    with u.add_enabled_units(cu):\n        cosmo = load(yml)\n\n    # Check argument `cosmology`, if not None\n    # This kwarg is required for compatibility with |Cosmology.from_format|\n    if isinstance(cosmology, str):\n        cosmology = _COSMOLOGY_CLASSES[cosmology]\n    if cosmology is not None and not isinstance(cosmo, cosmology):\n        raise TypeError(f\"cosmology {cosmo} is not an {cosmology} instance.\")\n\n    return cosmo\n\n\ndef to_yaml(cosmology, *args):\n    \"\"\"Return the cosmology class, parameters, and metadata as a :mod:`yaml` object.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    *args\n        Not used. Needed for compatibility with\n        `~astropy.io.registry.UnifiedReadWriteMethod`\n\n    Returns\n    -------\n    str\n        :mod:`yaml` representation of |Cosmology| object\n    \"\"\"\n    return dump(cosmology)\n\n\n# ``read`` cannot handle non-path strings.\n#  TODO! this says there should be different types of I/O registries.\n#        not just hacking object conversion on top of file I/O.\n# def yaml_identify(origin, format, *args, **kwargs):\n#     \"\"\"Identify if object uses the yaml format.\n#\n#     Returns\n#     -------\n#     bool\n#     \"\"\"\n#     itis = False\n#     if origin == \"read\":\n#         itis = isinstance(args[1], str) and args[1][0].startswith(\"!\")\n#         itis &= format in (None, \"yaml\")\n#\n#     return itis\n\n\n# ===================================================================\n# Register\n\nfor cosmo_cls in _COSMOLOGY_CLASSES.values():\n    register_cosmology_yaml(cosmo_cls)\n\nconvert_registry.register_reader(\"yaml\", Cosmology, from_yaml)\nconvert_registry.register_writer(\"yaml\", Cosmology, to_yaml)\n# convert_registry.register_identifier(\"yaml\", Cosmology, yaml_identify)\n"},{"col":0,"comment":"Instantiate a `~astropy.cosmology.Cosmology` from a `~astropy.table.Row`.\n\n    Parameters\n    ----------\n    row : `~astropy.table.Row`\n        The object containing the Cosmology information.\n    move_to_meta : bool (optional, keyword-only)\n        Whether to move keyword arguments that are not in the Cosmology class'\n        signature to the Cosmology's metadata. This will only be applied if the\n        Cosmology does NOT have a keyword-only argument (e.g. ``**kwargs``).\n        Arguments moved to the metadata will be merged with existing metadata,\n        preferring specified metadata in the case of a merge conflict\n        (e.g. for ``Cosmology(meta={'key':10}, key=42)``, the ``Cosmology.meta``\n        will be ``{'key': 10}``).\n\n    cosmology : str, `~astropy.cosmology.Cosmology` class, or None (optional, keyword-only)\n        The cosmology class (or string name thereof) to use when constructing\n        the cosmology instance. The class also provides default parameter values,\n        filling in any non-mandatory arguments missing in 'table'.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n\n    Examples\n    --------\n    To see loading a `~astropy.cosmology.Cosmology` from a Row with\n    ``from_row``, we will first make a `~astropy.table.Row` using\n    :func:`~astropy.cosmology.Cosmology.to_format`.\n\n        >>> from astropy.cosmology import Cosmology, Planck18\n        >>> cr = Planck18.to_format(\"astropy.row\")\n        >>> cr\n        <Row index=0>\n          cosmology     name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                               km / (Mpc s)            K                 eV\n            str13       str8     float64    float64 float64 float64   float64   float64\n        ------------- -------- ------------ ------- ------- ------- ----------- -------\n        FlatLambdaCDM Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\n    Now this row can be used to load a new cosmological instance identical\n    to the ``Planck18`` cosmology from which it was generated.\n\n        >>> cosmo = Cosmology.from_format(cr, format=\"astropy.row\")\n        >>> cosmo\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                      Tcmb0=2.7255 K, Neff=3.046, m_nu=[0. 0. 0.06] eV, Ob0=0.04897)\n    ","endLoc":82,"header":"def from_row(row, *, move_to_meta=False, cosmology=None)","id":14134,"name":"from_row","nodeType":"Function","startLoc":15,"text":"def from_row(row, *, move_to_meta=False, cosmology=None):\n    \"\"\"Instantiate a `~astropy.cosmology.Cosmology` from a `~astropy.table.Row`.\n\n    Parameters\n    ----------\n    row : `~astropy.table.Row`\n        The object containing the Cosmology information.\n    move_to_meta : bool (optional, keyword-only)\n        Whether to move keyword arguments that are not in the Cosmology class'\n        signature to the Cosmology's metadata. This will only be applied if the\n        Cosmology does NOT have a keyword-only argument (e.g. ``**kwargs``).\n        Arguments moved to the metadata will be merged with existing metadata,\n        preferring specified metadata in the case of a merge conflict\n        (e.g. for ``Cosmology(meta={'key':10}, key=42)``, the ``Cosmology.meta``\n        will be ``{'key': 10}``).\n\n    cosmology : str, `~astropy.cosmology.Cosmology` class, or None (optional, keyword-only)\n        The cosmology class (or string name thereof) to use when constructing\n        the cosmology instance. The class also provides default parameter values,\n        filling in any non-mandatory arguments missing in 'table'.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n\n    Examples\n    --------\n    To see loading a `~astropy.cosmology.Cosmology` from a Row with\n    ``from_row``, we will first make a `~astropy.table.Row` using\n    :func:`~astropy.cosmology.Cosmology.to_format`.\n\n        >>> from astropy.cosmology import Cosmology, Planck18\n        >>> cr = Planck18.to_format(\"astropy.row\")\n        >>> cr\n        <Row index=0>\n          cosmology     name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                               km / (Mpc s)            K                 eV\n            str13       str8     float64    float64 float64 float64   float64   float64\n        ------------- -------- ------------ ------- ------- ------- ----------- -------\n        FlatLambdaCDM Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\n    Now this row can be used to load a new cosmological instance identical\n    to the ``Planck18`` cosmology from which it was generated.\n\n        >>> cosmo = Cosmology.from_format(cr, format=\"astropy.row\")\n        >>> cosmo\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                      Tcmb0=2.7255 K, Neff=3.046, m_nu=[0. 0. 0.06] eV, Ob0=0.04897)\n    \"\"\"\n    # special values\n    name = row['name'] if 'name' in row.columns else None  # get name from column\n\n    meta = defaultdict(dict, copy.deepcopy(row.meta))\n    # Now need to add the Columnar metadata. This is only available on the\n    # parent table. If Row is ever separated from Table, this should be moved\n    # to ``to_table``.\n    for col in row._table.itercols():\n        if col.info.meta:  # Only add metadata if not empty\n            meta[col.name].update(col.info.meta)\n\n    # turn row into mapping, filling cosmo if not in a column\n    mapping = dict(row)\n    mapping[\"name\"] = name\n    mapping.setdefault(\"cosmology\", meta.pop(\"cosmology\", None))\n    mapping[\"meta\"] = dict(meta)\n\n    # build cosmology from map\n    return from_mapping(mapping, move_to_meta=move_to_meta, cosmology=cosmology)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1414,"id":14135,"name":"models","nodeType":"Attribute","startLoc":1414,"text":"self.models"},{"attributeType":"null","col":8,"comment":"null","endLoc":1423,"id":14136,"name":"ndim","nodeType":"Attribute","startLoc":1423,"text":"self.ndim"},{"attributeType":"null","col":8,"comment":"null","endLoc":1416,"id":14137,"name":"jointparams","nodeType":"Attribute","startLoc":1416,"text":"self.jointparams"},{"attributeType":"null","col":8,"comment":"null","endLoc":1418,"id":14138,"name":"fitparams","nodeType":"Attribute","startLoc":1418,"text":"self.fitparams"},{"attributeType":"_SIP1D","col":8,"comment":"null","endLoc":1628,"id":14139,"name":"sip1d_b","nodeType":"Attribute","startLoc":1628,"text":"self.sip1d_b"},{"attributeType":"null","col":8,"comment":"null","endLoc":1617,"id":14140,"name":"_b_order","nodeType":"Attribute","startLoc":1617,"text":"self._b_order"},{"attributeType":"null","col":8,"comment":"null","endLoc":1421,"id":14141,"name":"modeldims","nodeType":"Attribute","startLoc":1421,"text":"self.modeldims"},{"attributeType":"null","col":8,"comment":"null","endLoc":1415,"id":14142,"name":"initvals","nodeType":"Attribute","startLoc":1415,"text":"self.initvals"},{"col":0,"comment":"\n    This is a decorator that can be used to add support for dealing with\n    quantities to any __call__ method on a fitter which may not support\n    quantities itself. This is done by temporarily removing units from all\n    parameters then adding them back once the fitting has completed.\n    ","endLoc":267,"header":"def fitter_unit_support(func)","id":14143,"name":"fitter_unit_support","nodeType":"Function","startLoc":165,"text":"def fitter_unit_support(func):\n    \"\"\"\n    This is a decorator that can be used to add support for dealing with\n    quantities to any __call__ method on a fitter which may not support\n    quantities itself. This is done by temporarily removing units from all\n    parameters then adding them back once the fitting has completed.\n    \"\"\"\n    @wraps(func)\n    def wrapper(self, model, x, y, z=None, **kwargs):\n        equivalencies = kwargs.pop('equivalencies', None)\n\n        data_has_units = (isinstance(x, Quantity) or\n                          isinstance(y, Quantity) or\n                          isinstance(z, Quantity))\n\n        model_has_units = model._has_units\n\n        if data_has_units or model_has_units:\n\n            if model._supports_unit_fitting:\n\n                # We now combine any instance-level input equivalencies with user\n                # specified ones at call-time.\n\n                input_units_equivalencies = _combine_equivalency_dict(\n                    model.inputs, equivalencies, model.input_units_equivalencies)\n\n                # If input_units is defined, we transform the input data into those\n                # expected by the model. We hard-code the input names 'x', and 'y'\n                # here since FittableModel instances have input names ('x',) or\n                # ('x', 'y')\n\n                if model.input_units is not None:\n                    if isinstance(x, Quantity):\n                        x = x.to(model.input_units[model.inputs[0]],\n                                 equivalencies=input_units_equivalencies[model.inputs[0]])\n                    if isinstance(y, Quantity) and z is not None:\n                        y = y.to(model.input_units[model.inputs[1]],\n                                 equivalencies=input_units_equivalencies[model.inputs[1]])\n\n                # Create a dictionary mapping the real model inputs and outputs\n                # names to the data. This remapping of names must be done here, after\n                # the input data is converted to the correct units.\n                rename_data = {model.inputs[0]: x}\n                if z is not None:\n                    rename_data[model.outputs[0]] = z\n                    rename_data[model.inputs[1]] = y\n                else:\n                    rename_data[model.outputs[0]] = y\n                    rename_data['z'] = None\n\n                # We now strip away the units from the parameters, taking care to\n                # first convert any parameters to the units that correspond to the\n                # input units (to make sure that initial guesses on the parameters)\n                # are in the right unit system\n                model = model.without_units_for_data(**rename_data)\n                if isinstance(model, tuple):\n                    rename_data['_left_kwargs'] = model[1]\n                    rename_data['_right_kwargs'] = model[2]\n                    model = model[0]\n\n                # We strip away the units from the input itself\n                add_back_units = False\n\n                if isinstance(x, Quantity):\n                    add_back_units = True\n                    xdata = x.value\n                else:\n                    xdata = np.asarray(x)\n\n                if isinstance(y, Quantity):\n                    add_back_units = True\n                    ydata = y.value\n                else:\n                    ydata = np.asarray(y)\n\n                if z is not None:\n                    if isinstance(z, Quantity):\n                        add_back_units = True\n                        zdata = z.value\n                    else:\n                        zdata = np.asarray(z)\n                # We run the fitting\n                if z is None:\n                    model_new = func(self, model, xdata, ydata, **kwargs)\n                else:\n                    model_new = func(self, model, xdata, ydata, zdata, **kwargs)\n\n                # And finally we add back units to the parameters\n                if add_back_units:\n                    model_new = model_new.with_units_from_data(**rename_data)\n                return model_new\n\n            else:\n\n                raise NotImplementedError(\"This model does not support being \"\n                                          \"fit to data with units.\")\n\n        else:\n\n            return func(self, model, x, y, z=z, **kwargs)\n\n    return wrapper"},{"attributeType":"null","col":8,"comment":"null","endLoc":1623,"id":14144,"name":"_bp_coeff","nodeType":"Attribute","startLoc":1623,"text":"self._bp_coeff"},{"col":4,"comment":"Validate neutrino masses to right value, units, and shape.\n\n        There are no neutrinos if floor(Neff) or Tcmb0 are 0.\n        The number of neutrinos must match floor(Neff).\n        Neutrino masses cannot be negative.\n        ","endLoc":261,"header":"@m_nu.validator\n    def m_nu(self, param, value)","id":14145,"name":"m_nu","nodeType":"Function","startLoc":235,"text":"@m_nu.validator\n    def m_nu(self, param, value):\n        \"\"\"Validate neutrino masses to right value, units, and shape.\n\n        There are no neutrinos if floor(Neff) or Tcmb0 are 0.\n        The number of neutrinos must match floor(Neff).\n        Neutrino masses cannot be negative.\n        \"\"\"\n        # Check if there are any neutrinos\n        if (nneutrinos := floor(self._Neff)) == 0 or self._Tcmb0.value == 0:\n            return None  # None, regardless of input\n\n        # Validate / set units\n        value = _validate_with_unit(self, param, value)\n\n        # Check values and data shapes\n        if value.shape not in ((), (nneutrinos,)):\n            raise ValueError(\"unexpected number of neutrino masses — \"\n                             f\"expected {nneutrinos}, got {len(value)}.\")\n        elif np.any(value.value < 0):\n            raise ValueError(\"invalid (negative) neutrino mass encountered.\")\n\n        # scalar -> array\n        if value.isscalar:\n            value = np.full_like(value, value, shape=nneutrinos)\n\n        return value"},{"col":0,"comment":":mod:`yaml` representation of |Cosmology| object.\n\n    Parameters\n    ----------\n    tag : str\n        The class tag, e.g. '!astropy.cosmology.LambdaCDM'\n\n    Returns\n    -------\n    representer : callable[[`~astropy.io.misc.yaml.AstropyDumper`, |Cosmology|], str]\n        Function to construct :mod:`yaml` representation of |Cosmology| object.\n    ","endLoc":66,"header":"def yaml_representer(tag)","id":14146,"name":"yaml_representer","nodeType":"Function","startLoc":29,"text":"def yaml_representer(tag):\n    \"\"\":mod:`yaml` representation of |Cosmology| object.\n\n    Parameters\n    ----------\n    tag : str\n        The class tag, e.g. '!astropy.cosmology.LambdaCDM'\n\n    Returns\n    -------\n    representer : callable[[`~astropy.io.misc.yaml.AstropyDumper`, |Cosmology|], str]\n        Function to construct :mod:`yaml` representation of |Cosmology| object.\n    \"\"\"\n    def representer(dumper, obj):\n        \"\"\"Cosmology yaml representer function for {}.\n\n        Parameters\n        ----------\n        dumper : `~astropy.io.misc.yaml.AstropyDumper`\n        obj : `~astropy.cosmology.Cosmology`\n\n        Returns\n        -------\n        str\n            :mod:`yaml` representation of |Cosmology| object.\n        \"\"\"\n        # convert to mapping\n        map = obj.to_format(\"mapping\")\n        # remove the cosmology class info. It's already recorded in `tag`\n        map.pop(\"cosmology\")\n        # make the metadata serializable in an order-preserving way.\n        map[\"meta\"] = tuple(map[\"meta\"].items())\n\n        return dumper.represent_mapping(tag, map)\n\n    representer.__doc__ = representer.__doc__.format(tag)\n\n    return representer"},{"col":0,"comment":"Cosmology| object from :mod:`yaml` representation.\n\n    Parameters\n    ----------\n    cls : type\n        The class type, e.g. `~astropy.cosmology.LambdaCDM`.\n\n    Returns\n    -------\n    constructor : callable\n        Function to construct |Cosmology| object from :mod:`yaml` representation.\n    ","endLoc":104,"header":"def yaml_constructor(cls)","id":14147,"name":"yaml_constructor","nodeType":"Function","startLoc":69,"text":"def yaml_constructor(cls):\n    \"\"\"Cosmology| object from :mod:`yaml` representation.\n\n    Parameters\n    ----------\n    cls : type\n        The class type, e.g. `~astropy.cosmology.LambdaCDM`.\n\n    Returns\n    -------\n    constructor : callable\n        Function to construct |Cosmology| object from :mod:`yaml` representation.\n    \"\"\"\n    def constructor(loader, node):\n        \"\"\"Cosmology yaml constructor function.\n\n        Parameters\n        ----------\n        loader : `~astropy.io.misc.yaml.AstropyLoader`\n        node : `yaml.nodes.MappingNode`\n            yaml representation of |Cosmology| object.\n\n        Returns\n        -------\n        `~astropy.cosmology.Cosmology` subclass instance\n        \"\"\"\n        # create mapping from YAML node\n        map = loader.construct_mapping(node)\n        # restore metadata to dict\n        map[\"meta\"] = dict(map[\"meta\"])\n        # get cosmology class qualified name from node\n        cosmology = str(node.tag).split(\".\")[-1]\n        # create Cosmology from mapping\n        return from_mapping(map, move_to_meta=False, cosmology=cosmology)\n\n    return constructor"},{"col":0,"comment":"Serialize the cosmology into a `~astropy.table.QTable`.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    *args\n        Not used. Needed for compatibility with\n        `~astropy.io.registry.UnifiedReadWriteMethod`\n    cls : type (optional, keyword-only)\n        Astropy :class:`~astropy.table.Table` class or subclass type to return.\n        Default is :class:`~astropy.table.QTable`.\n    cosmology_in_meta : bool\n        Whether to put the cosmology class in the Table metadata (if `True`,\n        default) or as the first column (if `False`).\n\n    Returns\n    -------\n    `~astropy.table.QTable`\n        With columns for the cosmology parameters, and metadata and\n        cosmology class name in the Table's ``meta`` attribute\n\n    Raises\n    ------\n    TypeError\n        If kwarg (optional) 'cls' is not a subclass of `astropy.table.Table`\n\n    Examples\n    --------\n    A Cosmology as a `~astropy.table.QTable` will have the cosmology's name and\n    parameters as columns.\n\n        >>> from astropy.cosmology import Planck18\n        >>> ct = Planck18.to_format(\"astropy.table\")\n        >>> ct\n        <QTable length=1>\n          name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                 km / (Mpc s)            K                 eV\n          str8     float64    float64 float64 float64   float64   float64\n        -------- ------------ ------- ------- ------- ----------- -------\n        Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\n    The cosmological class and other metadata, e.g. a paper reference, are in\n    the Table's metadata.\n\n        >>> ct.meta\n        OrderedDict([..., ('cosmology', 'FlatLambdaCDM')])\n\n    To move the cosmology class from the metadata to a Table row, set the\n    ``cosmology_in_meta`` argument to `False`:\n\n        >>> Planck18.to_format(\"astropy.table\", cosmology_in_meta=False)\n        <QTable length=1>\n          cosmology     name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                               km / (Mpc s)            K                 eV\n            str13       str8     float64    float64 float64 float64   float64   float64\n        ------------- -------- ------------ ------- ------- ------- ----------- -------\n        FlatLambdaCDM Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\n    Astropy recommends `~astropy.table.QTable` for tables with\n    `~astropy.units.Quantity` columns. However the returned type may be\n    overridden using the ``cls`` argument:\n\n        >>> from astropy.table import Table\n        >>> Planck18.to_format(\"astropy.table\", cls=Table)\n        <Table length=1>\n        ...\n    ","endLoc":235,"header":"def to_table(cosmology, *args, cls=QTable, cosmology_in_meta=True)","id":14148,"name":"to_table","nodeType":"Function","startLoc":141,"text":"def to_table(cosmology, *args, cls=QTable, cosmology_in_meta=True):\n    \"\"\"Serialize the cosmology into a `~astropy.table.QTable`.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    *args\n        Not used. Needed for compatibility with\n        `~astropy.io.registry.UnifiedReadWriteMethod`\n    cls : type (optional, keyword-only)\n        Astropy :class:`~astropy.table.Table` class or subclass type to return.\n        Default is :class:`~astropy.table.QTable`.\n    cosmology_in_meta : bool\n        Whether to put the cosmology class in the Table metadata (if `True`,\n        default) or as the first column (if `False`).\n\n    Returns\n    -------\n    `~astropy.table.QTable`\n        With columns for the cosmology parameters, and metadata and\n        cosmology class name in the Table's ``meta`` attribute\n\n    Raises\n    ------\n    TypeError\n        If kwarg (optional) 'cls' is not a subclass of `astropy.table.Table`\n\n    Examples\n    --------\n    A Cosmology as a `~astropy.table.QTable` will have the cosmology's name and\n    parameters as columns.\n\n        >>> from astropy.cosmology import Planck18\n        >>> ct = Planck18.to_format(\"astropy.table\")\n        >>> ct\n        <QTable length=1>\n          name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                 km / (Mpc s)            K                 eV\n          str8     float64    float64 float64 float64   float64   float64\n        -------- ------------ ------- ------- ------- ----------- -------\n        Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\n    The cosmological class and other metadata, e.g. a paper reference, are in\n    the Table's metadata.\n\n        >>> ct.meta\n        OrderedDict([..., ('cosmology', 'FlatLambdaCDM')])\n\n    To move the cosmology class from the metadata to a Table row, set the\n    ``cosmology_in_meta`` argument to `False`:\n\n        >>> Planck18.to_format(\"astropy.table\", cosmology_in_meta=False)\n        <QTable length=1>\n          cosmology     name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                               km / (Mpc s)            K                 eV\n            str13       str8     float64    float64 float64 float64   float64   float64\n        ------------- -------- ------------ ------- ------- ------- ----------- -------\n        FlatLambdaCDM Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\n    Astropy recommends `~astropy.table.QTable` for tables with\n    `~astropy.units.Quantity` columns. However the returned type may be\n    overridden using the ``cls`` argument:\n\n        >>> from astropy.table import Table\n        >>> Planck18.to_format(\"astropy.table\", cls=Table)\n        <Table length=1>\n        ...\n    \"\"\"\n    if not issubclass(cls, Table):\n        raise TypeError(f\"'cls' must be a (sub)class of Table, not {type(cls)}\")\n\n    # Start by getting a map representation.\n    data = to_mapping(cosmology)\n    data[\"cosmology\"] = data[\"cosmology\"].__qualname__  # change to str\n\n    # Metadata\n    meta = data.pop(\"meta\")  # remove the meta\n    if cosmology_in_meta:\n        meta[\"cosmology\"] = data.pop(\"cosmology\")\n\n    # Need to turn everything into something Table can process:\n    # - Column for Parameter\n    # - list for anything else\n    cosmo_cls = cosmology.__class__\n    for k, v in data.items():\n        if k in cosmology.__parameters__:\n            col = convert_parameter_to_column(getattr(cosmo_cls, k), v,\n                                              cosmology.meta.get(k))\n        else:\n            col = Column([v])\n        data[k] = col\n\n    tbl = cls(data, meta=meta)\n    tbl.add_index(\"name\", unique=True)\n    return tbl"},{"attributeType":"null","col":8,"comment":"null","endLoc":1633,"id":14149,"name":"_outputs","nodeType":"Attribute","startLoc":1633,"text":"self._outputs"},{"col":0,"comment":"Register :mod:`yaml` for Cosmology class.\n\n    Parameters\n    ----------\n    cosmo_cls : `~astropy.cosmology.Cosmology` class\n    ","endLoc":117,"header":"def register_cosmology_yaml(cosmo_cls)","id":14150,"name":"register_cosmology_yaml","nodeType":"Function","startLoc":107,"text":"def register_cosmology_yaml(cosmo_cls):\n    \"\"\"Register :mod:`yaml` for Cosmology class.\n\n    Parameters\n    ----------\n    cosmo_cls : `~astropy.cosmology.Cosmology` class\n    \"\"\"\n    tag = f\"!{cosmo_cls.__module__}.{cosmo_cls.__qualname__}\"\n\n    AstropyDumper.add_representer(cosmo_cls, yaml_representer(tag))\n    AstropyLoader.add_constructor(tag, yaml_constructor(cosmo_cls))"},{"col":0,"comment":"Load `~astropy.cosmology.Cosmology` from :mod:`yaml` object.\n\n    Parameters\n    ----------\n    yml : str\n        :mod:`yaml` representation of |Cosmology| object\n    cosmology : str, `~astropy.cosmology.Cosmology` class, or None (optional, keyword-only)\n        The expected cosmology class (or string name thereof). This argument is\n        is only checked for correctness if not `None`.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n\n    Raises\n    ------\n    TypeError\n        If the |Cosmology| object loaded from ``yml`` is not an instance of\n        the ``cosmology`` (and ``cosmology`` is not `None`).\n    ","endLoc":155,"header":"def from_yaml(yml, *, cosmology=None)","id":14151,"name":"from_yaml","nodeType":"Function","startLoc":124,"text":"def from_yaml(yml, *, cosmology=None):\n    \"\"\"Load `~astropy.cosmology.Cosmology` from :mod:`yaml` object.\n\n    Parameters\n    ----------\n    yml : str\n        :mod:`yaml` representation of |Cosmology| object\n    cosmology : str, `~astropy.cosmology.Cosmology` class, or None (optional, keyword-only)\n        The expected cosmology class (or string name thereof). This argument is\n        is only checked for correctness if not `None`.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n\n    Raises\n    ------\n    TypeError\n        If the |Cosmology| object loaded from ``yml`` is not an instance of\n        the ``cosmology`` (and ``cosmology`` is not `None`).\n    \"\"\"\n    with u.add_enabled_units(cu):\n        cosmo = load(yml)\n\n    # Check argument `cosmology`, if not None\n    # This kwarg is required for compatibility with |Cosmology.from_format|\n    if isinstance(cosmology, str):\n        cosmology = _COSMOLOGY_CLASSES[cosmology]\n    if cosmology is not None and not isinstance(cosmo, cosmology):\n        raise TypeError(f\"cosmology {cosmo} is not an {cosmology} instance.\")\n\n    return cosmo"},{"attributeType":"null","col":8,"comment":"null","endLoc":1618,"id":14152,"name":"_a_coeff","nodeType":"Attribute","startLoc":1618,"text":"self._a_coeff"},{"col":0,"comment":"Serialize the cosmology into a `~astropy.table.Row`.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    *args\n        Not used. Needed for compatibility with\n        `~astropy.io.registry.UnifiedReadWriteMethod`\n    table_cls : type (optional, keyword-only)\n        Astropy :class:`~astropy.table.Table` class or subclass type to use.\n        Default is :class:`~astropy.table.QTable`.\n    cosmology_in_meta : bool\n        Whether to put the cosmology class in the Table metadata (if `True`) or\n        as the first column (if `False`, default).\n\n    Returns\n    -------\n    `~astropy.table.Row`\n        With columns for the cosmology parameters, and metadata in the Table's\n        ``meta`` attribute. The cosmology class name will either be a column\n        or in ``meta``, depending on 'cosmology_in_meta'.\n\n    Examples\n    --------\n    A Cosmology as a `~astropy.table.Row` will have the cosmology's name and\n    parameters as columns.\n\n        >>> from astropy.cosmology import Planck18\n        >>> cr = Planck18.to_format(\"astropy.row\")\n        >>> cr\n        <Row index=0>\n          cosmology     name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                               km / (Mpc s)            K                 eV\n            str13       str8     float64    float64 float64 float64   float64   float64\n        ------------- -------- ------------ ------- ------- ------- ----------- -------\n        FlatLambdaCDM Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\n    The cosmological class and other metadata, e.g. a paper reference, are in\n    the Table's metadata.\n    ","endLoc":129,"header":"def to_row(cosmology, *args, cosmology_in_meta=False, table_cls=QTable)","id":14153,"name":"to_row","nodeType":"Function","startLoc":85,"text":"def to_row(cosmology, *args, cosmology_in_meta=False, table_cls=QTable):\n    \"\"\"Serialize the cosmology into a `~astropy.table.Row`.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    *args\n        Not used. Needed for compatibility with\n        `~astropy.io.registry.UnifiedReadWriteMethod`\n    table_cls : type (optional, keyword-only)\n        Astropy :class:`~astropy.table.Table` class or subclass type to use.\n        Default is :class:`~astropy.table.QTable`.\n    cosmology_in_meta : bool\n        Whether to put the cosmology class in the Table metadata (if `True`) or\n        as the first column (if `False`, default).\n\n    Returns\n    -------\n    `~astropy.table.Row`\n        With columns for the cosmology parameters, and metadata in the Table's\n        ``meta`` attribute. The cosmology class name will either be a column\n        or in ``meta``, depending on 'cosmology_in_meta'.\n\n    Examples\n    --------\n    A Cosmology as a `~astropy.table.Row` will have the cosmology's name and\n    parameters as columns.\n\n        >>> from astropy.cosmology import Planck18\n        >>> cr = Planck18.to_format(\"astropy.row\")\n        >>> cr\n        <Row index=0>\n          cosmology     name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                               km / (Mpc s)            K                 eV\n            str13       str8     float64    float64 float64 float64   float64   float64\n        ------------- -------- ------------ ------- ------- ------- ----------- -------\n        FlatLambdaCDM Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\n    The cosmological class and other metadata, e.g. a paper reference, are in\n    the Table's metadata.\n    \"\"\"\n    from .table import to_table\n\n    table = to_table(cosmology, cls=table_cls, cosmology_in_meta=cosmology_in_meta)\n    return table[0]  # extract row from table"},{"col":0,"comment":"Return the cosmology class, parameters, and metadata as a `dict`.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    *args\n        Not used. Needed for compatibility with\n        `~astropy.io.registry.UnifiedReadWriteMethod`\n    cls : type (optional, keyword-only)\n        `dict` or `collections.Mapping` subclass.\n        The mapping type to return. Default is `dict`.\n    cosmology_as_str : bool (optional, keyword-only)\n        Whether the cosmology value is the class (if `False`, default) or\n        the semi-qualified name (if `True`).\n    move_from_meta : bool (optional, keyword-only)\n        Whether to add the Cosmology's metadata as an item to the mapping (if\n        `False`, default) or to merge with the rest of the mapping, preferring\n        the original values (if `True`)\n\n    Returns\n    -------\n    dict\n        with key-values for the cosmology parameters and also:\n        - 'cosmology' : the class\n        - 'meta' : the contents of the cosmology's metadata attribute.\n                   If ``move_from_meta`` is `True`, this key is missing and the\n                   contained metadata are added to the main `dict`.\n\n    Examples\n    --------\n    A Cosmology as a mapping will have the cosmology's name and\n    parameters as items, and the metadata as a nested dictionary.\n\n        >>> from astropy.cosmology import Planck18\n        >>> Planck18.to_format('mapping')\n        {'cosmology': <class 'astropy.cosmology.flrw.FlatLambdaCDM'>,\n         'name': 'Planck18', 'H0': <Quantity 67.66 km / (Mpc s)>, 'Om0': 0.30966,\n         'Tcmb0': <Quantity 2.7255 K>, 'Neff': 3.046,\n         'm_nu': <Quantity [0.  , 0.  , 0.06] eV>, 'Ob0': 0.04897,\n         'meta': ...\n\n    The dictionary type may be changed with the ``cls`` keyword argument:\n\n        >>> from collections import OrderedDict\n        >>> Planck18.to_format('mapping', cls=OrderedDict)\n        OrderedDict([('cosmology', <class 'astropy.cosmology.flrw.FlatLambdaCDM'>),\n          ('name', 'Planck18'), ('H0', <Quantity 67.66 km / (Mpc s)>),\n          ('Om0', 0.30966), ('Tcmb0', <Quantity 2.7255 K>), ('Neff', 3.046),\n          ('m_nu', <Quantity [0.  , 0.  , 0.06] eV>), ('Ob0', 0.04897),\n          ('meta', ...\n\n    Sometimes it is more useful to have the name of the cosmology class, not\n    the object itself. The keyword argument ``cosmology_as_str`` may be used:\n\n        >>> Planck18.to_format('mapping', cosmology_as_str=True)\n        {'cosmology': 'FlatLambdaCDM', ...\n\n    The metadata is normally included as a nested mapping. To move the metadata\n    into the main mapping, use the keyword argument ``move_from_meta``. This\n    kwarg inverts ``move_to_meta`` in\n    ``Cosmology.to_format(\"mapping\", move_to_meta=...)`` where extra items\n    are moved to the metadata (if the cosmology constructor does not have a\n    variable keyword-only argument -- ``**kwargs``).\n\n        >>> from astropy.cosmology import Planck18\n        >>> Planck18.to_format('mapping', move_from_meta=True)\n        {'cosmology': <class 'astropy.cosmology.flrw.FlatLambdaCDM'>,\n         'name': 'Planck18', 'Oc0': 0.2607, 'n': 0.9665, 'sigma8': 0.8102, ...\n    ","endLoc":213,"header":"def to_mapping(cosmology, *args, cls=dict, cosmology_as_str=False, move_from_meta=False)","id":14154,"name":"to_mapping","nodeType":"Function","startLoc":119,"text":"def to_mapping(cosmology, *args, cls=dict, cosmology_as_str=False, move_from_meta=False):\n    \"\"\"Return the cosmology class, parameters, and metadata as a `dict`.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    *args\n        Not used. Needed for compatibility with\n        `~astropy.io.registry.UnifiedReadWriteMethod`\n    cls : type (optional, keyword-only)\n        `dict` or `collections.Mapping` subclass.\n        The mapping type to return. Default is `dict`.\n    cosmology_as_str : bool (optional, keyword-only)\n        Whether the cosmology value is the class (if `False`, default) or\n        the semi-qualified name (if `True`).\n    move_from_meta : bool (optional, keyword-only)\n        Whether to add the Cosmology's metadata as an item to the mapping (if\n        `False`, default) or to merge with the rest of the mapping, preferring\n        the original values (if `True`)\n\n    Returns\n    -------\n    dict\n        with key-values for the cosmology parameters and also:\n        - 'cosmology' : the class\n        - 'meta' : the contents of the cosmology's metadata attribute.\n                   If ``move_from_meta`` is `True`, this key is missing and the\n                   contained metadata are added to the main `dict`.\n\n    Examples\n    --------\n    A Cosmology as a mapping will have the cosmology's name and\n    parameters as items, and the metadata as a nested dictionary.\n\n        >>> from astropy.cosmology import Planck18\n        >>> Planck18.to_format('mapping')\n        {'cosmology': <class 'astropy.cosmology.flrw.FlatLambdaCDM'>,\n         'name': 'Planck18', 'H0': <Quantity 67.66 km / (Mpc s)>, 'Om0': 0.30966,\n         'Tcmb0': <Quantity 2.7255 K>, 'Neff': 3.046,\n         'm_nu': <Quantity [0.  , 0.  , 0.06] eV>, 'Ob0': 0.04897,\n         'meta': ...\n\n    The dictionary type may be changed with the ``cls`` keyword argument:\n\n        >>> from collections import OrderedDict\n        >>> Planck18.to_format('mapping', cls=OrderedDict)\n        OrderedDict([('cosmology', <class 'astropy.cosmology.flrw.FlatLambdaCDM'>),\n          ('name', 'Planck18'), ('H0', <Quantity 67.66 km / (Mpc s)>),\n          ('Om0', 0.30966), ('Tcmb0', <Quantity 2.7255 K>), ('Neff', 3.046),\n          ('m_nu', <Quantity [0.  , 0.  , 0.06] eV>), ('Ob0', 0.04897),\n          ('meta', ...\n\n    Sometimes it is more useful to have the name of the cosmology class, not\n    the object itself. The keyword argument ``cosmology_as_str`` may be used:\n\n        >>> Planck18.to_format('mapping', cosmology_as_str=True)\n        {'cosmology': 'FlatLambdaCDM', ...\n\n    The metadata is normally included as a nested mapping. To move the metadata\n    into the main mapping, use the keyword argument ``move_from_meta``. This\n    kwarg inverts ``move_to_meta`` in\n    ``Cosmology.to_format(\"mapping\", move_to_meta=...)`` where extra items\n    are moved to the metadata (if the cosmology constructor does not have a\n    variable keyword-only argument -- ``**kwargs``).\n\n        >>> from astropy.cosmology import Planck18\n        >>> Planck18.to_format('mapping', move_from_meta=True)\n        {'cosmology': <class 'astropy.cosmology.flrw.FlatLambdaCDM'>,\n         'name': 'Planck18', 'Oc0': 0.2607, 'n': 0.9665, 'sigma8': 0.8102, ...\n    \"\"\"\n    if not issubclass(cls, (dict, Mapping)):\n        raise TypeError(f\"'cls' must be a (sub)class of dict or Mapping, not {cls}\")\n\n    m = cls()\n    # start with the cosmology class & name\n    m[\"cosmology\"] = cosmology.__class__.__qualname__ if cosmology_as_str else cosmology.__class__\n    m[\"name\"] = cosmology.name  # here only for dict ordering\n\n    meta = copy.deepcopy(cosmology.meta)  # metadata (mutable)\n    if move_from_meta:\n        # Merge the mutable metadata. Since params are added later they will\n        # be preferred in cases of overlapping keys. Likewise, need to pop\n        # cosmology and name from meta.\n        meta.pop(\"cosmology\", None)\n        meta.pop(\"name\", None)\n        m.update(meta)\n\n    # Add all the immutable inputs\n    m.update({k: v for k, v in cosmology._init_arguments.items()\n              if k not in (\"meta\", \"name\")})\n    # Lastly, add the metadata, if haven't already (above)\n    if not move_from_meta:\n        m[\"meta\"] = meta  # TODO? should meta be type(cls)\n\n    return m"},{"col":0,"comment":"Identify if object uses the `~astropy.table.Row` format.\n\n    Returns\n    -------\n    bool\n    ","endLoc":142,"header":"def row_identify(origin, format, *args, **kwargs)","id":14155,"name":"row_identify","nodeType":"Function","startLoc":132,"text":"def row_identify(origin, format, *args, **kwargs):\n    \"\"\"Identify if object uses the `~astropy.table.Row` format.\n\n    Returns\n    -------\n    bool\n    \"\"\"\n    itis = False\n    if origin == \"read\":\n        itis = isinstance(args[1], Row) and (format in (None, \"astropy.row\"))\n    return itis"},{"attributeType":"null","col":16,"comment":"null","endLoc":6,"id":14156,"name":"np","nodeType":"Attribute","startLoc":6,"text":"np"},{"col":0,"comment":"","endLoc":3,"header":"row.py#<anonymous>","id":14157,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"convert_registry.register_reader(\"astropy.row\", Cosmology, from_row)\n\nconvert_registry.register_writer(\"astropy.row\", Cosmology, to_row)\n\nconvert_registry.register_identifier(\"astropy.row\", Cosmology, row_identify)"},{"col":0,"comment":"Return the cosmology class, parameters, and metadata as a :mod:`yaml` object.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    *args\n        Not used. Needed for compatibility with\n        `~astropy.io.registry.UnifiedReadWriteMethod`\n\n    Returns\n    -------\n    str\n        :mod:`yaml` representation of |Cosmology| object\n    ","endLoc":173,"header":"def to_yaml(cosmology, *args)","id":14158,"name":"to_yaml","nodeType":"Function","startLoc":158,"text":"def to_yaml(cosmology, *args):\n    \"\"\"Return the cosmology class, parameters, and metadata as a :mod:`yaml` object.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    *args\n        Not used. Needed for compatibility with\n        `~astropy.io.registry.UnifiedReadWriteMethod`\n\n    Returns\n    -------\n    str\n        :mod:`yaml` representation of |Cosmology| object\n    \"\"\"\n    return dump(cosmology)"},{"attributeType":"_SIP1D","col":8,"comment":"null","endLoc":1626,"id":14159,"name":"sip1d_a","nodeType":"Attribute","startLoc":1626,"text":"self.sip1d_a"},{"attributeType":"null","col":8,"comment":"null","endLoc":1615,"id":14160,"name":"_crpix","nodeType":"Attribute","startLoc":1615,"text":"self._crpix"},{"col":4,"comment":"Validate baryon density to None or positive float > matter density.","endLoc":233,"header":"@Ob0.validator\n    def Ob0(self, param, value)","id":14161,"name":"Ob0","nodeType":"Function","startLoc":224,"text":"@Ob0.validator\n    def Ob0(self, param, value):\n        \"\"\"Validate baryon density to None or positive float > matter density.\"\"\"\n        if value is None:\n            return value\n\n        value = _validate_non_negative(self, param, value)\n        if value > self.Om0:\n            raise ValueError(\"baryonic density can not be larger than total matter density.\")\n        return value"},{"attributeType":"null","col":34,"comment":"null","endLoc":11,"id":14162,"name":"cu","nodeType":"Attribute","startLoc":11,"text":"cu"},{"attributeType":"null","col":24,"comment":"null","endLoc":12,"id":14163,"name":"u","nodeType":"Attribute","startLoc":12,"text":"u"},{"col":4,"comment":"null","endLoc":219,"header":"def __init__(self, H0, Om0, Ode0, Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV,\n                 Ob0=None, *, name=None, meta=None)","id":14164,"name":"__init__","nodeType":"Function","startLoc":131,"text":"def __init__(self, H0, Om0, Ode0, Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV,\n                 Ob0=None, *, name=None, meta=None):\n        super().__init__(name=name, meta=meta)\n\n        # Assign (and validate) Parameters\n        self.H0 = H0\n        self.Om0 = Om0\n        self.Ode0 = Ode0\n        self.Tcmb0 = Tcmb0\n        self.Neff = Neff\n        self.m_nu = m_nu  # (reset later, this is just for unit validation)\n        self.Ob0 = Ob0  # (must be after Om0)\n\n        # Derived quantities:\n        # Dark matter density; matter - baryons, if latter is not None.\n        self._Odm0 = None if Ob0 is None else (self._Om0 - self._Ob0)\n\n        # 100 km/s/Mpc * h = H0 (so h is dimensionless)\n        self._h = self._H0.value / 100.0\n        # Hubble distance\n        self._hubble_distance = (const.c / self._H0).to(u.Mpc)\n        # H0 in s^-1\n        H0_s = self._H0.value * H0units_to_invs\n        # Hubble time\n        self._hubble_time = (sec_to_Gyr / H0_s) << u.Gyr\n\n        # Critical density at z=0 (grams per cubic cm)\n        cd0value = critdens_const * H0_s ** 2\n        self._critical_density0 = cd0value << u.g / u.cm ** 3\n\n        # Compute photon density from Tcmb\n        self._Ogamma0 = a_B_c2 * self._Tcmb0.value ** 4 / self._critical_density0.value\n\n        # Compute Neutrino temperature:\n        # The constant in front is (4/11)^1/3 -- see any cosmology book for an\n        # explanation -- for example, Weinberg 'Cosmology' p 154 eq (3.1.21).\n        self._Tnu0 = 0.7137658555036082 * self._Tcmb0\n\n        # Compute neutrino parameters:\n        if self._m_nu is None:\n            self._nneutrinos = 0\n            self._neff_per_nu = None\n            self._massivenu = False\n            self._massivenu_mass = None\n            self._nmassivenu = self._nmasslessnu = None\n        else:\n            self._nneutrinos = floor(self._Neff)\n\n            # We are going to share Neff between the neutrinos equally. In\n            # detail this is not correct, but it is a standard assumption\n            # because properly calculating it is a) complicated b) depends on\n            # the details of the massive neutrinos (e.g., their weak\n            # interactions, which could be unusual if one is considering\n            # sterile neutrinos).\n            self._neff_per_nu = self._Neff / self._nneutrinos\n\n            # Now figure out if we have massive neutrinos to deal with, and if\n            # so, get the right number of masses. It is worth keeping track of\n            # massless ones separately (since they are easy to deal with, and a\n            # common use case is to have only one massive neutrino).\n            massive = np.nonzero(self._m_nu.value > 0)[0]\n            self._massivenu = massive.size > 0\n            self._nmassivenu = len(massive)\n            self._massivenu_mass = self._m_nu[massive].value if self._massivenu else None\n            self._nmasslessnu = self._nneutrinos - self._nmassivenu\n\n        # Compute Neutrino Omega and total relativistic component for massive\n        # neutrinos. We also store a list version, since that is more efficient\n        # to do integrals with (perhaps surprisingly! But small python lists\n        # are more efficient than small NumPy arrays).\n        if self._massivenu:  # (`_massivenu` set in `m_nu`)\n            nu_y = self._massivenu_mass / (kB_evK * self._Tnu0)\n            self._nu_y = nu_y.value\n            self._nu_y_list = self._nu_y.tolist()\n            self._Onu0 = self._Ogamma0 * self.nu_relative_density(0)\n        else:\n            # This case is particularly simple, so do it directly The 0.2271...\n            # is 7/8 (4/11)^(4/3) -- the temperature bit ^4 (blackbody energy\n            # density) times 7/8 for FD vs. BE statistics.\n            self._Onu0 = 0.22710731766 * self._Neff * self._Ogamma0\n            self._nu_y = self._nu_y_list = None\n\n        # Compute curvature density\n        self._Ok0 = 1.0 - self._Om0 - self._Ode0 - self._Ogamma0 - self._Onu0\n\n        # Subclasses should override this reference if they provide\n        #  more efficient scalar versions of inv_efunc.\n        self._inv_efunc_scalar = self.inv_efunc\n        self._inv_efunc_scalar_args = ()"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":14165,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"attributeType":"null","col":4,"comment":"null","endLoc":197,"id":14166,"name":"cosmo_cls","nodeType":"Attribute","startLoc":197,"text":"cosmo_cls"},{"col":0,"comment":"","endLoc":9,"header":"yaml.py#<anonymous>","id":14167,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThe following are private functions, included here **FOR REFERENCE ONLY** since\nthe io registry cannot be displayed. These functions are registered into\n:meth:`~astropy.cosmology.Cosmology.to_format` and\n:meth:`~astropy.cosmology.Cosmology.from_format` and should only be accessed\nvia these methods.\n\"\"\"  # this is shown in the docs.\n\n__all__ = []  # nothing is publicly scoped\n\nfor cosmo_cls in _COSMOLOGY_CLASSES.values():\n    register_cosmology_yaml(cosmo_cls)\n\nconvert_registry.register_reader(\"yaml\", Cosmology, from_yaml)\n\nconvert_registry.register_writer(\"yaml\", Cosmology, to_yaml)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1632,"id":14168,"name":"_inputs","nodeType":"Attribute","startLoc":1632,"text":"self._inputs"},{"attributeType":"Shift","col":8,"comment":"null","endLoc":1624,"id":14169,"name":"shift_a","nodeType":"Attribute","startLoc":1624,"text":"self.shift_a"},{"attributeType":"Shift","col":8,"comment":"null","endLoc":1625,"id":14170,"name":"shift_b","nodeType":"Attribute","startLoc":1625,"text":"self.shift_b"},{"attributeType":"null","col":8,"comment":"null","endLoc":1621,"id":14171,"name":"_bp_order","nodeType":"Attribute","startLoc":1621,"text":"self._bp_order"},{"fileName":"model.py","filePath":"astropy/cosmology/io","id":14172,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThe following are private functions, included here **FOR REFERENCE ONLY** since\nthe io registry cannot be displayed. These functions are registered into\n:meth:`~astropy.cosmology.Cosmology.to_format` and\n:meth:`~astropy.cosmology.Cosmology.from_format` and should only be accessed\nvia these methods.\n\"\"\"  # this is shown in the docs.\n\nimport abc\nimport copy\nimport inspect\n\nimport numpy as np\n\nfrom astropy.cosmology.connect import convert_registry\nfrom astropy.cosmology.core import _COSMOLOGY_CLASSES, Cosmology\nfrom astropy.modeling import FittableModel, Model\nfrom astropy.modeling import Parameter as ModelParameter\nfrom astropy.utils.decorators import classproperty\n\nfrom .utils import convert_parameter_to_model_parameter\n\n__all__ = []  # nothing is publicly scoped\n\n\nclass _CosmologyModel(FittableModel):\n    \"\"\"Base class for Cosmology redshift-method Models.\n\n    .. note::\n\n        This class is not publicly scoped so should not be used directly.\n        Instead, from a Cosmology instance use ``.to_format(\"astropy.model\")``\n        to create an instance of a subclass of this class.\n\n    `_CosmologyModel` (subclasses) wrap a redshift-method of a\n    :class:`~astropy.cosmology.Cosmology` class, converting each non-`None`\n    |Cosmology| :class:`~astropy.cosmology.Parameter` to a\n    :class:`astropy.modeling.Model` :class:`~astropy.modeling.Parameter`\n    and the redshift-method to the model's ``__call__ / evaluate``.\n\n    See Also\n    --------\n    astropy.cosmology.Cosmology.to_format\n    \"\"\"\n\n    @abc.abstractmethod\n    def _cosmology_class(self):\n        \"\"\"Cosmology class as a private attribute. Set in subclasses.\"\"\"\n\n    @abc.abstractmethod\n    def _method_name(self):\n        \"\"\"Cosmology method name as a private attribute. Set in subclasses.\"\"\"\n\n    @classproperty\n    def cosmology_class(cls):\n        \"\"\"|Cosmology| class.\"\"\"\n        return cls._cosmology_class\n\n    @property\n    def cosmology(self):\n        \"\"\"Return |Cosmology| using `~astropy.modeling.Parameter` values.\"\"\"\n        cosmo = self._cosmology_class(\n            name=self.name,\n            **{k: (v.value if not (v := getattr(self, k)).unit else v.quantity)\n               for k in self.param_names})\n        return cosmo\n\n    @classproperty\n    def method_name(self):\n        \"\"\"Redshift-method name on |Cosmology| instance.\"\"\"\n        return self._method_name\n\n    # ---------------------------------------------------------------\n\n    def evaluate(self, *args, **kwargs):\n        \"\"\"Evaluate method {method!r} of {cosmo_cls!r} Cosmology.\n\n        The Model wraps the :class:`~astropy.cosmology.Cosmology` method,\n        converting each |Cosmology| :class:`~astropy.cosmology.Parameter` to a\n        :class:`astropy.modeling.Model` :class:`~astropy.modeling.Parameter`\n        (unless the Parameter is None, in which case it is skipped).\n        Here an instance of the cosmology is created using the current\n        Parameter values and the method is evaluated given the input.\n\n        Parameters\n        ----------\n        *args, **kwargs\n            The first ``n_inputs`` of ``*args`` are for evaluating the method\n            of the cosmology. The remaining args and kwargs are passed to the\n            cosmology class constructor.\n            Any unspecified Cosmology Parameter use the current value of the\n            corresponding Model Parameter.\n\n        Returns\n        -------\n        Any\n            Results of evaluating the Cosmology method.\n        \"\"\"\n        # create BoundArgument with all available inputs beyond the Parameters,\n        # which will be filled in next\n        ba = self.cosmology_class._init_signature.bind_partial(*args[self.n_inputs:], **kwargs)\n\n        # fill in missing Parameters\n        for k in self.param_names:\n            if k not in ba.arguments:\n                v = getattr(self, k)\n                ba.arguments[k] = v.value if not v.unit else v.quantity\n\n            # unvectorize, since Cosmology is not vectorized\n            # TODO! remove when vectorized\n            if np.shape(ba.arguments[k]):  # only in __call__\n                # m_nu is a special case  # TODO! fix by making it 'structured'\n                if k == \"m_nu\" and len(ba.arguments[k].shape) == 1:\n                    continue\n                ba.arguments[k] = ba.arguments[k][0]\n\n        # make instance of cosmology\n        cosmo = self._cosmology_class(**ba.arguments)\n        # evaluate method\n        result = getattr(cosmo, self._method_name)(*args[:self.n_inputs])\n\n        return result\n\n\n##############################################################################\n\n\ndef from_model(model):\n    \"\"\"Load |Cosmology| from `~astropy.modeling.Model` object.\n\n    Parameters\n    ----------\n    model : `_CosmologyModel` subclass instance\n        See ``Cosmology.to_format.help(\"astropy.model\") for details.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n\n    Examples\n    --------\n    >>> from astropy.cosmology import Cosmology, Planck18\n    >>> model = Planck18.to_format(\"astropy.model\", method=\"lookback_time\")\n    >>> Cosmology.from_format(model)\n    FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                  Tcmb0=2.7255 K, Neff=3.046, m_nu=[0. 0. 0.06] eV, Ob0=0.04897)\n    \"\"\"\n    cosmology = model.cosmology_class\n    meta = copy.deepcopy(model.meta)\n\n    # assemble the Parameters\n    params = {}\n    for n in model.param_names:\n        p = getattr(model, n)\n        params[p.name] = p.quantity if p.unit else p.value\n        # put all attributes in a dict\n        meta[p.name] = {n: getattr(p, n) for n in dir(p)\n                        if not (n.startswith(\"_\") or callable(getattr(p, n)))}\n\n    ba = cosmology._init_signature.bind(name=model.name, **params, meta=meta)\n    return cosmology(*ba.args, **ba.kwargs)\n\n\ndef to_model(cosmology, *_, method):\n    \"\"\"Convert a `~astropy.cosmology.Cosmology` to a `~astropy.modeling.Model`.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    method : str, keyword-only\n        The name of the method on the ``cosmology``.\n\n    Returns\n    -------\n    `_CosmologyModel` subclass instance\n        The Model wraps the |Cosmology| method, converting each non-`None`\n        :class:`~astropy.cosmology.Parameter` to a\n        :class:`astropy.modeling.Model` :class:`~astropy.modeling.Parameter`\n        and the method to the model's ``__call__ / evaluate``.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import Planck18\n    >>> model = Planck18.to_format(\"astropy.model\", method=\"lookback_time\")\n    >>> model\n    <FlatLambdaCDMCosmologyLookbackTimeModel(H0=67.66 km / (Mpc s), Om0=0.30966,\n        Tcmb0=2.7255 K, Neff=3.046, m_nu=[0.  , 0.  , 0.06] eV, Ob0=0.04897,\n        name='Planck18')>\n    \"\"\"\n    cosmo_cls = cosmology.__class__\n\n    # get bound method & sig from cosmology (unbound if class).\n    if not hasattr(cosmology, method):\n        raise AttributeError(f\"{method} is not a method on {cosmology.__class__}.\")\n    func = getattr(cosmology, method)\n    if not callable(func):\n        raise ValueError(f\"{cosmology.__class__}.{method} is not callable.\")\n    msig = inspect.signature(func)\n\n    # introspect for number of positional inputs, ignoring \"self\"\n    n_inputs = len([p for p in tuple(msig.parameters.values()) if (p.kind in (0, 1))])\n\n    attrs = {}  # class attributes\n    attrs[\"_cosmology_class\"] = cosmo_cls\n    attrs[\"_method_name\"] = method\n    attrs[\"n_inputs\"] = n_inputs\n    attrs[\"n_outputs\"] = 1\n\n    params = {}  # Parameters (also class attributes)\n    for n in cosmology.__parameters__:\n        v = getattr(cosmology, n)  # parameter value\n\n        if v is None:  # skip unspecified parameters\n            continue\n\n        # add as Model Parameter\n        params[n] = convert_parameter_to_model_parameter(getattr(cosmo_cls, n), v,\n                                                         cosmology.meta.get(n))\n\n    # class name is cosmology name + Cosmology + method name + Model\n    clsname = (cosmo_cls.__qualname__.replace(\".\", \"_\")\n               + \"Cosmology\"\n               + method.replace(\"_\", \" \").title().replace(\" \", \"\")\n               + \"Model\")\n\n    # make Model class\n    CosmoModel = type(clsname, (_CosmologyModel, ), {**attrs, **params})\n    # override __signature__ and format the doc.\n    setattr(CosmoModel.evaluate, \"__signature__\", msig)\n    CosmoModel.evaluate.__doc__ = CosmoModel.evaluate.__doc__.format(\n        cosmo_cls=cosmo_cls.__qualname__, method=method)\n\n    # instantiate class using default values\n    ps = {n: getattr(cosmology, n) for n in params.keys()}\n    model = CosmoModel(**ps, name=cosmology.name, meta=copy.deepcopy(cosmology.meta))\n\n    return model\n\n\ndef model_identify(origin, format, *args, **kwargs):\n    \"\"\"Identify if object uses the :class:`~astropy.modeling.Model` format.\n\n    Returns\n    -------\n    bool\n    \"\"\"\n    itis = False\n    if origin == \"read\":\n        itis = isinstance(args[1], Model) and (format in (None, \"astropy.model\"))\n\n    return itis\n\n\n# ===================================================================\n# Register\n\nconvert_registry.register_reader(\"astropy.model\", Cosmology, from_model)\nconvert_registry.register_writer(\"astropy.model\", Cosmology, to_model)\nconvert_registry.register_identifier(\"astropy.model\", Cosmology, model_identify)\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":1622,"id":14173,"name":"_ap_coeff","nodeType":"Attribute","startLoc":1622,"text":"self._ap_coeff"},{"fileName":"__init__.py","filePath":"astropy/cosmology/io","id":14174,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nRead/Write/Interchange methods for `astropy.cosmology`. **NOT public API**.\n\"\"\"\n\n# Import to register with the I/O machinery\nfrom . import ecsv, mapping, model, row, table, yaml  # noqa: F403\n"},{"col":0,"comment":"","endLoc":6,"header":"__init__.py#<anonymous>","id":14175,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nRead/Write/Interchange methods for `astropy.cosmology`. **NOT public API**.\n\"\"\""},{"className":"InverseSIP","col":0,"comment":"\n    Inverse Simple Imaging Polynomial\n\n    Parameters\n    ----------\n    ap_order : int\n        order for the inverse transformation (AP coefficients)\n    bp_order : int\n        order for the inverse transformation (BP coefficients)\n    ap_coeff : dict\n        coefficients for the inverse transform\n    bp_coeff : dict\n        coefficients for the inverse transform\n\n    ","endLoc":1724,"id":14176,"nodeType":"Class","startLoc":1663,"text":"class InverseSIP(Model):\n    \"\"\"\n    Inverse Simple Imaging Polynomial\n\n    Parameters\n    ----------\n    ap_order : int\n        order for the inverse transformation (AP coefficients)\n    bp_order : int\n        order for the inverse transformation (BP coefficients)\n    ap_coeff : dict\n        coefficients for the inverse transform\n    bp_coeff : dict\n        coefficients for the inverse transform\n\n    \"\"\"\n\n    n_inputs = 2\n    n_outputs = 2\n\n    _separable = False\n\n    def __init__(self, ap_order, bp_order, ap_coeff={}, bp_coeff={},\n                 n_models=None, model_set_axis=None, name=None, meta=None):\n        self._ap_order = ap_order\n        self._bp_order = bp_order\n        self._ap_coeff = ap_coeff\n        self._bp_coeff = bp_coeff\n\n        # define the 0th term in order to use Polynomial2D\n        ap_coeff.setdefault('AP_0_0', 0)\n        bp_coeff.setdefault('BP_0_0', 0)\n\n        ap_coeff_params = dict((k.replace('AP_', 'c'), v)\n                               for k, v in ap_coeff.items())\n        bp_coeff_params = dict((k.replace('BP_', 'c'), v)\n                               for k, v in bp_coeff.items())\n\n        self.sip1d_ap = Polynomial2D(degree=ap_order,\n                                     model_set_axis=model_set_axis,\n                                     **ap_coeff_params)\n        self.sip1d_bp = Polynomial2D(degree=bp_order,\n                                     model_set_axis=model_set_axis,\n                                     **bp_coeff_params)\n        super().__init__(n_models=n_models, model_set_axis=model_set_axis,\n                         name=name, meta=meta)\n\n    def __repr__(self):\n        return f'<{self.__class__.__name__}({[self.sip1d_ap, self.sip1d_bp]!r})>'\n\n    def __str__(self):\n        parts = [f'Model: {self.__class__.__name__}']\n        for model in [self.sip1d_ap, self.sip1d_bp]:\n            parts.append(indent(str(model), width=4))\n            parts.append('')\n\n        return '\\n'.join(parts)\n\n    def evaluate(self, x, y):\n        x1 = self.sip1d_ap.evaluate(x, y, *self.sip1d_ap.param_sets)\n        y1 = self.sip1d_bp.evaluate(x, y, *self.sip1d_bp.param_sets)\n        return x1, y1"},{"col":4,"comment":"null","endLoc":1711,"header":"def __repr__(self)","id":14177,"name":"__repr__","nodeType":"Function","startLoc":1710,"text":"def __repr__(self):\n        return f'<{self.__class__.__name__}({[self.sip1d_ap, self.sip1d_bp]!r})>'"},{"col":4,"comment":"null","endLoc":1719,"header":"def __str__(self)","id":14178,"name":"__str__","nodeType":"Function","startLoc":1713,"text":"def __str__(self):\n        parts = [f'Model: {self.__class__.__name__}']\n        for model in [self.sip1d_ap, self.sip1d_bp]:\n            parts.append(indent(str(model), width=4))\n            parts.append('')\n\n        return '\\n'.join(parts)"},{"col":4,"comment":"null","endLoc":1724,"header":"def evaluate(self, x, y)","id":14179,"name":"evaluate","nodeType":"Function","startLoc":1721,"text":"def evaluate(self, x, y):\n        x1 = self.sip1d_ap.evaluate(x, y, *self.sip1d_ap.param_sets)\n        y1 = self.sip1d_bp.evaluate(x, y, *self.sip1d_bp.param_sets)\n        return x1, y1"},{"col":0,"comment":"Convert a |Cosmology| Parameter to a Table |Column|.\n\n    Parameters\n    ----------\n    parameter : `astropy.cosmology.parameter.Parameter`\n    value : Any\n    meta : dict or None, optional\n        Information from the Cosmology's metadata.\n\n    Returns\n    -------\n    `astropy.table.Column`\n    ","endLoc":34,"header":"def convert_parameter_to_column(parameter, value, meta=None)","id":14180,"name":"convert_parameter_to_column","nodeType":"Function","startLoc":10,"text":"def convert_parameter_to_column(parameter, value, meta=None):\n    \"\"\"Convert a |Cosmology| Parameter to a Table |Column|.\n\n    Parameters\n    ----------\n    parameter : `astropy.cosmology.parameter.Parameter`\n    value : Any\n    meta : dict or None, optional\n        Information from the Cosmology's metadata.\n\n    Returns\n    -------\n    `astropy.table.Column`\n    \"\"\"\n    format = None if value is None else parameter.format_spec\n    shape = (1,) + np.shape(value)  # minimum of 1d\n\n    col = Column(data=np.reshape(value, shape),\n                 name=parameter.name,\n                 dtype=None,  # inferred from the data\n                 description=parameter.__doc__,\n                 format=format,\n                 meta=meta)\n\n    return col"},{"col":0,"comment":"Convert a Cosmology Parameter to a Model Parameter.\n\n    Parameters\n    ----------\n    parameter : `astropy.cosmology.parameter.Parameter`\n    value : Any\n    meta : dict or None, optional\n        Information from the Cosmology's metadata.\n        This function will use any of: 'getter', 'setter', 'fixed', 'tied',\n        'min', 'max', 'bounds', 'prior', 'posterior'.\n\n    Returns\n    -------\n    `astropy.modeling.Parameter`\n    ","endLoc":61,"header":"def convert_parameter_to_model_parameter(parameter, value, meta=None)","id":14181,"name":"convert_parameter_to_model_parameter","nodeType":"Function","startLoc":37,"text":"def convert_parameter_to_model_parameter(parameter, value, meta=None):\n    \"\"\"Convert a Cosmology Parameter to a Model Parameter.\n\n    Parameters\n    ----------\n    parameter : `astropy.cosmology.parameter.Parameter`\n    value : Any\n    meta : dict or None, optional\n        Information from the Cosmology's metadata.\n        This function will use any of: 'getter', 'setter', 'fixed', 'tied',\n        'min', 'max', 'bounds', 'prior', 'posterior'.\n\n    Returns\n    -------\n    `astropy.modeling.Parameter`\n    \"\"\"\n    # Get from meta information relavant to Model\n    extra = {k: v for k, v in (meta or {}).items()\n             if k in ('getter', 'setter', 'fixed', 'tied', 'min', 'max',\n                      'bounds', 'prior', 'posterior')}\n\n    return ModelParameter(description=parameter.__doc__,\n                          default=value,\n                          unit=getattr(value, \"unit\", None),\n                          **extra)"},{"fileName":"utils.py","filePath":"astropy/cosmology/io","id":14182,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport numpy as np\n\nfrom astropy.cosmology.parameter import Parameter\nfrom astropy.table import Column\nfrom astropy.modeling import Parameter as ModelParameter\n\n\ndef convert_parameter_to_column(parameter, value, meta=None):\n    \"\"\"Convert a |Cosmology| Parameter to a Table |Column|.\n\n    Parameters\n    ----------\n    parameter : `astropy.cosmology.parameter.Parameter`\n    value : Any\n    meta : dict or None, optional\n        Information from the Cosmology's metadata.\n\n    Returns\n    -------\n    `astropy.table.Column`\n    \"\"\"\n    format = None if value is None else parameter.format_spec\n    shape = (1,) + np.shape(value)  # minimum of 1d\n\n    col = Column(data=np.reshape(value, shape),\n                 name=parameter.name,\n                 dtype=None,  # inferred from the data\n                 description=parameter.__doc__,\n                 format=format,\n                 meta=meta)\n\n    return col\n\n\ndef convert_parameter_to_model_parameter(parameter, value, meta=None):\n    \"\"\"Convert a Cosmology Parameter to a Model Parameter.\n\n    Parameters\n    ----------\n    parameter : `astropy.cosmology.parameter.Parameter`\n    value : Any\n    meta : dict or None, optional\n        Information from the Cosmology's metadata.\n        This function will use any of: 'getter', 'setter', 'fixed', 'tied',\n        'min', 'max', 'bounds', 'prior', 'posterior'.\n\n    Returns\n    -------\n    `astropy.modeling.Parameter`\n    \"\"\"\n    # Get from meta information relavant to Model\n    extra = {k: v for k, v in (meta or {}).items()\n             if k in ('getter', 'setter', 'fixed', 'tied', 'min', 'max',\n                      'bounds', 'prior', 'posterior')}\n\n    return ModelParameter(description=parameter.__doc__,\n                          default=value,\n                          unit=getattr(value, \"unit\", None),\n                          **extra)\n"},{"fileName":"table.py","filePath":"astropy/cosmology/io","id":14183,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport copy\n\nimport numpy as np\n\nfrom astropy.cosmology.connect import convert_registry\nfrom astropy.cosmology.core import Cosmology\nfrom astropy.table import QTable, Table, Column\n\nfrom .mapping import to_mapping\nfrom .row import from_row\nfrom .utils import convert_parameter_to_column\n\n\ndef from_table(table, index=None, *, move_to_meta=False, cosmology=None):\n    \"\"\"Instantiate a `~astropy.cosmology.Cosmology` from a |QTable|.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        The object to parse into a |Cosmology|.\n    index : int, str, or None, optional\n        Needed to select the row in tables with multiple rows. ``index`` can be\n        an integer for the row number or, if the table is indexed by a column,\n        the value of that column. If the table is not indexed and ``index``\n        is a string, the \"name\" column is used as the indexing column.\n\n    move_to_meta : bool (optional, keyword-only)\n        Whether to move keyword arguments that are not in the Cosmology class'\n        signature to the Cosmology's metadata. This will only be applied if the\n        Cosmology does NOT have a keyword-only argument (e.g. ``**kwargs``).\n        Arguments moved to the metadata will be merged with existing metadata,\n        preferring specified metadata in the case of a merge conflict\n        (e.g. for ``Cosmology(meta={'key':10}, key=42)``, the ``Cosmology.meta``\n        will be ``{'key': 10}``).\n\n    cosmology : str, `~astropy.cosmology.Cosmology` class, or None (optional, keyword-only)\n        The cosmology class (or string name thereof) to use when constructing\n        the cosmology instance. The class also provides default parameter values,\n        filling in any non-mandatory arguments missing in 'table'.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n\n    Examples\n    --------\n    To see loading a `~astropy.cosmology.Cosmology` from a Table with\n    ``from_table``, we will first make a |QTable| using\n    :func:`~astropy.cosmology.Cosmology.to_format`.\n\n        >>> from astropy.cosmology import Cosmology, Planck18\n        >>> ct = Planck18.to_format(\"astropy.table\")\n        >>> ct\n        <QTable length=1>\n          name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                 km / (Mpc s)            K                 eV\n          str8     float64    float64 float64 float64   float64   float64\n        -------- ------------ ------- ------- ------- ----------- -------\n        Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\n    Now this table can be used to load a new cosmological instance identical\n    to the ``Planck18`` cosmology from which it was generated.\n\n        >>> cosmo = Cosmology.from_format(ct, format=\"astropy.table\")\n        >>> cosmo\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                      Tcmb0=2.7255 K, Neff=3.046, m_nu=[0. 0. 0.06] eV, Ob0=0.04897)\n\n    Specific cosmology classes can be used to parse the data. The class'\n    default parameter values are used to fill in any information missing in the\n    data.\n\n        >>> from astropy.cosmology import FlatLambdaCDM\n        >>> del ct[\"Tcmb0\"]  # show FlatLambdaCDM provides default\n        >>> FlatLambdaCDM.from_format(ct)\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                      Tcmb0=0.0 K, Neff=3.046, m_nu=None, Ob0=0.04897)\n\n    For tables with multiple rows of cosmological parameters, the ``index``\n    argument is needed to select the correct row. The index can be an integer\n    for the row number or, if the table is indexed by a column, the value of\n    that column. If the table is not indexed and ``index`` is a string, the\n    \"name\" column is used as the indexing column.\n\n    Here is an example where ``index`` is needed and can be either an integer\n    (for the row number) or the name of one of the cosmologies, e.g. 'Planck15'.\n\n        >>> from astropy.cosmology import Planck13, Planck15, Planck18\n        >>> from astropy.table import vstack\n        >>> cts = vstack([c.to_format(\"astropy.table\")\n        ...               for c in (Planck13, Planck15, Planck18)],\n        ...              metadata_conflicts='silent')\n        >>> cts\n        <QTable length=3>\n          name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                 km / (Mpc s)            K                 eV\n          str8     float64    float64 float64 float64   float64   float64\n        -------- ------------ ------- ------- ------- ----------- --------\n        Planck13        67.77 0.30712  2.7255   3.046 0.0 .. 0.06 0.048252\n        Planck15        67.74  0.3075  2.7255   3.046 0.0 .. 0.06   0.0486\n        Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06  0.04897\n\n        >>> cosmo = Cosmology.from_format(cts, index=1, format=\"astropy.table\")\n        >>> cosmo == Planck15\n        True\n\n    For further examples, see :doc:`astropy:cosmology/io`.\n    \"\"\"\n    # Get row from table\n    # string index uses the indexed column on the table to find the row index.\n    if isinstance(index, str):\n        if not table.indices:  # no indexing column, find by string match\n            indices = np.where(table['name'] == index)[0]\n        else:  # has indexing column\n            indices = table.loc_indices[index]  # need to convert to row index (int)\n\n        if isinstance(indices, (int, np.integer)):  # loc_indices\n            index = indices\n        elif len(indices) == 1:  # only happens w/ np.where\n            index = indices[0]\n        elif len(indices) == 0:  # matches from loc_indices\n            raise KeyError(f\"No matches found for key {indices}\")\n        else:  # like the Highlander, there can be only 1 Cosmology\n            raise ValueError(f\"more than one cosmology found for key {indices}\")\n\n    # no index is needed for a 1-row table. For a multi-row table...\n    if index is None:\n        if len(table) != 1:  # multi-row table and no index\n            raise ValueError(\"need to select a specific row (e.g. index=1) when \"\n                             \"constructing a Cosmology from a multi-row table.\")\n        else:  # single-row table\n            index = 0\n    row = table[index]  # index is now the row index (int)\n\n    # parse row to cosmo\n    return from_row(row, move_to_meta=move_to_meta, cosmology=cosmology)\n\n\ndef to_table(cosmology, *args, cls=QTable, cosmology_in_meta=True):\n    \"\"\"Serialize the cosmology into a `~astropy.table.QTable`.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    *args\n        Not used. Needed for compatibility with\n        `~astropy.io.registry.UnifiedReadWriteMethod`\n    cls : type (optional, keyword-only)\n        Astropy :class:`~astropy.table.Table` class or subclass type to return.\n        Default is :class:`~astropy.table.QTable`.\n    cosmology_in_meta : bool\n        Whether to put the cosmology class in the Table metadata (if `True`,\n        default) or as the first column (if `False`).\n\n    Returns\n    -------\n    `~astropy.table.QTable`\n        With columns for the cosmology parameters, and metadata and\n        cosmology class name in the Table's ``meta`` attribute\n\n    Raises\n    ------\n    TypeError\n        If kwarg (optional) 'cls' is not a subclass of `astropy.table.Table`\n\n    Examples\n    --------\n    A Cosmology as a `~astropy.table.QTable` will have the cosmology's name and\n    parameters as columns.\n\n        >>> from astropy.cosmology import Planck18\n        >>> ct = Planck18.to_format(\"astropy.table\")\n        >>> ct\n        <QTable length=1>\n          name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                 km / (Mpc s)            K                 eV\n          str8     float64    float64 float64 float64   float64   float64\n        -------- ------------ ------- ------- ------- ----------- -------\n        Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\n    The cosmological class and other metadata, e.g. a paper reference, are in\n    the Table's metadata.\n\n        >>> ct.meta\n        OrderedDict([..., ('cosmology', 'FlatLambdaCDM')])\n\n    To move the cosmology class from the metadata to a Table row, set the\n    ``cosmology_in_meta`` argument to `False`:\n\n        >>> Planck18.to_format(\"astropy.table\", cosmology_in_meta=False)\n        <QTable length=1>\n          cosmology     name        H0        Om0    Tcmb0    Neff    m_nu [3]    Ob0\n                               km / (Mpc s)            K                 eV\n            str13       str8     float64    float64 float64 float64   float64   float64\n        ------------- -------- ------------ ------- ------- ------- ----------- -------\n        FlatLambdaCDM Planck18        67.66 0.30966  2.7255   3.046 0.0 .. 0.06 0.04897\n\n    Astropy recommends `~astropy.table.QTable` for tables with\n    `~astropy.units.Quantity` columns. However the returned type may be\n    overridden using the ``cls`` argument:\n\n        >>> from astropy.table import Table\n        >>> Planck18.to_format(\"astropy.table\", cls=Table)\n        <Table length=1>\n        ...\n    \"\"\"\n    if not issubclass(cls, Table):\n        raise TypeError(f\"'cls' must be a (sub)class of Table, not {type(cls)}\")\n\n    # Start by getting a map representation.\n    data = to_mapping(cosmology)\n    data[\"cosmology\"] = data[\"cosmology\"].__qualname__  # change to str\n\n    # Metadata\n    meta = data.pop(\"meta\")  # remove the meta\n    if cosmology_in_meta:\n        meta[\"cosmology\"] = data.pop(\"cosmology\")\n\n    # Need to turn everything into something Table can process:\n    # - Column for Parameter\n    # - list for anything else\n    cosmo_cls = cosmology.__class__\n    for k, v in data.items():\n        if k in cosmology.__parameters__:\n            col = convert_parameter_to_column(getattr(cosmo_cls, k), v,\n                                              cosmology.meta.get(k))\n        else:\n            col = Column([v])\n        data[k] = col\n\n    tbl = cls(data, meta=meta)\n    tbl.add_index(\"name\", unique=True)\n    return tbl\n\n\ndef table_identify(origin, format, *args, **kwargs):\n    \"\"\"Identify if object uses the Table format.\n\n    Returns\n    -------\n    bool\n    \"\"\"\n    itis = False\n    if origin == \"read\":\n        itis = isinstance(args[1], Table) and (format in (None, \"astropy.table\"))\n    return itis\n\n\n# ===================================================================\n# Register\n\nconvert_registry.register_reader(\"astropy.table\", Cosmology, from_table)\nconvert_registry.register_writer(\"astropy.table\", Cosmology, to_table)\nconvert_registry.register_identifier(\"astropy.table\", Cosmology, table_identify)\n"},{"col":0,"comment":"Identify if object uses the Table format.\n\n    Returns\n    -------\n    bool\n    ","endLoc":248,"header":"def table_identify(origin, format, *args, **kwargs)","id":14184,"name":"table_identify","nodeType":"Function","startLoc":238,"text":"def table_identify(origin, format, *args, **kwargs):\n    \"\"\"Identify if object uses the Table format.\n\n    Returns\n    -------\n    bool\n    \"\"\"\n    itis = False\n    if origin == \"read\":\n        itis = isinstance(args[1], Table) and (format in (None, \"astropy.table\"))\n    return itis"},{"col":0,"comment":"","endLoc":3,"header":"table.py#<anonymous>","id":14185,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"convert_registry.register_reader(\"astropy.table\", Cosmology, from_table)\n\nconvert_registry.register_writer(\"astropy.table\", Cosmology, to_table)\n\nconvert_registry.register_identifier(\"astropy.table\", Cosmology, table_identify)"},{"fileName":"mapping.py","filePath":"astropy/cosmology/io","id":14186,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThe following are private functions, included here **FOR REFERENCE ONLY** since\nthe io registry cannot be displayed. These functions are registered into\n:meth:`~astropy.cosmology.Cosmology.to_format` and\n:meth:`~astropy.cosmology.Cosmology.from_format` and should only be accessed\nvia these methods.\n\"\"\"  # this is shown in the docs.\n\nimport copy\nfrom collections.abc import Mapping\n\nimport numpy as np\n\nfrom astropy.cosmology.core import _COSMOLOGY_CLASSES, Cosmology\nfrom astropy.cosmology.connect import convert_registry\n\n__all__ = []  # nothing is publicly scoped\n\n\ndef from_mapping(map, *, move_to_meta=False, cosmology=None):\n    \"\"\"Load `~astropy.cosmology.Cosmology` from mapping object.\n\n    Parameters\n    ----------\n    map : mapping\n        Arguments into the class -- like \"name\" or \"meta\".\n        If 'cosmology' is None, must have field \"cosmology\" which can be either\n        the string name of the cosmology class (e.g. \"FlatLambdaCDM\") or the\n        class itself.\n\n    move_to_meta : bool (optional, keyword-only)\n        Whether to move keyword arguments that are not in the Cosmology class'\n        signature to the Cosmology's metadata. This will only be applied if the\n        Cosmology does NOT have a keyword-only argument (e.g. ``**kwargs``).\n        Arguments moved to the metadata will be merged with existing metadata,\n        preferring specified metadata in the case of a merge conflict\n        (e.g. for ``Cosmology(meta={'key':10}, key=42)``, the ``Cosmology.meta``\n        will be ``{'key': 10}``).\n\n    cosmology : str, `~astropy.cosmology.Cosmology` class, or None (optional, keyword-only)\n        The cosmology class (or string name thereof) to use when constructing\n        the cosmology instance. The class also provides default parameter values,\n        filling in any non-mandatory arguments missing in 'map'.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n\n    Examples\n    --------\n    To see loading a `~astropy.cosmology.Cosmology` from a dictionary with\n    ``from_mapping``, we will first make a mapping using\n    :meth:`~astropy.cosmology.Cosmology.to_format`.\n\n        >>> from astropy.cosmology import Cosmology, Planck18\n        >>> cm = Planck18.to_format('mapping')\n        >>> cm\n        {'cosmology': <class 'astropy.cosmology.flrw.FlatLambdaCDM'>,\n         'name': 'Planck18', 'H0': <Quantity 67.66 km / (Mpc s)>, 'Om0': 0.30966,\n         'Tcmb0': <Quantity 2.7255 K>, 'Neff': 3.046,\n         'm_nu': <Quantity [0. , 0. , 0.06] eV>, 'Ob0': 0.04897,\n         'meta': ...\n\n    Now this dict can be used to load a new cosmological instance identical\n    to the ``Planck18`` cosmology from which it was generated.\n\n        >>> cosmo = Cosmology.from_format(cm, format=\"mapping\")\n        >>> cosmo\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                      Tcmb0=2.7255 K, Neff=3.046, m_nu=[0. 0. 0.06] eV, Ob0=0.04897)\n\n    Specific cosmology classes can be used to parse the data. The class'\n    default parameter values are used to fill in any information missing in the\n    data.\n\n        >>> from astropy.cosmology import FlatLambdaCDM\n        >>> del cm[\"Tcmb0\"]  # show FlatLambdaCDM provides default\n        >>> FlatLambdaCDM.from_format(cm)\n        FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                      Tcmb0=0.0 K, Neff=3.046, m_nu=None, Ob0=0.04897)\n    \"\"\"\n    params = dict(map)  # so we are guaranteed to have a poppable map\n\n    # get cosmology\n    # 1st from argument. Allows for override of the cosmology, if on file.\n    # 2nd from params. This MUST have the cosmology if 'kwargs' did not.\n    if cosmology is None:\n        cosmology = params.pop(\"cosmology\")\n    else:\n        params.pop(\"cosmology\", None)  # pop, but don't use\n    # if string, parse to class\n    if isinstance(cosmology, str):\n        cosmology = _COSMOLOGY_CLASSES[cosmology]\n\n    # select arguments from mapping that are in the cosmo's signature.\n    ba = cosmology._init_signature.bind_partial()  # blank set of args\n    ba.apply_defaults()  # fill in the defaults\n    for k in cosmology._init_signature.parameters.keys():\n        if k in params:  # transfer argument, if in params\n            ba.arguments[k] = params.pop(k)\n\n    # deal with remaining params. If there is a **kwargs use that, else\n    # allow to transfer to metadata. Raise TypeError if can't.\n    lastp = tuple(cosmology._init_signature.parameters.values())[-1]\n    if lastp.kind == 4:  # variable keyword-only\n        ba.arguments[lastp.name] = params\n    elif move_to_meta:  # prefers current meta, which was explicitly set\n        meta = ba.arguments[\"meta\"] or {}  # (None -> dict)\n        ba.arguments[\"meta\"] = {**params, **meta}\n    elif params:\n        raise TypeError(f\"there are unused parameters {params}.\")\n    # else: pass  # no kwargs, no move-to-meta, and all the params are used\n\n    return cosmology(*ba.args, **ba.kwargs)\n\n\ndef to_mapping(cosmology, *args, cls=dict, cosmology_as_str=False, move_from_meta=False):\n    \"\"\"Return the cosmology class, parameters, and metadata as a `dict`.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    *args\n        Not used. Needed for compatibility with\n        `~astropy.io.registry.UnifiedReadWriteMethod`\n    cls : type (optional, keyword-only)\n        `dict` or `collections.Mapping` subclass.\n        The mapping type to return. Default is `dict`.\n    cosmology_as_str : bool (optional, keyword-only)\n        Whether the cosmology value is the class (if `False`, default) or\n        the semi-qualified name (if `True`).\n    move_from_meta : bool (optional, keyword-only)\n        Whether to add the Cosmology's metadata as an item to the mapping (if\n        `False`, default) or to merge with the rest of the mapping, preferring\n        the original values (if `True`)\n\n    Returns\n    -------\n    dict\n        with key-values for the cosmology parameters and also:\n        - 'cosmology' : the class\n        - 'meta' : the contents of the cosmology's metadata attribute.\n                   If ``move_from_meta`` is `True`, this key is missing and the\n                   contained metadata are added to the main `dict`.\n\n    Examples\n    --------\n    A Cosmology as a mapping will have the cosmology's name and\n    parameters as items, and the metadata as a nested dictionary.\n\n        >>> from astropy.cosmology import Planck18\n        >>> Planck18.to_format('mapping')\n        {'cosmology': <class 'astropy.cosmology.flrw.FlatLambdaCDM'>,\n         'name': 'Planck18', 'H0': <Quantity 67.66 km / (Mpc s)>, 'Om0': 0.30966,\n         'Tcmb0': <Quantity 2.7255 K>, 'Neff': 3.046,\n         'm_nu': <Quantity [0.  , 0.  , 0.06] eV>, 'Ob0': 0.04897,\n         'meta': ...\n\n    The dictionary type may be changed with the ``cls`` keyword argument:\n\n        >>> from collections import OrderedDict\n        >>> Planck18.to_format('mapping', cls=OrderedDict)\n        OrderedDict([('cosmology', <class 'astropy.cosmology.flrw.FlatLambdaCDM'>),\n          ('name', 'Planck18'), ('H0', <Quantity 67.66 km / (Mpc s)>),\n          ('Om0', 0.30966), ('Tcmb0', <Quantity 2.7255 K>), ('Neff', 3.046),\n          ('m_nu', <Quantity [0.  , 0.  , 0.06] eV>), ('Ob0', 0.04897),\n          ('meta', ...\n\n    Sometimes it is more useful to have the name of the cosmology class, not\n    the object itself. The keyword argument ``cosmology_as_str`` may be used:\n\n        >>> Planck18.to_format('mapping', cosmology_as_str=True)\n        {'cosmology': 'FlatLambdaCDM', ...\n\n    The metadata is normally included as a nested mapping. To move the metadata\n    into the main mapping, use the keyword argument ``move_from_meta``. This\n    kwarg inverts ``move_to_meta`` in\n    ``Cosmology.to_format(\"mapping\", move_to_meta=...)`` where extra items\n    are moved to the metadata (if the cosmology constructor does not have a\n    variable keyword-only argument -- ``**kwargs``).\n\n        >>> from astropy.cosmology import Planck18\n        >>> Planck18.to_format('mapping', move_from_meta=True)\n        {'cosmology': <class 'astropy.cosmology.flrw.FlatLambdaCDM'>,\n         'name': 'Planck18', 'Oc0': 0.2607, 'n': 0.9665, 'sigma8': 0.8102, ...\n    \"\"\"\n    if not issubclass(cls, (dict, Mapping)):\n        raise TypeError(f\"'cls' must be a (sub)class of dict or Mapping, not {cls}\")\n\n    m = cls()\n    # start with the cosmology class & name\n    m[\"cosmology\"] = cosmology.__class__.__qualname__ if cosmology_as_str else cosmology.__class__\n    m[\"name\"] = cosmology.name  # here only for dict ordering\n\n    meta = copy.deepcopy(cosmology.meta)  # metadata (mutable)\n    if move_from_meta:\n        # Merge the mutable metadata. Since params are added later they will\n        # be preferred in cases of overlapping keys. Likewise, need to pop\n        # cosmology and name from meta.\n        meta.pop(\"cosmology\", None)\n        meta.pop(\"name\", None)\n        m.update(meta)\n\n    # Add all the immutable inputs\n    m.update({k: v for k, v in cosmology._init_arguments.items()\n              if k not in (\"meta\", \"name\")})\n    # Lastly, add the metadata, if haven't already (above)\n    if not move_from_meta:\n        m[\"meta\"] = meta  # TODO? should meta be type(cls)\n\n    return m\n\n\ndef mapping_identify(origin, format, *args, **kwargs):\n    \"\"\"Identify if object uses the mapping format.\n\n    Returns\n    -------\n    bool\n    \"\"\"\n    itis = False\n    if origin == \"read\":\n        itis = isinstance(args[1], Mapping) and (format in (None, \"mapping\"))\n    return itis\n\n\n# ===================================================================\n# Register\n\nconvert_registry.register_reader(\"mapping\", Cosmology, from_mapping)\nconvert_registry.register_writer(\"mapping\", Cosmology, to_mapping)\nconvert_registry.register_identifier(\"mapping\", Cosmology, mapping_identify)\n"},{"col":0,"comment":"Identify if object uses the mapping format.\n\n    Returns\n    -------\n    bool\n    ","endLoc":226,"header":"def mapping_identify(origin, format, *args, **kwargs)","id":14187,"name":"mapping_identify","nodeType":"Function","startLoc":216,"text":"def mapping_identify(origin, format, *args, **kwargs):\n    \"\"\"Identify if object uses the mapping format.\n\n    Returns\n    -------\n    bool\n    \"\"\"\n    itis = False\n    if origin == \"read\":\n        itis = isinstance(args[1], Mapping) and (format in (None, \"mapping\"))\n    return itis"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":14188,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"col":0,"comment":"","endLoc":9,"header":"mapping.py#<anonymous>","id":14189,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThe following are private functions, included here **FOR REFERENCE ONLY** since\nthe io registry cannot be displayed. These functions are registered into\n:meth:`~astropy.cosmology.Cosmology.to_format` and\n:meth:`~astropy.cosmology.Cosmology.from_format` and should only be accessed\nvia these methods.\n\"\"\"  # this is shown in the docs.\n\n__all__ = []  # nothing is publicly scoped\n\nconvert_registry.register_reader(\"mapping\", Cosmology, from_mapping)\n\nconvert_registry.register_writer(\"mapping\", Cosmology, to_mapping)\n\nconvert_registry.register_identifier(\"mapping\", Cosmology, mapping_identify)"},{"col":0,"comment":"null","endLoc":1667,"header":"@deprecated('5.1', 'private method: _fitter_to_model_params has been made public now')\ndef _fitter_to_model_params(model, fps)","id":14190,"name":"_fitter_to_model_params","nodeType":"Function","startLoc":1665,"text":"@deprecated('5.1', 'private method: _fitter_to_model_params has been made public now')\ndef _fitter_to_model_params(model, fps):\n    return fitter_to_model_params(model, fps)"},{"col":0,"comment":"null","endLoc":1695,"header":"@deprecated('5.1', 'private method: _model_to_fit_params has been made public now')\ndef _model_to_fit_params(model)","id":14191,"name":"_model_to_fit_params","nodeType":"Function","startLoc":1693,"text":"@deprecated('5.1', 'private method: _model_to_fit_params has been made public now')\ndef _model_to_fit_params(model):\n    return model_to_fit_params(model)"},{"id":14192,"name":"astropy/cosmology/io/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/cosmology/io/tests","id":14193,"nodeType":"File","text":""},{"col":0,"comment":"\n    This injects entry points into the `astropy.modeling.fitting` namespace.\n    This provides a means of inserting a fitting routine without requirement\n    of it being merged into astropy's core.\n\n    Parameters\n    ----------\n    entry_points : list of `~importlib.metadata.EntryPoint`\n        entry_points are objects which encapsulate importable objects and\n        are defined on the installation of a package.\n\n    Notes\n    -----\n    An explanation of entry points can be found `here <http://setuptools.readthedocs.io/en/latest/setuptools.html#dynamic-discovery-of-services-and-plugins>`\n    ","endLoc":1782,"header":"def populate_entry_points(entry_points)","id":14194,"name":"populate_entry_points","nodeType":"Function","startLoc":1745,"text":"def populate_entry_points(entry_points):\n    \"\"\"\n    This injects entry points into the `astropy.modeling.fitting` namespace.\n    This provides a means of inserting a fitting routine without requirement\n    of it being merged into astropy's core.\n\n    Parameters\n    ----------\n    entry_points : list of `~importlib.metadata.EntryPoint`\n        entry_points are objects which encapsulate importable objects and\n        are defined on the installation of a package.\n\n    Notes\n    -----\n    An explanation of entry points can be found `here <http://setuptools.readthedocs.io/en/latest/setuptools.html#dynamic-discovery-of-services-and-plugins>`\n    \"\"\"\n\n    for entry_point in entry_points:\n        name = entry_point.name\n        try:\n            entry_point = entry_point.load()\n        except Exception as e:\n            # This stops the fitting from choking if an entry_point produces an error.\n            warnings.warn(AstropyUserWarning(\n                f'{type(e).__name__} error occurred in entry point {name}.'))\n        else:\n            if not inspect.isclass(entry_point):\n                warnings.warn(AstropyUserWarning(\n                    f'Modeling entry point {name} expected to be a Class.'))\n            else:\n                if issubclass(entry_point, Fitter):\n                    name = entry_point.__name__\n                    globals()[name] = entry_point\n                    __all__.append(name)\n                else:\n                    warnings.warn(AstropyUserWarning(\n                        'Modeling entry point {} expected to extend '\n                        'astropy.modeling.Fitter' .format(name)))"},{"fileName":"base.py","filePath":"astropy/cosmology/io/tests","id":14195,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# THIRD PARTY\nimport pytest\n\n# LOCAL\nimport astropy.units as u\nfrom astropy.cosmology import Cosmology, Parameter, realizations\nfrom astropy.cosmology import units as cu\nfrom astropy.cosmology.core import _COSMOLOGY_CLASSES\nfrom astropy.cosmology.realizations import available\n\ncosmo_instances = [getattr(realizations, name) for name in available]\n\n\n##############################################################################\n\n\nclass IOTestBase:\n    \"\"\"Base class for Cosmology I/O tests.\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass. Subclasses must define a :func:`pytest.fixture`\n    ``cosmo`` that returns/yields an instance of a |Cosmology|.\n    See ``TestCosmology`` for an example.\n    \"\"\"\n\n\nclass ToFromTestMixinBase(IOTestBase):\n    \"\"\"Tests for a Cosmology[To/From]Format with some ``format``.\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass. Subclasses must define a :func:`pytest.fixture`\n    ``cosmo`` that returns/yields an instance of a |Cosmology|.\n    See ``TestCosmology`` for an example.\n    \"\"\"\n\n    @pytest.fixture(scope=\"class\")\n    def from_format(self):\n        \"\"\"Convert to Cosmology using ``Cosmology.from_format()``.\"\"\"\n        return Cosmology.from_format\n\n    @pytest.fixture(scope=\"class\")\n    def to_format(self, cosmo):\n        \"\"\"Convert Cosmology instance using ``.to_format()``.\"\"\"\n        return cosmo.to_format\n\n    def can_autodentify(self, format):\n        \"\"\"Check whether a format can auto-identify.\"\"\"\n        return format in Cosmology.from_format.registry._identifiers\n\n\nclass ReadWriteTestMixinBase(IOTestBase):\n    \"\"\"Tests for a Cosmology[Read/Write].\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass. Subclasses must define a :func:`pytest.fixture`\n    ``cosmo`` that returns/yields an instance of a |Cosmology|.\n    See ``TestCosmology`` for an example.\n    \"\"\"\n\n    @pytest.fixture(scope=\"class\")\n    def read(self):\n        \"\"\"Read Cosmology instance using ``Cosmology.read()``.\"\"\"\n        return Cosmology.read\n\n    @pytest.fixture(scope=\"class\")\n    def write(self, cosmo):\n        \"\"\"Write Cosmology using ``.write()``.\"\"\"\n        return cosmo.write\n\n    @pytest.fixture\n    def add_cu(self):\n        \"\"\"Add :mod:`astropy.cosmology.units` to the enabled units.\"\"\"\n        # TODO! autoenable 'cu' if cosmology is imported?\n        with u.add_enabled_units(cu):\n            yield\n\n\n##############################################################################\n\n\nclass IODirectTestBase(IOTestBase):\n    \"\"\"Directly test Cosmology I/O functions.\n\n    These functions are not public API and are discouraged from public use, in\n    favor of the I/O methods on |Cosmology|. They are tested b/c they are used\n    internally and because some tests for the methods on |Cosmology| don't need\n    to be run in the |Cosmology| class's large test matrix.\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass.\n    \"\"\"\n\n    @pytest.fixture(scope=\"class\", autouse=True)\n    def setup(self):\n        \"\"\"Setup and teardown for tests.\"\"\"\n\n        class CosmologyWithKwargs(Cosmology):\n            Tcmb0 = Parameter(unit=u.K)\n\n            def __init__(self, Tcmb0=0, name=\"cosmology with kwargs\", meta=None, **kwargs):\n                super().__init__(name=name, meta=meta)\n                self._Tcmb0 = Tcmb0 << u.K\n\n        yield  # run tests\n\n        # pop CosmologyWithKwargs from registered classes\n        # but don't error b/c it can fail in parallel\n        _COSMOLOGY_CLASSES.pop(CosmologyWithKwargs.__qualname__, None)\n\n    @pytest.fixture(scope=\"class\", params=cosmo_instances)\n    def cosmo(self, request):\n        \"\"\"Cosmology instance.\"\"\"\n        if isinstance(request.param, str):  # CosmologyWithKwargs\n            return _COSMOLOGY_CLASSES[request.param](Tcmb0=3)\n        return request.param\n\n    @pytest.fixture(scope=\"class\")\n    def cosmo_cls(self, cosmo):\n        \"\"\"Cosmology classes.\"\"\"\n        return cosmo.__class__\n\n\nclass ToFromDirectTestBase(IODirectTestBase, ToFromTestMixinBase):\n    \"\"\"Directly test ``to/from_<format>``.\n\n    These functions are not public API and are discouraged from public use, in\n    favor of ``Cosmology.to/from_format(..., format=\"<format>\")``. They are\n    tested because they are used internally and because some tests for the\n    methods on |Cosmology| don't need to be run in the |Cosmology| class's\n    large test matrix.\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass.\n\n    Subclasses should have an attribute ``functions`` which is a dictionary\n    containing two items: ``\"to\"=<function for to_format>`` and\n    ``\"from\"=<function for from_format>``.\n    \"\"\"\n\n    @pytest.fixture(scope=\"class\")\n    def from_format(self):\n        \"\"\"Convert to Cosmology using function ``from``.\"\"\"\n        def use_from_format(*args, **kwargs):\n            kwargs.pop(\"format\", None)  # specific to Cosmology.from_format\n            return self.functions[\"from\"](*args, **kwargs)\n\n        return use_from_format\n\n    @pytest.fixture(scope=\"class\")\n    def to_format(self, cosmo):\n        \"\"\"Convert Cosmology to format using function ``to``.\"\"\"\n        def use_to_format(*args, **kwargs):\n            return self.functions[\"to\"](cosmo, *args, **kwargs)\n\n        return use_to_format\n\n\nclass ReadWriteDirectTestBase(IODirectTestBase, ToFromTestMixinBase):\n    \"\"\"Directly test ``read/write_<format>``.\n\n    These functions are not public API and are discouraged from public use, in\n    favor of ``Cosmology.read/write(..., format=\"<format>\")``. They are tested\n    because they are used internally and because some tests for the\n    methods on |Cosmology| don't need to be run in the |Cosmology| class's\n    large test matrix.\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass.\n\n    Subclasses should have an attribute ``functions`` which is a dictionary\n    containing two items: ``\"read\"=<function for read>`` and\n    ``\"write\"=<function for write>``.\n    \"\"\"\n\n    @pytest.fixture(scope=\"class\")\n    def read(self):\n        \"\"\"Read Cosmology from file using function ``read``.\"\"\"\n        def use_read(*args, **kwargs):\n            kwargs.pop(\"format\", None)  # specific to Cosmology.from_format\n            return self.functions[\"read\"](*args, **kwargs)\n\n        return use_read\n\n    @pytest.fixture(scope=\"class\")\n    def write(self, cosmo):\n        \"\"\"Write Cosmology to file using function ``write``.\"\"\"\n        def use_write(*args, **kwargs):\n            return self.functions[\"write\"](cosmo, *args, **kwargs)\n\n        return use_write\n"},{"className":"IOTestBase","col":0,"comment":"Base class for Cosmology I/O tests.\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass. Subclasses must define a :func:`pytest.fixture`\n    ``cosmo`` that returns/yields an instance of a |Cosmology|.\n    See ``TestCosmology`` for an example.\n    ","endLoc":27,"id":14196,"nodeType":"Class","startLoc":19,"text":"class IOTestBase:\n    \"\"\"Base class for Cosmology I/O tests.\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass. Subclasses must define a :func:`pytest.fixture`\n    ``cosmo`` that returns/yields an instance of a |Cosmology|.\n    See ``TestCosmology`` for an example.\n    \"\"\""},{"className":"ToFromTestMixinBase","col":0,"comment":"Tests for a Cosmology[To/From]Format with some ``format``.\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass. Subclasses must define a :func:`pytest.fixture`\n    ``cosmo`` that returns/yields an instance of a |Cosmology|.\n    See ``TestCosmology`` for an example.\n    ","endLoc":52,"id":14197,"nodeType":"Class","startLoc":30,"text":"class ToFromTestMixinBase(IOTestBase):\n    \"\"\"Tests for a Cosmology[To/From]Format with some ``format``.\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass. Subclasses must define a :func:`pytest.fixture`\n    ``cosmo`` that returns/yields an instance of a |Cosmology|.\n    See ``TestCosmology`` for an example.\n    \"\"\"\n\n    @pytest.fixture(scope=\"class\")\n    def from_format(self):\n        \"\"\"Convert to Cosmology using ``Cosmology.from_format()``.\"\"\"\n        return Cosmology.from_format\n\n    @pytest.fixture(scope=\"class\")\n    def to_format(self, cosmo):\n        \"\"\"Convert Cosmology instance using ``.to_format()``.\"\"\"\n        return cosmo.to_format\n\n    def can_autodentify(self, format):\n        \"\"\"Check whether a format can auto-identify.\"\"\"\n        return format in Cosmology.from_format.registry._identifiers"},{"col":4,"comment":"Convert to Cosmology using ``Cosmology.from_format()``.","endLoc":43,"header":"@pytest.fixture(scope=\"class\")\n    def from_format(self)","id":14198,"name":"from_format","nodeType":"Function","startLoc":40,"text":"@pytest.fixture(scope=\"class\")\n    def from_format(self):\n        \"\"\"Convert to Cosmology using ``Cosmology.from_format()``.\"\"\"\n        return Cosmology.from_format"},{"col":4,"comment":"Convert Cosmology instance using ``.to_format()``.","endLoc":48,"header":"@pytest.fixture(scope=\"class\")\n    def to_format(self, cosmo)","id":14199,"name":"to_format","nodeType":"Function","startLoc":45,"text":"@pytest.fixture(scope=\"class\")\n    def to_format(self, cosmo):\n        \"\"\"Convert Cosmology instance using ``.to_format()``.\"\"\"\n        return cosmo.to_format"},{"col":4,"comment":"Check whether a format can auto-identify.","endLoc":52,"header":"def can_autodentify(self, format)","id":14200,"name":"can_autodentify","nodeType":"Function","startLoc":50,"text":"def can_autodentify(self, format):\n        \"\"\"Check whether a format can auto-identify.\"\"\"\n        return format in Cosmology.from_format.registry._identifiers"},{"col":0,"comment":"Read a `~astropy.cosmology.Cosmology` from an ECSV file.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        From where to read the Cosmology.\n    index : int, str, or None, optional\n        Needed to select the row in tables with multiple rows. ``index`` can be\n        an integer for the row number or, if the table is indexed by a column,\n        the value of that column. If the table is not indexed and ``index``\n        is a string, the \"name\" column is used as the indexing column.\n\n    move_to_meta : bool (optional, keyword-only)\n        Whether to move keyword arguments that are not in the Cosmology class'\n        signature to the Cosmology's metadata. This will only be applied if the\n        Cosmology does NOT have a keyword-only argument (e.g. ``**kwargs``).\n        Arguments moved to the metadata will be merged with existing metadata,\n        preferring specified metadata in the case of a merge conflict\n        (e.g. for ``Cosmology(meta={'key':10}, key=42)``, the ``Cosmology.meta``\n        will be ``{'key': 10}``).\n\n    cosmology : str, `~astropy.cosmology.Cosmology` class, or None (optional, keyword-only)\n        The cosmology class (or string name thereof) to use when constructing\n        the cosmology instance. The class also provides default parameter values,\n        filling in any non-mandatory arguments missing in 'table'.\n\n    **kwargs\n        Passed to :attr:`astropy.table.QTable.read`\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n    ","endLoc":51,"header":"def read_ecsv(filename, index=None, *, move_to_meta=False, cosmology=None, **kwargs)","id":14201,"name":"read_ecsv","nodeType":"Function","startLoc":12,"text":"def read_ecsv(filename, index=None, *, move_to_meta=False, cosmology=None, **kwargs):\n    \"\"\"Read a `~astropy.cosmology.Cosmology` from an ECSV file.\n\n    Parameters\n    ----------\n    filename : path-like or file-like\n        From where to read the Cosmology.\n    index : int, str, or None, optional\n        Needed to select the row in tables with multiple rows. ``index`` can be\n        an integer for the row number or, if the table is indexed by a column,\n        the value of that column. If the table is not indexed and ``index``\n        is a string, the \"name\" column is used as the indexing column.\n\n    move_to_meta : bool (optional, keyword-only)\n        Whether to move keyword arguments that are not in the Cosmology class'\n        signature to the Cosmology's metadata. This will only be applied if the\n        Cosmology does NOT have a keyword-only argument (e.g. ``**kwargs``).\n        Arguments moved to the metadata will be merged with existing metadata,\n        preferring specified metadata in the case of a merge conflict\n        (e.g. for ``Cosmology(meta={'key':10}, key=42)``, the ``Cosmology.meta``\n        will be ``{'key': 10}``).\n\n    cosmology : str, `~astropy.cosmology.Cosmology` class, or None (optional, keyword-only)\n        The cosmology class (or string name thereof) to use when constructing\n        the cosmology instance. The class also provides default parameter values,\n        filling in any non-mandatory arguments missing in 'table'.\n\n    **kwargs\n        Passed to :attr:`astropy.table.QTable.read`\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n    \"\"\"\n    kwargs[\"format\"] = \"ascii.ecsv\"\n    with u.add_enabled_units(cu):\n        table = QTable.read(filename, **kwargs)\n\n    # build cosmology from table\n    return from_table(table, index=index, move_to_meta=move_to_meta, cosmology=cosmology)"},{"className":"ReadWriteTestMixinBase","col":0,"comment":"Tests for a Cosmology[Read/Write].\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass. Subclasses must define a :func:`pytest.fixture`\n    ``cosmo`` that returns/yields an instance of a |Cosmology|.\n    See ``TestCosmology`` for an example.\n    ","endLoc":80,"id":14202,"nodeType":"Class","startLoc":55,"text":"class ReadWriteTestMixinBase(IOTestBase):\n    \"\"\"Tests for a Cosmology[Read/Write].\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass. Subclasses must define a :func:`pytest.fixture`\n    ``cosmo`` that returns/yields an instance of a |Cosmology|.\n    See ``TestCosmology`` for an example.\n    \"\"\"\n\n    @pytest.fixture(scope=\"class\")\n    def read(self):\n        \"\"\"Read Cosmology instance using ``Cosmology.read()``.\"\"\"\n        return Cosmology.read\n\n    @pytest.fixture(scope=\"class\")\n    def write(self, cosmo):\n        \"\"\"Write Cosmology using ``.write()``.\"\"\"\n        return cosmo.write\n\n    @pytest.fixture\n    def add_cu(self):\n        \"\"\"Add :mod:`astropy.cosmology.units` to the enabled units.\"\"\"\n        # TODO! autoenable 'cu' if cosmology is imported?\n        with u.add_enabled_units(cu):\n            yield"},{"col":4,"comment":"Read Cosmology instance using ``Cosmology.read()``.","endLoc":68,"header":"@pytest.fixture(scope=\"class\")\n    def read(self)","id":14203,"name":"read","nodeType":"Function","startLoc":65,"text":"@pytest.fixture(scope=\"class\")\n    def read(self):\n        \"\"\"Read Cosmology instance using ``Cosmology.read()``.\"\"\"\n        return Cosmology.read"},{"col":4,"comment":"Write Cosmology using ``.write()``.","endLoc":73,"header":"@pytest.fixture(scope=\"class\")\n    def write(self, cosmo)","id":14204,"name":"write","nodeType":"Function","startLoc":70,"text":"@pytest.fixture(scope=\"class\")\n    def write(self, cosmo):\n        \"\"\"Write Cosmology using ``.write()``.\"\"\"\n        return cosmo.write"},{"col":4,"comment":"Add :mod:`astropy.cosmology.units` to the enabled units.","endLoc":80,"header":"@pytest.fixture\n    def add_cu(self)","id":14205,"name":"add_cu","nodeType":"Function","startLoc":75,"text":"@pytest.fixture\n    def add_cu(self):\n        \"\"\"Add :mod:`astropy.cosmology.units` to the enabled units.\"\"\"\n        # TODO! autoenable 'cu' if cosmology is imported?\n        with u.add_enabled_units(cu):\n            yield"},{"className":"IODirectTestBase","col":0,"comment":"Directly test Cosmology I/O functions.\n\n    These functions are not public API and are discouraged from public use, in\n    favor of the I/O methods on |Cosmology|. They are tested b/c they are used\n    internally and because some tests for the methods on |Cosmology| don't need\n    to be run in the |Cosmology| class's large test matrix.\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass.\n    ","endLoc":126,"id":14206,"nodeType":"Class","startLoc":86,"text":"class IODirectTestBase(IOTestBase):\n    \"\"\"Directly test Cosmology I/O functions.\n\n    These functions are not public API and are discouraged from public use, in\n    favor of the I/O methods on |Cosmology|. They are tested b/c they are used\n    internally and because some tests for the methods on |Cosmology| don't need\n    to be run in the |Cosmology| class's large test matrix.\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass.\n    \"\"\"\n\n    @pytest.fixture(scope=\"class\", autouse=True)\n    def setup(self):\n        \"\"\"Setup and teardown for tests.\"\"\"\n\n        class CosmologyWithKwargs(Cosmology):\n            Tcmb0 = Parameter(unit=u.K)\n\n            def __init__(self, Tcmb0=0, name=\"cosmology with kwargs\", meta=None, **kwargs):\n                super().__init__(name=name, meta=meta)\n                self._Tcmb0 = Tcmb0 << u.K\n\n        yield  # run tests\n\n        # pop CosmologyWithKwargs from registered classes\n        # but don't error b/c it can fail in parallel\n        _COSMOLOGY_CLASSES.pop(CosmologyWithKwargs.__qualname__, None)\n\n    @pytest.fixture(scope=\"class\", params=cosmo_instances)\n    def cosmo(self, request):\n        \"\"\"Cosmology instance.\"\"\"\n        if isinstance(request.param, str):  # CosmologyWithKwargs\n            return _COSMOLOGY_CLASSES[request.param](Tcmb0=3)\n        return request.param\n\n    @pytest.fixture(scope=\"class\")\n    def cosmo_cls(self, cosmo):\n        \"\"\"Cosmology classes.\"\"\"\n        return cosmo.__class__"},{"col":4,"comment":"Setup and teardown for tests.","endLoc":114,"header":"@pytest.fixture(scope=\"class\", autouse=True)\n    def setup(self)","id":14207,"name":"setup","nodeType":"Function","startLoc":99,"text":"@pytest.fixture(scope=\"class\", autouse=True)\n    def setup(self):\n        \"\"\"Setup and teardown for tests.\"\"\"\n\n        class CosmologyWithKwargs(Cosmology):\n            Tcmb0 = Parameter(unit=u.K)\n\n            def __init__(self, Tcmb0=0, name=\"cosmology with kwargs\", meta=None, **kwargs):\n                super().__init__(name=name, meta=meta)\n                self._Tcmb0 = Tcmb0 << u.K\n\n        yield  # run tests\n\n        # pop CosmologyWithKwargs from registered classes\n        # but don't error b/c it can fail in parallel\n        _COSMOLOGY_CLASSES.pop(CosmologyWithKwargs.__qualname__, None)"},{"className":"_CosmologyModel","col":0,"comment":"Base class for Cosmology redshift-method Models.\n\n    .. note::\n\n        This class is not publicly scoped so should not be used directly.\n        Instead, from a Cosmology instance use ``.to_format(\"astropy.model\")``\n        to create an instance of a subclass of this class.\n\n    `_CosmologyModel` (subclasses) wrap a redshift-method of a\n    :class:`~astropy.cosmology.Cosmology` class, converting each non-`None`\n    |Cosmology| :class:`~astropy.cosmology.Parameter` to a\n    :class:`astropy.modeling.Model` :class:`~astropy.modeling.Parameter`\n    and the redshift-method to the model's ``__call__ / evaluate``.\n\n    See Also\n    --------\n    astropy.cosmology.Cosmology.to_format\n    ","endLoc":124,"id":14208,"nodeType":"Class","startLoc":28,"text":"class _CosmologyModel(FittableModel):\n    \"\"\"Base class for Cosmology redshift-method Models.\n\n    .. note::\n\n        This class is not publicly scoped so should not be used directly.\n        Instead, from a Cosmology instance use ``.to_format(\"astropy.model\")``\n        to create an instance of a subclass of this class.\n\n    `_CosmologyModel` (subclasses) wrap a redshift-method of a\n    :class:`~astropy.cosmology.Cosmology` class, converting each non-`None`\n    |Cosmology| :class:`~astropy.cosmology.Parameter` to a\n    :class:`astropy.modeling.Model` :class:`~astropy.modeling.Parameter`\n    and the redshift-method to the model's ``__call__ / evaluate``.\n\n    See Also\n    --------\n    astropy.cosmology.Cosmology.to_format\n    \"\"\"\n\n    @abc.abstractmethod\n    def _cosmology_class(self):\n        \"\"\"Cosmology class as a private attribute. Set in subclasses.\"\"\"\n\n    @abc.abstractmethod\n    def _method_name(self):\n        \"\"\"Cosmology method name as a private attribute. Set in subclasses.\"\"\"\n\n    @classproperty\n    def cosmology_class(cls):\n        \"\"\"|Cosmology| class.\"\"\"\n        return cls._cosmology_class\n\n    @property\n    def cosmology(self):\n        \"\"\"Return |Cosmology| using `~astropy.modeling.Parameter` values.\"\"\"\n        cosmo = self._cosmology_class(\n            name=self.name,\n            **{k: (v.value if not (v := getattr(self, k)).unit else v.quantity)\n               for k in self.param_names})\n        return cosmo\n\n    @classproperty\n    def method_name(self):\n        \"\"\"Redshift-method name on |Cosmology| instance.\"\"\"\n        return self._method_name\n\n    # ---------------------------------------------------------------\n\n    def evaluate(self, *args, **kwargs):\n        \"\"\"Evaluate method {method!r} of {cosmo_cls!r} Cosmology.\n\n        The Model wraps the :class:`~astropy.cosmology.Cosmology` method,\n        converting each |Cosmology| :class:`~astropy.cosmology.Parameter` to a\n        :class:`astropy.modeling.Model` :class:`~astropy.modeling.Parameter`\n        (unless the Parameter is None, in which case it is skipped).\n        Here an instance of the cosmology is created using the current\n        Parameter values and the method is evaluated given the input.\n\n        Parameters\n        ----------\n        *args, **kwargs\n            The first ``n_inputs`` of ``*args`` are for evaluating the method\n            of the cosmology. The remaining args and kwargs are passed to the\n            cosmology class constructor.\n            Any unspecified Cosmology Parameter use the current value of the\n            corresponding Model Parameter.\n\n        Returns\n        -------\n        Any\n            Results of evaluating the Cosmology method.\n        \"\"\"\n        # create BoundArgument with all available inputs beyond the Parameters,\n        # which will be filled in next\n        ba = self.cosmology_class._init_signature.bind_partial(*args[self.n_inputs:], **kwargs)\n\n        # fill in missing Parameters\n        for k in self.param_names:\n            if k not in ba.arguments:\n                v = getattr(self, k)\n                ba.arguments[k] = v.value if not v.unit else v.quantity\n\n            # unvectorize, since Cosmology is not vectorized\n            # TODO! remove when vectorized\n            if np.shape(ba.arguments[k]):  # only in __call__\n                # m_nu is a special case  # TODO! fix by making it 'structured'\n                if k == \"m_nu\" and len(ba.arguments[k].shape) == 1:\n                    continue\n                ba.arguments[k] = ba.arguments[k][0]\n\n        # make instance of cosmology\n        cosmo = self._cosmology_class(**ba.arguments)\n        # evaluate method\n        result = getattr(cosmo, self._method_name)(*args[:self.n_inputs])\n\n        return result"},{"col":4,"comment":"Cosmology class as a private attribute. Set in subclasses.","endLoc":50,"header":"@abc.abstractmethod\n    def _cosmology_class(self)","id":14209,"name":"_cosmology_class","nodeType":"Function","startLoc":48,"text":"@abc.abstractmethod\n    def _cosmology_class(self):\n        \"\"\"Cosmology class as a private attribute. Set in subclasses.\"\"\""},{"col":4,"comment":"Cosmology method name as a private attribute. Set in subclasses.","endLoc":54,"header":"@abc.abstractmethod\n    def _method_name(self)","id":14210,"name":"_method_name","nodeType":"Function","startLoc":52,"text":"@abc.abstractmethod\n    def _method_name(self):\n        \"\"\"Cosmology method name as a private attribute. Set in subclasses.\"\"\""},{"col":4,"comment":"|Cosmology| class.","endLoc":59,"header":"@classproperty\n    def cosmology_class(cls)","id":14211,"name":"cosmology_class","nodeType":"Function","startLoc":56,"text":"@classproperty\n    def cosmology_class(cls):\n        \"\"\"|Cosmology| class.\"\"\"\n        return cls._cosmology_class"},{"col":4,"comment":"Return |Cosmology| using `~astropy.modeling.Parameter` values.","endLoc":68,"header":"@property\n    def cosmology(self)","id":14212,"name":"cosmology","nodeType":"Function","startLoc":61,"text":"@property\n    def cosmology(self):\n        \"\"\"Return |Cosmology| using `~astropy.modeling.Parameter` values.\"\"\"\n        cosmo = self._cosmology_class(\n            name=self.name,\n            **{k: (v.value if not (v := getattr(self, k)).unit else v.quantity)\n               for k in self.param_names})\n        return cosmo"},{"col":0,"comment":"null","endLoc":1791,"header":"def _populate_ep()","id":14213,"name":"_populate_ep","nodeType":"Function","startLoc":1785,"text":"def _populate_ep():\n    # TODO: Exclusively use select when Python minversion is 3.10\n    ep = entry_points()\n    if hasattr(ep, 'select'):\n        populate_entry_points(ep.select(group='astropy.modeling'))\n    else:\n        populate_entry_points(ep.get('astropy.modeling', []))"},{"col":4,"comment":"Cosmology instance.","endLoc":121,"header":"@pytest.fixture(scope=\"class\", params=cosmo_instances)\n    def cosmo(self, request)","id":14214,"name":"cosmo","nodeType":"Function","startLoc":116,"text":"@pytest.fixture(scope=\"class\", params=cosmo_instances)\n    def cosmo(self, request):\n        \"\"\"Cosmology instance.\"\"\"\n        if isinstance(request.param, str):  # CosmologyWithKwargs\n            return _COSMOLOGY_CLASSES[request.param](Tcmb0=3)\n        return request.param"},{"col":4,"comment":"Cosmology classes.","endLoc":126,"header":"@pytest.fixture(scope=\"class\")\n    def cosmo_cls(self, cosmo)","id":14215,"name":"cosmo_cls","nodeType":"Function","startLoc":123,"text":"@pytest.fixture(scope=\"class\")\n    def cosmo_cls(self, cosmo):\n        \"\"\"Cosmology classes.\"\"\"\n        return cosmo.__class__"},{"className":"ToFromDirectTestBase","col":0,"comment":"Directly test ``to/from_<format>``.\n\n    These functions are not public API and are discouraged from public use, in\n    favor of ``Cosmology.to/from_format(..., format=\"<format>\")``. They are\n    tested because they are used internally and because some tests for the\n    methods on |Cosmology| don't need to be run in the |Cosmology| class's\n    large test matrix.\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass.\n\n    Subclasses should have an attribute ``functions`` which is a dictionary\n    containing two items: ``\"to\"=<function for to_format>`` and\n    ``\"from\"=<function for from_format>``.\n    ","endLoc":162,"id":14216,"nodeType":"Class","startLoc":129,"text":"class ToFromDirectTestBase(IODirectTestBase, ToFromTestMixinBase):\n    \"\"\"Directly test ``to/from_<format>``.\n\n    These functions are not public API and are discouraged from public use, in\n    favor of ``Cosmology.to/from_format(..., format=\"<format>\")``. They are\n    tested because they are used internally and because some tests for the\n    methods on |Cosmology| don't need to be run in the |Cosmology| class's\n    large test matrix.\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass.\n\n    Subclasses should have an attribute ``functions`` which is a dictionary\n    containing two items: ``\"to\"=<function for to_format>`` and\n    ``\"from\"=<function for from_format>``.\n    \"\"\"\n\n    @pytest.fixture(scope=\"class\")\n    def from_format(self):\n        \"\"\"Convert to Cosmology using function ``from``.\"\"\"\n        def use_from_format(*args, **kwargs):\n            kwargs.pop(\"format\", None)  # specific to Cosmology.from_format\n            return self.functions[\"from\"](*args, **kwargs)\n\n        return use_from_format\n\n    @pytest.fixture(scope=\"class\")\n    def to_format(self, cosmo):\n        \"\"\"Convert Cosmology to format using function ``to``.\"\"\"\n        def use_to_format(*args, **kwargs):\n            return self.functions[\"to\"](cosmo, *args, **kwargs)\n\n        return use_to_format"},{"attributeType":"null","col":16,"comment":"null","endLoc":33,"id":14217,"name":"np","nodeType":"Attribute","startLoc":33,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":45,"id":14218,"name":"__all__","nodeType":"Attribute","startLoc":45,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":51,"id":14219,"name":"STATISTICS","nodeType":"Attribute","startLoc":51,"text":"STATISTICS"},{"attributeType":"null","col":0,"comment":"null","endLoc":54,"id":14220,"name":"OPTIMIZERS","nodeType":"Attribute","startLoc":54,"text":"OPTIMIZERS"},{"col":4,"comment":"Convert to Cosmology using function ``from``.","endLoc":154,"header":"@pytest.fixture(scope=\"class\")\n    def from_format(self)","id":14221,"name":"from_format","nodeType":"Function","startLoc":147,"text":"@pytest.fixture(scope=\"class\")\n    def from_format(self):\n        \"\"\"Convert to Cosmology using function ``from``.\"\"\"\n        def use_from_format(*args, **kwargs):\n            kwargs.pop(\"format\", None)  # specific to Cosmology.from_format\n            return self.functions[\"from\"](*args, **kwargs)\n\n        return use_from_format"},{"col":0,"comment":"","endLoc":22,"header":"fitting.py#<anonymous>","id":14222,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module implements classes (called Fitters) which combine optimization\nalgorithms (typically from `scipy.optimize`) with statistic functions to perform\nfitting. Fitters are implemented as callable classes. In addition to the data\nto fit, the ``__call__`` method takes an instance of\n`~astropy.modeling.core.FittableModel` as input, and returns a copy of the\nmodel with its parameters determined by the optimizer.\n\nOptimization algorithms, called \"optimizers\" are implemented in\n`~astropy.modeling.optimizers` and statistic functions are in\n`~astropy.modeling.statistic`. The goal is to provide an easy to extend\nframework and allow users to easily create new fitters by combining statistics\nwith optimizers.\n\nThere are two exceptions to the above scheme.\n`~astropy.modeling.fitting.LinearLSQFitter` uses Numpy's `~numpy.linalg.lstsq`\nfunction.  `~astropy.modeling.fitting.LevMarLSQFitter` uses\n`~scipy.optimize.leastsq` which combines optimization and statistic in one\nimplementation.\n\"\"\"\n\n__all__ = ['LinearLSQFitter', 'LevMarLSQFitter', 'FittingWithOutlierRemoval',\n           'SLSQPLSQFitter', 'SimplexLSQFitter', 'JointFitter', 'Fitter',\n           \"ModelLinearityError\", \"ModelsError\"]\n\nSTATISTICS = [leastsquare]\n\nOPTIMIZERS = [Simplex, SLSQP]\n\n_populate_ep()"},{"id":14223,"name":"astropy/cosmology/data","nodeType":"Package"},{"id":14224,"name":"Planck18.ecsv","nodeType":"TextFile","path":"astropy/cosmology/data","text":"# %ECSV 1.0\n# ---\n# datatype:\n# - {name: name, datatype: string}\n# - {name: H0, unit: km / (Mpc s), datatype: float64, format: '', description: Hubble constant as an `~astropy.units.Quantity` at z=0.}\n# - {name: Om0, datatype: float64, format: '', description: Omega matter; matter density/critical density at z=0.}\n# - {name: Tcmb0, unit: K, datatype: float64, format: '', description: Temperature of the CMB as `~astropy.units.Quantity` at z=0.}\n# - {name: Neff, datatype: float64, format: '', description: Number of effective neutrino species.}\n# - {name: m_nu, unit: eV, datatype: string, format: '', description: Mass of neutrino species., subtype: 'float64[3]'}\n# - {name: Ob0, datatype: float64, format: '', description: Omega baryon; baryonic matter density/critical density at z=0.}\n# meta: !!omap\n# - {Oc0: 0.2607}\n# - {n: 0.9665}\n# - {sigma8: 0.8102}\n# - {tau: 0.0561}\n# - z_reion: !astropy.units.Quantity\n#     unit: !astropy.units.Unit {unit: redshift}\n#     value: 7.82\n# - t0: !astropy.units.Quantity\n#     unit: !astropy.units.Unit {unit: Gyr}\n#     value: 13.787\n# - {flat: true}\n# - {reference: 'Planck Collaboration 2018, 2020, A&A, 641, A6  (Paper VI), Table 2 (TT, TE, EE + lowE + lensing + BAO)'}\n# - {cosmology: FlatLambdaCDM}\n# - __serialized_columns__:\n#     H0:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: km / (Mpc s)}\n#       value: !astropy.table.SerializedColumn {name: H0}\n#     Tcmb0:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: K}\n#       value: !astropy.table.SerializedColumn {name: Tcmb0}\n#     m_nu:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: eV}\n#       value: !astropy.table.SerializedColumn {name: m_nu}\n# schema: astropy-2.0\nname H0 Om0 Tcmb0 Neff m_nu Ob0\nPlanck18 67.66 0.30966 2.7255 3.046 [0.0,0.0,0.06] 0.04897\n"},{"id":14225,"name":"Planck13.ecsv","nodeType":"TextFile","path":"astropy/cosmology/data","text":"# %ECSV 1.0\n# ---\n# datatype:\n# - {name: name, datatype: string}\n# - {name: H0, unit: km / (Mpc s), datatype: float64, format: '', description: Hubble constant as an `~astropy.units.Quantity` at z=0.}\n# - {name: Om0, datatype: float64, format: '', description: Omega matter; matter density/critical density at z=0.}\n# - {name: Tcmb0, unit: K, datatype: float64, format: '', description: Temperature of the CMB as `~astropy.units.Quantity` at z=0.}\n# - {name: Neff, datatype: float64, format: '', description: Number of effective neutrino species.}\n# - {name: m_nu, unit: eV, datatype: string, format: '', description: Mass of neutrino species., subtype: 'float64[3]'}\n# - {name: Ob0, datatype: float64, format: '', description: Omega baryon; baryonic matter density/critical density at z=0.}\n# meta: !!omap\n# - {Oc0: 0.25886}\n# - {n: 0.9611}\n# - {sigma8: 0.8288}\n# - {tau: 0.0952}\n# - z_reion: !astropy.units.Quantity\n#     unit: !astropy.units.Unit {unit: redshift}\n#     value: 11.52\n# - t0: !astropy.units.Quantity\n#     unit: !astropy.units.Unit {unit: Gyr}\n#     value: 13.7965\n# - {flat: true}\n# - {reference: 'Planck Collaboration 2014, A&A, 571, A16 (Paper XVI), Table 5 (Planck + WP + highL + BAO)'}\n# - {cosmology: FlatLambdaCDM}\n# - __serialized_columns__:\n#     H0:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: km / (Mpc s)}\n#       value: !astropy.table.SerializedColumn {name: H0}\n#     Tcmb0:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: K}\n#       value: !astropy.table.SerializedColumn {name: Tcmb0}\n#     m_nu:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: eV}\n#       value: !astropy.table.SerializedColumn {name: m_nu}\n# schema: astropy-2.0\nname H0 Om0 Tcmb0 Neff m_nu Ob0\nPlanck13 67.77 0.30712 2.7255 3.046 [0.0,0.0,0.06] 0.048252\n"},{"id":14226,"name":"WMAP1.ecsv","nodeType":"TextFile","path":"astropy/cosmology/data","text":"# %ECSV 1.0\n# ---\n# datatype:\n# - {name: name, datatype: string}\n# - {name: H0, unit: km / (Mpc s), datatype: float64, format: '', description: Hubble constant as an `~astropy.units.Quantity` at z=0.}\n# - {name: Om0, datatype: float64, format: '', description: Omega matter; matter density/critical density at z=0.}\n# - {name: Tcmb0, unit: K, datatype: float64, format: '', description: Temperature of the CMB as `~astropy.units.Quantity` at z=0.}\n# - {name: Neff, datatype: float64, format: '', description: Number of effective neutrino species.}\n# - {name: m_nu, unit: eV, datatype: string, format: '', description: Mass of neutrino species., subtype: 'float64[3]'}\n# - {name: Ob0, datatype: float64, format: '', description: Omega baryon; baryonic matter density/critical density at z=0.}\n# meta: !!omap\n# - {Oc0: 0.213}\n# - {n: 0.96}\n# - {sigma8: 0.75}\n# - {tau: 0.117}\n# - z_reion: !astropy.units.Quantity\n#     unit: !astropy.units.Unit {unit: redshift}\n#     value: 17.0\n# - t0: !astropy.units.Quantity\n#     unit: !astropy.units.Unit {unit: Gyr}\n#     value: 13.4\n# - {flat: true}\n# - {reference: 'Spergel et al. 2003, ApJS, 148, 175, doi:  10.1086/377226. Table 7 (WMAP + CBI + ACBAR + 2dFGRS + Lya).\\nPending WMAP\n#     team approval and subject to change.'}\n# - {cosmology: FlatLambdaCDM}\n# - __serialized_columns__:\n#     H0:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: km / (Mpc s)}\n#       value: !astropy.table.SerializedColumn {name: H0}\n#     Tcmb0:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: K}\n#       value: !astropy.table.SerializedColumn {name: Tcmb0}\n#     m_nu:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: eV}\n#       value: !astropy.table.SerializedColumn {name: m_nu}\n# schema: astropy-2.0\nname H0 Om0 Tcmb0 Neff m_nu Ob0\nWMAP1 72.0 0.257 2.725 3.04 [0.0,0.0,0.0] 0.0436\n"},{"id":14227,"name":"WMAP7.ecsv","nodeType":"TextFile","path":"astropy/cosmology/data","text":"# %ECSV 1.0\n# ---\n# datatype:\n# - {name: name, datatype: string}\n# - {name: H0, unit: km / (Mpc s), datatype: float64, format: '', description: Hubble constant as an `~astropy.units.Quantity` at z=0.}\n# - {name: Om0, datatype: float64, format: '', description: Omega matter; matter density/critical density at z=0.}\n# - {name: Tcmb0, unit: K, datatype: float64, format: '', description: Temperature of the CMB as `~astropy.units.Quantity` at z=0.}\n# - {name: Neff, datatype: float64, format: '', description: Number of effective neutrino species.}\n# - {name: m_nu, unit: eV, datatype: string, format: '', description: Mass of neutrino species., subtype: 'float64[3]'}\n# - {name: Ob0, datatype: float64, format: '', description: Omega baryon; baryonic matter density/critical density at z=0.}\n# meta: !!omap\n# - {Oc0: 0.226}\n# - {n: 0.967}\n# - {sigma8: 0.81}\n# - {tau: 0.085}\n# - z_reion: !astropy.units.Quantity\n#     unit: !astropy.units.Unit {unit: redshift}\n#     value: 10.3\n# - t0: !astropy.units.Quantity\n#     unit: !astropy.units.Unit {unit: Gyr}\n#     value: 13.76\n# - {flat: true}\n# - {reference: 'Komatsu et al. 2011, ApJS, 192, 18, doi: 10.1088/0067-0049/192/2/18. Table 1 (WMAP + BAO + H0 ML).'}\n# - {cosmology: FlatLambdaCDM}\n# - __serialized_columns__:\n#     H0:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: km / (Mpc s)}\n#       value: !astropy.table.SerializedColumn {name: H0}\n#     Tcmb0:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: K}\n#       value: !astropy.table.SerializedColumn {name: Tcmb0}\n#     m_nu:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: eV}\n#       value: !astropy.table.SerializedColumn {name: m_nu}\n# schema: astropy-2.0\nname H0 Om0 Tcmb0 Neff m_nu Ob0\nWMAP7 70.4 0.272 2.725 3.04 [0.0,0.0,0.0] 0.0455\n"},{"id":14228,"name":"WMAP9.ecsv","nodeType":"TextFile","path":"astropy/cosmology/data","text":"# %ECSV 1.0\n# ---\n# datatype:\n# - {name: name, datatype: string}\n# - {name: H0, unit: km / (Mpc s), datatype: float64, format: '', description: Hubble constant as an `~astropy.units.Quantity` at z=0.}\n# - {name: Om0, datatype: float64, format: '', description: Omega matter; matter density/critical density at z=0.}\n# - {name: Tcmb0, unit: K, datatype: float64, format: '', description: Temperature of the CMB as `~astropy.units.Quantity` at z=0.}\n# - {name: Neff, datatype: float64, format: '', description: Number of effective neutrino species.}\n# - {name: m_nu, unit: eV, datatype: string, format: '', description: Mass of neutrino species., subtype: 'float64[3]'}\n# - {name: Ob0, datatype: float64, format: '', description: Omega baryon; baryonic matter density/critical density at z=0.}\n# meta: !!omap\n# - {Oc0: 0.2402}\n# - {n: 0.9608}\n# - {sigma8: 0.82}\n# - {tau: 0.081}\n# - z_reion: !astropy.units.Quantity\n#     unit: !astropy.units.Unit {unit: redshift}\n#     value: 10.1\n# - t0: !astropy.units.Quantity\n#     unit: !astropy.units.Unit {unit: Gyr}\n#     value: 13.772\n# - {flat: true}\n# - {reference: 'Hinshaw et al. 2013, ApJS, 208, 19, doi: 10.1088/0067-0049/208/2/19. Table 4 (WMAP9 + eCMB + BAO + H0, last column)'}\n# - {cosmology: FlatLambdaCDM}\n# - __serialized_columns__:\n#     H0:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: km / (Mpc s)}\n#       value: !astropy.table.SerializedColumn {name: H0}\n#     Tcmb0:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: K}\n#       value: !astropy.table.SerializedColumn {name: Tcmb0}\n#     m_nu:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: eV}\n#       value: !astropy.table.SerializedColumn {name: m_nu}\n# schema: astropy-2.0\nname H0 Om0 Tcmb0 Neff m_nu Ob0\nWMAP9 69.32 0.2865 2.725 3.04 [0.0,0.0,0.0] 0.04628\n"},{"id":14229,"name":"WMAP5.ecsv","nodeType":"TextFile","path":"astropy/cosmology/data","text":"# %ECSV 1.0\n# ---\n# datatype:\n# - {name: name, datatype: string}\n# - {name: H0, unit: km / (Mpc s), datatype: float64, format: '', description: Hubble constant as an `~astropy.units.Quantity` at z=0.}\n# - {name: Om0, datatype: float64, format: '', description: Omega matter; matter density/critical density at z=0.}\n# - {name: Tcmb0, unit: K, datatype: float64, format: '', description: Temperature of the CMB as `~astropy.units.Quantity` at z=0.}\n# - {name: Neff, datatype: float64, format: '', description: Number of effective neutrino species.}\n# - {name: m_nu, unit: eV, datatype: string, format: '', description: Mass of neutrino species., subtype: 'float64[3]'}\n# - {name: Ob0, datatype: float64, format: '', description: Omega baryon; baryonic matter density/critical density at z=0.}\n# meta: !!omap\n# - {Oc0: 0.231}\n# - {n: 0.962}\n# - {sigma8: 0.817}\n# - {tau: 0.088}\n# - z_reion: !astropy.units.Quantity\n#     unit: !astropy.units.Unit {unit: redshift}\n#     value: 11.3\n# - t0: !astropy.units.Quantity\n#     unit: !astropy.units.Unit {unit: Gyr}\n#     value: 13.72\n# - {flat: true}\n# - {reference: 'Komatsu et al. 2009, ApJS, 180, 330, doi: 10.1088/0067-0049/180/2/330. Table 1 (WMAP + BAO + SN ML).'}\n# - {cosmology: FlatLambdaCDM}\n# - __serialized_columns__:\n#     H0:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: km / (Mpc s)}\n#       value: !astropy.table.SerializedColumn {name: H0}\n#     Tcmb0:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: K}\n#       value: !astropy.table.SerializedColumn {name: Tcmb0}\n#     m_nu:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: eV}\n#       value: !astropy.table.SerializedColumn {name: m_nu}\n# schema: astropy-2.0\nname H0 Om0 Tcmb0 Neff m_nu Ob0\nWMAP5 70.2 0.277 2.725 3.04 [0.0,0.0,0.0] 0.0459\n"},{"id":14230,"name":"WMAP3.ecsv","nodeType":"TextFile","path":"astropy/cosmology/data","text":"# %ECSV 1.0\n# ---\n# datatype:\n# - {name: name, datatype: string}\n# - {name: H0, unit: km / (Mpc s), datatype: float64, format: '', description: Hubble constant as an `~astropy.units.Quantity` at z=0.}\n# - {name: Om0, datatype: float64, format: '', description: Omega matter; matter density/critical density at z=0.}\n# - {name: Tcmb0, unit: K, datatype: float64, format: '', description: Temperature of the CMB as `~astropy.units.Quantity` at z=0.}\n# - {name: Neff, datatype: float64, format: '', description: Number of effective neutrino species.}\n# - {name: m_nu, unit: eV, datatype: string, format: '', description: Mass of neutrino species., subtype: 'float64[3]'}\n# - {name: Ob0, datatype: float64, format: '', description: Omega baryon; baryonic matter density/critical density at z=0.}\n# meta: !!omap\n# - {Oc0: 0.23}\n# - {n: 0.946}\n# - {sigma8: 0.784}\n# - {tau: 0.079}\n# - z_reion: !astropy.units.Quantity\n#     unit: !astropy.units.Unit {unit: redshift}\n#     value: 10.3\n# - t0: !astropy.units.Quantity\n#     unit: !astropy.units.Unit {unit: Gyr}\n#     value: 13.78\n# - {flat: true}\n# - {reference: 'Spergel et al. 2007, ApJS, 170, 377, doi:  10.1086/513700. Table 6 (WMAP + SNGold) obtained from: https://lambda.gsfc.nasa.gov/product/map/dr2/params/lcdm_wmap_sngold.cfm\\nPending\n#     WMAP team approval and subject to change.'}\n# - {cosmology: FlatLambdaCDM}\n# - __serialized_columns__:\n#     H0:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: km / (Mpc s)}\n#       value: !astropy.table.SerializedColumn {name: H0}\n#     Tcmb0:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: K}\n#       value: !astropy.table.SerializedColumn {name: Tcmb0}\n#     m_nu:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: eV}\n#       value: !astropy.table.SerializedColumn {name: m_nu}\n# schema: astropy-2.0\nname H0 Om0 Tcmb0 Neff m_nu Ob0\nWMAP3 70.1 0.276 2.725 3.04 [0.0,0.0,0.0] 0.0454\n"},{"col":4,"comment":"Redshift-method name on |Cosmology| instance.","endLoc":73,"header":"@classproperty\n    def method_name(self)","id":14231,"name":"method_name","nodeType":"Function","startLoc":70,"text":"@classproperty\n    def method_name(self):\n        \"\"\"Redshift-method name on |Cosmology| instance.\"\"\"\n        return self._method_name"},{"col":4,"comment":"Evaluate method {method!r} of {cosmo_cls!r} Cosmology.\n\n        The Model wraps the :class:`~astropy.cosmology.Cosmology` method,\n        converting each |Cosmology| :class:`~astropy.cosmology.Parameter` to a\n        :class:`astropy.modeling.Model` :class:`~astropy.modeling.Parameter`\n        (unless the Parameter is None, in which case it is skipped).\n        Here an instance of the cosmology is created using the current\n        Parameter values and the method is evaluated given the input.\n\n        Parameters\n        ----------\n        *args, **kwargs\n            The first ``n_inputs`` of ``*args`` are for evaluating the method\n            of the cosmology. The remaining args and kwargs are passed to the\n            cosmology class constructor.\n            Any unspecified Cosmology Parameter use the current value of the\n            corresponding Model Parameter.\n\n        Returns\n        -------\n        Any\n            Results of evaluating the Cosmology method.\n        ","endLoc":124,"header":"def evaluate(self, *args, **kwargs)","id":14232,"name":"evaluate","nodeType":"Function","startLoc":77,"text":"def evaluate(self, *args, **kwargs):\n        \"\"\"Evaluate method {method!r} of {cosmo_cls!r} Cosmology.\n\n        The Model wraps the :class:`~astropy.cosmology.Cosmology` method,\n        converting each |Cosmology| :class:`~astropy.cosmology.Parameter` to a\n        :class:`astropy.modeling.Model` :class:`~astropy.modeling.Parameter`\n        (unless the Parameter is None, in which case it is skipped).\n        Here an instance of the cosmology is created using the current\n        Parameter values and the method is evaluated given the input.\n\n        Parameters\n        ----------\n        *args, **kwargs\n            The first ``n_inputs`` of ``*args`` are for evaluating the method\n            of the cosmology. The remaining args and kwargs are passed to the\n            cosmology class constructor.\n            Any unspecified Cosmology Parameter use the current value of the\n            corresponding Model Parameter.\n\n        Returns\n        -------\n        Any\n            Results of evaluating the Cosmology method.\n        \"\"\"\n        # create BoundArgument with all available inputs beyond the Parameters,\n        # which will be filled in next\n        ba = self.cosmology_class._init_signature.bind_partial(*args[self.n_inputs:], **kwargs)\n\n        # fill in missing Parameters\n        for k in self.param_names:\n            if k not in ba.arguments:\n                v = getattr(self, k)\n                ba.arguments[k] = v.value if not v.unit else v.quantity\n\n            # unvectorize, since Cosmology is not vectorized\n            # TODO! remove when vectorized\n            if np.shape(ba.arguments[k]):  # only in __call__\n                # m_nu is a special case  # TODO! fix by making it 'structured'\n                if k == \"m_nu\" and len(ba.arguments[k].shape) == 1:\n                    continue\n                ba.arguments[k] = ba.arguments[k][0]\n\n        # make instance of cosmology\n        cosmo = self._cosmology_class(**ba.arguments)\n        # evaluate method\n        result = getattr(cosmo, self._method_name)(*args[:self.n_inputs])\n\n        return result"},{"id":14233,"name":"Planck15.ecsv","nodeType":"TextFile","path":"astropy/cosmology/data","text":"# %ECSV 1.0\n# ---\n# datatype:\n# - {name: name, datatype: string}\n# - {name: H0, unit: km / (Mpc s), datatype: float64, format: '', description: Hubble constant as an `~astropy.units.Quantity` at z=0.}\n# - {name: Om0, datatype: float64, format: '', description: Omega matter; matter density/critical density at z=0.}\n# - {name: Tcmb0, unit: K, datatype: float64, format: '', description: Temperature of the CMB as `~astropy.units.Quantity` at z=0.}\n# - {name: Neff, datatype: float64, format: '', description: Number of effective neutrino species.}\n# - {name: m_nu, unit: eV, datatype: string, format: '', description: Mass of neutrino species., subtype: 'float64[3]'}\n# - {name: Ob0, datatype: float64, format: '', description: Omega baryon; baryonic matter density/critical density at z=0.}\n# meta: !!omap\n# - {Oc0: 0.2589}\n# - {n: 0.9667}\n# - {sigma8: 0.8159}\n# - {tau: 0.066}\n# - z_reion: !astropy.units.Quantity\n#     unit: !astropy.units.Unit {unit: redshift}\n#     value: 8.8\n# - t0: !astropy.units.Quantity\n#     unit: !astropy.units.Unit {unit: Gyr}\n#     value: 13.799\n# - {flat: true}\n# - {reference: 'Planck Collaboration 2016, A&A, 594, A13 (Paper XIII), Table 4 (TT, TE, EE + lowP + lensing + ext)'}\n# - {cosmology: FlatLambdaCDM}\n# - __serialized_columns__:\n#     H0:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: km / (Mpc s)}\n#       value: !astropy.table.SerializedColumn {name: H0}\n#     Tcmb0:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: K}\n#       value: !astropy.table.SerializedColumn {name: Tcmb0}\n#     m_nu:\n#       __class__: astropy.units.quantity.Quantity\n#       unit: !astropy.units.Unit {unit: eV}\n#       value: !astropy.table.SerializedColumn {name: m_nu}\n# schema: astropy-2.0\nname H0 Om0 Tcmb0 Neff m_nu Ob0\nPlanck15 67.74 0.3075 2.7255 3.046 [0.0,0.0,0.06] 0.0486\n"},{"id":14234,"name":"astropy/cosmology/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/cosmology/tests","id":14235,"nodeType":"File","text":"import os\nimport sys\n\nsys.path.insert(0, os.path.dirname(__file__))  # allows import of \"mypackage\"\n\n# isort split\nimport mypackage\n"},{"col":0,"comment":"Serialize the cosmology into a ECSV.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    file : path-like or file-like\n        Location to save the serialized cosmology.\n\n    overwrite : bool\n        Whether to overwrite the file, if it exists.\n    cls : type (optional, keyword-only)\n        Astropy :class:`~astropy.table.Table` (sub)class to use when writing.\n        Default is :class:`~astropy.table.QTable`.\n    cosmology_in_meta : bool\n        Whether to put the cosmology class in the Table metadata (if `True`,\n        default) or as the first column (if `False`).\n    **kwargs\n        Passed to ``cls.write``\n\n    Raises\n    ------\n    TypeError\n        If kwarg (optional) 'cls' is not a subclass of `astropy.table.Table`\n    ","endLoc":82,"header":"def write_ecsv(cosmology, file, *, overwrite=False, cls=QTable, cosmology_in_meta=True, **kwargs)","id":14236,"name":"write_ecsv","nodeType":"Function","startLoc":54,"text":"def write_ecsv(cosmology, file, *, overwrite=False, cls=QTable, cosmology_in_meta=True, **kwargs):\n    \"\"\"Serialize the cosmology into a ECSV.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    file : path-like or file-like\n        Location to save the serialized cosmology.\n\n    overwrite : bool\n        Whether to overwrite the file, if it exists.\n    cls : type (optional, keyword-only)\n        Astropy :class:`~astropy.table.Table` (sub)class to use when writing.\n        Default is :class:`~astropy.table.QTable`.\n    cosmology_in_meta : bool\n        Whether to put the cosmology class in the Table metadata (if `True`,\n        default) or as the first column (if `False`).\n    **kwargs\n        Passed to ``cls.write``\n\n    Raises\n    ------\n    TypeError\n        If kwarg (optional) 'cls' is not a subclass of `astropy.table.Table`\n    \"\"\"\n    table = to_table(cosmology, cls=cls, cosmology_in_meta=cosmology_in_meta)\n\n    kwargs[\"format\"] = \"ascii.ecsv\"\n    table.write(file, overwrite=overwrite, **kwargs)"},{"col":0,"comment":"","endLoc":1,"header":"__init__.py#<anonymous>","id":14237,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"sys.path.insert(0, os.path.dirname(__file__))  # allows import of \"mypackage\""},{"col":0,"comment":"Identify if object uses the Table format.\n\n    Returns\n    -------\n    bool\n    ","endLoc":92,"header":"def ecsv_identify(origin, filepath, fileobj, *args, **kwargs)","id":14238,"name":"ecsv_identify","nodeType":"Function","startLoc":85,"text":"def ecsv_identify(origin, filepath, fileobj, *args, **kwargs):\n    \"\"\"Identify if object uses the Table format.\n\n    Returns\n    -------\n    bool\n    \"\"\"\n    return filepath is not None and filepath.endswith(\".ecsv\")"},{"attributeType":"null","col":34,"comment":"null","endLoc":3,"id":14239,"name":"cu","nodeType":"Attribute","startLoc":3,"text":"cu"},{"fileName":"conftest.py","filePath":"astropy/cosmology/tests","id":14240,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"Configure the tests for :mod:`astropy.cosmology`.\"\"\"\n\n##############################################################################\n# IMPORTS\n\n# STDLIB\nimport inspect\n\n# THIRD-PARTY\nimport pytest\n\n# LOCAL\nfrom astropy.cosmology import core\nfrom astropy.tests.helper import pickle_protocol  # noqa: F403\n\n\n###############################################################################\n# FUNCTIONS\n\ndef get_redshift_methods(cosmology, allow_private=True, allow_z2=True):\n    \"\"\"Get redshift methods from a cosmology.\n\n    Parameters\n    ----------\n    cosmology : |Cosmology| class or instance\n\n    Returns\n    -------\n    set[str]\n    \"\"\"\n    methods = set()\n    for n in dir(cosmology):\n        try:  # get method, some will error on ABCs\n            m = getattr(cosmology, n)\n        except NotImplementedError:\n            continue\n\n        # Add anything callable, optionally excluding private methods.\n        if callable(m) and (not n.startswith('_') or allow_private):\n            methods.add(n)\n\n    # Sieve out incompatible methods.\n    # The index to check for redshift depends on whether cosmology is a class\n    # or instance and does/doesn't include 'self'.\n    iz1 = 1 if inspect.isclass(cosmology) else 0\n    for n in tuple(methods):\n        try:\n            sig = inspect.signature(getattr(cosmology, n))\n        except ValueError:  # Remove non-introspectable methods.\n            methods.discard(n)\n            continue\n        else:\n            params = list(sig.parameters.keys())\n\n        # Remove non redshift methods:\n        if len(params) <= iz1:  # Check there are enough arguments.\n            methods.discard(n)\n        elif len(params) >= iz1 + 1 and not params[iz1].startswith(\"z\"):  # First non-self arg is z.\n            methods.discard(n)\n        # If methods with 2 z args are not allowed, the following arg is checked.\n        elif not allow_z2 and (len(params) >= iz1 + 2) and params[iz1 + 1].startswith(\"z\"):\n            methods.discard(n)\n\n    return methods\n\n\n###############################################################################\n# FIXTURES\n\n@pytest.fixture\ndef clean_registry():\n    # TODO! with monkeypatch instead for thread safety.\n    ORIGINAL_COSMOLOGY_CLASSES = core._COSMOLOGY_CLASSES\n    core._COSMOLOGY_CLASSES = {}  # set as empty dict\n\n    yield core._COSMOLOGY_CLASSES\n\n    core._COSMOLOGY_CLASSES = ORIGINAL_COSMOLOGY_CLASSES\n"},{"attributeType":"null","col":24,"comment":"null","endLoc":4,"id":14241,"name":"u","nodeType":"Attribute","startLoc":4,"text":"u"},{"col":0,"comment":"","endLoc":3,"header":"ecsv.py#<anonymous>","id":14242,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"readwrite_registry.register_reader(\"ascii.ecsv\", Cosmology, read_ecsv)\n\nreadwrite_registry.register_writer(\"ascii.ecsv\", Cosmology, write_ecsv)\n\nreadwrite_registry.register_identifier(\"ascii.ecsv\", Cosmology, ecsv_identify)"},{"col":0,"comment":"Get redshift methods from a cosmology.\n\n    Parameters\n    ----------\n    cosmology : |Cosmology| class or instance\n\n    Returns\n    -------\n    set[str]\n    ","endLoc":66,"header":"def get_redshift_methods(cosmology, allow_private=True, allow_z2=True)","id":14243,"name":"get_redshift_methods","nodeType":"Function","startLoc":22,"text":"def get_redshift_methods(cosmology, allow_private=True, allow_z2=True):\n    \"\"\"Get redshift methods from a cosmology.\n\n    Parameters\n    ----------\n    cosmology : |Cosmology| class or instance\n\n    Returns\n    -------\n    set[str]\n    \"\"\"\n    methods = set()\n    for n in dir(cosmology):\n        try:  # get method, some will error on ABCs\n            m = getattr(cosmology, n)\n        except NotImplementedError:\n            continue\n\n        # Add anything callable, optionally excluding private methods.\n        if callable(m) and (not n.startswith('_') or allow_private):\n            methods.add(n)\n\n    # Sieve out incompatible methods.\n    # The index to check for redshift depends on whether cosmology is a class\n    # or instance and does/doesn't include 'self'.\n    iz1 = 1 if inspect.isclass(cosmology) else 0\n    for n in tuple(methods):\n        try:\n            sig = inspect.signature(getattr(cosmology, n))\n        except ValueError:  # Remove non-introspectable methods.\n            methods.discard(n)\n            continue\n        else:\n            params = list(sig.parameters.keys())\n\n        # Remove non redshift methods:\n        if len(params) <= iz1:  # Check there are enough arguments.\n            methods.discard(n)\n        elif len(params) >= iz1 + 1 and not params[iz1].startswith(\"z\"):  # First non-self arg is z.\n            methods.discard(n)\n        # If methods with 2 z args are not allowed, the following arg is checked.\n        elif not allow_z2 and (len(params) >= iz1 + 2) and params[iz1 + 1].startswith(\"z\"):\n            methods.discard(n)\n\n    return methods"},{"id":14244,"name":"astropy/cosmology/tests/mypackage","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/cosmology/tests/mypackage","id":14245,"nodeType":"File","text":"from . import cosmology, io\n"},{"fileName":"cosmology.py","filePath":"astropy/cosmology/tests/mypackage","id":14246,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n\n\"\"\"Cosmology classes and instances for package ``mypackage``.\"\"\"\n\n# STDLIB\nfrom collections import UserDict\n\n# THIRD PARTY\nimport numpy as np\n\n\nclass MyCosmology(UserDict):\n    \"\"\"Cosmology, from ``mypackage``.\n\n    Parameters\n    ----------\n    **kw\n        values for `MyCosmology`.\n    \"\"\"\n\n    def __init__(self, **kw):\n        super().__init__()\n        self.update(kw)\n\n    def __getattr__(self, key):\n        \"\"\"Get attributes like items.\"\"\"\n        if key in self:\n            return self[key]\n        super().__getattribute__(key)\n\n    def age_in_Gyr(z):\n        \"\"\"Cosmology age in Gyr. Returns `NotImplemented`.\"\"\"\n        return NotImplemented\n\n    def __eq__(self, other):\n        \"\"\"Equality check.\"\"\"\n        if not isinstance(other, MyCosmology):\n            return NotImplemented\n        return all(np.all(v == other[k]) for k, v in self.items())\n\n\nmyplanck = MyCosmology(\n    name=\"planck\",\n    hubble_parameter=67.66,  # km/s/Mpc\n    initial_dm_density=0.2607,  # X/rho_critical\n    initial_baryon_density=0.04897,  # X/rho_critical\n    initial_matter_density=0.30966,  # X/rho_critical\n    n=0.9665,\n    sigma8=0.8102,\n    z_reionization=7.82,  # redshift\n    current_age=13.787,  # Gyr\n    initial_temperature=2.7255,  # Kelvin\n    Neff=3.046,\n    neutrino_masses=[0., 0., 0.06],  # eV\n)\n"},{"className":"MyCosmology","col":0,"comment":"Cosmology, from ``mypackage``.\n\n    Parameters\n    ----------\n    **kw\n        values for `MyCosmology`.\n    ","endLoc":39,"id":14247,"nodeType":"Class","startLoc":12,"text":"class MyCosmology(UserDict):\n    \"\"\"Cosmology, from ``mypackage``.\n\n    Parameters\n    ----------\n    **kw\n        values for `MyCosmology`.\n    \"\"\"\n\n    def __init__(self, **kw):\n        super().__init__()\n        self.update(kw)\n\n    def __getattr__(self, key):\n        \"\"\"Get attributes like items.\"\"\"\n        if key in self:\n            return self[key]\n        super().__getattribute__(key)\n\n    def age_in_Gyr(z):\n        \"\"\"Cosmology age in Gyr. Returns `NotImplemented`.\"\"\"\n        return NotImplemented\n\n    def __eq__(self, other):\n        \"\"\"Equality check.\"\"\"\n        if not isinstance(other, MyCosmology):\n            return NotImplemented\n        return all(np.all(v == other[k]) for k, v in self.items())"},{"col":4,"comment":"null","endLoc":23,"header":"def __init__(self, **kw)","id":14248,"name":"__init__","nodeType":"Function","startLoc":21,"text":"def __init__(self, **kw):\n        super().__init__()\n        self.update(kw)"},{"col":0,"comment":"Load |Cosmology| from `~astropy.modeling.Model` object.\n\n    Parameters\n    ----------\n    model : `_CosmologyModel` subclass instance\n        See ``Cosmology.to_format.help(\"astropy.model\") for details.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n\n    Examples\n    --------\n    >>> from astropy.cosmology import Cosmology, Planck18\n    >>> model = Planck18.to_format(\"astropy.model\", method=\"lookback_time\")\n    >>> Cosmology.from_format(model)\n    FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                  Tcmb0=2.7255 K, Neff=3.046, m_nu=[0. 0. 0.06] eV, Ob0=0.04897)\n    ","endLoc":163,"header":"def from_model(model)","id":14249,"name":"from_model","nodeType":"Function","startLoc":130,"text":"def from_model(model):\n    \"\"\"Load |Cosmology| from `~astropy.modeling.Model` object.\n\n    Parameters\n    ----------\n    model : `_CosmologyModel` subclass instance\n        See ``Cosmology.to_format.help(\"astropy.model\") for details.\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology` subclass instance\n\n    Examples\n    --------\n    >>> from astropy.cosmology import Cosmology, Planck18\n    >>> model = Planck18.to_format(\"astropy.model\", method=\"lookback_time\")\n    >>> Cosmology.from_format(model)\n    FlatLambdaCDM(name=\"Planck18\", H0=67.66 km / (Mpc s), Om0=0.30966,\n                  Tcmb0=2.7255 K, Neff=3.046, m_nu=[0. 0. 0.06] eV, Ob0=0.04897)\n    \"\"\"\n    cosmology = model.cosmology_class\n    meta = copy.deepcopy(model.meta)\n\n    # assemble the Parameters\n    params = {}\n    for n in model.param_names:\n        p = getattr(model, n)\n        params[p.name] = p.quantity if p.unit else p.value\n        # put all attributes in a dict\n        meta[p.name] = {n: getattr(p, n) for n in dir(p)\n                        if not (n.startswith(\"_\") or callable(getattr(p, n)))}\n\n    ba = cosmology._init_signature.bind(name=model.name, **params, meta=meta)\n    return cosmology(*ba.args, **ba.kwargs)"},{"col":4,"comment":"Get attributes like items.","endLoc":29,"header":"def __getattr__(self, key)","id":14250,"name":"__getattr__","nodeType":"Function","startLoc":25,"text":"def __getattr__(self, key):\n        \"\"\"Get attributes like items.\"\"\"\n        if key in self:\n            return self[key]\n        super().__getattribute__(key)"},{"col":4,"comment":"Cosmology age in Gyr. Returns `NotImplemented`.","endLoc":33,"header":"def age_in_Gyr(z)","id":14251,"name":"age_in_Gyr","nodeType":"Function","startLoc":31,"text":"def age_in_Gyr(z):\n        \"\"\"Cosmology age in Gyr. Returns `NotImplemented`.\"\"\"\n        return NotImplemented"},{"col":4,"comment":"Neutrino density function relative to the energy density in photons.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        f : ndarray or float\n            The neutrino density scaling factor relative to the density in\n            photons at each redshift.\n            Only returns `float` if z is scalar.\n\n        Notes\n        -----\n        The density in neutrinos is given by\n\n        .. math::\n\n           \\rho_{\\nu} \\left(a\\right) = 0.2271 \\, N_{eff} \\,\n           f\\left(m_{\\nu} a / T_{\\nu 0} \\right) \\,\n           \\rho_{\\gamma} \\left( a \\right)\n\n        where\n\n        .. math::\n\n           f \\left(y\\right) = \\frac{120}{7 \\pi^4}\n           \\int_0^{\\infty} \\, dx \\frac{x^2 \\sqrt{x^2 + y^2}}\n           {e^x + 1}\n\n        assuming that all neutrino species have the same mass.\n        If they have different masses, a similar term is calculated for each\n        one. Note that ``f`` has the asymptotic behavior :math:`f(0) = 1`. This\n        method returns :math:`0.2271 f` using an analytical fitting formula\n        given in Komatsu et al. 2011, ApJS 192, 18.\n        ","endLoc":628,"header":"def nu_relative_density(self, z)","id":14252,"name":"nu_relative_density","nodeType":"Function","startLoc":564,"text":"def nu_relative_density(self, z):\n        r\"\"\"Neutrino density function relative to the energy density in photons.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        f : ndarray or float\n            The neutrino density scaling factor relative to the density in\n            photons at each redshift.\n            Only returns `float` if z is scalar.\n\n        Notes\n        -----\n        The density in neutrinos is given by\n\n        .. math::\n\n           \\rho_{\\nu} \\left(a\\right) = 0.2271 \\, N_{eff} \\,\n           f\\left(m_{\\nu} a / T_{\\nu 0} \\right) \\,\n           \\rho_{\\gamma} \\left( a \\right)\n\n        where\n\n        .. math::\n\n           f \\left(y\\right) = \\frac{120}{7 \\pi^4}\n           \\int_0^{\\infty} \\, dx \\frac{x^2 \\sqrt{x^2 + y^2}}\n           {e^x + 1}\n\n        assuming that all neutrino species have the same mass.\n        If they have different masses, a similar term is calculated for each\n        one. Note that ``f`` has the asymptotic behavior :math:`f(0) = 1`. This\n        method returns :math:`0.2271 f` using an analytical fitting formula\n        given in Komatsu et al. 2011, ApJS 192, 18.\n        \"\"\"\n        # Note that there is also a scalar-z-only cython implementation of\n        # this in scalar_inv_efuncs.pyx, so if you find a problem in this\n        # you need to update there too.\n\n        # See Komatsu et al. 2011, eq 26 and the surrounding discussion\n        # for an explanation of what we are doing here.\n        # However, this is modified to handle multiple neutrino masses\n        # by computing the above for each mass, then summing\n        prefac = 0.22710731766  # 7/8 (4/11)^4/3 -- see any cosmo book\n\n        # The massive and massless contribution must be handled separately\n        # But check for common cases first\n        z = aszarr(z)\n        if not self._massivenu:\n            return prefac * self._Neff * (np.ones(z.shape) if hasattr(z, \"shape\") else 1.0)\n\n        # These are purely fitting constants -- see the Komatsu paper\n        p = 1.83\n        invp = 0.54644808743  # 1.0 / p\n        k = 0.3173\n\n        curr_nu_y = self._nu_y / (1. + np.expand_dims(z, axis=-1))\n        rel_mass_per = (1.0 + (k * curr_nu_y) ** p) ** invp\n        rel_mass = rel_mass_per.sum(-1) + self._nmasslessnu\n\n        return prefac * self._neff_per_nu * rel_mass"},{"col":4,"comment":"Equality check.","endLoc":39,"header":"def __eq__(self, other)","id":14253,"name":"__eq__","nodeType":"Function","startLoc":35,"text":"def __eq__(self, other):\n        \"\"\"Equality check.\"\"\"\n        if not isinstance(other, MyCosmology):\n            return NotImplemented\n        return all(np.all(v == other[k]) for k, v in self.items())"},{"col":0,"comment":"null","endLoc":80,"header":"@pytest.fixture\ndef clean_registry()","id":14254,"name":"clean_registry","nodeType":"Function","startLoc":72,"text":"@pytest.fixture\ndef clean_registry():\n    # TODO! with monkeypatch instead for thread safety.\n    ORIGINAL_COSMOLOGY_CLASSES = core._COSMOLOGY_CLASSES\n    core._COSMOLOGY_CLASSES = {}  # set as empty dict\n\n    yield core._COSMOLOGY_CLASSES\n\n    core._COSMOLOGY_CLASSES = ORIGINAL_COSMOLOGY_CLASSES"},{"col":0,"comment":"","endLoc":3,"header":"conftest.py#<anonymous>","id":14255,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"Configure the tests for :mod:`astropy.cosmology`.\"\"\""},{"id":14256,"name":"astropy/cosmology/tests/mypackage/io","nodeType":"Package"},{"fileName":"astropy_convert.py","filePath":"astropy/cosmology/tests/mypackage/io","id":14257,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see Astropy LICENSE.rst\n\n\"\"\"\nRegister conversion methods for cosmology objects with Astropy Cosmology.\n\nWith this registered, we can start with a Cosmology from\n``mypackage`` and convert it to an astropy Cosmology instance.\n\n    >>> from mypackage.cosmology import myplanck\n    >>> from astropy.cosmology import Cosmology\n    >>> cosmo = Cosmology.from_format(myplanck, format=\"mypackage\")\n    >>> cosmo\n\nWe can also do the reverse: start with an astropy Cosmology and convert it\nto a ``mypackage`` object.\n\n    >>> from astropy.cosmology import Planck18\n    >>> myplanck = Planck18.to_format(\"mypackage\")\n    >>> myplanck\n\n\"\"\"\n\n# THIRD PARTY\nimport astropy.cosmology.units as cu\nimport astropy.units as u\nfrom astropy.cosmology import FLRW, Cosmology, FlatLambdaCDM\nfrom astropy.cosmology.connect import convert_registry\n\n# LOCAL\nfrom mypackage.cosmology import MyCosmology\n\n__doctest_skip__ = ['*']\n\n\ndef from_mypackage(mycosmo):\n    \"\"\"Load `~astropy.cosmology.Cosmology` from ``mypackage`` object.\n\n    Parameters\n    ----------\n    mycosmo : `~mypackage.cosmology.MyCosmology`\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology`\n    \"\"\"\n    m = dict(mycosmo)\n    m[\"name\"] = mycosmo.name\n\n    # ----------------\n    # remap Parameters\n    m[\"H0\"] = m.pop(\"hubble_parameter\") * (u.km / u.s / u.Mpc)\n    m[\"Om0\"] = m.pop(\"initial_matter_density\")\n    m[\"Tcmb0\"] = m.pop(\"initial_temperature\") * u.K\n    # m[\"Neff\"] = m.pop(\"Neff\")  # skip b/c unchanged\n    m[\"m_nu\"] = m.pop(\"neutrino_masses\") * u.eV\n    m[\"Ob0\"] = m.pop(\"initial_baryon_density\")\n\n    # ----------------\n    # remap metadata\n    m[\"t0\"] = m.pop(\"current_age\") * u.Gyr\n\n    # optional\n    if \"reionization_redshift\" in m:\n        m[\"z_reion\"] = m.pop(\"reionization_redshift\")\n\n    # ...  # keep building `m`\n\n    # ----------------\n    # Detect which type of Astropy cosmology to build.\n    # TODO! CUSTOMIZE FOR DETECTION\n    # Here we just force FlatLambdaCDM, but if your package allows for\n    # non-flat cosmologies...\n    m[\"cosmology\"] = FlatLambdaCDM\n\n    # build cosmology\n    return Cosmology.from_format(m, format=\"mapping\", move_to_meta=True)\n\n\ndef to_mypackage(cosmology, *args):\n    \"\"\"Return the cosmology as a ``mycosmo``.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology`\n\n    Returns\n    -------\n    `~mypackage.cosmology.MyCosmology`\n    \"\"\"\n    if not isinstance(cosmology, FLRW):\n        raise TypeError(\"format 'mypackage' only supports FLRW cosmologies.\")\n\n    # ----------------\n    # Cosmology provides a nice method \"mapping\", so all that needs to\n    # be done here is initialize from the dictionary\n    m = cosmology.to_format(\"mapping\")\n\n    # Detect which type of MyCosmology to build.\n    # Here we have forced FlatLambdaCDM, but if your package allows for\n    # non-flat cosmologies...\n    m.pop(\"cosmology\")\n\n    # MyCosmology doesn't support metadata. If your cosmology class does...\n    meta = m.pop(\"meta\")\n    m = {**meta, **m}  # merge, preferring current values\n\n    # ----------------\n    # remap values\n    # MyCosmology doesn't support units, so take values.\n    m[\"hubble_parameter\"] = m.pop(\"H0\").to_value(u.km/u.s/u.Mpc)\n    m[\"initial_matter_density\"] = m.pop(\"Om0\")\n    m[\"initial_temperature\"] = m.pop(\"Tcmb0\").to_value(u.K)\n    # m[\"Neff\"] = m.pop(\"Neff\")  # skip b/c unchanged\n    m[\"neutrino_masses\"] = m.pop(\"m_nu\").to_value(u.eV)\n    m[\"initial_baryon_density\"] = m.pop(\"Ob0\")\n    m[\"current_age\"] = m.pop(\"t0\", cosmology.age(0 * cu.redshift)).to_value(u.Gyr)\n\n    # optional\n    if \"z_reion\" in m:\n        m[\"reionization_redshift\"] = (m.pop(\"z_reion\") << cu.redshift).value\n\n    # ...  # keep remapping\n\n    return MyCosmology(**m)\n\n\ndef mypackage_identify(origin, format, *args, **kwargs):\n    \"\"\"Identify if object uses format \"mypackage\".\"\"\"\n    itis = False\n    if origin == \"read\":\n        itis = isinstance(args[1], MyCosmology) and (format in (None, \"mypackage\"))\n    return itis\n\n\n# -------------------------------------------------------------------\n# Register to/from_format & identify methods with Astropy Unified I/O\n\nconvert_registry.register_reader(\"mypackage\", Cosmology, from_mypackage, force=True)\nconvert_registry.register_writer(\"mypackage\", Cosmology, to_mypackage, force=True)\nconvert_registry.register_identifier(\"mypackage\", Cosmology, mypackage_identify, force=True)\n"},{"col":4,"comment":"Convert Cosmology to format using function ``to``.","endLoc":162,"header":"@pytest.fixture(scope=\"class\")\n    def to_format(self, cosmo)","id":14258,"name":"to_format","nodeType":"Function","startLoc":156,"text":"@pytest.fixture(scope=\"class\")\n    def to_format(self, cosmo):\n        \"\"\"Convert Cosmology to format using function ``to``.\"\"\"\n        def use_to_format(*args, **kwargs):\n            return self.functions[\"to\"](cosmo, *args, **kwargs)\n\n        return use_to_format"},{"className":"FlatLambdaCDM","col":0,"comment":"FLRW cosmology with a cosmological constant and no curvature.\n\n    This has no additional attributes beyond those of FLRW.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import FlatLambdaCDM\n    >>> cosmo = FlatLambdaCDM(H0=70, Om0=0.3)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n    ","endLoc":2139,"id":14259,"nodeType":"Class","startLoc":2020,"text":"class FlatLambdaCDM(FlatFLRWMixin, LambdaCDM):\n    \"\"\"FLRW cosmology with a cosmological constant and no curvature.\n\n    This has no additional attributes beyond those of FLRW.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import FlatLambdaCDM\n    >>> cosmo = FlatLambdaCDM(H0=70, Om0=0.3)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n    \"\"\"\n\n    def __init__(self, H0, Om0, Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV,\n                 Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=0.0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.flcdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0)\n            # Repeat the optimization reassignments here because the init\n            # of the LambaCDM above didn't actually create a flat cosmology.\n            # That was done through the explicit tweak setting self._Ok0.\n            self._optimize_flat_norad()\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.flcdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0 + self._Onu0)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.flcdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list)\n\n    def efunc(self, z):\n        \"\"\"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        \"\"\"\n        # We override this because it takes a particularly simple\n        # form for a cosmological constant\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return np.sqrt(zp1 ** 3 * (Or * zp1 + self._Om0) + self._Ode0)\n\n    def inv_efunc(self, z):\n        r\"\"\"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The inverse redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n        return (zp1 ** 3 * (Or * zp1 + self._Om0) + self._Ode0)**(-0.5)"},{"col":0,"comment":"Convert a `~astropy.cosmology.Cosmology` to a `~astropy.modeling.Model`.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    method : str, keyword-only\n        The name of the method on the ``cosmology``.\n\n    Returns\n    -------\n    `_CosmologyModel` subclass instance\n        The Model wraps the |Cosmology| method, converting each non-`None`\n        :class:`~astropy.cosmology.Parameter` to a\n        :class:`astropy.modeling.Model` :class:`~astropy.modeling.Parameter`\n        and the method to the model's ``__call__ / evaluate``.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import Planck18\n    >>> model = Planck18.to_format(\"astropy.model\", method=\"lookback_time\")\n    >>> model\n    <FlatLambdaCDMCosmologyLookbackTimeModel(H0=67.66 km / (Mpc s), Om0=0.30966,\n        Tcmb0=2.7255 K, Neff=3.046, m_nu=[0.  , 0.  , 0.06] eV, Ob0=0.04897,\n        name='Planck18')>\n    ","endLoc":239,"header":"def to_model(cosmology, *_, method)","id":14260,"name":"to_model","nodeType":"Function","startLoc":166,"text":"def to_model(cosmology, *_, method):\n    \"\"\"Convert a `~astropy.cosmology.Cosmology` to a `~astropy.modeling.Model`.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` subclass instance\n    method : str, keyword-only\n        The name of the method on the ``cosmology``.\n\n    Returns\n    -------\n    `_CosmologyModel` subclass instance\n        The Model wraps the |Cosmology| method, converting each non-`None`\n        :class:`~astropy.cosmology.Parameter` to a\n        :class:`astropy.modeling.Model` :class:`~astropy.modeling.Parameter`\n        and the method to the model's ``__call__ / evaluate``.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import Planck18\n    >>> model = Planck18.to_format(\"astropy.model\", method=\"lookback_time\")\n    >>> model\n    <FlatLambdaCDMCosmologyLookbackTimeModel(H0=67.66 km / (Mpc s), Om0=0.30966,\n        Tcmb0=2.7255 K, Neff=3.046, m_nu=[0.  , 0.  , 0.06] eV, Ob0=0.04897,\n        name='Planck18')>\n    \"\"\"\n    cosmo_cls = cosmology.__class__\n\n    # get bound method & sig from cosmology (unbound if class).\n    if not hasattr(cosmology, method):\n        raise AttributeError(f\"{method} is not a method on {cosmology.__class__}.\")\n    func = getattr(cosmology, method)\n    if not callable(func):\n        raise ValueError(f\"{cosmology.__class__}.{method} is not callable.\")\n    msig = inspect.signature(func)\n\n    # introspect for number of positional inputs, ignoring \"self\"\n    n_inputs = len([p for p in tuple(msig.parameters.values()) if (p.kind in (0, 1))])\n\n    attrs = {}  # class attributes\n    attrs[\"_cosmology_class\"] = cosmo_cls\n    attrs[\"_method_name\"] = method\n    attrs[\"n_inputs\"] = n_inputs\n    attrs[\"n_outputs\"] = 1\n\n    params = {}  # Parameters (also class attributes)\n    for n in cosmology.__parameters__:\n        v = getattr(cosmology, n)  # parameter value\n\n        if v is None:  # skip unspecified parameters\n            continue\n\n        # add as Model Parameter\n        params[n] = convert_parameter_to_model_parameter(getattr(cosmo_cls, n), v,\n                                                         cosmology.meta.get(n))\n\n    # class name is cosmology name + Cosmology + method name + Model\n    clsname = (cosmo_cls.__qualname__.replace(\".\", \"_\")\n               + \"Cosmology\"\n               + method.replace(\"_\", \" \").title().replace(\" \", \"\")\n               + \"Model\")\n\n    # make Model class\n    CosmoModel = type(clsname, (_CosmologyModel, ), {**attrs, **params})\n    # override __signature__ and format the doc.\n    setattr(CosmoModel.evaluate, \"__signature__\", msig)\n    CosmoModel.evaluate.__doc__ = CosmoModel.evaluate.__doc__.format(\n        cosmo_cls=cosmo_cls.__qualname__, method=method)\n\n    # instantiate class using default values\n    ps = {n: getattr(cosmology, n) for n in params.keys()}\n    model = CosmoModel(**ps, name=cosmology.name, meta=copy.deepcopy(cosmology.meta))\n\n    return model"},{"attributeType":"null","col":16,"comment":"null","endLoc":9,"id":14261,"name":"np","nodeType":"Attribute","startLoc":9,"text":"np"},{"className":"FlatFLRWMixin","col":0,"comment":"\n    Mixin class for flat FLRW cosmologies. Do NOT instantiate directly.\n    Must precede the base class in the multiple-inheritance so that this\n    mixin's ``__init__`` proceeds the base class'.\n    Note that all instances of ``FlatFLRWMixin`` are flat, but not all\n    flat cosmologies are instances of ``FlatFLRWMixin``. As example,\n    ``LambdaCDM`` **may** be flat (for the a specific set of parameter values),\n    but ``FlatLambdaCDM`` **will** be flat.\n    ","endLoc":1494,"id":14262,"nodeType":"Class","startLoc":1412,"text":"class FlatFLRWMixin(FlatCosmologyMixin):\n    \"\"\"\n    Mixin class for flat FLRW cosmologies. Do NOT instantiate directly.\n    Must precede the base class in the multiple-inheritance so that this\n    mixin's ``__init__`` proceeds the base class'.\n    Note that all instances of ``FlatFLRWMixin`` are flat, but not all\n    flat cosmologies are instances of ``FlatFLRWMixin``. As example,\n    ``LambdaCDM`` **may** be flat (for the a specific set of parameter values),\n    but ``FlatLambdaCDM`` **will** be flat.\n    \"\"\"\n\n    Ode0 = FLRW.Ode0.clone(derived=True)  # same as FLRW, but now a derived param.\n\n    def __init_subclass__(cls):\n        super().__init_subclass__()\n        if \"Ode0\" in cls._init_signature.parameters:\n            raise TypeError(\"subclasses of `FlatFLRWMixin` cannot have `Ode0` in `__init__`\")\n\n    def __init__(self, *args, **kw):\n        super().__init__(*args, **kw)  # guaranteed not to have `Ode0`\n        # Do some twiddling after the fact to get flatness\n        self._Ok0 = 0.0\n        self._Ode0 = 1.0 - (self._Om0 + self._Ogamma0 + self._Onu0 + self._Ok0)\n\n    @property\n    def Otot0(self):\n        \"\"\"Omega total; the total density/critical density at z=0.\"\"\"\n        return 1.0\n\n    def Otot(self, z):\n        \"\"\"The total density parameter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        Otot : ndarray or float\n            Returns float if input scalar. Value of 1.\n        \"\"\"\n        return 1.0 if isinstance(z, (Number, np.generic)) else np.ones_like(z, subok=False)\n\n    def __equiv__(self, other):\n        \"\"\"flat-FLRW equivalence. Use ``.is_equivalent()`` for actual check!\n\n        Parameters\n        ----------\n        other : `~astropy.cosmology.FLRW` subclass instance\n            The object in which to compare.\n\n        Returns\n        -------\n        bool or `NotImplemented`\n            `True` if 'other' is of the same class / non-flat class (e.g.\n            ``FlatLambdaCDM`` and ``LambdaCDM``) has matching parameters\n            and parameter values. `False` if 'other' is of the same class but\n            has different parameters. `NotImplemented` otherwise.\n        \"\"\"\n        # check if case (1): same class & parameters\n        if isinstance(other, FlatFLRWMixin):\n            return super().__equiv__(other)\n\n        # check cases (3, 4), if other is the non-flat version of this class\n        # this makes the assumption that any further subclass of a flat cosmo\n        # keeps the same physics.\n        comparable_classes = [c for c in self.__class__.mro()[1:]\n                              if (issubclass(c, FLRW) and c is not FLRW)]\n        if other.__class__ not in comparable_classes:\n            return NotImplemented\n\n        # check if have equivalent parameters\n        # check all parameters in other match those in 'self' and 'other' has\n        # no extra parameters (case (2)) except for 'Ode0' and that other\n        params_eq = (\n            set(self.__all_parameters__) == set(other.__all_parameters__) # no extra\n            and all(np.all(getattr(self, k) == getattr(other, k))  # equal\n                    for k in self.__parameters__)\n            and other.is_flat\n        )\n\n        return params_eq"},{"attributeType":"MyCosmology","col":0,"comment":"null","endLoc":42,"id":14263,"name":"myplanck","nodeType":"Attribute","startLoc":42,"text":"myplanck"},{"col":4,"comment":"null","endLoc":1428,"header":"def __init_subclass__(cls)","id":14264,"name":"__init_subclass__","nodeType":"Function","startLoc":1425,"text":"def __init_subclass__(cls):\n        super().__init_subclass__()\n        if \"Ode0\" in cls._init_signature.parameters:\n            raise TypeError(\"subclasses of `FlatFLRWMixin` cannot have `Ode0` in `__init__`\")"},{"col":4,"comment":"Return bool; `True` if the cosmology is flat.","endLoc":269,"header":"@property\n    def is_flat(self)","id":14265,"name":"is_flat","nodeType":"Function","startLoc":266,"text":"@property\n    def is_flat(self):\n        \"\"\"Return bool; `True` if the cosmology is flat.\"\"\"\n        return bool((self._Ok0 == 0.0) and (self.Otot0 == 1.0))"},{"col":4,"comment":"Omega total; the total density/critical density at z=0.","endLoc":274,"header":"@property\n    def Otot0(self)","id":14266,"name":"Otot0","nodeType":"Function","startLoc":271,"text":"@property\n    def Otot0(self):\n        \"\"\"Omega total; the total density/critical density at z=0.\"\"\"\n        return self._Om0 + self._Ogamma0 + self._Onu0 + self._Ode0 + self._Ok0"},{"col":4,"comment":"Omega dark matter; dark matter density/critical density at z=0.","endLoc":279,"header":"@property\n    def Odm0(self)","id":14267,"name":"Odm0","nodeType":"Function","startLoc":276,"text":"@property\n    def Odm0(self):\n        \"\"\"Omega dark matter; dark matter density/critical density at z=0.\"\"\"\n        return self._Odm0"},{"col":4,"comment":"Omega curvature; the effective curvature density/critical density at z=0.","endLoc":284,"header":"@property\n    def Ok0(self)","id":14268,"name":"Ok0","nodeType":"Function","startLoc":281,"text":"@property\n    def Ok0(self):\n        \"\"\"Omega curvature; the effective curvature density/critical density at z=0.\"\"\"\n        return self._Ok0"},{"col":4,"comment":"Temperature of the neutrino background as `~astropy.units.Quantity` at z=0.","endLoc":289,"header":"@property\n    def Tnu0(self)","id":14269,"name":"Tnu0","nodeType":"Function","startLoc":286,"text":"@property\n    def Tnu0(self):\n        \"\"\"Temperature of the neutrino background as `~astropy.units.Quantity` at z=0.\"\"\"\n        return self._Tnu0"},{"col":4,"comment":"Does this cosmology have at least one massive neutrino species?","endLoc":296,"header":"@property\n    def has_massive_nu(self)","id":14270,"name":"has_massive_nu","nodeType":"Function","startLoc":291,"text":"@property\n    def has_massive_nu(self):\n        \"\"\"Does this cosmology have at least one massive neutrino species?\"\"\"\n        if self._Tnu0.value == 0:\n            return False\n        return self._massivenu"},{"col":4,"comment":"Dimensionless Hubble constant: h = H_0 / 100 [km/sec/Mpc].","endLoc":301,"header":"@property\n    def h(self)","id":14271,"name":"h","nodeType":"Function","startLoc":298,"text":"@property\n    def h(self):\n        \"\"\"Dimensionless Hubble constant: h = H_0 / 100 [km/sec/Mpc].\"\"\"\n        return self._h"},{"col":4,"comment":"Hubble time as `~astropy.units.Quantity`.","endLoc":306,"header":"@property\n    def hubble_time(self)","id":14272,"name":"hubble_time","nodeType":"Function","startLoc":303,"text":"@property\n    def hubble_time(self):\n        \"\"\"Hubble time as `~astropy.units.Quantity`.\"\"\"\n        return self._hubble_time"},{"col":4,"comment":"Hubble distance as `~astropy.units.Quantity`.","endLoc":311,"header":"@property\n    def hubble_distance(self)","id":14273,"name":"hubble_distance","nodeType":"Function","startLoc":308,"text":"@property\n    def hubble_distance(self):\n        \"\"\"Hubble distance as `~astropy.units.Quantity`.\"\"\"\n        return self._hubble_distance"},{"col":4,"comment":"Critical density as `~astropy.units.Quantity` at z=0.","endLoc":316,"header":"@property\n    def critical_density0(self)","id":14274,"name":"critical_density0","nodeType":"Function","startLoc":313,"text":"@property\n    def critical_density0(self):\n        \"\"\"Critical density as `~astropy.units.Quantity` at z=0.\"\"\"\n        return self._critical_density0"},{"col":4,"comment":"Omega gamma; the density/critical density of photons at z=0.","endLoc":321,"header":"@property\n    def Ogamma0(self)","id":14275,"name":"Ogamma0","nodeType":"Function","startLoc":318,"text":"@property\n    def Ogamma0(self):\n        \"\"\"Omega gamma; the density/critical density of photons at z=0.\"\"\"\n        return self._Ogamma0"},{"className":"ReadWriteDirectTestBase","col":0,"comment":"Directly test ``read/write_<format>``.\n\n    These functions are not public API and are discouraged from public use, in\n    favor of ``Cosmology.read/write(..., format=\"<format>\")``. They are tested\n    because they are used internally and because some tests for the\n    methods on |Cosmology| don't need to be run in the |Cosmology| class's\n    large test matrix.\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass.\n\n    Subclasses should have an attribute ``functions`` which is a dictionary\n    containing two items: ``\"read\"=<function for read>`` and\n    ``\"write\"=<function for write>``.\n    ","endLoc":198,"id":14276,"nodeType":"Class","startLoc":165,"text":"class ReadWriteDirectTestBase(IODirectTestBase, ToFromTestMixinBase):\n    \"\"\"Directly test ``read/write_<format>``.\n\n    These functions are not public API and are discouraged from public use, in\n    favor of ``Cosmology.read/write(..., format=\"<format>\")``. They are tested\n    because they are used internally and because some tests for the\n    methods on |Cosmology| don't need to be run in the |Cosmology| class's\n    large test matrix.\n\n    This class will not be directly called by :mod:`pytest` since its name does\n    not begin with ``Test``. To activate the contained tests this class must\n    be inherited in a subclass.\n\n    Subclasses should have an attribute ``functions`` which is a dictionary\n    containing two items: ``\"read\"=<function for read>`` and\n    ``\"write\"=<function for write>``.\n    \"\"\"\n\n    @pytest.fixture(scope=\"class\")\n    def read(self):\n        \"\"\"Read Cosmology from file using function ``read``.\"\"\"\n        def use_read(*args, **kwargs):\n            kwargs.pop(\"format\", None)  # specific to Cosmology.from_format\n            return self.functions[\"read\"](*args, **kwargs)\n\n        return use_read\n\n    @pytest.fixture(scope=\"class\")\n    def write(self, cosmo):\n        \"\"\"Write Cosmology to file using function ``write``.\"\"\"\n        def use_write(*args, **kwargs):\n            return self.functions[\"write\"](cosmo, *args, **kwargs)\n\n        return use_write"},{"col":4,"comment":"Omega nu; the density/critical density of neutrinos at z=0.","endLoc":326,"header":"@property\n    def Onu0(self)","id":14277,"name":"Onu0","nodeType":"Function","startLoc":323,"text":"@property\n    def Onu0(self):\n        \"\"\"Omega nu; the density/critical density of neutrinos at z=0.\"\"\"\n        return self._Onu0"},{"col":4,"comment":"The dark energy equation of state.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state.\n            `float` if scalar input.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1.\n\n        This must be overridden by subclasses.\n        ","endLoc":354,"header":"@abstractmethod\n    def w(self, z)","id":14278,"name":"w","nodeType":"Function","startLoc":330,"text":"@abstractmethod\n    def w(self, z):\n        r\"\"\"The dark energy equation of state.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state.\n            `float` if scalar input.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1.\n\n        This must be overridden by subclasses.\n        \"\"\"\n        raise NotImplementedError(\"w(z) is not implemented\")"},{"col":4,"comment":"The total density parameter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        Otot : ndarray or float\n            The total density relative to the critical density at each redshift.\n            Returns float if input scalar.\n        ","endLoc":370,"header":"def Otot(self, z)","id":14279,"name":"Otot","nodeType":"Function","startLoc":356,"text":"def Otot(self, z):\n        \"\"\"The total density parameter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        Otot : ndarray or float\n            The total density relative to the critical density at each redshift.\n            Returns float if input scalar.\n        \"\"\"\n        return self.Om(z) + self.Ogamma(z) + self.Onu(z) + self.Ode(z) + self.Ok(z)"},{"col":4,"comment":"Read Cosmology from file using function ``read``.","endLoc":190,"header":"@pytest.fixture(scope=\"class\")\n    def read(self)","id":14280,"name":"read","nodeType":"Function","startLoc":183,"text":"@pytest.fixture(scope=\"class\")\n    def read(self):\n        \"\"\"Read Cosmology from file using function ``read``.\"\"\"\n        def use_read(*args, **kwargs):\n            kwargs.pop(\"format\", None)  # specific to Cosmology.from_format\n            return self.functions[\"read\"](*args, **kwargs)\n\n        return use_read"},{"col":4,"comment":"null","endLoc":1434,"header":"def __init__(self, *args, **kw)","id":14281,"name":"__init__","nodeType":"Function","startLoc":1430,"text":"def __init__(self, *args, **kw):\n        super().__init__(*args, **kw)  # guaranteed not to have `Ode0`\n        # Do some twiddling after the fact to get flatness\n        self._Ok0 = 0.0\n        self._Ode0 = 1.0 - (self._Om0 + self._Ogamma0 + self._Onu0 + self._Ok0)"},{"col":4,"comment":"Omega total; the total density/critical density at z=0.","endLoc":1439,"header":"@property\n    def Otot0(self)","id":14282,"name":"Otot0","nodeType":"Function","startLoc":1436,"text":"@property\n    def Otot0(self):\n        \"\"\"Omega total; the total density/critical density at z=0.\"\"\"\n        return 1.0"},{"col":4,"comment":"The total density parameter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        Otot : ndarray or float\n            Returns float if input scalar. Value of 1.\n        ","endLoc":1454,"header":"def Otot(self, z)","id":14283,"name":"Otot","nodeType":"Function","startLoc":1441,"text":"def Otot(self, z):\n        \"\"\"The total density parameter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        Otot : ndarray or float\n            Returns float if input scalar. Value of 1.\n        \"\"\"\n        return 1.0 if isinstance(z, (Number, np.generic)) else np.ones_like(z, subok=False)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1680,"id":14284,"name":"n_inputs","nodeType":"Attribute","startLoc":1680,"text":"n_inputs"},{"col":4,"comment":"flat-FLRW equivalence. Use ``.is_equivalent()`` for actual check!\n\n        Parameters\n        ----------\n        other : `~astropy.cosmology.FLRW` subclass instance\n            The object in which to compare.\n\n        Returns\n        -------\n        bool or `NotImplemented`\n            `True` if 'other' is of the same class / non-flat class (e.g.\n            ``FlatLambdaCDM`` and ``LambdaCDM``) has matching parameters\n            and parameter values. `False` if 'other' is of the same class but\n            has different parameters. `NotImplemented` otherwise.\n        ","endLoc":1494,"header":"def __equiv__(self, other)","id":14285,"name":"__equiv__","nodeType":"Function","startLoc":1456,"text":"def __equiv__(self, other):\n        \"\"\"flat-FLRW equivalence. Use ``.is_equivalent()`` for actual check!\n\n        Parameters\n        ----------\n        other : `~astropy.cosmology.FLRW` subclass instance\n            The object in which to compare.\n\n        Returns\n        -------\n        bool or `NotImplemented`\n            `True` if 'other' is of the same class / non-flat class (e.g.\n            ``FlatLambdaCDM`` and ``LambdaCDM``) has matching parameters\n            and parameter values. `False` if 'other' is of the same class but\n            has different parameters. `NotImplemented` otherwise.\n        \"\"\"\n        # check if case (1): same class & parameters\n        if isinstance(other, FlatFLRWMixin):\n            return super().__equiv__(other)\n\n        # check cases (3, 4), if other is the non-flat version of this class\n        # this makes the assumption that any further subclass of a flat cosmo\n        # keeps the same physics.\n        comparable_classes = [c for c in self.__class__.mro()[1:]\n                              if (issubclass(c, FLRW) and c is not FLRW)]\n        if other.__class__ not in comparable_classes:\n            return NotImplemented\n\n        # check if have equivalent parameters\n        # check all parameters in other match those in 'self' and 'other' has\n        # no extra parameters (case (2)) except for 'Ode0' and that other\n        params_eq = (\n            set(self.__all_parameters__) == set(other.__all_parameters__) # no extra\n            and all(np.all(getattr(self, k) == getattr(other, k))  # equal\n                    for k in self.__parameters__)\n            and other.is_flat\n        )\n\n        return params_eq"},{"col":0,"comment":"","endLoc":3,"header":"cosmology.py#<anonymous>","id":14286,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"Cosmology classes and instances for package ``mypackage``.\"\"\"\n\nmyplanck = MyCosmology(\n    name=\"planck\",\n    hubble_parameter=67.66,  # km/s/Mpc\n    initial_dm_density=0.2607,  # X/rho_critical\n    initial_baryon_density=0.04897,  # X/rho_critical\n    initial_matter_density=0.30966,  # X/rho_critical\n    n=0.9665,\n    sigma8=0.8102,\n    z_reionization=7.82,  # redshift\n    current_age=13.787,  # Gyr\n    initial_temperature=2.7255,  # Kelvin\n    Neff=3.046,\n    neutrino_masses=[0., 0., 0.06],  # eV\n)"},{"col":4,"comment":"\n        Return the density parameter for non-relativistic matter\n        at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Om : ndarray or float\n            The density of non-relativistic matter relative to the critical\n            density at each redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        This does not include neutrinos, even if non-relativistic at the\n        redshift of interest; see `Onu`.\n        ","endLoc":395,"header":"def Om(self, z)","id":14287,"name":"Om","nodeType":"Function","startLoc":372,"text":"def Om(self, z):\n        \"\"\"\n        Return the density parameter for non-relativistic matter\n        at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Om : ndarray or float\n            The density of non-relativistic matter relative to the critical\n            density at each redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        This does not include neutrinos, even if non-relativistic at the\n        redshift of interest; see `Onu`.\n        \"\"\"\n        z = aszarr(z)\n        return self._Om0 * (z + 1.0) ** 3 * self.inv_efunc(z) ** 2"},{"fileName":"astropy_io.py","filePath":"astropy/cosmology/tests/mypackage/io","id":14288,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see Astropy LICENSE.rst\n\n\"\"\"\nRegister Read/Write methods for \"myformat\" (JSON) with Astropy Cosmology.\n\nWith this format registered, we can start with a Cosmology from\n``mypackage``, write it to a file, and read it with Astropy to create an\nastropy Cosmology instance.\n\n    >>> from mypackage.cosmology import myplanck\n    >>> from mypackage.io import file_writer\n    >>> file_writer('<file name>', myplanck)\n\n    >>> from astropy.cosmology import Cosmology\n    >>> cosmo = Cosmology.read('<file name>', format=\"myformat\")\n    >>> cosmo\n\nWe can also do the reverse: start with an astropy Cosmology, save it and\nread it with ``mypackage``.\n\n    >>> from astropy.cosmology import Planck18\n    >>> Planck18.write('<file name>', format=\"myformat\")\n\n    >>> from mypackage.io import file_reader\n    >>> cosmo2 = file_reader('<file name>')\n    >>> cosmo2\n\n\"\"\"\n\n# STDLIB\nimport json\nimport os\n\n# THIRD PARTY\nimport astropy.units as u\nfrom astropy.cosmology import Cosmology\nfrom astropy.cosmology.connect import readwrite_registry\n\n# LOCAL\nfrom .core import file_reader, file_writer\n\n__doctest_skip__ = ['*']\n\n\ndef read_myformat(filename, **kwargs):\n    \"\"\"Read files in format 'myformat'.\n\n    Parameters\n    ----------\n    filename : str\n    **kwargs\n        Keyword arguments into `astropy.cosmology.Cosmology.from_format`\n        with ``format=\"mypackage\"``.\n\n    Returns\n    -------\n    `~mypackage.cosmology.MyCosmology` instance\n    \"\"\"\n    mycosmo = file_reader(filename)  # ← read file  ↓ build Cosmology\n    return Cosmology.from_format(mycosmo, format=\"mypackage\", **kwargs)\n\n\ndef write_myformat(cosmology, file, *, overwrite=False):\n    \"\"\"Write files in format 'myformat'.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` instance\n    file : str, bytes, or `~os.PathLike`\n    overwrite : bool (optional, keyword-only)\n        Whether to overwrite an existing file. Default is False.\n    \"\"\"\n    cosmo = cosmology.to_format(\"mypackage\")  # ← convert Cosmology ↓ write file\n    file_writer(file, cosmo, overwrite=overwrite)\n\n\ndef myformat_identify(origin, filepath, fileobj, *args, **kwargs):\n    \"\"\"Identify if object uses ``myformat`` (JSON).\"\"\"\n    return filepath is not None and filepath.endswith(\".myformat\")\n\n\n# -------------------------------------------------------------------\n# Register read/write/identify methods with Astropy Unified I/O\n\nreadwrite_registry.register_reader(\"myformat\", Cosmology, read_myformat, force=True)\nreadwrite_registry.register_writer(\"myformat\", Cosmology, write_myformat, force=True)\nreadwrite_registry.register_identifier(\"myformat\", Cosmology, myformat_identify, force=True)\n"},{"col":4,"comment":"Write Cosmology to file using function ``write``.","endLoc":198,"header":"@pytest.fixture(scope=\"class\")\n    def write(self, cosmo)","id":14289,"name":"write","nodeType":"Function","startLoc":192,"text":"@pytest.fixture(scope=\"class\")\n    def write(self, cosmo):\n        \"\"\"Write Cosmology to file using function ``write``.\"\"\"\n        def use_write(*args, **kwargs):\n            return self.functions[\"write\"](cosmo, *args, **kwargs)\n\n        return use_write"},{"attributeType":"null","col":4,"comment":"null","endLoc":1681,"id":14290,"name":"n_outputs","nodeType":"Attribute","startLoc":1681,"text":"n_outputs"},{"col":4,"comment":"Inverse of ``efunc``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the inverse Hubble constant.\n            Returns `float` if the input is scalar.\n        ","endLoc":743,"header":"def inv_efunc(self, z)","id":14291,"name":"inv_efunc","nodeType":"Function","startLoc":723,"text":"def inv_efunc(self, z):\n        \"\"\"Inverse of ``efunc``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the inverse Hubble constant.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        # Avoid the function overhead by repeating code\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return (zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) +\n                self._Ode0 * self.de_density_scale(z))**(-0.5)"},{"col":0,"comment":"Read files in format 'myformat'.\n\n    Parameters\n    ----------\n    filename : str, bytes, or `~os.PathLike`\n\n    Returns\n    -------\n    `~mypackage.cosmology.MyCosmology` instance\n    ","endLoc":39,"header":"def file_reader(filename)","id":14292,"name":"file_reader","nodeType":"Function","startLoc":14,"text":"def file_reader(filename):\n    \"\"\"Read files in format 'myformat'.\n\n    Parameters\n    ----------\n    filename : str, bytes, or `~os.PathLike`\n\n    Returns\n    -------\n    `~mypackage.cosmology.MyCosmology` instance\n    \"\"\"\n    # read\n    if isinstance(filename, (str, bytes, os.PathLike)):\n        with open(filename, \"r\") as file:\n            data = file.read()\n    else:  # file-like : this also handles errors in dumping\n        data = filename.read()\n\n    mapping = json.loads(data)  # parse json mappable to dict\n\n    # deserialize list to ndarray\n    for k, v in mapping.items():\n        if isinstance(v, list):\n            mapping[k] = np.array(v)\n\n    return MyCosmology(**mapping)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1683,"id":14293,"name":"_separable","nodeType":"Attribute","startLoc":1683,"text":"_separable"},{"attributeType":"null","col":8,"comment":"null","endLoc":1687,"id":14294,"name":"_ap_order","nodeType":"Attribute","startLoc":1687,"text":"self._ap_order"},{"attributeType":"null","col":8,"comment":"null","endLoc":1690,"id":14295,"name":"_bp_coeff","nodeType":"Attribute","startLoc":1690,"text":"self._bp_coeff"},{"col":4,"comment":"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and is given by\n\n        .. math::\n\n           I = \\exp \\left( 3 \\int_{a}^1 \\frac{ da^{\\prime} }{ a^{\\prime} }\n                          \\left[ 1 + w\\left( a^{\\prime} \\right) \\right] \\right)\n\n        The actual integral used is rewritten from [1]_ to be in terms of z.\n\n        It will generally helpful for subclasses to overload this method if\n        the integral can be done analytically for the particular dark\n        energy equation of state that they implement.\n\n        References\n        ----------\n        .. [1] Linder, E. (2003). Exploring the Expansion History of the\n               Universe. Phys. Rev. Lett., 90, 091301.\n        ","endLoc":694,"header":"def de_density_scale(self, z)","id":14296,"name":"de_density_scale","nodeType":"Function","startLoc":646,"text":"def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and is given by\n\n        .. math::\n\n           I = \\exp \\left( 3 \\int_{a}^1 \\frac{ da^{\\prime} }{ a^{\\prime} }\n                          \\left[ 1 + w\\left( a^{\\prime} \\right) \\right] \\right)\n\n        The actual integral used is rewritten from [1]_ to be in terms of z.\n\n        It will generally helpful for subclasses to overload this method if\n        the integral can be done analytically for the particular dark\n        energy equation of state that they implement.\n\n        References\n        ----------\n        .. [1] Linder, E. (2003). Exploring the Expansion History of the\n               Universe. Phys. Rev. Lett., 90, 091301.\n        \"\"\"\n        # This allows for an arbitrary w(z) following eq (5) of\n        # Linder 2003, PRL 90, 91301.  The code here evaluates\n        # the integral numerically.  However, most popular\n        # forms of w(z) are designed to make this integral analytic,\n        # so it is probably a good idea for subclasses to overload this\n        # method if an analytic form is available.\n        z = aszarr(z)\n        if not isinstance(z, (Number, np.generic)):  # array/Quantity\n            ival = np.array([quad(self._w_integrand, 0, log(1 + redshift))[0]\n                             for redshift in z])\n            return np.exp(3 * ival)\n        else:  # scalar\n            ival = quad(self._w_integrand, 0, log(z + 1.0))[0]\n            return exp(3 * ival)"},{"attributeType":"Polynomial2D","col":8,"comment":"null","endLoc":1701,"id":14297,"name":"sip1d_ap","nodeType":"Attribute","startLoc":1701,"text":"self.sip1d_ap"},{"attributeType":"Polynomial2D","col":8,"comment":"null","endLoc":1704,"id":14298,"name":"sip1d_bp","nodeType":"Attribute","startLoc":1704,"text":"self.sip1d_bp"},{"attributeType":"null","col":8,"comment":"null","endLoc":1688,"id":14299,"name":"_bp_order","nodeType":"Attribute","startLoc":1688,"text":"self._bp_order"},{"attributeType":"null","col":24,"comment":"null","endLoc":7,"id":14300,"name":"u","nodeType":"Attribute","startLoc":7,"text":"u"},{"attributeType":"null","col":4,"comment":"null","endLoc":1423,"id":14301,"name":"Ode0","nodeType":"Attribute","startLoc":1423,"text":"Ode0"},{"attributeType":"null","col":8,"comment":"null","endLoc":1689,"id":14302,"name":"_ap_coeff","nodeType":"Attribute","startLoc":1689,"text":"self._ap_coeff"},{"col":4,"comment":"null","endLoc":28,"header":"def quad(*args, **kwargs)","id":14303,"name":"quad","nodeType":"Function","startLoc":27,"text":"def quad(*args, **kwargs):\n        raise ModuleNotFoundError(\"No module named 'scipy.integrate'\")"},{"attributeType":"null","col":39,"comment":"null","endLoc":9,"id":14304,"name":"cu","nodeType":"Attribute","startLoc":9,"text":"cu"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":14305,"name":"cosmo_instances","nodeType":"Attribute","startLoc":13,"text":"cosmo_instances"},{"attributeType":"null","col":51,"comment":"null","endLoc":13,"id":14306,"name":"name","nodeType":"Attribute","startLoc":13,"text":"name"},{"attributeType":"null","col":8,"comment":"null","endLoc":1433,"id":14307,"name":"_Ok0","nodeType":"Attribute","startLoc":1433,"text":"self._Ok0"},{"col":0,"comment":"","endLoc":4,"header":"base.py#<anonymous>","id":14308,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"cosmo_instances = [getattr(realizations, name) for name in available]"},{"col":0,"comment":"Write files in format 'myformat'.\n\n    Parameters\n    ----------\n    file : str, bytes, `~os.PathLike`, or file-like\n    cosmo : `~mypackage.cosmology.MyCosmology` instance\n    overwrite : bool (optional, keyword-only)\n        Whether to overwrite an existing file. Default is False.\n    ","endLoc":67,"header":"def file_writer(file, cosmo, overwrite=False)","id":14309,"name":"file_writer","nodeType":"Function","startLoc":42,"text":"def file_writer(file, cosmo, overwrite=False):\n    \"\"\"Write files in format 'myformat'.\n\n    Parameters\n    ----------\n    file : str, bytes, `~os.PathLike`, or file-like\n    cosmo : `~mypackage.cosmology.MyCosmology` instance\n    overwrite : bool (optional, keyword-only)\n        Whether to overwrite an existing file. Default is False.\n    \"\"\"\n    output = dict(cosmo)\n\n    # serialize ndarray\n    for k, v in output.items():\n        if isinstance(v, np.ndarray):\n            output[k] = v.tolist()\n\n    # write\n    if isinstance(file, (str, bytes, os.PathLike)):\n        # check that file exists and whether to overwrite.\n        if os.path.exists(file) and not overwrite:\n            raise IOError(f\"{file} exists. Set 'overwrite' to write over.\")\n        with open(file, \"w\") as write_file:\n            json.dump(output, write_file)\n    else:  # file-like\n        json.dump(output, file)"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":14310,"name":"__all__","nodeType":"Attribute","startLoc":16,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"polynomial.py#<anonymous>","id":14311,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module contains models representing polynomials and polynomial series.\n\n\"\"\"\n\n__all__ = [\n    'Chebyshev1D', 'Chebyshev2D', 'Hermite1D', 'Hermite2D',\n    'InverseSIP', 'Legendre1D', 'Legendre2D', 'Polynomial1D',\n    'Polynomial2D', 'SIP', 'OrthoPolynomialBase',\n    'PolynomialModel'\n]"},{"col":0,"comment":"Read files in format 'myformat'.\n\n    Parameters\n    ----------\n    filename : str\n    **kwargs\n        Keyword arguments into `astropy.cosmology.Cosmology.from_format`\n        with ``format=\"mypackage\"``.\n\n    Returns\n    -------\n    `~mypackage.cosmology.MyCosmology` instance\n    ","endLoc":61,"header":"def read_myformat(filename, **kwargs)","id":14312,"name":"read_myformat","nodeType":"Function","startLoc":46,"text":"def read_myformat(filename, **kwargs):\n    \"\"\"Read files in format 'myformat'.\n\n    Parameters\n    ----------\n    filename : str\n    **kwargs\n        Keyword arguments into `astropy.cosmology.Cosmology.from_format`\n        with ``format=\"mypackage\"``.\n\n    Returns\n    -------\n    `~mypackage.cosmology.MyCosmology` instance\n    \"\"\"\n    mycosmo = file_reader(filename)  # ← read file  ↓ build Cosmology\n    return Cosmology.from_format(mycosmo, format=\"mypackage\", **kwargs)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1434,"id":14313,"name":"_Ode0","nodeType":"Attribute","startLoc":1434,"text":"self._Ode0"},{"className":"LambdaCDM","col":0,"comment":"FLRW cosmology with a cosmological constant and curvature.\n\n    This has no additional attributes beyond those of FLRW.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0.  If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Ode0 : float\n        Omega dark energy: density of the cosmological constant in units of\n        the critical density at z=0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import LambdaCDM\n    >>> cosmo = LambdaCDM(H0=70, Om0=0.3, Ode0=0.7)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n    ","endLoc":2017,"id":14314,"nodeType":"Class","startLoc":1497,"text":"class LambdaCDM(FLRW):\n    \"\"\"FLRW cosmology with a cosmological constant and curvature.\n\n    This has no additional attributes beyond those of FLRW.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0.  If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Ode0 : float\n        Omega dark energy: density of the cosmological constant in units of\n        the critical density at z=0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import LambdaCDM\n    >>> cosmo = LambdaCDM(H0=70, Om0=0.3, Ode0=0.7)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n    \"\"\"\n\n    def __init__(self, H0, Om0, Ode0, Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV,\n                 Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=Ode0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.lcdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0)\n            if self._Ok0 == 0:\n                self._optimize_flat_norad()\n            else:\n                self._comoving_distance_z1z2 = self._elliptic_comoving_distance_z1z2\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.lcdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0 + self._Onu0)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.lcdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list)\n\n    def _optimize_flat_norad(self):\n        \"\"\"Set optimizations for flat LCDM cosmologies with no radiation.\"\"\"\n        # Call out the Om0=0 (de Sitter) and Om0=1 (Einstein-de Sitter)\n        # The dS case is required because the hypergeometric case\n        #    for Omega_M=0 would lead to an infinity in its argument.\n        # The EdS case is three times faster than the hypergeometric.\n        if self._Om0 == 0:\n            self._comoving_distance_z1z2 = self._dS_comoving_distance_z1z2\n            self._age = self._dS_age\n            self._lookback_time = self._dS_lookback_time\n        elif self._Om0 == 1:\n            self._comoving_distance_z1z2 = self._EdS_comoving_distance_z1z2\n            self._age = self._EdS_age\n            self._lookback_time = self._EdS_lookback_time\n        else:\n            self._comoving_distance_z1z2 = self._hypergeometric_comoving_distance_z1z2\n            self._age = self._flat_age\n            self._lookback_time = self._flat_lookback_time\n\n    def w(self, z):\n        r\"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is :math:`w(z) = -1`.\n        \"\"\"\n        z = aszarr(z)\n        return -1.0 * (np.ones(z.shape) if hasattr(z, \"shape\") else 1.0)\n\n    def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by :math:`I = 1`.\n        \"\"\"\n        z = aszarr(z)\n        return np.ones(z.shape) if hasattr(z, \"shape\") else 1.0\n\n    def _elliptic_comoving_distance_z1z2(self, z1, z2):\n        r\"\"\"Comoving transverse distance in Mpc between two redshifts.\n\n        This value is the transverse comoving distance at redshift ``z``\n        corresponding to an angular separation of 1 radian. This is the same as\n        the comoving distance if :math:`\\Omega_k` is zero.\n\n        For :math:`\\Omega_{rad} = 0` the comoving distance can be directly\n        calculated as an elliptic integral [1]_.\n\n        Not valid or appropriate for flat cosmologies (Ok0=0).\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n\n        References\n        ----------\n        .. [1] Kantowski, R., Kao, J., & Thomas, R. (2000). Distance-Redshift\n               in Inhomogeneous FLRW. arXiv e-prints, astro-ph/0002334.\n        \"\"\"\n        try:\n            z1, z2 = np.broadcast_arrays(z1, z2)\n        except ValueError as e:\n            raise ValueError(\"z1 and z2 have different shapes\") from e\n\n        # The analytic solution is not valid for any of Om0, Ode0, Ok0 == 0.\n        # Use the explicit integral solution for these cases.\n        if self._Om0 == 0 or self._Ode0 == 0 or self._Ok0 == 0:\n            return self._integral_comoving_distance_z1z2(z1, z2)\n\n        b = -(27. / 2) * self._Om0**2 * self._Ode0 / self._Ok0**3\n        kappa = b / abs(b)\n        if (b < 0) or (2 < b):\n            def phi_z(Om0, Ok0, kappa, y1, A, z):\n                return np.arccos(((z + 1.0) * Om0 / abs(Ok0) + kappa * y1 - A) /\n                                 ((z + 1.0) * Om0 / abs(Ok0) + kappa * y1 + A))\n\n            v_k = pow(kappa * (b - 1) + sqrt(b * (b - 2)), 1. / 3)\n            y1 = (-1 + kappa * (v_k + 1 / v_k)) / 3\n            A = sqrt(y1 * (3 * y1 + 2))\n            g = 1 / sqrt(A)\n            k2 = (2 * A + kappa * (1 + 3 * y1)) / (4 * A)\n\n            phi_z1 = phi_z(self._Om0, self._Ok0, kappa, y1, A, z1)\n            phi_z2 = phi_z(self._Om0, self._Ok0, kappa, y1, A, z2)\n        # Get lower-right 0<b<2 solution in Om0, Ode0 plane.\n        # Fot the upper-left 0<b<2 solution the Big Bang didn't happen.\n        elif (0 < b) and (b < 2) and self._Om0 > self._Ode0:\n            def phi_z(Om0, Ok0, y1, y2, z):\n                return np.arcsin(np.sqrt((y1 - y2) /\n                                         ((z + 1.0) * Om0 / abs(Ok0) + y1)))\n\n            yb = cos(acos(1 - b) / 3)\n            yc = sqrt(3) * sin(acos(1 - b) / 3)\n            y1 = (1. / 3) * (-1 + yb + yc)\n            y2 = (1. / 3) * (-1 - 2 * yb)\n            y3 = (1. / 3) * (-1 + yb - yc)\n            g = 2 / sqrt(y1 - y2)\n            k2 = (y1 - y3) / (y1 - y2)\n            phi_z1 = phi_z(self._Om0, self._Ok0, y1, y2, z1)\n            phi_z2 = phi_z(self._Om0, self._Ok0, y1, y2, z2)\n        else:\n            return self._integral_comoving_distance_z1z2(z1, z2)\n\n        prefactor = self._hubble_distance / sqrt(abs(self._Ok0))\n        return prefactor * g * (ellipkinc(phi_z1, k2) - ellipkinc(phi_z2, k2))\n\n    def _dS_comoving_distance_z1z2(self, z1, z2):\n        r\"\"\"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2`` in a flat, :math:`\\Omega_{\\Lambda}=1` cosmology\n        (de Sitter).\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        The de Sitter case has an analytic solution.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts. Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n        \"\"\"\n        try:\n            z1, z2 = np.broadcast_arrays(z1, z2)\n        except ValueError as e:\n            raise ValueError(\"z1 and z2 have different shapes\") from e\n\n        return self._hubble_distance * (z2 - z1)\n\n    def _EdS_comoving_distance_z1z2(self, z1, z2):\n        r\"\"\"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2`` in a flat, :math:`\\Omega_M=1` cosmology\n        (Einstein - de Sitter).\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        For :math:`\\Omega_M=1`, :math:`\\Omega_{rad}=0` the comoving distance\n        has an analytic solution.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts. Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n        \"\"\"\n        try:\n            z1, z2 = np.broadcast_arrays(z1, z2)\n        except ValueError as e:\n            raise ValueError(\"z1 and z2 have different shapes\") from e\n\n        prefactor = 2 * self._hubble_distance\n        return prefactor * ((z1 + 1.0)**(-1./2) - (z2 + 1.0)**(-1./2))\n\n    def _hypergeometric_comoving_distance_z1z2(self, z1, z2):\n        r\"\"\"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2``.\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        For :math:`\\Omega_{rad} = 0` the comoving distance can be directly\n        calculated as a hypergeometric function [1]_.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n\n        References\n        ----------\n        .. [1] Baes, M., Camps, P., & Van De Putte, D. (2017). Analytical\n               expressions and numerical evaluation of the luminosity distance\n               in a flat cosmology. MNRAS, 468(1), 927-930.\n        \"\"\"\n        try:\n            z1, z2 = np.broadcast_arrays(z1, z2)\n        except ValueError as e:\n            raise ValueError(\"z1 and z2 have different shapes\") from e\n\n        s = ((1 - self._Om0) / self._Om0) ** (1./3)\n        # Use np.sqrt here to handle negative s (Om0>1).\n        prefactor = self._hubble_distance / np.sqrt(s * self._Om0)\n        return prefactor * (self._T_hypergeometric(s / (z1 + 1.0)) -\n                            self._T_hypergeometric(s / (z2 + 1.0)))\n\n    def _T_hypergeometric(self, x):\n        r\"\"\"Compute value using Gauss Hypergeometric function 2F1.\n\n        .. math::\n\n           T(x) = 2 \\sqrt(x) _{2}F_{1}\\left(\\frac{1}{6}, \\frac{1}{2};\n                                            \\frac{7}{6}; -x^3 \\right)\n\n        Notes\n        -----\n        The :func:`scipy.special.hyp2f1` code already implements the\n        hypergeometric transformation suggested by Baes et al. [1]_ for use in\n        actual numerical evaulations.\n\n        References\n        ----------\n        .. [1] Baes, M., Camps, P., & Van De Putte, D. (2017). Analytical\n           expressions and numerical evaluation of the luminosity distance\n           in a flat cosmology. MNRAS, 468(1), 927-930.\n        \"\"\"\n        return 2 * np.sqrt(x) * hyp2f1(1./6, 1./2, 7./6, -x**3)\n\n    def _dS_age(self, z):\n        \"\"\"Age of the universe in Gyr at redshift ``z``.\n\n        The age of a de Sitter Universe is infinite.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n        \"\"\"\n        t = (inf if isinstance(z, Number) else np.full_like(z, inf, dtype=float))\n        return self._hubble_time * t\n\n    def _EdS_age(self, z):\n        r\"\"\"Age of the universe in Gyr at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated as an elliptic integral [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n\n        References\n        ----------\n        .. [1] Thomas, R., & Kantowski, R. (2000). Age-redshift relation for\n               standard cosmology. PRD, 62(10), 103507.\n        \"\"\"\n        return (2./3) * self._hubble_time * (aszarr(z) + 1.0) ** (-1.5)\n\n    def _flat_age(self, z):\n        r\"\"\"Age of the universe in Gyr at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated as an elliptic integral [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n\n        References\n        ----------\n        .. [1] Thomas, R., & Kantowski, R. (2000). Age-redshift relation for\n               standard cosmology. PRD, 62(10), 103507.\n        \"\"\"\n        # Use np.sqrt, np.arcsinh instead of math.sqrt, math.asinh\n        # to handle properly the complex numbers for 1 - Om0 < 0\n        prefactor = (2./3) * self._hubble_time / np.emath.sqrt(1 - self._Om0)\n        arg = np.arcsinh(np.emath.sqrt((1 / self._Om0 - 1 + 0j) / (aszarr(z) + 1.0)**3))\n        return (prefactor * arg).real\n\n    def _EdS_lookback_time(self, z):\n        r\"\"\"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated as an elliptic integral.\n        The lookback time is here calculated based on the ``age(0) - age(z)``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n        \"\"\"\n        return self._EdS_age(0) - self._EdS_age(z)\n\n    def _dS_lookback_time(self, z):\n        r\"\"\"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated.\n\n        .. math::\n\n           a = exp(H * t) \\  \\text{where t=0 at z=0}\n\n           t = (1/H) (ln 1 - ln a) = (1/H) (0 - ln (1/(1+z))) = (1/H) ln(1+z)\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n        \"\"\"\n        return self._hubble_time * np.log(aszarr(z) + 1.0)\n\n    def _flat_lookback_time(self, z):\n        r\"\"\"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated.\n        The lookback time is here calculated based on the ``age(0) - age(z)``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n        \"\"\"\n        return self._flat_age(0) - self._flat_age(z)\n\n    def efunc(self, z):\n        \"\"\"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        \"\"\"\n        # We override this because it takes a particularly simple\n        # form for a cosmological constant\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) + self._Ode0)\n\n    def inv_efunc(self, z):\n        r\"\"\"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The inverse redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return (zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) + self._Ode0)**(-0.5)"},{"col":4,"comment":"null","endLoc":1577,"header":"def __init__(self, H0, Om0, Ode0, Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV,\n                 Ob0=None, *, name=None, meta=None)","id":14315,"name":"__init__","nodeType":"Function","startLoc":1554,"text":"def __init__(self, H0, Om0, Ode0, Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV,\n                 Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=Ode0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.lcdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0)\n            if self._Ok0 == 0:\n                self._optimize_flat_norad()\n            else:\n                self._comoving_distance_z1z2 = self._elliptic_comoving_distance_z1z2\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.lcdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0 + self._Onu0)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.lcdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list)"},{"fileName":"__init__.py","filePath":"astropy/cosmology/tests/mypackage/io","id":14316,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n\n\"\"\"\nReaders, Writers, and I/O Miscellany.\n\"\"\"\n\n__all__ = [\"file_reader\", \"file_writer\"]  # from `mypackage`\n\n# e.g. a file reader and writer for ``myformat``\n# this will be used in ``astropy_io.py``\nfrom .core import file_reader, file_writer\n\n# Register read and write methods into Astropy:\n# determine if it is 1) installed and 2) the correct version (v5.0+)\ntry:\n    import astropy\n    from astropy.utils.introspection import minversion\nexcept ImportError:\n    ASTROPY_GE_5 = False\nelse:\n    ASTROPY_GE_5 = minversion(astropy, \"5.0\")\n\nif ASTROPY_GE_5:\n    # Astropy is installed and v5.0+ so we import the following modules\n    # to register \"myformat\" with Cosmology read/write and \"mypackage\"\n    # with Cosmology to/from_format.\n    from . import astropy_convert, astropy_io\n"},{"col":0,"comment":"Write files in format 'myformat'.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` instance\n    file : str, bytes, or `~os.PathLike`\n    overwrite : bool (optional, keyword-only)\n        Whether to overwrite an existing file. Default is False.\n    ","endLoc":75,"header":"def write_myformat(cosmology, file, *, overwrite=False)","id":14317,"name":"write_myformat","nodeType":"Function","startLoc":64,"text":"def write_myformat(cosmology, file, *, overwrite=False):\n    \"\"\"Write files in format 'myformat'.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology` instance\n    file : str, bytes, or `~os.PathLike`\n    overwrite : bool (optional, keyword-only)\n        Whether to overwrite an existing file. Default is False.\n    \"\"\"\n    cosmo = cosmology.to_format(\"mypackage\")  # ← convert Cosmology ↓ write file\n    file_writer(file, cosmo, overwrite=overwrite)"},{"fileName":"core.py","filePath":"astropy/cosmology/tests/mypackage/io","id":14318,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n\n# STDLIB\nimport json\nimport os\n\n# THIRD PARTY\nimport numpy as np\n\n# LOCAL\nfrom mypackage.cosmology import MyCosmology\n\n\ndef file_reader(filename):\n    \"\"\"Read files in format 'myformat'.\n\n    Parameters\n    ----------\n    filename : str, bytes, or `~os.PathLike`\n\n    Returns\n    -------\n    `~mypackage.cosmology.MyCosmology` instance\n    \"\"\"\n    # read\n    if isinstance(filename, (str, bytes, os.PathLike)):\n        with open(filename, \"r\") as file:\n            data = file.read()\n    else:  # file-like : this also handles errors in dumping\n        data = filename.read()\n\n    mapping = json.loads(data)  # parse json mappable to dict\n\n    # deserialize list to ndarray\n    for k, v in mapping.items():\n        if isinstance(v, list):\n            mapping[k] = np.array(v)\n\n    return MyCosmology(**mapping)\n\n\ndef file_writer(file, cosmo, overwrite=False):\n    \"\"\"Write files in format 'myformat'.\n\n    Parameters\n    ----------\n    file : str, bytes, `~os.PathLike`, or file-like\n    cosmo : `~mypackage.cosmology.MyCosmology` instance\n    overwrite : bool (optional, keyword-only)\n        Whether to overwrite an existing file. Default is False.\n    \"\"\"\n    output = dict(cosmo)\n\n    # serialize ndarray\n    for k, v in output.items():\n        if isinstance(v, np.ndarray):\n            output[k] = v.tolist()\n\n    # write\n    if isinstance(file, (str, bytes, os.PathLike)):\n        # check that file exists and whether to overwrite.\n        if os.path.exists(file) and not overwrite:\n            raise IOError(f\"{file} exists. Set 'overwrite' to write over.\")\n        with open(file, \"w\") as write_file:\n            json.dump(output, write_file)\n    else:  # file-like\n        json.dump(output, file)\n"},{"col":4,"comment":"Return the density parameter for photons at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Ogamma : ndarray or float\n            The energy density of photons relative to the critical density at\n            each redshift.\n            Returns `float` if the input is scalar.\n        ","endLoc":509,"header":"def Ogamma(self, z)","id":14319,"name":"Ogamma","nodeType":"Function","startLoc":493,"text":"def Ogamma(self, z):\n        \"\"\"Return the density parameter for photons at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Ogamma : ndarray or float\n            The energy density of photons relative to the critical density at\n            each redshift.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        z = aszarr(z)\n        return self._Ogamma0 * (z + 1.0) ** 4 * self.inv_efunc(z) ** 2"},{"col":0,"comment":"Identify if object uses ``myformat`` (JSON).","endLoc":80,"header":"def myformat_identify(origin, filepath, fileobj, *args, **kwargs)","id":14320,"name":"myformat_identify","nodeType":"Function","startLoc":78,"text":"def myformat_identify(origin, filepath, fileobj, *args, **kwargs):\n    \"\"\"Identify if object uses ``myformat`` (JSON).\"\"\"\n    return filepath is not None and filepath.endswith(\".myformat\")"},{"id":14321,"name":"astropy/cosmology/tests/mypackage/io/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/cosmology/tests/mypackage/io/tests","id":14322,"nodeType":"File","text":""},{"fileName":"conftest.py","filePath":"astropy/cosmology/tests/mypackage/io/tests","id":14323,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# THIRD PARTY\nimport pytest\n\n# LOCAL\nfrom mypackage.io import ASTROPY_GE_5\n\n\n@pytest.fixture(scope=\"session\", autouse=True)\ndef teardown_mypackage():\n    \"\"\"Clean up module after tests.\"\"\"\n\n    yield  # to let all tests within the scope run\n\n    if ASTROPY_GE_5:\n        from astropy.cosmology import Cosmology\n        from astropy.cosmology.connect import convert_registry, readwrite_registry\n\n        readwrite_registry.unregister_reader(\"myformat\", Cosmology)\n        readwrite_registry.unregister_writer(\"myformat\", Cosmology)\n        readwrite_registry.unregister_identifier(\"myformat\", Cosmology)\n\n        convert_registry.unregister_reader(\"mypackage\", Cosmology)\n        convert_registry.unregister_writer(\"mypackage\", Cosmology)\n        convert_registry.unregister_identifier(\"mypackage\", Cosmology)\n"},{"attributeType":"null","col":24,"comment":"null","endLoc":36,"id":14324,"name":"u","nodeType":"Attribute","startLoc":36,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":43,"id":14325,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":43,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":29,"header":"astropy_io.py#<anonymous>","id":14326,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nRegister Read/Write methods for \"myformat\" (JSON) with Astropy Cosmology.\n\nWith this format registered, we can start with a Cosmology from\n``mypackage``, write it to a file, and read it with Astropy to create an\nastropy Cosmology instance.\n\n    >>> from mypackage.cosmology import myplanck\n    >>> from mypackage.io import file_writer\n    >>> file_writer('<file name>', myplanck)\n\n    >>> from astropy.cosmology import Cosmology\n    >>> cosmo = Cosmology.read('<file name>', format=\"myformat\")\n    >>> cosmo\n\nWe can also do the reverse: start with an astropy Cosmology, save it and\nread it with ``mypackage``.\n\n    >>> from astropy.cosmology import Planck18\n    >>> Planck18.write('<file name>', format=\"myformat\")\n\n    >>> from mypackage.io import file_reader\n    >>> cosmo2 = file_reader('<file name>')\n    >>> cosmo2\n\n\"\"\"\n\n__doctest_skip__ = ['*']\n\nreadwrite_registry.register_reader(\"myformat\", Cosmology, read_myformat, force=True)\n\nreadwrite_registry.register_writer(\"myformat\", Cosmology, write_myformat, force=True)\n\nreadwrite_registry.register_identifier(\"myformat\", Cosmology, myformat_identify, force=True)"},{"col":0,"comment":"Clean up module after tests.","endLoc":26,"header":"@pytest.fixture(scope=\"session\", autouse=True)\ndef teardown_mypackage()","id":14327,"name":"teardown_mypackage","nodeType":"Function","startLoc":10,"text":"@pytest.fixture(scope=\"session\", autouse=True)\ndef teardown_mypackage():\n    \"\"\"Clean up module after tests.\"\"\"\n\n    yield  # to let all tests within the scope run\n\n    if ASTROPY_GE_5:\n        from astropy.cosmology import Cosmology\n        from astropy.cosmology.connect import convert_registry, readwrite_registry\n\n        readwrite_registry.unregister_reader(\"myformat\", Cosmology)\n        readwrite_registry.unregister_writer(\"myformat\", Cosmology)\n        readwrite_registry.unregister_identifier(\"myformat\", Cosmology)\n\n        convert_registry.unregister_reader(\"mypackage\", Cosmology)\n        convert_registry.unregister_writer(\"mypackage\", Cosmology)\n        convert_registry.unregister_identifier(\"mypackage\", Cosmology)"},{"col":4,"comment":"Return the density parameter for neutrinos at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Onu : ndarray or float\n            The energy density of neutrinos relative to the critical density at\n            each redshift. Note that this includes their kinetic energy (if\n            they have mass), so it is not equal to the commonly used\n            :math:`\\sum \\frac{m_{\\nu}}{94 eV}`, which does not include\n            kinetic energy.\n            Returns `float` if the input is scalar.\n        ","endLoc":532,"header":"def Onu(self, z)","id":14328,"name":"Onu","nodeType":"Function","startLoc":511,"text":"def Onu(self, z):\n        r\"\"\"Return the density parameter for neutrinos at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Onu : ndarray or float\n            The energy density of neutrinos relative to the critical density at\n            each redshift. Note that this includes their kinetic energy (if\n            they have mass), so it is not equal to the commonly used\n            :math:`\\sum \\frac{m_{\\nu}}{94 eV}`, which does not include\n            kinetic energy.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        z = aszarr(z)\n        if self._Onu0 == 0:  # Common enough to be worth checking explicitly\n            return np.zeros(z.shape) if hasattr(z, \"shape\") else 0.0\n        return self.Ogamma(z) * self.nu_relative_density(z)"},{"id":14329,"name":".pyinstaller","nodeType":"Package"},{"fileName":"run_astropy_tests.py","filePath":".pyinstaller","id":14330,"nodeType":"File","text":"import os\nimport shutil\nimport sys\n\nimport erfa  # noqa\nimport pytest\n\nimport astropy  # noqa\n\nif len(sys.argv) == 3 and sys.argv[1] == '--astropy-root':\n    ROOT = sys.argv[2]\nelse:\n    # Make sure we don't allow any arguments to be passed - some tests call\n    # sys.executable which becomes this script when producing a pyinstaller\n    # bundle, but we should just error in this case since this is not the\n    # regular Python interpreter.\n    if len(sys.argv) > 1:\n        print(\"Extra arguments passed, exiting early\")\n        sys.exit(1)\n\nfor root, dirnames, files in os.walk(os.path.join(ROOT, 'astropy')):\n\n    # NOTE: we can't simply use\n    # test_root = root.replace('astropy', 'astropy_tests')\n    # as we only want to change the one which is for the module, so instead\n    # we search for the last occurrence and replace that.\n    pos = root.rfind('astropy')\n    test_root = root[:pos] + 'astropy_tests' + root[pos + 7:]\n\n    # Copy over the astropy 'tests' directories and their contents\n    for dirname in dirnames:\n        final_dir = os.path.relpath(os.path.join(test_root, dirname), ROOT)\n        # We only copy over 'tests' directories, but not astropy/tests (only\n        # astropy/tests/tests) since that is not just a directory with tests.\n        if dirname == 'tests' and not root.endswith('astropy'):\n            shutil.copytree(os.path.join(root, dirname), final_dir, dirs_exist_ok=True)\n        else:\n            # Create empty __init__.py files so that 'astropy_tests' still\n            # behaves like a single package, otherwise pytest gets confused\n            # by the different conftest.py files.\n            init_filename = os.path.join(final_dir, '__init__.py')\n            if not os.path.exists(os.path.join(final_dir, '__init__.py')):\n                os.makedirs(final_dir, exist_ok=True)\n                with open(os.path.join(final_dir, '__init__.py'), 'w') as f:\n                    f.write(\"#\")\n    # Copy over all conftest.py files\n    for file in files:\n        if file == 'conftest.py':\n            final_file = os.path.relpath(os.path.join(test_root, file), ROOT)\n            shutil.copy2(os.path.join(root, file), final_file)\n\n# Add the top-level __init__.py file\nwith open(os.path.join('astropy_tests', '__init__.py'), 'w') as f:\n    f.write(\"#\")\n\n# Remove test file that tries to import all sub-packages at collection time\nos.remove(os.path.join('astropy_tests', 'utils', 'iers', 'tests', 'test_leap_second.py'))\n\n# Remove convolution tests for now as there are issues with the loading of the C extension.\n# FIXME: one way to fix this would be to migrate the convolution C extension away from using\n# ctypes and using the regular extension mechanism instead.\nshutil.rmtree(os.path.join('astropy_tests', 'convolution'))\nos.remove(os.path.join('astropy_tests', 'modeling', 'tests', 'test_convolution.py'))\nos.remove(os.path.join('astropy_tests', 'modeling', 'tests', 'test_core.py'))\nos.remove(os.path.join('astropy_tests', 'visualization', 'tests', 'test_lupton_rgb.py'))\n\n# FIXME: The following tests rely on the fully qualified name of classes which\n# don't seem to be the same.\nos.remove(os.path.join('astropy_tests', 'table', 'mixins', 'tests', 'test_registry.py'))\n\n# Copy the top-level conftest.py\nshutil.copy2(os.path.join(ROOT, 'astropy', 'conftest.py'),\n             os.path.join('astropy_tests', 'conftest.py'))\n\n# We skip a few tests, which are generally ones that rely on explicitly\n# checking the name of the current module (which ends up starting with\n# astropy_tests rather than astropy).\n\nSKIP_TESTS = ['test_exception_logging_origin',\n              'test_log',\n              'test_configitem',\n              'test_config_noastropy_fallback',\n              'test_no_home',\n              'test_path',\n              'test_rename_path',\n              'test_data_name_third_party_package',\n              'test_pkg_finder',\n              'test_wcsapi_extension',\n              'test_find_current_module_bundle',\n              'test_minversion',\n              'test_imports',\n              'test_generate_config',\n              'test_generate_config2',\n              'test_create_config_file',\n              'test_download_parallel_fills_cache']\n\n# Run the tests!\nsys.exit(pytest.main(['astropy_tests',\n                      '-k ' + ' and '.join('not ' + test for test in SKIP_TESTS)],\n                     plugins=['pytest_doctestplus.plugin',\n                              'pytest_openfiles.plugin',\n                              'pytest_remotedata.plugin',\n                              'pytest_astropy_header.display']))\n"},{"col":0,"comment":"Identify if object uses the :class:`~astropy.modeling.Model` format.\n\n    Returns\n    -------\n    bool\n    ","endLoc":253,"header":"def model_identify(origin, format, *args, **kwargs)","id":14331,"name":"model_identify","nodeType":"Function","startLoc":242,"text":"def model_identify(origin, format, *args, **kwargs):\n    \"\"\"Identify if object uses the :class:`~astropy.modeling.Model` format.\n\n    Returns\n    -------\n    bool\n    \"\"\"\n    itis = False\n    if origin == \"read\":\n        itis = isinstance(args[1], Model) and (format in (None, \"astropy.model\"))\n\n    return itis"},{"attributeType":"null","col":16,"comment":"null","endLoc":15,"id":14332,"name":"np","nodeType":"Attribute","startLoc":15,"text":"np"},{"attributeType":"null","col":42,"comment":"null","endLoc":20,"id":14333,"name":"ModelParameter","nodeType":"Attribute","startLoc":20,"text":"ModelParameter"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":14334,"name":"__all__","nodeType":"Attribute","startLoc":25,"text":"__all__"},{"col":0,"comment":"","endLoc":9,"header":"model.py#<anonymous>","id":14335,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThe following are private functions, included here **FOR REFERENCE ONLY** since\nthe io registry cannot be displayed. These functions are registered into\n:meth:`~astropy.cosmology.Cosmology.to_format` and\n:meth:`~astropy.cosmology.Cosmology.from_format` and should only be accessed\nvia these methods.\n\"\"\"  # this is shown in the docs.\n\n__all__ = []  # nothing is publicly scoped\n\nconvert_registry.register_reader(\"astropy.model\", Cosmology, from_model)\n\nconvert_registry.register_writer(\"astropy.model\", Cosmology, to_model)\n\nconvert_registry.register_identifier(\"astropy.model\", Cosmology, model_identify)"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":14336,"name":"__all__","nodeType":"Attribute","startLoc":7,"text":"__all__"},{"attributeType":"null","col":4,"comment":"null","endLoc":19,"id":14337,"name":"ASTROPY_GE_5","nodeType":"Attribute","startLoc":19,"text":"ASTROPY_GE_5"},{"attributeType":"null","col":4,"comment":"null","endLoc":21,"id":14338,"name":"ASTROPY_GE_5","nodeType":"Attribute","startLoc":21,"text":"ASTROPY_GE_5"},{"id":14339,"name":"astropy/timeseries","nodeType":"Package"},{"fileName":"sampled.py","filePath":"astropy/timeseries","id":14340,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom copy import deepcopy\n\nimport numpy as np\n\nfrom astropy.table import groups, QTable, Table\nfrom astropy.time import Time, TimeDelta\nfrom astropy import units as u\nfrom astropy.units import Quantity, UnitsError\nfrom astropy.utils.decorators import deprecated_renamed_argument\nfrom astropy.timeseries.core import BaseTimeSeries, autocheck_required_columns\n\n__all__ = ['TimeSeries']\n\n\n@autocheck_required_columns\nclass TimeSeries(BaseTimeSeries):\n    \"\"\"\n    A class to represent time series data in tabular form.\n\n    `~astropy.timeseries.TimeSeries` provides a class for representing time\n    series as a collection of values of different quantities measured at specific\n    points in time (for time series with finite time bins, see the\n    `~astropy.timeseries.BinnedTimeSeries` class).\n    `~astropy.timeseries.TimeSeries` is a sub-class of `~astropy.table.QTable`\n    and thus provides all the standard table maniplation methods available to\n    tables, but it also provides additional conveniences for dealing with time\n    series, such as a flexible initializer for setting up the times, a method\n    for folding time series, and a ``time`` attribute for easy access to the\n    time values.\n\n    See also: https://docs.astropy.org/en/stable/timeseries/\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, `~astropy.table.Table`, or table-like object, optional\n        Data to initialize time series. This does not need to contain the times,\n        which can be provided separately, but if it does contain the times they\n        should be in a column called ``'time'`` to be automatically recognized.\n    time : `~astropy.time.Time`, `~astropy.time.TimeDelta` or iterable\n        The times at which the values are sampled - this can be either given\n        directly as a `~astropy.time.Time` or `~astropy.time.TimeDelta` array\n        or as any iterable that initializes the `~astropy.time.Time` class. If\n        this is given, then the remaining time-related arguments should not be used.\n    time_start : `~astropy.time.Time` or str\n        The time of the first sample in the time series. This is an alternative\n        to providing ``time`` and requires that ``time_delta`` is also provided.\n    time_delta : `~astropy.time.TimeDelta` or `~astropy.units.Quantity` ['time']\n        The step size in time for the series. This can either be a scalar if\n        the time series is evenly sampled, or an array of values if it is not.\n    n_samples : int\n        The number of time samples for the series. This is only used if both\n        ``time_start`` and ``time_delta`` are provided and are scalar values.\n    **kwargs : dict, optional\n        Additional keyword arguments are passed to `~astropy.table.QTable`.\n    \"\"\"\n\n    _required_columns = ['time']\n\n    def __init__(self, data=None, *, time=None, time_start=None,\n                 time_delta=None, n_samples=None, **kwargs):\n\n        super().__init__(data=data, **kwargs)\n\n        # For some operations, an empty time series needs to be created, then\n        # columns added one by one. We should check that when columns are added\n        # manually, time is added first and is of the right type.\n        if data is None and time is None and time_start is None and time_delta is None:\n            self._required_columns_relax = True\n            return\n\n        # First if time has been given in the table data, we should extract it\n        # and treat it as if it had been passed as a keyword argument.\n\n        if data is not None:\n            if n_samples is not None:\n                if n_samples != len(self):\n                    raise TypeError(\"'n_samples' has been given both and it is not the \"\n                                    \"same length as the input data.\")\n            else:\n                n_samples = len(self)\n\n        if 'time' in self.colnames:\n            if time is None:\n                time = self.columns['time']\n            else:\n                raise TypeError(\"'time' has been given both in the table and as a keyword argument\")\n\n        if time is None and time_start is None:\n            raise TypeError(\"Either 'time' or 'time_start' should be specified\")\n        elif time is not None and time_start is not None:\n            raise TypeError(\"Cannot specify both 'time' and 'time_start'\")\n\n        if time is not None and not isinstance(time, (Time, TimeDelta)):\n            time = Time(time)\n\n        if time_start is not None and not isinstance(time_start, (Time, TimeDelta)):\n            time_start = Time(time_start)\n\n        if time_delta is not None and not isinstance(time_delta, (Quantity, TimeDelta)):\n            raise TypeError(\"'time_delta' should be a Quantity or a TimeDelta\")\n\n        if isinstance(time_delta, TimeDelta):\n            time_delta = time_delta.sec * u.s\n\n        if time_start is not None:\n\n            # We interpret this as meaning that time is that of the first\n            # sample and that the interval is given by time_delta.\n\n            if time_delta is None:\n                raise TypeError(\"'time' is scalar, so 'time_delta' is required\")\n\n            if time_delta.isscalar:\n                time_delta = np.repeat(time_delta, n_samples)\n\n            time_delta = np.cumsum(time_delta)\n            time_delta = np.roll(time_delta, 1)\n            time_delta[0] = 0. * u.s\n\n            time = time_start + time_delta\n\n        elif len(self.colnames) > 0 and len(time) != len(self):\n            raise ValueError(\"Length of 'time' ({}) should match \"\n                             \"data length ({})\".format(len(time), n_samples))\n\n        elif time_delta is not None:\n            raise TypeError(\"'time_delta' should not be specified since \"\n                            \"'time' is an array\")\n\n        with self._delay_required_column_checks():\n            if 'time' in self.colnames:\n                self.remove_column('time')\n            self.add_column(time, index=0, name='time')\n\n    @property\n    def time(self):\n        \"\"\"\n        The time values.\n        \"\"\"\n        return self['time']\n\n    @deprecated_renamed_argument('midpoint_epoch', 'epoch_time', '4.0')\n    def fold(self, period=None, epoch_time=None, epoch_phase=0,\n             wrap_phase=None, normalize_phase=False):\n        \"\"\"\n        Return a new `~astropy.timeseries.TimeSeries` folded with a period and\n        epoch.\n\n        Parameters\n        ----------\n        period : `~astropy.units.Quantity` ['time']\n            The period to use for folding\n        epoch_time : `~astropy.time.Time`\n            The time to use as the reference epoch, at which the relative time\n            offset / phase will be ``epoch_phase``. Defaults to the first time\n            in the time series.\n        epoch_phase : float or `~astropy.units.Quantity` ['dimensionless', 'time']\n            Phase of ``epoch_time``. If ``normalize_phase`` is `True`, this\n            should be a dimensionless value, while if ``normalize_phase`` is\n            ``False``, this should be a `~astropy.units.Quantity` with time\n            units. Defaults to 0.\n        wrap_phase : float or `~astropy.units.Quantity` ['dimensionless', 'time']\n            The value of the phase above which values are wrapped back by one\n            period. If ``normalize_phase`` is `True`, this should be a\n            dimensionless value, while if ``normalize_phase`` is ``False``,\n            this should be a `~astropy.units.Quantity` with time units.\n            Defaults to half the period, so that the resulting time series goes\n            from ``-period / 2`` to ``period / 2`` (if ``normalize_phase`` is\n            `False`) or -0.5 to 0.5 (if ``normalize_phase`` is `True`).\n        normalize_phase : bool\n            If `False` phase is returned as `~astropy.time.TimeDelta`,\n            otherwise as a dimensionless `~astropy.units.Quantity`.\n\n        Returns\n        -------\n        folded_timeseries : `~astropy.timeseries.TimeSeries`\n            The folded time series object with phase as the ``time`` column.\n        \"\"\"\n\n        if not isinstance(period, Quantity) or period.unit.physical_type != 'time':\n            raise UnitsError('period should be a Quantity in units of time')\n\n        folded = self.copy()\n\n        if epoch_time is None:\n            epoch_time = self.time[0]\n        else:\n            epoch_time = Time(epoch_time)\n\n        period_sec = period.to_value(u.s)\n\n        if normalize_phase:\n            if isinstance(epoch_phase, Quantity) and epoch_phase.unit.physical_type != 'dimensionless':\n                raise UnitsError('epoch_phase should be a dimensionless Quantity '\n                                 'or a float when normalize_phase=True')\n            epoch_phase_sec = epoch_phase * period_sec\n        else:\n            if epoch_phase == 0:\n                epoch_phase_sec = 0.\n            else:\n                if not isinstance(epoch_phase, Quantity) or epoch_phase.unit.physical_type != 'time':\n                    raise UnitsError('epoch_phase should be a Quantity in units '\n                                     'of time when normalize_phase=False')\n                epoch_phase_sec = epoch_phase.to_value(u.s)\n\n        if wrap_phase is None:\n            wrap_phase = period_sec / 2\n        else:\n            if normalize_phase:\n                if isinstance(wrap_phase, Quantity) and not wrap_phase.unit.is_equivalent(u.one):\n                    raise UnitsError('wrap_phase should be dimensionless when '\n                                     'normalize_phase=True')\n                else:\n                    if wrap_phase < 0 or wrap_phase > 1:\n                        raise ValueError('wrap_phase should be between 0 and 1')\n                    else:\n                        wrap_phase = wrap_phase * period_sec\n            else:\n                if isinstance(wrap_phase, Quantity) and wrap_phase.unit.physical_type == 'time':\n                    if wrap_phase < 0 or wrap_phase > period:\n                        raise ValueError('wrap_phase should be between 0 and the period')\n                    else:\n                        wrap_phase = wrap_phase.to_value(u.s)\n                else:\n                    raise UnitsError('wrap_phase should be a Quantity in units '\n                                     'of time when normalize_phase=False')\n\n        relative_time_sec = (((self.time - epoch_time).sec\n                              + epoch_phase_sec\n                              + (period_sec - wrap_phase)) % period_sec\n                             - (period_sec - wrap_phase))\n\n        folded_time = TimeDelta(relative_time_sec * u.s)\n\n        if normalize_phase:\n            folded_time = (folded_time / period).decompose()\n            period = period_sec = 1\n\n        with folded._delay_required_column_checks():\n            folded.remove_column('time')\n            folded.add_column(folded_time, name='time', index=0)\n\n        return folded\n\n    def __getitem__(self, item):\n        if self._is_list_or_tuple_of_str(item):\n            if 'time' not in item:\n                out = QTable([self[x] for x in item],\n                             meta=deepcopy(self.meta),\n                             copy_indices=self._copy_indices)\n                out._groups = groups.TableGroups(out, indices=self.groups._indices,\n                                                 keys=self.groups._keys)\n                return out\n        return super().__getitem__(item)\n\n    def add_column(self, *args, **kwargs):\n        \"\"\"\n        See :meth:`~astropy.table.Table.add_column`.\n        \"\"\"\n        # Note that the docstring is inherited from QTable\n        result = super().add_column(*args, **kwargs)\n        if len(self.indices) == 0 and 'time' in self.colnames:\n            self.add_index('time')\n        return result\n\n    def add_columns(self, *args, **kwargs):\n        \"\"\"\n        See :meth:`~astropy.table.Table.add_columns`.\n        \"\"\"\n        # Note that the docstring is inherited from QTable\n        result = super().add_columns(*args, **kwargs)\n        if len(self.indices) == 0 and 'time' in self.colnames:\n            self.add_index('time')\n        return result\n\n    @classmethod\n    def from_pandas(self, df, time_scale='utc'):\n        \"\"\"\n        Convert a :class:`~pandas.DataFrame` to a\n        :class:`astropy.timeseries.TimeSeries`.\n\n        Parameters\n        ----------\n        df : :class:`pandas.DataFrame`\n            A pandas :class:`pandas.DataFrame` instance.\n        time_scale : str\n            The time scale to pass into `astropy.time.Time`.\n            Defaults to ``UTC``.\n\n        \"\"\"\n        from pandas import DataFrame, DatetimeIndex\n\n        if not isinstance(df, DataFrame):\n            raise TypeError(\"Input should be a pandas DataFrame\")\n\n        if not isinstance(df.index, DatetimeIndex):\n            raise TypeError(\"DataFrame does not have a DatetimeIndex\")\n\n        time = Time(df.index, scale=time_scale)\n        table = Table.from_pandas(df)\n\n        return TimeSeries(time=time, data=table)\n\n    def to_pandas(self):\n        \"\"\"\n        Convert this :class:`~astropy.timeseries.TimeSeries` to a\n        :class:`~pandas.DataFrame` with a :class:`~pandas.DatetimeIndex` index.\n\n        Returns\n        -------\n        dataframe : :class:`pandas.DataFrame`\n            A pandas :class:`pandas.DataFrame` instance\n        \"\"\"\n        return Table(self).to_pandas(index='time')\n\n    @classmethod\n    def read(self, filename, time_column=None, time_format=None, time_scale=None, format=None, *args, **kwargs):\n        \"\"\"\n        Read and parse a file and returns a `astropy.timeseries.TimeSeries`.\n\n        This method uses the unified I/O infrastructure in Astropy which makes\n        it easy to define readers/writers for various classes\n        (https://docs.astropy.org/en/stable/io/unified.html). By default, this\n        method will try and use readers defined specifically for the\n        `astropy.timeseries.TimeSeries` class - however, it is also\n        possible to use the ``format`` keyword to specify formats defined for\n        the `astropy.table.Table` class - in this case, you will need to also\n        provide the column names for column containing the start times for the\n        bins, as well as other column names (see the Parameters section below\n        for details)::\n\n            >>> from astropy.timeseries import TimeSeries\n            >>> ts = TimeSeries.read('sampled.dat', format='ascii.ecsv',\n            ...                      time_column='date')  # doctest: +SKIP\n\n        Parameters\n        ----------\n        filename : str\n            File to parse.\n        format : str\n            File format specifier.\n        time_column : str, optional\n            The name of the time column.\n        time_format : str, optional\n            The time format for the time column.\n        time_scale : str, optional\n            The time scale for the time column.\n        *args : tuple, optional\n            Positional arguments passed through to the data reader.\n        **kwargs : dict, optional\n            Keyword arguments passed through to the data reader.\n\n        Returns\n        -------\n        out : `astropy.timeseries.sampled.TimeSeries`\n            TimeSeries corresponding to file contents.\n\n        Notes\n        -----\n        \"\"\"\n        try:\n\n            # First we try the readers defined for the BinnedTimeSeries class\n            return super().read(filename, format=format, *args, **kwargs)\n\n        except TypeError:\n\n            # Otherwise we fall back to the default Table readers\n\n            if time_column is None:\n                raise ValueError(\"``time_column`` should be provided since the default Table readers are being used.\")\n\n            table = Table.read(filename, format=format, *args, **kwargs)\n\n            if time_column in table.colnames:\n                time = Time(table.columns[time_column], scale=time_scale, format=time_format)\n                table.remove_column(time_column)\n            else:\n                raise ValueError(f\"Time column '{time_column}' not found in the input data.\")\n\n            return TimeSeries(time=time, data=table)\n"},{"fileName":"__init__.py","filePath":"astropy/timeseries","id":14341,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis subpackage contains classes and functions for work with time series.\n\"\"\"\n\nfrom astropy.timeseries.core import *  # noqa\nfrom astropy.timeseries.sampled import *  # noqa\nfrom astropy.timeseries.binned import *  # noqa\nfrom astropy.timeseries import io  # noqa\nfrom astropy.timeseries.downsample import *  # noqa\nfrom astropy.timeseries.periodograms import *  # noqa\n"},{"className":"BaseTimeSeries","col":0,"comment":"null","endLoc":92,"id":14342,"nodeType":"Class","startLoc":46,"text":"class BaseTimeSeries(QTable):\n\n    _required_columns = None\n    _required_columns_enabled = True\n\n    # If _required_column_relax is True, we don't require the columns to be\n    # present but we do require them to be the correct ones IF present. Note\n    # that this is a temporary state - as soon as the required columns\n    # are all present, we toggle this to False\n    _required_columns_relax = False\n\n    def _check_required_columns(self):\n\n        if not self._required_columns_enabled:\n            return\n\n        if self._required_columns is not None:\n\n            if self._required_columns_relax:\n                required_columns = self._required_columns[:len(self.colnames)]\n            else:\n                required_columns = self._required_columns\n\n            plural = 's' if len(required_columns) > 1 else ''\n\n            if not self._required_columns_relax and len(self.colnames) == 0:\n\n                raise ValueError(\"{} object is invalid - expected '{}' \"\n                                 \"as the first column{} but time series has no columns\"\n                                 .format(self.__class__.__name__, required_columns[0], plural))\n\n            elif self.colnames[:len(required_columns)] != required_columns:\n\n                raise ValueError(\"{} object is invalid - expected '{}' \"\n                                 \"as the first column{} but found '{}'\"\n                                 .format(self.__class__.__name__, required_columns[0], plural, self.colnames[0]))\n\n            if (self._required_columns_relax\n                    and self._required_columns == self.colnames[:len(self._required_columns)]):\n                self._required_columns_relax = False\n\n    @contextmanager\n    def _delay_required_column_checks(self):\n        self._required_columns_enabled = False\n        yield\n        self._required_columns_enabled = True\n        self._check_required_columns()"},{"col":0,"comment":"","endLoc":5,"header":"__init__.py#<anonymous>","id":14343,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis subpackage contains classes and functions for work with time series.\n\"\"\""},{"col":4,"comment":"Set optimizations for flat LCDM cosmologies with no radiation.","endLoc":1596,"header":"def _optimize_flat_norad(self)","id":14344,"name":"_optimize_flat_norad","nodeType":"Function","startLoc":1579,"text":"def _optimize_flat_norad(self):\n        \"\"\"Set optimizations for flat LCDM cosmologies with no radiation.\"\"\"\n        # Call out the Om0=0 (de Sitter) and Om0=1 (Einstein-de Sitter)\n        # The dS case is required because the hypergeometric case\n        #    for Omega_M=0 would lead to an infinity in its argument.\n        # The EdS case is three times faster than the hypergeometric.\n        if self._Om0 == 0:\n            self._comoving_distance_z1z2 = self._dS_comoving_distance_z1z2\n            self._age = self._dS_age\n            self._lookback_time = self._dS_lookback_time\n        elif self._Om0 == 1:\n            self._comoving_distance_z1z2 = self._EdS_comoving_distance_z1z2\n            self._age = self._EdS_age\n            self._lookback_time = self._EdS_lookback_time\n        else:\n            self._comoving_distance_z1z2 = self._hypergeometric_comoving_distance_z1z2\n            self._age = self._flat_age\n            self._lookback_time = self._flat_lookback_time"},{"col":4,"comment":"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is :math:`w(z) = -1`.\n        ","endLoc":1620,"header":"def w(self, z)","id":14345,"name":"w","nodeType":"Function","startLoc":1598,"text":"def w(self, z):\n        r\"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is :math:`w(z) = -1`.\n        \"\"\"\n        z = aszarr(z)\n        return -1.0 * (np.ones(z.shape) if hasattr(z, \"shape\") else 1.0)"},{"col":0,"comment":"","endLoc":5,"header":"__init__.py#<anonymous>","id":14346,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nReaders, Writers, and I/O Miscellany.\n\"\"\"\n\n__all__ = [\"file_reader\", \"file_writer\"]  # from `mypackage`\n\ntry:\n    import astropy\n    from astropy.utils.introspection import minversion\nexcept ImportError:\n    ASTROPY_GE_5 = False\nelse:\n    ASTROPY_GE_5 = minversion(astropy, \"5.0\")\n\nif ASTROPY_GE_5:\n    # Astropy is installed and v5.0+ so we import the following modules\n    # to register \"myformat\" with Cosmology read/write and \"mypackage\"\n    # with Cosmology to/from_format.\n    from . import astropy_convert, astropy_io"},{"col":4,"comment":"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by :math:`I = 1`.\n        ","endLoc":1642,"header":"def de_density_scale(self, z)","id":14347,"name":"de_density_scale","nodeType":"Function","startLoc":1622,"text":"def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by :math:`I = 1`.\n        \"\"\"\n        z = aszarr(z)\n        return np.ones(z.shape) if hasattr(z, \"shape\") else 1.0"},{"col":4,"comment":"null","endLoc":85,"header":"def _check_required_columns(self)","id":14348,"name":"_check_required_columns","nodeType":"Function","startLoc":57,"text":"def _check_required_columns(self):\n\n        if not self._required_columns_enabled:\n            return\n\n        if self._required_columns is not None:\n\n            if self._required_columns_relax:\n                required_columns = self._required_columns[:len(self.colnames)]\n            else:\n                required_columns = self._required_columns\n\n            plural = 's' if len(required_columns) > 1 else ''\n\n            if not self._required_columns_relax and len(self.colnames) == 0:\n\n                raise ValueError(\"{} object is invalid - expected '{}' \"\n                                 \"as the first column{} but time series has no columns\"\n                                 .format(self.__class__.__name__, required_columns[0], plural))\n\n            elif self.colnames[:len(required_columns)] != required_columns:\n\n                raise ValueError(\"{} object is invalid - expected '{}' \"\n                                 \"as the first column{} but found '{}'\"\n                                 .format(self.__class__.__name__, required_columns[0], plural, self.colnames[0]))\n\n            if (self._required_columns_relax\n                    and self._required_columns == self.colnames[:len(self._required_columns)]):\n                self._required_columns_relax = False"},{"col":4,"comment":"Comoving transverse distance in Mpc between two redshifts.\n\n        This value is the transverse comoving distance at redshift ``z``\n        corresponding to an angular separation of 1 radian. This is the same as\n        the comoving distance if :math:`\\Omega_k` is zero.\n\n        For :math:`\\Omega_{rad} = 0` the comoving distance can be directly\n        calculated as an elliptic integral [1]_.\n\n        Not valid or appropriate for flat cosmologies (Ok0=0).\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n\n        References\n        ----------\n        .. [1] Kantowski, R., Kao, J., & Thomas, R. (2000). Distance-Redshift\n               in Inhomogeneous FLRW. arXiv e-prints, astro-ph/0002334.\n        ","endLoc":1716,"header":"def _elliptic_comoving_distance_z1z2(self, z1, z2)","id":14349,"name":"_elliptic_comoving_distance_z1z2","nodeType":"Function","startLoc":1644,"text":"def _elliptic_comoving_distance_z1z2(self, z1, z2):\n        r\"\"\"Comoving transverse distance in Mpc between two redshifts.\n\n        This value is the transverse comoving distance at redshift ``z``\n        corresponding to an angular separation of 1 radian. This is the same as\n        the comoving distance if :math:`\\Omega_k` is zero.\n\n        For :math:`\\Omega_{rad} = 0` the comoving distance can be directly\n        calculated as an elliptic integral [1]_.\n\n        Not valid or appropriate for flat cosmologies (Ok0=0).\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n\n        References\n        ----------\n        .. [1] Kantowski, R., Kao, J., & Thomas, R. (2000). Distance-Redshift\n               in Inhomogeneous FLRW. arXiv e-prints, astro-ph/0002334.\n        \"\"\"\n        try:\n            z1, z2 = np.broadcast_arrays(z1, z2)\n        except ValueError as e:\n            raise ValueError(\"z1 and z2 have different shapes\") from e\n\n        # The analytic solution is not valid for any of Om0, Ode0, Ok0 == 0.\n        # Use the explicit integral solution for these cases.\n        if self._Om0 == 0 or self._Ode0 == 0 or self._Ok0 == 0:\n            return self._integral_comoving_distance_z1z2(z1, z2)\n\n        b = -(27. / 2) * self._Om0**2 * self._Ode0 / self._Ok0**3\n        kappa = b / abs(b)\n        if (b < 0) or (2 < b):\n            def phi_z(Om0, Ok0, kappa, y1, A, z):\n                return np.arccos(((z + 1.0) * Om0 / abs(Ok0) + kappa * y1 - A) /\n                                 ((z + 1.0) * Om0 / abs(Ok0) + kappa * y1 + A))\n\n            v_k = pow(kappa * (b - 1) + sqrt(b * (b - 2)), 1. / 3)\n            y1 = (-1 + kappa * (v_k + 1 / v_k)) / 3\n            A = sqrt(y1 * (3 * y1 + 2))\n            g = 1 / sqrt(A)\n            k2 = (2 * A + kappa * (1 + 3 * y1)) / (4 * A)\n\n            phi_z1 = phi_z(self._Om0, self._Ok0, kappa, y1, A, z1)\n            phi_z2 = phi_z(self._Om0, self._Ok0, kappa, y1, A, z2)\n        # Get lower-right 0<b<2 solution in Om0, Ode0 plane.\n        # Fot the upper-left 0<b<2 solution the Big Bang didn't happen.\n        elif (0 < b) and (b < 2) and self._Om0 > self._Ode0:\n            def phi_z(Om0, Ok0, y1, y2, z):\n                return np.arcsin(np.sqrt((y1 - y2) /\n                                         ((z + 1.0) * Om0 / abs(Ok0) + y1)))\n\n            yb = cos(acos(1 - b) / 3)\n            yc = sqrt(3) * sin(acos(1 - b) / 3)\n            y1 = (1. / 3) * (-1 + yb + yc)\n            y2 = (1. / 3) * (-1 - 2 * yb)\n            y3 = (1. / 3) * (-1 + yb - yc)\n            g = 2 / sqrt(y1 - y2)\n            k2 = (y1 - y3) / (y1 - y2)\n            phi_z1 = phi_z(self._Om0, self._Ok0, y1, y2, z1)\n            phi_z2 = phi_z(self._Om0, self._Ok0, y1, y2, z2)\n        else:\n            return self._integral_comoving_distance_z1z2(z1, z2)\n\n        prefactor = self._hubble_distance / sqrt(abs(self._Ok0))\n        return prefactor * g * (ellipkinc(phi_z1, k2) - ellipkinc(phi_z2, k2))"},{"fileName":"binned.py","filePath":"astropy/timeseries","id":14350,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom copy import deepcopy\n\nimport numpy as np\n\nfrom astropy.table import groups, Table, QTable\nfrom astropy.time import Time, TimeDelta\nfrom astropy import units as u\nfrom astropy.units import Quantity\n\nfrom astropy.timeseries.core import BaseTimeSeries, autocheck_required_columns\n\n__all__ = ['BinnedTimeSeries']\n\n\n@autocheck_required_columns\nclass BinnedTimeSeries(BaseTimeSeries):\n    \"\"\"\n    A class to represent binned time series data in tabular form.\n\n    `~astropy.timeseries.BinnedTimeSeries` provides a class for\n    representing time series as a collection of values of different\n    quantities measured in time bins (for time series with values\n    sampled at specific times, see the `~astropy.timeseries.TimeSeries`\n    class). `~astropy.timeseries.BinnedTimeSeries` is a sub-class of\n    `~astropy.table.QTable` and thus provides all the standard table\n    maniplation methods available to tables, but it also provides\n    additional conveniences for dealing with time series, such as a\n    flexible initializer for setting up the times, and attributes to\n    access the start/center/end time of bins.\n\n    See also: https://docs.astropy.org/en/stable/timeseries/\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, table-like object, optional\n        Data to initialize time series. This does not need to contain the\n        times, which can be provided separately, but if it does contain the\n        times they should be in columns called ``'time_bin_start'`` and\n        ``'time_bin_size'`` to be automatically recognized.\n    time_bin_start : `~astropy.time.Time` or iterable\n        The times of the start of each bin - this can be either given\n        directly as a `~astropy.time.Time` array or as any iterable that\n        initializes the `~astropy.time.Time` class. If this is given, then\n        the remaining time-related arguments should not be used. This can also\n        be a scalar value if ``time_bin_size`` is provided.\n    time_bin_end : `~astropy.time.Time` or iterable\n        The times of the end of each bin - this can be either given directly\n        as a `~astropy.time.Time` array or as any value or iterable that\n        initializes the `~astropy.time.Time` class. If this is given, then the\n        remaining time-related arguments should not be used. This can only be\n        given if ``time_bin_start`` is an array of values. If ``time_bin_end``\n        is a scalar, time bins are assumed to be contiguous, such that the end\n        of each bin is the start of the next one, and ``time_bin_end`` gives\n        the end time for the last bin. If ``time_bin_end`` is an array, the\n        time bins do not need to be contiguous. If this argument is provided,\n        ``time_bin_size`` should not be provided.\n    time_bin_size : `~astropy.time.TimeDelta` or `~astropy.units.Quantity`\n        The size of the time bins, either as a scalar value (in which case all\n        time bins will be assumed to have the same duration) or as an array of\n        values (in which case each time bin can have a different duration).\n        If this argument is provided, ``time_bin_end`` should not be provided.\n    n_bins : int\n        The number of time bins for the series. This is only used if both\n        ``time_bin_start`` and ``time_bin_size`` are provided and are scalar\n        values.\n    **kwargs : dict, optional\n        Additional keyword arguments are passed to `~astropy.table.QTable`.\n    \"\"\"\n\n    _required_columns = ['time_bin_start', 'time_bin_size']\n\n    def __init__(self, data=None, *, time_bin_start=None, time_bin_end=None,\n                 time_bin_size=None, n_bins=None, **kwargs):\n\n        super().__init__(data=data, **kwargs)\n\n        # For some operations, an empty time series needs to be created, then\n        # columns added one by one. We should check that when columns are added\n        # manually, time is added first and is of the right type.\n        if (data is None and time_bin_start is None and time_bin_end is None and\n                time_bin_size is None and n_bins is None):\n            self._required_columns_relax = True\n            return\n\n        # First if time_bin_start and time_bin_end have been given in the table data, we\n        # should extract them and treat them as if they had been passed as\n        # keyword arguments.\n\n        if 'time_bin_start' in self.colnames:\n            if time_bin_start is None:\n                time_bin_start = self.columns['time_bin_start']\n            else:\n                raise TypeError(\"'time_bin_start' has been given both in the table \"\n                                \"and as a keyword argument\")\n\n        if 'time_bin_size' in self.colnames:\n            if time_bin_size is None:\n                time_bin_size = self.columns['time_bin_size']\n            else:\n                raise TypeError(\"'time_bin_size' has been given both in the table \"\n                                \"and as a keyword argument\")\n\n        if time_bin_start is None:\n            raise TypeError(\"'time_bin_start' has not been specified\")\n\n        if time_bin_end is None and time_bin_size is None:\n            raise TypeError(\"Either 'time_bin_size' or 'time_bin_end' should be specified\")\n\n        if not isinstance(time_bin_start, (Time, TimeDelta)):\n            time_bin_start = Time(time_bin_start)\n\n        if time_bin_end is not None and not isinstance(time_bin_end, (Time, TimeDelta)):\n            time_bin_end = Time(time_bin_end)\n\n        if time_bin_size is not None and not isinstance(time_bin_size, (Quantity, TimeDelta)):\n            raise TypeError(\"'time_bin_size' should be a Quantity or a TimeDelta\")\n\n        if isinstance(time_bin_size, TimeDelta):\n            time_bin_size = time_bin_size.sec * u.s\n\n        if n_bins is not None and time_bin_size is not None:\n            if not (time_bin_start.isscalar and time_bin_size.isscalar):\n                raise TypeError(\"'n_bins' cannot be specified if 'time_bin_start' or \"\n                                \"'time_bin_size' are not scalar'\")\n\n        if time_bin_start.isscalar:\n\n            # We interpret this as meaning that this is the start of the\n            # first bin and that the bins are contiguous. In this case,\n            # we require time_bin_size to be specified.\n\n            if time_bin_size is None:\n                raise TypeError(\"'time_bin_start' is scalar, so 'time_bin_size' is required\")\n\n            if time_bin_size.isscalar:\n                if data is not None:\n                    if n_bins is not None:\n                        if n_bins != len(self):\n                            raise TypeError(\"'n_bins' has been given and it is not the \"\n                                            \"same length as the input data.\")\n                    else:\n                        n_bins = len(self)\n\n                time_bin_size = np.repeat(time_bin_size, n_bins)\n\n            time_delta = np.cumsum(time_bin_size)\n            time_bin_end = time_bin_start + time_delta\n\n            # Now shift the array so that the first entry is 0\n            time_delta = np.roll(time_delta, 1)\n            time_delta[0] = 0. * u.s\n\n            # Make time_bin_start into an array\n            time_bin_start = time_bin_start + time_delta\n\n        else:\n\n            if len(self.colnames) > 0 and len(time_bin_start) != len(self):\n                raise ValueError(\"Length of 'time_bin_start' ({}) should match \"\n                                 \"table length ({})\".format(len(time_bin_start), len(self)))\n\n            if time_bin_end is not None:\n                if time_bin_end.isscalar:\n                    times = time_bin_start.copy()\n                    times[:-1] = times[1:]\n                    times[-1] = time_bin_end\n                    time_bin_end = times\n                time_bin_size = (time_bin_end - time_bin_start).sec * u.s\n\n        if time_bin_size.isscalar:\n            time_bin_size = np.repeat(time_bin_size, len(self))\n\n        with self._delay_required_column_checks():\n\n            if 'time_bin_start' in self.colnames:\n                self.remove_column('time_bin_start')\n\n            if 'time_bin_size' in self.colnames:\n                self.remove_column('time_bin_size')\n\n            self.add_column(time_bin_start, index=0, name='time_bin_start')\n            self.add_index('time_bin_start')\n            self.add_column(time_bin_size, index=1, name='time_bin_size')\n\n    @property\n    def time_bin_start(self):\n        \"\"\"\n        The start times of all the time bins.\n        \"\"\"\n        return self['time_bin_start']\n\n    @property\n    def time_bin_center(self):\n        \"\"\"\n        The center times of all the time bins.\n        \"\"\"\n        return self['time_bin_start'] + self['time_bin_size'] * 0.5\n\n    @property\n    def time_bin_end(self):\n        \"\"\"\n        The end times of all the time bins.\n        \"\"\"\n        return self['time_bin_start'] + self['time_bin_size']\n\n    @property\n    def time_bin_size(self):\n        \"\"\"\n        The sizes of all the time bins.\n        \"\"\"\n        return self['time_bin_size']\n\n    def __getitem__(self, item):\n        if self._is_list_or_tuple_of_str(item):\n            if 'time_bin_start' not in item or 'time_bin_size' not in item:\n                out = QTable([self[x] for x in item],\n                             meta=deepcopy(self.meta),\n                             copy_indices=self._copy_indices)\n                out._groups = groups.TableGroups(out, indices=self.groups._indices,\n                                                 keys=self.groups._keys)\n                return out\n        return super().__getitem__(item)\n\n    @classmethod\n    def read(self, filename, time_bin_start_column=None, time_bin_end_column=None,\n             time_bin_size_column=None, time_bin_size_unit=None, time_format=None, time_scale=None,\n             format=None, *args, **kwargs):\n        \"\"\"\n        Read and parse a file and returns a `astropy.timeseries.BinnedTimeSeries`.\n\n        This method uses the unified I/O infrastructure in Astropy which makes\n        it easy to define readers/writers for various classes\n        (https://docs.astropy.org/en/stable/io/unified.html). By default, this\n        method will try and use readers defined specifically for the\n        `astropy.timeseries.BinnedTimeSeries` class - however, it is also\n        possible to use the ``format`` keyword to specify formats defined for\n        the `astropy.table.Table` class - in this case, you will need to also\n        provide the column names for column containing the start times for the\n        bins, as well as other column names (see the Parameters section below\n        for details)::\n\n            >>> from astropy.timeseries.binned import BinnedTimeSeries\n            >>> ts = BinnedTimeSeries.read('binned.dat', format='ascii.ecsv',\n            ...                            time_bin_start_column='date_start',\n            ...                            time_bin_end_column='date_end')  # doctest: +SKIP\n\n        Parameters\n        ----------\n        filename : str\n            File to parse.\n        format : str\n            File format specifier.\n        time_bin_start_column : str\n            The name of the column with the start time for each bin.\n        time_bin_end_column : str, optional\n            The name of the column with the end time for each bin. Either this\n            option or ``time_bin_size_column`` should be specified.\n        time_bin_size_column : str, optional\n            The name of the column with the size for each bin. Either this\n            option or ``time_bin_end_column`` should be specified.\n        time_bin_size_unit : `astropy.units.Unit`, optional\n            If ``time_bin_size_column`` is specified but does not have a unit\n            set in the table, you can specify the unit manually.\n        time_format : str, optional\n            The time format for the start and end columns.\n        time_scale : str, optional\n            The time scale for the start and end columns.\n        *args : tuple, optional\n            Positional arguments passed through to the data reader.\n        **kwargs : dict, optional\n            Keyword arguments passed through to the data reader.\n\n        Returns\n        -------\n        out : `astropy.timeseries.binned.BinnedTimeSeries`\n            BinnedTimeSeries corresponding to the file.\n\n        \"\"\"\n\n        try:\n\n            # First we try the readers defined for the BinnedTimeSeries class\n            return super().read(filename, format=format, *args, **kwargs)\n\n        except TypeError:\n\n            # Otherwise we fall back to the default Table readers\n\n            if time_bin_start_column is None:\n                raise ValueError(\"``time_bin_start_column`` should be provided since the default Table readers are being used.\")\n            if time_bin_end_column is None and time_bin_size_column is None:\n                raise ValueError(\"Either `time_bin_end_column` or `time_bin_size_column` should be provided.\")\n            elif time_bin_end_column is not None and time_bin_size_column is not None:\n                raise ValueError(\"Cannot specify both `time_bin_end_column` and `time_bin_size_column`.\")\n\n            table = Table.read(filename, format=format, *args, **kwargs)\n\n            if time_bin_start_column in table.colnames:\n                time_bin_start = Time(table.columns[time_bin_start_column],\n                                      scale=time_scale, format=time_format)\n                table.remove_column(time_bin_start_column)\n            else:\n                raise ValueError(f\"Bin start time column '{time_bin_start_column}' not found in the input data.\")\n\n            if time_bin_end_column is not None:\n\n                if time_bin_end_column in table.colnames:\n                    time_bin_end = Time(table.columns[time_bin_end_column],\n                                        scale=time_scale, format=time_format)\n                    table.remove_column(time_bin_end_column)\n                else:\n                    raise ValueError(f\"Bin end time column '{time_bin_end_column}' not found in the input data.\")\n\n                time_bin_size = None\n\n            elif time_bin_size_column is not None:\n\n                if time_bin_size_column in table.colnames:\n                    time_bin_size = table.columns[time_bin_size_column]\n                    table.remove_column(time_bin_size_column)\n                else:\n                    raise ValueError(f\"Bin size column '{time_bin_size_column}' not found in the input data.\")\n\n                if time_bin_size.unit is None:\n                    if time_bin_size_unit is None or not isinstance(time_bin_size_unit, u.UnitBase):\n                        raise ValueError(\"The bin size unit should be specified as an astropy Unit using ``time_bin_size_unit``.\")\n                    time_bin_size = time_bin_size * time_bin_size_unit\n                else:\n                    time_bin_size = u.Quantity(time_bin_size)\n\n                time_bin_end = None\n\n            if time_bin_start.isscalar and time_bin_size.isscalar:\n                return BinnedTimeSeries(data=table,\n                                    time_bin_start=time_bin_start,\n                                    time_bin_end=time_bin_end,\n                                    time_bin_size=time_bin_size,\n                                    n_bins=len(table))\n            else:\n                return BinnedTimeSeries(data=table,\n                                    time_bin_start=time_bin_start,\n                                    time_bin_end=time_bin_end,\n                                    time_bin_size=time_bin_size)\n"},{"col":4,"comment":"null","endLoc":92,"header":"@contextmanager\n    def _delay_required_column_checks(self)","id":14351,"name":"_delay_required_column_checks","nodeType":"Function","startLoc":87,"text":"@contextmanager\n    def _delay_required_column_checks(self):\n        self._required_columns_enabled = False\n        yield\n        self._required_columns_enabled = True\n        self._check_required_columns()"},{"fileName":"core.py","filePath":"astropy/timeseries","id":14352,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom types import FunctionType\nfrom contextlib import contextmanager\nfrom functools import wraps\n\nfrom astropy.table import QTable\n\n__all__ = ['BaseTimeSeries', 'autocheck_required_columns']\n\nCOLUMN_RELATED_METHODS = ['add_column',\n                          'add_columns',\n                          'keep_columns',\n                          'remove_column',\n                          'remove_columns',\n                          'rename_column']\n\n\ndef autocheck_required_columns(cls):\n    \"\"\"\n    This is a decorator that ensures that the table contains specific\n    methods indicated by the _required_columns attribute. The aim is to\n    decorate all methods that might affect the columns in the table and check\n    for consistency after the methods have been run.\n    \"\"\"\n\n    def decorator_method(method):\n\n        @wraps(method)\n        def wrapper(self, *args, **kwargs):\n            result = method(self, *args, **kwargs)\n            self._check_required_columns()\n            return result\n\n        return wrapper\n\n    for name in COLUMN_RELATED_METHODS:\n        if (not hasattr(cls, name) or\n                not isinstance(getattr(cls, name), FunctionType)):\n            raise ValueError(f\"{name} is not a valid method\")\n        setattr(cls, name, decorator_method(getattr(cls, name)))\n\n    return cls\n\n\nclass BaseTimeSeries(QTable):\n\n    _required_columns = None\n    _required_columns_enabled = True\n\n    # If _required_column_relax is True, we don't require the columns to be\n    # present but we do require them to be the correct ones IF present. Note\n    # that this is a temporary state - as soon as the required columns\n    # are all present, we toggle this to False\n    _required_columns_relax = False\n\n    def _check_required_columns(self):\n\n        if not self._required_columns_enabled:\n            return\n\n        if self._required_columns is not None:\n\n            if self._required_columns_relax:\n                required_columns = self._required_columns[:len(self.colnames)]\n            else:\n                required_columns = self._required_columns\n\n            plural = 's' if len(required_columns) > 1 else ''\n\n            if not self._required_columns_relax and len(self.colnames) == 0:\n\n                raise ValueError(\"{} object is invalid - expected '{}' \"\n                                 \"as the first column{} but time series has no columns\"\n                                 .format(self.__class__.__name__, required_columns[0], plural))\n\n            elif self.colnames[:len(required_columns)] != required_columns:\n\n                raise ValueError(\"{} object is invalid - expected '{}' \"\n                                 \"as the first column{} but found '{}'\"\n                                 .format(self.__class__.__name__, required_columns[0], plural, self.colnames[0]))\n\n            if (self._required_columns_relax\n                    and self._required_columns == self.colnames[:len(self._required_columns)]):\n                self._required_columns_relax = False\n\n    @contextmanager\n    def _delay_required_column_checks(self):\n        self._required_columns_enabled = False\n        yield\n        self._required_columns_enabled = True\n        self._check_required_columns()\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":48,"id":14353,"name":"_required_columns","nodeType":"Attribute","startLoc":48,"text":"_required_columns"},{"attributeType":"null","col":4,"comment":"null","endLoc":49,"id":14354,"name":"_required_columns_enabled","nodeType":"Attribute","startLoc":49,"text":"_required_columns_enabled"},{"attributeType":"null","col":4,"comment":"null","endLoc":55,"id":14355,"name":"_required_columns_relax","nodeType":"Attribute","startLoc":55,"text":"_required_columns_relax"},{"attributeType":"null","col":16,"comment":"null","endLoc":85,"id":14356,"name":"_required_columns_relax","nodeType":"Attribute","startLoc":85,"text":"self._required_columns_relax"},{"col":4,"comment":"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2``. The comoving distance along the line-of-sight\n        between two objects remains constant with time for objects in the\n        Hubble flow.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'] or array-like\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n        ","endLoc":1092,"header":"def _integral_comoving_distance_z1z2(self, z1, z2)","id":14357,"name":"_integral_comoving_distance_z1z2","nodeType":"Function","startLoc":1075,"text":"def _integral_comoving_distance_z1z2(self, z1, z2):\n        \"\"\"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2``. The comoving distance along the line-of-sight\n        between two objects remains constant with time for objects in the\n        Hubble flow.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'] or array-like\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n        \"\"\"\n        return self._hubble_distance * self._integral_comoving_distance_z1z2_scalar(z1, z2)"},{"attributeType":"null","col":8,"comment":"null","endLoc":89,"id":14358,"name":"_required_columns_enabled","nodeType":"Attribute","startLoc":89,"text":"self._required_columns_enabled"},{"col":0,"comment":"\n    This is a decorator that ensures that the table contains specific\n    methods indicated by the _required_columns attribute. The aim is to\n    decorate all methods that might affect the columns in the table and check\n    for consistency after the methods have been run.\n    ","endLoc":43,"header":"def autocheck_required_columns(cls)","id":14359,"name":"autocheck_required_columns","nodeType":"Function","startLoc":19,"text":"def autocheck_required_columns(cls):\n    \"\"\"\n    This is a decorator that ensures that the table contains specific\n    methods indicated by the _required_columns attribute. The aim is to\n    decorate all methods that might affect the columns in the table and check\n    for consistency after the methods have been run.\n    \"\"\"\n\n    def decorator_method(method):\n\n        @wraps(method)\n        def wrapper(self, *args, **kwargs):\n            result = method(self, *args, **kwargs)\n            self._check_required_columns()\n            return result\n\n        return wrapper\n\n    for name in COLUMN_RELATED_METHODS:\n        if (not hasattr(cls, name) or\n                not isinstance(getattr(cls, name), FunctionType)):\n            raise ValueError(f\"{name} is not a valid method\")\n        setattr(cls, name, decorator_method(getattr(cls, name)))\n\n    return cls"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":14360,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":14361,"name":"COLUMN_RELATED_METHODS","nodeType":"Attribute","startLoc":11,"text":"COLUMN_RELATED_METHODS"},{"col":0,"comment":"","endLoc":3,"header":"core.py#<anonymous>","id":14362,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['BaseTimeSeries', 'autocheck_required_columns']\n\nCOLUMN_RELATED_METHODS = ['add_column',\n                          'add_columns',\n                          'keep_columns',\n                          'remove_column',\n                          'remove_columns',\n                          'rename_column']"},{"col":4,"comment":"\n        Comoving line-of-sight distance between objects at redshifts ``z1`` and\n        ``z2``. Value in Mpc.\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : float or ndarray\n            Comoving distance in Mpc between each input redshift.\n            Returns `float` if input scalar, `~numpy.ndarray` otherwise.\n        ","endLoc":1073,"header":"@vectorize_redshift_method(nin=2)\n    def _integral_comoving_distance_z1z2_scalar(self, z1, z2, /)","id":14363,"name":"_integral_comoving_distance_z1z2_scalar","nodeType":"Function","startLoc":1053,"text":"@vectorize_redshift_method(nin=2)\n    def _integral_comoving_distance_z1z2_scalar(self, z1, z2, /):\n        \"\"\"\n        Comoving line-of-sight distance between objects at redshifts ``z1`` and\n        ``z2``. Value in Mpc.\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : float or ndarray\n            Comoving distance in Mpc between each input redshift.\n            Returns `float` if input scalar, `~numpy.ndarray` otherwise.\n        \"\"\"\n        return quad(self._inv_efunc_scalar, z1, z2, args=self._inv_efunc_scalar_args)[0]"},{"className":"TimeSeries","col":0,"comment":"\n    A class to represent time series data in tabular form.\n\n    `~astropy.timeseries.TimeSeries` provides a class for representing time\n    series as a collection of values of different quantities measured at specific\n    points in time (for time series with finite time bins, see the\n    `~astropy.timeseries.BinnedTimeSeries` class).\n    `~astropy.timeseries.TimeSeries` is a sub-class of `~astropy.table.QTable`\n    and thus provides all the standard table maniplation methods available to\n    tables, but it also provides additional conveniences for dealing with time\n    series, such as a flexible initializer for setting up the times, a method\n    for folding time series, and a ``time`` attribute for easy access to the\n    time values.\n\n    See also: https://docs.astropy.org/en/stable/timeseries/\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, `~astropy.table.Table`, or table-like object, optional\n        Data to initialize time series. This does not need to contain the times,\n        which can be provided separately, but if it does contain the times they\n        should be in a column called ``'time'`` to be automatically recognized.\n    time : `~astropy.time.Time`, `~astropy.time.TimeDelta` or iterable\n        The times at which the values are sampled - this can be either given\n        directly as a `~astropy.time.Time` or `~astropy.time.TimeDelta` array\n        or as any iterable that initializes the `~astropy.time.Time` class. If\n        this is given, then the remaining time-related arguments should not be used.\n    time_start : `~astropy.time.Time` or str\n        The time of the first sample in the time series. This is an alternative\n        to providing ``time`` and requires that ``time_delta`` is also provided.\n    time_delta : `~astropy.time.TimeDelta` or `~astropy.units.Quantity` ['time']\n        The step size in time for the series. This can either be a scalar if\n        the time series is evenly sampled, or an array of values if it is not.\n    n_samples : int\n        The number of time samples for the series. This is only used if both\n        ``time_start`` and ``time_delta`` are provided and are scalar values.\n    **kwargs : dict, optional\n        Additional keyword arguments are passed to `~astropy.table.QTable`.\n    ","endLoc":383,"id":14365,"nodeType":"Class","startLoc":17,"text":"@autocheck_required_columns\nclass TimeSeries(BaseTimeSeries):\n    \"\"\"\n    A class to represent time series data in tabular form.\n\n    `~astropy.timeseries.TimeSeries` provides a class for representing time\n    series as a collection of values of different quantities measured at specific\n    points in time (for time series with finite time bins, see the\n    `~astropy.timeseries.BinnedTimeSeries` class).\n    `~astropy.timeseries.TimeSeries` is a sub-class of `~astropy.table.QTable`\n    and thus provides all the standard table maniplation methods available to\n    tables, but it also provides additional conveniences for dealing with time\n    series, such as a flexible initializer for setting up the times, a method\n    for folding time series, and a ``time`` attribute for easy access to the\n    time values.\n\n    See also: https://docs.astropy.org/en/stable/timeseries/\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, `~astropy.table.Table`, or table-like object, optional\n        Data to initialize time series. This does not need to contain the times,\n        which can be provided separately, but if it does contain the times they\n        should be in a column called ``'time'`` to be automatically recognized.\n    time : `~astropy.time.Time`, `~astropy.time.TimeDelta` or iterable\n        The times at which the values are sampled - this can be either given\n        directly as a `~astropy.time.Time` or `~astropy.time.TimeDelta` array\n        or as any iterable that initializes the `~astropy.time.Time` class. If\n        this is given, then the remaining time-related arguments should not be used.\n    time_start : `~astropy.time.Time` or str\n        The time of the first sample in the time series. This is an alternative\n        to providing ``time`` and requires that ``time_delta`` is also provided.\n    time_delta : `~astropy.time.TimeDelta` or `~astropy.units.Quantity` ['time']\n        The step size in time for the series. This can either be a scalar if\n        the time series is evenly sampled, or an array of values if it is not.\n    n_samples : int\n        The number of time samples for the series. This is only used if both\n        ``time_start`` and ``time_delta`` are provided and are scalar values.\n    **kwargs : dict, optional\n        Additional keyword arguments are passed to `~astropy.table.QTable`.\n    \"\"\"\n\n    _required_columns = ['time']\n\n    def __init__(self, data=None, *, time=None, time_start=None,\n                 time_delta=None, n_samples=None, **kwargs):\n\n        super().__init__(data=data, **kwargs)\n\n        # For some operations, an empty time series needs to be created, then\n        # columns added one by one. We should check that when columns are added\n        # manually, time is added first and is of the right type.\n        if data is None and time is None and time_start is None and time_delta is None:\n            self._required_columns_relax = True\n            return\n\n        # First if time has been given in the table data, we should extract it\n        # and treat it as if it had been passed as a keyword argument.\n\n        if data is not None:\n            if n_samples is not None:\n                if n_samples != len(self):\n                    raise TypeError(\"'n_samples' has been given both and it is not the \"\n                                    \"same length as the input data.\")\n            else:\n                n_samples = len(self)\n\n        if 'time' in self.colnames:\n            if time is None:\n                time = self.columns['time']\n            else:\n                raise TypeError(\"'time' has been given both in the table and as a keyword argument\")\n\n        if time is None and time_start is None:\n            raise TypeError(\"Either 'time' or 'time_start' should be specified\")\n        elif time is not None and time_start is not None:\n            raise TypeError(\"Cannot specify both 'time' and 'time_start'\")\n\n        if time is not None and not isinstance(time, (Time, TimeDelta)):\n            time = Time(time)\n\n        if time_start is not None and not isinstance(time_start, (Time, TimeDelta)):\n            time_start = Time(time_start)\n\n        if time_delta is not None and not isinstance(time_delta, (Quantity, TimeDelta)):\n            raise TypeError(\"'time_delta' should be a Quantity or a TimeDelta\")\n\n        if isinstance(time_delta, TimeDelta):\n            time_delta = time_delta.sec * u.s\n\n        if time_start is not None:\n\n            # We interpret this as meaning that time is that of the first\n            # sample and that the interval is given by time_delta.\n\n            if time_delta is None:\n                raise TypeError(\"'time' is scalar, so 'time_delta' is required\")\n\n            if time_delta.isscalar:\n                time_delta = np.repeat(time_delta, n_samples)\n\n            time_delta = np.cumsum(time_delta)\n            time_delta = np.roll(time_delta, 1)\n            time_delta[0] = 0. * u.s\n\n            time = time_start + time_delta\n\n        elif len(self.colnames) > 0 and len(time) != len(self):\n            raise ValueError(\"Length of 'time' ({}) should match \"\n                             \"data length ({})\".format(len(time), n_samples))\n\n        elif time_delta is not None:\n            raise TypeError(\"'time_delta' should not be specified since \"\n                            \"'time' is an array\")\n\n        with self._delay_required_column_checks():\n            if 'time' in self.colnames:\n                self.remove_column('time')\n            self.add_column(time, index=0, name='time')\n\n    @property\n    def time(self):\n        \"\"\"\n        The time values.\n        \"\"\"\n        return self['time']\n\n    @deprecated_renamed_argument('midpoint_epoch', 'epoch_time', '4.0')\n    def fold(self, period=None, epoch_time=None, epoch_phase=0,\n             wrap_phase=None, normalize_phase=False):\n        \"\"\"\n        Return a new `~astropy.timeseries.TimeSeries` folded with a period and\n        epoch.\n\n        Parameters\n        ----------\n        period : `~astropy.units.Quantity` ['time']\n            The period to use for folding\n        epoch_time : `~astropy.time.Time`\n            The time to use as the reference epoch, at which the relative time\n            offset / phase will be ``epoch_phase``. Defaults to the first time\n            in the time series.\n        epoch_phase : float or `~astropy.units.Quantity` ['dimensionless', 'time']\n            Phase of ``epoch_time``. If ``normalize_phase`` is `True`, this\n            should be a dimensionless value, while if ``normalize_phase`` is\n            ``False``, this should be a `~astropy.units.Quantity` with time\n            units. Defaults to 0.\n        wrap_phase : float or `~astropy.units.Quantity` ['dimensionless', 'time']\n            The value of the phase above which values are wrapped back by one\n            period. If ``normalize_phase`` is `True`, this should be a\n            dimensionless value, while if ``normalize_phase`` is ``False``,\n            this should be a `~astropy.units.Quantity` with time units.\n            Defaults to half the period, so that the resulting time series goes\n            from ``-period / 2`` to ``period / 2`` (if ``normalize_phase`` is\n            `False`) or -0.5 to 0.5 (if ``normalize_phase`` is `True`).\n        normalize_phase : bool\n            If `False` phase is returned as `~astropy.time.TimeDelta`,\n            otherwise as a dimensionless `~astropy.units.Quantity`.\n\n        Returns\n        -------\n        folded_timeseries : `~astropy.timeseries.TimeSeries`\n            The folded time series object with phase as the ``time`` column.\n        \"\"\"\n\n        if not isinstance(period, Quantity) or period.unit.physical_type != 'time':\n            raise UnitsError('period should be a Quantity in units of time')\n\n        folded = self.copy()\n\n        if epoch_time is None:\n            epoch_time = self.time[0]\n        else:\n            epoch_time = Time(epoch_time)\n\n        period_sec = period.to_value(u.s)\n\n        if normalize_phase:\n            if isinstance(epoch_phase, Quantity) and epoch_phase.unit.physical_type != 'dimensionless':\n                raise UnitsError('epoch_phase should be a dimensionless Quantity '\n                                 'or a float when normalize_phase=True')\n            epoch_phase_sec = epoch_phase * period_sec\n        else:\n            if epoch_phase == 0:\n                epoch_phase_sec = 0.\n            else:\n                if not isinstance(epoch_phase, Quantity) or epoch_phase.unit.physical_type != 'time':\n                    raise UnitsError('epoch_phase should be a Quantity in units '\n                                     'of time when normalize_phase=False')\n                epoch_phase_sec = epoch_phase.to_value(u.s)\n\n        if wrap_phase is None:\n            wrap_phase = period_sec / 2\n        else:\n            if normalize_phase:\n                if isinstance(wrap_phase, Quantity) and not wrap_phase.unit.is_equivalent(u.one):\n                    raise UnitsError('wrap_phase should be dimensionless when '\n                                     'normalize_phase=True')\n                else:\n                    if wrap_phase < 0 or wrap_phase > 1:\n                        raise ValueError('wrap_phase should be between 0 and 1')\n                    else:\n                        wrap_phase = wrap_phase * period_sec\n            else:\n                if isinstance(wrap_phase, Quantity) and wrap_phase.unit.physical_type == 'time':\n                    if wrap_phase < 0 or wrap_phase > period:\n                        raise ValueError('wrap_phase should be between 0 and the period')\n                    else:\n                        wrap_phase = wrap_phase.to_value(u.s)\n                else:\n                    raise UnitsError('wrap_phase should be a Quantity in units '\n                                     'of time when normalize_phase=False')\n\n        relative_time_sec = (((self.time - epoch_time).sec\n                              + epoch_phase_sec\n                              + (period_sec - wrap_phase)) % period_sec\n                             - (period_sec - wrap_phase))\n\n        folded_time = TimeDelta(relative_time_sec * u.s)\n\n        if normalize_phase:\n            folded_time = (folded_time / period).decompose()\n            period = period_sec = 1\n\n        with folded._delay_required_column_checks():\n            folded.remove_column('time')\n            folded.add_column(folded_time, name='time', index=0)\n\n        return folded\n\n    def __getitem__(self, item):\n        if self._is_list_or_tuple_of_str(item):\n            if 'time' not in item:\n                out = QTable([self[x] for x in item],\n                             meta=deepcopy(self.meta),\n                             copy_indices=self._copy_indices)\n                out._groups = groups.TableGroups(out, indices=self.groups._indices,\n                                                 keys=self.groups._keys)\n                return out\n        return super().__getitem__(item)\n\n    def add_column(self, *args, **kwargs):\n        \"\"\"\n        See :meth:`~astropy.table.Table.add_column`.\n        \"\"\"\n        # Note that the docstring is inherited from QTable\n        result = super().add_column(*args, **kwargs)\n        if len(self.indices) == 0 and 'time' in self.colnames:\n            self.add_index('time')\n        return result\n\n    def add_columns(self, *args, **kwargs):\n        \"\"\"\n        See :meth:`~astropy.table.Table.add_columns`.\n        \"\"\"\n        # Note that the docstring is inherited from QTable\n        result = super().add_columns(*args, **kwargs)\n        if len(self.indices) == 0 and 'time' in self.colnames:\n            self.add_index('time')\n        return result\n\n    @classmethod\n    def from_pandas(self, df, time_scale='utc'):\n        \"\"\"\n        Convert a :class:`~pandas.DataFrame` to a\n        :class:`astropy.timeseries.TimeSeries`.\n\n        Parameters\n        ----------\n        df : :class:`pandas.DataFrame`\n            A pandas :class:`pandas.DataFrame` instance.\n        time_scale : str\n            The time scale to pass into `astropy.time.Time`.\n            Defaults to ``UTC``.\n\n        \"\"\"\n        from pandas import DataFrame, DatetimeIndex\n\n        if not isinstance(df, DataFrame):\n            raise TypeError(\"Input should be a pandas DataFrame\")\n\n        if not isinstance(df.index, DatetimeIndex):\n            raise TypeError(\"DataFrame does not have a DatetimeIndex\")\n\n        time = Time(df.index, scale=time_scale)\n        table = Table.from_pandas(df)\n\n        return TimeSeries(time=time, data=table)\n\n    def to_pandas(self):\n        \"\"\"\n        Convert this :class:`~astropy.timeseries.TimeSeries` to a\n        :class:`~pandas.DataFrame` with a :class:`~pandas.DatetimeIndex` index.\n\n        Returns\n        -------\n        dataframe : :class:`pandas.DataFrame`\n            A pandas :class:`pandas.DataFrame` instance\n        \"\"\"\n        return Table(self).to_pandas(index='time')\n\n    @classmethod\n    def read(self, filename, time_column=None, time_format=None, time_scale=None, format=None, *args, **kwargs):\n        \"\"\"\n        Read and parse a file and returns a `astropy.timeseries.TimeSeries`.\n\n        This method uses the unified I/O infrastructure in Astropy which makes\n        it easy to define readers/writers for various classes\n        (https://docs.astropy.org/en/stable/io/unified.html). By default, this\n        method will try and use readers defined specifically for the\n        `astropy.timeseries.TimeSeries` class - however, it is also\n        possible to use the ``format`` keyword to specify formats defined for\n        the `astropy.table.Table` class - in this case, you will need to also\n        provide the column names for column containing the start times for the\n        bins, as well as other column names (see the Parameters section below\n        for details)::\n\n            >>> from astropy.timeseries import TimeSeries\n            >>> ts = TimeSeries.read('sampled.dat', format='ascii.ecsv',\n            ...                      time_column='date')  # doctest: +SKIP\n\n        Parameters\n        ----------\n        filename : str\n            File to parse.\n        format : str\n            File format specifier.\n        time_column : str, optional\n            The name of the time column.\n        time_format : str, optional\n            The time format for the time column.\n        time_scale : str, optional\n            The time scale for the time column.\n        *args : tuple, optional\n            Positional arguments passed through to the data reader.\n        **kwargs : dict, optional\n            Keyword arguments passed through to the data reader.\n\n        Returns\n        -------\n        out : `astropy.timeseries.sampled.TimeSeries`\n            TimeSeries corresponding to file contents.\n\n        Notes\n        -----\n        \"\"\"\n        try:\n\n            # First we try the readers defined for the BinnedTimeSeries class\n            return super().read(filename, format=format, *args, **kwargs)\n\n        except TypeError:\n\n            # Otherwise we fall back to the default Table readers\n\n            if time_column is None:\n                raise ValueError(\"``time_column`` should be provided since the default Table readers are being used.\")\n\n            table = Table.read(filename, format=format, *args, **kwargs)\n\n            if time_column in table.colnames:\n                time = Time(table.columns[time_column], scale=time_scale, format=time_format)\n                table.remove_column(time_column)\n            else:\n                raise ValueError(f\"Time column '{time_column}' not found in the input data.\")\n\n            return TimeSeries(time=time, data=table)"},{"fileName":"downsample.py","filePath":"astropy/timeseries","id":14366,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport warnings\n\nimport numpy as np\nfrom astropy import units as u\nfrom astropy.time import Time, TimeDelta\nfrom astropy.utils.exceptions import AstropyUserWarning\n\nfrom astropy.timeseries.sampled import TimeSeries\nfrom astropy.timeseries.binned import BinnedTimeSeries\n\n__all__ = ['aggregate_downsample']\n\n\ndef reduceat(array, indices, function):\n    \"\"\"\n    Manual reduceat functionality for cases where Numpy functions don't have a reduceat.\n    It will check if the input function has a reduceat and call that if it does.\n    \"\"\"\n    if len(indices) == 0:\n        return np.array([])\n    elif hasattr(function, 'reduceat'):\n        return np.array(function.reduceat(array, indices))\n    else:\n        result = []\n        for i in range(len(indices) - 1):\n            if indices[i+1] <= indices[i]+1:\n                result.append(function(array[indices[i]]))\n            else:\n                result.append(function(array[indices[i]:indices[i+1]]))\n        result.append(function(array[indices[-1]:]))\n        return np.array(result)\n\n\ndef aggregate_downsample(time_series, *, time_bin_size=None, time_bin_start=None,\n                         time_bin_end=None, n_bins=None, aggregate_func=None):\n    \"\"\"\n    Downsample a time series by binning values into bins with a fixed size or\n    custom sizes, using a single function to combine the values in the bin.\n\n    Parameters\n    ----------\n    time_series : :class:`~astropy.timeseries.TimeSeries`\n        The time series to downsample.\n    time_bin_size : `~astropy.units.Quantity` or `~astropy.time.TimeDelta` ['time'], optional\n        The time interval for the binned time series - this is either a scalar\n        value (in which case all time bins will be assumed to have the same\n        duration) or as an array of values (in which case each time bin can\n        have a different duration). If this argument is provided,\n        ``time_bin_end`` should not be provided.\n    time_bin_start : `~astropy.time.Time` or iterable, optional\n        The start time for the binned time series - this can be either given\n        directly as a `~astropy.time.Time` array or as any iterable that\n        initializes the `~astropy.time.Time` class. This can also be a scalar\n        value if ``time_bin_size`` or ``time_bin_end`` is provided.\n        Defaults to the first time in the sampled time series.\n    time_bin_end : `~astropy.time.Time` or iterable, optional\n        The times of the end of each bin - this can be either given directly as\n        a `~astropy.time.Time` array or as any iterable that initializes the\n        `~astropy.time.Time` class. This can only be given if ``time_bin_start``\n        is provided or its default is used. If ``time_bin_end`` is scalar and\n        ``time_bin_start`` is an array, time bins are assumed to be contiguous;\n        the end of each bin is the start of the next one, and ``time_bin_end`` gives\n        the end time for the last bin.  If ``time_bin_end`` is an array and\n        ``time_bin_start`` is scalar, bins will be contiguous. If both ``time_bin_end``\n        and ``time_bin_start`` are arrays, bins do not need to be contiguous.\n        If this argument is provided, ``time_bin_size`` should not be provided.\n    n_bins : int, optional\n        The number of bins to use. Defaults to the number needed to fit all\n        the original points. If both ``time_bin_start`` and ``time_bin_size``\n        are provided and are scalar values, this determines the total bins\n        within that interval. If ``time_bin_start`` is an iterable, this\n        parameter will be ignored.\n    aggregate_func : callable, optional\n        The function to use for combining points in the same bin. Defaults\n        to np.nanmean.\n\n    Returns\n    -------\n    binned_time_series : :class:`~astropy.timeseries.BinnedTimeSeries`\n        The downsampled time series.\n    \"\"\"\n\n    if not isinstance(time_series, TimeSeries):\n        raise TypeError(\"time_series should be a TimeSeries\")\n\n    if time_bin_size is not None and not isinstance(time_bin_size, (u.Quantity, TimeDelta)):\n        raise TypeError(\"'time_bin_size' should be a Quantity or a TimeDelta\")\n\n    if time_bin_start is not None and not isinstance(time_bin_start, (Time, TimeDelta)):\n        time_bin_start = Time(time_bin_start)\n\n    if time_bin_end is not None and not isinstance(time_bin_end, (Time, TimeDelta)):\n        time_bin_end = Time(time_bin_end)\n\n    # Use the table sorted by time\n    ts_sorted = time_series.iloc[:]\n\n    # If start time is not provided, it is assumed to be the start of the timeseries\n    if time_bin_start is None:\n        time_bin_start = ts_sorted.time[0]\n\n    # Total duration of the timeseries is needed for determining either\n    # `time_bin_size` or `nbins` in the case of scalar `time_bin_start`\n    if time_bin_start.isscalar:\n        time_duration = (ts_sorted.time[-1] - time_bin_start).sec\n\n    if time_bin_size is None and time_bin_end is None:\n        if time_bin_start.isscalar:\n            if n_bins is None:\n                raise TypeError(\"With single 'time_bin_start' either 'n_bins', \"\n                                \"'time_bin_size' or time_bin_end' must be provided\")\n            else:\n                # `nbins` defaults to the number needed to fit all points\n                time_bin_size = time_duration / n_bins * u.s\n        else:\n            time_bin_end = np.maximum(ts_sorted.time[-1], time_bin_start[-1])\n\n    if time_bin_start.isscalar:\n        if time_bin_size is not None:\n            if time_bin_size.isscalar:\n                # Determine the number of bins\n                if n_bins is None:\n                    bin_size_sec = time_bin_size.to_value(u.s)\n                    n_bins = int(np.ceil(time_duration/bin_size_sec))\n        elif time_bin_end is not None:\n            if not time_bin_end.isscalar:\n                # Convert start time to an array and populate using `time_bin_end`\n                scalar_start_time = time_bin_start\n                time_bin_start = time_bin_end.replicate(copy=True)\n                time_bin_start[0] = scalar_start_time\n                time_bin_start[1:] = time_bin_end[:-1]\n\n    # Check for overlapping bins, and warn if they are present\n    if time_bin_end is not None:\n        if (not time_bin_end.isscalar and not time_bin_start.isscalar and\n                np.any(time_bin_start[1:] < time_bin_end[:-1])):\n            warnings.warn(\"Overlapping bins should be avoided since they \"\n                          \"can lead to double-counting of data during binning.\",\n                          AstropyUserWarning)\n\n    binned = BinnedTimeSeries(time_bin_size=time_bin_size,\n                              time_bin_start=time_bin_start,\n                              time_bin_end=time_bin_end,\n                              n_bins=n_bins)\n\n    if aggregate_func is None:\n        aggregate_func = np.nanmean\n\n    # Start and end times of the binned timeseries\n    bin_start = binned.time_bin_start\n    bin_end = binned.time_bin_end\n\n    # Set `n_bins` to match the length of `time_bin_start` if\n    # `n_bins` is unspecified or if `time_bin_start` is an iterable\n    if n_bins is None or not time_bin_start.isscalar:\n        n_bins = len(bin_start)\n\n    # Find the subset of the table that is inside the union of all bins\n    keep = ((ts_sorted.time >= bin_start[0]) & (ts_sorted.time <= bin_end[-1]))\n\n    # Find out indices to be removed because of uncontiguous bins\n    for ind in range(n_bins-1):\n        delete_indices = np.where(np.logical_and(ts_sorted.time > bin_end[ind],\n                                                 ts_sorted.time < bin_start[ind+1]))\n        keep[delete_indices] = False\n\n    subset = ts_sorted[keep]\n\n    # Figure out which bin each row falls in by sorting with respect\n    # to the bin end times\n    indices = np.searchsorted(bin_end, ts_sorted.time[keep])\n\n    # For time == bin_start[i+1] == bin_end[i], let bin_start takes precedence\n    if len(indices) and np.all(bin_start[1:] >= bin_end[:-1]):\n        indices_start = np.searchsorted(subset.time, bin_start[bin_start <= ts_sorted.time[-1]])\n        indices[indices_start] = np.arange(len(indices_start))\n\n    # Determine rows where values are defined\n    if len(indices):\n        groups = np.hstack([0, np.nonzero(np.diff(indices))[0] + 1])\n    else:\n        groups = np.array([])\n\n    # Find unique indices to determine which rows in the final time series\n    # will not be empty.\n    unique_indices = np.unique(indices)\n\n    # Add back columns\n\n    for colname in subset.colnames:\n\n        if colname == 'time':\n            continue\n\n        values = subset[colname]\n\n        # FIXME: figure out how to avoid the following, if possible\n        if not isinstance(values, (np.ndarray, u.Quantity)):\n            warnings.warn(\"Skipping column {0} since it has a mix-in type\", AstropyUserWarning)\n            continue\n\n        if isinstance(values, u.Quantity):\n            data = u.Quantity(np.repeat(np.nan,  n_bins), unit=values.unit)\n            data[unique_indices] = u.Quantity(reduceat(values.value, groups, aggregate_func),\n                                              values.unit, copy=False)\n        else:\n            data = np.ma.zeros(n_bins, dtype=values.dtype)\n            data.mask = 1\n            data[unique_indices] = reduceat(values, groups, aggregate_func)\n            data.mask[unique_indices] = 0\n\n        binned[colname] = data\n\n    return binned\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":11,"id":14368,"name":"ROOT","nodeType":"Attribute","startLoc":11,"text":"ROOT"},{"col":4,"comment":"null","endLoc":135,"header":"def __init__(self, data=None, *, time=None, time_start=None,\n                 time_delta=None, n_samples=None, **kwargs)","id":14369,"name":"__init__","nodeType":"Function","startLoc":61,"text":"def __init__(self, data=None, *, time=None, time_start=None,\n                 time_delta=None, n_samples=None, **kwargs):\n\n        super().__init__(data=data, **kwargs)\n\n        # For some operations, an empty time series needs to be created, then\n        # columns added one by one. We should check that when columns are added\n        # manually, time is added first and is of the right type.\n        if data is None and time is None and time_start is None and time_delta is None:\n            self._required_columns_relax = True\n            return\n\n        # First if time has been given in the table data, we should extract it\n        # and treat it as if it had been passed as a keyword argument.\n\n        if data is not None:\n            if n_samples is not None:\n                if n_samples != len(self):\n                    raise TypeError(\"'n_samples' has been given both and it is not the \"\n                                    \"same length as the input data.\")\n            else:\n                n_samples = len(self)\n\n        if 'time' in self.colnames:\n            if time is None:\n                time = self.columns['time']\n            else:\n                raise TypeError(\"'time' has been given both in the table and as a keyword argument\")\n\n        if time is None and time_start is None:\n            raise TypeError(\"Either 'time' or 'time_start' should be specified\")\n        elif time is not None and time_start is not None:\n            raise TypeError(\"Cannot specify both 'time' and 'time_start'\")\n\n        if time is not None and not isinstance(time, (Time, TimeDelta)):\n            time = Time(time)\n\n        if time_start is not None and not isinstance(time_start, (Time, TimeDelta)):\n            time_start = Time(time_start)\n\n        if time_delta is not None and not isinstance(time_delta, (Quantity, TimeDelta)):\n            raise TypeError(\"'time_delta' should be a Quantity or a TimeDelta\")\n\n        if isinstance(time_delta, TimeDelta):\n            time_delta = time_delta.sec * u.s\n\n        if time_start is not None:\n\n            # We interpret this as meaning that time is that of the first\n            # sample and that the interval is given by time_delta.\n\n            if time_delta is None:\n                raise TypeError(\"'time' is scalar, so 'time_delta' is required\")\n\n            if time_delta.isscalar:\n                time_delta = np.repeat(time_delta, n_samples)\n\n            time_delta = np.cumsum(time_delta)\n            time_delta = np.roll(time_delta, 1)\n            time_delta[0] = 0. * u.s\n\n            time = time_start + time_delta\n\n        elif len(self.colnames) > 0 and len(time) != len(self):\n            raise ValueError(\"Length of 'time' ({}) should match \"\n                             \"data length ({})\".format(len(time), n_samples))\n\n        elif time_delta is not None:\n            raise TypeError(\"'time_delta' should not be specified since \"\n                            \"'time' is an array\")\n\n        with self._delay_required_column_checks():\n            if 'time' in self.colnames:\n                self.remove_column('time')\n            self.add_column(time, index=0, name='time')"},{"className":"BinnedTimeSeries","col":0,"comment":"\n    A class to represent binned time series data in tabular form.\n\n    `~astropy.timeseries.BinnedTimeSeries` provides a class for\n    representing time series as a collection of values of different\n    quantities measured in time bins (for time series with values\n    sampled at specific times, see the `~astropy.timeseries.TimeSeries`\n    class). `~astropy.timeseries.BinnedTimeSeries` is a sub-class of\n    `~astropy.table.QTable` and thus provides all the standard table\n    maniplation methods available to tables, but it also provides\n    additional conveniences for dealing with time series, such as a\n    flexible initializer for setting up the times, and attributes to\n    access the start/center/end time of bins.\n\n    See also: https://docs.astropy.org/en/stable/timeseries/\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, table-like object, optional\n        Data to initialize time series. This does not need to contain the\n        times, which can be provided separately, but if it does contain the\n        times they should be in columns called ``'time_bin_start'`` and\n        ``'time_bin_size'`` to be automatically recognized.\n    time_bin_start : `~astropy.time.Time` or iterable\n        The times of the start of each bin - this can be either given\n        directly as a `~astropy.time.Time` array or as any iterable that\n        initializes the `~astropy.time.Time` class. If this is given, then\n        the remaining time-related arguments should not be used. This can also\n        be a scalar value if ``time_bin_size`` is provided.\n    time_bin_end : `~astropy.time.Time` or iterable\n        The times of the end of each bin - this can be either given directly\n        as a `~astropy.time.Time` array or as any value or iterable that\n        initializes the `~astropy.time.Time` class. If this is given, then the\n        remaining time-related arguments should not be used. This can only be\n        given if ``time_bin_start`` is an array of values. If ``time_bin_end``\n        is a scalar, time bins are assumed to be contiguous, such that the end\n        of each bin is the start of the next one, and ``time_bin_end`` gives\n        the end time for the last bin. If ``time_bin_end`` is an array, the\n        time bins do not need to be contiguous. If this argument is provided,\n        ``time_bin_size`` should not be provided.\n    time_bin_size : `~astropy.time.TimeDelta` or `~astropy.units.Quantity`\n        The size of the time bins, either as a scalar value (in which case all\n        time bins will be assumed to have the same duration) or as an array of\n        values (in which case each time bin can have a different duration).\n        If this argument is provided, ``time_bin_end`` should not be provided.\n    n_bins : int\n        The number of time bins for the series. This is only used if both\n        ``time_bin_start`` and ``time_bin_size`` are provided and are scalar\n        values.\n    **kwargs : dict, optional\n        Additional keyword arguments are passed to `~astropy.table.QTable`.\n    ","endLoc":345,"id":14371,"nodeType":"Class","startLoc":17,"text":"@autocheck_required_columns\nclass BinnedTimeSeries(BaseTimeSeries):\n    \"\"\"\n    A class to represent binned time series data in tabular form.\n\n    `~astropy.timeseries.BinnedTimeSeries` provides a class for\n    representing time series as a collection of values of different\n    quantities measured in time bins (for time series with values\n    sampled at specific times, see the `~astropy.timeseries.TimeSeries`\n    class). `~astropy.timeseries.BinnedTimeSeries` is a sub-class of\n    `~astropy.table.QTable` and thus provides all the standard table\n    maniplation methods available to tables, but it also provides\n    additional conveniences for dealing with time series, such as a\n    flexible initializer for setting up the times, and attributes to\n    access the start/center/end time of bins.\n\n    See also: https://docs.astropy.org/en/stable/timeseries/\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, table-like object, optional\n        Data to initialize time series. This does not need to contain the\n        times, which can be provided separately, but if it does contain the\n        times they should be in columns called ``'time_bin_start'`` and\n        ``'time_bin_size'`` to be automatically recognized.\n    time_bin_start : `~astropy.time.Time` or iterable\n        The times of the start of each bin - this can be either given\n        directly as a `~astropy.time.Time` array or as any iterable that\n        initializes the `~astropy.time.Time` class. If this is given, then\n        the remaining time-related arguments should not be used. This can also\n        be a scalar value if ``time_bin_size`` is provided.\n    time_bin_end : `~astropy.time.Time` or iterable\n        The times of the end of each bin - this can be either given directly\n        as a `~astropy.time.Time` array or as any value or iterable that\n        initializes the `~astropy.time.Time` class. If this is given, then the\n        remaining time-related arguments should not be used. This can only be\n        given if ``time_bin_start`` is an array of values. If ``time_bin_end``\n        is a scalar, time bins are assumed to be contiguous, such that the end\n        of each bin is the start of the next one, and ``time_bin_end`` gives\n        the end time for the last bin. If ``time_bin_end`` is an array, the\n        time bins do not need to be contiguous. If this argument is provided,\n        ``time_bin_size`` should not be provided.\n    time_bin_size : `~astropy.time.TimeDelta` or `~astropy.units.Quantity`\n        The size of the time bins, either as a scalar value (in which case all\n        time bins will be assumed to have the same duration) or as an array of\n        values (in which case each time bin can have a different duration).\n        If this argument is provided, ``time_bin_end`` should not be provided.\n    n_bins : int\n        The number of time bins for the series. This is only used if both\n        ``time_bin_start`` and ``time_bin_size`` are provided and are scalar\n        values.\n    **kwargs : dict, optional\n        Additional keyword arguments are passed to `~astropy.table.QTable`.\n    \"\"\"\n\n    _required_columns = ['time_bin_start', 'time_bin_size']\n\n    def __init__(self, data=None, *, time_bin_start=None, time_bin_end=None,\n                 time_bin_size=None, n_bins=None, **kwargs):\n\n        super().__init__(data=data, **kwargs)\n\n        # For some operations, an empty time series needs to be created, then\n        # columns added one by one. We should check that when columns are added\n        # manually, time is added first and is of the right type.\n        if (data is None and time_bin_start is None and time_bin_end is None and\n                time_bin_size is None and n_bins is None):\n            self._required_columns_relax = True\n            return\n\n        # First if time_bin_start and time_bin_end have been given in the table data, we\n        # should extract them and treat them as if they had been passed as\n        # keyword arguments.\n\n        if 'time_bin_start' in self.colnames:\n            if time_bin_start is None:\n                time_bin_start = self.columns['time_bin_start']\n            else:\n                raise TypeError(\"'time_bin_start' has been given both in the table \"\n                                \"and as a keyword argument\")\n\n        if 'time_bin_size' in self.colnames:\n            if time_bin_size is None:\n                time_bin_size = self.columns['time_bin_size']\n            else:\n                raise TypeError(\"'time_bin_size' has been given both in the table \"\n                                \"and as a keyword argument\")\n\n        if time_bin_start is None:\n            raise TypeError(\"'time_bin_start' has not been specified\")\n\n        if time_bin_end is None and time_bin_size is None:\n            raise TypeError(\"Either 'time_bin_size' or 'time_bin_end' should be specified\")\n\n        if not isinstance(time_bin_start, (Time, TimeDelta)):\n            time_bin_start = Time(time_bin_start)\n\n        if time_bin_end is not None and not isinstance(time_bin_end, (Time, TimeDelta)):\n            time_bin_end = Time(time_bin_end)\n\n        if time_bin_size is not None and not isinstance(time_bin_size, (Quantity, TimeDelta)):\n            raise TypeError(\"'time_bin_size' should be a Quantity or a TimeDelta\")\n\n        if isinstance(time_bin_size, TimeDelta):\n            time_bin_size = time_bin_size.sec * u.s\n\n        if n_bins is not None and time_bin_size is not None:\n            if not (time_bin_start.isscalar and time_bin_size.isscalar):\n                raise TypeError(\"'n_bins' cannot be specified if 'time_bin_start' or \"\n                                \"'time_bin_size' are not scalar'\")\n\n        if time_bin_start.isscalar:\n\n            # We interpret this as meaning that this is the start of the\n            # first bin and that the bins are contiguous. In this case,\n            # we require time_bin_size to be specified.\n\n            if time_bin_size is None:\n                raise TypeError(\"'time_bin_start' is scalar, so 'time_bin_size' is required\")\n\n            if time_bin_size.isscalar:\n                if data is not None:\n                    if n_bins is not None:\n                        if n_bins != len(self):\n                            raise TypeError(\"'n_bins' has been given and it is not the \"\n                                            \"same length as the input data.\")\n                    else:\n                        n_bins = len(self)\n\n                time_bin_size = np.repeat(time_bin_size, n_bins)\n\n            time_delta = np.cumsum(time_bin_size)\n            time_bin_end = time_bin_start + time_delta\n\n            # Now shift the array so that the first entry is 0\n            time_delta = np.roll(time_delta, 1)\n            time_delta[0] = 0. * u.s\n\n            # Make time_bin_start into an array\n            time_bin_start = time_bin_start + time_delta\n\n        else:\n\n            if len(self.colnames) > 0 and len(time_bin_start) != len(self):\n                raise ValueError(\"Length of 'time_bin_start' ({}) should match \"\n                                 \"table length ({})\".format(len(time_bin_start), len(self)))\n\n            if time_bin_end is not None:\n                if time_bin_end.isscalar:\n                    times = time_bin_start.copy()\n                    times[:-1] = times[1:]\n                    times[-1] = time_bin_end\n                    time_bin_end = times\n                time_bin_size = (time_bin_end - time_bin_start).sec * u.s\n\n        if time_bin_size.isscalar:\n            time_bin_size = np.repeat(time_bin_size, len(self))\n\n        with self._delay_required_column_checks():\n\n            if 'time_bin_start' in self.colnames:\n                self.remove_column('time_bin_start')\n\n            if 'time_bin_size' in self.colnames:\n                self.remove_column('time_bin_size')\n\n            self.add_column(time_bin_start, index=0, name='time_bin_start')\n            self.add_index('time_bin_start')\n            self.add_column(time_bin_size, index=1, name='time_bin_size')\n\n    @property\n    def time_bin_start(self):\n        \"\"\"\n        The start times of all the time bins.\n        \"\"\"\n        return self['time_bin_start']\n\n    @property\n    def time_bin_center(self):\n        \"\"\"\n        The center times of all the time bins.\n        \"\"\"\n        return self['time_bin_start'] + self['time_bin_size'] * 0.5\n\n    @property\n    def time_bin_end(self):\n        \"\"\"\n        The end times of all the time bins.\n        \"\"\"\n        return self['time_bin_start'] + self['time_bin_size']\n\n    @property\n    def time_bin_size(self):\n        \"\"\"\n        The sizes of all the time bins.\n        \"\"\"\n        return self['time_bin_size']\n\n    def __getitem__(self, item):\n        if self._is_list_or_tuple_of_str(item):\n            if 'time_bin_start' not in item or 'time_bin_size' not in item:\n                out = QTable([self[x] for x in item],\n                             meta=deepcopy(self.meta),\n                             copy_indices=self._copy_indices)\n                out._groups = groups.TableGroups(out, indices=self.groups._indices,\n                                                 keys=self.groups._keys)\n                return out\n        return super().__getitem__(item)\n\n    @classmethod\n    def read(self, filename, time_bin_start_column=None, time_bin_end_column=None,\n             time_bin_size_column=None, time_bin_size_unit=None, time_format=None, time_scale=None,\n             format=None, *args, **kwargs):\n        \"\"\"\n        Read and parse a file and returns a `astropy.timeseries.BinnedTimeSeries`.\n\n        This method uses the unified I/O infrastructure in Astropy which makes\n        it easy to define readers/writers for various classes\n        (https://docs.astropy.org/en/stable/io/unified.html). By default, this\n        method will try and use readers defined specifically for the\n        `astropy.timeseries.BinnedTimeSeries` class - however, it is also\n        possible to use the ``format`` keyword to specify formats defined for\n        the `astropy.table.Table` class - in this case, you will need to also\n        provide the column names for column containing the start times for the\n        bins, as well as other column names (see the Parameters section below\n        for details)::\n\n            >>> from astropy.timeseries.binned import BinnedTimeSeries\n            >>> ts = BinnedTimeSeries.read('binned.dat', format='ascii.ecsv',\n            ...                            time_bin_start_column='date_start',\n            ...                            time_bin_end_column='date_end')  # doctest: +SKIP\n\n        Parameters\n        ----------\n        filename : str\n            File to parse.\n        format : str\n            File format specifier.\n        time_bin_start_column : str\n            The name of the column with the start time for each bin.\n        time_bin_end_column : str, optional\n            The name of the column with the end time for each bin. Either this\n            option or ``time_bin_size_column`` should be specified.\n        time_bin_size_column : str, optional\n            The name of the column with the size for each bin. Either this\n            option or ``time_bin_end_column`` should be specified.\n        time_bin_size_unit : `astropy.units.Unit`, optional\n            If ``time_bin_size_column`` is specified but does not have a unit\n            set in the table, you can specify the unit manually.\n        time_format : str, optional\n            The time format for the start and end columns.\n        time_scale : str, optional\n            The time scale for the start and end columns.\n        *args : tuple, optional\n            Positional arguments passed through to the data reader.\n        **kwargs : dict, optional\n            Keyword arguments passed through to the data reader.\n\n        Returns\n        -------\n        out : `astropy.timeseries.binned.BinnedTimeSeries`\n            BinnedTimeSeries corresponding to the file.\n\n        \"\"\"\n\n        try:\n\n            # First we try the readers defined for the BinnedTimeSeries class\n            return super().read(filename, format=format, *args, **kwargs)\n\n        except TypeError:\n\n            # Otherwise we fall back to the default Table readers\n\n            if time_bin_start_column is None:\n                raise ValueError(\"``time_bin_start_column`` should be provided since the default Table readers are being used.\")\n            if time_bin_end_column is None and time_bin_size_column is None:\n                raise ValueError(\"Either `time_bin_end_column` or `time_bin_size_column` should be provided.\")\n            elif time_bin_end_column is not None and time_bin_size_column is not None:\n                raise ValueError(\"Cannot specify both `time_bin_end_column` and `time_bin_size_column`.\")\n\n            table = Table.read(filename, format=format, *args, **kwargs)\n\n            if time_bin_start_column in table.colnames:\n                time_bin_start = Time(table.columns[time_bin_start_column],\n                                      scale=time_scale, format=time_format)\n                table.remove_column(time_bin_start_column)\n            else:\n                raise ValueError(f\"Bin start time column '{time_bin_start_column}' not found in the input data.\")\n\n            if time_bin_end_column is not None:\n\n                if time_bin_end_column in table.colnames:\n                    time_bin_end = Time(table.columns[time_bin_end_column],\n                                        scale=time_scale, format=time_format)\n                    table.remove_column(time_bin_end_column)\n                else:\n                    raise ValueError(f\"Bin end time column '{time_bin_end_column}' not found in the input data.\")\n\n                time_bin_size = None\n\n            elif time_bin_size_column is not None:\n\n                if time_bin_size_column in table.colnames:\n                    time_bin_size = table.columns[time_bin_size_column]\n                    table.remove_column(time_bin_size_column)\n                else:\n                    raise ValueError(f\"Bin size column '{time_bin_size_column}' not found in the input data.\")\n\n                if time_bin_size.unit is None:\n                    if time_bin_size_unit is None or not isinstance(time_bin_size_unit, u.UnitBase):\n                        raise ValueError(\"The bin size unit should be specified as an astropy Unit using ``time_bin_size_unit``.\")\n                    time_bin_size = time_bin_size * time_bin_size_unit\n                else:\n                    time_bin_size = u.Quantity(time_bin_size)\n\n                time_bin_end = None\n\n            if time_bin_start.isscalar and time_bin_size.isscalar:\n                return BinnedTimeSeries(data=table,\n                                    time_bin_start=time_bin_start,\n                                    time_bin_end=time_bin_end,\n                                    time_bin_size=time_bin_size,\n                                    n_bins=len(table))\n            else:\n                return BinnedTimeSeries(data=table,\n                                    time_bin_start=time_bin_start,\n                                    time_bin_end=time_bin_end,\n                                    time_bin_size=time_bin_size)"},{"col":4,"comment":"null","endLoc":31,"header":"def ellipkinc(*args, **kwargs)","id":14372,"name":"ellipkinc","nodeType":"Function","startLoc":30,"text":"def ellipkinc(*args, **kwargs):\n        raise ModuleNotFoundError(\"No module named 'scipy.special'\")"},{"col":4,"comment":"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2`` in a flat, :math:`\\Omega_{\\Lambda}=1` cosmology\n        (de Sitter).\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        The de Sitter case has an analytic solution.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts. Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n        ","endLoc":1744,"header":"def _dS_comoving_distance_z1z2(self, z1, z2)","id":14373,"name":"_dS_comoving_distance_z1z2","nodeType":"Function","startLoc":1718,"text":"def _dS_comoving_distance_z1z2(self, z1, z2):\n        r\"\"\"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2`` in a flat, :math:`\\Omega_{\\Lambda}=1` cosmology\n        (de Sitter).\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        The de Sitter case has an analytic solution.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts. Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n        \"\"\"\n        try:\n            z1, z2 = np.broadcast_arrays(z1, z2)\n        except ValueError as e:\n            raise ValueError(\"z1 and z2 have different shapes\") from e\n\n        return self._hubble_distance * (z2 - z1)"},{"col":4,"comment":"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2`` in a flat, :math:`\\Omega_M=1` cosmology\n        (Einstein - de Sitter).\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        For :math:`\\Omega_M=1`, :math:`\\Omega_{rad}=0` the comoving distance\n        has an analytic solution.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts. Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n        ","endLoc":1774,"header":"def _EdS_comoving_distance_z1z2(self, z1, z2)","id":14374,"name":"_EdS_comoving_distance_z1z2","nodeType":"Function","startLoc":1746,"text":"def _EdS_comoving_distance_z1z2(self, z1, z2):\n        r\"\"\"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2`` in a flat, :math:`\\Omega_M=1` cosmology\n        (Einstein - de Sitter).\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        For :math:`\\Omega_M=1`, :math:`\\Omega_{rad}=0` the comoving distance\n        has an analytic solution.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts. Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n        \"\"\"\n        try:\n            z1, z2 = np.broadcast_arrays(z1, z2)\n        except ValueError as e:\n            raise ValueError(\"z1 and z2 have different shapes\") from e\n\n        prefactor = 2 * self._hubble_distance\n        return prefactor * ((z1 + 1.0)**(-1./2) - (z2 + 1.0)**(-1./2))"},{"attributeType":"null","col":16,"comment":"null","endLoc":5,"id":14375,"name":"np","nodeType":"Attribute","startLoc":5,"text":"np"},{"attributeType":"null","col":29,"comment":"null","endLoc":9,"id":14376,"name":"u","nodeType":"Attribute","startLoc":9,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":14377,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":4,"comment":"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2``.\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        For :math:`\\Omega_{rad} = 0` the comoving distance can be directly\n        calculated as a hypergeometric function [1]_.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n\n        References\n        ----------\n        .. [1] Baes, M., Camps, P., & Van De Putte, D. (2017). Analytical\n               expressions and numerical evaluation of the luminosity distance\n               in a flat cosmology. MNRAS, 468(1), 927-930.\n        ","endLoc":1812,"header":"def _hypergeometric_comoving_distance_z1z2(self, z1, z2)","id":14378,"name":"_hypergeometric_comoving_distance_z1z2","nodeType":"Function","startLoc":1776,"text":"def _hypergeometric_comoving_distance_z1z2(self, z1, z2):\n        r\"\"\"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2``.\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        For :math:`\\Omega_{rad} = 0` the comoving distance can be directly\n        calculated as a hypergeometric function [1]_.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n\n        References\n        ----------\n        .. [1] Baes, M., Camps, P., & Van De Putte, D. (2017). Analytical\n               expressions and numerical evaluation of the luminosity distance\n               in a flat cosmology. MNRAS, 468(1), 927-930.\n        \"\"\"\n        try:\n            z1, z2 = np.broadcast_arrays(z1, z2)\n        except ValueError as e:\n            raise ValueError(\"z1 and z2 have different shapes\") from e\n\n        s = ((1 - self._Om0) / self._Om0) ** (1./3)\n        # Use np.sqrt here to handle negative s (Om0>1).\n        prefactor = self._hubble_distance / np.sqrt(s * self._Om0)\n        return prefactor * (self._T_hypergeometric(s / (z1 + 1.0)) -\n                            self._T_hypergeometric(s / (z2 + 1.0)))"},{"col":0,"comment":"","endLoc":3,"header":"binned.py#<anonymous>","id":14379,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['BinnedTimeSeries']"},{"id":14380,"name":"astropy/timeseries/io","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/timeseries/io","id":14381,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom .kepler import *\n"},{"fileName":"kepler.py","filePath":"astropy/timeseries/io","id":14382,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport warnings\n\nimport numpy as np\n\nfrom astropy.io import registry, fits\nfrom astropy.table import Table, MaskedColumn\nfrom astropy.time import Time, TimeDelta\n\nfrom astropy.timeseries.sampled import TimeSeries\n\n__all__ = [\"kepler_fits_reader\"]\n\n\ndef kepler_fits_reader(filename):\n    \"\"\"\n    This serves as the FITS reader for KEPLER or TESS files within\n    astropy-timeseries.\n\n    This function should generally not be called directly, and instead this\n    time series reader should be accessed with the\n    :meth:`~astropy.timeseries.TimeSeries.read` method::\n\n        >>> from astropy.timeseries import TimeSeries\n        >>> ts = TimeSeries.read('kplr33122.fits', format='kepler.fits')  # doctest: +SKIP\n\n    Parameters\n    ----------\n    filename : `str` or `pathlib.Path`\n        File to load.\n\n    Returns\n    -------\n    ts : `~astropy.timeseries.TimeSeries`\n        Data converted into a TimeSeries.\n    \"\"\"\n    hdulist = fits.open(filename)\n    # Get the lightcurve HDU\n    telescope = hdulist[0].header['telescop'].lower()\n\n    if telescope == 'tess':\n        hdu = hdulist['LIGHTCURVE']\n    elif telescope == 'kepler':\n        hdu = hdulist[1]\n    else:\n        raise NotImplementedError(\"{} is not implemented, only KEPLER or TESS are \"\n                                  \"supported through this reader\".format(hdulist[0].header['telescop']))\n\n    if hdu.header['EXTVER'] > 1:\n        raise NotImplementedError(\"Support for {} v{} files not yet \"\n                                  \"implemented\".format(hdu.header['TELESCOP'], hdu.header['EXTVER']))\n\n    # Check time scale\n    if hdu.header['TIMESYS'] != 'TDB':\n        raise NotImplementedError(\"Support for {} time scale not yet \"\n                                  \"implemented in {} reader\".format(hdu.header['TIMESYS'], hdu.header['TELESCOP']))\n\n    tab = Table.read(hdu, format='fits')\n\n    # Some KEPLER files have a T column instead of TIME.\n    if \"T\" in tab.colnames:\n        tab.rename_column(\"T\", \"TIME\")\n\n    for colname in tab.colnames:\n        unit = tab[colname].unit\n        # Make masks nan for any column which will turn into a Quantity\n        # later. TODO: remove once we support Masked Quantities properly?\n        if unit and isinstance(tab[colname], MaskedColumn):\n            tab[colname] = tab[colname].filled(np.nan)\n        # Fix units\n        if unit == 'e-/s':\n            tab[colname].unit = 'electron/s'\n        if unit == 'pixels':\n            tab[colname].unit = 'pixel'\n\n        # Rename columns to lowercase\n        tab.rename_column(colname, colname.lower())\n\n    # Filter out NaN rows\n    nans = np.isnan(tab['time'].data)\n    if np.any(nans):\n        warnings.warn(f'Ignoring {np.sum(nans)} rows with NaN times')\n    tab = tab[~nans]\n\n    # Time column is dependent on source and we correct it here\n    reference_date = Time(hdu.header['BJDREFI'], hdu.header['BJDREFF'],\n                          scale=hdu.header['TIMESYS'].lower(), format='jd')\n    time = reference_date + TimeDelta(tab['time'].data)\n    time.format = 'isot'\n\n    # Remove original time column\n    tab.remove_column('time')\n\n    hdulist.close()\n\n    return TimeSeries(time=time, data=tab)\n\n\nregistry.register_reader('kepler.fits', TimeSeries, kepler_fits_reader)\nregistry.register_reader('tess.fits', TimeSeries, kepler_fits_reader)\n"},{"col":4,"comment":"null","endLoc":185,"header":"def __init__(self, data=None, *, time_bin_start=None, time_bin_end=None,\n                 time_bin_size=None, n_bins=None, **kwargs)","id":14383,"name":"__init__","nodeType":"Function","startLoc":74,"text":"def __init__(self, data=None, *, time_bin_start=None, time_bin_end=None,\n                 time_bin_size=None, n_bins=None, **kwargs):\n\n        super().__init__(data=data, **kwargs)\n\n        # For some operations, an empty time series needs to be created, then\n        # columns added one by one. We should check that when columns are added\n        # manually, time is added first and is of the right type.\n        if (data is None and time_bin_start is None and time_bin_end is None and\n                time_bin_size is None and n_bins is None):\n            self._required_columns_relax = True\n            return\n\n        # First if time_bin_start and time_bin_end have been given in the table data, we\n        # should extract them and treat them as if they had been passed as\n        # keyword arguments.\n\n        if 'time_bin_start' in self.colnames:\n            if time_bin_start is None:\n                time_bin_start = self.columns['time_bin_start']\n            else:\n                raise TypeError(\"'time_bin_start' has been given both in the table \"\n                                \"and as a keyword argument\")\n\n        if 'time_bin_size' in self.colnames:\n            if time_bin_size is None:\n                time_bin_size = self.columns['time_bin_size']\n            else:\n                raise TypeError(\"'time_bin_size' has been given both in the table \"\n                                \"and as a keyword argument\")\n\n        if time_bin_start is None:\n            raise TypeError(\"'time_bin_start' has not been specified\")\n\n        if time_bin_end is None and time_bin_size is None:\n            raise TypeError(\"Either 'time_bin_size' or 'time_bin_end' should be specified\")\n\n        if not isinstance(time_bin_start, (Time, TimeDelta)):\n            time_bin_start = Time(time_bin_start)\n\n        if time_bin_end is not None and not isinstance(time_bin_end, (Time, TimeDelta)):\n            time_bin_end = Time(time_bin_end)\n\n        if time_bin_size is not None and not isinstance(time_bin_size, (Quantity, TimeDelta)):\n            raise TypeError(\"'time_bin_size' should be a Quantity or a TimeDelta\")\n\n        if isinstance(time_bin_size, TimeDelta):\n            time_bin_size = time_bin_size.sec * u.s\n\n        if n_bins is not None and time_bin_size is not None:\n            if not (time_bin_start.isscalar and time_bin_size.isscalar):\n                raise TypeError(\"'n_bins' cannot be specified if 'time_bin_start' or \"\n                                \"'time_bin_size' are not scalar'\")\n\n        if time_bin_start.isscalar:\n\n            # We interpret this as meaning that this is the start of the\n            # first bin and that the bins are contiguous. In this case,\n            # we require time_bin_size to be specified.\n\n            if time_bin_size is None:\n                raise TypeError(\"'time_bin_start' is scalar, so 'time_bin_size' is required\")\n\n            if time_bin_size.isscalar:\n                if data is not None:\n                    if n_bins is not None:\n                        if n_bins != len(self):\n                            raise TypeError(\"'n_bins' has been given and it is not the \"\n                                            \"same length as the input data.\")\n                    else:\n                        n_bins = len(self)\n\n                time_bin_size = np.repeat(time_bin_size, n_bins)\n\n            time_delta = np.cumsum(time_bin_size)\n            time_bin_end = time_bin_start + time_delta\n\n            # Now shift the array so that the first entry is 0\n            time_delta = np.roll(time_delta, 1)\n            time_delta[0] = 0. * u.s\n\n            # Make time_bin_start into an array\n            time_bin_start = time_bin_start + time_delta\n\n        else:\n\n            if len(self.colnames) > 0 and len(time_bin_start) != len(self):\n                raise ValueError(\"Length of 'time_bin_start' ({}) should match \"\n                                 \"table length ({})\".format(len(time_bin_start), len(self)))\n\n            if time_bin_end is not None:\n                if time_bin_end.isscalar:\n                    times = time_bin_start.copy()\n                    times[:-1] = times[1:]\n                    times[-1] = time_bin_end\n                    time_bin_end = times\n                time_bin_size = (time_bin_end - time_bin_start).sec * u.s\n\n        if time_bin_size.isscalar:\n            time_bin_size = np.repeat(time_bin_size, len(self))\n\n        with self._delay_required_column_checks():\n\n            if 'time_bin_start' in self.colnames:\n                self.remove_column('time_bin_start')\n\n            if 'time_bin_size' in self.colnames:\n                self.remove_column('time_bin_size')\n\n            self.add_column(time_bin_start, index=0, name='time_bin_start')\n            self.add_index('time_bin_start')\n            self.add_column(time_bin_size, index=1, name='time_bin_size')"},{"attributeType":"null","col":4,"comment":"null","endLoc":21,"id":14384,"name":"root","nodeType":"Attribute","startLoc":21,"text":"root"},{"attributeType":"null","col":10,"comment":"null","endLoc":21,"id":14385,"name":"dirnames","nodeType":"Attribute","startLoc":21,"text":"dirnames"},{"attributeType":"null","col":20,"comment":"null","endLoc":21,"id":14386,"name":"files","nodeType":"Attribute","startLoc":21,"text":"files"},{"attributeType":"null","col":4,"comment":"null","endLoc":27,"id":14387,"name":"pos","nodeType":"Attribute","startLoc":27,"text":"pos"},{"col":4,"comment":"Compute value using Gauss Hypergeometric function 2F1.\n\n        .. math::\n\n           T(x) = 2 \\sqrt(x) _{2}F_{1}\\left(\\frac{1}{6}, \\frac{1}{2};\n                                            \\frac{7}{6}; -x^3 \\right)\n\n        Notes\n        -----\n        The :func:`scipy.special.hyp2f1` code already implements the\n        hypergeometric transformation suggested by Baes et al. [1]_ for use in\n        actual numerical evaulations.\n\n        References\n        ----------\n        .. [1] Baes, M., Camps, P., & Van De Putte, D. (2017). Analytical\n           expressions and numerical evaluation of the luminosity distance\n           in a flat cosmology. MNRAS, 468(1), 927-930.\n        ","endLoc":1834,"header":"def _T_hypergeometric(self, x)","id":14388,"name":"_T_hypergeometric","nodeType":"Function","startLoc":1814,"text":"def _T_hypergeometric(self, x):\n        r\"\"\"Compute value using Gauss Hypergeometric function 2F1.\n\n        .. math::\n\n           T(x) = 2 \\sqrt(x) _{2}F_{1}\\left(\\frac{1}{6}, \\frac{1}{2};\n                                            \\frac{7}{6}; -x^3 \\right)\n\n        Notes\n        -----\n        The :func:`scipy.special.hyp2f1` code already implements the\n        hypergeometric transformation suggested by Baes et al. [1]_ for use in\n        actual numerical evaulations.\n\n        References\n        ----------\n        .. [1] Baes, M., Camps, P., & Van De Putte, D. (2017). Analytical\n           expressions and numerical evaluation of the luminosity distance\n           in a flat cosmology. MNRAS, 468(1), 927-930.\n        \"\"\"\n        return 2 * np.sqrt(x) * hyp2f1(1./6, 1./2, 7./6, -x**3)"},{"col":4,"comment":"Return the density parameter for dark energy at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Ode : ndarray or float\n            The density of non-relativistic matter relative to the critical\n            density at each redshift.\n            Returns `float` if the input is scalar.\n        ","endLoc":491,"header":"def Ode(self, z)","id":14389,"name":"Ode","nodeType":"Function","startLoc":473,"text":"def Ode(self, z):\n        \"\"\"Return the density parameter for dark energy at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Ode : ndarray or float\n            The density of non-relativistic matter relative to the critical\n            density at each redshift.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        z = aszarr(z)\n        if self._Ode0 == 0:  # Common enough to be worth checking explicitly\n            return np.zeros(z.shape) if hasattr(z, \"shape\") else 0.0\n        return self._Ode0 * self.de_density_scale(z) * self.inv_efunc(z) ** 2"},{"attributeType":"null","col":4,"comment":"null","endLoc":28,"id":14390,"name":"test_root","nodeType":"Attribute","startLoc":28,"text":"test_root"},{"attributeType":"null","col":8,"comment":"null","endLoc":31,"id":14391,"name":"dirname","nodeType":"Attribute","startLoc":31,"text":"dirname"},{"attributeType":"null","col":8,"comment":"null","endLoc":32,"id":14392,"name":"final_dir","nodeType":"Attribute","startLoc":32,"text":"final_dir"},{"attributeType":"null","col":12,"comment":"null","endLoc":41,"id":14393,"name":"init_filename","nodeType":"Attribute","startLoc":41,"text":"init_filename"},{"col":4,"comment":"null","endLoc":34,"header":"def hyp2f1(*args, **kwargs)","id":14394,"name":"hyp2f1","nodeType":"Function","startLoc":33,"text":"def hyp2f1(*args, **kwargs):\n        raise ModuleNotFoundError(\"No module named 'scipy.special'\")"},{"col":4,"comment":"Age of the universe in Gyr at redshift ``z``.\n\n        The age of a de Sitter Universe is infinite.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n        ","endLoc":1852,"header":"def _dS_age(self, z)","id":14395,"name":"_dS_age","nodeType":"Function","startLoc":1836,"text":"def _dS_age(self, z):\n        \"\"\"Age of the universe in Gyr at redshift ``z``.\n\n        The age of a de Sitter Universe is infinite.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n        \"\"\"\n        t = (inf if isinstance(z, Number) else np.full_like(z, inf, dtype=float))\n        return self._hubble_time * t"},{"attributeType":"null","col":74,"comment":"null","endLoc":44,"id":14396,"name":"f","nodeType":"Attribute","startLoc":44,"text":"f"},{"attributeType":"null","col":8,"comment":"null","endLoc":47,"id":14397,"name":"file","nodeType":"Attribute","startLoc":47,"text":"file"},{"col":4,"comment":"Age of the universe in Gyr at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated as an elliptic integral [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n\n        References\n        ----------\n        .. [1] Thomas, R., & Kantowski, R. (2000). Age-redshift relation for\n               standard cosmology. PRD, 62(10), 103507.\n        ","endLoc":1875,"header":"def _EdS_age(self, z)","id":14398,"name":"_EdS_age","nodeType":"Function","startLoc":1854,"text":"def _EdS_age(self, z):\n        r\"\"\"Age of the universe in Gyr at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated as an elliptic integral [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n\n        References\n        ----------\n        .. [1] Thomas, R., & Kantowski, R. (2000). Age-redshift relation for\n               standard cosmology. PRD, 62(10), 103507.\n        \"\"\"\n        return (2./3) * self._hubble_time * (aszarr(z) + 1.0) ** (-1.5)"},{"col":4,"comment":"Age of the universe in Gyr at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated as an elliptic integral [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n\n        References\n        ----------\n        .. [1] Thomas, R., & Kantowski, R. (2000). Age-redshift relation for\n               standard cosmology. PRD, 62(10), 103507.\n        ","endLoc":1902,"header":"def _flat_age(self, z)","id":14399,"name":"_flat_age","nodeType":"Function","startLoc":1877,"text":"def _flat_age(self, z):\n        r\"\"\"Age of the universe in Gyr at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated as an elliptic integral [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n\n        References\n        ----------\n        .. [1] Thomas, R., & Kantowski, R. (2000). Age-redshift relation for\n               standard cosmology. PRD, 62(10), 103507.\n        \"\"\"\n        # Use np.sqrt, np.arcsinh instead of math.sqrt, math.asinh\n        # to handle properly the complex numbers for 1 - Om0 < 0\n        prefactor = (2./3) * self._hubble_time / np.emath.sqrt(1 - self._Om0)\n        arg = np.arcsinh(np.emath.sqrt((1 / self._Om0 - 1 + 0j) / (aszarr(z) + 1.0)**3))\n        return (prefactor * arg).real"},{"attributeType":"null","col":12,"comment":"null","endLoc":49,"id":14400,"name":"final_file","nodeType":"Attribute","startLoc":49,"text":"final_file"},{"attributeType":"null","col":64,"comment":"null","endLoc":53,"id":14401,"name":"f","nodeType":"Attribute","startLoc":53,"text":"f"},{"attributeType":"null","col":0,"comment":"null","endLoc":79,"id":14402,"name":"SKIP_TESTS","nodeType":"Attribute","startLoc":79,"text":"SKIP_TESTS"},{"attributeType":"null","col":61,"comment":"null","endLoc":99,"id":14403,"name":"test","nodeType":"Attribute","startLoc":99,"text":"test"},{"col":0,"comment":"\n    This serves as the FITS reader for KEPLER or TESS files within\n    astropy-timeseries.\n\n    This function should generally not be called directly, and instead this\n    time series reader should be accessed with the\n    :meth:`~astropy.timeseries.TimeSeries.read` method::\n\n        >>> from astropy.timeseries import TimeSeries\n        >>> ts = TimeSeries.read('kplr33122.fits', format='kepler.fits')  # doctest: +SKIP\n\n    Parameters\n    ----------\n    filename : `str` or `pathlib.Path`\n        File to load.\n\n    Returns\n    -------\n    ts : `~astropy.timeseries.TimeSeries`\n        Data converted into a TimeSeries.\n    ","endLoc":96,"header":"def kepler_fits_reader(filename)","id":14404,"name":"kepler_fits_reader","nodeType":"Function","startLoc":15,"text":"def kepler_fits_reader(filename):\n    \"\"\"\n    This serves as the FITS reader for KEPLER or TESS files within\n    astropy-timeseries.\n\n    This function should generally not be called directly, and instead this\n    time series reader should be accessed with the\n    :meth:`~astropy.timeseries.TimeSeries.read` method::\n\n        >>> from astropy.timeseries import TimeSeries\n        >>> ts = TimeSeries.read('kplr33122.fits', format='kepler.fits')  # doctest: +SKIP\n\n    Parameters\n    ----------\n    filename : `str` or `pathlib.Path`\n        File to load.\n\n    Returns\n    -------\n    ts : `~astropy.timeseries.TimeSeries`\n        Data converted into a TimeSeries.\n    \"\"\"\n    hdulist = fits.open(filename)\n    # Get the lightcurve HDU\n    telescope = hdulist[0].header['telescop'].lower()\n\n    if telescope == 'tess':\n        hdu = hdulist['LIGHTCURVE']\n    elif telescope == 'kepler':\n        hdu = hdulist[1]\n    else:\n        raise NotImplementedError(\"{} is not implemented, only KEPLER or TESS are \"\n                                  \"supported through this reader\".format(hdulist[0].header['telescop']))\n\n    if hdu.header['EXTVER'] > 1:\n        raise NotImplementedError(\"Support for {} v{} files not yet \"\n                                  \"implemented\".format(hdu.header['TELESCOP'], hdu.header['EXTVER']))\n\n    # Check time scale\n    if hdu.header['TIMESYS'] != 'TDB':\n        raise NotImplementedError(\"Support for {} time scale not yet \"\n                                  \"implemented in {} reader\".format(hdu.header['TIMESYS'], hdu.header['TELESCOP']))\n\n    tab = Table.read(hdu, format='fits')\n\n    # Some KEPLER files have a T column instead of TIME.\n    if \"T\" in tab.colnames:\n        tab.rename_column(\"T\", \"TIME\")\n\n    for colname in tab.colnames:\n        unit = tab[colname].unit\n        # Make masks nan for any column which will turn into a Quantity\n        # later. TODO: remove once we support Masked Quantities properly?\n        if unit and isinstance(tab[colname], MaskedColumn):\n            tab[colname] = tab[colname].filled(np.nan)\n        # Fix units\n        if unit == 'e-/s':\n            tab[colname].unit = 'electron/s'\n        if unit == 'pixels':\n            tab[colname].unit = 'pixel'\n\n        # Rename columns to lowercase\n        tab.rename_column(colname, colname.lower())\n\n    # Filter out NaN rows\n    nans = np.isnan(tab['time'].data)\n    if np.any(nans):\n        warnings.warn(f'Ignoring {np.sum(nans)} rows with NaN times')\n    tab = tab[~nans]\n\n    # Time column is dependent on source and we correct it here\n    reference_date = Time(hdu.header['BJDREFI'], hdu.header['BJDREFF'],\n                          scale=hdu.header['TIMESYS'].lower(), format='jd')\n    time = reference_date + TimeDelta(tab['time'].data)\n    time.format = 'isot'\n\n    # Remove original time column\n    tab.remove_column('time')\n\n    hdulist.close()\n\n    return TimeSeries(time=time, data=tab)"},{"col":0,"comment":"","endLoc":1,"header":"run_astropy_tests.py#<anonymous>","id":14405,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"if len(sys.argv) == 3 and sys.argv[1] == '--astropy-root':\n    ROOT = sys.argv[2]\nelse:\n    # Make sure we don't allow any arguments to be passed - some tests call\n    # sys.executable which becomes this script when producing a pyinstaller\n    # bundle, but we should just error in this case since this is not the\n    # regular Python interpreter.\n    if len(sys.argv) > 1:\n        print(\"Extra arguments passed, exiting early\")\n        sys.exit(1)\n\nfor root, dirnames, files in os.walk(os.path.join(ROOT, 'astropy')):\n\n    # NOTE: we can't simply use\n    # test_root = root.replace('astropy', 'astropy_tests')\n    # as we only want to change the one which is for the module, so instead\n    # we search for the last occurrence and replace that.\n    pos = root.rfind('astropy')\n    test_root = root[:pos] + 'astropy_tests' + root[pos + 7:]\n\n    # Copy over the astropy 'tests' directories and their contents\n    for dirname in dirnames:\n        final_dir = os.path.relpath(os.path.join(test_root, dirname), ROOT)\n        # We only copy over 'tests' directories, but not astropy/tests (only\n        # astropy/tests/tests) since that is not just a directory with tests.\n        if dirname == 'tests' and not root.endswith('astropy'):\n            shutil.copytree(os.path.join(root, dirname), final_dir, dirs_exist_ok=True)\n        else:\n            # Create empty __init__.py files so that 'astropy_tests' still\n            # behaves like a single package, otherwise pytest gets confused\n            # by the different conftest.py files.\n            init_filename = os.path.join(final_dir, '__init__.py')\n            if not os.path.exists(os.path.join(final_dir, '__init__.py')):\n                os.makedirs(final_dir, exist_ok=True)\n                with open(os.path.join(final_dir, '__init__.py'), 'w') as f:\n                    f.write(\"#\")\n    # Copy over all conftest.py files\n    for file in files:\n        if file == 'conftest.py':\n            final_file = os.path.relpath(os.path.join(test_root, file), ROOT)\n            shutil.copy2(os.path.join(root, file), final_file)\n\nwith open(os.path.join('astropy_tests', '__init__.py'), 'w') as f:\n    f.write(\"#\")\n\nos.remove(os.path.join('astropy_tests', 'utils', 'iers', 'tests', 'test_leap_second.py'))\n\nshutil.rmtree(os.path.join('astropy_tests', 'convolution'))\n\nos.remove(os.path.join('astropy_tests', 'modeling', 'tests', 'test_convolution.py'))\n\nos.remove(os.path.join('astropy_tests', 'modeling', 'tests', 'test_core.py'))\n\nos.remove(os.path.join('astropy_tests', 'visualization', 'tests', 'test_lupton_rgb.py'))\n\nos.remove(os.path.join('astropy_tests', 'table', 'mixins', 'tests', 'test_registry.py'))\n\nshutil.copy2(os.path.join(ROOT, 'astropy', 'conftest.py'),\n             os.path.join('astropy_tests', 'conftest.py'))\n\nSKIP_TESTS = ['test_exception_logging_origin',\n              'test_log',\n              'test_configitem',\n              'test_config_noastropy_fallback',\n              'test_no_home',\n              'test_path',\n              'test_rename_path',\n              'test_data_name_third_party_package',\n              'test_pkg_finder',\n              'test_wcsapi_extension',\n              'test_find_current_module_bundle',\n              'test_minversion',\n              'test_imports',\n              'test_generate_config',\n              'test_generate_config2',\n              'test_create_config_file',\n              'test_download_parallel_fills_cache']\n\nsys.exit(pytest.main(['astropy_tests',\n                      '-k ' + ' and '.join('not ' + test for test in SKIP_TESTS)],\n                     plugins=['pytest_doctestplus.plugin',\n                              'pytest_openfiles.plugin',\n                              'pytest_remotedata.plugin',\n                              'pytest_astropy_header.display']))"},{"col":4,"comment":"\n        Return the equivalent density parameter for curvature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Ok : ndarray or float\n            The equivalent density parameter for curvature at each redshift.\n            Returns `float` if the input is scalar.\n        ","endLoc":471,"header":"def Ok(self, z)","id":14406,"name":"Ok","nodeType":"Function","startLoc":453,"text":"def Ok(self, z):\n        \"\"\"\n        Return the equivalent density parameter for curvature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Ok : ndarray or float\n            The equivalent density parameter for curvature at each redshift.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        z = aszarr(z)\n        if self._Ok0 == 0:  # Common enough to be worth checking explicitly\n            return np.zeros(z.shape) if hasattr(z, \"shape\") else 0.0\n        return self._Ok0 * (z + 1.0) ** 2 * self.inv_efunc(z) ** 2"},{"col":4,"comment":"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated as an elliptic integral.\n        The lookback time is here calculated based on the ``age(0) - age(z)``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n        ","endLoc":1924,"header":"def _EdS_lookback_time(self, z)","id":14407,"name":"_EdS_lookback_time","nodeType":"Function","startLoc":1904,"text":"def _EdS_lookback_time(self, z):\n        r\"\"\"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated as an elliptic integral.\n        The lookback time is here calculated based on the ``age(0) - age(z)``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n        \"\"\"\n        return self._EdS_age(0) - self._EdS_age(z)"},{"col":4,"comment":"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated.\n\n        .. math::\n\n           a = exp(H * t) \\  \\text{where t=0 at z=0}\n\n           t = (1/H) (ln 1 - ln a) = (1/H) (0 - ln (1/(1+z))) = (1/H) ln(1+z)\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n        ","endLoc":1951,"header":"def _dS_lookback_time(self, z)","id":14408,"name":"_dS_lookback_time","nodeType":"Function","startLoc":1926,"text":"def _dS_lookback_time(self, z):\n        r\"\"\"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated.\n\n        .. math::\n\n           a = exp(H * t) \\  \\text{where t=0 at z=0}\n\n           t = (1/H) (ln 1 - ln a) = (1/H) (0 - ln (1/(1+z))) = (1/H) ln(1+z)\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n        \"\"\"\n        return self._hubble_time * np.log(aszarr(z) + 1.0)"},{"id":14409,"name":"astropy/timeseries/io/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/timeseries/io/tests","id":14410,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n"},{"col":4,"comment":"\n        The start times of all the time bins.\n        ","endLoc":192,"header":"@property\n    def time_bin_start(self)","id":14411,"name":"time_bin_start","nodeType":"Function","startLoc":187,"text":"@property\n    def time_bin_start(self):\n        \"\"\"\n        The start times of all the time bins.\n        \"\"\"\n        return self['time_bin_start']"},{"col":4,"comment":"\n        The center times of all the time bins.\n        ","endLoc":199,"header":"@property\n    def time_bin_center(self)","id":14412,"name":"time_bin_center","nodeType":"Function","startLoc":194,"text":"@property\n    def time_bin_center(self):\n        \"\"\"\n        The center times of all the time bins.\n        \"\"\"\n        return self['time_bin_start'] + self['time_bin_size'] * 0.5"},{"col":4,"comment":"\n        The end times of all the time bins.\n        ","endLoc":206,"header":"@property\n    def time_bin_end(self)","id":14413,"name":"time_bin_end","nodeType":"Function","startLoc":201,"text":"@property\n    def time_bin_end(self):\n        \"\"\"\n        The end times of all the time bins.\n        \"\"\"\n        return self['time_bin_start'] + self['time_bin_size']"},{"col":4,"comment":"\n        The sizes of all the time bins.\n        ","endLoc":213,"header":"@property\n    def time_bin_size(self)","id":14414,"name":"time_bin_size","nodeType":"Function","startLoc":208,"text":"@property\n    def time_bin_size(self):\n        \"\"\"\n        The sizes of all the time bins.\n        \"\"\"\n        return self['time_bin_size']"},{"col":4,"comment":"null","endLoc":224,"header":"def __getitem__(self, item)","id":14415,"name":"__getitem__","nodeType":"Function","startLoc":215,"text":"def __getitem__(self, item):\n        if self._is_list_or_tuple_of_str(item):\n            if 'time_bin_start' not in item or 'time_bin_size' not in item:\n                out = QTable([self[x] for x in item],\n                             meta=deepcopy(self.meta),\n                             copy_indices=self._copy_indices)\n                out._groups = groups.TableGroups(out, indices=self.groups._indices,\n                                                 keys=self.groups._keys)\n                return out\n        return super().__getitem__(item)"},{"col":4,"comment":"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated.\n        The lookback time is here calculated based on the ``age(0) - age(z)``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n        ","endLoc":1973,"header":"def _flat_lookback_time(self, z)","id":14416,"name":"_flat_lookback_time","nodeType":"Function","startLoc":1953,"text":"def _flat_lookback_time(self, z):\n        r\"\"\"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        For :math:`\\Omega_{rad} = 0` (:math:`T_{CMB} = 0`; massless neutrinos)\n        the age can be directly calculated.\n        The lookback time is here calculated based on the ``age(0) - age(z)``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n        \"\"\"\n        return self._flat_age(0) - self._flat_age(z)"},{"col":4,"comment":"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        ","endLoc":1996,"header":"def efunc(self, z)","id":14417,"name":"efunc","nodeType":"Function","startLoc":1975,"text":"def efunc(self, z):\n        \"\"\"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        \"\"\"\n        # We override this because it takes a particularly simple\n        # form for a cosmological constant\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) + self._Ode0)"},{"id":14418,"name":"astropy/timeseries/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/timeseries/tests","id":14419,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n"},{"col":4,"comment":"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The inverse redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H_z = H_0 / E`.\n        ","endLoc":2017,"header":"def inv_efunc(self, z)","id":14420,"name":"inv_efunc","nodeType":"Function","startLoc":1998,"text":"def inv_efunc(self, z):\n        r\"\"\"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The inverse redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return (zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) + self._Ode0)**(-0.5)"},{"id":14421,"name":"astropy/timeseries/tests/data","nodeType":"Package"},{"id":14422,"name":"sampled.csv","nodeType":"TextFile","path":"astropy/timeseries/tests/data","text":"Date,A,B,C,D,E,F,G\n2008-03-18,24.68,164.93,114.73,26.27,19.21,28.87,63.44\n2008-03-19,24.18,164.89,114.75,26.22,19.07,27.76,59.98\n2008-03-20,23.99,164.63,115.04,25.78,19.01,27.04,59.61\n2008-03-25,24.14,163.92,114.85,27.41,19.61,27.84,59.41\n2008-03-26,24.44,163.45,114.84,26.86,19.53,28.02,60.09\n2008-03-27,24.38,163.46,115.4,27.09,19.72,28.25,59.62\n2008-03-28,24.32,163.22,115.56,27.13,19.63,28.24,58.65\n2008-03-31,24.19,164.02,115.54,26.74,19.55,28.43,59.2\n2008-04-01,23.81,163.59,115.72,27.82,20.21,29.17,56.18\n2008-04-02,24.03,163.32,115.11,28.22,20.42,29.38,56.64\n2008-04-03,24.34,163.34,115.17,28.14,20.36,29.51,57.49\n"},{"id":14423,"name":"binned.csv","nodeType":"TextFile","path":"astropy/timeseries/tests/data","text":"time_start,bin_size,time_end,A,B,C,D,E,F\n2016-03-22T12:30:31.000,3,2016-03-22T12:30:34.000,164.93,114.73,26.27,19.21,28.87,63.44\n2016-03-22T12:30:34.000,3,2016-03-22T12:30:37.000,164.89,114.75,26.22,19.07,27.76,59.98\n2016-03-22T12:30:37.000,3,2016-03-22T12:30:40.000,164.63,115.04,25.78,19.01,27.04,59.61\n2016-03-22T12:30:40.000,3,2016-03-22T12:30:43.000,163.92,114.85,27.41,19.61,27.84,59.41\n2016-03-22T12:30:43.000,3,2016-03-22T12:30:46.000,163.45,114.84,26.86,19.53,28.02,60.09\n2016-03-22T12:30:46.000,3,2016-03-22T12:30:49.000,163.46,115.4,27.09,19.72,28.25,59.62\n2016-03-22T12:30:49.000,3,2016-03-22T12:30:52.000,163.22,115.56,27.13,19.63,28.24,58.65\n2016-03-22T12:30:52.000,3,2016-03-22T12:30:55.000,164.02,115.54,26.74,19.55,28.43,59.2\n2016-03-22T12:30:55.000,3,2016-03-22T12:30:58.000,163.59,115.72,27.82,20.21,29.17,56.18\n2016-03-22T12:30:58.000,3,2016-03-22T12:31:01.000,163.32,115.11,28.22,20.42,29.38,56.64\n"},{"id":14424,"name":"astropy/timeseries/periodograms","nodeType":"Package"},{"fileName":"base.py","filePath":"astropy/timeseries/periodograms","id":14425,"nodeType":"File","text":"import abc\nimport numpy as np\nfrom astropy.timeseries import TimeSeries, BinnedTimeSeries\n\n__all__ = ['BasePeriodogram']\n\n\nclass BasePeriodogram:\n\n    @abc.abstractmethod\n    def __init__(self, t, y, dy=None):\n        pass\n\n    @classmethod\n    def from_timeseries(cls, timeseries, signal_column_name=None, uncertainty=None, **kwargs):\n        \"\"\"\n        Initialize a periodogram from a time series object.\n\n        If a binned time series is passed, the time at the center of the bins is\n        used. Also note that this method automatically gets rid of NaN/undefined\n        values when initializing the periodogram.\n\n        Parameters\n        ----------\n        signal_column_name : str\n            The name of the column containing the signal values to use.\n        uncertainty : str or float or `~astropy.units.Quantity`, optional\n            The name of the column containing the errors on the signal, or the\n            value to use for the error, if a scalar.\n        **kwargs\n            Additional keyword arguments are passed to the initializer for this\n            periodogram class.\n        \"\"\"\n\n        if signal_column_name is None:\n            raise ValueError('signal_column_name should be set to a valid column name')\n\n        y = timeseries[signal_column_name]\n        keep = ~np.isnan(y)\n\n        if isinstance(uncertainty, str):\n            dy = timeseries[uncertainty]\n            keep &= ~np.isnan(dy)\n            dy = dy[keep]\n        else:\n            dy = uncertainty\n\n        if isinstance(timeseries, TimeSeries):\n            time = timeseries.time\n        elif isinstance(timeseries, BinnedTimeSeries):\n            time = timeseries.time_bin_center\n        else:\n            raise TypeError('Input time series should be an instance of '\n                            'TimeSeries or BinnedTimeSeries')\n\n        return cls(time[keep], y[keep], dy=dy, **kwargs)\n"},{"attributeType":"null","col":12,"comment":"null","endLoc":1573,"id":14426,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":1573,"text":"self._inv_efunc_scalar"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":14427,"name":"__all__","nodeType":"Attribute","startLoc":5,"text":"__all__"},{"col":0,"comment":"","endLoc":1,"header":"base.py#<anonymous>","id":14428,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"__all__ = ['BasePeriodogram']"},{"attributeType":"null","col":12,"comment":"null","endLoc":1574,"id":14429,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":1574,"text":"self._inv_efunc_scalar_args"},{"fileName":"__init__.py","filePath":"astropy/timeseries/periodograms","id":14430,"nodeType":"File","text":"from astropy.timeseries.periodograms.base import *  # noqa\nfrom astropy.timeseries.periodograms.lombscargle import *  # noqa\nfrom astropy.timeseries.periodograms.bls import *  # noqa\n"},{"id":14431,"name":"astropy/timeseries/periodograms/bls","nodeType":"Package"},{"id":14432,"name":"_impl.pyx","nodeType":"TextFile","path":"astropy/timeseries/periodograms/bls","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n#cython: language_level=3\n\nimport numpy as np\ncimport numpy as np\n\ncimport cython\n\nfrom libc.math cimport sqrt\nfrom libc.stdlib cimport malloc, free\n\nDTYPE = np.float64\nctypedef np.float64_t DTYPE_t\n\nIDTYPE = np.int64\nctypedef np.int64_t IDTYPE_t\n\ncdef extern int run_bls (\n    int N,                   # Length of the time array\n    double* t,               # The list of timestamps\n    double* y,               # The y measured at ``t``\n    double* ivar,            # The inverse variance of the y array\n\n    int n_periods,           #\n    double* periods,         # The period to test in units of ``t``\n\n    int n_durations,         # Length of the durations array\n    double* durations,       # The durations to test in units of ``bin_duration``\n    int oversample,          # The number of ``bin_duration`` bins in the maximum duration\n\n    int obj_flag,            # A flag indicating the periodogram type\n                             # 0 - depth signal-to-noise\n                             # 1 - log likelihood\n\n    # Outputs\n    double* best_objective,  # The value of the periodogram at maximum\n    double* best_depth,      # The estimated depth at maximum\n    double* best_depth_std,  # The uncertainty on ``best_depth``\n    double* best_duration,   # The best fitting duration in units of ``t``\n    double* best_phase,      # The phase of the mid-transit time in units of\n                             # ``t``\n    double* best_depth_snr,  # The signal-to-noise ratio of the depth estimate\n    double* best_log_like    # The log likelihood at maximum\n) nogil\n\n\n@cython.cdivision(True)\n@cython.boundscheck(False)\n@cython.wraparound(False)\ndef bls_impl(\n    np.ndarray[DTYPE_t, mode='c'] t_array,\n    np.ndarray[DTYPE_t, mode='c'] y_array,\n    np.ndarray[DTYPE_t, mode='c'] ivar_array,\n    np.ndarray[DTYPE_t, mode='c'] period_array,\n    np.ndarray[DTYPE_t, mode='c'] duration_array,\n    int oversample,\n    int obj_flag\n):\n\n    cdef np.ndarray[DTYPE_t, mode='c'] out_objective = np.empty_like(period_array, dtype=DTYPE)\n    cdef np.ndarray[DTYPE_t, mode='c'] out_depth     = np.empty_like(period_array, dtype=DTYPE)\n    cdef np.ndarray[DTYPE_t, mode='c'] out_depth_err = np.empty_like(period_array, dtype=DTYPE)\n    cdef np.ndarray[DTYPE_t, mode='c'] out_duration  = np.empty_like(period_array, dtype=DTYPE)\n    cdef np.ndarray[DTYPE_t, mode='c'] out_phase     = np.empty_like(period_array, dtype=DTYPE)\n    cdef np.ndarray[DTYPE_t, mode='c'] out_depth_snr = np.empty_like(period_array, dtype=DTYPE)\n    cdef np.ndarray[DTYPE_t, mode='c'] out_log_like  = np.empty_like(period_array, dtype=DTYPE)\n    cdef int flag, N = len(t_array), n_periods = len(period_array), n_durations = len(duration_array)\n\n    with nogil:\n        flag = run_bls(\n            N,\n            <double*>t_array.data,\n            <double*>y_array.data,\n            <double*>ivar_array.data,\n            n_periods,\n            <double*>period_array.data,\n            n_durations,\n            <double*>duration_array.data,\n            oversample,\n            obj_flag,\n            <double*>out_objective.data,\n            <double*>out_depth.data,\n            <double*>out_depth_err.data,\n            <double*>out_duration.data,\n            <double*>out_phase.data,\n            <double*>out_depth_snr.data,\n            <double*>out_log_like.data\n        )\n\n    if flag < 0:\n        raise MemoryError()\n    if flag > 0:\n        raise ValueError(\"Invalid inputs for period and/or duration\")\n\n    return (out_objective, out_depth, out_depth_err, out_duration, out_phase,\n            out_depth_snr, out_log_like)\n"},{"fileName":"setup_package.py","filePath":"astropy/timeseries/periodograms/bls","id":14433,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\nfrom os.path import join\n\nfrom setuptools import Extension\n\nimport numpy\n\nBLS_ROOT = os.path.relpath(os.path.dirname(__file__))\n\n\ndef get_extensions():\n    ext = Extension(\n        \"astropy.timeseries.periodograms.bls._impl\",\n        sources=[\n            join(BLS_ROOT, \"bls.c\"),\n            join(BLS_ROOT, \"_impl.pyx\"),\n        ],\n        include_dirs=[numpy.get_include()],\n    )\n    return [ext]\n"},{"col":0,"comment":"null","endLoc":22,"header":"def get_extensions()","id":14434,"name":"get_extensions","nodeType":"Function","startLoc":13,"text":"def get_extensions():\n    ext = Extension(\n        \"astropy.timeseries.periodograms.bls._impl\",\n        sources=[\n            join(BLS_ROOT, \"bls.c\"),\n            join(BLS_ROOT, \"_impl.pyx\"),\n        ],\n        include_dirs=[numpy.get_include()],\n    )\n    return [ext]"},{"col":4,"comment":"Return the density parameter for baryonic matter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Ob : ndarray or float\n            The density of baryonic matter relative to the critical density at\n            each redshift.\n            Returns `float` if the input is scalar.\n\n        Raises\n        ------\n        ValueError\n            If ``Ob0`` is `None`.\n        ","endLoc":420,"header":"def Ob(self, z)","id":14435,"name":"Ob","nodeType":"Function","startLoc":397,"text":"def Ob(self, z):\n        \"\"\"Return the density parameter for baryonic matter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Ob : ndarray or float\n            The density of baryonic matter relative to the critical density at\n            each redshift.\n            Returns `float` if the input is scalar.\n\n        Raises\n        ------\n        ValueError\n            If ``Ob0`` is `None`.\n        \"\"\"\n        if self._Ob0 is None:\n            raise ValueError(\"Baryon density not set for this cosmology\")\n        z = aszarr(z)\n        return self._Ob0 * (z + 1.0) ** 3 * self.inv_efunc(z) ** 2"},{"attributeType":"function","col":16,"comment":"null","endLoc":1567,"id":14436,"name":"_comoving_distance_z1z2","nodeType":"Attribute","startLoc":1567,"text":"self._comoving_distance_z1z2"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":14437,"name":"BLS_ROOT","nodeType":"Attribute","startLoc":10,"text":"BLS_ROOT"},{"col":4,"comment":"\n        Read and parse a file and returns a `astropy.timeseries.BinnedTimeSeries`.\n\n        This method uses the unified I/O infrastructure in Astropy which makes\n        it easy to define readers/writers for various classes\n        (https://docs.astropy.org/en/stable/io/unified.html). By default, this\n        method will try and use readers defined specifically for the\n        `astropy.timeseries.BinnedTimeSeries` class - however, it is also\n        possible to use the ``format`` keyword to specify formats defined for\n        the `astropy.table.Table` class - in this case, you will need to also\n        provide the column names for column containing the start times for the\n        bins, as well as other column names (see the Parameters section below\n        for details)::\n\n            >>> from astropy.timeseries.binned import BinnedTimeSeries\n            >>> ts = BinnedTimeSeries.read('binned.dat', format='ascii.ecsv',\n            ...                            time_bin_start_column='date_start',\n            ...                            time_bin_end_column='date_end')  # doctest: +SKIP\n\n        Parameters\n        ----------\n        filename : str\n            File to parse.\n        format : str\n            File format specifier.\n        time_bin_start_column : str\n            The name of the column with the start time for each bin.\n        time_bin_end_column : str, optional\n            The name of the column with the end time for each bin. Either this\n            option or ``time_bin_size_column`` should be specified.\n        time_bin_size_column : str, optional\n            The name of the column with the size for each bin. Either this\n            option or ``time_bin_end_column`` should be specified.\n        time_bin_size_unit : `astropy.units.Unit`, optional\n            If ``time_bin_size_column`` is specified but does not have a unit\n            set in the table, you can specify the unit manually.\n        time_format : str, optional\n            The time format for the start and end columns.\n        time_scale : str, optional\n            The time scale for the start and end columns.\n        *args : tuple, optional\n            Positional arguments passed through to the data reader.\n        **kwargs : dict, optional\n            Keyword arguments passed through to the data reader.\n\n        Returns\n        -------\n        out : `astropy.timeseries.binned.BinnedTimeSeries`\n            BinnedTimeSeries corresponding to the file.\n\n        ","endLoc":345,"header":"@classmethod\n    def read(self, filename, time_bin_start_column=None, time_bin_end_column=None,\n             time_bin_size_column=None, time_bin_size_unit=None, time_format=None, time_scale=None,\n             format=None, *args, **kwargs)","id":14438,"name":"read","nodeType":"Function","startLoc":226,"text":"@classmethod\n    def read(self, filename, time_bin_start_column=None, time_bin_end_column=None,\n             time_bin_size_column=None, time_bin_size_unit=None, time_format=None, time_scale=None,\n             format=None, *args, **kwargs):\n        \"\"\"\n        Read and parse a file and returns a `astropy.timeseries.BinnedTimeSeries`.\n\n        This method uses the unified I/O infrastructure in Astropy which makes\n        it easy to define readers/writers for various classes\n        (https://docs.astropy.org/en/stable/io/unified.html). By default, this\n        method will try and use readers defined specifically for the\n        `astropy.timeseries.BinnedTimeSeries` class - however, it is also\n        possible to use the ``format`` keyword to specify formats defined for\n        the `astropy.table.Table` class - in this case, you will need to also\n        provide the column names for column containing the start times for the\n        bins, as well as other column names (see the Parameters section below\n        for details)::\n\n            >>> from astropy.timeseries.binned import BinnedTimeSeries\n            >>> ts = BinnedTimeSeries.read('binned.dat', format='ascii.ecsv',\n            ...                            time_bin_start_column='date_start',\n            ...                            time_bin_end_column='date_end')  # doctest: +SKIP\n\n        Parameters\n        ----------\n        filename : str\n            File to parse.\n        format : str\n            File format specifier.\n        time_bin_start_column : str\n            The name of the column with the start time for each bin.\n        time_bin_end_column : str, optional\n            The name of the column with the end time for each bin. Either this\n            option or ``time_bin_size_column`` should be specified.\n        time_bin_size_column : str, optional\n            The name of the column with the size for each bin. Either this\n            option or ``time_bin_end_column`` should be specified.\n        time_bin_size_unit : `astropy.units.Unit`, optional\n            If ``time_bin_size_column`` is specified but does not have a unit\n            set in the table, you can specify the unit manually.\n        time_format : str, optional\n            The time format for the start and end columns.\n        time_scale : str, optional\n            The time scale for the start and end columns.\n        *args : tuple, optional\n            Positional arguments passed through to the data reader.\n        **kwargs : dict, optional\n            Keyword arguments passed through to the data reader.\n\n        Returns\n        -------\n        out : `astropy.timeseries.binned.BinnedTimeSeries`\n            BinnedTimeSeries corresponding to the file.\n\n        \"\"\"\n\n        try:\n\n            # First we try the readers defined for the BinnedTimeSeries class\n            return super().read(filename, format=format, *args, **kwargs)\n\n        except TypeError:\n\n            # Otherwise we fall back to the default Table readers\n\n            if time_bin_start_column is None:\n                raise ValueError(\"``time_bin_start_column`` should be provided since the default Table readers are being used.\")\n            if time_bin_end_column is None and time_bin_size_column is None:\n                raise ValueError(\"Either `time_bin_end_column` or `time_bin_size_column` should be provided.\")\n            elif time_bin_end_column is not None and time_bin_size_column is not None:\n                raise ValueError(\"Cannot specify both `time_bin_end_column` and `time_bin_size_column`.\")\n\n            table = Table.read(filename, format=format, *args, **kwargs)\n\n            if time_bin_start_column in table.colnames:\n                time_bin_start = Time(table.columns[time_bin_start_column],\n                                      scale=time_scale, format=time_format)\n                table.remove_column(time_bin_start_column)\n            else:\n                raise ValueError(f\"Bin start time column '{time_bin_start_column}' not found in the input data.\")\n\n            if time_bin_end_column is not None:\n\n                if time_bin_end_column in table.colnames:\n                    time_bin_end = Time(table.columns[time_bin_end_column],\n                                        scale=time_scale, format=time_format)\n                    table.remove_column(time_bin_end_column)\n                else:\n                    raise ValueError(f\"Bin end time column '{time_bin_end_column}' not found in the input data.\")\n\n                time_bin_size = None\n\n            elif time_bin_size_column is not None:\n\n                if time_bin_size_column in table.colnames:\n                    time_bin_size = table.columns[time_bin_size_column]\n                    table.remove_column(time_bin_size_column)\n                else:\n                    raise ValueError(f\"Bin size column '{time_bin_size_column}' not found in the input data.\")\n\n                if time_bin_size.unit is None:\n                    if time_bin_size_unit is None or not isinstance(time_bin_size_unit, u.UnitBase):\n                        raise ValueError(\"The bin size unit should be specified as an astropy Unit using ``time_bin_size_unit``.\")\n                    time_bin_size = time_bin_size * time_bin_size_unit\n                else:\n                    time_bin_size = u.Quantity(time_bin_size)\n\n                time_bin_end = None\n\n            if time_bin_start.isscalar and time_bin_size.isscalar:\n                return BinnedTimeSeries(data=table,\n                                    time_bin_start=time_bin_start,\n                                    time_bin_end=time_bin_end,\n                                    time_bin_size=time_bin_size,\n                                    n_bins=len(table))\n            else:\n                return BinnedTimeSeries(data=table,\n                                    time_bin_start=time_bin_start,\n                                    time_bin_end=time_bin_end,\n                                    time_bin_size=time_bin_size)"},{"col":0,"comment":"","endLoc":3,"header":"setup_package.py#<anonymous>","id":14439,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"BLS_ROOT = os.path.relpath(os.path.dirname(__file__))"},{"col":4,"comment":"Return the density parameter for dark matter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Odm : ndarray or float\n            The density of non-relativistic dark matter relative to the\n            critical density at each redshift.\n            Returns `float` if the input is scalar.\n\n        Raises\n        ------\n        ValueError\n            If ``Ob0`` is `None`.\n\n        Notes\n        -----\n        This does not include neutrinos, even if non-relativistic at the\n        redshift of interest.\n        ","endLoc":451,"header":"def Odm(self, z)","id":14440,"name":"Odm","nodeType":"Function","startLoc":422,"text":"def Odm(self, z):\n        \"\"\"Return the density parameter for dark matter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Odm : ndarray or float\n            The density of non-relativistic dark matter relative to the\n            critical density at each redshift.\n            Returns `float` if the input is scalar.\n\n        Raises\n        ------\n        ValueError\n            If ``Ob0`` is `None`.\n\n        Notes\n        -----\n        This does not include neutrinos, even if non-relativistic at the\n        redshift of interest.\n        \"\"\"\n        if self._Odm0 is None:\n            raise ValueError(\"Baryonic density not set for this cosmology, \"\n                             \"unclear meaning of dark matter density\")\n        z = aszarr(z)\n        return self._Odm0 * (z + 1.0) ** 3 * self.inv_efunc(z) ** 2"},{"fileName":"methods.py","filePath":"astropy/timeseries/periodograms/bls","id":14441,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n__all__ = [\"bls_fast\", \"bls_slow\"]\n\nimport numpy as np\nfrom functools import partial\n\nfrom ._impl import bls_impl\n\n\ndef bls_slow(t, y, ivar, period, duration, oversample, use_likelihood):\n    \"\"\"Compute the periodogram using a brute force reference method\n\n    t : array-like\n        Sequence of observation times.\n    y : array-like\n        Sequence of observations associated with times t.\n    ivar : array-like\n        The inverse variance of ``y``.\n    period : array-like\n        The trial periods where the periodogram should be computed.\n    duration : array-like\n        The durations that should be tested.\n    oversample :\n        The resolution of the phase grid in units of durations.\n    use_likeliood : bool\n        If true, maximize the log likelihood over phase, duration, and depth.\n\n    Returns\n    -------\n    power : array-like\n        The periodogram evaluated at the periods in ``period``.\n    depth : array-like\n        The estimated depth of the maximum power model at each period.\n    depth_err : array-like\n        The 1-sigma uncertainty on ``depth``.\n    duration : array-like\n        The maximum power duration at each period.\n    transit_time : array-like\n        The maximum power phase of the transit in units of time. This\n        indicates the mid-transit time and it will always be in the range\n        (0, period).\n    depth_snr : array-like\n        The signal-to-noise with which the depth is measured at maximum power.\n    log_likelihood : array-like\n        The log likelihood of the maximum power model.\n\n    \"\"\"\n    f = partial(_bls_slow_one, t, y, ivar, duration,\n                oversample, use_likelihood)\n    return _apply(f, period)\n\n\ndef bls_fast(t, y, ivar, period, duration, oversample, use_likelihood):\n    \"\"\"Compute the periodogram using an optimized Cython implementation\n\n    t : array-like\n        Sequence of observation times.\n    y : array-like\n        Sequence of observations associated with times t.\n    ivar : array-like\n        The inverse variance of ``y``.\n    period : array-like\n        The trial periods where the periodogram should be computed.\n    duration : array-like\n        The durations that should be tested.\n    oversample :\n        The resolution of the phase grid in units of durations.\n    use_likeliood : bool\n        If true, maximize the log likelihood over phase, duration, and depth.\n\n    Returns\n    -------\n    power : array-like\n        The periodogram evaluated at the periods in ``period``.\n    depth : array-like\n        The estimated depth of the maximum power model at each period.\n    depth_err : array-like\n        The 1-sigma uncertainty on ``depth``.\n    duration : array-like\n        The maximum power duration at each period.\n    transit_time : array-like\n        The maximum power phase of the transit in units of time. This\n        indicates the mid-transit time and it will always be in the range\n        (0, period).\n    depth_snr : array-like\n        The signal-to-noise with which the depth is measured at maximum power.\n    log_likelihood : array-like\n        The log likelihood of the maximum power model.\n\n    \"\"\"\n    return bls_impl(\n        t, y, ivar, period, duration, oversample, use_likelihood\n    )\n\n\ndef _bls_slow_one(t, y, ivar, duration, oversample, use_likelihood, period):\n    \"\"\"A private function to compute the brute force periodogram result\"\"\"\n    best = (-np.inf, None)\n    hp = 0.5*period\n    min_t = np.min(t)\n    for dur in duration:\n\n        # Compute the phase grid (this is set by the duration and oversample).\n        d_phase = dur / oversample\n        phase = np.arange(0, period+d_phase, d_phase)\n\n        for t0 in phase:\n            # Figure out which data points are in and out of transit.\n            m_in = np.abs((t-min_t-t0+hp) % period - hp) < 0.5*dur\n            m_out = ~m_in\n\n            # Compute the estimates of the in and out-of-transit flux.\n            ivar_in = np.sum(ivar[m_in])\n            ivar_out = np.sum(ivar[m_out])\n            y_in = np.sum(y[m_in] * ivar[m_in]) / ivar_in\n            y_out = np.sum(y[m_out] * ivar[m_out]) / ivar_out\n\n            # Use this to compute the best fit depth and uncertainty.\n            depth = y_out - y_in\n            depth_err = np.sqrt(1.0 / ivar_in + 1.0 / ivar_out)\n            snr = depth / depth_err\n\n            # Compute the log likelihood of this model.\n            loglike = -0.5*np.sum((y_in - y[m_in])**2 * ivar[m_in])\n            loglike += 0.5*np.sum((y_out - y[m_in])**2 * ivar[m_in])\n\n            # Choose which objective should be used for the optimization.\n            if use_likelihood:\n                objective = loglike\n            else:\n                objective = snr\n\n            # If this model is better than any before, keep it.\n            if depth > 0 and objective > best[0]:\n                best = (\n                    objective,\n                    (objective, depth, depth_err, dur, (t0+min_t) % period,\n                     snr, loglike)\n                )\n\n    return best[1]\n\n\ndef _apply(f, period):\n    return tuple(map(np.array, zip(*map(f, period))))\n"},{"attributeType":"function","col":12,"comment":"null","endLoc":1588,"id":14442,"name":"_lookback_time","nodeType":"Attribute","startLoc":1588,"text":"self._lookback_time"},{"col":0,"comment":"Compute the periodogram using a brute force reference method\n\n    t : array-like\n        Sequence of observation times.\n    y : array-like\n        Sequence of observations associated with times t.\n    ivar : array-like\n        The inverse variance of ``y``.\n    period : array-like\n        The trial periods where the periodogram should be computed.\n    duration : array-like\n        The durations that should be tested.\n    oversample :\n        The resolution of the phase grid in units of durations.\n    use_likeliood : bool\n        If true, maximize the log likelihood over phase, duration, and depth.\n\n    Returns\n    -------\n    power : array-like\n        The periodogram evaluated at the periods in ``period``.\n    depth : array-like\n        The estimated depth of the maximum power model at each period.\n    depth_err : array-like\n        The 1-sigma uncertainty on ``depth``.\n    duration : array-like\n        The maximum power duration at each period.\n    transit_time : array-like\n        The maximum power phase of the transit in units of time. This\n        indicates the mid-transit time and it will always be in the range\n        (0, period).\n    depth_snr : array-like\n        The signal-to-noise with which the depth is measured at maximum power.\n    log_likelihood : array-like\n        The log likelihood of the maximum power model.\n\n    ","endLoc":52,"header":"def bls_slow(t, y, ivar, period, duration, oversample, use_likelihood)","id":14443,"name":"bls_slow","nodeType":"Function","startLoc":12,"text":"def bls_slow(t, y, ivar, period, duration, oversample, use_likelihood):\n    \"\"\"Compute the periodogram using a brute force reference method\n\n    t : array-like\n        Sequence of observation times.\n    y : array-like\n        Sequence of observations associated with times t.\n    ivar : array-like\n        The inverse variance of ``y``.\n    period : array-like\n        The trial periods where the periodogram should be computed.\n    duration : array-like\n        The durations that should be tested.\n    oversample :\n        The resolution of the phase grid in units of durations.\n    use_likeliood : bool\n        If true, maximize the log likelihood over phase, duration, and depth.\n\n    Returns\n    -------\n    power : array-like\n        The periodogram evaluated at the periods in ``period``.\n    depth : array-like\n        The estimated depth of the maximum power model at each period.\n    depth_err : array-like\n        The 1-sigma uncertainty on ``depth``.\n    duration : array-like\n        The maximum power duration at each period.\n    transit_time : array-like\n        The maximum power phase of the transit in units of time. This\n        indicates the mid-transit time and it will always be in the range\n        (0, period).\n    depth_snr : array-like\n        The signal-to-noise with which the depth is measured at maximum power.\n    log_likelihood : array-like\n        The log likelihood of the maximum power model.\n\n    \"\"\"\n    f = partial(_bls_slow_one, t, y, ivar, duration,\n                oversample, use_likelihood)\n    return _apply(f, period)"},{"col":4,"comment":"Return the CMB temperature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Tcmb : `~astropy.units.Quantity` ['temperature']\n            The temperature of the CMB in K.\n        ","endLoc":547,"header":"def Tcmb(self, z)","id":14444,"name":"Tcmb","nodeType":"Function","startLoc":534,"text":"def Tcmb(self, z):\n        \"\"\"Return the CMB temperature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Tcmb : `~astropy.units.Quantity` ['temperature']\n            The temperature of the CMB in K.\n        \"\"\"\n        return self._Tcmb0 * (aszarr(z) + 1.0)"},{"col":4,"comment":"Return the neutrino temperature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Tnu : `~astropy.units.Quantity` ['temperature']\n            The temperature of the cosmic neutrino background in K.\n        ","endLoc":562,"header":"def Tnu(self, z)","id":14445,"name":"Tnu","nodeType":"Function","startLoc":549,"text":"def Tnu(self, z):\n        \"\"\"Return the neutrino temperature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        Tnu : `~astropy.units.Quantity` ['temperature']\n            The temperature of the cosmic neutrino background in K.\n        \"\"\"\n        return self._Tnu0 * (aszarr(z) + 1.0)"},{"attributeType":"function","col":12,"comment":"null","endLoc":1587,"id":14446,"name":"_age","nodeType":"Attribute","startLoc":1587,"text":"self._age"},{"col":4,"comment":"Internal convenience function for w(z) integral (eq. 5 of [1]_).\n\n        Parameters\n        ----------\n        ln1pz : `~numbers.Number` or scalar ndarray\n            Assumes scalar input, since this should only be called inside an\n            integral.\n\n        References\n        ----------\n        .. [1] Linder, E. (2003). Exploring the Expansion History of the\n               Universe. Phys. Rev. Lett., 90, 091301.\n        ","endLoc":644,"header":"def _w_integrand(self, ln1pz)","id":14447,"name":"_w_integrand","nodeType":"Function","startLoc":630,"text":"def _w_integrand(self, ln1pz):\n        \"\"\"Internal convenience function for w(z) integral (eq. 5 of [1]_).\n\n        Parameters\n        ----------\n        ln1pz : `~numbers.Number` or scalar ndarray\n            Assumes scalar input, since this should only be called inside an\n            integral.\n\n        References\n        ----------\n        .. [1] Linder, E. (2003). Exploring the Expansion History of the\n               Universe. Phys. Rev. Lett., 90, 091301.\n        \"\"\"\n        return 1.0 + self.w(exp(ln1pz) - 1.0)"},{"col":4,"comment":"null","endLoc":2096,"header":"def __init__(self, H0, Om0, Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV,\n                 Ob0=None, *, name=None, meta=None)","id":14448,"name":"__init__","nodeType":"Function","startLoc":2073,"text":"def __init__(self, H0, Om0, Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV,\n                 Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=0.0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.flcdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0)\n            # Repeat the optimization reassignments here because the init\n            # of the LambaCDM above didn't actually create a flat cosmology.\n            # That was done through the explicit tweak setting self._Ok0.\n            self._optimize_flat_norad()\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.flcdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0 + self._Onu0)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.flcdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list)"},{"col":4,"comment":"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n\n        Notes\n        -----\n        It is not necessary to override this method, but if de_density_scale\n        takes a particularly simple form, it may be advantageous to.\n        ","endLoc":721,"header":"def efunc(self, z)","id":14449,"name":"efunc","nodeType":"Function","startLoc":696,"text":"def efunc(self, z):\n        \"\"\"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n\n        Notes\n        -----\n        It is not necessary to override this method, but if de_density_scale\n        takes a particularly simple form, it may be advantageous to.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) +\n                       self._Ode0 * self.de_density_scale(z))"},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":14450,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"col":4,"comment":"Integrand of the lookback time (equation 30 of [1]_).\n\n        Parameters\n        ----------\n        z : float\n            Input redshift.\n\n        Returns\n        -------\n        I : float\n            The integrand for the lookback time.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        ","endLoc":763,"header":"def _lookback_time_integrand_scalar(self, z)","id":14451,"name":"_lookback_time_integrand_scalar","nodeType":"Function","startLoc":745,"text":"def _lookback_time_integrand_scalar(self, z):\n        \"\"\"Integrand of the lookback time (equation 30 of [1]_).\n\n        Parameters\n        ----------\n        z : float\n            Input redshift.\n\n        Returns\n        -------\n        I : float\n            The integrand for the lookback time.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        \"\"\"\n        return self._inv_efunc_scalar(z, *self._inv_efunc_scalar_args) / (z + 1.0)"},{"col":0,"comment":"null","endLoc":147,"header":"def _apply(f, period)","id":14452,"name":"_apply","nodeType":"Function","startLoc":146,"text":"def _apply(f, period):\n    return tuple(map(np.array, zip(*map(f, period))))"},{"col":0,"comment":"Compute the periodogram using an optimized Cython implementation\n\n    t : array-like\n        Sequence of observation times.\n    y : array-like\n        Sequence of observations associated with times t.\n    ivar : array-like\n        The inverse variance of ``y``.\n    period : array-like\n        The trial periods where the periodogram should be computed.\n    duration : array-like\n        The durations that should be tested.\n    oversample :\n        The resolution of the phase grid in units of durations.\n    use_likeliood : bool\n        If true, maximize the log likelihood over phase, duration, and depth.\n\n    Returns\n    -------\n    power : array-like\n        The periodogram evaluated at the periods in ``period``.\n    depth : array-like\n        The estimated depth of the maximum power model at each period.\n    depth_err : array-like\n        The 1-sigma uncertainty on ``depth``.\n    duration : array-like\n        The maximum power duration at each period.\n    transit_time : array-like\n        The maximum power phase of the transit in units of time. This\n        indicates the mid-transit time and it will always be in the range\n        (0, period).\n    depth_snr : array-like\n        The signal-to-noise with which the depth is measured at maximum power.\n    log_likelihood : array-like\n        The log likelihood of the maximum power model.\n\n    ","endLoc":95,"header":"def bls_fast(t, y, ivar, period, duration, oversample, use_likelihood)","id":14453,"name":"bls_fast","nodeType":"Function","startLoc":55,"text":"def bls_fast(t, y, ivar, period, duration, oversample, use_likelihood):\n    \"\"\"Compute the periodogram using an optimized Cython implementation\n\n    t : array-like\n        Sequence of observation times.\n    y : array-like\n        Sequence of observations associated with times t.\n    ivar : array-like\n        The inverse variance of ``y``.\n    period : array-like\n        The trial periods where the periodogram should be computed.\n    duration : array-like\n        The durations that should be tested.\n    oversample :\n        The resolution of the phase grid in units of durations.\n    use_likeliood : bool\n        If true, maximize the log likelihood over phase, duration, and depth.\n\n    Returns\n    -------\n    power : array-like\n        The periodogram evaluated at the periods in ``period``.\n    depth : array-like\n        The estimated depth of the maximum power model at each period.\n    depth_err : array-like\n        The 1-sigma uncertainty on ``depth``.\n    duration : array-like\n        The maximum power duration at each period.\n    transit_time : array-like\n        The maximum power phase of the transit in units of time. This\n        indicates the mid-transit time and it will always be in the range\n        (0, period).\n    depth_snr : array-like\n        The signal-to-noise with which the depth is measured at maximum power.\n    log_likelihood : array-like\n        The log likelihood of the maximum power model.\n\n    \"\"\"\n    return bls_impl(\n        t, y, ivar, period, duration, oversample, use_likelihood\n    )"},{"col":0,"comment":"A private function to compute the brute force periodogram result","endLoc":143,"header":"def _bls_slow_one(t, y, ivar, duration, oversample, use_likelihood, period)","id":14454,"name":"_bls_slow_one","nodeType":"Function","startLoc":98,"text":"def _bls_slow_one(t, y, ivar, duration, oversample, use_likelihood, period):\n    \"\"\"A private function to compute the brute force periodogram result\"\"\"\n    best = (-np.inf, None)\n    hp = 0.5*period\n    min_t = np.min(t)\n    for dur in duration:\n\n        # Compute the phase grid (this is set by the duration and oversample).\n        d_phase = dur / oversample\n        phase = np.arange(0, period+d_phase, d_phase)\n\n        for t0 in phase:\n            # Figure out which data points are in and out of transit.\n            m_in = np.abs((t-min_t-t0+hp) % period - hp) < 0.5*dur\n            m_out = ~m_in\n\n            # Compute the estimates of the in and out-of-transit flux.\n            ivar_in = np.sum(ivar[m_in])\n            ivar_out = np.sum(ivar[m_out])\n            y_in = np.sum(y[m_in] * ivar[m_in]) / ivar_in\n            y_out = np.sum(y[m_out] * ivar[m_out]) / ivar_out\n\n            # Use this to compute the best fit depth and uncertainty.\n            depth = y_out - y_in\n            depth_err = np.sqrt(1.0 / ivar_in + 1.0 / ivar_out)\n            snr = depth / depth_err\n\n            # Compute the log likelihood of this model.\n            loglike = -0.5*np.sum((y_in - y[m_in])**2 * ivar[m_in])\n            loglike += 0.5*np.sum((y_out - y[m_in])**2 * ivar[m_in])\n\n            # Choose which objective should be used for the optimization.\n            if use_likelihood:\n                objective = loglike\n            else:\n                objective = snr\n\n            # If this model is better than any before, keep it.\n            if depth > 0 and objective > best[0]:\n                best = (\n                    objective,\n                    (objective, depth, depth_err, dur, (t0+min_t) % period,\n                     snr, loglike)\n                )\n\n    return best[1]"},{"col":4,"comment":"\n        See :meth:`~astropy.table.Table.add_column`.\n        ","endLoc":266,"header":"def add_column(self, *args, **kwargs)","id":14455,"name":"add_column","nodeType":"Function","startLoc":258,"text":"def add_column(self, *args, **kwargs):\n        \"\"\"\n        See :meth:`~astropy.table.Table.add_column`.\n        \"\"\"\n        # Note that the docstring is inherited from QTable\n        result = super().add_column(*args, **kwargs)\n        if len(self.indices) == 0 and 'time' in self.colnames:\n            self.add_index('time')\n        return result"},{"col":4,"comment":"\n        The time values.\n        ","endLoc":142,"header":"@property\n    def time(self)","id":14456,"name":"time","nodeType":"Function","startLoc":137,"text":"@property\n    def time(self):\n        \"\"\"\n        The time values.\n        \"\"\"\n        return self['time']"},{"col":4,"comment":"\n        Return a new `~astropy.timeseries.TimeSeries` folded with a period and\n        epoch.\n\n        Parameters\n        ----------\n        period : `~astropy.units.Quantity` ['time']\n            The period to use for folding\n        epoch_time : `~astropy.time.Time`\n            The time to use as the reference epoch, at which the relative time\n            offset / phase will be ``epoch_phase``. Defaults to the first time\n            in the time series.\n        epoch_phase : float or `~astropy.units.Quantity` ['dimensionless', 'time']\n            Phase of ``epoch_time``. If ``normalize_phase`` is `True`, this\n            should be a dimensionless value, while if ``normalize_phase`` is\n            ``False``, this should be a `~astropy.units.Quantity` with time\n            units. Defaults to 0.\n        wrap_phase : float or `~astropy.units.Quantity` ['dimensionless', 'time']\n            The value of the phase above which values are wrapped back by one\n            period. If ``normalize_phase`` is `True`, this should be a\n            dimensionless value, while if ``normalize_phase`` is ``False``,\n            this should be a `~astropy.units.Quantity` with time units.\n            Defaults to half the period, so that the resulting time series goes\n            from ``-period / 2`` to ``period / 2`` (if ``normalize_phase`` is\n            `False`) or -0.5 to 0.5 (if ``normalize_phase`` is `True`).\n        normalize_phase : bool\n            If `False` phase is returned as `~astropy.time.TimeDelta`,\n            otherwise as a dimensionless `~astropy.units.Quantity`.\n\n        Returns\n        -------\n        folded_timeseries : `~astropy.timeseries.TimeSeries`\n            The folded time series object with phase as the ``time`` column.\n        ","endLoc":245,"header":"@deprecated_renamed_argument('midpoint_epoch', 'epoch_time', '4.0')\n    def fold(self, period=None, epoch_time=None, epoch_phase=0,\n             wrap_phase=None, normalize_phase=False)","id":14457,"name":"fold","nodeType":"Function","startLoc":144,"text":"@deprecated_renamed_argument('midpoint_epoch', 'epoch_time', '4.0')\n    def fold(self, period=None, epoch_time=None, epoch_phase=0,\n             wrap_phase=None, normalize_phase=False):\n        \"\"\"\n        Return a new `~astropy.timeseries.TimeSeries` folded with a period and\n        epoch.\n\n        Parameters\n        ----------\n        period : `~astropy.units.Quantity` ['time']\n            The period to use for folding\n        epoch_time : `~astropy.time.Time`\n            The time to use as the reference epoch, at which the relative time\n            offset / phase will be ``epoch_phase``. Defaults to the first time\n            in the time series.\n        epoch_phase : float or `~astropy.units.Quantity` ['dimensionless', 'time']\n            Phase of ``epoch_time``. If ``normalize_phase`` is `True`, this\n            should be a dimensionless value, while if ``normalize_phase`` is\n            ``False``, this should be a `~astropy.units.Quantity` with time\n            units. Defaults to 0.\n        wrap_phase : float or `~astropy.units.Quantity` ['dimensionless', 'time']\n            The value of the phase above which values are wrapped back by one\n            period. If ``normalize_phase`` is `True`, this should be a\n            dimensionless value, while if ``normalize_phase`` is ``False``,\n            this should be a `~astropy.units.Quantity` with time units.\n            Defaults to half the period, so that the resulting time series goes\n            from ``-period / 2`` to ``period / 2`` (if ``normalize_phase`` is\n            `False`) or -0.5 to 0.5 (if ``normalize_phase`` is `True`).\n        normalize_phase : bool\n            If `False` phase is returned as `~astropy.time.TimeDelta`,\n            otherwise as a dimensionless `~astropy.units.Quantity`.\n\n        Returns\n        -------\n        folded_timeseries : `~astropy.timeseries.TimeSeries`\n            The folded time series object with phase as the ``time`` column.\n        \"\"\"\n\n        if not isinstance(period, Quantity) or period.unit.physical_type != 'time':\n            raise UnitsError('period should be a Quantity in units of time')\n\n        folded = self.copy()\n\n        if epoch_time is None:\n            epoch_time = self.time[0]\n        else:\n            epoch_time = Time(epoch_time)\n\n        period_sec = period.to_value(u.s)\n\n        if normalize_phase:\n            if isinstance(epoch_phase, Quantity) and epoch_phase.unit.physical_type != 'dimensionless':\n                raise UnitsError('epoch_phase should be a dimensionless Quantity '\n                                 'or a float when normalize_phase=True')\n            epoch_phase_sec = epoch_phase * period_sec\n        else:\n            if epoch_phase == 0:\n                epoch_phase_sec = 0.\n            else:\n                if not isinstance(epoch_phase, Quantity) or epoch_phase.unit.physical_type != 'time':\n                    raise UnitsError('epoch_phase should be a Quantity in units '\n                                     'of time when normalize_phase=False')\n                epoch_phase_sec = epoch_phase.to_value(u.s)\n\n        if wrap_phase is None:\n            wrap_phase = period_sec / 2\n        else:\n            if normalize_phase:\n                if isinstance(wrap_phase, Quantity) and not wrap_phase.unit.is_equivalent(u.one):\n                    raise UnitsError('wrap_phase should be dimensionless when '\n                                     'normalize_phase=True')\n                else:\n                    if wrap_phase < 0 or wrap_phase > 1:\n                        raise ValueError('wrap_phase should be between 0 and 1')\n                    else:\n                        wrap_phase = wrap_phase * period_sec\n            else:\n                if isinstance(wrap_phase, Quantity) and wrap_phase.unit.physical_type == 'time':\n                    if wrap_phase < 0 or wrap_phase > period:\n                        raise ValueError('wrap_phase should be between 0 and the period')\n                    else:\n                        wrap_phase = wrap_phase.to_value(u.s)\n                else:\n                    raise UnitsError('wrap_phase should be a Quantity in units '\n                                     'of time when normalize_phase=False')\n\n        relative_time_sec = (((self.time - epoch_time).sec\n                              + epoch_phase_sec\n                              + (period_sec - wrap_phase)) % period_sec\n                             - (period_sec - wrap_phase))\n\n        folded_time = TimeDelta(relative_time_sec * u.s)\n\n        if normalize_phase:\n            folded_time = (folded_time / period).decompose()\n            period = period_sec = 1\n\n        with folded._delay_required_column_checks():\n            folded.remove_column('time')\n            folded.add_column(folded_time, name='time', index=0)\n\n        return folded"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":14458,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"col":0,"comment":"","endLoc":2,"header":"kepler.py#<anonymous>","id":14459,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"__all__ = [\"kepler_fits_reader\"]\n\nregistry.register_reader('kepler.fits', TimeSeries, kepler_fits_reader)\n\nregistry.register_reader('tess.fits', TimeSeries, kepler_fits_reader)"},{"col":4,"comment":"Integrand of the lookback time (equation 30 of [1]_).\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : float or array\n            The integrand for the lookback time.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        ","endLoc":784,"header":"def lookback_time_integrand(self, z)","id":14460,"name":"lookback_time_integrand","nodeType":"Function","startLoc":765,"text":"def lookback_time_integrand(self, z):\n        \"\"\"Integrand of the lookback time (equation 30 of [1]_).\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : float or array\n            The integrand for the lookback time.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        \"\"\"\n        z = aszarr(z)\n        return self.inv_efunc(z) / (z + 1.0)"},{"col":4,"comment":"Integrand of the absorption distance [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        X : float\n            The integrand for the absorption distance.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        ","endLoc":805,"header":"def _abs_distance_integrand_scalar(self, z)","id":14461,"name":"_abs_distance_integrand_scalar","nodeType":"Function","startLoc":786,"text":"def _abs_distance_integrand_scalar(self, z):\n        \"\"\"Integrand of the absorption distance [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        X : float\n            The integrand for the absorption distance.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        \"\"\"\n        args = self._inv_efunc_scalar_args\n        return (z + 1.0) ** 2 * self._inv_efunc_scalar(z, *args)"},{"col":4,"comment":"Integrand of the absorption distance [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        X : float or array\n            The integrand for the absorption distance.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        ","endLoc":826,"header":"def abs_distance_integrand(self, z)","id":14462,"name":"abs_distance_integrand","nodeType":"Function","startLoc":807,"text":"def abs_distance_integrand(self, z):\n        \"\"\"Integrand of the absorption distance [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        X : float or array\n            The integrand for the absorption distance.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        \"\"\"\n        z = aszarr(z)\n        return (z + 1.0) ** 2 * self.inv_efunc(z)"},{"col":4,"comment":"Hubble parameter (km/s/Mpc) at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        H : `~astropy.units.Quantity` ['frequency']\n            Hubble parameter at each input redshift.\n        ","endLoc":841,"header":"def H(self, z)","id":14463,"name":"H","nodeType":"Function","startLoc":828,"text":"def H(self, z):\n        \"\"\"Hubble parameter (km/s/Mpc) at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        H : `~astropy.units.Quantity` ['frequency']\n            Hubble parameter at each input redshift.\n        \"\"\"\n        return self._H0 * self.efunc(z)"},{"col":4,"comment":"Scale factor at redshift ``z``.\n\n        The scale factor is defined as :math:`a = 1 / (1 + z)`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        a : ndarray or float\n            Scale factor at each input redshift.\n            Returns `float` if the input is scalar.\n        ","endLoc":859,"header":"def scale_factor(self, z)","id":14464,"name":"scale_factor","nodeType":"Function","startLoc":843,"text":"def scale_factor(self, z):\n        \"\"\"Scale factor at redshift ``z``.\n\n        The scale factor is defined as :math:`a = 1 / (1 + z)`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        a : ndarray or float\n            Scale factor at each input redshift.\n            Returns `float` if the input is scalar.\n        \"\"\"\n        return 1.0 / (aszarr(z) + 1.0)"},{"fileName":"__init__.py","filePath":"astropy/timeseries/periodograms/bls","id":14465,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nBox Least Squares\n=================\n\nAstroPy-compatible reference implementation of the transit periorogram used\nto discover transiting exoplanets.\n\n\"\"\"\n\n__all__ = [\"BoxLeastSquares\", \"BoxLeastSquaresResults\"]\n\nfrom .core import BoxLeastSquares, BoxLeastSquaresResults\n"},{"col":4,"comment":"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to a lookback time.\n        ","endLoc":881,"header":"def lookback_time(self, z)","id":14466,"name":"lookback_time","nodeType":"Function","startLoc":861,"text":"def lookback_time(self, z):\n        \"\"\"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to a lookback time.\n        \"\"\"\n        return self._lookback_time(z)"},{"col":4,"comment":"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        ","endLoc":2119,"header":"def efunc(self, z)","id":14467,"name":"efunc","nodeType":"Function","startLoc":2098,"text":"def efunc(self, z):\n        \"\"\"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        \"\"\"\n        # We override this because it takes a particularly simple\n        # form for a cosmological constant\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return np.sqrt(zp1 ** 3 * (Or * zp1 + self._Om0) + self._Ode0)"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":14468,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"col":0,"comment":"","endLoc":10,"header":"__init__.py#<anonymous>","id":14469,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nBox Least Squares\n=================\n\nAstroPy-compatible reference implementation of the transit periorogram used\nto discover transiting exoplanets.\n\n\"\"\"\n\n__all__ = [\"BoxLeastSquares\", \"BoxLeastSquaresResults\"]"},{"fileName":"core.py","filePath":"astropy/timeseries/periodograms/bls","id":14470,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n__all__ = [\"BoxLeastSquares\", \"BoxLeastSquaresResults\"]\n\nimport numpy as np\n\nfrom astropy import units\nfrom astropy.time import Time, TimeDelta\nfrom astropy.timeseries.periodograms.lombscargle.core import has_units, strip_units\nfrom astropy import units as u\nfrom . import methods\nfrom astropy.timeseries.periodograms.base import BasePeriodogram\n\n\ndef validate_unit_consistency(reference_object, input_object):\n    if has_units(reference_object):\n        input_object = units.Quantity(input_object, unit=reference_object.unit)\n    else:\n        if has_units(input_object):\n            input_object = units.Quantity(input_object, unit=units.one)\n            input_object = input_object.value\n    return input_object\n\n\nclass BoxLeastSquares(BasePeriodogram):\n    \"\"\"Compute the box least squares periodogram\n\n    This method is a commonly used tool for discovering transiting exoplanets\n    or eclipsing binaries in photometric time series datasets. This\n    implementation is based on the \"box least squares (BLS)\" method described\n    in [1]_ and [2]_.\n\n    Parameters\n    ----------\n    t : array-like, `~astropy.units.Quantity`, `~astropy.time.Time`, or `~astropy.time.TimeDelta`\n        Sequence of observation times.\n    y : array-like or `~astropy.units.Quantity`\n        Sequence of observations associated with times ``t``.\n    dy : float, array-like, or `~astropy.units.Quantity`, optional\n        Error or sequence of observational errors associated with times ``t``.\n\n    Examples\n    --------\n    Generate noisy data with a transit:\n\n    >>> rand = np.random.default_rng(42)\n    >>> t = rand.uniform(0, 10, 500)\n    >>> y = np.ones_like(t)\n    >>> y[np.abs((t + 1.0)%2.0-1)<0.08] = 1.0 - 0.1\n    >>> y += 0.01 * rand.standard_normal(len(t))\n\n    Compute the transit periodogram on a heuristically determined period grid\n    and find the period with maximum power:\n\n    >>> model = BoxLeastSquares(t, y)\n    >>> results = model.autopower(0.16)\n    >>> results.period[np.argmax(results.power)]  # doctest: +FLOAT_CMP\n    2.000412388152837\n\n    Compute the periodogram on a user-specified period grid:\n\n    >>> periods = np.linspace(1.9, 2.1, 5)\n    >>> results = model.power(periods, 0.16)\n    >>> results.power  # doctest: +FLOAT_CMP\n    array([0.01723948, 0.0643028 , 0.1338783 , 0.09428816, 0.03577543])\n\n    If the inputs are AstroPy Quantities with units, the units will be\n    validated and the outputs will also be Quantities with appropriate units:\n\n    >>> from astropy import units as u\n    >>> t = t * u.day\n    >>> y = y * u.dimensionless_unscaled\n    >>> model = BoxLeastSquares(t, y)\n    >>> results = model.autopower(0.16 * u.day)\n    >>> results.period.unit\n    Unit(\"d\")\n    >>> results.power.unit\n    Unit(dimensionless)\n\n    References\n    ----------\n    .. [1] Kovacs, Zucker, & Mazeh (2002), A&A, 391, 369\n        (arXiv:astro-ph/0206099)\n    .. [2] Hartman & Bakos (2016), Astronomy & Computing, 17, 1\n        (arXiv:1605.06811)\n\n    \"\"\"\n\n    def __init__(self, t, y, dy=None):\n\n        # If t is a TimeDelta, convert it to a quantity. The units we convert\n        # to don't really matter since the user gets a Quantity back at the end\n        # so can convert to any units they like.\n        if isinstance(t, TimeDelta):\n            t = t.to('day')\n\n        # We want to expose self.t as being the times the user passed in, but\n        # if the times are absolute, we need to convert them to relative times\n        # internally, so we use self._trel and self._tstart for this.\n\n        self.t = t\n\n        if isinstance(self.t, (Time, TimeDelta)):\n            self._tstart = self.t[0]\n            trel = (self.t - self._tstart).to(u.day)\n        else:\n            self._tstart = None\n            trel = self.t\n\n        self._trel, self.y, self.dy = self._validate_inputs(trel, y, dy)\n\n    def autoperiod(self, duration,\n                   minimum_period=None, maximum_period=None,\n                   minimum_n_transit=3, frequency_factor=1.0):\n        \"\"\"Determine a suitable grid of periods\n\n        This method uses a set of heuristics to select a conservative period\n        grid that is uniform in frequency. This grid might be too fine for\n        some user's needs depending on the precision requirements or the\n        sampling of the data. The grid can be made coarser by increasing\n        ``frequency_factor``.\n\n        Parameters\n        ----------\n        duration : float, array-like, or `~astropy.units.Quantity` ['time']\n            The set of durations that will be considered.\n        minimum_period, maximum_period : float or `~astropy.units.Quantity` ['time'], optional\n            The minimum/maximum periods to search. If not provided, these will\n            be computed as described in the notes below.\n        minimum_n_transits : int, optional\n            If ``maximum_period`` is not provided, this is used to compute the\n            maximum period to search by asserting that any systems with at\n            least ``minimum_n_transits`` will be within the range of searched\n            periods. Note that this is not the same as requiring that\n            ``minimum_n_transits`` be required for detection. The default\n            value is ``3``.\n        frequency_factor : float, optional\n            A factor to control the frequency spacing as described in the\n            notes below. The default value is ``1.0``.\n\n        Returns\n        -------\n        period : array-like or `~astropy.units.Quantity` ['time']\n            The set of periods computed using these heuristics with the same\n            units as ``t``.\n\n        Notes\n        -----\n        The default minimum period is chosen to be twice the maximum duration\n        because there won't be much sensitivity to periods shorter than that.\n\n        The default maximum period is computed as\n\n        .. code-block:: python\n\n            maximum_period = (max(t) - min(t)) / minimum_n_transits\n\n        ensuring that any systems with at least ``minimum_n_transits`` are\n        within the range of searched periods.\n\n        The frequency spacing is given by\n\n        .. code-block:: python\n\n            df = frequency_factor * min(duration) / (max(t) - min(t))**2\n\n        so the grid can be made finer by decreasing ``frequency_factor`` or\n        coarser by increasing ``frequency_factor``.\n\n        \"\"\"\n\n        duration = self._validate_duration(duration)\n        baseline = strip_units(self._trel.max() - self._trel.min())\n        min_duration = strip_units(np.min(duration))\n\n        # Estimate the required frequency spacing\n        # Because of the sparsity of a transit, this must be much finer than\n        # the frequency resolution for a sinusoidal fit. For a sinusoidal fit,\n        # df would be 1/baseline (see LombScargle), but here this should be\n        # scaled proportionally to the duration in units of baseline.\n        df = frequency_factor * min_duration / baseline**2\n\n        # If a minimum period is not provided, choose one that is twice the\n        # maximum duration because we won't be sensitive to any periods\n        # shorter than that.\n        if minimum_period is None:\n            minimum_period = 2.0 * strip_units(np.max(duration))\n        else:\n            minimum_period = validate_unit_consistency(self._trel, minimum_period)\n            minimum_period = strip_units(minimum_period)\n\n        # If no maximum period is provided, choose one by requiring that\n        # all signals with at least minimum_n_transit should be detectable.\n        if maximum_period is None:\n            if minimum_n_transit <= 1:\n                raise ValueError(\"minimum_n_transit must be greater than 1\")\n            maximum_period = baseline / (minimum_n_transit-1)\n        else:\n            maximum_period = validate_unit_consistency(self._trel, maximum_period)\n            maximum_period = strip_units(maximum_period)\n\n        if maximum_period < minimum_period:\n            minimum_period, maximum_period = maximum_period, minimum_period\n        if minimum_period <= 0.0:\n            raise ValueError(\"minimum_period must be positive\")\n\n        # Convert bounds to frequency\n        minimum_frequency = 1.0/strip_units(maximum_period)\n        maximum_frequency = 1.0/strip_units(minimum_period)\n\n        # Compute the number of frequencies and the frequency grid\n        nf = 1 + int(np.round((maximum_frequency - minimum_frequency)/df))\n        return 1.0/(maximum_frequency-df*np.arange(nf)) * self._t_unit()\n\n    def autopower(self, duration, objective=None, method=None, oversample=10,\n                  minimum_n_transit=3, minimum_period=None,\n                  maximum_period=None, frequency_factor=1.0):\n        \"\"\"Compute the periodogram at set of heuristically determined periods\n\n        This method calls :func:`BoxLeastSquares.autoperiod` to determine\n        the period grid and then :func:`BoxLeastSquares.power` to compute\n        the periodogram. See those methods for documentation of the arguments.\n\n        \"\"\"\n        period = self.autoperiod(duration,\n                                 minimum_n_transit=minimum_n_transit,\n                                 minimum_period=minimum_period,\n                                 maximum_period=maximum_period,\n                                 frequency_factor=frequency_factor)\n        return self.power(period, duration, objective=objective, method=method,\n                          oversample=oversample)\n\n    def power(self, period, duration, objective=None, method=None,\n              oversample=10):\n        \"\"\"Compute the periodogram for a set of periods\n\n        Parameters\n        ----------\n        period : array-like or `~astropy.units.Quantity` ['time']\n            The periods where the power should be computed\n        duration : float, array-like, or `~astropy.units.Quantity` ['time']\n            The set of durations to test\n        objective : {'likelihood', 'snr'}, optional\n            The scalar that should be optimized to find the best fit phase,\n            duration, and depth. This can be either ``'likelihood'`` (default)\n            to optimize the log-likelihood of the model, or ``'snr'`` to\n            optimize the signal-to-noise with which the transit depth is\n            measured.\n        method : {'fast', 'slow'}, optional\n            The computational method used to compute the periodogram. This is\n            mainly included for the purposes of testing and most users will\n            want to use the optimized ``'fast'`` method (default) that is\n            implemented in Cython.  ``'slow'`` is a brute-force method that is\n            used to test the results of the ``'fast'`` method.\n        oversample : int, optional\n            The number of bins per duration that should be used. This sets the\n            time resolution of the phase fit with larger values of\n            ``oversample`` yielding a finer grid and higher computational cost.\n\n        Returns\n        -------\n        results : BoxLeastSquaresResults\n            The periodogram results as a :class:`BoxLeastSquaresResults`\n            object.\n\n        Raises\n        ------\n        ValueError\n            If ``oversample`` is not an integer greater than 0 or if\n            ``objective`` or ``method`` are not valid.\n\n        \"\"\"\n        period, duration = self._validate_period_and_duration(period, duration)\n\n        # Check for absurdities in the ``oversample`` choice\n        try:\n            oversample = int(oversample)\n        except TypeError:\n            raise ValueError(f\"oversample must be an int, got {oversample}\")\n        if oversample < 1:\n            raise ValueError(\"oversample must be greater than or equal to 1\")\n\n        # Select the periodogram objective\n        if objective is None:\n            objective = \"likelihood\"\n        allowed_objectives = [\"snr\", \"likelihood\"]\n        if objective not in allowed_objectives:\n            raise ValueError((\"Unrecognized method '{0}'\\n\"\n                              \"allowed methods are: {1}\")\n                             .format(objective, allowed_objectives))\n        use_likelihood = (objective == \"likelihood\")\n\n        # Select the computational method\n        if method is None:\n            method = \"fast\"\n        allowed_methods = [\"fast\", \"slow\"]\n        if method not in allowed_methods:\n            raise ValueError((\"Unrecognized method '{0}'\\n\"\n                              \"allowed methods are: {1}\")\n                             .format(method, allowed_methods))\n\n        # Format and check the input arrays\n        t = np.ascontiguousarray(strip_units(self._trel), dtype=np.float64)\n        t_ref = np.min(t)\n        y = np.ascontiguousarray(strip_units(self.y), dtype=np.float64)\n        if self.dy is None:\n            ivar = np.ones_like(y)\n        else:\n            ivar = 1.0 / np.ascontiguousarray(strip_units(self.dy),\n                                              dtype=np.float64)**2\n\n        # Make sure that the period and duration arrays are C-order\n        period_fmt = np.ascontiguousarray(strip_units(period),\n                                          dtype=np.float64)\n        duration = np.ascontiguousarray(strip_units(duration),\n                                        dtype=np.float64)\n\n        # Select the correct implementation for the chosen method\n        if method == \"fast\":\n            bls = methods.bls_fast\n        else:\n            bls = methods.bls_slow\n\n        # Run the implementation\n        results = bls(\n            t - t_ref, y - np.median(y), ivar, period_fmt, duration,\n            oversample, use_likelihood)\n\n        return self._format_results(t_ref, objective, period, results)\n\n    def _as_relative_time(self, name, times):\n        \"\"\"\n        Convert the provided times (if absolute) to relative times using the\n        current _tstart value. If the times provided are relative, they are\n        returned without conversion (though we still do some checks).\n        \"\"\"\n\n        if isinstance(times, TimeDelta):\n            times = times.to('day')\n\n        if self._tstart is None:\n            if isinstance(times, Time):\n                raise TypeError('{} was provided as an absolute time but '\n                                'the BoxLeastSquares class was initialized '\n                                'with relative times.'.format(name))\n        else:\n            if isinstance(times, Time):\n                times = (times - self._tstart).to(u.day)\n            else:\n                raise TypeError('{} was provided as a relative time but '\n                                'the BoxLeastSquares class was initialized '\n                                'with absolute times.'.format(name))\n\n        times = validate_unit_consistency(self._trel, times)\n\n        return times\n\n    def _as_absolute_time_if_needed(self, name, times):\n        \"\"\"\n        Convert the provided times to absolute times using the current _tstart\n        value, if needed.\n        \"\"\"\n        if self._tstart is not None:\n            # Some time formats/scales can't represent dates/times too far\n            # off from the present, so we need to mask values offset by\n            # more than 100,000 yr (the periodogram algorithm can return\n            # transit times of e.g 1e300 for some periods).\n            reset = np.abs(times.to_value(u.year)) > 100000\n            times[reset] = 0\n            times = self._tstart + times\n            times[reset] = np.nan\n        return times\n\n    def model(self, t_model, period, duration, transit_time):\n        \"\"\"Compute the transit model at the given period, duration, and phase\n\n        Parameters\n        ----------\n        t_model : array-like, `~astropy.units.Quantity`, or `~astropy.time.Time`\n            Times at which to compute the model.\n        period : float or `~astropy.units.Quantity` ['time']\n            The period of the transits.\n        duration : float or `~astropy.units.Quantity` ['time']\n            The duration of the transit.\n        transit_time : float or `~astropy.units.Quantity` or `~astropy.time.Time`\n            The mid-transit time of a reference transit.\n\n        Returns\n        -------\n        y_model : array-like or `~astropy.units.Quantity`\n            The model evaluated at the times ``t_model`` with units of ``y``.\n\n        \"\"\"\n\n        period, duration = self._validate_period_and_duration(period, duration)\n\n        transit_time = self._as_relative_time('transit_time', transit_time)\n        t_model = strip_units(self._as_relative_time('t_model', t_model))\n\n        period = float(strip_units(period))\n        duration = float(strip_units(duration))\n        transit_time = float(strip_units(transit_time))\n\n        t = np.ascontiguousarray(strip_units(self._trel), dtype=np.float64)\n        y = np.ascontiguousarray(strip_units(self.y), dtype=np.float64)\n        if self.dy is None:\n            ivar = np.ones_like(y)\n        else:\n            ivar = 1.0 / np.ascontiguousarray(strip_units(self.dy),\n                                              dtype=np.float64)**2\n\n        # Compute the depth\n        hp = 0.5*period\n        m_in = np.abs((t-transit_time+hp) % period - hp) < 0.5*duration\n        m_out = ~m_in\n        y_in = np.sum(y[m_in] * ivar[m_in]) / np.sum(ivar[m_in])\n        y_out = np.sum(y[m_out] * ivar[m_out]) / np.sum(ivar[m_out])\n\n        # Evaluate the model\n        y_model = y_out + np.zeros_like(t_model)\n        m_model = np.abs((t_model-transit_time+hp) % period-hp) < 0.5*duration\n        y_model[m_model] = y_in\n\n        return y_model * self._y_unit()\n\n    def compute_stats(self, period, duration, transit_time):\n        \"\"\"Compute descriptive statistics for a given transit model\n\n        These statistics are commonly used for vetting of transit candidates.\n\n        Parameters\n        ----------\n        period : float or `~astropy.units.Quantity` ['time']\n            The period of the transits.\n        duration : float or `~astropy.units.Quantity` ['time']\n            The duration of the transit.\n        transit_time : float or `~astropy.units.Quantity` or `~astropy.time.Time`\n            The mid-transit time of a reference transit.\n\n        Returns\n        -------\n        stats : dict\n            A dictionary containing several descriptive statistics:\n\n            - ``depth``: The depth and uncertainty (as a tuple with two\n                values) on the depth for the fiducial model.\n            - ``depth_odd``: The depth and uncertainty on the depth for a\n                model where the period is twice the fiducial period.\n            - ``depth_even``: The depth and uncertainty on the depth for a\n                model where the period is twice the fiducial period and the\n                phase is offset by one orbital period.\n            - ``depth_half``: The depth and uncertainty for a model with a\n                period of half the fiducial period.\n            - ``depth_phased``: The depth and uncertainty for a model with the\n                fiducial period and the phase offset by half a period.\n            - ``harmonic_amplitude``: The amplitude of the best fit sinusoidal\n                model.\n            - ``harmonic_delta_log_likelihood``: The difference in log\n                likelihood between a sinusoidal model and the transit model.\n                If ``harmonic_delta_log_likelihood`` is greater than zero, the\n                sinusoidal model is preferred.\n            - ``transit_times``: The mid-transit time for each transit in the\n                baseline.\n            - ``per_transit_count``: An array with a count of the number of\n                data points in each unique transit included in the baseline.\n            - ``per_transit_log_likelihood``: An array with the value of the\n                log likelihood for each unique transit included in the\n                baseline.\n\n        \"\"\"\n\n        period, duration = self._validate_period_and_duration(period, duration)\n        transit_time = self._as_relative_time('transit_time', transit_time)\n\n        period = float(strip_units(period))\n        duration = float(strip_units(duration))\n        transit_time = float(strip_units(transit_time))\n\n        t = np.ascontiguousarray(strip_units(self._trel), dtype=np.float64)\n        y = np.ascontiguousarray(strip_units(self.y), dtype=np.float64)\n        if self.dy is None:\n            ivar = np.ones_like(y)\n        else:\n            ivar = 1.0 / np.ascontiguousarray(strip_units(self.dy),\n                                              dtype=np.float64)**2\n\n        # This a helper function that will compute the depth for several\n        # different hypothesized transit models with different parameters\n        def _compute_depth(m, y_out=None, var_out=None):\n            if np.any(m) and (var_out is None or np.isfinite(var_out)):\n                var_m = 1.0 / np.sum(ivar[m])\n                y_m = np.sum(y[m] * ivar[m]) * var_m\n                if y_out is None:\n                    return y_m, var_m\n                return y_out - y_m, np.sqrt(var_m + var_out)\n            return 0.0, np.inf\n\n        # Compute the depth of the fiducial model and the two models at twice\n        # the period\n        hp = 0.5*period\n        m_in = np.abs((t-transit_time+hp) % period - hp) < 0.5*duration\n        m_out = ~m_in\n        m_odd = np.abs((t-transit_time) % (2*period) - period) \\\n            < 0.5*duration\n        m_even = np.abs((t-transit_time+period) % (2*period) - period) \\\n            < 0.5*duration\n\n        y_out, var_out = _compute_depth(m_out)\n        depth = _compute_depth(m_in, y_out, var_out)\n        depth_odd = _compute_depth(m_odd, y_out, var_out)\n        depth_even = _compute_depth(m_even, y_out, var_out)\n        y_in = y_out - depth[0]\n\n        # Compute the depth of the model at a phase of 0.5*period\n        m_phase = np.abs((t-transit_time) % period - hp) < 0.5*duration\n        depth_phase = _compute_depth(m_phase,\n                                     *_compute_depth((~m_phase) & m_out))\n\n        # Compute the depth of a model with a period of 0.5*period\n        m_half = np.abs((t-transit_time+0.25*period) % (0.5*period)\n                        - 0.25*period) < 0.5*duration\n        depth_half = _compute_depth(m_half, *_compute_depth(~m_half))\n\n        # Compute the number of points in each transit\n        transit_id = np.round((t[m_in]-transit_time) / period).astype(int)\n        transit_times = period * np.arange(transit_id.min(),\n                                           transit_id.max()+1) + transit_time\n        unique_ids, unique_counts = np.unique(transit_id,\n                                              return_counts=True)\n        unique_ids -= np.min(transit_id)\n        transit_id -= np.min(transit_id)\n        counts = np.zeros(np.max(transit_id) + 1, dtype=int)\n        counts[unique_ids] = unique_counts\n\n        # Compute the per-transit log likelihood\n        ll = -0.5 * ivar[m_in] * ((y[m_in] - y_in)**2 - (y[m_in] - y_out)**2)\n        lls = np.zeros(len(counts))\n        for i in unique_ids:\n            lls[i] = np.sum(ll[transit_id == i])\n        full_ll = -0.5*np.sum(ivar[m_in] * (y[m_in] - y_in)**2)\n        full_ll -= 0.5*np.sum(ivar[m_out] * (y[m_out] - y_out)**2)\n\n        # Compute the log likelihood of a sine model\n        A = np.vstack((\n            np.sin(2*np.pi*t/period), np.cos(2*np.pi*t/period),\n            np.ones_like(t)\n        )).T\n        w = np.linalg.solve(np.dot(A.T, A * ivar[:, None]),\n                            np.dot(A.T, y * ivar))\n        mod = np.dot(A, w)\n        sin_ll = -0.5*np.sum((y-mod)**2*ivar)\n\n        # Format the results\n        y_unit = self._y_unit()\n        ll_unit = 1\n        if self.dy is None:\n            ll_unit = y_unit * y_unit\n        return dict(\n            transit_times=self._as_absolute_time_if_needed('transit_times', transit_times * self._t_unit()),\n            per_transit_count=counts,\n            per_transit_log_likelihood=lls * ll_unit,\n            depth=(depth[0] * y_unit, depth[1] * y_unit),\n            depth_phased=(depth_phase[0] * y_unit, depth_phase[1] * y_unit),\n            depth_half=(depth_half[0] * y_unit, depth_half[1] * y_unit),\n            depth_odd=(depth_odd[0] * y_unit, depth_odd[1] * y_unit),\n            depth_even=(depth_even[0] * y_unit, depth_even[1] * y_unit),\n            harmonic_amplitude=np.sqrt(np.sum(w[:2]**2)) * y_unit,\n            harmonic_delta_log_likelihood=(sin_ll - full_ll) * ll_unit,\n        )\n\n    def transit_mask(self, t, period, duration, transit_time):\n        \"\"\"Compute which data points are in transit for a given parameter set\n\n        Parameters\n        ----------\n        t_model : array-like or `~astropy.units.Quantity` ['time']\n            Times where the mask should be evaluated.\n        period : float or `~astropy.units.Quantity` ['time']\n            The period of the transits.\n        duration : float or `~astropy.units.Quantity` ['time']\n            The duration of the transit.\n        transit_time : float or `~astropy.units.Quantity` or `~astropy.time.Time`\n            The mid-transit time of a reference transit.\n\n        Returns\n        -------\n        transit_mask : array-like\n            A boolean array where ``True`` indicates and in transit point and\n            ``False`` indicates and out-of-transit point.\n\n        \"\"\"\n\n        period, duration = self._validate_period_and_duration(period, duration)\n        transit_time = self._as_relative_time('transit_time', transit_time)\n        t = strip_units(self._as_relative_time('t', t))\n\n        period = float(strip_units(period))\n        duration = float(strip_units(duration))\n        transit_time = float(strip_units(transit_time))\n\n        hp = 0.5*period\n        return np.abs((t-transit_time+hp) % period - hp) < 0.5*duration\n\n    def _validate_inputs(self, t, y, dy):\n        \"\"\"Private method used to check the consistency of the inputs\n\n        Parameters\n        ----------\n        t : array-like, `~astropy.units.Quantity`, `~astropy.time.Time`, or `~astropy.time.TimeDelta`\n            Sequence of observation times.\n        y : array-like or `~astropy.units.Quantity`\n            Sequence of observations associated with times t.\n        dy : float, array-like, or `~astropy.units.Quantity`\n            Error or sequence of observational errors associated with times t.\n\n        Returns\n        -------\n        t, y, dy : array-like, `~astropy.units.Quantity`, or `~astropy.time.Time`\n            The inputs with consistent shapes and units.\n\n        Raises\n        ------\n        ValueError\n            If the dimensions are incompatible or if the units of dy cannot be\n            converted to the units of y.\n\n        \"\"\"\n\n        # Validate shapes of inputs\n        if dy is None:\n            t, y = np.broadcast_arrays(t, y, subok=True)\n        else:\n            t, y, dy = np.broadcast_arrays(t, y, dy, subok=True)\n        if t.ndim != 1:\n            raise ValueError(\"Inputs (t, y, dy) must be 1-dimensional\")\n\n        # validate units of inputs if any is a Quantity\n        if dy is not None:\n            dy = validate_unit_consistency(y, dy)\n\n        return t, y, dy\n\n    def _validate_duration(self, duration):\n        \"\"\"Private method used to check a set of test durations\n\n        Parameters\n        ----------\n        duration : float, array-like, or `~astropy.units.Quantity`\n            The set of durations that will be considered.\n\n        Returns\n        -------\n        duration : array-like or `~astropy.units.Quantity`\n            The input reformatted with the correct shape and units.\n\n        Raises\n        ------\n        ValueError\n            If the units of duration cannot be converted to the units of t.\n\n        \"\"\"\n        duration = np.atleast_1d(np.abs(duration))\n        if duration.ndim != 1 or duration.size == 0:\n            raise ValueError(\"duration must be 1-dimensional\")\n        return validate_unit_consistency(self._trel, duration)\n\n    def _validate_period_and_duration(self, period, duration):\n        \"\"\"Private method used to check a set of periods and durations\n\n        Parameters\n        ----------\n        period : float, array-like, or `~astropy.units.Quantity` ['time']\n            The set of test periods.\n        duration : float, array-like, or `~astropy.units.Quantity` ['time']\n            The set of durations that will be considered.\n\n        Returns\n        -------\n        period, duration : array-like or `~astropy.units.Quantity` ['time']\n            The inputs reformatted with the correct shapes and units.\n\n        Raises\n        ------\n        ValueError\n            If the units of period or duration cannot be converted to the\n            units of t.\n\n        \"\"\"\n        duration = self._validate_duration(duration)\n        period = np.atleast_1d(np.abs(period))\n        if period.ndim != 1 or period.size == 0:\n            raise ValueError(\"period must be 1-dimensional\")\n        period = validate_unit_consistency(self._trel, period)\n\n        if not np.min(period) > np.max(duration):\n            raise ValueError(\"The maximum transit duration must be shorter \"\n                             \"than the minimum period\")\n\n        return period, duration\n\n    def _format_results(self, t_ref, objective, period, results):\n        \"\"\"A private method used to wrap and add units to the periodogram\n\n        Parameters\n        ----------\n        t_ref : float\n            The minimum time in the time series (a reference time).\n        objective : str\n            The name of the objective used in the optimization.\n        period : array-like or `~astropy.units.Quantity` ['time']\n            The set of trial periods.\n        results : tuple\n            The output of one of the periodogram implementations.\n\n        \"\"\"\n        (power, depth, depth_err, duration, transit_time, depth_snr,\n         log_likelihood) = results\n        transit_time += t_ref\n\n        if has_units(self._trel):\n            transit_time = units.Quantity(transit_time, unit=self._trel.unit)\n            transit_time = self._as_absolute_time_if_needed('transit_time', transit_time)\n            duration = units.Quantity(duration, unit=self._trel.unit)\n\n        if has_units(self.y):\n            depth = units.Quantity(depth, unit=self.y.unit)\n            depth_err = units.Quantity(depth_err, unit=self.y.unit)\n\n            depth_snr = units.Quantity(depth_snr, unit=units.one)\n\n            if self.dy is None:\n                if objective == \"likelihood\":\n                    power = units.Quantity(power, unit=self.y.unit**2)\n                else:\n                    power = units.Quantity(power, unit=units.one)\n                log_likelihood = units.Quantity(log_likelihood,\n                                                unit=self.y.unit**2)\n            else:\n                power = units.Quantity(power, unit=units.one)\n                log_likelihood = units.Quantity(log_likelihood, unit=units.one)\n\n        return BoxLeastSquaresResults(\n            objective, period, power, depth, depth_err, duration, transit_time,\n            depth_snr, log_likelihood)\n\n    def _t_unit(self):\n        if has_units(self._trel):\n            return self._trel.unit\n        else:\n            return 1\n\n    def _y_unit(self):\n        if has_units(self.y):\n            return self.y.unit\n        else:\n            return 1\n\n\nclass BoxLeastSquaresResults(dict):\n    \"\"\"The results of a BoxLeastSquares search\n\n    Attributes\n    ----------\n    objective : str\n        The scalar used to optimize to find the best fit phase, duration, and\n        depth. See :func:`BoxLeastSquares.power` for more information.\n    period : array-like or `~astropy.units.Quantity` ['time']\n        The set of test periods.\n    power : array-like or `~astropy.units.Quantity`\n        The periodogram evaluated at the periods in ``period``. If\n        ``objective`` is:\n\n        * ``'likelihood'``: the values of ``power`` are the\n          log likelihood maximized over phase, depth, and duration, or\n        * ``'snr'``: the values of ``power`` are the signal-to-noise with\n          which the depth is measured maximized over phase, depth, and\n          duration.\n\n    depth : array-like or `~astropy.units.Quantity`\n        The estimated depth of the maximum power model at each period.\n    depth_err : array-like or `~astropy.units.Quantity`\n        The 1-sigma uncertainty on ``depth``.\n    duration : array-like or `~astropy.units.Quantity` ['time']\n        The maximum power duration at each period.\n    transit_time : array-like, `~astropy.units.Quantity`, or `~astropy.time.Time`\n        The maximum power phase of the transit in units of time. This\n        indicates the mid-transit time and it will always be in the range\n        (0, period).\n    depth_snr : array-like or `~astropy.units.Quantity`\n        The signal-to-noise with which the depth is measured at maximum power.\n    log_likelihood : array-like or `~astropy.units.Quantity`\n        The log likelihood of the maximum power model.\n\n    \"\"\"\n    def __init__(self, *args):\n        super().__init__(zip(\n            (\"objective\", \"period\", \"power\", \"depth\", \"depth_err\",\n             \"duration\", \"transit_time\", \"depth_snr\", \"log_likelihood\"),\n            args\n        ))\n\n    def __getattr__(self, name):\n        try:\n            return self[name]\n        except KeyError:\n            raise AttributeError(name)\n\n    __setattr__ = dict.__setitem__\n    __delattr__ = dict.__delitem__\n\n    def __repr__(self):\n        if self.keys():\n            m = max(map(len, list(self.keys()))) + 1\n            return '\\n'.join([k.rjust(m) + ': ' + repr(v)\n                              for k, v in sorted(self.items())])\n        else:\n            return self.__class__.__name__ + \"()\"\n\n    def __dir__(self):\n        return list(self.keys())\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":4,"id":14471,"name":"__all__","nodeType":"Attribute","startLoc":4,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"core.py#<anonymous>","id":14472,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = [\"BoxLeastSquares\", \"BoxLeastSquaresResults\"]"},{"col":4,"comment":"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n        ","endLoc":899,"header":"def _lookback_time(self, z)","id":14473,"name":"_lookback_time","nodeType":"Function","startLoc":883,"text":"def _lookback_time(self, z):\n        \"\"\"Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            Lookback time in Gyr to each input redshift.\n        \"\"\"\n        return self._hubble_time * self._integral_lookback_time(z)"},{"col":4,"comment":"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The inverse redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H_z = H_0 / E`.\n        ","endLoc":2139,"header":"def inv_efunc(self, z)","id":14474,"name":"inv_efunc","nodeType":"Function","startLoc":2121,"text":"def inv_efunc(self, z):\n        r\"\"\"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The inverse redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n        return (zp1 ** 3 * (Or * zp1 + self._Om0) + self._Ode0)**(-0.5)"},{"id":14475,"name":"bls.c","nodeType":"TextFile","path":"astropy/timeseries/periodograms/bls","text":"/* Licensed under a 3-clause BSD style license - see LICENSE.rst */\n\n#include <math.h>\n#include <float.h>\n#include <stdlib.h>\n\n#if defined(_OPENMP)\n#include <omp.h>\n#endif\n\n#ifndef INFINITY\n#define INFINITY (1.0 / 0.0)\n#endif\n\nvoid compute_objective(\n    double y_in,\n    double y_out,\n    double ivar_in,\n    double ivar_out,\n    int obj_flag,\n    double* objective,\n    double* log_likelihood,\n    double* depth,\n    double* depth_err,\n    double* depth_snr\n) {\n    if (obj_flag) {\n        double arg = y_out - y_in;\n        *log_likelihood = 0.5*ivar_in*arg*arg;\n        *objective = *log_likelihood;\n    } else {\n        *depth = y_out - y_in;\n        *depth_err = sqrt(1.0 / ivar_in + 1.0 / ivar_out);\n        *depth_snr = *depth / *depth_err;\n        *objective = *depth_snr;\n    }\n}\n\nstatic inline double wrap_into (double x, double period)\n{\n    return x - period * floor(x / period);\n}\n\nint run_bls (\n    // Inputs\n    int N,                   // Length of the time array\n    double* t,               // The list of timestamps\n    double* y,               // The y measured at ``t``\n    double* ivar,            // The inverse variance of the y array\n\n    int n_periods,\n    double* periods,         // The period to test in units of ``t``\n\n    int n_durations,         // Length of the durations array\n    double* durations,       // The durations to test in units of ``bin_duration``\n    int oversample,          // The number of ``bin_duration`` bins in the maximum duration\n\n    int obj_flag,            // A flag indicating the periodogram type\n                             // 0 - depth signal-to-noise\n                             // 1 - log likelihood\n\n    // Outputs\n    double* best_objective,  // The value of the periodogram at maximum\n    double* best_depth,      // The estimated depth at maximum\n    double* best_depth_err,  // The uncertainty on ``best_depth``\n    double* best_duration,   // The best fitting duration in units of ``t``\n    double* best_phase,      // The phase of the mid-transit time in units of\n                             // ``t``\n    double* best_depth_snr,  // The signal-to-noise ratio of the depth estimate\n    double* best_log_like    // The log likelihood at maximum\n) {\n    // Start by finding the period and duration ranges\n    double max_period = periods[0], min_period = periods[0];\n    int k;\n    for (k = 1; k < n_periods; ++k) {\n        if (periods[k] < min_period) min_period = periods[k];\n        if (periods[k] > max_period) max_period = periods[k];\n    }\n    if (min_period < DBL_EPSILON) return 1;\n    double min_duration = durations[0], max_duration = durations[0];\n    for (k = 1; k < n_durations; ++k) {\n        if (durations[k] < min_duration) min_duration = durations[k];\n        if (durations[k] > max_duration) max_duration = durations[k];\n    }\n    if ((max_duration > min_period) || (min_duration < DBL_EPSILON)) return 2;\n\n    // Compute the durations in terms of bin_duration\n    double bin_duration = min_duration / ((double)oversample);\n    int max_n_bins = (int)(ceil(max_period / bin_duration)) + oversample;\n\n    int nthreads, blocksize = max_n_bins+1;\n#pragma omp parallel\n{\n#if defined(_OPENMP)\n    nthreads = omp_get_num_threads();\n#else\n    nthreads = 1;\n#endif\n}\n\n    // Allocate the work arrays\n    double* mean_y_0 = (double*)malloc(nthreads*blocksize*sizeof(double));\n    if (mean_y_0 == NULL) {\n        return -2;\n    }\n    double* mean_ivar_0 = (double*)malloc(nthreads*blocksize*sizeof(double));\n    if (mean_ivar_0 == NULL) {\n        free(mean_y_0);\n        return -3;\n    }\n\n    // Pre-accumulate some factors.\n    double min_t = INFINITY;\n    double sum_y = 0.0, sum_ivar = 0.0;\n    int i;\n    #pragma omp parallel for reduction(+:sum_y), reduction(+:sum_ivar)\n    for (i = 0; i < N; ++i) {\n        min_t = fmin(min_t, t[i]);\n        sum_y += y[i] * ivar[i];\n        sum_ivar += ivar[i];\n    }\n\n    // Loop over periods and do the search\n    int p;\n    #pragma omp parallel for\n    for (p = 0; p < n_periods; ++p) {\n#if defined(_OPENMP)\n        int ithread = omp_get_thread_num();\n#else\n        int ithread = 0;\n#endif\n        int block = blocksize * ithread;\n        double period = periods[p];\n        int n_bins = (int)(ceil(period / bin_duration)) + oversample;\n\n        double* mean_y = mean_y_0 + block;\n        double* mean_ivar = mean_ivar_0 + block;\n\n        // This first pass bins the data into a fine-grain grid in phase from zero\n        // to period and computes the weighted sum and inverse variance for each\n        // bin.\n        int n, ind;\n        for (n = 0; n < n_bins+1; ++n) {\n            mean_y[n] = 0.0;\n            mean_ivar[n] = 0.0;\n        }\n        for (n = 0; n < N; ++n) {\n            int ind = (int)(wrap_into(t[n] - min_t, period) / bin_duration) + 1;\n            mean_y[ind] += y[n] * ivar[n];\n            mean_ivar[ind] += ivar[n];\n        }\n\n        // To simplify calculations below, we wrap the binned values around and pad\n        // the end of the array with the first ``oversample`` samples.\n        for (n = 1, ind = n_bins - oversample; n <= oversample; ++n, ++ind) {\n            mean_y[ind] = mean_y[n];\n            mean_ivar[ind] = mean_ivar[n];\n        }\n\n        // To compute the estimates of the in-transit flux, we need the sum of\n        // mean_y and mean_ivar over a given set of transit points. To get this\n        // fast, we can compute the cumulative sum and then use differences between\n        // points separated by ``duration`` bins. Here we convert the mean arrays\n        // to cumulative sums.\n        for (n = 1; n <= n_bins; ++n) {\n            mean_y[n] += mean_y[n-1];\n            mean_ivar[n] += mean_ivar[n-1];\n        }\n\n        // Then we loop over phases (in steps of n_bin) and durations and find the\n        // best fit value. By looping over durations here, we get to reuse a lot of\n        // the computations that we did above.\n        double objective, log_like, depth, depth_err, depth_snr;\n        best_objective[p] = -INFINITY;\n        int k;\n        for (k = 0; k < n_durations; ++k) {\n            int dur = (int)(round(durations[k] / bin_duration));\n            int n_max = n_bins-dur;\n            for (n = 0; n <= n_max; ++n) {\n                // Estimate the in-transit and out-of-transit flux\n                double y_in = mean_y[n+dur] - mean_y[n];\n                double ivar_in = mean_ivar[n+dur] - mean_ivar[n];\n                double y_out = sum_y - y_in;\n                double ivar_out = sum_ivar - ivar_in;\n\n                // Skip this model if there are no points in transit\n                if ((ivar_in < DBL_EPSILON) || (ivar_out < DBL_EPSILON)) {\n                    continue;\n                }\n\n                // Normalize to compute the actual value of the flux\n                y_in /= ivar_in;\n                y_out /= ivar_out;\n\n                // Either compute the log likelihood or the signal-to-noise\n                // ratio\n                compute_objective(y_in, y_out, ivar_in, ivar_out, obj_flag,\n                        &objective, &log_like, &depth, &depth_err, &depth_snr);\n\n                // If this is the best result seen so far, keep it\n                if (y_out >= y_in && objective > best_objective[p]) {\n                    best_objective[p] = objective;\n\n                    // Compute the other parameters\n                    compute_objective(y_in, y_out, ivar_in, ivar_out, (obj_flag == 0),\n                            &objective, &log_like, &depth, &depth_err, &depth_snr);\n\n                    best_depth[p]     = depth;\n                    best_depth_err[p] = depth_err;\n                    best_depth_snr[p] = depth_snr;\n                    best_log_like[p]  = log_like;\n                    best_duration[p]  = dur * bin_duration;\n                    best_phase[p]     = fmod(n*bin_duration + 0.5*best_duration[p] + min_t, period);\n                }\n            }\n        }\n    }\n\n    // Clean up\n    free(mean_y_0);\n    free(mean_ivar_0);\n\n    return 0;\n}\n"},{"id":14476,"name":"astropy/timeseries/periodograms/bls/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/timeseries/periodograms/bls/tests","id":14477,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n"},{"attributeType":"null","col":12,"comment":"null","endLoc":2092,"id":14478,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":2092,"text":"self._inv_efunc_scalar"},{"id":14479,"name":"astropy/timeseries/periodograms/lombscargle","nodeType":"Package"},{"fileName":"utils.py","filePath":"astropy/timeseries/periodograms/lombscargle","id":14480,"nodeType":"File","text":"import numpy as np\n\n\nNORMALIZATIONS = ['standard', 'psd', 'model', 'log']\n\n\ndef compute_chi2_ref(y, dy=None, center_data=True, fit_mean=True):\n    \"\"\"Compute the reference chi-square for a particular dataset.\n\n    Note: this is not valid center_data=False and fit_mean=False.\n\n    Parameters\n    ----------\n    y : array-like\n        data values\n    dy : float, array, or None, optional\n        data uncertainties\n    center_data : bool\n        specify whether data should be pre-centered\n    fit_mean : bool\n        specify whether model should fit the mean of the data\n\n    Returns\n    -------\n    chi2_ref : float\n        The reference chi-square for the periodogram of this data\n    \"\"\"\n    if dy is None:\n        dy = 1\n    y, dy = np.broadcast_arrays(y, dy)\n    w = dy ** -2.0\n    if center_data or fit_mean:\n        mu = np.dot(w, y) / w.sum()\n    else:\n        mu = 0\n    yw = (y - mu) / dy\n    return np.dot(yw, yw)\n\n\ndef convert_normalization(Z, N, from_normalization, to_normalization,\n                          chi2_ref=None):\n    \"\"\"Convert power from one normalization to another.\n\n    This currently only works for standard & floating-mean models.\n\n    Parameters\n    ----------\n    Z : array-like\n        the periodogram output\n    N : int\n        the number of data points\n    from_normalization, to_normalization : str\n        the normalization to convert from and to. Options are\n        ['standard', 'model', 'log', 'psd']\n    chi2_ref : float\n        The reference chi-square, required for converting to or from the\n        psd normalization.\n\n    Returns\n    -------\n    Z_out : ndarray\n        The periodogram in the new normalization\n    \"\"\"\n    Z = np.asarray(Z)\n    from_to = (from_normalization, to_normalization)\n\n    for norm in from_to:\n        if norm not in NORMALIZATIONS:\n            raise ValueError(f\"{from_normalization} is not a valid normalization\")\n\n    if from_normalization == to_normalization:\n        return Z\n\n    if \"psd\" in from_to and chi2_ref is None:\n        raise ValueError(\"must supply reference chi^2 when converting \"\n                         \"to or from psd normalization\")\n\n    if from_to == ('log', 'standard'):\n        return 1 - np.exp(-Z)\n    elif from_to == ('standard', 'log'):\n        return -np.log(1 - Z)\n    elif from_to == ('log', 'model'):\n        return np.exp(Z) - 1\n    elif from_to == ('model', 'log'):\n        return np.log(Z + 1)\n    elif from_to == ('model', 'standard'):\n        return Z / (1 + Z)\n    elif from_to == ('standard', 'model'):\n        return Z / (1 - Z)\n    elif from_normalization == \"psd\":\n        return convert_normalization(2 / chi2_ref * Z, N,\n                                     from_normalization='standard',\n                                     to_normalization=to_normalization)\n    elif to_normalization == \"psd\":\n        Z_standard = convert_normalization(Z, N,\n                                           from_normalization=from_normalization,\n                                           to_normalization='standard')\n        return 0.5 * chi2_ref * Z_standard\n    else:\n        raise NotImplementedError(\"conversion from '{}' to '{}'\"\n                                  \"\".format(from_normalization,\n                                            to_normalization))\n"},{"col":4,"comment":"Lookback time to redshift ``z``. Value in units of Hubble time.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : float or ndarray\n            Lookback time to each input redshift in Hubble time units.\n            Returns `float` if input scalar, `~numpy.ndarray` otherwise.\n        ","endLoc":919,"header":"@vectorize_redshift_method\n    def _integral_lookback_time(self, z, /)","id":14481,"name":"_integral_lookback_time","nodeType":"Function","startLoc":901,"text":"@vectorize_redshift_method\n    def _integral_lookback_time(self, z, /):\n        \"\"\"Lookback time to redshift ``z``. Value in units of Hubble time.\n\n        The lookback time is the difference between the age of the Universe now\n        and the age at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : float or ndarray\n            Lookback time to each input redshift in Hubble time units.\n            Returns `float` if input scalar, `~numpy.ndarray` otherwise.\n        \"\"\"\n        return quad(self._lookback_time_integrand_scalar, 0, z)[0]"},{"col":4,"comment":"\n        The lookback distance is the light travel time distance to a given\n        redshift. It is simply c * lookback_time. It may be used to calculate\n        the proper distance between two redshifts, e.g. for the mean free path\n        to ionizing radiation.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Lookback distance in Mpc\n        ","endLoc":938,"header":"def lookback_distance(self, z)","id":14482,"name":"lookback_distance","nodeType":"Function","startLoc":921,"text":"def lookback_distance(self, z):\n        \"\"\"\n        The lookback distance is the light travel time distance to a given\n        redshift. It is simply c * lookback_time. It may be used to calculate\n        the proper distance between two redshifts, e.g. for the mean free path\n        to ionizing radiation.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Lookback distance in Mpc\n        \"\"\"\n        return (self.lookback_time(z) * const.c).to(u.Mpc)"},{"col":0,"comment":"Compute the reference chi-square for a particular dataset.\n\n    Note: this is not valid center_data=False and fit_mean=False.\n\n    Parameters\n    ----------\n    y : array-like\n        data values\n    dy : float, array, or None, optional\n        data uncertainties\n    center_data : bool\n        specify whether data should be pre-centered\n    fit_mean : bool\n        specify whether model should fit the mean of the data\n\n    Returns\n    -------\n    chi2_ref : float\n        The reference chi-square for the periodogram of this data\n    ","endLoc":37,"header":"def compute_chi2_ref(y, dy=None, center_data=True, fit_mean=True)","id":14483,"name":"compute_chi2_ref","nodeType":"Function","startLoc":7,"text":"def compute_chi2_ref(y, dy=None, center_data=True, fit_mean=True):\n    \"\"\"Compute the reference chi-square for a particular dataset.\n\n    Note: this is not valid center_data=False and fit_mean=False.\n\n    Parameters\n    ----------\n    y : array-like\n        data values\n    dy : float, array, or None, optional\n        data uncertainties\n    center_data : bool\n        specify whether data should be pre-centered\n    fit_mean : bool\n        specify whether model should fit the mean of the data\n\n    Returns\n    -------\n    chi2_ref : float\n        The reference chi-square for the periodogram of this data\n    \"\"\"\n    if dy is None:\n        dy = 1\n    y, dy = np.broadcast_arrays(y, dy)\n    w = dy ** -2.0\n    if center_data or fit_mean:\n        mu = np.dot(w, y) / w.sum()\n    else:\n        mu = 0\n    yw = (y - mu) / dy\n    return np.dot(yw, yw)"},{"attributeType":"null","col":12,"comment":"null","endLoc":2093,"id":14484,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":2093,"text":"self._inv_efunc_scalar_args"},{"col":0,"comment":"Load `~astropy.cosmology.Cosmology` from ``mypackage`` object.\n\n    Parameters\n    ----------\n    mycosmo : `~mypackage.cosmology.MyCosmology`\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology`\n    ","endLoc":77,"header":"def from_mypackage(mycosmo)","id":14485,"name":"from_mypackage","nodeType":"Function","startLoc":36,"text":"def from_mypackage(mycosmo):\n    \"\"\"Load `~astropy.cosmology.Cosmology` from ``mypackage`` object.\n\n    Parameters\n    ----------\n    mycosmo : `~mypackage.cosmology.MyCosmology`\n\n    Returns\n    -------\n    `~astropy.cosmology.Cosmology`\n    \"\"\"\n    m = dict(mycosmo)\n    m[\"name\"] = mycosmo.name\n\n    # ----------------\n    # remap Parameters\n    m[\"H0\"] = m.pop(\"hubble_parameter\") * (u.km / u.s / u.Mpc)\n    m[\"Om0\"] = m.pop(\"initial_matter_density\")\n    m[\"Tcmb0\"] = m.pop(\"initial_temperature\") * u.K\n    # m[\"Neff\"] = m.pop(\"Neff\")  # skip b/c unchanged\n    m[\"m_nu\"] = m.pop(\"neutrino_masses\") * u.eV\n    m[\"Ob0\"] = m.pop(\"initial_baryon_density\")\n\n    # ----------------\n    # remap metadata\n    m[\"t0\"] = m.pop(\"current_age\") * u.Gyr\n\n    # optional\n    if \"reionization_redshift\" in m:\n        m[\"z_reion\"] = m.pop(\"reionization_redshift\")\n\n    # ...  # keep building `m`\n\n    # ----------------\n    # Detect which type of Astropy cosmology to build.\n    # TODO! CUSTOMIZE FOR DETECTION\n    # Here we just force FlatLambdaCDM, but if your package allows for\n    # non-flat cosmologies...\n    m[\"cosmology\"] = FlatLambdaCDM\n\n    # build cosmology\n    return Cosmology.from_format(m, format=\"mapping\", move_to_meta=True)"},{"col":4,"comment":"Age of the universe in Gyr at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to an age.\n        ","endLoc":957,"header":"def age(self, z)","id":14486,"name":"age","nodeType":"Function","startLoc":940,"text":"def age(self, z):\n        \"\"\"Age of the universe in Gyr at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to an age.\n        \"\"\"\n        return self._age(z)"},{"col":4,"comment":"Age of the universe in Gyr at redshift ``z``.\n\n        This internal function exists to be re-defined for optimizations.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n        ","endLoc":974,"header":"def _age(self, z)","id":14487,"name":"_age","nodeType":"Function","startLoc":959,"text":"def _age(self, z):\n        \"\"\"Age of the universe in Gyr at redshift ``z``.\n\n        This internal function exists to be re-defined for optimizations.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity` ['time']\n            The age of the universe in Gyr at each input redshift.\n        \"\"\"\n        return self._hubble_time * self._integral_age(z)"},{"col":0,"comment":"Convert power from one normalization to another.\n\n    This currently only works for standard & floating-mean models.\n\n    Parameters\n    ----------\n    Z : array-like\n        the periodogram output\n    N : int\n        the number of data points\n    from_normalization, to_normalization : str\n        the normalization to convert from and to. Options are\n        ['standard', 'model', 'log', 'psd']\n    chi2_ref : float\n        The reference chi-square, required for converting to or from the\n        psd normalization.\n\n    Returns\n    -------\n    Z_out : ndarray\n        The periodogram in the new normalization\n    ","endLoc":102,"header":"def convert_normalization(Z, N, from_normalization, to_normalization,\n                          chi2_ref=None)","id":14488,"name":"convert_normalization","nodeType":"Function","startLoc":40,"text":"def convert_normalization(Z, N, from_normalization, to_normalization,\n                          chi2_ref=None):\n    \"\"\"Convert power from one normalization to another.\n\n    This currently only works for standard & floating-mean models.\n\n    Parameters\n    ----------\n    Z : array-like\n        the periodogram output\n    N : int\n        the number of data points\n    from_normalization, to_normalization : str\n        the normalization to convert from and to. Options are\n        ['standard', 'model', 'log', 'psd']\n    chi2_ref : float\n        The reference chi-square, required for converting to or from the\n        psd normalization.\n\n    Returns\n    -------\n    Z_out : ndarray\n        The periodogram in the new normalization\n    \"\"\"\n    Z = np.asarray(Z)\n    from_to = (from_normalization, to_normalization)\n\n    for norm in from_to:\n        if norm not in NORMALIZATIONS:\n            raise ValueError(f\"{from_normalization} is not a valid normalization\")\n\n    if from_normalization == to_normalization:\n        return Z\n\n    if \"psd\" in from_to and chi2_ref is None:\n        raise ValueError(\"must supply reference chi^2 when converting \"\n                         \"to or from psd normalization\")\n\n    if from_to == ('log', 'standard'):\n        return 1 - np.exp(-Z)\n    elif from_to == ('standard', 'log'):\n        return -np.log(1 - Z)\n    elif from_to == ('log', 'model'):\n        return np.exp(Z) - 1\n    elif from_to == ('model', 'log'):\n        return np.log(Z + 1)\n    elif from_to == ('model', 'standard'):\n        return Z / (1 + Z)\n    elif from_to == ('standard', 'model'):\n        return Z / (1 - Z)\n    elif from_normalization == \"psd\":\n        return convert_normalization(2 / chi2_ref * Z, N,\n                                     from_normalization='standard',\n                                     to_normalization=to_normalization)\n    elif to_normalization == \"psd\":\n        Z_standard = convert_normalization(Z, N,\n                                           from_normalization=from_normalization,\n                                           to_normalization='standard')\n        return 0.5 * chi2_ref * Z_standard\n    else:\n        raise NotImplementedError(\"conversion from '{}' to '{}'\"\n                                  \"\".format(from_normalization,\n                                            to_normalization))"},{"attributeType":"null","col":0,"comment":"null","endLoc":4,"id":14489,"name":"__all__","nodeType":"Attribute","startLoc":4,"text":"__all__"},{"attributeType":"null","col":16,"comment":"null","endLoc":6,"id":14490,"name":"np","nodeType":"Attribute","startLoc":6,"text":"np"},{"col":0,"comment":"","endLoc":4,"header":"methods.py#<anonymous>","id":14491,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = [\"bls_fast\", \"bls_slow\"]"},{"fileName":"_statistics.py","filePath":"astropy/timeseries/periodograms/lombscargle","id":14492,"nodeType":"File","text":"\"\"\"\nUtilities for computing periodogram statistics.\n\nThis is an internal module; users should access this functionality via the\n``false_alarm_probability`` and ``false_alarm_level`` methods of the\n``astropy.timeseries.LombScargle`` API.\n\"\"\"\n\nfrom functools import wraps\n\nimport numpy as np\n\nfrom astropy import units as u\n\n\ndef _weighted_sum(val, dy):\n    if dy is not None:\n        return (val / dy ** 2).sum()\n    else:\n        return val.sum()\n\n\ndef _weighted_mean(val, dy):\n    if dy is None:\n        return val.mean()\n    else:\n        return _weighted_sum(val, dy) / _weighted_sum(np.ones(val.shape), dy)\n\n\ndef _weighted_var(val, dy):\n    return _weighted_mean(val ** 2, dy) - _weighted_mean(val, dy) ** 2\n\n\ndef _gamma(N):\n    from scipy.special import gammaln\n    # Note: this is closely approximated by (1 - 0.75 / N) for large N\n    return np.sqrt(2 / N) * np.exp(gammaln(N / 2) - gammaln((N - 1) / 2))\n\n\ndef vectorize_first_argument(func):\n    @wraps(func)\n    def new_func(x, *args, **kwargs):\n        x = np.asarray(x)\n        return np.array([func(xi, *args, **kwargs)\n                         for xi in x.flat]).reshape(x.shape)\n    return new_func\n\n\ndef pdf_single(z, N, normalization, dH=1, dK=3):\n    \"\"\"Probability density function for Lomb-Scargle periodogram\n\n    Compute the expected probability density function of the periodogram\n    for the null hypothesis - i.e. data consisting of Gaussian noise.\n\n    Parameters\n    ----------\n    z : array-like\n        The periodogram value.\n    N : int\n        The number of data points from which the periodogram was computed.\n    normalization : {'standard', 'model', 'log', 'psd'}\n        The periodogram normalization.\n    dH, dK : int, optional\n        The number of parameters in the null hypothesis and the model.\n\n    Returns\n    -------\n    pdf : np.ndarray\n        The expected probability density function.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n    All expressions used here are adapted from Table 1 of Baluev 2008 [1]_.\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    \"\"\"\n    z = np.asarray(z)\n    if dK - dH != 2:\n        raise NotImplementedError(\"Degrees of freedom != 2\")\n    Nk = N - dK\n\n    if normalization == 'psd':\n        return np.exp(-z)\n    elif normalization == 'standard':\n        return 0.5 * Nk * (1 - z) ** (0.5 * Nk - 1)\n    elif normalization == 'model':\n        return 0.5 * Nk * (1 + z) ** (-0.5 * Nk - 1)\n    elif normalization == 'log':\n        return 0.5 * Nk * np.exp(-0.5 * Nk * z)\n    else:\n        raise ValueError(f\"normalization='{normalization}' is not recognized\")\n\n\ndef fap_single(z, N, normalization, dH=1, dK=3):\n    \"\"\"Single-frequency false alarm probability for the Lomb-Scargle periodogram\n\n    This is equal to 1 - cdf, where cdf is the cumulative distribution.\n    The single-frequency false alarm probability should not be confused with\n    the false alarm probability for the largest peak.\n\n    Parameters\n    ----------\n    z : array-like\n        The periodogram value.\n    N : int\n        The number of data points from which the periodogram was computed.\n    normalization : {'standard', 'model', 'log', 'psd'}\n        The periodogram normalization.\n    dH, dK : int, optional\n        The number of parameters in the null hypothesis and the model.\n\n    Returns\n    -------\n    false_alarm_probability : np.ndarray\n        The single-frequency false alarm probability.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n    All expressions used here are adapted from Table 1 of Baluev 2008 [1]_.\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    \"\"\"\n    z = np.asarray(z)\n    if dK - dH != 2:\n        raise NotImplementedError(\"Degrees of freedom != 2\")\n    Nk = N - dK\n\n    if normalization == 'psd':\n        return np.exp(-z)\n    elif normalization == 'standard':\n        return (1 - z) ** (0.5 * Nk)\n    elif normalization == 'model':\n        return (1 + z) ** (-0.5 * Nk)\n    elif normalization == 'log':\n        return np.exp(-0.5 * Nk * z)\n    else:\n        raise ValueError(f\"normalization='{normalization}' is not recognized\")\n\n\ndef inv_fap_single(fap, N, normalization, dH=1, dK=3):\n    \"\"\"Single-frequency inverse false alarm probability\n\n    This function computes the periodogram value associated with the specified\n    single-frequency false alarm probability. This should not be confused with\n    the false alarm level of the largest peak.\n\n    Parameters\n    ----------\n    fap : array-like\n        The false alarm probability.\n    N : int\n        The number of data points from which the periodogram was computed.\n    normalization : {'standard', 'model', 'log', 'psd'}\n        The periodogram normalization.\n    dH, dK : int, optional\n        The number of parameters in the null hypothesis and the model.\n\n    Returns\n    -------\n    z : np.ndarray\n        The periodogram power corresponding to the single-peak false alarm\n        probability.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n    All expressions used here are adapted from Table 1 of Baluev 2008 [1]_.\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    \"\"\"\n    fap = np.asarray(fap)\n    if dK - dH != 2:\n        raise NotImplementedError(\"Degrees of freedom != 2\")\n    Nk = N - dK\n\n    # No warnings for fap = 0; rather, just let it give the right infinity.\n    with np.errstate(divide='ignore'):\n        if normalization == 'psd':\n            return -np.log(fap)\n        elif normalization == 'standard':\n            return 1 - fap ** (2 / Nk)\n        elif normalization == 'model':\n            return -1 + fap ** (-2 / Nk)\n        elif normalization == 'log':\n            return -2 / Nk * np.log(fap)\n        else:\n            raise ValueError(f\"normalization='{normalization}' is not recognized\")\n\n\ndef cdf_single(z, N, normalization, dH=1, dK=3):\n    \"\"\"Cumulative distribution for the Lomb-Scargle periodogram\n\n    Compute the expected cumulative distribution of the periodogram\n    for the null hypothesis - i.e. data consisting of Gaussian noise.\n\n    Parameters\n    ----------\n    z : array-like\n        The periodogram value.\n    N : int\n        The number of data points from which the periodogram was computed.\n    normalization : {'standard', 'model', 'log', 'psd'}\n        The periodogram normalization.\n    dH, dK : int, optional\n        The number of parameters in the null hypothesis and the model.\n\n    Returns\n    -------\n    cdf : np.ndarray\n        The expected cumulative distribution function.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n    All expressions used here are adapted from Table 1 of Baluev 2008 [1]_.\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    \"\"\"\n    return 1 - fap_single(z, N, normalization=normalization, dH=dH, dK=dK)\n\n\ndef tau_davies(Z, fmax, t, y, dy, normalization='standard', dH=1, dK=3):\n    \"\"\"tau factor for estimating Davies bound (Baluev 2008, Table 1)\"\"\"\n    N = len(t)\n    NH = N - dH  # DOF for null hypothesis\n    NK = N - dK  # DOF for periodic hypothesis\n    Dt = _weighted_var(t, dy)\n    Teff = np.sqrt(4 * np.pi * Dt)  # Effective baseline\n    W = fmax * Teff\n    Z = np.asarray(Z)\n    if normalization == 'psd':\n        # 'psd' normalization is same as Baluev's z\n        return W * np.exp(-Z) * np.sqrt(Z)\n    elif normalization == 'standard':\n        # 'standard' normalization is Z = 2/NH * z_1\n        return (_gamma(NH) * W * (1 - Z) ** (0.5 * (NK - 1))\n                * np.sqrt(0.5 * NH * Z))\n    elif normalization == 'model':\n        # 'model' normalization is Z = 2/NK * z_2\n        return (_gamma(NK) * W * (1 + Z) ** (-0.5 * NK)\n                * np.sqrt(0.5 * NK * Z))\n    elif normalization == 'log':\n        # 'log' normalization is Z = 2/NK * z_3\n        return (_gamma(NK) * W * np.exp(-0.5 * Z * (NK - 0.5))\n                * np.sqrt(NK * np.sinh(0.5 * Z)))\n    else:\n        raise NotImplementedError(f\"normalization={normalization}\")\n\n\ndef fap_naive(Z, fmax, t, y, dy, normalization='standard'):\n    \"\"\"False Alarm Probability based on estimated number of indep frequencies\"\"\"\n    N = len(t)\n    T = max(t) - min(t)\n    N_eff = fmax * T\n    fap_s = fap_single(Z, N, normalization=normalization)\n    # result is 1 - (1 - fap_s) ** N_eff\n    # this is much more precise for small Z / large N\n    # Ignore divide by zero no np.log1p - fine to let it return -inf.\n    with np.errstate(divide='ignore'):\n        return -np.expm1(N_eff * np.log1p(-fap_s))\n\n\ndef inv_fap_naive(fap, fmax, t, y, dy, normalization='standard'):\n    \"\"\"Inverse FAP based on estimated number of indep frequencies\"\"\"\n    fap = np.asarray(fap)\n    N = len(t)\n    T = max(t) - min(t)\n    N_eff = fmax * T\n    # fap_s = 1 - (1 - fap) ** (1 / N_eff)\n    # Ignore divide by zero no np.log - fine to let it return -inf.\n    with np.errstate(divide='ignore'):\n        fap_s = -np.expm1(np.log(1 - fap) / N_eff)\n    return inv_fap_single(fap_s, N, normalization)\n\n\ndef fap_davies(Z, fmax, t, y, dy, normalization='standard'):\n    \"\"\"Davies upper-bound to the false alarm probability\n\n    (Eqn 5 of Baluev 2008)\n    \"\"\"\n    N = len(t)\n    fap_s = fap_single(Z, N, normalization=normalization)\n    tau = tau_davies(Z, fmax, t, y, dy, normalization=normalization)\n    return fap_s + tau\n\n\n@vectorize_first_argument\ndef inv_fap_davies(p, fmax, t, y, dy, normalization='standard'):\n    \"\"\"Inverse of the davies upper-bound\"\"\"\n    from scipy import optimize\n    args = (fmax, t, y, dy, normalization)\n    z0 = inv_fap_naive(p, *args)\n    func = lambda z, *args: fap_davies(z, *args) - p\n    res = optimize.root(func, z0, args=args, method='lm')\n    if not res.success:\n        raise ValueError(f'inv_fap_baluev did not converge for p={p}')\n    return res.x\n\n\ndef fap_baluev(Z, fmax, t, y, dy, normalization='standard'):\n    \"\"\"Alias-free approximation to false alarm probability\n\n    (Eqn 6 of Baluev 2008)\n    \"\"\"\n    fap_s = fap_single(Z, len(t), normalization)\n    tau = tau_davies(Z, fmax, t, y, dy, normalization=normalization)\n    # result is 1 - (1 - fap_s) * np.exp(-tau)\n    # this is much more precise for small numbers\n    return -np.expm1(-tau) + fap_s * np.exp(-tau)\n\n\n@vectorize_first_argument\ndef inv_fap_baluev(p, fmax, t, y, dy, normalization='standard'):\n    \"\"\"Inverse of the Baluev alias-free approximation\"\"\"\n    from scipy import optimize\n    args = (fmax, t, y, dy, normalization)\n    z0 = inv_fap_naive(p, *args)\n    func = lambda z, *args: fap_baluev(z, *args) - p\n    res = optimize.root(func, z0, args=args, method='lm')\n    if not res.success:\n        raise ValueError(f'inv_fap_baluev did not converge for p={p}')\n    return res.x\n\n\ndef _bootstrap_max(t, y, dy, fmax, normalization, random_seed, n_bootstrap=1000):\n    \"\"\"Generate a sequence of bootstrap estimates of the max\"\"\"\n    from .core import LombScargle\n    rng = np.random.default_rng(random_seed)\n    power_max = []\n    for _ in range(n_bootstrap):\n        s = rng.integers(0, len(y), len(y))  # sample with replacement\n        ls_boot = LombScargle(t, y[s], dy if dy is None else dy[s],\n                              normalization=normalization)\n        freq, power = ls_boot.autopower(maximum_frequency=fmax)\n        power_max.append(power.max())\n\n    power_max = u.Quantity(power_max)\n    power_max.sort()\n\n    return power_max\n\n\ndef fap_bootstrap(Z, fmax, t, y, dy, normalization='standard',\n                  n_bootstraps=1000, random_seed=None):\n    \"\"\"Bootstrap estimate of the false alarm probability\"\"\"\n    pmax = _bootstrap_max(t, y, dy, fmax, normalization, random_seed,\n                          n_bootstraps)\n\n    return 1 - np.searchsorted(pmax, Z) / len(pmax)\n\n\ndef inv_fap_bootstrap(fap, fmax, t, y, dy, normalization='standard',\n                      n_bootstraps=1000, random_seed=None):\n    \"\"\"Bootstrap estimate of the inverse false alarm probability\"\"\"\n    fap = np.asarray(fap)\n    pmax = _bootstrap_max(t, y, dy, fmax, normalization, random_seed,\n                          n_bootstraps)\n\n    return pmax[np.clip(np.floor((1 - fap) * len(pmax)).astype(int),\n                        0, len(pmax) - 1)]\n\n\nMETHODS = {'single': fap_single,\n           'naive': fap_naive,\n           'davies': fap_davies,\n           'baluev': fap_baluev,\n           'bootstrap': fap_bootstrap}\n\n\ndef false_alarm_probability(Z, fmax, t, y, dy, normalization='standard',\n                            method='baluev', method_kwds=None):\n    \"\"\"Compute the approximate false alarm probability for periodogram peaks Z\n\n    This gives an estimate of the false alarm probability for the largest value\n    in a periodogram, based on the null hypothesis of non-varying data with\n    Gaussian noise. The true probability cannot be computed analytically, so\n    each method available here is an approximation to the true value.\n\n    Parameters\n    ----------\n    Z : array-like\n        The periodogram value.\n    fmax : float\n        The maximum frequency of the periodogram.\n    t, y, dy : array-like\n        The data times, values, and errors.\n    normalization : {'standard', 'model', 'log', 'psd'}, optional\n        The periodogram normalization.\n    method : {'baluev', 'davies', 'naive', 'bootstrap'}, optional\n        The approximation method to use.\n    method_kwds : dict, optional\n        Additional method-specific keywords.\n\n    Returns\n    -------\n    false_alarm_probability : np.ndarray\n        The false alarm probability.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n\n    See Also\n    --------\n    false_alarm_level : compute the periodogram level for a particular fap\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    \"\"\"\n    if method == 'single':\n        return fap_single(Z, len(t), normalization)\n    elif method not in METHODS:\n        raise ValueError(f\"Unrecognized method: {method}\")\n    method = METHODS[method]\n    method_kwds = method_kwds or {}\n\n    return method(Z, fmax, t, y, dy, normalization, **method_kwds)\n\n\nINV_METHODS = {'single': inv_fap_single,\n               'naive': inv_fap_naive,\n               'davies': inv_fap_davies,\n               'baluev': inv_fap_baluev,\n               'bootstrap': inv_fap_bootstrap}\n\n\ndef false_alarm_level(p, fmax, t, y, dy, normalization,\n                      method='baluev', method_kwds=None):\n    \"\"\"Compute the approximate periodogram level given a false alarm probability\n\n    This gives an estimate of the periodogram level corresponding to a specified\n    false alarm probability for the largest peak, assuming a null hypothesis\n    of non-varying data with Gaussian noise. The true level cannot be computed\n    analytically, so each method available here is an approximation to the true\n    value.\n\n    Parameters\n    ----------\n    p : array-like\n        The false alarm probability (0 < p < 1).\n    fmax : float\n        The maximum frequency of the periodogram.\n    t, y, dy : arrays\n        The data times, values, and errors.\n    normalization : {'standard', 'model', 'log', 'psd'}, optional\n        The periodogram normalization.\n    method : {'baluev', 'davies', 'naive', 'bootstrap'}, optional\n        The approximation method to use.\n    method_kwds : dict, optional\n        Additional method-specific keywords.\n\n    Returns\n    -------\n    z : np.ndarray\n        The periodogram level.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n\n    See Also\n    --------\n    false_alarm_probability : compute the fap for a given periodogram level\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    \"\"\"\n    if method == 'single':\n        return inv_fap_single(p, len(t), normalization)\n    elif method not in INV_METHODS:\n        raise ValueError(f\"Unrecognized method: {method}\")\n    method = INV_METHODS[method]\n    method_kwds = method_kwds or {}\n\n    return method(p, fmax, t, y, dy, normalization, **method_kwds)\n"},{"col":0,"comment":"null","endLoc":20,"header":"def _weighted_sum(val, dy)","id":14493,"name":"_weighted_sum","nodeType":"Function","startLoc":16,"text":"def _weighted_sum(val, dy):\n    if dy is not None:\n        return (val / dy ** 2).sum()\n    else:\n        return val.sum()"},{"attributeType":"null","col":16,"comment":"null","endLoc":1,"id":14494,"name":"np","nodeType":"Attribute","startLoc":1,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":4,"id":14495,"name":"NORMALIZATIONS","nodeType":"Attribute","startLoc":4,"text":"NORMALIZATIONS"},{"col":0,"comment":"","endLoc":1,"header":"utils.py#<anonymous>","id":14496,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"NORMALIZATIONS = ['standard', 'psd', 'model', 'log']"},{"fileName":"__init__.py","filePath":"astropy/timeseries/periodograms/lombscargle","id":14497,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nlombscargle\n===========\nAstroPy-compatible implementation of the Lomb-Scargle periodogram.\n\"\"\"\nfrom .core import LombScargle\n"},{"col":4,"comment":"Age of the universe at redshift ``z``. Value in units of Hubble time.\n\n        Calculated using explicit integration.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : float or ndarray\n            The age of the universe at each input redshift in Hubble time units.\n            Returns `float` if input scalar, `~numpy.ndarray` otherwise.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to an age.\n        ","endLoc":997,"header":"@vectorize_redshift_method\n    def _integral_age(self, z, /)","id":14498,"name":"_integral_age","nodeType":"Function","startLoc":976,"text":"@vectorize_redshift_method\n    def _integral_age(self, z, /):\n        \"\"\"Age of the universe at redshift ``z``. Value in units of Hubble time.\n\n        Calculated using explicit integration.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        t : float or ndarray\n            The age of the universe at each input redshift in Hubble time units.\n            Returns `float` if input scalar, `~numpy.ndarray` otherwise.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to an age.\n        \"\"\"\n        return quad(self._lookback_time_integrand_scalar, z, np.inf)[0]"},{"col":0,"comment":"null","endLoc":27,"header":"def _weighted_mean(val, dy)","id":14499,"name":"_weighted_mean","nodeType":"Function","startLoc":23,"text":"def _weighted_mean(val, dy):\n    if dy is None:\n        return val.mean()\n    else:\n        return _weighted_sum(val, dy) / _weighted_sum(np.ones(val.shape), dy)"},{"col":0,"comment":"","endLoc":7,"header":"__init__.py#<anonymous>","id":14500,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nlombscargle\n===========\nAstroPy-compatible implementation of the Lomb-Scargle periodogram.\n\"\"\""},{"col":4,"comment":"Critical density in grams per cubic cm at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        rho : `~astropy.units.Quantity`\n            Critical density in g/cm^3 at each input redshift.\n        ","endLoc":1013,"header":"def critical_density(self, z)","id":14501,"name":"critical_density","nodeType":"Function","startLoc":999,"text":"def critical_density(self, z):\n        \"\"\"Critical density in grams per cubic cm at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        rho : `~astropy.units.Quantity`\n            Critical density in g/cm^3 at each input redshift.\n        \"\"\"\n\n        return self._critical_density0 * (self.efunc(z)) ** 2"},{"fileName":"core.py","filePath":"astropy/timeseries/periodograms/lombscargle","id":14502,"nodeType":"File","text":"\"\"\"Main Lomb-Scargle Implementation\"\"\"\n\nimport numpy as np\n\nfrom .implementations import lombscargle, available_methods\nfrom .implementations.mle import periodic_fit, design_matrix\nfrom . import _statistics\nfrom astropy import units\nfrom astropy.time import Time, TimeDelta\nfrom astropy import units as u\nfrom astropy.timeseries.periodograms.base import BasePeriodogram\n\n\ndef has_units(obj):\n    return hasattr(obj, 'unit')\n\n\ndef get_unit(obj):\n    return getattr(obj, 'unit', 1)\n\n\ndef strip_units(*arrs):\n    strip = lambda a: None if a is None else np.asarray(a)\n    if len(arrs) == 1:\n        return strip(arrs[0])\n    else:\n        return map(strip, arrs)\n\n\nclass LombScargle(BasePeriodogram):\n    \"\"\"Compute the Lomb-Scargle Periodogram.\n\n    This implementations here are based on code presented in [1]_ and [2]_;\n    if you use this functionality in an academic application, citation of\n    those works would be appreciated.\n\n    Parameters\n    ----------\n    t : array-like or `~astropy.units.Quantity` ['time']\n        sequence of observation times\n    y : array-like or `~astropy.units.Quantity`\n        sequence of observations associated with times t\n    dy : float, array-like, or `~astropy.units.Quantity`, optional\n        error or sequence of observational errors associated with times t\n    fit_mean : bool, optional\n        if True, include a constant offset as part of the model at each\n        frequency. This can lead to more accurate results, especially in the\n        case of incomplete phase coverage.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data. This is especially important if fit_mean = False\n    nterms : int, optional\n        number of terms to use in the Fourier fit\n    normalization : {'standard', 'model', 'log', 'psd'}, optional\n        Normalization to use for the periodogram.\n\n    Examples\n    --------\n    Generate noisy periodic data:\n\n    >>> rand = np.random.default_rng(42)\n    >>> t = 100 * rand.random(100)\n    >>> y = np.sin(2 * np.pi * t) + rand.standard_normal(100)\n\n    Compute the Lomb-Scargle periodogram on an automatically-determined\n    frequency grid & find the frequency of max power:\n\n    >>> frequency, power = LombScargle(t, y).autopower()\n    >>> frequency[np.argmax(power)]  # doctest: +FLOAT_CMP\n    1.0007641728995051\n\n    Compute the Lomb-Scargle periodogram at a user-specified frequency grid:\n\n    >>> freq = np.arange(0.8, 1.3, 0.1)\n    >>> LombScargle(t, y).power(freq)  # doctest: +FLOAT_CMP\n    array([0.0792948 , 0.01778874, 0.25328167, 0.01064157, 0.01471387])\n\n    If the inputs are astropy Quantities with units, the units will be\n    validated and the outputs will also be Quantities with appropriate units:\n\n    >>> from astropy import units as u\n    >>> t = t * u.s\n    >>> y = y * u.mag\n    >>> frequency, power = LombScargle(t, y).autopower()\n    >>> frequency.unit\n    Unit(\"1 / s\")\n    >>> power.unit\n    Unit(dimensionless)\n\n    Note here that the Lomb-Scargle power is always a unitless quantity,\n    because it is related to the :math:`\\\\chi^2` of the best-fit periodic\n    model at each frequency.\n\n    References\n    ----------\n    .. [1] Vanderplas, J., Connolly, A. Ivezic, Z. & Gray, A. *Introduction to\n        astroML: Machine learning for astrophysics*. Proceedings of the\n        Conference on Intelligent Data Understanding (2012)\n    .. [2] VanderPlas, J. & Ivezic, Z. *Periodograms for Multiband Astronomical\n        Time Series*. ApJ 812.1:18 (2015)\n    \"\"\"\n    available_methods = available_methods()\n\n    def __init__(self, t, y, dy=None, fit_mean=True, center_data=True,\n                 nterms=1, normalization='standard'):\n\n        # If t is a TimeDelta, convert it to a quantity. The units we convert\n        # to don't really matter since the user gets a Quantity back at the end\n        # so can convert to any units they like.\n        if isinstance(t, TimeDelta):\n            t = t.to('day')\n\n        # We want to expose self.t as being the times the user passed in, but\n        # if the times are absolute, we need to convert them to relative times\n        # internally, so we use self._trel and self._tstart for this.\n\n        self.t = t\n\n        if isinstance(self.t, Time):\n            self._tstart = self.t[0]\n            trel = (self.t - self._tstart).to(u.day)\n        else:\n            self._tstart = None\n            trel = self.t\n\n        self._trel, self.y, self.dy = self._validate_inputs(trel, y, dy)\n\n        self.fit_mean = fit_mean\n        self.center_data = center_data\n        self.nterms = nterms\n        self.normalization = normalization\n\n    def _validate_inputs(self, t, y, dy):\n        # Validate shapes of inputs\n        if dy is None:\n            t, y = np.broadcast_arrays(t, y, subok=True)\n        else:\n            t, y, dy = np.broadcast_arrays(t, y, dy, subok=True)\n        if t.ndim != 1:\n            raise ValueError(\"Inputs (t, y, dy) must be 1-dimensional\")\n\n        # validate units of inputs if any is a Quantity\n        if any(has_units(arr) for arr in (t, y, dy)):\n            t, y = map(units.Quantity, (t, y))\n            if dy is not None:\n                dy = units.Quantity(dy)\n                try:\n                    dy = units.Quantity(dy, unit=y.unit)\n                except units.UnitConversionError:\n                    raise ValueError(\"Units of dy not equivalent \"\n                                     \"to units of y\")\n        return t, y, dy\n\n    def _validate_frequency(self, frequency):\n        frequency = np.asanyarray(frequency)\n\n        if has_units(self._trel):\n            frequency = units.Quantity(frequency)\n            try:\n                frequency = units.Quantity(frequency, unit=1./self._trel.unit)\n            except units.UnitConversionError:\n                raise ValueError(\"Units of frequency not equivalent to \"\n                                 \"units of 1/t\")\n        else:\n            if has_units(frequency):\n                raise ValueError(\"frequency have units while 1/t doesn't.\")\n        return frequency\n\n    def _validate_t(self, t):\n        t = np.asanyarray(t)\n\n        if has_units(self._trel):\n            t = units.Quantity(t)\n            try:\n                t = units.Quantity(t, unit=self._trel.unit)\n            except units.UnitConversionError:\n                raise ValueError(\"Units of t not equivalent to \"\n                                 \"units of input self.t\")\n        return t\n\n    def _power_unit(self, norm):\n        if has_units(self.y):\n            if self.dy is None and norm == 'psd':\n                return self.y.unit ** 2\n            else:\n                return units.dimensionless_unscaled\n        else:\n            return 1\n\n    def autofrequency(self, samples_per_peak=5, nyquist_factor=5,\n                      minimum_frequency=None, maximum_frequency=None,\n                      return_freq_limits=False):\n        \"\"\"Determine a suitable frequency grid for data.\n\n        Note that this assumes the peak width is driven by the observational\n        baseline, which is generally a good assumption when the baseline is\n        much larger than the oscillation period.\n        If you are searching for periods longer than the baseline of your\n        observations, this may not perform well.\n\n        Even with a large baseline, be aware that the maximum frequency\n        returned is based on the concept of \"average Nyquist frequency\", which\n        may not be useful for irregularly-sampled data. The maximum frequency\n        can be adjusted via the nyquist_factor argument, or through the\n        maximum_frequency argument.\n\n        Parameters\n        ----------\n        samples_per_peak : float, optional\n            The approximate number of desired samples across the typical peak\n        nyquist_factor : float, optional\n            The multiple of the average nyquist frequency used to choose the\n            maximum frequency if maximum_frequency is not provided.\n        minimum_frequency : float, optional\n            If specified, then use this minimum frequency rather than one\n            chosen based on the size of the baseline.\n        maximum_frequency : float, optional\n            If specified, then use this maximum frequency rather than one\n            chosen based on the average nyquist frequency.\n        return_freq_limits : bool, optional\n            if True, return only the frequency limits rather than the full\n            frequency grid.\n\n        Returns\n        -------\n        frequency : ndarray or `~astropy.units.Quantity` ['frequency']\n            The heuristically-determined optimal frequency bin\n        \"\"\"\n        baseline = self._trel.max() - self._trel.min()\n        n_samples = self._trel.size\n\n        df = 1.0 / baseline / samples_per_peak\n\n        if minimum_frequency is None:\n            minimum_frequency = 0.5 * df\n\n        if maximum_frequency is None:\n            avg_nyquist = 0.5 * n_samples / baseline\n            maximum_frequency = nyquist_factor * avg_nyquist\n\n        Nf = 1 + int(np.round((maximum_frequency - minimum_frequency) / df))\n\n        if return_freq_limits:\n            return minimum_frequency, minimum_frequency + df * (Nf - 1)\n        else:\n            return minimum_frequency + df * np.arange(Nf)\n\n    def autopower(self, method='auto', method_kwds=None,\n                  normalization=None, samples_per_peak=5,\n                  nyquist_factor=5, minimum_frequency=None,\n                  maximum_frequency=None):\n        \"\"\"Compute Lomb-Scargle power at automatically-determined frequencies.\n\n        Parameters\n        ----------\n        method : str, optional\n            specify the lomb scargle implementation to use. Options are:\n\n            - 'auto': choose the best method based on the input\n            - 'fast': use the O[N log N] fast method. Note that this requires\n              evenly-spaced frequencies: by default this will be checked unless\n              ``assume_regular_frequency`` is set to True.\n            - 'slow': use the O[N^2] pure-python implementation\n            - 'cython': use the O[N^2] cython implementation. This is slightly\n              faster than method='slow', but much more memory efficient.\n            - 'chi2': use the O[N^2] chi2/linear-fitting implementation\n            - 'fastchi2': use the O[N log N] chi2 implementation. Note that this\n              requires evenly-spaced frequencies: by default this will be checked\n              unless ``assume_regular_frequency`` is set to True.\n            - 'scipy': use ``scipy.signal.lombscargle``, which is an O[N^2]\n              implementation written in C. Note that this does not support\n              heteroskedastic errors.\n\n        method_kwds : dict, optional\n            additional keywords to pass to the lomb-scargle method\n        normalization : {'standard', 'model', 'log', 'psd'}, optional\n            If specified, override the normalization specified at instantiation.\n        samples_per_peak : float, optional\n            The approximate number of desired samples across the typical peak\n        nyquist_factor : float, optional\n            The multiple of the average nyquist frequency used to choose the\n            maximum frequency if maximum_frequency is not provided.\n        minimum_frequency : float or `~astropy.units.Quantity` ['frequency'], optional\n            If specified, then use this minimum frequency rather than one\n            chosen based on the size of the baseline. Should be `~astropy.units.Quantity`\n            if inputs to LombScargle are `~astropy.units.Quantity`.\n        maximum_frequency : float or `~astropy.units.Quantity` ['frequency'], optional\n            If specified, then use this maximum frequency rather than one\n            chosen based on the average nyquist frequency. Should be `~astropy.units.Quantity`\n            if inputs to LombScargle are `~astropy.units.Quantity`.\n\n        Returns\n        -------\n        frequency, power : ndarray\n            The frequency and Lomb-Scargle power\n        \"\"\"\n        frequency = self.autofrequency(samples_per_peak=samples_per_peak,\n                                       nyquist_factor=nyquist_factor,\n                                       minimum_frequency=minimum_frequency,\n                                       maximum_frequency=maximum_frequency)\n        power = self.power(frequency,\n                           normalization=normalization,\n                           method=method, method_kwds=method_kwds,\n                           assume_regular_frequency=True)\n        return frequency, power\n\n    def power(self, frequency, normalization=None, method='auto',\n              assume_regular_frequency=False, method_kwds=None):\n        \"\"\"Compute the Lomb-Scargle power at the given frequencies.\n\n        Parameters\n        ----------\n        frequency : array-like or `~astropy.units.Quantity` ['frequency']\n            frequencies (not angular frequencies) at which to evaluate the\n            periodogram. Note that in order to use method='fast', frequencies\n            must be regularly-spaced.\n        method : str, optional\n            specify the lomb scargle implementation to use. Options are:\n\n            - 'auto': choose the best method based on the input\n            - 'fast': use the O[N log N] fast method. Note that this requires\n              evenly-spaced frequencies: by default this will be checked unless\n              ``assume_regular_frequency`` is set to True.\n            - 'slow': use the O[N^2] pure-python implementation\n            - 'cython': use the O[N^2] cython implementation. This is slightly\n              faster than method='slow', but much more memory efficient.\n            - 'chi2': use the O[N^2] chi2/linear-fitting implementation\n            - 'fastchi2': use the O[N log N] chi2 implementation. Note that this\n              requires evenly-spaced frequencies: by default this will be checked\n              unless ``assume_regular_frequency`` is set to True.\n            - 'scipy': use ``scipy.signal.lombscargle``, which is an O[N^2]\n              implementation written in C. Note that this does not support\n              heteroskedastic errors.\n\n        assume_regular_frequency : bool, optional\n            if True, assume that the input frequency is of the form\n            freq = f0 + df * np.arange(N). Only referenced if method is 'auto'\n            or 'fast'.\n        normalization : {'standard', 'model', 'log', 'psd'}, optional\n            If specified, override the normalization specified at instantiation.\n        fit_mean : bool, optional\n            If True, include a constant offset as part of the model at each\n            frequency. This can lead to more accurate results, especially in\n            the case of incomplete phase coverage.\n        center_data : bool, optional\n            If True, pre-center the data by subtracting the weighted mean of\n            the input data. This is especially important if fit_mean = False.\n        method_kwds : dict, optional\n            additional keywords to pass to the lomb-scargle method\n\n        Returns\n        -------\n        power : ndarray\n            The Lomb-Scargle power at the specified frequency\n        \"\"\"\n        if normalization is None:\n            normalization = self.normalization\n        frequency = self._validate_frequency(frequency)\n        power = lombscargle(*strip_units(self._trel, self.y, self.dy),\n                            frequency=strip_units(frequency),\n                            center_data=self.center_data,\n                            fit_mean=self.fit_mean,\n                            nterms=self.nterms,\n                            normalization=normalization,\n                            method=method, method_kwds=method_kwds,\n                            assume_regular_frequency=assume_regular_frequency)\n        return power * self._power_unit(normalization)\n\n    def _as_relative_time(self, name, times):\n        \"\"\"\n        Convert the provided times (if absolute) to relative times using the\n        current _tstart value. If the times provided are relative, they are\n        returned without conversion (though we still do some checks).\n        \"\"\"\n\n        if isinstance(times, TimeDelta):\n            times = times.to('day')\n\n        if self._tstart is None:\n            if isinstance(times, Time):\n                raise TypeError('{} was provided as an absolute time but '\n                                'the LombScargle class was initialized '\n                                'with relative times.'.format(name))\n        else:\n            if isinstance(times, Time):\n                times = (times - self._tstart).to(u.day)\n            else:\n                raise TypeError('{} was provided as a relative time but '\n                                'the LombScargle class was initialized '\n                                'with absolute times.'.format(name))\n\n        return times\n\n    def model(self, t, frequency):\n        \"\"\"Compute the Lomb-Scargle model at the given frequency.\n\n        The model at a particular frequency is a linear model:\n        model = offset + dot(design_matrix, model_parameters)\n\n        Parameters\n        ----------\n        t : array-like or `~astropy.units.Quantity` ['time']\n            Times (length ``n_samples``) at which to compute the model.\n        frequency : float\n            the frequency for the model\n\n        Returns\n        -------\n        y : np.ndarray\n            The model fit corresponding to the input times\n            (will have length ``n_samples``).\n\n        See Also\n        --------\n        design_matrix\n        offset\n        model_parameters\n        \"\"\"\n        frequency = self._validate_frequency(frequency)\n        t = self._validate_t(self._as_relative_time('t', t))\n        y_fit = periodic_fit(*strip_units(self._trel, self.y, self.dy),\n                             frequency=strip_units(frequency),\n                             t_fit=strip_units(t),\n                             center_data=self.center_data,\n                             fit_mean=self.fit_mean,\n                             nterms=self.nterms)\n        return y_fit * get_unit(self.y)\n\n    def offset(self):\n        \"\"\"Return the offset of the model\n\n        The offset of the model is the (weighted) mean of the y values.\n        Note that if self.center_data is False, the offset is 0 by definition.\n\n        Returns\n        -------\n        offset : scalar\n\n        See Also\n        --------\n        design_matrix\n        model\n        model_parameters\n        \"\"\"\n        y, dy = strip_units(self.y, self.dy)\n        if dy is None:\n            dy = 1\n        dy = np.broadcast_to(dy, y.shape)\n        if self.center_data:\n            w = dy ** -2.0\n            y_mean = np.dot(y, w) / w.sum()\n        else:\n            y_mean = 0\n        return y_mean * get_unit(self.y)\n\n    def model_parameters(self, frequency, units=True):\n        r\"\"\"Compute the best-fit model parameters at the given frequency.\n\n        The model described by these parameters is:\n\n        .. math::\n\n            y(t; f, \\vec{\\theta}) = \\theta_0 + \\sum_{n=1}^{\\tt nterms} [\\theta_{2n-1}\\sin(2\\pi n f t) + \\theta_{2n}\\cos(2\\pi n f t)]\n\n        where :math:`\\vec{\\theta}` is the array of parameters returned by this function.\n\n        Parameters\n        ----------\n        frequency : float\n            the frequency for the model\n        units : bool\n            If True (default), return design matrix with data units.\n\n        Returns\n        -------\n        theta : np.ndarray (n_parameters,)\n            The best-fit model parameters at the given frequency.\n\n        See Also\n        --------\n        design_matrix\n        model\n        offset\n        \"\"\"\n        frequency = self._validate_frequency(frequency)\n        t, y, dy = strip_units(self._trel, self.y, self.dy)\n\n        if self.center_data:\n            y = y - strip_units(self.offset())\n\n        dy = np.ones_like(y) if dy is None else np.asarray(dy)\n        X = self.design_matrix(frequency)\n        parameters = np.linalg.solve(np.dot(X.T, X),\n                                     np.dot(X.T, y / dy))\n        if units:\n            parameters = get_unit(self.y) * parameters\n        return parameters\n\n    def design_matrix(self, frequency, t=None):\n        \"\"\"Compute the design matrix for a given frequency\n\n        Parameters\n        ----------\n        frequency : float\n            the frequency for the model\n        t : array-like, `~astropy.units.Quantity`, or `~astropy.time.Time` (optional)\n            Times (length ``n_samples``) at which to compute the model.\n            If not specified, then the times and uncertainties of the input\n            data are used.\n\n        Returns\n        -------\n        X : array\n            The design matrix for the model at the given frequency.\n            This should have a shape of (``len(t)``, ``n_parameters``).\n\n        See Also\n        --------\n        model\n        model_parameters\n        offset\n        \"\"\"\n        if t is None:\n            t, dy = strip_units(self._trel, self.dy)\n        else:\n            t, dy = strip_units(self._validate_t(self._as_relative_time('t', t)), None)\n        return design_matrix(t, frequency, dy,\n                             nterms=self.nterms,\n                             bias=self.fit_mean)\n\n    def distribution(self, power, cumulative=False):\n        \"\"\"Expected periodogram distribution under the null hypothesis.\n\n        This computes the expected probability distribution or cumulative\n        probability distribution of periodogram power, under the null\n        hypothesis of a non-varying signal with Gaussian noise. Note that\n        this is not the same as the expected distribution of peak values;\n        for that see the ``false_alarm_probability()`` method.\n\n        Parameters\n        ----------\n        power : array-like\n            The periodogram power at which to compute the distribution.\n        cumulative : bool, optional\n            If True, then return the cumulative distribution.\n\n        See Also\n        --------\n        false_alarm_probability\n        false_alarm_level\n\n        Returns\n        -------\n        dist : np.ndarray\n            The probability density or cumulative probability associated with\n            the provided powers.\n        \"\"\"\n        dH = 1 if self.fit_mean or self.center_data else 0\n        dK = dH + 2 * self.nterms\n        dist = _statistics.cdf_single if cumulative else _statistics.pdf_single\n        return dist(power, len(self._trel), self.normalization, dH=dH, dK=dK)\n\n    def false_alarm_probability(self, power, method='baluev',\n                                samples_per_peak=5, nyquist_factor=5,\n                                minimum_frequency=None, maximum_frequency=None,\n                                method_kwds=None):\n        \"\"\"False alarm probability of periodogram maxima under the null hypothesis.\n\n        This gives an estimate of the false alarm probability given the height\n        of the largest peak in the periodogram, based on the null hypothesis\n        of non-varying data with Gaussian noise.\n\n        Parameters\n        ----------\n        power : array-like\n            The periodogram value.\n        method : {'baluev', 'davies', 'naive', 'bootstrap'}, optional\n            The approximation method to use.\n        maximum_frequency : float\n            The maximum frequency of the periodogram.\n        method_kwds : dict, optional\n            Additional method-specific keywords.\n\n        Returns\n        -------\n        false_alarm_probability : np.ndarray\n            The false alarm probability\n\n        Notes\n        -----\n        The true probability distribution for the largest peak cannot be\n        determined analytically, so each method here provides an approximation\n        to the value. The available methods are:\n\n        - \"baluev\" (default): the upper-limit to the alias-free probability,\n          using the approach of Baluev (2008) [1]_.\n        - \"davies\" : the Davies upper bound from Baluev (2008) [1]_.\n        - \"naive\" : the approximate probability based on an estimated\n          effective number of independent frequencies.\n        - \"bootstrap\" : the approximate probability based on bootstrap\n          resamplings of the input data.\n\n        Note also that for normalization='psd', the distribution can only be\n        computed for periodograms constructed with errors specified.\n\n        See Also\n        --------\n        distribution\n        false_alarm_level\n\n        References\n        ----------\n        .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n        \"\"\"\n        if self.nterms != 1:\n            raise NotImplementedError(\"false alarm probability is not \"\n                                      \"implemented for multiterm periodograms.\")\n        if not (self.fit_mean or self.center_data):\n            raise NotImplementedError(\"false alarm probability is implemented \"\n                                      \"only for periodograms of centered data.\")\n\n        fmin, fmax = self.autofrequency(samples_per_peak=samples_per_peak,\n                                        nyquist_factor=nyquist_factor,\n                                        minimum_frequency=minimum_frequency,\n                                        maximum_frequency=maximum_frequency,\n                                        return_freq_limits=True)\n        return _statistics.false_alarm_probability(power,\n                                                   fmax=fmax,\n                                                   t=self._trel, y=self.y, dy=self.dy,\n                                                   normalization=self.normalization,\n                                                   method=method,\n                                                   method_kwds=method_kwds)\n\n    def false_alarm_level(self, false_alarm_probability, method='baluev',\n                          samples_per_peak=5, nyquist_factor=5,\n                          minimum_frequency=None, maximum_frequency=None,\n                          method_kwds=None):\n        \"\"\"Level of maximum at a given false alarm probability.\n\n        This gives an estimate of the periodogram level corresponding to a\n        specified false alarm probability for the largest peak, assuming a\n        null hypothesis of non-varying data with Gaussian noise.\n\n        Parameters\n        ----------\n        false_alarm_probability : array-like\n            The false alarm probability (0 < fap < 1).\n        maximum_frequency : float\n            The maximum frequency of the periodogram.\n        method : {'baluev', 'davies', 'naive', 'bootstrap'}, optional\n            The approximation method to use; default='baluev'.\n        method_kwds : dict, optional\n            Additional method-specific keywords.\n\n        Returns\n        -------\n        power : np.ndarray\n            The periodogram peak height corresponding to the specified\n            false alarm probability.\n\n        Notes\n        -----\n        The true probability distribution for the largest peak cannot be\n        determined analytically, so each method here provides an approximation\n        to the value. The available methods are:\n\n        - \"baluev\" (default): the upper-limit to the alias-free probability,\n          using the approach of Baluev (2008) [1]_.\n        - \"davies\" : the Davies upper bound from Baluev (2008) [1]_.\n        - \"naive\" : the approximate probability based on an estimated\n          effective number of independent frequencies.\n        - \"bootstrap\" : the approximate probability based on bootstrap\n          resamplings of the input data.\n\n        Note also that for normalization='psd', the distribution can only be\n        computed for periodograms constructed with errors specified.\n\n        See Also\n        --------\n        distribution\n        false_alarm_probability\n\n        References\n        ----------\n        .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n        \"\"\"\n        if self.nterms != 1:\n            raise NotImplementedError(\"false alarm probability is not \"\n                                      \"implemented for multiterm periodograms.\")\n        if not (self.fit_mean or self.center_data):\n            raise NotImplementedError(\"false alarm probability is implemented \"\n                                      \"only for periodograms of centered data.\")\n\n        fmin, fmax = self.autofrequency(samples_per_peak=samples_per_peak,\n                                        nyquist_factor=nyquist_factor,\n                                        minimum_frequency=minimum_frequency,\n                                        maximum_frequency=maximum_frequency,\n                                        return_freq_limits=True)\n        return _statistics.false_alarm_level(false_alarm_probability,\n                                             fmax=fmax,\n                                             t=self._trel, y=self.y, dy=self.dy,\n                                             normalization=self.normalization,\n                                             method=method,\n                                             method_kwds=method_kwds)\n"},{"col":0,"comment":"null","endLoc":31,"header":"def _weighted_var(val, dy)","id":14503,"name":"_weighted_var","nodeType":"Function","startLoc":30,"text":"def _weighted_var(val, dy):\n    return _weighted_mean(val ** 2, dy) - _weighted_mean(val, dy) ** 2"},{"col":4,"comment":"Comoving line-of-sight distance in Mpc at a given redshift.\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc to each input redshift.\n        ","endLoc":1031,"header":"def comoving_distance(self, z)","id":14504,"name":"comoving_distance","nodeType":"Function","startLoc":1015,"text":"def comoving_distance(self, z):\n        \"\"\"Comoving line-of-sight distance in Mpc at a given redshift.\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc to each input redshift.\n        \"\"\"\n        return self._comoving_distance_z1z2(0, z)"},{"col":0,"comment":"null","endLoc":37,"header":"def _gamma(N)","id":14505,"name":"_gamma","nodeType":"Function","startLoc":34,"text":"def _gamma(N):\n    from scipy.special import gammaln\n    # Note: this is closely approximated by (1 - 0.75 / N) for large N\n    return np.sqrt(2 / N) * np.exp(gammaln(N / 2) - gammaln((N - 1) / 2))"},{"col":0,"comment":"","endLoc":1,"header":"core.py#<anonymous>","id":14506,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"Main Lomb-Scargle Implementation\"\"\""},{"col":0,"comment":"null","endLoc":46,"header":"def vectorize_first_argument(func)","id":14507,"name":"vectorize_first_argument","nodeType":"Function","startLoc":40,"text":"def vectorize_first_argument(func):\n    @wraps(func)\n    def new_func(x, *args, **kwargs):\n        x = np.asarray(x)\n        return np.array([func(xi, *args, **kwargs)\n                         for xi in x.flat]).reshape(x.shape)\n    return new_func"},{"col":4,"comment":"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2``.\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n        ","endLoc":1051,"header":"def _comoving_distance_z1z2(self, z1, z2)","id":14508,"name":"_comoving_distance_z1z2","nodeType":"Function","startLoc":1033,"text":"def _comoving_distance_z1z2(self, z1, z2):\n        \"\"\"\n        Comoving line-of-sight distance in Mpc between objects at redshifts\n        ``z1`` and ``z2``.\n\n        The comoving distance along the line-of-sight between two objects\n        remains constant with time for objects in the Hubble flow.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving distance in Mpc between each input redshift.\n        \"\"\"\n        return self._integral_comoving_distance_z1z2(z1, z2)"},{"col":0,"comment":"Probability density function for Lomb-Scargle periodogram\n\n    Compute the expected probability density function of the periodogram\n    for the null hypothesis - i.e. data consisting of Gaussian noise.\n\n    Parameters\n    ----------\n    z : array-like\n        The periodogram value.\n    N : int\n        The number of data points from which the periodogram was computed.\n    normalization : {'standard', 'model', 'log', 'psd'}\n        The periodogram normalization.\n    dH, dK : int, optional\n        The number of parameters in the null hypothesis and the model.\n\n    Returns\n    -------\n    pdf : np.ndarray\n        The expected probability density function.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n    All expressions used here are adapted from Table 1 of Baluev 2008 [1]_.\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    ","endLoc":95,"header":"def pdf_single(z, N, normalization, dH=1, dK=3)","id":14509,"name":"pdf_single","nodeType":"Function","startLoc":49,"text":"def pdf_single(z, N, normalization, dH=1, dK=3):\n    \"\"\"Probability density function for Lomb-Scargle periodogram\n\n    Compute the expected probability density function of the periodogram\n    for the null hypothesis - i.e. data consisting of Gaussian noise.\n\n    Parameters\n    ----------\n    z : array-like\n        The periodogram value.\n    N : int\n        The number of data points from which the periodogram was computed.\n    normalization : {'standard', 'model', 'log', 'psd'}\n        The periodogram normalization.\n    dH, dK : int, optional\n        The number of parameters in the null hypothesis and the model.\n\n    Returns\n    -------\n    pdf : np.ndarray\n        The expected probability density function.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n    All expressions used here are adapted from Table 1 of Baluev 2008 [1]_.\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    \"\"\"\n    z = np.asarray(z)\n    if dK - dH != 2:\n        raise NotImplementedError(\"Degrees of freedom != 2\")\n    Nk = N - dK\n\n    if normalization == 'psd':\n        return np.exp(-z)\n    elif normalization == 'standard':\n        return 0.5 * Nk * (1 - z) ** (0.5 * Nk - 1)\n    elif normalization == 'model':\n        return 0.5 * Nk * (1 + z) ** (-0.5 * Nk - 1)\n    elif normalization == 'log':\n        return 0.5 * Nk * np.exp(-0.5 * Nk * z)\n    else:\n        raise ValueError(f\"normalization='{normalization}' is not recognized\")"},{"id":14510,"name":"astropy/timeseries/periodograms/lombscargle/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/timeseries/periodograms/lombscargle/tests","id":14511,"nodeType":"File","text":""},{"col":4,"comment":"Comoving transverse distance in Mpc at a given redshift.\n\n        This value is the transverse comoving distance at redshift ``z``\n        corresponding to an angular separation of 1 radian. This is the same as\n        the comoving distance if :math:`\\Omega_k` is zero (as in the current\n        concordance Lambda-CDM model).\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving transverse distance in Mpc at each input redshift.\n\n        Notes\n        -----\n        This quantity is also called the 'proper motion distance' in some texts.\n        ","endLoc":1116,"header":"def comoving_transverse_distance(self, z)","id":14512,"name":"comoving_transverse_distance","nodeType":"Function","startLoc":1094,"text":"def comoving_transverse_distance(self, z):\n        r\"\"\"Comoving transverse distance in Mpc at a given redshift.\n\n        This value is the transverse comoving distance at redshift ``z``\n        corresponding to an angular separation of 1 radian. This is the same as\n        the comoving distance if :math:`\\Omega_k` is zero (as in the current\n        concordance Lambda-CDM model).\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving transverse distance in Mpc at each input redshift.\n\n        Notes\n        -----\n        This quantity is also called the 'proper motion distance' in some texts.\n        \"\"\"\n        return self._comoving_transverse_distance_z1z2(0, z)"},{"id":14513,"name":"astropy/timeseries/periodograms/lombscargle/implementations","nodeType":"Package"},{"fileName":"fastchi2_impl.py","filePath":"astropy/timeseries/periodograms/lombscargle/implementations","id":14514,"nodeType":"File","text":"\nimport numpy as np\n\nfrom .utils import trig_sum\n\n\ndef lombscargle_fastchi2(t, y, dy, f0, df, Nf, normalization='standard',\n                         fit_mean=True, center_data=True, nterms=1,\n                         use_fft=True, trig_sum_kwds=None):\n    \"\"\"Lomb-Scargle Periodogram\n\n    This implements a fast chi-squared periodogram using the algorithm\n    outlined in [4]_. The result is identical to the standard Lomb-Scargle\n    periodogram. The advantage of this algorithm is the\n    ability to compute multiterm periodograms relatively quickly.\n\n    Parameters\n    ----------\n    t, y, dy : array-like\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape. None should be `~astropy.units.Quantity`.\n    f0, df, Nf : (float, float, int)\n        parameters describing the frequency grid, f = f0 + df * arange(Nf).\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool, optional\n        if True, include a constant offset as part of the model at each\n        frequency. This can lead to more accurate results, especially in the\n        case of incomplete phase coverage.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data. This is especially important if ``fit_mean = False``\n    nterms : int, optional\n        Number of Fourier terms in the fit\n\n    Returns\n    -------\n    power : array-like\n        Lomb-Scargle power associated with each frequency.\n        Units of the result depend on the normalization.\n\n    References\n    ----------\n    .. [1] M. Zechmeister and M. Kurster, A&A 496, 577-584 (2009)\n    .. [2] W. Press et al, Numerical Recipes in C (2002)\n    .. [3] Scargle, J.D. ApJ 263:835-853 (1982)\n    .. [4] Palmer, J. ApJ 695:496-502 (2009)\n    \"\"\"\n    if nterms == 0 and not fit_mean:\n        raise ValueError(\"Cannot have nterms = 0 without fitting bias\")\n\n    if dy is None:\n        dy = 1\n\n    # Validate and setup input data\n    t, y, dy = np.broadcast_arrays(t, y, dy)\n    if t.ndim != 1:\n        raise ValueError(\"t, y, dy should be one dimensional\")\n\n    # Validate and setup frequency grid\n    if f0 < 0:\n        raise ValueError(\"Frequencies must be positive\")\n    if df <= 0:\n        raise ValueError(\"Frequency steps must be positive\")\n    if Nf <= 0:\n        raise ValueError(\"Number of frequencies must be positive\")\n\n    w = dy ** -2.0\n    ws = np.sum(w)\n\n    # if fit_mean is true, centering the data now simplifies the math below.\n    if center_data or fit_mean:\n        y = y - np.dot(w, y) / ws\n\n    yw = y / dy\n    chi2_ref = np.dot(yw, yw)\n\n    kwargs = dict.copy(trig_sum_kwds or {})\n    kwargs.update(f0=f0, df=df, use_fft=use_fft, N=Nf)\n\n    # Here we build-up the matrices XTX and XTy using pre-computed\n    # sums. The relevant identities are\n    # 2 sin(mx) sin(nx) = cos(m-n)x - cos(m+n)x\n    # 2 cos(mx) cos(nx) = cos(m-n)x + cos(m+n)x\n    # 2 sin(mx) cos(nx) = sin(m-n)x + sin(m+n)x\n\n    yws = np.sum(y * w)\n\n    SCw = [(np.zeros(Nf), ws * np.ones(Nf))]\n    SCw.extend([trig_sum(t, w, freq_factor=i, **kwargs)\n                for i in range(1, 2 * nterms + 1)])\n    Sw, Cw = zip(*SCw)\n\n    SCyw = [(np.zeros(Nf), yws * np.ones(Nf))]\n    SCyw.extend([trig_sum(t, w * y, freq_factor=i, **kwargs)\n                 for i in range(1, nterms + 1)])\n    Syw, Cyw = zip(*SCyw)\n\n    # Now create an indexing scheme so we can quickly\n    # build-up matrices at each frequency\n    order = [('C', 0)] if fit_mean else []\n    order.extend(sum([[('S', i), ('C', i)]\n                      for i in range(1, nterms + 1)], []))\n\n    funcs = dict(S=lambda m, i: Syw[m][i],\n                 C=lambda m, i: Cyw[m][i],\n                 SS=lambda m, n, i: 0.5 * (Cw[abs(m - n)][i] - Cw[m + n][i]),\n                 CC=lambda m, n, i: 0.5 * (Cw[abs(m - n)][i] + Cw[m + n][i]),\n                 SC=lambda m, n, i: 0.5 * (np.sign(m - n) * Sw[abs(m - n)][i]\n                                           + Sw[m + n][i]),\n                 CS=lambda m, n, i: 0.5 * (np.sign(n - m) * Sw[abs(n - m)][i]\n                                           + Sw[n + m][i]))\n\n    def compute_power(i):\n        XTX = np.array([[funcs[A[0] + B[0]](A[1], B[1], i)\n                         for A in order]\n                        for B in order])\n        XTy = np.array([funcs[A[0]](A[1], i) for A in order])\n        return np.dot(XTy.T, np.linalg.solve(XTX, XTy))\n\n    p = np.array([compute_power(i) for i in range(Nf)])\n\n    if normalization == 'psd':\n        p *= 0.5\n    elif normalization == 'standard':\n        p /= chi2_ref\n    elif normalization == 'log':\n        p = -np.log(1 - p / chi2_ref)\n    elif normalization == 'model':\n        p /= chi2_ref - p\n    else:\n        raise ValueError(f\"normalization='{normalization}' not recognized\")\n    return p\n"},{"col":0,"comment":"Cumulative distribution for the Lomb-Scargle periodogram\n\n    Compute the expected cumulative distribution of the periodogram\n    for the null hypothesis - i.e. data consisting of Gaussian noise.\n\n    Parameters\n    ----------\n    z : array-like\n        The periodogram value.\n    N : int\n        The number of data points from which the periodogram was computed.\n    normalization : {'standard', 'model', 'log', 'psd'}\n        The periodogram normalization.\n    dH, dK : int, optional\n        The number of parameters in the null hypothesis and the model.\n\n    Returns\n    -------\n    cdf : np.ndarray\n        The expected cumulative distribution function.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n    All expressions used here are adapted from Table 1 of Baluev 2008 [1]_.\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    ","endLoc":233,"header":"def cdf_single(z, N, normalization, dH=1, dK=3)","id":14515,"name":"cdf_single","nodeType":"Function","startLoc":201,"text":"def cdf_single(z, N, normalization, dH=1, dK=3):\n    \"\"\"Cumulative distribution for the Lomb-Scargle periodogram\n\n    Compute the expected cumulative distribution of the periodogram\n    for the null hypothesis - i.e. data consisting of Gaussian noise.\n\n    Parameters\n    ----------\n    z : array-like\n        The periodogram value.\n    N : int\n        The number of data points from which the periodogram was computed.\n    normalization : {'standard', 'model', 'log', 'psd'}\n        The periodogram normalization.\n    dH, dK : int, optional\n        The number of parameters in the null hypothesis and the model.\n\n    Returns\n    -------\n    cdf : np.ndarray\n        The expected cumulative distribution function.\n\n    Notes\n    -----\n    For normalization='psd', the distribution can only be computed for\n    periodograms constructed with errors specified.\n    All expressions used here are adapted from Table 1 of Baluev 2008 [1]_.\n\n    References\n    ----------\n    .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)\n    \"\"\"\n    return 1 - fap_single(z, N, normalization=normalization, dH=dH, dK=dK)"},{"col":4,"comment":"Comoving transverse distance in Mpc between two redshifts.\n\n        This value is the transverse comoving distance at redshift ``z2`` as\n        seen from redshift ``z1`` corresponding to an angular separation of\n        1 radian. This is the same as the comoving distance if :math:`\\Omega_k`\n        is zero (as in the current concordance Lambda-CDM model).\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving transverse distance in Mpc between input redshift.\n\n        Notes\n        -----\n        This quantity is also called the 'proper motion distance' in some texts.\n        ","endLoc":1149,"header":"def _comoving_transverse_distance_z1z2(self, z1, z2)","id":14516,"name":"_comoving_transverse_distance_z1z2","nodeType":"Function","startLoc":1118,"text":"def _comoving_transverse_distance_z1z2(self, z1, z2):\n        r\"\"\"Comoving transverse distance in Mpc between two redshifts.\n\n        This value is the transverse comoving distance at redshift ``z2`` as\n        seen from redshift ``z1`` corresponding to an angular separation of\n        1 radian. This is the same as the comoving distance if :math:`\\Omega_k`\n        is zero (as in the current concordance Lambda-CDM model).\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Comoving transverse distance in Mpc between input redshift.\n\n        Notes\n        -----\n        This quantity is also called the 'proper motion distance' in some texts.\n        \"\"\"\n        Ok0 = self._Ok0\n        dc = self._comoving_distance_z1z2(z1, z2)\n        if Ok0 == 0:\n            return dc\n        sqrtOk0 = sqrt(abs(Ok0))\n        dh = self._hubble_distance\n        if Ok0 > 0:\n            return dh / sqrtOk0 * np.sinh(sqrtOk0 * dc.value / dh.value)\n        else:\n            return dh / sqrtOk0 * np.sin(sqrtOk0 * dc.value / dh.value)"},{"col":0,"comment":"tau factor for estimating Davies bound (Baluev 2008, Table 1)","endLoc":261,"header":"def tau_davies(Z, fmax, t, y, dy, normalization='standard', dH=1, dK=3)","id":14517,"name":"tau_davies","nodeType":"Function","startLoc":236,"text":"def tau_davies(Z, fmax, t, y, dy, normalization='standard', dH=1, dK=3):\n    \"\"\"tau factor for estimating Davies bound (Baluev 2008, Table 1)\"\"\"\n    N = len(t)\n    NH = N - dH  # DOF for null hypothesis\n    NK = N - dK  # DOF for periodic hypothesis\n    Dt = _weighted_var(t, dy)\n    Teff = np.sqrt(4 * np.pi * Dt)  # Effective baseline\n    W = fmax * Teff\n    Z = np.asarray(Z)\n    if normalization == 'psd':\n        # 'psd' normalization is same as Baluev's z\n        return W * np.exp(-Z) * np.sqrt(Z)\n    elif normalization == 'standard':\n        # 'standard' normalization is Z = 2/NH * z_1\n        return (_gamma(NH) * W * (1 - Z) ** (0.5 * (NK - 1))\n                * np.sqrt(0.5 * NH * Z))\n    elif normalization == 'model':\n        # 'model' normalization is Z = 2/NK * z_2\n        return (_gamma(NK) * W * (1 + Z) ** (-0.5 * NK)\n                * np.sqrt(0.5 * NK * Z))\n    elif normalization == 'log':\n        # 'log' normalization is Z = 2/NK * z_3\n        return (_gamma(NK) * W * np.exp(-0.5 * Z * (NK - 0.5))\n                * np.sqrt(NK * np.sinh(0.5 * Z)))\n    else:\n        raise NotImplementedError(f\"normalization={normalization}\")"},{"col":0,"comment":"Compute (approximate) trigonometric sums for a number of frequencies\n    This routine computes weighted sine and cosine sums::\n\n        S_j = sum_i { h_i * sin(2 pi * f_j * t_i) }\n        C_j = sum_i { h_i * cos(2 pi * f_j * t_i) }\n\n    Where f_j = freq_factor * (f0 + j * df) for the values j in 1 ... N.\n    The sums can be computed either by a brute force O[N^2] method, or\n    by an FFT-based O[Nlog(N)] method.\n\n    Parameters\n    ----------\n    t : array-like\n        array of input times\n    h : array-like\n        array weights for the sum\n    df : float\n        frequency spacing\n    N : int\n        number of frequency bins to return\n    f0 : float, optional\n        The low frequency to use\n    freq_factor : float, optional\n        Factor which multiplies the frequency\n    use_fft : bool\n        if True, use the approximate FFT algorithm to compute the result.\n        This uses the FFT with Press & Rybicki's Lagrangian extirpolation.\n    oversampling : int (default = 5)\n        oversampling freq_factor for the approximation; roughly the number of\n        time samples across the highest-frequency sinusoid. This parameter\n        contains the trade-off between accuracy and speed. Not referenced\n        if use_fft is False.\n    Mfft : int\n        The number of adjacent points to use in the FFT approximation.\n        Not referenced if use_fft is False.\n\n    Returns\n    -------\n    S, C : ndarray\n        summation arrays for frequencies f = df * np.arange(1, N + 1)\n    ","endLoc":158,"header":"def trig_sum(t, h, df, N, f0=0, freq_factor=1,\n             oversampling=5, use_fft=True, Mfft=4)","id":14518,"name":"trig_sum","nodeType":"Function","startLoc":81,"text":"def trig_sum(t, h, df, N, f0=0, freq_factor=1,\n             oversampling=5, use_fft=True, Mfft=4):\n    \"\"\"Compute (approximate) trigonometric sums for a number of frequencies\n    This routine computes weighted sine and cosine sums::\n\n        S_j = sum_i { h_i * sin(2 pi * f_j * t_i) }\n        C_j = sum_i { h_i * cos(2 pi * f_j * t_i) }\n\n    Where f_j = freq_factor * (f0 + j * df) for the values j in 1 ... N.\n    The sums can be computed either by a brute force O[N^2] method, or\n    by an FFT-based O[Nlog(N)] method.\n\n    Parameters\n    ----------\n    t : array-like\n        array of input times\n    h : array-like\n        array weights for the sum\n    df : float\n        frequency spacing\n    N : int\n        number of frequency bins to return\n    f0 : float, optional\n        The low frequency to use\n    freq_factor : float, optional\n        Factor which multiplies the frequency\n    use_fft : bool\n        if True, use the approximate FFT algorithm to compute the result.\n        This uses the FFT with Press & Rybicki's Lagrangian extirpolation.\n    oversampling : int (default = 5)\n        oversampling freq_factor for the approximation; roughly the number of\n        time samples across the highest-frequency sinusoid. This parameter\n        contains the trade-off between accuracy and speed. Not referenced\n        if use_fft is False.\n    Mfft : int\n        The number of adjacent points to use in the FFT approximation.\n        Not referenced if use_fft is False.\n\n    Returns\n    -------\n    S, C : ndarray\n        summation arrays for frequencies f = df * np.arange(1, N + 1)\n    \"\"\"\n    df *= freq_factor\n    f0 *= freq_factor\n\n    if df <= 0:\n        raise ValueError(\"df must be positive\")\n    t, h = map(np.ravel, np.broadcast_arrays(t, h))\n\n    if use_fft:\n        Mfft = int(Mfft)\n        if Mfft <= 0:\n            raise ValueError(\"Mfft must be positive\")\n\n        # required size of fft is the power of 2 above the oversampling rate\n        Nfft = bitceil(N * oversampling)\n        t0 = t.min()\n\n        if f0 > 0:\n            h = h * np.exp(2j * np.pi * f0 * (t - t0))\n\n        tnorm = ((t - t0) * Nfft * df) % Nfft\n        grid = extirpolate(tnorm, h, Nfft, Mfft)\n\n        fftgrid = np.fft.ifft(grid)[:N]\n        if t0 != 0:\n            f = f0 + df * np.arange(N)\n            fftgrid *= np.exp(2j * np.pi * t0 * f)\n\n        C = Nfft * fftgrid.real\n        S = Nfft * fftgrid.imag\n    else:\n        f = f0 + df * np.arange(N)\n        C = np.dot(h, np.cos(2 * np.pi * f * t[:, np.newaxis]))\n        S = np.dot(h, np.sin(2 * np.pi * f * t[:, np.newaxis]))\n\n    return S, C"},{"col":4,"comment":"Angular diameter distance in Mpc at a given redshift.\n\n        This gives the proper (sometimes called 'physical') transverse\n        distance corresponding to an angle of 1 radian for an object\n        at redshift ``z`` ([1]_, [2]_, [3]_).\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Angular diameter distance in Mpc at each input redshift.\n\n        References\n        ----------\n        .. [1] Weinberg, 1972, pp 420-424; Weedman, 1986, pp 421-424.\n        .. [2] Weedman, D. (1986). Quasar astronomy, pp 65-67.\n        .. [3] Peebles, P. (1993). Principles of Physical Cosmology, pp 325-327.\n        ","endLoc":1175,"header":"def angular_diameter_distance(self, z)","id":14519,"name":"angular_diameter_distance","nodeType":"Function","startLoc":1151,"text":"def angular_diameter_distance(self, z):\n        \"\"\"Angular diameter distance in Mpc at a given redshift.\n\n        This gives the proper (sometimes called 'physical') transverse\n        distance corresponding to an angle of 1 radian for an object\n        at redshift ``z`` ([1]_, [2]_, [3]_).\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Angular diameter distance in Mpc at each input redshift.\n\n        References\n        ----------\n        .. [1] Weinberg, 1972, pp 420-424; Weedman, 1986, pp 421-424.\n        .. [2] Weedman, D. (1986). Quasar astronomy, pp 65-67.\n        .. [3] Peebles, P. (1993). Principles of Physical Cosmology, pp 325-327.\n        \"\"\"\n        z = aszarr(z)\n        return self.comoving_transverse_distance(z) / (z + 1.0)"},{"col":4,"comment":"Luminosity distance in Mpc at redshift ``z``.\n\n        This is the distance to use when converting between the bolometric flux\n        from an object at redshift ``z`` and its bolometric luminosity [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Luminosity distance in Mpc at each input redshift.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to a luminosity distance.\n\n        References\n        ----------\n        .. [1] Weinberg, 1972, pp 420-424; Weedman, 1986, pp 60-62.\n        ","endLoc":1202,"header":"def luminosity_distance(self, z)","id":14520,"name":"luminosity_distance","nodeType":"Function","startLoc":1177,"text":"def luminosity_distance(self, z):\n        \"\"\"Luminosity distance in Mpc at redshift ``z``.\n\n        This is the distance to use when converting between the bolometric flux\n        from an object at redshift ``z`` and its bolometric luminosity [1]_.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            Luminosity distance in Mpc at each input redshift.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to a luminosity distance.\n\n        References\n        ----------\n        .. [1] Weinberg, 1972, pp 420-424; Weedman, 1986, pp 60-62.\n        \"\"\"\n        z = aszarr(z)\n        return (z + 1.0) * self.comoving_transverse_distance(z)"},{"col":0,"comment":"False Alarm Probability based on estimated number of indep frequencies","endLoc":274,"header":"def fap_naive(Z, fmax, t, y, dy, normalization='standard')","id":14521,"name":"fap_naive","nodeType":"Function","startLoc":264,"text":"def fap_naive(Z, fmax, t, y, dy, normalization='standard'):\n    \"\"\"False Alarm Probability based on estimated number of indep frequencies\"\"\"\n    N = len(t)\n    T = max(t) - min(t)\n    N_eff = fmax * T\n    fap_s = fap_single(Z, N, normalization=normalization)\n    # result is 1 - (1 - fap_s) ** N_eff\n    # this is much more precise for small Z / large N\n    # Ignore divide by zero no np.log1p - fine to let it return -inf.\n    with np.errstate(divide='ignore'):\n        return -np.expm1(N_eff * np.log1p(-fap_s))"},{"col":0,"comment":"\n    Find the bit (i.e. power of 2) immediately greater than or equal to N\n    Note: this works for numbers up to 2 ** 64.\n    Roughly equivalent to int(2 ** np.ceil(np.log2(N)))\n    ","endLoc":11,"header":"def bitceil(N)","id":14522,"name":"bitceil","nodeType":"Function","startLoc":5,"text":"def bitceil(N):\n    \"\"\"\n    Find the bit (i.e. power of 2) immediately greater than or equal to N\n    Note: this works for numbers up to 2 ** 64.\n    Roughly equivalent to int(2 ** np.ceil(np.log2(N)))\n    \"\"\"\n    return 1 << int(N - 1).bit_length()"},{"col":4,"comment":"Angular diameter distance between objects at 2 redshifts.\n\n        Useful for gravitational lensing, for example computing the angular\n        diameter distance between a lensed galaxy and the foreground lens.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts. For most practical applications such as\n            gravitational lensing, ``z2`` should be larger than ``z1``. The\n            method will work for ``z2 < z1``; however, this will return\n            negative distances.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n            The angular diameter distance between each input redshift pair.\n            Returns scalar if input is scalar, array else-wise.\n        ","endLoc":1228,"header":"def angular_diameter_distance_z1z2(self, z1, z2)","id":14523,"name":"angular_diameter_distance_z1z2","nodeType":"Function","startLoc":1204,"text":"def angular_diameter_distance_z1z2(self, z1, z2):\n        \"\"\"Angular diameter distance between objects at 2 redshifts.\n\n        Useful for gravitational lensing, for example computing the angular\n        diameter distance between a lensed galaxy and the foreground lens.\n\n        Parameters\n        ----------\n        z1, z2 : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshifts. For most practical applications such as\n            gravitational lensing, ``z2`` should be larger than ``z1``. The\n            method will work for ``z2 < z1``; however, this will return\n            negative distances.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n            The angular diameter distance between each input redshift pair.\n            Returns scalar if input is scalar, array else-wise.\n        \"\"\"\n        z1, z2 = aszarr(z1), aszarr(z2)\n        if np.any(z2 < z1):\n            warnings.warn(f\"Second redshift(s) z2 ({z2}) is less than first \"\n                          f\"redshift(s) z1 ({z1}).\", AstropyUserWarning)\n        return self._comoving_transverse_distance_z1z2(z1, z2) / (z2 + 1.0)"},{"col":4,"comment":"Absorption distance at redshift ``z``.\n\n        This is used to calculate the number of objects with some cross section\n        of absorption and number density intersecting a sightline per unit\n        redshift path ([1]_, [2]_).\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : float or ndarray\n            Absorption distance (dimensionless) at each input redshift.\n            Returns `float` if input scalar, `~numpy.ndarray` otherwise.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        .. [2] Bahcall, John N. and Peebles, P.J.E. 1969, ApJ, 156L, 7B\n        ","endLoc":1255,"header":"@vectorize_redshift_method\n    def absorption_distance(self, z, /)","id":14524,"name":"absorption_distance","nodeType":"Function","startLoc":1230,"text":"@vectorize_redshift_method\n    def absorption_distance(self, z, /):\n        \"\"\"Absorption distance at redshift ``z``.\n\n        This is used to calculate the number of objects with some cross section\n        of absorption and number density intersecting a sightline per unit\n        redshift path ([1]_, [2]_).\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : float or ndarray\n            Absorption distance (dimensionless) at each input redshift.\n            Returns `float` if input scalar, `~numpy.ndarray` otherwise.\n\n        References\n        ----------\n        .. [1] Hogg, D. (1999). Distance measures in cosmology, section 11.\n               arXiv e-prints, astro-ph/9905116.\n        .. [2] Bahcall, John N. and Peebles, P.J.E. 1969, ApJ, 156L, 7B\n        \"\"\"\n        return quad(self._abs_distance_integrand_scalar, 0, z)[0]"},{"col":4,"comment":"Distance modulus at redshift ``z``.\n\n        The distance modulus is defined as the (apparent magnitude - absolute\n        magnitude) for an object at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        distmod : `~astropy.units.Quantity` ['length']\n            Distance modulus at each input redshift, in magnitudes.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to a distance modulus.\n        ","endLoc":1282,"header":"def distmod(self, z)","id":14525,"name":"distmod","nodeType":"Function","startLoc":1257,"text":"def distmod(self, z):\n        \"\"\"Distance modulus at redshift ``z``.\n\n        The distance modulus is defined as the (apparent magnitude - absolute\n        magnitude) for an object at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        distmod : `~astropy.units.Quantity` ['length']\n            Distance modulus at each input redshift, in magnitudes.\n\n        See Also\n        --------\n        z_at_value : Find the redshift corresponding to a distance modulus.\n        \"\"\"\n        # Remember that the luminosity distance is in Mpc\n        # Abs is necessary because in certain obscure closed cosmologies\n        #  the distance modulus can be negative -- which is okay because\n        #  it enters as the square.\n        val = 5. * np.log10(abs(self.luminosity_distance(z).value)) + 25.0\n        return u.Quantity(val, u.mag)"},{"col":0,"comment":"\n    Extirpolate the values (x, y) onto an integer grid range(N),\n    using lagrange polynomial weights on the M nearest points.\n\n    Parameters\n    ----------\n    x : array-like\n        array of abscissas\n    y : array-like\n        array of ordinates\n    N : int\n        number of integer bins to use. For best performance, N should be larger\n        than the maximum of x\n    M : int\n        number of adjoining points on which to extirpolate.\n\n    Returns\n    -------\n    yN : ndarray\n         N extirpolated values associated with range(N)\n\n    Example\n    -------\n    >>> rng = np.random.default_rng(0)\n    >>> x = 100 * rng.random(20)\n    >>> y = np.sin(x)\n    >>> y_hat = extirpolate(x, y)\n    >>> x_hat = np.arange(len(y_hat))\n    >>> f = lambda x: np.sin(x / 10)\n    >>> np.allclose(np.sum(y * f(x)), np.sum(y_hat * f(x_hat)))\n    True\n\n    Notes\n    -----\n    This code is based on the C implementation of spread() presented in\n    Numerical Recipes in C, Second Edition (Press et al. 1989; p.583).\n    ","endLoc":78,"header":"def extirpolate(x, y, N=None, M=4)","id":14526,"name":"extirpolate","nodeType":"Function","startLoc":14,"text":"def extirpolate(x, y, N=None, M=4):\n    \"\"\"\n    Extirpolate the values (x, y) onto an integer grid range(N),\n    using lagrange polynomial weights on the M nearest points.\n\n    Parameters\n    ----------\n    x : array-like\n        array of abscissas\n    y : array-like\n        array of ordinates\n    N : int\n        number of integer bins to use. For best performance, N should be larger\n        than the maximum of x\n    M : int\n        number of adjoining points on which to extirpolate.\n\n    Returns\n    -------\n    yN : ndarray\n         N extirpolated values associated with range(N)\n\n    Example\n    -------\n    >>> rng = np.random.default_rng(0)\n    >>> x = 100 * rng.random(20)\n    >>> y = np.sin(x)\n    >>> y_hat = extirpolate(x, y)\n    >>> x_hat = np.arange(len(y_hat))\n    >>> f = lambda x: np.sin(x / 10)\n    >>> np.allclose(np.sum(y * f(x)), np.sum(y_hat * f(x_hat)))\n    True\n\n    Notes\n    -----\n    This code is based on the C implementation of spread() presented in\n    Numerical Recipes in C, Second Edition (Press et al. 1989; p.583).\n    \"\"\"\n    x, y = map(np.ravel, np.broadcast_arrays(x, y))\n\n    if N is None:\n        N = int(np.max(x) + 0.5 * M + 1)\n\n    # Now use legendre polynomial weights to populate the results array;\n    # This is an efficient recursive implementation (See Press et al. 1989)\n    result = np.zeros(N, dtype=y.dtype)\n\n    # first take care of the easy cases where x is an integer\n    integers = (x % 1 == 0)\n    np.add.at(result, x[integers].astype(int), y[integers])\n    x, y = x[~integers], y[~integers]\n\n    # For each remaining x, find the index describing the extirpolation range.\n    # i.e. ilo[i] < x[i] < ilo[i] + M with x[i] in the center,\n    # adjusted so that the limits are within the range 0...N\n    ilo = np.clip((x - M // 2).astype(int), 0, N - M)\n    numerator = y * np.prod(x - ilo - np.arange(M)[:, np.newaxis], 0)\n    denominator = factorial(M - 1)\n\n    for j in range(M):\n        if j > 0:\n            denominator *= j / (j - M)\n        ind = ilo + (M - 1 - j)\n        np.add.at(result, ind, numerator / (denominator * (x - ind)))\n    return result"},{"col":0,"comment":"Return the cosmology as a ``mycosmo``.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology`\n\n    Returns\n    -------\n    `~mypackage.cosmology.MyCosmology`\n    ","endLoc":125,"header":"def to_mypackage(cosmology, *args)","id":14527,"name":"to_mypackage","nodeType":"Function","startLoc":80,"text":"def to_mypackage(cosmology, *args):\n    \"\"\"Return the cosmology as a ``mycosmo``.\n\n    Parameters\n    ----------\n    cosmology : `~astropy.cosmology.Cosmology`\n\n    Returns\n    -------\n    `~mypackage.cosmology.MyCosmology`\n    \"\"\"\n    if not isinstance(cosmology, FLRW):\n        raise TypeError(\"format 'mypackage' only supports FLRW cosmologies.\")\n\n    # ----------------\n    # Cosmology provides a nice method \"mapping\", so all that needs to\n    # be done here is initialize from the dictionary\n    m = cosmology.to_format(\"mapping\")\n\n    # Detect which type of MyCosmology to build.\n    # Here we have forced FlatLambdaCDM, but if your package allows for\n    # non-flat cosmologies...\n    m.pop(\"cosmology\")\n\n    # MyCosmology doesn't support metadata. If your cosmology class does...\n    meta = m.pop(\"meta\")\n    m = {**meta, **m}  # merge, preferring current values\n\n    # ----------------\n    # remap values\n    # MyCosmology doesn't support units, so take values.\n    m[\"hubble_parameter\"] = m.pop(\"H0\").to_value(u.km/u.s/u.Mpc)\n    m[\"initial_matter_density\"] = m.pop(\"Om0\")\n    m[\"initial_temperature\"] = m.pop(\"Tcmb0\").to_value(u.K)\n    # m[\"Neff\"] = m.pop(\"Neff\")  # skip b/c unchanged\n    m[\"neutrino_masses\"] = m.pop(\"m_nu\").to_value(u.eV)\n    m[\"initial_baryon_density\"] = m.pop(\"Ob0\")\n    m[\"current_age\"] = m.pop(\"t0\", cosmology.age(0 * cu.redshift)).to_value(u.Gyr)\n\n    # optional\n    if \"z_reion\" in m:\n        m[\"reionization_redshift\"] = (m.pop(\"z_reion\") << cu.redshift).value\n\n    # ...  # keep remapping\n\n    return MyCosmology(**m)"},{"attributeType":"null","col":4,"comment":"null","endLoc":72,"id":14528,"name":"_required_columns","nodeType":"Attribute","startLoc":72,"text":"_required_columns"},{"attributeType":"null","col":12,"comment":"null","endLoc":84,"id":14529,"name":"_required_columns_relax","nodeType":"Attribute","startLoc":84,"text":"self._required_columns_relax"},{"col":0,"comment":"Inverse FAP based on estimated number of indep frequencies","endLoc":287,"header":"def inv_fap_naive(fap, fmax, t, y, dy, normalization='standard')","id":14530,"name":"inv_fap_naive","nodeType":"Function","startLoc":277,"text":"def inv_fap_naive(fap, fmax, t, y, dy, normalization='standard'):\n    \"\"\"Inverse FAP based on estimated number of indep frequencies\"\"\"\n    fap = np.asarray(fap)\n    N = len(t)\n    T = max(t) - min(t)\n    N_eff = fmax * T\n    # fap_s = 1 - (1 - fap) ** (1 / N_eff)\n    # Ignore divide by zero no np.log - fine to let it return -inf.\n    with np.errstate(divide='ignore'):\n        fap_s = -np.expm1(np.log(1 - fap) / N_eff)\n    return inv_fap_single(fap_s, N, normalization)"},{"col":0,"comment":"Lomb-Scargle Periodogram\n\n    This implements a fast chi-squared periodogram using the algorithm\n    outlined in [4]_. The result is identical to the standard Lomb-Scargle\n    periodogram. The advantage of this algorithm is the\n    ability to compute multiterm periodograms relatively quickly.\n\n    Parameters\n    ----------\n    t, y, dy : array-like\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape. None should be `~astropy.units.Quantity`.\n    f0, df, Nf : (float, float, int)\n        parameters describing the frequency grid, f = f0 + df * arange(Nf).\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool, optional\n        if True, include a constant offset as part of the model at each\n        frequency. This can lead to more accurate results, especially in the\n        case of incomplete phase coverage.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data. This is especially important if ``fit_mean = False``\n    nterms : int, optional\n        Number of Fourier terms in the fit\n\n    Returns\n    -------\n    power : array-like\n        Lomb-Scargle power associated with each frequency.\n        Units of the result depend on the normalization.\n\n    References\n    ----------\n    .. [1] M. Zechmeister and M. Kurster, A&A 496, 577-584 (2009)\n    .. [2] W. Press et al, Numerical Recipes in C (2002)\n    .. [3] Scargle, J.D. ApJ 263:835-853 (1982)\n    .. [4] Palmer, J. ApJ 695:496-502 (2009)\n    ","endLoc":134,"header":"def lombscargle_fastchi2(t, y, dy, f0, df, Nf, normalization='standard',\n                         fit_mean=True, center_data=True, nterms=1,\n                         use_fft=True, trig_sum_kwds=None)","id":14531,"name":"lombscargle_fastchi2","nodeType":"Function","startLoc":7,"text":"def lombscargle_fastchi2(t, y, dy, f0, df, Nf, normalization='standard',\n                         fit_mean=True, center_data=True, nterms=1,\n                         use_fft=True, trig_sum_kwds=None):\n    \"\"\"Lomb-Scargle Periodogram\n\n    This implements a fast chi-squared periodogram using the algorithm\n    outlined in [4]_. The result is identical to the standard Lomb-Scargle\n    periodogram. The advantage of this algorithm is the\n    ability to compute multiterm periodograms relatively quickly.\n\n    Parameters\n    ----------\n    t, y, dy : array-like\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape. None should be `~astropy.units.Quantity`.\n    f0, df, Nf : (float, float, int)\n        parameters describing the frequency grid, f = f0 + df * arange(Nf).\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool, optional\n        if True, include a constant offset as part of the model at each\n        frequency. This can lead to more accurate results, especially in the\n        case of incomplete phase coverage.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data. This is especially important if ``fit_mean = False``\n    nterms : int, optional\n        Number of Fourier terms in the fit\n\n    Returns\n    -------\n    power : array-like\n        Lomb-Scargle power associated with each frequency.\n        Units of the result depend on the normalization.\n\n    References\n    ----------\n    .. [1] M. Zechmeister and M. Kurster, A&A 496, 577-584 (2009)\n    .. [2] W. Press et al, Numerical Recipes in C (2002)\n    .. [3] Scargle, J.D. ApJ 263:835-853 (1982)\n    .. [4] Palmer, J. ApJ 695:496-502 (2009)\n    \"\"\"\n    if nterms == 0 and not fit_mean:\n        raise ValueError(\"Cannot have nterms = 0 without fitting bias\")\n\n    if dy is None:\n        dy = 1\n\n    # Validate and setup input data\n    t, y, dy = np.broadcast_arrays(t, y, dy)\n    if t.ndim != 1:\n        raise ValueError(\"t, y, dy should be one dimensional\")\n\n    # Validate and setup frequency grid\n    if f0 < 0:\n        raise ValueError(\"Frequencies must be positive\")\n    if df <= 0:\n        raise ValueError(\"Frequency steps must be positive\")\n    if Nf <= 0:\n        raise ValueError(\"Number of frequencies must be positive\")\n\n    w = dy ** -2.0\n    ws = np.sum(w)\n\n    # if fit_mean is true, centering the data now simplifies the math below.\n    if center_data or fit_mean:\n        y = y - np.dot(w, y) / ws\n\n    yw = y / dy\n    chi2_ref = np.dot(yw, yw)\n\n    kwargs = dict.copy(trig_sum_kwds or {})\n    kwargs.update(f0=f0, df=df, use_fft=use_fft, N=Nf)\n\n    # Here we build-up the matrices XTX and XTy using pre-computed\n    # sums. The relevant identities are\n    # 2 sin(mx) sin(nx) = cos(m-n)x - cos(m+n)x\n    # 2 cos(mx) cos(nx) = cos(m-n)x + cos(m+n)x\n    # 2 sin(mx) cos(nx) = sin(m-n)x + sin(m+n)x\n\n    yws = np.sum(y * w)\n\n    SCw = [(np.zeros(Nf), ws * np.ones(Nf))]\n    SCw.extend([trig_sum(t, w, freq_factor=i, **kwargs)\n                for i in range(1, 2 * nterms + 1)])\n    Sw, Cw = zip(*SCw)\n\n    SCyw = [(np.zeros(Nf), yws * np.ones(Nf))]\n    SCyw.extend([trig_sum(t, w * y, freq_factor=i, **kwargs)\n                 for i in range(1, nterms + 1)])\n    Syw, Cyw = zip(*SCyw)\n\n    # Now create an indexing scheme so we can quickly\n    # build-up matrices at each frequency\n    order = [('C', 0)] if fit_mean else []\n    order.extend(sum([[('S', i), ('C', i)]\n                      for i in range(1, nterms + 1)], []))\n\n    funcs = dict(S=lambda m, i: Syw[m][i],\n                 C=lambda m, i: Cyw[m][i],\n                 SS=lambda m, n, i: 0.5 * (Cw[abs(m - n)][i] - Cw[m + n][i]),\n                 CC=lambda m, n, i: 0.5 * (Cw[abs(m - n)][i] + Cw[m + n][i]),\n                 SC=lambda m, n, i: 0.5 * (np.sign(m - n) * Sw[abs(m - n)][i]\n                                           + Sw[m + n][i]),\n                 CS=lambda m, n, i: 0.5 * (np.sign(n - m) * Sw[abs(n - m)][i]\n                                           + Sw[n + m][i]))\n\n    def compute_power(i):\n        XTX = np.array([[funcs[A[0] + B[0]](A[1], B[1], i)\n                         for A in order]\n                        for B in order])\n        XTy = np.array([funcs[A[0]](A[1], i) for A in order])\n        return np.dot(XTy.T, np.linalg.solve(XTX, XTy))\n\n    p = np.array([compute_power(i) for i in range(Nf)])\n\n    if normalization == 'psd':\n        p *= 0.5\n    elif normalization == 'standard':\n        p /= chi2_ref\n    elif normalization == 'log':\n        p = -np.log(1 - p / chi2_ref)\n    elif normalization == 'model':\n        p /= chi2_ref - p\n    else:\n        raise ValueError(f\"normalization='{normalization}' not recognized\")\n    return p"},{"col":4,"comment":"Comoving volume in cubic Mpc at redshift ``z``.\n\n        This is the volume of the universe encompassed by redshifts less than\n        ``z``. For the case of :math:`\\Omega_k = 0` it is a sphere of radius\n        `comoving_distance` but it is less intuitive if :math:`\\Omega_k` is not.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        V : `~astropy.units.Quantity`\n            Comoving volume in :math:`Mpc^3` at each input redshift.\n        ","endLoc":1314,"header":"def comoving_volume(self, z)","id":14532,"name":"comoving_volume","nodeType":"Function","startLoc":1284,"text":"def comoving_volume(self, z):\n        r\"\"\"Comoving volume in cubic Mpc at redshift ``z``.\n\n        This is the volume of the universe encompassed by redshifts less than\n        ``z``. For the case of :math:`\\Omega_k = 0` it is a sphere of radius\n        `comoving_distance` but it is less intuitive if :math:`\\Omega_k` is not.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        V : `~astropy.units.Quantity`\n            Comoving volume in :math:`Mpc^3` at each input redshift.\n        \"\"\"\n        Ok0 = self._Ok0\n        if Ok0 == 0:\n            return 4.0 / 3.0 * pi * self.comoving_distance(z) ** 3\n\n        dh = self._hubble_distance.value  # .value for speed\n        dm = self.comoving_transverse_distance(z).value\n        term1 = 4.0 * pi * dh ** 3 / (2.0 * Ok0) * u.Mpc ** 3\n        term2 = dm / dh * np.sqrt(1 + Ok0 * (dm / dh) ** 2)\n        term3 = sqrt(abs(Ok0)) * dm / dh\n\n        if Ok0 > 0:\n            return term1 * (term2 - 1. / sqrt(abs(Ok0)) * np.arcsinh(term3))\n        else:\n            return term1 * (term2 - 1. / sqrt(abs(Ok0)) * np.arcsin(term3))"},{"col":0,"comment":"Identify if object uses format \"mypackage\".","endLoc":133,"header":"def mypackage_identify(origin, format, *args, **kwargs)","id":14533,"name":"mypackage_identify","nodeType":"Function","startLoc":128,"text":"def mypackage_identify(origin, format, *args, **kwargs):\n    \"\"\"Identify if object uses format \"mypackage\".\"\"\"\n    itis = False\n    if origin == \"read\":\n        itis = isinstance(args[1], MyCosmology) and (format in (None, \"mypackage\"))\n    return itis"},{"attributeType":"null","col":34,"comment":"null","endLoc":25,"id":14534,"name":"cu","nodeType":"Attribute","startLoc":25,"text":"cu"},{"col":0,"comment":"\n    Manual reduceat functionality for cases where Numpy functions don't have a reduceat.\n    It will check if the input function has a reduceat and call that if it does.\n    ","endLoc":33,"header":"def reduceat(array, indices, function)","id":14535,"name":"reduceat","nodeType":"Function","startLoc":16,"text":"def reduceat(array, indices, function):\n    \"\"\"\n    Manual reduceat functionality for cases where Numpy functions don't have a reduceat.\n    It will check if the input function has a reduceat and call that if it does.\n    \"\"\"\n    if len(indices) == 0:\n        return np.array([])\n    elif hasattr(function, 'reduceat'):\n        return np.array(function.reduceat(array, indices))\n    else:\n        result = []\n        for i in range(len(indices) - 1):\n            if indices[i+1] <= indices[i]+1:\n                result.append(function(array[indices[i]]))\n            else:\n                result.append(function(array[indices[i]:indices[i+1]]))\n        result.append(function(array[indices[-1]:]))\n        return np.array(result)"},{"attributeType":"null","col":24,"comment":"null","endLoc":26,"id":14536,"name":"u","nodeType":"Attribute","startLoc":26,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":14537,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":33,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":22,"header":"astropy_convert.py#<anonymous>","id":14538,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nRegister conversion methods for cosmology objects with Astropy Cosmology.\n\nWith this registered, we can start with a Cosmology from\n``mypackage`` and convert it to an astropy Cosmology instance.\n\n    >>> from mypackage.cosmology import myplanck\n    >>> from astropy.cosmology import Cosmology\n    >>> cosmo = Cosmology.from_format(myplanck, format=\"mypackage\")\n    >>> cosmo\n\nWe can also do the reverse: start with an astropy Cosmology and convert it\nto a ``mypackage`` object.\n\n    >>> from astropy.cosmology import Planck18\n    >>> myplanck = Planck18.to_format(\"mypackage\")\n    >>> myplanck\n\n\"\"\"\n\n__doctest_skip__ = ['*']\n\nconvert_registry.register_reader(\"mypackage\", Cosmology, from_mypackage, force=True)\n\nconvert_registry.register_writer(\"mypackage\", Cosmology, to_mypackage, force=True)\n\nconvert_registry.register_identifier(\"mypackage\", Cosmology, mypackage_identify, force=True)"},{"col":4,"comment":"Differential comoving volume at redshift z.\n\n        Useful for calculating the effective comoving volume.\n        For example, allows for integration over a comoving volume that has a\n        sensitivity function that changes with redshift. The total comoving\n        volume is given by integrating ``differential_comoving_volume`` to\n        redshift ``z`` and multiplying by a solid angle.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        dV : `~astropy.units.Quantity`\n            Differential comoving volume per redshift per steradian at each\n            input redshift.\n        ","endLoc":1337,"header":"def differential_comoving_volume(self, z)","id":14539,"name":"differential_comoving_volume","nodeType":"Function","startLoc":1316,"text":"def differential_comoving_volume(self, z):\n        \"\"\"Differential comoving volume at redshift z.\n\n        Useful for calculating the effective comoving volume.\n        For example, allows for integration over a comoving volume that has a\n        sensitivity function that changes with redshift. The total comoving\n        volume is given by integrating ``differential_comoving_volume`` to\n        redshift ``z`` and multiplying by a solid angle.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        dV : `~astropy.units.Quantity`\n            Differential comoving volume per redshift per steradian at each\n            input redshift.\n        \"\"\"\n        dm = self.comoving_transverse_distance(z)\n        return self._hubble_distance * (dm ** 2.0) / (self.efunc(z) << u.steradian)"},{"fileName":"slow_impl.py","filePath":"astropy/timeseries/periodograms/lombscargle/implementations","id":14540,"nodeType":"File","text":"\nimport numpy as np\n\n\ndef lombscargle_slow(t, y, dy, frequency, normalization='standard',\n                     fit_mean=True, center_data=True):\n    \"\"\"Lomb-Scargle Periodogram\n\n    This is a pure-python implementation of the original Lomb-Scargle formalism\n    (e.g. [1]_, [2]_), with the addition of the floating mean (e.g. [3]_)\n\n    Parameters\n    ----------\n    t, y, dy : array-like\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape. None should be `~astropy.units.Quantity`.\n    frequency : array-like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool, optional\n        if True, include a constant offset as part of the model at each\n        frequency. This can lead to more accurate results, especially in the\n        case of incomplete phase coverage.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data. This is especially important if ``fit_mean = False``\n\n    Returns\n    -------\n    power : array-like\n        Lomb-Scargle power associated with each frequency.\n        Units of the result depend on the normalization.\n\n    References\n    ----------\n    .. [1] W. Press et al, Numerical Recipes in C (2002)\n    .. [2] Scargle, J.D. 1982, ApJ 263:835-853\n    .. [3] M. Zechmeister and M. Kurster, A&A 496, 577-584 (2009)\n    \"\"\"\n    if dy is None:\n        dy = 1\n\n    t, y, dy = np.broadcast_arrays(t, y, dy)\n    frequency = np.asarray(frequency)\n\n    if t.ndim != 1:\n        raise ValueError(\"t, y, dy should be one dimensional\")\n    if frequency.ndim != 1:\n        raise ValueError(\"frequency should be one-dimensional\")\n\n    w = dy ** -2.0\n    w /= w.sum()\n\n    # if fit_mean is true, centering the data now simplifies the math below.\n    if fit_mean or center_data:\n        y = y - np.dot(w, y)\n\n    omega = 2 * np.pi * frequency\n    omega = omega.ravel()[np.newaxis, :]\n\n    # make following arrays into column vectors\n    t, y, dy, w = map(lambda x: x[:, np.newaxis], (t, y, dy, w))\n\n    sin_omega_t = np.sin(omega * t)\n    cos_omega_t = np.cos(omega * t)\n\n    # compute time-shift tau\n    # S2 = np.dot(w.T, np.sin(2 * omega * t)\n    S2 = 2 * np.dot(w.T, sin_omega_t * cos_omega_t)\n    # C2 = np.dot(w.T, np.cos(2 * omega * t)\n    C2 = 2 * np.dot(w.T, 0.5 - sin_omega_t ** 2)\n\n    if fit_mean:\n        S = np.dot(w.T, sin_omega_t)\n        C = np.dot(w.T, cos_omega_t)\n\n        S2 -= (2 * S * C)\n        C2 -= (C * C - S * S)\n\n    # compute components needed for the fit\n    omega_t_tau = omega * t - 0.5 * np.arctan2(S2, C2)\n\n    sin_omega_t_tau = np.sin(omega_t_tau)\n    cos_omega_t_tau = np.cos(omega_t_tau)\n\n    Y = np.dot(w.T, y)\n\n    wy = w * y\n\n    YCtau = np.dot(wy.T, cos_omega_t_tau)\n    YStau = np.dot(wy.T, sin_omega_t_tau)\n    CCtau = np.dot(w.T, cos_omega_t_tau * cos_omega_t_tau)\n    SStau = np.dot(w.T, sin_omega_t_tau * sin_omega_t_tau)\n\n    if fit_mean:\n        Ctau = np.dot(w.T, cos_omega_t_tau)\n        Stau = np.dot(w.T, sin_omega_t_tau)\n\n        YCtau -= Y * Ctau\n        YStau -= Y * Stau\n        CCtau -= Ctau * Ctau\n        SStau -= Stau * Stau\n\n    p = (YCtau * YCtau / CCtau + YStau * YStau / SStau)\n    YY = np.dot(w.T, y * y)\n\n    if normalization == 'standard':\n        p /= YY\n    elif normalization == 'model':\n        p /= YY - p\n    elif normalization == 'log':\n        p = -np.log(1 - p / YY)\n    elif normalization == 'psd':\n        p *= 0.5 * (dy ** -2.0).sum()\n    else:\n        raise ValueError(f\"normalization='{normalization}' not recognized\")\n    return p.ravel()\n"},{"col":0,"comment":"Davies upper-bound to the false alarm probability\n\n    (Eqn 5 of Baluev 2008)\n    ","endLoc":298,"header":"def fap_davies(Z, fmax, t, y, dy, normalization='standard')","id":14541,"name":"fap_davies","nodeType":"Function","startLoc":290,"text":"def fap_davies(Z, fmax, t, y, dy, normalization='standard'):\n    \"\"\"Davies upper-bound to the false alarm probability\n\n    (Eqn 5 of Baluev 2008)\n    \"\"\"\n    N = len(t)\n    fap_s = fap_single(Z, N, normalization=normalization)\n    tau = tau_davies(Z, fmax, t, y, dy, normalization=normalization)\n    return fap_s + tau"},{"col":4,"comment":"\n        Separation in transverse comoving kpc corresponding to an arcminute at\n        redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            The distance in comoving kpc corresponding to an arcmin at each\n            input redshift.\n        ","endLoc":1355,"header":"def kpc_comoving_per_arcmin(self, z)","id":14542,"name":"kpc_comoving_per_arcmin","nodeType":"Function","startLoc":1339,"text":"def kpc_comoving_per_arcmin(self, z):\n        \"\"\"\n        Separation in transverse comoving kpc corresponding to an arcminute at\n        redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            The distance in comoving kpc corresponding to an arcmin at each\n            input redshift.\n        \"\"\"\n        return self.comoving_transverse_distance(z).to(u.kpc) / radian_in_arcmin"},{"col":0,"comment":"Inverse of the davies upper-bound","endLoc":311,"header":"@vectorize_first_argument\ndef inv_fap_davies(p, fmax, t, y, dy, normalization='standard')","id":14543,"name":"inv_fap_davies","nodeType":"Function","startLoc":301,"text":"@vectorize_first_argument\ndef inv_fap_davies(p, fmax, t, y, dy, normalization='standard'):\n    \"\"\"Inverse of the davies upper-bound\"\"\"\n    from scipy import optimize\n    args = (fmax, t, y, dy, normalization)\n    z0 = inv_fap_naive(p, *args)\n    func = lambda z, *args: fap_davies(z, *args) - p\n    res = optimize.root(func, z0, args=args, method='lm')\n    if not res.success:\n        raise ValueError(f'inv_fap_baluev did not converge for p={p}')\n    return res.x"},{"col":0,"comment":"\n    Downsample a time series by binning values into bins with a fixed size or\n    custom sizes, using a single function to combine the values in the bin.\n\n    Parameters\n    ----------\n    time_series : :class:`~astropy.timeseries.TimeSeries`\n        The time series to downsample.\n    time_bin_size : `~astropy.units.Quantity` or `~astropy.time.TimeDelta` ['time'], optional\n        The time interval for the binned time series - this is either a scalar\n        value (in which case all time bins will be assumed to have the same\n        duration) or as an array of values (in which case each time bin can\n        have a different duration). If this argument is provided,\n        ``time_bin_end`` should not be provided.\n    time_bin_start : `~astropy.time.Time` or iterable, optional\n        The start time for the binned time series - this can be either given\n        directly as a `~astropy.time.Time` array or as any iterable that\n        initializes the `~astropy.time.Time` class. This can also be a scalar\n        value if ``time_bin_size`` or ``time_bin_end`` is provided.\n        Defaults to the first time in the sampled time series.\n    time_bin_end : `~astropy.time.Time` or iterable, optional\n        The times of the end of each bin - this can be either given directly as\n        a `~astropy.time.Time` array or as any iterable that initializes the\n        `~astropy.time.Time` class. This can only be given if ``time_bin_start``\n        is provided or its default is used. If ``time_bin_end`` is scalar and\n        ``time_bin_start`` is an array, time bins are assumed to be contiguous;\n        the end of each bin is the start of the next one, and ``time_bin_end`` gives\n        the end time for the last bin.  If ``time_bin_end`` is an array and\n        ``time_bin_start`` is scalar, bins will be contiguous. If both ``time_bin_end``\n        and ``time_bin_start`` are arrays, bins do not need to be contiguous.\n        If this argument is provided, ``time_bin_size`` should not be provided.\n    n_bins : int, optional\n        The number of bins to use. Defaults to the number needed to fit all\n        the original points. If both ``time_bin_start`` and ``time_bin_size``\n        are provided and are scalar values, this determines the total bins\n        within that interval. If ``time_bin_start`` is an iterable, this\n        parameter will be ignored.\n    aggregate_func : callable, optional\n        The function to use for combining points in the same bin. Defaults\n        to np.nanmean.\n\n    Returns\n    -------\n    binned_time_series : :class:`~astropy.timeseries.BinnedTimeSeries`\n        The downsampled time series.\n    ","endLoc":216,"header":"def aggregate_downsample(time_series, *, time_bin_size=None, time_bin_start=None,\n                         time_bin_end=None, n_bins=None, aggregate_func=None)","id":14544,"name":"aggregate_downsample","nodeType":"Function","startLoc":36,"text":"def aggregate_downsample(time_series, *, time_bin_size=None, time_bin_start=None,\n                         time_bin_end=None, n_bins=None, aggregate_func=None):\n    \"\"\"\n    Downsample a time series by binning values into bins with a fixed size or\n    custom sizes, using a single function to combine the values in the bin.\n\n    Parameters\n    ----------\n    time_series : :class:`~astropy.timeseries.TimeSeries`\n        The time series to downsample.\n    time_bin_size : `~astropy.units.Quantity` or `~astropy.time.TimeDelta` ['time'], optional\n        The time interval for the binned time series - this is either a scalar\n        value (in which case all time bins will be assumed to have the same\n        duration) or as an array of values (in which case each time bin can\n        have a different duration). If this argument is provided,\n        ``time_bin_end`` should not be provided.\n    time_bin_start : `~astropy.time.Time` or iterable, optional\n        The start time for the binned time series - this can be either given\n        directly as a `~astropy.time.Time` array or as any iterable that\n        initializes the `~astropy.time.Time` class. This can also be a scalar\n        value if ``time_bin_size`` or ``time_bin_end`` is provided.\n        Defaults to the first time in the sampled time series.\n    time_bin_end : `~astropy.time.Time` or iterable, optional\n        The times of the end of each bin - this can be either given directly as\n        a `~astropy.time.Time` array or as any iterable that initializes the\n        `~astropy.time.Time` class. This can only be given if ``time_bin_start``\n        is provided or its default is used. If ``time_bin_end`` is scalar and\n        ``time_bin_start`` is an array, time bins are assumed to be contiguous;\n        the end of each bin is the start of the next one, and ``time_bin_end`` gives\n        the end time for the last bin.  If ``time_bin_end`` is an array and\n        ``time_bin_start`` is scalar, bins will be contiguous. If both ``time_bin_end``\n        and ``time_bin_start`` are arrays, bins do not need to be contiguous.\n        If this argument is provided, ``time_bin_size`` should not be provided.\n    n_bins : int, optional\n        The number of bins to use. Defaults to the number needed to fit all\n        the original points. If both ``time_bin_start`` and ``time_bin_size``\n        are provided and are scalar values, this determines the total bins\n        within that interval. If ``time_bin_start`` is an iterable, this\n        parameter will be ignored.\n    aggregate_func : callable, optional\n        The function to use for combining points in the same bin. Defaults\n        to np.nanmean.\n\n    Returns\n    -------\n    binned_time_series : :class:`~astropy.timeseries.BinnedTimeSeries`\n        The downsampled time series.\n    \"\"\"\n\n    if not isinstance(time_series, TimeSeries):\n        raise TypeError(\"time_series should be a TimeSeries\")\n\n    if time_bin_size is not None and not isinstance(time_bin_size, (u.Quantity, TimeDelta)):\n        raise TypeError(\"'time_bin_size' should be a Quantity or a TimeDelta\")\n\n    if time_bin_start is not None and not isinstance(time_bin_start, (Time, TimeDelta)):\n        time_bin_start = Time(time_bin_start)\n\n    if time_bin_end is not None and not isinstance(time_bin_end, (Time, TimeDelta)):\n        time_bin_end = Time(time_bin_end)\n\n    # Use the table sorted by time\n    ts_sorted = time_series.iloc[:]\n\n    # If start time is not provided, it is assumed to be the start of the timeseries\n    if time_bin_start is None:\n        time_bin_start = ts_sorted.time[0]\n\n    # Total duration of the timeseries is needed for determining either\n    # `time_bin_size` or `nbins` in the case of scalar `time_bin_start`\n    if time_bin_start.isscalar:\n        time_duration = (ts_sorted.time[-1] - time_bin_start).sec\n\n    if time_bin_size is None and time_bin_end is None:\n        if time_bin_start.isscalar:\n            if n_bins is None:\n                raise TypeError(\"With single 'time_bin_start' either 'n_bins', \"\n                                \"'time_bin_size' or time_bin_end' must be provided\")\n            else:\n                # `nbins` defaults to the number needed to fit all points\n                time_bin_size = time_duration / n_bins * u.s\n        else:\n            time_bin_end = np.maximum(ts_sorted.time[-1], time_bin_start[-1])\n\n    if time_bin_start.isscalar:\n        if time_bin_size is not None:\n            if time_bin_size.isscalar:\n                # Determine the number of bins\n                if n_bins is None:\n                    bin_size_sec = time_bin_size.to_value(u.s)\n                    n_bins = int(np.ceil(time_duration/bin_size_sec))\n        elif time_bin_end is not None:\n            if not time_bin_end.isscalar:\n                # Convert start time to an array and populate using `time_bin_end`\n                scalar_start_time = time_bin_start\n                time_bin_start = time_bin_end.replicate(copy=True)\n                time_bin_start[0] = scalar_start_time\n                time_bin_start[1:] = time_bin_end[:-1]\n\n    # Check for overlapping bins, and warn if they are present\n    if time_bin_end is not None:\n        if (not time_bin_end.isscalar and not time_bin_start.isscalar and\n                np.any(time_bin_start[1:] < time_bin_end[:-1])):\n            warnings.warn(\"Overlapping bins should be avoided since they \"\n                          \"can lead to double-counting of data during binning.\",\n                          AstropyUserWarning)\n\n    binned = BinnedTimeSeries(time_bin_size=time_bin_size,\n                              time_bin_start=time_bin_start,\n                              time_bin_end=time_bin_end,\n                              n_bins=n_bins)\n\n    if aggregate_func is None:\n        aggregate_func = np.nanmean\n\n    # Start and end times of the binned timeseries\n    bin_start = binned.time_bin_start\n    bin_end = binned.time_bin_end\n\n    # Set `n_bins` to match the length of `time_bin_start` if\n    # `n_bins` is unspecified or if `time_bin_start` is an iterable\n    if n_bins is None or not time_bin_start.isscalar:\n        n_bins = len(bin_start)\n\n    # Find the subset of the table that is inside the union of all bins\n    keep = ((ts_sorted.time >= bin_start[0]) & (ts_sorted.time <= bin_end[-1]))\n\n    # Find out indices to be removed because of uncontiguous bins\n    for ind in range(n_bins-1):\n        delete_indices = np.where(np.logical_and(ts_sorted.time > bin_end[ind],\n                                                 ts_sorted.time < bin_start[ind+1]))\n        keep[delete_indices] = False\n\n    subset = ts_sorted[keep]\n\n    # Figure out which bin each row falls in by sorting with respect\n    # to the bin end times\n    indices = np.searchsorted(bin_end, ts_sorted.time[keep])\n\n    # For time == bin_start[i+1] == bin_end[i], let bin_start takes precedence\n    if len(indices) and np.all(bin_start[1:] >= bin_end[:-1]):\n        indices_start = np.searchsorted(subset.time, bin_start[bin_start <= ts_sorted.time[-1]])\n        indices[indices_start] = np.arange(len(indices_start))\n\n    # Determine rows where values are defined\n    if len(indices):\n        groups = np.hstack([0, np.nonzero(np.diff(indices))[0] + 1])\n    else:\n        groups = np.array([])\n\n    # Find unique indices to determine which rows in the final time series\n    # will not be empty.\n    unique_indices = np.unique(indices)\n\n    # Add back columns\n\n    for colname in subset.colnames:\n\n        if colname == 'time':\n            continue\n\n        values = subset[colname]\n\n        # FIXME: figure out how to avoid the following, if possible\n        if not isinstance(values, (np.ndarray, u.Quantity)):\n            warnings.warn(\"Skipping column {0} since it has a mix-in type\", AstropyUserWarning)\n            continue\n\n        if isinstance(values, u.Quantity):\n            data = u.Quantity(np.repeat(np.nan,  n_bins), unit=values.unit)\n            data[unique_indices] = u.Quantity(reduceat(values.value, groups, aggregate_func),\n                                              values.unit, copy=False)\n        else:\n            data = np.ma.zeros(n_bins, dtype=values.dtype)\n            data.mask = 1\n            data[unique_indices] = reduceat(values, groups, aggregate_func)\n            data.mask[unique_indices] = 0\n\n        binned[colname] = data\n\n    return binned"},{"col":11,"endLoc":307,"id":14545,"nodeType":"Lambda","startLoc":307,"text":"lambda z, *args: fap_davies(z, *args) - p"},{"col":0,"comment":"Alias-free approximation to false alarm probability\n\n    (Eqn 6 of Baluev 2008)\n    ","endLoc":323,"header":"def fap_baluev(Z, fmax, t, y, dy, normalization='standard')","id":14546,"name":"fap_baluev","nodeType":"Function","startLoc":314,"text":"def fap_baluev(Z, fmax, t, y, dy, normalization='standard'):\n    \"\"\"Alias-free approximation to false alarm probability\n\n    (Eqn 6 of Baluev 2008)\n    \"\"\"\n    fap_s = fap_single(Z, len(t), normalization)\n    tau = tau_davies(Z, fmax, t, y, dy, normalization=normalization)\n    # result is 1 - (1 - fap_s) * np.exp(-tau)\n    # this is much more precise for small numbers\n    return -np.expm1(-tau) + fap_s * np.exp(-tau)"},{"col":4,"comment":"\n        Separation in transverse proper kpc corresponding to an arcminute at\n        redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            The distance in proper kpc corresponding to an arcmin at each input\n            redshift.\n        ","endLoc":1373,"header":"def kpc_proper_per_arcmin(self, z)","id":14547,"name":"kpc_proper_per_arcmin","nodeType":"Function","startLoc":1357,"text":"def kpc_proper_per_arcmin(self, z):\n        \"\"\"\n        Separation in transverse proper kpc corresponding to an arcminute at\n        redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity` ['length']\n            The distance in proper kpc corresponding to an arcmin at each input\n            redshift.\n        \"\"\"\n        return self.angular_diameter_distance(z).to(u.kpc) / radian_in_arcmin"},{"col":19,"endLoc":106,"id":14548,"nodeType":"Lambda","startLoc":106,"text":"lambda m, i: Syw[m][i]"},{"col":19,"endLoc":107,"id":14549,"nodeType":"Lambda","startLoc":107,"text":"lambda m, i: Cyw[m][i]"},{"col":20,"endLoc":108,"id":14550,"nodeType":"Lambda","startLoc":108,"text":"lambda m, n, i: 0.5 * (Cw[abs(m - n)][i] - Cw[m + n][i])"},{"col":20,"endLoc":109,"id":14551,"nodeType":"Lambda","startLoc":109,"text":"lambda m, n, i: 0.5 * (Cw[abs(m - n)][i] + Cw[m + n][i])"},{"col":0,"comment":"Inverse of the Baluev alias-free approximation","endLoc":336,"header":"@vectorize_first_argument\ndef inv_fap_baluev(p, fmax, t, y, dy, normalization='standard')","id":14552,"name":"inv_fap_baluev","nodeType":"Function","startLoc":326,"text":"@vectorize_first_argument\ndef inv_fap_baluev(p, fmax, t, y, dy, normalization='standard'):\n    \"\"\"Inverse of the Baluev alias-free approximation\"\"\"\n    from scipy import optimize\n    args = (fmax, t, y, dy, normalization)\n    z0 = inv_fap_naive(p, *args)\n    func = lambda z, *args: fap_baluev(z, *args) - p\n    res = optimize.root(func, z0, args=args, method='lm')\n    if not res.success:\n        raise ValueError(f'inv_fap_baluev did not converge for p={p}')\n    return res.x"},{"col":20,"endLoc":111,"id":14553,"nodeType":"Lambda","startLoc":110,"text":"lambda m, n, i: 0.5 * (np.sign(m - n) * Sw[abs(m - n)][i]\n                                           + Sw[m + n][i])"},{"col":20,"endLoc":113,"id":14554,"nodeType":"Lambda","startLoc":112,"text":"lambda m, n, i: 0.5 * (np.sign(n - m) * Sw[abs(n - m)][i]\n                                           + Sw[n + m][i])"},{"col":4,"comment":"\n        Angular separation in arcsec corresponding to a comoving kpc at\n        redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        theta : `~astropy.units.Quantity` ['angle']\n            The angular separation in arcsec corresponding to a comoving kpc at\n            each input redshift.\n        ","endLoc":1391,"header":"def arcsec_per_kpc_comoving(self, z)","id":14555,"name":"arcsec_per_kpc_comoving","nodeType":"Function","startLoc":1375,"text":"def arcsec_per_kpc_comoving(self, z):\n        \"\"\"\n        Angular separation in arcsec corresponding to a comoving kpc at\n        redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        theta : `~astropy.units.Quantity` ['angle']\n            The angular separation in arcsec corresponding to a comoving kpc at\n            each input redshift.\n        \"\"\"\n        return radian_in_arcsec / self.comoving_transverse_distance(z).to(u.kpc)"},{"col":11,"endLoc":332,"id":14556,"nodeType":"Lambda","startLoc":332,"text":"lambda z, *args: fap_baluev(z, *args) - p"},{"col":0,"comment":"Generate a sequence of bootstrap estimates of the max","endLoc":354,"header":"def _bootstrap_max(t, y, dy, fmax, normalization, random_seed, n_bootstrap=1000)","id":14557,"name":"_bootstrap_max","nodeType":"Function","startLoc":339,"text":"def _bootstrap_max(t, y, dy, fmax, normalization, random_seed, n_bootstrap=1000):\n    \"\"\"Generate a sequence of bootstrap estimates of the max\"\"\"\n    from .core import LombScargle\n    rng = np.random.default_rng(random_seed)\n    power_max = []\n    for _ in range(n_bootstrap):\n        s = rng.integers(0, len(y), len(y))  # sample with replacement\n        ls_boot = LombScargle(t, y[s], dy if dy is None else dy[s],\n                              normalization=normalization)\n        freq, power = ls_boot.autopower(maximum_frequency=fmax)\n        power_max.append(power.max())\n\n    power_max = u.Quantity(power_max)\n    power_max.sort()\n\n    return power_max"},{"col":4,"comment":"\n        Angular separation in arcsec corresponding to a proper kpc at redshift\n        ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        theta : `~astropy.units.Quantity` ['angle']\n            The angular separation in arcsec corresponding to a proper kpc at\n            each input redshift.\n        ","endLoc":1409,"header":"def arcsec_per_kpc_proper(self, z)","id":14558,"name":"arcsec_per_kpc_proper","nodeType":"Function","startLoc":1393,"text":"def arcsec_per_kpc_proper(self, z):\n        \"\"\"\n        Angular separation in arcsec corresponding to a proper kpc at redshift\n        ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        theta : `~astropy.units.Quantity` ['angle']\n            The angular separation in arcsec corresponding to a proper kpc at\n            each input redshift.\n        \"\"\"\n        return radian_in_arcsec / self.angular_diameter_distance(z).to(u.kpc)"},{"col":0,"comment":"Lomb-Scargle Periodogram\n\n    This is a pure-python implementation of the original Lomb-Scargle formalism\n    (e.g. [1]_, [2]_), with the addition of the floating mean (e.g. [3]_)\n\n    Parameters\n    ----------\n    t, y, dy : array-like\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape. None should be `~astropy.units.Quantity`.\n    frequency : array-like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool, optional\n        if True, include a constant offset as part of the model at each\n        frequency. This can lead to more accurate results, especially in the\n        case of incomplete phase coverage.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data. This is especially important if ``fit_mean = False``\n\n    Returns\n    -------\n    power : array-like\n        Lomb-Scargle power associated with each frequency.\n        Units of the result depend on the normalization.\n\n    References\n    ----------\n    .. [1] W. Press et al, Numerical Recipes in C (2002)\n    .. [2] Scargle, J.D. 1982, ApJ 263:835-853\n    .. [3] M. Zechmeister and M. Kurster, A&A 496, 577-584 (2009)\n    ","endLoc":119,"header":"def lombscargle_slow(t, y, dy, frequency, normalization='standard',\n                     fit_mean=True, center_data=True)","id":14560,"name":"lombscargle_slow","nodeType":"Function","startLoc":5,"text":"def lombscargle_slow(t, y, dy, frequency, normalization='standard',\n                     fit_mean=True, center_data=True):\n    \"\"\"Lomb-Scargle Periodogram\n\n    This is a pure-python implementation of the original Lomb-Scargle formalism\n    (e.g. [1]_, [2]_), with the addition of the floating mean (e.g. [3]_)\n\n    Parameters\n    ----------\n    t, y, dy : array-like\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape. None should be `~astropy.units.Quantity`.\n    frequency : array-like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool, optional\n        if True, include a constant offset as part of the model at each\n        frequency. This can lead to more accurate results, especially in the\n        case of incomplete phase coverage.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data. This is especially important if ``fit_mean = False``\n\n    Returns\n    -------\n    power : array-like\n        Lomb-Scargle power associated with each frequency.\n        Units of the result depend on the normalization.\n\n    References\n    ----------\n    .. [1] W. Press et al, Numerical Recipes in C (2002)\n    .. [2] Scargle, J.D. 1982, ApJ 263:835-853\n    .. [3] M. Zechmeister and M. Kurster, A&A 496, 577-584 (2009)\n    \"\"\"\n    if dy is None:\n        dy = 1\n\n    t, y, dy = np.broadcast_arrays(t, y, dy)\n    frequency = np.asarray(frequency)\n\n    if t.ndim != 1:\n        raise ValueError(\"t, y, dy should be one dimensional\")\n    if frequency.ndim != 1:\n        raise ValueError(\"frequency should be one-dimensional\")\n\n    w = dy ** -2.0\n    w /= w.sum()\n\n    # if fit_mean is true, centering the data now simplifies the math below.\n    if fit_mean or center_data:\n        y = y - np.dot(w, y)\n\n    omega = 2 * np.pi * frequency\n    omega = omega.ravel()[np.newaxis, :]\n\n    # make following arrays into column vectors\n    t, y, dy, w = map(lambda x: x[:, np.newaxis], (t, y, dy, w))\n\n    sin_omega_t = np.sin(omega * t)\n    cos_omega_t = np.cos(omega * t)\n\n    # compute time-shift tau\n    # S2 = np.dot(w.T, np.sin(2 * omega * t)\n    S2 = 2 * np.dot(w.T, sin_omega_t * cos_omega_t)\n    # C2 = np.dot(w.T, np.cos(2 * omega * t)\n    C2 = 2 * np.dot(w.T, 0.5 - sin_omega_t ** 2)\n\n    if fit_mean:\n        S = np.dot(w.T, sin_omega_t)\n        C = np.dot(w.T, cos_omega_t)\n\n        S2 -= (2 * S * C)\n        C2 -= (C * C - S * S)\n\n    # compute components needed for the fit\n    omega_t_tau = omega * t - 0.5 * np.arctan2(S2, C2)\n\n    sin_omega_t_tau = np.sin(omega_t_tau)\n    cos_omega_t_tau = np.cos(omega_t_tau)\n\n    Y = np.dot(w.T, y)\n\n    wy = w * y\n\n    YCtau = np.dot(wy.T, cos_omega_t_tau)\n    YStau = np.dot(wy.T, sin_omega_t_tau)\n    CCtau = np.dot(w.T, cos_omega_t_tau * cos_omega_t_tau)\n    SStau = np.dot(w.T, sin_omega_t_tau * sin_omega_t_tau)\n\n    if fit_mean:\n        Ctau = np.dot(w.T, cos_omega_t_tau)\n        Stau = np.dot(w.T, sin_omega_t_tau)\n\n        YCtau -= Y * Ctau\n        YStau -= Y * Stau\n        CCtau -= Ctau * Ctau\n        SStau -= Stau * Stau\n\n    p = (YCtau * YCtau / CCtau + YStau * YStau / SStau)\n    YY = np.dot(w.T, y * y)\n\n    if normalization == 'standard':\n        p /= YY\n    elif normalization == 'model':\n        p /= YY - p\n    elif normalization == 'log':\n        p = -np.log(1 - p / YY)\n    elif normalization == 'psd':\n        p *= 0.5 * (dy ** -2.0).sum()\n    else:\n        raise ValueError(f\"normalization='{normalization}' not recognized\")\n    return p.ravel()"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":118,"id":14561,"name":"H0","nodeType":"Attribute","startLoc":118,"text":"H0"},{"attributeType":"null","col":16,"comment":"null","endLoc":2,"id":14562,"name":"np","nodeType":"Attribute","startLoc":2,"text":"np"},{"fileName":"fast_impl.py","filePath":"astropy/timeseries/periodograms/lombscargle/implementations","id":14563,"nodeType":"File","text":"\nimport numpy as np\nfrom .utils import trig_sum\n\n\ndef lombscargle_fast(t, y, dy, f0, df, Nf,\n                     center_data=True, fit_mean=True,\n                     normalization='standard',\n                     use_fft=True, trig_sum_kwds=None):\n    \"\"\"Fast Lomb-Scargle Periodogram\n\n    This implements the Press & Rybicki method [1]_ for fast O[N log(N)]\n    Lomb-Scargle periodograms.\n\n    Parameters\n    ----------\n    t, y, dy : array-like\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape. None should be `~astropy.units.Quantity`.\n    f0, df, Nf : (float, float, int)\n        parameters describing the frequency grid, f = f0 + df * arange(Nf).\n    center_data : bool (default=True)\n        Specify whether to subtract the mean of the data before the fit\n    fit_mean : bool (default=True)\n        If True, then compute the floating-mean periodogram; i.e. let the mean\n        vary with the fit.\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    use_fft : bool (default=True)\n        If True, then use the Press & Rybicki O[NlogN] algorithm to compute\n        the result. Otherwise, use a slower O[N^2] algorithm\n    trig_sum_kwds : dict or None, optional\n        extra keyword arguments to pass to the ``trig_sum`` utility.\n        Options are ``oversampling`` and ``Mfft``. See documentation\n        of ``trig_sum`` for details.\n\n    Returns\n    -------\n    power : ndarray\n        Lomb-Scargle power associated with each frequency.\n        Units of the result depend on the normalization.\n\n    Notes\n    -----\n    Note that the ``use_fft=True`` algorithm is an approximation to the true\n    Lomb-Scargle periodogram, and as the number of points grows this\n    approximation improves. On the other hand, for very small datasets\n    (<~50 points or so) this approximation may not be useful.\n\n    References\n    ----------\n    .. [1] Press W.H. and Rybicki, G.B, \"Fast algorithm for spectral analysis\n        of unevenly sampled data\". ApJ 1:338, p277, 1989\n    .. [2] M. Zechmeister and M. Kurster, A&A 496, 577-584 (2009)\n    .. [3] W. Press et al, Numerical Recipes in C (2002)\n    \"\"\"\n    if dy is None:\n        dy = 1\n\n    # Validate and setup input data\n    t, y, dy = np.broadcast_arrays(t, y, dy)\n    if t.ndim != 1:\n        raise ValueError(\"t, y, dy should be one dimensional\")\n\n    # Validate and setup frequency grid\n    if f0 < 0:\n        raise ValueError(\"Frequencies must be positive\")\n    if df <= 0:\n        raise ValueError(\"Frequency steps must be positive\")\n    if Nf <= 0:\n        raise ValueError(\"Number of frequencies must be positive\")\n\n    w = dy ** -2.0\n    w /= w.sum()\n\n    # Center the data. Even if we're fitting the offset,\n    # this step makes the expressions below more succinct\n    if center_data or fit_mean:\n        y = y - np.dot(w, y)\n\n    # set up arguments to trig_sum\n    kwargs = dict.copy(trig_sum_kwds or {})\n    kwargs.update(f0=f0, df=df, use_fft=use_fft, N=Nf)\n\n    # ----------------------------------------------------------------------\n    # 1. compute functions of the time-shift tau at each frequency\n    Sh, Ch = trig_sum(t, w * y, **kwargs)\n    S2, C2 = trig_sum(t, w, freq_factor=2, **kwargs)\n\n    if fit_mean:\n        S, C = trig_sum(t, w, **kwargs)\n        tan_2omega_tau = (S2 - 2 * S * C) / (C2 - (C * C - S * S))\n    else:\n        tan_2omega_tau = S2 / C2\n\n    # This is what we're computing below; the straightforward way is slower\n    # and less stable, so we use trig identities instead\n    #\n    # omega_tau = 0.5 * np.arctan(tan_2omega_tau)\n    # S2w, C2w = np.sin(2 * omega_tau), np.cos(2 * omega_tau)\n    # Sw, Cw = np.sin(omega_tau), np.cos(omega_tau)\n\n    S2w = tan_2omega_tau / np.sqrt(1 + tan_2omega_tau * tan_2omega_tau)\n    C2w = 1 / np.sqrt(1 + tan_2omega_tau * tan_2omega_tau)\n    Cw = np.sqrt(0.5) * np.sqrt(1 + C2w)\n    Sw = np.sqrt(0.5) * np.sign(S2w) * np.sqrt(1 - C2w)\n\n    # ----------------------------------------------------------------------\n    # 2. Compute the periodogram, following Zechmeister & Kurster\n    #    and using tricks from Press & Rybicki.\n    YY = np.dot(w, y ** 2)\n    YC = Ch * Cw + Sh * Sw\n    YS = Sh * Cw - Ch * Sw\n    CC = 0.5 * (1 + C2 * C2w + S2 * S2w)\n    SS = 0.5 * (1 - C2 * C2w - S2 * S2w)\n\n    if fit_mean:\n        CC -= (C * Cw + S * Sw) ** 2\n        SS -= (S * Cw - C * Sw) ** 2\n\n    power = (YC * YC / CC + YS * YS / SS)\n\n    if normalization == 'standard':\n        power /= YY\n    elif normalization == 'model':\n        power /= YY - power\n    elif normalization == 'log':\n        power = -np.log(1 - power / YY)\n    elif normalization == 'psd':\n        power *= 0.5 * (dy ** -2.0).sum()\n    else:\n        raise ValueError(f\"normalization='{normalization}' not recognized\")\n\n    return power\n"},{"col":0,"comment":"Fast Lomb-Scargle Periodogram\n\n    This implements the Press & Rybicki method [1]_ for fast O[N log(N)]\n    Lomb-Scargle periodograms.\n\n    Parameters\n    ----------\n    t, y, dy : array-like\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape. None should be `~astropy.units.Quantity`.\n    f0, df, Nf : (float, float, int)\n        parameters describing the frequency grid, f = f0 + df * arange(Nf).\n    center_data : bool (default=True)\n        Specify whether to subtract the mean of the data before the fit\n    fit_mean : bool (default=True)\n        If True, then compute the floating-mean periodogram; i.e. let the mean\n        vary with the fit.\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    use_fft : bool (default=True)\n        If True, then use the Press & Rybicki O[NlogN] algorithm to compute\n        the result. Otherwise, use a slower O[N^2] algorithm\n    trig_sum_kwds : dict or None, optional\n        extra keyword arguments to pass to the ``trig_sum`` utility.\n        Options are ``oversampling`` and ``Mfft``. See documentation\n        of ``trig_sum`` for details.\n\n    Returns\n    -------\n    power : ndarray\n        Lomb-Scargle power associated with each frequency.\n        Units of the result depend on the normalization.\n\n    Notes\n    -----\n    Note that the ``use_fft=True`` algorithm is an approximation to the true\n    Lomb-Scargle periodogram, and as the number of points grows this\n    approximation improves. On the other hand, for very small datasets\n    (<~50 points or so) this approximation may not be useful.\n\n    References\n    ----------\n    .. [1] Press W.H. and Rybicki, G.B, \"Fast algorithm for spectral analysis\n        of unevenly sampled data\". ApJ 1:338, p277, 1989\n    .. [2] M. Zechmeister and M. Kurster, A&A 496, 577-584 (2009)\n    .. [3] W. Press et al, Numerical Recipes in C (2002)\n    ","endLoc":135,"header":"def lombscargle_fast(t, y, dy, f0, df, Nf,\n                     center_data=True, fit_mean=True,\n                     normalization='standard',\n                     use_fft=True, trig_sum_kwds=None)","id":14564,"name":"lombscargle_fast","nodeType":"Function","startLoc":6,"text":"def lombscargle_fast(t, y, dy, f0, df, Nf,\n                     center_data=True, fit_mean=True,\n                     normalization='standard',\n                     use_fft=True, trig_sum_kwds=None):\n    \"\"\"Fast Lomb-Scargle Periodogram\n\n    This implements the Press & Rybicki method [1]_ for fast O[N log(N)]\n    Lomb-Scargle periodograms.\n\n    Parameters\n    ----------\n    t, y, dy : array-like\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape. None should be `~astropy.units.Quantity`.\n    f0, df, Nf : (float, float, int)\n        parameters describing the frequency grid, f = f0 + df * arange(Nf).\n    center_data : bool (default=True)\n        Specify whether to subtract the mean of the data before the fit\n    fit_mean : bool (default=True)\n        If True, then compute the floating-mean periodogram; i.e. let the mean\n        vary with the fit.\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    use_fft : bool (default=True)\n        If True, then use the Press & Rybicki O[NlogN] algorithm to compute\n        the result. Otherwise, use a slower O[N^2] algorithm\n    trig_sum_kwds : dict or None, optional\n        extra keyword arguments to pass to the ``trig_sum`` utility.\n        Options are ``oversampling`` and ``Mfft``. See documentation\n        of ``trig_sum`` for details.\n\n    Returns\n    -------\n    power : ndarray\n        Lomb-Scargle power associated with each frequency.\n        Units of the result depend on the normalization.\n\n    Notes\n    -----\n    Note that the ``use_fft=True`` algorithm is an approximation to the true\n    Lomb-Scargle periodogram, and as the number of points grows this\n    approximation improves. On the other hand, for very small datasets\n    (<~50 points or so) this approximation may not be useful.\n\n    References\n    ----------\n    .. [1] Press W.H. and Rybicki, G.B, \"Fast algorithm for spectral analysis\n        of unevenly sampled data\". ApJ 1:338, p277, 1989\n    .. [2] M. Zechmeister and M. Kurster, A&A 496, 577-584 (2009)\n    .. [3] W. Press et al, Numerical Recipes in C (2002)\n    \"\"\"\n    if dy is None:\n        dy = 1\n\n    # Validate and setup input data\n    t, y, dy = np.broadcast_arrays(t, y, dy)\n    if t.ndim != 1:\n        raise ValueError(\"t, y, dy should be one dimensional\")\n\n    # Validate and setup frequency grid\n    if f0 < 0:\n        raise ValueError(\"Frequencies must be positive\")\n    if df <= 0:\n        raise ValueError(\"Frequency steps must be positive\")\n    if Nf <= 0:\n        raise ValueError(\"Number of frequencies must be positive\")\n\n    w = dy ** -2.0\n    w /= w.sum()\n\n    # Center the data. Even if we're fitting the offset,\n    # this step makes the expressions below more succinct\n    if center_data or fit_mean:\n        y = y - np.dot(w, y)\n\n    # set up arguments to trig_sum\n    kwargs = dict.copy(trig_sum_kwds or {})\n    kwargs.update(f0=f0, df=df, use_fft=use_fft, N=Nf)\n\n    # ----------------------------------------------------------------------\n    # 1. compute functions of the time-shift tau at each frequency\n    Sh, Ch = trig_sum(t, w * y, **kwargs)\n    S2, C2 = trig_sum(t, w, freq_factor=2, **kwargs)\n\n    if fit_mean:\n        S, C = trig_sum(t, w, **kwargs)\n        tan_2omega_tau = (S2 - 2 * S * C) / (C2 - (C * C - S * S))\n    else:\n        tan_2omega_tau = S2 / C2\n\n    # This is what we're computing below; the straightforward way is slower\n    # and less stable, so we use trig identities instead\n    #\n    # omega_tau = 0.5 * np.arctan(tan_2omega_tau)\n    # S2w, C2w = np.sin(2 * omega_tau), np.cos(2 * omega_tau)\n    # Sw, Cw = np.sin(omega_tau), np.cos(omega_tau)\n\n    S2w = tan_2omega_tau / np.sqrt(1 + tan_2omega_tau * tan_2omega_tau)\n    C2w = 1 / np.sqrt(1 + tan_2omega_tau * tan_2omega_tau)\n    Cw = np.sqrt(0.5) * np.sqrt(1 + C2w)\n    Sw = np.sqrt(0.5) * np.sign(S2w) * np.sqrt(1 - C2w)\n\n    # ----------------------------------------------------------------------\n    # 2. Compute the periodogram, following Zechmeister & Kurster\n    #    and using tricks from Press & Rybicki.\n    YY = np.dot(w, y ** 2)\n    YC = Ch * Cw + Sh * Sw\n    YS = Sh * Cw - Ch * Sw\n    CC = 0.5 * (1 + C2 * C2w + S2 * S2w)\n    SS = 0.5 * (1 - C2 * C2w - S2 * S2w)\n\n    if fit_mean:\n        CC -= (C * Cw + S * Sw) ** 2\n        SS -= (S * Cw - C * Sw) ** 2\n\n    power = (YC * YC / CC + YS * YS / SS)\n\n    if normalization == 'standard':\n        power /= YY\n    elif normalization == 'model':\n        power /= YY - power\n    elif normalization == 'log':\n        power = -np.log(1 - power / YY)\n    elif normalization == 'psd':\n        power *= 0.5 * (dy ** -2.0).sum()\n    else:\n        raise ValueError(f\"normalization='{normalization}' not recognized\")\n\n    return power"},{"col":4,"comment":"null","endLoc":256,"header":"def __getitem__(self, item)","id":14565,"name":"__getitem__","nodeType":"Function","startLoc":247,"text":"def __getitem__(self, item):\n        if self._is_list_or_tuple_of_str(item):\n            if 'time' not in item:\n                out = QTable([self[x] for x in item],\n                             meta=deepcopy(self.meta),\n                             copy_indices=self._copy_indices)\n                out._groups = groups.TableGroups(out, indices=self.groups._indices,\n                                                 keys=self.groups._keys)\n                return out\n        return super().__getitem__(item)"},{"col":22,"endLoc":64,"id":14566,"nodeType":"Lambda","startLoc":64,"text":"lambda x: x[:, np.newaxis]"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":120,"id":14567,"name":"Om0","nodeType":"Attribute","startLoc":120,"text":"Om0"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":122,"id":14568,"name":"Ode0","nodeType":"Attribute","startLoc":122,"text":"Ode0"},{"col":4,"comment":"\n        See :meth:`~astropy.table.Table.add_columns`.\n        ","endLoc":276,"header":"def add_columns(self, *args, **kwargs)","id":14569,"name":"add_columns","nodeType":"Function","startLoc":268,"text":"def add_columns(self, *args, **kwargs):\n        \"\"\"\n        See :meth:`~astropy.table.Table.add_columns`.\n        \"\"\"\n        # Note that the docstring is inherited from QTable\n        result = super().add_columns(*args, **kwargs)\n        if len(self.indices) == 0 and 'time' in self.colnames:\n            self.add_index('time')\n        return result"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":124,"id":14570,"name":"Tcmb0","nodeType":"Attribute","startLoc":124,"text":"Tcmb0"},{"col":0,"comment":"Bootstrap estimate of the false alarm probability","endLoc":363,"header":"def fap_bootstrap(Z, fmax, t, y, dy, normalization='standard',\n                  n_bootstraps=1000, random_seed=None)","id":14571,"name":"fap_bootstrap","nodeType":"Function","startLoc":357,"text":"def fap_bootstrap(Z, fmax, t, y, dy, normalization='standard',\n                  n_bootstraps=1000, random_seed=None):\n    \"\"\"Bootstrap estimate of the false alarm probability\"\"\"\n    pmax = _bootstrap_max(t, y, dy, fmax, normalization, random_seed,\n                          n_bootstraps)\n\n    return 1 - np.searchsorted(pmax, Z) / len(pmax)"},{"col":0,"comment":"Bootstrap estimate of the inverse false alarm probability","endLoc":374,"header":"def inv_fap_bootstrap(fap, fmax, t, y, dy, normalization='standard',\n                      n_bootstraps=1000, random_seed=None)","id":14572,"name":"inv_fap_bootstrap","nodeType":"Function","startLoc":366,"text":"def inv_fap_bootstrap(fap, fmax, t, y, dy, normalization='standard',\n                      n_bootstraps=1000, random_seed=None):\n    \"\"\"Bootstrap estimate of the inverse false alarm probability\"\"\"\n    fap = np.asarray(fap)\n    pmax = _bootstrap_max(t, y, dy, fmax, normalization, random_seed,\n                          n_bootstraps)\n\n    return pmax[np.clip(np.floor((1 - fap) * len(pmax)).astype(int),\n                        0, len(pmax) - 1)]"},{"col":4,"comment":"\n        Convert a :class:`~pandas.DataFrame` to a\n        :class:`astropy.timeseries.TimeSeries`.\n\n        Parameters\n        ----------\n        df : :class:`pandas.DataFrame`\n            A pandas :class:`pandas.DataFrame` instance.\n        time_scale : str\n            The time scale to pass into `astropy.time.Time`.\n            Defaults to ``UTC``.\n\n        ","endLoc":304,"header":"@classmethod\n    def from_pandas(self, df, time_scale='utc')","id":14573,"name":"from_pandas","nodeType":"Function","startLoc":278,"text":"@classmethod\n    def from_pandas(self, df, time_scale='utc'):\n        \"\"\"\n        Convert a :class:`~pandas.DataFrame` to a\n        :class:`astropy.timeseries.TimeSeries`.\n\n        Parameters\n        ----------\n        df : :class:`pandas.DataFrame`\n            A pandas :class:`pandas.DataFrame` instance.\n        time_scale : str\n            The time scale to pass into `astropy.time.Time`.\n            Defaults to ``UTC``.\n\n        \"\"\"\n        from pandas import DataFrame, DatetimeIndex\n\n        if not isinstance(df, DataFrame):\n            raise TypeError(\"Input should be a pandas DataFrame\")\n\n        if not isinstance(df.index, DatetimeIndex):\n            raise TypeError(\"DataFrame does not have a DatetimeIndex\")\n\n        time = Time(df.index, scale=time_scale)\n        table = Table.from_pandas(df)\n\n        return TimeSeries(time=time, data=table)"},{"attributeType":"null","col":16,"comment":"null","endLoc":2,"id":14574,"name":"np","nodeType":"Attribute","startLoc":2,"text":"np"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":126,"id":14575,"name":"Neff","nodeType":"Attribute","startLoc":126,"text":"Neff"},{"id":14576,"name":"cython_impl.pyx","nodeType":"TextFile","path":"astropy/timeseries/periodograms/lombscargle/implementations","text":"#cython: language_level=3\n\nimport numpy as np\ncimport numpy as np\n\ncimport cython\n\ncdef extern from \"math.h\":\n    double sin(double)\n    double cos(double)\n    double atan2(double, double)\n\nDTYPE = np.float64\nctypedef np.float64_t DTYPE_t\n\nITYPE = np.intp\nctypedef np.intp_t ITYPE_t\n\n\ndef lombscargle_cython(t, y, dy, frequency, normalization='standard',\n                       fit_mean=True, center_data=True):\n    \"\"\"Lomb-Scargle Periodogram\n\n    This is a pure-python implementation of the original Lomb-Scargle formalism\n    (e.g. [1]_, [2]_), with the addition of the floating mean (e.g. [3]_)\n\n    Parameters\n    ----------\n    t, y, dy : array-like\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape. None should be `~astropy.units.Quantity`.\n    frequency : array-like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool, optional\n        if True, include a constant offset as part of the model at each\n        frequency. This can lead to more accurate results, especially in the\n        case of incomplete phase coverage.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data. This is especially important if ``fit_mean = False``\n\n    Returns\n    -------\n    power : array-like\n        Lomb-Scargle power associated with each frequency.\n        Units of the result depend on the normalization.\n\n    References\n    ----------\n    .. [1] W. Press et al, Numerical Recipes in C (2002)\n    .. [2] Scargle, J.D. 1982, ApJ 263:835-853\n    .. [3] M. Zechmeister and M. Kurster, A&A 496, 577-584 (2009)\n    \"\"\"\n    if dy is None:\n        dy = 1\n\n    t, y, dy = np.broadcast_arrays(t, y, dy)\n    t = np.asarray(t, dtype=DTYPE, order='C')\n    y = np.asarray(y, dtype=DTYPE, order='C')\n    dy = np.asarray(dy, dtype=DTYPE, order='C')\n    frequency = np.asarray(frequency, dtype=DTYPE, order='C')\n\n    if t.ndim != 1:\n        raise ValueError(\"t, y, dy should be one dimensional\")\n    if frequency.ndim != 1:\n        raise ValueError(\"frequency should be one-dimensional\")\n\n    PLS = np.zeros(frequency.shape, dtype=DTYPE, order='C')\n\n    # pre-center the data: not technically required if fit_mean=True,\n    # but it simplifies the math.\n    if fit_mean or center_data:\n        # compute MLE for mean in the presence of noise.\n        w = dy ** -2\n        y = y - np.dot(w, y) / np.sum(w)\n\n    if fit_mean:\n        _generalized_lomb_scargle(t, y, dy, 2 * np.pi * frequency, PLS)\n    else:\n        _standard_lomb_scargle(t, y, dy, 2 * np.pi * frequency, PLS)\n\n    if normalization == 'standard':\n        pass\n    elif normalization == 'model':\n        return PLS / (1 - PLS)\n    elif normalization == 'log':\n        return -np.log(1 - PLS)\n    elif normalization == 'psd':\n        w = dy ** -2\n        PLS *= 0.5 * np.dot(w, y * y)\n    else:\n        raise ValueError(\"normalization='{0}' \"\n                         \"not recognized\".format(normalization))\n    return PLS.ravel()\n\n\n@cython.cdivision(True)\n@cython.boundscheck(False)\n@cython.wraparound(False)\ncdef _standard_lomb_scargle(const DTYPE_t[::1] t, const DTYPE_t[::1] y, const DTYPE_t[::1] dy,\n                            const DTYPE_t[::1] omega, DTYPE_t[::1] PLS):\n    cdef ITYPE_t N_freq = omega.shape[0]\n    cdef ITYPE_t N_obs = t.shape[0]\n\n    cdef DTYPE_t w, omega_t, sin_omega_t, cos_omega_t\n    cdef DTYPE_t S2, C2, tau, Y, wsum, YY, YCtau, YStau, CCtau, SStau\n\n    for i in range(N_freq):\n        # first pass: determine tau\n        S2 = 0\n        C2 = 0\n        for j in range(N_obs):\n            w = 1. / dy[j]\n            w *= w\n\n            omega_t = omega[i] * t[j]\n            sin_omega_t = sin(omega_t)\n            cos_omega_t = cos(omega_t)\n\n            S2 += 2 * w * sin_omega_t * cos_omega_t\n            C2 += w * (1 - 2 * sin_omega_t * sin_omega_t)\n\n        tau = 0.5 * atan2(S2, C2) / omega[i]\n\n        wsum = 0\n        Y = 0\n        YY = 0\n        YCtau = 0\n        YStau = 0\n        CCtau = 0\n        SStau = 0\n\n        # second pass: compute the power\n        for j in range(N_obs):\n            w = 1. / dy[j]\n            w *= w\n            wsum += w\n\n            omega_t = omega[i] * (t[j] - tau)\n            sin_omega_t = sin(omega_t)\n            cos_omega_t = cos(omega_t)\n\n            Y += w * y[j]\n            YY += w * y[j] * y[j]\n            YCtau += w * y[j] * cos_omega_t\n            YStau += w * y[j] * sin_omega_t\n            CCtau += w * cos_omega_t * cos_omega_t\n            SStau += w * sin_omega_t * sin_omega_t\n\n        Y /= wsum\n        YY /= wsum\n        YCtau /= wsum\n        YStau /= wsum\n        CCtau /= wsum\n        SStau /= wsum\n\n        PLS[i] = (YCtau * YCtau / CCtau + YStau * YStau / SStau) / YY\n\n\n@cython.cdivision(True)\n@cython.boundscheck(False)\n@cython.wraparound(False)\ncdef _generalized_lomb_scargle(const DTYPE_t[::1] t, const DTYPE_t[::1] y, const DTYPE_t[::1] dy,\n                               const DTYPE_t[::1] omega, DTYPE_t[::1] PLS):\n    cdef ITYPE_t N_freq = omega.shape[0]\n    cdef ITYPE_t N_obs = t.shape[0]\n\n    cdef DTYPE_t w, omega_t, sin_omega_t, cos_omega_t\n    cdef DTYPE_t S, C, S2, C2, tau, Y, wsum, YY\n    cdef DTYPE_t Stau, Ctau, YCtau, YStau, CCtau, SStau\n\n    for i in range(N_freq):\n        # first pass: determine tau\n        wsum = 0\n        S = 0\n        C = 0\n        S2 = 0\n        C2 = 0\n        for j in range(N_obs):\n            w = 1. / dy[j]\n            w *= w\n            wsum += w\n\n            omega_t = omega[i] * t[j]\n            sin_omega_t = sin(omega_t)\n            cos_omega_t = cos(omega_t)\n\n            S += w * sin_omega_t\n            C += w * cos_omega_t\n\n            S2 += 2 * w * sin_omega_t * cos_omega_t\n            C2 += w - 2 * w * sin_omega_t * sin_omega_t\n\n        S2 /= wsum\n        C2 /= wsum\n        S /= wsum\n        C /= wsum\n\n        S2 -= (2 * S * C)\n        C2 -= (C * C - S * S)\n\n        tau = 0.5 * atan2(S2, C2) / omega[i]\n\n        Y = 0\n        YY = 0\n        Stau = 0\n        Ctau = 0\n        YCtau = 0\n        YStau = 0\n        CCtau = 0\n        SStau = 0\n\n        # second pass: compute the power\n        for j in range(N_obs):\n            w = 1. / dy[j]\n            w *= w\n\n            omega_t = omega[i] * (t[j] - tau)\n            sin_omega_t = sin(omega_t)\n            cos_omega_t = cos(omega_t)\n\n            Y += w * y[j]\n            YY += w * y[j] * y[j]\n            Ctau += w * cos_omega_t\n            Stau += w * sin_omega_t\n            YCtau += w * y[j] * cos_omega_t\n            YStau += w * y[j] * sin_omega_t\n            CCtau += w * cos_omega_t * cos_omega_t\n            SStau += w * sin_omega_t * sin_omega_t\n\n        Y /= wsum\n        YY /= wsum\n        Ctau /= wsum\n        Stau /= wsum\n        YCtau /= wsum\n        YStau /= wsum\n        CCtau /= wsum\n        SStau /= wsum\n\n        YCtau -= Y * Ctau\n        YStau -= Y * Stau\n        CCtau -= Ctau * Ctau\n        SStau -= Stau * Stau\n\n        YY -= Y * Y\n\n        PLS[i] = (YCtau * YCtau / CCtau + YStau * YStau / SStau) / YY\n"},{"fileName":"__init__.py","filePath":"astropy/timeseries/periodograms/lombscargle/implementations","id":14577,"nodeType":"File","text":"\"\"\"Various implementations of the Lomb-Scargle Periodogram\"\"\"\n\nfrom .main import lombscargle, available_methods\nfrom .chi2_impl import lombscargle_chi2\nfrom .scipy_impl import lombscargle_scipy\nfrom .slow_impl import lombscargle_slow\nfrom .fast_impl import lombscargle_fast\nfrom .fastchi2_impl import lombscargle_fastchi2\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":377,"id":14578,"name":"METHODS","nodeType":"Attribute","startLoc":377,"text":"METHODS"},{"col":0,"comment":"Lomb-Scargle Periodogram\n\n    This implements a chi-squared-based periodogram, which is relatively slow\n    but useful for validating the faster algorithms in the package.\n\n    Parameters\n    ----------\n    t, y, dy : array-like\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape. None should be `~astropy.units.Quantity``.\n    frequency : array-like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool, optional\n        if True, include a constant offset as part of the model at each\n        frequency. This can lead to more accurate results, especially in the\n        case of incomplete phase coverage.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data. This is especially important if ``fit_mean = False``\n    nterms : int, optional\n        Number of Fourier terms in the fit\n\n    Returns\n    -------\n    power : array-like\n        Lomb-Scargle power associated with each frequency.\n        Units of the result depend on the normalization.\n\n    References\n    ----------\n    .. [1] M. Zechmeister and M. Kurster, A&A 496, 577-584 (2009)\n    .. [2] W. Press et al, Numerical Recipes in C (2002)\n    .. [3] Scargle, J.D. 1982, ApJ 263:835-853\n    ","endLoc":86,"header":"def lombscargle_chi2(t, y, dy, frequency, normalization='standard',\n                     fit_mean=True, center_data=True, nterms=1)","id":14579,"name":"lombscargle_chi2","nodeType":"Function","startLoc":7,"text":"def lombscargle_chi2(t, y, dy, frequency, normalization='standard',\n                     fit_mean=True, center_data=True, nterms=1):\n    \"\"\"Lomb-Scargle Periodogram\n\n    This implements a chi-squared-based periodogram, which is relatively slow\n    but useful for validating the faster algorithms in the package.\n\n    Parameters\n    ----------\n    t, y, dy : array-like\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape. None should be `~astropy.units.Quantity``.\n    frequency : array-like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool, optional\n        if True, include a constant offset as part of the model at each\n        frequency. This can lead to more accurate results, especially in the\n        case of incomplete phase coverage.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data. This is especially important if ``fit_mean = False``\n    nterms : int, optional\n        Number of Fourier terms in the fit\n\n    Returns\n    -------\n    power : array-like\n        Lomb-Scargle power associated with each frequency.\n        Units of the result depend on the normalization.\n\n    References\n    ----------\n    .. [1] M. Zechmeister and M. Kurster, A&A 496, 577-584 (2009)\n    .. [2] W. Press et al, Numerical Recipes in C (2002)\n    .. [3] Scargle, J.D. 1982, ApJ 263:835-853\n    \"\"\"\n    if dy is None:\n        dy = 1\n\n    t, y, dy = np.broadcast_arrays(t, y, dy)\n    frequency = np.asarray(frequency)\n\n    if t.ndim != 1:\n        raise ValueError(\"t, y, dy should be one dimensional\")\n    if frequency.ndim != 1:\n        raise ValueError(\"frequency should be one-dimensional\")\n\n    w = dy ** -2.0\n    w /= w.sum()\n\n    # if fit_mean is true, centering the data now simplifies the math below.\n    if center_data or fit_mean:\n        yw = (y - np.dot(w, y)) / dy\n    else:\n        yw = y / dy\n    chi2_ref = np.dot(yw, yw)\n\n    # compute the unnormalized model chi2 at each frequency\n    def compute_power(f):\n        X = design_matrix(t, f, dy=dy, bias=fit_mean, nterms=nterms)\n        XTX = np.dot(X.T, X)\n        XTy = np.dot(X.T, yw)\n        return np.dot(XTy.T, np.linalg.solve(XTX, XTy))\n\n    p = np.array([compute_power(f) for f in frequency])\n\n    if normalization == 'psd':\n        p *= 0.5\n    elif normalization == 'model':\n        p /= (chi2_ref - p)\n    elif normalization == 'log':\n        p = -np.log(1 - p / chi2_ref)\n    elif normalization == 'standard':\n        p /= chi2_ref\n    else:\n        raise ValueError(f\"normalization='{normalization}' not recognized\")\n    return p"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":127,"id":14580,"name":"m_nu","nodeType":"Attribute","startLoc":127,"text":"m_nu"},{"attributeType":"null","col":0,"comment":"null","endLoc":436,"id":14581,"name":"INV_METHODS","nodeType":"Attribute","startLoc":436,"text":"INV_METHODS"},{"col":0,"comment":"","endLoc":7,"header":"_statistics.py#<anonymous>","id":14582,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nUtilities for computing periodogram statistics.\n\nThis is an internal module; users should access this functionality via the\n``false_alarm_probability`` and ``false_alarm_level`` methods of the\n``astropy.timeseries.LombScargle`` API.\n\"\"\"\n\nMETHODS = {'single': fap_single,\n           'naive': fap_naive,\n           'davies': fap_davies,\n           'baluev': fap_baluev,\n           'bootstrap': fap_bootstrap}\n\nINV_METHODS = {'single': inv_fap_single,\n               'naive': inv_fap_naive,\n               'davies': inv_fap_davies,\n               'baluev': inv_fap_baluev,\n               'bootstrap': inv_fap_bootstrap}"},{"fileName":"utils.py","filePath":"astropy/timeseries/periodograms/lombscargle/implementations","id":14583,"nodeType":"File","text":"from math import factorial\nimport numpy as np\n\n\ndef bitceil(N):\n    \"\"\"\n    Find the bit (i.e. power of 2) immediately greater than or equal to N\n    Note: this works for numbers up to 2 ** 64.\n    Roughly equivalent to int(2 ** np.ceil(np.log2(N)))\n    \"\"\"\n    return 1 << int(N - 1).bit_length()\n\n\ndef extirpolate(x, y, N=None, M=4):\n    \"\"\"\n    Extirpolate the values (x, y) onto an integer grid range(N),\n    using lagrange polynomial weights on the M nearest points.\n\n    Parameters\n    ----------\n    x : array-like\n        array of abscissas\n    y : array-like\n        array of ordinates\n    N : int\n        number of integer bins to use. For best performance, N should be larger\n        than the maximum of x\n    M : int\n        number of adjoining points on which to extirpolate.\n\n    Returns\n    -------\n    yN : ndarray\n         N extirpolated values associated with range(N)\n\n    Example\n    -------\n    >>> rng = np.random.default_rng(0)\n    >>> x = 100 * rng.random(20)\n    >>> y = np.sin(x)\n    >>> y_hat = extirpolate(x, y)\n    >>> x_hat = np.arange(len(y_hat))\n    >>> f = lambda x: np.sin(x / 10)\n    >>> np.allclose(np.sum(y * f(x)), np.sum(y_hat * f(x_hat)))\n    True\n\n    Notes\n    -----\n    This code is based on the C implementation of spread() presented in\n    Numerical Recipes in C, Second Edition (Press et al. 1989; p.583).\n    \"\"\"\n    x, y = map(np.ravel, np.broadcast_arrays(x, y))\n\n    if N is None:\n        N = int(np.max(x) + 0.5 * M + 1)\n\n    # Now use legendre polynomial weights to populate the results array;\n    # This is an efficient recursive implementation (See Press et al. 1989)\n    result = np.zeros(N, dtype=y.dtype)\n\n    # first take care of the easy cases where x is an integer\n    integers = (x % 1 == 0)\n    np.add.at(result, x[integers].astype(int), y[integers])\n    x, y = x[~integers], y[~integers]\n\n    # For each remaining x, find the index describing the extirpolation range.\n    # i.e. ilo[i] < x[i] < ilo[i] + M with x[i] in the center,\n    # adjusted so that the limits are within the range 0...N\n    ilo = np.clip((x - M // 2).astype(int), 0, N - M)\n    numerator = y * np.prod(x - ilo - np.arange(M)[:, np.newaxis], 0)\n    denominator = factorial(M - 1)\n\n    for j in range(M):\n        if j > 0:\n            denominator *= j / (j - M)\n        ind = ilo + (M - 1 - j)\n        np.add.at(result, ind, numerator / (denominator * (x - ind)))\n    return result\n\n\ndef trig_sum(t, h, df, N, f0=0, freq_factor=1,\n             oversampling=5, use_fft=True, Mfft=4):\n    \"\"\"Compute (approximate) trigonometric sums for a number of frequencies\n    This routine computes weighted sine and cosine sums::\n\n        S_j = sum_i { h_i * sin(2 pi * f_j * t_i) }\n        C_j = sum_i { h_i * cos(2 pi * f_j * t_i) }\n\n    Where f_j = freq_factor * (f0 + j * df) for the values j in 1 ... N.\n    The sums can be computed either by a brute force O[N^2] method, or\n    by an FFT-based O[Nlog(N)] method.\n\n    Parameters\n    ----------\n    t : array-like\n        array of input times\n    h : array-like\n        array weights for the sum\n    df : float\n        frequency spacing\n    N : int\n        number of frequency bins to return\n    f0 : float, optional\n        The low frequency to use\n    freq_factor : float, optional\n        Factor which multiplies the frequency\n    use_fft : bool\n        if True, use the approximate FFT algorithm to compute the result.\n        This uses the FFT with Press & Rybicki's Lagrangian extirpolation.\n    oversampling : int (default = 5)\n        oversampling freq_factor for the approximation; roughly the number of\n        time samples across the highest-frequency sinusoid. This parameter\n        contains the trade-off between accuracy and speed. Not referenced\n        if use_fft is False.\n    Mfft : int\n        The number of adjacent points to use in the FFT approximation.\n        Not referenced if use_fft is False.\n\n    Returns\n    -------\n    S, C : ndarray\n        summation arrays for frequencies f = df * np.arange(1, N + 1)\n    \"\"\"\n    df *= freq_factor\n    f0 *= freq_factor\n\n    if df <= 0:\n        raise ValueError(\"df must be positive\")\n    t, h = map(np.ravel, np.broadcast_arrays(t, h))\n\n    if use_fft:\n        Mfft = int(Mfft)\n        if Mfft <= 0:\n            raise ValueError(\"Mfft must be positive\")\n\n        # required size of fft is the power of 2 above the oversampling rate\n        Nfft = bitceil(N * oversampling)\n        t0 = t.min()\n\n        if f0 > 0:\n            h = h * np.exp(2j * np.pi * f0 * (t - t0))\n\n        tnorm = ((t - t0) * Nfft * df) % Nfft\n        grid = extirpolate(tnorm, h, Nfft, Mfft)\n\n        fftgrid = np.fft.ifft(grid)[:N]\n        if t0 != 0:\n            f = f0 + df * np.arange(N)\n            fftgrid *= np.exp(2j * np.pi * t0 * f)\n\n        C = Nfft * fftgrid.real\n        S = Nfft * fftgrid.imag\n    else:\n        f = f0 + df * np.arange(N)\n        C = np.dot(h, np.cos(2 * np.pi * f * t[:, np.newaxis]))\n        S = np.dot(h, np.sin(2 * np.pi * f * t[:, np.newaxis]))\n\n    return S, C\n"},{"fileName":"main.py","filePath":"astropy/timeseries/periodograms/lombscargle/implementations","id":14584,"nodeType":"File","text":"\"\"\"\nMain Lomb-Scargle Implementation\n\nThe ``lombscargle`` function here is essentially a sophisticated switch\nstatement for the various implementations available in this submodule\n\"\"\"\n\n__all__ = ['lombscargle', 'available_methods']\n\nimport numpy as np\n\nfrom .slow_impl import lombscargle_slow\nfrom .fast_impl import lombscargle_fast\nfrom .scipy_impl import lombscargle_scipy\nfrom .chi2_impl import lombscargle_chi2\nfrom .fastchi2_impl import lombscargle_fastchi2\nfrom .cython_impl import lombscargle_cython\n\n\nMETHODS = {'slow': lombscargle_slow,\n           'fast': lombscargle_fast,\n           'chi2': lombscargle_chi2,\n           'scipy': lombscargle_scipy,\n           'fastchi2': lombscargle_fastchi2,\n           'cython': lombscargle_cython}\n\n\ndef available_methods():\n    methods = ['auto', 'slow', 'chi2', 'cython', 'fast', 'fastchi2']\n\n    # Scipy required for scipy algorithm (obviously)\n    try:\n        import scipy\n    except ImportError:\n        pass\n    else:\n        methods.append('scipy')\n    return methods\n\n\ndef _is_regular(frequency):\n    frequency = np.asarray(frequency)\n\n    if frequency.ndim != 1:\n        return False\n    elif len(frequency) == 1:\n        return True\n    else:\n        diff = np.diff(frequency)\n        return np.allclose(diff[0], diff)\n\n\ndef _get_frequency_grid(frequency, assume_regular_frequency=False):\n    \"\"\"Utility to get grid parameters from a frequency array\n\n    Parameters\n    ----------\n    frequency : array-like or `~astropy.units.Quantity` ['frequency']\n        input frequency grid\n    assume_regular_frequency : bool (default = False)\n        if True, then do not check whether frequency is a regular grid\n\n    Returns\n    -------\n    f0, df, N : scalar\n        Parameters such that all(frequency == f0 + df * np.arange(N))\n    \"\"\"\n    frequency = np.asarray(frequency)\n    if frequency.ndim != 1:\n        raise ValueError(\"frequency grid must be 1 dimensional\")\n    elif len(frequency) == 1:\n        return frequency[0], frequency[0], 1\n    elif not (assume_regular_frequency or _is_regular(frequency)):\n        raise ValueError(\"frequency must be a regular grid\")\n\n    return frequency[0], frequency[1] - frequency[0], len(frequency)\n\n\ndef validate_method(method, dy, fit_mean, nterms,\n                    frequency, assume_regular_frequency):\n    \"\"\"\n    Validate the method argument, and if method='auto'\n    choose the appropriate method\n    \"\"\"\n    methods = available_methods()\n    prefer_fast = (len(frequency) > 200\n                   and (assume_regular_frequency or _is_regular(frequency)))\n    prefer_scipy = 'scipy' in methods and dy is None and not fit_mean\n\n    # automatically choose the appropriate method\n    if method == 'auto':\n\n        if nterms != 1:\n            if prefer_fast:\n                method = 'fastchi2'\n            else:\n                method = 'chi2'\n        elif prefer_fast:\n            method = 'fast'\n        elif prefer_scipy:\n            method = 'scipy'\n        else:\n            method = 'cython'\n\n    if method not in METHODS:\n        raise ValueError(f\"invalid method: {method}\")\n\n    return method\n\n\ndef lombscargle(t, y, dy=None,\n                frequency=None,\n                method='auto',\n                assume_regular_frequency=False,\n                normalization='standard',\n                fit_mean=True, center_data=True,\n                method_kwds=None, nterms=1):\n    \"\"\"\n    Compute the Lomb-scargle Periodogram with a given method.\n\n    Parameters\n    ----------\n    t : array-like\n        sequence of observation times\n    y : array-like\n        sequence of observations associated with times t\n    dy : float or array-like, optional\n        error or sequence of observational errors associated with times t\n    frequency : array-like\n        frequencies (not angular frequencies) at which to evaluate the\n        periodogram. If not specified, optimal frequencies will be chosen using\n        a heuristic which will attempt to provide sufficient frequency range\n        and sampling so that peaks will not be missed. Note that in order to\n        use method='fast', frequencies must be regularly spaced.\n    method : str, optional\n        specify the lomb scargle implementation to use. Options are:\n\n        - 'auto': choose the best method based on the input\n        - 'fast': use the O[N log N] fast method. Note that this requires\n          evenly-spaced frequencies: by default this will be checked unless\n          ``assume_regular_frequency`` is set to True.\n        - `slow`: use the O[N^2] pure-python implementation\n        - `chi2`: use the O[N^2] chi2/linear-fitting implementation\n        - `fastchi2`: use the O[N log N] chi2 implementation. Note that this\n          requires evenly-spaced frequencies: by default this will be checked\n          unless `assume_regular_frequency` is set to True.\n        - `scipy`: use ``scipy.signal.lombscargle``, which is an O[N^2]\n          implementation written in C. Note that this does not support\n          heteroskedastic errors.\n\n    assume_regular_frequency : bool, optional\n        if True, assume that the input frequency is of the form\n        freq = f0 + df * np.arange(N). Only referenced if method is 'auto'\n        or 'fast'.\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard' or 'psd'.\n    fit_mean : bool, optional\n        if True, include a constant offset as part of the model at each\n        frequency. This can lead to more accurate results, especially in the\n        case of incomplete phase coverage.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data. This is especially important if `fit_mean = False`\n    method_kwds : dict, optional\n        additional keywords to pass to the lomb-scargle method\n    nterms : int, optional\n        number of Fourier terms to use in the periodogram.\n        Not supported with every method.\n\n    Returns\n    -------\n    PLS : array-like\n        Lomb-Scargle power associated with each frequency omega\n    \"\"\"\n    # frequencies should be one-dimensional arrays\n    output_shape = frequency.shape\n    frequency = frequency.ravel()\n\n    # we'll need to adjust args and kwds for each method\n    args = (t, y, dy)\n    kwds = dict(frequency=frequency,\n                center_data=center_data,\n                fit_mean=fit_mean,\n                normalization=normalization,\n                nterms=nterms,\n                **(method_kwds or {}))\n\n    method = validate_method(method, dy=dy, fit_mean=fit_mean, nterms=nterms,\n                             frequency=frequency,\n                             assume_regular_frequency=assume_regular_frequency)\n\n    # scipy doesn't support dy or fit_mean=True\n    if method == 'scipy':\n        if kwds.pop('fit_mean'):\n            raise ValueError(\"scipy method does not support fit_mean=True\")\n        if dy is not None:\n            dy = np.ravel(np.asarray(dy))\n            if not np.allclose(dy[0], dy):\n                raise ValueError(\"scipy method only supports \"\n                                 \"uniform uncertainties dy\")\n        args = (t, y)\n\n    # fast methods require frequency expressed as a grid\n    if method.startswith('fast'):\n        f0, df, Nf = _get_frequency_grid(kwds.pop('frequency'),\n                                         assume_regular_frequency)\n        kwds.update(f0=f0, df=df, Nf=Nf)\n\n    # only chi2 methods support nterms\n    if not method.endswith('chi2'):\n        if kwds.pop('nterms') != 1:\n            raise ValueError(\"nterms != 1 only supported with 'chi2' \"\n                             \"or 'fastchi2' methods\")\n\n    PLS = METHODS[method](*args, **kwds)\n    return PLS.reshape(output_shape)\n"},{"attributeType":"null","col":16,"comment":"null","endLoc":2,"id":14585,"name":"np","nodeType":"Attribute","startLoc":2,"text":"np"},{"col":0,"comment":"Lomb-Scargle Periodogram\n\n    This is a wrapper of ``scipy.signal.lombscargle`` for computation of the\n    Lomb-Scargle periodogram. This is a relatively fast version of the naive\n    O[N^2] algorithm, but cannot handle heteroskedastic errors.\n\n    Parameters\n    ----------\n    t, y: array-like\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape. None should be `~astropy.units.Quantity`.\n    frequency : array-like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data.\n\n    Returns\n    -------\n    power : array-like\n        Lomb-Scargle power associated with each frequency.\n        Units of the result depend on the normalization.\n\n    References\n    ----------\n    .. [1] M. Zechmeister and M. Kurster, A&A 496, 577-584 (2009)\n    .. [2] W. Press et al, Numerical Recipes in C (2002)\n    .. [3] Scargle, J.D. 1982, ApJ 263:835-853\n    ","endLoc":72,"header":"def lombscargle_scipy(t, y, frequency, normalization='standard',\n                      center_data=True)","id":14586,"name":"lombscargle_scipy","nodeType":"Function","startLoc":5,"text":"def lombscargle_scipy(t, y, frequency, normalization='standard',\n                      center_data=True):\n    \"\"\"Lomb-Scargle Periodogram\n\n    This is a wrapper of ``scipy.signal.lombscargle`` for computation of the\n    Lomb-Scargle periodogram. This is a relatively fast version of the naive\n    O[N^2] algorithm, but cannot handle heteroskedastic errors.\n\n    Parameters\n    ----------\n    t, y: array-like\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape. None should be `~astropy.units.Quantity`.\n    frequency : array-like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data.\n\n    Returns\n    -------\n    power : array-like\n        Lomb-Scargle power associated with each frequency.\n        Units of the result depend on the normalization.\n\n    References\n    ----------\n    .. [1] M. Zechmeister and M. Kurster, A&A 496, 577-584 (2009)\n    .. [2] W. Press et al, Numerical Recipes in C (2002)\n    .. [3] Scargle, J.D. 1982, ApJ 263:835-853\n    \"\"\"\n    try:\n        from scipy import signal\n    except ImportError:\n        raise ImportError(\"scipy must be installed to use lombscargle_scipy\")\n\n    t, y = np.broadcast_arrays(t, y)\n\n    # Scipy requires floating-point input\n    t = np.asarray(t, dtype=float)\n    y = np.asarray(y, dtype=float)\n    frequency = np.asarray(frequency, dtype=float)\n\n    if t.ndim != 1:\n        raise ValueError(\"t, y, dy should be one dimensional\")\n    if frequency.ndim != 1:\n        raise ValueError(\"frequency should be one-dimensional\")\n\n    if center_data:\n        y = y - y.mean()\n\n    # Note: scipy input accepts angular frequencies\n    p = signal.lombscargle(t, y, 2 * np.pi * frequency)\n\n    if normalization == 'psd':\n        pass\n    elif normalization == 'standard':\n        p *= 2 / (t.size * np.mean(y ** 2))\n    elif normalization == 'log':\n        p = -np.log(1 - 2 * p / (t.size * np.mean(y ** 2)))\n    elif normalization == 'model':\n        p /= 0.5 * t.size * np.mean(y ** 2) - p\n    else:\n        raise ValueError(f\"normalization='{normalization}' not recognized\")\n    return p"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":129,"id":14587,"name":"Ob0","nodeType":"Attribute","startLoc":129,"text":"Ob0"},{"col":4,"comment":"\n        Convert this :class:`~astropy.timeseries.TimeSeries` to a\n        :class:`~pandas.DataFrame` with a :class:`~pandas.DatetimeIndex` index.\n\n        Returns\n        -------\n        dataframe : :class:`pandas.DataFrame`\n            A pandas :class:`pandas.DataFrame` instance\n        ","endLoc":316,"header":"def to_pandas(self)","id":14588,"name":"to_pandas","nodeType":"Function","startLoc":306,"text":"def to_pandas(self):\n        \"\"\"\n        Convert this :class:`~astropy.timeseries.TimeSeries` to a\n        :class:`~pandas.DataFrame` with a :class:`~pandas.DatetimeIndex` index.\n\n        Returns\n        -------\n        dataframe : :class:`pandas.DataFrame`\n            A pandas :class:`pandas.DataFrame` instance\n        \"\"\"\n        return Table(self).to_pandas(index='time')"},{"attributeType":"null","col":8,"comment":"null","endLoc":139,"id":14589,"name":"Tcmb0","nodeType":"Attribute","startLoc":139,"text":"self.Tcmb0"},{"col":4,"comment":"\n        Read and parse a file and returns a `astropy.timeseries.TimeSeries`.\n\n        This method uses the unified I/O infrastructure in Astropy which makes\n        it easy to define readers/writers for various classes\n        (https://docs.astropy.org/en/stable/io/unified.html). By default, this\n        method will try and use readers defined specifically for the\n        `astropy.timeseries.TimeSeries` class - however, it is also\n        possible to use the ``format`` keyword to specify formats defined for\n        the `astropy.table.Table` class - in this case, you will need to also\n        provide the column names for column containing the start times for the\n        bins, as well as other column names (see the Parameters section below\n        for details)::\n\n            >>> from astropy.timeseries import TimeSeries\n            >>> ts = TimeSeries.read('sampled.dat', format='ascii.ecsv',\n            ...                      time_column='date')  # doctest: +SKIP\n\n        Parameters\n        ----------\n        filename : str\n            File to parse.\n        format : str\n            File format specifier.\n        time_column : str, optional\n            The name of the time column.\n        time_format : str, optional\n            The time format for the time column.\n        time_scale : str, optional\n            The time scale for the time column.\n        *args : tuple, optional\n            Positional arguments passed through to the data reader.\n        **kwargs : dict, optional\n            Keyword arguments passed through to the data reader.\n\n        Returns\n        -------\n        out : `astropy.timeseries.sampled.TimeSeries`\n            TimeSeries corresponding to file contents.\n\n        Notes\n        -----\n        ","endLoc":383,"header":"@classmethod\n    def read(self, filename, time_column=None, time_format=None, time_scale=None, format=None, *args, **kwargs)","id":14590,"name":"read","nodeType":"Function","startLoc":318,"text":"@classmethod\n    def read(self, filename, time_column=None, time_format=None, time_scale=None, format=None, *args, **kwargs):\n        \"\"\"\n        Read and parse a file and returns a `astropy.timeseries.TimeSeries`.\n\n        This method uses the unified I/O infrastructure in Astropy which makes\n        it easy to define readers/writers for various classes\n        (https://docs.astropy.org/en/stable/io/unified.html). By default, this\n        method will try and use readers defined specifically for the\n        `astropy.timeseries.TimeSeries` class - however, it is also\n        possible to use the ``format`` keyword to specify formats defined for\n        the `astropy.table.Table` class - in this case, you will need to also\n        provide the column names for column containing the start times for the\n        bins, as well as other column names (see the Parameters section below\n        for details)::\n\n            >>> from astropy.timeseries import TimeSeries\n            >>> ts = TimeSeries.read('sampled.dat', format='ascii.ecsv',\n            ...                      time_column='date')  # doctest: +SKIP\n\n        Parameters\n        ----------\n        filename : str\n            File to parse.\n        format : str\n            File format specifier.\n        time_column : str, optional\n            The name of the time column.\n        time_format : str, optional\n            The time format for the time column.\n        time_scale : str, optional\n            The time scale for the time column.\n        *args : tuple, optional\n            Positional arguments passed through to the data reader.\n        **kwargs : dict, optional\n            Keyword arguments passed through to the data reader.\n\n        Returns\n        -------\n        out : `astropy.timeseries.sampled.TimeSeries`\n            TimeSeries corresponding to file contents.\n\n        Notes\n        -----\n        \"\"\"\n        try:\n\n            # First we try the readers defined for the BinnedTimeSeries class\n            return super().read(filename, format=format, *args, **kwargs)\n\n        except TypeError:\n\n            # Otherwise we fall back to the default Table readers\n\n            if time_column is None:\n                raise ValueError(\"``time_column`` should be provided since the default Table readers are being used.\")\n\n            table = Table.read(filename, format=format, *args, **kwargs)\n\n            if time_column in table.colnames:\n                time = Time(table.columns[time_column], scale=time_scale, format=time_format)\n                table.remove_column(time_column)\n            else:\n                raise ValueError(f\"Time column '{time_column}' not found in the input data.\")\n\n            return TimeSeries(time=time, data=table)"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":14591,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":14592,"name":"METHODS","nodeType":"Attribute","startLoc":20,"text":"METHODS"},{"col":0,"comment":"","endLoc":6,"header":"main.py#<anonymous>","id":14593,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nMain Lomb-Scargle Implementation\n\nThe ``lombscargle`` function here is essentially a sophisticated switch\nstatement for the various implementations available in this submodule\n\"\"\"\n\n__all__ = ['lombscargle', 'available_methods']\n\nMETHODS = {'slow': lombscargle_slow,\n           'fast': lombscargle_fast,\n           'chi2': lombscargle_chi2,\n           'scipy': lombscargle_scipy,\n           'fastchi2': lombscargle_fastchi2,\n           'cython': lombscargle_cython}"},{"fileName":"scipy_impl.py","filePath":"astropy/timeseries/periodograms/lombscargle/implementations","id":14594,"nodeType":"File","text":"\nimport numpy as np\n\n\ndef lombscargle_scipy(t, y, frequency, normalization='standard',\n                      center_data=True):\n    \"\"\"Lomb-Scargle Periodogram\n\n    This is a wrapper of ``scipy.signal.lombscargle`` for computation of the\n    Lomb-Scargle periodogram. This is a relatively fast version of the naive\n    O[N^2] algorithm, but cannot handle heteroskedastic errors.\n\n    Parameters\n    ----------\n    t, y: array-like\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape. None should be `~astropy.units.Quantity`.\n    frequency : array-like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data.\n\n    Returns\n    -------\n    power : array-like\n        Lomb-Scargle power associated with each frequency.\n        Units of the result depend on the normalization.\n\n    References\n    ----------\n    .. [1] M. Zechmeister and M. Kurster, A&A 496, 577-584 (2009)\n    .. [2] W. Press et al, Numerical Recipes in C (2002)\n    .. [3] Scargle, J.D. 1982, ApJ 263:835-853\n    \"\"\"\n    try:\n        from scipy import signal\n    except ImportError:\n        raise ImportError(\"scipy must be installed to use lombscargle_scipy\")\n\n    t, y = np.broadcast_arrays(t, y)\n\n    # Scipy requires floating-point input\n    t = np.asarray(t, dtype=float)\n    y = np.asarray(y, dtype=float)\n    frequency = np.asarray(frequency, dtype=float)\n\n    if t.ndim != 1:\n        raise ValueError(\"t, y, dy should be one dimensional\")\n    if frequency.ndim != 1:\n        raise ValueError(\"frequency should be one-dimensional\")\n\n    if center_data:\n        y = y - y.mean()\n\n    # Note: scipy input accepts angular frequencies\n    p = signal.lombscargle(t, y, 2 * np.pi * frequency)\n\n    if normalization == 'psd':\n        pass\n    elif normalization == 'standard':\n        p *= 2 / (t.size * np.mean(y ** 2))\n    elif normalization == 'log':\n        p = -np.log(1 - 2 * p / (t.size * np.mean(y ** 2)))\n    elif normalization == 'model':\n        p /= 0.5 * t.size * np.mean(y ** 2) - p\n    else:\n        raise ValueError(f\"normalization='{normalization}' not recognized\")\n    return p\n"},{"fileName":"chi2_impl.py","filePath":"astropy/timeseries/periodograms/lombscargle/implementations","id":14595,"nodeType":"File","text":"\nimport numpy as np\n\nfrom .mle import design_matrix\n\n\ndef lombscargle_chi2(t, y, dy, frequency, normalization='standard',\n                     fit_mean=True, center_data=True, nterms=1):\n    \"\"\"Lomb-Scargle Periodogram\n\n    This implements a chi-squared-based periodogram, which is relatively slow\n    but useful for validating the faster algorithms in the package.\n\n    Parameters\n    ----------\n    t, y, dy : array-like\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape. None should be `~astropy.units.Quantity``.\n    frequency : array-like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : str, optional\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool, optional\n        if True, include a constant offset as part of the model at each\n        frequency. This can lead to more accurate results, especially in the\n        case of incomplete phase coverage.\n    center_data : bool, optional\n        if True, pre-center the data by subtracting the weighted mean\n        of the input data. This is especially important if ``fit_mean = False``\n    nterms : int, optional\n        Number of Fourier terms in the fit\n\n    Returns\n    -------\n    power : array-like\n        Lomb-Scargle power associated with each frequency.\n        Units of the result depend on the normalization.\n\n    References\n    ----------\n    .. [1] M. Zechmeister and M. Kurster, A&A 496, 577-584 (2009)\n    .. [2] W. Press et al, Numerical Recipes in C (2002)\n    .. [3] Scargle, J.D. 1982, ApJ 263:835-853\n    \"\"\"\n    if dy is None:\n        dy = 1\n\n    t, y, dy = np.broadcast_arrays(t, y, dy)\n    frequency = np.asarray(frequency)\n\n    if t.ndim != 1:\n        raise ValueError(\"t, y, dy should be one dimensional\")\n    if frequency.ndim != 1:\n        raise ValueError(\"frequency should be one-dimensional\")\n\n    w = dy ** -2.0\n    w /= w.sum()\n\n    # if fit_mean is true, centering the data now simplifies the math below.\n    if center_data or fit_mean:\n        yw = (y - np.dot(w, y)) / dy\n    else:\n        yw = y / dy\n    chi2_ref = np.dot(yw, yw)\n\n    # compute the unnormalized model chi2 at each frequency\n    def compute_power(f):\n        X = design_matrix(t, f, dy=dy, bias=fit_mean, nterms=nterms)\n        XTX = np.dot(X.T, X)\n        XTy = np.dot(X.T, yw)\n        return np.dot(XTy.T, np.linalg.solve(XTX, XTy))\n\n    p = np.array([compute_power(f) for f in frequency])\n\n    if normalization == 'psd':\n        p *= 0.5\n    elif normalization == 'model':\n        p /= (chi2_ref - p)\n    elif normalization == 'log':\n        p = -np.log(1 - p / chi2_ref)\n    elif normalization == 'standard':\n        p /= chi2_ref\n    else:\n        raise ValueError(f\"normalization='{normalization}' not recognized\")\n    return p\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":138,"id":14596,"name":"Ode0","nodeType":"Attribute","startLoc":138,"text":"self.Ode0"},{"fileName":"mle.py","filePath":"astropy/timeseries/periodograms/lombscargle/implementations","id":14597,"nodeType":"File","text":"\nimport numpy as np\n\n\ndef design_matrix(t, frequency, dy=None, bias=True, nterms=1):\n    \"\"\"Compute the Lomb-Scargle design matrix at the given frequency\n\n    This is the matrix X such that the periodic model at the given frequency\n    can be expressed :math:`\\\\hat{y} = X \\\\theta`.\n\n    Parameters\n    ----------\n    t : array-like, shape=(n_times,)\n        times at which to compute the design matrix\n    frequency : float\n        frequency for the design matrix\n    dy : float or array-like, optional\n        data uncertainties: should be broadcastable with `t`\n    bias : bool (default=True)\n        If true, include a bias column in the matrix\n    nterms : int (default=1)\n        Number of Fourier terms to include in the model\n\n    Returns\n    -------\n    X : ndarray, shape=(n_times, n_parameters)\n        The design matrix, where n_parameters = bool(bias) + 2 * nterms\n    \"\"\"\n    t = np.asarray(t)\n    frequency = np.asarray(frequency)\n\n    if t.ndim != 1:\n        raise ValueError(\"t should be one dimensional\")\n    if frequency.ndim != 0:\n        raise ValueError(\"frequency must be a scalar\")\n\n    if nterms == 0 and not bias:\n        raise ValueError(\"cannot have nterms=0 and no bias\")\n\n    if bias:\n        cols = [np.ones_like(t)]\n    else:\n        cols = []\n\n    for i in range(1, nterms + 1):\n        cols.append(np.sin(2 * np.pi * i * frequency * t))\n        cols.append(np.cos(2 * np.pi * i * frequency * t))\n    XT = np.vstack(cols)\n\n    if dy is not None:\n        XT /= dy\n\n    return np.transpose(XT)\n\n\ndef periodic_fit(t, y, dy, frequency, t_fit,\n                 center_data=True, fit_mean=True, nterms=1):\n    \"\"\"Compute the Lomb-Scargle model fit at a given frequency\n\n    Parameters\n    ----------\n    t, y, dy : float or array-like\n        The times, observations, and uncertainties to fit\n    frequency : float\n        The frequency at which to compute the model\n    t_fit : float or array-like\n        The times at which the fit should be computed\n    center_data : bool (default=True)\n        If True, center the input data before applying the fit\n    fit_mean : bool (default=True)\n        If True, include the bias as part of the model\n    nterms : int (default=1)\n        The number of Fourier terms to include in the fit\n\n    Returns\n    -------\n    y_fit : ndarray\n        The model fit evaluated at each value of t_fit\n    \"\"\"\n    t, y, frequency = map(np.asarray, (t, y, frequency))\n    if dy is None:\n        dy = np.ones_like(y)\n    else:\n        dy = np.asarray(dy)\n\n    t_fit = np.asarray(t_fit)\n\n    if t.ndim != 1:\n        raise ValueError(\"t, y, dy should be one dimensional\")\n    if t_fit.ndim != 1:\n        raise ValueError(\"t_fit should be one dimensional\")\n    if frequency.ndim != 0:\n        raise ValueError(\"frequency should be a scalar\")\n\n    if center_data:\n        w = dy ** -2.0\n        y_mean = np.dot(y, w) / w.sum()\n        y = (y - y_mean)\n    else:\n        y_mean = 0\n\n    X = design_matrix(t, frequency, dy=dy, bias=fit_mean, nterms=nterms)\n    theta_MLE = np.linalg.solve(np.dot(X.T, X),\n                                np.dot(X.T, y / dy))\n\n    X_fit = design_matrix(t_fit, frequency, bias=fit_mean, nterms=nterms)\n\n    return y_mean + np.dot(X_fit, theta_MLE)\n"},{"id":14598,"name":"astropy/timeseries/periodograms/lombscargle/implementations/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/timeseries/periodograms/lombscargle/implementations/tests","id":14599,"nodeType":"File","text":""},{"id":14600,"name":"astropy/convolution","nodeType":"Package"},{"fileName":"setup_package.py","filePath":"astropy/convolution","id":14601,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\nimport sys\n\nfrom setuptools import Extension\n\nimport numpy\n\nC_CONVOLVE_PKGDIR = os.path.relpath(os.path.dirname(__file__))\n\nSRC_FILES = [os.path.join(C_CONVOLVE_PKGDIR, filename)\n             for filename in ['src/convolve.c']]\n\nextra_compile_args = ['-UNDEBUG']\nif not sys.platform.startswith('win'):\n    extra_compile_args.append('-fPIC')\n\n\ndef get_extensions():\n    # Add '-Rpass-missed=.*' to ``extra_compile_args`` when compiling with clang\n    # to report missed optimizations\n    _convolve_ext = Extension(name='astropy.convolution._convolve', sources=SRC_FILES,\n                              extra_compile_args=extra_compile_args,\n                              include_dirs=[numpy.get_include()],\n                              language='c')\n\n    return [_convolve_ext]\n"},{"col":0,"comment":"null","endLoc":28,"header":"def get_extensions()","id":14602,"name":"get_extensions","nodeType":"Function","startLoc":20,"text":"def get_extensions():\n    # Add '-Rpass-missed=.*' to ``extra_compile_args`` when compiling with clang\n    # to report missed optimizations\n    _convolve_ext = Extension(name='astropy.convolution._convolve', sources=SRC_FILES,\n                              extra_compile_args=extra_compile_args,\n                              include_dirs=[numpy.get_include()],\n                              language='c')\n\n    return [_convolve_ext]"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":14603,"name":"C_CONVOLVE_PKGDIR","nodeType":"Attribute","startLoc":10,"text":"C_CONVOLVE_PKGDIR"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":14604,"name":"SRC_FILES","nodeType":"Attribute","startLoc":12,"text":"SRC_FILES"},{"attributeType":"null","col":17,"comment":"null","endLoc":13,"id":14605,"name":"filename","nodeType":"Attribute","startLoc":13,"text":"filename"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":14606,"name":"extra_compile_args","nodeType":"Attribute","startLoc":15,"text":"extra_compile_args"},{"attributeType":"null","col":4,"comment":"null","endLoc":59,"id":14607,"name":"_required_columns","nodeType":"Attribute","startLoc":59,"text":"_required_columns"},{"col":0,"comment":"","endLoc":3,"header":"setup_package.py#<anonymous>","id":14608,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"C_CONVOLVE_PKGDIR = os.path.relpath(os.path.dirname(__file__))\n\nSRC_FILES = [os.path.join(C_CONVOLVE_PKGDIR, filename)\n             for filename in ['src/convolve.c']]\n\nextra_compile_args = ['-UNDEBUG']\n\nif not sys.platform.startswith('win'):\n    extra_compile_args.append('-fPIC')"},{"fileName":"convolve.py","filePath":"astropy/convolution","id":14609,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport ctypes\nimport os\nimport warnings\nfrom functools import partial\n\nimport numpy as np\nfrom numpy.ctypeslib import load_library, ndpointer\n\nfrom astropy import units as u\nfrom astropy.modeling.convolution import Convolution\nfrom astropy.modeling.core import SPECIAL_OPERATORS, CompoundModel\nfrom astropy.nddata import support_nddata\nfrom astropy.utils.console import human_file_size\nfrom astropy.utils.exceptions import AstropyUserWarning\n\nfrom .core import MAX_NORMALIZATION, Kernel, Kernel1D, Kernel2D\nfrom .utils import KernelSizeError, has_even_axis, raise_even_kernel_exception\n\nLIBRARY_PATH = os.path.dirname(__file__)\n\ntry:\n    with warnings.catch_warnings():\n        # numpy.distutils is deprecated since numpy 1.23\n        # see https://github.com/astropy/astropy/issues/12865\n        warnings.simplefilter('ignore', DeprecationWarning)\n        _convolve = load_library(\"_convolve\", LIBRARY_PATH)\nexcept Exception:\n    raise ImportError(\"Convolution C extension is missing. Try re-building astropy.\")\n\n# The GIL is automatically released by default when calling functions imported\n# from libraries loaded by ctypes.cdll.LoadLibrary(<path>)\n\n# Declare prototypes\n# Boundary None\n_convolveNd_c = _convolve.convolveNd_c\n_convolveNd_c.restype = None\n_convolveNd_c.argtypes = [ndpointer(ctypes.c_double, flags={\"C_CONTIGUOUS\", \"WRITEABLE\"}),  # return array\n                          ndpointer(ctypes.c_double, flags=\"C_CONTIGUOUS\"),  # input array\n                          ctypes.c_uint,  # N dim\n                          # size array for input and result unless\n                          # embed_result_within_padded_region is False,\n                          # in which case the result array is assumed to be\n                          # input.shape - 2*(kernel.shape//2). Note: integer division.\n                          ndpointer(ctypes.c_size_t, flags=\"C_CONTIGUOUS\"),\n                          ndpointer(ctypes.c_double, flags=\"C_CONTIGUOUS\"),  # kernel array\n                          ndpointer(ctypes.c_size_t, flags=\"C_CONTIGUOUS\"),  # size array for kernel\n                          ctypes.c_bool,  # nan_interpolate\n                          ctypes.c_bool,  # embed_result_within_padded_region\n                          ctypes.c_uint]  # n_threads\n\n# np.unique([scipy.fft.next_fast_len(i, real=True) for i in range(10000)])\n_good_sizes = np.array([   0,    1,    2,    3,    4,    5,    6,    8,    9,   10,   12,  # noqa E201\n                          15,   16,   18,   20,   24,   25,   27,   30,   32,   36,   40,\n                          45,   48,   50,   54,   60,   64,   72,   75,   80,   81,   90,\n                          96,  100,  108,  120,  125,  128,  135,  144,  150,  160,  162,\n                         180,  192,  200,  216,  225,  240,  243,  250,  256,  270,  288,\n                         300,  320,  324,  360,  375,  384,  400,  405,  432,  450,  480,\n                         486,  500,  512,  540,  576,  600,  625,  640,  648,  675,  720,\n                         729,  750,  768,  800,  810,  864,  900,  960,  972, 1000, 1024,\n                        1080, 1125, 1152, 1200, 1215, 1250, 1280, 1296, 1350, 1440, 1458,\n                        1500, 1536, 1600, 1620, 1728, 1800, 1875, 1920, 1944, 2000, 2025,\n                        2048, 2160, 2187, 2250, 2304, 2400, 2430, 2500, 2560, 2592, 2700,\n                        2880, 2916, 3000, 3072, 3125, 3200, 3240, 3375, 3456, 3600, 3645,\n                        3750, 3840, 3888, 4000, 4050, 4096, 4320, 4374, 4500, 4608, 4800,\n                        4860, 5000, 5120, 5184, 5400, 5625, 5760, 5832, 6000, 6075, 6144,\n                        6250, 6400, 6480, 6561, 6750, 6912, 7200, 7290, 7500, 7680, 7776,\n                        8000, 8100, 8192, 8640, 8748, 9000, 9216, 9375, 9600, 9720, 10000])\n_good_range = int(np.log10(_good_sizes[-1]))\n\n# Disabling doctests when scipy isn't present.\n__doctest_requires__ = {('convolve_fft',): ['scipy.fft']}\n\nBOUNDARY_OPTIONS = [None, 'fill', 'wrap', 'extend']\n\n\ndef _next_fast_lengths(shape):\n    \"\"\"\n    Find optimal or good sizes to pad an array of ``shape`` to for better\n    performance with `numpy.fft.*fft` and `scipy.fft.*fft`.\n    Calculated directly with `scipy.fft.next_fast_len`, if available; otherwise\n    looked up from list and scaled by powers of 10, if necessary.\n    \"\"\"\n\n    try:\n        import scipy.fft\n        return np.array([scipy.fft.next_fast_len(j) for j in shape])\n    except ImportError:\n        pass\n\n    newshape = np.empty(len(np.atleast_1d(shape)), dtype=int)\n    for i, j in enumerate(shape):\n        scale = 10 ** max(int(np.ceil(np.log10(j))) - _good_range, 0)\n        for n in _good_sizes:\n            if n * scale >= j:\n                newshape[i] = n * scale\n                break\n        else:\n            raise ValueError(f'No next fast length for {j} found in list of _good_sizes '\n                             f'<= {_good_sizes[-1] * scale}.')\n    return newshape\n\n\ndef _copy_input_if_needed(input, dtype=float, order='C', nan_treatment=None,\n                          mask=None, fill_value=None):\n    # Alias input\n    input = input.array if isinstance(input, Kernel) else input\n    # strip quantity attributes\n    if hasattr(input, 'unit'):\n        input = input.value\n    output = input\n    # Copy input\n    try:\n        # Anything that's masked must be turned into NaNs for the interpolation.\n        # This requires copying. A copy is also needed for nan_treatment == 'fill'\n        # A copy prevents possible function side-effects of the input array.\n        if nan_treatment == 'fill' or np.ma.is_masked(input) or mask is not None:\n            if np.ma.is_masked(input):\n                # ``np.ma.maskedarray.filled()`` returns a copy, however there\n                # is no way to specify the return type or order etc. In addition\n                # ``np.nan`` is a ``float`` and there is no conversion to an\n                # ``int`` type. Therefore, a pre-fill copy is needed for non\n                # ``float`` masked arrays. ``subok=True`` is needed to retain\n                # ``np.ma.maskedarray.filled()``. ``copy=False`` allows the fill\n                # to act as the copy if type and order are already correct.\n                output = np.array(input, dtype=dtype, copy=False, order=order, subok=True)\n                output = output.filled(fill_value)\n            else:\n                # Since we're making a copy, we might as well use `subok=False` to save,\n                # what is probably, a negligible amount of memory.\n                output = np.array(input, dtype=dtype, copy=True, order=order, subok=False)\n\n            if mask is not None:\n                # mask != 0 yields a bool mask for all ints/floats/bool\n                output[mask != 0] = fill_value\n        else:\n            # The call below is synonymous with np.asanyarray(array, ftype=float, order='C')\n            # The advantage of `subok=True` is that it won't copy when array is an ndarray subclass. If it\n            # is and `subok=False` (default), then it will copy even if `copy=False`. This uses less memory\n            # when ndarray subclasses are passed in.\n            output = np.array(input, dtype=dtype, copy=False, order=order, subok=True)\n    except (TypeError, ValueError) as e:\n        raise TypeError('input should be a Numpy array or something '\n                        'convertible into a float array', e)\n    return output\n\n\n@support_nddata(data='array')\ndef convolve(array, kernel, boundary='fill', fill_value=0.,\n             nan_treatment='interpolate', normalize_kernel=True, mask=None,\n             preserve_nan=False, normalization_zero_tol=1e-8):\n    \"\"\"\n    Convolve an array with a kernel.\n\n    This routine differs from `scipy.ndimage.convolve` because\n    it includes a special treatment for ``NaN`` values. Rather than\n    including ``NaN`` values in the array in the convolution calculation, which\n    causes large ``NaN`` holes in the convolved array, ``NaN`` values are\n    replaced with interpolated values using the kernel as an interpolation\n    function.\n\n    Parameters\n    ----------\n    array : `~astropy.nddata.NDData` or array-like\n        The array to convolve. This should be a 1, 2, or 3-dimensional array\n        or a list or a set of nested lists representing a 1, 2, or\n        3-dimensional array.  If an `~astropy.nddata.NDData`, the ``mask`` of\n        the `~astropy.nddata.NDData` will be used as the ``mask`` argument.\n    kernel : `numpy.ndarray` or `~astropy.convolution.Kernel`\n        The convolution kernel. The number of dimensions should match those for\n        the array, and the dimensions should be odd in all directions.  If a\n        masked array, the masked values will be replaced by ``fill_value``.\n    boundary : str, optional\n        A flag indicating how to handle boundaries:\n            * `None`\n                Set the ``result`` values to zero where the kernel\n                extends beyond the edge of the array.\n            * 'fill'\n                Set values outside the array boundary to ``fill_value`` (default).\n            * 'wrap'\n                Periodic boundary that wrap to the other side of ``array``.\n            * 'extend'\n                Set values outside the array to the nearest ``array``\n                value.\n    fill_value : float, optional\n        The value to use outside the array when using ``boundary='fill'``.\n    normalize_kernel : bool, optional\n        Whether to normalize the kernel to have a sum of one.\n    nan_treatment : {'interpolate', 'fill'}, optional\n        The method used to handle NaNs in the input ``array``:\n            * ``'interpolate'``: ``NaN`` values are replaced with\n              interpolated values using the kernel as an interpolation\n              function. Note that if the kernel has a sum equal to\n              zero, NaN interpolation is not possible and will raise an\n              exception.\n            * ``'fill'``: ``NaN`` values are replaced by ``fill_value``\n              prior to convolution.\n    preserve_nan : bool, optional\n        After performing convolution, should pixels that were originally NaN\n        again become NaN?\n    mask : None or ndarray, optional\n        A \"mask\" array.  Shape must match ``array``, and anything that is masked\n        (i.e., not 0/`False`) will be set to NaN for the convolution.  If\n        `None`, no masking will be performed unless ``array`` is a masked array.\n        If ``mask`` is not `None` *and* ``array`` is a masked array, a pixel is\n        masked of it is masked in either ``mask`` *or* ``array.mask``.\n    normalization_zero_tol : float, optional\n        The absolute tolerance on whether the kernel is different than zero.\n        If the kernel sums to zero to within this precision, it cannot be\n        normalized. Default is \"1e-8\".\n\n    Returns\n    -------\n    result : `numpy.ndarray`\n        An array with the same dimensions and as the input array,\n        convolved with kernel.  The data type depends on the input\n        array type.  If array is a floating point type, then the\n        return array keeps the same data type, otherwise the type\n        is ``numpy.float``.\n\n    Notes\n    -----\n    For masked arrays, masked values are treated as NaNs.  The convolution\n    is always done at ``numpy.float`` precision.\n    \"\"\"\n\n    if boundary not in BOUNDARY_OPTIONS:\n        raise ValueError(f\"Invalid boundary option: must be one of {BOUNDARY_OPTIONS}\")\n\n    if nan_treatment not in ('interpolate', 'fill'):\n        raise ValueError(\"nan_treatment must be one of 'interpolate','fill'\")\n\n    # OpenMP support is disabled at the C src code level, changing this will have\n    # no effect.\n    n_threads = 1\n\n    # Keep refs to originals\n    passed_kernel = kernel\n    passed_array = array\n\n    # The C routines all need float type inputs (so, a particular\n    # bit size, endianness, etc.).  So we have to convert, which also\n    # has the effect of making copies so we don't modify the inputs.\n    # After this, the variables we work with will be array_internal, and\n    # kernel_internal.  However -- we do want to keep track of what type\n    # the input array was so we can cast the result to that at the end\n    # if it's a floating point type.  Don't bother with this for lists --\n    # just always push those as float.\n    # It is always necessary to make a copy of kernel (since it is modified),\n    # but, if we just so happen to be lucky enough to have the input array\n    # have exactly the desired type, we just alias to array_internal\n    # Convert kernel to ndarray if not already\n\n    # Copy or alias array to array_internal\n    array_internal = _copy_input_if_needed(passed_array, dtype=float, order='C',\n                                           nan_treatment=nan_treatment, mask=mask,\n                                           fill_value=np.nan)\n    array_dtype = getattr(passed_array, 'dtype', array_internal.dtype)\n    # Copy or alias kernel to kernel_internal\n    kernel_internal = _copy_input_if_needed(passed_kernel, dtype=float, order='C',\n                                            nan_treatment=None, mask=None,\n                                            fill_value=fill_value)\n\n    # Make sure kernel has all odd axes\n    if has_even_axis(kernel_internal):\n        raise_even_kernel_exception()\n\n    # If both image array and kernel are Kernel instances\n    # constrain convolution method\n    # This must occur before the main alias/copy of ``passed_kernel`` to\n    # ``kernel_internal`` as it is used for filling masked kernels.\n    if isinstance(passed_array, Kernel) and isinstance(passed_kernel, Kernel):\n        warnings.warn(\"Both array and kernel are Kernel instances, hardwiring \"\n                      \"the following parameters: boundary='fill', fill_value=0,\"\n                      \" normalize_Kernel=True, nan_treatment='interpolate'\",\n                      AstropyUserWarning)\n        boundary = 'fill'\n        fill_value = 0\n        normalize_kernel = True\n        nan_treatment = 'interpolate'\n\n    # -----------------------------------------------------------------------\n    # From this point onwards refer only to ``array_internal`` and\n    # ``kernel_internal``.\n    # Assume both are base np.ndarrays and NOT subclasses e.g. NOT\n    # ``Kernel`` nor ``np.ma.maskedarray`` classes.\n    # -----------------------------------------------------------------------\n\n    # Check dimensionality\n    if array_internal.ndim == 0:\n        raise Exception(\"cannot convolve 0-dimensional arrays\")\n    elif array_internal.ndim > 3:\n        raise NotImplementedError('convolve only supports 1, 2, and 3-dimensional '\n                                  'arrays at this time')\n    elif array_internal.ndim != kernel_internal.ndim:\n        raise Exception('array and kernel have differing number of '\n                        'dimensions.')\n\n    array_shape = np.array(array_internal.shape)\n    kernel_shape = np.array(kernel_internal.shape)\n    pad_width = kernel_shape//2\n\n    # For boundary=None only the center space is convolved. All array indices within a\n    # distance kernel.shape//2 from the edge are completely ignored (zeroed).\n    # E.g. (1D list) only the indices len(kernel)//2 : len(array)-len(kernel)//2\n    # are convolved. It is therefore not possible to use this method to convolve an\n    # array by a kernel that is larger (see note below) than the array - as ALL pixels would be ignored\n    # leaving an array of only zeros.\n    # Note: For even kernels the correctness condition is array_shape > kernel_shape.\n    # For odd kernels it is:\n    # array_shape >= kernel_shape OR array_shape > kernel_shape-1 OR array_shape > 2*(kernel_shape//2).\n    # Since the latter is equal to the former two for even lengths, the latter condition is complete.\n    if boundary is None and not np.all(array_shape > 2*pad_width):\n        raise KernelSizeError(\"for boundary=None all kernel axes must be smaller than array's - \"\n                              \"use boundary in ['fill', 'extend', 'wrap'] instead.\")\n\n    # NaN interpolation significantly slows down the C convolution\n    # computation. Since nan_treatment = 'interpolate', is the default\n    # check whether it is even needed, if not, don't interpolate.\n    # NB: np.isnan(array_internal.sum()) is faster than np.isnan(array_internal).any()\n    nan_interpolate = (nan_treatment == 'interpolate') and np.isnan(array_internal.sum())\n\n    # Check if kernel is normalizable\n    if normalize_kernel or nan_interpolate:\n        kernel_sum = kernel_internal.sum()\n        kernel_sums_to_zero = np.isclose(kernel_sum, 0,\n                                         atol=normalization_zero_tol)\n\n        if kernel_sum < 1. / MAX_NORMALIZATION or kernel_sums_to_zero:\n            if nan_interpolate:\n                raise ValueError(\"Setting nan_treatment='interpolate' \"\n                                 \"requires the kernel to be normalized, \"\n                                 \"but the input kernel has a sum close \"\n                                 \"to zero. For a zero-sum kernel and \"\n                                 \"data with NaNs, set nan_treatment='fill'.\")\n            else:\n                raise ValueError(\"The kernel can't be normalized, because \"\n                                 \"its sum is close to zero. The sum of the \"\n                                 \"given kernel is < {}\"\n                                 .format(1. / MAX_NORMALIZATION))\n\n    # Mark the NaN values so we can replace them later if interpolate_nan is\n    # not set\n    if preserve_nan or nan_treatment == 'fill':\n        initially_nan = np.isnan(array_internal)\n        if nan_treatment == 'fill':\n            array_internal[initially_nan] = fill_value\n\n    # Avoid any memory allocation within the C code. Allocate output array\n    # here and pass through instead.\n    result = np.zeros(array_internal.shape, dtype=float, order='C')\n\n    embed_result_within_padded_region = True\n    array_to_convolve = array_internal\n    if boundary in ('fill', 'extend', 'wrap'):\n        embed_result_within_padded_region = False\n        if boundary == 'fill':\n            # This method is faster than using numpy.pad(..., mode='constant')\n            array_to_convolve = np.full(array_shape + 2*pad_width, fill_value=fill_value, dtype=float, order='C')\n            # Use bounds [pad_width[0]:array_shape[0]+pad_width[0]] instead of [pad_width[0]:-pad_width[0]]\n            # to account for when the kernel has size of 1 making pad_width = 0.\n            if array_internal.ndim == 1:\n                array_to_convolve[pad_width[0]:array_shape[0]+pad_width[0]] = array_internal\n            elif array_internal.ndim == 2:\n                array_to_convolve[pad_width[0]:array_shape[0]+pad_width[0],\n                                  pad_width[1]:array_shape[1]+pad_width[1]] = array_internal\n            else:\n                array_to_convolve[pad_width[0]:array_shape[0]+pad_width[0],\n                                  pad_width[1]:array_shape[1]+pad_width[1],\n                                  pad_width[2]:array_shape[2]+pad_width[2]] = array_internal\n        else:\n            np_pad_mode_dict = {'fill': 'constant', 'extend': 'edge', 'wrap': 'wrap'}\n            np_pad_mode = np_pad_mode_dict[boundary]\n            pad_width = kernel_shape // 2\n\n            if array_internal.ndim == 1:\n                np_pad_width = (pad_width[0],)\n            elif array_internal.ndim == 2:\n                np_pad_width = ((pad_width[0],), (pad_width[1],))\n            else:\n                np_pad_width = ((pad_width[0],), (pad_width[1],), (pad_width[2],))\n\n            array_to_convolve = np.pad(array_internal, pad_width=np_pad_width,\n                                       mode=np_pad_mode)\n\n    _convolveNd_c(result, array_to_convolve,\n                  array_to_convolve.ndim,\n                  np.array(array_to_convolve.shape, dtype=ctypes.c_size_t, order='C'),\n                  kernel_internal,\n                  np.array(kernel_shape, dtype=ctypes.c_size_t, order='C'),\n                  nan_interpolate, embed_result_within_padded_region,\n                  n_threads)\n\n    # So far, normalization has only occurred for nan_treatment == 'interpolate'\n    # because this had to happen within the C extension so as to ignore\n    # any NaNs\n    if normalize_kernel:\n        if not nan_interpolate:\n            result /= kernel_sum\n    elif nan_interpolate:\n        result *= kernel_sum\n\n    if nan_interpolate and not preserve_nan and np.isnan(result.sum()):\n        warnings.warn(\"nan_treatment='interpolate', however, NaN values detected \"\n                      \"post convolution. A contiguous region of NaN values, larger \"\n                      \"than the kernel size, are present in the input array. \"\n                      \"Increase the kernel size to avoid this.\", AstropyUserWarning)\n\n    if preserve_nan:\n        result[initially_nan] = np.nan\n\n    # Convert result to original data type\n    array_unit = getattr(passed_array, \"unit\", None)\n    if array_unit is not None:\n        result <<= array_unit\n\n    if isinstance(passed_array, Kernel):\n        if isinstance(passed_array, Kernel1D):\n            new_result = Kernel1D(array=result)\n        elif isinstance(passed_array, Kernel2D):\n            new_result = Kernel2D(array=result)\n        else:\n            raise TypeError(\"Only 1D and 2D Kernels are supported.\")\n        new_result._is_bool = False\n        new_result._separable = passed_array._separable\n        if isinstance(passed_kernel, Kernel):\n            new_result._separable = new_result._separable and passed_kernel._separable\n        return new_result\n    elif array_dtype.kind == 'f':\n        # Try to preserve the input type if it's a floating point type\n        # Avoid making another copy if possible\n        try:\n            return result.astype(array_dtype, copy=False)\n        except TypeError:\n            return result.astype(array_dtype)\n    else:\n        return result\n\n\n@support_nddata(data='array')\ndef convolve_fft(array, kernel, boundary='fill', fill_value=0.,\n                 nan_treatment='interpolate', normalize_kernel=True,\n                 normalization_zero_tol=1e-8,\n                 preserve_nan=False, mask=None, crop=True, return_fft=False,\n                 fft_pad=None, psf_pad=None, min_wt=0.0, allow_huge=False,\n                 fftn=np.fft.fftn, ifftn=np.fft.ifftn,\n                 complex_dtype=complex, dealias=False):\n    \"\"\"\n    Convolve an ndarray with an nd-kernel.  Returns a convolved image with\n    ``shape = array.shape``.  Assumes kernel is centered.\n\n    `convolve_fft` is very similar to `convolve` in that it replaces ``NaN``\n    values in the original image with interpolated values using the kernel as\n    an interpolation function.  However, it also includes many additional\n    options specific to the implementation.\n\n    `convolve_fft` differs from `scipy.signal.fftconvolve` in a few ways:\n\n    * It can treat ``NaN`` values as zeros or interpolate over them.\n    * ``inf`` values are treated as ``NaN``\n    * It optionally pads to the nearest faster sizes to improve FFT speed.\n      These sizes are optimized for the numpy and scipy implementations, and\n      ``fftconvolve`` uses them by default as well; when using other external\n      functions (see below), results may vary.\n    * Its only valid ``mode`` is 'same' (i.e., the same shape array is returned)\n    * It lets you use your own fft, e.g.,\n      `pyFFTW <https://pypi.org/project/pyFFTW/>`_ or\n      `pyFFTW3 <https://pypi.org/project/PyFFTW3/0.2.1/>`_ , which can lead to\n      performance improvements, depending on your system configuration.  pyFFTW3\n      is threaded, and therefore may yield significant performance benefits on\n      multi-core machines at the cost of greater memory requirements.  Specify\n      the ``fftn`` and ``ifftn`` keywords to override the default, which is\n      `numpy.fft.fftn` and `numpy.fft.ifftn`.  The `scipy.fft` functions also\n      offer somewhat better performance and a multi-threaded option.\n\n    Parameters\n    ----------\n    array : `numpy.ndarray`\n        Array to be convolved with ``kernel``.  It can be of any\n        dimensionality, though only 1, 2, and 3d arrays have been tested.\n    kernel : `numpy.ndarray` or `astropy.convolution.Kernel`\n        The convolution kernel. The number of dimensions should match those\n        for the array.  The dimensions *do not* have to be odd in all directions,\n        unlike in the non-fft `convolve` function.  The kernel will be\n        normalized if ``normalize_kernel`` is set.  It is assumed to be centered\n        (i.e., shifts may result if your kernel is asymmetric)\n    boundary : {'fill', 'wrap'}, optional\n        A flag indicating how to handle boundaries:\n\n            * 'fill': set values outside the array boundary to fill_value\n              (default)\n            * 'wrap': periodic boundary\n\n        The `None` and 'extend' parameters are not supported for FFT-based\n        convolution.\n    fill_value : float, optional\n        The value to use outside the array when using boundary='fill'.\n    nan_treatment : {'interpolate', 'fill'}, optional\n        The method used to handle NaNs in the input ``array``:\n            * ``'interpolate'``: ``NaN`` values are replaced with\n              interpolated values using the kernel as an interpolation\n              function. Note that if the kernel has a sum equal to\n              zero, NaN interpolation is not possible and will raise an\n              exception.\n            * ``'fill'``: ``NaN`` values are replaced by ``fill_value``\n              prior to convolution.\n    normalize_kernel : callable or boolean, optional\n        If specified, this is the function to divide kernel by to normalize it.\n        e.g., ``normalize_kernel=np.sum`` means that kernel will be modified to be:\n        ``kernel = kernel / np.sum(kernel)``.  If True, defaults to\n        ``normalize_kernel = np.sum``.\n    normalization_zero_tol : float, optional\n        The absolute tolerance on whether the kernel is different than zero.\n        If the kernel sums to zero to within this precision, it cannot be\n        normalized. Default is \"1e-8\".\n    preserve_nan : bool, optional\n        After performing convolution, should pixels that were originally NaN\n        again become NaN?\n    mask : None or ndarray, optional\n        A \"mask\" array.  Shape must match ``array``, and anything that is masked\n        (i.e., not 0/`False`) will be set to NaN for the convolution.  If\n        `None`, no masking will be performed unless ``array`` is a masked array.\n        If ``mask`` is not `None` *and* ``array`` is a masked array, a pixel is\n        masked of it is masked in either ``mask`` *or* ``array.mask``.\n    crop : bool, optional\n        Default on.  Return an image of the size of the larger of the input\n        image and the kernel.\n        If the image and kernel are asymmetric in opposite directions, will\n        return the largest image in both directions.\n        For example, if an input image has shape [100,3] but a kernel with shape\n        [6,6] is used, the output will be [100,6].\n    return_fft : bool, optional\n        Return the ``fft(image)*fft(kernel)`` instead of the convolution (which is\n        ``ifft(fft(image)*fft(kernel))``).  Useful for making PSDs.\n    fft_pad : bool, optional\n        Default on.  Zero-pad image to the nearest size supporting more efficient\n        execution of the FFT, generally values factorizable into the first 3-5\n        prime numbers.  With ``boundary='wrap'``, this will be disabled.\n    psf_pad : bool, optional\n        Zero-pad image to be at least the sum of the image sizes to avoid\n        edge-wrapping when smoothing.  This is enabled by default with\n        ``boundary='fill'``, but it can be overridden with a boolean option.\n        ``boundary='wrap'`` and ``psf_pad=True`` are not compatible.\n    min_wt : float, optional\n        If ignoring ``NaN`` / zeros, force all grid points with a weight less than\n        this value to ``NaN`` (the weight of a grid point with *no* ignored\n        neighbors is 1.0).\n        If ``min_wt`` is zero, then all zero-weight points will be set to zero\n        instead of ``NaN`` (which they would be otherwise, because 1/0 = nan).\n        See the examples below.\n    allow_huge : bool, optional\n        Allow huge arrays in the FFT?  If False, will raise an exception if the\n        array or kernel size is >1 GB.\n    fftn : callable, optional\n        The fft function.  Can be overridden to use your own ffts,\n        e.g. an fftw3 wrapper or scipy's fftn, ``fft=scipy.fftpack.fftn``.\n    ifftn : callable, optional\n        The inverse fft function. Can be overridden the same way ``fttn``.\n    complex_dtype : complex type, optional\n        Which complex dtype to use.  `numpy` has a range of options, from 64 to\n        256.\n    dealias: bool, optional\n        Default off. Zero-pad image to enable explicit dealiasing\n        of convolution. With ``boundary='wrap'``, this will be disabled.\n        Note that for an input of nd dimensions this will increase\n        the size of the temporary arrays by at least ``1.5**nd``.\n        This may result in significantly more memory usage.\n\n    Returns\n    -------\n    default : ndarray\n        ``array`` convolved with ``kernel``.  If ``return_fft`` is set, returns\n        ``fft(array) * fft(kernel)``.  If crop is not set, returns the\n        image, but with the fft-padded size instead of the input size.\n\n    Raises\n    ------\n    `ValueError`\n        If the array is bigger than 1 GB after padding, will raise this\n        exception unless ``allow_huge`` is True.\n\n    See Also\n    --------\n    convolve:\n        Convolve is a non-fft version of this code.  It is more memory\n        efficient and for small kernels can be faster.\n\n    Notes\n    -----\n    With ``psf_pad=True`` and a large PSF, the resulting data\n    can become large and consume a lot of memory. See Issue\n    https://github.com/astropy/astropy/pull/4366 and the update in\n    https://github.com/astropy/astropy/pull/11533 for further details.\n\n    Dealiasing of pseudospectral convolutions is necessary for\n    numerical stability of the underlying algorithms. A common\n    method for handling this is to zero pad the image by at least\n    1/2 to eliminate the wavenumbers which have been aliased\n    by convolution. This is so that the aliased 1/3 of the\n    results of the convolution computation can be thrown out. See\n    https://doi.org/10.1175/1520-0469(1971)028%3C1074:OTEOAI%3E2.0.CO;2\n    https://iopscience.iop.org/article/10.1088/1742-6596/318/7/072037\n\n    Note that if dealiasing is necessary to your application, but your\n    process is memory constrained, you may want to consider using\n    FFTW++: https://github.com/dealias/fftwpp. It includes python\n    wrappers for a pseudospectral convolution which will implicitly\n    dealias your convolution without the need for additional padding.\n    Note that one cannot use FFTW++'s convlution directly in this\n    method as in handles the entire convolution process internally.\n    Additionally, FFTW++ includes other useful pseudospectral methods to\n    consider.\n\n    Examples\n    --------\n    >>> convolve_fft([1, 0, 3], [1, 1, 1])\n    array([0.33333333, 1.33333333, 1.        ])\n\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1])\n    array([0.5, 2. , 1.5])\n\n    >>> convolve_fft([1, 0, 3], [0, 1, 0])  # doctest: +FLOAT_CMP\n    array([ 1.00000000e+00, -3.70074342e-17,  3.00000000e+00])\n\n    >>> convolve_fft([1, 2, 3], [1])\n    array([1., 2., 3.])\n\n    >>> convolve_fft([1, np.nan, 3], [0, 1, 0], nan_treatment='interpolate')\n    array([1., 0., 3.])\n\n    >>> convolve_fft([1, np.nan, 3], [0, 1, 0], nan_treatment='interpolate',\n    ...              min_wt=1e-8)\n    array([ 1., nan,  3.])\n\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate')\n    array([0.5, 2. , 1.5])\n\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate',\n    ...               normalize_kernel=True)\n    array([0.5, 2. , 1.5])\n\n    >>> import scipy.fft  # optional - requires scipy\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate',\n    ...               normalize_kernel=True,\n    ...               fftn=scipy.fft.fftn, ifftn=scipy.fft.ifftn)\n    array([0.5, 2. , 1.5])\n\n    >>> fft_mp = lambda a: scipy.fft.fftn(a, workers=-1)  # use all available cores\n    >>> ifft_mp = lambda a: scipy.fft.ifftn(a, workers=-1)\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate',\n    ...               normalize_kernel=True, fftn=fft_mp, ifftn=ifft_mp)\n    array([0.5, 2. , 1.5])\n    \"\"\"\n    # Checking copied from convolve.py - however, since FFTs have real &\n    # complex components, we change the types.  Only the real part will be\n    # returned! Note that this always makes a copy.\n\n    # Check kernel is kernel instance\n    if isinstance(kernel, Kernel):\n        kernel = kernel.array\n        if isinstance(array, Kernel):\n            raise TypeError(\"Can't convolve two kernels with convolve_fft.  Use convolve instead.\")\n\n    if nan_treatment not in ('interpolate', 'fill'):\n        raise ValueError(\"nan_treatment must be one of 'interpolate','fill'\")\n\n    # Get array quantity if it exists\n    array_unit = getattr(array, \"unit\", None)\n\n    # Convert array dtype to complex\n    # and ensure that list inputs become arrays\n    array = _copy_input_if_needed(array, dtype=complex, order='C',\n                                  nan_treatment=nan_treatment, mask=mask,\n                                  fill_value=np.nan)\n    kernel = _copy_input_if_needed(kernel, dtype=complex, order='C',\n                                   nan_treatment=None, mask=None,\n                                   fill_value=0)\n\n    # Check that the number of dimensions is compatible\n    if array.ndim != kernel.ndim:\n        raise ValueError(\"Image and kernel must have same number of dimensions\")\n\n    arrayshape = array.shape\n    kernshape = kernel.shape\n\n    array_size_B = (np.product(arrayshape, dtype=np.int64) *\n                    np.dtype(complex_dtype).itemsize) * u.byte\n    if array_size_B > 1 * u.GB and not allow_huge:\n        raise ValueError(f\"Size Error: Arrays will be {human_file_size(array_size_B)}.  \"\n                         f\"Use allow_huge=True to override this exception.\")\n\n    # NaN and inf catching\n    nanmaskarray = np.isnan(array) | np.isinf(array)\n    if nan_treatment == 'fill':\n        array[nanmaskarray] = fill_value\n    else:\n        array[nanmaskarray] = 0\n    nanmaskkernel = np.isnan(kernel) | np.isinf(kernel)\n    kernel[nanmaskkernel] = 0\n\n    if normalize_kernel is True:\n        if kernel.sum() < 1. / MAX_NORMALIZATION:\n            raise Exception(\"The kernel can't be normalized, because its sum is \"\n                            \"close to zero. The sum of the given kernel is < {}\"\n                            .format(1. / MAX_NORMALIZATION))\n        kernel_scale = kernel.sum()\n        normalized_kernel = kernel / kernel_scale\n        kernel_scale = 1  # if we want to normalize it, leave it normed!\n    elif normalize_kernel:\n        # try this.  If a function is not passed, the code will just crash... I\n        # think type checking would be better but PEPs say otherwise...\n        kernel_scale = normalize_kernel(kernel)\n        normalized_kernel = kernel / kernel_scale\n    else:\n        kernel_scale = kernel.sum()\n        if np.abs(kernel_scale) < normalization_zero_tol:\n            if nan_treatment == 'interpolate':\n                raise ValueError('Cannot interpolate NaNs with an unnormalizable kernel')\n            else:\n                # the kernel's sum is near-zero, so it can't be scaled\n                kernel_scale = 1\n                normalized_kernel = kernel\n        else:\n            # the kernel is normalizable; we'll temporarily normalize it\n            # now and undo the normalization later.\n            normalized_kernel = kernel / kernel_scale\n\n    if boundary is None:\n        warnings.warn(\"The convolve_fft version of boundary=None is \"\n                      \"equivalent to the convolve boundary='fill'.  There is \"\n                      \"no FFT equivalent to convolve's \"\n                      \"zero-if-kernel-leaves-boundary\", AstropyUserWarning)\n        if psf_pad is None:\n            psf_pad = True\n        if fft_pad is None:\n            fft_pad = True\n    elif boundary == 'fill':\n        # create a boundary region at least as large as the kernel\n        if psf_pad is False:\n            warnings.warn(f\"psf_pad was set to {psf_pad}, which overrides the \"\n                          f\"boundary='fill' setting.\", AstropyUserWarning)\n        else:\n            psf_pad = True\n        if fft_pad is None:\n            # default is 'True' according to the docstring\n            fft_pad = True\n    elif boundary == 'wrap':\n        if psf_pad:\n            raise ValueError(\"With boundary='wrap', psf_pad cannot be enabled.\")\n        psf_pad = False\n        if fft_pad:\n            raise ValueError(\"With boundary='wrap', fft_pad cannot be enabled.\")\n        fft_pad = False\n        if dealias:\n            raise ValueError(\"With boundary='wrap', dealias cannot be enabled.\")\n        fill_value = 0  # force zero; it should not be used\n    elif boundary == 'extend':\n        raise NotImplementedError(\"The 'extend' option is not implemented \"\n                                  \"for fft-based convolution\")\n\n    # Add shapes elementwise for psf_pad.\n    if psf_pad:  # default=False\n        # add the sizes along each dimension (bigger)\n        newshape = np.array(arrayshape) + np.array(kernshape)\n    else:\n        # take the larger shape in each dimension (smaller)\n        newshape = np.maximum(arrayshape, kernshape)\n\n    if dealias:\n        # Extend shape by 1/2 for dealiasing\n        newshape += np.ceil(newshape / 2).astype(int)\n\n    # Find ideal size for fft (was power of 2, now any powers of prime factors 2, 3, 5).\n    if fft_pad:  # default=True\n        # Get optimized sizes from scipy.\n        newshape = _next_fast_lengths(newshape)\n\n    # perform a second check after padding\n    array_size_C = (np.product(newshape, dtype=np.int64) *\n                    np.dtype(complex_dtype).itemsize) * u.byte\n    if array_size_C > 1 * u.GB and not allow_huge:\n        raise ValueError(f\"Size Error: Arrays will be {human_file_size(array_size_C)}.  \"\n                         f\"Use allow_huge=True to override this exception.\")\n\n    # For future reference, this can be used to predict \"almost exactly\"\n    # how much *additional* memory will be used.\n    # size * (array + kernel + kernelfft + arrayfft +\n    #         (kernel*array)fft +\n    #         optional(weight image + weight_fft + weight_ifft) +\n    #         optional(returned_fft))\n    # total_memory_used_GB = (np.product(newshape)*np.dtype(complex_dtype).itemsize\n    #                        * (5 + 3*((interpolate_nan or ) and kernel_is_normalized))\n    #                        + (1 + (not return_fft)) *\n    #                          np.product(arrayshape)*np.dtype(complex_dtype).itemsize\n    #                        + np.product(arrayshape)*np.dtype(bool).itemsize\n    #                        + np.product(kernshape)*np.dtype(bool).itemsize)\n    #                        ) / 1024.**3\n\n    # separate each dimension by the padding size...  this is to determine the\n    # appropriate slice size to get back to the input dimensions\n    arrayslices = []\n    kernslices = []\n    for ii, (newdimsize, arraydimsize, kerndimsize) in enumerate(zip(newshape, arrayshape, kernshape)):\n        center = newdimsize - (newdimsize + 1) // 2\n        arrayslices += [slice(center - arraydimsize // 2,\n                              center + (arraydimsize + 1) // 2)]\n        kernslices += [slice(center - kerndimsize // 2,\n                             center + (kerndimsize + 1) // 2)]\n    arrayslices = tuple(arrayslices)\n    kernslices = tuple(kernslices)\n\n    if not np.all(newshape == arrayshape):\n        if np.isfinite(fill_value):\n            bigarray = np.ones(newshape, dtype=complex_dtype) * fill_value\n        else:\n            bigarray = np.zeros(newshape, dtype=complex_dtype)\n        bigarray[arrayslices] = array\n    else:\n        bigarray = array\n\n    if not np.all(newshape == kernshape):\n        bigkernel = np.zeros(newshape, dtype=complex_dtype)\n        bigkernel[kernslices] = normalized_kernel\n    else:\n        bigkernel = normalized_kernel\n\n    arrayfft = fftn(bigarray)\n    # need to shift the kernel so that, e.g., [0,0,1,0] -> [1,0,0,0] = unity\n    kernfft = fftn(np.fft.ifftshift(bigkernel))\n    fftmult = arrayfft * kernfft\n\n    interpolate_nan = (nan_treatment == 'interpolate')\n    if interpolate_nan:\n        if not np.isfinite(fill_value):\n            bigimwt = np.zeros(newshape, dtype=complex_dtype)\n        else:\n            bigimwt = np.ones(newshape, dtype=complex_dtype)\n\n        bigimwt[arrayslices] = 1.0 - nanmaskarray * interpolate_nan\n        wtfft = fftn(bigimwt)\n\n        # You can only get to this point if kernel_is_normalized\n        wtfftmult = wtfft * kernfft\n        wtsm = ifftn(wtfftmult)\n        # need to re-zero weights outside of the image (if it is padded, we\n        # still don't weight those regions)\n        bigimwt[arrayslices] = wtsm.real[arrayslices]\n    else:\n        bigimwt = 1\n\n    if np.isnan(fftmult).any():\n        # this check should be unnecessary; call it an insanity check\n        raise ValueError(\"Encountered NaNs in convolve.  This is disallowed.\")\n\n    fftmult *= kernel_scale\n\n    if array_unit is not None:\n        fftmult <<= array_unit\n\n    if return_fft:\n        return fftmult\n\n    if interpolate_nan:\n        with np.errstate(divide='ignore', invalid='ignore'):\n            # divide by zeros are expected here; if the weight is zero, we want\n            # the output to be nan or inf\n            rifft = (ifftn(fftmult)) / bigimwt\n        if not np.isscalar(bigimwt):\n            if min_wt > 0.:\n                rifft[bigimwt < min_wt] = np.nan\n            else:\n                # Set anything with no weight to zero (taking into account\n                # slight offsets due to floating-point errors).\n                rifft[bigimwt < 10 * np.finfo(bigimwt.dtype).eps] = 0.0\n    else:\n        rifft = ifftn(fftmult)\n\n    if preserve_nan:\n        rifft[arrayslices][nanmaskarray] = np.nan\n\n    if crop:\n        result = rifft[arrayslices].real\n        return result\n    else:\n        return rifft.real\n\n\ndef interpolate_replace_nans(array, kernel, convolve=convolve, **kwargs):\n    \"\"\"\n    Given a data set containing NaNs, replace the NaNs by interpolating from\n    neighboring data points with a given kernel.\n\n    Parameters\n    ----------\n    array : `numpy.ndarray`\n        Array to be convolved with ``kernel``.  It can be of any\n        dimensionality, though only 1, 2, and 3d arrays have been tested.\n    kernel : `numpy.ndarray` or `astropy.convolution.Kernel`\n        The convolution kernel. The number of dimensions should match those\n        for the array.  The dimensions *do not* have to be odd in all directions,\n        unlike in the non-fft `convolve` function.  The kernel will be\n        normalized if ``normalize_kernel`` is set.  It is assumed to be centered\n        (i.e., shifts may result if your kernel is asymmetric).  The kernel\n        *must be normalizable* (i.e., its sum cannot be zero).\n    convolve : `convolve` or `convolve_fft`\n        One of the two convolution functions defined in this package.\n\n    Returns\n    -------\n    newarray : `numpy.ndarray`\n        A copy of the original array with NaN pixels replaced with their\n        interpolated counterparts\n    \"\"\"\n\n    if not np.any(np.isnan(array)):\n        return array.copy()\n\n    newarray = array.copy()\n\n    convolved = convolve(array, kernel, nan_treatment='interpolate',\n                         normalize_kernel=True, preserve_nan=False, **kwargs)\n\n    isnan = np.isnan(array)\n    newarray[isnan] = convolved[isnan]\n\n    return newarray\n\n\ndef convolve_models(model, kernel, mode='convolve_fft', **kwargs):\n    \"\"\"\n    Convolve two models using `~astropy.convolution.convolve_fft`.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.core.Model`\n        Functional model\n    kernel : `~astropy.modeling.core.Model`\n        Convolution kernel\n    mode : str\n        Keyword representing which function to use for convolution.\n            * 'convolve_fft' : use `~astropy.convolution.convolve_fft` function.\n            * 'convolve' : use `~astropy.convolution.convolve`.\n    **kwargs : dict\n        Keyword arguments to me passed either to `~astropy.convolution.convolve`\n        or `~astropy.convolution.convolve_fft` depending on ``mode``.\n\n    Returns\n    -------\n    default : `~astropy.modeling.core.CompoundModel`\n        Convolved model\n    \"\"\"\n\n    if mode == 'convolve_fft':\n        operator = SPECIAL_OPERATORS.add('convolve_fft', partial(convolve_fft, **kwargs))\n    elif mode == 'convolve':\n        operator = SPECIAL_OPERATORS.add('convolve', partial(convolve, **kwargs))\n    else:\n        raise ValueError(f'Mode {mode} is not supported.')\n\n    return CompoundModel(operator, model, kernel)\n\n\ndef convolve_models_fft(model, kernel, bounding_box, resolution, cache=True, **kwargs):\n    \"\"\"\n    Convolve two models using `~astropy.convolution.convolve_fft`.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.core.Model`\n        Functional model\n    kernel : `~astropy.modeling.core.Model`\n        Convolution kernel\n    bounding_box : tuple\n        The bounding box which encompasses enough of the support of both\n        the ``model`` and ``kernel`` so that an accurate convolution can be\n        computed.\n    resolution : float\n        The resolution that one wishes to approximate the convolution\n        integral at.\n    cache : optional, bool\n        Default value True. Allow for the storage of the convolution\n        computation for later reuse.\n    **kwargs : dict\n        Keyword arguments to be passed either to `~astropy.convolution.convolve`\n        or `~astropy.convolution.convolve_fft` depending on ``mode``.\n\n    Returns\n    -------\n    default : `~astropy.modeling.core.CompoundModel`\n        Convolved model\n    \"\"\"\n\n    operator = SPECIAL_OPERATORS.add('convolve_fft', partial(convolve_fft, **kwargs))\n\n    return Convolution(operator, model, kernel, bounding_box, resolution, cache)\n"},{"attributeType":"null","col":12,"comment":"null","endLoc":70,"id":14610,"name":"_required_columns_relax","nodeType":"Attribute","startLoc":70,"text":"self._required_columns_relax"},{"fileName":"__init__.py","filePath":"astropy/convolution","id":14611,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nfrom .convolve import (convolve, convolve_fft, convolve_models,\n                       convolve_models_fft, interpolate_replace_nans)\nfrom .core import *\nfrom .kernels import *\nfrom .kernels import MexicanHat1DKernel, MexicanHat2DKernel  # Deprecated kernels\nfrom .utils import *\n"},{"attributeType":"null","col":12,"comment":"null","endLoc":185,"id":14612,"name":"_neff_per_nu","nodeType":"Attribute","startLoc":185,"text":"self._neff_per_nu"},{"attributeType":"null","col":16,"comment":"null","endLoc":5,"id":14613,"name":"np","nodeType":"Attribute","startLoc":5,"text":"np"},{"attributeType":"null","col":29,"comment":"null","endLoc":9,"id":14614,"name":"u","nodeType":"Attribute","startLoc":9,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":14615,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"sampled.py#<anonymous>","id":14616,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['TimeSeries']"},{"col":0,"comment":"","endLoc":1,"header":"__init__.py#<anonymous>","id":14618,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"Various implementations of the Lomb-Scargle Periodogram\"\"\""},{"fileName":"utils.py","filePath":"astropy/convolution","id":14619,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport ctypes\n\nimport numpy as np\n\nfrom astropy.modeling.core import FittableModel, custom_model\n\n__all__ = ['discretize_model', 'KernelSizeError']\n\n\nclass DiscretizationError(Exception):\n    \"\"\"\n    Called when discretization of models goes wrong.\n    \"\"\"\n\n\nclass KernelSizeError(Exception):\n    \"\"\"\n    Called when size of kernels is even.\n    \"\"\"\n\n\ndef has_even_axis(array):\n    if isinstance(array, (list, tuple)):\n        return not len(array) % 2\n    else:\n        return any(not axes_size % 2 for axes_size in array.shape)\n\n\ndef raise_even_kernel_exception():\n    raise KernelSizeError(\"Kernel size must be odd in all axes.\")\n\n\ndef add_kernel_arrays_1D(array_1, array_2):\n    \"\"\"\n    Add two 1D kernel arrays of different size.\n\n    The arrays are added with the centers lying upon each other.\n    \"\"\"\n    if array_1.size > array_2.size:\n        new_array = array_1.copy()\n        center = array_1.size // 2\n        slice_ = slice(center - array_2.size // 2,\n                       center + array_2.size // 2 + 1)\n        new_array[slice_] += array_2\n        return new_array\n    elif array_2.size > array_1.size:\n        new_array = array_2.copy()\n        center = array_2.size // 2\n        slice_ = slice(center - array_1.size // 2,\n                       center + array_1.size // 2 + 1)\n        new_array[slice_] += array_1\n        return new_array\n    return array_2 + array_1\n\n\ndef add_kernel_arrays_2D(array_1, array_2):\n    \"\"\"\n    Add two 2D kernel arrays of different size.\n\n    The arrays are added with the centers lying upon each other.\n    \"\"\"\n    if array_1.size > array_2.size:\n        new_array = array_1.copy()\n        center = [axes_size // 2 for axes_size in array_1.shape]\n        slice_x = slice(center[1] - array_2.shape[1] // 2,\n                        center[1] + array_2.shape[1] // 2 + 1)\n        slice_y = slice(center[0] - array_2.shape[0] // 2,\n                        center[0] + array_2.shape[0] // 2 + 1)\n        new_array[slice_y, slice_x] += array_2\n        return new_array\n    elif array_2.size > array_1.size:\n        new_array = array_2.copy()\n        center = [axes_size // 2 for axes_size in array_2.shape]\n        slice_x = slice(center[1] - array_1.shape[1] // 2,\n                        center[1] + array_1.shape[1] // 2 + 1)\n        slice_y = slice(center[0] - array_1.shape[0] // 2,\n                        center[0] + array_1.shape[0] // 2 + 1)\n        new_array[slice_y, slice_x] += array_1\n        return new_array\n    return array_2 + array_1\n\n\ndef discretize_model(model, x_range, y_range=None, mode='center', factor=10):\n    \"\"\"\n    Function to evaluate analytical model functions on a grid.\n\n    So far the function can only deal with pixel coordinates.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.FittableModel` or callable.\n        Analytic model function to be discretized. Callables, which are not an\n        instances of `~astropy.modeling.FittableModel` are passed to\n        `~astropy.modeling.custom_model` and then evaluated.\n    x_range : tuple\n        x range in which the model is evaluated. The difference between the\n        upper an lower limit must be a whole number, so that the output array\n        size is well defined.\n    y_range : tuple, optional\n        y range in which the model is evaluated. The difference between the\n        upper an lower limit must be a whole number, so that the output array\n        size is well defined. Necessary only for 2D models.\n    mode : str, optional\n        One of the following modes:\n            * ``'center'`` (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * ``'linear_interp'``\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n                For 2D models interpolation is bilinear.\n            * ``'oversample'``\n                Discretize model by taking the average\n                on an oversampled grid.\n            * ``'integrate'``\n                Discretize model by integrating the model\n                over the bin using `scipy.integrate.quad`.\n                Very slow.\n    factor : float or int\n        Factor of oversampling. Default = 10.\n\n    Returns\n    -------\n    array : `numpy.array`\n        Model value array\n\n    Notes\n    -----\n    The ``oversample`` mode allows to conserve the integral on a subpixel\n    scale. Here is the example of a normalized Gaussian1D:\n\n    .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        import numpy as np\n        from astropy.modeling.models import Gaussian1D\n        from astropy.convolution.utils import discretize_model\n        gauss_1D = Gaussian1D(1 / (0.5 * np.sqrt(2 * np.pi)), 0, 0.5)\n        y_center = discretize_model(gauss_1D, (-2, 3), mode='center')\n        y_corner = discretize_model(gauss_1D, (-2, 3), mode='linear_interp')\n        y_oversample = discretize_model(gauss_1D, (-2, 3), mode='oversample')\n        plt.plot(y_center, label='center sum = {0:3f}'.format(y_center.sum()))\n        plt.plot(y_corner, label='linear_interp sum = {0:3f}'.format(y_corner.sum()))\n        plt.plot(y_oversample, label='oversample sum = {0:3f}'.format(y_oversample.sum()))\n        plt.xlabel('pixels')\n        plt.ylabel('value')\n        plt.legend()\n        plt.show()\n\n\n    \"\"\"\n    if not callable(model):\n        raise TypeError('Model must be callable.')\n    if not isinstance(model, FittableModel):\n        model = custom_model(model)()\n    ndim = model.n_inputs\n    if ndim > 2:\n        raise ValueError('discretize_model only supports 1-d and 2-d models.')\n\n    if not float(np.diff(x_range)).is_integer():\n        raise ValueError(\"The difference between the upper and lower limit of\"\n                         \" 'x_range' must be a whole number.\")\n\n    if y_range:\n        if not float(np.diff(y_range)).is_integer():\n            raise ValueError(\"The difference between the upper and lower limit of\"\n                             \" 'y_range' must be a whole number.\")\n\n    if ndim == 2 and y_range is None:\n        raise ValueError(\"y range not specified, but model is 2-d\")\n    if ndim == 1 and y_range is not None:\n        raise ValueError(\"y range specified, but model is only 1-d.\")\n    if mode == \"center\":\n        if ndim == 1:\n            return discretize_center_1D(model, x_range)\n        elif ndim == 2:\n            return discretize_center_2D(model, x_range, y_range)\n    elif mode == \"linear_interp\":\n        if ndim == 1:\n            return discretize_linear_1D(model, x_range)\n        if ndim == 2:\n            return discretize_bilinear_2D(model, x_range, y_range)\n    elif mode == \"oversample\":\n        if ndim == 1:\n            return discretize_oversample_1D(model, x_range, factor)\n        if ndim == 2:\n            return discretize_oversample_2D(model, x_range, y_range, factor)\n    elif mode == \"integrate\":\n        if ndim == 1:\n            return discretize_integrate_1D(model, x_range)\n        if ndim == 2:\n            return discretize_integrate_2D(model, x_range, y_range)\n    else:\n        raise DiscretizationError('Invalid mode.')\n\n\ndef discretize_center_1D(model, x_range):\n    \"\"\"\n    Discretize model by taking the value at the center of the bin.\n    \"\"\"\n    x = np.arange(*x_range)\n    return model(x)\n\n\ndef discretize_center_2D(model, x_range, y_range):\n    \"\"\"\n    Discretize model by taking the value at the center of the pixel.\n    \"\"\"\n    x = np.arange(*x_range)\n    y = np.arange(*y_range)\n    x, y = np.meshgrid(x, y)\n    return model(x, y)\n\n\ndef discretize_linear_1D(model, x_range):\n    \"\"\"\n    Discretize model by performing a linear interpolation.\n    \"\"\"\n    # Evaluate model 0.5 pixel outside the boundaries\n    x = np.arange(x_range[0] - 0.5, x_range[1] + 0.5)\n    values_intermediate_grid = model(x)\n    return 0.5 * (values_intermediate_grid[1:] + values_intermediate_grid[:-1])\n\n\ndef discretize_bilinear_2D(model, x_range, y_range):\n    \"\"\"\n    Discretize model by performing a bilinear interpolation.\n    \"\"\"\n    # Evaluate model 0.5 pixel outside the boundaries\n    x = np.arange(x_range[0] - 0.5, x_range[1] + 0.5)\n    y = np.arange(y_range[0] - 0.5, y_range[1] + 0.5)\n    x, y = np.meshgrid(x, y)\n    values_intermediate_grid = model(x, y)\n\n    # Mean in y direction\n    values = 0.5 * (values_intermediate_grid[1:, :]\n                    + values_intermediate_grid[:-1, :])\n    # Mean in x direction\n    values = 0.5 * (values[:, 1:]\n                    + values[:, :-1])\n    return values\n\n\ndef discretize_oversample_1D(model, x_range, factor=10):\n    \"\"\"\n    Discretize model by taking the average on an oversampled grid.\n    \"\"\"\n    # Evaluate model on oversampled grid\n    x = np.linspace(x_range[0] - 0.5 * (1 - 1 / factor),\n                    x_range[1] - 0.5 * (1 + 1 / factor),\n                    num=int((x_range[1] - x_range[0]) * factor))\n\n    values = model(x)\n\n    # Reshape and compute mean\n    values = np.reshape(values, (x.size // factor, factor))\n    return values.mean(axis=1)\n\n\ndef discretize_oversample_2D(model, x_range, y_range, factor=10):\n    \"\"\"\n    Discretize model by taking the average on an oversampled grid.\n    \"\"\"\n    # Evaluate model on oversampled grid\n    x = np.linspace(x_range[0] - 0.5 * (1 - 1 / factor),\n                    x_range[1] - 0.5 * (1 + 1 / factor),\n                    num=int((x_range[1] - x_range[0]) * factor))\n    y = np.linspace(y_range[0] - 0.5 * (1 - 1 / factor),\n                    y_range[1] - 0.5 * (1 + 1 / factor),\n                    num=int((y_range[1] - y_range[0]) * factor))\n\n    x_grid, y_grid = np.meshgrid(x, y)\n    values = model(x_grid, y_grid)\n\n    # Reshape and compute mean\n    shape = (y.size // factor, factor, x.size // factor, factor)\n    values = np.reshape(values, shape)\n    return values.mean(axis=3).mean(axis=1)\n\n\ndef discretize_integrate_1D(model, x_range):\n    \"\"\"\n    Discretize model by integrating numerically the model over the bin.\n    \"\"\"\n    from scipy.integrate import quad\n\n    # Set up grid\n    x = np.arange(x_range[0] - 0.5, x_range[1] + 0.5)\n    values = np.array([])\n\n    # Integrate over all bins\n    for i in range(x.size - 1):\n        values = np.append(values, quad(model, x[i], x[i + 1])[0])\n    return values\n\n\ndef discretize_integrate_2D(model, x_range, y_range):\n    \"\"\"\n    Discretize model by integrating the model over the pixel.\n    \"\"\"\n    from scipy.integrate import dblquad\n\n    # Set up grid\n    x = np.arange(x_range[0] - 0.5, x_range[1] + 0.5)\n    y = np.arange(y_range[0] - 0.5, y_range[1] + 0.5)\n    values = np.empty((y.size - 1, x.size - 1))\n\n    # Integrate over all pixels\n    for i in range(x.size - 1):\n        for j in range(y.size - 1):\n            values[j, i] = dblquad(lambda y, x: model(x, y), x[i], x[i + 1],\n                                   lambda x: y[j], lambda x: y[j + 1])[0]\n    return values\n"},{"fileName":"core.py","filePath":"astropy/convolution","id":14620,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module contains the convolution and filter functionalities of astropy.\n\nA few conceptual notes:\nA filter kernel is mainly characterized by its response function. In the 1D\ncase we speak of \"impulse response function\", in the 2D case we call it \"point\nspread function\". This response function is given for every kernel by an\nastropy `FittableModel`, which is evaluated on a grid to obtain a filter array,\nwhich can then be applied to binned data.\n\nThe model is centered on the array and should have an amplitude such that the array\nintegrates to one per default.\n\nCurrently only symmetric 2D kernels are supported.\n\"\"\"\n\nimport copy\nimport warnings\n\nimport numpy as np\n\nfrom astropy.utils.exceptions import AstropyUserWarning\n\nfrom .utils import add_kernel_arrays_1D, add_kernel_arrays_2D, discretize_model\n\nMAX_NORMALIZATION = 100\n\n__all__ = ['Kernel', 'Kernel1D', 'Kernel2D', 'kernel_arithmetics']\n\n\nclass Kernel:\n    \"\"\"\n    Convolution kernel base class.\n\n    Parameters\n    ----------\n    array : ndarray\n        Kernel array.\n    \"\"\"\n    _separable = False\n    _is_bool = True\n    _model = None\n\n    def __init__(self, array):\n        self._array = np.asanyarray(array)\n\n    @property\n    def truncation(self):\n        \"\"\"\n        Deviation from the normalization to one.\n        \"\"\"\n        return self._truncation\n\n    @property\n    def is_bool(self):\n        \"\"\"\n        Indicates if kernel is bool.\n\n        If the kernel is bool the multiplication in the convolution could\n        be omitted, to increase the performance.\n        \"\"\"\n        return self._is_bool\n\n    @property\n    def model(self):\n        \"\"\"\n        Kernel response model.\n        \"\"\"\n        return self._model\n\n    @property\n    def dimension(self):\n        \"\"\"\n        Kernel dimension.\n        \"\"\"\n        return self.array.ndim\n\n    @property\n    def center(self):\n        \"\"\"\n        Index of the kernel center.\n        \"\"\"\n        return [axes_size // 2 for axes_size in self._array.shape]\n\n    def normalize(self, mode='integral'):\n        \"\"\"\n        Normalize the filter kernel.\n\n        Parameters\n        ----------\n        mode : {'integral', 'peak'}\n            One of the following modes:\n                * 'integral' (default)\n                    Kernel is normalized such that its integral = 1.\n                * 'peak'\n                    Kernel is normalized such that its peak = 1.\n        \"\"\"\n\n        if mode == 'integral':\n            normalization = self._array.sum()\n        elif mode == 'peak':\n            normalization = self._array.max()\n        else:\n            raise ValueError(\"invalid mode, must be 'integral' or 'peak'\")\n\n        # Warn the user for kernels that sum to zero\n        if normalization == 0:\n            warnings.warn('The kernel cannot be normalized because it '\n                          'sums to zero.', AstropyUserWarning)\n        else:\n            np.divide(self._array, normalization, self._array)\n\n        self._kernel_sum = self._array.sum()\n\n    @property\n    def shape(self):\n        \"\"\"\n        Shape of the kernel array.\n        \"\"\"\n        return self._array.shape\n\n    @property\n    def separable(self):\n        \"\"\"\n        Indicates if the filter kernel is separable.\n\n        A 2D filter is separable, when its filter array can be written as the\n        outer product of two 1D arrays.\n\n        If a filter kernel is separable, higher dimension convolutions will be\n        performed by applying the 1D filter array consecutively on every dimension.\n        This is significantly faster, than using a filter array with the same\n        dimension.\n        \"\"\"\n        return self._separable\n\n    @property\n    def array(self):\n        \"\"\"\n        Filter kernel array.\n        \"\"\"\n        return self._array\n\n    def __add__(self, kernel):\n        \"\"\"\n        Add two filter kernels.\n        \"\"\"\n        return kernel_arithmetics(self, kernel, 'add')\n\n    def __sub__(self, kernel):\n        \"\"\"\n        Subtract two filter kernels.\n        \"\"\"\n        return kernel_arithmetics(self, kernel, 'sub')\n\n    def __mul__(self, value):\n        \"\"\"\n        Multiply kernel with number or convolve two kernels.\n        \"\"\"\n        return kernel_arithmetics(self, value, \"mul\")\n\n    def __rmul__(self, value):\n        \"\"\"\n        Multiply kernel with number or convolve two kernels.\n        \"\"\"\n        return kernel_arithmetics(self, value, \"mul\")\n\n    def __array__(self):\n        \"\"\"\n        Array representation of the kernel.\n        \"\"\"\n        return self._array\n\n    def __array_wrap__(self, array, context=None):\n        \"\"\"\n        Wrapper for multiplication with numpy arrays.\n        \"\"\"\n        if type(context[0]) == np.ufunc:\n            return NotImplemented\n        else:\n            return array\n\n\nclass Kernel1D(Kernel):\n    \"\"\"\n    Base class for 1D filter kernels.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.FittableModel`\n        Model to be evaluated.\n    x_size : int or None, optional\n        Size of the kernel array. Default = ⌊8*width+1⌋.\n        Only used if ``array`` is None.\n    array : ndarray or None, optional\n        Kernel array.\n    width : number\n        Width of the filter kernel.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n    \"\"\"\n\n    def __init__(self, model=None, x_size=None, array=None, **kwargs):\n        # Initialize from model\n        if self._model:\n            if array is not None:\n                # Reject \"array\" keyword for kernel models, to avoid them not being\n                # populated as expected.\n                raise TypeError(\"Array argument not allowed for kernel models.\")\n\n            if x_size is None:\n                x_size = self._default_size\n            elif x_size != int(x_size):\n                raise TypeError(\"x_size should be an integer\")\n\n            # Set ranges where to evaluate the model\n\n            if x_size % 2 == 0:  # even kernel\n                x_range = (-(int(x_size)) // 2 + 0.5, (int(x_size)) // 2 + 0.5)\n            else:  # odd kernel\n                x_range = (-(int(x_size) - 1) // 2, (int(x_size) - 1) // 2 + 1)\n\n            array = discretize_model(self._model, x_range, **kwargs)\n\n        # Initialize from array\n        elif array is None:\n            raise TypeError(\"Must specify either array or model.\")\n\n        super().__init__(array)\n\n\nclass Kernel2D(Kernel):\n    \"\"\"\n    Base class for 2D filter kernels.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.FittableModel`\n        Model to be evaluated.\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*width + 1⌋.\n        Only used if ``array`` is None.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*width + 1⌋.\n        Only used if ``array`` is None,\n    array : ndarray or None, optional\n        Kernel array. Default is None.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    width : number\n        Width of the filter kernel.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n    \"\"\"\n\n    def __init__(self, model=None, x_size=None, y_size=None, array=None, **kwargs):\n\n        # Initialize from model\n        if self._model:\n            if array is not None:\n                # Reject \"array\" keyword for kernel models, to avoid them not being\n                # populated as expected.\n                raise TypeError(\"Array argument not allowed for kernel models.\")\n            if x_size is None:\n                x_size = self._default_size\n            elif x_size != int(x_size):\n                raise TypeError(\"x_size should be an integer\")\n\n            if y_size is None:\n                y_size = x_size\n            elif y_size != int(y_size):\n                raise TypeError(\"y_size should be an integer\")\n\n            # Set ranges where to evaluate the model\n\n            if x_size % 2 == 0:  # even kernel\n                x_range = (-(int(x_size)) // 2 + 0.5, (int(x_size)) // 2 + 0.5)\n            else:  # odd kernel\n                x_range = (-(int(x_size) - 1) // 2, (int(x_size) - 1) // 2 + 1)\n\n            if y_size % 2 == 0:  # even kernel\n                y_range = (-(int(y_size)) // 2 + 0.5, (int(y_size)) // 2 + 0.5)\n            else:  # odd kernel\n                y_range = (-(int(y_size) - 1) // 2, (int(y_size) - 1) // 2 + 1)\n\n            array = discretize_model(self._model, x_range, y_range, **kwargs)\n\n        # Initialize from array\n        elif array is None:\n            raise TypeError(\"Must specify either array or model.\")\n\n        super().__init__(array)\n\n\ndef kernel_arithmetics(kernel, value, operation):\n    \"\"\"\n    Add, subtract or multiply two kernels.\n\n    Parameters\n    ----------\n    kernel : `astropy.convolution.Kernel`\n        Kernel instance.\n    value : `astropy.convolution.Kernel`, float, or int\n        Value to operate with.\n    operation : {'add', 'sub', 'mul'}\n        One of the following operations:\n            * 'add'\n                Add two kernels\n            * 'sub'\n                Subtract two kernels\n            * 'mul'\n                Multiply kernel with number or convolve two kernels.\n    \"\"\"\n    # 1D kernels\n    if isinstance(kernel, Kernel1D) and isinstance(value, Kernel1D):\n        if operation == \"add\":\n            new_array = add_kernel_arrays_1D(kernel.array, value.array)\n        if operation == \"sub\":\n            new_array = add_kernel_arrays_1D(kernel.array, -value.array)\n        if operation == \"mul\":\n            raise Exception(\"Kernel operation not supported. Maybe you want \"\n                            \"to use convolve(kernel1, kernel2) instead.\")\n        new_kernel = Kernel1D(array=new_array)\n        new_kernel._separable = kernel._separable and value._separable\n        new_kernel._is_bool = kernel._is_bool or value._is_bool\n\n    # 2D kernels\n    elif isinstance(kernel, Kernel2D) and isinstance(value, Kernel2D):\n        if operation == \"add\":\n            new_array = add_kernel_arrays_2D(kernel.array, value.array)\n        if operation == \"sub\":\n            new_array = add_kernel_arrays_2D(kernel.array, -value.array)\n        if operation == \"mul\":\n            raise Exception(\"Kernel operation not supported. Maybe you want \"\n                            \"to use convolve(kernel1, kernel2) instead.\")\n        new_kernel = Kernel2D(array=new_array)\n        new_kernel._separable = kernel._separable and value._separable\n        new_kernel._is_bool = kernel._is_bool or value._is_bool\n\n    # kernel and number\n    elif ((isinstance(kernel, Kernel1D) or isinstance(kernel, Kernel2D))\n        and np.isscalar(value)):\n        if operation == \"mul\":\n            new_kernel = copy.copy(kernel)\n            new_kernel._array *= value\n        else:\n            raise Exception(\"Kernel operation not supported.\")\n    else:\n        raise Exception(\"Kernel operation not supported.\")\n    return new_kernel\n"},{"attributeType":"null","col":12,"comment":"null","endLoc":195,"id":14621,"name":"_nmasslessnu","nodeType":"Attribute","startLoc":195,"text":"self._nmasslessnu"},{"className":"DiscretizationError","col":0,"comment":"\n    Called when discretization of models goes wrong.\n    ","endLoc":14,"id":14622,"nodeType":"Class","startLoc":11,"text":"class DiscretizationError(Exception):\n    \"\"\"\n    Called when discretization of models goes wrong.\n    \"\"\""},{"className":"KernelSizeError","col":0,"comment":"\n    Called when size of kernels is even.\n    ","endLoc":20,"id":14623,"nodeType":"Class","startLoc":17,"text":"class KernelSizeError(Exception):\n    \"\"\"\n    Called when size of kernels is even.\n    \"\"\""},{"col":0,"comment":"null","endLoc":27,"header":"def has_even_axis(array)","id":14624,"name":"has_even_axis","nodeType":"Function","startLoc":23,"text":"def has_even_axis(array):\n    if isinstance(array, (list, tuple)):\n        return not len(array) % 2\n    else:\n        return any(not axes_size % 2 for axes_size in array.shape)"},{"col":0,"comment":"null","endLoc":31,"header":"def raise_even_kernel_exception()","id":14625,"name":"raise_even_kernel_exception","nodeType":"Function","startLoc":30,"text":"def raise_even_kernel_exception():\n    raise KernelSizeError(\"Kernel size must be odd in all axes.\")"},{"col":0,"comment":"\n    Add two 1D kernel arrays of different size.\n\n    The arrays are added with the centers lying upon each other.\n    ","endLoc":54,"header":"def add_kernel_arrays_1D(array_1, array_2)","id":14626,"name":"add_kernel_arrays_1D","nodeType":"Function","startLoc":34,"text":"def add_kernel_arrays_1D(array_1, array_2):\n    \"\"\"\n    Add two 1D kernel arrays of different size.\n\n    The arrays are added with the centers lying upon each other.\n    \"\"\"\n    if array_1.size > array_2.size:\n        new_array = array_1.copy()\n        center = array_1.size // 2\n        slice_ = slice(center - array_2.size // 2,\n                       center + array_2.size // 2 + 1)\n        new_array[slice_] += array_2\n        return new_array\n    elif array_2.size > array_1.size:\n        new_array = array_2.copy()\n        center = array_2.size // 2\n        slice_ = slice(center - array_1.size // 2,\n                       center + array_1.size // 2 + 1)\n        new_array[slice_] += array_1\n        return new_array\n    return array_2 + array_1"},{"col":0,"comment":"\n    Add two 2D kernel arrays of different size.\n\n    The arrays are added with the centers lying upon each other.\n    ","endLoc":81,"header":"def add_kernel_arrays_2D(array_1, array_2)","id":14627,"name":"add_kernel_arrays_2D","nodeType":"Function","startLoc":57,"text":"def add_kernel_arrays_2D(array_1, array_2):\n    \"\"\"\n    Add two 2D kernel arrays of different size.\n\n    The arrays are added with the centers lying upon each other.\n    \"\"\"\n    if array_1.size > array_2.size:\n        new_array = array_1.copy()\n        center = [axes_size // 2 for axes_size in array_1.shape]\n        slice_x = slice(center[1] - array_2.shape[1] // 2,\n                        center[1] + array_2.shape[1] // 2 + 1)\n        slice_y = slice(center[0] - array_2.shape[0] // 2,\n                        center[0] + array_2.shape[0] // 2 + 1)\n        new_array[slice_y, slice_x] += array_2\n        return new_array\n    elif array_2.size > array_1.size:\n        new_array = array_2.copy()\n        center = [axes_size // 2 for axes_size in array_2.shape]\n        slice_x = slice(center[1] - array_1.shape[1] // 2,\n                        center[1] + array_1.shape[1] // 2 + 1)\n        slice_y = slice(center[0] - array_1.shape[0] // 2,\n                        center[0] + array_1.shape[0] // 2 + 1)\n        new_array[slice_y, slice_x] += array_1\n        return new_array\n    return array_2 + array_1"},{"col":0,"comment":"\n    Convolve an array with a kernel.\n\n    This routine differs from `scipy.ndimage.convolve` because\n    it includes a special treatment for ``NaN`` values. Rather than\n    including ``NaN`` values in the array in the convolution calculation, which\n    causes large ``NaN`` holes in the convolved array, ``NaN`` values are\n    replaced with interpolated values using the kernel as an interpolation\n    function.\n\n    Parameters\n    ----------\n    array : `~astropy.nddata.NDData` or array-like\n        The array to convolve. This should be a 1, 2, or 3-dimensional array\n        or a list or a set of nested lists representing a 1, 2, or\n        3-dimensional array.  If an `~astropy.nddata.NDData`, the ``mask`` of\n        the `~astropy.nddata.NDData` will be used as the ``mask`` argument.\n    kernel : `numpy.ndarray` or `~astropy.convolution.Kernel`\n        The convolution kernel. The number of dimensions should match those for\n        the array, and the dimensions should be odd in all directions.  If a\n        masked array, the masked values will be replaced by ``fill_value``.\n    boundary : str, optional\n        A flag indicating how to handle boundaries:\n            * `None`\n                Set the ``result`` values to zero where the kernel\n                extends beyond the edge of the array.\n            * 'fill'\n                Set values outside the array boundary to ``fill_value`` (default).\n            * 'wrap'\n                Periodic boundary that wrap to the other side of ``array``.\n            * 'extend'\n                Set values outside the array to the nearest ``array``\n                value.\n    fill_value : float, optional\n        The value to use outside the array when using ``boundary='fill'``.\n    normalize_kernel : bool, optional\n        Whether to normalize the kernel to have a sum of one.\n    nan_treatment : {'interpolate', 'fill'}, optional\n        The method used to handle NaNs in the input ``array``:\n            * ``'interpolate'``: ``NaN`` values are replaced with\n              interpolated values using the kernel as an interpolation\n              function. Note that if the kernel has a sum equal to\n              zero, NaN interpolation is not possible and will raise an\n              exception.\n            * ``'fill'``: ``NaN`` values are replaced by ``fill_value``\n              prior to convolution.\n    preserve_nan : bool, optional\n        After performing convolution, should pixels that were originally NaN\n        again become NaN?\n    mask : None or ndarray, optional\n        A \"mask\" array.  Shape must match ``array``, and anything that is masked\n        (i.e., not 0/`False`) will be set to NaN for the convolution.  If\n        `None`, no masking will be performed unless ``array`` is a masked array.\n        If ``mask`` is not `None` *and* ``array`` is a masked array, a pixel is\n        masked of it is masked in either ``mask`` *or* ``array.mask``.\n    normalization_zero_tol : float, optional\n        The absolute tolerance on whether the kernel is different than zero.\n        If the kernel sums to zero to within this precision, it cannot be\n        normalized. Default is \"1e-8\".\n\n    Returns\n    -------\n    result : `numpy.ndarray`\n        An array with the same dimensions and as the input array,\n        convolved with kernel.  The data type depends on the input\n        array type.  If array is a floating point type, then the\n        return array keeps the same data type, otherwise the type\n        is ``numpy.float``.\n\n    Notes\n    -----\n    For masked arrays, masked values are treated as NaNs.  The convolution\n    is always done at ``numpy.float`` precision.\n    ","endLoc":438,"header":"@support_nddata(data='array')\ndef convolve(array, kernel, boundary='fill', fill_value=0.,\n             nan_treatment='interpolate', normalize_kernel=True, mask=None,\n             preserve_nan=False, normalization_zero_tol=1e-8)","id":14628,"name":"convolve","nodeType":"Function","startLoc":149,"text":"@support_nddata(data='array')\ndef convolve(array, kernel, boundary='fill', fill_value=0.,\n             nan_treatment='interpolate', normalize_kernel=True, mask=None,\n             preserve_nan=False, normalization_zero_tol=1e-8):\n    \"\"\"\n    Convolve an array with a kernel.\n\n    This routine differs from `scipy.ndimage.convolve` because\n    it includes a special treatment for ``NaN`` values. Rather than\n    including ``NaN`` values in the array in the convolution calculation, which\n    causes large ``NaN`` holes in the convolved array, ``NaN`` values are\n    replaced with interpolated values using the kernel as an interpolation\n    function.\n\n    Parameters\n    ----------\n    array : `~astropy.nddata.NDData` or array-like\n        The array to convolve. This should be a 1, 2, or 3-dimensional array\n        or a list or a set of nested lists representing a 1, 2, or\n        3-dimensional array.  If an `~astropy.nddata.NDData`, the ``mask`` of\n        the `~astropy.nddata.NDData` will be used as the ``mask`` argument.\n    kernel : `numpy.ndarray` or `~astropy.convolution.Kernel`\n        The convolution kernel. The number of dimensions should match those for\n        the array, and the dimensions should be odd in all directions.  If a\n        masked array, the masked values will be replaced by ``fill_value``.\n    boundary : str, optional\n        A flag indicating how to handle boundaries:\n            * `None`\n                Set the ``result`` values to zero where the kernel\n                extends beyond the edge of the array.\n            * 'fill'\n                Set values outside the array boundary to ``fill_value`` (default).\n            * 'wrap'\n                Periodic boundary that wrap to the other side of ``array``.\n            * 'extend'\n                Set values outside the array to the nearest ``array``\n                value.\n    fill_value : float, optional\n        The value to use outside the array when using ``boundary='fill'``.\n    normalize_kernel : bool, optional\n        Whether to normalize the kernel to have a sum of one.\n    nan_treatment : {'interpolate', 'fill'}, optional\n        The method used to handle NaNs in the input ``array``:\n            * ``'interpolate'``: ``NaN`` values are replaced with\n              interpolated values using the kernel as an interpolation\n              function. Note that if the kernel has a sum equal to\n              zero, NaN interpolation is not possible and will raise an\n              exception.\n            * ``'fill'``: ``NaN`` values are replaced by ``fill_value``\n              prior to convolution.\n    preserve_nan : bool, optional\n        After performing convolution, should pixels that were originally NaN\n        again become NaN?\n    mask : None or ndarray, optional\n        A \"mask\" array.  Shape must match ``array``, and anything that is masked\n        (i.e., not 0/`False`) will be set to NaN for the convolution.  If\n        `None`, no masking will be performed unless ``array`` is a masked array.\n        If ``mask`` is not `None` *and* ``array`` is a masked array, a pixel is\n        masked of it is masked in either ``mask`` *or* ``array.mask``.\n    normalization_zero_tol : float, optional\n        The absolute tolerance on whether the kernel is different than zero.\n        If the kernel sums to zero to within this precision, it cannot be\n        normalized. Default is \"1e-8\".\n\n    Returns\n    -------\n    result : `numpy.ndarray`\n        An array with the same dimensions and as the input array,\n        convolved with kernel.  The data type depends on the input\n        array type.  If array is a floating point type, then the\n        return array keeps the same data type, otherwise the type\n        is ``numpy.float``.\n\n    Notes\n    -----\n    For masked arrays, masked values are treated as NaNs.  The convolution\n    is always done at ``numpy.float`` precision.\n    \"\"\"\n\n    if boundary not in BOUNDARY_OPTIONS:\n        raise ValueError(f\"Invalid boundary option: must be one of {BOUNDARY_OPTIONS}\")\n\n    if nan_treatment not in ('interpolate', 'fill'):\n        raise ValueError(\"nan_treatment must be one of 'interpolate','fill'\")\n\n    # OpenMP support is disabled at the C src code level, changing this will have\n    # no effect.\n    n_threads = 1\n\n    # Keep refs to originals\n    passed_kernel = kernel\n    passed_array = array\n\n    # The C routines all need float type inputs (so, a particular\n    # bit size, endianness, etc.).  So we have to convert, which also\n    # has the effect of making copies so we don't modify the inputs.\n    # After this, the variables we work with will be array_internal, and\n    # kernel_internal.  However -- we do want to keep track of what type\n    # the input array was so we can cast the result to that at the end\n    # if it's a floating point type.  Don't bother with this for lists --\n    # just always push those as float.\n    # It is always necessary to make a copy of kernel (since it is modified),\n    # but, if we just so happen to be lucky enough to have the input array\n    # have exactly the desired type, we just alias to array_internal\n    # Convert kernel to ndarray if not already\n\n    # Copy or alias array to array_internal\n    array_internal = _copy_input_if_needed(passed_array, dtype=float, order='C',\n                                           nan_treatment=nan_treatment, mask=mask,\n                                           fill_value=np.nan)\n    array_dtype = getattr(passed_array, 'dtype', array_internal.dtype)\n    # Copy or alias kernel to kernel_internal\n    kernel_internal = _copy_input_if_needed(passed_kernel, dtype=float, order='C',\n                                            nan_treatment=None, mask=None,\n                                            fill_value=fill_value)\n\n    # Make sure kernel has all odd axes\n    if has_even_axis(kernel_internal):\n        raise_even_kernel_exception()\n\n    # If both image array and kernel are Kernel instances\n    # constrain convolution method\n    # This must occur before the main alias/copy of ``passed_kernel`` to\n    # ``kernel_internal`` as it is used for filling masked kernels.\n    if isinstance(passed_array, Kernel) and isinstance(passed_kernel, Kernel):\n        warnings.warn(\"Both array and kernel are Kernel instances, hardwiring \"\n                      \"the following parameters: boundary='fill', fill_value=0,\"\n                      \" normalize_Kernel=True, nan_treatment='interpolate'\",\n                      AstropyUserWarning)\n        boundary = 'fill'\n        fill_value = 0\n        normalize_kernel = True\n        nan_treatment = 'interpolate'\n\n    # -----------------------------------------------------------------------\n    # From this point onwards refer only to ``array_internal`` and\n    # ``kernel_internal``.\n    # Assume both are base np.ndarrays and NOT subclasses e.g. NOT\n    # ``Kernel`` nor ``np.ma.maskedarray`` classes.\n    # -----------------------------------------------------------------------\n\n    # Check dimensionality\n    if array_internal.ndim == 0:\n        raise Exception(\"cannot convolve 0-dimensional arrays\")\n    elif array_internal.ndim > 3:\n        raise NotImplementedError('convolve only supports 1, 2, and 3-dimensional '\n                                  'arrays at this time')\n    elif array_internal.ndim != kernel_internal.ndim:\n        raise Exception('array and kernel have differing number of '\n                        'dimensions.')\n\n    array_shape = np.array(array_internal.shape)\n    kernel_shape = np.array(kernel_internal.shape)\n    pad_width = kernel_shape//2\n\n    # For boundary=None only the center space is convolved. All array indices within a\n    # distance kernel.shape//2 from the edge are completely ignored (zeroed).\n    # E.g. (1D list) only the indices len(kernel)//2 : len(array)-len(kernel)//2\n    # are convolved. It is therefore not possible to use this method to convolve an\n    # array by a kernel that is larger (see note below) than the array - as ALL pixels would be ignored\n    # leaving an array of only zeros.\n    # Note: For even kernels the correctness condition is array_shape > kernel_shape.\n    # For odd kernels it is:\n    # array_shape >= kernel_shape OR array_shape > kernel_shape-1 OR array_shape > 2*(kernel_shape//2).\n    # Since the latter is equal to the former two for even lengths, the latter condition is complete.\n    if boundary is None and not np.all(array_shape > 2*pad_width):\n        raise KernelSizeError(\"for boundary=None all kernel axes must be smaller than array's - \"\n                              \"use boundary in ['fill', 'extend', 'wrap'] instead.\")\n\n    # NaN interpolation significantly slows down the C convolution\n    # computation. Since nan_treatment = 'interpolate', is the default\n    # check whether it is even needed, if not, don't interpolate.\n    # NB: np.isnan(array_internal.sum()) is faster than np.isnan(array_internal).any()\n    nan_interpolate = (nan_treatment == 'interpolate') and np.isnan(array_internal.sum())\n\n    # Check if kernel is normalizable\n    if normalize_kernel or nan_interpolate:\n        kernel_sum = kernel_internal.sum()\n        kernel_sums_to_zero = np.isclose(kernel_sum, 0,\n                                         atol=normalization_zero_tol)\n\n        if kernel_sum < 1. / MAX_NORMALIZATION or kernel_sums_to_zero:\n            if nan_interpolate:\n                raise ValueError(\"Setting nan_treatment='interpolate' \"\n                                 \"requires the kernel to be normalized, \"\n                                 \"but the input kernel has a sum close \"\n                                 \"to zero. For a zero-sum kernel and \"\n                                 \"data with NaNs, set nan_treatment='fill'.\")\n            else:\n                raise ValueError(\"The kernel can't be normalized, because \"\n                                 \"its sum is close to zero. The sum of the \"\n                                 \"given kernel is < {}\"\n                                 .format(1. / MAX_NORMALIZATION))\n\n    # Mark the NaN values so we can replace them later if interpolate_nan is\n    # not set\n    if preserve_nan or nan_treatment == 'fill':\n        initially_nan = np.isnan(array_internal)\n        if nan_treatment == 'fill':\n            array_internal[initially_nan] = fill_value\n\n    # Avoid any memory allocation within the C code. Allocate output array\n    # here and pass through instead.\n    result = np.zeros(array_internal.shape, dtype=float, order='C')\n\n    embed_result_within_padded_region = True\n    array_to_convolve = array_internal\n    if boundary in ('fill', 'extend', 'wrap'):\n        embed_result_within_padded_region = False\n        if boundary == 'fill':\n            # This method is faster than using numpy.pad(..., mode='constant')\n            array_to_convolve = np.full(array_shape + 2*pad_width, fill_value=fill_value, dtype=float, order='C')\n            # Use bounds [pad_width[0]:array_shape[0]+pad_width[0]] instead of [pad_width[0]:-pad_width[0]]\n            # to account for when the kernel has size of 1 making pad_width = 0.\n            if array_internal.ndim == 1:\n                array_to_convolve[pad_width[0]:array_shape[0]+pad_width[0]] = array_internal\n            elif array_internal.ndim == 2:\n                array_to_convolve[pad_width[0]:array_shape[0]+pad_width[0],\n                                  pad_width[1]:array_shape[1]+pad_width[1]] = array_internal\n            else:\n                array_to_convolve[pad_width[0]:array_shape[0]+pad_width[0],\n                                  pad_width[1]:array_shape[1]+pad_width[1],\n                                  pad_width[2]:array_shape[2]+pad_width[2]] = array_internal\n        else:\n            np_pad_mode_dict = {'fill': 'constant', 'extend': 'edge', 'wrap': 'wrap'}\n            np_pad_mode = np_pad_mode_dict[boundary]\n            pad_width = kernel_shape // 2\n\n            if array_internal.ndim == 1:\n                np_pad_width = (pad_width[0],)\n            elif array_internal.ndim == 2:\n                np_pad_width = ((pad_width[0],), (pad_width[1],))\n            else:\n                np_pad_width = ((pad_width[0],), (pad_width[1],), (pad_width[2],))\n\n            array_to_convolve = np.pad(array_internal, pad_width=np_pad_width,\n                                       mode=np_pad_mode)\n\n    _convolveNd_c(result, array_to_convolve,\n                  array_to_convolve.ndim,\n                  np.array(array_to_convolve.shape, dtype=ctypes.c_size_t, order='C'),\n                  kernel_internal,\n                  np.array(kernel_shape, dtype=ctypes.c_size_t, order='C'),\n                  nan_interpolate, embed_result_within_padded_region,\n                  n_threads)\n\n    # So far, normalization has only occurred for nan_treatment == 'interpolate'\n    # because this had to happen within the C extension so as to ignore\n    # any NaNs\n    if normalize_kernel:\n        if not nan_interpolate:\n            result /= kernel_sum\n    elif nan_interpolate:\n        result *= kernel_sum\n\n    if nan_interpolate and not preserve_nan and np.isnan(result.sum()):\n        warnings.warn(\"nan_treatment='interpolate', however, NaN values detected \"\n                      \"post convolution. A contiguous region of NaN values, larger \"\n                      \"than the kernel size, are present in the input array. \"\n                      \"Increase the kernel size to avoid this.\", AstropyUserWarning)\n\n    if preserve_nan:\n        result[initially_nan] = np.nan\n\n    # Convert result to original data type\n    array_unit = getattr(passed_array, \"unit\", None)\n    if array_unit is not None:\n        result <<= array_unit\n\n    if isinstance(passed_array, Kernel):\n        if isinstance(passed_array, Kernel1D):\n            new_result = Kernel1D(array=result)\n        elif isinstance(passed_array, Kernel2D):\n            new_result = Kernel2D(array=result)\n        else:\n            raise TypeError(\"Only 1D and 2D Kernels are supported.\")\n        new_result._is_bool = False\n        new_result._separable = passed_array._separable\n        if isinstance(passed_kernel, Kernel):\n            new_result._separable = new_result._separable and passed_kernel._separable\n        return new_result\n    elif array_dtype.kind == 'f':\n        # Try to preserve the input type if it's a floating point type\n        # Avoid making another copy if possible\n        try:\n            return result.astype(array_dtype, copy=False)\n        except TypeError:\n            return result.astype(array_dtype)\n    else:\n        return result"},{"col":0,"comment":"\n    Function to evaluate analytical model functions on a grid.\n\n    So far the function can only deal with pixel coordinates.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.FittableModel` or callable.\n        Analytic model function to be discretized. Callables, which are not an\n        instances of `~astropy.modeling.FittableModel` are passed to\n        `~astropy.modeling.custom_model` and then evaluated.\n    x_range : tuple\n        x range in which the model is evaluated. The difference between the\n        upper an lower limit must be a whole number, so that the output array\n        size is well defined.\n    y_range : tuple, optional\n        y range in which the model is evaluated. The difference between the\n        upper an lower limit must be a whole number, so that the output array\n        size is well defined. Necessary only for 2D models.\n    mode : str, optional\n        One of the following modes:\n            * ``'center'`` (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * ``'linear_interp'``\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n                For 2D models interpolation is bilinear.\n            * ``'oversample'``\n                Discretize model by taking the average\n                on an oversampled grid.\n            * ``'integrate'``\n                Discretize model by integrating the model\n                over the bin using `scipy.integrate.quad`.\n                Very slow.\n    factor : float or int\n        Factor of oversampling. Default = 10.\n\n    Returns\n    -------\n    array : `numpy.array`\n        Model value array\n\n    Notes\n    -----\n    The ``oversample`` mode allows to conserve the integral on a subpixel\n    scale. Here is the example of a normalized Gaussian1D:\n\n    .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        import numpy as np\n        from astropy.modeling.models import Gaussian1D\n        from astropy.convolution.utils import discretize_model\n        gauss_1D = Gaussian1D(1 / (0.5 * np.sqrt(2 * np.pi)), 0, 0.5)\n        y_center = discretize_model(gauss_1D, (-2, 3), mode='center')\n        y_corner = discretize_model(gauss_1D, (-2, 3), mode='linear_interp')\n        y_oversample = discretize_model(gauss_1D, (-2, 3), mode='oversample')\n        plt.plot(y_center, label='center sum = {0:3f}'.format(y_center.sum()))\n        plt.plot(y_corner, label='linear_interp sum = {0:3f}'.format(y_corner.sum()))\n        plt.plot(y_oversample, label='oversample sum = {0:3f}'.format(y_oversample.sum()))\n        plt.xlabel('pixels')\n        plt.ylabel('value')\n        plt.legend()\n        plt.show()\n\n\n    ","endLoc":196,"header":"def discretize_model(model, x_range, y_range=None, mode='center', factor=10)","id":14629,"name":"discretize_model","nodeType":"Function","startLoc":84,"text":"def discretize_model(model, x_range, y_range=None, mode='center', factor=10):\n    \"\"\"\n    Function to evaluate analytical model functions on a grid.\n\n    So far the function can only deal with pixel coordinates.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.FittableModel` or callable.\n        Analytic model function to be discretized. Callables, which are not an\n        instances of `~astropy.modeling.FittableModel` are passed to\n        `~astropy.modeling.custom_model` and then evaluated.\n    x_range : tuple\n        x range in which the model is evaluated. The difference between the\n        upper an lower limit must be a whole number, so that the output array\n        size is well defined.\n    y_range : tuple, optional\n        y range in which the model is evaluated. The difference between the\n        upper an lower limit must be a whole number, so that the output array\n        size is well defined. Necessary only for 2D models.\n    mode : str, optional\n        One of the following modes:\n            * ``'center'`` (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * ``'linear_interp'``\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n                For 2D models interpolation is bilinear.\n            * ``'oversample'``\n                Discretize model by taking the average\n                on an oversampled grid.\n            * ``'integrate'``\n                Discretize model by integrating the model\n                over the bin using `scipy.integrate.quad`.\n                Very slow.\n    factor : float or int\n        Factor of oversampling. Default = 10.\n\n    Returns\n    -------\n    array : `numpy.array`\n        Model value array\n\n    Notes\n    -----\n    The ``oversample`` mode allows to conserve the integral on a subpixel\n    scale. Here is the example of a normalized Gaussian1D:\n\n    .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        import numpy as np\n        from astropy.modeling.models import Gaussian1D\n        from astropy.convolution.utils import discretize_model\n        gauss_1D = Gaussian1D(1 / (0.5 * np.sqrt(2 * np.pi)), 0, 0.5)\n        y_center = discretize_model(gauss_1D, (-2, 3), mode='center')\n        y_corner = discretize_model(gauss_1D, (-2, 3), mode='linear_interp')\n        y_oversample = discretize_model(gauss_1D, (-2, 3), mode='oversample')\n        plt.plot(y_center, label='center sum = {0:3f}'.format(y_center.sum()))\n        plt.plot(y_corner, label='linear_interp sum = {0:3f}'.format(y_corner.sum()))\n        plt.plot(y_oversample, label='oversample sum = {0:3f}'.format(y_oversample.sum()))\n        plt.xlabel('pixels')\n        plt.ylabel('value')\n        plt.legend()\n        plt.show()\n\n\n    \"\"\"\n    if not callable(model):\n        raise TypeError('Model must be callable.')\n    if not isinstance(model, FittableModel):\n        model = custom_model(model)()\n    ndim = model.n_inputs\n    if ndim > 2:\n        raise ValueError('discretize_model only supports 1-d and 2-d models.')\n\n    if not float(np.diff(x_range)).is_integer():\n        raise ValueError(\"The difference between the upper and lower limit of\"\n                         \" 'x_range' must be a whole number.\")\n\n    if y_range:\n        if not float(np.diff(y_range)).is_integer():\n            raise ValueError(\"The difference between the upper and lower limit of\"\n                             \" 'y_range' must be a whole number.\")\n\n    if ndim == 2 and y_range is None:\n        raise ValueError(\"y range not specified, but model is 2-d\")\n    if ndim == 1 and y_range is not None:\n        raise ValueError(\"y range specified, but model is only 1-d.\")\n    if mode == \"center\":\n        if ndim == 1:\n            return discretize_center_1D(model, x_range)\n        elif ndim == 2:\n            return discretize_center_2D(model, x_range, y_range)\n    elif mode == \"linear_interp\":\n        if ndim == 1:\n            return discretize_linear_1D(model, x_range)\n        if ndim == 2:\n            return discretize_bilinear_2D(model, x_range, y_range)\n    elif mode == \"oversample\":\n        if ndim == 1:\n            return discretize_oversample_1D(model, x_range, factor)\n        if ndim == 2:\n            return discretize_oversample_2D(model, x_range, y_range, factor)\n    elif mode == \"integrate\":\n        if ndim == 1:\n            return discretize_integrate_1D(model, x_range)\n        if ndim == 2:\n            return discretize_integrate_2D(model, x_range, y_range)\n    else:\n        raise DiscretizationError('Invalid mode.')"},{"col":0,"comment":"\n    Discretize model by taking the value at the center of the bin.\n    ","endLoc":204,"header":"def discretize_center_1D(model, x_range)","id":14630,"name":"discretize_center_1D","nodeType":"Function","startLoc":199,"text":"def discretize_center_1D(model, x_range):\n    \"\"\"\n    Discretize model by taking the value at the center of the bin.\n    \"\"\"\n    x = np.arange(*x_range)\n    return model(x)"},{"col":0,"comment":"\n    Discretize model by taking the value at the center of the pixel.\n    ","endLoc":214,"header":"def discretize_center_2D(model, x_range, y_range)","id":14631,"name":"discretize_center_2D","nodeType":"Function","startLoc":207,"text":"def discretize_center_2D(model, x_range, y_range):\n    \"\"\"\n    Discretize model by taking the value at the center of the pixel.\n    \"\"\"\n    x = np.arange(*x_range)\n    y = np.arange(*y_range)\n    x, y = np.meshgrid(x, y)\n    return model(x, y)"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":14632,"name":"MAX_NORMALIZATION","nodeType":"Attribute","startLoc":27,"text":"MAX_NORMALIZATION"},{"col":0,"comment":"\n    Discretize model by performing a linear interpolation.\n    ","endLoc":224,"header":"def discretize_linear_1D(model, x_range)","id":14633,"name":"discretize_linear_1D","nodeType":"Function","startLoc":217,"text":"def discretize_linear_1D(model, x_range):\n    \"\"\"\n    Discretize model by performing a linear interpolation.\n    \"\"\"\n    # Evaluate model 0.5 pixel outside the boundaries\n    x = np.arange(x_range[0] - 0.5, x_range[1] + 0.5)\n    values_intermediate_grid = model(x)\n    return 0.5 * (values_intermediate_grid[1:] + values_intermediate_grid[:-1])"},{"className":"Kernel","col":0,"comment":"\n    Convolution kernel base class.\n\n    Parameters\n    ----------\n    array : ndarray\n        Kernel array.\n    ","endLoc":182,"id":14634,"nodeType":"Class","startLoc":32,"text":"class Kernel:\n    \"\"\"\n    Convolution kernel base class.\n\n    Parameters\n    ----------\n    array : ndarray\n        Kernel array.\n    \"\"\"\n    _separable = False\n    _is_bool = True\n    _model = None\n\n    def __init__(self, array):\n        self._array = np.asanyarray(array)\n\n    @property\n    def truncation(self):\n        \"\"\"\n        Deviation from the normalization to one.\n        \"\"\"\n        return self._truncation\n\n    @property\n    def is_bool(self):\n        \"\"\"\n        Indicates if kernel is bool.\n\n        If the kernel is bool the multiplication in the convolution could\n        be omitted, to increase the performance.\n        \"\"\"\n        return self._is_bool\n\n    @property\n    def model(self):\n        \"\"\"\n        Kernel response model.\n        \"\"\"\n        return self._model\n\n    @property\n    def dimension(self):\n        \"\"\"\n        Kernel dimension.\n        \"\"\"\n        return self.array.ndim\n\n    @property\n    def center(self):\n        \"\"\"\n        Index of the kernel center.\n        \"\"\"\n        return [axes_size // 2 for axes_size in self._array.shape]\n\n    def normalize(self, mode='integral'):\n        \"\"\"\n        Normalize the filter kernel.\n\n        Parameters\n        ----------\n        mode : {'integral', 'peak'}\n            One of the following modes:\n                * 'integral' (default)\n                    Kernel is normalized such that its integral = 1.\n                * 'peak'\n                    Kernel is normalized such that its peak = 1.\n        \"\"\"\n\n        if mode == 'integral':\n            normalization = self._array.sum()\n        elif mode == 'peak':\n            normalization = self._array.max()\n        else:\n            raise ValueError(\"invalid mode, must be 'integral' or 'peak'\")\n\n        # Warn the user for kernels that sum to zero\n        if normalization == 0:\n            warnings.warn('The kernel cannot be normalized because it '\n                          'sums to zero.', AstropyUserWarning)\n        else:\n            np.divide(self._array, normalization, self._array)\n\n        self._kernel_sum = self._array.sum()\n\n    @property\n    def shape(self):\n        \"\"\"\n        Shape of the kernel array.\n        \"\"\"\n        return self._array.shape\n\n    @property\n    def separable(self):\n        \"\"\"\n        Indicates if the filter kernel is separable.\n\n        A 2D filter is separable, when its filter array can be written as the\n        outer product of two 1D arrays.\n\n        If a filter kernel is separable, higher dimension convolutions will be\n        performed by applying the 1D filter array consecutively on every dimension.\n        This is significantly faster, than using a filter array with the same\n        dimension.\n        \"\"\"\n        return self._separable\n\n    @property\n    def array(self):\n        \"\"\"\n        Filter kernel array.\n        \"\"\"\n        return self._array\n\n    def __add__(self, kernel):\n        \"\"\"\n        Add two filter kernels.\n        \"\"\"\n        return kernel_arithmetics(self, kernel, 'add')\n\n    def __sub__(self, kernel):\n        \"\"\"\n        Subtract two filter kernels.\n        \"\"\"\n        return kernel_arithmetics(self, kernel, 'sub')\n\n    def __mul__(self, value):\n        \"\"\"\n        Multiply kernel with number or convolve two kernels.\n        \"\"\"\n        return kernel_arithmetics(self, value, \"mul\")\n\n    def __rmul__(self, value):\n        \"\"\"\n        Multiply kernel with number or convolve two kernels.\n        \"\"\"\n        return kernel_arithmetics(self, value, \"mul\")\n\n    def __array__(self):\n        \"\"\"\n        Array representation of the kernel.\n        \"\"\"\n        return self._array\n\n    def __array_wrap__(self, array, context=None):\n        \"\"\"\n        Wrapper for multiplication with numpy arrays.\n        \"\"\"\n        if type(context[0]) == np.ufunc:\n            return NotImplemented\n        else:\n            return array"},{"col":4,"comment":"null","endLoc":46,"header":"def __init__(self, array)","id":14635,"name":"__init__","nodeType":"Function","startLoc":45,"text":"def __init__(self, array):\n        self._array = np.asanyarray(array)"},{"col":0,"comment":"\n    Discretize model by performing a bilinear interpolation.\n    ","endLoc":243,"header":"def discretize_bilinear_2D(model, x_range, y_range)","id":14636,"name":"discretize_bilinear_2D","nodeType":"Function","startLoc":227,"text":"def discretize_bilinear_2D(model, x_range, y_range):\n    \"\"\"\n    Discretize model by performing a bilinear interpolation.\n    \"\"\"\n    # Evaluate model 0.5 pixel outside the boundaries\n    x = np.arange(x_range[0] - 0.5, x_range[1] + 0.5)\n    y = np.arange(y_range[0] - 0.5, y_range[1] + 0.5)\n    x, y = np.meshgrid(x, y)\n    values_intermediate_grid = model(x, y)\n\n    # Mean in y direction\n    values = 0.5 * (values_intermediate_grid[1:, :]\n                    + values_intermediate_grid[:-1, :])\n    # Mean in x direction\n    values = 0.5 * (values[:, 1:]\n                    + values[:, :-1])\n    return values"},{"col":0,"comment":"null","endLoc":146,"header":"def _copy_input_if_needed(input, dtype=float, order='C', nan_treatment=None,\n                          mask=None, fill_value=None)","id":14637,"name":"_copy_input_if_needed","nodeType":"Function","startLoc":105,"text":"def _copy_input_if_needed(input, dtype=float, order='C', nan_treatment=None,\n                          mask=None, fill_value=None):\n    # Alias input\n    input = input.array if isinstance(input, Kernel) else input\n    # strip quantity attributes\n    if hasattr(input, 'unit'):\n        input = input.value\n    output = input\n    # Copy input\n    try:\n        # Anything that's masked must be turned into NaNs for the interpolation.\n        # This requires copying. A copy is also needed for nan_treatment == 'fill'\n        # A copy prevents possible function side-effects of the input array.\n        if nan_treatment == 'fill' or np.ma.is_masked(input) or mask is not None:\n            if np.ma.is_masked(input):\n                # ``np.ma.maskedarray.filled()`` returns a copy, however there\n                # is no way to specify the return type or order etc. In addition\n                # ``np.nan`` is a ``float`` and there is no conversion to an\n                # ``int`` type. Therefore, a pre-fill copy is needed for non\n                # ``float`` masked arrays. ``subok=True`` is needed to retain\n                # ``np.ma.maskedarray.filled()``. ``copy=False`` allows the fill\n                # to act as the copy if type and order are already correct.\n                output = np.array(input, dtype=dtype, copy=False, order=order, subok=True)\n                output = output.filled(fill_value)\n            else:\n                # Since we're making a copy, we might as well use `subok=False` to save,\n                # what is probably, a negligible amount of memory.\n                output = np.array(input, dtype=dtype, copy=True, order=order, subok=False)\n\n            if mask is not None:\n                # mask != 0 yields a bool mask for all ints/floats/bool\n                output[mask != 0] = fill_value\n        else:\n            # The call below is synonymous with np.asanyarray(array, ftype=float, order='C')\n            # The advantage of `subok=True` is that it won't copy when array is an ndarray subclass. If it\n            # is and `subok=False` (default), then it will copy even if `copy=False`. This uses less memory\n            # when ndarray subclasses are passed in.\n            output = np.array(input, dtype=dtype, copy=False, order=order, subok=True)\n    except (TypeError, ValueError) as e:\n        raise TypeError('input should be a Numpy array or something '\n                        'convertible into a float array', e)\n    return output"},{"col":0,"comment":"\n    Discretize model by taking the average on an oversampled grid.\n    ","endLoc":259,"header":"def discretize_oversample_1D(model, x_range, factor=10)","id":14638,"name":"discretize_oversample_1D","nodeType":"Function","startLoc":246,"text":"def discretize_oversample_1D(model, x_range, factor=10):\n    \"\"\"\n    Discretize model by taking the average on an oversampled grid.\n    \"\"\"\n    # Evaluate model on oversampled grid\n    x = np.linspace(x_range[0] - 0.5 * (1 - 1 / factor),\n                    x_range[1] - 0.5 * (1 + 1 / factor),\n                    num=int((x_range[1] - x_range[0]) * factor))\n\n    values = model(x)\n\n    # Reshape and compute mean\n    values = np.reshape(values, (x.size // factor, factor))\n    return values.mean(axis=1)"},{"col":0,"comment":"\n    Discretize model by taking the average on an oversampled grid.\n    ","endLoc":280,"header":"def discretize_oversample_2D(model, x_range, y_range, factor=10)","id":14639,"name":"discretize_oversample_2D","nodeType":"Function","startLoc":262,"text":"def discretize_oversample_2D(model, x_range, y_range, factor=10):\n    \"\"\"\n    Discretize model by taking the average on an oversampled grid.\n    \"\"\"\n    # Evaluate model on oversampled grid\n    x = np.linspace(x_range[0] - 0.5 * (1 - 1 / factor),\n                    x_range[1] - 0.5 * (1 + 1 / factor),\n                    num=int((x_range[1] - x_range[0]) * factor))\n    y = np.linspace(y_range[0] - 0.5 * (1 - 1 / factor),\n                    y_range[1] - 0.5 * (1 + 1 / factor),\n                    num=int((y_range[1] - y_range[0]) * factor))\n\n    x_grid, y_grid = np.meshgrid(x, y)\n    values = model(x_grid, y_grid)\n\n    # Reshape and compute mean\n    shape = (y.size // factor, factor, x.size // factor, factor)\n    values = np.reshape(values, shape)\n    return values.mean(axis=3).mean(axis=1)"},{"col":4,"comment":"\n        Deviation from the normalization to one.\n        ","endLoc":53,"header":"@property\n    def truncation(self)","id":14640,"name":"truncation","nodeType":"Function","startLoc":48,"text":"@property\n    def truncation(self):\n        \"\"\"\n        Deviation from the normalization to one.\n        \"\"\"\n        return self._truncation"},{"col":4,"comment":"\n        Indicates if kernel is bool.\n\n        If the kernel is bool the multiplication in the convolution could\n        be omitted, to increase the performance.\n        ","endLoc":63,"header":"@property\n    def is_bool(self)","id":14641,"name":"is_bool","nodeType":"Function","startLoc":55,"text":"@property\n    def is_bool(self):\n        \"\"\"\n        Indicates if kernel is bool.\n\n        If the kernel is bool the multiplication in the convolution could\n        be omitted, to increase the performance.\n        \"\"\"\n        return self._is_bool"},{"col":4,"comment":"\n        Kernel response model.\n        ","endLoc":70,"header":"@property\n    def model(self)","id":14642,"name":"model","nodeType":"Function","startLoc":65,"text":"@property\n    def model(self):\n        \"\"\"\n        Kernel response model.\n        \"\"\"\n        return self._model"},{"col":4,"comment":"\n        Kernel dimension.\n        ","endLoc":77,"header":"@property\n    def dimension(self)","id":14643,"name":"dimension","nodeType":"Function","startLoc":72,"text":"@property\n    def dimension(self):\n        \"\"\"\n        Kernel dimension.\n        \"\"\"\n        return self.array.ndim"},{"col":4,"comment":"\n        Index of the kernel center.\n        ","endLoc":84,"header":"@property\n    def center(self)","id":14644,"name":"center","nodeType":"Function","startLoc":79,"text":"@property\n    def center(self):\n        \"\"\"\n        Index of the kernel center.\n        \"\"\"\n        return [axes_size // 2 for axes_size in self._array.shape]"},{"col":4,"comment":"\n        Normalize the filter kernel.\n\n        Parameters\n        ----------\n        mode : {'integral', 'peak'}\n            One of the following modes:\n                * 'integral' (default)\n                    Kernel is normalized such that its integral = 1.\n                * 'peak'\n                    Kernel is normalized such that its peak = 1.\n        ","endLoc":114,"header":"def normalize(self, mode='integral')","id":14645,"name":"normalize","nodeType":"Function","startLoc":86,"text":"def normalize(self, mode='integral'):\n        \"\"\"\n        Normalize the filter kernel.\n\n        Parameters\n        ----------\n        mode : {'integral', 'peak'}\n            One of the following modes:\n                * 'integral' (default)\n                    Kernel is normalized such that its integral = 1.\n                * 'peak'\n                    Kernel is normalized such that its peak = 1.\n        \"\"\"\n\n        if mode == 'integral':\n            normalization = self._array.sum()\n        elif mode == 'peak':\n            normalization = self._array.max()\n        else:\n            raise ValueError(\"invalid mode, must be 'integral' or 'peak'\")\n\n        # Warn the user for kernels that sum to zero\n        if normalization == 0:\n            warnings.warn('The kernel cannot be normalized because it '\n                          'sums to zero.', AstropyUserWarning)\n        else:\n            np.divide(self._array, normalization, self._array)\n\n        self._kernel_sum = self._array.sum()"},{"col":0,"comment":"\n    Discretize model by integrating numerically the model over the bin.\n    ","endLoc":296,"header":"def discretize_integrate_1D(model, x_range)","id":14646,"name":"discretize_integrate_1D","nodeType":"Function","startLoc":283,"text":"def discretize_integrate_1D(model, x_range):\n    \"\"\"\n    Discretize model by integrating numerically the model over the bin.\n    \"\"\"\n    from scipy.integrate import quad\n\n    # Set up grid\n    x = np.arange(x_range[0] - 0.5, x_range[1] + 0.5)\n    values = np.array([])\n\n    # Integrate over all bins\n    for i in range(x.size - 1):\n        values = np.append(values, quad(model, x[i], x[i + 1])[0])\n    return values"},{"col":0,"comment":"\n    Discretize model by integrating the model over the pixel.\n    ","endLoc":315,"header":"def discretize_integrate_2D(model, x_range, y_range)","id":14647,"name":"discretize_integrate_2D","nodeType":"Function","startLoc":299,"text":"def discretize_integrate_2D(model, x_range, y_range):\n    \"\"\"\n    Discretize model by integrating the model over the pixel.\n    \"\"\"\n    from scipy.integrate import dblquad\n\n    # Set up grid\n    x = np.arange(x_range[0] - 0.5, x_range[1] + 0.5)\n    y = np.arange(y_range[0] - 0.5, y_range[1] + 0.5)\n    values = np.empty((y.size - 1, x.size - 1))\n\n    # Integrate over all pixels\n    for i in range(x.size - 1):\n        for j in range(y.size - 1):\n            values[j, i] = dblquad(lambda y, x: model(x, y), x[i], x[i + 1],\n                                   lambda x: y[j], lambda x: y[j + 1])[0]\n    return values"},{"col":4,"comment":"\n        Shape of the kernel array.\n        ","endLoc":121,"header":"@property\n    def shape(self)","id":14648,"name":"shape","nodeType":"Function","startLoc":116,"text":"@property\n    def shape(self):\n        \"\"\"\n        Shape of the kernel array.\n        \"\"\"\n        return self._array.shape"},{"col":4,"comment":"\n        Indicates if the filter kernel is separable.\n\n        A 2D filter is separable, when its filter array can be written as the\n        outer product of two 1D arrays.\n\n        If a filter kernel is separable, higher dimension convolutions will be\n        performed by applying the 1D filter array consecutively on every dimension.\n        This is significantly faster, than using a filter array with the same\n        dimension.\n        ","endLoc":136,"header":"@property\n    def separable(self)","id":14649,"name":"separable","nodeType":"Function","startLoc":123,"text":"@property\n    def separable(self):\n        \"\"\"\n        Indicates if the filter kernel is separable.\n\n        A 2D filter is separable, when its filter array can be written as the\n        outer product of two 1D arrays.\n\n        If a filter kernel is separable, higher dimension convolutions will be\n        performed by applying the 1D filter array consecutively on every dimension.\n        This is significantly faster, than using a filter array with the same\n        dimension.\n        \"\"\"\n        return self._separable"},{"col":4,"comment":"\n        Filter kernel array.\n        ","endLoc":143,"header":"@property\n    def array(self)","id":14650,"name":"array","nodeType":"Function","startLoc":138,"text":"@property\n    def array(self):\n        \"\"\"\n        Filter kernel array.\n        \"\"\"\n        return self._array"},{"col":4,"comment":"\n        Add two filter kernels.\n        ","endLoc":149,"header":"def __add__(self, kernel)","id":14651,"name":"__add__","nodeType":"Function","startLoc":145,"text":"def __add__(self, kernel):\n        \"\"\"\n        Add two filter kernels.\n        \"\"\"\n        return kernel_arithmetics(self, kernel, 'add')"},{"className":"Kernel1D","col":0,"comment":"\n    Base class for 1D filter kernels.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.FittableModel`\n        Model to be evaluated.\n    x_size : int or None, optional\n        Size of the kernel array. Default = ⌊8*width+1⌋.\n        Only used if ``array`` is None.\n    array : ndarray or None, optional\n        Kernel array.\n    width : number\n        Width of the filter kernel.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n    ","endLoc":244,"id":14652,"nodeType":"Class","startLoc":185,"text":"class Kernel1D(Kernel):\n    \"\"\"\n    Base class for 1D filter kernels.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.FittableModel`\n        Model to be evaluated.\n    x_size : int or None, optional\n        Size of the kernel array. Default = ⌊8*width+1⌋.\n        Only used if ``array`` is None.\n    array : ndarray or None, optional\n        Kernel array.\n    width : number\n        Width of the filter kernel.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n    \"\"\"\n\n    def __init__(self, model=None, x_size=None, array=None, **kwargs):\n        # Initialize from model\n        if self._model:\n            if array is not None:\n                # Reject \"array\" keyword for kernel models, to avoid them not being\n                # populated as expected.\n                raise TypeError(\"Array argument not allowed for kernel models.\")\n\n            if x_size is None:\n                x_size = self._default_size\n            elif x_size != int(x_size):\n                raise TypeError(\"x_size should be an integer\")\n\n            # Set ranges where to evaluate the model\n\n            if x_size % 2 == 0:  # even kernel\n                x_range = (-(int(x_size)) // 2 + 0.5, (int(x_size)) // 2 + 0.5)\n            else:  # odd kernel\n                x_range = (-(int(x_size) - 1) // 2, (int(x_size) - 1) // 2 + 1)\n\n            array = discretize_model(self._model, x_range, **kwargs)\n\n        # Initialize from array\n        elif array is None:\n            raise TypeError(\"Must specify either array or model.\")\n\n        super().__init__(array)"},{"col":0,"comment":"\n    Add, subtract or multiply two kernels.\n\n    Parameters\n    ----------\n    kernel : `astropy.convolution.Kernel`\n        Kernel instance.\n    value : `astropy.convolution.Kernel`, float, or int\n        Value to operate with.\n    operation : {'add', 'sub', 'mul'}\n        One of the following operations:\n            * 'add'\n                Add two kernels\n            * 'sub'\n                Subtract two kernels\n            * 'mul'\n                Multiply kernel with number or convolve two kernels.\n    ","endLoc":377,"header":"def kernel_arithmetics(kernel, value, operation)","id":14653,"name":"kernel_arithmetics","nodeType":"Function","startLoc":322,"text":"def kernel_arithmetics(kernel, value, operation):\n    \"\"\"\n    Add, subtract or multiply two kernels.\n\n    Parameters\n    ----------\n    kernel : `astropy.convolution.Kernel`\n        Kernel instance.\n    value : `astropy.convolution.Kernel`, float, or int\n        Value to operate with.\n    operation : {'add', 'sub', 'mul'}\n        One of the following operations:\n            * 'add'\n                Add two kernels\n            * 'sub'\n                Subtract two kernels\n            * 'mul'\n                Multiply kernel with number or convolve two kernels.\n    \"\"\"\n    # 1D kernels\n    if isinstance(kernel, Kernel1D) and isinstance(value, Kernel1D):\n        if operation == \"add\":\n            new_array = add_kernel_arrays_1D(kernel.array, value.array)\n        if operation == \"sub\":\n            new_array = add_kernel_arrays_1D(kernel.array, -value.array)\n        if operation == \"mul\":\n            raise Exception(\"Kernel operation not supported. Maybe you want \"\n                            \"to use convolve(kernel1, kernel2) instead.\")\n        new_kernel = Kernel1D(array=new_array)\n        new_kernel._separable = kernel._separable and value._separable\n        new_kernel._is_bool = kernel._is_bool or value._is_bool\n\n    # 2D kernels\n    elif isinstance(kernel, Kernel2D) and isinstance(value, Kernel2D):\n        if operation == \"add\":\n            new_array = add_kernel_arrays_2D(kernel.array, value.array)\n        if operation == \"sub\":\n            new_array = add_kernel_arrays_2D(kernel.array, -value.array)\n        if operation == \"mul\":\n            raise Exception(\"Kernel operation not supported. Maybe you want \"\n                            \"to use convolve(kernel1, kernel2) instead.\")\n        new_kernel = Kernel2D(array=new_array)\n        new_kernel._separable = kernel._separable and value._separable\n        new_kernel._is_bool = kernel._is_bool or value._is_bool\n\n    # kernel and number\n    elif ((isinstance(kernel, Kernel1D) or isinstance(kernel, Kernel2D))\n        and np.isscalar(value)):\n        if operation == \"mul\":\n            new_kernel = copy.copy(kernel)\n            new_kernel._array *= value\n        else:\n            raise Exception(\"Kernel operation not supported.\")\n    else:\n        raise Exception(\"Kernel operation not supported.\")\n    return new_kernel"},{"col":4,"comment":"null","endLoc":244,"header":"def __init__(self, model=None, x_size=None, array=None, **kwargs)","id":14654,"name":"__init__","nodeType":"Function","startLoc":218,"text":"def __init__(self, model=None, x_size=None, array=None, **kwargs):\n        # Initialize from model\n        if self._model:\n            if array is not None:\n                # Reject \"array\" keyword for kernel models, to avoid them not being\n                # populated as expected.\n                raise TypeError(\"Array argument not allowed for kernel models.\")\n\n            if x_size is None:\n                x_size = self._default_size\n            elif x_size != int(x_size):\n                raise TypeError(\"x_size should be an integer\")\n\n            # Set ranges where to evaluate the model\n\n            if x_size % 2 == 0:  # even kernel\n                x_range = (-(int(x_size)) // 2 + 0.5, (int(x_size)) // 2 + 0.5)\n            else:  # odd kernel\n                x_range = (-(int(x_size) - 1) // 2, (int(x_size) - 1) // 2 + 1)\n\n            array = discretize_model(self._model, x_range, **kwargs)\n\n        # Initialize from array\n        elif array is None:\n            raise TypeError(\"Must specify either array or model.\")\n\n        super().__init__(array)"},{"col":35,"endLoc":313,"id":14655,"nodeType":"Lambda","startLoc":313,"text":"lambda y, x: model(x, y)"},{"col":35,"endLoc":314,"id":14656,"nodeType":"Lambda","startLoc":314,"text":"lambda x: y[j]"},{"col":51,"endLoc":314,"id":14657,"nodeType":"Lambda","startLoc":314,"text":"lambda x: y[j + 1]"},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":14658,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":14659,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"col":0,"comment":"","endLoc":2,"header":"utils.py#<anonymous>","id":14660,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"__all__ = ['discretize_model', 'KernelSizeError']"},{"fileName":"kernels.py","filePath":"astropy/convolution","id":14661,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport math\n\nimport numpy as np\n\nfrom astropy.modeling import models\nfrom astropy.modeling.core import Fittable1DModel, Fittable2DModel\nfrom astropy.utils.decorators import deprecated\n\nfrom .core import Kernel, Kernel1D, Kernel2D\nfrom .utils import KernelSizeError, has_even_axis, raise_even_kernel_exception\n\n__all__ = ['Gaussian1DKernel', 'Gaussian2DKernel', 'CustomKernel',\n           'Box1DKernel', 'Box2DKernel', 'Tophat2DKernel',\n           'Trapezoid1DKernel', 'RickerWavelet1DKernel', 'RickerWavelet2DKernel',\n           'AiryDisk2DKernel', 'Moffat2DKernel', 'Model1DKernel',\n           'Model2DKernel', 'TrapezoidDisk2DKernel', 'Ring2DKernel']\n\n\ndef _round_up_to_odd_integer(value):\n    i = math.ceil(value)\n    if i % 2 == 0:\n        return i + 1\n    else:\n        return i\n\n\nclass Gaussian1DKernel(Kernel1D):\n    \"\"\"\n    1D Gaussian filter kernel.\n\n    The Gaussian filter is a filter with great smoothing properties. It is\n    isotropic and does not produce artifacts.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    stddev : number\n        Standard deviation of the Gaussian kernel.\n    x_size : int, optional\n        Size of the kernel array. Default = ⌊8*stddev+1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin. Very slow.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10. If the factor\n        is too large, evaluation can be very slow.\n\n\n    See Also\n    --------\n    Box1DKernel, Trapezoid1DKernel, RickerWavelet1DKernel\n\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Gaussian1DKernel\n        gauss_1D_kernel = Gaussian1DKernel(10)\n        plt.plot(gauss_1D_kernel, drawstyle='steps')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('value')\n        plt.show()\n    \"\"\"\n    _separable = True\n    _is_bool = False\n\n    def __init__(self, stddev, **kwargs):\n        self._model = models.Gaussian1D(1. / (np.sqrt(2 * np.pi) * stddev),\n                                        0, stddev)\n        self._default_size = _round_up_to_odd_integer(8 * stddev)\n        super().__init__(**kwargs)\n        self._truncation = np.abs(1. - self._array.sum())\n\n\nclass Gaussian2DKernel(Kernel2D):\n    \"\"\"\n    2D Gaussian filter kernel.\n\n    The Gaussian filter is a filter with great smoothing properties. It is\n    isotropic and does not produce artifacts.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    x_stddev : float\n        Standard deviation of the Gaussian in x before rotating by theta.\n    y_stddev : float\n        Standard deviation of the Gaussian in y before rotating by theta.\n    theta : float or `~astropy.units.Quantity` ['angle']\n        Rotation angle. If passed as a float, it is assumed to be in radians.\n        The rotation angle increases counterclockwise.\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*stddev + 1⌋.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*stddev + 1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n\n    See Also\n    --------\n    Box2DKernel, Tophat2DKernel, RickerWavelet2DKernel, Ring2DKernel,\n    TrapezoidDisk2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Gaussian2DKernel\n        gaussian_2D_kernel = Gaussian2DKernel(10)\n        plt.imshow(gaussian_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n\n    \"\"\"\n    _separable = True\n    _is_bool = False\n\n    def __init__(self, x_stddev, y_stddev=None, theta=0.0, **kwargs):\n        if y_stddev is None:\n            y_stddev = x_stddev\n        self._model = models.Gaussian2D(1. / (2 * np.pi * x_stddev * y_stddev),\n                                        0, 0, x_stddev=x_stddev,\n                                        y_stddev=y_stddev, theta=theta)\n        self._default_size = _round_up_to_odd_integer(\n            8 * np.max([x_stddev, y_stddev]))\n        super().__init__(**kwargs)\n        self._truncation = np.abs(1. - self._array.sum())\n\n\nclass Box1DKernel(Kernel1D):\n    \"\"\"\n    1D Box filter kernel.\n\n    The Box filter or running mean is a smoothing filter. It is not isotropic\n    and can produce artifacts when applied repeatedly to the same data.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    By default the Box kernel uses the ``linear_interp`` discretization mode,\n    which allows non-shifting, even-sized kernels.  This is achieved by\n    weighting the edge pixels with 1/2. E.g a Box kernel with an effective\n    smoothing of 4 pixel would have the following array: [0.5, 1, 1, 1, 0.5].\n\n\n    Parameters\n    ----------\n    width : number\n        Width of the filter kernel.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center'\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp' (default)\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Gaussian1DKernel, Trapezoid1DKernel, RickerWavelet1DKernel\n\n\n    Examples\n    --------\n    Kernel response function:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Box1DKernel\n        box_1D_kernel = Box1DKernel(9)\n        plt.plot(box_1D_kernel, drawstyle='steps')\n        plt.xlim(-1, 9)\n        plt.xlabel('x [pixels]')\n        plt.ylabel('value')\n        plt.show()\n\n    \"\"\"\n    _separable = True\n    _is_bool = True\n\n    def __init__(self, width, **kwargs):\n        self._model = models.Box1D(1. / width, 0, width)\n        self._default_size = _round_up_to_odd_integer(width)\n        kwargs['mode'] = 'linear_interp'\n        super().__init__(**kwargs)\n        self._truncation = 0\n        self.normalize()\n\n\nclass Box2DKernel(Kernel2D):\n    \"\"\"\n    2D Box filter kernel.\n\n    The Box filter or running mean is a smoothing filter. It is not isotropic\n    and can produce artifacts when applied repeatedly to the same data.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    By default the Box kernel uses the ``linear_interp`` discretization mode,\n    which allows non-shifting, even-sized kernels.  This is achieved by\n    weighting the edge pixels with 1/2.\n\n\n    Parameters\n    ----------\n    width : number\n        Width of the filter kernel.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center'\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp' (default)\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n\n    See Also\n    --------\n    Gaussian2DKernel, Tophat2DKernel, RickerWavelet2DKernel, Ring2DKernel,\n    TrapezoidDisk2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Box2DKernel\n        box_2D_kernel = Box2DKernel(9)\n        plt.imshow(box_2D_kernel, interpolation='none', origin='lower',\n                   vmin=0.0, vmax=0.015)\n        plt.xlim(-1, 9)\n        plt.ylim(-1, 9)\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n    \"\"\"\n    _separable = True\n    _is_bool = True\n\n    def __init__(self, width, **kwargs):\n        self._model = models.Box2D(1. / width ** 2, 0, 0, width, width)\n        self._default_size = _round_up_to_odd_integer(width)\n        kwargs['mode'] = 'linear_interp'\n        super().__init__(**kwargs)\n        self._truncation = 0\n        self.normalize()\n\n\nclass Tophat2DKernel(Kernel2D):\n    \"\"\"\n    2D Tophat filter kernel.\n\n    The Tophat filter is an isotropic smoothing filter. It can produce\n    artifacts when applied repeatedly on the same data.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    radius : int\n        Radius of the filter kernel.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, RickerWavelet2DKernel, Ring2DKernel,\n    TrapezoidDisk2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Tophat2DKernel\n        tophat_2D_kernel = Tophat2DKernel(40)\n        plt.imshow(tophat_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n\n    \"\"\"\n    def __init__(self, radius, **kwargs):\n        self._model = models.Disk2D(1. / (np.pi * radius ** 2), 0, 0, radius)\n        self._default_size = _round_up_to_odd_integer(2 * radius)\n        super().__init__(**kwargs)\n        self._truncation = 0\n\n\nclass Ring2DKernel(Kernel2D):\n    \"\"\"\n    2D Ring filter kernel.\n\n    The Ring filter kernel is the difference between two Tophat kernels of\n    different width. This kernel is useful for, e.g., background estimation.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    radius_in : number\n        Inner radius of the ring kernel.\n    width : number\n        Width of the ring kernel.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, Tophat2DKernel, RickerWavelet2DKernel,\n    TrapezoidDisk2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Ring2DKernel\n        ring_2D_kernel = Ring2DKernel(9, 8)\n        plt.imshow(ring_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n    \"\"\"\n    def __init__(self, radius_in, width, **kwargs):\n        radius_out = radius_in + width\n        self._model = models.Ring2D(1. / (np.pi * (radius_out ** 2 - radius_in ** 2)),\n                                    0, 0, radius_in, width)\n        self._default_size = _round_up_to_odd_integer(2 * radius_out)\n        super().__init__(**kwargs)\n        self._truncation = 0\n\n\nclass Trapezoid1DKernel(Kernel1D):\n    \"\"\"\n    1D trapezoid kernel.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    width : number\n        Width of the filter kernel, defined as the width of the constant part,\n        before it begins to slope down.\n    slope : number\n        Slope of the filter kernel's tails\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Box1DKernel, Gaussian1DKernel, RickerWavelet1DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Trapezoid1DKernel\n        trapezoid_1D_kernel = Trapezoid1DKernel(17, slope=0.2)\n        plt.plot(trapezoid_1D_kernel, drawstyle='steps')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('amplitude')\n        plt.xlim(-1, 28)\n        plt.show()\n    \"\"\"\n    _is_bool = False\n\n    def __init__(self, width, slope=1., **kwargs):\n        self._model = models.Trapezoid1D(1, 0, width, slope)\n        self._default_size = _round_up_to_odd_integer(width + 2. / slope)\n        super().__init__(**kwargs)\n        self._truncation = 0\n        self.normalize()\n\n\nclass TrapezoidDisk2DKernel(Kernel2D):\n    \"\"\"\n    2D trapezoid kernel.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    radius : number\n        Width of the filter kernel, defined as the width of the constant part,\n        before it begins to slope down.\n    slope : number\n        Slope of the filter kernel's tails\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, Tophat2DKernel, RickerWavelet2DKernel,\n    Ring2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import TrapezoidDisk2DKernel\n        trapezoid_2D_kernel = TrapezoidDisk2DKernel(20, slope=0.2)\n        plt.imshow(trapezoid_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n\n    \"\"\"\n    _is_bool = False\n\n    def __init__(self, radius, slope=1., **kwargs):\n        self._model = models.TrapezoidDisk2D(1, 0, 0, radius, slope)\n        self._default_size = _round_up_to_odd_integer(2 * radius + 2. / slope)\n        super().__init__(**kwargs)\n        self._truncation = 0\n        self.normalize()\n\n\nclass RickerWavelet1DKernel(Kernel1D):\n    \"\"\"\n    1D Ricker wavelet filter kernel (sometimes known as a \"Mexican Hat\"\n    kernel).\n\n    The Ricker wavelet, or inverted Gaussian-Laplace filter, is a\n    bandpass filter. It smooths the data and removes slowly varying\n    or constant structures (e.g. Background). It is useful for peak or\n    multi-scale detection.\n\n    This kernel is derived from a normalized Gaussian function, by\n    computing the second derivative. This results in an amplitude\n    at the kernels center of 1. / (sqrt(2 * pi) * width ** 3). The\n    normalization is the same as for `scipy.ndimage.gaussian_laplace`,\n    except for a minus sign.\n\n    .. note::\n\n        See https://github.com/astropy/astropy/pull/9445 for discussions\n        related to renaming of this kernel.\n\n    Parameters\n    ----------\n    width : number\n        Width of the filter kernel, defined as the standard deviation\n        of the Gaussian function from which it is derived.\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*width +1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n\n    See Also\n    --------\n    Box1DKernel, Gaussian1DKernel, Trapezoid1DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import RickerWavelet1DKernel\n        ricker_1d_kernel = RickerWavelet1DKernel(10)\n        plt.plot(ricker_1d_kernel, drawstyle='steps')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('value')\n        plt.show()\n\n    \"\"\"\n    _is_bool = True\n\n    def __init__(self, width, **kwargs):\n        amplitude = 1.0 / (np.sqrt(2 * np.pi) * width ** 3)\n        self._model = models.RickerWavelet1D(amplitude, 0, width)\n        self._default_size = _round_up_to_odd_integer(8 * width)\n        super().__init__(**kwargs)\n        self._truncation = np.abs(self._array.sum() / self._array.size)\n\n\nclass RickerWavelet2DKernel(Kernel2D):\n    \"\"\"\n    2D Ricker wavelet filter kernel (sometimes known as a \"Mexican Hat\"\n    kernel).\n\n    The Ricker wavelet, or inverted Gaussian-Laplace filter, is a\n    bandpass filter. It smooths the data and removes slowly varying\n    or constant structures (e.g. Background). It is useful for peak or\n    multi-scale detection.\n\n    This kernel is derived from a normalized Gaussian function, by\n    computing the second derivative. This results in an amplitude\n    at the kernels center of 1. / (pi * width ** 4). The normalization\n    is the same as for `scipy.ndimage.gaussian_laplace`, except\n    for a minus sign.\n\n    .. note::\n\n        See https://github.com/astropy/astropy/pull/9445 for discussions\n        related to renaming of this kernel.\n\n    Parameters\n    ----------\n    width : number\n        Width of the filter kernel, defined as the standard deviation\n        of the Gaussian function from which it is derived.\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*width +1⌋.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*width +1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, Tophat2DKernel, Ring2DKernel,\n    TrapezoidDisk2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import RickerWavelet2DKernel\n        ricker_2d_kernel = RickerWavelet2DKernel(10)\n        plt.imshow(ricker_2d_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n    \"\"\"\n    _is_bool = False\n\n    def __init__(self, width, **kwargs):\n        amplitude = 1.0 / (np.pi * width ** 4)\n        self._model = models.RickerWavelet2D(amplitude, 0, 0, width)\n        self._default_size = _round_up_to_odd_integer(8 * width)\n        super().__init__(**kwargs)\n        self._truncation = np.abs(self._array.sum() / self._array.size)\n\n\nclass AiryDisk2DKernel(Kernel2D):\n    \"\"\"\n    2D Airy disk kernel.\n\n    This kernel models the diffraction pattern of a circular aperture.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    radius : float\n        The radius of the Airy disk kernel (radius of the first zero).\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*radius + 1⌋.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*radius + 1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, Tophat2DKernel, RickerWavelet2DKernel,\n    Ring2DKernel, TrapezoidDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import AiryDisk2DKernel\n        airydisk_2D_kernel = AiryDisk2DKernel(10)\n        plt.imshow(airydisk_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n    \"\"\"\n    _is_bool = False\n\n    def __init__(self, radius, **kwargs):\n        self._model = models.AiryDisk2D(1, 0, 0, radius)\n        self._default_size = _round_up_to_odd_integer(8 * radius)\n        super().__init__(**kwargs)\n        self.normalize()\n        self._truncation = None\n\n\nclass Moffat2DKernel(Kernel2D):\n    \"\"\"\n    2D Moffat kernel.\n\n    This kernel is a typical model for a seeing limited PSF.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    gamma : float\n        Core width of the Moffat model.\n    alpha : float\n        Power index of the Moffat model.\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*radius + 1⌋.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*radius + 1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, Tophat2DKernel, RickerWavelet2DKernel,\n    Ring2DKernel, TrapezoidDisk2DKernel, AiryDisk2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Moffat2DKernel\n        moffat_2D_kernel = Moffat2DKernel(3, 2)\n        plt.imshow(moffat_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n    \"\"\"\n    _is_bool = False\n\n    def __init__(self, gamma, alpha, **kwargs):\n        # Compute amplitude, from\n        # https://en.wikipedia.org/wiki/Moffat_distribution\n        amplitude = (alpha - 1.0) / (np.pi * gamma * gamma)\n        self._model = models.Moffat2D(amplitude, 0, 0, gamma, alpha)\n        self._default_size = _round_up_to_odd_integer(4.0 * self._model.fwhm)\n        super().__init__(**kwargs)\n        self.normalize()\n        self._truncation = None\n\n\nclass Model1DKernel(Kernel1D):\n    \"\"\"\n    Create kernel from 1D model.\n\n    The model has to be centered on x = 0.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.Fittable1DModel`\n        Kernel response function model\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*width +1⌋.\n        Must be odd.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    Raises\n    ------\n    TypeError\n        If model is not an instance of `~astropy.modeling.Fittable1DModel`\n\n    See also\n    --------\n    Model2DKernel : Create kernel from `~astropy.modeling.Fittable2DModel`\n    CustomKernel : Create kernel from list or array\n\n    Examples\n    --------\n    Define a Gaussian1D model:\n\n        >>> from astropy.modeling.models import Gaussian1D\n        >>> from astropy.convolution.kernels import Model1DKernel\n        >>> gauss = Gaussian1D(1, 0, 2)\n\n    And create a custom one dimensional kernel from it:\n\n        >>> gauss_kernel = Model1DKernel(gauss, x_size=9)\n\n    This kernel can now be used like a usual Astropy kernel.\n    \"\"\"\n    _separable = False\n    _is_bool = False\n\n    def __init__(self, model, **kwargs):\n        if isinstance(model, Fittable1DModel):\n            self._model = model\n        else:\n            raise TypeError(\"Must be Fittable1DModel\")\n        super().__init__(**kwargs)\n\n\nclass Model2DKernel(Kernel2D):\n    \"\"\"\n    Create kernel from 2D model.\n\n    The model has to be centered on x = 0 and y = 0.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.Fittable2DModel`\n        Kernel response function model\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*width +1⌋.\n        Must be odd.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*width +1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    Raises\n    ------\n    TypeError\n        If model is not an instance of `~astropy.modeling.Fittable2DModel`\n\n    See also\n    --------\n    Model1DKernel : Create kernel from `~astropy.modeling.Fittable1DModel`\n    CustomKernel : Create kernel from list or array\n\n    Examples\n    --------\n    Define a Gaussian2D model:\n\n        >>> from astropy.modeling.models import Gaussian2D\n        >>> from astropy.convolution.kernels import Model2DKernel\n        >>> gauss = Gaussian2D(1, 0, 0, 2, 2)\n\n    And create a custom two dimensional kernel from it:\n\n        >>> gauss_kernel = Model2DKernel(gauss, x_size=9)\n\n    This kernel can now be used like a usual astropy kernel.\n\n    \"\"\"\n    _is_bool = False\n    _separable = False\n\n    def __init__(self, model, **kwargs):\n        self._separable = False\n        if isinstance(model, Fittable2DModel):\n            self._model = model\n        else:\n            raise TypeError(\"Must be Fittable2DModel\")\n        super().__init__(**kwargs)\n\n\nclass PSFKernel(Kernel2D):\n    \"\"\"\n    Initialize filter kernel from astropy PSF instance.\n    \"\"\"\n    _separable = False\n\n    def __init__(self):\n        raise NotImplementedError('Not yet implemented')\n\n\nclass CustomKernel(Kernel):\n    \"\"\"\n    Create filter kernel from list or array.\n\n    Parameters\n    ----------\n    array : list or array\n        Filter kernel array. Size must be odd.\n\n    Raises\n    ------\n    TypeError\n        If array is not a list or array.\n    `~astropy.convolution.KernelSizeError`\n        If array size is even.\n\n    See also\n    --------\n    Model2DKernel, Model1DKernel\n\n    Examples\n    --------\n    Define one dimensional array:\n\n        >>> from astropy.convolution.kernels import CustomKernel\n        >>> import numpy as np\n        >>> array = np.array([1, 2, 3, 2, 1])\n        >>> kernel = CustomKernel(array)\n        >>> kernel.dimension\n        1\n\n    Define two dimensional array:\n\n        >>> array = np.array([[1, 1, 1], [1, 2, 1], [1, 1, 1]])\n        >>> kernel = CustomKernel(array)\n        >>> kernel.dimension\n        2\n    \"\"\"\n    def __init__(self, array):\n        self.array = array\n        super().__init__(self._array)\n\n    @property\n    def array(self):\n        \"\"\"\n        Filter kernel array.\n        \"\"\"\n        return self._array\n\n    @array.setter\n    def array(self, array):\n        \"\"\"\n        Filter kernel array setter\n        \"\"\"\n        if isinstance(array, np.ndarray):\n            self._array = array.astype(np.float64)\n        elif isinstance(array, list):\n            self._array = np.array(array, dtype=np.float64)\n        else:\n            raise TypeError(\"Must be list or array.\")\n\n        # Check if array is odd in all axes\n        if has_even_axis(self):\n            raise_even_kernel_exception()\n\n        # Check if array is bool\n        ones = self._array == 1.\n        zeros = self._array == 0\n        self._is_bool = bool(np.all(np.logical_or(ones, zeros)))\n\n        self._truncation = 0.0\n\n\n@deprecated('4.0', alternative='RickerWavelet1DKernel')\nclass MexicanHat1DKernel(RickerWavelet1DKernel):\n    pass\n\n\n@deprecated('4.0', alternative='RickerWavelet2DKernel')\nclass MexicanHat2DKernel(RickerWavelet2DKernel):\n    pass\n"},{"className":"Kernel2D","col":0,"comment":"\n    Base class for 2D filter kernels.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.FittableModel`\n        Model to be evaluated.\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*width + 1⌋.\n        Only used if ``array`` is None.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*width + 1⌋.\n        Only used if ``array`` is None,\n    array : ndarray or None, optional\n        Kernel array. Default is None.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    width : number\n        Width of the filter kernel.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n    ","endLoc":319,"id":14662,"nodeType":"Class","startLoc":247,"text":"class Kernel2D(Kernel):\n    \"\"\"\n    Base class for 2D filter kernels.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.FittableModel`\n        Model to be evaluated.\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*width + 1⌋.\n        Only used if ``array`` is None.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*width + 1⌋.\n        Only used if ``array`` is None,\n    array : ndarray or None, optional\n        Kernel array. Default is None.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    width : number\n        Width of the filter kernel.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n    \"\"\"\n\n    def __init__(self, model=None, x_size=None, y_size=None, array=None, **kwargs):\n\n        # Initialize from model\n        if self._model:\n            if array is not None:\n                # Reject \"array\" keyword for kernel models, to avoid them not being\n                # populated as expected.\n                raise TypeError(\"Array argument not allowed for kernel models.\")\n            if x_size is None:\n                x_size = self._default_size\n            elif x_size != int(x_size):\n                raise TypeError(\"x_size should be an integer\")\n\n            if y_size is None:\n                y_size = x_size\n            elif y_size != int(y_size):\n                raise TypeError(\"y_size should be an integer\")\n\n            # Set ranges where to evaluate the model\n\n            if x_size % 2 == 0:  # even kernel\n                x_range = (-(int(x_size)) // 2 + 0.5, (int(x_size)) // 2 + 0.5)\n            else:  # odd kernel\n                x_range = (-(int(x_size) - 1) // 2, (int(x_size) - 1) // 2 + 1)\n\n            if y_size % 2 == 0:  # even kernel\n                y_range = (-(int(y_size)) // 2 + 0.5, (int(y_size)) // 2 + 0.5)\n            else:  # odd kernel\n                y_range = (-(int(y_size) - 1) // 2, (int(y_size) - 1) // 2 + 1)\n\n            array = discretize_model(self._model, x_range, y_range, **kwargs)\n\n        # Initialize from array\n        elif array is None:\n            raise TypeError(\"Must specify either array or model.\")\n\n        super().__init__(array)"},{"col":4,"comment":"null","endLoc":319,"header":"def __init__(self, model=None, x_size=None, y_size=None, array=None, **kwargs)","id":14663,"name":"__init__","nodeType":"Function","startLoc":283,"text":"def __init__(self, model=None, x_size=None, y_size=None, array=None, **kwargs):\n\n        # Initialize from model\n        if self._model:\n            if array is not None:\n                # Reject \"array\" keyword for kernel models, to avoid them not being\n                # populated as expected.\n                raise TypeError(\"Array argument not allowed for kernel models.\")\n            if x_size is None:\n                x_size = self._default_size\n            elif x_size != int(x_size):\n                raise TypeError(\"x_size should be an integer\")\n\n            if y_size is None:\n                y_size = x_size\n            elif y_size != int(y_size):\n                raise TypeError(\"y_size should be an integer\")\n\n            # Set ranges where to evaluate the model\n\n            if x_size % 2 == 0:  # even kernel\n                x_range = (-(int(x_size)) // 2 + 0.5, (int(x_size)) // 2 + 0.5)\n            else:  # odd kernel\n                x_range = (-(int(x_size) - 1) // 2, (int(x_size) - 1) // 2 + 1)\n\n            if y_size % 2 == 0:  # even kernel\n                y_range = (-(int(y_size)) // 2 + 0.5, (int(y_size)) // 2 + 0.5)\n            else:  # odd kernel\n                y_range = (-(int(y_size) - 1) // 2, (int(y_size) - 1) // 2 + 1)\n\n            array = discretize_model(self._model, x_range, y_range, **kwargs)\n\n        # Initialize from array\n        elif array is None:\n            raise TypeError(\"Must specify either array or model.\")\n\n        super().__init__(array)"},{"attributeType":"null","col":16,"comment":"null","endLoc":21,"id":14664,"name":"np","nodeType":"Attribute","startLoc":21,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":29,"id":14665,"name":"__all__","nodeType":"Attribute","startLoc":29,"text":"__all__"},{"col":0,"comment":"","endLoc":16,"header":"core.py#<anonymous>","id":14666,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module contains the convolution and filter functionalities of astropy.\n\nA few conceptual notes:\nA filter kernel is mainly characterized by its response function. In the 1D\ncase we speak of \"impulse response function\", in the 2D case we call it \"point\nspread function\". This response function is given for every kernel by an\nastropy `FittableModel`, which is evaluated on a grid to obtain a filter array,\nwhich can then be applied to binned data.\n\nThe model is centered on the array and should have an amplitude such that the array\nintegrates to one per default.\n\nCurrently only symmetric 2D kernels are supported.\n\"\"\"\n\nMAX_NORMALIZATION = 100\n\n__all__ = ['Kernel', 'Kernel1D', 'Kernel2D', 'kernel_arithmetics']"},{"col":4,"comment":"\n        Subtract two filter kernels.\n        ","endLoc":155,"header":"def __sub__(self, kernel)","id":14667,"name":"__sub__","nodeType":"Function","startLoc":151,"text":"def __sub__(self, kernel):\n        \"\"\"\n        Subtract two filter kernels.\n        \"\"\"\n        return kernel_arithmetics(self, kernel, 'sub')"},{"className":"Gaussian1DKernel","col":0,"comment":"\n    1D Gaussian filter kernel.\n\n    The Gaussian filter is a filter with great smoothing properties. It is\n    isotropic and does not produce artifacts.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    stddev : number\n        Standard deviation of the Gaussian kernel.\n    x_size : int, optional\n        Size of the kernel array. Default = ⌊8*stddev+1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin. Very slow.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10. If the factor\n        is too large, evaluation can be very slow.\n\n\n    See Also\n    --------\n    Box1DKernel, Trapezoid1DKernel, RickerWavelet1DKernel\n\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Gaussian1DKernel\n        gauss_1D_kernel = Gaussian1DKernel(10)\n        plt.plot(gauss_1D_kernel, drawstyle='steps')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('value')\n        plt.show()\n    ","endLoc":91,"id":14668,"nodeType":"Class","startLoc":29,"text":"class Gaussian1DKernel(Kernel1D):\n    \"\"\"\n    1D Gaussian filter kernel.\n\n    The Gaussian filter is a filter with great smoothing properties. It is\n    isotropic and does not produce artifacts.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    stddev : number\n        Standard deviation of the Gaussian kernel.\n    x_size : int, optional\n        Size of the kernel array. Default = ⌊8*stddev+1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin. Very slow.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10. If the factor\n        is too large, evaluation can be very slow.\n\n\n    See Also\n    --------\n    Box1DKernel, Trapezoid1DKernel, RickerWavelet1DKernel\n\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Gaussian1DKernel\n        gauss_1D_kernel = Gaussian1DKernel(10)\n        plt.plot(gauss_1D_kernel, drawstyle='steps')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('value')\n        plt.show()\n    \"\"\"\n    _separable = True\n    _is_bool = False\n\n    def __init__(self, stddev, **kwargs):\n        self._model = models.Gaussian1D(1. / (np.sqrt(2 * np.pi) * stddev),\n                                        0, stddev)\n        self._default_size = _round_up_to_odd_integer(8 * stddev)\n        super().__init__(**kwargs)\n        self._truncation = np.abs(1. - self._array.sum())"},{"col":4,"comment":"\n        Multiply kernel with number or convolve two kernels.\n        ","endLoc":161,"header":"def __mul__(self, value)","id":14669,"name":"__mul__","nodeType":"Function","startLoc":157,"text":"def __mul__(self, value):\n        \"\"\"\n        Multiply kernel with number or convolve two kernels.\n        \"\"\"\n        return kernel_arithmetics(self, value, \"mul\")"},{"col":4,"comment":"\n        Multiply kernel with number or convolve two kernels.\n        ","endLoc":167,"header":"def __rmul__(self, value)","id":14670,"name":"__rmul__","nodeType":"Function","startLoc":163,"text":"def __rmul__(self, value):\n        \"\"\"\n        Multiply kernel with number or convolve two kernels.\n        \"\"\"\n        return kernel_arithmetics(self, value, \"mul\")"},{"id":14671,"name":"astropy/convolution/src","nodeType":"Package"},{"id":14672,"name":"convolve.h","nodeType":"TextFile","path":"astropy/convolution/src","text":"#ifndef CONVOLVE_INCLUDE\n#define CONVOLVE_INCLUDE\n\n#include <stddef.h>\n\n// Forcibly disable OpenMP support at the src level\n#undef _OPENMP\n\n#if defined(_MSC_VER)\n\n#define FORCE_INLINE  __forceinline\n#define NEVER_INLINE  __declspec(noinline)\n\n// Other compilers (including GCC & Clang)\n#else\n\n#define FORCE_INLINE inline __attribute__((always_inline))\n#define NEVER_INLINE __attribute__((noinline))\n\n#endif\n\n// MSVC implements OpenMP 2.0 which mandates signed integers for its parallel loops\n#if defined(_MSC_VER)\ntypedef signed omp_iter_var;\n#else\ntypedef size_t omp_iter_var;\n#endif\n\n// MSVC exports\n#if defined(_MSC_VER)\n#define LIB_CONVOLVE_EXPORT __declspec(dllexport)\n#else\n#define LIB_CONVOLVE_EXPORT // nothing\n#endif\n\n// Distutils on Windows will automatically exports ``PyInit_lib_convolve``,\n// create dummy to prevent linker complaining about missing symbol.\n#if defined(_MSC_VER)\nvoid PyInit__convolve(void);\n#endif\n\n#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\n#define NO_IMPORT_ARRAY\n#include \"numpy/ndarrayobject.h\"\n#define DTYPE npy_float64\n\n\nLIB_CONVOLVE_EXPORT void convolveNd_c(DTYPE * const result,\n        const DTYPE * const f,\n        const unsigned n_dim,\n        const size_t * const image_shape,\n        const DTYPE * const g,\n        const size_t * const kernel_shape,\n        const bool nan_interpolate,\n        const bool embed_result_within_padded_region,\n        const unsigned n_threads);\n\n// 1D\nvoid convolve1d_c(DTYPE * const result,\n        const DTYPE * const f, const size_t nx,\n        const DTYPE * const g, const size_t nkx,\n        const bool nan_interpolate,\n        const bool embed_result_within_padded_region,\n        const unsigned n_threads);\nFORCE_INLINE void convolve1d(DTYPE * const result,\n        const DTYPE * const f, const size_t nx,\n        const DTYPE * const g, const size_t nkx,\n        const bool nan_interpolate,\n        const bool embed_result_within_padded_region,\n        const unsigned n_threads);\n\n// 2D\nvoid convolve2d_c(DTYPE * const result,\n        const DTYPE * const f, const size_t nx, const size_t ny,\n        const DTYPE * const g, const size_t nkx, const size_t nky,\n        const bool nan_interpolate,\n        const bool embed_result_within_padded_region,\n        const unsigned n_threads);\nFORCE_INLINE void convolve2d(DTYPE * const result,\n        const DTYPE * const f, const size_t nx, const size_t ny,\n        const DTYPE * const g, const size_t nkx, const size_t nky,\n        const bool nan_interpolate,\n        const bool embed_result_within_padded_region,\n        const unsigned n_threads);\n\n// 3D\nvoid convolve3d_c(DTYPE * const result,\n        const DTYPE * const f, const size_t nx, const size_t ny, const size_t nz,\n        const DTYPE * const g, const size_t nkx, const size_t nky, const size_t nkz,\n        const bool nan_interpolate,\n        const bool embed_result_within_padded_region,\n        const unsigned n_threads);\nFORCE_INLINE void convolve3d(DTYPE * const result,\n        const DTYPE * const f, const size_t nx, const size_t ny, const size_t nz,\n        const DTYPE * const g, const size_t nkx, const size_t nky, const size_t nkz,\n        const bool nan_interpolate,\n        const bool embed_result_within_padded_region,\n        const unsigned n_threads);\n\n\n#endif\n"},{"col":4,"comment":"\n        Array representation of the kernel.\n        ","endLoc":173,"header":"def __array__(self)","id":14673,"name":"__array__","nodeType":"Function","startLoc":169,"text":"def __array__(self):\n        \"\"\"\n        Array representation of the kernel.\n        \"\"\"\n        return self._array"},{"col":4,"comment":"\n        Wrapper for multiplication with numpy arrays.\n        ","endLoc":182,"header":"def __array_wrap__(self, array, context=None)","id":14674,"name":"__array_wrap__","nodeType":"Function","startLoc":175,"text":"def __array_wrap__(self, array, context=None):\n        \"\"\"\n        Wrapper for multiplication with numpy arrays.\n        \"\"\"\n        if type(context[0]) == np.ufunc:\n            return NotImplemented\n        else:\n            return array"},{"attributeType":"null","col":4,"comment":"null","endLoc":41,"id":14675,"name":"_separable","nodeType":"Attribute","startLoc":41,"text":"_separable"},{"id":14676,"name":"convolve.c","nodeType":"TextFile","path":"astropy/convolution/src","text":"// Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n/*----------------------------- WARNING! -----------------------------\n * The C functions below are NOT designed to be called externally to\n * the Python function astropy/astropy/convolution/convolve.py.\n * They do NOT include any of the required correct usage checking.\n *\n *------------------------------- NOTES ------------------------------\n *\n * The simplest implementation of convolution does not deal with any boundary\n * treatment, and pixels within half a kernel width of the edge of the image are\n * set to zero. In cases where a boundary mode is set, we pad the input array in\n * the Python code. In the 1D case, this means that the input array to the C\n * code has a size nx + nkx where nx is the original array size and nkx is the\n * size of the kernel. If we also padded the results array, then we could use\n * the exact same C code for the convolution, provided that the results array\n * was 'unpadded' in the Python code after the C code.\n *\n * However, to avoid needlessly padding the results array, we instead adjust the\n * index when accessing the results array - for example in the 1D case we shift\n * the index in the results array compared to the input array by half the kernel\n * size. This is done via the 'result_index' variable, and this behavior is\n * triggered by the 'embed_result_within_padded_region' setting.\n *\n */\n\n\n#include <assert.h>\n#include <math.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <stddef.h>\n\n#include \"convolve.h\"\n\n// Distutils on Windows automatically exports ``PyInit__convolve``,\n// create dummy to prevent linker complaining about missing symbol.\n#if defined(_MSC_VER)\nvoid PyInit__convolve(void)\n{\n    return;\n}\n#endif\n\n#ifdef _OPENMP\n#include <omp.h>\n#endif\n\n\nvoid convolveNd_c(DTYPE * const result,\n        const DTYPE * const f,\n        const unsigned n_dim,\n        const size_t * const image_shape,\n        const DTYPE * const g,\n        const size_t * const kernel_shape,\n        const bool nan_interpolate,\n        const bool embed_result_within_padded_region,\n        const unsigned n_threads)\n{\n#ifdef NDEBUG\n    if (!result || !f || !g || !image_shape || !kernel_shape)\n        return;\n#else\n    assert(result);\n    assert(f);\n    assert(g);\n    assert(image_shape);\n    assert(kernel_shape);\n#endif\n\n    if (n_dim == 1)\n        convolve1d_c(result, f,\n                image_shape[0],\n                g, kernel_shape[0],\n                nan_interpolate,\n                embed_result_within_padded_region,\n                n_threads);\n    else if (n_dim == 2)\n        convolve2d_c(result, f,\n                image_shape[0], image_shape[1],\n                g, kernel_shape[0], kernel_shape[1],\n                nan_interpolate,\n                embed_result_within_padded_region,\n                n_threads);\n    else if (n_dim == 3)\n        convolve3d_c(result, f,\n                        image_shape[0], image_shape[1], image_shape[2],\n                        g, kernel_shape[0], kernel_shape[1], kernel_shape[2],\n                        nan_interpolate,\n                        embed_result_within_padded_region,\n                        n_threads);\n    else\n        assert(0); // Unimplemented: n_dim > 3\n}\n\n/*-------------------------PERFORMANCE NOTES--------------------------------\n * The function wrappers below are designed to take advantage of the following:\n * The preprocessor will inline convolve<N>d(), effectively\n * expanding the two logical branches, replacing nan_interpolate\n * for their literal equivalents. The corresponding conditionals\n * within these functions will then be optimized away, this\n * being the goal - removing the unnecessary conditionals from\n * the loops without duplicating code.\n *--------------------------------------------------------------------------\n */\n\nvoid convolve1d_c(DTYPE * const result,\n        const DTYPE * const f, const size_t nx,\n        const DTYPE * const g, const size_t nkx,\n        const bool nan_interpolate,\n        const bool embed_result_within_padded_region,\n        const unsigned n_threads)\n{\n#ifdef NDEBUG\n    if (!result || !f || !g)\n        return;\n#else\n    assert(result);\n    assert(f);\n    assert(g);\n#endif\n\n    if (nan_interpolate) {\n      if (embed_result_within_padded_region)\n        convolve1d(result, f, nx, g, nkx, true, true, n_threads);\n      else\n        convolve1d(result, f, nx, g, nkx, true, false, n_threads);\n    } else {\n      if (embed_result_within_padded_region)\n        convolve1d(result, f, nx, g, nkx, false, true, n_threads);\n      else\n        convolve1d(result, f, nx, g, nkx, false, false, n_threads);\n    }\n}\n\nvoid convolve2d_c(DTYPE * const result,\n        const DTYPE * const f, const size_t nx, const size_t ny,\n        const DTYPE * const g, const size_t nkx, const size_t nky,\n        const bool nan_interpolate,\n        const bool embed_result_within_padded_region,\n        const unsigned n_threads)\n{\n#ifdef NDEBUG\n    if (!result || !f || !g)\n        return;\n#else\n    assert(result);\n    assert(f);\n    assert(g);\n#endif\n\n    if (nan_interpolate) {\n      if (embed_result_within_padded_region)\n        convolve2d(result, f, nx, ny, g, nkx, nky, true, true, n_threads);\n      else\n        convolve2d(result, f, nx, ny, g, nkx, nky, true, false, n_threads);\n    } else {\n      if (embed_result_within_padded_region)\n        convolve2d(result, f, nx, ny, g, nkx, nky, false, true, n_threads);\n      else\n        convolve2d(result, f, nx, ny, g, nkx, nky, false, false, n_threads);\n    }\n}\n\nvoid convolve3d_c(DTYPE * const result,\n        const DTYPE * const f, const size_t nx, const size_t ny, const size_t nz,\n        const DTYPE * const g, const size_t nkx, const size_t nky, const size_t nkz,\n        const bool nan_interpolate,\n        const bool embed_result_within_padded_region,\n        const unsigned n_threads)\n{\n#ifdef NDEBUG\n    if (!result || !f || !g)\n        return;\n#else\n    assert(result);\n    assert(f);\n    assert(g);\n#endif\n\n    if (nan_interpolate) {\n      if (embed_result_within_padded_region)\n        convolve3d(result, f, nx, ny, nz, g, nkx, nky, nkz, true, true, n_threads);\n      else\n        convolve3d(result, f, nx, ny, nz, g, nkx, nky, nkz, true, false, n_threads);\n    } else {\n      if (embed_result_within_padded_region)\n        convolve3d(result, f, nx, ny, nz, g, nkx, nky, nkz, false, true, n_threads);\n      else\n        convolve3d(result, f, nx, ny, nz, g, nkx, nky, nkz, false, false, n_threads);\n    }\n}\n\n// 1D\nFORCE_INLINE void convolve1d(DTYPE * const result,\n        const DTYPE * const f, const size_t _nx,\n        const DTYPE * const g, const size_t _nkx,\n        const bool _nan_interpolate,\n        const bool _embed_result_within_padded_region,\n        const unsigned n_threads)\n{\n#ifdef NDEBUG\n    if (!result || !f || !g)\n        return;\n#else\n    assert(result);\n    assert(f);\n    assert(g);\n#endif\n\n    const size_t _wkx = _nkx / 2;\n\n#ifdef NDEBUG\n    if (!(_nx > 2*_wkx))\n        return;\n#else\n    assert(_nx > 2*_wkx);\n#endif\n\n#ifdef _OPENMP\n    omp_set_num_threads(n_threads); // Set number of threads to use\n#pragma omp parallel\n    { // Code within this block is threaded\n#endif\n\n    // Copy these to thread locals to allow compiler to optimize (hoist/loads licm)\n    // when threaded. Without these, compile time constant conditionals may\n    // not be optimized away.\n    const size_t nx = _nx;\n    const size_t nkx = _nkx;\n    const size_t nkx_minus_1 = nkx - 1;\n    const bool nan_interpolate = _nan_interpolate;\n    const bool embed_result_within_padded_region = _embed_result_within_padded_region;\n\n    // Thread locals\n    const size_t wkx = _wkx;\n    const omp_iter_var nx_minus_wkx = nx - wkx;\n    size_t i_minus_wkx;\n    size_t result_index;\n\n    DTYPE top, bot=0., ker, val;\n\n    {omp_iter_var i;\n#ifdef _OPENMP\n#pragma omp for schedule(dynamic)\n#endif\n    for (i = wkx; i < nx_minus_wkx; ++i)\n    {\n        i_minus_wkx = i - wkx;\n\n        top = 0.;\n        if (nan_interpolate) // compile time constant\n            bot = 0.;\n        {omp_iter_var ii;\n        for (ii = 0; ii < nkx; ++ii)\n        {\n            val = f[i_minus_wkx + ii];\n            ker = g[nkx_minus_1 - ii];\n            if (nan_interpolate) // compile time constant\n            {\n                if (!isnan(val))\n                {\n                    top += val * ker;\n                    bot += ker;\n                }\n            }\n            else\n                top += val * ker;\n        }}\n\n        if (embed_result_within_padded_region) { // compile time constant\n            result_index = i;\n        } else {\n            result_index = i_minus_wkx;\n        }\n\n        if (nan_interpolate) // compile time constant\n        {\n            if (bot == 0) // This should prob be np.isclose(kernel_sum, 0, atol=normalization_zero_tol)\n                result[result_index]  = f[i];\n            else\n                result[result_index]  = top / bot;\n        }\n        else\n            result[result_index] = top;\n    }}\n#ifdef _OPENMP\n    }//end parallel scope\n#endif\n}\n\n// 2D\nFORCE_INLINE void convolve2d(DTYPE * const result,\n        const DTYPE * const f, const size_t _nx, const size_t _ny,\n        const DTYPE * const g, const size_t _nkx, const size_t _nky,\n        const bool _nan_interpolate,\n        const bool _embed_result_within_padded_region,\n        const unsigned n_threads)\n{\n#ifdef NDEBUG\n    if (!result || !f || !g)\n        return;\n#else\n    assert(result);\n    assert(f);\n    assert(g);\n#endif\n\n    const size_t _wkx = _nkx / 2;\n    const size_t _wky = _nky / 2;\n#ifdef NDEBUG\n    if (!(_nx > 2*_wkx) || !(_ny > 2*_wky))\n        return;\n#else\n    assert(_nx > 2*_wkx);\n    assert(_ny > 2*_wky);\n#endif\n\n#ifdef _OPENMP\n    omp_set_num_threads(n_threads); // Set number of threads to use\n#pragma omp parallel\n    { // Code within this block is threaded\n#endif\n\n    // Copy these to thread locals to allow compiler to optimize (hoist/loads licm)\n    // when threaded. Without these, compile time constant conditionals may\n    // not be optimized away.\n    const size_t nx = _nx, ny = _ny;\n    const size_t nkx = _nkx, nky = _nky;\n    const size_t nkx_minus_1 = nkx - 1, nky_minus_1 = nky - 1;\n    const bool nan_interpolate = _nan_interpolate;\n    const bool embed_result_within_padded_region = _embed_result_within_padded_region;\n\n    // Thread locals\n    const size_t wkx = _wkx;\n    const size_t wky = _wky;\n    const omp_iter_var nx_minus_wkx = nx - wkx;\n    const omp_iter_var ny_minus_wky = ny - wky;\n    const size_t ny_minus_2wky = ny - 2 * wky;\n    size_t i_minus_wkx, j_minus_wky;\n    size_t result_cursor;\n    size_t f_cursor, g_cursor;\n    size_t result_index;\n\n    DTYPE top, bot=0., ker, val;\n\n    {omp_iter_var i;\n#ifdef _OPENMP\n#pragma omp for schedule(dynamic)\n#endif\n    for (i = wkx; i < nx_minus_wkx; ++i)\n    {\n        i_minus_wkx = i - wkx;\n        result_cursor = i*ny;\n\n        {omp_iter_var j;\n        for (j = wky; j < ny_minus_wky; ++j)\n        {\n            j_minus_wky = j - wky;\n\n            top = 0.;\n            if (nan_interpolate) // compile time constant\n                bot = 0.;\n            {omp_iter_var ii;\n            for (ii = 0; ii < nkx; ++ii)\n            {\n                f_cursor = (i_minus_wkx + ii)*ny + j_minus_wky;\n                g_cursor = (nkx_minus_1 - ii)*nky + nky_minus_1;\n\n                {omp_iter_var jj;\n                for (jj = 0; jj < nky; ++jj)\n                {\n                    val = f[f_cursor + jj];\n                    ker = g[g_cursor - jj];\n                    if (nan_interpolate) // compile time constant\n                    {\n                        if (!isnan(val))\n                        {\n                            top += val * ker;\n                            bot += ker;\n                        }\n                    }\n                    else\n                        top += val * ker;\n                }}\n            }}\n\n            if (embed_result_within_padded_region) { // compile time constant\n                result_index = result_cursor + j;\n            } else {\n                result_index = i_minus_wkx * ny_minus_2wky + j_minus_wky;\n            }\n\n            if (nan_interpolate) // compile time constant\n            {\n                if (bot == 0) // This should prob be np.isclose(kernel_sum, 0, atol=normalization_zero_tol)\n                    result[result_index]  = f[result_cursor + j] ;\n                else\n                    result[result_index]  = top / bot;\n            }\n            else\n                result[result_index] = top;\n        }}\n    }}\n#ifdef _OPENMP\n    }//end parallel scope\n#endif\n}\n\n// 3D\nFORCE_INLINE void convolve3d(DTYPE * const result,\n        const DTYPE * const f, const size_t _nx, const size_t _ny, const size_t _nz,\n        const DTYPE * const g, const size_t _nkx, const size_t _nky, const size_t _nkz,\n        const bool _nan_interpolate,\n        const bool _embed_result_within_padded_region,\n        const unsigned n_threads)\n{\n#ifdef NDEBUG\n    if (!result || !f || !g)\n        return;\n#else\n    assert(result);\n    assert(f);\n    assert(g);\n#endif\n\n    const size_t _wkx = _nkx / 2;\n    const size_t _wky = _nky / 2;\n    const size_t _wkz = _nkz / 2;\n#ifdef NDEBUG\n    if (!(_nx > 2*_wkx) || !(_ny > 2*_wky) || !(_nz > 2*_wkz))\n        return;\n#else\n    assert(_nx > 2*_wkx);\n    assert(_ny > 2*_wky);\n    assert(_nz > 2*_wkz);\n#endif\n\n#ifdef _OPENMP\n    omp_set_num_threads(n_threads); // Set number of threads to use\n#pragma omp parallel\n    { // Code within this block is threaded\n#endif\n\n    // Copy these to thread locals to allow compiler to optimize (hoist/loads licm)\n    // when threaded. Without these, compile time constant conditionals may\n    // not be optimized away.\n    const size_t nx = _nx, ny = _ny, nz = _nz;\n    const size_t nkx = _nkx, nky = _nky, nkz = _nkz;\n    const size_t nkx_minus_1 = nkx - 1, nky_minus_1 = nky - 1, nkz_minus_1 = nkz - 1;\n    const bool nan_interpolate = _nan_interpolate;\n    const bool embed_result_within_padded_region = _embed_result_within_padded_region;\n\n    // Thread locals\n    const size_t wkx = _wkx;\n    const size_t wky = _wky;\n    const size_t wkz = _wkz;\n    const size_t nx_minus_wkx = nx - wkx;\n    const omp_iter_var ny_minus_wky = ny - wky;\n    const omp_iter_var nz_minus_wkz = nz - wkz;\n    const size_t ny_minus_2wky = ny - 2 * wky;\n    const size_t nz_minus_2wkz = nz - 2 * wkz;\n    size_t i_minus_wkx, j_minus_wky, k_minus_wkz;\n    size_t f_ii_cursor, g_ii_cursor;\n    size_t f_cursor, g_cursor;\n    size_t array_cursor, array_i_cursor;\n    size_t result_index;\n\n    DTYPE top, bot=0., ker, val;\n\n    {omp_iter_var i;\n#ifdef _OPENMP\n#pragma omp for schedule(dynamic)\n#endif\n    for (i = wkx; i < nx_minus_wkx; ++i)\n    {\n        i_minus_wkx = i - wkx;\n        array_i_cursor = i*ny;\n\n        {omp_iter_var j;\n        for (j = wky; j < ny_minus_wky; ++j)\n        {\n            j_minus_wky = j - wky;\n            array_cursor = (array_i_cursor + j)*nz;\n\n            {omp_iter_var k;\n            for (k = wkz; k < nz_minus_wkz; ++k)\n            {\n                k_minus_wkz = k - wkz;\n\n                top = 0.;\n                if (nan_interpolate) // compile time constant\n                    bot = 0.;\n                {omp_iter_var ii;\n                for (ii = 0; ii < nkx; ++ii)\n                {\n                    f_ii_cursor = ((i_minus_wkx + ii)*ny + j_minus_wky)*nz + k_minus_wkz;\n                    g_ii_cursor = ((nkx_minus_1 - ii)*nky + nky_minus_1)*nkz + nkz_minus_1;\n\n                    {omp_iter_var jj;\n                    for (jj = 0; jj < nky; ++jj)\n                    {\n                        f_cursor = f_ii_cursor + jj*nz;\n                        g_cursor = g_ii_cursor - jj*nkz;\n                        {omp_iter_var kk;\n                        for (kk = 0; kk < nkz; ++kk)\n                        {\n                            val = f[f_cursor + kk];\n                            ker = g[g_cursor - kk];\n                            if (nan_interpolate) // compile time constant\n                            {\n                                if (!isnan(val))\n                                {\n                                    top += val * ker;\n                                    bot += ker;\n                                }\n                            }\n                            else\n                                top += val * ker;\n                        }}\n                    }}\n                }}\n\n                if (embed_result_within_padded_region) { // compile time constant\n                    result_index = array_cursor + k;\n                } else {\n                    result_index = (i_minus_wkx*ny_minus_2wky + j_minus_wky)*nz_minus_2wkz + k_minus_wkz;\n                }\n\n                if (nan_interpolate) // compile time constant\n                {\n                    if (bot == 0) // This should prob be np.isclose(kernel_sum, 0, atol=normalization_zero_tol)\n                        result[result_index]  = f[array_cursor+ k] ;\n                    else\n                        result[result_index]  = top / bot;\n                }\n                else\n                    result[result_index] = top;\n            }}\n        }}\n    }}\n#ifdef _OPENMP\n    }//end parallel scope\n#endif\n}\n"},{"attributeType":"null","col":16,"comment":"null","endLoc":5,"id":14677,"name":"np","nodeType":"Attribute","startLoc":5,"text":"np"},{"attributeType":"null","col":4,"comment":"null","endLoc":42,"id":14678,"name":"_is_bool","nodeType":"Attribute","startLoc":42,"text":"_is_bool"},{"attributeType":"null","col":29,"comment":"null","endLoc":6,"id":14679,"name":"u","nodeType":"Attribute","startLoc":6,"text":"u"},{"attributeType":"null","col":4,"comment":"null","endLoc":43,"id":14680,"name":"_model","nodeType":"Attribute","startLoc":43,"text":"_model"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":14681,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"downsample.py#<anonymous>","id":14682,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['aggregate_downsample']"},{"attributeType":"null","col":8,"comment":"null","endLoc":46,"id":14683,"name":"_array","nodeType":"Attribute","startLoc":46,"text":"self._array"},{"attributeType":"null","col":8,"comment":"null","endLoc":114,"id":14684,"name":"_kernel_sum","nodeType":"Attribute","startLoc":114,"text":"self._kernel_sum"},{"col":0,"comment":"\n    Find optimal or good sizes to pad an array of ``shape`` to for better\n    performance with `numpy.fft.*fft` and `scipy.fft.*fft`.\n    Calculated directly with `scipy.fft.next_fast_len`, if available; otherwise\n    looked up from list and scaled by powers of 10, if necessary.\n    ","endLoc":102,"header":"def _next_fast_lengths(shape)","id":14685,"name":"_next_fast_lengths","nodeType":"Function","startLoc":78,"text":"def _next_fast_lengths(shape):\n    \"\"\"\n    Find optimal or good sizes to pad an array of ``shape`` to for better\n    performance with `numpy.fft.*fft` and `scipy.fft.*fft`.\n    Calculated directly with `scipy.fft.next_fast_len`, if available; otherwise\n    looked up from list and scaled by powers of 10, if necessary.\n    \"\"\"\n\n    try:\n        import scipy.fft\n        return np.array([scipy.fft.next_fast_len(j) for j in shape])\n    except ImportError:\n        pass\n\n    newshape = np.empty(len(np.atleast_1d(shape)), dtype=int)\n    for i, j in enumerate(shape):\n        scale = 10 ** max(int(np.ceil(np.log10(j))) - _good_range, 0)\n        for n in _good_sizes:\n            if n * scale >= j:\n                newshape[i] = n * scale\n                break\n        else:\n            raise ValueError(f'No next fast length for {j} found in list of _good_sizes '\n                             f'<= {_good_sizes[-1] * scale}.')\n    return newshape"},{"col":4,"comment":"null","endLoc":91,"header":"def __init__(self, stddev, **kwargs)","id":14686,"name":"__init__","nodeType":"Function","startLoc":86,"text":"def __init__(self, stddev, **kwargs):\n        self._model = models.Gaussian1D(1. / (np.sqrt(2 * np.pi) * stddev),\n                                        0, stddev)\n        self._default_size = _round_up_to_odd_integer(8 * stddev)\n        super().__init__(**kwargs)\n        self._truncation = np.abs(1. - self._array.sum())"},{"id":14687,"name":"astropy/convolution/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/convolution/tests","id":14688,"nodeType":"File","text":""},{"attributeType":"None","col":12,"comment":"null","endLoc":211,"id":14689,"name":"_nu_y","nodeType":"Attribute","startLoc":211,"text":"self._nu_y"},{"attributeType":"null","col":8,"comment":"null","endLoc":162,"id":14690,"name":"_Ogamma0","nodeType":"Attribute","startLoc":162,"text":"self._Ogamma0"},{"attributeType":"null","col":8,"comment":"null","endLoc":155,"id":14691,"name":"_hubble_time","nodeType":"Attribute","startLoc":155,"text":"self._hubble_time"},{"attributeType":"null","col":12,"comment":"null","endLoc":193,"id":14692,"name":"_nmassivenu","nodeType":"Attribute","startLoc":193,"text":"self._nmassivenu"},{"attributeType":"None","col":8,"comment":"null","endLoc":146,"id":14693,"name":"_Odm0","nodeType":"Attribute","startLoc":146,"text":"self._Odm0"},{"id":14694,"name":"astropy/coordinates","nodeType":"Package"},{"fileName":"orbital_elements.py","filePath":"astropy/coordinates","id":14695,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module contains convenience functions implementing some of the\nalgorithms contained within Jean Meeus, 'Astronomical Algorithms',\nsecond edition, 1998, Willmann-Bell.\n\"\"\"\n\nimport numpy as np\nfrom numpy.polynomial.polynomial import polyval\nimport erfa\n\nfrom astropy.utils import deprecated\n\nfrom astropy import units as u\nfrom . import ICRS, SkyCoord, GeocentricTrueEcliptic\nfrom .builtin_frames.utils import get_jd12\n\n__all__ = [\"calc_moon\"]\n\n# Meeus 1998: table 47.A\n#   D   M   M'  F   l    r\n_MOON_L_R = (\n    (0, 0, 1, 0, 6288774, -20905355),\n    (2, 0, -1, 0, 1274027, -3699111),\n    (2, 0, 0, 0, 658314, -2955968),\n    (0, 0, 2, 0, 213618, -569925),\n    (0, 1, 0, 0, -185116, 48888),\n    (0, 0, 0, 2, -114332, -3149),\n    (2, 0, -2, 0, 58793, 246158),\n    (2, -1, -1, 0, 57066, -152138),\n    (2, 0, 1, 0, 53322, -170733),\n    (2, -1, 0, 0, 45758, -204586),\n    (0, 1, -1, 0, -40923, -129620),\n    (1, 0, 0, 0, -34720, 108743),\n    (0, 1, 1, 0, -30383, 104755),\n    (2, 0, 0, -2, 15327, 10321),\n    (0, 0, 1, 2, -12528, 0),\n    (0, 0, 1, -2, 10980, 79661),\n    (4, 0, -1, 0, 10675, -34782),\n    (0, 0, 3, 0, 10034, -23210),\n    (4, 0, -2, 0, 8548, -21636),\n    (2, 1, -1, 0, -7888, 24208),\n    (2, 1, 0, 0, -6766, 30824),\n    (1, 0, -1, 0, -5163, -8379),\n    (1, 1, 0, 0, 4987, -16675),\n    (2, -1, 1, 0, 4036, -12831),\n    (2, 0, 2, 0, 3994, -10445),\n    (4, 0, 0, 0, 3861, -11650),\n    (2, 0, -3, 0, 3665, 14403),\n    (0, 1, -2, 0, -2689, -7003),\n    (2, 0, -1, 2, -2602, 0),\n    (2, -1, -2, 0, 2390, 10056),\n    (1, 0, 1, 0, -2348, 6322),\n    (2, -2, 0, 0, 2236, -9884),\n    (0, 1, 2, 0, -2120, 5751),\n    (0, 2, 0, 0, -2069, 0),\n    (2, -2, -1, 0, 2048, -4950),\n    (2, 0, 1, -2, -1773, 4130),\n    (2, 0, 0, 2, -1595, 0),\n    (4, -1, -1, 0, 1215, -3958),\n    (0, 0, 2, 2, -1110, 0),\n    (3, 0, -1, 0, -892, 3258),\n    (2, 1, 1, 0, -810, 2616),\n    (4, -1, -2, 0, 759, -1897),\n    (0, 2, -1, 0, -713, -2117),\n    (2, 2, -1, 0, -700, 2354),\n    (2, 1, -2, 0, 691, 0),\n    (2, -1, 0, -2, 596, 0),\n    (4, 0, 1, 0, 549, -1423),\n    (0, 0, 4, 0, 537, -1117),\n    (4, -1, 0, 0, 520, -1571),\n    (1, 0, -2, 0, -487, -1739),\n    (2, 1, 0, -2, -399, 0),\n    (0, 0, 2, -2, -381, -4421),\n    (1, 1, 1, 0, 351, 0),\n    (3, 0, -2, 0, -340, 0),\n    (4, 0, -3, 0, 330, 0),\n    (2, -1, 2, 0, 327, 0),\n    (0, 2, 1, 0, -323, 1165),\n    (1, 1, -1, 0, 299, 0),\n    (2, 0, 3, 0, 294, 0),\n    (2, 0, -1, -2, 0, 8752)\n)\n\n# Meeus 1998: table 47.B\n#   D   M   M'  F   b\n_MOON_B = (\n    (0, 0, 0, 1, 5128122),\n    (0, 0, 1, 1, 280602),\n    (0, 0, 1, -1, 277693),\n    (2, 0, 0, -1, 173237),\n    (2, 0, -1, 1, 55413),\n    (2, 0, -1, -1, 46271),\n    (2, 0, 0, 1, 32573),\n    (0, 0, 2, 1, 17198),\n    (2, 0, 1, -1, 9266),\n    (0, 0, 2, -1, 8822),\n    (2, -1, 0, -1, 8216),\n    (2, 0, -2, -1, 4324),\n    (2, 0, 1, 1, 4200),\n    (2, 1, 0, -1, -3359),\n    (2, -1, -1, 1, 2463),\n    (2, -1, 0, 1, 2211),\n    (2, -1, -1, -1, 2065),\n    (0, 1, -1, -1, -1870),\n    (4, 0, -1, -1, 1828),\n    (0, 1, 0, 1, -1794),\n    (0, 0, 0, 3, -1749),\n    (0, 1, -1, 1, -1565),\n    (1, 0, 0, 1, -1491),\n    (0, 1, 1, 1, -1475),\n    (0, 1, 1, -1, -1410),\n    (0, 1, 0, -1, -1344),\n    (1, 0, 0, -1, -1335),\n    (0, 0, 3, 1, 1107),\n    (4, 0, 0, -1, 1021),\n    (4, 0, -1, 1, 833),\n    # second column\n    (0, 0, 1, -3, 777),\n    (4, 0, -2, 1, 671),\n    (2, 0, 0, -3, 607),\n    (2, 0, 2, -1, 596),\n    (2, -1, 1, -1, 491),\n    (2, 0, -2, 1, -451),\n    (0, 0, 3, -1, 439),\n    (2, 0, 2, 1, 422),\n    (2, 0, -3, -1, 421),\n    (2, 1, -1, 1, -366),\n    (2, 1, 0, 1, -351),\n    (4, 0, 0, 1, 331),\n    (2, -1, 1, 1, 315),\n    (2, -2, 0, -1, 302),\n    (0, 0, 1, 3, -283),\n    (2, 1, 1, -1, -229),\n    (1, 1, 0, -1, 223),\n    (1, 1, 0, 1, 223),\n    (0, 1, -2, -1, -220),\n    (2, 1, -1, -1, -220),\n    (1, 0, 1, 1, -185),\n    (2, -1, -2, -1, 181),\n    (0, 1, 2, 1, -177),\n    (4, 0, -2, -1, 176),\n    (4, -1, -1, -1, 166),\n    (1, 0, 1, -1, -164),\n    (4, 0, 1, -1, 132),\n    (1, 0, -1, -1, -119),\n    (4, -1, 0, -1, 115),\n    (2, -2, 0, 1, 107)\n)\n\n\"\"\"\nCoefficients of polynomials for various terms:\n\nLc : Mean longitude of Moon, w.r.t mean Equinox of date\nD : Mean elongation of the Moon\nM: Sun's mean anomaly\nMc : Moon's mean anomaly\nF : Moon's argument of latitude (mean distance of Moon from its ascending node).\n\"\"\"\n_coLc = (2.18316448e+02, 4.81267881e+05, -1.57860000e-03,\n         1.85583502e-06, -1.53388349e-08)\n_coD = (2.97850192e+02, 4.45267111e+05, -1.88190000e-03,\n        1.83194472e-06, -8.84447000e-09)\n_coM = (3.57529109e+02, 3.59990503e+04, -1.53600000e-04,\n        4.08329931e-08)\n_coMc = (1.34963396e+02, 4.77198868e+05, 8.74140000e-03,\n         1.43474081e-05, -6.79717238e-08)\n_coF = (9.32720950e+01, 4.83202018e+05, -3.65390000e-03,\n        -2.83607487e-07, 1.15833246e-09)\n_coA1 = (119.75, 131.849)\n_coA2 = (53.09, 479264.290)\n_coA3 = (313.45, 481266.484)\n_coE = (1.0, -0.002516, -0.0000074)\n\n\n@deprecated(since=\"5.0\",\n            alternative=\"astropy.coordinates.get_moon\",\n            message=(\"The private calc_moon function has been deprecated, \"\n                     \"as its functionality is now available in ERFA. \"\n                     \"Note that the coordinate system was not interpreted \"\n                     \"quite correctly, leading to small inaccuracies. Please \"\n                     \"use the public get_moon or get_body functions instead.\"))\ndef calc_moon(t):\n    \"\"\"\n    Lunar position model ELP2000-82 of (Chapront-Touze' and Chapront, 1983, 124, 50)\n\n    This is the simplified version of Jean Meeus, Astronomical Algorithms,\n    second edition, 1998, Willmann-Bell. Meeus claims approximate accuracy of 10\"\n    in longitude and 4\" in latitude, with no specified time range.\n\n    Tests against JPL ephemerides show accuracy of 10 arcseconds and 50 km over the\n    date range CE 1950-2050.\n\n    Parameters\n    ----------\n    t : `~astropy.time.Time`\n        Time of observation.\n\n    Returns\n    -------\n    skycoord : `~astropy.coordinates.SkyCoord`\n        ICRS Coordinate for the body\n    \"\"\"\n    # number of centuries since J2000.0.\n    # This should strictly speaking be in Ephemeris Time, but TDB or TT\n    # will introduce error smaller than intrinsic accuracy of algorithm.\n    T = (t.tdb.jyear-2000.0)/100.\n\n    # constants that are needed for all calculations\n    Lc = u.Quantity(polyval(T, _coLc), u.deg)\n    D = u.Quantity(polyval(T, _coD), u.deg)\n    M = u.Quantity(polyval(T, _coM), u.deg)\n    Mc = u.Quantity(polyval(T, _coMc), u.deg)\n    F = u.Quantity(polyval(T, _coF), u.deg)\n\n    A1 = u.Quantity(polyval(T, _coA1), u.deg)\n    A2 = u.Quantity(polyval(T, _coA2), u.deg)\n    A3 = u.Quantity(polyval(T, _coA3), u.deg)\n    E = polyval(T, _coE)\n\n    suml = sumr = 0.0\n    for DNum, MNum, McNum, FNum, LFac, RFac in _MOON_L_R:\n        corr = E ** abs(MNum)\n        suml += LFac*corr*np.sin(D*DNum+M*MNum+Mc*McNum+F*FNum)\n        sumr += RFac*corr*np.cos(D*DNum+M*MNum+Mc*McNum+F*FNum)\n\n    sumb = 0.0\n    for DNum, MNum, McNum, FNum, BFac in _MOON_B:\n        corr = E ** abs(MNum)\n        sumb += BFac*corr*np.sin(D*DNum+M*MNum+Mc*McNum+F*FNum)\n\n    suml += (3958*np.sin(A1) + 1962*np.sin(Lc-F) + 318*np.sin(A2))\n    sumb += (-2235*np.sin(Lc) + 382*np.sin(A3) + 175*np.sin(A1-F) +\n             175*np.sin(A1+F) + 127*np.sin(Lc-Mc) - 115*np.sin(Lc+Mc))\n\n    # ensure units\n    suml = suml*u.microdegree\n    sumb = sumb*u.microdegree\n\n    # nutation of longitude\n    jd1, jd2 = get_jd12(t, 'tt')\n    nut, _ = erfa.nut06a(jd1, jd2)\n    nut = nut*u.rad\n\n    # calculate ecliptic coordinates\n    lon = Lc + suml + nut\n    lat = sumb\n    dist = (385000.56+sumr/1000)*u.km\n\n    # Meeus algorithm gives GeocentricTrueEcliptic coordinates\n    ecliptic_coo = GeocentricTrueEcliptic(lon, lat, distance=dist,\n                                          obstime=t, equinox=t)\n\n    return SkyCoord(ecliptic_coo.transform_to(ICRS()))\n"},{"col":0,"comment":"\n    Convolve an ndarray with an nd-kernel.  Returns a convolved image with\n    ``shape = array.shape``.  Assumes kernel is centered.\n\n    `convolve_fft` is very similar to `convolve` in that it replaces ``NaN``\n    values in the original image with interpolated values using the kernel as\n    an interpolation function.  However, it also includes many additional\n    options specific to the implementation.\n\n    `convolve_fft` differs from `scipy.signal.fftconvolve` in a few ways:\n\n    * It can treat ``NaN`` values as zeros or interpolate over them.\n    * ``inf`` values are treated as ``NaN``\n    * It optionally pads to the nearest faster sizes to improve FFT speed.\n      These sizes are optimized for the numpy and scipy implementations, and\n      ``fftconvolve`` uses them by default as well; when using other external\n      functions (see below), results may vary.\n    * Its only valid ``mode`` is 'same' (i.e., the same shape array is returned)\n    * It lets you use your own fft, e.g.,\n      `pyFFTW <https://pypi.org/project/pyFFTW/>`_ or\n      `pyFFTW3 <https://pypi.org/project/PyFFTW3/0.2.1/>`_ , which can lead to\n      performance improvements, depending on your system configuration.  pyFFTW3\n      is threaded, and therefore may yield significant performance benefits on\n      multi-core machines at the cost of greater memory requirements.  Specify\n      the ``fftn`` and ``ifftn`` keywords to override the default, which is\n      `numpy.fft.fftn` and `numpy.fft.ifftn`.  The `scipy.fft` functions also\n      offer somewhat better performance and a multi-threaded option.\n\n    Parameters\n    ----------\n    array : `numpy.ndarray`\n        Array to be convolved with ``kernel``.  It can be of any\n        dimensionality, though only 1, 2, and 3d arrays have been tested.\n    kernel : `numpy.ndarray` or `astropy.convolution.Kernel`\n        The convolution kernel. The number of dimensions should match those\n        for the array.  The dimensions *do not* have to be odd in all directions,\n        unlike in the non-fft `convolve` function.  The kernel will be\n        normalized if ``normalize_kernel`` is set.  It is assumed to be centered\n        (i.e., shifts may result if your kernel is asymmetric)\n    boundary : {'fill', 'wrap'}, optional\n        A flag indicating how to handle boundaries:\n\n            * 'fill': set values outside the array boundary to fill_value\n              (default)\n            * 'wrap': periodic boundary\n\n        The `None` and 'extend' parameters are not supported for FFT-based\n        convolution.\n    fill_value : float, optional\n        The value to use outside the array when using boundary='fill'.\n    nan_treatment : {'interpolate', 'fill'}, optional\n        The method used to handle NaNs in the input ``array``:\n            * ``'interpolate'``: ``NaN`` values are replaced with\n              interpolated values using the kernel as an interpolation\n              function. Note that if the kernel has a sum equal to\n              zero, NaN interpolation is not possible and will raise an\n              exception.\n            * ``'fill'``: ``NaN`` values are replaced by ``fill_value``\n              prior to convolution.\n    normalize_kernel : callable or boolean, optional\n        If specified, this is the function to divide kernel by to normalize it.\n        e.g., ``normalize_kernel=np.sum`` means that kernel will be modified to be:\n        ``kernel = kernel / np.sum(kernel)``.  If True, defaults to\n        ``normalize_kernel = np.sum``.\n    normalization_zero_tol : float, optional\n        The absolute tolerance on whether the kernel is different than zero.\n        If the kernel sums to zero to within this precision, it cannot be\n        normalized. Default is \"1e-8\".\n    preserve_nan : bool, optional\n        After performing convolution, should pixels that were originally NaN\n        again become NaN?\n    mask : None or ndarray, optional\n        A \"mask\" array.  Shape must match ``array``, and anything that is masked\n        (i.e., not 0/`False`) will be set to NaN for the convolution.  If\n        `None`, no masking will be performed unless ``array`` is a masked array.\n        If ``mask`` is not `None` *and* ``array`` is a masked array, a pixel is\n        masked of it is masked in either ``mask`` *or* ``array.mask``.\n    crop : bool, optional\n        Default on.  Return an image of the size of the larger of the input\n        image and the kernel.\n        If the image and kernel are asymmetric in opposite directions, will\n        return the largest image in both directions.\n        For example, if an input image has shape [100,3] but a kernel with shape\n        [6,6] is used, the output will be [100,6].\n    return_fft : bool, optional\n        Return the ``fft(image)*fft(kernel)`` instead of the convolution (which is\n        ``ifft(fft(image)*fft(kernel))``).  Useful for making PSDs.\n    fft_pad : bool, optional\n        Default on.  Zero-pad image to the nearest size supporting more efficient\n        execution of the FFT, generally values factorizable into the first 3-5\n        prime numbers.  With ``boundary='wrap'``, this will be disabled.\n    psf_pad : bool, optional\n        Zero-pad image to be at least the sum of the image sizes to avoid\n        edge-wrapping when smoothing.  This is enabled by default with\n        ``boundary='fill'``, but it can be overridden with a boolean option.\n        ``boundary='wrap'`` and ``psf_pad=True`` are not compatible.\n    min_wt : float, optional\n        If ignoring ``NaN`` / zeros, force all grid points with a weight less than\n        this value to ``NaN`` (the weight of a grid point with *no* ignored\n        neighbors is 1.0).\n        If ``min_wt`` is zero, then all zero-weight points will be set to zero\n        instead of ``NaN`` (which they would be otherwise, because 1/0 = nan).\n        See the examples below.\n    allow_huge : bool, optional\n        Allow huge arrays in the FFT?  If False, will raise an exception if the\n        array or kernel size is >1 GB.\n    fftn : callable, optional\n        The fft function.  Can be overridden to use your own ffts,\n        e.g. an fftw3 wrapper or scipy's fftn, ``fft=scipy.fftpack.fftn``.\n    ifftn : callable, optional\n        The inverse fft function. Can be overridden the same way ``fttn``.\n    complex_dtype : complex type, optional\n        Which complex dtype to use.  `numpy` has a range of options, from 64 to\n        256.\n    dealias: bool, optional\n        Default off. Zero-pad image to enable explicit dealiasing\n        of convolution. With ``boundary='wrap'``, this will be disabled.\n        Note that for an input of nd dimensions this will increase\n        the size of the temporary arrays by at least ``1.5**nd``.\n        This may result in significantly more memory usage.\n\n    Returns\n    -------\n    default : ndarray\n        ``array`` convolved with ``kernel``.  If ``return_fft`` is set, returns\n        ``fft(array) * fft(kernel)``.  If crop is not set, returns the\n        image, but with the fft-padded size instead of the input size.\n\n    Raises\n    ------\n    `ValueError`\n        If the array is bigger than 1 GB after padding, will raise this\n        exception unless ``allow_huge`` is True.\n\n    See Also\n    --------\n    convolve:\n        Convolve is a non-fft version of this code.  It is more memory\n        efficient and for small kernels can be faster.\n\n    Notes\n    -----\n    With ``psf_pad=True`` and a large PSF, the resulting data\n    can become large and consume a lot of memory. See Issue\n    https://github.com/astropy/astropy/pull/4366 and the update in\n    https://github.com/astropy/astropy/pull/11533 for further details.\n\n    Dealiasing of pseudospectral convolutions is necessary for\n    numerical stability of the underlying algorithms. A common\n    method for handling this is to zero pad the image by at least\n    1/2 to eliminate the wavenumbers which have been aliased\n    by convolution. This is so that the aliased 1/3 of the\n    results of the convolution computation can be thrown out. See\n    https://doi.org/10.1175/1520-0469(1971)028%3C1074:OTEOAI%3E2.0.CO;2\n    https://iopscience.iop.org/article/10.1088/1742-6596/318/7/072037\n\n    Note that if dealiasing is necessary to your application, but your\n    process is memory constrained, you may want to consider using\n    FFTW++: https://github.com/dealias/fftwpp. It includes python\n    wrappers for a pseudospectral convolution which will implicitly\n    dealias your convolution without the need for additional padding.\n    Note that one cannot use FFTW++'s convlution directly in this\n    method as in handles the entire convolution process internally.\n    Additionally, FFTW++ includes other useful pseudospectral methods to\n    consider.\n\n    Examples\n    --------\n    >>> convolve_fft([1, 0, 3], [1, 1, 1])\n    array([0.33333333, 1.33333333, 1.        ])\n\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1])\n    array([0.5, 2. , 1.5])\n\n    >>> convolve_fft([1, 0, 3], [0, 1, 0])  # doctest: +FLOAT_CMP\n    array([ 1.00000000e+00, -3.70074342e-17,  3.00000000e+00])\n\n    >>> convolve_fft([1, 2, 3], [1])\n    array([1., 2., 3.])\n\n    >>> convolve_fft([1, np.nan, 3], [0, 1, 0], nan_treatment='interpolate')\n    array([1., 0., 3.])\n\n    >>> convolve_fft([1, np.nan, 3], [0, 1, 0], nan_treatment='interpolate',\n    ...              min_wt=1e-8)\n    array([ 1., nan,  3.])\n\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate')\n    array([0.5, 2. , 1.5])\n\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate',\n    ...               normalize_kernel=True)\n    array([0.5, 2. , 1.5])\n\n    >>> import scipy.fft  # optional - requires scipy\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate',\n    ...               normalize_kernel=True,\n    ...               fftn=scipy.fft.fftn, ifftn=scipy.fft.ifftn)\n    array([0.5, 2. , 1.5])\n\n    >>> fft_mp = lambda a: scipy.fft.fftn(a, workers=-1)  # use all available cores\n    >>> ifft_mp = lambda a: scipy.fft.ifftn(a, workers=-1)\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate',\n    ...               normalize_kernel=True, fftn=fft_mp, ifftn=ifft_mp)\n    array([0.5, 2. , 1.5])\n    ","endLoc":886,"header":"@support_nddata(data='array')\ndef convolve_fft(array, kernel, boundary='fill', fill_value=0.,\n                 nan_treatment='interpolate', normalize_kernel=True,\n                 normalization_zero_tol=1e-8,\n                 preserve_nan=False, mask=None, crop=True, return_fft=False,\n                 fft_pad=None, psf_pad=None, min_wt=0.0, allow_huge=False,\n                 fftn=np.fft.fftn, ifftn=np.fft.ifftn,\n                 complex_dtype=complex, dealias=False)","id":14696,"name":"convolve_fft","nodeType":"Function","startLoc":441,"text":"@support_nddata(data='array')\ndef convolve_fft(array, kernel, boundary='fill', fill_value=0.,\n                 nan_treatment='interpolate', normalize_kernel=True,\n                 normalization_zero_tol=1e-8,\n                 preserve_nan=False, mask=None, crop=True, return_fft=False,\n                 fft_pad=None, psf_pad=None, min_wt=0.0, allow_huge=False,\n                 fftn=np.fft.fftn, ifftn=np.fft.ifftn,\n                 complex_dtype=complex, dealias=False):\n    \"\"\"\n    Convolve an ndarray with an nd-kernel.  Returns a convolved image with\n    ``shape = array.shape``.  Assumes kernel is centered.\n\n    `convolve_fft` is very similar to `convolve` in that it replaces ``NaN``\n    values in the original image with interpolated values using the kernel as\n    an interpolation function.  However, it also includes many additional\n    options specific to the implementation.\n\n    `convolve_fft` differs from `scipy.signal.fftconvolve` in a few ways:\n\n    * It can treat ``NaN`` values as zeros or interpolate over them.\n    * ``inf`` values are treated as ``NaN``\n    * It optionally pads to the nearest faster sizes to improve FFT speed.\n      These sizes are optimized for the numpy and scipy implementations, and\n      ``fftconvolve`` uses them by default as well; when using other external\n      functions (see below), results may vary.\n    * Its only valid ``mode`` is 'same' (i.e., the same shape array is returned)\n    * It lets you use your own fft, e.g.,\n      `pyFFTW <https://pypi.org/project/pyFFTW/>`_ or\n      `pyFFTW3 <https://pypi.org/project/PyFFTW3/0.2.1/>`_ , which can lead to\n      performance improvements, depending on your system configuration.  pyFFTW3\n      is threaded, and therefore may yield significant performance benefits on\n      multi-core machines at the cost of greater memory requirements.  Specify\n      the ``fftn`` and ``ifftn`` keywords to override the default, which is\n      `numpy.fft.fftn` and `numpy.fft.ifftn`.  The `scipy.fft` functions also\n      offer somewhat better performance and a multi-threaded option.\n\n    Parameters\n    ----------\n    array : `numpy.ndarray`\n        Array to be convolved with ``kernel``.  It can be of any\n        dimensionality, though only 1, 2, and 3d arrays have been tested.\n    kernel : `numpy.ndarray` or `astropy.convolution.Kernel`\n        The convolution kernel. The number of dimensions should match those\n        for the array.  The dimensions *do not* have to be odd in all directions,\n        unlike in the non-fft `convolve` function.  The kernel will be\n        normalized if ``normalize_kernel`` is set.  It is assumed to be centered\n        (i.e., shifts may result if your kernel is asymmetric)\n    boundary : {'fill', 'wrap'}, optional\n        A flag indicating how to handle boundaries:\n\n            * 'fill': set values outside the array boundary to fill_value\n              (default)\n            * 'wrap': periodic boundary\n\n        The `None` and 'extend' parameters are not supported for FFT-based\n        convolution.\n    fill_value : float, optional\n        The value to use outside the array when using boundary='fill'.\n    nan_treatment : {'interpolate', 'fill'}, optional\n        The method used to handle NaNs in the input ``array``:\n            * ``'interpolate'``: ``NaN`` values are replaced with\n              interpolated values using the kernel as an interpolation\n              function. Note that if the kernel has a sum equal to\n              zero, NaN interpolation is not possible and will raise an\n              exception.\n            * ``'fill'``: ``NaN`` values are replaced by ``fill_value``\n              prior to convolution.\n    normalize_kernel : callable or boolean, optional\n        If specified, this is the function to divide kernel by to normalize it.\n        e.g., ``normalize_kernel=np.sum`` means that kernel will be modified to be:\n        ``kernel = kernel / np.sum(kernel)``.  If True, defaults to\n        ``normalize_kernel = np.sum``.\n    normalization_zero_tol : float, optional\n        The absolute tolerance on whether the kernel is different than zero.\n        If the kernel sums to zero to within this precision, it cannot be\n        normalized. Default is \"1e-8\".\n    preserve_nan : bool, optional\n        After performing convolution, should pixels that were originally NaN\n        again become NaN?\n    mask : None or ndarray, optional\n        A \"mask\" array.  Shape must match ``array``, and anything that is masked\n        (i.e., not 0/`False`) will be set to NaN for the convolution.  If\n        `None`, no masking will be performed unless ``array`` is a masked array.\n        If ``mask`` is not `None` *and* ``array`` is a masked array, a pixel is\n        masked of it is masked in either ``mask`` *or* ``array.mask``.\n    crop : bool, optional\n        Default on.  Return an image of the size of the larger of the input\n        image and the kernel.\n        If the image and kernel are asymmetric in opposite directions, will\n        return the largest image in both directions.\n        For example, if an input image has shape [100,3] but a kernel with shape\n        [6,6] is used, the output will be [100,6].\n    return_fft : bool, optional\n        Return the ``fft(image)*fft(kernel)`` instead of the convolution (which is\n        ``ifft(fft(image)*fft(kernel))``).  Useful for making PSDs.\n    fft_pad : bool, optional\n        Default on.  Zero-pad image to the nearest size supporting more efficient\n        execution of the FFT, generally values factorizable into the first 3-5\n        prime numbers.  With ``boundary='wrap'``, this will be disabled.\n    psf_pad : bool, optional\n        Zero-pad image to be at least the sum of the image sizes to avoid\n        edge-wrapping when smoothing.  This is enabled by default with\n        ``boundary='fill'``, but it can be overridden with a boolean option.\n        ``boundary='wrap'`` and ``psf_pad=True`` are not compatible.\n    min_wt : float, optional\n        If ignoring ``NaN`` / zeros, force all grid points with a weight less than\n        this value to ``NaN`` (the weight of a grid point with *no* ignored\n        neighbors is 1.0).\n        If ``min_wt`` is zero, then all zero-weight points will be set to zero\n        instead of ``NaN`` (which they would be otherwise, because 1/0 = nan).\n        See the examples below.\n    allow_huge : bool, optional\n        Allow huge arrays in the FFT?  If False, will raise an exception if the\n        array or kernel size is >1 GB.\n    fftn : callable, optional\n        The fft function.  Can be overridden to use your own ffts,\n        e.g. an fftw3 wrapper or scipy's fftn, ``fft=scipy.fftpack.fftn``.\n    ifftn : callable, optional\n        The inverse fft function. Can be overridden the same way ``fttn``.\n    complex_dtype : complex type, optional\n        Which complex dtype to use.  `numpy` has a range of options, from 64 to\n        256.\n    dealias: bool, optional\n        Default off. Zero-pad image to enable explicit dealiasing\n        of convolution. With ``boundary='wrap'``, this will be disabled.\n        Note that for an input of nd dimensions this will increase\n        the size of the temporary arrays by at least ``1.5**nd``.\n        This may result in significantly more memory usage.\n\n    Returns\n    -------\n    default : ndarray\n        ``array`` convolved with ``kernel``.  If ``return_fft`` is set, returns\n        ``fft(array) * fft(kernel)``.  If crop is not set, returns the\n        image, but with the fft-padded size instead of the input size.\n\n    Raises\n    ------\n    `ValueError`\n        If the array is bigger than 1 GB after padding, will raise this\n        exception unless ``allow_huge`` is True.\n\n    See Also\n    --------\n    convolve:\n        Convolve is a non-fft version of this code.  It is more memory\n        efficient and for small kernels can be faster.\n\n    Notes\n    -----\n    With ``psf_pad=True`` and a large PSF, the resulting data\n    can become large and consume a lot of memory. See Issue\n    https://github.com/astropy/astropy/pull/4366 and the update in\n    https://github.com/astropy/astropy/pull/11533 for further details.\n\n    Dealiasing of pseudospectral convolutions is necessary for\n    numerical stability of the underlying algorithms. A common\n    method for handling this is to zero pad the image by at least\n    1/2 to eliminate the wavenumbers which have been aliased\n    by convolution. This is so that the aliased 1/3 of the\n    results of the convolution computation can be thrown out. See\n    https://doi.org/10.1175/1520-0469(1971)028%3C1074:OTEOAI%3E2.0.CO;2\n    https://iopscience.iop.org/article/10.1088/1742-6596/318/7/072037\n\n    Note that if dealiasing is necessary to your application, but your\n    process is memory constrained, you may want to consider using\n    FFTW++: https://github.com/dealias/fftwpp. It includes python\n    wrappers for a pseudospectral convolution which will implicitly\n    dealias your convolution without the need for additional padding.\n    Note that one cannot use FFTW++'s convlution directly in this\n    method as in handles the entire convolution process internally.\n    Additionally, FFTW++ includes other useful pseudospectral methods to\n    consider.\n\n    Examples\n    --------\n    >>> convolve_fft([1, 0, 3], [1, 1, 1])\n    array([0.33333333, 1.33333333, 1.        ])\n\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1])\n    array([0.5, 2. , 1.5])\n\n    >>> convolve_fft([1, 0, 3], [0, 1, 0])  # doctest: +FLOAT_CMP\n    array([ 1.00000000e+00, -3.70074342e-17,  3.00000000e+00])\n\n    >>> convolve_fft([1, 2, 3], [1])\n    array([1., 2., 3.])\n\n    >>> convolve_fft([1, np.nan, 3], [0, 1, 0], nan_treatment='interpolate')\n    array([1., 0., 3.])\n\n    >>> convolve_fft([1, np.nan, 3], [0, 1, 0], nan_treatment='interpolate',\n    ...              min_wt=1e-8)\n    array([ 1., nan,  3.])\n\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate')\n    array([0.5, 2. , 1.5])\n\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate',\n    ...               normalize_kernel=True)\n    array([0.5, 2. , 1.5])\n\n    >>> import scipy.fft  # optional - requires scipy\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate',\n    ...               normalize_kernel=True,\n    ...               fftn=scipy.fft.fftn, ifftn=scipy.fft.ifftn)\n    array([0.5, 2. , 1.5])\n\n    >>> fft_mp = lambda a: scipy.fft.fftn(a, workers=-1)  # use all available cores\n    >>> ifft_mp = lambda a: scipy.fft.ifftn(a, workers=-1)\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate',\n    ...               normalize_kernel=True, fftn=fft_mp, ifftn=ifft_mp)\n    array([0.5, 2. , 1.5])\n    \"\"\"\n    # Checking copied from convolve.py - however, since FFTs have real &\n    # complex components, we change the types.  Only the real part will be\n    # returned! Note that this always makes a copy.\n\n    # Check kernel is kernel instance\n    if isinstance(kernel, Kernel):\n        kernel = kernel.array\n        if isinstance(array, Kernel):\n            raise TypeError(\"Can't convolve two kernels with convolve_fft.  Use convolve instead.\")\n\n    if nan_treatment not in ('interpolate', 'fill'):\n        raise ValueError(\"nan_treatment must be one of 'interpolate','fill'\")\n\n    # Get array quantity if it exists\n    array_unit = getattr(array, \"unit\", None)\n\n    # Convert array dtype to complex\n    # and ensure that list inputs become arrays\n    array = _copy_input_if_needed(array, dtype=complex, order='C',\n                                  nan_treatment=nan_treatment, mask=mask,\n                                  fill_value=np.nan)\n    kernel = _copy_input_if_needed(kernel, dtype=complex, order='C',\n                                   nan_treatment=None, mask=None,\n                                   fill_value=0)\n\n    # Check that the number of dimensions is compatible\n    if array.ndim != kernel.ndim:\n        raise ValueError(\"Image and kernel must have same number of dimensions\")\n\n    arrayshape = array.shape\n    kernshape = kernel.shape\n\n    array_size_B = (np.product(arrayshape, dtype=np.int64) *\n                    np.dtype(complex_dtype).itemsize) * u.byte\n    if array_size_B > 1 * u.GB and not allow_huge:\n        raise ValueError(f\"Size Error: Arrays will be {human_file_size(array_size_B)}.  \"\n                         f\"Use allow_huge=True to override this exception.\")\n\n    # NaN and inf catching\n    nanmaskarray = np.isnan(array) | np.isinf(array)\n    if nan_treatment == 'fill':\n        array[nanmaskarray] = fill_value\n    else:\n        array[nanmaskarray] = 0\n    nanmaskkernel = np.isnan(kernel) | np.isinf(kernel)\n    kernel[nanmaskkernel] = 0\n\n    if normalize_kernel is True:\n        if kernel.sum() < 1. / MAX_NORMALIZATION:\n            raise Exception(\"The kernel can't be normalized, because its sum is \"\n                            \"close to zero. The sum of the given kernel is < {}\"\n                            .format(1. / MAX_NORMALIZATION))\n        kernel_scale = kernel.sum()\n        normalized_kernel = kernel / kernel_scale\n        kernel_scale = 1  # if we want to normalize it, leave it normed!\n    elif normalize_kernel:\n        # try this.  If a function is not passed, the code will just crash... I\n        # think type checking would be better but PEPs say otherwise...\n        kernel_scale = normalize_kernel(kernel)\n        normalized_kernel = kernel / kernel_scale\n    else:\n        kernel_scale = kernel.sum()\n        if np.abs(kernel_scale) < normalization_zero_tol:\n            if nan_treatment == 'interpolate':\n                raise ValueError('Cannot interpolate NaNs with an unnormalizable kernel')\n            else:\n                # the kernel's sum is near-zero, so it can't be scaled\n                kernel_scale = 1\n                normalized_kernel = kernel\n        else:\n            # the kernel is normalizable; we'll temporarily normalize it\n            # now and undo the normalization later.\n            normalized_kernel = kernel / kernel_scale\n\n    if boundary is None:\n        warnings.warn(\"The convolve_fft version of boundary=None is \"\n                      \"equivalent to the convolve boundary='fill'.  There is \"\n                      \"no FFT equivalent to convolve's \"\n                      \"zero-if-kernel-leaves-boundary\", AstropyUserWarning)\n        if psf_pad is None:\n            psf_pad = True\n        if fft_pad is None:\n            fft_pad = True\n    elif boundary == 'fill':\n        # create a boundary region at least as large as the kernel\n        if psf_pad is False:\n            warnings.warn(f\"psf_pad was set to {psf_pad}, which overrides the \"\n                          f\"boundary='fill' setting.\", AstropyUserWarning)\n        else:\n            psf_pad = True\n        if fft_pad is None:\n            # default is 'True' according to the docstring\n            fft_pad = True\n    elif boundary == 'wrap':\n        if psf_pad:\n            raise ValueError(\"With boundary='wrap', psf_pad cannot be enabled.\")\n        psf_pad = False\n        if fft_pad:\n            raise ValueError(\"With boundary='wrap', fft_pad cannot be enabled.\")\n        fft_pad = False\n        if dealias:\n            raise ValueError(\"With boundary='wrap', dealias cannot be enabled.\")\n        fill_value = 0  # force zero; it should not be used\n    elif boundary == 'extend':\n        raise NotImplementedError(\"The 'extend' option is not implemented \"\n                                  \"for fft-based convolution\")\n\n    # Add shapes elementwise for psf_pad.\n    if psf_pad:  # default=False\n        # add the sizes along each dimension (bigger)\n        newshape = np.array(arrayshape) + np.array(kernshape)\n    else:\n        # take the larger shape in each dimension (smaller)\n        newshape = np.maximum(arrayshape, kernshape)\n\n    if dealias:\n        # Extend shape by 1/2 for dealiasing\n        newshape += np.ceil(newshape / 2).astype(int)\n\n    # Find ideal size for fft (was power of 2, now any powers of prime factors 2, 3, 5).\n    if fft_pad:  # default=True\n        # Get optimized sizes from scipy.\n        newshape = _next_fast_lengths(newshape)\n\n    # perform a second check after padding\n    array_size_C = (np.product(newshape, dtype=np.int64) *\n                    np.dtype(complex_dtype).itemsize) * u.byte\n    if array_size_C > 1 * u.GB and not allow_huge:\n        raise ValueError(f\"Size Error: Arrays will be {human_file_size(array_size_C)}.  \"\n                         f\"Use allow_huge=True to override this exception.\")\n\n    # For future reference, this can be used to predict \"almost exactly\"\n    # how much *additional* memory will be used.\n    # size * (array + kernel + kernelfft + arrayfft +\n    #         (kernel*array)fft +\n    #         optional(weight image + weight_fft + weight_ifft) +\n    #         optional(returned_fft))\n    # total_memory_used_GB = (np.product(newshape)*np.dtype(complex_dtype).itemsize\n    #                        * (5 + 3*((interpolate_nan or ) and kernel_is_normalized))\n    #                        + (1 + (not return_fft)) *\n    #                          np.product(arrayshape)*np.dtype(complex_dtype).itemsize\n    #                        + np.product(arrayshape)*np.dtype(bool).itemsize\n    #                        + np.product(kernshape)*np.dtype(bool).itemsize)\n    #                        ) / 1024.**3\n\n    # separate each dimension by the padding size...  this is to determine the\n    # appropriate slice size to get back to the input dimensions\n    arrayslices = []\n    kernslices = []\n    for ii, (newdimsize, arraydimsize, kerndimsize) in enumerate(zip(newshape, arrayshape, kernshape)):\n        center = newdimsize - (newdimsize + 1) // 2\n        arrayslices += [slice(center - arraydimsize // 2,\n                              center + (arraydimsize + 1) // 2)]\n        kernslices += [slice(center - kerndimsize // 2,\n                             center + (kerndimsize + 1) // 2)]\n    arrayslices = tuple(arrayslices)\n    kernslices = tuple(kernslices)\n\n    if not np.all(newshape == arrayshape):\n        if np.isfinite(fill_value):\n            bigarray = np.ones(newshape, dtype=complex_dtype) * fill_value\n        else:\n            bigarray = np.zeros(newshape, dtype=complex_dtype)\n        bigarray[arrayslices] = array\n    else:\n        bigarray = array\n\n    if not np.all(newshape == kernshape):\n        bigkernel = np.zeros(newshape, dtype=complex_dtype)\n        bigkernel[kernslices] = normalized_kernel\n    else:\n        bigkernel = normalized_kernel\n\n    arrayfft = fftn(bigarray)\n    # need to shift the kernel so that, e.g., [0,0,1,0] -> [1,0,0,0] = unity\n    kernfft = fftn(np.fft.ifftshift(bigkernel))\n    fftmult = arrayfft * kernfft\n\n    interpolate_nan = (nan_treatment == 'interpolate')\n    if interpolate_nan:\n        if not np.isfinite(fill_value):\n            bigimwt = np.zeros(newshape, dtype=complex_dtype)\n        else:\n            bigimwt = np.ones(newshape, dtype=complex_dtype)\n\n        bigimwt[arrayslices] = 1.0 - nanmaskarray * interpolate_nan\n        wtfft = fftn(bigimwt)\n\n        # You can only get to this point if kernel_is_normalized\n        wtfftmult = wtfft * kernfft\n        wtsm = ifftn(wtfftmult)\n        # need to re-zero weights outside of the image (if it is padded, we\n        # still don't weight those regions)\n        bigimwt[arrayslices] = wtsm.real[arrayslices]\n    else:\n        bigimwt = 1\n\n    if np.isnan(fftmult).any():\n        # this check should be unnecessary; call it an insanity check\n        raise ValueError(\"Encountered NaNs in convolve.  This is disallowed.\")\n\n    fftmult *= kernel_scale\n\n    if array_unit is not None:\n        fftmult <<= array_unit\n\n    if return_fft:\n        return fftmult\n\n    if interpolate_nan:\n        with np.errstate(divide='ignore', invalid='ignore'):\n            # divide by zeros are expected here; if the weight is zero, we want\n            # the output to be nan or inf\n            rifft = (ifftn(fftmult)) / bigimwt\n        if not np.isscalar(bigimwt):\n            if min_wt > 0.:\n                rifft[bigimwt < min_wt] = np.nan\n            else:\n                # Set anything with no weight to zero (taking into account\n                # slight offsets due to floating-point errors).\n                rifft[bigimwt < 10 * np.finfo(bigimwt.dtype).eps] = 0.0\n    else:\n        rifft = ifftn(fftmult)\n\n    if preserve_nan:\n        rifft[arrayslices][nanmaskarray] = np.nan\n\n    if crop:\n        result = rifft[arrayslices].real\n        return result\n    else:\n        return rifft.real"},{"attributeType":"null","col":8,"comment":"null","endLoc":151,"id":14697,"name":"_hubble_distance","nodeType":"Attribute","startLoc":151,"text":"self._hubble_distance"},{"attributeType":"null","col":12,"comment":"null","endLoc":177,"id":14698,"name":"_nneutrinos","nodeType":"Attribute","startLoc":177,"text":"self._nneutrinos"},{"attributeType":"null","col":12,"comment":"null","endLoc":210,"id":14699,"name":"_Onu0","nodeType":"Attribute","startLoc":210,"text":"self._Onu0"},{"attributeType":"null","col":8,"comment":"null","endLoc":214,"id":14700,"name":"_Ok0","nodeType":"Attribute","startLoc":214,"text":"self._Ok0"},{"attributeType":"null","col":8,"comment":"null","endLoc":142,"id":14701,"name":"Ob0","nodeType":"Attribute","startLoc":142,"text":"self.Ob0"},{"fileName":"angle_lextab.py","filePath":"astropy/coordinates","id":14702,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# This file was automatically generated from ply. To re-generate this file,\n# remove it from this folder, then build astropy and run the tests in-place:\n#\n#   python setup.py build_ext --inplace\n#   pytest astropy/coordinates\n#\n# You can then commit the changes to this file.\n\n# angle_lextab.py. This file automatically created by PLY (version 3.11). Don't edit!\n_tabversion   = '3.10'\n_lextokens    = set(('COLON', 'DEGREE', 'EASTWEST', 'HOUR', 'MINUTE', 'NORTHSOUTH', 'SECOND', 'SIGN', 'SIMPLE_UNIT', 'UFLOAT', 'UINT'))\n_lexreflags   = 64\n_lexliterals  = ''\n_lexstateinfo = {'INITIAL': 'inclusive'}\n_lexstatere   = {'INITIAL': [('(?P<t_UFLOAT>((\\\\d+\\\\.\\\\d*)|(\\\\.\\\\d+))([eE][+-−]?\\\\d+)?)|(?P<t_UINT>\\\\d+)|(?P<t_SIGN>[+−-])|(?P<t_EASTWEST>[EW]$)|(?P<t_NORTHSOUTH>[NS]$)|(?P<t_SIMPLE_UNIT>(?:Earcmin)|(?:Earcsec)|(?:Edeg)|(?:Erad)|(?:Garcmin)|(?:Garcsec)|(?:Gdeg)|(?:Grad)|(?:Marcmin)|(?:Marcsec)|(?:Mdeg)|(?:Mrad)|(?:Parcmin)|(?:Parcsec)|(?:Pdeg)|(?:Prad)|(?:Tarcmin)|(?:Tarcsec)|(?:Tdeg)|(?:Trad)|(?:Yarcmin)|(?:Yarcsec)|(?:Ydeg)|(?:Yrad)|(?:Zarcmin)|(?:Zarcsec)|(?:Zdeg)|(?:Zrad)|(?:aarcmin)|(?:aarcsec)|(?:adeg)|(?:arad)|(?:arcmin)|(?:arcminute)|(?:arcsec)|(?:arcsecond)|(?:attoarcminute)|(?:attoarcsecond)|(?:attodegree)|(?:attoradian)|(?:carcmin)|(?:carcsec)|(?:cdeg)|(?:centiarcminute)|(?:centiarcsecond)|(?:centidegree)|(?:centiradian)|(?:crad)|(?:cy)|(?:cycle)|(?:daarcmin)|(?:daarcsec)|(?:dadeg)|(?:darad)|(?:darcmin)|(?:darcsec)|(?:ddeg)|(?:decaarcminute)|(?:decaarcsecond)|(?:decadegree)|(?:decaradian)|(?:deciarcminute)|(?:deciarcsecond)|(?:decidegree)|(?:deciradian)|(?:dekaarcminute)|(?:dekaarcsecond)|(?:dekadegree)|(?:dekaradian)|(?:drad)|(?:exaarcminute)|(?:exaarcsecond)|(?:exadegree)|(?:exaradian)|(?:farcmin)|(?:farcsec)|(?:fdeg)|(?:femtoarcminute)|(?:femtoarcsecond)|(?:femtodegree)|(?:femtoradian)|(?:frad)|(?:gigaarcminute)|(?:gigaarcsecond)|(?:gigadegree)|(?:gigaradian)|(?:harcmin)|(?:harcsec)|(?:hdeg)|(?:hectoarcminute)|(?:hectoarcsecond)|(?:hectodegree)|(?:hectoradian)|(?:hrad)|(?:karcmin)|(?:karcsec)|(?:kdeg)|(?:kiloarcminute)|(?:kiloarcsecond)|(?:kilodegree)|(?:kiloradian)|(?:krad)|(?:marcmin)|(?:marcsec)|(?:mas)|(?:mdeg)|(?:megaarcminute)|(?:megaarcsecond)|(?:megadegree)|(?:megaradian)|(?:microarcminute)|(?:microarcsecond)|(?:microdegree)|(?:microradian)|(?:milliarcminute)|(?:milliarcsecond)|(?:millidegree)|(?:milliradian)|(?:mrad)|(?:nanoarcminute)|(?:nanoarcsecond)|(?:nanodegree)|(?:nanoradian)|(?:narcmin)|(?:narcsec)|(?:ndeg)|(?:nrad)|(?:parcmin)|(?:parcsec)|(?:pdeg)|(?:petaarcminute)|(?:petaarcsecond)|(?:petadegree)|(?:petaradian)|(?:picoarcminute)|(?:picoarcsecond)|(?:picodegree)|(?:picoradian)|(?:prad)|(?:rad)|(?:radian)|(?:teraarcminute)|(?:teraarcsecond)|(?:teradegree)|(?:teraradian)|(?:uarcmin)|(?:uarcsec)|(?:uas)|(?:udeg)|(?:urad)|(?:yarcmin)|(?:yarcsec)|(?:ydeg)|(?:yoctoarcminute)|(?:yoctoarcsecond)|(?:yoctodegree)|(?:yoctoradian)|(?:yottaarcminute)|(?:yottaarcsecond)|(?:yottadegree)|(?:yottaradian)|(?:yrad)|(?:zarcmin)|(?:zarcsec)|(?:zdeg)|(?:zeptoarcminute)|(?:zeptoarcsecond)|(?:zeptodegree)|(?:zeptoradian)|(?:zettaarcminute)|(?:zettaarcsecond)|(?:zettadegree)|(?:zettaradian)|(?:zrad))|(?P<t_MINUTE>m(in(ute(s)?)?)?|′|\\\\\\'|ᵐ)|(?P<t_SECOND>s(ec(ond(s)?)?)?|″|\\\\\"|ˢ)|(?P<t_DEGREE>d(eg(ree(s)?)?)?|°)|(?P<t_HOUR>hour(s)?|h(r)?|ʰ)|(?P<t_COLON>:)', [None, ('t_UFLOAT', 'UFLOAT'), None, None, None, None, ('t_UINT', 'UINT'), ('t_SIGN', 'SIGN'), ('t_EASTWEST', 'EASTWEST'), ('t_NORTHSOUTH', 'NORTHSOUTH'), ('t_SIMPLE_UNIT', 'SIMPLE_UNIT'), (None, 'MINUTE'), None, None, None, (None, 'SECOND'), None, None, None, (None, 'DEGREE'), None, None, None, (None, 'HOUR'), None, None, (None, 'COLON')])]}\n_lexstateignore = {'INITIAL': ' '}\n_lexstateerrorf = {'INITIAL': 't_error'}\n_lexstateeoff = {}\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":14703,"name":"_tabversion","nodeType":"Attribute","startLoc":13,"text":"_tabversion"},{"attributeType":"function","col":8,"comment":"null","endLoc":218,"id":14704,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":218,"text":"self._inv_efunc_scalar"},{"className":"GeocentricTrueEcliptic","col":0,"comment":"\n    Geocentric true ecliptic coordinates.  These origin of the coordinates are the\n    geocenter (Earth), with the x axis pointing to the *true* (not mean) equinox\n    at the time specified by the ``equinox`` attribute, and the xy-plane in the\n    plane of the ecliptic for that date.\n\n    Be aware that the definition of \"geocentric\" here means that this frame\n    *includes* light deflection from the sun, aberration, etc when transforming\n    to/from e.g. ICRS.\n\n    The frame attributes are listed under **Other Parameters**.\n    ","endLoc":109,"id":14705,"nodeType":"Class","startLoc":92,"text":"@format_doc(base_doc, components=doc_components_ecl.format('geocenter'),\n            footer=doc_footer_geo)\nclass GeocentricTrueEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Geocentric true ecliptic coordinates.  These origin of the coordinates are the\n    geocenter (Earth), with the x axis pointing to the *true* (not mean) equinox\n    at the time specified by the ``equinox`` attribute, and the xy-plane in the\n    plane of the ecliptic for that date.\n\n    Be aware that the definition of \"geocentric\" here means that this frame\n    *includes* light deflection from the sun, aberration, etc when transforming\n    to/from e.g. ICRS.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":14706,"name":"_lextokens","nodeType":"Attribute","startLoc":14,"text":"_lextokens"},{"attributeType":"null","col":8,"comment":"null","endLoc":136,"id":14707,"name":"H0","nodeType":"Attribute","startLoc":136,"text":"self.H0"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":14708,"name":"_lexreflags","nodeType":"Attribute","startLoc":15,"text":"_lexreflags"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":14709,"name":"_lexliterals","nodeType":"Attribute","startLoc":16,"text":"_lexliterals"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":14710,"name":"_lexstateinfo","nodeType":"Attribute","startLoc":17,"text":"_lexstateinfo"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":14711,"name":"_lexstatere","nodeType":"Attribute","startLoc":18,"text":"_lexstatere"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":14712,"name":"_lexstateignore","nodeType":"Attribute","startLoc":19,"text":"_lexstateignore"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":14713,"name":"_lexstateerrorf","nodeType":"Attribute","startLoc":20,"text":"_lexstateerrorf"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":14714,"name":"_lexstateeoff","nodeType":"Attribute","startLoc":21,"text":"_lexstateeoff"},{"col":0,"comment":"","endLoc":13,"header":"angle_lextab.py#<anonymous>","id":14715,"name":"<anonymous>","nodeType":"Function","startLoc":13,"text":"_tabversion   = '3.10'\n\n_lextokens    = set(('COLON', 'DEGREE', 'EASTWEST', 'HOUR', 'MINUTE', 'NORTHSOUTH', 'SECOND', 'SIGN', 'SIMPLE_UNIT', 'UFLOAT', 'UINT'))\n\n_lexreflags   = 64\n\n_lexliterals  = ''\n\n_lexstateinfo = {'INITIAL': 'inclusive'}\n\n_lexstatere   = {'INITIAL': [('(?P<t_UFLOAT>((\\\\d+\\\\.\\\\d*)|(\\\\.\\\\d+))([eE][+-−]?\\\\d+)?)|(?P<t_UINT>\\\\d+)|(?P<t_SIGN>[+−-])|(?P<t_EASTWEST>[EW]$)|(?P<t_NORTHSOUTH>[NS]$)|(?P<t_SIMPLE_UNIT>(?:Earcmin)|(?:Earcsec)|(?:Edeg)|(?:Erad)|(?:Garcmin)|(?:Garcsec)|(?:Gdeg)|(?:Grad)|(?:Marcmin)|(?:Marcsec)|(?:Mdeg)|(?:Mrad)|(?:Parcmin)|(?:Parcsec)|(?:Pdeg)|(?:Prad)|(?:Tarcmin)|(?:Tarcsec)|(?:Tdeg)|(?:Trad)|(?:Yarcmin)|(?:Yarcsec)|(?:Ydeg)|(?:Yrad)|(?:Zarcmin)|(?:Zarcsec)|(?:Zdeg)|(?:Zrad)|(?:aarcmin)|(?:aarcsec)|(?:adeg)|(?:arad)|(?:arcmin)|(?:arcminute)|(?:arcsec)|(?:arcsecond)|(?:attoarcminute)|(?:attoarcsecond)|(?:attodegree)|(?:attoradian)|(?:carcmin)|(?:carcsec)|(?:cdeg)|(?:centiarcminute)|(?:centiarcsecond)|(?:centidegree)|(?:centiradian)|(?:crad)|(?:cy)|(?:cycle)|(?:daarcmin)|(?:daarcsec)|(?:dadeg)|(?:darad)|(?:darcmin)|(?:darcsec)|(?:ddeg)|(?:decaarcminute)|(?:decaarcsecond)|(?:decadegree)|(?:decaradian)|(?:deciarcminute)|(?:deciarcsecond)|(?:decidegree)|(?:deciradian)|(?:dekaarcminute)|(?:dekaarcsecond)|(?:dekadegree)|(?:dekaradian)|(?:drad)|(?:exaarcminute)|(?:exaarcsecond)|(?:exadegree)|(?:exaradian)|(?:farcmin)|(?:farcsec)|(?:fdeg)|(?:femtoarcminute)|(?:femtoarcsecond)|(?:femtodegree)|(?:femtoradian)|(?:frad)|(?:gigaarcminute)|(?:gigaarcsecond)|(?:gigadegree)|(?:gigaradian)|(?:harcmin)|(?:harcsec)|(?:hdeg)|(?:hectoarcminute)|(?:hectoarcsecond)|(?:hectodegree)|(?:hectoradian)|(?:hrad)|(?:karcmin)|(?:karcsec)|(?:kdeg)|(?:kiloarcminute)|(?:kiloarcsecond)|(?:kilodegree)|(?:kiloradian)|(?:krad)|(?:marcmin)|(?:marcsec)|(?:mas)|(?:mdeg)|(?:megaarcminute)|(?:megaarcsecond)|(?:megadegree)|(?:megaradian)|(?:microarcminute)|(?:microarcsecond)|(?:microdegree)|(?:microradian)|(?:milliarcminute)|(?:milliarcsecond)|(?:millidegree)|(?:milliradian)|(?:mrad)|(?:nanoarcminute)|(?:nanoarcsecond)|(?:nanodegree)|(?:nanoradian)|(?:narcmin)|(?:narcsec)|(?:ndeg)|(?:nrad)|(?:parcmin)|(?:parcsec)|(?:pdeg)|(?:petaarcminute)|(?:petaarcsecond)|(?:petadegree)|(?:petaradian)|(?:picoarcminute)|(?:picoarcsecond)|(?:picodegree)|(?:picoradian)|(?:prad)|(?:rad)|(?:radian)|(?:teraarcminute)|(?:teraarcsecond)|(?:teradegree)|(?:teraradian)|(?:uarcmin)|(?:uarcsec)|(?:uas)|(?:udeg)|(?:urad)|(?:yarcmin)|(?:yarcsec)|(?:ydeg)|(?:yoctoarcminute)|(?:yoctoarcsecond)|(?:yoctodegree)|(?:yoctoradian)|(?:yottaarcminute)|(?:yottaarcsecond)|(?:yottadegree)|(?:yottaradian)|(?:yrad)|(?:zarcmin)|(?:zarcsec)|(?:zdeg)|(?:zeptoarcminute)|(?:zeptoarcsecond)|(?:zeptodegree)|(?:zeptoradian)|(?:zettaarcminute)|(?:zettaarcsecond)|(?:zettadegree)|(?:zettaradian)|(?:zrad))|(?P<t_MINUTE>m(in(ute(s)?)?)?|′|\\\\\\'|ᵐ)|(?P<t_SECOND>s(ec(ond(s)?)?)?|″|\\\\\"|ˢ)|(?P<t_DEGREE>d(eg(ree(s)?)?)?|°)|(?P<t_HOUR>hour(s)?|h(r)?|ʰ)|(?P<t_COLON>:)', [None, ('t_UFLOAT', 'UFLOAT'), None, None, None, None, ('t_UINT', 'UINT'), ('t_SIGN', 'SIGN'), ('t_EASTWEST', 'EASTWEST'), ('t_NORTHSOUTH', 'NORTHSOUTH'), ('t_SIMPLE_UNIT', 'SIMPLE_UNIT'), (None, 'MINUTE'), None, None, None, (None, 'SECOND'), None, None, None, (None, 'DEGREE'), None, None, None, (None, 'HOUR'), None, None, (None, 'COLON')])]}\n\n_lexstateignore = {'INITIAL': ' '}\n\n_lexstateerrorf = {'INITIAL': 't_error'}\n\n_lexstateeoff = {}"},{"fileName":"sites.py","filePath":"astropy/coordinates","id":14716,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nCurrently the only site accessible without internet access is the Royal\nGreenwich Observatory, as an example (and for testing purposes).  In future\nreleases, a canonical set of sites may be bundled into astropy for when the\nonline registry is unavailable.\n\nAdditions or corrections to the observatory list can be submitted via Pull\nRequest to the [astropy-data GitHub repository](https://github.com/astropy/astropy-data),\nupdating the ``location.json`` file.\n\"\"\"\n\n\nimport json\nfrom difflib import get_close_matches\nfrom collections.abc import Mapping\n\nfrom astropy.utils.data import get_pkg_data_contents, get_file_contents\nfrom .earth import EarthLocation\nfrom .errors import UnknownSiteException\nfrom astropy import units as u\n\n\nclass SiteRegistry(Mapping):\n    \"\"\"\n    A bare-bones registry of EarthLocation objects.\n\n    This acts as a mapping (dict-like object) but with the important caveat that\n    it's always transforms its inputs to lower-case.  So keys are always all\n    lower-case, and even if you ask for something that's got mixed case, it will\n    be interpreted as the all lower-case version.\n    \"\"\"\n    def __init__(self):\n        # the keys to this are always lower-case\n        self._lowercase_names_to_locations = {}\n        # these can be whatever case is appropriate\n        self._names = []\n\n    def __getitem__(self, site_name):\n        \"\"\"\n        Returns an EarthLocation for a known site in this registry.\n\n        Parameters\n        ----------\n        site_name : str\n            Name of the observatory (case-insensitive).\n\n        Returns\n        -------\n        site : `~astropy.coordinates.EarthLocation`\n            The location of the observatory.\n        \"\"\"\n        if site_name.lower() not in self._lowercase_names_to_locations:\n            # If site name not found, find close matches and suggest them in error\n            close_names = get_close_matches(site_name, self._lowercase_names_to_locations)\n            close_names = sorted(close_names, key=len)\n\n            raise UnknownSiteException(site_name, \"the 'names' attribute\", close_names=close_names)\n\n        return self._lowercase_names_to_locations[site_name.lower()]\n\n    def __len__(self):\n        return len(self._lowercase_names_to_locations)\n\n    def __iter__(self):\n        return iter(self._lowercase_names_to_locations)\n\n    def __contains__(self, site_name):\n        return site_name.lower() in self._lowercase_names_to_locations\n\n    @property\n    def names(self):\n        \"\"\"\n        The names in this registry.  Note that these are *not* exactly the same\n        as the keys: keys are always lower-case, while `names` is what you\n        should use for the actual readable names (which may be case-sensitive)\n\n        Returns\n        -------\n        site : list of str\n            The names of the sites in this registry\n        \"\"\"\n        return sorted(self._names)\n\n    def add_site(self, names, locationobj):\n        \"\"\"\n        Adds a location to the registry.\n\n        Parameters\n        ----------\n        names : list of str\n            All the names this site should go under\n        locationobj : `~astropy.coordinates.EarthLocation`\n            The actual site object\n        \"\"\"\n        for name in names:\n            self._lowercase_names_to_locations[name.lower()] = locationobj\n            self._names.append(name)\n\n    @classmethod\n    def from_json(cls, jsondb):\n        reg = cls()\n        for site in jsondb:\n            site_info = jsondb[site].copy()\n            location = EarthLocation.from_geodetic(site_info.pop('longitude') * u.Unit(site_info.pop('longitude_unit')),\n                                                   site_info.pop('latitude') * u.Unit(site_info.pop('latitude_unit')),\n                                                   site_info.pop('elevation') * u.Unit(site_info.pop('elevation_unit')))\n            location.info.name = site_info.pop('name')\n            aliases = site_info.pop('aliases')\n            location.info.meta = site_info  # whatever is left\n\n            reg.add_site([site] + aliases, location)\n\n        reg._loaded_jsondb = jsondb\n        return reg\n\n\ndef get_builtin_sites():\n    \"\"\"\n    Load observatory database from data/observatories.json and parse them into\n    a SiteRegistry.\n    \"\"\"\n    jsondb = json.loads(get_pkg_data_contents('data/sites.json'))\n    return SiteRegistry.from_json(jsondb)\n\n\ndef get_downloaded_sites(jsonurl=None):\n    \"\"\"\n    Load observatory database from data.astropy.org and parse into a SiteRegistry\n    \"\"\"\n\n    # we explicitly set the encoding because the default is to leave it set by\n    # the users' locale, which may fail if it's not matched to the sites.json\n    if jsonurl is None:\n        content = get_pkg_data_contents('coordinates/sites.json', encoding='UTF-8')\n    else:\n        content = get_file_contents(jsonurl, encoding='UTF-8')\n\n    jsondb = json.loads(content)\n    return SiteRegistry.from_json(jsondb)\n"},{"col":0,"comment":"null","endLoc":26,"header":"def _round_up_to_odd_integer(value)","id":14717,"name":"_round_up_to_odd_integer","nodeType":"Function","startLoc":21,"text":"def _round_up_to_odd_integer(value):\n    i = math.ceil(value)\n    if i % 2 == 0:\n        return i + 1\n    else:\n        return i"},{"className":"UnknownSiteException","col":0,"comment":"null","endLoc":175,"id":14718,"nodeType":"Class","startLoc":167,"text":"class UnknownSiteException(KeyError):\n    def __init__(self, site, attribute, close_names=None):\n        message = f\"Site '{site}' not in database. Use {attribute} to see available sites.\"\n        if close_names:\n            message += \" Did you mean one of: '{}'?'\".format(\"', '\".join(close_names))\n        self.site = site\n        self.attribute = attribute\n        self.close_names = close_names\n        return super().__init__(message)"},{"attributeType":"null","col":8,"comment":"null","endLoc":172,"id":14719,"name":"site","nodeType":"Attribute","startLoc":172,"text":"self.site"},{"attributeType":"null","col":8,"comment":"null","endLoc":149,"id":14720,"name":"_h","nodeType":"Attribute","startLoc":149,"text":"self._h"},{"attributeType":"null","col":8,"comment":"null","endLoc":173,"id":14721,"name":"attribute","nodeType":"Attribute","startLoc":173,"text":"self.attribute"},{"attributeType":"null","col":8,"comment":"null","endLoc":174,"id":14722,"name":"close_names","nodeType":"Attribute","startLoc":174,"text":"self.close_names"},{"className":"SiteRegistry","col":0,"comment":"\n    A bare-bones registry of EarthLocation objects.\n\n    This acts as a mapping (dict-like object) but with the important caveat that\n    it's always transforms its inputs to lower-case.  So keys are always all\n    lower-case, and even if you ask for something that's got mixed case, it will\n    be interpreted as the all lower-case version.\n    ","endLoc":115,"id":14723,"nodeType":"Class","startLoc":24,"text":"class SiteRegistry(Mapping):\n    \"\"\"\n    A bare-bones registry of EarthLocation objects.\n\n    This acts as a mapping (dict-like object) but with the important caveat that\n    it's always transforms its inputs to lower-case.  So keys are always all\n    lower-case, and even if you ask for something that's got mixed case, it will\n    be interpreted as the all lower-case version.\n    \"\"\"\n    def __init__(self):\n        # the keys to this are always lower-case\n        self._lowercase_names_to_locations = {}\n        # these can be whatever case is appropriate\n        self._names = []\n\n    def __getitem__(self, site_name):\n        \"\"\"\n        Returns an EarthLocation for a known site in this registry.\n\n        Parameters\n        ----------\n        site_name : str\n            Name of the observatory (case-insensitive).\n\n        Returns\n        -------\n        site : `~astropy.coordinates.EarthLocation`\n            The location of the observatory.\n        \"\"\"\n        if site_name.lower() not in self._lowercase_names_to_locations:\n            # If site name not found, find close matches and suggest them in error\n            close_names = get_close_matches(site_name, self._lowercase_names_to_locations)\n            close_names = sorted(close_names, key=len)\n\n            raise UnknownSiteException(site_name, \"the 'names' attribute\", close_names=close_names)\n\n        return self._lowercase_names_to_locations[site_name.lower()]\n\n    def __len__(self):\n        return len(self._lowercase_names_to_locations)\n\n    def __iter__(self):\n        return iter(self._lowercase_names_to_locations)\n\n    def __contains__(self, site_name):\n        return site_name.lower() in self._lowercase_names_to_locations\n\n    @property\n    def names(self):\n        \"\"\"\n        The names in this registry.  Note that these are *not* exactly the same\n        as the keys: keys are always lower-case, while `names` is what you\n        should use for the actual readable names (which may be case-sensitive)\n\n        Returns\n        -------\n        site : list of str\n            The names of the sites in this registry\n        \"\"\"\n        return sorted(self._names)\n\n    def add_site(self, names, locationobj):\n        \"\"\"\n        Adds a location to the registry.\n\n        Parameters\n        ----------\n        names : list of str\n            All the names this site should go under\n        locationobj : `~astropy.coordinates.EarthLocation`\n            The actual site object\n        \"\"\"\n        for name in names:\n            self._lowercase_names_to_locations[name.lower()] = locationobj\n            self._names.append(name)\n\n    @classmethod\n    def from_json(cls, jsondb):\n        reg = cls()\n        for site in jsondb:\n            site_info = jsondb[site].copy()\n            location = EarthLocation.from_geodetic(site_info.pop('longitude') * u.Unit(site_info.pop('longitude_unit')),\n                                                   site_info.pop('latitude') * u.Unit(site_info.pop('latitude_unit')),\n                                                   site_info.pop('elevation') * u.Unit(site_info.pop('elevation_unit')))\n            location.info.name = site_info.pop('name')\n            aliases = site_info.pop('aliases')\n            location.info.meta = site_info  # whatever is left\n\n            reg.add_site([site] + aliases, location)\n\n        reg._loaded_jsondb = jsondb\n        return reg"},{"col":4,"comment":"\n        Returns an EarthLocation for a known site in this registry.\n\n        Parameters\n        ----------\n        site_name : str\n            Name of the observatory (case-insensitive).\n\n        Returns\n        -------\n        site : `~astropy.coordinates.EarthLocation`\n            The location of the observatory.\n        ","endLoc":60,"header":"def __getitem__(self, site_name)","id":14724,"name":"__getitem__","nodeType":"Function","startLoc":39,"text":"def __getitem__(self, site_name):\n        \"\"\"\n        Returns an EarthLocation for a known site in this registry.\n\n        Parameters\n        ----------\n        site_name : str\n            Name of the observatory (case-insensitive).\n\n        Returns\n        -------\n        site : `~astropy.coordinates.EarthLocation`\n            The location of the observatory.\n        \"\"\"\n        if site_name.lower() not in self._lowercase_names_to_locations:\n            # If site name not found, find close matches and suggest them in error\n            close_names = get_close_matches(site_name, self._lowercase_names_to_locations)\n            close_names = sorted(close_names, key=len)\n\n            raise UnknownSiteException(site_name, \"the 'names' attribute\", close_names=close_names)\n\n        return self._lowercase_names_to_locations[site_name.lower()]"},{"className":"BaseEclipticFrame","col":0,"comment":"\n    A base class for frames that have names and conventions like that of\n    ecliptic frames.\n\n    .. warning::\n            In the current version of astropy, the ecliptic frames do not yet have\n            stringent accuracy tests.  We recommend you test to \"known-good\" cases\n            to ensure this frames are what you are looking for. (and then ideally\n            you would contribute these tests to Astropy!)\n    ","endLoc":56,"id":14725,"nodeType":"Class","startLoc":40,"text":"@format_doc(base_doc,\n            components=doc_components_ecl.format('specified location'),\n            footer=\"\")\nclass BaseEclipticFrame(BaseCoordinateFrame):\n    \"\"\"\n    A base class for frames that have names and conventions like that of\n    ecliptic frames.\n\n    .. warning::\n            In the current version of astropy, the ecliptic frames do not yet have\n            stringent accuracy tests.  We recommend you test to \"known-good\" cases\n            to ensure this frames are what you are looking for. (and then ideally\n            you would contribute these tests to Astropy!)\n    \"\"\"\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential"},{"attributeType":"null","col":4,"comment":"null","endLoc":55,"id":14726,"name":"default_representation","nodeType":"Attribute","startLoc":55,"text":"default_representation"},{"col":4,"comment":"null","endLoc":63,"header":"def __len__(self)","id":14727,"name":"__len__","nodeType":"Function","startLoc":62,"text":"def __len__(self):\n        return len(self._lowercase_names_to_locations)"},{"col":4,"comment":"null","endLoc":66,"header":"def __iter__(self)","id":14728,"name":"__iter__","nodeType":"Function","startLoc":65,"text":"def __iter__(self):\n        return iter(self._lowercase_names_to_locations)"},{"col":4,"comment":"null","endLoc":69,"header":"def __contains__(self, site_name)","id":14729,"name":"__contains__","nodeType":"Function","startLoc":68,"text":"def __contains__(self, site_name):\n        return site_name.lower() in self._lowercase_names_to_locations"},{"col":4,"comment":"\n        The names in this registry.  Note that these are *not* exactly the same\n        as the keys: keys are always lower-case, while `names` is what you\n        should use for the actual readable names (which may be case-sensitive)\n\n        Returns\n        -------\n        site : list of str\n            The names of the sites in this registry\n        ","endLoc":83,"header":"@property\n    def names(self)","id":14730,"name":"names","nodeType":"Function","startLoc":71,"text":"@property\n    def names(self):\n        \"\"\"\n        The names in this registry.  Note that these are *not* exactly the same\n        as the keys: keys are always lower-case, while `names` is what you\n        should use for the actual readable names (which may be case-sensitive)\n\n        Returns\n        -------\n        site : list of str\n            The names of the sites in this registry\n        \"\"\"\n        return sorted(self._names)"},{"col":4,"comment":"\n        Adds a location to the registry.\n\n        Parameters\n        ----------\n        names : list of str\n            All the names this site should go under\n        locationobj : `~astropy.coordinates.EarthLocation`\n            The actual site object\n        ","endLoc":98,"header":"def add_site(self, names, locationobj)","id":14731,"name":"add_site","nodeType":"Function","startLoc":85,"text":"def add_site(self, names, locationobj):\n        \"\"\"\n        Adds a location to the registry.\n\n        Parameters\n        ----------\n        names : list of str\n            All the names this site should go under\n        locationobj : `~astropy.coordinates.EarthLocation`\n            The actual site object\n        \"\"\"\n        for name in names:\n            self._lowercase_names_to_locations[name.lower()] = locationobj\n            self._names.append(name)"},{"attributeType":"null","col":4,"comment":"null","endLoc":56,"id":14732,"name":"default_differential","nodeType":"Attribute","startLoc":56,"text":"default_differential"},{"attributeType":"None","col":12,"comment":"null","endLoc":194,"id":14733,"name":"_massivenu_mass","nodeType":"Attribute","startLoc":194,"text":"self._massivenu_mass"},{"attributeType":"null","col":8,"comment":"null","endLoc":141,"id":14734,"name":"m_nu","nodeType":"Attribute","startLoc":141,"text":"self.m_nu"},{"attributeType":"null","col":4,"comment":"null","endLoc":83,"id":14735,"name":"_separable","nodeType":"Attribute","startLoc":83,"text":"_separable"},{"attributeType":"null","col":4,"comment":"null","endLoc":84,"id":14736,"name":"_is_bool","nodeType":"Attribute","startLoc":84,"text":"_is_bool"},{"attributeType":"null","col":8,"comment":"null","endLoc":159,"id":14737,"name":"_critical_density0","nodeType":"Attribute","startLoc":159,"text":"self._critical_density0"},{"attributeType":"null","col":12,"comment":"null","endLoc":192,"id":14738,"name":"_massivenu","nodeType":"Attribute","startLoc":192,"text":"self._massivenu"},{"attributeType":"null","col":8,"comment":"null","endLoc":219,"id":14739,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":219,"text":"self._inv_efunc_scalar_args"},{"attributeType":"null","col":8,"comment":"null","endLoc":89,"id":14740,"name":"_default_size","nodeType":"Attribute","startLoc":89,"text":"self._default_size"},{"attributeType":"null","col":4,"comment":"null","endLoc":108,"id":14741,"name":"equinox","nodeType":"Attribute","startLoc":108,"text":"equinox"},{"attributeType":"null","col":4,"comment":"null","endLoc":109,"id":14742,"name":"obstime","nodeType":"Attribute","startLoc":109,"text":"obstime"},{"attributeType":"null","col":8,"comment":"null","endLoc":37,"id":14743,"name":"_names","nodeType":"Attribute","startLoc":37,"text":"self._names"},{"attributeType":"null","col":8,"comment":"null","endLoc":35,"id":14744,"name":"_lowercase_names_to_locations","nodeType":"Attribute","startLoc":35,"text":"self._lowercase_names_to_locations"},{"col":0,"comment":"\n    Lunar position model ELP2000-82 of (Chapront-Touze' and Chapront, 1983, 124, 50)\n\n    This is the simplified version of Jean Meeus, Astronomical Algorithms,\n    second edition, 1998, Willmann-Bell. Meeus claims approximate accuracy of 10\"\n    in longitude and 4\" in latitude, with no specified time range.\n\n    Tests against JPL ephemerides show accuracy of 10 arcseconds and 50 km over the\n    date range CE 1950-2050.\n\n    Parameters\n    ----------\n    t : `~astropy.time.Time`\n        Time of observation.\n\n    Returns\n    -------\n    skycoord : `~astropy.coordinates.SkyCoord`\n        ICRS Coordinate for the body\n    ","endLoc":254,"header":"@deprecated(since=\"5.0\",\n            alternative=\"astropy.coordinates.get_moon\",\n            message=(\"The private calc_moon function has been deprecated, \"\n                     \"as its functionality is now available in ERFA. \"\n                     \"Note that the coordinate system was not interpreted \"\n                     \"quite correctly, leading to small inaccuracies. Please \"\n                     \"use the public get_moon or get_body functions instead.\"))\ndef calc_moon(t)","id":14745,"name":"calc_moon","nodeType":"Function","startLoc":176,"text":"@deprecated(since=\"5.0\",\n            alternative=\"astropy.coordinates.get_moon\",\n            message=(\"The private calc_moon function has been deprecated, \"\n                     \"as its functionality is now available in ERFA. \"\n                     \"Note that the coordinate system was not interpreted \"\n                     \"quite correctly, leading to small inaccuracies. Please \"\n                     \"use the public get_moon or get_body functions instead.\"))\ndef calc_moon(t):\n    \"\"\"\n    Lunar position model ELP2000-82 of (Chapront-Touze' and Chapront, 1983, 124, 50)\n\n    This is the simplified version of Jean Meeus, Astronomical Algorithms,\n    second edition, 1998, Willmann-Bell. Meeus claims approximate accuracy of 10\"\n    in longitude and 4\" in latitude, with no specified time range.\n\n    Tests against JPL ephemerides show accuracy of 10 arcseconds and 50 km over the\n    date range CE 1950-2050.\n\n    Parameters\n    ----------\n    t : `~astropy.time.Time`\n        Time of observation.\n\n    Returns\n    -------\n    skycoord : `~astropy.coordinates.SkyCoord`\n        ICRS Coordinate for the body\n    \"\"\"\n    # number of centuries since J2000.0.\n    # This should strictly speaking be in Ephemeris Time, but TDB or TT\n    # will introduce error smaller than intrinsic accuracy of algorithm.\n    T = (t.tdb.jyear-2000.0)/100.\n\n    # constants that are needed for all calculations\n    Lc = u.Quantity(polyval(T, _coLc), u.deg)\n    D = u.Quantity(polyval(T, _coD), u.deg)\n    M = u.Quantity(polyval(T, _coM), u.deg)\n    Mc = u.Quantity(polyval(T, _coMc), u.deg)\n    F = u.Quantity(polyval(T, _coF), u.deg)\n\n    A1 = u.Quantity(polyval(T, _coA1), u.deg)\n    A2 = u.Quantity(polyval(T, _coA2), u.deg)\n    A3 = u.Quantity(polyval(T, _coA3), u.deg)\n    E = polyval(T, _coE)\n\n    suml = sumr = 0.0\n    for DNum, MNum, McNum, FNum, LFac, RFac in _MOON_L_R:\n        corr = E ** abs(MNum)\n        suml += LFac*corr*np.sin(D*DNum+M*MNum+Mc*McNum+F*FNum)\n        sumr += RFac*corr*np.cos(D*DNum+M*MNum+Mc*McNum+F*FNum)\n\n    sumb = 0.0\n    for DNum, MNum, McNum, FNum, BFac in _MOON_B:\n        corr = E ** abs(MNum)\n        sumb += BFac*corr*np.sin(D*DNum+M*MNum+Mc*McNum+F*FNum)\n\n    suml += (3958*np.sin(A1) + 1962*np.sin(Lc-F) + 318*np.sin(A2))\n    sumb += (-2235*np.sin(Lc) + 382*np.sin(A3) + 175*np.sin(A1-F) +\n             175*np.sin(A1+F) + 127*np.sin(Lc-Mc) - 115*np.sin(Lc+Mc))\n\n    # ensure units\n    suml = suml*u.microdegree\n    sumb = sumb*u.microdegree\n\n    # nutation of longitude\n    jd1, jd2 = get_jd12(t, 'tt')\n    nut, _ = erfa.nut06a(jd1, jd2)\n    nut = nut*u.rad\n\n    # calculate ecliptic coordinates\n    lon = Lc + suml + nut\n    lat = sumb\n    dist = (385000.56+sumr/1000)*u.km\n\n    # Meeus algorithm gives GeocentricTrueEcliptic coordinates\n    ecliptic_coo = GeocentricTrueEcliptic(lon, lat, distance=dist,\n                                          obstime=t, equinox=t)\n\n    return SkyCoord(ecliptic_coo.transform_to(ICRS()))"},{"col":0,"comment":"\n    Convolve two models using `~astropy.convolution.convolve_fft`.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.core.Model`\n        Functional model\n    kernel : `~astropy.modeling.core.Model`\n        Convolution kernel\n    mode : str\n        Keyword representing which function to use for convolution.\n            * 'convolve_fft' : use `~astropy.convolution.convolve_fft` function.\n            * 'convolve' : use `~astropy.convolution.convolve`.\n    **kwargs : dict\n        Keyword arguments to me passed either to `~astropy.convolution.convolve`\n        or `~astropy.convolution.convolve_fft` depending on ``mode``.\n\n    Returns\n    -------\n    default : `~astropy.modeling.core.CompoundModel`\n        Convolved model\n    ","endLoc":961,"header":"def convolve_models(model, kernel, mode='convolve_fft', **kwargs)","id":14746,"name":"convolve_models","nodeType":"Function","startLoc":930,"text":"def convolve_models(model, kernel, mode='convolve_fft', **kwargs):\n    \"\"\"\n    Convolve two models using `~astropy.convolution.convolve_fft`.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.core.Model`\n        Functional model\n    kernel : `~astropy.modeling.core.Model`\n        Convolution kernel\n    mode : str\n        Keyword representing which function to use for convolution.\n            * 'convolve_fft' : use `~astropy.convolution.convolve_fft` function.\n            * 'convolve' : use `~astropy.convolution.convolve`.\n    **kwargs : dict\n        Keyword arguments to me passed either to `~astropy.convolution.convolve`\n        or `~astropy.convolution.convolve_fft` depending on ``mode``.\n\n    Returns\n    -------\n    default : `~astropy.modeling.core.CompoundModel`\n        Convolved model\n    \"\"\"\n\n    if mode == 'convolve_fft':\n        operator = SPECIAL_OPERATORS.add('convolve_fft', partial(convolve_fft, **kwargs))\n    elif mode == 'convolve':\n        operator = SPECIAL_OPERATORS.add('convolve', partial(convolve, **kwargs))\n    else:\n        raise ValueError(f'Mode {mode} is not supported.')\n\n    return CompoundModel(operator, model, kernel)"},{"col":0,"comment":"","endLoc":11,"header":"sites.py#<anonymous>","id":14747,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nCurrently the only site accessible without internet access is the Royal\nGreenwich Observatory, as an example (and for testing purposes).  In future\nreleases, a canonical set of sites may be bundled into astropy for when the\nonline registry is unavailable.\n\nAdditions or corrections to the observatory list can be submitted via Pull\nRequest to the [astropy-data GitHub repository](https://github.com/astropy/astropy-data),\nupdating the ``location.json`` file.\n\"\"\""},{"attributeType":"Gaussian1D","col":8,"comment":"null","endLoc":87,"id":14748,"name":"_model","nodeType":"Attribute","startLoc":87,"text":"self._model"},{"attributeType":"null","col":8,"comment":"null","endLoc":137,"id":14749,"name":"Om0","nodeType":"Attribute","startLoc":137,"text":"self.Om0"},{"fileName":"angle_parsetab.py","filePath":"astropy/coordinates","id":14750,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# This file was automatically generated from ply. To re-generate this file,\n# remove it from this folder, then build astropy and run the tests in-place:\n#\n#   python setup.py build_ext --inplace\n#   pytest astropy/coordinates\n#\n# You can then commit the changes to this file.\n\n\n# angle_parsetab.py\n# This file is automatically generated. Do not edit.\n# pylint: disable=W,C,R\n_tabversion = '3.10'\n\n_lr_method = 'LALR'\n\n_lr_signature = 'COLON DEGREE EASTWEST HOUR MINUTE NORTHSOUTH SECOND SIGN SIMPLE_UNIT UFLOAT UINT\\n            angle : sign hms eastwest\\n                  | sign dms dir\\n                  | sign arcsecond dir\\n                  | sign arcminute dir\\n                  | sign simple dir\\n            \\n            sign : SIGN\\n                 |\\n            \\n            eastwest : EASTWEST\\n                     |\\n            \\n            dir : EASTWEST\\n                | NORTHSOUTH\\n                |\\n            \\n            ufloat : UFLOAT\\n                   | UINT\\n            \\n            colon : UINT COLON ufloat\\n                  | UINT COLON UINT COLON ufloat\\n            \\n            spaced : UINT ufloat\\n                   | UINT UINT ufloat\\n            \\n            generic : colon\\n                    | spaced\\n                    | ufloat\\n            \\n            hms : UINT HOUR\\n                | UINT HOUR ufloat\\n                | UINT HOUR UINT MINUTE\\n                | UINT HOUR UFLOAT MINUTE\\n                | UINT HOUR UINT MINUTE ufloat\\n                | UINT HOUR UINT MINUTE ufloat SECOND\\n                | generic HOUR\\n            \\n            dms : UINT DEGREE\\n                | UINT DEGREE ufloat\\n                | UINT DEGREE UINT MINUTE\\n                | UINT DEGREE UFLOAT MINUTE\\n                | UINT DEGREE UINT MINUTE ufloat\\n                | UINT DEGREE UINT MINUTE ufloat SECOND\\n                | generic DEGREE\\n            \\n            simple : generic\\n                   | generic SIMPLE_UNIT\\n            \\n            arcsecond : generic SECOND\\n            \\n            arcminute : generic MINUTE\\n            '\n\n_lr_action_items = {'SIGN':([0,],[3,]),'UINT':([0,2,3,9,23,24,26,27,43,45,47,],[-7,9,-6,23,33,35,38,41,33,33,33,]),'UFLOAT':([0,2,3,9,23,24,26,27,43,45,47,],[-7,11,-6,11,11,37,40,11,11,11,11,]),'$end':([1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,48,49,50,51,52,],[0,-9,-12,-12,-12,-12,-14,-21,-13,-36,-19,-20,-1,-8,-2,-10,-11,-3,-4,-5,-14,-22,-17,-29,-28,-35,-38,-39,-37,-14,-18,-14,-23,-13,-14,-30,-13,-14,-15,-24,-25,-31,-32,-26,-33,-16,-27,-34,]),'EASTWEST':([4,5,6,7,8,9,10,11,12,13,14,23,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,48,49,50,51,52,],[16,18,18,18,18,-14,-21,-13,-36,-19,-20,-14,-22,-17,-29,-28,-35,-38,-39,-37,-14,-18,-14,-23,-13,-14,-30,-13,-14,-15,-24,-25,-31,-32,-26,-33,-16,-27,-34,]),'NORTHSOUTH':([5,6,7,8,9,10,11,12,13,14,23,25,26,29,30,31,32,33,34,38,39,40,41,42,45,46,49,50,52,],[19,19,19,19,-14,-21,-13,-36,-19,-20,-14,-17,-29,-35,-38,-39,-37,-14,-18,-14,-30,-13,-14,-15,-31,-32,-33,-16,-34,]),'HOUR':([9,10,11,12,13,14,23,25,33,34,41,42,50,],[24,-21,-13,28,-19,-20,-14,-17,-14,-18,-14,-15,-16,]),'DEGREE':([9,10,11,12,13,14,23,25,33,34,41,42,50,],[26,-21,-13,29,-19,-20,-14,-17,-14,-18,-14,-15,-16,]),'COLON':([9,41,],[27,47,]),'SECOND':([9,10,11,12,13,14,23,25,33,34,41,42,48,49,50,],[-14,-21,-13,30,-19,-20,-14,-17,-14,-18,-14,-15,51,52,-16,]),'MINUTE':([9,10,11,12,13,14,23,25,33,34,35,37,38,40,41,42,50,],[-14,-21,-13,31,-19,-20,-14,-17,-14,-18,43,44,45,46,-14,-15,-16,]),'SIMPLE_UNIT':([9,10,11,12,13,14,23,25,33,34,41,42,50,],[-14,-21,-13,32,-19,-20,-14,-17,-14,-18,-14,-15,-16,]),}\n\n_lr_action = {}\nfor _k, _v in _lr_action_items.items():\n   for _x,_y in zip(_v[0],_v[1]):\n      if not _x in _lr_action:  _lr_action[_x] = {}\n      _lr_action[_x][_k] = _y\ndel _lr_action_items\n\n_lr_goto_items = {'angle':([0,],[1,]),'sign':([0,],[2,]),'hms':([2,],[4,]),'dms':([2,],[5,]),'arcsecond':([2,],[6,]),'arcminute':([2,],[7,]),'simple':([2,],[8,]),'ufloat':([2,9,23,24,26,27,43,45,47,],[10,25,34,36,39,42,48,49,50,]),'generic':([2,],[12,]),'colon':([2,],[13,]),'spaced':([2,],[14,]),'eastwest':([4,],[15,]),'dir':([5,6,7,8,],[17,20,21,22,]),}\n\n_lr_goto = {}\nfor _k, _v in _lr_goto_items.items():\n   for _x, _y in zip(_v[0], _v[1]):\n       if not _x in _lr_goto: _lr_goto[_x] = {}\n       _lr_goto[_x][_k] = _y\ndel _lr_goto_items\n_lr_productions = [\n  (\"S' -> angle\",\"S'\",1,None,None,None),\n  ('angle -> sign hms eastwest','angle',3,'p_angle','angle_formats.py',159),\n  ('angle -> sign dms dir','angle',3,'p_angle','angle_formats.py',160),\n  ('angle -> sign arcsecond dir','angle',3,'p_angle','angle_formats.py',161),\n  ('angle -> sign arcminute dir','angle',3,'p_angle','angle_formats.py',162),\n  ('angle -> sign simple dir','angle',3,'p_angle','angle_formats.py',163),\n  ('sign -> SIGN','sign',1,'p_sign','angle_formats.py',174),\n  ('sign -> <empty>','sign',0,'p_sign','angle_formats.py',175),\n  ('eastwest -> EASTWEST','eastwest',1,'p_eastwest','angle_formats.py',184),\n  ('eastwest -> <empty>','eastwest',0,'p_eastwest','angle_formats.py',185),\n  ('dir -> EASTWEST','dir',1,'p_dir','angle_formats.py',194),\n  ('dir -> NORTHSOUTH','dir',1,'p_dir','angle_formats.py',195),\n  ('dir -> <empty>','dir',0,'p_dir','angle_formats.py',196),\n  ('ufloat -> UFLOAT','ufloat',1,'p_ufloat','angle_formats.py',205),\n  ('ufloat -> UINT','ufloat',1,'p_ufloat','angle_formats.py',206),\n  ('colon -> UINT COLON ufloat','colon',3,'p_colon','angle_formats.py',212),\n  ('colon -> UINT COLON UINT COLON ufloat','colon',5,'p_colon','angle_formats.py',213),\n  ('spaced -> UINT ufloat','spaced',2,'p_spaced','angle_formats.py',222),\n  ('spaced -> UINT UINT ufloat','spaced',3,'p_spaced','angle_formats.py',223),\n  ('generic -> colon','generic',1,'p_generic','angle_formats.py',232),\n  ('generic -> spaced','generic',1,'p_generic','angle_formats.py',233),\n  ('generic -> ufloat','generic',1,'p_generic','angle_formats.py',234),\n  ('hms -> UINT HOUR','hms',2,'p_hms','angle_formats.py',240),\n  ('hms -> UINT HOUR ufloat','hms',3,'p_hms','angle_formats.py',241),\n  ('hms -> UINT HOUR UINT MINUTE','hms',4,'p_hms','angle_formats.py',242),\n  ('hms -> UINT HOUR UFLOAT MINUTE','hms',4,'p_hms','angle_formats.py',243),\n  ('hms -> UINT HOUR UINT MINUTE ufloat','hms',5,'p_hms','angle_formats.py',244),\n  ('hms -> UINT HOUR UINT MINUTE ufloat SECOND','hms',6,'p_hms','angle_formats.py',245),\n  ('hms -> generic HOUR','hms',2,'p_hms','angle_formats.py',246),\n  ('dms -> UINT DEGREE','dms',2,'p_dms','angle_formats.py',257),\n  ('dms -> UINT DEGREE ufloat','dms',3,'p_dms','angle_formats.py',258),\n  ('dms -> UINT DEGREE UINT MINUTE','dms',4,'p_dms','angle_formats.py',259),\n  ('dms -> UINT DEGREE UFLOAT MINUTE','dms',4,'p_dms','angle_formats.py',260),\n  ('dms -> UINT DEGREE UINT MINUTE ufloat','dms',5,'p_dms','angle_formats.py',261),\n  ('dms -> UINT DEGREE UINT MINUTE ufloat SECOND','dms',6,'p_dms','angle_formats.py',262),\n  ('dms -> generic DEGREE','dms',2,'p_dms','angle_formats.py',263),\n  ('simple -> generic','simple',1,'p_simple','angle_formats.py',274),\n  ('simple -> generic SIMPLE_UNIT','simple',2,'p_simple','angle_formats.py',275),\n  ('arcsecond -> generic SECOND','arcsecond',2,'p_arcsecond','angle_formats.py',284),\n  ('arcminute -> generic MINUTE','arcminute',2,'p_arcminute','angle_formats.py',290),\n]\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":91,"id":14751,"name":"_truncation","nodeType":"Attribute","startLoc":91,"text":"self._truncation"},{"className":"Gaussian2DKernel","col":0,"comment":"\n    2D Gaussian filter kernel.\n\n    The Gaussian filter is a filter with great smoothing properties. It is\n    isotropic and does not produce artifacts.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    x_stddev : float\n        Standard deviation of the Gaussian in x before rotating by theta.\n    y_stddev : float\n        Standard deviation of the Gaussian in y before rotating by theta.\n    theta : float or `~astropy.units.Quantity` ['angle']\n        Rotation angle. If passed as a float, it is assumed to be in radians.\n        The rotation angle increases counterclockwise.\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*stddev + 1⌋.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*stddev + 1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n\n    See Also\n    --------\n    Box2DKernel, Tophat2DKernel, RickerWavelet2DKernel, Ring2DKernel,\n    TrapezoidDisk2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Gaussian2DKernel\n        gaussian_2D_kernel = Gaussian2DKernel(10)\n        plt.imshow(gaussian_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n\n    ","endLoc":168,"id":14752,"nodeType":"Class","startLoc":94,"text":"class Gaussian2DKernel(Kernel2D):\n    \"\"\"\n    2D Gaussian filter kernel.\n\n    The Gaussian filter is a filter with great smoothing properties. It is\n    isotropic and does not produce artifacts.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    x_stddev : float\n        Standard deviation of the Gaussian in x before rotating by theta.\n    y_stddev : float\n        Standard deviation of the Gaussian in y before rotating by theta.\n    theta : float or `~astropy.units.Quantity` ['angle']\n        Rotation angle. If passed as a float, it is assumed to be in radians.\n        The rotation angle increases counterclockwise.\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*stddev + 1⌋.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*stddev + 1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n\n    See Also\n    --------\n    Box2DKernel, Tophat2DKernel, RickerWavelet2DKernel, Ring2DKernel,\n    TrapezoidDisk2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Gaussian2DKernel\n        gaussian_2D_kernel = Gaussian2DKernel(10)\n        plt.imshow(gaussian_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n\n    \"\"\"\n    _separable = True\n    _is_bool = False\n\n    def __init__(self, x_stddev, y_stddev=None, theta=0.0, **kwargs):\n        if y_stddev is None:\n            y_stddev = x_stddev\n        self._model = models.Gaussian2D(1. / (2 * np.pi * x_stddev * y_stddev),\n                                        0, 0, x_stddev=x_stddev,\n                                        y_stddev=y_stddev, theta=theta)\n        self._default_size = _round_up_to_odd_integer(\n            8 * np.max([x_stddev, y_stddev]))\n        super().__init__(**kwargs)\n        self._truncation = np.abs(1. - self._array.sum())"},{"col":4,"comment":"null","endLoc":168,"header":"def __init__(self, x_stddev, y_stddev=None, theta=0.0, **kwargs)","id":14753,"name":"__init__","nodeType":"Function","startLoc":159,"text":"def __init__(self, x_stddev, y_stddev=None, theta=0.0, **kwargs):\n        if y_stddev is None:\n            y_stddev = x_stddev\n        self._model = models.Gaussian2D(1. / (2 * np.pi * x_stddev * y_stddev),\n                                        0, 0, x_stddev=x_stddev,\n                                        y_stddev=y_stddev, theta=theta)\n        self._default_size = _round_up_to_odd_integer(\n            8 * np.max([x_stddev, y_stddev]))\n        super().__init__(**kwargs)\n        self._truncation = np.abs(1. - self._array.sum())"},{"attributeType":"null","col":8,"comment":"null","endLoc":140,"id":14754,"name":"Neff","nodeType":"Attribute","startLoc":140,"text":"self.Neff"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":14755,"name":"_tabversion","nodeType":"Attribute","startLoc":16,"text":"_tabversion"},{"attributeType":"None","col":25,"comment":"null","endLoc":211,"id":14756,"name":"_nu_y_list","nodeType":"Attribute","startLoc":211,"text":"self._nu_y_list"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":14757,"name":"_lr_method","nodeType":"Attribute","startLoc":18,"text":"_lr_method"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":14758,"name":"_lr_signature","nodeType":"Attribute","startLoc":20,"text":"_lr_signature"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":14759,"name":"_lr_action_items","nodeType":"Attribute","startLoc":22,"text":"_lr_action_items"},{"attributeType":"null","col":8,"comment":"null","endLoc":167,"id":14760,"name":"_Tnu0","nodeType":"Attribute","startLoc":167,"text":"self._Tnu0"},{"className":"wCDM","col":0,"comment":"\n    FLRW cosmology with a constant dark energy equation of state and curvature.\n\n    This has one additional attribute beyond those of FLRW.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Ode0 : float\n        Omega dark energy: density of dark energy in units of the critical\n        density at z=0.\n\n    w0 : float, optional\n        Dark energy equation of state at all redshifts. This is\n        pressure/density for dark energy in units where c=1. A cosmological\n        constant has w0=-1.0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import wCDM\n    >>> cosmo = wCDM(H0=70, Om0=0.3, Ode0=0.7, w0=-0.9)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n    ","endLoc":2319,"id":14761,"nodeType":"Class","startLoc":2142,"text":"class wCDM(FLRW):\n    \"\"\"\n    FLRW cosmology with a constant dark energy equation of state and curvature.\n\n    This has one additional attribute beyond those of FLRW.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Ode0 : float\n        Omega dark energy: density of dark energy in units of the critical\n        density at z=0.\n\n    w0 : float, optional\n        Dark energy equation of state at all redshifts. This is\n        pressure/density for dark energy in units where c=1. A cosmological\n        constant has w0=-1.0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import wCDM\n    >>> cosmo = wCDM(H0=70, Om0=0.3, Ode0=0.7, w0=-0.9)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n    \"\"\"\n\n    w0 = Parameter(doc=\"Dark energy equation of state.\", fvalidate=\"float\")\n\n    def __init__(self, H0, Om0, Ode0, w0=-1.0, Tcmb0=0.0*u.K, Neff=3.04,\n                 m_nu=0.0*u.eV, Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=Ode0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n        self.w0 = w0\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wcdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._w0)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wcdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._w0)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wcdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._w0)\n\n    def w(self, z):\n        r\"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is :math:`w(z) = w_0`.\n        \"\"\"\n        z = aszarr(z)\n        return self._w0 * (np.ones(z.shape) if hasattr(z, \"shape\") else 1.0)\n\n    def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by\n        :math:`I = \\left(1 + z\\right)^{3\\left(1 + w_0\\right)}`\n        \"\"\"\n        return (aszarr(z) + 1.0) ** (3.0 * (1. + self._w0))\n\n    def efunc(self, z):\n        \"\"\"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) +\n                       self._Ode0 * zp1 ** (3. * (1. + self._w0)))\n\n    def inv_efunc(self, z):\n        r\"\"\"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The inverse redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return (zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) +\n                self._Ode0 * zp1 ** (3. * (1. + self._w0)))**(-0.5)"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":14762,"name":"_lr_action","nodeType":"Attribute","startLoc":24,"text":"_lr_action"},{"attributeType":"null","col":4,"comment":"null","endLoc":25,"id":14763,"name":"_k","nodeType":"Attribute","startLoc":25,"text":"_k"},{"col":4,"comment":"null","endLoc":2229,"header":"def __init__(self, H0, Om0, Ode0, w0=-1.0, Tcmb0=0.0*u.K, Neff=3.04,\n                 m_nu=0.0*u.eV, Ob0=None, *, name=None, meta=None)","id":14764,"name":"__init__","nodeType":"Function","startLoc":2207,"text":"def __init__(self, H0, Om0, Ode0, w0=-1.0, Tcmb0=0.0*u.K, Neff=3.04,\n                 m_nu=0.0*u.eV, Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=Ode0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n        self.w0 = w0\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wcdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._w0)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wcdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._w0)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wcdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._w0)"},{"attributeType":"null","col":8,"comment":"null","endLoc":25,"id":14765,"name":"_v","nodeType":"Attribute","startLoc":25,"text":"_v"},{"attributeType":"null","col":7,"comment":"null","endLoc":26,"id":14766,"name":"_x","nodeType":"Attribute","startLoc":26,"text":"_x"},{"attributeType":"null","col":10,"comment":"null","endLoc":26,"id":14767,"name":"_y","nodeType":"Attribute","startLoc":26,"text":"_y"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":14768,"name":"_lr_goto_items","nodeType":"Attribute","startLoc":31,"text":"_lr_goto_items"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":14769,"name":"_lr_goto","nodeType":"Attribute","startLoc":33,"text":"_lr_goto"},{"attributeType":"null","col":4,"comment":"null","endLoc":34,"id":14770,"name":"_k","nodeType":"Attribute","startLoc":34,"text":"_k"},{"attributeType":"null","col":8,"comment":"null","endLoc":34,"id":14771,"name":"_v","nodeType":"Attribute","startLoc":34,"text":"_v"},{"attributeType":"null","col":7,"comment":"null","endLoc":35,"id":14772,"name":"_x","nodeType":"Attribute","startLoc":35,"text":"_x"},{"attributeType":"null","col":11,"comment":"null","endLoc":35,"id":14773,"name":"_y","nodeType":"Attribute","startLoc":35,"text":"_y"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":14774,"name":"_lr_productions","nodeType":"Attribute","startLoc":39,"text":"_lr_productions"},{"col":0,"comment":"\n    Convolve two models using `~astropy.convolution.convolve_fft`.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.core.Model`\n        Functional model\n    kernel : `~astropy.modeling.core.Model`\n        Convolution kernel\n    bounding_box : tuple\n        The bounding box which encompasses enough of the support of both\n        the ``model`` and ``kernel`` so that an accurate convolution can be\n        computed.\n    resolution : float\n        The resolution that one wishes to approximate the convolution\n        integral at.\n    cache : optional, bool\n        Default value True. Allow for the storage of the convolution\n        computation for later reuse.\n    **kwargs : dict\n        Keyword arguments to be passed either to `~astropy.convolution.convolve`\n        or `~astropy.convolution.convolve_fft` depending on ``mode``.\n\n    Returns\n    -------\n    default : `~astropy.modeling.core.CompoundModel`\n        Convolved model\n    ","endLoc":996,"header":"def convolve_models_fft(model, kernel, bounding_box, resolution, cache=True, **kwargs)","id":14775,"name":"convolve_models_fft","nodeType":"Function","startLoc":964,"text":"def convolve_models_fft(model, kernel, bounding_box, resolution, cache=True, **kwargs):\n    \"\"\"\n    Convolve two models using `~astropy.convolution.convolve_fft`.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.core.Model`\n        Functional model\n    kernel : `~astropy.modeling.core.Model`\n        Convolution kernel\n    bounding_box : tuple\n        The bounding box which encompasses enough of the support of both\n        the ``model`` and ``kernel`` so that an accurate convolution can be\n        computed.\n    resolution : float\n        The resolution that one wishes to approximate the convolution\n        integral at.\n    cache : optional, bool\n        Default value True. Allow for the storage of the convolution\n        computation for later reuse.\n    **kwargs : dict\n        Keyword arguments to be passed either to `~astropy.convolution.convolve`\n        or `~astropy.convolution.convolve_fft` depending on ``mode``.\n\n    Returns\n    -------\n    default : `~astropy.modeling.core.CompoundModel`\n        Convolved model\n    \"\"\"\n\n    operator = SPECIAL_OPERATORS.add('convolve_fft', partial(convolve_fft, **kwargs))\n\n    return Convolution(operator, model, kernel, bounding_box, resolution, cache)"},{"col":0,"comment":"","endLoc":16,"header":"angle_parsetab.py#<anonymous>","id":14776,"name":"<anonymous>","nodeType":"Function","startLoc":16,"text":"_tabversion = '3.10'\n\n_lr_method = 'LALR'\n\n_lr_signature = 'COLON DEGREE EASTWEST HOUR MINUTE NORTHSOUTH SECOND SIGN SIMPLE_UNIT UFLOAT UINT\\n            angle : sign hms eastwest\\n                  | sign dms dir\\n                  | sign arcsecond dir\\n                  | sign arcminute dir\\n                  | sign simple dir\\n            \\n            sign : SIGN\\n                 |\\n            \\n            eastwest : EASTWEST\\n                     |\\n            \\n            dir : EASTWEST\\n                | NORTHSOUTH\\n                |\\n            \\n            ufloat : UFLOAT\\n                   | UINT\\n            \\n            colon : UINT COLON ufloat\\n                  | UINT COLON UINT COLON ufloat\\n            \\n            spaced : UINT ufloat\\n                   | UINT UINT ufloat\\n            \\n            generic : colon\\n                    | spaced\\n                    | ufloat\\n            \\n            hms : UINT HOUR\\n                | UINT HOUR ufloat\\n                | UINT HOUR UINT MINUTE\\n                | UINT HOUR UFLOAT MINUTE\\n                | UINT HOUR UINT MINUTE ufloat\\n                | UINT HOUR UINT MINUTE ufloat SECOND\\n                | generic HOUR\\n            \\n            dms : UINT DEGREE\\n                | UINT DEGREE ufloat\\n                | UINT DEGREE UINT MINUTE\\n                | UINT DEGREE UFLOAT MINUTE\\n                | UINT DEGREE UINT MINUTE ufloat\\n                | UINT DEGREE UINT MINUTE ufloat SECOND\\n                | generic DEGREE\\n            \\n            simple : generic\\n                   | generic SIMPLE_UNIT\\n            \\n            arcsecond : generic SECOND\\n            \\n            arcminute : generic MINUTE\\n            '\n\n_lr_action_items = {'SIGN':([0,],[3,]),'UINT':([0,2,3,9,23,24,26,27,43,45,47,],[-7,9,-6,23,33,35,38,41,33,33,33,]),'UFLOAT':([0,2,3,9,23,24,26,27,43,45,47,],[-7,11,-6,11,11,37,40,11,11,11,11,]),'$end':([1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,48,49,50,51,52,],[0,-9,-12,-12,-12,-12,-14,-21,-13,-36,-19,-20,-1,-8,-2,-10,-11,-3,-4,-5,-14,-22,-17,-29,-28,-35,-38,-39,-37,-14,-18,-14,-23,-13,-14,-30,-13,-14,-15,-24,-25,-31,-32,-26,-33,-16,-27,-34,]),'EASTWEST':([4,5,6,7,8,9,10,11,12,13,14,23,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,48,49,50,51,52,],[16,18,18,18,18,-14,-21,-13,-36,-19,-20,-14,-22,-17,-29,-28,-35,-38,-39,-37,-14,-18,-14,-23,-13,-14,-30,-13,-14,-15,-24,-25,-31,-32,-26,-33,-16,-27,-34,]),'NORTHSOUTH':([5,6,7,8,9,10,11,12,13,14,23,25,26,29,30,31,32,33,34,38,39,40,41,42,45,46,49,50,52,],[19,19,19,19,-14,-21,-13,-36,-19,-20,-14,-17,-29,-35,-38,-39,-37,-14,-18,-14,-30,-13,-14,-15,-31,-32,-33,-16,-34,]),'HOUR':([9,10,11,12,13,14,23,25,33,34,41,42,50,],[24,-21,-13,28,-19,-20,-14,-17,-14,-18,-14,-15,-16,]),'DEGREE':([9,10,11,12,13,14,23,25,33,34,41,42,50,],[26,-21,-13,29,-19,-20,-14,-17,-14,-18,-14,-15,-16,]),'COLON':([9,41,],[27,47,]),'SECOND':([9,10,11,12,13,14,23,25,33,34,41,42,48,49,50,],[-14,-21,-13,30,-19,-20,-14,-17,-14,-18,-14,-15,51,52,-16,]),'MINUTE':([9,10,11,12,13,14,23,25,33,34,35,37,38,40,41,42,50,],[-14,-21,-13,31,-19,-20,-14,-17,-14,-18,43,44,45,46,-14,-15,-16,]),'SIMPLE_UNIT':([9,10,11,12,13,14,23,25,33,34,41,42,50,],[-14,-21,-13,32,-19,-20,-14,-17,-14,-18,-14,-15,-16,]),}\n\n_lr_action = {}\n\nfor _k, _v in _lr_action_items.items():\n   for _x,_y in zip(_v[0],_v[1]):\n      if not _x in _lr_action:  _lr_action[_x] = {}\n      _lr_action[_x][_k] = _y\n\ndel _lr_action_items\n\n_lr_goto_items = {'angle':([0,],[1,]),'sign':([0,],[2,]),'hms':([2,],[4,]),'dms':([2,],[5,]),'arcsecond':([2,],[6,]),'arcminute':([2,],[7,]),'simple':([2,],[8,]),'ufloat':([2,9,23,24,26,27,43,45,47,],[10,25,34,36,39,42,48,49,50,]),'generic':([2,],[12,]),'colon':([2,],[13,]),'spaced':([2,],[14,]),'eastwest':([4,],[15,]),'dir':([5,6,7,8,],[17,20,21,22,]),}\n\n_lr_goto = {}\n\nfor _k, _v in _lr_goto_items.items():\n   for _x, _y in zip(_v[0], _v[1]):\n       if not _x in _lr_goto: _lr_goto[_x] = {}\n       _lr_goto[_x][_k] = _y\n\ndel _lr_goto_items\n\n_lr_productions = [\n  (\"S' -> angle\",\"S'\",1,None,None,None),\n  ('angle -> sign hms eastwest','angle',3,'p_angle','angle_formats.py',159),\n  ('angle -> sign dms dir','angle',3,'p_angle','angle_formats.py',160),\n  ('angle -> sign arcsecond dir','angle',3,'p_angle','angle_formats.py',161),\n  ('angle -> sign arcminute dir','angle',3,'p_angle','angle_formats.py',162),\n  ('angle -> sign simple dir','angle',3,'p_angle','angle_formats.py',163),\n  ('sign -> SIGN','sign',1,'p_sign','angle_formats.py',174),\n  ('sign -> <empty>','sign',0,'p_sign','angle_formats.py',175),\n  ('eastwest -> EASTWEST','eastwest',1,'p_eastwest','angle_formats.py',184),\n  ('eastwest -> <empty>','eastwest',0,'p_eastwest','angle_formats.py',185),\n  ('dir -> EASTWEST','dir',1,'p_dir','angle_formats.py',194),\n  ('dir -> NORTHSOUTH','dir',1,'p_dir','angle_formats.py',195),\n  ('dir -> <empty>','dir',0,'p_dir','angle_formats.py',196),\n  ('ufloat -> UFLOAT','ufloat',1,'p_ufloat','angle_formats.py',205),\n  ('ufloat -> UINT','ufloat',1,'p_ufloat','angle_formats.py',206),\n  ('colon -> UINT COLON ufloat','colon',3,'p_colon','angle_formats.py',212),\n  ('colon -> UINT COLON UINT COLON ufloat','colon',5,'p_colon','angle_formats.py',213),\n  ('spaced -> UINT ufloat','spaced',2,'p_spaced','angle_formats.py',222),\n  ('spaced -> UINT UINT ufloat','spaced',3,'p_spaced','angle_formats.py',223),\n  ('generic -> colon','generic',1,'p_generic','angle_formats.py',232),\n  ('generic -> spaced','generic',1,'p_generic','angle_formats.py',233),\n  ('generic -> ufloat','generic',1,'p_generic','angle_formats.py',234),\n  ('hms -> UINT HOUR','hms',2,'p_hms','angle_formats.py',240),\n  ('hms -> UINT HOUR ufloat','hms',3,'p_hms','angle_formats.py',241),\n  ('hms -> UINT HOUR UINT MINUTE','hms',4,'p_hms','angle_formats.py',242),\n  ('hms -> UINT HOUR UFLOAT MINUTE','hms',4,'p_hms','angle_formats.py',243),\n  ('hms -> UINT HOUR UINT MINUTE ufloat','hms',5,'p_hms','angle_formats.py',244),\n  ('hms -> UINT HOUR UINT MINUTE ufloat SECOND','hms',6,'p_hms','angle_formats.py',245),\n  ('hms -> generic HOUR','hms',2,'p_hms','angle_formats.py',246),\n  ('dms -> UINT DEGREE','dms',2,'p_dms','angle_formats.py',257),\n  ('dms -> UINT DEGREE ufloat','dms',3,'p_dms','angle_formats.py',258),\n  ('dms -> UINT DEGREE UINT MINUTE','dms',4,'p_dms','angle_formats.py',259),\n  ('dms -> UINT DEGREE UFLOAT MINUTE','dms',4,'p_dms','angle_formats.py',260),\n  ('dms -> UINT DEGREE UINT MINUTE ufloat','dms',5,'p_dms','angle_formats.py',261),\n  ('dms -> UINT DEGREE UINT MINUTE ufloat SECOND','dms',6,'p_dms','angle_formats.py',262),\n  ('dms -> generic DEGREE','dms',2,'p_dms','angle_formats.py',263),\n  ('simple -> generic','simple',1,'p_simple','angle_formats.py',274),\n  ('simple -> generic SIMPLE_UNIT','simple',2,'p_simple','angle_formats.py',275),\n  ('arcsecond -> generic SECOND','arcsecond',2,'p_arcsecond','angle_formats.py',284),\n  ('arcminute -> generic MINUTE','arcminute',2,'p_arcminute','angle_formats.py',290),\n]"},{"fileName":"earth_orientation.py","filePath":"astropy/coordinates","id":14777,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module contains standard functions for earth orientation, such as\nprecession and nutation.\n\nThis module is (currently) not intended to be part of the public API, but\nis instead primarily for internal use in `coordinates`\n\"\"\"\n\n\nimport numpy as np\n\nfrom astropy.time import Time\nfrom astropy import units as u\nfrom .matrix_utilities import rotation_matrix, matrix_product, matrix_transpose\n\n\njd1950 = Time('B1950').jd\njd2000 = Time('J2000').jd\n_asecperrad = u.radian.to(u.arcsec)\n\n\ndef eccentricity(jd):\n    \"\"\"\n    Eccentricity of the Earth's orbit at the requested Julian Date.\n\n    Parameters\n    ----------\n    jd : scalar or array-like\n        Julian date at which to compute the eccentricity\n\n    Returns\n    -------\n    eccentricity : scalar or array\n        The eccentricity (or array of eccentricities)\n\n    References\n    ----------\n    * Explanatory Supplement to the Astronomical Almanac: P. Kenneth\n      Seidelmann (ed), University Science Books (1992).\n    \"\"\"\n    T = (jd - jd1950) / 36525.0\n\n    p = (-0.000000126, - 0.00004193, 0.01673011)\n\n    return np.polyval(p, T)\n\n\ndef mean_lon_of_perigee(jd):\n    \"\"\"\n    Computes the mean longitude of perigee of the Earth's orbit at the\n    requested Julian Date.\n\n    Parameters\n    ----------\n    jd : scalar or array-like\n        Julian date at which to compute the mean longitude of perigee\n\n    Returns\n    -------\n    mean_lon_of_perigee : scalar or array\n        Mean longitude of perigee in degrees (or array of mean longitudes)\n\n    References\n    ----------\n    * Explanatory Supplement to the Astronomical Almanac: P. Kenneth\n      Seidelmann (ed), University Science Books (1992).\n    \"\"\"\n    T = (jd - jd1950) / 36525.0\n\n    p = (0.012, 1.65, 6190.67, 1015489.951)\n\n    return np.polyval(p, T) / 3600.\n\n\ndef obliquity(jd, algorithm=2006):\n    \"\"\"\n    Computes the obliquity of the Earth at the requested Julian Date.\n\n    Parameters\n    ----------\n    jd : scalar or array-like\n        Julian date at which to compute the obliquity\n    algorithm : int\n        Year of algorithm based on IAU adoption. Can be 2006, 2000 or 1980. The\n        2006 algorithm is mentioned in Circular 179, but the canonical reference\n        for the IAU adoption is apparently Hilton et al. 06 is composed of the\n        1980 algorithm with a precession-rate correction due to the 2000\n        precession models, and a description of the 1980 algorithm can be found\n        in the Explanatory Supplement to the Astronomical Almanac.\n\n    Returns\n    -------\n    obliquity : scalar or array\n        Mean obliquity in degrees (or array of obliquities)\n\n    References\n    ----------\n    * Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351. 2000\n    * USNO Circular 179\n    * Explanatory Supplement to the Astronomical Almanac: P. Kenneth\n      Seidelmann (ed), University Science Books (1992).\n    \"\"\"\n    T = (jd - jd2000) / 36525.0\n\n    if algorithm == 2006:\n        p = (-0.0000000434, -0.000000576, 0.00200340, -0.0001831, -46.836769, 84381.406)\n        corr = 0\n    elif algorithm == 2000:\n        p = (0.001813, -0.00059, -46.8150, 84381.448)\n        corr = -0.02524 * T\n    elif algorithm == 1980:\n        p = (0.001813, -0.00059, -46.8150, 84381.448)\n        corr = 0\n    else:\n        raise ValueError('invalid algorithm year for computing obliquity')\n\n    return (np.polyval(p, T) + corr) / 3600.\n\n\n# TODO: replace this with SOFA equivalent\ndef precession_matrix_Capitaine(fromepoch, toepoch):\n    \"\"\"\n    Computes the precession matrix from one Julian epoch to another.\n    The exact method is based on Capitaine et al. 2003, which should\n    match the IAU 2006 standard.\n\n    Parameters\n    ----------\n    fromepoch : `~astropy.time.Time`\n        The epoch to precess from.\n    toepoch : `~astropy.time.Time`\n        The epoch to precess to.\n\n    Returns\n    -------\n    pmatrix : 3x3 array\n        Precession matrix to get from ``fromepoch`` to ``toepoch``\n\n    References\n    ----------\n    USNO Circular 179\n    \"\"\"\n    mat_fromto2000 = matrix_transpose(\n        _precess_from_J2000_Capitaine(fromepoch.jyear))\n    mat_2000toto = _precess_from_J2000_Capitaine(toepoch.jyear)\n\n    return np.dot(mat_2000toto, mat_fromto2000)\n\n\ndef _precess_from_J2000_Capitaine(epoch):\n    \"\"\"\n    Computes the precession matrix from J2000 to the given Julian Epoch.\n    Expression from from Capitaine et al. 2003 as expressed in the USNO\n    Circular 179.  This should match the IAU 2006 standard from SOFA.\n\n    Parameters\n    ----------\n    epoch : scalar\n        The epoch as a Julian year number (e.g. J2000 is 2000.0)\n\n    \"\"\"\n    T = (epoch - 2000.0) / 100.0\n    # from USNO circular\n    pzeta = (-0.0000003173, -0.000005971, 0.01801828, 0.2988499, 2306.083227, 2.650545)\n    pz = (-0.0000002904, -0.000028596, 0.01826837, 1.0927348, 2306.077181, -2.650545)\n    ptheta = (-0.0000001274, -0.000007089, -0.04182264, -0.4294934, 2004.191903, 0)\n    zeta = np.polyval(pzeta, T) / 3600.0\n    z = np.polyval(pz, T) / 3600.0\n    theta = np.polyval(ptheta, T) / 3600.0\n\n    return matrix_product(rotation_matrix(-z, 'z'),\n                          rotation_matrix(theta, 'y'),\n                          rotation_matrix(-zeta, 'z'))\n\n\ndef _precession_matrix_besselian(epoch1, epoch2):\n    \"\"\"\n    Computes the precession matrix from one Besselian epoch to another using\n    Newcomb's method.\n\n    ``epoch1`` and ``epoch2`` are in Besselian year numbers.\n    \"\"\"\n    # tropical years\n    t1 = (epoch1 - 1850.0) / 1000.0\n    t2 = (epoch2 - 1850.0) / 1000.0\n    dt = t2 - t1\n\n    zeta1 = 23035.545 + t1 * 139.720 + 0.060 * t1 * t1\n    zeta2 = 30.240 - 0.27 * t1\n    zeta3 = 17.995\n    pzeta = (zeta3, zeta2, zeta1, 0)\n    zeta = np.polyval(pzeta, dt) / 3600\n\n    z1 = 23035.545 + t1 * 139.720 + 0.060 * t1 * t1\n    z2 = 109.480 + 0.39 * t1\n    z3 = 18.325\n    pz = (z3, z2, z1, 0)\n    z = np.polyval(pz, dt) / 3600\n\n    theta1 = 20051.12 - 85.29 * t1 - 0.37 * t1 * t1\n    theta2 = -42.65 - 0.37 * t1\n    theta3 = -41.8\n    ptheta = (theta3, theta2, theta1, 0)\n    theta = np.polyval(ptheta, dt) / 3600\n\n    return matrix_product(rotation_matrix(-z, 'z'),\n                          rotation_matrix(theta, 'y'),\n                          rotation_matrix(-zeta, 'z'))\n\n\ndef _load_nutation_data(datastr, seriestype):\n    \"\"\"\n    Loads nutation series from data stored in string form.\n\n    Seriestype can be 'lunisolar' or 'planetary'\n    \"\"\"\n\n    if seriestype == 'lunisolar':\n        dtypes = [('nl', int),\n                  ('nlp', int),\n                  ('nF', int),\n                  ('nD', int),\n                  ('nOm', int),\n                  ('ps', float),\n                  ('pst', float),\n                  ('pc', float),\n                  ('ec', float),\n                  ('ect', float),\n                  ('es', float)]\n    elif seriestype == 'planetary':\n        dtypes = [('nl', int),\n                  ('nF', int),\n                  ('nD', int),\n                  ('nOm', int),\n                  ('nme', int),\n                  ('nve', int),\n                  ('nea', int),\n                  ('nma', int),\n                  ('nju', int),\n                  ('nsa', int),\n                  ('nur', int),\n                  ('nne', int),\n                  ('npa', int),\n                  ('sp', int),\n                  ('cp', int),\n                  ('se', int),\n                  ('ce', int)]\n    else:\n        raise ValueError('requested invalid nutation series type')\n\n    lines = [l for l in datastr.split('\\n')\n             if not l.startswith('#') if not l.strip() == '']\n\n    lists = [[] for _ in dtypes]\n    for l in lines:\n        for i, e in enumerate(l.split(' ')):\n            lists[i].append(dtypes[i][1](e))\n    return np.rec.fromarrays(lists, names=[e[0] for e in dtypes])\n\n\n_nut_data_00b = \"\"\"\n#l lprime F D Omega longitude_sin longitude_sin*t longitude_cos obliquity_cos obliquity_cos*t,obliquity_sin\n\n0 0 0 0 1 -172064161.0 -174666.0 33386.0 92052331.0 9086.0 15377.0\n0 0 2 -2 2 -13170906.0 -1675.0 -13696.0 5730336.0 -3015.0 -4587.0\n0 0 2 0 2 -2276413.0 -234.0 2796.0 978459.0 -485.0 1374.0\n0 0 0 0 2 2074554.0 207.0 -698.0 -897492.0 470.0 -291.0\n0 1 0 0 0 1475877.0 -3633.0 11817.0 73871.0 -184.0 -1924.0\n0 1 2 -2 2 -516821.0 1226.0 -524.0 224386.0 -677.0 -174.0\n1 0 0 0 0 711159.0 73.0 -872.0 -6750.0 0.0 358.0\n0 0 2 0 1 -387298.0 -367.0 380.0 200728.0 18.0 318.0\n1 0 2 0 2 -301461.0 -36.0 816.0 129025.0 -63.0 367.0\n0 -1 2 -2 2 215829.0 -494.0 111.0 -95929.0 299.0 132.0\n0 0 2 -2 1 128227.0 137.0 181.0 -68982.0 -9.0 39.0\n-1 0 2 0 2 123457.0 11.0 19.0 -53311.0 32.0 -4.0\n-1 0 0 2 0 156994.0 10.0 -168.0 -1235.0 0.0 82.0\n1 0 0 0 1 63110.0 63.0 27.0 -33228.0 0.0 -9.0\n-1 0 0 0 1 -57976.0 -63.0 -189.0 31429.0 0.0 -75.0\n-1 0 2 2 2 -59641.0 -11.0 149.0 25543.0 -11.0 66.0\n1 0 2 0 1 -51613.0 -42.0 129.0 26366.0 0.0 78.0\n-2 0 2 0 1 45893.0 50.0 31.0 -24236.0 -10.0 20.0\n0 0 0 2 0 63384.0 11.0 -150.0 -1220.0 0.0 29.0\n0 0 2 2 2 -38571.0 -1.0 158.0 16452.0 -11.0 68.0\n0 -2 2 -2 2 32481.0 0.0 0.0 -13870.0 0.0 0.0\n-2 0 0 2 0 -47722.0 0.0 -18.0 477.0 0.0 -25.0\n2 0 2 0 2 -31046.0 -1.0 131.0 13238.0 -11.0 59.0\n1 0 2 -2 2 28593.0 0.0 -1.0 -12338.0 10.0 -3.0\n-1 0 2 0 1 20441.0 21.0 10.0 -10758.0 0.0 -3.0\n2 0 0 0 0 29243.0 0.0 -74.0 -609.0 0.0 13.0\n0 0 2 0 0 25887.0 0.0 -66.0 -550.0 0.0 11.0\n0 1 0 0 1 -14053.0 -25.0 79.0 8551.0 -2.0 -45.0\n-1 0 0 2 1 15164.0 10.0 11.0 -8001.0 0.0 -1.0\n0 2 2 -2 2 -15794.0 72.0 -16.0 6850.0 -42.0 -5.0\n0 0 -2 2 0 21783.0 0.0 13.0 -167.0 0.0 13.0\n1 0 0 -2 1 -12873.0 -10.0 -37.0 6953.0 0.0 -14.0\n0 -1 0 0 1 -12654.0 11.0 63.0 6415.0 0.0 26.0\n-1 0 2 2 1 -10204.0 0.0 25.0 5222.0 0.0 15.0\n0 2 0 0 0 16707.0 -85.0 -10.0 168.0 -1.0 10.0\n1 0 2 2 2 -7691.0 0.0 44.0 3268.0 0.0 19.0\n-2 0 2 0 0 -11024.0 0.0 -14.0 104.0 0.0 2.0\n0 1 2 0 2 7566.0 -21.0 -11.0 -3250.0 0.0 -5.0\n0 0 2 2 1 -6637.0 -11.0 25.0 3353.0 0.0 14.0\n0 -1 2 0 2 -7141.0 21.0 8.0 3070.0 0.0 4.0\n0 0 0 2 1 -6302.0 -11.0 2.0 3272.0 0.0 4.0\n1 0 2 -2 1 5800.0 10.0 2.0 -3045.0 0.0 -1.0\n2 0 2 -2 2 6443.0 0.0 -7.0 -2768.0 0.0 -4.0\n-2 0 0 2 1 -5774.0 -11.0 -15.0 3041.0 0.0 -5.0\n2 0 2 0 1 -5350.0 0.0 21.0 2695.0 0.0 12.0\n0 -1 2 -2 1 -4752.0 -11.0 -3.0 2719.0 0.0 -3.0\n0 0 0 -2 1 -4940.0 -11.0 -21.0 2720.0 0.0 -9.0\n-1 -1 0 2 0 7350.0 0.0 -8.0 -51.0 0.0 4.0\n2 0 0 -2 1 4065.0 0.0 6.0 -2206.0 0.0 1.0\n1 0 0 2 0 6579.0 0.0 -24.0 -199.0 0.0 2.0\n0 1 2 -2 1 3579.0 0.0 5.0 -1900.0 0.0 1.0\n1 -1 0 0 0 4725.0 0.0 -6.0 -41.0 0.0 3.0\n-2 0 2 0 2 -3075.0 0.0 -2.0 1313.0 0.0 -1.0\n3 0 2 0 2 -2904.0 0.0 15.0 1233.0 0.0 7.0\n0 -1 0 2 0 4348.0 0.0 -10.0 -81.0 0.0 2.0\n1 -1 2 0 2 -2878.0 0.0 8.0 1232.0 0.0 4.0\n0 0 0 1 0 -4230.0 0.0 5.0 -20.0 0.0 -2.0\n-1 -1 2 2 2 -2819.0 0.0 7.0 1207.0 0.0 3.0\n-1 0 2 0 0 -4056.0 0.0 5.0 40.0 0.0 -2.0\n0 -1 2 2 2 -2647.0 0.0 11.0 1129.0 0.0 5.0\n-2 0 0 0 1 -2294.0 0.0 -10.0 1266.0 0.0 -4.0\n1 1 2 0 2 2481.0 0.0 -7.0 -1062.0 0.0 -3.0\n2 0 0 0 1 2179.0 0.0 -2.0 -1129.0 0.0 -2.0\n-1 1 0 1 0 3276.0 0.0 1.0 -9.0 0.0 0.0\n1 1 0 0 0 -3389.0 0.0 5.0 35.0 0.0 -2.0\n1 0 2 0 0 3339.0 0.0 -13.0 -107.0 0.0 1.0\n-1 0 2 -2 1 -1987.0 0.0 -6.0 1073.0 0.0 -2.0\n1 0 0 0 2 -1981.0 0.0 0.0 854.0 0.0 0.0\n-1 0 0 1 0 4026.0 0.0 -353.0 -553.0 0.0 -139.0\n0 0 2 1 2 1660.0 0.0 -5.0 -710.0 0.0 -2.0\n-1 0 2 4 2 -1521.0 0.0 9.0 647.0 0.0 4.0\n-1 1 0 1 1 1314.0 0.0 0.0 -700.0 0.0 0.0\n0 -2 2 -2 1 -1283.0 0.0 0.0 672.0 0.0 0.0\n1 0 2 2 1 -1331.0 0.0 8.0 663.0 0.0 4.0\n-2 0 2 2 2 1383.0 0.0 -2.0 -594.0 0.0 -2.0\n-1 0 0 0 2 1405.0 0.0 4.0 -610.0 0.0 2.0\n1 1 2 -2 2 1290.0 0.0 0.0 -556.0 0.0 0.0\n\"\"\"[1:-1]\n_nut_data_00b = _load_nutation_data(_nut_data_00b, 'lunisolar')\n\n# TODO: replace w/SOFA equivalent\n\n\ndef nutation_components2000B(jd):\n    \"\"\"\n    Computes nutation components following the IAU 2000B specification\n\n    Parameters\n    ----------\n    jd : scalar\n        epoch at which to compute the nutation components as a JD\n\n    Returns\n    -------\n    eps : float\n        epsilon in radians\n    dpsi : float\n        dpsi in radians\n    deps : float\n        depsilon in raidans\n    \"\"\"\n    epsa = np.radians(obliquity(jd, 2000))\n    t = (jd - jd2000) / 36525\n\n    # Fundamental (Delaunay) arguments from Simon et al. (1994) via SOFA\n    # Mean anomaly of moon\n    el = ((485868.249036 + 1717915923.2178 * t) % 1296000) / _asecperrad\n    # Mean anomaly of sun\n    elp = ((1287104.79305 + 129596581.0481 * t) % 1296000) / _asecperrad\n    # Mean argument of the latitude of Moon\n    F = ((335779.526232 + 1739527262.8478 * t) % 1296000) / _asecperrad\n    # Mean elongation of the Moon from Sun\n    D = ((1072260.70369 + 1602961601.2090 * t) % 1296000) / _asecperrad\n    # Mean longitude of the ascending node of Moon\n    Om = ((450160.398036 + -6962890.5431 * t) % 1296000) / _asecperrad\n\n    # compute nutation series using array loaded from data directory\n    dat = _nut_data_00b\n    arg = dat.nl * el + dat.nlp * elp + dat.nF * F + dat.nD * D + dat.nOm * Om\n    sarg = np.sin(arg)\n    carg = np.cos(arg)\n\n    p1u_asecperrad = _asecperrad * 1e7  # 0.1 microasrcsecperrad\n    dpsils = np.sum((dat.ps + dat.pst * t) * sarg + dat.pc * carg) / p1u_asecperrad\n    depsls = np.sum((dat.ec + dat.ect * t) * carg + dat.es * sarg) / p1u_asecperrad\n    # fixed offset in place of planetary tersm\n    m_asecperrad = _asecperrad * 1e3  # milliarcsec per rad\n    dpsipl = -0.135 / m_asecperrad\n    depspl = 0.388 / m_asecperrad\n\n    return epsa, dpsils + dpsipl, depsls + depspl  # all in radians\n\n\ndef nutation_matrix(epoch):\n    \"\"\"\n    Nutation matrix generated from nutation components.\n\n    Matrix converts from mean coordinate to true coordinate as\n    r_true = M * r_mean\n    \"\"\"\n    # TODO: implement higher precision 2006/2000A model if requested/needed\n    epsa, dpsi, deps = nutation_components2000B(epoch.jd)  # all in radians\n\n    return matrix_product(rotation_matrix(-(epsa + deps), 'x', False),\n                          rotation_matrix(-dpsi, 'z', False),\n                          rotation_matrix(epsa, 'x', False))\n"},{"col":4,"comment":"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is :math:`w(z) = w_0`.\n        ","endLoc":2253,"header":"def w(self, z)","id":14778,"name":"w","nodeType":"Function","startLoc":2231,"text":"def w(self, z):\n        r\"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is :math:`w(z) = w_0`.\n        \"\"\"\n        z = aszarr(z)\n        return self._w0 * (np.ones(z.shape) if hasattr(z, \"shape\") else 1.0)"},{"col":0,"comment":"\n    Given a data set containing NaNs, replace the NaNs by interpolating from\n    neighboring data points with a given kernel.\n\n    Parameters\n    ----------\n    array : `numpy.ndarray`\n        Array to be convolved with ``kernel``.  It can be of any\n        dimensionality, though only 1, 2, and 3d arrays have been tested.\n    kernel : `numpy.ndarray` or `astropy.convolution.Kernel`\n        The convolution kernel. The number of dimensions should match those\n        for the array.  The dimensions *do not* have to be odd in all directions,\n        unlike in the non-fft `convolve` function.  The kernel will be\n        normalized if ``normalize_kernel`` is set.  It is assumed to be centered\n        (i.e., shifts may result if your kernel is asymmetric).  The kernel\n        *must be normalizable* (i.e., its sum cannot be zero).\n    convolve : `convolve` or `convolve_fft`\n        One of the two convolution functions defined in this package.\n\n    Returns\n    -------\n    newarray : `numpy.ndarray`\n        A copy of the original array with NaN pixels replaced with their\n        interpolated counterparts\n    ","endLoc":927,"header":"def interpolate_replace_nans(array, kernel, convolve=convolve, **kwargs)","id":14779,"name":"interpolate_replace_nans","nodeType":"Function","startLoc":889,"text":"def interpolate_replace_nans(array, kernel, convolve=convolve, **kwargs):\n    \"\"\"\n    Given a data set containing NaNs, replace the NaNs by interpolating from\n    neighboring data points with a given kernel.\n\n    Parameters\n    ----------\n    array : `numpy.ndarray`\n        Array to be convolved with ``kernel``.  It can be of any\n        dimensionality, though only 1, 2, and 3d arrays have been tested.\n    kernel : `numpy.ndarray` or `astropy.convolution.Kernel`\n        The convolution kernel. The number of dimensions should match those\n        for the array.  The dimensions *do not* have to be odd in all directions,\n        unlike in the non-fft `convolve` function.  The kernel will be\n        normalized if ``normalize_kernel`` is set.  It is assumed to be centered\n        (i.e., shifts may result if your kernel is asymmetric).  The kernel\n        *must be normalizable* (i.e., its sum cannot be zero).\n    convolve : `convolve` or `convolve_fft`\n        One of the two convolution functions defined in this package.\n\n    Returns\n    -------\n    newarray : `numpy.ndarray`\n        A copy of the original array with NaN pixels replaced with their\n        interpolated counterparts\n    \"\"\"\n\n    if not np.any(np.isnan(array)):\n        return array.copy()\n\n    newarray = array.copy()\n\n    convolved = convolve(array, kernel, nan_treatment='interpolate',\n                         normalize_kernel=True, preserve_nan=False, **kwargs)\n\n    isnan = np.isnan(array)\n    newarray[isnan] = convolved[isnan]\n\n    return newarray"},{"col":4,"comment":"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by\n        :math:`I = \\left(1 + z\\right)^{3\\left(1 + w_0\\right)}`\n        ","endLoc":2275,"header":"def de_density_scale(self, z)","id":14780,"name":"de_density_scale","nodeType":"Function","startLoc":2255,"text":"def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by\n        :math:`I = \\left(1 + z\\right)^{3\\left(1 + w_0\\right)}`\n        \"\"\"\n        return (aszarr(z) + 1.0) ** (3.0 * (1. + self._w0))"},{"col":0,"comment":"\n    Eccentricity of the Earth's orbit at the requested Julian Date.\n\n    Parameters\n    ----------\n    jd : scalar or array-like\n        Julian date at which to compute the eccentricity\n\n    Returns\n    -------\n    eccentricity : scalar or array\n        The eccentricity (or array of eccentricities)\n\n    References\n    ----------\n    * Explanatory Supplement to the Astronomical Almanac: P. Kenneth\n      Seidelmann (ed), University Science Books (1992).\n    ","endLoc":47,"header":"def eccentricity(jd)","id":14781,"name":"eccentricity","nodeType":"Function","startLoc":24,"text":"def eccentricity(jd):\n    \"\"\"\n    Eccentricity of the Earth's orbit at the requested Julian Date.\n\n    Parameters\n    ----------\n    jd : scalar or array-like\n        Julian date at which to compute the eccentricity\n\n    Returns\n    -------\n    eccentricity : scalar or array\n        The eccentricity (or array of eccentricities)\n\n    References\n    ----------\n    * Explanatory Supplement to the Astronomical Almanac: P. Kenneth\n      Seidelmann (ed), University Science Books (1992).\n    \"\"\"\n    T = (jd - jd1950) / 36525.0\n\n    p = (-0.000000126, - 0.00004193, 0.01673011)\n\n    return np.polyval(p, T)"},{"col":0,"comment":"\n    Computes the mean longitude of perigee of the Earth's orbit at the\n    requested Julian Date.\n\n    Parameters\n    ----------\n    jd : scalar or array-like\n        Julian date at which to compute the mean longitude of perigee\n\n    Returns\n    -------\n    mean_lon_of_perigee : scalar or array\n        Mean longitude of perigee in degrees (or array of mean longitudes)\n\n    References\n    ----------\n    * Explanatory Supplement to the Astronomical Almanac: P. Kenneth\n      Seidelmann (ed), University Science Books (1992).\n    ","endLoc":74,"header":"def mean_lon_of_perigee(jd)","id":14782,"name":"mean_lon_of_perigee","nodeType":"Function","startLoc":50,"text":"def mean_lon_of_perigee(jd):\n    \"\"\"\n    Computes the mean longitude of perigee of the Earth's orbit at the\n    requested Julian Date.\n\n    Parameters\n    ----------\n    jd : scalar or array-like\n        Julian date at which to compute the mean longitude of perigee\n\n    Returns\n    -------\n    mean_lon_of_perigee : scalar or array\n        Mean longitude of perigee in degrees (or array of mean longitudes)\n\n    References\n    ----------\n    * Explanatory Supplement to the Astronomical Almanac: P. Kenneth\n      Seidelmann (ed), University Science Books (1992).\n    \"\"\"\n    T = (jd - jd1950) / 36525.0\n\n    p = (0.012, 1.65, 6190.67, 1015489.951)\n\n    return np.polyval(p, T) / 3600."},{"col":4,"comment":"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        ","endLoc":2297,"header":"def efunc(self, z)","id":14783,"name":"efunc","nodeType":"Function","startLoc":2277,"text":"def efunc(self, z):\n        \"\"\"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) +\n                       self._Ode0 * zp1 ** (3. * (1. + self._w0)))"},{"col":0,"comment":"\n    Computes the obliquity of the Earth at the requested Julian Date.\n\n    Parameters\n    ----------\n    jd : scalar or array-like\n        Julian date at which to compute the obliquity\n    algorithm : int\n        Year of algorithm based on IAU adoption. Can be 2006, 2000 or 1980. The\n        2006 algorithm is mentioned in Circular 179, but the canonical reference\n        for the IAU adoption is apparently Hilton et al. 06 is composed of the\n        1980 algorithm with a precession-rate correction due to the 2000\n        precession models, and a description of the 1980 algorithm can be found\n        in the Explanatory Supplement to the Astronomical Almanac.\n\n    Returns\n    -------\n    obliquity : scalar or array\n        Mean obliquity in degrees (or array of obliquities)\n\n    References\n    ----------\n    * Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351. 2000\n    * USNO Circular 179\n    * Explanatory Supplement to the Astronomical Almanac: P. Kenneth\n      Seidelmann (ed), University Science Books (1992).\n    ","endLoc":119,"header":"def obliquity(jd, algorithm=2006)","id":14784,"name":"obliquity","nodeType":"Function","startLoc":77,"text":"def obliquity(jd, algorithm=2006):\n    \"\"\"\n    Computes the obliquity of the Earth at the requested Julian Date.\n\n    Parameters\n    ----------\n    jd : scalar or array-like\n        Julian date at which to compute the obliquity\n    algorithm : int\n        Year of algorithm based on IAU adoption. Can be 2006, 2000 or 1980. The\n        2006 algorithm is mentioned in Circular 179, but the canonical reference\n        for the IAU adoption is apparently Hilton et al. 06 is composed of the\n        1980 algorithm with a precession-rate correction due to the 2000\n        precession models, and a description of the 1980 algorithm can be found\n        in the Explanatory Supplement to the Astronomical Almanac.\n\n    Returns\n    -------\n    obliquity : scalar or array\n        Mean obliquity in degrees (or array of obliquities)\n\n    References\n    ----------\n    * Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351. 2000\n    * USNO Circular 179\n    * Explanatory Supplement to the Astronomical Almanac: P. Kenneth\n      Seidelmann (ed), University Science Books (1992).\n    \"\"\"\n    T = (jd - jd2000) / 36525.0\n\n    if algorithm == 2006:\n        p = (-0.0000000434, -0.000000576, 0.00200340, -0.0001831, -46.836769, 84381.406)\n        corr = 0\n    elif algorithm == 2000:\n        p = (0.001813, -0.00059, -46.8150, 84381.448)\n        corr = -0.02524 * T\n    elif algorithm == 1980:\n        p = (0.001813, -0.00059, -46.8150, 84381.448)\n        corr = 0\n    else:\n        raise ValueError('invalid algorithm year for computing obliquity')\n\n    return (np.polyval(p, T) + corr) / 3600."},{"col":0,"comment":"\n    Computes the precession matrix from one Julian epoch to another.\n    The exact method is based on Capitaine et al. 2003, which should\n    match the IAU 2006 standard.\n\n    Parameters\n    ----------\n    fromepoch : `~astropy.time.Time`\n        The epoch to precess from.\n    toepoch : `~astropy.time.Time`\n        The epoch to precess to.\n\n    Returns\n    -------\n    pmatrix : 3x3 array\n        Precession matrix to get from ``fromepoch`` to ``toepoch``\n\n    References\n    ----------\n    USNO Circular 179\n    ","endLoc":149,"header":"def precession_matrix_Capitaine(fromepoch, toepoch)","id":14785,"name":"precession_matrix_Capitaine","nodeType":"Function","startLoc":123,"text":"def precession_matrix_Capitaine(fromepoch, toepoch):\n    \"\"\"\n    Computes the precession matrix from one Julian epoch to another.\n    The exact method is based on Capitaine et al. 2003, which should\n    match the IAU 2006 standard.\n\n    Parameters\n    ----------\n    fromepoch : `~astropy.time.Time`\n        The epoch to precess from.\n    toepoch : `~astropy.time.Time`\n        The epoch to precess to.\n\n    Returns\n    -------\n    pmatrix : 3x3 array\n        Precession matrix to get from ``fromepoch`` to ``toepoch``\n\n    References\n    ----------\n    USNO Circular 179\n    \"\"\"\n    mat_fromto2000 = matrix_transpose(\n        _precess_from_J2000_Capitaine(fromepoch.jyear))\n    mat_2000toto = _precess_from_J2000_Capitaine(toepoch.jyear)\n\n    return np.dot(mat_2000toto, mat_fromto2000)"},{"attributeType":"null","col":4,"comment":"null","endLoc":156,"id":14786,"name":"_separable","nodeType":"Attribute","startLoc":156,"text":"_separable"},{"col":0,"comment":"\n    Computes the precession matrix from J2000 to the given Julian Epoch.\n    Expression from from Capitaine et al. 2003 as expressed in the USNO\n    Circular 179.  This should match the IAU 2006 standard from SOFA.\n\n    Parameters\n    ----------\n    epoch : scalar\n        The epoch as a Julian year number (e.g. J2000 is 2000.0)\n\n    ","endLoc":175,"header":"def _precess_from_J2000_Capitaine(epoch)","id":14787,"name":"_precess_from_J2000_Capitaine","nodeType":"Function","startLoc":152,"text":"def _precess_from_J2000_Capitaine(epoch):\n    \"\"\"\n    Computes the precession matrix from J2000 to the given Julian Epoch.\n    Expression from from Capitaine et al. 2003 as expressed in the USNO\n    Circular 179.  This should match the IAU 2006 standard from SOFA.\n\n    Parameters\n    ----------\n    epoch : scalar\n        The epoch as a Julian year number (e.g. J2000 is 2000.0)\n\n    \"\"\"\n    T = (epoch - 2000.0) / 100.0\n    # from USNO circular\n    pzeta = (-0.0000003173, -0.000005971, 0.01801828, 0.2988499, 2306.083227, 2.650545)\n    pz = (-0.0000002904, -0.000028596, 0.01826837, 1.0927348, 2306.077181, -2.650545)\n    ptheta = (-0.0000001274, -0.000007089, -0.04182264, -0.4294934, 2004.191903, 0)\n    zeta = np.polyval(pzeta, T) / 3600.0\n    z = np.polyval(pz, T) / 3600.0\n    theta = np.polyval(ptheta, T) / 3600.0\n\n    return matrix_product(rotation_matrix(-z, 'z'),\n                          rotation_matrix(theta, 'y'),\n                          rotation_matrix(-zeta, 'z'))"},{"attributeType":"null","col":4,"comment":"null","endLoc":157,"id":14788,"name":"_is_bool","nodeType":"Attribute","startLoc":157,"text":"_is_bool"},{"col":4,"comment":"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The inverse redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H_z = H_0 / E`.\n        ","endLoc":2319,"header":"def inv_efunc(self, z)","id":14789,"name":"inv_efunc","nodeType":"Function","startLoc":2299,"text":"def inv_efunc(self, z):\n        r\"\"\"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The inverse redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return (zp1 ** 2 * ((Or * zp1 + self._Om0) * zp1 + self._Ok0) +\n                self._Ode0 * zp1 ** (3. * (1. + self._w0)))**(-0.5)"},{"attributeType":"null","col":8,"comment":"null","endLoc":165,"id":14790,"name":"_default_size","nodeType":"Attribute","startLoc":165,"text":"self._default_size"},{"className":"MexicanHat1DKernel","col":0,"comment":"null","endLoc":1064,"id":14791,"nodeType":"Class","startLoc":1062,"text":"@deprecated('4.0', alternative='RickerWavelet1DKernel')\nclass MexicanHat1DKernel(RickerWavelet1DKernel):\n    pass"},{"className":"RickerWavelet1DKernel","col":0,"comment":"\n    1D Ricker wavelet filter kernel (sometimes known as a \"Mexican Hat\"\n    kernel).\n\n    The Ricker wavelet, or inverted Gaussian-Laplace filter, is a\n    bandpass filter. It smooths the data and removes slowly varying\n    or constant structures (e.g. Background). It is useful for peak or\n    multi-scale detection.\n\n    This kernel is derived from a normalized Gaussian function, by\n    computing the second derivative. This results in an amplitude\n    at the kernels center of 1. / (sqrt(2 * pi) * width ** 3). The\n    normalization is the same as for `scipy.ndimage.gaussian_laplace`,\n    except for a minus sign.\n\n    .. note::\n\n        See https://github.com/astropy/astropy/pull/9445 for discussions\n        related to renaming of this kernel.\n\n    Parameters\n    ----------\n    width : number\n        Width of the filter kernel, defined as the standard deviation\n        of the Gaussian function from which it is derived.\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*width +1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n\n    See Also\n    --------\n    Box1DKernel, Gaussian1DKernel, Trapezoid1DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import RickerWavelet1DKernel\n        ricker_1d_kernel = RickerWavelet1DKernel(10)\n        plt.plot(ricker_1d_kernel, drawstyle='steps')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('value')\n        plt.show()\n\n    ","endLoc":630,"id":14792,"nodeType":"Class","startLoc":557,"text":"class RickerWavelet1DKernel(Kernel1D):\n    \"\"\"\n    1D Ricker wavelet filter kernel (sometimes known as a \"Mexican Hat\"\n    kernel).\n\n    The Ricker wavelet, or inverted Gaussian-Laplace filter, is a\n    bandpass filter. It smooths the data and removes slowly varying\n    or constant structures (e.g. Background). It is useful for peak or\n    multi-scale detection.\n\n    This kernel is derived from a normalized Gaussian function, by\n    computing the second derivative. This results in an amplitude\n    at the kernels center of 1. / (sqrt(2 * pi) * width ** 3). The\n    normalization is the same as for `scipy.ndimage.gaussian_laplace`,\n    except for a minus sign.\n\n    .. note::\n\n        See https://github.com/astropy/astropy/pull/9445 for discussions\n        related to renaming of this kernel.\n\n    Parameters\n    ----------\n    width : number\n        Width of the filter kernel, defined as the standard deviation\n        of the Gaussian function from which it is derived.\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*width +1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n\n    See Also\n    --------\n    Box1DKernel, Gaussian1DKernel, Trapezoid1DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import RickerWavelet1DKernel\n        ricker_1d_kernel = RickerWavelet1DKernel(10)\n        plt.plot(ricker_1d_kernel, drawstyle='steps')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('value')\n        plt.show()\n\n    \"\"\"\n    _is_bool = True\n\n    def __init__(self, width, **kwargs):\n        amplitude = 1.0 / (np.sqrt(2 * np.pi) * width ** 3)\n        self._model = models.RickerWavelet1D(amplitude, 0, width)\n        self._default_size = _round_up_to_odd_integer(8 * width)\n        super().__init__(**kwargs)\n        self._truncation = np.abs(self._array.sum() / self._array.size)"},{"col":4,"comment":"null","endLoc":630,"header":"def __init__(self, width, **kwargs)","id":14793,"name":"__init__","nodeType":"Function","startLoc":625,"text":"def __init__(self, width, **kwargs):\n        amplitude = 1.0 / (np.sqrt(2 * np.pi) * width ** 3)\n        self._model = models.RickerWavelet1D(amplitude, 0, width)\n        self._default_size = _round_up_to_odd_integer(8 * width)\n        super().__init__(**kwargs)\n        self._truncation = np.abs(self._array.sum() / self._array.size)"},{"col":0,"comment":"\n    Computes the precession matrix from one Besselian epoch to another using\n    Newcomb's method.\n\n    ``epoch1`` and ``epoch2`` are in Besselian year numbers.\n    ","endLoc":210,"header":"def _precession_matrix_besselian(epoch1, epoch2)","id":14794,"name":"_precession_matrix_besselian","nodeType":"Function","startLoc":178,"text":"def _precession_matrix_besselian(epoch1, epoch2):\n    \"\"\"\n    Computes the precession matrix from one Besselian epoch to another using\n    Newcomb's method.\n\n    ``epoch1`` and ``epoch2`` are in Besselian year numbers.\n    \"\"\"\n    # tropical years\n    t1 = (epoch1 - 1850.0) / 1000.0\n    t2 = (epoch2 - 1850.0) / 1000.0\n    dt = t2 - t1\n\n    zeta1 = 23035.545 + t1 * 139.720 + 0.060 * t1 * t1\n    zeta2 = 30.240 - 0.27 * t1\n    zeta3 = 17.995\n    pzeta = (zeta3, zeta2, zeta1, 0)\n    zeta = np.polyval(pzeta, dt) / 3600\n\n    z1 = 23035.545 + t1 * 139.720 + 0.060 * t1 * t1\n    z2 = 109.480 + 0.39 * t1\n    z3 = 18.325\n    pz = (z3, z2, z1, 0)\n    z = np.polyval(pz, dt) / 3600\n\n    theta1 = 20051.12 - 85.29 * t1 - 0.37 * t1 * t1\n    theta2 = -42.65 - 0.37 * t1\n    theta3 = -41.8\n    ptheta = (theta3, theta2, theta1, 0)\n    theta = np.polyval(ptheta, dt) / 3600\n\n    return matrix_product(rotation_matrix(-z, 'z'),\n                          rotation_matrix(theta, 'y'),\n                          rotation_matrix(-zeta, 'z'))"},{"attributeType":"Gaussian2D","col":8,"comment":"null","endLoc":162,"id":14795,"name":"_model","nodeType":"Attribute","startLoc":162,"text":"self._model"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":2205,"id":14796,"name":"w0","nodeType":"Attribute","startLoc":2205,"text":"w0"},{"attributeType":"null","col":8,"comment":"null","endLoc":168,"id":14797,"name":"_truncation","nodeType":"Attribute","startLoc":168,"text":"self._truncation"},{"col":0,"comment":"\n    Loads nutation series from data stored in string form.\n\n    Seriestype can be 'lunisolar' or 'planetary'\n    ","endLoc":260,"header":"def _load_nutation_data(datastr, seriestype)","id":14798,"name":"_load_nutation_data","nodeType":"Function","startLoc":213,"text":"def _load_nutation_data(datastr, seriestype):\n    \"\"\"\n    Loads nutation series from data stored in string form.\n\n    Seriestype can be 'lunisolar' or 'planetary'\n    \"\"\"\n\n    if seriestype == 'lunisolar':\n        dtypes = [('nl', int),\n                  ('nlp', int),\n                  ('nF', int),\n                  ('nD', int),\n                  ('nOm', int),\n                  ('ps', float),\n                  ('pst', float),\n                  ('pc', float),\n                  ('ec', float),\n                  ('ect', float),\n                  ('es', float)]\n    elif seriestype == 'planetary':\n        dtypes = [('nl', int),\n                  ('nF', int),\n                  ('nD', int),\n                  ('nOm', int),\n                  ('nme', int),\n                  ('nve', int),\n                  ('nea', int),\n                  ('nma', int),\n                  ('nju', int),\n                  ('nsa', int),\n                  ('nur', int),\n                  ('nne', int),\n                  ('npa', int),\n                  ('sp', int),\n                  ('cp', int),\n                  ('se', int),\n                  ('ce', int)]\n    else:\n        raise ValueError('requested invalid nutation series type')\n\n    lines = [l for l in datastr.split('\\n')\n             if not l.startswith('#') if not l.strip() == '']\n\n    lists = [[] for _ in dtypes]\n    for l in lines:\n        for i, e in enumerate(l.split(' ')):\n            lists[i].append(dtypes[i][1](e))\n    return np.rec.fromarrays(lists, names=[e[0] for e in dtypes])"},{"className":"Box1DKernel","col":0,"comment":"\n    1D Box filter kernel.\n\n    The Box filter or running mean is a smoothing filter. It is not isotropic\n    and can produce artifacts when applied repeatedly to the same data.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    By default the Box kernel uses the ``linear_interp`` discretization mode,\n    which allows non-shifting, even-sized kernels.  This is achieved by\n    weighting the edge pixels with 1/2. E.g a Box kernel with an effective\n    smoothing of 4 pixel would have the following array: [0.5, 1, 1, 1, 0.5].\n\n\n    Parameters\n    ----------\n    width : number\n        Width of the filter kernel.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center'\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp' (default)\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Gaussian1DKernel, Trapezoid1DKernel, RickerWavelet1DKernel\n\n\n    Examples\n    --------\n    Kernel response function:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Box1DKernel\n        box_1D_kernel = Box1DKernel(9)\n        plt.plot(box_1D_kernel, drawstyle='steps')\n        plt.xlim(-1, 9)\n        plt.xlabel('x [pixels]')\n        plt.ylabel('value')\n        plt.show()\n\n    ","endLoc":238,"id":14799,"nodeType":"Class","startLoc":171,"text":"class Box1DKernel(Kernel1D):\n    \"\"\"\n    1D Box filter kernel.\n\n    The Box filter or running mean is a smoothing filter. It is not isotropic\n    and can produce artifacts when applied repeatedly to the same data.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    By default the Box kernel uses the ``linear_interp`` discretization mode,\n    which allows non-shifting, even-sized kernels.  This is achieved by\n    weighting the edge pixels with 1/2. E.g a Box kernel with an effective\n    smoothing of 4 pixel would have the following array: [0.5, 1, 1, 1, 0.5].\n\n\n    Parameters\n    ----------\n    width : number\n        Width of the filter kernel.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center'\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp' (default)\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Gaussian1DKernel, Trapezoid1DKernel, RickerWavelet1DKernel\n\n\n    Examples\n    --------\n    Kernel response function:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Box1DKernel\n        box_1D_kernel = Box1DKernel(9)\n        plt.plot(box_1D_kernel, drawstyle='steps')\n        plt.xlim(-1, 9)\n        plt.xlabel('x [pixels]')\n        plt.ylabel('value')\n        plt.show()\n\n    \"\"\"\n    _separable = True\n    _is_bool = True\n\n    def __init__(self, width, **kwargs):\n        self._model = models.Box1D(1. / width, 0, width)\n        self._default_size = _round_up_to_odd_integer(width)\n        kwargs['mode'] = 'linear_interp'\n        super().__init__(**kwargs)\n        self._truncation = 0\n        self.normalize()"},{"col":4,"comment":"null","endLoc":238,"header":"def __init__(self, width, **kwargs)","id":14800,"name":"__init__","nodeType":"Function","startLoc":232,"text":"def __init__(self, width, **kwargs):\n        self._model = models.Box1D(1. / width, 0, width)\n        self._default_size = _round_up_to_odd_integer(width)\n        kwargs['mode'] = 'linear_interp'\n        super().__init__(**kwargs)\n        self._truncation = 0\n        self.normalize()"},{"col":0,"comment":"\n    Computes nutation components following the IAU 2000B specification\n\n    Parameters\n    ----------\n    jd : scalar\n        epoch at which to compute the nutation components as a JD\n\n    Returns\n    -------\n    eps : float\n        epsilon in radians\n    dpsi : float\n        dpsi in radians\n    deps : float\n        depsilon in raidans\n    ","endLoc":396,"header":"def nutation_components2000B(jd)","id":14801,"name":"nutation_components2000B","nodeType":"Function","startLoc":349,"text":"def nutation_components2000B(jd):\n    \"\"\"\n    Computes nutation components following the IAU 2000B specification\n\n    Parameters\n    ----------\n    jd : scalar\n        epoch at which to compute the nutation components as a JD\n\n    Returns\n    -------\n    eps : float\n        epsilon in radians\n    dpsi : float\n        dpsi in radians\n    deps : float\n        depsilon in raidans\n    \"\"\"\n    epsa = np.radians(obliquity(jd, 2000))\n    t = (jd - jd2000) / 36525\n\n    # Fundamental (Delaunay) arguments from Simon et al. (1994) via SOFA\n    # Mean anomaly of moon\n    el = ((485868.249036 + 1717915923.2178 * t) % 1296000) / _asecperrad\n    # Mean anomaly of sun\n    elp = ((1287104.79305 + 129596581.0481 * t) % 1296000) / _asecperrad\n    # Mean argument of the latitude of Moon\n    F = ((335779.526232 + 1739527262.8478 * t) % 1296000) / _asecperrad\n    # Mean elongation of the Moon from Sun\n    D = ((1072260.70369 + 1602961601.2090 * t) % 1296000) / _asecperrad\n    # Mean longitude of the ascending node of Moon\n    Om = ((450160.398036 + -6962890.5431 * t) % 1296000) / _asecperrad\n\n    # compute nutation series using array loaded from data directory\n    dat = _nut_data_00b\n    arg = dat.nl * el + dat.nlp * elp + dat.nF * F + dat.nD * D + dat.nOm * Om\n    sarg = np.sin(arg)\n    carg = np.cos(arg)\n\n    p1u_asecperrad = _asecperrad * 1e7  # 0.1 microasrcsecperrad\n    dpsils = np.sum((dat.ps + dat.pst * t) * sarg + dat.pc * carg) / p1u_asecperrad\n    depsls = np.sum((dat.ec + dat.ect * t) * carg + dat.es * sarg) / p1u_asecperrad\n    # fixed offset in place of planetary tersm\n    m_asecperrad = _asecperrad * 1e3  # milliarcsec per rad\n    dpsipl = -0.135 / m_asecperrad\n    depspl = 0.388 / m_asecperrad\n\n    return epsa, dpsils + dpsipl, depsls + depspl  # all in radians"},{"col":0,"comment":"\n    Nutation matrix generated from nutation components.\n\n    Matrix converts from mean coordinate to true coordinate as\n    r_true = M * r_mean\n    ","endLoc":411,"header":"def nutation_matrix(epoch)","id":14802,"name":"nutation_matrix","nodeType":"Function","startLoc":399,"text":"def nutation_matrix(epoch):\n    \"\"\"\n    Nutation matrix generated from nutation components.\n\n    Matrix converts from mean coordinate to true coordinate as\n    r_true = M * r_mean\n    \"\"\"\n    # TODO: implement higher precision 2006/2000A model if requested/needed\n    epsa, dpsi, deps = nutation_components2000B(epoch.jd)  # all in radians\n\n    return matrix_product(rotation_matrix(-(epsa + deps), 'x', False),\n                          rotation_matrix(-dpsi, 'z', False),\n                          rotation_matrix(epsa, 'x', False))"},{"attributeType":"null","col":12,"comment":"null","endLoc":2225,"id":14803,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":2225,"text":"self._inv_efunc_scalar"},{"attributeType":"null","col":16,"comment":"null","endLoc":12,"id":14804,"name":"np","nodeType":"Attribute","startLoc":12,"text":"np"},{"attributeType":"null","col":29,"comment":"null","endLoc":15,"id":14805,"name":"u","nodeType":"Attribute","startLoc":15,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":14806,"name":"jd1950","nodeType":"Attribute","startLoc":19,"text":"jd1950"},{"attributeType":"null","col":12,"comment":"null","endLoc":2226,"id":14807,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":2226,"text":"self._inv_efunc_scalar_args"},{"attributeType":"null","col":4,"comment":"null","endLoc":229,"id":14808,"name":"_separable","nodeType":"Attribute","startLoc":229,"text":"_separable"},{"attributeType":"null","col":4,"comment":"null","endLoc":230,"id":14809,"name":"_is_bool","nodeType":"Attribute","startLoc":230,"text":"_is_bool"},{"attributeType":"null","col":8,"comment":"null","endLoc":234,"id":14810,"name":"_default_size","nodeType":"Attribute","startLoc":234,"text":"self._default_size"},{"attributeType":"Box1D","col":8,"comment":"null","endLoc":233,"id":14811,"name":"_model","nodeType":"Attribute","startLoc":233,"text":"self._model"},{"attributeType":"null","col":8,"comment":"null","endLoc":237,"id":14812,"name":"_truncation","nodeType":"Attribute","startLoc":237,"text":"self._truncation"},{"className":"Box2DKernel","col":0,"comment":"\n    2D Box filter kernel.\n\n    The Box filter or running mean is a smoothing filter. It is not isotropic\n    and can produce artifacts when applied repeatedly to the same data.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    By default the Box kernel uses the ``linear_interp`` discretization mode,\n    which allows non-shifting, even-sized kernels.  This is achieved by\n    weighting the edge pixels with 1/2.\n\n\n    Parameters\n    ----------\n    width : number\n        Width of the filter kernel.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center'\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp' (default)\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n\n    See Also\n    --------\n    Gaussian2DKernel, Tophat2DKernel, RickerWavelet2DKernel, Ring2DKernel,\n    TrapezoidDisk2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Box2DKernel\n        box_2D_kernel = Box2DKernel(9)\n        plt.imshow(box_2D_kernel, interpolation='none', origin='lower',\n                   vmin=0.0, vmax=0.015)\n        plt.xlim(-1, 9)\n        plt.ylim(-1, 9)\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n    ","endLoc":310,"id":14813,"nodeType":"Class","startLoc":241,"text":"class Box2DKernel(Kernel2D):\n    \"\"\"\n    2D Box filter kernel.\n\n    The Box filter or running mean is a smoothing filter. It is not isotropic\n    and can produce artifacts when applied repeatedly to the same data.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    By default the Box kernel uses the ``linear_interp`` discretization mode,\n    which allows non-shifting, even-sized kernels.  This is achieved by\n    weighting the edge pixels with 1/2.\n\n\n    Parameters\n    ----------\n    width : number\n        Width of the filter kernel.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center'\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp' (default)\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n\n    See Also\n    --------\n    Gaussian2DKernel, Tophat2DKernel, RickerWavelet2DKernel, Ring2DKernel,\n    TrapezoidDisk2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Box2DKernel\n        box_2D_kernel = Box2DKernel(9)\n        plt.imshow(box_2D_kernel, interpolation='none', origin='lower',\n                   vmin=0.0, vmax=0.015)\n        plt.xlim(-1, 9)\n        plt.ylim(-1, 9)\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n    \"\"\"\n    _separable = True\n    _is_bool = True\n\n    def __init__(self, width, **kwargs):\n        self._model = models.Box2D(1. / width ** 2, 0, 0, width, width)\n        self._default_size = _round_up_to_odd_integer(width)\n        kwargs['mode'] = 'linear_interp'\n        super().__init__(**kwargs)\n        self._truncation = 0\n        self.normalize()"},{"attributeType":"null","col":4,"comment":"null","endLoc":623,"id":14814,"name":"_is_bool","nodeType":"Attribute","startLoc":623,"text":"_is_bool"},{"col":4,"comment":"null","endLoc":310,"header":"def __init__(self, width, **kwargs)","id":14815,"name":"__init__","nodeType":"Function","startLoc":304,"text":"def __init__(self, width, **kwargs):\n        self._model = models.Box2D(1. / width ** 2, 0, 0, width, width)\n        self._default_size = _round_up_to_odd_integer(width)\n        kwargs['mode'] = 'linear_interp'\n        super().__init__(**kwargs)\n        self._truncation = 0\n        self.normalize()"},{"attributeType":"null","col":8,"comment":"null","endLoc":628,"id":14816,"name":"_default_size","nodeType":"Attribute","startLoc":628,"text":"self._default_size"},{"attributeType":"null","col":8,"comment":"null","endLoc":627,"id":14817,"name":"_model","nodeType":"Attribute","startLoc":627,"text":"self._model"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":14818,"name":"jd2000","nodeType":"Attribute","startLoc":20,"text":"jd2000"},{"attributeType":"null","col":4,"comment":"null","endLoc":301,"id":14819,"name":"_separable","nodeType":"Attribute","startLoc":301,"text":"_separable"},{"attributeType":"null","col":4,"comment":"null","endLoc":302,"id":14820,"name":"_is_bool","nodeType":"Attribute","startLoc":302,"text":"_is_bool"},{"attributeType":"null","col":8,"comment":"null","endLoc":306,"id":14821,"name":"_default_size","nodeType":"Attribute","startLoc":306,"text":"self._default_size"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":14822,"name":"_asecperrad","nodeType":"Attribute","startLoc":21,"text":"_asecperrad"},{"attributeType":"Box2D","col":8,"comment":"null","endLoc":305,"id":14823,"name":"_model","nodeType":"Attribute","startLoc":305,"text":"self._model"},{"attributeType":"null","col":8,"comment":"null","endLoc":630,"id":14824,"name":"_truncation","nodeType":"Attribute","startLoc":630,"text":"self._truncation"},{"attributeType":"null","col":0,"comment":"null","endLoc":263,"id":14825,"name":"_nut_data_00b","nodeType":"Attribute","startLoc":263,"text":"_nut_data_00b"},{"attributeType":"null","col":8,"comment":"null","endLoc":309,"id":14826,"name":"_truncation","nodeType":"Attribute","startLoc":309,"text":"self._truncation"},{"attributeType":"null","col":0,"comment":"null","endLoc":344,"id":14827,"name":"_nut_data_00b","nodeType":"Attribute","startLoc":344,"text":"_nut_data_00b"},{"className":"MexicanHat2DKernel","col":0,"comment":"null","endLoc":1069,"id":14828,"nodeType":"Class","startLoc":1067,"text":"@deprecated('4.0', alternative='RickerWavelet2DKernel')\nclass MexicanHat2DKernel(RickerWavelet2DKernel):\n    pass"},{"className":"RickerWavelet2DKernel","col":0,"comment":"\n    2D Ricker wavelet filter kernel (sometimes known as a \"Mexican Hat\"\n    kernel).\n\n    The Ricker wavelet, or inverted Gaussian-Laplace filter, is a\n    bandpass filter. It smooths the data and removes slowly varying\n    or constant structures (e.g. Background). It is useful for peak or\n    multi-scale detection.\n\n    This kernel is derived from a normalized Gaussian function, by\n    computing the second derivative. This results in an amplitude\n    at the kernels center of 1. / (pi * width ** 4). The normalization\n    is the same as for `scipy.ndimage.gaussian_laplace`, except\n    for a minus sign.\n\n    .. note::\n\n        See https://github.com/astropy/astropy/pull/9445 for discussions\n        related to renaming of this kernel.\n\n    Parameters\n    ----------\n    width : number\n        Width of the filter kernel, defined as the standard deviation\n        of the Gaussian function from which it is derived.\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*width +1⌋.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*width +1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, Tophat2DKernel, Ring2DKernel,\n    TrapezoidDisk2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import RickerWavelet2DKernel\n        ricker_2d_kernel = RickerWavelet2DKernel(10)\n        plt.imshow(ricker_2d_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n    ","endLoc":709,"id":14829,"nodeType":"Class","startLoc":633,"text":"class RickerWavelet2DKernel(Kernel2D):\n    \"\"\"\n    2D Ricker wavelet filter kernel (sometimes known as a \"Mexican Hat\"\n    kernel).\n\n    The Ricker wavelet, or inverted Gaussian-Laplace filter, is a\n    bandpass filter. It smooths the data and removes slowly varying\n    or constant structures (e.g. Background). It is useful for peak or\n    multi-scale detection.\n\n    This kernel is derived from a normalized Gaussian function, by\n    computing the second derivative. This results in an amplitude\n    at the kernels center of 1. / (pi * width ** 4). The normalization\n    is the same as for `scipy.ndimage.gaussian_laplace`, except\n    for a minus sign.\n\n    .. note::\n\n        See https://github.com/astropy/astropy/pull/9445 for discussions\n        related to renaming of this kernel.\n\n    Parameters\n    ----------\n    width : number\n        Width of the filter kernel, defined as the standard deviation\n        of the Gaussian function from which it is derived.\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*width +1⌋.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*width +1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, Tophat2DKernel, Ring2DKernel,\n    TrapezoidDisk2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import RickerWavelet2DKernel\n        ricker_2d_kernel = RickerWavelet2DKernel(10)\n        plt.imshow(ricker_2d_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n    \"\"\"\n    _is_bool = False\n\n    def __init__(self, width, **kwargs):\n        amplitude = 1.0 / (np.pi * width ** 4)\n        self._model = models.RickerWavelet2D(amplitude, 0, 0, width)\n        self._default_size = _round_up_to_odd_integer(8 * width)\n        super().__init__(**kwargs)\n        self._truncation = np.abs(self._array.sum() / self._array.size)"},{"col":4,"comment":"null","endLoc":709,"header":"def __init__(self, width, **kwargs)","id":14830,"name":"__init__","nodeType":"Function","startLoc":704,"text":"def __init__(self, width, **kwargs):\n        amplitude = 1.0 / (np.pi * width ** 4)\n        self._model = models.RickerWavelet2D(amplitude, 0, 0, width)\n        self._default_size = _round_up_to_odd_integer(8 * width)\n        super().__init__(**kwargs)\n        self._truncation = np.abs(self._array.sum() / self._array.size)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2211,"id":14831,"name":"w0","nodeType":"Attribute","startLoc":2211,"text":"self.w0"},{"className":"Tophat2DKernel","col":0,"comment":"\n    2D Tophat filter kernel.\n\n    The Tophat filter is an isotropic smoothing filter. It can produce\n    artifacts when applied repeatedly on the same data.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    radius : int\n        Radius of the filter kernel.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, RickerWavelet2DKernel, Ring2DKernel,\n    TrapezoidDisk2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Tophat2DKernel\n        tophat_2D_kernel = Tophat2DKernel(40)\n        plt.imshow(tophat_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n\n    ","endLoc":370,"id":14832,"nodeType":"Class","startLoc":313,"text":"class Tophat2DKernel(Kernel2D):\n    \"\"\"\n    2D Tophat filter kernel.\n\n    The Tophat filter is an isotropic smoothing filter. It can produce\n    artifacts when applied repeatedly on the same data.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    radius : int\n        Radius of the filter kernel.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, RickerWavelet2DKernel, Ring2DKernel,\n    TrapezoidDisk2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Tophat2DKernel\n        tophat_2D_kernel = Tophat2DKernel(40)\n        plt.imshow(tophat_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n\n    \"\"\"\n    def __init__(self, radius, **kwargs):\n        self._model = models.Disk2D(1. / (np.pi * radius ** 2), 0, 0, radius)\n        self._default_size = _round_up_to_odd_integer(2 * radius)\n        super().__init__(**kwargs)\n        self._truncation = 0"},{"col":0,"comment":"","endLoc":9,"header":"earth_orientation.py#<anonymous>","id":14833,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module contains standard functions for earth orientation, such as\nprecession and nutation.\n\nThis module is (currently) not intended to be part of the public API, but\nis instead primarily for internal use in `coordinates`\n\"\"\"\n\njd1950 = Time('B1950').jd\n\njd2000 = Time('J2000').jd\n\n_asecperrad = u.radian.to(u.arcsec)\n\n_nut_data_00b = \"\"\"\n#l lprime F D Omega longitude_sin longitude_sin*t longitude_cos obliquity_cos obliquity_cos*t,obliquity_sin\n\n0 0 0 0 1 -172064161.0 -174666.0 33386.0 92052331.0 9086.0 15377.0\n0 0 2 -2 2 -13170906.0 -1675.0 -13696.0 5730336.0 -3015.0 -4587.0\n0 0 2 0 2 -2276413.0 -234.0 2796.0 978459.0 -485.0 1374.0\n0 0 0 0 2 2074554.0 207.0 -698.0 -897492.0 470.0 -291.0\n0 1 0 0 0 1475877.0 -3633.0 11817.0 73871.0 -184.0 -1924.0\n0 1 2 -2 2 -516821.0 1226.0 -524.0 224386.0 -677.0 -174.0\n1 0 0 0 0 711159.0 73.0 -872.0 -6750.0 0.0 358.0\n0 0 2 0 1 -387298.0 -367.0 380.0 200728.0 18.0 318.0\n1 0 2 0 2 -301461.0 -36.0 816.0 129025.0 -63.0 367.0\n0 -1 2 -2 2 215829.0 -494.0 111.0 -95929.0 299.0 132.0\n0 0 2 -2 1 128227.0 137.0 181.0 -68982.0 -9.0 39.0\n-1 0 2 0 2 123457.0 11.0 19.0 -53311.0 32.0 -4.0\n-1 0 0 2 0 156994.0 10.0 -168.0 -1235.0 0.0 82.0\n1 0 0 0 1 63110.0 63.0 27.0 -33228.0 0.0 -9.0\n-1 0 0 0 1 -57976.0 -63.0 -189.0 31429.0 0.0 -75.0\n-1 0 2 2 2 -59641.0 -11.0 149.0 25543.0 -11.0 66.0\n1 0 2 0 1 -51613.0 -42.0 129.0 26366.0 0.0 78.0\n-2 0 2 0 1 45893.0 50.0 31.0 -24236.0 -10.0 20.0\n0 0 0 2 0 63384.0 11.0 -150.0 -1220.0 0.0 29.0\n0 0 2 2 2 -38571.0 -1.0 158.0 16452.0 -11.0 68.0\n0 -2 2 -2 2 32481.0 0.0 0.0 -13870.0 0.0 0.0\n-2 0 0 2 0 -47722.0 0.0 -18.0 477.0 0.0 -25.0\n2 0 2 0 2 -31046.0 -1.0 131.0 13238.0 -11.0 59.0\n1 0 2 -2 2 28593.0 0.0 -1.0 -12338.0 10.0 -3.0\n-1 0 2 0 1 20441.0 21.0 10.0 -10758.0 0.0 -3.0\n2 0 0 0 0 29243.0 0.0 -74.0 -609.0 0.0 13.0\n0 0 2 0 0 25887.0 0.0 -66.0 -550.0 0.0 11.0\n0 1 0 0 1 -14053.0 -25.0 79.0 8551.0 -2.0 -45.0\n-1 0 0 2 1 15164.0 10.0 11.0 -8001.0 0.0 -1.0\n0 2 2 -2 2 -15794.0 72.0 -16.0 6850.0 -42.0 -5.0\n0 0 -2 2 0 21783.0 0.0 13.0 -167.0 0.0 13.0\n1 0 0 -2 1 -12873.0 -10.0 -37.0 6953.0 0.0 -14.0\n0 -1 0 0 1 -12654.0 11.0 63.0 6415.0 0.0 26.0\n-1 0 2 2 1 -10204.0 0.0 25.0 5222.0 0.0 15.0\n0 2 0 0 0 16707.0 -85.0 -10.0 168.0 -1.0 10.0\n1 0 2 2 2 -7691.0 0.0 44.0 3268.0 0.0 19.0\n-2 0 2 0 0 -11024.0 0.0 -14.0 104.0 0.0 2.0\n0 1 2 0 2 7566.0 -21.0 -11.0 -3250.0 0.0 -5.0\n0 0 2 2 1 -6637.0 -11.0 25.0 3353.0 0.0 14.0\n0 -1 2 0 2 -7141.0 21.0 8.0 3070.0 0.0 4.0\n0 0 0 2 1 -6302.0 -11.0 2.0 3272.0 0.0 4.0\n1 0 2 -2 1 5800.0 10.0 2.0 -3045.0 0.0 -1.0\n2 0 2 -2 2 6443.0 0.0 -7.0 -2768.0 0.0 -4.0\n-2 0 0 2 1 -5774.0 -11.0 -15.0 3041.0 0.0 -5.0\n2 0 2 0 1 -5350.0 0.0 21.0 2695.0 0.0 12.0\n0 -1 2 -2 1 -4752.0 -11.0 -3.0 2719.0 0.0 -3.0\n0 0 0 -2 1 -4940.0 -11.0 -21.0 2720.0 0.0 -9.0\n-1 -1 0 2 0 7350.0 0.0 -8.0 -51.0 0.0 4.0\n2 0 0 -2 1 4065.0 0.0 6.0 -2206.0 0.0 1.0\n1 0 0 2 0 6579.0 0.0 -24.0 -199.0 0.0 2.0\n0 1 2 -2 1 3579.0 0.0 5.0 -1900.0 0.0 1.0\n1 -1 0 0 0 4725.0 0.0 -6.0 -41.0 0.0 3.0\n-2 0 2 0 2 -3075.0 0.0 -2.0 1313.0 0.0 -1.0\n3 0 2 0 2 -2904.0 0.0 15.0 1233.0 0.0 7.0\n0 -1 0 2 0 4348.0 0.0 -10.0 -81.0 0.0 2.0\n1 -1 2 0 2 -2878.0 0.0 8.0 1232.0 0.0 4.0\n0 0 0 1 0 -4230.0 0.0 5.0 -20.0 0.0 -2.0\n-1 -1 2 2 2 -2819.0 0.0 7.0 1207.0 0.0 3.0\n-1 0 2 0 0 -4056.0 0.0 5.0 40.0 0.0 -2.0\n0 -1 2 2 2 -2647.0 0.0 11.0 1129.0 0.0 5.0\n-2 0 0 0 1 -2294.0 0.0 -10.0 1266.0 0.0 -4.0\n1 1 2 0 2 2481.0 0.0 -7.0 -1062.0 0.0 -3.0\n2 0 0 0 1 2179.0 0.0 -2.0 -1129.0 0.0 -2.0\n-1 1 0 1 0 3276.0 0.0 1.0 -9.0 0.0 0.0\n1 1 0 0 0 -3389.0 0.0 5.0 35.0 0.0 -2.0\n1 0 2 0 0 3339.0 0.0 -13.0 -107.0 0.0 1.0\n-1 0 2 -2 1 -1987.0 0.0 -6.0 1073.0 0.0 -2.0\n1 0 0 0 2 -1981.0 0.0 0.0 854.0 0.0 0.0\n-1 0 0 1 0 4026.0 0.0 -353.0 -553.0 0.0 -139.0\n0 0 2 1 2 1660.0 0.0 -5.0 -710.0 0.0 -2.0\n-1 0 2 4 2 -1521.0 0.0 9.0 647.0 0.0 4.0\n-1 1 0 1 1 1314.0 0.0 0.0 -700.0 0.0 0.0\n0 -2 2 -2 1 -1283.0 0.0 0.0 672.0 0.0 0.0\n1 0 2 2 1 -1331.0 0.0 8.0 663.0 0.0 4.0\n-2 0 2 2 2 1383.0 0.0 -2.0 -594.0 0.0 -2.0\n-1 0 0 0 2 1405.0 0.0 4.0 -610.0 0.0 2.0\n1 1 2 -2 2 1290.0 0.0 0.0 -556.0 0.0 0.0\n\"\"\"[1:-1]\n\n_nut_data_00b = _load_nutation_data(_nut_data_00b, 'lunisolar')"},{"col":4,"comment":"null","endLoc":370,"header":"def __init__(self, radius, **kwargs)","id":14834,"name":"__init__","nodeType":"Function","startLoc":366,"text":"def __init__(self, radius, **kwargs):\n        self._model = models.Disk2D(1. / (np.pi * radius ** 2), 0, 0, radius)\n        self._default_size = _round_up_to_odd_integer(2 * radius)\n        super().__init__(**kwargs)\n        self._truncation = 0"},{"fileName":"distances.py","filePath":"astropy/coordinates","id":14835,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module contains the classes and utility functions for distance and\ncartesian coordinates.\n\"\"\"\n\nimport warnings\n\nimport numpy as np\n\nfrom astropy import units as u\nfrom astropy.utils.exceptions import AstropyWarning\nfrom .angles import Angle\n\n__all__ = ['Distance']\n\n\n__doctest_requires__ = {'*': ['scipy']}\n\n\nclass Distance(u.SpecificTypeQuantity):\n    \"\"\"\n    A one-dimensional distance.\n\n    This can be initialized by providing one of the following:\n\n    * Distance ``value`` (array or float) and a ``unit``\n    * |Quantity| object with dimensionality of length\n    * Redshift and (optionally) a `~astropy.cosmology.Cosmology`\n    * Distance modulus\n    * Parallax\n\n    Parameters\n    ----------\n    value : scalar or `~astropy.units.Quantity` ['length']\n        The value of this distance.\n    unit : `~astropy.units.UnitBase` ['length']\n        The unit for this distance.\n    z : float\n        A redshift for this distance.  It will be converted to a distance\n        by computing the luminosity distance for this redshift given the\n        cosmology specified by ``cosmology``. Must be given as a keyword\n        argument.\n    cosmology : `~astropy.cosmology.Cosmology` or None\n        A cosmology that will be used to compute the distance from ``z``.\n        If `None`, the current cosmology will be used (see\n        `astropy.cosmology` for details).\n    distmod : float or `~astropy.units.Quantity`\n        The distance modulus for this distance. Note that if ``unit`` is not\n        provided, a guess will be made at the unit between AU, pc, kpc, and Mpc.\n    parallax : `~astropy.units.Quantity` or `~astropy.coordinates.Angle`\n        The parallax in angular units.\n    dtype : `~numpy.dtype`, optional\n        See `~astropy.units.Quantity`.\n    copy : bool, optional\n        See `~astropy.units.Quantity`.\n    order : {'C', 'F', 'A'}, optional\n        See `~astropy.units.Quantity`.\n    subok : bool, optional\n        See `~astropy.units.Quantity`.\n    ndmin : int, optional\n        See `~astropy.units.Quantity`.\n    allow_negative : bool, optional\n        Whether to allow negative distances (which are possible in some\n        cosmologies).  Default: `False`.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If the ``unit`` is not a length unit.\n    ValueError\n        If value specified is less than 0 and ``allow_negative=False``.\n\n        If ``cosmology`` is provided when ``z`` is *not* given.\n\n        If either none or more than one of ``value``, ``z``, ``distmod``,\n        or ``parallax`` were given.\n\n\n    Examples\n    --------\n    >>> from astropy import units as u\n    >>> from astropy.cosmology import WMAP5\n    >>> Distance(10, u.Mpc)\n    <Distance 10. Mpc>\n    >>> Distance(40*u.pc, unit=u.kpc)\n    <Distance 0.04 kpc>\n    >>> Distance(z=0.23)                      # doctest: +FLOAT_CMP\n    <Distance 1184.01657566 Mpc>\n    >>> Distance(z=0.23, cosmology=WMAP5)     # doctest: +FLOAT_CMP\n    <Distance 1147.78831918 Mpc>\n    >>> Distance(distmod=24.47*u.mag)         # doctest: +FLOAT_CMP\n    <Distance 783.42964277 kpc>\n    >>> Distance(parallax=21.34*u.mas)        # doctest: +FLOAT_CMP\n    <Distance 46.86035614 pc>\n    \"\"\"\n\n    _equivalent_unit = u.m\n    _include_easy_conversion_members = True\n\n    def __new__(cls, value=None, unit=None, z=None, cosmology=None,\n                distmod=None, parallax=None, dtype=None, copy=True, order=None,\n                subok=False, ndmin=0, allow_negative=False):\n\n        n_not_none = sum(x is not None for x in [value, z, distmod, parallax])\n        if n_not_none == 0:\n            raise ValueError('none of `value`, `z`, `distmod`, or `parallax` '\n                             'were given to Distance constructor')\n        elif n_not_none > 1:\n            raise ValueError('more than one of `value`, `z`, `distmod`, or '\n                             '`parallax` were given to Distance constructor')\n\n        if value is None:\n            # If something else but `value` was provided then a new array will\n            # be created anyways and there is no need to copy that.\n            copy = False\n\n        if z is not None:\n            if cosmology is None:\n                from astropy.cosmology import default_cosmology\n                cosmology = default_cosmology.get()\n\n            value = cosmology.luminosity_distance(z)\n\n        elif cosmology is not None:\n            raise ValueError('a `cosmology` was given but `z` was not '\n                             'provided in Distance constructor')\n\n        elif distmod is not None:\n            value = cls._distmod_to_pc(distmod)\n            if unit is None:\n                # if the unit is not specified, guess based on the mean of\n                # the log of the distance\n                meanlogval = np.log10(value.value).mean()\n                if meanlogval > 6:\n                    unit = u.Mpc\n                elif meanlogval > 3:\n                    unit = u.kpc\n                elif meanlogval < -3:  # ~200 AU\n                    unit = u.AU\n                else:\n                    unit = u.pc\n\n        elif parallax is not None:\n            if unit is None:\n                unit = u.pc\n            value = parallax.to_value(unit, equivalencies=u.parallax())\n\n            if np.any(parallax < 0):\n                if allow_negative:\n                    warnings.warn(\n                        \"negative parallaxes are converted to NaN \"\n                        \"distances even when `allow_negative=True`, \"\n                        \"because negative parallaxes cannot be transformed \"\n                        \"into distances. See the discussion in this paper: \"\n                        \"https://arxiv.org/abs/1507.02105\", AstropyWarning)\n                else:\n                    raise ValueError(\n                        \"some parallaxes are negative, which are not \"\n                        \"interpretable as distances. See the discussion in \"\n                        \"this paper: https://arxiv.org/abs/1507.02105 . You \"\n                        \"can convert negative parallaxes to NaN distances by \"\n                        \"providing the `allow_negative=True` argument.\")\n\n        # now we have arguments like for a Quantity, so let it do the work\n        distance = super().__new__(\n            cls, value, unit, dtype=dtype, copy=copy, order=order,\n            subok=subok, ndmin=ndmin)\n\n        # This invalid catch block can be removed when the minimum numpy\n        # version is >= 1.19 (NUMPY_LT_1_19)\n        with np.errstate(invalid='ignore'):\n            any_negative = np.any(distance.value < 0)\n\n        if not allow_negative and any_negative:\n            raise ValueError(\"distance must be >= 0. Use the argument \"\n                             \"`allow_negative=True` to allow negative values.\")\n\n        return distance\n\n    @property\n    def z(self):\n        \"\"\"Short for ``self.compute_z()``\"\"\"\n        return self.compute_z()\n\n    def compute_z(self, cosmology=None, **atzkw):\n        \"\"\"\n        The redshift for this distance assuming its physical distance is\n        a luminosity distance.\n\n        Parameters\n        ----------\n        cosmology : `~astropy.cosmology.Cosmology` or None\n            The cosmology to assume for this calculation, or `None` to use the\n            current cosmology (see `astropy.cosmology` for details).\n        **atzkw\n            keyword arguments for :func:`~astropy.cosmology.z_at_value`\n\n        Returns\n        -------\n        z : `~astropy.units.Quantity`\n            The redshift of this distance given the provided ``cosmology``.\n\n        Warnings\n        --------\n        This method can be slow for large arrays.\n        The redshift is determined using :func:`astropy.cosmology.z_at_value`,\n        which handles vector inputs (e.g. an array of distances) by\n        element-wise calling of :func:`scipy.optimize.minimize_scalar`.\n        For faster results consider using an interpolation table;\n        :func:`astropy.cosmology.z_at_value` provides details.\n\n        See Also\n        --------\n        :func:`astropy.cosmology.z_at_value`\n            Find the redshift corresponding to a\n            :meth:`astropy.cosmology.FLRW.luminosity_distance`.\n        \"\"\"\n        from astropy.cosmology import z_at_value\n\n        if cosmology is None:\n            from astropy.cosmology import default_cosmology\n            cosmology = default_cosmology.get()\n\n        atzkw.setdefault(\"ztol\", 1.e-10)\n        return z_at_value(cosmology.luminosity_distance, self, **atzkw)\n\n    @property\n    def distmod(self):\n        \"\"\"The distance modulus as a `~astropy.units.Quantity`\"\"\"\n        val = 5. * np.log10(self.to_value(u.pc)) - 5.\n        return u.Quantity(val, u.mag, copy=False)\n\n    @classmethod\n    def _distmod_to_pc(cls, dm):\n        dm = u.Quantity(dm, u.mag)\n        return cls(10 ** ((dm.value + 5) / 5.), u.pc, copy=False)\n\n    @property\n    def parallax(self):\n        \"\"\"The parallax angle as an `~astropy.coordinates.Angle` object\"\"\"\n        return Angle(self.to(u.milliarcsecond, u.parallax()))\n"},{"className":"FlatwCDM","col":0,"comment":"\n    FLRW cosmology with a constant dark energy equation of state and no spatial\n    curvature.\n\n    This has one additional attribute beyond those of FLRW.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    w0 : float, optional\n        Dark energy equation of state at all redshifts. This is\n        pressure/density for dark energy in units where c=1. A cosmological\n        constant has w0=-1.0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import FlatwCDM\n    >>> cosmo = FlatwCDM(H0=70, Om0=0.3, w0=-0.9)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n    ","endLoc":2447,"id":14836,"nodeType":"Class","startLoc":2322,"text":"class FlatwCDM(FlatFLRWMixin, wCDM):\n    \"\"\"\n    FLRW cosmology with a constant dark energy equation of state and no spatial\n    curvature.\n\n    This has one additional attribute beyond those of FLRW.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    w0 : float, optional\n        Dark energy equation of state at all redshifts. This is\n        pressure/density for dark energy in units where c=1. A cosmological\n        constant has w0=-1.0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import FlatwCDM\n    >>> cosmo = FlatwCDM(H0=70, Om0=0.3, w0=-0.9)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n    \"\"\"\n\n    def __init__(self, H0, Om0, w0=-1.0, Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV,\n                 Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=0.0, w0=w0, Tcmb0=Tcmb0,\n                         Neff=Neff, m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fwcdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._w0)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fwcdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._w0)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fwcdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._w0)\n\n    def efunc(self, z):\n        \"\"\"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return np.sqrt(zp1 ** 3 * (Or * zp1 + self._Om0) +\n                       self._Ode0 * zp1 ** (3. * (1 + self._w0)))\n\n    def inv_efunc(self, z):\n        r\"\"\"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The inverse redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return (zp1 ** 3 * (Or * zp1 + self._Om0) +\n                self._Ode0 * zp1 ** (3. * (1. + self._w0)))**(-0.5)"},{"className":"Distance","col":0,"comment":"\n    A one-dimensional distance.\n\n    This can be initialized by providing one of the following:\n\n    * Distance ``value`` (array or float) and a ``unit``\n    * |Quantity| object with dimensionality of length\n    * Redshift and (optionally) a `~astropy.cosmology.Cosmology`\n    * Distance modulus\n    * Parallax\n\n    Parameters\n    ----------\n    value : scalar or `~astropy.units.Quantity` ['length']\n        The value of this distance.\n    unit : `~astropy.units.UnitBase` ['length']\n        The unit for this distance.\n    z : float\n        A redshift for this distance.  It will be converted to a distance\n        by computing the luminosity distance for this redshift given the\n        cosmology specified by ``cosmology``. Must be given as a keyword\n        argument.\n    cosmology : `~astropy.cosmology.Cosmology` or None\n        A cosmology that will be used to compute the distance from ``z``.\n        If `None`, the current cosmology will be used (see\n        `astropy.cosmology` for details).\n    distmod : float or `~astropy.units.Quantity`\n        The distance modulus for this distance. Note that if ``unit`` is not\n        provided, a guess will be made at the unit between AU, pc, kpc, and Mpc.\n    parallax : `~astropy.units.Quantity` or `~astropy.coordinates.Angle`\n        The parallax in angular units.\n    dtype : `~numpy.dtype`, optional\n        See `~astropy.units.Quantity`.\n    copy : bool, optional\n        See `~astropy.units.Quantity`.\n    order : {'C', 'F', 'A'}, optional\n        See `~astropy.units.Quantity`.\n    subok : bool, optional\n        See `~astropy.units.Quantity`.\n    ndmin : int, optional\n        See `~astropy.units.Quantity`.\n    allow_negative : bool, optional\n        Whether to allow negative distances (which are possible in some\n        cosmologies).  Default: `False`.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If the ``unit`` is not a length unit.\n    ValueError\n        If value specified is less than 0 and ``allow_negative=False``.\n\n        If ``cosmology`` is provided when ``z`` is *not* given.\n\n        If either none or more than one of ``value``, ``z``, ``distmod``,\n        or ``parallax`` were given.\n\n\n    Examples\n    --------\n    >>> from astropy import units as u\n    >>> from astropy.cosmology import WMAP5\n    >>> Distance(10, u.Mpc)\n    <Distance 10. Mpc>\n    >>> Distance(40*u.pc, unit=u.kpc)\n    <Distance 0.04 kpc>\n    >>> Distance(z=0.23)                      # doctest: +FLOAT_CMP\n    <Distance 1184.01657566 Mpc>\n    >>> Distance(z=0.23, cosmology=WMAP5)     # doctest: +FLOAT_CMP\n    <Distance 1147.78831918 Mpc>\n    >>> Distance(distmod=24.47*u.mag)         # doctest: +FLOAT_CMP\n    <Distance 783.42964277 kpc>\n    >>> Distance(parallax=21.34*u.mas)        # doctest: +FLOAT_CMP\n    <Distance 46.86035614 pc>\n    ","endLoc":243,"id":14837,"nodeType":"Class","startLoc":22,"text":"class Distance(u.SpecificTypeQuantity):\n    \"\"\"\n    A one-dimensional distance.\n\n    This can be initialized by providing one of the following:\n\n    * Distance ``value`` (array or float) and a ``unit``\n    * |Quantity| object with dimensionality of length\n    * Redshift and (optionally) a `~astropy.cosmology.Cosmology`\n    * Distance modulus\n    * Parallax\n\n    Parameters\n    ----------\n    value : scalar or `~astropy.units.Quantity` ['length']\n        The value of this distance.\n    unit : `~astropy.units.UnitBase` ['length']\n        The unit for this distance.\n    z : float\n        A redshift for this distance.  It will be converted to a distance\n        by computing the luminosity distance for this redshift given the\n        cosmology specified by ``cosmology``. Must be given as a keyword\n        argument.\n    cosmology : `~astropy.cosmology.Cosmology` or None\n        A cosmology that will be used to compute the distance from ``z``.\n        If `None`, the current cosmology will be used (see\n        `astropy.cosmology` for details).\n    distmod : float or `~astropy.units.Quantity`\n        The distance modulus for this distance. Note that if ``unit`` is not\n        provided, a guess will be made at the unit between AU, pc, kpc, and Mpc.\n    parallax : `~astropy.units.Quantity` or `~astropy.coordinates.Angle`\n        The parallax in angular units.\n    dtype : `~numpy.dtype`, optional\n        See `~astropy.units.Quantity`.\n    copy : bool, optional\n        See `~astropy.units.Quantity`.\n    order : {'C', 'F', 'A'}, optional\n        See `~astropy.units.Quantity`.\n    subok : bool, optional\n        See `~astropy.units.Quantity`.\n    ndmin : int, optional\n        See `~astropy.units.Quantity`.\n    allow_negative : bool, optional\n        Whether to allow negative distances (which are possible in some\n        cosmologies).  Default: `False`.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If the ``unit`` is not a length unit.\n    ValueError\n        If value specified is less than 0 and ``allow_negative=False``.\n\n        If ``cosmology`` is provided when ``z`` is *not* given.\n\n        If either none or more than one of ``value``, ``z``, ``distmod``,\n        or ``parallax`` were given.\n\n\n    Examples\n    --------\n    >>> from astropy import units as u\n    >>> from astropy.cosmology import WMAP5\n    >>> Distance(10, u.Mpc)\n    <Distance 10. Mpc>\n    >>> Distance(40*u.pc, unit=u.kpc)\n    <Distance 0.04 kpc>\n    >>> Distance(z=0.23)                      # doctest: +FLOAT_CMP\n    <Distance 1184.01657566 Mpc>\n    >>> Distance(z=0.23, cosmology=WMAP5)     # doctest: +FLOAT_CMP\n    <Distance 1147.78831918 Mpc>\n    >>> Distance(distmod=24.47*u.mag)         # doctest: +FLOAT_CMP\n    <Distance 783.42964277 kpc>\n    >>> Distance(parallax=21.34*u.mas)        # doctest: +FLOAT_CMP\n    <Distance 46.86035614 pc>\n    \"\"\"\n\n    _equivalent_unit = u.m\n    _include_easy_conversion_members = True\n\n    def __new__(cls, value=None, unit=None, z=None, cosmology=None,\n                distmod=None, parallax=None, dtype=None, copy=True, order=None,\n                subok=False, ndmin=0, allow_negative=False):\n\n        n_not_none = sum(x is not None for x in [value, z, distmod, parallax])\n        if n_not_none == 0:\n            raise ValueError('none of `value`, `z`, `distmod`, or `parallax` '\n                             'were given to Distance constructor')\n        elif n_not_none > 1:\n            raise ValueError('more than one of `value`, `z`, `distmod`, or '\n                             '`parallax` were given to Distance constructor')\n\n        if value is None:\n            # If something else but `value` was provided then a new array will\n            # be created anyways and there is no need to copy that.\n            copy = False\n\n        if z is not None:\n            if cosmology is None:\n                from astropy.cosmology import default_cosmology\n                cosmology = default_cosmology.get()\n\n            value = cosmology.luminosity_distance(z)\n\n        elif cosmology is not None:\n            raise ValueError('a `cosmology` was given but `z` was not '\n                             'provided in Distance constructor')\n\n        elif distmod is not None:\n            value = cls._distmod_to_pc(distmod)\n            if unit is None:\n                # if the unit is not specified, guess based on the mean of\n                # the log of the distance\n                meanlogval = np.log10(value.value).mean()\n                if meanlogval > 6:\n                    unit = u.Mpc\n                elif meanlogval > 3:\n                    unit = u.kpc\n                elif meanlogval < -3:  # ~200 AU\n                    unit = u.AU\n                else:\n                    unit = u.pc\n\n        elif parallax is not None:\n            if unit is None:\n                unit = u.pc\n            value = parallax.to_value(unit, equivalencies=u.parallax())\n\n            if np.any(parallax < 0):\n                if allow_negative:\n                    warnings.warn(\n                        \"negative parallaxes are converted to NaN \"\n                        \"distances even when `allow_negative=True`, \"\n                        \"because negative parallaxes cannot be transformed \"\n                        \"into distances. See the discussion in this paper: \"\n                        \"https://arxiv.org/abs/1507.02105\", AstropyWarning)\n                else:\n                    raise ValueError(\n                        \"some parallaxes are negative, which are not \"\n                        \"interpretable as distances. See the discussion in \"\n                        \"this paper: https://arxiv.org/abs/1507.02105 . You \"\n                        \"can convert negative parallaxes to NaN distances by \"\n                        \"providing the `allow_negative=True` argument.\")\n\n        # now we have arguments like for a Quantity, so let it do the work\n        distance = super().__new__(\n            cls, value, unit, dtype=dtype, copy=copy, order=order,\n            subok=subok, ndmin=ndmin)\n\n        # This invalid catch block can be removed when the minimum numpy\n        # version is >= 1.19 (NUMPY_LT_1_19)\n        with np.errstate(invalid='ignore'):\n            any_negative = np.any(distance.value < 0)\n\n        if not allow_negative and any_negative:\n            raise ValueError(\"distance must be >= 0. Use the argument \"\n                             \"`allow_negative=True` to allow negative values.\")\n\n        return distance\n\n    @property\n    def z(self):\n        \"\"\"Short for ``self.compute_z()``\"\"\"\n        return self.compute_z()\n\n    def compute_z(self, cosmology=None, **atzkw):\n        \"\"\"\n        The redshift for this distance assuming its physical distance is\n        a luminosity distance.\n\n        Parameters\n        ----------\n        cosmology : `~astropy.cosmology.Cosmology` or None\n            The cosmology to assume for this calculation, or `None` to use the\n            current cosmology (see `astropy.cosmology` for details).\n        **atzkw\n            keyword arguments for :func:`~astropy.cosmology.z_at_value`\n\n        Returns\n        -------\n        z : `~astropy.units.Quantity`\n            The redshift of this distance given the provided ``cosmology``.\n\n        Warnings\n        --------\n        This method can be slow for large arrays.\n        The redshift is determined using :func:`astropy.cosmology.z_at_value`,\n        which handles vector inputs (e.g. an array of distances) by\n        element-wise calling of :func:`scipy.optimize.minimize_scalar`.\n        For faster results consider using an interpolation table;\n        :func:`astropy.cosmology.z_at_value` provides details.\n\n        See Also\n        --------\n        :func:`astropy.cosmology.z_at_value`\n            Find the redshift corresponding to a\n            :meth:`astropy.cosmology.FLRW.luminosity_distance`.\n        \"\"\"\n        from astropy.cosmology import z_at_value\n\n        if cosmology is None:\n            from astropy.cosmology import default_cosmology\n            cosmology = default_cosmology.get()\n\n        atzkw.setdefault(\"ztol\", 1.e-10)\n        return z_at_value(cosmology.luminosity_distance, self, **atzkw)\n\n    @property\n    def distmod(self):\n        \"\"\"The distance modulus as a `~astropy.units.Quantity`\"\"\"\n        val = 5. * np.log10(self.to_value(u.pc)) - 5.\n        return u.Quantity(val, u.mag, copy=False)\n\n    @classmethod\n    def _distmod_to_pc(cls, dm):\n        dm = u.Quantity(dm, u.mag)\n        return cls(10 ** ((dm.value + 5) / 5.), u.pc, copy=False)\n\n    @property\n    def parallax(self):\n        \"\"\"The parallax angle as an `~astropy.coordinates.Angle` object\"\"\"\n        return Angle(self.to(u.milliarcsecond, u.parallax()))"},{"col":4,"comment":"null","endLoc":2403,"header":"def __init__(self, H0, Om0, w0=-1.0, Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV,\n                 Ob0=None, *, name=None, meta=None)","id":14838,"name":"__init__","nodeType":"Function","startLoc":2382,"text":"def __init__(self, H0, Om0, w0=-1.0, Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV,\n                 Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=0.0, w0=w0, Tcmb0=Tcmb0,\n                         Neff=Neff, m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fwcdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._w0)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fwcdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._w0)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fwcdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._w0)"},{"col":4,"comment":"Short for ``self.compute_z()``","endLoc":185,"header":"@property\n    def z(self)","id":14839,"name":"z","nodeType":"Function","startLoc":182,"text":"@property\n    def z(self):\n        \"\"\"Short for ``self.compute_z()``\"\"\"\n        return self.compute_z()"},{"attributeType":"null","col":8,"comment":"null","endLoc":368,"id":14840,"name":"_default_size","nodeType":"Attribute","startLoc":368,"text":"self._default_size"},{"attributeType":"Disk2D","col":8,"comment":"null","endLoc":367,"id":14841,"name":"_model","nodeType":"Attribute","startLoc":367,"text":"self._model"},{"col":4,"comment":"\n        The redshift for this distance assuming its physical distance is\n        a luminosity distance.\n\n        Parameters\n        ----------\n        cosmology : `~astropy.cosmology.Cosmology` or None\n            The cosmology to assume for this calculation, or `None` to use the\n            current cosmology (see `astropy.cosmology` for details).\n        **atzkw\n            keyword arguments for :func:`~astropy.cosmology.z_at_value`\n\n        Returns\n        -------\n        z : `~astropy.units.Quantity`\n            The redshift of this distance given the provided ``cosmology``.\n\n        Warnings\n        --------\n        This method can be slow for large arrays.\n        The redshift is determined using :func:`astropy.cosmology.z_at_value`,\n        which handles vector inputs (e.g. an array of distances) by\n        element-wise calling of :func:`scipy.optimize.minimize_scalar`.\n        For faster results consider using an interpolation table;\n        :func:`astropy.cosmology.z_at_value` provides details.\n\n        See Also\n        --------\n        :func:`astropy.cosmology.z_at_value`\n            Find the redshift corresponding to a\n            :meth:`astropy.cosmology.FLRW.luminosity_distance`.\n        ","endLoc":227,"header":"def compute_z(self, cosmology=None, **atzkw)","id":14842,"name":"compute_z","nodeType":"Function","startLoc":187,"text":"def compute_z(self, cosmology=None, **atzkw):\n        \"\"\"\n        The redshift for this distance assuming its physical distance is\n        a luminosity distance.\n\n        Parameters\n        ----------\n        cosmology : `~astropy.cosmology.Cosmology` or None\n            The cosmology to assume for this calculation, or `None` to use the\n            current cosmology (see `astropy.cosmology` for details).\n        **atzkw\n            keyword arguments for :func:`~astropy.cosmology.z_at_value`\n\n        Returns\n        -------\n        z : `~astropy.units.Quantity`\n            The redshift of this distance given the provided ``cosmology``.\n\n        Warnings\n        --------\n        This method can be slow for large arrays.\n        The redshift is determined using :func:`astropy.cosmology.z_at_value`,\n        which handles vector inputs (e.g. an array of distances) by\n        element-wise calling of :func:`scipy.optimize.minimize_scalar`.\n        For faster results consider using an interpolation table;\n        :func:`astropy.cosmology.z_at_value` provides details.\n\n        See Also\n        --------\n        :func:`astropy.cosmology.z_at_value`\n            Find the redshift corresponding to a\n            :meth:`astropy.cosmology.FLRW.luminosity_distance`.\n        \"\"\"\n        from astropy.cosmology import z_at_value\n\n        if cosmology is None:\n            from astropy.cosmology import default_cosmology\n            cosmology = default_cosmology.get()\n\n        atzkw.setdefault(\"ztol\", 1.e-10)\n        return z_at_value(cosmology.luminosity_distance, self, **atzkw)"},{"attributeType":"null","col":8,"comment":"null","endLoc":370,"id":14843,"name":"_truncation","nodeType":"Attribute","startLoc":370,"text":"self._truncation"},{"col":4,"comment":"The distance modulus as a `~astropy.units.Quantity`","endLoc":233,"header":"@property\n    def distmod(self)","id":14844,"name":"distmod","nodeType":"Function","startLoc":229,"text":"@property\n    def distmod(self):\n        \"\"\"The distance modulus as a `~astropy.units.Quantity`\"\"\"\n        val = 5. * np.log10(self.to_value(u.pc)) - 5.\n        return u.Quantity(val, u.mag, copy=False)"},{"attributeType":"null","col":16,"comment":"null","endLoc":8,"id":14845,"name":"np","nodeType":"Attribute","startLoc":8,"text":"np"},{"attributeType":"null","col":29,"comment":"null","endLoc":11,"id":14846,"name":"u","nodeType":"Attribute","startLoc":11,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":14847,"name":"LIBRARY_PATH","nodeType":"Attribute","startLoc":21,"text":"LIBRARY_PATH"},{"className":"Ring2DKernel","col":0,"comment":"\n    2D Ring filter kernel.\n\n    The Ring filter kernel is the difference between two Tophat kernels of\n    different width. This kernel is useful for, e.g., background estimation.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    radius_in : number\n        Inner radius of the ring kernel.\n    width : number\n        Width of the ring kernel.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, Tophat2DKernel, RickerWavelet2DKernel,\n    TrapezoidDisk2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Ring2DKernel\n        ring_2D_kernel = Ring2DKernel(9, 8)\n        plt.imshow(ring_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n    ","endLoc":432,"id":14848,"nodeType":"Class","startLoc":373,"text":"class Ring2DKernel(Kernel2D):\n    \"\"\"\n    2D Ring filter kernel.\n\n    The Ring filter kernel is the difference between two Tophat kernels of\n    different width. This kernel is useful for, e.g., background estimation.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    radius_in : number\n        Inner radius of the ring kernel.\n    width : number\n        Width of the ring kernel.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, Tophat2DKernel, RickerWavelet2DKernel,\n    TrapezoidDisk2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Ring2DKernel\n        ring_2D_kernel = Ring2DKernel(9, 8)\n        plt.imshow(ring_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n    \"\"\"\n    def __init__(self, radius_in, width, **kwargs):\n        radius_out = radius_in + width\n        self._model = models.Ring2D(1. / (np.pi * (radius_out ** 2 - radius_in ** 2)),\n                                    0, 0, radius_in, width)\n        self._default_size = _round_up_to_odd_integer(2 * radius_out)\n        super().__init__(**kwargs)\n        self._truncation = 0"},{"attributeType":"null","col":8,"comment":"null","endLoc":28,"id":14849,"name":"_convolve","nodeType":"Attribute","startLoc":28,"text":"_convolve"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":14850,"name":"_convolveNd_c","nodeType":"Attribute","startLoc":37,"text":"_convolveNd_c"},{"attributeType":"None","col":0,"comment":"null","endLoc":38,"id":14851,"name":"restype","nodeType":"Attribute","startLoc":38,"text":"_convolveNd_c.restype"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":14852,"name":"argtypes","nodeType":"Attribute","startLoc":39,"text":"_convolveNd_c.argtypes"},{"attributeType":"null","col":0,"comment":"null","endLoc":54,"id":14853,"name":"_good_sizes","nodeType":"Attribute","startLoc":54,"text":"_good_sizes"},{"col":4,"comment":"null","endLoc":432,"header":"def __init__(self, radius_in, width, **kwargs)","id":14854,"name":"__init__","nodeType":"Function","startLoc":426,"text":"def __init__(self, radius_in, width, **kwargs):\n        radius_out = radius_in + width\n        self._model = models.Ring2D(1. / (np.pi * (radius_out ** 2 - radius_in ** 2)),\n                                    0, 0, radius_in, width)\n        self._default_size = _round_up_to_odd_integer(2 * radius_out)\n        super().__init__(**kwargs)\n        self._truncation = 0"},{"attributeType":"null","col":4,"comment":"null","endLoc":702,"id":14855,"name":"_is_bool","nodeType":"Attribute","startLoc":702,"text":"_is_bool"},{"attributeType":"null","col":8,"comment":"null","endLoc":707,"id":14856,"name":"_default_size","nodeType":"Attribute","startLoc":707,"text":"self._default_size"},{"attributeType":"null","col":8,"comment":"null","endLoc":706,"id":14857,"name":"_model","nodeType":"Attribute","startLoc":706,"text":"self._model"},{"attributeType":"null","col":0,"comment":"null","endLoc":70,"id":14858,"name":"_good_range","nodeType":"Attribute","startLoc":70,"text":"_good_range"},{"attributeType":"null","col":0,"comment":"null","endLoc":73,"id":14859,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":73,"text":"__doctest_requires__"},{"attributeType":"null","col":0,"comment":"null","endLoc":75,"id":14860,"name":"BOUNDARY_OPTIONS","nodeType":"Attribute","startLoc":75,"text":"BOUNDARY_OPTIONS"},{"col":0,"comment":"","endLoc":3,"header":"convolve.py#<anonymous>","id":14861,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"LIBRARY_PATH = os.path.dirname(__file__)\n\ntry:\n    with warnings.catch_warnings():\n        # numpy.distutils is deprecated since numpy 1.23\n        # see https://github.com/astropy/astropy/issues/12865\n        warnings.simplefilter('ignore', DeprecationWarning)\n        _convolve = load_library(\"_convolve\", LIBRARY_PATH)\nexcept Exception:\n    raise ImportError(\"Convolution C extension is missing. Try re-building astropy.\")\n\n_convolveNd_c = _convolve.convolveNd_c\n\n_convolveNd_c.restype = None\n\n_convolveNd_c.argtypes = [ndpointer(ctypes.c_double, flags={\"C_CONTIGUOUS\", \"WRITEABLE\"}),  # return array\n                          ndpointer(ctypes.c_double, flags=\"C_CONTIGUOUS\"),  # input array\n                          ctypes.c_uint,  # N dim\n                          # size array for input and result unless\n                          # embed_result_within_padded_region is False,\n                          # in which case the result array is assumed to be\n                          # input.shape - 2*(kernel.shape//2). Note: integer division.\n                          ndpointer(ctypes.c_size_t, flags=\"C_CONTIGUOUS\"),\n                          ndpointer(ctypes.c_double, flags=\"C_CONTIGUOUS\"),  # kernel array\n                          ndpointer(ctypes.c_size_t, flags=\"C_CONTIGUOUS\"),  # size array for kernel\n                          ctypes.c_bool,  # nan_interpolate\n                          ctypes.c_bool,  # embed_result_within_padded_region\n                          ctypes.c_uint]  # n_threads\n\n_good_sizes = np.array([   0,    1,    2,    3,    4,    5,    6,    8,    9,   10,   12,  # noqa E201\n                          15,   16,   18,   20,   24,   25,   27,   30,   32,   36,   40,\n                          45,   48,   50,   54,   60,   64,   72,   75,   80,   81,   90,\n                          96,  100,  108,  120,  125,  128,  135,  144,  150,  160,  162,\n                         180,  192,  200,  216,  225,  240,  243,  250,  256,  270,  288,\n                         300,  320,  324,  360,  375,  384,  400,  405,  432,  450,  480,\n                         486,  500,  512,  540,  576,  600,  625,  640,  648,  675,  720,\n                         729,  750,  768,  800,  810,  864,  900,  960,  972, 1000, 1024,\n                        1080, 1125, 1152, 1200, 1215, 1250, 1280, 1296, 1350, 1440, 1458,\n                        1500, 1536, 1600, 1620, 1728, 1800, 1875, 1920, 1944, 2000, 2025,\n                        2048, 2160, 2187, 2250, 2304, 2400, 2430, 2500, 2560, 2592, 2700,\n                        2880, 2916, 3000, 3072, 3125, 3200, 3240, 3375, 3456, 3600, 3645,\n                        3750, 3840, 3888, 4000, 4050, 4096, 4320, 4374, 4500, 4608, 4800,\n                        4860, 5000, 5120, 5184, 5400, 5625, 5760, 5832, 6000, 6075, 6144,\n                        6250, 6400, 6480, 6561, 6750, 6912, 7200, 7290, 7500, 7680, 7776,\n                        8000, 8100, 8192, 8640, 8748, 9000, 9216, 9375, 9600, 9720, 10000])\n\n_good_range = int(np.log10(_good_sizes[-1]))\n\n__doctest_requires__ = {('convolve_fft',): ['scipy.fft']}\n\nBOUNDARY_OPTIONS = [None, 'fill', 'wrap', 'extend']"},{"attributeType":"null","col":8,"comment":"null","endLoc":709,"id":14862,"name":"_truncation","nodeType":"Attribute","startLoc":709,"text":"self._truncation"},{"fileName":"transformations.py","filePath":"astropy/coordinates","id":14863,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module contains a general framework for defining graphs of transformations\nbetween coordinates, suitable for either spatial coordinates or more generalized\ncoordinate systems.\n\nThe fundamental idea is that each class is a node in the transformation graph,\nand transitions from one node to another are defined as functions (or methods)\nwrapped in transformation objects.\n\nThis module also includes more specific transformation classes for\ncelestial/spatial coordinate frames, generally focused around matrix-style\ntransformations that are typically how the algorithms are defined.\n\"\"\"\n\n\nimport heapq\nimport inspect\nimport subprocess\nfrom warnings import warn\n\nfrom abc import ABCMeta, abstractmethod\nfrom collections import defaultdict\nfrom contextlib import suppress, contextmanager\nfrom inspect import signature\n\nimport numpy as np\n\nfrom astropy import units as u\nfrom astropy.utils.exceptions import AstropyWarning\n\nfrom .matrix_utilities import matrix_product\n\n__all__ = ['TransformGraph', 'CoordinateTransform', 'FunctionTransform',\n           'BaseAffineTransform', 'AffineTransform',\n           'StaticMatrixTransform', 'DynamicMatrixTransform',\n           'FunctionTransformWithFiniteDifference', 'CompositeTransform']\n\n\ndef frame_attrs_from_set(frame_set):\n    \"\"\"\n    A `dict` of all the attributes of all frame classes in this\n    `TransformGraph`.\n\n    Broken out of the class so this can be called on a temporary frame set to\n    validate new additions to the transform graph before actually adding them.\n    \"\"\"\n    result = {}\n\n    for frame_cls in frame_set:\n        result.update(frame_cls.frame_attributes)\n\n    return result\n\n\ndef frame_comps_from_set(frame_set):\n    \"\"\"\n    A `set` of all component names every defined within any frame class in\n    this `TransformGraph`.\n\n    Broken out of the class so this can be called on a temporary frame set to\n    validate new additions to the transform graph before actually adding them.\n    \"\"\"\n    result = set()\n\n    for frame_cls in frame_set:\n        rep_info = frame_cls._frame_specific_representation_info\n        for mappings in rep_info.values():\n            for rep_map in mappings:\n                result.update([rep_map.framename])\n\n    return result\n\n\nclass TransformGraph:\n    \"\"\"\n    A graph representing the paths between coordinate frames.\n    \"\"\"\n\n    def __init__(self):\n        self._graph = defaultdict(dict)\n        self.invalidate_cache()  # generates cache entries\n\n    @property\n    def _cached_names(self):\n        if self._cached_names_dct is None:\n            self._cached_names_dct = dct = {}\n            for c in self.frame_set:\n                nm = getattr(c, 'name', None)\n                if nm is not None:\n                    if not isinstance(nm, list):\n                        nm = [nm]\n                    for name in nm:\n                        dct[name] = c\n\n        return self._cached_names_dct\n\n    @property\n    def frame_set(self):\n        \"\"\"\n        A `set` of all the frame classes present in this `TransformGraph`.\n        \"\"\"\n        if self._cached_frame_set is None:\n            self._cached_frame_set = set()\n            for a in self._graph:\n                self._cached_frame_set.add(a)\n                for b in self._graph[a]:\n                    self._cached_frame_set.add(b)\n\n        return self._cached_frame_set.copy()\n\n    @property\n    def frame_attributes(self):\n        \"\"\"\n        A `dict` of all the attributes of all frame classes in this\n        `TransformGraph`.\n        \"\"\"\n        if self._cached_frame_attributes is None:\n            self._cached_frame_attributes = frame_attrs_from_set(self.frame_set)\n\n        return self._cached_frame_attributes\n\n    @property\n    def frame_component_names(self):\n        \"\"\"\n        A `set` of all component names every defined within any frame class in\n        this `TransformGraph`.\n        \"\"\"\n        if self._cached_component_names is None:\n            self._cached_component_names = frame_comps_from_set(self.frame_set)\n\n        return self._cached_component_names\n\n    def invalidate_cache(self):\n        \"\"\"\n        Invalidates the cache that stores optimizations for traversing the\n        transform graph.  This is called automatically when transforms\n        are added or removed, but will need to be called manually if\n        weights on transforms are modified inplace.\n        \"\"\"\n        self._cached_names_dct = None\n        self._cached_frame_set = None\n        self._cached_frame_attributes = None\n        self._cached_component_names = None\n        self._shortestpaths = {}\n        self._composite_cache = {}\n\n    def add_transform(self, fromsys, tosys, transform):\n        \"\"\"\n        Add a new coordinate transformation to the graph.\n\n        Parameters\n        ----------\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform into.\n        transform : `CoordinateTransform`\n            The transformation object. Typically a `CoordinateTransform` object,\n            although it may be some other callable that is called with the same\n            signature.\n\n        Raises\n        ------\n        TypeError\n            If ``fromsys`` or ``tosys`` are not classes or ``transform`` is\n            not callable.\n        \"\"\"\n\n        if not inspect.isclass(fromsys):\n            raise TypeError('fromsys must be a class')\n        if not inspect.isclass(tosys):\n            raise TypeError('tosys must be a class')\n        if not callable(transform):\n            raise TypeError('transform must be callable')\n\n        frame_set = self.frame_set.copy()\n        frame_set.add(fromsys)\n        frame_set.add(tosys)\n\n        # Now we check to see if any attributes on the proposed frames override\n        # *any* component names, which we can't allow for some of the logic in\n        # the SkyCoord initializer to work\n        attrs = set(frame_attrs_from_set(frame_set).keys())\n        comps = frame_comps_from_set(frame_set)\n\n        invalid_attrs = attrs.intersection(comps)\n        if invalid_attrs:\n            invalid_frames = set()\n            for attr in invalid_attrs:\n                if attr in fromsys.frame_attributes:\n                    invalid_frames.update([fromsys])\n\n                if attr in tosys.frame_attributes:\n                    invalid_frames.update([tosys])\n\n            raise ValueError(\"Frame(s) {} contain invalid attribute names: {}\"\n                             \"\\nFrame attributes can not conflict with *any* of\"\n                             \" the frame data component names (see\"\n                             \" `frame_transform_graph.frame_component_names`).\"\n                             .format(list(invalid_frames), invalid_attrs))\n\n        self._graph[fromsys][tosys] = transform\n        self.invalidate_cache()\n\n    def remove_transform(self, fromsys, tosys, transform):\n        \"\"\"\n        Removes a coordinate transform from the graph.\n\n        Parameters\n        ----------\n        fromsys : class or None\n            The coordinate frame *class* to start from. If `None`,\n            ``transform`` will be searched for and removed (``tosys`` must\n            also be `None`).\n        tosys : class or None\n            The coordinate frame *class* to transform into. If `None`,\n            ``transform`` will be searched for and removed (``fromsys`` must\n            also be `None`).\n        transform : callable or None\n            The transformation object to be removed or `None`.  If `None`\n            and ``tosys`` and ``fromsys`` are supplied, there will be no\n            check to ensure the correct object is removed.\n        \"\"\"\n        if fromsys is None or tosys is None:\n            if not (tosys is None and fromsys is None):\n                raise ValueError('fromsys and tosys must both be None if either are')\n            if transform is None:\n                raise ValueError('cannot give all Nones to remove_transform')\n\n            # search for the requested transform by brute force and remove it\n            for a in self._graph:\n                agraph = self._graph[a]\n                for b in agraph:\n                    if agraph[b] is transform:\n                        del agraph[b]\n                        fromsys = a\n                        break\n\n                # If the transform was found, need to break out of the outer for loop too\n                if fromsys:\n                    break\n            else:\n                raise ValueError(f'Could not find transform {transform} in the graph')\n\n        else:\n            if transform is None:\n                self._graph[fromsys].pop(tosys, None)\n            else:\n                curr = self._graph[fromsys].get(tosys, None)\n                if curr is transform:\n                    self._graph[fromsys].pop(tosys)\n                else:\n                    raise ValueError('Current transform from {} to {} is not '\n                                     '{}'.format(fromsys, tosys, transform))\n\n        # Remove the subgraph if it is now empty\n        if self._graph[fromsys] == {}:\n            self._graph.pop(fromsys)\n\n        self.invalidate_cache()\n\n    def find_shortest_path(self, fromsys, tosys):\n        \"\"\"\n        Computes the shortest distance along the transform graph from\n        one system to another.\n\n        Parameters\n        ----------\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform into.\n\n        Returns\n        -------\n        path : list of class or None\n            The path from ``fromsys`` to ``tosys`` as an in-order sequence\n            of classes.  This list includes *both* ``fromsys`` and\n            ``tosys``. Is `None` if there is no possible path.\n        distance : float or int\n            The total distance/priority from ``fromsys`` to ``tosys``.  If\n            priorities are not set this is the number of transforms\n            needed. Is ``inf`` if there is no possible path.\n        \"\"\"\n\n        inf = float('inf')\n\n        # special-case the 0 or 1-path\n        if tosys is fromsys:\n            if tosys not in self._graph[fromsys]:\n                # Means there's no transform necessary to go from it to itself.\n                return [tosys], 0\n        if tosys in self._graph[fromsys]:\n            # this will also catch the case where tosys is fromsys, but has\n            # a defined transform.\n            t = self._graph[fromsys][tosys]\n            return [fromsys, tosys], float(t.priority if hasattr(t, 'priority') else 1)\n\n        # otherwise, need to construct the path:\n\n        if fromsys in self._shortestpaths:\n            # already have a cached result\n            fpaths = self._shortestpaths[fromsys]\n            if tosys in fpaths:\n                return fpaths[tosys]\n            else:\n                return None, inf\n\n        # use Dijkstra's algorithm to find shortest path in all other cases\n\n        nodes = []\n        # first make the list of nodes\n        for a in self._graph:\n            if a not in nodes:\n                nodes.append(a)\n            for b in self._graph[a]:\n                if b not in nodes:\n                    nodes.append(b)\n\n        if fromsys not in nodes or tosys not in nodes:\n            # fromsys or tosys are isolated or not registered, so there's\n            # certainly no way to get from one to the other\n            return None, inf\n\n        edgeweights = {}\n        # construct another graph that is a dict of dicts of priorities\n        # (used as edge weights in Dijkstra's algorithm)\n        for a in self._graph:\n            edgeweights[a] = aew = {}\n            agraph = self._graph[a]\n            for b in agraph:\n                aew[b] = float(agraph[b].priority if hasattr(agraph[b], 'priority') else 1)\n\n        # entries in q are [distance, count, nodeobj, pathlist]\n        # count is needed because in py 3.x, tie-breaking fails on the nodes.\n        # this way, insertion order is preserved if the weights are the same\n        q = [[inf, i, n, []] for i, n in enumerate(nodes) if n is not fromsys]\n        q.insert(0, [0, -1, fromsys, []])\n\n        # this dict will store the distance to node from ``fromsys`` and the path\n        result = {}\n\n        # definitely starts as a valid heap because of the insert line; from the\n        # node to itself is always the shortest distance\n        while len(q) > 0:\n            d, orderi, n, path = heapq.heappop(q)\n\n            if d == inf:\n                # everything left is unreachable from fromsys, just copy them to\n                # the results and jump out of the loop\n                result[n] = (None, d)\n                for d, orderi, n, path in q:\n                    result[n] = (None, d)\n                break\n            else:\n                result[n] = (path, d)\n                path.append(n)\n                if n not in edgeweights:\n                    # this is a system that can be transformed to, but not from.\n                    continue\n                for n2 in edgeweights[n]:\n                    if n2 not in result:  # already visited\n                        # find where n2 is in the heap\n                        for i in range(len(q)):\n                            if q[i][2] == n2:\n                                break\n                        else:\n                            raise ValueError('n2 not in heap - this should be impossible!')\n\n                        newd = d + edgeweights[n][n2]\n                        if newd < q[i][0]:\n                            q[i][0] = newd\n                            q[i][3] = list(path)\n                            heapq.heapify(q)\n\n        # cache for later use\n        self._shortestpaths[fromsys] = result\n        return result[tosys]\n\n    def get_transform(self, fromsys, tosys):\n        \"\"\"\n        Generates and returns the `CompositeTransform` for a transformation\n        between two coordinate systems.\n\n        Parameters\n        ----------\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform into.\n\n        Returns\n        -------\n        trans : `CompositeTransform` or None\n            If there is a path from ``fromsys`` to ``tosys``, this is a\n            transform object for that path.   If no path could be found, this is\n            `None`.\n\n        Notes\n        -----\n        This function always returns a `CompositeTransform`, because\n        `CompositeTransform` is slightly more adaptable in the way it can be\n        called than other transform classes. Specifically, it takes care of\n        intermediate steps of transformations in a way that is consistent with\n        1-hop transformations.\n\n        \"\"\"\n        if not inspect.isclass(fromsys):\n            raise TypeError('fromsys is not a class')\n        if not inspect.isclass(tosys):\n            raise TypeError('tosys is not a class')\n\n        path, distance = self.find_shortest_path(fromsys, tosys)\n\n        if path is None:\n            return None\n\n        transforms = []\n        currsys = fromsys\n        for p in path[1:]:  # first element is fromsys so we skip it\n            transforms.append(self._graph[currsys][p])\n            currsys = p\n\n        fttuple = (fromsys, tosys)\n        if fttuple not in self._composite_cache:\n            comptrans = CompositeTransform(transforms, fromsys, tosys,\n                                           register_graph=False)\n            self._composite_cache[fttuple] = comptrans\n        return self._composite_cache[fttuple]\n\n    def lookup_name(self, name):\n        \"\"\"\n        Tries to locate the coordinate class with the provided alias.\n\n        Parameters\n        ----------\n        name : str\n            The alias to look up.\n\n        Returns\n        -------\n        `BaseCoordinateFrame` subclass\n            The coordinate class corresponding to the ``name`` or `None` if\n            no such class exists.\n        \"\"\"\n\n        return self._cached_names.get(name, None)\n\n    def get_names(self):\n        \"\"\"\n        Returns all available transform names. They will all be\n        valid arguments to `lookup_name`.\n\n        Returns\n        -------\n        nms : list\n            The aliases for coordinate systems.\n        \"\"\"\n        return list(self._cached_names.keys())\n\n    def to_dot_graph(self, priorities=True, addnodes=[], savefn=None,\n                     savelayout='plain', saveformat=None, color_edges=True):\n        \"\"\"\n        Converts this transform graph to the graphviz_ DOT format.\n\n        Optionally saves it (requires `graphviz`_ be installed and on your path).\n\n        .. _graphviz: http://www.graphviz.org/\n\n        Parameters\n        ----------\n        priorities : bool\n            If `True`, show the priority values for each transform.  Otherwise,\n            the will not be included in the graph.\n        addnodes : sequence of str\n            Additional coordinate systems to add (this can include systems\n            already in the transform graph, but they will only appear once).\n        savefn : None or str\n            The file name to save this graph to or `None` to not save\n            to a file.\n        savelayout : str\n            The graphviz program to use to layout the graph (see\n            graphviz_ for details) or 'plain' to just save the DOT graph\n            content. Ignored if ``savefn`` is `None`.\n        saveformat : str\n            The graphviz output format. (e.g. the ``-Txxx`` option for\n            the command line program - see graphviz docs for details).\n            Ignored if ``savefn`` is `None`.\n        color_edges : bool\n            Color the edges between two nodes (frames) based on the type of\n            transform. ``FunctionTransform``: red, ``StaticMatrixTransform``:\n            blue, ``DynamicMatrixTransform``: green.\n\n        Returns\n        -------\n        dotgraph : str\n            A string with the DOT format graph.\n        \"\"\"\n\n        nodes = []\n        # find the node names\n        for a in self._graph:\n            if a not in nodes:\n                nodes.append(a)\n            for b in self._graph[a]:\n                if b not in nodes:\n                    nodes.append(b)\n        for node in addnodes:\n            if node not in nodes:\n                nodes.append(node)\n        nodenames = []\n        invclsaliases = dict([(f, [k for k, v in self._cached_names.items() if v == f])\n                              for f in self.frame_set])\n        for n in nodes:\n            if n in invclsaliases:\n                aliases = '`\\\\n`'.join(invclsaliases[n])\n                nodenames.append('{0} [shape=oval label=\"{0}\\\\n`{1}`\"]'.format(n.__name__, aliases))\n            else:\n                nodenames.append(n.__name__ + '[ shape=oval ]')\n\n        edgenames = []\n        # Now the edges\n        for a in self._graph:\n            agraph = self._graph[a]\n            for b in agraph:\n                transform = agraph[b]\n                pri = transform.priority if hasattr(transform, 'priority') else 1\n                color = trans_to_color[transform.__class__] if color_edges else 'black'\n                edgenames.append((a.__name__, b.__name__, pri, color))\n\n        # generate simple dot format graph\n        lines = ['digraph AstropyCoordinateTransformGraph {']\n        lines.append('graph [rankdir=LR]')\n        lines.append('; '.join(nodenames) + ';')\n        for enm1, enm2, weights, color in edgenames:\n            labelstr_fmt = '[ {0} {1} ]'\n\n            if priorities:\n                priority_part = f'label = \"{weights}\"'\n            else:\n                priority_part = ''\n\n            color_part = f'color = \"{color}\"'\n\n            labelstr = labelstr_fmt.format(priority_part, color_part)\n            lines.append(f'{enm1} -> {enm2}{labelstr};')\n\n        lines.append('')\n        lines.append('overlap=false')\n        lines.append('}')\n        dotgraph = '\\n'.join(lines)\n\n        if savefn is not None:\n            if savelayout == 'plain':\n                with open(savefn, 'w') as f:\n                    f.write(dotgraph)\n            else:\n                args = [savelayout]\n                if saveformat is not None:\n                    args.append('-T' + saveformat)\n                proc = subprocess.Popen(args, stdin=subprocess.PIPE,\n                                        stdout=subprocess.PIPE,\n                                        stderr=subprocess.PIPE)\n                stdout, stderr = proc.communicate(dotgraph)\n                if proc.returncode != 0:\n                    raise OSError('problem running graphviz: \\n' + stderr)\n\n                with open(savefn, 'w') as f:\n                    f.write(stdout)\n\n        return dotgraph\n\n    def to_networkx_graph(self):\n        \"\"\"\n        Converts this transform graph into a networkx graph.\n\n        .. note::\n            You must have the `networkx <https://networkx.github.io/>`_\n            package installed for this to work.\n\n        Returns\n        -------\n        nxgraph : ``networkx.Graph``\n            This `TransformGraph` as a `networkx.Graph <https://networkx.github.io/documentation/stable/reference/classes/graph.html>`_.\n        \"\"\"\n        import networkx as nx\n\n        nxgraph = nx.Graph()\n\n        # first make the nodes\n        for a in self._graph:\n            if a not in nxgraph:\n                nxgraph.add_node(a)\n            for b in self._graph[a]:\n                if b not in nxgraph:\n                    nxgraph.add_node(b)\n\n        # Now the edges\n        for a in self._graph:\n            agraph = self._graph[a]\n            for b in agraph:\n                transform = agraph[b]\n                pri = transform.priority if hasattr(transform, 'priority') else 1\n                color = trans_to_color[transform.__class__]\n                nxgraph.add_edge(a, b, weight=pri, color=color)\n\n        return nxgraph\n\n    def transform(self, transcls, fromsys, tosys, priority=1, **kwargs):\n        \"\"\"\n        A function decorator for defining transformations.\n\n        .. note::\n            If decorating a static method of a class, ``@staticmethod``\n            should be  added *above* this decorator.\n\n        Parameters\n        ----------\n        transcls : class\n            The class of the transformation object to create.\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform into.\n        priority : float or int\n            The priority if this transform when finding the shortest\n            coordinate transform path - large numbers are lower priorities.\n\n        Additional keyword arguments are passed into the ``transcls``\n        constructor.\n\n        Returns\n        -------\n        deco : function\n            A function that can be called on another function as a decorator\n            (see example).\n\n        Notes\n        -----\n        This decorator assumes the first argument of the ``transcls``\n        initializer accepts a callable, and that the second and third\n        are ``fromsys`` and ``tosys``. If this is not true, you should just\n        initialize the class manually and use `add_transform` instead of\n        using this decorator.\n\n        Examples\n        --------\n\n        ::\n\n            graph = TransformGraph()\n\n            class Frame1(BaseCoordinateFrame):\n               ...\n\n            class Frame2(BaseCoordinateFrame):\n                ...\n\n            @graph.transform(FunctionTransform, Frame1, Frame2)\n            def f1_to_f2(f1_obj):\n                ... do something with f1_obj ...\n                return f2_obj\n\n\n        \"\"\"\n        def deco(func):\n            # this doesn't do anything directly with the transform because\n            # ``register_graph=self`` stores it in the transform graph\n            # automatically\n            transcls(func, fromsys, tosys, priority=priority,\n                     register_graph=self, **kwargs)\n            return func\n        return deco\n\n    def _add_merged_transform(self, fromsys, tosys, *furthersys, priority=1):\n        \"\"\"\n        Add a single-step transform that encapsulates a multi-step transformation path,\n        using the transforms that already exist in the graph.\n\n        The created transform internally calls the existing transforms.  If all of the\n        transforms are affine, the merged transform is\n        `~astropy.coordinates.transformations.DynamicMatrixTransform` (if there are no\n        origin shifts) or `~astropy.coordinates.transformations.AffineTransform`\n        (otherwise).  If at least one of the transforms is not affine, the merged\n        transform is\n        `~astropy.coordinates.transformations.FunctionTransformWithFiniteDifference`.\n\n        This method is primarily useful for defining loopback transformations\n        (i.e., where ``fromsys`` and the final ``tosys`` are the same).\n\n        Parameters\n        ----------\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform to.\n        furthersys : class\n            Additional coordinate frame classes to transform to in order.\n        priority : number\n            The priority of this transform when finding the shortest\n            coordinate transform path - large numbers are lower priorities.\n\n        Notes\n        -----\n        Even though the created transform is a single step in the graph, it\n        will still internally call the constituent transforms.  Thus, there is\n        no performance benefit for using this created transform.\n\n        For Astropy's built-in frames, loopback transformations typically use\n        `~astropy.coordinates.ICRS` to be safe.  Tranforming through an inertial\n        frame ensures that changes in observation time and observer\n        location/velocity are properly accounted for.\n\n        An error will be raised if a direct transform between ``fromsys`` and\n        ``tosys`` already exist.\n        \"\"\"\n        frames = [fromsys, tosys, *furthersys]\n        lastsys = frames[-1]\n        full_path = self.get_transform(fromsys, lastsys)\n        transforms = [self.get_transform(frame_a, frame_b)\n                      for frame_a, frame_b in zip(frames[:-1], frames[1:])]\n        if None in transforms:\n            raise ValueError(f\"This transformation path is not possible\")\n        if len(full_path.transforms) == 1:\n            raise ValueError(f\"A direct transform for {fromsys.__name__}->{lastsys.__name__} already exists\")\n\n        self.add_transform(fromsys, lastsys,\n                           CompositeTransform(transforms, fromsys, lastsys,\n                                              priority=priority)._as_single_transform())\n\n    @contextmanager\n    def impose_finite_difference_dt(self, dt):\n        \"\"\"\n        Context manager to impose a finite-difference time step on all applicable transformations\n\n        For each transformation in this transformation graph that has the attribute\n        ``finite_difference_dt``, that attribute is set to the provided value.  The only standard\n        transformation with this attribute is\n        `~astropy.coordinates.transformations.FunctionTransformWithFiniteDifference`.\n\n        Parameters\n        ----------\n        dt : `~astropy.units.Quantity` ['time'] or callable\n            If a quantity, this is the size of the differential used to do the finite difference.\n            If a callable, should accept ``(fromcoord, toframe)`` and return the ``dt`` value.\n        \"\"\"\n        key = 'finite_difference_dt'\n        saved_settings = []\n\n        try:\n            for to_frames in self._graph.values():\n                for transform in to_frames.values():\n                    if hasattr(transform, key):\n                        old_setting = (transform, key, getattr(transform, key))\n                        saved_settings.append(old_setting)\n                        setattr(transform, key, dt)\n            yield\n        finally:\n            for setting in saved_settings:\n                setattr(*setting)\n\n\n# <-------------------Define the builtin transform classes-------------------->\n\nclass CoordinateTransform(metaclass=ABCMeta):\n    \"\"\"\n    An object that transforms a coordinate from one system to another.\n    Subclasses must implement `__call__` with the provided signature.\n    They should also call this superclass's ``__init__`` in their\n    ``__init__``.\n\n    Parameters\n    ----------\n    fromsys : `~astropy.coordinates.BaseCoordinateFrame` subclass\n        The coordinate frame class to start from.\n    tosys : `~astropy.coordinates.BaseCoordinateFrame` subclass\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n    \"\"\"\n\n    def __init__(self, fromsys, tosys, priority=1, register_graph=None):\n        if not inspect.isclass(fromsys):\n            raise TypeError('fromsys must be a class')\n        if not inspect.isclass(tosys):\n            raise TypeError('tosys must be a class')\n\n        self.fromsys = fromsys\n        self.tosys = tosys\n        self.priority = float(priority)\n\n        if register_graph:\n            # this will do the type-checking when it adds to the graph\n            self.register(register_graph)\n        else:\n            if not inspect.isclass(fromsys) or not inspect.isclass(tosys):\n                raise TypeError('fromsys and tosys must be classes')\n\n        self.overlapping_frame_attr_names = overlap = []\n        if (hasattr(fromsys, 'get_frame_attr_names') and\n                hasattr(tosys, 'get_frame_attr_names')):\n            # the if statement is there so that non-frame things might be usable\n            # if it makes sense\n            for from_nm in fromsys.frame_attributes.keys():\n                if from_nm in tosys.frame_attributes.keys():\n                    overlap.append(from_nm)\n\n    def register(self, graph):\n        \"\"\"\n        Add this transformation to the requested Transformation graph,\n        replacing anything already connecting these two coordinates.\n\n        Parameters\n        ----------\n        graph : `TransformGraph` object\n            The graph to register this transformation with.\n        \"\"\"\n        graph.add_transform(self.fromsys, self.tosys, self)\n\n    def unregister(self, graph):\n        \"\"\"\n        Remove this transformation from the requested transformation\n        graph.\n\n        Parameters\n        ----------\n        graph : a TransformGraph object\n            The graph to unregister this transformation from.\n\n        Raises\n        ------\n        ValueError\n            If this is not currently in the transform graph.\n        \"\"\"\n        graph.remove_transform(self.fromsys, self.tosys, self)\n\n    @abstractmethod\n    def __call__(self, fromcoord, toframe):\n        \"\"\"\n        Does the actual coordinate transformation from the ``fromsys`` class to\n        the ``tosys`` class.\n\n        Parameters\n        ----------\n        fromcoord : `~astropy.coordinates.BaseCoordinateFrame` subclass instance\n            An object of class matching ``fromsys`` that is to be transformed.\n        toframe : object\n            An object that has the attributes necessary to fully specify the\n            frame.  That is, it must have attributes with names that match the\n            keys of the dictionary that ``tosys.get_frame_attr_names()``\n            returns. Typically this is of class ``tosys``, but it *might* be\n            some other class as long as it has the appropriate attributes.\n\n        Returns\n        -------\n        tocoord : `BaseCoordinateFrame` subclass instance\n            The new coordinate after the transform has been applied.\n        \"\"\"\n\n\nclass FunctionTransform(CoordinateTransform):\n    \"\"\"\n    A coordinate transformation defined by a function that accepts a\n    coordinate object and returns the transformed coordinate object.\n\n    Parameters\n    ----------\n    func : callable\n        The transformation function. Should have a call signature\n        ``func(formcoord, toframe)``. Note that, unlike\n        `CoordinateTransform.__call__`, ``toframe`` is assumed to be of type\n        ``tosys`` for this function.\n    fromsys : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n\n    Raises\n    ------\n    TypeError\n        If ``func`` is not callable.\n    ValueError\n        If ``func`` cannot accept two arguments.\n\n\n    \"\"\"\n\n    def __init__(self, func, fromsys, tosys, priority=1, register_graph=None):\n        if not callable(func):\n            raise TypeError('func must be callable')\n\n        with suppress(TypeError):\n            sig = signature(func)\n            kinds = [x.kind for x in sig.parameters.values()]\n            if (len(x for x in kinds if x == sig.POSITIONAL_ONLY) != 2 and\n                    sig.VAR_POSITIONAL not in kinds):\n                raise ValueError('provided function does not accept two arguments')\n\n        self.func = func\n\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)\n\n    def __call__(self, fromcoord, toframe):\n        res = self.func(fromcoord, toframe)\n        if not isinstance(res, self.tosys):\n            raise TypeError(f'the transformation function yielded {res} but '\n                            f'should have been of type {self.tosys}')\n        if fromcoord.data.differentials and not res.data.differentials:\n            warn(\"Applied a FunctionTransform to a coordinate frame with \"\n                 \"differentials, but the FunctionTransform does not handle \"\n                 \"differentials, so they have been dropped.\", AstropyWarning)\n        return res\n\n\nclass FunctionTransformWithFiniteDifference(FunctionTransform):\n    r\"\"\"\n    A coordinate transformation that works like a `FunctionTransform`, but\n    computes velocity shifts based on the finite-difference relative to one of\n    the frame attributes.  Note that the transform function should *not* change\n    the differential at all in this case, as any differentials will be\n    overridden.\n\n    When a differential is in the from coordinate, the finite difference\n    calculation has two components. The first part is simple the existing\n    differential, but re-orientation (using finite-difference techniques) to\n    point in the direction the velocity vector has in the *new* frame. The\n    second component is the \"induced\" velocity.  That is, the velocity\n    intrinsic to the frame itself, estimated by shifting the frame using the\n    ``finite_difference_frameattr_name`` frame attribute a small amount\n    (``finite_difference_dt``) in time and re-calculating the position.\n\n    Parameters\n    ----------\n    finite_difference_frameattr_name : str or None\n        The name of the frame attribute on the frames to use for the finite\n        difference.  Both the to and the from frame will be checked for this\n        attribute, but only one needs to have it. If None, no velocity\n        component induced from the frame itself will be included - only the\n        re-orientation of any existing differential.\n    finite_difference_dt : `~astropy.units.Quantity` ['time'] or callable\n        If a quantity, this is the size of the differential used to do the\n        finite difference.  If a callable, should accept\n        ``(fromcoord, toframe)`` and return the ``dt`` value.\n    symmetric_finite_difference : bool\n        If True, the finite difference is computed as\n        :math:`\\frac{x(t + \\Delta t / 2) - x(t + \\Delta t / 2)}{\\Delta t}`, or\n        if False, :math:`\\frac{x(t + \\Delta t) - x(t)}{\\Delta t}`.  The latter\n        case has slightly better performance (and more stable finite difference\n        behavior).\n\n    All other parameters are identical to the initializer for\n    `FunctionTransform`.\n\n    \"\"\"\n\n    def __init__(self, func, fromsys, tosys, priority=1, register_graph=None,\n                 finite_difference_frameattr_name='obstime',\n                 finite_difference_dt=1*u.second,\n                 symmetric_finite_difference=True):\n        super().__init__(func, fromsys, tosys, priority, register_graph)\n        self.finite_difference_frameattr_name = finite_difference_frameattr_name\n        self.finite_difference_dt = finite_difference_dt\n        self.symmetric_finite_difference = symmetric_finite_difference\n\n    @property\n    def finite_difference_frameattr_name(self):\n        return self._finite_difference_frameattr_name\n\n    @finite_difference_frameattr_name.setter\n    def finite_difference_frameattr_name(self, value):\n        if value is None:\n            self._diff_attr_in_fromsys = self._diff_attr_in_tosys = False\n        else:\n            diff_attr_in_fromsys = value in self.fromsys.frame_attributes\n            diff_attr_in_tosys = value in self.tosys.frame_attributes\n            if diff_attr_in_fromsys or diff_attr_in_tosys:\n                self._diff_attr_in_fromsys = diff_attr_in_fromsys\n                self._diff_attr_in_tosys = diff_attr_in_tosys\n            else:\n                raise ValueError('Frame attribute name {} is not a frame '\n                                 'attribute of {} or {}'.format(value,\n                                                                self.fromsys,\n                                                                self.tosys))\n        self._finite_difference_frameattr_name = value\n\n    def __call__(self, fromcoord, toframe):\n        from .representation import (CartesianRepresentation,\n                                     CartesianDifferential)\n\n        supcall = self.func\n        if fromcoord.data.differentials:\n            # this is the finite difference case\n\n            if callable(self.finite_difference_dt):\n                dt = self.finite_difference_dt(fromcoord, toframe)\n            else:\n                dt = self.finite_difference_dt\n            halfdt = dt/2\n\n            from_diffless = fromcoord.realize_frame(fromcoord.data.without_differentials())\n            reprwithoutdiff = supcall(from_diffless, toframe)\n\n            # first we use the existing differential to compute an offset due to\n            # the already-existing velocity, but in the new frame\n            fromcoord_cart = fromcoord.cartesian\n            if self.symmetric_finite_difference:\n                fwdxyz = (fromcoord_cart.xyz +\n                          fromcoord_cart.differentials['s'].d_xyz*halfdt)\n                fwd = supcall(fromcoord.realize_frame(CartesianRepresentation(fwdxyz)), toframe)\n                backxyz = (fromcoord_cart.xyz -\n                           fromcoord_cart.differentials['s'].d_xyz*halfdt)\n                back = supcall(fromcoord.realize_frame(CartesianRepresentation(backxyz)), toframe)\n            else:\n                fwdxyz = (fromcoord_cart.xyz +\n                          fromcoord_cart.differentials['s'].d_xyz*dt)\n                fwd = supcall(fromcoord.realize_frame(CartesianRepresentation(fwdxyz)), toframe)\n                back = reprwithoutdiff\n            diffxyz = (fwd.cartesian - back.cartesian).xyz / dt\n\n            # now we compute the \"induced\" velocities due to any movement in\n            # the frame itself over time\n            attrname = self.finite_difference_frameattr_name\n            if attrname is not None:\n                if self.symmetric_finite_difference:\n                    if self._diff_attr_in_fromsys:\n                        kws = {attrname: getattr(from_diffless, attrname) + halfdt}\n                        from_diffless_fwd = from_diffless.replicate(**kws)\n                    else:\n                        from_diffless_fwd = from_diffless\n                    if self._diff_attr_in_tosys:\n                        kws = {attrname: getattr(toframe, attrname) + halfdt}\n                        fwd_frame = toframe.replicate_without_data(**kws)\n                    else:\n                        fwd_frame = toframe\n                    fwd = supcall(from_diffless_fwd, fwd_frame)\n\n                    if self._diff_attr_in_fromsys:\n                        kws = {attrname: getattr(from_diffless, attrname) - halfdt}\n                        from_diffless_back = from_diffless.replicate(**kws)\n                    else:\n                        from_diffless_back = from_diffless\n                    if self._diff_attr_in_tosys:\n                        kws = {attrname: getattr(toframe, attrname) - halfdt}\n                        back_frame = toframe.replicate_without_data(**kws)\n                    else:\n                        back_frame = toframe\n                    back = supcall(from_diffless_back, back_frame)\n                else:\n                    if self._diff_attr_in_fromsys:\n                        kws = {attrname: getattr(from_diffless, attrname) + dt}\n                        from_diffless_fwd = from_diffless.replicate(**kws)\n                    else:\n                        from_diffless_fwd = from_diffless\n                    if self._diff_attr_in_tosys:\n                        kws = {attrname: getattr(toframe, attrname) + dt}\n                        fwd_frame = toframe.replicate_without_data(**kws)\n                    else:\n                        fwd_frame = toframe\n                    fwd = supcall(from_diffless_fwd, fwd_frame)\n                    back = reprwithoutdiff\n\n                diffxyz += (fwd.cartesian - back.cartesian).xyz / dt\n\n            newdiff = CartesianDifferential(diffxyz)\n            reprwithdiff = reprwithoutdiff.data.to_cartesian().with_differentials(newdiff)\n            return reprwithoutdiff.realize_frame(reprwithdiff)\n        else:\n            return supcall(fromcoord, toframe)\n\n\nclass BaseAffineTransform(CoordinateTransform):\n    \"\"\"Base class for common functionality between the ``AffineTransform``-type\n    subclasses.\n\n    This base class is needed because ``AffineTransform`` and the matrix\n    transform classes share the ``__call__()`` method, but differ in how they\n    generate the affine parameters.  ``StaticMatrixTransform`` passes in a\n    matrix stored as a class attribute, and both of the matrix transforms pass\n    in ``None`` for the offset. Hence, user subclasses would likely want to\n    subclass this (rather than ``AffineTransform``) if they want to provide\n    alternative transformations using this machinery.\n    \"\"\"\n\n    def _apply_transform(self, fromcoord, matrix, offset):\n        from .representation import (UnitSphericalRepresentation,\n                                     CartesianDifferential,\n                                     SphericalDifferential,\n                                     SphericalCosLatDifferential,\n                                     RadialDifferential)\n\n        data = fromcoord.data\n        has_velocity = 's' in data.differentials\n\n        # Bail out if no transform is actually requested\n        if matrix is None and offset is None:\n            return data\n\n        # list of unit differentials\n        _unit_diffs = (SphericalDifferential._unit_differential,\n                       SphericalCosLatDifferential._unit_differential)\n        unit_vel_diff = (has_velocity and\n                         isinstance(data.differentials['s'], _unit_diffs))\n        rad_vel_diff = (has_velocity and\n                        isinstance(data.differentials['s'], RadialDifferential))\n\n        # Some initial checking to short-circuit doing any re-representation if\n        # we're going to fail anyways:\n        if isinstance(data, UnitSphericalRepresentation) and offset is not None:\n            raise TypeError(\"Position information stored on coordinate frame \"\n                            \"is insufficient to do a full-space position \"\n                            \"transformation (representation class: {})\"\n                            .format(data.__class__))\n\n        elif (has_velocity and (unit_vel_diff or rad_vel_diff) and\n              offset is not None and 's' in offset.differentials):\n            # Coordinate has a velocity, but it is not a full-space velocity\n            # that we need to do a velocity offset\n            raise TypeError(\"Velocity information stored on coordinate frame \"\n                            \"is insufficient to do a full-space velocity \"\n                            \"transformation (differential class: {})\"\n                            .format(data.differentials['s'].__class__))\n\n        elif len(data.differentials) > 1:\n            # We should never get here because the frame initializer shouldn't\n            # allow more differentials, but this just adds protection for\n            # subclasses that somehow skip the checks\n            raise ValueError(\"Representation passed to AffineTransform contains\"\n                             \" multiple associated differentials. Only a single\"\n                             \" differential with velocity units is presently\"\n                             \" supported (differentials: {}).\"\n                             .format(str(data.differentials)))\n\n        # If the representation is a UnitSphericalRepresentation, and this is\n        # just a MatrixTransform, we have to try to turn the differential into a\n        # Unit version of the differential (if no radial velocity) or a\n        # sphericaldifferential with zero proper motion (if only a radial\n        # velocity) so that the matrix operation works\n        if (has_velocity and isinstance(data, UnitSphericalRepresentation) and\n                not unit_vel_diff and not rad_vel_diff):\n            # retrieve just velocity differential\n            unit_diff = data.differentials['s'].represent_as(\n                data.differentials['s']._unit_differential, data)\n            data = data.with_differentials({'s': unit_diff})  # updates key\n\n        # If it's a RadialDifferential, we flat-out ignore the differentials\n        # This is because, by this point (past the validation above), we can\n        # only possibly be doing a rotation-only transformation, and that\n        # won't change the radial differential. We later add it back in\n        elif rad_vel_diff:\n            data = data.without_differentials()\n\n        # Convert the representation and differentials to cartesian without\n        # having them attached to a frame\n        rep = data.to_cartesian()\n        diffs = dict([(k, diff.represent_as(CartesianDifferential, data))\n                      for k, diff in data.differentials.items()])\n        rep = rep.with_differentials(diffs)\n\n        # Only do transform if matrix is specified. This is for speed in\n        # transformations that only specify an offset (e.g., LSR)\n        if matrix is not None:\n            # Note: this applies to both representation and differentials\n            rep = rep.transform(matrix)\n\n        # TODO: if we decide to allow arithmetic between representations that\n        # contain differentials, this can be tidied up\n        if offset is not None:\n            newrep = (rep.without_differentials() +\n                      offset.without_differentials())\n        else:\n            newrep = rep.without_differentials()\n\n        # We need a velocity (time derivative) and, for now, are strict: the\n        # representation can only contain a velocity differential and no others.\n        if has_velocity and not rad_vel_diff:\n            veldiff = rep.differentials['s']  # already in Cartesian form\n\n            if offset is not None and 's' in offset.differentials:\n                veldiff = veldiff + offset.differentials['s']\n\n            newrep = newrep.with_differentials({'s': veldiff})\n\n        if isinstance(fromcoord.data, UnitSphericalRepresentation):\n            # Special-case this because otherwise the return object will think\n            # it has a valid distance with the default return (a\n            # CartesianRepresentation instance)\n\n            if has_velocity and not unit_vel_diff and not rad_vel_diff:\n                # We have to first represent as the Unit types we converted to,\n                # then put the d_distance information back in to the\n                # differentials and re-represent as their original forms\n                newdiff = newrep.differentials['s']\n                _unit_cls = fromcoord.data.differentials['s']._unit_differential\n                newdiff = newdiff.represent_as(_unit_cls, newrep)\n\n                kwargs = dict([(comp, getattr(newdiff, comp))\n                               for comp in newdiff.components])\n                kwargs['d_distance'] = fromcoord.data.differentials['s'].d_distance\n                diffs = {'s': fromcoord.data.differentials['s'].__class__(\n                    copy=False, **kwargs)}\n\n            elif has_velocity and unit_vel_diff:\n                newdiff = newrep.differentials['s'].represent_as(\n                    fromcoord.data.differentials['s'].__class__, newrep)\n                diffs = {'s': newdiff}\n\n            else:\n                diffs = newrep.differentials\n\n            newrep = newrep.represent_as(fromcoord.data.__class__)  # drops diffs\n            newrep = newrep.with_differentials(diffs)\n\n        elif has_velocity and unit_vel_diff:\n            # Here, we're in the case where the representation is not\n            # UnitSpherical, but the differential *is* one of the UnitSpherical\n            # types. We have to convert back to that differential class or the\n            # resulting frame will think it has a valid radial_velocity. This\n            # can probably be cleaned up: we currently have to go through the\n            # dimensional version of the differential before representing as the\n            # unit differential so that the units work out (the distance length\n            # unit shouldn't appear in the resulting proper motions)\n\n            diff_cls = fromcoord.data.differentials['s'].__class__\n            newrep = newrep.represent_as(fromcoord.data.__class__,\n                                         diff_cls._dimensional_differential)\n            newrep = newrep.represent_as(fromcoord.data.__class__, diff_cls)\n\n        # We pulled the radial differential off of the representation\n        # earlier, so now we need to put it back. But, in order to do that, we\n        # have to turn the representation into a repr that is compatible with\n        # having a RadialDifferential\n        if has_velocity and rad_vel_diff:\n            newrep = newrep.represent_as(fromcoord.data.__class__)\n            newrep = newrep.with_differentials(\n                {'s': fromcoord.data.differentials['s']})\n\n        return newrep\n\n    def __call__(self, fromcoord, toframe):\n        params = self._affine_params(fromcoord, toframe)\n        newrep = self._apply_transform(fromcoord, *params)\n        return toframe.realize_frame(newrep)\n\n    @abstractmethod\n    def _affine_params(self, fromcoord, toframe):\n        pass\n\n\nclass AffineTransform(BaseAffineTransform):\n    \"\"\"\n    A coordinate transformation specified as a function that yields a 3 x 3\n    cartesian transformation matrix and a tuple of displacement vectors.\n\n    See `~astropy.coordinates.builtin_frames.galactocentric.Galactocentric` for\n    an example.\n\n    Parameters\n    ----------\n    transform_func : callable\n        A callable that has the signature ``transform_func(fromcoord, toframe)``\n        and returns: a (3, 3) matrix that operates on ``fromcoord`` in a\n        Cartesian representation, and a ``CartesianRepresentation`` with\n        (optionally) an attached velocity ``CartesianDifferential`` to represent\n        a translation and offset in velocity to apply after the matrix\n        operation.\n    fromsys : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n\n    Raises\n    ------\n    TypeError\n        If ``transform_func`` is not callable\n\n    \"\"\"\n\n    def __init__(self, transform_func, fromsys, tosys, priority=1,\n                 register_graph=None):\n\n        if not callable(transform_func):\n            raise TypeError('transform_func is not callable')\n        self.transform_func = transform_func\n\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)\n\n    def _affine_params(self, fromcoord, toframe):\n        return self.transform_func(fromcoord, toframe)\n\n\nclass StaticMatrixTransform(BaseAffineTransform):\n    \"\"\"\n    A coordinate transformation defined as a 3 x 3 cartesian\n    transformation matrix.\n\n    This is distinct from DynamicMatrixTransform in that this kind of matrix is\n    independent of frame attributes.  That is, it depends *only* on the class of\n    the frame.\n\n    Parameters\n    ----------\n    matrix : array-like or callable\n        A 3 x 3 matrix for transforming 3-vectors. In most cases will\n        be unitary (although this is not strictly required). If a callable,\n        will be called *with no arguments* to get the matrix.\n    fromsys : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n\n    Raises\n    ------\n    ValueError\n        If the matrix is not 3 x 3\n\n    \"\"\"\n\n    def __init__(self, matrix, fromsys, tosys, priority=1, register_graph=None):\n        if callable(matrix):\n            matrix = matrix()\n        self.matrix = np.array(matrix)\n\n        if self.matrix.shape != (3, 3):\n            raise ValueError('Provided matrix is not 3 x 3')\n\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)\n\n    def _affine_params(self, fromcoord, toframe):\n        return self.matrix, None\n\n\nclass DynamicMatrixTransform(BaseAffineTransform):\n    \"\"\"\n    A coordinate transformation specified as a function that yields a\n    3 x 3 cartesian transformation matrix.\n\n    This is similar to, but distinct from StaticMatrixTransform, in that the\n    matrix for this class might depend on frame attributes.\n\n    Parameters\n    ----------\n    matrix_func : callable\n        A callable that has the signature ``matrix_func(fromcoord, toframe)`` and\n        returns a 3 x 3 matrix that converts ``fromcoord`` in a cartesian\n        representation to the new coordinate system.\n    fromsys : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n\n    Raises\n    ------\n    TypeError\n        If ``matrix_func`` is not callable\n\n    \"\"\"\n\n    def __init__(self, matrix_func, fromsys, tosys, priority=1,\n                 register_graph=None):\n        if not callable(matrix_func):\n            raise TypeError('matrix_func is not callable')\n        self.matrix_func = matrix_func\n\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)\n\n    def _affine_params(self, fromcoord, toframe):\n        return self.matrix_func(fromcoord, toframe), None\n\n\nclass CompositeTransform(CoordinateTransform):\n    \"\"\"\n    A transformation constructed by combining together a series of single-step\n    transformations.\n\n    Note that the intermediate frame objects are constructed using any frame\n    attributes in ``toframe`` or ``fromframe`` that overlap with the intermediate\n    frame (``toframe`` favored over ``fromframe`` if there's a conflict).  Any frame\n    attributes that are not present use the defaults.\n\n    Parameters\n    ----------\n    transforms : sequence of `CoordinateTransform` object\n        The sequence of transformations to apply.\n    fromsys : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n    collapse_static_mats : bool\n        If `True`, consecutive `StaticMatrixTransform` will be collapsed into a\n        single transformation to speed up the calculation.\n\n    \"\"\"\n\n    def __init__(self, transforms, fromsys, tosys, priority=1,\n                 register_graph=None, collapse_static_mats=True):\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)\n\n        if collapse_static_mats:\n            transforms = self._combine_statics(transforms)\n\n        self.transforms = tuple(transforms)\n\n    def _combine_statics(self, transforms):\n        \"\"\"\n        Combines together sequences of `StaticMatrixTransform`s into a single\n        transform and returns it.\n        \"\"\"\n        newtrans = []\n        for currtrans in transforms:\n            lasttrans = newtrans[-1] if len(newtrans) > 0 else None\n\n            if (isinstance(lasttrans, StaticMatrixTransform) and\n                    isinstance(currtrans, StaticMatrixTransform)):\n                combinedmat = matrix_product(currtrans.matrix, lasttrans.matrix)\n                newtrans[-1] = StaticMatrixTransform(combinedmat,\n                                                     lasttrans.fromsys,\n                                                     currtrans.tosys)\n            else:\n                newtrans.append(currtrans)\n        return newtrans\n\n    def __call__(self, fromcoord, toframe):\n        curr_coord = fromcoord\n        for t in self.transforms:\n            # build an intermediate frame with attributes taken from either\n            # `toframe`, or if not there, `fromcoord`, or if not there, use\n            # the defaults\n            # TODO: caching this information when creating the transform may\n            # speed things up a lot\n            frattrs = {}\n            for inter_frame_attr_nm in t.tosys.get_frame_attr_names():\n                if hasattr(toframe, inter_frame_attr_nm):\n                    attr = getattr(toframe, inter_frame_attr_nm)\n                    frattrs[inter_frame_attr_nm] = attr\n                elif hasattr(fromcoord, inter_frame_attr_nm):\n                    attr = getattr(fromcoord, inter_frame_attr_nm)\n                    frattrs[inter_frame_attr_nm] = attr\n\n            curr_toframe = t.tosys(**frattrs)\n            curr_coord = t(curr_coord, curr_toframe)\n\n        # this is safe even in the case where self.transforms is empty, because\n        # coordinate objects are immutable, so copying is not needed\n        return curr_coord\n\n    def _as_single_transform(self):\n        \"\"\"\n        Return an encapsulated version of the composite transform so that it appears to\n        be a single transform.\n\n        The returned transform internally calls the constituent transforms.  If all of\n        the transforms are affine, the merged transform is\n        `~astropy.coordinates.transformations.DynamicMatrixTransform` (if there are no\n        origin shifts) or `~astropy.coordinates.transformations.AffineTransform`\n        (otherwise).  If at least one of the transforms is not affine, the merged\n        transform is\n        `~astropy.coordinates.transformations.FunctionTransformWithFiniteDifference`.\n        \"\"\"\n        # Create a list of the transforms including flattening any constituent CompositeTransform\n        transforms = [t if not isinstance(t, CompositeTransform) else t._as_single_transform()\n                      for t in self.transforms]\n\n        if all([isinstance(t, BaseAffineTransform) for t in transforms]):\n            # Check if there may be an origin shift\n            fixed_origin = all([isinstance(t, (StaticMatrixTransform, DynamicMatrixTransform))\n                                for t in transforms])\n\n            # Dynamically define the transformation function\n            def single_transform(from_coo, to_frame):\n                if from_coo.is_equivalent_frame(to_frame):  # loopback to the same frame\n                    return None if fixed_origin else (None, None)\n\n                # Create a merged attribute dictionary for any intermediate frames\n                # For any attributes shared by the \"from\"/\"to\" frames, the \"to\" frame takes\n                #   precedence because this is the same choice implemented in __call__()\n                merged_attr = {name: getattr(from_coo, name)\n                               for name in from_coo.frame_attributes}\n                merged_attr.update({name: getattr(to_frame, name)\n                                    for name in to_frame.frame_attributes})\n\n                affine_params = (None, None)\n                # Step through each transform step (frame A -> frame B)\n                for i, t in enumerate(transforms):\n                    # Extract the relevant attributes for frame A\n                    if i == 0:\n                        # If frame A is actually the initial frame, preserve its attributes\n                        a_attr = {name: getattr(from_coo, name)\n                                  for name in from_coo.frame_attributes}\n                    else:\n                        a_attr = {k: v for k, v in merged_attr.items()\n                                  if k in t.fromsys.frame_attributes}\n\n                    # Extract the relevant attributes for frame B\n                    b_attr = {k: v for k, v in merged_attr.items()\n                              if k in t.tosys.frame_attributes}\n\n                    # Obtain the affine parameters for the transform\n                    # Note that we insert some dummy data into frame A because the transformation\n                    #   machinery requires there to be data present.  Removing that limitation\n                    #   is a possible TODO, but some care would need to be taken because some affine\n                    #   transforms have branching code depending on the presence of differentials.\n                    next_affine_params = t._affine_params(t.fromsys(from_coo.data, **a_attr),\n                                                          t.tosys(**b_attr))\n\n                    # Combine the affine parameters with the running set\n                    affine_params = _combine_affine_params(affine_params, next_affine_params)\n\n                # If there is no origin shift, return only the matrix\n                return affine_params[0] if fixed_origin else affine_params\n\n            # The return type depends on whether there is any origin shift\n            transform_type = DynamicMatrixTransform if fixed_origin else AffineTransform\n        else:\n            # Dynamically define the transformation function\n            def single_transform(from_coo, to_frame):\n                if from_coo.is_equivalent_frame(to_frame):  # loopback to the same frame\n                    return to_frame.realize_frame(from_coo.data)\n                return self(from_coo, to_frame)\n\n            transform_type = FunctionTransformWithFiniteDifference\n\n        return transform_type(single_transform, self.fromsys, self.tosys, priority=self.priority)\n\n\ndef _combine_affine_params(params, next_params):\n    \"\"\"\n    Combine two sets of affine parameters.\n\n    The parameters for an affine transformation are a 3 x 3 Cartesian\n    transformation matrix and a displacement vector, which can include an\n    attached velocity.  Either type of parameter can be ``None``.\n    \"\"\"\n    M, vec = params\n    next_M, next_vec = next_params\n\n    # Multiply the transformation matrices if they both exist\n    if M is not None and next_M is not None:\n        new_M = next_M @ M\n    else:\n        new_M = M if M is not None else next_M\n\n    if vec is not None:\n        # Transform the first displacement vector by the second transformation matrix\n        if next_M is not None:\n            vec = vec.transform(next_M)\n\n        # Calculate the new displacement vector\n        if next_vec is not None:\n            if 's' in vec.differentials and 's' in next_vec.differentials:\n                # Adding vectors with velocities takes more steps\n                # TODO: Add support in representation.py\n                new_vec_velocity = vec.differentials['s'] + next_vec.differentials['s']\n                new_vec = vec.without_differentials() + next_vec.without_differentials()\n                new_vec = new_vec.with_differentials({'s': new_vec_velocity})\n            else:\n                new_vec = vec + next_vec\n        else:\n            new_vec = vec\n    else:\n        new_vec = next_vec\n\n    return new_M, new_vec\n\n\n# map class names to colorblind-safe colors\ntrans_to_color = {}\ntrans_to_color[AffineTransform] = '#555555'  # gray\ntrans_to_color[FunctionTransform] = '#783001'  # dark red-ish/brown\ntrans_to_color[FunctionTransformWithFiniteDifference] = '#d95f02'  # red-ish\ntrans_to_color[StaticMatrixTransform] = '#7570b3'  # blue-ish\ntrans_to_color[DynamicMatrixTransform] = '#1b9e77'  # green-ish\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":430,"id":14864,"name":"_default_size","nodeType":"Attribute","startLoc":430,"text":"self._default_size"},{"attributeType":"Ring2D","col":8,"comment":"null","endLoc":428,"id":14865,"name":"_model","nodeType":"Attribute","startLoc":428,"text":"self._model"},{"col":4,"comment":"The parallax angle as an `~astropy.coordinates.Angle` object","endLoc":243,"header":"@property\n    def parallax(self)","id":14866,"name":"parallax","nodeType":"Function","startLoc":240,"text":"@property\n    def parallax(self):\n        \"\"\"The parallax angle as an `~astropy.coordinates.Angle` object\"\"\"\n        return Angle(self.to(u.milliarcsecond, u.parallax()))"},{"attributeType":"null","col":8,"comment":"null","endLoc":432,"id":14867,"name":"_truncation","nodeType":"Attribute","startLoc":432,"text":"self._truncation"},{"className":"Trapezoid1DKernel","col":0,"comment":"\n    1D trapezoid kernel.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    width : number\n        Width of the filter kernel, defined as the width of the constant part,\n        before it begins to slope down.\n    slope : number\n        Slope of the filter kernel's tails\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Box1DKernel, Gaussian1DKernel, RickerWavelet1DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Trapezoid1DKernel\n        trapezoid_1D_kernel = Trapezoid1DKernel(17, slope=0.2)\n        plt.plot(trapezoid_1D_kernel, drawstyle='steps')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('amplitude')\n        plt.xlim(-1, 28)\n        plt.show()\n    ","endLoc":492,"id":14868,"nodeType":"Class","startLoc":435,"text":"class Trapezoid1DKernel(Kernel1D):\n    \"\"\"\n    1D trapezoid kernel.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    width : number\n        Width of the filter kernel, defined as the width of the constant part,\n        before it begins to slope down.\n    slope : number\n        Slope of the filter kernel's tails\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Box1DKernel, Gaussian1DKernel, RickerWavelet1DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Trapezoid1DKernel\n        trapezoid_1D_kernel = Trapezoid1DKernel(17, slope=0.2)\n        plt.plot(trapezoid_1D_kernel, drawstyle='steps')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('amplitude')\n        plt.xlim(-1, 28)\n        plt.show()\n    \"\"\"\n    _is_bool = False\n\n    def __init__(self, width, slope=1., **kwargs):\n        self._model = models.Trapezoid1D(1, 0, width, slope)\n        self._default_size = _round_up_to_odd_integer(width + 2. / slope)\n        super().__init__(**kwargs)\n        self._truncation = 0\n        self.normalize()"},{"col":4,"comment":"null","endLoc":492,"header":"def __init__(self, width, slope=1., **kwargs)","id":14869,"name":"__init__","nodeType":"Function","startLoc":487,"text":"def __init__(self, width, slope=1., **kwargs):\n        self._model = models.Trapezoid1D(1, 0, width, slope)\n        self._default_size = _round_up_to_odd_integer(width + 2. / slope)\n        super().__init__(**kwargs)\n        self._truncation = 0\n        self.normalize()"},{"col":4,"comment":"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        ","endLoc":2425,"header":"def efunc(self, z)","id":14870,"name":"efunc","nodeType":"Function","startLoc":2405,"text":"def efunc(self, z):\n        \"\"\"Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return np.sqrt(zp1 ** 3 * (Or * zp1 + self._Om0) +\n                       self._Ode0 * zp1 ** (3. * (1 + self._w0)))"},{"fileName":"sky_coordinate.py","filePath":"astropy/coordinates","id":14871,"nodeType":"File","text":"import re\nimport copy\nimport warnings\nimport operator\n\nimport numpy as np\nimport erfa\n\nfrom astropy.utils.compat.misc import override__dir__\nfrom astropy import units as u\nfrom astropy.constants import c as speed_of_light\nfrom astropy.utils.data_info import MixinInfo\nfrom astropy.utils import ShapedLikeNDArray\nfrom astropy.table import QTable\nfrom astropy.time import Time\nfrom astropy.utils.exceptions import AstropyUserWarning\n\nfrom .distances import Distance\nfrom .angles import Angle\nfrom .baseframe import (BaseCoordinateFrame, frame_transform_graph,\n                        GenericFrame)\nfrom .builtin_frames import ICRS, SkyOffsetFrame\nfrom .representation import (RadialDifferential, SphericalDifferential,\n                             SphericalRepresentation,\n                             UnitSphericalCosLatDifferential,\n                             UnitSphericalDifferential,\n                             UnitSphericalRepresentation)\nfrom .sky_coordinate_parsers import (_get_frame_class, _get_frame_without_data,\n                                     _parse_coordinate_data)\n\n__all__ = ['SkyCoord', 'SkyCoordInfo']\n\n\nclass SkyCoordInfo(MixinInfo):\n    \"\"\"\n    Container for meta information like name, description, format.  This is\n    required when the object is used as a mixin column within a table, but can\n    be used as a general way to store meta information.\n    \"\"\"\n    attrs_from_parent = set(['unit'])  # Unit is read-only\n    _supports_indexing = False\n\n    @staticmethod\n    def default_format(val):\n        repr_data = val.info._repr_data\n        formats = ['{0.' + compname + '.value:}' for compname\n                   in repr_data.components]\n        return ','.join(formats).format(repr_data)\n\n    @property\n    def unit(self):\n        repr_data = self._repr_data\n        unit = ','.join(str(getattr(repr_data, comp).unit) or 'None'\n                        for comp in repr_data.components)\n        return unit\n\n    @property\n    def _repr_data(self):\n        if self._parent is None:\n            return None\n\n        sc = self._parent\n        if (issubclass(sc.representation_type, SphericalRepresentation)\n                and isinstance(sc.data, UnitSphericalRepresentation)):\n            repr_data = sc.represent_as(sc.data.__class__, in_frame_units=True)\n        else:\n            repr_data = sc.represent_as(sc.representation_type,\n                                        in_frame_units=True)\n        return repr_data\n\n    def _represent_as_dict(self):\n        sc = self._parent\n        attrs = list(sc.representation_component_names)\n\n        # Don't output distance unless it's actually distance.\n        if isinstance(sc.data, UnitSphericalRepresentation):\n            attrs = attrs[:-1]\n\n        diff = sc.data.differentials.get('s')\n        if diff is not None:\n            diff_attrs = list(sc.get_representation_component_names('s'))\n            # Don't output proper motions if they haven't been specified.\n            if isinstance(diff, RadialDifferential):\n                diff_attrs = diff_attrs[2:]\n            # Don't output radial velocity unless it's actually velocity.\n            elif isinstance(diff, (UnitSphericalDifferential,\n                                   UnitSphericalCosLatDifferential)):\n                diff_attrs = diff_attrs[:-1]\n            attrs.extend(diff_attrs)\n\n        attrs.extend(frame_transform_graph.frame_attributes.keys())\n\n        out = super()._represent_as_dict(attrs)\n\n        out['representation_type'] = sc.representation_type.get_name()\n        out['frame'] = sc.frame.name\n        # Note that sc.info.unit is a fake composite unit (e.g. 'deg,deg,None'\n        # or None,None,m) and is not stored.  The individual attributes have\n        # units.\n\n        return out\n\n    def new_like(self, skycoords, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new SkyCoord instance which is consistent with the input\n        SkyCoord objects ``skycoords`` and has ``length`` rows.  Being\n        \"consistent\" is defined as being able to set an item from one to each of\n        the rest without any exception being raised.\n\n        This is intended for creating a new SkyCoord instance whose elements can\n        be set in-place for table operations like join or vstack.  This is used\n        when a SkyCoord object is used as a mixin column in an astropy Table.\n\n        The data values are not predictable and it is expected that the consumer\n        of the object will fill in all values.\n\n        Parameters\n        ----------\n        skycoords : list\n            List of input SkyCoord objects\n        length : int\n            Length of the output skycoord object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output name (sets output skycoord.info.name)\n\n        Returns\n        -------\n        skycoord : SkyCoord (or subclass)\n            Instance of this class consistent with ``skycoords``\n\n        \"\"\"\n        # Get merged info attributes like shape, dtype, format, description, etc.\n        attrs = self.merge_cols_attributes(skycoords, metadata_conflicts, name,\n                                           ('meta', 'description'))\n        skycoord0 = skycoords[0]\n\n        # Make a new SkyCoord object with the desired length and attributes\n        # by using the _apply / __getitem__ machinery to effectively return\n        # skycoord0[[0, 0, ..., 0, 0]]. This will have the all the right frame\n        # attributes with the right shape.\n        indexes = np.zeros(length, dtype=np.int64)\n        out = skycoord0[indexes]\n\n        # Use __setitem__ machinery to check for consistency of all skycoords\n        for skycoord in skycoords[1:]:\n            try:\n                out[0] = skycoord[0]\n            except Exception as err:\n                raise ValueError(f'Input skycoords are inconsistent.') from err\n\n        # Set (merged) info attributes\n        for attr in ('name', 'meta', 'description'):\n            if attr in attrs:\n                setattr(out.info, attr, attrs[attr])\n\n        return out\n\n\nclass SkyCoord(ShapedLikeNDArray):\n    \"\"\"High-level object providing a flexible interface for celestial coordinate\n    representation, manipulation, and transformation between systems.\n\n    The `SkyCoord` class accepts a wide variety of inputs for initialization. At\n    a minimum these must provide one or more celestial coordinate values with\n    unambiguous units.  Inputs may be scalars or lists/tuples/arrays, yielding\n    scalar or array coordinates (can be checked via ``SkyCoord.isscalar``).\n    Typically one also specifies the coordinate frame, though this is not\n    required. The general pattern for spherical representations is::\n\n      SkyCoord(COORD, [FRAME], keyword_args ...)\n      SkyCoord(LON, LAT, [FRAME], keyword_args ...)\n      SkyCoord(LON, LAT, [DISTANCE], frame=FRAME, unit=UNIT, keyword_args ...)\n      SkyCoord([FRAME], <lon_attr>=LON, <lat_attr>=LAT, keyword_args ...)\n\n    It is also possible to input coordinate values in other representations\n    such as cartesian or cylindrical.  In this case one includes the keyword\n    argument ``representation_type='cartesian'`` (for example) along with data\n    in ``x``, ``y``, and ``z``.\n\n    See also: https://docs.astropy.org/en/stable/coordinates/\n\n    Examples\n    --------\n    The examples below illustrate common ways of initializing a `SkyCoord`\n    object.  For a complete description of the allowed syntax see the\n    full coordinates documentation.  First some imports::\n\n      >>> from astropy.coordinates import SkyCoord  # High-level coordinates\n      >>> from astropy.coordinates import ICRS, Galactic, FK4, FK5  # Low-level frames\n      >>> from astropy.coordinates import Angle, Latitude, Longitude  # Angles\n      >>> import astropy.units as u\n\n    The coordinate values and frame specification can now be provided using\n    positional and keyword arguments::\n\n      >>> c = SkyCoord(10, 20, unit=\"deg\")  # defaults to ICRS frame\n      >>> c = SkyCoord([1, 2, 3], [-30, 45, 8], frame=\"icrs\", unit=\"deg\")  # 3 coords\n\n      >>> coords = [\"1:12:43.2 +31:12:43\", \"1 12 43.2 +31 12 43\"]\n      >>> c = SkyCoord(coords, frame=FK4, unit=(u.hourangle, u.deg), obstime=\"J1992.21\")\n\n      >>> c = SkyCoord(\"1h12m43.2s +1d12m43s\", frame=Galactic)  # Units from string\n      >>> c = SkyCoord(frame=\"galactic\", l=\"1h12m43.2s\", b=\"+1d12m43s\")\n\n      >>> ra = Longitude([1, 2, 3], unit=u.deg)  # Could also use Angle\n      >>> dec = np.array([4.5, 5.2, 6.3]) * u.deg  # Astropy Quantity\n      >>> c = SkyCoord(ra, dec, frame='icrs')\n      >>> c = SkyCoord(frame=ICRS, ra=ra, dec=dec, obstime='2001-01-02T12:34:56')\n\n      >>> c = FK4(1 * u.deg, 2 * u.deg)  # Uses defaults for obstime, equinox\n      >>> c = SkyCoord(c, obstime='J2010.11', equinox='B1965')  # Override defaults\n\n      >>> c = SkyCoord(w=0, u=1, v=2, unit='kpc', frame='galactic',\n      ...              representation_type='cartesian')\n\n      >>> c = SkyCoord([ICRS(ra=1*u.deg, dec=2*u.deg), ICRS(ra=3*u.deg, dec=4*u.deg)])\n\n    Velocity components (proper motions or radial velocities) can also be\n    provided in a similar manner::\n\n      >>> c = SkyCoord(ra=1*u.deg, dec=2*u.deg, radial_velocity=10*u.km/u.s)\n\n      >>> c = SkyCoord(ra=1*u.deg, dec=2*u.deg, pm_ra_cosdec=2*u.mas/u.yr, pm_dec=1*u.mas/u.yr)\n\n    As shown, the frame can be a `~astropy.coordinates.BaseCoordinateFrame`\n    class or the corresponding string alias.  The frame classes that are built in\n    to astropy are `ICRS`, `FK5`, `FK4`, `FK4NoETerms`, and `Galactic`.\n    The string aliases are simply lower-case versions of the class name, and\n    allow for creating a `SkyCoord` object and transforming frames without\n    explicitly importing the frame classes.\n\n    Parameters\n    ----------\n    frame : `~astropy.coordinates.BaseCoordinateFrame` class or string, optional\n        Type of coordinate frame this `SkyCoord` should represent. Defaults to\n        to ICRS if not given or given as None.\n    unit : `~astropy.units.Unit`, string, or tuple of :class:`~astropy.units.Unit` or str, optional\n        Units for supplied coordinate values.\n        If only one unit is supplied then it applies to all values.\n        Note that passing only one unit might lead to unit conversion errors\n        if the coordinate values are expected to have mixed physical meanings\n        (e.g., angles and distances).\n    obstime : time-like, optional\n        Time(s) of observation.\n    equinox : time-like, optional\n        Coordinate frame equinox time.\n    representation_type : str or Representation class\n        Specifies the representation, e.g. 'spherical', 'cartesian', or\n        'cylindrical'.  This affects the positional args and other keyword args\n        which must correspond to the given representation.\n    copy : bool, optional\n        If `True` (default), a copy of any coordinate data is made.  This\n        argument can only be passed in as a keyword argument.\n    **keyword_args\n        Other keyword arguments as applicable for user-defined coordinate frames.\n        Common options include:\n\n        ra, dec : angle-like, optional\n            RA and Dec for frames where ``ra`` and ``dec`` are keys in the\n            frame's ``representation_component_names``, including `ICRS`,\n            `FK5`, `FK4`, and `FK4NoETerms`.\n        pm_ra_cosdec, pm_dec  : `~astropy.units.Quantity` ['angular speed'], optional\n            Proper motion components, in angle per time units.\n        l, b : angle-like, optional\n            Galactic ``l`` and ``b`` for for frames where ``l`` and ``b`` are\n            keys in the frame's ``representation_component_names``, including\n            the `Galactic` frame.\n        pm_l_cosb, pm_b : `~astropy.units.Quantity` ['angular speed'], optional\n            Proper motion components in the `Galactic` frame, in angle per time\n            units.\n        x, y, z : float or `~astropy.units.Quantity` ['length'], optional\n            Cartesian coordinates values\n        u, v, w : float or `~astropy.units.Quantity` ['length'], optional\n            Cartesian coordinates values for the Galactic frame.\n        radial_velocity : `~astropy.units.Quantity` ['speed'], optional\n            The component of the velocity along the line-of-sight (i.e., the\n            radial direction), in velocity units.\n    \"\"\"\n\n    # Declare that SkyCoord can be used as a Table column by defining the\n    # info property.\n    info = SkyCoordInfo()\n\n    def __init__(self, *args, copy=True, **kwargs):\n\n        # these are frame attributes set on this SkyCoord but *not* a part of\n        # the frame object this SkyCoord contains\n        self._extra_frameattr_names = set()\n\n        # If all that is passed in is a frame instance that already has data,\n        # we should bypass all of the parsing and logic below. This is here\n        # to make this the fastest way to create a SkyCoord instance. Many of\n        # the classmethods implemented for performance enhancements will use\n        # this as the initialization path\n        if (len(args) == 1 and len(kwargs) == 0\n                and isinstance(args[0], (BaseCoordinateFrame, SkyCoord))):\n\n            coords = args[0]\n            if isinstance(coords, SkyCoord):\n                self._extra_frameattr_names = coords._extra_frameattr_names\n                self.info = coords.info\n\n                # Copy over any extra frame attributes\n                for attr_name in self._extra_frameattr_names:\n                    # Setting it will also validate it.\n                    setattr(self, attr_name, getattr(coords, attr_name))\n\n                coords = coords.frame\n\n            if not coords.has_data:\n                raise ValueError('Cannot initialize from a coordinate frame '\n                                 'instance without coordinate data')\n\n            if copy:\n                self._sky_coord_frame = coords.copy()\n            else:\n                self._sky_coord_frame = coords\n\n        else:\n            # Get the frame instance without coordinate data but with all frame\n            # attributes set - these could either have been passed in with the\n            # frame as an instance, or passed in as kwargs here\n            frame_cls, frame_kwargs = _get_frame_without_data(args, kwargs)\n\n            # Parse the args and kwargs to assemble a sanitized and validated\n            # kwargs dict for initializing attributes for this object and for\n            # creating the internal self._sky_coord_frame object\n            args = list(args)  # Make it mutable\n            skycoord_kwargs, components, info = _parse_coordinate_data(\n                frame_cls(**frame_kwargs), args, kwargs)\n\n            # In the above two parsing functions, these kwargs were identified\n            # as valid frame attributes for *some* frame, but not the frame that\n            # this SkyCoord will have. We keep these attributes as special\n            # skycoord frame attributes:\n            for attr in skycoord_kwargs:\n                # Setting it will also validate it.\n                setattr(self, attr, skycoord_kwargs[attr])\n\n            if info is not None:\n                self.info = info\n\n            # Finally make the internal coordinate object.\n            frame_kwargs.update(components)\n            self._sky_coord_frame = frame_cls(copy=copy, **frame_kwargs)\n\n            if not self._sky_coord_frame.has_data:\n                raise ValueError('Cannot create a SkyCoord without data')\n\n    @property\n    def frame(self):\n        return self._sky_coord_frame\n\n    @property\n    def representation_type(self):\n        return self.frame.representation_type\n\n    @representation_type.setter\n    def representation_type(self, value):\n        self.frame.representation_type = value\n\n    # TODO: remove these in future\n    @property\n    def representation(self):\n        return self.frame.representation\n\n    @representation.setter\n    def representation(self, value):\n        self.frame.representation = value\n\n    @property\n    def shape(self):\n        return self.frame.shape\n\n    def __eq__(self, value):\n        \"\"\"Equality operator for SkyCoord\n\n        This implements strict equality and requires that the frames are\n        equivalent, extra frame attributes are equivalent, and that the\n        representation data are exactly equal.\n        \"\"\"\n        if not isinstance(value, SkyCoord):\n            return NotImplemented\n        # Make sure that any extra frame attribute names are equivalent.\n        for attr in self._extra_frameattr_names | value._extra_frameattr_names:\n            if not self.frame._frameattr_equiv(getattr(self, attr),\n                                               getattr(value, attr)):\n                raise ValueError(f\"cannot compare: extra frame attribute \"\n                                 f\"'{attr}' is not equivalent \"\n                                 f\"(perhaps compare the frames directly to avoid \"\n                                 f\"this exception)\")\n\n        return self._sky_coord_frame == value._sky_coord_frame\n\n    def __ne__(self, value):\n        return np.logical_not(self == value)\n\n    def _apply(self, method, *args, **kwargs):\n        \"\"\"Create a new instance, applying a method to the underlying data.\n\n        In typical usage, the method is any of the shape-changing methods for\n        `~numpy.ndarray` (``reshape``, ``swapaxes``, etc.), as well as those\n        picking particular elements (``__getitem__``, ``take``, etc.), which\n        are all defined in `~astropy.utils.shapes.ShapedLikeNDArray`. It will be\n        applied to the underlying arrays in the representation (e.g., ``x``,\n        ``y``, and ``z`` for `~astropy.coordinates.CartesianRepresentation`),\n        as well as to any frame attributes that have a shape, with the results\n        used to create a new instance.\n\n        Internally, it is also used to apply functions to the above parts\n        (in particular, `~numpy.broadcast_to`).\n\n        Parameters\n        ----------\n        method : str or callable\n            If str, it is the name of a method that is applied to the internal\n            ``components``. If callable, the function is applied.\n        args : tuple\n            Any positional arguments for ``method``.\n        kwargs : dict\n            Any keyword arguments for ``method``.\n        \"\"\"\n        def apply_method(value):\n            if isinstance(value, ShapedLikeNDArray):\n                return value._apply(method, *args, **kwargs)\n            else:\n                if callable(method):\n                    return method(value, *args, **kwargs)\n                else:\n                    return getattr(value, method)(*args, **kwargs)\n\n        # create a new but empty instance, and copy over stuff\n        new = super().__new__(self.__class__)\n        new._sky_coord_frame = self._sky_coord_frame._apply(method,\n                                                            *args, **kwargs)\n        new._extra_frameattr_names = self._extra_frameattr_names.copy()\n        for attr in self._extra_frameattr_names:\n            value = getattr(self, attr)\n            if getattr(value, 'shape', ()):\n                value = apply_method(value)\n            elif method == 'copy' or method == 'flatten':\n                # flatten should copy also for a single element array, but\n                # we cannot use it directly for array scalars, since it\n                # always returns a one-dimensional array. So, just copy.\n                value = copy.copy(value)\n            setattr(new, '_' + attr, value)\n\n        # Copy other 'info' attr only if it has actually been defined.\n        # See PR #3898 for further explanation and justification, along\n        # with Quantity.__array_finalize__\n        if 'info' in self.__dict__:\n            new.info = self.info\n\n        return new\n\n    def __setitem__(self, item, value):\n        \"\"\"Implement self[item] = value for SkyCoord\n\n        The right hand ``value`` must be strictly consistent with self:\n        - Identical class\n        - Equivalent frames\n        - Identical representation_types\n        - Identical representation differentials keys\n        - Identical frame attributes\n        - Identical \"extra\" frame attributes (e.g. obstime for an ICRS coord)\n\n        With these caveats the setitem ends up as effectively a setitem on\n        the representation data.\n\n          self.frame.data[item] = value.frame.data\n        \"\"\"\n        if self.__class__ is not value.__class__:\n            raise TypeError(f'can only set from object of same class: '\n                            f'{self.__class__.__name__} vs. '\n                            f'{value.__class__.__name__}')\n\n        # Make sure that any extra frame attribute names are equivalent.\n        for attr in self._extra_frameattr_names | value._extra_frameattr_names:\n            if not self.frame._frameattr_equiv(getattr(self, attr),\n                                               getattr(value, attr)):\n                raise ValueError(f'attribute {attr} is not equivalent')\n\n        # Set the frame values.  This checks frame equivalence and also clears\n        # the cache to ensure that the object is not in an inconsistent state.\n        self._sky_coord_frame[item] = value._sky_coord_frame\n\n    def insert(self, obj, values, axis=0):\n        \"\"\"\n        Insert coordinate values before the given indices in the object and\n        return a new Frame object.\n\n        The values to be inserted must conform to the rules for in-place setting\n        of ``SkyCoord`` objects.\n\n        The API signature matches the ``np.insert`` API, but is more limited.\n        The specification of insert index ``obj`` must be a single integer,\n        and the ``axis`` must be ``0`` for simple insertion before the index.\n\n        Parameters\n        ----------\n        obj : int\n            Integer index before which ``values`` is inserted.\n        values : array-like\n            Value(s) to insert.  If the type of ``values`` is different\n            from that of quantity, ``values`` is converted to the matching type.\n        axis : int, optional\n            Axis along which to insert ``values``.  Default is 0, which is the\n            only allowed value and will insert a row.\n\n        Returns\n        -------\n        out : `~astropy.coordinates.SkyCoord` instance\n            New coordinate object with inserted value(s)\n\n        \"\"\"\n        # Validate inputs: obj arg is integer, axis=0, self is not a scalar, and\n        # input index is in bounds.\n        try:\n            idx0 = operator.index(obj)\n        except TypeError:\n            raise TypeError('obj arg must be an integer')\n\n        if axis != 0:\n            raise ValueError('axis must be 0')\n\n        if not self.shape:\n            raise TypeError('cannot insert into scalar {} object'\n                            .format(self.__class__.__name__))\n\n        if abs(idx0) > len(self):\n            raise IndexError('index {} is out of bounds for axis 0 with size {}'\n                             .format(idx0, len(self)))\n\n        # Turn negative index into positive\n        if idx0 < 0:\n            idx0 = len(self) + idx0\n\n        n_values = len(values) if values.shape else 1\n\n        # Finally make the new object with the correct length and set values for the\n        # three sections, before insert, the insert, and after the insert.\n        out = self.__class__.info.new_like([self], len(self) + n_values, name=self.info.name)\n\n        # Set the output values. This is where validation of `values` takes place to ensure\n        # that it can indeed be inserted.\n        out[:idx0] = self[:idx0]\n        out[idx0:idx0 + n_values] = values\n        out[idx0 + n_values:] = self[idx0:]\n\n        return out\n\n    def is_transformable_to(self, new_frame):\n        \"\"\"\n        Determines if this coordinate frame can be transformed to another\n        given frame.\n\n        Parameters\n        ----------\n        new_frame : frame class, frame object, or str\n            The proposed frame to transform into.\n\n        Returns\n        -------\n        transformable : bool or str\n            `True` if this can be transformed to ``new_frame``, `False` if\n            not, or the string 'same' if ``new_frame`` is the same system as\n            this object but no transformation is defined.\n\n        Notes\n        -----\n        A return value of 'same' means the transformation will work, but it will\n        just give back a copy of this object.  The intended usage is::\n\n            if coord.is_transformable_to(some_unknown_frame):\n                coord2 = coord.transform_to(some_unknown_frame)\n\n        This will work even if ``some_unknown_frame``  turns out to be the same\n        frame class as ``coord``.  This is intended for cases where the frame\n        is the same regardless of the frame attributes (e.g. ICRS), but be\n        aware that it *might* also indicate that someone forgot to define the\n        transformation between two objects of the same frame class but with\n        different attributes.\n        \"\"\"\n        # TODO! like matplotlib, do string overrides for modified methods\n        new_frame = (_get_frame_class(new_frame) if isinstance(new_frame, str)\n                     else new_frame)\n        return self.frame.is_transformable_to(new_frame)\n\n    def transform_to(self, frame, merge_attributes=True):\n        \"\"\"Transform this coordinate to a new frame.\n\n        The precise frame transformed to depends on ``merge_attributes``.\n        If `False`, the destination frame is used exactly as passed in.\n        But this is often not quite what one wants.  E.g., suppose one wants to\n        transform an ICRS coordinate that has an obstime attribute to FK4; in\n        this case, one likely would want to use this information. Thus, the\n        default for ``merge_attributes`` is `True`, in which the precedence is\n        as follows: (1) explicitly set (i.e., non-default) values in the\n        destination frame; (2) explicitly set values in the source; (3) default\n        value in the destination frame.\n\n        Note that in either case, any explicitly set attributes on the source\n        `SkyCoord` that are not part of the destination frame's definition are\n        kept (stored on the resulting `SkyCoord`), and thus one can round-trip\n        (e.g., from FK4 to ICRS to FK4 without losing obstime).\n\n        Parameters\n        ----------\n        frame : str, `BaseCoordinateFrame` class or instance, or `SkyCoord` instance\n            The frame to transform this coordinate into.  If a `SkyCoord`, the\n            underlying frame is extracted, and all other information ignored.\n        merge_attributes : bool, optional\n            Whether the default attributes in the destination frame are allowed\n            to be overridden by explicitly set attributes in the source\n            (see note above; default: `True`).\n\n        Returns\n        -------\n        coord : `SkyCoord`\n            A new object with this coordinate represented in the `frame` frame.\n\n        Raises\n        ------\n        ValueError\n            If there is no possible transformation route.\n\n        \"\"\"\n        from astropy.coordinates.errors import ConvertError\n\n        frame_kwargs = {}\n\n        # Frame name (string) or frame class?  Coerce into an instance.\n        try:\n            frame = _get_frame_class(frame)()\n        except Exception:\n            pass\n\n        if isinstance(frame, SkyCoord):\n            frame = frame.frame  # Change to underlying coord frame instance\n\n        if isinstance(frame, BaseCoordinateFrame):\n            new_frame_cls = frame.__class__\n            # Get frame attributes, allowing defaults to be overridden by\n            # explicitly set attributes of the source if ``merge_attributes``.\n            for attr in frame_transform_graph.frame_attributes:\n                self_val = getattr(self, attr, None)\n                frame_val = getattr(frame, attr, None)\n                if (frame_val is not None\n                    and not (merge_attributes\n                             and frame.is_frame_attr_default(attr))):\n                    frame_kwargs[attr] = frame_val\n                elif (self_val is not None\n                      and not self.is_frame_attr_default(attr)):\n                    frame_kwargs[attr] = self_val\n                elif frame_val is not None:\n                    frame_kwargs[attr] = frame_val\n        else:\n            raise ValueError('Transform `frame` must be a frame name, class, or instance')\n\n        # Get the composite transform to the new frame\n        trans = frame_transform_graph.get_transform(self.frame.__class__, new_frame_cls)\n        if trans is None:\n            raise ConvertError('Cannot transform from {} to {}'\n                               .format(self.frame.__class__, new_frame_cls))\n\n        # Make a generic frame which will accept all the frame kwargs that\n        # are provided and allow for transforming through intermediate frames\n        # which may require one or more of those kwargs.\n        generic_frame = GenericFrame(frame_kwargs)\n\n        # Do the transformation, returning a coordinate frame of the desired\n        # final type (not generic).\n        new_coord = trans(self.frame, generic_frame)\n\n        # Finally make the new SkyCoord object from the `new_coord` and\n        # remaining frame_kwargs that are not frame_attributes in `new_coord`.\n        for attr in (set(new_coord.get_frame_attr_names()) &\n                     set(frame_kwargs.keys())):\n            frame_kwargs.pop(attr)\n\n        # Always remove the origin frame attribute, as that attribute only makes\n        # sense with a SkyOffsetFrame (in which case it will be stored on the frame).\n        # See gh-11277.\n        # TODO: Should it be a property of the frame attribute that it can\n        # or cannot be stored on a SkyCoord?\n        frame_kwargs.pop('origin', None)\n\n        return self.__class__(new_coord, **frame_kwargs)\n\n    def apply_space_motion(self, new_obstime=None, dt=None):\n        \"\"\"\n        Compute the position of the source represented by this coordinate object\n        to a new time using the velocities stored in this object and assuming\n        linear space motion (including relativistic corrections). This is\n        sometimes referred to as an \"epoch transformation.\"\n\n        The initial time before the evolution is taken from the ``obstime``\n        attribute of this coordinate.  Note that this method currently does not\n        support evolving coordinates where the *frame* has an ``obstime`` frame\n        attribute, so the ``obstime`` is only used for storing the before and\n        after times, not actually as an attribute of the frame. Alternatively,\n        if ``dt`` is given, an ``obstime`` need not be provided at all.\n\n        Parameters\n        ----------\n        new_obstime : `~astropy.time.Time`, optional\n            The time at which to evolve the position to. Requires that the\n            ``obstime`` attribute be present on this frame.\n        dt : `~astropy.units.Quantity`, `~astropy.time.TimeDelta`, optional\n            An amount of time to evolve the position of the source. Cannot be\n            given at the same time as ``new_obstime``.\n\n        Returns\n        -------\n        new_coord : `SkyCoord`\n            A new coordinate object with the evolved location of this coordinate\n            at the new time.  ``obstime`` will be set on this object to the new\n            time only if ``self`` also has ``obstime``.\n        \"\"\"\n\n        if (new_obstime is None and dt is None or\n                new_obstime is not None and dt is not None):\n            raise ValueError(\"You must specify one of `new_obstime` or `dt`, \"\n                             \"but not both.\")\n\n        # Validate that we have velocity info\n        if 's' not in self.frame.data.differentials:\n            raise ValueError('SkyCoord requires velocity data to evolve the '\n                             'position.')\n\n        if 'obstime' in self.frame.frame_attributes:\n            raise NotImplementedError(\"Updating the coordinates in a frame \"\n                                      \"with explicit time dependence is \"\n                                      \"currently not supported. If you would \"\n                                      \"like this functionality, please open an \"\n                                      \"issue on github:\\n\"\n                                      \"https://github.com/astropy/astropy\")\n\n        if new_obstime is not None and self.obstime is None:\n            # If no obstime is already on this object, raise an error if a new\n            # obstime is passed: we need to know the time / epoch at which the\n            # the position / velocity were measured initially\n            raise ValueError('This object has no associated `obstime`. '\n                             'apply_space_motion() must receive a time '\n                             'difference, `dt`, and not a new obstime.')\n\n        # Compute t1 and t2, the times used in the starpm call, which *only*\n        # uses them to compute a delta-time\n        t1 = self.obstime\n        if dt is None:\n            # self.obstime is not None and new_obstime is not None b/c of above\n            # checks\n            t2 = new_obstime\n        else:\n            # new_obstime is definitely None b/c of the above checks\n            if t1 is None:\n                # MAGIC NUMBER: if the current SkyCoord object has no obstime,\n                # assume J2000 to do the dt offset. This is not actually used\n                # for anything except a delta-t in starpm, so it's OK that it's\n                # not necessarily the \"real\" obstime\n                t1 = Time('J2000')\n                new_obstime = None  # we don't actually know the initial obstime\n                t2 = t1 + dt\n            else:\n                t2 = t1 + dt\n                new_obstime = t2\n        # starpm wants tdb time\n        t1 = t1.tdb\n        t2 = t2.tdb\n\n        # proper motion in RA should not include the cos(dec) term, see the\n        # erfa function eraStarpv, comment (4).  So we convert to the regular\n        # spherical differentials.\n        icrsrep = self.icrs.represent_as(SphericalRepresentation, SphericalDifferential)\n        icrsvel = icrsrep.differentials['s']\n\n        parallax_zero = False\n        try:\n            plx = icrsrep.distance.to_value(u.arcsecond, u.parallax())\n        except u.UnitConversionError:  # No distance: set to 0 by convention\n            plx = 0.\n            parallax_zero = True\n\n        try:\n            rv = icrsvel.d_distance.to_value(u.km/u.s)\n        except u.UnitConversionError:  # No RV\n            rv = 0.\n\n        starpm = erfa.pmsafe(icrsrep.lon.radian, icrsrep.lat.radian,\n                             icrsvel.d_lon.to_value(u.radian/u.yr),\n                             icrsvel.d_lat.to_value(u.radian/u.yr),\n                             plx, rv, t1.jd1, t1.jd2, t2.jd1, t2.jd2)\n\n        if parallax_zero:\n            new_distance = None\n        else:\n            new_distance = Distance(parallax=starpm[4] << u.arcsec)\n\n        icrs2 = ICRS(ra=u.Quantity(starpm[0], u.radian, copy=False),\n                     dec=u.Quantity(starpm[1], u.radian, copy=False),\n                     pm_ra=u.Quantity(starpm[2], u.radian/u.yr, copy=False),\n                     pm_dec=u.Quantity(starpm[3], u.radian/u.yr, copy=False),\n                     distance=new_distance,\n                     radial_velocity=u.Quantity(starpm[5], u.km/u.s, copy=False),\n                     differential_type=SphericalDifferential)\n\n        # Update the obstime of the returned SkyCoord, and need to carry along\n        # the frame attributes\n        frattrs = {attrnm: getattr(self, attrnm)\n                   for attrnm in self._extra_frameattr_names}\n        frattrs['obstime'] = new_obstime\n        result = self.__class__(icrs2, **frattrs).transform_to(self.frame)\n\n        # Without this the output might not have the right differential type.\n        # Not sure if this fixes the problem or just hides it.  See #11932\n        result.differential_type = self.differential_type\n\n        return result\n\n    def _is_name(self, string):\n        \"\"\"\n        Returns whether a string is one of the aliases for the frame.\n        \"\"\"\n        return (self.frame.name == string or\n                (isinstance(self.frame.name, list) and string in self.frame.name))\n\n    def __getattr__(self, attr):\n        \"\"\"\n        Overrides getattr to return coordinates that this can be transformed\n        to, based on the alias attr in the primary transform graph.\n        \"\"\"\n        if '_sky_coord_frame' in self.__dict__:\n            if self._is_name(attr):\n                return self  # Should this be a deepcopy of self?\n\n            # Anything in the set of all possible frame_attr_names is handled\n            # here. If the attr is relevant for the current frame then delegate\n            # to self.frame otherwise get it from self._<attr>.\n            if attr in frame_transform_graph.frame_attributes:\n                if attr in self.frame.get_frame_attr_names():\n                    return getattr(self.frame, attr)\n                else:\n                    return getattr(self, '_' + attr, None)\n\n            # Some attributes might not fall in the above category but still\n            # are available through self._sky_coord_frame.\n            if not attr.startswith('_') and hasattr(self._sky_coord_frame, attr):\n                return getattr(self._sky_coord_frame, attr)\n\n            # Try to interpret as a new frame for transforming.\n            frame_cls = frame_transform_graph.lookup_name(attr)\n            if frame_cls is not None and self.frame.is_transformable_to(frame_cls):\n                return self.transform_to(attr)\n\n        # Fail\n        raise AttributeError(\"'{}' object has no attribute '{}'\"\n                             .format(self.__class__.__name__, attr))\n\n    def __setattr__(self, attr, val):\n        # This is to make anything available through __getattr__ immutable\n        if '_sky_coord_frame' in self.__dict__:\n            if self._is_name(attr):\n                raise AttributeError(f\"'{attr}' is immutable\")\n\n            if not attr.startswith('_') and hasattr(self._sky_coord_frame, attr):\n                setattr(self._sky_coord_frame, attr, val)\n                return\n\n            frame_cls = frame_transform_graph.lookup_name(attr)\n            if frame_cls is not None and self.frame.is_transformable_to(frame_cls):\n                raise AttributeError(f\"'{attr}' is immutable\")\n\n        if attr in frame_transform_graph.frame_attributes:\n            # All possible frame attributes can be set, but only via a private\n            # variable.  See __getattr__ above.\n            super().__setattr__('_' + attr, val)\n            # Validate it\n            frame_transform_graph.frame_attributes[attr].__get__(self)\n            # And add to set of extra attributes\n            self._extra_frameattr_names |= {attr}\n\n        else:\n            # Otherwise, do the standard Python attribute setting\n            super().__setattr__(attr, val)\n\n    def __delattr__(self, attr):\n        # mirror __setattr__ above\n        if '_sky_coord_frame' in self.__dict__:\n            if self._is_name(attr):\n                raise AttributeError(f\"'{attr}' is immutable\")\n\n            if not attr.startswith('_') and hasattr(self._sky_coord_frame,\n                                                    attr):\n                delattr(self._sky_coord_frame, attr)\n                return\n\n            frame_cls = frame_transform_graph.lookup_name(attr)\n            if frame_cls is not None and self.frame.is_transformable_to(frame_cls):\n                raise AttributeError(f\"'{attr}' is immutable\")\n\n        if attr in frame_transform_graph.frame_attributes:\n            # All possible frame attributes can be deleted, but need to remove\n            # the corresponding private variable.  See __getattr__ above.\n            super().__delattr__('_' + attr)\n            # Also remove it from the set of extra attributes\n            self._extra_frameattr_names -= {attr}\n\n        else:\n            # Otherwise, do the standard Python attribute setting\n            super().__delattr__(attr)\n\n    @override__dir__\n    def __dir__(self):\n        \"\"\"\n        Override the builtin `dir` behavior to include:\n        - Transforms available by aliases\n        - Attribute / methods of the underlying self.frame object\n        \"\"\"\n\n        # determine the aliases that this can be transformed to.\n        dir_values = set()\n        for name in frame_transform_graph.get_names():\n            frame_cls = frame_transform_graph.lookup_name(name)\n            if self.frame.is_transformable_to(frame_cls):\n                dir_values.add(name)\n\n        # Add public attributes of self.frame\n        dir_values.update(set(attr for attr in dir(self.frame) if not attr.startswith('_')))\n\n        # Add all possible frame attributes\n        dir_values.update(frame_transform_graph.frame_attributes.keys())\n\n        return dir_values\n\n    def __repr__(self):\n        clsnm = self.__class__.__name__\n        coonm = self.frame.__class__.__name__\n        frameattrs = self.frame._frame_attrs_repr()\n        if frameattrs:\n            frameattrs = ': ' + frameattrs\n\n        data = self.frame._data_repr()\n        if data:\n            data = ': ' + data\n\n        return '<{clsnm} ({coonm}{frameattrs}){data}>'.format(**locals())\n\n    def to_string(self, style='decimal', **kwargs):\n        \"\"\"\n        A string representation of the coordinates.\n\n        The default styles definitions are::\n\n          'decimal': 'lat': {'decimal': True, 'unit': \"deg\"}\n                     'lon': {'decimal': True, 'unit': \"deg\"}\n          'dms': 'lat': {'unit': \"deg\"}\n                 'lon': {'unit': \"deg\"}\n          'hmsdms': 'lat': {'alwayssign': True, 'pad': True, 'unit': \"deg\"}\n                    'lon': {'pad': True, 'unit': \"hour\"}\n\n        See :meth:`~astropy.coordinates.Angle.to_string` for details and\n        keyword arguments (the two angles forming the coordinates are are\n        both :class:`~astropy.coordinates.Angle` instances). Keyword\n        arguments have precedence over the style defaults and are passed\n        to :meth:`~astropy.coordinates.Angle.to_string`.\n\n        Parameters\n        ----------\n        style : {'hmsdms', 'dms', 'decimal'}\n            The formatting specification to use. These encode the three most\n            common ways to represent coordinates. The default is `decimal`.\n        kwargs\n            Keyword args passed to :meth:`~astropy.coordinates.Angle.to_string`.\n        \"\"\"\n\n        sph_coord = self.frame.represent_as(SphericalRepresentation)\n\n        styles = {'hmsdms': {'lonargs': {'unit': u.hour, 'pad': True},\n                             'latargs': {'unit': u.degree, 'pad': True, 'alwayssign': True}},\n                  'dms': {'lonargs': {'unit': u.degree},\n                          'latargs': {'unit': u.degree}},\n                  'decimal': {'lonargs': {'unit': u.degree, 'decimal': True},\n                              'latargs': {'unit': u.degree, 'decimal': True}}\n                  }\n\n        lonargs = {}\n        latargs = {}\n\n        if style in styles:\n            lonargs.update(styles[style]['lonargs'])\n            latargs.update(styles[style]['latargs'])\n        else:\n            raise ValueError(f\"Invalid style.  Valid options are: {','.join(styles)}\")\n\n        lonargs.update(kwargs)\n        latargs.update(kwargs)\n\n        if np.isscalar(sph_coord.lon.value):\n            coord_string = (sph_coord.lon.to_string(**lonargs) +\n                            \" \" + sph_coord.lat.to_string(**latargs))\n        else:\n            coord_string = []\n            for lonangle, latangle in zip(sph_coord.lon.ravel(), sph_coord.lat.ravel()):\n                coord_string += [(lonangle.to_string(**lonargs) +\n                                 \" \" + latangle.to_string(**latargs))]\n            if len(sph_coord.shape) > 1:\n                coord_string = np.array(coord_string).reshape(sph_coord.shape)\n\n        return coord_string\n\n    def to_table(self):\n        \"\"\"\n        Convert this |SkyCoord| to a |QTable|.\n\n        Any attributes that have the same length as the |SkyCoord| will be\n        converted to columns of the |QTable|. All other attributes will be\n        recorded as metadata.\n\n        Returns\n        -------\n        `~astropy.table.QTable`\n            A |QTable| containing the data of this |SkyCoord|.\n\n        Examples\n        --------\n        >>> sc = SkyCoord(ra=[40, 70]*u.deg, dec=[0, -20]*u.deg,\n        ...               obstime=Time([2000, 2010], format='jyear'))\n        >>> t =  sc.to_table()\n        >>> t\n        <QTable length=2>\n           ra     dec   obstime\n          deg     deg\n        float64 float64   Time\n        ------- ------- -------\n           40.0     0.0  2000.0\n           70.0   -20.0  2010.0\n        >>> t.meta\n        {'representation_type': 'spherical', 'frame': 'icrs'}\n        \"\"\"\n        self_as_dict = self.info._represent_as_dict()\n        tabledata = {}\n        metadata = {}\n        # Record attributes that have the same length as self as columns in the\n        # table, and the other attributes as table metadata.  This matches\n        # table.serialize._represent_mixin_as_column().\n        for key, value in self_as_dict.items():\n            if getattr(value, 'shape', ())[:1] == (len(self),):\n                tabledata[key] = value\n            else:\n                metadata[key] = value\n        return QTable(tabledata, meta=metadata)\n\n    def is_equivalent_frame(self, other):\n        \"\"\"\n        Checks if this object's frame as the same as that of the ``other``\n        object.\n\n        To be the same frame, two objects must be the same frame class and have\n        the same frame attributes. For two `SkyCoord` objects, *all* of the\n        frame attributes have to match, not just those relevant for the object's\n        frame.\n\n        Parameters\n        ----------\n        other : SkyCoord or BaseCoordinateFrame\n            The other object to check.\n\n        Returns\n        -------\n        isequiv : bool\n            True if the frames are the same, False if not.\n\n        Raises\n        ------\n        TypeError\n            If ``other`` isn't a `SkyCoord` or a `BaseCoordinateFrame` or subclass.\n        \"\"\"\n        if isinstance(other, BaseCoordinateFrame):\n            return self.frame.is_equivalent_frame(other)\n        elif isinstance(other, SkyCoord):\n            if other.frame.name != self.frame.name:\n                return False\n\n            for fattrnm in frame_transform_graph.frame_attributes:\n                if not BaseCoordinateFrame._frameattr_equiv(getattr(self, fattrnm),\n                                                            getattr(other, fattrnm)):\n                    return False\n            return True\n        else:\n            # not a BaseCoordinateFrame nor a SkyCoord object\n            raise TypeError(\"Tried to do is_equivalent_frame on something that \"\n                            \"isn't frame-like\")\n\n    # High-level convenience methods\n    def separation(self, other):\n        \"\"\"\n        Computes on-sky separation between this coordinate and another.\n\n        .. note::\n\n            If the ``other`` coordinate object is in a different frame, it is\n            first transformed to the frame of this object. This can lead to\n            unintuitive behavior if not accounted for. Particularly of note is\n            that ``self.separation(other)`` and ``other.separation(self)`` may\n            not give the same answer in this case.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate to get the separation to.\n\n        Returns\n        -------\n        sep : `~astropy.coordinates.Angle`\n            The on-sky separation between this and the ``other`` coordinate.\n\n        Notes\n        -----\n        The separation is calculated using the Vincenty formula, which\n        is stable at all locations, including poles and antipodes [1]_.\n\n        .. [1] https://en.wikipedia.org/wiki/Great-circle_distance\n\n        \"\"\"\n        from . import Angle\n        from .angle_utilities import angular_separation\n\n        if not self.is_equivalent_frame(other):\n            try:\n                kwargs = {'merge_attributes': False} if isinstance(other, SkyCoord) else {}\n                other = other.transform_to(self, **kwargs)\n            except TypeError:\n                raise TypeError('Can only get separation to another SkyCoord '\n                                'or a coordinate frame with data')\n\n        lon1 = self.spherical.lon\n        lat1 = self.spherical.lat\n        lon2 = other.spherical.lon\n        lat2 = other.spherical.lat\n\n        # Get the separation as a Quantity, convert to Angle in degrees\n        sep = angular_separation(lon1, lat1, lon2, lat2)\n        return Angle(sep, unit=u.degree)\n\n    def separation_3d(self, other):\n        \"\"\"\n        Computes three dimensional separation between this coordinate\n        and another.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate to get the separation to.\n\n        Returns\n        -------\n        sep : `~astropy.coordinates.Distance`\n            The real-space distance between these two coordinates.\n\n        Raises\n        ------\n        ValueError\n            If this or the other coordinate do not have distances.\n        \"\"\"\n        if not self.is_equivalent_frame(other):\n            try:\n                kwargs = {'merge_attributes': False} if isinstance(other, SkyCoord) else {}\n                other = other.transform_to(self, **kwargs)\n            except TypeError:\n                raise TypeError('Can only get separation to another SkyCoord '\n                                'or a coordinate frame with data')\n\n        if issubclass(self.data.__class__, UnitSphericalRepresentation):\n            raise ValueError('This object does not have a distance; cannot '\n                             'compute 3d separation.')\n        if issubclass(other.data.__class__, UnitSphericalRepresentation):\n            raise ValueError('The other object does not have a distance; '\n                             'cannot compute 3d separation.')\n\n        c1 = self.cartesian.without_differentials()\n        c2 = other.cartesian.without_differentials()\n        return Distance((c1 - c2).norm())\n\n    def spherical_offsets_to(self, tocoord):\n        r\"\"\"\n        Computes angular offsets to go *from* this coordinate *to* another.\n\n        Parameters\n        ----------\n        tocoord : `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate to find the offset to.\n\n        Returns\n        -------\n        lon_offset : `~astropy.coordinates.Angle`\n            The angular offset in the longitude direction. The definition of\n            \"longitude\" depends on this coordinate's frame (e.g., RA for\n            equatorial coordinates).\n        lat_offset : `~astropy.coordinates.Angle`\n            The angular offset in the latitude direction. The definition of\n            \"latitude\" depends on this coordinate's frame (e.g., Dec for\n            equatorial coordinates).\n\n        Raises\n        ------\n        ValueError\n            If the ``tocoord`` is not in the same frame as this one. This is\n            different from the behavior of the `separation`/`separation_3d`\n            methods because the offset components depend critically on the\n            specific choice of frame.\n\n        Notes\n        -----\n        This uses the sky offset frame machinery, and hence will produce a new\n        sky offset frame if one does not already exist for this object's frame\n        class.\n\n        See Also\n        --------\n        separation : for the *total* angular offset (not broken out into components).\n        position_angle : for the direction of the offset.\n\n        \"\"\"\n        if not self.is_equivalent_frame(tocoord):\n            raise ValueError('Tried to use spherical_offsets_to with two non-matching frames!')\n\n        aframe = self.skyoffset_frame()\n        acoord = tocoord.transform_to(aframe)\n\n        dlon = acoord.spherical.lon.view(Angle)\n        dlat = acoord.spherical.lat.view(Angle)\n        return dlon, dlat\n\n    def spherical_offsets_by(self, d_lon, d_lat):\n        \"\"\"\n        Computes the coordinate that is a specified pair of angular offsets away\n        from this coordinate.\n\n        Parameters\n        ----------\n        d_lon : angle-like\n            The angular offset in the longitude direction. The definition of\n            \"longitude\" depends on this coordinate's frame (e.g., RA for\n            equatorial coordinates).\n        d_lat : angle-like\n            The angular offset in the latitude direction. The definition of\n            \"latitude\" depends on this coordinate's frame (e.g., Dec for\n            equatorial coordinates).\n\n        Returns\n        -------\n        newcoord : `~astropy.coordinates.SkyCoord`\n            The coordinates for the location that corresponds to offsetting by\n            ``d_lat`` in the latitude direction and ``d_lon`` in the longitude\n            direction.\n\n        Notes\n        -----\n        This internally uses `~astropy.coordinates.SkyOffsetFrame` to do the\n        transformation. For a more complete set of transform offsets, use\n        `~astropy.coordinates.SkyOffsetFrame` or `~astropy.wcs.WCS` manually.\n        This specific method can be reproduced by doing\n        ``SkyCoord(SkyOffsetFrame(d_lon, d_lat, origin=self.frame).transform_to(self))``.\n\n        See Also\n        --------\n        spherical_offsets_to : compute the angular offsets to another coordinate\n        directional_offset_by : offset a coordinate by an angle in a direction\n        \"\"\"\n        return self.__class__(\n            SkyOffsetFrame(d_lon, d_lat, origin=self.frame).transform_to(self))\n\n    def directional_offset_by(self, position_angle, separation):\n        \"\"\"\n        Computes coordinates at the given offset from this coordinate.\n\n        Parameters\n        ----------\n        position_angle : `~astropy.coordinates.Angle`\n            position_angle of offset\n        separation : `~astropy.coordinates.Angle`\n            offset angular separation\n\n        Returns\n        -------\n        newpoints : `~astropy.coordinates.SkyCoord`\n            The coordinates for the location that corresponds to offsetting by\n            the given `position_angle` and `separation`.\n\n        Notes\n        -----\n        Returned SkyCoord frame retains only the frame attributes that are for\n        the resulting frame type.  (e.g. if the input frame is\n        `~astropy.coordinates.ICRS`, an ``equinox`` value will be retained, but\n        an ``obstime`` will not.)\n\n        For a more complete set of transform offsets, use `~astropy.wcs.WCS`.\n        `~astropy.coordinates.SkyCoord.skyoffset_frame()` can also be used to\n        create a spherical frame with (lat=0, lon=0) at a reference point,\n        approximating an xy cartesian system for small offsets. This method\n        is distinct in that it is accurate on the sphere.\n\n        See Also\n        --------\n        position_angle : inverse operation for the ``position_angle`` component\n        separation : inverse operation for the ``separation`` component\n\n        \"\"\"\n        from . import angle_utilities\n\n        slat = self.represent_as(UnitSphericalRepresentation).lat\n        slon = self.represent_as(UnitSphericalRepresentation).lon\n\n        newlon, newlat = angle_utilities.offset_by(\n            lon=slon, lat=slat,\n            posang=position_angle, distance=separation)\n\n        return SkyCoord(newlon, newlat, frame=self.frame)\n\n    def match_to_catalog_sky(self, catalogcoord, nthneighbor=1):\n        \"\"\"\n        Finds the nearest on-sky matches of this coordinate in a set of\n        catalog coordinates.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        catalogcoord : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The base catalog in which to search for matches. Typically this\n            will be a coordinate object that is an array (i.e.,\n            ``catalogcoord.isscalar == False``)\n        nthneighbor : int, optional\n            Which closest neighbor to search for.  Typically ``1`` is\n            desired here, as that is correct for matching one set of\n            coordinates to another. The next likely use case is ``2``,\n            for matching a coordinate catalog against *itself* (``1``\n            is inappropriate because each point will find itself as the\n            closest match).\n\n        Returns\n        -------\n        idx : int array\n            Indices into ``catalogcoord`` to get the matched points for\n            each of this object's coordinates. Shape matches this\n            object.\n        sep2d : `~astropy.coordinates.Angle`\n            The on-sky separation between the closest match for each\n            element in this object in ``catalogcoord``. Shape matches\n            this object.\n        dist3d : `~astropy.units.Quantity` ['length']\n            The 3D distance between the closest match for each element\n            in this object in ``catalogcoord``. Shape matches this\n            object. Unless both this and ``catalogcoord`` have associated\n            distances, this quantity assumes that all sources are at a\n            distance of 1 (dimensionless).\n\n        Notes\n        -----\n        This method requires `SciPy <https://www.scipy.org/>`_ to be\n        installed or it will fail.\n\n        See Also\n        --------\n        astropy.coordinates.match_coordinates_sky\n        SkyCoord.match_to_catalog_3d\n        \"\"\"\n        from .matching import match_coordinates_sky\n\n        if not (isinstance(catalogcoord, (SkyCoord, BaseCoordinateFrame))\n                and catalogcoord.has_data):\n            raise TypeError('Can only get separation to another SkyCoord or a '\n                            'coordinate frame with data')\n\n        res = match_coordinates_sky(self, catalogcoord,\n                                    nthneighbor=nthneighbor,\n                                    storekdtree='_kdtree_sky')\n        return res\n\n    def match_to_catalog_3d(self, catalogcoord, nthneighbor=1):\n        \"\"\"\n        Finds the nearest 3-dimensional matches of this coordinate to a set\n        of catalog coordinates.\n\n        This finds the 3-dimensional closest neighbor, which is only different\n        from the on-sky distance if ``distance`` is set in this object or the\n        ``catalogcoord`` object.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        catalogcoord : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The base catalog in which to search for matches. Typically this\n            will be a coordinate object that is an array (i.e.,\n            ``catalogcoord.isscalar == False``)\n        nthneighbor : int, optional\n            Which closest neighbor to search for.  Typically ``1`` is\n            desired here, as that is correct for matching one set of\n            coordinates to another.  The next likely use case is\n            ``2``, for matching a coordinate catalog against *itself*\n            (``1`` is inappropriate because each point will find\n            itself as the closest match).\n\n        Returns\n        -------\n        idx : int array\n            Indices into ``catalogcoord`` to get the matched points for\n            each of this object's coordinates. Shape matches this\n            object.\n        sep2d : `~astropy.coordinates.Angle`\n            The on-sky separation between the closest match for each\n            element in this object in ``catalogcoord``. Shape matches\n            this object.\n        dist3d : `~astropy.units.Quantity` ['length']\n            The 3D distance between the closest match for each element\n            in this object in ``catalogcoord``. Shape matches this\n            object.\n\n        Notes\n        -----\n        This method requires `SciPy <https://www.scipy.org/>`_ to be\n        installed or it will fail.\n\n        See Also\n        --------\n        astropy.coordinates.match_coordinates_3d\n        SkyCoord.match_to_catalog_sky\n        \"\"\"\n        from .matching import match_coordinates_3d\n\n        if not (isinstance(catalogcoord, (SkyCoord, BaseCoordinateFrame))\n                and catalogcoord.has_data):\n            raise TypeError('Can only get separation to another SkyCoord or a '\n                            'coordinate frame with data')\n\n        res = match_coordinates_3d(self, catalogcoord,\n                                   nthneighbor=nthneighbor,\n                                   storekdtree='_kdtree_3d')\n\n        return res\n\n    def search_around_sky(self, searcharoundcoords, seplimit):\n        \"\"\"\n        Searches for all coordinates in this object around a supplied set of\n        points within a given on-sky separation.\n\n        This is intended for use on `~astropy.coordinates.SkyCoord` objects\n        with coordinate arrays, rather than a scalar coordinate.  For a scalar\n        coordinate, it is better to use\n        `~astropy.coordinates.SkyCoord.separation`.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        searcharoundcoords : coordinate-like\n            The coordinates to search around to try to find matching points in\n            this `SkyCoord`. This should be an object with array coordinates,\n            not a scalar coordinate object.\n        seplimit : `~astropy.units.Quantity` ['angle']\n            The on-sky separation to search within.\n\n        Returns\n        -------\n        idxsearcharound : int array\n            Indices into ``searcharoundcoords`` that match the\n            corresponding elements of ``idxself``. Shape matches\n            ``idxself``.\n        idxself : int array\n            Indices into ``self`` that match the\n            corresponding elements of ``idxsearcharound``. Shape matches\n            ``idxsearcharound``.\n        sep2d : `~astropy.coordinates.Angle`\n            The on-sky separation between the coordinates. Shape matches\n            ``idxsearcharound`` and ``idxself``.\n        dist3d : `~astropy.units.Quantity` ['length']\n            The 3D distance between the coordinates. Shape matches\n            ``idxsearcharound`` and ``idxself``.\n\n        Notes\n        -----\n        This method requires `SciPy <https://www.scipy.org/>`_ to be\n        installed or it will fail.\n\n        In the current implementation, the return values are always sorted in\n        the same order as the ``searcharoundcoords`` (so ``idxsearcharound`` is\n        in ascending order).  This is considered an implementation detail,\n        though, so it could change in a future release.\n\n        See Also\n        --------\n        astropy.coordinates.search_around_sky\n        SkyCoord.search_around_3d\n        \"\"\"\n        from .matching import search_around_sky\n\n        return search_around_sky(searcharoundcoords, self, seplimit,\n                                 storekdtree='_kdtree_sky')\n\n    def search_around_3d(self, searcharoundcoords, distlimit):\n        \"\"\"\n        Searches for all coordinates in this object around a supplied set of\n        points within a given 3D radius.\n\n        This is intended for use on `~astropy.coordinates.SkyCoord` objects\n        with coordinate arrays, rather than a scalar coordinate.  For a scalar\n        coordinate, it is better to use\n        `~astropy.coordinates.SkyCoord.separation_3d`.\n\n        For more on how to use this (and related) functionality, see the\n        examples in :doc:`astropy:/coordinates/matchsep`.\n\n        Parameters\n        ----------\n        searcharoundcoords : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinates to search around to try to find matching points in\n            this `SkyCoord`. This should be an object with array coordinates,\n            not a scalar coordinate object.\n        distlimit : `~astropy.units.Quantity` ['length']\n            The physical radius to search within.\n\n        Returns\n        -------\n        idxsearcharound : int array\n            Indices into ``searcharoundcoords`` that match the\n            corresponding elements of ``idxself``. Shape matches\n            ``idxself``.\n        idxself : int array\n            Indices into ``self`` that match the\n            corresponding elements of ``idxsearcharound``. Shape matches\n            ``idxsearcharound``.\n        sep2d : `~astropy.coordinates.Angle`\n            The on-sky separation between the coordinates. Shape matches\n            ``idxsearcharound`` and ``idxself``.\n        dist3d : `~astropy.units.Quantity` ['length']\n            The 3D distance between the coordinates. Shape matches\n            ``idxsearcharound`` and ``idxself``.\n\n        Notes\n        -----\n        This method requires `SciPy <https://www.scipy.org/>`_ to be\n        installed or it will fail.\n\n        In the current implementation, the return values are always sorted in\n        the same order as the ``searcharoundcoords`` (so ``idxsearcharound`` is\n        in ascending order).  This is considered an implementation detail,\n        though, so it could change in a future release.\n\n        See Also\n        --------\n        astropy.coordinates.search_around_3d\n        SkyCoord.search_around_sky\n        \"\"\"\n        from .matching import search_around_3d\n\n        return search_around_3d(searcharoundcoords, self, distlimit,\n                                storekdtree='_kdtree_3d')\n\n    def position_angle(self, other):\n        \"\"\"\n        Computes the on-sky position angle (East of North) between this\n        `SkyCoord` and another.\n\n        Parameters\n        ----------\n        other : `SkyCoord`\n            The other coordinate to compute the position angle to.  It is\n            treated as the \"head\" of the vector of the position angle.\n\n        Returns\n        -------\n        pa : `~astropy.coordinates.Angle`\n            The (positive) position angle of the vector pointing from ``self``\n            to ``other``.  If either ``self`` or ``other`` contain arrays, this\n            will be an array following the appropriate `numpy` broadcasting\n            rules.\n\n        Examples\n        --------\n\n        >>> c1 = SkyCoord(0*u.deg, 0*u.deg)\n        >>> c2 = SkyCoord(1*u.deg, 0*u.deg)\n        >>> c1.position_angle(c2).degree\n        90.0\n        >>> c3 = SkyCoord(1*u.deg, 1*u.deg)\n        >>> c1.position_angle(c3).degree  # doctest: +FLOAT_CMP\n        44.995636455344844\n        \"\"\"\n        from . import angle_utilities\n\n        if not self.is_equivalent_frame(other):\n            try:\n                other = other.transform_to(self, merge_attributes=False)\n            except TypeError:\n                raise TypeError('Can only get position_angle to another '\n                                'SkyCoord or a coordinate frame with data')\n\n        slat = self.represent_as(UnitSphericalRepresentation).lat\n        slon = self.represent_as(UnitSphericalRepresentation).lon\n        olat = other.represent_as(UnitSphericalRepresentation).lat\n        olon = other.represent_as(UnitSphericalRepresentation).lon\n\n        return angle_utilities.position_angle(slon, slat, olon, olat)\n\n    def skyoffset_frame(self, rotation=None):\n        \"\"\"\n        Returns the sky offset frame with this `SkyCoord` at the origin.\n\n        Returns\n        -------\n        astrframe : `~astropy.coordinates.SkyOffsetFrame`\n            A sky offset frame of the same type as this `SkyCoord` (e.g., if\n            this object has an ICRS coordinate, the resulting frame is\n            SkyOffsetICRS, with the origin set to this object)\n        rotation : angle-like\n            The final rotation of the frame about the ``origin``. The sign of\n            the rotation is the left-hand rule. That is, an object at a\n            particular position angle in the un-rotated system will be sent to\n            the positive latitude (z) direction in the final frame.\n        \"\"\"\n        return SkyOffsetFrame(origin=self, rotation=rotation)\n\n    def get_constellation(self, short_name=False, constellation_list='iau'):\n        \"\"\"\n        Determines the constellation(s) of the coordinates this `SkyCoord`\n        contains.\n\n        Parameters\n        ----------\n        short_name : bool\n            If True, the returned names are the IAU-sanctioned abbreviated\n            names.  Otherwise, full names for the constellations are used.\n        constellation_list : str\n            The set of constellations to use.  Currently only ``'iau'`` is\n            supported, meaning the 88 \"modern\" constellations endorsed by the IAU.\n\n        Returns\n        -------\n        constellation : str or string array\n            If this is a scalar coordinate, returns the name of the\n            constellation.  If it is an array `SkyCoord`, it returns an array of\n            names.\n\n        Notes\n        -----\n        To determine which constellation a point on the sky is in, this first\n        precesses to B1875, and then uses the Delporte boundaries of the 88\n        modern constellations, as tabulated by\n        `Roman 1987 <http://cdsarc.u-strasbg.fr/viz-bin/Cat?VI/42>`_.\n\n        See Also\n        --------\n        astropy.coordinates.get_constellation\n        \"\"\"\n        from .funcs import get_constellation\n\n        # because of issue #7028, the conversion to a PrecessedGeocentric\n        # system fails in some cases.  Work around is to  drop the velocities.\n        # they are not needed here since only position information is used\n        extra_frameattrs = {nm: getattr(self, nm)\n                            for nm in self._extra_frameattr_names}\n        novel = SkyCoord(self.realize_frame(self.data.without_differentials()),\n                         **extra_frameattrs)\n        return get_constellation(novel, short_name, constellation_list)\n\n        # the simpler version below can be used when gh-issue #7028 is resolved\n        # return get_constellation(self, short_name, constellation_list)\n\n    # WCS pixel to/from sky conversions\n    def to_pixel(self, wcs, origin=0, mode='all'):\n        \"\"\"\n        Convert this coordinate to pixel coordinates using a `~astropy.wcs.WCS`\n        object.\n\n        Parameters\n        ----------\n        wcs : `~astropy.wcs.WCS`\n            The WCS to use for convert\n        origin : int\n            Whether to return 0 or 1-based pixel coordinates.\n        mode : 'all' or 'wcs'\n            Whether to do the transformation including distortions (``'all'``) or\n            only including only the core WCS transformation (``'wcs'``).\n\n        Returns\n        -------\n        xp, yp : `numpy.ndarray`\n            The pixel coordinates\n\n        See Also\n        --------\n        astropy.wcs.utils.skycoord_to_pixel : the implementation of this method\n        \"\"\"\n        from astropy.wcs.utils import skycoord_to_pixel\n        return skycoord_to_pixel(self, wcs=wcs, origin=origin, mode=mode)\n\n    @classmethod\n    def from_pixel(cls, xp, yp, wcs, origin=0, mode='all'):\n        \"\"\"\n        Create a new `SkyCoord` from pixel coordinates using an\n        `~astropy.wcs.WCS` object.\n\n        Parameters\n        ----------\n        xp, yp : float or ndarray\n            The coordinates to convert.\n        wcs : `~astropy.wcs.WCS`\n            The WCS to use for convert\n        origin : int\n            Whether to return 0 or 1-based pixel coordinates.\n        mode : 'all' or 'wcs'\n            Whether to do the transformation including distortions (``'all'``) or\n            only including only the core WCS transformation (``'wcs'``).\n\n        Returns\n        -------\n        coord : `~astropy.coordinates.SkyCoord`\n            A new object with sky coordinates corresponding to the input ``xp``\n            and ``yp``.\n\n        See Also\n        --------\n        to_pixel : to do the inverse operation\n        astropy.wcs.utils.pixel_to_skycoord : the implementation of this method\n        \"\"\"\n        from astropy.wcs.utils import pixel_to_skycoord\n        return pixel_to_skycoord(xp, yp, wcs=wcs, origin=origin, mode=mode, cls=cls)\n\n    def contained_by(self, wcs, image=None, **kwargs):\n        \"\"\"\n        Determines if the SkyCoord is contained in the given wcs footprint.\n\n        Parameters\n        ----------\n        wcs : `~astropy.wcs.WCS`\n            The coordinate to check if it is within the wcs coordinate.\n        image : array\n            Optional.  The image associated with the wcs object that the cooordinate\n            is being checked against. If not given the naxis keywords will be used\n            to determine if the coordinate falls within the wcs footprint.\n        **kwargs :\n           Additional arguments to pass to `~astropy.coordinates.SkyCoord.to_pixel`\n\n        Returns\n        -------\n        response : bool\n           True means the WCS footprint contains the coordinate, False means it does not.\n        \"\"\"\n\n        if image is not None:\n            ymax, xmax = image.shape\n        else:\n            xmax, ymax = wcs._naxis\n\n        import warnings\n        with warnings.catch_warnings():\n            #  Suppress warnings since they just mean we didn't find the coordinate\n            warnings.simplefilter(\"ignore\")\n            try:\n                x, y = self.to_pixel(wcs, **kwargs)\n            except Exception:\n                return False\n\n        return (x < xmax) & (x > 0) & (y < ymax) & (y > 0)\n\n    def radial_velocity_correction(self, kind='barycentric', obstime=None,\n                                   location=None):\n        \"\"\"\n        Compute the correction required to convert a radial velocity at a given\n        time and place on the Earth's Surface to a barycentric or heliocentric\n        velocity.\n\n        Parameters\n        ----------\n        kind : str\n            The kind of velocity correction.  Must be 'barycentric' or\n            'heliocentric'.\n        obstime : `~astropy.time.Time` or None, optional\n            The time at which to compute the correction.  If `None`, the\n            ``obstime`` frame attribute on the `SkyCoord` will be used.\n        location : `~astropy.coordinates.EarthLocation` or None, optional\n            The observer location at which to compute the correction.  If\n            `None`, the  ``location`` frame attribute on the passed-in\n            ``obstime`` will be used, and if that is None, the ``location``\n            frame attribute on the `SkyCoord` will be used.\n\n        Raises\n        ------\n        ValueError\n            If either ``obstime`` or ``location`` are passed in (not ``None``)\n            when the frame attribute is already set on this `SkyCoord`.\n        TypeError\n            If ``obstime`` or ``location`` aren't provided, either as arguments\n            or as frame attributes.\n\n        Returns\n        -------\n        vcorr : `~astropy.units.Quantity` ['speed']\n            The  correction with a positive sign.  I.e., *add* this\n            to an observed radial velocity to get the barycentric (or\n            heliocentric) velocity. If m/s precision or better is needed,\n            see the notes below.\n\n        Notes\n        -----\n        The barycentric correction is calculated to higher precision than the\n        heliocentric correction and includes additional physics (e.g time dilation).\n        Use barycentric corrections if m/s precision is required.\n\n        The algorithm here is sufficient to perform corrections at the mm/s level, but\n        care is needed in application. The barycentric correction returned uses the optical\n        approximation v = z * c. Strictly speaking, the barycentric correction is\n        multiplicative and should be applied as::\n\n          >>> from astropy.time import Time\n          >>> from astropy.coordinates import SkyCoord, EarthLocation\n          >>> from astropy.constants import c\n          >>> t = Time(56370.5, format='mjd', scale='utc')\n          >>> loc = EarthLocation('149d33m00.5s','-30d18m46.385s',236.87*u.m)\n          >>> sc = SkyCoord(1*u.deg, 2*u.deg)\n          >>> vcorr = sc.radial_velocity_correction(kind='barycentric', obstime=t, location=loc)  # doctest: +REMOTE_DATA\n          >>> rv = rv + vcorr + rv * vcorr / c  # doctest: +SKIP\n\n        Also note that this method returns the correction velocity in the so-called\n        *optical convention*::\n\n          >>> vcorr = zb * c  # doctest: +SKIP\n\n        where ``zb`` is the barycentric correction redshift as defined in section 3\n        of Wright & Eastman (2014). The application formula given above follows from their\n        equation (11) under assumption that the radial velocity ``rv`` has also been defined\n        using the same optical convention. Note, this can be regarded as a matter of\n        velocity definition and does not by itself imply any loss of accuracy, provided\n        sufficient care has been taken during interpretation of the results. If you need\n        the barycentric correction expressed as the full relativistic velocity (e.g., to provide\n        it as the input to another software which performs the application), the\n        following recipe can be used::\n\n          >>> zb = vcorr / c  # doctest: +REMOTE_DATA\n          >>> zb_plus_one_squared = (zb + 1) ** 2  # doctest: +REMOTE_DATA\n          >>> vcorr_rel = c * (zb_plus_one_squared - 1) / (zb_plus_one_squared + 1)  # doctest: +REMOTE_DATA\n\n        or alternatively using just equivalencies::\n\n          >>> vcorr_rel = vcorr.to(u.Hz, u.doppler_optical(1*u.Hz)).to(vcorr.unit, u.doppler_relativistic(1*u.Hz))  # doctest: +REMOTE_DATA\n\n        See also `~astropy.units.equivalencies.doppler_optical`,\n        `~astropy.units.equivalencies.doppler_radio`, and\n        `~astropy.units.equivalencies.doppler_relativistic` for more information on\n        the velocity conventions.\n\n        The default is for this method to use the builtin ephemeris for\n        computing the sun and earth location.  Other ephemerides can be chosen\n        by setting the `~astropy.coordinates.solar_system_ephemeris` variable,\n        either directly or via ``with`` statement.  For example, to use the JPL\n        ephemeris, do::\n\n          >>> from astropy.coordinates import solar_system_ephemeris\n          >>> sc = SkyCoord(1*u.deg, 2*u.deg)\n          >>> with solar_system_ephemeris.set('jpl'):  # doctest: +REMOTE_DATA\n          ...     rv += sc.radial_velocity_correction(obstime=t, location=loc)  # doctest: +SKIP\n\n        \"\"\"\n        # has to be here to prevent circular imports\n        from .solar_system import get_body_barycentric_posvel\n\n        # location validation\n        timeloc = getattr(obstime, 'location', None)\n        if location is None:\n            if self.location is not None:\n                location = self.location\n                if timeloc is not None:\n                    raise ValueError('`location` cannot be in both the '\n                                     'passed-in `obstime` and this `SkyCoord` '\n                                     'because it is ambiguous which is meant '\n                                     'for the radial_velocity_correction.')\n            elif timeloc is not None:\n                location = timeloc\n            else:\n                raise TypeError('Must provide a `location` to '\n                                'radial_velocity_correction, either as a '\n                                'SkyCoord frame attribute, as an attribute on '\n                                'the passed in `obstime`, or in the method '\n                                'call.')\n\n        elif self.location is not None or timeloc is not None:\n            raise ValueError('Cannot compute radial velocity correction if '\n                             '`location` argument is passed in and there is '\n                             'also a  `location` attribute on this SkyCoord or '\n                             'the passed-in `obstime`.')\n\n        # obstime validation\n        coo_at_rv_obstime = self  # assume we need no space motion for now\n        if obstime is None:\n            obstime = self.obstime\n            if obstime is None:\n                raise TypeError('Must provide an `obstime` to '\n                                'radial_velocity_correction, either as a '\n                                'SkyCoord frame attribute or in the method '\n                                'call.')\n        elif self.obstime is not None and self.frame.data.differentials:\n            # we do need space motion after all\n            coo_at_rv_obstime = self.apply_space_motion(obstime)\n        elif self.obstime is None:\n            # warn the user if the object has differentials set\n            if 's' in self.data.differentials:\n                warnings.warn(\n                    \"SkyCoord has space motion, and therefore the specified \"\n                    \"position of the SkyCoord may not be the same as \"\n                    \"the `obstime` for the radial velocity measurement. \"\n                    \"This may affect the rv correction at the order of km/s\"\n                    \"for very high proper motions sources. If you wish to \"\n                    \"apply space motion of the SkyCoord to correct for this\"\n                    \"the `obstime` attribute of the SkyCoord must be set\",\n                    AstropyUserWarning\n                )\n\n        pos_earth, v_earth = get_body_barycentric_posvel('earth', obstime)\n        if kind == 'barycentric':\n            v_origin_to_earth = v_earth\n        elif kind == 'heliocentric':\n            v_sun = get_body_barycentric_posvel('sun', obstime)[1]\n            v_origin_to_earth = v_earth - v_sun\n        else:\n            raise ValueError(\"`kind` argument to radial_velocity_correction must \"\n                             \"be 'barycentric' or 'heliocentric', but got \"\n                             \"'{}'\".format(kind))\n\n        gcrs_p, gcrs_v = location.get_gcrs_posvel(obstime)\n        # transforming to GCRS is not the correct thing to do here, since we don't want to\n        # include aberration (or light deflection)? Instead, only apply parallax if necessary\n        icrs_cart = coo_at_rv_obstime.icrs.cartesian\n        icrs_cart_novel = icrs_cart.without_differentials()\n        if self.data.__class__ is UnitSphericalRepresentation:\n            targcart = icrs_cart_novel\n        else:\n            # skycoord has distances so apply parallax\n            obs_icrs_cart = pos_earth + gcrs_p\n            targcart = icrs_cart_novel - obs_icrs_cart\n            targcart /= targcart.norm()\n\n        if kind == 'barycentric':\n            beta_obs = (v_origin_to_earth + gcrs_v) / speed_of_light\n            gamma_obs = 1 / np.sqrt(1 - beta_obs.norm()**2)\n            gr = location.gravitational_redshift(obstime)\n            # barycentric redshift according to eq 28 in Wright & Eastmann (2014),\n            # neglecting Shapiro delay and effects of the star's own motion\n            zb = gamma_obs * (1 + beta_obs.dot(targcart)) / (1 + gr/speed_of_light)\n            # try and get terms corresponding to stellar motion.\n            if icrs_cart.differentials:\n                try:\n                    ro = self.icrs.cartesian\n                    beta_star = ro.differentials['s'].to_cartesian() / speed_of_light\n                    # ICRS unit vector at coordinate epoch\n                    ro = ro.without_differentials()\n                    ro /= ro.norm()\n                    zb *= (1 + beta_star.dot(ro)) / (1 + beta_star.dot(targcart))\n                except u.UnitConversionError:\n                    warnings.warn(\"SkyCoord contains some velocity information, but not enough to \"\n                                  \"calculate the full space motion of the source, and so this has \"\n                                  \"been ignored for the purposes of calculating the radial velocity \"\n                                  \"correction. This can lead to errors on the order of metres/second.\",\n                                  AstropyUserWarning)\n\n            zb = zb - 1\n            return zb * speed_of_light\n        else:\n            # do a simpler correction ignoring time dilation and gravitational redshift\n            # this is adequate since Heliocentric corrections shouldn't be used if\n            # cm/s precision is required.\n            return targcart.dot(v_origin_to_earth + gcrs_v)\n\n    # Table interactions\n    @classmethod\n    def guess_from_table(cls, table, **coord_kwargs):\n        r\"\"\"\n        A convenience method to create and return a new `SkyCoord` from the data\n        in an astropy Table.\n\n        This method matches table columns that start with the case-insensitive\n        names of the the components of the requested frames (including\n        differentials), if they are also followed by a non-alphanumeric\n        character. It will also match columns that *end* with the component name\n        if a non-alphanumeric character is *before* it.\n\n        For example, the first rule means columns with names like\n        ``'RA[J2000]'`` or ``'ra'`` will be interpreted as ``ra`` attributes for\n        `~astropy.coordinates.ICRS` frames, but ``'RAJ2000'`` or ``'radius'``\n        are *not*. Similarly, the second rule applied to the\n        `~astropy.coordinates.Galactic` frame means that a column named\n        ``'gal_l'`` will be used as the the ``l`` component, but ``gall`` or\n        ``'fill'`` will not.\n\n        The definition of alphanumeric here is based on Unicode's definition\n        of alphanumeric, except without ``_`` (which is normally considered\n        alphanumeric).  So for ASCII, this means the non-alphanumeric characters\n        are ``<space>_!\"#$%&'()*+,-./\\:;<=>?@[]^`{|}~``).\n\n        Parameters\n        ----------\n        table : `~astropy.table.Table` or subclass\n            The table to load data from.\n        **coord_kwargs\n            Any additional keyword arguments are passed directly to this class's\n            constructor.\n\n        Returns\n        -------\n        newsc : `~astropy.coordinates.SkyCoord` or subclass\n            The new `SkyCoord` (or subclass) object.\n\n        Raises\n        ------\n        ValueError\n            If more than one match is found in the table for a component,\n            unless the additional matches are also valid frame component names.\n            If a \"coord_kwargs\" is provided for a value also found in the table.\n\n        \"\"\"\n        _frame_cls, _frame_kwargs = _get_frame_without_data([], coord_kwargs)\n        frame = _frame_cls(**_frame_kwargs)\n        coord_kwargs['frame'] = coord_kwargs.get('frame', frame)\n\n        representation_component_names = (\n            set(frame.get_representation_component_names())\n            .union(set(frame.get_representation_component_names(\"s\")))\n        )\n\n        comp_kwargs = {}\n        for comp_name in representation_component_names:\n            # this matches things like 'ra[...]'' but *not* 'rad'.\n            # note that the \"_\" must be in there explicitly, because\n            # \"alphanumeric\" usually includes underscores.\n            starts_with_comp = comp_name + r'(\\W|\\b|_)'\n            # this part matches stuff like 'center_ra', but *not*\n            # 'aura'\n            ends_with_comp = r'.*(\\W|\\b|_)' + comp_name + r'\\b'\n            # the final regex ORs together the two patterns\n            rex = re.compile(rf\"({starts_with_comp})|({ends_with_comp})\",\n                             re.IGNORECASE | re.UNICODE)\n\n            # find all matches\n            matches = {col_name for col_name in table.colnames\n                       if rex.match(col_name)}\n\n            # now need to select among matches, also making sure we don't have\n            # an exact match with another component\n            if len(matches) == 0:  # no matches\n                continue\n            elif len(matches) == 1:  # only one match\n                col_name = matches.pop()\n            else:  # more than 1 match\n                # try to sieve out other components\n                matches -= representation_component_names - {comp_name}\n                # if there's only one remaining match, it worked.\n                if len(matches) == 1:\n                    col_name = matches.pop()\n                else:\n                    raise ValueError(\n                        'Found at least two matches for component '\n                        f'\"{comp_name}\": \"{matches}\". Cannot guess coordinates '\n                        'from a table with this ambiguity.')\n\n            comp_kwargs[comp_name] = table[col_name]\n\n        for k, v in comp_kwargs.items():\n            if k in coord_kwargs:\n                raise ValueError('Found column \"{}\" in table, but it was '\n                                 'already provided as \"{}\" keyword to '\n                                 'guess_from_table function.'.format(v.name, k))\n            else:\n                coord_kwargs[k] = v\n\n        return cls(**coord_kwargs)\n\n    # Name resolve\n    @classmethod\n    def from_name(cls, name, frame='icrs', parse=False, cache=True):\n        \"\"\"\n        Given a name, query the CDS name resolver to attempt to retrieve\n        coordinate information for that object. The search database, sesame\n        url, and  query timeout can be set through configuration items in\n        ``astropy.coordinates.name_resolve`` -- see docstring for\n        `~astropy.coordinates.get_icrs_coordinates` for more\n        information.\n\n        Parameters\n        ----------\n        name : str\n            The name of the object to get coordinates for, e.g. ``'M42'``.\n        frame : str or `BaseCoordinateFrame` class or instance\n            The frame to transform the object to.\n        parse: bool\n            Whether to attempt extracting the coordinates from the name by\n            parsing with a regex. For objects catalog names that have\n            J-coordinates embedded in their names, e.g.,\n            'CRTS SSS100805 J194428-420209', this may be much faster than a\n            Sesame query for the same object name. The coordinates extracted\n            in this way may differ from the database coordinates by a few\n            deci-arcseconds, so only use this option if you do not need\n            sub-arcsecond accuracy for coordinates.\n        cache : bool, optional\n            Determines whether to cache the results or not. To update or\n            overwrite an existing value, pass ``cache='update'``.\n\n        Returns\n        -------\n        coord : SkyCoord\n            Instance of the SkyCoord class.\n        \"\"\"\n\n        from .name_resolve import get_icrs_coordinates\n\n        icrs_coord = get_icrs_coordinates(name, parse, cache=cache)\n        icrs_sky_coord = cls(icrs_coord)\n        if frame in ('icrs', icrs_coord.__class__):\n            return icrs_sky_coord\n        else:\n            return icrs_sky_coord.transform_to(frame)\n"},{"attributeType":"null","col":16,"comment":"null","endLoc":8,"id":14872,"name":"np","nodeType":"Attribute","startLoc":8,"text":"np"},{"col":4,"comment":"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The inverse redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        ","endLoc":2447,"header":"def inv_efunc(self, z)","id":14873,"name":"inv_efunc","nodeType":"Function","startLoc":2427,"text":"def inv_efunc(self, z):\n        r\"\"\"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        E : ndarray or float\n            The inverse redshift scaling of the Hubble constant.\n            Returns `float` if the input is scalar.\n            Defined such that :math:`H(z) = H_0 E(z)`.\n        \"\"\"\n        Or = self._Ogamma0 + (self._Onu0 if not self._massivenu\n                              else self._Ogamma0 * self.nu_relative_density(z))\n        zp1 = aszarr(z) + 1.0  # (converts z [unit] -> z [dimensionless])\n\n        return (zp1 ** 3 * (Or * zp1 + self._Om0) +\n                self._Ode0 * zp1 ** (3. * (1. + self._w0)))**(-0.5)"},{"attributeType":"null","col":29,"comment":"null","endLoc":14,"id":14874,"name":"u","nodeType":"Attribute","startLoc":14,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":14875,"name":"__all__","nodeType":"Attribute","startLoc":18,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":14876,"name":"_MOON_L_R","nodeType":"Attribute","startLoc":22,"text":"_MOON_L_R"},{"className":"GenericFrame","col":0,"comment":"\n    A frame object that can't store data but can hold any arbitrary frame\n    attributes. Mostly useful as a utility for the high-level class to store\n    intermediate frame attributes.\n\n    Parameters\n    ----------\n    frame_attrs : dict\n        A dictionary of attributes to be used as the frame attributes for this\n        frame.\n    ","endLoc":1890,"id":14877,"nodeType":"Class","startLoc":1857,"text":"class GenericFrame(BaseCoordinateFrame):\n    \"\"\"\n    A frame object that can't store data but can hold any arbitrary frame\n    attributes. Mostly useful as a utility for the high-level class to store\n    intermediate frame attributes.\n\n    Parameters\n    ----------\n    frame_attrs : dict\n        A dictionary of attributes to be used as the frame attributes for this\n        frame.\n    \"\"\"\n\n    name = None  # it's not a \"real\" frame so it doesn't have a name\n\n    def __init__(self, frame_attrs):\n        self.frame_attributes = {}\n        for name, default in frame_attrs.items():\n            self.frame_attributes[name] = Attribute(default)\n            setattr(self, '_' + name, default)\n\n        super().__init__(None)\n\n    def __getattr__(self, name):\n        if '_' + name in self.__dict__:\n            return getattr(self, '_' + name)\n        else:\n            raise AttributeError(f'no {name}')\n\n    def __setattr__(self, name, value):\n        if name in self.get_frame_attr_names():\n            raise AttributeError(f\"can't set frame attribute '{name}'\")\n        else:\n            super().__setattr__(name, value)"},{"col":4,"comment":"null","endLoc":1884,"header":"def __getattr__(self, name)","id":14878,"name":"__getattr__","nodeType":"Function","startLoc":1880,"text":"def __getattr__(self, name):\n        if '_' + name in self.__dict__:\n            return getattr(self, '_' + name)\n        else:\n            raise AttributeError(f'no {name}')"},{"col":4,"comment":"null","endLoc":1890,"header":"def __setattr__(self, name, value)","id":14879,"name":"__setattr__","nodeType":"Function","startLoc":1886,"text":"def __setattr__(self, name, value):\n        if name in self.get_frame_attr_names():\n            raise AttributeError(f\"can't set frame attribute '{name}'\")\n        else:\n            super().__setattr__(name, value)"},{"attributeType":"null","col":4,"comment":"null","endLoc":485,"id":14880,"name":"_is_bool","nodeType":"Attribute","startLoc":485,"text":"_is_bool"},{"attributeType":"null","col":12,"comment":"null","endLoc":2399,"id":14881,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":2399,"text":"self._inv_efunc_scalar"},{"attributeType":"null","col":0,"comment":"\nCoefficients of polynomials for various terms:\n\nLc : Mean longitude of Moon, w.r.t mean Equinox of date\nD : Mean elongation of the Moon\nM: Sun's mean anomaly\nMc : Moon's mean anomaly\nF : Moon's argument of latitude (mean distance of Moon from its ascending node).\n","endLoc":87,"id":14882,"name":"_MOON_B","nodeType":"Attribute","startLoc":87,"text":"_MOON_B"},{"attributeType":"null","col":8,"comment":"null","endLoc":489,"id":14883,"name":"_default_size","nodeType":"Attribute","startLoc":489,"text":"self._default_size"},{"attributeType":"null","col":4,"comment":"null","endLoc":99,"id":14884,"name":"_equivalent_unit","nodeType":"Attribute","startLoc":99,"text":"_equivalent_unit"},{"attributeType":"Trapezoid1D","col":8,"comment":"null","endLoc":488,"id":14885,"name":"_model","nodeType":"Attribute","startLoc":488,"text":"self._model"},{"attributeType":"null","col":4,"comment":"null","endLoc":1870,"id":14886,"name":"name","nodeType":"Attribute","startLoc":1870,"text":"name"},{"attributeType":"null","col":8,"comment":"null","endLoc":491,"id":14887,"name":"_truncation","nodeType":"Attribute","startLoc":491,"text":"self._truncation"},{"attributeType":"null","col":8,"comment":"null","endLoc":1873,"id":14888,"name":"frame_attributes","nodeType":"Attribute","startLoc":1873,"text":"self.frame_attributes"},{"attributeType":"null","col":4,"comment":"null","endLoc":100,"id":14889,"name":"_include_easy_conversion_members","nodeType":"Attribute","startLoc":100,"text":"_include_easy_conversion_members"},{"className":"TrapezoidDisk2DKernel","col":0,"comment":"\n    2D trapezoid kernel.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    radius : number\n        Width of the filter kernel, defined as the width of the constant part,\n        before it begins to slope down.\n    slope : number\n        Slope of the filter kernel's tails\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, Tophat2DKernel, RickerWavelet2DKernel,\n    Ring2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import TrapezoidDisk2DKernel\n        trapezoid_2D_kernel = TrapezoidDisk2DKernel(20, slope=0.2)\n        plt.imshow(trapezoid_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n\n    ","endLoc":554,"id":14890,"nodeType":"Class","startLoc":495,"text":"class TrapezoidDisk2DKernel(Kernel2D):\n    \"\"\"\n    2D trapezoid kernel.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    radius : number\n        Width of the filter kernel, defined as the width of the constant part,\n        before it begins to slope down.\n    slope : number\n        Slope of the filter kernel's tails\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, Tophat2DKernel, RickerWavelet2DKernel,\n    Ring2DKernel, AiryDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import TrapezoidDisk2DKernel\n        trapezoid_2D_kernel = TrapezoidDisk2DKernel(20, slope=0.2)\n        plt.imshow(trapezoid_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n\n    \"\"\"\n    _is_bool = False\n\n    def __init__(self, radius, slope=1., **kwargs):\n        self._model = models.TrapezoidDisk2D(1, 0, 0, radius, slope)\n        self._default_size = _round_up_to_odd_integer(2 * radius + 2. / slope)\n        super().__init__(**kwargs)\n        self._truncation = 0\n        self.normalize()"},{"attributeType":"null","col":16,"comment":"null","endLoc":147,"id":14891,"name":"unit","nodeType":"Attribute","startLoc":147,"text":"unit"},{"col":4,"comment":"null","endLoc":554,"header":"def __init__(self, radius, slope=1., **kwargs)","id":14892,"name":"__init__","nodeType":"Function","startLoc":549,"text":"def __init__(self, radius, slope=1., **kwargs):\n        self._model = models.TrapezoidDisk2D(1, 0, 0, radius, slope)\n        self._default_size = _round_up_to_odd_integer(2 * radius + 2. / slope)\n        super().__init__(**kwargs)\n        self._truncation = 0\n        self.normalize()"},{"className":"SkyOffsetFrame","col":0,"comment":"\n    A frame which is relative to some specific position and oriented to match\n    its frame.\n\n    SkyOffsetFrames always have component names for spherical coordinates\n    of ``lon``/``lat``, *not* the component names for the frame of ``origin``.\n\n    This is useful for calculating offsets and dithers in the frame of the sky\n    relative to an arbitrary position. Coordinates in this frame are both centered on the position specified by the\n    ``origin`` coordinate, *and* they are oriented in the same manner as the\n    ``origin`` frame.  E.g., if ``origin`` is `~astropy.coordinates.ICRS`, this\n    object's ``lat`` will be pointed in the direction of Dec, while ``lon``\n    will point in the direction of RA.\n\n    For more on skyoffset frames, see :ref:`astropy:astropy-skyoffset-frames`.\n\n    Parameters\n    ----------\n    representation : `~astropy.coordinates.BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n    origin : coordinate-like\n        The coordinate which specifies the origin of this frame. Note that this\n        origin is used purely for on-sky location/rotation.  It can have a\n        ``distance`` but it will not be used by this ``SkyOffsetFrame``.\n    rotation : angle-like\n        The final rotation of the frame about the ``origin``. The sign of\n        the rotation is the left-hand rule.  That is, an object at a\n        particular position angle in the un-rotated system will be sent to\n        the positive latitude (z) direction in the final frame.\n\n\n    Notes\n    -----\n    ``SkyOffsetFrame`` is a factory class.  That is, the objects that it\n    yields are *not* actually objects of class ``SkyOffsetFrame``.  Instead,\n    distinct classes are created on-the-fly for whatever the frame class is\n    of ``origin``.\n    ","endLoc":179,"id":14893,"nodeType":"Class","startLoc":93,"text":"class SkyOffsetFrame(BaseCoordinateFrame):\n    \"\"\"\n    A frame which is relative to some specific position and oriented to match\n    its frame.\n\n    SkyOffsetFrames always have component names for spherical coordinates\n    of ``lon``/``lat``, *not* the component names for the frame of ``origin``.\n\n    This is useful for calculating offsets and dithers in the frame of the sky\n    relative to an arbitrary position. Coordinates in this frame are both centered on the position specified by the\n    ``origin`` coordinate, *and* they are oriented in the same manner as the\n    ``origin`` frame.  E.g., if ``origin`` is `~astropy.coordinates.ICRS`, this\n    object's ``lat`` will be pointed in the direction of Dec, while ``lon``\n    will point in the direction of RA.\n\n    For more on skyoffset frames, see :ref:`astropy:astropy-skyoffset-frames`.\n\n    Parameters\n    ----------\n    representation : `~astropy.coordinates.BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n    origin : coordinate-like\n        The coordinate which specifies the origin of this frame. Note that this\n        origin is used purely for on-sky location/rotation.  It can have a\n        ``distance`` but it will not be used by this ``SkyOffsetFrame``.\n    rotation : angle-like\n        The final rotation of the frame about the ``origin``. The sign of\n        the rotation is the left-hand rule.  That is, an object at a\n        particular position angle in the un-rotated system will be sent to\n        the positive latitude (z) direction in the final frame.\n\n\n    Notes\n    -----\n    ``SkyOffsetFrame`` is a factory class.  That is, the objects that it\n    yields are *not* actually objects of class ``SkyOffsetFrame``.  Instead,\n    distinct classes are created on-the-fly for whatever the frame class is\n    of ``origin``.\n    \"\"\"\n\n    rotation = QuantityAttribute(default=0, unit=u.deg)\n    origin = CoordinateAttribute(default=None, frame=None)\n\n    def __new__(cls, *args, **kwargs):\n        # We don't want to call this method if we've already set up\n        # an skyoffset frame for this class.\n        if not (issubclass(cls, SkyOffsetFrame) and cls is not SkyOffsetFrame):\n            # We get the origin argument, and handle it here.\n            try:\n                origin_frame = kwargs['origin']\n            except KeyError:\n                raise TypeError(\"Can't initialize an SkyOffsetFrame without origin= keyword.\")\n            if hasattr(origin_frame, 'frame'):\n                origin_frame = origin_frame.frame\n            newcls = make_skyoffset_cls(origin_frame.__class__)\n            return newcls.__new__(newcls, *args, **kwargs)\n\n        # http://stackoverflow.com/questions/19277399/why-does-object-new-work-differently-in-these-three-cases\n        # See above for why this is necessary. Basically, because some child\n        # may override __new__, we must override it here to never pass\n        # arguments to the object.__new__ method.\n        if super().__new__ is object.__new__:\n            return super().__new__(cls)\n        return super().__new__(cls, *args, **kwargs)\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        if self.origin is not None and not self.origin.has_data:\n            raise ValueError('The origin supplied to SkyOffsetFrame has no '\n                             'data.')\n        if self.has_data:\n            self._set_skyoffset_data_lon_wrap_angle(self.data)\n\n    @staticmethod\n    def _set_skyoffset_data_lon_wrap_angle(data):\n        if hasattr(data, 'lon'):\n            data.lon.wrap_angle = 180. * u.deg\n        return data\n\n    def represent_as(self, base, s='base', in_frame_units=False):\n        \"\"\"\n        Ensure the wrap angle for any spherical\n        representations.\n        \"\"\"\n        data = super().represent_as(base, s, in_frame_units=in_frame_units)\n        self._set_skyoffset_data_lon_wrap_angle(data)\n        return data"},{"attributeType":"Quantity","col":8,"comment":"null","endLoc":167,"id":14894,"name":"distance","nodeType":"Attribute","startLoc":167,"text":"distance"},{"col":4,"comment":"null","endLoc":156,"header":"def __new__(cls, *args, **kwargs)","id":14895,"name":"__new__","nodeType":"Function","startLoc":136,"text":"def __new__(cls, *args, **kwargs):\n        # We don't want to call this method if we've already set up\n        # an skyoffset frame for this class.\n        if not (issubclass(cls, SkyOffsetFrame) and cls is not SkyOffsetFrame):\n            # We get the origin argument, and handle it here.\n            try:\n                origin_frame = kwargs['origin']\n            except KeyError:\n                raise TypeError(\"Can't initialize an SkyOffsetFrame without origin= keyword.\")\n            if hasattr(origin_frame, 'frame'):\n                origin_frame = origin_frame.frame\n            newcls = make_skyoffset_cls(origin_frame.__class__)\n            return newcls.__new__(newcls, *args, **kwargs)\n\n        # http://stackoverflow.com/questions/19277399/why-does-object-new-work-differently-in-these-three-cases\n        # See above for why this is necessary. Basically, because some child\n        # may override __new__, we must override it here to never pass\n        # arguments to the object.__new__ method.\n        if super().__new__ is object.__new__:\n            return super().__new__(cls)\n        return super().__new__(cls, *args, **kwargs)"},{"col":0,"comment":"\n    Create a new class that is the sky offset frame for a specific class of\n    origin frame. If such a class has already been created for this frame, the\n    same class will be returned.\n\n    The new class will always have component names for spherical coordinates of\n    ``lon``/``lat``.\n\n    Parameters\n    ----------\n    framecls : `~astropy.coordinates.BaseCoordinateFrame` subclass\n        The class to create the SkyOffsetFrame of.\n\n    Returns\n    -------\n    skyoffsetframecls : class\n        The class for the new skyoffset frame.\n\n    Notes\n    -----\n    This function is necessary because Astropy's frame transformations depend\n    on connection between specific frame *classes*.  So each type of frame\n    needs its own distinct skyoffset frame class.  This function generates\n    just that class, as well as ensuring that only one example of such a class\n    actually gets created in any given python session.\n    ","endLoc":90,"header":"def make_skyoffset_cls(framecls)","id":14896,"name":"make_skyoffset_cls","nodeType":"Function","startLoc":15,"text":"def make_skyoffset_cls(framecls):\n    \"\"\"\n    Create a new class that is the sky offset frame for a specific class of\n    origin frame. If such a class has already been created for this frame, the\n    same class will be returned.\n\n    The new class will always have component names for spherical coordinates of\n    ``lon``/``lat``.\n\n    Parameters\n    ----------\n    framecls : `~astropy.coordinates.BaseCoordinateFrame` subclass\n        The class to create the SkyOffsetFrame of.\n\n    Returns\n    -------\n    skyoffsetframecls : class\n        The class for the new skyoffset frame.\n\n    Notes\n    -----\n    This function is necessary because Astropy's frame transformations depend\n    on connection between specific frame *classes*.  So each type of frame\n    needs its own distinct skyoffset frame class.  This function generates\n    just that class, as well as ensuring that only one example of such a class\n    actually gets created in any given python session.\n    \"\"\"\n\n    if framecls in _skyoffset_cache:\n        return _skyoffset_cache[framecls]\n\n    # Create a new SkyOffsetFrame subclass for this frame class.\n    name = 'SkyOffset' + framecls.__name__\n    _SkyOffsetFramecls = type(\n        name, (SkyOffsetFrame, framecls),\n        {'origin': CoordinateAttribute(frame=framecls, default=None),\n         # The following two have to be done because otherwise we use the\n         # defaults of SkyOffsetFrame set by BaseCoordinateFrame.\n         '_default_representation': framecls._default_representation,\n         '_default_differential': framecls._default_differential,\n         '__doc__': SkyOffsetFrame.__doc__,\n         })\n\n    @frame_transform_graph.transform(FunctionTransform, _SkyOffsetFramecls, _SkyOffsetFramecls)\n    def skyoffset_to_skyoffset(from_skyoffset_coord, to_skyoffset_frame):\n        \"\"\"Transform between two skyoffset frames.\"\"\"\n\n        # This transform goes through the parent frames on each side.\n        # from_frame -> from_frame.origin -> to_frame.origin -> to_frame\n        intermediate_from = from_skyoffset_coord.transform_to(from_skyoffset_coord.origin)\n        intermediate_to = intermediate_from.transform_to(to_skyoffset_frame.origin)\n        return intermediate_to.transform_to(to_skyoffset_frame)\n\n    @frame_transform_graph.transform(DynamicMatrixTransform, framecls, _SkyOffsetFramecls)\n    def reference_to_skyoffset(reference_frame, skyoffset_frame):\n        \"\"\"Convert a reference coordinate to an sky offset frame.\"\"\"\n\n        # Define rotation matrices along the position angle vector, and\n        # relative to the origin.\n        origin = skyoffset_frame.origin.spherical\n        mat1 = rotation_matrix(-skyoffset_frame.rotation, 'x')\n        mat2 = rotation_matrix(-origin.lat, 'y')\n        mat3 = rotation_matrix(origin.lon, 'z')\n        return matrix_product(mat1, mat2, mat3)\n\n    @frame_transform_graph.transform(DynamicMatrixTransform, _SkyOffsetFramecls, framecls)\n    def skyoffset_to_reference(skyoffset_coord, reference_frame):\n        \"\"\"Convert an sky offset frame coordinate to the reference frame\"\"\"\n\n        # use the forward transform, but just invert it\n        R = reference_to_skyoffset(reference_frame, skyoffset_coord)\n        # transpose is the inverse because R is a rotation matrix\n        return matrix_transpose(R)\n\n    _skyoffset_cache[framecls] = _SkyOffsetFramecls\n    return _SkyOffsetFramecls"},{"attributeType":"null","col":12,"comment":"null","endLoc":117,"id":14897,"name":"copy","nodeType":"Attribute","startLoc":117,"text":"copy"},{"attributeType":"Cosmology | None","col":16,"comment":"null","endLoc":122,"id":14898,"name":"cosmology","nodeType":"Attribute","startLoc":122,"text":"cosmology"},{"attributeType":"null","col":0,"comment":"null","endLoc":160,"id":14899,"name":"_coLc","nodeType":"Attribute","startLoc":160,"text":"_coLc"},{"attributeType":"null","col":0,"comment":"null","endLoc":162,"id":14900,"name":"_coD","nodeType":"Attribute","startLoc":162,"text":"_coD"},{"attributeType":"null","col":12,"comment":"null","endLoc":2400,"id":14901,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":2400,"text":"self._inv_efunc_scalar_args"},{"attributeType":"null","col":0,"comment":"null","endLoc":164,"id":14902,"name":"_coM","nodeType":"Attribute","startLoc":164,"text":"_coM"},{"attributeType":"null","col":0,"comment":"null","endLoc":166,"id":14903,"name":"_coMc","nodeType":"Attribute","startLoc":166,"text":"_coMc"},{"attributeType":"null","col":0,"comment":"null","endLoc":168,"id":14904,"name":"_coF","nodeType":"Attribute","startLoc":168,"text":"_coF"},{"attributeType":"null","col":0,"comment":"null","endLoc":170,"id":14905,"name":"_coA1","nodeType":"Attribute","startLoc":170,"text":"_coA1"},{"attributeType":"null","col":0,"comment":"null","endLoc":171,"id":14906,"name":"_coA2","nodeType":"Attribute","startLoc":171,"text":"_coA2"},{"attributeType":"null","col":0,"comment":"null","endLoc":172,"id":14907,"name":"_coA3","nodeType":"Attribute","startLoc":172,"text":"_coA3"},{"attributeType":"null","col":0,"comment":"null","endLoc":173,"id":14908,"name":"_coE","nodeType":"Attribute","startLoc":173,"text":"_coE"},{"col":0,"comment":"","endLoc":6,"header":"orbital_elements.py#<anonymous>","id":14909,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module contains convenience functions implementing some of the\nalgorithms contained within Jean Meeus, 'Astronomical Algorithms',\nsecond edition, 1998, Willmann-Bell.\n\"\"\"\n\n__all__ = [\"calc_moon\"]\n\n_MOON_L_R = (\n    (0, 0, 1, 0, 6288774, -20905355),\n    (2, 0, -1, 0, 1274027, -3699111),\n    (2, 0, 0, 0, 658314, -2955968),\n    (0, 0, 2, 0, 213618, -569925),\n    (0, 1, 0, 0, -185116, 48888),\n    (0, 0, 0, 2, -114332, -3149),\n    (2, 0, -2, 0, 58793, 246158),\n    (2, -1, -1, 0, 57066, -152138),\n    (2, 0, 1, 0, 53322, -170733),\n    (2, -1, 0, 0, 45758, -204586),\n    (0, 1, -1, 0, -40923, -129620),\n    (1, 0, 0, 0, -34720, 108743),\n    (0, 1, 1, 0, -30383, 104755),\n    (2, 0, 0, -2, 15327, 10321),\n    (0, 0, 1, 2, -12528, 0),\n    (0, 0, 1, -2, 10980, 79661),\n    (4, 0, -1, 0, 10675, -34782),\n    (0, 0, 3, 0, 10034, -23210),\n    (4, 0, -2, 0, 8548, -21636),\n    (2, 1, -1, 0, -7888, 24208),\n    (2, 1, 0, 0, -6766, 30824),\n    (1, 0, -1, 0, -5163, -8379),\n    (1, 1, 0, 0, 4987, -16675),\n    (2, -1, 1, 0, 4036, -12831),\n    (2, 0, 2, 0, 3994, -10445),\n    (4, 0, 0, 0, 3861, -11650),\n    (2, 0, -3, 0, 3665, 14403),\n    (0, 1, -2, 0, -2689, -7003),\n    (2, 0, -1, 2, -2602, 0),\n    (2, -1, -2, 0, 2390, 10056),\n    (1, 0, 1, 0, -2348, 6322),\n    (2, -2, 0, 0, 2236, -9884),\n    (0, 1, 2, 0, -2120, 5751),\n    (0, 2, 0, 0, -2069, 0),\n    (2, -2, -1, 0, 2048, -4950),\n    (2, 0, 1, -2, -1773, 4130),\n    (2, 0, 0, 2, -1595, 0),\n    (4, -1, -1, 0, 1215, -3958),\n    (0, 0, 2, 2, -1110, 0),\n    (3, 0, -1, 0, -892, 3258),\n    (2, 1, 1, 0, -810, 2616),\n    (4, -1, -2, 0, 759, -1897),\n    (0, 2, -1, 0, -713, -2117),\n    (2, 2, -1, 0, -700, 2354),\n    (2, 1, -2, 0, 691, 0),\n    (2, -1, 0, -2, 596, 0),\n    (4, 0, 1, 0, 549, -1423),\n    (0, 0, 4, 0, 537, -1117),\n    (4, -1, 0, 0, 520, -1571),\n    (1, 0, -2, 0, -487, -1739),\n    (2, 1, 0, -2, -399, 0),\n    (0, 0, 2, -2, -381, -4421),\n    (1, 1, 1, 0, 351, 0),\n    (3, 0, -2, 0, -340, 0),\n    (4, 0, -3, 0, 330, 0),\n    (2, -1, 2, 0, 327, 0),\n    (0, 2, 1, 0, -323, 1165),\n    (1, 1, -1, 0, 299, 0),\n    (2, 0, 3, 0, 294, 0),\n    (2, 0, -1, -2, 0, 8752)\n)\n\n_MOON_B = (\n    (0, 0, 0, 1, 5128122),\n    (0, 0, 1, 1, 280602),\n    (0, 0, 1, -1, 277693),\n    (2, 0, 0, -1, 173237),\n    (2, 0, -1, 1, 55413),\n    (2, 0, -1, -1, 46271),\n    (2, 0, 0, 1, 32573),\n    (0, 0, 2, 1, 17198),\n    (2, 0, 1, -1, 9266),\n    (0, 0, 2, -1, 8822),\n    (2, -1, 0, -1, 8216),\n    (2, 0, -2, -1, 4324),\n    (2, 0, 1, 1, 4200),\n    (2, 1, 0, -1, -3359),\n    (2, -1, -1, 1, 2463),\n    (2, -1, 0, 1, 2211),\n    (2, -1, -1, -1, 2065),\n    (0, 1, -1, -1, -1870),\n    (4, 0, -1, -1, 1828),\n    (0, 1, 0, 1, -1794),\n    (0, 0, 0, 3, -1749),\n    (0, 1, -1, 1, -1565),\n    (1, 0, 0, 1, -1491),\n    (0, 1, 1, 1, -1475),\n    (0, 1, 1, -1, -1410),\n    (0, 1, 0, -1, -1344),\n    (1, 0, 0, -1, -1335),\n    (0, 0, 3, 1, 1107),\n    (4, 0, 0, -1, 1021),\n    (4, 0, -1, 1, 833),\n    # second column\n    (0, 0, 1, -3, 777),\n    (4, 0, -2, 1, 671),\n    (2, 0, 0, -3, 607),\n    (2, 0, 2, -1, 596),\n    (2, -1, 1, -1, 491),\n    (2, 0, -2, 1, -451),\n    (0, 0, 3, -1, 439),\n    (2, 0, 2, 1, 422),\n    (2, 0, -3, -1, 421),\n    (2, 1, -1, 1, -366),\n    (2, 1, 0, 1, -351),\n    (4, 0, 0, 1, 331),\n    (2, -1, 1, 1, 315),\n    (2, -2, 0, -1, 302),\n    (0, 0, 1, 3, -283),\n    (2, 1, 1, -1, -229),\n    (1, 1, 0, -1, 223),\n    (1, 1, 0, 1, 223),\n    (0, 1, -2, -1, -220),\n    (2, 1, -1, -1, -220),\n    (1, 0, 1, 1, -185),\n    (2, -1, -2, -1, 181),\n    (0, 1, 2, 1, -177),\n    (4, 0, -2, -1, 176),\n    (4, -1, -1, -1, 166),\n    (1, 0, 1, -1, -164),\n    (4, 0, 1, -1, 132),\n    (1, 0, -1, -1, -119),\n    (4, -1, 0, -1, 115),\n    (2, -2, 0, 1, 107)\n)\n\n\"\"\"\nCoefficients of polynomials for various terms:\n\nLc : Mean longitude of Moon, w.r.t mean Equinox of date\nD : Mean elongation of the Moon\nM: Sun's mean anomaly\nMc : Moon's mean anomaly\nF : Moon's argument of latitude (mean distance of Moon from its ascending node).\n\"\"\"\n\n_coLc = (2.18316448e+02, 4.81267881e+05, -1.57860000e-03,\n         1.85583502e-06, -1.53388349e-08)\n\n_coD = (2.97850192e+02, 4.45267111e+05, -1.88190000e-03,\n        1.83194472e-06, -8.84447000e-09)\n\n_coM = (3.57529109e+02, 3.59990503e+04, -1.53600000e-04,\n        4.08329931e-08)\n\n_coMc = (1.34963396e+02, 4.77198868e+05, 8.74140000e-03,\n         1.43474081e-05, -6.79717238e-08)\n\n_coF = (9.32720950e+01, 4.83202018e+05, -3.65390000e-03,\n        -2.83607487e-07, 1.15833246e-09)\n\n_coA1 = (119.75, 131.849)\n\n_coA2 = (53.09, 479264.290)\n\n_coA3 = (313.45, 481266.484)\n\n_coE = (1.0, -0.002516, -0.0000074)"},{"attributeType":"null","col":8,"comment":"null","endLoc":106,"id":14910,"name":"n_not_none","nodeType":"Attribute","startLoc":106,"text":"n_not_none"},{"attributeType":"null","col":12,"comment":"null","endLoc":148,"id":14911,"name":"value","nodeType":"Attribute","startLoc":148,"text":"value"},{"className":"TransformGraph","col":0,"comment":"\n    A graph representing the paths between coordinate frames.\n    ","endLoc":762,"id":14912,"nodeType":"Class","startLoc":76,"text":"class TransformGraph:\n    \"\"\"\n    A graph representing the paths between coordinate frames.\n    \"\"\"\n\n    def __init__(self):\n        self._graph = defaultdict(dict)\n        self.invalidate_cache()  # generates cache entries\n\n    @property\n    def _cached_names(self):\n        if self._cached_names_dct is None:\n            self._cached_names_dct = dct = {}\n            for c in self.frame_set:\n                nm = getattr(c, 'name', None)\n                if nm is not None:\n                    if not isinstance(nm, list):\n                        nm = [nm]\n                    for name in nm:\n                        dct[name] = c\n\n        return self._cached_names_dct\n\n    @property\n    def frame_set(self):\n        \"\"\"\n        A `set` of all the frame classes present in this `TransformGraph`.\n        \"\"\"\n        if self._cached_frame_set is None:\n            self._cached_frame_set = set()\n            for a in self._graph:\n                self._cached_frame_set.add(a)\n                for b in self._graph[a]:\n                    self._cached_frame_set.add(b)\n\n        return self._cached_frame_set.copy()\n\n    @property\n    def frame_attributes(self):\n        \"\"\"\n        A `dict` of all the attributes of all frame classes in this\n        `TransformGraph`.\n        \"\"\"\n        if self._cached_frame_attributes is None:\n            self._cached_frame_attributes = frame_attrs_from_set(self.frame_set)\n\n        return self._cached_frame_attributes\n\n    @property\n    def frame_component_names(self):\n        \"\"\"\n        A `set` of all component names every defined within any frame class in\n        this `TransformGraph`.\n        \"\"\"\n        if self._cached_component_names is None:\n            self._cached_component_names = frame_comps_from_set(self.frame_set)\n\n        return self._cached_component_names\n\n    def invalidate_cache(self):\n        \"\"\"\n        Invalidates the cache that stores optimizations for traversing the\n        transform graph.  This is called automatically when transforms\n        are added or removed, but will need to be called manually if\n        weights on transforms are modified inplace.\n        \"\"\"\n        self._cached_names_dct = None\n        self._cached_frame_set = None\n        self._cached_frame_attributes = None\n        self._cached_component_names = None\n        self._shortestpaths = {}\n        self._composite_cache = {}\n\n    def add_transform(self, fromsys, tosys, transform):\n        \"\"\"\n        Add a new coordinate transformation to the graph.\n\n        Parameters\n        ----------\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform into.\n        transform : `CoordinateTransform`\n            The transformation object. Typically a `CoordinateTransform` object,\n            although it may be some other callable that is called with the same\n            signature.\n\n        Raises\n        ------\n        TypeError\n            If ``fromsys`` or ``tosys`` are not classes or ``transform`` is\n            not callable.\n        \"\"\"\n\n        if not inspect.isclass(fromsys):\n            raise TypeError('fromsys must be a class')\n        if not inspect.isclass(tosys):\n            raise TypeError('tosys must be a class')\n        if not callable(transform):\n            raise TypeError('transform must be callable')\n\n        frame_set = self.frame_set.copy()\n        frame_set.add(fromsys)\n        frame_set.add(tosys)\n\n        # Now we check to see if any attributes on the proposed frames override\n        # *any* component names, which we can't allow for some of the logic in\n        # the SkyCoord initializer to work\n        attrs = set(frame_attrs_from_set(frame_set).keys())\n        comps = frame_comps_from_set(frame_set)\n\n        invalid_attrs = attrs.intersection(comps)\n        if invalid_attrs:\n            invalid_frames = set()\n            for attr in invalid_attrs:\n                if attr in fromsys.frame_attributes:\n                    invalid_frames.update([fromsys])\n\n                if attr in tosys.frame_attributes:\n                    invalid_frames.update([tosys])\n\n            raise ValueError(\"Frame(s) {} contain invalid attribute names: {}\"\n                             \"\\nFrame attributes can not conflict with *any* of\"\n                             \" the frame data component names (see\"\n                             \" `frame_transform_graph.frame_component_names`).\"\n                             .format(list(invalid_frames), invalid_attrs))\n\n        self._graph[fromsys][tosys] = transform\n        self.invalidate_cache()\n\n    def remove_transform(self, fromsys, tosys, transform):\n        \"\"\"\n        Removes a coordinate transform from the graph.\n\n        Parameters\n        ----------\n        fromsys : class or None\n            The coordinate frame *class* to start from. If `None`,\n            ``transform`` will be searched for and removed (``tosys`` must\n            also be `None`).\n        tosys : class or None\n            The coordinate frame *class* to transform into. If `None`,\n            ``transform`` will be searched for and removed (``fromsys`` must\n            also be `None`).\n        transform : callable or None\n            The transformation object to be removed or `None`.  If `None`\n            and ``tosys`` and ``fromsys`` are supplied, there will be no\n            check to ensure the correct object is removed.\n        \"\"\"\n        if fromsys is None or tosys is None:\n            if not (tosys is None and fromsys is None):\n                raise ValueError('fromsys and tosys must both be None if either are')\n            if transform is None:\n                raise ValueError('cannot give all Nones to remove_transform')\n\n            # search for the requested transform by brute force and remove it\n            for a in self._graph:\n                agraph = self._graph[a]\n                for b in agraph:\n                    if agraph[b] is transform:\n                        del agraph[b]\n                        fromsys = a\n                        break\n\n                # If the transform was found, need to break out of the outer for loop too\n                if fromsys:\n                    break\n            else:\n                raise ValueError(f'Could not find transform {transform} in the graph')\n\n        else:\n            if transform is None:\n                self._graph[fromsys].pop(tosys, None)\n            else:\n                curr = self._graph[fromsys].get(tosys, None)\n                if curr is transform:\n                    self._graph[fromsys].pop(tosys)\n                else:\n                    raise ValueError('Current transform from {} to {} is not '\n                                     '{}'.format(fromsys, tosys, transform))\n\n        # Remove the subgraph if it is now empty\n        if self._graph[fromsys] == {}:\n            self._graph.pop(fromsys)\n\n        self.invalidate_cache()\n\n    def find_shortest_path(self, fromsys, tosys):\n        \"\"\"\n        Computes the shortest distance along the transform graph from\n        one system to another.\n\n        Parameters\n        ----------\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform into.\n\n        Returns\n        -------\n        path : list of class or None\n            The path from ``fromsys`` to ``tosys`` as an in-order sequence\n            of classes.  This list includes *both* ``fromsys`` and\n            ``tosys``. Is `None` if there is no possible path.\n        distance : float or int\n            The total distance/priority from ``fromsys`` to ``tosys``.  If\n            priorities are not set this is the number of transforms\n            needed. Is ``inf`` if there is no possible path.\n        \"\"\"\n\n        inf = float('inf')\n\n        # special-case the 0 or 1-path\n        if tosys is fromsys:\n            if tosys not in self._graph[fromsys]:\n                # Means there's no transform necessary to go from it to itself.\n                return [tosys], 0\n        if tosys in self._graph[fromsys]:\n            # this will also catch the case where tosys is fromsys, but has\n            # a defined transform.\n            t = self._graph[fromsys][tosys]\n            return [fromsys, tosys], float(t.priority if hasattr(t, 'priority') else 1)\n\n        # otherwise, need to construct the path:\n\n        if fromsys in self._shortestpaths:\n            # already have a cached result\n            fpaths = self._shortestpaths[fromsys]\n            if tosys in fpaths:\n                return fpaths[tosys]\n            else:\n                return None, inf\n\n        # use Dijkstra's algorithm to find shortest path in all other cases\n\n        nodes = []\n        # first make the list of nodes\n        for a in self._graph:\n            if a not in nodes:\n                nodes.append(a)\n            for b in self._graph[a]:\n                if b not in nodes:\n                    nodes.append(b)\n\n        if fromsys not in nodes or tosys not in nodes:\n            # fromsys or tosys are isolated or not registered, so there's\n            # certainly no way to get from one to the other\n            return None, inf\n\n        edgeweights = {}\n        # construct another graph that is a dict of dicts of priorities\n        # (used as edge weights in Dijkstra's algorithm)\n        for a in self._graph:\n            edgeweights[a] = aew = {}\n            agraph = self._graph[a]\n            for b in agraph:\n                aew[b] = float(agraph[b].priority if hasattr(agraph[b], 'priority') else 1)\n\n        # entries in q are [distance, count, nodeobj, pathlist]\n        # count is needed because in py 3.x, tie-breaking fails on the nodes.\n        # this way, insertion order is preserved if the weights are the same\n        q = [[inf, i, n, []] for i, n in enumerate(nodes) if n is not fromsys]\n        q.insert(0, [0, -1, fromsys, []])\n\n        # this dict will store the distance to node from ``fromsys`` and the path\n        result = {}\n\n        # definitely starts as a valid heap because of the insert line; from the\n        # node to itself is always the shortest distance\n        while len(q) > 0:\n            d, orderi, n, path = heapq.heappop(q)\n\n            if d == inf:\n                # everything left is unreachable from fromsys, just copy them to\n                # the results and jump out of the loop\n                result[n] = (None, d)\n                for d, orderi, n, path in q:\n                    result[n] = (None, d)\n                break\n            else:\n                result[n] = (path, d)\n                path.append(n)\n                if n not in edgeweights:\n                    # this is a system that can be transformed to, but not from.\n                    continue\n                for n2 in edgeweights[n]:\n                    if n2 not in result:  # already visited\n                        # find where n2 is in the heap\n                        for i in range(len(q)):\n                            if q[i][2] == n2:\n                                break\n                        else:\n                            raise ValueError('n2 not in heap - this should be impossible!')\n\n                        newd = d + edgeweights[n][n2]\n                        if newd < q[i][0]:\n                            q[i][0] = newd\n                            q[i][3] = list(path)\n                            heapq.heapify(q)\n\n        # cache for later use\n        self._shortestpaths[fromsys] = result\n        return result[tosys]\n\n    def get_transform(self, fromsys, tosys):\n        \"\"\"\n        Generates and returns the `CompositeTransform` for a transformation\n        between two coordinate systems.\n\n        Parameters\n        ----------\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform into.\n\n        Returns\n        -------\n        trans : `CompositeTransform` or None\n            If there is a path from ``fromsys`` to ``tosys``, this is a\n            transform object for that path.   If no path could be found, this is\n            `None`.\n\n        Notes\n        -----\n        This function always returns a `CompositeTransform`, because\n        `CompositeTransform` is slightly more adaptable in the way it can be\n        called than other transform classes. Specifically, it takes care of\n        intermediate steps of transformations in a way that is consistent with\n        1-hop transformations.\n\n        \"\"\"\n        if not inspect.isclass(fromsys):\n            raise TypeError('fromsys is not a class')\n        if not inspect.isclass(tosys):\n            raise TypeError('tosys is not a class')\n\n        path, distance = self.find_shortest_path(fromsys, tosys)\n\n        if path is None:\n            return None\n\n        transforms = []\n        currsys = fromsys\n        for p in path[1:]:  # first element is fromsys so we skip it\n            transforms.append(self._graph[currsys][p])\n            currsys = p\n\n        fttuple = (fromsys, tosys)\n        if fttuple not in self._composite_cache:\n            comptrans = CompositeTransform(transforms, fromsys, tosys,\n                                           register_graph=False)\n            self._composite_cache[fttuple] = comptrans\n        return self._composite_cache[fttuple]\n\n    def lookup_name(self, name):\n        \"\"\"\n        Tries to locate the coordinate class with the provided alias.\n\n        Parameters\n        ----------\n        name : str\n            The alias to look up.\n\n        Returns\n        -------\n        `BaseCoordinateFrame` subclass\n            The coordinate class corresponding to the ``name`` or `None` if\n            no such class exists.\n        \"\"\"\n\n        return self._cached_names.get(name, None)\n\n    def get_names(self):\n        \"\"\"\n        Returns all available transform names. They will all be\n        valid arguments to `lookup_name`.\n\n        Returns\n        -------\n        nms : list\n            The aliases for coordinate systems.\n        \"\"\"\n        return list(self._cached_names.keys())\n\n    def to_dot_graph(self, priorities=True, addnodes=[], savefn=None,\n                     savelayout='plain', saveformat=None, color_edges=True):\n        \"\"\"\n        Converts this transform graph to the graphviz_ DOT format.\n\n        Optionally saves it (requires `graphviz`_ be installed and on your path).\n\n        .. _graphviz: http://www.graphviz.org/\n\n        Parameters\n        ----------\n        priorities : bool\n            If `True`, show the priority values for each transform.  Otherwise,\n            the will not be included in the graph.\n        addnodes : sequence of str\n            Additional coordinate systems to add (this can include systems\n            already in the transform graph, but they will only appear once).\n        savefn : None or str\n            The file name to save this graph to or `None` to not save\n            to a file.\n        savelayout : str\n            The graphviz program to use to layout the graph (see\n            graphviz_ for details) or 'plain' to just save the DOT graph\n            content. Ignored if ``savefn`` is `None`.\n        saveformat : str\n            The graphviz output format. (e.g. the ``-Txxx`` option for\n            the command line program - see graphviz docs for details).\n            Ignored if ``savefn`` is `None`.\n        color_edges : bool\n            Color the edges between two nodes (frames) based on the type of\n            transform. ``FunctionTransform``: red, ``StaticMatrixTransform``:\n            blue, ``DynamicMatrixTransform``: green.\n\n        Returns\n        -------\n        dotgraph : str\n            A string with the DOT format graph.\n        \"\"\"\n\n        nodes = []\n        # find the node names\n        for a in self._graph:\n            if a not in nodes:\n                nodes.append(a)\n            for b in self._graph[a]:\n                if b not in nodes:\n                    nodes.append(b)\n        for node in addnodes:\n            if node not in nodes:\n                nodes.append(node)\n        nodenames = []\n        invclsaliases = dict([(f, [k for k, v in self._cached_names.items() if v == f])\n                              for f in self.frame_set])\n        for n in nodes:\n            if n in invclsaliases:\n                aliases = '`\\\\n`'.join(invclsaliases[n])\n                nodenames.append('{0} [shape=oval label=\"{0}\\\\n`{1}`\"]'.format(n.__name__, aliases))\n            else:\n                nodenames.append(n.__name__ + '[ shape=oval ]')\n\n        edgenames = []\n        # Now the edges\n        for a in self._graph:\n            agraph = self._graph[a]\n            for b in agraph:\n                transform = agraph[b]\n                pri = transform.priority if hasattr(transform, 'priority') else 1\n                color = trans_to_color[transform.__class__] if color_edges else 'black'\n                edgenames.append((a.__name__, b.__name__, pri, color))\n\n        # generate simple dot format graph\n        lines = ['digraph AstropyCoordinateTransformGraph {']\n        lines.append('graph [rankdir=LR]')\n        lines.append('; '.join(nodenames) + ';')\n        for enm1, enm2, weights, color in edgenames:\n            labelstr_fmt = '[ {0} {1} ]'\n\n            if priorities:\n                priority_part = f'label = \"{weights}\"'\n            else:\n                priority_part = ''\n\n            color_part = f'color = \"{color}\"'\n\n            labelstr = labelstr_fmt.format(priority_part, color_part)\n            lines.append(f'{enm1} -> {enm2}{labelstr};')\n\n        lines.append('')\n        lines.append('overlap=false')\n        lines.append('}')\n        dotgraph = '\\n'.join(lines)\n\n        if savefn is not None:\n            if savelayout == 'plain':\n                with open(savefn, 'w') as f:\n                    f.write(dotgraph)\n            else:\n                args = [savelayout]\n                if saveformat is not None:\n                    args.append('-T' + saveformat)\n                proc = subprocess.Popen(args, stdin=subprocess.PIPE,\n                                        stdout=subprocess.PIPE,\n                                        stderr=subprocess.PIPE)\n                stdout, stderr = proc.communicate(dotgraph)\n                if proc.returncode != 0:\n                    raise OSError('problem running graphviz: \\n' + stderr)\n\n                with open(savefn, 'w') as f:\n                    f.write(stdout)\n\n        return dotgraph\n\n    def to_networkx_graph(self):\n        \"\"\"\n        Converts this transform graph into a networkx graph.\n\n        .. note::\n            You must have the `networkx <https://networkx.github.io/>`_\n            package installed for this to work.\n\n        Returns\n        -------\n        nxgraph : ``networkx.Graph``\n            This `TransformGraph` as a `networkx.Graph <https://networkx.github.io/documentation/stable/reference/classes/graph.html>`_.\n        \"\"\"\n        import networkx as nx\n\n        nxgraph = nx.Graph()\n\n        # first make the nodes\n        for a in self._graph:\n            if a not in nxgraph:\n                nxgraph.add_node(a)\n            for b in self._graph[a]:\n                if b not in nxgraph:\n                    nxgraph.add_node(b)\n\n        # Now the edges\n        for a in self._graph:\n            agraph = self._graph[a]\n            for b in agraph:\n                transform = agraph[b]\n                pri = transform.priority if hasattr(transform, 'priority') else 1\n                color = trans_to_color[transform.__class__]\n                nxgraph.add_edge(a, b, weight=pri, color=color)\n\n        return nxgraph\n\n    def transform(self, transcls, fromsys, tosys, priority=1, **kwargs):\n        \"\"\"\n        A function decorator for defining transformations.\n\n        .. note::\n            If decorating a static method of a class, ``@staticmethod``\n            should be  added *above* this decorator.\n\n        Parameters\n        ----------\n        transcls : class\n            The class of the transformation object to create.\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform into.\n        priority : float or int\n            The priority if this transform when finding the shortest\n            coordinate transform path - large numbers are lower priorities.\n\n        Additional keyword arguments are passed into the ``transcls``\n        constructor.\n\n        Returns\n        -------\n        deco : function\n            A function that can be called on another function as a decorator\n            (see example).\n\n        Notes\n        -----\n        This decorator assumes the first argument of the ``transcls``\n        initializer accepts a callable, and that the second and third\n        are ``fromsys`` and ``tosys``. If this is not true, you should just\n        initialize the class manually and use `add_transform` instead of\n        using this decorator.\n\n        Examples\n        --------\n\n        ::\n\n            graph = TransformGraph()\n\n            class Frame1(BaseCoordinateFrame):\n               ...\n\n            class Frame2(BaseCoordinateFrame):\n                ...\n\n            @graph.transform(FunctionTransform, Frame1, Frame2)\n            def f1_to_f2(f1_obj):\n                ... do something with f1_obj ...\n                return f2_obj\n\n\n        \"\"\"\n        def deco(func):\n            # this doesn't do anything directly with the transform because\n            # ``register_graph=self`` stores it in the transform graph\n            # automatically\n            transcls(func, fromsys, tosys, priority=priority,\n                     register_graph=self, **kwargs)\n            return func\n        return deco\n\n    def _add_merged_transform(self, fromsys, tosys, *furthersys, priority=1):\n        \"\"\"\n        Add a single-step transform that encapsulates a multi-step transformation path,\n        using the transforms that already exist in the graph.\n\n        The created transform internally calls the existing transforms.  If all of the\n        transforms are affine, the merged transform is\n        `~astropy.coordinates.transformations.DynamicMatrixTransform` (if there are no\n        origin shifts) or `~astropy.coordinates.transformations.AffineTransform`\n        (otherwise).  If at least one of the transforms is not affine, the merged\n        transform is\n        `~astropy.coordinates.transformations.FunctionTransformWithFiniteDifference`.\n\n        This method is primarily useful for defining loopback transformations\n        (i.e., where ``fromsys`` and the final ``tosys`` are the same).\n\n        Parameters\n        ----------\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform to.\n        furthersys : class\n            Additional coordinate frame classes to transform to in order.\n        priority : number\n            The priority of this transform when finding the shortest\n            coordinate transform path - large numbers are lower priorities.\n\n        Notes\n        -----\n        Even though the created transform is a single step in the graph, it\n        will still internally call the constituent transforms.  Thus, there is\n        no performance benefit for using this created transform.\n\n        For Astropy's built-in frames, loopback transformations typically use\n        `~astropy.coordinates.ICRS` to be safe.  Tranforming through an inertial\n        frame ensures that changes in observation time and observer\n        location/velocity are properly accounted for.\n\n        An error will be raised if a direct transform between ``fromsys`` and\n        ``tosys`` already exist.\n        \"\"\"\n        frames = [fromsys, tosys, *furthersys]\n        lastsys = frames[-1]\n        full_path = self.get_transform(fromsys, lastsys)\n        transforms = [self.get_transform(frame_a, frame_b)\n                      for frame_a, frame_b in zip(frames[:-1], frames[1:])]\n        if None in transforms:\n            raise ValueError(f\"This transformation path is not possible\")\n        if len(full_path.transforms) == 1:\n            raise ValueError(f\"A direct transform for {fromsys.__name__}->{lastsys.__name__} already exists\")\n\n        self.add_transform(fromsys, lastsys,\n                           CompositeTransform(transforms, fromsys, lastsys,\n                                              priority=priority)._as_single_transform())\n\n    @contextmanager\n    def impose_finite_difference_dt(self, dt):\n        \"\"\"\n        Context manager to impose a finite-difference time step on all applicable transformations\n\n        For each transformation in this transformation graph that has the attribute\n        ``finite_difference_dt``, that attribute is set to the provided value.  The only standard\n        transformation with this attribute is\n        `~astropy.coordinates.transformations.FunctionTransformWithFiniteDifference`.\n\n        Parameters\n        ----------\n        dt : `~astropy.units.Quantity` ['time'] or callable\n            If a quantity, this is the size of the differential used to do the finite difference.\n            If a callable, should accept ``(fromcoord, toframe)`` and return the ``dt`` value.\n        \"\"\"\n        key = 'finite_difference_dt'\n        saved_settings = []\n\n        try:\n            for to_frames in self._graph.values():\n                for transform in to_frames.values():\n                    if hasattr(transform, key):\n                        old_setting = (transform, key, getattr(transform, key))\n                        saved_settings.append(old_setting)\n                        setattr(transform, key, dt)\n            yield\n        finally:\n            for setting in saved_settings:\n                setattr(*setting)"},{"col":4,"comment":"null","endLoc":83,"header":"def __init__(self)","id":14913,"name":"__init__","nodeType":"Function","startLoc":81,"text":"def __init__(self):\n        self._graph = defaultdict(dict)\n        self.invalidate_cache()  # generates cache entries"},{"col":4,"comment":"null","endLoc":421,"header":"def __init__(self, frame, default=None, secondary_attribute='')","id":14914,"name":"__init__","nodeType":"Function","startLoc":419,"text":"def __init__(self, frame, default=None, secondary_attribute=''):\n        self._frame = frame\n        super().__init__(default, secondary_attribute)"},{"attributeType":"null","col":16,"comment":"null","endLoc":135,"id":14915,"name":"meanlogval","nodeType":"Attribute","startLoc":135,"text":"meanlogval"},{"fileName":"erfa_astrom.py","filePath":"astropy/coordinates","id":14916,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module contains a helper function to fill erfa.astrom struct and a\nScienceState, which allows to speed up coordinate transformations at the\nexpense of accuracy.\n\"\"\"\nimport warnings\n\nimport numpy as np\nimport erfa\n\nfrom astropy.time import Time\nfrom astropy.utils.state import ScienceState\nimport astropy.units as u\nfrom astropy.utils.exceptions import AstropyWarning\n\nfrom .builtin_frames.utils import (\n    get_jd12, get_cip, prepare_earth_position_vel, get_polar_motion,\n    pav2pv\n)\nfrom .matrix_utilities import rotation_matrix\n\n\n__all__ = []\n\n\nclass ErfaAstrom:\n    '''\n    The default provider for astrometry values.\n    A utility class to extract the necessary arguments for\n    erfa functions from frame attributes, call the corresponding\n    erfa functions and return the astrom object.\n    '''\n    @staticmethod\n    def apco(frame_or_coord):\n        '''\n        Wrapper for ``erfa.apco``, used in conversions AltAz <-> ICRS and CIRS <-> ICRS\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, an AltAz or CIRS frame is expected.\n        '''\n        lon, lat, height = frame_or_coord.location.to_geodetic('WGS84')\n        obstime = frame_or_coord.obstime\n\n        jd1_tt, jd2_tt = get_jd12(obstime, 'tt')\n        xp, yp = get_polar_motion(obstime)\n        sp = erfa.sp00(jd1_tt, jd2_tt)\n        x, y, s = get_cip(jd1_tt, jd2_tt)\n        era = erfa.era00(*get_jd12(obstime, 'ut1'))\n        earth_pv, earth_heliocentric = prepare_earth_position_vel(obstime)\n\n        # refraction constants\n        if hasattr(frame_or_coord, 'pressure'):\n            # this is an AltAz like frame. Calculate refraction\n            refa, refb = erfa.refco(\n                frame_or_coord.pressure.to_value(u.hPa),\n                frame_or_coord.temperature.to_value(u.deg_C),\n                frame_or_coord.relative_humidity.value,\n                frame_or_coord.obswl.to_value(u.micron)\n            )\n        else:\n            # This is not an AltAz frame, so don't bother computing refraction\n            refa, refb = 0.0, 0.0\n\n        return erfa.apco(\n            jd1_tt, jd2_tt, earth_pv, earth_heliocentric, x, y, s, era,\n            lon.to_value(u.radian),\n            lat.to_value(u.radian),\n            height.to_value(u.m),\n            xp, yp, sp, refa, refb\n        )\n\n    @staticmethod\n    def apcs(frame_or_coord):\n        '''\n        Wrapper for ``erfa.apcs``, used in conversions GCRS <-> ICRS\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, a GCRS frame is expected.\n        '''\n        jd1_tt, jd2_tt = get_jd12(frame_or_coord.obstime, 'tt')\n        obs_pv = pav2pv(\n            frame_or_coord.obsgeoloc.get_xyz(xyz_axis=-1).value,\n            frame_or_coord.obsgeovel.get_xyz(xyz_axis=-1).value\n        )\n        earth_pv, earth_heliocentric = prepare_earth_position_vel(frame_or_coord.obstime)\n        return erfa.apcs(jd1_tt, jd2_tt, obs_pv, earth_pv, earth_heliocentric)\n\n    @staticmethod\n    def apio(frame_or_coord):\n        '''\n        Slightly modified equivalent of ``erfa.apio``, used in conversions AltAz <-> CIRS.\n\n        Since we use a topocentric CIRS frame, we have dropped the steps needed to calculate\n        diurnal aberration.\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, an AltAz frame is expected.\n        '''\n        # Calculate erfa.apio input parameters.\n        # TIO locator s'\n        sp = erfa.sp00(*get_jd12(frame_or_coord.obstime, 'tt'))\n\n        # Earth rotation angle.\n        theta = erfa.era00(*get_jd12(frame_or_coord.obstime, 'ut1'))\n\n        # Longitude and latitude in radians.\n        lon, lat, height = frame_or_coord.location.to_geodetic('WGS84')\n        elong = lon.to_value(u.radian)\n        phi = lat.to_value(u.radian)\n\n        # Polar motion, rotated onto local meridian\n        xp, yp = get_polar_motion(frame_or_coord.obstime)\n\n        # we need an empty astrom structure before we fill in the required sections\n        astrom = np.zeros(frame_or_coord.obstime.shape, dtype=erfa.dt_eraASTROM)\n\n        # Form the rotation matrix, CIRS to apparent [HA,Dec].\n        r = (rotation_matrix(elong, 'z', unit=u.radian)\n             @ rotation_matrix(-yp, 'x', unit=u.radian)\n             @ rotation_matrix(-xp, 'y', unit=u.radian)\n             @ rotation_matrix(theta+sp, 'z', unit=u.radian))\n\n        # Solve for local Earth rotation angle.\n        a = r[..., 0, 0]\n        b = r[..., 0, 1]\n        eral = np.arctan2(b, a)\n        astrom['eral'] = eral\n\n        # Solve for polar motion [X,Y] with respect to local meridian.\n        c = r[..., 0, 2]\n        astrom['xpl'] = np.arctan2(c, np.sqrt(a*a+b*b))\n        a = r[..., 1, 2]\n        b = r[..., 2, 2]\n        astrom['ypl'] = -np.arctan2(a, b)\n\n        # Adjusted longitude.\n        astrom['along'] = erfa.anpm(eral - theta)\n\n        # Functions of latitude.\n        astrom['sphi'] = np.sin(phi)\n        astrom['cphi'] = np.cos(phi)\n\n        # Omit two steps that are zero for a geocentric observer:\n        # Observer's geocentric position and velocity (m, m/s, CIRS).\n        # Magnitude of diurnal aberration vector.\n\n        # Refraction constants.\n        astrom['refa'], astrom['refb'] = erfa.refco(\n            frame_or_coord.pressure.to_value(u.hPa),\n            frame_or_coord.temperature.to_value(u.deg_C),\n            frame_or_coord.relative_humidity.value,\n            frame_or_coord.obswl.to_value(u.micron)\n        )\n        return astrom\n\n\nclass ErfaAstromInterpolator(ErfaAstrom):\n    '''\n    A provider for astrometry values that does not call erfa\n    for each individual timestamp but interpolates linearly\n    between support points.\n\n    For the interpolation, float64 MJD values are used, so time precision\n    for the interpolation will be around a microsecond.\n\n    This can dramatically speed up coordinate transformations,\n    e.g. between CIRS and ICRS,\n    when obstime is an array of many values (factors of 10 to > 100 depending\n    on the selected resolution, number of points and the time range of the values).\n\n    The precision of the transformation will still be in the order of microseconds\n    for reasonable values of time_resolution, e.g. ``300 * u.s``.\n\n    Users should benchmark performance and accuracy with the default transformation\n    for their specific use case and then choose a suitable ``time_resolution``\n    from there.\n\n    This class is intended be used together with the ``erfa_astrom`` science state,\n    e.g. in a context manager like this\n\n    Example\n    -------\n    >>> from astropy.coordinates import SkyCoord, CIRS\n    >>> from astropy.coordinates.erfa_astrom import erfa_astrom, ErfaAstromInterpolator\n    >>> import astropy.units as u\n    >>> from astropy.time import Time\n    >>> import numpy as np\n\n    >>> obstime = Time('2010-01-01T20:00:00') + np.linspace(0, 4, 1000) * u.hour\n    >>> crab = SkyCoord(ra='05h34m31.94s', dec='22d00m52.2s')\n    >>> with erfa_astrom.set(ErfaAstromInterpolator(300 * u.s)):\n    ...    cirs = crab.transform_to(CIRS(obstime=obstime))\n    '''\n\n    @u.quantity_input(time_resolution=u.day)\n    def __init__(self, time_resolution):\n        if time_resolution.to_value(u.us) < 10:\n            warnings.warn(\n                f'Using {self.__class__.__name__} with `time_resolution`'\n                ' below 10 microseconds might lead to numerical inaccuracies'\n                ' as the MJD-based interpolation is limited by floating point '\n                ' precision to about a microsecond of precision',\n                AstropyWarning\n            )\n        self.mjd_resolution = time_resolution.to_value(u.day)\n\n    def _get_support_points(self, obstime):\n        '''\n        Calculate support points for the interpolation.\n\n        We divide the MJD by the time resolution (as single float64 values),\n        and calculate ceil and floor.\n        Then we take the unique and sorted values and scale back to MJD.\n        This will create a sparse support for non-regular input obstimes.\n        '''\n        mjd_scaled = np.ravel(obstime.mjd / self.mjd_resolution)\n\n        # unique already does sorting\n        mjd_u = np.unique(np.concatenate([\n            np.floor(mjd_scaled),\n            np.ceil(mjd_scaled),\n        ]))\n\n        return Time(\n            mjd_u * self.mjd_resolution,\n            format='mjd',\n            scale=obstime.scale,\n        )\n\n    @staticmethod\n    def _prepare_earth_position_vel(support, obstime):\n        \"\"\"\n        Calculate Earth's position and velocity.\n\n        Uses the coarser grid ``support`` to do the calculation, and interpolates\n        onto the finer grid ``obstime``.\n        \"\"\"\n        pv_support, heliocentric_support = prepare_earth_position_vel(support)\n\n        # do interpolation\n        earth_pv = np.empty(obstime.shape, dtype=erfa.dt_pv)\n        earth_heliocentric = np.empty(obstime.shape + (3,))\n        for dim in range(3):\n            for key in 'pv':\n                earth_pv[key][..., dim] = np.interp(\n                    obstime.mjd,\n                    support.mjd,\n                    pv_support[key][..., dim]\n                )\n            earth_heliocentric[..., dim] = np.interp(\n                obstime.mjd, support.mjd, heliocentric_support[..., dim]\n            )\n\n        return earth_pv, earth_heliocentric\n\n    @staticmethod\n    def _get_c2i(support, obstime):\n        \"\"\"\n        Calculate the Celestial-to-Intermediate rotation matrix.\n\n        Uses the coarser grid ``support`` to do the calculation, and interpolates\n        onto the finer grid ``obstime``.\n        \"\"\"\n        jd1_tt_support, jd2_tt_support = get_jd12(support, 'tt')\n        c2i_support = erfa.c2i06a(jd1_tt_support, jd2_tt_support)\n        c2i = np.empty(obstime.shape + (3, 3))\n        for dim1 in range(3):\n            for dim2 in range(3):\n                c2i[..., dim1, dim2] = np.interp(obstime.mjd, support.mjd, c2i_support[..., dim1, dim2])\n        return c2i\n\n    @staticmethod\n    def _get_cip(support, obstime):\n        \"\"\"\n        Find the X, Y coordinates of the CIP and the CIO locator, s.\n\n        Uses the coarser grid ``support`` to do the calculation, and interpolates\n        onto the finer grid ``obstime``.\n        \"\"\"\n        jd1_tt_support, jd2_tt_support = get_jd12(support, 'tt')\n        cip_support = get_cip(jd1_tt_support, jd2_tt_support)\n        return tuple(\n            np.interp(obstime.mjd, support.mjd, cip_component)\n            for cip_component in cip_support\n        )\n\n    @staticmethod\n    def _get_polar_motion(support, obstime):\n        \"\"\"\n        Find the two polar motion components in radians\n\n        Uses the coarser grid ``support`` to do the calculation, and interpolates\n        onto the finer grid ``obstime``.\n        \"\"\"\n        polar_motion_support = get_polar_motion(support)\n        return tuple(\n            np.interp(obstime.mjd, support.mjd, polar_motion_component)\n            for polar_motion_component in polar_motion_support\n        )\n\n    def apco(self, frame_or_coord):\n        '''\n        Wrapper for ``erfa.apco``, used in conversions AltAz <-> ICRS and CIRS <-> ICRS\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, an AltAz or CIRS frame is expected.\n        '''\n        lon, lat, height = frame_or_coord.location.to_geodetic('WGS84')\n        obstime = frame_or_coord.obstime\n        support = self._get_support_points(obstime)\n        jd1_tt, jd2_tt = get_jd12(obstime, 'tt')\n\n        # get the position and velocity arrays for the observatory.  Need to\n        # have xyz in last dimension, and pos/vel in one-but-last.\n        earth_pv, earth_heliocentric = self._prepare_earth_position_vel(support, obstime)\n\n        xp, yp = self._get_polar_motion(support, obstime)\n        sp = erfa.sp00(jd1_tt, jd2_tt)\n        x, y, s = self._get_cip(support, obstime)\n        era = erfa.era00(*get_jd12(obstime, 'ut1'))\n\n        # refraction constants\n        if hasattr(frame_or_coord, 'pressure'):\n            # an AltAz like frame. Include refraction\n            refa, refb = erfa.refco(\n                frame_or_coord.pressure.to_value(u.hPa),\n                frame_or_coord.temperature.to_value(u.deg_C),\n                frame_or_coord.relative_humidity.value,\n                frame_or_coord.obswl.to_value(u.micron)\n            )\n        else:\n            # a CIRS like frame - no refraction\n            refa, refb = 0.0, 0.0\n\n        return erfa.apco(\n            jd1_tt, jd2_tt, earth_pv, earth_heliocentric, x, y, s, era,\n            lon.to_value(u.radian),\n            lat.to_value(u.radian),\n            height.to_value(u.m),\n            xp, yp, sp, refa, refb\n        )\n\n    def apcs(self, frame_or_coord):\n        '''\n        Wrapper for ``erfa.apci``, used in conversions GCRS <-> ICRS\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, a GCRS frame is expected.\n        '''\n        obstime = frame_or_coord.obstime\n        support = self._get_support_points(obstime)\n\n        # get the position and velocity arrays for the observatory.  Need to\n        # have xyz in last dimension, and pos/vel in one-but-last.\n        earth_pv, earth_heliocentric = self._prepare_earth_position_vel(support, obstime)\n        pv = pav2pv(\n            frame_or_coord.obsgeoloc.get_xyz(xyz_axis=-1).value,\n            frame_or_coord.obsgeovel.get_xyz(xyz_axis=-1).value\n        )\n\n        jd1_tt, jd2_tt = get_jd12(obstime, 'tt')\n        return erfa.apcs(jd1_tt, jd2_tt, pv, earth_pv, earth_heliocentric)\n\n\nclass erfa_astrom(ScienceState):\n    \"\"\"\n    ScienceState to select with astrom provider is used in\n    coordinate transformations.\n    \"\"\"\n\n    _value = ErfaAstrom()\n\n    @classmethod\n    def validate(cls, value):\n        if not isinstance(value, ErfaAstrom):\n            raise TypeError(f'Must be an instance of {ErfaAstrom!r}')\n        return value\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":547,"id":14917,"name":"_is_bool","nodeType":"Attribute","startLoc":547,"text":"_is_bool"},{"attributeType":"null","col":8,"comment":"null","endLoc":551,"id":14918,"name":"_default_size","nodeType":"Attribute","startLoc":551,"text":"self._default_size"},{"attributeType":"TrapezoidDisk2D","col":8,"comment":"null","endLoc":550,"id":14919,"name":"_model","nodeType":"Attribute","startLoc":550,"text":"self._model"},{"col":0,"comment":"\n    Find the X, Y coordinates of the CIP and the CIO locator, s.\n\n    Parameters\n    ----------\n    jd1 : float or `np.ndarray`\n        First part of two part Julian date (TDB)\n    jd2 : float or `np.ndarray`\n        Second part of two part Julian date (TDB)\n\n    Returns\n    -------\n    x : float or `np.ndarray`\n        x coordinate of the CIP\n    y : float or `np.ndarray`\n        y coordinate of the CIP\n    s : float or `np.ndarray`\n        CIO locator, s\n    ","endLoc":169,"header":"def get_cip(jd1, jd2)","id":14920,"name":"get_cip","nodeType":"Function","startLoc":143,"text":"def get_cip(jd1, jd2):\n    \"\"\"\n    Find the X, Y coordinates of the CIP and the CIO locator, s.\n\n    Parameters\n    ----------\n    jd1 : float or `np.ndarray`\n        First part of two part Julian date (TDB)\n    jd2 : float or `np.ndarray`\n        Second part of two part Julian date (TDB)\n\n    Returns\n    -------\n    x : float or `np.ndarray`\n        x coordinate of the CIP\n    y : float or `np.ndarray`\n        y coordinate of the CIP\n    s : float or `np.ndarray`\n        CIO locator, s\n    \"\"\"\n    # classical NPB matrix, IAU 2006/2000A\n    rpnb = erfa.pnm06a(jd1, jd2)\n    # CIP X, Y coordinates from array\n    x, y = erfa.bpn2xy(rpnb)\n    # CIO locator, s\n    s = erfa.s06(jd1, jd2, x, y)\n    return x, y, s"},{"col":0,"comment":"\n    Get barycentric position and velocity, and heliocentric position of Earth\n\n    Parameters\n    ----------\n    time : `~astropy.time.Time`\n        time at which to calculate position and velocity of Earth\n\n    Returns\n    -------\n    earth_pv : `np.ndarray`\n        Barycentric position and velocity of Earth, in au and au/day\n    earth_helio : `np.ndarray`\n        Heliocentric position of Earth in au\n    ","endLoc":385,"header":"def prepare_earth_position_vel(time)","id":14921,"name":"prepare_earth_position_vel","nodeType":"Function","startLoc":334,"text":"def prepare_earth_position_vel(time):\n    \"\"\"\n    Get barycentric position and velocity, and heliocentric position of Earth\n\n    Parameters\n    ----------\n    time : `~astropy.time.Time`\n        time at which to calculate position and velocity of Earth\n\n    Returns\n    -------\n    earth_pv : `np.ndarray`\n        Barycentric position and velocity of Earth, in au and au/day\n    earth_helio : `np.ndarray`\n        Heliocentric position of Earth in au\n    \"\"\"\n    # this goes here to avoid circular import errors\n    from astropy.coordinates.solar_system import (\n        get_body_barycentric,\n        get_body_barycentric_posvel,\n        solar_system_ephemeris,\n    )\n    # get barycentric position and velocity of earth\n\n    ephemeris = solar_system_ephemeris.get()\n\n    # if we are using the builtin erfa based ephemeris,\n    # we can use the fact that epv00 already provides all we need.\n    # This avoids calling epv00 twice, once\n    # in get_body_barycentric_posvel('earth') and once in\n    # get_body_barycentric('sun')\n    if ephemeris == 'builtin':\n        jd1, jd2 = get_jd12(time, 'tdb')\n        earth_pv_heliocentric, earth_pv = erfa.epv00(jd1, jd2)\n        earth_heliocentric = earth_pv_heliocentric['p']\n\n    # all other ephemeris providers probably don't have a shortcut like this\n    else:\n        earth_p, earth_v = get_body_barycentric_posvel('earth', time)\n\n        # get heliocentric position of earth, preparing it for passing to erfa.\n        sun = get_body_barycentric('sun', time)\n        earth_heliocentric = (earth_p - sun).get_xyz(xyz_axis=-1).to_value(u.au)\n\n        # Also prepare earth_pv for passing to erfa, which wants it as\n        # a structured dtype.\n        earth_pv = pav2pv(\n            earth_p.get_xyz(xyz_axis=-1).to_value(u.au),\n            earth_v.get_xyz(xyz_axis=-1).to_value(u.au / u.d)\n        )\n\n    return earth_pv, earth_heliocentric"},{"attributeType":"null","col":8,"comment":"null","endLoc":553,"id":14922,"name":"_truncation","nodeType":"Attribute","startLoc":553,"text":"self._truncation"},{"className":"AiryDisk2DKernel","col":0,"comment":"\n    2D Airy disk kernel.\n\n    This kernel models the diffraction pattern of a circular aperture.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    radius : float\n        The radius of the Airy disk kernel (radius of the first zero).\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*radius + 1⌋.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*radius + 1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, Tophat2DKernel, RickerWavelet2DKernel,\n    Ring2DKernel, TrapezoidDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import AiryDisk2DKernel\n        airydisk_2D_kernel = AiryDisk2DKernel(10)\n        plt.imshow(airydisk_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n    ","endLoc":773,"id":14924,"nodeType":"Class","startLoc":712,"text":"class AiryDisk2DKernel(Kernel2D):\n    \"\"\"\n    2D Airy disk kernel.\n\n    This kernel models the diffraction pattern of a circular aperture.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    radius : float\n        The radius of the Airy disk kernel (radius of the first zero).\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*radius + 1⌋.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*radius + 1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, Tophat2DKernel, RickerWavelet2DKernel,\n    Ring2DKernel, TrapezoidDisk2DKernel, Moffat2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import AiryDisk2DKernel\n        airydisk_2D_kernel = AiryDisk2DKernel(10)\n        plt.imshow(airydisk_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n    \"\"\"\n    _is_bool = False\n\n    def __init__(self, radius, **kwargs):\n        self._model = models.AiryDisk2D(1, 0, 0, radius)\n        self._default_size = _round_up_to_odd_integer(8 * radius)\n        super().__init__(**kwargs)\n        self.normalize()\n        self._truncation = None"},{"col":4,"comment":"null","endLoc":773,"header":"def __init__(self, radius, **kwargs)","id":14925,"name":"__init__","nodeType":"Function","startLoc":768,"text":"def __init__(self, radius, **kwargs):\n        self._model = models.AiryDisk2D(1, 0, 0, radius)\n        self._default_size = _round_up_to_odd_integer(8 * radius)\n        super().__init__(**kwargs)\n        self.normalize()\n        self._truncation = None"},{"col":0,"comment":"\n    Combine p- and v- vectors into a pv-vector.\n    ","endLoc":140,"header":"def pav2pv(p, v)","id":14926,"name":"pav2pv","nodeType":"Function","startLoc":133,"text":"def pav2pv(p, v):\n    \"\"\"\n    Combine p- and v- vectors into a pv-vector.\n    \"\"\"\n    pv = np.empty(np.broadcast(p, v).shape[:-1], erfa.dt_pv)\n    pv['p'] = p\n    pv['v'] = v\n    return pv"},{"className":"ErfaAstrom","col":0,"comment":"\n    The default provider for astrometry values.\n    A utility class to extract the necessary arguments for\n    erfa functions from frame attributes, call the corresponding\n    erfa functions and return the astrom object.\n    ","endLoc":167,"id":14927,"nodeType":"Class","startLoc":27,"text":"class ErfaAstrom:\n    '''\n    The default provider for astrometry values.\n    A utility class to extract the necessary arguments for\n    erfa functions from frame attributes, call the corresponding\n    erfa functions and return the astrom object.\n    '''\n    @staticmethod\n    def apco(frame_or_coord):\n        '''\n        Wrapper for ``erfa.apco``, used in conversions AltAz <-> ICRS and CIRS <-> ICRS\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, an AltAz or CIRS frame is expected.\n        '''\n        lon, lat, height = frame_or_coord.location.to_geodetic('WGS84')\n        obstime = frame_or_coord.obstime\n\n        jd1_tt, jd2_tt = get_jd12(obstime, 'tt')\n        xp, yp = get_polar_motion(obstime)\n        sp = erfa.sp00(jd1_tt, jd2_tt)\n        x, y, s = get_cip(jd1_tt, jd2_tt)\n        era = erfa.era00(*get_jd12(obstime, 'ut1'))\n        earth_pv, earth_heliocentric = prepare_earth_position_vel(obstime)\n\n        # refraction constants\n        if hasattr(frame_or_coord, 'pressure'):\n            # this is an AltAz like frame. Calculate refraction\n            refa, refb = erfa.refco(\n                frame_or_coord.pressure.to_value(u.hPa),\n                frame_or_coord.temperature.to_value(u.deg_C),\n                frame_or_coord.relative_humidity.value,\n                frame_or_coord.obswl.to_value(u.micron)\n            )\n        else:\n            # This is not an AltAz frame, so don't bother computing refraction\n            refa, refb = 0.0, 0.0\n\n        return erfa.apco(\n            jd1_tt, jd2_tt, earth_pv, earth_heliocentric, x, y, s, era,\n            lon.to_value(u.radian),\n            lat.to_value(u.radian),\n            height.to_value(u.m),\n            xp, yp, sp, refa, refb\n        )\n\n    @staticmethod\n    def apcs(frame_or_coord):\n        '''\n        Wrapper for ``erfa.apcs``, used in conversions GCRS <-> ICRS\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, a GCRS frame is expected.\n        '''\n        jd1_tt, jd2_tt = get_jd12(frame_or_coord.obstime, 'tt')\n        obs_pv = pav2pv(\n            frame_or_coord.obsgeoloc.get_xyz(xyz_axis=-1).value,\n            frame_or_coord.obsgeovel.get_xyz(xyz_axis=-1).value\n        )\n        earth_pv, earth_heliocentric = prepare_earth_position_vel(frame_or_coord.obstime)\n        return erfa.apcs(jd1_tt, jd2_tt, obs_pv, earth_pv, earth_heliocentric)\n\n    @staticmethod\n    def apio(frame_or_coord):\n        '''\n        Slightly modified equivalent of ``erfa.apio``, used in conversions AltAz <-> CIRS.\n\n        Since we use a topocentric CIRS frame, we have dropped the steps needed to calculate\n        diurnal aberration.\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, an AltAz frame is expected.\n        '''\n        # Calculate erfa.apio input parameters.\n        # TIO locator s'\n        sp = erfa.sp00(*get_jd12(frame_or_coord.obstime, 'tt'))\n\n        # Earth rotation angle.\n        theta = erfa.era00(*get_jd12(frame_or_coord.obstime, 'ut1'))\n\n        # Longitude and latitude in radians.\n        lon, lat, height = frame_or_coord.location.to_geodetic('WGS84')\n        elong = lon.to_value(u.radian)\n        phi = lat.to_value(u.radian)\n\n        # Polar motion, rotated onto local meridian\n        xp, yp = get_polar_motion(frame_or_coord.obstime)\n\n        # we need an empty astrom structure before we fill in the required sections\n        astrom = np.zeros(frame_or_coord.obstime.shape, dtype=erfa.dt_eraASTROM)\n\n        # Form the rotation matrix, CIRS to apparent [HA,Dec].\n        r = (rotation_matrix(elong, 'z', unit=u.radian)\n             @ rotation_matrix(-yp, 'x', unit=u.radian)\n             @ rotation_matrix(-xp, 'y', unit=u.radian)\n             @ rotation_matrix(theta+sp, 'z', unit=u.radian))\n\n        # Solve for local Earth rotation angle.\n        a = r[..., 0, 0]\n        b = r[..., 0, 1]\n        eral = np.arctan2(b, a)\n        astrom['eral'] = eral\n\n        # Solve for polar motion [X,Y] with respect to local meridian.\n        c = r[..., 0, 2]\n        astrom['xpl'] = np.arctan2(c, np.sqrt(a*a+b*b))\n        a = r[..., 1, 2]\n        b = r[..., 2, 2]\n        astrom['ypl'] = -np.arctan2(a, b)\n\n        # Adjusted longitude.\n        astrom['along'] = erfa.anpm(eral - theta)\n\n        # Functions of latitude.\n        astrom['sphi'] = np.sin(phi)\n        astrom['cphi'] = np.cos(phi)\n\n        # Omit two steps that are zero for a geocentric observer:\n        # Observer's geocentric position and velocity (m, m/s, CIRS).\n        # Magnitude of diurnal aberration vector.\n\n        # Refraction constants.\n        astrom['refa'], astrom['refb'] = erfa.refco(\n            frame_or_coord.pressure.to_value(u.hPa),\n            frame_or_coord.temperature.to_value(u.deg_C),\n            frame_or_coord.relative_humidity.value,\n            frame_or_coord.obswl.to_value(u.micron)\n        )\n        return astrom"},{"col":4,"comment":"\n        Wrapper for ``erfa.apco``, used in conversions AltAz <-> ICRS and CIRS <-> ICRS\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, an AltAz or CIRS frame is expected.\n        ","endLoc":75,"header":"@staticmethod\n    def apco(frame_or_coord)","id":14928,"name":"apco","nodeType":"Function","startLoc":34,"text":"@staticmethod\n    def apco(frame_or_coord):\n        '''\n        Wrapper for ``erfa.apco``, used in conversions AltAz <-> ICRS and CIRS <-> ICRS\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, an AltAz or CIRS frame is expected.\n        '''\n        lon, lat, height = frame_or_coord.location.to_geodetic('WGS84')\n        obstime = frame_or_coord.obstime\n\n        jd1_tt, jd2_tt = get_jd12(obstime, 'tt')\n        xp, yp = get_polar_motion(obstime)\n        sp = erfa.sp00(jd1_tt, jd2_tt)\n        x, y, s = get_cip(jd1_tt, jd2_tt)\n        era = erfa.era00(*get_jd12(obstime, 'ut1'))\n        earth_pv, earth_heliocentric = prepare_earth_position_vel(obstime)\n\n        # refraction constants\n        if hasattr(frame_or_coord, 'pressure'):\n            # this is an AltAz like frame. Calculate refraction\n            refa, refb = erfa.refco(\n                frame_or_coord.pressure.to_value(u.hPa),\n                frame_or_coord.temperature.to_value(u.deg_C),\n                frame_or_coord.relative_humidity.value,\n                frame_or_coord.obswl.to_value(u.micron)\n            )\n        else:\n            # This is not an AltAz frame, so don't bother computing refraction\n            refa, refb = 0.0, 0.0\n\n        return erfa.apco(\n            jd1_tt, jd2_tt, earth_pv, earth_heliocentric, x, y, s, era,\n            lon.to_value(u.radian),\n            lat.to_value(u.radian),\n            height.to_value(u.m),\n            xp, yp, sp, refa, refb\n        )"},{"col":4,"comment":"\n        Ensure the wrap angle for any spherical\n        representations.\n        ","endLoc":179,"header":"def represent_as(self, base, s='base', in_frame_units=False)","id":14929,"name":"represent_as","nodeType":"Function","startLoc":172,"text":"def represent_as(self, base, s='base', in_frame_units=False):\n        \"\"\"\n        Ensure the wrap angle for any spherical\n        representations.\n        \"\"\"\n        data = super().represent_as(base, s, in_frame_units=in_frame_units)\n        self._set_skyoffset_data_lon_wrap_angle(data)\n        return data"},{"col":4,"comment":"\n        Invalidates the cache that stores optimizations for traversing the\n        transform graph.  This is called automatically when transforms\n        are added or removed, but will need to be called manually if\n        weights on transforms are modified inplace.\n        ","endLoc":147,"header":"def invalidate_cache(self)","id":14930,"name":"invalidate_cache","nodeType":"Function","startLoc":135,"text":"def invalidate_cache(self):\n        \"\"\"\n        Invalidates the cache that stores optimizations for traversing the\n        transform graph.  This is called automatically when transforms\n        are added or removed, but will need to be called manually if\n        weights on transforms are modified inplace.\n        \"\"\"\n        self._cached_names_dct = None\n        self._cached_frame_set = None\n        self._cached_frame_attributes = None\n        self._cached_component_names = None\n        self._shortestpaths = {}\n        self._composite_cache = {}"},{"col":4,"comment":"null","endLoc":97,"header":"@property\n    def _cached_names(self)","id":14931,"name":"_cached_names","nodeType":"Function","startLoc":85,"text":"@property\n    def _cached_names(self):\n        if self._cached_names_dct is None:\n            self._cached_names_dct = dct = {}\n            for c in self.frame_set:\n                nm = getattr(c, 'name', None)\n                if nm is not None:\n                    if not isinstance(nm, list):\n                        nm = [nm]\n                    for name in nm:\n                        dct[name] = c\n\n        return self._cached_names_dct"},{"col":4,"comment":"\n        A `set` of all the frame classes present in this `TransformGraph`.\n        ","endLoc":111,"header":"@property\n    def frame_set(self)","id":14932,"name":"frame_set","nodeType":"Function","startLoc":99,"text":"@property\n    def frame_set(self):\n        \"\"\"\n        A `set` of all the frame classes present in this `TransformGraph`.\n        \"\"\"\n        if self._cached_frame_set is None:\n            self._cached_frame_set = set()\n            for a in self._graph:\n                self._cached_frame_set.add(a)\n                for b in self._graph[a]:\n                    self._cached_frame_set.add(b)\n\n        return self._cached_frame_set.copy()"},{"attributeType":"null","col":4,"comment":"null","endLoc":766,"id":14933,"name":"_is_bool","nodeType":"Attribute","startLoc":766,"text":"_is_bool"},{"attributeType":"null","col":4,"comment":"null","endLoc":133,"id":14934,"name":"rotation","nodeType":"Attribute","startLoc":133,"text":"rotation"},{"attributeType":"null","col":8,"comment":"null","endLoc":770,"id":14935,"name":"_default_size","nodeType":"Attribute","startLoc":770,"text":"self._default_size"},{"className":"w0waCDM","col":0,"comment":"FLRW cosmology with a CPL dark energy equation of state and curvature.\n\n    The equation for the dark energy equation of state uses the\n    CPL form as described in Chevallier & Polarski [1]_ and Linder [2]_:\n    :math:`w(z) = w_0 + w_a (1-a) = w_0 + w_a z / (1+z)`.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Ode0 : float\n        Omega dark energy: density of dark energy in units of the critical\n        density at z=0.\n\n    w0 : float, optional\n        Dark energy equation of state at z=0 (a=1). This is pressure/density\n        for dark energy in units where c=1.\n\n    wa : float, optional\n        Negative derivative of the dark energy equation of state with respect\n        to the scale factor. A cosmological constant has w0=-1.0 and wa=0.0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import w0waCDM\n    >>> cosmo = w0waCDM(H0=70, Om0=0.3, Ode0=0.7, w0=-0.9, wa=0.2)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n\n    References\n    ----------\n    .. [1] Chevallier, M., & Polarski, D. (2001). Accelerating Universes with\n           Scaling Dark Matter. International Journal of Modern Physics D,\n           10(2), 213-223.\n    .. [2] Linder, E. (2003). Exploring the Expansion History of the\n           Universe. Phys. Rev. Lett., 90, 091301.\n    ","endLoc":2606,"id":14936,"nodeType":"Class","startLoc":2450,"text":"class w0waCDM(FLRW):\n    r\"\"\"FLRW cosmology with a CPL dark energy equation of state and curvature.\n\n    The equation for the dark energy equation of state uses the\n    CPL form as described in Chevallier & Polarski [1]_ and Linder [2]_:\n    :math:`w(z) = w_0 + w_a (1-a) = w_0 + w_a z / (1+z)`.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Ode0 : float\n        Omega dark energy: density of dark energy in units of the critical\n        density at z=0.\n\n    w0 : float, optional\n        Dark energy equation of state at z=0 (a=1). This is pressure/density\n        for dark energy in units where c=1.\n\n    wa : float, optional\n        Negative derivative of the dark energy equation of state with respect\n        to the scale factor. A cosmological constant has w0=-1.0 and wa=0.0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import w0waCDM\n    >>> cosmo = w0waCDM(H0=70, Om0=0.3, Ode0=0.7, w0=-0.9, wa=0.2)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n\n    References\n    ----------\n    .. [1] Chevallier, M., & Polarski, D. (2001). Accelerating Universes with\n           Scaling Dark Matter. International Journal of Modern Physics D,\n           10(2), 213-223.\n    .. [2] Linder, E. (2003). Exploring the Expansion History of the\n           Universe. Phys. Rev. Lett., 90, 091301.\n    \"\"\"\n\n    w0 = Parameter(doc=\"Dark energy equation of state at z=0.\", fvalidate=\"float\")\n    wa = Parameter(doc=\"Negative derivative of dark energy equation of state w.r.t. a.\",\n                   fvalidate=\"float\")\n\n    def __init__(self, H0, Om0, Ode0, w0=-1.0, wa=0.0, Tcmb0=0.0*u.K, Neff=3.04,\n                 m_nu=0.0*u.eV, Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=Ode0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n        self.w0 = w0\n        self.wa = wa\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wacdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._w0, self._wa)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wacdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._w0, self._wa)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wacdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._w0,\n                                           self._wa)\n\n    def w(self, z):\n        r\"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is\n        :math:`w(z) = w_0 + w_a (1 - a) = w_0 + w_a \\frac{z}{1+z}`.\n        \"\"\"\n        z = aszarr(z)\n        return self._w0 + self._wa * z / (z + 1.0)\n\n    def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by\n\n        .. math::\n\n           I = \\left(1 + z\\right)^{3 \\left(1 + w_0 + w_a\\right)}\n                     \\exp \\left(-3 w_a \\frac{z}{1+z}\\right)\n        \"\"\"\n        z = aszarr(z)\n        zp1 = z + 1.0  # (converts z [unit] -> z [dimensionless])\n        return zp1 ** (3 * (1 + self._w0 + self._wa)) * np.exp(-3 * self._wa * z / zp1)"},{"col":4,"comment":"null","endLoc":2553,"header":"def __init__(self, H0, Om0, Ode0, w0=-1.0, wa=0.0, Tcmb0=0.0*u.K, Neff=3.04,\n                 m_nu=0.0*u.eV, Ob0=None, *, name=None, meta=None)","id":14937,"name":"__init__","nodeType":"Function","startLoc":2529,"text":"def __init__(self, H0, Om0, Ode0, w0=-1.0, wa=0.0, Tcmb0=0.0*u.K, Neff=3.04,\n                 m_nu=0.0*u.eV, Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=Ode0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n        self.w0 = w0\n        self.wa = wa\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wacdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._w0, self._wa)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wacdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._w0, self._wa)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wacdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._w0,\n                                           self._wa)"},{"attributeType":"AiryDisk2D","col":8,"comment":"null","endLoc":769,"id":14938,"name":"_model","nodeType":"Attribute","startLoc":769,"text":"self._model"},{"attributeType":"null","col":4,"comment":"null","endLoc":134,"id":14939,"name":"origin","nodeType":"Attribute","startLoc":134,"text":"origin"},{"attributeType":"null","col":12,"comment":"null","endLoc":174,"id":14940,"name":"any_negative","nodeType":"Attribute","startLoc":174,"text":"any_negative"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":14941,"name":"__all__","nodeType":"Attribute","startLoc":16,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":14942,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":19,"text":"__doctest_requires__"},{"attributeType":"None","col":8,"comment":"null","endLoc":773,"id":14943,"name":"_truncation","nodeType":"Attribute","startLoc":773,"text":"self._truncation"},{"col":0,"comment":"","endLoc":6,"header":"distances.py#<anonymous>","id":14944,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module contains the classes and utility functions for distance and\ncartesian coordinates.\n\"\"\"\n\n__all__ = ['Distance']\n\n__doctest_requires__ = {'*': ['scipy']}"},{"col":4,"comment":"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is\n        :math:`w(z) = w_0 + w_a (1 - a) = w_0 + w_a \\frac{z}{1+z}`.\n        ","endLoc":2578,"header":"def w(self, z)","id":14945,"name":"w","nodeType":"Function","startLoc":2555,"text":"def w(self, z):\n        r\"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is\n        :math:`w(z) = w_0 + w_a (1 - a) = w_0 + w_a \\frac{z}{1+z}`.\n        \"\"\"\n        z = aszarr(z)\n        return self._w0 + self._wa * z / (z + 1.0)"},{"col":4,"comment":"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by\n\n        .. math::\n\n           I = \\left(1 + z\\right)^{3 \\left(1 + w_0 + w_a\\right)}\n                     \\exp \\left(-3 w_a \\frac{z}{1+z}\\right)\n        ","endLoc":2606,"header":"def de_density_scale(self, z)","id":14946,"name":"de_density_scale","nodeType":"Function","startLoc":2580,"text":"def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by\n\n        .. math::\n\n           I = \\left(1 + z\\right)^{3 \\left(1 + w_0 + w_a\\right)}\n                     \\exp \\left(-3 w_a \\frac{z}{1+z}\\right)\n        \"\"\"\n        z = aszarr(z)\n        zp1 = z + 1.0  # (converts z [unit] -> z [dimensionless])\n        return zp1 ** (3 * (1 + self._w0 + self._wa)) * np.exp(-3 * self._wa * z / zp1)"},{"className":"Moffat2DKernel","col":0,"comment":"\n    2D Moffat kernel.\n\n    This kernel is a typical model for a seeing limited PSF.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    gamma : float\n        Core width of the Moffat model.\n    alpha : float\n        Power index of the Moffat model.\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*radius + 1⌋.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*radius + 1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, Tophat2DKernel, RickerWavelet2DKernel,\n    Ring2DKernel, TrapezoidDisk2DKernel, AiryDisk2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Moffat2DKernel\n        moffat_2D_kernel = Moffat2DKernel(3, 2)\n        plt.imshow(moffat_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n    ","endLoc":842,"id":14947,"nodeType":"Class","startLoc":776,"text":"class Moffat2DKernel(Kernel2D):\n    \"\"\"\n    2D Moffat kernel.\n\n    This kernel is a typical model for a seeing limited PSF.\n\n    The generated kernel is normalized so that it integrates to 1.\n\n    Parameters\n    ----------\n    gamma : float\n        Core width of the Moffat model.\n    alpha : float\n        Power index of the Moffat model.\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*radius + 1⌋.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*radius + 1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    See Also\n    --------\n    Gaussian2DKernel, Box2DKernel, Tophat2DKernel, RickerWavelet2DKernel,\n    Ring2DKernel, TrapezoidDisk2DKernel, AiryDisk2DKernel\n\n    Examples\n    --------\n    Kernel response:\n\n     .. plot::\n        :include-source:\n\n        import matplotlib.pyplot as plt\n        from astropy.convolution import Moffat2DKernel\n        moffat_2D_kernel = Moffat2DKernel(3, 2)\n        plt.imshow(moffat_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n    \"\"\"\n    _is_bool = False\n\n    def __init__(self, gamma, alpha, **kwargs):\n        # Compute amplitude, from\n        # https://en.wikipedia.org/wiki/Moffat_distribution\n        amplitude = (alpha - 1.0) / (np.pi * gamma * gamma)\n        self._model = models.Moffat2D(amplitude, 0, 0, gamma, alpha)\n        self._default_size = _round_up_to_odd_integer(4.0 * self._model.fwhm)\n        super().__init__(**kwargs)\n        self.normalize()\n        self._truncation = None"},{"col":4,"comment":"null","endLoc":842,"header":"def __init__(self, gamma, alpha, **kwargs)","id":14948,"name":"__init__","nodeType":"Function","startLoc":834,"text":"def __init__(self, gamma, alpha, **kwargs):\n        # Compute amplitude, from\n        # https://en.wikipedia.org/wiki/Moffat_distribution\n        amplitude = (alpha - 1.0) / (np.pi * gamma * gamma)\n        self._model = models.Moffat2D(amplitude, 0, 0, gamma, alpha)\n        self._default_size = _round_up_to_odd_integer(4.0 * self._model.fwhm)\n        super().__init__(**kwargs)\n        self.normalize()\n        self._truncation = None"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":2525,"id":14949,"name":"w0","nodeType":"Attribute","startLoc":2525,"text":"w0"},{"attributeType":"null","col":12,"comment":"null","endLoc":147,"id":14950,"name":"newcls","nodeType":"Attribute","startLoc":147,"text":"newcls"},{"attributeType":"null","col":16,"comment":"null","endLoc":146,"id":14951,"name":"origin_frame","nodeType":"Attribute","startLoc":146,"text":"origin_frame"},{"className":"RadialDifferential","col":0,"comment":"Differential(s) of radial distances.\n\n    Parameters\n    ----------\n    d_distance : `~astropy.units.Quantity`\n        The differential distance.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    ","endLoc":3391,"id":14952,"nodeType":"Class","startLoc":3340,"text":"class RadialDifferential(BaseDifferential):\n    \"\"\"Differential(s) of radial distances.\n\n    Parameters\n    ----------\n    d_distance : `~astropy.units.Quantity`\n        The differential distance.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n    base_representation = RadialRepresentation\n\n    def to_cartesian(self, base):\n        return self.d_distance * base.represent_as(\n            UnitSphericalRepresentation).to_cartesian()\n\n    def norm(self, base=None):\n        return self.d_distance\n\n    @classmethod\n    def from_cartesian(cls, other, base):\n        return cls(other.dot(base.represent_as(UnitSphericalRepresentation)),\n                   copy=False)\n\n    @classmethod\n    def from_representation(cls, representation, base=None):\n        if isinstance(representation, (SphericalDifferential,\n                                       SphericalCosLatDifferential)):\n            return cls(representation.d_distance)\n        elif isinstance(representation, PhysicsSphericalDifferential):\n            return cls(representation.d_r)\n        else:\n            return super().from_representation(representation, base)\n\n    def _combine_operation(self, op, other, reverse=False):\n        if isinstance(other, self.base_representation):\n            if reverse:\n                first, second = other.distance, self.d_distance\n            else:\n                first, second = self.d_distance, other.distance\n            return other.__class__(op(first, second), copy=False)\n        elif isinstance(other, (BaseSphericalDifferential,\n                                BaseSphericalCosLatDifferential)):\n            all_components = set(self.components) | set(other.components)\n            first, second = (self, other) if not reverse else (other, self)\n            result_args = {c: op(getattr(first, c, 0.), getattr(second, c, 0.))\n                           for c in all_components}\n            return SphericalDifferential(**result_args)\n\n        else:\n            return super()._combine_operation(op, other, reverse)"},{"className":"BaseDifferential","col":0,"comment":"A base class representing differentials of representations.\n\n    These represent differences or derivatives along each component.\n    E.g., for physics spherical coordinates, these would be\n    :math:`\\delta r, \\delta \\theta, \\delta \\phi`.\n\n    Parameters\n    ----------\n    d_comp1, d_comp2, d_comp3 : `~astropy.units.Quantity` or subclass\n        The components of the 3D differentials.  The names are the keys and the\n        subclasses the values of the ``attr_classes`` attribute.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n\n    Notes\n    -----\n    All differential representation classes should subclass this base class,\n    and define an ``base_representation`` attribute with the class of the\n    regular `~astropy.coordinates.BaseRepresentation` for which differential\n    coordinates are provided. This will set up a default ``attr_classes``\n    instance with names equal to the base component names prefixed by ``d_``,\n    and all classes set to `~astropy.units.Quantity`, plus properties to access\n    those, and a default ``__init__`` for initialization.\n    ","endLoc":2735,"id":14953,"nodeType":"Class","startLoc":2415,"text":"class BaseDifferential(BaseRepresentationOrDifferential):\n    r\"\"\"A base class representing differentials of representations.\n\n    These represent differences or derivatives along each component.\n    E.g., for physics spherical coordinates, these would be\n    :math:`\\delta r, \\delta \\theta, \\delta \\phi`.\n\n    Parameters\n    ----------\n    d_comp1, d_comp2, d_comp3 : `~astropy.units.Quantity` or subclass\n        The components of the 3D differentials.  The names are the keys and the\n        subclasses the values of the ``attr_classes`` attribute.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n\n    Notes\n    -----\n    All differential representation classes should subclass this base class,\n    and define an ``base_representation`` attribute with the class of the\n    regular `~astropy.coordinates.BaseRepresentation` for which differential\n    coordinates are provided. This will set up a default ``attr_classes``\n    instance with names equal to the base component names prefixed by ``d_``,\n    and all classes set to `~astropy.units.Quantity`, plus properties to access\n    those, and a default ``__init__`` for initialization.\n    \"\"\"\n\n    def __init_subclass__(cls, **kwargs):\n        \"\"\"Set default ``attr_classes`` and component getters on a Differential.\n        class BaseDifferential(BaseRepresentationOrDifferential):\n\n        For these, the components are those of the base representation prefixed\n        by 'd_', and the class is `~astropy.units.Quantity`.\n        \"\"\"\n\n        # Don't do anything for base helper classes.\n        if cls.__name__ in ('BaseDifferential', 'BaseSphericalDifferential',\n                            'BaseSphericalCosLatDifferential'):\n            return\n\n        if not hasattr(cls, 'base_representation'):\n            raise NotImplementedError('Differential representations must have a'\n                                      '\"base_representation\" class attribute.')\n\n        # If not defined explicitly, create attr_classes.\n        if not hasattr(cls, 'attr_classes'):\n            base_attr_classes = cls.base_representation.attr_classes\n            cls.attr_classes = {'d_' + c: u.Quantity\n                                for c in base_attr_classes}\n\n        repr_name = cls.get_name()\n        if repr_name in DIFFERENTIAL_CLASSES:\n            raise ValueError(f\"Differential class {repr_name} already defined\")\n\n        DIFFERENTIAL_CLASSES[repr_name] = cls\n        _invalidate_reprdiff_cls_hash()\n\n        # If not defined explicitly, create properties for the components.\n        for component in cls.attr_classes:\n            if not hasattr(cls, component):\n                setattr(cls, component,\n                        property(_make_getter(component),\n                                 doc=f\"Component '{component}' of the Differential.\"))\n\n        super().__init_subclass__(**kwargs)\n\n    @classmethod\n    def _check_base(cls, base):\n        if cls not in base._compatible_differentials:\n            raise TypeError(f\"Differential class {cls} is not compatible with the \"\n                            f\"base (representation) class {base.__class__}\")\n\n    def _get_deriv_key(self, base):\n        \"\"\"Given a base (representation instance), determine the unit of the\n        derivative by removing the representation unit from the component units\n        of this differential.\n        \"\"\"\n\n        # This check is just a last resort so we don't return a strange unit key\n        # from accidentally passing in the wrong base.\n        self._check_base(base)\n\n        for name in base.components:\n            comp = getattr(base, name)\n            d_comp = getattr(self, f'd_{name}', None)\n            if d_comp is not None:\n                d_unit = comp.unit / d_comp.unit\n\n                # This is quite a bit faster than using to_system() or going\n                # through Quantity()\n                d_unit_si = d_unit.decompose(u.si.bases)\n                d_unit_si._scale = 1  # remove the scale from the unit\n\n                return str(d_unit_si)\n\n        else:\n            raise RuntimeError(\"Invalid representation-differential units! This\"\n                               \" likely happened because either the \"\n                               \"representation or the associated differential \"\n                               \"have non-standard units. Check that the input \"\n                               \"positional data have positional units, and the \"\n                               \"input velocity data have velocity units, or \"\n                               \"are both dimensionless.\")\n\n    @classmethod\n    def _get_base_vectors(cls, base):\n        \"\"\"Get unit vectors and scale factors from base.\n\n        Parameters\n        ----------\n        base : instance of ``self.base_representation``\n            The points for which the unit vectors and scale factors should be\n            retrieved.\n\n        Returns\n        -------\n        unit_vectors : dict of `CartesianRepresentation`\n            In the directions of the coordinates of base.\n        scale_factors : dict of `~astropy.units.Quantity`\n            Scale factors for each of the coordinates\n\n        Raises\n        ------\n        TypeError : if the base is not of the correct type\n        \"\"\"\n        cls._check_base(base)\n        return base.unit_vectors(), base.scale_factors()\n\n    def to_cartesian(self, base):\n        \"\"\"Convert the differential to 3D rectangular cartesian coordinates.\n\n        Parameters\n        ----------\n        base : instance of ``self.base_representation``\n            The points for which the differentials are to be converted: each of\n            the components is multiplied by its unit vectors and scale factors.\n\n        Returns\n        -------\n        `CartesianDifferential`\n            This object, converted.\n\n        \"\"\"\n        base_e, base_sf = self._get_base_vectors(base)\n        return functools.reduce(\n            operator.add, (getattr(self, d_c) * base_sf[c] * base_e[c]\n                           for d_c, c in zip(self.components, base.components)))\n\n    @classmethod\n    def from_cartesian(cls, other, base):\n        \"\"\"Convert the differential from 3D rectangular cartesian coordinates to\n        the desired class.\n\n        Parameters\n        ----------\n        other\n            The object to convert into this differential.\n        base : `BaseRepresentation`\n            The points for which the differentials are to be converted: each of\n            the components is multiplied by its unit vectors and scale factors.\n            Will be converted to ``cls.base_representation`` if needed.\n\n        Returns\n        -------\n        `BaseDifferential` subclass instance\n            A new differential object that is this class' type.\n        \"\"\"\n        base = base.represent_as(cls.base_representation)\n        base_e, base_sf = cls._get_base_vectors(base)\n        return cls(*(other.dot(e / base_sf[component])\n                     for component, e in base_e.items()), copy=False)\n\n    def represent_as(self, other_class, base):\n        \"\"\"Convert coordinates to another representation.\n\n        If the instance is of the requested class, it is returned unmodified.\n        By default, conversion is done via cartesian coordinates.\n\n        Parameters\n        ----------\n        other_class : `~astropy.coordinates.BaseRepresentation` subclass\n            The type of representation to turn the coordinates into.\n        base : instance of ``self.base_representation``\n            Base relative to which the differentials are defined.  If the other\n            class is a differential representation, the base will be converted\n            to its ``base_representation``.\n        \"\"\"\n        if other_class is self.__class__:\n            return self\n\n        # The default is to convert via cartesian coordinates.\n        self_cartesian = self.to_cartesian(base)\n        if issubclass(other_class, BaseDifferential):\n            return other_class.from_cartesian(self_cartesian, base)\n        else:\n            return other_class.from_cartesian(self_cartesian)\n\n    @classmethod\n    def from_representation(cls, representation, base):\n        \"\"\"Create a new instance of this representation from another one.\n\n        Parameters\n        ----------\n        representation : `~astropy.coordinates.BaseRepresentation` instance\n            The presentation that should be converted to this class.\n        base : instance of ``cls.base_representation``\n            The base relative to which the differentials will be defined. If\n            the representation is a differential itself, the base will be\n            converted to its ``base_representation`` to help convert it.\n        \"\"\"\n        if isinstance(representation, BaseDifferential):\n            cartesian = representation.to_cartesian(\n                base.represent_as(representation.base_representation))\n        else:\n            cartesian = representation.to_cartesian()\n\n        return cls.from_cartesian(cartesian, base)\n\n    def transform(self, matrix, base, transformed_base):\n        \"\"\"Transform differential using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new differential and does not modify the original one.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n        base : instance of ``cls.base_representation``\n            Base relative to which the differentials are defined.  If the other\n            class is a differential representation, the base will be converted\n            to its ``base_representation``.\n        transformed_base : instance of ``cls.base_representation``\n            Base relative to which the transformed differentials are defined.\n            If the other class is a differential representation, the base will\n            be converted to its ``base_representation``.\n        \"\"\"\n        # route transformation through Cartesian\n        cdiff = self.represent_as(CartesianDifferential, base=base\n                                  ).transform(matrix)\n        # move back to original representation\n        diff = cdiff.represent_as(self.__class__, transformed_base)\n        return diff\n\n    def _scale_operation(self, op, *args, scaled_base=False):\n        \"\"\"Scale all components.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.mul`, `~operator.neg`, etc.\n        *args\n            Any arguments required for the operator (typically, what is to\n            be multiplied with, divided by).\n        scaled_base : bool, optional\n            Whether the base was scaled the same way. This affects whether\n            differential components should be scaled. For instance, a differential\n            in longitude should not be scaled if its spherical base is scaled\n            in radius.\n        \"\"\"\n        scaled_attrs = [op(getattr(self, c), *args) for c in self.components]\n        return self.__class__(*scaled_attrs, copy=False)\n\n    def _combine_operation(self, op, other, reverse=False):\n        \"\"\"Combine two differentials, or a differential with a representation.\n\n        If ``other`` is of the same differential type as ``self``, the\n        components will simply be combined.  If ``other`` is a representation,\n        it will be used as a base for which to evaluate the differential,\n        and the result is a new representation.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.add`, `~operator.sub`, etc.\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The other differential or representation.\n        reverse : bool\n            Whether the operands should be reversed (e.g., as we got here via\n            ``self.__rsub__`` because ``self`` is a subclass of ``other``).\n        \"\"\"\n        if isinstance(self, type(other)):\n            first, second = (self, other) if not reverse else (other, self)\n            return self.__class__(*[op(getattr(first, c), getattr(second, c))\n                                    for c in self.components])\n        else:\n            try:\n                self_cartesian = self.to_cartesian(other)\n            except TypeError:\n                return NotImplemented\n\n            return other._combine_operation(op, self_cartesian, not reverse)\n\n    def __sub__(self, other):\n        # avoid \"differential - representation\".\n        if isinstance(other, BaseRepresentation):\n            return NotImplemented\n        return super().__sub__(other)\n\n    def norm(self, base=None):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.\n\n        Parameters\n        ----------\n        base : instance of ``self.base_representation``\n            Base relative to which the differentials are defined. This is\n            required to calculate the physical size of the differential for\n            all but Cartesian differentials or radial differentials.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\n        # RadialDifferential overrides this function, so there is no handling here\n        if not isinstance(self, CartesianDifferential) and base is None:\n            raise ValueError(\"`base` must be provided to calculate the norm of a\"\n                             f\" {type(self).__name__}\")\n        return self.to_cartesian(base).norm()"},{"fileName":"representation.py","filePath":"astropy/coordinates","id":14954,"nodeType":"File","text":"\"\"\"\nIn this module, we define the coordinate representation classes, which are\nused to represent low-level cartesian, spherical, cylindrical, and other\ncoordinates.\n\"\"\"\n\nimport abc\nimport functools\nimport operator\nimport inspect\nimport warnings\n\nimport numpy as np\nimport astropy.units as u\nfrom erfa import ufunc as erfa_ufunc\n\nfrom .angles import Angle, Longitude, Latitude\nfrom .distances import Distance\nfrom .matrix_utilities import is_O3\nfrom astropy.utils import ShapedLikeNDArray, classproperty\nfrom astropy.utils.data_info import MixinInfo\nfrom astropy.utils.exceptions import DuplicateRepresentationWarning\n\n\n__all__ = [\"BaseRepresentationOrDifferential\", \"BaseRepresentation\",\n           \"CartesianRepresentation\", \"SphericalRepresentation\",\n           \"UnitSphericalRepresentation\", \"RadialRepresentation\",\n           \"PhysicsSphericalRepresentation\", \"CylindricalRepresentation\",\n           \"BaseDifferential\", \"CartesianDifferential\",\n           \"BaseSphericalDifferential\", \"BaseSphericalCosLatDifferential\",\n           \"SphericalDifferential\", \"SphericalCosLatDifferential\",\n           \"UnitSphericalDifferential\", \"UnitSphericalCosLatDifferential\",\n           \"RadialDifferential\", \"CylindricalDifferential\",\n           \"PhysicsSphericalDifferential\"]\n\n# Module-level dict mapping representation string alias names to classes.\n# This is populated by __init_subclass__ when called by Representation or\n# Differential classes so that they are all registered automatically.\nREPRESENTATION_CLASSES = {}\nDIFFERENTIAL_CLASSES = {}\n# set for tracking duplicates\nDUPLICATE_REPRESENTATIONS = set()\n\n# a hash for the content of the above two dicts, cached for speed.\n_REPRDIFF_HASH = None\n\n\ndef _fqn_class(cls):\n    ''' Get the fully qualified name of a class '''\n    return cls.__module__ + '.' + cls.__qualname__\n\n\ndef get_reprdiff_cls_hash():\n    \"\"\"\n    Returns a hash value that should be invariable if the\n    `REPRESENTATION_CLASSES` and `DIFFERENTIAL_CLASSES` dictionaries have not\n    changed.\n    \"\"\"\n    global _REPRDIFF_HASH\n    if _REPRDIFF_HASH is None:\n        _REPRDIFF_HASH = (hash(tuple(REPRESENTATION_CLASSES.items())) +\n                          hash(tuple(DIFFERENTIAL_CLASSES.items())))\n    return _REPRDIFF_HASH\n\n\ndef _invalidate_reprdiff_cls_hash():\n    global _REPRDIFF_HASH\n    _REPRDIFF_HASH = None\n\n\ndef _array2string(values, prefix=''):\n    # Work around version differences for array2string.\n    kwargs = {'separator': ', ', 'prefix': prefix}\n    kwargs['formatter'] = {}\n\n    return np.array2string(values, **kwargs)\n\n\nclass BaseRepresentationOrDifferentialInfo(MixinInfo):\n    \"\"\"\n    Container for meta information like name, description, format.  This is\n    required when the object is used as a mixin column within a table, but can\n    be used as a general way to store meta information.\n    \"\"\"\n    attrs_from_parent = {'unit'}  # Indicates unit is read-only\n    _supports_indexing = False\n\n    @staticmethod\n    def default_format(val):\n        # Create numpy dtype so that numpy formatting will work.\n        components = val.components\n        values = tuple(getattr(val, component).value for component in components)\n        a = np.empty(getattr(val, 'shape', ()),\n                     [(component, value.dtype) for component, value\n                      in zip(components, values)])\n        for component, value in zip(components, values):\n            a[component] = value\n        return str(a)\n\n    @property\n    def _represent_as_dict_attrs(self):\n        return self._parent.components\n\n    @property\n    def unit(self):\n        if self._parent is None:\n            return None\n\n        unit = self._parent._unitstr\n        return unit[1:-1] if unit.startswith('(') else unit\n\n    def new_like(self, reps, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new instance like ``reps`` with ``length`` rows.\n\n        This is intended for creating an empty column object whose elements can\n        be set in-place for table operations like join or vstack.\n\n        Parameters\n        ----------\n        reps : list\n            List of input representations or differentials.\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : `BaseRepresentation` or `BaseDifferential` subclass instance\n            Empty instance of this class consistent with ``cols``\n\n        \"\"\"\n\n        # Get merged info attributes like shape, dtype, format, description, etc.\n        attrs = self.merge_cols_attributes(reps, metadata_conflicts, name,\n                                           ('meta', 'description'))\n        # Make a new representation or differential with the desired length\n        # using the _apply / __getitem__ machinery to effectively return\n        # rep0[[0, 0, ..., 0, 0]]. This will have the right shape, and\n        # include possible differentials.\n        indexes = np.zeros(length, dtype=np.int64)\n        out = reps[0][indexes]\n\n        # Use __setitem__ machinery to check whether all representations\n        # can represent themselves as this one without loss of information.\n        for rep in reps[1:]:\n            try:\n                out[0] = rep[0]\n            except Exception as err:\n                raise ValueError(f'input representations are inconsistent.') from err\n\n        # Set (merged) info attributes.\n        for attr in ('name', 'meta', 'description'):\n            if attr in attrs:\n                setattr(out.info, attr, attrs[attr])\n\n        return out\n\n\nclass BaseRepresentationOrDifferential(ShapedLikeNDArray):\n    \"\"\"3D coordinate representations and differentials.\n\n    Parameters\n    ----------\n    comp1, comp2, comp3 : `~astropy.units.Quantity` or subclass\n        The components of the 3D point or differential.  The names are the\n        keys and the subclasses the values of the ``attr_classes`` attribute.\n    copy : bool, optional\n        If `True` (default), arrays will be copied; if `False`, they will be\n        broadcast together but not use new memory.\n    \"\"\"\n\n    # Ensure multiplication/division with ndarray or Quantity doesn't lead to\n    # object arrays.\n    __array_priority__ = 50000\n\n    info = BaseRepresentationOrDifferentialInfo()\n\n    def __init__(self, *args, **kwargs):\n        # make argument a list, so we can pop them off.\n        args = list(args)\n        components = self.components\n        if (args and isinstance(args[0], self.__class__)\n                and all(arg is None for arg in args[1:])):\n            rep_or_diff = args[0]\n            copy = kwargs.pop('copy', True)\n            attrs = [getattr(rep_or_diff, component)\n                     for component in components]\n            if 'info' in rep_or_diff.__dict__:\n                self.info = rep_or_diff.info\n\n            if kwargs:\n                raise TypeError(f'unexpected keyword arguments for case '\n                                f'where class instance is passed in: {kwargs}')\n\n        else:\n            attrs = []\n            for component in components:\n                try:\n                    attr = args.pop(0) if args else kwargs.pop(component)\n                except KeyError:\n                    raise TypeError(f'__init__() missing 1 required positional '\n                                    f'argument: {component!r}') from None\n\n                if attr is None:\n                    raise TypeError(f'__init__() missing 1 required positional '\n                                    f'argument: {component!r} (or first '\n                                    f'argument should be an instance of '\n                                    f'{self.__class__.__name__}).')\n\n                attrs.append(attr)\n\n            copy = args.pop(0) if args else kwargs.pop('copy', True)\n\n            if args:\n                raise TypeError(f'unexpected arguments: {args}')\n\n            if kwargs:\n                for component in components:\n                    if component in kwargs:\n                        raise TypeError(f\"__init__() got multiple values for \"\n                                        f\"argument {component!r}\")\n\n                raise TypeError(f'unexpected keyword arguments: {kwargs}')\n\n        # Pass attributes through the required initializing classes.\n        attrs = [self.attr_classes[component](attr, copy=copy, subok=True)\n                 for component, attr in zip(components, attrs)]\n        try:\n            bc_attrs = np.broadcast_arrays(*attrs, subok=True)\n        except ValueError  as err:\n            if len(components) <= 2:\n                c_str = ' and '.join(components)\n            else:\n                c_str = ', '.join(components[:2]) + ', and ' + components[2]\n            raise ValueError(f\"Input parameters {c_str} cannot be broadcast\") from err\n\n        # The output of np.broadcast_arrays() has limitations on writeability, so we perform\n        # additional handling to enable writeability in most situations.  This is primarily\n        # relevant for allowing the changing of the wrap angle of longitude components.\n        #\n        # If the shape has changed for a given component, broadcasting is needed:\n        #     If copy=True, we make a copy of the broadcasted array to ensure writeability.\n        #         Note that array had already been copied prior to the broadcasting.\n        #         TODO: Find a way to avoid the double copy.\n        #     If copy=False, we use the broadcasted array, and writeability may still be\n        #         limited.\n        # If the shape has not changed for a given component, we can proceed with using the\n        #     non-broadcasted array, which avoids writeability issues from np.broadcast_arrays().\n        attrs = [(bc_attr.copy() if copy else bc_attr) if bc_attr.shape != attr.shape else attr\n                 for attr, bc_attr in zip(attrs, bc_attrs)]\n\n        # Set private attributes for the attributes. (If not defined explicitly\n        # on the class, the metaclass will define properties to access these.)\n        for component, attr in zip(components, attrs):\n            setattr(self, '_' + component, attr)\n\n    @classmethod\n    def get_name(cls):\n        \"\"\"Name of the representation or differential.\n\n        In lower case, with any trailing 'representation' or 'differential'\n        removed. (E.g., 'spherical' for\n        `~astropy.coordinates.SphericalRepresentation` or\n        `~astropy.coordinates.SphericalDifferential`.)\n        \"\"\"\n        name = cls.__name__.lower()\n\n        if name.endswith('representation'):\n            name = name[:-14]\n        elif name.endswith('differential'):\n            name = name[:-12]\n\n        return name\n\n    # The two methods that any subclass has to define.\n    @classmethod\n    @abc.abstractmethod\n    def from_cartesian(cls, other):\n        \"\"\"Create a representation of this class from a supplied Cartesian one.\n\n        Parameters\n        ----------\n        other : `CartesianRepresentation`\n            The representation to turn into this class\n\n        Returns\n        -------\n        representation : `BaseRepresentation` subclass instance\n            A new representation of this class's type.\n        \"\"\"\n        # Note: the above docstring gets overridden for differentials.\n        raise NotImplementedError()\n\n    @abc.abstractmethod\n    def to_cartesian(self):\n        \"\"\"Convert the representation to its Cartesian form.\n\n        Note that any differentials get dropped.\n        Also note that orientation information at the origin is *not* preserved by\n        conversions through Cartesian coordinates. For example, transforming\n        an angular position defined at distance=0 through cartesian coordinates\n        and back will lose the original angular coordinates::\n\n            >>> import astropy.units as u\n            >>> import astropy.coordinates as coord\n            >>> rep = coord.SphericalRepresentation(\n            ...     lon=15*u.deg,\n            ...     lat=-11*u.deg,\n            ...     distance=0*u.pc)\n            >>> rep.to_cartesian().represent_as(coord.SphericalRepresentation)\n            <SphericalRepresentation (lon, lat, distance) in (rad, rad, pc)\n                (0., 0., 0.)>\n\n        Returns\n        -------\n        cartrepr : `CartesianRepresentation`\n            The representation in Cartesian form.\n        \"\"\"\n        # Note: the above docstring gets overridden for differentials.\n        raise NotImplementedError()\n\n    @property\n    def components(self):\n        \"\"\"A tuple with the in-order names of the coordinate components.\"\"\"\n        return tuple(self.attr_classes)\n\n    def __eq__(self, value):\n        \"\"\"Equality operator\n\n        This implements strict equality and requires that the representation\n        classes are identical and that the representation data are exactly equal.\n        \"\"\"\n        if self.__class__ is not value.__class__:\n            raise TypeError(f'cannot compare: objects must have same class: '\n                            f'{self.__class__.__name__} vs. '\n                            f'{value.__class__.__name__}')\n\n        try:\n            np.broadcast(self, value)\n        except ValueError as exc:\n            raise ValueError(f'cannot compare: {exc}') from exc\n\n        out = True\n        for comp in self.components:\n            out &= (getattr(self, '_' + comp) == getattr(value, '_' + comp))\n\n        return out\n\n    def __ne__(self, value):\n        return np.logical_not(self == value)\n\n    def _apply(self, method, *args, **kwargs):\n        \"\"\"Create a new representation or differential with ``method`` applied\n        to the component data.\n\n        In typical usage, the method is any of the shape-changing methods for\n        `~numpy.ndarray` (``reshape``, ``swapaxes``, etc.), as well as those\n        picking particular elements (``__getitem__``, ``take``, etc.), which\n        are all defined in `~astropy.utils.shapes.ShapedLikeNDArray`. It will be\n        applied to the underlying arrays (e.g., ``x``, ``y``, and ``z`` for\n        `~astropy.coordinates.CartesianRepresentation`), with the results used\n        to create a new instance.\n\n        Internally, it is also used to apply functions to the components\n        (in particular, `~numpy.broadcast_to`).\n\n        Parameters\n        ----------\n        method : str or callable\n            If str, it is the name of a method that is applied to the internal\n            ``components``. If callable, the function is applied.\n        *args : tuple\n            Any positional arguments for ``method``.\n        **kwargs : dict\n            Any keyword arguments for ``method``.\n        \"\"\"\n        if callable(method):\n            apply_method = lambda array: method(array, *args, **kwargs)\n        else:\n            apply_method = operator.methodcaller(method, *args, **kwargs)\n\n        new = super().__new__(self.__class__)\n        for component in self.components:\n            setattr(new, '_' + component,\n                    apply_method(getattr(self, component)))\n\n        # Copy other 'info' attr only if it has actually been defined.\n        # See PR #3898 for further explanation and justification, along\n        # with Quantity.__array_finalize__\n        if 'info' in self.__dict__:\n            new.info = self.info\n\n        return new\n\n    def __setitem__(self, item, value):\n        if value.__class__ is not self.__class__:\n            raise TypeError(f'can only set from object of same class: '\n                            f'{self.__class__.__name__} vs. '\n                            f'{value.__class__.__name__}')\n\n        for component in self.components:\n            getattr(self, '_' + component)[item] = getattr(value, '_' + component)\n\n    @property\n    def shape(self):\n        \"\"\"The shape of the instance and underlying arrays.\n\n        Like `~numpy.ndarray.shape`, can be set to a new shape by assigning a\n        tuple.  Note that if different instances share some but not all\n        underlying data, setting the shape of one instance can make the other\n        instance unusable.  Hence, it is strongly recommended to get new,\n        reshaped instances with the ``reshape`` method.\n\n        Raises\n        ------\n        ValueError\n            If the new shape has the wrong total number of elements.\n        AttributeError\n            If the shape of any of the components cannot be changed without the\n            arrays being copied.  For these cases, use the ``reshape`` method\n            (which copies any arrays that cannot be reshaped in-place).\n        \"\"\"\n        return getattr(self, self.components[0]).shape\n\n    @shape.setter\n    def shape(self, shape):\n        # We keep track of arrays that were already reshaped since we may have\n        # to return those to their original shape if a later shape-setting\n        # fails. (This can happen since coordinates are broadcast together.)\n        reshaped = []\n        oldshape = self.shape\n        for component in self.components:\n            val = getattr(self, component)\n            if val.size > 1:\n                try:\n                    val.shape = shape\n                except Exception:\n                    for val2 in reshaped:\n                        val2.shape = oldshape\n                    raise\n                else:\n                    reshaped.append(val)\n\n    # Required to support multiplication and division, and defined by the base\n    # representation and differential classes.\n    @abc.abstractmethod\n    def _scale_operation(self, op, *args):\n        raise NotImplementedError()\n\n    def __mul__(self, other):\n        return self._scale_operation(operator.mul, other)\n\n    def __rmul__(self, other):\n        return self.__mul__(other)\n\n    def __truediv__(self, other):\n        return self._scale_operation(operator.truediv, other)\n\n    def __neg__(self):\n        return self._scale_operation(operator.neg)\n\n    # Follow numpy convention and make an independent copy.\n    def __pos__(self):\n        return self.copy()\n\n    # Required to support addition and subtraction, and defined by the base\n    # representation and differential classes.\n    @abc.abstractmethod\n    def _combine_operation(self, op, other, reverse=False):\n        raise NotImplementedError()\n\n    def __add__(self, other):\n        return self._combine_operation(operator.add, other)\n\n    def __radd__(self, other):\n        return self._combine_operation(operator.add, other, reverse=True)\n\n    def __sub__(self, other):\n        return self._combine_operation(operator.sub, other)\n\n    def __rsub__(self, other):\n        return self._combine_operation(operator.sub, other, reverse=True)\n\n    # The following are used for repr and str\n    @property\n    def _values(self):\n        \"\"\"Turn the coordinates into a record array with the coordinate values.\n\n        The record array fields will have the component names.\n        \"\"\"\n        coo_items = [(c, getattr(self, c)) for c in self.components]\n        result = np.empty(self.shape, [(c, coo.dtype) for c, coo in coo_items])\n        for c, coo in coo_items:\n            result[c] = coo.value\n        return result\n\n    @property\n    def _units(self):\n        \"\"\"Return a dictionary with the units of the coordinate components.\"\"\"\n        return dict([(component, getattr(self, component).unit)\n                     for component in self.components])\n\n    @property\n    def _unitstr(self):\n        units_set = set(self._units.values())\n        if len(units_set) == 1:\n            unitstr = units_set.pop().to_string()\n        else:\n            unitstr = '({})'.format(\n                ', '.join([self._units[component].to_string()\n                           for component in self.components]))\n        return unitstr\n\n    def __str__(self):\n        return f'{_array2string(self._values)} {self._unitstr:s}'\n\n    def __repr__(self):\n        prefixstr = '    '\n        arrstr = _array2string(self._values, prefix=prefixstr)\n\n        diffstr = ''\n        if getattr(self, 'differentials', None):\n            diffstr = '\\n (has differentials w.r.t.: {})'.format(\n                ', '.join([repr(key) for key in self.differentials.keys()]))\n\n        unitstr = ('in ' + self._unitstr) if self._unitstr else '[dimensionless]'\n        return '<{} ({}) {:s}\\n{}{}{}>'.format(\n            self.__class__.__name__, ', '.join(self.components),\n            unitstr, prefixstr, arrstr, diffstr)\n\n\ndef _make_getter(component):\n    \"\"\"Make an attribute getter for use in a property.\n\n    Parameters\n    ----------\n    component : str\n        The name of the component that should be accessed.  This assumes the\n        actual value is stored in an attribute of that name prefixed by '_'.\n    \"\"\"\n    # This has to be done in a function to ensure the reference to component\n    # is not lost/redirected.\n    component = '_' + component\n\n    def get_component(self):\n        return getattr(self, component)\n    return get_component\n\n\nclass RepresentationInfo(BaseRepresentationOrDifferentialInfo):\n\n    @property\n    def _represent_as_dict_attrs(self):\n        attrs = super()._represent_as_dict_attrs\n        if self._parent._differentials:\n            attrs += ('differentials',)\n        return attrs\n\n    def _represent_as_dict(self, attrs=None):\n        out = super()._represent_as_dict(attrs)\n        for key, value in out.pop('differentials', {}).items():\n            out[f'differentials.{key}'] = value\n        return out\n\n    def _construct_from_dict(self, map):\n        differentials = {}\n        for key in list(map.keys()):\n            if key.startswith('differentials.'):\n                differentials[key[14:]] = map.pop(key)\n        map['differentials'] = differentials\n        return super()._construct_from_dict(map)\n\n\nclass BaseRepresentation(BaseRepresentationOrDifferential):\n    \"\"\"Base for representing a point in a 3D coordinate system.\n\n    Parameters\n    ----------\n    comp1, comp2, comp3 : `~astropy.units.Quantity` or subclass\n        The components of the 3D points.  The names are the keys and the\n        subclasses the values of the ``attr_classes`` attribute.\n    differentials : dict, `~astropy.coordinates.BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `~astropy.coordinates.BaseDifferential`\n        subclass instance, or a dictionary with keys set to a string\n        representation of the SI unit with which the differential (derivative)\n        is taken. For example, for a velocity differential on a positional\n        representation, the key would be ``'s'`` for seconds, indicating that\n        the derivative is a time derivative.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n\n    Notes\n    -----\n    All representation classes should subclass this base representation class,\n    and define an ``attr_classes`` attribute, a `dict`\n    which maps component names to the class that creates them. They must also\n    define a ``to_cartesian`` method and a ``from_cartesian`` class method. By\n    default, transformations are done via the cartesian system, but classes\n    that want to define a smarter transformation path can overload the\n    ``represent_as`` method. If one wants to use an associated differential\n    class, one should also define ``unit_vectors`` and ``scale_factors``\n    methods (see those methods for details).\n    \"\"\"\n\n    info = RepresentationInfo()\n\n    def __init_subclass__(cls, **kwargs):\n        # Register representation name (except for BaseRepresentation)\n        if cls.__name__ == 'BaseRepresentation':\n            return\n\n        if not hasattr(cls, 'attr_classes'):\n            raise NotImplementedError('Representations must have an '\n                                      '\"attr_classes\" class attribute.')\n\n        repr_name = cls.get_name()\n        # first time a duplicate is added\n        # remove first entry and add both using their qualnames\n        if repr_name in REPRESENTATION_CLASSES:\n            DUPLICATE_REPRESENTATIONS.add(repr_name)\n\n            fqn_cls = _fqn_class(cls)\n            existing = REPRESENTATION_CLASSES[repr_name]\n            fqn_existing = _fqn_class(existing)\n\n            if fqn_cls == fqn_existing:\n                raise ValueError(f'Representation \"{fqn_cls}\" already defined')\n\n            msg = (\n                f'Representation \"{repr_name}\" already defined, removing it to avoid confusion.'\n                f'Use qualnames \"{fqn_cls}\" and \"{fqn_existing}\" or class instances directly'\n            )\n            warnings.warn(msg, DuplicateRepresentationWarning)\n\n            del REPRESENTATION_CLASSES[repr_name]\n            REPRESENTATION_CLASSES[fqn_existing] = existing\n            repr_name = fqn_cls\n\n        # further definitions with the same name, just add qualname\n        elif repr_name in DUPLICATE_REPRESENTATIONS:\n            fqn_cls = _fqn_class(cls)\n            warnings.warn(f'Representation \"{repr_name}\" already defined, using qualname '\n                          f'\"{fqn_cls}\".')\n            repr_name = fqn_cls\n            if repr_name in REPRESENTATION_CLASSES:\n                raise ValueError(\n                    f'Representation \"{repr_name}\" already defined'\n                )\n\n        REPRESENTATION_CLASSES[repr_name] = cls\n        _invalidate_reprdiff_cls_hash()\n\n        # define getters for any component that does not yet have one.\n        for component in cls.attr_classes:\n            if not hasattr(cls, component):\n                setattr(cls, component,\n                        property(_make_getter(component),\n                                 doc=f\"The '{component}' component of the points(s).\"))\n\n        super().__init_subclass__(**kwargs)\n\n    def __init__(self, *args, differentials=None, **kwargs):\n        # Handle any differentials passed in.\n        super().__init__(*args, **kwargs)\n        if (differentials is None\n                and args and isinstance(args[0], self.__class__)):\n            differentials = args[0]._differentials\n        self._differentials = self._validate_differentials(differentials)\n\n    def _validate_differentials(self, differentials):\n        \"\"\"\n        Validate that the provided differentials are appropriate for this\n        representation and recast/reshape as necessary and then return.\n\n        Note that this does *not* set the differentials on\n        ``self._differentials``, but rather leaves that for the caller.\n        \"\"\"\n\n        # Now handle the actual validation of any specified differential classes\n        if differentials is None:\n            differentials = dict()\n\n        elif isinstance(differentials, BaseDifferential):\n            # We can't handle auto-determining the key for this combo\n            if (isinstance(differentials, RadialDifferential) and\n                    isinstance(self, UnitSphericalRepresentation)):\n                raise ValueError(\"To attach a RadialDifferential to a \"\n                                 \"UnitSphericalRepresentation, you must supply \"\n                                 \"a dictionary with an appropriate key.\")\n\n            key = differentials._get_deriv_key(self)\n            differentials = {key: differentials}\n\n        for key in differentials:\n            try:\n                diff = differentials[key]\n            except TypeError as err:\n                raise TypeError(\"'differentials' argument must be a \"\n                                \"dictionary-like object\") from err\n\n            diff._check_base(self)\n\n            if (isinstance(diff, RadialDifferential) and\n                    isinstance(self, UnitSphericalRepresentation)):\n                # We trust the passing of a key for a RadialDifferential\n                # attached to a UnitSphericalRepresentation because it will not\n                # have a paired component name (UnitSphericalRepresentation has\n                # no .distance) to automatically determine the expected key\n                pass\n\n            else:\n                expected_key = diff._get_deriv_key(self)\n                if key != expected_key:\n                    raise ValueError(\"For differential object '{}', expected \"\n                                     \"unit key = '{}' but received key = '{}'\"\n                                     .format(repr(diff), expected_key, key))\n\n            # For now, we are very rigid: differentials must have the same shape\n            # as the representation. This makes it easier to handle __getitem__\n            # and any other shape-changing operations on representations that\n            # have associated differentials\n            if diff.shape != self.shape:\n                # TODO: message of IncompatibleShapeError is not customizable,\n                #       so use a valueerror instead?\n                raise ValueError(\"Shape of differentials must be the same \"\n                                 \"as the shape of the representation ({} vs \"\n                                 \"{})\".format(diff.shape, self.shape))\n\n        return differentials\n\n    def _raise_if_has_differentials(self, op_name):\n        \"\"\"\n        Used to raise a consistent exception for any operation that is not\n        supported when a representation has differentials attached.\n        \"\"\"\n        if self.differentials:\n            raise TypeError(\"Operation '{}' is not supported when \"\n                            \"differentials are attached to a {}.\"\n                            .format(op_name, self.__class__.__name__))\n\n    @classproperty\n    def _compatible_differentials(cls):\n        return [DIFFERENTIAL_CLASSES[cls.get_name()]]\n\n    @property\n    def differentials(self):\n        \"\"\"A dictionary of differential class instances.\n\n        The keys of this dictionary must be a string representation of the SI\n        unit with which the differential (derivative) is taken. For example, for\n        a velocity differential on a positional representation, the key would be\n        ``'s'`` for seconds, indicating that the derivative is a time\n        derivative.\n        \"\"\"\n        return self._differentials\n\n    # We do not make unit_vectors and scale_factors abstract methods, since\n    # they are only necessary if one also defines an associated Differential.\n    # Also, doing so would break pre-differential representation subclasses.\n    def unit_vectors(self):\n        r\"\"\"Cartesian unit vectors in the direction of each component.\n\n        Given unit vectors :math:`\\hat{e}_c` and scale factors :math:`f_c`,\n        a change in one component of :math:`\\delta c` corresponds to a change\n        in representation of :math:`\\delta c \\times f_c \\times \\hat{e}_c`.\n\n        Returns\n        -------\n        unit_vectors : dict of `CartesianRepresentation`\n            The keys are the component names.\n        \"\"\"\n        raise NotImplementedError(f\"{type(self)} has not implemented unit vectors\")\n\n    def scale_factors(self):\n        r\"\"\"Scale factors for each component's direction.\n\n        Given unit vectors :math:`\\hat{e}_c` and scale factors :math:`f_c`,\n        a change in one component of :math:`\\delta c` corresponds to a change\n        in representation of :math:`\\delta c \\times f_c \\times \\hat{e}_c`.\n\n        Returns\n        -------\n        scale_factors : dict of `~astropy.units.Quantity`\n            The keys are the component names.\n        \"\"\"\n        raise NotImplementedError(f\"{type(self)} has not implemented scale factors.\")\n\n    def _re_represent_differentials(self, new_rep, differential_class):\n        \"\"\"Re-represent the differentials to the specified classes.\n\n        This returns a new dictionary with the same keys but with the\n        attached differentials converted to the new differential classes.\n        \"\"\"\n        if differential_class is None:\n            return dict()\n\n        if not self.differentials and differential_class:\n            raise ValueError(\"No differentials associated with this \"\n                             \"representation!\")\n\n        elif (len(self.differentials) == 1 and\n                inspect.isclass(differential_class) and\n                issubclass(differential_class, BaseDifferential)):\n            # TODO: is there a better way to do this?\n            differential_class = {\n                list(self.differentials.keys())[0]: differential_class\n            }\n\n        elif differential_class.keys() != self.differentials.keys():\n            raise ValueError(\"Desired differential classes must be passed in \"\n                             \"as a dictionary with keys equal to a string \"\n                             \"representation of the unit of the derivative \"\n                             \"for each differential stored with this \"\n                             \"representation object ({0})\"\n                             .format(self.differentials))\n\n        new_diffs = dict()\n        for k in self.differentials:\n            diff = self.differentials[k]\n            try:\n                new_diffs[k] = diff.represent_as(differential_class[k],\n                                                 base=self)\n            except Exception as err:\n                if (differential_class[k] not in\n                        new_rep._compatible_differentials):\n                    raise TypeError(\"Desired differential class {} is not \"\n                                    \"compatible with the desired \"\n                                    \"representation class {}\"\n                                    .format(differential_class[k],\n                                            new_rep.__class__)) from err\n                else:\n                    raise\n\n        return new_diffs\n\n    def represent_as(self, other_class, differential_class=None):\n        \"\"\"Convert coordinates to another representation.\n\n        If the instance is of the requested class, it is returned unmodified.\n        By default, conversion is done via Cartesian coordinates.\n        Also note that orientation information at the origin is *not* preserved by\n        conversions through Cartesian coordinates. See the docstring for\n        :meth:`~astropy.coordinates.BaseRepresentationOrDifferential.to_cartesian`\n        for an example.\n\n        Parameters\n        ----------\n        other_class : `~astropy.coordinates.BaseRepresentation` subclass\n            The type of representation to turn the coordinates into.\n        differential_class : dict of `~astropy.coordinates.BaseDifferential`, optional\n            Classes in which the differentials should be represented.\n            Can be a single class if only a single differential is attached,\n            otherwise it should be a `dict` keyed by the same keys as the\n            differentials.\n        \"\"\"\n        if other_class is self.__class__ and not differential_class:\n            return self.without_differentials()\n\n        else:\n            if isinstance(other_class, str):\n                raise ValueError(\"Input to a representation's represent_as \"\n                                 \"must be a class, not a string. For \"\n                                 \"strings, use frame objects\")\n\n            if other_class is not self.__class__:\n                # The default is to convert via cartesian coordinates\n                new_rep = other_class.from_cartesian(self.to_cartesian())\n            else:\n                new_rep = self\n\n            new_rep._differentials = self._re_represent_differentials(\n                new_rep, differential_class)\n\n            return new_rep\n\n    def transform(self, matrix):\n        \"\"\"Transform coordinates using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n\n        \"\"\"\n        # route transformation through Cartesian\n        difs_cls = {k: CartesianDifferential for k in self.differentials.keys()}\n        crep = self.represent_as(CartesianRepresentation,\n                                 differential_class=difs_cls\n                                ).transform(matrix)\n\n        # move back to original representation\n        difs_cls = {k: diff.__class__ for k, diff in self.differentials.items()}\n        rep = crep.represent_as(self.__class__, difs_cls)\n        return rep\n\n    def with_differentials(self, differentials):\n        \"\"\"\n        Create a new representation with the same positions as this\n        representation, but with these new differentials.\n\n        Differential keys that already exist in this object's differential dict\n        are overwritten.\n\n        Parameters\n        ----------\n        differentials : sequence of `~astropy.coordinates.BaseDifferential` subclass instance\n            The differentials for the new representation to have.\n\n        Returns\n        -------\n        `~astropy.coordinates.BaseRepresentation` subclass instance\n            A copy of this representation, but with the ``differentials`` as\n            its differentials.\n        \"\"\"\n        if not differentials:\n            return self\n\n        args = [getattr(self, component) for component in self.components]\n\n        # We shallow copy the differentials dictionary so we don't update the\n        # current object's dictionary when adding new keys\n        new_rep = self.__class__(*args, differentials=self.differentials.copy(),\n                                 copy=False)\n        new_rep._differentials.update(\n            new_rep._validate_differentials(differentials))\n\n        return new_rep\n\n    def without_differentials(self):\n        \"\"\"Return a copy of the representation without attached differentials.\n\n        Returns\n        -------\n        `~astropy.coordinates.BaseRepresentation` subclass instance\n            A shallow copy of this representation, without any differentials.\n            If no differentials were present, no copy is made.\n        \"\"\"\n\n        if not self._differentials:\n            return self\n\n        args = [getattr(self, component) for component in self.components]\n        return self.__class__(*args, copy=False)\n\n    @classmethod\n    def from_representation(cls, representation):\n        \"\"\"Create a new instance of this representation from another one.\n\n        Parameters\n        ----------\n        representation : `~astropy.coordinates.BaseRepresentation` instance\n            The presentation that should be converted to this class.\n        \"\"\"\n        return representation.represent_as(cls)\n\n    def __eq__(self, value):\n        \"\"\"Equality operator for BaseRepresentation\n\n        This implements strict equality and requires that the representation\n        classes are identical, the differentials are identical, and that the\n        representation data are exactly equal.\n        \"\"\"\n        # BaseRepresentationOrDifferental (checks classes and compares components)\n        out = super().__eq__(value)\n\n        # super() checks that the class is identical so can this even happen?\n        # (same class, different differentials ?)\n        if self._differentials.keys() != value._differentials.keys():\n            raise ValueError(f'cannot compare: objects must have same differentials')\n\n        for self_diff, value_diff in zip(self._differentials.values(),\n                                         value._differentials.values()):\n            out &= (self_diff == value_diff)\n\n        return out\n\n    def __ne__(self, value):\n        return np.logical_not(self == value)\n\n    def _apply(self, method, *args, **kwargs):\n        \"\"\"Create a new representation with ``method`` applied to the component\n        data.\n\n        This is not a simple inherit from ``BaseRepresentationOrDifferential``\n        because we need to call ``._apply()`` on any associated differential\n        classes.\n\n        See docstring for `BaseRepresentationOrDifferential._apply`.\n\n        Parameters\n        ----------\n        method : str or callable\n            If str, it is the name of a method that is applied to the internal\n            ``components``. If callable, the function is applied.\n        *args : tuple\n            Any positional arguments for ``method``.\n        **kwargs : dict\n            Any keyword arguments for ``method``.\n\n        \"\"\"\n        rep = super()._apply(method, *args, **kwargs)\n\n        rep._differentials = dict(\n            [(k, diff._apply(method, *args, **kwargs))\n             for k, diff in self._differentials.items()])\n        return rep\n\n    def __setitem__(self, item, value):\n        if not isinstance(value, BaseRepresentation):\n            raise TypeError(f'value must be a representation instance, '\n                            f'not {type(value)}.')\n\n        if not (isinstance(value, self.__class__)\n                or len(value.attr_classes) == len(self.attr_classes)):\n            raise ValueError(\n                f'value must be representable as {self.__class__.__name__} '\n                f'without loss of information.')\n\n        diff_classes = {}\n        if self._differentials:\n            if self._differentials.keys() != value._differentials.keys():\n                raise ValueError('value must have the same differentials.')\n\n            for key, self_diff in self._differentials.items():\n                diff_classes[key] = self_diff_cls = self_diff.__class__\n                value_diff_cls = value._differentials[key].__class__\n                if not (isinstance(value_diff_cls, self_diff_cls)\n                        or (len(value_diff_cls.attr_classes)\n                            == len(self_diff_cls.attr_classes))):\n                    raise ValueError(\n                        f'value differential {key!r} must be representable as '\n                        f'{self_diff.__class__.__name__} without loss of information.')\n\n        value = value.represent_as(self.__class__, diff_classes)\n        super().__setitem__(item, value)\n        for key, differential in self._differentials.items():\n            differential[item] = value._differentials[key]\n\n    def _scale_operation(self, op, *args):\n        \"\"\"Scale all non-angular components, leaving angular ones unchanged.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.mul`, `~operator.neg`, etc.\n        *args\n            Any arguments required for the operator (typically, what is to\n            be multiplied with, divided by).\n        \"\"\"\n        results = []\n        for component, cls in self.attr_classes.items():\n            value = getattr(self, component)\n            if issubclass(cls, Angle):\n                results.append(value)\n            else:\n                results.append(op(value, *args))\n\n        # try/except catches anything that cannot initialize the class, such\n        # as operations that returned NotImplemented or a representation\n        # instead of a quantity (as would happen for, e.g., rep * rep).\n        try:\n            result = self.__class__(*results)\n        except Exception:\n            return NotImplemented\n\n        for key, differential in self.differentials.items():\n            diff_result = differential._scale_operation(op, *args, scaled_base=True)\n            result.differentials[key] = diff_result\n\n        return result\n\n    def _combine_operation(self, op, other, reverse=False):\n        \"\"\"Combine two representation.\n\n        By default, operate on the cartesian representations of both.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.add`, `~operator.sub`, etc.\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The other representation.\n        reverse : bool\n            Whether the operands should be reversed (e.g., as we got here via\n            ``self.__rsub__`` because ``self`` is a subclass of ``other``).\n        \"\"\"\n        self._raise_if_has_differentials(op.__name__)\n\n        result = self.to_cartesian()._combine_operation(op, other, reverse)\n        if result is NotImplemented:\n            return NotImplemented\n        else:\n            return self.from_cartesian(result)\n\n    # We need to override this setter to support differentials\n    @BaseRepresentationOrDifferential.shape.setter\n    def shape(self, shape):\n        orig_shape = self.shape\n\n        # See: https://stackoverflow.com/questions/3336767/ for an example\n        BaseRepresentationOrDifferential.shape.fset(self, shape)\n\n        # also try to perform shape-setting on any associated differentials\n        try:\n            for k in self.differentials:\n                self.differentials[k].shape = shape\n        except Exception:\n            BaseRepresentationOrDifferential.shape.fset(self, orig_shape)\n            for k in self.differentials:\n                self.differentials[k].shape = orig_shape\n\n            raise\n\n    def norm(self):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.\n\n        Note that any associated differentials will be dropped during this\n        operation.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\n        return np.sqrt(functools.reduce(\n            operator.add, (getattr(self, component)**2\n                           for component, cls in self.attr_classes.items()\n                           if not issubclass(cls, Angle))))\n\n    def mean(self, *args, **kwargs):\n        \"\"\"Vector mean.\n\n        Averaging is done by converting the representation to cartesian, and\n        taking the mean of the x, y, and z components. The result is converted\n        back to the same representation as the input.\n\n        Refer to `~numpy.mean` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n\n        Returns\n        -------\n        mean : `~astropy.coordinates.BaseRepresentation` subclass instance\n            Vector mean, in the same representation as that of the input.\n        \"\"\"\n        self._raise_if_has_differentials('mean')\n        return self.from_cartesian(self.to_cartesian().mean(*args, **kwargs))\n\n    def sum(self, *args, **kwargs):\n        \"\"\"Vector sum.\n\n        Adding is done by converting the representation to cartesian, and\n        summing the x, y, and z components. The result is converted back to the\n        same representation as the input.\n\n        Refer to `~numpy.sum` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n\n        Returns\n        -------\n        sum : `~astropy.coordinates.BaseRepresentation` subclass instance\n            Vector sum, in the same representation as that of the input.\n        \"\"\"\n        self._raise_if_has_differentials('sum')\n        return self.from_cartesian(self.to_cartesian().sum(*args, **kwargs))\n\n    def dot(self, other):\n        \"\"\"Dot product of two representations.\n\n        The calculation is done by converting both ``self`` and ``other``\n        to `~astropy.coordinates.CartesianRepresentation`.\n\n        Note that any associated differentials will be dropped during this\n        operation.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation`\n            The representation to take the dot product with.\n\n        Returns\n        -------\n        dot_product : `~astropy.units.Quantity`\n            The sum of the product of the x, y, and z components of the\n            cartesian representations of ``self`` and ``other``.\n        \"\"\"\n        return self.to_cartesian().dot(other)\n\n    def cross(self, other):\n        \"\"\"Vector cross product of two representations.\n\n        The calculation is done by converting both ``self`` and ``other``\n        to `~astropy.coordinates.CartesianRepresentation`, and converting the\n        result back to the type of representation of ``self``.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The representation to take the cross product with.\n\n        Returns\n        -------\n        cross_product : `~astropy.coordinates.BaseRepresentation` subclass instance\n            With vectors perpendicular to both ``self`` and ``other``, in the\n            same type of representation as ``self``.\n        \"\"\"\n        self._raise_if_has_differentials('cross')\n        return self.from_cartesian(self.to_cartesian().cross(other))\n\n\nclass CartesianRepresentation(BaseRepresentation):\n    \"\"\"\n    Representation of points in 3D cartesian coordinates.\n\n    Parameters\n    ----------\n    x, y, z : `~astropy.units.Quantity` or array\n        The x, y, and z coordinates of the point(s). If ``x``, ``y``, and ``z``\n        have different shapes, they should be broadcastable. If not quantity,\n        ``unit`` should be set.  If only ``x`` is given, it is assumed that it\n        contains an array with the 3 coordinates stored along ``xyz_axis``.\n    unit : unit-like\n        If given, the coordinates will be converted to this unit (or taken to\n        be in this unit if not given.\n    xyz_axis : int, optional\n        The axis along which the coordinates are stored when a single array is\n        provided rather than distinct ``x``, ``y``, and ``z`` (default: 0).\n\n    differentials : dict, `CartesianDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single\n        `CartesianDifferential` instance, or a dictionary of\n        `CartesianDifferential` s with keys set to a string representation of\n        the SI unit with which the differential (derivative) is taken. For\n        example, for a velocity differential on a positional representation, the\n        key would be ``'s'`` for seconds, indicating that the derivative is a\n        time derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n\n    attr_classes = {'x': u.Quantity,\n                    'y': u.Quantity,\n                    'z': u.Quantity}\n\n    _xyz = None\n\n    def __init__(self, x, y=None, z=None, unit=None, xyz_axis=None,\n                 differentials=None, copy=True):\n\n        if y is None and z is None:\n            if isinstance(x, np.ndarray) and x.dtype.kind not in 'OV':\n                # Short-cut for 3-D array input.\n                x = u.Quantity(x, unit, copy=copy, subok=True)\n                # Keep a link to the array with all three coordinates\n                # so that we can return it quickly if needed in get_xyz.\n                self._xyz = x\n                if xyz_axis:\n                    x = np.moveaxis(x, xyz_axis, 0)\n                    self._xyz_axis = xyz_axis\n                else:\n                    self._xyz_axis = 0\n\n                self._x, self._y, self._z = x\n                self._differentials = self._validate_differentials(differentials)\n                return\n\n            elif (isinstance(x, CartesianRepresentation)\n                  and unit is None and xyz_axis is None):\n                if differentials is None:\n                    differentials = x._differentials\n\n                return super().__init__(x, differentials=differentials,\n                                        copy=copy)\n\n            else:\n                x, y, z = x\n\n        if xyz_axis is not None:\n            raise ValueError(\"xyz_axis should only be set if x, y, and z are \"\n                             \"in a single array passed in through x, \"\n                             \"i.e., y and z should not be not given.\")\n\n        if y is None or z is None:\n            raise ValueError(\"x, y, and z are required to instantiate {}\"\n                             .format(self.__class__.__name__))\n\n        if unit is not None:\n            x = u.Quantity(x, unit, copy=copy, subok=True)\n            y = u.Quantity(y, unit, copy=copy, subok=True)\n            z = u.Quantity(z, unit, copy=copy, subok=True)\n            copy = False\n\n        super().__init__(x, y, z, copy=copy, differentials=differentials)\n        if not (self._x.unit.is_equivalent(self._y.unit) and\n                self._x.unit.is_equivalent(self._z.unit)):\n            raise u.UnitsError(\"x, y, and z should have matching physical types\")\n\n    def unit_vectors(self):\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        o = np.broadcast_to(0.*u.one, self.shape, subok=True)\n        return {\n            'x': CartesianRepresentation(l, o, o, copy=False),\n            'y': CartesianRepresentation(o, l, o, copy=False),\n            'z': CartesianRepresentation(o, o, l, copy=False)}\n\n    def scale_factors(self):\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return {'x': l, 'y': l, 'z': l}\n\n    def get_xyz(self, xyz_axis=0):\n        \"\"\"Return a vector array of the x, y, and z coordinates.\n\n        Parameters\n        ----------\n        xyz_axis : int, optional\n            The axis in the final array along which the x, y, z components\n            should be stored (default: 0).\n\n        Returns\n        -------\n        xyz : `~astropy.units.Quantity`\n            With dimension 3 along ``xyz_axis``.  Note that, if possible,\n            this will be a view.\n        \"\"\"\n        if self._xyz is not None:\n            if self._xyz_axis == xyz_axis:\n                return self._xyz\n            else:\n                return np.moveaxis(self._xyz, self._xyz_axis, xyz_axis)\n\n        # Create combined array.  TO DO: keep it in _xyz for repeated use?\n        # But then in-place changes have to cancel it. Likely best to\n        # also update components.\n        return np.stack([self._x, self._y, self._z], axis=xyz_axis)\n\n    xyz = property(get_xyz)\n\n    @classmethod\n    def from_cartesian(cls, other):\n        return other\n\n    def to_cartesian(self):\n        return self\n\n    def transform(self, matrix):\n        \"\"\"\n        Transform the cartesian coordinates using a 3x3 matrix.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : ndarray\n            A 3x3 transformation matrix, such as a rotation matrix.\n\n        Examples\n        --------\n\n        We can start off by creating a cartesian representation object:\n\n            >>> from astropy import units as u\n            >>> from astropy.coordinates import CartesianRepresentation\n            >>> rep = CartesianRepresentation([1, 2] * u.pc,\n            ...                               [2, 3] * u.pc,\n            ...                               [3, 4] * u.pc)\n\n        We now create a rotation matrix around the z axis:\n\n            >>> from astropy.coordinates.matrix_utilities import rotation_matrix\n            >>> rotation = rotation_matrix(30 * u.deg, axis='z')\n\n        Finally, we can apply this transformation:\n\n            >>> rep_new = rep.transform(rotation)\n            >>> rep_new.xyz  # doctest: +FLOAT_CMP\n            <Quantity [[ 1.8660254 , 3.23205081],\n                       [ 1.23205081, 1.59807621],\n                       [ 3.        , 4.        ]] pc>\n        \"\"\"\n        # erfa rxp: Multiply a p-vector by an r-matrix.\n        p = erfa_ufunc.rxp(matrix, self.get_xyz(xyz_axis=-1))\n        # transformed representation\n        rep = self.__class__(p, xyz_axis=-1, copy=False)\n        # Handle differentials attached to this representation\n        new_diffs = dict((k, d.transform(matrix, self, rep))\n                         for k, d in self.differentials.items())\n        return rep.with_differentials(new_diffs)\n\n    def _combine_operation(self, op, other, reverse=False):\n        self._raise_if_has_differentials(op.__name__)\n\n        try:\n            other_c = other.to_cartesian()\n        except Exception:\n            return NotImplemented\n\n        first, second = ((self, other_c) if not reverse else\n                         (other_c, self))\n        return self.__class__(*(op(getattr(first, component),\n                                   getattr(second, component))\n                                for component in first.components))\n\n    def norm(self):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.\n\n        Note that any associated differentials will be dropped during this\n        operation.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\n        # erfa pm: Modulus of p-vector.\n        return erfa_ufunc.pm(self.get_xyz(xyz_axis=-1))\n\n    def mean(self, *args, **kwargs):\n        \"\"\"Vector mean.\n\n        Returns a new CartesianRepresentation instance with the means of the\n        x, y, and z components.\n\n        Refer to `~numpy.mean` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n        \"\"\"\n        self._raise_if_has_differentials('mean')\n        return self._apply('mean', *args, **kwargs)\n\n    def sum(self, *args, **kwargs):\n        \"\"\"Vector sum.\n\n        Returns a new CartesianRepresentation instance with the sums of the\n        x, y, and z components.\n\n        Refer to `~numpy.sum` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n        \"\"\"\n        self._raise_if_has_differentials('sum')\n        return self._apply('sum', *args, **kwargs)\n\n    def dot(self, other):\n        \"\"\"Dot product of two representations.\n\n        Note that any associated differentials will be dropped during this\n        operation.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            If not already cartesian, it is converted.\n\n        Returns\n        -------\n        dot_product : `~astropy.units.Quantity`\n            The sum of the product of the x, y, and z components of ``self``\n            and ``other``.\n        \"\"\"\n        try:\n            other_c = other.to_cartesian()\n        except Exception as err:\n            raise TypeError(\"cannot only take dot product with another \"\n                            \"representation, not a {} instance.\"\n                            .format(type(other))) from err\n        # erfa pdp: p-vector inner (=scalar=dot) product.\n        return erfa_ufunc.pdp(self.get_xyz(xyz_axis=-1),\n                              other_c.get_xyz(xyz_axis=-1))\n\n    def cross(self, other):\n        \"\"\"Cross product of two representations.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            If not already cartesian, it is converted.\n\n        Returns\n        -------\n        cross_product : `~astropy.coordinates.CartesianRepresentation`\n            With vectors perpendicular to both ``self`` and ``other``.\n        \"\"\"\n        self._raise_if_has_differentials('cross')\n        try:\n            other_c = other.to_cartesian()\n        except Exception as err:\n            raise TypeError(\"cannot only take cross product with another \"\n                            \"representation, not a {} instance.\"\n                            .format(type(other))) from err\n        # erfa pxp: p-vector outer (=vector=cross) product.\n        sxo = erfa_ufunc.pxp(self.get_xyz(xyz_axis=-1),\n                             other_c.get_xyz(xyz_axis=-1))\n        return self.__class__(sxo, xyz_axis=-1)\n\n\nclass UnitSphericalRepresentation(BaseRepresentation):\n    \"\"\"\n    Representation of points on a unit sphere.\n\n    Parameters\n    ----------\n    lon, lat : `~astropy.units.Quantity` ['angle'] or str\n        The longitude and latitude of the point(s), in angular units. The\n        latitude should be between -90 and 90 degrees, and the longitude will\n        be wrapped to an angle between 0 and 360 degrees. These can also be\n        instances of `~astropy.coordinates.Angle`,\n        `~astropy.coordinates.Longitude`, or `~astropy.coordinates.Latitude`.\n\n    differentials : dict, `~astropy.coordinates.BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `~astropy.coordinates.BaseDifferential`\n        instance (see `._compatible_differentials` for valid types), or a\n        dictionary of of differential instances with keys set to a string\n        representation of the SI unit with which the differential (derivative)\n        is taken. For example, for a velocity differential on a positional\n        representation, the key would be ``'s'`` for seconds, indicating that\n        the derivative is a time derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n\n    attr_classes = {'lon': Longitude,\n                    'lat': Latitude}\n\n    @classproperty\n    def _dimensional_representation(cls):\n        return SphericalRepresentation\n\n    def __init__(self, lon, lat=None, differentials=None, copy=True):\n        super().__init__(lon, lat, differentials=differentials, copy=copy)\n\n    @classproperty\n    def _compatible_differentials(cls):\n        return [UnitSphericalDifferential, UnitSphericalCosLatDifferential,\n                SphericalDifferential, SphericalCosLatDifferential,\n                RadialDifferential]\n\n    # Could let the metaclass define these automatically, but good to have\n    # a bit clearer docstrings.\n    @property\n    def lon(self):\n        \"\"\"\n        The longitude of the point(s).\n        \"\"\"\n        return self._lon\n\n    @property\n    def lat(self):\n        \"\"\"\n        The latitude of the point(s).\n        \"\"\"\n        return self._lat\n\n    def unit_vectors(self):\n        sinlon, coslon = np.sin(self.lon), np.cos(self.lon)\n        sinlat, coslat = np.sin(self.lat), np.cos(self.lat)\n        return {\n            'lon': CartesianRepresentation(-sinlon, coslon, 0., copy=False),\n            'lat': CartesianRepresentation(-sinlat*coslon, -sinlat*sinlon,\n                                           coslat, copy=False)}\n\n    def scale_factors(self, omit_coslat=False):\n        sf_lat = np.broadcast_to(1./u.radian, self.shape, subok=True)\n        sf_lon = sf_lat if omit_coslat else np.cos(self.lat) / u.radian\n        return {'lon': sf_lon,\n                'lat': sf_lat}\n\n    def to_cartesian(self):\n        \"\"\"\n        Converts spherical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        \"\"\"\n        # erfa s2c: Convert [unit]spherical coordinates to Cartesian.\n        p = erfa_ufunc.s2c(self.lon, self.lat)\n        return CartesianRepresentation(p, xyz_axis=-1, copy=False)\n\n    @classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates to spherical polar\n        coordinates.\n        \"\"\"\n        p = cart.get_xyz(xyz_axis=-1)\n        # erfa c2s: P-vector to [unit]spherical coordinates.\n        return cls(*erfa_ufunc.c2s(p), copy=False)\n\n    def represent_as(self, other_class, differential_class=None):\n        # Take a short cut if the other class is a spherical representation\n        # TODO! for differential_class. This cannot (currently) be implemented\n        # like in the other Representations since `_re_represent_differentials`\n        # keeps differentials' unit keys, but this can result in a mismatch\n        # between the UnitSpherical expected key (e.g. \"s\") and that expected\n        # in the other class (here \"s / m\"). For more info, see PR #11467\n        if inspect.isclass(other_class) and not differential_class:\n            if issubclass(other_class, PhysicsSphericalRepresentation):\n                return other_class(phi=self.lon, theta=90 * u.deg - self.lat,\n                                   r=1.0, copy=False)\n            elif issubclass(other_class, SphericalRepresentation):\n                return other_class(lon=self.lon, lat=self.lat, distance=1.0,\n                                   copy=False)\n\n        return super().represent_as(other_class, differential_class)\n\n    def transform(self, matrix):\n        r\"\"\"Transform the unit-spherical coordinates using a 3x3 matrix.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 matrix, such as a rotation matrix (or a stack of matrices).\n\n        Returns\n        -------\n        `UnitSphericalRepresentation` or `SphericalRepresentation`\n            If ``matrix`` is O(3) -- :math:`M \\dot M^T = I` -- like a rotation,\n            then the result is a `UnitSphericalRepresentation`.\n            All other matrices will change the distance, so the dimensional\n            representation is used instead.\n\n        \"\"\"\n        # the transformation matrix does not need to be a rotation matrix,\n        # so the unit-distance is not guaranteed. For speed, we check if the\n        # matrix is in O(3) and preserves lengths.\n        if np.all(is_O3(matrix)):  # remain in unit-rep\n            xyz = erfa_ufunc.s2c(self.lon, self.lat)\n            p = erfa_ufunc.rxp(matrix, xyz)\n            lon, lat = erfa_ufunc.c2s(p)\n            rep = self.__class__(lon=lon, lat=lat)\n            # handle differentials\n            new_diffs = dict((k, d.transform(matrix, self, rep))\n                             for k, d in self.differentials.items())\n            rep = rep.with_differentials(new_diffs)\n\n        else:  # switch to dimensional representation\n            rep = self._dimensional_representation(\n                lon=self.lon, lat=self.lat, distance=1,\n                differentials=self.differentials\n            ).transform(matrix)\n\n        return rep\n\n    def _scale_operation(self, op, *args):\n        return self._dimensional_representation(\n            lon=self.lon, lat=self.lat, distance=1.,\n            differentials=self.differentials)._scale_operation(op, *args)\n\n    def __neg__(self):\n        if any(differential.base_representation is not self.__class__\n               for differential in self.differentials.values()):\n            return super().__neg__()\n\n        result = self.__class__(self.lon + 180. * u.deg, -self.lat, copy=False)\n        for key, differential in self.differentials.items():\n            new_comps = (op(getattr(differential, comp))\n                         for op, comp in zip((operator.pos, operator.neg),\n                                             differential.components))\n            result.differentials[key] = differential.__class__(*new_comps, copy=False)\n        return result\n\n    def norm(self):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units, which is\n        always unity for vectors on the unit sphere.\n\n        Returns\n        -------\n        norm : `~astropy.units.Quantity` ['dimensionless']\n            Dimensionless ones, with the same shape as the representation.\n        \"\"\"\n        return u.Quantity(np.ones(self.shape), u.dimensionless_unscaled,\n                          copy=False)\n\n    def _combine_operation(self, op, other, reverse=False):\n        self._raise_if_has_differentials(op.__name__)\n\n        result = self.to_cartesian()._combine_operation(op, other, reverse)\n        if result is NotImplemented:\n            return NotImplemented\n        else:\n            return self._dimensional_representation.from_cartesian(result)\n\n    def mean(self, *args, **kwargs):\n        \"\"\"Vector mean.\n\n        The representation is converted to cartesian, the means of the x, y,\n        and z components are calculated, and the result is converted to a\n        `~astropy.coordinates.SphericalRepresentation`.\n\n        Refer to `~numpy.mean` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n        \"\"\"\n        self._raise_if_has_differentials('mean')\n        return self._dimensional_representation.from_cartesian(\n            self.to_cartesian().mean(*args, **kwargs))\n\n    def sum(self, *args, **kwargs):\n        \"\"\"Vector sum.\n\n        The representation is converted to cartesian, the sums of the x, y,\n        and z components are calculated, and the result is converted to a\n        `~astropy.coordinates.SphericalRepresentation`.\n\n        Refer to `~numpy.sum` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n        \"\"\"\n        self._raise_if_has_differentials('sum')\n        return self._dimensional_representation.from_cartesian(\n            self.to_cartesian().sum(*args, **kwargs))\n\n    def cross(self, other):\n        \"\"\"Cross product of two representations.\n\n        The calculation is done by converting both ``self`` and ``other``\n        to `~astropy.coordinates.CartesianRepresentation`, and converting the\n        result back to `~astropy.coordinates.SphericalRepresentation`.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The representation to take the cross product with.\n\n        Returns\n        -------\n        cross_product : `~astropy.coordinates.SphericalRepresentation`\n            With vectors perpendicular to both ``self`` and ``other``.\n        \"\"\"\n        self._raise_if_has_differentials('cross')\n        return self._dimensional_representation.from_cartesian(\n            self.to_cartesian().cross(other))\n\n\nclass RadialRepresentation(BaseRepresentation):\n    \"\"\"\n    Representation of the distance of points from the origin.\n\n    Note that this is mostly intended as an internal helper representation.\n    It can do little else but being used as a scale in multiplication.\n\n    Parameters\n    ----------\n    distance : `~astropy.units.Quantity` ['length']\n        The distance of the point(s) from the origin.\n\n    differentials : dict, `~astropy.coordinates.BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `~astropy.coordinates.BaseDifferential`\n        instance (see `._compatible_differentials` for valid types), or a\n        dictionary of of differential instances with keys set to a string\n        representation of the SI unit with which the differential (derivative)\n        is taken. For example, for a velocity differential on a positional\n        representation, the key would be ``'s'`` for seconds, indicating that\n        the derivative is a time derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n\n    attr_classes = {'distance': u.Quantity}\n\n    def __init__(self, distance, differentials=None, copy=True):\n        super().__init__(distance, differentials=differentials, copy=copy)\n\n    @property\n    def distance(self):\n        \"\"\"\n        The distance from the origin to the point(s).\n        \"\"\"\n        return self._distance\n\n    def unit_vectors(self):\n        \"\"\"Cartesian unit vectors are undefined for radial representation.\"\"\"\n        raise NotImplementedError('Cartesian unit vectors are undefined for '\n                                  '{} instances'.format(self.__class__))\n\n    def scale_factors(self):\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return {'distance': l}\n\n    def to_cartesian(self):\n        \"\"\"Cannot convert radial representation to cartesian.\"\"\"\n        raise NotImplementedError('cannot convert {} instance to cartesian.'\n                                  .format(self.__class__))\n\n    @classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates to radial coordinate.\n        \"\"\"\n        return cls(distance=cart.norm(), copy=False)\n\n    def __mul__(self, other):\n        if isinstance(other, BaseRepresentation):\n            return self.distance * other\n        else:\n            return super().__mul__(other)\n\n    def norm(self):\n        \"\"\"Vector norm.\n\n        Just the distance itself.\n\n        Returns\n        -------\n        norm : `~astropy.units.Quantity` ['dimensionless']\n            Dimensionless ones, with the same shape as the representation.\n        \"\"\"\n        return self.distance\n\n    def _combine_operation(self, op, other, reverse=False):\n        return NotImplemented\n\n    def transform(self, matrix):\n        \"\"\"Radial representations cannot be transformed by a Cartesian matrix.\n\n        Parameters\n        ----------\n        matrix : array-like\n            The transformation matrix in a Cartesian basis.\n            Must be a multiplication: a diagonal matrix with identical elements.\n            Must have shape (..., 3, 3), where the last 2 indices are for the\n            matrix on each other axis. Make sure that the matrix shape is\n            compatible with the shape of this representation.\n\n        Raises\n        ------\n        ValueError\n            If the matrix is not a multiplication.\n\n        \"\"\"\n        scl = matrix[..., 0, 0]\n        # check that the matrix is a scaled identity matrix on the last 2 axes.\n        if np.any(matrix != scl[..., np.newaxis, np.newaxis] * np.identity(3)):\n            raise ValueError(\"Radial representations can only be \"\n                             \"transformed by a scaled identity matrix\")\n\n        return self * scl\n\n\ndef _spherical_op_funcs(op, *args):\n    \"\"\"For given operator, return functions that adjust lon, lat, distance.\"\"\"\n    if op is operator.neg:\n        return lambda x: x+180*u.deg, operator.neg, operator.pos\n\n    try:\n        scale_sign = np.sign(args[0])\n    except Exception:\n        # This should always work, even if perhaps we get a negative distance.\n        return operator.pos, operator.pos, lambda x: op(x, *args)\n\n    scale = abs(args[0])\n    return (lambda x: x + 180*u.deg*np.signbit(scale_sign),\n            lambda x: x * scale_sign,\n            lambda x: op(x, scale))\n\n\nclass SphericalRepresentation(BaseRepresentation):\n    \"\"\"\n    Representation of points in 3D spherical coordinates.\n\n    Parameters\n    ----------\n    lon, lat : `~astropy.units.Quantity` ['angle']\n        The longitude and latitude of the point(s), in angular units. The\n        latitude should be between -90 and 90 degrees, and the longitude will\n        be wrapped to an angle between 0 and 360 degrees. These can also be\n        instances of `~astropy.coordinates.Angle`,\n        `~astropy.coordinates.Longitude`, or `~astropy.coordinates.Latitude`.\n\n    distance : `~astropy.units.Quantity` ['length']\n        The distance to the point(s). If the distance is a length, it is\n        passed to the :class:`~astropy.coordinates.Distance` class, otherwise\n        it is passed to the :class:`~astropy.units.Quantity` class.\n\n    differentials : dict, `~astropy.coordinates.BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `~astropy.coordinates.BaseDifferential`\n        instance (see `._compatible_differentials` for valid types), or a\n        dictionary of of differential instances with keys set to a string\n        representation of the SI unit with which the differential (derivative)\n        is taken. For example, for a velocity differential on a positional\n        representation, the key would be ``'s'`` for seconds, indicating that\n        the derivative is a time derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n\n    attr_classes = {'lon': Longitude,\n                    'lat': Latitude,\n                    'distance': u.Quantity}\n    _unit_representation = UnitSphericalRepresentation\n\n    def __init__(self, lon, lat=None, distance=None, differentials=None,\n                 copy=True):\n        super().__init__(lon, lat, distance, copy=copy,\n                         differentials=differentials)\n        if (not isinstance(self._distance, Distance)\n                and self._distance.unit.physical_type == 'length'):\n            try:\n                self._distance = Distance(self._distance, copy=False)\n            except ValueError as e:\n                if e.args[0].startswith('distance must be >= 0'):\n                    raise ValueError(\"Distance must be >= 0. To allow negative \"\n                                     \"distance values, you must explicitly pass\"\n                                     \" in a `Distance` object with the the \"\n                                     \"argument 'allow_negative=True'.\") from e\n                else:\n                    raise\n\n    @classproperty\n    def _compatible_differentials(cls):\n        return [UnitSphericalDifferential, UnitSphericalCosLatDifferential,\n                SphericalDifferential, SphericalCosLatDifferential,\n                RadialDifferential]\n\n    @property\n    def lon(self):\n        \"\"\"\n        The longitude of the point(s).\n        \"\"\"\n        return self._lon\n\n    @property\n    def lat(self):\n        \"\"\"\n        The latitude of the point(s).\n        \"\"\"\n        return self._lat\n\n    @property\n    def distance(self):\n        \"\"\"\n        The distance from the origin to the point(s).\n        \"\"\"\n        return self._distance\n\n    def unit_vectors(self):\n        sinlon, coslon = np.sin(self.lon), np.cos(self.lon)\n        sinlat, coslat = np.sin(self.lat), np.cos(self.lat)\n        return {\n            'lon': CartesianRepresentation(-sinlon, coslon, 0., copy=False),\n            'lat': CartesianRepresentation(-sinlat*coslon, -sinlat*sinlon,\n                                           coslat, copy=False),\n            'distance': CartesianRepresentation(coslat*coslon, coslat*sinlon,\n                                                sinlat, copy=False)}\n\n    def scale_factors(self, omit_coslat=False):\n        sf_lat = self.distance / u.radian\n        sf_lon = sf_lat if omit_coslat else sf_lat * np.cos(self.lat)\n        sf_distance = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return {'lon': sf_lon,\n                'lat': sf_lat,\n                'distance': sf_distance}\n\n    def represent_as(self, other_class, differential_class=None):\n        # Take a short cut if the other class is a spherical representation\n\n        if inspect.isclass(other_class):\n            if issubclass(other_class, PhysicsSphericalRepresentation):\n                diffs = self._re_represent_differentials(other_class,\n                                                         differential_class)\n                return other_class(phi=self.lon, theta=90 * u.deg - self.lat,\n                                   r=self.distance, differentials=diffs,\n                                   copy=False)\n\n            elif issubclass(other_class, UnitSphericalRepresentation):\n                diffs = self._re_represent_differentials(other_class,\n                                                         differential_class)\n                return other_class(lon=self.lon, lat=self.lat,\n                                   differentials=diffs, copy=False)\n\n        return super().represent_as(other_class, differential_class)\n\n    def to_cartesian(self):\n        \"\"\"\n        Converts spherical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        \"\"\"\n\n        # We need to convert Distance to Quantity to allow negative values.\n        if isinstance(self.distance, Distance):\n            d = self.distance.view(u.Quantity)\n        else:\n            d = self.distance\n\n        # erfa s2p: Convert spherical polar coordinates to p-vector.\n        p = erfa_ufunc.s2p(self.lon, self.lat, d)\n\n        return CartesianRepresentation(p, xyz_axis=-1, copy=False)\n\n    @classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates to spherical polar\n        coordinates.\n        \"\"\"\n        p = cart.get_xyz(xyz_axis=-1)\n        # erfa p2s: P-vector to spherical polar coordinates.\n        return cls(*erfa_ufunc.p2s(p), copy=False)\n\n    def transform(self, matrix):\n        \"\"\"Transform the spherical coordinates using a 3x3 matrix.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 matrix, such as a rotation matrix (or a stack of matrices).\n\n        \"\"\"\n        xyz = erfa_ufunc.s2c(self.lon, self.lat)\n        p = erfa_ufunc.rxp(matrix, xyz)\n        lon, lat, ur = erfa_ufunc.p2s(p)\n        rep = self.__class__(lon=lon, lat=lat, distance=self.distance * ur)\n\n        # handle differentials\n        new_diffs = dict((k, d.transform(matrix, self, rep))\n                         for k, d in self.differentials.items())\n        return rep.with_differentials(new_diffs)\n\n    def norm(self):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.  For\n        spherical coordinates, this is just the absolute value of the distance.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\n        return np.abs(self.distance)\n\n    def _scale_operation(self, op, *args):\n        # TODO: expand special-casing to UnitSpherical and RadialDifferential.\n        if any(differential.base_representation is not self.__class__\n               for differential in self.differentials.values()):\n            return super()._scale_operation(op, *args)\n\n        lon_op, lat_op, distance_op = _spherical_op_funcs(op, *args)\n\n        result = self.__class__(lon_op(self.lon), lat_op(self.lat),\n                                distance_op(self.distance), copy=False)\n        for key, differential in self.differentials.items():\n            new_comps = (op(getattr(differential, comp)) for op, comp in zip(\n                (operator.pos, lat_op, distance_op),\n                differential.components))\n            result.differentials[key] = differential.__class__(*new_comps, copy=False)\n        return result\n\n\nclass PhysicsSphericalRepresentation(BaseRepresentation):\n    \"\"\"\n    Representation of points in 3D spherical coordinates (using the physics\n    convention of using ``phi`` and ``theta`` for azimuth and inclination\n    from the pole).\n\n    Parameters\n    ----------\n    phi, theta : `~astropy.units.Quantity` or str\n        The azimuth and inclination of the point(s), in angular units. The\n        inclination should be between 0 and 180 degrees, and the azimuth will\n        be wrapped to an angle between 0 and 360 degrees. These can also be\n        instances of `~astropy.coordinates.Angle`.  If ``copy`` is False, `phi`\n        will be changed inplace if it is not between 0 and 360 degrees.\n\n    r : `~astropy.units.Quantity`\n        The distance to the point(s). If the distance is a length, it is\n        passed to the :class:`~astropy.coordinates.Distance` class, otherwise\n        it is passed to the :class:`~astropy.units.Quantity` class.\n\n    differentials : dict, `PhysicsSphericalDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single\n        `PhysicsSphericalDifferential` instance, or a dictionary of of\n        differential instances with keys set to a string representation of the\n        SI unit with which the differential (derivative) is taken. For example,\n        for a velocity differential on a positional representation, the key\n        would be ``'s'`` for seconds, indicating that the derivative is a time\n        derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n\n    attr_classes = {'phi': Angle,\n                    'theta': Angle,\n                    'r': u.Quantity}\n\n    def __init__(self, phi, theta=None, r=None, differentials=None, copy=True):\n        super().__init__(phi, theta, r, copy=copy, differentials=differentials)\n\n        # Wrap/validate phi/theta\n        # Note that _phi already holds our own copy if copy=True.\n        self._phi.wrap_at(360 * u.deg, inplace=True)\n\n        # This invalid catch block can be removed when the minimum numpy\n        # version is >= 1.19 (NUMPY_LT_1_19)\n        with np.errstate(invalid='ignore'):\n            if np.any(self._theta < 0.*u.deg) or np.any(self._theta > 180.*u.deg):\n                raise ValueError('Inclination angle(s) must be within '\n                                 '0 deg <= angle <= 180 deg, '\n                                 'got {}'.format(theta.to(u.degree)))\n\n        if self._r.unit.physical_type == 'length':\n            self._r = self._r.view(Distance)\n\n    @property\n    def phi(self):\n        \"\"\"\n        The azimuth of the point(s).\n        \"\"\"\n        return self._phi\n\n    @property\n    def theta(self):\n        \"\"\"\n        The elevation of the point(s).\n        \"\"\"\n        return self._theta\n\n    @property\n    def r(self):\n        \"\"\"\n        The distance from the origin to the point(s).\n        \"\"\"\n        return self._r\n\n    def unit_vectors(self):\n        sinphi, cosphi = np.sin(self.phi), np.cos(self.phi)\n        sintheta, costheta = np.sin(self.theta), np.cos(self.theta)\n        return {\n            'phi': CartesianRepresentation(-sinphi, cosphi, 0., copy=False),\n            'theta': CartesianRepresentation(costheta*cosphi,\n                                             costheta*sinphi,\n                                             -sintheta, copy=False),\n            'r': CartesianRepresentation(sintheta*cosphi, sintheta*sinphi,\n                                         costheta, copy=False)}\n\n    def scale_factors(self):\n        r = self.r / u.radian\n        sintheta = np.sin(self.theta)\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return {'phi': r * sintheta,\n                'theta': r,\n                'r': l}\n\n    def represent_as(self, other_class, differential_class=None):\n        # Take a short cut if the other class is a spherical representation\n\n        if inspect.isclass(other_class):\n            if issubclass(other_class, SphericalRepresentation):\n                diffs = self._re_represent_differentials(other_class,\n                                                         differential_class)\n                return other_class(lon=self.phi, lat=90 * u.deg - self.theta,\n                                   distance=self.r, differentials=diffs,\n                                   copy=False)\n            elif issubclass(other_class, UnitSphericalRepresentation):\n                diffs = self._re_represent_differentials(other_class,\n                                                         differential_class)\n                return other_class(lon=self.phi, lat=90 * u.deg - self.theta,\n                                   differentials=diffs, copy=False)\n\n        return super().represent_as(other_class, differential_class)\n\n    def to_cartesian(self):\n        \"\"\"\n        Converts spherical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        \"\"\"\n\n        # We need to convert Distance to Quantity to allow negative values.\n        if isinstance(self.r, Distance):\n            d = self.r.view(u.Quantity)\n        else:\n            d = self.r\n\n        x = d * np.sin(self.theta) * np.cos(self.phi)\n        y = d * np.sin(self.theta) * np.sin(self.phi)\n        z = d * np.cos(self.theta)\n\n        return CartesianRepresentation(x=x, y=y, z=z, copy=False)\n\n    @classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates to spherical polar\n        coordinates.\n        \"\"\"\n\n        s = np.hypot(cart.x, cart.y)\n        r = np.hypot(s, cart.z)\n\n        phi = np.arctan2(cart.y, cart.x)\n        theta = np.arctan2(s, cart.z)\n\n        return cls(phi=phi, theta=theta, r=r, copy=False)\n\n    def transform(self, matrix):\n        \"\"\"Transform the spherical coordinates using a 3x3 matrix.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 matrix, such as a rotation matrix (or a stack of matrices).\n\n        \"\"\"\n        # apply transformation in unit-spherical coordinates\n        xyz = erfa_ufunc.s2c(self.phi, 90*u.deg-self.theta)\n        p = erfa_ufunc.rxp(matrix, xyz)\n        lon, lat, ur = erfa_ufunc.p2s(p)  # `ur` is transformed unit-`r`\n        # create transformed physics-spherical representation,\n        # reapplying the distance scaling\n        rep = self.__class__(phi=lon, theta=90*u.deg-lat, r=self.r * ur)\n\n        new_diffs = dict((k, d.transform(matrix, self, rep))\n                         for k, d in self.differentials.items())\n        return rep.with_differentials(new_diffs)\n\n    def norm(self):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.  For\n        spherical coordinates, this is just the absolute value of the radius.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\n        return np.abs(self.r)\n\n    def _scale_operation(self, op, *args):\n        if any(differential.base_representation is not self.__class__\n               for differential in self.differentials.values()):\n            return super()._scale_operation(op, *args)\n\n        phi_op, adjust_theta_sign, r_op = _spherical_op_funcs(op, *args)\n        # Also run phi_op on theta to ensure theta remains between 0 and 180:\n        # any time the scale is negative, we do -theta + 180 degrees.\n        result = self.__class__(phi_op(self.phi),\n                                phi_op(adjust_theta_sign(self.theta)),\n                                r_op(self.r), copy=False)\n        for key, differential in self.differentials.items():\n            new_comps = (op(getattr(differential, comp)) for op, comp in zip(\n                (operator.pos, adjust_theta_sign, r_op),\n                differential.components))\n            result.differentials[key] = differential.__class__(*new_comps, copy=False)\n        return result\n\n\nclass CylindricalRepresentation(BaseRepresentation):\n    \"\"\"\n    Representation of points in 3D cylindrical coordinates.\n\n    Parameters\n    ----------\n    rho : `~astropy.units.Quantity`\n        The distance from the z axis to the point(s).\n\n    phi : `~astropy.units.Quantity` or str\n        The azimuth of the point(s), in angular units, which will be wrapped\n        to an angle between 0 and 360 degrees. This can also be instances of\n        `~astropy.coordinates.Angle`,\n\n    z : `~astropy.units.Quantity`\n        The z coordinate(s) of the point(s)\n\n    differentials : dict, `CylindricalDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single\n        `CylindricalDifferential` instance, or a dictionary of of differential\n        instances with keys set to a string representation of the SI unit with\n        which the differential (derivative) is taken. For example, for a\n        velocity differential on a positional representation, the key would be\n        ``'s'`` for seconds, indicating that the derivative is a time\n        derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n\n    attr_classes = {'rho': u.Quantity,\n                    'phi': Angle,\n                    'z': u.Quantity}\n\n    def __init__(self, rho, phi=None, z=None, differentials=None, copy=True):\n        super().__init__(rho, phi, z, copy=copy, differentials=differentials)\n\n        if not self._rho.unit.is_equivalent(self._z.unit):\n            raise u.UnitsError(\"rho and z should have matching physical types\")\n\n    @property\n    def rho(self):\n        \"\"\"\n        The distance of the point(s) from the z-axis.\n        \"\"\"\n        return self._rho\n\n    @property\n    def phi(self):\n        \"\"\"\n        The azimuth of the point(s).\n        \"\"\"\n        return self._phi\n\n    @property\n    def z(self):\n        \"\"\"\n        The height of the point(s).\n        \"\"\"\n        return self._z\n\n    def unit_vectors(self):\n        sinphi, cosphi = np.sin(self.phi), np.cos(self.phi)\n        l = np.broadcast_to(1., self.shape)\n        return {\n            'rho': CartesianRepresentation(cosphi, sinphi, 0, copy=False),\n            'phi': CartesianRepresentation(-sinphi, cosphi, 0, copy=False),\n            'z': CartesianRepresentation(0, 0, l, unit=u.one, copy=False)}\n\n    def scale_factors(self):\n        rho = self.rho / u.radian\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return {'rho': l,\n                'phi': rho,\n                'z': l}\n\n    @classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates to cylindrical polar\n        coordinates.\n        \"\"\"\n\n        rho = np.hypot(cart.x, cart.y)\n        phi = np.arctan2(cart.y, cart.x)\n        z = cart.z\n\n        return cls(rho=rho, phi=phi, z=z, copy=False)\n\n    def to_cartesian(self):\n        \"\"\"\n        Converts cylindrical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        \"\"\"\n        x = self.rho * np.cos(self.phi)\n        y = self.rho * np.sin(self.phi)\n        z = self.z\n\n        return CartesianRepresentation(x=x, y=y, z=z, copy=False)\n\n    def _scale_operation(self, op, *args):\n        if any(differential.base_representation is not self.__class__\n               for differential in self.differentials.values()):\n            return super()._scale_operation(op, *args)\n\n        phi_op, _, rho_op = _spherical_op_funcs(op, *args)\n        z_op = lambda x: op(x, *args)\n\n        result = self.__class__(rho_op(self.rho), phi_op(self.phi),\n                                z_op(self.z), copy=False)\n        for key, differential in self.differentials.items():\n            new_comps = (op(getattr(differential, comp)) for op, comp in zip(\n                (rho_op, operator.pos, z_op), differential.components))\n            result.differentials[key] = differential.__class__(*new_comps, copy=False)\n        return result\n\n\nclass BaseDifferential(BaseRepresentationOrDifferential):\n    r\"\"\"A base class representing differentials of representations.\n\n    These represent differences or derivatives along each component.\n    E.g., for physics spherical coordinates, these would be\n    :math:`\\delta r, \\delta \\theta, \\delta \\phi`.\n\n    Parameters\n    ----------\n    d_comp1, d_comp2, d_comp3 : `~astropy.units.Quantity` or subclass\n        The components of the 3D differentials.  The names are the keys and the\n        subclasses the values of the ``attr_classes`` attribute.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n\n    Notes\n    -----\n    All differential representation classes should subclass this base class,\n    and define an ``base_representation`` attribute with the class of the\n    regular `~astropy.coordinates.BaseRepresentation` for which differential\n    coordinates are provided. This will set up a default ``attr_classes``\n    instance with names equal to the base component names prefixed by ``d_``,\n    and all classes set to `~astropy.units.Quantity`, plus properties to access\n    those, and a default ``__init__`` for initialization.\n    \"\"\"\n\n    def __init_subclass__(cls, **kwargs):\n        \"\"\"Set default ``attr_classes`` and component getters on a Differential.\n        class BaseDifferential(BaseRepresentationOrDifferential):\n\n        For these, the components are those of the base representation prefixed\n        by 'd_', and the class is `~astropy.units.Quantity`.\n        \"\"\"\n\n        # Don't do anything for base helper classes.\n        if cls.__name__ in ('BaseDifferential', 'BaseSphericalDifferential',\n                            'BaseSphericalCosLatDifferential'):\n            return\n\n        if not hasattr(cls, 'base_representation'):\n            raise NotImplementedError('Differential representations must have a'\n                                      '\"base_representation\" class attribute.')\n\n        # If not defined explicitly, create attr_classes.\n        if not hasattr(cls, 'attr_classes'):\n            base_attr_classes = cls.base_representation.attr_classes\n            cls.attr_classes = {'d_' + c: u.Quantity\n                                for c in base_attr_classes}\n\n        repr_name = cls.get_name()\n        if repr_name in DIFFERENTIAL_CLASSES:\n            raise ValueError(f\"Differential class {repr_name} already defined\")\n\n        DIFFERENTIAL_CLASSES[repr_name] = cls\n        _invalidate_reprdiff_cls_hash()\n\n        # If not defined explicitly, create properties for the components.\n        for component in cls.attr_classes:\n            if not hasattr(cls, component):\n                setattr(cls, component,\n                        property(_make_getter(component),\n                                 doc=f\"Component '{component}' of the Differential.\"))\n\n        super().__init_subclass__(**kwargs)\n\n    @classmethod\n    def _check_base(cls, base):\n        if cls not in base._compatible_differentials:\n            raise TypeError(f\"Differential class {cls} is not compatible with the \"\n                            f\"base (representation) class {base.__class__}\")\n\n    def _get_deriv_key(self, base):\n        \"\"\"Given a base (representation instance), determine the unit of the\n        derivative by removing the representation unit from the component units\n        of this differential.\n        \"\"\"\n\n        # This check is just a last resort so we don't return a strange unit key\n        # from accidentally passing in the wrong base.\n        self._check_base(base)\n\n        for name in base.components:\n            comp = getattr(base, name)\n            d_comp = getattr(self, f'd_{name}', None)\n            if d_comp is not None:\n                d_unit = comp.unit / d_comp.unit\n\n                # This is quite a bit faster than using to_system() or going\n                # through Quantity()\n                d_unit_si = d_unit.decompose(u.si.bases)\n                d_unit_si._scale = 1  # remove the scale from the unit\n\n                return str(d_unit_si)\n\n        else:\n            raise RuntimeError(\"Invalid representation-differential units! This\"\n                               \" likely happened because either the \"\n                               \"representation or the associated differential \"\n                               \"have non-standard units. Check that the input \"\n                               \"positional data have positional units, and the \"\n                               \"input velocity data have velocity units, or \"\n                               \"are both dimensionless.\")\n\n    @classmethod\n    def _get_base_vectors(cls, base):\n        \"\"\"Get unit vectors and scale factors from base.\n\n        Parameters\n        ----------\n        base : instance of ``self.base_representation``\n            The points for which the unit vectors and scale factors should be\n            retrieved.\n\n        Returns\n        -------\n        unit_vectors : dict of `CartesianRepresentation`\n            In the directions of the coordinates of base.\n        scale_factors : dict of `~astropy.units.Quantity`\n            Scale factors for each of the coordinates\n\n        Raises\n        ------\n        TypeError : if the base is not of the correct type\n        \"\"\"\n        cls._check_base(base)\n        return base.unit_vectors(), base.scale_factors()\n\n    def to_cartesian(self, base):\n        \"\"\"Convert the differential to 3D rectangular cartesian coordinates.\n\n        Parameters\n        ----------\n        base : instance of ``self.base_representation``\n            The points for which the differentials are to be converted: each of\n            the components is multiplied by its unit vectors and scale factors.\n\n        Returns\n        -------\n        `CartesianDifferential`\n            This object, converted.\n\n        \"\"\"\n        base_e, base_sf = self._get_base_vectors(base)\n        return functools.reduce(\n            operator.add, (getattr(self, d_c) * base_sf[c] * base_e[c]\n                           for d_c, c in zip(self.components, base.components)))\n\n    @classmethod\n    def from_cartesian(cls, other, base):\n        \"\"\"Convert the differential from 3D rectangular cartesian coordinates to\n        the desired class.\n\n        Parameters\n        ----------\n        other\n            The object to convert into this differential.\n        base : `BaseRepresentation`\n            The points for which the differentials are to be converted: each of\n            the components is multiplied by its unit vectors and scale factors.\n            Will be converted to ``cls.base_representation`` if needed.\n\n        Returns\n        -------\n        `BaseDifferential` subclass instance\n            A new differential object that is this class' type.\n        \"\"\"\n        base = base.represent_as(cls.base_representation)\n        base_e, base_sf = cls._get_base_vectors(base)\n        return cls(*(other.dot(e / base_sf[component])\n                     for component, e in base_e.items()), copy=False)\n\n    def represent_as(self, other_class, base):\n        \"\"\"Convert coordinates to another representation.\n\n        If the instance is of the requested class, it is returned unmodified.\n        By default, conversion is done via cartesian coordinates.\n\n        Parameters\n        ----------\n        other_class : `~astropy.coordinates.BaseRepresentation` subclass\n            The type of representation to turn the coordinates into.\n        base : instance of ``self.base_representation``\n            Base relative to which the differentials are defined.  If the other\n            class is a differential representation, the base will be converted\n            to its ``base_representation``.\n        \"\"\"\n        if other_class is self.__class__:\n            return self\n\n        # The default is to convert via cartesian coordinates.\n        self_cartesian = self.to_cartesian(base)\n        if issubclass(other_class, BaseDifferential):\n            return other_class.from_cartesian(self_cartesian, base)\n        else:\n            return other_class.from_cartesian(self_cartesian)\n\n    @classmethod\n    def from_representation(cls, representation, base):\n        \"\"\"Create a new instance of this representation from another one.\n\n        Parameters\n        ----------\n        representation : `~astropy.coordinates.BaseRepresentation` instance\n            The presentation that should be converted to this class.\n        base : instance of ``cls.base_representation``\n            The base relative to which the differentials will be defined. If\n            the representation is a differential itself, the base will be\n            converted to its ``base_representation`` to help convert it.\n        \"\"\"\n        if isinstance(representation, BaseDifferential):\n            cartesian = representation.to_cartesian(\n                base.represent_as(representation.base_representation))\n        else:\n            cartesian = representation.to_cartesian()\n\n        return cls.from_cartesian(cartesian, base)\n\n    def transform(self, matrix, base, transformed_base):\n        \"\"\"Transform differential using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new differential and does not modify the original one.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n        base : instance of ``cls.base_representation``\n            Base relative to which the differentials are defined.  If the other\n            class is a differential representation, the base will be converted\n            to its ``base_representation``.\n        transformed_base : instance of ``cls.base_representation``\n            Base relative to which the transformed differentials are defined.\n            If the other class is a differential representation, the base will\n            be converted to its ``base_representation``.\n        \"\"\"\n        # route transformation through Cartesian\n        cdiff = self.represent_as(CartesianDifferential, base=base\n                                  ).transform(matrix)\n        # move back to original representation\n        diff = cdiff.represent_as(self.__class__, transformed_base)\n        return diff\n\n    def _scale_operation(self, op, *args, scaled_base=False):\n        \"\"\"Scale all components.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.mul`, `~operator.neg`, etc.\n        *args\n            Any arguments required for the operator (typically, what is to\n            be multiplied with, divided by).\n        scaled_base : bool, optional\n            Whether the base was scaled the same way. This affects whether\n            differential components should be scaled. For instance, a differential\n            in longitude should not be scaled if its spherical base is scaled\n            in radius.\n        \"\"\"\n        scaled_attrs = [op(getattr(self, c), *args) for c in self.components]\n        return self.__class__(*scaled_attrs, copy=False)\n\n    def _combine_operation(self, op, other, reverse=False):\n        \"\"\"Combine two differentials, or a differential with a representation.\n\n        If ``other`` is of the same differential type as ``self``, the\n        components will simply be combined.  If ``other`` is a representation,\n        it will be used as a base for which to evaluate the differential,\n        and the result is a new representation.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.add`, `~operator.sub`, etc.\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The other differential or representation.\n        reverse : bool\n            Whether the operands should be reversed (e.g., as we got here via\n            ``self.__rsub__`` because ``self`` is a subclass of ``other``).\n        \"\"\"\n        if isinstance(self, type(other)):\n            first, second = (self, other) if not reverse else (other, self)\n            return self.__class__(*[op(getattr(first, c), getattr(second, c))\n                                    for c in self.components])\n        else:\n            try:\n                self_cartesian = self.to_cartesian(other)\n            except TypeError:\n                return NotImplemented\n\n            return other._combine_operation(op, self_cartesian, not reverse)\n\n    def __sub__(self, other):\n        # avoid \"differential - representation\".\n        if isinstance(other, BaseRepresentation):\n            return NotImplemented\n        return super().__sub__(other)\n\n    def norm(self, base=None):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.\n\n        Parameters\n        ----------\n        base : instance of ``self.base_representation``\n            Base relative to which the differentials are defined. This is\n            required to calculate the physical size of the differential for\n            all but Cartesian differentials or radial differentials.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\n        # RadialDifferential overrides this function, so there is no handling here\n        if not isinstance(self, CartesianDifferential) and base is None:\n            raise ValueError(\"`base` must be provided to calculate the norm of a\"\n                             f\" {type(self).__name__}\")\n        return self.to_cartesian(base).norm()\n\n\nclass CartesianDifferential(BaseDifferential):\n    \"\"\"Differentials in of points in 3D cartesian coordinates.\n\n    Parameters\n    ----------\n    d_x, d_y, d_z : `~astropy.units.Quantity` or array\n        The x, y, and z coordinates of the differentials. If ``d_x``, ``d_y``,\n        and ``d_z`` have different shapes, they should be broadcastable. If not\n        quantities, ``unit`` should be set.  If only ``d_x`` is given, it is\n        assumed that it contains an array with the 3 coordinates stored along\n        ``xyz_axis``.\n    unit : `~astropy.units.Unit` or str\n        If given, the differentials will be converted to this unit (or taken to\n        be in this unit if not given.\n    xyz_axis : int, optional\n        The axis along which the coordinates are stored when a single array is\n        provided instead of distinct ``d_x``, ``d_y``, and ``d_z`` (default: 0).\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n    base_representation = CartesianRepresentation\n    _d_xyz = None\n\n    def __init__(self, d_x, d_y=None, d_z=None, unit=None, xyz_axis=None,\n                 copy=True):\n\n        if d_y is None and d_z is None:\n            if isinstance(d_x, np.ndarray) and d_x.dtype.kind not in 'OV':\n                # Short-cut for 3-D array input.\n                d_x = u.Quantity(d_x, unit, copy=copy, subok=True)\n                # Keep a link to the array with all three coordinates\n                # so that we can return it quickly if needed in get_xyz.\n                self._d_xyz = d_x\n                if xyz_axis:\n                    d_x = np.moveaxis(d_x, xyz_axis, 0)\n                    self._xyz_axis = xyz_axis\n                else:\n                    self._xyz_axis = 0\n\n                self._d_x, self._d_y, self._d_z = d_x\n                return\n\n            else:\n                d_x, d_y, d_z = d_x\n\n        if xyz_axis is not None:\n            raise ValueError(\"xyz_axis should only be set if d_x, d_y, and d_z \"\n                             \"are in a single array passed in through d_x, \"\n                             \"i.e., d_y and d_z should not be not given.\")\n\n        if d_y is None or d_z is None:\n            raise ValueError(\"d_x, d_y, and d_z are required to instantiate {}\"\n                             .format(self.__class__.__name__))\n\n        if unit is not None:\n            d_x = u.Quantity(d_x, unit, copy=copy, subok=True)\n            d_y = u.Quantity(d_y, unit, copy=copy, subok=True)\n            d_z = u.Quantity(d_z, unit, copy=copy, subok=True)\n            copy = False\n\n        super().__init__(d_x, d_y, d_z, copy=copy)\n        if not (self._d_x.unit.is_equivalent(self._d_y.unit) and\n                self._d_x.unit.is_equivalent(self._d_z.unit)):\n            raise u.UnitsError('d_x, d_y and d_z should have equivalent units.')\n\n    def to_cartesian(self, base=None):\n        return CartesianRepresentation(*[getattr(self, c) for c\n                                         in self.components])\n\n    @classmethod\n    def from_cartesian(cls, other, base=None):\n        return cls(*[getattr(other, c) for c in other.components])\n\n    def transform(self, matrix, base=None, transformed_base=None):\n        \"\"\"Transform differentials using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new differential and does not modify the original one.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n        base, transformed_base : `~astropy.coordinates.CartesianRepresentation` or None, optional\n            Not used in the Cartesian transformation.\n        \"\"\"\n        # erfa rxp: Multiply a p-vector by an r-matrix.\n        p = erfa_ufunc.rxp(matrix, self.get_d_xyz(xyz_axis=-1))\n\n        return self.__class__(p, xyz_axis=-1, copy=False)\n\n    def get_d_xyz(self, xyz_axis=0):\n        \"\"\"Return a vector array of the x, y, and z coordinates.\n\n        Parameters\n        ----------\n        xyz_axis : int, optional\n            The axis in the final array along which the x, y, z components\n            should be stored (default: 0).\n\n        Returns\n        -------\n        d_xyz : `~astropy.units.Quantity`\n            With dimension 3 along ``xyz_axis``.  Note that, if possible,\n            this will be a view.\n        \"\"\"\n        if self._d_xyz is not None:\n            if self._xyz_axis == xyz_axis:\n                return self._d_xyz\n            else:\n                return np.moveaxis(self._d_xyz, self._xyz_axis, xyz_axis)\n\n        # Create combined array.  TO DO: keep it in _d_xyz for repeated use?\n        # But then in-place changes have to cancel it. Likely best to\n        # also update components.\n        return np.stack([self._d_x, self._d_y, self._d_z], axis=xyz_axis)\n\n    d_xyz = property(get_d_xyz)\n\n\nclass BaseSphericalDifferential(BaseDifferential):\n    def _d_lon_coslat(self, base):\n        \"\"\"Convert longitude differential d_lon to d_lon_coslat.\n\n        Parameters\n        ----------\n        base : instance of ``cls.base_representation``\n            The base from which the latitude will be taken.\n        \"\"\"\n        self._check_base(base)\n        return self.d_lon * np.cos(base.lat)\n\n    @classmethod\n    def _get_d_lon(cls, d_lon_coslat, base):\n        \"\"\"Convert longitude differential d_lon_coslat to d_lon.\n\n        Parameters\n        ----------\n        d_lon_coslat : `~astropy.units.Quantity`\n            Longitude differential that includes ``cos(lat)``.\n        base : instance of ``cls.base_representation``\n            The base from which the latitude will be taken.\n        \"\"\"\n        cls._check_base(base)\n        return d_lon_coslat / np.cos(base.lat)\n\n    def _combine_operation(self, op, other, reverse=False):\n        \"\"\"Combine two differentials, or a differential with a representation.\n\n        If ``other`` is of the same differential type as ``self``, the\n        components will simply be combined.  If both are different parts of\n        a `~astropy.coordinates.SphericalDifferential` (e.g., a\n        `~astropy.coordinates.UnitSphericalDifferential` and a\n        `~astropy.coordinates.RadialDifferential`), they will combined\n        appropriately.\n\n        If ``other`` is a representation, it will be used as a base for which\n        to evaluate the differential, and the result is a new representation.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.add`, `~operator.sub`, etc.\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The other differential or representation.\n        reverse : bool\n            Whether the operands should be reversed (e.g., as we got here via\n            ``self.__rsub__`` because ``self`` is a subclass of ``other``).\n        \"\"\"\n        if (isinstance(other, BaseSphericalDifferential) and\n                not isinstance(self, type(other)) or\n                isinstance(other, RadialDifferential)):\n            all_components = set(self.components) | set(other.components)\n            first, second = (self, other) if not reverse else (other, self)\n            result_args = {c: op(getattr(first, c, 0.), getattr(second, c, 0.))\n                           for c in all_components}\n            return SphericalDifferential(**result_args)\n\n        return super()._combine_operation(op, other, reverse)\n\n\nclass UnitSphericalDifferential(BaseSphericalDifferential):\n    \"\"\"Differential(s) of points on a unit sphere.\n\n    Parameters\n    ----------\n    d_lon, d_lat : `~astropy.units.Quantity`\n        The longitude and latitude of the differentials.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n    base_representation = UnitSphericalRepresentation\n\n    @classproperty\n    def _dimensional_differential(cls):\n        return SphericalDifferential\n\n    def __init__(self, d_lon, d_lat=None, copy=True):\n        super().__init__(d_lon, d_lat, copy=copy)\n        if not self._d_lon.unit.is_equivalent(self._d_lat.unit):\n            raise u.UnitsError('d_lon and d_lat should have equivalent units.')\n\n    @classmethod\n    def from_cartesian(cls, other, base):\n        # Go via the dimensional equivalent, so that the longitude and latitude\n        # differentials correctly take into account the norm of the base.\n        dimensional = cls._dimensional_differential.from_cartesian(other, base)\n        return dimensional.represent_as(cls)\n\n    def to_cartesian(self, base):\n        if isinstance(base, SphericalRepresentation):\n            scale = base.distance\n        elif isinstance(base, PhysicsSphericalRepresentation):\n            scale = base.r\n        else:\n            return super().to_cartesian(base)\n\n        base = base.represent_as(UnitSphericalRepresentation)\n        return scale * super().to_cartesian(base)\n\n    def represent_as(self, other_class, base=None):\n        # Only have enough information to represent other unit-spherical.\n        if issubclass(other_class, UnitSphericalCosLatDifferential):\n            return other_class(self._d_lon_coslat(base), self.d_lat)\n\n        return super().represent_as(other_class, base)\n\n    @classmethod\n    def from_representation(cls, representation, base=None):\n        # All spherical differentials can be done without going to Cartesian,\n        # though CosLat needs base for the latitude.\n        if isinstance(representation, SphericalDifferential):\n            return cls(representation.d_lon, representation.d_lat)\n        elif isinstance(representation, (SphericalCosLatDifferential,\n                                         UnitSphericalCosLatDifferential)):\n            d_lon = cls._get_d_lon(representation.d_lon_coslat, base)\n            return cls(d_lon, representation.d_lat)\n        elif isinstance(representation, PhysicsSphericalDifferential):\n            return cls(representation.d_phi, -representation.d_theta)\n\n        return super().from_representation(representation, base)\n\n    def transform(self, matrix, base, transformed_base):\n        \"\"\"Transform differential using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new differential and does not modify the original one.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n        base : instance of ``cls.base_representation``\n            Base relative to which the differentials are defined.  If the other\n            class is a differential representation, the base will be converted\n            to its ``base_representation``.\n        transformed_base : instance of ``cls.base_representation``\n            Base relative to which the transformed differentials are defined.\n            If the other class is a differential representation, the base will\n            be converted to its ``base_representation``.\n        \"\"\"\n        # the transformation matrix does not need to be a rotation matrix,\n        # so the unit-distance is not guaranteed. For speed, we check if the\n        # matrix is in O(3) and preserves lengths.\n        if np.all(is_O3(matrix)):  # remain in unit-rep\n            # TODO! implement without Cartesian intermediate step.\n            # some of this can be moved to the parent class.\n            diff = super().transform(matrix, base, transformed_base)\n\n        else:  # switch to dimensional representation\n            du = self.d_lon.unit / base.lon.unit  # derivative unit\n            diff = self._dimensional_differential(\n                d_lon=self.d_lon, d_lat=self.d_lat, d_distance=0 * du\n            ).transform(matrix, base, transformed_base)\n\n        return diff\n\n    def _scale_operation(self, op, *args, scaled_base=False):\n        if scaled_base:\n            return self.copy()\n        else:\n            return super()._scale_operation(op, *args)\n\n\nclass SphericalDifferential(BaseSphericalDifferential):\n    \"\"\"Differential(s) of points in 3D spherical coordinates.\n\n    Parameters\n    ----------\n    d_lon, d_lat : `~astropy.units.Quantity`\n        The differential longitude and latitude.\n    d_distance : `~astropy.units.Quantity`\n        The differential distance.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n    base_representation = SphericalRepresentation\n    _unit_differential = UnitSphericalDifferential\n\n    def __init__(self, d_lon, d_lat=None, d_distance=None, copy=True):\n        super().__init__(d_lon, d_lat, d_distance, copy=copy)\n        if not self._d_lon.unit.is_equivalent(self._d_lat.unit):\n            raise u.UnitsError('d_lon and d_lat should have equivalent units.')\n\n    def represent_as(self, other_class, base=None):\n        # All spherical differentials can be done without going to Cartesian,\n        # though CosLat needs base for the latitude.\n        if issubclass(other_class, UnitSphericalDifferential):\n            return other_class(self.d_lon, self.d_lat)\n        elif issubclass(other_class, RadialDifferential):\n            return other_class(self.d_distance)\n        elif issubclass(other_class, SphericalCosLatDifferential):\n            return other_class(self._d_lon_coslat(base), self.d_lat,\n                               self.d_distance)\n        elif issubclass(other_class, UnitSphericalCosLatDifferential):\n            return other_class(self._d_lon_coslat(base), self.d_lat)\n        elif issubclass(other_class, PhysicsSphericalDifferential):\n            return other_class(self.d_lon, -self.d_lat, self.d_distance)\n        else:\n            return super().represent_as(other_class, base)\n\n    @classmethod\n    def from_representation(cls, representation, base=None):\n        # Other spherical differentials can be done without going to Cartesian,\n        # though CosLat needs base for the latitude.\n        if isinstance(representation, SphericalCosLatDifferential):\n            d_lon = cls._get_d_lon(representation.d_lon_coslat, base)\n            return cls(d_lon, representation.d_lat, representation.d_distance)\n        elif isinstance(representation, PhysicsSphericalDifferential):\n            return cls(representation.d_phi, -representation.d_theta,\n                       representation.d_r)\n\n        return super().from_representation(representation, base)\n\n    def _scale_operation(self, op, *args, scaled_base=False):\n        if scaled_base:\n            return self.__class__(self.d_lon, self.d_lat, op(self.d_distance, *args))\n        else:\n            return super()._scale_operation(op, *args)\n\n\nclass BaseSphericalCosLatDifferential(BaseDifferential):\n    \"\"\"Differentials from points on a spherical base representation.\n\n    With cos(lat) assumed to be included in the longitude differential.\n    \"\"\"\n    @classmethod\n    def _get_base_vectors(cls, base):\n        \"\"\"Get unit vectors and scale factors from (unit)spherical base.\n\n        Parameters\n        ----------\n        base : instance of ``self.base_representation``\n            The points for which the unit vectors and scale factors should be\n            retrieved.\n\n        Returns\n        -------\n        unit_vectors : dict of `CartesianRepresentation`\n            In the directions of the coordinates of base.\n        scale_factors : dict of `~astropy.units.Quantity`\n            Scale factors for each of the coordinates.  The scale factor for\n            longitude does not include the cos(lat) factor.\n\n        Raises\n        ------\n        TypeError : if the base is not of the correct type\n        \"\"\"\n        cls._check_base(base)\n        return base.unit_vectors(), base.scale_factors(omit_coslat=True)\n\n    def _d_lon(self, base):\n        \"\"\"Convert longitude differential with cos(lat) to one without.\n\n        Parameters\n        ----------\n        base : instance of ``cls.base_representation``\n            The base from which the latitude will be taken.\n        \"\"\"\n        self._check_base(base)\n        return self.d_lon_coslat / np.cos(base.lat)\n\n    @classmethod\n    def _get_d_lon_coslat(cls, d_lon, base):\n        \"\"\"Convert longitude differential d_lon to d_lon_coslat.\n\n        Parameters\n        ----------\n        d_lon : `~astropy.units.Quantity`\n            Value of the longitude differential without ``cos(lat)``.\n        base : instance of ``cls.base_representation``\n            The base from which the latitude will be taken.\n        \"\"\"\n        cls._check_base(base)\n        return d_lon * np.cos(base.lat)\n\n    def _combine_operation(self, op, other, reverse=False):\n        \"\"\"Combine two differentials, or a differential with a representation.\n\n        If ``other`` is of the same differential type as ``self``, the\n        components will simply be combined.  If both are different parts of\n        a `~astropy.coordinates.SphericalDifferential` (e.g., a\n        `~astropy.coordinates.UnitSphericalDifferential` and a\n        `~astropy.coordinates.RadialDifferential`), they will combined\n        appropriately.\n\n        If ``other`` is a representation, it will be used as a base for which\n        to evaluate the differential, and the result is a new representation.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.add`, `~operator.sub`, etc.\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The other differential or representation.\n        reverse : bool\n            Whether the operands should be reversed (e.g., as we got here via\n            ``self.__rsub__`` because ``self`` is a subclass of ``other``).\n        \"\"\"\n        if (isinstance(other, BaseSphericalCosLatDifferential) and\n                not isinstance(self, type(other)) or\n                isinstance(other, RadialDifferential)):\n            all_components = set(self.components) | set(other.components)\n            first, second = (self, other) if not reverse else (other, self)\n            result_args = {c: op(getattr(first, c, 0.), getattr(second, c, 0.))\n                           for c in all_components}\n            return SphericalCosLatDifferential(**result_args)\n\n        return super()._combine_operation(op, other, reverse)\n\n\nclass UnitSphericalCosLatDifferential(BaseSphericalCosLatDifferential):\n    \"\"\"Differential(s) of points on a unit sphere.\n\n    Parameters\n    ----------\n    d_lon_coslat, d_lat : `~astropy.units.Quantity`\n        The longitude and latitude of the differentials.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n    base_representation = UnitSphericalRepresentation\n    attr_classes = {'d_lon_coslat': u.Quantity,\n                    'd_lat': u.Quantity}\n\n    @classproperty\n    def _dimensional_differential(cls):\n        return SphericalCosLatDifferential\n\n    def __init__(self, d_lon_coslat, d_lat=None, copy=True):\n        super().__init__(d_lon_coslat, d_lat, copy=copy)\n        if not self._d_lon_coslat.unit.is_equivalent(self._d_lat.unit):\n            raise u.UnitsError('d_lon_coslat and d_lat should have equivalent '\n                               'units.')\n\n    @classmethod\n    def from_cartesian(cls, other, base):\n        # Go via the dimensional equivalent, so that the longitude and latitude\n        # differentials correctly take into account the norm of the base.\n        dimensional = cls._dimensional_differential.from_cartesian(other, base)\n        return dimensional.represent_as(cls)\n\n    def to_cartesian(self, base):\n        if isinstance(base, SphericalRepresentation):\n            scale = base.distance\n        elif isinstance(base, PhysicsSphericalRepresentation):\n            scale = base.r\n        else:\n            return super().to_cartesian(base)\n\n        base = base.represent_as(UnitSphericalRepresentation)\n        return scale * super().to_cartesian(base)\n\n    def represent_as(self, other_class, base=None):\n        # Only have enough information to represent other unit-spherical.\n        if issubclass(other_class, UnitSphericalDifferential):\n            return other_class(self._d_lon(base), self.d_lat)\n\n        return super().represent_as(other_class, base)\n\n    @classmethod\n    def from_representation(cls, representation, base=None):\n        # All spherical differentials can be done without going to Cartesian,\n        # though w/o CosLat needs base for the latitude.\n        if isinstance(representation, SphericalCosLatDifferential):\n            return cls(representation.d_lon_coslat, representation.d_lat)\n        elif isinstance(representation, (SphericalDifferential,\n                                         UnitSphericalDifferential)):\n            d_lon_coslat = cls._get_d_lon_coslat(representation.d_lon, base)\n            return cls(d_lon_coslat, representation.d_lat)\n        elif isinstance(representation, PhysicsSphericalDifferential):\n            d_lon_coslat = cls._get_d_lon_coslat(representation.d_phi, base)\n            return cls(d_lon_coslat, -representation.d_theta)\n\n        return super().from_representation(representation, base)\n\n    def transform(self, matrix, base, transformed_base):\n        \"\"\"Transform differential using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new differential and does not modify the original one.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n        base : instance of ``cls.base_representation``\n            Base relative to which the differentials are defined.  If the other\n            class is a differential representation, the base will be converted\n            to its ``base_representation``.\n        transformed_base : instance of ``cls.base_representation``\n            Base relative to which the transformed differentials are defined.\n            If the other class is a differential representation, the base will\n            be converted to its ``base_representation``.\n        \"\"\"\n        # the transformation matrix does not need to be a rotation matrix,\n        # so the unit-distance is not guaranteed. For speed, we check if the\n        # matrix is in O(3) and preserves lengths.\n        if np.all(is_O3(matrix)):  # remain in unit-rep\n            # TODO! implement without Cartesian intermediate step.\n            diff = super().transform(matrix, base, transformed_base)\n\n        else:  # switch to dimensional representation\n            du = self.d_lat.unit / base.lat.unit  # derivative unit\n            diff = self._dimensional_differential(\n                d_lon_coslat=self.d_lon_coslat, d_lat=self.d_lat,\n                d_distance=0 * du\n            ).transform(matrix, base, transformed_base)\n\n        return diff\n\n    def _scale_operation(self, op, *args, scaled_base=False):\n        if scaled_base:\n            return self.copy()\n        else:\n            return super()._scale_operation(op, *args)\n\n\nclass SphericalCosLatDifferential(BaseSphericalCosLatDifferential):\n    \"\"\"Differential(s) of points in 3D spherical coordinates.\n\n    Parameters\n    ----------\n    d_lon_coslat, d_lat : `~astropy.units.Quantity`\n        The differential longitude (with cos(lat) included) and latitude.\n    d_distance : `~astropy.units.Quantity`\n        The differential distance.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n    base_representation = SphericalRepresentation\n    _unit_differential = UnitSphericalCosLatDifferential\n    attr_classes = {'d_lon_coslat': u.Quantity,\n                    'd_lat': u.Quantity,\n                    'd_distance': u.Quantity}\n\n    def __init__(self, d_lon_coslat, d_lat=None, d_distance=None, copy=True):\n        super().__init__(d_lon_coslat, d_lat, d_distance, copy=copy)\n        if not self._d_lon_coslat.unit.is_equivalent(self._d_lat.unit):\n            raise u.UnitsError('d_lon_coslat and d_lat should have equivalent '\n                               'units.')\n\n    def represent_as(self, other_class, base=None):\n        # All spherical differentials can be done without going to Cartesian,\n        # though some need base for the latitude to remove cos(lat).\n        if issubclass(other_class, UnitSphericalCosLatDifferential):\n            return other_class(self.d_lon_coslat, self.d_lat)\n        elif issubclass(other_class, RadialDifferential):\n            return other_class(self.d_distance)\n        elif issubclass(other_class, SphericalDifferential):\n            return other_class(self._d_lon(base), self.d_lat, self.d_distance)\n        elif issubclass(other_class, UnitSphericalDifferential):\n            return other_class(self._d_lon(base), self.d_lat)\n        elif issubclass(other_class, PhysicsSphericalDifferential):\n            return other_class(self._d_lon(base), -self.d_lat, self.d_distance)\n\n        return super().represent_as(other_class, base)\n\n    @classmethod\n    def from_representation(cls, representation, base=None):\n        # Other spherical differentials can be done without going to Cartesian,\n        # though we need base for the latitude to remove coslat.\n        if isinstance(representation, SphericalDifferential):\n            d_lon_coslat = cls._get_d_lon_coslat(representation.d_lon, base)\n            return cls(d_lon_coslat, representation.d_lat,\n                       representation.d_distance)\n        elif isinstance(representation, PhysicsSphericalDifferential):\n            d_lon_coslat = cls._get_d_lon_coslat(representation.d_phi, base)\n            return cls(d_lon_coslat, -representation.d_theta,\n                       representation.d_r)\n\n        return super().from_representation(representation, base)\n\n    def _scale_operation(self, op, *args, scaled_base=False):\n        if scaled_base:\n            return self.__class__(self.d_lon_coslat, self.d_lat, op(self.d_distance, *args))\n        else:\n            return super()._scale_operation(op, *args)\n\n\nclass RadialDifferential(BaseDifferential):\n    \"\"\"Differential(s) of radial distances.\n\n    Parameters\n    ----------\n    d_distance : `~astropy.units.Quantity`\n        The differential distance.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n    base_representation = RadialRepresentation\n\n    def to_cartesian(self, base):\n        return self.d_distance * base.represent_as(\n            UnitSphericalRepresentation).to_cartesian()\n\n    def norm(self, base=None):\n        return self.d_distance\n\n    @classmethod\n    def from_cartesian(cls, other, base):\n        return cls(other.dot(base.represent_as(UnitSphericalRepresentation)),\n                   copy=False)\n\n    @classmethod\n    def from_representation(cls, representation, base=None):\n        if isinstance(representation, (SphericalDifferential,\n                                       SphericalCosLatDifferential)):\n            return cls(representation.d_distance)\n        elif isinstance(representation, PhysicsSphericalDifferential):\n            return cls(representation.d_r)\n        else:\n            return super().from_representation(representation, base)\n\n    def _combine_operation(self, op, other, reverse=False):\n        if isinstance(other, self.base_representation):\n            if reverse:\n                first, second = other.distance, self.d_distance\n            else:\n                first, second = self.d_distance, other.distance\n            return other.__class__(op(first, second), copy=False)\n        elif isinstance(other, (BaseSphericalDifferential,\n                                BaseSphericalCosLatDifferential)):\n            all_components = set(self.components) | set(other.components)\n            first, second = (self, other) if not reverse else (other, self)\n            result_args = {c: op(getattr(first, c, 0.), getattr(second, c, 0.))\n                           for c in all_components}\n            return SphericalDifferential(**result_args)\n\n        else:\n            return super()._combine_operation(op, other, reverse)\n\n\nclass PhysicsSphericalDifferential(BaseDifferential):\n    \"\"\"Differential(s) of 3D spherical coordinates using physics convention.\n\n    Parameters\n    ----------\n    d_phi, d_theta : `~astropy.units.Quantity`\n        The differential azimuth and inclination.\n    d_r : `~astropy.units.Quantity`\n        The differential radial distance.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n    base_representation = PhysicsSphericalRepresentation\n\n    def __init__(self, d_phi, d_theta=None, d_r=None, copy=True):\n        super().__init__(d_phi, d_theta, d_r, copy=copy)\n        if not self._d_phi.unit.is_equivalent(self._d_theta.unit):\n            raise u.UnitsError('d_phi and d_theta should have equivalent '\n                               'units.')\n\n    def represent_as(self, other_class, base=None):\n        # All spherical differentials can be done without going to Cartesian,\n        # though CosLat needs base for the latitude. For those, explicitly\n        # do the equivalent of self._d_lon_coslat in SphericalDifferential.\n        if issubclass(other_class, SphericalDifferential):\n            return other_class(self.d_phi, -self.d_theta, self.d_r)\n        elif issubclass(other_class, UnitSphericalDifferential):\n            return other_class(self.d_phi, -self.d_theta)\n        elif issubclass(other_class, SphericalCosLatDifferential):\n            self._check_base(base)\n            d_lon_coslat = self.d_phi * np.sin(base.theta)\n            return other_class(d_lon_coslat, -self.d_theta, self.d_r)\n        elif issubclass(other_class, UnitSphericalCosLatDifferential):\n            self._check_base(base)\n            d_lon_coslat = self.d_phi * np.sin(base.theta)\n            return other_class(d_lon_coslat, -self.d_theta)\n        elif issubclass(other_class, RadialDifferential):\n            return other_class(self.d_r)\n\n        return super().represent_as(other_class, base)\n\n    @classmethod\n    def from_representation(cls, representation, base=None):\n        # Other spherical differentials can be done without going to Cartesian,\n        # though we need base for the latitude to remove coslat. For that case,\n        # do the equivalent of cls._d_lon in SphericalDifferential.\n        if isinstance(representation, SphericalDifferential):\n            return cls(representation.d_lon, -representation.d_lat,\n                       representation.d_distance)\n        elif isinstance(representation, SphericalCosLatDifferential):\n            cls._check_base(base)\n            d_phi = representation.d_lon_coslat / np.sin(base.theta)\n            return cls(d_phi, -representation.d_lat, representation.d_distance)\n\n        return super().from_representation(representation, base)\n\n    def _scale_operation(self, op, *args, scaled_base=False):\n        if scaled_base:\n            return self.__class__(self.d_phi, self.d_theta, op(self.d_r, *args))\n        else:\n            return super()._scale_operation(op, *args)\n\n\nclass CylindricalDifferential(BaseDifferential):\n    \"\"\"Differential(s) of points in cylindrical coordinates.\n\n    Parameters\n    ----------\n    d_rho : `~astropy.units.Quantity` ['speed']\n        The differential cylindrical radius.\n    d_phi : `~astropy.units.Quantity` ['angular speed']\n        The differential azimuth.\n    d_z : `~astropy.units.Quantity` ['speed']\n        The differential height.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n    base_representation = CylindricalRepresentation\n\n    def __init__(self, d_rho, d_phi=None, d_z=None, copy=False):\n        super().__init__(d_rho, d_phi, d_z, copy=copy)\n        if not self._d_rho.unit.is_equivalent(self._d_z.unit):\n            raise u.UnitsError(\"d_rho and d_z should have equivalent units.\")\n"},{"col":4,"comment":"Set default ``attr_classes`` and component getters on a Differential.\n        class BaseDifferential(BaseRepresentationOrDifferential):\n\n        For these, the components are those of the base representation prefixed\n        by 'd_', and the class is `~astropy.units.Quantity`.\n        ","endLoc":2479,"header":"def __init_subclass__(cls, **kwargs)","id":14955,"name":"__init_subclass__","nodeType":"Function","startLoc":2442,"text":"def __init_subclass__(cls, **kwargs):\n        \"\"\"Set default ``attr_classes`` and component getters on a Differential.\n        class BaseDifferential(BaseRepresentationOrDifferential):\n\n        For these, the components are those of the base representation prefixed\n        by 'd_', and the class is `~astropy.units.Quantity`.\n        \"\"\"\n\n        # Don't do anything for base helper classes.\n        if cls.__name__ in ('BaseDifferential', 'BaseSphericalDifferential',\n                            'BaseSphericalCosLatDifferential'):\n            return\n\n        if not hasattr(cls, 'base_representation'):\n            raise NotImplementedError('Differential representations must have a'\n                                      '\"base_representation\" class attribute.')\n\n        # If not defined explicitly, create attr_classes.\n        if not hasattr(cls, 'attr_classes'):\n            base_attr_classes = cls.base_representation.attr_classes\n            cls.attr_classes = {'d_' + c: u.Quantity\n                                for c in base_attr_classes}\n\n        repr_name = cls.get_name()\n        if repr_name in DIFFERENTIAL_CLASSES:\n            raise ValueError(f\"Differential class {repr_name} already defined\")\n\n        DIFFERENTIAL_CLASSES[repr_name] = cls\n        _invalidate_reprdiff_cls_hash()\n\n        # If not defined explicitly, create properties for the components.\n        for component in cls.attr_classes:\n            if not hasattr(cls, component):\n                setattr(cls, component,\n                        property(_make_getter(component),\n                                 doc=f\"Component '{component}' of the Differential.\"))\n\n        super().__init_subclass__(**kwargs)"},{"col":0,"comment":"Check whether a matrix is in the length-preserving group O(3).\n\n    Parameters\n    ----------\n    matrix : (..., N, N) array-like\n        Must have attribute ``.shape`` and method ``.swapaxes()`` and not error\n        when using `~numpy.isclose`.\n\n    Returns\n    -------\n    is_o3 : bool or array of bool\n        If the matrix has more than two axes, the O(3) check is performed on\n        slices along the last two axes -- (M, N, N) => (M, ) bool array.\n\n    Notes\n    -----\n    The orthogonal group O(3) preserves lengths, but is not guaranteed to keep\n    orientations. Rotations and reflections are in this group.\n    For more information, see https://en.wikipedia.org/wiki/Orthogonal_group\n\n    ","endLoc":161,"header":"def is_O3(matrix)","id":14956,"name":"is_O3","nodeType":"Function","startLoc":134,"text":"def is_O3(matrix):\n    \"\"\"Check whether a matrix is in the length-preserving group O(3).\n\n    Parameters\n    ----------\n    matrix : (..., N, N) array-like\n        Must have attribute ``.shape`` and method ``.swapaxes()`` and not error\n        when using `~numpy.isclose`.\n\n    Returns\n    -------\n    is_o3 : bool or array of bool\n        If the matrix has more than two axes, the O(3) check is performed on\n        slices along the last two axes -- (M, N, N) => (M, ) bool array.\n\n    Notes\n    -----\n    The orthogonal group O(3) preserves lengths, but is not guaranteed to keep\n    orientations. Rotations and reflections are in this group.\n    For more information, see https://en.wikipedia.org/wiki/Orthogonal_group\n\n    \"\"\"\n    # matrix is in O(3) (rotations, proper and improper).\n    I = np.identity(matrix.shape[-1])\n    is_o3 = np.all(np.isclose(matrix @ matrix.swapaxes(-2, -1), I, atol=1e-15),\n                   axis=(-2, -1))\n\n    return is_o3"},{"col":4,"comment":"\n        A `dict` of all the attributes of all frame classes in this\n        `TransformGraph`.\n        ","endLoc":122,"header":"@property\n    def frame_attributes(self)","id":14957,"name":"frame_attributes","nodeType":"Function","startLoc":113,"text":"@property\n    def frame_attributes(self):\n        \"\"\"\n        A `dict` of all the attributes of all frame classes in this\n        `TransformGraph`.\n        \"\"\"\n        if self._cached_frame_attributes is None:\n            self._cached_frame_attributes = frame_attrs_from_set(self.frame_set)\n\n        return self._cached_frame_attributes"},{"className":"BaseRepresentationOrDifferentialInfo","col":0,"comment":"\n    Container for meta information like name, description, format.  This is\n    required when the object is used as a mixin column within a table, but can\n    be used as a general way to store meta information.\n    ","endLoc":160,"id":14958,"nodeType":"Class","startLoc":79,"text":"class BaseRepresentationOrDifferentialInfo(MixinInfo):\n    \"\"\"\n    Container for meta information like name, description, format.  This is\n    required when the object is used as a mixin column within a table, but can\n    be used as a general way to store meta information.\n    \"\"\"\n    attrs_from_parent = {'unit'}  # Indicates unit is read-only\n    _supports_indexing = False\n\n    @staticmethod\n    def default_format(val):\n        # Create numpy dtype so that numpy formatting will work.\n        components = val.components\n        values = tuple(getattr(val, component).value for component in components)\n        a = np.empty(getattr(val, 'shape', ()),\n                     [(component, value.dtype) for component, value\n                      in zip(components, values)])\n        for component, value in zip(components, values):\n            a[component] = value\n        return str(a)\n\n    @property\n    def _represent_as_dict_attrs(self):\n        return self._parent.components\n\n    @property\n    def unit(self):\n        if self._parent is None:\n            return None\n\n        unit = self._parent._unitstr\n        return unit[1:-1] if unit.startswith('(') else unit\n\n    def new_like(self, reps, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new instance like ``reps`` with ``length`` rows.\n\n        This is intended for creating an empty column object whose elements can\n        be set in-place for table operations like join or vstack.\n\n        Parameters\n        ----------\n        reps : list\n            List of input representations or differentials.\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : `BaseRepresentation` or `BaseDifferential` subclass instance\n            Empty instance of this class consistent with ``cols``\n\n        \"\"\"\n\n        # Get merged info attributes like shape, dtype, format, description, etc.\n        attrs = self.merge_cols_attributes(reps, metadata_conflicts, name,\n                                           ('meta', 'description'))\n        # Make a new representation or differential with the desired length\n        # using the _apply / __getitem__ machinery to effectively return\n        # rep0[[0, 0, ..., 0, 0]]. This will have the right shape, and\n        # include possible differentials.\n        indexes = np.zeros(length, dtype=np.int64)\n        out = reps[0][indexes]\n\n        # Use __setitem__ machinery to check whether all representations\n        # can represent themselves as this one without loss of information.\n        for rep in reps[1:]:\n            try:\n                out[0] = rep[0]\n            except Exception as err:\n                raise ValueError(f'input representations are inconsistent.') from err\n\n        # Set (merged) info attributes.\n        for attr in ('name', 'meta', 'description'):\n            if attr in attrs:\n                setattr(out.info, attr, attrs[attr])\n\n        return out"},{"col":4,"comment":"null","endLoc":98,"header":"@staticmethod\n    def default_format(val)","id":14959,"name":"default_format","nodeType":"Function","startLoc":88,"text":"@staticmethod\n    def default_format(val):\n        # Create numpy dtype so that numpy formatting will work.\n        components = val.components\n        values = tuple(getattr(val, component).value for component in components)\n        a = np.empty(getattr(val, 'shape', ()),\n                     [(component, value.dtype) for component, value\n                      in zip(components, values)])\n        for component, value in zip(components, values):\n            a[component] = value\n        return str(a)"},{"col":4,"comment":"\n        Wrapper for ``erfa.apcs``, used in conversions GCRS <-> ICRS\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, a GCRS frame is expected.\n        ","endLoc":95,"header":"@staticmethod\n    def apcs(frame_or_coord)","id":14960,"name":"apcs","nodeType":"Function","startLoc":77,"text":"@staticmethod\n    def apcs(frame_or_coord):\n        '''\n        Wrapper for ``erfa.apcs``, used in conversions GCRS <-> ICRS\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, a GCRS frame is expected.\n        '''\n        jd1_tt, jd2_tt = get_jd12(frame_or_coord.obstime, 'tt')\n        obs_pv = pav2pv(\n            frame_or_coord.obsgeoloc.get_xyz(xyz_axis=-1).value,\n            frame_or_coord.obsgeovel.get_xyz(xyz_axis=-1).value\n        )\n        earth_pv, earth_heliocentric = prepare_earth_position_vel(frame_or_coord.obstime)\n        return erfa.apcs(jd1_tt, jd2_tt, obs_pv, earth_pv, earth_heliocentric)"},{"col":0,"comment":"\n    A `dict` of all the attributes of all frame classes in this\n    `TransformGraph`.\n\n    Broken out of the class so this can be called on a temporary frame set to\n    validate new additions to the transform graph before actually adding them.\n    ","endLoc":54,"header":"def frame_attrs_from_set(frame_set)","id":14961,"name":"frame_attrs_from_set","nodeType":"Function","startLoc":41,"text":"def frame_attrs_from_set(frame_set):\n    \"\"\"\n    A `dict` of all the attributes of all frame classes in this\n    `TransformGraph`.\n\n    Broken out of the class so this can be called on a temporary frame set to\n    validate new additions to the transform graph before actually adding them.\n    \"\"\"\n    result = {}\n\n    for frame_cls in frame_set:\n        result.update(frame_cls.frame_attributes)\n\n    return result"},{"col":4,"comment":"null","endLoc":102,"header":"@property\n    def _represent_as_dict_attrs(self)","id":14962,"name":"_represent_as_dict_attrs","nodeType":"Function","startLoc":100,"text":"@property\n    def _represent_as_dict_attrs(self):\n        return self._parent.components"},{"col":4,"comment":"null","endLoc":110,"header":"@property\n    def unit(self)","id":14963,"name":"unit","nodeType":"Function","startLoc":104,"text":"@property\n    def unit(self):\n        if self._parent is None:\n            return None\n\n        unit = self._parent._unitstr\n        return unit[1:-1] if unit.startswith('(') else unit"},{"col":4,"comment":"\n        A `set` of all component names every defined within any frame class in\n        this `TransformGraph`.\n        ","endLoc":133,"header":"@property\n    def frame_component_names(self)","id":14964,"name":"frame_component_names","nodeType":"Function","startLoc":124,"text":"@property\n    def frame_component_names(self):\n        \"\"\"\n        A `set` of all component names every defined within any frame class in\n        this `TransformGraph`.\n        \"\"\"\n        if self._cached_component_names is None:\n            self._cached_component_names = frame_comps_from_set(self.frame_set)\n\n        return self._cached_component_names"},{"col":4,"comment":"\n        Return a new instance like ``reps`` with ``length`` rows.\n\n        This is intended for creating an empty column object whose elements can\n        be set in-place for table operations like join or vstack.\n\n        Parameters\n        ----------\n        reps : list\n            List of input representations or differentials.\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : `BaseRepresentation` or `BaseDifferential` subclass instance\n            Empty instance of this class consistent with ``cols``\n\n        ","endLoc":160,"header":"def new_like(self, reps, length, metadata_conflicts='warn', name=None)","id":14965,"name":"new_like","nodeType":"Function","startLoc":112,"text":"def new_like(self, reps, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new instance like ``reps`` with ``length`` rows.\n\n        This is intended for creating an empty column object whose elements can\n        be set in-place for table operations like join or vstack.\n\n        Parameters\n        ----------\n        reps : list\n            List of input representations or differentials.\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : `BaseRepresentation` or `BaseDifferential` subclass instance\n            Empty instance of this class consistent with ``cols``\n\n        \"\"\"\n\n        # Get merged info attributes like shape, dtype, format, description, etc.\n        attrs = self.merge_cols_attributes(reps, metadata_conflicts, name,\n                                           ('meta', 'description'))\n        # Make a new representation or differential with the desired length\n        # using the _apply / __getitem__ machinery to effectively return\n        # rep0[[0, 0, ..., 0, 0]]. This will have the right shape, and\n        # include possible differentials.\n        indexes = np.zeros(length, dtype=np.int64)\n        out = reps[0][indexes]\n\n        # Use __setitem__ machinery to check whether all representations\n        # can represent themselves as this one without loss of information.\n        for rep in reps[1:]:\n            try:\n                out[0] = rep[0]\n            except Exception as err:\n                raise ValueError(f'input representations are inconsistent.') from err\n\n        # Set (merged) info attributes.\n        for attr in ('name', 'meta', 'description'):\n            if attr in attrs:\n                setattr(out.info, attr, attrs[attr])\n\n        return out"},{"col":4,"comment":"null","endLoc":2485,"header":"@classmethod\n    def _check_base(cls, base)","id":14966,"name":"_check_base","nodeType":"Function","startLoc":2481,"text":"@classmethod\n    def _check_base(cls, base):\n        if cls not in base._compatible_differentials:\n            raise TypeError(f\"Differential class {cls} is not compatible with the \"\n                            f\"base (representation) class {base.__class__}\")"},{"col":4,"comment":"Given a base (representation instance), determine the unit of the\n        derivative by removing the representation unit from the component units\n        of this differential.\n        ","endLoc":2517,"header":"def _get_deriv_key(self, base)","id":14967,"name":"_get_deriv_key","nodeType":"Function","startLoc":2487,"text":"def _get_deriv_key(self, base):\n        \"\"\"Given a base (representation instance), determine the unit of the\n        derivative by removing the representation unit from the component units\n        of this differential.\n        \"\"\"\n\n        # This check is just a last resort so we don't return a strange unit key\n        # from accidentally passing in the wrong base.\n        self._check_base(base)\n\n        for name in base.components:\n            comp = getattr(base, name)\n            d_comp = getattr(self, f'd_{name}', None)\n            if d_comp is not None:\n                d_unit = comp.unit / d_comp.unit\n\n                # This is quite a bit faster than using to_system() or going\n                # through Quantity()\n                d_unit_si = d_unit.decompose(u.si.bases)\n                d_unit_si._scale = 1  # remove the scale from the unit\n\n                return str(d_unit_si)\n\n        else:\n            raise RuntimeError(\"Invalid representation-differential units! This\"\n                               \" likely happened because either the \"\n                               \"representation or the associated differential \"\n                               \"have non-standard units. Check that the input \"\n                               \"positional data have positional units, and the \"\n                               \"input velocity data have velocity units, or \"\n                               \"are both dimensionless.\")"},{"col":0,"comment":"\n    A `set` of all component names every defined within any frame class in\n    this `TransformGraph`.\n\n    Broken out of the class so this can be called on a temporary frame set to\n    validate new additions to the transform graph before actually adding them.\n    ","endLoc":73,"header":"def frame_comps_from_set(frame_set)","id":14968,"name":"frame_comps_from_set","nodeType":"Function","startLoc":57,"text":"def frame_comps_from_set(frame_set):\n    \"\"\"\n    A `set` of all component names every defined within any frame class in\n    this `TransformGraph`.\n\n    Broken out of the class so this can be called on a temporary frame set to\n    validate new additions to the transform graph before actually adding them.\n    \"\"\"\n    result = set()\n\n    for frame_cls in frame_set:\n        rep_info = frame_cls._frame_specific_representation_info\n        for mappings in rep_info.values():\n            for rep_map in mappings:\n                result.update([rep_map.framename])\n\n    return result"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":2526,"id":14969,"name":"wa","nodeType":"Attribute","startLoc":2526,"text":"wa"},{"col":4,"comment":"\n        Slightly modified equivalent of ``erfa.apio``, used in conversions AltAz <-> CIRS.\n\n        Since we use a topocentric CIRS frame, we have dropped the steps needed to calculate\n        diurnal aberration.\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, an AltAz frame is expected.\n        ","endLoc":167,"header":"@staticmethod\n    def apio(frame_or_coord)","id":14970,"name":"apio","nodeType":"Function","startLoc":97,"text":"@staticmethod\n    def apio(frame_or_coord):\n        '''\n        Slightly modified equivalent of ``erfa.apio``, used in conversions AltAz <-> CIRS.\n\n        Since we use a topocentric CIRS frame, we have dropped the steps needed to calculate\n        diurnal aberration.\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, an AltAz frame is expected.\n        '''\n        # Calculate erfa.apio input parameters.\n        # TIO locator s'\n        sp = erfa.sp00(*get_jd12(frame_or_coord.obstime, 'tt'))\n\n        # Earth rotation angle.\n        theta = erfa.era00(*get_jd12(frame_or_coord.obstime, 'ut1'))\n\n        # Longitude and latitude in radians.\n        lon, lat, height = frame_or_coord.location.to_geodetic('WGS84')\n        elong = lon.to_value(u.radian)\n        phi = lat.to_value(u.radian)\n\n        # Polar motion, rotated onto local meridian\n        xp, yp = get_polar_motion(frame_or_coord.obstime)\n\n        # we need an empty astrom structure before we fill in the required sections\n        astrom = np.zeros(frame_or_coord.obstime.shape, dtype=erfa.dt_eraASTROM)\n\n        # Form the rotation matrix, CIRS to apparent [HA,Dec].\n        r = (rotation_matrix(elong, 'z', unit=u.radian)\n             @ rotation_matrix(-yp, 'x', unit=u.radian)\n             @ rotation_matrix(-xp, 'y', unit=u.radian)\n             @ rotation_matrix(theta+sp, 'z', unit=u.radian))\n\n        # Solve for local Earth rotation angle.\n        a = r[..., 0, 0]\n        b = r[..., 0, 1]\n        eral = np.arctan2(b, a)\n        astrom['eral'] = eral\n\n        # Solve for polar motion [X,Y] with respect to local meridian.\n        c = r[..., 0, 2]\n        astrom['xpl'] = np.arctan2(c, np.sqrt(a*a+b*b))\n        a = r[..., 1, 2]\n        b = r[..., 2, 2]\n        astrom['ypl'] = -np.arctan2(a, b)\n\n        # Adjusted longitude.\n        astrom['along'] = erfa.anpm(eral - theta)\n\n        # Functions of latitude.\n        astrom['sphi'] = np.sin(phi)\n        astrom['cphi'] = np.cos(phi)\n\n        # Omit two steps that are zero for a geocentric observer:\n        # Observer's geocentric position and velocity (m, m/s, CIRS).\n        # Magnitude of diurnal aberration vector.\n\n        # Refraction constants.\n        astrom['refa'], astrom['refb'] = erfa.refco(\n            frame_or_coord.pressure.to_value(u.hPa),\n            frame_or_coord.temperature.to_value(u.deg_C),\n            frame_or_coord.relative_humidity.value,\n            frame_or_coord.obswl.to_value(u.micron)\n        )\n        return astrom"},{"attributeType":"null","col":4,"comment":"null","endLoc":832,"id":14971,"name":"_is_bool","nodeType":"Attribute","startLoc":832,"text":"_is_bool"},{"attributeType":"null","col":8,"comment":"null","endLoc":839,"id":14972,"name":"_default_size","nodeType":"Attribute","startLoc":839,"text":"self._default_size"},{"col":4,"comment":"\n        Add a new coordinate transformation to the graph.\n\n        Parameters\n        ----------\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform into.\n        transform : `CoordinateTransform`\n            The transformation object. Typically a `CoordinateTransform` object,\n            although it may be some other callable that is called with the same\n            signature.\n\n        Raises\n        ------\n        TypeError\n            If ``fromsys`` or ``tosys`` are not classes or ``transform`` is\n            not callable.\n        ","endLoc":205,"header":"def add_transform(self, fromsys, tosys, transform)","id":14973,"name":"add_transform","nodeType":"Function","startLoc":149,"text":"def add_transform(self, fromsys, tosys, transform):\n        \"\"\"\n        Add a new coordinate transformation to the graph.\n\n        Parameters\n        ----------\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform into.\n        transform : `CoordinateTransform`\n            The transformation object. Typically a `CoordinateTransform` object,\n            although it may be some other callable that is called with the same\n            signature.\n\n        Raises\n        ------\n        TypeError\n            If ``fromsys`` or ``tosys`` are not classes or ``transform`` is\n            not callable.\n        \"\"\"\n\n        if not inspect.isclass(fromsys):\n            raise TypeError('fromsys must be a class')\n        if not inspect.isclass(tosys):\n            raise TypeError('tosys must be a class')\n        if not callable(transform):\n            raise TypeError('transform must be callable')\n\n        frame_set = self.frame_set.copy()\n        frame_set.add(fromsys)\n        frame_set.add(tosys)\n\n        # Now we check to see if any attributes on the proposed frames override\n        # *any* component names, which we can't allow for some of the logic in\n        # the SkyCoord initializer to work\n        attrs = set(frame_attrs_from_set(frame_set).keys())\n        comps = frame_comps_from_set(frame_set)\n\n        invalid_attrs = attrs.intersection(comps)\n        if invalid_attrs:\n            invalid_frames = set()\n            for attr in invalid_attrs:\n                if attr in fromsys.frame_attributes:\n                    invalid_frames.update([fromsys])\n\n                if attr in tosys.frame_attributes:\n                    invalid_frames.update([tosys])\n\n            raise ValueError(\"Frame(s) {} contain invalid attribute names: {}\"\n                             \"\\nFrame attributes can not conflict with *any* of\"\n                             \" the frame data component names (see\"\n                             \" `frame_transform_graph.frame_component_names`).\"\n                             .format(list(invalid_frames), invalid_attrs))\n\n        self._graph[fromsys][tosys] = transform\n        self.invalidate_cache()"},{"attributeType":"null","col":4,"comment":"null","endLoc":85,"id":14974,"name":"attrs_from_parent","nodeType":"Attribute","startLoc":85,"text":"attrs_from_parent"},{"attributeType":"null","col":4,"comment":"null","endLoc":86,"id":14975,"name":"_supports_indexing","nodeType":"Attribute","startLoc":86,"text":"_supports_indexing"},{"className":"RepresentationInfo","col":0,"comment":"null","endLoc":575,"id":14976,"nodeType":"Class","startLoc":554,"text":"class RepresentationInfo(BaseRepresentationOrDifferentialInfo):\n\n    @property\n    def _represent_as_dict_attrs(self):\n        attrs = super()._represent_as_dict_attrs\n        if self._parent._differentials:\n            attrs += ('differentials',)\n        return attrs\n\n    def _represent_as_dict(self, attrs=None):\n        out = super()._represent_as_dict(attrs)\n        for key, value in out.pop('differentials', {}).items():\n            out[f'differentials.{key}'] = value\n        return out\n\n    def _construct_from_dict(self, map):\n        differentials = {}\n        for key in list(map.keys()):\n            if key.startswith('differentials.'):\n                differentials[key[14:]] = map.pop(key)\n        map['differentials'] = differentials\n        return super()._construct_from_dict(map)"},{"attributeType":"Moffat2D","col":8,"comment":"null","endLoc":838,"id":14977,"name":"_model","nodeType":"Attribute","startLoc":838,"text":"self._model"},{"col":4,"comment":"null","endLoc":561,"header":"@property\n    def _represent_as_dict_attrs(self)","id":14978,"name":"_represent_as_dict_attrs","nodeType":"Function","startLoc":556,"text":"@property\n    def _represent_as_dict_attrs(self):\n        attrs = super()._represent_as_dict_attrs\n        if self._parent._differentials:\n            attrs += ('differentials',)\n        return attrs"},{"col":4,"comment":"null","endLoc":567,"header":"def _represent_as_dict(self, attrs=None)","id":14979,"name":"_represent_as_dict","nodeType":"Function","startLoc":563,"text":"def _represent_as_dict(self, attrs=None):\n        out = super()._represent_as_dict(attrs)\n        for key, value in out.pop('differentials', {}).items():\n            out[f'differentials.{key}'] = value\n        return out"},{"col":4,"comment":"Get unit vectors and scale factors from base.\n\n        Parameters\n        ----------\n        base : instance of ``self.base_representation``\n            The points for which the unit vectors and scale factors should be\n            retrieved.\n\n        Returns\n        -------\n        unit_vectors : dict of `CartesianRepresentation`\n            In the directions of the coordinates of base.\n        scale_factors : dict of `~astropy.units.Quantity`\n            Scale factors for each of the coordinates\n\n        Raises\n        ------\n        TypeError : if the base is not of the correct type\n        ","endLoc":2541,"header":"@classmethod\n    def _get_base_vectors(cls, base)","id":14980,"name":"_get_base_vectors","nodeType":"Function","startLoc":2519,"text":"@classmethod\n    def _get_base_vectors(cls, base):\n        \"\"\"Get unit vectors and scale factors from base.\n\n        Parameters\n        ----------\n        base : instance of ``self.base_representation``\n            The points for which the unit vectors and scale factors should be\n            retrieved.\n\n        Returns\n        -------\n        unit_vectors : dict of `CartesianRepresentation`\n            In the directions of the coordinates of base.\n        scale_factors : dict of `~astropy.units.Quantity`\n            Scale factors for each of the coordinates\n\n        Raises\n        ------\n        TypeError : if the base is not of the correct type\n        \"\"\"\n        cls._check_base(base)\n        return base.unit_vectors(), base.scale_factors()"},{"attributeType":"None","col":8,"comment":"null","endLoc":842,"id":14981,"name":"_truncation","nodeType":"Attribute","startLoc":842,"text":"self._truncation"},{"col":4,"comment":"null","endLoc":575,"header":"def _construct_from_dict(self, map)","id":14982,"name":"_construct_from_dict","nodeType":"Function","startLoc":569,"text":"def _construct_from_dict(self, map):\n        differentials = {}\n        for key in list(map.keys()):\n            if key.startswith('differentials.'):\n                differentials[key[14:]] = map.pop(key)\n        map['differentials'] = differentials\n        return super()._construct_from_dict(map)"},{"className":"Model1DKernel","col":0,"comment":"\n    Create kernel from 1D model.\n\n    The model has to be centered on x = 0.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.Fittable1DModel`\n        Kernel response function model\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*width +1⌋.\n        Must be odd.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    Raises\n    ------\n    TypeError\n        If model is not an instance of `~astropy.modeling.Fittable1DModel`\n\n    See also\n    --------\n    Model2DKernel : Create kernel from `~astropy.modeling.Fittable2DModel`\n    CustomKernel : Create kernel from list or array\n\n    Examples\n    --------\n    Define a Gaussian1D model:\n\n        >>> from astropy.modeling.models import Gaussian1D\n        >>> from astropy.convolution.kernels import Model1DKernel\n        >>> gauss = Gaussian1D(1, 0, 2)\n\n    And create a custom one dimensional kernel from it:\n\n        >>> gauss_kernel = Model1DKernel(gauss, x_size=9)\n\n    This kernel can now be used like a usual Astropy kernel.\n    ","endLoc":907,"id":14983,"nodeType":"Class","startLoc":845,"text":"class Model1DKernel(Kernel1D):\n    \"\"\"\n    Create kernel from 1D model.\n\n    The model has to be centered on x = 0.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.Fittable1DModel`\n        Kernel response function model\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*width +1⌋.\n        Must be odd.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by linearly interpolating\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    Raises\n    ------\n    TypeError\n        If model is not an instance of `~astropy.modeling.Fittable1DModel`\n\n    See also\n    --------\n    Model2DKernel : Create kernel from `~astropy.modeling.Fittable2DModel`\n    CustomKernel : Create kernel from list or array\n\n    Examples\n    --------\n    Define a Gaussian1D model:\n\n        >>> from astropy.modeling.models import Gaussian1D\n        >>> from astropy.convolution.kernels import Model1DKernel\n        >>> gauss = Gaussian1D(1, 0, 2)\n\n    And create a custom one dimensional kernel from it:\n\n        >>> gauss_kernel = Model1DKernel(gauss, x_size=9)\n\n    This kernel can now be used like a usual Astropy kernel.\n    \"\"\"\n    _separable = False\n    _is_bool = False\n\n    def __init__(self, model, **kwargs):\n        if isinstance(model, Fittable1DModel):\n            self._model = model\n        else:\n            raise TypeError(\"Must be Fittable1DModel\")\n        super().__init__(**kwargs)"},{"col":4,"comment":"null","endLoc":907,"header":"def __init__(self, model, **kwargs)","id":14984,"name":"__init__","nodeType":"Function","startLoc":902,"text":"def __init__(self, model, **kwargs):\n        if isinstance(model, Fittable1DModel):\n            self._model = model\n        else:\n            raise TypeError(\"Must be Fittable1DModel\")\n        super().__init__(**kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":899,"id":14985,"name":"_separable","nodeType":"Attribute","startLoc":899,"text":"_separable"},{"attributeType":"null","col":4,"comment":"null","endLoc":900,"id":14986,"name":"_is_bool","nodeType":"Attribute","startLoc":900,"text":"_is_bool"},{"className":"UnitSphericalRepresentation","col":0,"comment":"\n    Representation of points on a unit sphere.\n\n    Parameters\n    ----------\n    lon, lat : `~astropy.units.Quantity` ['angle'] or str\n        The longitude and latitude of the point(s), in angular units. The\n        latitude should be between -90 and 90 degrees, and the longitude will\n        be wrapped to an angle between 0 and 360 degrees. These can also be\n        instances of `~astropy.coordinates.Angle`,\n        `~astropy.coordinates.Longitude`, or `~astropy.coordinates.Latitude`.\n\n    differentials : dict, `~astropy.coordinates.BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `~astropy.coordinates.BaseDifferential`\n        instance (see `._compatible_differentials` for valid types), or a\n        dictionary of of differential instances with keys set to a string\n        representation of the SI unit with which the differential (derivative)\n        is taken. For example, for a velocity differential on a positional\n        representation, the key would be ``'s'`` for seconds, indicating that\n        the derivative is a time derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    ","endLoc":1761,"id":14987,"nodeType":"Class","startLoc":1518,"text":"class UnitSphericalRepresentation(BaseRepresentation):\n    \"\"\"\n    Representation of points on a unit sphere.\n\n    Parameters\n    ----------\n    lon, lat : `~astropy.units.Quantity` ['angle'] or str\n        The longitude and latitude of the point(s), in angular units. The\n        latitude should be between -90 and 90 degrees, and the longitude will\n        be wrapped to an angle between 0 and 360 degrees. These can also be\n        instances of `~astropy.coordinates.Angle`,\n        `~astropy.coordinates.Longitude`, or `~astropy.coordinates.Latitude`.\n\n    differentials : dict, `~astropy.coordinates.BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `~astropy.coordinates.BaseDifferential`\n        instance (see `._compatible_differentials` for valid types), or a\n        dictionary of of differential instances with keys set to a string\n        representation of the SI unit with which the differential (derivative)\n        is taken. For example, for a velocity differential on a positional\n        representation, the key would be ``'s'`` for seconds, indicating that\n        the derivative is a time derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n\n    attr_classes = {'lon': Longitude,\n                    'lat': Latitude}\n\n    @classproperty\n    def _dimensional_representation(cls):\n        return SphericalRepresentation\n\n    def __init__(self, lon, lat=None, differentials=None, copy=True):\n        super().__init__(lon, lat, differentials=differentials, copy=copy)\n\n    @classproperty\n    def _compatible_differentials(cls):\n        return [UnitSphericalDifferential, UnitSphericalCosLatDifferential,\n                SphericalDifferential, SphericalCosLatDifferential,\n                RadialDifferential]\n\n    # Could let the metaclass define these automatically, but good to have\n    # a bit clearer docstrings.\n    @property\n    def lon(self):\n        \"\"\"\n        The longitude of the point(s).\n        \"\"\"\n        return self._lon\n\n    @property\n    def lat(self):\n        \"\"\"\n        The latitude of the point(s).\n        \"\"\"\n        return self._lat\n\n    def unit_vectors(self):\n        sinlon, coslon = np.sin(self.lon), np.cos(self.lon)\n        sinlat, coslat = np.sin(self.lat), np.cos(self.lat)\n        return {\n            'lon': CartesianRepresentation(-sinlon, coslon, 0., copy=False),\n            'lat': CartesianRepresentation(-sinlat*coslon, -sinlat*sinlon,\n                                           coslat, copy=False)}\n\n    def scale_factors(self, omit_coslat=False):\n        sf_lat = np.broadcast_to(1./u.radian, self.shape, subok=True)\n        sf_lon = sf_lat if omit_coslat else np.cos(self.lat) / u.radian\n        return {'lon': sf_lon,\n                'lat': sf_lat}\n\n    def to_cartesian(self):\n        \"\"\"\n        Converts spherical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        \"\"\"\n        # erfa s2c: Convert [unit]spherical coordinates to Cartesian.\n        p = erfa_ufunc.s2c(self.lon, self.lat)\n        return CartesianRepresentation(p, xyz_axis=-1, copy=False)\n\n    @classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates to spherical polar\n        coordinates.\n        \"\"\"\n        p = cart.get_xyz(xyz_axis=-1)\n        # erfa c2s: P-vector to [unit]spherical coordinates.\n        return cls(*erfa_ufunc.c2s(p), copy=False)\n\n    def represent_as(self, other_class, differential_class=None):\n        # Take a short cut if the other class is a spherical representation\n        # TODO! for differential_class. This cannot (currently) be implemented\n        # like in the other Representations since `_re_represent_differentials`\n        # keeps differentials' unit keys, but this can result in a mismatch\n        # between the UnitSpherical expected key (e.g. \"s\") and that expected\n        # in the other class (here \"s / m\"). For more info, see PR #11467\n        if inspect.isclass(other_class) and not differential_class:\n            if issubclass(other_class, PhysicsSphericalRepresentation):\n                return other_class(phi=self.lon, theta=90 * u.deg - self.lat,\n                                   r=1.0, copy=False)\n            elif issubclass(other_class, SphericalRepresentation):\n                return other_class(lon=self.lon, lat=self.lat, distance=1.0,\n                                   copy=False)\n\n        return super().represent_as(other_class, differential_class)\n\n    def transform(self, matrix):\n        r\"\"\"Transform the unit-spherical coordinates using a 3x3 matrix.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 matrix, such as a rotation matrix (or a stack of matrices).\n\n        Returns\n        -------\n        `UnitSphericalRepresentation` or `SphericalRepresentation`\n            If ``matrix`` is O(3) -- :math:`M \\dot M^T = I` -- like a rotation,\n            then the result is a `UnitSphericalRepresentation`.\n            All other matrices will change the distance, so the dimensional\n            representation is used instead.\n\n        \"\"\"\n        # the transformation matrix does not need to be a rotation matrix,\n        # so the unit-distance is not guaranteed. For speed, we check if the\n        # matrix is in O(3) and preserves lengths.\n        if np.all(is_O3(matrix)):  # remain in unit-rep\n            xyz = erfa_ufunc.s2c(self.lon, self.lat)\n            p = erfa_ufunc.rxp(matrix, xyz)\n            lon, lat = erfa_ufunc.c2s(p)\n            rep = self.__class__(lon=lon, lat=lat)\n            # handle differentials\n            new_diffs = dict((k, d.transform(matrix, self, rep))\n                             for k, d in self.differentials.items())\n            rep = rep.with_differentials(new_diffs)\n\n        else:  # switch to dimensional representation\n            rep = self._dimensional_representation(\n                lon=self.lon, lat=self.lat, distance=1,\n                differentials=self.differentials\n            ).transform(matrix)\n\n        return rep\n\n    def _scale_operation(self, op, *args):\n        return self._dimensional_representation(\n            lon=self.lon, lat=self.lat, distance=1.,\n            differentials=self.differentials)._scale_operation(op, *args)\n\n    def __neg__(self):\n        if any(differential.base_representation is not self.__class__\n               for differential in self.differentials.values()):\n            return super().__neg__()\n\n        result = self.__class__(self.lon + 180. * u.deg, -self.lat, copy=False)\n        for key, differential in self.differentials.items():\n            new_comps = (op(getattr(differential, comp))\n                         for op, comp in zip((operator.pos, operator.neg),\n                                             differential.components))\n            result.differentials[key] = differential.__class__(*new_comps, copy=False)\n        return result\n\n    def norm(self):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units, which is\n        always unity for vectors on the unit sphere.\n\n        Returns\n        -------\n        norm : `~astropy.units.Quantity` ['dimensionless']\n            Dimensionless ones, with the same shape as the representation.\n        \"\"\"\n        return u.Quantity(np.ones(self.shape), u.dimensionless_unscaled,\n                          copy=False)\n\n    def _combine_operation(self, op, other, reverse=False):\n        self._raise_if_has_differentials(op.__name__)\n\n        result = self.to_cartesian()._combine_operation(op, other, reverse)\n        if result is NotImplemented:\n            return NotImplemented\n        else:\n            return self._dimensional_representation.from_cartesian(result)\n\n    def mean(self, *args, **kwargs):\n        \"\"\"Vector mean.\n\n        The representation is converted to cartesian, the means of the x, y,\n        and z components are calculated, and the result is converted to a\n        `~astropy.coordinates.SphericalRepresentation`.\n\n        Refer to `~numpy.mean` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n        \"\"\"\n        self._raise_if_has_differentials('mean')\n        return self._dimensional_representation.from_cartesian(\n            self.to_cartesian().mean(*args, **kwargs))\n\n    def sum(self, *args, **kwargs):\n        \"\"\"Vector sum.\n\n        The representation is converted to cartesian, the sums of the x, y,\n        and z components are calculated, and the result is converted to a\n        `~astropy.coordinates.SphericalRepresentation`.\n\n        Refer to `~numpy.sum` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n        \"\"\"\n        self._raise_if_has_differentials('sum')\n        return self._dimensional_representation.from_cartesian(\n            self.to_cartesian().sum(*args, **kwargs))\n\n    def cross(self, other):\n        \"\"\"Cross product of two representations.\n\n        The calculation is done by converting both ``self`` and ``other``\n        to `~astropy.coordinates.CartesianRepresentation`, and converting the\n        result back to `~astropy.coordinates.SphericalRepresentation`.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The representation to take the cross product with.\n\n        Returns\n        -------\n        cross_product : `~astropy.coordinates.SphericalRepresentation`\n            With vectors perpendicular to both ``self`` and ``other``.\n        \"\"\"\n        self._raise_if_has_differentials('cross')\n        return self._dimensional_representation.from_cartesian(\n            self.to_cartesian().cross(other))"},{"col":4,"comment":"Convert the differential to 3D rectangular cartesian coordinates.\n\n        Parameters\n        ----------\n        base : instance of ``self.base_representation``\n            The points for which the differentials are to be converted: each of\n            the components is multiplied by its unit vectors and scale factors.\n\n        Returns\n        -------\n        `CartesianDifferential`\n            This object, converted.\n\n        ","endLoc":2561,"header":"def to_cartesian(self, base)","id":14988,"name":"to_cartesian","nodeType":"Function","startLoc":2543,"text":"def to_cartesian(self, base):\n        \"\"\"Convert the differential to 3D rectangular cartesian coordinates.\n\n        Parameters\n        ----------\n        base : instance of ``self.base_representation``\n            The points for which the differentials are to be converted: each of\n            the components is multiplied by its unit vectors and scale factors.\n\n        Returns\n        -------\n        `CartesianDifferential`\n            This object, converted.\n\n        \"\"\"\n        base_e, base_sf = self._get_base_vectors(base)\n        return functools.reduce(\n            operator.add, (getattr(self, d_c) * base_sf[c] * base_e[c]\n                           for d_c, c in zip(self.components, base.components)))"},{"col":4,"comment":"null","endLoc":1551,"header":"@classproperty\n    def _dimensional_representation(cls)","id":14989,"name":"_dimensional_representation","nodeType":"Function","startLoc":1549,"text":"@classproperty\n    def _dimensional_representation(cls):\n        return SphericalRepresentation"},{"col":4,"comment":"null","endLoc":1560,"header":"@classproperty\n    def _compatible_differentials(cls)","id":14990,"name":"_compatible_differentials","nodeType":"Function","startLoc":1556,"text":"@classproperty\n    def _compatible_differentials(cls):\n        return [UnitSphericalDifferential, UnitSphericalCosLatDifferential,\n                SphericalDifferential, SphericalCosLatDifferential,\n                RadialDifferential]"},{"col":4,"comment":"\n        The longitude of the point(s).\n        ","endLoc":1569,"header":"@property\n    def lon(self)","id":14991,"name":"lon","nodeType":"Function","startLoc":1564,"text":"@property\n    def lon(self):\n        \"\"\"\n        The longitude of the point(s).\n        \"\"\"\n        return self._lon"},{"col":4,"comment":"\n        The latitude of the point(s).\n        ","endLoc":1576,"header":"@property\n    def lat(self)","id":14992,"name":"lat","nodeType":"Function","startLoc":1571,"text":"@property\n    def lat(self):\n        \"\"\"\n        The latitude of the point(s).\n        \"\"\"\n        return self._lat"},{"col":4,"comment":"null","endLoc":1584,"header":"def unit_vectors(self)","id":14993,"name":"unit_vectors","nodeType":"Function","startLoc":1578,"text":"def unit_vectors(self):\n        sinlon, coslon = np.sin(self.lon), np.cos(self.lon)\n        sinlat, coslat = np.sin(self.lat), np.cos(self.lat)\n        return {\n            'lon': CartesianRepresentation(-sinlon, coslon, 0., copy=False),\n            'lat': CartesianRepresentation(-sinlat*coslon, -sinlat*sinlon,\n                                           coslat, copy=False)}"},{"attributeType":"Fittable1DModel","col":12,"comment":"null","endLoc":904,"id":14994,"name":"_model","nodeType":"Attribute","startLoc":904,"text":"self._model"},{"col":4,"comment":"Convert the differential from 3D rectangular cartesian coordinates to\n        the desired class.\n\n        Parameters\n        ----------\n        other\n            The object to convert into this differential.\n        base : `BaseRepresentation`\n            The points for which the differentials are to be converted: each of\n            the components is multiplied by its unit vectors and scale factors.\n            Will be converted to ``cls.base_representation`` if needed.\n\n        Returns\n        -------\n        `BaseDifferential` subclass instance\n            A new differential object that is this class' type.\n        ","endLoc":2585,"header":"@classmethod\n    def from_cartesian(cls, other, base)","id":14995,"name":"from_cartesian","nodeType":"Function","startLoc":2563,"text":"@classmethod\n    def from_cartesian(cls, other, base):\n        \"\"\"Convert the differential from 3D rectangular cartesian coordinates to\n        the desired class.\n\n        Parameters\n        ----------\n        other\n            The object to convert into this differential.\n        base : `BaseRepresentation`\n            The points for which the differentials are to be converted: each of\n            the components is multiplied by its unit vectors and scale factors.\n            Will be converted to ``cls.base_representation`` if needed.\n\n        Returns\n        -------\n        `BaseDifferential` subclass instance\n            A new differential object that is this class' type.\n        \"\"\"\n        base = base.represent_as(cls.base_representation)\n        base_e, base_sf = cls._get_base_vectors(base)\n        return cls(*(other.dot(e / base_sf[component])\n                     for component, e in base_e.items()), copy=False)"},{"attributeType":"null","col":12,"comment":"null","endLoc":2548,"id":14996,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":2548,"text":"self._inv_efunc_scalar"},{"className":"ErfaAstromInterpolator","col":0,"comment":"\n    A provider for astrometry values that does not call erfa\n    for each individual timestamp but interpolates linearly\n    between support points.\n\n    For the interpolation, float64 MJD values are used, so time precision\n    for the interpolation will be around a microsecond.\n\n    This can dramatically speed up coordinate transformations,\n    e.g. between CIRS and ICRS,\n    when obstime is an array of many values (factors of 10 to > 100 depending\n    on the selected resolution, number of points and the time range of the values).\n\n    The precision of the transformation will still be in the order of microseconds\n    for reasonable values of time_resolution, e.g. ``300 * u.s``.\n\n    Users should benchmark performance and accuracy with the default transformation\n    for their specific use case and then choose a suitable ``time_resolution``\n    from there.\n\n    This class is intended be used together with the ``erfa_astrom`` science state,\n    e.g. in a context manager like this\n\n    Example\n    -------\n    >>> from astropy.coordinates import SkyCoord, CIRS\n    >>> from astropy.coordinates.erfa_astrom import erfa_astrom, ErfaAstromInterpolator\n    >>> import astropy.units as u\n    >>> from astropy.time import Time\n    >>> import numpy as np\n\n    >>> obstime = Time('2010-01-01T20:00:00') + np.linspace(0, 4, 1000) * u.hour\n    >>> crab = SkyCoord(ra='05h34m31.94s', dec='22d00m52.2s')\n    >>> with erfa_astrom.set(ErfaAstromInterpolator(300 * u.s)):\n    ...    cirs = crab.transform_to(CIRS(obstime=obstime))\n    ","endLoc":383,"id":14997,"nodeType":"Class","startLoc":170,"text":"class ErfaAstromInterpolator(ErfaAstrom):\n    '''\n    A provider for astrometry values that does not call erfa\n    for each individual timestamp but interpolates linearly\n    between support points.\n\n    For the interpolation, float64 MJD values are used, so time precision\n    for the interpolation will be around a microsecond.\n\n    This can dramatically speed up coordinate transformations,\n    e.g. between CIRS and ICRS,\n    when obstime is an array of many values (factors of 10 to > 100 depending\n    on the selected resolution, number of points and the time range of the values).\n\n    The precision of the transformation will still be in the order of microseconds\n    for reasonable values of time_resolution, e.g. ``300 * u.s``.\n\n    Users should benchmark performance and accuracy with the default transformation\n    for their specific use case and then choose a suitable ``time_resolution``\n    from there.\n\n    This class is intended be used together with the ``erfa_astrom`` science state,\n    e.g. in a context manager like this\n\n    Example\n    -------\n    >>> from astropy.coordinates import SkyCoord, CIRS\n    >>> from astropy.coordinates.erfa_astrom import erfa_astrom, ErfaAstromInterpolator\n    >>> import astropy.units as u\n    >>> from astropy.time import Time\n    >>> import numpy as np\n\n    >>> obstime = Time('2010-01-01T20:00:00') + np.linspace(0, 4, 1000) * u.hour\n    >>> crab = SkyCoord(ra='05h34m31.94s', dec='22d00m52.2s')\n    >>> with erfa_astrom.set(ErfaAstromInterpolator(300 * u.s)):\n    ...    cirs = crab.transform_to(CIRS(obstime=obstime))\n    '''\n\n    @u.quantity_input(time_resolution=u.day)\n    def __init__(self, time_resolution):\n        if time_resolution.to_value(u.us) < 10:\n            warnings.warn(\n                f'Using {self.__class__.__name__} with `time_resolution`'\n                ' below 10 microseconds might lead to numerical inaccuracies'\n                ' as the MJD-based interpolation is limited by floating point '\n                ' precision to about a microsecond of precision',\n                AstropyWarning\n            )\n        self.mjd_resolution = time_resolution.to_value(u.day)\n\n    def _get_support_points(self, obstime):\n        '''\n        Calculate support points for the interpolation.\n\n        We divide the MJD by the time resolution (as single float64 values),\n        and calculate ceil and floor.\n        Then we take the unique and sorted values and scale back to MJD.\n        This will create a sparse support for non-regular input obstimes.\n        '''\n        mjd_scaled = np.ravel(obstime.mjd / self.mjd_resolution)\n\n        # unique already does sorting\n        mjd_u = np.unique(np.concatenate([\n            np.floor(mjd_scaled),\n            np.ceil(mjd_scaled),\n        ]))\n\n        return Time(\n            mjd_u * self.mjd_resolution,\n            format='mjd',\n            scale=obstime.scale,\n        )\n\n    @staticmethod\n    def _prepare_earth_position_vel(support, obstime):\n        \"\"\"\n        Calculate Earth's position and velocity.\n\n        Uses the coarser grid ``support`` to do the calculation, and interpolates\n        onto the finer grid ``obstime``.\n        \"\"\"\n        pv_support, heliocentric_support = prepare_earth_position_vel(support)\n\n        # do interpolation\n        earth_pv = np.empty(obstime.shape, dtype=erfa.dt_pv)\n        earth_heliocentric = np.empty(obstime.shape + (3,))\n        for dim in range(3):\n            for key in 'pv':\n                earth_pv[key][..., dim] = np.interp(\n                    obstime.mjd,\n                    support.mjd,\n                    pv_support[key][..., dim]\n                )\n            earth_heliocentric[..., dim] = np.interp(\n                obstime.mjd, support.mjd, heliocentric_support[..., dim]\n            )\n\n        return earth_pv, earth_heliocentric\n\n    @staticmethod\n    def _get_c2i(support, obstime):\n        \"\"\"\n        Calculate the Celestial-to-Intermediate rotation matrix.\n\n        Uses the coarser grid ``support`` to do the calculation, and interpolates\n        onto the finer grid ``obstime``.\n        \"\"\"\n        jd1_tt_support, jd2_tt_support = get_jd12(support, 'tt')\n        c2i_support = erfa.c2i06a(jd1_tt_support, jd2_tt_support)\n        c2i = np.empty(obstime.shape + (3, 3))\n        for dim1 in range(3):\n            for dim2 in range(3):\n                c2i[..., dim1, dim2] = np.interp(obstime.mjd, support.mjd, c2i_support[..., dim1, dim2])\n        return c2i\n\n    @staticmethod\n    def _get_cip(support, obstime):\n        \"\"\"\n        Find the X, Y coordinates of the CIP and the CIO locator, s.\n\n        Uses the coarser grid ``support`` to do the calculation, and interpolates\n        onto the finer grid ``obstime``.\n        \"\"\"\n        jd1_tt_support, jd2_tt_support = get_jd12(support, 'tt')\n        cip_support = get_cip(jd1_tt_support, jd2_tt_support)\n        return tuple(\n            np.interp(obstime.mjd, support.mjd, cip_component)\n            for cip_component in cip_support\n        )\n\n    @staticmethod\n    def _get_polar_motion(support, obstime):\n        \"\"\"\n        Find the two polar motion components in radians\n\n        Uses the coarser grid ``support`` to do the calculation, and interpolates\n        onto the finer grid ``obstime``.\n        \"\"\"\n        polar_motion_support = get_polar_motion(support)\n        return tuple(\n            np.interp(obstime.mjd, support.mjd, polar_motion_component)\n            for polar_motion_component in polar_motion_support\n        )\n\n    def apco(self, frame_or_coord):\n        '''\n        Wrapper for ``erfa.apco``, used in conversions AltAz <-> ICRS and CIRS <-> ICRS\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, an AltAz or CIRS frame is expected.\n        '''\n        lon, lat, height = frame_or_coord.location.to_geodetic('WGS84')\n        obstime = frame_or_coord.obstime\n        support = self._get_support_points(obstime)\n        jd1_tt, jd2_tt = get_jd12(obstime, 'tt')\n\n        # get the position and velocity arrays for the observatory.  Need to\n        # have xyz in last dimension, and pos/vel in one-but-last.\n        earth_pv, earth_heliocentric = self._prepare_earth_position_vel(support, obstime)\n\n        xp, yp = self._get_polar_motion(support, obstime)\n        sp = erfa.sp00(jd1_tt, jd2_tt)\n        x, y, s = self._get_cip(support, obstime)\n        era = erfa.era00(*get_jd12(obstime, 'ut1'))\n\n        # refraction constants\n        if hasattr(frame_or_coord, 'pressure'):\n            # an AltAz like frame. Include refraction\n            refa, refb = erfa.refco(\n                frame_or_coord.pressure.to_value(u.hPa),\n                frame_or_coord.temperature.to_value(u.deg_C),\n                frame_or_coord.relative_humidity.value,\n                frame_or_coord.obswl.to_value(u.micron)\n            )\n        else:\n            # a CIRS like frame - no refraction\n            refa, refb = 0.0, 0.0\n\n        return erfa.apco(\n            jd1_tt, jd2_tt, earth_pv, earth_heliocentric, x, y, s, era,\n            lon.to_value(u.radian),\n            lat.to_value(u.radian),\n            height.to_value(u.m),\n            xp, yp, sp, refa, refb\n        )\n\n    def apcs(self, frame_or_coord):\n        '''\n        Wrapper for ``erfa.apci``, used in conversions GCRS <-> ICRS\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, a GCRS frame is expected.\n        '''\n        obstime = frame_or_coord.obstime\n        support = self._get_support_points(obstime)\n\n        # get the position and velocity arrays for the observatory.  Need to\n        # have xyz in last dimension, and pos/vel in one-but-last.\n        earth_pv, earth_heliocentric = self._prepare_earth_position_vel(support, obstime)\n        pv = pav2pv(\n            frame_or_coord.obsgeoloc.get_xyz(xyz_axis=-1).value,\n            frame_or_coord.obsgeovel.get_xyz(xyz_axis=-1).value\n        )\n\n        jd1_tt, jd2_tt = get_jd12(obstime, 'tt')\n        return erfa.apcs(jd1_tt, jd2_tt, pv, earth_pv, earth_heliocentric)"},{"col":4,"comment":"null","endLoc":218,"header":"@u.quantity_input(time_resolution=u.day)\n    def __init__(self, time_resolution)","id":14998,"name":"__init__","nodeType":"Function","startLoc":208,"text":"@u.quantity_input(time_resolution=u.day)\n    def __init__(self, time_resolution):\n        if time_resolution.to_value(u.us) < 10:\n            warnings.warn(\n                f'Using {self.__class__.__name__} with `time_resolution`'\n                ' below 10 microseconds might lead to numerical inaccuracies'\n                ' as the MJD-based interpolation is limited by floating point '\n                ' precision to about a microsecond of precision',\n                AstropyWarning\n            )\n        self.mjd_resolution = time_resolution.to_value(u.day)"},{"col":4,"comment":"Convert coordinates to another representation.\n\n        If the instance is of the requested class, it is returned unmodified.\n        By default, conversion is done via cartesian coordinates.\n\n        Parameters\n        ----------\n        other_class : `~astropy.coordinates.BaseRepresentation` subclass\n            The type of representation to turn the coordinates into.\n        base : instance of ``self.base_representation``\n            Base relative to which the differentials are defined.  If the other\n            class is a differential representation, the base will be converted\n            to its ``base_representation``.\n        ","endLoc":2610,"header":"def represent_as(self, other_class, base)","id":14999,"name":"represent_as","nodeType":"Function","startLoc":2587,"text":"def represent_as(self, other_class, base):\n        \"\"\"Convert coordinates to another representation.\n\n        If the instance is of the requested class, it is returned unmodified.\n        By default, conversion is done via cartesian coordinates.\n\n        Parameters\n        ----------\n        other_class : `~astropy.coordinates.BaseRepresentation` subclass\n            The type of representation to turn the coordinates into.\n        base : instance of ``self.base_representation``\n            Base relative to which the differentials are defined.  If the other\n            class is a differential representation, the base will be converted\n            to its ``base_representation``.\n        \"\"\"\n        if other_class is self.__class__:\n            return self\n\n        # The default is to convert via cartesian coordinates.\n        self_cartesian = self.to_cartesian(base)\n        if issubclass(other_class, BaseDifferential):\n            return other_class.from_cartesian(self_cartesian, base)\n        else:\n            return other_class.from_cartesian(self_cartesian)"},{"col":4,"comment":"\n        Calculate support points for the interpolation.\n\n        We divide the MJD by the time resolution (as single float64 values),\n        and calculate ceil and floor.\n        Then we take the unique and sorted values and scale back to MJD.\n        This will create a sparse support for non-regular input obstimes.\n        ","endLoc":241,"header":"def _get_support_points(self, obstime)","id":15000,"name":"_get_support_points","nodeType":"Function","startLoc":220,"text":"def _get_support_points(self, obstime):\n        '''\n        Calculate support points for the interpolation.\n\n        We divide the MJD by the time resolution (as single float64 values),\n        and calculate ceil and floor.\n        Then we take the unique and sorted values and scale back to MJD.\n        This will create a sparse support for non-regular input obstimes.\n        '''\n        mjd_scaled = np.ravel(obstime.mjd / self.mjd_resolution)\n\n        # unique already does sorting\n        mjd_u = np.unique(np.concatenate([\n            np.floor(mjd_scaled),\n            np.ceil(mjd_scaled),\n        ]))\n\n        return Time(\n            mjd_u * self.mjd_resolution,\n            format='mjd',\n            scale=obstime.scale,\n        )"},{"col":4,"comment":"\n        Removes a coordinate transform from the graph.\n\n        Parameters\n        ----------\n        fromsys : class or None\n            The coordinate frame *class* to start from. If `None`,\n            ``transform`` will be searched for and removed (``tosys`` must\n            also be `None`).\n        tosys : class or None\n            The coordinate frame *class* to transform into. If `None`,\n            ``transform`` will be searched for and removed (``fromsys`` must\n            also be `None`).\n        transform : callable or None\n            The transformation object to be removed or `None`.  If `None`\n            and ``tosys`` and ``fromsys`` are supplied, there will be no\n            check to ensure the correct object is removed.\n        ","endLoc":262,"header":"def remove_transform(self, fromsys, tosys, transform)","id":15001,"name":"remove_transform","nodeType":"Function","startLoc":207,"text":"def remove_transform(self, fromsys, tosys, transform):\n        \"\"\"\n        Removes a coordinate transform from the graph.\n\n        Parameters\n        ----------\n        fromsys : class or None\n            The coordinate frame *class* to start from. If `None`,\n            ``transform`` will be searched for and removed (``tosys`` must\n            also be `None`).\n        tosys : class or None\n            The coordinate frame *class* to transform into. If `None`,\n            ``transform`` will be searched for and removed (``fromsys`` must\n            also be `None`).\n        transform : callable or None\n            The transformation object to be removed or `None`.  If `None`\n            and ``tosys`` and ``fromsys`` are supplied, there will be no\n            check to ensure the correct object is removed.\n        \"\"\"\n        if fromsys is None or tosys is None:\n            if not (tosys is None and fromsys is None):\n                raise ValueError('fromsys and tosys must both be None if either are')\n            if transform is None:\n                raise ValueError('cannot give all Nones to remove_transform')\n\n            # search for the requested transform by brute force and remove it\n            for a in self._graph:\n                agraph = self._graph[a]\n                for b in agraph:\n                    if agraph[b] is transform:\n                        del agraph[b]\n                        fromsys = a\n                        break\n\n                # If the transform was found, need to break out of the outer for loop too\n                if fromsys:\n                    break\n            else:\n                raise ValueError(f'Could not find transform {transform} in the graph')\n\n        else:\n            if transform is None:\n                self._graph[fromsys].pop(tosys, None)\n            else:\n                curr = self._graph[fromsys].get(tosys, None)\n                if curr is transform:\n                    self._graph[fromsys].pop(tosys)\n                else:\n                    raise ValueError('Current transform from {} to {} is not '\n                                     '{}'.format(fromsys, tosys, transform))\n\n        # Remove the subgraph if it is now empty\n        if self._graph[fromsys] == {}:\n            self._graph.pop(fromsys)\n\n        self.invalidate_cache()"},{"col":4,"comment":"null","endLoc":1590,"header":"def scale_factors(self, omit_coslat=False)","id":15002,"name":"scale_factors","nodeType":"Function","startLoc":1586,"text":"def scale_factors(self, omit_coslat=False):\n        sf_lat = np.broadcast_to(1./u.radian, self.shape, subok=True)\n        sf_lon = sf_lat if omit_coslat else np.cos(self.lat) / u.radian\n        return {'lon': sf_lon,\n                'lat': sf_lat}"},{"className":"Model2DKernel","col":0,"comment":"\n    Create kernel from 2D model.\n\n    The model has to be centered on x = 0 and y = 0.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.Fittable2DModel`\n        Kernel response function model\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*width +1⌋.\n        Must be odd.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*width +1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    Raises\n    ------\n    TypeError\n        If model is not an instance of `~astropy.modeling.Fittable2DModel`\n\n    See also\n    --------\n    Model1DKernel : Create kernel from `~astropy.modeling.Fittable1DModel`\n    CustomKernel : Create kernel from list or array\n\n    Examples\n    --------\n    Define a Gaussian2D model:\n\n        >>> from astropy.modeling.models import Gaussian2D\n        >>> from astropy.convolution.kernels import Model2DKernel\n        >>> gauss = Gaussian2D(1, 0, 0, 2, 2)\n\n    And create a custom two dimensional kernel from it:\n\n        >>> gauss_kernel = Model2DKernel(gauss, x_size=9)\n\n    This kernel can now be used like a usual astropy kernel.\n\n    ","endLoc":976,"id":15003,"nodeType":"Class","startLoc":910,"text":"class Model2DKernel(Kernel2D):\n    \"\"\"\n    Create kernel from 2D model.\n\n    The model has to be centered on x = 0 and y = 0.\n\n    Parameters\n    ----------\n    model : `~astropy.modeling.Fittable2DModel`\n        Kernel response function model\n    x_size : int, optional\n        Size in x direction of the kernel array. Default = ⌊8*width +1⌋.\n        Must be odd.\n    y_size : int, optional\n        Size in y direction of the kernel array. Default = ⌊8*width +1⌋.\n    mode : str, optional\n        One of the following discretization modes:\n            * 'center' (default)\n                Discretize model by taking the value\n                at the center of the bin.\n            * 'linear_interp'\n                Discretize model by performing a bilinear interpolation\n                between the values at the corners of the bin.\n            * 'oversample'\n                Discretize model by taking the average\n                on an oversampled grid.\n            * 'integrate'\n                Discretize model by integrating the\n                model over the bin.\n    factor : number, optional\n        Factor of oversampling. Default factor = 10.\n\n    Raises\n    ------\n    TypeError\n        If model is not an instance of `~astropy.modeling.Fittable2DModel`\n\n    See also\n    --------\n    Model1DKernel : Create kernel from `~astropy.modeling.Fittable1DModel`\n    CustomKernel : Create kernel from list or array\n\n    Examples\n    --------\n    Define a Gaussian2D model:\n\n        >>> from astropy.modeling.models import Gaussian2D\n        >>> from astropy.convolution.kernels import Model2DKernel\n        >>> gauss = Gaussian2D(1, 0, 0, 2, 2)\n\n    And create a custom two dimensional kernel from it:\n\n        >>> gauss_kernel = Model2DKernel(gauss, x_size=9)\n\n    This kernel can now be used like a usual astropy kernel.\n\n    \"\"\"\n    _is_bool = False\n    _separable = False\n\n    def __init__(self, model, **kwargs):\n        self._separable = False\n        if isinstance(model, Fittable2DModel):\n            self._model = model\n        else:\n            raise TypeError(\"Must be Fittable2DModel\")\n        super().__init__(**kwargs)"},{"col":4,"comment":"\n        Converts spherical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        ","endLoc":1599,"header":"def to_cartesian(self)","id":15004,"name":"to_cartesian","nodeType":"Function","startLoc":1592,"text":"def to_cartesian(self):\n        \"\"\"\n        Converts spherical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        \"\"\"\n        # erfa s2c: Convert [unit]spherical coordinates to Cartesian.\n        p = erfa_ufunc.s2c(self.lon, self.lat)\n        return CartesianRepresentation(p, xyz_axis=-1, copy=False)"},{"col":4,"comment":"null","endLoc":976,"header":"def __init__(self, model, **kwargs)","id":15005,"name":"__init__","nodeType":"Function","startLoc":970,"text":"def __init__(self, model, **kwargs):\n        self._separable = False\n        if isinstance(model, Fittable2DModel):\n            self._model = model\n        else:\n            raise TypeError(\"Must be Fittable2DModel\")\n        super().__init__(**kwargs)"},{"col":4,"comment":"\n        Converts 3D rectangular cartesian coordinates to spherical polar\n        coordinates.\n        ","endLoc":1609,"header":"@classmethod\n    def from_cartesian(cls, cart)","id":15006,"name":"from_cartesian","nodeType":"Function","startLoc":1601,"text":"@classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates to spherical polar\n        coordinates.\n        \"\"\"\n        p = cart.get_xyz(xyz_axis=-1)\n        # erfa c2s: P-vector to [unit]spherical coordinates.\n        return cls(*erfa_ufunc.c2s(p), copy=False)"},{"attributeType":"null","col":12,"comment":"null","endLoc":2549,"id":15007,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":2549,"text":"self._inv_efunc_scalar_args"},{"attributeType":"null","col":4,"comment":"null","endLoc":967,"id":15008,"name":"_is_bool","nodeType":"Attribute","startLoc":967,"text":"_is_bool"},{"col":4,"comment":"Create a new instance of this representation from another one.\n\n        Parameters\n        ----------\n        representation : `~astropy.coordinates.BaseRepresentation` instance\n            The presentation that should be converted to this class.\n        base : instance of ``cls.base_representation``\n            The base relative to which the differentials will be defined. If\n            the representation is a differential itself, the base will be\n            converted to its ``base_representation`` to help convert it.\n        ","endLoc":2631,"header":"@classmethod\n    def from_representation(cls, representation, base)","id":15009,"name":"from_representation","nodeType":"Function","startLoc":2612,"text":"@classmethod\n    def from_representation(cls, representation, base):\n        \"\"\"Create a new instance of this representation from another one.\n\n        Parameters\n        ----------\n        representation : `~astropy.coordinates.BaseRepresentation` instance\n            The presentation that should be converted to this class.\n        base : instance of ``cls.base_representation``\n            The base relative to which the differentials will be defined. If\n            the representation is a differential itself, the base will be\n            converted to its ``base_representation`` to help convert it.\n        \"\"\"\n        if isinstance(representation, BaseDifferential):\n            cartesian = representation.to_cartesian(\n                base.represent_as(representation.base_representation))\n        else:\n            cartesian = representation.to_cartesian()\n\n        return cls.from_cartesian(cartesian, base)"},{"attributeType":"null","col":4,"comment":"null","endLoc":968,"id":15010,"name":"_separable","nodeType":"Attribute","startLoc":968,"text":"_separable"},{"attributeType":"null","col":8,"comment":"null","endLoc":971,"id":15011,"name":"_separable","nodeType":"Attribute","startLoc":971,"text":"self._separable"},{"attributeType":"Fittable2DModel","col":12,"comment":"null","endLoc":973,"id":15012,"name":"_model","nodeType":"Attribute","startLoc":973,"text":"self._model"},{"col":4,"comment":"Transform differential using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new differential and does not modify the original one.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n        base : instance of ``cls.base_representation``\n            Base relative to which the differentials are defined.  If the other\n            class is a differential representation, the base will be converted\n            to its ``base_representation``.\n        transformed_base : instance of ``cls.base_representation``\n            Base relative to which the transformed differentials are defined.\n            If the other class is a differential representation, the base will\n            be converted to its ``base_representation``.\n        ","endLoc":2656,"header":"def transform(self, matrix, base, transformed_base)","id":15013,"name":"transform","nodeType":"Function","startLoc":2633,"text":"def transform(self, matrix, base, transformed_base):\n        \"\"\"Transform differential using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new differential and does not modify the original one.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n        base : instance of ``cls.base_representation``\n            Base relative to which the differentials are defined.  If the other\n            class is a differential representation, the base will be converted\n            to its ``base_representation``.\n        transformed_base : instance of ``cls.base_representation``\n            Base relative to which the transformed differentials are defined.\n            If the other class is a differential representation, the base will\n            be converted to its ``base_representation``.\n        \"\"\"\n        # route transformation through Cartesian\n        cdiff = self.represent_as(CartesianDifferential, base=base\n                                  ).transform(matrix)\n        # move back to original representation\n        diff = cdiff.represent_as(self.__class__, transformed_base)\n        return diff"},{"col":4,"comment":"\n        Calculate Earth's position and velocity.\n\n        Uses the coarser grid ``support`` to do the calculation, and interpolates\n        onto the finer grid ``obstime``.\n        ","endLoc":267,"header":"@staticmethod\n    def _prepare_earth_position_vel(support, obstime)","id":15014,"name":"_prepare_earth_position_vel","nodeType":"Function","startLoc":243,"text":"@staticmethod\n    def _prepare_earth_position_vel(support, obstime):\n        \"\"\"\n        Calculate Earth's position and velocity.\n\n        Uses the coarser grid ``support`` to do the calculation, and interpolates\n        onto the finer grid ``obstime``.\n        \"\"\"\n        pv_support, heliocentric_support = prepare_earth_position_vel(support)\n\n        # do interpolation\n        earth_pv = np.empty(obstime.shape, dtype=erfa.dt_pv)\n        earth_heliocentric = np.empty(obstime.shape + (3,))\n        for dim in range(3):\n            for key in 'pv':\n                earth_pv[key][..., dim] = np.interp(\n                    obstime.mjd,\n                    support.mjd,\n                    pv_support[key][..., dim]\n                )\n            earth_heliocentric[..., dim] = np.interp(\n                obstime.mjd, support.mjd, heliocentric_support[..., dim]\n            )\n\n        return earth_pv, earth_heliocentric"},{"col":4,"comment":"null","endLoc":1626,"header":"def represent_as(self, other_class, differential_class=None)","id":15015,"name":"represent_as","nodeType":"Function","startLoc":1611,"text":"def represent_as(self, other_class, differential_class=None):\n        # Take a short cut if the other class is a spherical representation\n        # TODO! for differential_class. This cannot (currently) be implemented\n        # like in the other Representations since `_re_represent_differentials`\n        # keeps differentials' unit keys, but this can result in a mismatch\n        # between the UnitSpherical expected key (e.g. \"s\") and that expected\n        # in the other class (here \"s / m\"). For more info, see PR #11467\n        if inspect.isclass(other_class) and not differential_class:\n            if issubclass(other_class, PhysicsSphericalRepresentation):\n                return other_class(phi=self.lon, theta=90 * u.deg - self.lat,\n                                   r=1.0, copy=False)\n            elif issubclass(other_class, SphericalRepresentation):\n                return other_class(lon=self.lon, lat=self.lat, distance=1.0,\n                                   copy=False)\n\n        return super().represent_as(other_class, differential_class)"},{"col":4,"comment":"\n        Calculate the Celestial-to-Intermediate rotation matrix.\n\n        Uses the coarser grid ``support`` to do the calculation, and interpolates\n        onto the finer grid ``obstime``.\n        ","endLoc":283,"header":"@staticmethod\n    def _get_c2i(support, obstime)","id":15016,"name":"_get_c2i","nodeType":"Function","startLoc":269,"text":"@staticmethod\n    def _get_c2i(support, obstime):\n        \"\"\"\n        Calculate the Celestial-to-Intermediate rotation matrix.\n\n        Uses the coarser grid ``support`` to do the calculation, and interpolates\n        onto the finer grid ``obstime``.\n        \"\"\"\n        jd1_tt_support, jd2_tt_support = get_jd12(support, 'tt')\n        c2i_support = erfa.c2i06a(jd1_tt_support, jd2_tt_support)\n        c2i = np.empty(obstime.shape + (3, 3))\n        for dim1 in range(3):\n            for dim2 in range(3):\n                c2i[..., dim1, dim2] = np.interp(obstime.mjd, support.mjd, c2i_support[..., dim1, dim2])\n        return c2i"},{"col":4,"comment":"Scale all components.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.mul`, `~operator.neg`, etc.\n        *args\n            Any arguments required for the operator (typically, what is to\n            be multiplied with, divided by).\n        scaled_base : bool, optional\n            Whether the base was scaled the same way. This affects whether\n            differential components should be scaled. For instance, a differential\n            in longitude should not be scaled if its spherical base is scaled\n            in radius.\n        ","endLoc":2675,"header":"def _scale_operation(self, op, *args, scaled_base=False)","id":15017,"name":"_scale_operation","nodeType":"Function","startLoc":2658,"text":"def _scale_operation(self, op, *args, scaled_base=False):\n        \"\"\"Scale all components.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.mul`, `~operator.neg`, etc.\n        *args\n            Any arguments required for the operator (typically, what is to\n            be multiplied with, divided by).\n        scaled_base : bool, optional\n            Whether the base was scaled the same way. This affects whether\n            differential components should be scaled. For instance, a differential\n            in longitude should not be scaled if its spherical base is scaled\n            in radius.\n        \"\"\"\n        scaled_attrs = [op(getattr(self, c), *args) for c in self.components]\n        return self.__class__(*scaled_attrs, copy=False)"},{"col":4,"comment":"\n        Find the X, Y coordinates of the CIP and the CIO locator, s.\n\n        Uses the coarser grid ``support`` to do the calculation, and interpolates\n        onto the finer grid ``obstime``.\n        ","endLoc":298,"header":"@staticmethod\n    def _get_cip(support, obstime)","id":15018,"name":"_get_cip","nodeType":"Function","startLoc":285,"text":"@staticmethod\n    def _get_cip(support, obstime):\n        \"\"\"\n        Find the X, Y coordinates of the CIP and the CIO locator, s.\n\n        Uses the coarser grid ``support`` to do the calculation, and interpolates\n        onto the finer grid ``obstime``.\n        \"\"\"\n        jd1_tt_support, jd2_tt_support = get_jd12(support, 'tt')\n        cip_support = get_cip(jd1_tt_support, jd2_tt_support)\n        return tuple(\n            np.interp(obstime.mjd, support.mjd, cip_component)\n            for cip_component in cip_support\n        )"},{"col":4,"comment":"Combine two differentials, or a differential with a representation.\n\n        If ``other`` is of the same differential type as ``self``, the\n        components will simply be combined.  If ``other`` is a representation,\n        it will be used as a base for which to evaluate the differential,\n        and the result is a new representation.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.add`, `~operator.sub`, etc.\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The other differential or representation.\n        reverse : bool\n            Whether the operands should be reversed (e.g., as we got here via\n            ``self.__rsub__`` because ``self`` is a subclass of ``other``).\n        ","endLoc":2705,"header":"def _combine_operation(self, op, other, reverse=False)","id":15019,"name":"_combine_operation","nodeType":"Function","startLoc":2677,"text":"def _combine_operation(self, op, other, reverse=False):\n        \"\"\"Combine two differentials, or a differential with a representation.\n\n        If ``other`` is of the same differential type as ``self``, the\n        components will simply be combined.  If ``other`` is a representation,\n        it will be used as a base for which to evaluate the differential,\n        and the result is a new representation.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.add`, `~operator.sub`, etc.\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The other differential or representation.\n        reverse : bool\n            Whether the operands should be reversed (e.g., as we got here via\n            ``self.__rsub__`` because ``self`` is a subclass of ``other``).\n        \"\"\"\n        if isinstance(self, type(other)):\n            first, second = (self, other) if not reverse else (other, self)\n            return self.__class__(*[op(getattr(first, c), getattr(second, c))\n                                    for c in self.components])\n        else:\n            try:\n                self_cartesian = self.to_cartesian(other)\n            except TypeError:\n                return NotImplemented\n\n            return other._combine_operation(op, self_cartesian, not reverse)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2533,"id":15020,"name":"w0","nodeType":"Attribute","startLoc":2533,"text":"self.w0"},{"className":"PSFKernel","col":0,"comment":"\n    Initialize filter kernel from astropy PSF instance.\n    ","endLoc":986,"id":15021,"nodeType":"Class","startLoc":979,"text":"class PSFKernel(Kernel2D):\n    \"\"\"\n    Initialize filter kernel from astropy PSF instance.\n    \"\"\"\n    _separable = False\n\n    def __init__(self):\n        raise NotImplementedError('Not yet implemented')"},{"col":4,"comment":"\n        Computes the shortest distance along the transform graph from\n        one system to another.\n\n        Parameters\n        ----------\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform into.\n\n        Returns\n        -------\n        path : list of class or None\n            The path from ``fromsys`` to ``tosys`` as an in-order sequence\n            of classes.  This list includes *both* ``fromsys`` and\n            ``tosys``. Is `None` if there is no possible path.\n        distance : float or int\n            The total distance/priority from ``fromsys`` to ``tosys``.  If\n            priorities are not set this is the number of transforms\n            needed. Is ``inf`` if there is no possible path.\n        ","endLoc":380,"header":"def find_shortest_path(self, fromsys, tosys)","id":15022,"name":"find_shortest_path","nodeType":"Function","startLoc":264,"text":"def find_shortest_path(self, fromsys, tosys):\n        \"\"\"\n        Computes the shortest distance along the transform graph from\n        one system to another.\n\n        Parameters\n        ----------\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform into.\n\n        Returns\n        -------\n        path : list of class or None\n            The path from ``fromsys`` to ``tosys`` as an in-order sequence\n            of classes.  This list includes *both* ``fromsys`` and\n            ``tosys``. Is `None` if there is no possible path.\n        distance : float or int\n            The total distance/priority from ``fromsys`` to ``tosys``.  If\n            priorities are not set this is the number of transforms\n            needed. Is ``inf`` if there is no possible path.\n        \"\"\"\n\n        inf = float('inf')\n\n        # special-case the 0 or 1-path\n        if tosys is fromsys:\n            if tosys not in self._graph[fromsys]:\n                # Means there's no transform necessary to go from it to itself.\n                return [tosys], 0\n        if tosys in self._graph[fromsys]:\n            # this will also catch the case where tosys is fromsys, but has\n            # a defined transform.\n            t = self._graph[fromsys][tosys]\n            return [fromsys, tosys], float(t.priority if hasattr(t, 'priority') else 1)\n\n        # otherwise, need to construct the path:\n\n        if fromsys in self._shortestpaths:\n            # already have a cached result\n            fpaths = self._shortestpaths[fromsys]\n            if tosys in fpaths:\n                return fpaths[tosys]\n            else:\n                return None, inf\n\n        # use Dijkstra's algorithm to find shortest path in all other cases\n\n        nodes = []\n        # first make the list of nodes\n        for a in self._graph:\n            if a not in nodes:\n                nodes.append(a)\n            for b in self._graph[a]:\n                if b not in nodes:\n                    nodes.append(b)\n\n        if fromsys not in nodes or tosys not in nodes:\n            # fromsys or tosys are isolated or not registered, so there's\n            # certainly no way to get from one to the other\n            return None, inf\n\n        edgeweights = {}\n        # construct another graph that is a dict of dicts of priorities\n        # (used as edge weights in Dijkstra's algorithm)\n        for a in self._graph:\n            edgeweights[a] = aew = {}\n            agraph = self._graph[a]\n            for b in agraph:\n                aew[b] = float(agraph[b].priority if hasattr(agraph[b], 'priority') else 1)\n\n        # entries in q are [distance, count, nodeobj, pathlist]\n        # count is needed because in py 3.x, tie-breaking fails on the nodes.\n        # this way, insertion order is preserved if the weights are the same\n        q = [[inf, i, n, []] for i, n in enumerate(nodes) if n is not fromsys]\n        q.insert(0, [0, -1, fromsys, []])\n\n        # this dict will store the distance to node from ``fromsys`` and the path\n        result = {}\n\n        # definitely starts as a valid heap because of the insert line; from the\n        # node to itself is always the shortest distance\n        while len(q) > 0:\n            d, orderi, n, path = heapq.heappop(q)\n\n            if d == inf:\n                # everything left is unreachable from fromsys, just copy them to\n                # the results and jump out of the loop\n                result[n] = (None, d)\n                for d, orderi, n, path in q:\n                    result[n] = (None, d)\n                break\n            else:\n                result[n] = (path, d)\n                path.append(n)\n                if n not in edgeweights:\n                    # this is a system that can be transformed to, but not from.\n                    continue\n                for n2 in edgeweights[n]:\n                    if n2 not in result:  # already visited\n                        # find where n2 is in the heap\n                        for i in range(len(q)):\n                            if q[i][2] == n2:\n                                break\n                        else:\n                            raise ValueError('n2 not in heap - this should be impossible!')\n\n                        newd = d + edgeweights[n][n2]\n                        if newd < q[i][0]:\n                            q[i][0] = newd\n                            q[i][3] = list(path)\n                            heapq.heapify(q)\n\n        # cache for later use\n        self._shortestpaths[fromsys] = result\n        return result[tosys]"},{"col":4,"comment":"null","endLoc":986,"header":"def __init__(self)","id":15023,"name":"__init__","nodeType":"Function","startLoc":985,"text":"def __init__(self):\n        raise NotImplementedError('Not yet implemented')"},{"attributeType":"null","col":4,"comment":"null","endLoc":983,"id":15024,"name":"_separable","nodeType":"Attribute","startLoc":983,"text":"_separable"},{"col":4,"comment":"\n        Find the two polar motion components in radians\n\n        Uses the coarser grid ``support`` to do the calculation, and interpolates\n        onto the finer grid ``obstime``.\n        ","endLoc":312,"header":"@staticmethod\n    def _get_polar_motion(support, obstime)","id":15025,"name":"_get_polar_motion","nodeType":"Function","startLoc":300,"text":"@staticmethod\n    def _get_polar_motion(support, obstime):\n        \"\"\"\n        Find the two polar motion components in radians\n\n        Uses the coarser grid ``support`` to do the calculation, and interpolates\n        onto the finer grid ``obstime``.\n        \"\"\"\n        polar_motion_support = get_polar_motion(support)\n        return tuple(\n            np.interp(obstime.mjd, support.mjd, polar_motion_component)\n            for polar_motion_component in polar_motion_support\n        )"},{"className":"CustomKernel","col":0,"comment":"\n    Create filter kernel from list or array.\n\n    Parameters\n    ----------\n    array : list or array\n        Filter kernel array. Size must be odd.\n\n    Raises\n    ------\n    TypeError\n        If array is not a list or array.\n    `~astropy.convolution.KernelSizeError`\n        If array size is even.\n\n    See also\n    --------\n    Model2DKernel, Model1DKernel\n\n    Examples\n    --------\n    Define one dimensional array:\n\n        >>> from astropy.convolution.kernels import CustomKernel\n        >>> import numpy as np\n        >>> array = np.array([1, 2, 3, 2, 1])\n        >>> kernel = CustomKernel(array)\n        >>> kernel.dimension\n        1\n\n    Define two dimensional array:\n\n        >>> array = np.array([[1, 1, 1], [1, 2, 1], [1, 1, 1]])\n        >>> kernel = CustomKernel(array)\n        >>> kernel.dimension\n        2\n    ","endLoc":1059,"id":15026,"nodeType":"Class","startLoc":989,"text":"class CustomKernel(Kernel):\n    \"\"\"\n    Create filter kernel from list or array.\n\n    Parameters\n    ----------\n    array : list or array\n        Filter kernel array. Size must be odd.\n\n    Raises\n    ------\n    TypeError\n        If array is not a list or array.\n    `~astropy.convolution.KernelSizeError`\n        If array size is even.\n\n    See also\n    --------\n    Model2DKernel, Model1DKernel\n\n    Examples\n    --------\n    Define one dimensional array:\n\n        >>> from astropy.convolution.kernels import CustomKernel\n        >>> import numpy as np\n        >>> array = np.array([1, 2, 3, 2, 1])\n        >>> kernel = CustomKernel(array)\n        >>> kernel.dimension\n        1\n\n    Define two dimensional array:\n\n        >>> array = np.array([[1, 1, 1], [1, 2, 1], [1, 1, 1]])\n        >>> kernel = CustomKernel(array)\n        >>> kernel.dimension\n        2\n    \"\"\"\n    def __init__(self, array):\n        self.array = array\n        super().__init__(self._array)\n\n    @property\n    def array(self):\n        \"\"\"\n        Filter kernel array.\n        \"\"\"\n        return self._array\n\n    @array.setter\n    def array(self, array):\n        \"\"\"\n        Filter kernel array setter\n        \"\"\"\n        if isinstance(array, np.ndarray):\n            self._array = array.astype(np.float64)\n        elif isinstance(array, list):\n            self._array = np.array(array, dtype=np.float64)\n        else:\n            raise TypeError(\"Must be list or array.\")\n\n        # Check if array is odd in all axes\n        if has_even_axis(self):\n            raise_even_kernel_exception()\n\n        # Check if array is bool\n        ones = self._array == 1.\n        zeros = self._array == 0\n        self._is_bool = bool(np.all(np.logical_or(ones, zeros)))\n\n        self._truncation = 0.0"},{"col":4,"comment":"null","endLoc":2711,"header":"def __sub__(self, other)","id":15027,"name":"__sub__","nodeType":"Function","startLoc":2707,"text":"def __sub__(self, other):\n        # avoid \"differential - representation\".\n        if isinstance(other, BaseRepresentation):\n            return NotImplemented\n        return super().__sub__(other)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2534,"id":15028,"name":"wa","nodeType":"Attribute","startLoc":2534,"text":"self.wa"},{"col":4,"comment":"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.\n\n        Parameters\n        ----------\n        base : instance of ``self.base_representation``\n            Base relative to which the differentials are defined. This is\n            required to calculate the physical size of the differential for\n            all but Cartesian differentials or radial differentials.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        ","endLoc":2735,"header":"def norm(self, base=None)","id":15029,"name":"norm","nodeType":"Function","startLoc":2713,"text":"def norm(self, base=None):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.\n\n        Parameters\n        ----------\n        base : instance of ``self.base_representation``\n            Base relative to which the differentials are defined. This is\n            required to calculate the physical size of the differential for\n            all but Cartesian differentials or radial differentials.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\n        # RadialDifferential overrides this function, so there is no handling here\n        if not isinstance(self, CartesianDifferential) and base is None:\n            raise ValueError(\"`base` must be provided to calculate the norm of a\"\n                             f\" {type(self).__name__}\")\n        return self.to_cartesian(base).norm()"},{"col":4,"comment":"null","endLoc":1029,"header":"def __init__(self, array)","id":15030,"name":"__init__","nodeType":"Function","startLoc":1027,"text":"def __init__(self, array):\n        self.array = array\n        super().__init__(self._array)"},{"col":4,"comment":"\n        Filter kernel array.\n        ","endLoc":1036,"header":"@property\n    def array(self)","id":15031,"name":"array","nodeType":"Function","startLoc":1031,"text":"@property\n    def array(self):\n        \"\"\"\n        Filter kernel array.\n        \"\"\"\n        return self._array"},{"col":4,"comment":"\n        Filter kernel array setter\n        ","endLoc":1059,"header":"@array.setter\n    def array(self, array)","id":15032,"name":"array","nodeType":"Function","startLoc":1038,"text":"@array.setter\n    def array(self, array):\n        \"\"\"\n        Filter kernel array setter\n        \"\"\"\n        if isinstance(array, np.ndarray):\n            self._array = array.astype(np.float64)\n        elif isinstance(array, list):\n            self._array = np.array(array, dtype=np.float64)\n        else:\n            raise TypeError(\"Must be list or array.\")\n\n        # Check if array is odd in all axes\n        if has_even_axis(self):\n            raise_even_kernel_exception()\n\n        # Check if array is bool\n        ones = self._array == 1.\n        zeros = self._array == 0\n        self._is_bool = bool(np.all(np.logical_or(ones, zeros)))\n\n        self._truncation = 0.0"},{"col":4,"comment":"\n        Wrapper for ``erfa.apco``, used in conversions AltAz <-> ICRS and CIRS <-> ICRS\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, an AltAz or CIRS frame is expected.\n        ","endLoc":358,"header":"def apco(self, frame_or_coord)","id":15033,"name":"apco","nodeType":"Function","startLoc":314,"text":"def apco(self, frame_or_coord):\n        '''\n        Wrapper for ``erfa.apco``, used in conversions AltAz <-> ICRS and CIRS <-> ICRS\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, an AltAz or CIRS frame is expected.\n        '''\n        lon, lat, height = frame_or_coord.location.to_geodetic('WGS84')\n        obstime = frame_or_coord.obstime\n        support = self._get_support_points(obstime)\n        jd1_tt, jd2_tt = get_jd12(obstime, 'tt')\n\n        # get the position and velocity arrays for the observatory.  Need to\n        # have xyz in last dimension, and pos/vel in one-but-last.\n        earth_pv, earth_heliocentric = self._prepare_earth_position_vel(support, obstime)\n\n        xp, yp = self._get_polar_motion(support, obstime)\n        sp = erfa.sp00(jd1_tt, jd2_tt)\n        x, y, s = self._get_cip(support, obstime)\n        era = erfa.era00(*get_jd12(obstime, 'ut1'))\n\n        # refraction constants\n        if hasattr(frame_or_coord, 'pressure'):\n            # an AltAz like frame. Include refraction\n            refa, refb = erfa.refco(\n                frame_or_coord.pressure.to_value(u.hPa),\n                frame_or_coord.temperature.to_value(u.deg_C),\n                frame_or_coord.relative_humidity.value,\n                frame_or_coord.obswl.to_value(u.micron)\n            )\n        else:\n            # a CIRS like frame - no refraction\n            refa, refb = 0.0, 0.0\n\n        return erfa.apco(\n            jd1_tt, jd2_tt, earth_pv, earth_heliocentric, x, y, s, era,\n            lon.to_value(u.radian),\n            lat.to_value(u.radian),\n            height.to_value(u.m),\n            xp, yp, sp, refa, refb\n        )"},{"className":"Flatw0waCDM","col":0,"comment":"FLRW cosmology with a CPL dark energy equation of state and no\n    curvature.\n\n    The equation for the dark energy equation of state uses the CPL form as\n    described in Chevallier & Polarski [1]_ and Linder [2]_:\n    :math:`w(z) = w_0 + w_a (1-a) = w_0 + w_a z / (1+z)`.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    w0 : float, optional\n        Dark energy equation of state at z=0 (a=1). This is pressure/density\n        for dark energy in units where c=1.\n\n    wa : float, optional\n        Negative derivative of the dark energy equation of state with respect\n        to the scale factor. A cosmological constant has w0=-1.0 and wa=0.0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import Flatw0waCDM\n    >>> cosmo = Flatw0waCDM(H0=70, Om0=0.3, w0=-0.9, wa=0.2)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n\n    References\n    ----------\n    .. [1] Chevallier, M., & Polarski, D. (2001). Accelerating Universes with\n           Scaling Dark Matter. International Journal of Modern Physics D,\n           10(2), 213-223.\n    .. [2] Linder, E. (2003). Exploring the Expansion History of the\n           Universe. Phys. Rev. Lett., 90, 091301.\n    ","endLoc":2703,"id":15034,"nodeType":"Class","startLoc":2609,"text":"class Flatw0waCDM(FlatFLRWMixin, w0waCDM):\n    \"\"\"FLRW cosmology with a CPL dark energy equation of state and no\n    curvature.\n\n    The equation for the dark energy equation of state uses the CPL form as\n    described in Chevallier & Polarski [1]_ and Linder [2]_:\n    :math:`w(z) = w_0 + w_a (1-a) = w_0 + w_a z / (1+z)`.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    w0 : float, optional\n        Dark energy equation of state at z=0 (a=1). This is pressure/density\n        for dark energy in units where c=1.\n\n    wa : float, optional\n        Negative derivative of the dark energy equation of state with respect\n        to the scale factor. A cosmological constant has w0=-1.0 and wa=0.0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import Flatw0waCDM\n    >>> cosmo = Flatw0waCDM(H0=70, Om0=0.3, w0=-0.9, wa=0.2)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n\n    References\n    ----------\n    .. [1] Chevallier, M., & Polarski, D. (2001). Accelerating Universes with\n           Scaling Dark Matter. International Journal of Modern Physics D,\n           10(2), 213-223.\n    .. [2] Linder, E. (2003). Exploring the Expansion History of the\n           Universe. Phys. Rev. Lett., 90, 091301.\n    \"\"\"\n\n    def __init__(self, H0, Om0, w0=-1.0, wa=0.0, Tcmb0=0.0*u.K, Neff=3.04,\n                 m_nu=0.0*u.eV, Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=0.0, w0=w0, wa=wa, Tcmb0=Tcmb0,\n                         Neff=Neff, m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fw0wacdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._w0, self._wa)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fw0wacdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._w0, self._wa)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fw0wacdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._w0,\n                                           self._wa)"},{"col":4,"comment":"null","endLoc":2703,"header":"def __init__(self, H0, Om0, w0=-1.0, wa=0.0, Tcmb0=0.0*u.K, Neff=3.04,\n                 m_nu=0.0*u.eV, Ob0=None, *, name=None, meta=None)","id":15035,"name":"__init__","nodeType":"Function","startLoc":2681,"text":"def __init__(self, H0, Om0, w0=-1.0, wa=0.0, Tcmb0=0.0*u.K, Neff=3.04,\n                 m_nu=0.0*u.eV, Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=0.0, w0=w0, wa=wa, Tcmb0=Tcmb0,\n                         Neff=Neff, m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fw0wacdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._w0, self._wa)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fw0wacdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._w0, self._wa)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.fw0wacdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._w0,\n                                           self._wa)"},{"attributeType":"null","col":12,"comment":"null","endLoc":2462,"id":15036,"name":"attr_classes","nodeType":"Attribute","startLoc":2462,"text":"cls.attr_classes"},{"col":4,"comment":"null","endLoc":3355,"header":"def to_cartesian(self, base)","id":15037,"name":"to_cartesian","nodeType":"Function","startLoc":3353,"text":"def to_cartesian(self, base):\n        return self.d_distance * base.represent_as(\n            UnitSphericalRepresentation).to_cartesian()"},{"col":4,"comment":"null","endLoc":3358,"header":"def norm(self, base=None)","id":15038,"name":"norm","nodeType":"Function","startLoc":3357,"text":"def norm(self, base=None):\n        return self.d_distance"},{"col":4,"comment":"null","endLoc":3363,"header":"@classmethod\n    def from_cartesian(cls, other, base)","id":15039,"name":"from_cartesian","nodeType":"Function","startLoc":3360,"text":"@classmethod\n    def from_cartesian(cls, other, base):\n        return cls(other.dot(base.represent_as(UnitSphericalRepresentation)),\n                   copy=False)"},{"attributeType":"null","col":12,"comment":"null","endLoc":1044,"id":15040,"name":"_array","nodeType":"Attribute","startLoc":1044,"text":"self._array"},{"attributeType":"null","col":8,"comment":"null","endLoc":1057,"id":15041,"name":"_is_bool","nodeType":"Attribute","startLoc":1057,"text":"self._is_bool"},{"col":4,"comment":"null","endLoc":3373,"header":"@classmethod\n    def from_representation(cls, representation, base=None)","id":15042,"name":"from_representation","nodeType":"Function","startLoc":3365,"text":"@classmethod\n    def from_representation(cls, representation, base=None):\n        if isinstance(representation, (SphericalDifferential,\n                                       SphericalCosLatDifferential)):\n            return cls(representation.d_distance)\n        elif isinstance(representation, PhysicsSphericalDifferential):\n            return cls(representation.d_r)\n        else:\n            return super().from_representation(representation, base)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1028,"id":15043,"name":"array","nodeType":"Attribute","startLoc":1028,"text":"self.array"},{"attributeType":"null","col":8,"comment":"null","endLoc":1059,"id":15044,"name":"_truncation","nodeType":"Attribute","startLoc":1059,"text":"self._truncation"},{"attributeType":"null","col":16,"comment":"null","endLoc":5,"id":15045,"name":"np","nodeType":"Attribute","startLoc":5,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":15046,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"kernels.py#<anonymous>","id":15047,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['Gaussian1DKernel', 'Gaussian2DKernel', 'CustomKernel',\n           'Box1DKernel', 'Box2DKernel', 'Tophat2DKernel',\n           'Trapezoid1DKernel', 'RickerWavelet1DKernel', 'RickerWavelet2DKernel',\n           'AiryDisk2DKernel', 'Moffat2DKernel', 'Model1DKernel',\n           'Model2DKernel', 'TrapezoidDisk2DKernel', 'Ring2DKernel']"},{"fileName":"spectral_quantity.py","filePath":"astropy/coordinates","id":15048,"nodeType":"File","text":"import numpy as np\nfrom astropy.units import si\nfrom astropy.units import equivalencies as eq\nfrom astropy.units import Unit\nfrom astropy.units.quantity import SpecificTypeQuantity, Quantity\nfrom astropy.units.decorators import quantity_input\n\n__all__ = ['SpectralQuantity']\n\n# We don't want to run doctests in the docstrings we inherit from Quantity\n__doctest_skip__ = ['SpectralQuantity.*']\n\nKMS = si.km / si.s\n\nSPECTRAL_UNITS = (si.Hz, si.m, si.J, si.m ** -1, KMS)\n\nDOPPLER_CONVENTIONS = {\n    'radio': eq.doppler_radio,\n    'optical': eq.doppler_optical,\n    'relativistic': eq.doppler_relativistic\n}\n\n\nclass SpectralQuantity(SpecificTypeQuantity):\n    \"\"\"\n    One or more value(s) with spectral units.\n\n    The spectral units should be those for frequencies, wavelengths, energies,\n    wavenumbers, or velocities (interpreted as Doppler velocities relative to a\n    rest spectral value). The advantage of using this class over the regular\n    `~astropy.units.Quantity` class is that in `SpectralQuantity`, the\n    ``u.spectral`` equivalency is enabled by default (allowing automatic\n    conversion between spectral units), and a preferred Doppler rest value and\n    convention can be stored for easy conversion to/from velocities.\n\n    Parameters\n    ----------\n    value : ndarray or `~astropy.units.Quantity` or `SpectralQuantity`\n        Spectral axis data values.\n    unit : unit-like\n        Unit for the given data.\n    doppler_rest : `~astropy.units.Quantity` ['speed'], optional\n        The rest value to use for conversions from/to velocities\n    doppler_convention : str, optional\n        The convention to use when converting the spectral data to/from\n        velocities.\n    \"\"\"\n\n    _equivalent_unit = SPECTRAL_UNITS\n\n    _include_easy_conversion_members = True\n\n    def __new__(cls, value, unit=None,\n                doppler_rest=None, doppler_convention=None,\n                **kwargs):\n\n        obj = super().__new__(cls, value, unit=unit, **kwargs)\n\n        # If we're initializing from an existing SpectralQuantity, keep any\n        # parameters that aren't being overridden\n        if doppler_rest is None:\n            doppler_rest = getattr(value, 'doppler_rest', None)\n        if doppler_convention is None:\n            doppler_convention = getattr(value, 'doppler_convention', None)\n\n        obj._doppler_rest = doppler_rest\n        obj._doppler_convention = doppler_convention\n\n        return obj\n\n    def __array_finalize__(self, obj):\n        super().__array_finalize__(obj)\n        self._doppler_rest = getattr(obj, '_doppler_rest', None)\n        self._doppler_convention = getattr(obj, '_doppler_convention', None)\n\n    def __quantity_subclass__(self, unit):\n        # Always default to just returning a Quantity, unless we explicitly\n        # choose to return a SpectralQuantity - even if the units match, we\n        # want to avoid doing things like adding two SpectralQuantity instances\n        # together and getting a SpectralQuantity back\n        if unit is self.unit:\n            return SpectralQuantity, True\n        else:\n            return Quantity, False\n\n    def __array_ufunc__(self, function, method, *inputs, **kwargs):\n        # We always return Quantity except in a few specific cases\n        result = super().__array_ufunc__(function, method, *inputs, **kwargs)\n        if ((function is np.multiply\n            or function is np.true_divide and inputs[0] is self)\n            and result.unit == self.unit\n            or (function in (np.minimum, np.maximum, np.fmax, np.fmin)\n                and method in ('reduce', 'reduceat'))):\n            result = result.view(self.__class__)\n            result.__array_finalize__(self)\n        else:\n            if result is self:\n                raise TypeError(f\"Cannot store the result of this operation in {self.__class__.__name__}\")\n            if result.dtype.kind == 'b':\n                result = result.view(np.ndarray)\n            else:\n                result = result.view(Quantity)\n        return result\n\n    @property\n    def doppler_rest(self):\n        \"\"\"\n        The rest value of the spectrum used for transformations to/from\n        velocity space.\n\n        Returns\n        -------\n        `~astropy.units.Quantity` ['speed']\n            Rest value as an astropy `~astropy.units.Quantity` object.\n        \"\"\"\n        return self._doppler_rest\n\n    @doppler_rest.setter\n    @quantity_input(value=SPECTRAL_UNITS)\n    def doppler_rest(self, value):\n        \"\"\"\n        New rest value needed for velocity-space conversions.\n\n        Parameters\n        ----------\n        value : `~astropy.units.Quantity` ['speed']\n            Rest value.\n        \"\"\"\n        if self._doppler_rest is not None:\n            raise AttributeError(\"doppler_rest has already been set, and cannot \"\n                                 \"be changed. Use the ``to`` method to convert \"\n                                 \"the spectral values(s) to use a different \"\n                                 \"rest value\")\n        self._doppler_rest = value\n\n    @property\n    def doppler_convention(self):\n        \"\"\"\n        The defined convention for conversions to/from velocity space.\n\n        Returns\n        -------\n        str\n            One of 'optical', 'radio', or 'relativistic' representing the\n            equivalency used in the unit conversions.\n        \"\"\"\n        return self._doppler_convention\n\n    @doppler_convention.setter\n    def doppler_convention(self, value):\n        \"\"\"\n        New velocity convention used for velocity space conversions.\n\n        Parameters\n        ----------\n        value\n\n        Notes\n        -----\n        More information on the equations dictating the transformations can be\n        found in the astropy documentation [1]_.\n\n        References\n        ----------\n        .. [1] Astropy documentation: https://docs.astropy.org/en/stable/units/equivalencies.html#spectral-doppler-equivalencies\n\n        \"\"\"\n\n        if self._doppler_convention is not None:\n            raise AttributeError(\"doppler_convention has already been set, and cannot \"\n                                 \"be changed. Use the ``to`` method to convert \"\n                                 \"the spectral values(s) to use a different \"\n                                 \"convention\")\n\n        if value is not None and value not in DOPPLER_CONVENTIONS:\n            raise ValueError(f\"doppler_convention should be one of {'/'.join(sorted(DOPPLER_CONVENTIONS))}\")\n\n        self._doppler_convention = value\n\n    @quantity_input(doppler_rest=SPECTRAL_UNITS)\n    def to(self, unit,\n           equivalencies=[],\n           doppler_rest=None,\n           doppler_convention=None):\n        \"\"\"\n        Return a new `~astropy.coordinates.SpectralQuantity` object with the specified unit.\n\n        By default, the ``spectral`` equivalency will be enabled, as well as\n        one of the Doppler equivalencies if converting to/from velocities.\n\n        Parameters\n        ----------\n        unit : unit-like\n            An object that represents the unit to convert to. Must be\n            an `~astropy.units.UnitBase` object or a string parseable\n            by the `~astropy.units` package, and should be a spectral unit.\n        equivalencies : list of `~astropy.units.equivalencies.Equivalency`, optional\n            A list of equivalence pairs to try if the units are not\n            directly convertible (along with spectral).\n            See :ref:`astropy:unit_equivalencies`.\n            If not provided or ``[]``, spectral equivalencies will be used.\n            If `None`, no equivalencies will be applied at all, not even any\n            set globally or within a context.\n        doppler_rest : `~astropy.units.Quantity` ['speed'], optional\n            The rest value used when converting to/from velocities. This will\n            also be set at an attribute on the output\n            `~astropy.coordinates.SpectralQuantity`.\n        doppler_convention : {'relativistic', 'optical', 'radio'}, optional\n            The Doppler convention used when converting to/from velocities.\n            This will also be set at an attribute on the output\n            `~astropy.coordinates.SpectralQuantity`.\n\n        Returns\n        -------\n        `SpectralQuantity`\n            New spectral coordinate object with data converted to the new unit.\n        \"\"\"\n\n        # Make sure units can be passed as strings\n        unit = Unit(unit)\n\n        # If equivalencies is explicitly set to None, we should just use the\n        # default Quantity.to with equivalencies also set to None\n        if equivalencies is None:\n            result = super().to(unit, equivalencies=None)\n            result = result.view(self.__class__)\n            result.__array_finalize__(self)\n            return result\n\n        # FIXME: need to consider case where doppler equivalency is passed in\n        # equivalencies list, or is u.spectral equivalency is already passed\n\n        if doppler_rest is None:\n            doppler_rest = self._doppler_rest\n\n        if doppler_convention is None:\n            doppler_convention = self._doppler_convention\n        elif doppler_convention not in DOPPLER_CONVENTIONS:\n            raise ValueError(f\"doppler_convention should be one of {'/'.join(sorted(DOPPLER_CONVENTIONS))}\")\n\n        if self.unit.is_equivalent(KMS) and unit.is_equivalent(KMS):\n\n            # Special case: if the current and final units are both velocity,\n            # and either the rest value or the convention are different, we\n            # need to convert back to frequency temporarily.\n\n            if doppler_convention is not None and self._doppler_convention is None:\n                raise ValueError(\"Original doppler_convention not set\")\n\n            if doppler_rest is not None and self._doppler_rest is None:\n                raise ValueError(\"Original doppler_rest not set\")\n\n            if doppler_rest is None and doppler_convention is None:\n                result = super().to(unit, equivalencies=equivalencies)\n                result = result.view(self.__class__)\n                result.__array_finalize__(self)\n                return result\n\n            elif (doppler_rest is None) is not (doppler_convention is None):\n                raise ValueError(\"Either both or neither doppler_rest and \"\n                                 \"doppler_convention should be defined for \"\n                                 \"velocity conversions\")\n\n            vel_equiv1 = DOPPLER_CONVENTIONS[self._doppler_convention](self._doppler_rest)\n\n            freq = super().to(si.Hz, equivalencies=equivalencies + vel_equiv1)\n\n            vel_equiv2 = DOPPLER_CONVENTIONS[doppler_convention](doppler_rest)\n\n            result = freq.to(unit, equivalencies=equivalencies + vel_equiv2)\n\n        else:\n\n            additional_equivalencies = eq.spectral()\n\n            if self.unit.is_equivalent(KMS) or unit.is_equivalent(KMS):\n\n                if doppler_convention is None:\n                    raise ValueError(\"doppler_convention not set, cannot convert to/from velocities\")\n\n                if doppler_rest is None:\n                    raise ValueError(\"doppler_rest not set, cannot convert to/from velocities\")\n\n                additional_equivalencies = additional_equivalencies + DOPPLER_CONVENTIONS[doppler_convention](doppler_rest)\n\n            result = super().to(unit, equivalencies=equivalencies + additional_equivalencies)\n\n        # Since we have to explicitly specify when we want to keep this as a\n        # SpectralQuantity, we need to convert it back from a Quantity to\n        # a SpectralQuantity here. Note that we don't use __array_finalize__\n        # here since we might need to set the output doppler convention and\n        # rest based on the parameters passed to 'to'\n        result = result.view(self.__class__)\n        result.__array_finalize__(self)\n        result._doppler_convention = doppler_convention\n        result._doppler_rest = doppler_rest\n\n        return result\n\n    def to_value(self, unit=None, *args, **kwargs):\n        if unit is None:\n            return self.view(np.ndarray)\n\n        return self.to(unit, *args, **kwargs).value\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":15049,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":15050,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":11,"text":"__doctest_skip__"},{"col":4,"comment":"\n        Generates and returns the `CompositeTransform` for a transformation\n        between two coordinate systems.\n\n        Parameters\n        ----------\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform into.\n\n        Returns\n        -------\n        trans : `CompositeTransform` or None\n            If there is a path from ``fromsys`` to ``tosys``, this is a\n            transform object for that path.   If no path could be found, this is\n            `None`.\n\n        Notes\n        -----\n        This function always returns a `CompositeTransform`, because\n        `CompositeTransform` is slightly more adaptable in the way it can be\n        called than other transform classes. Specifically, it takes care of\n        intermediate steps of transformations in a way that is consistent with\n        1-hop transformations.\n\n        ","endLoc":431,"header":"def get_transform(self, fromsys, tosys)","id":15051,"name":"get_transform","nodeType":"Function","startLoc":382,"text":"def get_transform(self, fromsys, tosys):\n        \"\"\"\n        Generates and returns the `CompositeTransform` for a transformation\n        between two coordinate systems.\n\n        Parameters\n        ----------\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform into.\n\n        Returns\n        -------\n        trans : `CompositeTransform` or None\n            If there is a path from ``fromsys`` to ``tosys``, this is a\n            transform object for that path.   If no path could be found, this is\n            `None`.\n\n        Notes\n        -----\n        This function always returns a `CompositeTransform`, because\n        `CompositeTransform` is slightly more adaptable in the way it can be\n        called than other transform classes. Specifically, it takes care of\n        intermediate steps of transformations in a way that is consistent with\n        1-hop transformations.\n\n        \"\"\"\n        if not inspect.isclass(fromsys):\n            raise TypeError('fromsys is not a class')\n        if not inspect.isclass(tosys):\n            raise TypeError('tosys is not a class')\n\n        path, distance = self.find_shortest_path(fromsys, tosys)\n\n        if path is None:\n            return None\n\n        transforms = []\n        currsys = fromsys\n        for p in path[1:]:  # first element is fromsys so we skip it\n            transforms.append(self._graph[currsys][p])\n            currsys = p\n\n        fttuple = (fromsys, tosys)\n        if fttuple not in self._composite_cache:\n            comptrans = CompositeTransform(transforms, fromsys, tosys,\n                                           register_graph=False)\n            self._composite_cache[fttuple] = comptrans\n        return self._composite_cache[fttuple]"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":15052,"name":"KMS","nodeType":"Attribute","startLoc":13,"text":"KMS"},{"col":4,"comment":"null","endLoc":3391,"header":"def _combine_operation(self, op, other, reverse=False)","id":15053,"name":"_combine_operation","nodeType":"Function","startLoc":3375,"text":"def _combine_operation(self, op, other, reverse=False):\n        if isinstance(other, self.base_representation):\n            if reverse:\n                first, second = other.distance, self.d_distance\n            else:\n                first, second = self.d_distance, other.distance\n            return other.__class__(op(first, second), copy=False)\n        elif isinstance(other, (BaseSphericalDifferential,\n                                BaseSphericalCosLatDifferential)):\n            all_components = set(self.components) | set(other.components)\n            first, second = (self, other) if not reverse else (other, self)\n            result_args = {c: op(getattr(first, c, 0.), getattr(second, c, 0.))\n                           for c in all_components}\n            return SphericalDifferential(**result_args)\n\n        else:\n            return super()._combine_operation(op, other, reverse)"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":15054,"name":"SPECTRAL_UNITS","nodeType":"Attribute","startLoc":15,"text":"SPECTRAL_UNITS"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":15055,"name":"DOPPLER_CONVENTIONS","nodeType":"Attribute","startLoc":17,"text":"DOPPLER_CONVENTIONS"},{"attributeType":"null","col":12,"comment":"null","endLoc":2698,"id":15056,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":2698,"text":"self._inv_efunc_scalar"},{"col":0,"comment":"","endLoc":1,"header":"spectral_quantity.py#<anonymous>","id":15057,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"__all__ = ['SpectralQuantity']\n\n__doctest_skip__ = ['SpectralQuantity.*']\n\nKMS = si.km / si.s\n\nSPECTRAL_UNITS = (si.Hz, si.m, si.J, si.m ** -1, KMS)\n\nDOPPLER_CONVENTIONS = {\n    'radio': eq.doppler_radio,\n    'optical': eq.doppler_optical,\n    'relativistic': eq.doppler_relativistic\n}"},{"fileName":"matrix_utilities.py","filePath":"astropy/coordinates","id":15058,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nUtililies used for constructing and inspecting rotation matrices.\n\"\"\"\nfrom functools import reduce\nimport numpy as np\n\nfrom astropy import units as u\nfrom .angles import Angle\n\n\ndef matrix_product(*matrices):\n    \"\"\"Matrix multiply all arguments together.\n\n    Arguments should have dimension 2 or larger. Larger dimensional objects\n    are interpreted as stacks of matrices residing in the last two dimensions.\n\n    This function mostly exists for readability: using `~numpy.matmul`\n    directly, one would have ``matmul(matmul(m1, m2), m3)``, etc. For even\n    better readability, one might consider using `~numpy.matrix` for the\n    arguments (so that one could write ``m1 * m2 * m3``), but then it is not\n    possible to handle stacks of matrices. Once only python >=3.5 is supported,\n    this function can be replaced by ``m1 @ m2 @ m3``.\n    \"\"\"\n    return reduce(np.matmul, matrices)\n\n\ndef matrix_transpose(matrix):\n    \"\"\"Transpose a matrix or stack of matrices by swapping the last two axes.\n\n    This function mostly exists for readability; seeing ``.swapaxes(-2, -1)``\n    it is not that obvious that one does a transpose.  Note that one cannot\n    use `~numpy.ndarray.T`, as this transposes all axes and thus does not\n    work for stacks of matrices.\n    \"\"\"\n    return matrix.swapaxes(-2, -1)\n\n\ndef rotation_matrix(angle, axis='z', unit=None):\n    \"\"\"\n    Generate matrices for rotation by some angle around some axis.\n\n    Parameters\n    ----------\n    angle : angle-like\n        The amount of rotation the matrices should represent.  Can be an array.\n    axis : str or array-like\n        Either ``'x'``, ``'y'``, ``'z'``, or a (x,y,z) specifying the axis to\n        rotate about. If ``'x'``, ``'y'``, or ``'z'``, the rotation sense is\n        counterclockwise looking down the + axis (e.g. positive rotations obey\n        left-hand-rule).  If given as an array, the last dimension should be 3;\n        it will be broadcast against ``angle``.\n    unit : unit-like, optional\n        If ``angle`` does not have associated units, they are in this\n        unit.  If neither are provided, it is assumed to be degrees.\n\n    Returns\n    -------\n    rmat : `numpy.matrix`\n        A unitary rotation matrix.\n    \"\"\"\n    if isinstance(angle, u.Quantity):\n        angle = angle.to_value(u.radian)\n    else:\n        if unit is None:\n            angle = np.deg2rad(angle)\n        else:\n            angle = u.Unit(unit).to(u.rad, angle)\n\n    s = np.sin(angle)\n    c = np.cos(angle)\n\n    # use optimized implementations for x/y/z\n    try:\n        i = 'xyz'.index(axis)\n    except TypeError:\n        axis = np.asarray(axis)\n        axis = axis / np.sqrt((axis * axis).sum(axis=-1, keepdims=True))\n        R = (axis[..., np.newaxis] * axis[..., np.newaxis, :] *\n             (1. - c)[..., np.newaxis, np.newaxis])\n\n        for i in range(0, 3):\n            R[..., i, i] += c\n            a1 = (i + 1) % 3\n            a2 = (i + 2) % 3\n            R[..., a1, a2] += axis[..., i] * s\n            R[..., a2, a1] -= axis[..., i] * s\n\n    else:\n        a1 = (i + 1) % 3\n        a2 = (i + 2) % 3\n        R = np.zeros(getattr(angle, 'shape', ()) + (3, 3))\n        R[..., i, i] = 1.\n        R[..., a1, a1] = c\n        R[..., a1, a2] = s\n        R[..., a2, a1] = -s\n        R[..., a2, a2] = c\n\n    return R\n\n\ndef angle_axis(matrix):\n    \"\"\"\n    Angle of rotation and rotation axis for a given rotation matrix.\n\n    Parameters\n    ----------\n    matrix : array-like\n        A 3 x 3 unitary rotation matrix (or stack of matrices).\n\n    Returns\n    -------\n    angle : `~astropy.coordinates.Angle`\n        The angle of rotation.\n    axis : array\n        The (normalized) axis of rotation (with last dimension 3).\n    \"\"\"\n    m = np.asanyarray(matrix)\n    if m.shape[-2:] != (3, 3):\n        raise ValueError('matrix is not 3x3')\n\n    axis = np.zeros(m.shape[:-1])\n    axis[..., 0] = m[..., 2, 1] - m[..., 1, 2]\n    axis[..., 1] = m[..., 0, 2] - m[..., 2, 0]\n    axis[..., 2] = m[..., 1, 0] - m[..., 0, 1]\n    r = np.sqrt((axis * axis).sum(-1, keepdims=True))\n    angle = np.arctan2(r[..., 0],\n                       m[..., 0, 0] + m[..., 1, 1] + m[..., 2, 2] - 1.)\n    return Angle(angle, u.radian), -axis / r\n\n\ndef is_O3(matrix):\n    \"\"\"Check whether a matrix is in the length-preserving group O(3).\n\n    Parameters\n    ----------\n    matrix : (..., N, N) array-like\n        Must have attribute ``.shape`` and method ``.swapaxes()`` and not error\n        when using `~numpy.isclose`.\n\n    Returns\n    -------\n    is_o3 : bool or array of bool\n        If the matrix has more than two axes, the O(3) check is performed on\n        slices along the last two axes -- (M, N, N) => (M, ) bool array.\n\n    Notes\n    -----\n    The orthogonal group O(3) preserves lengths, but is not guaranteed to keep\n    orientations. Rotations and reflections are in this group.\n    For more information, see https://en.wikipedia.org/wiki/Orthogonal_group\n\n    \"\"\"\n    # matrix is in O(3) (rotations, proper and improper).\n    I = np.identity(matrix.shape[-1])\n    is_o3 = np.all(np.isclose(matrix @ matrix.swapaxes(-2, -1), I, atol=1e-15),\n                   axis=(-2, -1))\n\n    return is_o3\n\n\ndef is_rotation(matrix, allow_improper=False):\n    \"\"\"Check whether a matrix is a rotation, proper or improper.\n\n    Parameters\n    ----------\n    matrix : (..., N, N) array-like\n        Must have attribute ``.shape`` and method ``.swapaxes()`` and not error\n        when using `~numpy.isclose` and `~numpy.linalg.det`.\n    allow_improper : bool, optional\n        Whether to restrict check to the SO(3), the group of proper rotations,\n        or also allow improper rotations (with determinant -1).\n        The default (False) is only SO(3).\n\n    Returns\n    -------\n    isrot : bool or array of bool\n        If the matrix has more than two axes, the checks are performed on\n        slices along the last two axes -- (M, N, N) => (M, ) bool array.\n\n    See Also\n    --------\n    `~astopy.coordinates.matrix_utilities.is_O3`\n        For the less restrictive check that a matrix is in the group O(3).\n\n    Notes\n    -----\n    The group SO(3) is the rotation group. It is O(3), with determinant 1.\n    Rotations with determinant -1 are improper rotations, combining both a\n    rotation and a reflection.\n    For more information, see https://en.wikipedia.org/wiki/Orthogonal_group\n\n    \"\"\"\n    # matrix is in O(3).\n    is_o3 = is_O3(matrix)\n\n    # determinant checks  for rotation (proper and improper)\n    if allow_improper:  # determinant can be +/- 1\n        is_det1 = np.isclose(np.abs(np.linalg.det(matrix)), 1.0)\n    else:  # restrict to SO(3)\n        is_det1 = np.isclose(np.linalg.det(matrix), 1.0)\n\n    return is_o3 & is_det1\n"},{"col":4,"comment":"null","endLoc":3041,"header":"def __init__(self, d_lon, d_lat=None, d_distance=None, copy=True)","id":15059,"name":"__init__","nodeType":"Function","startLoc":3038,"text":"def __init__(self, d_lon, d_lat=None, d_distance=None, copy=True):\n        super().__init__(d_lon, d_lat, d_distance, copy=copy)\n        if not self._d_lon.unit.is_equivalent(self._d_lat.unit):\n            raise u.UnitsError('d_lon and d_lat should have equivalent units.')"},{"col":0,"comment":"\n    Angle of rotation and rotation axis for a given rotation matrix.\n\n    Parameters\n    ----------\n    matrix : array-like\n        A 3 x 3 unitary rotation matrix (or stack of matrices).\n\n    Returns\n    -------\n    angle : `~astropy.coordinates.Angle`\n        The angle of rotation.\n    axis : array\n        The (normalized) axis of rotation (with last dimension 3).\n    ","endLoc":131,"header":"def angle_axis(matrix)","id":15060,"name":"angle_axis","nodeType":"Function","startLoc":104,"text":"def angle_axis(matrix):\n    \"\"\"\n    Angle of rotation and rotation axis for a given rotation matrix.\n\n    Parameters\n    ----------\n    matrix : array-like\n        A 3 x 3 unitary rotation matrix (or stack of matrices).\n\n    Returns\n    -------\n    angle : `~astropy.coordinates.Angle`\n        The angle of rotation.\n    axis : array\n        The (normalized) axis of rotation (with last dimension 3).\n    \"\"\"\n    m = np.asanyarray(matrix)\n    if m.shape[-2:] != (3, 3):\n        raise ValueError('matrix is not 3x3')\n\n    axis = np.zeros(m.shape[:-1])\n    axis[..., 0] = m[..., 2, 1] - m[..., 1, 2]\n    axis[..., 1] = m[..., 0, 2] - m[..., 2, 0]\n    axis[..., 2] = m[..., 1, 0] - m[..., 0, 1]\n    r = np.sqrt((axis * axis).sum(-1, keepdims=True))\n    angle = np.arctan2(r[..., 0],\n                       m[..., 0, 0] + m[..., 1, 1] + m[..., 2, 2] - 1.)\n    return Angle(angle, u.radian), -axis / r"},{"attributeType":"null","col":4,"comment":"null","endLoc":3351,"id":15061,"name":"base_representation","nodeType":"Attribute","startLoc":3351,"text":"base_representation"},{"attributeType":"null","col":12,"comment":"null","endLoc":2699,"id":15062,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":2699,"text":"self._inv_efunc_scalar_args"},{"col":4,"comment":"null","endLoc":1442,"header":"def __init__(self, transforms, fromsys, tosys, priority=1,\n                 register_graph=None, collapse_static_mats=True)","id":15063,"name":"__init__","nodeType":"Function","startLoc":1434,"text":"def __init__(self, transforms, fromsys, tosys, priority=1,\n                 register_graph=None, collapse_static_mats=True):\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)\n\n        if collapse_static_mats:\n            transforms = self._combine_statics(transforms)\n\n        self.transforms = tuple(transforms)"},{"className":"SphericalDifferential","col":0,"comment":"Differential(s) of points in 3D spherical coordinates.\n\n    Parameters\n    ----------\n    d_lon, d_lat : `~astropy.units.Quantity`\n        The differential longitude and latitude.\n    d_distance : `~astropy.units.Quantity`\n        The differential distance.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    ","endLoc":3077,"id":15064,"nodeType":"Class","startLoc":3022,"text":"class SphericalDifferential(BaseSphericalDifferential):\n    \"\"\"Differential(s) of points in 3D spherical coordinates.\n\n    Parameters\n    ----------\n    d_lon, d_lat : `~astropy.units.Quantity`\n        The differential longitude and latitude.\n    d_distance : `~astropy.units.Quantity`\n        The differential distance.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n    base_representation = SphericalRepresentation\n    _unit_differential = UnitSphericalDifferential\n\n    def __init__(self, d_lon, d_lat=None, d_distance=None, copy=True):\n        super().__init__(d_lon, d_lat, d_distance, copy=copy)\n        if not self._d_lon.unit.is_equivalent(self._d_lat.unit):\n            raise u.UnitsError('d_lon and d_lat should have equivalent units.')\n\n    def represent_as(self, other_class, base=None):\n        # All spherical differentials can be done without going to Cartesian,\n        # though CosLat needs base for the latitude.\n        if issubclass(other_class, UnitSphericalDifferential):\n            return other_class(self.d_lon, self.d_lat)\n        elif issubclass(other_class, RadialDifferential):\n            return other_class(self.d_distance)\n        elif issubclass(other_class, SphericalCosLatDifferential):\n            return other_class(self._d_lon_coslat(base), self.d_lat,\n                               self.d_distance)\n        elif issubclass(other_class, UnitSphericalCosLatDifferential):\n            return other_class(self._d_lon_coslat(base), self.d_lat)\n        elif issubclass(other_class, PhysicsSphericalDifferential):\n            return other_class(self.d_lon, -self.d_lat, self.d_distance)\n        else:\n            return super().represent_as(other_class, base)\n\n    @classmethod\n    def from_representation(cls, representation, base=None):\n        # Other spherical differentials can be done without going to Cartesian,\n        # though CosLat needs base for the latitude.\n        if isinstance(representation, SphericalCosLatDifferential):\n            d_lon = cls._get_d_lon(representation.d_lon_coslat, base)\n            return cls(d_lon, representation.d_lat, representation.d_distance)\n        elif isinstance(representation, PhysicsSphericalDifferential):\n            return cls(representation.d_phi, -representation.d_theta,\n                       representation.d_r)\n\n        return super().from_representation(representation, base)\n\n    def _scale_operation(self, op, *args, scaled_base=False):\n        if scaled_base:\n            return self.__class__(self.d_lon, self.d_lat, op(self.d_distance, *args))\n        else:\n            return super()._scale_operation(op, *args)"},{"className":"BaseSphericalDifferential","col":0,"comment":"null","endLoc":2916,"id":15065,"nodeType":"Class","startLoc":2858,"text":"class BaseSphericalDifferential(BaseDifferential):\n    def _d_lon_coslat(self, base):\n        \"\"\"Convert longitude differential d_lon to d_lon_coslat.\n\n        Parameters\n        ----------\n        base : instance of ``cls.base_representation``\n            The base from which the latitude will be taken.\n        \"\"\"\n        self._check_base(base)\n        return self.d_lon * np.cos(base.lat)\n\n    @classmethod\n    def _get_d_lon(cls, d_lon_coslat, base):\n        \"\"\"Convert longitude differential d_lon_coslat to d_lon.\n\n        Parameters\n        ----------\n        d_lon_coslat : `~astropy.units.Quantity`\n            Longitude differential that includes ``cos(lat)``.\n        base : instance of ``cls.base_representation``\n            The base from which the latitude will be taken.\n        \"\"\"\n        cls._check_base(base)\n        return d_lon_coslat / np.cos(base.lat)\n\n    def _combine_operation(self, op, other, reverse=False):\n        \"\"\"Combine two differentials, or a differential with a representation.\n\n        If ``other`` is of the same differential type as ``self``, the\n        components will simply be combined.  If both are different parts of\n        a `~astropy.coordinates.SphericalDifferential` (e.g., a\n        `~astropy.coordinates.UnitSphericalDifferential` and a\n        `~astropy.coordinates.RadialDifferential`), they will combined\n        appropriately.\n\n        If ``other`` is a representation, it will be used as a base for which\n        to evaluate the differential, and the result is a new representation.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.add`, `~operator.sub`, etc.\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The other differential or representation.\n        reverse : bool\n            Whether the operands should be reversed (e.g., as we got here via\n            ``self.__rsub__`` because ``self`` is a subclass of ``other``).\n        \"\"\"\n        if (isinstance(other, BaseSphericalDifferential) and\n                not isinstance(self, type(other)) or\n                isinstance(other, RadialDifferential)):\n            all_components = set(self.components) | set(other.components)\n            first, second = (self, other) if not reverse else (other, self)\n            result_args = {c: op(getattr(first, c, 0.), getattr(second, c, 0.))\n                           for c in all_components}\n            return SphericalDifferential(**result_args)\n\n        return super()._combine_operation(op, other, reverse)"},{"col":4,"comment":"Convert longitude differential d_lon to d_lon_coslat.\n\n        Parameters\n        ----------\n        base : instance of ``cls.base_representation``\n            The base from which the latitude will be taken.\n        ","endLoc":2868,"header":"def _d_lon_coslat(self, base)","id":15066,"name":"_d_lon_coslat","nodeType":"Function","startLoc":2859,"text":"def _d_lon_coslat(self, base):\n        \"\"\"Convert longitude differential d_lon to d_lon_coslat.\n\n        Parameters\n        ----------\n        base : instance of ``cls.base_representation``\n            The base from which the latitude will be taken.\n        \"\"\"\n        self._check_base(base)\n        return self.d_lon * np.cos(base.lat)"},{"col":4,"comment":"Convert longitude differential d_lon_coslat to d_lon.\n\n        Parameters\n        ----------\n        d_lon_coslat : `~astropy.units.Quantity`\n            Longitude differential that includes ``cos(lat)``.\n        base : instance of ``cls.base_representation``\n            The base from which the latitude will be taken.\n        ","endLoc":2882,"header":"@classmethod\n    def _get_d_lon(cls, d_lon_coslat, base)","id":15067,"name":"_get_d_lon","nodeType":"Function","startLoc":2870,"text":"@classmethod\n    def _get_d_lon(cls, d_lon_coslat, base):\n        \"\"\"Convert longitude differential d_lon_coslat to d_lon.\n\n        Parameters\n        ----------\n        d_lon_coslat : `~astropy.units.Quantity`\n            Longitude differential that includes ``cos(lat)``.\n        base : instance of ``cls.base_representation``\n            The base from which the latitude will be taken.\n        \"\"\"\n        cls._check_base(base)\n        return d_lon_coslat / np.cos(base.lat)"},{"col":4,"comment":"Combine two differentials, or a differential with a representation.\n\n        If ``other`` is of the same differential type as ``self``, the\n        components will simply be combined.  If both are different parts of\n        a `~astropy.coordinates.SphericalDifferential` (e.g., a\n        `~astropy.coordinates.UnitSphericalDifferential` and a\n        `~astropy.coordinates.RadialDifferential`), they will combined\n        appropriately.\n\n        If ``other`` is a representation, it will be used as a base for which\n        to evaluate the differential, and the result is a new representation.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.add`, `~operator.sub`, etc.\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The other differential or representation.\n        reverse : bool\n            Whether the operands should be reversed (e.g., as we got here via\n            ``self.__rsub__`` because ``self`` is a subclass of ``other``).\n        ","endLoc":2916,"header":"def _combine_operation(self, op, other, reverse=False)","id":15068,"name":"_combine_operation","nodeType":"Function","startLoc":2884,"text":"def _combine_operation(self, op, other, reverse=False):\n        \"\"\"Combine two differentials, or a differential with a representation.\n\n        If ``other`` is of the same differential type as ``self``, the\n        components will simply be combined.  If both are different parts of\n        a `~astropy.coordinates.SphericalDifferential` (e.g., a\n        `~astropy.coordinates.UnitSphericalDifferential` and a\n        `~astropy.coordinates.RadialDifferential`), they will combined\n        appropriately.\n\n        If ``other`` is a representation, it will be used as a base for which\n        to evaluate the differential, and the result is a new representation.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.add`, `~operator.sub`, etc.\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The other differential or representation.\n        reverse : bool\n            Whether the operands should be reversed (e.g., as we got here via\n            ``self.__rsub__`` because ``self`` is a subclass of ``other``).\n        \"\"\"\n        if (isinstance(other, BaseSphericalDifferential) and\n                not isinstance(self, type(other)) or\n                isinstance(other, RadialDifferential)):\n            all_components = set(self.components) | set(other.components)\n            first, second = (self, other) if not reverse else (other, self)\n            result_args = {c: op(getattr(first, c, 0.), getattr(second, c, 0.))\n                           for c in all_components}\n            return SphericalDifferential(**result_args)\n\n        return super()._combine_operation(op, other, reverse)"},{"col":0,"comment":"Check whether a matrix is a rotation, proper or improper.\n\n    Parameters\n    ----------\n    matrix : (..., N, N) array-like\n        Must have attribute ``.shape`` and method ``.swapaxes()`` and not error\n        when using `~numpy.isclose` and `~numpy.linalg.det`.\n    allow_improper : bool, optional\n        Whether to restrict check to the SO(3), the group of proper rotations,\n        or also allow improper rotations (with determinant -1).\n        The default (False) is only SO(3).\n\n    Returns\n    -------\n    isrot : bool or array of bool\n        If the matrix has more than two axes, the checks are performed on\n        slices along the last two axes -- (M, N, N) => (M, ) bool array.\n\n    See Also\n    --------\n    `~astopy.coordinates.matrix_utilities.is_O3`\n        For the less restrictive check that a matrix is in the group O(3).\n\n    Notes\n    -----\n    The group SO(3) is the rotation group. It is O(3), with determinant 1.\n    Rotations with determinant -1 are improper rotations, combining both a\n    rotation and a reflection.\n    For more information, see https://en.wikipedia.org/wiki/Orthogonal_group\n\n    ","endLoc":205,"header":"def is_rotation(matrix, allow_improper=False)","id":15069,"name":"is_rotation","nodeType":"Function","startLoc":164,"text":"def is_rotation(matrix, allow_improper=False):\n    \"\"\"Check whether a matrix is a rotation, proper or improper.\n\n    Parameters\n    ----------\n    matrix : (..., N, N) array-like\n        Must have attribute ``.shape`` and method ``.swapaxes()`` and not error\n        when using `~numpy.isclose` and `~numpy.linalg.det`.\n    allow_improper : bool, optional\n        Whether to restrict check to the SO(3), the group of proper rotations,\n        or also allow improper rotations (with determinant -1).\n        The default (False) is only SO(3).\n\n    Returns\n    -------\n    isrot : bool or array of bool\n        If the matrix has more than two axes, the checks are performed on\n        slices along the last two axes -- (M, N, N) => (M, ) bool array.\n\n    See Also\n    --------\n    `~astopy.coordinates.matrix_utilities.is_O3`\n        For the less restrictive check that a matrix is in the group O(3).\n\n    Notes\n    -----\n    The group SO(3) is the rotation group. It is O(3), with determinant 1.\n    Rotations with determinant -1 are improper rotations, combining both a\n    rotation and a reflection.\n    For more information, see https://en.wikipedia.org/wiki/Orthogonal_group\n\n    \"\"\"\n    # matrix is in O(3).\n    is_o3 = is_O3(matrix)\n\n    # determinant checks  for rotation (proper and improper)\n    if allow_improper:  # determinant can be +/- 1\n        is_det1 = np.isclose(np.abs(np.linalg.det(matrix)), 1.0)\n    else:  # restrict to SO(3)\n        is_det1 = np.isclose(np.linalg.det(matrix), 1.0)\n\n    return is_o3 & is_det1"},{"col":0,"comment":"","endLoc":6,"header":"matrix_utilities.py#<anonymous>","id":15070,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nUtililies used for constructing and inspecting rotation matrices.\n\"\"\""},{"className":"wpwaCDM","col":0,"comment":"\n    FLRW cosmology with a CPL dark energy equation of state, a pivot redshift,\n    and curvature.\n\n    The equation for the dark energy equation of state uses the CPL form as\n    described in Chevallier & Polarski [1]_ and Linder [2]_, but modified to\n    have a pivot redshift as in the findings of the Dark Energy Task Force\n    [3]_: :math:`w(a) = w_p + w_a (a_p - a) = w_p + w_a( 1/(1+zp) - 1/(1+z) )`.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Ode0 : float\n        Omega dark energy: density of dark energy in units of the critical\n        density at z=0.\n\n    wp : float, optional\n        Dark energy equation of state at the pivot redshift zp. This is\n        pressure/density for dark energy in units where c=1.\n\n    wa : float, optional\n        Negative derivative of the dark energy equation of state with respect\n        to the scale factor. A cosmological constant has wp=-1.0 and wa=0.0.\n\n    zp : float or quantity-like ['redshift'], optional\n        Pivot redshift -- the redshift where w(z) = wp\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import wpwaCDM\n    >>> cosmo = wpwaCDM(H0=70, Om0=0.3, Ode0=0.7, wp=-0.9, wa=0.2, zp=0.4)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n\n    References\n    ----------\n    .. [1] Chevallier, M., & Polarski, D. (2001). Accelerating Universes with\n           Scaling Dark Matter. International Journal of Modern Physics D,\n           10(2), 213-223.\n    .. [2] Linder, E. (2003). Exploring the Expansion History of the\n           Universe. Phys. Rev. Lett., 90, 091301.\n    .. [3] Albrecht, A., Amendola, L., Bernstein, G., Clowe, D., Eisenstein,\n           D., Guzzo, L., Hirata, C., Huterer, D., Kirshner, R., Kolb, E., &\n           Nichol, R. (2009). Findings of the Joint Dark Energy Mission Figure\n           of Merit Science Working Group. arXiv e-prints, arXiv:0901.0721.\n    ","endLoc":2880,"id":15071,"nodeType":"Class","startLoc":2706,"text":"class wpwaCDM(FLRW):\n    r\"\"\"\n    FLRW cosmology with a CPL dark energy equation of state, a pivot redshift,\n    and curvature.\n\n    The equation for the dark energy equation of state uses the CPL form as\n    described in Chevallier & Polarski [1]_ and Linder [2]_, but modified to\n    have a pivot redshift as in the findings of the Dark Energy Task Force\n    [3]_: :math:`w(a) = w_p + w_a (a_p - a) = w_p + w_a( 1/(1+zp) - 1/(1+z) )`.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Ode0 : float\n        Omega dark energy: density of dark energy in units of the critical\n        density at z=0.\n\n    wp : float, optional\n        Dark energy equation of state at the pivot redshift zp. This is\n        pressure/density for dark energy in units where c=1.\n\n    wa : float, optional\n        Negative derivative of the dark energy equation of state with respect\n        to the scale factor. A cosmological constant has wp=-1.0 and wa=0.0.\n\n    zp : float or quantity-like ['redshift'], optional\n        Pivot redshift -- the redshift where w(z) = wp\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import wpwaCDM\n    >>> cosmo = wpwaCDM(H0=70, Om0=0.3, Ode0=0.7, wp=-0.9, wa=0.2, zp=0.4)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n\n    References\n    ----------\n    .. [1] Chevallier, M., & Polarski, D. (2001). Accelerating Universes with\n           Scaling Dark Matter. International Journal of Modern Physics D,\n           10(2), 213-223.\n    .. [2] Linder, E. (2003). Exploring the Expansion History of the\n           Universe. Phys. Rev. Lett., 90, 091301.\n    .. [3] Albrecht, A., Amendola, L., Bernstein, G., Clowe, D., Eisenstein,\n           D., Guzzo, L., Hirata, C., Huterer, D., Kirshner, R., Kolb, E., &\n           Nichol, R. (2009). Findings of the Joint Dark Energy Mission Figure\n           of Merit Science Working Group. arXiv e-prints, arXiv:0901.0721.\n    \"\"\"\n\n    wp = Parameter(doc=\"Dark energy equation of state at the pivot redshift zp.\", fvalidate=\"float\")\n    wa = Parameter(doc=\"Negative derivative of dark energy equation of state w.r.t. a.\",\n                   fvalidate=\"float\")\n    zp = Parameter(doc=\"The pivot redshift, where w(z) = wp.\", unit=cu.redshift)\n\n    def __init__(self, H0, Om0, Ode0, wp=-1.0, wa=0.0, zp=0.0 * cu.redshift,\n                 Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV, Ob0=None, *,\n                 name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=Ode0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n        self.wp = wp\n        self.wa = wa\n        self.zp = zp\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        apiv = 1.0 / (1.0 + self._zp.value)\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wpwacdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._wp, apiv, self._wa)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wpwacdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._wp, apiv, self._wa)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wpwacdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._wp,\n                                           apiv, self._wa)\n\n    def w(self, z):\n        r\"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is :math:`w(z) = w_p + w_a (a_p - a)` where\n        :math:`a = 1/1+z` and :math:`a_p = 1 / 1 + z_p`.\n        \"\"\"\n        apiv = 1.0 / (1.0 + self._zp.value)\n        return self._wp + self._wa * (apiv - 1.0 / (aszarr(z) + 1.0))\n\n    def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by\n\n        .. math::\n\n           a_p = \\frac{1}{1 + z_p}\n\n           I = \\left(1 + z\\right)^{3 \\left(1 + w_p + a_p w_a\\right)}\n                     \\exp \\left(-3 w_a \\frac{z}{1+z}\\right)\n        \"\"\"\n        z = aszarr(z)\n        zp1 = z + 1.0  # (converts z [unit] -> z [dimensionless])\n        apiv = 1. / (1. + self._zp.value)\n        return zp1 ** (3. * (1. + self._wp + apiv * self._wa)) * \\\n            np.exp(-3. * self._wa * z / zp1)"},{"fileName":"angle_utilities.py","filePath":"astropy/coordinates","id":15072,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module contains utility functions for working with angles. These are both\nused internally in astropy.coordinates.angles, and of possible\n\"\"\"\n\n__all__ = ['angular_separation', 'position_angle', 'offset_by',\n           'golden_spiral_grid', 'uniform_spherical_random_surface',\n           'uniform_spherical_random_volume']\n\n# Third-party\nimport numpy as np\n\n# Astropy\nimport astropy.units as u\nfrom astropy.coordinates.representation import (\n    UnitSphericalRepresentation,\n    SphericalRepresentation)\n\n\ndef angular_separation(lon1, lat1, lon2, lat2):\n    \"\"\"\n    Angular separation between two points on a sphere.\n\n    Parameters\n    ----------\n    lon1, lat1, lon2, lat2 : `~astropy.coordinates.Angle`, `~astropy.units.Quantity` or float\n        Longitude and latitude of the two points. Quantities should be in\n        angular units; floats in radians.\n\n    Returns\n    -------\n    angular separation : `~astropy.units.Quantity` ['angle'] or float\n        Type depends on input; ``Quantity`` in angular units, or float in\n        radians.\n\n    Notes\n    -----\n    The angular separation is calculated using the Vincenty formula [1]_,\n    which is slightly more complex and computationally expensive than\n    some alternatives, but is stable at at all distances, including the\n    poles and antipodes.\n\n    .. [1] https://en.wikipedia.org/wiki/Great-circle_distance\n    \"\"\"\n\n    sdlon = np.sin(lon2 - lon1)\n    cdlon = np.cos(lon2 - lon1)\n    slat1 = np.sin(lat1)\n    slat2 = np.sin(lat2)\n    clat1 = np.cos(lat1)\n    clat2 = np.cos(lat2)\n\n    num1 = clat2 * sdlon\n    num2 = clat1 * slat2 - slat1 * clat2 * cdlon\n    denominator = slat1 * slat2 + clat1 * clat2 * cdlon\n\n    return np.arctan2(np.hypot(num1, num2), denominator)\n\n\ndef position_angle(lon1, lat1, lon2, lat2):\n    \"\"\"\n    Position Angle (East of North) between two points on a sphere.\n\n    Parameters\n    ----------\n    lon1, lat1, lon2, lat2 : `~astropy.coordinates.Angle`, `~astropy.units.Quantity` or float\n        Longitude and latitude of the two points. Quantities should be in\n        angular units; floats in radians.\n\n    Returns\n    -------\n    pa : `~astropy.coordinates.Angle`\n        The (positive) position angle of the vector pointing from position 1 to\n        position 2.  If any of the angles are arrays, this will contain an array\n        following the appropriate `numpy` broadcasting rules.\n\n    \"\"\"\n    from .angles import Angle\n\n    deltalon = lon2 - lon1\n    colat = np.cos(lat2)\n\n    x = np.sin(lat2) * np.cos(lat1) - colat * np.sin(lat1) * np.cos(deltalon)\n    y = np.sin(deltalon) * colat\n\n    return Angle(np.arctan2(y, x), u.radian).wrap_at(360*u.deg)\n\n\ndef offset_by(lon, lat, posang, distance):\n    \"\"\"\n    Point with the given offset from the given point.\n\n    Parameters\n    ----------\n    lon, lat, posang, distance : `~astropy.coordinates.Angle`, `~astropy.units.Quantity` or float\n        Longitude and latitude of the starting point,\n        position angle and distance to the final point.\n        Quantities should be in angular units; floats in radians.\n        Polar points at lat= +/-90 are treated as limit of +/-(90-epsilon) and same lon.\n\n    Returns\n    -------\n    lon, lat : `~astropy.coordinates.Angle`\n        The position of the final point.  If any of the angles are arrays,\n        these will contain arrays following the appropriate `numpy` broadcasting rules.\n        0 <= lon < 2pi.\n\n    Notes\n    -----\n    \"\"\"\n    from .angles import Angle\n\n    # Calculations are done using the spherical trigonometry sine and cosine rules\n    # of the triangle A at North Pole,   B at starting point,   C at final point\n    # with angles     A (change in lon), B (posang),            C (not used, but negative reciprocal posang)\n    # with sides      a (distance),      b (final co-latitude), c (starting colatitude)\n    # B, a, c are knowns; A and b are unknowns\n    # https://en.wikipedia.org/wiki/Spherical_trigonometry\n\n    cos_a = np.cos(distance)\n    sin_a = np.sin(distance)\n    cos_c = np.sin(lat)\n    sin_c = np.cos(lat)\n    cos_B = np.cos(posang)\n    sin_B = np.sin(posang)\n\n    # cosine rule: Know two sides: a,c and included angle: B; get unknown side b\n    cos_b = cos_c * cos_a + sin_c * sin_a * cos_B\n    # sin_b = np.sqrt(1 - cos_b**2)\n    # sine rule and cosine rule for A (using both lets arctan2 pick quadrant).\n    # multiplying both sin_A and cos_A by x=sin_b * sin_c prevents /0 errors\n    # at poles.  Correct for the x=0 multiplication a few lines down.\n    # sin_A/sin_a == sin_B/sin_b    # Sine rule\n    xsin_A = sin_a * sin_B * sin_c\n    # cos_a == cos_b * cos_c + sin_b * sin_c * cos_A  # cosine rule\n    xcos_A = cos_a - cos_b * cos_c\n\n    A = Angle(np.arctan2(xsin_A, xcos_A), u.radian)\n    # Treat the poles as if they are infinitesimally far from pole but at given lon\n    small_sin_c = sin_c < 1e-12\n    if small_sin_c.any():\n        # For south pole (cos_c = -1), A = posang; for North pole, A=180 deg - posang\n        A_pole = (90*u.deg + cos_c*(90*u.deg-Angle(posang, u.radian))).to(u.rad)\n        if A.shape:\n            # broadcast to ensure the shape is like that of A, which is also\n            # affected by the (possible) shapes of lat, posang, and distance.\n            small_sin_c = np.broadcast_to(small_sin_c, A.shape)\n            A[small_sin_c] = A_pole[small_sin_c]\n        else:\n            A = A_pole\n\n    outlon = (Angle(lon, u.radian) + A).wrap_at(360.0*u.deg).to(u.deg)\n    outlat = Angle(np.arcsin(cos_b), u.radian).to(u.deg)\n\n    return outlon, outlat\n\n\ndef golden_spiral_grid(size):\n    \"\"\"Generate a grid of points on the surface of the unit sphere using the\n    Fibonacci or Golden Spiral method.\n\n    .. seealso::\n\n        `Evenly distributing points on a sphere <https://stackoverflow.com/questions/9600801/evenly-distributing-n-points-on-a-sphere>`_\n\n    Parameters\n    ----------\n    size : int\n        The number of points to generate.\n\n    Returns\n    -------\n    rep : `~astropy.coordinates.UnitSphericalRepresentation`\n        The grid of points.\n    \"\"\"\n    golden_r = (1 + 5**0.5) / 2\n\n    grid = np.arange(0, size, dtype=float) + 0.5\n    lon = 2*np.pi / golden_r * grid * u.rad\n    lat = np.arcsin(1 - 2 * grid / size) * u.rad\n\n    return UnitSphericalRepresentation(lon, lat)\n\n\ndef uniform_spherical_random_surface(size=1):\n    \"\"\"Generate a random sampling of points on the surface of the unit sphere.\n\n    Parameters\n    ----------\n    size : int\n        The number of points to generate.\n\n    Returns\n    -------\n    rep : `~astropy.coordinates.UnitSphericalRepresentation`\n        The random points.\n    \"\"\"\n\n    rng = np.random  # can maybe switch to this being an input later - see #11628\n\n    lon = rng.uniform(0, 2*np.pi, size) * u.rad\n    lat = np.arcsin(rng.uniform(-1, 1, size=size)) * u.rad\n\n    return UnitSphericalRepresentation(lon, lat)\n\n\ndef uniform_spherical_random_volume(size=1, max_radius=1):\n    \"\"\"Generate a random sampling of points that follow a uniform volume\n    density distribution within a sphere.\n\n    Parameters\n    ----------\n    size : int\n        The number of points to generate.\n    max_radius : number, quantity-like, optional\n        A dimensionless or unit-ful factor to scale the random distances.\n    rng : `numpy.random.Generator`, optional\n        A random number generator instance.\n\n    Returns\n    -------\n    rep : `~astropy.coordinates.SphericalRepresentation`\n        The random points.\n    \"\"\"\n    rng = np.random  # can maybe switch to this being an input later - see #11628\n\n    usph = uniform_spherical_random_surface(size=size)\n\n    r = np.cbrt(rng.uniform(size=size)) * u.Quantity(max_radius, copy=False)\n    return SphericalRepresentation(usph.lon, usph.lat, r)\n\n\n# # below here can be deleted in v5.0\nfrom astropy.utils.decorators import deprecated\nfrom astropy.coordinates import angle_formats\n__old_angle_utilities_funcs = ['check_hms_ranges', 'degrees_to_dms',\n                               'degrees_to_string', 'dms_to_degrees',\n                               'format_exception', 'hms_to_degrees',\n                               'hms_to_dms', 'hms_to_hours',\n                               'hms_to_radians', 'hours_to_decimal',\n                               'hours_to_hms', 'hours_to_radians',\n                               'hours_to_string', 'parse_angle',\n                               'radians_to_degrees', 'radians_to_dms',\n                               'radians_to_hms', 'radians_to_hours',\n                               'sexagesimal_to_string']\nfor funcname in __old_angle_utilities_funcs:\n    vars()[funcname] = deprecated(name='astropy.coordinates.angle_utilities.' + funcname,\n                                  alternative='astropy.coordinates.angle_formats.' + funcname,\n                                  since='v4.3')(getattr(angle_formats, funcname))\n"},{"col":4,"comment":"null","endLoc":3058,"header":"def represent_as(self, other_class, base=None)","id":15073,"name":"represent_as","nodeType":"Function","startLoc":3043,"text":"def represent_as(self, other_class, base=None):\n        # All spherical differentials can be done without going to Cartesian,\n        # though CosLat needs base for the latitude.\n        if issubclass(other_class, UnitSphericalDifferential):\n            return other_class(self.d_lon, self.d_lat)\n        elif issubclass(other_class, RadialDifferential):\n            return other_class(self.d_distance)\n        elif issubclass(other_class, SphericalCosLatDifferential):\n            return other_class(self._d_lon_coslat(base), self.d_lat,\n                               self.d_distance)\n        elif issubclass(other_class, UnitSphericalCosLatDifferential):\n            return other_class(self._d_lon_coslat(base), self.d_lat)\n        elif issubclass(other_class, PhysicsSphericalDifferential):\n            return other_class(self.d_lon, -self.d_lat, self.d_distance)\n        else:\n            return super().represent_as(other_class, base)"},{"col":4,"comment":"null","endLoc":2823,"header":"def __init__(self, H0, Om0, Ode0, wp=-1.0, wa=0.0, zp=0.0 * cu.redshift,\n                 Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV, Ob0=None, *,\n                 name=None, meta=None)","id":15074,"name":"__init__","nodeType":"Function","startLoc":2796,"text":"def __init__(self, H0, Om0, Ode0, wp=-1.0, wa=0.0, zp=0.0 * cu.redshift,\n                 Tcmb0=0.0*u.K, Neff=3.04, m_nu=0.0*u.eV, Ob0=None, *,\n                 name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=Ode0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n        self.wp = wp\n        self.wa = wa\n        self.zp = zp\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        apiv = 1.0 / (1.0 + self._zp.value)\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wpwacdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._wp, apiv, self._wa)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wpwacdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._wp, apiv, self._wa)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.wpwacdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._wp,\n                                           apiv, self._wa)"},{"col":0,"comment":"Generate a grid of points on the surface of the unit sphere using the\n    Fibonacci or Golden Spiral method.\n\n    .. seealso::\n\n        `Evenly distributing points on a sphere <https://stackoverflow.com/questions/9600801/evenly-distributing-n-points-on-a-sphere>`_\n\n    Parameters\n    ----------\n    size : int\n        The number of points to generate.\n\n    Returns\n    -------\n    rep : `~astropy.coordinates.UnitSphericalRepresentation`\n        The grid of points.\n    ","endLoc":184,"header":"def golden_spiral_grid(size)","id":15075,"name":"golden_spiral_grid","nodeType":"Function","startLoc":160,"text":"def golden_spiral_grid(size):\n    \"\"\"Generate a grid of points on the surface of the unit sphere using the\n    Fibonacci or Golden Spiral method.\n\n    .. seealso::\n\n        `Evenly distributing points on a sphere <https://stackoverflow.com/questions/9600801/evenly-distributing-n-points-on-a-sphere>`_\n\n    Parameters\n    ----------\n    size : int\n        The number of points to generate.\n\n    Returns\n    -------\n    rep : `~astropy.coordinates.UnitSphericalRepresentation`\n        The grid of points.\n    \"\"\"\n    golden_r = (1 + 5**0.5) / 2\n\n    grid = np.arange(0, size, dtype=float) + 0.5\n    lon = 2*np.pi / golden_r * grid * u.rad\n    lat = np.arcsin(1 - 2 * grid / size) * u.rad\n\n    return UnitSphericalRepresentation(lon, lat)"},{"col":4,"comment":"null","endLoc":812,"header":"def __init__(self, fromsys, tosys, priority=1, register_graph=None)","id":15076,"name":"__init__","nodeType":"Function","startLoc":788,"text":"def __init__(self, fromsys, tosys, priority=1, register_graph=None):\n        if not inspect.isclass(fromsys):\n            raise TypeError('fromsys must be a class')\n        if not inspect.isclass(tosys):\n            raise TypeError('tosys must be a class')\n\n        self.fromsys = fromsys\n        self.tosys = tosys\n        self.priority = float(priority)\n\n        if register_graph:\n            # this will do the type-checking when it adds to the graph\n            self.register(register_graph)\n        else:\n            if not inspect.isclass(fromsys) or not inspect.isclass(tosys):\n                raise TypeError('fromsys and tosys must be classes')\n\n        self.overlapping_frame_attr_names = overlap = []\n        if (hasattr(fromsys, 'get_frame_attr_names') and\n                hasattr(tosys, 'get_frame_attr_names')):\n            # the if statement is there so that non-frame things might be usable\n            # if it makes sense\n            for from_nm in fromsys.frame_attributes.keys():\n                if from_nm in tosys.frame_attributes.keys():\n                    overlap.append(from_nm)"},{"col":4,"comment":"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is :math:`w(z) = w_p + w_a (a_p - a)` where\n        :math:`a = 1/1+z` and :math:`a_p = 1 / 1 + z_p`.\n        ","endLoc":2848,"header":"def w(self, z)","id":15077,"name":"w","nodeType":"Function","startLoc":2825,"text":"def w(self, z):\n        r\"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is :math:`w(z) = w_p + w_a (a_p - a)` where\n        :math:`a = 1/1+z` and :math:`a_p = 1 / 1 + z_p`.\n        \"\"\"\n        apiv = 1.0 / (1.0 + self._zp.value)\n        return self._wp + self._wa * (apiv - 1.0 / (aszarr(z) + 1.0))"},{"col":4,"comment":"null","endLoc":3071,"header":"@classmethod\n    def from_representation(cls, representation, base=None)","id":15078,"name":"from_representation","nodeType":"Function","startLoc":3060,"text":"@classmethod\n    def from_representation(cls, representation, base=None):\n        # Other spherical differentials can be done without going to Cartesian,\n        # though CosLat needs base for the latitude.\n        if isinstance(representation, SphericalCosLatDifferential):\n            d_lon = cls._get_d_lon(representation.d_lon_coslat, base)\n            return cls(d_lon, representation.d_lat, representation.d_distance)\n        elif isinstance(representation, PhysicsSphericalDifferential):\n            return cls(representation.d_phi, -representation.d_theta,\n                       representation.d_r)\n\n        return super().from_representation(representation, base)"},{"col":4,"comment":"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by\n\n        .. math::\n\n           a_p = \\frac{1}{1 + z_p}\n\n           I = \\left(1 + z\\right)^{3 \\left(1 + w_p + a_p w_a\\right)}\n                     \\exp \\left(-3 w_a \\frac{z}{1+z}\\right)\n        ","endLoc":2880,"header":"def de_density_scale(self, z)","id":15079,"name":"de_density_scale","nodeType":"Function","startLoc":2850,"text":"def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by\n\n        .. math::\n\n           a_p = \\frac{1}{1 + z_p}\n\n           I = \\left(1 + z\\right)^{3 \\left(1 + w_p + a_p w_a\\right)}\n                     \\exp \\left(-3 w_a \\frac{z}{1+z}\\right)\n        \"\"\"\n        z = aszarr(z)\n        zp1 = z + 1.0  # (converts z [unit] -> z [dimensionless])\n        apiv = 1. / (1. + self._zp.value)\n        return zp1 ** (3. * (1. + self._wp + apiv * self._wa)) * \\\n            np.exp(-3. * self._wa * z / zp1)"},{"col":4,"comment":"\n        Wrapper for ``erfa.apci``, used in conversions GCRS <-> ICRS\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, a GCRS frame is expected.\n        ","endLoc":383,"header":"def apcs(self, frame_or_coord)","id":15080,"name":"apcs","nodeType":"Function","startLoc":360,"text":"def apcs(self, frame_or_coord):\n        '''\n        Wrapper for ``erfa.apci``, used in conversions GCRS <-> ICRS\n\n        Parameters\n        ----------\n        frame_or_coord : ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``\n            Frame or coordinate instance in the corresponding frame\n            for which to calculate the calculate the astrom values.\n            For this function, a GCRS frame is expected.\n        '''\n        obstime = frame_or_coord.obstime\n        support = self._get_support_points(obstime)\n\n        # get the position and velocity arrays for the observatory.  Need to\n        # have xyz in last dimension, and pos/vel in one-but-last.\n        earth_pv, earth_heliocentric = self._prepare_earth_position_vel(support, obstime)\n        pv = pav2pv(\n            frame_or_coord.obsgeoloc.get_xyz(xyz_axis=-1).value,\n            frame_or_coord.obsgeovel.get_xyz(xyz_axis=-1).value\n        )\n\n        jd1_tt, jd2_tt = get_jd12(obstime, 'tt')\n        return erfa.apcs(jd1_tt, jd2_tt, pv, earth_pv, earth_heliocentric)"},{"col":4,"comment":"\n        Add this transformation to the requested Transformation graph,\n        replacing anything already connecting these two coordinates.\n\n        Parameters\n        ----------\n        graph : `TransformGraph` object\n            The graph to register this transformation with.\n        ","endLoc":824,"header":"def register(self, graph)","id":15081,"name":"register","nodeType":"Function","startLoc":814,"text":"def register(self, graph):\n        \"\"\"\n        Add this transformation to the requested Transformation graph,\n        replacing anything already connecting these two coordinates.\n\n        Parameters\n        ----------\n        graph : `TransformGraph` object\n            The graph to register this transformation with.\n        \"\"\"\n        graph.add_transform(self.fromsys, self.tosys, self)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":2791,"id":15082,"name":"wp","nodeType":"Attribute","startLoc":2791,"text":"wp"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":2792,"id":15083,"name":"wa","nodeType":"Attribute","startLoc":2792,"text":"wa"},{"col":4,"comment":"null","endLoc":3077,"header":"def _scale_operation(self, op, *args, scaled_base=False)","id":15084,"name":"_scale_operation","nodeType":"Function","startLoc":3073,"text":"def _scale_operation(self, op, *args, scaled_base=False):\n        if scaled_base:\n            return self.__class__(self.d_lon, self.d_lat, op(self.d_distance, *args))\n        else:\n            return super()._scale_operation(op, *args)"},{"attributeType":"null","col":8,"comment":"null","endLoc":218,"id":15085,"name":"mjd_resolution","nodeType":"Attribute","startLoc":218,"text":"self.mjd_resolution"},{"className":"erfa_astrom","col":0,"comment":"\n    ScienceState to select with astrom provider is used in\n    coordinate transformations.\n    ","endLoc":398,"id":15086,"nodeType":"Class","startLoc":386,"text":"class erfa_astrom(ScienceState):\n    \"\"\"\n    ScienceState to select with astrom provider is used in\n    coordinate transformations.\n    \"\"\"\n\n    _value = ErfaAstrom()\n\n    @classmethod\n    def validate(cls, value):\n        if not isinstance(value, ErfaAstrom):\n            raise TypeError(f'Must be an instance of {ErfaAstrom!r}')\n        return value"},{"col":4,"comment":"null","endLoc":398,"header":"@classmethod\n    def validate(cls, value)","id":15087,"name":"validate","nodeType":"Function","startLoc":394,"text":"@classmethod\n    def validate(cls, value):\n        if not isinstance(value, ErfaAstrom):\n            raise TypeError(f'Must be an instance of {ErfaAstrom!r}')\n        return value"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":2794,"id":15088,"name":"zp","nodeType":"Attribute","startLoc":2794,"text":"zp"},{"attributeType":"ErfaAstrom","col":4,"comment":"null","endLoc":392,"id":15089,"name":"_value","nodeType":"Attribute","startLoc":392,"text":"_value"},{"attributeType":"null","col":16,"comment":"null","endLoc":9,"id":15090,"name":"np","nodeType":"Attribute","startLoc":9,"text":"np"},{"attributeType":"null","col":24,"comment":"null","endLoc":14,"id":15091,"name":"u","nodeType":"Attribute","startLoc":14,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":15092,"name":"__all__","nodeType":"Attribute","startLoc":24,"text":"__all__"},{"col":0,"comment":"","endLoc":6,"header":"erfa_astrom.py#<anonymous>","id":15093,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module contains a helper function to fill erfa.astrom struct and a\nScienceState, which allows to speed up coordinate transformations at the\nexpense of accuracy.\n\"\"\"\n\n__all__ = []"},{"attributeType":"null","col":4,"comment":"null","endLoc":3035,"id":15094,"name":"base_representation","nodeType":"Attribute","startLoc":3035,"text":"base_representation"},{"fileName":"funcs.py","filePath":"astropy/coordinates","id":15095,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module contains convenience functions for coordinate-related functionality.\n\nThis is generally just wrapping around the object-oriented coordinates\nframework, but it is useful for some users who are used to more functional\ninterfaces.\n\"\"\"\n\nimport warnings\nfrom collections.abc import Sequence\n\nimport numpy as np\nimport erfa\n\nfrom astropy import units as u\nfrom astropy.constants import c\nfrom astropy.io import ascii\nfrom astropy.utils import isiterable, data\nfrom .sky_coordinate import SkyCoord\nfrom .builtin_frames import GCRS, PrecessedGeocentric\nfrom .representation import SphericalRepresentation, CartesianRepresentation\nfrom .builtin_frames.utils import get_jd12\n\n__all__ = ['cartesian_to_spherical', 'spherical_to_cartesian', 'get_sun',\n           'get_constellation', 'concatenate_representations', 'concatenate']\n\n\ndef cartesian_to_spherical(x, y, z):\n    \"\"\"\n    Converts 3D rectangular cartesian coordinates to spherical polar\n    coordinates.\n\n    Note that the resulting angles are latitude/longitude or\n    elevation/azimuthal form.  I.e., the origin is along the equator\n    rather than at the north pole.\n\n    .. note::\n        This function simply wraps functionality provided by the\n        `~astropy.coordinates.CartesianRepresentation` and\n        `~astropy.coordinates.SphericalRepresentation` classes.  In general,\n        for both performance and readability, we suggest using these classes\n        directly.  But for situations where a quick one-off conversion makes\n        sense, this function is provided.\n\n    Parameters\n    ----------\n    x : scalar, array-like, or `~astropy.units.Quantity`\n        The first Cartesian coordinate.\n    y : scalar, array-like, or `~astropy.units.Quantity`\n        The second Cartesian coordinate.\n    z : scalar, array-like, or `~astropy.units.Quantity`\n        The third Cartesian coordinate.\n\n    Returns\n    -------\n    r : `~astropy.units.Quantity`\n        The radial coordinate (in the same units as the inputs).\n    lat : `~astropy.units.Quantity` ['angle']\n        The latitude in radians\n    lon : `~astropy.units.Quantity` ['angle']\n        The longitude in radians\n    \"\"\"\n    if not hasattr(x, 'unit'):\n        x = x * u.dimensionless_unscaled\n    if not hasattr(y, 'unit'):\n        y = y * u.dimensionless_unscaled\n    if not hasattr(z, 'unit'):\n        z = z * u.dimensionless_unscaled\n\n    cart = CartesianRepresentation(x, y, z)\n    sph = cart.represent_as(SphericalRepresentation)\n\n    return sph.distance, sph.lat, sph.lon\n\n\ndef spherical_to_cartesian(r, lat, lon):\n    \"\"\"\n    Converts spherical polar coordinates to rectangular cartesian\n    coordinates.\n\n    Note that the input angles should be in latitude/longitude or\n    elevation/azimuthal form.  I.e., the origin is along the equator\n    rather than at the north pole.\n\n    .. note::\n        This is a low-level function used internally in\n        `astropy.coordinates`.  It is provided for users if they really\n        want to use it, but it is recommended that you use the\n        `astropy.coordinates` coordinate systems.\n\n    Parameters\n    ----------\n    r : scalar, array-like, or `~astropy.units.Quantity`\n        The radial coordinate (in the same units as the inputs).\n    lat : scalar, array-like, or `~astropy.units.Quantity` ['angle']\n        The latitude (in radians if array or scalar)\n    lon : scalar, array-like, or `~astropy.units.Quantity` ['angle']\n        The longitude (in radians if array or scalar)\n\n    Returns\n    -------\n    x : float or array\n        The first cartesian coordinate.\n    y : float or array\n        The second cartesian coordinate.\n    z : float or array\n        The third cartesian coordinate.\n\n\n    \"\"\"\n    if not hasattr(r, 'unit'):\n        r = r * u.dimensionless_unscaled\n    if not hasattr(lat, 'unit'):\n        lat = lat * u.radian\n    if not hasattr(lon, 'unit'):\n        lon = lon * u.radian\n\n    sph = SphericalRepresentation(distance=r, lat=lat, lon=lon)\n    cart = sph.represent_as(CartesianRepresentation)\n\n    return cart.x, cart.y, cart.z\n\n\ndef get_sun(time):\n    \"\"\"\n    Determines the location of the sun at a given time (or times, if the input\n    is an array `~astropy.time.Time` object), in geocentric coordinates.\n\n    Parameters\n    ----------\n    time : `~astropy.time.Time`\n        The time(s) at which to compute the location of the sun.\n\n    Returns\n    -------\n    newsc : `~astropy.coordinates.SkyCoord`\n        The location of the sun as a `~astropy.coordinates.SkyCoord` in the\n        `~astropy.coordinates.GCRS` frame.\n\n\n    Notes\n    -----\n    The algorithm for determining the sun/earth relative position is based\n    on the simplified version of VSOP2000 that is part of ERFA. Compared to\n    JPL's ephemeris, it should be good to about 4 km (in the Sun-Earth\n    vector) from 1900-2100 C.E., 8 km for the 1800-2200 span, and perhaps\n    250 km over the 1000-3000.\n\n    \"\"\"\n    earth_pv_helio, earth_pv_bary = erfa.epv00(*get_jd12(time, 'tdb'))\n\n    # We have to manually do aberration because we're outputting directly into\n    # GCRS\n    earth_p = earth_pv_helio['p']\n    earth_v = earth_pv_bary['v']\n\n    # convert barycentric velocity to units of c, but keep as array for passing in to erfa\n    earth_v /= c.to_value(u.au/u.d)\n\n    dsun = np.sqrt(np.sum(earth_p**2, axis=-1))\n    invlorentz = (1-np.sum(earth_v**2, axis=-1))**0.5\n    properdir = erfa.ab(earth_p/dsun.reshape(dsun.shape + (1,)),\n                        -earth_v, dsun, invlorentz)\n\n    cartrep = CartesianRepresentation(x=-dsun*properdir[..., 0] * u.AU,\n                                      y=-dsun*properdir[..., 1] * u.AU,\n                                      z=-dsun*properdir[..., 2] * u.AU)\n    return SkyCoord(cartrep, frame=GCRS(obstime=time))\n\n\n# global dictionary that caches repeatedly-needed info for get_constellation\n_constellation_data = {}\n\n\ndef get_constellation(coord, short_name=False, constellation_list='iau'):\n    \"\"\"\n    Determines the constellation(s) a given coordinate object contains.\n\n    Parameters\n    ----------\n    coord : coordinate-like\n        The object to determine the constellation of.\n    short_name : bool\n        If True, the returned names are the IAU-sanctioned abbreviated\n        names.  Otherwise, full names for the constellations are used.\n    constellation_list : str\n        The set of constellations to use.  Currently only ``'iau'`` is\n        supported, meaning the 88 \"modern\" constellations endorsed by the IAU.\n\n    Returns\n    -------\n    constellation : str or string array\n        If ``coords`` contains a scalar coordinate, returns the name of the\n        constellation.  If it is an array coordinate object, it returns an array\n        of names.\n\n    Notes\n    -----\n    To determine which constellation a point on the sky is in, this precesses\n    to B1875, and then uses the Delporte boundaries of the 88 modern\n    constellations, as tabulated by\n    `Roman 1987 <http://cdsarc.u-strasbg.fr/viz-bin/Cat?VI/42>`_.\n    \"\"\"\n    if constellation_list != 'iau':\n        raise ValueError(\"only 'iau' us currently supported for constellation_list\")\n\n    # read the data files and cache them if they haven't been already\n    if not _constellation_data:\n        cdata = data.get_pkg_data_contents('data/constellation_data_roman87.dat')\n        ctable = ascii.read(cdata, names=['ral', 'rau', 'decl', 'name'])\n        cnames = data.get_pkg_data_contents('data/constellation_names.dat', encoding='UTF8')\n        cnames_short_to_long = dict([(l[:3], l[4:])\n                                     for l in cnames.split('\\n')\n                                     if not l.startswith('#')])\n        cnames_long = np.array([cnames_short_to_long[nm] for nm in ctable['name']])\n\n        _constellation_data['ctable'] = ctable\n        _constellation_data['cnames_long'] = cnames_long\n    else:\n        ctable = _constellation_data['ctable']\n        cnames_long = _constellation_data['cnames_long']\n\n    isscalar = coord.isscalar\n\n    # if it is geocentric, we reproduce the frame but with the 1875 equinox,\n    # which is where the constellations are defined\n    # this yields a \"dubious year\" warning because ERFA considers the year 1875\n    # \"dubious\", probably because UTC isn't well-defined then and precession\n    # models aren't precisely calibrated back to then.  But it's plenty\n    # sufficient for constellations\n    with warnings.catch_warnings():\n        warnings.simplefilter('ignore', erfa.ErfaWarning)\n        constel_coord = coord.transform_to(PrecessedGeocentric(equinox='B1875'))\n    if isscalar:\n        rah = constel_coord.ra.ravel().hour\n        decd = constel_coord.dec.ravel().deg\n    else:\n        rah = constel_coord.ra.hour\n        decd = constel_coord.dec.deg\n\n    constellidx = -np.ones(len(rah), dtype=int)\n\n    notided = constellidx == -1  # should be all\n    for i, row in enumerate(ctable):\n        msk = (row['ral'] < rah) & (rah < row['rau']) & (decd > row['decl'])\n        constellidx[notided & msk] = i\n        notided = constellidx == -1\n        if np.sum(notided) == 0:\n            break\n    else:\n        raise ValueError(f'Could not find constellation for coordinates {constel_coord[notided]}')\n\n    if short_name:\n        names = ctable['name'][constellidx]\n    else:\n        names = cnames_long[constellidx]\n\n    if isscalar:\n        return names[0]\n    else:\n        return names\n\n\ndef _concatenate_components(reps_difs, names):\n    \"\"\" Helper function for the concatenate function below. Gets and\n    concatenates all of the individual components for an iterable of\n    representations or differentials.\n    \"\"\"\n    values = []\n    for name in names:\n        unit0 = getattr(reps_difs[0], name).unit\n        # Go via to_value because np.concatenate doesn't work with Quantity\n        data_vals = [getattr(x, name).to_value(unit0) for x in reps_difs]\n        concat_vals = np.concatenate(np.atleast_1d(*data_vals))\n        concat_vals = concat_vals << unit0\n        values.append(concat_vals)\n\n    return values\n\n\ndef concatenate_representations(reps):\n    \"\"\"\n    Combine multiple representation objects into a single instance by\n    concatenating the data in each component.\n\n    Currently, all of the input representations have to be the same type. This\n    properly handles differential or velocity data, but all input objects must\n    have the same differential object type as well.\n\n    Parameters\n    ----------\n    reps : sequence of `~astropy.coordinates.BaseRepresentation`\n        The objects to concatenate\n\n    Returns\n    -------\n    rep : `~astropy.coordinates.BaseRepresentation` subclass instance\n        A single representation object with its data set to the concatenation of\n        all the elements of the input sequence of representations.\n\n    \"\"\"\n    if not isinstance(reps, (Sequence, np.ndarray)):\n        raise TypeError('Input must be a list or iterable of representation '\n                        'objects.')\n\n    # First, validate that the representations are the same, and\n    # concatenate all of the positional data:\n    rep_type = type(reps[0])\n    if any(type(r) != rep_type for r in reps):\n        raise TypeError('Input representations must all have the same type.')\n\n    # Construct the new representation with the concatenated data from the\n    # representations passed in\n    values = _concatenate_components(reps,\n                                     rep_type.attr_classes.keys())\n    new_rep = rep_type(*values)\n\n    has_diff = any('s' in rep.differentials for rep in reps)\n    if has_diff and any('s' not in rep.differentials for rep in reps):\n        raise ValueError('Input representations must either all contain '\n                         'differentials, or not contain differentials.')\n\n    if has_diff:\n        dif_type = type(reps[0].differentials['s'])\n\n        if any('s' not in r.differentials or\n                type(r.differentials['s']) != dif_type\n               for r in reps):\n            raise TypeError('All input representations must have the same '\n                            'differential type.')\n\n        values = _concatenate_components([r.differentials['s'] for r in reps],\n                                         dif_type.attr_classes.keys())\n        new_dif = dif_type(*values)\n        new_rep = new_rep.with_differentials({'s': new_dif})\n\n    return new_rep\n\n\ndef concatenate(coords):\n    \"\"\"\n    Combine multiple coordinate objects into a single\n    `~astropy.coordinates.SkyCoord`.\n\n    \"Coordinate objects\" here mean frame objects with data,\n    `~astropy.coordinates.SkyCoord`, or representation objects.  Currently,\n    they must all be in the same frame, but in a future version this may be\n    relaxed to allow inhomogeneous sequences of objects.\n\n    Parameters\n    ----------\n    coords : sequence of coordinate-like\n        The objects to concatenate\n\n    Returns\n    -------\n    cskycoord : SkyCoord\n        A single sky coordinate with its data set to the concatenation of all\n        the elements in ``coords``\n    \"\"\"\n    if getattr(coords, 'isscalar', False) or not isiterable(coords):\n        raise TypeError('The argument to concatenate must be iterable')\n\n    scs = [SkyCoord(coord, copy=False) for coord in coords]\n\n    # Check that all frames are equivalent\n    for sc in scs[1:]:\n        if not sc.is_equivalent_frame(scs[0]):\n            raise ValueError(\"All inputs must have equivalent frames: \"\n                             \"{} != {}\".format(sc, scs[0]))\n\n    # TODO: this can be changed to SkyCoord.from_representation() for a speed\n    # boost when we switch to using classmethods\n    return SkyCoord(concatenate_representations([c.data for c in coords]),\n                    frame=scs[0].frame)\n"},{"col":0,"comment":"Generate a random sampling of points on the surface of the unit sphere.\n\n    Parameters\n    ----------\n    size : int\n        The number of points to generate.\n\n    Returns\n    -------\n    rep : `~astropy.coordinates.UnitSphericalRepresentation`\n        The random points.\n    ","endLoc":206,"header":"def uniform_spherical_random_surface(size=1)","id":15096,"name":"uniform_spherical_random_surface","nodeType":"Function","startLoc":187,"text":"def uniform_spherical_random_surface(size=1):\n    \"\"\"Generate a random sampling of points on the surface of the unit sphere.\n\n    Parameters\n    ----------\n    size : int\n        The number of points to generate.\n\n    Returns\n    -------\n    rep : `~astropy.coordinates.UnitSphericalRepresentation`\n        The random points.\n    \"\"\"\n\n    rng = np.random  # can maybe switch to this being an input later - see #11628\n\n    lon = rng.uniform(0, 2*np.pi, size) * u.rad\n    lat = np.arcsin(rng.uniform(-1, 1, size=size)) * u.rad\n\n    return UnitSphericalRepresentation(lon, lat)"},{"attributeType":"null","col":4,"comment":"null","endLoc":3036,"id":15097,"name":"_unit_differential","nodeType":"Attribute","startLoc":3036,"text":"_unit_differential"},{"className":"UnitSphericalCosLatDifferential","col":0,"comment":"Differential(s) of points on a unit sphere.\n\n    Parameters\n    ----------\n    d_lon_coslat, d_lat : `~astropy.units.Quantity`\n        The longitude and latitude of the differentials.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    ","endLoc":3274,"id":15098,"nodeType":"Class","startLoc":3170,"text":"class UnitSphericalCosLatDifferential(BaseSphericalCosLatDifferential):\n    \"\"\"Differential(s) of points on a unit sphere.\n\n    Parameters\n    ----------\n    d_lon_coslat, d_lat : `~astropy.units.Quantity`\n        The longitude and latitude of the differentials.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n    base_representation = UnitSphericalRepresentation\n    attr_classes = {'d_lon_coslat': u.Quantity,\n                    'd_lat': u.Quantity}\n\n    @classproperty\n    def _dimensional_differential(cls):\n        return SphericalCosLatDifferential\n\n    def __init__(self, d_lon_coslat, d_lat=None, copy=True):\n        super().__init__(d_lon_coslat, d_lat, copy=copy)\n        if not self._d_lon_coslat.unit.is_equivalent(self._d_lat.unit):\n            raise u.UnitsError('d_lon_coslat and d_lat should have equivalent '\n                               'units.')\n\n    @classmethod\n    def from_cartesian(cls, other, base):\n        # Go via the dimensional equivalent, so that the longitude and latitude\n        # differentials correctly take into account the norm of the base.\n        dimensional = cls._dimensional_differential.from_cartesian(other, base)\n        return dimensional.represent_as(cls)\n\n    def to_cartesian(self, base):\n        if isinstance(base, SphericalRepresentation):\n            scale = base.distance\n        elif isinstance(base, PhysicsSphericalRepresentation):\n            scale = base.r\n        else:\n            return super().to_cartesian(base)\n\n        base = base.represent_as(UnitSphericalRepresentation)\n        return scale * super().to_cartesian(base)\n\n    def represent_as(self, other_class, base=None):\n        # Only have enough information to represent other unit-spherical.\n        if issubclass(other_class, UnitSphericalDifferential):\n            return other_class(self._d_lon(base), self.d_lat)\n\n        return super().represent_as(other_class, base)\n\n    @classmethod\n    def from_representation(cls, representation, base=None):\n        # All spherical differentials can be done without going to Cartesian,\n        # though w/o CosLat needs base for the latitude.\n        if isinstance(representation, SphericalCosLatDifferential):\n            return cls(representation.d_lon_coslat, representation.d_lat)\n        elif isinstance(representation, (SphericalDifferential,\n                                         UnitSphericalDifferential)):\n            d_lon_coslat = cls._get_d_lon_coslat(representation.d_lon, base)\n            return cls(d_lon_coslat, representation.d_lat)\n        elif isinstance(representation, PhysicsSphericalDifferential):\n            d_lon_coslat = cls._get_d_lon_coslat(representation.d_phi, base)\n            return cls(d_lon_coslat, -representation.d_theta)\n\n        return super().from_representation(representation, base)\n\n    def transform(self, matrix, base, transformed_base):\n        \"\"\"Transform differential using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new differential and does not modify the original one.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n        base : instance of ``cls.base_representation``\n            Base relative to which the differentials are defined.  If the other\n            class is a differential representation, the base will be converted\n            to its ``base_representation``.\n        transformed_base : instance of ``cls.base_representation``\n            Base relative to which the transformed differentials are defined.\n            If the other class is a differential representation, the base will\n            be converted to its ``base_representation``.\n        \"\"\"\n        # the transformation matrix does not need to be a rotation matrix,\n        # so the unit-distance is not guaranteed. For speed, we check if the\n        # matrix is in O(3) and preserves lengths.\n        if np.all(is_O3(matrix)):  # remain in unit-rep\n            # TODO! implement without Cartesian intermediate step.\n            diff = super().transform(matrix, base, transformed_base)\n\n        else:  # switch to dimensional representation\n            du = self.d_lat.unit / base.lat.unit  # derivative unit\n            diff = self._dimensional_differential(\n                d_lon_coslat=self.d_lon_coslat, d_lat=self.d_lat,\n                d_distance=0 * du\n            ).transform(matrix, base, transformed_base)\n\n        return diff\n\n    def _scale_operation(self, op, *args, scaled_base=False):\n        if scaled_base:\n            return self.copy()\n        else:\n            return super()._scale_operation(op, *args)"},{"className":"GCRS","col":0,"comment":"\n    A coordinate or frame in the Geocentric Celestial Reference System (GCRS).\n\n    GCRS is distinct form ICRS mainly in that it is relative to the Earth's\n    center-of-mass rather than the solar system Barycenter.  That means this\n    frame includes the effects of aberration (unlike ICRS). For more background\n    on the GCRS, see the references provided in the\n    :ref:`astropy:astropy-coordinates-seealso` section of the documentation. (Of\n    particular note is Section 1.2 of\n    `USNO Circular 179 <https://arxiv.org/abs/astro-ph/0602086>`_)\n\n    This frame also includes frames that are defined *relative* to the Earth,\n    but that are offset (in both position and velocity) from the Earth.\n\n    The frame attributes are listed under **Other Parameters**.\n    ","endLoc":59,"id":15099,"nodeType":"Class","startLoc":36,"text":"@format_doc(base_doc, components=doc_components, footer=doc_footer_gcrs)\nclass GCRS(BaseRADecFrame):\n    \"\"\"\n    A coordinate or frame in the Geocentric Celestial Reference System (GCRS).\n\n    GCRS is distinct form ICRS mainly in that it is relative to the Earth's\n    center-of-mass rather than the solar system Barycenter.  That means this\n    frame includes the effects of aberration (unlike ICRS). For more background\n    on the GCRS, see the references provided in the\n    :ref:`astropy:astropy-coordinates-seealso` section of the documentation. (Of\n    particular note is Section 1.2 of\n    `USNO Circular 179 <https://arxiv.org/abs/astro-ph/0602086>`_)\n\n    This frame also includes frames that are defined *relative* to the Earth,\n    but that are offset (in both position and velocity) from the Earth.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n    obsgeoloc = CartesianRepresentationAttribute(default=[0, 0, 0],\n                                                 unit=u.m)\n    obsgeovel = CartesianRepresentationAttribute(default=[0, 0, 0],\n                                                 unit=u.m/u.s)"},{"className":"BaseSphericalCosLatDifferential","col":0,"comment":"Differentials from points on a spherical base representation.\n\n    With cos(lat) assumed to be included in the longitude differential.\n    ","endLoc":3167,"id":15100,"nodeType":"Class","startLoc":3080,"text":"class BaseSphericalCosLatDifferential(BaseDifferential):\n    \"\"\"Differentials from points on a spherical base representation.\n\n    With cos(lat) assumed to be included in the longitude differential.\n    \"\"\"\n    @classmethod\n    def _get_base_vectors(cls, base):\n        \"\"\"Get unit vectors and scale factors from (unit)spherical base.\n\n        Parameters\n        ----------\n        base : instance of ``self.base_representation``\n            The points for which the unit vectors and scale factors should be\n            retrieved.\n\n        Returns\n        -------\n        unit_vectors : dict of `CartesianRepresentation`\n            In the directions of the coordinates of base.\n        scale_factors : dict of `~astropy.units.Quantity`\n            Scale factors for each of the coordinates.  The scale factor for\n            longitude does not include the cos(lat) factor.\n\n        Raises\n        ------\n        TypeError : if the base is not of the correct type\n        \"\"\"\n        cls._check_base(base)\n        return base.unit_vectors(), base.scale_factors(omit_coslat=True)\n\n    def _d_lon(self, base):\n        \"\"\"Convert longitude differential with cos(lat) to one without.\n\n        Parameters\n        ----------\n        base : instance of ``cls.base_representation``\n            The base from which the latitude will be taken.\n        \"\"\"\n        self._check_base(base)\n        return self.d_lon_coslat / np.cos(base.lat)\n\n    @classmethod\n    def _get_d_lon_coslat(cls, d_lon, base):\n        \"\"\"Convert longitude differential d_lon to d_lon_coslat.\n\n        Parameters\n        ----------\n        d_lon : `~astropy.units.Quantity`\n            Value of the longitude differential without ``cos(lat)``.\n        base : instance of ``cls.base_representation``\n            The base from which the latitude will be taken.\n        \"\"\"\n        cls._check_base(base)\n        return d_lon * np.cos(base.lat)\n\n    def _combine_operation(self, op, other, reverse=False):\n        \"\"\"Combine two differentials, or a differential with a representation.\n\n        If ``other`` is of the same differential type as ``self``, the\n        components will simply be combined.  If both are different parts of\n        a `~astropy.coordinates.SphericalDifferential` (e.g., a\n        `~astropy.coordinates.UnitSphericalDifferential` and a\n        `~astropy.coordinates.RadialDifferential`), they will combined\n        appropriately.\n\n        If ``other`` is a representation, it will be used as a base for which\n        to evaluate the differential, and the result is a new representation.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.add`, `~operator.sub`, etc.\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The other differential or representation.\n        reverse : bool\n            Whether the operands should be reversed (e.g., as we got here via\n            ``self.__rsub__`` because ``self`` is a subclass of ``other``).\n        \"\"\"\n        if (isinstance(other, BaseSphericalCosLatDifferential) and\n                not isinstance(self, type(other)) or\n                isinstance(other, RadialDifferential)):\n            all_components = set(self.components) | set(other.components)\n            first, second = (self, other) if not reverse else (other, self)\n            result_args = {c: op(getattr(first, c, 0.), getattr(second, c, 0.))\n                           for c in all_components}\n            return SphericalCosLatDifferential(**result_args)\n\n        return super()._combine_operation(op, other, reverse)"},{"attributeType":"null","col":12,"comment":"null","endLoc":2818,"id":15101,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":2818,"text":"self._inv_efunc_scalar"},{"col":4,"comment":"Get unit vectors and scale factors from (unit)spherical base.\n\n        Parameters\n        ----------\n        base : instance of ``self.base_representation``\n            The points for which the unit vectors and scale factors should be\n            retrieved.\n\n        Returns\n        -------\n        unit_vectors : dict of `CartesianRepresentation`\n            In the directions of the coordinates of base.\n        scale_factors : dict of `~astropy.units.Quantity`\n            Scale factors for each of the coordinates.  The scale factor for\n            longitude does not include the cos(lat) factor.\n\n        Raises\n        ------\n        TypeError : if the base is not of the correct type\n        ","endLoc":3108,"header":"@classmethod\n    def _get_base_vectors(cls, base)","id":15102,"name":"_get_base_vectors","nodeType":"Function","startLoc":3085,"text":"@classmethod\n    def _get_base_vectors(cls, base):\n        \"\"\"Get unit vectors and scale factors from (unit)spherical base.\n\n        Parameters\n        ----------\n        base : instance of ``self.base_representation``\n            The points for which the unit vectors and scale factors should be\n            retrieved.\n\n        Returns\n        -------\n        unit_vectors : dict of `CartesianRepresentation`\n            In the directions of the coordinates of base.\n        scale_factors : dict of `~astropy.units.Quantity`\n            Scale factors for each of the coordinates.  The scale factor for\n            longitude does not include the cos(lat) factor.\n\n        Raises\n        ------\n        TypeError : if the base is not of the correct type\n        \"\"\"\n        cls._check_base(base)\n        return base.unit_vectors(), base.scale_factors(omit_coslat=True)"},{"attributeType":"null","col":4,"comment":"null","endLoc":55,"id":15103,"name":"obstime","nodeType":"Attribute","startLoc":55,"text":"obstime"},{"col":4,"comment":"\n        Combines together sequences of `StaticMatrixTransform`s into a single\n        transform and returns it.\n        ","endLoc":1461,"header":"def _combine_statics(self, transforms)","id":15104,"name":"_combine_statics","nodeType":"Function","startLoc":1444,"text":"def _combine_statics(self, transforms):\n        \"\"\"\n        Combines together sequences of `StaticMatrixTransform`s into a single\n        transform and returns it.\n        \"\"\"\n        newtrans = []\n        for currtrans in transforms:\n            lasttrans = newtrans[-1] if len(newtrans) > 0 else None\n\n            if (isinstance(lasttrans, StaticMatrixTransform) and\n                    isinstance(currtrans, StaticMatrixTransform)):\n                combinedmat = matrix_product(currtrans.matrix, lasttrans.matrix)\n                newtrans[-1] = StaticMatrixTransform(combinedmat,\n                                                     lasttrans.fromsys,\n                                                     currtrans.tosys)\n            else:\n                newtrans.append(currtrans)\n        return newtrans"},{"col":4,"comment":"null","endLoc":1353,"header":"def __init__(self, matrix, fromsys, tosys, priority=1, register_graph=None)","id":15105,"name":"__init__","nodeType":"Function","startLoc":1344,"text":"def __init__(self, matrix, fromsys, tosys, priority=1, register_graph=None):\n        if callable(matrix):\n            matrix = matrix()\n        self.matrix = np.array(matrix)\n\n        if self.matrix.shape != (3, 3):\n            raise ValueError('Provided matrix is not 3 x 3')\n\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)"},{"attributeType":"null","col":4,"comment":"null","endLoc":56,"id":15106,"name":"obsgeoloc","nodeType":"Attribute","startLoc":56,"text":"obsgeoloc"},{"col":0,"comment":"Generate a random sampling of points that follow a uniform volume\n    density distribution within a sphere.\n\n    Parameters\n    ----------\n    size : int\n        The number of points to generate.\n    max_radius : number, quantity-like, optional\n        A dimensionless or unit-ful factor to scale the random distances.\n    rng : `numpy.random.Generator`, optional\n        A random number generator instance.\n\n    Returns\n    -------\n    rep : `~astropy.coordinates.SphericalRepresentation`\n        The random points.\n    ","endLoc":232,"header":"def uniform_spherical_random_volume(size=1, max_radius=1)","id":15107,"name":"uniform_spherical_random_volume","nodeType":"Function","startLoc":209,"text":"def uniform_spherical_random_volume(size=1, max_radius=1):\n    \"\"\"Generate a random sampling of points that follow a uniform volume\n    density distribution within a sphere.\n\n    Parameters\n    ----------\n    size : int\n        The number of points to generate.\n    max_radius : number, quantity-like, optional\n        A dimensionless or unit-ful factor to scale the random distances.\n    rng : `numpy.random.Generator`, optional\n        A random number generator instance.\n\n    Returns\n    -------\n    rep : `~astropy.coordinates.SphericalRepresentation`\n        The random points.\n    \"\"\"\n    rng = np.random  # can maybe switch to this being an input later - see #11628\n\n    usph = uniform_spherical_random_surface(size=size)\n\n    r = np.cbrt(rng.uniform(size=size)) * u.Quantity(max_radius, copy=False)\n    return SphericalRepresentation(usph.lon, usph.lat, r)"},{"attributeType":"null","col":4,"comment":"null","endLoc":58,"id":15108,"name":"obsgeovel","nodeType":"Attribute","startLoc":58,"text":"obsgeovel"},{"className":"PrecessedGeocentric","col":0,"comment":"\n    A coordinate frame defined in a similar manner as GCRS, but precessed to a\n    requested (mean) equinox.  Note that this does *not* end up the same as\n    regular GCRS even for J2000 equinox, because the GCRS orientation is fixed\n    to that of ICRS, which is not quite the same as the dynamical J2000\n    orientation.\n\n    The frame attributes are listed under **Other Parameters**\n    ","endLoc":104,"id":15109,"nodeType":"Class","startLoc":89,"text":"@format_doc(base_doc, components=doc_components, footer=doc_footer_prec_geo)\nclass PrecessedGeocentric(BaseRADecFrame):\n    \"\"\"\n    A coordinate frame defined in a similar manner as GCRS, but precessed to a\n    requested (mean) equinox.  Note that this does *not* end up the same as\n    regular GCRS even for J2000 equinox, because the GCRS orientation is fixed\n    to that of ICRS, which is not quite the same as the dynamical J2000\n    orientation.\n\n    The frame attributes are listed under **Other Parameters**\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n    obsgeoloc = CartesianRepresentationAttribute(default=[0, 0, 0], unit=u.m)\n    obsgeovel = CartesianRepresentationAttribute(default=[0, 0, 0], unit=u.m/u.s)"},{"attributeType":"null","col":4,"comment":"null","endLoc":101,"id":15110,"name":"equinox","nodeType":"Attribute","startLoc":101,"text":"equinox"},{"attributeType":"null","col":4,"comment":"null","endLoc":102,"id":15111,"name":"obstime","nodeType":"Attribute","startLoc":102,"text":"obstime"},{"attributeType":"null","col":4,"comment":"null","endLoc":103,"id":15112,"name":"obsgeoloc","nodeType":"Attribute","startLoc":103,"text":"obsgeoloc"},{"attributeType":"null","col":4,"comment":"null","endLoc":104,"id":15113,"name":"obsgeovel","nodeType":"Attribute","startLoc":104,"text":"obsgeovel"},{"col":4,"comment":"\n        Tries to locate the coordinate class with the provided alias.\n\n        Parameters\n        ----------\n        name : str\n            The alias to look up.\n\n        Returns\n        -------\n        `BaseCoordinateFrame` subclass\n            The coordinate class corresponding to the ``name`` or `None` if\n            no such class exists.\n        ","endLoc":449,"header":"def lookup_name(self, name)","id":15114,"name":"lookup_name","nodeType":"Function","startLoc":433,"text":"def lookup_name(self, name):\n        \"\"\"\n        Tries to locate the coordinate class with the provided alias.\n\n        Parameters\n        ----------\n        name : str\n            The alias to look up.\n\n        Returns\n        -------\n        `BaseCoordinateFrame` subclass\n            The coordinate class corresponding to the ``name`` or `None` if\n            no such class exists.\n        \"\"\"\n\n        return self._cached_names.get(name, None)"},{"col":4,"comment":"Convert longitude differential with cos(lat) to one without.\n\n        Parameters\n        ----------\n        base : instance of ``cls.base_representation``\n            The base from which the latitude will be taken.\n        ","endLoc":3119,"header":"def _d_lon(self, base)","id":15115,"name":"_d_lon","nodeType":"Function","startLoc":3110,"text":"def _d_lon(self, base):\n        \"\"\"Convert longitude differential with cos(lat) to one without.\n\n        Parameters\n        ----------\n        base : instance of ``cls.base_representation``\n            The base from which the latitude will be taken.\n        \"\"\"\n        self._check_base(base)\n        return self.d_lon_coslat / np.cos(base.lat)"},{"col":0,"comment":"\n    Converts 3D rectangular cartesian coordinates to spherical polar\n    coordinates.\n\n    Note that the resulting angles are latitude/longitude or\n    elevation/azimuthal form.  I.e., the origin is along the equator\n    rather than at the north pole.\n\n    .. note::\n        This function simply wraps functionality provided by the\n        `~astropy.coordinates.CartesianRepresentation` and\n        `~astropy.coordinates.SphericalRepresentation` classes.  In general,\n        for both performance and readability, we suggest using these classes\n        directly.  But for situations where a quick one-off conversion makes\n        sense, this function is provided.\n\n    Parameters\n    ----------\n    x : scalar, array-like, or `~astropy.units.Quantity`\n        The first Cartesian coordinate.\n    y : scalar, array-like, or `~astropy.units.Quantity`\n        The second Cartesian coordinate.\n    z : scalar, array-like, or `~astropy.units.Quantity`\n        The third Cartesian coordinate.\n\n    Returns\n    -------\n    r : `~astropy.units.Quantity`\n        The radial coordinate (in the same units as the inputs).\n    lat : `~astropy.units.Quantity` ['angle']\n        The latitude in radians\n    lon : `~astropy.units.Quantity` ['angle']\n        The longitude in radians\n    ","endLoc":75,"header":"def cartesian_to_spherical(x, y, z)","id":15116,"name":"cartesian_to_spherical","nodeType":"Function","startLoc":30,"text":"def cartesian_to_spherical(x, y, z):\n    \"\"\"\n    Converts 3D rectangular cartesian coordinates to spherical polar\n    coordinates.\n\n    Note that the resulting angles are latitude/longitude or\n    elevation/azimuthal form.  I.e., the origin is along the equator\n    rather than at the north pole.\n\n    .. note::\n        This function simply wraps functionality provided by the\n        `~astropy.coordinates.CartesianRepresentation` and\n        `~astropy.coordinates.SphericalRepresentation` classes.  In general,\n        for both performance and readability, we suggest using these classes\n        directly.  But for situations where a quick one-off conversion makes\n        sense, this function is provided.\n\n    Parameters\n    ----------\n    x : scalar, array-like, or `~astropy.units.Quantity`\n        The first Cartesian coordinate.\n    y : scalar, array-like, or `~astropy.units.Quantity`\n        The second Cartesian coordinate.\n    z : scalar, array-like, or `~astropy.units.Quantity`\n        The third Cartesian coordinate.\n\n    Returns\n    -------\n    r : `~astropy.units.Quantity`\n        The radial coordinate (in the same units as the inputs).\n    lat : `~astropy.units.Quantity` ['angle']\n        The latitude in radians\n    lon : `~astropy.units.Quantity` ['angle']\n        The longitude in radians\n    \"\"\"\n    if not hasattr(x, 'unit'):\n        x = x * u.dimensionless_unscaled\n    if not hasattr(y, 'unit'):\n        y = y * u.dimensionless_unscaled\n    if not hasattr(z, 'unit'):\n        z = z * u.dimensionless_unscaled\n\n    cart = CartesianRepresentation(x, y, z)\n    sph = cart.represent_as(SphericalRepresentation)\n\n    return sph.distance, sph.lat, sph.lon"},{"attributeType":"null","col":12,"comment":"null","endLoc":2819,"id":15117,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":2819,"text":"self._inv_efunc_scalar_args"},{"col":4,"comment":"\n        Returns all available transform names. They will all be\n        valid arguments to `lookup_name`.\n\n        Returns\n        -------\n        nms : list\n            The aliases for coordinate systems.\n        ","endLoc":461,"header":"def get_names(self)","id":15118,"name":"get_names","nodeType":"Function","startLoc":451,"text":"def get_names(self):\n        \"\"\"\n        Returns all available transform names. They will all be\n        valid arguments to `lookup_name`.\n\n        Returns\n        -------\n        nms : list\n            The aliases for coordinate systems.\n        \"\"\"\n        return list(self._cached_names.keys())"},{"col":4,"comment":"Convert longitude differential d_lon to d_lon_coslat.\n\n        Parameters\n        ----------\n        d_lon : `~astropy.units.Quantity`\n            Value of the longitude differential without ``cos(lat)``.\n        base : instance of ``cls.base_representation``\n            The base from which the latitude will be taken.\n        ","endLoc":3133,"header":"@classmethod\n    def _get_d_lon_coslat(cls, d_lon, base)","id":15119,"name":"_get_d_lon_coslat","nodeType":"Function","startLoc":3121,"text":"@classmethod\n    def _get_d_lon_coslat(cls, d_lon, base):\n        \"\"\"Convert longitude differential d_lon to d_lon_coslat.\n\n        Parameters\n        ----------\n        d_lon : `~astropy.units.Quantity`\n            Value of the longitude differential without ``cos(lat)``.\n        base : instance of ``cls.base_representation``\n            The base from which the latitude will be taken.\n        \"\"\"\n        cls._check_base(base)\n        return d_lon * np.cos(base.lat)"},{"col":4,"comment":"\n        Converts this transform graph to the graphviz_ DOT format.\n\n        Optionally saves it (requires `graphviz`_ be installed and on your path).\n\n        .. _graphviz: http://www.graphviz.org/\n\n        Parameters\n        ----------\n        priorities : bool\n            If `True`, show the priority values for each transform.  Otherwise,\n            the will not be included in the graph.\n        addnodes : sequence of str\n            Additional coordinate systems to add (this can include systems\n            already in the transform graph, but they will only appear once).\n        savefn : None or str\n            The file name to save this graph to or `None` to not save\n            to a file.\n        savelayout : str\n            The graphviz program to use to layout the graph (see\n            graphviz_ for details) or 'plain' to just save the DOT graph\n            content. Ignored if ``savefn`` is `None`.\n        saveformat : str\n            The graphviz output format. (e.g. the ``-Txxx`` option for\n            the command line program - see graphviz docs for details).\n            Ignored if ``savefn`` is `None`.\n        color_edges : bool\n            Color the edges between two nodes (frames) based on the type of\n            transform. ``FunctionTransform``: red, ``StaticMatrixTransform``:\n            blue, ``DynamicMatrixTransform``: green.\n\n        Returns\n        -------\n        dotgraph : str\n            A string with the DOT format graph.\n        ","endLoc":573,"header":"def to_dot_graph(self, priorities=True, addnodes=[], savefn=None,\n                     savelayout='plain', saveformat=None, color_edges=True)","id":15120,"name":"to_dot_graph","nodeType":"Function","startLoc":463,"text":"def to_dot_graph(self, priorities=True, addnodes=[], savefn=None,\n                     savelayout='plain', saveformat=None, color_edges=True):\n        \"\"\"\n        Converts this transform graph to the graphviz_ DOT format.\n\n        Optionally saves it (requires `graphviz`_ be installed and on your path).\n\n        .. _graphviz: http://www.graphviz.org/\n\n        Parameters\n        ----------\n        priorities : bool\n            If `True`, show the priority values for each transform.  Otherwise,\n            the will not be included in the graph.\n        addnodes : sequence of str\n            Additional coordinate systems to add (this can include systems\n            already in the transform graph, but they will only appear once).\n        savefn : None or str\n            The file name to save this graph to or `None` to not save\n            to a file.\n        savelayout : str\n            The graphviz program to use to layout the graph (see\n            graphviz_ for details) or 'plain' to just save the DOT graph\n            content. Ignored if ``savefn`` is `None`.\n        saveformat : str\n            The graphviz output format. (e.g. the ``-Txxx`` option for\n            the command line program - see graphviz docs for details).\n            Ignored if ``savefn`` is `None`.\n        color_edges : bool\n            Color the edges between two nodes (frames) based on the type of\n            transform. ``FunctionTransform``: red, ``StaticMatrixTransform``:\n            blue, ``DynamicMatrixTransform``: green.\n\n        Returns\n        -------\n        dotgraph : str\n            A string with the DOT format graph.\n        \"\"\"\n\n        nodes = []\n        # find the node names\n        for a in self._graph:\n            if a not in nodes:\n                nodes.append(a)\n            for b in self._graph[a]:\n                if b not in nodes:\n                    nodes.append(b)\n        for node in addnodes:\n            if node not in nodes:\n                nodes.append(node)\n        nodenames = []\n        invclsaliases = dict([(f, [k for k, v in self._cached_names.items() if v == f])\n                              for f in self.frame_set])\n        for n in nodes:\n            if n in invclsaliases:\n                aliases = '`\\\\n`'.join(invclsaliases[n])\n                nodenames.append('{0} [shape=oval label=\"{0}\\\\n`{1}`\"]'.format(n.__name__, aliases))\n            else:\n                nodenames.append(n.__name__ + '[ shape=oval ]')\n\n        edgenames = []\n        # Now the edges\n        for a in self._graph:\n            agraph = self._graph[a]\n            for b in agraph:\n                transform = agraph[b]\n                pri = transform.priority if hasattr(transform, 'priority') else 1\n                color = trans_to_color[transform.__class__] if color_edges else 'black'\n                edgenames.append((a.__name__, b.__name__, pri, color))\n\n        # generate simple dot format graph\n        lines = ['digraph AstropyCoordinateTransformGraph {']\n        lines.append('graph [rankdir=LR]')\n        lines.append('; '.join(nodenames) + ';')\n        for enm1, enm2, weights, color in edgenames:\n            labelstr_fmt = '[ {0} {1} ]'\n\n            if priorities:\n                priority_part = f'label = \"{weights}\"'\n            else:\n                priority_part = ''\n\n            color_part = f'color = \"{color}\"'\n\n            labelstr = labelstr_fmt.format(priority_part, color_part)\n            lines.append(f'{enm1} -> {enm2}{labelstr};')\n\n        lines.append('')\n        lines.append('overlap=false')\n        lines.append('}')\n        dotgraph = '\\n'.join(lines)\n\n        if savefn is not None:\n            if savelayout == 'plain':\n                with open(savefn, 'w') as f:\n                    f.write(dotgraph)\n            else:\n                args = [savelayout]\n                if saveformat is not None:\n                    args.append('-T' + saveformat)\n                proc = subprocess.Popen(args, stdin=subprocess.PIPE,\n                                        stdout=subprocess.PIPE,\n                                        stderr=subprocess.PIPE)\n                stdout, stderr = proc.communicate(dotgraph)\n                if proc.returncode != 0:\n                    raise OSError('problem running graphviz: \\n' + stderr)\n\n                with open(savefn, 'w') as f:\n                    f.write(stdout)\n\n        return dotgraph"},{"col":4,"comment":"Combine two differentials, or a differential with a representation.\n\n        If ``other`` is of the same differential type as ``self``, the\n        components will simply be combined.  If both are different parts of\n        a `~astropy.coordinates.SphericalDifferential` (e.g., a\n        `~astropy.coordinates.UnitSphericalDifferential` and a\n        `~astropy.coordinates.RadialDifferential`), they will combined\n        appropriately.\n\n        If ``other`` is a representation, it will be used as a base for which\n        to evaluate the differential, and the result is a new representation.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.add`, `~operator.sub`, etc.\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The other differential or representation.\n        reverse : bool\n            Whether the operands should be reversed (e.g., as we got here via\n            ``self.__rsub__`` because ``self`` is a subclass of ``other``).\n        ","endLoc":3167,"header":"def _combine_operation(self, op, other, reverse=False)","id":15121,"name":"_combine_operation","nodeType":"Function","startLoc":3135,"text":"def _combine_operation(self, op, other, reverse=False):\n        \"\"\"Combine two differentials, or a differential with a representation.\n\n        If ``other`` is of the same differential type as ``self``, the\n        components will simply be combined.  If both are different parts of\n        a `~astropy.coordinates.SphericalDifferential` (e.g., a\n        `~astropy.coordinates.UnitSphericalDifferential` and a\n        `~astropy.coordinates.RadialDifferential`), they will combined\n        appropriately.\n\n        If ``other`` is a representation, it will be used as a base for which\n        to evaluate the differential, and the result is a new representation.\n\n        Parameters\n        ----------\n        op : `~operator` callable\n            Operator to apply (e.g., `~operator.add`, `~operator.sub`, etc.\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The other differential or representation.\n        reverse : bool\n            Whether the operands should be reversed (e.g., as we got here via\n            ``self.__rsub__`` because ``self`` is a subclass of ``other``).\n        \"\"\"\n        if (isinstance(other, BaseSphericalCosLatDifferential) and\n                not isinstance(self, type(other)) or\n                isinstance(other, RadialDifferential)):\n            all_components = set(self.components) | set(other.components)\n            first, second = (self, other) if not reverse else (other, self)\n            result_args = {c: op(getattr(first, c, 0.), getattr(second, c, 0.))\n                           for c in all_components}\n            return SphericalCosLatDifferential(**result_args)\n\n        return super()._combine_operation(op, other, reverse)"},{"col":4,"comment":"null","endLoc":2145,"header":"def __init__(self, phi, theta=None, r=None, differentials=None, copy=True)","id":15122,"name":"__init__","nodeType":"Function","startLoc":2129,"text":"def __init__(self, phi, theta=None, r=None, differentials=None, copy=True):\n        super().__init__(phi, theta, r, copy=copy, differentials=differentials)\n\n        # Wrap/validate phi/theta\n        # Note that _phi already holds our own copy if copy=True.\n        self._phi.wrap_at(360 * u.deg, inplace=True)\n\n        # This invalid catch block can be removed when the minimum numpy\n        # version is >= 1.19 (NUMPY_LT_1_19)\n        with np.errstate(invalid='ignore'):\n            if np.any(self._theta < 0.*u.deg) or np.any(self._theta > 180.*u.deg):\n                raise ValueError('Inclination angle(s) must be within '\n                                 '0 deg <= angle <= 180 deg, '\n                                 'got {}'.format(theta.to(u.degree)))\n\n        if self._r.unit.physical_type == 'length':\n            self._r = self._r.view(Distance)"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":15123,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":238,"id":15124,"name":"__old_angle_utilities_funcs","nodeType":"Attribute","startLoc":238,"text":"__old_angle_utilities_funcs"},{"attributeType":"null","col":4,"comment":"null","endLoc":248,"id":15125,"name":"funcname","nodeType":"Attribute","startLoc":248,"text":"funcname"},{"col":0,"comment":"","endLoc":6,"header":"angle_utilities.py#<anonymous>","id":15126,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module contains utility functions for working with angles. These are both\nused internally in astropy.coordinates.angles, and of possible\n\"\"\"\n\n__all__ = ['angular_separation', 'position_angle', 'offset_by',\n           'golden_spiral_grid', 'uniform_spherical_random_surface',\n           'uniform_spherical_random_volume']\n\n__old_angle_utilities_funcs = ['check_hms_ranges', 'degrees_to_dms',\n                               'degrees_to_string', 'dms_to_degrees',\n                               'format_exception', 'hms_to_degrees',\n                               'hms_to_dms', 'hms_to_hours',\n                               'hms_to_radians', 'hours_to_decimal',\n                               'hours_to_hms', 'hours_to_radians',\n                               'hours_to_string', 'parse_angle',\n                               'radians_to_degrees', 'radians_to_dms',\n                               'radians_to_hms', 'radians_to_hours',\n                               'sexagesimal_to_string']\n\nfor funcname in __old_angle_utilities_funcs:\n    vars()[funcname] = deprecated(name='astropy.coordinates.angle_utilities.' + funcname,\n                                  alternative='astropy.coordinates.angle_formats.' + funcname,\n                                  since='v4.3')(getattr(angle_formats, funcname))"},{"attributeType":"null","col":8,"comment":"null","endLoc":2803,"id":15127,"name":"zp","nodeType":"Attribute","startLoc":2803,"text":"self.zp"},{"col":4,"comment":"null","endLoc":3187,"header":"@classproperty\n    def _dimensional_differential(cls)","id":15128,"name":"_dimensional_differential","nodeType":"Function","startLoc":3185,"text":"@classproperty\n    def _dimensional_differential(cls):\n        return SphericalCosLatDifferential"},{"col":4,"comment":"null","endLoc":3193,"header":"def __init__(self, d_lon_coslat, d_lat=None, copy=True)","id":15129,"name":"__init__","nodeType":"Function","startLoc":3189,"text":"def __init__(self, d_lon_coslat, d_lat=None, copy=True):\n        super().__init__(d_lon_coslat, d_lat, copy=copy)\n        if not self._d_lon_coslat.unit.is_equivalent(self._d_lat.unit):\n            raise u.UnitsError('d_lon_coslat and d_lat should have equivalent '\n                               'units.')"},{"fileName":"solar_system.py","filePath":"astropy/coordinates","id":15130,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module contains convenience functions for retrieving solar system\nephemerides from jplephem.\n\"\"\"\n\nfrom urllib.parse import urlparse\nimport os.path\n\nimport numpy as np\nimport erfa\n\nfrom .sky_coordinate import SkyCoord\nfrom astropy.utils.data import download_file\nfrom astropy.utils.decorators import classproperty, deprecated\nfrom astropy.utils.state import ScienceState\nfrom astropy.utils import indent\nfrom astropy import units as u\nfrom astropy.constants import c as speed_of_light\nfrom .representation import CartesianRepresentation, CartesianDifferential\nfrom .builtin_frames import GCRS, ICRS, ITRS, TETE\nfrom .builtin_frames.utils import get_jd12\n\n__all__ = [\"get_body\", \"get_moon\", \"get_body_barycentric\",\n           \"get_body_barycentric_posvel\", \"solar_system_ephemeris\"]\n\n\nDEFAULT_JPL_EPHEMERIS = 'de430'\n\n\"\"\"List of kernel pairs needed to calculate positions of a given object.\"\"\"\nBODY_NAME_TO_KERNEL_SPEC = {\n    'sun': [(0, 10)],\n    'mercury': [(0, 1), (1, 199)],\n    'venus': [(0, 2), (2, 299)],\n    'earth-moon-barycenter': [(0, 3)],\n    'earth': [(0, 3), (3, 399)],\n    'moon': [(0, 3), (3, 301)],\n    'mars': [(0, 4)],\n    'jupiter': [(0, 5)],\n    'saturn': [(0, 6)],\n    'uranus': [(0, 7)],\n    'neptune': [(0, 8)],\n    'pluto': [(0, 9)],\n}\n\n\"\"\"Indices to the plan94 routine for the given object.\"\"\"\nPLAN94_BODY_NAME_TO_PLANET_INDEX = {\n    'mercury': 1,\n    'venus': 2,\n    'earth-moon-barycenter': 3,\n    'mars': 4,\n    'jupiter': 5,\n    'saturn': 6,\n    'uranus': 7,\n    'neptune': 8,\n}\n\n_EPHEMERIS_NOTE = \"\"\"\nYou can either give an explicit ephemeris or use a default, which is normally\na built-in ephemeris that does not require ephemeris files.  To change\nthe default to be the JPL ephemeris::\n\n    >>> from astropy.coordinates import solar_system_ephemeris\n    >>> solar_system_ephemeris.set('jpl')  # doctest: +SKIP\n\nUse of any JPL ephemeris requires the jplephem package\n(https://pypi.org/project/jplephem/).\nIf needed, the ephemeris file will be downloaded (and cached).\n\nOne can check which bodies are covered by a given ephemeris using::\n\n    >>> solar_system_ephemeris.bodies\n    ('earth', 'sun', 'moon', 'mercury', 'venus', 'earth-moon-barycenter', 'mars', 'jupiter', 'saturn', 'uranus', 'neptune')\n\"\"\"[1:-1]\n\n\nclass solar_system_ephemeris(ScienceState):\n    \"\"\"Default ephemerides for calculating positions of Solar-System bodies.\n\n    This can be one of the following::\n\n    - 'builtin': polynomial approximations to the orbital elements.\n    - 'de430', 'de432s', 'de440', 'de440s': short-cuts for recent JPL dynamical models.\n    - 'jpl': Alias for the default JPL ephemeris (currently, 'de430').\n    - URL: (str) The url to a SPK ephemeris in SPICE binary (.bsp) format.\n    - PATH: (str) File path to a SPK ephemeris in SPICE binary (.bsp) format.\n    - `None`: Ensure an Exception is raised without an explicit ephemeris.\n\n    The default is 'builtin', which uses the ``epv00`` and ``plan94``\n    routines from the ``erfa`` implementation of the Standards Of Fundamental\n    Astronomy library.\n\n    Notes\n    -----\n    Any file required will be downloaded (and cached) when the state is set.\n    The default Satellite Planet Kernel (SPK) file from NASA JPL (de430) is\n    ~120MB, and covers years ~1550-2650 CE [1]_.  The smaller de432s file is\n    ~10MB, and covers years 1950-2050 [2]_ (and similarly for the newer de440\n    and de440s).  Older versions of the JPL ephemerides (such as the widely\n    used de200) can be used via their URL [3]_.\n\n    .. [1] https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/aareadme_de430-de431.txt\n    .. [2] https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/aareadme_de432s.txt\n    .. [3] https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/a_old_versions/\n    \"\"\"\n    _value = 'builtin'\n    _kernel = None\n\n    @classmethod\n    def validate(cls, value):\n        # make no changes if value is None\n        if value is None:\n            return cls._value\n        # Set up Kernel; if the file is not in cache, this will download it.\n        cls.get_kernel(value)\n        return value\n\n    @classmethod\n    def get_kernel(cls, value):\n        # ScienceState only ensures the `_value` attribute is up to date,\n        # so we need to be sure any kernel returned is consistent.\n        if cls._kernel is None or cls._kernel.origin != value:\n            if cls._kernel is not None:\n                cls._kernel.daf.file.close()\n                cls._kernel = None\n            kernel = _get_kernel(value)\n            if kernel is not None:\n                kernel.origin = value\n            cls._kernel = kernel\n        return cls._kernel\n\n    @classproperty\n    def kernel(cls):\n        return cls.get_kernel(cls._value)\n\n    @classproperty\n    def bodies(cls):\n        if cls._value is None:\n            return None\n        if cls._value.lower() == 'builtin':\n            return (('earth', 'sun', 'moon') +\n                    tuple(PLAN94_BODY_NAME_TO_PLANET_INDEX.keys()))\n        else:\n            return tuple(BODY_NAME_TO_KERNEL_SPEC.keys())\n\n\ndef _get_kernel(value):\n    \"\"\"\n    Try importing jplephem, download/retrieve from cache the Satellite Planet\n    Kernel corresponding to the given ephemeris.\n    \"\"\"\n    if value is None or value.lower() == 'builtin':\n        return None\n\n    try:\n        from jplephem.spk import SPK\n    except ImportError:\n        raise ImportError(\"Solar system JPL ephemeris calculations require \"\n                          \"the jplephem package \"\n                          \"(https://pypi.org/project/jplephem/)\")\n\n    if value.lower() == 'jpl':\n        value = DEFAULT_JPL_EPHEMERIS\n\n    if value.lower() in ('de430', 'de432s', 'de440', 'de440s'):\n        value = ('https://naif.jpl.nasa.gov/pub/naif/generic_kernels'\n                 '/spk/planets/{:s}.bsp'.format(value.lower()))\n\n    elif os.path.isfile(value):\n        return SPK.open(value)\n\n    else:\n        try:\n            urlparse(value)\n        except Exception:\n            raise ValueError('{} was not one of the standard strings and '\n                             'could not be parsed as a file path or URL'.format(value))\n\n    return SPK.open(download_file(value, cache=True))\n\n\ndef _get_body_barycentric_posvel(body, time, ephemeris=None,\n                                 get_velocity=True):\n    \"\"\"Calculate the barycentric position (and velocity) of a solar system body.\n\n    Parameters\n    ----------\n    body : str or other\n        The solar system body for which to calculate positions.  Can also be a\n        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL\n        kernel.\n    time : `~astropy.time.Time`\n        Time of observation.\n    ephemeris : str, optional\n        Ephemeris to use.  By default, use the one set with\n        ``astropy.coordinates.solar_system_ephemeris.set``\n    get_velocity : bool, optional\n        Whether or not to calculate the velocity as well as the position.\n\n    Returns\n    -------\n    position : `~astropy.coordinates.CartesianRepresentation` or tuple\n        Barycentric (ICRS) position or tuple of position and velocity.\n\n    Notes\n    -----\n    Whether or not velocities are calculated makes little difference for the\n    built-in ephemerides, but for most JPL ephemeris files, the execution time\n    roughly doubles.\n    \"\"\"\n    # If the ephemeris is to be taken from solar_system_ephemeris, or the one\n    # it already contains, use the kernel there.  Otherwise, open the ephemeris,\n    # possibly downloading it, but make sure the file is closed at the end.\n    default_kernel = ephemeris is None or ephemeris is solar_system_ephemeris._value\n    kernel = None\n    try:\n        if default_kernel:\n            if solar_system_ephemeris.get() is None:\n                raise ValueError(_EPHEMERIS_NOTE)\n            kernel = solar_system_ephemeris.kernel\n        else:\n            kernel = _get_kernel(ephemeris)\n\n        jd1, jd2 = get_jd12(time, 'tdb')\n        if kernel is None:\n            body = body.lower()\n            earth_pv_helio, earth_pv_bary = erfa.epv00(jd1, jd2)\n            if body == 'earth':\n                body_pv_bary = earth_pv_bary\n\n            elif body == 'moon':\n                # The moon98 documentation notes that it takes TT, but that TDB leads\n                # to errors smaller than the uncertainties in the algorithm.\n                # moon98 returns the astrometric position relative to the Earth.\n                moon_pv_geo = erfa.moon98(jd1, jd2)\n                body_pv_bary = erfa.pvppv(moon_pv_geo, earth_pv_bary)\n            else:\n                sun_pv_bary = erfa.pvmpv(earth_pv_bary, earth_pv_helio)\n                if body == 'sun':\n                    body_pv_bary = sun_pv_bary\n                else:\n                    try:\n                        body_index = PLAN94_BODY_NAME_TO_PLANET_INDEX[body]\n                    except KeyError:\n                        raise KeyError(\"{}'s position and velocity cannot be \"\n                                       \"calculated with the '{}' ephemeris.\"\n                                       .format(body, ephemeris))\n                    body_pv_helio = erfa.plan94(jd1, jd2, body_index)\n                    body_pv_bary = erfa.pvppv(body_pv_helio, sun_pv_bary)\n\n            body_pos_bary = CartesianRepresentation(\n                body_pv_bary['p'], unit=u.au, xyz_axis=-1, copy=False)\n            if get_velocity:\n                body_vel_bary = CartesianRepresentation(\n                    body_pv_bary['v'], unit=u.au/u.day, xyz_axis=-1,\n                    copy=False)\n\n        else:\n            if isinstance(body, str):\n                # Look up kernel chain for JPL ephemeris, based on name\n                try:\n                    kernel_spec = BODY_NAME_TO_KERNEL_SPEC[body.lower()]\n                except KeyError:\n                    raise KeyError(\"{}'s position cannot be calculated with \"\n                                   \"the {} ephemeris.\".format(body, ephemeris))\n            else:\n                # otherwise, assume the user knows what their doing and intentionally\n                # passed in a kernel chain\n                kernel_spec = body\n\n            # jplephem cannot handle multi-D arrays, so convert to 1D here.\n            jd1_shape = getattr(jd1, 'shape', ())\n            if len(jd1_shape) > 1:\n                jd1, jd2 = jd1.ravel(), jd2.ravel()\n                # Note that we use the new jd1.shape here to create a 1D result array.\n                # It is reshaped below.\n            body_posvel_bary = np.zeros((2 if get_velocity else 1, 3) +\n                                        getattr(jd1, 'shape', ()))\n            for pair in kernel_spec:\n                spk = kernel[pair]\n                if spk.data_type == 3:\n                    # Type 3 kernels contain both position and velocity.\n                    posvel = spk.compute(jd1, jd2)\n                    if get_velocity:\n                        body_posvel_bary += posvel.reshape(body_posvel_bary.shape)\n                    else:\n                        body_posvel_bary[0] += posvel[:4]\n                else:\n                    # spk.generate first yields the position and then the\n                    # derivative. If no velocities are desired, body_posvel_bary\n                    # has only one element and thus the loop ends after a single\n                    # iteration, avoiding the velocity calculation.\n                    for body_p_or_v, p_or_v in zip(body_posvel_bary,\n                                                   spk.generate(jd1, jd2)):\n                        body_p_or_v += p_or_v\n\n            body_posvel_bary.shape = body_posvel_bary.shape[:2] + jd1_shape\n            body_pos_bary = CartesianRepresentation(body_posvel_bary[0],\n                                                    unit=u.km, copy=False)\n            if get_velocity:\n                body_vel_bary = CartesianRepresentation(body_posvel_bary[1],\n                                                        unit=u.km/u.day, copy=False)\n\n        return (body_pos_bary, body_vel_bary) if get_velocity else body_pos_bary\n\n    finally:\n        if not default_kernel and kernel is not None:\n            kernel.daf.file.close()\n\n\ndef get_body_barycentric_posvel(body, time, ephemeris=None):\n    \"\"\"Calculate the barycentric position and velocity of a solar system body.\n\n    Parameters\n    ----------\n    body : str or list of tuple\n        The solar system body for which to calculate positions.  Can also be a\n        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL\n        kernel.\n    time : `~astropy.time.Time`\n        Time of observation.\n    ephemeris : str, optional\n        Ephemeris to use.  By default, use the one set with\n        ``astropy.coordinates.solar_system_ephemeris.set``\n\n    Returns\n    -------\n    position, velocity : tuple of `~astropy.coordinates.CartesianRepresentation`\n        Tuple of barycentric (ICRS) position and velocity.\n\n    See also\n    --------\n    get_body_barycentric : to calculate position only.\n        This is faster by about a factor two for JPL kernels, but has no\n        speed advantage for the built-in ephemeris.\n\n    Notes\n    -----\n    {_EPHEMERIS_NOTE}\n    \"\"\"\n    return _get_body_barycentric_posvel(body, time, ephemeris)\n\n\ndef get_body_barycentric(body, time, ephemeris=None):\n    \"\"\"Calculate the barycentric position of a solar system body.\n\n    Parameters\n    ----------\n    body : str or list of tuple\n        The solar system body for which to calculate positions.  Can also be a\n        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL\n        kernel.\n    time : `~astropy.time.Time`\n        Time of observation.\n    ephemeris : str, optional\n        Ephemeris to use.  By default, use the one set with\n        ``astropy.coordinates.solar_system_ephemeris.set``\n\n    Returns\n    -------\n    position : `~astropy.coordinates.CartesianRepresentation`\n        Barycentric (ICRS) position of the body in cartesian coordinates\n\n    See also\n    --------\n    get_body_barycentric_posvel : to calculate both position and velocity.\n\n    Notes\n    -----\n    {_EPHEMERIS_NOTE}\n    \"\"\"\n    return _get_body_barycentric_posvel(body, time, ephemeris,\n                                        get_velocity=False)\n\n\ndef _get_apparent_body_position(body, time, ephemeris, obsgeoloc=None):\n    \"\"\"Calculate the apparent position of body ``body`` relative to Earth.\n\n    This corrects for the light-travel time to the object.\n\n    Parameters\n    ----------\n    body : str or other\n        The solar system body for which to calculate positions.  Can also be a\n        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL\n        kernel.\n    time : `~astropy.time.Time`\n        Time of observation.\n    ephemeris : str, optional\n        Ephemeris to use.  By default, use the one set with\n        ``~astropy.coordinates.solar_system_ephemeris.set``\n    obsgeoloc : `~astropy.coordinates.CartesianRepresentation`, optional\n        The GCRS position of the observer\n\n    Returns\n    -------\n    cartesian_position : `~astropy.coordinates.CartesianRepresentation`\n        Barycentric (ICRS) apparent position of the body in cartesian coordinates\n\n    Notes\n    -----\n    {_EPHEMERIS_NOTE}\n    \"\"\"\n    if ephemeris is None:\n        ephemeris = solar_system_ephemeris.get()\n\n    # Calculate position given approximate light travel time.\n    delta_light_travel_time = 20. * u.s\n    emitted_time = time\n    light_travel_time = 0. * u.s\n    earth_loc = get_body_barycentric('earth', time, ephemeris)\n    if obsgeoloc is not None:\n        earth_loc += obsgeoloc\n    while np.any(np.fabs(delta_light_travel_time) > 1.0e-8*u.s):\n        body_loc = get_body_barycentric(body, emitted_time, ephemeris)\n        earth_distance = (body_loc - earth_loc).norm()\n        delta_light_travel_time = (light_travel_time -\n                                   earth_distance/speed_of_light)\n        light_travel_time = earth_distance/speed_of_light\n        emitted_time = time - light_travel_time\n\n    return get_body_barycentric(body, emitted_time, ephemeris)\n\n\ndef get_body(body, time, location=None, ephemeris=None):\n    \"\"\"\n    Get a `~astropy.coordinates.SkyCoord` for a solar system body as observed\n    from a location on Earth in the `~astropy.coordinates.GCRS` reference\n    system.\n\n    Parameters\n    ----------\n    body : str or list of tuple\n        The solar system body for which to calculate positions.  Can also be a\n        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL\n        kernel.\n    time : `~astropy.time.Time`\n        Time of observation.\n    location : `~astropy.coordinates.EarthLocation`, optional\n        Location of observer on the Earth.  If not given, will be taken from\n        ``time`` (if not present, a geocentric observer will be assumed).\n    ephemeris : str, optional\n        Ephemeris to use.  If not given, use the one set with\n        ``astropy.coordinates.solar_system_ephemeris.set`` (which is\n        set to 'builtin' by default).\n\n    Returns\n    -------\n    skycoord : `~astropy.coordinates.SkyCoord`\n        GCRS Coordinate for the body\n\n    Notes\n    -----\n    The coordinate returned is the apparent position, which is the position of\n    the body at time *t* minus the light travel time from the *body* to the\n    observing *location*.\n\n    {_EPHEMERIS_NOTE}\n    \"\"\"\n    if location is None:\n        location = time.location\n\n    if location is not None:\n        obsgeoloc, obsgeovel = location.get_gcrs_posvel(time)\n    else:\n        obsgeoloc, obsgeovel = None, None\n\n    cartrep = _get_apparent_body_position(body, time, ephemeris, obsgeoloc)\n    icrs = ICRS(cartrep)\n    gcrs = icrs.transform_to(GCRS(obstime=time,\n                                  obsgeoloc=obsgeoloc,\n                                  obsgeovel=obsgeovel))\n\n    return SkyCoord(gcrs)\n\n\ndef get_moon(time, location=None, ephemeris=None):\n    \"\"\"\n    Get a `~astropy.coordinates.SkyCoord` for the Earth's Moon as observed\n    from a location on Earth in the `~astropy.coordinates.GCRS` reference\n    system.\n\n    Parameters\n    ----------\n    time : `~astropy.time.Time`\n        Time of observation\n    location : `~astropy.coordinates.EarthLocation`\n        Location of observer on the Earth. If none is supplied, taken from\n        ``time`` (if not present, a geocentric observer will be assumed).\n    ephemeris : str, optional\n        Ephemeris to use.  If not given, use the one set with\n        ``astropy.coordinates.solar_system_ephemeris.set`` (which is\n        set to 'builtin' by default).\n\n    Returns\n    -------\n    skycoord : `~astropy.coordinates.SkyCoord`\n        GCRS Coordinate for the Moon\n\n    Notes\n    -----\n    The coordinate returned is the apparent position, which is the position of\n    the moon at time *t* minus the light travel time from the moon to the\n    observing *location*.\n\n    {_EPHEMERIS_NOTE}\n    \"\"\"\n\n    return get_body('moon', time, location=location, ephemeris=ephemeris)\n\n\n# Add note about the ephemeris choices to the docstrings of relevant functions.\n# Note: sadly, one cannot use f-strings for docstrings, so we format explicitly.\nfor f in [f for f in locals().values() if callable(f) and f.__doc__ is not None\n          and '{_EPHEMERIS_NOTE}' in f.__doc__]:\n    f.__doc__ = f.__doc__.format(_EPHEMERIS_NOTE=indent(_EPHEMERIS_NOTE)[4:])\n\n\ndeprecation_msg = \"\"\"\nThe use of _apparent_position_in_true_coordinates is deprecated because\nastropy now implements a True Equator True Equinox Frame (TETE), which\nshould be used instead.\n\"\"\"\n\n\n@deprecated('4.2', deprecation_msg)\ndef _apparent_position_in_true_coordinates(skycoord):\n    \"\"\"\n    Convert Skycoord in GCRS frame into one in which RA and Dec\n    are defined w.r.t to the true equinox and poles of the Earth\n    \"\"\"\n    location = getattr(skycoord, 'location', None)\n    if location is None:\n        gcrs_rep = skycoord.obsgeoloc.with_differentials(\n            {'s': CartesianDifferential.from_cartesian(skycoord.obsgeovel)})\n        location = (GCRS(gcrs_rep, obstime=skycoord.obstime)\n                    .transform_to(ITRS(obstime=skycoord.obstime))\n                    .earth_location)\n    tete_frame = TETE(obstime=skycoord.obstime, location=location)\n    return skycoord.transform_to(tete_frame)\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":2801,"id":15131,"name":"wp","nodeType":"Attribute","startLoc":2801,"text":"self.wp"},{"className":"CartesianDifferential","col":0,"comment":"Differentials in of points in 3D cartesian coordinates.\n\n    Parameters\n    ----------\n    d_x, d_y, d_z : `~astropy.units.Quantity` or array\n        The x, y, and z coordinates of the differentials. If ``d_x``, ``d_y``,\n        and ``d_z`` have different shapes, they should be broadcastable. If not\n        quantities, ``unit`` should be set.  If only ``d_x`` is given, it is\n        assumed that it contains an array with the 3 coordinates stored along\n        ``xyz_axis``.\n    unit : `~astropy.units.Unit` or str\n        If given, the differentials will be converted to this unit (or taken to\n        be in this unit if not given.\n    xyz_axis : int, optional\n        The axis along which the coordinates are stored when a single array is\n        provided instead of distinct ``d_x``, ``d_y``, and ``d_z`` (default: 0).\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    ","endLoc":2855,"id":15132,"nodeType":"Class","startLoc":2738,"text":"class CartesianDifferential(BaseDifferential):\n    \"\"\"Differentials in of points in 3D cartesian coordinates.\n\n    Parameters\n    ----------\n    d_x, d_y, d_z : `~astropy.units.Quantity` or array\n        The x, y, and z coordinates of the differentials. If ``d_x``, ``d_y``,\n        and ``d_z`` have different shapes, they should be broadcastable. If not\n        quantities, ``unit`` should be set.  If only ``d_x`` is given, it is\n        assumed that it contains an array with the 3 coordinates stored along\n        ``xyz_axis``.\n    unit : `~astropy.units.Unit` or str\n        If given, the differentials will be converted to this unit (or taken to\n        be in this unit if not given.\n    xyz_axis : int, optional\n        The axis along which the coordinates are stored when a single array is\n        provided instead of distinct ``d_x``, ``d_y``, and ``d_z`` (default: 0).\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n    base_representation = CartesianRepresentation\n    _d_xyz = None\n\n    def __init__(self, d_x, d_y=None, d_z=None, unit=None, xyz_axis=None,\n                 copy=True):\n\n        if d_y is None and d_z is None:\n            if isinstance(d_x, np.ndarray) and d_x.dtype.kind not in 'OV':\n                # Short-cut for 3-D array input.\n                d_x = u.Quantity(d_x, unit, copy=copy, subok=True)\n                # Keep a link to the array with all three coordinates\n                # so that we can return it quickly if needed in get_xyz.\n                self._d_xyz = d_x\n                if xyz_axis:\n                    d_x = np.moveaxis(d_x, xyz_axis, 0)\n                    self._xyz_axis = xyz_axis\n                else:\n                    self._xyz_axis = 0\n\n                self._d_x, self._d_y, self._d_z = d_x\n                return\n\n            else:\n                d_x, d_y, d_z = d_x\n\n        if xyz_axis is not None:\n            raise ValueError(\"xyz_axis should only be set if d_x, d_y, and d_z \"\n                             \"are in a single array passed in through d_x, \"\n                             \"i.e., d_y and d_z should not be not given.\")\n\n        if d_y is None or d_z is None:\n            raise ValueError(\"d_x, d_y, and d_z are required to instantiate {}\"\n                             .format(self.__class__.__name__))\n\n        if unit is not None:\n            d_x = u.Quantity(d_x, unit, copy=copy, subok=True)\n            d_y = u.Quantity(d_y, unit, copy=copy, subok=True)\n            d_z = u.Quantity(d_z, unit, copy=copy, subok=True)\n            copy = False\n\n        super().__init__(d_x, d_y, d_z, copy=copy)\n        if not (self._d_x.unit.is_equivalent(self._d_y.unit) and\n                self._d_x.unit.is_equivalent(self._d_z.unit)):\n            raise u.UnitsError('d_x, d_y and d_z should have equivalent units.')\n\n    def to_cartesian(self, base=None):\n        return CartesianRepresentation(*[getattr(self, c) for c\n                                         in self.components])\n\n    @classmethod\n    def from_cartesian(cls, other, base=None):\n        return cls(*[getattr(other, c) for c in other.components])\n\n    def transform(self, matrix, base=None, transformed_base=None):\n        \"\"\"Transform differentials using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new differential and does not modify the original one.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n        base, transformed_base : `~astropy.coordinates.CartesianRepresentation` or None, optional\n            Not used in the Cartesian transformation.\n        \"\"\"\n        # erfa rxp: Multiply a p-vector by an r-matrix.\n        p = erfa_ufunc.rxp(matrix, self.get_d_xyz(xyz_axis=-1))\n\n        return self.__class__(p, xyz_axis=-1, copy=False)\n\n    def get_d_xyz(self, xyz_axis=0):\n        \"\"\"Return a vector array of the x, y, and z coordinates.\n\n        Parameters\n        ----------\n        xyz_axis : int, optional\n            The axis in the final array along which the x, y, z components\n            should be stored (default: 0).\n\n        Returns\n        -------\n        d_xyz : `~astropy.units.Quantity`\n            With dimension 3 along ``xyz_axis``.  Note that, if possible,\n            this will be a view.\n        \"\"\"\n        if self._d_xyz is not None:\n            if self._xyz_axis == xyz_axis:\n                return self._d_xyz\n            else:\n                return np.moveaxis(self._d_xyz, self._xyz_axis, xyz_axis)\n\n        # Create combined array.  TO DO: keep it in _d_xyz for repeated use?\n        # But then in-place changes have to cancel it. Likely best to\n        # also update components.\n        return np.stack([self._d_x, self._d_y, self._d_z], axis=xyz_axis)\n\n    d_xyz = property(get_d_xyz)"},{"col":4,"comment":"null","endLoc":2806,"header":"def to_cartesian(self, base=None)","id":15133,"name":"to_cartesian","nodeType":"Function","startLoc":2804,"text":"def to_cartesian(self, base=None):\n        return CartesianRepresentation(*[getattr(self, c) for c\n                                         in self.components])"},{"col":0,"comment":"\n    Converts spherical polar coordinates to rectangular cartesian\n    coordinates.\n\n    Note that the input angles should be in latitude/longitude or\n    elevation/azimuthal form.  I.e., the origin is along the equator\n    rather than at the north pole.\n\n    .. note::\n        This is a low-level function used internally in\n        `astropy.coordinates`.  It is provided for users if they really\n        want to use it, but it is recommended that you use the\n        `astropy.coordinates` coordinate systems.\n\n    Parameters\n    ----------\n    r : scalar, array-like, or `~astropy.units.Quantity`\n        The radial coordinate (in the same units as the inputs).\n    lat : scalar, array-like, or `~astropy.units.Quantity` ['angle']\n        The latitude (in radians if array or scalar)\n    lon : scalar, array-like, or `~astropy.units.Quantity` ['angle']\n        The longitude (in radians if array or scalar)\n\n    Returns\n    -------\n    x : float or array\n        The first cartesian coordinate.\n    y : float or array\n        The second cartesian coordinate.\n    z : float or array\n        The third cartesian coordinate.\n\n\n    ","endLoc":123,"header":"def spherical_to_cartesian(r, lat, lon)","id":15134,"name":"spherical_to_cartesian","nodeType":"Function","startLoc":78,"text":"def spherical_to_cartesian(r, lat, lon):\n    \"\"\"\n    Converts spherical polar coordinates to rectangular cartesian\n    coordinates.\n\n    Note that the input angles should be in latitude/longitude or\n    elevation/azimuthal form.  I.e., the origin is along the equator\n    rather than at the north pole.\n\n    .. note::\n        This is a low-level function used internally in\n        `astropy.coordinates`.  It is provided for users if they really\n        want to use it, but it is recommended that you use the\n        `astropy.coordinates` coordinate systems.\n\n    Parameters\n    ----------\n    r : scalar, array-like, or `~astropy.units.Quantity`\n        The radial coordinate (in the same units as the inputs).\n    lat : scalar, array-like, or `~astropy.units.Quantity` ['angle']\n        The latitude (in radians if array or scalar)\n    lon : scalar, array-like, or `~astropy.units.Quantity` ['angle']\n        The longitude (in radians if array or scalar)\n\n    Returns\n    -------\n    x : float or array\n        The first cartesian coordinate.\n    y : float or array\n        The second cartesian coordinate.\n    z : float or array\n        The third cartesian coordinate.\n\n\n    \"\"\"\n    if not hasattr(r, 'unit'):\n        r = r * u.dimensionless_unscaled\n    if not hasattr(lat, 'unit'):\n        lat = lat * u.radian\n    if not hasattr(lon, 'unit'):\n        lon = lon * u.radian\n\n    sph = SphericalRepresentation(distance=r, lat=lat, lon=lon)\n    cart = sph.represent_as(CartesianRepresentation)\n\n    return cart.x, cart.y, cart.z"},{"col":4,"comment":"null","endLoc":3200,"header":"@classmethod\n    def from_cartesian(cls, other, base)","id":15135,"name":"from_cartesian","nodeType":"Function","startLoc":3195,"text":"@classmethod\n    def from_cartesian(cls, other, base):\n        # Go via the dimensional equivalent, so that the longitude and latitude\n        # differentials correctly take into account the norm of the base.\n        dimensional = cls._dimensional_differential.from_cartesian(other, base)\n        return dimensional.represent_as(cls)"},{"col":4,"comment":"\n        Converts this transform graph into a networkx graph.\n\n        .. note::\n            You must have the `networkx <https://networkx.github.io/>`_\n            package installed for this to work.\n\n        Returns\n        -------\n        nxgraph : ``networkx.Graph``\n            This `TransformGraph` as a `networkx.Graph <https://networkx.github.io/documentation/stable/reference/classes/graph.html>`_.\n        ","endLoc":609,"header":"def to_networkx_graph(self)","id":15136,"name":"to_networkx_graph","nodeType":"Function","startLoc":575,"text":"def to_networkx_graph(self):\n        \"\"\"\n        Converts this transform graph into a networkx graph.\n\n        .. note::\n            You must have the `networkx <https://networkx.github.io/>`_\n            package installed for this to work.\n\n        Returns\n        -------\n        nxgraph : ``networkx.Graph``\n            This `TransformGraph` as a `networkx.Graph <https://networkx.github.io/documentation/stable/reference/classes/graph.html>`_.\n        \"\"\"\n        import networkx as nx\n\n        nxgraph = nx.Graph()\n\n        # first make the nodes\n        for a in self._graph:\n            if a not in nxgraph:\n                nxgraph.add_node(a)\n            for b in self._graph[a]:\n                if b not in nxgraph:\n                    nxgraph.add_node(b)\n\n        # Now the edges\n        for a in self._graph:\n            agraph = self._graph[a]\n            for b in agraph:\n                transform = agraph[b]\n                pri = transform.priority if hasattr(transform, 'priority') else 1\n                color = trans_to_color[transform.__class__]\n                nxgraph.add_edge(a, b, weight=pri, color=color)\n\n        return nxgraph"},{"col":4,"comment":"\n        A function decorator for defining transformations.\n\n        .. note::\n            If decorating a static method of a class, ``@staticmethod``\n            should be  added *above* this decorator.\n\n        Parameters\n        ----------\n        transcls : class\n            The class of the transformation object to create.\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform into.\n        priority : float or int\n            The priority if this transform when finding the shortest\n            coordinate transform path - large numbers are lower priorities.\n\n        Additional keyword arguments are passed into the ``transcls``\n        constructor.\n\n        Returns\n        -------\n        deco : function\n            A function that can be called on another function as a decorator\n            (see example).\n\n        Notes\n        -----\n        This decorator assumes the first argument of the ``transcls``\n        initializer accepts a callable, and that the second and third\n        are ``fromsys`` and ``tosys``. If this is not true, you should just\n        initialize the class manually and use `add_transform` instead of\n        using this decorator.\n\n        Examples\n        --------\n\n        ::\n\n            graph = TransformGraph()\n\n            class Frame1(BaseCoordinateFrame):\n               ...\n\n            class Frame2(BaseCoordinateFrame):\n                ...\n\n            @graph.transform(FunctionTransform, Frame1, Frame2)\n            def f1_to_f2(f1_obj):\n                ... do something with f1_obj ...\n                return f2_obj\n\n\n        ","endLoc":675,"header":"def transform(self, transcls, fromsys, tosys, priority=1, **kwargs)","id":15137,"name":"transform","nodeType":"Function","startLoc":611,"text":"def transform(self, transcls, fromsys, tosys, priority=1, **kwargs):\n        \"\"\"\n        A function decorator for defining transformations.\n\n        .. note::\n            If decorating a static method of a class, ``@staticmethod``\n            should be  added *above* this decorator.\n\n        Parameters\n        ----------\n        transcls : class\n            The class of the transformation object to create.\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform into.\n        priority : float or int\n            The priority if this transform when finding the shortest\n            coordinate transform path - large numbers are lower priorities.\n\n        Additional keyword arguments are passed into the ``transcls``\n        constructor.\n\n        Returns\n        -------\n        deco : function\n            A function that can be called on another function as a decorator\n            (see example).\n\n        Notes\n        -----\n        This decorator assumes the first argument of the ``transcls``\n        initializer accepts a callable, and that the second and third\n        are ``fromsys`` and ``tosys``. If this is not true, you should just\n        initialize the class manually and use `add_transform` instead of\n        using this decorator.\n\n        Examples\n        --------\n\n        ::\n\n            graph = TransformGraph()\n\n            class Frame1(BaseCoordinateFrame):\n               ...\n\n            class Frame2(BaseCoordinateFrame):\n                ...\n\n            @graph.transform(FunctionTransform, Frame1, Frame2)\n            def f1_to_f2(f1_obj):\n                ... do something with f1_obj ...\n                return f2_obj\n\n\n        \"\"\"\n        def deco(func):\n            # this doesn't do anything directly with the transform because\n            # ``register_graph=self`` stores it in the transform graph\n            # automatically\n            transcls(func, fromsys, tosys, priority=priority,\n                     register_graph=self, **kwargs)\n            return func\n        return deco"},{"col":4,"comment":"Transform differentials using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new differential and does not modify the original one.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n        base, transformed_base : `~astropy.coordinates.CartesianRepresentation` or None, optional\n            Not used in the Cartesian transformation.\n        ","endLoc":2827,"header":"def transform(self, matrix, base=None, transformed_base=None)","id":15138,"name":"transform","nodeType":"Function","startLoc":2812,"text":"def transform(self, matrix, base=None, transformed_base=None):\n        \"\"\"Transform differentials using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new differential and does not modify the original one.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n        base, transformed_base : `~astropy.coordinates.CartesianRepresentation` or None, optional\n            Not used in the Cartesian transformation.\n        \"\"\"\n        # erfa rxp: Multiply a p-vector by an r-matrix.\n        p = erfa_ufunc.rxp(matrix, self.get_d_xyz(xyz_axis=-1))\n\n        return self.__class__(p, xyz_axis=-1, copy=False)"},{"col":4,"comment":"Transform the unit-spherical coordinates using a 3x3 matrix.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 matrix, such as a rotation matrix (or a stack of matrices).\n\n        Returns\n        -------\n        `UnitSphericalRepresentation` or `SphericalRepresentation`\n            If ``matrix`` is O(3) -- :math:`M \\dot M^T = I` -- like a rotation,\n            then the result is a `UnitSphericalRepresentation`.\n            All other matrices will change the distance, so the dimensional\n            representation is used instead.\n\n        ","endLoc":1668,"header":"def transform(self, matrix)","id":15139,"name":"transform","nodeType":"Function","startLoc":1628,"text":"def transform(self, matrix):\n        r\"\"\"Transform the unit-spherical coordinates using a 3x3 matrix.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 matrix, such as a rotation matrix (or a stack of matrices).\n\n        Returns\n        -------\n        `UnitSphericalRepresentation` or `SphericalRepresentation`\n            If ``matrix`` is O(3) -- :math:`M \\dot M^T = I` -- like a rotation,\n            then the result is a `UnitSphericalRepresentation`.\n            All other matrices will change the distance, so the dimensional\n            representation is used instead.\n\n        \"\"\"\n        # the transformation matrix does not need to be a rotation matrix,\n        # so the unit-distance is not guaranteed. For speed, we check if the\n        # matrix is in O(3) and preserves lengths.\n        if np.all(is_O3(matrix)):  # remain in unit-rep\n            xyz = erfa_ufunc.s2c(self.lon, self.lat)\n            p = erfa_ufunc.rxp(matrix, xyz)\n            lon, lat = erfa_ufunc.c2s(p)\n            rep = self.__class__(lon=lon, lat=lat)\n            # handle differentials\n            new_diffs = dict((k, d.transform(matrix, self, rep))\n                             for k, d in self.differentials.items())\n            rep = rep.with_differentials(new_diffs)\n\n        else:  # switch to dimensional representation\n            rep = self._dimensional_representation(\n                lon=self.lon, lat=self.lat, distance=1,\n                differentials=self.differentials\n            ).transform(matrix)\n\n        return rep"},{"col":4,"comment":"Return a vector array of the x, y, and z coordinates.\n\n        Parameters\n        ----------\n        xyz_axis : int, optional\n            The axis in the final array along which the x, y, z components\n            should be stored (default: 0).\n\n        Returns\n        -------\n        d_xyz : `~astropy.units.Quantity`\n            With dimension 3 along ``xyz_axis``.  Note that, if possible,\n            this will be a view.\n        ","endLoc":2853,"header":"def get_d_xyz(self, xyz_axis=0)","id":15140,"name":"get_d_xyz","nodeType":"Function","startLoc":2829,"text":"def get_d_xyz(self, xyz_axis=0):\n        \"\"\"Return a vector array of the x, y, and z coordinates.\n\n        Parameters\n        ----------\n        xyz_axis : int, optional\n            The axis in the final array along which the x, y, z components\n            should be stored (default: 0).\n\n        Returns\n        -------\n        d_xyz : `~astropy.units.Quantity`\n            With dimension 3 along ``xyz_axis``.  Note that, if possible,\n            this will be a view.\n        \"\"\"\n        if self._d_xyz is not None:\n            if self._xyz_axis == xyz_axis:\n                return self._d_xyz\n            else:\n                return np.moveaxis(self._d_xyz, self._xyz_axis, xyz_axis)\n\n        # Create combined array.  TO DO: keep it in _d_xyz for repeated use?\n        # But then in-place changes have to cancel it. Likely best to\n        # also update components.\n        return np.stack([self._d_x, self._d_y, self._d_z], axis=xyz_axis)"},{"attributeType":"null","col":4,"comment":"null","endLoc":2759,"id":15141,"name":"base_representation","nodeType":"Attribute","startLoc":2759,"text":"base_representation"},{"col":4,"comment":"\n        Add a single-step transform that encapsulates a multi-step transformation path,\n        using the transforms that already exist in the graph.\n\n        The created transform internally calls the existing transforms.  If all of the\n        transforms are affine, the merged transform is\n        `~astropy.coordinates.transformations.DynamicMatrixTransform` (if there are no\n        origin shifts) or `~astropy.coordinates.transformations.AffineTransform`\n        (otherwise).  If at least one of the transforms is not affine, the merged\n        transform is\n        `~astropy.coordinates.transformations.FunctionTransformWithFiniteDifference`.\n\n        This method is primarily useful for defining loopback transformations\n        (i.e., where ``fromsys`` and the final ``tosys`` are the same).\n\n        Parameters\n        ----------\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform to.\n        furthersys : class\n            Additional coordinate frame classes to transform to in order.\n        priority : number\n            The priority of this transform when finding the shortest\n            coordinate transform path - large numbers are lower priorities.\n\n        Notes\n        -----\n        Even though the created transform is a single step in the graph, it\n        will still internally call the constituent transforms.  Thus, there is\n        no performance benefit for using this created transform.\n\n        For Astropy's built-in frames, loopback transformations typically use\n        `~astropy.coordinates.ICRS` to be safe.  Tranforming through an inertial\n        frame ensures that changes in observation time and observer\n        location/velocity are properly accounted for.\n\n        An error will be raised if a direct transform between ``fromsys`` and\n        ``tosys`` already exist.\n        ","endLoc":731,"header":"def _add_merged_transform(self, fromsys, tosys, *furthersys, priority=1)","id":15142,"name":"_add_merged_transform","nodeType":"Function","startLoc":677,"text":"def _add_merged_transform(self, fromsys, tosys, *furthersys, priority=1):\n        \"\"\"\n        Add a single-step transform that encapsulates a multi-step transformation path,\n        using the transforms that already exist in the graph.\n\n        The created transform internally calls the existing transforms.  If all of the\n        transforms are affine, the merged transform is\n        `~astropy.coordinates.transformations.DynamicMatrixTransform` (if there are no\n        origin shifts) or `~astropy.coordinates.transformations.AffineTransform`\n        (otherwise).  If at least one of the transforms is not affine, the merged\n        transform is\n        `~astropy.coordinates.transformations.FunctionTransformWithFiniteDifference`.\n\n        This method is primarily useful for defining loopback transformations\n        (i.e., where ``fromsys`` and the final ``tosys`` are the same).\n\n        Parameters\n        ----------\n        fromsys : class\n            The coordinate frame class to start from.\n        tosys : class\n            The coordinate frame class to transform to.\n        furthersys : class\n            Additional coordinate frame classes to transform to in order.\n        priority : number\n            The priority of this transform when finding the shortest\n            coordinate transform path - large numbers are lower priorities.\n\n        Notes\n        -----\n        Even though the created transform is a single step in the graph, it\n        will still internally call the constituent transforms.  Thus, there is\n        no performance benefit for using this created transform.\n\n        For Astropy's built-in frames, loopback transformations typically use\n        `~astropy.coordinates.ICRS` to be safe.  Tranforming through an inertial\n        frame ensures that changes in observation time and observer\n        location/velocity are properly accounted for.\n\n        An error will be raised if a direct transform between ``fromsys`` and\n        ``tosys`` already exist.\n        \"\"\"\n        frames = [fromsys, tosys, *furthersys]\n        lastsys = frames[-1]\n        full_path = self.get_transform(fromsys, lastsys)\n        transforms = [self.get_transform(frame_a, frame_b)\n                      for frame_a, frame_b in zip(frames[:-1], frames[1:])]\n        if None in transforms:\n            raise ValueError(f\"This transformation path is not possible\")\n        if len(full_path.transforms) == 1:\n            raise ValueError(f\"A direct transform for {fromsys.__name__}->{lastsys.__name__} already exists\")\n\n        self.add_transform(fromsys, lastsys,\n                           CompositeTransform(transforms, fromsys, lastsys,\n                                              priority=priority)._as_single_transform())"},{"attributeType":"null","col":4,"comment":"null","endLoc":2760,"id":15143,"name":"_d_xyz","nodeType":"Attribute","startLoc":2760,"text":"_d_xyz"},{"attributeType":"null","col":4,"comment":"null","endLoc":2855,"id":15144,"name":"d_xyz","nodeType":"Attribute","startLoc":2855,"text":"d_xyz"},{"col":4,"comment":"null","endLoc":3211,"header":"def to_cartesian(self, base)","id":15145,"name":"to_cartesian","nodeType":"Function","startLoc":3202,"text":"def to_cartesian(self, base):\n        if isinstance(base, SphericalRepresentation):\n            scale = base.distance\n        elif isinstance(base, PhysicsSphericalRepresentation):\n            scale = base.r\n        else:\n            return super().to_cartesian(base)\n\n        base = base.represent_as(UnitSphericalRepresentation)\n        return scale * super().to_cartesian(base)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2802,"id":15146,"name":"wa","nodeType":"Attribute","startLoc":2802,"text":"self.wa"},{"attributeType":"null","col":16,"comment":"null","endLoc":2778,"id":15147,"name":"_d_x","nodeType":"Attribute","startLoc":2778,"text":"self._d_x"},{"col":4,"comment":"null","endLoc":3218,"header":"def represent_as(self, other_class, base=None)","id":15148,"name":"represent_as","nodeType":"Function","startLoc":3213,"text":"def represent_as(self, other_class, base=None):\n        # Only have enough information to represent other unit-spherical.\n        if issubclass(other_class, UnitSphericalDifferential):\n            return other_class(self._d_lon(base), self.d_lat)\n\n        return super().represent_as(other_class, base)"},{"attributeType":"null","col":27,"comment":"null","endLoc":2778,"id":15149,"name":"_d_y","nodeType":"Attribute","startLoc":2778,"text":"self._d_y"},{"className":"w0wzCDM","col":0,"comment":"\n    FLRW cosmology with a variable dark energy equation of state and curvature.\n\n    The equation for the dark energy equation of state uses the simple form:\n    :math:`w(z) = w_0 + w_z z`.\n\n    This form is not recommended for z > 1.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Ode0 : float\n        Omega dark energy: density of dark energy in units of the critical\n        density at z=0.\n\n    w0 : float, optional\n        Dark energy equation of state at z=0. This is pressure/density for\n        dark energy in units where c=1.\n\n    wz : float, optional\n        Derivative of the dark energy equation of state with respect to z.\n        A cosmological constant has w0=-1.0 and wz=0.0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import w0wzCDM\n    >>> cosmo = w0wzCDM(H0=70, Om0=0.3, Ode0=0.7, w0=-0.9, wz=0.2)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n    ","endLoc":3030,"id":15150,"nodeType":"Class","startLoc":2883,"text":"class w0wzCDM(FLRW):\n    \"\"\"\n    FLRW cosmology with a variable dark energy equation of state and curvature.\n\n    The equation for the dark energy equation of state uses the simple form:\n    :math:`w(z) = w_0 + w_z z`.\n\n    This form is not recommended for z > 1.\n\n    Parameters\n    ----------\n    H0 : float or scalar quantity-like ['frequency']\n        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].\n\n    Om0 : float\n        Omega matter: density of non-relativistic matter in units of the\n        critical density at z=0.\n\n    Ode0 : float\n        Omega dark energy: density of dark energy in units of the critical\n        density at z=0.\n\n    w0 : float, optional\n        Dark energy equation of state at z=0. This is pressure/density for\n        dark energy in units where c=1.\n\n    wz : float, optional\n        Derivative of the dark energy equation of state with respect to z.\n        A cosmological constant has w0=-1.0 and wz=0.0.\n\n    Tcmb0 : float or scalar quantity-like ['temperature'], optional\n        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].\n        Setting this to zero will turn off both photons and neutrinos\n        (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : quantity-like ['energy', 'mass'] or array-like, optional\n        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).\n        If this is a scalar Quantity, then all neutrino species are assumed to\n        have that mass. Otherwise, the mass of each species. The actual number\n        of neutrino species (and hence the number of elements of m_nu if it is\n        not scalar) must be the floor of Neff. Typically this means you should\n        provide three neutrino masses unless you are considering something like\n        a sterile neutrino.\n\n    Ob0 : float or None, optional\n        Omega baryons: density of baryonic matter in units of the critical\n        density at z=0.  If this is set to None (the default), any computation\n        that requires its value will raise an exception.\n\n    name : str or None (optional, keyword-only)\n        Name for this cosmological object.\n\n    meta : mapping or None (optional, keyword-only)\n        Metadata for the cosmology, e.g., a reference.\n\n    Examples\n    --------\n    >>> from astropy.cosmology import w0wzCDM\n    >>> cosmo = w0wzCDM(H0=70, Om0=0.3, Ode0=0.7, w0=-0.9, wz=0.2)\n\n    The comoving distance in Mpc at redshift z:\n\n    >>> z = 0.5\n    >>> dc = cosmo.comoving_distance(z)\n    \"\"\"\n\n    w0 = Parameter(doc=\"Dark energy equation of state at z=0.\", fvalidate=\"float\")\n    wz = Parameter(doc=\"Derivative of the dark energy equation of state w.r.t. z.\", fvalidate=\"float\")\n\n    def __init__(self, H0, Om0, Ode0, w0=-1.0, wz=0.0, Tcmb0=0.0*u.K, Neff=3.04,\n                 m_nu=0.0*u.eV, Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=Ode0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n        self.w0 = w0\n        self.wz = wz\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wzcdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._w0, self._wz)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wzcdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._w0, self._wz)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wzcdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._w0,\n                                           self._wz)\n\n    def w(self, z):\n        r\"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is given by :math:`w(z) = w_0 + w_z z`.\n        \"\"\"\n        return self._w0 + self._wz * aszarr(z)\n\n    def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by\n\n        .. math::\n\n           I = \\left(1 + z\\right)^{3 \\left(1 + w_0 - w_z\\right)}\n                     \\exp \\left(-3 w_z z\\right)\n        \"\"\"\n        z = aszarr(z)\n        zp1 = z + 1.0  # (converts z [unit] -> z [dimensionless])\n        return zp1 ** (3. * (1. + self._w0 - self._wz)) * np.exp(-3. * self._wz * z)"},{"col":4,"comment":"null","endLoc":2979,"header":"def __init__(self, H0, Om0, Ode0, w0=-1.0, wz=0.0, Tcmb0=0.0*u.K, Neff=3.04,\n                 m_nu=0.0*u.eV, Ob0=None, *, name=None, meta=None)","id":15151,"name":"__init__","nodeType":"Function","startLoc":2955,"text":"def __init__(self, H0, Om0, Ode0, w0=-1.0, wz=0.0, Tcmb0=0.0*u.K, Neff=3.04,\n                 m_nu=0.0*u.eV, Ob0=None, *, name=None, meta=None):\n        super().__init__(H0=H0, Om0=Om0, Ode0=Ode0, Tcmb0=Tcmb0, Neff=Neff,\n                         m_nu=m_nu, Ob0=Ob0, name=name, meta=meta)\n        self.w0 = w0\n        self.wz = wz\n\n        # Please see :ref:`astropy-cosmology-fast-integrals` for discussion\n        # about what is being done here.\n        if self._Tcmb0.value == 0:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wzcdm_inv_efunc_norel\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._w0, self._wz)\n        elif not self._massivenu:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wzcdm_inv_efunc_nomnu\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0 + self._Onu0,\n                                           self._w0, self._wz)\n        else:\n            self._inv_efunc_scalar = scalar_inv_efuncs.w0wzcdm_inv_efunc\n            self._inv_efunc_scalar_args = (self._Om0, self._Ode0, self._Ok0,\n                                           self._Ogamma0, self._neff_per_nu,\n                                           self._nmasslessnu,\n                                           self._nu_y_list, self._w0,\n                                           self._wz)"},{"attributeType":"null","col":16,"comment":"null","endLoc":2771,"id":15152,"name":"_d_xyz","nodeType":"Attribute","startLoc":2771,"text":"self._d_xyz"},{"attributeType":"null","col":20,"comment":"null","endLoc":2776,"id":15153,"name":"_xyz_axis","nodeType":"Attribute","startLoc":2776,"text":"self._xyz_axis"},{"col":4,"comment":"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is given by :math:`w(z) = w_0 + w_z z`.\n        ","endLoc":3002,"header":"def w(self, z)","id":15154,"name":"w","nodeType":"Function","startLoc":2981,"text":"def w(self, z):\n        r\"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        w : ndarray or float\n            The dark energy equation of state.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The dark energy equation of state is defined as\n        :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at\n        redshift z and :math:`\\rho(z)` is the density at redshift z, both in\n        units where c=1. Here this is given by :math:`w(z) = w_0 + w_z z`.\n        \"\"\"\n        return self._w0 + self._wz * aszarr(z)"},{"col":4,"comment":"null","endLoc":3234,"header":"@classmethod\n    def from_representation(cls, representation, base=None)","id":15155,"name":"from_representation","nodeType":"Function","startLoc":3220,"text":"@classmethod\n    def from_representation(cls, representation, base=None):\n        # All spherical differentials can be done without going to Cartesian,\n        # though w/o CosLat needs base for the latitude.\n        if isinstance(representation, SphericalCosLatDifferential):\n            return cls(representation.d_lon_coslat, representation.d_lat)\n        elif isinstance(representation, (SphericalDifferential,\n                                         UnitSphericalDifferential)):\n            d_lon_coslat = cls._get_d_lon_coslat(representation.d_lon, base)\n            return cls(d_lon_coslat, representation.d_lat)\n        elif isinstance(representation, PhysicsSphericalDifferential):\n            d_lon_coslat = cls._get_d_lon_coslat(representation.d_phi, base)\n            return cls(d_lon_coslat, -representation.d_theta)\n\n        return super().from_representation(representation, base)"},{"attributeType":"null","col":38,"comment":"null","endLoc":2778,"id":15156,"name":"_d_z","nodeType":"Attribute","startLoc":2778,"text":"self._d_z"},{"col":4,"comment":"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by\n\n        .. math::\n\n           I = \\left(1 + z\\right)^{3 \\left(1 + w_0 - w_z\\right)}\n                     \\exp \\left(-3 w_z z\\right)\n        ","endLoc":3030,"header":"def de_density_scale(self, z)","id":15157,"name":"de_density_scale","nodeType":"Function","startLoc":3004,"text":"def de_density_scale(self, z):\n        r\"\"\"Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`\n            Input redshift.\n\n        Returns\n        -------\n        I : ndarray or float\n            The scaling of the energy density of dark energy with redshift.\n            Returns `float` if the input is scalar.\n\n        Notes\n        -----\n        The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`,\n        and in this case is given by\n\n        .. math::\n\n           I = \\left(1 + z\\right)^{3 \\left(1 + w_0 - w_z\\right)}\n                     \\exp \\left(-3 w_z z\\right)\n        \"\"\"\n        z = aszarr(z)\n        zp1 = z + 1.0  # (converts z [unit] -> z [dimensionless])\n        return zp1 ** (3. * (1. + self._w0 - self._wz)) * np.exp(-3. * self._wz * z)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":2952,"id":15158,"name":"w0","nodeType":"Attribute","startLoc":2952,"text":"w0"},{"col":0,"comment":"\n    Determines the location of the sun at a given time (or times, if the input\n    is an array `~astropy.time.Time` object), in geocentric coordinates.\n\n    Parameters\n    ----------\n    time : `~astropy.time.Time`\n        The time(s) at which to compute the location of the sun.\n\n    Returns\n    -------\n    newsc : `~astropy.coordinates.SkyCoord`\n        The location of the sun as a `~astropy.coordinates.SkyCoord` in the\n        `~astropy.coordinates.GCRS` frame.\n\n\n    Notes\n    -----\n    The algorithm for determining the sun/earth relative position is based\n    on the simplified version of VSOP2000 that is part of ERFA. Compared to\n    JPL's ephemeris, it should be good to about 4 km (in the Sun-Earth\n    vector) from 1900-2100 C.E., 8 km for the 1800-2200 span, and perhaps\n    250 km over the 1000-3000.\n\n    ","endLoc":170,"header":"def get_sun(time)","id":15159,"name":"get_sun","nodeType":"Function","startLoc":126,"text":"def get_sun(time):\n    \"\"\"\n    Determines the location of the sun at a given time (or times, if the input\n    is an array `~astropy.time.Time` object), in geocentric coordinates.\n\n    Parameters\n    ----------\n    time : `~astropy.time.Time`\n        The time(s) at which to compute the location of the sun.\n\n    Returns\n    -------\n    newsc : `~astropy.coordinates.SkyCoord`\n        The location of the sun as a `~astropy.coordinates.SkyCoord` in the\n        `~astropy.coordinates.GCRS` frame.\n\n\n    Notes\n    -----\n    The algorithm for determining the sun/earth relative position is based\n    on the simplified version of VSOP2000 that is part of ERFA. Compared to\n    JPL's ephemeris, it should be good to about 4 km (in the Sun-Earth\n    vector) from 1900-2100 C.E., 8 km for the 1800-2200 span, and perhaps\n    250 km over the 1000-3000.\n\n    \"\"\"\n    earth_pv_helio, earth_pv_bary = erfa.epv00(*get_jd12(time, 'tdb'))\n\n    # We have to manually do aberration because we're outputting directly into\n    # GCRS\n    earth_p = earth_pv_helio['p']\n    earth_v = earth_pv_bary['v']\n\n    # convert barycentric velocity to units of c, but keep as array for passing in to erfa\n    earth_v /= c.to_value(u.au/u.d)\n\n    dsun = np.sqrt(np.sum(earth_p**2, axis=-1))\n    invlorentz = (1-np.sum(earth_v**2, axis=-1))**0.5\n    properdir = erfa.ab(earth_p/dsun.reshape(dsun.shape + (1,)),\n                        -earth_v, dsun, invlorentz)\n\n    cartrep = CartesianRepresentation(x=-dsun*properdir[..., 0] * u.AU,\n                                      y=-dsun*properdir[..., 1] * u.AU,\n                                      z=-dsun*properdir[..., 2] * u.AU)\n    return SkyCoord(cartrep, frame=GCRS(obstime=time))"},{"className":"TETE","col":0,"comment":"\n    An equatorial coordinate or frame using the True Equator and True Equinox (TETE).\n\n    Equatorial coordinate frames measure RA with respect to the equinox and declination\n    with with respect to the equator. The location of the equinox and equator vary due\n    the gravitational torques on the oblate Earth. This variation is split into precession\n    and nutation, although really they are two aspects of a single phenomena. The smooth,\n    long term variation is known as precession, whilst smaller, periodic components are\n    called nutation.\n\n    Calculation of the true equator and equinox involves the application of both precession\n    and nutation, whilst only applying precession gives a mean equator and equinox.\n\n    TETE coordinates are often referred to as \"apparent\" coordinates, or\n    \"apparent place\". TETE is the apparent coordinate system used by JPL Horizons\n    and is the correct coordinate system to use when combining the right ascension\n    with local apparent sidereal time to calculate the apparent (TIRS) hour angle.\n\n    For more background on TETE, see the references provided in the\n    :ref:`astropy:astropy-coordinates-seealso` section of the documentation.\n    Of particular note are Sections 5 and 6 of\n    `USNO Circular 179 <https://arxiv.org/abs/astro-ph/0602086>`_) and\n    especially the diagram at the top of page 57.\n\n    This frame also includes frames that are defined *relative* to the center of the Earth,\n    but that are offset (in both position and velocity) from the center of the Earth. You\n    may see such non-geocentric coordinates referred to as \"topocentric\".\n\n    The frame attributes are listed under **Other Parameters**.\n    ","endLoc":80,"id":15160,"nodeType":"Class","startLoc":46,"text":"@format_doc(base_doc, components=doc_components, footer=doc_footer_tete)\nclass TETE(BaseRADecFrame):\n    \"\"\"\n    An equatorial coordinate or frame using the True Equator and True Equinox (TETE).\n\n    Equatorial coordinate frames measure RA with respect to the equinox and declination\n    with with respect to the equator. The location of the equinox and equator vary due\n    the gravitational torques on the oblate Earth. This variation is split into precession\n    and nutation, although really they are two aspects of a single phenomena. The smooth,\n    long term variation is known as precession, whilst smaller, periodic components are\n    called nutation.\n\n    Calculation of the true equator and equinox involves the application of both precession\n    and nutation, whilst only applying precession gives a mean equator and equinox.\n\n    TETE coordinates are often referred to as \"apparent\" coordinates, or\n    \"apparent place\". TETE is the apparent coordinate system used by JPL Horizons\n    and is the correct coordinate system to use when combining the right ascension\n    with local apparent sidereal time to calculate the apparent (TIRS) hour angle.\n\n    For more background on TETE, see the references provided in the\n    :ref:`astropy:astropy-coordinates-seealso` section of the documentation.\n    Of particular note are Sections 5 and 6 of\n    `USNO Circular 179 <https://arxiv.org/abs/astro-ph/0602086>`_) and\n    especially the diagram at the top of page 57.\n\n    This frame also includes frames that are defined *relative* to the center of the Earth,\n    but that are offset (in both position and velocity) from the center of the Earth. You\n    may see such non-geocentric coordinates referred to as \"topocentric\".\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n    location = EarthLocationAttribute(default=EARTH_CENTER)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":2953,"id":15161,"name":"wz","nodeType":"Attribute","startLoc":2953,"text":"wz"},{"col":4,"comment":"null","endLoc":1673,"header":"def _scale_operation(self, op, *args)","id":15162,"name":"_scale_operation","nodeType":"Function","startLoc":1670,"text":"def _scale_operation(self, op, *args):\n        return self._dimensional_representation(\n            lon=self.lon, lat=self.lat, distance=1.,\n            differentials=self.differentials)._scale_operation(op, *args)"},{"attributeType":"null","col":4,"comment":"null","endLoc":79,"id":15163,"name":"obstime","nodeType":"Attribute","startLoc":79,"text":"obstime"},{"col":4,"comment":"null","endLoc":1686,"header":"def __neg__(self)","id":15164,"name":"__neg__","nodeType":"Function","startLoc":1675,"text":"def __neg__(self):\n        if any(differential.base_representation is not self.__class__\n               for differential in self.differentials.values()):\n            return super().__neg__()\n\n        result = self.__class__(self.lon + 180. * u.deg, -self.lat, copy=False)\n        for key, differential in self.differentials.items():\n            new_comps = (op(getattr(differential, comp))\n                         for op, comp in zip((operator.pos, operator.neg),\n                                             differential.components))\n            result.differentials[key] = differential.__class__(*new_comps, copy=False)\n        return result"},{"attributeType":"null","col":12,"comment":"null","endLoc":2974,"id":15165,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":2974,"text":"self._inv_efunc_scalar"},{"attributeType":"null","col":4,"comment":"null","endLoc":80,"id":15166,"name":"location","nodeType":"Attribute","startLoc":80,"text":"location"},{"col":4,"comment":"Transform differential using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new differential and does not modify the original one.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n        base : instance of ``cls.base_representation``\n            Base relative to which the differentials are defined.  If the other\n            class is a differential representation, the base will be converted\n            to its ``base_representation``.\n        transformed_base : instance of ``cls.base_representation``\n            Base relative to which the transformed differentials are defined.\n            If the other class is a differential representation, the base will\n            be converted to its ``base_representation``.\n        ","endLoc":3268,"header":"def transform(self, matrix, base, transformed_base)","id":15167,"name":"transform","nodeType":"Function","startLoc":3236,"text":"def transform(self, matrix, base, transformed_base):\n        \"\"\"Transform differential using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new differential and does not modify the original one.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n        base : instance of ``cls.base_representation``\n            Base relative to which the differentials are defined.  If the other\n            class is a differential representation, the base will be converted\n            to its ``base_representation``.\n        transformed_base : instance of ``cls.base_representation``\n            Base relative to which the transformed differentials are defined.\n            If the other class is a differential representation, the base will\n            be converted to its ``base_representation``.\n        \"\"\"\n        # the transformation matrix does not need to be a rotation matrix,\n        # so the unit-distance is not guaranteed. For speed, we check if the\n        # matrix is in O(3) and preserves lengths.\n        if np.all(is_O3(matrix)):  # remain in unit-rep\n            # TODO! implement without Cartesian intermediate step.\n            diff = super().transform(matrix, base, transformed_base)\n\n        else:  # switch to dimensional representation\n            du = self.d_lat.unit / base.lat.unit  # derivative unit\n            diff = self._dimensional_differential(\n                d_lon_coslat=self.d_lon_coslat, d_lat=self.d_lat,\n                d_distance=0 * du\n            ).transform(matrix, base, transformed_base)\n\n        return diff"},{"col":4,"comment":"null","endLoc":3274,"header":"def _scale_operation(self, op, *args, scaled_base=False)","id":15168,"name":"_scale_operation","nodeType":"Function","startLoc":3270,"text":"def _scale_operation(self, op, *args, scaled_base=False):\n        if scaled_base:\n            return self.copy()\n        else:\n            return super()._scale_operation(op, *args)"},{"className":"solar_system_ephemeris","col":0,"comment":"Default ephemerides for calculating positions of Solar-System bodies.\n\n    This can be one of the following::\n\n    - 'builtin': polynomial approximations to the orbital elements.\n    - 'de430', 'de432s', 'de440', 'de440s': short-cuts for recent JPL dynamical models.\n    - 'jpl': Alias for the default JPL ephemeris (currently, 'de430').\n    - URL: (str) The url to a SPK ephemeris in SPICE binary (.bsp) format.\n    - PATH: (str) File path to a SPK ephemeris in SPICE binary (.bsp) format.\n    - `None`: Ensure an Exception is raised without an explicit ephemeris.\n\n    The default is 'builtin', which uses the ``epv00`` and ``plan94``\n    routines from the ``erfa`` implementation of the Standards Of Fundamental\n    Astronomy library.\n\n    Notes\n    -----\n    Any file required will be downloaded (and cached) when the state is set.\n    The default Satellite Planet Kernel (SPK) file from NASA JPL (de430) is\n    ~120MB, and covers years ~1550-2650 CE [1]_.  The smaller de432s file is\n    ~10MB, and covers years 1950-2050 [2]_ (and similarly for the newer de440\n    and de440s).  Older versions of the JPL ephemerides (such as the widely\n    used de200) can be used via their URL [3]_.\n\n    .. [1] https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/aareadme_de430-de431.txt\n    .. [2] https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/aareadme_de432s.txt\n    .. [3] https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/a_old_versions/\n    ","endLoc":144,"id":15169,"nodeType":"Class","startLoc":77,"text":"class solar_system_ephemeris(ScienceState):\n    \"\"\"Default ephemerides for calculating positions of Solar-System bodies.\n\n    This can be one of the following::\n\n    - 'builtin': polynomial approximations to the orbital elements.\n    - 'de430', 'de432s', 'de440', 'de440s': short-cuts for recent JPL dynamical models.\n    - 'jpl': Alias for the default JPL ephemeris (currently, 'de430').\n    - URL: (str) The url to a SPK ephemeris in SPICE binary (.bsp) format.\n    - PATH: (str) File path to a SPK ephemeris in SPICE binary (.bsp) format.\n    - `None`: Ensure an Exception is raised without an explicit ephemeris.\n\n    The default is 'builtin', which uses the ``epv00`` and ``plan94``\n    routines from the ``erfa`` implementation of the Standards Of Fundamental\n    Astronomy library.\n\n    Notes\n    -----\n    Any file required will be downloaded (and cached) when the state is set.\n    The default Satellite Planet Kernel (SPK) file from NASA JPL (de430) is\n    ~120MB, and covers years ~1550-2650 CE [1]_.  The smaller de432s file is\n    ~10MB, and covers years 1950-2050 [2]_ (and similarly for the newer de440\n    and de440s).  Older versions of the JPL ephemerides (such as the widely\n    used de200) can be used via their URL [3]_.\n\n    .. [1] https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/aareadme_de430-de431.txt\n    .. [2] https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/aareadme_de432s.txt\n    .. [3] https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/a_old_versions/\n    \"\"\"\n    _value = 'builtin'\n    _kernel = None\n\n    @classmethod\n    def validate(cls, value):\n        # make no changes if value is None\n        if value is None:\n            return cls._value\n        # Set up Kernel; if the file is not in cache, this will download it.\n        cls.get_kernel(value)\n        return value\n\n    @classmethod\n    def get_kernel(cls, value):\n        # ScienceState only ensures the `_value` attribute is up to date,\n        # so we need to be sure any kernel returned is consistent.\n        if cls._kernel is None or cls._kernel.origin != value:\n            if cls._kernel is not None:\n                cls._kernel.daf.file.close()\n                cls._kernel = None\n            kernel = _get_kernel(value)\n            if kernel is not None:\n                kernel.origin = value\n            cls._kernel = kernel\n        return cls._kernel\n\n    @classproperty\n    def kernel(cls):\n        return cls.get_kernel(cls._value)\n\n    @classproperty\n    def bodies(cls):\n        if cls._value is None:\n            return None\n        if cls._value.lower() == 'builtin':\n            return (('earth', 'sun', 'moon') +\n                    tuple(PLAN94_BODY_NAME_TO_PLANET_INDEX.keys()))\n        else:\n            return tuple(BODY_NAME_TO_KERNEL_SPEC.keys())"},{"attributeType":"null","col":4,"comment":"null","endLoc":3181,"id":15170,"name":"base_representation","nodeType":"Attribute","startLoc":3181,"text":"base_representation"},{"attributeType":"null","col":4,"comment":"null","endLoc":3182,"id":15171,"name":"attr_classes","nodeType":"Attribute","startLoc":3182,"text":"attr_classes"},{"col":4,"comment":"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units, which is\n        always unity for vectors on the unit sphere.\n\n        Returns\n        -------\n        norm : `~astropy.units.Quantity` ['dimensionless']\n            Dimensionless ones, with the same shape as the representation.\n        ","endLoc":1701,"header":"def norm(self)","id":15172,"name":"norm","nodeType":"Function","startLoc":1688,"text":"def norm(self):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units, which is\n        always unity for vectors on the unit sphere.\n\n        Returns\n        -------\n        norm : `~astropy.units.Quantity` ['dimensionless']\n            Dimensionless ones, with the same shape as the representation.\n        \"\"\"\n        return u.Quantity(np.ones(self.shape), u.dimensionless_unscaled,\n                          copy=False)"},{"className":"UnitSphericalDifferential","col":0,"comment":"Differential(s) of points on a unit sphere.\n\n    Parameters\n    ----------\n    d_lon, d_lat : `~astropy.units.Quantity`\n        The longitude and latitude of the differentials.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    ","endLoc":3019,"id":15173,"nodeType":"Class","startLoc":2919,"text":"class UnitSphericalDifferential(BaseSphericalDifferential):\n    \"\"\"Differential(s) of points on a unit sphere.\n\n    Parameters\n    ----------\n    d_lon, d_lat : `~astropy.units.Quantity`\n        The longitude and latitude of the differentials.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n    base_representation = UnitSphericalRepresentation\n\n    @classproperty\n    def _dimensional_differential(cls):\n        return SphericalDifferential\n\n    def __init__(self, d_lon, d_lat=None, copy=True):\n        super().__init__(d_lon, d_lat, copy=copy)\n        if not self._d_lon.unit.is_equivalent(self._d_lat.unit):\n            raise u.UnitsError('d_lon and d_lat should have equivalent units.')\n\n    @classmethod\n    def from_cartesian(cls, other, base):\n        # Go via the dimensional equivalent, so that the longitude and latitude\n        # differentials correctly take into account the norm of the base.\n        dimensional = cls._dimensional_differential.from_cartesian(other, base)\n        return dimensional.represent_as(cls)\n\n    def to_cartesian(self, base):\n        if isinstance(base, SphericalRepresentation):\n            scale = base.distance\n        elif isinstance(base, PhysicsSphericalRepresentation):\n            scale = base.r\n        else:\n            return super().to_cartesian(base)\n\n        base = base.represent_as(UnitSphericalRepresentation)\n        return scale * super().to_cartesian(base)\n\n    def represent_as(self, other_class, base=None):\n        # Only have enough information to represent other unit-spherical.\n        if issubclass(other_class, UnitSphericalCosLatDifferential):\n            return other_class(self._d_lon_coslat(base), self.d_lat)\n\n        return super().represent_as(other_class, base)\n\n    @classmethod\n    def from_representation(cls, representation, base=None):\n        # All spherical differentials can be done without going to Cartesian,\n        # though CosLat needs base for the latitude.\n        if isinstance(representation, SphericalDifferential):\n            return cls(representation.d_lon, representation.d_lat)\n        elif isinstance(representation, (SphericalCosLatDifferential,\n                                         UnitSphericalCosLatDifferential)):\n            d_lon = cls._get_d_lon(representation.d_lon_coslat, base)\n            return cls(d_lon, representation.d_lat)\n        elif isinstance(representation, PhysicsSphericalDifferential):\n            return cls(representation.d_phi, -representation.d_theta)\n\n        return super().from_representation(representation, base)\n\n    def transform(self, matrix, base, transformed_base):\n        \"\"\"Transform differential using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new differential and does not modify the original one.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n        base : instance of ``cls.base_representation``\n            Base relative to which the differentials are defined.  If the other\n            class is a differential representation, the base will be converted\n            to its ``base_representation``.\n        transformed_base : instance of ``cls.base_representation``\n            Base relative to which the transformed differentials are defined.\n            If the other class is a differential representation, the base will\n            be converted to its ``base_representation``.\n        \"\"\"\n        # the transformation matrix does not need to be a rotation matrix,\n        # so the unit-distance is not guaranteed. For speed, we check if the\n        # matrix is in O(3) and preserves lengths.\n        if np.all(is_O3(matrix)):  # remain in unit-rep\n            # TODO! implement without Cartesian intermediate step.\n            # some of this can be moved to the parent class.\n            diff = super().transform(matrix, base, transformed_base)\n\n        else:  # switch to dimensional representation\n            du = self.d_lon.unit / base.lon.unit  # derivative unit\n            diff = self._dimensional_differential(\n                d_lon=self.d_lon, d_lat=self.d_lat, d_distance=0 * du\n            ).transform(matrix, base, transformed_base)\n\n        return diff\n\n    def _scale_operation(self, op, *args, scaled_base=False):\n        if scaled_base:\n            return self.copy()\n        else:\n            return super()._scale_operation(op, *args)"},{"col":4,"comment":"null","endLoc":116,"header":"@classmethod\n    def validate(cls, value)","id":15174,"name":"validate","nodeType":"Function","startLoc":109,"text":"@classmethod\n    def validate(cls, value):\n        # make no changes if value is None\n        if value is None:\n            return cls._value\n        # Set up Kernel; if the file is not in cache, this will download it.\n        cls.get_kernel(value)\n        return value"},{"col":4,"comment":"null","endLoc":2934,"header":"@classproperty\n    def _dimensional_differential(cls)","id":15175,"name":"_dimensional_differential","nodeType":"Function","startLoc":2932,"text":"@classproperty\n    def _dimensional_differential(cls):\n        return SphericalDifferential"},{"col":4,"comment":"null","endLoc":2939,"header":"def __init__(self, d_lon, d_lat=None, copy=True)","id":15176,"name":"__init__","nodeType":"Function","startLoc":2936,"text":"def __init__(self, d_lon, d_lat=None, copy=True):\n        super().__init__(d_lon, d_lat, copy=copy)\n        if not self._d_lon.unit.is_equivalent(self._d_lat.unit):\n            raise u.UnitsError('d_lon and d_lat should have equivalent units.')"},{"attributeType":"null","col":12,"comment":"null","endLoc":2975,"id":15177,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":2975,"text":"self._inv_efunc_scalar_args"},{"col":4,"comment":"null","endLoc":2946,"header":"@classmethod\n    def from_cartesian(cls, other, base)","id":15178,"name":"from_cartesian","nodeType":"Function","startLoc":2941,"text":"@classmethod\n    def from_cartesian(cls, other, base):\n        # Go via the dimensional equivalent, so that the longitude and latitude\n        # differentials correctly take into account the norm of the base.\n        dimensional = cls._dimensional_differential.from_cartesian(other, base)\n        return dimensional.represent_as(cls)"},{"col":4,"comment":"null","endLoc":2957,"header":"def to_cartesian(self, base)","id":15179,"name":"to_cartesian","nodeType":"Function","startLoc":2948,"text":"def to_cartesian(self, base):\n        if isinstance(base, SphericalRepresentation):\n            scale = base.distance\n        elif isinstance(base, PhysicsSphericalRepresentation):\n            scale = base.r\n        else:\n            return super().to_cartesian(base)\n\n        base = base.represent_as(UnitSphericalRepresentation)\n        return scale * super().to_cartesian(base)"},{"col":4,"comment":"\n        Return an encapsulated version of the composite transform so that it appears to\n        be a single transform.\n\n        The returned transform internally calls the constituent transforms.  If all of\n        the transforms are affine, the merged transform is\n        `~astropy.coordinates.transformations.DynamicMatrixTransform` (if there are no\n        origin shifts) or `~astropy.coordinates.transformations.AffineTransform`\n        (otherwise).  If at least one of the transforms is not affine, the merged\n        transform is\n        `~astropy.coordinates.transformations.FunctionTransformWithFiniteDifference`.\n        ","endLoc":1563,"header":"def _as_single_transform(self)","id":15180,"name":"_as_single_transform","nodeType":"Function","startLoc":1487,"text":"def _as_single_transform(self):\n        \"\"\"\n        Return an encapsulated version of the composite transform so that it appears to\n        be a single transform.\n\n        The returned transform internally calls the constituent transforms.  If all of\n        the transforms are affine, the merged transform is\n        `~astropy.coordinates.transformations.DynamicMatrixTransform` (if there are no\n        origin shifts) or `~astropy.coordinates.transformations.AffineTransform`\n        (otherwise).  If at least one of the transforms is not affine, the merged\n        transform is\n        `~astropy.coordinates.transformations.FunctionTransformWithFiniteDifference`.\n        \"\"\"\n        # Create a list of the transforms including flattening any constituent CompositeTransform\n        transforms = [t if not isinstance(t, CompositeTransform) else t._as_single_transform()\n                      for t in self.transforms]\n\n        if all([isinstance(t, BaseAffineTransform) for t in transforms]):\n            # Check if there may be an origin shift\n            fixed_origin = all([isinstance(t, (StaticMatrixTransform, DynamicMatrixTransform))\n                                for t in transforms])\n\n            # Dynamically define the transformation function\n            def single_transform(from_coo, to_frame):\n                if from_coo.is_equivalent_frame(to_frame):  # loopback to the same frame\n                    return None if fixed_origin else (None, None)\n\n                # Create a merged attribute dictionary for any intermediate frames\n                # For any attributes shared by the \"from\"/\"to\" frames, the \"to\" frame takes\n                #   precedence because this is the same choice implemented in __call__()\n                merged_attr = {name: getattr(from_coo, name)\n                               for name in from_coo.frame_attributes}\n                merged_attr.update({name: getattr(to_frame, name)\n                                    for name in to_frame.frame_attributes})\n\n                affine_params = (None, None)\n                # Step through each transform step (frame A -> frame B)\n                for i, t in enumerate(transforms):\n                    # Extract the relevant attributes for frame A\n                    if i == 0:\n                        # If frame A is actually the initial frame, preserve its attributes\n                        a_attr = {name: getattr(from_coo, name)\n                                  for name in from_coo.frame_attributes}\n                    else:\n                        a_attr = {k: v for k, v in merged_attr.items()\n                                  if k in t.fromsys.frame_attributes}\n\n                    # Extract the relevant attributes for frame B\n                    b_attr = {k: v for k, v in merged_attr.items()\n                              if k in t.tosys.frame_attributes}\n\n                    # Obtain the affine parameters for the transform\n                    # Note that we insert some dummy data into frame A because the transformation\n                    #   machinery requires there to be data present.  Removing that limitation\n                    #   is a possible TODO, but some care would need to be taken because some affine\n                    #   transforms have branching code depending on the presence of differentials.\n                    next_affine_params = t._affine_params(t.fromsys(from_coo.data, **a_attr),\n                                                          t.tosys(**b_attr))\n\n                    # Combine the affine parameters with the running set\n                    affine_params = _combine_affine_params(affine_params, next_affine_params)\n\n                # If there is no origin shift, return only the matrix\n                return affine_params[0] if fixed_origin else affine_params\n\n            # The return type depends on whether there is any origin shift\n            transform_type = DynamicMatrixTransform if fixed_origin else AffineTransform\n        else:\n            # Dynamically define the transformation function\n            def single_transform(from_coo, to_frame):\n                if from_coo.is_equivalent_frame(to_frame):  # loopback to the same frame\n                    return to_frame.realize_frame(from_coo.data)\n                return self(from_coo, to_frame)\n\n            transform_type = FunctionTransformWithFiniteDifference\n\n        return transform_type(single_transform, self.fromsys, self.tosys, priority=self.priority)"},{"col":4,"comment":"null","endLoc":2964,"header":"def represent_as(self, other_class, base=None)","id":15181,"name":"represent_as","nodeType":"Function","startLoc":2959,"text":"def represent_as(self, other_class, base=None):\n        # Only have enough information to represent other unit-spherical.\n        if issubclass(other_class, UnitSphericalCosLatDifferential):\n            return other_class(self._d_lon_coslat(base), self.d_lat)\n\n        return super().represent_as(other_class, base)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2960,"id":15182,"name":"wz","nodeType":"Attribute","startLoc":2960,"text":"self.wz"},{"col":4,"comment":"null","endLoc":1710,"header":"def _combine_operation(self, op, other, reverse=False)","id":15183,"name":"_combine_operation","nodeType":"Function","startLoc":1703,"text":"def _combine_operation(self, op, other, reverse=False):\n        self._raise_if_has_differentials(op.__name__)\n\n        result = self.to_cartesian()._combine_operation(op, other, reverse)\n        if result is NotImplemented:\n            return NotImplemented\n        else:\n            return self._dimensional_representation.from_cartesian(result)"},{"col":4,"comment":"null","endLoc":2979,"header":"@classmethod\n    def from_representation(cls, representation, base=None)","id":15184,"name":"from_representation","nodeType":"Function","startLoc":2966,"text":"@classmethod\n    def from_representation(cls, representation, base=None):\n        # All spherical differentials can be done without going to Cartesian,\n        # though CosLat needs base for the latitude.\n        if isinstance(representation, SphericalDifferential):\n            return cls(representation.d_lon, representation.d_lat)\n        elif isinstance(representation, (SphericalCosLatDifferential,\n                                         UnitSphericalCosLatDifferential)):\n            d_lon = cls._get_d_lon(representation.d_lon_coslat, base)\n            return cls(d_lon, representation.d_lat)\n        elif isinstance(representation, PhysicsSphericalDifferential):\n            return cls(representation.d_phi, -representation.d_theta)\n\n        return super().from_representation(representation, base)"},{"col":4,"comment":"null","endLoc":130,"header":"@classmethod\n    def get_kernel(cls, value)","id":15185,"name":"get_kernel","nodeType":"Function","startLoc":118,"text":"@classmethod\n    def get_kernel(cls, value):\n        # ScienceState only ensures the `_value` attribute is up to date,\n        # so we need to be sure any kernel returned is consistent.\n        if cls._kernel is None or cls._kernel.origin != value:\n            if cls._kernel is not None:\n                cls._kernel.daf.file.close()\n                cls._kernel = None\n            kernel = _get_kernel(value)\n            if kernel is not None:\n                kernel.origin = value\n            cls._kernel = kernel\n        return cls._kernel"},{"col":4,"comment":"null","endLoc":134,"header":"@classproperty\n    def kernel(cls)","id":15186,"name":"kernel","nodeType":"Function","startLoc":132,"text":"@classproperty\n    def kernel(cls):\n        return cls.get_kernel(cls._value)"},{"col":4,"comment":"null","endLoc":144,"header":"@classproperty\n    def bodies(cls)","id":15187,"name":"bodies","nodeType":"Function","startLoc":136,"text":"@classproperty\n    def bodies(cls):\n        if cls._value is None:\n            return None\n        if cls._value.lower() == 'builtin':\n            return (('earth', 'sun', 'moon') +\n                    tuple(PLAN94_BODY_NAME_TO_PLANET_INDEX.keys()))\n        else:\n            return tuple(BODY_NAME_TO_KERNEL_SPEC.keys())"},{"attributeType":"null","col":8,"comment":"null","endLoc":2959,"id":15188,"name":"w0","nodeType":"Attribute","startLoc":2959,"text":"self.w0"},{"attributeType":"null","col":4,"comment":"null","endLoc":106,"id":15189,"name":"_value","nodeType":"Attribute","startLoc":106,"text":"_value"},{"attributeType":"None","col":4,"comment":"null","endLoc":107,"id":15190,"name":"_kernel","nodeType":"Attribute","startLoc":107,"text":"_kernel"},{"attributeType":"None","col":16,"comment":"null","endLoc":125,"id":15191,"name":"_kernel","nodeType":"Attribute","startLoc":125,"text":"cls._kernel"},{"col":0,"comment":"Calculate the apparent position of body ``body`` relative to Earth.\n\n    This corrects for the light-travel time to the object.\n\n    Parameters\n    ----------\n    body : str or other\n        The solar system body for which to calculate positions.  Can also be a\n        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL\n        kernel.\n    time : `~astropy.time.Time`\n        Time of observation.\n    ephemeris : str, optional\n        Ephemeris to use.  By default, use the one set with\n        ``~astropy.coordinates.solar_system_ephemeris.set``\n    obsgeoloc : `~astropy.coordinates.CartesianRepresentation`, optional\n        The GCRS position of the observer\n\n    Returns\n    -------\n    cartesian_position : `~astropy.coordinates.CartesianRepresentation`\n        Barycentric (ICRS) apparent position of the body in cartesian coordinates\n\n    Notes\n    -----\n    {_EPHEMERIS_NOTE}\n    ","endLoc":422,"header":"def _get_apparent_body_position(body, time, ephemeris, obsgeoloc=None)","id":15192,"name":"_get_apparent_body_position","nodeType":"Function","startLoc":376,"text":"def _get_apparent_body_position(body, time, ephemeris, obsgeoloc=None):\n    \"\"\"Calculate the apparent position of body ``body`` relative to Earth.\n\n    This corrects for the light-travel time to the object.\n\n    Parameters\n    ----------\n    body : str or other\n        The solar system body for which to calculate positions.  Can also be a\n        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL\n        kernel.\n    time : `~astropy.time.Time`\n        Time of observation.\n    ephemeris : str, optional\n        Ephemeris to use.  By default, use the one set with\n        ``~astropy.coordinates.solar_system_ephemeris.set``\n    obsgeoloc : `~astropy.coordinates.CartesianRepresentation`, optional\n        The GCRS position of the observer\n\n    Returns\n    -------\n    cartesian_position : `~astropy.coordinates.CartesianRepresentation`\n        Barycentric (ICRS) apparent position of the body in cartesian coordinates\n\n    Notes\n    -----\n    {_EPHEMERIS_NOTE}\n    \"\"\"\n    if ephemeris is None:\n        ephemeris = solar_system_ephemeris.get()\n\n    # Calculate position given approximate light travel time.\n    delta_light_travel_time = 20. * u.s\n    emitted_time = time\n    light_travel_time = 0. * u.s\n    earth_loc = get_body_barycentric('earth', time, ephemeris)\n    if obsgeoloc is not None:\n        earth_loc += obsgeoloc\n    while np.any(np.fabs(delta_light_travel_time) > 1.0e-8*u.s):\n        body_loc = get_body_barycentric(body, emitted_time, ephemeris)\n        earth_distance = (body_loc - earth_loc).norm()\n        delta_light_travel_time = (light_travel_time -\n                                   earth_distance/speed_of_light)\n        light_travel_time = earth_distance/speed_of_light\n        emitted_time = time - light_travel_time\n\n    return get_body_barycentric(body, emitted_time, ephemeris)"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":15193,"name":"__all__","nodeType":"Attribute","startLoc":37,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":40,"id":15194,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":40,"text":"__doctest_requires__"},{"attributeType":"null","col":0,"comment":"null","endLoc":45,"id":15195,"name":"H0units_to_invs","nodeType":"Attribute","startLoc":45,"text":"H0units_to_invs"},{"attributeType":"null","col":0,"comment":"null","endLoc":46,"id":15196,"name":"sec_to_Gyr","nodeType":"Attribute","startLoc":46,"text":"sec_to_Gyr"},{"attributeType":"null","col":0,"comment":"null","endLoc":48,"id":15197,"name":"critdens_const","nodeType":"Attribute","startLoc":48,"text":"critdens_const"},{"attributeType":"null","col":0,"comment":"null","endLoc":50,"id":15198,"name":"radian_in_arcsec","nodeType":"Attribute","startLoc":50,"text":"radian_in_arcsec"},{"attributeType":"null","col":0,"comment":"null","endLoc":51,"id":15199,"name":"radian_in_arcmin","nodeType":"Attribute","startLoc":51,"text":"radian_in_arcmin"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":15200,"name":"a_B_c2","nodeType":"Attribute","startLoc":53,"text":"a_B_c2"},{"attributeType":"null","col":0,"comment":"null","endLoc":55,"id":15201,"name":"kB_evK","nodeType":"Attribute","startLoc":55,"text":"kB_evK"},{"col":0,"comment":"","endLoc":3,"header":"flrw.py#<anonymous>","id":15202,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"if HAS_SCIPY:\n    from scipy.integrate import quad\n    from scipy.special import ellipkinc, hyp2f1\nelse:\n    def quad(*args, **kwargs):\n        raise ModuleNotFoundError(\"No module named 'scipy.integrate'\")\n\n    def ellipkinc(*args, **kwargs):\n        raise ModuleNotFoundError(\"No module named 'scipy.special'\")\n\n    def hyp2f1(*args, **kwargs):\n        raise ModuleNotFoundError(\"No module named 'scipy.special'\")\n\n__all__ = [\"FLRW\", \"LambdaCDM\", \"FlatLambdaCDM\", \"wCDM\", \"FlatwCDM\",\n           \"w0waCDM\", \"Flatw0waCDM\", \"wpwaCDM\", \"w0wzCDM\", \"FlatFLRWMixin\"]\n\n__doctest_requires__ = {'*': ['scipy']}\n\nH0units_to_invs = (u.km / (u.s * u.Mpc)).to(1.0 / u.s)\n\nsec_to_Gyr = u.s.to(u.Gyr)\n\ncritdens_const = (3 / (8 * pi * const.G)).cgs.value\n\nradian_in_arcsec = (1 * u.rad).to(u.arcsec)\n\nradian_in_arcmin = (1 * u.rad).to(u.arcmin)\n\na_B_c2 = (4 * const.sigma_sb / const.c ** 3).cgs.value\n\nkB_evK = const.k_B.to(u.eV / u.K)"},{"col":4,"comment":"Vector mean.\n\n        The representation is converted to cartesian, the means of the x, y,\n        and z components are calculated, and the result is converted to a\n        `~astropy.coordinates.SphericalRepresentation`.\n\n        Refer to `~numpy.mean` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n        ","endLoc":1725,"header":"def mean(self, *args, **kwargs)","id":15203,"name":"mean","nodeType":"Function","startLoc":1712,"text":"def mean(self, *args, **kwargs):\n        \"\"\"Vector mean.\n\n        The representation is converted to cartesian, the means of the x, y,\n        and z components are calculated, and the result is converted to a\n        `~astropy.coordinates.SphericalRepresentation`.\n\n        Refer to `~numpy.mean` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n        \"\"\"\n        self._raise_if_has_differentials('mean')\n        return self._dimensional_representation.from_cartesian(\n            self.to_cartesian().mean(*args, **kwargs))"},{"fileName":"angle_formats.py","filePath":"astropy/coordinates","id":15204,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# This module includes files automatically generated from ply (these end in\n# _lextab.py and _parsetab.py). To generate these files, remove them from this\n# folder, then build astropy and run the tests in-place:\n#\n#   python setup.py build_ext --inplace\n#   pytest astropy/coordinates\n#\n# You can then commit the changes to the re-generated _lextab.py and\n# _parsetab.py files.\n\n\"\"\"\nThis module contains formatting functions that are for internal use in\nastropy.coordinates.angles. Mainly they are conversions from one format\nof data to another.\n\"\"\"\n\nimport os\nimport threading\nfrom warnings import warn\n\nimport numpy as np\n\nfrom .errors import (IllegalHourWarning, IllegalHourError,\n                     IllegalMinuteWarning, IllegalMinuteError,\n                     IllegalSecondWarning, IllegalSecondError)\nfrom astropy.utils import format_exception, parsing\nfrom astropy import units as u\n\n\nclass _AngleParser:\n    \"\"\"\n    Parses the various angle formats including:\n\n       * 01:02:30.43 degrees\n       * 1 2 0 hours\n       * 1°2′3″\n       * 1d2m3s\n       * -1h2m3s\n       * 1°2′3″N\n\n    This class should not be used directly.  Use `parse_angle`\n    instead.\n    \"\"\"\n    # For safe multi-threaded operation all class (but not instance)\n    # members that carry state should be thread-local. They are stored\n    # in the following class member\n    _thread_local = threading.local()\n\n    def __init__(self):\n        # TODO: in principle, the parser should be invalidated if we change unit\n        # system (from CDS to FITS, say).  Might want to keep a link to the\n        # unit_registry used, and regenerate the parser/lexer if it changes.\n        # Alternatively, perhaps one should not worry at all and just pre-\n        # generate the parser for each release (as done for unit formats).\n        # For some discussion of this problem, see\n        # https://github.com/astropy/astropy/issues/5350#issuecomment-248770151\n        if '_parser' not in _AngleParser._thread_local.__dict__:\n            (_AngleParser._thread_local._parser,\n             _AngleParser._thread_local._lexer) = self._make_parser()\n\n    @classmethod\n    def _get_simple_unit_names(cls):\n        simple_units = set(\n            u.radian.find_equivalent_units(include_prefix_units=True))\n        simple_unit_names = set()\n        # We filter out degree and hourangle, since those are treated\n        # separately.\n        for unit in simple_units:\n            if unit != u.deg and unit != u.hourangle:\n                simple_unit_names.update(unit.names)\n        return sorted(simple_unit_names)\n\n    @classmethod\n    def _make_parser(cls):\n        from astropy.extern.ply import lex, yacc\n\n        # List of token names.\n        tokens = (\n            'SIGN',\n            'UINT',\n            'UFLOAT',\n            'COLON',\n            'DEGREE',\n            'HOUR',\n            'MINUTE',\n            'SECOND',\n            'SIMPLE_UNIT',\n            'EASTWEST',\n            'NORTHSOUTH'\n        )\n\n        # NOTE THE ORDERING OF THESE RULES IS IMPORTANT!!\n        # Regular expression rules for simple tokens\n        def t_UFLOAT(t):\n            r'((\\d+\\.\\d*)|(\\.\\d+))([eE][+-−]?\\d+)?'\n            # The above includes Unicode \"MINUS SIGN\" \\u2212.  It is\n            # important to include the hyphen last, or the regex will\n            # treat this as a range.\n            t.value = float(t.value.replace('−', '-'))\n            return t\n\n        def t_UINT(t):\n            r'\\d+'\n            t.value = int(t.value)\n            return t\n\n        def t_SIGN(t):\n            r'[+−-]'\n            # The above include Unicode \"MINUS SIGN\" \\u2212.  It is\n            # important to include the hyphen last, or the regex will\n            # treat this as a range.\n            if t.value == '+':\n                t.value = 1.0\n            else:\n                t.value = -1.0\n            return t\n\n        def t_EASTWEST(t):\n            r'[EW]$'\n            t.value = -1.0 if t.value == 'W' else 1.0\n            return t\n\n        def t_NORTHSOUTH(t):\n            r'[NS]$'\n            # We cannot use lower-case letters otherwise we'll confuse\n            # s[outh] with s[econd]\n            t.value = -1.0 if t.value == 'S' else 1.0\n            return t\n\n        def t_SIMPLE_UNIT(t):\n            t.value = u.Unit(t.value)\n            return t\n\n        t_SIMPLE_UNIT.__doc__ = '|'.join(\n            f'(?:{x})' for x in cls._get_simple_unit_names())\n\n        t_COLON = ':'\n        t_DEGREE = r'd(eg(ree(s)?)?)?|°'\n        t_HOUR = r'hour(s)?|h(r)?|ʰ'\n        t_MINUTE = r'm(in(ute(s)?)?)?|′|\\'|ᵐ'\n        t_SECOND = r's(ec(ond(s)?)?)?|″|\\\"|ˢ'\n\n        # A string containing ignored characters (spaces)\n        t_ignore = ' '\n\n        # Error handling rule\n        def t_error(t):\n            raise ValueError(\n                f\"Invalid character at col {t.lexpos}\")\n\n        lexer = parsing.lex(lextab='angle_lextab', package='astropy/coordinates')\n\n        def p_angle(p):\n            '''\n            angle : sign hms eastwest\n                  | sign dms dir\n                  | sign arcsecond dir\n                  | sign arcminute dir\n                  | sign simple dir\n            '''\n            sign = p[1] * p[3]\n            value, unit = p[2]\n            if isinstance(value, tuple):\n                p[0] = ((sign * value[0],) + value[1:], unit)\n            else:\n                p[0] = (sign * value, unit)\n\n        def p_sign(p):\n            '''\n            sign : SIGN\n                 |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1.0\n\n        def p_eastwest(p):\n            '''\n            eastwest : EASTWEST\n                     |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1.0\n\n        def p_dir(p):\n            '''\n            dir : EASTWEST\n                | NORTHSOUTH\n                |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1.0\n\n        def p_ufloat(p):\n            '''\n            ufloat : UFLOAT\n                   | UINT\n            '''\n            p[0] = p[1]\n\n        def p_colon(p):\n            '''\n            colon : UINT COLON ufloat\n                  | UINT COLON UINT COLON ufloat\n            '''\n            if len(p) == 4:\n                p[0] = (p[1], p[3])\n            elif len(p) == 6:\n                p[0] = (p[1], p[3], p[5])\n\n        def p_spaced(p):\n            '''\n            spaced : UINT ufloat\n                   | UINT UINT ufloat\n            '''\n            if len(p) == 3:\n                p[0] = (p[1], p[2])\n            elif len(p) == 4:\n                p[0] = (p[1], p[2], p[3])\n\n        def p_generic(p):\n            '''\n            generic : colon\n                    | spaced\n                    | ufloat\n            '''\n            p[0] = p[1]\n\n        def p_hms(p):\n            '''\n            hms : UINT HOUR\n                | UINT HOUR ufloat\n                | UINT HOUR UINT MINUTE\n                | UINT HOUR UFLOAT MINUTE\n                | UINT HOUR UINT MINUTE ufloat\n                | UINT HOUR UINT MINUTE ufloat SECOND\n                | generic HOUR\n            '''\n            if len(p) == 3:\n                p[0] = (p[1], u.hourangle)\n            elif len(p) in (4, 5):\n                p[0] = ((p[1], p[3]), u.hourangle)\n            elif len(p) in (6, 7):\n                p[0] = ((p[1], p[3], p[5]), u.hourangle)\n\n        def p_dms(p):\n            '''\n            dms : UINT DEGREE\n                | UINT DEGREE ufloat\n                | UINT DEGREE UINT MINUTE\n                | UINT DEGREE UFLOAT MINUTE\n                | UINT DEGREE UINT MINUTE ufloat\n                | UINT DEGREE UINT MINUTE ufloat SECOND\n                | generic DEGREE\n            '''\n            if len(p) == 3:\n                p[0] = (p[1], u.degree)\n            elif len(p) in (4, 5):\n                p[0] = ((p[1], p[3]), u.degree)\n            elif len(p) in (6, 7):\n                p[0] = ((p[1], p[3], p[5]), u.degree)\n\n        def p_simple(p):\n            '''\n            simple : generic\n                   | generic SIMPLE_UNIT\n            '''\n            if len(p) == 2:\n                p[0] = (p[1], None)\n            else:\n                p[0] = (p[1], p[2])\n\n        def p_arcsecond(p):\n            '''\n            arcsecond : generic SECOND\n            '''\n            p[0] = (p[1], u.arcsecond)\n\n        def p_arcminute(p):\n            '''\n            arcminute : generic MINUTE\n            '''\n            p[0] = (p[1], u.arcminute)\n\n        def p_error(p):\n            raise ValueError\n\n        parser = parsing.yacc(tabmodule='angle_parsetab', package='astropy/coordinates')\n\n        return parser, lexer\n\n    def parse(self, angle, unit, debug=False):\n        try:\n            found_angle, found_unit = self._thread_local._parser.parse(\n                angle, lexer=self._thread_local._lexer, debug=debug)\n        except ValueError as e:\n            if str(e):\n                raise ValueError(f\"{str(e)} in angle {angle!r}\") from e\n            else:\n                raise ValueError(\n                    f\"Syntax error parsing angle {angle!r}\")  from e\n\n        if unit is None and found_unit is None:\n            raise u.UnitsError(\"No unit specified\")\n\n        return found_angle, found_unit\n\n\ndef _check_hour_range(hrs):\n    \"\"\"\n    Checks that the given value is in the range (-24, 24).\n    \"\"\"\n    if np.any(np.abs(hrs) == 24.):\n        warn(IllegalHourWarning(hrs, 'Treating as 24 hr'))\n    elif np.any(hrs < -24.) or np.any(hrs > 24.):\n        raise IllegalHourError(hrs)\n\n\ndef _check_minute_range(m):\n    \"\"\"\n    Checks that the given value is in the range [0,60].  If the value\n    is equal to 60, then a warning is raised.\n    \"\"\"\n    if np.any(m == 60.):\n        warn(IllegalMinuteWarning(m, 'Treating as 0 min, +1 hr/deg'))\n    elif np.any(m < -60.) or np.any(m > 60.):\n        # \"Error: minutes not in range [-60,60) ({0}).\".format(min))\n        raise IllegalMinuteError(m)\n\n\ndef _check_second_range(sec):\n    \"\"\"\n    Checks that the given value is in the range [0,60].  If the value\n    is equal to 60, then a warning is raised.\n    \"\"\"\n    if np.any(sec == 60.):\n        warn(IllegalSecondWarning(sec, 'Treating as 0 sec, +1 min'))\n    elif sec is None:\n        pass\n    elif np.any(sec < -60.) or np.any(sec > 60.):\n        # \"Error: seconds not in range [-60,60) ({0}).\".format(sec))\n        raise IllegalSecondError(sec)\n\n\ndef check_hms_ranges(h, m, s):\n    \"\"\"\n    Checks that the given hour, minute and second are all within\n    reasonable range.\n    \"\"\"\n    _check_hour_range(h)\n    _check_minute_range(m)\n    _check_second_range(s)\n    return None\n\n\ndef parse_angle(angle, unit=None, debug=False):\n    \"\"\"\n    Parses an input string value into an angle value.\n\n    Parameters\n    ----------\n    angle : str\n        A string representing the angle.  May be in one of the following forms:\n\n            * 01:02:30.43 degrees\n            * 1 2 0 hours\n            * 1°2′3″\n            * 1d2m3s\n            * -1h2m3s\n\n    unit : `~astropy.units.UnitBase` instance, optional\n        The unit used to interpret the string.  If ``unit`` is not\n        provided, the unit must be explicitly represented in the\n        string, either at the end or as number separators.\n\n    debug : bool, optional\n        If `True`, print debugging information from the parser.\n\n    Returns\n    -------\n    value, unit : tuple\n        ``value`` is the value as a floating point number or three-part\n        tuple, and ``unit`` is a `Unit` instance which is either the\n        unit passed in or the one explicitly mentioned in the input\n        string.\n    \"\"\"\n    return _AngleParser().parse(angle, unit, debug=debug)\n\n\ndef degrees_to_dms(d):\n    \"\"\"\n    Convert a floating-point degree value into a ``(degree, arcminute,\n    arcsecond)`` tuple.\n    \"\"\"\n    sign = np.copysign(1.0, d)\n\n    (df, d) = np.modf(np.abs(d))  # (degree fraction, degree)\n    (mf, m) = np.modf(df * 60.)  # (minute fraction, minute)\n    s = mf * 60.\n\n    return np.floor(sign * d), sign * np.floor(m), sign * s\n\n\ndef dms_to_degrees(d, m, s=None):\n    \"\"\"\n    Convert degrees, arcminute, arcsecond to a float degrees value.\n    \"\"\"\n\n    _check_minute_range(m)\n    _check_second_range(s)\n\n    # determine sign\n    sign = np.copysign(1.0, d)\n\n    try:\n        d = np.floor(np.abs(d))\n        if s is None:\n            m = np.abs(m)\n            s = 0\n        else:\n            m = np.floor(np.abs(m))\n            s = np.abs(s)\n    except ValueError as err:\n        raise ValueError(format_exception(\n            \"{func}: dms values ({1[0]},{2[1]},{3[2]}) could not be \"\n            \"converted to numbers.\", d, m, s)) from err\n\n    return sign * (d + m / 60. + s / 3600.)\n\n\ndef hms_to_hours(h, m, s=None):\n    \"\"\"\n    Convert hour, minute, second to a float hour value.\n    \"\"\"\n\n    check_hms_ranges(h, m, s)\n\n    # determine sign\n    sign = np.copysign(1.0, h)\n\n    try:\n        h = np.floor(np.abs(h))\n        if s is None:\n            m = np.abs(m)\n            s = 0\n        else:\n            m = np.floor(np.abs(m))\n            s = np.abs(s)\n    except ValueError as err:\n        raise ValueError(format_exception(\n            \"{func}: HMS values ({1[0]},{2[1]},{3[2]}) could not be \"\n            \"converted to numbers.\", h, m, s)) from err\n\n    return sign * (h + m / 60. + s / 3600.)\n\n\ndef hms_to_degrees(h, m, s):\n    \"\"\"\n    Convert hour, minute, second to a float degrees value.\n    \"\"\"\n\n    return hms_to_hours(h, m, s) * 15.\n\n\ndef hms_to_radians(h, m, s):\n    \"\"\"\n    Convert hour, minute, second to a float radians value.\n    \"\"\"\n\n    return u.degree.to(u.radian, hms_to_degrees(h, m, s))\n\n\ndef hms_to_dms(h, m, s):\n    \"\"\"\n    Convert degrees, arcminutes, arcseconds to an ``(hour, minute, second)``\n    tuple.\n    \"\"\"\n\n    return degrees_to_dms(hms_to_degrees(h, m, s))\n\n\ndef hours_to_decimal(h):\n    \"\"\"\n    Convert any parseable hour value into a float value.\n    \"\"\"\n    from . import angles\n    return angles.Angle(h, unit=u.hourangle).hour\n\n\ndef hours_to_radians(h):\n    \"\"\"\n    Convert an angle in Hours to Radians.\n    \"\"\"\n\n    return u.hourangle.to(u.radian, h)\n\n\ndef hours_to_hms(h):\n    \"\"\"\n    Convert an floating-point hour value into an ``(hour, minute,\n    second)`` tuple.\n    \"\"\"\n\n    sign = np.copysign(1.0, h)\n\n    (hf, h) = np.modf(np.abs(h))  # (degree fraction, degree)\n    (mf, m) = np.modf(hf * 60.0)  # (minute fraction, minute)\n    s = mf * 60.0\n\n    return (np.floor(sign * h), sign * np.floor(m), sign * s)\n\n\ndef radians_to_degrees(r):\n    \"\"\"\n    Convert an angle in Radians to Degrees.\n    \"\"\"\n    return u.radian.to(u.degree, r)\n\n\ndef radians_to_hours(r):\n    \"\"\"\n    Convert an angle in Radians to Hours.\n    \"\"\"\n    return u.radian.to(u.hourangle, r)\n\n\ndef radians_to_hms(r):\n    \"\"\"\n    Convert an angle in Radians to an ``(hour, minute, second)`` tuple.\n    \"\"\"\n\n    hours = radians_to_hours(r)\n    return hours_to_hms(hours)\n\n\ndef radians_to_dms(r):\n    \"\"\"\n    Convert an angle in Radians to an ``(degree, arcminute,\n    arcsecond)`` tuple.\n    \"\"\"\n\n    degrees = u.radian.to(u.degree, r)\n    return degrees_to_dms(degrees)\n\n\ndef sexagesimal_to_string(values, precision=None, pad=False, sep=(':',),\n                          fields=3):\n    \"\"\"\n    Given an already separated tuple of sexagesimal values, returns\n    a string.\n\n    See `hours_to_string` and `degrees_to_string` for a higher-level\n    interface to this functionality.\n    \"\"\"\n\n    # Check to see if values[0] is negative, using np.copysign to handle -0\n    sign = np.copysign(1.0, values[0])\n    # If the coordinates are negative, we need to take the absolute values.\n    # We use np.abs because abs(-0) is -0\n    # TODO: Is this true? (MHvK, 2018-02-01: not on my system)\n    values = [np.abs(value) for value in values]\n\n    if pad:\n        if sign == -1:\n            pad = 3\n        else:\n            pad = 2\n    else:\n        pad = 0\n\n    if not isinstance(sep, tuple):\n        sep = tuple(sep)\n\n    if fields < 1 or fields > 3:\n        raise ValueError(\n            \"fields must be 1, 2, or 3\")\n\n    if not sep:  # empty string, False, or None, etc.\n        sep = ('', '', '')\n    elif len(sep) == 1:\n        if fields == 3:\n            sep = sep + (sep[0], '')\n        elif fields == 2:\n            sep = sep + ('', '')\n        else:\n            sep = ('', '', '')\n    elif len(sep) == 2:\n        sep = sep + ('',)\n    elif len(sep) != 3:\n        raise ValueError(\n            \"Invalid separator specification for converting angle to string.\")\n\n    # Simplify the expression based on the requested precision.  For\n    # example, if the seconds will round up to 60, we should convert\n    # it to 0 and carry upwards.  If the field is hidden (by the\n    # fields kwarg) we round up around the middle, 30.0.\n    if precision is None:\n        rounding_thresh = 60.0 - (10.0 ** -8)\n    else:\n        rounding_thresh = 60.0 - (10.0 ** -precision)\n\n    if fields == 3 and values[2] >= rounding_thresh:\n        values[2] = 0.0\n        values[1] += 1.0\n    elif fields < 3 and values[2] >= 30.0:\n        values[1] += 1.0\n\n    if fields >= 2 and values[1] >= 60.0:\n        values[1] = 0.0\n        values[0] += 1.0\n    elif fields < 2 and values[1] >= 30.0:\n        values[0] += 1.0\n\n    literal = []\n    last_value = ''\n    literal.append('{0:0{pad}.0f}{sep[0]}')\n    if fields >= 2:\n        literal.append('{1:02d}{sep[1]}')\n    if fields == 3:\n        if precision is None:\n            last_value = f'{abs(values[2]):.8f}'\n            last_value = last_value.rstrip('0').rstrip('.')\n        else:\n            last_value = '{0:.{precision}f}'.format(\n                abs(values[2]), precision=precision)\n        if len(last_value) == 1 or last_value[1] == '.':\n            last_value = '0' + last_value\n        literal.append('{last_value}{sep[2]}')\n    literal = ''.join(literal)\n    return literal.format(np.copysign(values[0], sign),\n                          int(values[1]), values[2],\n                          sep=sep, pad=pad,\n                          last_value=last_value)\n\n\ndef hours_to_string(h, precision=5, pad=False, sep=('h', 'm', 's'),\n                    fields=3):\n    \"\"\"\n    Takes a decimal hour value and returns a string formatted as hms with\n    separator specified by the 'sep' parameter.\n\n    ``h`` must be a scalar.\n    \"\"\"\n    h, m, s = hours_to_hms(h)\n    return sexagesimal_to_string((h, m, s), precision=precision, pad=pad,\n                                 sep=sep, fields=fields)\n\n\ndef degrees_to_string(d, precision=5, pad=False, sep=':', fields=3):\n    \"\"\"\n    Takes a decimal hour value and returns a string formatted as dms with\n    separator specified by the 'sep' parameter.\n\n    ``d`` must be a scalar.\n    \"\"\"\n    d, m, s = degrees_to_dms(d)\n    return sexagesimal_to_string((d, m, s), precision=precision, pad=pad,\n                                 sep=sep, fields=fields)\n"},{"className":"IllegalHourWarning","col":0,"comment":"\n    Raised when an hour value is 24.\n\n    Parameters\n    ----------\n    hour : int, float\n    ","endLoc":66,"id":15205,"nodeType":"Class","startLoc":50,"text":"class IllegalHourWarning(AstropyWarning):\n    \"\"\"\n    Raised when an hour value is 24.\n\n    Parameters\n    ----------\n    hour : int, float\n    \"\"\"\n    def __init__(self, hour, alternativeactionstr=None):\n        self.hour = hour\n        self.alternativeactionstr = alternativeactionstr\n\n    def __str__(self):\n        message = f\"'hour' was found  to be '{self.hour}', which is not in range (-24, 24).\"\n        if self.alternativeactionstr is not None:\n            message += ' ' + self.alternativeactionstr\n        return message"},{"col":4,"comment":"null","endLoc":66,"header":"def __str__(self)","id":15206,"name":"__str__","nodeType":"Function","startLoc":62,"text":"def __str__(self):\n        message = f\"'hour' was found  to be '{self.hour}', which is not in range (-24, 24).\"\n        if self.alternativeactionstr is not None:\n            message += ' ' + self.alternativeactionstr\n        return message"},{"attributeType":"null","col":8,"comment":"null","endLoc":59,"id":15207,"name":"hour","nodeType":"Attribute","startLoc":59,"text":"self.hour"},{"attributeType":"null","col":8,"comment":"null","endLoc":60,"id":15208,"name":"alternativeactionstr","nodeType":"Attribute","startLoc":60,"text":"self.alternativeactionstr"},{"col":0,"comment":"\n    Get a `~astropy.coordinates.SkyCoord` for a solar system body as observed\n    from a location on Earth in the `~astropy.coordinates.GCRS` reference\n    system.\n\n    Parameters\n    ----------\n    body : str or list of tuple\n        The solar system body for which to calculate positions.  Can also be a\n        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL\n        kernel.\n    time : `~astropy.time.Time`\n        Time of observation.\n    location : `~astropy.coordinates.EarthLocation`, optional\n        Location of observer on the Earth.  If not given, will be taken from\n        ``time`` (if not present, a geocentric observer will be assumed).\n    ephemeris : str, optional\n        Ephemeris to use.  If not given, use the one set with\n        ``astropy.coordinates.solar_system_ephemeris.set`` (which is\n        set to 'builtin' by default).\n\n    Returns\n    -------\n    skycoord : `~astropy.coordinates.SkyCoord`\n        GCRS Coordinate for the body\n\n    Notes\n    -----\n    The coordinate returned is the apparent position, which is the position of\n    the body at time *t* minus the light travel time from the *body* to the\n    observing *location*.\n\n    {_EPHEMERIS_NOTE}\n    ","endLoc":474,"header":"def get_body(body, time, location=None, ephemeris=None)","id":15209,"name":"get_body","nodeType":"Function","startLoc":425,"text":"def get_body(body, time, location=None, ephemeris=None):\n    \"\"\"\n    Get a `~astropy.coordinates.SkyCoord` for a solar system body as observed\n    from a location on Earth in the `~astropy.coordinates.GCRS` reference\n    system.\n\n    Parameters\n    ----------\n    body : str or list of tuple\n        The solar system body for which to calculate positions.  Can also be a\n        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL\n        kernel.\n    time : `~astropy.time.Time`\n        Time of observation.\n    location : `~astropy.coordinates.EarthLocation`, optional\n        Location of observer on the Earth.  If not given, will be taken from\n        ``time`` (if not present, a geocentric observer will be assumed).\n    ephemeris : str, optional\n        Ephemeris to use.  If not given, use the one set with\n        ``astropy.coordinates.solar_system_ephemeris.set`` (which is\n        set to 'builtin' by default).\n\n    Returns\n    -------\n    skycoord : `~astropy.coordinates.SkyCoord`\n        GCRS Coordinate for the body\n\n    Notes\n    -----\n    The coordinate returned is the apparent position, which is the position of\n    the body at time *t* minus the light travel time from the *body* to the\n    observing *location*.\n\n    {_EPHEMERIS_NOTE}\n    \"\"\"\n    if location is None:\n        location = time.location\n\n    if location is not None:\n        obsgeoloc, obsgeovel = location.get_gcrs_posvel(time)\n    else:\n        obsgeoloc, obsgeovel = None, None\n\n    cartrep = _get_apparent_body_position(body, time, ephemeris, obsgeoloc)\n    icrs = ICRS(cartrep)\n    gcrs = icrs.transform_to(GCRS(obstime=time,\n                                  obsgeoloc=obsgeoloc,\n                                  obsgeovel=obsgeovel))\n\n    return SkyCoord(gcrs)"},{"className":"IllegalHourError","col":0,"comment":"\n    Raised when an hour value is not in the range [0,24).\n\n    Parameters\n    ----------\n    hour : int, float\n\n    Examples\n    --------\n\n    .. code-block:: python\n\n        if not 0 <= hr < 24:\n           raise IllegalHourError(hour)\n    ","endLoc":47,"id":15210,"nodeType":"Class","startLoc":27,"text":"class IllegalHourError(RangeError):\n    \"\"\"\n    Raised when an hour value is not in the range [0,24).\n\n    Parameters\n    ----------\n    hour : int, float\n\n    Examples\n    --------\n\n    .. code-block:: python\n\n        if not 0 <= hr < 24:\n           raise IllegalHourError(hour)\n    \"\"\"\n    def __init__(self, hour):\n        self.hour = hour\n\n    def __str__(self):\n        return f\"An invalid value for 'hours' was found ('{self.hour}'); must be in the range [0,24).\""},{"className":"RangeError","col":0,"comment":"\n    Raised when some part of an angle is out of its valid range.\n    ","endLoc":18,"id":15211,"nodeType":"Class","startLoc":15,"text":"class RangeError(ValueError):\n    \"\"\"\n    Raised when some part of an angle is out of its valid range.\n    \"\"\""},{"col":4,"comment":"null","endLoc":47,"header":"def __str__(self)","id":15212,"name":"__str__","nodeType":"Function","startLoc":46,"text":"def __str__(self):\n        return f\"An invalid value for 'hours' was found ('{self.hour}'); must be in the range [0,24).\""},{"attributeType":"null","col":8,"comment":"null","endLoc":44,"id":15213,"name":"hour","nodeType":"Attribute","startLoc":44,"text":"self.hour"},{"col":0,"comment":"\n    Combine two sets of affine parameters.\n\n    The parameters for an affine transformation are a 3 x 3 Cartesian\n    transformation matrix and a displacement vector, which can include an\n    attached velocity.  Either type of parameter can be ``None``.\n    ","endLoc":1603,"header":"def _combine_affine_params(params, next_params)","id":15214,"name":"_combine_affine_params","nodeType":"Function","startLoc":1566,"text":"def _combine_affine_params(params, next_params):\n    \"\"\"\n    Combine two sets of affine parameters.\n\n    The parameters for an affine transformation are a 3 x 3 Cartesian\n    transformation matrix and a displacement vector, which can include an\n    attached velocity.  Either type of parameter can be ``None``.\n    \"\"\"\n    M, vec = params\n    next_M, next_vec = next_params\n\n    # Multiply the transformation matrices if they both exist\n    if M is not None and next_M is not None:\n        new_M = next_M @ M\n    else:\n        new_M = M if M is not None else next_M\n\n    if vec is not None:\n        # Transform the first displacement vector by the second transformation matrix\n        if next_M is not None:\n            vec = vec.transform(next_M)\n\n        # Calculate the new displacement vector\n        if next_vec is not None:\n            if 's' in vec.differentials and 's' in next_vec.differentials:\n                # Adding vectors with velocities takes more steps\n                # TODO: Add support in representation.py\n                new_vec_velocity = vec.differentials['s'] + next_vec.differentials['s']\n                new_vec = vec.without_differentials() + next_vec.without_differentials()\n                new_vec = new_vec.with_differentials({'s': new_vec_velocity})\n            else:\n                new_vec = vec + next_vec\n        else:\n            new_vec = vec\n    else:\n        new_vec = next_vec\n\n    return new_M, new_vec"},{"className":"IllegalMinuteWarning","col":0,"comment":"\n    Raised when a minute value is 60.\n\n    Parameters\n    ----------\n    minute : int, float\n    ","endLoc":109,"id":15215,"nodeType":"Class","startLoc":93,"text":"class IllegalMinuteWarning(AstropyWarning):\n    \"\"\"\n    Raised when a minute value is 60.\n\n    Parameters\n    ----------\n    minute : int, float\n    \"\"\"\n    def __init__(self, minute, alternativeactionstr=None):\n        self.minute = minute\n        self.alternativeactionstr = alternativeactionstr\n\n    def __str__(self):\n        message = f\"'minute' was found  to be '{self.minute}', which is not in range [0,60).\"\n        if self.alternativeactionstr is not None:\n            message += ' ' + self.alternativeactionstr\n        return message"},{"col":4,"comment":"null","endLoc":109,"header":"def __str__(self)","id":15216,"name":"__str__","nodeType":"Function","startLoc":105,"text":"def __str__(self):\n        message = f\"'minute' was found  to be '{self.minute}', which is not in range [0,60).\"\n        if self.alternativeactionstr is not None:\n            message += ' ' + self.alternativeactionstr\n        return message"},{"attributeType":"null","col":8,"comment":"null","endLoc":103,"id":15217,"name":"alternativeactionstr","nodeType":"Attribute","startLoc":103,"text":"self.alternativeactionstr"},{"attributeType":"null","col":8,"comment":"null","endLoc":102,"id":15218,"name":"minute","nodeType":"Attribute","startLoc":102,"text":"self.minute"},{"col":4,"comment":"Transform differential using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new differential and does not modify the original one.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n        base : instance of ``cls.base_representation``\n            Base relative to which the differentials are defined.  If the other\n            class is a differential representation, the base will be converted\n            to its ``base_representation``.\n        transformed_base : instance of ``cls.base_representation``\n            Base relative to which the transformed differentials are defined.\n            If the other class is a differential representation, the base will\n            be converted to its ``base_representation``.\n        ","endLoc":3013,"header":"def transform(self, matrix, base, transformed_base)","id":15219,"name":"transform","nodeType":"Function","startLoc":2981,"text":"def transform(self, matrix, base, transformed_base):\n        \"\"\"Transform differential using a 3x3 matrix in a Cartesian basis.\n\n        This returns a new differential and does not modify the original one.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 (or stack thereof) matrix, such as a rotation matrix.\n        base : instance of ``cls.base_representation``\n            Base relative to which the differentials are defined.  If the other\n            class is a differential representation, the base will be converted\n            to its ``base_representation``.\n        transformed_base : instance of ``cls.base_representation``\n            Base relative to which the transformed differentials are defined.\n            If the other class is a differential representation, the base will\n            be converted to its ``base_representation``.\n        \"\"\"\n        # the transformation matrix does not need to be a rotation matrix,\n        # so the unit-distance is not guaranteed. For speed, we check if the\n        # matrix is in O(3) and preserves lengths.\n        if np.all(is_O3(matrix)):  # remain in unit-rep\n            # TODO! implement without Cartesian intermediate step.\n            # some of this can be moved to the parent class.\n            diff = super().transform(matrix, base, transformed_base)\n\n        else:  # switch to dimensional representation\n            du = self.d_lon.unit / base.lon.unit  # derivative unit\n            diff = self._dimensional_differential(\n                d_lon=self.d_lon, d_lat=self.d_lat, d_distance=0 * du\n            ).transform(matrix, base, transformed_base)\n\n        return diff"},{"className":"IllegalMinuteError","col":0,"comment":"\n    Raised when an minute value is not in the range [0,60].\n\n    Parameters\n    ----------\n    minute : int, float\n\n    Examples\n    --------\n\n    .. code-block:: python\n\n        if not 0 <= min < 60:\n            raise IllegalMinuteError(minute)\n\n    ","endLoc":90,"id":15220,"nodeType":"Class","startLoc":69,"text":"class IllegalMinuteError(RangeError):\n    \"\"\"\n    Raised when an minute value is not in the range [0,60].\n\n    Parameters\n    ----------\n    minute : int, float\n\n    Examples\n    --------\n\n    .. code-block:: python\n\n        if not 0 <= min < 60:\n            raise IllegalMinuteError(minute)\n\n    \"\"\"\n    def __init__(self, minute):\n        self.minute = minute\n\n    def __str__(self):\n        return f\"An invalid value for 'minute' was found ('{self.minute}'); should be in the range [0,60).\""},{"col":4,"comment":"null","endLoc":90,"header":"def __str__(self)","id":15221,"name":"__str__","nodeType":"Function","startLoc":89,"text":"def __str__(self):\n        return f\"An invalid value for 'minute' was found ('{self.minute}'); should be in the range [0,60).\""},{"attributeType":"null","col":8,"comment":"null","endLoc":87,"id":15222,"name":"minute","nodeType":"Attribute","startLoc":87,"text":"self.minute"},{"col":0,"comment":" Helper function for the concatenate function below. Gets and\n    concatenates all of the individual components for an iterable of\n    representations or differentials.\n    ","endLoc":280,"header":"def _concatenate_components(reps_difs, names)","id":15223,"name":"_concatenate_components","nodeType":"Function","startLoc":266,"text":"def _concatenate_components(reps_difs, names):\n    \"\"\" Helper function for the concatenate function below. Gets and\n    concatenates all of the individual components for an iterable of\n    representations or differentials.\n    \"\"\"\n    values = []\n    for name in names:\n        unit0 = getattr(reps_difs[0], name).unit\n        # Go via to_value because np.concatenate doesn't work with Quantity\n        data_vals = [getattr(x, name).to_value(unit0) for x in reps_difs]\n        concat_vals = np.concatenate(np.atleast_1d(*data_vals))\n        concat_vals = concat_vals << unit0\n        values.append(concat_vals)\n\n    return values"},{"col":0,"comment":"\n    Combine multiple representation objects into a single instance by\n    concatenating the data in each component.\n\n    Currently, all of the input representations have to be the same type. This\n    properly handles differential or velocity data, but all input objects must\n    have the same differential object type as well.\n\n    Parameters\n    ----------\n    reps : sequence of `~astropy.coordinates.BaseRepresentation`\n        The objects to concatenate\n\n    Returns\n    -------\n    rep : `~astropy.coordinates.BaseRepresentation` subclass instance\n        A single representation object with its data set to the concatenation of\n        all the elements of the input sequence of representations.\n\n    ","endLoc":339,"header":"def concatenate_representations(reps)","id":15224,"name":"concatenate_representations","nodeType":"Function","startLoc":283,"text":"def concatenate_representations(reps):\n    \"\"\"\n    Combine multiple representation objects into a single instance by\n    concatenating the data in each component.\n\n    Currently, all of the input representations have to be the same type. This\n    properly handles differential or velocity data, but all input objects must\n    have the same differential object type as well.\n\n    Parameters\n    ----------\n    reps : sequence of `~astropy.coordinates.BaseRepresentation`\n        The objects to concatenate\n\n    Returns\n    -------\n    rep : `~astropy.coordinates.BaseRepresentation` subclass instance\n        A single representation object with its data set to the concatenation of\n        all the elements of the input sequence of representations.\n\n    \"\"\"\n    if not isinstance(reps, (Sequence, np.ndarray)):\n        raise TypeError('Input must be a list or iterable of representation '\n                        'objects.')\n\n    # First, validate that the representations are the same, and\n    # concatenate all of the positional data:\n    rep_type = type(reps[0])\n    if any(type(r) != rep_type for r in reps):\n        raise TypeError('Input representations must all have the same type.')\n\n    # Construct the new representation with the concatenated data from the\n    # representations passed in\n    values = _concatenate_components(reps,\n                                     rep_type.attr_classes.keys())\n    new_rep = rep_type(*values)\n\n    has_diff = any('s' in rep.differentials for rep in reps)\n    if has_diff and any('s' not in rep.differentials for rep in reps):\n        raise ValueError('Input representations must either all contain '\n                         'differentials, or not contain differentials.')\n\n    if has_diff:\n        dif_type = type(reps[0].differentials['s'])\n\n        if any('s' not in r.differentials or\n                type(r.differentials['s']) != dif_type\n               for r in reps):\n            raise TypeError('All input representations must have the same '\n                            'differential type.')\n\n        values = _concatenate_components([r.differentials['s'] for r in reps],\n                                         dif_type.attr_classes.keys())\n        new_dif = dif_type(*values)\n        new_rep = new_rep.with_differentials({'s': new_dif})\n\n    return new_rep"},{"col":4,"comment":"Vector sum.\n\n        The representation is converted to cartesian, the sums of the x, y,\n        and z components are calculated, and the result is converted to a\n        `~astropy.coordinates.SphericalRepresentation`.\n\n        Refer to `~numpy.sum` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n        ","endLoc":1740,"header":"def sum(self, *args, **kwargs)","id":15225,"name":"sum","nodeType":"Function","startLoc":1727,"text":"def sum(self, *args, **kwargs):\n        \"\"\"Vector sum.\n\n        The representation is converted to cartesian, the sums of the x, y,\n        and z components are calculated, and the result is converted to a\n        `~astropy.coordinates.SphericalRepresentation`.\n\n        Refer to `~numpy.sum` for full documentation of the arguments, noting\n        that ``axis`` is the entry in the ``shape`` of the representation, and\n        that the ``out`` argument cannot be used.\n        \"\"\"\n        self._raise_if_has_differentials('sum')\n        return self._dimensional_representation.from_cartesian(\n            self.to_cartesian().sum(*args, **kwargs))"},{"col":0,"comment":"\n    Combine multiple coordinate objects into a single\n    `~astropy.coordinates.SkyCoord`.\n\n    \"Coordinate objects\" here mean frame objects with data,\n    `~astropy.coordinates.SkyCoord`, or representation objects.  Currently,\n    they must all be in the same frame, but in a future version this may be\n    relaxed to allow inhomogeneous sequences of objects.\n\n    Parameters\n    ----------\n    coords : sequence of coordinate-like\n        The objects to concatenate\n\n    Returns\n    -------\n    cskycoord : SkyCoord\n        A single sky coordinate with its data set to the concatenation of all\n        the elements in ``coords``\n    ","endLoc":377,"header":"def concatenate(coords)","id":15226,"name":"concatenate","nodeType":"Function","startLoc":342,"text":"def concatenate(coords):\n    \"\"\"\n    Combine multiple coordinate objects into a single\n    `~astropy.coordinates.SkyCoord`.\n\n    \"Coordinate objects\" here mean frame objects with data,\n    `~astropy.coordinates.SkyCoord`, or representation objects.  Currently,\n    they must all be in the same frame, but in a future version this may be\n    relaxed to allow inhomogeneous sequences of objects.\n\n    Parameters\n    ----------\n    coords : sequence of coordinate-like\n        The objects to concatenate\n\n    Returns\n    -------\n    cskycoord : SkyCoord\n        A single sky coordinate with its data set to the concatenation of all\n        the elements in ``coords``\n    \"\"\"\n    if getattr(coords, 'isscalar', False) or not isiterable(coords):\n        raise TypeError('The argument to concatenate must be iterable')\n\n    scs = [SkyCoord(coord, copy=False) for coord in coords]\n\n    # Check that all frames are equivalent\n    for sc in scs[1:]:\n        if not sc.is_equivalent_frame(scs[0]):\n            raise ValueError(\"All inputs must have equivalent frames: \"\n                             \"{} != {}\".format(sc, scs[0]))\n\n    # TODO: this can be changed to SkyCoord.from_representation() for a speed\n    # boost when we switch to using classmethods\n    return SkyCoord(concatenate_representations([c.data for c in coords]),\n                    frame=scs[0].frame)"},{"col":4,"comment":"null","endLoc":3019,"header":"def _scale_operation(self, op, *args, scaled_base=False)","id":15227,"name":"_scale_operation","nodeType":"Function","startLoc":3015,"text":"def _scale_operation(self, op, *args, scaled_base=False):\n        if scaled_base:\n            return self.copy()\n        else:\n            return super()._scale_operation(op, *args)"},{"col":4,"comment":"null","endLoc":1485,"header":"def __call__(self, fromcoord, toframe)","id":15228,"name":"__call__","nodeType":"Function","startLoc":1463,"text":"def __call__(self, fromcoord, toframe):\n        curr_coord = fromcoord\n        for t in self.transforms:\n            # build an intermediate frame with attributes taken from either\n            # `toframe`, or if not there, `fromcoord`, or if not there, use\n            # the defaults\n            # TODO: caching this information when creating the transform may\n            # speed things up a lot\n            frattrs = {}\n            for inter_frame_attr_nm in t.tosys.get_frame_attr_names():\n                if hasattr(toframe, inter_frame_attr_nm):\n                    attr = getattr(toframe, inter_frame_attr_nm)\n                    frattrs[inter_frame_attr_nm] = attr\n                elif hasattr(fromcoord, inter_frame_attr_nm):\n                    attr = getattr(fromcoord, inter_frame_attr_nm)\n                    frattrs[inter_frame_attr_nm] = attr\n\n            curr_toframe = t.tosys(**frattrs)\n            curr_coord = t(curr_coord, curr_toframe)\n\n        # this is safe even in the case where self.transforms is empty, because\n        # coordinate objects are immutable, so copying is not needed\n        return curr_coord"},{"className":"IllegalSecondWarning","col":0,"comment":"\n    Raised when a second value is 60.\n\n    Parameters\n    ----------\n    second : int, float\n    ","endLoc":151,"id":15229,"nodeType":"Class","startLoc":135,"text":"class IllegalSecondWarning(AstropyWarning):\n    \"\"\"\n    Raised when a second value is 60.\n\n    Parameters\n    ----------\n    second : int, float\n    \"\"\"\n    def __init__(self, second, alternativeactionstr=None):\n        self.second = second\n        self.alternativeactionstr = alternativeactionstr\n\n    def __str__(self):\n        message = f\"'second' was found  to be '{self.second}', which is not in range [0,60).\"\n        if self.alternativeactionstr is not None:\n            message += ' ' + self.alternativeactionstr\n        return message"},{"col":4,"comment":"null","endLoc":151,"header":"def __str__(self)","id":15230,"name":"__str__","nodeType":"Function","startLoc":147,"text":"def __str__(self):\n        message = f\"'second' was found  to be '{self.second}', which is not in range [0,60).\"\n        if self.alternativeactionstr is not None:\n            message += ' ' + self.alternativeactionstr\n        return message"},{"attributeType":"null","col":8,"comment":"null","endLoc":145,"id":15231,"name":"alternativeactionstr","nodeType":"Attribute","startLoc":145,"text":"self.alternativeactionstr"},{"col":4,"comment":"null","endLoc":976,"header":"def __init__(self, func, fromsys, tosys, priority=1, register_graph=None,\n                 finite_difference_frameattr_name='obstime',\n                 finite_difference_dt=1*u.second,\n                 symmetric_finite_difference=True)","id":15232,"name":"__init__","nodeType":"Function","startLoc":969,"text":"def __init__(self, func, fromsys, tosys, priority=1, register_graph=None,\n                 finite_difference_frameattr_name='obstime',\n                 finite_difference_dt=1*u.second,\n                 symmetric_finite_difference=True):\n        super().__init__(func, fromsys, tosys, priority, register_graph)\n        self.finite_difference_frameattr_name = finite_difference_frameattr_name\n        self.finite_difference_dt = finite_difference_dt\n        self.symmetric_finite_difference = symmetric_finite_difference"},{"col":4,"comment":"null","endLoc":914,"header":"def __init__(self, func, fromsys, tosys, priority=1, register_graph=None)","id":15233,"name":"__init__","nodeType":"Function","startLoc":900,"text":"def __init__(self, func, fromsys, tosys, priority=1, register_graph=None):\n        if not callable(func):\n            raise TypeError('func must be callable')\n\n        with suppress(TypeError):\n            sig = signature(func)\n            kinds = [x.kind for x in sig.parameters.values()]\n            if (len(x for x in kinds if x == sig.POSITIONAL_ONLY) != 2 and\n                    sig.VAR_POSITIONAL not in kinds):\n                raise ValueError('provided function does not accept two arguments')\n\n        self.func = func\n\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)"},{"attributeType":"null","col":4,"comment":"null","endLoc":2930,"id":15234,"name":"base_representation","nodeType":"Attribute","startLoc":2930,"text":"base_representation"},{"col":4,"comment":"Cross product of two representations.\n\n        The calculation is done by converting both ``self`` and ``other``\n        to `~astropy.coordinates.CartesianRepresentation`, and converting the\n        result back to `~astropy.coordinates.SphericalRepresentation`.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The representation to take the cross product with.\n\n        Returns\n        -------\n        cross_product : `~astropy.coordinates.SphericalRepresentation`\n            With vectors perpendicular to both ``self`` and ``other``.\n        ","endLoc":1761,"header":"def cross(self, other)","id":15235,"name":"cross","nodeType":"Function","startLoc":1742,"text":"def cross(self, other):\n        \"\"\"Cross product of two representations.\n\n        The calculation is done by converting both ``self`` and ``other``\n        to `~astropy.coordinates.CartesianRepresentation`, and converting the\n        result back to `~astropy.coordinates.SphericalRepresentation`.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseRepresentation` subclass instance\n            The representation to take the cross product with.\n\n        Returns\n        -------\n        cross_product : `~astropy.coordinates.SphericalRepresentation`\n            With vectors perpendicular to both ``self`` and ``other``.\n        \"\"\"\n        self._raise_if_has_differentials('cross')\n        return self._dimensional_representation.from_cartesian(\n            self.to_cartesian().cross(other))"},{"col":0,"comment":"\n    Get a `~astropy.coordinates.SkyCoord` for the Earth's Moon as observed\n    from a location on Earth in the `~astropy.coordinates.GCRS` reference\n    system.\n\n    Parameters\n    ----------\n    time : `~astropy.time.Time`\n        Time of observation\n    location : `~astropy.coordinates.EarthLocation`\n        Location of observer on the Earth. If none is supplied, taken from\n        ``time`` (if not present, a geocentric observer will be assumed).\n    ephemeris : str, optional\n        Ephemeris to use.  If not given, use the one set with\n        ``astropy.coordinates.solar_system_ephemeris.set`` (which is\n        set to 'builtin' by default).\n\n    Returns\n    -------\n    skycoord : `~astropy.coordinates.SkyCoord`\n        GCRS Coordinate for the Moon\n\n    Notes\n    -----\n    The coordinate returned is the apparent position, which is the position of\n    the moon at time *t* minus the light travel time from the moon to the\n    observing *location*.\n\n    {_EPHEMERIS_NOTE}\n    ","endLoc":509,"header":"def get_moon(time, location=None, ephemeris=None)","id":15236,"name":"get_moon","nodeType":"Function","startLoc":477,"text":"def get_moon(time, location=None, ephemeris=None):\n    \"\"\"\n    Get a `~astropy.coordinates.SkyCoord` for the Earth's Moon as observed\n    from a location on Earth in the `~astropy.coordinates.GCRS` reference\n    system.\n\n    Parameters\n    ----------\n    time : `~astropy.time.Time`\n        Time of observation\n    location : `~astropy.coordinates.EarthLocation`\n        Location of observer on the Earth. If none is supplied, taken from\n        ``time`` (if not present, a geocentric observer will be assumed).\n    ephemeris : str, optional\n        Ephemeris to use.  If not given, use the one set with\n        ``astropy.coordinates.solar_system_ephemeris.set`` (which is\n        set to 'builtin' by default).\n\n    Returns\n    -------\n    skycoord : `~astropy.coordinates.SkyCoord`\n        GCRS Coordinate for the Moon\n\n    Notes\n    -----\n    The coordinate returned is the apparent position, which is the position of\n    the moon at time *t* minus the light travel time from the moon to the\n    observing *location*.\n\n    {_EPHEMERIS_NOTE}\n    \"\"\"\n\n    return get_body('moon', time, location=location, ephemeris=ephemeris)"},{"col":0,"comment":"\n    Convert Skycoord in GCRS frame into one in which RA and Dec\n    are defined w.r.t to the true equinox and poles of the Earth\n    ","endLoc":540,"header":"@deprecated('4.2', deprecation_msg)\ndef _apparent_position_in_true_coordinates(skycoord)","id":15237,"name":"_apparent_position_in_true_coordinates","nodeType":"Function","startLoc":526,"text":"@deprecated('4.2', deprecation_msg)\ndef _apparent_position_in_true_coordinates(skycoord):\n    \"\"\"\n    Convert Skycoord in GCRS frame into one in which RA and Dec\n    are defined w.r.t to the true equinox and poles of the Earth\n    \"\"\"\n    location = getattr(skycoord, 'location', None)\n    if location is None:\n        gcrs_rep = skycoord.obsgeoloc.with_differentials(\n            {'s': CartesianDifferential.from_cartesian(skycoord.obsgeovel)})\n        location = (GCRS(gcrs_rep, obstime=skycoord.obstime)\n                    .transform_to(ITRS(obstime=skycoord.obstime))\n                    .earth_location)\n    tete_frame = TETE(obstime=skycoord.obstime, location=location)\n    return skycoord.transform_to(tete_frame)"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":15238,"name":"__all__","nodeType":"Attribute","startLoc":26,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":174,"id":15239,"name":"_constellation_data","nodeType":"Attribute","startLoc":174,"text":"_constellation_data"},{"className":"SkyCoordInfo","col":0,"comment":"\n    Container for meta information like name, description, format.  This is\n    required when the object is used as a mixin column within a table, but can\n    be used as a general way to store meta information.\n    ","endLoc":158,"id":15240,"nodeType":"Class","startLoc":34,"text":"class SkyCoordInfo(MixinInfo):\n    \"\"\"\n    Container for meta information like name, description, format.  This is\n    required when the object is used as a mixin column within a table, but can\n    be used as a general way to store meta information.\n    \"\"\"\n    attrs_from_parent = set(['unit'])  # Unit is read-only\n    _supports_indexing = False\n\n    @staticmethod\n    def default_format(val):\n        repr_data = val.info._repr_data\n        formats = ['{0.' + compname + '.value:}' for compname\n                   in repr_data.components]\n        return ','.join(formats).format(repr_data)\n\n    @property\n    def unit(self):\n        repr_data = self._repr_data\n        unit = ','.join(str(getattr(repr_data, comp).unit) or 'None'\n                        for comp in repr_data.components)\n        return unit\n\n    @property\n    def _repr_data(self):\n        if self._parent is None:\n            return None\n\n        sc = self._parent\n        if (issubclass(sc.representation_type, SphericalRepresentation)\n                and isinstance(sc.data, UnitSphericalRepresentation)):\n            repr_data = sc.represent_as(sc.data.__class__, in_frame_units=True)\n        else:\n            repr_data = sc.represent_as(sc.representation_type,\n                                        in_frame_units=True)\n        return repr_data\n\n    def _represent_as_dict(self):\n        sc = self._parent\n        attrs = list(sc.representation_component_names)\n\n        # Don't output distance unless it's actually distance.\n        if isinstance(sc.data, UnitSphericalRepresentation):\n            attrs = attrs[:-1]\n\n        diff = sc.data.differentials.get('s')\n        if diff is not None:\n            diff_attrs = list(sc.get_representation_component_names('s'))\n            # Don't output proper motions if they haven't been specified.\n            if isinstance(diff, RadialDifferential):\n                diff_attrs = diff_attrs[2:]\n            # Don't output radial velocity unless it's actually velocity.\n            elif isinstance(diff, (UnitSphericalDifferential,\n                                   UnitSphericalCosLatDifferential)):\n                diff_attrs = diff_attrs[:-1]\n            attrs.extend(diff_attrs)\n\n        attrs.extend(frame_transform_graph.frame_attributes.keys())\n\n        out = super()._represent_as_dict(attrs)\n\n        out['representation_type'] = sc.representation_type.get_name()\n        out['frame'] = sc.frame.name\n        # Note that sc.info.unit is a fake composite unit (e.g. 'deg,deg,None'\n        # or None,None,m) and is not stored.  The individual attributes have\n        # units.\n\n        return out\n\n    def new_like(self, skycoords, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new SkyCoord instance which is consistent with the input\n        SkyCoord objects ``skycoords`` and has ``length`` rows.  Being\n        \"consistent\" is defined as being able to set an item from one to each of\n        the rest without any exception being raised.\n\n        This is intended for creating a new SkyCoord instance whose elements can\n        be set in-place for table operations like join or vstack.  This is used\n        when a SkyCoord object is used as a mixin column in an astropy Table.\n\n        The data values are not predictable and it is expected that the consumer\n        of the object will fill in all values.\n\n        Parameters\n        ----------\n        skycoords : list\n            List of input SkyCoord objects\n        length : int\n            Length of the output skycoord object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output name (sets output skycoord.info.name)\n\n        Returns\n        -------\n        skycoord : SkyCoord (or subclass)\n            Instance of this class consistent with ``skycoords``\n\n        \"\"\"\n        # Get merged info attributes like shape, dtype, format, description, etc.\n        attrs = self.merge_cols_attributes(skycoords, metadata_conflicts, name,\n                                           ('meta', 'description'))\n        skycoord0 = skycoords[0]\n\n        # Make a new SkyCoord object with the desired length and attributes\n        # by using the _apply / __getitem__ machinery to effectively return\n        # skycoord0[[0, 0, ..., 0, 0]]. This will have the all the right frame\n        # attributes with the right shape.\n        indexes = np.zeros(length, dtype=np.int64)\n        out = skycoord0[indexes]\n\n        # Use __setitem__ machinery to check for consistency of all skycoords\n        for skycoord in skycoords[1:]:\n            try:\n                out[0] = skycoord[0]\n            except Exception as err:\n                raise ValueError(f'Input skycoords are inconsistent.') from err\n\n        # Set (merged) info attributes\n        for attr in ('name', 'meta', 'description'):\n            if attr in attrs:\n                setattr(out.info, attr, attrs[attr])\n\n        return out"},{"col":0,"comment":"","endLoc":9,"header":"funcs.py#<anonymous>","id":15241,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module contains convenience functions for coordinate-related functionality.\n\nThis is generally just wrapping around the object-oriented coordinates\nframework, but it is useful for some users who are used to more functional\ninterfaces.\n\"\"\"\n\n__all__ = ['cartesian_to_spherical', 'spherical_to_cartesian', 'get_sun',\n           'get_constellation', 'concatenate_representations', 'concatenate']\n\n_constellation_data = {}"},{"col":4,"comment":"null","endLoc":48,"header":"@staticmethod\n    def default_format(val)","id":15242,"name":"default_format","nodeType":"Function","startLoc":43,"text":"@staticmethod\n    def default_format(val):\n        repr_data = val.info._repr_data\n        formats = ['{0.' + compname + '.value:}' for compname\n                   in repr_data.components]\n        return ','.join(formats).format(repr_data)"},{"col":4,"comment":"null","endLoc":55,"header":"@property\n    def unit(self)","id":15243,"name":"unit","nodeType":"Function","startLoc":50,"text":"@property\n    def unit(self):\n        repr_data = self._repr_data\n        unit = ','.join(str(getattr(repr_data, comp).unit) or 'None'\n                        for comp in repr_data.components)\n        return unit"},{"col":4,"comment":"null","endLoc":69,"header":"@property\n    def _repr_data(self)","id":15244,"name":"_repr_data","nodeType":"Function","startLoc":57,"text":"@property\n    def _repr_data(self):\n        if self._parent is None:\n            return None\n\n        sc = self._parent\n        if (issubclass(sc.representation_type, SphericalRepresentation)\n                and isinstance(sc.data, UnitSphericalRepresentation)):\n            repr_data = sc.represent_as(sc.data.__class__, in_frame_units=True)\n        else:\n            repr_data = sc.represent_as(sc.representation_type,\n                                        in_frame_units=True)\n        return repr_data"},{"attributeType":"null","col":8,"comment":"null","endLoc":144,"id":15245,"name":"second","nodeType":"Attribute","startLoc":144,"text":"self.second"},{"className":"IllegalSecondError","col":0,"comment":"\n    Raised when an second value (time) is not in the range [0,60].\n\n    Parameters\n    ----------\n    second : int, float\n\n    Examples\n    --------\n\n    .. code-block:: python\n\n        if not 0 <= sec < 60:\n            raise IllegalSecondError(second)\n    ","endLoc":132,"id":15246,"nodeType":"Class","startLoc":112,"text":"class IllegalSecondError(RangeError):\n    \"\"\"\n    Raised when an second value (time) is not in the range [0,60].\n\n    Parameters\n    ----------\n    second : int, float\n\n    Examples\n    --------\n\n    .. code-block:: python\n\n        if not 0 <= sec < 60:\n            raise IllegalSecondError(second)\n    \"\"\"\n    def __init__(self, second):\n        self.second = second\n\n    def __str__(self):\n        return f\"An invalid value for 'second' was found ('{self.second}'); should be in the range [0,60).\""},{"col":4,"comment":"\n        Context manager to impose a finite-difference time step on all applicable transformations\n\n        For each transformation in this transformation graph that has the attribute\n        ``finite_difference_dt``, that attribute is set to the provided value.  The only standard\n        transformation with this attribute is\n        `~astropy.coordinates.transformations.FunctionTransformWithFiniteDifference`.\n\n        Parameters\n        ----------\n        dt : `~astropy.units.Quantity` ['time'] or callable\n            If a quantity, this is the size of the differential used to do the finite difference.\n            If a callable, should accept ``(fromcoord, toframe)`` and return the ``dt`` value.\n        ","endLoc":762,"header":"@contextmanager\n    def impose_finite_difference_dt(self, dt)","id":15247,"name":"impose_finite_difference_dt","nodeType":"Function","startLoc":733,"text":"@contextmanager\n    def impose_finite_difference_dt(self, dt):\n        \"\"\"\n        Context manager to impose a finite-difference time step on all applicable transformations\n\n        For each transformation in this transformation graph that has the attribute\n        ``finite_difference_dt``, that attribute is set to the provided value.  The only standard\n        transformation with this attribute is\n        `~astropy.coordinates.transformations.FunctionTransformWithFiniteDifference`.\n\n        Parameters\n        ----------\n        dt : `~astropy.units.Quantity` ['time'] or callable\n            If a quantity, this is the size of the differential used to do the finite difference.\n            If a callable, should accept ``(fromcoord, toframe)`` and return the ``dt`` value.\n        \"\"\"\n        key = 'finite_difference_dt'\n        saved_settings = []\n\n        try:\n            for to_frames in self._graph.values():\n                for transform in to_frames.values():\n                    if hasattr(transform, key):\n                        old_setting = (transform, key, getattr(transform, key))\n                        saved_settings.append(old_setting)\n                        setattr(transform, key, dt)\n            yield\n        finally:\n            for setting in saved_settings:\n                setattr(*setting)"},{"col":4,"comment":"null","endLoc":132,"header":"def __str__(self)","id":15248,"name":"__str__","nodeType":"Function","startLoc":131,"text":"def __str__(self):\n        return f\"An invalid value for 'second' was found ('{self.second}'); should be in the range [0,60).\""},{"col":4,"comment":"null","endLoc":101,"header":"def _represent_as_dict(self)","id":15249,"name":"_represent_as_dict","nodeType":"Function","startLoc":71,"text":"def _represent_as_dict(self):\n        sc = self._parent\n        attrs = list(sc.representation_component_names)\n\n        # Don't output distance unless it's actually distance.\n        if isinstance(sc.data, UnitSphericalRepresentation):\n            attrs = attrs[:-1]\n\n        diff = sc.data.differentials.get('s')\n        if diff is not None:\n            diff_attrs = list(sc.get_representation_component_names('s'))\n            # Don't output proper motions if they haven't been specified.\n            if isinstance(diff, RadialDifferential):\n                diff_attrs = diff_attrs[2:]\n            # Don't output radial velocity unless it's actually velocity.\n            elif isinstance(diff, (UnitSphericalDifferential,\n                                   UnitSphericalCosLatDifferential)):\n                diff_attrs = diff_attrs[:-1]\n            attrs.extend(diff_attrs)\n\n        attrs.extend(frame_transform_graph.frame_attributes.keys())\n\n        out = super()._represent_as_dict(attrs)\n\n        out['representation_type'] = sc.representation_type.get_name()\n        out['frame'] = sc.frame.name\n        # Note that sc.info.unit is a fake composite unit (e.g. 'deg,deg,None'\n        # or None,None,m) and is not stored.  The individual attributes have\n        # units.\n\n        return out"},{"attributeType":"null","col":8,"comment":"null","endLoc":129,"id":15250,"name":"second","nodeType":"Attribute","startLoc":129,"text":"self.second"},{"fileName":"baseframe.py","filePath":"astropy/coordinates","id":15251,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nFramework and base classes for coordinate frames/\"low-level\" coordinate\nclasses.\n\"\"\"\n\n\n# Standard library\nimport copy\nimport inspect\nfrom collections import namedtuple, defaultdict\nimport warnings\n\n# Dependencies\nimport numpy as np\n\n# Project\nfrom astropy.utils.compat.misc import override__dir__\nfrom astropy.utils.decorators import lazyproperty, format_doc\nfrom astropy.utils.exceptions import AstropyWarning, AstropyDeprecationWarning\nfrom astropy import units as u\nfrom astropy.utils import ShapedLikeNDArray, check_broadcast\nfrom .transformations import TransformGraph\nfrom . import representation as r\nfrom .angles import Angle\nfrom .attributes import Attribute\n\n\n__all__ = ['BaseCoordinateFrame', 'frame_transform_graph',\n           'GenericFrame', 'RepresentationMapping']\n\n\n# the graph used for all transformations between frames\nframe_transform_graph = TransformGraph()\n\n\ndef _get_repr_cls(value):\n    \"\"\"\n    Return a valid representation class from ``value`` or raise exception.\n    \"\"\"\n\n    if value in r.REPRESENTATION_CLASSES:\n        value = r.REPRESENTATION_CLASSES[value]\n    elif (not isinstance(value, type) or\n          not issubclass(value, r.BaseRepresentation)):\n        raise ValueError(\n            'Representation is {!r} but must be a BaseRepresentation class '\n            'or one of the string aliases {}'.format(\n                value, list(r.REPRESENTATION_CLASSES)))\n    return value\n\n\ndef _get_diff_cls(value):\n    \"\"\"\n    Return a valid differential class from ``value`` or raise exception.\n\n    As originally created, this is only used in the SkyCoord initializer, so if\n    that is refactored, this function my no longer be necessary.\n    \"\"\"\n\n    if value in r.DIFFERENTIAL_CLASSES:\n        value = r.DIFFERENTIAL_CLASSES[value]\n    elif (not isinstance(value, type) or\n          not issubclass(value, r.BaseDifferential)):\n        raise ValueError(\n            'Differential is {!r} but must be a BaseDifferential class '\n            'or one of the string aliases {}'.format(\n                value, list(r.DIFFERENTIAL_CLASSES)))\n    return value\n\n\ndef _get_repr_classes(base, **differentials):\n    \"\"\"Get valid representation and differential classes.\n\n    Parameters\n    ----------\n    base : str or `~astropy.coordinates.BaseRepresentation` subclass\n        class for the representation of the base coordinates.  If a string,\n        it is looked up among the known representation classes.\n    **differentials : dict of str or `~astropy.coordinates.BaseDifferentials`\n        Keys are like for normal differentials, i.e., 's' for a first\n        derivative in time, etc.  If an item is set to `None`, it will be\n        guessed from the base class.\n\n    Returns\n    -------\n    repr_classes : dict of subclasses\n        The base class is keyed by 'base'; the others by the keys of\n        ``diffferentials``.\n    \"\"\"\n    base = _get_repr_cls(base)\n    repr_classes = {'base': base}\n\n    for name, differential_type in differentials.items():\n        if differential_type == 'base':\n            # We don't want to fail for this case.\n            differential_type = r.DIFFERENTIAL_CLASSES.get(base.get_name(), None)\n\n        elif differential_type in r.DIFFERENTIAL_CLASSES:\n            differential_type = r.DIFFERENTIAL_CLASSES[differential_type]\n\n        elif (differential_type is not None\n              and (not isinstance(differential_type, type)\n                   or not issubclass(differential_type, r.BaseDifferential))):\n            raise ValueError(\n                'Differential is {!r} but must be a BaseDifferential class '\n                'or one of the string aliases {}'.format(\n                    differential_type, list(r.DIFFERENTIAL_CLASSES)))\n        repr_classes[name] = differential_type\n    return repr_classes\n\n\n_RepresentationMappingBase = \\\n    namedtuple('RepresentationMapping',\n               ('reprname', 'framename', 'defaultunit'))\n\n\nclass RepresentationMapping(_RepresentationMappingBase):\n    \"\"\"\n    This `~collections.namedtuple` is used with the\n    ``frame_specific_representation_info`` attribute to tell frames what\n    attribute names (and default units) to use for a particular representation.\n    ``reprname`` and ``framename`` should be strings, while ``defaultunit`` can\n    be either an astropy unit, the string ``'recommended'`` (which is degrees\n    for Angles, nothing otherwise), or None (to indicate that no unit mapping\n    should be done).\n    \"\"\"\n\n    def __new__(cls, reprname, framename, defaultunit='recommended'):\n        # this trick just provides some defaults\n        return super().__new__(cls, reprname, framename, defaultunit)\n\n\nbase_doc = \"\"\"{__doc__}\n    Parameters\n    ----------\n    data : `~astropy.coordinates.BaseRepresentation` subclass instance\n        A representation object or ``None`` to have no data (or use the\n        coordinate component arguments, see below).\n    {components}\n    representation_type : `~astropy.coordinates.BaseRepresentation` subclass, str, optional\n        A representation class or string name of a representation class. This\n        sets the expected input representation class, thereby changing the\n        expected keyword arguments for the data passed in. For example, passing\n        ``representation_type='cartesian'`` will make the classes expect\n        position data with cartesian names, i.e. ``x, y, z`` in most cases\n        unless overridden via ``frame_specific_representation_info``. To see this\n        frame's names, check out ``<this frame>().representation_info``.\n    differential_type : `~astropy.coordinates.BaseDifferential` subclass, str, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets the\n        expected input differential class, thereby changing the expected keyword\n        arguments of the data passed in. For example, passing\n        ``differential_type='cartesian'`` will make the classes expect velocity\n        data with the argument names ``v_x, v_y, v_z`` unless overridden via\n        ``frame_specific_representation_info``. To see this frame's names,\n        check out ``<this frame>().representation_info``.\n    copy : bool, optional\n        If `True` (default), make copies of the input coordinate arrays.\n        Can only be passed in as a keyword argument.\n    {footer}\n\"\"\"\n\n_components = \"\"\"\n    *args, **kwargs\n        Coordinate components, with names that depend on the subclass.\n\"\"\"\n\n\n@format_doc(base_doc, components=_components, footer=\"\")\nclass BaseCoordinateFrame(ShapedLikeNDArray):\n    \"\"\"\n    The base class for coordinate frames.\n\n    This class is intended to be subclassed to create instances of specific\n    systems.  Subclasses can implement the following attributes:\n\n    * `default_representation`\n        A subclass of `~astropy.coordinates.BaseRepresentation` that will be\n        treated as the default representation of this frame.  This is the\n        representation assumed by default when the frame is created.\n\n    * `default_differential`\n        A subclass of `~astropy.coordinates.BaseDifferential` that will be\n        treated as the default differential class of this frame.  This is the\n        differential class assumed by default when the frame is created.\n\n    * `~astropy.coordinates.Attribute` class attributes\n       Frame attributes such as ``FK4.equinox`` or ``FK4.obstime`` are defined\n       using a descriptor class.  See the narrative documentation or\n       built-in classes code for details.\n\n    * `frame_specific_representation_info`\n        A dictionary mapping the name or class of a representation to a list of\n        `~astropy.coordinates.RepresentationMapping` objects that tell what\n        names and default units should be used on this frame for the components\n        of that representation.\n\n    Unless overridden via `frame_specific_representation_info`, velocity name\n    defaults are:\n\n      * ``pm_{lon}_cos{lat}``, ``pm_{lat}`` for `SphericalCosLatDifferential`\n        proper motion components\n      * ``pm_{lon}``, ``pm_{lat}`` for `SphericalDifferential` proper motion\n        components\n      * ``radial_velocity`` for any ``d_distance`` component\n      * ``v_{x,y,z}`` for `CartesianDifferential` velocity components\n\n    where ``{lon}`` and ``{lat}`` are the frame names of the angular components.\n    \"\"\"\n\n    default_representation = None\n    default_differential = None\n\n    # Specifies special names and units for representation and differential\n    # attributes.\n    frame_specific_representation_info = {}\n\n    frame_attributes = {}\n    # Default empty frame_attributes dict\n\n    def __init_subclass__(cls, **kwargs):\n\n        # We first check for explicitly set values for these:\n        default_repr = getattr(cls, 'default_representation', None)\n        default_diff = getattr(cls, 'default_differential', None)\n        repr_info = getattr(cls, 'frame_specific_representation_info', None)\n        # Then, to make sure this works for subclasses-of-subclasses, we also\n        # have to check for cases where the attribute names have already been\n        # replaced by underscore-prefaced equivalents by the logic below:\n        if default_repr is None or isinstance(default_repr, property):\n            default_repr = getattr(cls, '_default_representation', None)\n\n        if default_diff is None or isinstance(default_diff, property):\n            default_diff = getattr(cls, '_default_differential', None)\n\n        if repr_info is None or isinstance(repr_info, property):\n            repr_info = getattr(cls, '_frame_specific_representation_info', None)\n\n        repr_info = cls._infer_repr_info(repr_info)\n\n        # Make read-only properties for the frame class attributes that should\n        # be read-only to make them immutable after creation.\n        # We copy attributes instead of linking to make sure there's no\n        # accidental cross-talk between classes\n        cls._create_readonly_property('default_representation', default_repr,\n                                      'Default representation for position data')\n        cls._create_readonly_property('default_differential', default_diff,\n                                      'Default representation for differential data '\n                                      '(e.g., velocity)')\n        cls._create_readonly_property('frame_specific_representation_info',\n                                      copy.deepcopy(repr_info),\n                                      'Mapping for frame-specific component names')\n\n        # Set the frame attributes. We first construct the attributes from\n        # superclasses, going in reverse order to keep insertion order,\n        # and then add any attributes from the frame now being defined\n        # (if any old definitions are overridden, this keeps the order).\n        # Note that we cannot simply start with the inherited frame_attributes\n        # since we could be a mixin between multiple coordinate frames.\n        # TODO: Should this be made to use readonly_prop_factory as well or\n        # would it be inconvenient for getting the frame_attributes from\n        # classes?\n        frame_attrs = {}\n        for basecls in reversed(cls.__bases__):\n            if issubclass(basecls, BaseCoordinateFrame):\n                frame_attrs.update(basecls.frame_attributes)\n\n        for k, v in cls.__dict__.items():\n            if isinstance(v, Attribute):\n                frame_attrs[k] = v\n\n        cls.frame_attributes = frame_attrs\n\n        # Deal with setting the name of the frame:\n        if not hasattr(cls, 'name'):\n            cls.name = cls.__name__.lower()\n        elif (BaseCoordinateFrame not in cls.__bases__ and\n                cls.name in [getattr(base, 'name', None)\n                             for base in cls.__bases__]):\n            # This may be a subclass of a subclass of BaseCoordinateFrame,\n            # like ICRS(BaseRADecFrame). In this case, cls.name will have been\n            # set by init_subclass\n            cls.name = cls.__name__.lower()\n\n        # A cache that *must be unique to each frame class* - it is\n        # insufficient to share them with superclasses, hence the need to put\n        # them in the meta\n        cls._frame_class_cache = {}\n\n        super().__init_subclass__(**kwargs)\n\n    def __init__(self, *args, copy=True, representation_type=None,\n                 differential_type=None, **kwargs):\n        self._attr_names_with_defaults = []\n\n        self._representation = self._infer_representation(representation_type, differential_type)\n        self._data = self._infer_data(args, copy, kwargs)  # possibly None.\n\n        # Set frame attributes, if any\n\n        values = {}\n        for fnm, fdefault in self.get_frame_attr_names().items():\n            # Read-only frame attributes are defined as FrameAttribute\n            # descriptors which are not settable, so set 'real' attributes as\n            # the name prefaced with an underscore.\n\n            if fnm in kwargs:\n                value = kwargs.pop(fnm)\n                setattr(self, '_' + fnm, value)\n                # Validate attribute by getting it. If the instance has data,\n                # this also checks its shape is OK. If not, we do it below.\n                values[fnm] = getattr(self, fnm)\n            else:\n                setattr(self, '_' + fnm, fdefault)\n                self._attr_names_with_defaults.append(fnm)\n\n        if kwargs:\n            raise TypeError(\n                f'Coordinate frame {self.__class__.__name__} got unexpected '\n                f'keywords: {list(kwargs)}')\n\n        # We do ``is None`` because self._data might evaluate to false for\n        # empty arrays or data == 0\n        if self._data is None:\n            # No data: we still need to check that any non-scalar attributes\n            # have consistent shapes. Collect them for all attributes with\n            # size > 1 (which should be array-like and thus have a shape).\n            shapes = {fnm: value.shape for fnm, value in values.items()\n                      if getattr(value, 'shape', ())}\n            if shapes:\n                if len(shapes) > 1:\n                    try:\n                        self._no_data_shape = check_broadcast(*shapes.values())\n                    except ValueError as err:\n                        raise ValueError(\n                            f\"non-scalar attributes with inconsistent shapes: {shapes}\") from err\n\n                    # Above, we checked that it is possible to broadcast all\n                    # shapes.  By getting and thus validating the attributes,\n                    # we verify that the attributes can in fact be broadcast.\n                    for fnm in shapes:\n                        getattr(self, fnm)\n                else:\n                    self._no_data_shape = shapes.popitem()[1]\n\n            else:\n                self._no_data_shape = ()\n\n        # The logic of this block is not related to the previous one\n        if self._data is not None:\n            # This makes the cache keys backwards-compatible, but also adds\n            # support for having differentials attached to the frame data\n            # representation object.\n            if 's' in self._data.differentials:\n                # TODO: assumes a velocity unit differential\n                key = (self._data.__class__.__name__,\n                       self._data.differentials['s'].__class__.__name__,\n                       False)\n            else:\n                key = (self._data.__class__.__name__, False)\n\n            # Set up representation cache.\n            self.cache['representation'][key] = self._data\n\n    def _infer_representation(self, representation_type, differential_type):\n        if representation_type is None and differential_type is None:\n            return {'base': self.default_representation, 's': self.default_differential}\n\n        if representation_type is None:\n            representation_type = self.default_representation\n\n        if (inspect.isclass(differential_type)\n                and issubclass(differential_type, r.BaseDifferential)):\n            # TODO: assumes the differential class is for the velocity\n            # differential\n            differential_type = {'s': differential_type}\n\n        elif isinstance(differential_type, str):\n            # TODO: assumes the differential class is for the velocity\n            # differential\n            diff_cls = r.DIFFERENTIAL_CLASSES[differential_type]\n            differential_type = {'s': diff_cls}\n\n        elif differential_type is None:\n            if representation_type == self.default_representation:\n                differential_type = {'s': self.default_differential}\n            else:\n                differential_type = {'s': 'base'}  # see set_representation_cls()\n\n        return _get_repr_classes(representation_type, **differential_type)\n\n    def _infer_data(self, args, copy, kwargs):\n        # if not set below, this is a frame with no data\n        representation_data = None\n        differential_data = None\n\n        args = list(args)  # need to be able to pop them\n        if (len(args) > 0) and (isinstance(args[0], r.BaseRepresentation) or\n                                args[0] is None):\n            representation_data = args.pop(0)  # This can still be None\n            if len(args) > 0:\n                raise TypeError(\n                    'Cannot create a frame with both a representation object '\n                    'and other positional arguments')\n\n            if representation_data is not None:\n                diffs = representation_data.differentials\n                differential_data = diffs.get('s', None)\n                if ((differential_data is None and len(diffs) > 0) or\n                        (differential_data is not None and len(diffs) > 1)):\n                    raise ValueError('Multiple differentials are associated '\n                                     'with the representation object passed in '\n                                     'to the frame initializer. Only a single '\n                                     'velocity differential is supported. Got: '\n                                     '{}'.format(diffs))\n\n        else:\n            representation_cls = self.get_representation_cls()\n            # Get any representation data passed in to the frame initializer\n            # using keyword or positional arguments for the component names\n            repr_kwargs = {}\n            for nmkw, nmrep in self.representation_component_names.items():\n                if len(args) > 0:\n                    # first gather up positional args\n                    repr_kwargs[nmrep] = args.pop(0)\n                elif nmkw in kwargs:\n                    repr_kwargs[nmrep] = kwargs.pop(nmkw)\n\n            # special-case the Spherical->UnitSpherical if no `distance`\n\n            if repr_kwargs:\n                # TODO: determine how to get rid of the part before the \"try\" -\n                # currently removing it has a performance regression for\n                # unitspherical because of the try-related overhead.\n                # Also frames have no way to indicate what the \"distance\" is\n                if repr_kwargs.get('distance', True) is None:\n                    del repr_kwargs['distance']\n\n                if (issubclass(representation_cls,\n                               r.SphericalRepresentation)\n                        and 'distance' not in repr_kwargs):\n                    representation_cls = representation_cls._unit_representation\n\n                try:\n                    representation_data = representation_cls(copy=copy,\n                                                             **repr_kwargs)\n                except TypeError as e:\n                    # this except clause is here to make the names of the\n                    # attributes more human-readable.  Without this the names\n                    # come from the representation instead of the frame's\n                    # attribute names.\n                    try:\n                        representation_data = (\n                            representation_cls._unit_representation(\n                                copy=copy, **repr_kwargs))\n                    except Exception:\n                        msg = str(e)\n                        names = self.get_representation_component_names()\n                        for frame_name, repr_name in names.items():\n                            msg = msg.replace(repr_name, frame_name)\n                        msg = msg.replace('__init__()',\n                                          f'{self.__class__.__name__}()')\n                        e.args = (msg,)\n                        raise e\n\n            # Now we handle the Differential data:\n            # Get any differential data passed in to the frame initializer\n            # using keyword or positional arguments for the component names\n            differential_cls = self.get_representation_cls('s')\n            diff_component_names = self.get_representation_component_names('s')\n            diff_kwargs = {}\n            for nmkw, nmrep in diff_component_names.items():\n                if len(args) > 0:\n                    # first gather up positional args\n                    diff_kwargs[nmrep] = args.pop(0)\n                elif nmkw in kwargs:\n                    diff_kwargs[nmrep] = kwargs.pop(nmkw)\n\n            if diff_kwargs:\n                if (hasattr(differential_cls, '_unit_differential')\n                        and 'd_distance' not in diff_kwargs):\n                    differential_cls = differential_cls._unit_differential\n\n                elif len(diff_kwargs) == 1 and 'd_distance' in diff_kwargs:\n                    differential_cls = r.RadialDifferential\n\n                try:\n                    differential_data = differential_cls(copy=copy,\n                                                         **diff_kwargs)\n                except TypeError as e:\n                    # this except clause is here to make the names of the\n                    # attributes more human-readable.  Without this the names\n                    # come from the representation instead of the frame's\n                    # attribute names.\n                    msg = str(e)\n                    names = self.get_representation_component_names('s')\n                    for frame_name, repr_name in names.items():\n                        msg = msg.replace(repr_name, frame_name)\n                    msg = msg.replace('__init__()',\n                                      f'{self.__class__.__name__}()')\n                    e.args = (msg,)\n                    raise\n\n        if len(args) > 0:\n            raise TypeError(\n                '{}.__init__ had {} remaining unhandled arguments'.format(\n                    self.__class__.__name__, len(args)))\n\n        if representation_data is None and differential_data is not None:\n            raise ValueError(\"Cannot pass in differential component data \"\n                             \"without positional (representation) data.\")\n\n        if differential_data:\n            # Check that differential data provided has units compatible\n            # with time-derivative of representation data.\n            # NOTE: there is no dimensionless time while lengths can be\n            # dimensionless (u.dimensionless_unscaled).\n            for comp in representation_data.components:\n                if (diff_comp := f'd_{comp}') in differential_data.components:\n                    current_repr_unit = representation_data._units[comp]\n                    current_diff_unit = differential_data._units[diff_comp]\n                    expected_unit = current_repr_unit / u.s\n                    if not current_diff_unit.is_equivalent(expected_unit):\n                        for key, val in self.get_representation_component_names().items():\n                            if val == comp:\n                                current_repr_name = key\n                                break\n                        for key, val in self.get_representation_component_names('s').items():\n                            if val == diff_comp:\n                                current_diff_name = key\n                                break\n                        raise ValueError(\n                            f'{current_repr_name} has unit \"{current_repr_unit}\" with physical '\n                            f'type \"{current_repr_unit.physical_type}\", but {current_diff_name} '\n                            f'has incompatible unit \"{current_diff_unit}\" with physical type '\n                            f'\"{current_diff_unit.physical_type}\" instead of the expected '\n                            f'\"{(expected_unit).physical_type}\".')\n\n            representation_data = representation_data.with_differentials({'s': differential_data})\n\n        return representation_data\n\n    @classmethod\n    def _infer_repr_info(cls, repr_info):\n        # Unless overridden via `frame_specific_representation_info`, velocity\n        # name defaults are (see also docstring for BaseCoordinateFrame):\n        #   * ``pm_{lon}_cos{lat}``, ``pm_{lat}`` for\n        #     `SphericalCosLatDifferential` proper motion components\n        #   * ``pm_{lon}``, ``pm_{lat}`` for `SphericalDifferential` proper\n        #     motion components\n        #   * ``radial_velocity`` for any `d_distance` component\n        #   * ``v_{x,y,z}`` for `CartesianDifferential` velocity components\n        # where `{lon}` and `{lat}` are the frame names of the angular\n        # components.\n        if repr_info is None:\n            repr_info = {}\n\n        # the tuple() call below is necessary because if it is not there,\n        # the iteration proceeds in a difficult-to-predict manner in the\n        # case that one of the class objects hash is such that it gets\n        # revisited by the iteration.  The tuple() call prevents this by\n        # making the items iterated over fixed regardless of how the dict\n        # changes\n        for cls_or_name in tuple(repr_info.keys()):\n            if isinstance(cls_or_name, str):\n                # TODO: this provides a layer of backwards compatibility in\n                # case the key is a string, but now we want explicit classes.\n                _cls = _get_repr_cls(cls_or_name)\n                repr_info[_cls] = repr_info.pop(cls_or_name)\n\n        # The default spherical names are 'lon' and 'lat'\n        repr_info.setdefault(r.SphericalRepresentation,\n                             [RepresentationMapping('lon', 'lon'),\n                              RepresentationMapping('lat', 'lat')])\n\n        sph_component_map = {m.reprname: m.framename\n                             for m in repr_info[r.SphericalRepresentation]}\n\n        repr_info.setdefault(r.SphericalCosLatDifferential, [\n            RepresentationMapping(\n                'd_lon_coslat',\n                'pm_{lon}_cos{lat}'.format(**sph_component_map),\n                u.mas/u.yr),\n            RepresentationMapping('d_lat',\n                                  'pm_{lat}'.format(**sph_component_map),\n                                  u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity',\n                                  u.km/u.s)\n        ])\n\n        repr_info.setdefault(r.SphericalDifferential, [\n            RepresentationMapping('d_lon',\n                                  'pm_{lon}'.format(**sph_component_map),\n                                  u.mas/u.yr),\n            RepresentationMapping('d_lat',\n                                  'pm_{lat}'.format(**sph_component_map),\n                                  u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity',\n                                  u.km/u.s)\n        ])\n\n        repr_info.setdefault(r.CartesianDifferential, [\n            RepresentationMapping('d_x', 'v_x', u.km/u.s),\n            RepresentationMapping('d_y', 'v_y', u.km/u.s),\n            RepresentationMapping('d_z', 'v_z', u.km/u.s)])\n\n        # Unit* classes should follow the same naming conventions\n        # TODO: this adds some unnecessary mappings for the Unit classes, so\n        # this could be cleaned up, but in practice doesn't seem to have any\n        # negative side effects\n        repr_info.setdefault(r.UnitSphericalRepresentation,\n                             repr_info[r.SphericalRepresentation])\n\n        repr_info.setdefault(r.UnitSphericalCosLatDifferential,\n                             repr_info[r.SphericalCosLatDifferential])\n\n        repr_info.setdefault(r.UnitSphericalDifferential,\n                             repr_info[r.SphericalDifferential])\n\n        return repr_info\n\n    @classmethod\n    def _create_readonly_property(cls, attr_name, value, doc=None):\n        private_attr = '_' + attr_name\n\n        def getter(self):\n            return getattr(self, private_attr)\n\n        setattr(cls, private_attr, value)\n        setattr(cls, attr_name, property(getter, doc=doc))\n\n    @lazyproperty\n    def cache(self):\n        \"\"\"\n        Cache for this frame, a dict.  It stores anything that should be\n        computed from the coordinate data (*not* from the frame attributes).\n        This can be used in functions to store anything that might be\n        expensive to compute but might be re-used by some other function.\n        E.g.::\n\n            if 'user_data' in myframe.cache:\n                data = myframe.cache['user_data']\n            else:\n                myframe.cache['user_data'] = data = expensive_func(myframe.lat)\n\n        If in-place modifications are made to the frame data, the cache should\n        be cleared::\n\n            myframe.cache.clear()\n\n        \"\"\"\n        return defaultdict(dict)\n\n    @property\n    def data(self):\n        \"\"\"\n        The coordinate data for this object.  If this frame has no data, an\n        `ValueError` will be raised.  Use `has_data` to\n        check if data is present on this frame object.\n        \"\"\"\n        if self._data is None:\n            raise ValueError('The frame object \"{!r}\" does not have '\n                             'associated data'.format(self))\n        return self._data\n\n    @property\n    def has_data(self):\n        \"\"\"\n        True if this frame has `data`, False otherwise.\n        \"\"\"\n        return self._data is not None\n\n    @property\n    def shape(self):\n        return self.data.shape if self.has_data else self._no_data_shape\n\n    # We have to override the ShapedLikeNDArray definitions, since our shape\n    # does not have to be that of the data.\n    def __len__(self):\n        return len(self.data)\n\n    def __bool__(self):\n        return self.has_data and self.size > 0\n\n    @property\n    def size(self):\n        return self.data.size\n\n    @property\n    def isscalar(self):\n        return self.has_data and self.data.isscalar\n\n    @classmethod\n    def get_frame_attr_names(cls):\n        return {name: getattr(cls, name)\n                for name in cls.frame_attributes}\n\n    def get_representation_cls(self, which='base'):\n        \"\"\"The class used for part of this frame's data.\n\n        Parameters\n        ----------\n        which : ('base', 's', `None`)\n            The class of which part to return.  'base' means the class used to\n            represent the coordinates; 's' the first derivative to time, i.e.,\n            the class representing the proper motion and/or radial velocity.\n            If `None`, return a dict with both.\n\n        Returns\n        -------\n        representation : `~astropy.coordinates.BaseRepresentation` or `~astropy.coordinates.BaseDifferential`.\n        \"\"\"\n        if which is not None:\n            return self._representation[which]\n        else:\n            return self._representation\n\n    def set_representation_cls(self, base=None, s='base'):\n        \"\"\"Set representation and/or differential class for this frame's data.\n\n        Parameters\n        ----------\n        base : str, `~astropy.coordinates.BaseRepresentation` subclass, optional\n            The name or subclass to use to represent the coordinate data.\n        s : `~astropy.coordinates.BaseDifferential` subclass, optional\n            The differential subclass to use to represent any velocities,\n            such as proper motion and radial velocity.  If equal to 'base',\n            which is the default, it will be inferred from the representation.\n            If `None`, the representation will drop any differentials.\n        \"\"\"\n        if base is None:\n            base = self._representation['base']\n        self._representation = _get_repr_classes(base=base, s=s)\n\n    representation_type = property(\n        fget=get_representation_cls, fset=set_representation_cls,\n        doc=\"\"\"The representation class used for this frame's data.\n\n        This will be a subclass from `~astropy.coordinates.BaseRepresentation`.\n        Can also be *set* using the string name of the representation. If you\n        wish to set an explicit differential class (rather than have it be\n        inferred), use the ``set_representation_cls`` method.\n        \"\"\")\n\n    @property\n    def differential_type(self):\n        \"\"\"\n        The differential used for this frame's data.\n\n        This will be a subclass from `~astropy.coordinates.BaseDifferential`.\n        For simultaneous setting of representation and differentials, see the\n        ``set_representation_cls`` method.\n        \"\"\"\n        return self.get_representation_cls('s')\n\n    @differential_type.setter\n    def differential_type(self, value):\n        self.set_representation_cls(s=value)\n\n    @classmethod\n    def _get_representation_info(cls):\n        # This exists as a class method only to support handling frame inputs\n        # without units, which are deprecated and will be removed.  This can be\n        # moved into the representation_info property at that time.\n        # note that if so moved, the cache should be acceessed as\n        # self.__class__._frame_class_cache\n\n        if cls._frame_class_cache.get('last_reprdiff_hash', None) != r.get_reprdiff_cls_hash():\n            repr_attrs = {}\n            for repr_diff_cls in (list(r.REPRESENTATION_CLASSES.values()) +\n                                  list(r.DIFFERENTIAL_CLASSES.values())):\n                repr_attrs[repr_diff_cls] = {'names': [], 'units': []}\n                for c, c_cls in repr_diff_cls.attr_classes.items():\n                    repr_attrs[repr_diff_cls]['names'].append(c)\n                    rec_unit = u.deg if issubclass(c_cls, Angle) else None\n                    repr_attrs[repr_diff_cls]['units'].append(rec_unit)\n\n            for repr_diff_cls, mappings in cls._frame_specific_representation_info.items():\n\n                # take the 'names' and 'units' tuples from repr_attrs,\n                # and then use the RepresentationMapping objects\n                # to update as needed for this frame.\n                nms = repr_attrs[repr_diff_cls]['names']\n                uns = repr_attrs[repr_diff_cls]['units']\n                comptomap = dict([(m.reprname, m) for m in mappings])\n                for i, c in enumerate(repr_diff_cls.attr_classes.keys()):\n                    if c in comptomap:\n                        mapp = comptomap[c]\n                        nms[i] = mapp.framename\n\n                        # need the isinstance because otherwise if it's a unit it\n                        # will try to compare to the unit string representation\n                        if not (isinstance(mapp.defaultunit, str)\n                                and mapp.defaultunit == 'recommended'):\n                            uns[i] = mapp.defaultunit\n                            # else we just leave it as recommended_units says above\n\n                # Convert to tuples so that this can't mess with frame internals\n                repr_attrs[repr_diff_cls]['names'] = tuple(nms)\n                repr_attrs[repr_diff_cls]['units'] = tuple(uns)\n\n            cls._frame_class_cache['representation_info'] = repr_attrs\n            cls._frame_class_cache['last_reprdiff_hash'] = r.get_reprdiff_cls_hash()\n        return cls._frame_class_cache['representation_info']\n\n    @lazyproperty\n    def representation_info(self):\n        \"\"\"\n        A dictionary with the information of what attribute names for this frame\n        apply to particular representations.\n        \"\"\"\n        return self._get_representation_info()\n\n    def get_representation_component_names(self, which='base'):\n        out = {}\n        repr_or_diff_cls = self.get_representation_cls(which)\n        if repr_or_diff_cls is None:\n            return out\n        data_names = repr_or_diff_cls.attr_classes.keys()\n        repr_names = self.representation_info[repr_or_diff_cls]['names']\n        for repr_name, data_name in zip(repr_names, data_names):\n            out[repr_name] = data_name\n        return out\n\n    def get_representation_component_units(self, which='base'):\n        out = {}\n        repr_or_diff_cls = self.get_representation_cls(which)\n        if repr_or_diff_cls is None:\n            return out\n        repr_attrs = self.representation_info[repr_or_diff_cls]\n        repr_names = repr_attrs['names']\n        repr_units = repr_attrs['units']\n        for repr_name, repr_unit in zip(repr_names, repr_units):\n            if repr_unit:\n                out[repr_name] = repr_unit\n        return out\n\n    representation_component_names = property(get_representation_component_names)\n\n    representation_component_units = property(get_representation_component_units)\n\n    def _replicate(self, data, copy=False, **kwargs):\n        \"\"\"Base for replicating a frame, with possibly different attributes.\n\n        Produces a new instance of the frame using the attributes of the old\n        frame (unless overridden) and with the data given.\n\n        Parameters\n        ----------\n        data : `~astropy.coordinates.BaseRepresentation` or None\n            Data to use in the new frame instance.  If `None`, it will be\n            a data-less frame.\n        copy : bool, optional\n            Whether data and the attributes on the old frame should be copied\n            (default), or passed on by reference.\n        **kwargs\n            Any attributes that should be overridden.\n        \"\"\"\n        # This is to provide a slightly nicer error message if the user tries\n        # to use frame_obj.representation instead of frame_obj.data to get the\n        # underlying representation object [e.g., #2890]\n        if inspect.isclass(data):\n            raise TypeError('Class passed as data instead of a representation '\n                            'instance. If you called frame.representation, this'\n                            ' returns the representation class. frame.data '\n                            'returns the instantiated object - you may want to '\n                            ' use this instead.')\n        if copy and data is not None:\n            data = data.copy()\n\n        for attr in self.get_frame_attr_names():\n            if (attr not in self._attr_names_with_defaults\n                    and attr not in kwargs):\n                value = getattr(self, attr)\n                if copy:\n                    value = value.copy()\n\n                kwargs[attr] = value\n\n        return self.__class__(data, copy=False, **kwargs)\n\n    def replicate(self, copy=False, **kwargs):\n        \"\"\"\n        Return a replica of the frame, optionally with new frame attributes.\n\n        The replica is a new frame object that has the same data as this frame\n        object and with frame attributes overridden if they are provided as extra\n        keyword arguments to this method. If ``copy`` is set to `True` then a\n        copy of the internal arrays will be made.  Otherwise the replica will\n        use a reference to the original arrays when possible to save memory. The\n        internal arrays are normally not changeable by the user so in most cases\n        it should not be necessary to set ``copy`` to `True`.\n\n        Parameters\n        ----------\n        copy : bool, optional\n            If True, the resulting object is a copy of the data.  When False,\n            references are used where  possible. This rule also applies to the\n            frame attributes.\n\n        Any additional keywords are treated as frame attributes to be set on the\n        new frame object.\n\n        Returns\n        -------\n        frameobj : `BaseCoordinateFrame` subclass instance\n            Replica of this object, but possibly with new frame attributes.\n        \"\"\"\n        return self._replicate(self.data, copy=copy, **kwargs)\n\n    def replicate_without_data(self, copy=False, **kwargs):\n        \"\"\"\n        Return a replica without data, optionally with new frame attributes.\n\n        The replica is a new frame object without data but with the same frame\n        attributes as this object, except where overridden by extra keyword\n        arguments to this method.  The ``copy`` keyword determines if the frame\n        attributes are truly copied vs being references (which saves memory for\n        cases where frame attributes are large).\n\n        This method is essentially the converse of `realize_frame`.\n\n        Parameters\n        ----------\n        copy : bool, optional\n            If True, the resulting object has copies of the frame attributes.\n            When False, references are used where  possible.\n\n        Any additional keywords are treated as frame attributes to be set on the\n        new frame object.\n\n        Returns\n        -------\n        frameobj : `BaseCoordinateFrame` subclass instance\n            Replica of this object, but without data and possibly with new frame\n            attributes.\n        \"\"\"\n        return self._replicate(None, copy=copy, **kwargs)\n\n    def realize_frame(self, data, **kwargs):\n        \"\"\"\n        Generates a new frame with new data from another frame (which may or\n        may not have data). Roughly speaking, the converse of\n        `replicate_without_data`.\n\n        Parameters\n        ----------\n        data : `~astropy.coordinates.BaseRepresentation`\n            The representation to use as the data for the new frame.\n\n        Any additional keywords are treated as frame attributes to be set on the\n        new frame object. In particular, `representation_type` can be specified.\n\n        Returns\n        -------\n        frameobj : `BaseCoordinateFrame` subclass instance\n            A new object in *this* frame, with the same frame attributes as\n            this one, but with the ``data`` as the coordinate data.\n\n        \"\"\"\n        return self._replicate(data, **kwargs)\n\n    def represent_as(self, base, s='base', in_frame_units=False):\n        \"\"\"\n        Generate and return a new representation of this frame's `data`\n        as a Representation object.\n\n        Note: In order to make an in-place change of the representation\n        of a Frame or SkyCoord object, set the ``representation``\n        attribute of that object to the desired new representation, or\n        use the ``set_representation_cls`` method to also set the differential.\n\n        Parameters\n        ----------\n        base : subclass of BaseRepresentation or string\n            The type of representation to generate.  Must be a *class*\n            (not an instance), or the string name of the representation\n            class.\n        s : subclass of `~astropy.coordinates.BaseDifferential`, str, optional\n            Class in which any velocities should be represented. Must be\n            a *class* (not an instance), or the string name of the\n            differential class.  If equal to 'base' (default), inferred from\n            the base class.  If `None`, all velocity information is dropped.\n        in_frame_units : bool, keyword-only\n            Force the representation units to match the specified units\n            particular to this frame\n\n        Returns\n        -------\n        newrep : BaseRepresentation-derived object\n            A new representation object of this frame's `data`.\n\n        Raises\n        ------\n        AttributeError\n            If this object had no `data`\n\n        Examples\n        --------\n        >>> from astropy import units as u\n        >>> from astropy.coordinates import SkyCoord, CartesianRepresentation\n        >>> coord = SkyCoord(0*u.deg, 0*u.deg)\n        >>> coord.represent_as(CartesianRepresentation)  # doctest: +FLOAT_CMP\n        <CartesianRepresentation (x, y, z) [dimensionless]\n                (1., 0., 0.)>\n\n        >>> coord.representation_type = CartesianRepresentation\n        >>> coord  # doctest: +FLOAT_CMP\n        <SkyCoord (ICRS): (x, y, z) [dimensionless]\n            (1., 0., 0.)>\n        \"\"\"\n\n        # For backwards compatibility (because in_frame_units used to be the\n        # 2nd argument), we check to see if `new_differential` is a boolean. If\n        # it is, we ignore the value of `new_differential` and warn about the\n        # position change\n        if isinstance(s, bool):\n            warnings.warn(\"The argument position for `in_frame_units` in \"\n                          \"`represent_as` has changed. Use as a keyword \"\n                          \"argument if needed.\", AstropyWarning)\n            in_frame_units = s\n            s = 'base'\n\n        # In the future, we may want to support more differentials, in which\n        # case one probably needs to define **kwargs above and use it here.\n        # But for now, we only care about the velocity.\n        repr_classes = _get_repr_classes(base=base, s=s)\n        representation_cls = repr_classes['base']\n        # We only keep velocity information\n        if 's' in self.data.differentials:\n            # For the default 'base' option in which _get_repr_classes has\n            # given us a best guess based on the representation class, we only\n            # use it if the class we had already is incompatible.\n            if (s == 'base'\n                and (self.data.differentials['s'].__class__\n                     in representation_cls._compatible_differentials)):\n                differential_cls = self.data.differentials['s'].__class__\n            else:\n                differential_cls = repr_classes['s']\n        elif s is None or s == 'base':\n            differential_cls = None\n        else:\n            raise TypeError('Frame data has no associated differentials '\n                            '(i.e. the frame has no velocity data) - '\n                            'represent_as() only accepts a new '\n                            'representation.')\n\n        if differential_cls:\n            cache_key = (representation_cls.__name__,\n                         differential_cls.__name__, in_frame_units)\n        else:\n            cache_key = (representation_cls.__name__, in_frame_units)\n\n        cached_repr = self.cache['representation'].get(cache_key)\n        if not cached_repr:\n            if differential_cls:\n                # Sanity check to ensure we do not just drop radial\n                # velocity.  TODO: should Representation.represent_as\n                # allow this transformation in the first place?\n                if (isinstance(self.data, r.UnitSphericalRepresentation)\n                    and issubclass(representation_cls, r.CartesianRepresentation)\n                    and not isinstance(self.data.differentials['s'],\n                                       (r.UnitSphericalDifferential,\n                                        r.UnitSphericalCosLatDifferential,\n                                        r.RadialDifferential))):\n                    raise u.UnitConversionError(\n                        'need a distance to retrieve a cartesian representation '\n                        'when both radial velocity and proper motion are present, '\n                        'since otherwise the units cannot match.')\n\n                # TODO NOTE: only supports a single differential\n                data = self.data.represent_as(representation_cls,\n                                              differential_cls)\n                diff = data.differentials['s']  # TODO: assumes velocity\n            else:\n                data = self.data.represent_as(representation_cls)\n\n            # If the new representation is known to this frame and has a defined\n            # set of names and units, then use that.\n            new_attrs = self.representation_info.get(representation_cls)\n            if new_attrs and in_frame_units:\n                datakwargs = dict((comp, getattr(data, comp))\n                                  for comp in data.components)\n                for comp, new_attr_unit in zip(data.components, new_attrs['units']):\n                    if new_attr_unit:\n                        datakwargs[comp] = datakwargs[comp].to(new_attr_unit)\n                data = data.__class__(copy=False, **datakwargs)\n\n            if differential_cls:\n                # the original differential\n                data_diff = self.data.differentials['s']\n\n                # If the new differential is known to this frame and has a\n                # defined set of names and units, then use that.\n                new_attrs = self.representation_info.get(differential_cls)\n                if new_attrs and in_frame_units:\n                    diffkwargs = dict((comp, getattr(diff, comp))\n                                      for comp in diff.components)\n                    for comp, new_attr_unit in zip(diff.components,\n                                                   new_attrs['units']):\n                        # Some special-casing to treat a situation where the\n                        # input data has a UnitSphericalDifferential or a\n                        # RadialDifferential. It is re-represented to the\n                        # frame's differential class (which might be, e.g., a\n                        # dimensional Differential), so we don't want to try to\n                        # convert the empty component units\n                        if (isinstance(data_diff,\n                                       (r.UnitSphericalDifferential,\n                                        r.UnitSphericalCosLatDifferential))\n                                and comp not in data_diff.__class__.attr_classes):\n                            continue\n\n                        elif (isinstance(data_diff, r.RadialDifferential)\n                              and comp not in data_diff.__class__.attr_classes):\n                            continue\n\n                        # Try to convert to requested units. Since that might\n                        # not be possible (e.g., for a coordinate with proper\n                        # motion but without distance, one cannot convert to a\n                        # cartesian differential in km/s), we allow the unit\n                        # conversion to fail.  See gh-7028 for discussion.\n                        if new_attr_unit and hasattr(diff, comp):\n                            try:\n                                diffkwargs[comp] = diffkwargs[comp].to(new_attr_unit)\n                            except Exception:\n                                pass\n\n                    diff = diff.__class__(copy=False, **diffkwargs)\n\n                    # Here we have to bypass using with_differentials() because\n                    # it has a validation check. But because\n                    # .representation_type and .differential_type don't point to\n                    # the original classes, if the input differential is a\n                    # RadialDifferential, it usually gets turned into a\n                    # SphericalCosLatDifferential (or whatever the default is)\n                    # with strange units for the d_lon and d_lat attributes.\n                    # This then causes the dictionary key check to fail (i.e.\n                    # comparison against `diff._get_deriv_key()`)\n                    data._differentials.update({'s': diff})\n\n            self.cache['representation'][cache_key] = data\n\n        return self.cache['representation'][cache_key]\n\n    def transform_to(self, new_frame):\n        \"\"\"\n        Transform this object's coordinate data to a new frame.\n\n        Parameters\n        ----------\n        new_frame : coordinate-like or `BaseCoordinateFrame` subclass instance\n            The frame to transform this coordinate frame into.\n            The frame class option is deprecated.\n\n        Returns\n        -------\n        transframe : coordinate-like\n            A new object with the coordinate data represented in the\n            ``newframe`` system.\n\n        Raises\n        ------\n        ValueError\n            If there is no possible transformation route.\n        \"\"\"\n        from .errors import ConvertError\n\n        if self._data is None:\n            raise ValueError('Cannot transform a frame with no data')\n\n        if (getattr(self.data, 'differentials', None)\n                and hasattr(self, 'obstime') and hasattr(new_frame, 'obstime')\n                and np.any(self.obstime != new_frame.obstime)):\n            raise NotImplementedError('You cannot transform a frame that has '\n                                      'velocities to another frame at a '\n                                      'different obstime. If you think this '\n                                      'should (or should not) be possible, '\n                                      'please comment at https://github.com/astropy/astropy/issues/6280')\n\n        if inspect.isclass(new_frame):\n            warnings.warn(\"Transforming a frame instance to a frame class (as opposed to another \"\n                          \"frame instance) will not be supported in the future.  Either \"\n                          \"explicitly instantiate the target frame, or first convert the source \"\n                          \"frame instance to a `astropy.coordinates.SkyCoord` and use its \"\n                          \"`transform_to()` method.\",\n                          AstropyDeprecationWarning)\n            # Use the default frame attributes for this class\n            new_frame = new_frame()\n\n        if hasattr(new_frame, '_sky_coord_frame'):\n            # Input new_frame is not a frame instance or class and is most\n            # likely a SkyCoord object.\n            new_frame = new_frame._sky_coord_frame\n\n        trans = frame_transform_graph.get_transform(self.__class__,\n                                                    new_frame.__class__)\n        if trans is None:\n            if new_frame is self.__class__:\n                # no special transform needed, but should update frame info\n                return new_frame.realize_frame(self.data)\n            msg = 'Cannot transform from {0} to {1}'\n            raise ConvertError(msg.format(self.__class__, new_frame.__class__))\n        return trans(self, new_frame)\n\n    def is_transformable_to(self, new_frame):\n        \"\"\"\n        Determines if this coordinate frame can be transformed to another\n        given frame.\n\n        Parameters\n        ----------\n        new_frame : `BaseCoordinateFrame` subclass or instance\n            The proposed frame to transform into.\n\n        Returns\n        -------\n        transformable : bool or str\n            `True` if this can be transformed to ``new_frame``, `False` if\n            not, or the string 'same' if ``new_frame`` is the same system as\n            this object but no transformation is defined.\n\n        Notes\n        -----\n        A return value of 'same' means the transformation will work, but it will\n        just give back a copy of this object.  The intended usage is::\n\n            if coord.is_transformable_to(some_unknown_frame):\n                coord2 = coord.transform_to(some_unknown_frame)\n\n        This will work even if ``some_unknown_frame``  turns out to be the same\n        frame class as ``coord``.  This is intended for cases where the frame\n        is the same regardless of the frame attributes (e.g. ICRS), but be\n        aware that it *might* also indicate that someone forgot to define the\n        transformation between two objects of the same frame class but with\n        different attributes.\n        \"\"\"\n        new_frame_cls = new_frame if inspect.isclass(new_frame) else new_frame.__class__\n        trans = frame_transform_graph.get_transform(self.__class__, new_frame_cls)\n\n        if trans is None:\n            if new_frame_cls is self.__class__:\n                return 'same'\n            else:\n                return False\n        else:\n            return True\n\n    def is_frame_attr_default(self, attrnm):\n        \"\"\"\n        Determine whether or not a frame attribute has its value because it's\n        the default value, or because this frame was created with that value\n        explicitly requested.\n\n        Parameters\n        ----------\n        attrnm : str\n            The name of the attribute to check.\n\n        Returns\n        -------\n        isdefault : bool\n            True if the attribute ``attrnm`` has its value by default, False if\n            it was specified at creation of this frame.\n        \"\"\"\n        return attrnm in self._attr_names_with_defaults\n\n    @staticmethod\n    def _frameattr_equiv(left_fattr, right_fattr):\n        \"\"\"\n        Determine if two frame attributes are equivalent.  Implemented as a\n        staticmethod mainly as a convenient location, although conceivable it\n        might be desirable for subclasses to override this behavior.\n\n        Primary purpose is to check for equality of representations.  This\n        aspect can actually be simplified/removed now that representations have\n        equality defined.\n\n        Secondary purpose is to check for equality of coordinate attributes,\n        which first checks whether they themselves are in equivalent frames\n        before checking for equality in the normal fashion.  This is because\n        checking for equality with non-equivalent frames raises an error.\n        \"\"\"\n        if left_fattr is right_fattr:\n            # shortcut if it's exactly the same object\n            return True\n        elif left_fattr is None or right_fattr is None:\n            # shortcut if one attribute is unspecified and the other isn't\n            return False\n\n        left_is_repr = isinstance(left_fattr, r.BaseRepresentationOrDifferential)\n        right_is_repr = isinstance(right_fattr, r.BaseRepresentationOrDifferential)\n        if left_is_repr and right_is_repr:\n            # both are representations.\n            if (getattr(left_fattr, 'differentials', False) or\n                    getattr(right_fattr, 'differentials', False)):\n                warnings.warn('Two representation frame attributes were '\n                              'checked for equivalence when at least one of'\n                              ' them has differentials.  This yields False '\n                              'even if the underlying representations are '\n                              'equivalent (although this may change in '\n                              'future versions of Astropy)', AstropyWarning)\n                return False\n            if isinstance(right_fattr, left_fattr.__class__):\n                # if same representation type, compare components.\n                return np.all([(getattr(left_fattr, comp) ==\n                                getattr(right_fattr, comp))\n                               for comp in left_fattr.components])\n            else:\n                # convert to cartesian and see if they match\n                return np.all(left_fattr.to_cartesian().xyz ==\n                              right_fattr.to_cartesian().xyz)\n        elif left_is_repr or right_is_repr:\n            return False\n\n        left_is_coord = isinstance(left_fattr, BaseCoordinateFrame)\n        right_is_coord = isinstance(right_fattr, BaseCoordinateFrame)\n        if left_is_coord and right_is_coord:\n            # both are coordinates\n            if left_fattr.is_equivalent_frame(right_fattr):\n                return np.all(left_fattr == right_fattr)\n            else:\n                return False\n        elif left_is_coord or right_is_coord:\n            return False\n\n        return np.all(left_fattr == right_fattr)\n\n    def is_equivalent_frame(self, other):\n        \"\"\"\n        Checks if this object is the same frame as the ``other`` object.\n\n        To be the same frame, two objects must be the same frame class and have\n        the same frame attributes.  Note that it does *not* matter what, if any,\n        data either object has.\n\n        Parameters\n        ----------\n        other : :class:`~astropy.coordinates.BaseCoordinateFrame`\n            the other frame to check\n\n        Returns\n        -------\n        isequiv : bool\n            True if the frames are the same, False if not.\n\n        Raises\n        ------\n        TypeError\n            If ``other`` isn't a `BaseCoordinateFrame` or subclass.\n        \"\"\"\n        if self.__class__ == other.__class__:\n            for frame_attr_name in self.get_frame_attr_names():\n                if not self._frameattr_equiv(getattr(self, frame_attr_name),\n                                             getattr(other, frame_attr_name)):\n                    return False\n            return True\n        elif not isinstance(other, BaseCoordinateFrame):\n            raise TypeError(\"Tried to do is_equivalent_frame on something that \"\n                            \"isn't a frame\")\n        else:\n            return False\n\n    def __repr__(self):\n        frameattrs = self._frame_attrs_repr()\n        data_repr = self._data_repr()\n\n        if frameattrs:\n            frameattrs = f' ({frameattrs})'\n\n        if data_repr:\n            return f'<{self.__class__.__name__} Coordinate{frameattrs}: {data_repr}>'\n        else:\n            return f'<{self.__class__.__name__} Frame{frameattrs}>'\n\n    def _data_repr(self):\n        \"\"\"Returns a string representation of the coordinate data.\"\"\"\n\n        if not self.has_data:\n            return ''\n\n        if self.representation_type:\n            if (hasattr(self.representation_type, '_unit_representation')\n                    and isinstance(self.data,\n                                   self.representation_type._unit_representation)):\n                rep_cls = self.data.__class__\n            else:\n                rep_cls = self.representation_type\n\n            if 's' in self.data.differentials:\n                dif_cls = self.get_representation_cls('s')\n                dif_data = self.data.differentials['s']\n                if isinstance(dif_data, (r.UnitSphericalDifferential,\n                                         r.UnitSphericalCosLatDifferential,\n                                         r.RadialDifferential)):\n                    dif_cls = dif_data.__class__\n\n            else:\n                dif_cls = None\n\n            data = self.represent_as(rep_cls, dif_cls, in_frame_units=True)\n\n            data_repr = repr(data)\n            # Generate the list of component names out of the repr string\n            part1, _, remainder = data_repr.partition('(')\n            if remainder != '':\n                comp_str, _, part2 = remainder.partition(')')\n                comp_names = comp_str.split(', ')\n                # Swap in frame-specific component names\n                invnames = dict([(nmrepr, nmpref) for nmpref, nmrepr\n                                 in self.representation_component_names.items()])\n                for i, name in enumerate(comp_names):\n                    comp_names[i] = invnames.get(name, name)\n                # Reassemble the repr string\n                data_repr = part1 + '(' + ', '.join(comp_names) + ')' + part2\n\n        else:\n            data = self.data\n            data_repr = repr(self.data)\n\n        if data_repr.startswith('<' + data.__class__.__name__):\n            # remove both the leading \"<\" and the space after the name, as well\n            # as the trailing \">\"\n            data_repr = data_repr[(len(data.__class__.__name__) + 2):-1]\n        else:\n            data_repr = 'Data:\\n' + data_repr\n\n        if 's' in self.data.differentials:\n            data_repr_spl = data_repr.split('\\n')\n            if 'has differentials' in data_repr_spl[-1]:\n                diffrepr = repr(data.differentials['s']).split('\\n')\n                if diffrepr[0].startswith('<'):\n                    diffrepr[0] = ' ' + ' '.join(diffrepr[0].split(' ')[1:])\n                for frm_nm, rep_nm in self.get_representation_component_names('s').items():\n                    diffrepr[0] = diffrepr[0].replace(rep_nm, frm_nm)\n                if diffrepr[-1].endswith('>'):\n                    diffrepr[-1] = diffrepr[-1][:-1]\n                data_repr_spl[-1] = '\\n'.join(diffrepr)\n\n            data_repr = '\\n'.join(data_repr_spl)\n\n        return data_repr\n\n    def _frame_attrs_repr(self):\n        \"\"\"\n        Returns a string representation of the frame's attributes, if any.\n        \"\"\"\n        attr_strs = []\n        for attribute_name in self.get_frame_attr_names():\n            attr = getattr(self, attribute_name)\n            # Check to see if this object has a way of representing itself\n            # specific to being an attribute of a frame. (Note, this is not the\n            # Attribute class, it's the actual object).\n            if hasattr(attr, \"_astropy_repr_in_frame\"):\n                attrstr = attr._astropy_repr_in_frame()\n            else:\n                attrstr = str(attr)\n            attr_strs.append(f\"{attribute_name}={attrstr}\")\n\n        return ', '.join(attr_strs)\n\n    def _apply(self, method, *args, **kwargs):\n        \"\"\"Create a new instance, applying a method to the underlying data.\n\n        In typical usage, the method is any of the shape-changing methods for\n        `~numpy.ndarray` (``reshape``, ``swapaxes``, etc.), as well as those\n        picking particular elements (``__getitem__``, ``take``, etc.), which\n        are all defined in `~astropy.utils.shapes.ShapedLikeNDArray`. It will be\n        applied to the underlying arrays in the representation (e.g., ``x``,\n        ``y``, and ``z`` for `~astropy.coordinates.CartesianRepresentation`),\n        as well as to any frame attributes that have a shape, with the results\n        used to create a new instance.\n\n        Internally, it is also used to apply functions to the above parts\n        (in particular, `~numpy.broadcast_to`).\n\n        Parameters\n        ----------\n        method : str or callable\n            If str, it is the name of a method that is applied to the internal\n            ``components``. If callable, the function is applied.\n        *args : tuple\n            Any positional arguments for ``method``.\n        **kwargs : dict\n            Any keyword arguments for ``method``.\n        \"\"\"\n        def apply_method(value):\n            if isinstance(value, ShapedLikeNDArray):\n                return value._apply(method, *args, **kwargs)\n            else:\n                if callable(method):\n                    return method(value, *args, **kwargs)\n                else:\n                    return getattr(value, method)(*args, **kwargs)\n\n        new = super().__new__(self.__class__)\n        if hasattr(self, '_representation'):\n            new._representation = self._representation.copy()\n        new._attr_names_with_defaults = self._attr_names_with_defaults.copy()\n\n        for attr in self.frame_attributes:\n            _attr = '_' + attr\n            if attr in self._attr_names_with_defaults:\n                setattr(new, _attr, getattr(self, _attr))\n            else:\n                value = getattr(self, _attr)\n                if getattr(value, 'shape', ()):\n                    value = apply_method(value)\n                elif method == 'copy' or method == 'flatten':\n                    # flatten should copy also for a single element array, but\n                    # we cannot use it directly for array scalars, since it\n                    # always returns a one-dimensional array. So, just copy.\n                    value = copy.copy(value)\n\n                setattr(new, _attr, value)\n\n        if self.has_data:\n            new._data = apply_method(self.data)\n        else:\n            new._data = None\n            shapes = [getattr(new, '_' + attr).shape\n                      for attr in new.frame_attributes\n                      if (attr not in new._attr_names_with_defaults\n                          and getattr(getattr(new, '_' + attr), 'shape', ()))]\n            if shapes:\n                new._no_data_shape = (check_broadcast(*shapes)\n                                      if len(shapes) > 1 else shapes[0])\n            else:\n                new._no_data_shape = ()\n\n        return new\n\n    def __setitem__(self, item, value):\n        if self.__class__ is not value.__class__:\n            raise TypeError(f'can only set from object of same class: '\n                            f'{self.__class__.__name__} vs. '\n                            f'{value.__class__.__name__}')\n\n        if not self.is_equivalent_frame(value):\n            raise ValueError('can only set frame item from an equivalent frame')\n\n        if value._data is None:\n            raise ValueError('can only set frame with value that has data')\n\n        if self._data is None:\n            raise ValueError('cannot set frame which has no data')\n\n        if self.shape == ():\n            raise TypeError(f\"scalar '{self.__class__.__name__}' frame object \"\n                            f\"does not support item assignment\")\n\n        if self._data is None:\n            raise ValueError('can only set frame if it has data')\n\n        if self._data.__class__ is not value._data.__class__:\n            raise TypeError(f'can only set from object of same class: '\n                            f'{self._data.__class__.__name__} vs. '\n                            f'{value._data.__class__.__name__}')\n\n        if self._data._differentials:\n            # Can this ever occur? (Same class but different differential keys).\n            # This exception is not tested since it is not clear how to generate it.\n            if self._data._differentials.keys() != value._data._differentials.keys():\n                raise ValueError(f'setitem value must have same differentials')\n\n            for key, self_diff in self._data._differentials.items():\n                if self_diff.__class__ is not value._data._differentials[key].__class__:\n                    raise TypeError(f'can only set from object of same class: '\n                                    f'{self_diff.__class__.__name__} vs. '\n                                    f'{value._data._differentials[key].__class__.__name__}')\n\n        # Set representation data\n        self._data[item] = value._data\n\n        # Frame attributes required to be identical by is_equivalent_frame,\n        # no need to set them here.\n\n        self.cache.clear()\n\n    @override__dir__\n    def __dir__(self):\n        \"\"\"\n        Override the builtin `dir` behavior to include representation\n        names.\n\n        TODO: dynamic representation transforms (i.e. include cylindrical et al.).\n        \"\"\"\n        dir_values = set(self.representation_component_names)\n        dir_values |= set(self.get_representation_component_names('s'))\n\n        return dir_values\n\n    def __getattr__(self, attr):\n        \"\"\"\n        Allow access to attributes on the representation and differential as\n        found via ``self.get_representation_component_names``.\n\n        TODO: We should handle dynamic representation transforms here (e.g.,\n        `.cylindrical`) instead of defining properties as below.\n        \"\"\"\n\n        # attr == '_representation' is likely from the hasattr() test in the\n        # representation property which is used for\n        # self.representation_component_names.\n        #\n        # Prevent infinite recursion here.\n        if attr.startswith('_'):\n            return self.__getattribute__(attr)  # Raise AttributeError.\n\n        repr_names = self.representation_component_names\n        if attr in repr_names:\n            if self._data is None:\n                self.data  # this raises the \"no data\" error by design - doing it\n                # this way means we don't have to replicate the error message here\n\n            rep = self.represent_as(self.representation_type,\n                                    in_frame_units=True)\n            val = getattr(rep, repr_names[attr])\n            return val\n\n        diff_names = self.get_representation_component_names('s')\n        if attr in diff_names:\n            if self._data is None:\n                self.data  # see above.\n            # TODO: this doesn't work for the case when there is only\n            # unitspherical information. The differential_type gets set to the\n            # default_differential, which expects full information, so the\n            # units don't work out\n            rep = self.represent_as(in_frame_units=True,\n                                    **self.get_representation_cls(None))\n            val = getattr(rep.differentials['s'], diff_names[attr])\n            return val\n\n        return self.__getattribute__(attr)  # Raise AttributeError.\n\n    def __setattr__(self, attr, value):\n        # Don't slow down access of private attributes!\n        if not attr.startswith('_'):\n            if hasattr(self, 'representation_info'):\n                repr_attr_names = set()\n                for representation_attr in self.representation_info.values():\n                    repr_attr_names.update(representation_attr['names'])\n\n                if attr in repr_attr_names:\n                    raise AttributeError(\n                        f'Cannot set any frame attribute {attr}')\n\n        super().__setattr__(attr, value)\n\n    def __eq__(self, value):\n        \"\"\"Equality operator for frame.\n\n        This implements strict equality and requires that the frames are\n        equivalent and that the representation data are exactly equal.\n        \"\"\"\n        is_equiv = self.is_equivalent_frame(value)\n\n        if self._data is None and value._data is None:\n            # For Frame with no data, == compare is same as is_equivalent_frame()\n            return is_equiv\n\n        if not is_equiv:\n            raise TypeError(f'cannot compare: objects must have equivalent frames: '\n                            f'{self.replicate_without_data()} vs. '\n                            f'{value.replicate_without_data()}')\n\n        if ((value._data is None and self._data is not None)\n                or (self._data is None and value._data is not None)):\n            raise ValueError('cannot compare: one frame has data and the other '\n                             'does not')\n\n        return self._data == value._data\n\n    def __ne__(self, value):\n        return np.logical_not(self == value)\n\n    def separation(self, other):\n        \"\"\"\n        Computes on-sky separation between this coordinate and another.\n\n        .. note::\n\n            If the ``other`` coordinate object is in a different frame, it is\n            first transformed to the frame of this object. This can lead to\n            unintuitive behavior if not accounted for. Particularly of note is\n            that ``self.separation(other)`` and ``other.separation(self)`` may\n            not give the same answer in this case.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate to get the separation to.\n\n        Returns\n        -------\n        sep : `~astropy.coordinates.Angle`\n            The on-sky separation between this and the ``other`` coordinate.\n\n        Notes\n        -----\n        The separation is calculated using the Vincenty formula, which\n        is stable at all locations, including poles and antipodes [1]_.\n\n        .. [1] https://en.wikipedia.org/wiki/Great-circle_distance\n\n        \"\"\"\n        from .angle_utilities import angular_separation\n        from .angles import Angle\n\n        self_unit_sph = self.represent_as(r.UnitSphericalRepresentation)\n        other_transformed = other.transform_to(self)\n        other_unit_sph = other_transformed.represent_as(r.UnitSphericalRepresentation)\n\n        # Get the separation as a Quantity, convert to Angle in degrees\n        sep = angular_separation(self_unit_sph.lon, self_unit_sph.lat,\n                                 other_unit_sph.lon, other_unit_sph.lat)\n        return Angle(sep, unit=u.degree)\n\n    def separation_3d(self, other):\n        \"\"\"\n        Computes three dimensional separation between this coordinate\n        and another.\n\n        Parameters\n        ----------\n        other : `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate system to get the distance to.\n\n        Returns\n        -------\n        sep : `~astropy.coordinates.Distance`\n            The real-space distance between these two coordinates.\n\n        Raises\n        ------\n        ValueError\n            If this or the other coordinate do not have distances.\n        \"\"\"\n\n        from .distances import Distance\n\n        if issubclass(self.data.__class__, r.UnitSphericalRepresentation):\n            raise ValueError('This object does not have a distance; cannot '\n                             'compute 3d separation.')\n\n        # do this first just in case the conversion somehow creates a distance\n        other_in_self_system = other.transform_to(self)\n\n        if issubclass(other_in_self_system.__class__, r.UnitSphericalRepresentation):\n            raise ValueError('The other object does not have a distance; '\n                             'cannot compute 3d separation.')\n\n        # drop the differentials to ensure they don't do anything odd in the\n        # subtraction\n        self_car = self.data.without_differentials().represent_as(r.CartesianRepresentation)\n        other_car = other_in_self_system.data.without_differentials().represent_as(r.CartesianRepresentation)\n        dist = (self_car - other_car).norm()\n        if dist.unit == u.one:\n            return dist\n        else:\n            return Distance(dist)\n\n    @property\n    def cartesian(self):\n        \"\"\"\n        Shorthand for a cartesian representation of the coordinates in this\n        object.\n        \"\"\"\n\n        # TODO: if representations are updated to use a full transform graph,\n        #       the representation aliases should not be hard-coded like this\n        return self.represent_as('cartesian', in_frame_units=True)\n\n    @property\n    def cylindrical(self):\n        \"\"\"\n        Shorthand for a cylindrical representation of the coordinates in this\n        object.\n        \"\"\"\n\n        # TODO: if representations are updated to use a full transform graph,\n        #       the representation aliases should not be hard-coded like this\n        return self.represent_as('cylindrical', in_frame_units=True)\n\n    @property\n    def spherical(self):\n        \"\"\"\n        Shorthand for a spherical representation of the coordinates in this\n        object.\n        \"\"\"\n\n        # TODO: if representations are updated to use a full transform graph,\n        #       the representation aliases should not be hard-coded like this\n        return self.represent_as('spherical', in_frame_units=True)\n\n    @property\n    def sphericalcoslat(self):\n        \"\"\"\n        Shorthand for a spherical representation of the positional data and a\n        `SphericalCosLatDifferential` for the velocity data in this object.\n        \"\"\"\n\n        # TODO: if representations are updated to use a full transform graph,\n        #       the representation aliases should not be hard-coded like this\n        return self.represent_as('spherical', 'sphericalcoslat',\n                                 in_frame_units=True)\n\n    @property\n    def velocity(self):\n        \"\"\"\n        Shorthand for retrieving the Cartesian space-motion as a\n        `CartesianDifferential` object. This is equivalent to calling\n        ``self.cartesian.differentials['s']``.\n        \"\"\"\n        if 's' not in self.data.differentials:\n            raise ValueError('Frame has no associated velocity (Differential) '\n                             'data information.')\n\n        return self.cartesian.differentials['s']\n\n    @property\n    def proper_motion(self):\n        \"\"\"\n        Shorthand for the two-dimensional proper motion as a\n        `~astropy.units.Quantity` object with angular velocity units. In the\n        returned `~astropy.units.Quantity`, ``axis=0`` is the longitude/latitude\n        dimension so that ``.proper_motion[0]`` is the longitudinal proper\n        motion and ``.proper_motion[1]`` is latitudinal. The longitudinal proper\n        motion already includes the cos(latitude) term.\n        \"\"\"\n        if 's' not in self.data.differentials:\n            raise ValueError('Frame has no associated velocity (Differential) '\n                             'data information.')\n\n        sph = self.represent_as('spherical', 'sphericalcoslat',\n                                in_frame_units=True)\n        pm_lon = sph.differentials['s'].d_lon_coslat\n        pm_lat = sph.differentials['s'].d_lat\n        return np.stack((pm_lon.value,\n                         pm_lat.to(pm_lon.unit).value), axis=0) * pm_lon.unit\n\n    @property\n    def radial_velocity(self):\n        \"\"\"\n        Shorthand for the radial or line-of-sight velocity as a\n        `~astropy.units.Quantity` object.\n        \"\"\"\n        if 's' not in self.data.differentials:\n            raise ValueError('Frame has no associated velocity (Differential) '\n                             'data information.')\n\n        sph = self.represent_as('spherical', in_frame_units=True)\n        return sph.differentials['s'].d_distance\n\n\nclass GenericFrame(BaseCoordinateFrame):\n    \"\"\"\n    A frame object that can't store data but can hold any arbitrary frame\n    attributes. Mostly useful as a utility for the high-level class to store\n    intermediate frame attributes.\n\n    Parameters\n    ----------\n    frame_attrs : dict\n        A dictionary of attributes to be used as the frame attributes for this\n        frame.\n    \"\"\"\n\n    name = None  # it's not a \"real\" frame so it doesn't have a name\n\n    def __init__(self, frame_attrs):\n        self.frame_attributes = {}\n        for name, default in frame_attrs.items():\n            self.frame_attributes[name] = Attribute(default)\n            setattr(self, '_' + name, default)\n\n        super().__init__(None)\n\n    def __getattr__(self, name):\n        if '_' + name in self.__dict__:\n            return getattr(self, '_' + name)\n        else:\n            raise AttributeError(f'no {name}')\n\n    def __setattr__(self, name, value):\n        if name in self.get_frame_attr_names():\n            raise AttributeError(f\"can't set frame attribute '{name}'\")\n        else:\n            super().__setattr__(name, value)\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":147,"id":15252,"name":"_composite_cache","nodeType":"Attribute","startLoc":147,"text":"self._composite_cache"},{"className":"Attribute","col":0,"comment":"A non-mutable data descriptor to hold a frame attribute.\n\n    This class must be used to define frame attributes (e.g. ``equinox`` or\n    ``obstime``) that are included in a frame class definition.\n\n    Examples\n    --------\n    The `~astropy.coordinates.FK4` class uses the following class attributes::\n\n      class FK4(BaseCoordinateFrame):\n          equinox = TimeAttribute(default=_EQUINOX_B1950)\n          obstime = TimeAttribute(default=None,\n                                  secondary_attribute='equinox')\n\n    This means that ``equinox`` and ``obstime`` are available to be set as\n    keyword arguments when creating an ``FK4`` class instance and are then\n    accessible as instance attributes.  The instance value for the attribute\n    must be stored in ``'_' + <attribute_name>`` by the frame ``__init__``\n    method.\n\n    Note in this example that ``equinox`` and ``obstime`` are time attributes\n    and use the ``TimeAttributeFrame`` class.  This subclass overrides the\n    ``convert_input`` method to validate and convert inputs into a ``Time``\n    object.\n\n    Parameters\n    ----------\n    default : object\n        Default value for the attribute if not provided\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    ","endLoc":131,"id":15253,"nodeType":"Class","startLoc":17,"text":"class Attribute:\n    \"\"\"A non-mutable data descriptor to hold a frame attribute.\n\n    This class must be used to define frame attributes (e.g. ``equinox`` or\n    ``obstime``) that are included in a frame class definition.\n\n    Examples\n    --------\n    The `~astropy.coordinates.FK4` class uses the following class attributes::\n\n      class FK4(BaseCoordinateFrame):\n          equinox = TimeAttribute(default=_EQUINOX_B1950)\n          obstime = TimeAttribute(default=None,\n                                  secondary_attribute='equinox')\n\n    This means that ``equinox`` and ``obstime`` are available to be set as\n    keyword arguments when creating an ``FK4`` class instance and are then\n    accessible as instance attributes.  The instance value for the attribute\n    must be stored in ``'_' + <attribute_name>`` by the frame ``__init__``\n    method.\n\n    Note in this example that ``equinox`` and ``obstime`` are time attributes\n    and use the ``TimeAttributeFrame`` class.  This subclass overrides the\n    ``convert_input`` method to validate and convert inputs into a ``Time``\n    object.\n\n    Parameters\n    ----------\n    default : object\n        Default value for the attribute if not provided\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    \"\"\"\n\n    name = '<unbound>'\n\n    def __init__(self, default=None, secondary_attribute=''):\n        self.default = default\n        self.secondary_attribute = secondary_attribute\n        super().__init__()\n\n    def __set_name__(self, owner, name):\n        self.name = name\n\n    def convert_input(self, value):\n        \"\"\"\n        Validate the input ``value`` and convert to expected attribute class.\n\n        The base method here does nothing, but subclasses can implement this\n        as needed.  The method should catch any internal exceptions and raise\n        ValueError with an informative message.\n\n        The method returns the validated input along with a boolean that\n        indicates whether the input value was actually converted.  If the input\n        value was already the correct type then the ``converted`` return value\n        should be ``False``.\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        output_value : object\n            The ``value`` converted to the correct type (or just ``value`` if\n            ``converted`` is False)\n        converted : bool\n            True if the conversion was actually performed, False otherwise.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n\n        \"\"\"\n        return value, False\n\n    def __get__(self, instance, frame_cls=None):\n        if instance is None:\n            out = self.default\n        else:\n            out = getattr(instance, '_' + self.name, self.default)\n            if out is None:\n                out = getattr(instance, self.secondary_attribute, self.default)\n\n        out, converted = self.convert_input(out)\n        if instance is not None:\n            instance_shape = getattr(instance, 'shape', None)  # None if instance (frame) has no data!\n            if instance_shape is not None and (getattr(out, 'shape', ()) and\n                                               out.shape != instance_shape):\n                # If the shapes do not match, try broadcasting.\n                try:\n                    if isinstance(out, ShapedLikeNDArray):\n                        out = out._apply(np.broadcast_to, shape=instance_shape,\n                                         subok=True)\n                    else:\n                        out = np.broadcast_to(out, instance_shape, subok=True)\n                except ValueError:\n                    # raise more informative exception.\n                    raise ValueError(\n                        \"attribute {} should be scalar or have shape {}, \"\n                        \"but is has shape {} and could not be broadcast.\"\n                        .format(self.name, instance_shape, out.shape))\n\n                converted = True\n\n            if converted:\n                setattr(instance, '_' + self.name, out)\n\n        return out\n\n    def __set__(self, instance, val):\n        raise AttributeError('Cannot set frame attribute')"},{"attributeType":"null","col":8,"comment":"null","endLoc":82,"id":15254,"name":"_graph","nodeType":"Attribute","startLoc":82,"text":"self._graph"},{"attributeType":"null","col":12,"comment":"null","endLoc":105,"id":15255,"name":"_cached_frame_set","nodeType":"Attribute","startLoc":105,"text":"self._cached_frame_set"},{"attributeType":"null","col":8,"comment":"null","endLoc":146,"id":15256,"name":"_shortestpaths","nodeType":"Attribute","startLoc":146,"text":"self._shortestpaths"},{"col":4,"comment":"null","endLoc":60,"header":"def __set_name__(self, owner, name)","id":15257,"name":"__set_name__","nodeType":"Function","startLoc":59,"text":"def __set_name__(self, owner, name):\n        self.name = name"},{"attributeType":"null","col":12,"comment":"null","endLoc":120,"id":15258,"name":"_cached_frame_attributes","nodeType":"Attribute","startLoc":120,"text":"self._cached_frame_attributes"},{"col":4,"comment":"\n        Validate the input ``value`` and convert to expected attribute class.\n\n        The base method here does nothing, but subclasses can implement this\n        as needed.  The method should catch any internal exceptions and raise\n        ValueError with an informative message.\n\n        The method returns the validated input along with a boolean that\n        indicates whether the input value was actually converted.  If the input\n        value was already the correct type then the ``converted`` return value\n        should be ``False``.\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        output_value : object\n            The ``value`` converted to the correct type (or just ``value`` if\n            ``converted`` is False)\n        converted : bool\n            True if the conversion was actually performed, False otherwise.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n\n        ","endLoc":94,"header":"def convert_input(self, value)","id":15259,"name":"convert_input","nodeType":"Function","startLoc":62,"text":"def convert_input(self, value):\n        \"\"\"\n        Validate the input ``value`` and convert to expected attribute class.\n\n        The base method here does nothing, but subclasses can implement this\n        as needed.  The method should catch any internal exceptions and raise\n        ValueError with an informative message.\n\n        The method returns the validated input along with a boolean that\n        indicates whether the input value was actually converted.  If the input\n        value was already the correct type then the ``converted`` return value\n        should be ``False``.\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        output_value : object\n            The ``value`` converted to the correct type (or just ``value`` if\n            ``converted`` is False)\n        converted : bool\n            True if the conversion was actually performed, False otherwise.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n\n        \"\"\"\n        return value, False"},{"col":4,"comment":"null","endLoc":128,"header":"def __get__(self, instance, frame_cls=None)","id":15260,"name":"__get__","nodeType":"Function","startLoc":96,"text":"def __get__(self, instance, frame_cls=None):\n        if instance is None:\n            out = self.default\n        else:\n            out = getattr(instance, '_' + self.name, self.default)\n            if out is None:\n                out = getattr(instance, self.secondary_attribute, self.default)\n\n        out, converted = self.convert_input(out)\n        if instance is not None:\n            instance_shape = getattr(instance, 'shape', None)  # None if instance (frame) has no data!\n            if instance_shape is not None and (getattr(out, 'shape', ()) and\n                                               out.shape != instance_shape):\n                # If the shapes do not match, try broadcasting.\n                try:\n                    if isinstance(out, ShapedLikeNDArray):\n                        out = out._apply(np.broadcast_to, shape=instance_shape,\n                                         subok=True)\n                    else:\n                        out = np.broadcast_to(out, instance_shape, subok=True)\n                except ValueError:\n                    # raise more informative exception.\n                    raise ValueError(\n                        \"attribute {} should be scalar or have shape {}, \"\n                        \"but is has shape {} and could not be broadcast.\"\n                        .format(self.name, instance_shape, out.shape))\n\n                converted = True\n\n            if converted:\n                setattr(instance, '_' + self.name, out)\n\n        return out"},{"attributeType":"null","col":12,"comment":"null","endLoc":88,"id":15261,"name":"_cached_names_dct","nodeType":"Attribute","startLoc":88,"text":"self._cached_names_dct"},{"attributeType":"null","col":12,"comment":"null","endLoc":131,"id":15262,"name":"_cached_component_names","nodeType":"Attribute","startLoc":131,"text":"self._cached_component_names"},{"className":"_AngleParser","col":0,"comment":"\n    Parses the various angle formats including:\n\n       * 01:02:30.43 degrees\n       * 1 2 0 hours\n       * 1°2′3″\n       * 1d2m3s\n       * -1h2m3s\n       * 1°2′3″N\n\n    This class should not be used directly.  Use `parse_angle`\n    instead.\n    ","endLoc":314,"id":15263,"nodeType":"Class","startLoc":33,"text":"class _AngleParser:\n    \"\"\"\n    Parses the various angle formats including:\n\n       * 01:02:30.43 degrees\n       * 1 2 0 hours\n       * 1°2′3″\n       * 1d2m3s\n       * -1h2m3s\n       * 1°2′3″N\n\n    This class should not be used directly.  Use `parse_angle`\n    instead.\n    \"\"\"\n    # For safe multi-threaded operation all class (but not instance)\n    # members that carry state should be thread-local. They are stored\n    # in the following class member\n    _thread_local = threading.local()\n\n    def __init__(self):\n        # TODO: in principle, the parser should be invalidated if we change unit\n        # system (from CDS to FITS, say).  Might want to keep a link to the\n        # unit_registry used, and regenerate the parser/lexer if it changes.\n        # Alternatively, perhaps one should not worry at all and just pre-\n        # generate the parser for each release (as done for unit formats).\n        # For some discussion of this problem, see\n        # https://github.com/astropy/astropy/issues/5350#issuecomment-248770151\n        if '_parser' not in _AngleParser._thread_local.__dict__:\n            (_AngleParser._thread_local._parser,\n             _AngleParser._thread_local._lexer) = self._make_parser()\n\n    @classmethod\n    def _get_simple_unit_names(cls):\n        simple_units = set(\n            u.radian.find_equivalent_units(include_prefix_units=True))\n        simple_unit_names = set()\n        # We filter out degree and hourangle, since those are treated\n        # separately.\n        for unit in simple_units:\n            if unit != u.deg and unit != u.hourangle:\n                simple_unit_names.update(unit.names)\n        return sorted(simple_unit_names)\n\n    @classmethod\n    def _make_parser(cls):\n        from astropy.extern.ply import lex, yacc\n\n        # List of token names.\n        tokens = (\n            'SIGN',\n            'UINT',\n            'UFLOAT',\n            'COLON',\n            'DEGREE',\n            'HOUR',\n            'MINUTE',\n            'SECOND',\n            'SIMPLE_UNIT',\n            'EASTWEST',\n            'NORTHSOUTH'\n        )\n\n        # NOTE THE ORDERING OF THESE RULES IS IMPORTANT!!\n        # Regular expression rules for simple tokens\n        def t_UFLOAT(t):\n            r'((\\d+\\.\\d*)|(\\.\\d+))([eE][+-−]?\\d+)?'\n            # The above includes Unicode \"MINUS SIGN\" \\u2212.  It is\n            # important to include the hyphen last, or the regex will\n            # treat this as a range.\n            t.value = float(t.value.replace('−', '-'))\n            return t\n\n        def t_UINT(t):\n            r'\\d+'\n            t.value = int(t.value)\n            return t\n\n        def t_SIGN(t):\n            r'[+−-]'\n            # The above include Unicode \"MINUS SIGN\" \\u2212.  It is\n            # important to include the hyphen last, or the regex will\n            # treat this as a range.\n            if t.value == '+':\n                t.value = 1.0\n            else:\n                t.value = -1.0\n            return t\n\n        def t_EASTWEST(t):\n            r'[EW]$'\n            t.value = -1.0 if t.value == 'W' else 1.0\n            return t\n\n        def t_NORTHSOUTH(t):\n            r'[NS]$'\n            # We cannot use lower-case letters otherwise we'll confuse\n            # s[outh] with s[econd]\n            t.value = -1.0 if t.value == 'S' else 1.0\n            return t\n\n        def t_SIMPLE_UNIT(t):\n            t.value = u.Unit(t.value)\n            return t\n\n        t_SIMPLE_UNIT.__doc__ = '|'.join(\n            f'(?:{x})' for x in cls._get_simple_unit_names())\n\n        t_COLON = ':'\n        t_DEGREE = r'd(eg(ree(s)?)?)?|°'\n        t_HOUR = r'hour(s)?|h(r)?|ʰ'\n        t_MINUTE = r'm(in(ute(s)?)?)?|′|\\'|ᵐ'\n        t_SECOND = r's(ec(ond(s)?)?)?|″|\\\"|ˢ'\n\n        # A string containing ignored characters (spaces)\n        t_ignore = ' '\n\n        # Error handling rule\n        def t_error(t):\n            raise ValueError(\n                f\"Invalid character at col {t.lexpos}\")\n\n        lexer = parsing.lex(lextab='angle_lextab', package='astropy/coordinates')\n\n        def p_angle(p):\n            '''\n            angle : sign hms eastwest\n                  | sign dms dir\n                  | sign arcsecond dir\n                  | sign arcminute dir\n                  | sign simple dir\n            '''\n            sign = p[1] * p[3]\n            value, unit = p[2]\n            if isinstance(value, tuple):\n                p[0] = ((sign * value[0],) + value[1:], unit)\n            else:\n                p[0] = (sign * value, unit)\n\n        def p_sign(p):\n            '''\n            sign : SIGN\n                 |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1.0\n\n        def p_eastwest(p):\n            '''\n            eastwest : EASTWEST\n                     |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1.0\n\n        def p_dir(p):\n            '''\n            dir : EASTWEST\n                | NORTHSOUTH\n                |\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = 1.0\n\n        def p_ufloat(p):\n            '''\n            ufloat : UFLOAT\n                   | UINT\n            '''\n            p[0] = p[1]\n\n        def p_colon(p):\n            '''\n            colon : UINT COLON ufloat\n                  | UINT COLON UINT COLON ufloat\n            '''\n            if len(p) == 4:\n                p[0] = (p[1], p[3])\n            elif len(p) == 6:\n                p[0] = (p[1], p[3], p[5])\n\n        def p_spaced(p):\n            '''\n            spaced : UINT ufloat\n                   | UINT UINT ufloat\n            '''\n            if len(p) == 3:\n                p[0] = (p[1], p[2])\n            elif len(p) == 4:\n                p[0] = (p[1], p[2], p[3])\n\n        def p_generic(p):\n            '''\n            generic : colon\n                    | spaced\n                    | ufloat\n            '''\n            p[0] = p[1]\n\n        def p_hms(p):\n            '''\n            hms : UINT HOUR\n                | UINT HOUR ufloat\n                | UINT HOUR UINT MINUTE\n                | UINT HOUR UFLOAT MINUTE\n                | UINT HOUR UINT MINUTE ufloat\n                | UINT HOUR UINT MINUTE ufloat SECOND\n                | generic HOUR\n            '''\n            if len(p) == 3:\n                p[0] = (p[1], u.hourangle)\n            elif len(p) in (4, 5):\n                p[0] = ((p[1], p[3]), u.hourangle)\n            elif len(p) in (6, 7):\n                p[0] = ((p[1], p[3], p[5]), u.hourangle)\n\n        def p_dms(p):\n            '''\n            dms : UINT DEGREE\n                | UINT DEGREE ufloat\n                | UINT DEGREE UINT MINUTE\n                | UINT DEGREE UFLOAT MINUTE\n                | UINT DEGREE UINT MINUTE ufloat\n                | UINT DEGREE UINT MINUTE ufloat SECOND\n                | generic DEGREE\n            '''\n            if len(p) == 3:\n                p[0] = (p[1], u.degree)\n            elif len(p) in (4, 5):\n                p[0] = ((p[1], p[3]), u.degree)\n            elif len(p) in (6, 7):\n                p[0] = ((p[1], p[3], p[5]), u.degree)\n\n        def p_simple(p):\n            '''\n            simple : generic\n                   | generic SIMPLE_UNIT\n            '''\n            if len(p) == 2:\n                p[0] = (p[1], None)\n            else:\n                p[0] = (p[1], p[2])\n\n        def p_arcsecond(p):\n            '''\n            arcsecond : generic SECOND\n            '''\n            p[0] = (p[1], u.arcsecond)\n\n        def p_arcminute(p):\n            '''\n            arcminute : generic MINUTE\n            '''\n            p[0] = (p[1], u.arcminute)\n\n        def p_error(p):\n            raise ValueError\n\n        parser = parsing.yacc(tabmodule='angle_parsetab', package='astropy/coordinates')\n\n        return parser, lexer\n\n    def parse(self, angle, unit, debug=False):\n        try:\n            found_angle, found_unit = self._thread_local._parser.parse(\n                angle, lexer=self._thread_local._lexer, debug=debug)\n        except ValueError as e:\n            if str(e):\n                raise ValueError(f\"{str(e)} in angle {angle!r}\") from e\n            else:\n                raise ValueError(\n                    f\"Syntax error parsing angle {angle!r}\")  from e\n\n        if unit is None and found_unit is None:\n            raise u.UnitsError(\"No unit specified\")\n\n        return found_angle, found_unit"},{"className":"CoordinateTransform","col":0,"comment":"\n    An object that transforms a coordinate from one system to another.\n    Subclasses must implement `__call__` with the provided signature.\n    They should also call this superclass's ``__init__`` in their\n    ``__init__``.\n\n    Parameters\n    ----------\n    fromsys : `~astropy.coordinates.BaseCoordinateFrame` subclass\n        The coordinate frame class to start from.\n    tosys : `~astropy.coordinates.BaseCoordinateFrame` subclass\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n    ","endLoc":864,"id":15264,"nodeType":"Class","startLoc":767,"text":"class CoordinateTransform(metaclass=ABCMeta):\n    \"\"\"\n    An object that transforms a coordinate from one system to another.\n    Subclasses must implement `__call__` with the provided signature.\n    They should also call this superclass's ``__init__`` in their\n    ``__init__``.\n\n    Parameters\n    ----------\n    fromsys : `~astropy.coordinates.BaseCoordinateFrame` subclass\n        The coordinate frame class to start from.\n    tosys : `~astropy.coordinates.BaseCoordinateFrame` subclass\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n    \"\"\"\n\n    def __init__(self, fromsys, tosys, priority=1, register_graph=None):\n        if not inspect.isclass(fromsys):\n            raise TypeError('fromsys must be a class')\n        if not inspect.isclass(tosys):\n            raise TypeError('tosys must be a class')\n\n        self.fromsys = fromsys\n        self.tosys = tosys\n        self.priority = float(priority)\n\n        if register_graph:\n            # this will do the type-checking when it adds to the graph\n            self.register(register_graph)\n        else:\n            if not inspect.isclass(fromsys) or not inspect.isclass(tosys):\n                raise TypeError('fromsys and tosys must be classes')\n\n        self.overlapping_frame_attr_names = overlap = []\n        if (hasattr(fromsys, 'get_frame_attr_names') and\n                hasattr(tosys, 'get_frame_attr_names')):\n            # the if statement is there so that non-frame things might be usable\n            # if it makes sense\n            for from_nm in fromsys.frame_attributes.keys():\n                if from_nm in tosys.frame_attributes.keys():\n                    overlap.append(from_nm)\n\n    def register(self, graph):\n        \"\"\"\n        Add this transformation to the requested Transformation graph,\n        replacing anything already connecting these two coordinates.\n\n        Parameters\n        ----------\n        graph : `TransformGraph` object\n            The graph to register this transformation with.\n        \"\"\"\n        graph.add_transform(self.fromsys, self.tosys, self)\n\n    def unregister(self, graph):\n        \"\"\"\n        Remove this transformation from the requested transformation\n        graph.\n\n        Parameters\n        ----------\n        graph : a TransformGraph object\n            The graph to unregister this transformation from.\n\n        Raises\n        ------\n        ValueError\n            If this is not currently in the transform graph.\n        \"\"\"\n        graph.remove_transform(self.fromsys, self.tosys, self)\n\n    @abstractmethod\n    def __call__(self, fromcoord, toframe):\n        \"\"\"\n        Does the actual coordinate transformation from the ``fromsys`` class to\n        the ``tosys`` class.\n\n        Parameters\n        ----------\n        fromcoord : `~astropy.coordinates.BaseCoordinateFrame` subclass instance\n            An object of class matching ``fromsys`` that is to be transformed.\n        toframe : object\n            An object that has the attributes necessary to fully specify the\n            frame.  That is, it must have attributes with names that match the\n            keys of the dictionary that ``tosys.get_frame_attr_names()``\n            returns. Typically this is of class ``tosys``, but it *might* be\n            some other class as long as it has the appropriate attributes.\n\n        Returns\n        -------\n        tocoord : `BaseCoordinateFrame` subclass instance\n            The new coordinate after the transform has been applied.\n        \"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":1546,"id":15265,"name":"attr_classes","nodeType":"Attribute","startLoc":1546,"text":"attr_classes"},{"col":4,"comment":"\n        Remove this transformation from the requested transformation\n        graph.\n\n        Parameters\n        ----------\n        graph : a TransformGraph object\n            The graph to unregister this transformation from.\n\n        Raises\n        ------\n        ValueError\n            If this is not currently in the transform graph.\n        ","endLoc":841,"header":"def unregister(self, graph)","id":15266,"name":"unregister","nodeType":"Function","startLoc":826,"text":"def unregister(self, graph):\n        \"\"\"\n        Remove this transformation from the requested transformation\n        graph.\n\n        Parameters\n        ----------\n        graph : a TransformGraph object\n            The graph to unregister this transformation from.\n\n        Raises\n        ------\n        ValueError\n            If this is not currently in the transform graph.\n        \"\"\"\n        graph.remove_transform(self.fromsys, self.tosys, self)"},{"className":"RadialRepresentation","col":0,"comment":"\n    Representation of the distance of points from the origin.\n\n    Note that this is mostly intended as an internal helper representation.\n    It can do little else but being used as a scale in multiplication.\n\n    Parameters\n    ----------\n    distance : `~astropy.units.Quantity` ['length']\n        The distance of the point(s) from the origin.\n\n    differentials : dict, `~astropy.coordinates.BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `~astropy.coordinates.BaseDifferential`\n        instance (see `._compatible_differentials` for valid types), or a\n        dictionary of of differential instances with keys set to a string\n        representation of the SI unit with which the differential (derivative)\n        is taken. For example, for a velocity differential on a positional\n        representation, the key would be ``'s'`` for seconds, indicating that\n        the derivative is a time derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    ","endLoc":1869,"id":15267,"nodeType":"Class","startLoc":1764,"text":"class RadialRepresentation(BaseRepresentation):\n    \"\"\"\n    Representation of the distance of points from the origin.\n\n    Note that this is mostly intended as an internal helper representation.\n    It can do little else but being used as a scale in multiplication.\n\n    Parameters\n    ----------\n    distance : `~astropy.units.Quantity` ['length']\n        The distance of the point(s) from the origin.\n\n    differentials : dict, `~astropy.coordinates.BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `~astropy.coordinates.BaseDifferential`\n        instance (see `._compatible_differentials` for valid types), or a\n        dictionary of of differential instances with keys set to a string\n        representation of the SI unit with which the differential (derivative)\n        is taken. For example, for a velocity differential on a positional\n        representation, the key would be ``'s'`` for seconds, indicating that\n        the derivative is a time derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n\n    attr_classes = {'distance': u.Quantity}\n\n    def __init__(self, distance, differentials=None, copy=True):\n        super().__init__(distance, differentials=differentials, copy=copy)\n\n    @property\n    def distance(self):\n        \"\"\"\n        The distance from the origin to the point(s).\n        \"\"\"\n        return self._distance\n\n    def unit_vectors(self):\n        \"\"\"Cartesian unit vectors are undefined for radial representation.\"\"\"\n        raise NotImplementedError('Cartesian unit vectors are undefined for '\n                                  '{} instances'.format(self.__class__))\n\n    def scale_factors(self):\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return {'distance': l}\n\n    def to_cartesian(self):\n        \"\"\"Cannot convert radial representation to cartesian.\"\"\"\n        raise NotImplementedError('cannot convert {} instance to cartesian.'\n                                  .format(self.__class__))\n\n    @classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates to radial coordinate.\n        \"\"\"\n        return cls(distance=cart.norm(), copy=False)\n\n    def __mul__(self, other):\n        if isinstance(other, BaseRepresentation):\n            return self.distance * other\n        else:\n            return super().__mul__(other)\n\n    def norm(self):\n        \"\"\"Vector norm.\n\n        Just the distance itself.\n\n        Returns\n        -------\n        norm : `~astropy.units.Quantity` ['dimensionless']\n            Dimensionless ones, with the same shape as the representation.\n        \"\"\"\n        return self.distance\n\n    def _combine_operation(self, op, other, reverse=False):\n        return NotImplemented\n\n    def transform(self, matrix):\n        \"\"\"Radial representations cannot be transformed by a Cartesian matrix.\n\n        Parameters\n        ----------\n        matrix : array-like\n            The transformation matrix in a Cartesian basis.\n            Must be a multiplication: a diagonal matrix with identical elements.\n            Must have shape (..., 3, 3), where the last 2 indices are for the\n            matrix on each other axis. Make sure that the matrix shape is\n            compatible with the shape of this representation.\n\n        Raises\n        ------\n        ValueError\n            If the matrix is not a multiplication.\n\n        \"\"\"\n        scl = matrix[..., 0, 0]\n        # check that the matrix is a scaled identity matrix on the last 2 axes.\n        if np.any(matrix != scl[..., np.newaxis, np.newaxis] * np.identity(3)):\n            raise ValueError(\"Radial representations can only be \"\n                             \"transformed by a scaled identity matrix\")\n\n        return self * scl"},{"col":4,"comment":"null","endLoc":1794,"header":"def __init__(self, distance, differentials=None, copy=True)","id":15268,"name":"__init__","nodeType":"Function","startLoc":1793,"text":"def __init__(self, distance, differentials=None, copy=True):\n        super().__init__(distance, differentials=differentials, copy=copy)"},{"attributeType":"null","col":4,"comment":"null","endLoc":50,"id":15269,"name":"_thread_local","nodeType":"Attribute","startLoc":50,"text":"_thread_local"},{"col":4,"comment":"\n        Does the actual coordinate transformation from the ``fromsys`` class to\n        the ``tosys`` class.\n\n        Parameters\n        ----------\n        fromcoord : `~astropy.coordinates.BaseCoordinateFrame` subclass instance\n            An object of class matching ``fromsys`` that is to be transformed.\n        toframe : object\n            An object that has the attributes necessary to fully specify the\n            frame.  That is, it must have attributes with names that match the\n            keys of the dictionary that ``tosys.get_frame_attr_names()``\n            returns. Typically this is of class ``tosys``, but it *might* be\n            some other class as long as it has the appropriate attributes.\n\n        Returns\n        -------\n        tocoord : `BaseCoordinateFrame` subclass instance\n            The new coordinate after the transform has been applied.\n        ","endLoc":864,"header":"@abstractmethod\n    def __call__(self, fromcoord, toframe)","id":15270,"name":"__call__","nodeType":"Function","startLoc":843,"text":"@abstractmethod\n    def __call__(self, fromcoord, toframe):\n        \"\"\"\n        Does the actual coordinate transformation from the ``fromsys`` class to\n        the ``tosys`` class.\n\n        Parameters\n        ----------\n        fromcoord : `~astropy.coordinates.BaseCoordinateFrame` subclass instance\n            An object of class matching ``fromsys`` that is to be transformed.\n        toframe : object\n            An object that has the attributes necessary to fully specify the\n            frame.  That is, it must have attributes with names that match the\n            keys of the dictionary that ``tosys.get_frame_attr_names()``\n            returns. Typically this is of class ``tosys``, but it *might* be\n            some other class as long as it has the appropriate attributes.\n\n        Returns\n        -------\n        tocoord : `BaseCoordinateFrame` subclass instance\n            The new coordinate after the transform has been applied.\n        \"\"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":794,"id":15271,"name":"fromsys","nodeType":"Attribute","startLoc":794,"text":"self.fromsys"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":15272,"name":"__all__","nodeType":"Attribute","startLoc":24,"text":"__all__"},{"attributeType":"null","col":0,"comment":"List of kernel pairs needed to calculate positions of a given object.","endLoc":28,"id":15273,"name":"DEFAULT_JPL_EPHEMERIS","nodeType":"Attribute","startLoc":28,"text":"DEFAULT_JPL_EPHEMERIS"},{"attributeType":"null","col":0,"comment":"Indices to the plan94 routine for the given object.","endLoc":31,"id":15274,"name":"BODY_NAME_TO_KERNEL_SPEC","nodeType":"Attribute","startLoc":31,"text":"BODY_NAME_TO_KERNEL_SPEC"},{"attributeType":"null","col":0,"comment":"null","endLoc":47,"id":15275,"name":"PLAN94_BODY_NAME_TO_PLANET_INDEX","nodeType":"Attribute","startLoc":47,"text":"PLAN94_BODY_NAME_TO_PLANET_INDEX"},{"attributeType":"null","col":0,"comment":"null","endLoc":58,"id":15276,"name":"_EPHEMERIS_NOTE","nodeType":"Attribute","startLoc":58,"text":"_EPHEMERIS_NOTE"},{"attributeType":"null","col":4,"comment":"null","endLoc":514,"id":15277,"name":"f","nodeType":"Attribute","startLoc":514,"text":"f"},{"attributeType":"null","col":0,"comment":"null","endLoc":519,"id":15278,"name":"deprecation_msg","nodeType":"Attribute","startLoc":519,"text":"deprecation_msg"},{"col":0,"comment":"","endLoc":5,"header":"solar_system.py#<anonymous>","id":15279,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module contains convenience functions for retrieving solar system\nephemerides from jplephem.\n\"\"\"\n\n__all__ = [\"get_body\", \"get_moon\", \"get_body_barycentric\",\n           \"get_body_barycentric_posvel\", \"solar_system_ephemeris\"]\n\nDEFAULT_JPL_EPHEMERIS = 'de430'\n\n\"\"\"List of kernel pairs needed to calculate positions of a given object.\"\"\"\n\nBODY_NAME_TO_KERNEL_SPEC = {\n    'sun': [(0, 10)],\n    'mercury': [(0, 1), (1, 199)],\n    'venus': [(0, 2), (2, 299)],\n    'earth-moon-barycenter': [(0, 3)],\n    'earth': [(0, 3), (3, 399)],\n    'moon': [(0, 3), (3, 301)],\n    'mars': [(0, 4)],\n    'jupiter': [(0, 5)],\n    'saturn': [(0, 6)],\n    'uranus': [(0, 7)],\n    'neptune': [(0, 8)],\n    'pluto': [(0, 9)],\n}\n\n\"\"\"Indices to the plan94 routine for the given object.\"\"\"\n\nPLAN94_BODY_NAME_TO_PLANET_INDEX = {\n    'mercury': 1,\n    'venus': 2,\n    'earth-moon-barycenter': 3,\n    'mars': 4,\n    'jupiter': 5,\n    'saturn': 6,\n    'uranus': 7,\n    'neptune': 8,\n}\n\n_EPHEMERIS_NOTE = \"\"\"\nYou can either give an explicit ephemeris or use a default, which is normally\na built-in ephemeris that does not require ephemeris files.  To change\nthe default to be the JPL ephemeris::\n\n    >>> from astropy.coordinates import solar_system_ephemeris\n    >>> solar_system_ephemeris.set('jpl')  # doctest: +SKIP\n\nUse of any JPL ephemeris requires the jplephem package\n(https://pypi.org/project/jplephem/).\nIf needed, the ephemeris file will be downloaded (and cached).\n\nOne can check which bodies are covered by a given ephemeris using::\n\n    >>> solar_system_ephemeris.bodies\n    ('earth', 'sun', 'moon', 'mercury', 'venus', 'earth-moon-barycenter', 'mars', 'jupiter', 'saturn', 'uranus', 'neptune')\n\"\"\"[1:-1]\n\nfor f in [f for f in locals().values() if callable(f) and f.__doc__ is not None\n          and '{_EPHEMERIS_NOTE}' in f.__doc__]:\n    f.__doc__ = f.__doc__.format(_EPHEMERIS_NOTE=indent(_EPHEMERIS_NOTE)[4:])\n\ndeprecation_msg = \"\"\"\nThe use of _apparent_position_in_true_coordinates is deprecated because\nastropy now implements a True Equator True Equinox Frame (TETE), which\nshould be used instead.\n\"\"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":795,"id":15280,"name":"tosys","nodeType":"Attribute","startLoc":795,"text":"self.tosys"},{"col":4,"comment":"\n        The distance from the origin to the point(s).\n        ","endLoc":1801,"header":"@property\n    def distance(self)","id":15281,"name":"distance","nodeType":"Function","startLoc":1796,"text":"@property\n    def distance(self):\n        \"\"\"\n        The distance from the origin to the point(s).\n        \"\"\"\n        return self._distance"},{"col":4,"comment":"Cartesian unit vectors are undefined for radial representation.","endLoc":1806,"header":"def unit_vectors(self)","id":15282,"name":"unit_vectors","nodeType":"Function","startLoc":1803,"text":"def unit_vectors(self):\n        \"\"\"Cartesian unit vectors are undefined for radial representation.\"\"\"\n        raise NotImplementedError('Cartesian unit vectors are undefined for '\n                                  '{} instances'.format(self.__class__))"},{"col":4,"comment":"null","endLoc":1810,"header":"def scale_factors(self)","id":15283,"name":"scale_factors","nodeType":"Function","startLoc":1808,"text":"def scale_factors(self):\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return {'distance': l}"},{"col":4,"comment":"Cannot convert radial representation to cartesian.","endLoc":1815,"header":"def to_cartesian(self)","id":15284,"name":"to_cartesian","nodeType":"Function","startLoc":1812,"text":"def to_cartesian(self):\n        \"\"\"Cannot convert radial representation to cartesian.\"\"\"\n        raise NotImplementedError('cannot convert {} instance to cartesian.'\n                                  .format(self.__class__))"},{"attributeType":"null","col":8,"comment":"null","endLoc":805,"id":15285,"name":"overlapping_frame_attr_names","nodeType":"Attribute","startLoc":805,"text":"self.overlapping_frame_attr_names"},{"col":4,"comment":"\n        Converts 3D rectangular cartesian coordinates to radial coordinate.\n        ","endLoc":1822,"header":"@classmethod\n    def from_cartesian(cls, cart)","id":15286,"name":"from_cartesian","nodeType":"Function","startLoc":1817,"text":"@classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates to radial coordinate.\n        \"\"\"\n        return cls(distance=cart.norm(), copy=False)"},{"attributeType":"null","col":8,"comment":"null","endLoc":796,"id":15287,"name":"priority","nodeType":"Attribute","startLoc":796,"text":"self.priority"},{"col":0,"comment":"\n    Convert hour, minute, second to a float degrees value.\n    ","endLoc":470,"header":"def hms_to_degrees(h, m, s)","id":15288,"name":"hms_to_degrees","nodeType":"Function","startLoc":465,"text":"def hms_to_degrees(h, m, s):\n    \"\"\"\n    Convert hour, minute, second to a float degrees value.\n    \"\"\"\n\n    return hms_to_hours(h, m, s) * 15."},{"className":"FunctionTransform","col":0,"comment":"\n    A coordinate transformation defined by a function that accepts a\n    coordinate object and returns the transformed coordinate object.\n\n    Parameters\n    ----------\n    func : callable\n        The transformation function. Should have a call signature\n        ``func(formcoord, toframe)``. Note that, unlike\n        `CoordinateTransform.__call__`, ``toframe`` is assumed to be of type\n        ``tosys`` for this function.\n    fromsys : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n\n    Raises\n    ------\n    TypeError\n        If ``func`` is not callable.\n    ValueError\n        If ``func`` cannot accept two arguments.\n\n\n    ","endLoc":925,"id":15289,"nodeType":"Class","startLoc":867,"text":"class FunctionTransform(CoordinateTransform):\n    \"\"\"\n    A coordinate transformation defined by a function that accepts a\n    coordinate object and returns the transformed coordinate object.\n\n    Parameters\n    ----------\n    func : callable\n        The transformation function. Should have a call signature\n        ``func(formcoord, toframe)``. Note that, unlike\n        `CoordinateTransform.__call__`, ``toframe`` is assumed to be of type\n        ``tosys`` for this function.\n    fromsys : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n\n    Raises\n    ------\n    TypeError\n        If ``func`` is not callable.\n    ValueError\n        If ``func`` cannot accept two arguments.\n\n\n    \"\"\"\n\n    def __init__(self, func, fromsys, tosys, priority=1, register_graph=None):\n        if not callable(func):\n            raise TypeError('func must be callable')\n\n        with suppress(TypeError):\n            sig = signature(func)\n            kinds = [x.kind for x in sig.parameters.values()]\n            if (len(x for x in kinds if x == sig.POSITIONAL_ONLY) != 2 and\n                    sig.VAR_POSITIONAL not in kinds):\n                raise ValueError('provided function does not accept two arguments')\n\n        self.func = func\n\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)\n\n    def __call__(self, fromcoord, toframe):\n        res = self.func(fromcoord, toframe)\n        if not isinstance(res, self.tosys):\n            raise TypeError(f'the transformation function yielded {res} but '\n                            f'should have been of type {self.tosys}')\n        if fromcoord.data.differentials and not res.data.differentials:\n            warn(\"Applied a FunctionTransform to a coordinate frame with \"\n                 \"differentials, but the FunctionTransform does not handle \"\n                 \"differentials, so they have been dropped.\", AstropyWarning)\n        return res"},{"col":4,"comment":"null","endLoc":925,"header":"def __call__(self, fromcoord, toframe)","id":15290,"name":"__call__","nodeType":"Function","startLoc":916,"text":"def __call__(self, fromcoord, toframe):\n        res = self.func(fromcoord, toframe)\n        if not isinstance(res, self.tosys):\n            raise TypeError(f'the transformation function yielded {res} but '\n                            f'should have been of type {self.tosys}')\n        if fromcoord.data.differentials and not res.data.differentials:\n            warn(\"Applied a FunctionTransform to a coordinate frame with \"\n                 \"differentials, but the FunctionTransform does not handle \"\n                 \"differentials, so they have been dropped.\", AstropyWarning)\n        return res"},{"col":0,"comment":"\n    Convert hour, minute, second to a float radians value.\n    ","endLoc":478,"header":"def hms_to_radians(h, m, s)","id":15291,"name":"hms_to_radians","nodeType":"Function","startLoc":473,"text":"def hms_to_radians(h, m, s):\n    \"\"\"\n    Convert hour, minute, second to a float radians value.\n    \"\"\"\n\n    return u.degree.to(u.radian, hms_to_degrees(h, m, s))"},{"col":4,"comment":"null","endLoc":131,"header":"def __set__(self, instance, val)","id":15292,"name":"__set__","nodeType":"Function","startLoc":130,"text":"def __set__(self, instance, val):\n        raise AttributeError('Cannot set frame attribute')"},{"attributeType":"null","col":4,"comment":"null","endLoc":52,"id":15293,"name":"name","nodeType":"Attribute","startLoc":52,"text":"name"},{"col":0,"comment":"\n    Convert degrees, arcminutes, arcseconds to an ``(hour, minute, second)``\n    tuple.\n    ","endLoc":487,"header":"def hms_to_dms(h, m, s)","id":15294,"name":"hms_to_dms","nodeType":"Function","startLoc":481,"text":"def hms_to_dms(h, m, s):\n    \"\"\"\n    Convert degrees, arcminutes, arcseconds to an ``(hour, minute, second)``\n    tuple.\n    \"\"\"\n\n    return degrees_to_dms(hms_to_degrees(h, m, s))"},{"col":4,"comment":"\n        Return a new SkyCoord instance which is consistent with the input\n        SkyCoord objects ``skycoords`` and has ``length`` rows.  Being\n        \"consistent\" is defined as being able to set an item from one to each of\n        the rest without any exception being raised.\n\n        This is intended for creating a new SkyCoord instance whose elements can\n        be set in-place for table operations like join or vstack.  This is used\n        when a SkyCoord object is used as a mixin column in an astropy Table.\n\n        The data values are not predictable and it is expected that the consumer\n        of the object will fill in all values.\n\n        Parameters\n        ----------\n        skycoords : list\n            List of input SkyCoord objects\n        length : int\n            Length of the output skycoord object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output name (sets output skycoord.info.name)\n\n        Returns\n        -------\n        skycoord : SkyCoord (or subclass)\n            Instance of this class consistent with ``skycoords``\n\n        ","endLoc":158,"header":"def new_like(self, skycoords, length, metadata_conflicts='warn', name=None)","id":15295,"name":"new_like","nodeType":"Function","startLoc":103,"text":"def new_like(self, skycoords, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new SkyCoord instance which is consistent with the input\n        SkyCoord objects ``skycoords`` and has ``length`` rows.  Being\n        \"consistent\" is defined as being able to set an item from one to each of\n        the rest without any exception being raised.\n\n        This is intended for creating a new SkyCoord instance whose elements can\n        be set in-place for table operations like join or vstack.  This is used\n        when a SkyCoord object is used as a mixin column in an astropy Table.\n\n        The data values are not predictable and it is expected that the consumer\n        of the object will fill in all values.\n\n        Parameters\n        ----------\n        skycoords : list\n            List of input SkyCoord objects\n        length : int\n            Length of the output skycoord object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output name (sets output skycoord.info.name)\n\n        Returns\n        -------\n        skycoord : SkyCoord (or subclass)\n            Instance of this class consistent with ``skycoords``\n\n        \"\"\"\n        # Get merged info attributes like shape, dtype, format, description, etc.\n        attrs = self.merge_cols_attributes(skycoords, metadata_conflicts, name,\n                                           ('meta', 'description'))\n        skycoord0 = skycoords[0]\n\n        # Make a new SkyCoord object with the desired length and attributes\n        # by using the _apply / __getitem__ machinery to effectively return\n        # skycoord0[[0, 0, ..., 0, 0]]. This will have the all the right frame\n        # attributes with the right shape.\n        indexes = np.zeros(length, dtype=np.int64)\n        out = skycoord0[indexes]\n\n        # Use __setitem__ machinery to check for consistency of all skycoords\n        for skycoord in skycoords[1:]:\n            try:\n                out[0] = skycoord[0]\n            except Exception as err:\n                raise ValueError(f'Input skycoords are inconsistent.') from err\n\n        # Set (merged) info attributes\n        for attr in ('name', 'meta', 'description'):\n            if attr in attrs:\n                setattr(out.info, attr, attrs[attr])\n\n        return out"},{"attributeType":"null","col":8,"comment":"null","endLoc":55,"id":15296,"name":"default","nodeType":"Attribute","startLoc":55,"text":"self.default"},{"col":0,"comment":"\n    Convert any parseable hour value into a float value.\n    ","endLoc":495,"header":"def hours_to_decimal(h)","id":15297,"name":"hours_to_decimal","nodeType":"Function","startLoc":490,"text":"def hours_to_decimal(h):\n    \"\"\"\n    Convert any parseable hour value into a float value.\n    \"\"\"\n    from . import angles\n    return angles.Angle(h, unit=u.hourangle).hour"},{"attributeType":"null","col":8,"comment":"null","endLoc":56,"id":15298,"name":"secondary_attribute","nodeType":"Attribute","startLoc":56,"text":"self.secondary_attribute"},{"attributeType":"Callable","col":8,"comment":"null","endLoc":911,"id":15299,"name":"func","nodeType":"Attribute","startLoc":911,"text":"self.func"},{"className":"FunctionTransformWithFiniteDifference","col":0,"comment":"\n    A coordinate transformation that works like a `FunctionTransform`, but\n    computes velocity shifts based on the finite-difference relative to one of\n    the frame attributes.  Note that the transform function should *not* change\n    the differential at all in this case, as any differentials will be\n    overridden.\n\n    When a differential is in the from coordinate, the finite difference\n    calculation has two components. The first part is simple the existing\n    differential, but re-orientation (using finite-difference techniques) to\n    point in the direction the velocity vector has in the *new* frame. The\n    second component is the \"induced\" velocity.  That is, the velocity\n    intrinsic to the frame itself, estimated by shifting the frame using the\n    ``finite_difference_frameattr_name`` frame attribute a small amount\n    (``finite_difference_dt``) in time and re-calculating the position.\n\n    Parameters\n    ----------\n    finite_difference_frameattr_name : str or None\n        The name of the frame attribute on the frames to use for the finite\n        difference.  Both the to and the from frame will be checked for this\n        attribute, but only one needs to have it. If None, no velocity\n        component induced from the frame itself will be included - only the\n        re-orientation of any existing differential.\n    finite_difference_dt : `~astropy.units.Quantity` ['time'] or callable\n        If a quantity, this is the size of the differential used to do the\n        finite difference.  If a callable, should accept\n        ``(fromcoord, toframe)`` and return the ``dt`` value.\n    symmetric_finite_difference : bool\n        If True, the finite difference is computed as\n        :math:`\\frac{x(t + \\Delta t / 2) - x(t + \\Delta t / 2)}{\\Delta t}`, or\n        if False, :math:`\\frac{x(t + \\Delta t) - x(t)}{\\Delta t}`.  The latter\n        case has slightly better performance (and more stable finite difference\n        behavior).\n\n    All other parameters are identical to the initializer for\n    `FunctionTransform`.\n\n    ","endLoc":1081,"id":15300,"nodeType":"Class","startLoc":928,"text":"class FunctionTransformWithFiniteDifference(FunctionTransform):\n    r\"\"\"\n    A coordinate transformation that works like a `FunctionTransform`, but\n    computes velocity shifts based on the finite-difference relative to one of\n    the frame attributes.  Note that the transform function should *not* change\n    the differential at all in this case, as any differentials will be\n    overridden.\n\n    When a differential is in the from coordinate, the finite difference\n    calculation has two components. The first part is simple the existing\n    differential, but re-orientation (using finite-difference techniques) to\n    point in the direction the velocity vector has in the *new* frame. The\n    second component is the \"induced\" velocity.  That is, the velocity\n    intrinsic to the frame itself, estimated by shifting the frame using the\n    ``finite_difference_frameattr_name`` frame attribute a small amount\n    (``finite_difference_dt``) in time and re-calculating the position.\n\n    Parameters\n    ----------\n    finite_difference_frameattr_name : str or None\n        The name of the frame attribute on the frames to use for the finite\n        difference.  Both the to and the from frame will be checked for this\n        attribute, but only one needs to have it. If None, no velocity\n        component induced from the frame itself will be included - only the\n        re-orientation of any existing differential.\n    finite_difference_dt : `~astropy.units.Quantity` ['time'] or callable\n        If a quantity, this is the size of the differential used to do the\n        finite difference.  If a callable, should accept\n        ``(fromcoord, toframe)`` and return the ``dt`` value.\n    symmetric_finite_difference : bool\n        If True, the finite difference is computed as\n        :math:`\\frac{x(t + \\Delta t / 2) - x(t + \\Delta t / 2)}{\\Delta t}`, or\n        if False, :math:`\\frac{x(t + \\Delta t) - x(t)}{\\Delta t}`.  The latter\n        case has slightly better performance (and more stable finite difference\n        behavior).\n\n    All other parameters are identical to the initializer for\n    `FunctionTransform`.\n\n    \"\"\"\n\n    def __init__(self, func, fromsys, tosys, priority=1, register_graph=None,\n                 finite_difference_frameattr_name='obstime',\n                 finite_difference_dt=1*u.second,\n                 symmetric_finite_difference=True):\n        super().__init__(func, fromsys, tosys, priority, register_graph)\n        self.finite_difference_frameattr_name = finite_difference_frameattr_name\n        self.finite_difference_dt = finite_difference_dt\n        self.symmetric_finite_difference = symmetric_finite_difference\n\n    @property\n    def finite_difference_frameattr_name(self):\n        return self._finite_difference_frameattr_name\n\n    @finite_difference_frameattr_name.setter\n    def finite_difference_frameattr_name(self, value):\n        if value is None:\n            self._diff_attr_in_fromsys = self._diff_attr_in_tosys = False\n        else:\n            diff_attr_in_fromsys = value in self.fromsys.frame_attributes\n            diff_attr_in_tosys = value in self.tosys.frame_attributes\n            if diff_attr_in_fromsys or diff_attr_in_tosys:\n                self._diff_attr_in_fromsys = diff_attr_in_fromsys\n                self._diff_attr_in_tosys = diff_attr_in_tosys\n            else:\n                raise ValueError('Frame attribute name {} is not a frame '\n                                 'attribute of {} or {}'.format(value,\n                                                                self.fromsys,\n                                                                self.tosys))\n        self._finite_difference_frameattr_name = value\n\n    def __call__(self, fromcoord, toframe):\n        from .representation import (CartesianRepresentation,\n                                     CartesianDifferential)\n\n        supcall = self.func\n        if fromcoord.data.differentials:\n            # this is the finite difference case\n\n            if callable(self.finite_difference_dt):\n                dt = self.finite_difference_dt(fromcoord, toframe)\n            else:\n                dt = self.finite_difference_dt\n            halfdt = dt/2\n\n            from_diffless = fromcoord.realize_frame(fromcoord.data.without_differentials())\n            reprwithoutdiff = supcall(from_diffless, toframe)\n\n            # first we use the existing differential to compute an offset due to\n            # the already-existing velocity, but in the new frame\n            fromcoord_cart = fromcoord.cartesian\n            if self.symmetric_finite_difference:\n                fwdxyz = (fromcoord_cart.xyz +\n                          fromcoord_cart.differentials['s'].d_xyz*halfdt)\n                fwd = supcall(fromcoord.realize_frame(CartesianRepresentation(fwdxyz)), toframe)\n                backxyz = (fromcoord_cart.xyz -\n                           fromcoord_cart.differentials['s'].d_xyz*halfdt)\n                back = supcall(fromcoord.realize_frame(CartesianRepresentation(backxyz)), toframe)\n            else:\n                fwdxyz = (fromcoord_cart.xyz +\n                          fromcoord_cart.differentials['s'].d_xyz*dt)\n                fwd = supcall(fromcoord.realize_frame(CartesianRepresentation(fwdxyz)), toframe)\n                back = reprwithoutdiff\n            diffxyz = (fwd.cartesian - back.cartesian).xyz / dt\n\n            # now we compute the \"induced\" velocities due to any movement in\n            # the frame itself over time\n            attrname = self.finite_difference_frameattr_name\n            if attrname is not None:\n                if self.symmetric_finite_difference:\n                    if self._diff_attr_in_fromsys:\n                        kws = {attrname: getattr(from_diffless, attrname) + halfdt}\n                        from_diffless_fwd = from_diffless.replicate(**kws)\n                    else:\n                        from_diffless_fwd = from_diffless\n                    if self._diff_attr_in_tosys:\n                        kws = {attrname: getattr(toframe, attrname) + halfdt}\n                        fwd_frame = toframe.replicate_without_data(**kws)\n                    else:\n                        fwd_frame = toframe\n                    fwd = supcall(from_diffless_fwd, fwd_frame)\n\n                    if self._diff_attr_in_fromsys:\n                        kws = {attrname: getattr(from_diffless, attrname) - halfdt}\n                        from_diffless_back = from_diffless.replicate(**kws)\n                    else:\n                        from_diffless_back = from_diffless\n                    if self._diff_attr_in_tosys:\n                        kws = {attrname: getattr(toframe, attrname) - halfdt}\n                        back_frame = toframe.replicate_without_data(**kws)\n                    else:\n                        back_frame = toframe\n                    back = supcall(from_diffless_back, back_frame)\n                else:\n                    if self._diff_attr_in_fromsys:\n                        kws = {attrname: getattr(from_diffless, attrname) + dt}\n                        from_diffless_fwd = from_diffless.replicate(**kws)\n                    else:\n                        from_diffless_fwd = from_diffless\n                    if self._diff_attr_in_tosys:\n                        kws = {attrname: getattr(toframe, attrname) + dt}\n                        fwd_frame = toframe.replicate_without_data(**kws)\n                    else:\n                        fwd_frame = toframe\n                    fwd = supcall(from_diffless_fwd, fwd_frame)\n                    back = reprwithoutdiff\n\n                diffxyz += (fwd.cartesian - back.cartesian).xyz / dt\n\n            newdiff = CartesianDifferential(diffxyz)\n            reprwithdiff = reprwithoutdiff.data.to_cartesian().with_differentials(newdiff)\n            return reprwithoutdiff.realize_frame(reprwithdiff)\n        else:\n            return supcall(fromcoord, toframe)"},{"col":4,"comment":"null","endLoc":980,"header":"@property\n    def finite_difference_frameattr_name(self)","id":15301,"name":"finite_difference_frameattr_name","nodeType":"Function","startLoc":978,"text":"@property\n    def finite_difference_frameattr_name(self):\n        return self._finite_difference_frameattr_name"},{"col":4,"comment":"null","endLoc":997,"header":"@finite_difference_frameattr_name.setter\n    def finite_difference_frameattr_name(self, value)","id":15302,"name":"finite_difference_frameattr_name","nodeType":"Function","startLoc":982,"text":"@finite_difference_frameattr_name.setter\n    def finite_difference_frameattr_name(self, value):\n        if value is None:\n            self._diff_attr_in_fromsys = self._diff_attr_in_tosys = False\n        else:\n            diff_attr_in_fromsys = value in self.fromsys.frame_attributes\n            diff_attr_in_tosys = value in self.tosys.frame_attributes\n            if diff_attr_in_fromsys or diff_attr_in_tosys:\n                self._diff_attr_in_fromsys = diff_attr_in_fromsys\n                self._diff_attr_in_tosys = diff_attr_in_tosys\n            else:\n                raise ValueError('Frame attribute name {} is not a frame '\n                                 'attribute of {} or {}'.format(value,\n                                                                self.fromsys,\n                                                                self.tosys))\n        self._finite_difference_frameattr_name = value"},{"attributeType":"null","col":8,"comment":"null","endLoc":60,"id":15303,"name":"name","nodeType":"Attribute","startLoc":60,"text":"self.name"},{"col":4,"comment":"null","endLoc":1081,"header":"def __call__(self, fromcoord, toframe)","id":15304,"name":"__call__","nodeType":"Function","startLoc":999,"text":"def __call__(self, fromcoord, toframe):\n        from .representation import (CartesianRepresentation,\n                                     CartesianDifferential)\n\n        supcall = self.func\n        if fromcoord.data.differentials:\n            # this is the finite difference case\n\n            if callable(self.finite_difference_dt):\n                dt = self.finite_difference_dt(fromcoord, toframe)\n            else:\n                dt = self.finite_difference_dt\n            halfdt = dt/2\n\n            from_diffless = fromcoord.realize_frame(fromcoord.data.without_differentials())\n            reprwithoutdiff = supcall(from_diffless, toframe)\n\n            # first we use the existing differential to compute an offset due to\n            # the already-existing velocity, but in the new frame\n            fromcoord_cart = fromcoord.cartesian\n            if self.symmetric_finite_difference:\n                fwdxyz = (fromcoord_cart.xyz +\n                          fromcoord_cart.differentials['s'].d_xyz*halfdt)\n                fwd = supcall(fromcoord.realize_frame(CartesianRepresentation(fwdxyz)), toframe)\n                backxyz = (fromcoord_cart.xyz -\n                           fromcoord_cart.differentials['s'].d_xyz*halfdt)\n                back = supcall(fromcoord.realize_frame(CartesianRepresentation(backxyz)), toframe)\n            else:\n                fwdxyz = (fromcoord_cart.xyz +\n                          fromcoord_cart.differentials['s'].d_xyz*dt)\n                fwd = supcall(fromcoord.realize_frame(CartesianRepresentation(fwdxyz)), toframe)\n                back = reprwithoutdiff\n            diffxyz = (fwd.cartesian - back.cartesian).xyz / dt\n\n            # now we compute the \"induced\" velocities due to any movement in\n            # the frame itself over time\n            attrname = self.finite_difference_frameattr_name\n            if attrname is not None:\n                if self.symmetric_finite_difference:\n                    if self._diff_attr_in_fromsys:\n                        kws = {attrname: getattr(from_diffless, attrname) + halfdt}\n                        from_diffless_fwd = from_diffless.replicate(**kws)\n                    else:\n                        from_diffless_fwd = from_diffless\n                    if self._diff_attr_in_tosys:\n                        kws = {attrname: getattr(toframe, attrname) + halfdt}\n                        fwd_frame = toframe.replicate_without_data(**kws)\n                    else:\n                        fwd_frame = toframe\n                    fwd = supcall(from_diffless_fwd, fwd_frame)\n\n                    if self._diff_attr_in_fromsys:\n                        kws = {attrname: getattr(from_diffless, attrname) - halfdt}\n                        from_diffless_back = from_diffless.replicate(**kws)\n                    else:\n                        from_diffless_back = from_diffless\n                    if self._diff_attr_in_tosys:\n                        kws = {attrname: getattr(toframe, attrname) - halfdt}\n                        back_frame = toframe.replicate_without_data(**kws)\n                    else:\n                        back_frame = toframe\n                    back = supcall(from_diffless_back, back_frame)\n                else:\n                    if self._diff_attr_in_fromsys:\n                        kws = {attrname: getattr(from_diffless, attrname) + dt}\n                        from_diffless_fwd = from_diffless.replicate(**kws)\n                    else:\n                        from_diffless_fwd = from_diffless\n                    if self._diff_attr_in_tosys:\n                        kws = {attrname: getattr(toframe, attrname) + dt}\n                        fwd_frame = toframe.replicate_without_data(**kws)\n                    else:\n                        fwd_frame = toframe\n                    fwd = supcall(from_diffless_fwd, fwd_frame)\n                    back = reprwithoutdiff\n\n                diffxyz += (fwd.cartesian - back.cartesian).xyz / dt\n\n            newdiff = CartesianDifferential(diffxyz)\n            reprwithdiff = reprwithoutdiff.data.to_cartesian().with_differentials(newdiff)\n            return reprwithoutdiff.realize_frame(reprwithdiff)\n        else:\n            return supcall(fromcoord, toframe)"},{"className":"RepresentationMapping","col":0,"comment":"\n    This `~collections.namedtuple` is used with the\n    ``frame_specific_representation_info`` attribute to tell frames what\n    attribute names (and default units) to use for a particular representation.\n    ``reprname`` and ``framename`` should be strings, while ``defaultunit`` can\n    be either an astropy unit, the string ``'recommended'`` (which is degrees\n    for Angles, nothing otherwise), or None (to indicate that no unit mapping\n    should be done).\n    ","endLoc":132,"id":15305,"nodeType":"Class","startLoc":119,"text":"class RepresentationMapping(_RepresentationMappingBase):\n    \"\"\"\n    This `~collections.namedtuple` is used with the\n    ``frame_specific_representation_info`` attribute to tell frames what\n    attribute names (and default units) to use for a particular representation.\n    ``reprname`` and ``framename`` should be strings, while ``defaultunit`` can\n    be either an astropy unit, the string ``'recommended'`` (which is degrees\n    for Angles, nothing otherwise), or None (to indicate that no unit mapping\n    should be done).\n    \"\"\"\n\n    def __new__(cls, reprname, framename, defaultunit='recommended'):\n        # this trick just provides some defaults\n        return super().__new__(cls, reprname, framename, defaultunit)"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":15306,"name":"__all__","nodeType":"Attribute","startLoc":30,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":114,"id":15307,"name":"_RepresentationMappingBase","nodeType":"Attribute","startLoc":114,"text":"_RepresentationMappingBase"},{"attributeType":"null","col":0,"comment":"null","endLoc":135,"id":15308,"name":"base_doc","nodeType":"Attribute","startLoc":135,"text":"base_doc"},{"attributeType":"null","col":0,"comment":"null","endLoc":165,"id":15309,"name":"_components","nodeType":"Attribute","startLoc":165,"text":"_components"},{"col":0,"comment":"","endLoc":6,"header":"baseframe.py#<anonymous>","id":15310,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nFramework and base classes for coordinate frames/\"low-level\" coordinate\nclasses.\n\"\"\"\n\n__all__ = ['BaseCoordinateFrame', 'frame_transform_graph',\n           'GenericFrame', 'RepresentationMapping']\n\nframe_transform_graph = TransformGraph()\n\n_RepresentationMappingBase = \\\n    namedtuple('RepresentationMapping',\n               ('reprname', 'framename', 'defaultunit'))\n\nbase_doc = \"\"\"{__doc__}\n    Parameters\n    ----------\n    data : `~astropy.coordinates.BaseRepresentation` subclass instance\n        A representation object or ``None`` to have no data (or use the\n        coordinate component arguments, see below).\n    {components}\n    representation_type : `~astropy.coordinates.BaseRepresentation` subclass, str, optional\n        A representation class or string name of a representation class. This\n        sets the expected input representation class, thereby changing the\n        expected keyword arguments for the data passed in. For example, passing\n        ``representation_type='cartesian'`` will make the classes expect\n        position data with cartesian names, i.e. ``x, y, z`` in most cases\n        unless overridden via ``frame_specific_representation_info``. To see this\n        frame's names, check out ``<this frame>().representation_info``.\n    differential_type : `~astropy.coordinates.BaseDifferential` subclass, str, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets the\n        expected input differential class, thereby changing the expected keyword\n        arguments of the data passed in. For example, passing\n        ``differential_type='cartesian'`` will make the classes expect velocity\n        data with the argument names ``v_x, v_y, v_z`` unless overridden via\n        ``frame_specific_representation_info``. To see this frame's names,\n        check out ``<this frame>().representation_info``.\n    copy : bool, optional\n        If `True` (default), make copies of the input coordinate arrays.\n        Can only be passed in as a keyword argument.\n    {footer}\n\"\"\"\n\n_components = \"\"\"\n    *args, **kwargs\n        Coordinate components, with names that depend on the subclass.\n\"\"\""},{"fileName":"calculation.py","filePath":"astropy/coordinates","id":15311,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\n# Standard library\nimport re\nimport textwrap\nimport warnings\nfrom datetime import datetime\nfrom urllib.request import urlopen, Request\n\n# Third-party\nfrom astropy import time as atime\nfrom astropy.utils.console import color_print, _color_text\nfrom . import get_sun\n\n__all__ = []\n\n\nclass HumanError(ValueError):\n    pass\n\n\nclass CelestialError(ValueError):\n    pass\n\n\ndef get_sign(dt):\n    \"\"\"\n    \"\"\"\n    if ((int(dt.month) == 12 and int(dt.day) >= 22)or(int(dt.month) == 1 and int(dt.day) <= 19)):\n        zodiac_sign = \"capricorn\"\n    elif ((int(dt.month) == 1 and int(dt.day) >= 20)or(int(dt.month) == 2 and int(dt.day) <= 17)):\n        zodiac_sign = \"aquarius\"\n    elif ((int(dt.month) == 2 and int(dt.day) >= 18)or(int(dt.month) == 3 and int(dt.day) <= 19)):\n        zodiac_sign = \"pisces\"\n    elif ((int(dt.month) == 3 and int(dt.day) >= 20)or(int(dt.month) == 4 and int(dt.day) <= 19)):\n        zodiac_sign = \"aries\"\n    elif ((int(dt.month) == 4 and int(dt.day) >= 20)or(int(dt.month) == 5 and int(dt.day) <= 20)):\n        zodiac_sign = \"taurus\"\n    elif ((int(dt.month) == 5 and int(dt.day) >= 21)or(int(dt.month) == 6 and int(dt.day) <= 20)):\n        zodiac_sign = \"gemini\"\n    elif ((int(dt.month) == 6 and int(dt.day) >= 21)or(int(dt.month) == 7 and int(dt.day) <= 22)):\n        zodiac_sign = \"cancer\"\n    elif ((int(dt.month) == 7 and int(dt.day) >= 23)or(int(dt.month) == 8 and int(dt.day) <= 22)):\n        zodiac_sign = \"leo\"\n    elif ((int(dt.month) == 8 and int(dt.day) >= 23)or(int(dt.month) == 9 and int(dt.day) <= 22)):\n        zodiac_sign = \"virgo\"\n    elif ((int(dt.month) == 9 and int(dt.day) >= 23)or(int(dt.month) == 10 and int(dt.day) <= 22)):\n        zodiac_sign = \"libra\"\n    elif ((int(dt.month) == 10 and int(dt.day) >= 23)or(int(dt.month) == 11 and int(dt.day) <= 21)):\n        zodiac_sign = \"scorpio\"\n    elif ((int(dt.month) == 11 and int(dt.day) >= 22)or(int(dt.month) == 12 and int(dt.day) <= 21)):\n        zodiac_sign = \"sagittarius\"\n\n    return zodiac_sign\n\n\n_VALID_SIGNS = [\"capricorn\", \"aquarius\", \"pisces\", \"aries\", \"taurus\", \"gemini\",\n                \"cancer\", \"leo\", \"virgo\", \"libra\", \"scorpio\", \"sagittarius\"]\n# Some of the constellation names map to different astrological \"sign names\".\n# Astrologers really needs to talk to the IAU...\n_CONST_TO_SIGNS = {'capricornus': 'capricorn', 'scorpius': 'scorpio'}\n\n_ZODIAC = ((1900, \"rat\"), (1901, \"ox\"), (1902, \"tiger\"),\n           (1903, \"rabbit\"), (1904, \"dragon\"), (1905, \"snake\"),\n           (1906, \"horse\"), (1907, \"goat\"), (1908, \"monkey\"),\n           (1909, \"rooster\"), (1910, \"dog\"), (1911, \"pig\"))\n\n\n# https://stackoverflow.com/questions/12791871/chinese-zodiac-python-program\ndef _get_zodiac(yr):\n    return _ZODIAC[(yr - _ZODIAC[0][0]) % 12][1]\n\n\ndef horoscope(birthday, corrected=True, chinese=False):\n    \"\"\"\n    Enter your birthday as an `astropy.time.Time` object and\n    receive a mystical horoscope about things to come.\n\n    Parameters\n    ----------\n    birthday : `astropy.time.Time` or str\n        Your birthday as a `datetime.datetime` or `astropy.time.Time` object\n        or \"YYYY-MM-DD\"string.\n    corrected : bool\n        Whether to account for the precession of the Earth instead of using the\n        ancient Greek dates for the signs.  After all, you do want your *real*\n        horoscope, not a cheap inaccurate approximation, right?\n\n    chinese : bool\n        Chinese annual zodiac wisdom instead of Western one.\n\n    Returns\n    -------\n    Infinite wisdom, condensed into astrologically precise prose.\n\n    Notes\n    -----\n    This function was implemented on April 1.  Take note of that date.\n    \"\"\"\n    from bs4 import BeautifulSoup\n\n    today = datetime.now()\n    err_msg = \"Invalid response from celestial gods (failed to load horoscope).\"\n    headers = {'User-Agent': 'foo/bar'}\n\n    special_words = {\n        '([sS]tar[s^ ]*)': 'yellow',\n        '([yY]ou[^ ]*)': 'magenta',\n        '([pP]lay[^ ]*)': 'blue',\n        '([hH]eart)': 'red',\n        '([fF]ate)': 'lightgreen',\n    }\n\n    if isinstance(birthday, str):\n        birthday = datetime.strptime(birthday, '%Y-%m-%d')\n\n    if chinese:\n        # TODO: Make this more accurate by using the actual date, not just year\n        # Might need third-party tool like https://pypi.org/project/lunardate\n        zodiac_sign = _get_zodiac(birthday.year)\n        url = ('https://www.horoscope.com/us/horoscopes/yearly/'\n               '{}-chinese-horoscope-{}.aspx'.format(today.year, zodiac_sign))\n        summ_title_sfx = f'in {today.year}'\n\n        try:\n            res = Request(url, headers=headers)\n            with urlopen(res) as f:\n                try:\n                    doc = BeautifulSoup(f, 'html.parser')\n                    # TODO: Also include Love, Family & Friends, Work, Money, More?\n                    item = doc.find(id='overview')\n                    desc = item.getText()\n                except Exception:\n                    raise CelestialError(err_msg)\n        except Exception:\n            raise CelestialError(err_msg)\n\n    else:\n        birthday = atime.Time(birthday)\n\n        if corrected:\n            with warnings.catch_warnings():\n                warnings.simplefilter('ignore')  # Ignore ErfaWarning\n                zodiac_sign = get_sun(birthday).get_constellation().lower()\n            zodiac_sign = _CONST_TO_SIGNS.get(zodiac_sign, zodiac_sign)\n            if zodiac_sign not in _VALID_SIGNS:\n                raise HumanError('On your birthday the sun was in {}, which is not '\n                                 'a sign of the zodiac.  You must not exist.  Or '\n                                 'maybe you can settle for '\n                                 'corrected=False.'.format(zodiac_sign.title()))\n        else:\n            zodiac_sign = get_sign(birthday.to_datetime())\n        url = f\"http://www.astrology.com/us/horoscope/daily-overview.aspx?sign={zodiac_sign}\"\n        summ_title_sfx = f\"on {today.strftime('%Y-%m-%d')}\"\n\n        res = Request(url, headers=headers)\n        with urlopen(res) as f:\n            try:\n                doc = BeautifulSoup(f, 'html.parser')\n                item = doc.find('div', {'id': 'content'})\n                desc = item.getText()\n            except Exception:\n                raise CelestialError(err_msg)\n\n    print(\"*\"*79)\n    color_print(f\"Horoscope for {zodiac_sign.capitalize()} {summ_title_sfx}:\",\n                'green')\n    print(\"*\"*79)\n    for block in textwrap.wrap(desc, 79):\n        split_block = block.split()\n        for i, word in enumerate(split_block):\n            for re_word in special_words.keys():\n                match = re.search(re_word, word)\n                if match is None:\n                    continue\n                split_block[i] = _color_text(match.groups()[0], special_words[re_word])\n        print(\" \".join(split_block))\n\n\ndef inject_horoscope():\n    import astropy\n    astropy._yourfuture = horoscope\n\n\ninject_horoscope()\n"},{"fileName":"matching.py","filePath":"astropy/coordinates","id":15312,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module contains functions for matching coordinate catalogs.\n\"\"\"\n\nimport numpy as np\n\nfrom .representation import UnitSphericalRepresentation\nfrom astropy import units as u\nfrom . import Angle\nfrom .sky_coordinate import SkyCoord\n\n__all__ = ['match_coordinates_3d', 'match_coordinates_sky', 'search_around_3d',\n           'search_around_sky']\n\n\ndef match_coordinates_3d(matchcoord, catalogcoord, nthneighbor=1, storekdtree='kdtree_3d'):\n    \"\"\"\n    Finds the nearest 3-dimensional matches of a coordinate or coordinates in\n    a set of catalog coordinates.\n\n    This finds the 3-dimensional closest neighbor, which is only different\n    from the on-sky distance if ``distance`` is set in either ``matchcoord``\n    or ``catalogcoord``.\n\n    Parameters\n    ----------\n    matchcoord : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The coordinate(s) to match to the catalog.\n    catalogcoord : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The base catalog in which to search for matches. Typically this will\n        be a coordinate object that is an array (i.e.,\n        ``catalogcoord.isscalar == False``)\n    nthneighbor : int, optional\n        Which closest neighbor to search for.  Typically ``1`` is desired here,\n        as that is correct for matching one set of coordinates to another.\n        The next likely use case is ``2``, for matching a coordinate catalog\n        against *itself* (``1`` is inappropriate because each point will find\n        itself as the closest match).\n    storekdtree : bool or str, optional\n        If a string, will store the KD-Tree used for the computation\n        in the ``catalogcoord``, as in ``catalogcoord.cache`` with the\n        provided name.  This dramatically speeds up subsequent calls with the\n        same catalog. If False, the KD-Tree is discarded after use.\n\n    Returns\n    -------\n    idx : int array\n        Indices into ``catalogcoord`` to get the matched points for each\n        ``matchcoord``. Shape matches ``matchcoord``.\n    sep2d : `~astropy.coordinates.Angle`\n        The on-sky separation between the closest match for each ``matchcoord``\n        and the ``matchcoord``. Shape matches ``matchcoord``.\n    dist3d : `~astropy.units.Quantity` ['length']\n        The 3D distance between the closest match for each ``matchcoord`` and\n        the ``matchcoord``. Shape matches ``matchcoord``.\n\n    Notes\n    -----\n    This function requires `SciPy <https://www.scipy.org/>`_ to be installed\n    or it will fail.\n    \"\"\"\n    if catalogcoord.isscalar or len(catalogcoord) < 1:\n        raise ValueError('The catalog for coordinate matching cannot be a '\n                         'scalar or length-0.')\n\n    kdt = _get_cartesian_kdtree(catalogcoord, storekdtree)\n\n    # make sure coordinate systems match\n    if isinstance(matchcoord, SkyCoord):\n        matchcoord = matchcoord.transform_to(catalogcoord, merge_attributes=False)\n    else:\n        matchcoord = matchcoord.transform_to(catalogcoord)\n\n    # make sure units match\n    catunit = catalogcoord.cartesian.x.unit\n    matchxyz = matchcoord.cartesian.xyz.to(catunit)\n\n    matchflatxyz = matchxyz.reshape((3, np.prod(matchxyz.shape) // 3))\n    # Querying NaN returns garbage\n    if np.isnan(matchflatxyz.value).any():\n        raise ValueError(\"Matching coordinates cannot contain NaN entries.\")\n    dist, idx = kdt.query(matchflatxyz.T, nthneighbor)\n\n    if nthneighbor > 1:  # query gives 1D arrays if k=1, 2D arrays otherwise\n        dist = dist[:, -1]\n        idx = idx[:, -1]\n\n    sep2d = catalogcoord[idx].separation(matchcoord)\n    return idx.reshape(matchxyz.shape[1:]), sep2d, dist.reshape(matchxyz.shape[1:]) * catunit\n\n\ndef match_coordinates_sky(matchcoord, catalogcoord, nthneighbor=1, storekdtree='kdtree_sky'):\n    \"\"\"\n    Finds the nearest on-sky matches of a coordinate or coordinates in\n    a set of catalog coordinates.\n\n    This finds the on-sky closest neighbor, which is only different from the\n    3-dimensional match if ``distance`` is set in either ``matchcoord``\n    or ``catalogcoord``.\n\n    Parameters\n    ----------\n    matchcoord : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The coordinate(s) to match to the catalog.\n    catalogcoord : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The base catalog in which to search for matches. Typically this will\n        be a coordinate object that is an array (i.e.,\n        ``catalogcoord.isscalar == False``)\n    nthneighbor : int, optional\n        Which closest neighbor to search for.  Typically ``1`` is desired here,\n        as that is correct for matching one set of coordinates to another.\n        The next likely use case is ``2``, for matching a coordinate catalog\n        against *itself* (``1`` is inappropriate because each point will find\n        itself as the closest match).\n    storekdtree : bool or str, optional\n        If a string, will store the KD-Tree used for the computation\n        in the ``catalogcoord`` in ``catalogcoord.cache`` with the\n        provided name.  This dramatically speeds up subsequent calls with the\n        same catalog. If False, the KD-Tree is discarded after use.\n\n    Returns\n    -------\n    idx : int array\n        Indices into ``catalogcoord`` to get the matched points for each\n        ``matchcoord``. Shape matches ``matchcoord``.\n    sep2d : `~astropy.coordinates.Angle`\n        The on-sky separation between the closest match for each\n        ``matchcoord`` and the ``matchcoord``. Shape matches ``matchcoord``.\n    dist3d : `~astropy.units.Quantity` ['length']\n        The 3D distance between the closest match for each ``matchcoord`` and\n        the ``matchcoord``. Shape matches ``matchcoord``.  If either\n        ``matchcoord`` or ``catalogcoord`` don't have a distance, this is the 3D\n        distance on the unit sphere, rather than a true distance.\n\n    Notes\n    -----\n    This function requires `SciPy <https://www.scipy.org/>`_ to be installed\n    or it will fail.\n    \"\"\"\n    if catalogcoord.isscalar or len(catalogcoord) < 1:\n        raise ValueError('The catalog for coordinate matching cannot be a '\n                         'scalar or length-0.')\n\n    # send to catalog frame\n    if isinstance(matchcoord, SkyCoord):\n        newmatch = matchcoord.transform_to(catalogcoord, merge_attributes=False)\n    else:\n        newmatch = matchcoord.transform_to(catalogcoord)\n\n    # strip out distance info\n    match_urepr = newmatch.data.represent_as(UnitSphericalRepresentation)\n    newmatch_u = newmatch.realize_frame(match_urepr)\n\n    cat_urepr = catalogcoord.data.represent_as(UnitSphericalRepresentation)\n    newcat_u = catalogcoord.realize_frame(cat_urepr)\n\n    # Check for a stored KD-tree on the passed-in coordinate. Normally it will\n    # have a distinct name from the \"3D\" one, so it's safe to use even though\n    # it's based on UnitSphericalRepresentation.\n    storekdtree = catalogcoord.cache.get(storekdtree, storekdtree)\n\n    idx, sep2d, sep3d = match_coordinates_3d(newmatch_u, newcat_u, nthneighbor, storekdtree)\n    # sep3d is *wrong* above, because the distance information was removed,\n    # unless one of the catalogs doesn't have a real distance\n    if not (isinstance(catalogcoord.data, UnitSphericalRepresentation) or\n            isinstance(newmatch.data, UnitSphericalRepresentation)):\n        sep3d = catalogcoord[idx].separation_3d(newmatch)\n\n    # update the kdtree on the actual passed-in coordinate\n    if isinstance(storekdtree, str):\n        catalogcoord.cache[storekdtree] = newcat_u.cache[storekdtree]\n    elif storekdtree is True:\n        # the old backwards-compatible name\n        catalogcoord.cache['kdtree'] = newcat_u.cache['kdtree']\n\n    return idx, sep2d, sep3d\n\n\ndef search_around_3d(coords1, coords2, distlimit, storekdtree='kdtree_3d'):\n    \"\"\"\n    Searches for pairs of points that are at least as close as a specified\n    distance in 3D space.\n\n    This is intended for use on coordinate objects with arrays of coordinates,\n    not scalars.  For scalar coordinates, it is better to use the\n    ``separation_3d`` methods.\n\n    Parameters\n    ----------\n    coords1 : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The first set of coordinates, which will be searched for matches from\n        ``coords2`` within ``seplimit``.  Cannot be a scalar coordinate.\n    coords2 : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The second set of coordinates, which will be searched for matches from\n        ``coords1`` within ``seplimit``.  Cannot be a scalar coordinate.\n    distlimit : `~astropy.units.Quantity` ['length']\n        The physical radius to search within.\n    storekdtree : bool or str, optional\n        If a string, will store the KD-Tree used in the search with the name\n        ``storekdtree`` in ``coords2.cache``. This speeds up subsequent calls\n        to this function. If False, the KD-Trees are not saved.\n\n    Returns\n    -------\n    idx1 : int array\n        Indices into ``coords1`` that matches to the corresponding element of\n        ``idx2``. Shape matches ``idx2``.\n    idx2 : int array\n        Indices into ``coords2`` that matches to the corresponding element of\n        ``idx1``. Shape matches ``idx1``.\n    sep2d : `~astropy.coordinates.Angle`\n        The on-sky separation between the coordinates. Shape matches ``idx1``\n        and ``idx2``.\n    dist3d : `~astropy.units.Quantity` ['length']\n        The 3D distance between the coordinates. Shape matches ``idx1`` and\n        ``idx2``. The unit is that of ``coords1``.\n\n    Notes\n    -----\n    This function requires `SciPy <https://www.scipy.org/>`_\n    to be installed or it will fail.\n\n    If you are using this function to search in a catalog for matches around\n    specific points, the convention is for ``coords2`` to be the catalog, and\n    ``coords1`` are the points to search around.  While these operations are\n    mathematically the same if ``coords1`` and ``coords2`` are flipped, some of\n    the optimizations may work better if this convention is obeyed.\n\n    In the current implementation, the return values are always sorted in the\n    same order as the ``coords1`` (so ``idx1`` is in ascending order).  This is\n    considered an implementation detail, though, so it could change in a future\n    release.\n    \"\"\"\n    if not distlimit.isscalar:\n        raise ValueError('distlimit must be a scalar in search_around_3d')\n\n    if coords1.isscalar or coords2.isscalar:\n        raise ValueError('One of the inputs to search_around_3d is a scalar. '\n                         'search_around_3d is intended for use with array '\n                         'coordinates, not scalars.  Instead, use '\n                         '``coord1.separation_3d(coord2) < distlimit`` to find '\n                         'the coordinates near a scalar coordinate.')\n\n    if len(coords1) == 0 or len(coords2) == 0:\n        # Empty array input: return empty match\n        return (np.array([], dtype=int), np.array([], dtype=int),\n                Angle([], u.deg),\n                u.Quantity([], coords1.distance.unit))\n\n    kdt2 = _get_cartesian_kdtree(coords2, storekdtree)\n    cunit = coords2.cartesian.x.unit\n\n    # we convert coord1 to match coord2's frame.  We do it this way\n    # so that if the conversion does happen, the KD tree of coord2 at least gets\n    # saved. (by convention, coord2 is the \"catalog\" if that makes sense)\n    coords1 = coords1.transform_to(coords2)\n\n    kdt1 = _get_cartesian_kdtree(coords1, storekdtree, forceunit=cunit)\n\n    # this is the *cartesian* 3D distance that corresponds to the given angle\n    d = distlimit.to_value(cunit)\n\n    idxs1 = []\n    idxs2 = []\n    for i, matches in enumerate(kdt1.query_ball_tree(kdt2, d)):\n        for match in matches:\n            idxs1.append(i)\n            idxs2.append(match)\n    idxs1 = np.array(idxs1, dtype=int)\n    idxs2 = np.array(idxs2, dtype=int)\n\n    if idxs1.size == 0:\n        d2ds = Angle([], u.deg)\n        d3ds = u.Quantity([], coords1.distance.unit)\n    else:\n        d2ds = coords1[idxs1].separation(coords2[idxs2])\n        d3ds = coords1[idxs1].separation_3d(coords2[idxs2])\n\n    return idxs1, idxs2, d2ds, d3ds\n\n\ndef search_around_sky(coords1, coords2, seplimit, storekdtree='kdtree_sky'):\n    \"\"\"\n    Searches for pairs of points that have an angular separation at least as\n    close as a specified angle.\n\n    This is intended for use on coordinate objects with arrays of coordinates,\n    not scalars.  For scalar coordinates, it is better to use the ``separation``\n    methods.\n\n    Parameters\n    ----------\n    coords1 : coordinate-like\n        The first set of coordinates, which will be searched for matches from\n        ``coords2`` within ``seplimit``. Cannot be a scalar coordinate.\n    coords2 : coordinate-like\n        The second set of coordinates, which will be searched for matches from\n        ``coords1`` within ``seplimit``. Cannot be a scalar coordinate.\n    seplimit : `~astropy.units.Quantity` ['angle']\n        The on-sky separation to search within.\n    storekdtree : bool or str, optional\n        If a string, will store the KD-Tree used in the search with the name\n        ``storekdtree`` in ``coords2.cache``. This speeds up subsequent calls\n        to this function. If False, the KD-Trees are not saved.\n\n    Returns\n    -------\n    idx1 : int array\n        Indices into ``coords1`` that matches to the corresponding element of\n        ``idx2``. Shape matches ``idx2``.\n    idx2 : int array\n        Indices into ``coords2`` that matches to the corresponding element of\n        ``idx1``. Shape matches ``idx1``.\n    sep2d : `~astropy.coordinates.Angle`\n        The on-sky separation between the coordinates. Shape matches ``idx1``\n        and ``idx2``.\n    dist3d : `~astropy.units.Quantity` ['length']\n        The 3D distance between the coordinates. Shape matches ``idx1``\n        and ``idx2``; the unit is that of ``coords1``.\n        If either ``coords1`` or ``coords2`` don't have a distance,\n        this is the 3D distance on the unit sphere, rather than a\n        physical distance.\n\n    Notes\n    -----\n    This function requires `SciPy <https://www.scipy.org/>`_\n    to be installed or it will fail.\n\n    In the current implementation, the return values are always sorted in the\n    same order as the ``coords1`` (so ``idx1`` is in ascending order).  This is\n    considered an implementation detail, though, so it could change in a future\n    release.\n    \"\"\"\n    if not seplimit.isscalar:\n        raise ValueError('seplimit must be a scalar in search_around_sky')\n\n    if coords1.isscalar or coords2.isscalar:\n        raise ValueError('One of the inputs to search_around_sky is a scalar. '\n                         'search_around_sky is intended for use with array '\n                         'coordinates, not scalars.  Instead, use '\n                         '``coord1.separation(coord2) < seplimit`` to find the '\n                         'coordinates near a scalar coordinate.')\n\n    if len(coords1) == 0 or len(coords2) == 0:\n        # Empty array input: return empty match\n        if coords2.distance.unit == u.dimensionless_unscaled:\n            distunit = u.dimensionless_unscaled\n        else:\n            distunit = coords1.distance.unit\n        return (np.array([], dtype=int), np.array([], dtype=int),\n                Angle([], u.deg),\n                u.Quantity([], distunit))\n\n    # we convert coord1 to match coord2's frame.  We do it this way\n    # so that if the conversion does happen, the KD tree of coord2 at least gets\n    # saved. (by convention, coord2 is the \"catalog\" if that makes sense)\n    coords1 = coords1.transform_to(coords2)\n\n    # strip out distance info\n    urepr1 = coords1.data.represent_as(UnitSphericalRepresentation)\n    ucoords1 = coords1.realize_frame(urepr1)\n\n    kdt1 = _get_cartesian_kdtree(ucoords1, storekdtree)\n\n    if storekdtree and coords2.cache.get(storekdtree):\n        # just use the stored KD-Tree\n        kdt2 = coords2.cache[storekdtree]\n    else:\n        # strip out distance info\n        urepr2 = coords2.data.represent_as(UnitSphericalRepresentation)\n        ucoords2 = coords2.realize_frame(urepr2)\n\n        kdt2 = _get_cartesian_kdtree(ucoords2, storekdtree)\n        if storekdtree:\n            # save the KD-Tree in coords2, *not* ucoords2\n            coords2.cache['kdtree' if storekdtree is True else storekdtree] = kdt2\n\n    # this is the *cartesian* 3D distance that corresponds to the given angle\n    r = (2 * np.sin(Angle(seplimit) / 2.0)).value\n\n    idxs1 = []\n    idxs2 = []\n    for i, matches in enumerate(kdt1.query_ball_tree(kdt2, r)):\n        for match in matches:\n            idxs1.append(i)\n            idxs2.append(match)\n    idxs1 = np.array(idxs1, dtype=int)\n    idxs2 = np.array(idxs2, dtype=int)\n\n    if idxs1.size == 0:\n        if coords2.distance.unit == u.dimensionless_unscaled:\n            distunit = u.dimensionless_unscaled\n        else:\n            distunit = coords1.distance.unit\n        d2ds = Angle([], u.deg)\n        d3ds = u.Quantity([], distunit)\n    else:\n        d2ds = coords1[idxs1].separation(coords2[idxs2])\n        try:\n            d3ds = coords1[idxs1].separation_3d(coords2[idxs2])\n        except ValueError:\n            # they don't have distances, so we just fall back on the cartesian\n            # distance, computed from d2ds\n            d3ds = 2 * np.sin(d2ds / 2.0)\n\n    return idxs1, idxs2, d2ds, d3ds\n\n\ndef _get_cartesian_kdtree(coord, attrname_or_kdt='kdtree', forceunit=None):\n    \"\"\"\n    This is a utility function to retrieve (and build/cache, if necessary)\n    a 3D cartesian KD-Tree from various sorts of astropy coordinate objects.\n\n    Parameters\n    ----------\n    coord : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n        The coordinates to build the KD-Tree for.\n    attrname_or_kdt : bool or str or KDTree\n        If a string, will store the KD-Tree used for the computation in the\n        ``coord``, in ``coord.cache`` with the provided name. If given as a\n        KD-Tree, it will just be used directly.\n    forceunit : unit or None\n        If a unit, the cartesian coordinates will convert to that unit before\n        being put in the KD-Tree.  If None, whatever unit it's already in\n        will be used\n\n    Returns\n    -------\n    kdt : `~scipy.spatial.cKDTree` or `~scipy.spatial.KDTree`\n        The KD-Tree representing the 3D cartesian representation of the input\n        coordinates.\n    \"\"\"\n    from warnings import warn\n\n    # without scipy this will immediately fail\n    from scipy import spatial\n    try:\n        KDTree = spatial.cKDTree\n    except Exception:\n        warn('C-based KD tree not found, falling back on (much slower) '\n             'python implementation')\n        KDTree = spatial.KDTree\n\n    if attrname_or_kdt is True:  # backwards compatibility for pre v0.4\n        attrname_or_kdt = 'kdtree'\n\n    # figure out where any cached KDTree might be\n    if isinstance(attrname_or_kdt, str):\n        kdt = coord.cache.get(attrname_or_kdt, None)\n        if kdt is not None and not isinstance(kdt, KDTree):\n            raise TypeError(f'The `attrname_or_kdt` \"{attrname_or_kdt}\" is not a scipy KD tree!')\n    elif isinstance(attrname_or_kdt, KDTree):\n        kdt = attrname_or_kdt\n        attrname_or_kdt = None\n    elif not attrname_or_kdt:\n        kdt = None\n    else:\n        raise TypeError('Invalid `attrname_or_kdt` argument for KD-Tree:' +\n                        str(attrname_or_kdt))\n\n    if kdt is None:\n        # need to build the cartesian KD-tree for the catalog\n        if forceunit is None:\n            cartxyz = coord.cartesian.xyz\n        else:\n            cartxyz = coord.cartesian.xyz.to(forceunit)\n        flatxyz = cartxyz.reshape((3, np.prod(cartxyz.shape) // 3))\n        # There should be no NaNs in the kdtree data.\n        if np.isnan(flatxyz.value).any():\n            raise ValueError(\"Catalog coordinates cannot contain NaN entries.\")\n        try:\n            # Set compact_nodes=False, balanced_tree=False to use\n            # \"sliding midpoint\" rule, which is much faster than standard for\n            # many common use cases\n            kdt = KDTree(flatxyz.value.T, compact_nodes=False, balanced_tree=False)\n        except TypeError:\n            # Python implementation does not take compact_nodes and balanced_tree\n            # as arguments.  However, it uses sliding midpoint rule by default\n            kdt = KDTree(flatxyz.value.T)\n\n    if attrname_or_kdt:\n        # cache the kdtree in `coord`\n        coord.cache[attrname_or_kdt] = kdt\n\n    return kdt\n"},{"col":4,"comment":"null","endLoc":1828,"header":"def __mul__(self, other)","id":15313,"name":"__mul__","nodeType":"Function","startLoc":1824,"text":"def __mul__(self, other):\n        if isinstance(other, BaseRepresentation):\n            return self.distance * other\n        else:\n            return super().__mul__(other)"},{"col":0,"comment":"\n    Convert an angle in Hours to Radians.\n    ","endLoc":503,"header":"def hours_to_radians(h)","id":15314,"name":"hours_to_radians","nodeType":"Function","startLoc":498,"text":"def hours_to_radians(h):\n    \"\"\"\n    Convert an angle in Hours to Radians.\n    \"\"\"\n\n    return u.hourangle.to(u.radian, h)"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":15315,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"matching.py#<anonymous>","id":15316,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module contains functions for matching coordinate catalogs.\n\"\"\"\n\n__all__ = ['match_coordinates_3d', 'match_coordinates_sky', 'search_around_3d',\n           'search_around_sky']"},{"col":0,"comment":"\n    Convert an angle in Radians to Degrees.\n    ","endLoc":525,"header":"def radians_to_degrees(r)","id":15317,"name":"radians_to_degrees","nodeType":"Function","startLoc":521,"text":"def radians_to_degrees(r):\n    \"\"\"\n    Convert an angle in Radians to Degrees.\n    \"\"\"\n    return u.radian.to(u.degree, r)"},{"fileName":"spectral_coordinate.py","filePath":"astropy/coordinates","id":15318,"nodeType":"File","text":"import warnings\nfrom textwrap import indent\n\nimport astropy.units as u\nimport numpy as np\nfrom astropy.constants import c\nfrom astropy.coordinates import (ICRS,\n                                 CartesianDifferential,\n                                 CartesianRepresentation, SkyCoord)\nfrom astropy.coordinates.spectral_quantity import SpectralQuantity\nfrom astropy.coordinates.baseframe import (BaseCoordinateFrame,\n                                           frame_transform_graph)\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n__all__ = ['SpectralCoord']\n\n\nclass NoVelocityWarning(AstropyUserWarning):\n    pass\n\n\nclass NoDistanceWarning(AstropyUserWarning):\n    pass\n\n\nKMS = u.km / u.s\nZERO_VELOCITIES = CartesianDifferential([0, 0, 0] * KMS)\n\n# Default distance to use for target when none is provided\nDEFAULT_DISTANCE = 1e6 * u.kpc\n\n# We don't want to run doctests in the docstrings we inherit from Quantity\n__doctest_skip__ = ['SpectralCoord.*']\n\n\ndef _apply_relativistic_doppler_shift(scoord, velocity):\n    \"\"\"\n    Given a `SpectralQuantity` and a velocity, return a new `SpectralQuantity`\n    that is Doppler shifted by this amount.\n\n    Note that the Doppler shift applied is the full relativistic one, so\n    `SpectralQuantity` currently expressed in velocity and not using the\n    relativistic convention will temporarily be converted to use the\n    relativistic convention while the shift is applied.\n\n    Positive velocities are assumed to redshift the spectral quantity,\n    while negative velocities blueshift the spectral quantity.\n    \"\"\"\n\n    # NOTE: we deliberately don't keep sub-classes of SpectralQuantity intact\n    # since we can't guarantee that their metadata would be correct/consistent.\n    squantity = scoord.view(SpectralQuantity)\n\n    beta = velocity / c\n    doppler_factor = np.sqrt((1 + beta) / (1 - beta))\n\n    if squantity.unit.is_equivalent(u.m):  # wavelength\n        return squantity * doppler_factor\n    elif (squantity.unit.is_equivalent(u.Hz) or\n          squantity.unit.is_equivalent(u.eV) or\n          squantity.unit.is_equivalent(1 / u.m)):\n        return squantity / doppler_factor\n    elif squantity.unit.is_equivalent(KMS):  # velocity\n        return (squantity.to(u.Hz) / doppler_factor).to(squantity.unit)\n    else:  # pragma: no cover\n        raise RuntimeError(f\"Unexpected units in velocity shift: {squantity.unit}. \"\n                           \"This should not happen, so please report this in the \"\n                           \"astropy issue tracker!\")\n\n\ndef update_differentials_to_match(original, velocity_reference, preserve_observer_frame=False):\n    \"\"\"\n    Given an original coordinate object, update the differentials so that\n    the final coordinate is at the same location as the original coordinate\n    but co-moving with the velocity reference object.\n\n    If preserve_original_frame is set to True, the resulting object will be in\n    the frame of the original coordinate, otherwise it will be in the frame of\n    the velocity reference.\n    \"\"\"\n\n    if not velocity_reference.data.differentials:\n        raise ValueError(\"Reference frame has no velocities\")\n\n    # If the reference has an obstime already defined, we should ignore\n    # it and stick with the original observer obstime.\n    if 'obstime' in velocity_reference.frame_attributes and hasattr(original, 'obstime'):\n        velocity_reference = velocity_reference.replicate(obstime=original.obstime)\n\n    # We transform both coordinates to ICRS for simplicity and because we know\n    # it's a simple frame that is not time-dependent (it could be that both\n    # the original and velocity_reference frame are time-dependent)\n\n    original_icrs = original.transform_to(ICRS())\n    velocity_reference_icrs = velocity_reference.transform_to(ICRS())\n\n    differentials = velocity_reference_icrs.data.represent_as(CartesianRepresentation,\n                                                              CartesianDifferential).differentials\n\n    data_with_differentials = (original_icrs.data.represent_as(CartesianRepresentation)\n                               .with_differentials(differentials))\n\n    final_icrs = original_icrs.realize_frame(data_with_differentials)\n\n    if preserve_observer_frame:\n        final = final_icrs.transform_to(original)\n    else:\n        final = final_icrs.transform_to(velocity_reference)\n\n    return final.replicate(representation_type=CartesianRepresentation,\n                           differential_type=CartesianDifferential)\n\n\ndef attach_zero_velocities(coord):\n    \"\"\"\n    Set the differentials to be stationary on a coordinate object.\n    \"\"\"\n    new_data = coord.cartesian.with_differentials(ZERO_VELOCITIES)\n    return coord.realize_frame(new_data)\n\n\ndef _get_velocities(coord):\n    if 's' in coord.data.differentials:\n        return coord.velocity\n    else:\n        return ZERO_VELOCITIES\n\n\nclass SpectralCoord(SpectralQuantity):\n    \"\"\"\n    A spectral coordinate with its corresponding unit.\n\n    .. note:: The |SpectralCoord| class is new in Astropy v4.1 and should be\n              considered experimental at this time. Note that we do not fully\n              support cases where the observer and target are moving\n              relativistically relative to each other, so care should be taken\n              in those cases. It is possible that there will be API changes in\n              future versions of Astropy based on user feedback. If you have\n              specific ideas for how it might be improved, please  let us know\n              on the `astropy-dev mailing list`_ or at\n              http://feedback.astropy.org.\n\n    Parameters\n    ----------\n    value : ndarray or `~astropy.units.Quantity` or `SpectralCoord`\n        Spectral values, which should be either wavelength, frequency,\n        energy, wavenumber, or velocity values.\n    unit : unit-like\n        Unit for the given spectral values.\n    observer : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`, optional\n        The coordinate (position and velocity) of observer. If no velocities\n        are present on this object, the observer is assumed to be stationary\n        relative to the frame origin.\n    target : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`, optional\n        The coordinate (position and velocity) of target. If no velocities\n        are present on this object, the target is assumed to be stationary\n        relative to the frame origin.\n    radial_velocity : `~astropy.units.Quantity` ['speed'], optional\n        The radial velocity of the target with respect to the observer. This\n        can only be specified if ``redshift`` is not specified.\n    redshift : float, optional\n        The relativistic redshift of the target with respect to the observer.\n        This can only be specified if ``radial_velocity`` cannot be specified.\n    doppler_rest : `~astropy.units.Quantity`, optional\n        The rest value to use when expressing the spectral value as a velocity.\n    doppler_convention : str, optional\n        The Doppler convention to use when expressing the spectral value as a velocity.\n    \"\"\"\n\n    @u.quantity_input(radial_velocity=u.km/u.s)\n    def __new__(cls, value, unit=None,\n                observer=None, target=None,\n                radial_velocity=None, redshift=None,\n                **kwargs):\n\n        obj = super().__new__(cls, value, unit=unit, **kwargs)\n\n        # There are two main modes of operation in this class. Either the\n        # observer and target are both defined, in which case the radial\n        # velocity and redshift are automatically computed from these, or\n        # only one of the observer and target are specified, along with a\n        # manually specified radial velocity or redshift. So if a target and\n        # observer are both specified, we can't also accept a radial velocity\n        # or redshift.\n        if target is not None and observer is not None:\n            if radial_velocity is not None or redshift is not None:\n                raise ValueError(\"Cannot specify radial velocity or redshift if both \"\n                                 \"target and observer are specified\")\n\n        # We only deal with redshifts here and in the redshift property.\n        # Otherwise internally we always deal with velocities.\n        if redshift is not None:\n            if radial_velocity is not None:\n                raise ValueError(\"Cannot set both a radial velocity and redshift\")\n            redshift = u.Quantity(redshift)\n            # For now, we can't specify redshift=u.one in quantity_input above\n            # and have it work with plain floats, but if that is fixed, for\n            # example as in https://github.com/astropy/astropy/pull/10232, we\n            # can remove the check here and add redshift=u.one to the decorator\n            if not redshift.unit.is_equivalent(u.one):\n                raise u.UnitsError('redshift should be dimensionless')\n            radial_velocity = redshift.to(u.km / u.s, u.doppler_redshift())\n\n        # If we're initializing from an existing SpectralCoord, keep any\n        # parameters that aren't being overridden\n        if observer is None:\n            observer = getattr(value, 'observer', None)\n        if target is None:\n            target = getattr(value, 'target', None)\n\n        # As mentioned above, we should only specify the radial velocity\n        # manually if either or both the observer and target are not\n        # specified.\n        if observer is None or target is None:\n            if radial_velocity is None:\n                radial_velocity = getattr(value, 'radial_velocity', None)\n\n        obj._radial_velocity = radial_velocity\n        obj._observer = cls._validate_coordinate(observer, label='observer')\n        obj._target = cls._validate_coordinate(target, label='target')\n\n        return obj\n\n    def __array_finalize__(self, obj):\n        super().__array_finalize__(obj)\n        self._radial_velocity = getattr(obj, '_radial_velocity', None)\n        self._observer = getattr(obj, '_observer', None)\n        self._target = getattr(obj, '_target', None)\n\n    @staticmethod\n    def _validate_coordinate(coord, label=''):\n        \"\"\"\n        Checks the type of the frame and whether a velocity differential and a\n        distance has been defined on the frame object.\n\n        If no distance is defined, the target is assumed to be \"really far\n        away\", and the observer is assumed to be \"in the solar system\".\n\n        Parameters\n        ----------\n        coord : `~astropy.coordinates.BaseCoordinateFrame`\n            The new frame to be used for target or observer.\n        label : str, optional\n            The name of the object being validated (e.g. 'target' or 'observer'),\n            which is then used in error messages.\n        \"\"\"\n\n        if coord is None:\n            return\n\n        if not issubclass(coord.__class__, BaseCoordinateFrame):\n            if isinstance(coord, SkyCoord):\n                coord = coord.frame\n            else:\n                raise TypeError(f\"{label} must be a SkyCoord or coordinate frame instance\")\n\n        # If the distance is not well-defined, ensure that it works properly\n        # for generating differentials\n        # TODO: change this to not set the distance and yield a warning once\n        # there's a good way to address this in astropy.coordinates\n        # https://github.com/astropy/astropy/issues/10247\n        with np.errstate(all='ignore'):\n            distance = getattr(coord, 'distance', None)\n        if distance is not None and distance.unit.physical_type == 'dimensionless':\n            coord = SkyCoord(coord, distance=DEFAULT_DISTANCE)\n            warnings.warn(\n                \"Distance on coordinate object is dimensionless, an \"\n                f\"arbitrary distance value of {DEFAULT_DISTANCE} will be set instead.\",\n                NoDistanceWarning)\n\n        # If the observer frame does not contain information about the\n        # velocity of the system, assume that the velocity is zero in the\n        # system.\n        if 's' not in coord.data.differentials:\n            warnings.warn(\n                f\"No velocity defined on frame, assuming {ZERO_VELOCITIES}.\",\n                NoVelocityWarning)\n\n            coord = attach_zero_velocities(coord)\n\n        return coord\n\n    def replicate(self, value=None, unit=None,\n                  observer=None, target=None,\n                  radial_velocity=None, redshift=None,\n                  doppler_convention=None, doppler_rest=None,\n                  copy=False):\n        \"\"\"\n        Return a replica of the `SpectralCoord`, optionally changing the\n        values or attributes.\n\n        Note that no conversion is carried out by this method - this keeps\n        all the values and attributes the same, except for the ones explicitly\n        passed to this method which are changed.\n\n        If ``copy`` is set to `True` then a full copy of the internal arrays\n        will be made.  By default the replica will use a reference to the\n        original arrays when possible to save memory.\n\n        Parameters\n        ----------\n        value : ndarray or `~astropy.units.Quantity` or `SpectralCoord`, optional\n            Spectral values, which should be either wavelength, frequency,\n            energy, wavenumber, or velocity values.\n        unit : unit-like\n            Unit for the given spectral values.\n        observer : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`, optional\n            The coordinate (position and velocity) of observer.\n        target : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`, optional\n            The coordinate (position and velocity) of target.\n        radial_velocity : `~astropy.units.Quantity` ['speed'], optional\n            The radial velocity of the target with respect to the observer.\n        redshift : float, optional\n            The relativistic redshift of the target with respect to the observer.\n        doppler_rest : `~astropy.units.Quantity`, optional\n            The rest value to use when expressing the spectral value as a velocity.\n        doppler_convention : str, optional\n            The Doppler convention to use when expressing the spectral value as a velocity.\n        copy : bool, optional\n            If `True`, and ``value`` is not specified, the values are copied to\n            the new `SkyCoord` - otherwise a reference to the same values is used.\n\n        Returns\n        -------\n        sc : `SpectralCoord` object\n            Replica of this object\n        \"\"\"\n\n        if isinstance(value, u.Quantity):\n            if unit is not None:\n                raise ValueError(\"Cannot specify value as a Quantity and also specify unit\")\n            else:\n                value, unit = value.value, value.unit\n\n        value = value if value is not None else self.value\n        unit = unit or self.unit\n        observer = self._validate_coordinate(observer) or self.observer\n        target = self._validate_coordinate(target) or self.target\n        doppler_convention = doppler_convention or self.doppler_convention\n        doppler_rest = doppler_rest or self.doppler_rest\n\n        # If value is being taken from self and copy is Tru\n        if copy:\n            value = value.copy()\n\n        # Only include radial_velocity if it is not auto-computed from the\n        # observer and target.\n        if (self.observer is None or self.target is None) and radial_velocity is None and redshift is None:\n            radial_velocity = self.radial_velocity\n\n        with warnings.catch_warnings():\n            warnings.simplefilter('ignore', NoVelocityWarning)\n            return self.__class__(value=value, unit=unit,\n                                  observer=observer, target=target,\n                                  radial_velocity=radial_velocity, redshift=redshift,\n                                  doppler_convention=doppler_convention, doppler_rest=doppler_rest, copy=False)\n\n    @property\n    def quantity(self):\n        \"\"\"\n        Convert the ``SpectralCoord`` to a `~astropy.units.Quantity`.\n        Equivalent to ``self.view(u.Quantity)``.\n\n        Returns\n        -------\n        `~astropy.units.Quantity`\n            This object viewed as a `~astropy.units.Quantity`.\n\n        \"\"\"\n        return self.view(u.Quantity)\n\n    @property\n    def observer(self):\n        \"\"\"\n        The coordinates of the observer.\n\n        If set, and a target is set as well, this will override any explicit\n        radial velocity passed in.\n\n        Returns\n        -------\n        `~astropy.coordinates.BaseCoordinateFrame`\n            The astropy coordinate frame representing the observation.\n        \"\"\"\n        return self._observer\n\n    @observer.setter\n    def observer(self, value):\n\n        if self.observer is not None:\n            raise ValueError(\"observer has already been set\")\n\n        self._observer = self._validate_coordinate(value, label='observer')\n\n        # Switch to auto-computing radial velocity\n        if self._target is not None:\n            self._radial_velocity = None\n\n    @property\n    def target(self):\n        \"\"\"\n        The coordinates of the target being observed.\n\n        If set, and an observer is set as well, this will override any explicit\n        radial velocity passed in.\n\n        Returns\n        -------\n        `~astropy.coordinates.BaseCoordinateFrame`\n            The astropy coordinate frame representing the target.\n        \"\"\"\n        return self._target\n\n    @target.setter\n    def target(self, value):\n\n        if self.target is not None:\n            raise ValueError(\"target has already been set\")\n\n        self._target = self._validate_coordinate(value, label='target')\n\n        # Switch to auto-computing radial velocity\n        if self._observer is not None:\n            self._radial_velocity = None\n\n    @property\n    def radial_velocity(self):\n        \"\"\"\n        Radial velocity of target relative to the observer.\n\n        Returns\n        -------\n        `~astropy.units.Quantity` ['speed']\n            Radial velocity of target.\n\n        Notes\n        -----\n        This is different from the ``.radial_velocity`` property of a\n        coordinate frame in that this calculates the radial velocity with\n        respect to the *observer*, not the origin of the frame.\n        \"\"\"\n        if self._observer is None or self._target is None:\n            if self._radial_velocity is None:\n                return 0 * KMS\n            else:\n                return self._radial_velocity\n        else:\n            return self._calculate_radial_velocity(self._observer, self._target,\n                                                   as_scalar=True)\n\n    @property\n    def redshift(self):\n        \"\"\"\n        Redshift of target relative to observer. Calculated from the radial\n        velocity.\n\n        Returns\n        -------\n        `astropy.units.Quantity`\n            Redshift of target.\n        \"\"\"\n        return self.radial_velocity.to(u.dimensionless_unscaled, u.doppler_redshift())\n\n    @staticmethod\n    def _calculate_radial_velocity(observer, target, as_scalar=False):\n        \"\"\"\n        Compute the line-of-sight velocity from the observer to the target.\n\n        Parameters\n        ----------\n        observer : `~astropy.coordinates.BaseCoordinateFrame`\n            The frame of the observer.\n        target : `~astropy.coordinates.BaseCoordinateFrame`\n            The frame of the target.\n        as_scalar : bool\n            If `True`, the magnitude of the velocity vector will be returned,\n            otherwise the full vector will be returned.\n\n        Returns\n        -------\n        `~astropy.units.Quantity` ['speed']\n            The radial velocity of the target with respect to the observer.\n        \"\"\"\n\n        # Convert observer and target to ICRS to avoid finite differencing\n        # calculations that lack numerical precision.\n        observer_icrs = observer.transform_to(ICRS())\n        target_icrs = target.transform_to(ICRS())\n\n        pos_hat = SpectralCoord._normalized_position_vector(observer_icrs, target_icrs)\n\n        d_vel = target_icrs.velocity - observer_icrs.velocity\n\n        vel_mag = pos_hat.dot(d_vel)\n\n        if as_scalar:\n            return vel_mag\n        else:\n            return vel_mag * pos_hat\n\n    @staticmethod\n    def _normalized_position_vector(observer, target):\n        \"\"\"\n        Calculate the normalized position vector between two frames.\n\n        Parameters\n        ----------\n        observer : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n            The observation frame or coordinate.\n        target : `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n            The target frame or coordinate.\n\n        Returns\n        -------\n        pos_hat : `BaseRepresentation`\n            Position representation.\n        \"\"\"\n        d_pos = (target.cartesian.without_differentials() -\n                 observer.cartesian.without_differentials())\n\n        dp_norm = d_pos.norm()\n\n        # Reset any that are 0 to 1 to avoid nans from 0/0\n        dp_norm[dp_norm == 0] = 1 * dp_norm.unit\n\n        pos_hat = d_pos / dp_norm\n\n        return pos_hat\n\n    @u.quantity_input(velocity=u.km/u.s)\n    def with_observer_stationary_relative_to(self, frame, velocity=None, preserve_observer_frame=False):\n        \"\"\"\n        A new  `SpectralCoord` with the velocity of the observer altered,\n        but not the position.\n\n        If a coordinate frame is specified, the observer velocities will be\n        modified to be stationary in the specified frame. If a coordinate\n        instance is specified, optionally with non-zero velocities, the\n        observer velocities will be updated so that the observer is co-moving\n        with the specified coordinates.\n\n        Parameters\n        ----------\n        frame : str, `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n            The observation frame in which the observer will be stationary. This\n            can be the name of a frame (e.g. 'icrs'), a frame class, frame instance\n            with no data, or instance with data. This can optionally include\n            velocities.\n        velocity : `~astropy.units.Quantity` or `~astropy.coordinates.CartesianDifferential`, optional\n            If ``frame`` does not contain velocities, these can be specified as\n            a 3-element `~astropy.units.Quantity`. In the case where this is\n            also not specified, the velocities default to zero.\n        preserve_observer_frame : bool\n            If `True`, the final observer frame class will be the same as the\n            original one, and if `False` it will be the frame of the velocity\n            reference class.\n\n        Returns\n        -------\n        new_coord : `SpectralCoord`\n            The new coordinate object representing the spectral data\n            transformed based on the observer's new velocity frame.\n        \"\"\"\n\n        if self.observer is None or self.target is None:\n            raise ValueError(\"This method can only be used if both observer \"\n                             \"and target are defined on the SpectralCoord.\")\n\n        # Start off by extracting frame if a SkyCoord was passed in\n        if isinstance(frame, SkyCoord):\n            frame = frame.frame\n\n        if isinstance(frame, BaseCoordinateFrame):\n\n            if not frame.has_data:\n                frame = frame.realize_frame(CartesianRepresentation(0 * u.km, 0 * u.km, 0 * u.km))\n\n            if frame.data.differentials:\n                if velocity is not None:\n                    raise ValueError('frame already has differentials, cannot also specify velocity')\n                # otherwise frame is ready to go\n            else:\n                if velocity is None:\n                    differentials = ZERO_VELOCITIES\n                else:\n                    differentials = CartesianDifferential(velocity)\n                frame = frame.realize_frame(frame.data.with_differentials(differentials))\n\n        if isinstance(frame, (type, str)):\n            if isinstance(frame, type):\n                frame_cls = frame\n            elif isinstance(frame, str):\n                frame_cls = frame_transform_graph.lookup_name(frame)\n            if velocity is None:\n                velocity = 0 * u.m / u.s, 0 * u.m / u.s, 0 * u.m / u.s\n            elif velocity.shape != (3,):\n                raise ValueError('velocity should be a Quantity vector with 3 elements')\n            frame = frame_cls(0 * u.m, 0 * u.m, 0 * u.m,\n                              *velocity,\n                              representation_type='cartesian',\n                              differential_type='cartesian')\n\n        observer = update_differentials_to_match(self.observer, frame,\n                                                 preserve_observer_frame=preserve_observer_frame)\n\n        # Calculate the initial and final los velocity\n        init_obs_vel = self._calculate_radial_velocity(self.observer, self.target, as_scalar=True)\n        fin_obs_vel = self._calculate_radial_velocity(observer, self.target, as_scalar=True)\n\n        # Apply transformation to data\n        new_data = _apply_relativistic_doppler_shift(self, fin_obs_vel - init_obs_vel)\n\n        new_coord = self.replicate(value=new_data, observer=observer)\n\n        return new_coord\n\n    def with_radial_velocity_shift(self, target_shift=None, observer_shift=None):\n        \"\"\"\n        Apply a velocity shift to this spectral coordinate.\n\n        The shift can be provided as a redshift (float value) or radial\n        velocity (`~astropy.units.Quantity` with physical type of 'speed').\n\n        Parameters\n        ----------\n        target_shift : float or `~astropy.units.Quantity` ['speed']\n            Shift value to apply to current target.\n        observer_shift : float or `~astropy.units.Quantity` ['speed']\n            Shift value to apply to current observer.\n\n        Returns\n        -------\n        `SpectralCoord`\n            New spectral coordinate with the target/observer velocity changed\n            to incorporate the shift. This is always a new object even if\n            ``target_shift`` and ``observer_shift`` are both `None`.\n        \"\"\"\n\n        if observer_shift is not None and (self.target is None or\n                                           self.observer is None):\n            raise ValueError(\"Both an observer and target must be defined \"\n                             \"before applying a velocity shift.\")\n\n        for arg in [x for x in [target_shift, observer_shift] if x is not None]:\n            if isinstance(arg, u.Quantity) and not arg.unit.is_equivalent((u.one, KMS)):\n                raise u.UnitsError(\"Argument must have unit physical type \"\n                                   \"'speed' for radial velocty or \"\n                                   \"'dimensionless' for redshift.\")\n\n        # The target or observer value is defined but is not a quantity object,\n        #  assume it's a redshift float value and convert to velocity\n\n        if target_shift is None:\n            if self._observer is None or self._target is None:\n                return self.replicate()\n            target_shift = 0 * KMS\n        else:\n            target_shift = u.Quantity(target_shift)\n            if target_shift.unit.physical_type == 'dimensionless':\n                target_shift = target_shift.to(u.km / u.s, u.doppler_redshift())\n            if self._observer is None or self._target is None:\n                return self.replicate(value=_apply_relativistic_doppler_shift(self, target_shift),\n                                      radial_velocity=self.radial_velocity + target_shift)\n\n        if observer_shift is None:\n            observer_shift = 0 * KMS\n        else:\n            observer_shift = u.Quantity(observer_shift)\n            if observer_shift.unit.physical_type == 'dimensionless':\n                observer_shift = observer_shift.to(u.km / u.s, u.doppler_redshift())\n\n        target_icrs = self._target.transform_to(ICRS())\n        observer_icrs = self._observer.transform_to(ICRS())\n\n        pos_hat = SpectralCoord._normalized_position_vector(observer_icrs, target_icrs)\n\n        target_velocity = _get_velocities(target_icrs) + target_shift * pos_hat\n        observer_velocity = _get_velocities(observer_icrs) + observer_shift * pos_hat\n\n        target_velocity = CartesianDifferential(target_velocity.xyz)\n        observer_velocity = CartesianDifferential(observer_velocity.xyz)\n\n        new_target = (target_icrs\n                      .realize_frame(target_icrs.cartesian.with_differentials(target_velocity))\n                      .transform_to(self._target))\n\n        new_observer = (observer_icrs\n                        .realize_frame(observer_icrs.cartesian.with_differentials(observer_velocity))\n                        .transform_to(self._observer))\n\n        init_obs_vel = self._calculate_radial_velocity(observer_icrs, target_icrs, as_scalar=True)\n        fin_obs_vel = self._calculate_radial_velocity(new_observer, new_target, as_scalar=True)\n\n        new_data = _apply_relativistic_doppler_shift(self, fin_obs_vel - init_obs_vel)\n\n        return self.replicate(value=new_data,\n                              observer=new_observer,\n                              target=new_target)\n\n    def to_rest(self):\n        \"\"\"\n        Transforms the spectral axis to the rest frame.\n        \"\"\"\n\n        if self.observer is not None and self.target is not None:\n            return self.with_observer_stationary_relative_to(self.target)\n\n        result = _apply_relativistic_doppler_shift(self, -self.radial_velocity)\n\n        return self.replicate(value=result, radial_velocity=0. * KMS, redshift=None)\n\n    def __repr__(self):\n\n        prefixstr = '<' + self.__class__.__name__ + ' '\n\n        try:\n            radial_velocity = self.radial_velocity\n            redshift = self.redshift\n        except ValueError:\n            radial_velocity = redshift = 'Undefined'\n\n        repr_items = [f'{prefixstr}']\n\n        if self.observer is not None:\n            observer_repr = indent(repr(self.observer), 14 * ' ').lstrip()\n            repr_items.append(f'    observer: {observer_repr}')\n\n        if self.target is not None:\n            target_repr = indent(repr(self.target), 12 * ' ').lstrip()\n            repr_items.append(f'    target: {target_repr}')\n\n        if (self._observer is not None and self._target is not None) or self._radial_velocity is not None:\n            if self.observer is not None and self.target is not None:\n                repr_items.append('    observer to target (computed from above):')\n            else:\n                repr_items.append('    observer to target:')\n            repr_items.append(f'      radial_velocity={radial_velocity}')\n            repr_items.append(f'      redshift={redshift}')\n\n        if self.doppler_rest is not None or self.doppler_convention is not None:\n            repr_items.append(f'    doppler_rest={self.doppler_rest}')\n            repr_items.append(f'    doppler_convention={self.doppler_convention}')\n\n        arrstr = np.array2string(self.view(np.ndarray), separator=', ',\n                                 prefix='  ')\n\n        if len(repr_items) == 1:\n            repr_items[0] += f'{arrstr}{self._unitstr:s}'\n        else:\n            repr_items[1] = '   (' + repr_items[1].lstrip()\n            repr_items[-1] += ')'\n            repr_items.append(f'  {arrstr}{self._unitstr:s}')\n\n        return '\\n'.join(repr_items) + '>'\n"},{"col":0,"comment":"\n    Convert an angle in Radians to Hours.\n    ","endLoc":532,"header":"def radians_to_hours(r)","id":15319,"name":"radians_to_hours","nodeType":"Function","startLoc":528,"text":"def radians_to_hours(r):\n    \"\"\"\n    Convert an angle in Radians to Hours.\n    \"\"\"\n    return u.radian.to(u.hourangle, r)"},{"className":"NoVelocityWarning","col":0,"comment":"null","endLoc":19,"id":15320,"nodeType":"Class","startLoc":18,"text":"class NoVelocityWarning(AstropyUserWarning):\n    pass"},{"className":"NoDistanceWarning","col":0,"comment":"null","endLoc":23,"id":15321,"nodeType":"Class","startLoc":22,"text":"class NoDistanceWarning(AstropyUserWarning):\n    pass"},{"col":0,"comment":"\n    Convert an angle in Radians to an ``(hour, minute, second)`` tuple.\n    ","endLoc":541,"header":"def radians_to_hms(r)","id":15322,"name":"radians_to_hms","nodeType":"Function","startLoc":535,"text":"def radians_to_hms(r):\n    \"\"\"\n    Convert an angle in Radians to an ``(hour, minute, second)`` tuple.\n    \"\"\"\n\n    hours = radians_to_hours(r)\n    return hours_to_hms(hours)"},{"col":0,"comment":"\n    Convert an angle in Radians to an ``(degree, arcminute,\n    arcsecond)`` tuple.\n    ","endLoc":551,"header":"def radians_to_dms(r)","id":15323,"name":"radians_to_dms","nodeType":"Function","startLoc":544,"text":"def radians_to_dms(r):\n    \"\"\"\n    Convert an angle in Radians to an ``(degree, arcminute,\n    arcsecond)`` tuple.\n    \"\"\"\n\n    degrees = u.radian.to(u.degree, r)\n    return degrees_to_dms(degrees)"},{"attributeType":"null","col":4,"comment":"null","endLoc":40,"id":15324,"name":"attrs_from_parent","nodeType":"Attribute","startLoc":40,"text":"attrs_from_parent"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":15325,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":15326,"name":"KMS","nodeType":"Attribute","startLoc":26,"text":"KMS"},{"attributeType":"null","col":4,"comment":"null","endLoc":41,"id":15327,"name":"_supports_indexing","nodeType":"Attribute","startLoc":41,"text":"_supports_indexing"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":15328,"name":"__all__","nodeType":"Attribute","startLoc":31,"text":"__all__"},{"col":0,"comment":"","endLoc":1,"header":"sky_coordinate.py#<anonymous>","id":15329,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"__all__ = ['SkyCoord', 'SkyCoordInfo']"},{"col":4,"comment":"Vector norm.\n\n        Just the distance itself.\n\n        Returns\n        -------\n        norm : `~astropy.units.Quantity` ['dimensionless']\n            Dimensionless ones, with the same shape as the representation.\n        ","endLoc":1840,"header":"def norm(self)","id":15330,"name":"norm","nodeType":"Function","startLoc":1830,"text":"def norm(self):\n        \"\"\"Vector norm.\n\n        Just the distance itself.\n\n        Returns\n        -------\n        norm : `~astropy.units.Quantity` ['dimensionless']\n            Dimensionless ones, with the same shape as the representation.\n        \"\"\"\n        return self.distance"},{"col":4,"comment":"null","endLoc":1843,"header":"def _combine_operation(self, op, other, reverse=False)","id":15331,"name":"_combine_operation","nodeType":"Function","startLoc":1842,"text":"def _combine_operation(self, op, other, reverse=False):\n        return NotImplemented"},{"col":4,"comment":"Radial representations cannot be transformed by a Cartesian matrix.\n\n        Parameters\n        ----------\n        matrix : array-like\n            The transformation matrix in a Cartesian basis.\n            Must be a multiplication: a diagonal matrix with identical elements.\n            Must have shape (..., 3, 3), where the last 2 indices are for the\n            matrix on each other axis. Make sure that the matrix shape is\n            compatible with the shape of this representation.\n\n        Raises\n        ------\n        ValueError\n            If the matrix is not a multiplication.\n\n        ","endLoc":1869,"header":"def transform(self, matrix)","id":15332,"name":"transform","nodeType":"Function","startLoc":1845,"text":"def transform(self, matrix):\n        \"\"\"Radial representations cannot be transformed by a Cartesian matrix.\n\n        Parameters\n        ----------\n        matrix : array-like\n            The transformation matrix in a Cartesian basis.\n            Must be a multiplication: a diagonal matrix with identical elements.\n            Must have shape (..., 3, 3), where the last 2 indices are for the\n            matrix on each other axis. Make sure that the matrix shape is\n            compatible with the shape of this representation.\n\n        Raises\n        ------\n        ValueError\n            If the matrix is not a multiplication.\n\n        \"\"\"\n        scl = matrix[..., 0, 0]\n        # check that the matrix is a scaled identity matrix on the last 2 axes.\n        if np.any(matrix != scl[..., np.newaxis, np.newaxis] * np.identity(3)):\n            raise ValueError(\"Radial representations can only be \"\n                             \"transformed by a scaled identity matrix\")\n\n        return self * scl"},{"attributeType":"CartesianDifferential","col":0,"comment":"null","endLoc":27,"id":15333,"name":"ZERO_VELOCITIES","nodeType":"Attribute","startLoc":27,"text":"ZERO_VELOCITIES"},{"className":"HumanError","col":0,"comment":"null","endLoc":21,"id":15334,"nodeType":"Class","startLoc":20,"text":"class HumanError(ValueError):\n    pass"},{"fileName":"attributes.py","filePath":"astropy/coordinates","id":15335,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# Dependencies\nimport numpy as np\n\n# Project\nfrom astropy import units as u\nfrom astropy.utils import ShapedLikeNDArray\n\n__all__ = ['Attribute', 'TimeAttribute', 'QuantityAttribute',\n           'EarthLocationAttribute', 'CoordinateAttribute',\n           'CartesianRepresentationAttribute',\n           'DifferentialAttribute']\n\n\nclass Attribute:\n    \"\"\"A non-mutable data descriptor to hold a frame attribute.\n\n    This class must be used to define frame attributes (e.g. ``equinox`` or\n    ``obstime``) that are included in a frame class definition.\n\n    Examples\n    --------\n    The `~astropy.coordinates.FK4` class uses the following class attributes::\n\n      class FK4(BaseCoordinateFrame):\n          equinox = TimeAttribute(default=_EQUINOX_B1950)\n          obstime = TimeAttribute(default=None,\n                                  secondary_attribute='equinox')\n\n    This means that ``equinox`` and ``obstime`` are available to be set as\n    keyword arguments when creating an ``FK4`` class instance and are then\n    accessible as instance attributes.  The instance value for the attribute\n    must be stored in ``'_' + <attribute_name>`` by the frame ``__init__``\n    method.\n\n    Note in this example that ``equinox`` and ``obstime`` are time attributes\n    and use the ``TimeAttributeFrame`` class.  This subclass overrides the\n    ``convert_input`` method to validate and convert inputs into a ``Time``\n    object.\n\n    Parameters\n    ----------\n    default : object\n        Default value for the attribute if not provided\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    \"\"\"\n\n    name = '<unbound>'\n\n    def __init__(self, default=None, secondary_attribute=''):\n        self.default = default\n        self.secondary_attribute = secondary_attribute\n        super().__init__()\n\n    def __set_name__(self, owner, name):\n        self.name = name\n\n    def convert_input(self, value):\n        \"\"\"\n        Validate the input ``value`` and convert to expected attribute class.\n\n        The base method here does nothing, but subclasses can implement this\n        as needed.  The method should catch any internal exceptions and raise\n        ValueError with an informative message.\n\n        The method returns the validated input along with a boolean that\n        indicates whether the input value was actually converted.  If the input\n        value was already the correct type then the ``converted`` return value\n        should be ``False``.\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        output_value : object\n            The ``value`` converted to the correct type (or just ``value`` if\n            ``converted`` is False)\n        converted : bool\n            True if the conversion was actually performed, False otherwise.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n\n        \"\"\"\n        return value, False\n\n    def __get__(self, instance, frame_cls=None):\n        if instance is None:\n            out = self.default\n        else:\n            out = getattr(instance, '_' + self.name, self.default)\n            if out is None:\n                out = getattr(instance, self.secondary_attribute, self.default)\n\n        out, converted = self.convert_input(out)\n        if instance is not None:\n            instance_shape = getattr(instance, 'shape', None)  # None if instance (frame) has no data!\n            if instance_shape is not None and (getattr(out, 'shape', ()) and\n                                               out.shape != instance_shape):\n                # If the shapes do not match, try broadcasting.\n                try:\n                    if isinstance(out, ShapedLikeNDArray):\n                        out = out._apply(np.broadcast_to, shape=instance_shape,\n                                         subok=True)\n                    else:\n                        out = np.broadcast_to(out, instance_shape, subok=True)\n                except ValueError:\n                    # raise more informative exception.\n                    raise ValueError(\n                        \"attribute {} should be scalar or have shape {}, \"\n                        \"but is has shape {} and could not be broadcast.\"\n                        .format(self.name, instance_shape, out.shape))\n\n                converted = True\n\n            if converted:\n                setattr(instance, '_' + self.name, out)\n\n        return out\n\n    def __set__(self, instance, val):\n        raise AttributeError('Cannot set frame attribute')\n\n\nclass TimeAttribute(Attribute):\n    \"\"\"\n    Frame attribute descriptor for quantities that are Time objects.\n    See the `~astropy.coordinates.Attribute` API doc for further\n    information.\n\n    Parameters\n    ----------\n    default : object\n        Default value for the attribute if not provided\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    \"\"\"\n\n    def convert_input(self, value):\n        \"\"\"\n        Convert input value to a Time object and validate by running through\n        the Time constructor.  Also check that the input was a scalar.\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n\n        from astropy.time import Time\n\n        if value is None:\n            return None, False\n\n        if isinstance(value, Time):\n            out = value\n            converted = False\n        else:\n            try:\n                out = Time(value)\n            except Exception as err:\n                raise ValueError(\n                    f'Invalid time input {self.name}={value!r}.') from err\n            converted = True\n\n        # Set attribute as read-only for arrays (not allowed by numpy\n        # for array scalars)\n        if out.shape:\n            out.writeable = False\n        return out, converted\n\n\nclass CartesianRepresentationAttribute(Attribute):\n    \"\"\"\n    A frame attribute that is a CartesianRepresentation with specified units.\n\n    Parameters\n    ----------\n    default : object\n        Default value for the attribute if not provided\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    unit : unit-like or None\n        Name of a unit that the input will be converted into. If None, no\n        unit-checking or conversion is performed\n    \"\"\"\n\n    def __init__(self, default=None, secondary_attribute='', unit=None):\n        super().__init__(default, secondary_attribute)\n        self.unit = unit\n\n    def convert_input(self, value):\n        \"\"\"\n        Checks that the input is a CartesianRepresentation with the correct\n        unit, or the special value ``[0, 0, 0]``.\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out : object\n            The correctly-typed object.\n        converted : boolean\n            A boolean which indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n\n        if (isinstance(value, list) and len(value) == 3 and\n                all(v == 0 for v in value) and self.unit is not None):\n            return CartesianRepresentation(np.zeros(3) * self.unit), True\n        else:\n            # is it a CartesianRepresentation with correct unit?\n            if hasattr(value, 'xyz') and value.xyz.unit == self.unit:\n                return value, False\n\n            converted = True\n            # if it's a CartesianRepresentation, get the xyz Quantity\n            value = getattr(value, 'xyz', value)\n            if not hasattr(value, 'unit'):\n                raise TypeError('tried to set a {} with something that does '\n                                'not have a unit.'\n                                .format(self.__class__.__name__))\n\n            value = value.to(self.unit)\n\n            # now try and make a CartesianRepresentation.\n            cartrep = CartesianRepresentation(value, copy=False)\n            return cartrep, converted\n\n\nclass QuantityAttribute(Attribute):\n    \"\"\"\n    A frame attribute that is a quantity with specified units and shape\n    (optionally).\n\n    Can be `None`, which should be used for special cases in associated\n    frame transformations like \"this quantity should be ignored\" or similar.\n\n    Parameters\n    ----------\n    default : number or `~astropy.units.Quantity` or None, optional\n        Default value for the attribute if the user does not supply one. If a\n        Quantity, it must be consistent with ``unit``, or if a value, ``unit``\n        cannot be None.\n    secondary_attribute : str, optional\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    unit : unit-like or None, optional\n        Name of a unit that the input will be converted into. If None, no\n        unit-checking or conversion is performed\n    shape : tuple or None, optional\n        If given, specifies the shape the attribute must be\n    \"\"\"\n\n    def __init__(self, default=None, secondary_attribute='', unit=None,\n                 shape=None):\n\n        if default is None and unit is None:\n            raise ValueError('Either a default quantity value must be '\n                             'provided, or a unit must be provided to define a '\n                             'QuantityAttribute.')\n\n        if default is not None and unit is None:\n            unit = default.unit\n\n        self.unit = unit\n        self.shape = shape\n        default = self.convert_input(default)[0]\n        super().__init__(default, secondary_attribute)\n\n    def convert_input(self, value):\n        \"\"\"\n        Checks that the input is a Quantity with the necessary units (or the\n        special value ``0``).\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n\n        if value is None:\n            return None, False\n\n        if (not hasattr(value, 'unit') and self.unit != u.dimensionless_unscaled\n                and np.any(value != 0)):\n            raise TypeError('Tried to set a QuantityAttribute with '\n                            'something that does not have a unit.')\n\n        oldvalue = value\n        value = u.Quantity(oldvalue, self.unit, copy=False)\n        if self.shape is not None and value.shape != self.shape:\n            if value.shape == () and oldvalue == 0:\n                # Allow a single 0 to fill whatever shape is needed.\n                value = np.broadcast_to(value, self.shape, subok=True)\n            else:\n                raise ValueError(\n                    f'The provided value has shape \"{value.shape}\", but '\n                    f'should have shape \"{self.shape}\"')\n\n        converted = oldvalue is not value\n        return value, converted\n\n\nclass EarthLocationAttribute(Attribute):\n    \"\"\"\n    A frame attribute that can act as a `~astropy.coordinates.EarthLocation`.\n    It can be created as anything that can be transformed to the\n    `~astropy.coordinates.ITRS` frame, but always presents as an `EarthLocation`\n    when accessed after creation.\n\n    Parameters\n    ----------\n    default : object\n        Default value for the attribute if not provided\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    \"\"\"\n\n    def convert_input(self, value):\n        \"\"\"\n        Checks that the input is a Quantity with the necessary units (or the\n        special value ``0``).\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n\n        if value is None:\n            return None, False\n        elif isinstance(value, EarthLocation):\n            return value, False\n        else:\n            # we have to do the import here because of some tricky circular deps\n            from .builtin_frames import ITRS\n\n            if not hasattr(value, 'transform_to'):\n                raise ValueError('\"{}\" was passed into an '\n                                 'EarthLocationAttribute, but it does not have '\n                                 '\"transform_to\" method'.format(value))\n            itrsobj = value.transform_to(ITRS())\n            return itrsobj.earth_location, True\n\n\nclass CoordinateAttribute(Attribute):\n    \"\"\"\n    A frame attribute which is a coordinate object.  It can be given as a\n    `~astropy.coordinates.SkyCoord` or a low-level frame instance.  If a\n    low-level frame instance is provided, it will always be upgraded to be a\n    `~astropy.coordinates.SkyCoord` to ensure consistent transformation\n    behavior.  The coordinate object will always be returned as a low-level\n    frame instance when accessed.\n\n    Parameters\n    ----------\n    frame : `~astropy.coordinates.BaseCoordinateFrame` class\n        The type of frame this attribute can be\n    default : object\n        Default value for the attribute if not provided\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    \"\"\"\n\n    def __init__(self, frame, default=None, secondary_attribute=''):\n        self._frame = frame\n        super().__init__(default, secondary_attribute)\n\n    def convert_input(self, value):\n        \"\"\"\n        Checks that the input is a SkyCoord with the necessary units (or the\n        special value ``None``).\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n        from astropy.coordinates import SkyCoord\n\n        if value is None:\n            return None, False\n        elif isinstance(value, self._frame):\n            return value, False\n        else:\n            value = SkyCoord(value)  # always make the value a SkyCoord\n            transformedobj = value.transform_to(self._frame)\n            return transformedobj.frame, True\n\n\nclass DifferentialAttribute(Attribute):\n    \"\"\"A frame attribute which is a differential instance.\n\n    The optional ``allowed_classes`` argument allows specifying a restricted\n    set of valid differential classes to check the input against. Otherwise,\n    any `~astropy.coordinates.BaseDifferential` subclass instance is valid.\n\n    Parameters\n    ----------\n    default : object\n        Default value for the attribute if not provided\n    allowed_classes : tuple, optional\n        A list of allowed differential classes for this attribute to have.\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    \"\"\"\n\n    def __init__(self, default=None, allowed_classes=None,\n                 secondary_attribute=''):\n\n        if allowed_classes is not None:\n            self.allowed_classes = tuple(allowed_classes)\n        else:\n            self.allowed_classes = BaseDifferential\n\n        super().__init__(default, secondary_attribute)\n\n    def convert_input(self, value):\n        \"\"\"\n        Checks that the input is a differential object and is one of the\n        allowed class types.\n\n        Parameters\n        ----------\n        value : object\n            Input value.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n\n        if value is None:\n            return None, False\n\n        if not isinstance(value, self.allowed_classes):\n            if len(self.allowed_classes) == 1:\n                value = self.allowed_classes[0](value)\n            else:\n                raise TypeError('Tried to set a DifferentialAttribute with '\n                                'an unsupported Differential type {}. Allowed '\n                                'classes are: {}'\n                                .format(value.__class__,\n                                        self.allowed_classes))\n\n        return value, True\n\n\n# do this here to prevent a series of complicated circular imports\nfrom .earth import EarthLocation\nfrom .representation import CartesianRepresentation, BaseDifferential\n"},{"className":"TimeAttribute","col":0,"comment":"\n    Frame attribute descriptor for quantities that are Time objects.\n    See the `~astropy.coordinates.Attribute` API doc for further\n    information.\n\n    Parameters\n    ----------\n    default : object\n        Default value for the attribute if not provided\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    ","endLoc":191,"id":15336,"nodeType":"Class","startLoc":134,"text":"class TimeAttribute(Attribute):\n    \"\"\"\n    Frame attribute descriptor for quantities that are Time objects.\n    See the `~astropy.coordinates.Attribute` API doc for further\n    information.\n\n    Parameters\n    ----------\n    default : object\n        Default value for the attribute if not provided\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    \"\"\"\n\n    def convert_input(self, value):\n        \"\"\"\n        Convert input value to a Time object and validate by running through\n        the Time constructor.  Also check that the input was a scalar.\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n\n        from astropy.time import Time\n\n        if value is None:\n            return None, False\n\n        if isinstance(value, Time):\n            out = value\n            converted = False\n        else:\n            try:\n                out = Time(value)\n            except Exception as err:\n                raise ValueError(\n                    f'Invalid time input {self.name}={value!r}.') from err\n            converted = True\n\n        # Set attribute as read-only for arrays (not allowed by numpy\n        # for array scalars)\n        if out.shape:\n            out.writeable = False\n        return out, converted"},{"col":4,"comment":"\n        Convert input value to a Time object and validate by running through\n        the Time constructor.  Also check that the input was a scalar.\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        ","endLoc":191,"header":"def convert_input(self, value)","id":15337,"name":"convert_input","nodeType":"Function","startLoc":149,"text":"def convert_input(self, value):\n        \"\"\"\n        Convert input value to a Time object and validate by running through\n        the Time constructor.  Also check that the input was a scalar.\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n\n        from astropy.time import Time\n\n        if value is None:\n            return None, False\n\n        if isinstance(value, Time):\n            out = value\n            converted = False\n        else:\n            try:\n                out = Time(value)\n            except Exception as err:\n                raise ValueError(\n                    f'Invalid time input {self.name}={value!r}.') from err\n            converted = True\n\n        # Set attribute as read-only for arrays (not allowed by numpy\n        # for array scalars)\n        if out.shape:\n            out.writeable = False\n        return out, converted"},{"attributeType":"null","col":4,"comment":"null","endLoc":1791,"id":15338,"name":"attr_classes","nodeType":"Attribute","startLoc":1791,"text":"attr_classes"},{"col":0,"comment":"","endLoc":18,"header":"angle_formats.py#<anonymous>","id":15339,"name":"<anonymous>","nodeType":"Function","startLoc":14,"text":"\"\"\"\nThis module contains formatting functions that are for internal use in\nastropy.coordinates.angles. Mainly they are conversions from one format\nof data to another.\n\"\"\""},{"className":"PhysicsSphericalRepresentation","col":0,"comment":"\n    Representation of points in 3D spherical coordinates (using the physics\n    convention of using ``phi`` and ``theta`` for azimuth and inclination\n    from the pole).\n\n    Parameters\n    ----------\n    phi, theta : `~astropy.units.Quantity` or str\n        The azimuth and inclination of the point(s), in angular units. The\n        inclination should be between 0 and 180 degrees, and the azimuth will\n        be wrapped to an angle between 0 and 360 degrees. These can also be\n        instances of `~astropy.coordinates.Angle`.  If ``copy`` is False, `phi`\n        will be changed inplace if it is not between 0 and 360 degrees.\n\n    r : `~astropy.units.Quantity`\n        The distance to the point(s). If the distance is a length, it is\n        passed to the :class:`~astropy.coordinates.Distance` class, otherwise\n        it is passed to the :class:`~astropy.units.Quantity` class.\n\n    differentials : dict, `PhysicsSphericalDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single\n        `PhysicsSphericalDifferential` instance, or a dictionary of of\n        differential instances with keys set to a string representation of the\n        SI unit with which the differential (derivative) is taken. For example,\n        for a velocity differential on a positional representation, the key\n        would be ``'s'`` for seconds, indicating that the derivative is a time\n        derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    ","endLoc":2293,"id":15340,"nodeType":"Class","startLoc":2090,"text":"class PhysicsSphericalRepresentation(BaseRepresentation):\n    \"\"\"\n    Representation of points in 3D spherical coordinates (using the physics\n    convention of using ``phi`` and ``theta`` for azimuth and inclination\n    from the pole).\n\n    Parameters\n    ----------\n    phi, theta : `~astropy.units.Quantity` or str\n        The azimuth and inclination of the point(s), in angular units. The\n        inclination should be between 0 and 180 degrees, and the azimuth will\n        be wrapped to an angle between 0 and 360 degrees. These can also be\n        instances of `~astropy.coordinates.Angle`.  If ``copy`` is False, `phi`\n        will be changed inplace if it is not between 0 and 360 degrees.\n\n    r : `~astropy.units.Quantity`\n        The distance to the point(s). If the distance is a length, it is\n        passed to the :class:`~astropy.coordinates.Distance` class, otherwise\n        it is passed to the :class:`~astropy.units.Quantity` class.\n\n    differentials : dict, `PhysicsSphericalDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single\n        `PhysicsSphericalDifferential` instance, or a dictionary of of\n        differential instances with keys set to a string representation of the\n        SI unit with which the differential (derivative) is taken. For example,\n        for a velocity differential on a positional representation, the key\n        would be ``'s'`` for seconds, indicating that the derivative is a time\n        derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n\n    attr_classes = {'phi': Angle,\n                    'theta': Angle,\n                    'r': u.Quantity}\n\n    def __init__(self, phi, theta=None, r=None, differentials=None, copy=True):\n        super().__init__(phi, theta, r, copy=copy, differentials=differentials)\n\n        # Wrap/validate phi/theta\n        # Note that _phi already holds our own copy if copy=True.\n        self._phi.wrap_at(360 * u.deg, inplace=True)\n\n        # This invalid catch block can be removed when the minimum numpy\n        # version is >= 1.19 (NUMPY_LT_1_19)\n        with np.errstate(invalid='ignore'):\n            if np.any(self._theta < 0.*u.deg) or np.any(self._theta > 180.*u.deg):\n                raise ValueError('Inclination angle(s) must be within '\n                                 '0 deg <= angle <= 180 deg, '\n                                 'got {}'.format(theta.to(u.degree)))\n\n        if self._r.unit.physical_type == 'length':\n            self._r = self._r.view(Distance)\n\n    @property\n    def phi(self):\n        \"\"\"\n        The azimuth of the point(s).\n        \"\"\"\n        return self._phi\n\n    @property\n    def theta(self):\n        \"\"\"\n        The elevation of the point(s).\n        \"\"\"\n        return self._theta\n\n    @property\n    def r(self):\n        \"\"\"\n        The distance from the origin to the point(s).\n        \"\"\"\n        return self._r\n\n    def unit_vectors(self):\n        sinphi, cosphi = np.sin(self.phi), np.cos(self.phi)\n        sintheta, costheta = np.sin(self.theta), np.cos(self.theta)\n        return {\n            'phi': CartesianRepresentation(-sinphi, cosphi, 0., copy=False),\n            'theta': CartesianRepresentation(costheta*cosphi,\n                                             costheta*sinphi,\n                                             -sintheta, copy=False),\n            'r': CartesianRepresentation(sintheta*cosphi, sintheta*sinphi,\n                                         costheta, copy=False)}\n\n    def scale_factors(self):\n        r = self.r / u.radian\n        sintheta = np.sin(self.theta)\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return {'phi': r * sintheta,\n                'theta': r,\n                'r': l}\n\n    def represent_as(self, other_class, differential_class=None):\n        # Take a short cut if the other class is a spherical representation\n\n        if inspect.isclass(other_class):\n            if issubclass(other_class, SphericalRepresentation):\n                diffs = self._re_represent_differentials(other_class,\n                                                         differential_class)\n                return other_class(lon=self.phi, lat=90 * u.deg - self.theta,\n                                   distance=self.r, differentials=diffs,\n                                   copy=False)\n            elif issubclass(other_class, UnitSphericalRepresentation):\n                diffs = self._re_represent_differentials(other_class,\n                                                         differential_class)\n                return other_class(lon=self.phi, lat=90 * u.deg - self.theta,\n                                   differentials=diffs, copy=False)\n\n        return super().represent_as(other_class, differential_class)\n\n    def to_cartesian(self):\n        \"\"\"\n        Converts spherical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        \"\"\"\n\n        # We need to convert Distance to Quantity to allow negative values.\n        if isinstance(self.r, Distance):\n            d = self.r.view(u.Quantity)\n        else:\n            d = self.r\n\n        x = d * np.sin(self.theta) * np.cos(self.phi)\n        y = d * np.sin(self.theta) * np.sin(self.phi)\n        z = d * np.cos(self.theta)\n\n        return CartesianRepresentation(x=x, y=y, z=z, copy=False)\n\n    @classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates to spherical polar\n        coordinates.\n        \"\"\"\n\n        s = np.hypot(cart.x, cart.y)\n        r = np.hypot(s, cart.z)\n\n        phi = np.arctan2(cart.y, cart.x)\n        theta = np.arctan2(s, cart.z)\n\n        return cls(phi=phi, theta=theta, r=r, copy=False)\n\n    def transform(self, matrix):\n        \"\"\"Transform the spherical coordinates using a 3x3 matrix.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 matrix, such as a rotation matrix (or a stack of matrices).\n\n        \"\"\"\n        # apply transformation in unit-spherical coordinates\n        xyz = erfa_ufunc.s2c(self.phi, 90*u.deg-self.theta)\n        p = erfa_ufunc.rxp(matrix, xyz)\n        lon, lat, ur = erfa_ufunc.p2s(p)  # `ur` is transformed unit-`r`\n        # create transformed physics-spherical representation,\n        # reapplying the distance scaling\n        rep = self.__class__(phi=lon, theta=90*u.deg-lat, r=self.r * ur)\n\n        new_diffs = dict((k, d.transform(matrix, self, rep))\n                         for k, d in self.differentials.items())\n        return rep.with_differentials(new_diffs)\n\n    def norm(self):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.  For\n        spherical coordinates, this is just the absolute value of the radius.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\n        return np.abs(self.r)\n\n    def _scale_operation(self, op, *args):\n        if any(differential.base_representation is not self.__class__\n               for differential in self.differentials.values()):\n            return super()._scale_operation(op, *args)\n\n        phi_op, adjust_theta_sign, r_op = _spherical_op_funcs(op, *args)\n        # Also run phi_op on theta to ensure theta remains between 0 and 180:\n        # any time the scale is negative, we do -theta + 180 degrees.\n        result = self.__class__(phi_op(self.phi),\n                                phi_op(adjust_theta_sign(self.theta)),\n                                r_op(self.r), copy=False)\n        for key, differential in self.differentials.items():\n            new_comps = (op(getattr(differential, comp)) for op, comp in zip(\n                (operator.pos, adjust_theta_sign, r_op),\n                differential.components))\n            result.differentials[key] = differential.__class__(*new_comps, copy=False)\n        return result"},{"col":4,"comment":"\n        The azimuth of the point(s).\n        ","endLoc":2152,"header":"@property\n    def phi(self)","id":15341,"name":"phi","nodeType":"Function","startLoc":2147,"text":"@property\n    def phi(self):\n        \"\"\"\n        The azimuth of the point(s).\n        \"\"\"\n        return self._phi"},{"col":4,"comment":"\n        The elevation of the point(s).\n        ","endLoc":2159,"header":"@property\n    def theta(self)","id":15342,"name":"theta","nodeType":"Function","startLoc":2154,"text":"@property\n    def theta(self):\n        \"\"\"\n        The elevation of the point(s).\n        \"\"\"\n        return self._theta"},{"col":4,"comment":"\n        The distance from the origin to the point(s).\n        ","endLoc":2166,"header":"@property\n    def r(self)","id":15343,"name":"r","nodeType":"Function","startLoc":2161,"text":"@property\n    def r(self):\n        \"\"\"\n        The distance from the origin to the point(s).\n        \"\"\"\n        return self._r"},{"col":4,"comment":"null","endLoc":2177,"header":"def unit_vectors(self)","id":15344,"name":"unit_vectors","nodeType":"Function","startLoc":2168,"text":"def unit_vectors(self):\n        sinphi, cosphi = np.sin(self.phi), np.cos(self.phi)\n        sintheta, costheta = np.sin(self.theta), np.cos(self.theta)\n        return {\n            'phi': CartesianRepresentation(-sinphi, cosphi, 0., copy=False),\n            'theta': CartesianRepresentation(costheta*cosphi,\n                                             costheta*sinphi,\n                                             -sintheta, copy=False),\n            'r': CartesianRepresentation(sintheta*cosphi, sintheta*sinphi,\n                                         costheta, copy=False)}"},{"fileName":"__init__.py","filePath":"astropy/coordinates","id":15345,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis subpackage contains classes and functions for celestial coordinates\nof astronomical objects. It also contains a framework for conversions\nbetween coordinate systems.\n\"\"\"\n\nfrom .errors import *\nfrom .angles import *\nfrom .baseframe import *\nfrom .attributes import *\nfrom .distances import *\nfrom .earth import *\nfrom .transformations import *\nfrom .builtin_frames import *\nfrom .name_resolve import *\nfrom .matching import *\nfrom .representation import *\nfrom .sky_coordinate import *\nfrom .funcs import *\nfrom .calculation import *\nfrom .solar_system import *\nfrom .spectral_quantity import *\nfrom .spectral_coordinate import *\nfrom .angle_utilities import *\n"},{"className":"CelestialError","col":0,"comment":"null","endLoc":25,"id":15346,"nodeType":"Class","startLoc":24,"text":"class CelestialError(ValueError):\n    pass"},{"col":0,"comment":"\n    ","endLoc":56,"header":"def get_sign(dt)","id":15347,"name":"get_sign","nodeType":"Function","startLoc":28,"text":"def get_sign(dt):\n    \"\"\"\n    \"\"\"\n    if ((int(dt.month) == 12 and int(dt.day) >= 22)or(int(dt.month) == 1 and int(dt.day) <= 19)):\n        zodiac_sign = \"capricorn\"\n    elif ((int(dt.month) == 1 and int(dt.day) >= 20)or(int(dt.month) == 2 and int(dt.day) <= 17)):\n        zodiac_sign = \"aquarius\"\n    elif ((int(dt.month) == 2 and int(dt.day) >= 18)or(int(dt.month) == 3 and int(dt.day) <= 19)):\n        zodiac_sign = \"pisces\"\n    elif ((int(dt.month) == 3 and int(dt.day) >= 20)or(int(dt.month) == 4 and int(dt.day) <= 19)):\n        zodiac_sign = \"aries\"\n    elif ((int(dt.month) == 4 and int(dt.day) >= 20)or(int(dt.month) == 5 and int(dt.day) <= 20)):\n        zodiac_sign = \"taurus\"\n    elif ((int(dt.month) == 5 and int(dt.day) >= 21)or(int(dt.month) == 6 and int(dt.day) <= 20)):\n        zodiac_sign = \"gemini\"\n    elif ((int(dt.month) == 6 and int(dt.day) >= 21)or(int(dt.month) == 7 and int(dt.day) <= 22)):\n        zodiac_sign = \"cancer\"\n    elif ((int(dt.month) == 7 and int(dt.day) >= 23)or(int(dt.month) == 8 and int(dt.day) <= 22)):\n        zodiac_sign = \"leo\"\n    elif ((int(dt.month) == 8 and int(dt.day) >= 23)or(int(dt.month) == 9 and int(dt.day) <= 22)):\n        zodiac_sign = \"virgo\"\n    elif ((int(dt.month) == 9 and int(dt.day) >= 23)or(int(dt.month) == 10 and int(dt.day) <= 22)):\n        zodiac_sign = \"libra\"\n    elif ((int(dt.month) == 10 and int(dt.day) >= 23)or(int(dt.month) == 11 and int(dt.day) <= 21)):\n        zodiac_sign = \"scorpio\"\n    elif ((int(dt.month) == 11 and int(dt.day) >= 22)or(int(dt.month) == 12 and int(dt.day) <= 21)):\n        zodiac_sign = \"sagittarius\"\n\n    return zodiac_sign"},{"col":0,"comment":"","endLoc":7,"header":"__init__.py#<anonymous>","id":15348,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis subpackage contains classes and functions for celestial coordinates\nof astronomical objects. It also contains a framework for conversions\nbetween coordinate systems.\n\"\"\""},{"fileName":"earth.py","filePath":"astropy/coordinates","id":15349,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom warnings import warn\nimport collections\nimport socket\nimport json\nimport urllib.request\nimport urllib.error\nimport urllib.parse\n\nimport numpy as np\nimport erfa\n\nfrom astropy import units as u\nfrom astropy import constants as consts\nfrom astropy.units.quantity import QuantityInfoBase\nfrom astropy.utils import data\nfrom astropy.utils.decorators import format_doc\nfrom astropy.utils.exceptions import AstropyUserWarning\n\nfrom .angles import Angle, Longitude, Latitude\nfrom .representation import (BaseRepresentation, CartesianRepresentation,\n                             CartesianDifferential)\nfrom .matrix_utilities import matrix_transpose\nfrom .errors import UnknownSiteException\n\n\n__all__ = ['EarthLocation', 'BaseGeodeticRepresentation',\n           'WGS84GeodeticRepresentation', 'WGS72GeodeticRepresentation',\n           'GRS80GeodeticRepresentation']\n\nGeodeticLocation = collections.namedtuple('GeodeticLocation', ['lon', 'lat', 'height'])\n\nELLIPSOIDS = {}\n\"\"\"Available ellipsoids (defined in erfam.h, with numbers exposed in erfa).\"\"\"\n# Note: they get filled by the creation of the geodetic classes.\n\nOMEGA_EARTH = ((1.002_737_811_911_354_48 * u.cycle/u.day)\n               .to(1/u.s, u.dimensionless_angles()))\n\"\"\"\nRotational velocity of Earth, following SOFA's pvtob.\n\nIn UT1 seconds, this would be 2 pi / (24 * 3600), but we need the value\nin SI seconds, so multiply by the ratio of stellar to solar day.\nSee Explanatory Supplement to the Astronomical Almanac, ed. P. Kenneth\nSeidelmann (1992), University Science Books. The constant is the\nconventional, exact one (IERS conventions 2003); see\nhttp://hpiers.obspm.fr/eop-pc/index.php?index=constants.\n\"\"\"\n\n\ndef _check_ellipsoid(ellipsoid=None, default='WGS84'):\n    if ellipsoid is None:\n        ellipsoid = default\n    if ellipsoid not in ELLIPSOIDS:\n        raise ValueError(f'Ellipsoid {ellipsoid} not among known ones ({ELLIPSOIDS})')\n    return ellipsoid\n\n\ndef _get_json_result(url, err_str, use_google):\n\n    # need to do this here to prevent a series of complicated circular imports\n    from .name_resolve import NameResolveError\n    try:\n        # Retrieve JSON response from Google maps API\n        resp = urllib.request.urlopen(url, timeout=data.conf.remote_timeout)\n        resp_data = json.loads(resp.read().decode('utf8'))\n\n    except urllib.error.URLError as e:\n        # This catches a timeout error, see:\n        #   http://stackoverflow.com/questions/2712524/handling-urllib2s-timeout-python\n        if isinstance(e.reason, socket.timeout):\n            raise NameResolveError(err_str.format(msg=\"connection timed out\")) from e\n        else:\n            raise NameResolveError(err_str.format(msg=e.reason)) from e\n\n    except socket.timeout:\n        # There are some cases where urllib2 does not catch socket.timeout\n        # especially while receiving response data on an already previously\n        # working request\n        raise NameResolveError(err_str.format(msg=\"connection timed out\"))\n\n    if use_google:\n        results = resp_data.get('results', [])\n\n        if resp_data.get('status', None) != 'OK':\n            raise NameResolveError(err_str.format(msg=\"unknown failure with \"\n                                                  \"Google API\"))\n\n    else:  # OpenStreetMap returns a list\n        results = resp_data\n\n    if not results:\n        raise NameResolveError(err_str.format(msg=\"no results returned\"))\n\n    return results\n\n\nclass EarthLocationInfo(QuantityInfoBase):\n    \"\"\"\n    Container for meta information like name, description, format.  This is\n    required when the object is used as a mixin column within a table, but can\n    be used as a general way to store meta information.\n    \"\"\"\n    _represent_as_dict_attrs = ('x', 'y', 'z', 'ellipsoid')\n\n    def _construct_from_dict(self, map):\n        # Need to pop ellipsoid off and update post-instantiation.  This is\n        # on the to-fix list in #4261.\n        ellipsoid = map.pop('ellipsoid')\n        out = self._parent_cls(**map)\n        out.ellipsoid = ellipsoid\n        return out\n\n    def new_like(self, cols, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new EarthLocation instance which is consistent with the\n        input ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty column object whose elements can\n        be set in-place for table operations like join or vstack.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : EarthLocation (or subclass)\n            Empty instance of this class consistent with ``cols``\n        \"\"\"\n        # Very similar to QuantityInfo.new_like, but the creation of the\n        # map is different enough that this needs its own rouinte.\n        # Get merged info attributes shape, dtype, format, description.\n        attrs = self.merge_cols_attributes(cols, metadata_conflicts, name,\n                                           ('meta', 'format', 'description'))\n        # The above raises an error if the dtypes do not match, but returns\n        # just the string representation, which is not useful, so remove.\n        attrs.pop('dtype')\n        # Make empty EarthLocation using the dtype and unit of the last column.\n        # Use zeros so we do not get problems for possible conversion to\n        # geodetic coordinates.\n        shape = (length,) + attrs.pop('shape')\n        data = u.Quantity(np.zeros(shape=shape, dtype=cols[0].dtype),\n                          unit=cols[0].unit, copy=False)\n        # Get arguments needed to reconstruct class\n        map = {key: (data[key] if key in 'xyz' else getattr(cols[-1], key))\n               for key in self._represent_as_dict_attrs}\n        out = self._construct_from_dict(map)\n        # Set remaining info attributes\n        for attr, value in attrs.items():\n            setattr(out.info, attr, value)\n\n        return out\n\n\nclass EarthLocation(u.Quantity):\n    \"\"\"\n    Location on the Earth.\n\n    Initialization is first attempted assuming geocentric (x, y, z) coordinates\n    are given; if that fails, another attempt is made assuming geodetic\n    coordinates (longitude, latitude, height above a reference ellipsoid).\n    When using the geodetic forms, Longitudes are measured increasing to the\n    east, so west longitudes are negative. Internally, the coordinates are\n    stored as geocentric.\n\n    To ensure a specific type of coordinates is used, use the corresponding\n    class methods (`from_geocentric` and `from_geodetic`) or initialize the\n    arguments with names (``x``, ``y``, ``z`` for geocentric; ``lon``, ``lat``,\n    ``height`` for geodetic).  See the class methods for details.\n\n\n    Notes\n    -----\n    This class fits into the coordinates transformation framework in that it\n    encodes a position on the `~astropy.coordinates.ITRS` frame.  To get a\n    proper `~astropy.coordinates.ITRS` object from this object, use the ``itrs``\n    property.\n    \"\"\"\n\n    _ellipsoid = 'WGS84'\n    _location_dtype = np.dtype({'names': ['x', 'y', 'z'],\n                                'formats': [np.float64]*3})\n    _array_dtype = np.dtype((np.float64, (3,)))\n\n    info = EarthLocationInfo()\n\n    def __new__(cls, *args, **kwargs):\n        # TODO: needs copy argument and better dealing with inputs.\n        if (len(args) == 1 and len(kwargs) == 0 and\n                isinstance(args[0], EarthLocation)):\n            return args[0].copy()\n        try:\n            self = cls.from_geocentric(*args, **kwargs)\n        except (u.UnitsError, TypeError) as exc_geocentric:\n            try:\n                self = cls.from_geodetic(*args, **kwargs)\n            except Exception as exc_geodetic:\n                raise TypeError('Coordinates could not be parsed as either '\n                                'geocentric or geodetic, with respective '\n                                'exceptions \"{}\" and \"{}\"'\n                                .format(exc_geocentric, exc_geodetic))\n        return self\n\n    @classmethod\n    def from_geocentric(cls, x, y, z, unit=None):\n        \"\"\"\n        Location on Earth, initialized from geocentric coordinates.\n\n        Parameters\n        ----------\n        x, y, z : `~astropy.units.Quantity` or array-like\n            Cartesian coordinates.  If not quantities, ``unit`` should be given.\n        unit : unit-like or None\n            Physical unit of the coordinate values.  If ``x``, ``y``, and/or\n            ``z`` are quantities, they will be converted to this unit.\n\n        Raises\n        ------\n        astropy.units.UnitsError\n            If the units on ``x``, ``y``, and ``z`` do not match or an invalid\n            unit is given.\n        ValueError\n            If the shapes of ``x``, ``y``, and ``z`` do not match.\n        TypeError\n            If ``x`` is not a `~astropy.units.Quantity` and no unit is given.\n        \"\"\"\n        if unit is None:\n            try:\n                unit = x.unit\n            except AttributeError:\n                raise TypeError(\"Geocentric coordinates should be Quantities \"\n                                \"unless an explicit unit is given.\") from None\n        else:\n            unit = u.Unit(unit)\n\n        if unit.physical_type != 'length':\n            raise u.UnitsError(\"Geocentric coordinates should be in \"\n                               \"units of length.\")\n\n        try:\n            x = u.Quantity(x, unit, copy=False)\n            y = u.Quantity(y, unit, copy=False)\n            z = u.Quantity(z, unit, copy=False)\n        except u.UnitsError:\n            raise u.UnitsError(\"Geocentric coordinate units should all be \"\n                               \"consistent.\")\n\n        x, y, z = np.broadcast_arrays(x, y, z)\n        struc = np.empty(x.shape, cls._location_dtype)\n        struc['x'], struc['y'], struc['z'] = x, y, z\n        return super().__new__(cls, struc, unit, copy=False)\n\n    @classmethod\n    def from_geodetic(cls, lon, lat, height=0., ellipsoid=None):\n        \"\"\"\n        Location on Earth, initialized from geodetic coordinates.\n\n        Parameters\n        ----------\n        lon : `~astropy.coordinates.Longitude` or float\n            Earth East longitude.  Can be anything that initialises an\n            `~astropy.coordinates.Angle` object (if float, in degrees).\n        lat : `~astropy.coordinates.Latitude` or float\n            Earth latitude.  Can be anything that initialises an\n            `~astropy.coordinates.Latitude` object (if float, in degrees).\n        height : `~astropy.units.Quantity` ['length'] or float, optional\n            Height above reference ellipsoid (if float, in meters; default: 0).\n        ellipsoid : str, optional\n            Name of the reference ellipsoid to use (default: 'WGS84').\n            Available ellipsoids are:  'WGS84', 'GRS80', 'WGS72'.\n\n        Raises\n        ------\n        astropy.units.UnitsError\n            If the units on ``lon`` and ``lat`` are inconsistent with angular\n            ones, or that on ``height`` with a length.\n        ValueError\n            If ``lon``, ``lat``, and ``height`` do not have the same shape, or\n            if ``ellipsoid`` is not recognized as among the ones implemented.\n\n        Notes\n        -----\n        For the conversion to geocentric coordinates, the ERFA routine\n        ``gd2gc`` is used.  See https://github.com/liberfa/erfa\n        \"\"\"\n        ellipsoid = _check_ellipsoid(ellipsoid, default=cls._ellipsoid)\n        # As wrapping fails on readonly input, we do so manually\n        lon = Angle(lon, u.degree, copy=False).wrap_at(180 * u.degree)\n        lat = Latitude(lat, u.degree, copy=False)\n        # don't convert to m by default, so we can use the height unit below.\n        if not isinstance(height, u.Quantity):\n            height = u.Quantity(height, u.m, copy=False)\n        # get geocentric coordinates.\n        geodetic = ELLIPSOIDS[ellipsoid](lon, lat, height, copy=False)\n        xyz = geodetic.to_cartesian().get_xyz(xyz_axis=-1) << height.unit\n        self = xyz.view(cls._location_dtype, cls).reshape(geodetic.shape)\n        self._ellipsoid = ellipsoid\n        return self\n\n    @classmethod\n    def of_site(cls, site_name):\n        \"\"\"\n        Return an object of this class for a known observatory/site by name.\n\n        This is intended as a quick convenience function to get basic site\n        information, not a fully-featured exhaustive registry of observatories\n        and all their properties.\n\n        Additional information about the site is stored in the ``.info.meta``\n        dictionary of sites obtained using this method (see the examples below).\n\n        .. note::\n            When this function is called, it will attempt to download site\n            information from the astropy data server. If you would like a site\n            to be added, issue a pull request to the\n            `astropy-data repository <https://github.com/astropy/astropy-data>`_ .\n            If a site cannot be found in the registry (i.e., an internet\n            connection is not available), it will fall back on a built-in list,\n            In the future, this bundled list might include a version-controlled\n            list of canonical observatories extracted from the online version,\n            but it currently only contains the Greenwich Royal Observatory as an\n            example case.\n\n\n        Parameters\n        ----------\n        site_name : str\n            Name of the observatory (case-insensitive).\n\n        Returns\n        -------\n        site : `~astropy.coordinates.EarthLocation` (or subclass) instance\n            The location of the observatory. The returned class will be the same\n            as this class.\n\n        Examples\n        --------\n\n        >>> from astropy.coordinates import EarthLocation\n        >>> keck = EarthLocation.of_site('Keck Observatory')  # doctest: +REMOTE_DATA\n        >>> keck.geodetic  # doctest: +REMOTE_DATA +FLOAT_CMP\n        GeodeticLocation(lon=<Longitude -155.47833333 deg>, lat=<Latitude 19.82833333 deg>, height=<Quantity 4160. m>)\n        >>> keck.info  # doctest: +REMOTE_DATA\n        name = W. M. Keck Observatory\n        dtype = void192\n        unit = m\n        class = EarthLocation\n        n_bad = 0\n        >>> keck.info.meta  # doctest: +REMOTE_DATA\n        {'source': 'IRAF Observatory Database', 'timezone': 'US/Hawaii'}\n\n        See Also\n        --------\n        get_site_names : the list of sites that this function can access\n        \"\"\"  # noqa\n        registry = cls._get_site_registry()\n        try:\n            el = registry[site_name]\n        except UnknownSiteException as e:\n            raise UnknownSiteException(e.site, 'EarthLocation.get_site_names',\n                                       close_names=e.close_names) from e\n\n        if cls is el.__class__:\n            return el\n        else:\n            newel = cls.from_geodetic(*el.to_geodetic())\n            newel.info.name = el.info.name\n            return newel\n\n    @classmethod\n    def of_address(cls, address, get_height=False, google_api_key=None):\n        \"\"\"\n        Return an object of this class for a given address by querying either\n        the OpenStreetMap Nominatim tool [1]_ (default) or the Google geocoding\n        API [2]_, which requires a specified API key.\n\n        This is intended as a quick convenience function to get easy access to\n        locations. If you need to specify a precise location, you should use the\n        initializer directly and pass in a longitude, latitude, and elevation.\n\n        In the background, this just issues a web query to either of\n        the APIs noted above. This is not meant to be abused! Both\n        OpenStreetMap and Google use IP-based query limiting and will ban your\n        IP if you send more than a few thousand queries per hour [2]_.\n\n        .. warning::\n            If the query returns more than one location (e.g., searching on\n            ``address='springfield'``), this function will use the **first**\n            returned location.\n\n        Parameters\n        ----------\n        address : str\n            The address to get the location for. As per the Google maps API,\n            this can be a fully specified street address (e.g., 123 Main St.,\n            New York, NY) or a city name (e.g., Danbury, CT), or etc.\n        get_height : bool, optional\n            This only works when using the Google API! See the ``google_api_key``\n            block below. Use the retrieved location to perform a second query to\n            the Google maps elevation API to retrieve the height of the input\n            address [3]_.\n        google_api_key : str, optional\n            A Google API key with the Geocoding API and (optionally) the\n            elevation API enabled. See [4]_ for more information.\n\n\n        Returns\n        -------\n        location : `~astropy.coordinates.EarthLocation` (or subclass) instance\n            The location of the input address.\n            Will be type(this class)\n\n        References\n        ----------\n        .. [1] https://nominatim.openstreetmap.org/\n        .. [2] https://developers.google.com/maps/documentation/geocoding/start\n        .. [3] https://developers.google.com/maps/documentation/elevation/start\n        .. [4] https://developers.google.com/maps/documentation/geocoding/get-api-key\n\n        \"\"\"\n\n        use_google = google_api_key is not None\n\n        # Fail fast if invalid options are passed:\n        if not use_google and get_height:\n            raise ValueError(\n                'Currently, `get_height` only works when using '\n                'the Google geocoding API, which requires passing '\n                'a Google API key with `google_api_key`. See: '\n                'https://developers.google.com/maps/documentation/geocoding/get-api-key '\n                'for information on obtaining an API key.')\n\n        if use_google:  # Google\n            pars = urllib.parse.urlencode({'address': address,\n                                           'key': google_api_key})\n            geo_url = f\"https://maps.googleapis.com/maps/api/geocode/json?{pars}\"\n\n        else:  # OpenStreetMap\n            pars = urllib.parse.urlencode({'q': address,\n                                           'format': 'json'})\n            geo_url = f\"https://nominatim.openstreetmap.org/search?{pars}\"\n\n        # get longitude and latitude location\n        err_str = f\"Unable to retrieve coordinates for address '{address}'; {{msg}}\"\n        geo_result = _get_json_result(geo_url, err_str=err_str,\n                                      use_google=use_google)\n\n        if use_google:\n            loc = geo_result[0]['geometry']['location']\n            lat = loc['lat']\n            lon = loc['lng']\n\n        else:\n            loc = geo_result[0]\n            lat = float(loc['lat'])  # strings are returned by OpenStreetMap\n            lon = float(loc['lon'])\n\n        if get_height:\n            pars = {'locations': f'{lat:.8f},{lon:.8f}',\n                    'key': google_api_key}\n            pars = urllib.parse.urlencode(pars)\n            ele_url = f\"https://maps.googleapis.com/maps/api/elevation/json?{pars}\"\n\n            err_str = f\"Unable to retrieve elevation for address '{address}'; {{msg}}\"\n            ele_result = _get_json_result(ele_url, err_str=err_str,\n                                          use_google=use_google)\n            height = ele_result[0]['elevation']*u.meter\n\n        else:\n            height = 0.\n\n        return cls.from_geodetic(lon=lon*u.deg, lat=lat*u.deg, height=height)\n\n    @classmethod\n    def get_site_names(cls):\n        \"\"\"\n        Get list of names of observatories for use with\n        `~astropy.coordinates.EarthLocation.of_site`.\n\n        .. note::\n            When this function is called, it will first attempt to\n            download site information from the astropy data server.  If it\n            cannot (i.e., an internet connection is not available), it will fall\n            back on the list included with astropy (which is a limited and dated\n            set of sites).  If you think a site should be added, issue a pull\n            request to the\n            `astropy-data repository <https://github.com/astropy/astropy-data>`_ .\n\n\n        Returns\n        -------\n        names : list of str\n            List of valid observatory names\n\n        See Also\n        --------\n        of_site : Gets the actual location object for one of the sites names\n                  this returns.\n        \"\"\"\n        return cls._get_site_registry().names\n\n    @classmethod\n    def _get_site_registry(cls, force_download=False, force_builtin=False):\n        \"\"\"\n        Gets the site registry.  The first time this either downloads or loads\n        from the data file packaged with astropy.  Subsequent calls will use the\n        cached version unless explicitly overridden.\n\n        Parameters\n        ----------\n        force_download : bool or str\n            If not False, force replacement of the cached registry with a\n            downloaded version. If a str, that will be used as the URL to\n            download from (if just True, the default URL will be used).\n        force_builtin : bool\n            If True, load from the data file bundled with astropy and set the\n            cache to that.\n\n        Returns\n        -------\n        reg : astropy.coordinates.sites.SiteRegistry\n        \"\"\"\n        # need to do this here at the bottom to avoid circular dependencies\n        from .sites import get_builtin_sites, get_downloaded_sites\n\n        if force_builtin and force_download:\n            raise ValueError('Cannot have both force_builtin and force_download True')\n\n        if force_builtin:\n            reg = cls._site_registry = get_builtin_sites()\n        else:\n            reg = getattr(cls, '_site_registry', None)\n            if force_download or not reg:\n                try:\n                    if isinstance(force_download, str):\n                        reg = get_downloaded_sites(force_download)\n                    else:\n                        reg = get_downloaded_sites()\n                except OSError:\n                    if force_download:\n                        raise\n                    msg = ('Could not access the online site list. Falling '\n                           'back on the built-in version, which is rather '\n                           'limited. If you want to retry the download, do '\n                           '{0}._get_site_registry(force_download=True)')\n                    warn(AstropyUserWarning(msg.format(cls.__name__)))\n                    reg = get_builtin_sites()\n                cls._site_registry = reg\n\n        return reg\n\n    @property\n    def ellipsoid(self):\n        \"\"\"The default ellipsoid used to convert to geodetic coordinates.\"\"\"\n        return self._ellipsoid\n\n    @ellipsoid.setter\n    def ellipsoid(self, ellipsoid):\n        self._ellipsoid = _check_ellipsoid(ellipsoid)\n\n    @property\n    def geodetic(self):\n        \"\"\"Convert to geodetic coordinates for the default ellipsoid.\"\"\"\n        return self.to_geodetic()\n\n    def to_geodetic(self, ellipsoid=None):\n        \"\"\"Convert to geodetic coordinates.\n\n        Parameters\n        ----------\n        ellipsoid : str, optional\n            Reference ellipsoid to use.  Default is the one the coordinates\n            were initialized with.  Available are: 'WGS84', 'GRS80', 'WGS72'\n\n        Returns\n        -------\n        lon, lat, height : `~astropy.units.Quantity`\n            The tuple is a ``GeodeticLocation`` namedtuple and is comprised of\n            instances of `~astropy.coordinates.Longitude`,\n            `~astropy.coordinates.Latitude`, and `~astropy.units.Quantity`.\n\n        Raises\n        ------\n        ValueError\n            if ``ellipsoid`` is not recognized as among the ones implemented.\n\n        Notes\n        -----\n        For the conversion to geodetic coordinates, the ERFA routine\n        ``gc2gd`` is used.  See https://github.com/liberfa/erfa\n        \"\"\"\n        ellipsoid = _check_ellipsoid(ellipsoid, default=self.ellipsoid)\n        xyz = self.view(self._array_dtype, u.Quantity)\n        llh = CartesianRepresentation(xyz, xyz_axis=-1, copy=False).represent_as(\n                ELLIPSOIDS[ellipsoid])\n        return GeodeticLocation(\n            Longitude(llh.lon, u.deg, wrap_angle=180*u.deg, copy=False),\n            llh.lat << u.deg, llh.height << self.unit)\n\n    @property\n    def lon(self):\n        \"\"\"Longitude of the location, for the default ellipsoid.\"\"\"\n        return self.geodetic[0]\n\n    @property\n    def lat(self):\n        \"\"\"Latitude of the location, for the default ellipsoid.\"\"\"\n        return self.geodetic[1]\n\n    @property\n    def height(self):\n        \"\"\"Height of the location, for the default ellipsoid.\"\"\"\n        return self.geodetic[2]\n\n    # mostly for symmetry with geodetic and to_geodetic.\n    @property\n    def geocentric(self):\n        \"\"\"Convert to a tuple with X, Y, and Z as quantities\"\"\"\n        return self.to_geocentric()\n\n    def to_geocentric(self):\n        \"\"\"Convert to a tuple with X, Y, and Z as quantities\"\"\"\n        return (self.x, self.y, self.z)\n\n    def get_itrs(self, obstime=None):\n        \"\"\"\n        Generates an `~astropy.coordinates.ITRS` object with the location of\n        this object at the requested ``obstime``.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time` or None\n            The ``obstime`` to apply to the new `~astropy.coordinates.ITRS`, or\n            if None, the default ``obstime`` will be used.\n\n        Returns\n        -------\n        itrs : `~astropy.coordinates.ITRS`\n            The new object in the ITRS frame\n        \"\"\"\n        # Broadcast for a single position at multiple times, but don't attempt\n        # to be more general here.\n        if obstime and self.size == 1 and obstime.shape:\n            self = np.broadcast_to(self, obstime.shape, subok=True)\n\n        # do this here to prevent a series of complicated circular imports\n        from .builtin_frames import ITRS\n        return ITRS(x=self.x, y=self.y, z=self.z, obstime=obstime)\n\n    itrs = property(get_itrs, doc=\"\"\"An `~astropy.coordinates.ITRS` object  with\n                                     for the location of this object at the\n                                     default ``obstime``.\"\"\")\n\n    def get_gcrs(self, obstime):\n        \"\"\"GCRS position with velocity at ``obstime`` as a GCRS coordinate.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time`\n            The ``obstime`` to calculate the GCRS position/velocity at.\n\n        Returns\n        -------\n        gcrs : `~astropy.coordinates.GCRS` instance\n            With velocity included.\n        \"\"\"\n        # do this here to prevent a series of complicated circular imports\n        from .builtin_frames import GCRS\n        loc, vel = self.get_gcrs_posvel(obstime)\n        loc.differentials['s'] = CartesianDifferential.from_cartesian(vel)\n        return GCRS(loc, obstime=obstime)\n\n    def _get_gcrs_posvel(self, obstime, ref_to_itrs, gcrs_to_ref):\n        \"\"\"Calculate GCRS position and velocity given transformation matrices.\n\n        The reference frame z axis must point to the Celestial Intermediate Pole\n        (as is the case for CIRS and TETE).\n\n        This private method is used in intermediate_rotation_transforms,\n        where some of the matrices are already available for the coordinate\n        transformation.\n\n        The method is faster by an order of magnitude than just adding a zero\n        velocity to ITRS and transforming to GCRS, because it avoids calculating\n        the velocity via finite differencing of the results of the transformation\n        at three separate times.\n        \"\"\"\n        # The simplest route is to transform to the reference frame where the\n        # z axis is properly aligned with the Earth's rotation axis (CIRS or\n        # TETE), then calculate the velocity, and then transform this\n        # reference position and velocity to GCRS.  For speed, though, we\n        # transform the coordinates to GCRS in one step, and calculate the\n        # velocities by rotating around the earth's axis transformed to GCRS.\n        ref_to_gcrs = matrix_transpose(gcrs_to_ref)\n        itrs_to_gcrs = ref_to_gcrs @ matrix_transpose(ref_to_itrs)\n        # Earth's rotation vector in the ref frame is rot_vec_ref = (0,0,OMEGA_EARTH),\n        # so in GCRS it is rot_vec_gcrs[..., 2] @ OMEGA_EARTH.\n        rot_vec_gcrs = CartesianRepresentation(ref_to_gcrs[..., 2] * OMEGA_EARTH,\n                                               xyz_axis=-1, copy=False)\n        # Get the position in the GCRS frame.\n        # Since we just need the cartesian representation of ITRS, avoid get_itrs().\n        itrs_cart = CartesianRepresentation(self.x, self.y, self.z, copy=False)\n        pos = itrs_cart.transform(itrs_to_gcrs)\n        vel = rot_vec_gcrs.cross(pos)\n        return pos, vel\n\n    def get_gcrs_posvel(self, obstime):\n        \"\"\"\n        Calculate the GCRS position and velocity of this object at the\n        requested ``obstime``.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time`\n            The ``obstime`` to calculate the GCRS position/velocity at.\n\n        Returns\n        -------\n        obsgeoloc : `~astropy.coordinates.CartesianRepresentation`\n            The GCRS position of the object\n        obsgeovel : `~astropy.coordinates.CartesianRepresentation`\n            The GCRS velocity of the object\n        \"\"\"\n        # Local import to prevent circular imports.\n        from .builtin_frames.intermediate_rotation_transforms import (\n            cirs_to_itrs_mat, gcrs_to_cirs_mat)\n\n        # Get gcrs_posvel by transforming via CIRS (slightly faster than TETE).\n        return self._get_gcrs_posvel(obstime,\n                                     cirs_to_itrs_mat(obstime),\n                                     gcrs_to_cirs_mat(obstime))\n\n    def gravitational_redshift(self, obstime,\n                               bodies=['sun', 'jupiter', 'moon'],\n                               masses={}):\n        \"\"\"Return the gravitational redshift at this EarthLocation.\n\n        Calculates the gravitational redshift, of order 3 m/s, due to the\n        requested solar system bodies.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time`\n            The ``obstime`` to calculate the redshift at.\n\n        bodies : iterable, optional\n            The bodies (other than the Earth) to include in the redshift\n            calculation.  List elements should be any body name\n            `get_body_barycentric` accepts.  Defaults to Jupiter, the Sun, and\n            the Moon.  Earth is always included (because the class represents\n            an *Earth* location).\n\n        masses : dict[str, `~astropy.units.Quantity`], optional\n            The mass or gravitational parameters (G * mass) to assume for the\n            bodies requested in ``bodies``. Can be used to override the\n            defaults for the Sun, Jupiter, the Moon, and the Earth, or to\n            pass in masses for other bodies.\n\n        Returns\n        -------\n        redshift : `~astropy.units.Quantity`\n            Gravitational redshift in velocity units at given obstime.\n        \"\"\"\n        # needs to be here to avoid circular imports\n        from .solar_system import get_body_barycentric\n\n        bodies = list(bodies)\n        # Ensure earth is included and last in the list.\n        if 'earth' in bodies:\n            bodies.remove('earth')\n        bodies.append('earth')\n        _masses = {'sun': consts.GM_sun,\n                   'jupiter': consts.GM_jup,\n                   'moon': consts.G * 7.34767309e22*u.kg,\n                   'earth': consts.GM_earth}\n        _masses.update(masses)\n        GMs = []\n        M_GM_equivalency = (u.kg, u.Unit(consts.G * u.kg))\n        for body in bodies:\n            try:\n                GMs.append(_masses[body].to(u.m**3/u.s**2, [M_GM_equivalency]))\n            except KeyError as err:\n                raise KeyError(f'body \"{body}\" does not have a mass.') from err\n            except u.UnitsError as exc:\n                exc.args += ('\"masses\" argument values must be masses or '\n                             'gravitational parameters.',)\n                raise\n\n        positions = [get_body_barycentric(name, obstime) for name in bodies]\n        # Calculate distances to objects other than earth.\n        distances = [(pos - positions[-1]).norm() for pos in positions[:-1]]\n        # Append distance from Earth's center for Earth's contribution.\n        distances.append(CartesianRepresentation(self.geocentric).norm())\n        # Get redshifts due to all objects.\n        redshifts = [-GM / consts.c / distance for (GM, distance) in\n                     zip(GMs, distances)]\n        # Reverse order of summing, to go from small to big, and to get\n        # \"earth\" first, which gives m/s as unit.\n        return sum(redshifts[::-1])\n\n    @property\n    def x(self):\n        \"\"\"The X component of the geocentric coordinates.\"\"\"\n        return self['x']\n\n    @property\n    def y(self):\n        \"\"\"The Y component of the geocentric coordinates.\"\"\"\n        return self['y']\n\n    @property\n    def z(self):\n        \"\"\"The Z component of the geocentric coordinates.\"\"\"\n        return self['z']\n\n    def __getitem__(self, item):\n        result = super().__getitem__(item)\n        if result.dtype is self.dtype:\n            return result.view(self.__class__)\n        else:\n            return result.view(u.Quantity)\n\n    def __array_finalize__(self, obj):\n        super().__array_finalize__(obj)\n        if hasattr(obj, '_ellipsoid'):\n            self._ellipsoid = obj._ellipsoid\n\n    def __len__(self):\n        if self.shape == ():\n            raise IndexError('0-d EarthLocation arrays cannot be indexed')\n        else:\n            return super().__len__()\n\n    def _to_value(self, unit, equivalencies=[]):\n        \"\"\"Helper method for to and to_value.\"\"\"\n        # Conversion to another unit in both ``to`` and ``to_value`` goes\n        # via this routine. To make the regular quantity routines work, we\n        # temporarily turn the structured array into a regular one.\n        array_view = self.view(self._array_dtype, np.ndarray)\n        if equivalencies == []:\n            equivalencies = self._equivalencies\n        new_array = self.unit.to(unit, array_view, equivalencies=equivalencies)\n        return new_array.view(self.dtype).reshape(self.shape)\n\n\ngeodetic_base_doc = \"\"\"{__doc__}\n\n    Parameters\n    ----------\n    lon, lat : angle-like\n        The longitude and latitude of the point(s), in angular units. The\n        latitude should be between -90 and 90 degrees, and the longitude will\n        be wrapped to an angle between 0 and 360 degrees. These can also be\n        instances of `~astropy.coordinates.Angle` and either\n        `~astropy.coordinates.Longitude` not `~astropy.coordinates.Latitude`,\n        depending on the parameter.\n    height : `~astropy.units.Quantity` ['length']\n        The height to the point(s).\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n\n\"\"\"\n\n\n@format_doc(geodetic_base_doc)\nclass BaseGeodeticRepresentation(BaseRepresentation):\n    \"\"\"Base geodetic representation.\"\"\"\n\n    attr_classes = {'lon': Longitude,\n                    'lat': Latitude,\n                    'height': u.Quantity}\n\n    def __init_subclass__(cls, **kwargs):\n        super().__init_subclass__(**kwargs)\n        if '_ellipsoid' in cls.__dict__:\n            ELLIPSOIDS[cls._ellipsoid] = cls\n\n    def __init__(self, lon, lat=None, height=None, copy=True):\n        if height is None and not isinstance(lon, self.__class__):\n            height = 0 << u.m\n\n        super().__init__(lon, lat, height, copy=copy)\n        if not self.height.unit.is_equivalent(u.m):\n            raise u.UnitTypeError(f\"{self.__class__.__name__} requires \"\n                                  f\"height with units of length.\")\n\n    def to_cartesian(self):\n        \"\"\"\n        Converts WGS84 geodetic coordinates to 3D rectangular (geocentric)\n        cartesian coordinates.\n        \"\"\"\n        xyz = erfa.gd2gc(getattr(erfa, self._ellipsoid),\n                         self.lon, self.lat, self.height)\n        return CartesianRepresentation(xyz, xyz_axis=-1, copy=False)\n\n    @classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates (assumed geocentric) to\n        WGS84 geodetic coordinates.\n        \"\"\"\n        lon, lat, height = erfa.gc2gd(getattr(erfa, cls._ellipsoid),\n                                      cart.get_xyz(xyz_axis=-1))\n        return cls(lon, lat, height, copy=False)\n\n\n@format_doc(geodetic_base_doc)\nclass WGS84GeodeticRepresentation(BaseGeodeticRepresentation):\n    \"\"\"Representation of points in WGS84 3D geodetic coordinates.\"\"\"\n\n    _ellipsoid = 'WGS84'\n\n\n@format_doc(geodetic_base_doc)\nclass WGS72GeodeticRepresentation(BaseGeodeticRepresentation):\n    \"\"\"Representation of points in WGS72 3D geodetic coordinates.\"\"\"\n\n    _ellipsoid = 'WGS72'\n\n\n@format_doc(geodetic_base_doc)\nclass GRS80GeodeticRepresentation(BaseGeodeticRepresentation):\n    \"\"\"Representation of points in GRS80 3D geodetic coordinates.\"\"\"\n\n    _ellipsoid = 'GRS80'\n"},{"className":"EarthLocationInfo","col":0,"comment":"\n    Container for meta information like name, description, format.  This is\n    required when the object is used as a mixin column within a table, but can\n    be used as a general way to store meta information.\n    ","endLoc":161,"id":15350,"nodeType":"Class","startLoc":99,"text":"class EarthLocationInfo(QuantityInfoBase):\n    \"\"\"\n    Container for meta information like name, description, format.  This is\n    required when the object is used as a mixin column within a table, but can\n    be used as a general way to store meta information.\n    \"\"\"\n    _represent_as_dict_attrs = ('x', 'y', 'z', 'ellipsoid')\n\n    def _construct_from_dict(self, map):\n        # Need to pop ellipsoid off and update post-instantiation.  This is\n        # on the to-fix list in #4261.\n        ellipsoid = map.pop('ellipsoid')\n        out = self._parent_cls(**map)\n        out.ellipsoid = ellipsoid\n        return out\n\n    def new_like(self, cols, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new EarthLocation instance which is consistent with the\n        input ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty column object whose elements can\n        be set in-place for table operations like join or vstack.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : EarthLocation (or subclass)\n            Empty instance of this class consistent with ``cols``\n        \"\"\"\n        # Very similar to QuantityInfo.new_like, but the creation of the\n        # map is different enough that this needs its own rouinte.\n        # Get merged info attributes shape, dtype, format, description.\n        attrs = self.merge_cols_attributes(cols, metadata_conflicts, name,\n                                           ('meta', 'format', 'description'))\n        # The above raises an error if the dtypes do not match, but returns\n        # just the string representation, which is not useful, so remove.\n        attrs.pop('dtype')\n        # Make empty EarthLocation using the dtype and unit of the last column.\n        # Use zeros so we do not get problems for possible conversion to\n        # geodetic coordinates.\n        shape = (length,) + attrs.pop('shape')\n        data = u.Quantity(np.zeros(shape=shape, dtype=cols[0].dtype),\n                          unit=cols[0].unit, copy=False)\n        # Get arguments needed to reconstruct class\n        map = {key: (data[key] if key in 'xyz' else getattr(cols[-1], key))\n               for key in self._represent_as_dict_attrs}\n        out = self._construct_from_dict(map)\n        # Set remaining info attributes\n        for attr, value in attrs.items():\n            setattr(out.info, attr, value)\n\n        return out"},{"col":4,"comment":"null","endLoc":113,"header":"def _construct_from_dict(self, map)","id":15351,"name":"_construct_from_dict","nodeType":"Function","startLoc":107,"text":"def _construct_from_dict(self, map):\n        # Need to pop ellipsoid off and update post-instantiation.  This is\n        # on the to-fix list in #4261.\n        ellipsoid = map.pop('ellipsoid')\n        out = self._parent_cls(**map)\n        out.ellipsoid = ellipsoid\n        return out"},{"className":"CartesianRepresentationAttribute","col":0,"comment":"\n    A frame attribute that is a CartesianRepresentation with specified units.\n\n    Parameters\n    ----------\n    default : object\n        Default value for the attribute if not provided\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    unit : unit-like or None\n        Name of a unit that the input will be converted into. If None, no\n        unit-checking or conversion is performed\n    ","endLoc":257,"id":15352,"nodeType":"Class","startLoc":194,"text":"class CartesianRepresentationAttribute(Attribute):\n    \"\"\"\n    A frame attribute that is a CartesianRepresentation with specified units.\n\n    Parameters\n    ----------\n    default : object\n        Default value for the attribute if not provided\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    unit : unit-like or None\n        Name of a unit that the input will be converted into. If None, no\n        unit-checking or conversion is performed\n    \"\"\"\n\n    def __init__(self, default=None, secondary_attribute='', unit=None):\n        super().__init__(default, secondary_attribute)\n        self.unit = unit\n\n    def convert_input(self, value):\n        \"\"\"\n        Checks that the input is a CartesianRepresentation with the correct\n        unit, or the special value ``[0, 0, 0]``.\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out : object\n            The correctly-typed object.\n        converted : boolean\n            A boolean which indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n\n        if (isinstance(value, list) and len(value) == 3 and\n                all(v == 0 for v in value) and self.unit is not None):\n            return CartesianRepresentation(np.zeros(3) * self.unit), True\n        else:\n            # is it a CartesianRepresentation with correct unit?\n            if hasattr(value, 'xyz') and value.xyz.unit == self.unit:\n                return value, False\n\n            converted = True\n            # if it's a CartesianRepresentation, get the xyz Quantity\n            value = getattr(value, 'xyz', value)\n            if not hasattr(value, 'unit'):\n                raise TypeError('tried to set a {} with something that does '\n                                'not have a unit.'\n                                .format(self.__class__.__name__))\n\n            value = value.to(self.unit)\n\n            # now try and make a CartesianRepresentation.\n            cartrep = CartesianRepresentation(value, copy=False)\n            return cartrep, converted"},{"col":4,"comment":"null","endLoc":212,"header":"def __init__(self, default=None, secondary_attribute='', unit=None)","id":15353,"name":"__init__","nodeType":"Function","startLoc":210,"text":"def __init__(self, default=None, secondary_attribute='', unit=None):\n        super().__init__(default, secondary_attribute)\n        self.unit = unit"},{"col":4,"comment":"null","endLoc":2185,"header":"def scale_factors(self)","id":15354,"name":"scale_factors","nodeType":"Function","startLoc":2179,"text":"def scale_factors(self):\n        r = self.r / u.radian\n        sintheta = np.sin(self.theta)\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return {'phi': r * sintheta,\n                'theta': r,\n                'r': l}"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":15355,"name":"DEFAULT_DISTANCE","nodeType":"Attribute","startLoc":30,"text":"DEFAULT_DISTANCE"},{"col":0,"comment":"null","endLoc":73,"header":"def _get_zodiac(yr)","id":15356,"name":"_get_zodiac","nodeType":"Function","startLoc":72,"text":"def _get_zodiac(yr):\n    return _ZODIAC[(yr - _ZODIAC[0][0]) % 12][1]"},{"col":0,"comment":"\n    Enter your birthday as an `astropy.time.Time` object and\n    receive a mystical horoscope about things to come.\n\n    Parameters\n    ----------\n    birthday : `astropy.time.Time` or str\n        Your birthday as a `datetime.datetime` or `astropy.time.Time` object\n        or \"YYYY-MM-DD\"string.\n    corrected : bool\n        Whether to account for the precession of the Earth instead of using the\n        ancient Greek dates for the signs.  After all, you do want your *real*\n        horoscope, not a cheap inaccurate approximation, right?\n\n    chinese : bool\n        Chinese annual zodiac wisdom instead of Western one.\n\n    Returns\n    -------\n    Infinite wisdom, condensed into astrologically precise prose.\n\n    Notes\n    -----\n    This function was implemented on April 1.  Take note of that date.\n    ","endLoc":179,"header":"def horoscope(birthday, corrected=True, chinese=False)","id":15357,"name":"horoscope","nodeType":"Function","startLoc":76,"text":"def horoscope(birthday, corrected=True, chinese=False):\n    \"\"\"\n    Enter your birthday as an `astropy.time.Time` object and\n    receive a mystical horoscope about things to come.\n\n    Parameters\n    ----------\n    birthday : `astropy.time.Time` or str\n        Your birthday as a `datetime.datetime` or `astropy.time.Time` object\n        or \"YYYY-MM-DD\"string.\n    corrected : bool\n        Whether to account for the precession of the Earth instead of using the\n        ancient Greek dates for the signs.  After all, you do want your *real*\n        horoscope, not a cheap inaccurate approximation, right?\n\n    chinese : bool\n        Chinese annual zodiac wisdom instead of Western one.\n\n    Returns\n    -------\n    Infinite wisdom, condensed into astrologically precise prose.\n\n    Notes\n    -----\n    This function was implemented on April 1.  Take note of that date.\n    \"\"\"\n    from bs4 import BeautifulSoup\n\n    today = datetime.now()\n    err_msg = \"Invalid response from celestial gods (failed to load horoscope).\"\n    headers = {'User-Agent': 'foo/bar'}\n\n    special_words = {\n        '([sS]tar[s^ ]*)': 'yellow',\n        '([yY]ou[^ ]*)': 'magenta',\n        '([pP]lay[^ ]*)': 'blue',\n        '([hH]eart)': 'red',\n        '([fF]ate)': 'lightgreen',\n    }\n\n    if isinstance(birthday, str):\n        birthday = datetime.strptime(birthday, '%Y-%m-%d')\n\n    if chinese:\n        # TODO: Make this more accurate by using the actual date, not just year\n        # Might need third-party tool like https://pypi.org/project/lunardate\n        zodiac_sign = _get_zodiac(birthday.year)\n        url = ('https://www.horoscope.com/us/horoscopes/yearly/'\n               '{}-chinese-horoscope-{}.aspx'.format(today.year, zodiac_sign))\n        summ_title_sfx = f'in {today.year}'\n\n        try:\n            res = Request(url, headers=headers)\n            with urlopen(res) as f:\n                try:\n                    doc = BeautifulSoup(f, 'html.parser')\n                    # TODO: Also include Love, Family & Friends, Work, Money, More?\n                    item = doc.find(id='overview')\n                    desc = item.getText()\n                except Exception:\n                    raise CelestialError(err_msg)\n        except Exception:\n            raise CelestialError(err_msg)\n\n    else:\n        birthday = atime.Time(birthday)\n\n        if corrected:\n            with warnings.catch_warnings():\n                warnings.simplefilter('ignore')  # Ignore ErfaWarning\n                zodiac_sign = get_sun(birthday).get_constellation().lower()\n            zodiac_sign = _CONST_TO_SIGNS.get(zodiac_sign, zodiac_sign)\n            if zodiac_sign not in _VALID_SIGNS:\n                raise HumanError('On your birthday the sun was in {}, which is not '\n                                 'a sign of the zodiac.  You must not exist.  Or '\n                                 'maybe you can settle for '\n                                 'corrected=False.'.format(zodiac_sign.title()))\n        else:\n            zodiac_sign = get_sign(birthday.to_datetime())\n        url = f\"http://www.astrology.com/us/horoscope/daily-overview.aspx?sign={zodiac_sign}\"\n        summ_title_sfx = f\"on {today.strftime('%Y-%m-%d')}\"\n\n        res = Request(url, headers=headers)\n        with urlopen(res) as f:\n            try:\n                doc = BeautifulSoup(f, 'html.parser')\n                item = doc.find('div', {'id': 'content'})\n                desc = item.getText()\n            except Exception:\n                raise CelestialError(err_msg)\n\n    print(\"*\"*79)\n    color_print(f\"Horoscope for {zodiac_sign.capitalize()} {summ_title_sfx}:\",\n                'green')\n    print(\"*\"*79)\n    for block in textwrap.wrap(desc, 79):\n        split_block = block.split()\n        for i, word in enumerate(split_block):\n            for re_word in special_words.keys():\n                match = re.search(re_word, word)\n                if match is None:\n                    continue\n                split_block[i] = _color_text(match.groups()[0], special_words[re_word])\n        print(\" \".join(split_block))"},{"col":4,"comment":"null","endLoc":2203,"header":"def represent_as(self, other_class, differential_class=None)","id":15358,"name":"represent_as","nodeType":"Function","startLoc":2187,"text":"def represent_as(self, other_class, differential_class=None):\n        # Take a short cut if the other class is a spherical representation\n\n        if inspect.isclass(other_class):\n            if issubclass(other_class, SphericalRepresentation):\n                diffs = self._re_represent_differentials(other_class,\n                                                         differential_class)\n                return other_class(lon=self.phi, lat=90 * u.deg - self.theta,\n                                   distance=self.r, differentials=diffs,\n                                   copy=False)\n            elif issubclass(other_class, UnitSphericalRepresentation):\n                diffs = self._re_represent_differentials(other_class,\n                                                         differential_class)\n                return other_class(lon=self.phi, lat=90 * u.deg - self.theta,\n                                   differentials=diffs, copy=False)\n\n        return super().represent_as(other_class, differential_class)"},{"col":4,"comment":"\n        Checks that the input is a CartesianRepresentation with the correct\n        unit, or the special value ``[0, 0, 0]``.\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out : object\n            The correctly-typed object.\n        converted : boolean\n            A boolean which indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        ","endLoc":257,"header":"def convert_input(self, value)","id":15359,"name":"convert_input","nodeType":"Function","startLoc":214,"text":"def convert_input(self, value):\n        \"\"\"\n        Checks that the input is a CartesianRepresentation with the correct\n        unit, or the special value ``[0, 0, 0]``.\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out : object\n            The correctly-typed object.\n        converted : boolean\n            A boolean which indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n\n        if (isinstance(value, list) and len(value) == 3 and\n                all(v == 0 for v in value) and self.unit is not None):\n            return CartesianRepresentation(np.zeros(3) * self.unit), True\n        else:\n            # is it a CartesianRepresentation with correct unit?\n            if hasattr(value, 'xyz') and value.xyz.unit == self.unit:\n                return value, False\n\n            converted = True\n            # if it's a CartesianRepresentation, get the xyz Quantity\n            value = getattr(value, 'xyz', value)\n            if not hasattr(value, 'unit'):\n                raise TypeError('tried to set a {} with something that does '\n                                'not have a unit.'\n                                .format(self.__class__.__name__))\n\n            value = value.to(self.unit)\n\n            # now try and make a CartesianRepresentation.\n            cartrep = CartesianRepresentation(value, copy=False)\n            return cartrep, converted"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":15360,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":33,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":1,"header":"spectral_coordinate.py#<anonymous>","id":15361,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"__all__ = ['SpectralCoord']\n\nKMS = u.km / u.s\n\nZERO_VELOCITIES = CartesianDifferential([0, 0, 0] * KMS)\n\nDEFAULT_DISTANCE = 1e6 * u.kpc\n\n__doctest_skip__ = ['SpectralCoord.*']"},{"col":4,"comment":"\n        Return a new EarthLocation instance which is consistent with the\n        input ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty column object whose elements can\n        be set in-place for table operations like join or vstack.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : EarthLocation (or subclass)\n            Empty instance of this class consistent with ``cols``\n        ","endLoc":161,"header":"def new_like(self, cols, length, metadata_conflicts='warn', name=None)","id":15362,"name":"new_like","nodeType":"Function","startLoc":115,"text":"def new_like(self, cols, length, metadata_conflicts='warn', name=None):\n        \"\"\"\n        Return a new EarthLocation instance which is consistent with the\n        input ``cols`` and has ``length`` rows.\n\n        This is intended for creating an empty column object whose elements can\n        be set in-place for table operations like join or vstack.\n\n        Parameters\n        ----------\n        cols : list\n            List of input columns\n        length : int\n            Length of the output column object\n        metadata_conflicts : str ('warn'|'error'|'silent')\n            How to handle metadata conflicts\n        name : str\n            Output column name\n\n        Returns\n        -------\n        col : EarthLocation (or subclass)\n            Empty instance of this class consistent with ``cols``\n        \"\"\"\n        # Very similar to QuantityInfo.new_like, but the creation of the\n        # map is different enough that this needs its own rouinte.\n        # Get merged info attributes shape, dtype, format, description.\n        attrs = self.merge_cols_attributes(cols, metadata_conflicts, name,\n                                           ('meta', 'format', 'description'))\n        # The above raises an error if the dtypes do not match, but returns\n        # just the string representation, which is not useful, so remove.\n        attrs.pop('dtype')\n        # Make empty EarthLocation using the dtype and unit of the last column.\n        # Use zeros so we do not get problems for possible conversion to\n        # geodetic coordinates.\n        shape = (length,) + attrs.pop('shape')\n        data = u.Quantity(np.zeros(shape=shape, dtype=cols[0].dtype),\n                          unit=cols[0].unit, copy=False)\n        # Get arguments needed to reconstruct class\n        map = {key: (data[key] if key in 'xyz' else getattr(cols[-1], key))\n               for key in self._represent_as_dict_attrs}\n        out = self._construct_from_dict(map)\n        # Set remaining info attributes\n        for attr, value in attrs.items():\n            setattr(out.info, attr, value)\n\n        return out"},{"fileName":"jparser.py","filePath":"astropy/coordinates","id":15363,"nodeType":"File","text":"\"\"\"\nModule for parsing astronomical object names to extract embedded coordinates\neg: '2MASS J06495091-0737408'\n\"\"\"\n\nimport re\n\nimport numpy as np\n\nimport astropy.units as u\nfrom astropy.coordinates import SkyCoord\n\nRA_REGEX = r'()([0-2]\\d)([0-5]\\d)([0-5]\\d)\\.?(\\d{0,3})'\nDEC_REGEX = r'([+-])(\\d{1,2})([0-5]\\d)([0-5]\\d)\\.?(\\d{0,3})'\nJCOORD_REGEX = '(.*?J)' + RA_REGEX + DEC_REGEX\nJPARSER = re.compile(JCOORD_REGEX)\n\n\ndef _sexagesimal(g):\n    # convert matched regex groups to sexigesimal array\n    sign, h, m, s, frac = g\n    sign = -1 if (sign == '-') else 1\n    s = '.'.join((s, frac))\n    return sign * np.array([h, m, s], float)\n\n\ndef search(name, raise_=False):\n    \"\"\"Regex match for coordinates in name\"\"\"\n    # extract the coordinate data from name\n    match = JPARSER.search(name)\n    if match is None and raise_:\n        raise ValueError('No coordinate match found!')\n    return match\n\n\ndef to_ra_dec_angles(name):\n    \"\"\"get RA in hourangle and DEC in degrees by parsing name \"\"\"\n    groups = search(name, True).groups()\n    prefix, hms, dms = np.split(groups, [1, 6])\n    ra = (_sexagesimal(hms) / (1, 60, 60 * 60) * u.hourangle).sum()\n    dec = (_sexagesimal(dms) * (u.deg, u.arcmin, u.arcsec)).sum()\n    return ra, dec\n\n\ndef to_skycoord(name, frame='icrs'):\n    \"\"\"Convert to `name` to `SkyCoords` object\"\"\"\n    return SkyCoord(*to_ra_dec_angles(name), frame=frame)\n\n\ndef shorten(name):\n    \"\"\"\n    Produce a shortened version of the full object name using: the prefix\n    (usually the survey name) and RA (hour, minute), DEC (deg, arcmin) parts.\n        e.g.: '2MASS J06495091-0737408' --> '2MASS J0649-0737'\n    Parameters\n    ----------\n    name : str\n        Full object name with J-coords embedded.\n    Returns\n    -------\n    shortName: str\n    \"\"\"\n    match = search(name)\n    return ''.join(match.group(1, 3, 4, 7, 8, 9))\n"},{"col":0,"comment":"\n    Produce a shortened version of the full object name using: the prefix\n    (usually the survey name) and RA (hour, minute), DEC (deg, arcmin) parts.\n        e.g.: '2MASS J06495091-0737408' --> '2MASS J0649-0737'\n    Parameters\n    ----------\n    name : str\n        Full object name with J-coords embedded.\n    Returns\n    -------\n    shortName: str\n    ","endLoc":64,"header":"def shorten(name)","id":15364,"name":"shorten","nodeType":"Function","startLoc":50,"text":"def shorten(name):\n    \"\"\"\n    Produce a shortened version of the full object name using: the prefix\n    (usually the survey name) and RA (hour, minute), DEC (deg, arcmin) parts.\n        e.g.: '2MASS J06495091-0737408' --> '2MASS J0649-0737'\n    Parameters\n    ----------\n    name : str\n        Full object name with J-coords embedded.\n    Returns\n    -------\n    shortName: str\n    \"\"\"\n    match = search(name)\n    return ''.join(match.group(1, 3, 4, 7, 8, 9))"},{"attributeType":"null","col":8,"comment":"null","endLoc":212,"id":15365,"name":"unit","nodeType":"Attribute","startLoc":212,"text":"self.unit"},{"className":"QuantityAttribute","col":0,"comment":"\n    A frame attribute that is a quantity with specified units and shape\n    (optionally).\n\n    Can be `None`, which should be used for special cases in associated\n    frame transformations like \"this quantity should be ignored\" or similar.\n\n    Parameters\n    ----------\n    default : number or `~astropy.units.Quantity` or None, optional\n        Default value for the attribute if the user does not supply one. If a\n        Quantity, it must be consistent with ``unit``, or if a value, ``unit``\n        cannot be None.\n    secondary_attribute : str, optional\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    unit : unit-like or None, optional\n        Name of a unit that the input will be converted into. If None, no\n        unit-checking or conversion is performed\n    shape : tuple or None, optional\n        If given, specifies the shape the attribute must be\n    ","endLoc":342,"id":15366,"nodeType":"Class","startLoc":260,"text":"class QuantityAttribute(Attribute):\n    \"\"\"\n    A frame attribute that is a quantity with specified units and shape\n    (optionally).\n\n    Can be `None`, which should be used for special cases in associated\n    frame transformations like \"this quantity should be ignored\" or similar.\n\n    Parameters\n    ----------\n    default : number or `~astropy.units.Quantity` or None, optional\n        Default value for the attribute if the user does not supply one. If a\n        Quantity, it must be consistent with ``unit``, or if a value, ``unit``\n        cannot be None.\n    secondary_attribute : str, optional\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    unit : unit-like or None, optional\n        Name of a unit that the input will be converted into. If None, no\n        unit-checking or conversion is performed\n    shape : tuple or None, optional\n        If given, specifies the shape the attribute must be\n    \"\"\"\n\n    def __init__(self, default=None, secondary_attribute='', unit=None,\n                 shape=None):\n\n        if default is None and unit is None:\n            raise ValueError('Either a default quantity value must be '\n                             'provided, or a unit must be provided to define a '\n                             'QuantityAttribute.')\n\n        if default is not None and unit is None:\n            unit = default.unit\n\n        self.unit = unit\n        self.shape = shape\n        default = self.convert_input(default)[0]\n        super().__init__(default, secondary_attribute)\n\n    def convert_input(self, value):\n        \"\"\"\n        Checks that the input is a Quantity with the necessary units (or the\n        special value ``0``).\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n\n        if value is None:\n            return None, False\n\n        if (not hasattr(value, 'unit') and self.unit != u.dimensionless_unscaled\n                and np.any(value != 0)):\n            raise TypeError('Tried to set a QuantityAttribute with '\n                            'something that does not have a unit.')\n\n        oldvalue = value\n        value = u.Quantity(oldvalue, self.unit, copy=False)\n        if self.shape is not None and value.shape != self.shape:\n            if value.shape == () and oldvalue == 0:\n                # Allow a single 0 to fill whatever shape is needed.\n                value = np.broadcast_to(value, self.shape, subok=True)\n            else:\n                raise ValueError(\n                    f'The provided value has shape \"{value.shape}\", but '\n                    f'should have shape \"{self.shape}\"')\n\n        converted = oldvalue is not value\n        return value, converted"},{"col":4,"comment":"null","endLoc":298,"header":"def __init__(self, default=None, secondary_attribute='', unit=None,\n                 shape=None)","id":15367,"name":"__init__","nodeType":"Function","startLoc":284,"text":"def __init__(self, default=None, secondary_attribute='', unit=None,\n                 shape=None):\n\n        if default is None and unit is None:\n            raise ValueError('Either a default quantity value must be '\n                             'provided, or a unit must be provided to define a '\n                             'QuantityAttribute.')\n\n        if default is not None and unit is None:\n            unit = default.unit\n\n        self.unit = unit\n        self.shape = shape\n        default = self.convert_input(default)[0]\n        super().__init__(default, secondary_attribute)"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":15368,"name":"RA_REGEX","nodeType":"Attribute","startLoc":13,"text":"RA_REGEX"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":15369,"name":"DEC_REGEX","nodeType":"Attribute","startLoc":14,"text":"DEC_REGEX"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":15370,"name":"JCOORD_REGEX","nodeType":"Attribute","startLoc":15,"text":"JCOORD_REGEX"},{"col":4,"comment":"\n        Converts spherical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        ","endLoc":2221,"header":"def to_cartesian(self)","id":15371,"name":"to_cartesian","nodeType":"Function","startLoc":2205,"text":"def to_cartesian(self):\n        \"\"\"\n        Converts spherical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        \"\"\"\n\n        # We need to convert Distance to Quantity to allow negative values.\n        if isinstance(self.r, Distance):\n            d = self.r.view(u.Quantity)\n        else:\n            d = self.r\n\n        x = d * np.sin(self.theta) * np.cos(self.phi)\n        y = d * np.sin(self.theta) * np.sin(self.phi)\n        z = d * np.cos(self.theta)\n\n        return CartesianRepresentation(x=x, y=y, z=z, copy=False)"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":15372,"name":"JPARSER","nodeType":"Attribute","startLoc":16,"text":"JPARSER"},{"col":0,"comment":"","endLoc":4,"header":"jparser.py#<anonymous>","id":15373,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nModule for parsing astronomical object names to extract embedded coordinates\neg: '2MASS J06495091-0737408'\n\"\"\"\n\nRA_REGEX = r'()([0-2]\\d)([0-5]\\d)([0-5]\\d)\\.?(\\d{0,3})'\n\nDEC_REGEX = r'([+-])(\\d{1,2})([0-5]\\d)([0-5]\\d)\\.?(\\d{0,3})'\n\nJCOORD_REGEX = '(.*?J)' + RA_REGEX + DEC_REGEX\n\nJPARSER = re.compile(JCOORD_REGEX)"},{"col":4,"comment":"\n        Checks that the input is a Quantity with the necessary units (or the\n        special value ``0``).\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        ","endLoc":342,"header":"def convert_input(self, value)","id":15374,"name":"convert_input","nodeType":"Function","startLoc":300,"text":"def convert_input(self, value):\n        \"\"\"\n        Checks that the input is a Quantity with the necessary units (or the\n        special value ``0``).\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n\n        if value is None:\n            return None, False\n\n        if (not hasattr(value, 'unit') and self.unit != u.dimensionless_unscaled\n                and np.any(value != 0)):\n            raise TypeError('Tried to set a QuantityAttribute with '\n                            'something that does not have a unit.')\n\n        oldvalue = value\n        value = u.Quantity(oldvalue, self.unit, copy=False)\n        if self.shape is not None and value.shape != self.shape:\n            if value.shape == () and oldvalue == 0:\n                # Allow a single 0 to fill whatever shape is needed.\n                value = np.broadcast_to(value, self.shape, subok=True)\n            else:\n                raise ValueError(\n                    f'The provided value has shape \"{value.shape}\", but '\n                    f'should have shape \"{self.shape}\"')\n\n        converted = oldvalue is not value\n        return value, converted"},{"attributeType":"null","col":4,"comment":"null","endLoc":105,"id":15375,"name":"_represent_as_dict_attrs","nodeType":"Attribute","startLoc":105,"text":"_represent_as_dict_attrs"},{"className":"BaseGeodeticRepresentation","col":0,"comment":"Base geodetic representation.","endLoc":914,"id":15376,"nodeType":"Class","startLoc":875,"text":"@format_doc(geodetic_base_doc)\nclass BaseGeodeticRepresentation(BaseRepresentation):\n    \"\"\"Base geodetic representation.\"\"\"\n\n    attr_classes = {'lon': Longitude,\n                    'lat': Latitude,\n                    'height': u.Quantity}\n\n    def __init_subclass__(cls, **kwargs):\n        super().__init_subclass__(**kwargs)\n        if '_ellipsoid' in cls.__dict__:\n            ELLIPSOIDS[cls._ellipsoid] = cls\n\n    def __init__(self, lon, lat=None, height=None, copy=True):\n        if height is None and not isinstance(lon, self.__class__):\n            height = 0 << u.m\n\n        super().__init__(lon, lat, height, copy=copy)\n        if not self.height.unit.is_equivalent(u.m):\n            raise u.UnitTypeError(f\"{self.__class__.__name__} requires \"\n                                  f\"height with units of length.\")\n\n    def to_cartesian(self):\n        \"\"\"\n        Converts WGS84 geodetic coordinates to 3D rectangular (geocentric)\n        cartesian coordinates.\n        \"\"\"\n        xyz = erfa.gd2gc(getattr(erfa, self._ellipsoid),\n                         self.lon, self.lat, self.height)\n        return CartesianRepresentation(xyz, xyz_axis=-1, copy=False)\n\n    @classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates (assumed geocentric) to\n        WGS84 geodetic coordinates.\n        \"\"\"\n        lon, lat, height = erfa.gc2gd(getattr(erfa, cls._ellipsoid),\n                                      cart.get_xyz(xyz_axis=-1))\n        return cls(lon, lat, height, copy=False)"},{"col":4,"comment":"null","endLoc":886,"header":"def __init_subclass__(cls, **kwargs)","id":15377,"name":"__init_subclass__","nodeType":"Function","startLoc":883,"text":"def __init_subclass__(cls, **kwargs):\n        super().__init_subclass__(**kwargs)\n        if '_ellipsoid' in cls.__dict__:\n            ELLIPSOIDS[cls._ellipsoid] = cls"},{"col":4,"comment":"null","endLoc":895,"header":"def __init__(self, lon, lat=None, height=None, copy=True)","id":15378,"name":"__init__","nodeType":"Function","startLoc":888,"text":"def __init__(self, lon, lat=None, height=None, copy=True):\n        if height is None and not isinstance(lon, self.__class__):\n            height = 0 << u.m\n\n        super().__init__(lon, lat, height, copy=copy)\n        if not self.height.unit.is_equivalent(u.m):\n            raise u.UnitTypeError(f\"{self.__class__.__name__} requires \"\n                                  f\"height with units of length.\")"},{"fileName":"sky_coordinate_parsers.py","filePath":"astropy/coordinates","id":15379,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport re\nfrom collections.abc import Sequence\nimport inspect\n\nimport numpy as np\n\nfrom astropy.units import Unit, IrreducibleUnit\nfrom astropy import units as u\n\nfrom .baseframe import (BaseCoordinateFrame, frame_transform_graph,\n                        _get_repr_cls, _get_diff_cls)\nfrom .builtin_frames import ICRS\nfrom .representation import (BaseRepresentation, SphericalRepresentation,\n                             UnitSphericalRepresentation)\n\n\"\"\"\nThis module contains utility functions to make the SkyCoord initializer more modular\nand maintainable. No functionality here should be in the public API, but rather used as\npart of creating SkyCoord objects.\n\"\"\"\n\nPLUS_MINUS_RE = re.compile(r'(\\+|\\-)')\nJ_PREFIXED_RA_DEC_RE = re.compile(\n    r\"\"\"J                              # J prefix\n    ([0-9]{6,7}\\.?[0-9]{0,2})          # RA as HHMMSS.ss or DDDMMSS.ss, optional decimal digits\n    ([\\+\\-][0-9]{6}\\.?[0-9]{0,2})\\s*$  # Dec as DDMMSS.ss, optional decimal digits\n    \"\"\", re.VERBOSE)\n\n\ndef _get_frame_class(frame):\n    \"\"\"\n    Get a frame class from the input `frame`, which could be a frame name\n    string, or frame class.\n    \"\"\"\n\n    if isinstance(frame, str):\n        frame_names = frame_transform_graph.get_names()\n        if frame not in frame_names:\n            raise ValueError('Coordinate frame name \"{}\" is not a known '\n                             'coordinate frame ({})'\n                             .format(frame, sorted(frame_names)))\n        frame_cls = frame_transform_graph.lookup_name(frame)\n\n    elif inspect.isclass(frame) and issubclass(frame, BaseCoordinateFrame):\n        frame_cls = frame\n\n    else:\n        raise ValueError(\"Coordinate frame must be a frame name or frame \"\n                         \"class, not a '{}'\".format(frame.__class__.__name__))\n\n    return frame_cls\n\n\n_conflict_err_msg = (\"Coordinate attribute '{0}'={1!r} conflicts with keyword \"\n                     \"argument '{0}'={2!r}. This usually means an attribute \"\n                     \"was set on one of the input objects and also in the \"\n                     \"keyword arguments to {3}\")\n\n\ndef _get_frame_without_data(args, kwargs):\n    \"\"\"\n    Determines the coordinate frame from input SkyCoord args and kwargs.\n\n    This function extracts (removes) all frame attributes from the kwargs and\n    determines the frame class either using the kwargs, or using the first\n    element in the args (if a single frame object is passed in, for example).\n    This function allows a frame to be specified as a string like 'icrs' or a\n    frame class like ICRS, or an instance ICRS(), as long as the instance frame\n    attributes don't conflict with kwargs passed in (which could require a\n    three-way merge with the coordinate data possibly specified via the args).\n    \"\"\"\n    from .sky_coordinate import SkyCoord\n\n    # We eventually (hopefully) fill and return these by extracting the frame\n    # and frame attributes from the input:\n    frame_cls = None\n    frame_cls_kwargs = {}\n\n    # The first place to check: the frame could be specified explicitly\n    frame = kwargs.pop('frame', None)\n\n    if frame is not None:\n        # Here the frame was explicitly passed in as a keyword argument.\n\n        # If the frame is an instance or SkyCoord, we extract the attributes\n        # and split the instance into the frame class and an attributes dict\n\n        if isinstance(frame, SkyCoord):\n            # If the frame was passed as a SkyCoord, we also want to preserve\n            # any extra attributes (e.g., obstime) if they are not already\n            # specified in the kwargs. We preserve these extra attributes by\n            # adding them to the kwargs dict:\n            for attr in frame._extra_frameattr_names:\n                if (attr in kwargs and\n                        np.any(getattr(frame, attr) != kwargs[attr])):\n                    # This SkyCoord attribute passed in with the frame= object\n                    # conflicts with an attribute passed in directly to the\n                    # SkyCoord initializer as a kwarg:\n                    raise ValueError(_conflict_err_msg\n                                     .format(attr, getattr(frame, attr),\n                                             kwargs[attr], 'SkyCoord'))\n                else:\n                    kwargs[attr] = getattr(frame, attr)\n            frame = frame.frame\n\n        if isinstance(frame, BaseCoordinateFrame):\n            # Extract any frame attributes\n            for attr in frame.get_frame_attr_names():\n                # If the frame was specified as an instance, we have to make\n                # sure that no frame attributes were specified as kwargs - this\n                # would require a potential three-way merge:\n                if attr in kwargs:\n                    raise ValueError(\"Cannot specify frame attribute '{}' \"\n                                     \"directly as an argument to SkyCoord \"\n                                     \"because a frame instance was passed in. \"\n                                     \"Either pass a frame class, or modify the \"\n                                     \"frame attributes of the input frame \"\n                                     \"instance.\".format(attr))\n                elif not frame.is_frame_attr_default(attr):\n                    kwargs[attr] = getattr(frame, attr)\n\n            frame_cls = frame.__class__\n\n            # Make sure we propagate representation/differential _type choices,\n            # unless these are specified directly in the kwargs:\n            kwargs.setdefault('representation_type', frame.representation_type)\n            kwargs.setdefault('differential_type', frame.differential_type)\n\n        if frame_cls is None:  # frame probably a string\n            frame_cls = _get_frame_class(frame)\n\n    # Check that the new frame doesn't conflict with existing coordinate frame\n    # if a coordinate is supplied in the args list.  If the frame still had not\n    # been set by this point and a coordinate was supplied, then use that frame.\n    for arg in args:\n        # this catches the \"single list passed in\" case.  For that case we want\n        # to allow the first argument to set the class.  That's OK because\n        # _parse_coordinate_arg goes and checks that the frames match between\n        # the first and all the others\n        if (isinstance(arg, (Sequence, np.ndarray)) and\n                len(args) == 1 and len(arg) > 0):\n            arg = arg[0]\n\n        coord_frame_obj = coord_frame_cls = None\n        if isinstance(arg, BaseCoordinateFrame):\n            coord_frame_obj = arg\n        elif isinstance(arg, SkyCoord):\n            coord_frame_obj = arg.frame\n        if coord_frame_obj is not None:\n            coord_frame_cls = coord_frame_obj.__class__\n            frame_diff = coord_frame_obj.get_representation_cls('s')\n            if frame_diff is not None:\n                # we do this check because otherwise if there's no default\n                # differential (i.e. it is None), the code below chokes. but\n                # None still gets through if the user *requests* it\n                kwargs.setdefault('differential_type', frame_diff)\n\n            for attr in coord_frame_obj.get_frame_attr_names():\n                if (attr in kwargs and\n                        not coord_frame_obj.is_frame_attr_default(attr) and\n                        np.any(kwargs[attr] != getattr(coord_frame_obj, attr))):\n                    raise ValueError(\"Frame attribute '{}' has conflicting \"\n                                     \"values between the input coordinate data \"\n                                     \"and either keyword arguments or the \"\n                                     \"frame specification (frame=...): \"\n                                     \"{} =/= {}\"\n                                     .format(attr,\n                                             getattr(coord_frame_obj, attr),\n                                             kwargs[attr]))\n\n                elif (attr not in kwargs and\n                        not coord_frame_obj.is_frame_attr_default(attr)):\n                    kwargs[attr] = getattr(coord_frame_obj, attr)\n\n        if coord_frame_cls is not None:\n            if frame_cls is None:\n                frame_cls = coord_frame_cls\n            elif frame_cls is not coord_frame_cls:\n                raise ValueError(\"Cannot override frame='{}' of input \"\n                                 \"coordinate with new frame='{}'. Instead, \"\n                                 \"transform the coordinate.\"\n                                 .format(coord_frame_cls.__name__,\n                                         frame_cls.__name__))\n\n    if frame_cls is None:\n        frame_cls = ICRS\n\n    # By now, frame_cls should be set - if it's not, something went wrong\n    if not issubclass(frame_cls, BaseCoordinateFrame):\n        # We should hopefully never get here...\n        raise ValueError(f'Frame class has unexpected type: {frame_cls.__name__}')\n\n    for attr in frame_cls.frame_attributes:\n        if attr in kwargs:\n            frame_cls_kwargs[attr] = kwargs.pop(attr)\n\n    if 'representation_type' in kwargs:\n        frame_cls_kwargs['representation_type'] = _get_repr_cls(\n            kwargs.pop('representation_type'))\n\n    differential_type = kwargs.pop('differential_type', None)\n    if differential_type is not None:\n        frame_cls_kwargs['differential_type'] = _get_diff_cls(\n            differential_type)\n\n    return frame_cls, frame_cls_kwargs\n\n\ndef _parse_coordinate_data(frame, args, kwargs):\n    \"\"\"\n    Extract coordinate data from the args and kwargs passed to SkyCoord.\n\n    By this point, we assume that all of the frame attributes have been\n    extracted from kwargs (see _get_frame_without_data()), so all that are left\n    are (1) extra SkyCoord attributes, and (2) the coordinate data, specified in\n    any of the valid ways.\n    \"\"\"\n    valid_skycoord_kwargs = {}\n    valid_components = {}\n    info = None\n\n    # Look through the remaining kwargs to see if any are valid attribute names\n    # by asking the frame transform graph:\n    attr_names = list(kwargs.keys())\n    for attr in attr_names:\n        if attr in frame_transform_graph.frame_attributes:\n            valid_skycoord_kwargs[attr] = kwargs.pop(attr)\n\n    # By this point in parsing the arguments, anything left in the args and\n    # kwargs should be data. Either as individual components, or a list of\n    # objects, or a representation, etc.\n\n    # Get units of components\n    units = _get_representation_component_units(args, kwargs)\n\n    # Grab any frame-specific attr names like `ra` or `l` or `distance` from\n    # kwargs and move them to valid_components.\n    valid_components.update(_get_representation_attrs(frame, units, kwargs))\n\n    # Error if anything is still left in kwargs\n    if kwargs:\n        # The next few lines add a more user-friendly error message to a\n        # common and confusing situation when the user specifies, e.g.,\n        # `pm_ra` when they really should be passing `pm_ra_cosdec`. The\n        # extra error should only turn on when the positional representation\n        # is spherical, and when the component 'pm_<lon>' is passed.\n        pm_message = ''\n        if frame.representation_type == SphericalRepresentation:\n            frame_names = list(frame.get_representation_component_names().keys())\n            lon_name = frame_names[0]\n            lat_name = frame_names[1]\n\n            if f'pm_{lon_name}' in list(kwargs.keys()):\n                pm_message = ('\\n\\n By default, most frame classes expect '\n                              'the longitudinal proper motion to include '\n                              'the cos(latitude) term, named '\n                              '`pm_{}_cos{}`. Did you mean to pass in '\n                              'this component?'\n                              .format(lon_name, lat_name))\n\n        raise ValueError('Unrecognized keyword argument(s) {}{}'\n                         .format(', '.join(f\"'{key}'\"\n                                           for key in kwargs),\n                                 pm_message))\n\n    # Finally deal with the unnamed args.  This figures out what the arg[0]\n    # is and returns a dict with appropriate key/values for initializing\n    # frame class. Note that differentials are *never* valid args, only\n    # kwargs.  So they are not accounted for here (unless they're in a frame\n    # or SkyCoord object)\n    if args:\n        if len(args) == 1:\n            # One arg which must be a coordinate.  In this case coord_kwargs\n            # will contain keys like 'ra', 'dec', 'distance' along with any\n            # frame attributes like equinox or obstime which were explicitly\n            # specified in the coordinate object (i.e. non-default).\n            _skycoord_kwargs, _components = _parse_coordinate_arg(\n                args[0], frame, units, kwargs)\n\n            # Copy other 'info' attr only if it has actually been defined.\n            if 'info' in getattr(args[0], '__dict__', ()):\n                info = args[0].info\n\n        elif len(args) <= 3:\n            _skycoord_kwargs = {}\n            _components = {}\n\n            frame_attr_names = frame.representation_component_names.keys()\n            repr_attr_names = frame.representation_component_names.values()\n\n            for arg, frame_attr_name, repr_attr_name, unit in zip(args, frame_attr_names,\n                                                                  repr_attr_names, units):\n                attr_class = frame.representation_type.attr_classes[repr_attr_name]\n                _components[frame_attr_name] = attr_class(arg, unit=unit)\n\n        else:\n            raise ValueError('Must supply no more than three positional arguments, got {}'\n                             .format(len(args)))\n\n        # The next two loops copy the component and skycoord attribute data into\n        # their final, respective \"valid_\" dictionaries. For each, we check that\n        # there are no relevant conflicts with values specified by the user\n        # through other means:\n\n        # First validate the component data\n        for attr, coord_value in _components.items():\n            if attr in valid_components:\n                raise ValueError(_conflict_err_msg\n                                 .format(attr, coord_value,\n                                         valid_components[attr], 'SkyCoord'))\n            valid_components[attr] = coord_value\n\n        # Now validate the custom SkyCoord attributes\n        for attr, value in _skycoord_kwargs.items():\n            if (attr in valid_skycoord_kwargs and\n                    np.any(valid_skycoord_kwargs[attr] != value)):\n                raise ValueError(_conflict_err_msg\n                                 .format(attr, value,\n                                         valid_skycoord_kwargs[attr],\n                                         'SkyCoord'))\n            valid_skycoord_kwargs[attr] = value\n\n    return valid_skycoord_kwargs, valid_components, info\n\n\ndef _get_representation_component_units(args, kwargs):\n    \"\"\"\n    Get the unit from kwargs for the *representation* components (not the\n    differentials).\n    \"\"\"\n    if 'unit' not in kwargs:\n        units = [None, None, None]\n\n    else:\n        units = kwargs.pop('unit')\n\n        if isinstance(units, str):\n            units = [x.strip() for x in units.split(',')]\n            # Allow for input like unit='deg' or unit='m'\n            if len(units) == 1:\n                units = [units[0], units[0], units[0]]\n        elif isinstance(units, (Unit, IrreducibleUnit)):\n            units = [units, units, units]\n\n        try:\n            units = [(Unit(x) if x else None) for x in units]\n            units.extend(None for x in range(3 - len(units)))\n            if len(units) > 3:\n                raise ValueError()\n        except Exception as err:\n            raise ValueError('Unit keyword must have one to three unit values as '\n                             'tuple or comma-separated string.') from err\n\n    return units\n\n\ndef _parse_coordinate_arg(coords, frame, units, init_kwargs):\n    \"\"\"\n    Single unnamed arg supplied.  This must be:\n    - Coordinate frame with data\n    - Representation\n    - SkyCoord\n    - List or tuple of:\n      - String which splits into two values\n      - Iterable with two values\n      - SkyCoord, frame, or representation objects.\n\n    Returns a dict mapping coordinate attribute names to values (or lists of\n    values)\n    \"\"\"\n    from .sky_coordinate import SkyCoord\n\n    is_scalar = False  # Differentiate between scalar and list input\n    # valid_kwargs = {}  # Returned dict of lon, lat, and distance (optional)\n    components = {}\n    skycoord_kwargs = {}\n\n    frame_attr_names = list(frame.representation_component_names.keys())\n    repr_attr_names = list(frame.representation_component_names.values())\n    repr_attr_classes = list(frame.representation_type.attr_classes.values())\n    n_attr_names = len(repr_attr_names)\n\n    # Turn a single string into a list of strings for convenience\n    if isinstance(coords, str):\n        is_scalar = True\n        coords = [coords]\n\n    if isinstance(coords, (SkyCoord, BaseCoordinateFrame)):\n        # Note that during parsing of `frame` it is checked that any coordinate\n        # args have the same frame as explicitly supplied, so don't worry here.\n\n        if not coords.has_data:\n            raise ValueError('Cannot initialize from a frame without coordinate data')\n\n        data = coords.data.represent_as(frame.representation_type)\n\n        values = []  # List of values corresponding to representation attrs\n        repr_attr_name_to_drop = []\n        for repr_attr_name in repr_attr_names:\n            # If coords did not have an explicit distance then don't include in initializers.\n            if (isinstance(coords.data, UnitSphericalRepresentation) and\n                    repr_attr_name == 'distance'):\n                repr_attr_name_to_drop.append(repr_attr_name)\n                continue\n\n            # Get the value from `data` in the eventual representation\n            values.append(getattr(data, repr_attr_name))\n\n        # drop the ones that were skipped because they were distances\n        for nametodrop in repr_attr_name_to_drop:\n            nameidx = repr_attr_names.index(nametodrop)\n            del repr_attr_names[nameidx]\n            del units[nameidx]\n            del frame_attr_names[nameidx]\n            del repr_attr_classes[nameidx]\n\n        if coords.data.differentials and 's' in coords.data.differentials:\n            orig_vel = coords.data.differentials['s']\n            vel = coords.data.represent_as(frame.representation_type, frame.get_representation_cls('s')).differentials['s']\n            for frname, reprname in frame.get_representation_component_names('s').items():\n                if (reprname == 'd_distance' and\n                        not hasattr(orig_vel, reprname) and\n                        'unit' in orig_vel.get_name()):\n                    continue\n                values.append(getattr(vel, reprname))\n                units.append(None)\n                frame_attr_names.append(frname)\n                repr_attr_names.append(reprname)\n                repr_attr_classes.append(vel.attr_classes[reprname])\n\n        for attr in frame_transform_graph.frame_attributes:\n            value = getattr(coords, attr, None)\n            use_value = (isinstance(coords, SkyCoord) or\n                         attr not in coords.get_frame_attr_names())\n            if use_value and value is not None:\n                skycoord_kwargs[attr] = value\n\n    elif isinstance(coords, BaseRepresentation):\n        if coords.differentials and 's' in coords.differentials:\n            diffs = frame.get_representation_cls('s')\n            data = coords.represent_as(frame.representation_type, diffs)\n            values = [getattr(data, repr_attr_name) for repr_attr_name in repr_attr_names]\n            for frname, reprname in frame.get_representation_component_names('s').items():\n                values.append(getattr(data.differentials['s'], reprname))\n                units.append(None)\n                frame_attr_names.append(frname)\n                repr_attr_names.append(reprname)\n                repr_attr_classes.append(data.differentials['s'].attr_classes[reprname])\n\n        else:\n            data = coords.represent_as(frame.representation_type)\n            values = [getattr(data, repr_attr_name) for repr_attr_name in repr_attr_names]\n\n    elif (isinstance(coords, np.ndarray) and coords.dtype.kind in 'if' and\n          coords.ndim == 2 and coords.shape[1] <= 3):\n        # 2-d array of coordinate values.  Handle specially for efficiency.\n        values = coords.transpose()  # Iterates over repr attrs\n\n    elif isinstance(coords, (Sequence, np.ndarray)):\n        # Handles list-like input.\n\n        vals = []\n        is_ra_dec_representation = ('ra' in frame.representation_component_names and\n                                    'dec' in frame.representation_component_names)\n        coord_types = (SkyCoord, BaseCoordinateFrame, BaseRepresentation)\n        if any(isinstance(coord, coord_types) for coord in coords):\n            # this parsing path is used when there are coordinate-like objects\n            # in the list - instead of creating lists of values, we create\n            # SkyCoords from the list elements and then combine them.\n            scs = [SkyCoord(coord, **init_kwargs) for coord in coords]\n\n            # Check that all frames are equivalent\n            for sc in scs[1:]:\n                if not sc.is_equivalent_frame(scs[0]):\n                    raise ValueError(\"List of inputs don't have equivalent \"\n                                     \"frames: {} != {}\".format(sc, scs[0]))\n\n            # Now use the first to determine if they are all UnitSpherical\n            allunitsphrepr = isinstance(scs[0].data, UnitSphericalRepresentation)\n\n            # get the frame attributes from the first coord in the list, because\n            # from the above we know it matches all the others.  First copy over\n            # the attributes that are in the frame itself, then copy over any\n            # extras in the SkyCoord\n            for fattrnm in scs[0].frame.frame_attributes:\n                skycoord_kwargs[fattrnm] = getattr(scs[0].frame, fattrnm)\n            for fattrnm in scs[0]._extra_frameattr_names:\n                skycoord_kwargs[fattrnm] = getattr(scs[0], fattrnm)\n\n            # Now combine the values, to be used below\n            values = []\n            for data_attr_name, repr_attr_name in zip(frame_attr_names, repr_attr_names):\n                if allunitsphrepr and repr_attr_name == 'distance':\n                    # if they are *all* UnitSpherical, don't give a distance\n                    continue\n                data_vals = []\n                for sc in scs:\n                    data_val = getattr(sc, data_attr_name)\n                    data_vals.append(data_val.reshape(1,) if sc.isscalar else data_val)\n                concat_vals = np.concatenate(data_vals)\n                # Hack because np.concatenate doesn't fully work with Quantity\n                if isinstance(concat_vals, u.Quantity):\n                    concat_vals._unit = data_val.unit\n                values.append(concat_vals)\n        else:\n            # none of the elements are \"frame-like\"\n            # turn into a list of lists like [[v1_0, v2_0, v3_0], ... [v1_N, v2_N, v3_N]]\n            for coord in coords:\n                if isinstance(coord, str):\n                    coord1 = coord.split()\n                    if len(coord1) == 6:\n                        coord = (' '.join(coord1[:3]), ' '.join(coord1[3:]))\n                    elif is_ra_dec_representation:\n                        coord = _parse_ra_dec(coord)\n                    else:\n                        coord = coord1\n                vals.append(coord)  # Assumes coord is a sequence at this point\n\n            # Do some basic validation of the list elements: all have a length and all\n            # lengths the same\n            try:\n                n_coords = sorted(set(len(x) for x in vals))\n            except Exception as err:\n                raise ValueError('One or more elements of input sequence '\n                                 'does not have a length.') from err\n\n            if len(n_coords) > 1:\n                raise ValueError('Input coordinate values must have '\n                                 'same number of elements, found {}'.format(n_coords))\n            n_coords = n_coords[0]\n\n            # Must have no more coord inputs than representation attributes\n            if n_coords > n_attr_names:\n                raise ValueError('Input coordinates have {} values but '\n                                 'representation {} only accepts {}'\n                                 .format(n_coords,\n                                         frame.representation_type.get_name(),\n                                         n_attr_names))\n\n            # Now transpose vals to get [(v1_0 .. v1_N), (v2_0 .. v2_N), (v3_0 .. v3_N)]\n            # (ok since we know it is exactly rectangular).  (Note: can't just use zip(*values)\n            # because Longitude et al distinguishes list from tuple so [a1, a2, ..] is needed\n            # while (a1, a2, ..) doesn't work.\n            values = [list(x) for x in zip(*vals)]\n\n            if is_scalar:\n                values = [x[0] for x in values]\n    else:\n        raise ValueError('Cannot parse coordinates from first argument')\n\n    # Finally we have a list of values from which to create the keyword args\n    # for the frame initialization.  Validate by running through the appropriate\n    # class initializer and supply units (which might be None).\n    try:\n        for frame_attr_name, repr_attr_class, value, unit in zip(\n                frame_attr_names, repr_attr_classes, values, units):\n            components[frame_attr_name] = repr_attr_class(value, unit=unit,\n                                                          copy=False)\n    except Exception as err:\n        raise ValueError('Cannot parse first argument data \"{}\" for attribute '\n                         '{}'.format(value, frame_attr_name)) from err\n    return skycoord_kwargs, components\n\n\ndef _get_representation_attrs(frame, units, kwargs):\n    \"\"\"\n    Find instances of the \"representation attributes\" for specifying data\n    for this frame.  Pop them off of kwargs, run through the appropriate class\n    constructor (to validate and apply unit), and put into the output\n    valid_kwargs.  \"Representation attributes\" are the frame-specific aliases\n    for the underlying data values in the representation, e.g. \"ra\" for \"lon\"\n    for many equatorial spherical representations, or \"w\" for \"x\" in the\n    cartesian representation of Galactic.\n\n    This also gets any *differential* kwargs, because they go into the same\n    frame initializer later on.\n    \"\"\"\n    frame_attr_names = frame.representation_component_names.keys()\n    repr_attr_classes = frame.representation_type.attr_classes.values()\n\n    valid_kwargs = {}\n    for frame_attr_name, repr_attr_class, unit in zip(frame_attr_names, repr_attr_classes, units):\n        value = kwargs.pop(frame_attr_name, None)\n        if value is not None:\n            try:\n                valid_kwargs[frame_attr_name] = repr_attr_class(value, unit=unit)\n            except u.UnitConversionError as err:\n                error_message = (\n                    f\"Unit '{unit}' ({unit.physical_type}) could not be applied to '{frame_attr_name}'. \"\n                    \"This can occur when passing units for some coordinate components \"\n                    \"when other components are specified as Quantity objects. \"\n                    \"Either pass a list of units for all components (and unit-less coordinate data), \"\n                    \"or pass Quantities for all components.\"\n                )\n                raise u.UnitConversionError(error_message) from err\n\n    # also check the differentials.  They aren't included in the units keyword,\n    # so we only look for the names.\n\n    differential_type = frame.differential_type\n    if differential_type is not None:\n        for frame_name, repr_name in frame.get_representation_component_names('s').items():\n            diff_attr_class = differential_type.attr_classes[repr_name]\n            value = kwargs.pop(frame_name, None)\n            if value is not None:\n                valid_kwargs[frame_name] = diff_attr_class(value)\n\n    return valid_kwargs\n\n\ndef _parse_ra_dec(coord_str):\n    \"\"\"\n    Parse RA and Dec values from a coordinate string. Currently the\n    following formats are supported:\n\n     * space separated 6-value format\n     * space separated <6-value format, this requires a plus or minus sign\n       separation between RA and Dec\n     * sign separated format\n     * JHHMMSS.ss+DDMMSS.ss format, with up to two optional decimal digits\n     * JDDDMMSS.ss+DDMMSS.ss format, with up to two optional decimal digits\n\n    Parameters\n    ----------\n    coord_str : str\n        Coordinate string to parse.\n\n    Returns\n    -------\n    coord : str or list of str\n        Parsed coordinate values.\n    \"\"\"\n\n    if isinstance(coord_str, str):\n        coord1 = coord_str.split()\n    else:\n        # This exception should never be raised from SkyCoord\n        raise TypeError('coord_str must be a single str')\n\n    if len(coord1) == 6:\n        coord = (' '.join(coord1[:3]), ' '.join(coord1[3:]))\n    elif len(coord1) > 2:\n        coord = PLUS_MINUS_RE.split(coord_str)\n        coord = (coord[0], ' '.join(coord[1:]))\n    elif len(coord1) == 1:\n        match_j = J_PREFIXED_RA_DEC_RE.match(coord_str)\n        if match_j:\n            coord = match_j.groups()\n            if len(coord[0].split('.')[0]) == 7:\n                coord = (f'{coord[0][0:3]} {coord[0][3:5]} {coord[0][5:]}',\n                         f'{coord[1][0:3]} {coord[1][3:5]} {coord[1][5:]}')\n            else:\n                coord = (f'{coord[0][0:2]} {coord[0][2:4]} {coord[0][4:]}',\n                         f'{coord[1][0:3]} {coord[1][3:5]} {coord[1][5:]}')\n        else:\n            coord = PLUS_MINUS_RE.split(coord_str)\n            coord = (coord[0], ' '.join(coord[1:]))\n    else:\n        coord = coord1\n\n    return coord\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":15380,"name":"PLUS_MINUS_RE","nodeType":"Attribute","startLoc":24,"text":"PLUS_MINUS_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":15381,"name":"J_PREFIXED_RA_DEC_RE","nodeType":"Attribute","startLoc":25,"text":"J_PREFIXED_RA_DEC_RE"},{"col":4,"comment":"\n        Converts 3D rectangular cartesian coordinates to spherical polar\n        coordinates.\n        ","endLoc":2236,"header":"@classmethod\n    def from_cartesian(cls, cart)","id":15382,"name":"from_cartesian","nodeType":"Function","startLoc":2223,"text":"@classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates to spherical polar\n        coordinates.\n        \"\"\"\n\n        s = np.hypot(cart.x, cart.y)\n        r = np.hypot(s, cart.z)\n\n        phi = np.arctan2(cart.y, cart.x)\n        theta = np.arctan2(s, cart.z)\n\n        return cls(phi=phi, theta=theta, r=r, copy=False)"},{"attributeType":"null","col":0,"comment":"null","endLoc":56,"id":15383,"name":"_conflict_err_msg","nodeType":"Attribute","startLoc":56,"text":"_conflict_err_msg"},{"col":0,"comment":"","endLoc":3,"header":"sky_coordinate_parsers.py#<anonymous>","id":15384,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module contains utility functions to make the SkyCoord initializer more modular\nand maintainable. No functionality here should be in the public API, but rather used as\npart of creating SkyCoord objects.\n\"\"\"\n\nPLUS_MINUS_RE = re.compile(r'(\\+|\\-)')\n\nJ_PREFIXED_RA_DEC_RE = re.compile(\n    r\"\"\"J                              # J prefix\n    ([0-9]{6,7}\\.?[0-9]{0,2})          # RA as HHMMSS.ss or DDDMMSS.ss, optional decimal digits\n    ([\\+\\-][0-9]{6}\\.?[0-9]{0,2})\\s*$  # Dec as DDMMSS.ss, optional decimal digits\n    \"\"\", re.VERBOSE)\n\n_conflict_err_msg = (\"Coordinate attribute '{0}'={1!r} conflicts with keyword \"\n                     \"argument '{0}'={2!r}. This usually means an attribute \"\n                     \"was set on one of the input objects and also in the \"\n                     \"keyword arguments to {3}\")"},{"fileName":"angles.py","filePath":"astropy/coordinates","id":15385,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module contains the fundamental classes used for representing\ncoordinates in astropy.\n\"\"\"\n\nimport warnings\nfrom collections import namedtuple\n\nimport numpy as np\n\nfrom . import angle_formats as form\nfrom astropy import units as u\nfrom astropy.utils import isiterable\n\n__all__ = ['Angle', 'Latitude', 'Longitude']\n\n\n# these are used by the `hms` and `dms` attributes\nhms_tuple = namedtuple('hms_tuple', ('h', 'm', 's'))\ndms_tuple = namedtuple('dms_tuple', ('d', 'm', 's'))\nsigned_dms_tuple = namedtuple('signed_dms_tuple', ('sign', 'd', 'm', 's'))\n\n\nclass Angle(u.SpecificTypeQuantity):\n    \"\"\"\n    One or more angular value(s) with units equivalent to radians or degrees.\n\n    An angle can be specified either as an array, scalar, tuple (see\n    below), string, `~astropy.units.Quantity` or another\n    :class:`~astropy.coordinates.Angle`.\n\n    The input parser is flexible and supports a variety of formats.\n    The examples below illustrate common ways of initializing an `Angle`\n    object. First some imports::\n\n      >>> from astropy.coordinates import Angle\n      >>> from astropy import units as u\n\n    The angle values can now be provided::\n\n      >>> Angle('10.2345d')\n      <Angle 10.2345 deg>\n      >>> Angle(['10.2345d', '-20d'])\n      <Angle [ 10.2345, -20.    ] deg>\n      >>> Angle('1:2:30.43 degrees')\n      <Angle 1.04178611 deg>\n      >>> Angle('1 2 0 hours')\n      <Angle 1.03333333 hourangle>\n      >>> Angle(np.arange(1, 8), unit=u.deg)\n      <Angle [1., 2., 3., 4., 5., 6., 7.] deg>\n      >>> Angle('1°2′3″')\n      <Angle 1.03416667 deg>\n      >>> Angle('1°2′3″N')\n      <Angle 1.03416667 deg>\n      >>> Angle('1d2m3.4s')\n      <Angle 1.03427778 deg>\n      >>> Angle('1d2m3.4sS')\n      <Angle -1.03427778 deg>\n      >>> Angle('-1h2m3s')\n      <Angle -1.03416667 hourangle>\n      >>> Angle('-1h2m3sE')\n      <Angle -1.03416667 hourangle>\n      >>> Angle('-1h2.5m')\n      <Angle -1.04166667 hourangle>\n      >>> Angle('-1h2.5mW')\n      <Angle 1.04166667 hourangle>\n      >>> Angle('-1:2.5', unit=u.deg)\n      <Angle -1.04166667 deg>\n      >>> Angle((10, 11, 12), unit='hourangle')  # (h, m, s)\n      <Angle 10.18666667 hourangle>\n      >>> Angle((-1, 2, 3), unit=u.deg)  # (d, m, s)\n      <Angle -1.03416667 deg>\n      >>> Angle(10.2345 * u.deg)\n      <Angle 10.2345 deg>\n      >>> Angle(Angle(10.2345 * u.deg))\n      <Angle 10.2345 deg>\n\n    Parameters\n    ----------\n    angle : `~numpy.array`, scalar, `~astropy.units.Quantity`, :class:`~astropy.coordinates.Angle`\n        The angle value. If a tuple, will be interpreted as ``(h, m,\n        s)`` or ``(d, m, s)`` depending on ``unit``. If a string, it\n        will be interpreted following the rules described above.\n\n        If ``angle`` is a sequence or array of strings, the resulting\n        values will be in the given ``unit``, or if `None` is provided,\n        the unit will be taken from the first given value.\n\n    unit : unit-like, optional\n        The unit of the value specified for the angle.  This may be\n        any string that `~astropy.units.Unit` understands, but it is\n        better to give an actual unit object.  Must be an angular\n        unit.\n\n    dtype : `~numpy.dtype`, optional\n        See `~astropy.units.Quantity`.\n\n    copy : bool, optional\n        See `~astropy.units.Quantity`.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If a unit is not provided or it is not an angular unit.\n    \"\"\"\n    _equivalent_unit = u.radian\n    _include_easy_conversion_members = True\n\n    def __new__(cls, angle, unit=None, dtype=None, copy=True, **kwargs):\n\n        if not isinstance(angle, u.Quantity):\n            if unit is not None:\n                unit = cls._convert_unit_to_angle_unit(u.Unit(unit))\n\n            if isinstance(angle, tuple):\n                angle = cls._tuple_to_float(angle, unit)\n\n            elif isinstance(angle, str):\n                angle, angle_unit = form.parse_angle(angle, unit)\n                if angle_unit is None:\n                    angle_unit = unit\n\n                if isinstance(angle, tuple):\n                    angle = cls._tuple_to_float(angle, angle_unit)\n\n                if angle_unit is not unit:\n                    # Possible conversion to `unit` will be done below.\n                    angle = u.Quantity(angle, angle_unit, copy=False)\n\n            elif (isiterable(angle) and\n                  not (isinstance(angle, np.ndarray) and\n                       angle.dtype.kind not in 'SUVO')):\n                angle = [Angle(x, unit, copy=False) for x in angle]\n\n        return super().__new__(cls, angle, unit, dtype=dtype, copy=copy,\n                               **kwargs)\n\n    @staticmethod\n    def _tuple_to_float(angle, unit):\n        \"\"\"\n        Converts an angle represented as a 3-tuple or 2-tuple into a floating\n        point number in the given unit.\n        \"\"\"\n        # TODO: Numpy array of tuples?\n        if unit == u.hourangle:\n            return form.hms_to_hours(*angle)\n        elif unit == u.degree:\n            return form.dms_to_degrees(*angle)\n        else:\n            raise u.UnitsError(f\"Can not parse '{angle}' as unit '{unit}'\")\n\n    @staticmethod\n    def _convert_unit_to_angle_unit(unit):\n        return u.hourangle if unit is u.hour else unit\n\n    def _set_unit(self, unit):\n        super()._set_unit(self._convert_unit_to_angle_unit(unit))\n\n    @property\n    def hour(self):\n        \"\"\"\n        The angle's value in hours (read-only property).\n        \"\"\"\n        return self.hourangle\n\n    @property\n    def hms(self):\n        \"\"\"\n        The angle's value in hours, as a named tuple with ``(h, m, s)``\n        members.  (This is a read-only property.)\n        \"\"\"\n        return hms_tuple(*form.hours_to_hms(self.hourangle))\n\n    @property\n    def dms(self):\n        \"\"\"\n        The angle's value in degrees, as a named tuple with ``(d, m, s)``\n        members.  (This is a read-only property.)\n        \"\"\"\n        return dms_tuple(*form.degrees_to_dms(self.degree))\n\n    @property\n    def signed_dms(self):\n        \"\"\"\n        The angle's value in degrees, as a named tuple with ``(sign, d, m, s)``\n        members.  The ``d``, ``m``, ``s`` are thus always positive, and the sign of\n        the angle is given by ``sign``. (This is a read-only property.)\n\n        This is primarily intended for use with `dms` to generate string\n        representations of coordinates that are correct for negative angles.\n        \"\"\"\n        return signed_dms_tuple(np.sign(self.degree),\n                                *form.degrees_to_dms(np.abs(self.degree)))\n\n    def to_string(self, unit=None, decimal=False, sep='fromunit',\n                  precision=None, alwayssign=False, pad=False,\n                  fields=3, format=None):\n        \"\"\" A string representation of the angle.\n\n        Parameters\n        ----------\n        unit : `~astropy.units.UnitBase`, optional\n            Specifies the unit.  Must be an angular unit.  If not\n            provided, the unit used to initialize the angle will be\n            used.\n\n        decimal : bool, optional\n            If `True`, a decimal representation will be used, otherwise\n            the returned string will be in sexagesimal form.\n\n        sep : str, optional\n            The separator between numbers in a sexagesimal\n            representation.  E.g., if it is ':', the result is\n            ``'12:41:11.1241'``. Also accepts 2 or 3 separators. E.g.,\n            ``sep='hms'`` would give the result ``'12h41m11.1241s'``, or\n            sep='-:' would yield ``'11-21:17.124'``.  Alternatively, the\n            special string 'fromunit' means 'dms' if the unit is\n            degrees, or 'hms' if the unit is hours.\n\n        precision : int, optional\n            The level of decimal precision.  If ``decimal`` is `True`,\n            this is the raw precision, otherwise it gives the\n            precision of the last place of the sexagesimal\n            representation (seconds).  If `None`, or not provided, the\n            number of decimal places is determined by the value, and\n            will be between 0-8 decimal places as required.\n\n        alwayssign : bool, optional\n            If `True`, include the sign no matter what.  If `False`,\n            only include the sign if it is negative.\n\n        pad : bool, optional\n            If `True`, include leading zeros when needed to ensure a\n            fixed number of characters for sexagesimal representation.\n\n        fields : int, optional\n            Specifies the number of fields to display when outputting\n            sexagesimal notation.  For example:\n\n                - fields == 1: ``'5d'``\n                - fields == 2: ``'5d45m'``\n                - fields == 3: ``'5d45m32.5s'``\n\n            By default, all fields are displayed.\n\n        format : str, optional\n            The format of the result.  If not provided, an unadorned\n            string is returned.  Supported values are:\n\n            - 'latex': Return a LaTeX-formatted string\n\n            - 'unicode': Return a string containing non-ASCII unicode\n              characters, such as the degree symbol\n\n        Returns\n        -------\n        strrepr : str or array\n            A string representation of the angle. If the angle is an array, this\n            will be an array with a unicode dtype.\n\n\n        \"\"\"\n        if unit is None:\n            unit = self.unit\n        else:\n            unit = self._convert_unit_to_angle_unit(u.Unit(unit))\n\n        separators = {\n            None: {\n                u.degree: 'dms',\n                u.hourangle: 'hms'},\n            'latex': {\n                u.degree: [r'^\\circ', r'{}^\\prime', r'{}^{\\prime\\prime}'],\n                u.hourangle: [r'^{\\mathrm{h}}', r'^{\\mathrm{m}}', r'^{\\mathrm{s}}']},\n            'unicode': {\n                u.degree: '°′″',\n                u.hourangle: 'ʰᵐˢ'}\n        }\n\n        if sep == 'fromunit':\n            if format not in separators:\n                raise ValueError(f\"Unknown format '{format}'\")\n            seps = separators[format]\n            if unit in seps:\n                sep = seps[unit]\n\n        # Create an iterator so we can format each element of what\n        # might be an array.\n        if unit is u.degree:\n            if decimal:\n                values = self.degree\n                if precision is not None:\n                    func = (\"{0:0.\" + str(precision) + \"f}\").format\n                else:\n                    func = '{:g}'.format\n            else:\n                if sep == 'fromunit':\n                    sep = 'dms'\n                values = self.degree\n                func = lambda x: form.degrees_to_string(\n                    x, precision=precision, sep=sep, pad=pad,\n                    fields=fields)\n\n        elif unit is u.hourangle:\n            if decimal:\n                values = self.hour\n                if precision is not None:\n                    func = (\"{0:0.\" + str(precision) + \"f}\").format\n                else:\n                    func = '{:g}'.format\n            else:\n                if sep == 'fromunit':\n                    sep = 'hms'\n                values = self.hour\n                func = lambda x: form.hours_to_string(\n                    x, precision=precision, sep=sep, pad=pad,\n                    fields=fields)\n\n        elif unit.is_equivalent(u.radian):\n            if decimal:\n                values = self.to_value(unit)\n                if precision is not None:\n                    func = (\"{0:1.\" + str(precision) + \"f}\").format\n                else:\n                    func = \"{:g}\".format\n            elif sep == 'fromunit':\n                values = self.to_value(unit)\n                unit_string = unit.to_string(format=format)\n                if format == 'latex':\n                    unit_string = unit_string[1:-1]\n\n                if precision is not None:\n                    def plain_unit_format(val):\n                        return (\"{0:0.\" + str(precision) + \"f}{1}\").format(\n                            val, unit_string)\n                    func = plain_unit_format\n                else:\n                    def plain_unit_format(val):\n                        return f\"{val:g}{unit_string}\"\n                    func = plain_unit_format\n            else:\n                raise ValueError(\n                    f\"'{unit.name}' can not be represented in sexagesimal notation\")\n\n        else:\n            raise u.UnitsError(\n                \"The unit value provided is not an angular unit.\")\n\n        def do_format(val):\n            # Check if value is not nan to avoid ValueErrors when turning it into\n            # a hexagesimal string.\n            if not np.isnan(val):\n                s = func(float(val))\n                if alwayssign and not s.startswith('-'):\n                    s = '+' + s\n                if format == 'latex':\n                    s = f'${s}$'\n                return s\n            s = f\"{val}\"\n            return s\n\n        format_ufunc = np.vectorize(do_format, otypes=['U'])\n        result = format_ufunc(values)\n\n        if result.ndim == 0:\n            result = result[()]\n        return result\n\n    def _wrap_at(self, wrap_angle):\n        \"\"\"\n        Implementation that assumes ``angle`` is already validated\n        and that wrapping is inplace.\n        \"\"\"\n        # Convert the wrap angle and 360 degrees to the native unit of\n        # this Angle, then do all the math on raw Numpy arrays rather\n        # than Quantity objects for speed.\n        a360 = u.degree.to(self.unit, 360.0)\n        wrap_angle = wrap_angle.to_value(self.unit)\n        wrap_angle_floor = wrap_angle - a360\n        self_angle = self.view(np.ndarray)\n        # Do the wrapping, but only if any angles need to be wrapped\n        #\n        # This invalid catch block is needed both for the floor division\n        # and for the comparisons later on (latter not really needed\n        # any more for >= 1.19 (NUMPY_LT_1_19), but former is).\n        with np.errstate(invalid='ignore'):\n            wraps = (self_angle - wrap_angle_floor) // a360\n            np.nan_to_num(wraps, copy=False)\n            if np.any(wraps != 0):\n                self_angle -= wraps*a360\n                # Rounding errors can cause problems.\n                self_angle[self_angle >= wrap_angle] -= a360\n                self_angle[self_angle < wrap_angle_floor] += a360\n\n    def wrap_at(self, wrap_angle, inplace=False):\n        \"\"\"\n        Wrap the `~astropy.coordinates.Angle` object at the given ``wrap_angle``.\n\n        This method forces all the angle values to be within a contiguous\n        360 degree range so that ``wrap_angle - 360d <= angle <\n        wrap_angle``. By default a new Angle object is returned, but if the\n        ``inplace`` argument is `True` then the `~astropy.coordinates.Angle`\n        object is wrapped in place and nothing is returned.\n\n        For instance::\n\n          >>> from astropy.coordinates import Angle\n          >>> import astropy.units as u\n          >>> a = Angle([-20.0, 150.0, 350.0] * u.deg)\n\n          >>> a.wrap_at(360 * u.deg).degree  # Wrap into range 0 to 360 degrees  # doctest: +FLOAT_CMP\n          array([340., 150., 350.])\n\n          >>> a.wrap_at('180d', inplace=True)  # Wrap into range -180 to 180 degrees  # doctest: +FLOAT_CMP\n          >>> a.degree  # doctest: +FLOAT_CMP\n          array([-20., 150., -10.])\n\n        Parameters\n        ----------\n        wrap_angle : angle-like\n            Specifies a single value for the wrap angle.  This can be any\n            object that can initialize an `~astropy.coordinates.Angle` object,\n            e.g. ``'180d'``, ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.\n\n        inplace : bool\n            If `True` then wrap the object in place instead of returning\n            a new `~astropy.coordinates.Angle`\n\n        Returns\n        -------\n        out : Angle or None\n            If ``inplace is False`` (default), return new\n            `~astropy.coordinates.Angle` object with angles wrapped accordingly.\n            Otherwise wrap in place and return `None`.\n        \"\"\"\n        wrap_angle = Angle(wrap_angle, copy=False)  # Convert to an Angle\n        if not inplace:\n            self = self.copy()\n        self._wrap_at(wrap_angle)\n        return None if inplace else self\n\n    def is_within_bounds(self, lower=None, upper=None):\n        \"\"\"\n        Check if all angle(s) satisfy ``lower <= angle < upper``\n\n        If ``lower`` is not specified (or `None`) then no lower bounds check is\n        performed.  Likewise ``upper`` can be left unspecified.  For example::\n\n          >>> from astropy.coordinates import Angle\n          >>> import astropy.units as u\n          >>> a = Angle([-20, 150, 350] * u.deg)\n          >>> a.is_within_bounds('0d', '360d')\n          False\n          >>> a.is_within_bounds(None, '360d')\n          True\n          >>> a.is_within_bounds(-30 * u.deg, None)\n          True\n\n        Parameters\n        ----------\n        lower : angle-like or None\n            Specifies lower bound for checking.  This can be any object\n            that can initialize an `~astropy.coordinates.Angle` object, e.g. ``'180d'``,\n            ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.\n        upper : angle-like or None\n            Specifies upper bound for checking.  This can be any object\n            that can initialize an `~astropy.coordinates.Angle` object, e.g. ``'180d'``,\n            ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.\n\n        Returns\n        -------\n        is_within_bounds : bool\n            `True` if all angles satisfy ``lower <= angle < upper``\n        \"\"\"\n        ok = True\n        if lower is not None:\n            ok &= np.all(Angle(lower) <= self)\n        if ok and upper is not None:\n            ok &= np.all(self < Angle(upper))\n        return bool(ok)\n\n    def _str_helper(self, format=None):\n        if self.isscalar:\n            return self.to_string(format=format)\n\n        def formatter(x):\n            return x.to_string(format=format)\n\n        return np.array2string(self, formatter={'all': formatter})\n\n    def __str__(self):\n        return self._str_helper()\n\n    def _repr_latex_(self):\n        return self._str_helper(format='latex')\n\n\ndef _no_angle_subclass(obj):\n    \"\"\"Return any Angle subclass objects as an Angle objects.\n\n    This is used to ensure that Latitude and Longitude change to Angle\n    objects when they are used in calculations (such as lon/2.)\n    \"\"\"\n    if isinstance(obj, tuple):\n        return tuple(_no_angle_subclass(_obj) for _obj in obj)\n\n    return obj.view(Angle) if isinstance(obj, (Latitude, Longitude)) else obj\n\n\nclass Latitude(Angle):\n    \"\"\"\n    Latitude-like angle(s) which must be in the range -90 to +90 deg.\n\n    A Latitude object is distinguished from a pure\n    :class:`~astropy.coordinates.Angle` by virtue of being constrained\n    so that::\n\n      -90.0 * u.deg <= angle(s) <= +90.0 * u.deg\n\n    Any attempt to set a value outside that range will result in a\n    `ValueError`.\n\n    The input angle(s) can be specified either as an array, list,\n    scalar, tuple (see below), string,\n    :class:`~astropy.units.Quantity` or another\n    :class:`~astropy.coordinates.Angle`.\n\n    The input parser is flexible and supports all of the input formats\n    supported by :class:`~astropy.coordinates.Angle`.\n\n    Parameters\n    ----------\n    angle : array, list, scalar, `~astropy.units.Quantity`, `~astropy.coordinates.Angle`\n        The angle value(s). If a tuple, will be interpreted as ``(h, m, s)``\n        or ``(d, m, s)`` depending on ``unit``. If a string, it will be\n        interpreted following the rules described for\n        :class:`~astropy.coordinates.Angle`.\n\n        If ``angle`` is a sequence or array of strings, the resulting\n        values will be in the given ``unit``, or if `None` is provided,\n        the unit will be taken from the first given value.\n\n    unit : unit-like, optional\n        The unit of the value specified for the angle.  This may be\n        any string that `~astropy.units.Unit` understands, but it is\n        better to give an actual unit object.  Must be an angular\n        unit.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If a unit is not provided or it is not an angular unit.\n    `TypeError`\n        If the angle parameter is an instance of :class:`~astropy.coordinates.Longitude`.\n    \"\"\"\n    def __new__(cls, angle, unit=None, **kwargs):\n        # Forbid creating a Lat from a Long.\n        if isinstance(angle, Longitude):\n            raise TypeError(\"A Latitude angle cannot be created from a Longitude angle\")\n        self = super().__new__(cls, angle, unit=unit, **kwargs)\n        self._validate_angles()\n        return self\n\n    def _validate_angles(self, angles=None):\n        \"\"\"Check that angles are between -90 and 90 degrees.\n        If not given, the check is done on the object itself\"\"\"\n        # Convert the lower and upper bounds to the \"native\" unit of\n        # this angle.  This limits multiplication to two values,\n        # rather than the N values in `self.value`.  Also, the\n        # comparison is performed on raw arrays, rather than Quantity\n        # objects, for speed.\n        if angles is None:\n            angles = self\n        lower = u.degree.to(angles.unit, -90.0)\n        upper = u.degree.to(angles.unit, 90.0)\n        # This invalid catch block can be removed when the minimum numpy\n        # version is >= 1.19 (NUMPY_LT_1_19)\n        with np.errstate(invalid='ignore'):\n            invalid_angles = (np.any(angles.value < lower) or\n                              np.any(angles.value > upper))\n        if invalid_angles:\n            raise ValueError('Latitude angle(s) must be within -90 deg <= angle <= 90 deg, '\n                             'got {}'.format(angles.to(u.degree)))\n\n    def __setitem__(self, item, value):\n        # Forbid assigning a Long to a Lat.\n        if isinstance(value, Longitude):\n            raise TypeError(\"A Longitude angle cannot be assigned to a Latitude angle\")\n        # first check bounds\n        if value is not np.ma.masked:\n            self._validate_angles(value)\n        super().__setitem__(item, value)\n\n    # Any calculation should drop to Angle\n    def __array_ufunc__(self, *args, **kwargs):\n        results = super().__array_ufunc__(*args, **kwargs)\n        return _no_angle_subclass(results)\n\n\nclass LongitudeInfo(u.QuantityInfo):\n    _represent_as_dict_attrs = u.QuantityInfo._represent_as_dict_attrs + ('wrap_angle',)\n\n\nclass Longitude(Angle):\n    \"\"\"\n    Longitude-like angle(s) which are wrapped within a contiguous 360 degree range.\n\n    A ``Longitude`` object is distinguished from a pure\n    :class:`~astropy.coordinates.Angle` by virtue of a ``wrap_angle``\n    property.  The ``wrap_angle`` specifies that all angle values\n    represented by the object will be in the range::\n\n      wrap_angle - 360 * u.deg <= angle(s) < wrap_angle\n\n    The default ``wrap_angle`` is 360 deg.  Setting ``wrap_angle=180 *\n    u.deg`` would instead result in values between -180 and +180 deg.\n    Setting the ``wrap_angle`` attribute of an existing ``Longitude``\n    object will result in re-wrapping the angle values in-place.\n\n    The input angle(s) can be specified either as an array, list,\n    scalar, tuple, string, :class:`~astropy.units.Quantity`\n    or another :class:`~astropy.coordinates.Angle`.\n\n    The input parser is flexible and supports all of the input formats\n    supported by :class:`~astropy.coordinates.Angle`.\n\n    Parameters\n    ----------\n    angle : tuple or angle-like\n        The angle value(s). If a tuple, will be interpreted as ``(h, m s)`` or\n        ``(d, m, s)`` depending on ``unit``. If a string, it will be interpreted\n        following the rules described for :class:`~astropy.coordinates.Angle`.\n\n        If ``angle`` is a sequence or array of strings, the resulting\n        values will be in the given ``unit``, or if `None` is provided,\n        the unit will be taken from the first given value.\n\n    unit : unit-like ['angle'], optional\n        The unit of the value specified for the angle.  This may be\n        any string that `~astropy.units.Unit` understands, but it is\n        better to give an actual unit object.  Must be an angular\n        unit.\n\n    wrap_angle : angle-like or None, optional\n        Angle at which to wrap back to ``wrap_angle - 360 deg``.\n        If ``None`` (default), it will be taken to be 360 deg unless ``angle``\n        has a ``wrap_angle`` attribute already (i.e., is a ``Longitude``),\n        in which case it will be taken from there.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If a unit is not provided or it is not an angular unit.\n    `TypeError`\n        If the angle parameter is an instance of :class:`~astropy.coordinates.Latitude`.\n    \"\"\"\n\n    _wrap_angle = None\n    _default_wrap_angle = Angle(360 * u.deg)\n    info = LongitudeInfo()\n\n    def __new__(cls, angle, unit=None, wrap_angle=None, **kwargs):\n        # Forbid creating a Long from a Lat.\n        if isinstance(angle, Latitude):\n            raise TypeError(\"A Longitude angle cannot be created from \"\n                            \"a Latitude angle.\")\n        self = super().__new__(cls, angle, unit=unit, **kwargs)\n        if wrap_angle is None:\n            wrap_angle = getattr(angle, 'wrap_angle', self._default_wrap_angle)\n        self.wrap_angle = wrap_angle  # angle-like b/c property setter\n        return self\n\n    def __setitem__(self, item, value):\n        # Forbid assigning a Lat to a Long.\n        if isinstance(value, Latitude):\n            raise TypeError(\"A Latitude angle cannot be assigned to a Longitude angle\")\n        super().__setitem__(item, value)\n        self._wrap_at(self.wrap_angle)\n\n    @property\n    def wrap_angle(self):\n        return self._wrap_angle\n\n    @wrap_angle.setter\n    def wrap_angle(self, value):\n        self._wrap_angle = Angle(value, copy=False)\n        self._wrap_at(self.wrap_angle)\n\n    def __array_finalize__(self, obj):\n        super().__array_finalize__(obj)\n        self._wrap_angle = getattr(obj, '_wrap_angle',\n                                   self._default_wrap_angle)\n\n    # Any calculation should drop to Angle\n    def __array_ufunc__(self, *args, **kwargs):\n        results = super().__array_ufunc__(*args, **kwargs)\n        return _no_angle_subclass(results)\n"},{"className":"LongitudeInfo","col":0,"comment":"null","endLoc":604,"id":15386,"nodeType":"Class","startLoc":603,"text":"class LongitudeInfo(u.QuantityInfo):\n    _represent_as_dict_attrs = u.QuantityInfo._represent_as_dict_attrs + ('wrap_angle',)"},{"col":4,"comment":"\n        Converts WGS84 geodetic coordinates to 3D rectangular (geocentric)\n        cartesian coordinates.\n        ","endLoc":904,"header":"def to_cartesian(self)","id":15387,"name":"to_cartesian","nodeType":"Function","startLoc":897,"text":"def to_cartesian(self):\n        \"\"\"\n        Converts WGS84 geodetic coordinates to 3D rectangular (geocentric)\n        cartesian coordinates.\n        \"\"\"\n        xyz = erfa.gd2gc(getattr(erfa, self._ellipsoid),\n                         self.lon, self.lat, self.height)\n        return CartesianRepresentation(xyz, xyz_axis=-1, copy=False)"},{"attributeType":"null","col":4,"comment":"null","endLoc":604,"id":15388,"name":"_represent_as_dict_attrs","nodeType":"Attribute","startLoc":604,"text":"_represent_as_dict_attrs"},{"col":4,"comment":"\n        Converts 3D rectangular cartesian coordinates (assumed geocentric) to\n        WGS84 geodetic coordinates.\n        ","endLoc":914,"header":"@classmethod\n    def from_cartesian(cls, cart)","id":15389,"name":"from_cartesian","nodeType":"Function","startLoc":906,"text":"@classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates (assumed geocentric) to\n        WGS84 geodetic coordinates.\n        \"\"\"\n        lon, lat, height = erfa.gc2gd(getattr(erfa, cls._ellipsoid),\n                                      cart.get_xyz(xyz_axis=-1))\n        return cls(lon, lat, height, copy=False)"},{"col":4,"comment":"Transform the spherical coordinates using a 3x3 matrix.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 matrix, such as a rotation matrix (or a stack of matrices).\n\n        ","endLoc":2261,"header":"def transform(self, matrix)","id":15390,"name":"transform","nodeType":"Function","startLoc":2238,"text":"def transform(self, matrix):\n        \"\"\"Transform the spherical coordinates using a 3x3 matrix.\n\n        This returns a new representation and does not modify the original one.\n        Any differentials attached to this representation will also be\n        transformed.\n\n        Parameters\n        ----------\n        matrix : (3,3) array-like\n            A 3x3 matrix, such as a rotation matrix (or a stack of matrices).\n\n        \"\"\"\n        # apply transformation in unit-spherical coordinates\n        xyz = erfa_ufunc.s2c(self.phi, 90*u.deg-self.theta)\n        p = erfa_ufunc.rxp(matrix, xyz)\n        lon, lat, ur = erfa_ufunc.p2s(p)  # `ur` is transformed unit-`r`\n        # create transformed physics-spherical representation,\n        # reapplying the distance scaling\n        rep = self.__class__(phi=lon, theta=90*u.deg-lat, r=self.r * ur)\n\n        new_diffs = dict((k, d.transform(matrix, self, rep))\n                         for k, d in self.differentials.items())\n        return rep.with_differentials(new_diffs)"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":15391,"name":"__all__","nodeType":"Attribute","startLoc":18,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":15392,"name":"hms_tuple","nodeType":"Attribute","startLoc":22,"text":"hms_tuple"},{"attributeType":"null","col":4,"comment":"null","endLoc":879,"id":15393,"name":"attr_classes","nodeType":"Attribute","startLoc":879,"text":"attr_classes"},{"className":"WGS84GeodeticRepresentation","col":0,"comment":"Representation of points in WGS84 3D geodetic coordinates.","endLoc":921,"id":15394,"nodeType":"Class","startLoc":917,"text":"@format_doc(geodetic_base_doc)\nclass WGS84GeodeticRepresentation(BaseGeodeticRepresentation):\n    \"\"\"Representation of points in WGS84 3D geodetic coordinates.\"\"\"\n\n    _ellipsoid = 'WGS84'"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":15395,"name":"dms_tuple","nodeType":"Attribute","startLoc":23,"text":"dms_tuple"},{"attributeType":"null","col":4,"comment":"null","endLoc":921,"id":15396,"name":"_ellipsoid","nodeType":"Attribute","startLoc":921,"text":"_ellipsoid"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":15397,"name":"signed_dms_tuple","nodeType":"Attribute","startLoc":24,"text":"signed_dms_tuple"},{"col":0,"comment":"","endLoc":7,"header":"angles.py#<anonymous>","id":15398,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nThis module contains the fundamental classes used for representing\ncoordinates in astropy.\n\"\"\"\n\n__all__ = ['Angle', 'Latitude', 'Longitude']\n\nhms_tuple = namedtuple('hms_tuple', ('h', 'm', 's'))\n\ndms_tuple = namedtuple('dms_tuple', ('d', 'm', 's'))\n\nsigned_dms_tuple = namedtuple('signed_dms_tuple', ('sign', 'd', 'm', 's'))"},{"className":"WGS72GeodeticRepresentation","col":0,"comment":"Representation of points in WGS72 3D geodetic coordinates.","endLoc":928,"id":15399,"nodeType":"Class","startLoc":924,"text":"@format_doc(geodetic_base_doc)\nclass WGS72GeodeticRepresentation(BaseGeodeticRepresentation):\n    \"\"\"Representation of points in WGS72 3D geodetic coordinates.\"\"\"\n\n    _ellipsoid = 'WGS72'"},{"attributeType":"null","col":4,"comment":"null","endLoc":928,"id":15400,"name":"_ellipsoid","nodeType":"Attribute","startLoc":928,"text":"_ellipsoid"},{"fileName":"errors.py","filePath":"astropy/coordinates","id":15401,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n''' This module defines custom errors and exceptions used in astropy.coordinates.\n'''\n\nfrom astropy.utils.exceptions import AstropyWarning\n\n__all__ = ['RangeError', 'BoundsError', 'IllegalHourError',\n           'IllegalMinuteError', 'IllegalSecondError', 'ConvertError',\n           'IllegalHourWarning', 'IllegalMinuteWarning', 'IllegalSecondWarning',\n           'UnknownSiteException']\n\n\nclass RangeError(ValueError):\n    \"\"\"\n    Raised when some part of an angle is out of its valid range.\n    \"\"\"\n\n\nclass BoundsError(RangeError):\n    \"\"\"\n    Raised when an angle is outside of its user-specified bounds.\n    \"\"\"\n\n\nclass IllegalHourError(RangeError):\n    \"\"\"\n    Raised when an hour value is not in the range [0,24).\n\n    Parameters\n    ----------\n    hour : int, float\n\n    Examples\n    --------\n\n    .. code-block:: python\n\n        if not 0 <= hr < 24:\n           raise IllegalHourError(hour)\n    \"\"\"\n    def __init__(self, hour):\n        self.hour = hour\n\n    def __str__(self):\n        return f\"An invalid value for 'hours' was found ('{self.hour}'); must be in the range [0,24).\"\n\n\nclass IllegalHourWarning(AstropyWarning):\n    \"\"\"\n    Raised when an hour value is 24.\n\n    Parameters\n    ----------\n    hour : int, float\n    \"\"\"\n    def __init__(self, hour, alternativeactionstr=None):\n        self.hour = hour\n        self.alternativeactionstr = alternativeactionstr\n\n    def __str__(self):\n        message = f\"'hour' was found  to be '{self.hour}', which is not in range (-24, 24).\"\n        if self.alternativeactionstr is not None:\n            message += ' ' + self.alternativeactionstr\n        return message\n\n\nclass IllegalMinuteError(RangeError):\n    \"\"\"\n    Raised when an minute value is not in the range [0,60].\n\n    Parameters\n    ----------\n    minute : int, float\n\n    Examples\n    --------\n\n    .. code-block:: python\n\n        if not 0 <= min < 60:\n            raise IllegalMinuteError(minute)\n\n    \"\"\"\n    def __init__(self, minute):\n        self.minute = minute\n\n    def __str__(self):\n        return f\"An invalid value for 'minute' was found ('{self.minute}'); should be in the range [0,60).\"\n\n\nclass IllegalMinuteWarning(AstropyWarning):\n    \"\"\"\n    Raised when a minute value is 60.\n\n    Parameters\n    ----------\n    minute : int, float\n    \"\"\"\n    def __init__(self, minute, alternativeactionstr=None):\n        self.minute = minute\n        self.alternativeactionstr = alternativeactionstr\n\n    def __str__(self):\n        message = f\"'minute' was found  to be '{self.minute}', which is not in range [0,60).\"\n        if self.alternativeactionstr is not None:\n            message += ' ' + self.alternativeactionstr\n        return message\n\n\nclass IllegalSecondError(RangeError):\n    \"\"\"\n    Raised when an second value (time) is not in the range [0,60].\n\n    Parameters\n    ----------\n    second : int, float\n\n    Examples\n    --------\n\n    .. code-block:: python\n\n        if not 0 <= sec < 60:\n            raise IllegalSecondError(second)\n    \"\"\"\n    def __init__(self, second):\n        self.second = second\n\n    def __str__(self):\n        return f\"An invalid value for 'second' was found ('{self.second}'); should be in the range [0,60).\"\n\n\nclass IllegalSecondWarning(AstropyWarning):\n    \"\"\"\n    Raised when a second value is 60.\n\n    Parameters\n    ----------\n    second : int, float\n    \"\"\"\n    def __init__(self, second, alternativeactionstr=None):\n        self.second = second\n        self.alternativeactionstr = alternativeactionstr\n\n    def __str__(self):\n        message = f\"'second' was found  to be '{self.second}', which is not in range [0,60).\"\n        if self.alternativeactionstr is not None:\n            message += ' ' + self.alternativeactionstr\n        return message\n\n\n# TODO: consider if this should be used to `units`?\nclass UnitsError(ValueError):\n    \"\"\"\n    Raised if units are missing or invalid.\n    \"\"\"\n\n\nclass ConvertError(Exception):\n    \"\"\"\n    Raised if a coordinate system cannot be converted to another\n    \"\"\"\n\n\nclass UnknownSiteException(KeyError):\n    def __init__(self, site, attribute, close_names=None):\n        message = f\"Site '{site}' not in database. Use {attribute} to see available sites.\"\n        if close_names:\n            message += \" Did you mean one of: '{}'?'\".format(\"', '\".join(close_names))\n        self.site = site\n        self.attribute = attribute\n        self.close_names = close_names\n        return super().__init__(message)\n"},{"className":"GRS80GeodeticRepresentation","col":0,"comment":"Representation of points in GRS80 3D geodetic coordinates.","endLoc":935,"id":15402,"nodeType":"Class","startLoc":931,"text":"@format_doc(geodetic_base_doc)\nclass GRS80GeodeticRepresentation(BaseGeodeticRepresentation):\n    \"\"\"Representation of points in GRS80 3D geodetic coordinates.\"\"\"\n\n    _ellipsoid = 'GRS80'"},{"className":"BoundsError","col":0,"comment":"\n    Raised when an angle is outside of its user-specified bounds.\n    ","endLoc":24,"id":15403,"nodeType":"Class","startLoc":21,"text":"class BoundsError(RangeError):\n    \"\"\"\n    Raised when an angle is outside of its user-specified bounds.\n    \"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":935,"id":15404,"name":"_ellipsoid","nodeType":"Attribute","startLoc":935,"text":"_ellipsoid"},{"className":"UnitsError","col":0,"comment":"\n    Raised if units are missing or invalid.\n    ","endLoc":158,"id":15405,"nodeType":"Class","startLoc":155,"text":"class UnitsError(ValueError):\n    \"\"\"\n    Raised if units are missing or invalid.\n    \"\"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":15406,"name":"__all__","nodeType":"Attribute","startLoc":28,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":15407,"name":"GeodeticLocation","nodeType":"Attribute","startLoc":32,"text":"GeodeticLocation"},{"attributeType":"null","col":0,"comment":"Available ellipsoids (defined in erfam.h, with numbers exposed in erfa).","endLoc":34,"id":15408,"name":"ELLIPSOIDS","nodeType":"Attribute","startLoc":34,"text":"ELLIPSOIDS"},{"attributeType":"null","col":0,"comment":"\nRotational velocity of Earth, following SOFA's pvtob.\n\nIn UT1 seconds, this would be 2 pi / (24 * 3600), but we need the value\nin SI seconds, so multiply by the ratio of stellar to solar day.\nSee Explanatory Supplement to the Astronomical Almanac, ed. P. Kenneth\nSeidelmann (1992), University Science Books. The constant is the\nconventional, exact one (IERS conventions 2003); see\nhttp://hpiers.obspm.fr/eop-pc/index.php?index=constants.\n","endLoc":38,"id":15409,"name":"OMEGA_EARTH","nodeType":"Attribute","startLoc":38,"text":"OMEGA_EARTH"},{"className":"ConvertError","col":0,"comment":"\n    Raised if a coordinate system cannot be converted to another\n    ","endLoc":164,"id":15410,"nodeType":"Class","startLoc":161,"text":"class ConvertError(Exception):\n    \"\"\"\n    Raised if a coordinate system cannot be converted to another\n    \"\"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":15411,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"errors.py#<anonymous>","id":15412,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"''' This module defines custom errors and exceptions used in astropy.coordinates.\n'''\n\n__all__ = ['RangeError', 'BoundsError', 'IllegalHourError',\n           'IllegalMinuteError', 'IllegalSecondError', 'ConvertError',\n           'IllegalHourWarning', 'IllegalMinuteWarning', 'IllegalSecondWarning',\n           'UnknownSiteException']"},{"attributeType":"null","col":0,"comment":"null","endLoc":855,"id":15413,"name":"geodetic_base_doc","nodeType":"Attribute","startLoc":855,"text":"geodetic_base_doc"},{"col":0,"comment":"","endLoc":3,"header":"earth.py#<anonymous>","id":15414,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['EarthLocation', 'BaseGeodeticRepresentation',\n           'WGS84GeodeticRepresentation', 'WGS72GeodeticRepresentation',\n           'GRS80GeodeticRepresentation']\n\nGeodeticLocation = collections.namedtuple('GeodeticLocation', ['lon', 'lat', 'height'])\n\nELLIPSOIDS = {}\n\n\"\"\"Available ellipsoids (defined in erfam.h, with numbers exposed in erfa).\"\"\"\n\nOMEGA_EARTH = ((1.002_737_811_911_354_48 * u.cycle/u.day)\n               .to(1/u.s, u.dimensionless_angles()))\n\n\"\"\"\nRotational velocity of Earth, following SOFA's pvtob.\n\nIn UT1 seconds, this would be 2 pi / (24 * 3600), but we need the value\nin SI seconds, so multiply by the ratio of stellar to solar day.\nSee Explanatory Supplement to the Astronomical Almanac, ed. P. Kenneth\nSeidelmann (1992), University Science Books. The constant is the\nconventional, exact one (IERS conventions 2003); see\nhttp://hpiers.obspm.fr/eop-pc/index.php?index=constants.\n\"\"\"\n\ngeodetic_base_doc = \"\"\"{__doc__}\n\n    Parameters\n    ----------\n    lon, lat : angle-like\n        The longitude and latitude of the point(s), in angular units. The\n        latitude should be between -90 and 90 degrees, and the longitude will\n        be wrapped to an angle between 0 and 360 degrees. These can also be\n        instances of `~astropy.coordinates.Angle` and either\n        `~astropy.coordinates.Longitude` not `~astropy.coordinates.Latitude`,\n        depending on the parameter.\n    height : `~astropy.units.Quantity` ['length']\n        The height to the point(s).\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n\n\"\"\""},{"col":4,"comment":"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.  For\n        spherical coordinates, this is just the absolute value of the radius.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        ","endLoc":2275,"header":"def norm(self)","id":15415,"name":"norm","nodeType":"Function","startLoc":2263,"text":"def norm(self):\n        \"\"\"Vector norm.\n\n        The norm is the standard Frobenius norm, i.e., the square root of the\n        sum of the squares of all components with non-angular units.  For\n        spherical coordinates, this is just the absolute value of the radius.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\n        return np.abs(self.r)"},{"attributeType":"null","col":8,"comment":"null","endLoc":295,"id":15416,"name":"unit","nodeType":"Attribute","startLoc":295,"text":"self.unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":296,"id":15417,"name":"shape","nodeType":"Attribute","startLoc":296,"text":"self.shape"},{"className":"EarthLocationAttribute","col":0,"comment":"\n    A frame attribute that can act as a `~astropy.coordinates.EarthLocation`.\n    It can be created as anything that can be transformed to the\n    `~astropy.coordinates.ITRS` frame, but always presents as an `EarthLocation`\n    when accessed after creation.\n\n    Parameters\n    ----------\n    default : object\n        Default value for the attribute if not provided\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    ","endLoc":396,"id":15418,"nodeType":"Class","startLoc":345,"text":"class EarthLocationAttribute(Attribute):\n    \"\"\"\n    A frame attribute that can act as a `~astropy.coordinates.EarthLocation`.\n    It can be created as anything that can be transformed to the\n    `~astropy.coordinates.ITRS` frame, but always presents as an `EarthLocation`\n    when accessed after creation.\n\n    Parameters\n    ----------\n    default : object\n        Default value for the attribute if not provided\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    \"\"\"\n\n    def convert_input(self, value):\n        \"\"\"\n        Checks that the input is a Quantity with the necessary units (or the\n        special value ``0``).\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n\n        if value is None:\n            return None, False\n        elif isinstance(value, EarthLocation):\n            return value, False\n        else:\n            # we have to do the import here because of some tricky circular deps\n            from .builtin_frames import ITRS\n\n            if not hasattr(value, 'transform_to'):\n                raise ValueError('\"{}\" was passed into an '\n                                 'EarthLocationAttribute, but it does not have '\n                                 '\"transform_to\" method'.format(value))\n            itrsobj = value.transform_to(ITRS())\n            return itrsobj.earth_location, True"},{"col":4,"comment":"null","endLoc":2293,"header":"def _scale_operation(self, op, *args)","id":15419,"name":"_scale_operation","nodeType":"Function","startLoc":2277,"text":"def _scale_operation(self, op, *args):\n        if any(differential.base_representation is not self.__class__\n               for differential in self.differentials.values()):\n            return super()._scale_operation(op, *args)\n\n        phi_op, adjust_theta_sign, r_op = _spherical_op_funcs(op, *args)\n        # Also run phi_op on theta to ensure theta remains between 0 and 180:\n        # any time the scale is negative, we do -theta + 180 degrees.\n        result = self.__class__(phi_op(self.phi),\n                                phi_op(adjust_theta_sign(self.theta)),\n                                r_op(self.r), copy=False)\n        for key, differential in self.differentials.items():\n            new_comps = (op(getattr(differential, comp)) for op, comp in zip(\n                (operator.pos, adjust_theta_sign, r_op),\n                differential.components))\n            result.differentials[key] = differential.__class__(*new_comps, copy=False)\n        return result"},{"col":4,"comment":"\n        Checks that the input is a Quantity with the necessary units (or the\n        special value ``0``).\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        ","endLoc":396,"header":"def convert_input(self, value)","id":15420,"name":"convert_input","nodeType":"Function","startLoc":361,"text":"def convert_input(self, value):\n        \"\"\"\n        Checks that the input is a Quantity with the necessary units (or the\n        special value ``0``).\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n\n        if value is None:\n            return None, False\n        elif isinstance(value, EarthLocation):\n            return value, False\n        else:\n            # we have to do the import here because of some tricky circular deps\n            from .builtin_frames import ITRS\n\n            if not hasattr(value, 'transform_to'):\n                raise ValueError('\"{}\" was passed into an '\n                                 'EarthLocationAttribute, but it does not have '\n                                 '\"transform_to\" method'.format(value))\n            itrsobj = value.transform_to(ITRS())\n            return itrsobj.earth_location, True"},{"fileName":"name_resolve.py","filePath":"astropy/coordinates","id":15421,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module contains convenience functions for getting a coordinate object\nfor a named object by querying SESAME and getting the first returned result.\nNote that this is intended to be a convenience, and is very simple. If you\nneed precise coordinates for an object you should find the appropriate\nreference for that measurement and input the coordinates manually.\n\"\"\"\n\n# Standard library\nimport os\nimport re\nimport socket\nimport urllib.request\nimport urllib.parse\nimport urllib.error\n\n# Astropy\nfrom astropy import units as u\nfrom .sky_coordinate import SkyCoord\nfrom astropy.utils import data\nfrom astropy.utils.data import download_file, get_file_contents\nfrom astropy.utils.state import ScienceState\n\n__all__ = [\"get_icrs_coordinates\"]\n\n\nclass sesame_url(ScienceState):\n    \"\"\"\n    The URL(s) to Sesame's web-queryable database.\n    \"\"\"\n    _value = [\"http://cdsweb.u-strasbg.fr/cgi-bin/nph-sesame/\",\n              \"http://vizier.cfa.harvard.edu/viz-bin/nph-sesame/\"]\n\n    @classmethod\n    def validate(cls, value):\n        # TODO: Implement me\n        return value\n\n\nclass sesame_database(ScienceState):\n    \"\"\"\n    This specifies the default database that SESAME will query when\n    using the name resolve mechanism in the coordinates\n    subpackage. Default is to search all databases, but this can be\n    'all', 'simbad', 'ned', or 'vizier'.\n    \"\"\"\n    _value = 'all'\n\n    @classmethod\n    def validate(cls, value):\n        if value not in ['all', 'simbad', 'ned', 'vizier']:\n            raise ValueError(f\"Unknown database '{value}'\")\n        return value\n\n\nclass NameResolveError(Exception):\n    pass\n\n\ndef _parse_response(resp_data):\n    \"\"\"\n    Given a string response from SESAME, parse out the coordinates by looking\n    for a line starting with a J, meaning ICRS J2000 coordinates.\n\n    Parameters\n    ----------\n    resp_data : str\n        The string HTTP response from SESAME.\n\n    Returns\n    -------\n    ra : str\n        The string Right Ascension parsed from the HTTP response.\n    dec : str\n        The string Declination parsed from the HTTP response.\n    \"\"\"\n\n    pattr = re.compile(r\"%J\\s*([0-9\\.]+)\\s*([\\+\\-\\.0-9]+)\")\n    matched = pattr.search(resp_data)\n\n    if matched is None:\n        return None, None\n    else:\n        ra, dec = matched.groups()\n        return ra, dec\n\n\ndef get_icrs_coordinates(name, parse=False, cache=False):\n    \"\"\"\n    Retrieve an ICRS object by using an online name resolving service to\n    retrieve coordinates for the specified name. By default, this will\n    search all available databases until a match is found. If you would like\n    to specify the database, use the science state\n    ``astropy.coordinates.name_resolve.sesame_database``. You can also\n    specify a list of servers to use for querying Sesame using the science\n    state ``astropy.coordinates.name_resolve.sesame_url``. This will try\n    each one in order until a valid response is returned. By default, this\n    list includes the main Sesame host and a mirror at vizier.  The\n    configuration item `astropy.utils.data.Conf.remote_timeout` controls the\n    number of seconds to wait for a response from the server before giving\n    up.\n\n    Parameters\n    ----------\n    name : str\n        The name of the object to get coordinates for, e.g. ``'M42'``.\n    parse : bool\n        Whether to attempt extracting the coordinates from the name by\n        parsing with a regex. For objects catalog names that have\n        J-coordinates embedded in their names eg:\n        'CRTS SSS100805 J194428-420209', this may be much faster than a\n        sesame query for the same object name. The coordinates extracted\n        in this way may differ from the database coordinates by a few\n        deci-arcseconds, so only use this option if you do not need\n        sub-arcsecond accuracy for coordinates.\n    cache : bool, str, optional\n        Determines whether to cache the results or not. Passed through to\n        `~astropy.utils.data.download_file`, so pass \"update\" to update the\n        cached value.\n\n    Returns\n    -------\n    coord : `astropy.coordinates.ICRS` object\n        The object's coordinates in the ICRS frame.\n\n    \"\"\"\n\n    # if requested, first try extract coordinates embedded in the object name.\n    # Do this first since it may be much faster than doing the sesame query\n    if parse:\n        from . import jparser\n        if jparser.search(name):\n            return jparser.to_skycoord(name)\n        else:\n            # if the parser failed, fall back to sesame query.\n            pass\n            # maybe emit a warning instead of silently falling back to sesame?\n\n    database = sesame_database.get()\n    # The web API just takes the first letter of the database name\n    db = database.upper()[0]\n\n    # Make sure we don't have duplicates in the url list\n    urls = []\n    domains = []\n    for url in sesame_url.get():\n        domain = urllib.parse.urlparse(url).netloc\n\n        # Check for duplicates\n        if domain not in domains:\n            domains.append(domain)\n\n            # Add the query to the end of the url, add to url list\n            fmt_url = os.path.join(url, \"{db}?{name}\")\n            fmt_url = fmt_url.format(name=urllib.parse.quote(name), db=db)\n            urls.append(fmt_url)\n\n    exceptions = []\n    for url in urls:\n        try:\n            resp_data = get_file_contents(\n                download_file(url, cache=cache, show_progress=False))\n            break\n        except urllib.error.URLError as e:\n            exceptions.append(e)\n            continue\n        except socket.timeout as e:\n            # There are some cases where urllib2 does not catch socket.timeout\n            # especially while receiving response data on an already previously\n            # working request\n            e.reason = (\"Request took longer than the allowed \"\n                        f\"{data.conf.remote_timeout:.1f} seconds\")\n            exceptions.append(e)\n            continue\n\n    # All Sesame URL's failed...\n    else:\n        messages = [f\"{url}: {e.reason}\"\n                    for url, e in zip(urls, exceptions)]\n        raise NameResolveError(\"All Sesame queries failed. Unable to \"\n                               \"retrieve coordinates. See errors per URL \"\n                               f\"below: \\n {os.linesep.join(messages)}\")\n\n    ra, dec = _parse_response(resp_data)\n\n    if ra is None or dec is None:\n        if db == \"A\":\n            err = f\"Unable to find coordinates for name '{name}' using {url}\"\n        else:\n            err = f\"Unable to find coordinates for name '{name}' in database {database} using {url}\"\n\n        raise NameResolveError(err)\n\n    # Return SkyCoord object\n    sc = SkyCoord(ra=ra, dec=dec, unit=(u.degree, u.degree), frame='icrs')\n    return sc\n"},{"attributeType":"None","col":8,"comment":"null","endLoc":974,"id":15422,"name":"finite_difference_frameattr_name","nodeType":"Attribute","startLoc":974,"text":"self.finite_difference_frameattr_name"},{"className":"sesame_url","col":0,"comment":"\n    The URL(s) to Sesame's web-queryable database.\n    ","endLoc":39,"id":15423,"nodeType":"Class","startLoc":29,"text":"class sesame_url(ScienceState):\n    \"\"\"\n    The URL(s) to Sesame's web-queryable database.\n    \"\"\"\n    _value = [\"http://cdsweb.u-strasbg.fr/cgi-bin/nph-sesame/\",\n              \"http://vizier.cfa.harvard.edu/viz-bin/nph-sesame/\"]\n\n    @classmethod\n    def validate(cls, value):\n        # TODO: Implement me\n        return value"},{"col":4,"comment":"null","endLoc":39,"header":"@classmethod\n    def validate(cls, value)","id":15424,"name":"validate","nodeType":"Function","startLoc":36,"text":"@classmethod\n    def validate(cls, value):\n        # TODO: Implement me\n        return value"},{"attributeType":"null","col":4,"comment":"null","endLoc":33,"id":15425,"name":"_value","nodeType":"Attribute","startLoc":33,"text":"_value"},{"className":"sesame_database","col":0,"comment":"\n    This specifies the default database that SESAME will query when\n    using the name resolve mechanism in the coordinates\n    subpackage. Default is to search all databases, but this can be\n    'all', 'simbad', 'ned', or 'vizier'.\n    ","endLoc":55,"id":15426,"nodeType":"Class","startLoc":42,"text":"class sesame_database(ScienceState):\n    \"\"\"\n    This specifies the default database that SESAME will query when\n    using the name resolve mechanism in the coordinates\n    subpackage. Default is to search all databases, but this can be\n    'all', 'simbad', 'ned', or 'vizier'.\n    \"\"\"\n    _value = 'all'\n\n    @classmethod\n    def validate(cls, value):\n        if value not in ['all', 'simbad', 'ned', 'vizier']:\n            raise ValueError(f\"Unknown database '{value}'\")\n        return value"},{"col":4,"comment":"null","endLoc":55,"header":"@classmethod\n    def validate(cls, value)","id":15427,"name":"validate","nodeType":"Function","startLoc":51,"text":"@classmethod\n    def validate(cls, value):\n        if value not in ['all', 'simbad', 'ned', 'vizier']:\n            raise ValueError(f\"Unknown database '{value}'\")\n        return value"},{"attributeType":"null","col":8,"comment":"null","endLoc":975,"id":15428,"name":"finite_difference_dt","nodeType":"Attribute","startLoc":975,"text":"self.finite_difference_dt"},{"attributeType":"null","col":8,"comment":"null","endLoc":976,"id":15429,"name":"symmetric_finite_difference","nodeType":"Attribute","startLoc":976,"text":"self.symmetric_finite_difference"},{"attributeType":"null","col":4,"comment":"null","endLoc":49,"id":15430,"name":"_value","nodeType":"Attribute","startLoc":49,"text":"_value"},{"className":"NameResolveError","col":0,"comment":"null","endLoc":59,"id":15431,"nodeType":"Class","startLoc":58,"text":"class NameResolveError(Exception):\n    pass"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":15432,"name":"__all__","nodeType":"Attribute","startLoc":26,"text":"__all__"},{"col":0,"comment":"","endLoc":9,"header":"name_resolve.py#<anonymous>","id":15433,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module contains convenience functions for getting a coordinate object\nfor a named object by querying SESAME and getting the first returned result.\nNote that this is intended to be a convenience, and is very simple. If you\nneed precise coordinates for an object you should find the appropriate\nreference for that measurement and input the coordinates manually.\n\"\"\"\n\n__all__ = [\"get_icrs_coordinates\"]"},{"attributeType":"None","col":8,"comment":"null","endLoc":997,"id":15434,"name":"_finite_difference_frameattr_name","nodeType":"Attribute","startLoc":997,"text":"self._finite_difference_frameattr_name"},{"id":15435,"name":"astropy/coordinates/data","nodeType":"Package"},{"id":15436,"name":"sites.json","nodeType":"TextFile","path":"astropy/coordinates/data","text":"{\n    \"greenwich\": {\n        \"source\": \"Ordnance Survey via http://gpsinformation.net/main/greenwich.htm and UNESCO\",\n        \"elevation\": 46,\n        \"name\": \"Royal Observatory Greenwich\",\n        \"longitude_unit\": \"degree\",\n        \"latitude_unit\": \"degree\",\n        \"latitude\": 51.477811,\n        \"elevation_unit\": \"meter\",\n        \"longitude\": -0.001475,\n        \"aliases\": [\n            \"example_site\"\n        ]\n    }\n}\n"},{"id":15437,"name":"constellation_names.dat","nodeType":"TextFile","path":"astropy/coordinates/data","text":"# This list gives the official IAU constellation names via vizier:  http://vizier.u-strasbg.fr/vizier/VizieR/constellations.htx\nAnd Andromeda\nAnt Antlia\nAps Apus\nAqr Aquarius\nAql Aquila\nAra Ara\nAri Aries\nAur Auriga\nBoo Boötes\nCae Caelum\nCam Camelopardalis\nCnc Cancer\nCVn Canes Venatici\nCMa Canis Major\nCMi Canis Minor\nCap Capricornus\nCar Carina\nCas Cassiopeia\nCen Centaurus\nCep Cepheus\nCet Cetus\nCha Chamaleon\nCir Circinus\nCol Columba\nCom Coma Berenices\nCrA Corona Australis\nCrB Corona Borealis\nCrv Corvus\nCrt Crater\nCru Crux \nCyg Cygnus\nDel Delphinus\nDor Dorado\nDra Draco\nEqu Equuleus\nEri Eridanus\nFor Fornax\nGem Gemini\nGru Grus\nHer Hercules\nHor Horologium\nHya Hydra\nHyi Hydrus\nInd Indus\nLac Lacerta\nLeo Leo\nLMi Leo Minor\nLep Lepus\nLib Libra\nLup Lupus\nLyn Lynx\nLyr Lyra\nMen Mensa\nMic Microscopium\nMon Monoceros\nMus Musca\nNor Norma\nOct Octans\nOph Ophiucus\nOri Orion\nPav Pavo\nPeg Pegasus\nPer Perseus\nPhe Phoenix\nPic Pictor\nPsc Pisces\nPsA Pisces Austrinus\nPup Puppis\nPyx Pyxis\nRet Reticulum\nSge Sagitta\nSgr Sagittarius\nSco Scorpius\nScl Sculptor\nSct Scutum\nSer Serpens\nSex Sextans\nTau Taurus\nTel Telescopium\nTri Triangulum\nTrA Triangulum Australe\nTuc Tucana\nUMa Ursa Major\nUMi Ursa Minor\nVel Vela\nVir Virgo\nVol Volans\nVul Vulpecula"},{"id":15438,"name":"constellation_data_roman87.dat","nodeType":"TextFile","path":"astropy/coordinates/data","text":"# This data file is from Roman et al. 1987: http://cdsarc.u-strasbg.fr/viz-bin/Cat?VI/42\n  0.0000 24.0000  88.0000 UMi\n  8.0000 14.5000  86.5000 UMi\n 21.0000 23.0000  86.1667 UMi\n 18.0000 21.0000  86.0000 UMi\n  0.0000  8.0000  85.0000 Cep\n  9.1667 10.6667  82.0000 Cam\n  0.0000  5.0000  80.0000 Cep\n 10.6667 14.5000  80.0000 Cam\n 17.5000 18.0000  80.0000 UMi\n 20.1667 21.0000  80.0000 Dra\n  0.0000  3.5083  77.0000 Cep\n 11.5000 13.5833  77.0000 Cam\n 16.5333 17.5000  75.0000 UMi\n 20.1667 20.6667  75.0000 Cep\n  7.9667  9.1667  73.5000 Cam\n  9.1667 11.3333  73.5000 Dra\n 13.0000 16.5333  70.0000 UMi\n  3.1000  3.4167  68.0000 Cas\n 20.4167 20.6667  67.0000 Dra\n 11.3333 12.0000  66.5000 Dra\n  0.0000  0.3333  66.0000 Cep\n 14.0000 15.6667  66.0000 UMi\n 23.5833 24.0000  66.0000 Cep\n 12.0000 13.5000  64.0000 Dra\n 13.5000 14.4167  63.0000 Dra\n 23.1667 23.5833  63.0000 Cep\n  6.1000  7.0000  62.0000 Cam\n 20.0000 20.4167  61.5000 Dra\n 20.5367 20.6000  60.9167 Cep\n  7.0000  7.9667  60.0000 Cam\n  7.9667  8.4167  60.0000 UMa\n 19.7667 20.0000  59.5000 Dra\n 20.0000 20.5367  59.5000 Cep\n 22.8667 23.1667  59.0833 Cep\n  0.0000  2.4333  58.5000 Cas\n 19.4167 19.7667  58.0000 Dra\n  1.7000  1.9083  57.5000 Cas\n  2.4333  3.1000  57.0000 Cas\n  3.1000  3.1667  57.0000 Cam\n 22.3167 22.8667  56.2500 Cep\n  5.0000  6.1000  56.0000 Cam\n 14.0333 14.4167  55.5000 UMa\n 14.4167 19.4167  55.5000 Dra\n  3.1667  3.3333  55.0000 Cam\n 22.1333 22.3167  55.0000 Cep\n 20.6000 21.9667  54.8333 Cep\n  0.0000  1.7000  54.0000 Cas\n  6.1000  6.5000  54.0000 Lyn\n 12.0833 13.5000  53.0000 UMa\n 15.2500 15.7500  53.0000 Dra\n 21.9667 22.1333  52.7500 Cep\n  3.3333  5.0000  52.5000 Cam\n 22.8667 23.3333  52.5000 Cas\n 15.7500 17.0000  51.5000 Dra\n  2.0417  2.5167  50.5000 Per\n 17.0000 18.2333  50.5000 Dra\n  0.0000  1.3667  50.0000 Cas\n  1.3667  1.6667  50.0000 Per\n  6.5000  6.8000  50.0000 Lyn\n 23.3333 24.0000  50.0000 Cas\n 13.5000 14.0333  48.5000 UMa\n  0.0000  1.1167  48.0000 Cas\n 23.5833 24.0000  48.0000 Cas\n 18.1750 18.2333  47.5000 Her\n 18.2333 19.0833  47.5000 Dra\n 19.0833 19.1667  47.5000 Cyg\n  1.6667  2.0417  47.0000 Per\n  8.4167  9.1667  47.0000 UMa\n  0.1667  0.8667  46.0000 Cas\n 12.0000 12.0833  45.0000 UMa\n  6.8000  7.3667  44.5000 Lyn\n 21.9083 21.9667  44.0000 Cyg\n 21.8750 21.9083  43.7500 Cyg\n 19.1667 19.4000  43.5000 Cyg\n  9.1667 10.1667  42.0000 UMa\n 10.1667 10.7833  40.0000 UMa\n 15.4333 15.7500  40.0000 Boo\n 15.7500 16.3333  40.0000 Her\n  9.2500  9.5833  39.7500 Lyn\n  0.0000  2.5167  36.7500 And\n  2.5167  2.5667  36.7500 Per\n 19.3583 19.4000  36.5000 Lyr\n  4.5000  4.6917  36.0000 Per\n 21.7333 21.8750  36.0000 Cyg\n 21.8750 22.0000  36.0000 Lac\n  6.5333  7.3667  35.5000 Aur\n  7.3667  7.7500  35.5000 Lyn\n  0.0000  2.0000  35.0000 And\n 22.0000 22.8167  35.0000 Lac\n 22.8167 22.8667  34.5000 Lac\n 22.8667 23.5000  34.5000 And\n  2.5667  2.7167  34.0000 Per\n 10.7833 11.0000  34.0000 UMa\n 12.0000 12.3333  34.0000 CVn\n  7.7500  9.2500  33.5000 Lyn\n  9.2500  9.8833  33.5000 LMi\n  0.7167  1.4083  33.0000 And\n 15.1833 15.4333  33.0000 Boo\n 23.5000 23.7500  32.0833 And\n 12.3333 13.2500  32.0000 CVn\n 23.7500 24.0000  31.3333 And\n 13.9583 14.0333  30.7500 CVn\n  2.4167  2.7167  30.6667 Tri\n  2.7167  4.5000  30.6667 Per\n  4.5000  4.7500  30.0000 Aur\n 18.1750 19.3583  30.0000 Lyr\n 11.0000 12.0000  29.0000 UMa\n 19.6667 20.9167  29.0000 Cyg\n  4.7500  5.8833  28.5000 Aur\n  9.8833 10.5000  28.5000 LMi\n 13.2500 13.9583  28.5000 CVn\n  0.0000  0.0667  28.0000 And\n  1.4083  1.6667  28.0000 Tri\n  5.8833  6.5333  28.0000 Aur\n  7.8833  8.0000  28.0000 Gem\n 20.9167 21.7333  28.0000 Cyg\n 19.2583 19.6667  27.5000 Cyg\n  1.9167  2.4167  27.2500 Tri\n 16.1667 16.3333  27.0000 CrB\n 15.0833 15.1833  26.0000 Boo\n 15.1833 16.1667  26.0000 CrB\n 18.3667 18.8667  26.0000 Lyr\n 10.7500 11.0000  25.5000 LMi\n 18.8667 19.2583  25.5000 Lyr\n  1.6667  1.9167  25.0000 Tri\n  0.7167  0.8500  23.7500 Psc\n 10.5000 10.7500  23.5000 LMi\n 21.2500 21.4167  23.5000 Vul\n  5.7000  5.8833  22.8333 Tau\n  0.0667  0.1417  22.0000 And\n 15.9167 16.0333  22.0000 Ser\n  5.8833  6.2167  21.5000 Gem\n 19.8333 20.2500  21.2500 Vul\n 18.8667 19.2500  21.0833 Vul\n  0.1417  0.8500  21.0000 And\n 20.2500 20.5667  20.5000 Vul\n  7.8083  7.8833  20.0000 Gem\n 20.5667 21.2500  19.5000 Vul\n 19.2500 19.8333  19.1667 Vul\n  3.2833  3.3667  19.0000 Ari\n 18.8667 19.0000  18.5000 Sge\n  5.7000  5.7667  18.0000 Ori\n  6.2167  6.3083  17.5000 Gem\n 19.0000 19.8333  16.1667 Sge\n  4.9667  5.3333  16.0000 Tau\n 15.9167 16.0833  16.0000 Her\n 19.8333 20.2500  15.7500 Sge\n  4.6167  4.9667  15.5000 Tau\n  5.3333  5.6000  15.5000 Tau\n 12.8333 13.5000  15.0000 Com\n 17.2500 18.2500  14.3333 Her\n 11.8667 12.8333  14.0000 Com\n  7.5000  7.8083  13.5000 Gem\n 16.7500 17.2500  12.8333 Her\n  0.0000  0.1417  12.5000 Peg\n  5.6000  5.7667  12.5000 Tau\n  7.0000  7.5000  12.5000 Gem\n 21.1167 21.3333  12.5000 Peg\n  6.3083  6.9333  12.0000 Gem\n 18.2500 18.8667  12.0000 Her\n 20.8750 21.0500  11.8333 Del\n 21.0500 21.1167  11.8333 Peg\n 11.5167 11.8667  11.0000 Leo\n  6.2417  6.3083  10.0000 Ori\n  6.9333  7.0000  10.0000 Gem\n  7.8083  7.9250  10.0000 Cnc\n 23.8333 24.0000  10.0000 Peg\n  1.6667  3.2833   9.9167 Ari\n 20.1417 20.3000   8.5000 Del\n 13.5000 15.0833   8.0000 Boo\n 22.7500 23.8333   7.5000 Peg\n  7.9250  9.2500   7.0000 Cnc\n  9.2500 10.7500   7.0000 Leo\n 18.2500 18.6622   6.2500 Oph\n 18.6622 18.8667   6.2500 Aql\n 20.8333 20.8750   6.0000 Del\n  7.0000  7.0167   5.5000 CMi\n 18.2500 18.4250   4.5000 Ser\n 16.0833 16.7500   4.0000 Her\n 18.2500 18.4250   3.0000 Oph\n 21.4667 21.6667   2.7500 Peg\n  0.0000  2.0000   2.0000 Psc\n 18.5833 18.8667   2.0000 Ser\n 20.3000 20.8333   2.0000 Del\n 20.8333 21.3333   2.0000 Equ\n 21.3333 21.4667   2.0000 Peg\n 22.0000 22.7500   2.0000 Peg\n 21.6667 22.0000   1.7500 Peg\n  7.0167  7.2000   1.5000 CMi\n  3.5833  4.6167   0.0000 Tau\n  4.6167  4.6667   0.0000 Ori\n  7.2000  8.0833   0.0000 CMi\n 14.6667 15.0833   0.0000 Vir\n 17.8333 18.2500   0.0000 Oph\n  2.6500  3.2833 -01.7500 Cet\n  3.2833  3.5833 -01.7500 Tau\n 15.0833 16.2667 -03.2500 Ser\n  4.6667  5.0833 -04.0000 Ori\n  5.8333  6.2417 -04.0000 Ori\n 17.8333 17.9667 -04.0000 Ser\n 18.2500 18.5833 -04.0000 Ser\n 18.5833 18.8667 -04.0000 Aql\n 22.7500 23.8333 -04.0000 Psc\n 10.7500 11.5167 -06.0000 Leo\n 11.5167 11.8333 -06.0000 Vir\n  0.0000 00.3333 -07.0000 Psc\n 23.8333 24.0000 -07.0000 Psc\n 14.2500 14.6667 -08.0000 Vir\n 15.9167 16.2667 -08.0000 Oph\n 20.0000 20.5333 -09.0000 Aql\n 21.3333 21.8667 -09.0000 Aqr\n 17.1667 17.9667 -10.0000 Oph\n  5.8333  8.0833 -11.0000 Mon\n  4.9167  5.0833 -11.0000 Eri\n  5.0833  5.8333 -11.0000 Ori\n  8.0833  8.3667 -11.0000 Hya\n  9.5833 10.7500 -11.0000 Sex\n 11.8333 12.8333 -11.0000 Vir\n 17.5833 17.6667 -11.6667 Oph\n 18.8667 20.0000 -12.0333 Aql\n  4.8333  4.9167 -14.5000 Eri\n 20.5333 21.3333 -15.0000 Aqr\n 17.1667 18.2500 -16.0000 Ser\n 18.2500 18.8667 -16.0000 Sct\n  8.3667  8.5833 -17.0000 Hya\n 16.2667 16.3750 -18.2500 Oph\n  8.5833  9.0833 -19.0000 Hya\n 10.7500 10.8333 -19.0000 Crt\n 16.2667 16.3750 -19.2500 Sco\n 15.6667 15.9167 -20.0000 Lib\n 12.5833 12.8333 -22.0000 Crv\n 12.8333 14.2500 -22.0000 Vir\n  9.0833  9.7500 -24.0000 Hya\n  1.6667  2.6500 -24.3833 Cet\n  2.6500  3.7500 -24.3833 Eri\n 10.8333 11.8333 -24.5000 Crt\n 11.8333 12.5833 -24.5000 Crv\n 14.2500 14.9167 -24.5000 Lib\n 16.2667 16.7500 -24.5833 Oph\n  0.0000  1.6667 -25.5000 Cet\n 21.3333 21.8667 -25.5000 Cap\n 21.8667 23.8333 -25.5000 Aqr\n 23.8333 24.0000 -25.5000 Cet\n  9.7500 10.2500 -26.5000 Hya\n  4.7000  4.8333 -27.2500 Eri\n  4.8333  6.1167 -27.2500 Lep\n 20.0000 21.3333 -28.0000 Cap\n 10.2500 10.5833 -29.1667 Hya\n 12.5833 14.9167 -29.5000 Hya\n 14.9167 15.6667 -29.5000 Lib\n 15.6667 16.0000 -29.5000 Sco\n  4.5833  4.7000 -30.0000 Eri\n 16.7500 17.6000 -30.0000 Oph\n 17.6000 17.8333 -30.0000 Sgr\n 10.5833 10.8333 -31.1667 Hya\n  6.1167  7.3667 -33.0000 CMa\n 12.2500 12.5833 -33.0000 Hya\n 10.8333 12.2500 -35.0000 Hya\n  3.5000  3.7500 -36.0000 For\n  8.3667  9.3667 -36.7500 Pyx\n  4.2667  4.5833 -37.0000 Eri\n 17.8333 19.1667 -37.0000 Sgr\n 21.3333 23.0000 -37.0000 PsA\n 23.0000 23.3333 -37.0000 Scl\n  3.0000  3.5000 -39.5833 For\n  9.3667 11.0000 -39.7500 Ant\n  0.0000  1.6667 -40.0000 Scl\n  1.6667  3.0000 -40.0000 For\n  3.8667  4.2667 -40.0000 Eri\n 23.3333 24.0000 -40.0000 Scl\n 14.1667 14.9167 -42.0000 Cen\n 15.6667 16.0000 -42.0000 Lup\n 16.0000 16.4208 -42.0000 Sco\n  4.8333  5.0000 -43.0000 Cae\n  5.0000  6.5833 -43.0000 Col\n  8.0000  8.3667 -43.0000 Pup\n  3.4167  3.8667 -44.0000 Eri\n 16.4208 17.8333 -45.5000 Sco\n 17.8333 19.1667 -45.5000 CrA\n 19.1667 20.3333 -45.5000 Sgr\n 20.3333 21.3333 -45.5000 Mic\n  3.0000  3.4167 -46.0000 Eri\n  4.5000  4.8333 -46.5000 Cae\n 15.3333 15.6667 -48.0000 Lup\n  0.0000  2.3333 -48.1667 Phe\n  2.6667  3.0000 -49.0000 Eri\n  4.0833  4.2667 -49.0000 Hor\n  4.2667  4.5000 -49.0000 Cae\n 21.3333 22.0000 -50.0000 Gru\n  6.0000  8.0000 -50.7500 Pup\n  8.0000  8.1667 -50.7500 Vel\n  2.4167  2.6667 -51.0000 Eri\n  3.8333  4.0833 -51.0000 Hor\n  0.0000  1.8333 -51.5000 Phe\n  6.0000  6.1667 -52.5000 Car\n  8.1667  8.4500 -53.0000 Vel\n  3.5000  3.8333 -53.1667 Hor\n  3.8333  4.0000 -53.1667 Dor\n  0.0000  1.5833 -53.5000 Phe\n  2.1667  2.4167 -54.0000 Eri\n  4.5000  5.0000 -54.0000 Pic\n 15.0500 15.3333 -54.0000 Lup\n  8.4500  8.8333 -54.5000 Vel\n  6.1667  6.5000 -55.0000 Car\n 11.8333 12.8333 -55.0000 Cen\n 14.1667 15.0500 -55.0000 Lup\n 15.0500 15.3333 -55.0000 Nor\n  4.0000  4.3333 -56.5000 Dor\n  8.8333 11.0000 -56.5000 Vel\n 11.0000 11.2500 -56.5000 Cen\n 17.5000 18.0000 -57.0000 Ara\n 18.0000 20.3333 -57.0000 Tel\n 22.0000 23.3333 -57.0000 Gru\n  3.2000  3.5000 -57.5000 Hor\n  5.0000  5.5000 -57.5000 Pic\n  6.5000  6.8333 -58.0000 Car\n  0.0000  1.3333 -58.5000 Phe\n  1.3333  2.1667 -58.5000 Eri\n 23.3333 24.0000 -58.5000 Phe\n  4.3333  4.5833 -59.0000 Dor\n 15.3333 16.4208 -60.0000 Nor\n 20.3333 21.3333 -60.0000 Ind\n  5.5000  6.0000 -61.0000 Pic\n 15.1667 15.3333 -61.0000 Cir\n 16.4208 16.5833 -61.0000 Ara\n 14.9167 15.1667 -63.5833 Cir\n 16.5833 16.7500 -63.5833 Ara\n  6.0000  6.8333 -64.0000 Pic\n  6.8333  9.0333 -64.0000 Car\n 11.2500 11.8333 -64.0000 Cen\n 11.8333 12.8333 -64.0000 Cru\n 12.8333 14.5333 -64.0000 Cen\n 13.5000 13.6667 -65.0000 Cir\n 16.7500 16.8333 -65.0000 Ara\n  2.1667  3.2000 -67.5000 Hor\n  3.2000  4.5833 -67.5000 Ret\n 14.7500 14.9167 -67.5000 Cir\n 16.8333 17.5000 -67.5000 Ara\n 17.5000 18.0000 -67.5000 Pav\n 22.0000 23.3333 -67.5000 Tuc\n  4.5833  6.5833 -70.0000 Dor\n 13.6667 14.7500 -70.0000 Cir\n 14.7500 17.0000 -70.0000 TrA\n  0.0000  1.3333 -75.0000 Tuc\n  3.5000  4.5833 -75.0000 Hyi\n  6.5833  9.0333 -75.0000 Vol\n  9.0333 11.2500 -75.0000 Car\n 11.2500 13.6667 -75.0000 Mus\n 18.0000 21.3333 -75.0000 Pav\n 21.3333 23.3333 -75.0000 Ind\n 23.3333 24.0000 -75.0000 Tuc\n  0.7500  1.3333 -76.0000 Tuc\n  0.0000  3.5000 -82.5000 Hyi\n  7.6667 13.6667 -82.5000 Cha\n 13.6667 18.0000 -82.5000 Aps\n  3.5000  7.6667 -85.0000 Men\n  0.0000 24.0000 -90.0000 Oct\n"},{"className":"CoordinateAttribute","col":0,"comment":"\n    A frame attribute which is a coordinate object.  It can be given as a\n    `~astropy.coordinates.SkyCoord` or a low-level frame instance.  If a\n    low-level frame instance is provided, it will always be upgraded to be a\n    `~astropy.coordinates.SkyCoord` to ensure consistent transformation\n    behavior.  The coordinate object will always be returned as a low-level\n    frame instance when accessed.\n\n    Parameters\n    ----------\n    frame : `~astropy.coordinates.BaseCoordinateFrame` class\n        The type of frame this attribute can be\n    default : object\n        Default value for the attribute if not provided\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    ","endLoc":453,"id":15439,"nodeType":"Class","startLoc":399,"text":"class CoordinateAttribute(Attribute):\n    \"\"\"\n    A frame attribute which is a coordinate object.  It can be given as a\n    `~astropy.coordinates.SkyCoord` or a low-level frame instance.  If a\n    low-level frame instance is provided, it will always be upgraded to be a\n    `~astropy.coordinates.SkyCoord` to ensure consistent transformation\n    behavior.  The coordinate object will always be returned as a low-level\n    frame instance when accessed.\n\n    Parameters\n    ----------\n    frame : `~astropy.coordinates.BaseCoordinateFrame` class\n        The type of frame this attribute can be\n    default : object\n        Default value for the attribute if not provided\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    \"\"\"\n\n    def __init__(self, frame, default=None, secondary_attribute=''):\n        self._frame = frame\n        super().__init__(default, secondary_attribute)\n\n    def convert_input(self, value):\n        \"\"\"\n        Checks that the input is a SkyCoord with the necessary units (or the\n        special value ``None``).\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n        from astropy.coordinates import SkyCoord\n\n        if value is None:\n            return None, False\n        elif isinstance(value, self._frame):\n            return value, False\n        else:\n            value = SkyCoord(value)  # always make the value a SkyCoord\n            transformedobj = value.transform_to(self._frame)\n            return transformedobj.frame, True"},{"col":4,"comment":"\n        Checks that the input is a SkyCoord with the necessary units (or the\n        special value ``None``).\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        ","endLoc":453,"header":"def convert_input(self, value)","id":15440,"name":"convert_input","nodeType":"Function","startLoc":423,"text":"def convert_input(self, value):\n        \"\"\"\n        Checks that the input is a SkyCoord with the necessary units (or the\n        special value ``None``).\n\n        Parameters\n        ----------\n        value : object\n            Input value to be converted.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n        from astropy.coordinates import SkyCoord\n\n        if value is None:\n            return None, False\n        elif isinstance(value, self._frame):\n            return value, False\n        else:\n            value = SkyCoord(value)  # always make the value a SkyCoord\n            transformedobj = value.transform_to(self._frame)\n            return transformedobj.frame, True"},{"attributeType":"null","col":41,"comment":"null","endLoc":985,"id":15441,"name":"_diff_attr_in_tosys","nodeType":"Attribute","startLoc":985,"text":"self._diff_attr_in_tosys"},{"attributeType":"null","col":12,"comment":"null","endLoc":985,"id":15442,"name":"_diff_attr_in_fromsys","nodeType":"Attribute","startLoc":985,"text":"self._diff_attr_in_fromsys"},{"className":"BaseAffineTransform","col":0,"comment":"Base class for common functionality between the ``AffineTransform``-type\n    subclasses.\n\n    This base class is needed because ``AffineTransform`` and the matrix\n    transform classes share the ``__call__()`` method, but differ in how they\n    generate the affine parameters.  ``StaticMatrixTransform`` passes in a\n    matrix stored as a class attribute, and both of the matrix transforms pass\n    in ``None`` for the offset. Hence, user subclasses would likely want to\n    subclass this (rather than ``AffineTransform``) if they want to provide\n    alternative transformations using this machinery.\n    ","endLoc":1259,"id":15443,"nodeType":"Class","startLoc":1084,"text":"class BaseAffineTransform(CoordinateTransform):\n    \"\"\"Base class for common functionality between the ``AffineTransform``-type\n    subclasses.\n\n    This base class is needed because ``AffineTransform`` and the matrix\n    transform classes share the ``__call__()`` method, but differ in how they\n    generate the affine parameters.  ``StaticMatrixTransform`` passes in a\n    matrix stored as a class attribute, and both of the matrix transforms pass\n    in ``None`` for the offset. Hence, user subclasses would likely want to\n    subclass this (rather than ``AffineTransform``) if they want to provide\n    alternative transformations using this machinery.\n    \"\"\"\n\n    def _apply_transform(self, fromcoord, matrix, offset):\n        from .representation import (UnitSphericalRepresentation,\n                                     CartesianDifferential,\n                                     SphericalDifferential,\n                                     SphericalCosLatDifferential,\n                                     RadialDifferential)\n\n        data = fromcoord.data\n        has_velocity = 's' in data.differentials\n\n        # Bail out if no transform is actually requested\n        if matrix is None and offset is None:\n            return data\n\n        # list of unit differentials\n        _unit_diffs = (SphericalDifferential._unit_differential,\n                       SphericalCosLatDifferential._unit_differential)\n        unit_vel_diff = (has_velocity and\n                         isinstance(data.differentials['s'], _unit_diffs))\n        rad_vel_diff = (has_velocity and\n                        isinstance(data.differentials['s'], RadialDifferential))\n\n        # Some initial checking to short-circuit doing any re-representation if\n        # we're going to fail anyways:\n        if isinstance(data, UnitSphericalRepresentation) and offset is not None:\n            raise TypeError(\"Position information stored on coordinate frame \"\n                            \"is insufficient to do a full-space position \"\n                            \"transformation (representation class: {})\"\n                            .format(data.__class__))\n\n        elif (has_velocity and (unit_vel_diff or rad_vel_diff) and\n              offset is not None and 's' in offset.differentials):\n            # Coordinate has a velocity, but it is not a full-space velocity\n            # that we need to do a velocity offset\n            raise TypeError(\"Velocity information stored on coordinate frame \"\n                            \"is insufficient to do a full-space velocity \"\n                            \"transformation (differential class: {})\"\n                            .format(data.differentials['s'].__class__))\n\n        elif len(data.differentials) > 1:\n            # We should never get here because the frame initializer shouldn't\n            # allow more differentials, but this just adds protection for\n            # subclasses that somehow skip the checks\n            raise ValueError(\"Representation passed to AffineTransform contains\"\n                             \" multiple associated differentials. Only a single\"\n                             \" differential with velocity units is presently\"\n                             \" supported (differentials: {}).\"\n                             .format(str(data.differentials)))\n\n        # If the representation is a UnitSphericalRepresentation, and this is\n        # just a MatrixTransform, we have to try to turn the differential into a\n        # Unit version of the differential (if no radial velocity) or a\n        # sphericaldifferential with zero proper motion (if only a radial\n        # velocity) so that the matrix operation works\n        if (has_velocity and isinstance(data, UnitSphericalRepresentation) and\n                not unit_vel_diff and not rad_vel_diff):\n            # retrieve just velocity differential\n            unit_diff = data.differentials['s'].represent_as(\n                data.differentials['s']._unit_differential, data)\n            data = data.with_differentials({'s': unit_diff})  # updates key\n\n        # If it's a RadialDifferential, we flat-out ignore the differentials\n        # This is because, by this point (past the validation above), we can\n        # only possibly be doing a rotation-only transformation, and that\n        # won't change the radial differential. We later add it back in\n        elif rad_vel_diff:\n            data = data.without_differentials()\n\n        # Convert the representation and differentials to cartesian without\n        # having them attached to a frame\n        rep = data.to_cartesian()\n        diffs = dict([(k, diff.represent_as(CartesianDifferential, data))\n                      for k, diff in data.differentials.items()])\n        rep = rep.with_differentials(diffs)\n\n        # Only do transform if matrix is specified. This is for speed in\n        # transformations that only specify an offset (e.g., LSR)\n        if matrix is not None:\n            # Note: this applies to both representation and differentials\n            rep = rep.transform(matrix)\n\n        # TODO: if we decide to allow arithmetic between representations that\n        # contain differentials, this can be tidied up\n        if offset is not None:\n            newrep = (rep.without_differentials() +\n                      offset.without_differentials())\n        else:\n            newrep = rep.without_differentials()\n\n        # We need a velocity (time derivative) and, for now, are strict: the\n        # representation can only contain a velocity differential and no others.\n        if has_velocity and not rad_vel_diff:\n            veldiff = rep.differentials['s']  # already in Cartesian form\n\n            if offset is not None and 's' in offset.differentials:\n                veldiff = veldiff + offset.differentials['s']\n\n            newrep = newrep.with_differentials({'s': veldiff})\n\n        if isinstance(fromcoord.data, UnitSphericalRepresentation):\n            # Special-case this because otherwise the return object will think\n            # it has a valid distance with the default return (a\n            # CartesianRepresentation instance)\n\n            if has_velocity and not unit_vel_diff and not rad_vel_diff:\n                # We have to first represent as the Unit types we converted to,\n                # then put the d_distance information back in to the\n                # differentials and re-represent as their original forms\n                newdiff = newrep.differentials['s']\n                _unit_cls = fromcoord.data.differentials['s']._unit_differential\n                newdiff = newdiff.represent_as(_unit_cls, newrep)\n\n                kwargs = dict([(comp, getattr(newdiff, comp))\n                               for comp in newdiff.components])\n                kwargs['d_distance'] = fromcoord.data.differentials['s'].d_distance\n                diffs = {'s': fromcoord.data.differentials['s'].__class__(\n                    copy=False, **kwargs)}\n\n            elif has_velocity and unit_vel_diff:\n                newdiff = newrep.differentials['s'].represent_as(\n                    fromcoord.data.differentials['s'].__class__, newrep)\n                diffs = {'s': newdiff}\n\n            else:\n                diffs = newrep.differentials\n\n            newrep = newrep.represent_as(fromcoord.data.__class__)  # drops diffs\n            newrep = newrep.with_differentials(diffs)\n\n        elif has_velocity and unit_vel_diff:\n            # Here, we're in the case where the representation is not\n            # UnitSpherical, but the differential *is* one of the UnitSpherical\n            # types. We have to convert back to that differential class or the\n            # resulting frame will think it has a valid radial_velocity. This\n            # can probably be cleaned up: we currently have to go through the\n            # dimensional version of the differential before representing as the\n            # unit differential so that the units work out (the distance length\n            # unit shouldn't appear in the resulting proper motions)\n\n            diff_cls = fromcoord.data.differentials['s'].__class__\n            newrep = newrep.represent_as(fromcoord.data.__class__,\n                                         diff_cls._dimensional_differential)\n            newrep = newrep.represent_as(fromcoord.data.__class__, diff_cls)\n\n        # We pulled the radial differential off of the representation\n        # earlier, so now we need to put it back. But, in order to do that, we\n        # have to turn the representation into a repr that is compatible with\n        # having a RadialDifferential\n        if has_velocity and rad_vel_diff:\n            newrep = newrep.represent_as(fromcoord.data.__class__)\n            newrep = newrep.with_differentials(\n                {'s': fromcoord.data.differentials['s']})\n\n        return newrep\n\n    def __call__(self, fromcoord, toframe):\n        params = self._affine_params(fromcoord, toframe)\n        newrep = self._apply_transform(fromcoord, *params)\n        return toframe.realize_frame(newrep)\n\n    @abstractmethod\n    def _affine_params(self, fromcoord, toframe):\n        pass"},{"col":4,"comment":"null","endLoc":1250,"header":"def _apply_transform(self, fromcoord, matrix, offset)","id":15444,"name":"_apply_transform","nodeType":"Function","startLoc":1097,"text":"def _apply_transform(self, fromcoord, matrix, offset):\n        from .representation import (UnitSphericalRepresentation,\n                                     CartesianDifferential,\n                                     SphericalDifferential,\n                                     SphericalCosLatDifferential,\n                                     RadialDifferential)\n\n        data = fromcoord.data\n        has_velocity = 's' in data.differentials\n\n        # Bail out if no transform is actually requested\n        if matrix is None and offset is None:\n            return data\n\n        # list of unit differentials\n        _unit_diffs = (SphericalDifferential._unit_differential,\n                       SphericalCosLatDifferential._unit_differential)\n        unit_vel_diff = (has_velocity and\n                         isinstance(data.differentials['s'], _unit_diffs))\n        rad_vel_diff = (has_velocity and\n                        isinstance(data.differentials['s'], RadialDifferential))\n\n        # Some initial checking to short-circuit doing any re-representation if\n        # we're going to fail anyways:\n        if isinstance(data, UnitSphericalRepresentation) and offset is not None:\n            raise TypeError(\"Position information stored on coordinate frame \"\n                            \"is insufficient to do a full-space position \"\n                            \"transformation (representation class: {})\"\n                            .format(data.__class__))\n\n        elif (has_velocity and (unit_vel_diff or rad_vel_diff) and\n              offset is not None and 's' in offset.differentials):\n            # Coordinate has a velocity, but it is not a full-space velocity\n            # that we need to do a velocity offset\n            raise TypeError(\"Velocity information stored on coordinate frame \"\n                            \"is insufficient to do a full-space velocity \"\n                            \"transformation (differential class: {})\"\n                            .format(data.differentials['s'].__class__))\n\n        elif len(data.differentials) > 1:\n            # We should never get here because the frame initializer shouldn't\n            # allow more differentials, but this just adds protection for\n            # subclasses that somehow skip the checks\n            raise ValueError(\"Representation passed to AffineTransform contains\"\n                             \" multiple associated differentials. Only a single\"\n                             \" differential with velocity units is presently\"\n                             \" supported (differentials: {}).\"\n                             .format(str(data.differentials)))\n\n        # If the representation is a UnitSphericalRepresentation, and this is\n        # just a MatrixTransform, we have to try to turn the differential into a\n        # Unit version of the differential (if no radial velocity) or a\n        # sphericaldifferential with zero proper motion (if only a radial\n        # velocity) so that the matrix operation works\n        if (has_velocity and isinstance(data, UnitSphericalRepresentation) and\n                not unit_vel_diff and not rad_vel_diff):\n            # retrieve just velocity differential\n            unit_diff = data.differentials['s'].represent_as(\n                data.differentials['s']._unit_differential, data)\n            data = data.with_differentials({'s': unit_diff})  # updates key\n\n        # If it's a RadialDifferential, we flat-out ignore the differentials\n        # This is because, by this point (past the validation above), we can\n        # only possibly be doing a rotation-only transformation, and that\n        # won't change the radial differential. We later add it back in\n        elif rad_vel_diff:\n            data = data.without_differentials()\n\n        # Convert the representation and differentials to cartesian without\n        # having them attached to a frame\n        rep = data.to_cartesian()\n        diffs = dict([(k, diff.represent_as(CartesianDifferential, data))\n                      for k, diff in data.differentials.items()])\n        rep = rep.with_differentials(diffs)\n\n        # Only do transform if matrix is specified. This is for speed in\n        # transformations that only specify an offset (e.g., LSR)\n        if matrix is not None:\n            # Note: this applies to both representation and differentials\n            rep = rep.transform(matrix)\n\n        # TODO: if we decide to allow arithmetic between representations that\n        # contain differentials, this can be tidied up\n        if offset is not None:\n            newrep = (rep.without_differentials() +\n                      offset.without_differentials())\n        else:\n            newrep = rep.without_differentials()\n\n        # We need a velocity (time derivative) and, for now, are strict: the\n        # representation can only contain a velocity differential and no others.\n        if has_velocity and not rad_vel_diff:\n            veldiff = rep.differentials['s']  # already in Cartesian form\n\n            if offset is not None and 's' in offset.differentials:\n                veldiff = veldiff + offset.differentials['s']\n\n            newrep = newrep.with_differentials({'s': veldiff})\n\n        if isinstance(fromcoord.data, UnitSphericalRepresentation):\n            # Special-case this because otherwise the return object will think\n            # it has a valid distance with the default return (a\n            # CartesianRepresentation instance)\n\n            if has_velocity and not unit_vel_diff and not rad_vel_diff:\n                # We have to first represent as the Unit types we converted to,\n                # then put the d_distance information back in to the\n                # differentials and re-represent as their original forms\n                newdiff = newrep.differentials['s']\n                _unit_cls = fromcoord.data.differentials['s']._unit_differential\n                newdiff = newdiff.represent_as(_unit_cls, newrep)\n\n                kwargs = dict([(comp, getattr(newdiff, comp))\n                               for comp in newdiff.components])\n                kwargs['d_distance'] = fromcoord.data.differentials['s'].d_distance\n                diffs = {'s': fromcoord.data.differentials['s'].__class__(\n                    copy=False, **kwargs)}\n\n            elif has_velocity and unit_vel_diff:\n                newdiff = newrep.differentials['s'].represent_as(\n                    fromcoord.data.differentials['s'].__class__, newrep)\n                diffs = {'s': newdiff}\n\n            else:\n                diffs = newrep.differentials\n\n            newrep = newrep.represent_as(fromcoord.data.__class__)  # drops diffs\n            newrep = newrep.with_differentials(diffs)\n\n        elif has_velocity and unit_vel_diff:\n            # Here, we're in the case where the representation is not\n            # UnitSpherical, but the differential *is* one of the UnitSpherical\n            # types. We have to convert back to that differential class or the\n            # resulting frame will think it has a valid radial_velocity. This\n            # can probably be cleaned up: we currently have to go through the\n            # dimensional version of the differential before representing as the\n            # unit differential so that the units work out (the distance length\n            # unit shouldn't appear in the resulting proper motions)\n\n            diff_cls = fromcoord.data.differentials['s'].__class__\n            newrep = newrep.represent_as(fromcoord.data.__class__,\n                                         diff_cls._dimensional_differential)\n            newrep = newrep.represent_as(fromcoord.data.__class__, diff_cls)\n\n        # We pulled the radial differential off of the representation\n        # earlier, so now we need to put it back. But, in order to do that, we\n        # have to turn the representation into a repr that is compatible with\n        # having a RadialDifferential\n        if has_velocity and rad_vel_diff:\n            newrep = newrep.represent_as(fromcoord.data.__class__)\n            newrep = newrep.with_differentials(\n                {'s': fromcoord.data.differentials['s']})\n\n        return newrep"},{"id":15445,"name":"astropy/coordinates/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/coordinates/tests","id":15446,"nodeType":"File","text":""},{"attributeType":"null","col":4,"comment":"null","endLoc":2125,"id":15447,"name":"attr_classes","nodeType":"Attribute","startLoc":2125,"text":"attr_classes"},{"attributeType":"null","col":12,"comment":"null","endLoc":2145,"id":15448,"name":"_r","nodeType":"Attribute","startLoc":2145,"text":"self._r"},{"className":"CylindricalRepresentation","col":0,"comment":"\n    Representation of points in 3D cylindrical coordinates.\n\n    Parameters\n    ----------\n    rho : `~astropy.units.Quantity`\n        The distance from the z axis to the point(s).\n\n    phi : `~astropy.units.Quantity` or str\n        The azimuth of the point(s), in angular units, which will be wrapped\n        to an angle between 0 and 360 degrees. This can also be instances of\n        `~astropy.coordinates.Angle`,\n\n    z : `~astropy.units.Quantity`\n        The z coordinate(s) of the point(s)\n\n    differentials : dict, `CylindricalDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single\n        `CylindricalDifferential` instance, or a dictionary of of differential\n        instances with keys set to a string representation of the SI unit with\n        which the differential (derivative) is taken. For example, for a\n        velocity differential on a positional representation, the key would be\n        ``'s'`` for seconds, indicating that the derivative is a time\n        derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    ","endLoc":2412,"id":15449,"nodeType":"Class","startLoc":2296,"text":"class CylindricalRepresentation(BaseRepresentation):\n    \"\"\"\n    Representation of points in 3D cylindrical coordinates.\n\n    Parameters\n    ----------\n    rho : `~astropy.units.Quantity`\n        The distance from the z axis to the point(s).\n\n    phi : `~astropy.units.Quantity` or str\n        The azimuth of the point(s), in angular units, which will be wrapped\n        to an angle between 0 and 360 degrees. This can also be instances of\n        `~astropy.coordinates.Angle`,\n\n    z : `~astropy.units.Quantity`\n        The z coordinate(s) of the point(s)\n\n    differentials : dict, `CylindricalDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single\n        `CylindricalDifferential` instance, or a dictionary of of differential\n        instances with keys set to a string representation of the SI unit with\n        which the differential (derivative) is taken. For example, for a\n        velocity differential on a positional representation, the key would be\n        ``'s'`` for seconds, indicating that the derivative is a time\n        derivative.\n\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n\n    attr_classes = {'rho': u.Quantity,\n                    'phi': Angle,\n                    'z': u.Quantity}\n\n    def __init__(self, rho, phi=None, z=None, differentials=None, copy=True):\n        super().__init__(rho, phi, z, copy=copy, differentials=differentials)\n\n        if not self._rho.unit.is_equivalent(self._z.unit):\n            raise u.UnitsError(\"rho and z should have matching physical types\")\n\n    @property\n    def rho(self):\n        \"\"\"\n        The distance of the point(s) from the z-axis.\n        \"\"\"\n        return self._rho\n\n    @property\n    def phi(self):\n        \"\"\"\n        The azimuth of the point(s).\n        \"\"\"\n        return self._phi\n\n    @property\n    def z(self):\n        \"\"\"\n        The height of the point(s).\n        \"\"\"\n        return self._z\n\n    def unit_vectors(self):\n        sinphi, cosphi = np.sin(self.phi), np.cos(self.phi)\n        l = np.broadcast_to(1., self.shape)\n        return {\n            'rho': CartesianRepresentation(cosphi, sinphi, 0, copy=False),\n            'phi': CartesianRepresentation(-sinphi, cosphi, 0, copy=False),\n            'z': CartesianRepresentation(0, 0, l, unit=u.one, copy=False)}\n\n    def scale_factors(self):\n        rho = self.rho / u.radian\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return {'rho': l,\n                'phi': rho,\n                'z': l}\n\n    @classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates to cylindrical polar\n        coordinates.\n        \"\"\"\n\n        rho = np.hypot(cart.x, cart.y)\n        phi = np.arctan2(cart.y, cart.x)\n        z = cart.z\n\n        return cls(rho=rho, phi=phi, z=z, copy=False)\n\n    def to_cartesian(self):\n        \"\"\"\n        Converts cylindrical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        \"\"\"\n        x = self.rho * np.cos(self.phi)\n        y = self.rho * np.sin(self.phi)\n        z = self.z\n\n        return CartesianRepresentation(x=x, y=y, z=z, copy=False)\n\n    def _scale_operation(self, op, *args):\n        if any(differential.base_representation is not self.__class__\n               for differential in self.differentials.values()):\n            return super()._scale_operation(op, *args)\n\n        phi_op, _, rho_op = _spherical_op_funcs(op, *args)\n        z_op = lambda x: op(x, *args)\n\n        result = self.__class__(rho_op(self.rho), phi_op(self.phi),\n                                z_op(self.z), copy=False)\n        for key, differential in self.differentials.items():\n            new_comps = (op(getattr(differential, comp)) for op, comp in zip(\n                (rho_op, operator.pos, z_op), differential.components))\n            result.differentials[key] = differential.__class__(*new_comps, copy=False)\n        return result"},{"col":4,"comment":"null","endLoc":2336,"header":"def __init__(self, rho, phi=None, z=None, differentials=None, copy=True)","id":15450,"name":"__init__","nodeType":"Function","startLoc":2332,"text":"def __init__(self, rho, phi=None, z=None, differentials=None, copy=True):\n        super().__init__(rho, phi, z, copy=copy, differentials=differentials)\n\n        if not self._rho.unit.is_equivalent(self._z.unit):\n            raise u.UnitsError(\"rho and z should have matching physical types\")"},{"id":15451,"name":"astropy/coordinates/tests/accuracy","nodeType":"Package"},{"fileName":"generate_spectralcoord_ref.py","filePath":"astropy/coordinates/tests/accuracy","id":15452,"nodeType":"File","text":"# Script to generate random targets, observatory locations, and times, and\n# run these using the Starlink rv command to generate reference values for the\n# velocity frame corrections. This requires that Starlink is installed and that\n# the rv command is in your PATH. More information about Starlink can be found\n# at http://starlink.eao.hawaii.edu/starlink\n\nif __name__ == \"__main__\":\n\n    from random import choice\n    from subprocess import check_output\n\n    import numpy as np\n\n    from astropy.table import QTable\n    from astropy.coordinates import SkyCoord, Angle\n    from astropy.time import Time\n    from astropy import units as u\n\n    np.random.seed(12345)\n\n    N = 100\n\n    tab = QTable()\n    target_lon = np.random.uniform(0, 360, N) * u.deg\n    target_lat = np.degrees(np.arcsin(np.random.uniform(-1, 1, N))) * u.deg\n    tab['target'] = SkyCoord(target_lon, target_lat, frame='fk5')\n    tab['obstime'] = Time(np.random.uniform(Time('1997-01-01').mjd, Time('2017-12-31').mjd, N), format='mjd', scale='utc')\n    tab['obslon'] = Angle(np.random.uniform(-180, 180, N) * u.deg)\n    tab['obslat'] = Angle(np.arcsin(np.random.uniform(-1, 1, N)) * u.deg)\n    tab['geocent'] = 0.\n    tab['heliocent'] = 0.\n    tab['lsrk'] = 0.\n    tab['lsrd'] = 0.\n    tab['galactoc'] = 0.\n    tab['localgrp'] = 0.\n\n    for row in tab:\n\n        # Produce input file for rv command\n        with open('rv.input', 'w') as f:\n            f.write(row['obslon'].to_string('deg', sep=' ') + ' ' + row['obslat'].to_string('deg', sep=' ') + '\\n')\n            f.write(f\"{row['obstime'].datetime.year} {row['obstime'].datetime.month} {row['obstime'].datetime.day} 1\\n\")\n            f.write(row['target'].to_string('hmsdms', sep=' ') + ' J2000\\n')\n            f.write('END\\n')\n\n        # Run Starlink rv command\n        check_output(['rv', 'rv.input'])\n\n        # Parse values from output file\n        lis_lines = []\n        started = False\n        for lis_line in open('rv.lis'):\n            if started and lis_line.strip() != '':\n                lis_lines.append(lis_line.strip())\n            elif 'LOCAL GROUP' in lis_line:\n                started = True\n\n        # Some sources are not observable at the specified time and therefore don't\n        # have entries in the rv output file\n        if len(lis_lines) == 0:\n            continue\n\n        # If there are lines, we pick one at random. Note that we can't get rv to\n        # run at the exact time we specified in the input, so we will re-parse the\n        # actual date/time used and replace it in the table\n        lis_line = choice(lis_lines)\n\n        # The column for 'SUN' has an entry also for the light travel time, which\n        # we want to ignore. It sometimes includes '(' followed by a space which\n        # can cause issues with splitting, hence why we get rid of the space.\n        lis_line = lis_line.replace('(  ', '(').replace('( ', '(')\n        year, month, day, time, zd, row['geocent'], row['heliocent'], _, \\\n            row['lsrk'], row['lsrd'], row['galactoc'], row['localgrp'] = lis_line.split()\n        row['obstime'] = Time(f'{year}-{month}-{day}T{time}:00', format='isot', scale='utc')\n\n    # We sampled 100 coordinates above since some may not have results - we now\n    # truncate to 50 sources since this is sufficient.\n    tab[:50].write('reference_rv.ecsv', format='ascii.ecsv')\n"},{"col":0,"comment":"null","endLoc":184,"header":"def inject_horoscope()","id":15453,"name":"inject_horoscope","nodeType":"Function","startLoc":182,"text":"def inject_horoscope():\n    import astropy\n    astropy._yourfuture = horoscope"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":15454,"name":"__all__","nodeType":"Attribute","startLoc":17,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":59,"id":15455,"name":"_VALID_SIGNS","nodeType":"Attribute","startLoc":59,"text":"_VALID_SIGNS"},{"attributeType":"null","col":0,"comment":"null","endLoc":63,"id":15456,"name":"_CONST_TO_SIGNS","nodeType":"Attribute","startLoc":63,"text":"_CONST_TO_SIGNS"},{"attributeType":"null","col":0,"comment":"null","endLoc":65,"id":15457,"name":"_ZODIAC","nodeType":"Attribute","startLoc":65,"text":"_ZODIAC"},{"col":0,"comment":"","endLoc":6,"header":"calculation.py#<anonymous>","id":15458,"name":"<anonymous>","nodeType":"Function","startLoc":6,"text":"__all__ = []\n\n_VALID_SIGNS = [\"capricorn\", \"aquarius\", \"pisces\", \"aries\", \"taurus\", \"gemini\",\n                \"cancer\", \"leo\", \"virgo\", \"libra\", \"scorpio\", \"sagittarius\"]\n\n_CONST_TO_SIGNS = {'capricornus': 'capricorn', 'scorpius': 'scorpio'}\n\n_ZODIAC = ((1900, \"rat\"), (1901, \"ox\"), (1902, \"tiger\"),\n           (1903, \"rabbit\"), (1904, \"dragon\"), (1905, \"snake\"),\n           (1906, \"horse\"), (1907, \"goat\"), (1908, \"monkey\"),\n           (1909, \"rooster\"), (1910, \"dog\"), (1911, \"pig\"))\n\ninject_horoscope()"},{"attributeType":"null","col":8,"comment":"null","endLoc":420,"id":15459,"name":"_frame","nodeType":"Attribute","startLoc":420,"text":"self._frame"},{"className":"DifferentialAttribute","col":0,"comment":"A frame attribute which is a differential instance.\n\n    The optional ``allowed_classes`` argument allows specifying a restricted\n    set of valid differential classes to check the input against. Otherwise,\n    any `~astropy.coordinates.BaseDifferential` subclass instance is valid.\n\n    Parameters\n    ----------\n    default : object\n        Default value for the attribute if not provided\n    allowed_classes : tuple, optional\n        A list of allowed differential classes for this attribute to have.\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    ","endLoc":519,"id":15460,"nodeType":"Class","startLoc":456,"text":"class DifferentialAttribute(Attribute):\n    \"\"\"A frame attribute which is a differential instance.\n\n    The optional ``allowed_classes`` argument allows specifying a restricted\n    set of valid differential classes to check the input against. Otherwise,\n    any `~astropy.coordinates.BaseDifferential` subclass instance is valid.\n\n    Parameters\n    ----------\n    default : object\n        Default value for the attribute if not provided\n    allowed_classes : tuple, optional\n        A list of allowed differential classes for this attribute to have.\n    secondary_attribute : str\n        Name of a secondary instance attribute which supplies the value if\n        ``default is None`` and no value was supplied during initialization.\n    \"\"\"\n\n    def __init__(self, default=None, allowed_classes=None,\n                 secondary_attribute=''):\n\n        if allowed_classes is not None:\n            self.allowed_classes = tuple(allowed_classes)\n        else:\n            self.allowed_classes = BaseDifferential\n\n        super().__init__(default, secondary_attribute)\n\n    def convert_input(self, value):\n        \"\"\"\n        Checks that the input is a differential object and is one of the\n        allowed class types.\n\n        Parameters\n        ----------\n        value : object\n            Input value.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n\n        if value is None:\n            return None, False\n\n        if not isinstance(value, self.allowed_classes):\n            if len(self.allowed_classes) == 1:\n                value = self.allowed_classes[0](value)\n            else:\n                raise TypeError('Tried to set a DifferentialAttribute with '\n                                'an unsupported Differential type {}. Allowed '\n                                'classes are: {}'\n                                .format(value.__class__,\n                                        self.allowed_classes))\n\n        return value, True"},{"col":4,"comment":"null","endLoc":482,"header":"def __init__(self, default=None, allowed_classes=None,\n                 secondary_attribute='')","id":15461,"name":"__init__","nodeType":"Function","startLoc":474,"text":"def __init__(self, default=None, allowed_classes=None,\n                 secondary_attribute=''):\n\n        if allowed_classes is not None:\n            self.allowed_classes = tuple(allowed_classes)\n        else:\n            self.allowed_classes = BaseDifferential\n\n        super().__init__(default, secondary_attribute)"},{"attributeType":"null","col":20,"comment":"null","endLoc":12,"id":15462,"name":"np","nodeType":"Attribute","startLoc":12,"text":"np"},{"fileName":"__init__.py","filePath":"astropy/coordinates/tests/accuracy","id":15463,"nodeType":"File","text":"\n\"\"\"\nThe modules in the accuracy testing subpackage are primarily intended for\ncomparison with \"known-good\" (or at least \"known-familiar\") datasets. More\nbasic functionality and sanity checks are in the main ``coordinates/tests``\ntesting modules.\n\"\"\"\n\nN_ACCURACY_TESTS = 10  # the number of samples to use per accuracy test\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":15464,"name":"N_ACCURACY_TESTS","nodeType":"Attribute","startLoc":9,"text":"N_ACCURACY_TESTS"},{"col":4,"comment":"\n        Checks that the input is a differential object and is one of the\n        allowed class types.\n\n        Parameters\n        ----------\n        value : object\n            Input value.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        ","endLoc":519,"header":"def convert_input(self, value)","id":15465,"name":"convert_input","nodeType":"Function","startLoc":484,"text":"def convert_input(self, value):\n        \"\"\"\n        Checks that the input is a differential object and is one of the\n        allowed class types.\n\n        Parameters\n        ----------\n        value : object\n            Input value.\n\n        Returns\n        -------\n        out, converted : correctly-typed object, boolean\n            Tuple consisting of the correctly-typed object and a boolean which\n            indicates if conversion was actually performed.\n\n        Raises\n        ------\n        ValueError\n            If the input is not valid for this attribute.\n        \"\"\"\n\n        if value is None:\n            return None, False\n\n        if not isinstance(value, self.allowed_classes):\n            if len(self.allowed_classes) == 1:\n                value = self.allowed_classes[0](value)\n            else:\n                raise TypeError('Tried to set a DifferentialAttribute with '\n                                'an unsupported Differential type {}. Allowed '\n                                'classes are: {}'\n                                .format(value.__class__,\n                                        self.allowed_classes))\n\n        return value, True"},{"attributeType":"null","col":33,"comment":"null","endLoc":17,"id":15466,"name":"u","nodeType":"Attribute","startLoc":17,"text":"u"},{"attributeType":"null","col":4,"comment":"null","endLoc":21,"id":15467,"name":"N","nodeType":"Attribute","startLoc":21,"text":"N"},{"attributeType":"QTable","col":4,"comment":"null","endLoc":23,"id":15468,"name":"tab","nodeType":"Attribute","startLoc":23,"text":"tab"},{"col":0,"comment":"","endLoc":7,"header":"__init__.py#<anonymous>","id":15469,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThe modules in the accuracy testing subpackage are primarily intended for\ncomparison with \"known-good\" (or at least \"known-familiar\") datasets. More\nbasic functionality and sanity checks are in the main ``coordinates/tests``\ntesting modules.\n\"\"\"\n\nN_ACCURACY_TESTS = 10  # the number of samples to use per accuracy test"},{"fileName":"generate_ref_ast.py","filePath":"astropy/coordinates/tests/accuracy","id":15470,"nodeType":"File","text":"\"\"\"\nThis series of functions are used to generate the reference CSV files\nused by the accuracy tests.  Running this as a command-line script will\ngenerate them all.\n\"\"\"\n\nimport os\n\nimport numpy as np\n\nfrom astropy.table import Table, Column\n\n\ndef ref_fk4_no_e_fk4(fnout='fk4_no_e_fk4.csv'):\n    \"\"\"\n    Accuracy tests for the FK4 (with no E-terms of aberration) to/from FK4\n    conversion, with arbitrary equinoxes and epoch of observation.\n    \"\"\"\n\n    import starlink.Ast as Ast\n\n    np.random.seed(12345)\n\n    N = 200\n\n    # Sample uniformly on the unit sphere. These will be either the FK4\n    # coordinates for the transformation to FK5, or the FK5 coordinates for the\n    # transformation to FK4.\n    ra = np.random.uniform(0., 360., N)\n    dec = np.degrees(np.arcsin(np.random.uniform(-1., 1., N)))\n\n    # Generate random observation epoch and equinoxes\n    obstime = [f\"B{x:7.2f}\" for x in np.random.uniform(1950., 2000., N)]\n\n    ra_fk4ne, dec_fk4ne = [], []\n    ra_fk4, dec_fk4 = [], []\n\n    for i in range(N):\n\n        # Set up frames for AST\n        frame_fk4ne = Ast.SkyFrame(f'System=FK4-NO-E,Epoch={obstime[i]},Equinox=B1950')\n        frame_fk4 = Ast.SkyFrame(f'System=FK4,Epoch={obstime[i]},Equinox=B1950')\n\n        # FK4 to FK4 (no E-terms)\n        frameset = frame_fk4.convert(frame_fk4ne)\n        coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]]))\n        ra_fk4ne.append(coords[0, 0])\n        dec_fk4ne.append(coords[1, 0])\n\n        # FK4 (no E-terms) to FK4\n        frameset = frame_fk4ne.convert(frame_fk4)\n        coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]]))\n        ra_fk4.append(coords[0, 0])\n        dec_fk4.append(coords[1, 0])\n\n    # Write out table to a CSV file\n    t = Table()\n    t.add_column(Column(name='obstime', data=obstime))\n    t.add_column(Column(name='ra_in', data=ra))\n    t.add_column(Column(name='dec_in', data=dec))\n    t.add_column(Column(name='ra_fk4ne', data=ra_fk4ne))\n    t.add_column(Column(name='dec_fk4ne', data=dec_fk4ne))\n    t.add_column(Column(name='ra_fk4', data=ra_fk4))\n    t.add_column(Column(name='dec_fk4', data=dec_fk4))\n    f = open(os.path.join('data', fnout), 'wb')\n    f.write(\"# This file was generated with the {} script, and the reference \"\n            \"values were computed using AST\\n\".format(os.path.basename(__file__)))\n    t.write(f, format='ascii', delimiter=',')\n\n\ndef ref_fk4_no_e_fk5(fnout='fk4_no_e_fk5.csv'):\n    \"\"\"\n    Accuracy tests for the FK4 (with no E-terms of aberration) to/from FK5\n    conversion, with arbitrary equinoxes and epoch of observation.\n    \"\"\"\n\n    import starlink.Ast as Ast\n\n    np.random.seed(12345)\n\n    N = 200\n\n    # Sample uniformly on the unit sphere. These will be either the FK4\n    # coordinates for the transformation to FK5, or the FK5 coordinates for the\n    # transformation to FK4.\n    ra = np.random.uniform(0., 360., N)\n    dec = np.degrees(np.arcsin(np.random.uniform(-1., 1., N)))\n\n    # Generate random observation epoch and equinoxes\n    obstime = [f\"B{x:7.2f}\" for x in np.random.uniform(1950., 2000., N)]\n    equinox_fk4 = [f\"B{x:7.2f}\" for x in np.random.uniform(1925., 1975., N)]\n    equinox_fk5 = [f\"J{x:7.2f}\" for x in np.random.uniform(1975., 2025., N)]\n\n    ra_fk4, dec_fk4 = [], []\n    ra_fk5, dec_fk5 = [], []\n\n    for i in range(N):\n\n        # Set up frames for AST\n        frame_fk4 = Ast.SkyFrame(f'System=FK4-NO-E,Epoch={obstime[i]},Equinox={equinox_fk4[i]}')\n        frame_fk5 = Ast.SkyFrame(f'System=FK5,Epoch={obstime[i]},Equinox={equinox_fk5[i]}')\n\n        # FK4 to FK5\n        frameset = frame_fk4.convert(frame_fk5)\n        coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]]))\n        ra_fk5.append(coords[0, 0])\n        dec_fk5.append(coords[1, 0])\n\n        # FK5 to FK4\n        frameset = frame_fk5.convert(frame_fk4)\n        coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]]))\n        ra_fk4.append(coords[0, 0])\n        dec_fk4.append(coords[1, 0])\n\n    # Write out table to a CSV file\n    t = Table()\n    t.add_column(Column(name='equinox_fk4', data=equinox_fk4))\n    t.add_column(Column(name='equinox_fk5', data=equinox_fk5))\n    t.add_column(Column(name='obstime', data=obstime))\n    t.add_column(Column(name='ra_in', data=ra))\n    t.add_column(Column(name='dec_in', data=dec))\n    t.add_column(Column(name='ra_fk5', data=ra_fk5))\n    t.add_column(Column(name='dec_fk5', data=dec_fk5))\n    t.add_column(Column(name='ra_fk4', data=ra_fk4))\n    t.add_column(Column(name='dec_fk4', data=dec_fk4))\n    f = open(os.path.join('data', fnout), 'wb')\n    f.write(\"# This file was generated with the {} script, and the reference \"\n            \"values were computed using AST\\n\".format(os.path.basename(__file__)))\n    t.write(f, format='ascii', delimiter=',')\n\n\ndef ref_galactic_fk4(fnout='galactic_fk4.csv'):\n    \"\"\"\n    Accuracy tests for the ICRS (with no E-terms of aberration) to/from FK5\n    conversion, with arbitrary equinoxes and epoch of observation.\n    \"\"\"\n\n    import starlink.Ast as Ast\n\n    np.random.seed(12345)\n\n    N = 200\n\n    # Sample uniformly on the unit sphere. These will be either the ICRS\n    # coordinates for the transformation to FK5, or the FK5 coordinates for the\n    # transformation to ICRS.\n    lon = np.random.uniform(0., 360., N)\n    lat = np.degrees(np.arcsin(np.random.uniform(-1., 1., N)))\n\n    # Generate random observation epoch and equinoxes\n    obstime = [f\"B{x:7.2f}\" for x in np.random.uniform(1950., 2000., N)]\n    equinox_fk4 = [f\"J{x:7.2f}\" for x in np.random.uniform(1975., 2025., N)]\n\n    lon_gal, lat_gal = [], []\n    ra_fk4, dec_fk4 = [], []\n\n    for i in range(N):\n\n        # Set up frames for AST\n        frame_gal = Ast.SkyFrame(f'System=Galactic,Epoch={obstime[i]}')\n        frame_fk4 = Ast.SkyFrame(f'System=FK4,Epoch={obstime[i]},Equinox={equinox_fk4[i]}')\n\n        # ICRS to FK5\n        frameset = frame_gal.convert(frame_fk4)\n        coords = np.degrees(frameset.tran([[np.radians(lon[i])], [np.radians(lat[i])]]))\n        ra_fk4.append(coords[0, 0])\n        dec_fk4.append(coords[1, 0])\n\n        # FK5 to ICRS\n        frameset = frame_fk4.convert(frame_gal)\n        coords = np.degrees(frameset.tran([[np.radians(lon[i])], [np.radians(lat[i])]]))\n        lon_gal.append(coords[0, 0])\n        lat_gal.append(coords[1, 0])\n\n    # Write out table to a CSV file\n    t = Table()\n    t.add_column(Column(name='equinox_fk4', data=equinox_fk4))\n    t.add_column(Column(name='obstime', data=obstime))\n    t.add_column(Column(name='lon_in', data=lon))\n    t.add_column(Column(name='lat_in', data=lat))\n    t.add_column(Column(name='ra_fk4', data=ra_fk4))\n    t.add_column(Column(name='dec_fk4', data=dec_fk4))\n    t.add_column(Column(name='lon_gal', data=lon_gal))\n    t.add_column(Column(name='lat_gal', data=lat_gal))\n    f = open(os.path.join('data', fnout), 'wb')\n    f.write(\"# This file was generated with the {} script, and the reference \"\n            \"values were computed using AST\\n\".format(os.path.basename(__file__)))\n    t.write(f, format='ascii', delimiter=',')\n\n\ndef ref_icrs_fk5(fnout='icrs_fk5.csv'):\n    \"\"\"\n    Accuracy tests for the ICRS (with no E-terms of aberration) to/from FK5\n    conversion, with arbitrary equinoxes and epoch of observation.\n    \"\"\"\n\n    import starlink.Ast as Ast\n\n    np.random.seed(12345)\n\n    N = 200\n\n    # Sample uniformly on the unit sphere. These will be either the ICRS\n    # coordinates for the transformation to FK5, or the FK5 coordinates for the\n    # transformation to ICRS.\n    ra = np.random.uniform(0., 360., N)\n    dec = np.degrees(np.arcsin(np.random.uniform(-1., 1., N)))\n\n    # Generate random observation epoch and equinoxes\n    obstime = [f\"B{x:7.2f}\" for x in np.random.uniform(1950., 2000., N)]\n    equinox_fk5 = [f\"J{x:7.2f}\" for x in np.random.uniform(1975., 2025., N)]\n\n    ra_icrs, dec_icrs = [], []\n    ra_fk5, dec_fk5 = [], []\n\n    for i in range(N):\n\n        # Set up frames for AST\n        frame_icrs = Ast.SkyFrame(f'System=ICRS,Epoch={obstime[i]}')\n        frame_fk5 = Ast.SkyFrame(f'System=FK5,Epoch={obstime[i]},Equinox={equinox_fk5[i]}')\n\n        # ICRS to FK5\n        frameset = frame_icrs.convert(frame_fk5)\n        coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]]))\n        ra_fk5.append(coords[0, 0])\n        dec_fk5.append(coords[1, 0])\n\n        # FK5 to ICRS\n        frameset = frame_fk5.convert(frame_icrs)\n        coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]]))\n        ra_icrs.append(coords[0, 0])\n        dec_icrs.append(coords[1, 0])\n\n    # Write out table to a CSV file\n    t = Table()\n    t.add_column(Column(name='equinox_fk5', data=equinox_fk5))\n    t.add_column(Column(name='obstime', data=obstime))\n    t.add_column(Column(name='ra_in', data=ra))\n    t.add_column(Column(name='dec_in', data=dec))\n    t.add_column(Column(name='ra_fk5', data=ra_fk5))\n    t.add_column(Column(name='dec_fk5', data=dec_fk5))\n    t.add_column(Column(name='ra_icrs', data=ra_icrs))\n    t.add_column(Column(name='dec_icrs', data=dec_icrs))\n    f = open(os.path.join('data', fnout), 'wb')\n    f.write(\"# This file was generated with the {} script, and the reference \"\n            \"values were computed using AST\\n\".format(os.path.basename(__file__)))\n    t.write(f, format='ascii', delimiter=',')\n\n\nif __name__ == '__main__':\n    ref_fk4_no_e_fk4()\n    ref_fk4_no_e_fk5()\n    ref_galactic_fk4()\n    ref_icrs_fk5()\n"},{"attributeType":"BaseDifferential","col":12,"comment":"null","endLoc":480,"id":15471,"name":"allowed_classes","nodeType":"Attribute","startLoc":480,"text":"self.allowed_classes"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":15472,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"attributes.py#<anonymous>","id":15473,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"__all__ = ['Attribute', 'TimeAttribute', 'QuantityAttribute',\n           'EarthLocationAttribute', 'CoordinateAttribute',\n           'CartesianRepresentationAttribute',\n           'DifferentialAttribute']"},{"col":4,"comment":"\n        The distance of the point(s) from the z-axis.\n        ","endLoc":2343,"header":"@property\n    def rho(self)","id":15474,"name":"rho","nodeType":"Function","startLoc":2338,"text":"@property\n    def rho(self):\n        \"\"\"\n        The distance of the point(s) from the z-axis.\n        \"\"\"\n        return self._rho"},{"col":4,"comment":"\n        The azimuth of the point(s).\n        ","endLoc":2350,"header":"@property\n    def phi(self)","id":15475,"name":"phi","nodeType":"Function","startLoc":2345,"text":"@property\n    def phi(self):\n        \"\"\"\n        The azimuth of the point(s).\n        \"\"\"\n        return self._phi"},{"col":4,"comment":"\n        The height of the point(s).\n        ","endLoc":2357,"header":"@property\n    def z(self)","id":15476,"name":"z","nodeType":"Function","startLoc":2352,"text":"@property\n    def z(self):\n        \"\"\"\n        The height of the point(s).\n        \"\"\"\n        return self._z"},{"col":4,"comment":"null","endLoc":2365,"header":"def unit_vectors(self)","id":15477,"name":"unit_vectors","nodeType":"Function","startLoc":2359,"text":"def unit_vectors(self):\n        sinphi, cosphi = np.sin(self.phi), np.cos(self.phi)\n        l = np.broadcast_to(1., self.shape)\n        return {\n            'rho': CartesianRepresentation(cosphi, sinphi, 0, copy=False),\n            'phi': CartesianRepresentation(-sinphi, cosphi, 0, copy=False),\n            'z': CartesianRepresentation(0, 0, l, unit=u.one, copy=False)}"},{"id":15478,"name":"astropy/coordinates/tests/accuracy/data","nodeType":"Package"},{"id":15479,"name":"galactic_fk4.csv","nodeType":"TextFile","path":"astropy/coordinates/tests/accuracy/data","text":"# This file was generated with the ref_galactic_fk4.py script, and the reference values were computed using AST\nequinox_fk4,obstime,lon_in,lat_in,ra_fk4,dec_fk4,lon_gal,lat_gal\nJ1998.36,B1995.95,334.661793414,43.9385116594,215.729885213,-13.2119623291,95.9916336135,-10.7923599366\nJ2021.64,B1954.56,113.895199649,-14.1109832563,0.0191713429163,47.9584946764,230.354307383,2.91031092906\nJ2020.49,B1953.55,66.2107722038,-7.76265420193,307.0396671,25.0473933964,202.190459847,-36.2511029663\nJ1981.50,B1970.69,73.6417002791,41.7006137481,249.552478408,47.490161693,163.738209835,-0.997514227815\nJ2001.47,B1960.78,204.381010469,-14.9357743223,85.7262507794,0.592842446128,319.182343564,46.4865699629\nJ2005.96,B1975.98,214.396093073,-66.7648451487,38.7974895634,-25.3131215325,311.259111645,-5.26093959516\nJ2006.23,B1977.93,347.225227105,6.27744217753,251.681067557,-35.6975782982,82.4439145069,-48.3754431897\nJ2007.34,B1973.69,235.143754874,-5.59566003897,108.194271484,-22.3032173532,0.622684927771,37.7376079889\nJ1991.60,B1960.79,269.606389512,26.7823112195,159.265817549,-27.2400623832,52.4594618492,22.7351205489\nJ1980.71,B1961.97,235.285153507,-14.0695156888,99.5923664647,-26.0329761781,353.421599279,31.5338685058\nJ2003.56,B1960.84,269.177331338,42.9472695107,168.194363902,-13.373076419,69.4875812789,27.7142399301\nJ1990.10,B1982.78,346.070424986,-3.51848810713,260.556249219,-42.5373980474,71.1723254841,-55.2318229113\nJ1984.68,B1992.32,3.01978725896,7.19732176646,261.223075691,-22.5183053503,106.371052811,-54.3443814356\nJ2003.24,B1996.52,38.3199756112,18.8080489808,268.244155911,13.0679884186,153.915977612,-37.8861321281\nJ2005.52,B1990.02,107.533336957,-4.33088623215,345.276777715,55.2303472065,218.881057613,2.11460956182\nJ1977.27,B1984.04,236.30802591,14.3162535375,126.558516177,-13.1859909524,24.4040838917,47.3681313134\nJ2024.27,B1960.36,291.532518915,-33.7960784017,65.6262288958,-78.0827780664,4.70715132794,-21.1240080657\nJ1980.19,B1987.08,313.983328941,27.7572327639,204.395115343,-33.9974383642,72.5499341116,-11.3261456428\nJ1995.29,B1984.85,347.273135054,-13.6880685538,273.878542915,-46.5817989568,57.2967846205,-62.636282227\nJ2008.28,B1969.09,260.526724891,-37.6134342267,75.5423582477,-53.0108213216,349.993949344,-0.500521761262\nJ1984.85,B1992.51,231.291118043,-27.2371455509,84.3750724965,-27.2619452007,340.394703326,24.1136027935\nJ1987.09,B1976.41,258.283303492,-30.1025933842,87.5349107922,-50.9413101937,355.216758932,5.09769033822\nJ2006.16,B1994.65,168.335642599,-44.084769302,44.0040901708,7.58736494962,284.861051883,15.3412175718\nJ2014.94,B1991.03,117.210483914,32.8708634152,231.950026475,82.367116716,187.3264088,25.4619880653\nJ2002.23,B1961.43,158.272058119,-29.286471988,46.4761761399,24.2223508812,269.917276667,24.5785034911\nJ1984.88,B1991.03,262.688069789,-48.1516431413,57.7755536872,-52.5013674166,342.226051771,-7.92146528355\nJ2014.21,B1956.93,357.845250924,19.2890677934,248.037990583,-19.4340699812,103.672360905,-41.3775036599\nJ2015.72,B1974.12,243.674536239,-10.0431678136,108.027253494,-31.863249456,2.91619105856,28.4959537625\nJ2010.54,B1957.44,284.696106425,19.6051067047,170.340404941,-40.0951306839,51.2254926849,7.33605738412\nJ2022.20,B1972.41,61.5291328053,18.6403709997,277.730191309,33.3416109651,174.063892959,-24.5412790814\nJ2017.75,B1983.30,9.66573928438,-22.9075078717,295.17981175,-30.0450764744,85.3259571782,-84.8466105492\nJ2023.18,B1989.45,288.133287813,-36.6947385674,61.7090085882,-74.1820684991,0.817296879039,-19.4797887996\nJ1998.23,B1983.10,325.340113758,-33.7758802174,307.31206399,-69.6283338955,11.6623486171,-48.8815187305\nJ1999.25,B1985.58,8.88343575454,-49.4693354042,325.965770063,-35.6133692502,309.666273629,-67.4551398942\nJ2004.32,B1994.40,177.029034641,-67.7755279684,31.2372626731,-12.9650951893,296.955672515,-5.62000346764\nJ2022.10,B1957.08,189.451860246,-68.7071945134,33.5293665419,-17.1203080138,301.559917262,-5.75405801934\nJ1993.61,B1957.38,214.691763751,-32.6160600699,73.7224767298,-15.6028544376,323.538376206,26.6926709764\nJ2004.91,B1966.30,18.7047162369,-32.9080620608,308.505564328,-25.5373410674,263.547066418,-82.3338996972\nJ2005.68,B1951.59,322.232230099,14.4669345738,219.553504168,-44.4049264885,66.7343979667,-25.6090866517\nJ2003.00,B1984.39,262.175824918,51.7319974933,169.003247618,-3.42937646572,78.8860186239,33.5626186817\nJ1980.93,B1988.24,294.6060041,34.0181871087,184.771961476,-28.2403711462,68.3561968833,5.91397226579\nJ1995.15,B1967.50,180.08019102,26.2892216009,115.670140935,39.4176352042,214.406973761,78.6105433559\nJ1986.07,B1980.80,291.668187169,-22.2789167174,125.910652709,-78.6378819053,16.4272341834,-17.5632578893\nJ2014.41,B1997.92,34.548669268,-15.8924906144,297.966081457,-5.74276095396,188.103833481,-67.1344687124\nJ2013.20,B1964.55,78.8220157436,-37.4332268082,338.41386544,13.3803692475,241.413633182,-34.4957267196\nJ1983.72,B1984.33,93.1388621771,60.5731416456,215.515242863,51.025917079,153.788670192,19.0304556569\nJ2011.19,B1952.11,168.518071423,7.09229333513,86.7960140054,42.4095753728,249.125769518,59.3639239957\nJ2021.23,B1953.13,165.374352937,39.3890686842,133.539016217,52.7585931969,177.607817121,63.8456065457\nJ1998.80,B1990.72,255.423520875,-17.5881075751,104.861453622,-45.3027201728,3.92822669713,14.6469670383\nJ2020.65,B1971.83,64.0990821181,36.8289797648,256.321772318,39.914355366,162.091739264,-10.1708006469\nJ1996.87,B1969.60,191.321958369,-52.3532066605,47.9455555868,-9.26762335019,302.005131299,10.4906094438\nJ1978.29,B1966.53,60.3872023631,25.1025882655,269.550425169,34.4047511633,168.612591713,-20.2821406332\nJ1993.19,B1972.88,276.773010626,56.6051138031,178.703826596,-3.3434530167,85.5633134045,25.6194736799\nJ1984.47,B1991.77,334.141397682,37.3852087993,218.479404766,-19.0772794069,91.968516951,-15.9701580762\nJ1982.42,B1973.34,219.417716878,-20.2290328911,87.1109593231,-14.6004706289,334.420144542,35.926923956\nJ1985.55,B1971.06,54.0660580808,-29.3264933861,318.139103598,3.17485146412,226.277308044,-53.6788644695\nJ2018.98,B1978.54,176.26561333,-0.572718169429,83.8491889252,31.8061689325,269.795526718,58.0046040213\nJ2015.89,B1986.95,135.84418338,-9.94938261687,33.531734841,50.9381624137,238.492810285,23.3637333893\nJ2006.58,B1952.75,305.496508312,-8.63421746611,200.932667574,-71.3815196871,35.373262982,-23.9548001451\nJ2022.76,B1981.21,327.995002307,-58.3471659896,350.834964718,-54.0901563813,335.114901978,-45.751212695\nJ1980.95,B1981.05,138.185539617,11.9337947187,58.631520613,69.0711593141,218.447399995,36.9072609382\nJ2005.11,B1950.06,113.578525223,29.6301583121,263.636462216,81.3987773508,189.681688921,21.6122927944\nJ1991.57,B1980.14,204.621895006,36.5235009134,133.680798913,22.0411777739,78.808513096,76.2737160193\nJ2016.08,B1952.01,67.6144926088,-13.7094836718,313.132620076,22.6386092017,209.654020089,-37.5533649541\nJ2007.99,B1979.29,45.3029557779,36.4639084123,253.115407251,25.0961411128,150.086524604,-19.5316401959\nJ1996.13,B1972.42,247.534489816,-3.23349952461,117.046928774,-32.0174103517,11.9107776158,29.166414441\nJ2010.80,B1967.69,287.858418461,26.2825631559,176.528272624,-34.7137695077,58.5625336575,7.68664923227\nJ1985.76,B1996.68,206.473163472,-38.4312130715,65.3730874222,-11.8626802001,314.662473159,23.1067145187\nJ1975.84,B1963.36,350.362793376,-7.51631961926,267.890694432,-41.0314521815,72.0362114405,-61.1485139616\nJ1989.04,B1964.06,228.259575769,40.311002157,144.950655363,6.68810736787,66.3208521242,57.9479583999\nJ2005.09,B1975.25,319.831820932,40.7337792676,206.517019036,-20.3728721852,85.376518971,-6.19125657467\nJ1998.03,B1982.34,178.349313153,-38.3854710615,53.3367731423,6.47139870346,290.627978018,23.0870158337\nJ2010.53,B1998.53,126.58195076,-73.6980337652,14.0339286057,-10.7989965101,287.063023216,-19.6793830621\nJ1983.23,B1951.79,257.122932676,24.0154376566,147.559357599,-22.3222385045,45.3959106575,32.4293515474\nJ2022.01,B1971.16,181.414481921,-17.7858263698,71.6065443096,17.7205783522,287.370198984,43.7863289812\nJ2022.77,B1979.42,81.2295383474,-9.26450146427,319.219354065,35.7151156735,211.413414641,-23.6522137945\nJ2024.04,B1986.59,88.1907984871,32.4238226453,264.445366137,59.5075300274,177.63221018,2.82201785023\nJ1977.94,B1958.78,285.408252018,67.7826509035,186.006666089,5.9317624038,98.5359798987,24.0369224888\nJ2012.02,B1975.53,178.262069224,51.7327600597,149.616027267,42.1293667525,143.189803372,62.9449441105\nJ2005.03,B1975.01,329.433722424,-46.8960749035,333.526505486,-61.2774858546,350.879342803,-50.7102611905\nJ1979.45,B1994.64,340.333860195,36.5560891832,223.292370195,-17.1540759917,95.9213163317,-19.343112709\nJ2024.47,B1969.13,191.963602676,21.3572019706,114.434412024,27.503830072,291.719299139,84.2576478027\nJ2002.44,B1983.14,90.8973340407,3.44588414281,314.995461083,51.3170142615,204.308033362,-9.04466471803\nJ2008.72,B1952.34,259.510340943,47.0512387915,164.869262172,-6.16993929742,73.122316095,35.0776892287\nJ2011.24,B1987.56,132.277954966,30.4307232942,127.48825526,81.1338000052,193.90517209,37.3016929434\nJ2003.42,B1968.44,179.513439448,-54.44865752,42.0526470828,-4.9188999851,295.12094312,7.62776271377\nJ2001.37,B1997.40,81.5670170865,-19.9451944488,328.061837334,28.1928252216,222.515151909,-27.3578081826\nJ1982.54,B1967.36,127.283632829,-10.0946390302,19.6477131913,52.4470778861,233.960957731,16.5452929993\nJ1987.01,B1984.19,234.306643184,-86.4404274379,16.4715901103,-28.4445608636,305.546826719,-24.5135301459\nJ1995.13,B1991.23,112.65584231,11.2521500479,339.527728916,71.3900724033,207.206370175,13.7939581949\nJ1978.39,B1974.31,276.744760981,21.4151577082,162.407802968,-35.1255983687,49.8499233813,14.5681779743\nJ2012.92,B1999.21,281.461357214,-15.511897988,128.74174115,-66.9721136327,18.3606180783,-5.64535469428\nJ1992.13,B1980.19,306.867413859,-11.9467360888,207.123394118,-74.3365109128,32.8334594598,-26.7428218865\nJ2024.49,B1987.98,341.966066455,-2.82477813631,257.079269135,-45.5062849208,66.5166383458,-51.5988768204\nJ2019.43,B1984.23,38.6362483924,9.3322810896,277.298399175,9.29190831823,160.679381282,-46.0098367014\nJ2021.93,B1996.62,327.861128148,-46.529254733,334.498175895,-62.285753657,351.779204131,-49.5514803605\nJ2011.96,B1997.49,120.979858288,87.22617179,193.112689708,29.8355211732,125.900479598,27.8877168914\nJ1976.35,B1999.51,297.496953653,0.839666332936,181.085417356,-61.4154773919,40.6846762696,-12.8402998175\nJ1994.12,B1956.31,323.316228643,-0.794522598791,232.744583525,-57.172811607,53.4475657454,-35.7640525677\nJ1975.53,B1998.83,15.3775095611,-38.7740290611,313.687711979,-29.7532661336,292.123823728,-78.249288242\nJ1978.26,B1961.46,70.486199672,-24.0682131367,323.035235152,17.9223915313,223.250351558,-38.1828370964\nJ2009.07,B1959.30,106.020475905,36.6574903487,244.972778375,72.7878865437,180.327652321,18.0468441903\nJ2024.33,B1975.46,225.719957006,-24.2326924255,86.0366112823,-21.5082578389,337.38182103,29.8986234954\nJ2008.31,B1976.52,31.0403178442,23.2187819108,261.302299942,8.78047554861,143.772447485,-36.7511639142\nJ1995.76,B1964.13,51.4602071324,-27.0058546166,315.065766587,2.55796617517,221.775446591,-55.7242078312\nJ1977.06,B1965.51,185.697546923,55.594260797,153.338541661,37.440299398,131.049487592,61.2247044105\nJ2019.71,B1965.49,248.162878677,-23.7609450888,94.0591617121,-40.8224910786,354.392971779,16.4900856964\nJ2010.34,B1963.32,308.385291884,51.2349043028,196.476156832,-11.5444983515,88.2071202318,6.64482242886\nJ1998.94,B1979.67,233.050205996,63.3093356498,166.867510536,15.6637804493,98.5156204798,45.4612418027\nJ1985.78,B1960.86,209.382723191,-41.4659129842,63.4734186744,-15.1442383851,316.163237599,19.6100595169\nJ1979.09,B1970.12,256.001743835,-16.3448051664,106.649451565,-45.3254094121,5.44744564064,14.6683716892\nJ2008.66,B1964.43,90.8700685367,21.3678694408,287.008253726,60.3030901692,188.510594416,-0.450177420343\nJ2024.74,B1958.69,324.057486054,57.4352750563,204.387834151,-3.71156697525,98.8294418875,3.92980570683\nJ2004.68,B1961.29,159.225729446,-45.2472278228,37.9943842023,10.4609560801,279.445767043,11.4162684154\nJ2017.01,B1999.43,7.38749687642,-53.1540997613,330.796893447,-36.432735539,310.561617023,-63.5428435122\nJ1982.65,B1971.70,345.477965039,-10.1831007688,267.939382589,-46.5465175303,61.3892410717,-59.2635781091\nJ2018.81,B1991.41,234.801152081,71.8511934075,175.271116162,19.166721209,107.275353666,39.7113209648\nJ2002.24,B1978.63,184.754250038,-66.4894904918,34.1841541814,-14.4958117979,299.686716649,-3.81069739954\nJ2024.18,B1982.60,245.64829793,-38.7682176459,73.9547095701,-41.3059410321,341.54798842,7.97381666623\nJ2011.79,B1986.49,176.234540627,12.5643501076,97.7788131928,38.1835469935,252.339039389,68.6211958128\nJ1979.65,B1969.56,333.536461653,-55.645568776,343.316605394,-54.0790917446,336.652926202,-50.1180340532\nJ1989.61,B1969.64,185.716717981,-21.5568171888,70.5091730065,12.162471916,294.316919615,40.7880063819\nJ1988.65,B1992.98,25.9775574253,12.7249831044,268.242055984,-0.265815951959,142.501478254,-48.0628732689\nJ1978.56,B1990.50,204.302987352,-36.6989586206,66.0962720642,-9.57087489783,313.310472546,25.1146611916\nJ2009.00,B1991.83,221.487546141,22.5689795999,126.853873425,2.99323159891,29.3329007943,63.7844492045\nJ1986.24,B1959.40,338.956666009,-30.7135370512,297.785788922,-58.4349148844,18.009575125,-60.3855752943\nJ2002.57,B1967.98,149.5308077,21.1458572723,94.8524518306,65.0524091023,211.851072125,50.1739306174\nJ2013.49,B1974.10,95.1983908472,-1.61163007915,325.627893674,50.8317830992,210.781640873,-7.70049786191\nJ1985.59,B1998.30,35.0615395317,-28.6207880841,309.362547589,-10.9681750175,222.2815235,-70.2039555167\nJ1989.64,B1978.17,174.903919876,-25.7547140538,60.6700456981,17.1698957102,283.434726362,34.3456435324\nJ1992.82,B1991.38,167.27863063,54.1842744725,155.134423626,47.955156172,150.615261991,57.1592810224\nJ2022.82,B1953.81,10.7133541168,-26.6356033619,299.700062775,-30.2854018223,42.0331929301,-87.8059255496\nJ2008.01,B1977.66,249.939886269,43.0233288254,157.107675338,-4.65986958657,67.7233796,41.7069452763\nJ2022.53,B1977.40,258.100960451,-37.3838036503,76.1621887374,-51.0815347034,348.967532389,1.36680578377\nJ1979.84,B1995.27,262.732112385,-19.8057986634,105.205356822,-52.5372854117,6.11993733263,7.43500801549\nJ1988.23,B1968.47,149.166366188,63.2857703333,174.688450428,50.0778473898,148.575911001,44.2672282651\nJ1988.61,B1995.06,5.4355841259,0.695799807062,268.674810006,-23.9106016257,107.664837783,-61.2469672937\nJ2016.75,B1957.03,327.231056694,-11.1377396332,252.951382603,-62.1498935414,44.0578705009,-44.1656816269\nJ2015.64,B1954.96,284.17633852,-71.0631656787,21.4861837786,-44.7317770239,324.040057511,-25.8326289675\nJ1989.69,B1998.66,59.4717008987,14.0960045791,281.495047329,29.7732755945,176.567960403,-28.6862393249\nJ2007.49,B1997.10,112.602946077,-17.7763932222,359.226063676,44.0329923131,233.074018942,0.179492159778\nJ1996.05,B1979.55,219.940310095,-26.5130440909,81.4465458752,-17.5043303516,331.149281423,30.3269968045\nJ1978.73,B1952.60,131.216503219,-60.6790709392,16.634154156,1.81850032112,276.99056645,-10.9885663722\nJ2011.94,B1952.51,56.1738921125,-19.3427782341,311.186999671,10.4337104739,211.304689863,-49.7748029903\nJ2004.27,B1966.23,63.8293728328,-59.8347944156,346.99277437,-9.45023426908,270.969703277,-42.5256665899\nJ1992.23,B1968.79,312.440281577,-82.909075449,11.3540896839,-34.157150499,310.093208312,-30.498791986\nJ1987.90,B1988.21,104.43408064,-66.6447299251,5.45340291535,-4.88740816946,277.212698727,-24.1397093769\nJ1989.59,B1992.96,210.664663673,-17.5831928536,86.0165552167,-5.98416607071,326.19870132,41.9722447163\nJ2013.49,B1977.29,163.438155327,-54.6954182678,35.0847453795,1.14728902679,286.284423558,4.38048943444\nJ1996.22,B1966.19,148.024127582,2.32865180198,61.1653789554,55.4628176364,235.147968548,40.5062869945\nJ1989.43,B1970.29,317.748400264,-34.6457182874,316.831643302,-75.2962612516,9.65732035894,-42.8175894028\nJ1988.21,B1955.48,249.374885326,79.5246095403,183.718980722,20.6913682813,112.565520636,32.5641832214\nJ1988.85,B1956.86,100.53840787,-27.7507223648,349.546329312,30.9972476643,237.218549213,-14.0500966148\nJ2017.12,B1987.27,23.1984832267,21.1208388177,259.952338902,1.35554765265,135.43691251,-40.8550069313\nJ1983.48,B1993.82,71.5045009532,3.00896662959,299.603452073,35.2702997539,194.634394328,-25.8112525209\nJ1987.60,B1962.95,335.405788093,-6.90098238794,255.324007551,-53.1294372006,55.8410528163,-49.2268304977\nJ2004.59,B1984.28,307.588884401,18.8511389183,199.036872823,-43.8235513129,61.4614776755,-11.7984990917\nJ2023.77,B1967.96,343.704504442,-46.9224252956,326.142463635,-52.3943400975,344.29956144,-59.491008965\nJ1975.21,B1950.30,18.8112053675,35.1485289159,245.286476487,4.93182941858,128.71934377,-27.3093230426\nJ1987.00,B1988.06,208.609805013,-46.3894275721,58.5433364885,-16.5301679525,314.238428253,15.0130783715\nJ2011.33,B1970.70,172.978655994,15.4172636989,99.5237786852,42.2246688539,240.910040544,68.0540051284\nJ1987.54,B1966.69,7.8152324312,-34.9365736294,307.969684049,-34.8499910529,330.146180835,-81.2012202729\nJ2020.91,B1963.90,134.503366944,-72.4111269318,16.6485961895,-9.74558853146,287.251430013,-17.0236932061\nJ2000.41,B1979.63,149.073048424,14.7065160273,81.1217800627,62.690435672,220.791567295,47.4907829088\nJ2000.13,B1966.26,217.406604209,16.5186514295,119.582956349,3.61620654175,12.9778311665,64.930795113\nJ2010.62,B1996.84,241.829541848,16.5114334946,131.926345089,-16.4641006337,30.2129120083,43.7266326194\nJ2006.99,B1954.80,301.991652158,46.8228690265,192.281654734,-16.0819438067,82.1831278354,7.65942031664\nJ1989.22,B1994.16,280.629434995,-19.0017596678,119.763163085,-67.9434807772,15.0327362766,-6.7748272396\nJ1975.49,B1978.40,144.252375855,-10.2581330338,44.2663724488,47.1780541535,244.906125318,30.0146889384\nJ2004.74,B1953.10,286.0305233,12.7464714044,168.403291875,-46.9082451034,45.684929198,3.05860565516\nJ2017.05,B1993.75,321.524751743,61.8464645226,201.729972147,0.142282640146,100.9998867,8.01195048206\nJ1999.33,B1961.24,94.4962887092,-44.0946278203,352.197455758,14.1646347321,251.750996447,-24.2178084719\nJ2014.04,B1989.97,356.110922656,-39.1892569317,312.562642311,-44.4976591581,347.918750957,-71.4003276728\nJ1995.63,B1990.09,307.190555646,-43.7191034979,2.19409366458,-73.0808365619,356.907677491,-35.5140842361\nJ1993.99,B1951.45,263.331776174,25.1917278571,153.169840501,-25.2115873395,48.721484719,27.5451183286\nJ2019.92,B1981.35,128.003624894,58.8666544649,188.132407462,57.9560573023,158.151363881,35.6484565698\nJ2019.84,B1980.23,317.984216655,-8.89508525523,234.105102561,-66.9359336144,41.2540921899,-35.0019322625\nJ2011.02,B1953.91,312.465272698,5.18400310772,210.387316474,-56.4513187131,52.2045687218,-23.2783213403\nJ1989.24,B1988.65,344.0759205,-20.8070551085,282.194864755,-52.0563161521,40.4226717361,-63.1239129244\nJ1991.99,B1957.17,0.0386123471053,-42.7336081023,317.113101073,-41.6722671173,333.272026627,-71.3154908857\nJ1989.26,B1973.18,5.95477509083,23.9728714179,248.645776385,-10.559858406,115.039830262,-38.4244563396\nJ2013.98,B1954.86,113.065220613,27.4191705733,278.378621564,81.2392172048,191.670829361,20.3160887911\nJ1975.23,B1978.49,358.313822853,67.0446512684,211.780718733,12.9835628445,117.438946252,4.91999007663\nJ1979.23,B1970.19,53.5839203362,-15.011852649,305.729478083,10.5974755105,203.68085793,-50.0750506428\nJ1997.07,B1979.33,60.2557627351,25.6833225299,269.003573186,34.456942967,167.932574018,-20.1669832622\nJ1987.55,B1987.44,273.08593329,76.4393919681,185.756212072,15.2737854446,107.678579719,28.6298222935\nJ2020.29,B1994.48,25.0306798156,-51.1202356021,329.572709072,-25.482154153,285.52934787,-64.2572780699\nJ2019.04,B1968.97,253.970437895,31.094899255,151.036217235,-15.4523165082,52.7995114065,37.292668285\nJ2010.83,B1964.62,168.89950144,-43.2270950714,44.9384665428,8.00028298712,284.864643848,16.2980080563\nJ1986.93,B1975.46,3.66775780511,39.2622225734,235.238676188,-2.72528403932,115.361704733,-23.0060112816\nJ2021.26,B1976.64,278.936590632,6.21231840756,154.692659833,-49.4790598243,36.5657932055,6.53011956709\nJ2023.48,B1955.27,285.91236301,9.40548699672,166.481412833,-50.0386245303,42.5308356905,1.81955485147\nJ2003.91,B1952.30,53.8450026285,60.7259893436,226.147190382,33.5643817186,141.659779689,3.93637165962\nJ1988.45,B1981.10,8.53330744443,-7.54498028811,278.255981158,-25.1174817952,110.761077739,-69.9571108312\nJ1990.05,B1991.12,274.342957522,-1.24603088049,141.305593094,-52.2551761295,27.9749402015,6.88675256757\nJ2006.27,B1952.75,80.5212647616,19.4060625392,284.864123639,50.4777772377,185.129288864,-9.72047187101\nJ2013.99,B1989.90,94.3827831954,15.0883386826,301.493234394,60.9106556021,195.582917069,-0.623869405575\nJ1996.06,B1962.21,164.473020999,-47.6965440186,39.4946578672,6.36223553605,283.94830707,10.9316648861\nJ2007.85,B1990.18,89.9736906625,-16.9964263489,333.217747094,35.5496625256,222.809109826,-18.9265144618\nJ1996.18,B1964.91,204.582082173,15.6789515837,113.317697869,14.3475448707,348.941256944,74.1578851882\n"},{"id":15480,"name":"rv.ecsv","nodeType":"TextFile","path":"astropy/coordinates/tests/accuracy/data","text":"# %ECSV 0.9\n# ---\n# datatype:\n# - {name: target.ra, unit: deg, datatype: float64}\n# - {name: target.dec, unit: deg, datatype: float64}\n# - {name: obstime, datatype: float64}\n# - {name: obslon, unit: deg, datatype: float64}\n# - {name: obslat, unit: deg, datatype: float64}\n# - {name: geocent, datatype: float64}\n# - {name: heliocent, datatype: float64}\n# - {name: lsrk, datatype: float64}\n# - {name: lsrd, datatype: float64}\n# - {name: galactoc, datatype: float64}\n# - {name: localgrp, datatype: float64}\n# meta: !!omap\n# - __serialized_columns__:\n#     obslat:\n#       __class__: astropy.coordinates.angles.Angle\n#       unit: &id001 !astropy.units.Unit {unit: deg}\n#       value: !astropy.table.SerializedColumn {name: obslat}\n#     obslon:\n#       __class__: astropy.coordinates.angles.Angle\n#       unit: *id001\n#       value: !astropy.table.SerializedColumn {name: obslon}\n#     obstime:\n#       __class__: astropy.time.core.Time\n#       format: mjd\n#       in_subfmt: '*'\n#       out_subfmt: '*'\n#       precision: 3\n#       scale: utc\n#       value: !astropy.table.SerializedColumn {name: obstime}\n#     target:\n#       __class__: astropy.coordinates.sky_coordinate.SkyCoord\n#       dec: !astropy.table.SerializedColumn\n#         __class__: astropy.coordinates.angles.Latitude\n#         unit: *id001\n#         value: !astropy.table.SerializedColumn {name: target.dec}\n#       equinox: !astropy.time.Time {format: jyear_str, in_subfmt: '*', jd1: 2451545.0, jd2: 0.0, out_subfmt: '*', precision: 3, scale: tt}\n#       frame: fk5\n#       ra: !astropy.table.SerializedColumn\n#         __class__: astropy.coordinates.angles.Longitude\n#         unit: *id001\n#         value: !astropy.table.SerializedColumn {name: target.ra}\n#         wrap_angle: !astropy.coordinates.Angle\n#           unit: *id001\n#           value: 360.0\n#       representation_type: spherical\n# schema: astropy-2.0\ntarget.ra target.dec obstime obslon obslat geocent heliocent lsrk lsrd galactoc localgrp\n334.66179341417325 -37.4746243276451 56944.583333333336 -73.4083146850998 0.9934458639867794 -0.18 23.14 23.14 23.39 12.17 7.83\n113.89519964944293 -24.267502562084083 53348.604166666664 107.4654213177339 -0.9569986706412217 0.41 -14.25 4.41 0.88 190.13 243.82\n66.210772203754 14.714324392325588 53765.833333333336 -73.87981454255879 -1.031043527663963 0.44 27.29 39.97 38.47 40.93 30.65\n73.6417002790943 -55.84826698141797 56834.604166666664 70.96377360006986 -0.1734450505423973 -0.06 -5.06 12.5 9.35 180.88 228.84\n204.3810104694072 -45.57030459618369 53295.208333333336 -81.73467764966647 -0.604946001350626 -0.12 6.68 9.0 7.63 166.01 222.66\n214.39609307253056 1.8138884922928018 50760.729166666664 148.51024245554663 0.03940746193103754 -0.37 -8.24 -18.09 -17.25 11.95 31.57\n347.2252271048238 22.252107390805392 54702.0625 -72.52587584643553 0.1172968316070286 0.42 -11.16 -18.75 -16.52 -196.9 -257.13\n235.14375487376552 45.50009583993112 53909.4375 140.3495179573211 -0.05262395721077776 0.26 12.19 -4.78 -2.02 -131.97 -165.02\n269.60638951220824 17.140949971137772 56011.708333333336 160.8200257553005 -0.6043845463833969 0.06 -22.54 -42.04 -38.79 -180.02 -215.14\n235.28515350662474 9.394853889964539 53351.916666666664 -119.19138376640424 -0.5481653070862904 -0.41 -14.2 -29.72 -27.66 -72.78 -75.72\n269.1773313376586 24.975577707564298 56896.916666666664 -50.655093936251546 -0.602280880058363 0.42 18.34 -1.58 1.82 -154.86 -195.31\n346.0704249862157 -29.68071601491614 54048.791666666664 65.5838290336441 0.3166456786256257 -0.4 26.25 27.34 27.6 -3.15 -15.69\n3.0197872589592567 53.160610484023216 54763.395833333336 151.70110921981524 0.7653464790734448 0.1 0.82 -6.81 -4.58 -198.1 -263.07\n38.31997561117896 -6.627424567462557 55519.75 -127.82723616205769 1.0370925745030768 0.39 11.94 23.53 22.32 16.85 4.47\n107.53333695697735 -73.5279867111198 53993.083333333336 -144.04522141505498 0.6442651205842602 0.11 4.35 18.65 15.72 209.05 267.99\n236.30802590961719 66.82716745025738 55231.0 -31.823000434204914 0.36982437935615714 -0.17 -3.51 -18.31 -15.59 -174.98 -220.86\n291.5325189147365 17.72512847931437 52150.333333333336 171.04513347287752 -0.62547952609733 -0.04 14.66 -3.83 -0.42 -175.16 -223.63\n313.9833289407419 1.513500797959476 56069.6875 -165.05764527647344 0.5044424937779216 -0.17 -27.28 -40.2 -37.53 -187.73 -232.09\n347.27313505389486 21.38990692260652 53376.5625 -112.71085397550353 0.40477197455037056 0.42 26.47 19.01 21.22 -157.52 -217.26\n260.5267248911832 -1.1986703812163568 51943.541666666664 39.15647567857732 -0.23874257222646839 0.23 -22.59 -39.41 -36.91 -112.1 -125.11\n231.29111804250286 58.53732285682286 52528.229166666664 -148.60126255566854 0.7757311669082397 -0.04 2.77 -12.72 -10.03 -154.59 -194.35\n258.2833034924689 1.8199938990721456 52360.1875 -66.13626459169684 0.05625202381376123 0.4 -25.33 -42.54 -39.98 -118.91 -132.96\n168.33564259894672 -58.83496582048319 51615.083333333336 39.64887954254834 0.9043413373567406 -0.03 -9.66 0.86 -1.78 204.17 271.18\n117.21048391417601 7.759579578627679 56364.354166666664 -107.5699033566731 0.6959551447790346 -0.44 23.22 37.26 34.73 148.03 177.72\n158.27205811853142 13.325707913931879 52407.9375 69.08317791400725 -0.5738183280271965 -0.14 28.55 32.74 31.43 127.06 158.96\n262.6880697888665 62.017700918318994 51427.458333333336 -91.93429037075109 0.6961234934619044 -0.08 2.56 -14.32 -11.16 -195.33 -248.59\n357.8452509239863 -9.745569332792781 55550.854166666664 64.93381052225013 -0.8079571898867685 -0.2 29.65 30.42 31.06 -51.81 -83.35\n243.67453623855718 -28.107026048533715 53614.729166666664 -5.0624175924442625 -0.035072199356146055 0.03 29.31 20.44 21.2 63.78 87.36\n284.6961064252039 -53.630895572353495 55570.229166666664 -86.22186779862115 -0.7787340672175637 -0.04 -3.79 -5.72 -5.78 54.06 77.81\n61.52913280527639 -1.6223494642741854 55509.916666666664 -78.21348508199557 -0.10359709759018712 0.27 -5.06 10.3 8.28 47.13 47.91\n9.665739284376805 -4.052716210177093 52790.729166666664 145.9625831377877 0.3383307603623594 -0.04 -25.76 -22.44 -22.14 -101.03 -133.33\n288.13328781316585 -70.13255329445501 51992.125 -80.69663252215345 0.616355159380941 0.05 -20.11 -16.32 -17.41 94.04 131.87\n325.34011375812 22.864612376567866 52151.416666666664 122.81329530279726 0.32999840154090804 0.28 0.78 -12.41 -9.42 -206.94 -268.57\n8.883435754535496 25.714952533161966 51369.083333333336 -109.2872251131505 0.43678098897547474 0.36 -27.17 -29.35 -27.95 -182.41 -237.78\n177.02903464051894 27.362773160568356 50733.333333333336 -60.98996539279433 0.8880569847092364 0.17 -15.2 -18.75 -18.68 6.7 19.41\n189.45186024594884 -9.86329409104824 50710.125 160.78675866598064 -0.7989862235046445 0.37 8.2 7.4 6.56 124.52 169.06\n214.691763750977 -75.88361544740292 52216.354166666664 2.1858658339403405 -0.7822254133599056 -0.08 7.39 14.74 12.8 180.39 235.91\n18.70471623691209 54.880135655957154 52200.708333333336 -34.770291013644936 -0.35558445082184315 -0.24 -6.28 -11.42 -9.62 -185.22 -245.73\n322.2322300994116 35.363194699425364 55241.791666666664 -170.25784618433008 -1.2118068894128302 -0.38 5.07 -9.55 -6.31 -220.38 -286.83\n262.1758249177622 -42.03632830194462 57294.6875 43.83852819600639 0.38496401885182396 -0.27 27.14 21.13 21.57 70.59 93.99\n294.6060041003692 -21.98896894125426 56428.229166666664 -54.95453756736161 0.5579640044030655 0.42 -24.58 -35.55 -33.71 -96.65 -110.41\n180.08019102040137 12.820102019263015 55981.916666666664 -80.35227799034473 -0.30467290716888323 0.19 -9.95 -11.91 -12.32 57.08 84.68\n291.6681871691717 -15.724937669501106 52829.770833333336 -156.94028138415626 0.2341489277699312 0.42 -1.49 -14.37 -12.19 -93.83 -112.81\n34.54866926804398 -43.46590628574244 53233.916666666664 -59.61941319035486 1.1604926136685172 -0.21 -12.83 1.01 -1.07 87.27 107.65\n78.82201574355365 -40.19510063677284 51952.625 -155.62442071260259 -0.431126807264691 0.35 13.44 32.83 29.5 192.8 236.12\n93.13886217712052 47.373110575874435 57623.6875 -178.6232706253277 0.3826249910126916 -0.26 -23.35 -18.99 -19.25 -69.96 -92.5\n168.51807142305665 -24.822634439632814 54756.6875 -165.25159077078516 -1.156857201461019 -0.42 -11.82 -4.23 -6.48 176.88 238.21\n165.37435293725312 9.808706832070078 56716.041666666664 -54.37624837573425 -1.0654208134159855 0.4 -1.89 0.99 -0.2 99.8 134.47\n255.42352087530443 -5.279265781945744 53124.791666666664 -146.8964480988924 0.6800056167019152 0.26 -16.27 -31.97 -29.77 -81.72 -87.11\n64.09908211807372 -10.23254405085257 56582.020833333336 7.313661525185296 -0.12710524541521373 -0.28 -15.09 1.89 -0.52 68.57 79.13\n"},{"id":15481,"name":"fk4_no_e_fk4.csv","nodeType":"TextFile","path":"astropy/coordinates/tests/accuracy/data","text":"# This file was generated with the ref_fk4_no_e_fk4.py script, and the reference values were computed using AST\nobstime,ra_in,dec_in,ra_fk4ne,dec_fk4ne,ra_fk4,dec_fk4\nB1995.95,334.661793414,43.9385116594,334.661871722,43.9384643913,334.661715106,43.9385589276\nB1954.56,113.895199649,-14.1109832563,113.895104206,-14.1109806856,113.895295093,-14.110985827\nB1953.55,66.2107722038,-7.76265420193,66.2106936357,-7.76263900837,66.2108507719,-7.76266939548\nB1970.69,73.6417002791,41.7006137481,73.6415874825,41.7005905459,73.6418130758,41.7006369502\nB1960.78,204.381010469,-14.9357743223,204.381033022,-14.935790469,204.380987917,-14.9357581756\nB1975.98,214.396093073,-66.7648451487,214.39618819,-66.7649221332,214.395997956,-66.7647681643\nB1977.93,347.225227105,6.27744217753,347.225265767,6.27744057158,347.225188443,6.27744378347\nB1973.69,235.143754874,-5.59566003897,235.143821166,-5.59565879904,235.143688582,-5.59566127889\nB1960.79,269.606389512,26.7823112195,269.6064937,26.7823268289,269.606285325,26.78229561\nB1961.97,235.285153507,-14.0695156888,235.285221697,-14.0695245442,235.285085317,-14.0695068334\nB1960.84,269.177331338,42.9472695107,269.177458208,42.9472886864,269.177204468,42.947250335\nB1982.78,346.070424986,-3.51848810713,346.070465234,-3.51847491299,346.070384739,-3.51850130129\nB1992.32,3.01978725896,7.19732176646,3.0198007213,7.19731786183,3.0197737966,7.1973256711\nB1996.52,38.3199756112,18.8080489808,38.3199297604,18.8080292742,38.320021462,18.8080686874\nB1990.02,107.533336957,-4.33088623215,107.533242366,-4.3308791254,107.533431548,-4.33089333889\nB1984.04,236.30802591,14.3162535375,236.308095417,14.316277761,236.307956402,14.316229314\nB1960.36,291.532518915,-33.7960784017,291.532631247,-33.7960622584,291.532406582,-33.7960945449\nB1987.08,313.983328941,27.7572327639,313.983419024,27.757215788,313.983238857,27.7572497397\nB1984.85,347.273135054,-13.6880685538,347.273174533,-13.6880403026,347.273095575,-13.688096805\nB1969.09,260.526724891,-37.6134342267,260.526837065,-37.6134483095,260.526612717,-37.6134201437\nB1992.51,231.291118043,-27.2371455509,231.291186922,-27.2371716878,231.291049163,-27.237119414\nB1976.41,258.283303492,-30.1025933842,258.283404615,-30.1026049901,258.28320237,-30.1025817782\nB1994.65,168.335642599,-44.084769302,168.33559145,-44.0848244927,168.335693748,-44.0847141113\nB1991.03,117.210483914,32.8708634152,117.210375337,32.8708843641,117.210592491,32.8708424662\nB1961.43,158.272058119,-29.286471988,158.271999107,-29.2865040826,158.27211713,-29.2864398934\nB1991.03,262.688069789,-48.1516431413,262.688204769,-48.1516601921,262.687934809,-48.1516260902\nB1956.93,357.845250924,19.2890677934,357.845273996,19.2890447616,357.845227852,19.2890908252\nB1974.12,243.674536239,-10.0431678136,243.67461278,-10.0431700653,243.674459697,-10.0431655619\nB1957.44,284.696106425,19.6051067047,284.696206986,19.6051121836,284.696005864,19.6051012256\nB1972.41,61.5291328053,18.6403709997,61.5290555992,18.640359185,61.5292100114,18.6403828144\nB1983.30,9.66573928438,-22.9075078717,9.66574187976,-22.9074636315,9.66573668899,-22.9075521118\nB1989.45,288.133287813,-36.6947385674,288.1334053,-36.6947252717,288.133170326,-36.694751863\nB1983.10,325.340113758,-33.7758802174,325.340195579,-33.7758368156,325.340031937,-33.7759236192\nB1985.58,8.88343575454,-49.4693354042,8.88344142656,-49.4692581619,8.88343008249,-49.4694126467\nB1994.40,177.029034641,-67.7755279684,177.028973591,-67.7756101942,177.02909569,-67.7754457425\nB1957.08,189.451860246,-68.7071945134,189.451852687,-68.707280034,189.451867805,-68.7071089929\nB1957.38,214.691763751,-32.6160600699,214.691808834,-32.6161002775,214.691718668,-32.6160198625\nB1966.30,18.7047162369,-32.9080620608,18.7047012927,-32.9080042868,18.7047311812,-32.9081198349\nB1951.59,322.232230099,14.4669345738,322.232303942,14.4669266585,322.232156257,14.466942489\nB1984.39,262.175824918,51.7319974933,262.175969881,51.7320265851,262.175679954,51.7319684013\nB1988.24,294.6060041,34.0181871087,294.606115453,34.0181812889,294.605892748,34.0181929283\nB1967.50,180.08019102,26.2892216009,180.080170768,26.2892699746,180.080211273,26.2891732273\nB1980.80,291.668187169,-22.2789167174,291.668288006,-22.2789027838,291.668086332,-22.2789306509\nB1997.92,34.548669268,-15.8924906144,34.5486300111,-15.8924591395,34.548708525,-15.8925220893\nB1964.55,78.8220157436,-37.4332268082,78.8219051397,-37.4331986299,78.8221263475,-37.4332549865\nB1984.33,93.1388621771,60.5731416456,93.1386708523,60.5731340793,93.139053502,60.5731492117\nB1952.11,168.518071423,7.09229333513,168.51803468,7.09231202586,168.518108166,7.09227464443\nB1953.13,165.374352937,39.3890686842,165.374299611,39.3891290726,165.374406263,39.3890082959\nB1990.72,255.423520875,-17.5881075751,255.423610608,-17.5881124458,255.423431143,-17.5881027044\nB1971.83,64.0990821181,36.8289797648,64.098987426,36.8289518646,64.0991768103,36.829007665\nB1969.60,191.321958369,-52.3532066605,191.321958947,-52.3532769701,191.321957792,-52.3531363511\nB1966.53,60.3872023631,25.1025882655,60.3871229238,25.1025691776,60.3872818026,25.1026073533\nB1972.88,276.773010626,56.6051138031,276.773182582,56.6051241599,276.772838671,56.6051034461\nB1991.77,334.141397682,37.3852087993,334.141469519,37.3851690556,334.141325844,37.3852485429\nB1973.34,219.417716878,-20.2290328911,219.417764848,-20.2290543437,219.417668907,-20.2290114386\nB1971.06,54.0660580808,-29.3264933861,54.0659838918,-29.3264524474,54.06613227,-29.3265343247\nB1978.54,176.26561333,-0.572718169429,176.265589013,-0.572711155523,176.265637647,-0.572725183324\nB1986.95,135.84418338,-9.94938261687,135.844104187,-9.94938414897,135.844262573,-9.94938108476\nB1952.75,305.496508312,-8.63421746611,305.496595751,-8.63420374088,305.496420873,-8.63423119132\nB1981.21,327.995002307,-58.3471659896,327.995125925,-58.3471028456,327.994878689,-58.3472291335\nB1981.05,138.185539617,11.9337947187,138.185462216,11.9338143115,138.185617017,11.9337751259\nB1950.06,113.578525223,29.6301583121,113.578418602,29.6301753387,113.578631843,29.6301412853\nB1980.14,204.621895006,36.5235009134,204.621922605,36.5235622135,204.621867408,36.5234396134\nB1952.01,67.6144926088,-13.7094836718,67.6144111325,-13.7094635522,67.6145740851,-13.7095037914\nB1979.29,45.3029557779,36.4639084123,45.30288945,36.4638681314,45.3030221059,36.4639486932\nB1972.42,247.534489816,-3.23349952461,247.534569024,-3.23349456661,247.534410608,-3.2335044826\nB1967.69,287.858418461,26.2825631559,287.858523588,26.2825653277,287.858313334,26.2825609839\nB1996.68,206.473163472,-38.4312130715,206.473195575,-38.4312637479,206.473131368,-38.4311623951\nB1963.36,350.362793376,-7.51631961926,350.36282729,-7.51630014511,350.362759462,-7.51633909343\nB1964.06,228.259575769,40.311002157,228.259650941,40.3110571481,228.259500598,40.3109471658\nB1975.25,319.831820932,40.7337792676,319.831918659,40.7337465323,319.831723205,40.7338120029\nB1982.34,178.349313153,-38.3854710615,178.349286408,-38.3855223276,178.349339897,-38.3854197955\nB1998.53,126.58195076,-73.6980337652,126.581645487,-73.6980707198,126.582256033,-73.6979968102\nB1951.79,257.122932676,24.0154376566,257.123027615,24.0154606049,257.122837737,24.0154147083\nB1971.16,181.414481921,-17.7858263698,181.414465135,-17.7858473968,181.414498707,-17.7858053429\nB1979.42,81.2295383474,-9.26450146427,81.2294479067,-9.26448844016,81.2296287882,-9.26451448837\nB1986.59,88.1907984871,32.4238226453,88.1906888861,32.4238179627,88.1909080881,32.4238273279\nB1958.78,285.408252018,67.7826509035,285.408502334,67.7826473151,285.408001701,67.7826544915\nB1975.53,178.262069224,51.7327600597,178.262035148,51.7328376286,178.2621033,51.7326824908\nB1975.01,329.433722424,-46.8960749035,329.433814783,-46.8960177216,329.433630065,-46.8961320854\nB1994.64,340.333860195,36.5560891832,340.333920655,36.5560469817,340.333799735,36.5561313847\nB1969.13,191.963602676,21.3572019706,191.963604196,21.3572439205,191.963601156,21.3571600208\nB1983.14,90.8973340407,3.44588414281,90.897240458,3.44589104844,90.8974276234,3.44587723717\nB1952.34,259.510340943,47.0512387915,259.51047047,47.0512697696,259.510211416,47.0512078131\nB1987.56,132.277954966,30.4307232942,132.277860775,30.4307550149,132.278049157,30.4306915735\nB1968.44,179.513439448,-54.44865752,179.513406635,-54.4487285563,179.513472261,-54.4485864837\nB1997.40,81.5670170865,-19.9451944488,81.5669219294,-19.9451761627,81.5671122436,-19.9452127349\nB1967.36,127.283632829,-10.0946390302,127.283546305,-10.0946385601,127.283719352,-10.0946395003\nB1984.19,234.306643184,-86.4404274379,234.307689689,-86.4404960056,234.305596721,-86.440358869\nB1991.23,112.65584231,11.2521500479,112.655747491,11.2521615342,112.655937129,11.2521385617\nB1974.31,276.744760981,21.4151577082,276.744862642,21.4151677292,276.74465932,21.4151476871\nB1999.21,281.461357214,-15.511897988,281.461455717,-15.5118901893,281.46125871,-15.5119057865\nB1980.19,306.867413859,-11.9467360888,306.867501237,-11.9467197906,306.86732648,-11.946752387\nB1987.98,341.966066455,-2.82477813631,341.966112735,-2.82476612903,341.966020175,-2.82479014361\nB1984.23,38.6362483924,9.3322810896,38.6362039361,9.33227526676,38.6362928487,9.33228691243\nB1996.62,327.861128148,-46.529254733,327.861222674,-46.5291991016,327.86103362,-46.5293103644\nB1997.49,120.979858288,87.22617179,120.978013685,87.226204397,120.981702849,87.2261391801\nB1999.51,297.496953653,0.839666332936,297.497044724,0.83967387104,297.496862583,0.839658794827\nB1956.31,323.316228643,-0.794522598791,323.316298957,-0.794513783928,323.316158329,-0.794531413663\nB1998.83,15.3775095611,-38.7740290611,15.3775004994,-38.7739636006,15.3775186228,-38.7740945216\nB1961.46,70.486199672,-24.0682131367,70.4861102148,-24.0681861769,70.4862891293,-24.0682400965\nB1959.30,106.020475905,36.6574903487,106.020358021,36.6575015631,106.020593788,36.6574791342\nB1975.46,225.719957006,-24.2326924255,225.720016128,-24.2327172566,225.719897883,-24.2326675945\nB1976.52,31.0403178442,23.2187819108,31.040282636,23.2187540208,31.0403530525,23.2188098008\nB1964.13,51.4602071324,-27.0058546166,51.4601381551,-27.0058147039,51.4602761098,-27.0058945294\nB1965.51,185.697546923,55.594260797,185.697531081,55.5943432416,185.697562765,55.5941783525\nB1965.49,248.162878677,-23.7609450888,248.162965707,-23.7609586287,248.162791647,-23.7609315488\nB1963.32,308.385291884,51.2349043028,308.385426622,51.2348753519,308.385157147,51.2349332534\nB1979.67,233.050205996,63.3093356498,233.050347232,63.3094022915,233.05006476,63.3092690079\nB1960.86,209.382723191,-41.4659129842,209.382762908,-41.4659667228,209.382683474,-41.4658592457\nB1970.12,256.001743835,-16.3448051664,256.001833404,-16.3448088895,256.001654267,-16.3448014432\nB1964.43,90.8700685367,21.3678694408,90.8699682366,21.3678706796,90.8701688369,21.3678682019\nB1958.69,324.057486054,57.4352750563,324.057615131,57.4352248218,324.057356976,57.4353252907\nB1961.29,159.225729446,-45.2472278228,159.225658238,-45.2472794744,159.225800655,-45.2471761712\nB1999.43,7.38749687642,-53.1540997613,7.38750715011,-53.1540192078,7.38748660267,-53.1541803148\nB1971.70,345.477965039,-10.1831007688,345.478006755,-10.1830778328,345.477923323,-10.1831237048\nB1991.41,234.801152081,71.8511934075,234.80136258,71.8512610944,234.800941584,71.8511257203\nB1978.63,184.754250038,-66.4894904918,184.754223702,-66.4895738307,184.754276373,-66.4894071529\nB1982.60,245.64829793,-38.7682176459,245.648397087,-38.7682459424,245.648198773,-38.7681893494\nB1986.49,176.234540627,12.5643501076,176.234515663,12.564377805,176.23456559,12.5643224102\nB1969.56,333.536461653,-55.645568776,333.536564215,-55.6455021935,333.53635909,-55.6456353585\nB1969.64,185.716717981,-21.5568171888,185.71670839,-21.5568445326,185.716727571,-21.556789845\nB1992.98,25.9775574253,12.7249831044,25.9775324561,12.7249706335,25.9775823945,12.7249955753\nB1990.50,204.302987352,-36.6989586206,204.303014372,-36.6990074874,204.302960331,-36.6989097538\nB1991.83,221.487546141,22.5689795999,221.487598122,22.569018351,221.487494159,22.5689408487\nB1959.40,338.956666009,-30.7135370512,338.956724763,-30.7134891887,338.956607255,-30.7135849138\nB1967.98,149.5308077,21.1458572723,149.530740161,21.1458902834,149.530875238,21.1458242612\nB1974.10,95.1983908472,-1.61163007915,95.1982963974,-1.61162187599,95.198485297,-1.6116382823\nB1998.30,35.0615395317,-28.6207880841,35.0614956333,-28.620739571,35.0615834301,-28.6208365972\nB1978.17,174.903919876,-25.7547140538,174.903890465,-25.754746515,174.903949287,-25.7546815927\nB1991.38,167.27863063,54.1842744725,167.278565096,54.1843495205,167.278696164,54.1841994246\nB1953.81,10.7133541168,-26.6356033619,10.7133548501,-26.6355537205,10.7133533835,-26.6356530033\nB1977.66,249.939886269,43.0233288254,249.939997359,43.0233681421,249.939775179,43.0232895085\nB1977.40,258.100960451,-37.3838036503,258.101070404,-37.3838198729,258.1008505,-37.3837874275\nB1995.27,262.732112385,-19.8057986634,262.732208125,-19.8058013404,262.732016645,-19.8057959863\nB1968.47,149.166366188,63.2857703333,149.166225063,63.2858369635,149.166507312,63.2857037031\nB1995.06,5.4355841259,0.695799807062,5.43559350993,0.695806590879,5.43557474185,0.695793023234\nB1957.03,327.231056694,-11.1377396332,327.231123747,-11.137718635,327.230989642,-11.1377606314\nB1954.96,284.17633852,-71.0631656787,284.17663058,-71.0631583005,284.176046459,-71.0631730565\nB1998.66,59.4717008987,14.0960045791,59.4716277587,14.0959969126,59.4717740389,14.0960122456\nB1997.10,112.602946077,-17.7763932222,112.6028484,-17.7763914439,112.603043755,-17.7763950006\nB1979.55,219.940310095,-26.5130440909,219.940361247,-26.5130741126,219.940258944,-26.5130140693\nB1952.60,131.216503219,-60.6790709392,131.216335542,-60.6791085681,131.216670895,-60.6790333101\nB1952.51,56.1738921125,-19.3427782341,56.1738209005,-19.3427485454,56.1739633247,-19.3428079229\nB1966.23,63.8293728328,-59.8347944156,63.8292225342,-59.8347407237,63.829523132,-59.8348481073\nB1968.79,312.440281577,-82.909075449,312.440938353,-82.9090254915,312.439624792,-82.9091254056\nB1988.21,104.43408064,-66.6447299251,104.433841614,-66.6447318349,104.434319666,-66.644728015\nB1992.96,210.664663673,-17.5831928536,210.664697001,-17.5832123123,210.664630345,-17.5831733949\nB1977.29,163.438155327,-54.6954182678,163.438079056,-54.6954822858,163.438231598,-54.6953542498\nB1966.19,148.024127582,2.32865180198,148.024062692,2.32866254348,148.024192472,2.32864106049\nB1970.29,317.748400264,-34.6457182874,317.748492841,-34.6456795601,317.748307686,-34.6457570147\nB1955.48,249.374885326,79.5246095403,249.375329338,79.5246600743,249.374441319,79.5245590057\nB1956.86,100.53840787,-27.7507223648,100.538300623,-27.7507149055,100.538515118,-27.750729824\nB1987.27,23.1984832267,21.1208388177,23.1984619158,21.1208127728,23.1985045377,21.1208648626\nB1993.82,71.5045009532,3.00896662959,71.504418313,3.00897208869,71.5045835934,3.00896117048\nB1962.95,335.405788093,-6.90098238794,335.40584389,-6.90096525284,335.405732296,-6.90099952305\nB1984.28,307.588884401,18.8511389183,307.588974176,18.8511327496,307.588794626,18.851145087\nB1967.96,343.704504442,-46.9224252956,343.704568407,-46.9223583286,343.704440477,-46.9224922627\nB1950.30,18.8112053675,35.1485289159,18.8111898096,35.1484812505,18.8112209256,35.1485765813\nB1988.06,208.609805013,-46.3894275721,208.609846395,-46.3894876445,208.609763631,-46.3893674997\nB1970.70,172.978655994,15.4172636989,172.978625355,15.4172953255,172.978686632,15.4172320724\nB1966.69,7.8152324312,-34.9365736294,7.81523908357,-34.936512861,7.81522577882,-34.9366343978\nB1963.90,134.503366944,-72.4111269318,134.503104699,-72.4111743348,134.503629189,-72.4110795286\nB1979.63,149.073048424,14.7065160273,149.072982715,14.7065415958,149.073114132,14.7064904588\nB1966.26,217.406604209,16.5186514295,217.406648071,16.518683228,217.406560347,16.518619631\nB1996.84,241.829541848,16.5114334946,241.82961848,16.5114581776,241.829465216,16.5114088117\nB1954.80,301.991652158,46.8228690265,301.991781762,46.8228497806,301.991522554,46.8228882722\nB1994.16,280.629434995,-19.0017596678,280.629535379,-19.0017524272,280.629334611,-19.0017669083\nB1978.40,144.252375855,-10.2581330338,144.252305474,-10.258136788,144.252446236,-10.2581292796\nB1953.10,286.0305233,12.7464714044,286.030620257,12.7464773437,286.030426344,12.7464654651\nB1993.75,321.524751743,61.8464645226,321.524904902,61.8464140081,321.524598583,61.846515037\nB1961.24,94.4962887092,-44.0946278203,94.4961574273,-44.0946145181,94.4964199912,-44.0946411224\nB1989.97,356.110922656,-39.1892569317,356.110954348,-39.1891928509,356.110890964,-39.1893210125\nB1990.09,307.190555646,-43.7191034979,307.190673602,-43.7190689248,307.190437689,-43.719138071\nB1951.45,263.331776174,25.1917278571,263.331876059,25.1917473693,263.331676289,25.1917083448\nB1981.35,128.003624894,58.8666544649,128.003461169,58.8666953172,128.003788619,58.8666136124\nB1980.23,317.984216655,-8.89508525523,317.984293507,-8.89506861216,317.984139802,-8.8951018983\nB1953.91,312.465272698,5.18400310772,312.465354085,5.18400654399,312.465191311,5.18399967144\nB1988.65,344.0759205,-20.8070551085,344.07596665,-20.8070176615,344.07587435,-20.8070925556\nB1957.17,0.0386123471053,-42.7336081023,0.0386371599928,-42.7335390653,0.0385875341353,-42.7336771394\nB1973.18,5.95477509083,23.9728714179,5.95478442291,23.9728402559,5.95476575873,23.97290258\nB1954.86,113.065220613,27.4191705733,113.065116003,27.4191866686,113.065325223,27.4191544779\nB1978.49,358.313822853,67.0446512684,358.313876751,67.0445691316,358.313768955,67.0447334052\nB1970.19,53.5839203362,-15.011852649,53.5838539771,-15.0118268548,53.5839866953,-15.0118784432\nB1979.33,60.2557627351,25.6833225299,60.2556830704,25.6833027692,60.2558423998,25.6833422906\nB1987.44,273.08593329,76.4393919681,273.086334137,76.439406706,273.085532444,76.4393772296\nB1994.48,25.0306798156,-51.1202356021,25.0306434336,-51.1201589045,25.0307161977,-51.1203122997\nB1968.97,253.970437895,31.094899255,253.970536535,31.0949284071,253.970339254,31.0948701027\nB1964.62,168.89950144,-43.2270950714,168.899452201,-43.2271494771,168.89955068,-43.2270406658\nB1975.46,3.66775780511,39.2622225734,3.66777368182,39.26216915,3.66774192836,39.2622759968\nB1976.64,278.936590632,6.21231840756,278.936686041,6.21232668172,278.936495223,6.21231013337\nB1955.27,285.91236301,9.40548699672,285.912458882,9.40549352262,285.912267137,9.40548047079\nB1952.30,53.8450026285,60.7259893436,53.8448709018,60.7259324097,53.8451343557,60.7260462774\nB1981.10,8.53330744443,-7.54498028811,8.5333117472,-7.54495997493,8.53330314165,-7.54500060131\nB1991.12,274.342957522,-1.24603088049,274.3430518,-1.24602319414,274.342863244,-1.24603856684\nB1952.75,80.5212647616,19.4060625392,80.5211705543,19.4060589302,80.521358969,19.4060661482\nB1989.90,94.3827831954,15.0883386826,94.382685566,15.0883434466,94.3828808249,15.0883339185\nB1962.21,164.473020999,-47.6965440186,164.472957775,-47.69660143,164.473084223,-47.6964866073\nB1990.18,89.9736906625,-16.9964263489,89.973593279,-16.9964134056,89.9737880461,-16.9964392923\nB1964.91,204.582082173,15.6789515837,204.582105142,15.678984165,204.582059203,15.6789190023\n"},{"id":15482,"name":"icrs_fk5.csv","nodeType":"TextFile","path":"astropy/coordinates/tests/accuracy/data","text":"# This file was generated with the ref_icrs_fk5.py script, and the reference values were computed using AST\nequinox_fk5,obstime,ra_in,dec_in,ra_fk5,dec_fk5,ra_icrs,dec_icrs\nJ1998.36,B1995.95,334.661793414,43.9385116594,334.644564717,43.9302620645,334.679023415,43.9467624314\nJ2021.64,B1954.56,113.895199649,-14.1109832563,114.144749047,-14.1600275394,113.645603942,-14.0624187531\nJ2020.49,B1953.55,66.2107722038,-7.76265420193,66.4590983513,-7.71687128381,65.9625042534,-7.80888947142\nJ1981.50,B1970.69,73.6417002791,41.7006137481,73.3167722987,41.6713224382,73.9668646614,41.7293444168\nJ2001.47,B1960.78,204.381010469,-14.9357743223,204.400749583,-14.9432299686,204.361272512,-14.9283175102\nJ2005.96,B1975.98,214.396093073,-66.7648451487,214.51622501,-66.7922023737,214.276152292,-66.7374486425\nJ2006.23,B1977.93,347.225227105,6.27744217753,347.304207997,6.31127500827,347.146246763,6.24361991082\nJ2007.34,B1973.69,235.143754874,-5.59566003897,235.241093646,-5.61898190462,235.046433786,-5.57228120384\nJ1991.60,B1960.79,269.606389512,26.7823112195,269.522379939,26.7826702924,269.690399178,26.7820207078\nJ1980.71,B1961.97,235.285153507,-14.0695156888,235.015999226,-14.0081475332,235.554479961,-14.1304690349\nJ2003.56,B1960.84,269.177331338,42.9472695107,269.20449399,42.9469939989,269.150168743,42.9475544195\nJ1990.10,B1982.78,346.070424986,-3.51848810713,345.942775401,-3.57196685618,346.198054805,-3.46497978924\nJ1984.68,B1992.32,3.01978725896,7.19732176646,2.82298721926,7.11213924582,3.21663102538,7.28248887117\nJ2003.24,B1996.52,38.3199756112,18.8080489808,38.3653094841,18.8221903901,38.2746486329,18.7938987191\nJ2005.52,B1990.02,107.533336957,-4.33088623215,107.601845445,-4.34016819794,107.464824543,-4.32163930179\nJ1977.27,B1984.04,236.30802591,14.3162535375,236.043743614,14.3866995821,236.572362968,14.2462932004\nJ2024.27,B1960.36,291.532518915,-33.7960784017,291.927410812,-33.7460496092,291.137240582,-33.8452405537\nJ1980.19,B1987.08,313.983328941,27.7572327639,313.771329108,27.6807919311,314.195342452,27.8339672537\nJ1995.29,B1984.85,347.273135054,-13.6880685538,347.211387919,-13.7136412695,347.334872743,-13.662489607\nJ2008.28,B1969.09,260.526724891,-37.6134342267,260.667857852,-37.6209601213,260.385615908,-37.6057963361\nJ1984.85,B1992.51,231.291118043,-27.2371455509,231.063254934,-27.1842630084,231.519165836,-27.2897662439\nJ1987.09,B1976.41,258.283303492,-30.1025933842,258.077147166,-30.0878669846,258.489514237,-30.1170665366\nJ2006.16,B1994.65,168.335642599,-44.084769302,168.407881134,-44.1183592869,168.263437199,-44.0511880472\nJ2014.94,B1991.03,117.210483914,32.8708634152,117.449614999,32.8326715727,116.971180598,32.9087464534\nJ2002.23,B1961.43,158.272058119,-29.286471988,158.29805553,-29.2980114305,158.246062428,-29.2749346296\nJ1984.88,B1991.03,262.688069789,-48.1516431413,262.401200048,-48.1407150038,262.975034556,-48.1621531697\nJ2014.21,B1956.93,357.845250924,19.2890677934,358.026315201,19.3681291925,357.664269464,19.2100157767\nJ2015.72,B1974.12,243.674536239,-10.0431678136,243.889881509,-10.0818251308,243.459271586,-10.0042157281\nJ2010.54,B1957.44,284.696106425,19.6051067047,284.810926274,19.6200552,284.581280582,19.5902719604\nJ2022.20,B1972.41,61.5291328053,18.6403709997,61.8503393647,18.6989763949,61.2081620218,18.581156754\nJ2017.75,B1983.30,9.66573928438,-22.9075078717,9.88608757274,-22.8101292831,9.44526590432,-23.0049503113\nJ2023.18,B1989.45,288.133287813,-36.6947385674,288.521507272,-36.654154333,287.744731719,-36.7344915409\nJ1998.23,B1983.10,325.340113758,-33.7758802174,325.313691637,-33.783980295,325.366532233,-33.7677775537\nJ1999.25,B1985.58,8.88343575454,-49.4693354042,8.87458135076,-49.4734614153,8.89228952149,-49.4652094919\nJ2004.32,B1994.40,177.029034641,-67.7755279684,177.081382811,-67.7995455131,176.976736518,-67.7515115552\nJ2022.10,B1957.08,189.451860246,-68.7071945134,189.787950236,-68.8284977585,189.117915692,-68.5857730927\nJ1993.61,B1957.38,214.691763751,-32.6160600699,214.596970957,-32.5867949166,214.786602083,-32.6452917256\nJ2004.91,B1966.30,18.7047162369,-32.9080620608,18.7619437329,-32.8821737407,18.6474776276,-32.9339591431\nJ2005.68,B1951.59,322.232230099,14.4669345738,322.300004441,14.4919497078,322.164454374,14.4419423495\nJ2003.00,B1984.39,262.175824918,51.7319974933,262.193291036,51.7297325887,262.15835963,51.7342674421\nJ1980.93,B1988.24,294.6060041,34.0181871087,294.426858562,33.9741356521,294.78513452,34.0625403768\nJ1995.15,B1967.50,180.08019102,26.2892216009,180.018069261,26.3162194666,180.142298341,26.2622237714\nJ1986.07,B1980.80,291.668187169,-22.2789167174,291.460165406,-22.3074160406,291.876124294,-22.2501557708\nJ2014.41,B1997.92,34.548669268,-15.8924906144,34.7203476357,-15.826491503,34.3769912557,-15.9586260582\nJ2013.20,B1964.55,78.8220157436,-37.4332268082,78.9359542832,-37.4190574603,78.7080839461,-37.4475395217\nJ1983.72,B1984.33,93.1388621771,60.5731416456,92.7698274429,60.5778081354,93.5078078659,60.5678923219\nJ2011.19,B1952.11,168.518071423,7.09229333513,168.662964922,7.03122231792,168.373145295,7.15333299716\nJ2021.23,B1953.13,165.374352937,39.3890686842,165.670569356,39.2746286306,165.077550855,39.5033543186\nJ1998.80,B1990.72,255.423520875,-17.5881075751,255.406106679,-17.5864187707,255.440935444,-17.5897944148\nJ2020.65,B1971.83,64.0990821181,36.8289797648,64.4412908098,36.8788812849,63.757239339,36.77846091\nJ1996.87,B1969.60,191.321958369,-52.3532066605,191.277444974,-52.3361209946,191.366491705,-52.3702896721\nJ1978.29,B1966.53,60.3872023631,25.1025882655,60.0600049106,25.0425615489,60.7146932542,25.1620146503\nJ1993.19,B1972.88,276.773010626,56.6051138031,276.742873164,56.6006572956,276.803141964,56.6095901107\nJ1984.47,B1991.77,334.141397682,37.3852087993,333.971320286,37.3074623211,334.311570487,37.4630672642\nJ1982.42,B1973.34,219.417716878,-20.2290328911,219.169713749,-20.1532857902,219.66593381,-20.3045108915\nJ1985.55,B1971.06,54.0660580808,-29.3264933861,53.9175360432,-29.3737907652,54.2145819747,-29.2793648485\nJ2018.98,B1978.54,176.26561333,-0.572718169429,176.5087243,-0.678171194716,176.022494179,-0.467294315659\nJ2015.89,B1986.95,135.84418338,-9.94938261687,136.036951663,-10.0129567306,135.651382202,-9.88601582693\nJ2006.58,B1952.75,305.496508312,-8.63421746611,305.585332083,-8.61291748186,305.407668201,-8.65547120765\nJ2022.76,B1981.21,327.995002307,-58.3471659896,328.394703325,-58.2394830075,327.593625588,-58.4543795694\nJ1980.95,B1981.05,138.185539617,11.9337947187,137.926465957,12.0126777715,138.444435852,11.854592026\nJ2005.11,B1950.06,113.578525223,29.6301583121,113.658818144,29.6187548389,113.498216367,29.6415252375\nJ1991.57,B1980.14,204.621895006,36.5235009134,204.528365616,36.5661830045,204.715395365,36.4808507277\nJ2016.08,B1952.01,67.6144926088,-13.7094836718,67.8003322803,-13.675528411,67.4286781478,-13.7437074086\nJ2007.99,B1979.29,45.3029557779,36.4639084123,45.4287375369,36.4951563695,45.1772514486,36.4325910517\nJ1996.13,B1972.42,247.534489816,-3.23349952461,247.483791774,-3.22525417405,247.585191141,-3.24172726082\nJ2010.80,B1967.69,287.858418461,26.2825631559,287.968526608,26.3010624761,287.748304904,26.2641738179\nJ1985.76,B1996.68,206.473163472,-38.4312130715,206.262844929,-38.3601778797,206.683760191,-38.5021184668\nJ1975.84,B1963.36,350.362793376,-7.51631961926,350.050245875,-7.64886538089,350.675192428,-7.38365103931\nJ1989.04,B1964.06,228.259575769,40.311002157,228.157788783,40.3516658201,228.36135704,40.2704193663\nJ2005.09,B1975.25,319.831820932,40.7337792676,319.881302594,40.7554460493,319.782343346,40.712128268\nJ1998.03,B1982.34,178.349313153,-38.3854710615,178.324338212,-38.3745092745,178.374291779,-38.3964329888\nJ2010.53,B1998.53,126.58195076,-73.6980337652,126.555725353,-73.7329650434,126.607757619,-73.6630811157\nJ1983.23,B1951.79,257.122932676,24.0154376566,256.948650568,24.0363842696,257.297226196,23.9947678892\nJ2022.01,B1971.16,181.414481921,-17.7858263698,181.697561318,-17.9083119018,181.131603746,-17.6633258663\nJ2022.77,B1979.42,81.2295383474,-9.26450146427,81.5008624611,-9.24547745382,80.9582426792,-9.28411870238\nJ2024.04,B1986.59,88.1907984871,32.4238226453,88.5837995469,32.4275810011,87.7978296174,32.4191468321\nJ1977.94,B1958.78,285.408252018,67.7826509035,285.415288738,67.7500149744,285.400733562,67.815271794\nJ2012.02,B1975.53,178.262069224,51.7327600597,178.418521574,51.6658699581,178.105379001,51.7996446322\nJ2005.03,B1975.01,329.433722424,-46.8960749035,329.513358137,-46.8719488299,329.354038052,-46.9201811836\nJ1979.45,B1994.64,340.333860195,36.5560891832,340.099269221,36.4484316911,340.568666175,36.6639044187\nJ2024.47,B1969.13,191.963602676,21.3572019706,192.265985395,21.2240120738,191.661020584,21.4905409785\nJ2002.44,B1983.14,90.8973340407,3.44588414281,90.9294194634,3.44566140242,90.8652485585,3.44609927685\nJ2008.72,B1952.34,259.510340943,47.0512387915,259.570777662,47.0424288828,259.449910071,47.060099055\nJ2011.24,B1987.56,132.277954966,30.4307232942,132.449103167,30.388553739,132.106687114,30.4727545196\nJ2003.42,B1968.44,179.513439448,-54.44865752,179.557050535,-54.4676997913,179.469848483,-54.4296153679\nJ2001.37,B1997.40,81.5670170865,-19.9451944488,81.5818413055,-19.9440843678,81.5521929287,-19.9463064817\nJ1982.54,B1967.36,127.283632829,-10.0946390302,127.073706282,-10.0359014336,127.493515779,-10.1536599704\nJ1987.01,B1984.19,234.306643184,-86.4404274379,233.208246223,-86.397666282,235.429405927,-86.482050156\nJ1995.13,B1991.23,112.65584231,11.2521500479,112.588477624,11.262573342,112.723199816,11.2416973345\nJ1978.39,B1974.31,276.744760981,21.4151577082,276.514780435,21.4012711846,276.974729777,21.4295237953\nJ2012.92,B1999.21,281.461357214,-15.511897988,281.646447197,-15.4974841762,281.27623546,-15.5260840726\nJ1992.13,B1980.19,306.867413859,-11.9467360888,306.759165107,-11.9729853099,306.975635305,-11.9204206469\nJ2024.49,B1987.98,341.966066455,-2.82477813631,342.281869892,-2.69502407373,341.650132043,-2.95429956154\nJ2019.43,B1984.23,38.6362483924,9.3322810896,38.8963811972,9.41661462037,38.3762808891,9.24764100258\nJ2021.93,B1996.62,327.861128148,-46.529254733,328.210157236,-46.4256790337,327.511186361,-46.632434339\nJ2011.96,B1997.49,120.979858288,87.22617179,122.295667673,87.1912385961,119.633038513,87.2597786682\nJ1976.35,B1999.51,297.496953653,0.839666332936,297.195644583,0.779185153185,297.798143461,0.9007616283\nJ1994.12,B1956.31,323.316228643,-0.794522598791,323.240624027,-0.820755621072,323.391823819,-0.768263773348\nJ1975.53,B1998.83,15.3775095611,-38.7740290611,15.0928652608,-38.9054807438,15.6617662484,-38.6427567079\nJ1978.26,B1961.46,70.486199672,-24.0682131367,70.2586642967,-24.1088709419,70.7137598878,-24.0280083925\nJ2009.07,B1959.30,106.020475905,36.6574903487,106.172780811,36.6434848171,105.868125064,36.6713668422\nJ2024.33,B1975.46,225.719957006,-24.2326924255,226.075567685,-24.326948892,225.364802775,-24.1378344642\nJ2008.31,B1976.52,31.0403178442,23.2187819108,31.1570536178,23.258394038,30.9236362505,23.1791211798\nJ1995.76,B1964.13,51.4602071324,-27.0058546166,51.4152973853,-27.0205700299,51.5051169729,-26.991153671\nJ1977.06,B1965.51,185.697546923,55.594260797,185.421779304,55.721374348,185.972510783,55.4672081659\nJ2019.71,B1965.49,248.162878677,-23.7609450888,248.460344259,-23.8014906584,247.865592952,-23.7198708623\nJ2010.34,B1963.32,308.385291884,51.2349043028,308.461574811,51.2706847328,308.308996421,51.1991839517\nJ1998.94,B1979.67,233.050205996,63.3093356498,233.046004532,63.3128868847,233.05440839,63.3057847603\nJ1985.78,B1960.86,209.382723191,-41.4659129842,209.166390198,-41.3968581581,209.599369778,-41.5348210618\nJ1979.09,B1970.12,256.001743835,-16.3448051664,255.700801743,-16.3163460002,256.302789611,-16.3726709454\nJ2008.66,B1964.43,90.8700685367,21.3678694408,90.9998841203,21.3670776114,90.7402515844,21.3685520416\nJ2024.74,B1958.69,324.057486054,57.4352750563,324.24791254,57.5469196438,323.867096755,57.3238991167\nJ2004.68,B1961.29,159.225729446,-45.2472278228,159.276379685,-45.27159791,159.175093005,-45.2228659014\nJ2017.01,B1999.43,7.38749687642,-53.1540997613,7.58899121668,-53.0602158752,7.18561693871,-53.2480265357\nJ1982.65,B1971.70,345.477965039,-10.1831007688,345.251295994,-10.2765575516,345.704526845,-10.0895481742\nJ2018.81,B1991.41,234.801152081,71.8511934075,234.781598949,71.7908263583,234.821698672,71.9115305128\nJ2002.24,B1978.63,184.754250038,-66.4894904918,184.785352293,-66.5019187594,184.723164704,-66.4770616601\nJ2024.18,B1982.60,245.64829793,-38.7682176459,246.056856393,-38.8232771335,245.240252475,-38.7122842298\nJ2011.79,B1986.49,176.234540627,12.5643501076,176.386539261,12.4988499005,176.082498099,12.6298388968\nJ1979.65,B1969.56,333.536461653,-55.645568776,333.201327008,-55.7468423589,333.870449248,-55.544000369\nJ1989.61,B1969.64,185.716717981,-21.5568171888,185.58137022,-21.4992561733,185.852126151,-21.6143646005\nJ1988.65,B1992.98,25.9775574253,12.7249831044,25.8259425625,12.6681381133,26.129235078,12.7817548524\nJ1978.56,B1990.50,204.302987352,-36.6989586206,203.992013028,-36.590035009,204.614547277,-36.8076153687\nJ2009.00,B1991.83,221.487546141,22.5689795999,221.589063682,22.531481696,221.386026462,22.6065363227\nJ1986.24,B1959.40,338.956666009,-30.7135370512,338.763951811,-30.7849831444,339.149190984,-30.6419984779\nJ2002.57,B1967.98,149.5308077,21.1458572723,149.566540611,21.1335179376,149.495070016,21.1581920836\nJ2013.49,B1974.10,95.1983908472,-1.61163007915,95.3691226237,-1.61855225484,95.0276507441,-1.6049307767\nJ1985.59,B1998.30,35.0615395317,-28.6207880841,34.9020739253,-28.6865248849,35.2209739544,-28.5551795263\nJ1989.64,B1978.17,174.903919876,-25.7547140538,174.773704705,-25.6972724215,175.03419171,-25.8121673429\nJ1992.82,B1991.38,167.27863063,54.1842744725,167.174390005,54.2232575861,167.382755502,54.1452753419\nJ2022.82,B1953.81,10.7133541168,-26.6356033619,10.9937676648,-26.5108341533,10.4326984418,-26.7604882278\nJ2008.01,B1977.66,249.939886269,43.0233288254,250.003422167,43.0080617632,249.876355463,43.0386423389\nJ2022.53,B1977.40,258.100960451,-37.3838036503,258.483519166,-37.4092478087,257.718621316,-37.3575402646\nJ1979.84,B1995.27,262.732112385,-19.8057986634,262.43378889,-19.7913038792,263.030493701,-19.8197136836\nJ1988.23,B1968.47,149.166366188,63.2857703333,148.948549069,63.3419675102,149.383595682,63.2294456404\nJ1988.61,B1995.06,5.4355841259,0.695799807062,5.28960631728,0.632663567066,5.5815705005,0.758920757926\nJ2016.75,B1957.03,327.231056694,-11.1377396332,327.455533267,-11.0592260753,327.006447871,-11.2160554034\nJ2015.64,B1954.96,284.17633852,-71.0631656787,284.622383668,-71.0415076498,283.729510587,-71.08416592\nJ1989.69,B1998.66,59.4717008987,14.0960045791,59.3272356842,14.0667790018,59.6162113325,14.1251054777\nJ2007.49,B1997.10,112.602946077,-17.7763932222,112.686574032,-17.7924540137,112.519313748,-17.7603886122\nJ1996.05,B1979.55,219.940310095,-26.5130440909,219.882677955,-26.4961740042,219.997955886,-26.5298999803\nJ1978.73,B1952.60,131.216503219,-60.6790709392,131.102499987,-60.6011373948,131.330276761,-60.7571815411\nJ2011.94,B1952.51,56.1738921125,-19.3427782341,56.3074873507,-19.3058404816,56.0403066499,-19.3798447522\nJ2004.27,B1966.23,63.8293728328,-59.8347944156,63.8473703919,-59.8243161934,63.8113850715,-59.8452793392\nJ1992.23,B1968.79,312.440281577,-82.909075449,312.082844158,-82.9381618829,312.795193361,-82.879790561\nJ1987.90,B1988.21,104.43408064,-66.6447299251,104.430099425,-66.6279457743,104.437942894,-66.6615185415\nJ1989.59,B1992.96,210.664663673,-17.5831928536,210.521977043,-17.533300504,210.807417956,-17.6330115873\nJ2013.49,B1977.29,163.438155327,-54.6954182678,163.580861698,-54.7674320028,163.295621486,-54.6234578045\nJ1996.22,B1966.19,148.024127582,2.32865180198,147.975248991,2.34649291874,148.073002076,2.31080117706\nJ1989.43,B1970.29,317.748400264,-34.6457182874,317.585582699,-34.6892153211,317.911087895,-34.6021088555\nJ1988.21,B1955.48,249.374885326,79.5246095403,249.556636954,79.5476344368,249.19427904,79.5013904045\nJ1988.85,B1956.86,100.53840787,-27.7507223648,100.427671298,-27.7394319384,100.64914055,-27.7621307317\nJ2017.12,B1987.27,23.1984832267,21.1208388177,23.4324436323,21.2083599648,22.9647269089,21.0331644062\nJ1983.48,B1993.82,71.5045009532,3.00896662959,71.2883142486,2.97961964121,71.7207379936,3.03798447641\nJ1987.60,B1962.95,335.405788093,-6.90098238794,335.243429575,-6.9637085665,335.56809315,-6.83817480211\nJ2004.59,B1984.28,307.588884401,18.8511389183,307.640784808,18.8667407469,307.536982665,18.8355554286\nJ2023.77,B1967.96,343.704504442,-46.9224252956,344.048269178,-46.7952999698,343.359747105,-47.0493275593\nJ1975.21,B1950.30,18.8112053675,35.1485289159,18.4626544919,35.0177535414,19.1604681331,35.2790332993\nJ1987.00,B1988.06,208.609805013,-46.3894275721,208.40705329,-46.3258250272,208.812873725,-46.4529073994\nJ2011.33,B1970.70,172.978655994,15.4172636989,173.125918709,15.3546485543,172.831339838,15.4798590369\nJ1987.54,B1966.69,7.8152324312,-34.9365736294,7.662140954,-35.0053080694,7.96821251179,-34.8678643727\nJ2020.91,B1963.90,134.503366944,-72.4111269318,134.508752259,-72.4927321248,134.496713839,-72.3295304626\nJ2000.41,B1979.63,149.073048424,14.7065160273,149.078614359,14.7045538676,149.067482395,14.7084780734\nJ2000.13,B1966.26,217.406604209,16.5186514295,217.408141458,16.5180765377,217.40506696,16.5192263332\nJ2010.62,B1996.84,241.829541848,16.5114334946,241.950169443,16.4835846733,241.708924453,16.5393920451\nJ2006.99,B1954.80,301.991652158,46.8228690265,302.04602973,46.8435076393,301.937270072,46.8022617404\nJ1989.22,B1994.16,280.629434995,-19.0017596678,280.47101531,-19.0127425519,280.787831403,-18.9906136966\nJ1975.49,B1978.40,144.252375855,-10.2581330338,143.952794662,-10.1475953709,144.551902691,-10.3690875087\nJ2004.74,B1953.10,286.0305233,12.7464714044,286.085513107,12.7537759609,285.975531683,12.739191194\nJ2017.05,B1993.75,321.524751743,61.8464645226,321.632828791,61.9208329855,321.416592726,61.7722074849\nJ1999.33,B1961.24,94.4962887092,-44.0946278203,94.4913067992,-44.0943400421,94.5012706073,-44.0949159215\nJ2014.04,B1989.97,356.110922656,-39.1892569317,356.295020794,-39.1112673044,355.926608129,-39.2672295394\nJ1995.63,B1990.09,307.190555646,-43.7191034979,307.116027145,-43.7337921796,307.265056341,-43.7043896052\nJ1993.99,B1951.45,263.331776174,25.1917278571,263.270410907,25.195633174,263.393142235,25.187858127\nJ2019.92,B1981.35,128.003624894,58.8666544649,128.402920612,58.7980654005,127.60315064,58.9346336939\nJ2019.84,B1980.23,317.984216655,-8.89508525523,318.249905253,-8.81284951457,317.718360008,-8.97697809843\nJ2011.02,B1953.91,312.465272698,5.18400310772,312.602344189,5.22548362633,312.328177207,5.1426308705\nJ1989.24,B1988.65,344.0759205,-20.8070551085,343.931796087,-20.8646386849,344.219970948,-20.7494301859\nJ1991.99,B1957.17,0.0386123471053,-42.7336081023,359.935984167,-42.778197083,0.141166805258,-42.6890191696\nJ1989.26,B1973.18,5.95477509083,23.9728714179,5.81446857607,23.9133953285,6.09515408275,24.0323323244\nJ2013.98,B1954.86,113.065220613,27.4191705733,113.281430058,27.3885381062,112.848903077,27.4495327526\nJ1975.23,B1978.49,358.313822853,67.0446512684,358.006936646,66.906817269,358.62239279,67.1825070772\nJ1979.23,B1970.19,53.5839203362,-15.011852649,53.3428201185,-15.0806959511,53.8250625845,-14.9434009383\nJ1997.07,B1979.33,60.2557627351,25.6833225299,60.211425166,25.6752201005,60.3001057813,25.6914140019\nJ1987.55,B1987.44,273.08593329,76.4393919681,273.213340941,76.4355890802,272.958409407,76.443040877\nJ2020.29,B1994.48,25.0306798156,-51.1202356021,25.2312583612,-51.0179789716,24.8298733815,-51.2226596567\nJ2019.04,B1968.97,253.970437895,31.094899255,254.152950904,31.0657978691,253.787939628,31.1243251572\nJ2010.83,B1964.62,168.89950144,-43.2270950714,169.027402777,-43.286276106,168.771701635,-43.167939929\nJ1986.93,B1975.46,3.66775780511,39.2622225734,3.49661533708,39.1896011422,3.8390874932,39.3348301065\nJ2021.26,B1976.64,278.936590632,6.21231840756,279.196246371,6.23097561081,278.676905991,6.19419108431\nJ2023.48,B1955.27,285.91236301,9.40548699672,286.192352454,9.44163731007,285.632321786,9.36995103333\nJ2003.91,B1952.30,53.8450026285,60.7259893436,53.9264872004,60.7388195386,53.763567111,60.7131341506\nJ1988.45,B1981.10,8.53330744443,-7.54498028811,8.38660351469,-7.60858303157,8.6800005788,-7.48140196135\nJ1990.05,B1991.12,274.342957522,-1.24603088049,274.214291508,-1.25015780077,274.471619291,-1.24177991998\nJ2006.27,B1952.75,80.5212647616,19.4060625392,80.6137303362,19.4117801816,80.4288063349,19.4002893257\nJ2013.99,B1989.90,94.3827831954,15.0883386826,94.5829613625,15.0822437507,94.1825907513,15.0941622997\nJ1996.06,B1962.21,164.473020999,-47.6965440186,164.429008903,-47.6754169753,164.51704615,-47.7176755752\nJ2007.85,B1990.18,89.9736906625,-16.9964263489,90.0609144086,-16.9964467144,89.8864669212,-16.9964725118\nJ1996.18,B1964.91,204.582082173,15.6789515837,204.535627332,15.698292886,204.628535832,15.6596174499\n"},{"id":15483,"name":"astropy/coordinates/builtin_frames","nodeType":"Package"},{"fileName":"itrs.py","filePath":"astropy/coordinates/builtin_frames","id":15484,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom astropy.utils.decorators import format_doc\nfrom astropy.coordinates.representation import CartesianRepresentation, CartesianDifferential\nfrom astropy.coordinates.baseframe import BaseCoordinateFrame, base_doc\nfrom astropy.coordinates.attributes import TimeAttribute\nfrom .utils import DEFAULT_OBSTIME\n\n__all__ = ['ITRS']\n\n\n@format_doc(base_doc, components=\"\", footer=\"\")\nclass ITRS(BaseCoordinateFrame):\n    \"\"\"\n    A coordinate or frame in the International Terrestrial Reference System\n    (ITRS).  This is approximately a geocentric system, although strictly it is\n    defined by a series of reference locations near the surface of the Earth.\n    For more background on the ITRS, see the references provided in the\n    :ref:`astropy:astropy-coordinates-seealso` section of the documentation.\n    \"\"\"\n\n    default_representation = CartesianRepresentation\n    default_differential = CartesianDifferential\n\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n\n    @property\n    def earth_location(self):\n        \"\"\"\n        The data in this frame as an `~astropy.coordinates.EarthLocation` class.\n        \"\"\"\n        from astropy.coordinates.earth import EarthLocation\n\n        cart = self.represent_as(CartesianRepresentation)\n        return EarthLocation(x=cart.x, y=cart.y, z=cart.z)\n\n# Self-transform is in intermediate_rotation_transforms.py with all the other\n# ITRS transforms\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":15485,"name":"DEFAULT_OBSTIME","nodeType":"Attribute","startLoc":30,"text":"DEFAULT_OBSTIME"},{"id":15486,"name":"fk4_no_e_fk5.csv","nodeType":"TextFile","path":"astropy/coordinates/tests/accuracy/data","text":"# This file was generated with the ref_fk4_no_e_fk5.py script, and the reference values were computed using AST\nequinox_fk4,equinox_fk5,obstime,ra_in,dec_in,ra_fk5,dec_fk5,ra_fk4,dec_fk4\nB1948.36,J1992.59,B1995.95,334.661793414,43.9385116594,335.127505587,44.1614743713,334.19703321,43.7164045503\nB1971.64,J2006.23,B1954.56,113.895199649,-14.1109832563,114.294239451,-14.189617335,113.496041526,-14.0335757922\nB1970.49,J2015.57,B1953.55,66.2107722038,-7.76265420193,66.7573654302,-7.66250556575,65.6644607308,-7.86499337709\nB1931.50,J1999.69,B1970.69,73.6417002791,41.7006137481,74.8414427945,41.8037189279,72.4451689528,41.5898910005\nB1951.47,J1977.66,B1960.78,204.381010469,-14.9357743223,204.732916483,-15.0684119497,204.02947143,-14.8027671534\nB1955.96,J1999.16,B1975.98,214.396093073,-66.7648451487,215.271219746,-66.9622610907,213.531009752,-66.5653657951\nB1956.23,J2000.23,B1977.93,347.225227105,6.27744217753,347.783144277,6.51660389395,346.667337259,6.03880786927\nB1957.34,J1996.85,B1973.69,235.143754874,-5.59566003897,235.668034446,-5.72055011897,234.619987804,-5.46911905342\nB1941.60,J1993.80,B1960.79,269.606389512,26.7823112195,270.128504362,26.7816404236,269.084278188,26.7856304113\nB1930.71,J2013.89,B1961.97,235.285153507,-14.0695156888,236.447792421,-14.3293747521,234.125715822,-13.8019427393\nB1953.56,J1980.00,B1960.84,269.177331338,42.9472695107,269.379190001,42.9454157845,268.975475883,42.9496418506\nB1940.10,J1975.82,B1982.78,346.070424986,-3.51848810713,346.530942755,-3.32528640922,345.609649936,-3.71130492658\nB1934.68,J2014.12,B1992.32,3.01978725896,7.19732176646,4.04111300197,7.63872974164,1.9996375316,6.75549866988\nB1953.24,J2017.66,B1996.52,38.3199756112,18.8080489808,39.2225541698,19.0876452406,37.4201227465,18.5249551135\nB1955.52,J1986.19,B1990.02,107.533336957,-4.33088623215,107.914038138,-4.38286340945,107.152514675,-4.27999097547\nB1927.27,J2006.35,B1984.04,236.30802591,14.3162535375,237.227969566,14.0749779959,235.388744829,14.5634084162\nB1974.27,J1978.23,B1960.36,291.532518915,-33.7960784017,291.597238932,-33.7879646382,291.467788569,-33.8041689728\nB1930.19,J1986.95,B1987.08,313.983328941,27.7572327639,314.590894151,27.9778790422,313.375876285,27.5389973059\nB1945.29,J1997.99,B1984.85,347.273135054,-13.6880685538,347.963547495,-13.4015008868,346.58154003,-13.9738567052\nB1958.28,J2008.13,B1969.09,260.526724891,-37.6134342267,261.376886242,-37.6570793786,259.677433211,-37.5657291394\nB1934.85,J1985.89,B1992.51,231.291118043,-27.2371455509,232.060225806,-27.4133463836,230.524106155,-27.0579724511\nB1937.09,J1998.50,B1976.41,258.283303492,-30.1025933842,259.264766067,-30.1691519653,257.303071837,-30.0303039078\nB1956.16,J2023.91,B1994.65,168.335642599,-44.084769302,169.131984863,-44.4546574256,167.543307692,-43.7159381708\nB1964.94,J2000.65,B1991.03,117.210483914,32.8708634152,117.781943773,32.7790791562,116.63804006,32.9608828232\nB1952.23,J1998.51,B1961.43,158.272058119,-29.286471988,158.811965795,-29.5262894831,157.73289082,-29.0475527364\nB1934.88,J2008.31,B1991.03,262.688069789,-48.1516431413,264.082620089,-48.1987316304,261.295758898,-48.0946938009\nB1964.21,J2001.06,B1956.93,357.845250924,19.2890677934,358.315118415,19.4941375001,357.375940593,19.084061288\nB1965.72,J1987.86,B1974.12,243.674536239,-10.0431678136,243.97803572,-10.097540261,243.371196745,-9.98821027624\nB1960.54,J2016.21,B1957.44,284.696106425,19.6051067047,285.302622767,19.6853290904,284.089422958,19.5280584762\nB1972.20,J1981.44,B1972.41,61.5291328053,18.6403709997,61.6630317661,18.6648463372,61.3952747433,18.6157899771\nB1967.75,J1983.60,B1983.30,9.66573928438,-22.9075078717,9.8627174508,-22.8205464878,9.46866122286,-22.9945202022\nB1973.18,J1983.75,B1989.45,288.133287813,-36.6947385674,288.310596498,-36.676339325,287.955909092,-36.712964737\nB1948.23,J1994.10,B1983.10,325.340113758,-33.7758802174,326.023797476,-33.5649649991,324.65398011,-33.9850593768\nB1949.25,J1980.08,B1985.58,8.88343575454,-49.4693354042,9.24701151693,-49.2998476535,8.51878534341,-49.6389915796\nB1954.32,J1994.49,B1994.40,177.029034641,-67.7755279684,177.517646511,-67.9988963388,176.544747657,-67.552257953\nB1972.10,J2015.50,B1957.08,189.451860246,-68.7071945134,190.114123213,-68.9453284555,188.797874924,-68.4686046268\nB1943.61,J1992.69,B1957.38,214.691763751,-32.6160600699,215.421492998,-32.8397553215,213.964722034,-32.3903875087\nB1954.91,J2018.83,B1966.30,18.7047162369,-32.9080620608,19.4489945613,-32.5717365496,17.9585532678,-33.2458719202\nB1955.68,J2022.94,B1951.59,322.232230099,14.4669345738,323.034821026,14.7645630389,321.42944541,14.1725191869\nB1953.00,J2016.94,B1984.39,262.175824918,51.7319974933,262.548281917,51.6846881399,261.803746337,51.7815981232\nB1930.93,J1980.75,B1988.24,294.6060041,34.0181871087,295.074015891,34.1347005761,294.137889278,33.9037336792\nB1945.15,J2003.12,B1967.50,180.08019102,26.2892216009,180.821706382,25.9664807149,179.336612509,26.6119683301\nB1936.07,J1980.42,B1980.80,291.668187169,-22.2789167174,292.329992922,-22.1864262743,291.005523355,-22.3687549985\nB1964.41,J2018.79,B1997.92,34.548669268,-15.8924906144,35.1967101241,-15.6441308582,33.9006331013,-16.1427921034\nB1963.20,J1992.50,B1964.55,78.8220157436,-37.4332268082,79.075079173,-37.4019554736,78.5689855058,-37.465204993\nB1933.72,J2019.89,B1984.33,93.1388621771,60.5731416456,95.0905202877,60.5387165097,91.184708092,60.591240446\nB1961.19,J1981.21,B1952.11,168.518071423,7.09229333513,168.777442158,6.98298378221,168.258596163,7.20150240716\nB1971.23,J2006.89,B1953.13,165.374352937,39.3890686842,165.87176885,39.196720756,164.875283704,39.5809806285\nB1948.80,J2018.63,B1990.72,255.423520875,-17.5881075751,256.438156117,-17.6826060848,254.410141307,-17.4869506738\nB1970.65,J1975.05,B1971.83,64.0990821181,36.8289797648,64.172215273,36.8396700703,64.0259656206,36.8182613277\nB1946.87,J1990.24,B1969.60,191.321958369,-52.3532066605,191.941068845,-52.5897148324,190.706679307,-52.1161877868\nB1928.29,J1976.44,B1966.53,60.3872023631,25.1025882655,61.1139601332,25.2335783606,59.6618880776,24.9686447968\nB1943.19,J2002.49,B1972.88,276.773010626,56.6051138031,277.035261703,56.6448029825,276.510294672,56.5669265636\nB1934.47,J1983.76,B1991.77,334.141397682,37.3852087993,334.681936673,37.63269657,333.601820309,37.1388490904\nB1932.42,J2004.50,B1973.34,219.417716878,-20.2290328911,220.436864842,-20.53677356,218.402163145,-19.9167676954\nB1935.55,J1975.26,B1971.06,54.0660580808,-29.3264933861,54.4742787759,-29.1973856015,53.6578513784,-29.4568765774\nB1968.98,J1989.10,B1978.54,176.26561333,-0.572718169429,176.523526883,-0.684515911301,176.007690571,-0.460953265257\nB1965.89,J2012.99,B1986.95,135.84418338,-9.94938261687,136.4156383,-10.1384151142,135.27243952,-9.76217234374\nB1956.58,J2018.60,B1952.75,305.496508312,-8.63421746611,306.333192119,-8.43166153129,304.658373119,-8.83266452583\nB1972.76,J2000.27,B1981.21,327.995002307,-58.3471659896,328.478135531,-58.216943679,327.509419894,-58.4767020929\nB1930.95,J1999.19,B1981.05,138.185539617,11.9337947187,139.11218066,11.6486009656,137.256622001,12.2148869077\nB1955.11,J1977.39,B1950.06,113.578525223,29.6301583121,113.928637253,29.5801804457,113.228110262,29.6794410184\nB1941.57,J2012.54,B1980.14,204.621895006,36.5235009134,205.408269314,36.1654570594,203.833462777,36.8838069508\nB1966.08,J2016.57,B1952.01,67.6144926088,-13.7094836718,68.1982560465,-13.6037505529,67.030977723,-13.8178646409\nB1957.99,J2018.30,B1979.29,45.3029557779,36.4639084123,46.2543764288,36.6980750272,44.3559469687,36.2257877401\nB1946.13,J2016.34,B1972.42,247.534489816,-3.23349952461,248.455025871,-3.37995755876,246.615033795,-3.08124145001\nB1960.80,J1999.98,B1967.69,287.858418461,26.2825631559,288.257968726,26.350185895,287.458797059,26.2163884515\nB1935.76,J1975.44,B1996.68,206.473163472,-38.4312130715,207.060791642,-38.6284341117,205.887695173,-38.2329839969\nB1925.84,J1992.06,B1963.36,350.362793376,-7.51631961926,351.218703416,-7.15237789524,349.505768066,-7.87933870474\nB1939.04,J2012.01,B1964.06,228.259575769,40.311002157,228.937164323,40.0423286476,227.581733934,40.5832613094\nB1955.09,J2020.54,B1975.25,319.831820932,40.7337792676,320.468436705,41.0135236496,319.195878847,40.4566449257\nB1948.03,J1989.70,B1982.34,178.349313153,-38.3854710615,178.878815281,-38.6173901794,177.821462042,-38.1536135802\nB1960.53,J1984.34,B1998.53,126.58195076,-73.6980337652,126.522212859,-73.7769656974,126.639550025,-73.6189928568\nB1933.23,J2019.21,B1951.79,257.122932676,24.0154376566,258.016684748,23.9123993004,256.229480593,24.1257542269\nB1972.01,J1994.20,B1971.16,181.414481921,-17.7858263698,181.700080407,-17.9093349916,181.129088126,-17.6623025404\nB1972.77,J2005.85,B1979.42,81.2295383474,-9.26450146427,81.6239207678,-9.2370487074,80.8352159785,-9.29320699924\nB1974.04,J2004.85,B1986.59,88.1907984871,32.4238226453,88.6946934578,32.4284817102,87.6869564835,32.4176559135\nB1927.94,J1991.17,B1958.78,285.408252018,67.7826509035,285.385328422,67.8761253941,285.427216468,67.6890523656\nB1962.02,J2007.00,B1975.53,178.262069224,51.7327600597,178.846486725,51.48241739,177.67431932,51.983025032\nB1955.03,J1997.43,B1975.01,329.433722424,-46.8960749035,330.103614247,-46.692118107,328.760372892,-47.0986245326\nB1929.45,J2009.92,B1994.64,340.333860195,36.5560891832,341.254677798,36.9791399195,339.41634063,36.1354568961\nB1974.47,J1983.10,B1969.13,191.963602676,21.3572019706,192.070505327,21.3101918576,191.856675141,21.4042306751\nB1952.44,J1984.77,B1983.14,90.8973340407,3.44588414281,91.3225022889,3.4423974082,90.4721556483,3.44803542582\nB1958.72,J1999.14,B1952.34,259.510340943,47.0512387915,259.790647567,47.0108077311,259.230159931,47.0927522883\nB1961.24,J2000.00,B1987.56,132.277954966,30.4307232942,132.867785214,30.2847386621,131.686701777,30.5750623541\nB1953.42,J2013.40,B1968.44,179.513439448,-54.44865752,180.28117417,-54.7825927917,178.751891964,-54.1147599287\nB1951.37,J1984.64,B1997.40,81.5670170865,-19.9451944488,81.9269374609,-19.9186092791,81.2071330825,-19.9729303814\nB1932.54,J2024.61,B1967.36,127.283632829,-10.0946390302,128.389991343,-10.4090695278,126.176062442,-9.78808786127\nB1937.01,J1991.26,B1984.19,234.306643184,-86.4404274379,239.159196268,-86.6062091923,229.877779523,-86.2547679857\nB1945.13,J2017.30,B1991.23,112.65584231,11.2521500479,113.653522343,11.0941650144,111.656584771,11.4036739314\nB1928.39,J2015.91,B1974.31,276.744760981,21.4151577082,277.676112471,21.4763175641,275.813216777,21.3618641896\nB1962.92,J2020.33,B1999.21,281.461357214,-15.511897988,282.28369792,-15.4461443386,280.638389569,-15.573154518\nB1942.13,J2011.97,B1980.19,306.867413859,-11.9467360888,307.826980276,-11.7108610078,305.905696925,-12.1773958306\nB1974.49,J1990.83,B1987.98,341.966066455,-2.82477813631,342.177020368,-2.73822865168,341.755054209,-2.91122392552\nB1969.43,J1976.38,B1984.23,38.6362483924,9.3322810896,38.7295143004,9.36248136387,38.5430036498,9.30204150263\nB1971.93,J2003.15,B1996.62,327.861128148,-46.529254733,328.357950708,-46.3816911362,327.362455314,-46.6760151537\nB1961.96,J2022.83,B1997.49,120.979858288,87.22617179,127.356289341,87.0356348542,113.806804821,87.3823224486\nB1926.35,J1982.80,B1999.51,297.496953653,0.839666332936,298.215707802,0.986504246823,296.777520197,0.696326958488\nB1944.12,J2012.89,B1956.31,323.316228643,-0.794522598791,324.199877999,-0.485711290555,322.43128765,-1.09980368764\nB1925.53,J1977.07,B1998.83,15.3775095611,-38.7740290611,15.975820035,-38.4977806231,14.777479512,-39.0510731102\nB1928.26,J1984.73,B1961.46,70.486199672,-24.0682131367,71.0773386429,-23.9647188389,69.8952283629,-24.1747645717\nB1959.07,J2001.01,B1959.30,106.020475905,36.6574903487,106.724489447,36.5916635763,105.315480342,36.7205573317\nB1974.33,J1998.24,B1975.46,225.719957006,-24.2326924255,226.069642,-24.3253436846,225.370713094,-24.1394598386\nB1958.31,J2014.48,B1976.52,31.0403178442,23.2187819108,31.8305300515,23.4855979353,30.252581142,22.9497454125\nB1945.76,J1981.40,B1964.13,51.4602071324,-27.0058546166,51.8377992184,-26.8827293131,51.0826217069,-27.1300027947\nB1927.06,J2019.62,B1965.51,185.697546923,55.594260797,186.80220854,55.0820030044,184.579796584,56.1075102073\nB1969.71,J1983.82,B1965.49,248.162878677,-23.7609450888,248.376028149,-23.7900358626,247.949821476,-23.7315830399\nB1960.34,J1996.74,B1963.32,308.385291884,51.2349043028,308.653885549,51.3611262862,308.116543047,51.1094272568\nB1948.94,J1982.47,B1979.67,233.050205996,63.3093356498,233.183624905,63.1972984089,232.917717277,63.4217190672\nB1935.78,J2009.44,B1960.86,209.382723191,-41.4659129842,210.508471779,-41.8212717612,208.265390379,-41.1066153061\nB1929.09,J2015.70,B1970.12,256.001743835,-16.3448051664,257.249402003,-16.4563411788,254.755864037,-16.2230882626\nB1958.66,J1984.63,B1964.43,90.8700685367,21.3678694408,91.2595104175,21.3651813051,90.4806144234,21.369574816\nB1974.74,J2003.91,B1958.69,324.057486054,57.4352750563,324.282176393,57.5669676284,323.83284781,57.3039563174\nB1954.68,J2011.04,B1961.29,159.225729446,-45.2472278228,159.836674886,-45.541209348,158.616784774,-44.9544310498\nB1967.01,J1998.76,B1999.43,7.38749687642,-53.1540997613,7.76348958513,-52.978901243,7.01015979396,-53.3294476754\nB1932.65,J1988.10,B1971.70,345.477965039,-10.1831007688,346.201723123,-9.88376000525,344.753111544,-10.4814629211\nB1968.81,J2011.71,B1991.41,234.801152081,71.8511934075,234.75819291,71.7134587916,234.849277912,71.9887729277\nB1952.24,J1992.46,B1978.63,184.754250038,-66.4894904918,185.31507512,-66.7125454196,184.198875868,-66.2662547282\nB1974.18,J2008.57,B1982.60,245.64829793,-38.7682176459,246.229734859,-38.8462753796,245.067899116,-38.6883914108\nB1961.79,J1977.75,B1986.49,176.234540627,12.5643501076,176.440478946,12.4756870596,176.028521797,12.6529921788\nB1929.65,J2019.85,B1969.56,333.536461653,-55.645568776,335.008274077,-55.1931712959,332.042112951,-56.0921730529\nB1939.61,J2001.08,B1969.64,185.716717981,-21.5568171888,186.518819162,-21.8971031217,184.916731889,-21.2160545858\nB1938.65,J1988.76,B1992.98,25.9775574253,12.7249831044,26.6478047282,12.9750431145,25.30853404,12.4734949987\nB1928.56,J2017.18,B1990.50,204.302987352,-36.6989586206,205.594712571,-37.1462777072,203.0212666,-36.2470793085\nB1959.00,J1997.12,B1991.83,221.487546141,22.5689795999,221.917649745,22.4105410037,221.057403953,22.7284735519\nB1936.24,J2008.46,B1959.40,338.956666009,-30.7135370512,339.96511112,-30.3370017697,337.943007518,-31.0875245016\nB1952.57,J2024.63,B1967.98,149.5308077,21.1458572723,150.530972008,20.7983136142,148.526893227,21.4898432119\nB1963.49,J2017.63,B1974.10,95.1983908472,-1.61163007915,95.8836923542,-1.64073778617,94.5129553374,-1.58611303786\nB1935.59,J2021.68,B1998.30,35.0615395317,-28.6207880841,36.013756926,-28.230800891,34.108208406,-29.0153533631\nB1939.64,J2018.11,B1978.17,174.903919876,-25.7547140538,175.892230462,-26.1901662894,173.918861307,-25.3199298979\nB1942.82,J1978.35,B1991.38,167.27863063,54.1842744725,167.792865117,53.9911451576,166.761561647,54.3770117742\nB1972.82,J1989.59,B1953.81,10.7133541168,-26.6356033619,10.9196530538,-26.5438625332,10.5069242085,-26.7274067313\nB1958.01,J1984.82,B1977.66,249.939886269,43.0233288254,250.152708941,42.9723921243,249.727120549,43.0747862488\nB1972.53,J1995.55,B1977.40,258.100960451,-37.3838036503,258.492060536,-37.4098004846,257.710089764,-37.356950996\nB1929.84,J1995.96,B1995.27,262.732112385,-19.8057986634,263.710992923,-19.8492450608,261.753853467,-19.7561160195\nB1938.23,J2022.91,B1968.47,149.166366188,63.2857703333,150.716387336,62.8777259431,147.585925919,63.6872128631\nB1938.61,J2021.20,B1995.06,5.4355841259,0.695799807062,6.49453219621,1.15308515723,4.37708671511,0.237709638907\nB1966.75,J2024.18,B1957.03,327.231056694,-11.1377396332,328.000338248,-10.8677167475,326.460220195,-11.4054365616\nB1965.64,J1994.07,B1954.96,284.17633852,-71.0631656787,284.986812185,-71.023307137,283.363277683,-71.1008495735\nB1939.69,J2023.20,B1998.66,59.4717008987,14.0960045791,60.6437035945,14.328043327,58.3026637155,13.8557849823\nB1957.49,J2004.52,B1997.10,112.602946077,-17.7763932222,113.128066437,-17.8781256601,112.077653347,-17.6768763275\nB1946.05,J2000.05,B1979.55,219.940310095,-26.5130440909,220.729784133,-26.7422090278,219.153387495,-26.2812240409\nB1928.73,J1989.10,B1952.60,131.216503219,-60.6790709392,131.538762739,-60.9012667241,130.892392069,-60.458301418\nB1961.94,J1983.12,B1952.51,56.1738921125,-19.3427782341,56.4110363048,-19.277323069,55.9367786527,-19.4086389221\nB1954.27,J1997.44,B1966.23,63.8293728328,-59.8347944156,64.0119166618,-59.729130492,63.6478301692,-59.9411437379\nB1942.23,J1992.36,B1968.79,312.440281577,-82.909075449,314.686445788,-82.716709549,310.089004633,-83.0931764134\nB1937.90,J2001.19,B1988.21,104.43408064,-66.6447299251,104.453108425,-66.7326176146,104.411797906,-66.5569652662\nB1939.59,J2002.19,B1992.96,210.664663673,-17.5831928536,211.524274634,-17.8816169868,209.807499075,-17.2821058793\nB1963.49,J1975.54,B1977.29,163.438155327,-54.6954182678,163.565812054,-54.7597430346,163.310636547,-54.6311360803\nB1946.22,J1989.83,B1966.19,148.024127582,2.32865180198,148.587881848,2.12205454824,147.4598279,2.53398329697\nB1939.43,J1983.41,B1970.29,317.748400264,-34.6457182874,318.424549161,-34.4635023474,317.070001399,-34.8259880426\nB1938.21,J2022.93,B1955.48,249.374885326,79.5246095403,248.102397286,79.3535339601,250.706479605,79.6856520522\nB1938.85,J1986.82,B1956.86,100.53840787,-27.7507223648,101.014813183,-27.8006647295,100.061930435,-27.7029635357\nB1967.12,J2016.63,B1987.27,23.1984832267,21.1208388177,23.8758085173,21.373531354,22.5228650317,20.8668643466\nB1933.48,J2010.39,B1993.82,71.5045009532,3.00896662959,72.5117326573,3.14121771682,70.4983597655,2.86958134305\nB1937.60,J2003.03,B1962.95,335.405788093,-6.90098238794,336.26168125,-6.56861752396,334.548406282,-7.23108048852\nB1954.59,J2010.06,B1984.28,307.588884401,18.8511389183,308.216046805,19.0408491208,306.961527852,18.6641076356\nB1973.77,J1985.60,B1967.96,343.704504442,-46.9224252956,343.875951545,-46.8591633148,343.532811099,-46.9856319247\nB1925.21,J2009.55,B1950.30,18.8112053675,35.1485289159,20.0024206727,35.5914321179,17.6282310843,34.702488267\nB1937.00,J2006.08,B1988.06,208.609805013,-46.3894275721,209.692670963,-46.7252945952,207.535889978,-46.0500943647\nB1961.33,J2010.87,B1970.70,172.978655994,15.4172636989,173.622309813,15.1433334088,172.333980129,15.6908149586\nB1937.54,J1982.63,B1966.69,7.8152324312,-34.9365736294,8.36836736742,-34.688026104,7.26063844242,-35.1854511343\nB1970.91,J1979.71,B1963.90,134.503366944,-72.4111269318,134.50595835,-72.4454843369,134.500551115,-72.3767711725\nB1950.41,J2022.56,B1979.63,149.073048424,14.7065160273,150.050293767,14.3602043524,148.092931537,15.0493015642\nB1950.13,J1995.20,B1966.26,217.406604209,16.5186514295,217.938935407,16.3200334608,216.874300735,16.7186856279\nB1960.62,J2007.17,B1996.84,241.829541848,16.5114334946,242.358489224,16.3901534117,241.300790354,16.6348221277\nB1956.99,J2023.02,B1954.80,301.991652158,46.8228690265,302.505263266,47.0190374374,301.477638783,46.6294966913\nB1939.22,J2016.87,B1994.16,280.629434995,-19.0017596678,281.769997009,-18.9177962123,279.487664877,-19.0772612574\nB1925.49,J1981.53,B1978.40,144.252375855,-10.2581330338,144.937158573,-10.5124362227,143.567309058,-10.006008783\nB1954.74,J2000.05,B1953.10,286.0305233,12.7464714044,286.556205108,12.8172544241,285.504676194,12.6779134146\nB1967.05,J1984.09,B1993.75,321.524751743,61.8464645226,321.632971919,61.9207781138,321.416450206,61.7722624353\nB1949.33,J1977.52,B1961.24,94.4962887092,-44.0946278203,94.7059415448,-44.1072194614,94.2866143528,-44.0826087841\nB1964.04,J2019.75,B1989.97,356.110922656,-39.1892569317,356.840327262,-38.8797072373,355.378110002,-39.4985381971\nB1945.63,J1988.30,B1990.09,307.190555646,-43.7191034979,307.916952389,-43.5743180165,306.461507156,-43.8614854707\nB1943.99,J1977.69,B1951.45,263.331776174,25.1917278571,263.675941152,25.1704984165,262.987636197,25.2140768109\nB1969.92,J1999.97,B1981.35,128.003624894,58.8666544649,128.605737687,58.7629529731,127.398829454,58.9689675244\nB1969.84,J2014.01,B1980.23,317.984216655,-8.89508525523,318.575678141,-8.71153679083,317.391922121,-9.07693345337\nB1961.02,J2002.85,B1953.91,312.465272698,5.18400310772,312.985580994,5.34203296971,311.944618588,5.02753402011\nB1939.24,J1981.75,B1988.65,344.0759205,-20.8070551085,344.644700272,-20.5791609914,343.505986239,-21.0343039973\nB1941.99,J1994.43,B1957.17,0.0386123471053,-42.7336081023,0.708747131881,-42.4416361362,359.365316955,-43.025582347\nB1939.26,J1987.88,B1973.18,5.95477509083,23.9728714179,6.5909526232,24.2419429246,5.32008332697,23.7034884386\nB1963.98,J2001.37,B1954.86,113.065220613,27.4191705733,113.643404238,27.3366368146,112.486263629,27.4997700815\nB1925.23,J2020.13,B1978.49,358.313822853,67.0446512684,359.505559565,67.5728883986,357.14681594,66.5167328688\nB1929.23,J2017.66,B1970.19,53.5839203362,-15.011852649,54.610957277,-14.7231509285,52.5576449921,-15.3076533827\nB1947.07,J2016.84,B1979.33,60.2557627351,25.6833225299,61.3134611254,25.8729083597,59.2011689172,25.4875201301\nB1937.55,J1985.79,B1987.44,273.08593329,76.4393919681,272.591344908,76.4526927726,273.578774594,76.4237802487\nB1970.29,J1981.68,B1994.48,25.0306798156,-51.1202356021,25.1435488988,-51.0628198065,24.9177386023,-51.177704254\nB1969.04,J1981.01,B1968.97,253.970437895,31.094899255,254.085382476,31.0765584395,253.855499113,31.1133685873\nB1960.83,J2018.73,B1964.62,168.89950144,-43.2270950714,169.584603614,-43.5437889415,168.217301809,-42.9111416391\nB1936.93,J1979.00,B1975.46,3.66775780511,39.2622225734,4.22000281563,39.4958903381,3.11745305971,39.0284106254\nB1971.26,J1994.47,B1976.64,278.936590632,6.21231840756,279.220262021,6.23271017522,278.652884808,6.19255870349\nB1973.48,J1984.09,B1955.27,285.91236301,9.40548699672,286.039106102,9.42175539099,285.785609343,9.38934433416\nB1953.91,J1995.56,B1952.30,53.8450026285,60.7259893436,54.7155379279,60.8613834632,52.9800334576,60.5877592411\nB1938.45,J2016.67,B1981.10,8.53330744443,-7.54498028811,9.52668790991,-7.1149113183,7.53943191911,-7.97616983921\nB1940.05,J2023.92,B1991.12,274.342957522,-1.24603088049,275.427502795,-1.20626637794,273.258110296,-1.27698166464\nB1956.27,J1975.21,B1952.75,80.5212647616,19.4060625392,80.8007537943,19.4231777982,80.2418410241,19.3884398656\nB1963.99,J2002.99,B1989.90,94.3827831954,15.0883386826,94.9409404907,15.0706908672,93.8245150675,15.1038774277\nB1946.06,J2012.59,B1962.21,164.473020999,-47.6965440186,165.218388831,-48.0540734375,163.731379108,-47.3403011601\nB1957.85,J1994.50,B1990.18,89.9736906625,-16.9964263489,90.3810379284,-16.9970588536,89.5663435591,-16.9972444015\nB1946.18,J1990.43,B1964.91,204.582082173,15.6789515837,205.12023156,15.4553934359,204.04377436,15.9034725087\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":15487,"name":"__all__","nodeType":"Attribute","startLoc":10,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"itrs.py#<anonymous>","id":15488,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['ITRS']"},{"fileName":"icrs_cirs_transforms.py","filePath":"astropy/coordinates/builtin_frames","id":15489,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nContains the transformation functions for getting from ICRS/HCRS to CIRS and\nanything in between (currently that means GCRS)\n\"\"\"\n\nimport numpy as np\n\nfrom astropy import units as u\nfrom astropy.coordinates.baseframe import frame_transform_graph\nfrom astropy.coordinates.transformations import (\n    FunctionTransformWithFiniteDifference,\n    AffineTransform,\n)\nfrom astropy.coordinates.representation import (\n    SphericalRepresentation,\n    CartesianRepresentation,\n    UnitSphericalRepresentation,\n    CartesianDifferential,\n)\n\nfrom .icrs import ICRS\nfrom .gcrs import GCRS\nfrom .cirs import CIRS\nfrom .hcrs import HCRS\nfrom .utils import aticq, atciqz, get_offset_sun_from_barycenter\n\nfrom ..erfa_astrom import erfa_astrom\n\n\n# First the ICRS/CIRS related transforms\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ICRS, CIRS)\ndef icrs_to_cirs(icrs_coo, cirs_frame):\n    # first set up the astrometry context for ICRS<->CIRS\n    astrom = erfa_astrom.get().apco(cirs_frame)\n\n    if icrs_coo.data.get_name() == 'unitspherical' or icrs_coo.data.to_cartesian().x.unit == u.one:\n        # if no distance, just do the infinite-distance/no parallax calculation\n        srepr = icrs_coo.spherical\n        cirs_ra, cirs_dec = atciqz(srepr.without_differentials(), astrom)\n\n        newrep = UnitSphericalRepresentation(lat=u.Quantity(cirs_dec, u.radian, copy=False),\n                                             lon=u.Quantity(cirs_ra, u.radian, copy=False),\n                                             copy=False)\n    else:\n        # When there is a distance,  we first offset for parallax to get the\n        # astrometric coordinate direction and *then* run the ERFA transform for\n        # no parallax/PM. This ensures reversibility and is more sensible for\n        # inside solar system objects\n        astrom_eb = CartesianRepresentation(astrom['eb'], unit=u.au,\n                                            xyz_axis=-1, copy=False)\n        newcart = icrs_coo.cartesian - astrom_eb\n        srepr = newcart.represent_as(SphericalRepresentation)\n        cirs_ra, cirs_dec = atciqz(srepr.without_differentials(), astrom)\n\n        newrep = SphericalRepresentation(lat=u.Quantity(cirs_dec, u.radian, copy=False),\n                                         lon=u.Quantity(cirs_ra, u.radian, copy=False),\n                                         distance=srepr.distance, copy=False)\n\n    return cirs_frame.realize_frame(newrep)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, ICRS)\ndef cirs_to_icrs(cirs_coo, icrs_frame):\n    # set up the astrometry context for ICRS<->cirs and then convert to\n    # astrometric coordinate direction\n    astrom = erfa_astrom.get().apco(cirs_coo)\n    srepr = cirs_coo.represent_as(SphericalRepresentation)\n    i_ra, i_dec = aticq(srepr.without_differentials(), astrom)\n\n    if cirs_coo.data.get_name() == 'unitspherical' or cirs_coo.data.to_cartesian().x.unit == u.one:\n        # if no distance, just use the coordinate direction to yield the\n        # infinite-distance/no parallax answer\n        newrep = UnitSphericalRepresentation(lat=u.Quantity(i_dec, u.radian, copy=False),\n                                             lon=u.Quantity(i_ra, u.radian, copy=False),\n                                             copy=False)\n    else:\n        # When there is a distance, apply the parallax/offset to the SSB as the\n        # last step - ensures round-tripping with the icrs_to_cirs transform\n\n        # the distance in intermedrep is *not* a real distance as it does not\n        # include the offset back to the SSB\n        intermedrep = SphericalRepresentation(lat=u.Quantity(i_dec, u.radian, copy=False),\n                                              lon=u.Quantity(i_ra, u.radian, copy=False),\n                                              distance=srepr.distance,\n                                              copy=False)\n\n        astrom_eb = CartesianRepresentation(astrom['eb'], unit=u.au,\n                                            xyz_axis=-1, copy=False)\n        newrep = intermedrep + astrom_eb\n\n    return icrs_frame.realize_frame(newrep)\n\n\n# Now the GCRS-related transforms to/from ICRS\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ICRS, GCRS)\ndef icrs_to_gcrs(icrs_coo, gcrs_frame):\n    # first set up the astrometry context for ICRS<->GCRS.\n    astrom = erfa_astrom.get().apcs(gcrs_frame)\n\n    if icrs_coo.data.get_name() == 'unitspherical' or icrs_coo.data.to_cartesian().x.unit == u.one:\n        # if no distance, just do the infinite-distance/no parallax calculation\n        srepr = icrs_coo.represent_as(SphericalRepresentation)\n        gcrs_ra, gcrs_dec = atciqz(srepr.without_differentials(), astrom)\n\n        newrep = UnitSphericalRepresentation(lat=u.Quantity(gcrs_dec, u.radian, copy=False),\n                                             lon=u.Quantity(gcrs_ra, u.radian, copy=False),\n                                             copy=False)\n    else:\n        # When there is a distance,  we first offset for parallax to get the\n        # BCRS coordinate direction and *then* run the ERFA transform for no\n        # parallax/PM. This ensures reversibility and is more sensible for\n        # inside solar system objects\n        astrom_eb = CartesianRepresentation(astrom['eb'], unit=u.au,\n                                            xyz_axis=-1, copy=False)\n        newcart = icrs_coo.cartesian - astrom_eb\n\n        srepr = newcart.represent_as(SphericalRepresentation)\n        gcrs_ra, gcrs_dec = atciqz(srepr.without_differentials(), astrom)\n\n        newrep = SphericalRepresentation(lat=u.Quantity(gcrs_dec, u.radian, copy=False),\n                                         lon=u.Quantity(gcrs_ra, u.radian, copy=False),\n                                         distance=srepr.distance, copy=False)\n\n    return gcrs_frame.realize_frame(newrep)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 GCRS, ICRS)\ndef gcrs_to_icrs(gcrs_coo, icrs_frame):\n    # set up the astrometry context for ICRS<->GCRS and then convert to BCRS\n    # coordinate direction\n    astrom = erfa_astrom.get().apcs(gcrs_coo)\n\n    srepr = gcrs_coo.represent_as(SphericalRepresentation)\n    i_ra, i_dec = aticq(srepr.without_differentials(), astrom)\n\n    if gcrs_coo.data.get_name() == 'unitspherical' or gcrs_coo.data.to_cartesian().x.unit == u.one:\n        # if no distance, just use the coordinate direction to yield the\n        # infinite-distance/no parallax answer\n        newrep = UnitSphericalRepresentation(lat=u.Quantity(i_dec, u.radian, copy=False),\n                                             lon=u.Quantity(i_ra, u.radian, copy=False),\n                                             copy=False)\n    else:\n        # When there is a distance, apply the parallax/offset to the SSB as the\n        # last step - ensures round-tripping with the icrs_to_gcrs transform\n\n        # the distance in intermedrep is *not* a real distance as it does not\n        # include the offset back to the SSB\n        intermedrep = SphericalRepresentation(lat=u.Quantity(i_dec, u.radian, copy=False),\n                                              lon=u.Quantity(i_ra, u.radian, copy=False),\n                                              distance=srepr.distance,\n                                              copy=False)\n\n        astrom_eb = CartesianRepresentation(astrom['eb'], unit=u.au,\n                                            xyz_axis=-1, copy=False)\n        newrep = intermedrep + astrom_eb\n\n    return icrs_frame.realize_frame(newrep)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, HCRS)\ndef gcrs_to_hcrs(gcrs_coo, hcrs_frame):\n\n    if np.any(gcrs_coo.obstime != hcrs_frame.obstime):\n        # if they GCRS obstime and HCRS obstime are not the same, we first\n        # have to move to a GCRS where they are.\n        frameattrs = gcrs_coo.get_frame_attr_names()\n        frameattrs['obstime'] = hcrs_frame.obstime\n        gcrs_coo = gcrs_coo.transform_to(GCRS(**frameattrs))\n\n    # set up the astrometry context for ICRS<->GCRS and then convert to ICRS\n    # coordinate direction\n    astrom = erfa_astrom.get().apcs(gcrs_coo)\n    srepr = gcrs_coo.represent_as(SphericalRepresentation)\n    i_ra, i_dec = aticq(srepr.without_differentials(), astrom)\n\n    # convert to Quantity objects\n    i_ra = u.Quantity(i_ra, u.radian, copy=False)\n    i_dec = u.Quantity(i_dec, u.radian, copy=False)\n    if gcrs_coo.data.get_name() == 'unitspherical' or gcrs_coo.data.to_cartesian().x.unit == u.one:\n        # if no distance, just use the coordinate direction to yield the\n        # infinite-distance/no parallax answer\n        newrep = UnitSphericalRepresentation(lat=i_dec, lon=i_ra, copy=False)\n    else:\n        # When there is a distance, apply the parallax/offset to the\n        # Heliocentre as the last step to ensure round-tripping with the\n        # hcrs_to_gcrs transform\n\n        # Note that the distance in intermedrep is *not* a real distance as it\n        # does not include the offset back to the Heliocentre\n        intermedrep = SphericalRepresentation(lat=i_dec, lon=i_ra,\n                                              distance=srepr.distance,\n                                              copy=False)\n\n        # astrom['eh'] and astrom['em'] contain Sun to observer unit vector,\n        # and distance, respectively. Shapes are (X) and (X,3), where (X) is the\n        # shape resulting from broadcasting the shape of the times object\n        # against the shape of the pv array.\n        # broadcast em to eh and scale eh\n        eh = astrom['eh'] * astrom['em'][..., np.newaxis]\n        eh = CartesianRepresentation(eh, unit=u.au, xyz_axis=-1, copy=False)\n\n        newrep = intermedrep.to_cartesian() + eh\n\n    return hcrs_frame.realize_frame(newrep)\n\n\n_NEED_ORIGIN_HINT = (\"The input {0} coordinates do not have length units. This \"\n                     \"probably means you created coordinates with lat/lon but \"\n                     \"no distance.  Heliocentric<->ICRS transforms cannot \"\n                     \"function in this case because there is an origin shift.\")\n\n\n@frame_transform_graph.transform(AffineTransform, HCRS, ICRS)\ndef hcrs_to_icrs(hcrs_coo, icrs_frame):\n    # this is just an origin translation so without a distance it cannot go ahead\n    if isinstance(hcrs_coo.data, UnitSphericalRepresentation):\n        raise u.UnitsError(_NEED_ORIGIN_HINT.format(hcrs_coo.__class__.__name__))\n\n    return None, get_offset_sun_from_barycenter(hcrs_coo.obstime,\n                                                include_velocity=bool(hcrs_coo.data.differentials))\n\n\n@frame_transform_graph.transform(AffineTransform, ICRS, HCRS)\ndef icrs_to_hcrs(icrs_coo, hcrs_frame):\n    # this is just an origin translation so without a distance it cannot go ahead\n    if isinstance(icrs_coo.data, UnitSphericalRepresentation):\n        raise u.UnitsError(_NEED_ORIGIN_HINT.format(icrs_coo.__class__.__name__))\n\n    return None, get_offset_sun_from_barycenter(hcrs_frame.obstime, reverse=True,\n                                                include_velocity=bool(icrs_coo.data.differentials))\n\n\n# Create loopback transformations\nframe_transform_graph._add_merged_transform(CIRS, ICRS, CIRS)\n# The CIRS<-> CIRS transform going through ICRS has a\n# subtle implication that a point in CIRS is uniquely determined\n# by the corresponding astrometric ICRS coordinate *at its\n# current time*.  This has some subtle implications in terms of GR, but\n# is sort of glossed over in the current scheme because we are dropping\n# distances anyway.\nframe_transform_graph._add_merged_transform(GCRS, ICRS, GCRS)\nframe_transform_graph._add_merged_transform(HCRS, ICRS, HCRS)\n"},{"col":4,"comment":"null","endLoc":2372,"header":"def scale_factors(self)","id":15490,"name":"scale_factors","nodeType":"Function","startLoc":2367,"text":"def scale_factors(self):\n        rho = self.rho / u.radian\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return {'rho': l,\n                'phi': rho,\n                'z': l}"},{"col":4,"comment":"\n        Converts 3D rectangular cartesian coordinates to cylindrical polar\n        coordinates.\n        ","endLoc":2385,"header":"@classmethod\n    def from_cartesian(cls, cart)","id":15491,"name":"from_cartesian","nodeType":"Function","startLoc":2374,"text":"@classmethod\n    def from_cartesian(cls, cart):\n        \"\"\"\n        Converts 3D rectangular cartesian coordinates to cylindrical polar\n        coordinates.\n        \"\"\"\n\n        rho = np.hypot(cart.x, cart.y)\n        phi = np.arctan2(cart.y, cart.x)\n        z = cart.z\n\n        return cls(rho=rho, phi=phi, z=z, copy=False)"},{"attributeType":"null","col":4,"comment":"null","endLoc":24,"id":15492,"name":"target_lon","nodeType":"Attribute","startLoc":24,"text":"target_lon"},{"fileName":"gcrs.py","filePath":"astropy/coordinates/builtin_frames","id":15493,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom astropy import units as u\nfrom astropy.utils.decorators import format_doc\nfrom astropy.coordinates.attributes import (TimeAttribute,\n                                            CartesianRepresentationAttribute)\nfrom .utils import DEFAULT_OBSTIME, EQUINOX_J2000\nfrom astropy.coordinates.baseframe import base_doc\nfrom .baseradec import BaseRADecFrame, doc_components\n\n__all__ = ['GCRS', 'PrecessedGeocentric']\n\n\ndoc_footer_gcrs = \"\"\"\n    Other parameters\n    ----------------\n    obstime : `~astropy.time.Time`\n        The time at which the observation is taken.  Used for determining the\n        position of the Earth.\n    obsgeoloc : `~astropy.coordinates.CartesianRepresentation`, `~astropy.units.Quantity`\n        The position of the observer relative to the center-of-mass of the\n        Earth, oriented the same as BCRS/ICRS. Either [0, 0, 0],\n        `~astropy.coordinates.CartesianRepresentation`, or proper input for one,\n        i.e., a `~astropy.units.Quantity` with shape (3, ...) and length units.\n        Defaults to [0, 0, 0], meaning \"true\" GCRS.\n    obsgeovel : `~astropy.coordinates.CartesianRepresentation`, `~astropy.units.Quantity`\n        The velocity of the observer relative to the center-of-mass of the\n        Earth, oriented the same as BCRS/ICRS. Either [0, 0, 0],\n        `~astropy.coordinates.CartesianRepresentation`, or proper input for one,\n        i.e., a `~astropy.units.Quantity` with shape (3, ...) and velocity\n        units.  Defaults to [0, 0, 0], meaning \"true\" GCRS.\n\"\"\"\n\n\n@format_doc(base_doc, components=doc_components, footer=doc_footer_gcrs)\nclass GCRS(BaseRADecFrame):\n    \"\"\"\n    A coordinate or frame in the Geocentric Celestial Reference System (GCRS).\n\n    GCRS is distinct form ICRS mainly in that it is relative to the Earth's\n    center-of-mass rather than the solar system Barycenter.  That means this\n    frame includes the effects of aberration (unlike ICRS). For more background\n    on the GCRS, see the references provided in the\n    :ref:`astropy:astropy-coordinates-seealso` section of the documentation. (Of\n    particular note is Section 1.2 of\n    `USNO Circular 179 <https://arxiv.org/abs/astro-ph/0602086>`_)\n\n    This frame also includes frames that are defined *relative* to the Earth,\n    but that are offset (in both position and velocity) from the Earth.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n    obsgeoloc = CartesianRepresentationAttribute(default=[0, 0, 0],\n                                                 unit=u.m)\n    obsgeovel = CartesianRepresentationAttribute(default=[0, 0, 0],\n                                                 unit=u.m/u.s)\n\n\n# The \"self-transform\" is defined in icrs_cirs_transformations.py, because in\n# the current implementation it goes through ICRS (like CIRS)\n\n\ndoc_footer_prec_geo = \"\"\"\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\n        The (mean) equinox to precess the coordinates to.\n    obstime : `~astropy.time.Time`\n        The time at which the observation is taken.  Used for determining the\n        position of the Earth.\n    obsgeoloc : `~astropy.coordinates.CartesianRepresentation`, `~astropy.units.Quantity`\n        The position of the observer relative to the center-of-mass of the\n        Earth, oriented the same as BCRS/ICRS. Either [0, 0, 0],\n        `~astropy.coordinates.CartesianRepresentation`, or proper input for one,\n        i.e., a `~astropy.units.Quantity` with shape (3, ...) and length units.\n        Defaults to [0, 0, 0], meaning \"true\" Geocentric.\n    obsgeovel : `~astropy.coordinates.CartesianRepresentation`, `~astropy.units.Quantity`\n        The velocity of the observer relative to the center-of-mass of the\n        Earth, oriented the same as BCRS/ICRS. Either 0,\n        `~astropy.coordinates.CartesianRepresentation`, or proper input for one,\n        i.e., a `~astropy.units.Quantity` with shape (3, ...) and velocity\n        units. Defaults to [0, 0, 0], meaning \"true\" Geocentric.\n\"\"\"\n\n\n@format_doc(base_doc, components=doc_components, footer=doc_footer_prec_geo)\nclass PrecessedGeocentric(BaseRADecFrame):\n    \"\"\"\n    A coordinate frame defined in a similar manner as GCRS, but precessed to a\n    requested (mean) equinox.  Note that this does *not* end up the same as\n    regular GCRS even for J2000 equinox, because the GCRS orientation is fixed\n    to that of ICRS, which is not quite the same as the dynamical J2000\n    orientation.\n\n    The frame attributes are listed under **Other Parameters**\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n    obsgeoloc = CartesianRepresentationAttribute(default=[0, 0, 0], unit=u.m)\n    obsgeovel = CartesianRepresentationAttribute(default=[0, 0, 0], unit=u.m/u.s)\n"},{"col":0,"comment":"\n    Accuracy tests for the FK4 (with no E-terms of aberration) to/from FK4\n    conversion, with arbitrary equinoxes and epoch of observation.\n    ","endLoc":68,"header":"def ref_fk4_no_e_fk4(fnout='fk4_no_e_fk4.csv')","id":15494,"name":"ref_fk4_no_e_fk4","nodeType":"Function","startLoc":14,"text":"def ref_fk4_no_e_fk4(fnout='fk4_no_e_fk4.csv'):\n    \"\"\"\n    Accuracy tests for the FK4 (with no E-terms of aberration) to/from FK4\n    conversion, with arbitrary equinoxes and epoch of observation.\n    \"\"\"\n\n    import starlink.Ast as Ast\n\n    np.random.seed(12345)\n\n    N = 200\n\n    # Sample uniformly on the unit sphere. These will be either the FK4\n    # coordinates for the transformation to FK5, or the FK5 coordinates for the\n    # transformation to FK4.\n    ra = np.random.uniform(0., 360., N)\n    dec = np.degrees(np.arcsin(np.random.uniform(-1., 1., N)))\n\n    # Generate random observation epoch and equinoxes\n    obstime = [f\"B{x:7.2f}\" for x in np.random.uniform(1950., 2000., N)]\n\n    ra_fk4ne, dec_fk4ne = [], []\n    ra_fk4, dec_fk4 = [], []\n\n    for i in range(N):\n\n        # Set up frames for AST\n        frame_fk4ne = Ast.SkyFrame(f'System=FK4-NO-E,Epoch={obstime[i]},Equinox=B1950')\n        frame_fk4 = Ast.SkyFrame(f'System=FK4,Epoch={obstime[i]},Equinox=B1950')\n\n        # FK4 to FK4 (no E-terms)\n        frameset = frame_fk4.convert(frame_fk4ne)\n        coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]]))\n        ra_fk4ne.append(coords[0, 0])\n        dec_fk4ne.append(coords[1, 0])\n\n        # FK4 (no E-terms) to FK4\n        frameset = frame_fk4ne.convert(frame_fk4)\n        coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]]))\n        ra_fk4.append(coords[0, 0])\n        dec_fk4.append(coords[1, 0])\n\n    # Write out table to a CSV file\n    t = Table()\n    t.add_column(Column(name='obstime', data=obstime))\n    t.add_column(Column(name='ra_in', data=ra))\n    t.add_column(Column(name='dec_in', data=dec))\n    t.add_column(Column(name='ra_fk4ne', data=ra_fk4ne))\n    t.add_column(Column(name='dec_fk4ne', data=dec_fk4ne))\n    t.add_column(Column(name='ra_fk4', data=ra_fk4))\n    t.add_column(Column(name='dec_fk4', data=dec_fk4))\n    f = open(os.path.join('data', fnout), 'wb')\n    f.write(\"# This file was generated with the {} script, and the reference \"\n            \"values were computed using AST\\n\".format(os.path.basename(__file__)))\n    t.write(f, format='ascii', delimiter=',')"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":15495,"name":"EQUINOX_J2000","nodeType":"Attribute","startLoc":25,"text":"EQUINOX_J2000"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":15496,"name":"doc_components","nodeType":"Attribute","startLoc":11,"text":"doc_components"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":15497,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":15498,"name":"doc_footer_gcrs","nodeType":"Attribute","startLoc":15,"text":"doc_footer_gcrs"},{"attributeType":"null","col":0,"comment":"null","endLoc":66,"id":15499,"name":"doc_footer_prec_geo","nodeType":"Attribute","startLoc":66,"text":"doc_footer_prec_geo"},{"className":"AffineTransform","col":0,"comment":"\n    A coordinate transformation specified as a function that yields a 3 x 3\n    cartesian transformation matrix and a tuple of displacement vectors.\n\n    See `~astropy.coordinates.builtin_frames.galactocentric.Galactocentric` for\n    an example.\n\n    Parameters\n    ----------\n    transform_func : callable\n        A callable that has the signature ``transform_func(fromcoord, toframe)``\n        and returns: a (3, 3) matrix that operates on ``fromcoord`` in a\n        Cartesian representation, and a ``CartesianRepresentation`` with\n        (optionally) an attached velocity ``CartesianDifferential`` to represent\n        a translation and offset in velocity to apply after the matrix\n        operation.\n    fromsys : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n\n    Raises\n    ------\n    TypeError\n        If ``transform_func`` is not callable\n\n    ","endLoc":1308,"id":15500,"nodeType":"Class","startLoc":1262,"text":"class AffineTransform(BaseAffineTransform):\n    \"\"\"\n    A coordinate transformation specified as a function that yields a 3 x 3\n    cartesian transformation matrix and a tuple of displacement vectors.\n\n    See `~astropy.coordinates.builtin_frames.galactocentric.Galactocentric` for\n    an example.\n\n    Parameters\n    ----------\n    transform_func : callable\n        A callable that has the signature ``transform_func(fromcoord, toframe)``\n        and returns: a (3, 3) matrix that operates on ``fromcoord`` in a\n        Cartesian representation, and a ``CartesianRepresentation`` with\n        (optionally) an attached velocity ``CartesianDifferential`` to represent\n        a translation and offset in velocity to apply after the matrix\n        operation.\n    fromsys : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n\n    Raises\n    ------\n    TypeError\n        If ``transform_func`` is not callable\n\n    \"\"\"\n\n    def __init__(self, transform_func, fromsys, tosys, priority=1,\n                 register_graph=None):\n\n        if not callable(transform_func):\n            raise TypeError('transform_func is not callable')\n        self.transform_func = transform_func\n\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)\n\n    def _affine_params(self, fromcoord, toframe):\n        return self.transform_func(fromcoord, toframe)"},{"col":0,"comment":"","endLoc":4,"header":"gcrs.py#<anonymous>","id":15501,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['GCRS', 'PrecessedGeocentric']\n\ndoc_footer_gcrs = \"\"\"\n    Other parameters\n    ----------------\n    obstime : `~astropy.time.Time`\n        The time at which the observation is taken.  Used for determining the\n        position of the Earth.\n    obsgeoloc : `~astropy.coordinates.CartesianRepresentation`, `~astropy.units.Quantity`\n        The position of the observer relative to the center-of-mass of the\n        Earth, oriented the same as BCRS/ICRS. Either [0, 0, 0],\n        `~astropy.coordinates.CartesianRepresentation`, or proper input for one,\n        i.e., a `~astropy.units.Quantity` with shape (3, ...) and length units.\n        Defaults to [0, 0, 0], meaning \"true\" GCRS.\n    obsgeovel : `~astropy.coordinates.CartesianRepresentation`, `~astropy.units.Quantity`\n        The velocity of the observer relative to the center-of-mass of the\n        Earth, oriented the same as BCRS/ICRS. Either [0, 0, 0],\n        `~astropy.coordinates.CartesianRepresentation`, or proper input for one,\n        i.e., a `~astropy.units.Quantity` with shape (3, ...) and velocity\n        units.  Defaults to [0, 0, 0], meaning \"true\" GCRS.\n\"\"\"\n\ndoc_footer_prec_geo = \"\"\"\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\n        The (mean) equinox to precess the coordinates to.\n    obstime : `~astropy.time.Time`\n        The time at which the observation is taken.  Used for determining the\n        position of the Earth.\n    obsgeoloc : `~astropy.coordinates.CartesianRepresentation`, `~astropy.units.Quantity`\n        The position of the observer relative to the center-of-mass of the\n        Earth, oriented the same as BCRS/ICRS. Either [0, 0, 0],\n        `~astropy.coordinates.CartesianRepresentation`, or proper input for one,\n        i.e., a `~astropy.units.Quantity` with shape (3, ...) and length units.\n        Defaults to [0, 0, 0], meaning \"true\" Geocentric.\n    obsgeovel : `~astropy.coordinates.CartesianRepresentation`, `~astropy.units.Quantity`\n        The velocity of the observer relative to the center-of-mass of the\n        Earth, oriented the same as BCRS/ICRS. Either 0,\n        `~astropy.coordinates.CartesianRepresentation`, or proper input for one,\n        i.e., a `~astropy.units.Quantity` with shape (3, ...) and velocity\n        units. Defaults to [0, 0, 0], meaning \"true\" Geocentric.\n\"\"\""},{"col":4,"comment":"null","endLoc":1305,"header":"def __init__(self, transform_func, fromsys, tosys, priority=1,\n                 register_graph=None)","id":15502,"name":"__init__","nodeType":"Function","startLoc":1297,"text":"def __init__(self, transform_func, fromsys, tosys, priority=1,\n                 register_graph=None):\n\n        if not callable(transform_func):\n            raise TypeError('transform_func is not callable')\n        self.transform_func = transform_func\n\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)"},{"fileName":"skyoffset.py","filePath":"astropy/coordinates/builtin_frames","id":15503,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom astropy import units as u\nfrom astropy.coordinates.transformations import DynamicMatrixTransform, FunctionTransform\nfrom astropy.coordinates.baseframe import (frame_transform_graph,\n                                           BaseCoordinateFrame)\nfrom astropy.coordinates.attributes import CoordinateAttribute, QuantityAttribute\nfrom astropy.coordinates.matrix_utilities import (rotation_matrix,\n                                                  matrix_product,\n                                                  matrix_transpose)\n\n_skyoffset_cache = {}\n\n\ndef make_skyoffset_cls(framecls):\n    \"\"\"\n    Create a new class that is the sky offset frame for a specific class of\n    origin frame. If such a class has already been created for this frame, the\n    same class will be returned.\n\n    The new class will always have component names for spherical coordinates of\n    ``lon``/``lat``.\n\n    Parameters\n    ----------\n    framecls : `~astropy.coordinates.BaseCoordinateFrame` subclass\n        The class to create the SkyOffsetFrame of.\n\n    Returns\n    -------\n    skyoffsetframecls : class\n        The class for the new skyoffset frame.\n\n    Notes\n    -----\n    This function is necessary because Astropy's frame transformations depend\n    on connection between specific frame *classes*.  So each type of frame\n    needs its own distinct skyoffset frame class.  This function generates\n    just that class, as well as ensuring that only one example of such a class\n    actually gets created in any given python session.\n    \"\"\"\n\n    if framecls in _skyoffset_cache:\n        return _skyoffset_cache[framecls]\n\n    # Create a new SkyOffsetFrame subclass for this frame class.\n    name = 'SkyOffset' + framecls.__name__\n    _SkyOffsetFramecls = type(\n        name, (SkyOffsetFrame, framecls),\n        {'origin': CoordinateAttribute(frame=framecls, default=None),\n         # The following two have to be done because otherwise we use the\n         # defaults of SkyOffsetFrame set by BaseCoordinateFrame.\n         '_default_representation': framecls._default_representation,\n         '_default_differential': framecls._default_differential,\n         '__doc__': SkyOffsetFrame.__doc__,\n         })\n\n    @frame_transform_graph.transform(FunctionTransform, _SkyOffsetFramecls, _SkyOffsetFramecls)\n    def skyoffset_to_skyoffset(from_skyoffset_coord, to_skyoffset_frame):\n        \"\"\"Transform between two skyoffset frames.\"\"\"\n\n        # This transform goes through the parent frames on each side.\n        # from_frame -> from_frame.origin -> to_frame.origin -> to_frame\n        intermediate_from = from_skyoffset_coord.transform_to(from_skyoffset_coord.origin)\n        intermediate_to = intermediate_from.transform_to(to_skyoffset_frame.origin)\n        return intermediate_to.transform_to(to_skyoffset_frame)\n\n    @frame_transform_graph.transform(DynamicMatrixTransform, framecls, _SkyOffsetFramecls)\n    def reference_to_skyoffset(reference_frame, skyoffset_frame):\n        \"\"\"Convert a reference coordinate to an sky offset frame.\"\"\"\n\n        # Define rotation matrices along the position angle vector, and\n        # relative to the origin.\n        origin = skyoffset_frame.origin.spherical\n        mat1 = rotation_matrix(-skyoffset_frame.rotation, 'x')\n        mat2 = rotation_matrix(-origin.lat, 'y')\n        mat3 = rotation_matrix(origin.lon, 'z')\n        return matrix_product(mat1, mat2, mat3)\n\n    @frame_transform_graph.transform(DynamicMatrixTransform, _SkyOffsetFramecls, framecls)\n    def skyoffset_to_reference(skyoffset_coord, reference_frame):\n        \"\"\"Convert an sky offset frame coordinate to the reference frame\"\"\"\n\n        # use the forward transform, but just invert it\n        R = reference_to_skyoffset(reference_frame, skyoffset_coord)\n        # transpose is the inverse because R is a rotation matrix\n        return matrix_transpose(R)\n\n    _skyoffset_cache[framecls] = _SkyOffsetFramecls\n    return _SkyOffsetFramecls\n\n\nclass SkyOffsetFrame(BaseCoordinateFrame):\n    \"\"\"\n    A frame which is relative to some specific position and oriented to match\n    its frame.\n\n    SkyOffsetFrames always have component names for spherical coordinates\n    of ``lon``/``lat``, *not* the component names for the frame of ``origin``.\n\n    This is useful for calculating offsets and dithers in the frame of the sky\n    relative to an arbitrary position. Coordinates in this frame are both centered on the position specified by the\n    ``origin`` coordinate, *and* they are oriented in the same manner as the\n    ``origin`` frame.  E.g., if ``origin`` is `~astropy.coordinates.ICRS`, this\n    object's ``lat`` will be pointed in the direction of Dec, while ``lon``\n    will point in the direction of RA.\n\n    For more on skyoffset frames, see :ref:`astropy:astropy-skyoffset-frames`.\n\n    Parameters\n    ----------\n    representation : `~astropy.coordinates.BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n    origin : coordinate-like\n        The coordinate which specifies the origin of this frame. Note that this\n        origin is used purely for on-sky location/rotation.  It can have a\n        ``distance`` but it will not be used by this ``SkyOffsetFrame``.\n    rotation : angle-like\n        The final rotation of the frame about the ``origin``. The sign of\n        the rotation is the left-hand rule.  That is, an object at a\n        particular position angle in the un-rotated system will be sent to\n        the positive latitude (z) direction in the final frame.\n\n\n    Notes\n    -----\n    ``SkyOffsetFrame`` is a factory class.  That is, the objects that it\n    yields are *not* actually objects of class ``SkyOffsetFrame``.  Instead,\n    distinct classes are created on-the-fly for whatever the frame class is\n    of ``origin``.\n    \"\"\"\n\n    rotation = QuantityAttribute(default=0, unit=u.deg)\n    origin = CoordinateAttribute(default=None, frame=None)\n\n    def __new__(cls, *args, **kwargs):\n        # We don't want to call this method if we've already set up\n        # an skyoffset frame for this class.\n        if not (issubclass(cls, SkyOffsetFrame) and cls is not SkyOffsetFrame):\n            # We get the origin argument, and handle it here.\n            try:\n                origin_frame = kwargs['origin']\n            except KeyError:\n                raise TypeError(\"Can't initialize an SkyOffsetFrame without origin= keyword.\")\n            if hasattr(origin_frame, 'frame'):\n                origin_frame = origin_frame.frame\n            newcls = make_skyoffset_cls(origin_frame.__class__)\n            return newcls.__new__(newcls, *args, **kwargs)\n\n        # http://stackoverflow.com/questions/19277399/why-does-object-new-work-differently-in-these-three-cases\n        # See above for why this is necessary. Basically, because some child\n        # may override __new__, we must override it here to never pass\n        # arguments to the object.__new__ method.\n        if super().__new__ is object.__new__:\n            return super().__new__(cls)\n        return super().__new__(cls, *args, **kwargs)\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        if self.origin is not None and not self.origin.has_data:\n            raise ValueError('The origin supplied to SkyOffsetFrame has no '\n                             'data.')\n        if self.has_data:\n            self._set_skyoffset_data_lon_wrap_angle(self.data)\n\n    @staticmethod\n    def _set_skyoffset_data_lon_wrap_angle(data):\n        if hasattr(data, 'lon'):\n            data.lon.wrap_angle = 180. * u.deg\n        return data\n\n    def represent_as(self, base, s='base', in_frame_units=False):\n        \"\"\"\n        Ensure the wrap angle for any spherical\n        representations.\n        \"\"\"\n        data = super().represent_as(base, s, in_frame_units=in_frame_units)\n        self._set_skyoffset_data_lon_wrap_angle(data)\n        return data\n"},{"className":"DynamicMatrixTransform","col":0,"comment":"\n    A coordinate transformation specified as a function that yields a\n    3 x 3 cartesian transformation matrix.\n\n    This is similar to, but distinct from StaticMatrixTransform, in that the\n    matrix for this class might depend on frame attributes.\n\n    Parameters\n    ----------\n    matrix_func : callable\n        A callable that has the signature ``matrix_func(fromcoord, toframe)`` and\n        returns a 3 x 3 matrix that converts ``fromcoord`` in a cartesian\n        representation to the new coordinate system.\n    fromsys : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n\n    Raises\n    ------\n    TypeError\n        If ``matrix_func`` is not callable\n\n    ","endLoc":1401,"id":15504,"nodeType":"Class","startLoc":1359,"text":"class DynamicMatrixTransform(BaseAffineTransform):\n    \"\"\"\n    A coordinate transformation specified as a function that yields a\n    3 x 3 cartesian transformation matrix.\n\n    This is similar to, but distinct from StaticMatrixTransform, in that the\n    matrix for this class might depend on frame attributes.\n\n    Parameters\n    ----------\n    matrix_func : callable\n        A callable that has the signature ``matrix_func(fromcoord, toframe)`` and\n        returns a 3 x 3 matrix that converts ``fromcoord`` in a cartesian\n        representation to the new coordinate system.\n    fromsys : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n\n    Raises\n    ------\n    TypeError\n        If ``matrix_func`` is not callable\n\n    \"\"\"\n\n    def __init__(self, matrix_func, fromsys, tosys, priority=1,\n                 register_graph=None):\n        if not callable(matrix_func):\n            raise TypeError('matrix_func is not callable')\n        self.matrix_func = matrix_func\n\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)\n\n    def _affine_params(self, fromcoord, toframe):\n        return self.matrix_func(fromcoord, toframe), None"},{"col":4,"comment":"null","endLoc":1398,"header":"def __init__(self, matrix_func, fromsys, tosys, priority=1,\n                 register_graph=None)","id":15505,"name":"__init__","nodeType":"Function","startLoc":1391,"text":"def __init__(self, matrix_func, fromsys, tosys, priority=1,\n                 register_graph=None):\n        if not callable(matrix_func):\n            raise TypeError('matrix_func is not callable')\n        self.matrix_func = matrix_func\n\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)"},{"col":4,"comment":"\n        Converts cylindrical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        ","endLoc":2396,"header":"def to_cartesian(self)","id":15506,"name":"to_cartesian","nodeType":"Function","startLoc":2387,"text":"def to_cartesian(self):\n        \"\"\"\n        Converts cylindrical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        \"\"\"\n        x = self.rho * np.cos(self.phi)\n        y = self.rho * np.sin(self.phi)\n        z = self.z\n\n        return CartesianRepresentation(x=x, y=y, z=z, copy=False)"},{"col":4,"comment":"null","endLoc":2412,"header":"def _scale_operation(self, op, *args)","id":15507,"name":"_scale_operation","nodeType":"Function","startLoc":2398,"text":"def _scale_operation(self, op, *args):\n        if any(differential.base_representation is not self.__class__\n               for differential in self.differentials.values()):\n            return super()._scale_operation(op, *args)\n\n        phi_op, _, rho_op = _spherical_op_funcs(op, *args)\n        z_op = lambda x: op(x, *args)\n\n        result = self.__class__(rho_op(self.rho), phi_op(self.phi),\n                                z_op(self.z), copy=False)\n        for key, differential in self.differentials.items():\n            new_comps = (op(getattr(differential, comp)) for op, comp in zip(\n                (rho_op, operator.pos, z_op), differential.components))\n            result.differentials[key] = differential.__class__(*new_comps, copy=False)\n        return result"},{"col":4,"comment":"null","endLoc":1308,"header":"def _affine_params(self, fromcoord, toframe)","id":15508,"name":"_affine_params","nodeType":"Function","startLoc":1307,"text":"def _affine_params(self, fromcoord, toframe):\n        return self.transform_func(fromcoord, toframe)"},{"col":4,"comment":"null","endLoc":1401,"header":"def _affine_params(self, fromcoord, toframe)","id":15509,"name":"_affine_params","nodeType":"Function","startLoc":1400,"text":"def _affine_params(self, fromcoord, toframe):\n        return self.matrix_func(fromcoord, toframe), None"},{"attributeType":"null","col":8,"comment":"null","endLoc":1302,"id":15510,"name":"transform_func","nodeType":"Attribute","startLoc":1302,"text":"self.transform_func"},{"col":15,"endLoc":2404,"id":15511,"nodeType":"Lambda","startLoc":2404,"text":"lambda x: op(x, *args)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1395,"id":15512,"name":"matrix_func","nodeType":"Attribute","startLoc":1395,"text":"self.matrix_func"},{"className":"CIRS","col":0,"comment":"\n    A coordinate or frame in the Celestial Intermediate Reference System (CIRS).\n\n    The frame attributes are listed under **Other Parameters**.\n    ","endLoc":37,"id":15513,"nodeType":"Class","startLoc":28,"text":"@format_doc(base_doc, components=doc_components, footer=doc_footer)\nclass CIRS(BaseRADecFrame):\n    \"\"\"\n    A coordinate or frame in the Celestial Intermediate Reference System (CIRS).\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n    location = EarthLocationAttribute(default=EARTH_CENTER)"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":15514,"name":"_skyoffset_cache","nodeType":"Attribute","startLoc":12,"text":"_skyoffset_cache"},{"col":0,"comment":"","endLoc":3,"header":"skyoffset.py#<anonymous>","id":15515,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"_skyoffset_cache = {}"},{"attributeType":"null","col":4,"comment":"null","endLoc":36,"id":15516,"name":"obstime","nodeType":"Attribute","startLoc":36,"text":"obstime"},{"fileName":"icrs_observed_transforms.py","filePath":"astropy/coordinates/builtin_frames","id":15517,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nContains the transformation functions for getting to \"observed\" systems from ICRS.\n\"\"\"\nimport erfa\n\nfrom astropy import units as u\nfrom astropy.coordinates.builtin_frames.utils import atciqz, aticq\nfrom astropy.coordinates.baseframe import frame_transform_graph\nfrom astropy.coordinates.transformations import FunctionTransformWithFiniteDifference\nfrom astropy.coordinates.representation import (SphericalRepresentation,\n                                                CartesianRepresentation,\n                                                UnitSphericalRepresentation)\n\nfrom .icrs import ICRS\nfrom .altaz import AltAz\nfrom .hadec import HADec\nfrom .utils import PIOVER2\nfrom ..erfa_astrom import erfa_astrom\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ICRS, AltAz)\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ICRS, HADec)\ndef icrs_to_observed(icrs_coo, observed_frame):\n    # if the data are UnitSphericalRepresentation, we can skip the distance calculations\n    is_unitspherical = (isinstance(icrs_coo.data, UnitSphericalRepresentation) or\n                        icrs_coo.cartesian.x.unit == u.one)\n    # first set up the astrometry context for ICRS<->observed\n    astrom = erfa_astrom.get().apco(observed_frame)\n\n    # correct for parallax to find BCRS direction from observer (as in erfa.pmpx)\n    if is_unitspherical:\n        srepr = icrs_coo.spherical\n    else:\n        observer_icrs = CartesianRepresentation(astrom['eb'], unit=u.au, xyz_axis=-1, copy=False)\n        srepr = (icrs_coo.cartesian - observer_icrs).represent_as(\n            SphericalRepresentation)\n\n    # convert to topocentric CIRS\n    cirs_ra, cirs_dec = atciqz(srepr, astrom)\n\n    # now perform observed conversion\n    if isinstance(observed_frame, AltAz):\n        lon, zen, _, _, _ = erfa.atioq(cirs_ra, cirs_dec, astrom)\n        lat = PIOVER2 - zen\n    else:\n        _, _, lon, lat, _ = erfa.atioq(cirs_ra, cirs_dec, astrom)\n\n    if is_unitspherical:\n        obs_srepr = UnitSphericalRepresentation(lon << u.radian, lat << u.radian, copy=False)\n    else:\n        obs_srepr = SphericalRepresentation(lon << u.radian, lat << u.radian, srepr.distance, copy=False)\n    return observed_frame.realize_frame(obs_srepr)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, AltAz, ICRS)\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, HADec, ICRS)\ndef observed_to_icrs(observed_coo, icrs_frame):\n    # if the data are UnitSphericalRepresentation, we can skip the distance calculations\n    is_unitspherical = (isinstance(observed_coo.data, UnitSphericalRepresentation) or\n                        observed_coo.cartesian.x.unit == u.one)\n\n    usrepr = observed_coo.represent_as(UnitSphericalRepresentation)\n    lon = usrepr.lon.to_value(u.radian)\n    lat = usrepr.lat.to_value(u.radian)\n\n    if isinstance(observed_coo, AltAz):\n        # the 'A' indicates zen/az inputs\n        coord_type = 'A'\n        lat = PIOVER2 - lat\n    else:\n        coord_type = 'H'\n\n    # first set up the astrometry context for ICRS<->CIRS at the observed_coo time\n    astrom = erfa_astrom.get().apco(observed_coo)\n\n    # Topocentric CIRS\n    cirs_ra, cirs_dec = erfa.atoiq(coord_type, lon, lat, astrom) << u.radian\n    if is_unitspherical:\n        srepr = SphericalRepresentation(cirs_ra, cirs_dec, 1, copy=False)\n    else:\n        srepr = SphericalRepresentation(lon=cirs_ra, lat=cirs_dec,\n                                        distance=observed_coo.distance, copy=False)\n\n    # BCRS (Astrometric) direction to source\n    bcrs_ra, bcrs_dec = aticq(srepr, astrom) << u.radian\n\n    # Correct for parallax to get ICRS representation\n    if is_unitspherical:\n        icrs_srepr = UnitSphericalRepresentation(bcrs_ra, bcrs_dec, copy=False)\n    else:\n        icrs_srepr = SphericalRepresentation(lon=bcrs_ra, lat=bcrs_dec,\n                                             distance=observed_coo.distance, copy=False)\n        observer_icrs = CartesianRepresentation(astrom['eb'], unit=u.au, xyz_axis=-1, copy=False)\n        newrepr = icrs_srepr.to_cartesian() + observer_icrs\n        icrs_srepr = newrepr.represent_as(SphericalRepresentation)\n\n    return icrs_frame.realize_frame(icrs_srepr)\n\n\n# Create loopback transformations\nframe_transform_graph._add_merged_transform(AltAz, ICRS, AltAz)\nframe_transform_graph._add_merged_transform(HADec, ICRS, HADec)\n# for now we just implement this through ICRS to make sure we get everything\n# covered\n# Before, this was using CIRS as intermediate frame, however this is much\n# slower than the direct observed<->ICRS transform added in 4.3\n# due to how the frame attribute broadcasting works, see\n# https://github.com/astropy/astropy/pull/10994#issuecomment-722617041\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":37,"id":15518,"name":"location","nodeType":"Attribute","startLoc":37,"text":"location"},{"className":"HCRS","col":0,"comment":"\n    A coordinate or frame in a Heliocentric system, with axes aligned to ICRS.\n\n    The ICRS has an origin at the Barycenter and axes which are fixed with\n    respect to space.\n\n    This coordinate system is distinct from ICRS mainly in that it is relative\n    to the Sun's center-of-mass rather than the solar system Barycenter.\n    In principle, therefore, this frame should include the effects of\n    aberration (unlike ICRS), but this is not done, since they are very small,\n    of the order of 8 milli-arcseconds.\n\n    For more background on the ICRS and related coordinate transformations, see\n    the references provided in the :ref:`astropy:astropy-coordinates-seealso`\n    section of the documentation.\n\n    The frame attributes are listed under **Other Parameters**.\n    ","endLoc":43,"id":15519,"nodeType":"Class","startLoc":22,"text":"@format_doc(base_doc, components=doc_components, footer=doc_footer)\nclass HCRS(BaseRADecFrame):\n    \"\"\"\n    A coordinate or frame in a Heliocentric system, with axes aligned to ICRS.\n\n    The ICRS has an origin at the Barycenter and axes which are fixed with\n    respect to space.\n\n    This coordinate system is distinct from ICRS mainly in that it is relative\n    to the Sun's center-of-mass rather than the solar system Barycenter.\n    In principle, therefore, this frame should include the effects of\n    aberration (unlike ICRS), but this is not done, since they are very small,\n    of the order of 8 milli-arcseconds.\n\n    For more background on the ICRS and related coordinate transformations, see\n    the references provided in the :ref:`astropy:astropy-coordinates-seealso`\n    section of the documentation.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)"},{"col":0,"comment":"\n    A slightly modified version of the ERFA function ``eraAtciqz``.\n\n    ``eraAtciqz`` performs the transformations between two coordinate systems,\n    with the details of the transformation being encoded into the ``astrom`` array.\n\n    There are two issues with the version of atciqz in ERFA. Both are associated\n    with the handling of light deflection.\n\n    The companion function ``eraAticq`` is meant to be its inverse. However, this\n    is not true for directions close to the Solar centre, since the light deflection\n    calculations are numerically unstable and therefore not reversible.\n\n    This version sidesteps that problem by artificially reducing the light deflection\n    for directions which are within 90 arcseconds of the Sun's position. This is the\n    same approach used by the ERFA functions above, except that they use a threshold of\n    9 arcseconds.\n\n    In addition, ERFA's atciqz assumes a distant source, so there is no difference between\n    the object-Sun vector and the observer-Sun vector. This can lead to errors of up to a\n    few arcseconds in the worst case (e.g a Venus transit).\n\n    Parameters\n    ----------\n    srepr : `~astropy.coordinates.SphericalRepresentation`\n        Astrometric ICRS position of object from observer\n    astrom : eraASTROM array\n        ERFA astrometry context, as produced by, e.g. ``eraApci13`` or ``eraApcs13``\n\n    Returns\n    -------\n    ri : float or `~numpy.ndarray`\n        Right Ascension in radians\n    di : float or `~numpy.ndarray`\n        Declination in radians\n    ","endLoc":331,"header":"def atciqz(srepr, astrom)","id":15520,"name":"atciqz","nodeType":"Function","startLoc":257,"text":"def atciqz(srepr, astrom):\n    \"\"\"\n    A slightly modified version of the ERFA function ``eraAtciqz``.\n\n    ``eraAtciqz`` performs the transformations between two coordinate systems,\n    with the details of the transformation being encoded into the ``astrom`` array.\n\n    There are two issues with the version of atciqz in ERFA. Both are associated\n    with the handling of light deflection.\n\n    The companion function ``eraAticq`` is meant to be its inverse. However, this\n    is not true for directions close to the Solar centre, since the light deflection\n    calculations are numerically unstable and therefore not reversible.\n\n    This version sidesteps that problem by artificially reducing the light deflection\n    for directions which are within 90 arcseconds of the Sun's position. This is the\n    same approach used by the ERFA functions above, except that they use a threshold of\n    9 arcseconds.\n\n    In addition, ERFA's atciqz assumes a distant source, so there is no difference between\n    the object-Sun vector and the observer-Sun vector. This can lead to errors of up to a\n    few arcseconds in the worst case (e.g a Venus transit).\n\n    Parameters\n    ----------\n    srepr : `~astropy.coordinates.SphericalRepresentation`\n        Astrometric ICRS position of object from observer\n    astrom : eraASTROM array\n        ERFA astrometry context, as produced by, e.g. ``eraApci13`` or ``eraApcs13``\n\n    Returns\n    -------\n    ri : float or `~numpy.ndarray`\n        Right Ascension in radians\n    di : float or `~numpy.ndarray`\n        Declination in radians\n    \"\"\"\n    # ignore parallax effects if no distance, or far away\n    srepr_distance = srepr.distance\n    ignore_distance = srepr_distance.unit == u.one\n\n    # BCRS coordinate direction (unit vector).\n    pco = erfa.s2c(srepr.lon.radian, srepr.lat.radian)\n\n    # Find BCRS direction of Sun to object\n    if ignore_distance:\n        # No distance to object, assume a long way away\n        q = pco\n    else:\n        # Find BCRS direction of Sun to object.\n        # astrom['eh'] and astrom['em'] contain Sun to observer unit vector,\n        # and distance, respectively.\n        eh = astrom['em'][..., np.newaxis] * astrom['eh']\n        # unit vector from Sun to object\n        q = eh + srepr_distance[..., np.newaxis].to_value(u.au) * pco\n        sundist, q = erfa.pn(q)\n        sundist = sundist[..., np.newaxis]\n        # calculation above is extremely unstable very close to the sun\n        # in these situations, default back to ldsun-style behaviour,\n        # since this is reversible and drops to zero within stellar limb\n        q = np.where(sundist > 1.0e-10, q, pco)\n\n    # Light deflection by the Sun, giving BCRS natural direction.\n    pnat = erfa.ld(1.0, pco, q, astrom['eh'], astrom['em'], 1e-6)\n\n    # Aberration, giving GCRS proper direction.\n    ppr = erfa.ab(pnat, astrom['v'], astrom['em'], astrom['bm1'])\n\n    # Bias-precession-nutation, giving CIRS proper direction.\n    # Has no effect if matrix is identity matrix, in which case gives GCRS ppr.\n    pi = erfa.rxp(astrom['bpn'], ppr)\n\n    # CIRS (GCRS) RA, Dec\n    ri, di = erfa.c2s(pi)\n    return erfa.anp(ri), di"},{"attributeType":"null","col":4,"comment":"null","endLoc":43,"id":15521,"name":"obstime","nodeType":"Attribute","startLoc":43,"text":"obstime"},{"attributeType":"null","col":4,"comment":"null","endLoc":25,"id":15522,"name":"target_lat","nodeType":"Attribute","startLoc":25,"text":"target_lat"},{"col":0,"comment":"\n    A slightly modified version of the ERFA function ``eraAticq``.\n\n    ``eraAticq`` performs the transformations between two coordinate systems,\n    with the details of the transformation being encoded into the ``astrom`` array.\n\n    There are two issues with the version of aticq in ERFA. Both are associated\n    with the handling of light deflection.\n\n    The companion function ``eraAtciqz`` is meant to be its inverse. However, this\n    is not true for directions close to the Solar centre, since the light deflection\n    calculations are numerically unstable and therefore not reversible.\n\n    This version sidesteps that problem by artificially reducing the light deflection\n    for directions which are within 90 arcseconds of the Sun's position. This is the\n    same approach used by the ERFA functions above, except that they use a threshold of\n    9 arcseconds.\n\n    In addition, ERFA's aticq assumes a distant source, so there is no difference between\n    the object-Sun vector and the observer-Sun vector. This can lead to errors of up to a\n    few arcseconds in the worst case (e.g a Venus transit).\n\n    Parameters\n    ----------\n    srepr : `~astropy.coordinates.SphericalRepresentation`\n        Astrometric GCRS or CIRS position of object from observer\n    astrom : eraASTROM array\n        ERFA astrometry context, as produced by, e.g. ``eraApci13`` or ``eraApcs13``\n\n    Returns\n    -------\n    rc : float or `~numpy.ndarray`\n        Right Ascension in radians\n    dc : float or `~numpy.ndarray`\n        Declination in radians\n    ","endLoc":254,"header":"def aticq(srepr, astrom)","id":15523,"name":"aticq","nodeType":"Function","startLoc":172,"text":"def aticq(srepr, astrom):\n    \"\"\"\n    A slightly modified version of the ERFA function ``eraAticq``.\n\n    ``eraAticq`` performs the transformations between two coordinate systems,\n    with the details of the transformation being encoded into the ``astrom`` array.\n\n    There are two issues with the version of aticq in ERFA. Both are associated\n    with the handling of light deflection.\n\n    The companion function ``eraAtciqz`` is meant to be its inverse. However, this\n    is not true for directions close to the Solar centre, since the light deflection\n    calculations are numerically unstable and therefore not reversible.\n\n    This version sidesteps that problem by artificially reducing the light deflection\n    for directions which are within 90 arcseconds of the Sun's position. This is the\n    same approach used by the ERFA functions above, except that they use a threshold of\n    9 arcseconds.\n\n    In addition, ERFA's aticq assumes a distant source, so there is no difference between\n    the object-Sun vector and the observer-Sun vector. This can lead to errors of up to a\n    few arcseconds in the worst case (e.g a Venus transit).\n\n    Parameters\n    ----------\n    srepr : `~astropy.coordinates.SphericalRepresentation`\n        Astrometric GCRS or CIRS position of object from observer\n    astrom : eraASTROM array\n        ERFA astrometry context, as produced by, e.g. ``eraApci13`` or ``eraApcs13``\n\n    Returns\n    -------\n    rc : float or `~numpy.ndarray`\n        Right Ascension in radians\n    dc : float or `~numpy.ndarray`\n        Declination in radians\n    \"\"\"\n    # ignore parallax effects if no distance, or far away\n    srepr_distance = srepr.distance\n    ignore_distance = srepr_distance.unit == u.one\n\n    # RA, Dec to cartesian unit vectors\n    pos = erfa.s2c(srepr.lon.radian, srepr.lat.radian)\n\n    # Bias-precession-nutation, giving GCRS proper direction.\n    ppr = erfa.trxp(astrom['bpn'], pos)\n\n    # Aberration, giving GCRS natural direction\n    d = np.zeros_like(ppr)\n    for j in range(2):\n        before = norm(ppr-d)\n        after = erfa.ab(before, astrom['v'], astrom['em'], astrom['bm1'])\n        d = after - before\n    pnat = norm(ppr-d)\n\n    # Light deflection by the Sun, giving BCRS coordinate direction\n    d = np.zeros_like(pnat)\n    for j in range(5):\n        before = norm(pnat-d)\n        if ignore_distance:\n            # No distance to object, assume a long way away\n            q = before\n        else:\n            # Find BCRS direction of Sun to object.\n            # astrom['eh'] and astrom['em'] contain Sun to observer unit vector,\n            # and distance, respectively.\n            eh = astrom['em'][..., np.newaxis] * astrom['eh']\n            # unit vector from Sun to object\n            q = eh + srepr_distance[..., np.newaxis].to_value(u.au) * before\n            sundist, q = erfa.pn(q)\n            sundist = sundist[..., np.newaxis]\n            # calculation above is extremely unstable very close to the sun\n            # in these situations, default back to ldsun-style behaviour,\n            # since this is reversible and drops to zero within stellar limb\n            q = np.where(sundist > 1.0e-10, q, before)\n\n        after = erfa.ld(1.0, before, q, astrom['eh'], astrom['em'], 1e-6)\n        d = after - before\n    pco = norm(pnat-d)\n\n    # ICRS astrometric RA, Dec\n    rc, dc = erfa.c2s(pco)\n    return erfa.anp(rc), dc"},{"attributeType":"null","col":4,"comment":"null","endLoc":2328,"id":15524,"name":"attr_classes","nodeType":"Attribute","startLoc":2328,"text":"attr_classes"},{"className":"SphericalCosLatDifferential","col":0,"comment":"Differential(s) of points in 3D spherical coordinates.\n\n    Parameters\n    ----------\n    d_lon_coslat, d_lat : `~astropy.units.Quantity`\n        The differential longitude (with cos(lat) included) and latitude.\n    d_distance : `~astropy.units.Quantity`\n        The differential distance.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    ","endLoc":3337,"id":15525,"nodeType":"Class","startLoc":3277,"text":"class SphericalCosLatDifferential(BaseSphericalCosLatDifferential):\n    \"\"\"Differential(s) of points in 3D spherical coordinates.\n\n    Parameters\n    ----------\n    d_lon_coslat, d_lat : `~astropy.units.Quantity`\n        The differential longitude (with cos(lat) included) and latitude.\n    d_distance : `~astropy.units.Quantity`\n        The differential distance.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n    base_representation = SphericalRepresentation\n    _unit_differential = UnitSphericalCosLatDifferential\n    attr_classes = {'d_lon_coslat': u.Quantity,\n                    'd_lat': u.Quantity,\n                    'd_distance': u.Quantity}\n\n    def __init__(self, d_lon_coslat, d_lat=None, d_distance=None, copy=True):\n        super().__init__(d_lon_coslat, d_lat, d_distance, copy=copy)\n        if not self._d_lon_coslat.unit.is_equivalent(self._d_lat.unit):\n            raise u.UnitsError('d_lon_coslat and d_lat should have equivalent '\n                               'units.')\n\n    def represent_as(self, other_class, base=None):\n        # All spherical differentials can be done without going to Cartesian,\n        # though some need base for the latitude to remove cos(lat).\n        if issubclass(other_class, UnitSphericalCosLatDifferential):\n            return other_class(self.d_lon_coslat, self.d_lat)\n        elif issubclass(other_class, RadialDifferential):\n            return other_class(self.d_distance)\n        elif issubclass(other_class, SphericalDifferential):\n            return other_class(self._d_lon(base), self.d_lat, self.d_distance)\n        elif issubclass(other_class, UnitSphericalDifferential):\n            return other_class(self._d_lon(base), self.d_lat)\n        elif issubclass(other_class, PhysicsSphericalDifferential):\n            return other_class(self._d_lon(base), -self.d_lat, self.d_distance)\n\n        return super().represent_as(other_class, base)\n\n    @classmethod\n    def from_representation(cls, representation, base=None):\n        # Other spherical differentials can be done without going to Cartesian,\n        # though we need base for the latitude to remove coslat.\n        if isinstance(representation, SphericalDifferential):\n            d_lon_coslat = cls._get_d_lon_coslat(representation.d_lon, base)\n            return cls(d_lon_coslat, representation.d_lat,\n                       representation.d_distance)\n        elif isinstance(representation, PhysicsSphericalDifferential):\n            d_lon_coslat = cls._get_d_lon_coslat(representation.d_phi, base)\n            return cls(d_lon_coslat, -representation.d_theta,\n                       representation.d_r)\n\n        return super().from_representation(representation, base)\n\n    def _scale_operation(self, op, *args, scaled_base=False):\n        if scaled_base:\n            return self.__class__(self.d_lon_coslat, self.d_lat, op(self.d_distance, *args))\n        else:\n            return super()._scale_operation(op, *args)"},{"attributeType":"null","col":8,"comment":"null","endLoc":37,"id":15526,"name":"row","nodeType":"Attribute","startLoc":37,"text":"row"},{"col":4,"comment":"null","endLoc":3316,"header":"def represent_as(self, other_class, base=None)","id":15527,"name":"represent_as","nodeType":"Function","startLoc":3302,"text":"def represent_as(self, other_class, base=None):\n        # All spherical differentials can be done without going to Cartesian,\n        # though some need base for the latitude to remove cos(lat).\n        if issubclass(other_class, UnitSphericalCosLatDifferential):\n            return other_class(self.d_lon_coslat, self.d_lat)\n        elif issubclass(other_class, RadialDifferential):\n            return other_class(self.d_distance)\n        elif issubclass(other_class, SphericalDifferential):\n            return other_class(self._d_lon(base), self.d_lat, self.d_distance)\n        elif issubclass(other_class, UnitSphericalDifferential):\n            return other_class(self._d_lon(base), self.d_lat)\n        elif issubclass(other_class, PhysicsSphericalDifferential):\n            return other_class(self._d_lon(base), -self.d_lat, self.d_distance)\n\n        return super().represent_as(other_class, base)"},{"col":0,"comment":"\n    Normalise a p-vector.\n    ","endLoc":130,"header":"def norm(p)","id":15528,"name":"norm","nodeType":"Function","startLoc":126,"text":"def norm(p):\n    \"\"\"\n    Normalise a p-vector.\n    \"\"\"\n    return p / np.sqrt(np.einsum('...i,...i', p, p))[..., np.newaxis]"},{"className":"AltAz","col":0,"comment":"\n    A coordinate or frame in the Altitude-Azimuth system (Horizontal\n    coordinates) with respect to the WGS84 ellipsoid.  Azimuth is oriented\n    East of North (i.e., N=0, E=90 degrees).  Altitude is also known as\n    elevation angle, so this frame is also in the Azimuth-Elevation system.\n\n    This frame is assumed to *include* refraction effects if the ``pressure``\n    frame attribute is non-zero.\n\n    The frame attributes are listed under **Other Parameters**, which are\n    necessary for transforming from AltAz to some other system.\n    ","endLoc":124,"id":15529,"nodeType":"Class","startLoc":76,"text":"@format_doc(base_doc, components=doc_components, footer=doc_footer)\nclass AltAz(BaseCoordinateFrame):\n    \"\"\"\n    A coordinate or frame in the Altitude-Azimuth system (Horizontal\n    coordinates) with respect to the WGS84 ellipsoid.  Azimuth is oriented\n    East of North (i.e., N=0, E=90 degrees).  Altitude is also known as\n    elevation angle, so this frame is also in the Azimuth-Elevation system.\n\n    This frame is assumed to *include* refraction effects if the ``pressure``\n    frame attribute is non-zero.\n\n    The frame attributes are listed under **Other Parameters**, which are\n    necessary for transforming from AltAz to some other system.\n    \"\"\"\n\n    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'az'),\n            RepresentationMapping('lat', 'alt')\n        ]\n    }\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential\n\n    obstime = TimeAttribute(default=None)\n    location = EarthLocationAttribute(default=None)\n    pressure = QuantityAttribute(default=0, unit=u.hPa)\n    temperature = QuantityAttribute(default=0, unit=u.deg_C)\n    relative_humidity = QuantityAttribute(default=0, unit=u.dimensionless_unscaled)\n    obswl = QuantityAttribute(default=1*u.micron, unit=u.micron)\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n    @property\n    def secz(self):\n        \"\"\"\n        Secant of the zenith angle for this coordinate, a common estimate of\n        the airmass.\n        \"\"\"\n        return 1/np.sin(self.alt)\n\n    @property\n    def zen(self):\n        \"\"\"\n        The zenith angle (or zenith distance / co-altitude) for this coordinate.\n        \"\"\"\n        return _90DEG.to(self.alt.unit) - self.alt"},{"col":4,"comment":"null","endLoc":109,"header":"def __init__(self, *args, **kwargs)","id":15530,"name":"__init__","nodeType":"Function","startLoc":108,"text":"def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)"},{"col":0,"comment":"\n    Returns the offset of the Sun center from the solar-system barycenter (SSB).\n\n    Parameters\n    ----------\n    time : `~astropy.time.Time`\n        Time at which to calculate the offset\n    include_velocity : `bool`\n        If ``True``, attach the velocity as a differential.  Defaults to ``False``.\n    reverse : `bool`\n        If ``True``, return the offset of the barycenter from the Sun.  Defaults to ``False``.\n\n    Returns\n    -------\n    `~astropy.coordinates.CartesianRepresentation`\n        The offset\n    ","endLoc":422,"header":"def get_offset_sun_from_barycenter(time, include_velocity=False, reverse=False)","id":15531,"name":"get_offset_sun_from_barycenter","nodeType":"Function","startLoc":388,"text":"def get_offset_sun_from_barycenter(time, include_velocity=False, reverse=False):\n    \"\"\"\n    Returns the offset of the Sun center from the solar-system barycenter (SSB).\n\n    Parameters\n    ----------\n    time : `~astropy.time.Time`\n        Time at which to calculate the offset\n    include_velocity : `bool`\n        If ``True``, attach the velocity as a differential.  Defaults to ``False``.\n    reverse : `bool`\n        If ``True``, return the offset of the barycenter from the Sun.  Defaults to ``False``.\n\n    Returns\n    -------\n    `~astropy.coordinates.CartesianRepresentation`\n        The offset\n    \"\"\"\n    if include_velocity:\n        # Import here to avoid a circular import\n        from astropy.coordinates.solar_system import get_body_barycentric_posvel\n        offset_pos, offset_vel = get_body_barycentric_posvel('sun', time)\n        if reverse:\n            offset_pos, offset_vel = -offset_pos, -offset_vel\n        offset_vel = offset_vel.represent_as(CartesianDifferential)\n        offset_pos = offset_pos.with_differentials(offset_vel)\n\n    else:\n        # Import here to avoid a circular import\n        from astropy.coordinates.solar_system import get_body_barycentric\n        offset_pos = get_body_barycentric('sun', time)\n        if reverse:\n            offset_pos = -offset_pos\n\n    return offset_pos"},{"col":0,"comment":"null","endLoc":61,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ICRS, CIRS)\ndef icrs_to_cirs(icrs_coo, cirs_frame)","id":15532,"name":"icrs_to_cirs","nodeType":"Function","startLoc":33,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ICRS, CIRS)\ndef icrs_to_cirs(icrs_coo, cirs_frame):\n    # first set up the astrometry context for ICRS<->CIRS\n    astrom = erfa_astrom.get().apco(cirs_frame)\n\n    if icrs_coo.data.get_name() == 'unitspherical' or icrs_coo.data.to_cartesian().x.unit == u.one:\n        # if no distance, just do the infinite-distance/no parallax calculation\n        srepr = icrs_coo.spherical\n        cirs_ra, cirs_dec = atciqz(srepr.without_differentials(), astrom)\n\n        newrep = UnitSphericalRepresentation(lat=u.Quantity(cirs_dec, u.radian, copy=False),\n                                             lon=u.Quantity(cirs_ra, u.radian, copy=False),\n                                             copy=False)\n    else:\n        # When there is a distance,  we first offset for parallax to get the\n        # astrometric coordinate direction and *then* run the ERFA transform for\n        # no parallax/PM. This ensures reversibility and is more sensible for\n        # inside solar system objects\n        astrom_eb = CartesianRepresentation(astrom['eb'], unit=u.au,\n                                            xyz_axis=-1, copy=False)\n        newcart = icrs_coo.cartesian - astrom_eb\n        srepr = newcart.represent_as(SphericalRepresentation)\n        cirs_ra, cirs_dec = atciqz(srepr.without_differentials(), astrom)\n\n        newrep = SphericalRepresentation(lat=u.Quantity(cirs_dec, u.radian, copy=False),\n                                         lon=u.Quantity(cirs_ra, u.radian, copy=False),\n                                         distance=srepr.distance, copy=False)\n\n    return cirs_frame.realize_frame(newrep)"},{"col":4,"comment":"\n        Secant of the zenith angle for this coordinate, a common estimate of\n        the airmass.\n        ","endLoc":117,"header":"@property\n    def secz(self)","id":15533,"name":"secz","nodeType":"Function","startLoc":111,"text":"@property\n    def secz(self):\n        \"\"\"\n        Secant of the zenith angle for this coordinate, a common estimate of\n        the airmass.\n        \"\"\"\n        return 1/np.sin(self.alt)"},{"attributeType":"null","col":38,"comment":"null","endLoc":40,"id":15534,"name":"f","nodeType":"Attribute","startLoc":40,"text":"f"},{"attributeType":"null","col":8,"comment":"null","endLoc":50,"id":15535,"name":"lis_lines","nodeType":"Attribute","startLoc":50,"text":"lis_lines"},{"col":4,"comment":"\n        The zenith angle (or zenith distance / co-altitude) for this coordinate.\n        ","endLoc":124,"header":"@property\n    def zen(self)","id":15536,"name":"zen","nodeType":"Function","startLoc":119,"text":"@property\n    def zen(self):\n        \"\"\"\n        The zenith angle (or zenith distance / co-altitude) for this coordinate.\n        \"\"\"\n        return _90DEG.to(self.alt.unit) - self.alt"},{"attributeType":"null","col":8,"comment":"null","endLoc":51,"id":15537,"name":"started","nodeType":"Attribute","startLoc":51,"text":"started"},{"attributeType":"null","col":12,"comment":"null","endLoc":52,"id":15538,"name":"lis_line","nodeType":"Attribute","startLoc":52,"text":"lis_line"},{"attributeType":"null","col":16,"comment":"null","endLoc":56,"id":15539,"name":"started","nodeType":"Attribute","startLoc":56,"text":"started"},{"attributeType":"null","col":8,"comment":"null","endLoc":66,"id":15540,"name":"lis_line","nodeType":"Attribute","startLoc":66,"text":"lis_line"},{"attributeType":"null","col":4,"comment":"null","endLoc":91,"id":15541,"name":"frame_specific_representation_info","nodeType":"Attribute","startLoc":91,"text":"frame_specific_representation_info"},{"attributeType":"null","col":4,"comment":"null","endLoc":98,"id":15542,"name":"default_representation","nodeType":"Attribute","startLoc":98,"text":"default_representation"},{"attributeType":"null","col":8,"comment":"null","endLoc":71,"id":15543,"name":"lis_line","nodeType":"Attribute","startLoc":71,"text":"lis_line"},{"attributeType":"null","col":4,"comment":"null","endLoc":99,"id":15544,"name":"default_differential","nodeType":"Attribute","startLoc":99,"text":"default_differential"},{"attributeType":"null","col":4,"comment":"null","endLoc":101,"id":15545,"name":"obstime","nodeType":"Attribute","startLoc":101,"text":"obstime"},{"attributeType":"null","col":4,"comment":"null","endLoc":102,"id":15546,"name":"location","nodeType":"Attribute","startLoc":102,"text":"location"},{"attributeType":"null","col":4,"comment":"null","endLoc":103,"id":15547,"name":"pressure","nodeType":"Attribute","startLoc":103,"text":"pressure"},{"attributeType":"null","col":4,"comment":"null","endLoc":104,"id":15548,"name":"temperature","nodeType":"Attribute","startLoc":104,"text":"temperature"},{"attributeType":"null","col":4,"comment":"null","endLoc":105,"id":15549,"name":"relative_humidity","nodeType":"Attribute","startLoc":105,"text":"relative_humidity"},{"attributeType":"null","col":4,"comment":"null","endLoc":106,"id":15550,"name":"obswl","nodeType":"Attribute","startLoc":106,"text":"obswl"},{"col":4,"comment":"null","endLoc":1255,"header":"def __call__(self, fromcoord, toframe)","id":15551,"name":"__call__","nodeType":"Function","startLoc":1252,"text":"def __call__(self, fromcoord, toframe):\n        params = self._affine_params(fromcoord, toframe)\n        newrep = self._apply_transform(fromcoord, *params)\n        return toframe.realize_frame(newrep)"},{"className":"HADec","col":0,"comment":"\n    A coordinate or frame in the Hour Angle-Declination system (Equatorial\n    coordinates) with respect to the WGS84 ellipsoid.  Hour Angle is oriented\n    with respect to upper culmination such that the hour angle is negative to\n    the East and positive to the West.\n\n    This frame is assumed to *include* refraction effects if the ``pressure``\n    frame attribute is non-zero.\n\n    The frame attributes are listed under **Other Parameters**, which are\n    necessary for transforming from HADec to some other system.\n    ","endLoc":124,"id":15552,"nodeType":"Class","startLoc":74,"text":"@format_doc(base_doc, components=doc_components, footer=doc_footer)\nclass HADec(BaseCoordinateFrame):\n    \"\"\"\n    A coordinate or frame in the Hour Angle-Declination system (Equatorial\n    coordinates) with respect to the WGS84 ellipsoid.  Hour Angle is oriented\n    with respect to upper culmination such that the hour angle is negative to\n    the East and positive to the West.\n\n    This frame is assumed to *include* refraction effects if the ``pressure``\n    frame attribute is non-zero.\n\n    The frame attributes are listed under **Other Parameters**, which are\n    necessary for transforming from HADec to some other system.\n    \"\"\"\n\n    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'ha', u.hourangle),\n            RepresentationMapping('lat', 'dec')\n        ]\n    }\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential\n\n    obstime = TimeAttribute(default=None)\n    location = EarthLocationAttribute(default=None)\n    pressure = QuantityAttribute(default=0, unit=u.hPa)\n    temperature = QuantityAttribute(default=0, unit=u.deg_C)\n    relative_humidity = QuantityAttribute(default=0, unit=u.dimensionless_unscaled)\n    obswl = QuantityAttribute(default=1*u.micron, unit=u.micron)\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        if self.has_data:\n            self._set_data_lon_wrap_angle(self.data)\n\n    @staticmethod\n    def _set_data_lon_wrap_angle(data):\n        if hasattr(data, 'lon'):\n            data.lon.wrap_angle = 180. * u.deg\n        return data\n\n    def represent_as(self, base, s='base', in_frame_units=False):\n        \"\"\"\n        Ensure the wrap angle for any spherical\n        representations.\n        \"\"\"\n        data = super().represent_as(base, s, in_frame_units=in_frame_units)\n        self._set_data_lon_wrap_angle(data)\n        return data"},{"col":4,"comment":"null","endLoc":1259,"header":"@abstractmethod\n    def _affine_params(self, fromcoord, toframe)","id":15553,"name":"_affine_params","nodeType":"Function","startLoc":1257,"text":"@abstractmethod\n    def _affine_params(self, fromcoord, toframe):\n        pass"},{"col":4,"comment":"null","endLoc":109,"header":"def __init__(self, *args, **kwargs)","id":15554,"name":"__init__","nodeType":"Function","startLoc":106,"text":"def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        if self.has_data:\n            self._set_data_lon_wrap_angle(self.data)"},{"attributeType":"null","col":8,"comment":"null","endLoc":72,"id":15555,"name":"year","nodeType":"Attribute","startLoc":72,"text":"year"},{"col":4,"comment":"null","endLoc":115,"header":"@staticmethod\n    def _set_data_lon_wrap_angle(data)","id":15556,"name":"_set_data_lon_wrap_angle","nodeType":"Function","startLoc":111,"text":"@staticmethod\n    def _set_data_lon_wrap_angle(data):\n        if hasattr(data, 'lon'):\n            data.lon.wrap_angle = 180. * u.deg\n        return data"},{"col":4,"comment":"\n        Ensure the wrap angle for any spherical\n        representations.\n        ","endLoc":124,"header":"def represent_as(self, base, s='base', in_frame_units=False)","id":15557,"name":"represent_as","nodeType":"Function","startLoc":117,"text":"def represent_as(self, base, s='base', in_frame_units=False):\n        \"\"\"\n        Ensure the wrap angle for any spherical\n        representations.\n        \"\"\"\n        data = super().represent_as(base, s, in_frame_units=in_frame_units)\n        self._set_data_lon_wrap_angle(data)\n        return data"},{"attributeType":"null","col":14,"comment":"null","endLoc":72,"id":15558,"name":"month","nodeType":"Attribute","startLoc":72,"text":"month"},{"attributeType":"null","col":4,"comment":"null","endLoc":89,"id":15559,"name":"frame_specific_representation_info","nodeType":"Attribute","startLoc":89,"text":"frame_specific_representation_info"},{"attributeType":"null","col":4,"comment":"null","endLoc":96,"id":15560,"name":"default_representation","nodeType":"Attribute","startLoc":96,"text":"default_representation"},{"attributeType":"null","col":21,"comment":"null","endLoc":72,"id":15561,"name":"day","nodeType":"Attribute","startLoc":72,"text":"day"},{"className":"StaticMatrixTransform","col":0,"comment":"\n    A coordinate transformation defined as a 3 x 3 cartesian\n    transformation matrix.\n\n    This is distinct from DynamicMatrixTransform in that this kind of matrix is\n    independent of frame attributes.  That is, it depends *only* on the class of\n    the frame.\n\n    Parameters\n    ----------\n    matrix : array-like or callable\n        A 3 x 3 matrix for transforming 3-vectors. In most cases will\n        be unitary (although this is not strictly required). If a callable,\n        will be called *with no arguments* to get the matrix.\n    fromsys : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n\n    Raises\n    ------\n    ValueError\n        If the matrix is not 3 x 3\n\n    ","endLoc":1356,"id":15562,"nodeType":"Class","startLoc":1311,"text":"class StaticMatrixTransform(BaseAffineTransform):\n    \"\"\"\n    A coordinate transformation defined as a 3 x 3 cartesian\n    transformation matrix.\n\n    This is distinct from DynamicMatrixTransform in that this kind of matrix is\n    independent of frame attributes.  That is, it depends *only* on the class of\n    the frame.\n\n    Parameters\n    ----------\n    matrix : array-like or callable\n        A 3 x 3 matrix for transforming 3-vectors. In most cases will\n        be unitary (although this is not strictly required). If a callable,\n        will be called *with no arguments* to get the matrix.\n    fromsys : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n\n    Raises\n    ------\n    ValueError\n        If the matrix is not 3 x 3\n\n    \"\"\"\n\n    def __init__(self, matrix, fromsys, tosys, priority=1, register_graph=None):\n        if callable(matrix):\n            matrix = matrix()\n        self.matrix = np.array(matrix)\n\n        if self.matrix.shape != (3, 3):\n            raise ValueError('Provided matrix is not 3 x 3')\n\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)\n\n    def _affine_params(self, fromcoord, toframe):\n        return self.matrix, None"},{"attributeType":"null","col":4,"comment":"null","endLoc":97,"id":15563,"name":"default_differential","nodeType":"Attribute","startLoc":97,"text":"default_differential"},{"col":4,"comment":"null","endLoc":1356,"header":"def _affine_params(self, fromcoord, toframe)","id":15564,"name":"_affine_params","nodeType":"Function","startLoc":1355,"text":"def _affine_params(self, fromcoord, toframe):\n        return self.matrix, None"},{"attributeType":"null","col":4,"comment":"null","endLoc":99,"id":15565,"name":"obstime","nodeType":"Attribute","startLoc":99,"text":"obstime"},{"attributeType":"null","col":8,"comment":"null","endLoc":1347,"id":15566,"name":"matrix","nodeType":"Attribute","startLoc":1347,"text":"self.matrix"},{"attributeType":"null","col":4,"comment":"null","endLoc":100,"id":15567,"name":"location","nodeType":"Attribute","startLoc":100,"text":"location"},{"attributeType":"null","col":4,"comment":"null","endLoc":101,"id":15568,"name":"pressure","nodeType":"Attribute","startLoc":101,"text":"pressure"},{"attributeType":"null","col":26,"comment":"null","endLoc":72,"id":15569,"name":"time","nodeType":"Attribute","startLoc":72,"text":"time"},{"attributeType":"null","col":4,"comment":"null","endLoc":102,"id":15570,"name":"temperature","nodeType":"Attribute","startLoc":102,"text":"temperature"},{"className":"CompositeTransform","col":0,"comment":"\n    A transformation constructed by combining together a series of single-step\n    transformations.\n\n    Note that the intermediate frame objects are constructed using any frame\n    attributes in ``toframe`` or ``fromframe`` that overlap with the intermediate\n    frame (``toframe`` favored over ``fromframe`` if there's a conflict).  Any frame\n    attributes that are not present use the defaults.\n\n    Parameters\n    ----------\n    transforms : sequence of `CoordinateTransform` object\n        The sequence of transformations to apply.\n    fromsys : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n    collapse_static_mats : bool\n        If `True`, consecutive `StaticMatrixTransform` will be collapsed into a\n        single transformation to speed up the calculation.\n\n    ","endLoc":1563,"id":15571,"nodeType":"Class","startLoc":1404,"text":"class CompositeTransform(CoordinateTransform):\n    \"\"\"\n    A transformation constructed by combining together a series of single-step\n    transformations.\n\n    Note that the intermediate frame objects are constructed using any frame\n    attributes in ``toframe`` or ``fromframe`` that overlap with the intermediate\n    frame (``toframe`` favored over ``fromframe`` if there's a conflict).  Any frame\n    attributes that are not present use the defaults.\n\n    Parameters\n    ----------\n    transforms : sequence of `CoordinateTransform` object\n        The sequence of transformations to apply.\n    fromsys : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : float or int\n        The priority if this transform when finding the shortest\n        coordinate transform path - large numbers are lower priorities.\n    register_graph : `TransformGraph` or None\n        A graph to register this transformation with on creation, or\n        `None` to leave it unregistered.\n    collapse_static_mats : bool\n        If `True`, consecutive `StaticMatrixTransform` will be collapsed into a\n        single transformation to speed up the calculation.\n\n    \"\"\"\n\n    def __init__(self, transforms, fromsys, tosys, priority=1,\n                 register_graph=None, collapse_static_mats=True):\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)\n\n        if collapse_static_mats:\n            transforms = self._combine_statics(transforms)\n\n        self.transforms = tuple(transforms)\n\n    def _combine_statics(self, transforms):\n        \"\"\"\n        Combines together sequences of `StaticMatrixTransform`s into a single\n        transform and returns it.\n        \"\"\"\n        newtrans = []\n        for currtrans in transforms:\n            lasttrans = newtrans[-1] if len(newtrans) > 0 else None\n\n            if (isinstance(lasttrans, StaticMatrixTransform) and\n                    isinstance(currtrans, StaticMatrixTransform)):\n                combinedmat = matrix_product(currtrans.matrix, lasttrans.matrix)\n                newtrans[-1] = StaticMatrixTransform(combinedmat,\n                                                     lasttrans.fromsys,\n                                                     currtrans.tosys)\n            else:\n                newtrans.append(currtrans)\n        return newtrans\n\n    def __call__(self, fromcoord, toframe):\n        curr_coord = fromcoord\n        for t in self.transforms:\n            # build an intermediate frame with attributes taken from either\n            # `toframe`, or if not there, `fromcoord`, or if not there, use\n            # the defaults\n            # TODO: caching this information when creating the transform may\n            # speed things up a lot\n            frattrs = {}\n            for inter_frame_attr_nm in t.tosys.get_frame_attr_names():\n                if hasattr(toframe, inter_frame_attr_nm):\n                    attr = getattr(toframe, inter_frame_attr_nm)\n                    frattrs[inter_frame_attr_nm] = attr\n                elif hasattr(fromcoord, inter_frame_attr_nm):\n                    attr = getattr(fromcoord, inter_frame_attr_nm)\n                    frattrs[inter_frame_attr_nm] = attr\n\n            curr_toframe = t.tosys(**frattrs)\n            curr_coord = t(curr_coord, curr_toframe)\n\n        # this is safe even in the case where self.transforms is empty, because\n        # coordinate objects are immutable, so copying is not needed\n        return curr_coord\n\n    def _as_single_transform(self):\n        \"\"\"\n        Return an encapsulated version of the composite transform so that it appears to\n        be a single transform.\n\n        The returned transform internally calls the constituent transforms.  If all of\n        the transforms are affine, the merged transform is\n        `~astropy.coordinates.transformations.DynamicMatrixTransform` (if there are no\n        origin shifts) or `~astropy.coordinates.transformations.AffineTransform`\n        (otherwise).  If at least one of the transforms is not affine, the merged\n        transform is\n        `~astropy.coordinates.transformations.FunctionTransformWithFiniteDifference`.\n        \"\"\"\n        # Create a list of the transforms including flattening any constituent CompositeTransform\n        transforms = [t if not isinstance(t, CompositeTransform) else t._as_single_transform()\n                      for t in self.transforms]\n\n        if all([isinstance(t, BaseAffineTransform) for t in transforms]):\n            # Check if there may be an origin shift\n            fixed_origin = all([isinstance(t, (StaticMatrixTransform, DynamicMatrixTransform))\n                                for t in transforms])\n\n            # Dynamically define the transformation function\n            def single_transform(from_coo, to_frame):\n                if from_coo.is_equivalent_frame(to_frame):  # loopback to the same frame\n                    return None if fixed_origin else (None, None)\n\n                # Create a merged attribute dictionary for any intermediate frames\n                # For any attributes shared by the \"from\"/\"to\" frames, the \"to\" frame takes\n                #   precedence because this is the same choice implemented in __call__()\n                merged_attr = {name: getattr(from_coo, name)\n                               for name in from_coo.frame_attributes}\n                merged_attr.update({name: getattr(to_frame, name)\n                                    for name in to_frame.frame_attributes})\n\n                affine_params = (None, None)\n                # Step through each transform step (frame A -> frame B)\n                for i, t in enumerate(transforms):\n                    # Extract the relevant attributes for frame A\n                    if i == 0:\n                        # If frame A is actually the initial frame, preserve its attributes\n                        a_attr = {name: getattr(from_coo, name)\n                                  for name in from_coo.frame_attributes}\n                    else:\n                        a_attr = {k: v for k, v in merged_attr.items()\n                                  if k in t.fromsys.frame_attributes}\n\n                    # Extract the relevant attributes for frame B\n                    b_attr = {k: v for k, v in merged_attr.items()\n                              if k in t.tosys.frame_attributes}\n\n                    # Obtain the affine parameters for the transform\n                    # Note that we insert some dummy data into frame A because the transformation\n                    #   machinery requires there to be data present.  Removing that limitation\n                    #   is a possible TODO, but some care would need to be taken because some affine\n                    #   transforms have branching code depending on the presence of differentials.\n                    next_affine_params = t._affine_params(t.fromsys(from_coo.data, **a_attr),\n                                                          t.tosys(**b_attr))\n\n                    # Combine the affine parameters with the running set\n                    affine_params = _combine_affine_params(affine_params, next_affine_params)\n\n                # If there is no origin shift, return only the matrix\n                return affine_params[0] if fixed_origin else affine_params\n\n            # The return type depends on whether there is any origin shift\n            transform_type = DynamicMatrixTransform if fixed_origin else AffineTransform\n        else:\n            # Dynamically define the transformation function\n            def single_transform(from_coo, to_frame):\n                if from_coo.is_equivalent_frame(to_frame):  # loopback to the same frame\n                    return to_frame.realize_frame(from_coo.data)\n                return self(from_coo, to_frame)\n\n            transform_type = FunctionTransformWithFiniteDifference\n\n        return transform_type(single_transform, self.fromsys, self.tosys, priority=self.priority)"},{"attributeType":"null","col":4,"comment":"null","endLoc":103,"id":15572,"name":"relative_humidity","nodeType":"Attribute","startLoc":103,"text":"relative_humidity"},{"attributeType":"null","col":8,"comment":"null","endLoc":1442,"id":15573,"name":"transforms","nodeType":"Attribute","startLoc":1442,"text":"self.transforms"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":15574,"name":"__all__","nodeType":"Attribute","startLoc":35,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":1607,"id":15575,"name":"trans_to_color","nodeType":"Attribute","startLoc":1607,"text":"trans_to_color"},{"col":0,"comment":"","endLoc":15,"header":"transformations.py#<anonymous>","id":15576,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module contains a general framework for defining graphs of transformations\nbetween coordinates, suitable for either spatial coordinates or more generalized\ncoordinate systems.\n\nThe fundamental idea is that each class is a node in the transformation graph,\nand transitions from one node to another are defined as functions (or methods)\nwrapped in transformation objects.\n\nThis module also includes more specific transformation classes for\ncelestial/spatial coordinate frames, generally focused around matrix-style\ntransformations that are typically how the algorithms are defined.\n\"\"\"\n\n__all__ = ['TransformGraph', 'CoordinateTransform', 'FunctionTransform',\n           'BaseAffineTransform', 'AffineTransform',\n           'StaticMatrixTransform', 'DynamicMatrixTransform',\n           'FunctionTransformWithFiniteDifference', 'CompositeTransform']\n\ntrans_to_color = {}\n\ntrans_to_color[AffineTransform] = '#555555'  # gray\n\ntrans_to_color[FunctionTransform] = '#783001'  # dark red-ish/brown\n\ntrans_to_color[FunctionTransformWithFiniteDifference] = '#d95f02'  # red-ish\n\ntrans_to_color[StaticMatrixTransform] = '#7570b3'  # blue-ish\n\ntrans_to_color[DynamicMatrixTransform] = '#1b9e77'  # green-ish"},{"attributeType":"null","col":4,"comment":"null","endLoc":104,"id":15577,"name":"obswl","nodeType":"Attribute","startLoc":104,"text":"obswl"},{"attributeType":"null","col":0,"comment":"null","endLoc":36,"id":15578,"name":"PIOVER2","nodeType":"Attribute","startLoc":36,"text":"PIOVER2"},{"col":0,"comment":"null","endLoc":54,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ICRS, AltAz)\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ICRS, HADec)\ndef icrs_to_observed(icrs_coo, observed_frame)","id":15579,"name":"icrs_to_observed","nodeType":"Function","startLoc":23,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ICRS, AltAz)\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ICRS, HADec)\ndef icrs_to_observed(icrs_coo, observed_frame):\n    # if the data are UnitSphericalRepresentation, we can skip the distance calculations\n    is_unitspherical = (isinstance(icrs_coo.data, UnitSphericalRepresentation) or\n                        icrs_coo.cartesian.x.unit == u.one)\n    # first set up the astrometry context for ICRS<->observed\n    astrom = erfa_astrom.get().apco(observed_frame)\n\n    # correct for parallax to find BCRS direction from observer (as in erfa.pmpx)\n    if is_unitspherical:\n        srepr = icrs_coo.spherical\n    else:\n        observer_icrs = CartesianRepresentation(astrom['eb'], unit=u.au, xyz_axis=-1, copy=False)\n        srepr = (icrs_coo.cartesian - observer_icrs).represent_as(\n            SphericalRepresentation)\n\n    # convert to topocentric CIRS\n    cirs_ra, cirs_dec = atciqz(srepr, astrom)\n\n    # now perform observed conversion\n    if isinstance(observed_frame, AltAz):\n        lon, zen, _, _, _ = erfa.atioq(cirs_ra, cirs_dec, astrom)\n        lat = PIOVER2 - zen\n    else:\n        _, _, lon, lat, _ = erfa.atioq(cirs_ra, cirs_dec, astrom)\n\n    if is_unitspherical:\n        obs_srepr = UnitSphericalRepresentation(lon << u.radian, lat << u.radian, copy=False)\n    else:\n        obs_srepr = SphericalRepresentation(lon << u.radian, lat << u.radian, srepr.distance, copy=False)\n    return observed_frame.realize_frame(obs_srepr)"},{"attributeType":"null","col":32,"comment":"null","endLoc":72,"id":15580,"name":"zd","nodeType":"Attribute","startLoc":72,"text":"zd"},{"fileName":"fk4.py","filePath":"astropy/coordinates/builtin_frames","id":15581,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport numpy as np\n\nfrom astropy import units as u\nfrom astropy.utils.decorators import format_doc\nfrom astropy.coordinates.baseframe import frame_transform_graph, base_doc\nfrom astropy.coordinates.attributes import TimeAttribute\nfrom astropy.coordinates.transformations import (\n    FunctionTransformWithFiniteDifference, DynamicMatrixTransform)\nfrom astropy.coordinates.representation import (CartesianRepresentation,\n                                                UnitSphericalRepresentation)\nfrom astropy.coordinates import earth_orientation as earth\n\nfrom .utils import EQUINOX_B1950\nfrom .baseradec import doc_components, BaseRADecFrame\n\n__all__ = ['FK4', 'FK4NoETerms']\n\n\ndoc_footer_fk4 = \"\"\"\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\n        The equinox of this frame.\n    obstime : `~astropy.time.Time`\n        The time this frame was observed.  If ``None``, will be the same as\n        ``equinox``.\n\"\"\"\n\n\n@format_doc(base_doc, components=doc_components, footer=doc_footer_fk4)\nclass FK4(BaseRADecFrame):\n    \"\"\"\n    A coordinate or frame in the FK4 system.\n\n    Note that this is a barycentric version of FK4 - that is, the origin for\n    this frame is the Solar System Barycenter, *not* the Earth geocenter.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_B1950)\n    obstime = TimeAttribute(default=None, secondary_attribute='equinox')\n\n\n# the \"self\" transform\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, FK4, FK4)\ndef fk4_to_fk4(fk4coord1, fk4frame2):\n    # deceptively complicated: need to transform to No E-terms FK4, precess, and\n    # then come back, because precession is non-trivial with E-terms\n    fnoe_w_eqx1 = fk4coord1.transform_to(FK4NoETerms(equinox=fk4coord1.equinox))\n    fnoe_w_eqx2 = fnoe_w_eqx1.transform_to(FK4NoETerms(equinox=fk4frame2.equinox))\n    return fnoe_w_eqx2.transform_to(fk4frame2)\n\n\n@format_doc(base_doc, components=doc_components, footer=doc_footer_fk4)\nclass FK4NoETerms(BaseRADecFrame):\n    \"\"\"\n    A coordinate or frame in the FK4 system, but with the E-terms of aberration\n    removed.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_B1950)\n    obstime = TimeAttribute(default=None, secondary_attribute='equinox')\n\n    @staticmethod\n    def _precession_matrix(oldequinox, newequinox):\n        \"\"\"\n        Compute and return the precession matrix for FK4 using Newcomb's method.\n        Used inside some of the transformation functions.\n\n        Parameters\n        ----------\n        oldequinox : `~astropy.time.Time`\n            The equinox to precess from.\n        newequinox : `~astropy.time.Time`\n            The equinox to precess to.\n\n        Returns\n        -------\n        newcoord : array\n            The precession matrix to transform to the new equinox\n        \"\"\"\n        return earth._precession_matrix_besselian(oldequinox.byear, newequinox.byear)\n\n\n# the \"self\" transform\n\n\n@frame_transform_graph.transform(DynamicMatrixTransform, FK4NoETerms, FK4NoETerms)\ndef fk4noe_to_fk4noe(fk4necoord1, fk4neframe2):\n    return fk4necoord1._precession_matrix(fk4necoord1.equinox, fk4neframe2.equinox)\n\n\n# FK4-NO-E to/from FK4 ----------------------------->\n# Unlike other frames, this module include *two* frame classes for FK4\n# coordinates - one including the E-terms of aberration (FK4), and\n# one not including them (FK4NoETerms). The following functions\n# implement the transformation between these two.\ndef fk4_e_terms(equinox):\n    \"\"\"\n    Return the e-terms of aberration vector\n\n    Parameters\n    ----------\n    equinox : Time object\n        The equinox for which to compute the e-terms\n    \"\"\"\n    # Constant of aberration at J2000; from Explanatory Supplement to the\n    # Astronomical Almanac (Seidelmann, 2005).\n    k = 0.0056932  # in degrees (v_earth/c ~ 1e-4 rad ~ 0.0057 deg)\n    k = np.radians(k)\n\n    # Eccentricity of the Earth's orbit\n    e = earth.eccentricity(equinox.jd)\n\n    # Mean longitude of perigee of the solar orbit\n    g = earth.mean_lon_of_perigee(equinox.jd)\n    g = np.radians(g)\n\n    # Obliquity of the ecliptic\n    o = earth.obliquity(equinox.jd, algorithm=1980)\n    o = np.radians(o)\n\n    return (e * k * np.sin(g),\n            -e * k * np.cos(g) * np.cos(o),\n            -e * k * np.cos(g) * np.sin(o))\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, FK4, FK4NoETerms)\ndef fk4_to_fk4_no_e(fk4coord, fk4noeframe):\n    # Extract cartesian vector\n    rep = fk4coord.cartesian\n\n    # Find distance (for re-normalization)\n    d_orig = rep.norm()\n    rep /= d_orig\n\n    # Apply E-terms of aberration. Note that this depends on the equinox (not\n    # the observing time/epoch) of the coordinates. See issue #1496 for a\n    # discussion of this.\n    eterms_a = CartesianRepresentation(\n        u.Quantity(fk4_e_terms(fk4coord.equinox), u.dimensionless_unscaled,\n                   copy=False), copy=False)\n    rep = rep - eterms_a + eterms_a.dot(rep) * rep\n\n    # Find new distance (for re-normalization)\n    d_new = rep.norm()\n\n    # Renormalize\n    rep *= d_orig / d_new\n\n    # now re-cast into an appropriate Representation, and precess if need be\n    if isinstance(fk4coord.data, UnitSphericalRepresentation):\n        rep = rep.represent_as(UnitSphericalRepresentation)\n\n    # if no obstime was given in the new frame, use the old one for consistency\n    newobstime = fk4coord._obstime if fk4noeframe._obstime is None else fk4noeframe._obstime\n\n    fk4noe = FK4NoETerms(rep, equinox=fk4coord.equinox, obstime=newobstime)\n    if fk4coord.equinox != fk4noeframe.equinox:\n        # precession\n        fk4noe = fk4noe.transform_to(fk4noeframe)\n    return fk4noe\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, FK4NoETerms, FK4)\ndef fk4_no_e_to_fk4(fk4noecoord, fk4frame):\n    # first precess, if necessary\n    if fk4noecoord.equinox != fk4frame.equinox:\n        fk4noe_w_fk4equinox = FK4NoETerms(equinox=fk4frame.equinox,\n                                          obstime=fk4noecoord.obstime)\n        fk4noecoord = fk4noecoord.transform_to(fk4noe_w_fk4equinox)\n\n    # Extract cartesian vector\n    rep = fk4noecoord.cartesian\n\n    # Find distance (for re-normalization)\n    d_orig = rep.norm()\n    rep /= d_orig\n\n    # Apply E-terms of aberration. Note that this depends on the equinox (not\n    # the observing time/epoch) of the coordinates. See issue #1496 for a\n    # discussion of this.\n    eterms_a = CartesianRepresentation(\n        u.Quantity(fk4_e_terms(fk4noecoord.equinox), u.dimensionless_unscaled,\n                   copy=False), copy=False)\n\n    rep0 = rep.copy()\n    for _ in range(10):\n        rep = (eterms_a + rep0) / (1. + eterms_a.dot(rep))\n\n    # Find new distance (for re-normalization)\n    d_new = rep.norm()\n\n    # Renormalize\n    rep *= d_orig / d_new\n\n    # now re-cast into an appropriate Representation, and precess if need be\n    if isinstance(fk4noecoord.data, UnitSphericalRepresentation):\n        rep = rep.represent_as(UnitSphericalRepresentation)\n\n    return fk4frame.realize_frame(rep)\n"},{"attributeType":"null","col":70,"comment":"null","endLoc":72,"id":15582,"name":"_","nodeType":"Attribute","startLoc":72,"text":"_"},{"col":0,"comment":"","endLoc":78,"header":"generate_spectralcoord_ref.py#<anonymous>","id":15583,"name":"<anonymous>","nodeType":"Function","startLoc":7,"text":"if __name__ == \"__main__\":\n\n    from random import choice\n    from subprocess import check_output\n\n    import numpy as np\n\n    from astropy.table import QTable\n    from astropy.coordinates import SkyCoord, Angle\n    from astropy.time import Time\n    from astropy import units as u\n\n    np.random.seed(12345)\n\n    N = 100\n\n    tab = QTable()\n    target_lon = np.random.uniform(0, 360, N) * u.deg\n    target_lat = np.degrees(np.arcsin(np.random.uniform(-1, 1, N))) * u.deg\n    tab['target'] = SkyCoord(target_lon, target_lat, frame='fk5')\n    tab['obstime'] = Time(np.random.uniform(Time('1997-01-01').mjd, Time('2017-12-31').mjd, N), format='mjd', scale='utc')\n    tab['obslon'] = Angle(np.random.uniform(-180, 180, N) * u.deg)\n    tab['obslat'] = Angle(np.arcsin(np.random.uniform(-1, 1, N)) * u.deg)\n    tab['geocent'] = 0.\n    tab['heliocent'] = 0.\n    tab['lsrk'] = 0.\n    tab['lsrd'] = 0.\n    tab['galactoc'] = 0.\n    tab['localgrp'] = 0.\n\n    for row in tab:\n\n        # Produce input file for rv command\n        with open('rv.input', 'w') as f:\n            f.write(row['obslon'].to_string('deg', sep=' ') + ' ' + row['obslat'].to_string('deg', sep=' ') + '\\n')\n            f.write(f\"{row['obstime'].datetime.year} {row['obstime'].datetime.month} {row['obstime'].datetime.day} 1\\n\")\n            f.write(row['target'].to_string('hmsdms', sep=' ') + ' J2000\\n')\n            f.write('END\\n')\n\n        # Run Starlink rv command\n        check_output(['rv', 'rv.input'])\n\n        # Parse values from output file\n        lis_lines = []\n        started = False\n        for lis_line in open('rv.lis'):\n            if started and lis_line.strip() != '':\n                lis_lines.append(lis_line.strip())\n            elif 'LOCAL GROUP' in lis_line:\n                started = True\n\n        # Some sources are not observable at the specified time and therefore don't\n        # have entries in the rv output file\n        if len(lis_lines) == 0:\n            continue\n\n        # If there are lines, we pick one at random. Note that we can't get rv to\n        # run at the exact time we specified in the input, so we will re-parse the\n        # actual date/time used and replace it in the table\n        lis_line = choice(lis_lines)\n\n        # The column for 'SUN' has an entry also for the light travel time, which\n        # we want to ignore. It sometimes includes '(' followed by a space which\n        # can cause issues with splitting, hence why we get rid of the space.\n        lis_line = lis_line.replace('(  ', '(').replace('( ', '(')\n        year, month, day, time, zd, row['geocent'], row['heliocent'], _, \\\n            row['lsrk'], row['lsrd'], row['galactoc'], row['localgrp'] = lis_line.split()\n        row['obstime'] = Time(f'{year}-{month}-{day}T{time}:00', format='isot', scale='utc')\n\n    # We sampled 100 coordinates above since some may not have results - we now\n    # truncate to 50 sources since this is sufficient.\n    tab[:50].write('reference_rv.ecsv', format='ascii.ecsv')"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":15584,"name":"EQUINOX_B1950","nodeType":"Attribute","startLoc":26,"text":"EQUINOX_B1950"},{"className":"FK4","col":0,"comment":"\n    A coordinate or frame in the FK4 system.\n\n    Note that this is a barycentric version of FK4 - that is, the origin for\n    this frame is the Solar System Barycenter, *not* the Earth geocenter.\n\n    The frame attributes are listed under **Other Parameters**.\n    ","endLoc":45,"id":15585,"nodeType":"Class","startLoc":33,"text":"@format_doc(base_doc, components=doc_components, footer=doc_footer_fk4)\nclass FK4(BaseRADecFrame):\n    \"\"\"\n    A coordinate or frame in the FK4 system.\n\n    Note that this is a barycentric version of FK4 - that is, the origin for\n    this frame is the Solar System Barycenter, *not* the Earth geocenter.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_B1950)\n    obstime = TimeAttribute(default=None, secondary_attribute='equinox')"},{"col":4,"comment":"null","endLoc":3413,"header":"def __init__(self, d_phi, d_theta=None, d_r=None, copy=True)","id":15586,"name":"__init__","nodeType":"Function","startLoc":3409,"text":"def __init__(self, d_phi, d_theta=None, d_r=None, copy=True):\n        super().__init__(d_phi, d_theta, d_r, copy=copy)\n        if not self._d_phi.unit.is_equivalent(self._d_theta.unit):\n            raise u.UnitsError('d_phi and d_theta should have equivalent '\n                               'units.')"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":44,"id":15587,"name":"equinox","nodeType":"Attribute","startLoc":44,"text":"equinox"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":45,"id":15588,"name":"obstime","nodeType":"Attribute","startLoc":45,"text":"obstime"},{"col":4,"comment":"null","endLoc":3331,"header":"@classmethod\n    def from_representation(cls, representation, base=None)","id":15589,"name":"from_representation","nodeType":"Function","startLoc":3318,"text":"@classmethod\n    def from_representation(cls, representation, base=None):\n        # Other spherical differentials can be done without going to Cartesian,\n        # though we need base for the latitude to remove coslat.\n        if isinstance(representation, SphericalDifferential):\n            d_lon_coslat = cls._get_d_lon_coslat(representation.d_lon, base)\n            return cls(d_lon_coslat, representation.d_lat,\n                       representation.d_distance)\n        elif isinstance(representation, PhysicsSphericalDifferential):\n            d_lon_coslat = cls._get_d_lon_coslat(representation.d_phi, base)\n            return cls(d_lon_coslat, -representation.d_theta,\n                       representation.d_r)\n\n        return super().from_representation(representation, base)"},{"className":"FK4NoETerms","col":0,"comment":"\n    A coordinate or frame in the FK4 system, but with the E-terms of aberration\n    removed.\n\n    The frame attributes are listed under **Other Parameters**.\n    ","endLoc":90,"id":15590,"nodeType":"Class","startLoc":60,"text":"@format_doc(base_doc, components=doc_components, footer=doc_footer_fk4)\nclass FK4NoETerms(BaseRADecFrame):\n    \"\"\"\n    A coordinate or frame in the FK4 system, but with the E-terms of aberration\n    removed.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_B1950)\n    obstime = TimeAttribute(default=None, secondary_attribute='equinox')\n\n    @staticmethod\n    def _precession_matrix(oldequinox, newequinox):\n        \"\"\"\n        Compute and return the precession matrix for FK4 using Newcomb's method.\n        Used inside some of the transformation functions.\n\n        Parameters\n        ----------\n        oldequinox : `~astropy.time.Time`\n            The equinox to precess from.\n        newequinox : `~astropy.time.Time`\n            The equinox to precess to.\n\n        Returns\n        -------\n        newcoord : array\n            The precession matrix to transform to the new equinox\n        \"\"\"\n        return earth._precession_matrix_besselian(oldequinox.byear, newequinox.byear)"},{"col":4,"comment":"\n        Compute and return the precession matrix for FK4 using Newcomb's method.\n        Used inside some of the transformation functions.\n\n        Parameters\n        ----------\n        oldequinox : `~astropy.time.Time`\n            The equinox to precess from.\n        newequinox : `~astropy.time.Time`\n            The equinox to precess to.\n\n        Returns\n        -------\n        newcoord : array\n            The precession matrix to transform to the new equinox\n        ","endLoc":90,"header":"@staticmethod\n    def _precession_matrix(oldequinox, newequinox)","id":15591,"name":"_precession_matrix","nodeType":"Function","startLoc":72,"text":"@staticmethod\n    def _precession_matrix(oldequinox, newequinox):\n        \"\"\"\n        Compute and return the precession matrix for FK4 using Newcomb's method.\n        Used inside some of the transformation functions.\n\n        Parameters\n        ----------\n        oldequinox : `~astropy.time.Time`\n            The equinox to precess from.\n        newequinox : `~astropy.time.Time`\n            The equinox to precess to.\n\n        Returns\n        -------\n        newcoord : array\n            The precession matrix to transform to the new equinox\n        \"\"\"\n        return earth._precession_matrix_besselian(oldequinox.byear, newequinox.byear)"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":69,"id":15592,"name":"equinox","nodeType":"Attribute","startLoc":69,"text":"equinox"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":70,"id":15593,"name":"obstime","nodeType":"Attribute","startLoc":70,"text":"obstime"},{"col":0,"comment":"null","endLoc":57,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, FK4, FK4)\ndef fk4_to_fk4(fk4coord1, fk4frame2)","id":15594,"name":"fk4_to_fk4","nodeType":"Function","startLoc":51,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, FK4, FK4)\ndef fk4_to_fk4(fk4coord1, fk4frame2):\n    # deceptively complicated: need to transform to No E-terms FK4, precess, and\n    # then come back, because precession is non-trivial with E-terms\n    fnoe_w_eqx1 = fk4coord1.transform_to(FK4NoETerms(equinox=fk4coord1.equinox))\n    fnoe_w_eqx2 = fnoe_w_eqx1.transform_to(FK4NoETerms(equinox=fk4frame2.equinox))\n    return fnoe_w_eqx2.transform_to(fk4frame2)"},{"col":4,"comment":"null","endLoc":3337,"header":"def _scale_operation(self, op, *args, scaled_base=False)","id":15595,"name":"_scale_operation","nodeType":"Function","startLoc":3333,"text":"def _scale_operation(self, op, *args, scaled_base=False):\n        if scaled_base:\n            return self.__class__(self.d_lon_coslat, self.d_lat, op(self.d_distance, *args))\n        else:\n            return super()._scale_operation(op, *args)"},{"col":0,"comment":"\n    Accuracy tests for the FK4 (with no E-terms of aberration) to/from FK5\n    conversion, with arbitrary equinoxes and epoch of observation.\n    ","endLoc":129,"header":"def ref_fk4_no_e_fk5(fnout='fk4_no_e_fk5.csv')","id":15596,"name":"ref_fk4_no_e_fk5","nodeType":"Function","startLoc":71,"text":"def ref_fk4_no_e_fk5(fnout='fk4_no_e_fk5.csv'):\n    \"\"\"\n    Accuracy tests for the FK4 (with no E-terms of aberration) to/from FK5\n    conversion, with arbitrary equinoxes and epoch of observation.\n    \"\"\"\n\n    import starlink.Ast as Ast\n\n    np.random.seed(12345)\n\n    N = 200\n\n    # Sample uniformly on the unit sphere. These will be either the FK4\n    # coordinates for the transformation to FK5, or the FK5 coordinates for the\n    # transformation to FK4.\n    ra = np.random.uniform(0., 360., N)\n    dec = np.degrees(np.arcsin(np.random.uniform(-1., 1., N)))\n\n    # Generate random observation epoch and equinoxes\n    obstime = [f\"B{x:7.2f}\" for x in np.random.uniform(1950., 2000., N)]\n    equinox_fk4 = [f\"B{x:7.2f}\" for x in np.random.uniform(1925., 1975., N)]\n    equinox_fk5 = [f\"J{x:7.2f}\" for x in np.random.uniform(1975., 2025., N)]\n\n    ra_fk4, dec_fk4 = [], []\n    ra_fk5, dec_fk5 = [], []\n\n    for i in range(N):\n\n        # Set up frames for AST\n        frame_fk4 = Ast.SkyFrame(f'System=FK4-NO-E,Epoch={obstime[i]},Equinox={equinox_fk4[i]}')\n        frame_fk5 = Ast.SkyFrame(f'System=FK5,Epoch={obstime[i]},Equinox={equinox_fk5[i]}')\n\n        # FK4 to FK5\n        frameset = frame_fk4.convert(frame_fk5)\n        coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]]))\n        ra_fk5.append(coords[0, 0])\n        dec_fk5.append(coords[1, 0])\n\n        # FK5 to FK4\n        frameset = frame_fk5.convert(frame_fk4)\n        coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]]))\n        ra_fk4.append(coords[0, 0])\n        dec_fk4.append(coords[1, 0])\n\n    # Write out table to a CSV file\n    t = Table()\n    t.add_column(Column(name='equinox_fk4', data=equinox_fk4))\n    t.add_column(Column(name='equinox_fk5', data=equinox_fk5))\n    t.add_column(Column(name='obstime', data=obstime))\n    t.add_column(Column(name='ra_in', data=ra))\n    t.add_column(Column(name='dec_in', data=dec))\n    t.add_column(Column(name='ra_fk5', data=ra_fk5))\n    t.add_column(Column(name='dec_fk5', data=dec_fk5))\n    t.add_column(Column(name='ra_fk4', data=ra_fk4))\n    t.add_column(Column(name='dec_fk4', data=dec_fk4))\n    f = open(os.path.join('data', fnout), 'wb')\n    f.write(\"# This file was generated with the {} script, and the reference \"\n            \"values were computed using AST\\n\".format(os.path.basename(__file__)))\n    t.write(f, format='ascii', delimiter=',')"},{"attributeType":"SphericalRepresentation","col":4,"comment":"null","endLoc":3290,"id":15597,"name":"base_representation","nodeType":"Attribute","startLoc":3290,"text":"base_representation"},{"attributeType":"UnitSphericalCosLatDifferential","col":4,"comment":"null","endLoc":3291,"id":15598,"name":"_unit_differential","nodeType":"Attribute","startLoc":3291,"text":"_unit_differential"},{"attributeType":"null","col":4,"comment":"null","endLoc":3292,"id":15599,"name":"attr_classes","nodeType":"Attribute","startLoc":3292,"text":"attr_classes"},{"col":0,"comment":"null","endLoc":98,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, FK4NoETerms, FK4NoETerms)\ndef fk4noe_to_fk4noe(fk4necoord1, fk4neframe2)","id":15600,"name":"fk4noe_to_fk4noe","nodeType":"Function","startLoc":96,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, FK4NoETerms, FK4NoETerms)\ndef fk4noe_to_fk4noe(fk4necoord1, fk4neframe2):\n    return fk4necoord1._precession_matrix(fk4necoord1.equinox, fk4neframe2.equinox)"},{"className":"PhysicsSphericalDifferential","col":0,"comment":"Differential(s) of 3D spherical coordinates using physics convention.\n\n    Parameters\n    ----------\n    d_phi, d_theta : `~astropy.units.Quantity`\n        The differential azimuth and inclination.\n    d_r : `~astropy.units.Quantity`\n        The differential radial distance.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    ","endLoc":3455,"id":15601,"nodeType":"Class","startLoc":3394,"text":"class PhysicsSphericalDifferential(BaseDifferential):\n    \"\"\"Differential(s) of 3D spherical coordinates using physics convention.\n\n    Parameters\n    ----------\n    d_phi, d_theta : `~astropy.units.Quantity`\n        The differential azimuth and inclination.\n    d_r : `~astropy.units.Quantity`\n        The differential radial distance.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n    base_representation = PhysicsSphericalRepresentation\n\n    def __init__(self, d_phi, d_theta=None, d_r=None, copy=True):\n        super().__init__(d_phi, d_theta, d_r, copy=copy)\n        if not self._d_phi.unit.is_equivalent(self._d_theta.unit):\n            raise u.UnitsError('d_phi and d_theta should have equivalent '\n                               'units.')\n\n    def represent_as(self, other_class, base=None):\n        # All spherical differentials can be done without going to Cartesian,\n        # though CosLat needs base for the latitude. For those, explicitly\n        # do the equivalent of self._d_lon_coslat in SphericalDifferential.\n        if issubclass(other_class, SphericalDifferential):\n            return other_class(self.d_phi, -self.d_theta, self.d_r)\n        elif issubclass(other_class, UnitSphericalDifferential):\n            return other_class(self.d_phi, -self.d_theta)\n        elif issubclass(other_class, SphericalCosLatDifferential):\n            self._check_base(base)\n            d_lon_coslat = self.d_phi * np.sin(base.theta)\n            return other_class(d_lon_coslat, -self.d_theta, self.d_r)\n        elif issubclass(other_class, UnitSphericalCosLatDifferential):\n            self._check_base(base)\n            d_lon_coslat = self.d_phi * np.sin(base.theta)\n            return other_class(d_lon_coslat, -self.d_theta)\n        elif issubclass(other_class, RadialDifferential):\n            return other_class(self.d_r)\n\n        return super().represent_as(other_class, base)\n\n    @classmethod\n    def from_representation(cls, representation, base=None):\n        # Other spherical differentials can be done without going to Cartesian,\n        # though we need base for the latitude to remove coslat. For that case,\n        # do the equivalent of cls._d_lon in SphericalDifferential.\n        if isinstance(representation, SphericalDifferential):\n            return cls(representation.d_lon, -representation.d_lat,\n                       representation.d_distance)\n        elif isinstance(representation, SphericalCosLatDifferential):\n            cls._check_base(base)\n            d_phi = representation.d_lon_coslat / np.sin(base.theta)\n            return cls(d_phi, -representation.d_lat, representation.d_distance)\n\n        return super().from_representation(representation, base)\n\n    def _scale_operation(self, op, *args, scaled_base=False):\n        if scaled_base:\n            return self.__class__(self.d_phi, self.d_theta, op(self.d_r, *args))\n        else:\n            return super()._scale_operation(op, *args)"},{"col":4,"comment":"null","endLoc":3434,"header":"def represent_as(self, other_class, base=None)","id":15602,"name":"represent_as","nodeType":"Function","startLoc":3415,"text":"def represent_as(self, other_class, base=None):\n        # All spherical differentials can be done without going to Cartesian,\n        # though CosLat needs base for the latitude. For those, explicitly\n        # do the equivalent of self._d_lon_coslat in SphericalDifferential.\n        if issubclass(other_class, SphericalDifferential):\n            return other_class(self.d_phi, -self.d_theta, self.d_r)\n        elif issubclass(other_class, UnitSphericalDifferential):\n            return other_class(self.d_phi, -self.d_theta)\n        elif issubclass(other_class, SphericalCosLatDifferential):\n            self._check_base(base)\n            d_lon_coslat = self.d_phi * np.sin(base.theta)\n            return other_class(d_lon_coslat, -self.d_theta, self.d_r)\n        elif issubclass(other_class, UnitSphericalCosLatDifferential):\n            self._check_base(base)\n            d_lon_coslat = self.d_phi * np.sin(base.theta)\n            return other_class(d_lon_coslat, -self.d_theta)\n        elif issubclass(other_class, RadialDifferential):\n            return other_class(self.d_r)\n\n        return super().represent_as(other_class, base)"},{"col":0,"comment":"\n    Return the e-terms of aberration vector\n\n    Parameters\n    ----------\n    equinox : Time object\n        The equinox for which to compute the e-terms\n    ","endLoc":133,"header":"def fk4_e_terms(equinox)","id":15603,"name":"fk4_e_terms","nodeType":"Function","startLoc":106,"text":"def fk4_e_terms(equinox):\n    \"\"\"\n    Return the e-terms of aberration vector\n\n    Parameters\n    ----------\n    equinox : Time object\n        The equinox for which to compute the e-terms\n    \"\"\"\n    # Constant of aberration at J2000; from Explanatory Supplement to the\n    # Astronomical Almanac (Seidelmann, 2005).\n    k = 0.0056932  # in degrees (v_earth/c ~ 1e-4 rad ~ 0.0057 deg)\n    k = np.radians(k)\n\n    # Eccentricity of the Earth's orbit\n    e = earth.eccentricity(equinox.jd)\n\n    # Mean longitude of perigee of the solar orbit\n    g = earth.mean_lon_of_perigee(equinox.jd)\n    g = np.radians(g)\n\n    # Obliquity of the ecliptic\n    o = earth.obliquity(equinox.jd, algorithm=1980)\n    o = np.radians(o)\n\n    return (e * k * np.sin(g),\n            -e * k * np.cos(g) * np.cos(o),\n            -e * k * np.cos(g) * np.sin(o))"},{"col":0,"comment":"null","endLoc":170,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, FK4, FK4NoETerms)\ndef fk4_to_fk4_no_e(fk4coord, fk4noeframe)","id":15604,"name":"fk4_to_fk4_no_e","nodeType":"Function","startLoc":136,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, FK4, FK4NoETerms)\ndef fk4_to_fk4_no_e(fk4coord, fk4noeframe):\n    # Extract cartesian vector\n    rep = fk4coord.cartesian\n\n    # Find distance (for re-normalization)\n    d_orig = rep.norm()\n    rep /= d_orig\n\n    # Apply E-terms of aberration. Note that this depends on the equinox (not\n    # the observing time/epoch) of the coordinates. See issue #1496 for a\n    # discussion of this.\n    eterms_a = CartesianRepresentation(\n        u.Quantity(fk4_e_terms(fk4coord.equinox), u.dimensionless_unscaled,\n                   copy=False), copy=False)\n    rep = rep - eterms_a + eterms_a.dot(rep) * rep\n\n    # Find new distance (for re-normalization)\n    d_new = rep.norm()\n\n    # Renormalize\n    rep *= d_orig / d_new\n\n    # now re-cast into an appropriate Representation, and precess if need be\n    if isinstance(fk4coord.data, UnitSphericalRepresentation):\n        rep = rep.represent_as(UnitSphericalRepresentation)\n\n    # if no obstime was given in the new frame, use the old one for consistency\n    newobstime = fk4coord._obstime if fk4noeframe._obstime is None else fk4noeframe._obstime\n\n    fk4noe = FK4NoETerms(rep, equinox=fk4coord.equinox, obstime=newobstime)\n    if fk4coord.equinox != fk4noeframe.equinox:\n        # precession\n        fk4noe = fk4noe.transform_to(fk4noeframe)\n    return fk4noe"},{"col":4,"comment":"null","endLoc":3449,"header":"@classmethod\n    def from_representation(cls, representation, base=None)","id":15605,"name":"from_representation","nodeType":"Function","startLoc":3436,"text":"@classmethod\n    def from_representation(cls, representation, base=None):\n        # Other spherical differentials can be done without going to Cartesian,\n        # though we need base for the latitude to remove coslat. For that case,\n        # do the equivalent of cls._d_lon in SphericalDifferential.\n        if isinstance(representation, SphericalDifferential):\n            return cls(representation.d_lon, -representation.d_lat,\n                       representation.d_distance)\n        elif isinstance(representation, SphericalCosLatDifferential):\n            cls._check_base(base)\n            d_phi = representation.d_lon_coslat / np.sin(base.theta)\n            return cls(d_phi, -representation.d_lat, representation.d_distance)\n\n        return super().from_representation(representation, base)"},{"col":0,"comment":"null","endLoc":99,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, AltAz, ICRS)\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, HADec, ICRS)\ndef observed_to_icrs(observed_coo, icrs_frame)","id":15606,"name":"observed_to_icrs","nodeType":"Function","startLoc":57,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, AltAz, ICRS)\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, HADec, ICRS)\ndef observed_to_icrs(observed_coo, icrs_frame):\n    # if the data are UnitSphericalRepresentation, we can skip the distance calculations\n    is_unitspherical = (isinstance(observed_coo.data, UnitSphericalRepresentation) or\n                        observed_coo.cartesian.x.unit == u.one)\n\n    usrepr = observed_coo.represent_as(UnitSphericalRepresentation)\n    lon = usrepr.lon.to_value(u.radian)\n    lat = usrepr.lat.to_value(u.radian)\n\n    if isinstance(observed_coo, AltAz):\n        # the 'A' indicates zen/az inputs\n        coord_type = 'A'\n        lat = PIOVER2 - lat\n    else:\n        coord_type = 'H'\n\n    # first set up the astrometry context for ICRS<->CIRS at the observed_coo time\n    astrom = erfa_astrom.get().apco(observed_coo)\n\n    # Topocentric CIRS\n    cirs_ra, cirs_dec = erfa.atoiq(coord_type, lon, lat, astrom) << u.radian\n    if is_unitspherical:\n        srepr = SphericalRepresentation(cirs_ra, cirs_dec, 1, copy=False)\n    else:\n        srepr = SphericalRepresentation(lon=cirs_ra, lat=cirs_dec,\n                                        distance=observed_coo.distance, copy=False)\n\n    # BCRS (Astrometric) direction to source\n    bcrs_ra, bcrs_dec = aticq(srepr, astrom) << u.radian\n\n    # Correct for parallax to get ICRS representation\n    if is_unitspherical:\n        icrs_srepr = UnitSphericalRepresentation(bcrs_ra, bcrs_dec, copy=False)\n    else:\n        icrs_srepr = SphericalRepresentation(lon=bcrs_ra, lat=bcrs_dec,\n                                             distance=observed_coo.distance, copy=False)\n        observer_icrs = CartesianRepresentation(astrom['eb'], unit=u.au, xyz_axis=-1, copy=False)\n        newrepr = icrs_srepr.to_cartesian() + observer_icrs\n        icrs_srepr = newrepr.represent_as(SphericalRepresentation)\n\n    return icrs_frame.realize_frame(icrs_srepr)"},{"col":4,"comment":"null","endLoc":3455,"header":"def _scale_operation(self, op, *args, scaled_base=False)","id":15607,"name":"_scale_operation","nodeType":"Function","startLoc":3451,"text":"def _scale_operation(self, op, *args, scaled_base=False):\n        if scaled_base:\n            return self.__class__(self.d_phi, self.d_theta, op(self.d_r, *args))\n        else:\n            return super()._scale_operation(op, *args)"},{"col":0,"comment":"null","endLoc":93,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, ICRS)\ndef cirs_to_icrs(cirs_coo, icrs_frame)","id":15608,"name":"cirs_to_icrs","nodeType":"Function","startLoc":64,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, ICRS)\ndef cirs_to_icrs(cirs_coo, icrs_frame):\n    # set up the astrometry context for ICRS<->cirs and then convert to\n    # astrometric coordinate direction\n    astrom = erfa_astrom.get().apco(cirs_coo)\n    srepr = cirs_coo.represent_as(SphericalRepresentation)\n    i_ra, i_dec = aticq(srepr.without_differentials(), astrom)\n\n    if cirs_coo.data.get_name() == 'unitspherical' or cirs_coo.data.to_cartesian().x.unit == u.one:\n        # if no distance, just use the coordinate direction to yield the\n        # infinite-distance/no parallax answer\n        newrep = UnitSphericalRepresentation(lat=u.Quantity(i_dec, u.radian, copy=False),\n                                             lon=u.Quantity(i_ra, u.radian, copy=False),\n                                             copy=False)\n    else:\n        # When there is a distance, apply the parallax/offset to the SSB as the\n        # last step - ensures round-tripping with the icrs_to_cirs transform\n\n        # the distance in intermedrep is *not* a real distance as it does not\n        # include the offset back to the SSB\n        intermedrep = SphericalRepresentation(lat=u.Quantity(i_dec, u.radian, copy=False),\n                                              lon=u.Quantity(i_ra, u.radian, copy=False),\n                                              distance=srepr.distance,\n                                              copy=False)\n\n        astrom_eb = CartesianRepresentation(astrom['eb'], unit=u.au,\n                                            xyz_axis=-1, copy=False)\n        newrep = intermedrep + astrom_eb\n\n    return icrs_frame.realize_frame(newrep)"},{"attributeType":"PhysicsSphericalRepresentation","col":4,"comment":"null","endLoc":3407,"id":15609,"name":"base_representation","nodeType":"Attribute","startLoc":3407,"text":"base_representation"},{"className":"CylindricalDifferential","col":0,"comment":"Differential(s) of points in cylindrical coordinates.\n\n    Parameters\n    ----------\n    d_rho : `~astropy.units.Quantity` ['speed']\n        The differential cylindrical radius.\n    d_phi : `~astropy.units.Quantity` ['angular speed']\n        The differential azimuth.\n    d_z : `~astropy.units.Quantity` ['speed']\n        The differential height.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    ","endLoc":3478,"id":15610,"nodeType":"Class","startLoc":3458,"text":"class CylindricalDifferential(BaseDifferential):\n    \"\"\"Differential(s) of points in cylindrical coordinates.\n\n    Parameters\n    ----------\n    d_rho : `~astropy.units.Quantity` ['speed']\n        The differential cylindrical radius.\n    d_phi : `~astropy.units.Quantity` ['angular speed']\n        The differential azimuth.\n    d_z : `~astropy.units.Quantity` ['speed']\n        The differential height.\n    copy : bool, optional\n        If `True` (default), arrays will be copied. If `False`, arrays will\n        be references, though possibly broadcast to ensure matching shapes.\n    \"\"\"\n    base_representation = CylindricalRepresentation\n\n    def __init__(self, d_rho, d_phi=None, d_z=None, copy=False):\n        super().__init__(d_rho, d_phi, d_z, copy=copy)\n        if not self._d_rho.unit.is_equivalent(self._d_z.unit):\n            raise u.UnitsError(\"d_rho and d_z should have equivalent units.\")"},{"col":4,"comment":"null","endLoc":3478,"header":"def __init__(self, d_rho, d_phi=None, d_z=None, copy=False)","id":15611,"name":"__init__","nodeType":"Function","startLoc":3475,"text":"def __init__(self, d_rho, d_phi=None, d_z=None, copy=False):\n        super().__init__(d_rho, d_phi, d_z, copy=copy)\n        if not self._d_rho.unit.is_equivalent(self._d_z.unit):\n            raise u.UnitsError(\"d_rho and d_z should have equivalent units.\")"},{"attributeType":"CylindricalRepresentation","col":4,"comment":"null","endLoc":3473,"id":15612,"name":"base_representation","nodeType":"Attribute","startLoc":3473,"text":"base_representation"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":15613,"name":"__all__","nodeType":"Attribute","startLoc":25,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":15614,"name":"REPRESENTATION_CLASSES","nodeType":"Attribute","startLoc":39,"text":"REPRESENTATION_CLASSES"},{"attributeType":"null","col":0,"comment":"null","endLoc":40,"id":15615,"name":"DIFFERENTIAL_CLASSES","nodeType":"Attribute","startLoc":40,"text":"DIFFERENTIAL_CLASSES"},{"attributeType":"null","col":0,"comment":"null","endLoc":42,"id":15616,"name":"DUPLICATE_REPRESENTATIONS","nodeType":"Attribute","startLoc":42,"text":"DUPLICATE_REPRESENTATIONS"},{"attributeType":"None","col":0,"comment":"null","endLoc":45,"id":15617,"name":"_REPRDIFF_HASH","nodeType":"Attribute","startLoc":45,"text":"_REPRDIFF_HASH"},{"col":0,"comment":"","endLoc":5,"header":"representation.py#<anonymous>","id":15618,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nIn this module, we define the coordinate representation classes, which are\nused to represent low-level cartesian, spherical, cylindrical, and other\ncoordinates.\n\"\"\"\n\n__all__ = [\"BaseRepresentationOrDifferential\", \"BaseRepresentation\",\n           \"CartesianRepresentation\", \"SphericalRepresentation\",\n           \"UnitSphericalRepresentation\", \"RadialRepresentation\",\n           \"PhysicsSphericalRepresentation\", \"CylindricalRepresentation\",\n           \"BaseDifferential\", \"CartesianDifferential\",\n           \"BaseSphericalDifferential\", \"BaseSphericalCosLatDifferential\",\n           \"SphericalDifferential\", \"SphericalCosLatDifferential\",\n           \"UnitSphericalDifferential\", \"UnitSphericalCosLatDifferential\",\n           \"RadialDifferential\", \"CylindricalDifferential\",\n           \"PhysicsSphericalDifferential\"]\n\nREPRESENTATION_CLASSES = {}\n\nDIFFERENTIAL_CLASSES = {}\n\nDUPLICATE_REPRESENTATIONS = set()\n\n_REPRDIFF_HASH = None"},{"fileName":"cirs_observed_transforms.py","filePath":"astropy/coordinates/builtin_frames","id":15619,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nContains the transformation functions for getting to \"observed\" systems from CIRS.\n\"\"\"\n\nimport numpy as np\nimport erfa\n\nfrom astropy import units as u\nfrom astropy.coordinates.baseframe import frame_transform_graph\nfrom astropy.coordinates.transformations import FunctionTransformWithFiniteDifference\nfrom astropy.coordinates.representation import (SphericalRepresentation,\n                                                UnitSphericalRepresentation)\n\nfrom .cirs import CIRS\nfrom .altaz import AltAz\nfrom .hadec import HADec\nfrom .utils import PIOVER2\nfrom ..erfa_astrom import erfa_astrom\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, AltAz)\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, HADec)\ndef cirs_to_observed(cirs_coo, observed_frame):\n    if (np.any(observed_frame.location != cirs_coo.location) or\n            np.any(cirs_coo.obstime != observed_frame.obstime)):\n        cirs_coo = cirs_coo.transform_to(CIRS(obstime=observed_frame.obstime,\n                                              location=observed_frame.location))\n\n    # if the data are UnitSphericalRepresentation, we can skip the distance calculations\n    is_unitspherical = (isinstance(cirs_coo.data, UnitSphericalRepresentation) or\n                        cirs_coo.cartesian.x.unit == u.one)\n\n    # We used to do \"astrometric\" corrections here, but these are no longer necesssary\n    # CIRS has proper topocentric behaviour\n    usrepr = cirs_coo.represent_as(UnitSphericalRepresentation)\n    cirs_ra = usrepr.lon.to_value(u.radian)\n    cirs_dec = usrepr.lat.to_value(u.radian)\n    # first set up the astrometry context for CIRS<->observed\n    astrom = erfa_astrom.get().apio(observed_frame)\n\n    if isinstance(observed_frame, AltAz):\n        lon, zen, _, _, _ = erfa.atioq(cirs_ra, cirs_dec, astrom)\n        lat = PIOVER2 - zen\n    else:\n        _, _, lon, lat, _ = erfa.atioq(cirs_ra, cirs_dec, astrom)\n\n    if is_unitspherical:\n        rep = UnitSphericalRepresentation(lat=u.Quantity(lat, u.radian, copy=False),\n                                          lon=u.Quantity(lon, u.radian, copy=False),\n                                          copy=False)\n    else:\n        # since we've transformed to CIRS at the observatory location, just use CIRS distance\n        rep = SphericalRepresentation(lat=u.Quantity(lat, u.radian, copy=False),\n                                      lon=u.Quantity(lon, u.radian, copy=False),\n                                      distance=cirs_coo.distance,\n                                      copy=False)\n    return observed_frame.realize_frame(rep)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, AltAz, CIRS)\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, HADec, CIRS)\ndef observed_to_cirs(observed_coo, cirs_frame):\n    usrepr = observed_coo.represent_as(UnitSphericalRepresentation)\n    lon = usrepr.lon.to_value(u.radian)\n    lat = usrepr.lat.to_value(u.radian)\n\n    if isinstance(observed_coo, AltAz):\n        # the 'A' indicates zen/az inputs\n        coord_type = 'A'\n        lat = PIOVER2 - lat\n    else:\n        coord_type = 'H'\n\n    # first set up the astrometry context for ICRS<->CIRS at the observed_coo time\n    astrom = erfa_astrom.get().apio(observed_coo)\n\n    cirs_ra, cirs_dec = erfa.atoiq(coord_type, lon, lat, astrom) << u.radian\n    if isinstance(observed_coo.data, UnitSphericalRepresentation) or observed_coo.cartesian.x.unit == u.one:\n        distance = None\n    else:\n        distance = observed_coo.distance\n\n    cirs_at_aa_time = CIRS(ra=cirs_ra, dec=cirs_dec, distance=distance,\n                           obstime=observed_coo.obstime,\n                           location=observed_coo.location)\n\n    # this final transform may be a no-op if the obstimes and locations are the same\n    return cirs_at_aa_time.transform_to(cirs_frame)\n"},{"fileName":"intermediate_rotation_transforms.py","filePath":"astropy/coordinates/builtin_frames","id":15620,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nContains the transformation functions for getting to/from ITRS, TEME, GCRS, and CIRS.\nThese are distinct from the ICRS and AltAz functions because they are just\nrotations without aberration corrections or offsets.\n\"\"\"\n\nimport numpy as np\nimport erfa\n\nfrom astropy.coordinates.baseframe import frame_transform_graph\nfrom astropy.coordinates.transformations import FunctionTransformWithFiniteDifference\nfrom astropy.coordinates.matrix_utilities import matrix_transpose\n\nfrom .icrs import ICRS\nfrom .gcrs import GCRS, PrecessedGeocentric\nfrom .cirs import CIRS\nfrom .itrs import ITRS\nfrom .equatorial import TEME, TETE\nfrom .utils import get_polar_motion, get_jd12, EARTH_CENTER\n\n# # first define helper functions\n\n\ndef teme_to_itrs_mat(time):\n    # Sidereal time, rotates from ITRS to mean equinox\n    # Use 1982 model for consistency with Vallado et al (2006)\n    # http://www.celestrak.com/publications/aiaa/2006-6753/AIAA-2006-6753.pdf\n    gst = erfa.gmst82(*get_jd12(time, 'ut1'))\n\n    # Polar Motion\n    # Do not include TIO locator s' because it is not used in Vallado 2006\n    xp, yp = get_polar_motion(time)\n    pmmat = erfa.pom00(xp, yp, 0)\n\n    # rotation matrix\n    # c2tcio expects a GCRS->CIRS matrix as it's first argument.\n    # Here, we just set that to an I-matrix, because we're already\n    # in TEME and the difference between TEME and CIRS is just the\n    # rotation by the sidereal time rather than the Earth Rotation Angle\n    return erfa.c2tcio(np.eye(3), gst, pmmat)\n\n\ndef gcrs_to_cirs_mat(time):\n    # celestial-to-intermediate matrix\n    return erfa.c2i06a(*get_jd12(time, 'tt'))\n\n\ndef cirs_to_itrs_mat(time):\n    # compute the polar motion p-matrix\n    xp, yp = get_polar_motion(time)\n    sp = erfa.sp00(*get_jd12(time, 'tt'))\n    pmmat = erfa.pom00(xp, yp, sp)\n\n    # now determine the Earth Rotation Angle for the input obstime\n    # era00 accepts UT1, so we convert if need be\n    era = erfa.era00(*get_jd12(time, 'ut1'))\n\n    # c2tcio expects a GCRS->CIRS matrix, but we just set that to an I-matrix\n    # because we're already in CIRS\n    return erfa.c2tcio(np.eye(3), era, pmmat)\n\n\ndef tete_to_itrs_mat(time, rbpn=None):\n    \"\"\"Compute the polar motion p-matrix at the given time.\n\n    If the nutation-precession matrix is already known, it should be passed in,\n    as this is by far the most expensive calculation.\n    \"\"\"\n    xp, yp = get_polar_motion(time)\n    sp = erfa.sp00(*get_jd12(time, 'tt'))\n    pmmat = erfa.pom00(xp, yp, sp)\n\n    # now determine the greenwich apparent siderial time for the input obstime\n    # we use the 2006A model for consistency with RBPN matrix use in GCRS <-> TETE\n    ujd1, ujd2 = get_jd12(time, 'ut1')\n    jd1, jd2 = get_jd12(time, 'tt')\n    if rbpn is None:\n        # erfa.gst06a calls pnm06a to calculate rbpn and then gst06. Use it in\n        # favour of getting rbpn with erfa.pnm06a to avoid a possibly large array.\n        gast = erfa.gst06a(ujd1, ujd2, jd1, jd2)\n    else:\n        gast = erfa.gst06(ujd1, ujd2, jd1, jd2, rbpn)\n\n    # c2tcio expects a GCRS->CIRS matrix, but we just set that to an I-matrix\n    # because we're already in CIRS equivalent frame\n    return erfa.c2tcio(np.eye(3), gast, pmmat)\n\n\ndef gcrs_precession_mat(equinox):\n    gamb, phib, psib, epsa = erfa.pfw06(*get_jd12(equinox, 'tt'))\n    return erfa.fw2m(gamb, phib, psib, epsa)\n\n\ndef get_location_gcrs(location, obstime, ref_to_itrs, gcrs_to_ref):\n    \"\"\"Create a GCRS frame at the location and obstime.\n\n    The reference frame z axis must point to the Celestial Intermediate Pole\n    (as is the case for CIRS and TETE).\n\n    This function is here to avoid location.get_gcrs(obstime), which would\n    recalculate matrices that are already available below (and return a GCRS\n    coordinate, rather than a frame with obsgeoloc and obsgeovel).  Instead,\n    it uses the private method that allows passing in the matrices.\n\n    \"\"\"\n    obsgeoloc, obsgeovel = location._get_gcrs_posvel(obstime,\n                                                     ref_to_itrs, gcrs_to_ref)\n    return GCRS(obstime=obstime, obsgeoloc=obsgeoloc, obsgeovel=obsgeovel)\n\n\n# now the actual transforms\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, TETE)\ndef gcrs_to_tete(gcrs_coo, tete_frame):\n    # Classical NPB matrix, IAU 2006/2000A\n    # (same as in builtin_frames.utils.get_cip).\n    rbpn = erfa.pnm06a(*get_jd12(tete_frame.obstime, 'tt'))\n    # Get GCRS coordinates for the target observer location and time.\n    loc_gcrs = get_location_gcrs(tete_frame.location, tete_frame.obstime,\n                                 tete_to_itrs_mat(tete_frame.obstime, rbpn=rbpn),\n                                 rbpn)\n    gcrs_coo2 = gcrs_coo.transform_to(loc_gcrs)\n    # Now we are relative to the correct observer, do the transform to TETE.\n    # These rotations are defined at the geocenter, but can be applied to\n    # topocentric positions as well, assuming rigid Earth. See p57 of\n    # https://www.usno.navy.mil/USNO/astronomical-applications/publications/Circular_179.pdf\n    crepr = gcrs_coo2.cartesian.transform(rbpn)\n    return tete_frame.realize_frame(crepr)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, TETE, GCRS)\ndef tete_to_gcrs(tete_coo, gcrs_frame):\n    # Compute the pn matrix, and then multiply by its transpose.\n    rbpn = erfa.pnm06a(*get_jd12(tete_coo.obstime, 'tt'))\n    newrepr = tete_coo.cartesian.transform(matrix_transpose(rbpn))\n    # We now have a GCRS vector for the input location and obstime.\n    # Turn it into a GCRS frame instance.\n    loc_gcrs = get_location_gcrs(tete_coo.location, tete_coo.obstime,\n                                 tete_to_itrs_mat(tete_coo.obstime, rbpn=rbpn),\n                                 rbpn)\n    gcrs = loc_gcrs.realize_frame(newrepr)\n    # Finally, do any needed offsets (no-op if same obstime and location)\n    return gcrs.transform_to(gcrs_frame)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, TETE, ITRS)\ndef tete_to_itrs(tete_coo, itrs_frame):\n    # first get us to TETE at the target obstime, and geocentric position\n    tete_coo2 = tete_coo.transform_to(TETE(obstime=itrs_frame.obstime,\n                                           location=EARTH_CENTER))\n\n    # now get the pmatrix\n    pmat = tete_to_itrs_mat(itrs_frame.obstime)\n    crepr = tete_coo2.cartesian.transform(pmat)\n    return itrs_frame.realize_frame(crepr)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ITRS, TETE)\ndef itrs_to_tete(itrs_coo, tete_frame):\n    # compute the pmatrix, and then multiply by its transpose\n    pmat = tete_to_itrs_mat(itrs_coo.obstime)\n    newrepr = itrs_coo.cartesian.transform(matrix_transpose(pmat))\n    tete = TETE(newrepr, obstime=itrs_coo.obstime)\n\n    # now do any needed offsets (no-op if same obstime)\n    return tete.transform_to(tete_frame)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, CIRS)\ndef gcrs_to_cirs(gcrs_coo, cirs_frame):\n    # first get the pmatrix\n    pmat = gcrs_to_cirs_mat(cirs_frame.obstime)\n    # Get GCRS coordinates for the target observer location and time.\n    loc_gcrs = get_location_gcrs(cirs_frame.location, cirs_frame.obstime,\n                                 cirs_to_itrs_mat(cirs_frame.obstime), pmat)\n    gcrs_coo2 = gcrs_coo.transform_to(loc_gcrs)\n    # Now we are relative to the correct observer, do the transform to CIRS.\n    crepr = gcrs_coo2.cartesian.transform(pmat)\n    return cirs_frame.realize_frame(crepr)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, GCRS)\ndef cirs_to_gcrs(cirs_coo, gcrs_frame):\n    # Compute the pmatrix, and then multiply by its transpose,\n    pmat = gcrs_to_cirs_mat(cirs_coo.obstime)\n    newrepr = cirs_coo.cartesian.transform(matrix_transpose(pmat))\n    # We now have a GCRS vector for the input location and obstime.\n    # Turn it into a GCRS frame instance.\n    loc_gcrs = get_location_gcrs(cirs_coo.location, cirs_coo.obstime,\n                                 cirs_to_itrs_mat(cirs_coo.obstime), pmat)\n    gcrs = loc_gcrs.realize_frame(newrepr)\n    # Finally, do any needed offsets (no-op if same obstime and location)\n    return gcrs.transform_to(gcrs_frame)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, ITRS)\ndef cirs_to_itrs(cirs_coo, itrs_frame):\n    # first get us to geocentric CIRS at the target obstime\n    cirs_coo2 = cirs_coo.transform_to(CIRS(obstime=itrs_frame.obstime,\n                                           location=EARTH_CENTER))\n\n    # now get the pmatrix\n    pmat = cirs_to_itrs_mat(itrs_frame.obstime)\n    crepr = cirs_coo2.cartesian.transform(pmat)\n    return itrs_frame.realize_frame(crepr)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ITRS, CIRS)\ndef itrs_to_cirs(itrs_coo, cirs_frame):\n    # compute the pmatrix, and then multiply by its transpose\n    pmat = cirs_to_itrs_mat(itrs_coo.obstime)\n    newrepr = itrs_coo.cartesian.transform(matrix_transpose(pmat))\n    cirs = CIRS(newrepr, obstime=itrs_coo.obstime)\n\n    # now do any needed offsets (no-op if same obstime)\n    return cirs.transform_to(cirs_frame)\n\n\n# TODO: implement GCRS<->CIRS if there's call for it.  The thing that's awkward\n# is that they both have obstimes, so an extra set of transformations are necessary.\n# so unless there's a specific need for that, better to just have it go through the above\n# two steps anyway\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, PrecessedGeocentric)\ndef gcrs_to_precessedgeo(from_coo, to_frame):\n    # first get us to GCRS with the right attributes (might be a no-op)\n    gcrs_coo = from_coo.transform_to(GCRS(obstime=to_frame.obstime,\n                                          obsgeoloc=to_frame.obsgeoloc,\n                                          obsgeovel=to_frame.obsgeovel))\n\n    # now precess to the requested equinox\n    pmat = gcrs_precession_mat(to_frame.equinox)\n    crepr = gcrs_coo.cartesian.transform(pmat)\n    return to_frame.realize_frame(crepr)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, PrecessedGeocentric, GCRS)\ndef precessedgeo_to_gcrs(from_coo, to_frame):\n    # first un-precess\n    pmat = gcrs_precession_mat(from_coo.equinox)\n    crepr = from_coo.cartesian.transform(matrix_transpose(pmat))\n    gcrs_coo = GCRS(crepr,\n                    obstime=from_coo.obstime,\n                    obsgeoloc=from_coo.obsgeoloc,\n                    obsgeovel=from_coo.obsgeovel)\n\n    # then move to the GCRS that's actually desired\n    return gcrs_coo.transform_to(to_frame)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, TEME, ITRS)\ndef teme_to_itrs(teme_coo, itrs_frame):\n    # use the pmatrix to transform to ITRS in the source obstime\n    pmat = teme_to_itrs_mat(teme_coo.obstime)\n    crepr = teme_coo.cartesian.transform(pmat)\n    itrs = ITRS(crepr, obstime=teme_coo.obstime)\n\n    # transform the ITRS coordinate to the target obstime\n    return itrs.transform_to(itrs_frame)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ITRS, TEME)\ndef itrs_to_teme(itrs_coo, teme_frame):\n    # transform the ITRS coordinate to the target obstime\n    itrs_coo2 = itrs_coo.transform_to(ITRS(obstime=teme_frame.obstime))\n\n    # compute the pmatrix, and then multiply by its transpose\n    pmat = teme_to_itrs_mat(teme_frame.obstime)\n    newrepr = itrs_coo2.cartesian.transform(matrix_transpose(pmat))\n    return teme_frame.realize_frame(newrepr)\n\n\n# Create loopback transformations\nframe_transform_graph._add_merged_transform(ITRS, CIRS, ITRS)\nframe_transform_graph._add_merged_transform(PrecessedGeocentric, GCRS, PrecessedGeocentric)\nframe_transform_graph._add_merged_transform(TEME, ITRS, TEME)\nframe_transform_graph._add_merged_transform(TETE, ICRS, TETE)\n"},{"className":"TEME","col":0,"comment":"\n    A coordinate or frame in the True Equator Mean Equinox frame (TEME).\n\n    This frame is a geocentric system similar to CIRS or geocentric apparent place,\n    except that the mean sidereal time is used to rotate from TIRS. TEME coordinates\n    are most often used in combination with orbital data for satellites in the\n    two-line-ephemeris format.\n\n    Different implementations of the TEME frame exist. For clarity, this frame follows the\n    conventions and relations to other frames that are set out in Vallado et al (2006).\n\n    For more background on TEME, see the references provided in the\n    :ref:`astropy:astropy-coordinates-seealso` section of the documentation.\n    ","endLoc":105,"id":15621,"nodeType":"Class","startLoc":85,"text":"@format_doc(base_doc, components=\"\", footer=doc_footer_teme)\nclass TEME(BaseCoordinateFrame):\n    \"\"\"\n    A coordinate or frame in the True Equator Mean Equinox frame (TEME).\n\n    This frame is a geocentric system similar to CIRS or geocentric apparent place,\n    except that the mean sidereal time is used to rotate from TIRS. TEME coordinates\n    are most often used in combination with orbital data for satellites in the\n    two-line-ephemeris format.\n\n    Different implementations of the TEME frame exist. For clarity, this frame follows the\n    conventions and relations to other frames that are set out in Vallado et al (2006).\n\n    For more background on TEME, see the references provided in the\n    :ref:`astropy:astropy-coordinates-seealso` section of the documentation.\n    \"\"\"\n\n    default_representation = CartesianRepresentation\n    default_differential = CartesianDifferential\n\n    obstime = TimeAttribute()"},{"attributeType":"null","col":4,"comment":"null","endLoc":102,"id":15622,"name":"default_representation","nodeType":"Attribute","startLoc":102,"text":"default_representation"},{"col":0,"comment":"null","endLoc":59,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, AltAz)\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, HADec)\ndef cirs_to_observed(cirs_coo, observed_frame)","id":15623,"name":"cirs_to_observed","nodeType":"Function","startLoc":23,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, AltAz)\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, HADec)\ndef cirs_to_observed(cirs_coo, observed_frame):\n    if (np.any(observed_frame.location != cirs_coo.location) or\n            np.any(cirs_coo.obstime != observed_frame.obstime)):\n        cirs_coo = cirs_coo.transform_to(CIRS(obstime=observed_frame.obstime,\n                                              location=observed_frame.location))\n\n    # if the data are UnitSphericalRepresentation, we can skip the distance calculations\n    is_unitspherical = (isinstance(cirs_coo.data, UnitSphericalRepresentation) or\n                        cirs_coo.cartesian.x.unit == u.one)\n\n    # We used to do \"astrometric\" corrections here, but these are no longer necesssary\n    # CIRS has proper topocentric behaviour\n    usrepr = cirs_coo.represent_as(UnitSphericalRepresentation)\n    cirs_ra = usrepr.lon.to_value(u.radian)\n    cirs_dec = usrepr.lat.to_value(u.radian)\n    # first set up the astrometry context for CIRS<->observed\n    astrom = erfa_astrom.get().apio(observed_frame)\n\n    if isinstance(observed_frame, AltAz):\n        lon, zen, _, _, _ = erfa.atioq(cirs_ra, cirs_dec, astrom)\n        lat = PIOVER2 - zen\n    else:\n        _, _, lon, lat, _ = erfa.atioq(cirs_ra, cirs_dec, astrom)\n\n    if is_unitspherical:\n        rep = UnitSphericalRepresentation(lat=u.Quantity(lat, u.radian, copy=False),\n                                          lon=u.Quantity(lon, u.radian, copy=False),\n                                          copy=False)\n    else:\n        # since we've transformed to CIRS at the observatory location, just use CIRS distance\n        rep = SphericalRepresentation(lat=u.Quantity(lat, u.radian, copy=False),\n                                      lon=u.Quantity(lon, u.radian, copy=False),\n                                      distance=cirs_coo.distance,\n                                      copy=False)\n    return observed_frame.realize_frame(rep)"},{"attributeType":"null","col":4,"comment":"null","endLoc":103,"id":15624,"name":"default_differential","nodeType":"Attribute","startLoc":103,"text":"default_differential"},{"col":0,"comment":"null","endLoc":209,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, FK4NoETerms, FK4)\ndef fk4_no_e_to_fk4(fk4noecoord, fk4frame)","id":15625,"name":"fk4_no_e_to_fk4","nodeType":"Function","startLoc":173,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, FK4NoETerms, FK4)\ndef fk4_no_e_to_fk4(fk4noecoord, fk4frame):\n    # first precess, if necessary\n    if fk4noecoord.equinox != fk4frame.equinox:\n        fk4noe_w_fk4equinox = FK4NoETerms(equinox=fk4frame.equinox,\n                                          obstime=fk4noecoord.obstime)\n        fk4noecoord = fk4noecoord.transform_to(fk4noe_w_fk4equinox)\n\n    # Extract cartesian vector\n    rep = fk4noecoord.cartesian\n\n    # Find distance (for re-normalization)\n    d_orig = rep.norm()\n    rep /= d_orig\n\n    # Apply E-terms of aberration. Note that this depends on the equinox (not\n    # the observing time/epoch) of the coordinates. See issue #1496 for a\n    # discussion of this.\n    eterms_a = CartesianRepresentation(\n        u.Quantity(fk4_e_terms(fk4noecoord.equinox), u.dimensionless_unscaled,\n                   copy=False), copy=False)\n\n    rep0 = rep.copy()\n    for _ in range(10):\n        rep = (eterms_a + rep0) / (1. + eterms_a.dot(rep))\n\n    # Find new distance (for re-normalization)\n    d_new = rep.norm()\n\n    # Renormalize\n    rep *= d_orig / d_new\n\n    # now re-cast into an appropriate Representation, and precess if need be\n    if isinstance(fk4noecoord.data, UnitSphericalRepresentation):\n        rep = rep.represent_as(UnitSphericalRepresentation)\n\n    return fk4frame.realize_frame(rep)"},{"attributeType":"null","col":4,"comment":"null","endLoc":105,"id":15626,"name":"obstime","nodeType":"Attribute","startLoc":105,"text":"obstime"},{"attributeType":"null","col":0,"comment":"null","endLoc":34,"id":15627,"name":"EARTH_CENTER","nodeType":"Attribute","startLoc":34,"text":"EARTH_CENTER"},{"col":0,"comment":"null","endLoc":42,"header":"def teme_to_itrs_mat(time)","id":15628,"name":"teme_to_itrs_mat","nodeType":"Function","startLoc":26,"text":"def teme_to_itrs_mat(time):\n    # Sidereal time, rotates from ITRS to mean equinox\n    # Use 1982 model for consistency with Vallado et al (2006)\n    # http://www.celestrak.com/publications/aiaa/2006-6753/AIAA-2006-6753.pdf\n    gst = erfa.gmst82(*get_jd12(time, 'ut1'))\n\n    # Polar Motion\n    # Do not include TIO locator s' because it is not used in Vallado 2006\n    xp, yp = get_polar_motion(time)\n    pmmat = erfa.pom00(xp, yp, 0)\n\n    # rotation matrix\n    # c2tcio expects a GCRS->CIRS matrix as it's first argument.\n    # Here, we just set that to an I-matrix, because we're already\n    # in TEME and the difference between TEME and CIRS is just the\n    # rotation by the sidereal time rather than the Earth Rotation Angle\n    return erfa.c2tcio(np.eye(3), gst, pmmat)"},{"col":0,"comment":"Compute the polar motion p-matrix at the given time.\n\n    If the nutation-precession matrix is already known, it should be passed in,\n    as this is by far the most expensive calculation.\n    ","endLoc":88,"header":"def tete_to_itrs_mat(time, rbpn=None)","id":15629,"name":"tete_to_itrs_mat","nodeType":"Function","startLoc":65,"text":"def tete_to_itrs_mat(time, rbpn=None):\n    \"\"\"Compute the polar motion p-matrix at the given time.\n\n    If the nutation-precession matrix is already known, it should be passed in,\n    as this is by far the most expensive calculation.\n    \"\"\"\n    xp, yp = get_polar_motion(time)\n    sp = erfa.sp00(*get_jd12(time, 'tt'))\n    pmmat = erfa.pom00(xp, yp, sp)\n\n    # now determine the greenwich apparent siderial time for the input obstime\n    # we use the 2006A model for consistency with RBPN matrix use in GCRS <-> TETE\n    ujd1, ujd2 = get_jd12(time, 'ut1')\n    jd1, jd2 = get_jd12(time, 'tt')\n    if rbpn is None:\n        # erfa.gst06a calls pnm06a to calculate rbpn and then gst06. Use it in\n        # favour of getting rbpn with erfa.pnm06a to avoid a possibly large array.\n        gast = erfa.gst06a(ujd1, ujd2, jd1, jd2)\n    else:\n        gast = erfa.gst06(ujd1, ujd2, jd1, jd2, rbpn)\n\n    # c2tcio expects a GCRS->CIRS matrix, but we just set that to an I-matrix\n    # because we're already in CIRS equivalent frame\n    return erfa.c2tcio(np.eye(3), gast, pmmat)"},{"col":0,"comment":"null","endLoc":93,"header":"def gcrs_precession_mat(equinox)","id":15630,"name":"gcrs_precession_mat","nodeType":"Function","startLoc":91,"text":"def gcrs_precession_mat(equinox):\n    gamb, phib, psib, epsa = erfa.pfw06(*get_jd12(equinox, 'tt'))\n    return erfa.fw2m(gamb, phib, psib, epsa)"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":15631,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":15632,"name":"doc_footer_fk4","nodeType":"Attribute","startLoc":22,"text":"doc_footer_fk4"},{"col":0,"comment":"","endLoc":4,"header":"fk4.py#<anonymous>","id":15633,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['FK4', 'FK4NoETerms']\n\ndoc_footer_fk4 = \"\"\"\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\n        The equinox of this frame.\n    obstime : `~astropy.time.Time`\n        The time this frame was observed.  If ``None``, will be the same as\n        ``equinox``.\n\"\"\""},{"attributeType":"null","col":29,"comment":"null","endLoc":8,"id":15634,"name":"u","nodeType":"Attribute","startLoc":8,"text":"u"},{"col":0,"comment":"","endLoc":5,"header":"icrs_observed_transforms.py#<anonymous>","id":15635,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nContains the transformation functions for getting to \"observed\" systems from ICRS.\n\"\"\"\n\nframe_transform_graph._add_merged_transform(AltAz, ICRS, AltAz)\n\nframe_transform_graph._add_merged_transform(HADec, ICRS, HADec)"},{"fileName":"galactocentric.py","filePath":"astropy/coordinates/builtin_frames","id":15636,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport copy\nfrom collections.abc import MappingView\nfrom types import MappingProxyType\n\nimport numpy as np\n\nfrom astropy import units as u\nfrom astropy.utils.state import ScienceState\nfrom astropy.utils.decorators import format_doc, classproperty, deprecated\nfrom astropy.coordinates.angles import Angle\nfrom astropy.coordinates.matrix_utilities import rotation_matrix, matrix_product, matrix_transpose\nfrom astropy.coordinates import representation as r\nfrom astropy.coordinates.baseframe import (BaseCoordinateFrame,\n                                           frame_transform_graph,\n                                           base_doc)\nfrom astropy.coordinates.attributes import (CoordinateAttribute,\n                                            QuantityAttribute,\n                                            DifferentialAttribute)\nfrom astropy.coordinates.transformations import AffineTransform\nfrom astropy.coordinates.errors import ConvertError\n\nfrom .icrs import ICRS\n\n__all__ = ['Galactocentric']\n\n\n# Measured by minimizing the difference between a plane of coordinates along\n#   l=0, b=[-90,90] and the Galactocentric x-z plane\n# This is not used directly, but accessed via `get_roll0`.  We define it here to\n# prevent having to create new Angle objects every time `get_roll0` is called.\n_ROLL0 = Angle(58.5986320306*u.degree)\n\n\nclass _StateProxy(MappingView):\n    \"\"\"\n    `~collections.abc.MappingView` with a read-only ``getitem`` through\n    `~types.MappingProxyType`.\n\n    \"\"\"\n\n    def __init__(self, mapping):\n        super().__init__(mapping)\n        self._mappingproxy = MappingProxyType(self._mapping)  # read-only\n\n    def __getitem__(self, key):\n        \"\"\"Read-only ``getitem``.\"\"\"\n        return self._mappingproxy[key]\n\n    def __deepcopy__(self, memo):\n        return copy.deepcopy(self._mapping, memo=memo)\n\n\nclass galactocentric_frame_defaults(ScienceState):\n    \"\"\"This class controls the global setting of default values for the frame\n    attributes in the `~astropy.coordinates.Galactocentric` frame, which may be\n    updated in future versions of ``astropy``. Note that when using\n    `~astropy.coordinates.Galactocentric`, changing values here will not affect\n    any attributes that are set explicitly by passing values in to the\n    `~astropy.coordinates.Galactocentric` initializer. Modifying these defaults\n    will only affect the frame attribute values when using the frame as, e.g.,\n    ``Galactocentric`` or ``Galactocentric()`` with no explicit arguments.\n\n    This class controls the parameter settings by specifying a string name,\n    with the following pre-specified options:\n\n    - 'pre-v4.0': The current default value, which sets the default frame\n      attribute values to their original (pre-astropy-v4.0) values.\n    - 'v4.0': The attribute values as updated in Astropy version 4.0.\n    - 'latest': An alias of the most recent parameter set (currently: 'v4.0')\n\n    Alternatively, user-defined parameter settings may be registered, with\n    :meth:`~astropy.coordinates.galactocentric_frame_defaults.register`,\n    and used identically as pre-specified parameter sets. At minimum,\n    registrations must have unique names and a dictionary of parameters\n    with keys \"galcen_coord\", \"galcen_distance\", \"galcen_v_sun\", \"z_sun\",\n    \"roll\". See examples below.\n\n    This class also tracks the references for all parameter values in the\n    attribute ``references``, as well as any further information the registry.\n    The pre-specified options can be extended to include similar\n    state information as user-defined parameter settings -- for example, to add\n    parameter uncertainties.\n\n    The preferred method for getting a parameter set and metadata, by name, is\n    :meth:`~galactocentric_frame_defaults.get_from_registry` since\n    it ensures the immutability of the registry.\n\n    See :ref:`astropy:astropy-coordinates-galactocentric-defaults` for more\n    information.\n\n    Examples\n    --------\n    The default `~astropy.coordinates.Galactocentric` frame parameters can be\n    modified globally::\n\n        >>> from astropy.coordinates import galactocentric_frame_defaults\n        >>> _ = galactocentric_frame_defaults.set('v4.0') # doctest: +SKIP\n        >>> Galactocentric() # doctest: +SKIP\n        <Galactocentric Frame (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            (266.4051, -28.936175)>, galcen_distance=8.122 kpc, galcen_v_sun=(12.9, 245.6, 7.78) km / s, z_sun=20.8 pc, roll=0.0 deg)>\n        >>> _ = galactocentric_frame_defaults.set('pre-v4.0') # doctest: +SKIP\n        >>> Galactocentric() # doctest: +SKIP\n        <Galactocentric Frame (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            (266.4051, -28.936175)>, galcen_distance=8.3 kpc, galcen_v_sun=(11.1, 232.24, 7.25) km / s, z_sun=27.0 pc, roll=0.0 deg)>\n\n    The default parameters can also be updated by using this class as a context\n    manager::\n\n        >>> with galactocentric_frame_defaults.set('pre-v4.0'):\n        ...     print(Galactocentric()) # doctest: +FLOAT_CMP\n        <Galactocentric Frame (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            (266.4051, -28.936175)>, galcen_distance=8.3 kpc, galcen_v_sun=(11.1, 232.24, 7.25) km / s, z_sun=27.0 pc, roll=0.0 deg)>\n\n    Again, changing the default parameter values will not affect frame\n    attributes that are explicitly specified::\n\n        >>> import astropy.units as u\n        >>> with galactocentric_frame_defaults.set('pre-v4.0'):\n        ...     print(Galactocentric(galcen_distance=8.0*u.kpc)) # doctest: +FLOAT_CMP\n        <Galactocentric Frame (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            (266.4051, -28.936175)>, galcen_distance=8.0 kpc, galcen_v_sun=(11.1, 232.24, 7.25) km / s, z_sun=27.0 pc, roll=0.0 deg)>\n\n    Additional parameter sets may be registered, for instance to use the\n    Dehnen & Binney (1998) measurements of the solar motion. We can also\n    add metadata, such as the 1-sigma errors. In this example we will modify\n    the required key \"parameters\", change the recommended key \"references\" to\n    match \"parameters\", and add the extra key \"error\" (any key can be added)::\n\n        >>> state = galactocentric_frame_defaults.get_from_registry(\"v4.0\")\n        >>> state[\"parameters\"][\"galcen_v_sun\"] = (10.00, 225.25, 7.17) * (u.km / u.s)\n        >>> state[\"references\"][\"galcen_v_sun\"] = \"https://ui.adsabs.harvard.edu/full/1998MNRAS.298..387D\"\n        >>> state[\"error\"] = {\"galcen_v_sun\": (0.36, 0.62, 0.38) * (u.km / u.s)}\n        >>> galactocentric_frame_defaults.register(name=\"DB1998\", **state)\n\n    Just as in the previous examples, the new parameter set can be retrieved with::\n\n        >>> state = galactocentric_frame_defaults.get_from_registry(\"DB1998\")\n        >>> print(state[\"error\"][\"galcen_v_sun\"])  # doctest: +FLOAT_CMP\n        [0.36 0.62 0.38] km / s\n\n    \"\"\"\n\n    _latest_value = 'v4.0'\n    _value = None\n    _references = None\n    _state = dict()  # all other data\n\n    # Note: _StateProxy() produces read-only view of enclosed mapping.\n    _registry = {\n        \"v4.0\": {\n            \"parameters\": _StateProxy(\n                {\n                    \"galcen_coord\": ICRS(\n                        ra=266.4051 * u.degree, dec=-28.936175 * u.degree\n                    ),\n                    \"galcen_distance\": 8.122 * u.kpc,\n                    \"galcen_v_sun\": r.CartesianDifferential(\n                        [12.9, 245.6, 7.78] * (u.km / u.s)\n                    ),\n                    \"z_sun\": 20.8 * u.pc,\n                    \"roll\": 0 * u.deg,\n                }\n            ),\n            \"references\": _StateProxy(\n                {\n                    \"galcen_coord\": \"https://ui.adsabs.harvard.edu/abs/2004ApJ...616..872R\",\n                    \"galcen_distance\": \"https://ui.adsabs.harvard.edu/abs/2018A%26A...615L..15G\",\n                    \"galcen_v_sun\": [\n                        \"https://ui.adsabs.harvard.edu/abs/2018RNAAS...2..210D\",\n                        \"https://ui.adsabs.harvard.edu/abs/2018A%26A...615L..15G\",\n                        \"https://ui.adsabs.harvard.edu/abs/2004ApJ...616..872R\",\n                    ],\n                    \"z_sun\": \"https://ui.adsabs.harvard.edu/abs/2019MNRAS.482.1417B\",\n                    \"roll\": None,\n                }\n            ),\n        },\n        \"pre-v4.0\": {\n            \"parameters\": _StateProxy(\n                {\n                    \"galcen_coord\": ICRS(\n                        ra=266.4051 * u.degree, dec=-28.936175 * u.degree\n                    ),\n                    \"galcen_distance\": 8.3 * u.kpc,\n                    \"galcen_v_sun\": r.CartesianDifferential(\n                        [11.1, 220 + 12.24, 7.25] * (u.km / u.s)\n                    ),\n                    \"z_sun\": 27.0 * u.pc,\n                    \"roll\": 0 * u.deg,\n                }\n            ),\n            \"references\": _StateProxy(\n                {\n                    \"galcen_coord\": \"https://ui.adsabs.harvard.edu/abs/2004ApJ...616..872R\",\n                    \"galcen_distance\": \"https://ui.adsabs.harvard.edu/#abs/2009ApJ...692.1075G\",\n                    \"galcen_v_sun\": [\n                        \"https://ui.adsabs.harvard.edu/#abs/2010MNRAS.403.1829S\",\n                        \"https://ui.adsabs.harvard.edu/#abs/2015ApJS..216...29B\",\n                    ],\n                    \"z_sun\": \"https://ui.adsabs.harvard.edu/#abs/2001ApJ...553..184C\",\n                    \"roll\": None,\n                }\n            ),\n        },\n    }\n\n    @classproperty  # read-only\n    def parameters(cls):\n        return cls._value\n\n    @classproperty  # read-only\n    def references(cls):\n        return cls._references\n\n    @classmethod\n    def get_from_registry(cls, name: str):\n        \"\"\"\n        Return Galactocentric solar parameters and metadata given string names\n        for the parameter sets. This method ensures the returned state is a\n        mutable copy, so any changes made do not affect the registry state.\n\n        Returns\n        -------\n        state : dict\n            Copy of the registry for the string name.\n            Should contain, at minimum:\n\n            - \"parameters\": dict\n                Galactocentric solar parameters\n            - \"references\" : Dict[str, Union[str, Sequence[str]]]\n                References for \"parameters\".\n                Fields are str or sequence of str.\n\n        Raises\n        ------\n        KeyError\n            If invalid string input to registry\n            to retrieve solar parameters for Galactocentric frame.\n\n        \"\"\"\n        # Resolve the meaning of 'latest': latest parameter set is from v4.0\n        # - update this as newer parameter choices are added\n        if name == 'latest':\n            name = cls._latest_value\n\n        # Get the state from the registry.\n        # Copy to ensure registry is immutable to modifications of \"_value\".\n        # Raises KeyError if `name` is invalid string input to registry\n        # to retrieve solar parameters for Galactocentric frame.\n        state = copy.deepcopy(cls._registry[name])  # ensure mutable\n\n        return state\n\n    @deprecated(\"v4.2\", alternative=\"`get_from_registry`\")\n    @classmethod\n    def get_solar_params_from_string(cls, arg):\n        \"\"\"\n        Return Galactocentric solar parameters given string names\n        for the parameter sets.\n\n        Returns\n        -------\n        parameters : dict\n            Copy of Galactocentric solar parameters from registry\n\n        Raises\n        ------\n        KeyError\n            If invalid string input to registry\n            to retrieve solar parameters for Galactocentric frame.\n\n        \"\"\"\n        return cls.get_from_registry(arg)[\"parameters\"]\n\n    @classmethod\n    def validate(cls, value):\n        if value is None:\n            value = cls._latest_value\n\n        if isinstance(value, str):\n            state = cls.get_from_registry(value)\n            cls._references = state[\"references\"]\n            cls._state = state\n            parameters = state[\"parameters\"]\n\n        elif isinstance(value, dict):\n            parameters = value\n\n        elif isinstance(value, Galactocentric):\n            # turn the frame instance into a dict of frame attributes\n            parameters = dict()\n            for k in value.frame_attributes:\n                parameters[k] = getattr(value, k)\n            cls._references = value.frame_attribute_references.copy()\n            cls._state = dict(parameters=parameters,\n                              references=cls._references)\n\n        else:\n            raise ValueError(\"Invalid input to retrieve solar parameters for \"\n                             \"Galactocentric frame: input must be a string, \"\n                             \"dict, or Galactocentric instance\")\n\n        return parameters\n\n    @classmethod\n    def register(cls, name: str, parameters: dict, references=None,\n                 **meta: dict):\n        \"\"\"Register a set of parameters.\n\n        Parameters\n        ----------\n        name : str\n            The registration name for the parameter and metadata set.\n        parameters : dict\n            The solar parameters for Galactocentric frame.\n        references : dict or None, optional\n            References for contents of `parameters`.\n            None becomes empty dict.\n        **meta : dict, optional\n            Any other properties to register.\n\n        \"\"\"\n        # check on contents of `parameters`\n        must_have = {\"galcen_coord\", \"galcen_distance\", \"galcen_v_sun\",\n                     \"z_sun\", \"roll\"}\n        missing = must_have.difference(parameters)\n        if missing:\n            raise ValueError(f\"Missing parameters: {missing}\")\n\n        references = references or {}  # None -> {}\n\n        state = dict(parameters=parameters, references=references)\n        state.update(meta)  # meta never has keys \"parameters\" or \"references\"\n\n        cls._registry[name] = state\n\n\ndoc_components = \"\"\"\n    x : `~astropy.units.Quantity`, optional\n        Cartesian, Galactocentric :math:`x` position component.\n    y : `~astropy.units.Quantity`, optional\n        Cartesian, Galactocentric :math:`y` position component.\n    z : `~astropy.units.Quantity`, optional\n        Cartesian, Galactocentric :math:`z` position component.\n\n    v_x : `~astropy.units.Quantity`, optional\n        Cartesian, Galactocentric :math:`v_x` velocity component.\n    v_y : `~astropy.units.Quantity`, optional\n        Cartesian, Galactocentric :math:`v_y` velocity component.\n    v_z : `~astropy.units.Quantity`, optional\n        Cartesian, Galactocentric :math:`v_z` velocity component.\n\"\"\"\n\ndoc_footer = \"\"\"\n    Other parameters\n    ----------------\n    galcen_coord : `ICRS`, optional, keyword-only\n        The ICRS coordinates of the Galactic center.\n    galcen_distance : `~astropy.units.Quantity`, optional, keyword-only\n        The distance from the sun to the Galactic center.\n    galcen_v_sun : `~astropy.coordinates.representation.CartesianDifferential`, `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The velocity of the sun *in the Galactocentric frame* as Cartesian\n        velocity components.\n    z_sun : `~astropy.units.Quantity` ['length'], optional, keyword-only\n        The distance from the sun to the Galactic midplane.\n    roll : `~astropy.coordinates.Angle`, optional, keyword-only\n        The angle to rotate about the final x-axis, relative to the\n        orientation for Galactic. For example, if this roll angle is 0,\n        the final x-z plane will align with the Galactic coordinates x-z\n        plane. Unless you really know what this means, you probably should\n        not change this!\n\n    Examples\n    --------\n\n    To transform to the Galactocentric frame with the default\n    frame attributes, pass the uninstantiated class name to the\n    ``transform_to()`` method of a `~astropy.coordinates.SkyCoord` object::\n\n        >>> import astropy.units as u\n        >>> import astropy.coordinates as coord\n        >>> c = coord.SkyCoord(ra=[158.3122, 24.5] * u.degree,\n        ...                    dec=[-17.3, 81.52] * u.degree,\n        ...                    distance=[11.5, 24.12] * u.kpc,\n        ...                    frame='icrs')\n        >>> c.transform_to(coord.Galactocentric) # doctest: +FLOAT_CMP\n        <SkyCoord (Galactocentric: galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            (266.4051, -28.936175)>, galcen_distance=8.122 kpc, galcen_v_sun=(12.9, 245.6, 7.78) km / s, z_sun=20.8 pc, roll=0.0 deg): (x, y, z) in kpc\n            [( -9.43489286, -9.40062188, 6.51345359),\n             (-21.11044918, 18.76334013, 7.83175149)]>\n\n\n    To specify a custom set of parameters, you have to include extra keyword\n    arguments when initializing the Galactocentric frame object::\n\n        >>> c.transform_to(coord.Galactocentric(galcen_distance=8.1*u.kpc)) # doctest: +FLOAT_CMP\n        <SkyCoord (Galactocentric: galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            (266.4051, -28.936175)>, galcen_distance=8.1 kpc, galcen_v_sun=(12.9, 245.6, 7.78) km / s, z_sun=20.8 pc, roll=0.0 deg): (x, y, z) in kpc\n            [( -9.41284763, -9.40062188, 6.51346272),\n             (-21.08839478, 18.76334013, 7.83184184)]>\n\n    Similarly, transforming from the Galactocentric frame to another coordinate frame::\n\n        >>> c = coord.SkyCoord(x=[-8.3, 4.5] * u.kpc,\n        ...                    y=[0., 81.52] * u.kpc,\n        ...                    z=[0.027, 24.12] * u.kpc,\n        ...                    frame=coord.Galactocentric)\n        >>> c.transform_to(coord.ICRS) # doctest: +FLOAT_CMP\n        <SkyCoord (ICRS): (ra, dec, distance) in (deg, deg, kpc)\n            [( 88.22423301, 29.88672864,  0.17813456),\n             (289.72864549, 49.9865043 , 85.93949064)]>\n\n    Or, with custom specification of the Galactic center::\n\n        >>> c = coord.SkyCoord(x=[-8.0, 4.5] * u.kpc,\n        ...                    y=[0., 81.52] * u.kpc,\n        ...                    z=[21.0, 24120.0] * u.pc,\n        ...                    frame=coord.Galactocentric,\n        ...                    z_sun=21 * u.pc, galcen_distance=8. * u.kpc)\n        >>> c.transform_to(coord.ICRS) # doctest: +FLOAT_CMP\n        <SkyCoord (ICRS): (ra, dec, distance) in (deg, deg, kpc)\n            [( 86.2585249 , 28.85773187, 2.75625475e-05),\n             (289.77285255, 50.06290457, 8.59216010e+01)]>\n\n\"\"\"\n\n\n@format_doc(base_doc, components=doc_components, footer=doc_footer)\nclass Galactocentric(BaseCoordinateFrame):\n    r\"\"\"\n    A coordinate or frame in the Galactocentric system.\n\n    This frame allows specifying the Sun-Galactic center distance, the height of\n    the Sun above the Galactic midplane, and the solar motion relative to the\n    Galactic center. However, as there is no modern standard definition of a\n    Galactocentric reference frame, it is important to pay attention to the\n    default values used in this class if precision is important in your code.\n    The default values of the parameters of this frame are taken from the\n    original definition of the frame in 2014. As such, the defaults are somewhat\n    out of date relative to recent measurements made possible by, e.g., Gaia.\n    The defaults can, however, be changed at runtime by setting the parameter\n    set name in `~astropy.coordinates.galactocentric_frame_defaults`.\n\n    The current default parameter set is ``\"pre-v4.0\"``, indicating that the\n    parameters were adopted before ``astropy`` version 4.0. A regularly-updated\n    parameter set can instead be used by setting\n    ``galactocentric_frame_defaults.set ('latest')``, and other parameter set\n    names may be added in future versions. To find out the scientific papers\n    that the current default parameters are derived from, use\n    ``galcen.frame_attribute_references`` (where ``galcen`` is an instance of\n    this frame), which will update even if the default parameter set is changed.\n\n    The position of the Sun is assumed to be on the x axis of the final,\n    right-handed system. That is, the x axis points from the position of\n    the Sun projected to the Galactic midplane to the Galactic center --\n    roughly towards :math:`(l,b) = (0^\\circ,0^\\circ)`. For the default\n    transformation (:math:`{\\rm roll}=0^\\circ`), the y axis points roughly\n    towards Galactic longitude :math:`l=90^\\circ`, and the z axis points\n    roughly towards the North Galactic Pole (:math:`b=90^\\circ`).\n\n    For a more detailed look at the math behind this transformation, see\n    the document :ref:`astropy:coordinates-galactocentric`.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    default_representation = r.CartesianRepresentation\n    default_differential = r.CartesianDifferential\n\n    # frame attributes\n    galcen_coord = CoordinateAttribute(frame=ICRS)\n    galcen_distance = QuantityAttribute(unit=u.kpc)\n\n    galcen_v_sun = DifferentialAttribute(\n        allowed_classes=[r.CartesianDifferential])\n\n    z_sun = QuantityAttribute(unit=u.pc)\n    roll = QuantityAttribute(unit=u.deg)\n\n    def __init__(self, *args, **kwargs):\n        # Set default frame attribute values based on the ScienceState instance\n        # for the solar parameters defined above\n        default_params = galactocentric_frame_defaults.get()\n        self.frame_attribute_references = \\\n            galactocentric_frame_defaults.references.copy()\n\n        for k in default_params:\n            if k in kwargs:\n                # If a frame attribute is set by the user, remove its reference\n                self.frame_attribute_references.pop(k, None)\n\n            # Keep the frame attribute if it is set by the user, otherwise use\n            # the default value\n            kwargs[k] = kwargs.get(k, default_params[k])\n\n        super().__init__(*args, **kwargs)\n\n    @classmethod\n    def get_roll0(cls):\n        \"\"\"\n        The additional roll angle (about the final x axis) necessary to align\n        the final z axis to match the Galactic yz-plane.  Setting the ``roll``\n        frame attribute to  -this method's return value removes this rotation,\n        allowing the use of the `Galactocentric` frame in more general contexts.\n        \"\"\"\n        # note that the actual value is defined at the module level.  We make at\n        # a property here because this module isn't actually part of the public\n        # API, so it's better for it to be accessible from Galactocentric\n        return _ROLL0\n\n# ICRS to/from Galactocentric ----------------------->\n\n\ndef get_matrix_vectors(galactocentric_frame, inverse=False):\n    \"\"\"\n    Use the ``inverse`` argument to get the inverse transformation, matrix and\n    offsets to go from Galactocentric to ICRS.\n    \"\"\"\n    # shorthand\n    gcf = galactocentric_frame\n\n    # rotation matrix to align x(ICRS) with the vector to the Galactic center\n    mat1 = rotation_matrix(-gcf.galcen_coord.dec, 'y')\n    mat2 = rotation_matrix(gcf.galcen_coord.ra, 'z')\n    # extra roll away from the Galactic x-z plane\n    mat0 = rotation_matrix(gcf.get_roll0() - gcf.roll, 'x')\n\n    # construct transformation matrix and use it\n    R = matrix_product(mat0, mat1, mat2)\n\n    # Now need to translate by Sun-Galactic center distance around x' and\n    # rotate about y' to account for tilt due to Sun's height above the plane\n    translation = r.CartesianRepresentation(gcf.galcen_distance * [1., 0., 0.])\n    z_d = gcf.z_sun / gcf.galcen_distance\n    H = rotation_matrix(-np.arcsin(z_d), 'y')\n\n    # compute total matrices\n    A = matrix_product(H, R)\n\n    # Now we re-align the translation vector to account for the Sun's height\n    # above the midplane\n    offset = -translation.transform(H)\n\n    if inverse:\n        # the inverse of a rotation matrix is a transpose, which is much faster\n        #   and more stable to compute\n        A = matrix_transpose(A)\n        offset = (-offset).transform(A)\n        offset_v = r.CartesianDifferential.from_cartesian(\n            (-gcf.galcen_v_sun).to_cartesian().transform(A))\n        offset = offset.with_differentials(offset_v)\n\n    else:\n        offset = offset.with_differentials(gcf.galcen_v_sun)\n\n    return A, offset\n\n\ndef _check_coord_repr_diff_types(c):\n    if isinstance(c.data, r.UnitSphericalRepresentation):\n        raise ConvertError(\"Transforming to/from a Galactocentric frame \"\n                           \"requires a 3D coordinate, e.g. (angle, angle, \"\n                           \"distance) or (x, y, z).\")\n\n    if ('s' in c.data.differentials and\n            isinstance(c.data.differentials['s'],\n                       (r.UnitSphericalDifferential,\n                        r.UnitSphericalCosLatDifferential,\n                        r.RadialDifferential))):\n        raise ConvertError(\"Transforming to/from a Galactocentric frame \"\n                           \"requires a 3D velocity, e.g., proper motion \"\n                           \"components and radial velocity.\")\n\n\n@frame_transform_graph.transform(AffineTransform, ICRS, Galactocentric)\ndef icrs_to_galactocentric(icrs_coord, galactocentric_frame):\n    _check_coord_repr_diff_types(icrs_coord)\n    return get_matrix_vectors(galactocentric_frame)\n\n\n@frame_transform_graph.transform(AffineTransform, Galactocentric, ICRS)\ndef galactocentric_to_icrs(galactocentric_coord, icrs_frame):\n    _check_coord_repr_diff_types(galactocentric_coord)\n    return get_matrix_vectors(galactocentric_coord, inverse=True)\n\n\n# Create loopback transformation\nframe_transform_graph._add_merged_transform(Galactocentric, ICRS, Galactocentric)\n"},{"fileName":"cirs.py","filePath":"astropy/coordinates/builtin_frames","id":15637,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom astropy.utils.decorators import format_doc\nfrom astropy.coordinates.attributes import (TimeAttribute,\n                                            EarthLocationAttribute)\nfrom astropy.coordinates.baseframe import base_doc\nfrom .baseradec import doc_components, BaseRADecFrame\nfrom .utils import DEFAULT_OBSTIME, EARTH_CENTER\n\n__all__ = ['CIRS']\n\n\ndoc_footer = \"\"\"\n    Other parameters\n    ----------------\n    obstime : `~astropy.time.Time`\n        The time at which the observation is taken.  Used for determining the\n        position of the Earth and its precession.\n    location : `~astropy.coordinates.EarthLocation`\n        The location on the Earth.  This can be specified either as an\n        `~astropy.coordinates.EarthLocation` object or as anything that can be\n        transformed to an `~astropy.coordinates.ITRS` frame. The default is the\n        centre of the Earth.\n\"\"\"\n\n\n@format_doc(base_doc, components=doc_components, footer=doc_footer)\nclass CIRS(BaseRADecFrame):\n    \"\"\"\n    A coordinate or frame in the Celestial Intermediate Reference System (CIRS).\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n    location = EarthLocationAttribute(default=EARTH_CENTER)\n\n# The \"self-transform\" is defined in icrs_cirs_transformations.py, because in\n# the current implementation it goes through ICRS (like GCRS)\n"},{"col":0,"comment":"Create a GCRS frame at the location and obstime.\n\n    The reference frame z axis must point to the Celestial Intermediate Pole\n    (as is the case for CIRS and TETE).\n\n    This function is here to avoid location.get_gcrs(obstime), which would\n    recalculate matrices that are already available below (and return a GCRS\n    coordinate, rather than a frame with obsgeoloc and obsgeovel).  Instead,\n    it uses the private method that allows passing in the matrices.\n\n    ","endLoc":110,"header":"def get_location_gcrs(location, obstime, ref_to_itrs, gcrs_to_ref)","id":15638,"name":"get_location_gcrs","nodeType":"Function","startLoc":96,"text":"def get_location_gcrs(location, obstime, ref_to_itrs, gcrs_to_ref):\n    \"\"\"Create a GCRS frame at the location and obstime.\n\n    The reference frame z axis must point to the Celestial Intermediate Pole\n    (as is the case for CIRS and TETE).\n\n    This function is here to avoid location.get_gcrs(obstime), which would\n    recalculate matrices that are already available below (and return a GCRS\n    coordinate, rather than a frame with obsgeoloc and obsgeovel).  Instead,\n    it uses the private method that allows passing in the matrices.\n\n    \"\"\"\n    obsgeoloc, obsgeovel = location._get_gcrs_posvel(obstime,\n                                                     ref_to_itrs, gcrs_to_ref)\n    return GCRS(obstime=obstime, obsgeoloc=obsgeoloc, obsgeovel=obsgeovel)"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":15639,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":15640,"name":"doc_footer","nodeType":"Attribute","startLoc":14,"text":"doc_footer"},{"col":0,"comment":"","endLoc":4,"header":"cirs.py#<anonymous>","id":15641,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['CIRS']\n\ndoc_footer = \"\"\"\n    Other parameters\n    ----------------\n    obstime : `~astropy.time.Time`\n        The time at which the observation is taken.  Used for determining the\n        position of the Earth and its precession.\n    location : `~astropy.coordinates.EarthLocation`\n        The location on the Earth.  This can be specified either as an\n        `~astropy.coordinates.EarthLocation` object or as anything that can be\n        transformed to an `~astropy.coordinates.ITRS` frame. The default is the\n        centre of the Earth.\n\"\"\""},{"fileName":"altaz.py","filePath":"astropy/coordinates/builtin_frames","id":15642,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport numpy as np\n\nfrom astropy import units as u\nfrom astropy.utils.decorators import format_doc\nfrom astropy.coordinates import representation as r\nfrom astropy.coordinates.baseframe import BaseCoordinateFrame, RepresentationMapping, base_doc\nfrom astropy.coordinates.attributes import (TimeAttribute,\n                                            QuantityAttribute,\n                                            EarthLocationAttribute)\n\n__all__ = ['AltAz']\n\n\n_90DEG = 90*u.deg\n\ndoc_components = \"\"\"\n    az : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Azimuth for this object (``alt`` must also be given and\n        ``representation`` must be None).\n    alt : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Altitude for this object (``az`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity` ['length'], optional, keyword-only\n        The Distance for this object along the line-of-sight.\n\n    pm_az_cosalt : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in azimuth (including the ``cos(alt)`` factor) for\n        this object (``pm_alt`` must also be given).\n    pm_alt : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in altitude for this object (``pm_az_cosalt`` must\n        also be given).\n    radial_velocity : `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The radial velocity of this object.\"\"\"\n\ndoc_footer = \"\"\"\n    Other parameters\n    ----------------\n    obstime : `~astropy.time.Time`\n        The time at which the observation is taken.  Used for determining the\n        position and orientation of the Earth.\n    location : `~astropy.coordinates.EarthLocation`\n        The location on the Earth.  This can be specified either as an\n        `~astropy.coordinates.EarthLocation` object or as anything that can be\n        transformed to an `~astropy.coordinates.ITRS` frame.\n    pressure : `~astropy.units.Quantity` ['pressure']\n        The atmospheric pressure as an `~astropy.units.Quantity` with pressure\n        units.  This is necessary for performing refraction corrections.\n        Setting this to 0 (the default) will disable refraction calculations\n        when transforming to/from this frame.\n    temperature : `~astropy.units.Quantity` ['temperature']\n        The ground-level temperature as an `~astropy.units.Quantity` in\n        deg C.  This is necessary for performing refraction corrections.\n    relative_humidity : `~astropy.units.Quantity` ['dimensionless'] or number\n        The relative humidity as a dimensionless quantity between 0 to 1.\n        This is necessary for performing refraction corrections.\n    obswl : `~astropy.units.Quantity` ['length']\n        The average wavelength of observations as an `~astropy.units.Quantity`\n         with length units.  This is necessary for performing refraction\n         corrections.\n\n    Notes\n    -----\n    The refraction model is based on that implemented in ERFA, which is fast\n    but becomes inaccurate for altitudes below about 5 degrees.  Near and below\n    altitudes of 0, it can even give meaningless answers, and in this case\n    transforming to AltAz and back to another frame can give highly discrepant\n    results.  For much better numerical stability, leave the ``pressure`` at\n    ``0`` (the default), thereby disabling the refraction correction and\n    yielding \"topocentric\" horizontal coordinates.\n    \"\"\"\n\n\n@format_doc(base_doc, components=doc_components, footer=doc_footer)\nclass AltAz(BaseCoordinateFrame):\n    \"\"\"\n    A coordinate or frame in the Altitude-Azimuth system (Horizontal\n    coordinates) with respect to the WGS84 ellipsoid.  Azimuth is oriented\n    East of North (i.e., N=0, E=90 degrees).  Altitude is also known as\n    elevation angle, so this frame is also in the Azimuth-Elevation system.\n\n    This frame is assumed to *include* refraction effects if the ``pressure``\n    frame attribute is non-zero.\n\n    The frame attributes are listed under **Other Parameters**, which are\n    necessary for transforming from AltAz to some other system.\n    \"\"\"\n\n    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'az'),\n            RepresentationMapping('lat', 'alt')\n        ]\n    }\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential\n\n    obstime = TimeAttribute(default=None)\n    location = EarthLocationAttribute(default=None)\n    pressure = QuantityAttribute(default=0, unit=u.hPa)\n    temperature = QuantityAttribute(default=0, unit=u.deg_C)\n    relative_humidity = QuantityAttribute(default=0, unit=u.dimensionless_unscaled)\n    obswl = QuantityAttribute(default=1*u.micron, unit=u.micron)\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n    @property\n    def secz(self):\n        \"\"\"\n        Secant of the zenith angle for this coordinate, a common estimate of\n        the airmass.\n        \"\"\"\n        return 1/np.sin(self.alt)\n\n    @property\n    def zen(self):\n        \"\"\"\n        The zenith angle (or zenith distance / co-altitude) for this coordinate.\n        \"\"\"\n        return _90DEG.to(self.alt.unit) - self.alt\n\n\n# self-transform defined in cirs_observed_transforms.py\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":15643,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":15644,"name":"_90DEG","nodeType":"Attribute","startLoc":17,"text":"_90DEG"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":15645,"name":"doc_components","nodeType":"Attribute","startLoc":19,"text":"doc_components"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":15646,"name":"doc_footer","nodeType":"Attribute","startLoc":38,"text":"doc_footer"},{"col":0,"comment":"","endLoc":4,"header":"altaz.py#<anonymous>","id":15647,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['AltAz']\n\n_90DEG = 90*u.deg\n\ndoc_components = \"\"\"\n    az : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Azimuth for this object (``alt`` must also be given and\n        ``representation`` must be None).\n    alt : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Altitude for this object (``az`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity` ['length'], optional, keyword-only\n        The Distance for this object along the line-of-sight.\n\n    pm_az_cosalt : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in azimuth (including the ``cos(alt)`` factor) for\n        this object (``pm_alt`` must also be given).\n    pm_alt : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in altitude for this object (``pm_az_cosalt`` must\n        also be given).\n    radial_velocity : `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The radial velocity of this object.\"\"\"\n\ndoc_footer = \"\"\"\n    Other parameters\n    ----------------\n    obstime : `~astropy.time.Time`\n        The time at which the observation is taken.  Used for determining the\n        position and orientation of the Earth.\n    location : `~astropy.coordinates.EarthLocation`\n        The location on the Earth.  This can be specified either as an\n        `~astropy.coordinates.EarthLocation` object or as anything that can be\n        transformed to an `~astropy.coordinates.ITRS` frame.\n    pressure : `~astropy.units.Quantity` ['pressure']\n        The atmospheric pressure as an `~astropy.units.Quantity` with pressure\n        units.  This is necessary for performing refraction corrections.\n        Setting this to 0 (the default) will disable refraction calculations\n        when transforming to/from this frame.\n    temperature : `~astropy.units.Quantity` ['temperature']\n        The ground-level temperature as an `~astropy.units.Quantity` in\n        deg C.  This is necessary for performing refraction corrections.\n    relative_humidity : `~astropy.units.Quantity` ['dimensionless'] or number\n        The relative humidity as a dimensionless quantity between 0 to 1.\n        This is necessary for performing refraction corrections.\n    obswl : `~astropy.units.Quantity` ['length']\n        The average wavelength of observations as an `~astropy.units.Quantity`\n         with length units.  This is necessary for performing refraction\n         corrections.\n\n    Notes\n    -----\n    The refraction model is based on that implemented in ERFA, which is fast\n    but becomes inaccurate for altitudes below about 5 degrees.  Near and below\n    altitudes of 0, it can even give meaningless answers, and in this case\n    transforming to AltAz and back to another frame can give highly discrepant\n    results.  For much better numerical stability, leave the ``pressure`` at\n    ``0`` (the default), thereby disabling the refraction correction and\n    yielding \"topocentric\" horizontal coordinates.\n    \"\"\""},{"className":"_StateProxy","col":0,"comment":"\n    `~collections.abc.MappingView` with a read-only ``getitem`` through\n    `~types.MappingProxyType`.\n\n    ","endLoc":53,"id":15648,"nodeType":"Class","startLoc":37,"text":"class _StateProxy(MappingView):\n    \"\"\"\n    `~collections.abc.MappingView` with a read-only ``getitem`` through\n    `~types.MappingProxyType`.\n\n    \"\"\"\n\n    def __init__(self, mapping):\n        super().__init__(mapping)\n        self._mappingproxy = MappingProxyType(self._mapping)  # read-only\n\n    def __getitem__(self, key):\n        \"\"\"Read-only ``getitem``.\"\"\"\n        return self._mappingproxy[key]\n\n    def __deepcopy__(self, memo):\n        return copy.deepcopy(self._mapping, memo=memo)"},{"fileName":"lsr.py","filePath":"astropy/coordinates/builtin_frames","id":15649,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom astropy import units as u\nfrom astropy.utils.decorators import format_doc\nfrom astropy.time import Time\nfrom astropy.coordinates import representation as r\nfrom astropy.coordinates.baseframe import (BaseCoordinateFrame,\n                                           RepresentationMapping,\n                                           frame_transform_graph, base_doc)\nfrom astropy.coordinates.transformations import AffineTransform\nfrom astropy.coordinates.attributes import DifferentialAttribute\n\nfrom .baseradec import BaseRADecFrame, doc_components as doc_components_radec\nfrom .icrs import ICRS\nfrom .galactic import Galactic\nfrom .fk4 import FK4\n\n# For speed\nJ2000 = Time('J2000')\n\nv_bary_Schoenrich2010 = r.CartesianDifferential([11.1, 12.24, 7.25]*u.km/u.s)\n\n__all__ = ['LSR', 'GalacticLSR', 'LSRK', 'LSRD']\n\n\ndoc_footer_lsr = \"\"\"\n    Other parameters\n    ----------------\n    v_bary : `~astropy.coordinates.representation.CartesianDifferential`\n        The velocity of the solar system barycenter with respect to the LSR, in\n        Galactic cartesian velocity components.\n\"\"\"\n\n\n@format_doc(base_doc, components=doc_components_radec, footer=doc_footer_lsr)\nclass LSR(BaseRADecFrame):\n    r\"\"\"A coordinate or frame in the Local Standard of Rest (LSR).\n\n    This coordinate frame is axis-aligned and co-spatial with `ICRS`, but has\n    a velocity offset relative to the solar system barycenter to remove the\n    peculiar motion of the sun relative to the LSR. Roughly, the LSR is the mean\n    velocity of the stars in the solar neighborhood, but the precise definition\n    of which depends on the study. As defined in Schönrich et al. (2010):\n    \"The LSR is the rest frame at the location of the Sun of a star that would\n    be on a circular orbit in the gravitational potential one would obtain by\n    azimuthally averaging away non-axisymmetric features in the actual Galactic\n    potential.\" No such orbit truly exists, but it is still a commonly used\n    velocity frame.\n\n    We use default values from Schönrich et al. (2010) for the barycentric\n    velocity relative to the LSR, which is defined in Galactic (right-handed)\n    cartesian velocity components\n    :math:`(U, V, W) = (11.1, 12.24, 7.25)~{{\\rm km}}~{{\\rm s}}^{{-1}}`. These\n    values are customizable via the ``v_bary`` argument which specifies the\n    velocity of the solar system barycenter with respect to the LSR.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    # frame attributes:\n    v_bary = DifferentialAttribute(default=v_bary_Schoenrich2010,\n                                   allowed_classes=[r.CartesianDifferential])\n\n\n@frame_transform_graph.transform(AffineTransform, ICRS, LSR)\ndef icrs_to_lsr(icrs_coord, lsr_frame):\n    v_bary_gal = Galactic(lsr_frame.v_bary.to_cartesian())\n    v_bary_icrs = v_bary_gal.transform_to(icrs_coord)\n    v_offset = v_bary_icrs.data.represent_as(r.CartesianDifferential)\n    offset = r.CartesianRepresentation([0, 0, 0]*u.au, differentials=v_offset)\n    return None, offset\n\n\n@frame_transform_graph.transform(AffineTransform, LSR, ICRS)\ndef lsr_to_icrs(lsr_coord, icrs_frame):\n    v_bary_gal = Galactic(lsr_coord.v_bary.to_cartesian())\n    v_bary_icrs = v_bary_gal.transform_to(icrs_frame)\n    v_offset = v_bary_icrs.data.represent_as(r.CartesianDifferential)\n    offset = r.CartesianRepresentation([0, 0, 0]*u.au, differentials=-v_offset)\n    return None, offset\n\n\n# ------------------------------------------------------------------------------\n\n\ndoc_components_gal = \"\"\"\n    l : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Galactic longitude for this object (``b`` must also be given and\n        ``representation`` must be None).\n    b : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Galactic latitude for this object (``l`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity` ['length'], optional, keyword-only\n        The Distance for this object along the line-of-sight.\n        (``representation`` must be None).\n\n    pm_l_cosb : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in Galactic longitude (including the ``cos(b)`` term)\n        for this object (``pm_b`` must also be given).\n    pm_b : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in Galactic latitude for this object (``pm_l_cosb``\n        must also be given).\n    radial_velocity : `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The radial velocity of this object.\n\"\"\"\n\n\n@format_doc(base_doc, components=doc_components_gal, footer=doc_footer_lsr)\nclass GalacticLSR(BaseCoordinateFrame):\n    r\"\"\"A coordinate or frame in the Local Standard of Rest (LSR), axis-aligned\n    to the `Galactic` frame.\n\n    This coordinate frame is axis-aligned and co-spatial with `ICRS`, but has\n    a velocity offset relative to the solar system barycenter to remove the\n    peculiar motion of the sun relative to the LSR. Roughly, the LSR is the mean\n    velocity of the stars in the solar neighborhood, but the precise definition\n    of which depends on the study. As defined in Schönrich et al. (2010):\n    \"The LSR is the rest frame at the location of the Sun of a star that would\n    be on a circular orbit in the gravitational potential one would obtain by\n    azimuthally averaging away non-axisymmetric features in the actual Galactic\n    potential.\" No such orbit truly exists, but it is still a commonly used\n    velocity frame.\n\n    We use default values from Schönrich et al. (2010) for the barycentric\n    velocity relative to the LSR, which is defined in Galactic (right-handed)\n    cartesian velocity components\n    :math:`(U, V, W) = (11.1, 12.24, 7.25)~{{\\rm km}}~{{\\rm s}}^{{-1}}`. These\n    values are customizable via the ``v_bary`` argument which specifies the\n    velocity of the solar system barycenter with respect to the LSR.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'l'),\n            RepresentationMapping('lat', 'b')\n        ]\n    }\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential\n\n    # frame attributes:\n    v_bary = DifferentialAttribute(default=v_bary_Schoenrich2010)\n\n\n@frame_transform_graph.transform(AffineTransform, Galactic, GalacticLSR)\ndef galactic_to_galacticlsr(galactic_coord, lsr_frame):\n    v_bary_gal = Galactic(lsr_frame.v_bary.to_cartesian())\n    v_offset = v_bary_gal.data.represent_as(r.CartesianDifferential)\n    offset = r.CartesianRepresentation([0, 0, 0]*u.au, differentials=v_offset)\n    return None, offset\n\n\n@frame_transform_graph.transform(AffineTransform, GalacticLSR, Galactic)\ndef galacticlsr_to_galactic(lsr_coord, galactic_frame):\n    v_bary_gal = Galactic(lsr_coord.v_bary.to_cartesian())\n    v_offset = v_bary_gal.data.represent_as(r.CartesianDifferential)\n    offset = r.CartesianRepresentation([0, 0, 0]*u.au, differentials=-v_offset)\n    return None, offset\n\n\n# ------------------------------------------------------------------------------\n\n# The LSRK velocity frame, defined as having a velocity of 20 km/s towards\n# RA=270 Dec=30 (B1900) relative to the solar system Barycenter. This is defined\n# in:\n#\n#   Gordon 1975, Methods of Experimental Physics: Volume 12:\n#   Astrophysics, Part C: Radio Observations - Section 6.1.5.\n\n\nclass LSRK(BaseRADecFrame):\n    r\"\"\"\n    A coordinate or frame in the Kinematic Local Standard of Rest (LSR).\n\n    This frame is defined as having a velocity of 20 km/s towards RA=270 Dec=30\n    (B1900) relative to the solar system Barycenter. This is defined in:\n\n        Gordon 1975, Methods of Experimental Physics: Volume 12:\n        Astrophysics, Part C: Radio Observations - Section 6.1.5.\n\n    This coordinate frame is axis-aligned and co-spatial with `ICRS`, but has\n    a velocity offset relative to the solar system barycenter to remove the\n    peculiar motion of the sun relative to the LSRK.\n    \"\"\"\n\n\n# NOTE: To avoid a performance penalty at import time, we hard-code the ICRS\n# offsets here. The code to generate the offsets is provided for reproducibility.\n# GORDON1975_V_BARY = 20*u.km/u.s\n# GORDON1975_DIRECTION = FK4(ra=270*u.deg, dec=30*u.deg, equinox='B1900')\n# V_OFFSET_LSRK = ((GORDON1975_V_BARY * GORDON1975_DIRECTION.transform_to(ICRS()).data)\n#                  .represent_as(r.CartesianDifferential))\n\nV_OFFSET_LSRK = r.CartesianDifferential([0.28999706839034606,\n                                         -17.317264789717928,\n                                         10.00141199546947]*u.km/u.s)\n\nICRS_LSRK_OFFSET = r.CartesianRepresentation([0, 0, 0]*u.au, differentials=V_OFFSET_LSRK)\nLSRK_ICRS_OFFSET = r.CartesianRepresentation([0, 0, 0]*u.au, differentials=-V_OFFSET_LSRK)\n\n\n@frame_transform_graph.transform(AffineTransform, ICRS, LSRK)\ndef icrs_to_lsrk(icrs_coord, lsr_frame):\n    return None, ICRS_LSRK_OFFSET\n\n\n@frame_transform_graph.transform(AffineTransform, LSRK, ICRS)\ndef lsrk_to_icrs(lsr_coord, icrs_frame):\n    return None, LSRK_ICRS_OFFSET\n\n\n# ------------------------------------------------------------------------------\n\n# The LSRD velocity frame, defined as a velocity of U=9 km/s, V=12 km/s,\n# and W=7 km/s in Galactic coordinates or 16.552945 km/s\n# towards l=53.13 b=25.02. This is defined in:\n#\n#   Delhaye 1965, Solar Motion and Velocity Distribution of\n#   Common Stars.\n\n\nclass LSRD(BaseRADecFrame):\n    r\"\"\"\n    A coordinate or frame in the Dynamical Local Standard of Rest (LSRD)\n\n    This frame is defined as a velocity of U=9 km/s, V=12 km/s,\n    and W=7 km/s in Galactic coordinates or 16.552945 km/s\n    towards l=53.13 b=25.02. This is defined in:\n\n       Delhaye 1965, Solar Motion and Velocity Distribution of\n       Common Stars.\n\n    This coordinate frame is axis-aligned and co-spatial with `ICRS`, but has\n    a velocity offset relative to the solar system barycenter to remove the\n    peculiar motion of the sun relative to the LSRD.\n    \"\"\"\n\n\n# NOTE: To avoid a performance penalty at import time, we hard-code the ICRS\n# offsets here. The code to generate the offsets is provided for reproducibility.\n# V_BARY_DELHAYE1965 = r.CartesianDifferential([9, 12, 7] * u.km/u.s)\n# V_OFFSET_LSRD = (Galactic(V_BARY_DELHAYE1965.to_cartesian()).transform_to(ICRS()).data\n#                  .represent_as(r.CartesianDifferential))\n\nV_OFFSET_LSRD = r.CartesianDifferential([-0.6382306360182073,\n                                         -14.585424483191094,\n                                         7.8011572411006815]*u.km/u.s)\n\nICRS_LSRD_OFFSET = r.CartesianRepresentation([0, 0, 0]*u.au, differentials=V_OFFSET_LSRD)\nLSRD_ICRS_OFFSET = r.CartesianRepresentation([0, 0, 0]*u.au, differentials=-V_OFFSET_LSRD)\n\n\n@frame_transform_graph.transform(AffineTransform, ICRS, LSRD)\ndef icrs_to_lsrd(icrs_coord, lsr_frame):\n    return None, ICRS_LSRD_OFFSET\n\n\n@frame_transform_graph.transform(AffineTransform, LSRD, ICRS)\ndef lsrd_to_icrs(lsr_coord, icrs_frame):\n    return None, LSRD_ICRS_OFFSET\n\n\n# ------------------------------------------------------------------------------\n\n# Create loopback transformations\nframe_transform_graph._add_merged_transform(LSR, ICRS, LSR)\nframe_transform_graph._add_merged_transform(GalacticLSR, Galactic, GalacticLSR)\n"},{"col":4,"comment":"null","endLoc":46,"header":"def __init__(self, mapping)","id":15650,"name":"__init__","nodeType":"Function","startLoc":44,"text":"def __init__(self, mapping):\n        super().__init__(mapping)\n        self._mappingproxy = MappingProxyType(self._mapping)  # read-only"},{"col":4,"comment":"Read-only ``getitem``.","endLoc":50,"header":"def __getitem__(self, key)","id":15651,"name":"__getitem__","nodeType":"Function","startLoc":48,"text":"def __getitem__(self, key):\n        \"\"\"Read-only ``getitem``.\"\"\"\n        return self._mappingproxy[key]"},{"col":4,"comment":"null","endLoc":53,"header":"def __deepcopy__(self, memo)","id":15652,"name":"__deepcopy__","nodeType":"Function","startLoc":52,"text":"def __deepcopy__(self, memo):\n        return copy.deepcopy(self._mapping, memo=memo)"},{"attributeType":"null","col":8,"comment":"null","endLoc":46,"id":15653,"name":"_mappingproxy","nodeType":"Attribute","startLoc":46,"text":"self._mappingproxy"},{"className":"galactocentric_frame_defaults","col":0,"comment":"This class controls the global setting of default values for the frame\n    attributes in the `~astropy.coordinates.Galactocentric` frame, which may be\n    updated in future versions of ``astropy``. Note that when using\n    `~astropy.coordinates.Galactocentric`, changing values here will not affect\n    any attributes that are set explicitly by passing values in to the\n    `~astropy.coordinates.Galactocentric` initializer. Modifying these defaults\n    will only affect the frame attribute values when using the frame as, e.g.,\n    ``Galactocentric`` or ``Galactocentric()`` with no explicit arguments.\n\n    This class controls the parameter settings by specifying a string name,\n    with the following pre-specified options:\n\n    - 'pre-v4.0': The current default value, which sets the default frame\n      attribute values to their original (pre-astropy-v4.0) values.\n    - 'v4.0': The attribute values as updated in Astropy version 4.0.\n    - 'latest': An alias of the most recent parameter set (currently: 'v4.0')\n\n    Alternatively, user-defined parameter settings may be registered, with\n    :meth:`~astropy.coordinates.galactocentric_frame_defaults.register`,\n    and used identically as pre-specified parameter sets. At minimum,\n    registrations must have unique names and a dictionary of parameters\n    with keys \"galcen_coord\", \"galcen_distance\", \"galcen_v_sun\", \"z_sun\",\n    \"roll\". See examples below.\n\n    This class also tracks the references for all parameter values in the\n    attribute ``references``, as well as any further information the registry.\n    The pre-specified options can be extended to include similar\n    state information as user-defined parameter settings -- for example, to add\n    parameter uncertainties.\n\n    The preferred method for getting a parameter set and metadata, by name, is\n    :meth:`~galactocentric_frame_defaults.get_from_registry` since\n    it ensures the immutability of the registry.\n\n    See :ref:`astropy:astropy-coordinates-galactocentric-defaults` for more\n    information.\n\n    Examples\n    --------\n    The default `~astropy.coordinates.Galactocentric` frame parameters can be\n    modified globally::\n\n        >>> from astropy.coordinates import galactocentric_frame_defaults\n        >>> _ = galactocentric_frame_defaults.set('v4.0') # doctest: +SKIP\n        >>> Galactocentric() # doctest: +SKIP\n        <Galactocentric Frame (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            (266.4051, -28.936175)>, galcen_distance=8.122 kpc, galcen_v_sun=(12.9, 245.6, 7.78) km / s, z_sun=20.8 pc, roll=0.0 deg)>\n        >>> _ = galactocentric_frame_defaults.set('pre-v4.0') # doctest: +SKIP\n        >>> Galactocentric() # doctest: +SKIP\n        <Galactocentric Frame (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            (266.4051, -28.936175)>, galcen_distance=8.3 kpc, galcen_v_sun=(11.1, 232.24, 7.25) km / s, z_sun=27.0 pc, roll=0.0 deg)>\n\n    The default parameters can also be updated by using this class as a context\n    manager::\n\n        >>> with galactocentric_frame_defaults.set('pre-v4.0'):\n        ...     print(Galactocentric()) # doctest: +FLOAT_CMP\n        <Galactocentric Frame (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            (266.4051, -28.936175)>, galcen_distance=8.3 kpc, galcen_v_sun=(11.1, 232.24, 7.25) km / s, z_sun=27.0 pc, roll=0.0 deg)>\n\n    Again, changing the default parameter values will not affect frame\n    attributes that are explicitly specified::\n\n        >>> import astropy.units as u\n        >>> with galactocentric_frame_defaults.set('pre-v4.0'):\n        ...     print(Galactocentric(galcen_distance=8.0*u.kpc)) # doctest: +FLOAT_CMP\n        <Galactocentric Frame (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            (266.4051, -28.936175)>, galcen_distance=8.0 kpc, galcen_v_sun=(11.1, 232.24, 7.25) km / s, z_sun=27.0 pc, roll=0.0 deg)>\n\n    Additional parameter sets may be registered, for instance to use the\n    Dehnen & Binney (1998) measurements of the solar motion. We can also\n    add metadata, such as the 1-sigma errors. In this example we will modify\n    the required key \"parameters\", change the recommended key \"references\" to\n    match \"parameters\", and add the extra key \"error\" (any key can be added)::\n\n        >>> state = galactocentric_frame_defaults.get_from_registry(\"v4.0\")\n        >>> state[\"parameters\"][\"galcen_v_sun\"] = (10.00, 225.25, 7.17) * (u.km / u.s)\n        >>> state[\"references\"][\"galcen_v_sun\"] = \"https://ui.adsabs.harvard.edu/full/1998MNRAS.298..387D\"\n        >>> state[\"error\"] = {\"galcen_v_sun\": (0.36, 0.62, 0.38) * (u.km / u.s)}\n        >>> galactocentric_frame_defaults.register(name=\"DB1998\", **state)\n\n    Just as in the previous examples, the new parameter set can be retrieved with::\n\n        >>> state = galactocentric_frame_defaults.get_from_registry(\"DB1998\")\n        >>> print(state[\"error\"][\"galcen_v_sun\"])  # doctest: +FLOAT_CMP\n        [0.36 0.62 0.38] km / s\n\n    ","endLoc":338,"id":15654,"nodeType":"Class","startLoc":56,"text":"class galactocentric_frame_defaults(ScienceState):\n    \"\"\"This class controls the global setting of default values for the frame\n    attributes in the `~astropy.coordinates.Galactocentric` frame, which may be\n    updated in future versions of ``astropy``. Note that when using\n    `~astropy.coordinates.Galactocentric`, changing values here will not affect\n    any attributes that are set explicitly by passing values in to the\n    `~astropy.coordinates.Galactocentric` initializer. Modifying these defaults\n    will only affect the frame attribute values when using the frame as, e.g.,\n    ``Galactocentric`` or ``Galactocentric()`` with no explicit arguments.\n\n    This class controls the parameter settings by specifying a string name,\n    with the following pre-specified options:\n\n    - 'pre-v4.0': The current default value, which sets the default frame\n      attribute values to their original (pre-astropy-v4.0) values.\n    - 'v4.0': The attribute values as updated in Astropy version 4.0.\n    - 'latest': An alias of the most recent parameter set (currently: 'v4.0')\n\n    Alternatively, user-defined parameter settings may be registered, with\n    :meth:`~astropy.coordinates.galactocentric_frame_defaults.register`,\n    and used identically as pre-specified parameter sets. At minimum,\n    registrations must have unique names and a dictionary of parameters\n    with keys \"galcen_coord\", \"galcen_distance\", \"galcen_v_sun\", \"z_sun\",\n    \"roll\". See examples below.\n\n    This class also tracks the references for all parameter values in the\n    attribute ``references``, as well as any further information the registry.\n    The pre-specified options can be extended to include similar\n    state information as user-defined parameter settings -- for example, to add\n    parameter uncertainties.\n\n    The preferred method for getting a parameter set and metadata, by name, is\n    :meth:`~galactocentric_frame_defaults.get_from_registry` since\n    it ensures the immutability of the registry.\n\n    See :ref:`astropy:astropy-coordinates-galactocentric-defaults` for more\n    information.\n\n    Examples\n    --------\n    The default `~astropy.coordinates.Galactocentric` frame parameters can be\n    modified globally::\n\n        >>> from astropy.coordinates import galactocentric_frame_defaults\n        >>> _ = galactocentric_frame_defaults.set('v4.0') # doctest: +SKIP\n        >>> Galactocentric() # doctest: +SKIP\n        <Galactocentric Frame (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            (266.4051, -28.936175)>, galcen_distance=8.122 kpc, galcen_v_sun=(12.9, 245.6, 7.78) km / s, z_sun=20.8 pc, roll=0.0 deg)>\n        >>> _ = galactocentric_frame_defaults.set('pre-v4.0') # doctest: +SKIP\n        >>> Galactocentric() # doctest: +SKIP\n        <Galactocentric Frame (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            (266.4051, -28.936175)>, galcen_distance=8.3 kpc, galcen_v_sun=(11.1, 232.24, 7.25) km / s, z_sun=27.0 pc, roll=0.0 deg)>\n\n    The default parameters can also be updated by using this class as a context\n    manager::\n\n        >>> with galactocentric_frame_defaults.set('pre-v4.0'):\n        ...     print(Galactocentric()) # doctest: +FLOAT_CMP\n        <Galactocentric Frame (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            (266.4051, -28.936175)>, galcen_distance=8.3 kpc, galcen_v_sun=(11.1, 232.24, 7.25) km / s, z_sun=27.0 pc, roll=0.0 deg)>\n\n    Again, changing the default parameter values will not affect frame\n    attributes that are explicitly specified::\n\n        >>> import astropy.units as u\n        >>> with galactocentric_frame_defaults.set('pre-v4.0'):\n        ...     print(Galactocentric(galcen_distance=8.0*u.kpc)) # doctest: +FLOAT_CMP\n        <Galactocentric Frame (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            (266.4051, -28.936175)>, galcen_distance=8.0 kpc, galcen_v_sun=(11.1, 232.24, 7.25) km / s, z_sun=27.0 pc, roll=0.0 deg)>\n\n    Additional parameter sets may be registered, for instance to use the\n    Dehnen & Binney (1998) measurements of the solar motion. We can also\n    add metadata, such as the 1-sigma errors. In this example we will modify\n    the required key \"parameters\", change the recommended key \"references\" to\n    match \"parameters\", and add the extra key \"error\" (any key can be added)::\n\n        >>> state = galactocentric_frame_defaults.get_from_registry(\"v4.0\")\n        >>> state[\"parameters\"][\"galcen_v_sun\"] = (10.00, 225.25, 7.17) * (u.km / u.s)\n        >>> state[\"references\"][\"galcen_v_sun\"] = \"https://ui.adsabs.harvard.edu/full/1998MNRAS.298..387D\"\n        >>> state[\"error\"] = {\"galcen_v_sun\": (0.36, 0.62, 0.38) * (u.km / u.s)}\n        >>> galactocentric_frame_defaults.register(name=\"DB1998\", **state)\n\n    Just as in the previous examples, the new parameter set can be retrieved with::\n\n        >>> state = galactocentric_frame_defaults.get_from_registry(\"DB1998\")\n        >>> print(state[\"error\"][\"galcen_v_sun\"])  # doctest: +FLOAT_CMP\n        [0.36 0.62 0.38] km / s\n\n    \"\"\"\n\n    _latest_value = 'v4.0'\n    _value = None\n    _references = None\n    _state = dict()  # all other data\n\n    # Note: _StateProxy() produces read-only view of enclosed mapping.\n    _registry = {\n        \"v4.0\": {\n            \"parameters\": _StateProxy(\n                {\n                    \"galcen_coord\": ICRS(\n                        ra=266.4051 * u.degree, dec=-28.936175 * u.degree\n                    ),\n                    \"galcen_distance\": 8.122 * u.kpc,\n                    \"galcen_v_sun\": r.CartesianDifferential(\n                        [12.9, 245.6, 7.78] * (u.km / u.s)\n                    ),\n                    \"z_sun\": 20.8 * u.pc,\n                    \"roll\": 0 * u.deg,\n                }\n            ),\n            \"references\": _StateProxy(\n                {\n                    \"galcen_coord\": \"https://ui.adsabs.harvard.edu/abs/2004ApJ...616..872R\",\n                    \"galcen_distance\": \"https://ui.adsabs.harvard.edu/abs/2018A%26A...615L..15G\",\n                    \"galcen_v_sun\": [\n                        \"https://ui.adsabs.harvard.edu/abs/2018RNAAS...2..210D\",\n                        \"https://ui.adsabs.harvard.edu/abs/2018A%26A...615L..15G\",\n                        \"https://ui.adsabs.harvard.edu/abs/2004ApJ...616..872R\",\n                    ],\n                    \"z_sun\": \"https://ui.adsabs.harvard.edu/abs/2019MNRAS.482.1417B\",\n                    \"roll\": None,\n                }\n            ),\n        },\n        \"pre-v4.0\": {\n            \"parameters\": _StateProxy(\n                {\n                    \"galcen_coord\": ICRS(\n                        ra=266.4051 * u.degree, dec=-28.936175 * u.degree\n                    ),\n                    \"galcen_distance\": 8.3 * u.kpc,\n                    \"galcen_v_sun\": r.CartesianDifferential(\n                        [11.1, 220 + 12.24, 7.25] * (u.km / u.s)\n                    ),\n                    \"z_sun\": 27.0 * u.pc,\n                    \"roll\": 0 * u.deg,\n                }\n            ),\n            \"references\": _StateProxy(\n                {\n                    \"galcen_coord\": \"https://ui.adsabs.harvard.edu/abs/2004ApJ...616..872R\",\n                    \"galcen_distance\": \"https://ui.adsabs.harvard.edu/#abs/2009ApJ...692.1075G\",\n                    \"galcen_v_sun\": [\n                        \"https://ui.adsabs.harvard.edu/#abs/2010MNRAS.403.1829S\",\n                        \"https://ui.adsabs.harvard.edu/#abs/2015ApJS..216...29B\",\n                    ],\n                    \"z_sun\": \"https://ui.adsabs.harvard.edu/#abs/2001ApJ...553..184C\",\n                    \"roll\": None,\n                }\n            ),\n        },\n    }\n\n    @classproperty  # read-only\n    def parameters(cls):\n        return cls._value\n\n    @classproperty  # read-only\n    def references(cls):\n        return cls._references\n\n    @classmethod\n    def get_from_registry(cls, name: str):\n        \"\"\"\n        Return Galactocentric solar parameters and metadata given string names\n        for the parameter sets. This method ensures the returned state is a\n        mutable copy, so any changes made do not affect the registry state.\n\n        Returns\n        -------\n        state : dict\n            Copy of the registry for the string name.\n            Should contain, at minimum:\n\n            - \"parameters\": dict\n                Galactocentric solar parameters\n            - \"references\" : Dict[str, Union[str, Sequence[str]]]\n                References for \"parameters\".\n                Fields are str or sequence of str.\n\n        Raises\n        ------\n        KeyError\n            If invalid string input to registry\n            to retrieve solar parameters for Galactocentric frame.\n\n        \"\"\"\n        # Resolve the meaning of 'latest': latest parameter set is from v4.0\n        # - update this as newer parameter choices are added\n        if name == 'latest':\n            name = cls._latest_value\n\n        # Get the state from the registry.\n        # Copy to ensure registry is immutable to modifications of \"_value\".\n        # Raises KeyError if `name` is invalid string input to registry\n        # to retrieve solar parameters for Galactocentric frame.\n        state = copy.deepcopy(cls._registry[name])  # ensure mutable\n\n        return state\n\n    @deprecated(\"v4.2\", alternative=\"`get_from_registry`\")\n    @classmethod\n    def get_solar_params_from_string(cls, arg):\n        \"\"\"\n        Return Galactocentric solar parameters given string names\n        for the parameter sets.\n\n        Returns\n        -------\n        parameters : dict\n            Copy of Galactocentric solar parameters from registry\n\n        Raises\n        ------\n        KeyError\n            If invalid string input to registry\n            to retrieve solar parameters for Galactocentric frame.\n\n        \"\"\"\n        return cls.get_from_registry(arg)[\"parameters\"]\n\n    @classmethod\n    def validate(cls, value):\n        if value is None:\n            value = cls._latest_value\n\n        if isinstance(value, str):\n            state = cls.get_from_registry(value)\n            cls._references = state[\"references\"]\n            cls._state = state\n            parameters = state[\"parameters\"]\n\n        elif isinstance(value, dict):\n            parameters = value\n\n        elif isinstance(value, Galactocentric):\n            # turn the frame instance into a dict of frame attributes\n            parameters = dict()\n            for k in value.frame_attributes:\n                parameters[k] = getattr(value, k)\n            cls._references = value.frame_attribute_references.copy()\n            cls._state = dict(parameters=parameters,\n                              references=cls._references)\n\n        else:\n            raise ValueError(\"Invalid input to retrieve solar parameters for \"\n                             \"Galactocentric frame: input must be a string, \"\n                             \"dict, or Galactocentric instance\")\n\n        return parameters\n\n    @classmethod\n    def register(cls, name: str, parameters: dict, references=None,\n                 **meta: dict):\n        \"\"\"Register a set of parameters.\n\n        Parameters\n        ----------\n        name : str\n            The registration name for the parameter and metadata set.\n        parameters : dict\n            The solar parameters for Galactocentric frame.\n        references : dict or None, optional\n            References for contents of `parameters`.\n            None becomes empty dict.\n        **meta : dict, optional\n            Any other properties to register.\n\n        \"\"\"\n        # check on contents of `parameters`\n        must_have = {\"galcen_coord\", \"galcen_distance\", \"galcen_v_sun\",\n                     \"z_sun\", \"roll\"}\n        missing = must_have.difference(parameters)\n        if missing:\n            raise ValueError(f\"Missing parameters: {missing}\")\n\n        references = references or {}  # None -> {}\n\n        state = dict(parameters=parameters, references=references)\n        state.update(meta)  # meta never has keys \"parameters\" or \"references\"\n\n        cls._registry[name] = state"},{"col":4,"comment":"null","endLoc":212,"header":"@classproperty  # read-only\n    def parameters(cls)","id":15655,"name":"parameters","nodeType":"Function","startLoc":210,"text":"@classproperty  # read-only\n    def parameters(cls):\n        return cls._value"},{"col":4,"comment":"null","endLoc":216,"header":"@classproperty  # read-only\n    def references(cls)","id":15656,"name":"references","nodeType":"Function","startLoc":214,"text":"@classproperty  # read-only\n    def references(cls):\n        return cls._references"},{"col":4,"comment":"\n        Return Galactocentric solar parameters and metadata given string names\n        for the parameter sets. This method ensures the returned state is a\n        mutable copy, so any changes made do not affect the registry state.\n\n        Returns\n        -------\n        state : dict\n            Copy of the registry for the string name.\n            Should contain, at minimum:\n\n            - \"parameters\": dict\n                Galactocentric solar parameters\n            - \"references\" : Dict[str, Union[str, Sequence[str]]]\n                References for \"parameters\".\n                Fields are str or sequence of str.\n\n        Raises\n        ------\n        KeyError\n            If invalid string input to registry\n            to retrieve solar parameters for Galactocentric frame.\n\n        ","endLoc":255,"header":"@classmethod\n    def get_from_registry(cls, name: str)","id":15657,"name":"get_from_registry","nodeType":"Function","startLoc":218,"text":"@classmethod\n    def get_from_registry(cls, name: str):\n        \"\"\"\n        Return Galactocentric solar parameters and metadata given string names\n        for the parameter sets. This method ensures the returned state is a\n        mutable copy, so any changes made do not affect the registry state.\n\n        Returns\n        -------\n        state : dict\n            Copy of the registry for the string name.\n            Should contain, at minimum:\n\n            - \"parameters\": dict\n                Galactocentric solar parameters\n            - \"references\" : Dict[str, Union[str, Sequence[str]]]\n                References for \"parameters\".\n                Fields are str or sequence of str.\n\n        Raises\n        ------\n        KeyError\n            If invalid string input to registry\n            to retrieve solar parameters for Galactocentric frame.\n\n        \"\"\"\n        # Resolve the meaning of 'latest': latest parameter set is from v4.0\n        # - update this as newer parameter choices are added\n        if name == 'latest':\n            name = cls._latest_value\n\n        # Get the state from the registry.\n        # Copy to ensure registry is immutable to modifications of \"_value\".\n        # Raises KeyError if `name` is invalid string input to registry\n        # to retrieve solar parameters for Galactocentric frame.\n        state = copy.deepcopy(cls._registry[name])  # ensure mutable\n\n        return state"},{"className":"LSR","col":0,"comment":"A coordinate or frame in the Local Standard of Rest (LSR).\n\n    This coordinate frame is axis-aligned and co-spatial with `ICRS`, but has\n    a velocity offset relative to the solar system barycenter to remove the\n    peculiar motion of the sun relative to the LSR. Roughly, the LSR is the mean\n    velocity of the stars in the solar neighborhood, but the precise definition\n    of which depends on the study. As defined in Schönrich et al. (2010):\n    \"The LSR is the rest frame at the location of the Sun of a star that would\n    be on a circular orbit in the gravitational potential one would obtain by\n    azimuthally averaging away non-axisymmetric features in the actual Galactic\n    potential.\" No such orbit truly exists, but it is still a commonly used\n    velocity frame.\n\n    We use default values from Schönrich et al. (2010) for the barycentric\n    velocity relative to the LSR, which is defined in Galactic (right-handed)\n    cartesian velocity components\n    :math:`(U, V, W) = (11.1, 12.24, 7.25)~{{\\rm km}}~{{\\rm s}}^{{-1}}`. These\n    values are customizable via the ``v_bary`` argument which specifies the\n    velocity of the solar system barycenter with respect to the LSR.\n\n    The frame attributes are listed under **Other Parameters**.\n    ","endLoc":63,"id":15658,"nodeType":"Class","startLoc":36,"text":"@format_doc(base_doc, components=doc_components_radec, footer=doc_footer_lsr)\nclass LSR(BaseRADecFrame):\n    r\"\"\"A coordinate or frame in the Local Standard of Rest (LSR).\n\n    This coordinate frame is axis-aligned and co-spatial with `ICRS`, but has\n    a velocity offset relative to the solar system barycenter to remove the\n    peculiar motion of the sun relative to the LSR. Roughly, the LSR is the mean\n    velocity of the stars in the solar neighborhood, but the precise definition\n    of which depends on the study. As defined in Schönrich et al. (2010):\n    \"The LSR is the rest frame at the location of the Sun of a star that would\n    be on a circular orbit in the gravitational potential one would obtain by\n    azimuthally averaging away non-axisymmetric features in the actual Galactic\n    potential.\" No such orbit truly exists, but it is still a commonly used\n    velocity frame.\n\n    We use default values from Schönrich et al. (2010) for the barycentric\n    velocity relative to the LSR, which is defined in Galactic (right-handed)\n    cartesian velocity components\n    :math:`(U, V, W) = (11.1, 12.24, 7.25)~{{\\rm km}}~{{\\rm s}}^{{-1}}`. These\n    values are customizable via the ``v_bary`` argument which specifies the\n    velocity of the solar system barycenter with respect to the LSR.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    # frame attributes:\n    v_bary = DifferentialAttribute(default=v_bary_Schoenrich2010,\n                                   allowed_classes=[r.CartesianDifferential])"},{"col":4,"comment":"\n        Return Galactocentric solar parameters given string names\n        for the parameter sets.\n\n        Returns\n        -------\n        parameters : dict\n            Copy of Galactocentric solar parameters from registry\n\n        Raises\n        ------\n        KeyError\n            If invalid string input to registry\n            to retrieve solar parameters for Galactocentric frame.\n\n        ","endLoc":276,"header":"@deprecated(\"v4.2\", alternative=\"`get_from_registry`\")\n    @classmethod\n    def get_solar_params_from_string(cls, arg)","id":15659,"name":"get_solar_params_from_string","nodeType":"Function","startLoc":257,"text":"@deprecated(\"v4.2\", alternative=\"`get_from_registry`\")\n    @classmethod\n    def get_solar_params_from_string(cls, arg):\n        \"\"\"\n        Return Galactocentric solar parameters given string names\n        for the parameter sets.\n\n        Returns\n        -------\n        parameters : dict\n            Copy of Galactocentric solar parameters from registry\n\n        Raises\n        ------\n        KeyError\n            If invalid string input to registry\n            to retrieve solar parameters for Galactocentric frame.\n\n        \"\"\"\n        return cls.get_from_registry(arg)[\"parameters\"]"},{"attributeType":"DifferentialAttribute","col":4,"comment":"null","endLoc":62,"id":15660,"name":"v_bary","nodeType":"Attribute","startLoc":62,"text":"v_bary"},{"col":0,"comment":"null","endLoc":127,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ICRS, GCRS)\ndef icrs_to_gcrs(icrs_coo, gcrs_frame)","id":15661,"name":"icrs_to_gcrs","nodeType":"Function","startLoc":98,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ICRS, GCRS)\ndef icrs_to_gcrs(icrs_coo, gcrs_frame):\n    # first set up the astrometry context for ICRS<->GCRS.\n    astrom = erfa_astrom.get().apcs(gcrs_frame)\n\n    if icrs_coo.data.get_name() == 'unitspherical' or icrs_coo.data.to_cartesian().x.unit == u.one:\n        # if no distance, just do the infinite-distance/no parallax calculation\n        srepr = icrs_coo.represent_as(SphericalRepresentation)\n        gcrs_ra, gcrs_dec = atciqz(srepr.without_differentials(), astrom)\n\n        newrep = UnitSphericalRepresentation(lat=u.Quantity(gcrs_dec, u.radian, copy=False),\n                                             lon=u.Quantity(gcrs_ra, u.radian, copy=False),\n                                             copy=False)\n    else:\n        # When there is a distance,  we first offset for parallax to get the\n        # BCRS coordinate direction and *then* run the ERFA transform for no\n        # parallax/PM. This ensures reversibility and is more sensible for\n        # inside solar system objects\n        astrom_eb = CartesianRepresentation(astrom['eb'], unit=u.au,\n                                            xyz_axis=-1, copy=False)\n        newcart = icrs_coo.cartesian - astrom_eb\n\n        srepr = newcart.represent_as(SphericalRepresentation)\n        gcrs_ra, gcrs_dec = atciqz(srepr.without_differentials(), astrom)\n\n        newrep = SphericalRepresentation(lat=u.Quantity(gcrs_dec, u.radian, copy=False),\n                                         lon=u.Quantity(gcrs_ra, u.radian, copy=False),\n                                         distance=srepr.distance, copy=False)\n\n    return gcrs_frame.realize_frame(newrep)"},{"col":0,"comment":"\n    Accuracy tests for the ICRS (with no E-terms of aberration) to/from FK5\n    conversion, with arbitrary equinoxes and epoch of observation.\n    ","endLoc":188,"header":"def ref_galactic_fk4(fnout='galactic_fk4.csv')","id":15662,"name":"ref_galactic_fk4","nodeType":"Function","startLoc":132,"text":"def ref_galactic_fk4(fnout='galactic_fk4.csv'):\n    \"\"\"\n    Accuracy tests for the ICRS (with no E-terms of aberration) to/from FK5\n    conversion, with arbitrary equinoxes and epoch of observation.\n    \"\"\"\n\n    import starlink.Ast as Ast\n\n    np.random.seed(12345)\n\n    N = 200\n\n    # Sample uniformly on the unit sphere. These will be either the ICRS\n    # coordinates for the transformation to FK5, or the FK5 coordinates for the\n    # transformation to ICRS.\n    lon = np.random.uniform(0., 360., N)\n    lat = np.degrees(np.arcsin(np.random.uniform(-1., 1., N)))\n\n    # Generate random observation epoch and equinoxes\n    obstime = [f\"B{x:7.2f}\" for x in np.random.uniform(1950., 2000., N)]\n    equinox_fk4 = [f\"J{x:7.2f}\" for x in np.random.uniform(1975., 2025., N)]\n\n    lon_gal, lat_gal = [], []\n    ra_fk4, dec_fk4 = [], []\n\n    for i in range(N):\n\n        # Set up frames for AST\n        frame_gal = Ast.SkyFrame(f'System=Galactic,Epoch={obstime[i]}')\n        frame_fk4 = Ast.SkyFrame(f'System=FK4,Epoch={obstime[i]},Equinox={equinox_fk4[i]}')\n\n        # ICRS to FK5\n        frameset = frame_gal.convert(frame_fk4)\n        coords = np.degrees(frameset.tran([[np.radians(lon[i])], [np.radians(lat[i])]]))\n        ra_fk4.append(coords[0, 0])\n        dec_fk4.append(coords[1, 0])\n\n        # FK5 to ICRS\n        frameset = frame_fk4.convert(frame_gal)\n        coords = np.degrees(frameset.tran([[np.radians(lon[i])], [np.radians(lat[i])]]))\n        lon_gal.append(coords[0, 0])\n        lat_gal.append(coords[1, 0])\n\n    # Write out table to a CSV file\n    t = Table()\n    t.add_column(Column(name='equinox_fk4', data=equinox_fk4))\n    t.add_column(Column(name='obstime', data=obstime))\n    t.add_column(Column(name='lon_in', data=lon))\n    t.add_column(Column(name='lat_in', data=lat))\n    t.add_column(Column(name='ra_fk4', data=ra_fk4))\n    t.add_column(Column(name='dec_fk4', data=dec_fk4))\n    t.add_column(Column(name='lon_gal', data=lon_gal))\n    t.add_column(Column(name='lat_gal', data=lat_gal))\n    f = open(os.path.join('data', fnout), 'wb')\n    f.write(\"# This file was generated with the {} script, and the reference \"\n            \"values were computed using AST\\n\".format(os.path.basename(__file__)))\n    t.write(f, format='ascii', delimiter=',')"},{"col":4,"comment":"null","endLoc":306,"header":"@classmethod\n    def validate(cls, value)","id":15663,"name":"validate","nodeType":"Function","startLoc":278,"text":"@classmethod\n    def validate(cls, value):\n        if value is None:\n            value = cls._latest_value\n\n        if isinstance(value, str):\n            state = cls.get_from_registry(value)\n            cls._references = state[\"references\"]\n            cls._state = state\n            parameters = state[\"parameters\"]\n\n        elif isinstance(value, dict):\n            parameters = value\n\n        elif isinstance(value, Galactocentric):\n            # turn the frame instance into a dict of frame attributes\n            parameters = dict()\n            for k in value.frame_attributes:\n                parameters[k] = getattr(value, k)\n            cls._references = value.frame_attribute_references.copy()\n            cls._state = dict(parameters=parameters,\n                              references=cls._references)\n\n        else:\n            raise ValueError(\"Invalid input to retrieve solar parameters for \"\n                             \"Galactocentric frame: input must be a string, \"\n                             \"dict, or Galactocentric instance\")\n\n        return parameters"},{"className":"GalacticLSR","col":0,"comment":"A coordinate or frame in the Local Standard of Rest (LSR), axis-aligned\n    to the `Galactic` frame.\n\n    This coordinate frame is axis-aligned and co-spatial with `ICRS`, but has\n    a velocity offset relative to the solar system barycenter to remove the\n    peculiar motion of the sun relative to the LSR. Roughly, the LSR is the mean\n    velocity of the stars in the solar neighborhood, but the precise definition\n    of which depends on the study. As defined in Schönrich et al. (2010):\n    \"The LSR is the rest frame at the location of the Sun of a star that would\n    be on a circular orbit in the gravitational potential one would obtain by\n    azimuthally averaging away non-axisymmetric features in the actual Galactic\n    potential.\" No such orbit truly exists, but it is still a commonly used\n    velocity frame.\n\n    We use default values from Schönrich et al. (2010) for the barycentric\n    velocity relative to the LSR, which is defined in Galactic (right-handed)\n    cartesian velocity components\n    :math:`(U, V, W) = (11.1, 12.24, 7.25)~{{\\rm km}}~{{\\rm s}}^{{-1}}`. These\n    values are customizable via the ``v_bary`` argument which specifies the\n    velocity of the solar system barycenter with respect to the LSR.\n\n    The frame attributes are listed under **Other Parameters**.\n    ","endLoc":146,"id":15664,"nodeType":"Class","startLoc":109,"text":"@format_doc(base_doc, components=doc_components_gal, footer=doc_footer_lsr)\nclass GalacticLSR(BaseCoordinateFrame):\n    r\"\"\"A coordinate or frame in the Local Standard of Rest (LSR), axis-aligned\n    to the `Galactic` frame.\n\n    This coordinate frame is axis-aligned and co-spatial with `ICRS`, but has\n    a velocity offset relative to the solar system barycenter to remove the\n    peculiar motion of the sun relative to the LSR. Roughly, the LSR is the mean\n    velocity of the stars in the solar neighborhood, but the precise definition\n    of which depends on the study. As defined in Schönrich et al. (2010):\n    \"The LSR is the rest frame at the location of the Sun of a star that would\n    be on a circular orbit in the gravitational potential one would obtain by\n    azimuthally averaging away non-axisymmetric features in the actual Galactic\n    potential.\" No such orbit truly exists, but it is still a commonly used\n    velocity frame.\n\n    We use default values from Schönrich et al. (2010) for the barycentric\n    velocity relative to the LSR, which is defined in Galactic (right-handed)\n    cartesian velocity components\n    :math:`(U, V, W) = (11.1, 12.24, 7.25)~{{\\rm km}}~{{\\rm s}}^{{-1}}`. These\n    values are customizable via the ``v_bary`` argument which specifies the\n    velocity of the solar system barycenter with respect to the LSR.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'l'),\n            RepresentationMapping('lat', 'b')\n        ]\n    }\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential\n\n    # frame attributes:\n    v_bary = DifferentialAttribute(default=v_bary_Schoenrich2010)"},{"attributeType":"null","col":4,"comment":"null","endLoc":135,"id":15665,"name":"frame_specific_representation_info","nodeType":"Attribute","startLoc":135,"text":"frame_specific_representation_info"},{"attributeType":"SphericalRepresentation","col":4,"comment":"null","endLoc":142,"id":15666,"name":"default_representation","nodeType":"Attribute","startLoc":142,"text":"default_representation"},{"attributeType":"SphericalCosLatDifferential","col":4,"comment":"null","endLoc":143,"id":15667,"name":"default_differential","nodeType":"Attribute","startLoc":143,"text":"default_differential"},{"attributeType":"DifferentialAttribute","col":4,"comment":"null","endLoc":146,"id":15668,"name":"v_bary","nodeType":"Attribute","startLoc":146,"text":"v_bary"},{"col":0,"comment":"null","endLoc":130,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, TETE)\ndef gcrs_to_tete(gcrs_coo, tete_frame)","id":15669,"name":"gcrs_to_tete","nodeType":"Function","startLoc":115,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, TETE)\ndef gcrs_to_tete(gcrs_coo, tete_frame):\n    # Classical NPB matrix, IAU 2006/2000A\n    # (same as in builtin_frames.utils.get_cip).\n    rbpn = erfa.pnm06a(*get_jd12(tete_frame.obstime, 'tt'))\n    # Get GCRS coordinates for the target observer location and time.\n    loc_gcrs = get_location_gcrs(tete_frame.location, tete_frame.obstime,\n                                 tete_to_itrs_mat(tete_frame.obstime, rbpn=rbpn),\n                                 rbpn)\n    gcrs_coo2 = gcrs_coo.transform_to(loc_gcrs)\n    # Now we are relative to the correct observer, do the transform to TETE.\n    # These rotations are defined at the geocenter, but can be applied to\n    # topocentric positions as well, assuming rigid Earth. See p57 of\n    # https://www.usno.navy.mil/USNO/astronomical-applications/publications/Circular_179.pdf\n    crepr = gcrs_coo2.cartesian.transform(rbpn)\n    return tete_frame.realize_frame(crepr)"},{"className":"LSRK","col":0,"comment":"\n    A coordinate or frame in the Kinematic Local Standard of Rest (LSR).\n\n    This frame is defined as having a velocity of 20 km/s towards RA=270 Dec=30\n    (B1900) relative to the solar system Barycenter. This is defined in:\n\n        Gordon 1975, Methods of Experimental Physics: Volume 12:\n        Astrophysics, Part C: Radio Observations - Section 6.1.5.\n\n    This coordinate frame is axis-aligned and co-spatial with `ICRS`, but has\n    a velocity offset relative to the solar system barycenter to remove the\n    peculiar motion of the sun relative to the LSRK.\n    ","endLoc":188,"id":15670,"nodeType":"Class","startLoc":175,"text":"class LSRK(BaseRADecFrame):\n    r\"\"\"\n    A coordinate or frame in the Kinematic Local Standard of Rest (LSR).\n\n    This frame is defined as having a velocity of 20 km/s towards RA=270 Dec=30\n    (B1900) relative to the solar system Barycenter. This is defined in:\n\n        Gordon 1975, Methods of Experimental Physics: Volume 12:\n        Astrophysics, Part C: Radio Observations - Section 6.1.5.\n\n    This coordinate frame is axis-aligned and co-spatial with `ICRS`, but has\n    a velocity offset relative to the solar system barycenter to remove the\n    peculiar motion of the sun relative to the LSRK.\n    \"\"\""},{"className":"LSRD","col":0,"comment":"\n    A coordinate or frame in the Dynamical Local Standard of Rest (LSRD)\n\n    This frame is defined as a velocity of U=9 km/s, V=12 km/s,\n    and W=7 km/s in Galactic coordinates or 16.552945 km/s\n    towards l=53.13 b=25.02. This is defined in:\n\n       Delhaye 1965, Solar Motion and Velocity Distribution of\n       Common Stars.\n\n    This coordinate frame is axis-aligned and co-spatial with `ICRS`, but has\n    a velocity offset relative to the solar system barycenter to remove the\n    peculiar motion of the sun relative to the LSRD.\n    ","endLoc":240,"id":15671,"nodeType":"Class","startLoc":226,"text":"class LSRD(BaseRADecFrame):\n    r\"\"\"\n    A coordinate or frame in the Dynamical Local Standard of Rest (LSRD)\n\n    This frame is defined as a velocity of U=9 km/s, V=12 km/s,\n    and W=7 km/s in Galactic coordinates or 16.552945 km/s\n    towards l=53.13 b=25.02. This is defined in:\n\n       Delhaye 1965, Solar Motion and Velocity Distribution of\n       Common Stars.\n\n    This coordinate frame is axis-aligned and co-spatial with `ICRS`, but has\n    a velocity offset relative to the solar system barycenter to remove the\n    peculiar motion of the sun relative to the LSRD.\n    \"\"\""},{"col":0,"comment":"null","endLoc":72,"header":"@frame_transform_graph.transform(AffineTransform, ICRS, LSR)\ndef icrs_to_lsr(icrs_coord, lsr_frame)","id":15672,"name":"icrs_to_lsr","nodeType":"Function","startLoc":66,"text":"@frame_transform_graph.transform(AffineTransform, ICRS, LSR)\ndef icrs_to_lsr(icrs_coord, lsr_frame):\n    v_bary_gal = Galactic(lsr_frame.v_bary.to_cartesian())\n    v_bary_icrs = v_bary_gal.transform_to(icrs_coord)\n    v_offset = v_bary_icrs.data.represent_as(r.CartesianDifferential)\n    offset = r.CartesianRepresentation([0, 0, 0]*u.au, differentials=v_offset)\n    return None, offset"},{"col":4,"comment":"Register a set of parameters.\n\n        Parameters\n        ----------\n        name : str\n            The registration name for the parameter and metadata set.\n        parameters : dict\n            The solar parameters for Galactocentric frame.\n        references : dict or None, optional\n            References for contents of `parameters`.\n            None becomes empty dict.\n        **meta : dict, optional\n            Any other properties to register.\n\n        ","endLoc":338,"header":"@classmethod\n    def register(cls, name: str, parameters: dict, references=None,\n                 **meta: dict)","id":15673,"name":"register","nodeType":"Function","startLoc":308,"text":"@classmethod\n    def register(cls, name: str, parameters: dict, references=None,\n                 **meta: dict):\n        \"\"\"Register a set of parameters.\n\n        Parameters\n        ----------\n        name : str\n            The registration name for the parameter and metadata set.\n        parameters : dict\n            The solar parameters for Galactocentric frame.\n        references : dict or None, optional\n            References for contents of `parameters`.\n            None becomes empty dict.\n        **meta : dict, optional\n            Any other properties to register.\n\n        \"\"\"\n        # check on contents of `parameters`\n        must_have = {\"galcen_coord\", \"galcen_distance\", \"galcen_v_sun\",\n                     \"z_sun\", \"roll\"}\n        missing = must_have.difference(parameters)\n        if missing:\n            raise ValueError(f\"Missing parameters: {missing}\")\n\n        references = references or {}  # None -> {}\n\n        state = dict(parameters=parameters, references=references)\n        state.update(meta)  # meta never has keys \"parameters\" or \"references\"\n\n        cls._registry[name] = state"},{"attributeType":"null","col":4,"comment":"null","endLoc":146,"id":15674,"name":"_latest_value","nodeType":"Attribute","startLoc":146,"text":"_latest_value"},{"attributeType":"None","col":4,"comment":"null","endLoc":147,"id":15675,"name":"_value","nodeType":"Attribute","startLoc":147,"text":"_value"},{"col":0,"comment":"null","endLoc":145,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, TETE, GCRS)\ndef tete_to_gcrs(tete_coo, gcrs_frame)","id":15676,"name":"tete_to_gcrs","nodeType":"Function","startLoc":133,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, TETE, GCRS)\ndef tete_to_gcrs(tete_coo, gcrs_frame):\n    # Compute the pn matrix, and then multiply by its transpose.\n    rbpn = erfa.pnm06a(*get_jd12(tete_coo.obstime, 'tt'))\n    newrepr = tete_coo.cartesian.transform(matrix_transpose(rbpn))\n    # We now have a GCRS vector for the input location and obstime.\n    # Turn it into a GCRS frame instance.\n    loc_gcrs = get_location_gcrs(tete_coo.location, tete_coo.obstime,\n                                 tete_to_itrs_mat(tete_coo.obstime, rbpn=rbpn),\n                                 rbpn)\n    gcrs = loc_gcrs.realize_frame(newrepr)\n    # Finally, do any needed offsets (no-op if same obstime and location)\n    return gcrs.transform_to(gcrs_frame)"},{"attributeType":"None","col":4,"comment":"null","endLoc":148,"id":15677,"name":"_references","nodeType":"Attribute","startLoc":148,"text":"_references"},{"attributeType":"null","col":4,"comment":"null","endLoc":149,"id":15678,"name":"_state","nodeType":"Attribute","startLoc":149,"text":"_state"},{"attributeType":"null","col":4,"comment":"null","endLoc":152,"id":15679,"name":"_registry","nodeType":"Attribute","startLoc":152,"text":"_registry"},{"attributeType":"null","col":12,"comment":"null","endLoc":286,"id":15680,"name":"_state","nodeType":"Attribute","startLoc":286,"text":"cls._state"},{"attributeType":"null","col":12,"comment":"null","endLoc":285,"id":15681,"name":"_references","nodeType":"Attribute","startLoc":285,"text":"cls._references"},{"col":0,"comment":"null","endLoc":157,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, TETE, ITRS)\ndef tete_to_itrs(tete_coo, itrs_frame)","id":15682,"name":"tete_to_itrs","nodeType":"Function","startLoc":148,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, TETE, ITRS)\ndef tete_to_itrs(tete_coo, itrs_frame):\n    # first get us to TETE at the target obstime, and geocentric position\n    tete_coo2 = tete_coo.transform_to(TETE(obstime=itrs_frame.obstime,\n                                           location=EARTH_CENTER))\n\n    # now get the pmatrix\n    pmat = tete_to_itrs_mat(itrs_frame.obstime)\n    crepr = tete_coo2.cartesian.transform(pmat)\n    return itrs_frame.realize_frame(crepr)"},{"className":"Galactocentric","col":0,"comment":"\n    A coordinate or frame in the Galactocentric system.\n\n    This frame allows specifying the Sun-Galactic center distance, the height of\n    the Sun above the Galactic midplane, and the solar motion relative to the\n    Galactic center. However, as there is no modern standard definition of a\n    Galactocentric reference frame, it is important to pay attention to the\n    default values used in this class if precision is important in your code.\n    The default values of the parameters of this frame are taken from the\n    original definition of the frame in 2014. As such, the defaults are somewhat\n    out of date relative to recent measurements made possible by, e.g., Gaia.\n    The defaults can, however, be changed at runtime by setting the parameter\n    set name in `~astropy.coordinates.galactocentric_frame_defaults`.\n\n    The current default parameter set is ``\"pre-v4.0\"``, indicating that the\n    parameters were adopted before ``astropy`` version 4.0. A regularly-updated\n    parameter set can instead be used by setting\n    ``galactocentric_frame_defaults.set ('latest')``, and other parameter set\n    names may be added in future versions. To find out the scientific papers\n    that the current default parameters are derived from, use\n    ``galcen.frame_attribute_references`` (where ``galcen`` is an instance of\n    this frame), which will update even if the default parameter set is changed.\n\n    The position of the Sun is assumed to be on the x axis of the final,\n    right-handed system. That is, the x axis points from the position of\n    the Sun projected to the Galactic midplane to the Galactic center --\n    roughly towards :math:`(l,b) = (0^\\circ,0^\\circ)`. For the default\n    transformation (:math:`{\\rm roll}=0^\\circ`), the y axis points roughly\n    towards Galactic longitude :math:`l=90^\\circ`, and the z axis points\n    roughly towards the North Galactic Pole (:math:`b=90^\\circ`).\n\n    For a more detailed look at the math behind this transformation, see\n    the document :ref:`astropy:coordinates-galactocentric`.\n\n    The frame attributes are listed under **Other Parameters**.\n    ","endLoc":512,"id":15683,"nodeType":"Class","startLoc":431,"text":"@format_doc(base_doc, components=doc_components, footer=doc_footer)\nclass Galactocentric(BaseCoordinateFrame):\n    r\"\"\"\n    A coordinate or frame in the Galactocentric system.\n\n    This frame allows specifying the Sun-Galactic center distance, the height of\n    the Sun above the Galactic midplane, and the solar motion relative to the\n    Galactic center. However, as there is no modern standard definition of a\n    Galactocentric reference frame, it is important to pay attention to the\n    default values used in this class if precision is important in your code.\n    The default values of the parameters of this frame are taken from the\n    original definition of the frame in 2014. As such, the defaults are somewhat\n    out of date relative to recent measurements made possible by, e.g., Gaia.\n    The defaults can, however, be changed at runtime by setting the parameter\n    set name in `~astropy.coordinates.galactocentric_frame_defaults`.\n\n    The current default parameter set is ``\"pre-v4.0\"``, indicating that the\n    parameters were adopted before ``astropy`` version 4.0. A regularly-updated\n    parameter set can instead be used by setting\n    ``galactocentric_frame_defaults.set ('latest')``, and other parameter set\n    names may be added in future versions. To find out the scientific papers\n    that the current default parameters are derived from, use\n    ``galcen.frame_attribute_references`` (where ``galcen`` is an instance of\n    this frame), which will update even if the default parameter set is changed.\n\n    The position of the Sun is assumed to be on the x axis of the final,\n    right-handed system. That is, the x axis points from the position of\n    the Sun projected to the Galactic midplane to the Galactic center --\n    roughly towards :math:`(l,b) = (0^\\circ,0^\\circ)`. For the default\n    transformation (:math:`{\\rm roll}=0^\\circ`), the y axis points roughly\n    towards Galactic longitude :math:`l=90^\\circ`, and the z axis points\n    roughly towards the North Galactic Pole (:math:`b=90^\\circ`).\n\n    For a more detailed look at the math behind this transformation, see\n    the document :ref:`astropy:coordinates-galactocentric`.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    default_representation = r.CartesianRepresentation\n    default_differential = r.CartesianDifferential\n\n    # frame attributes\n    galcen_coord = CoordinateAttribute(frame=ICRS)\n    galcen_distance = QuantityAttribute(unit=u.kpc)\n\n    galcen_v_sun = DifferentialAttribute(\n        allowed_classes=[r.CartesianDifferential])\n\n    z_sun = QuantityAttribute(unit=u.pc)\n    roll = QuantityAttribute(unit=u.deg)\n\n    def __init__(self, *args, **kwargs):\n        # Set default frame attribute values based on the ScienceState instance\n        # for the solar parameters defined above\n        default_params = galactocentric_frame_defaults.get()\n        self.frame_attribute_references = \\\n            galactocentric_frame_defaults.references.copy()\n\n        for k in default_params:\n            if k in kwargs:\n                # If a frame attribute is set by the user, remove its reference\n                self.frame_attribute_references.pop(k, None)\n\n            # Keep the frame attribute if it is set by the user, otherwise use\n            # the default value\n            kwargs[k] = kwargs.get(k, default_params[k])\n\n        super().__init__(*args, **kwargs)\n\n    @classmethod\n    def get_roll0(cls):\n        \"\"\"\n        The additional roll angle (about the final x axis) necessary to align\n        the final z axis to match the Galactic yz-plane.  Setting the ``roll``\n        frame attribute to  -this method's return value removes this rotation,\n        allowing the use of the `Galactocentric` frame in more general contexts.\n        \"\"\"\n        # note that the actual value is defined at the module level.  We make at\n        # a property here because this module isn't actually part of the public\n        # API, so it's better for it to be accessible from Galactocentric\n        return _ROLL0"},{"col":4,"comment":"null","endLoc":499,"header":"def __init__(self, *args, **kwargs)","id":15684,"name":"__init__","nodeType":"Function","startLoc":483,"text":"def __init__(self, *args, **kwargs):\n        # Set default frame attribute values based on the ScienceState instance\n        # for the solar parameters defined above\n        default_params = galactocentric_frame_defaults.get()\n        self.frame_attribute_references = \\\n            galactocentric_frame_defaults.references.copy()\n\n        for k in default_params:\n            if k in kwargs:\n                # If a frame attribute is set by the user, remove its reference\n                self.frame_attribute_references.pop(k, None)\n\n            # Keep the frame attribute if it is set by the user, otherwise use\n            # the default value\n            kwargs[k] = kwargs.get(k, default_params[k])\n\n        super().__init__(*args, **kwargs)"},{"col":0,"comment":"null","endLoc":168,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ITRS, TETE)\ndef itrs_to_tete(itrs_coo, tete_frame)","id":15685,"name":"itrs_to_tete","nodeType":"Function","startLoc":160,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ITRS, TETE)\ndef itrs_to_tete(itrs_coo, tete_frame):\n    # compute the pmatrix, and then multiply by its transpose\n    pmat = tete_to_itrs_mat(itrs_coo.obstime)\n    newrepr = itrs_coo.cartesian.transform(matrix_transpose(pmat))\n    tete = TETE(newrepr, obstime=itrs_coo.obstime)\n\n    # now do any needed offsets (no-op if same obstime)\n    return tete.transform_to(tete_frame)"},{"col":4,"comment":"\n        The additional roll angle (about the final x axis) necessary to align\n        the final z axis to match the Galactic yz-plane.  Setting the ``roll``\n        frame attribute to  -this method's return value removes this rotation,\n        allowing the use of the `Galactocentric` frame in more general contexts.\n        ","endLoc":512,"header":"@classmethod\n    def get_roll0(cls)","id":15686,"name":"get_roll0","nodeType":"Function","startLoc":501,"text":"@classmethod\n    def get_roll0(cls):\n        \"\"\"\n        The additional roll angle (about the final x axis) necessary to align\n        the final z axis to match the Galactic yz-plane.  Setting the ``roll``\n        frame attribute to  -this method's return value removes this rotation,\n        allowing the use of the `Galactocentric` frame in more general contexts.\n        \"\"\"\n        # note that the actual value is defined at the module level.  We make at\n        # a property here because this module isn't actually part of the public\n        # API, so it's better for it to be accessible from Galactocentric\n        return _ROLL0"},{"attributeType":"CartesianRepresentation","col":4,"comment":"null","endLoc":470,"id":15687,"name":"default_representation","nodeType":"Attribute","startLoc":470,"text":"default_representation"},{"attributeType":"CartesianDifferential","col":4,"comment":"null","endLoc":471,"id":15688,"name":"default_differential","nodeType":"Attribute","startLoc":471,"text":"default_differential"},{"attributeType":"CoordinateAttribute","col":4,"comment":"null","endLoc":474,"id":15689,"name":"galcen_coord","nodeType":"Attribute","startLoc":474,"text":"galcen_coord"},{"attributeType":"QuantityAttribute","col":4,"comment":"null","endLoc":475,"id":15690,"name":"galcen_distance","nodeType":"Attribute","startLoc":475,"text":"galcen_distance"},{"col":0,"comment":"null","endLoc":181,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, CIRS)\ndef gcrs_to_cirs(gcrs_coo, cirs_frame)","id":15691,"name":"gcrs_to_cirs","nodeType":"Function","startLoc":171,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, CIRS)\ndef gcrs_to_cirs(gcrs_coo, cirs_frame):\n    # first get the pmatrix\n    pmat = gcrs_to_cirs_mat(cirs_frame.obstime)\n    # Get GCRS coordinates for the target observer location and time.\n    loc_gcrs = get_location_gcrs(cirs_frame.location, cirs_frame.obstime,\n                                 cirs_to_itrs_mat(cirs_frame.obstime), pmat)\n    gcrs_coo2 = gcrs_coo.transform_to(loc_gcrs)\n    # Now we are relative to the correct observer, do the transform to CIRS.\n    crepr = gcrs_coo2.cartesian.transform(pmat)\n    return cirs_frame.realize_frame(crepr)"},{"col":0,"comment":"\n    Accuracy tests for the ICRS (with no E-terms of aberration) to/from FK5\n    conversion, with arbitrary equinoxes and epoch of observation.\n    ","endLoc":247,"header":"def ref_icrs_fk5(fnout='icrs_fk5.csv')","id":15692,"name":"ref_icrs_fk5","nodeType":"Function","startLoc":191,"text":"def ref_icrs_fk5(fnout='icrs_fk5.csv'):\n    \"\"\"\n    Accuracy tests for the ICRS (with no E-terms of aberration) to/from FK5\n    conversion, with arbitrary equinoxes and epoch of observation.\n    \"\"\"\n\n    import starlink.Ast as Ast\n\n    np.random.seed(12345)\n\n    N = 200\n\n    # Sample uniformly on the unit sphere. These will be either the ICRS\n    # coordinates for the transformation to FK5, or the FK5 coordinates for the\n    # transformation to ICRS.\n    ra = np.random.uniform(0., 360., N)\n    dec = np.degrees(np.arcsin(np.random.uniform(-1., 1., N)))\n\n    # Generate random observation epoch and equinoxes\n    obstime = [f\"B{x:7.2f}\" for x in np.random.uniform(1950., 2000., N)]\n    equinox_fk5 = [f\"J{x:7.2f}\" for x in np.random.uniform(1975., 2025., N)]\n\n    ra_icrs, dec_icrs = [], []\n    ra_fk5, dec_fk5 = [], []\n\n    for i in range(N):\n\n        # Set up frames for AST\n        frame_icrs = Ast.SkyFrame(f'System=ICRS,Epoch={obstime[i]}')\n        frame_fk5 = Ast.SkyFrame(f'System=FK5,Epoch={obstime[i]},Equinox={equinox_fk5[i]}')\n\n        # ICRS to FK5\n        frameset = frame_icrs.convert(frame_fk5)\n        coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]]))\n        ra_fk5.append(coords[0, 0])\n        dec_fk5.append(coords[1, 0])\n\n        # FK5 to ICRS\n        frameset = frame_fk5.convert(frame_icrs)\n        coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]]))\n        ra_icrs.append(coords[0, 0])\n        dec_icrs.append(coords[1, 0])\n\n    # Write out table to a CSV file\n    t = Table()\n    t.add_column(Column(name='equinox_fk5', data=equinox_fk5))\n    t.add_column(Column(name='obstime', data=obstime))\n    t.add_column(Column(name='ra_in', data=ra))\n    t.add_column(Column(name='dec_in', data=dec))\n    t.add_column(Column(name='ra_fk5', data=ra_fk5))\n    t.add_column(Column(name='dec_fk5', data=dec_fk5))\n    t.add_column(Column(name='ra_icrs', data=ra_icrs))\n    t.add_column(Column(name='dec_icrs', data=dec_icrs))\n    f = open(os.path.join('data', fnout), 'wb')\n    f.write(\"# This file was generated with the {} script, and the reference \"\n            \"values were computed using AST\\n\".format(os.path.basename(__file__)))\n    t.write(f, format='ascii', delimiter=',')"},{"col":0,"comment":"null","endLoc":81,"header":"@frame_transform_graph.transform(AffineTransform, LSR, ICRS)\ndef lsr_to_icrs(lsr_coord, icrs_frame)","id":15693,"name":"lsr_to_icrs","nodeType":"Function","startLoc":75,"text":"@frame_transform_graph.transform(AffineTransform, LSR, ICRS)\ndef lsr_to_icrs(lsr_coord, icrs_frame):\n    v_bary_gal = Galactic(lsr_coord.v_bary.to_cartesian())\n    v_bary_icrs = v_bary_gal.transform_to(icrs_frame)\n    v_offset = v_bary_icrs.data.represent_as(r.CartesianDifferential)\n    offset = r.CartesianRepresentation([0, 0, 0]*u.au, differentials=-v_offset)\n    return None, offset"},{"col":0,"comment":"null","endLoc":161,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 GCRS, ICRS)\ndef gcrs_to_icrs(gcrs_coo, icrs_frame)","id":15694,"name":"gcrs_to_icrs","nodeType":"Function","startLoc":130,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 GCRS, ICRS)\ndef gcrs_to_icrs(gcrs_coo, icrs_frame):\n    # set up the astrometry context for ICRS<->GCRS and then convert to BCRS\n    # coordinate direction\n    astrom = erfa_astrom.get().apcs(gcrs_coo)\n\n    srepr = gcrs_coo.represent_as(SphericalRepresentation)\n    i_ra, i_dec = aticq(srepr.without_differentials(), astrom)\n\n    if gcrs_coo.data.get_name() == 'unitspherical' or gcrs_coo.data.to_cartesian().x.unit == u.one:\n        # if no distance, just use the coordinate direction to yield the\n        # infinite-distance/no parallax answer\n        newrep = UnitSphericalRepresentation(lat=u.Quantity(i_dec, u.radian, copy=False),\n                                             lon=u.Quantity(i_ra, u.radian, copy=False),\n                                             copy=False)\n    else:\n        # When there is a distance, apply the parallax/offset to the SSB as the\n        # last step - ensures round-tripping with the icrs_to_gcrs transform\n\n        # the distance in intermedrep is *not* a real distance as it does not\n        # include the offset back to the SSB\n        intermedrep = SphericalRepresentation(lat=u.Quantity(i_dec, u.radian, copy=False),\n                                              lon=u.Quantity(i_ra, u.radian, copy=False),\n                                              distance=srepr.distance,\n                                              copy=False)\n\n        astrom_eb = CartesianRepresentation(astrom['eb'], unit=u.au,\n                                            xyz_axis=-1, copy=False)\n        newrep = intermedrep + astrom_eb\n\n    return icrs_frame.realize_frame(newrep)"},{"attributeType":"DifferentialAttribute","col":4,"comment":"null","endLoc":477,"id":15695,"name":"galcen_v_sun","nodeType":"Attribute","startLoc":477,"text":"galcen_v_sun"},{"col":0,"comment":"null","endLoc":195,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, GCRS)\ndef cirs_to_gcrs(cirs_coo, gcrs_frame)","id":15696,"name":"cirs_to_gcrs","nodeType":"Function","startLoc":184,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, GCRS)\ndef cirs_to_gcrs(cirs_coo, gcrs_frame):\n    # Compute the pmatrix, and then multiply by its transpose,\n    pmat = gcrs_to_cirs_mat(cirs_coo.obstime)\n    newrepr = cirs_coo.cartesian.transform(matrix_transpose(pmat))\n    # We now have a GCRS vector for the input location and obstime.\n    # Turn it into a GCRS frame instance.\n    loc_gcrs = get_location_gcrs(cirs_coo.location, cirs_coo.obstime,\n                                 cirs_to_itrs_mat(cirs_coo.obstime), pmat)\n    gcrs = loc_gcrs.realize_frame(newrepr)\n    # Finally, do any needed offsets (no-op if same obstime and location)\n    return gcrs.transform_to(gcrs_frame)"},{"col":0,"comment":"null","endLoc":154,"header":"@frame_transform_graph.transform(AffineTransform, Galactic, GalacticLSR)\ndef galactic_to_galacticlsr(galactic_coord, lsr_frame)","id":15697,"name":"galactic_to_galacticlsr","nodeType":"Function","startLoc":149,"text":"@frame_transform_graph.transform(AffineTransform, Galactic, GalacticLSR)\ndef galactic_to_galacticlsr(galactic_coord, lsr_frame):\n    v_bary_gal = Galactic(lsr_frame.v_bary.to_cartesian())\n    v_offset = v_bary_gal.data.represent_as(r.CartesianDifferential)\n    offset = r.CartesianRepresentation([0, 0, 0]*u.au, differentials=v_offset)\n    return None, offset"},{"col":0,"comment":"null","endLoc":90,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, AltAz, CIRS)\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, HADec, CIRS)\ndef observed_to_cirs(observed_coo, cirs_frame)","id":15698,"name":"observed_to_cirs","nodeType":"Function","startLoc":62,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, AltAz, CIRS)\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, HADec, CIRS)\ndef observed_to_cirs(observed_coo, cirs_frame):\n    usrepr = observed_coo.represent_as(UnitSphericalRepresentation)\n    lon = usrepr.lon.to_value(u.radian)\n    lat = usrepr.lat.to_value(u.radian)\n\n    if isinstance(observed_coo, AltAz):\n        # the 'A' indicates zen/az inputs\n        coord_type = 'A'\n        lat = PIOVER2 - lat\n    else:\n        coord_type = 'H'\n\n    # first set up the astrometry context for ICRS<->CIRS at the observed_coo time\n    astrom = erfa_astrom.get().apio(observed_coo)\n\n    cirs_ra, cirs_dec = erfa.atoiq(coord_type, lon, lat, astrom) << u.radian\n    if isinstance(observed_coo.data, UnitSphericalRepresentation) or observed_coo.cartesian.x.unit == u.one:\n        distance = None\n    else:\n        distance = observed_coo.distance\n\n    cirs_at_aa_time = CIRS(ra=cirs_ra, dec=cirs_dec, distance=distance,\n                           obstime=observed_coo.obstime,\n                           location=observed_coo.location)\n\n    # this final transform may be a no-op if the obstimes and locations are the same\n    return cirs_at_aa_time.transform_to(cirs_frame)"},{"attributeType":"QuantityAttribute","col":4,"comment":"null","endLoc":480,"id":15699,"name":"z_sun","nodeType":"Attribute","startLoc":480,"text":"z_sun"},{"col":0,"comment":"null","endLoc":207,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, ITRS)\ndef cirs_to_itrs(cirs_coo, itrs_frame)","id":15700,"name":"cirs_to_itrs","nodeType":"Function","startLoc":198,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, ITRS)\ndef cirs_to_itrs(cirs_coo, itrs_frame):\n    # first get us to geocentric CIRS at the target obstime\n    cirs_coo2 = cirs_coo.transform_to(CIRS(obstime=itrs_frame.obstime,\n                                           location=EARTH_CENTER))\n\n    # now get the pmatrix\n    pmat = cirs_to_itrs_mat(itrs_frame.obstime)\n    crepr = cirs_coo2.cartesian.transform(pmat)\n    return itrs_frame.realize_frame(crepr)"},{"attributeType":"QuantityAttribute","col":4,"comment":"null","endLoc":481,"id":15701,"name":"roll","nodeType":"Attribute","startLoc":481,"text":"roll"},{"attributeType":"null","col":8,"comment":"null","endLoc":487,"id":15702,"name":"frame_attribute_references","nodeType":"Attribute","startLoc":487,"text":"self.frame_attribute_references"},{"col":0,"comment":"\n    Use the ``inverse`` argument to get the inverse transformation, matrix and\n    offsets to go from Galactocentric to ICRS.\n    ","endLoc":559,"header":"def get_matrix_vectors(galactocentric_frame, inverse=False)","id":15703,"name":"get_matrix_vectors","nodeType":"Function","startLoc":517,"text":"def get_matrix_vectors(galactocentric_frame, inverse=False):\n    \"\"\"\n    Use the ``inverse`` argument to get the inverse transformation, matrix and\n    offsets to go from Galactocentric to ICRS.\n    \"\"\"\n    # shorthand\n    gcf = galactocentric_frame\n\n    # rotation matrix to align x(ICRS) with the vector to the Galactic center\n    mat1 = rotation_matrix(-gcf.galcen_coord.dec, 'y')\n    mat2 = rotation_matrix(gcf.galcen_coord.ra, 'z')\n    # extra roll away from the Galactic x-z plane\n    mat0 = rotation_matrix(gcf.get_roll0() - gcf.roll, 'x')\n\n    # construct transformation matrix and use it\n    R = matrix_product(mat0, mat1, mat2)\n\n    # Now need to translate by Sun-Galactic center distance around x' and\n    # rotate about y' to account for tilt due to Sun's height above the plane\n    translation = r.CartesianRepresentation(gcf.galcen_distance * [1., 0., 0.])\n    z_d = gcf.z_sun / gcf.galcen_distance\n    H = rotation_matrix(-np.arcsin(z_d), 'y')\n\n    # compute total matrices\n    A = matrix_product(H, R)\n\n    # Now we re-align the translation vector to account for the Sun's height\n    # above the midplane\n    offset = -translation.transform(H)\n\n    if inverse:\n        # the inverse of a rotation matrix is a transpose, which is much faster\n        #   and more stable to compute\n        A = matrix_transpose(A)\n        offset = (-offset).transform(A)\n        offset_v = r.CartesianDifferential.from_cartesian(\n            (-gcf.galcen_v_sun).to_cartesian().transform(A))\n        offset = offset.with_differentials(offset_v)\n\n    else:\n        offset = offset.with_differentials(gcf.galcen_v_sun)\n\n    return A, offset"},{"col":0,"comment":"null","endLoc":162,"header":"@frame_transform_graph.transform(AffineTransform, GalacticLSR, Galactic)\ndef galacticlsr_to_galactic(lsr_coord, galactic_frame)","id":15704,"name":"galacticlsr_to_galactic","nodeType":"Function","startLoc":157,"text":"@frame_transform_graph.transform(AffineTransform, GalacticLSR, Galactic)\ndef galacticlsr_to_galactic(lsr_coord, galactic_frame):\n    v_bary_gal = Galactic(lsr_coord.v_bary.to_cartesian())\n    v_offset = v_bary_gal.data.represent_as(r.CartesianDifferential)\n    offset = r.CartesianRepresentation([0, 0, 0]*u.au, differentials=-v_offset)\n    return None, offset"},{"col":0,"comment":"null","endLoc":218,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ITRS, CIRS)\ndef itrs_to_cirs(itrs_coo, cirs_frame)","id":15705,"name":"itrs_to_cirs","nodeType":"Function","startLoc":210,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ITRS, CIRS)\ndef itrs_to_cirs(itrs_coo, cirs_frame):\n    # compute the pmatrix, and then multiply by its transpose\n    pmat = cirs_to_itrs_mat(itrs_coo.obstime)\n    newrepr = itrs_coo.cartesian.transform(matrix_transpose(pmat))\n    cirs = CIRS(newrepr, obstime=itrs_coo.obstime)\n\n    # now do any needed offsets (no-op if same obstime)\n    return cirs.transform_to(cirs_frame)"},{"col":0,"comment":"null","endLoc":237,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, PrecessedGeocentric)\ndef gcrs_to_precessedgeo(from_coo, to_frame)","id":15706,"name":"gcrs_to_precessedgeo","nodeType":"Function","startLoc":227,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, PrecessedGeocentric)\ndef gcrs_to_precessedgeo(from_coo, to_frame):\n    # first get us to GCRS with the right attributes (might be a no-op)\n    gcrs_coo = from_coo.transform_to(GCRS(obstime=to_frame.obstime,\n                                          obsgeoloc=to_frame.obsgeoloc,\n                                          obsgeovel=to_frame.obsgeovel))\n\n    # now precess to the requested equinox\n    pmat = gcrs_precession_mat(to_frame.equinox)\n    crepr = gcrs_coo.cartesian.transform(pmat)\n    return to_frame.realize_frame(crepr)"},{"col":0,"comment":"null","endLoc":208,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, HCRS)\ndef gcrs_to_hcrs(gcrs_coo, hcrs_frame)","id":15707,"name":"gcrs_to_hcrs","nodeType":"Function","startLoc":164,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, HCRS)\ndef gcrs_to_hcrs(gcrs_coo, hcrs_frame):\n\n    if np.any(gcrs_coo.obstime != hcrs_frame.obstime):\n        # if they GCRS obstime and HCRS obstime are not the same, we first\n        # have to move to a GCRS where they are.\n        frameattrs = gcrs_coo.get_frame_attr_names()\n        frameattrs['obstime'] = hcrs_frame.obstime\n        gcrs_coo = gcrs_coo.transform_to(GCRS(**frameattrs))\n\n    # set up the astrometry context for ICRS<->GCRS and then convert to ICRS\n    # coordinate direction\n    astrom = erfa_astrom.get().apcs(gcrs_coo)\n    srepr = gcrs_coo.represent_as(SphericalRepresentation)\n    i_ra, i_dec = aticq(srepr.without_differentials(), astrom)\n\n    # convert to Quantity objects\n    i_ra = u.Quantity(i_ra, u.radian, copy=False)\n    i_dec = u.Quantity(i_dec, u.radian, copy=False)\n    if gcrs_coo.data.get_name() == 'unitspherical' or gcrs_coo.data.to_cartesian().x.unit == u.one:\n        # if no distance, just use the coordinate direction to yield the\n        # infinite-distance/no parallax answer\n        newrep = UnitSphericalRepresentation(lat=i_dec, lon=i_ra, copy=False)\n    else:\n        # When there is a distance, apply the parallax/offset to the\n        # Heliocentre as the last step to ensure round-tripping with the\n        # hcrs_to_gcrs transform\n\n        # Note that the distance in intermedrep is *not* a real distance as it\n        # does not include the offset back to the Heliocentre\n        intermedrep = SphericalRepresentation(lat=i_dec, lon=i_ra,\n                                              distance=srepr.distance,\n                                              copy=False)\n\n        # astrom['eh'] and astrom['em'] contain Sun to observer unit vector,\n        # and distance, respectively. Shapes are (X) and (X,3), where (X) is the\n        # shape resulting from broadcasting the shape of the times object\n        # against the shape of the pv array.\n        # broadcast em to eh and scale eh\n        eh = astrom['eh'] * astrom['em'][..., np.newaxis]\n        eh = CartesianRepresentation(eh, unit=u.au, xyz_axis=-1, copy=False)\n\n        newrep = intermedrep.to_cartesian() + eh\n\n    return hcrs_frame.realize_frame(newrep)"},{"attributeType":"null","col":16,"comment":"null","endLoc":7,"id":15708,"name":"np","nodeType":"Attribute","startLoc":7,"text":"np"},{"attributeType":"null","col":29,"comment":"null","endLoc":10,"id":15709,"name":"u","nodeType":"Attribute","startLoc":10,"text":"u"},{"col":0,"comment":"","endLoc":5,"header":"cirs_observed_transforms.py#<anonymous>","id":15710,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nContains the transformation functions for getting to \"observed\" systems from CIRS.\n\"\"\""},{"col":0,"comment":"null","endLoc":251,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, PrecessedGeocentric, GCRS)\ndef precessedgeo_to_gcrs(from_coo, to_frame)","id":15711,"name":"precessedgeo_to_gcrs","nodeType":"Function","startLoc":240,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, PrecessedGeocentric, GCRS)\ndef precessedgeo_to_gcrs(from_coo, to_frame):\n    # first un-precess\n    pmat = gcrs_precession_mat(from_coo.equinox)\n    crepr = from_coo.cartesian.transform(matrix_transpose(pmat))\n    gcrs_coo = GCRS(crepr,\n                    obstime=from_coo.obstime,\n                    obsgeoloc=from_coo.obsgeoloc,\n                    obsgeovel=from_coo.obsgeovel)\n\n    # then move to the GCRS that's actually desired\n    return gcrs_coo.transform_to(to_frame)"},{"fileName":"galactic_transforms.py","filePath":"astropy/coordinates/builtin_frames","id":15712,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom astropy.coordinates.matrix_utilities import (rotation_matrix,\n                                                  matrix_product,\n                                                  matrix_transpose)\nfrom astropy.coordinates.baseframe import frame_transform_graph\nfrom astropy.coordinates.transformations import DynamicMatrixTransform\n\nfrom .fk5 import FK5\nfrom .fk4 import FK4NoETerms\nfrom .utils import EQUINOX_B1950, EQUINOX_J2000\nfrom .galactic import Galactic\n\n\n# Galactic to/from FK4/FK5 ----------------------->\n# can't be static because the equinox is needed\n@frame_transform_graph.transform(DynamicMatrixTransform, FK5, Galactic)\ndef fk5_to_gal(fk5coord, galframe):\n    # need precess to J2000 first\n    pmat = fk5coord._precession_matrix(fk5coord.equinox, EQUINOX_J2000)\n    mat1 = rotation_matrix(180 - Galactic._lon0_J2000.degree, 'z')\n    mat2 = rotation_matrix(90 - Galactic._ngp_J2000.dec.degree, 'y')\n    mat3 = rotation_matrix(Galactic._ngp_J2000.ra.degree, 'z')\n\n    return matrix_product(mat1, mat2, mat3, pmat)\n\n\n@frame_transform_graph.transform(DynamicMatrixTransform, Galactic, FK5)\ndef _gal_to_fk5(galcoord, fk5frame):\n    return matrix_transpose(fk5_to_gal(fk5frame, galcoord))\n\n\n@frame_transform_graph.transform(DynamicMatrixTransform, FK4NoETerms, Galactic)\ndef fk4_to_gal(fk4coords, galframe):\n    mat1 = rotation_matrix(180 - Galactic._lon0_B1950.degree, 'z')\n    mat2 = rotation_matrix(90 - Galactic._ngp_B1950.dec.degree, 'y')\n    mat3 = rotation_matrix(Galactic._ngp_B1950.ra.degree, 'z')\n    matprec = fk4coords._precession_matrix(fk4coords.equinox, EQUINOX_B1950)\n\n    return matrix_product(mat1, mat2, mat3, matprec)\n\n\n@frame_transform_graph.transform(DynamicMatrixTransform, Galactic, FK4NoETerms)\ndef gal_to_fk4(galcoords, fk4frame):\n    return matrix_transpose(fk4_to_gal(fk4frame, galcoords))\n"},{"className":"FK5","col":0,"comment":"\n    A coordinate or frame in the FK5 system.\n\n    Note that this is a barycentric version of FK5 - that is, the origin for\n    this frame is the Solar System Barycenter, *not* the Earth geocenter.\n\n    The frame attributes are listed under **Other Parameters**.\n    ","endLoc":55,"id":15713,"nodeType":"Class","startLoc":24,"text":"@format_doc(base_doc, components=doc_components, footer=doc_footer)\nclass FK5(BaseRADecFrame):\n    \"\"\"\n    A coordinate or frame in the FK5 system.\n\n    Note that this is a barycentric version of FK5 - that is, the origin for\n    this frame is the Solar System Barycenter, *not* the Earth geocenter.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n\n    @staticmethod\n    def _precession_matrix(oldequinox, newequinox):\n        \"\"\"\n        Compute and return the precession matrix for FK5 based on Capitaine et\n        al. 2003/IAU2006.  Used inside some of the transformation functions.\n\n        Parameters\n        ----------\n        oldequinox : `~astropy.time.Time`\n            The equinox to precess from.\n        newequinox : `~astropy.time.Time`\n            The equinox to precess to.\n\n        Returns\n        -------\n        newcoord : array\n            The precession matrix to transform to the new equinox\n        \"\"\"\n        return earth.precession_matrix_Capitaine(oldequinox, newequinox)"},{"col":4,"comment":"\n        Compute and return the precession matrix for FK5 based on Capitaine et\n        al. 2003/IAU2006.  Used inside some of the transformation functions.\n\n        Parameters\n        ----------\n        oldequinox : `~astropy.time.Time`\n            The equinox to precess from.\n        newequinox : `~astropy.time.Time`\n            The equinox to precess to.\n\n        Returns\n        -------\n        newcoord : array\n            The precession matrix to transform to the new equinox\n        ","endLoc":55,"header":"@staticmethod\n    def _precession_matrix(oldequinox, newequinox)","id":15714,"name":"_precession_matrix","nodeType":"Function","startLoc":37,"text":"@staticmethod\n    def _precession_matrix(oldequinox, newequinox):\n        \"\"\"\n        Compute and return the precession matrix for FK5 based on Capitaine et\n        al. 2003/IAU2006.  Used inside some of the transformation functions.\n\n        Parameters\n        ----------\n        oldequinox : `~astropy.time.Time`\n            The equinox to precess from.\n        newequinox : `~astropy.time.Time`\n            The equinox to precess to.\n\n        Returns\n        -------\n        newcoord : array\n            The precession matrix to transform to the new equinox\n        \"\"\"\n        return earth.precession_matrix_Capitaine(oldequinox, newequinox)"},{"col":0,"comment":"null","endLoc":262,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, TEME, ITRS)\ndef teme_to_itrs(teme_coo, itrs_frame)","id":15715,"name":"teme_to_itrs","nodeType":"Function","startLoc":254,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, TEME, ITRS)\ndef teme_to_itrs(teme_coo, itrs_frame):\n    # use the pmatrix to transform to ITRS in the source obstime\n    pmat = teme_to_itrs_mat(teme_coo.obstime)\n    crepr = teme_coo.cartesian.transform(pmat)\n    itrs = ITRS(crepr, obstime=teme_coo.obstime)\n\n    # transform the ITRS coordinate to the target obstime\n    return itrs.transform_to(itrs_frame)"},{"attributeType":"null","col":4,"comment":"null","endLoc":35,"id":15716,"name":"equinox","nodeType":"Attribute","startLoc":35,"text":"equinox"},{"col":0,"comment":"null","endLoc":26,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, FK5, Galactic)\ndef fk5_to_gal(fk5coord, galframe)","id":15717,"name":"fk5_to_gal","nodeType":"Function","startLoc":18,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, FK5, Galactic)\ndef fk5_to_gal(fk5coord, galframe):\n    # need precess to J2000 first\n    pmat = fk5coord._precession_matrix(fk5coord.equinox, EQUINOX_J2000)\n    mat1 = rotation_matrix(180 - Galactic._lon0_J2000.degree, 'z')\n    mat2 = rotation_matrix(90 - Galactic._ngp_J2000.dec.degree, 'y')\n    mat3 = rotation_matrix(Galactic._ngp_J2000.ra.degree, 'z')\n\n    return matrix_product(mat1, mat2, mat3, pmat)"},{"col":0,"comment":"null","endLoc":273,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ITRS, TEME)\ndef itrs_to_teme(itrs_coo, teme_frame)","id":15718,"name":"itrs_to_teme","nodeType":"Function","startLoc":265,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ITRS, TEME)\ndef itrs_to_teme(itrs_coo, teme_frame):\n    # transform the ITRS coordinate to the target obstime\n    itrs_coo2 = itrs_coo.transform_to(ITRS(obstime=teme_frame.obstime))\n\n    # compute the pmatrix, and then multiply by its transpose\n    pmat = teme_to_itrs_mat(teme_frame.obstime)\n    newrepr = itrs_coo2.cartesian.transform(matrix_transpose(pmat))\n    return teme_frame.realize_frame(newrepr)"},{"col":0,"comment":"null","endLoc":208,"header":"@frame_transform_graph.transform(AffineTransform, ICRS, LSRK)\ndef icrs_to_lsrk(icrs_coord, lsr_frame)","id":15719,"name":"icrs_to_lsrk","nodeType":"Function","startLoc":206,"text":"@frame_transform_graph.transform(AffineTransform, ICRS, LSRK)\ndef icrs_to_lsrk(icrs_coord, lsr_frame):\n    return None, ICRS_LSRK_OFFSET"},{"col":0,"comment":"null","endLoc":31,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, Galactic, FK5)\ndef _gal_to_fk5(galcoord, fk5frame)","id":15720,"name":"_gal_to_fk5","nodeType":"Function","startLoc":29,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, Galactic, FK5)\ndef _gal_to_fk5(galcoord, fk5frame):\n    return matrix_transpose(fk5_to_gal(fk5frame, galcoord))"},{"col":0,"comment":"","endLoc":7,"header":"intermediate_rotation_transforms.py#<anonymous>","id":15721,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nContains the transformation functions for getting to/from ITRS, TEME, GCRS, and CIRS.\nThese are distinct from the ICRS and AltAz functions because they are just\nrotations without aberration corrections or offsets.\n\"\"\"\n\nframe_transform_graph._add_merged_transform(ITRS, CIRS, ITRS)\n\nframe_transform_graph._add_merged_transform(PrecessedGeocentric, GCRS, PrecessedGeocentric)\n\nframe_transform_graph._add_merged_transform(TEME, ITRS, TEME)\n\nframe_transform_graph._add_merged_transform(TETE, ICRS, TETE)"},{"col":0,"comment":"null","endLoc":41,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, FK4NoETerms, Galactic)\ndef fk4_to_gal(fk4coords, galframe)","id":15722,"name":"fk4_to_gal","nodeType":"Function","startLoc":34,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, FK4NoETerms, Galactic)\ndef fk4_to_gal(fk4coords, galframe):\n    mat1 = rotation_matrix(180 - Galactic._lon0_B1950.degree, 'z')\n    mat2 = rotation_matrix(90 - Galactic._ngp_B1950.dec.degree, 'y')\n    mat3 = rotation_matrix(Galactic._ngp_B1950.ra.degree, 'z')\n    matprec = fk4coords._precession_matrix(fk4coords.equinox, EQUINOX_B1950)\n\n    return matrix_product(mat1, mat2, mat3, matprec)"},{"col":0,"comment":"null","endLoc":213,"header":"@frame_transform_graph.transform(AffineTransform, LSRK, ICRS)\ndef lsrk_to_icrs(lsr_coord, icrs_frame)","id":15723,"name":"lsrk_to_icrs","nodeType":"Function","startLoc":211,"text":"@frame_transform_graph.transform(AffineTransform, LSRK, ICRS)\ndef lsrk_to_icrs(lsr_coord, icrs_frame):\n    return None, LSRK_ICRS_OFFSET"},{"col":0,"comment":"null","endLoc":259,"header":"@frame_transform_graph.transform(AffineTransform, ICRS, LSRD)\ndef icrs_to_lsrd(icrs_coord, lsr_frame)","id":15724,"name":"icrs_to_lsrd","nodeType":"Function","startLoc":257,"text":"@frame_transform_graph.transform(AffineTransform, ICRS, LSRD)\ndef icrs_to_lsrd(icrs_coord, lsr_frame):\n    return None, ICRS_LSRD_OFFSET"},{"col":0,"comment":"null","endLoc":224,"header":"@frame_transform_graph.transform(AffineTransform, HCRS, ICRS)\ndef hcrs_to_icrs(hcrs_coo, icrs_frame)","id":15725,"name":"hcrs_to_icrs","nodeType":"Function","startLoc":217,"text":"@frame_transform_graph.transform(AffineTransform, HCRS, ICRS)\ndef hcrs_to_icrs(hcrs_coo, icrs_frame):\n    # this is just an origin translation so without a distance it cannot go ahead\n    if isinstance(hcrs_coo.data, UnitSphericalRepresentation):\n        raise u.UnitsError(_NEED_ORIGIN_HINT.format(hcrs_coo.__class__.__name__))\n\n    return None, get_offset_sun_from_barycenter(hcrs_coo.obstime,\n                                                include_velocity=bool(hcrs_coo.data.differentials))"},{"col":0,"comment":"null","endLoc":264,"header":"@frame_transform_graph.transform(AffineTransform, LSRD, ICRS)\ndef lsrd_to_icrs(lsr_coord, icrs_frame)","id":15726,"name":"lsrd_to_icrs","nodeType":"Function","startLoc":262,"text":"@frame_transform_graph.transform(AffineTransform, LSRD, ICRS)\ndef lsrd_to_icrs(lsr_coord, icrs_frame):\n    return None, LSRD_ICRS_OFFSET"},{"col":0,"comment":"null","endLoc":46,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, Galactic, FK4NoETerms)\ndef gal_to_fk4(galcoords, fk4frame)","id":15727,"name":"gal_to_fk4","nodeType":"Function","startLoc":44,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, Galactic, FK4NoETerms)\ndef gal_to_fk4(galcoords, fk4frame):\n    return matrix_transpose(fk4_to_gal(fk4frame, galcoords))"},{"attributeType":"null","col":29,"comment":"null","endLoc":4,"id":15728,"name":"u","nodeType":"Attribute","startLoc":4,"text":"u"},{"attributeType":"null","col":50,"comment":"null","endLoc":7,"id":15729,"name":"r","nodeType":"Attribute","startLoc":7,"text":"r"},{"attributeType":"null","col":57,"comment":"null","endLoc":14,"id":15730,"name":"doc_components_radec","nodeType":"Attribute","startLoc":14,"text":"doc_components_radec"},{"attributeType":"Time","col":0,"comment":"null","endLoc":20,"id":15731,"name":"J2000","nodeType":"Attribute","startLoc":20,"text":"J2000"},{"attributeType":"CartesianDifferential","col":0,"comment":"null","endLoc":22,"id":15732,"name":"v_bary_Schoenrich2010","nodeType":"Attribute","startLoc":22,"text":"v_bary_Schoenrich2010"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":15733,"name":"__all__","nodeType":"Attribute","startLoc":24,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":15734,"name":"doc_footer_lsr","nodeType":"Attribute","startLoc":27,"text":"doc_footer_lsr"},{"attributeType":"null","col":0,"comment":"null","endLoc":87,"id":15735,"name":"doc_components_gal","nodeType":"Attribute","startLoc":87,"text":"doc_components_gal"},{"attributeType":"CartesianDifferential","col":0,"comment":"null","endLoc":198,"id":15736,"name":"V_OFFSET_LSRK","nodeType":"Attribute","startLoc":198,"text":"V_OFFSET_LSRK"},{"attributeType":"CartesianRepresentation","col":0,"comment":"null","endLoc":202,"id":15737,"name":"ICRS_LSRK_OFFSET","nodeType":"Attribute","startLoc":202,"text":"ICRS_LSRK_OFFSET"},{"attributeType":"CartesianRepresentation","col":0,"comment":"null","endLoc":203,"id":15738,"name":"LSRK_ICRS_OFFSET","nodeType":"Attribute","startLoc":203,"text":"LSRK_ICRS_OFFSET"},{"attributeType":"CartesianDifferential","col":0,"comment":"null","endLoc":249,"id":15739,"name":"V_OFFSET_LSRD","nodeType":"Attribute","startLoc":249,"text":"V_OFFSET_LSRD"},{"fileName":"utils.py","filePath":"astropy/coordinates/builtin_frames","id":15740,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module contains functions/values used repeatedly in different modules of\nthe ``builtin_frames`` package.\n\"\"\"\n\nimport warnings\n\nimport erfa\nimport numpy as np\n\nfrom astropy import units as u\nfrom astropy.time import Time\nfrom astropy.coordinates.earth import EarthLocation\nfrom astropy.utils import iers\nfrom astropy.utils.exceptions import AstropyWarning\nfrom ..representation import CartesianDifferential\n\n\n# We use tt as the time scale for this equinoxes, primarily because it is the\n# convention for J2000 (it is unclear if there is any \"right answer\" for B1950)\n# while #8600 makes this the default behavior, we show it here to ensure it's\n# clear which is used here\nEQUINOX_J2000 = Time('J2000', scale='tt')\nEQUINOX_B1950 = Time('B1950', scale='tt')\n\n# This is a time object that is the default \"obstime\" when such an attribute is\n# necessary.  Currently, we use J2000.\nDEFAULT_OBSTIME = Time('J2000', scale='tt')\n\n# This is an EarthLocation that is the default \"location\" when such an attribute is\n# necessary. It is the centre of the Earth.\nEARTH_CENTER = EarthLocation(0*u.km, 0*u.km, 0*u.km)\n\nPIOVER2 = np.pi / 2.\n\n# comes from the mean of the 1962-2014 IERS B data\n_DEFAULT_PM = (0.035, 0.29)*u.arcsec\n\n\ndef get_polar_motion(time):\n    \"\"\"\n    gets the two polar motion components in radians for use with apio\n    \"\"\"\n    # Get the polar motion from the IERS table\n    iers_table = iers.earth_orientation_table.get()\n    xp, yp, status = iers_table.pm_xy(time, return_status=True)\n\n    wmsg = (\n        'Tried to get polar motions for times {} IERS data is '\n        'valid. Defaulting to polar motion from the 50-yr mean for those. '\n        'This may affect precision at the arcsec level. Please check your '\n        'astropy.utils.iers.conf.iers_auto_url and point it to a newer '\n        'version if necessary.'\n    )\n    if np.any(status == iers.TIME_BEFORE_IERS_RANGE):\n        xp[status == iers.TIME_BEFORE_IERS_RANGE] = _DEFAULT_PM[0]\n        yp[status == iers.TIME_BEFORE_IERS_RANGE] = _DEFAULT_PM[1]\n\n        warnings.warn(wmsg.format('before'), AstropyWarning)\n\n    if np.any(status == iers.TIME_BEYOND_IERS_RANGE):\n\n        xp[status == iers.TIME_BEYOND_IERS_RANGE] = _DEFAULT_PM[0]\n        yp[status == iers.TIME_BEYOND_IERS_RANGE] = _DEFAULT_PM[1]\n\n        warnings.warn(wmsg.format('after'), AstropyWarning)\n\n    return xp.to_value(u.radian), yp.to_value(u.radian)\n\n\ndef _warn_iers(ierserr):\n    \"\"\"\n    Generate a warning for an IERSRangeerror\n\n    Parameters\n    ----------\n    ierserr : An `~astropy.utils.iers.IERSRangeError`\n    \"\"\"\n    msg = '{0} Assuming UT1-UTC=0 for coordinate transformations.'\n    warnings.warn(msg.format(ierserr.args[0]), AstropyWarning)\n\n\ndef get_dut1utc(time):\n    \"\"\"\n    This function is used to get UT1-UTC in coordinates because normally it\n    gives an error outside the IERS range, but in coordinates we want to allow\n    it to go through but with a warning.\n    \"\"\"\n    try:\n        return time.delta_ut1_utc\n    except iers.IERSRangeError as e:\n        _warn_iers(e)\n        return np.zeros(time.shape)\n\n\ndef get_jd12(time, scale):\n    \"\"\"\n    Gets ``jd1`` and ``jd2`` from a time object in a particular scale.\n\n    Parameters\n    ----------\n    time : `~astropy.time.Time`\n        The time to get the jds for\n    scale : str\n        The time scale to get the jds for\n\n    Returns\n    -------\n    jd1 : float\n    jd2 : float\n    \"\"\"\n    if time.scale == scale:\n        newtime = time\n    else:\n        try:\n            newtime = getattr(time, scale)\n        except iers.IERSRangeError as e:\n            _warn_iers(e)\n            newtime = time\n\n    return newtime.jd1, newtime.jd2\n\n\ndef norm(p):\n    \"\"\"\n    Normalise a p-vector.\n    \"\"\"\n    return p / np.sqrt(np.einsum('...i,...i', p, p))[..., np.newaxis]\n\n\ndef pav2pv(p, v):\n    \"\"\"\n    Combine p- and v- vectors into a pv-vector.\n    \"\"\"\n    pv = np.empty(np.broadcast(p, v).shape[:-1], erfa.dt_pv)\n    pv['p'] = p\n    pv['v'] = v\n    return pv\n\n\ndef get_cip(jd1, jd2):\n    \"\"\"\n    Find the X, Y coordinates of the CIP and the CIO locator, s.\n\n    Parameters\n    ----------\n    jd1 : float or `np.ndarray`\n        First part of two part Julian date (TDB)\n    jd2 : float or `np.ndarray`\n        Second part of two part Julian date (TDB)\n\n    Returns\n    -------\n    x : float or `np.ndarray`\n        x coordinate of the CIP\n    y : float or `np.ndarray`\n        y coordinate of the CIP\n    s : float or `np.ndarray`\n        CIO locator, s\n    \"\"\"\n    # classical NPB matrix, IAU 2006/2000A\n    rpnb = erfa.pnm06a(jd1, jd2)\n    # CIP X, Y coordinates from array\n    x, y = erfa.bpn2xy(rpnb)\n    # CIO locator, s\n    s = erfa.s06(jd1, jd2, x, y)\n    return x, y, s\n\n\ndef aticq(srepr, astrom):\n    \"\"\"\n    A slightly modified version of the ERFA function ``eraAticq``.\n\n    ``eraAticq`` performs the transformations between two coordinate systems,\n    with the details of the transformation being encoded into the ``astrom`` array.\n\n    There are two issues with the version of aticq in ERFA. Both are associated\n    with the handling of light deflection.\n\n    The companion function ``eraAtciqz`` is meant to be its inverse. However, this\n    is not true for directions close to the Solar centre, since the light deflection\n    calculations are numerically unstable and therefore not reversible.\n\n    This version sidesteps that problem by artificially reducing the light deflection\n    for directions which are within 90 arcseconds of the Sun's position. This is the\n    same approach used by the ERFA functions above, except that they use a threshold of\n    9 arcseconds.\n\n    In addition, ERFA's aticq assumes a distant source, so there is no difference between\n    the object-Sun vector and the observer-Sun vector. This can lead to errors of up to a\n    few arcseconds in the worst case (e.g a Venus transit).\n\n    Parameters\n    ----------\n    srepr : `~astropy.coordinates.SphericalRepresentation`\n        Astrometric GCRS or CIRS position of object from observer\n    astrom : eraASTROM array\n        ERFA astrometry context, as produced by, e.g. ``eraApci13`` or ``eraApcs13``\n\n    Returns\n    -------\n    rc : float or `~numpy.ndarray`\n        Right Ascension in radians\n    dc : float or `~numpy.ndarray`\n        Declination in radians\n    \"\"\"\n    # ignore parallax effects if no distance, or far away\n    srepr_distance = srepr.distance\n    ignore_distance = srepr_distance.unit == u.one\n\n    # RA, Dec to cartesian unit vectors\n    pos = erfa.s2c(srepr.lon.radian, srepr.lat.radian)\n\n    # Bias-precession-nutation, giving GCRS proper direction.\n    ppr = erfa.trxp(astrom['bpn'], pos)\n\n    # Aberration, giving GCRS natural direction\n    d = np.zeros_like(ppr)\n    for j in range(2):\n        before = norm(ppr-d)\n        after = erfa.ab(before, astrom['v'], astrom['em'], astrom['bm1'])\n        d = after - before\n    pnat = norm(ppr-d)\n\n    # Light deflection by the Sun, giving BCRS coordinate direction\n    d = np.zeros_like(pnat)\n    for j in range(5):\n        before = norm(pnat-d)\n        if ignore_distance:\n            # No distance to object, assume a long way away\n            q = before\n        else:\n            # Find BCRS direction of Sun to object.\n            # astrom['eh'] and astrom['em'] contain Sun to observer unit vector,\n            # and distance, respectively.\n            eh = astrom['em'][..., np.newaxis] * astrom['eh']\n            # unit vector from Sun to object\n            q = eh + srepr_distance[..., np.newaxis].to_value(u.au) * before\n            sundist, q = erfa.pn(q)\n            sundist = sundist[..., np.newaxis]\n            # calculation above is extremely unstable very close to the sun\n            # in these situations, default back to ldsun-style behaviour,\n            # since this is reversible and drops to zero within stellar limb\n            q = np.where(sundist > 1.0e-10, q, before)\n\n        after = erfa.ld(1.0, before, q, astrom['eh'], astrom['em'], 1e-6)\n        d = after - before\n    pco = norm(pnat-d)\n\n    # ICRS astrometric RA, Dec\n    rc, dc = erfa.c2s(pco)\n    return erfa.anp(rc), dc\n\n\ndef atciqz(srepr, astrom):\n    \"\"\"\n    A slightly modified version of the ERFA function ``eraAtciqz``.\n\n    ``eraAtciqz`` performs the transformations between two coordinate systems,\n    with the details of the transformation being encoded into the ``astrom`` array.\n\n    There are two issues with the version of atciqz in ERFA. Both are associated\n    with the handling of light deflection.\n\n    The companion function ``eraAticq`` is meant to be its inverse. However, this\n    is not true for directions close to the Solar centre, since the light deflection\n    calculations are numerically unstable and therefore not reversible.\n\n    This version sidesteps that problem by artificially reducing the light deflection\n    for directions which are within 90 arcseconds of the Sun's position. This is the\n    same approach used by the ERFA functions above, except that they use a threshold of\n    9 arcseconds.\n\n    In addition, ERFA's atciqz assumes a distant source, so there is no difference between\n    the object-Sun vector and the observer-Sun vector. This can lead to errors of up to a\n    few arcseconds in the worst case (e.g a Venus transit).\n\n    Parameters\n    ----------\n    srepr : `~astropy.coordinates.SphericalRepresentation`\n        Astrometric ICRS position of object from observer\n    astrom : eraASTROM array\n        ERFA astrometry context, as produced by, e.g. ``eraApci13`` or ``eraApcs13``\n\n    Returns\n    -------\n    ri : float or `~numpy.ndarray`\n        Right Ascension in radians\n    di : float or `~numpy.ndarray`\n        Declination in radians\n    \"\"\"\n    # ignore parallax effects if no distance, or far away\n    srepr_distance = srepr.distance\n    ignore_distance = srepr_distance.unit == u.one\n\n    # BCRS coordinate direction (unit vector).\n    pco = erfa.s2c(srepr.lon.radian, srepr.lat.radian)\n\n    # Find BCRS direction of Sun to object\n    if ignore_distance:\n        # No distance to object, assume a long way away\n        q = pco\n    else:\n        # Find BCRS direction of Sun to object.\n        # astrom['eh'] and astrom['em'] contain Sun to observer unit vector,\n        # and distance, respectively.\n        eh = astrom['em'][..., np.newaxis] * astrom['eh']\n        # unit vector from Sun to object\n        q = eh + srepr_distance[..., np.newaxis].to_value(u.au) * pco\n        sundist, q = erfa.pn(q)\n        sundist = sundist[..., np.newaxis]\n        # calculation above is extremely unstable very close to the sun\n        # in these situations, default back to ldsun-style behaviour,\n        # since this is reversible and drops to zero within stellar limb\n        q = np.where(sundist > 1.0e-10, q, pco)\n\n    # Light deflection by the Sun, giving BCRS natural direction.\n    pnat = erfa.ld(1.0, pco, q, astrom['eh'], astrom['em'], 1e-6)\n\n    # Aberration, giving GCRS proper direction.\n    ppr = erfa.ab(pnat, astrom['v'], astrom['em'], astrom['bm1'])\n\n    # Bias-precession-nutation, giving CIRS proper direction.\n    # Has no effect if matrix is identity matrix, in which case gives GCRS ppr.\n    pi = erfa.rxp(astrom['bpn'], ppr)\n\n    # CIRS (GCRS) RA, Dec\n    ri, di = erfa.c2s(pi)\n    return erfa.anp(ri), di\n\n\ndef prepare_earth_position_vel(time):\n    \"\"\"\n    Get barycentric position and velocity, and heliocentric position of Earth\n\n    Parameters\n    ----------\n    time : `~astropy.time.Time`\n        time at which to calculate position and velocity of Earth\n\n    Returns\n    -------\n    earth_pv : `np.ndarray`\n        Barycentric position and velocity of Earth, in au and au/day\n    earth_helio : `np.ndarray`\n        Heliocentric position of Earth in au\n    \"\"\"\n    # this goes here to avoid circular import errors\n    from astropy.coordinates.solar_system import (\n        get_body_barycentric,\n        get_body_barycentric_posvel,\n        solar_system_ephemeris,\n    )\n    # get barycentric position and velocity of earth\n\n    ephemeris = solar_system_ephemeris.get()\n\n    # if we are using the builtin erfa based ephemeris,\n    # we can use the fact that epv00 already provides all we need.\n    # This avoids calling epv00 twice, once\n    # in get_body_barycentric_posvel('earth') and once in\n    # get_body_barycentric('sun')\n    if ephemeris == 'builtin':\n        jd1, jd2 = get_jd12(time, 'tdb')\n        earth_pv_heliocentric, earth_pv = erfa.epv00(jd1, jd2)\n        earth_heliocentric = earth_pv_heliocentric['p']\n\n    # all other ephemeris providers probably don't have a shortcut like this\n    else:\n        earth_p, earth_v = get_body_barycentric_posvel('earth', time)\n\n        # get heliocentric position of earth, preparing it for passing to erfa.\n        sun = get_body_barycentric('sun', time)\n        earth_heliocentric = (earth_p - sun).get_xyz(xyz_axis=-1).to_value(u.au)\n\n        # Also prepare earth_pv for passing to erfa, which wants it as\n        # a structured dtype.\n        earth_pv = pav2pv(\n            earth_p.get_xyz(xyz_axis=-1).to_value(u.au),\n            earth_v.get_xyz(xyz_axis=-1).to_value(u.au / u.d)\n        )\n\n    return earth_pv, earth_heliocentric\n\n\ndef get_offset_sun_from_barycenter(time, include_velocity=False, reverse=False):\n    \"\"\"\n    Returns the offset of the Sun center from the solar-system barycenter (SSB).\n\n    Parameters\n    ----------\n    time : `~astropy.time.Time`\n        Time at which to calculate the offset\n    include_velocity : `bool`\n        If ``True``, attach the velocity as a differential.  Defaults to ``False``.\n    reverse : `bool`\n        If ``True``, return the offset of the barycenter from the Sun.  Defaults to ``False``.\n\n    Returns\n    -------\n    `~astropy.coordinates.CartesianRepresentation`\n        The offset\n    \"\"\"\n    if include_velocity:\n        # Import here to avoid a circular import\n        from astropy.coordinates.solar_system import get_body_barycentric_posvel\n        offset_pos, offset_vel = get_body_barycentric_posvel('sun', time)\n        if reverse:\n            offset_pos, offset_vel = -offset_pos, -offset_vel\n        offset_vel = offset_vel.represent_as(CartesianDifferential)\n        offset_pos = offset_pos.with_differentials(offset_vel)\n\n    else:\n        # Import here to avoid a circular import\n        from astropy.coordinates.solar_system import get_body_barycentric\n        offset_pos = get_body_barycentric('sun', time)\n        if reverse:\n            offset_pos = -offset_pos\n\n    return offset_pos\n"},{"attributeType":"CartesianRepresentation","col":0,"comment":"null","endLoc":253,"id":15741,"name":"ICRS_LSRD_OFFSET","nodeType":"Attribute","startLoc":253,"text":"ICRS_LSRD_OFFSET"},{"attributeType":"CartesianRepresentation","col":0,"comment":"null","endLoc":254,"id":15742,"name":"LSRD_ICRS_OFFSET","nodeType":"Attribute","startLoc":254,"text":"LSRD_ICRS_OFFSET"},{"col":0,"comment":"\n    This function is used to get UT1-UTC in coordinates because normally it\n    gives an error outside the IERS range, but in coordinates we want to allow\n    it to go through but with a warning.\n    ","endLoc":95,"header":"def get_dut1utc(time)","id":15743,"name":"get_dut1utc","nodeType":"Function","startLoc":85,"text":"def get_dut1utc(time):\n    \"\"\"\n    This function is used to get UT1-UTC in coordinates because normally it\n    gives an error outside the IERS range, but in coordinates we want to allow\n    it to go through but with a warning.\n    \"\"\"\n    try:\n        return time.delta_ut1_utc\n    except iers.IERSRangeError as e:\n        _warn_iers(e)\n        return np.zeros(time.shape)"},{"col":0,"comment":"","endLoc":4,"header":"lsr.py#<anonymous>","id":15744,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"J2000 = Time('J2000')\n\nv_bary_Schoenrich2010 = r.CartesianDifferential([11.1, 12.24, 7.25]*u.km/u.s)\n\n__all__ = ['LSR', 'GalacticLSR', 'LSRK', 'LSRD']\n\ndoc_footer_lsr = \"\"\"\n    Other parameters\n    ----------------\n    v_bary : `~astropy.coordinates.representation.CartesianDifferential`\n        The velocity of the solar system barycenter with respect to the LSR, in\n        Galactic cartesian velocity components.\n\"\"\"\n\ndoc_components_gal = \"\"\"\n    l : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Galactic longitude for this object (``b`` must also be given and\n        ``representation`` must be None).\n    b : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Galactic latitude for this object (``l`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity` ['length'], optional, keyword-only\n        The Distance for this object along the line-of-sight.\n        (``representation`` must be None).\n\n    pm_l_cosb : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in Galactic longitude (including the ``cos(b)`` term)\n        for this object (``pm_b`` must also be given).\n    pm_b : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in Galactic latitude for this object (``pm_l_cosb``\n        must also be given).\n    radial_velocity : `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The radial velocity of this object.\n\"\"\"\n\nV_OFFSET_LSRK = r.CartesianDifferential([0.28999706839034606,\n                                         -17.317264789717928,\n                                         10.00141199546947]*u.km/u.s)\n\nICRS_LSRK_OFFSET = r.CartesianRepresentation([0, 0, 0]*u.au, differentials=V_OFFSET_LSRK)\n\nLSRK_ICRS_OFFSET = r.CartesianRepresentation([0, 0, 0]*u.au, differentials=-V_OFFSET_LSRK)\n\nV_OFFSET_LSRD = r.CartesianDifferential([-0.6382306360182073,\n                                         -14.585424483191094,\n                                         7.8011572411006815]*u.km/u.s)\n\nICRS_LSRD_OFFSET = r.CartesianRepresentation([0, 0, 0]*u.au, differentials=V_OFFSET_LSRD)\n\nLSRD_ICRS_OFFSET = r.CartesianRepresentation([0, 0, 0]*u.au, differentials=-V_OFFSET_LSRD)\n\nframe_transform_graph._add_merged_transform(LSR, ICRS, LSR)\n\nframe_transform_graph._add_merged_transform(GalacticLSR, Galactic, GalacticLSR)"},{"col":0,"comment":"null","endLoc":234,"header":"@frame_transform_graph.transform(AffineTransform, ICRS, HCRS)\ndef icrs_to_hcrs(icrs_coo, hcrs_frame)","id":15745,"name":"icrs_to_hcrs","nodeType":"Function","startLoc":227,"text":"@frame_transform_graph.transform(AffineTransform, ICRS, HCRS)\ndef icrs_to_hcrs(icrs_coo, hcrs_frame):\n    # this is just an origin translation so without a distance it cannot go ahead\n    if isinstance(icrs_coo.data, UnitSphericalRepresentation):\n        raise u.UnitsError(_NEED_ORIGIN_HINT.format(icrs_coo.__class__.__name__))\n\n    return None, get_offset_sun_from_barycenter(hcrs_frame.obstime, reverse=True,\n                                                include_velocity=bool(icrs_coo.data.differentials))"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":15746,"name":"_DEFAULT_PM","nodeType":"Attribute","startLoc":39,"text":"_DEFAULT_PM"},{"fileName":"icrs.py","filePath":"astropy/coordinates/builtin_frames","id":15747,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom astropy.utils.decorators import format_doc\nfrom astropy.coordinates.baseframe import base_doc\nfrom .baseradec import BaseRADecFrame, doc_components\n\n__all__ = ['ICRS']\n\n\n@format_doc(base_doc, components=doc_components, footer=\"\")\nclass ICRS(BaseRADecFrame):\n    \"\"\"\n    A coordinate or frame in the ICRS system.\n\n    If you're looking for \"J2000\" coordinates, and aren't sure if you want to\n    use this or `~astropy.coordinates.FK5`, you probably want to use ICRS. It's\n    more well-defined as a catalog coordinate and is an inertial system, and is\n    very close (within tens of milliarcseconds) to J2000 equatorial.\n\n    For more background on the ICRS and related coordinate transformations, see\n    the references provided in the  :ref:`astropy:astropy-coordinates-seealso`\n    section of the documentation.\n    \"\"\"\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":15748,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"fileName":"hadec.py","filePath":"astropy/coordinates/builtin_frames","id":15749,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport numpy as np\n\nfrom astropy import units as u\nfrom astropy.utils.decorators import format_doc\nfrom astropy.coordinates import representation as r\nfrom astropy.coordinates.baseframe import BaseCoordinateFrame, RepresentationMapping, base_doc\nfrom astropy.coordinates.attributes import (TimeAttribute,\n                                            QuantityAttribute,\n                                            EarthLocationAttribute)\n\n__all__ = ['HADec']\n\n\ndoc_components = \"\"\"\n    ha : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Hour Angle for this object (``dec`` must also be given and\n        ``representation`` must be None).\n    dec : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Declination for this object (``ha`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity` ['length'], optional, keyword-only\n        The Distance for this object along the line-of-sight.\n\n    pm_ha_cosdec : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in hour angle (including the ``cos(dec)`` factor) for\n        this object (``pm_dec`` must also be given).\n    pm_dec : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in declination for this object (``pm_ha_cosdec`` must\n        also be given).\n    radial_velocity : `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The radial velocity of this object.\"\"\"\n\ndoc_footer = \"\"\"\n    Other parameters\n    ----------------\n    obstime : `~astropy.time.Time`\n        The time at which the observation is taken.  Used for determining the\n        position and orientation of the Earth.\n    location : `~astropy.coordinates.EarthLocation`\n        The location on the Earth.  This can be specified either as an\n        `~astropy.coordinates.EarthLocation` object or as anything that can be\n        transformed to an `~astropy.coordinates.ITRS` frame.\n    pressure : `~astropy.units.Quantity` ['pressure']\n        The atmospheric pressure as an `~astropy.units.Quantity` with pressure\n        units.  This is necessary for performing refraction corrections.\n        Setting this to 0 (the default) will disable refraction calculations\n        when transforming to/from this frame.\n    temperature : `~astropy.units.Quantity` ['temperature']\n        The ground-level temperature as an `~astropy.units.Quantity` in\n        deg C.  This is necessary for performing refraction corrections.\n    relative_humidity : `~astropy.units.Quantity` ['dimensionless'] or number.\n        The relative humidity as a dimensionless quantity between 0 to 1.\n        This is necessary for performing refraction corrections.\n    obswl : `~astropy.units.Quantity` ['length']\n        The average wavelength of observations as an `~astropy.units.Quantity`\n         with length units.  This is necessary for performing refraction\n         corrections.\n\n    Notes\n    -----\n    The refraction model is based on that implemented in ERFA, which is fast\n    but becomes inaccurate for altitudes below about 5 degrees.  Near and below\n    altitudes of 0, it can even give meaningless answers, and in this case\n    transforming to HADec and back to another frame can give highly discrepant\n    results.  For much better numerical stability, leave the ``pressure`` at\n    ``0`` (the default), thereby disabling the refraction correction and\n    yielding \"topocentric\" equatorial coordinates.\n    \"\"\"\n\n\n@format_doc(base_doc, components=doc_components, footer=doc_footer)\nclass HADec(BaseCoordinateFrame):\n    \"\"\"\n    A coordinate or frame in the Hour Angle-Declination system (Equatorial\n    coordinates) with respect to the WGS84 ellipsoid.  Hour Angle is oriented\n    with respect to upper culmination such that the hour angle is negative to\n    the East and positive to the West.\n\n    This frame is assumed to *include* refraction effects if the ``pressure``\n    frame attribute is non-zero.\n\n    The frame attributes are listed under **Other Parameters**, which are\n    necessary for transforming from HADec to some other system.\n    \"\"\"\n\n    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'ha', u.hourangle),\n            RepresentationMapping('lat', 'dec')\n        ]\n    }\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential\n\n    obstime = TimeAttribute(default=None)\n    location = EarthLocationAttribute(default=None)\n    pressure = QuantityAttribute(default=0, unit=u.hPa)\n    temperature = QuantityAttribute(default=0, unit=u.deg_C)\n    relative_humidity = QuantityAttribute(default=0, unit=u.dimensionless_unscaled)\n    obswl = QuantityAttribute(default=1*u.micron, unit=u.micron)\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        if self.has_data:\n            self._set_data_lon_wrap_angle(self.data)\n\n    @staticmethod\n    def _set_data_lon_wrap_angle(data):\n        if hasattr(data, 'lon'):\n            data.lon.wrap_angle = 180. * u.deg\n        return data\n\n    def represent_as(self, base, s='base', in_frame_units=False):\n        \"\"\"\n        Ensure the wrap angle for any spherical\n        representations.\n        \"\"\"\n        data = super().represent_as(base, s, in_frame_units=in_frame_units)\n        self._set_data_lon_wrap_angle(data)\n        return data\n\n\n# self-transform defined in cirs_observed_transforms.py\n"},{"col":0,"comment":"","endLoc":4,"header":"icrs.py#<anonymous>","id":15750,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['ICRS']"},{"attributeType":"null","col":16,"comment":"null","endLoc":8,"id":15751,"name":"np","nodeType":"Attribute","startLoc":8,"text":"np"},{"attributeType":"null","col":29,"comment":"null","endLoc":10,"id":15752,"name":"u","nodeType":"Attribute","startLoc":10,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":211,"id":15753,"name":"_NEED_ORIGIN_HINT","nodeType":"Attribute","startLoc":211,"text":"_NEED_ORIGIN_HINT"},{"col":0,"comment":"","endLoc":6,"header":"icrs_cirs_transforms.py#<anonymous>","id":15754,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nContains the transformation functions for getting from ICRS/HCRS to CIRS and\nanything in between (currently that means GCRS)\n\"\"\"\n\n_NEED_ORIGIN_HINT = (\"The input {0} coordinates do not have length units. This \"\n                     \"probably means you created coordinates with lat/lon but \"\n                     \"no distance.  Heliocentric<->ICRS transforms cannot \"\n                     \"function in this case because there is an origin shift.\")\n\nframe_transform_graph._add_merged_transform(CIRS, ICRS, CIRS)\n\nframe_transform_graph._add_merged_transform(GCRS, ICRS, GCRS)\n\nframe_transform_graph._add_merged_transform(HCRS, ICRS, HCRS)"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":15755,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":15756,"name":"doc_components","nodeType":"Attribute","startLoc":17,"text":"doc_components"},{"attributeType":"null","col":0,"comment":"null","endLoc":36,"id":15757,"name":"doc_footer","nodeType":"Attribute","startLoc":36,"text":"doc_footer"},{"fileName":"ecliptic.py","filePath":"astropy/coordinates/builtin_frames","id":15758,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom astropy import units as u\nfrom astropy.utils.decorators import format_doc\nfrom astropy.coordinates import representation as r\nfrom astropy.coordinates.baseframe import BaseCoordinateFrame, base_doc\nfrom astropy.coordinates.attributes import TimeAttribute, QuantityAttribute\nfrom .utils import EQUINOX_J2000, DEFAULT_OBSTIME\n\n__all__ = ['GeocentricMeanEcliptic', 'BarycentricMeanEcliptic',\n           'HeliocentricMeanEcliptic', 'BaseEclipticFrame',\n           'GeocentricTrueEcliptic', 'BarycentricTrueEcliptic',\n           'HeliocentricTrueEcliptic',\n           'HeliocentricEclipticIAU76', 'CustomBarycentricEcliptic']\n\n\ndoc_components_ecl = \"\"\"\n    lon : `~astropy.coordinates.Angle`, optional, keyword-only\n        The ecliptic longitude for this object (``lat`` must also be given and\n        ``representation`` must be None).\n    lat : `~astropy.coordinates.Angle`, optional, keyword-only\n        The ecliptic latitude for this object (``lon`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity` ['length'], optional, keyword-only\n        The distance for this object from the {0}.\n        (``representation`` must be None).\n\n    pm_lon_coslat : `~astropy.units.Quantity` ['angualar speed'], optional, keyword-only\n        The proper motion in the ecliptic longitude (including the ``cos(lat)``\n        factor) for this object (``pm_lat`` must also be given).\n    pm_lat : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in the ecliptic latitude for this object\n        (``pm_lon_coslat`` must also be given).\n    radial_velocity : `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The radial velocity of this object.\n\"\"\"\n\n\n@format_doc(base_doc,\n            components=doc_components_ecl.format('specified location'),\n            footer=\"\")\nclass BaseEclipticFrame(BaseCoordinateFrame):\n    \"\"\"\n    A base class for frames that have names and conventions like that of\n    ecliptic frames.\n\n    .. warning::\n            In the current version of astropy, the ecliptic frames do not yet have\n            stringent accuracy tests.  We recommend you test to \"known-good\" cases\n            to ensure this frames are what you are looking for. (and then ideally\n            you would contribute these tests to Astropy!)\n    \"\"\"\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential\n\n\ndoc_footer_geo = \"\"\"\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`, optional\n        The date to assume for this frame.  Determines the location of the\n        x-axis and the location of the Earth (necessary for transformation to\n        non-geocentric systems). Defaults to the 'J2000' equinox.\n    obstime : `~astropy.time.Time`, optional\n        The time at which the observation is taken.  Used for determining the\n        position of the Earth. Defaults to J2000.\n\"\"\"\n\n\n@format_doc(base_doc, components=doc_components_ecl.format('geocenter'),\n            footer=doc_footer_geo)\nclass GeocentricMeanEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Geocentric mean ecliptic coordinates.  These origin of the coordinates are the\n    geocenter (Earth), with the x axis pointing to the *mean* (not true) equinox\n    at the time specified by the ``equinox`` attribute, and the xy-plane in the\n    plane of the ecliptic for that date.\n\n    Be aware that the definition of \"geocentric\" here means that this frame\n    *includes* light deflection from the sun, aberration, etc when transforming\n    to/from e.g. ICRS.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n\n\n@format_doc(base_doc, components=doc_components_ecl.format('geocenter'),\n            footer=doc_footer_geo)\nclass GeocentricTrueEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Geocentric true ecliptic coordinates.  These origin of the coordinates are the\n    geocenter (Earth), with the x axis pointing to the *true* (not mean) equinox\n    at the time specified by the ``equinox`` attribute, and the xy-plane in the\n    plane of the ecliptic for that date.\n\n    Be aware that the definition of \"geocentric\" here means that this frame\n    *includes* light deflection from the sun, aberration, etc when transforming\n    to/from e.g. ICRS.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n\n\ndoc_footer_bary = \"\"\"\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`, optional\n        The date to assume for this frame.  Determines the location of the\n        x-axis and the location of the Earth and Sun.\n        Defaults to the 'J2000' equinox.\n\"\"\"\n\n\n@format_doc(base_doc, components=doc_components_ecl.format(\"barycenter\"),\n            footer=doc_footer_bary)\nclass BarycentricMeanEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Barycentric mean ecliptic coordinates.  These origin of the coordinates are the\n    barycenter of the solar system, with the x axis pointing in the direction of\n    the *mean* (not true) equinox as at the time specified by the ``equinox``\n    attribute (as seen from Earth), and the xy-plane in the plane of the\n    ecliptic for that date.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n\n\n@format_doc(base_doc, components=doc_components_ecl.format(\"barycenter\"),\n            footer=doc_footer_bary)\nclass BarycentricTrueEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Barycentric true ecliptic coordinates.  These origin of the coordinates are the\n    barycenter of the solar system, with the x axis pointing in the direction of\n    the *true* (not mean) equinox as at the time specified by the ``equinox``\n    attribute (as seen from Earth), and the xy-plane in the plane of the\n    ecliptic for that date.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n\n\ndoc_footer_helio = \"\"\"\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`, optional\n        The date to assume for this frame.  Determines the location of the\n        x-axis and the location of the Earth and Sun.\n        Defaults to the 'J2000' equinox.\n    obstime : `~astropy.time.Time`, optional\n        The time at which the observation is taken.  Used for determining the\n        position of the Sun. Defaults to J2000.\n\"\"\"\n\n\n@format_doc(base_doc, components=doc_components_ecl.format(\"sun's center\"),\n            footer=doc_footer_helio)\nclass HeliocentricMeanEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Heliocentric mean ecliptic coordinates.  These origin of the coordinates are the\n    center of the sun, with the x axis pointing in the direction of\n    the *mean* (not true) equinox as at the time specified by the ``equinox``\n    attribute (as seen from Earth), and the xy-plane in the plane of the\n    ecliptic for that date.\n\n    The frame attributes are listed under **Other Parameters**.\n\n    {params}\n\n\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n\n\n@format_doc(base_doc, components=doc_components_ecl.format(\"sun's center\"),\n            footer=doc_footer_helio)\nclass HeliocentricTrueEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Heliocentric true ecliptic coordinates.  These origin of the coordinates are the\n    center of the sun, with the x axis pointing in the direction of\n    the *true* (not mean) equinox as at the time specified by the ``equinox``\n    attribute (as seen from Earth), and the xy-plane in the plane of the\n    ecliptic for that date.\n\n    The frame attributes are listed under **Other Parameters**.\n\n    {params}\n\n\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n\n\n@format_doc(base_doc, components=doc_components_ecl.format(\"sun's center\"),\n            footer=\"\")\nclass HeliocentricEclipticIAU76(BaseEclipticFrame):\n    \"\"\"\n    Heliocentric mean (IAU 1976) ecliptic coordinates.  These origin of the coordinates are the\n    center of the sun, with the x axis pointing in the direction of\n    the *mean* (not true) equinox of J2000, and the xy-plane in the plane of the\n    ecliptic of J2000 (according to the IAU 1976/1980 obliquity model).\n    It has, therefore, a fixed equinox and an older obliquity value\n    than the rest of the frames.\n\n    The frame attributes are listed under **Other Parameters**.\n\n    {params}\n\n\n    \"\"\"\n\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n\n\n@format_doc(base_doc, components=doc_components_ecl.format(\"barycenter\"),\n            footer=\"\")\nclass CustomBarycentricEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Barycentric ecliptic coordinates with custom obliquity.\n    These origin of the coordinates are the\n    barycenter of the solar system, with the x axis pointing in the direction of\n    the *mean* (not true) equinox of J2000, and the xy-plane in the plane of the\n    ecliptic tilted a custom obliquity angle.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    obliquity = QuantityAttribute(default=84381.448 * u.arcsec, unit=u.arcsec)\n"},{"col":0,"comment":"","endLoc":4,"header":"hadec.py#<anonymous>","id":15759,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['HADec']\n\ndoc_components = \"\"\"\n    ha : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Hour Angle for this object (``dec`` must also be given and\n        ``representation`` must be None).\n    dec : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Declination for this object (``ha`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity` ['length'], optional, keyword-only\n        The Distance for this object along the line-of-sight.\n\n    pm_ha_cosdec : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in hour angle (including the ``cos(dec)`` factor) for\n        this object (``pm_dec`` must also be given).\n    pm_dec : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in declination for this object (``pm_ha_cosdec`` must\n        also be given).\n    radial_velocity : `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The radial velocity of this object.\"\"\"\n\ndoc_footer = \"\"\"\n    Other parameters\n    ----------------\n    obstime : `~astropy.time.Time`\n        The time at which the observation is taken.  Used for determining the\n        position and orientation of the Earth.\n    location : `~astropy.coordinates.EarthLocation`\n        The location on the Earth.  This can be specified either as an\n        `~astropy.coordinates.EarthLocation` object or as anything that can be\n        transformed to an `~astropy.coordinates.ITRS` frame.\n    pressure : `~astropy.units.Quantity` ['pressure']\n        The atmospheric pressure as an `~astropy.units.Quantity` with pressure\n        units.  This is necessary for performing refraction corrections.\n        Setting this to 0 (the default) will disable refraction calculations\n        when transforming to/from this frame.\n    temperature : `~astropy.units.Quantity` ['temperature']\n        The ground-level temperature as an `~astropy.units.Quantity` in\n        deg C.  This is necessary for performing refraction corrections.\n    relative_humidity : `~astropy.units.Quantity` ['dimensionless'] or number.\n        The relative humidity as a dimensionless quantity between 0 to 1.\n        This is necessary for performing refraction corrections.\n    obswl : `~astropy.units.Quantity` ['length']\n        The average wavelength of observations as an `~astropy.units.Quantity`\n         with length units.  This is necessary for performing refraction\n         corrections.\n\n    Notes\n    -----\n    The refraction model is based on that implemented in ERFA, which is fast\n    but becomes inaccurate for altitudes below about 5 degrees.  Near and below\n    altitudes of 0, it can even give meaningless answers, and in this case\n    transforming to HADec and back to another frame can give highly discrepant\n    results.  For much better numerical stability, leave the ``pressure`` at\n    ``0`` (the default), thereby disabling the refraction correction and\n    yielding \"topocentric\" equatorial coordinates.\n    \"\"\""},{"className":"GeocentricMeanEcliptic","col":0,"comment":"\n    Geocentric mean ecliptic coordinates.  These origin of the coordinates are the\n    geocenter (Earth), with the x axis pointing to the *mean* (not true) equinox\n    at the time specified by the ``equinox`` attribute, and the xy-plane in the\n    plane of the ecliptic for that date.\n\n    Be aware that the definition of \"geocentric\" here means that this frame\n    *includes* light deflection from the sun, aberration, etc when transforming\n    to/from e.g. ICRS.\n\n    The frame attributes are listed under **Other Parameters**.\n    ","endLoc":89,"id":15760,"nodeType":"Class","startLoc":72,"text":"@format_doc(base_doc, components=doc_components_ecl.format('geocenter'),\n            footer=doc_footer_geo)\nclass GeocentricMeanEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Geocentric mean ecliptic coordinates.  These origin of the coordinates are the\n    geocenter (Earth), with the x axis pointing to the *mean* (not true) equinox\n    at the time specified by the ``equinox`` attribute, and the xy-plane in the\n    plane of the ecliptic for that date.\n\n    Be aware that the definition of \"geocentric\" here means that this frame\n    *includes* light deflection from the sun, aberration, etc when transforming\n    to/from e.g. ICRS.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":88,"id":15761,"name":"equinox","nodeType":"Attribute","startLoc":88,"text":"equinox"},{"fileName":"supergalactic.py","filePath":"astropy/coordinates/builtin_frames","id":15762,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom astropy import units as u\nfrom astropy.utils.decorators import format_doc\nfrom astropy.coordinates import representation as r\nfrom astropy.coordinates.baseframe import BaseCoordinateFrame, RepresentationMapping, base_doc\nfrom .galactic import Galactic\n\n__all__ = ['Supergalactic']\n\n\ndoc_components = \"\"\"\n    sgl : `~astropy.coordinates.Angle`, optional, keyword-only\n        The supergalactic longitude for this object (``sgb`` must also be given and\n        ``representation`` must be None).\n    sgb : `~astropy.coordinates.Angle`, optional, keyword-only\n        The supergalactic latitude for this object (``sgl`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The Distance for this object along the line-of-sight.\n\n    pm_sgl_cossgb : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in Right Ascension for this object (``pm_sgb`` must\n        also be given).\n    pm_sgb : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in Declination for this object (``pm_sgl_cossgb`` must\n        also be given).\n    radial_velocity : `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The radial velocity of this object.\n\"\"\"\n\n\n@format_doc(base_doc, components=doc_components, footer=\"\")\nclass Supergalactic(BaseCoordinateFrame):\n    \"\"\"\n    Supergalactic Coordinates\n    (see Lahav et al. 2000, <https://ui.adsabs.harvard.edu/abs/2000MNRAS.312..166L>,\n    and references therein).\n    \"\"\"\n\n    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'sgl'),\n            RepresentationMapping('lat', 'sgb')\n        ],\n        r.CartesianRepresentation: [\n            RepresentationMapping('x', 'sgx'),\n            RepresentationMapping('y', 'sgy'),\n            RepresentationMapping('z', 'sgz')\n        ],\n        r.CartesianDifferential: [\n            RepresentationMapping('d_x', 'v_x', u.km/u.s),\n            RepresentationMapping('d_y', 'v_y', u.km/u.s),\n            RepresentationMapping('d_z', 'v_z', u.km/u.s)\n        ],\n    }\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential\n\n    # North supergalactic pole in Galactic coordinates.\n    # Needed for transformations to/from Galactic coordinates.\n    _nsgp_gal = Galactic(l=47.37*u.degree, b=+6.32*u.degree)\n"},{"fileName":"fk4_fk5_transforms.py","filePath":"astropy/coordinates/builtin_frames","id":15763,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport numpy as np\n\nfrom astropy.coordinates.baseframe import frame_transform_graph\nfrom astropy.coordinates.transformations import DynamicMatrixTransform\nfrom astropy.coordinates.matrix_utilities import matrix_product, matrix_transpose\n\n\nfrom .fk4 import FK4NoETerms\nfrom .fk5 import FK5\nfrom .utils import EQUINOX_B1950, EQUINOX_J2000\n\n\n# FK5 to/from FK4 ------------------->\n# B1950->J2000 matrix from Murray 1989 A&A 218,325 eqn 28\n_B1950_TO_J2000_M = np.array(\n    [[0.9999256794956877, -0.0111814832204662, -0.0048590038153592],\n     [0.0111814832391717, 0.9999374848933135, -0.0000271625947142],\n     [0.0048590037723143, -0.0000271702937440, 0.9999881946023742]])\n\n_FK4_CORR = np.array(\n    [[-0.0026455262, -1.1539918689, +2.1111346190],\n     [+1.1540628161, -0.0129042997, +0.0236021478],\n     [-2.1112979048, -0.0056024448, +0.0102587734]]) * 1.e-6\n\n\ndef _fk4_B_matrix(obstime):\n    \"\"\"\n    This is a correction term in the FK4 transformations because FK4 is a\n    rotating system - see Murray 89 eqn 29\n    \"\"\"\n    # Note this is *julian century*, not besselian\n    T = (obstime.jyear - 1950.) / 100.\n    if getattr(T, 'shape', ()):\n        # Ensure we broadcast possibly arrays of times properly.\n        T.shape += (1, 1)\n    return _B1950_TO_J2000_M + _FK4_CORR * T\n\n\n# This transformation can't be static because the observation date is needed.\n@frame_transform_graph.transform(DynamicMatrixTransform, FK4NoETerms, FK5)\ndef fk4_no_e_to_fk5(fk4noecoord, fk5frame):\n    # Correction terms for FK4 being a rotating system\n    B = _fk4_B_matrix(fk4noecoord.obstime)\n\n    # construct both precession matricies - if the equinoxes are B1950 and\n    # J2000, these are just identity matricies\n    pmat1 = fk4noecoord._precession_matrix(fk4noecoord.equinox, EQUINOX_B1950)\n    pmat2 = fk5frame._precession_matrix(EQUINOX_J2000, fk5frame.equinox)\n\n    return matrix_product(pmat2, B, pmat1)\n\n\n# This transformation can't be static because the observation date is needed.\n@frame_transform_graph.transform(DynamicMatrixTransform, FK5, FK4NoETerms)\ndef fk5_to_fk4_no_e(fk5coord, fk4noeframe):\n    # Get transposed version of the rotating correction terms... so with the\n    # transpose this takes us from FK5/J200 to FK4/B1950\n    B = matrix_transpose(_fk4_B_matrix(fk4noeframe.obstime))\n\n    # construct both precession matricies - if the equinoxes are B1950 and\n    # J2000, these are just identity matricies\n    pmat1 = fk5coord._precession_matrix(fk5coord.equinox, EQUINOX_J2000)\n    pmat2 = fk4noeframe._precession_matrix(EQUINOX_B1950, fk4noeframe.equinox)\n\n    return matrix_product(pmat2, B, pmat1)\n"},{"className":"Supergalactic","col":0,"comment":"\n    Supergalactic Coordinates\n    (see Lahav et al. 2000, <https://ui.adsabs.harvard.edu/abs/2000MNRAS.312..166L>,\n    and references therein).\n    ","endLoc":64,"id":15764,"nodeType":"Class","startLoc":34,"text":"@format_doc(base_doc, components=doc_components, footer=\"\")\nclass Supergalactic(BaseCoordinateFrame):\n    \"\"\"\n    Supergalactic Coordinates\n    (see Lahav et al. 2000, <https://ui.adsabs.harvard.edu/abs/2000MNRAS.312..166L>,\n    and references therein).\n    \"\"\"\n\n    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'sgl'),\n            RepresentationMapping('lat', 'sgb')\n        ],\n        r.CartesianRepresentation: [\n            RepresentationMapping('x', 'sgx'),\n            RepresentationMapping('y', 'sgy'),\n            RepresentationMapping('z', 'sgz')\n        ],\n        r.CartesianDifferential: [\n            RepresentationMapping('d_x', 'v_x', u.km/u.s),\n            RepresentationMapping('d_y', 'v_y', u.km/u.s),\n            RepresentationMapping('d_z', 'v_z', u.km/u.s)\n        ],\n    }\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential\n\n    # North supergalactic pole in Galactic coordinates.\n    # Needed for transformations to/from Galactic coordinates.\n    _nsgp_gal = Galactic(l=47.37*u.degree, b=+6.32*u.degree)"},{"attributeType":"null","col":4,"comment":"null","endLoc":42,"id":15765,"name":"frame_specific_representation_info","nodeType":"Attribute","startLoc":42,"text":"frame_specific_representation_info"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":89,"id":15766,"name":"obstime","nodeType":"Attribute","startLoc":89,"text":"obstime"},{"attributeType":"SphericalRepresentation","col":4,"comment":"null","endLoc":59,"id":15767,"name":"default_representation","nodeType":"Attribute","startLoc":59,"text":"default_representation"},{"className":"BarycentricMeanEcliptic","col":0,"comment":"\n    Barycentric mean ecliptic coordinates.  These origin of the coordinates are the\n    barycenter of the solar system, with the x axis pointing in the direction of\n    the *mean* (not true) equinox as at the time specified by the ``equinox``\n    attribute (as seen from Earth), and the xy-plane in the plane of the\n    ecliptic for that date.\n\n    The frame attributes are listed under **Other Parameters**.\n    ","endLoc":135,"id":15768,"nodeType":"Class","startLoc":122,"text":"@format_doc(base_doc, components=doc_components_ecl.format(\"barycenter\"),\n            footer=doc_footer_bary)\nclass BarycentricMeanEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Barycentric mean ecliptic coordinates.  These origin of the coordinates are the\n    barycenter of the solar system, with the x axis pointing in the direction of\n    the *mean* (not true) equinox as at the time specified by the ``equinox``\n    attribute (as seen from Earth), and the xy-plane in the plane of the\n    ecliptic for that date.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":135,"id":15769,"name":"equinox","nodeType":"Attribute","startLoc":135,"text":"equinox"},{"col":0,"comment":"\n    This is a correction term in the FK4 transformations because FK4 is a\n    rotating system - see Murray 89 eqn 29\n    ","endLoc":40,"header":"def _fk4_B_matrix(obstime)","id":15770,"name":"_fk4_B_matrix","nodeType":"Function","startLoc":30,"text":"def _fk4_B_matrix(obstime):\n    \"\"\"\n    This is a correction term in the FK4 transformations because FK4 is a\n    rotating system - see Murray 89 eqn 29\n    \"\"\"\n    # Note this is *julian century*, not besselian\n    T = (obstime.jyear - 1950.) / 100.\n    if getattr(T, 'shape', ()):\n        # Ensure we broadcast possibly arrays of times properly.\n        T.shape += (1, 1)\n    return _B1950_TO_J2000_M + _FK4_CORR * T"},{"col":0,"comment":"null","endLoc":575,"header":"def _check_coord_repr_diff_types(c)","id":15771,"name":"_check_coord_repr_diff_types","nodeType":"Function","startLoc":562,"text":"def _check_coord_repr_diff_types(c):\n    if isinstance(c.data, r.UnitSphericalRepresentation):\n        raise ConvertError(\"Transforming to/from a Galactocentric frame \"\n                           \"requires a 3D coordinate, e.g. (angle, angle, \"\n                           \"distance) or (x, y, z).\")\n\n    if ('s' in c.data.differentials and\n            isinstance(c.data.differentials['s'],\n                       (r.UnitSphericalDifferential,\n                        r.UnitSphericalCosLatDifferential,\n                        r.RadialDifferential))):\n        raise ConvertError(\"Transforming to/from a Galactocentric frame \"\n                           \"requires a 3D velocity, e.g., proper motion \"\n                           \"components and radial velocity.\")"},{"attributeType":"null","col":16,"comment":"null","endLoc":9,"id":15772,"name":"np","nodeType":"Attribute","startLoc":9,"text":"np"},{"col":0,"comment":"","endLoc":5,"header":"generate_ref_ast.py#<anonymous>","id":15773,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nThis series of functions are used to generate the reference CSV files\nused by the accuracy tests.  Running this as a command-line script will\ngenerate them all.\n\"\"\"\n\nif __name__ == '__main__':\n    ref_fk4_no_e_fk4()\n    ref_fk4_no_e_fk5()\n    ref_galactic_fk4()\n    ref_icrs_fk5()"},{"className":"BarycentricTrueEcliptic","col":0,"comment":"\n    Barycentric true ecliptic coordinates.  These origin of the coordinates are the\n    barycenter of the solar system, with the x axis pointing in the direction of\n    the *true* (not mean) equinox as at the time specified by the ``equinox``\n    attribute (as seen from Earth), and the xy-plane in the plane of the\n    ecliptic for that date.\n\n    The frame attributes are listed under **Other Parameters**.\n    ","endLoc":151,"id":15774,"nodeType":"Class","startLoc":138,"text":"@format_doc(base_doc, components=doc_components_ecl.format(\"barycenter\"),\n            footer=doc_footer_bary)\nclass BarycentricTrueEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Barycentric true ecliptic coordinates.  These origin of the coordinates are the\n    barycenter of the solar system, with the x axis pointing in the direction of\n    the *true* (not mean) equinox as at the time specified by the ``equinox``\n    attribute (as seen from Earth), and the xy-plane in the plane of the\n    ecliptic for that date.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":151,"id":15775,"name":"equinox","nodeType":"Attribute","startLoc":151,"text":"equinox"},{"col":0,"comment":"null","endLoc":54,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, FK4NoETerms, FK5)\ndef fk4_no_e_to_fk5(fk4noecoord, fk5frame)","id":15776,"name":"fk4_no_e_to_fk5","nodeType":"Function","startLoc":44,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, FK4NoETerms, FK5)\ndef fk4_no_e_to_fk5(fk4noecoord, fk5frame):\n    # Correction terms for FK4 being a rotating system\n    B = _fk4_B_matrix(fk4noecoord.obstime)\n\n    # construct both precession matricies - if the equinoxes are B1950 and\n    # J2000, these are just identity matricies\n    pmat1 = fk4noecoord._precession_matrix(fk4noecoord.equinox, EQUINOX_B1950)\n    pmat2 = fk5frame._precession_matrix(EQUINOX_J2000, fk5frame.equinox)\n\n    return matrix_product(pmat2, B, pmat1)"},{"className":"HeliocentricMeanEcliptic","col":0,"comment":"\n    Heliocentric mean ecliptic coordinates.  These origin of the coordinates are the\n    center of the sun, with the x axis pointing in the direction of\n    the *mean* (not true) equinox as at the time specified by the ``equinox``\n    attribute (as seen from Earth), and the xy-plane in the plane of the\n    ecliptic for that date.\n\n    The frame attributes are listed under **Other Parameters**.\n\n    {params}\n\n\n    ","endLoc":185,"id":15777,"nodeType":"Class","startLoc":167,"text":"@format_doc(base_doc, components=doc_components_ecl.format(\"sun's center\"),\n            footer=doc_footer_helio)\nclass HeliocentricMeanEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Heliocentric mean ecliptic coordinates.  These origin of the coordinates are the\n    center of the sun, with the x axis pointing in the direction of\n    the *mean* (not true) equinox as at the time specified by the ``equinox``\n    attribute (as seen from Earth), and the xy-plane in the plane of the\n    ecliptic for that date.\n\n    The frame attributes are listed under **Other Parameters**.\n\n    {params}\n\n\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":184,"id":15778,"name":"equinox","nodeType":"Attribute","startLoc":184,"text":"equinox"},{"fileName":"ecliptic_transforms.py","filePath":"astropy/coordinates/builtin_frames","id":15779,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nContains the transformation functions for getting to/from ecliptic systems.\n\"\"\"\nimport erfa\n\nfrom astropy import units as u\nfrom astropy.coordinates.baseframe import frame_transform_graph\nfrom astropy.coordinates.transformations import (\n    FunctionTransformWithFiniteDifference, DynamicMatrixTransform,\n    AffineTransform,\n)\nfrom astropy.coordinates.matrix_utilities import (rotation_matrix,\n                                                  matrix_product,\n                                                  matrix_transpose)\n\nfrom .icrs import ICRS\nfrom .gcrs import GCRS\nfrom .ecliptic import (GeocentricMeanEcliptic, BarycentricMeanEcliptic, HeliocentricMeanEcliptic,\n                       GeocentricTrueEcliptic, BarycentricTrueEcliptic, HeliocentricTrueEcliptic,\n                       HeliocentricEclipticIAU76, CustomBarycentricEcliptic)\nfrom .utils import get_jd12, get_offset_sun_from_barycenter, EQUINOX_J2000\nfrom astropy.coordinates.errors import UnitsError\n\n\ndef _mean_ecliptic_rotation_matrix(equinox):\n    # This code just calls ecm06, which uses the precession matrix according to the\n    # IAU 2006 model, but leaves out nutation. This brings the results closer to what\n    # other libraries give (see https://github.com/astropy/astropy/pull/6508).\n    return erfa.ecm06(*get_jd12(equinox, 'tt'))\n\n\ndef _true_ecliptic_rotation_matrix(equinox):\n    # This code calls the same routines as done in pnm06a from ERFA, which\n    # retrieves the precession matrix (including frame bias) according to\n    # the IAU 2006 model, and including the nutation.\n    # This family of systems is less popular\n    # (see https://github.com/astropy/astropy/pull/6508).\n    jd1, jd2 = get_jd12(equinox, 'tt')\n    # Here, we call the three routines from erfa.pnm06a separately,\n    # so that we can keep the nutation for calculating the true obliquity\n    # (which is a fairly expensive operation); see gh-11000.\n    # pnm06a: Fukushima-Williams angles for frame bias and precession.\n    # (ERFA names short for F-W's gamma_bar, phi_bar, psi_bar and epsilon_A).\n    gamb, phib, psib, epsa = erfa.pfw06(jd1, jd2)\n    # pnm06a: Nutation components (in longitude and obliquity).\n    dpsi, deps = erfa.nut06a(jd1, jd2)\n    # pnm06a: Equinox based nutation x precession x bias matrix.\n    rnpb = erfa.fw2m(gamb, phib, psib+dpsi, epsa+deps)\n    # calculate the true obliquity of the ecliptic\n    obl = erfa.obl06(jd1, jd2)+deps\n    return matrix_product(rotation_matrix(obl << u.radian, 'x'), rnpb)\n\n\ndef _obliquity_only_rotation_matrix(obl=erfa.obl80(EQUINOX_J2000.jd1, EQUINOX_J2000.jd2) * u.radian):\n    # This code only accounts for the obliquity,\n    # which can be passed explicitly.\n    # The default value is the IAU 1980 value for J2000,\n    # which is computed using obl80 from ERFA:\n    #\n    # obl = erfa.obl80(EQUINOX_J2000.jd1, EQUINOX_J2000.jd2) * u.radian\n    return rotation_matrix(obl, \"x\")\n\n\n# MeanEcliptic frames\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 GCRS, GeocentricMeanEcliptic,\n                                 finite_difference_frameattr_name='equinox')\ndef gcrs_to_geoecliptic(gcrs_coo, to_frame):\n    # first get us to a 0 pos/vel GCRS at the target equinox\n    gcrs_coo2 = gcrs_coo.transform_to(GCRS(obstime=to_frame.obstime))\n\n    rmat = _mean_ecliptic_rotation_matrix(to_frame.equinox)\n    newrepr = gcrs_coo2.cartesian.transform(rmat)\n    return to_frame.realize_frame(newrepr)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GeocentricMeanEcliptic, GCRS)\ndef geoecliptic_to_gcrs(from_coo, gcrs_frame):\n    rmat = _mean_ecliptic_rotation_matrix(from_coo.equinox)\n    newrepr = from_coo.cartesian.transform(matrix_transpose(rmat))\n    gcrs = GCRS(newrepr, obstime=from_coo.obstime)\n\n    # now do any needed offsets (no-op if same obstime and 0 pos/vel)\n    return gcrs.transform_to(gcrs_frame)\n\n\n@frame_transform_graph.transform(DynamicMatrixTransform, ICRS, BarycentricMeanEcliptic)\ndef icrs_to_baryecliptic(from_coo, to_frame):\n    return _mean_ecliptic_rotation_matrix(to_frame.equinox)\n\n\n@frame_transform_graph.transform(DynamicMatrixTransform, BarycentricMeanEcliptic, ICRS)\ndef baryecliptic_to_icrs(from_coo, to_frame):\n    return matrix_transpose(icrs_to_baryecliptic(to_frame, from_coo))\n\n\n_NEED_ORIGIN_HINT = (\"The input {0} coordinates do not have length units. This \"\n                     \"probably means you created coordinates with lat/lon but \"\n                     \"no distance.  Heliocentric<->ICRS transforms cannot \"\n                     \"function in this case because there is an origin shift.\")\n\n\n@frame_transform_graph.transform(AffineTransform,\n                                 ICRS, HeliocentricMeanEcliptic)\ndef icrs_to_helioecliptic(from_coo, to_frame):\n    if not u.m.is_equivalent(from_coo.cartesian.x.unit):\n        raise UnitsError(_NEED_ORIGIN_HINT.format(from_coo.__class__.__name__))\n\n    # get the offset of the barycenter from the Sun\n    ssb_from_sun = get_offset_sun_from_barycenter(to_frame.obstime, reverse=True,\n                                                  include_velocity=bool(from_coo.data.differentials))\n\n    # now compute the matrix to precess to the right orientation\n    rmat = _mean_ecliptic_rotation_matrix(to_frame.equinox)\n\n    return rmat, ssb_from_sun.transform(rmat)\n\n\n@frame_transform_graph.transform(AffineTransform,\n                                 HeliocentricMeanEcliptic, ICRS)\ndef helioecliptic_to_icrs(from_coo, to_frame):\n    if not u.m.is_equivalent(from_coo.cartesian.x.unit):\n        raise UnitsError(_NEED_ORIGIN_HINT.format(from_coo.__class__.__name__))\n\n    # first un-precess from ecliptic to ICRS orientation\n    rmat = _mean_ecliptic_rotation_matrix(from_coo.equinox)\n\n    # now offset back to barycentric, which is the correct center for ICRS\n    sun_from_ssb = get_offset_sun_from_barycenter(from_coo.obstime,\n                                                  include_velocity=bool(from_coo.data.differentials))\n\n    return matrix_transpose(rmat), sun_from_ssb\n\n\n# TrueEcliptic frames\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 GCRS, GeocentricTrueEcliptic,\n                                 finite_difference_frameattr_name='equinox')\ndef gcrs_to_true_geoecliptic(gcrs_coo, to_frame):\n    # first get us to a 0 pos/vel GCRS at the target equinox\n    gcrs_coo2 = gcrs_coo.transform_to(GCRS(obstime=to_frame.obstime))\n\n    rmat = _true_ecliptic_rotation_matrix(to_frame.equinox)\n    newrepr = gcrs_coo2.cartesian.transform(rmat)\n    return to_frame.realize_frame(newrepr)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GeocentricTrueEcliptic, GCRS)\ndef true_geoecliptic_to_gcrs(from_coo, gcrs_frame):\n    rmat = _true_ecliptic_rotation_matrix(from_coo.equinox)\n    newrepr = from_coo.cartesian.transform(matrix_transpose(rmat))\n    gcrs = GCRS(newrepr, obstime=from_coo.obstime)\n\n    # now do any needed offsets (no-op if same obstime and 0 pos/vel)\n    return gcrs.transform_to(gcrs_frame)\n\n\n@frame_transform_graph.transform(DynamicMatrixTransform, ICRS, BarycentricTrueEcliptic)\ndef icrs_to_true_baryecliptic(from_coo, to_frame):\n    return _true_ecliptic_rotation_matrix(to_frame.equinox)\n\n\n@frame_transform_graph.transform(DynamicMatrixTransform, BarycentricTrueEcliptic, ICRS)\ndef true_baryecliptic_to_icrs(from_coo, to_frame):\n    return matrix_transpose(icrs_to_true_baryecliptic(to_frame, from_coo))\n\n\n@frame_transform_graph.transform(AffineTransform,\n                                 ICRS, HeliocentricTrueEcliptic)\ndef icrs_to_true_helioecliptic(from_coo, to_frame):\n    if not u.m.is_equivalent(from_coo.cartesian.x.unit):\n        raise UnitsError(_NEED_ORIGIN_HINT.format(from_coo.__class__.__name__))\n\n    # get the offset of the barycenter from the Sun\n    ssb_from_sun = get_offset_sun_from_barycenter(to_frame.obstime, reverse=True,\n                                                  include_velocity=bool(from_coo.data.differentials))\n\n    # now compute the matrix to precess to the right orientation\n    rmat = _true_ecliptic_rotation_matrix(to_frame.equinox)\n\n    return rmat, ssb_from_sun.transform(rmat)\n\n\n@frame_transform_graph.transform(AffineTransform,\n                                 HeliocentricTrueEcliptic, ICRS)\ndef true_helioecliptic_to_icrs(from_coo, to_frame):\n    if not u.m.is_equivalent(from_coo.cartesian.x.unit):\n        raise UnitsError(_NEED_ORIGIN_HINT.format(from_coo.__class__.__name__))\n\n    # first un-precess from ecliptic to ICRS orientation\n    rmat = _true_ecliptic_rotation_matrix(from_coo.equinox)\n\n    # now offset back to barycentric, which is the correct center for ICRS\n    sun_from_ssb = get_offset_sun_from_barycenter(from_coo.obstime,\n                                                  include_velocity=bool(from_coo.data.differentials))\n\n    return matrix_transpose(rmat), sun_from_ssb\n\n\n# Other ecliptic frames\n\n\n@frame_transform_graph.transform(AffineTransform,\n                                 HeliocentricEclipticIAU76, ICRS)\ndef ecliptic_to_iau76_icrs(from_coo, to_frame):\n    # first un-precess from ecliptic to ICRS orientation\n    rmat = _obliquity_only_rotation_matrix()\n\n    # now offset back to barycentric, which is the correct center for ICRS\n    sun_from_ssb = get_offset_sun_from_barycenter(from_coo.obstime,\n                                                  include_velocity=bool(from_coo.data.differentials))\n\n    return matrix_transpose(rmat), sun_from_ssb\n\n\n@frame_transform_graph.transform(AffineTransform,\n                                 ICRS, HeliocentricEclipticIAU76)\ndef icrs_to_iau76_ecliptic(from_coo, to_frame):\n    # get the offset of the barycenter from the Sun\n    ssb_from_sun = get_offset_sun_from_barycenter(to_frame.obstime, reverse=True,\n                                                  include_velocity=bool(from_coo.data.differentials))\n\n    # now compute the matrix to precess to the right orientation\n    rmat = _obliquity_only_rotation_matrix()\n\n    return rmat, ssb_from_sun.transform(rmat)\n\n\n@frame_transform_graph.transform(DynamicMatrixTransform,\n                                 ICRS, CustomBarycentricEcliptic)\ndef icrs_to_custombaryecliptic(from_coo, to_frame):\n    return _obliquity_only_rotation_matrix(to_frame.obliquity)\n\n\n@frame_transform_graph.transform(DynamicMatrixTransform,\n                                 CustomBarycentricEcliptic, ICRS)\ndef custombaryecliptic_to_icrs(from_coo, to_frame):\n    return icrs_to_custombaryecliptic(to_frame, from_coo).T\n\n\n# Create loopback transformations\nframe_transform_graph._add_merged_transform(GeocentricMeanEcliptic, ICRS, GeocentricMeanEcliptic)\nframe_transform_graph._add_merged_transform(GeocentricTrueEcliptic, ICRS, GeocentricTrueEcliptic)\nframe_transform_graph._add_merged_transform(HeliocentricMeanEcliptic, ICRS, HeliocentricMeanEcliptic)\nframe_transform_graph._add_merged_transform(HeliocentricTrueEcliptic, ICRS, HeliocentricTrueEcliptic)\nframe_transform_graph._add_merged_transform(HeliocentricEclipticIAU76, ICRS, HeliocentricEclipticIAU76)\nframe_transform_graph._add_merged_transform(BarycentricMeanEcliptic, ICRS, BarycentricMeanEcliptic)\nframe_transform_graph._add_merged_transform(BarycentricTrueEcliptic, ICRS, BarycentricTrueEcliptic)\nframe_transform_graph._add_merged_transform(CustomBarycentricEcliptic, ICRS, CustomBarycentricEcliptic)\n"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":185,"id":15780,"name":"obstime","nodeType":"Attribute","startLoc":185,"text":"obstime"},{"className":"HeliocentricTrueEcliptic","col":0,"comment":"\n    Heliocentric true ecliptic coordinates.  These origin of the coordinates are the\n    center of the sun, with the x axis pointing in the direction of\n    the *true* (not mean) equinox as at the time specified by the ``equinox``\n    attribute (as seen from Earth), and the xy-plane in the plane of the\n    ecliptic for that date.\n\n    The frame attributes are listed under **Other Parameters**.\n\n    {params}\n\n\n    ","endLoc":206,"id":15781,"nodeType":"Class","startLoc":188,"text":"@format_doc(base_doc, components=doc_components_ecl.format(\"sun's center\"),\n            footer=doc_footer_helio)\nclass HeliocentricTrueEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Heliocentric true ecliptic coordinates.  These origin of the coordinates are the\n    center of the sun, with the x axis pointing in the direction of\n    the *true* (not mean) equinox as at the time specified by the ``equinox``\n    attribute (as seen from Earth), and the xy-plane in the plane of the\n    ecliptic for that date.\n\n    The frame attributes are listed under **Other Parameters**.\n\n    {params}\n\n\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":205,"id":15782,"name":"equinox","nodeType":"Attribute","startLoc":205,"text":"equinox"},{"col":0,"comment":"null","endLoc":69,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, FK5, FK4NoETerms)\ndef fk5_to_fk4_no_e(fk5coord, fk4noeframe)","id":15783,"name":"fk5_to_fk4_no_e","nodeType":"Function","startLoc":58,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, FK5, FK4NoETerms)\ndef fk5_to_fk4_no_e(fk5coord, fk4noeframe):\n    # Get transposed version of the rotating correction terms... so with the\n    # transpose this takes us from FK5/J200 to FK4/B1950\n    B = matrix_transpose(_fk4_B_matrix(fk4noeframe.obstime))\n\n    # construct both precession matricies - if the equinoxes are B1950 and\n    # J2000, these are just identity matricies\n    pmat1 = fk5coord._precession_matrix(fk5coord.equinox, EQUINOX_J2000)\n    pmat2 = fk4noeframe._precession_matrix(EQUINOX_B1950, fk4noeframe.equinox)\n\n    return matrix_product(pmat2, B, pmat1)"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":206,"id":15784,"name":"obstime","nodeType":"Attribute","startLoc":206,"text":"obstime"},{"attributeType":"SphericalCosLatDifferential","col":4,"comment":"null","endLoc":60,"id":15785,"name":"default_differential","nodeType":"Attribute","startLoc":60,"text":"default_differential"},{"className":"HeliocentricEclipticIAU76","col":0,"comment":"\n    Heliocentric mean (IAU 1976) ecliptic coordinates.  These origin of the coordinates are the\n    center of the sun, with the x axis pointing in the direction of\n    the *mean* (not true) equinox of J2000, and the xy-plane in the plane of the\n    ecliptic of J2000 (according to the IAU 1976/1980 obliquity model).\n    It has, therefore, a fixed equinox and an older obliquity value\n    than the rest of the frames.\n\n    The frame attributes are listed under **Other Parameters**.\n\n    {params}\n\n\n    ","endLoc":227,"id":15786,"nodeType":"Class","startLoc":209,"text":"@format_doc(base_doc, components=doc_components_ecl.format(\"sun's center\"),\n            footer=\"\")\nclass HeliocentricEclipticIAU76(BaseEclipticFrame):\n    \"\"\"\n    Heliocentric mean (IAU 1976) ecliptic coordinates.  These origin of the coordinates are the\n    center of the sun, with the x axis pointing in the direction of\n    the *mean* (not true) equinox of J2000, and the xy-plane in the plane of the\n    ecliptic of J2000 (according to the IAU 1976/1980 obliquity model).\n    It has, therefore, a fixed equinox and an older obliquity value\n    than the rest of the frames.\n\n    The frame attributes are listed under **Other Parameters**.\n\n    {params}\n\n\n    \"\"\"\n\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)"},{"attributeType":"null","col":4,"comment":"null","endLoc":227,"id":15787,"name":"obstime","nodeType":"Attribute","startLoc":227,"text":"obstime"},{"className":"CustomBarycentricEcliptic","col":0,"comment":"\n    Barycentric ecliptic coordinates with custom obliquity.\n    These origin of the coordinates are the\n    barycenter of the solar system, with the x axis pointing in the direction of\n    the *mean* (not true) equinox of J2000, and the xy-plane in the plane of the\n    ecliptic tilted a custom obliquity angle.\n\n    The frame attributes are listed under **Other Parameters**.\n    ","endLoc":243,"id":15788,"nodeType":"Class","startLoc":230,"text":"@format_doc(base_doc, components=doc_components_ecl.format(\"barycenter\"),\n            footer=\"\")\nclass CustomBarycentricEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Barycentric ecliptic coordinates with custom obliquity.\n    These origin of the coordinates are the\n    barycenter of the solar system, with the x axis pointing in the direction of\n    the *mean* (not true) equinox of J2000, and the xy-plane in the plane of the\n    ecliptic tilted a custom obliquity angle.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    obliquity = QuantityAttribute(default=84381.448 * u.arcsec, unit=u.arcsec)"},{"attributeType":"null","col":16,"comment":"null","endLoc":5,"id":15789,"name":"np","nodeType":"Attribute","startLoc":5,"text":"np"},{"attributeType":"QuantityAttribute","col":4,"comment":"null","endLoc":243,"id":15790,"name":"obliquity","nodeType":"Attribute","startLoc":243,"text":"obliquity"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":15791,"name":"_B1950_TO_J2000_M","nodeType":"Attribute","startLoc":19,"text":"_B1950_TO_J2000_M"},{"attributeType":"Galactic","col":4,"comment":"null","endLoc":64,"id":15792,"name":"_nsgp_gal","nodeType":"Attribute","startLoc":64,"text":"_nsgp_gal"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":15793,"name":"_FK4_CORR","nodeType":"Attribute","startLoc":24,"text":"_FK4_CORR"},{"col":0,"comment":"","endLoc":5,"header":"fk4_fk5_transforms.py#<anonymous>","id":15794,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"_B1950_TO_J2000_M = np.array(\n    [[0.9999256794956877, -0.0111814832204662, -0.0048590038153592],\n     [0.0111814832391717, 0.9999374848933135, -0.0000271625947142],\n     [0.0048590037723143, -0.0000271702937440, 0.9999881946023742]])\n\n_FK4_CORR = np.array(\n    [[-0.0026455262, -1.1539918689, +2.1111346190],\n     [+1.1540628161, -0.0129042997, +0.0236021478],\n     [-2.1112979048, -0.0056024448, +0.0102587734]]) * 1.e-6"},{"col":0,"comment":"null","endLoc":31,"header":"def _mean_ecliptic_rotation_matrix(equinox)","id":15795,"name":"_mean_ecliptic_rotation_matrix","nodeType":"Function","startLoc":27,"text":"def _mean_ecliptic_rotation_matrix(equinox):\n    # This code just calls ecm06, which uses the precession matrix according to the\n    # IAU 2006 model, but leaves out nutation. This brings the results closer to what\n    # other libraries give (see https://github.com/astropy/astropy/pull/6508).\n    return erfa.ecm06(*get_jd12(equinox, 'tt'))"},{"fileName":"hcrs.py","filePath":"astropy/coordinates/builtin_frames","id":15796,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom astropy.utils.decorators import format_doc\nfrom astropy.coordinates.attributes import TimeAttribute\nfrom .utils import DEFAULT_OBSTIME\nfrom astropy.coordinates.baseframe import base_doc\nfrom .baseradec import BaseRADecFrame, doc_components\n\n__all__ = ['HCRS']\n\n\ndoc_footer = \"\"\"\n    Other parameters\n    ----------------\n    obstime : `~astropy.time.Time`\n        The time at which the observation is taken.  Used for determining the\n        position of the Sun.\n\"\"\"\n\n\n@format_doc(base_doc, components=doc_components, footer=doc_footer)\nclass HCRS(BaseRADecFrame):\n    \"\"\"\n    A coordinate or frame in a Heliocentric system, with axes aligned to ICRS.\n\n    The ICRS has an origin at the Barycenter and axes which are fixed with\n    respect to space.\n\n    This coordinate system is distinct from ICRS mainly in that it is relative\n    to the Sun's center-of-mass rather than the solar system Barycenter.\n    In principle, therefore, this frame should include the effects of\n    aberration (unlike ICRS), but this is not done, since they are very small,\n    of the order of 8 milli-arcseconds.\n\n    For more background on the ICRS and related coordinate transformations, see\n    the references provided in the :ref:`astropy:astropy-coordinates-seealso`\n    section of the documentation.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n\n# Transformations are defined in icrs_circ_transforms.py\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":15797,"name":"__all__","nodeType":"Attribute","startLoc":10,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":15798,"name":"doc_footer","nodeType":"Attribute","startLoc":13,"text":"doc_footer"},{"col":0,"comment":"","endLoc":4,"header":"hcrs.py#<anonymous>","id":15799,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['HCRS']\n\ndoc_footer = \"\"\"\n    Other parameters\n    ----------------\n    obstime : `~astropy.time.Time`\n        The time at which the observation is taken.  Used for determining the\n        position of the Sun.\n\"\"\""},{"fileName":"__init__.py","filePath":"astropy/coordinates/builtin_frames","id":15800,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis package contains the coordinate frames implemented by astropy.\n\nUsers shouldn't use this module directly, but rather import from the\n`astropy.coordinates` module.  While it is likely to exist for the long-term,\nthe existence of this package and details of its organization should be\nconsidered an implementation detail, and is not guaranteed to hold for future\nversions of astropy.\n\nNotes\n-----\nThe builtin frame classes are all imported automatically into this package's\nnamespace, so there's no need to access the sub-modules directly.\n\nTo implement a new frame in Astropy, a developer should add the frame as a new\nmodule in this package.  Any \"self\" transformations (i.e., those that transform\nfrom one frame to another frame of the same class) should be included in that\nmodule.  Transformation functions connecting the new frame to other frames\nshould be in a separate module, which should be imported in this package's\n``__init__.py`` to ensure the transformations are hooked up when this package is\nimported.  Placing the transformation functions in separate modules avoids\ncircular dependencies, because they need references to the frame classes.\n\"\"\"\n\nfrom .baseradec import BaseRADecFrame\nfrom .icrs import ICRS\nfrom .fk5 import FK5\nfrom .fk4 import FK4, FK4NoETerms\nfrom .galactic import Galactic\nfrom .galactocentric import Galactocentric, galactocentric_frame_defaults\nfrom .supergalactic import Supergalactic\nfrom .altaz import AltAz\nfrom .hadec import HADec\nfrom .gcrs import GCRS, PrecessedGeocentric\nfrom .cirs import CIRS\nfrom .itrs import ITRS\nfrom .hcrs import HCRS\nfrom .equatorial import TEME, TETE\n\nfrom .ecliptic import *  # there are a lot of these so we don't list them all explicitly\nfrom .skyoffset import SkyOffsetFrame\n# need to import transformations so that they get registered in the graph\nfrom . import icrs_fk5_transforms\nfrom . import fk4_fk5_transforms\nfrom . import galactic_transforms\nfrom . import supergalactic_transforms\nfrom . import icrs_cirs_transforms\nfrom . import cirs_observed_transforms\nfrom . import icrs_observed_transforms\nfrom . import intermediate_rotation_transforms\nfrom . import ecliptic_transforms\n\n# Import this after importing other frames, since this requires various\n# transformtions to set up the LSR frames\nfrom .lsr import LSR, GalacticLSR, LSRK, LSRD\n\nfrom astropy.coordinates.baseframe import frame_transform_graph\n\n# we define an __all__ because otherwise the transformation modules\n# get included\n__all__ = ['ICRS', 'FK5', 'FK4', 'FK4NoETerms', 'Galactic', 'Galactocentric',\n           'galactocentric_frame_defaults',\n           'Supergalactic', 'AltAz', 'HADec', 'GCRS', 'CIRS', 'ITRS', 'HCRS',\n           'TEME', 'TETE', 'PrecessedGeocentric', 'GeocentricMeanEcliptic',\n           'BarycentricMeanEcliptic', 'HeliocentricMeanEcliptic',\n           'GeocentricTrueEcliptic', 'BarycentricTrueEcliptic',\n           'HeliocentricTrueEcliptic',\n           'SkyOffsetFrame', 'GalacticLSR', 'LSR', 'LSRK', 'LSRD',\n           'BaseEclipticFrame', 'BaseRADecFrame', 'make_transform_graph_docs',\n           'HeliocentricEclipticIAU76', 'CustomBarycentricEcliptic']\n\n\ndef make_transform_graph_docs(transform_graph):\n    \"\"\"\n    Generates a string that can be used in other docstrings to include a\n    transformation graph, showing the available transforms and\n    coordinate systems.\n\n    Parameters\n    ----------\n    transform_graph : `~.coordinates.TransformGraph`\n\n    Returns\n    -------\n    docstring : str\n        A string that can be added to the end of a docstring to show the\n        transform graph.\n    \"\"\"\n    from textwrap import dedent\n    coosys = [transform_graph.lookup_name(item) for\n              item in transform_graph.get_names()]\n\n    # currently, all of the priorities are set to 1, so we don't need to show\n    #   then in the transform graph.\n    graphstr = transform_graph.to_dot_graph(addnodes=coosys,\n                                            priorities=False)\n\n    docstr = \"\"\"\n    The diagram below shows all of the built in coordinate systems,\n    their aliases (useful for converting other coordinates to them using\n    attribute-style access) and the pre-defined transformations between\n    them.  The user is free to override any of these transformations by\n    defining new transformations between these systems, but the\n    pre-defined transformations should be sufficient for typical usage.\n\n    The color of an edge in the graph (i.e. the transformations between two\n    frames) is set by the type of transformation; the legend box defines the\n    mapping from transform class name to color.\n\n    .. Wrap the graph in a div with a custom class to allow themeing.\n    .. container:: frametransformgraph\n\n        .. graphviz::\n\n    \"\"\"\n\n    docstr = dedent(docstr) + '        ' + graphstr.replace('\\n', '\\n        ')\n\n    # colors are in dictionary at the bottom of transformations.py\n    from astropy.coordinates.transformations import trans_to_color\n    html_list_items = []\n    for cls, color in trans_to_color.items():\n        block = f\"\"\"\n            <li style='list-style: none;'>\n                <p style=\"font-size: 12px;line-height: 24px;font-weight: normal;color: #848484;padding: 0;margin: 0;\">\n                    <b>{cls.__name__}:</b>\n                    <span style=\"font-size: 24px; color: {color};\"><b>➝</b></span>\n                </p>\n            </li>\n        \"\"\"\n        html_list_items.append(block)\n\n    nl = '\\n'\n    graph_legend = f\"\"\"\n    .. raw:: html\n\n        <ul>\n            {nl.join(html_list_items)}\n        </ul>\n    \"\"\"\n    docstr = docstr + dedent(graph_legend)\n\n    return docstr\n\n\n_transform_graph_docs = make_transform_graph_docs(frame_transform_graph)\n\n# Here, we override the module docstring so that sphinx renders the transform\n# graph without the developer documentation in the main docstring above.\n__doc__ = _transform_graph_docs\n"},{"col":0,"comment":"null","endLoc":53,"header":"def _true_ecliptic_rotation_matrix(equinox)","id":15801,"name":"_true_ecliptic_rotation_matrix","nodeType":"Function","startLoc":34,"text":"def _true_ecliptic_rotation_matrix(equinox):\n    # This code calls the same routines as done in pnm06a from ERFA, which\n    # retrieves the precession matrix (including frame bias) according to\n    # the IAU 2006 model, and including the nutation.\n    # This family of systems is less popular\n    # (see https://github.com/astropy/astropy/pull/6508).\n    jd1, jd2 = get_jd12(equinox, 'tt')\n    # Here, we call the three routines from erfa.pnm06a separately,\n    # so that we can keep the nutation for calculating the true obliquity\n    # (which is a fairly expensive operation); see gh-11000.\n    # pnm06a: Fukushima-Williams angles for frame bias and precession.\n    # (ERFA names short for F-W's gamma_bar, phi_bar, psi_bar and epsilon_A).\n    gamb, phib, psib, epsa = erfa.pfw06(jd1, jd2)\n    # pnm06a: Nutation components (in longitude and obliquity).\n    dpsi, deps = erfa.nut06a(jd1, jd2)\n    # pnm06a: Equinox based nutation x precession x bias matrix.\n    rnpb = erfa.fw2m(gamb, phib, psib+dpsi, epsa+deps)\n    # calculate the true obliquity of the ecliptic\n    obl = erfa.obl06(jd1, jd2)+deps\n    return matrix_product(rotation_matrix(obl << u.radian, 'x'), rnpb)"},{"col":0,"comment":"null","endLoc":581,"header":"@frame_transform_graph.transform(AffineTransform, ICRS, Galactocentric)\ndef icrs_to_galactocentric(icrs_coord, galactocentric_frame)","id":15802,"name":"icrs_to_galactocentric","nodeType":"Function","startLoc":578,"text":"@frame_transform_graph.transform(AffineTransform, ICRS, Galactocentric)\ndef icrs_to_galactocentric(icrs_coord, galactocentric_frame):\n    _check_coord_repr_diff_types(icrs_coord)\n    return get_matrix_vectors(galactocentric_frame)"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":15803,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":15804,"name":"doc_components_ecl","nodeType":"Attribute","startLoc":18,"text":"doc_components_ecl"},{"attributeType":"null","col":0,"comment":"null","endLoc":59,"id":15805,"name":"doc_footer_geo","nodeType":"Attribute","startLoc":59,"text":"doc_footer_geo"},{"attributeType":"null","col":0,"comment":"null","endLoc":112,"id":15806,"name":"doc_footer_bary","nodeType":"Attribute","startLoc":112,"text":"doc_footer_bary"},{"attributeType":"null","col":0,"comment":"null","endLoc":154,"id":15807,"name":"doc_footer_helio","nodeType":"Attribute","startLoc":154,"text":"doc_footer_helio"},{"col":0,"comment":"","endLoc":4,"header":"ecliptic.py#<anonymous>","id":15808,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['GeocentricMeanEcliptic', 'BarycentricMeanEcliptic',\n           'HeliocentricMeanEcliptic', 'BaseEclipticFrame',\n           'GeocentricTrueEcliptic', 'BarycentricTrueEcliptic',\n           'HeliocentricTrueEcliptic',\n           'HeliocentricEclipticIAU76', 'CustomBarycentricEcliptic']\n\ndoc_components_ecl = \"\"\"\n    lon : `~astropy.coordinates.Angle`, optional, keyword-only\n        The ecliptic longitude for this object (``lat`` must also be given and\n        ``representation`` must be None).\n    lat : `~astropy.coordinates.Angle`, optional, keyword-only\n        The ecliptic latitude for this object (``lon`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity` ['length'], optional, keyword-only\n        The distance for this object from the {0}.\n        (``representation`` must be None).\n\n    pm_lon_coslat : `~astropy.units.Quantity` ['angualar speed'], optional, keyword-only\n        The proper motion in the ecliptic longitude (including the ``cos(lat)``\n        factor) for this object (``pm_lat`` must also be given).\n    pm_lat : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in the ecliptic latitude for this object\n        (``pm_lon_coslat`` must also be given).\n    radial_velocity : `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The radial velocity of this object.\n\"\"\"\n\ndoc_footer_geo = \"\"\"\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`, optional\n        The date to assume for this frame.  Determines the location of the\n        x-axis and the location of the Earth (necessary for transformation to\n        non-geocentric systems). Defaults to the 'J2000' equinox.\n    obstime : `~astropy.time.Time`, optional\n        The time at which the observation is taken.  Used for determining the\n        position of the Earth. Defaults to J2000.\n\"\"\"\n\ndoc_footer_bary = \"\"\"\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`, optional\n        The date to assume for this frame.  Determines the location of the\n        x-axis and the location of the Earth and Sun.\n        Defaults to the 'J2000' equinox.\n\"\"\"\n\ndoc_footer_helio = \"\"\"\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`, optional\n        The date to assume for this frame.  Determines the location of the\n        x-axis and the location of the Earth and Sun.\n        Defaults to the 'J2000' equinox.\n    obstime : `~astropy.time.Time`, optional\n        The time at which the observation is taken.  Used for determining the\n        position of the Sun. Defaults to J2000.\n\"\"\""},{"col":0,"comment":"null","endLoc":63,"header":"def _obliquity_only_rotation_matrix(obl=erfa.obl80(EQUINOX_J2000.jd1, EQUINOX_J2000.jd2) * u.radian)","id":15809,"name":"_obliquity_only_rotation_matrix","nodeType":"Function","startLoc":56,"text":"def _obliquity_only_rotation_matrix(obl=erfa.obl80(EQUINOX_J2000.jd1, EQUINOX_J2000.jd2) * u.radian):\n    # This code only accounts for the obliquity,\n    # which can be passed explicitly.\n    # The default value is the IAU 1980 value for J2000,\n    # which is computed using obl80 from ERFA:\n    #\n    # obl = erfa.obl80(EQUINOX_J2000.jd1, EQUINOX_J2000.jd2) * u.radian\n    return rotation_matrix(obl, \"x\")"},{"fileName":"galactic.py","filePath":"astropy/coordinates/builtin_frames","id":15810,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom astropy import units as u\nfrom astropy.utils.decorators import format_doc\nfrom astropy.coordinates.angles import Angle\nfrom astropy.coordinates import representation as r\nfrom astropy.coordinates.baseframe import BaseCoordinateFrame, RepresentationMapping, base_doc\n\n# these are needed for defining the NGP\nfrom .fk5 import FK5\nfrom .fk4 import FK4NoETerms\n\n__all__ = ['Galactic']\n\n\ndoc_components = \"\"\"\n    l : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Galactic longitude for this object (``b`` must also be given and\n        ``representation`` must be None).\n    b : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Galactic latitude for this object (``l`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity` ['length'], optional, keyword-only\n        The Distance for this object along the line-of-sight.\n\n    pm_l_cosb : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in Galactic longitude (including the ``cos(b)`` term)\n        for this object (``pm_b`` must also be given).\n    pm_b : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in Galactic latitude for this object (``pm_l_cosb``\n        must also be given).\n    radial_velocity : `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The radial velocity of this object.\n\"\"\"\n\ndoc_footer = \"\"\"\n    Notes\n    -----\n    .. [1] Blaauw, A.; Gum, C. S.; Pawsey, J. L.; Westerhout, G. (1960), \"The\n       new I.A.U. system of galactic coordinates (1958 revision),\"\n       `MNRAS, Vol 121, pp.123 <https://ui.adsabs.harvard.edu/abs/1960MNRAS.121..123B>`_.\n\"\"\"\n\n\n@format_doc(base_doc, components=doc_components, footer=doc_footer)\nclass Galactic(BaseCoordinateFrame):\n    \"\"\"\n    A coordinate or frame in the Galactic coordinate system.\n\n    This frame is used in a variety of Galactic contexts because it has as its\n    x-y plane the plane of the Milky Way.  The positive x direction (i.e., the\n    l=0, b=0 direction) points to the center of the Milky Way and the z-axis\n    points toward the North Galactic Pole (following the IAU's 1958 definition\n    [1]_). However, unlike the `~astropy.coordinates.Galactocentric` frame, the\n    *origin* of this frame in 3D space is the solar system barycenter, not\n    the center of the Milky Way.\n    \"\"\"\n\n    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'l'),\n            RepresentationMapping('lat', 'b')\n        ],\n        r.CartesianRepresentation: [\n            RepresentationMapping('x', 'u'),\n            RepresentationMapping('y', 'v'),\n            RepresentationMapping('z', 'w')\n        ],\n        r.CartesianDifferential: [\n            RepresentationMapping('d_x', 'U', u.km/u.s),\n            RepresentationMapping('d_y', 'V', u.km/u.s),\n            RepresentationMapping('d_z', 'W', u.km/u.s)\n        ]\n    }\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential\n\n    # North galactic pole and zeropoint of l in FK4/FK5 coordinates. Needed for\n    # transformations to/from FK4/5\n\n    # These are from the IAU's definition of galactic coordinates\n    _ngp_B1950 = FK4NoETerms(ra=192.25*u.degree, dec=27.4*u.degree)\n    _lon0_B1950 = Angle(123, u.degree)\n\n    # These are *not* from Reid & Brunthaler 2004 - instead, they were\n    # derived by doing:\n    #\n    # >>> FK4NoETerms(ra=192.25*u.degree, dec=27.4*u.degree).transform_to(FK5())\n    #\n    # This gives better consistency with other codes than using the values\n    # from Reid & Brunthaler 2004 and the best self-consistency between FK5\n    # -> Galactic and FK5 -> FK4 -> Galactic. The lon0 angle was found by\n    # optimizing the self-consistency.\n    _ngp_J2000 = FK5(ra=192.8594812065348*u.degree, dec=27.12825118085622*u.degree)\n    _lon0_J2000 = Angle(122.9319185680026, u.degree)\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":15811,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":15812,"name":"doc_components","nodeType":"Attribute","startLoc":17,"text":"doc_components"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":15813,"name":"doc_footer","nodeType":"Attribute","startLoc":37,"text":"doc_footer"},{"attributeType":"null","col":29,"comment":"null","endLoc":4,"id":15814,"name":"u","nodeType":"Attribute","startLoc":4,"text":"u"},{"col":0,"comment":"","endLoc":4,"header":"galactic.py#<anonymous>","id":15815,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['Galactic']\n\ndoc_components = \"\"\"\n    l : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Galactic longitude for this object (``b`` must also be given and\n        ``representation`` must be None).\n    b : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Galactic latitude for this object (``l`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity` ['length'], optional, keyword-only\n        The Distance for this object along the line-of-sight.\n\n    pm_l_cosb : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in Galactic longitude (including the ``cos(b)`` term)\n        for this object (``pm_b`` must also be given).\n    pm_b : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in Galactic latitude for this object (``pm_l_cosb``\n        must also be given).\n    radial_velocity : `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The radial velocity of this object.\n\"\"\"\n\ndoc_footer = \"\"\"\n    Notes\n    -----\n    .. [1] Blaauw, A.; Gum, C. S.; Pawsey, J. L.; Westerhout, G. (1960), \"The\n       new I.A.U. system of galactic coordinates (1958 revision),\"\n       `MNRAS, Vol 121, pp.123 <https://ui.adsabs.harvard.edu/abs/1960MNRAS.121..123B>`_.\n\"\"\""},{"col":0,"comment":"null","endLoc":78,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 GCRS, GeocentricMeanEcliptic,\n                                 finite_difference_frameattr_name='equinox')\ndef gcrs_to_geoecliptic(gcrs_coo, to_frame)","id":15816,"name":"gcrs_to_geoecliptic","nodeType":"Function","startLoc":69,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 GCRS, GeocentricMeanEcliptic,\n                                 finite_difference_frameattr_name='equinox')\ndef gcrs_to_geoecliptic(gcrs_coo, to_frame):\n    # first get us to a 0 pos/vel GCRS at the target equinox\n    gcrs_coo2 = gcrs_coo.transform_to(GCRS(obstime=to_frame.obstime))\n\n    rmat = _mean_ecliptic_rotation_matrix(to_frame.equinox)\n    newrepr = gcrs_coo2.cartesian.transform(rmat)\n    return to_frame.realize_frame(newrepr)"},{"attributeType":"null","col":50,"comment":"null","endLoc":6,"id":15817,"name":"r","nodeType":"Attribute","startLoc":6,"text":"r"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":15818,"name":"__all__","nodeType":"Attribute","startLoc":10,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":15819,"name":"doc_components","nodeType":"Attribute","startLoc":13,"text":"doc_components"},{"col":0,"comment":"","endLoc":4,"header":"supergalactic.py#<anonymous>","id":15820,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['Supergalactic']\n\ndoc_components = \"\"\"\n    sgl : `~astropy.coordinates.Angle`, optional, keyword-only\n        The supergalactic longitude for this object (``sgb`` must also be given and\n        ``representation`` must be None).\n    sgb : `~astropy.coordinates.Angle`, optional, keyword-only\n        The supergalactic latitude for this object (``sgl`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The Distance for this object along the line-of-sight.\n\n    pm_sgl_cossgb : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in Right Ascension for this object (``pm_sgb`` must\n        also be given).\n    pm_sgb : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in Declination for this object (``pm_sgl_cossgb`` must\n        also be given).\n    radial_velocity : `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The radial velocity of this object.\n\"\"\""},{"fileName":"equatorial.py","filePath":"astropy/coordinates/builtin_frames","id":15821,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nCoordinate frames tied to the Equator and Equinox of Earth.\n\nTEME is a True equator, Mean Equinox coordinate frame used in NORAD TLE\nsatellite files.\n\nTETE is a True equator, True Equinox coordinate frame often called the\n\"apparent\" coordinates. It is the same frame as used by JPL Horizons\nand can be combined with Local Apparent Sidereal Time to calculate the\nhour angle.\n\"\"\"\n\nfrom astropy.utils.decorators import format_doc\nfrom astropy.coordinates.representation import (CartesianRepresentation, CartesianDifferential)\nfrom astropy.coordinates.baseframe import BaseCoordinateFrame, base_doc\nfrom astropy.coordinates.builtin_frames.baseradec import BaseRADecFrame, doc_components\nfrom astropy.coordinates.attributes import TimeAttribute, EarthLocationAttribute\nfrom .utils import DEFAULT_OBSTIME, EARTH_CENTER\n\n__all__ = ['TEME', 'TETE']\n\ndoc_footer_teme = \"\"\"\n    Other parameters\n    ----------------\n    obstime : `~astropy.time.Time`\n        The time at which the frame is defined.  Used for determining the\n        position of the Earth.\n\"\"\"\n\ndoc_footer_tete = \"\"\"\n    Other parameters\n    ----------------\n    obstime : `~astropy.time.Time`\n        The time at which the observation is taken.  Used for determining the\n        position of the Earth.\n    location : `~astropy.coordinates.EarthLocation`\n        The location on the Earth.  This can be specified either as an\n        `~astropy.coordinates.EarthLocation` object or as anything that can be\n        transformed to an `~astropy.coordinates.ITRS` frame. The default is the\n        centre of the Earth.\n\"\"\"\n\n\n@format_doc(base_doc, components=doc_components, footer=doc_footer_tete)\nclass TETE(BaseRADecFrame):\n    \"\"\"\n    An equatorial coordinate or frame using the True Equator and True Equinox (TETE).\n\n    Equatorial coordinate frames measure RA with respect to the equinox and declination\n    with with respect to the equator. The location of the equinox and equator vary due\n    the gravitational torques on the oblate Earth. This variation is split into precession\n    and nutation, although really they are two aspects of a single phenomena. The smooth,\n    long term variation is known as precession, whilst smaller, periodic components are\n    called nutation.\n\n    Calculation of the true equator and equinox involves the application of both precession\n    and nutation, whilst only applying precession gives a mean equator and equinox.\n\n    TETE coordinates are often referred to as \"apparent\" coordinates, or\n    \"apparent place\". TETE is the apparent coordinate system used by JPL Horizons\n    and is the correct coordinate system to use when combining the right ascension\n    with local apparent sidereal time to calculate the apparent (TIRS) hour angle.\n\n    For more background on TETE, see the references provided in the\n    :ref:`astropy:astropy-coordinates-seealso` section of the documentation.\n    Of particular note are Sections 5 and 6 of\n    `USNO Circular 179 <https://arxiv.org/abs/astro-ph/0602086>`_) and\n    especially the diagram at the top of page 57.\n\n    This frame also includes frames that are defined *relative* to the center of the Earth,\n    but that are offset (in both position and velocity) from the center of the Earth. You\n    may see such non-geocentric coordinates referred to as \"topocentric\".\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n    location = EarthLocationAttribute(default=EARTH_CENTER)\n\n# Self transform goes through ICRS and is defined in icrs_cirs_transforms.py\n\n\n@format_doc(base_doc, components=\"\", footer=doc_footer_teme)\nclass TEME(BaseCoordinateFrame):\n    \"\"\"\n    A coordinate or frame in the True Equator Mean Equinox frame (TEME).\n\n    This frame is a geocentric system similar to CIRS or geocentric apparent place,\n    except that the mean sidereal time is used to rotate from TIRS. TEME coordinates\n    are most often used in combination with orbital data for satellites in the\n    two-line-ephemeris format.\n\n    Different implementations of the TEME frame exist. For clarity, this frame follows the\n    conventions and relations to other frames that are set out in Vallado et al (2006).\n\n    For more background on TEME, see the references provided in the\n    :ref:`astropy:astropy-coordinates-seealso` section of the documentation.\n    \"\"\"\n\n    default_representation = CartesianRepresentation\n    default_differential = CartesianDifferential\n\n    obstime = TimeAttribute()\n\n# Transformation functions for getting to/from TEME and ITRS are in\n# intermediate rotation transforms.py\n"},{"fileName":"fk5.py","filePath":"astropy/coordinates/builtin_frames","id":15822,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom astropy.utils.decorators import format_doc\nfrom astropy.coordinates.baseframe import frame_transform_graph, base_doc\nfrom astropy.coordinates.attributes import TimeAttribute\nfrom astropy.coordinates.transformations import DynamicMatrixTransform\nfrom astropy.coordinates import earth_orientation as earth\n\nfrom .baseradec import BaseRADecFrame, doc_components\nfrom .utils import EQUINOX_J2000\n\n__all__ = ['FK5']\n\n\ndoc_footer = \"\"\"\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\n        The equinox of this frame.\n\"\"\"\n\n\n@format_doc(base_doc, components=doc_components, footer=doc_footer)\nclass FK5(BaseRADecFrame):\n    \"\"\"\n    A coordinate or frame in the FK5 system.\n\n    Note that this is a barycentric version of FK5 - that is, the origin for\n    this frame is the Solar System Barycenter, *not* the Earth geocenter.\n\n    The frame attributes are listed under **Other Parameters**.\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n\n    @staticmethod\n    def _precession_matrix(oldequinox, newequinox):\n        \"\"\"\n        Compute and return the precession matrix for FK5 based on Capitaine et\n        al. 2003/IAU2006.  Used inside some of the transformation functions.\n\n        Parameters\n        ----------\n        oldequinox : `~astropy.time.Time`\n            The equinox to precess from.\n        newequinox : `~astropy.time.Time`\n            The equinox to precess to.\n\n        Returns\n        -------\n        newcoord : array\n            The precession matrix to transform to the new equinox\n        \"\"\"\n        return earth.precession_matrix_Capitaine(oldequinox, newequinox)\n\n\n# This is the \"self-transform\".  Defined at module level because the decorator\n#  needs a reference to the FK5 class\n\n\n@frame_transform_graph.transform(DynamicMatrixTransform, FK5, FK5)\ndef fk5_to_fk5(fk5coord1, fk5frame2):\n    return fk5coord1._precession_matrix(fk5coord1.equinox, fk5frame2.equinox)\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":15823,"name":"__all__","nodeType":"Attribute","startLoc":22,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":15824,"name":"doc_footer_teme","nodeType":"Attribute","startLoc":24,"text":"doc_footer_teme"},{"col":0,"comment":"null","endLoc":64,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, FK5, FK5)\ndef fk5_to_fk5(fk5coord1, fk5frame2)","id":15825,"name":"fk5_to_fk5","nodeType":"Function","startLoc":62,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, FK5, FK5)\ndef fk5_to_fk5(fk5coord1, fk5frame2):\n    return fk5coord1._precession_matrix(fk5coord1.equinox, fk5frame2.equinox)"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":15826,"name":"doc_footer_tete","nodeType":"Attribute","startLoc":32,"text":"doc_footer_tete"},{"col":0,"comment":"","endLoc":13,"header":"equatorial.py#<anonymous>","id":15827,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nCoordinate frames tied to the Equator and Equinox of Earth.\n\nTEME is a True equator, Mean Equinox coordinate frame used in NORAD TLE\nsatellite files.\n\nTETE is a True equator, True Equinox coordinate frame often called the\n\"apparent\" coordinates. It is the same frame as used by JPL Horizons\nand can be combined with Local Apparent Sidereal Time to calculate the\nhour angle.\n\"\"\"\n\n__all__ = ['TEME', 'TETE']\n\ndoc_footer_teme = \"\"\"\n    Other parameters\n    ----------------\n    obstime : `~astropy.time.Time`\n        The time at which the frame is defined.  Used for determining the\n        position of the Earth.\n\"\"\"\n\ndoc_footer_tete = \"\"\"\n    Other parameters\n    ----------------\n    obstime : `~astropy.time.Time`\n        The time at which the observation is taken.  Used for determining the\n        position of the Earth.\n    location : `~astropy.coordinates.EarthLocation`\n        The location on the Earth.  This can be specified either as an\n        `~astropy.coordinates.EarthLocation` object or as anything that can be\n        transformed to an `~astropy.coordinates.ITRS` frame. The default is the\n        centre of the Earth.\n\"\"\""},{"fileName":"supergalactic_transforms.py","filePath":"astropy/coordinates/builtin_frames","id":15828,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom astropy.coordinates.matrix_utilities import (rotation_matrix,\n                                                  matrix_product,\n                                                  matrix_transpose)\nfrom astropy.coordinates.baseframe import frame_transform_graph\nfrom astropy.coordinates.transformations import StaticMatrixTransform\n\nfrom .galactic import Galactic\nfrom .supergalactic import Supergalactic\n\n\n@frame_transform_graph.transform(StaticMatrixTransform, Galactic, Supergalactic)\ndef gal_to_supergal():\n    mat1 = rotation_matrix(90, 'z')\n    mat2 = rotation_matrix(90 - Supergalactic._nsgp_gal.b.degree, 'y')\n    mat3 = rotation_matrix(Supergalactic._nsgp_gal.l.degree, 'z')\n    return matrix_product(mat1, mat2, mat3)\n\n\n@frame_transform_graph.transform(StaticMatrixTransform, Supergalactic, Galactic)\ndef supergal_to_gal():\n    return matrix_transpose(gal_to_supergal())\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":15829,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":15830,"name":"doc_footer","nodeType":"Attribute","startLoc":16,"text":"doc_footer"},{"col":0,"comment":"","endLoc":4,"header":"fk5.py#<anonymous>","id":15831,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['FK5']\n\ndoc_footer = \"\"\"\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\n        The equinox of this frame.\n\"\"\""},{"col":0,"comment":"null","endLoc":587,"header":"@frame_transform_graph.transform(AffineTransform, Galactocentric, ICRS)\ndef galactocentric_to_icrs(galactocentric_coord, icrs_frame)","id":15832,"name":"galactocentric_to_icrs","nodeType":"Function","startLoc":584,"text":"@frame_transform_graph.transform(AffineTransform, Galactocentric, ICRS)\ndef galactocentric_to_icrs(galactocentric_coord, icrs_frame):\n    _check_coord_repr_diff_types(galactocentric_coord)\n    return get_matrix_vectors(galactocentric_coord, inverse=True)"},{"col":0,"comment":"null","endLoc":19,"header":"@frame_transform_graph.transform(StaticMatrixTransform, Galactic, Supergalactic)\ndef gal_to_supergal()","id":15833,"name":"gal_to_supergal","nodeType":"Function","startLoc":14,"text":"@frame_transform_graph.transform(StaticMatrixTransform, Galactic, Supergalactic)\ndef gal_to_supergal():\n    mat1 = rotation_matrix(90, 'z')\n    mat2 = rotation_matrix(90 - Supergalactic._nsgp_gal.b.degree, 'y')\n    mat3 = rotation_matrix(Supergalactic._nsgp_gal.l.degree, 'z')\n    return matrix_product(mat1, mat2, mat3)"},{"fileName":"baseradec.py","filePath":"astropy/coordinates/builtin_frames","id":15834,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom astropy.utils.decorators import format_doc\nfrom astropy.coordinates import representation as r\nfrom astropy.coordinates.baseframe import BaseCoordinateFrame, RepresentationMapping, base_doc\n\n__all__ = ['BaseRADecFrame']\n\n\ndoc_components = \"\"\"\n    ra : `~astropy.coordinates.Angle`, optional, keyword-only\n        The RA for this object (``dec`` must also be given and ``representation``\n        must be None).\n    dec : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Declination for this object (``ra`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity` ['length'], optional, keyword-only\n        The Distance for this object along the line-of-sight.\n        (``representation`` must be None).\n\n    pm_ra_cosdec : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in Right Ascension (including the ``cos(dec)`` factor)\n        for this object (``pm_dec`` must also be given).\n    pm_dec : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in Declination for this object (``pm_ra_cosdec`` must\n        also be given).\n    radial_velocity : `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The radial velocity of this object.\n\"\"\"\n\n\n@format_doc(base_doc, components=doc_components, footer=\"\")\nclass BaseRADecFrame(BaseCoordinateFrame):\n    \"\"\"\n    A base class that defines default representation info for frames that\n    represent longitude and latitude as Right Ascension and Declination\n    following typical \"equatorial\" conventions.\n    \"\"\"\n    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'ra'),\n            RepresentationMapping('lat', 'dec')\n        ]\n    }\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":15835,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"baseradec.py#<anonymous>","id":15836,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['BaseRADecFrame']\n\ndoc_components = \"\"\"\n    ra : `~astropy.coordinates.Angle`, optional, keyword-only\n        The RA for this object (``dec`` must also be given and ``representation``\n        must be None).\n    dec : `~astropy.coordinates.Angle`, optional, keyword-only\n        The Declination for this object (``ra`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity` ['length'], optional, keyword-only\n        The Distance for this object along the line-of-sight.\n        (``representation`` must be None).\n\n    pm_ra_cosdec : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in Right Ascension (including the ``cos(dec)`` factor)\n        for this object (``pm_dec`` must also be given).\n    pm_dec : `~astropy.units.Quantity` ['angular speed'], optional, keyword-only\n        The proper motion in Declination for this object (``pm_ra_cosdec`` must\n        also be given).\n    radial_velocity : `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The radial velocity of this object.\n\"\"\""},{"attributeType":"null","col":16,"comment":"null","endLoc":8,"id":15837,"name":"np","nodeType":"Attribute","startLoc":8,"text":"np"},{"attributeType":"null","col":29,"comment":"null","endLoc":10,"id":15838,"name":"u","nodeType":"Attribute","startLoc":10,"text":"u"},{"attributeType":"null","col":50,"comment":"null","endLoc":15,"id":15839,"name":"r","nodeType":"Attribute","startLoc":15,"text":"r"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":15840,"name":"__all__","nodeType":"Attribute","startLoc":27,"text":"__all__"},{"attributeType":"Angle","col":0,"comment":"null","endLoc":34,"id":15841,"name":"_ROLL0","nodeType":"Attribute","startLoc":34,"text":"_ROLL0"},{"attributeType":"null","col":0,"comment":"null","endLoc":341,"id":15842,"name":"doc_components","nodeType":"Attribute","startLoc":341,"text":"doc_components"},{"fileName":"icrs_fk5_transforms.py","filePath":"astropy/coordinates/builtin_frames","id":15843,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom astropy.coordinates.matrix_utilities import (rotation_matrix,\n                                                  matrix_product,\n                                                  matrix_transpose)\nfrom astropy.coordinates.baseframe import frame_transform_graph\nfrom astropy.coordinates.transformations import DynamicMatrixTransform\n\nfrom .fk5 import FK5\nfrom .icrs import ICRS\nfrom .utils import EQUINOX_J2000\n\n\ndef _icrs_to_fk5_matrix():\n    \"\"\"\n    B-matrix from USNO circular 179.  Used by the ICRS->FK5 transformation\n    functions.\n    \"\"\"\n\n    eta0 = -19.9 / 3600000.\n    xi0 = 9.1 / 3600000.\n    da0 = -22.9 / 3600000.\n\n    m1 = rotation_matrix(-eta0, 'x')\n    m2 = rotation_matrix(xi0, 'y')\n    m3 = rotation_matrix(da0, 'z')\n\n    return matrix_product(m1, m2, m3)\n\n\n# define this here because it only needs to be computed once\n_ICRS_TO_FK5_J2000_MAT = _icrs_to_fk5_matrix()\n\n\n@frame_transform_graph.transform(DynamicMatrixTransform, ICRS, FK5)\ndef icrs_to_fk5(icrscoord, fk5frame):\n    # ICRS is by design very close to J2000 equinox\n    pmat = fk5frame._precession_matrix(EQUINOX_J2000, fk5frame.equinox)\n    return matrix_product(pmat, _ICRS_TO_FK5_J2000_MAT)\n\n\n# can't be static because the equinox is needed\n@frame_transform_graph.transform(DynamicMatrixTransform, FK5, ICRS)\ndef fk5_to_icrs(fk5coord, icrsframe):\n    # ICRS is by design very close to J2000 equinox\n    pmat = fk5coord._precession_matrix(fk5coord.equinox, EQUINOX_J2000)\n    return matrix_product(matrix_transpose(_ICRS_TO_FK5_J2000_MAT), pmat)\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":357,"id":15844,"name":"doc_footer","nodeType":"Attribute","startLoc":357,"text":"doc_footer"},{"col":0,"comment":"","endLoc":4,"header":"galactocentric.py#<anonymous>","id":15845,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['Galactocentric']\n\n_ROLL0 = Angle(58.5986320306*u.degree)\n\ndoc_components = \"\"\"\n    x : `~astropy.units.Quantity`, optional\n        Cartesian, Galactocentric :math:`x` position component.\n    y : `~astropy.units.Quantity`, optional\n        Cartesian, Galactocentric :math:`y` position component.\n    z : `~astropy.units.Quantity`, optional\n        Cartesian, Galactocentric :math:`z` position component.\n\n    v_x : `~astropy.units.Quantity`, optional\n        Cartesian, Galactocentric :math:`v_x` velocity component.\n    v_y : `~astropy.units.Quantity`, optional\n        Cartesian, Galactocentric :math:`v_y` velocity component.\n    v_z : `~astropy.units.Quantity`, optional\n        Cartesian, Galactocentric :math:`v_z` velocity component.\n\"\"\"\n\ndoc_footer = \"\"\"\n    Other parameters\n    ----------------\n    galcen_coord : `ICRS`, optional, keyword-only\n        The ICRS coordinates of the Galactic center.\n    galcen_distance : `~astropy.units.Quantity`, optional, keyword-only\n        The distance from the sun to the Galactic center.\n    galcen_v_sun : `~astropy.coordinates.representation.CartesianDifferential`, `~astropy.units.Quantity` ['speed'], optional, keyword-only\n        The velocity of the sun *in the Galactocentric frame* as Cartesian\n        velocity components.\n    z_sun : `~astropy.units.Quantity` ['length'], optional, keyword-only\n        The distance from the sun to the Galactic midplane.\n    roll : `~astropy.coordinates.Angle`, optional, keyword-only\n        The angle to rotate about the final x-axis, relative to the\n        orientation for Galactic. For example, if this roll angle is 0,\n        the final x-z plane will align with the Galactic coordinates x-z\n        plane. Unless you really know what this means, you probably should\n        not change this!\n\n    Examples\n    --------\n\n    To transform to the Galactocentric frame with the default\n    frame attributes, pass the uninstantiated class name to the\n    ``transform_to()`` method of a `~astropy.coordinates.SkyCoord` object::\n\n        >>> import astropy.units as u\n        >>> import astropy.coordinates as coord\n        >>> c = coord.SkyCoord(ra=[158.3122, 24.5] * u.degree,\n        ...                    dec=[-17.3, 81.52] * u.degree,\n        ...                    distance=[11.5, 24.12] * u.kpc,\n        ...                    frame='icrs')\n        >>> c.transform_to(coord.Galactocentric) # doctest: +FLOAT_CMP\n        <SkyCoord (Galactocentric: galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            (266.4051, -28.936175)>, galcen_distance=8.122 kpc, galcen_v_sun=(12.9, 245.6, 7.78) km / s, z_sun=20.8 pc, roll=0.0 deg): (x, y, z) in kpc\n            [( -9.43489286, -9.40062188, 6.51345359),\n             (-21.11044918, 18.76334013, 7.83175149)]>\n\n\n    To specify a custom set of parameters, you have to include extra keyword\n    arguments when initializing the Galactocentric frame object::\n\n        >>> c.transform_to(coord.Galactocentric(galcen_distance=8.1*u.kpc)) # doctest: +FLOAT_CMP\n        <SkyCoord (Galactocentric: galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            (266.4051, -28.936175)>, galcen_distance=8.1 kpc, galcen_v_sun=(12.9, 245.6, 7.78) km / s, z_sun=20.8 pc, roll=0.0 deg): (x, y, z) in kpc\n            [( -9.41284763, -9.40062188, 6.51346272),\n             (-21.08839478, 18.76334013, 7.83184184)]>\n\n    Similarly, transforming from the Galactocentric frame to another coordinate frame::\n\n        >>> c = coord.SkyCoord(x=[-8.3, 4.5] * u.kpc,\n        ...                    y=[0., 81.52] * u.kpc,\n        ...                    z=[0.027, 24.12] * u.kpc,\n        ...                    frame=coord.Galactocentric)\n        >>> c.transform_to(coord.ICRS) # doctest: +FLOAT_CMP\n        <SkyCoord (ICRS): (ra, dec, distance) in (deg, deg, kpc)\n            [( 88.22423301, 29.88672864,  0.17813456),\n             (289.72864549, 49.9865043 , 85.93949064)]>\n\n    Or, with custom specification of the Galactic center::\n\n        >>> c = coord.SkyCoord(x=[-8.0, 4.5] * u.kpc,\n        ...                    y=[0., 81.52] * u.kpc,\n        ...                    z=[21.0, 24120.0] * u.pc,\n        ...                    frame=coord.Galactocentric,\n        ...                    z_sun=21 * u.pc, galcen_distance=8. * u.kpc)\n        >>> c.transform_to(coord.ICRS) # doctest: +FLOAT_CMP\n        <SkyCoord (ICRS): (ra, dec, distance) in (deg, deg, kpc)\n            [( 86.2585249 , 28.85773187, 2.75625475e-05),\n             (289.77285255, 50.06290457, 8.59216010e+01)]>\n\n\"\"\"\n\nframe_transform_graph._add_merged_transform(Galactocentric, ICRS, Galactocentric)"},{"col":0,"comment":"null","endLoc":24,"header":"@frame_transform_graph.transform(StaticMatrixTransform, Supergalactic, Galactic)\ndef supergal_to_gal()","id":15846,"name":"supergal_to_gal","nodeType":"Function","startLoc":22,"text":"@frame_transform_graph.transform(StaticMatrixTransform, Supergalactic, Galactic)\ndef supergal_to_gal():\n    return matrix_transpose(gal_to_supergal())"},{"col":0,"comment":"\n    B-matrix from USNO circular 179.  Used by the ICRS->FK5 transformation\n    functions.\n    ","endLoc":29,"header":"def _icrs_to_fk5_matrix()","id":15847,"name":"_icrs_to_fk5_matrix","nodeType":"Function","startLoc":15,"text":"def _icrs_to_fk5_matrix():\n    \"\"\"\n    B-matrix from USNO circular 179.  Used by the ICRS->FK5 transformation\n    functions.\n    \"\"\"\n\n    eta0 = -19.9 / 3600000.\n    xi0 = 9.1 / 3600000.\n    da0 = -22.9 / 3600000.\n\n    m1 = rotation_matrix(-eta0, 'x')\n    m2 = rotation_matrix(xi0, 'y')\n    m3 = rotation_matrix(da0, 'z')\n\n    return matrix_product(m1, m2, m3)"},{"col":0,"comment":"null","endLoc":40,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, ICRS, FK5)\ndef icrs_to_fk5(icrscoord, fk5frame)","id":15848,"name":"icrs_to_fk5","nodeType":"Function","startLoc":36,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, ICRS, FK5)\ndef icrs_to_fk5(icrscoord, fk5frame):\n    # ICRS is by design very close to J2000 equinox\n    pmat = fk5frame._precession_matrix(EQUINOX_J2000, fk5frame.equinox)\n    return matrix_product(pmat, _ICRS_TO_FK5_J2000_MAT)"},{"id":15849,"name":"astropy/uncertainty","nodeType":"Package"},{"fileName":"core.py","filePath":"astropy/uncertainty","id":15850,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nDistribution class and associated machinery.\n\"\"\"\nimport builtins\n\nimport numpy as np\n\nfrom astropy import units as u\nfrom astropy import stats\n\n__all__ = ['Distribution']\n\n\n# we set this by hand because the symbolic expression (below) requires scipy\n# SMAD_SCALE_FACTOR = 1 / scipy.stats.norm.ppf(0.75)\nSMAD_SCALE_FACTOR = 1.48260221850560203193936104071326553821563720703125\n\n\nclass Distribution:\n    \"\"\"\n    A scalar value or array values with associated uncertainty distribution.\n\n    This object will take its exact type from whatever the ``samples`` argument\n    is. In general this is expected to be an `~astropy.units.Quantity` or\n    `numpy.ndarray`, although anything compatible with `numpy.asanyarray` is\n    possible.\n\n    See also: https://docs.astropy.org/en/stable/uncertainty/\n\n    Parameters\n    ----------\n    samples : array-like\n        The distribution, with sampling along the *leading* axis. If 1D, the\n        sole dimension is used as the sampling axis (i.e., it is a scalar\n        distribution).\n    \"\"\"\n    _generated_subclasses = {}\n\n    def __new__(cls, samples):\n        if isinstance(samples, Distribution):\n            samples = samples.distribution\n        else:\n            samples = np.asanyarray(samples, order='C')\n        if samples.shape == ():\n            raise TypeError('Attempted to initialize a Distribution with a scalar')\n\n        new_dtype = np.dtype({'names': ['samples'],\n                              'formats': [(samples.dtype, (samples.shape[-1],))]})\n        samples_cls = type(samples)\n        new_cls = cls._generated_subclasses.get(samples_cls)\n        if new_cls is None:\n            # Make a new class with the combined name, inserting Distribution\n            # itself below the samples class since that way Quantity methods\n            # like \".to\" just work (as .view() gets intercepted).  However,\n            # repr and str are problems, so we put those on top.\n            # TODO: try to deal with this at the lower level.  The problem is\n            # that array2string does not allow one to override how structured\n            # arrays are typeset, leading to all samples to be shown.  It may\n            # be possible to hack oneself out by temporarily becoming a void.\n            new_name = samples_cls.__name__ + cls.__name__\n            new_cls = type(\n                new_name,\n                (_DistributionRepr, samples_cls, ArrayDistribution),\n                {'_samples_cls': samples_cls})\n            cls._generated_subclasses[samples_cls] = new_cls\n\n        self = samples.view(dtype=new_dtype, type=new_cls)\n        # Get rid of trailing dimension of 1.\n        self.shape = samples.shape[:-1]\n        return self\n\n    @property\n    def distribution(self):\n        return self['samples']\n\n    def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):\n        converted = []\n        outputs = kwargs.pop('out', None)\n        if outputs:\n            kwargs['out'] = tuple((output.distribution if\n                                   isinstance(output, Distribution)\n                                   else output) for output in outputs)\n        if method in {'reduce', 'accumulate', 'reduceat'}:\n            axis = kwargs.get('axis', None)\n            if axis is None:\n                assert isinstance(inputs[0], Distribution)\n                kwargs['axis'] = tuple(range(inputs[0].ndim))\n\n        for input_ in inputs:\n            if isinstance(input_, Distribution):\n                converted.append(input_.distribution)\n            else:\n                shape = getattr(input_, 'shape', ())\n                if shape:\n                    converted.append(input_[..., np.newaxis])\n                else:\n                    converted.append(input_)\n\n        results = getattr(ufunc, method)(*converted, **kwargs)\n\n        if not isinstance(results, tuple):\n            results = (results,)\n        if outputs is None:\n            outputs = (None,) * len(results)\n\n        finals = []\n        for result, output in zip(results, outputs):\n            if output is not None:\n                finals.append(output)\n            else:\n                if getattr(result, 'shape', False):\n                    finals.append(Distribution(result))\n                else:\n                    finals.append(result)\n\n        return finals if len(finals) > 1 else finals[0]\n\n    @property\n    def n_samples(self):\n        \"\"\"\n        The number of samples of this distribution.  A single `int`.\n        \"\"\"\n        return self.dtype['samples'].shape[0]\n\n    def pdf_mean(self, dtype=None, out=None):\n        \"\"\"\n        The mean of this distribution.\n\n        Arguments are as for `numpy.mean`.\n        \"\"\"\n        return self.distribution.mean(axis=-1, dtype=dtype, out=out)\n\n    def pdf_std(self, dtype=None, out=None, ddof=0):\n        \"\"\"\n        The standard deviation of this distribution.\n\n        Arguments are as for `numpy.std`.\n        \"\"\"\n        return self.distribution.std(axis=-1, dtype=dtype, out=out, ddof=ddof)\n\n    def pdf_var(self, dtype=None, out=None, ddof=0):\n        \"\"\"\n        The variance of this distribution.\n\n        Arguments are as for `numpy.var`.\n        \"\"\"\n        return self.distribution.var(axis=-1, dtype=dtype, out=out, ddof=ddof)\n\n    def pdf_median(self, out=None):\n        \"\"\"\n        The median of this distribution.\n\n        Parameters\n        ----------\n        out : array, optional\n            Alternative output array in which to place the result. It must\n            have the same shape and buffer length as the expected output,\n            but the type (of the output) will be cast if necessary.\n        \"\"\"\n        return np.median(self.distribution, axis=-1, out=out)\n\n    def pdf_mad(self, out=None):\n        \"\"\"\n        The median absolute deviation of this distribution.\n\n        Parameters\n        ----------\n        out : array, optional\n            Alternative output array in which to place the result. It must\n            have the same shape and buffer length as the expected output,\n            but the type (of the output) will be cast if necessary.\n        \"\"\"\n        median = self.pdf_median(out=out)\n        absdiff = np.abs(self - median)\n        return np.median(absdiff.distribution, axis=-1, out=median,\n                         overwrite_input=True)\n\n    def pdf_smad(self, out=None):\n        \"\"\"\n        The median absolute deviation of this distribution rescaled to match the\n        standard deviation for a normal distribution.\n\n        Parameters\n        ----------\n        out : array, optional\n            Alternative output array in which to place the result. It must\n            have the same shape and buffer length as the expected output,\n            but the type (of the output) will be cast if necessary.\n        \"\"\"\n        result = self.pdf_mad(out=out)\n        result *= SMAD_SCALE_FACTOR\n        return result\n\n    def pdf_percentiles(self, percentile, **kwargs):\n        \"\"\"\n        Compute percentiles of this Distribution.\n\n        Parameters\n        ----------\n        percentile : float or array of float or `~astropy.units.Quantity`\n            The desired percentiles of the distribution (i.e., on [0,100]).\n            `~astropy.units.Quantity` will be converted to percent, meaning\n            that a ``dimensionless_unscaled`` `~astropy.units.Quantity` will\n            be interpreted as a quantile.\n\n        Additional keywords are passed into `numpy.percentile`.\n\n        Returns\n        -------\n        percentiles : `~astropy.units.Quantity` ['dimensionless']\n            The ``fracs`` percentiles of this distribution.\n        \"\"\"\n        percentile = u.Quantity(percentile, u.percent).value\n        percs = np.percentile(self.distribution, percentile, axis=-1, **kwargs)\n        # numpy.percentile strips units for unclear reasons, so we have to make\n        # a new object with units\n        if hasattr(self.distribution, '_new_view'):\n            return self.distribution._new_view(percs)\n        else:\n            return percs\n\n    def pdf_histogram(self, **kwargs):\n        \"\"\"\n        Compute histogram over the samples in the distribution.\n\n        Parameters\n        ----------\n        All keyword arguments are passed into `astropy.stats.histogram`. Note\n        That some of these options may not be valid for some multidimensional\n        distributions.\n\n        Returns\n        -------\n        hist : array\n            The values of the histogram. Trailing dimension is the histogram\n            dimension.\n        bin_edges : array of dtype float\n            Return the bin edges ``(length(hist)+1)``. Trailing dimension is the\n            bin histogram dimension.\n        \"\"\"\n        distr = self.distribution\n        raveled_distr = distr.reshape(distr.size//distr.shape[-1], distr.shape[-1])\n\n        nhists = []\n        bin_edges = []\n        for d in raveled_distr:\n            nhist, bin_edge = stats.histogram(d, **kwargs)\n            nhists.append(nhist)\n            bin_edges.append(bin_edge)\n\n        nhists = np.array(nhists)\n        nh_shape = self.shape + (nhists.size//self.size,)\n        bin_edges = np.array(bin_edges)\n        be_shape = self.shape + (bin_edges.size//self.size,)\n        return nhists.reshape(nh_shape), bin_edges.reshape(be_shape)\n\n\nclass ScalarDistribution(Distribution, np.void):\n    \"\"\"Scalar distribution.\n\n    This class mostly exists to make `~numpy.array2print` possible for\n    all subclasses.  It is a scalar element, still with n_samples samples.\n    \"\"\"\n    pass\n\n\nclass ArrayDistribution(Distribution, np.ndarray):\n    # This includes the important override of view and __getitem__\n    # which are needed for all ndarray subclass Distributions, but not\n    # for the scalar one.\n    _samples_cls = np.ndarray\n\n    # Override view so that we stay a Distribution version of the new type.\n    def view(self, dtype=None, type=None):\n        \"\"\"New view of array with the same data.\n\n        Like `~numpy.ndarray.view` except that the result will always be a new\n        `~astropy.uncertainty.Distribution` instance.  If the requested\n        ``type`` is a `~astropy.uncertainty.Distribution`, then no change in\n        ``dtype`` is allowed.\n\n        \"\"\"\n        if type is None and (isinstance(dtype, builtins.type)\n                             and issubclass(dtype, np.ndarray)):\n            type = dtype\n            dtype = None\n\n        view_args = [item for item in (dtype, type) if item is not None]\n\n        if type is None or (isinstance(type, builtins.type)\n                            and issubclass(type, Distribution)):\n            if dtype is not None and dtype != self.dtype:\n                raise ValueError('cannot view as Distribution subclass with a new dtype.')\n            return super().view(*view_args)\n\n        # View as the new non-Distribution class, but turn into a Distribution again.\n        result = self.distribution.view(*view_args)\n        return Distribution(result)\n\n    # Override __getitem__ so that 'samples' is returned as the sample class.\n    def __getitem__(self, item):\n        result = super().__getitem__(item)\n        if item == 'samples':\n            # Here, we need to avoid our own redefinition of view.\n            return super(ArrayDistribution, result).view(self._samples_cls)\n        elif isinstance(result, np.void):\n            return result.view((ScalarDistribution, result.dtype))\n        else:\n            return result\n\n\nclass _DistributionRepr:\n    def __repr__(self):\n        reprarr = repr(self.distribution)\n        if reprarr.endswith('>'):\n            firstspace = reprarr.find(' ')\n            reprarr = reprarr[firstspace+1:-1]  # :-1] removes the ending '>'\n            return '<{} {} with n_samples={}>'.format(self.__class__.__name__,\n                                                      reprarr, self.n_samples)\n        else:  # numpy array-like\n            firstparen = reprarr.find('(')\n            reprarr = reprarr[firstparen:]\n            return f'{self.__class__.__name__}{reprarr} with n_samples={self.n_samples}'\n            return reprarr\n\n    def __str__(self):\n        distrstr = str(self.distribution)\n        toadd = f' with n_samples={self.n_samples}'\n        return distrstr + toadd\n\n    def _repr_latex_(self):\n        if hasattr(self.distribution, '_repr_latex_'):\n            superlatex = self.distribution._repr_latex_()\n            toadd = fr', \\; n_{{\\rm samp}}={self.n_samples}'\n            return superlatex[:-1] + toadd + superlatex[-1]\n        else:\n            return None\n\n\nclass NdarrayDistribution(_DistributionRepr, ArrayDistribution):\n    pass\n\n\n# Ensure our base NdarrayDistribution is known.\nDistribution._generated_subclasses[np.ndarray] = NdarrayDistribution\n"},{"col":0,"comment":"null","endLoc":88,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GeocentricMeanEcliptic, GCRS)\ndef geoecliptic_to_gcrs(from_coo, gcrs_frame)","id":15851,"name":"geoecliptic_to_gcrs","nodeType":"Function","startLoc":81,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GeocentricMeanEcliptic, GCRS)\ndef geoecliptic_to_gcrs(from_coo, gcrs_frame):\n    rmat = _mean_ecliptic_rotation_matrix(from_coo.equinox)\n    newrepr = from_coo.cartesian.transform(matrix_transpose(rmat))\n    gcrs = GCRS(newrepr, obstime=from_coo.obstime)\n\n    # now do any needed offsets (no-op if same obstime and 0 pos/vel)\n    return gcrs.transform_to(gcrs_frame)"},{"col":0,"comment":"null","endLoc":48,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, FK5, ICRS)\ndef fk5_to_icrs(fk5coord, icrsframe)","id":15852,"name":"fk5_to_icrs","nodeType":"Function","startLoc":44,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, FK5, ICRS)\ndef fk5_to_icrs(fk5coord, icrsframe):\n    # ICRS is by design very close to J2000 equinox\n    pmat = fk5coord._precession_matrix(fk5coord.equinox, EQUINOX_J2000)\n    return matrix_product(matrix_transpose(_ICRS_TO_FK5_J2000_MAT), pmat)"},{"col":0,"comment":"\n    Generates a string that can be used in other docstrings to include a\n    transformation graph, showing the available transforms and\n    coordinate systems.\n\n    Parameters\n    ----------\n    transform_graph : `~.coordinates.TransformGraph`\n\n    Returns\n    -------\n    docstring : str\n        A string that can be added to the end of a docstring to show the\n        transform graph.\n    ","endLoc":145,"header":"def make_transform_graph_docs(transform_graph)","id":15853,"name":"make_transform_graph_docs","nodeType":"Function","startLoc":75,"text":"def make_transform_graph_docs(transform_graph):\n    \"\"\"\n    Generates a string that can be used in other docstrings to include a\n    transformation graph, showing the available transforms and\n    coordinate systems.\n\n    Parameters\n    ----------\n    transform_graph : `~.coordinates.TransformGraph`\n\n    Returns\n    -------\n    docstring : str\n        A string that can be added to the end of a docstring to show the\n        transform graph.\n    \"\"\"\n    from textwrap import dedent\n    coosys = [transform_graph.lookup_name(item) for\n              item in transform_graph.get_names()]\n\n    # currently, all of the priorities are set to 1, so we don't need to show\n    #   then in the transform graph.\n    graphstr = transform_graph.to_dot_graph(addnodes=coosys,\n                                            priorities=False)\n\n    docstr = \"\"\"\n    The diagram below shows all of the built in coordinate systems,\n    their aliases (useful for converting other coordinates to them using\n    attribute-style access) and the pre-defined transformations between\n    them.  The user is free to override any of these transformations by\n    defining new transformations between these systems, but the\n    pre-defined transformations should be sufficient for typical usage.\n\n    The color of an edge in the graph (i.e. the transformations between two\n    frames) is set by the type of transformation; the legend box defines the\n    mapping from transform class name to color.\n\n    .. Wrap the graph in a div with a custom class to allow themeing.\n    .. container:: frametransformgraph\n\n        .. graphviz::\n\n    \"\"\"\n\n    docstr = dedent(docstr) + '        ' + graphstr.replace('\\n', '\\n        ')\n\n    # colors are in dictionary at the bottom of transformations.py\n    from astropy.coordinates.transformations import trans_to_color\n    html_list_items = []\n    for cls, color in trans_to_color.items():\n        block = f\"\"\"\n            <li style='list-style: none;'>\n                <p style=\"font-size: 12px;line-height: 24px;font-weight: normal;color: #848484;padding: 0;margin: 0;\">\n                    <b>{cls.__name__}:</b>\n                    <span style=\"font-size: 24px; color: {color};\"><b>➝</b></span>\n                </p>\n            </li>\n        \"\"\"\n        html_list_items.append(block)\n\n    nl = '\\n'\n    graph_legend = f\"\"\"\n    .. raw:: html\n\n        <ul>\n            {nl.join(html_list_items)}\n        </ul>\n    \"\"\"\n    docstr = docstr + dedent(graph_legend)\n\n    return docstr"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":15854,"name":"_ICRS_TO_FK5_J2000_MAT","nodeType":"Attribute","startLoc":33,"text":"_ICRS_TO_FK5_J2000_MAT"},{"col":0,"comment":"","endLoc":6,"header":"icrs_fk5_transforms.py#<anonymous>","id":15855,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"_ICRS_TO_FK5_J2000_MAT = _icrs_to_fk5_matrix()"},{"fileName":"distributions.py","filePath":"astropy/uncertainty","id":15856,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nBuilt-in distribution-creation functions.\n\"\"\"\nfrom warnings import warn\n\nimport numpy as np\n\nfrom astropy import units as u\nfrom .core import Distribution\n\n__all__ = ['normal', 'poisson', 'uniform']\n\n\ndef normal(center, *, std=None, var=None, ivar=None, n_samples,\n           cls=Distribution, **kwargs):\n    \"\"\"\n    Create a Gaussian/normal distribution.\n\n    Parameters\n    ----------\n    center : `~astropy.units.Quantity`\n        The center of this distribution\n    std : `~astropy.units.Quantity` or None\n        The standard deviation/σ of this distribution. Shape must match and unit\n        must be compatible with ``center``, or be `None` (if ``var`` or ``ivar``\n        are set).\n    var : `~astropy.units.Quantity` or None\n        The variance of this distribution. Shape must match and unit must be\n        compatible with ``center``, or be `None` (if ``std`` or ``ivar`` are set).\n    ivar : `~astropy.units.Quantity` or None\n        The inverse variance of this distribution. Shape must match and unit\n        must be compatible with ``center``, or be `None` (if ``std`` or ``var``\n        are set).\n    n_samples : int\n        The number of Monte Carlo samples to use with this distribution\n    cls : class\n        The class to use to create this distribution.  Typically a\n        `Distribution` subclass.\n\n    Remaining keywords are passed into the constructor of the ``cls``\n\n    Returns\n    -------\n    distr : `~astropy.uncertainty.Distribution` or object\n        The sampled Gaussian distribution.\n        The type will be the same as the parameter ``cls``.\n\n    \"\"\"\n    center = np.asanyarray(center)\n    if var is not None:\n        if std is None:\n            std = np.asanyarray(var)**0.5\n        else:\n            raise ValueError('normal cannot take both std and var')\n    if ivar is not None:\n        if std is None:\n            std = np.asanyarray(ivar)**-0.5\n        else:\n            raise ValueError('normal cannot take both ivar and '\n                             'and std or var')\n    if std is None:\n        raise ValueError('normal requires one of std, var, or ivar')\n    else:\n        std = np.asanyarray(std)\n\n    randshape = np.broadcast(std, center).shape + (n_samples,)\n    samples = center[..., np.newaxis] + np.random.randn(*randshape) * std[..., np.newaxis]\n    return cls(samples, **kwargs)\n\n\nCOUNT_UNITS = (u.count, u.electron, u.dimensionless_unscaled, u.chan, u.bin, u.vox, u.bit, u.byte)\n\n\ndef poisson(center, n_samples, cls=Distribution, **kwargs):\n    \"\"\"\n    Create a Poisson distribution.\n\n    Parameters\n    ----------\n    center : `~astropy.units.Quantity`\n        The center value of this distribution (i.e., λ).\n    n_samples : int\n        The number of Monte Carlo samples to use with this distribution\n    cls : class\n        The class to use to create this distribution.  Typically a\n        `Distribution` subclass.\n\n    Remaining keywords are passed into the constructor of the ``cls``\n\n    Returns\n    -------\n    distr : `~astropy.uncertainty.Distribution` or object\n        The sampled Poisson distribution.\n        The type will be the same as the parameter ``cls``.\n    \"\"\"\n    # we convert to arrays because np.random.poisson has trouble with quantities\n    has_unit = False\n    if hasattr(center, 'unit'):\n        has_unit = True\n        poissonarr = np.asanyarray(center.value)\n    else:\n        poissonarr = np.asanyarray(center)\n    randshape = poissonarr.shape + (n_samples,)\n\n    samples = np.random.poisson(poissonarr[..., np.newaxis], randshape)\n    if has_unit:\n        if center.unit == u.adu:\n            warn('ADUs were provided to poisson.  ADUs are not strictly count'\n                 'units because they need the gain to be applied. It is '\n                 'recommended you apply the gain to convert to e.g. electrons.')\n        elif center.unit not in COUNT_UNITS:\n            warn('Unit {} was provided to poisson, which is not one of {}, '\n                 'and therefore suspect as a \"counting\" unit.  Ensure you mean '\n                 'to use Poisson statistics.'.format(center.unit, COUNT_UNITS))\n\n        # re-attach the unit\n        samples = samples * center.unit\n\n    return cls(samples, **kwargs)\n\n\ndef uniform(*, lower=None, upper=None, center=None, width=None, n_samples,\n            cls=Distribution, **kwargs):\n    \"\"\"\n    Create a Uniform distriution from the lower and upper bounds.\n\n    Note that this function requires keywords to be explicit, and requires\n    either ``lower``/``upper`` or ``center``/``width``.\n\n    Parameters\n    ----------\n    lower : array-like\n        The lower edge of this distribution. If a `~astropy.units.Quantity`, the\n        distribution will have the same units as ``lower``.\n    upper : `~astropy.units.Quantity`\n        The upper edge of this distribution. Must match shape and if a\n        `~astropy.units.Quantity` must have compatible units with ``lower``.\n    center : array-like\n        The center value of the distribution. Cannot be provided at the same\n        time as ``lower``/``upper``.\n    width : array-like\n        The width of the distribution.  Must have the same shape and compatible\n        units with ``center`` (if any).\n    n_samples : int\n        The number of Monte Carlo samples to use with this distribution\n    cls : class\n        The class to use to create this distribution.  Typically a\n        `Distribution` subclass.\n\n    Remaining keywords are passed into the constructor of the ``cls``\n\n    Returns\n    -------\n    distr : `~astropy.uncertainty.Distribution` or object\n        The sampled uniform distribution.\n        The type will be the same as the parameter ``cls``.\n    \"\"\"\n    if center is None and width is None:\n        lower = np.asanyarray(lower)\n        upper = np.asanyarray(upper)\n        if lower.shape != upper.shape:\n            raise ValueError('lower and upper must have consistent shapes')\n    elif upper is None and lower is None:\n        center = np.asanyarray(center)\n        width = np.asanyarray(width)\n        lower = center - width/2\n        upper = center + width/2\n    else:\n        raise ValueError('either upper/lower or center/width must be given '\n                         'to uniform - other combinations are not valid')\n\n    newshape = lower.shape + (n_samples,)\n    if lower.shape == tuple() and upper.shape == tuple():\n        width = upper - lower  # scalar\n    else:\n        width = (upper - lower)[:, np.newaxis]\n        lower = lower[:, np.newaxis]\n    samples = lower + width * np.random.uniform(size=newshape)\n\n    return cls(samples, **kwargs)\n"},{"col":0,"comment":"","endLoc":6,"header":"utils.py#<anonymous>","id":15857,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module contains functions/values used repeatedly in different modules of\nthe ``builtin_frames`` package.\n\"\"\"\n\nEQUINOX_J2000 = Time('J2000', scale='tt')\n\nEQUINOX_B1950 = Time('B1950', scale='tt')\n\nDEFAULT_OBSTIME = Time('J2000', scale='tt')\n\nEARTH_CENTER = EarthLocation(0*u.km, 0*u.km, 0*u.km)\n\nPIOVER2 = np.pi / 2.\n\n_DEFAULT_PM = (0.035, 0.29)*u.arcsec"},{"className":"Distribution","col":0,"comment":"\n    A scalar value or array values with associated uncertainty distribution.\n\n    This object will take its exact type from whatever the ``samples`` argument\n    is. In general this is expected to be an `~astropy.units.Quantity` or\n    `numpy.ndarray`, although anything compatible with `numpy.asanyarray` is\n    possible.\n\n    See also: https://docs.astropy.org/en/stable/uncertainty/\n\n    Parameters\n    ----------\n    samples : array-like\n        The distribution, with sampling along the *leading* axis. If 1D, the\n        sole dimension is used as the sampling axis (i.e., it is a scalar\n        distribution).\n    ","endLoc":258,"id":15858,"nodeType":"Class","startLoc":22,"text":"class Distribution:\n    \"\"\"\n    A scalar value or array values with associated uncertainty distribution.\n\n    This object will take its exact type from whatever the ``samples`` argument\n    is. In general this is expected to be an `~astropy.units.Quantity` or\n    `numpy.ndarray`, although anything compatible with `numpy.asanyarray` is\n    possible.\n\n    See also: https://docs.astropy.org/en/stable/uncertainty/\n\n    Parameters\n    ----------\n    samples : array-like\n        The distribution, with sampling along the *leading* axis. If 1D, the\n        sole dimension is used as the sampling axis (i.e., it is a scalar\n        distribution).\n    \"\"\"\n    _generated_subclasses = {}\n\n    def __new__(cls, samples):\n        if isinstance(samples, Distribution):\n            samples = samples.distribution\n        else:\n            samples = np.asanyarray(samples, order='C')\n        if samples.shape == ():\n            raise TypeError('Attempted to initialize a Distribution with a scalar')\n\n        new_dtype = np.dtype({'names': ['samples'],\n                              'formats': [(samples.dtype, (samples.shape[-1],))]})\n        samples_cls = type(samples)\n        new_cls = cls._generated_subclasses.get(samples_cls)\n        if new_cls is None:\n            # Make a new class with the combined name, inserting Distribution\n            # itself below the samples class since that way Quantity methods\n            # like \".to\" just work (as .view() gets intercepted).  However,\n            # repr and str are problems, so we put those on top.\n            # TODO: try to deal with this at the lower level.  The problem is\n            # that array2string does not allow one to override how structured\n            # arrays are typeset, leading to all samples to be shown.  It may\n            # be possible to hack oneself out by temporarily becoming a void.\n            new_name = samples_cls.__name__ + cls.__name__\n            new_cls = type(\n                new_name,\n                (_DistributionRepr, samples_cls, ArrayDistribution),\n                {'_samples_cls': samples_cls})\n            cls._generated_subclasses[samples_cls] = new_cls\n\n        self = samples.view(dtype=new_dtype, type=new_cls)\n        # Get rid of trailing dimension of 1.\n        self.shape = samples.shape[:-1]\n        return self\n\n    @property\n    def distribution(self):\n        return self['samples']\n\n    def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):\n        converted = []\n        outputs = kwargs.pop('out', None)\n        if outputs:\n            kwargs['out'] = tuple((output.distribution if\n                                   isinstance(output, Distribution)\n                                   else output) for output in outputs)\n        if method in {'reduce', 'accumulate', 'reduceat'}:\n            axis = kwargs.get('axis', None)\n            if axis is None:\n                assert isinstance(inputs[0], Distribution)\n                kwargs['axis'] = tuple(range(inputs[0].ndim))\n\n        for input_ in inputs:\n            if isinstance(input_, Distribution):\n                converted.append(input_.distribution)\n            else:\n                shape = getattr(input_, 'shape', ())\n                if shape:\n                    converted.append(input_[..., np.newaxis])\n                else:\n                    converted.append(input_)\n\n        results = getattr(ufunc, method)(*converted, **kwargs)\n\n        if not isinstance(results, tuple):\n            results = (results,)\n        if outputs is None:\n            outputs = (None,) * len(results)\n\n        finals = []\n        for result, output in zip(results, outputs):\n            if output is not None:\n                finals.append(output)\n            else:\n                if getattr(result, 'shape', False):\n                    finals.append(Distribution(result))\n                else:\n                    finals.append(result)\n\n        return finals if len(finals) > 1 else finals[0]\n\n    @property\n    def n_samples(self):\n        \"\"\"\n        The number of samples of this distribution.  A single `int`.\n        \"\"\"\n        return self.dtype['samples'].shape[0]\n\n    def pdf_mean(self, dtype=None, out=None):\n        \"\"\"\n        The mean of this distribution.\n\n        Arguments are as for `numpy.mean`.\n        \"\"\"\n        return self.distribution.mean(axis=-1, dtype=dtype, out=out)\n\n    def pdf_std(self, dtype=None, out=None, ddof=0):\n        \"\"\"\n        The standard deviation of this distribution.\n\n        Arguments are as for `numpy.std`.\n        \"\"\"\n        return self.distribution.std(axis=-1, dtype=dtype, out=out, ddof=ddof)\n\n    def pdf_var(self, dtype=None, out=None, ddof=0):\n        \"\"\"\n        The variance of this distribution.\n\n        Arguments are as for `numpy.var`.\n        \"\"\"\n        return self.distribution.var(axis=-1, dtype=dtype, out=out, ddof=ddof)\n\n    def pdf_median(self, out=None):\n        \"\"\"\n        The median of this distribution.\n\n        Parameters\n        ----------\n        out : array, optional\n            Alternative output array in which to place the result. It must\n            have the same shape and buffer length as the expected output,\n            but the type (of the output) will be cast if necessary.\n        \"\"\"\n        return np.median(self.distribution, axis=-1, out=out)\n\n    def pdf_mad(self, out=None):\n        \"\"\"\n        The median absolute deviation of this distribution.\n\n        Parameters\n        ----------\n        out : array, optional\n            Alternative output array in which to place the result. It must\n            have the same shape and buffer length as the expected output,\n            but the type (of the output) will be cast if necessary.\n        \"\"\"\n        median = self.pdf_median(out=out)\n        absdiff = np.abs(self - median)\n        return np.median(absdiff.distribution, axis=-1, out=median,\n                         overwrite_input=True)\n\n    def pdf_smad(self, out=None):\n        \"\"\"\n        The median absolute deviation of this distribution rescaled to match the\n        standard deviation for a normal distribution.\n\n        Parameters\n        ----------\n        out : array, optional\n            Alternative output array in which to place the result. It must\n            have the same shape and buffer length as the expected output,\n            but the type (of the output) will be cast if necessary.\n        \"\"\"\n        result = self.pdf_mad(out=out)\n        result *= SMAD_SCALE_FACTOR\n        return result\n\n    def pdf_percentiles(self, percentile, **kwargs):\n        \"\"\"\n        Compute percentiles of this Distribution.\n\n        Parameters\n        ----------\n        percentile : float or array of float or `~astropy.units.Quantity`\n            The desired percentiles of the distribution (i.e., on [0,100]).\n            `~astropy.units.Quantity` will be converted to percent, meaning\n            that a ``dimensionless_unscaled`` `~astropy.units.Quantity` will\n            be interpreted as a quantile.\n\n        Additional keywords are passed into `numpy.percentile`.\n\n        Returns\n        -------\n        percentiles : `~astropy.units.Quantity` ['dimensionless']\n            The ``fracs`` percentiles of this distribution.\n        \"\"\"\n        percentile = u.Quantity(percentile, u.percent).value\n        percs = np.percentile(self.distribution, percentile, axis=-1, **kwargs)\n        # numpy.percentile strips units for unclear reasons, so we have to make\n        # a new object with units\n        if hasattr(self.distribution, '_new_view'):\n            return self.distribution._new_view(percs)\n        else:\n            return percs\n\n    def pdf_histogram(self, **kwargs):\n        \"\"\"\n        Compute histogram over the samples in the distribution.\n\n        Parameters\n        ----------\n        All keyword arguments are passed into `astropy.stats.histogram`. Note\n        That some of these options may not be valid for some multidimensional\n        distributions.\n\n        Returns\n        -------\n        hist : array\n            The values of the histogram. Trailing dimension is the histogram\n            dimension.\n        bin_edges : array of dtype float\n            Return the bin edges ``(length(hist)+1)``. Trailing dimension is the\n            bin histogram dimension.\n        \"\"\"\n        distr = self.distribution\n        raveled_distr = distr.reshape(distr.size//distr.shape[-1], distr.shape[-1])\n\n        nhists = []\n        bin_edges = []\n        for d in raveled_distr:\n            nhist, bin_edge = stats.histogram(d, **kwargs)\n            nhists.append(nhist)\n            bin_edges.append(bin_edge)\n\n        nhists = np.array(nhists)\n        nh_shape = self.shape + (nhists.size//self.size,)\n        bin_edges = np.array(bin_edges)\n        be_shape = self.shape + (bin_edges.size//self.size,)\n        return nhists.reshape(nh_shape), bin_edges.reshape(be_shape)"},{"fileName":"__init__.py","filePath":"astropy/uncertainty","id":15859,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis sub-package contains classes and functions for creating distributions that\nwork similar to `~astropy.units.Quantity` or array objects, but can propagate\nuncertainties.\n\"\"\"\n\n\nfrom .core import *\nfrom .distributions import *\n"},{"col":0,"comment":"","endLoc":8,"header":"__init__.py#<anonymous>","id":15860,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nThis sub-package contains classes and functions for creating distributions that\nwork similar to `~astropy.units.Quantity` or array objects, but can propagate\nuncertainties.\n\"\"\""},{"id":15861,"name":"astropy/uncertainty/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/uncertainty/tests","id":15862,"nodeType":"File","text":""},{"attributeType":"null","col":0,"comment":"null","endLoc":63,"id":15863,"name":"__all__","nodeType":"Attribute","startLoc":63,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":148,"id":15864,"name":"_transform_graph_docs","nodeType":"Attribute","startLoc":148,"text":"_transform_graph_docs"},{"id":15866,"name":"astropy/visualization","nodeType":"Package"},{"fileName":"transform.py","filePath":"astropy/visualization","id":15867,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\n__all__ = ['BaseTransform', 'CompositeTransform']\n\n\nclass BaseTransform:\n    \"\"\"\n    A transformation object.\n\n    This is used to construct transformations such as scaling, stretching, and\n    so on.\n    \"\"\"\n\n    def __add__(self, other):\n        return CompositeTransform(other, self)\n\n\nclass CompositeTransform(BaseTransform):\n    \"\"\"\n    A combination of two transforms.\n\n    Parameters\n    ----------\n    transform_1 : :class:`astropy.visualization.BaseTransform`\n        The first transform to apply.\n    transform_2 : :class:`astropy.visualization.BaseTransform`\n        The second transform to apply.\n    \"\"\"\n\n    def __init__(self, transform_1, transform_2):\n        super().__init__()\n        self.transform_1 = transform_1\n        self.transform_2 = transform_2\n\n    def __call__(self, values, clip=True):\n        return self.transform_2(self.transform_1(values, clip=clip), clip=clip)\n\n    @property\n    def inverse(self):\n        return self.__class__(self.transform_2.inverse,\n                              self.transform_1.inverse)\n"},{"className":"BaseTransform","col":0,"comment":"\n    A transformation object.\n\n    This is used to construct transformations such as scaling, stretching, and\n    so on.\n    ","endLoc":16,"id":15868,"nodeType":"Class","startLoc":7,"text":"class BaseTransform:\n    \"\"\"\n    A transformation object.\n\n    This is used to construct transformations such as scaling, stretching, and\n    so on.\n    \"\"\"\n\n    def __add__(self, other):\n        return CompositeTransform(other, self)"},{"col":4,"comment":"null","endLoc":73,"header":"def __new__(cls, samples)","id":15869,"name":"__new__","nodeType":"Function","startLoc":42,"text":"def __new__(cls, samples):\n        if isinstance(samples, Distribution):\n            samples = samples.distribution\n        else:\n            samples = np.asanyarray(samples, order='C')\n        if samples.shape == ():\n            raise TypeError('Attempted to initialize a Distribution with a scalar')\n\n        new_dtype = np.dtype({'names': ['samples'],\n                              'formats': [(samples.dtype, (samples.shape[-1],))]})\n        samples_cls = type(samples)\n        new_cls = cls._generated_subclasses.get(samples_cls)\n        if new_cls is None:\n            # Make a new class with the combined name, inserting Distribution\n            # itself below the samples class since that way Quantity methods\n            # like \".to\" just work (as .view() gets intercepted).  However,\n            # repr and str are problems, so we put those on top.\n            # TODO: try to deal with this at the lower level.  The problem is\n            # that array2string does not allow one to override how structured\n            # arrays are typeset, leading to all samples to be shown.  It may\n            # be possible to hack oneself out by temporarily becoming a void.\n            new_name = samples_cls.__name__ + cls.__name__\n            new_cls = type(\n                new_name,\n                (_DistributionRepr, samples_cls, ArrayDistribution),\n                {'_samples_cls': samples_cls})\n            cls._generated_subclasses[samples_cls] = new_cls\n\n        self = samples.view(dtype=new_dtype, type=new_cls)\n        # Get rid of trailing dimension of 1.\n        self.shape = samples.shape[:-1]\n        return self"},{"col":4,"comment":"null","endLoc":16,"header":"def __add__(self, other)","id":15870,"name":"__add__","nodeType":"Function","startLoc":15,"text":"def __add__(self, other):\n        return CompositeTransform(other, self)"},{"col":4,"comment":"null","endLoc":77,"header":"@property\n    def distribution(self)","id":15871,"name":"distribution","nodeType":"Function","startLoc":75,"text":"@property\n    def distribution(self):\n        return self['samples']"},{"col":4,"comment":"null","endLoc":119,"header":"def __array_ufunc__(self, ufunc, method, *inputs, **kwargs)","id":15872,"name":"__array_ufunc__","nodeType":"Function","startLoc":79,"text":"def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):\n        converted = []\n        outputs = kwargs.pop('out', None)\n        if outputs:\n            kwargs['out'] = tuple((output.distribution if\n                                   isinstance(output, Distribution)\n                                   else output) for output in outputs)\n        if method in {'reduce', 'accumulate', 'reduceat'}:\n            axis = kwargs.get('axis', None)\n            if axis is None:\n                assert isinstance(inputs[0], Distribution)\n                kwargs['axis'] = tuple(range(inputs[0].ndim))\n\n        for input_ in inputs:\n            if isinstance(input_, Distribution):\n                converted.append(input_.distribution)\n            else:\n                shape = getattr(input_, 'shape', ())\n                if shape:\n                    converted.append(input_[..., np.newaxis])\n                else:\n                    converted.append(input_)\n\n        results = getattr(ufunc, method)(*converted, **kwargs)\n\n        if not isinstance(results, tuple):\n            results = (results,)\n        if outputs is None:\n            outputs = (None,) * len(results)\n\n        finals = []\n        for result, output in zip(results, outputs):\n            if output is not None:\n                finals.append(output)\n            else:\n                if getattr(result, 'shape', False):\n                    finals.append(Distribution(result))\n                else:\n                    finals.append(result)\n\n        return finals if len(finals) > 1 else finals[0]"},{"attributeType":"null","col":0,"comment":"null","endLoc":152,"id":15873,"name":"__doc__","nodeType":"Attribute","startLoc":152,"text":"__doc__"},{"fileName":"hist.py","filePath":"astropy/visualization","id":15874,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom astropy.stats.histogram import calculate_bin_edges\n\n__all__ = ['hist']\n\n\ndef hist(x, bins=10, ax=None, max_bins=1e5, **kwargs):\n    \"\"\"Enhanced histogram function\n\n    This is a histogram function that enables the use of more sophisticated\n    algorithms for determining bins.  Aside from the ``bins`` argument allowing\n    a string specified how bins are computed, the parameters are the same\n    as pylab.hist().\n\n    This function was ported from astroML: https://www.astroml.org/\n\n    Parameters\n    ----------\n    x : array-like\n        array of data to be histogrammed\n\n    bins : int, list, or str, optional\n        If bins is a string, then it must be one of:\n\n        - 'blocks' : use bayesian blocks for dynamic bin widths\n\n        - 'knuth' : use Knuth's rule to determine bins\n\n        - 'scott' : use Scott's rule to determine bins\n\n        - 'freedman' : use the Freedman-Diaconis rule to determine bins\n\n    ax : `~matplotlib.axes.Axes` instance, optional\n        Specify the Axes on which to draw the histogram. If not specified,\n        then the current active axes will be used.\n\n    max_bins : int, optional\n        Maximum number of bins allowed. With more than a few thousand bins\n        the performance of matplotlib will not be great. If the number of\n        bins is large *and* the number of input data points is large then\n        the it will take a very long time to compute the histogram.\n\n    **kwargs :\n        other keyword arguments are described in ``plt.hist()``.\n\n    Notes\n    -----\n    Return values are the same as for ``plt.hist()``\n\n    See Also\n    --------\n    astropy.stats.histogram\n    \"\"\"\n    # Note that we only calculate the bin edges...matplotlib will calculate\n    # the actual histogram.\n    range = kwargs.get('range', None)\n    weights = kwargs.get('weights', None)\n    bins = calculate_bin_edges(x, bins, range=range, weights=weights)\n\n    if len(bins) > max_bins:\n        raise ValueError('Histogram has too many bins: '\n                         '{nbin}. Use max_bins to increase the number '\n                         'of allowed bins or range to restrict '\n                         'the histogram range.'.format(nbin=len(bins)))\n\n    if ax is None:\n        # optional dependency; only import if strictly needed.\n        import matplotlib.pyplot as plt\n        ax = plt.gca()\n\n    return ax.hist(x, bins, **kwargs)\n"},{"col":0,"comment":"","endLoc":25,"header":"__init__.py#<anonymous>","id":15875,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis package contains the coordinate frames implemented by astropy.\n\nUsers shouldn't use this module directly, but rather import from the\n`astropy.coordinates` module.  While it is likely to exist for the long-term,\nthe existence of this package and details of its organization should be\nconsidered an implementation detail, and is not guaranteed to hold for future\nversions of astropy.\n\nNotes\n-----\nThe builtin frame classes are all imported automatically into this package's\nnamespace, so there's no need to access the sub-modules directly.\n\nTo implement a new frame in Astropy, a developer should add the frame as a new\nmodule in this package.  Any \"self\" transformations (i.e., those that transform\nfrom one frame to another frame of the same class) should be included in that\nmodule.  Transformation functions connecting the new frame to other frames\nshould be in a separate module, which should be imported in this package's\n``__init__.py`` to ensure the transformations are hooked up when this package is\nimported.  Placing the transformation functions in separate modules avoids\ncircular dependencies, because they need references to the frame classes.\n\"\"\"\n\n__all__ = ['ICRS', 'FK5', 'FK4', 'FK4NoETerms', 'Galactic', 'Galactocentric',\n           'galactocentric_frame_defaults',\n           'Supergalactic', 'AltAz', 'HADec', 'GCRS', 'CIRS', 'ITRS', 'HCRS',\n           'TEME', 'TETE', 'PrecessedGeocentric', 'GeocentricMeanEcliptic',\n           'BarycentricMeanEcliptic', 'HeliocentricMeanEcliptic',\n           'GeocentricTrueEcliptic', 'BarycentricTrueEcliptic',\n           'HeliocentricTrueEcliptic',\n           'SkyOffsetFrame', 'GalacticLSR', 'LSR', 'LSRK', 'LSRD',\n           'BaseEclipticFrame', 'BaseRADecFrame', 'make_transform_graph_docs',\n           'HeliocentricEclipticIAU76', 'CustomBarycentricEcliptic']\n\n_transform_graph_docs = make_transform_graph_docs(frame_transform_graph)\n\n__doc__ = _transform_graph_docs"},{"fileName":"lupton_rgb.py","filePath":"astropy/visualization","id":15876,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nCombine 3 images to produce a properly-scaled RGB image following Lupton et al. (2004).\n\nThe three images must be aligned and have the same pixel scale and size.\n\nFor details, see : https://ui.adsabs.harvard.edu/abs/2004PASP..116..133L\n\"\"\"\n\nimport numpy as np\nfrom . import ZScaleInterval\n\n\n__all__ = ['make_lupton_rgb']\n\n\ndef compute_intensity(image_r, image_g=None, image_b=None):\n    \"\"\"\n    Return a naive total intensity from the red, blue, and green intensities.\n\n    Parameters\n    ----------\n    image_r : ndarray\n        Intensity of image to be mapped to red; or total intensity if ``image_g``\n        and ``image_b`` are None.\n    image_g : ndarray, optional\n        Intensity of image to be mapped to green.\n    image_b : ndarray, optional\n        Intensity of image to be mapped to blue.\n\n    Returns\n    -------\n    intensity : ndarray\n        Total intensity from the red, blue and green intensities, or ``image_r``\n        if green and blue images are not provided.\n    \"\"\"\n    if image_g is None or image_b is None:\n        if not (image_g is None and image_b is None):\n            raise ValueError(\"please specify either a single image \"\n                             \"or red, green, and blue images.\")\n        return image_r\n\n    intensity = (image_r + image_g + image_b)/3.0\n\n    # Repack into whatever type was passed to us\n    return np.asarray(intensity, dtype=image_r.dtype)\n\n\nclass Mapping:\n    \"\"\"\n    Baseclass to map red, blue, green intensities into uint8 values.\n\n    Parameters\n    ----------\n    minimum : float or sequence(3)\n        Intensity that should be mapped to black (a scalar or array for R, G, B).\n    image : ndarray, optional\n        An image used to calculate some parameters of some mappings.\n    \"\"\"\n\n    def __init__(self, minimum=None, image=None):\n        self._uint8Max = float(np.iinfo(np.uint8).max)\n\n        try:\n            len(minimum)\n        except TypeError:\n            minimum = 3*[minimum]\n        if len(minimum) != 3:\n            raise ValueError(\"please provide 1 or 3 values for minimum.\")\n\n        self.minimum = minimum\n        self._image = np.asarray(image)\n\n    def make_rgb_image(self, image_r, image_g, image_b):\n        \"\"\"\n        Convert 3 arrays, image_r, image_g, and image_b into an 8-bit RGB image.\n\n        Parameters\n        ----------\n        image_r : ndarray\n            Image to map to red.\n        image_g : ndarray\n            Image to map to green.\n        image_b : ndarray\n            Image to map to blue.\n\n        Returns\n        -------\n        RGBimage : ndarray\n            RGB (integer, 8-bits per channel) color image as an NxNx3 numpy array.\n        \"\"\"\n        image_r = np.asarray(image_r)\n        image_g = np.asarray(image_g)\n        image_b = np.asarray(image_b)\n\n        if (image_r.shape != image_g.shape) or (image_g.shape != image_b.shape):\n            msg = \"The image shapes must match. r: {}, g: {} b: {}\"\n            raise ValueError(msg.format(image_r.shape, image_g.shape, image_b.shape))\n\n        return np.dstack(self._convert_images_to_uint8(image_r, image_g, image_b)).astype(np.uint8)\n\n    def intensity(self, image_r, image_g, image_b):\n        \"\"\"\n        Return the total intensity from the red, blue, and green intensities.\n        This is a naive computation, and may be overridden by subclasses.\n\n        Parameters\n        ----------\n        image_r : ndarray\n            Intensity of image to be mapped to red; or total intensity if\n            ``image_g`` and ``image_b`` are None.\n        image_g : ndarray, optional\n            Intensity of image to be mapped to green.\n        image_b : ndarray, optional\n            Intensity of image to be mapped to blue.\n\n        Returns\n        -------\n        intensity : ndarray\n            Total intensity from the red, blue and green intensities, or\n            ``image_r`` if green and blue images are not provided.\n        \"\"\"\n        return compute_intensity(image_r, image_g, image_b)\n\n    def map_intensity_to_uint8(self, I):\n        \"\"\"\n        Return an array which, when multiplied by an image, returns that image\n        mapped to the range of a uint8, [0, 255] (but not converted to uint8).\n\n        The intensity is assumed to have had minimum subtracted (as that can be\n        done per-band).\n\n        Parameters\n        ----------\n        I : ndarray\n            Intensity to be mapped.\n\n        Returns\n        -------\n        mapped_I : ndarray\n            ``I`` mapped to uint8\n        \"\"\"\n        with np.errstate(invalid='ignore', divide='ignore'):\n            return np.clip(I, 0, self._uint8Max)\n\n    def _convert_images_to_uint8(self, image_r, image_g, image_b):\n        \"\"\"Use the mapping to convert images image_r, image_g, and image_b to a triplet of uint8 images\"\"\"\n        image_r = image_r - self.minimum[0]  # n.b. makes copy\n        image_g = image_g - self.minimum[1]\n        image_b = image_b - self.minimum[2]\n\n        fac = self.map_intensity_to_uint8(self.intensity(image_r, image_g, image_b))\n\n        image_rgb = [image_r, image_g, image_b]\n        for c in image_rgb:\n            c *= fac\n            with np.errstate(invalid='ignore'):\n                c[c < 0] = 0                # individual bands can still be < 0, even if fac isn't\n\n        pixmax = self._uint8Max\n        r0, g0, b0 = image_rgb           # copies -- could work row by row to minimise memory usage\n\n        with np.errstate(invalid='ignore', divide='ignore'):  # n.b. np.where can't and doesn't short-circuit\n            for i, c in enumerate(image_rgb):\n                c = np.where(r0 > g0,\n                             np.where(r0 > b0,\n                                      np.where(r0 >= pixmax, c*pixmax/r0, c),\n                                      np.where(b0 >= pixmax, c*pixmax/b0, c)),\n                             np.where(g0 > b0,\n                                      np.where(g0 >= pixmax, c*pixmax/g0, c),\n                                      np.where(b0 >= pixmax, c*pixmax/b0, c))).astype(np.uint8)\n                c[c > pixmax] = pixmax\n\n                image_rgb[i] = c\n\n        return image_rgb\n\n\nclass LinearMapping(Mapping):\n    \"\"\"\n    A linear map map of red, blue, green intensities into uint8 values.\n\n    A linear stretch from [minimum, maximum].\n    If one or both are omitted use image min and/or max to set them.\n\n    Parameters\n    ----------\n    minimum : float\n        Intensity that should be mapped to black (a scalar or array for R, G, B).\n    maximum : float\n        Intensity that should be mapped to white (a scalar).\n    \"\"\"\n\n    def __init__(self, minimum=None, maximum=None, image=None):\n        if minimum is None or maximum is None:\n            if image is None:\n                raise ValueError(\"you must provide an image if you don't \"\n                                 \"set both minimum and maximum\")\n            if minimum is None:\n                minimum = image.min()\n            if maximum is None:\n                maximum = image.max()\n\n        Mapping.__init__(self, minimum=minimum, image=image)\n        self.maximum = maximum\n\n        if maximum is None:\n            self._range = None\n        else:\n            if maximum == minimum:\n                raise ValueError(\"minimum and maximum values must not be equal\")\n            self._range = float(maximum - minimum)\n\n    def map_intensity_to_uint8(self, I):\n        with np.errstate(invalid='ignore', divide='ignore'):  # n.b. np.where can't and doesn't short-circuit\n            return np.where(I <= 0, 0,\n                            np.where(I >= self._range, self._uint8Max/I, self._uint8Max/self._range))\n\n\nclass AsinhMapping(Mapping):\n    \"\"\"\n    A mapping for an asinh stretch (preserving colours independent of brightness)\n\n    x = asinh(Q (I - minimum)/stretch)/Q\n\n    This reduces to a linear stretch if Q == 0\n\n    See https://ui.adsabs.harvard.edu/abs/2004PASP..116..133L\n\n    Parameters\n    ----------\n\n    minimum : float\n        Intensity that should be mapped to black (a scalar or array for R, G, B).\n    stretch : float\n        The linear stretch of the image.\n    Q : float\n        The asinh softening parameter.\n    \"\"\"\n\n    def __init__(self, minimum, stretch, Q=8):\n        Mapping.__init__(self, minimum)\n\n        epsilon = 1.0/2**23            # 32bit floating point machine epsilon; sys.float_info.epsilon is 64bit\n        if abs(Q) < epsilon:\n            Q = 0.1\n        else:\n            Qmax = 1e10\n            if Q > Qmax:\n                Q = Qmax\n\n        frac = 0.1                  # gradient estimated using frac*stretch is _slope\n        self._slope = frac*self._uint8Max/np.arcsinh(frac*Q)\n\n        self._soften = Q/float(stretch)\n\n    def map_intensity_to_uint8(self, I):\n        with np.errstate(invalid='ignore', divide='ignore'):  # n.b. np.where can't and doesn't short-circuit\n            return np.where(I <= 0, 0, np.arcsinh(I*self._soften)*self._slope/I)\n\n\nclass AsinhZScaleMapping(AsinhMapping):\n    \"\"\"\n    A mapping for an asinh stretch, estimating the linear stretch by zscale.\n\n    x = asinh(Q (I - z1)/(z2 - z1))/Q\n\n    Parameters\n    ----------\n    image1 : ndarray or a list of arrays\n        The image to analyse, or a list of 3 images to be converted to\n        an intensity image.\n    image2 : ndarray, optional\n        the second image to analyse (must be specified with image3).\n    image3 : ndarray, optional\n        the third image to analyse (must be specified with image2).\n    Q : float, optional\n        The asinh softening parameter. Default is 8.\n    pedestal : float or sequence(3), optional\n        The value, or array of 3 values, to subtract from the images; or None.\n\n    Notes\n    -----\n    pedestal, if not None, is removed from the images when calculating the\n    zscale stretch, and added back into Mapping.minimum[]\n    \"\"\"\n\n    def __init__(self, image1, image2=None, image3=None, Q=8, pedestal=None):\n        \"\"\"\n        \"\"\"\n\n        if image2 is None or image3 is None:\n            if not (image2 is None and image3 is None):\n                raise ValueError(\"please specify either a single image \"\n                                 \"or three images.\")\n            image = [image1]\n        else:\n            image = [image1, image2, image3]\n\n        if pedestal is not None:\n            try:\n                len(pedestal)\n            except TypeError:\n                pedestal = 3*[pedestal]\n\n            if len(pedestal) != 3:\n                raise ValueError(\"please provide 1 or 3 pedestals.\")\n\n            image = list(image)        # needs to be mutable\n            for i, im in enumerate(image):\n                if pedestal[i] != 0.0:\n                    image[i] = im - pedestal[i]  # n.b. a copy\n        else:\n            pedestal = len(image)*[0.0]\n\n        image = compute_intensity(*image)\n\n        zscale_limits = ZScaleInterval().get_limits(image)\n        zscale = LinearMapping(*zscale_limits, image=image)\n        stretch = zscale.maximum - zscale.minimum[0]  # zscale.minimum is always a triple\n        minimum = zscale.minimum\n\n        for i, level in enumerate(pedestal):\n            minimum[i] += level\n\n        AsinhMapping.__init__(self, minimum, stretch, Q)\n        self._image = image\n\n\ndef make_lupton_rgb(image_r, image_g, image_b, minimum=0, stretch=5, Q=8,\n                    filename=None):\n    \"\"\"\n    Return a Red/Green/Blue color image from up to 3 images using an asinh stretch.\n    The input images can be int or float, and in any range or bit-depth.\n\n    For a more detailed look at the use of this method, see the document\n    :ref:`astropy:astropy-visualization-rgb`.\n\n    Parameters\n    ----------\n    image_r : ndarray\n        Image to map to red.\n    image_g : ndarray\n        Image to map to green.\n    image_b : ndarray\n        Image to map to blue.\n    minimum : float\n        Intensity that should be mapped to black (a scalar or array for R, G, B).\n    stretch : float\n        The linear stretch of the image.\n    Q : float\n        The asinh softening parameter.\n    filename : str\n        Write the resulting RGB image to a file (file type determined\n        from extension).\n\n    Returns\n    -------\n    rgb : ndarray\n        RGB (integer, 8-bits per channel) color image as an NxNx3 numpy array.\n    \"\"\"\n    asinhMap = AsinhMapping(minimum, stretch, Q)\n    rgb = asinhMap.make_rgb_image(image_r, image_g, image_b)\n\n    if filename:\n        import matplotlib.image\n        matplotlib.image.imsave(filename, rgb, origin='lower')\n\n    return rgb\n"},{"col":0,"comment":"null","endLoc":93,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, ICRS, BarycentricMeanEcliptic)\ndef icrs_to_baryecliptic(from_coo, to_frame)","id":15877,"name":"icrs_to_baryecliptic","nodeType":"Function","startLoc":91,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, ICRS, BarycentricMeanEcliptic)\ndef icrs_to_baryecliptic(from_coo, to_frame):\n    return _mean_ecliptic_rotation_matrix(to_frame.equinox)"},{"col":0,"comment":"Enhanced histogram function\n\n    This is a histogram function that enables the use of more sophisticated\n    algorithms for determining bins.  Aside from the ``bins`` argument allowing\n    a string specified how bins are computed, the parameters are the same\n    as pylab.hist().\n\n    This function was ported from astroML: https://www.astroml.org/\n\n    Parameters\n    ----------\n    x : array-like\n        array of data to be histogrammed\n\n    bins : int, list, or str, optional\n        If bins is a string, then it must be one of:\n\n        - 'blocks' : use bayesian blocks for dynamic bin widths\n\n        - 'knuth' : use Knuth's rule to determine bins\n\n        - 'scott' : use Scott's rule to determine bins\n\n        - 'freedman' : use the Freedman-Diaconis rule to determine bins\n\n    ax : `~matplotlib.axes.Axes` instance, optional\n        Specify the Axes on which to draw the histogram. If not specified,\n        then the current active axes will be used.\n\n    max_bins : int, optional\n        Maximum number of bins allowed. With more than a few thousand bins\n        the performance of matplotlib will not be great. If the number of\n        bins is large *and* the number of input data points is large then\n        the it will take a very long time to compute the histogram.\n\n    **kwargs :\n        other keyword arguments are described in ``plt.hist()``.\n\n    Notes\n    -----\n    Return values are the same as for ``plt.hist()``\n\n    See Also\n    --------\n    astropy.stats.histogram\n    ","endLoc":72,"header":"def hist(x, bins=10, ax=None, max_bins=1e5, **kwargs)","id":15878,"name":"hist","nodeType":"Function","startLoc":8,"text":"def hist(x, bins=10, ax=None, max_bins=1e5, **kwargs):\n    \"\"\"Enhanced histogram function\n\n    This is a histogram function that enables the use of more sophisticated\n    algorithms for determining bins.  Aside from the ``bins`` argument allowing\n    a string specified how bins are computed, the parameters are the same\n    as pylab.hist().\n\n    This function was ported from astroML: https://www.astroml.org/\n\n    Parameters\n    ----------\n    x : array-like\n        array of data to be histogrammed\n\n    bins : int, list, or str, optional\n        If bins is a string, then it must be one of:\n\n        - 'blocks' : use bayesian blocks for dynamic bin widths\n\n        - 'knuth' : use Knuth's rule to determine bins\n\n        - 'scott' : use Scott's rule to determine bins\n\n        - 'freedman' : use the Freedman-Diaconis rule to determine bins\n\n    ax : `~matplotlib.axes.Axes` instance, optional\n        Specify the Axes on which to draw the histogram. If not specified,\n        then the current active axes will be used.\n\n    max_bins : int, optional\n        Maximum number of bins allowed. With more than a few thousand bins\n        the performance of matplotlib will not be great. If the number of\n        bins is large *and* the number of input data points is large then\n        the it will take a very long time to compute the histogram.\n\n    **kwargs :\n        other keyword arguments are described in ``plt.hist()``.\n\n    Notes\n    -----\n    Return values are the same as for ``plt.hist()``\n\n    See Also\n    --------\n    astropy.stats.histogram\n    \"\"\"\n    # Note that we only calculate the bin edges...matplotlib will calculate\n    # the actual histogram.\n    range = kwargs.get('range', None)\n    weights = kwargs.get('weights', None)\n    bins = calculate_bin_edges(x, bins, range=range, weights=weights)\n\n    if len(bins) > max_bins:\n        raise ValueError('Histogram has too many bins: '\n                         '{nbin}. Use max_bins to increase the number '\n                         'of allowed bins or range to restrict '\n                         'the histogram range.'.format(nbin=len(bins)))\n\n    if ax is None:\n        # optional dependency; only import if strictly needed.\n        import matplotlib.pyplot as plt\n        ax = plt.gca()\n\n    return ax.hist(x, bins, **kwargs)"},{"col":0,"comment":"null","endLoc":98,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, BarycentricMeanEcliptic, ICRS)\ndef baryecliptic_to_icrs(from_coo, to_frame)","id":15879,"name":"baryecliptic_to_icrs","nodeType":"Function","startLoc":96,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, BarycentricMeanEcliptic, ICRS)\ndef baryecliptic_to_icrs(from_coo, to_frame):\n    return matrix_transpose(icrs_to_baryecliptic(to_frame, from_coo))"},{"col":0,"comment":"null","endLoc":120,"header":"@frame_transform_graph.transform(AffineTransform,\n                                 ICRS, HeliocentricMeanEcliptic)\ndef icrs_to_helioecliptic(from_coo, to_frame)","id":15880,"name":"icrs_to_helioecliptic","nodeType":"Function","startLoc":107,"text":"@frame_transform_graph.transform(AffineTransform,\n                                 ICRS, HeliocentricMeanEcliptic)\ndef icrs_to_helioecliptic(from_coo, to_frame):\n    if not u.m.is_equivalent(from_coo.cartesian.x.unit):\n        raise UnitsError(_NEED_ORIGIN_HINT.format(from_coo.__class__.__name__))\n\n    # get the offset of the barycenter from the Sun\n    ssb_from_sun = get_offset_sun_from_barycenter(to_frame.obstime, reverse=True,\n                                                  include_velocity=bool(from_coo.data.differentials))\n\n    # now compute the matrix to precess to the right orientation\n    rmat = _mean_ecliptic_rotation_matrix(to_frame.equinox)\n\n    return rmat, ssb_from_sun.transform(rmat)"},{"col":4,"comment":"\n        The number of samples of this distribution.  A single `int`.\n        ","endLoc":126,"header":"@property\n    def n_samples(self)","id":15881,"name":"n_samples","nodeType":"Function","startLoc":121,"text":"@property\n    def n_samples(self):\n        \"\"\"\n        The number of samples of this distribution.  A single `int`.\n        \"\"\"\n        return self.dtype['samples'].shape[0]"},{"col":4,"comment":"\n        The mean of this distribution.\n\n        Arguments are as for `numpy.mean`.\n        ","endLoc":134,"header":"def pdf_mean(self, dtype=None, out=None)","id":15882,"name":"pdf_mean","nodeType":"Function","startLoc":128,"text":"def pdf_mean(self, dtype=None, out=None):\n        \"\"\"\n        The mean of this distribution.\n\n        Arguments are as for `numpy.mean`.\n        \"\"\"\n        return self.distribution.mean(axis=-1, dtype=dtype, out=out)"},{"className":"ZScaleInterval","col":0,"comment":"\n    Interval based on IRAF's zscale.\n\n    https://iraf.net/forum/viewtopic.php?showtopic=134139\n\n    Original implementation:\n    https://github.com/spacetelescope/stsci.numdisplay/blob/master/lib/stsci/numdisplay/zscale.py\n\n    Licensed under a 3-clause BSD style license (see AURA_LICENSE.rst).\n\n    Parameters\n    ----------\n    nsamples : int, optional\n        The number of points in the array to sample for determining\n        scaling factors.  Defaults to 1000.\n    contrast : float, optional\n        The scaling factor (between 0 and 1) for determining the minimum\n        and maximum value.  Larger values increase the difference\n        between the minimum and maximum values used for display.\n        Defaults to 0.25.\n    max_reject : float, optional\n        If more than ``max_reject * npixels`` pixels are rejected, then\n        the returned values are the minimum and maximum of the data.\n        Defaults to 0.5.\n    min_npixels : int, optional\n        If there are less than ``min_npixels`` pixels remaining after\n        the pixel rejection, then the returned values are the minimum\n        and maximum of the data.  Defaults to 5.\n    krej : float, optional\n        The number of sigma used for the rejection. Defaults to 2.5.\n    max_iterations : int, optional\n        The maximum number of iterations for the rejection. Defaults to\n        5.\n    ","endLoc":296,"id":15883,"nodeType":"Class","startLoc":193,"text":"class ZScaleInterval(BaseInterval):\n    \"\"\"\n    Interval based on IRAF's zscale.\n\n    https://iraf.net/forum/viewtopic.php?showtopic=134139\n\n    Original implementation:\n    https://github.com/spacetelescope/stsci.numdisplay/blob/master/lib/stsci/numdisplay/zscale.py\n\n    Licensed under a 3-clause BSD style license (see AURA_LICENSE.rst).\n\n    Parameters\n    ----------\n    nsamples : int, optional\n        The number of points in the array to sample for determining\n        scaling factors.  Defaults to 1000.\n    contrast : float, optional\n        The scaling factor (between 0 and 1) for determining the minimum\n        and maximum value.  Larger values increase the difference\n        between the minimum and maximum values used for display.\n        Defaults to 0.25.\n    max_reject : float, optional\n        If more than ``max_reject * npixels`` pixels are rejected, then\n        the returned values are the minimum and maximum of the data.\n        Defaults to 0.5.\n    min_npixels : int, optional\n        If there are less than ``min_npixels`` pixels remaining after\n        the pixel rejection, then the returned values are the minimum\n        and maximum of the data.  Defaults to 5.\n    krej : float, optional\n        The number of sigma used for the rejection. Defaults to 2.5.\n    max_iterations : int, optional\n        The maximum number of iterations for the rejection. Defaults to\n        5.\n    \"\"\"\n\n    def __init__(self, nsamples=1000, contrast=0.25, max_reject=0.5,\n                 min_npixels=5, krej=2.5, max_iterations=5):\n        self.nsamples = nsamples\n        self.contrast = contrast\n        self.max_reject = max_reject\n        self.min_npixels = min_npixels\n        self.krej = krej\n        self.max_iterations = max_iterations\n\n    def get_limits(self, values):\n        # Sample the image\n        values = np.asarray(values)\n        values = values[np.isfinite(values)]\n        stride = int(max(1.0, values.size / self.nsamples))\n        samples = values[::stride][:self.nsamples]\n        samples.sort()\n\n        npix = len(samples)\n        vmin = samples[0]\n        vmax = samples[-1]\n\n        # Fit a line to the sorted array of samples\n        minpix = max(self.min_npixels, int(npix * self.max_reject))\n        x = np.arange(npix)\n        ngoodpix = npix\n        last_ngoodpix = npix + 1\n\n        # Bad pixels mask used in k-sigma clipping\n        badpix = np.zeros(npix, dtype=bool)\n\n        # Kernel used to dilate the bad pixels mask\n        ngrow = max(1, int(npix * 0.01))\n        kernel = np.ones(ngrow, dtype=bool)\n\n        for _ in range(self.max_iterations):\n            if ngoodpix >= last_ngoodpix or ngoodpix < minpix:\n                break\n\n            fit = np.polyfit(x, samples, deg=1, w=(~badpix).astype(int))\n            fitted = np.poly1d(fit)(x)\n\n            # Subtract fitted line from the data array\n            flat = samples - fitted\n\n            # Compute the k-sigma rejection threshold\n            threshold = self.krej * flat[~badpix].std()\n\n            # Detect and reject pixels further than k*sigma from the\n            # fitted line\n            badpix[(flat < - threshold) | (flat > threshold)] = True\n\n            # Convolve with a kernel of length ngrow\n            badpix = np.convolve(badpix, kernel, mode='same')\n\n            last_ngoodpix = ngoodpix\n            ngoodpix = np.sum(~badpix)\n\n        if ngoodpix >= minpix:\n            slope, _ = fit\n\n            if self.contrast > 0:\n                slope = slope / self.contrast\n            center_pixel = (npix - 1) // 2\n            median = np.median(samples)\n            vmin = max(vmin, median - (center_pixel - 1) * slope)\n            vmax = min(vmax, median + (npix - center_pixel) * slope)\n\n        return vmin, vmax"},{"col":4,"comment":"\n        The standard deviation of this distribution.\n\n        Arguments are as for `numpy.std`.\n        ","endLoc":142,"header":"def pdf_std(self, dtype=None, out=None, ddof=0)","id":15884,"name":"pdf_std","nodeType":"Function","startLoc":136,"text":"def pdf_std(self, dtype=None, out=None, ddof=0):\n        \"\"\"\n        The standard deviation of this distribution.\n\n        Arguments are as for `numpy.std`.\n        \"\"\"\n        return self.distribution.std(axis=-1, dtype=dtype, out=out, ddof=ddof)"},{"col":4,"comment":"\n        The variance of this distribution.\n\n        Arguments are as for `numpy.var`.\n        ","endLoc":150,"header":"def pdf_var(self, dtype=None, out=None, ddof=0)","id":15885,"name":"pdf_var","nodeType":"Function","startLoc":144,"text":"def pdf_var(self, dtype=None, out=None, ddof=0):\n        \"\"\"\n        The variance of this distribution.\n\n        Arguments are as for `numpy.var`.\n        \"\"\"\n        return self.distribution.var(axis=-1, dtype=dtype, out=out, ddof=ddof)"},{"col":4,"comment":"null","endLoc":34,"header":"def __init__(self, transform_1, transform_2)","id":15886,"name":"__init__","nodeType":"Function","startLoc":31,"text":"def __init__(self, transform_1, transform_2):\n        super().__init__()\n        self.transform_1 = transform_1\n        self.transform_2 = transform_2"},{"col":4,"comment":"\n        The median of this distribution.\n\n        Parameters\n        ----------\n        out : array, optional\n            Alternative output array in which to place the result. It must\n            have the same shape and buffer length as the expected output,\n            but the type (of the output) will be cast if necessary.\n        ","endLoc":163,"header":"def pdf_median(self, out=None)","id":15887,"name":"pdf_median","nodeType":"Function","startLoc":152,"text":"def pdf_median(self, out=None):\n        \"\"\"\n        The median of this distribution.\n\n        Parameters\n        ----------\n        out : array, optional\n            Alternative output array in which to place the result. It must\n            have the same shape and buffer length as the expected output,\n            but the type (of the output) will be cast if necessary.\n        \"\"\"\n        return np.median(self.distribution, axis=-1, out=out)"},{"col":4,"comment":"\n        The median absolute deviation of this distribution.\n\n        Parameters\n        ----------\n        out : array, optional\n            Alternative output array in which to place the result. It must\n            have the same shape and buffer length as the expected output,\n            but the type (of the output) will be cast if necessary.\n        ","endLoc":179,"header":"def pdf_mad(self, out=None)","id":15888,"name":"pdf_mad","nodeType":"Function","startLoc":165,"text":"def pdf_mad(self, out=None):\n        \"\"\"\n        The median absolute deviation of this distribution.\n\n        Parameters\n        ----------\n        out : array, optional\n            Alternative output array in which to place the result. It must\n            have the same shape and buffer length as the expected output,\n            but the type (of the output) will be cast if necessary.\n        \"\"\"\n        median = self.pdf_median(out=out)\n        absdiff = np.abs(self - median)\n        return np.median(absdiff.distribution, axis=-1, out=median,\n                         overwrite_input=True)"},{"className":"CompositeTransform","col":0,"comment":"\n    A combination of two transforms.\n\n    Parameters\n    ----------\n    transform_1 : :class:`astropy.visualization.BaseTransform`\n        The first transform to apply.\n    transform_2 : :class:`astropy.visualization.BaseTransform`\n        The second transform to apply.\n    ","endLoc":42,"id":15889,"nodeType":"Class","startLoc":19,"text":"class CompositeTransform(BaseTransform):\n    \"\"\"\n    A combination of two transforms.\n\n    Parameters\n    ----------\n    transform_1 : :class:`astropy.visualization.BaseTransform`\n        The first transform to apply.\n    transform_2 : :class:`astropy.visualization.BaseTransform`\n        The second transform to apply.\n    \"\"\"\n\n    def __init__(self, transform_1, transform_2):\n        super().__init__()\n        self.transform_1 = transform_1\n        self.transform_2 = transform_2\n\n    def __call__(self, values, clip=True):\n        return self.transform_2(self.transform_1(values, clip=clip), clip=clip)\n\n    @property\n    def inverse(self):\n        return self.__class__(self.transform_2.inverse,\n                              self.transform_1.inverse)"},{"col":4,"comment":"null","endLoc":37,"header":"def __call__(self, values, clip=True)","id":15890,"name":"__call__","nodeType":"Function","startLoc":36,"text":"def __call__(self, values, clip=True):\n        return self.transform_2(self.transform_1(values, clip=clip), clip=clip)"},{"col":4,"comment":"\n        The median absolute deviation of this distribution rescaled to match the\n        standard deviation for a normal distribution.\n\n        Parameters\n        ----------\n        out : array, optional\n            Alternative output array in which to place the result. It must\n            have the same shape and buffer length as the expected output,\n            but the type (of the output) will be cast if necessary.\n        ","endLoc":195,"header":"def pdf_smad(self, out=None)","id":15891,"name":"pdf_smad","nodeType":"Function","startLoc":181,"text":"def pdf_smad(self, out=None):\n        \"\"\"\n        The median absolute deviation of this distribution rescaled to match the\n        standard deviation for a normal distribution.\n\n        Parameters\n        ----------\n        out : array, optional\n            Alternative output array in which to place the result. It must\n            have the same shape and buffer length as the expected output,\n            but the type (of the output) will be cast if necessary.\n        \"\"\"\n        result = self.pdf_mad(out=out)\n        result *= SMAD_SCALE_FACTOR\n        return result"},{"col":0,"comment":"null","endLoc":136,"header":"@frame_transform_graph.transform(AffineTransform,\n                                 HeliocentricMeanEcliptic, ICRS)\ndef helioecliptic_to_icrs(from_coo, to_frame)","id":15892,"name":"helioecliptic_to_icrs","nodeType":"Function","startLoc":123,"text":"@frame_transform_graph.transform(AffineTransform,\n                                 HeliocentricMeanEcliptic, ICRS)\ndef helioecliptic_to_icrs(from_coo, to_frame):\n    if not u.m.is_equivalent(from_coo.cartesian.x.unit):\n        raise UnitsError(_NEED_ORIGIN_HINT.format(from_coo.__class__.__name__))\n\n    # first un-precess from ecliptic to ICRS orientation\n    rmat = _mean_ecliptic_rotation_matrix(from_coo.equinox)\n\n    # now offset back to barycentric, which is the correct center for ICRS\n    sun_from_ssb = get_offset_sun_from_barycenter(from_coo.obstime,\n                                                  include_velocity=bool(from_coo.data.differentials))\n\n    return matrix_transpose(rmat), sun_from_ssb"},{"col":4,"comment":"null","endLoc":42,"header":"@property\n    def inverse(self)","id":15893,"name":"inverse","nodeType":"Function","startLoc":39,"text":"@property\n    def inverse(self):\n        return self.__class__(self.transform_2.inverse,\n                              self.transform_1.inverse)"},{"attributeType":"BaseTransform","col":8,"comment":"null","endLoc":34,"id":15894,"name":"transform_2","nodeType":"Attribute","startLoc":34,"text":"self.transform_2"},{"attributeType":"BaseTransform","col":8,"comment":"null","endLoc":33,"id":15895,"name":"transform_1","nodeType":"Attribute","startLoc":33,"text":"self.transform_1"},{"attributeType":"null","col":0,"comment":"null","endLoc":4,"id":15896,"name":"__all__","nodeType":"Attribute","startLoc":4,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"transform.py#<anonymous>","id":15897,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['BaseTransform', 'CompositeTransform']"},{"col":4,"comment":"\n        Compute percentiles of this Distribution.\n\n        Parameters\n        ----------\n        percentile : float or array of float or `~astropy.units.Quantity`\n            The desired percentiles of the distribution (i.e., on [0,100]).\n            `~astropy.units.Quantity` will be converted to percent, meaning\n            that a ``dimensionless_unscaled`` `~astropy.units.Quantity` will\n            be interpreted as a quantile.\n\n        Additional keywords are passed into `numpy.percentile`.\n\n        Returns\n        -------\n        percentiles : `~astropy.units.Quantity` ['dimensionless']\n            The ``fracs`` percentiles of this distribution.\n        ","endLoc":223,"header":"def pdf_percentiles(self, percentile, **kwargs)","id":15898,"name":"pdf_percentiles","nodeType":"Function","startLoc":197,"text":"def pdf_percentiles(self, percentile, **kwargs):\n        \"\"\"\n        Compute percentiles of this Distribution.\n\n        Parameters\n        ----------\n        percentile : float or array of float or `~astropy.units.Quantity`\n            The desired percentiles of the distribution (i.e., on [0,100]).\n            `~astropy.units.Quantity` will be converted to percent, meaning\n            that a ``dimensionless_unscaled`` `~astropy.units.Quantity` will\n            be interpreted as a quantile.\n\n        Additional keywords are passed into `numpy.percentile`.\n\n        Returns\n        -------\n        percentiles : `~astropy.units.Quantity` ['dimensionless']\n            The ``fracs`` percentiles of this distribution.\n        \"\"\"\n        percentile = u.Quantity(percentile, u.percent).value\n        percs = np.percentile(self.distribution, percentile, axis=-1, **kwargs)\n        # numpy.percentile strips units for unclear reasons, so we have to make\n        # a new object with units\n        if hasattr(self.distribution, '_new_view'):\n            return self.distribution._new_view(percs)\n        else:\n            return percs"},{"className":"BaseInterval","col":0,"comment":"\n    Base class for the interval classes, which, when called with an\n    array of values, return an interval computed following different\n    algorithms.\n    ","endLoc":82,"id":15899,"nodeType":"Class","startLoc":19,"text":"class BaseInterval(BaseTransform):\n    \"\"\"\n    Base class for the interval classes, which, when called with an\n    array of values, return an interval computed following different\n    algorithms.\n    \"\"\"\n\n    @abc.abstractmethod\n    def get_limits(self, values):\n        \"\"\"\n        Return the minimum and maximum value in the interval based on\n        the values provided.\n\n        Parameters\n        ----------\n        values : ndarray\n            The image values.\n\n        Returns\n        -------\n        vmin, vmax : float\n            The mininium and maximum image value in the interval.\n        \"\"\"\n\n        raise NotImplementedError('Needs to be implemented in a subclass.')\n\n    def __call__(self, values, clip=True, out=None):\n        \"\"\"\n        Transform values using this interval.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        \"\"\"\n\n        vmin, vmax = self.get_limits(values)\n\n        if out is None:\n            values = np.subtract(values, float(vmin))\n        else:\n            if out.dtype.kind != 'f':\n                raise TypeError('Can only do in-place scaling for '\n                                'floating-point arrays')\n            values = np.subtract(values, float(vmin), out=out)\n\n        if (vmax - vmin) != 0:\n            np.true_divide(values, vmax - vmin, out=values)\n\n        if clip:\n            np.clip(values, 0., 1., out=values)\n\n        return values"},{"fileName":"interval.py","filePath":"astropy/visualization","id":15900,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nClasses that deal with computing intervals from arrays of values based on\nvarious criteria.\n\"\"\"\n\nimport abc\nimport numpy as np\n\nfrom .transform import BaseTransform\n\n\n__all__ = ['BaseInterval', 'ManualInterval', 'MinMaxInterval',\n           'AsymmetricPercentileInterval', 'PercentileInterval',\n           'ZScaleInterval']\n\n\nclass BaseInterval(BaseTransform):\n    \"\"\"\n    Base class for the interval classes, which, when called with an\n    array of values, return an interval computed following different\n    algorithms.\n    \"\"\"\n\n    @abc.abstractmethod\n    def get_limits(self, values):\n        \"\"\"\n        Return the minimum and maximum value in the interval based on\n        the values provided.\n\n        Parameters\n        ----------\n        values : ndarray\n            The image values.\n\n        Returns\n        -------\n        vmin, vmax : float\n            The mininium and maximum image value in the interval.\n        \"\"\"\n\n        raise NotImplementedError('Needs to be implemented in a subclass.')\n\n    def __call__(self, values, clip=True, out=None):\n        \"\"\"\n        Transform values using this interval.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        \"\"\"\n\n        vmin, vmax = self.get_limits(values)\n\n        if out is None:\n            values = np.subtract(values, float(vmin))\n        else:\n            if out.dtype.kind != 'f':\n                raise TypeError('Can only do in-place scaling for '\n                                'floating-point arrays')\n            values = np.subtract(values, float(vmin), out=out)\n\n        if (vmax - vmin) != 0:\n            np.true_divide(values, vmax - vmin, out=values)\n\n        if clip:\n            np.clip(values, 0., 1., out=values)\n\n        return values\n\n\nclass ManualInterval(BaseInterval):\n    \"\"\"\n    Interval based on user-specified values.\n\n    Parameters\n    ----------\n    vmin : float, optional\n        The minimum value in the scaling.  Defaults to the image\n        minimum (ignoring NaNs)\n    vmax : float, optional\n        The maximum value in the scaling.  Defaults to the image\n        maximum (ignoring NaNs)\n    \"\"\"\n\n    def __init__(self, vmin=None, vmax=None):\n        self.vmin = vmin\n        self.vmax = vmax\n\n    def get_limits(self, values):\n        # Make sure values is a Numpy array\n        values = np.asarray(values).ravel()\n\n        # Filter out invalid values (inf, nan)\n        values = values[np.isfinite(values)]\n\n        vmin = np.min(values) if self.vmin is None else self.vmin\n        vmax = np.max(values) if self.vmax is None else self.vmax\n        return vmin, vmax\n\n\nclass MinMaxInterval(BaseInterval):\n    \"\"\"\n    Interval based on the minimum and maximum values in the data.\n    \"\"\"\n\n    def get_limits(self, values):\n        # Make sure values is a Numpy array\n        values = np.asarray(values).ravel()\n\n        # Filter out invalid values (inf, nan)\n        values = values[np.isfinite(values)]\n\n        return np.min(values), np.max(values)\n\n\nclass AsymmetricPercentileInterval(BaseInterval):\n    \"\"\"\n    Interval based on a keeping a specified fraction of pixels (can be\n    asymmetric).\n\n    Parameters\n    ----------\n    lower_percentile : float\n        The lower percentile below which to ignore pixels.\n    upper_percentile : float\n        The upper percentile above which to ignore pixels.\n    n_samples : int, optional\n        Maximum number of values to use. If this is specified, and there\n        are more values in the dataset as this, then values are randomly\n        sampled from the array (with replacement).\n    \"\"\"\n\n    def __init__(self, lower_percentile, upper_percentile, n_samples=None):\n        self.lower_percentile = lower_percentile\n        self.upper_percentile = upper_percentile\n        self.n_samples = n_samples\n\n    def get_limits(self, values):\n        # Make sure values is a Numpy array\n        values = np.asarray(values).ravel()\n\n        # If needed, limit the number of samples. We sample with replacement\n        # since this is much faster.\n        if self.n_samples is not None and values.size > self.n_samples:\n            values = np.random.choice(values, self.n_samples)\n\n        # Filter out invalid values (inf, nan)\n        values = values[np.isfinite(values)]\n\n        # Determine values at percentiles\n        vmin, vmax = np.percentile(values, (self.lower_percentile,\n                                            self.upper_percentile))\n\n        return vmin, vmax\n\n\nclass PercentileInterval(AsymmetricPercentileInterval):\n    \"\"\"\n    Interval based on a keeping a specified fraction of pixels.\n\n    Parameters\n    ----------\n    percentile : float\n        The fraction of pixels to keep. The same fraction of pixels is\n        eliminated from both ends.\n    n_samples : int, optional\n        Maximum number of values to use. If this is specified, and there\n        are more values in the dataset as this, then values are randomly\n        sampled from the array (with replacement).\n    \"\"\"\n\n    def __init__(self, percentile, n_samples=None):\n        lower_percentile = (100 - percentile) * 0.5\n        upper_percentile = 100 - lower_percentile\n        super().__init__(\n            lower_percentile, upper_percentile, n_samples=n_samples)\n\n\nclass ZScaleInterval(BaseInterval):\n    \"\"\"\n    Interval based on IRAF's zscale.\n\n    https://iraf.net/forum/viewtopic.php?showtopic=134139\n\n    Original implementation:\n    https://github.com/spacetelescope/stsci.numdisplay/blob/master/lib/stsci/numdisplay/zscale.py\n\n    Licensed under a 3-clause BSD style license (see AURA_LICENSE.rst).\n\n    Parameters\n    ----------\n    nsamples : int, optional\n        The number of points in the array to sample for determining\n        scaling factors.  Defaults to 1000.\n    contrast : float, optional\n        The scaling factor (between 0 and 1) for determining the minimum\n        and maximum value.  Larger values increase the difference\n        between the minimum and maximum values used for display.\n        Defaults to 0.25.\n    max_reject : float, optional\n        If more than ``max_reject * npixels`` pixels are rejected, then\n        the returned values are the minimum and maximum of the data.\n        Defaults to 0.5.\n    min_npixels : int, optional\n        If there are less than ``min_npixels`` pixels remaining after\n        the pixel rejection, then the returned values are the minimum\n        and maximum of the data.  Defaults to 5.\n    krej : float, optional\n        The number of sigma used for the rejection. Defaults to 2.5.\n    max_iterations : int, optional\n        The maximum number of iterations for the rejection. Defaults to\n        5.\n    \"\"\"\n\n    def __init__(self, nsamples=1000, contrast=0.25, max_reject=0.5,\n                 min_npixels=5, krej=2.5, max_iterations=5):\n        self.nsamples = nsamples\n        self.contrast = contrast\n        self.max_reject = max_reject\n        self.min_npixels = min_npixels\n        self.krej = krej\n        self.max_iterations = max_iterations\n\n    def get_limits(self, values):\n        # Sample the image\n        values = np.asarray(values)\n        values = values[np.isfinite(values)]\n        stride = int(max(1.0, values.size / self.nsamples))\n        samples = values[::stride][:self.nsamples]\n        samples.sort()\n\n        npix = len(samples)\n        vmin = samples[0]\n        vmax = samples[-1]\n\n        # Fit a line to the sorted array of samples\n        minpix = max(self.min_npixels, int(npix * self.max_reject))\n        x = np.arange(npix)\n        ngoodpix = npix\n        last_ngoodpix = npix + 1\n\n        # Bad pixels mask used in k-sigma clipping\n        badpix = np.zeros(npix, dtype=bool)\n\n        # Kernel used to dilate the bad pixels mask\n        ngrow = max(1, int(npix * 0.01))\n        kernel = np.ones(ngrow, dtype=bool)\n\n        for _ in range(self.max_iterations):\n            if ngoodpix >= last_ngoodpix or ngoodpix < minpix:\n                break\n\n            fit = np.polyfit(x, samples, deg=1, w=(~badpix).astype(int))\n            fitted = np.poly1d(fit)(x)\n\n            # Subtract fitted line from the data array\n            flat = samples - fitted\n\n            # Compute the k-sigma rejection threshold\n            threshold = self.krej * flat[~badpix].std()\n\n            # Detect and reject pixels further than k*sigma from the\n            # fitted line\n            badpix[(flat < - threshold) | (flat > threshold)] = True\n\n            # Convolve with a kernel of length ngrow\n            badpix = np.convolve(badpix, kernel, mode='same')\n\n            last_ngoodpix = ngoodpix\n            ngoodpix = np.sum(~badpix)\n\n        if ngoodpix >= minpix:\n            slope, _ = fit\n\n            if self.contrast > 0:\n                slope = slope / self.contrast\n            center_pixel = (npix - 1) // 2\n            median = np.median(samples)\n            vmin = max(vmin, median - (center_pixel - 1) * slope)\n            vmax = min(vmax, median + (npix - center_pixel) * slope)\n\n        return vmin, vmax\n"},{"col":4,"comment":"\n        Return the minimum and maximum value in the interval based on\n        the values provided.\n\n        Parameters\n        ----------\n        values : ndarray\n            The image values.\n\n        Returns\n        -------\n        vmin, vmax : float\n            The mininium and maximum image value in the interval.\n        ","endLoc":43,"header":"@abc.abstractmethod\n    def get_limits(self, values)","id":15901,"name":"get_limits","nodeType":"Function","startLoc":26,"text":"@abc.abstractmethod\n    def get_limits(self, values):\n        \"\"\"\n        Return the minimum and maximum value in the interval based on\n        the values provided.\n\n        Parameters\n        ----------\n        values : ndarray\n            The image values.\n\n        Returns\n        -------\n        vmin, vmax : float\n            The mininium and maximum image value in the interval.\n        \"\"\"\n\n        raise NotImplementedError('Needs to be implemented in a subclass.')"},{"className":"ManualInterval","col":0,"comment":"\n    Interval based on user-specified values.\n\n    Parameters\n    ----------\n    vmin : float, optional\n        The minimum value in the scaling.  Defaults to the image\n        minimum (ignoring NaNs)\n    vmax : float, optional\n        The maximum value in the scaling.  Defaults to the image\n        maximum (ignoring NaNs)\n    ","endLoc":112,"id":15902,"nodeType":"Class","startLoc":85,"text":"class ManualInterval(BaseInterval):\n    \"\"\"\n    Interval based on user-specified values.\n\n    Parameters\n    ----------\n    vmin : float, optional\n        The minimum value in the scaling.  Defaults to the image\n        minimum (ignoring NaNs)\n    vmax : float, optional\n        The maximum value in the scaling.  Defaults to the image\n        maximum (ignoring NaNs)\n    \"\"\"\n\n    def __init__(self, vmin=None, vmax=None):\n        self.vmin = vmin\n        self.vmax = vmax\n\n    def get_limits(self, values):\n        # Make sure values is a Numpy array\n        values = np.asarray(values).ravel()\n\n        # Filter out invalid values (inf, nan)\n        values = values[np.isfinite(values)]\n\n        vmin = np.min(values) if self.vmin is None else self.vmin\n        vmax = np.max(values) if self.vmax is None else self.vmax\n        return vmin, vmax"},{"col":4,"comment":"null","endLoc":101,"header":"def __init__(self, vmin=None, vmax=None)","id":15903,"name":"__init__","nodeType":"Function","startLoc":99,"text":"def __init__(self, vmin=None, vmax=None):\n        self.vmin = vmin\n        self.vmax = vmax"},{"col":4,"comment":"null","endLoc":112,"header":"def get_limits(self, values)","id":15904,"name":"get_limits","nodeType":"Function","startLoc":103,"text":"def get_limits(self, values):\n        # Make sure values is a Numpy array\n        values = np.asarray(values).ravel()\n\n        # Filter out invalid values (inf, nan)\n        values = values[np.isfinite(values)]\n\n        vmin = np.min(values) if self.vmin is None else self.vmin\n        vmax = np.max(values) if self.vmax is None else self.vmax\n        return vmin, vmax"},{"col":4,"comment":"\n        Transform values using this interval.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        ","endLoc":82,"header":"def __call__(self, values, clip=True, out=None)","id":15905,"name":"__call__","nodeType":"Function","startLoc":45,"text":"def __call__(self, values, clip=True, out=None):\n        \"\"\"\n        Transform values using this interval.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        \"\"\"\n\n        vmin, vmax = self.get_limits(values)\n\n        if out is None:\n            values = np.subtract(values, float(vmin))\n        else:\n            if out.dtype.kind != 'f':\n                raise TypeError('Can only do in-place scaling for '\n                                'floating-point arrays')\n            values = np.subtract(values, float(vmin), out=out)\n\n        if (vmax - vmin) != 0:\n            np.true_divide(values, vmax - vmin, out=values)\n\n        if clip:\n            np.clip(values, 0., 1., out=values)\n\n        return values"},{"col":0,"comment":"null","endLoc":151,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 GCRS, GeocentricTrueEcliptic,\n                                 finite_difference_frameattr_name='equinox')\ndef gcrs_to_true_geoecliptic(gcrs_coo, to_frame)","id":15906,"name":"gcrs_to_true_geoecliptic","nodeType":"Function","startLoc":142,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 GCRS, GeocentricTrueEcliptic,\n                                 finite_difference_frameattr_name='equinox')\ndef gcrs_to_true_geoecliptic(gcrs_coo, to_frame):\n    # first get us to a 0 pos/vel GCRS at the target equinox\n    gcrs_coo2 = gcrs_coo.transform_to(GCRS(obstime=to_frame.obstime))\n\n    rmat = _true_ecliptic_rotation_matrix(to_frame.equinox)\n    newrepr = gcrs_coo2.cartesian.transform(rmat)\n    return to_frame.realize_frame(newrepr)"},{"attributeType":"null","col":8,"comment":"null","endLoc":101,"id":15907,"name":"vmax","nodeType":"Attribute","startLoc":101,"text":"self.vmax"},{"col":4,"comment":"null","endLoc":236,"header":"def __init__(self, nsamples=1000, contrast=0.25, max_reject=0.5,\n                 min_npixels=5, krej=2.5, max_iterations=5)","id":15908,"name":"__init__","nodeType":"Function","startLoc":229,"text":"def __init__(self, nsamples=1000, contrast=0.25, max_reject=0.5,\n                 min_npixels=5, krej=2.5, max_iterations=5):\n        self.nsamples = nsamples\n        self.contrast = contrast\n        self.max_reject = max_reject\n        self.min_npixels = min_npixels\n        self.krej = krej\n        self.max_iterations = max_iterations"},{"col":4,"comment":"null","endLoc":296,"header":"def get_limits(self, values)","id":15909,"name":"get_limits","nodeType":"Function","startLoc":238,"text":"def get_limits(self, values):\n        # Sample the image\n        values = np.asarray(values)\n        values = values[np.isfinite(values)]\n        stride = int(max(1.0, values.size / self.nsamples))\n        samples = values[::stride][:self.nsamples]\n        samples.sort()\n\n        npix = len(samples)\n        vmin = samples[0]\n        vmax = samples[-1]\n\n        # Fit a line to the sorted array of samples\n        minpix = max(self.min_npixels, int(npix * self.max_reject))\n        x = np.arange(npix)\n        ngoodpix = npix\n        last_ngoodpix = npix + 1\n\n        # Bad pixels mask used in k-sigma clipping\n        badpix = np.zeros(npix, dtype=bool)\n\n        # Kernel used to dilate the bad pixels mask\n        ngrow = max(1, int(npix * 0.01))\n        kernel = np.ones(ngrow, dtype=bool)\n\n        for _ in range(self.max_iterations):\n            if ngoodpix >= last_ngoodpix or ngoodpix < minpix:\n                break\n\n            fit = np.polyfit(x, samples, deg=1, w=(~badpix).astype(int))\n            fitted = np.poly1d(fit)(x)\n\n            # Subtract fitted line from the data array\n            flat = samples - fitted\n\n            # Compute the k-sigma rejection threshold\n            threshold = self.krej * flat[~badpix].std()\n\n            # Detect and reject pixels further than k*sigma from the\n            # fitted line\n            badpix[(flat < - threshold) | (flat > threshold)] = True\n\n            # Convolve with a kernel of length ngrow\n            badpix = np.convolve(badpix, kernel, mode='same')\n\n            last_ngoodpix = ngoodpix\n            ngoodpix = np.sum(~badpix)\n\n        if ngoodpix >= minpix:\n            slope, _ = fit\n\n            if self.contrast > 0:\n                slope = slope / self.contrast\n            center_pixel = (npix - 1) // 2\n            median = np.median(samples)\n            vmin = max(vmin, median - (center_pixel - 1) * slope)\n            vmax = min(vmax, median + (npix - center_pixel) * slope)\n\n        return vmin, vmax"},{"attributeType":"null","col":8,"comment":"null","endLoc":100,"id":15910,"name":"vmin","nodeType":"Attribute","startLoc":100,"text":"self.vmin"},{"className":"MinMaxInterval","col":0,"comment":"\n    Interval based on the minimum and maximum values in the data.\n    ","endLoc":127,"id":15911,"nodeType":"Class","startLoc":115,"text":"class MinMaxInterval(BaseInterval):\n    \"\"\"\n    Interval based on the minimum and maximum values in the data.\n    \"\"\"\n\n    def get_limits(self, values):\n        # Make sure values is a Numpy array\n        values = np.asarray(values).ravel()\n\n        # Filter out invalid values (inf, nan)\n        values = values[np.isfinite(values)]\n\n        return np.min(values), np.max(values)"},{"col":4,"comment":"null","endLoc":127,"header":"def get_limits(self, values)","id":15912,"name":"get_limits","nodeType":"Function","startLoc":120,"text":"def get_limits(self, values):\n        # Make sure values is a Numpy array\n        values = np.asarray(values).ravel()\n\n        # Filter out invalid values (inf, nan)\n        values = values[np.isfinite(values)]\n\n        return np.min(values), np.max(values)"},{"col":0,"comment":"null","endLoc":161,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GeocentricTrueEcliptic, GCRS)\ndef true_geoecliptic_to_gcrs(from_coo, gcrs_frame)","id":15913,"name":"true_geoecliptic_to_gcrs","nodeType":"Function","startLoc":154,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GeocentricTrueEcliptic, GCRS)\ndef true_geoecliptic_to_gcrs(from_coo, gcrs_frame):\n    rmat = _true_ecliptic_rotation_matrix(from_coo.equinox)\n    newrepr = from_coo.cartesian.transform(matrix_transpose(rmat))\n    gcrs = GCRS(newrepr, obstime=from_coo.obstime)\n\n    # now do any needed offsets (no-op if same obstime and 0 pos/vel)\n    return gcrs.transform_to(gcrs_frame)"},{"className":"AsymmetricPercentileInterval","col":0,"comment":"\n    Interval based on a keeping a specified fraction of pixels (can be\n    asymmetric).\n\n    Parameters\n    ----------\n    lower_percentile : float\n        The lower percentile below which to ignore pixels.\n    upper_percentile : float\n        The upper percentile above which to ignore pixels.\n    n_samples : int, optional\n        Maximum number of values to use. If this is specified, and there\n        are more values in the dataset as this, then values are randomly\n        sampled from the array (with replacement).\n    ","endLoc":168,"id":15914,"nodeType":"Class","startLoc":130,"text":"class AsymmetricPercentileInterval(BaseInterval):\n    \"\"\"\n    Interval based on a keeping a specified fraction of pixels (can be\n    asymmetric).\n\n    Parameters\n    ----------\n    lower_percentile : float\n        The lower percentile below which to ignore pixels.\n    upper_percentile : float\n        The upper percentile above which to ignore pixels.\n    n_samples : int, optional\n        Maximum number of values to use. If this is specified, and there\n        are more values in the dataset as this, then values are randomly\n        sampled from the array (with replacement).\n    \"\"\"\n\n    def __init__(self, lower_percentile, upper_percentile, n_samples=None):\n        self.lower_percentile = lower_percentile\n        self.upper_percentile = upper_percentile\n        self.n_samples = n_samples\n\n    def get_limits(self, values):\n        # Make sure values is a Numpy array\n        values = np.asarray(values).ravel()\n\n        # If needed, limit the number of samples. We sample with replacement\n        # since this is much faster.\n        if self.n_samples is not None and values.size > self.n_samples:\n            values = np.random.choice(values, self.n_samples)\n\n        # Filter out invalid values (inf, nan)\n        values = values[np.isfinite(values)]\n\n        # Determine values at percentiles\n        vmin, vmax = np.percentile(values, (self.lower_percentile,\n                                            self.upper_percentile))\n\n        return vmin, vmax"},{"col":4,"comment":"null","endLoc":150,"header":"def __init__(self, lower_percentile, upper_percentile, n_samples=None)","id":15915,"name":"__init__","nodeType":"Function","startLoc":147,"text":"def __init__(self, lower_percentile, upper_percentile, n_samples=None):\n        self.lower_percentile = lower_percentile\n        self.upper_percentile = upper_percentile\n        self.n_samples = n_samples"},{"col":4,"comment":"null","endLoc":168,"header":"def get_limits(self, values)","id":15916,"name":"get_limits","nodeType":"Function","startLoc":152,"text":"def get_limits(self, values):\n        # Make sure values is a Numpy array\n        values = np.asarray(values).ravel()\n\n        # If needed, limit the number of samples. We sample with replacement\n        # since this is much faster.\n        if self.n_samples is not None and values.size > self.n_samples:\n            values = np.random.choice(values, self.n_samples)\n\n        # Filter out invalid values (inf, nan)\n        values = values[np.isfinite(values)]\n\n        # Determine values at percentiles\n        vmin, vmax = np.percentile(values, (self.lower_percentile,\n                                            self.upper_percentile))\n\n        return vmin, vmax"},{"attributeType":"null","col":8,"comment":"null","endLoc":236,"id":15917,"name":"max_iterations","nodeType":"Attribute","startLoc":236,"text":"self.max_iterations"},{"col":4,"comment":"\n        Compute histogram over the samples in the distribution.\n\n        Parameters\n        ----------\n        All keyword arguments are passed into `astropy.stats.histogram`. Note\n        That some of these options may not be valid for some multidimensional\n        distributions.\n\n        Returns\n        -------\n        hist : array\n            The values of the histogram. Trailing dimension is the histogram\n            dimension.\n        bin_edges : array of dtype float\n            Return the bin edges ``(length(hist)+1)``. Trailing dimension is the\n            bin histogram dimension.\n        ","endLoc":258,"header":"def pdf_histogram(self, **kwargs)","id":15918,"name":"pdf_histogram","nodeType":"Function","startLoc":225,"text":"def pdf_histogram(self, **kwargs):\n        \"\"\"\n        Compute histogram over the samples in the distribution.\n\n        Parameters\n        ----------\n        All keyword arguments are passed into `astropy.stats.histogram`. Note\n        That some of these options may not be valid for some multidimensional\n        distributions.\n\n        Returns\n        -------\n        hist : array\n            The values of the histogram. Trailing dimension is the histogram\n            dimension.\n        bin_edges : array of dtype float\n            Return the bin edges ``(length(hist)+1)``. Trailing dimension is the\n            bin histogram dimension.\n        \"\"\"\n        distr = self.distribution\n        raveled_distr = distr.reshape(distr.size//distr.shape[-1], distr.shape[-1])\n\n        nhists = []\n        bin_edges = []\n        for d in raveled_distr:\n            nhist, bin_edge = stats.histogram(d, **kwargs)\n            nhists.append(nhist)\n            bin_edges.append(bin_edge)\n\n        nhists = np.array(nhists)\n        nh_shape = self.shape + (nhists.size//self.size,)\n        bin_edges = np.array(bin_edges)\n        be_shape = self.shape + (bin_edges.size//self.size,)\n        return nhists.reshape(nh_shape), bin_edges.reshape(be_shape)"},{"attributeType":"null","col":8,"comment":"null","endLoc":231,"id":15919,"name":"nsamples","nodeType":"Attribute","startLoc":231,"text":"self.nsamples"},{"attributeType":"null","col":8,"comment":"null","endLoc":233,"id":15920,"name":"max_reject","nodeType":"Attribute","startLoc":233,"text":"self.max_reject"},{"attributeType":"null","col":8,"comment":"null","endLoc":149,"id":15921,"name":"upper_percentile","nodeType":"Attribute","startLoc":149,"text":"self.upper_percentile"},{"attributeType":"null","col":8,"comment":"null","endLoc":232,"id":15922,"name":"contrast","nodeType":"Attribute","startLoc":232,"text":"self.contrast"},{"col":0,"comment":"null","endLoc":166,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, ICRS, BarycentricTrueEcliptic)\ndef icrs_to_true_baryecliptic(from_coo, to_frame)","id":15923,"name":"icrs_to_true_baryecliptic","nodeType":"Function","startLoc":164,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, ICRS, BarycentricTrueEcliptic)\ndef icrs_to_true_baryecliptic(from_coo, to_frame):\n    return _true_ecliptic_rotation_matrix(to_frame.equinox)"},{"attributeType":"null","col":8,"comment":"null","endLoc":234,"id":15924,"name":"min_npixels","nodeType":"Attribute","startLoc":234,"text":"self.min_npixels"},{"col":0,"comment":"null","endLoc":171,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, BarycentricTrueEcliptic, ICRS)\ndef true_baryecliptic_to_icrs(from_coo, to_frame)","id":15925,"name":"true_baryecliptic_to_icrs","nodeType":"Function","startLoc":169,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, BarycentricTrueEcliptic, ICRS)\ndef true_baryecliptic_to_icrs(from_coo, to_frame):\n    return matrix_transpose(icrs_to_true_baryecliptic(to_frame, from_coo))"},{"attributeType":"null","col":8,"comment":"null","endLoc":148,"id":15926,"name":"lower_percentile","nodeType":"Attribute","startLoc":148,"text":"self.lower_percentile"},{"attributeType":"null","col":8,"comment":"null","endLoc":150,"id":15927,"name":"n_samples","nodeType":"Attribute","startLoc":150,"text":"self.n_samples"},{"className":"PercentileInterval","col":0,"comment":"\n    Interval based on a keeping a specified fraction of pixels.\n\n    Parameters\n    ----------\n    percentile : float\n        The fraction of pixels to keep. The same fraction of pixels is\n        eliminated from both ends.\n    n_samples : int, optional\n        Maximum number of values to use. If this is specified, and there\n        are more values in the dataset as this, then values are randomly\n        sampled from the array (with replacement).\n    ","endLoc":190,"id":15928,"nodeType":"Class","startLoc":171,"text":"class PercentileInterval(AsymmetricPercentileInterval):\n    \"\"\"\n    Interval based on a keeping a specified fraction of pixels.\n\n    Parameters\n    ----------\n    percentile : float\n        The fraction of pixels to keep. The same fraction of pixels is\n        eliminated from both ends.\n    n_samples : int, optional\n        Maximum number of values to use. If this is specified, and there\n        are more values in the dataset as this, then values are randomly\n        sampled from the array (with replacement).\n    \"\"\"\n\n    def __init__(self, percentile, n_samples=None):\n        lower_percentile = (100 - percentile) * 0.5\n        upper_percentile = 100 - lower_percentile\n        super().__init__(\n            lower_percentile, upper_percentile, n_samples=n_samples)"},{"attributeType":"null","col":4,"comment":"null","endLoc":40,"id":15929,"name":"_generated_subclasses","nodeType":"Attribute","startLoc":40,"text":"_generated_subclasses"},{"attributeType":"null","col":8,"comment":"null","endLoc":72,"id":15930,"name":"shape","nodeType":"Attribute","startLoc":72,"text":"self.shape"},{"attributeType":"null","col":8,"comment":"null","endLoc":52,"id":15931,"name":"samples_cls","nodeType":"Attribute","startLoc":52,"text":"samples_cls"},{"col":4,"comment":"null","endLoc":190,"header":"def __init__(self, percentile, n_samples=None)","id":15932,"name":"__init__","nodeType":"Function","startLoc":186,"text":"def __init__(self, percentile, n_samples=None):\n        lower_percentile = (100 - percentile) * 0.5\n        upper_percentile = 100 - lower_percentile\n        super().__init__(\n            lower_percentile, upper_percentile, n_samples=n_samples)"},{"attributeType":"null","col":8,"comment":"null","endLoc":50,"id":15933,"name":"new_dtype","nodeType":"Attribute","startLoc":50,"text":"new_dtype"},{"attributeType":"null","col":8,"comment":"null","endLoc":235,"id":15934,"name":"krej","nodeType":"Attribute","startLoc":235,"text":"self.krej"},{"attributeType":"null","col":8,"comment":"null","endLoc":70,"id":15935,"name":"self","nodeType":"Attribute","startLoc":70,"text":"self"},{"attributeType":"null","col":12,"comment":"null","endLoc":64,"id":15936,"name":"new_cls","nodeType":"Attribute","startLoc":64,"text":"new_cls"},{"col":0,"comment":"null","endLoc":187,"header":"@frame_transform_graph.transform(AffineTransform,\n                                 ICRS, HeliocentricTrueEcliptic)\ndef icrs_to_true_helioecliptic(from_coo, to_frame)","id":15937,"name":"icrs_to_true_helioecliptic","nodeType":"Function","startLoc":174,"text":"@frame_transform_graph.transform(AffineTransform,\n                                 ICRS, HeliocentricTrueEcliptic)\ndef icrs_to_true_helioecliptic(from_coo, to_frame):\n    if not u.m.is_equivalent(from_coo.cartesian.x.unit):\n        raise UnitsError(_NEED_ORIGIN_HINT.format(from_coo.__class__.__name__))\n\n    # get the offset of the barycenter from the Sun\n    ssb_from_sun = get_offset_sun_from_barycenter(to_frame.obstime, reverse=True,\n                                                  include_velocity=bool(from_coo.data.differentials))\n\n    # now compute the matrix to precess to the right orientation\n    rmat = _true_ecliptic_rotation_matrix(to_frame.equinox)\n\n    return rmat, ssb_from_sun.transform(rmat)"},{"attributeType":"null","col":12,"comment":"null","endLoc":46,"id":15938,"name":"samples","nodeType":"Attribute","startLoc":46,"text":"samples"},{"attributeType":"null","col":12,"comment":"null","endLoc":63,"id":15939,"name":"new_name","nodeType":"Attribute","startLoc":63,"text":"new_name"},{"col":0,"comment":"\n    Create a Gaussian/normal distribution.\n\n    Parameters\n    ----------\n    center : `~astropy.units.Quantity`\n        The center of this distribution\n    std : `~astropy.units.Quantity` or None\n        The standard deviation/σ of this distribution. Shape must match and unit\n        must be compatible with ``center``, or be `None` (if ``var`` or ``ivar``\n        are set).\n    var : `~astropy.units.Quantity` or None\n        The variance of this distribution. Shape must match and unit must be\n        compatible with ``center``, or be `None` (if ``std`` or ``ivar`` are set).\n    ivar : `~astropy.units.Quantity` or None\n        The inverse variance of this distribution. Shape must match and unit\n        must be compatible with ``center``, or be `None` (if ``std`` or ``var``\n        are set).\n    n_samples : int\n        The number of Monte Carlo samples to use with this distribution\n    cls : class\n        The class to use to create this distribution.  Typically a\n        `Distribution` subclass.\n\n    Remaining keywords are passed into the constructor of the ``cls``\n\n    Returns\n    -------\n    distr : `~astropy.uncertainty.Distribution` or object\n        The sampled Gaussian distribution.\n        The type will be the same as the parameter ``cls``.\n\n    ","endLoc":71,"header":"def normal(center, *, std=None, var=None, ivar=None, n_samples,\n           cls=Distribution, **kwargs)","id":15940,"name":"normal","nodeType":"Function","startLoc":17,"text":"def normal(center, *, std=None, var=None, ivar=None, n_samples,\n           cls=Distribution, **kwargs):\n    \"\"\"\n    Create a Gaussian/normal distribution.\n\n    Parameters\n    ----------\n    center : `~astropy.units.Quantity`\n        The center of this distribution\n    std : `~astropy.units.Quantity` or None\n        The standard deviation/σ of this distribution. Shape must match and unit\n        must be compatible with ``center``, or be `None` (if ``var`` or ``ivar``\n        are set).\n    var : `~astropy.units.Quantity` or None\n        The variance of this distribution. Shape must match and unit must be\n        compatible with ``center``, or be `None` (if ``std`` or ``ivar`` are set).\n    ivar : `~astropy.units.Quantity` or None\n        The inverse variance of this distribution. Shape must match and unit\n        must be compatible with ``center``, or be `None` (if ``std`` or ``var``\n        are set).\n    n_samples : int\n        The number of Monte Carlo samples to use with this distribution\n    cls : class\n        The class to use to create this distribution.  Typically a\n        `Distribution` subclass.\n\n    Remaining keywords are passed into the constructor of the ``cls``\n\n    Returns\n    -------\n    distr : `~astropy.uncertainty.Distribution` or object\n        The sampled Gaussian distribution.\n        The type will be the same as the parameter ``cls``.\n\n    \"\"\"\n    center = np.asanyarray(center)\n    if var is not None:\n        if std is None:\n            std = np.asanyarray(var)**0.5\n        else:\n            raise ValueError('normal cannot take both std and var')\n    if ivar is not None:\n        if std is None:\n            std = np.asanyarray(ivar)**-0.5\n        else:\n            raise ValueError('normal cannot take both ivar and '\n                             'and std or var')\n    if std is None:\n        raise ValueError('normal requires one of std, var, or ivar')\n    else:\n        std = np.asanyarray(std)\n\n    randshape = np.broadcast(std, center).shape + (n_samples,)\n    samples = center[..., np.newaxis] + np.random.randn(*randshape) * std[..., np.newaxis]\n    return cls(samples, **kwargs)"},{"className":"Mapping","col":0,"comment":"\n    Baseclass to map red, blue, green intensities into uint8 values.\n\n    Parameters\n    ----------\n    minimum : float or sequence(3)\n        Intensity that should be mapped to black (a scalar or array for R, G, B).\n    image : ndarray, optional\n        An image used to calculate some parameters of some mappings.\n    ","endLoc":176,"id":15941,"nodeType":"Class","startLoc":49,"text":"class Mapping:\n    \"\"\"\n    Baseclass to map red, blue, green intensities into uint8 values.\n\n    Parameters\n    ----------\n    minimum : float or sequence(3)\n        Intensity that should be mapped to black (a scalar or array for R, G, B).\n    image : ndarray, optional\n        An image used to calculate some parameters of some mappings.\n    \"\"\"\n\n    def __init__(self, minimum=None, image=None):\n        self._uint8Max = float(np.iinfo(np.uint8).max)\n\n        try:\n            len(minimum)\n        except TypeError:\n            minimum = 3*[minimum]\n        if len(minimum) != 3:\n            raise ValueError(\"please provide 1 or 3 values for minimum.\")\n\n        self.minimum = minimum\n        self._image = np.asarray(image)\n\n    def make_rgb_image(self, image_r, image_g, image_b):\n        \"\"\"\n        Convert 3 arrays, image_r, image_g, and image_b into an 8-bit RGB image.\n\n        Parameters\n        ----------\n        image_r : ndarray\n            Image to map to red.\n        image_g : ndarray\n            Image to map to green.\n        image_b : ndarray\n            Image to map to blue.\n\n        Returns\n        -------\n        RGBimage : ndarray\n            RGB (integer, 8-bits per channel) color image as an NxNx3 numpy array.\n        \"\"\"\n        image_r = np.asarray(image_r)\n        image_g = np.asarray(image_g)\n        image_b = np.asarray(image_b)\n\n        if (image_r.shape != image_g.shape) or (image_g.shape != image_b.shape):\n            msg = \"The image shapes must match. r: {}, g: {} b: {}\"\n            raise ValueError(msg.format(image_r.shape, image_g.shape, image_b.shape))\n\n        return np.dstack(self._convert_images_to_uint8(image_r, image_g, image_b)).astype(np.uint8)\n\n    def intensity(self, image_r, image_g, image_b):\n        \"\"\"\n        Return the total intensity from the red, blue, and green intensities.\n        This is a naive computation, and may be overridden by subclasses.\n\n        Parameters\n        ----------\n        image_r : ndarray\n            Intensity of image to be mapped to red; or total intensity if\n            ``image_g`` and ``image_b`` are None.\n        image_g : ndarray, optional\n            Intensity of image to be mapped to green.\n        image_b : ndarray, optional\n            Intensity of image to be mapped to blue.\n\n        Returns\n        -------\n        intensity : ndarray\n            Total intensity from the red, blue and green intensities, or\n            ``image_r`` if green and blue images are not provided.\n        \"\"\"\n        return compute_intensity(image_r, image_g, image_b)\n\n    def map_intensity_to_uint8(self, I):\n        \"\"\"\n        Return an array which, when multiplied by an image, returns that image\n        mapped to the range of a uint8, [0, 255] (but not converted to uint8).\n\n        The intensity is assumed to have had minimum subtracted (as that can be\n        done per-band).\n\n        Parameters\n        ----------\n        I : ndarray\n            Intensity to be mapped.\n\n        Returns\n        -------\n        mapped_I : ndarray\n            ``I`` mapped to uint8\n        \"\"\"\n        with np.errstate(invalid='ignore', divide='ignore'):\n            return np.clip(I, 0, self._uint8Max)\n\n    def _convert_images_to_uint8(self, image_r, image_g, image_b):\n        \"\"\"Use the mapping to convert images image_r, image_g, and image_b to a triplet of uint8 images\"\"\"\n        image_r = image_r - self.minimum[0]  # n.b. makes copy\n        image_g = image_g - self.minimum[1]\n        image_b = image_b - self.minimum[2]\n\n        fac = self.map_intensity_to_uint8(self.intensity(image_r, image_g, image_b))\n\n        image_rgb = [image_r, image_g, image_b]\n        for c in image_rgb:\n            c *= fac\n            with np.errstate(invalid='ignore'):\n                c[c < 0] = 0                # individual bands can still be < 0, even if fac isn't\n\n        pixmax = self._uint8Max\n        r0, g0, b0 = image_rgb           # copies -- could work row by row to minimise memory usage\n\n        with np.errstate(invalid='ignore', divide='ignore'):  # n.b. np.where can't and doesn't short-circuit\n            for i, c in enumerate(image_rgb):\n                c = np.where(r0 > g0,\n                             np.where(r0 > b0,\n                                      np.where(r0 >= pixmax, c*pixmax/r0, c),\n                                      np.where(b0 >= pixmax, c*pixmax/b0, c)),\n                             np.where(g0 > b0,\n                                      np.where(g0 >= pixmax, c*pixmax/g0, c),\n                                      np.where(b0 >= pixmax, c*pixmax/b0, c))).astype(np.uint8)\n                c[c > pixmax] = pixmax\n\n                image_rgb[i] = c\n\n        return image_rgb"},{"col":4,"comment":"null","endLoc":72,"header":"def __init__(self, minimum=None, image=None)","id":15942,"name":"__init__","nodeType":"Function","startLoc":61,"text":"def __init__(self, minimum=None, image=None):\n        self._uint8Max = float(np.iinfo(np.uint8).max)\n\n        try:\n            len(minimum)\n        except TypeError:\n            minimum = 3*[minimum]\n        if len(minimum) != 3:\n            raise ValueError(\"please provide 1 or 3 values for minimum.\")\n\n        self.minimum = minimum\n        self._image = np.asarray(image)"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":15943,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":6,"header":"interval.py#<anonymous>","id":15944,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nClasses that deal with computing intervals from arrays of values based on\nvarious criteria.\n\"\"\"\n\n__all__ = ['BaseInterval', 'ManualInterval', 'MinMaxInterval',\n           'AsymmetricPercentileInterval', 'PercentileInterval',\n           'ZScaleInterval']"},{"fileName":"mpl_style.py","filePath":"astropy/visualization","id":15945,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# This module contains dictionaries that can be used to set a matplotlib\n# plotting style. It is no longer documented/recommended as of Astropy v3.0\n# but is kept here for backward-compatibility.\n\n__all__ = ['astropy_mpl_style_1', 'astropy_mpl_style']\n\n# Version 1 astropy plotting style for matplotlib\nastropy_mpl_style_1 = {\n    # Lines\n    'lines.linewidth': 1.7,\n    'lines.antialiased': True,\n\n    # Patches\n    'patch.linewidth': 1.0,\n    'patch.facecolor': '#348ABD',\n    'patch.edgecolor': '#CCCCCC',\n    'patch.antialiased': True,\n\n    # Images\n    'image.cmap': 'gist_heat',\n    'image.origin': 'upper',\n\n    # Font\n    'font.size': 12.0,\n\n    # Axes\n    'axes.facecolor': '#FFFFFF',\n    'axes.edgecolor': '#AAAAAA',\n    'axes.linewidth': 1.0,\n    'axes.grid': True,\n    'axes.titlesize': 'x-large',\n    'axes.labelsize': 'large',\n    'axes.labelcolor': 'k',\n    'axes.axisbelow': True,\n\n    # Ticks\n    'xtick.major.size': 0,\n    'xtick.minor.size': 0,\n    'xtick.major.pad': 6,\n    'xtick.minor.pad': 6,\n    'xtick.color': '#565656',\n    'xtick.direction': 'in',\n    'ytick.major.size': 0,\n    'ytick.minor.size': 0,\n    'ytick.major.pad': 6,\n    'ytick.minor.pad': 6,\n    'ytick.color': '#565656',\n    'ytick.direction': 'in',\n\n    # Legend\n    'legend.fancybox': True,\n    'legend.loc': 'best',\n\n    # Figure\n    'figure.figsize': [8, 6],\n    'figure.facecolor': '1.0',\n    'figure.edgecolor': '0.50',\n    'figure.subplot.hspace': 0.5,\n\n    # Other\n    'savefig.dpi': 72,\n}\ncolor_cycle = ['#348ABD',   # blue\n               '#7A68A6',   # purple\n               '#A60628',   # red\n               '#467821',   # green\n               '#CF4457',   # pink\n               '#188487',   # turquoise\n               '#E24A33']   # orange\n\ntry:\n    # This is a dependency of matplotlib, so should be present if matplotlib\n    # is installed.\n    from cycler import cycler\n    astropy_mpl_style_1['axes.prop_cycle'] = cycler('color', color_cycle)\nexcept ImportError:\n    astropy_mpl_style_1['axes.color_cycle'] = color_cycle\n\n\nastropy_mpl_style = astropy_mpl_style_1\n\"\"\"The most recent version of the astropy plotting style.\"\"\"\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":15946,"name":"__all__","nodeType":"Attribute","startLoc":5,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"hist.py#<anonymous>","id":15947,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['hist']"},{"col":4,"comment":"\n        Convert 3 arrays, image_r, image_g, and image_b into an 8-bit RGB image.\n\n        Parameters\n        ----------\n        image_r : ndarray\n            Image to map to red.\n        image_g : ndarray\n            Image to map to green.\n        image_b : ndarray\n            Image to map to blue.\n\n        Returns\n        -------\n        RGBimage : ndarray\n            RGB (integer, 8-bits per channel) color image as an NxNx3 numpy array.\n        ","endLoc":100,"header":"def make_rgb_image(self, image_r, image_g, image_b)","id":15948,"name":"make_rgb_image","nodeType":"Function","startLoc":74,"text":"def make_rgb_image(self, image_r, image_g, image_b):\n        \"\"\"\n        Convert 3 arrays, image_r, image_g, and image_b into an 8-bit RGB image.\n\n        Parameters\n        ----------\n        image_r : ndarray\n            Image to map to red.\n        image_g : ndarray\n            Image to map to green.\n        image_b : ndarray\n            Image to map to blue.\n\n        Returns\n        -------\n        RGBimage : ndarray\n            RGB (integer, 8-bits per channel) color image as an NxNx3 numpy array.\n        \"\"\"\n        image_r = np.asarray(image_r)\n        image_g = np.asarray(image_g)\n        image_b = np.asarray(image_b)\n\n        if (image_r.shape != image_g.shape) or (image_g.shape != image_b.shape):\n            msg = \"The image shapes must match. r: {}, g: {} b: {}\"\n            raise ValueError(msg.format(image_r.shape, image_g.shape, image_b.shape))\n\n        return np.dstack(self._convert_images_to_uint8(image_r, image_g, image_b)).astype(np.uint8)"},{"col":0,"comment":"\n    Create a Poisson distribution.\n\n    Parameters\n    ----------\n    center : `~astropy.units.Quantity`\n        The center value of this distribution (i.e., λ).\n    n_samples : int\n        The number of Monte Carlo samples to use with this distribution\n    cls : class\n        The class to use to create this distribution.  Typically a\n        `Distribution` subclass.\n\n    Remaining keywords are passed into the constructor of the ``cls``\n\n    Returns\n    -------\n    distr : `~astropy.uncertainty.Distribution` or object\n        The sampled Poisson distribution.\n        The type will be the same as the parameter ``cls``.\n    ","endLoc":122,"header":"def poisson(center, n_samples, cls=Distribution, **kwargs)","id":15949,"name":"poisson","nodeType":"Function","startLoc":77,"text":"def poisson(center, n_samples, cls=Distribution, **kwargs):\n    \"\"\"\n    Create a Poisson distribution.\n\n    Parameters\n    ----------\n    center : `~astropy.units.Quantity`\n        The center value of this distribution (i.e., λ).\n    n_samples : int\n        The number of Monte Carlo samples to use with this distribution\n    cls : class\n        The class to use to create this distribution.  Typically a\n        `Distribution` subclass.\n\n    Remaining keywords are passed into the constructor of the ``cls``\n\n    Returns\n    -------\n    distr : `~astropy.uncertainty.Distribution` or object\n        The sampled Poisson distribution.\n        The type will be the same as the parameter ``cls``.\n    \"\"\"\n    # we convert to arrays because np.random.poisson has trouble with quantities\n    has_unit = False\n    if hasattr(center, 'unit'):\n        has_unit = True\n        poissonarr = np.asanyarray(center.value)\n    else:\n        poissonarr = np.asanyarray(center)\n    randshape = poissonarr.shape + (n_samples,)\n\n    samples = np.random.poisson(poissonarr[..., np.newaxis], randshape)\n    if has_unit:\n        if center.unit == u.adu:\n            warn('ADUs were provided to poisson.  ADUs are not strictly count'\n                 'units because they need the gain to be applied. It is '\n                 'recommended you apply the gain to convert to e.g. electrons.')\n        elif center.unit not in COUNT_UNITS:\n            warn('Unit {} was provided to poisson, which is not one of {}, '\n                 'and therefore suspect as a \"counting\" unit.  Ensure you mean '\n                 'to use Poisson statistics.'.format(center.unit, COUNT_UNITS))\n\n        # re-attach the unit\n        samples = samples * center.unit\n\n    return cls(samples, **kwargs)"},{"fileName":"units.py","filePath":"astropy/visualization","id":15950,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport numpy as np\n\n\n__doctest_skip__ = ['quantity_support']\n\n\ndef quantity_support(format='latex_inline'):\n    \"\"\"\n    Enable support for plotting `astropy.units.Quantity` instances in\n    matplotlib.\n\n    May be (optionally) used with a ``with`` statement.\n\n      >>> import matplotlib.pyplot as plt\n      >>> from astropy import units as u\n      >>> from astropy import visualization\n      >>> with visualization.quantity_support():\n      ...     plt.figure()\n      ...     plt.plot([1, 2, 3] * u.m)\n      [...]\n      ...     plt.plot([101, 125, 150] * u.cm)\n      [...]\n      ...     plt.draw()\n\n    Parameters\n    ----------\n    format : `astropy.units.format.Base` instance or str\n        The name of a format or a formatter object.  If not\n        provided, defaults to ``latex_inline``.\n\n    \"\"\"\n    from astropy import units as u\n    # import Angle just so we have a more or less complete list of Quantity\n    # subclasses loaded - matplotlib needs them all separately!\n    # NOTE: in matplotlib >=3.2, subclasses will be recognized automatically,\n    # and once that becomes our minimum version, we can remove this,\n    # adding just u.Quantity itself to the registry.\n    from astropy.coordinates import Angle  # noqa\n\n    from matplotlib import units\n    from matplotlib import ticker\n\n    # Get all subclass for Quantity, since matplotlib checks on class,\n    # not subclass.\n    def all_issubclass(cls):\n        return {cls}.union(\n            [s for c in cls.__subclasses__() for s in all_issubclass(c)])\n\n    def rad_fn(x, pos=None):\n        n = int((x / np.pi) * 2.0 + 0.25)\n        if n == 0:\n            return '0'\n        elif n == 1:\n            return 'π/2'\n        elif n == 2:\n            return 'π'\n        elif n % 2 == 0:\n            return f'{n // 2}π'\n        else:\n            return f'{n}π/2'\n\n    class MplQuantityConverter(units.ConversionInterface):\n\n        _all_issubclass_quantity = all_issubclass(u.Quantity)\n\n        def __init__(self):\n\n            # Keep track of original converter in case the context manager is\n            # used in a nested way.\n            self._original_converter = {}\n\n            for cls in self._all_issubclass_quantity:\n                self._original_converter[cls] = units.registry.get(cls)\n                units.registry[cls] = self\n\n        @staticmethod\n        def axisinfo(unit, axis):\n            if unit == u.radian:\n                return units.AxisInfo(\n                    majloc=ticker.MultipleLocator(base=np.pi/2),\n                    majfmt=ticker.FuncFormatter(rad_fn),\n                    label=unit.to_string(),\n                )\n            elif unit == u.degree:\n                return units.AxisInfo(\n                    majloc=ticker.AutoLocator(),\n                    majfmt=ticker.FormatStrFormatter('%i°'),\n                    label=unit.to_string(),\n                )\n            elif unit is not None:\n                return units.AxisInfo(label=unit.to_string(format))\n            return None\n\n        @staticmethod\n        def convert(val, unit, axis):\n            if isinstance(val, u.Quantity):\n                return val.to_value(unit)\n            elif isinstance(val, list) and val and isinstance(val[0], u.Quantity):\n                return [v.to_value(unit) for v in val]\n            else:\n                return val\n\n        @staticmethod\n        def default_units(x, axis):\n            if hasattr(x, 'unit'):\n                return x.unit\n            return None\n\n        def __enter__(self):\n            return self\n\n        def __exit__(self, type, value, tb):\n            for cls in self._all_issubclass_quantity:\n                if self._original_converter[cls] is None:\n                    del units.registry[cls]\n                else:\n                    units.registry[cls] = self._original_converter[cls]\n\n    return MplQuantityConverter()\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":15951,"name":"__all__","nodeType":"Attribute","startLoc":7,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":15952,"name":"astropy_mpl_style_1","nodeType":"Attribute","startLoc":10,"text":"astropy_mpl_style_1"},{"attributeType":"null","col":0,"comment":"null","endLoc":65,"id":15953,"name":"color_cycle","nodeType":"Attribute","startLoc":65,"text":"color_cycle"},{"attributeType":"null","col":0,"comment":"The most recent version of the astropy plotting style.","endLoc":82,"id":15954,"name":"astropy_mpl_style","nodeType":"Attribute","startLoc":82,"text":"astropy_mpl_style"},{"col":0,"comment":"","endLoc":7,"header":"mpl_style.py#<anonymous>","id":15955,"name":"<anonymous>","nodeType":"Function","startLoc":7,"text":"__all__ = ['astropy_mpl_style_1', 'astropy_mpl_style']\n\nastropy_mpl_style_1 = {\n    # Lines\n    'lines.linewidth': 1.7,\n    'lines.antialiased': True,\n\n    # Patches\n    'patch.linewidth': 1.0,\n    'patch.facecolor': '#348ABD',\n    'patch.edgecolor': '#CCCCCC',\n    'patch.antialiased': True,\n\n    # Images\n    'image.cmap': 'gist_heat',\n    'image.origin': 'upper',\n\n    # Font\n    'font.size': 12.0,\n\n    # Axes\n    'axes.facecolor': '#FFFFFF',\n    'axes.edgecolor': '#AAAAAA',\n    'axes.linewidth': 1.0,\n    'axes.grid': True,\n    'axes.titlesize': 'x-large',\n    'axes.labelsize': 'large',\n    'axes.labelcolor': 'k',\n    'axes.axisbelow': True,\n\n    # Ticks\n    'xtick.major.size': 0,\n    'xtick.minor.size': 0,\n    'xtick.major.pad': 6,\n    'xtick.minor.pad': 6,\n    'xtick.color': '#565656',\n    'xtick.direction': 'in',\n    'ytick.major.size': 0,\n    'ytick.minor.size': 0,\n    'ytick.major.pad': 6,\n    'ytick.minor.pad': 6,\n    'ytick.color': '#565656',\n    'ytick.direction': 'in',\n\n    # Legend\n    'legend.fancybox': True,\n    'legend.loc': 'best',\n\n    # Figure\n    'figure.figsize': [8, 6],\n    'figure.facecolor': '1.0',\n    'figure.edgecolor': '0.50',\n    'figure.subplot.hspace': 0.5,\n\n    # Other\n    'savefig.dpi': 72,\n}\n\ncolor_cycle = ['#348ABD',   # blue\n               '#7A68A6',   # purple\n               '#A60628',   # red\n               '#467821',   # green\n               '#CF4457',   # pink\n               '#188487',   # turquoise\n               '#E24A33']   # orange\n\ntry:\n    # This is a dependency of matplotlib, so should be present if matplotlib\n    # is installed.\n    from cycler import cycler\n    astropy_mpl_style_1['axes.prop_cycle'] = cycler('color', color_cycle)\nexcept ImportError:\n    astropy_mpl_style_1['axes.color_cycle'] = color_cycle\n\nastropy_mpl_style = astropy_mpl_style_1\n\n\"\"\"The most recent version of the astropy plotting style.\"\"\""},{"col":0,"comment":"\n    Enable support for plotting `astropy.units.Quantity` instances in\n    matplotlib.\n\n    May be (optionally) used with a ``with`` statement.\n\n      >>> import matplotlib.pyplot as plt\n      >>> from astropy import units as u\n      >>> from astropy import visualization\n      >>> with visualization.quantity_support():\n      ...     plt.figure()\n      ...     plt.plot([1, 2, 3] * u.m)\n      [...]\n      ...     plt.plot([101, 125, 150] * u.cm)\n      [...]\n      ...     plt.draw()\n\n    Parameters\n    ----------\n    format : `astropy.units.format.Base` instance or str\n        The name of a format or a formatter object.  If not\n        provided, defaults to ``latex_inline``.\n\n    ","endLoc":122,"header":"def quantity_support(format='latex_inline')","id":15956,"name":"quantity_support","nodeType":"Function","startLoc":10,"text":"def quantity_support(format='latex_inline'):\n    \"\"\"\n    Enable support for plotting `astropy.units.Quantity` instances in\n    matplotlib.\n\n    May be (optionally) used with a ``with`` statement.\n\n      >>> import matplotlib.pyplot as plt\n      >>> from astropy import units as u\n      >>> from astropy import visualization\n      >>> with visualization.quantity_support():\n      ...     plt.figure()\n      ...     plt.plot([1, 2, 3] * u.m)\n      [...]\n      ...     plt.plot([101, 125, 150] * u.cm)\n      [...]\n      ...     plt.draw()\n\n    Parameters\n    ----------\n    format : `astropy.units.format.Base` instance or str\n        The name of a format or a formatter object.  If not\n        provided, defaults to ``latex_inline``.\n\n    \"\"\"\n    from astropy import units as u\n    # import Angle just so we have a more or less complete list of Quantity\n    # subclasses loaded - matplotlib needs them all separately!\n    # NOTE: in matplotlib >=3.2, subclasses will be recognized automatically,\n    # and once that becomes our minimum version, we can remove this,\n    # adding just u.Quantity itself to the registry.\n    from astropy.coordinates import Angle  # noqa\n\n    from matplotlib import units\n    from matplotlib import ticker\n\n    # Get all subclass for Quantity, since matplotlib checks on class,\n    # not subclass.\n    def all_issubclass(cls):\n        return {cls}.union(\n            [s for c in cls.__subclasses__() for s in all_issubclass(c)])\n\n    def rad_fn(x, pos=None):\n        n = int((x / np.pi) * 2.0 + 0.25)\n        if n == 0:\n            return '0'\n        elif n == 1:\n            return 'π/2'\n        elif n == 2:\n            return 'π'\n        elif n % 2 == 0:\n            return f'{n // 2}π'\n        else:\n            return f'{n}π/2'\n\n    class MplQuantityConverter(units.ConversionInterface):\n\n        _all_issubclass_quantity = all_issubclass(u.Quantity)\n\n        def __init__(self):\n\n            # Keep track of original converter in case the context manager is\n            # used in a nested way.\n            self._original_converter = {}\n\n            for cls in self._all_issubclass_quantity:\n                self._original_converter[cls] = units.registry.get(cls)\n                units.registry[cls] = self\n\n        @staticmethod\n        def axisinfo(unit, axis):\n            if unit == u.radian:\n                return units.AxisInfo(\n                    majloc=ticker.MultipleLocator(base=np.pi/2),\n                    majfmt=ticker.FuncFormatter(rad_fn),\n                    label=unit.to_string(),\n                )\n            elif unit == u.degree:\n                return units.AxisInfo(\n                    majloc=ticker.AutoLocator(),\n                    majfmt=ticker.FormatStrFormatter('%i°'),\n                    label=unit.to_string(),\n                )\n            elif unit is not None:\n                return units.AxisInfo(label=unit.to_string(format))\n            return None\n\n        @staticmethod\n        def convert(val, unit, axis):\n            if isinstance(val, u.Quantity):\n                return val.to_value(unit)\n            elif isinstance(val, list) and val and isinstance(val[0], u.Quantity):\n                return [v.to_value(unit) for v in val]\n            else:\n                return val\n\n        @staticmethod\n        def default_units(x, axis):\n            if hasattr(x, 'unit'):\n                return x.unit\n            return None\n\n        def __enter__(self):\n            return self\n\n        def __exit__(self, type, value, tb):\n            for cls in self._all_issubclass_quantity:\n                if self._original_converter[cls] is None:\n                    del units.registry[cls]\n                else:\n                    units.registry[cls] = self._original_converter[cls]\n\n    return MplQuantityConverter()"},{"fileName":"__init__.py","filePath":"astropy/visualization","id":15957,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom .hist import *\nfrom .interval import *\nfrom .mpl_normalize import *\nfrom .mpl_style import *\nfrom .stretch import *\nfrom .transform import *\nfrom .units import *\nfrom .time import *\nfrom .lupton_rgb import *\n"},{"fileName":"stretch.py","filePath":"astropy/visualization","id":15958,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nClasses that deal with stretching, i.e. mapping a range of [0:1] values onto\nanother set of [0:1] values with a transformation\n\"\"\"\n\nimport numpy as np\n\nfrom .transform import BaseTransform\nfrom .transform import CompositeTransform\n\n\n__all__ = [\"BaseStretch\", \"LinearStretch\", \"SqrtStretch\", \"PowerStretch\",\n           \"PowerDistStretch\", \"SquaredStretch\", \"LogStretch\", \"AsinhStretch\",\n           \"SinhStretch\", \"HistEqStretch\", \"ContrastBiasStretch\",\n           \"CompositeStretch\"]\n\n\ndef _logn(n, x, out=None):\n    \"\"\"Calculate the log base n of x.\"\"\"\n    # We define this because numpy.lib.scimath.logn doesn't support out=\n    if out is None:\n        return np.log(x) / np.log(n)\n    else:\n        np.log(x, out=out)\n        np.true_divide(out, np.log(n), out=out)\n        return out\n\n\ndef _prepare(values, clip=True, out=None):\n    \"\"\"\n    Prepare the data by optionally clipping and copying, and return the\n    array that should be subsequently used for in-place calculations.\n    \"\"\"\n\n    if clip:\n        return np.clip(values, 0., 1., out=out)\n    else:\n        if out is None:\n            return np.array(values, copy=True)\n        else:\n            out[:] = np.asarray(values)\n            return out\n\n\nclass BaseStretch(BaseTransform):\n    \"\"\"\n    Base class for the stretch classes, which, when called with an array\n    of values in the range [0:1], return an transformed array of values,\n    also in the range [0:1].\n    \"\"\"\n\n    @property\n    def _supports_invalid_kw(self):\n        return False\n\n    def __add__(self, other):\n        return CompositeStretch(other, self)\n\n    def __call__(self, values, clip=True, out=None):\n        \"\"\"\n        Transform values using this stretch.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values, which should already be normalized to the\n            [0:1] range.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        \"\"\"\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n\n\nclass LinearStretch(BaseStretch):\n    \"\"\"\n    A linear stretch with a slope and offset.\n\n    The stretch is given by:\n\n    .. math::\n        y = slope x + intercept\n\n    Parameters\n    ----------\n    slope : float, optional\n        The ``slope`` parameter used in the above formula.  Default is 1.\n    intercept : float, optional\n        The ``intercept`` parameter used in the above formula.  Default is 0.\n    \"\"\"\n\n    def __init__(self, slope=1, intercept=0):\n        super().__init__()\n        self.slope = slope\n        self.intercept = intercept\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        if self.slope != 1:\n            np.multiply(values, self.slope, out=values)\n        if self.intercept != 0:\n            np.add(values, self.intercept, out=values)\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return LinearStretch(1. / self.slope, - self.intercept / self.slope)\n\n\nclass SqrtStretch(BaseStretch):\n    r\"\"\"\n    A square root stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\sqrt{x}\n    \"\"\"\n\n    @property\n    def _supports_invalid_kw(self):\n        return True\n\n    def __call__(self, values, clip=True, out=None, invalid=None):\n        \"\"\"\n        Transform values using this stretch.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values, which should already be normalized to the\n            [0:1] range.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n        invalid : None or float, optional\n            Value to assign NaN values generated by this class.  NaNs in\n            the input ``values`` array are not changed.  This option is\n            generally used with matplotlib normalization classes, where\n            the ``invalid`` value should map to the matplotlib colormap\n            \"under\" value (i.e., any finite value < 0).  If `None`, then\n            NaN values are not replaced.  This keyword has no effect if\n            ``clip=True``.\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        \"\"\"\n\n        values = _prepare(values, clip=clip, out=out)\n        replace_invalid = not clip and invalid is not None\n        with np.errstate(invalid='ignore'):\n            if replace_invalid:\n                idx = (values < 0)\n            np.sqrt(values, out=values)\n\n        if replace_invalid:\n            # Assign new NaN (i.e., NaN not in the original input\n            # values, but generated by this class) to the invalid value.\n            values[idx] = invalid\n\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return PowerStretch(2)\n\n\nclass PowerStretch(BaseStretch):\n    r\"\"\"\n    A power stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = x^a\n\n    Parameters\n    ----------\n    a : float\n        The power index (see the above formula).  ``a`` must be greater\n        than 0.\n    \"\"\"\n\n    @property\n    def _supports_invalid_kw(self):\n        return True\n\n    def __init__(self, a):\n        super().__init__()\n        if a <= 0:\n            raise ValueError(\"a must be > 0\")\n        self.power = a\n\n    def __call__(self, values, clip=True, out=None, invalid=None):\n        \"\"\"\n        Transform values using this stretch.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values, which should already be normalized to the\n            [0:1] range.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n        invalid : None or float, optional\n            Value to assign NaN values generated by this class.  NaNs in\n            the input ``values`` array are not changed.  This option is\n            generally used with matplotlib normalization classes, where\n            the ``invalid`` value should map to the matplotlib colormap\n            \"under\" value (i.e., any finite value < 0).  If `None`, then\n            NaN values are not replaced.  This keyword has no effect if\n            ``clip=True``.\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        \"\"\"\n\n        values = _prepare(values, clip=clip, out=out)\n        replace_invalid = (not clip and invalid is not None\n                           and ((-1 < self.power < 0)\n                                or (0 < self.power < 1)))\n        with np.errstate(invalid='ignore'):\n            if replace_invalid:\n                idx = (values < 0)\n            np.power(values, self.power, out=values)\n\n        if replace_invalid:\n            # Assign new NaN (i.e., NaN not in the original input\n            # values, but generated by this class) to the invalid value.\n            values[idx] = invalid\n\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return PowerStretch(1. / self.power)\n\n\nclass PowerDistStretch(BaseStretch):\n    r\"\"\"\n    An alternative power stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{a^x - 1}{a - 1}\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  ``a`` must be\n        greater than or equal to 0, but cannot be set to 1.  Default is\n        1000.\n    \"\"\"\n\n    def __init__(self, a=1000.0):\n        if a < 0 or a == 1:  # singularity\n            raise ValueError(\"a must be >= 0, but cannot be set to 1\")\n        super().__init__()\n        self.exp = a\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.power(self.exp, values, out=values)\n        np.subtract(values, 1, out=values)\n        np.true_divide(values, self.exp - 1.0, out=values)\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return InvertedPowerDistStretch(a=self.exp)\n\n\nclass InvertedPowerDistStretch(BaseStretch):\n    r\"\"\"\n    Inverse transformation for\n    `~astropy.image.scaling.PowerDistStretch`.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{\\log(y (a-1) + 1)}{\\log a}\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  ``a`` must be\n        greater than or equal to 0, but cannot be set to 1.  Default is\n        1000.\n    \"\"\"\n\n    def __init__(self, a=1000.0):\n        if a < 0 or a == 1:  # singularity\n            raise ValueError(\"a must be >= 0, but cannot be set to 1\")\n        super().__init__()\n        self.exp = a\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.multiply(values, self.exp - 1.0, out=values)\n        np.add(values, 1, out=values)\n        _logn(self.exp, values, out=values)\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return PowerDistStretch(a=self.exp)\n\n\nclass SquaredStretch(PowerStretch):\n    r\"\"\"\n    A convenience class for a power stretch of 2.\n\n    The stretch is given by:\n\n    .. math::\n        y = x^2\n    \"\"\"\n\n    def __init__(self):\n        super().__init__(2)\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return SqrtStretch()\n\n\nclass LogStretch(BaseStretch):\n    r\"\"\"\n    A log stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{\\log{(a x + 1)}}{\\log{(a + 1)}}\n\n    Parameters\n    ----------\n    a : float\n        The ``a`` parameter used in the above formula.  ``a`` must be\n        greater than 0.  Default is 1000.\n    \"\"\"\n\n    @property\n    def _supports_invalid_kw(self):\n        return True\n\n    def __init__(self, a=1000.0):\n        super().__init__()\n        if a <= 0:  # singularity\n            raise ValueError(\"a must be > 0\")\n        self.exp = a\n\n    def __call__(self, values, clip=True, out=None, invalid=None):\n        \"\"\"\n        Transform values using this stretch.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values, which should already be normalized to the\n            [0:1] range.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n        invalid : None or float, optional\n            Value to assign NaN values generated by this class.  NaNs in\n            the input ``values`` array are not changed.  This option is\n            generally used with matplotlib normalization classes, where\n            the ``invalid`` value should map to the matplotlib colormap\n            \"under\" value (i.e., any finite value < 0).  If `None`, then\n            NaN values are not replaced.  This keyword has no effect if\n            ``clip=True``.\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        \"\"\"\n\n        values = _prepare(values, clip=clip, out=out)\n        replace_invalid = not clip and invalid is not None\n        with np.errstate(invalid='ignore'):\n            if replace_invalid:\n                idx = (values < 0)\n            np.multiply(values, self.exp, out=values)\n            np.add(values, 1., out=values)\n            np.log(values, out=values)\n            np.true_divide(values, np.log(self.exp + 1.), out=values)\n\n        if replace_invalid:\n            # Assign new NaN (i.e., NaN not in the original input\n            # values, but generated by this class) to the invalid value.\n            values[idx] = invalid\n\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return InvertedLogStretch(self.exp)\n\n\nclass InvertedLogStretch(BaseStretch):\n    r\"\"\"\n    Inverse transformation for `~astropy.image.scaling.LogStretch`.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{e^{y \\log{a + 1}} - 1}{a} \\\\\n        y = \\frac{e^{y} (a + 1) - 1}{a}\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  ``a`` must be\n        greater than 0.  Default is 1000.\n    \"\"\"\n\n    def __init__(self, a):\n        super().__init__()\n        if a <= 0:  # singularity\n            raise ValueError(\"a must be > 0\")\n        self.exp = a\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.multiply(values, np.log(self.exp + 1.), out=values)\n        np.exp(values, out=values)\n        np.subtract(values, 1., out=values)\n        np.true_divide(values, self.exp, out=values)\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return LogStretch(self.exp)\n\n\nclass AsinhStretch(BaseStretch):\n    r\"\"\"\n    An asinh stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{{\\rm asinh}(x / a)}{{\\rm asinh}(1 / a)}.\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  The value of\n        this parameter is where the asinh curve transitions from linear\n        to logarithmic behavior, expressed as a fraction of the\n        normalized image.  ``a`` must be greater than 0 and less than or\n        equal to 1 (0 < a <= 1).  Default is 0.1.\n    \"\"\"\n\n    def __init__(self, a=0.1):\n        super().__init__()\n        if a <= 0 or a > 1:\n            raise ValueError(\"a must be > 0 and <= 1\")\n        self.a = a\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.true_divide(values, self.a, out=values)\n        np.arcsinh(values, out=values)\n        np.true_divide(values, np.arcsinh(1. / self.a), out=values)\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return SinhStretch(a=1. / np.arcsinh(1. / self.a))\n\n\nclass SinhStretch(BaseStretch):\n    r\"\"\"\n    A sinh stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{{\\rm sinh}(x / a)}{{\\rm sinh}(1 / a)}\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  ``a`` must be\n        greater than 0 and less than or equal to 1 (0 < a <= 1).\n        Default is 1/3.\n    \"\"\"\n\n    def __init__(self, a=1./3.):\n        super().__init__()\n        if a <= 0 or a > 1:\n            raise ValueError(\"a must be > 0 and <= 1\")\n        self.a = a\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.true_divide(values, self.a, out=values)\n        np.sinh(values, out=values)\n        np.true_divide(values, np.sinh(1. / self.a), out=values)\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return AsinhStretch(a=1. / np.sinh(1. / self.a))\n\n\nclass HistEqStretch(BaseStretch):\n    \"\"\"\n    A histogram equalization stretch.\n\n    Parameters\n    ----------\n    data : array-like\n        The data defining the equalization.\n    values : array-like, optional\n        The input image values, which should already be normalized to\n        the [0:1] range.\n    \"\"\"\n\n    def __init__(self, data, values=None):\n        # Assume data is not necessarily normalized at this point\n        self.data = np.sort(data.ravel())\n        self.data = self.data[np.isfinite(self.data)]\n        vmin = self.data.min()\n        vmax = self.data.max()\n        self.data = (self.data - vmin) / (vmax - vmin)\n\n        # Compute relative position of each pixel\n        if values is None:\n            self.values = np.linspace(0., 1., len(self.data))\n        else:\n            self.values = values\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        values[:] = np.interp(values, self.data, self.values)\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return InvertedHistEqStretch(self.data, values=self.values)\n\n\nclass InvertedHistEqStretch(BaseStretch):\n    \"\"\"\n    Inverse transformation for `~astropy.image.scaling.HistEqStretch`.\n\n    Parameters\n    ----------\n    data : array-like\n        The data defining the equalization.\n    values : array-like, optional\n        The input image values, which should already be normalized to\n        the [0:1] range.\n    \"\"\"\n\n    def __init__(self, data, values=None):\n        self.data = data[np.isfinite(data)]\n        if values is None:\n            self.values = np.linspace(0., 1., len(self.data))\n        else:\n            self.values = values\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        values[:] = np.interp(values, self.values, self.data)\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return HistEqStretch(self.data, values=self.values)\n\n\nclass ContrastBiasStretch(BaseStretch):\n    r\"\"\"\n    A stretch that takes into account contrast and bias.\n\n    The stretch is given by:\n\n    .. math::\n        y = (x - {\\rm bias}) * {\\rm contrast} + 0.5\n\n    and the output values are clipped to the [0:1] range.\n\n    Parameters\n    ----------\n    contrast : float\n        The contrast parameter (see the above formula).\n\n    bias : float\n        The bias parameter (see the above formula).\n    \"\"\"\n\n    def __init__(self, contrast, bias):\n        super().__init__()\n        self.contrast = contrast\n        self.bias = bias\n\n    def __call__(self, values, clip=True, out=None):\n        # As a special case here, we only clip *after* the\n        # transformation since it does not map [0:1] to [0:1]\n        values = _prepare(values, clip=False, out=out)\n\n        np.subtract(values, self.bias, out=values)\n        np.multiply(values, self.contrast, out=values)\n        np.add(values, 0.5, out=values)\n\n        if clip:\n            np.clip(values, 0, 1, out=values)\n\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return InvertedContrastBiasStretch(self.contrast, self.bias)\n\n\nclass InvertedContrastBiasStretch(BaseStretch):\n    \"\"\"\n    Inverse transformation for ContrastBiasStretch.\n\n    Parameters\n    ----------\n    contrast : float\n        The contrast parameter (see\n        `~astropy.visualization.ConstrastBiasStretch).\n\n    bias : float\n        The bias parameter (see\n        `~astropy.visualization.ConstrastBiasStretch).\n    \"\"\"\n\n    def __init__(self, contrast, bias):\n        super().__init__()\n        self.contrast = contrast\n        self.bias = bias\n\n    def __call__(self, values, clip=True, out=None):\n        # As a special case here, we only clip *after* the\n        # transformation since it does not map [0:1] to [0:1]\n        values = _prepare(values, clip=False, out=out)\n        np.subtract(values, 0.5, out=values)\n        np.true_divide(values, self.contrast, out=values)\n        np.add(values, self.bias, out=values)\n\n        if clip:\n            np.clip(values, 0, 1, out=values)\n\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return ContrastBiasStretch(self.contrast, self.bias)\n\n\nclass CompositeStretch(CompositeTransform, BaseStretch):\n    \"\"\"\n    A combination of two stretches.\n\n    Parameters\n    ----------\n    stretch_1 : :class:`astropy.visualization.BaseStretch`\n        The first stretch to apply.\n    stretch_2 : :class:`astropy.visualization.BaseStretch`\n        The second stretch to apply.\n    \"\"\"\n\n    def __call__(self, values, clip=True, out=None):\n        return self.transform_2(\n            self.transform_1(values, clip=clip, out=out), clip=clip, out=out)\n"},{"className":"ScalarDistribution","col":0,"comment":"Scalar distribution.\n\n    This class mostly exists to make `~numpy.array2print` possible for\n    all subclasses.  It is a scalar element, still with n_samples samples.\n    ","endLoc":267,"id":15959,"nodeType":"Class","startLoc":261,"text":"class ScalarDistribution(Distribution, np.void):\n    \"\"\"Scalar distribution.\n\n    This class mostly exists to make `~numpy.array2print` possible for\n    all subclasses.  It is a scalar element, still with n_samples samples.\n    \"\"\"\n    pass"},{"className":"ArrayDistribution","col":0,"comment":"null","endLoc":312,"id":15960,"nodeType":"Class","startLoc":270,"text":"class ArrayDistribution(Distribution, np.ndarray):\n    # This includes the important override of view and __getitem__\n    # which are needed for all ndarray subclass Distributions, but not\n    # for the scalar one.\n    _samples_cls = np.ndarray\n\n    # Override view so that we stay a Distribution version of the new type.\n    def view(self, dtype=None, type=None):\n        \"\"\"New view of array with the same data.\n\n        Like `~numpy.ndarray.view` except that the result will always be a new\n        `~astropy.uncertainty.Distribution` instance.  If the requested\n        ``type`` is a `~astropy.uncertainty.Distribution`, then no change in\n        ``dtype`` is allowed.\n\n        \"\"\"\n        if type is None and (isinstance(dtype, builtins.type)\n                             and issubclass(dtype, np.ndarray)):\n            type = dtype\n            dtype = None\n\n        view_args = [item for item in (dtype, type) if item is not None]\n\n        if type is None or (isinstance(type, builtins.type)\n                            and issubclass(type, Distribution)):\n            if dtype is not None and dtype != self.dtype:\n                raise ValueError('cannot view as Distribution subclass with a new dtype.')\n            return super().view(*view_args)\n\n        # View as the new non-Distribution class, but turn into a Distribution again.\n        result = self.distribution.view(*view_args)\n        return Distribution(result)\n\n    # Override __getitem__ so that 'samples' is returned as the sample class.\n    def __getitem__(self, item):\n        result = super().__getitem__(item)\n        if item == 'samples':\n            # Here, we need to avoid our own redefinition of view.\n            return super(ArrayDistribution, result).view(self._samples_cls)\n        elif isinstance(result, np.void):\n            return result.view((ScalarDistribution, result.dtype))\n        else:\n            return result"},{"col":4,"comment":"New view of array with the same data.\n\n        Like `~numpy.ndarray.view` except that the result will always be a new\n        `~astropy.uncertainty.Distribution` instance.  If the requested\n        ``type`` is a `~astropy.uncertainty.Distribution`, then no change in\n        ``dtype`` is allowed.\n\n        ","endLoc":301,"header":"def view(self, dtype=None, type=None)","id":15961,"name":"view","nodeType":"Function","startLoc":277,"text":"def view(self, dtype=None, type=None):\n        \"\"\"New view of array with the same data.\n\n        Like `~numpy.ndarray.view` except that the result will always be a new\n        `~astropy.uncertainty.Distribution` instance.  If the requested\n        ``type`` is a `~astropy.uncertainty.Distribution`, then no change in\n        ``dtype`` is allowed.\n\n        \"\"\"\n        if type is None and (isinstance(dtype, builtins.type)\n                             and issubclass(dtype, np.ndarray)):\n            type = dtype\n            dtype = None\n\n        view_args = [item for item in (dtype, type) if item is not None]\n\n        if type is None or (isinstance(type, builtins.type)\n                            and issubclass(type, Distribution)):\n            if dtype is not None and dtype != self.dtype:\n                raise ValueError('cannot view as Distribution subclass with a new dtype.')\n            return super().view(*view_args)\n\n        # View as the new non-Distribution class, but turn into a Distribution again.\n        result = self.distribution.view(*view_args)\n        return Distribution(result)"},{"col":4,"comment":"null","endLoc":312,"header":"def __getitem__(self, item)","id":15963,"name":"__getitem__","nodeType":"Function","startLoc":304,"text":"def __getitem__(self, item):\n        result = super().__getitem__(item)\n        if item == 'samples':\n            # Here, we need to avoid our own redefinition of view.\n            return super(ArrayDistribution, result).view(self._samples_cls)\n        elif isinstance(result, np.void):\n            return result.view((ScalarDistribution, result.dtype))\n        else:\n            return result"},{"col":0,"comment":"null","endLoc":203,"header":"@frame_transform_graph.transform(AffineTransform,\n                                 HeliocentricTrueEcliptic, ICRS)\ndef true_helioecliptic_to_icrs(from_coo, to_frame)","id":15964,"name":"true_helioecliptic_to_icrs","nodeType":"Function","startLoc":190,"text":"@frame_transform_graph.transform(AffineTransform,\n                                 HeliocentricTrueEcliptic, ICRS)\ndef true_helioecliptic_to_icrs(from_coo, to_frame):\n    if not u.m.is_equivalent(from_coo.cartesian.x.unit):\n        raise UnitsError(_NEED_ORIGIN_HINT.format(from_coo.__class__.__name__))\n\n    # first un-precess from ecliptic to ICRS orientation\n    rmat = _true_ecliptic_rotation_matrix(from_coo.equinox)\n\n    # now offset back to barycentric, which is the correct center for ICRS\n    sun_from_ssb = get_offset_sun_from_barycenter(from_coo.obstime,\n                                                  include_velocity=bool(from_coo.data.differentials))\n\n    return matrix_transpose(rmat), sun_from_ssb"},{"attributeType":"null","col":4,"comment":"null","endLoc":274,"id":15965,"name":"_samples_cls","nodeType":"Attribute","startLoc":274,"text":"_samples_cls"},{"className":"_DistributionRepr","col":0,"comment":"null","endLoc":340,"id":15966,"nodeType":"Class","startLoc":315,"text":"class _DistributionRepr:\n    def __repr__(self):\n        reprarr = repr(self.distribution)\n        if reprarr.endswith('>'):\n            firstspace = reprarr.find(' ')\n            reprarr = reprarr[firstspace+1:-1]  # :-1] removes the ending '>'\n            return '<{} {} with n_samples={}>'.format(self.__class__.__name__,\n                                                      reprarr, self.n_samples)\n        else:  # numpy array-like\n            firstparen = reprarr.find('(')\n            reprarr = reprarr[firstparen:]\n            return f'{self.__class__.__name__}{reprarr} with n_samples={self.n_samples}'\n            return reprarr\n\n    def __str__(self):\n        distrstr = str(self.distribution)\n        toadd = f' with n_samples={self.n_samples}'\n        return distrstr + toadd\n\n    def _repr_latex_(self):\n        if hasattr(self.distribution, '_repr_latex_'):\n            superlatex = self.distribution._repr_latex_()\n            toadd = fr', \\; n_{{\\rm samp}}={self.n_samples}'\n            return superlatex[:-1] + toadd + superlatex[-1]\n        else:\n            return None"},{"col":4,"comment":"null","endLoc":327,"header":"def __repr__(self)","id":15967,"name":"__repr__","nodeType":"Function","startLoc":316,"text":"def __repr__(self):\n        reprarr = repr(self.distribution)\n        if reprarr.endswith('>'):\n            firstspace = reprarr.find(' ')\n            reprarr = reprarr[firstspace+1:-1]  # :-1] removes the ending '>'\n            return '<{} {} with n_samples={}>'.format(self.__class__.__name__,\n                                                      reprarr, self.n_samples)\n        else:  # numpy array-like\n            firstparen = reprarr.find('(')\n            reprarr = reprarr[firstparen:]\n            return f'{self.__class__.__name__}{reprarr} with n_samples={self.n_samples}'\n            return reprarr"},{"className":"BaseStretch","col":0,"comment":"\n    Base class for the stretch classes, which, when called with an array\n    of values in the range [0:1], return an transformed array of values,\n    also in the range [0:1].\n    ","endLoc":85,"id":15968,"nodeType":"Class","startLoc":47,"text":"class BaseStretch(BaseTransform):\n    \"\"\"\n    Base class for the stretch classes, which, when called with an array\n    of values in the range [0:1], return an transformed array of values,\n    also in the range [0:1].\n    \"\"\"\n\n    @property\n    def _supports_invalid_kw(self):\n        return False\n\n    def __add__(self, other):\n        return CompositeStretch(other, self)\n\n    def __call__(self, values, clip=True, out=None):\n        \"\"\"\n        Transform values using this stretch.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values, which should already be normalized to the\n            [0:1] range.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        \"\"\"\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\""},{"col":4,"comment":"null","endLoc":332,"header":"def __str__(self)","id":15969,"name":"__str__","nodeType":"Function","startLoc":329,"text":"def __str__(self):\n        distrstr = str(self.distribution)\n        toadd = f' with n_samples={self.n_samples}'\n        return distrstr + toadd"},{"col":0,"comment":"\n    Create a Uniform distriution from the lower and upper bounds.\n\n    Note that this function requires keywords to be explicit, and requires\n    either ``lower``/``upper`` or ``center``/``width``.\n\n    Parameters\n    ----------\n    lower : array-like\n        The lower edge of this distribution. If a `~astropy.units.Quantity`, the\n        distribution will have the same units as ``lower``.\n    upper : `~astropy.units.Quantity`\n        The upper edge of this distribution. Must match shape and if a\n        `~astropy.units.Quantity` must have compatible units with ``lower``.\n    center : array-like\n        The center value of the distribution. Cannot be provided at the same\n        time as ``lower``/``upper``.\n    width : array-like\n        The width of the distribution.  Must have the same shape and compatible\n        units with ``center`` (if any).\n    n_samples : int\n        The number of Monte Carlo samples to use with this distribution\n    cls : class\n        The class to use to create this distribution.  Typically a\n        `Distribution` subclass.\n\n    Remaining keywords are passed into the constructor of the ``cls``\n\n    Returns\n    -------\n    distr : `~astropy.uncertainty.Distribution` or object\n        The sampled uniform distribution.\n        The type will be the same as the parameter ``cls``.\n    ","endLoc":183,"header":"def uniform(*, lower=None, upper=None, center=None, width=None, n_samples,\n            cls=Distribution, **kwargs)","id":15970,"name":"uniform","nodeType":"Function","startLoc":125,"text":"def uniform(*, lower=None, upper=None, center=None, width=None, n_samples,\n            cls=Distribution, **kwargs):\n    \"\"\"\n    Create a Uniform distriution from the lower and upper bounds.\n\n    Note that this function requires keywords to be explicit, and requires\n    either ``lower``/``upper`` or ``center``/``width``.\n\n    Parameters\n    ----------\n    lower : array-like\n        The lower edge of this distribution. If a `~astropy.units.Quantity`, the\n        distribution will have the same units as ``lower``.\n    upper : `~astropy.units.Quantity`\n        The upper edge of this distribution. Must match shape and if a\n        `~astropy.units.Quantity` must have compatible units with ``lower``.\n    center : array-like\n        The center value of the distribution. Cannot be provided at the same\n        time as ``lower``/``upper``.\n    width : array-like\n        The width of the distribution.  Must have the same shape and compatible\n        units with ``center`` (if any).\n    n_samples : int\n        The number of Monte Carlo samples to use with this distribution\n    cls : class\n        The class to use to create this distribution.  Typically a\n        `Distribution` subclass.\n\n    Remaining keywords are passed into the constructor of the ``cls``\n\n    Returns\n    -------\n    distr : `~astropy.uncertainty.Distribution` or object\n        The sampled uniform distribution.\n        The type will be the same as the parameter ``cls``.\n    \"\"\"\n    if center is None and width is None:\n        lower = np.asanyarray(lower)\n        upper = np.asanyarray(upper)\n        if lower.shape != upper.shape:\n            raise ValueError('lower and upper must have consistent shapes')\n    elif upper is None and lower is None:\n        center = np.asanyarray(center)\n        width = np.asanyarray(width)\n        lower = center - width/2\n        upper = center + width/2\n    else:\n        raise ValueError('either upper/lower or center/width must be given '\n                         'to uniform - other combinations are not valid')\n\n    newshape = lower.shape + (n_samples,)\n    if lower.shape == tuple() and upper.shape == tuple():\n        width = upper - lower  # scalar\n    else:\n        width = (upper - lower)[:, np.newaxis]\n        lower = lower[:, np.newaxis]\n    samples = lower + width * np.random.uniform(size=newshape)\n\n    return cls(samples, **kwargs)"},{"col":4,"comment":"null","endLoc":340,"header":"def _repr_latex_(self)","id":15971,"name":"_repr_latex_","nodeType":"Function","startLoc":334,"text":"def _repr_latex_(self):\n        if hasattr(self.distribution, '_repr_latex_'):\n            superlatex = self.distribution._repr_latex_()\n            toadd = fr', \\; n_{{\\rm samp}}={self.n_samples}'\n            return superlatex[:-1] + toadd + superlatex[-1]\n        else:\n            return None"},{"className":"NdarrayDistribution","col":0,"comment":"null","endLoc":344,"id":15972,"nodeType":"Class","startLoc":343,"text":"class NdarrayDistribution(_DistributionRepr, ArrayDistribution):\n    pass"},{"attributeType":"null","col":16,"comment":"null","endLoc":9,"id":15973,"name":"np","nodeType":"Attribute","startLoc":9,"text":"np"},{"attributeType":"null","col":29,"comment":"null","endLoc":11,"id":15974,"name":"u","nodeType":"Attribute","startLoc":11,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":15975,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":15976,"name":"SMAD_SCALE_FACTOR","nodeType":"Attribute","startLoc":19,"text":"SMAD_SCALE_FACTOR"},{"col":0,"comment":"","endLoc":6,"header":"core.py#<anonymous>","id":15977,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nDistribution class and associated machinery.\n\"\"\"\n\n__all__ = ['Distribution']\n\nSMAD_SCALE_FACTOR = 1.48260221850560203193936104071326553821563720703125\n\nDistribution._generated_subclasses[np.ndarray] = NdarrayDistribution"},{"col":4,"comment":"null","endLoc":56,"header":"@property\n    def _supports_invalid_kw(self)","id":15978,"name":"_supports_invalid_kw","nodeType":"Function","startLoc":54,"text":"@property\n    def _supports_invalid_kw(self):\n        return False"},{"col":4,"comment":"null","endLoc":59,"header":"def __add__(self, other)","id":15979,"name":"__add__","nodeType":"Function","startLoc":58,"text":"def __add__(self, other):\n        return CompositeStretch(other, self)"},{"attributeType":"null","col":16,"comment":"null","endLoc":9,"id":15980,"name":"np","nodeType":"Attribute","startLoc":9,"text":"np"},{"attributeType":"null","col":29,"comment":"null","endLoc":11,"id":15981,"name":"u","nodeType":"Attribute","startLoc":11,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":15982,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":74,"id":15983,"name":"COUNT_UNITS","nodeType":"Attribute","startLoc":74,"text":"COUNT_UNITS"},{"col":4,"comment":"Use the mapping to convert images image_r, image_g, and image_b to a triplet of uint8 images","endLoc":176,"header":"def _convert_images_to_uint8(self, image_r, image_g, image_b)","id":15984,"name":"_convert_images_to_uint8","nodeType":"Function","startLoc":146,"text":"def _convert_images_to_uint8(self, image_r, image_g, image_b):\n        \"\"\"Use the mapping to convert images image_r, image_g, and image_b to a triplet of uint8 images\"\"\"\n        image_r = image_r - self.minimum[0]  # n.b. makes copy\n        image_g = image_g - self.minimum[1]\n        image_b = image_b - self.minimum[2]\n\n        fac = self.map_intensity_to_uint8(self.intensity(image_r, image_g, image_b))\n\n        image_rgb = [image_r, image_g, image_b]\n        for c in image_rgb:\n            c *= fac\n            with np.errstate(invalid='ignore'):\n                c[c < 0] = 0                # individual bands can still be < 0, even if fac isn't\n\n        pixmax = self._uint8Max\n        r0, g0, b0 = image_rgb           # copies -- could work row by row to minimise memory usage\n\n        with np.errstate(invalid='ignore', divide='ignore'):  # n.b. np.where can't and doesn't short-circuit\n            for i, c in enumerate(image_rgb):\n                c = np.where(r0 > g0,\n                             np.where(r0 > b0,\n                                      np.where(r0 >= pixmax, c*pixmax/r0, c),\n                                      np.where(b0 >= pixmax, c*pixmax/b0, c)),\n                             np.where(g0 > b0,\n                                      np.where(g0 >= pixmax, c*pixmax/g0, c),\n                                      np.where(b0 >= pixmax, c*pixmax/b0, c))).astype(np.uint8)\n                c[c > pixmax] = pixmax\n\n                image_rgb[i] = c\n\n        return image_rgb"},{"col":4,"comment":"\n        Return the total intensity from the red, blue, and green intensities.\n        This is a naive computation, and may be overridden by subclasses.\n\n        Parameters\n        ----------\n        image_r : ndarray\n            Intensity of image to be mapped to red; or total intensity if\n            ``image_g`` and ``image_b`` are None.\n        image_g : ndarray, optional\n            Intensity of image to be mapped to green.\n        image_b : ndarray, optional\n            Intensity of image to be mapped to blue.\n\n        Returns\n        -------\n        intensity : ndarray\n            Total intensity from the red, blue and green intensities, or\n            ``image_r`` if green and blue images are not provided.\n        ","endLoc":123,"header":"def intensity(self, image_r, image_g, image_b)","id":15985,"name":"intensity","nodeType":"Function","startLoc":102,"text":"def intensity(self, image_r, image_g, image_b):\n        \"\"\"\n        Return the total intensity from the red, blue, and green intensities.\n        This is a naive computation, and may be overridden by subclasses.\n\n        Parameters\n        ----------\n        image_r : ndarray\n            Intensity of image to be mapped to red; or total intensity if\n            ``image_g`` and ``image_b`` are None.\n        image_g : ndarray, optional\n            Intensity of image to be mapped to green.\n        image_b : ndarray, optional\n            Intensity of image to be mapped to blue.\n\n        Returns\n        -------\n        intensity : ndarray\n            Total intensity from the red, blue and green intensities, or\n            ``image_r`` if green and blue images are not provided.\n        \"\"\"\n        return compute_intensity(image_r, image_g, image_b)"},{"fileName":"mpl_normalize.py","filePath":"astropy/visualization","id":15986,"nodeType":"File","text":"\"\"\"\nNormalization class for Matplotlib that can be used to produce\ncolorbars.\n\"\"\"\n\nimport inspect\n\nimport numpy as np\nfrom numpy import ma\n\nfrom .interval import (PercentileInterval, AsymmetricPercentileInterval,\n                       ManualInterval, MinMaxInterval, BaseInterval)\nfrom .stretch import (LinearStretch, SqrtStretch, PowerStretch, LogStretch,\n                      AsinhStretch, BaseStretch)\n\ntry:\n    import matplotlib  # pylint: disable=W0611\n    from matplotlib.colors import Normalize\n    from matplotlib import pyplot as plt\nexcept ImportError:\n    class Normalize:\n        def __init__(self, *args, **kwargs):\n            raise ImportError('matplotlib is required in order to use this '\n                              'class.')\n\n\n__all__ = ['ImageNormalize', 'simple_norm', 'imshow_norm']\n\n__doctest_requires__ = {'*': ['matplotlib']}\n\n\nclass ImageNormalize(Normalize):\n    \"\"\"\n    Normalization class to be used with Matplotlib.\n\n    Parameters\n    ----------\n    data : ndarray, optional\n        The image array.  This input is used only if ``interval`` is\n        also input.  ``data`` and ``interval`` are used to compute the\n        vmin and/or vmax values only if ``vmin`` or ``vmax`` are not\n        input.\n    interval : `~astropy.visualization.BaseInterval` subclass instance, optional\n        The interval object to apply to the input ``data`` to determine\n        the ``vmin`` and ``vmax`` values.  This input is used only if\n        ``data`` is also input.  ``data`` and ``interval`` are used to\n        compute the vmin and/or vmax values only if ``vmin`` or ``vmax``\n        are not input.\n    vmin, vmax : float, optional\n        The minimum and maximum levels to show for the data.  The\n        ``vmin`` and ``vmax`` inputs override any calculated values from\n        the ``interval`` and ``data`` inputs.\n    stretch : `~astropy.visualization.BaseStretch` subclass instance\n        The stretch object to apply to the data.  The default is\n        `~astropy.visualization.LinearStretch`.\n    clip : bool, optional\n        If `True`, data values outside the [0:1] range are clipped to\n        the [0:1] range.\n    invalid : None or float, optional\n        Value to assign NaN values generated by this class.  NaNs in the\n        input ``data`` array are not changed.  For matplotlib\n        normalization, the ``invalid`` value should map to the\n        matplotlib colormap \"under\" value (i.e., any finite value < 0).\n        If `None`, then NaN values are not replaced.  This keyword has\n        no effect if ``clip=True``.\n    \"\"\"\n\n    def __init__(self, data=None, interval=None, vmin=None, vmax=None,\n                 stretch=LinearStretch(), clip=False, invalid=-1.0):\n        # this super call checks for matplotlib\n        super().__init__(vmin=vmin, vmax=vmax, clip=clip)\n\n        self.vmin = vmin\n        self.vmax = vmax\n\n        if stretch is None:\n            raise ValueError('stretch must be input')\n        if not isinstance(stretch, BaseStretch):\n            raise TypeError('stretch must be an instance of a BaseStretch '\n                            'subclass')\n        self.stretch = stretch\n\n        if interval is not None and not isinstance(interval, BaseInterval):\n            raise TypeError('interval must be an instance of a BaseInterval '\n                            'subclass')\n        self.interval = interval\n\n        self.inverse_stretch = stretch.inverse\n        self.clip = clip\n        self.invalid = invalid\n\n        # Define vmin and vmax if not None and data was input\n        if data is not None:\n            self._set_limits(data)\n\n    def _set_limits(self, data):\n        if self.vmin is not None and self.vmax is not None:\n            return\n\n        # Define vmin and vmax from the interval class if not None\n        if self.interval is None:\n            if self.vmin is None:\n                self.vmin = np.min(data[np.isfinite(data)])\n            if self.vmax is None:\n                self.vmax = np.max(data[np.isfinite(data)])\n        else:\n            _vmin, _vmax = self.interval.get_limits(data)\n            if self.vmin is None:\n                self.vmin = _vmin\n            if self.vmax is None:\n                self.vmax = _vmax\n\n    def __call__(self, values, clip=None, invalid=None):\n        \"\"\"\n        Transform values using this normalization.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values.\n        clip : bool, optional\n            If `True`, values outside the [0:1] range are clipped to the\n            [0:1] range.  If `None` then the ``clip`` value from the\n            `ImageNormalize` instance is used (the default of which is\n            `False`).\n        invalid : None or float, optional\n            Value to assign NaN values generated by this class.  NaNs in\n            the input ``data`` array are not changed.  For matplotlib\n            normalization, the ``invalid`` value should map to the\n            matplotlib colormap \"under\" value (i.e., any finite value <\n            0).  If `None`, then the `ImageNormalize` instance value is\n            used.  This keyword has no effect if ``clip=True``.\n        \"\"\"\n\n        if clip is None:\n            clip = self.clip\n\n        if invalid is None:\n            invalid = self.invalid\n\n        if isinstance(values, ma.MaskedArray):\n            if clip:\n                mask = False\n            else:\n                mask = values.mask\n            values = values.filled(self.vmax)\n        else:\n            mask = False\n\n        # Make sure scalars get broadcast to 1-d\n        if np.isscalar(values):\n            values = np.array([values], dtype=float)\n        else:\n            # copy because of in-place operations after\n            values = np.array(values, copy=True, dtype=float)\n\n        # Define vmin and vmax if not None\n        self._set_limits(values)\n\n        # Normalize based on vmin and vmax\n        np.subtract(values, self.vmin, out=values)\n        np.true_divide(values, self.vmax - self.vmin, out=values)\n\n        # Clip to the 0 to 1 range\n        if clip:\n            values = np.clip(values, 0., 1., out=values)\n\n        # Stretch values\n        if self.stretch._supports_invalid_kw:\n            values = self.stretch(values, out=values, clip=False,\n                                  invalid=invalid)\n        else:\n            values = self.stretch(values, out=values, clip=False)\n\n        # Convert to masked array for matplotlib\n        return ma.array(values, mask=mask)\n\n    def inverse(self, values, invalid=None):\n        # Find unstretched values in range 0 to 1\n        if self.inverse_stretch._supports_invalid_kw:\n            values_norm = self.inverse_stretch(values, clip=False,\n                                               invalid=invalid)\n        else:\n            values_norm = self.inverse_stretch(values, clip=False)\n\n        # Scale to original range\n        return values_norm * (self.vmax - self.vmin) + self.vmin\n\n\ndef simple_norm(data, stretch='linear', power=1.0, asinh_a=0.1, min_cut=None,\n                max_cut=None, min_percent=None, max_percent=None,\n                percent=None, clip=False, log_a=1000, invalid=-1.0):\n    \"\"\"\n    Return a Normalization class that can be used for displaying images\n    with Matplotlib.\n\n    This function enables only a subset of image stretching functions\n    available in `~astropy.visualization.mpl_normalize.ImageNormalize`.\n\n    This function is used by the\n    ``astropy.visualization.scripts.fits2bitmap`` script.\n\n    Parameters\n    ----------\n    data : ndarray\n        The image array.\n\n    stretch : {'linear', 'sqrt', 'power', log', 'asinh'}, optional\n        The stretch function to apply to the image.  The default is\n        'linear'.\n\n    power : float, optional\n        The power index for ``stretch='power'``.  The default is 1.0.\n\n    asinh_a : float, optional\n        For ``stretch='asinh'``, the value where the asinh curve\n        transitions from linear to logarithmic behavior, expressed as a\n        fraction of the normalized image.  Must be in the range between\n        0 and 1.  The default is 0.1.\n\n    min_cut : float, optional\n        The pixel value of the minimum cut level.  Data values less than\n        ``min_cut`` will set to ``min_cut`` before stretching the image.\n        The default is the image minimum.  ``min_cut`` overrides\n        ``min_percent``.\n\n    max_cut : float, optional\n        The pixel value of the maximum cut level.  Data values greater\n        than ``min_cut`` will set to ``min_cut`` before stretching the\n        image.  The default is the image maximum.  ``max_cut`` overrides\n        ``max_percent``.\n\n    min_percent : float, optional\n        The percentile value used to determine the pixel value of\n        minimum cut level.  The default is 0.0.  ``min_percent``\n        overrides ``percent``.\n\n    max_percent : float, optional\n        The percentile value used to determine the pixel value of\n        maximum cut level.  The default is 100.0.  ``max_percent``\n        overrides ``percent``.\n\n    percent : float, optional\n        The percentage of the image values used to determine the pixel\n        values of the minimum and maximum cut levels.  The lower cut\n        level will set at the ``(100 - percent) / 2`` percentile, while\n        the upper cut level will be set at the ``(100 + percent) / 2``\n        percentile.  The default is 100.0.  ``percent`` is ignored if\n        either ``min_percent`` or ``max_percent`` is input.\n\n    clip : bool, optional\n        If `True`, data values outside the [0:1] range are clipped to\n        the [0:1] range.\n\n    log_a : float, optional\n        The log index for ``stretch='log'``. The default is 1000.\n\n    invalid : None or float, optional\n        Value to assign NaN values generated by the normalization.  NaNs\n        in the input ``data`` array are not changed.  For matplotlib\n        normalization, the ``invalid`` value should map to the\n        matplotlib colormap \"under\" value (i.e., any finite value < 0).\n        If `None`, then NaN values are not replaced.  This keyword has\n        no effect if ``clip=True``.\n\n    Returns\n    -------\n    result : `ImageNormalize` instance\n        An `ImageNormalize` instance that can be used for displaying\n        images with Matplotlib.\n    \"\"\"\n\n    if percent is not None:\n        interval = PercentileInterval(percent)\n    elif min_percent is not None or max_percent is not None:\n        interval = AsymmetricPercentileInterval(min_percent or 0.,\n                                                max_percent or 100.)\n    elif min_cut is not None or max_cut is not None:\n        interval = ManualInterval(min_cut, max_cut)\n    else:\n        interval = MinMaxInterval()\n\n    if stretch == 'linear':\n        stretch = LinearStretch()\n    elif stretch == 'sqrt':\n        stretch = SqrtStretch()\n    elif stretch == 'power':\n        stretch = PowerStretch(power)\n    elif stretch == 'log':\n        stretch = LogStretch(log_a)\n    elif stretch == 'asinh':\n        stretch = AsinhStretch(asinh_a)\n    else:\n        raise ValueError(f'Unknown stretch: {stretch}.')\n\n    vmin, vmax = interval.get_limits(data)\n\n    return ImageNormalize(vmin=vmin, vmax=vmax, stretch=stretch, clip=clip,\n                          invalid=invalid)\n\n\n# used in imshow_norm\n_norm_sig = inspect.signature(ImageNormalize)\n\n\ndef imshow_norm(data, ax=None, **kwargs):\n    \"\"\" A convenience function to call matplotlib's `matplotlib.pyplot.imshow`\n    function, using an `ImageNormalize` object as the normalization.\n\n    Parameters\n    ----------\n    data : 2D or 3D array-like\n        The data to show. Can be whatever `~matplotlib.pyplot.imshow` and\n        `ImageNormalize` both accept. See `~matplotlib.pyplot.imshow`.\n    ax : None or `~matplotlib.axes.Axes`, optional\n        If None, use pyplot's imshow.  Otherwise, calls ``imshow`` method of\n        the supplied axes.\n    **kwargs : dict, optional\n        All other keyword arguments are parsed first by the\n        `ImageNormalize` initializer, then to\n        `~matplotlib.pyplot.imshow`.\n\n    Returns\n    -------\n    result : tuple\n        A tuple containing the `~matplotlib.image.AxesImage` generated\n        by `~matplotlib.pyplot.imshow` as well as the `ImageNormalize`\n        instance.\n\n    Notes\n    -----\n    The ``norm`` matplotlib keyword is not supported.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n        from astropy.visualization import (imshow_norm, MinMaxInterval,\n                                           SqrtStretch)\n\n        # Generate and display a test image\n        image = np.arange(65536).reshape((256, 256))\n        fig = plt.figure()\n        ax = fig.add_subplot(1, 1, 1)\n        im, norm = imshow_norm(image, ax, origin='lower',\n                               interval=MinMaxInterval(),\n                               stretch=SqrtStretch())\n        fig.colorbar(im)\n    \"\"\"\n    if 'X' in kwargs:\n        raise ValueError('Cannot give both ``X`` and ``data``')\n\n    if 'norm' in kwargs:\n        raise ValueError('There is no point in using imshow_norm if you give '\n                         'the ``norm`` keyword - use imshow directly if you '\n                         'want that.')\n\n    imshow_kwargs = dict(kwargs)\n\n    norm_kwargs = {'data': data}\n    for pname in _norm_sig.parameters:\n        if pname in kwargs:\n            norm_kwargs[pname] = imshow_kwargs.pop(pname)\n\n    imshow_kwargs['norm'] = ImageNormalize(**norm_kwargs)\n\n    if ax is None:\n        imshow_result = plt.imshow(data, **imshow_kwargs)\n    else:\n        imshow_result = ax.imshow(data, **imshow_kwargs)\n\n    return imshow_result, imshow_kwargs['norm']\n"},{"col":0,"comment":"\n    Return a naive total intensity from the red, blue, and green intensities.\n\n    Parameters\n    ----------\n    image_r : ndarray\n        Intensity of image to be mapped to red; or total intensity if ``image_g``\n        and ``image_b`` are None.\n    image_g : ndarray, optional\n        Intensity of image to be mapped to green.\n    image_b : ndarray, optional\n        Intensity of image to be mapped to blue.\n\n    Returns\n    -------\n    intensity : ndarray\n        Total intensity from the red, blue and green intensities, or ``image_r``\n        if green and blue images are not provided.\n    ","endLoc":46,"header":"def compute_intensity(image_r, image_g=None, image_b=None)","id":15987,"name":"compute_intensity","nodeType":"Function","startLoc":17,"text":"def compute_intensity(image_r, image_g=None, image_b=None):\n    \"\"\"\n    Return a naive total intensity from the red, blue, and green intensities.\n\n    Parameters\n    ----------\n    image_r : ndarray\n        Intensity of image to be mapped to red; or total intensity if ``image_g``\n        and ``image_b`` are None.\n    image_g : ndarray, optional\n        Intensity of image to be mapped to green.\n    image_b : ndarray, optional\n        Intensity of image to be mapped to blue.\n\n    Returns\n    -------\n    intensity : ndarray\n        Total intensity from the red, blue and green intensities, or ``image_r``\n        if green and blue images are not provided.\n    \"\"\"\n    if image_g is None or image_b is None:\n        if not (image_g is None and image_b is None):\n            raise ValueError(\"please specify either a single image \"\n                             \"or red, green, and blue images.\")\n        return image_r\n\n    intensity = (image_r + image_g + image_b)/3.0\n\n    # Repack into whatever type was passed to us\n    return np.asarray(intensity, dtype=image_r.dtype)"},{"col":4,"comment":"\n        Return an array which, when multiplied by an image, returns that image\n        mapped to the range of a uint8, [0, 255] (but not converted to uint8).\n\n        The intensity is assumed to have had minimum subtracted (as that can be\n        done per-band).\n\n        Parameters\n        ----------\n        I : ndarray\n            Intensity to be mapped.\n\n        Returns\n        -------\n        mapped_I : ndarray\n            ``I`` mapped to uint8\n        ","endLoc":144,"header":"def map_intensity_to_uint8(self, I)","id":15988,"name":"map_intensity_to_uint8","nodeType":"Function","startLoc":125,"text":"def map_intensity_to_uint8(self, I):\n        \"\"\"\n        Return an array which, when multiplied by an image, returns that image\n        mapped to the range of a uint8, [0, 255] (but not converted to uint8).\n\n        The intensity is assumed to have had minimum subtracted (as that can be\n        done per-band).\n\n        Parameters\n        ----------\n        I : ndarray\n            Intensity to be mapped.\n\n        Returns\n        -------\n        mapped_I : ndarray\n            ``I`` mapped to uint8\n        \"\"\"\n        with np.errstate(invalid='ignore', divide='ignore'):\n            return np.clip(I, 0, self._uint8Max)"},{"attributeType":"null","col":8,"comment":"null","endLoc":62,"id":15989,"name":"_uint8Max","nodeType":"Attribute","startLoc":62,"text":"self._uint8Max"},{"attributeType":"null","col":8,"comment":"null","endLoc":72,"id":15990,"name":"_image","nodeType":"Attribute","startLoc":72,"text":"self._image"},{"col":4,"comment":"\n        Transform values using this stretch.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values, which should already be normalized to the\n            [0:1] range.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        ","endLoc":81,"header":"def __call__(self, values, clip=True, out=None)","id":15991,"name":"__call__","nodeType":"Function","startLoc":61,"text":"def __call__(self, values, clip=True, out=None):\n        \"\"\"\n        Transform values using this stretch.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values, which should already be normalized to the\n            [0:1] range.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        \"\"\""},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":85,"header":"@property\n    def inverse(self)","id":15992,"name":"inverse","nodeType":"Function","startLoc":83,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\""},{"className":"LinearStretch","col":0,"comment":"\n    A linear stretch with a slope and offset.\n\n    The stretch is given by:\n\n    .. math::\n        y = slope x + intercept\n\n    Parameters\n    ----------\n    slope : float, optional\n        The ``slope`` parameter used in the above formula.  Default is 1.\n    intercept : float, optional\n        The ``intercept`` parameter used in the above formula.  Default is 0.\n    ","endLoc":121,"id":15993,"nodeType":"Class","startLoc":88,"text":"class LinearStretch(BaseStretch):\n    \"\"\"\n    A linear stretch with a slope and offset.\n\n    The stretch is given by:\n\n    .. math::\n        y = slope x + intercept\n\n    Parameters\n    ----------\n    slope : float, optional\n        The ``slope`` parameter used in the above formula.  Default is 1.\n    intercept : float, optional\n        The ``intercept`` parameter used in the above formula.  Default is 0.\n    \"\"\"\n\n    def __init__(self, slope=1, intercept=0):\n        super().__init__()\n        self.slope = slope\n        self.intercept = intercept\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        if self.slope != 1:\n            np.multiply(values, self.slope, out=values)\n        if self.intercept != 0:\n            np.add(values, self.intercept, out=values)\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return LinearStretch(1. / self.slope, - self.intercept / self.slope)"},{"col":4,"comment":"null","endLoc":108,"header":"def __init__(self, slope=1, intercept=0)","id":15994,"name":"__init__","nodeType":"Function","startLoc":105,"text":"def __init__(self, slope=1, intercept=0):\n        super().__init__()\n        self.slope = slope\n        self.intercept = intercept"},{"attributeType":"null","col":8,"comment":"null","endLoc":71,"id":15995,"name":"minimum","nodeType":"Attribute","startLoc":71,"text":"self.minimum"},{"col":4,"comment":"null","endLoc":116,"header":"def __call__(self, values, clip=True, out=None)","id":15996,"name":"__call__","nodeType":"Function","startLoc":110,"text":"def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        if self.slope != 1:\n            np.multiply(values, self.slope, out=values)\n        if self.intercept != 0:\n            np.add(values, self.intercept, out=values)\n        return values"},{"col":0,"comment":"null","endLoc":219,"header":"@frame_transform_graph.transform(AffineTransform,\n                                 HeliocentricEclipticIAU76, ICRS)\ndef ecliptic_to_iau76_icrs(from_coo, to_frame)","id":15997,"name":"ecliptic_to_iau76_icrs","nodeType":"Function","startLoc":209,"text":"@frame_transform_graph.transform(AffineTransform,\n                                 HeliocentricEclipticIAU76, ICRS)\ndef ecliptic_to_iau76_icrs(from_coo, to_frame):\n    # first un-precess from ecliptic to ICRS orientation\n    rmat = _obliquity_only_rotation_matrix()\n\n    # now offset back to barycentric, which is the correct center for ICRS\n    sun_from_ssb = get_offset_sun_from_barycenter(from_coo.obstime,\n                                                  include_velocity=bool(from_coo.data.differentials))\n\n    return matrix_transpose(rmat), sun_from_ssb"},{"col":0,"comment":"","endLoc":6,"header":"distributions.py#<anonymous>","id":15998,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nBuilt-in distribution-creation functions.\n\"\"\"\n\n__all__ = ['normal', 'poisson', 'uniform']\n\nCOUNT_UNITS = (u.count, u.electron, u.dimensionless_unscaled, u.chan, u.bin, u.vox, u.bit, u.byte)"},{"fileName":"time.py","filePath":"astropy/visualization","id":15999,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport numpy as np\n\nfrom datetime import datetime\n\nfrom astropy.time import Time\nfrom astropy import units as u\n\n__all__ = ['time_support']\n\n__doctest_requires__ = {'time_support': ['matplotlib']}\n\nUNSUPPORTED_FORMATS = ('datetime', 'datetime64')\nYMDHMS_FORMATS = ('fits', 'iso', 'isot', 'yday')\nSTR_FORMATS = YMDHMS_FORMATS + ('byear_str', 'jyear_str')\n\n\ndef time_support(*, scale=None, format=None, simplify=True):\n    \"\"\"\n    Enable support for plotting `astropy.time.Time` instances in\n    matplotlib.\n\n    May be (optionally) used with a ``with`` statement.\n\n      >>> import matplotlib.pyplot as plt\n      >>> from astropy import units as u\n      >>> from astropy import visualization\n      >>> with visualization.time_support():  # doctest: +IGNORE_OUTPUT\n      ...     plt.figure()\n      ...     plt.plot(Time(['2016-03-22T12:30:31', '2016-03-22T12:30:38', '2016-03-22T12:34:40']))\n      ...     plt.draw()\n\n    Parameters\n    ----------\n    scale : str, optional\n        The time scale to use for the times on the axis. If not specified,\n        the scale of the first Time object passed to Matplotlib is used.\n    format : str, optional\n        The time format to use for the times on the axis. If not specified,\n        the format of the first Time object passed to Matplotlib is used.\n    simplify : bool, optional\n        If possible, simplify labels, e.g. by removing 00:00:00.000 times from\n        ISO strings if all labels fall on that time.\n    \"\"\"\n\n    import matplotlib.units as units\n    from matplotlib.ticker import MaxNLocator, ScalarFormatter\n    from astropy.visualization.wcsaxes.utils import select_step_hour, select_step_scalar\n\n    class AstropyTimeLocator(MaxNLocator):\n\n        # Note: we default to AutoLocator since many time formats\n        # can just use this.\n\n        def __init__(self, converter, *args, **kwargs):\n            kwargs['nbins'] = 4\n            super().__init__(*args, **kwargs)\n            self._converter = converter\n\n        def tick_values(self, vmin, vmax):\n\n            # Where we put the ticks depends on the format we are using\n            if self._converter.format in YMDHMS_FORMATS:\n\n                # If we are here, we need to check what the range of values\n                # is and decide how to find tick locations accordingly\n\n                vrange = vmax - vmin\n\n                if (self._converter.format != 'yday' and vrange > 31) or vrange > 366:  # greater than a month\n\n                    # We need to be careful here since not all years and months have\n                    # the same length\n\n                    # Start off by converting the values from the range to\n                    # datetime objects, so that we can easily extract the year and\n                    # month.\n\n                    tmin = Time(vmin, scale=self._converter.scale, format='mjd').datetime\n                    tmax = Time(vmax, scale=self._converter.scale, format='mjd').datetime\n\n                    # Find the range of years\n                    ymin = tmin.year\n                    ymax = tmax.year\n\n                    if ymax > ymin + 1:  # greater than a year\n\n                        # Find the step we want to use\n                        ystep = int(select_step_scalar(max(1, (ymax - ymin) / 3)))\n\n                        ymin = ystep * (ymin // ystep)\n\n                        # Generate the years for these steps\n                        times = []\n                        for year in range(ymin, ymax + 1, ystep):\n                            times.append(datetime(year=year, month=1, day=1))\n\n                    else:  # greater than a month but less than a year\n\n                        mmin = tmin.month\n                        mmax = tmax.month + 12 * (ymax - ymin)\n\n                        mstep = int(select_step_scalar(max(1, (mmax - mmin) / 3)))\n\n                        mmin = mstep * max(1, mmin // mstep)\n\n                        # Generate the months for these steps\n                        times = []\n                        for month in range(mmin, mmax + 1, mstep):\n                            times.append(datetime(year=ymin + (month - 1) // 12,\n                                                  month=(month - 1) % 12 + 1,\n                                                  day=1))\n\n                    # Convert back to MJD\n                    values = Time(times, scale=self._converter.scale).mjd\n\n                elif vrange > 1:  # greater than a day\n\n                    self.set_params(steps=[1, 2, 5, 10])\n                    values = super().tick_values(vmin, vmax)\n\n                else:\n\n                    # Determine ideal step\n                    dv = (vmax - vmin) / 3 * 24 << u.hourangle\n\n                    # And round to nearest sensible value\n                    dv = select_step_hour(dv).to_value(u.hourangle) / 24\n\n                    # Determine tick locations\n                    imin = np.ceil(vmin / dv)\n                    imax = np.floor(vmax / dv)\n                    values = np.arange(imin, imax + 1, dtype=np.int64) * dv\n\n            else:\n\n                values = super().tick_values(vmin, vmax)\n\n            # Get rid of values outside of the input interval\n            values = values[(values >= vmin) & (values <= vmax)]\n\n            return values\n\n        def __call__(self):\n            vmin, vmax = self.axis.get_view_interval()\n            return self.tick_values(vmin, vmax)\n\n    class AstropyTimeFormatter(ScalarFormatter):\n\n        def __init__(self, converter, *args, **kwargs):\n            super().__init__(*args, **kwargs)\n            self._converter = converter\n            self.set_useOffset(False)\n            self.set_scientific(False)\n\n        def __call__(self, value, pos=None):\n            # Needed for Matplotlib <3.1\n            if self._converter.format in STR_FORMATS:\n                return self.format_ticks([value])[0]\n            else:\n                return super().__call__(value, pos=pos)\n\n        def format_ticks(self, values):\n            if len(values) == 0:\n                return []\n            if self._converter.format in YMDHMS_FORMATS:\n                times = Time(values, format='mjd', scale=self._converter.scale)\n                formatted = getattr(times, self._converter.format)\n                if self._converter.simplify:\n                    if self._converter.format in ('fits', 'iso', 'isot'):\n                        if all([x.endswith('00:00:00.000') for x in formatted]):\n                            split = ' ' if self._converter.format == 'iso' else 'T'\n                            formatted = [x.split(split)[0] for x in formatted]\n                    elif self._converter.format == 'yday':\n                        if all([x.endswith(':001:00:00:00.000') for x in formatted]):\n                            formatted = [x.split(':', 1)[0] for x in formatted]\n                return formatted\n            elif self._converter.format == 'byear_str':\n                return Time(values, format='byear', scale=self._converter.scale).byear_str\n            elif self._converter.format == 'jyear_str':\n                return Time(values, format='jyear', scale=self._converter.scale).jyear_str\n            else:\n                return super().format_ticks(values)\n\n    class MplTimeConverter(units.ConversionInterface):\n\n        def __init__(self, scale=None, format=None, simplify=None):\n\n            super().__init__()\n\n            self.format = format\n            self.scale = scale\n            self.simplify = simplify\n\n            # Keep track of original converter in case the context manager is\n            # used in a nested way.\n            self._original_converter = units.registry.get(Time)\n\n            units.registry[Time] = self\n\n        @property\n        def format(self):\n            return self._format\n\n        @format.setter\n        def format(self, value):\n            if value in UNSUPPORTED_FORMATS:\n                raise ValueError(f'time_support does not support format={value}')\n            self._format = value\n\n        def __enter__(self):\n            return self\n\n        def __exit__(self, type, value, tb):\n            if self._original_converter is None:\n                del units.registry[Time]\n            else:\n                units.registry[Time] = self._original_converter\n\n        def default_units(self, x, axis):\n            if isinstance(x, tuple):\n                x = x[0]\n            if self.format is None:\n                self.format = x.format\n            if self.scale is None:\n                self.scale = x.scale\n            return 'astropy_time'\n\n        def convert(self, value, unit, axis):\n            \"\"\"\n            Convert a Time value to a scalar or array.\n            \"\"\"\n            scaled = getattr(value, self.scale)\n            if self.format in YMDHMS_FORMATS:\n                return scaled.mjd\n            elif self.format == 'byear_str':\n                return scaled.byear\n            elif self.format == 'jyear_str':\n                return scaled.jyear\n            else:\n                return getattr(scaled, self.format)\n\n        def axisinfo(self, unit, axis):\n            \"\"\"\n            Return major and minor tick locators and formatters.\n            \"\"\"\n            majloc = AstropyTimeLocator(self)\n            majfmt = AstropyTimeFormatter(self)\n            return units.AxisInfo(majfmt=majfmt,\n                                  majloc=majloc,\n                                  label=f'Time ({self.scale})')\n\n    return MplTimeConverter(scale=scale, format=format, simplify=simplify)\n"},{"col":0,"comment":"\n    Prepare the data by optionally clipping and copying, and return the\n    array that should be subsequently used for in-place calculations.\n    ","endLoc":44,"header":"def _prepare(values, clip=True, out=None)","id":16000,"name":"_prepare","nodeType":"Function","startLoc":31,"text":"def _prepare(values, clip=True, out=None):\n    \"\"\"\n    Prepare the data by optionally clipping and copying, and return the\n    array that should be subsequently used for in-place calculations.\n    \"\"\"\n\n    if clip:\n        return np.clip(values, 0., 1., out=out)\n    else:\n        if out is None:\n            return np.array(values, copy=True)\n        else:\n            out[:] = np.asarray(values)\n            return out"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":16002,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":7,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":4,"header":"units.py#<anonymous>","id":16003,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__doctest_skip__ = ['quantity_support']"},{"className":"SqrtStretch","col":0,"comment":"\n    A square root stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\sqrt{x}\n    ","endLoc":185,"id":16004,"nodeType":"Class","startLoc":124,"text":"class SqrtStretch(BaseStretch):\n    r\"\"\"\n    A square root stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\sqrt{x}\n    \"\"\"\n\n    @property\n    def _supports_invalid_kw(self):\n        return True\n\n    def __call__(self, values, clip=True, out=None, invalid=None):\n        \"\"\"\n        Transform values using this stretch.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values, which should already be normalized to the\n            [0:1] range.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n        invalid : None or float, optional\n            Value to assign NaN values generated by this class.  NaNs in\n            the input ``values`` array are not changed.  This option is\n            generally used with matplotlib normalization classes, where\n            the ``invalid`` value should map to the matplotlib colormap\n            \"under\" value (i.e., any finite value < 0).  If `None`, then\n            NaN values are not replaced.  This keyword has no effect if\n            ``clip=True``.\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        \"\"\"\n\n        values = _prepare(values, clip=clip, out=out)\n        replace_invalid = not clip and invalid is not None\n        with np.errstate(invalid='ignore'):\n            if replace_invalid:\n                idx = (values < 0)\n            np.sqrt(values, out=values)\n\n        if replace_invalid:\n            # Assign new NaN (i.e., NaN not in the original input\n            # values, but generated by this class) to the invalid value.\n            values[idx] = invalid\n\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return PowerStretch(2)"},{"col":4,"comment":"null","endLoc":136,"header":"@property\n    def _supports_invalid_kw(self)","id":16005,"name":"_supports_invalid_kw","nodeType":"Function","startLoc":134,"text":"@property\n    def _supports_invalid_kw(self):\n        return True"},{"col":4,"comment":"\n        Transform values using this stretch.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values, which should already be normalized to the\n            [0:1] range.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n        invalid : None or float, optional\n            Value to assign NaN values generated by this class.  NaNs in\n            the input ``values`` array are not changed.  This option is\n            generally used with matplotlib normalization classes, where\n            the ``invalid`` value should map to the matplotlib colormap\n            \"under\" value (i.e., any finite value < 0).  If `None`, then\n            NaN values are not replaced.  This keyword has no effect if\n            ``clip=True``.\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        ","endLoc":180,"header":"def __call__(self, values, clip=True, out=None, invalid=None)","id":16006,"name":"__call__","nodeType":"Function","startLoc":138,"text":"def __call__(self, values, clip=True, out=None, invalid=None):\n        \"\"\"\n        Transform values using this stretch.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values, which should already be normalized to the\n            [0:1] range.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n        invalid : None or float, optional\n            Value to assign NaN values generated by this class.  NaNs in\n            the input ``values`` array are not changed.  This option is\n            generally used with matplotlib normalization classes, where\n            the ``invalid`` value should map to the matplotlib colormap\n            \"under\" value (i.e., any finite value < 0).  If `None`, then\n            NaN values are not replaced.  This keyword has no effect if\n            ``clip=True``.\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        \"\"\"\n\n        values = _prepare(values, clip=clip, out=out)\n        replace_invalid = not clip and invalid is not None\n        with np.errstate(invalid='ignore'):\n            if replace_invalid:\n                idx = (values < 0)\n            np.sqrt(values, out=values)\n\n        if replace_invalid:\n            # Assign new NaN (i.e., NaN not in the original input\n            # values, but generated by this class) to the invalid value.\n            values[idx] = invalid\n\n        return values"},{"id":16007,"name":"astropy/visualization/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/visualization/tests","id":16008,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":185,"header":"@property\n    def inverse(self)","id":16009,"name":"inverse","nodeType":"Function","startLoc":182,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return PowerStretch(2)"},{"col":0,"comment":"null","endLoc":232,"header":"@frame_transform_graph.transform(AffineTransform,\n                                 ICRS, HeliocentricEclipticIAU76)\ndef icrs_to_iau76_ecliptic(from_coo, to_frame)","id":16010,"name":"icrs_to_iau76_ecliptic","nodeType":"Function","startLoc":222,"text":"@frame_transform_graph.transform(AffineTransform,\n                                 ICRS, HeliocentricEclipticIAU76)\ndef icrs_to_iau76_ecliptic(from_coo, to_frame):\n    # get the offset of the barycenter from the Sun\n    ssb_from_sun = get_offset_sun_from_barycenter(to_frame.obstime, reverse=True,\n                                                  include_velocity=bool(from_coo.data.differentials))\n\n    # now compute the matrix to precess to the right orientation\n    rmat = _obliquity_only_rotation_matrix()\n\n    return rmat, ssb_from_sun.transform(rmat)"},{"col":0,"comment":"\n    Enable support for plotting `astropy.time.Time` instances in\n    matplotlib.\n\n    May be (optionally) used with a ``with`` statement.\n\n      >>> import matplotlib.pyplot as plt\n      >>> from astropy import units as u\n      >>> from astropy import visualization\n      >>> with visualization.time_support():  # doctest: +IGNORE_OUTPUT\n      ...     plt.figure()\n      ...     plt.plot(Time(['2016-03-22T12:30:31', '2016-03-22T12:30:38', '2016-03-22T12:34:40']))\n      ...     plt.draw()\n\n    Parameters\n    ----------\n    scale : str, optional\n        The time scale to use for the times on the axis. If not specified,\n        the scale of the first Time object passed to Matplotlib is used.\n    format : str, optional\n        The time format to use for the times on the axis. If not specified,\n        the format of the first Time object passed to Matplotlib is used.\n    simplify : bool, optional\n        If possible, simplify labels, e.g. by removing 00:00:00.000 times from\n        ISO strings if all labels fall on that time.\n    ","endLoc":255,"header":"def time_support(*, scale=None, format=None, simplify=True)","id":16011,"name":"time_support","nodeType":"Function","startLoc":20,"text":"def time_support(*, scale=None, format=None, simplify=True):\n    \"\"\"\n    Enable support for plotting `astropy.time.Time` instances in\n    matplotlib.\n\n    May be (optionally) used with a ``with`` statement.\n\n      >>> import matplotlib.pyplot as plt\n      >>> from astropy import units as u\n      >>> from astropy import visualization\n      >>> with visualization.time_support():  # doctest: +IGNORE_OUTPUT\n      ...     plt.figure()\n      ...     plt.plot(Time(['2016-03-22T12:30:31', '2016-03-22T12:30:38', '2016-03-22T12:34:40']))\n      ...     plt.draw()\n\n    Parameters\n    ----------\n    scale : str, optional\n        The time scale to use for the times on the axis. If not specified,\n        the scale of the first Time object passed to Matplotlib is used.\n    format : str, optional\n        The time format to use for the times on the axis. If not specified,\n        the format of the first Time object passed to Matplotlib is used.\n    simplify : bool, optional\n        If possible, simplify labels, e.g. by removing 00:00:00.000 times from\n        ISO strings if all labels fall on that time.\n    \"\"\"\n\n    import matplotlib.units as units\n    from matplotlib.ticker import MaxNLocator, ScalarFormatter\n    from astropy.visualization.wcsaxes.utils import select_step_hour, select_step_scalar\n\n    class AstropyTimeLocator(MaxNLocator):\n\n        # Note: we default to AutoLocator since many time formats\n        # can just use this.\n\n        def __init__(self, converter, *args, **kwargs):\n            kwargs['nbins'] = 4\n            super().__init__(*args, **kwargs)\n            self._converter = converter\n\n        def tick_values(self, vmin, vmax):\n\n            # Where we put the ticks depends on the format we are using\n            if self._converter.format in YMDHMS_FORMATS:\n\n                # If we are here, we need to check what the range of values\n                # is and decide how to find tick locations accordingly\n\n                vrange = vmax - vmin\n\n                if (self._converter.format != 'yday' and vrange > 31) or vrange > 366:  # greater than a month\n\n                    # We need to be careful here since not all years and months have\n                    # the same length\n\n                    # Start off by converting the values from the range to\n                    # datetime objects, so that we can easily extract the year and\n                    # month.\n\n                    tmin = Time(vmin, scale=self._converter.scale, format='mjd').datetime\n                    tmax = Time(vmax, scale=self._converter.scale, format='mjd').datetime\n\n                    # Find the range of years\n                    ymin = tmin.year\n                    ymax = tmax.year\n\n                    if ymax > ymin + 1:  # greater than a year\n\n                        # Find the step we want to use\n                        ystep = int(select_step_scalar(max(1, (ymax - ymin) / 3)))\n\n                        ymin = ystep * (ymin // ystep)\n\n                        # Generate the years for these steps\n                        times = []\n                        for year in range(ymin, ymax + 1, ystep):\n                            times.append(datetime(year=year, month=1, day=1))\n\n                    else:  # greater than a month but less than a year\n\n                        mmin = tmin.month\n                        mmax = tmax.month + 12 * (ymax - ymin)\n\n                        mstep = int(select_step_scalar(max(1, (mmax - mmin) / 3)))\n\n                        mmin = mstep * max(1, mmin // mstep)\n\n                        # Generate the months for these steps\n                        times = []\n                        for month in range(mmin, mmax + 1, mstep):\n                            times.append(datetime(year=ymin + (month - 1) // 12,\n                                                  month=(month - 1) % 12 + 1,\n                                                  day=1))\n\n                    # Convert back to MJD\n                    values = Time(times, scale=self._converter.scale).mjd\n\n                elif vrange > 1:  # greater than a day\n\n                    self.set_params(steps=[1, 2, 5, 10])\n                    values = super().tick_values(vmin, vmax)\n\n                else:\n\n                    # Determine ideal step\n                    dv = (vmax - vmin) / 3 * 24 << u.hourangle\n\n                    # And round to nearest sensible value\n                    dv = select_step_hour(dv).to_value(u.hourangle) / 24\n\n                    # Determine tick locations\n                    imin = np.ceil(vmin / dv)\n                    imax = np.floor(vmax / dv)\n                    values = np.arange(imin, imax + 1, dtype=np.int64) * dv\n\n            else:\n\n                values = super().tick_values(vmin, vmax)\n\n            # Get rid of values outside of the input interval\n            values = values[(values >= vmin) & (values <= vmax)]\n\n            return values\n\n        def __call__(self):\n            vmin, vmax = self.axis.get_view_interval()\n            return self.tick_values(vmin, vmax)\n\n    class AstropyTimeFormatter(ScalarFormatter):\n\n        def __init__(self, converter, *args, **kwargs):\n            super().__init__(*args, **kwargs)\n            self._converter = converter\n            self.set_useOffset(False)\n            self.set_scientific(False)\n\n        def __call__(self, value, pos=None):\n            # Needed for Matplotlib <3.1\n            if self._converter.format in STR_FORMATS:\n                return self.format_ticks([value])[0]\n            else:\n                return super().__call__(value, pos=pos)\n\n        def format_ticks(self, values):\n            if len(values) == 0:\n                return []\n            if self._converter.format in YMDHMS_FORMATS:\n                times = Time(values, format='mjd', scale=self._converter.scale)\n                formatted = getattr(times, self._converter.format)\n                if self._converter.simplify:\n                    if self._converter.format in ('fits', 'iso', 'isot'):\n                        if all([x.endswith('00:00:00.000') for x in formatted]):\n                            split = ' ' if self._converter.format == 'iso' else 'T'\n                            formatted = [x.split(split)[0] for x in formatted]\n                    elif self._converter.format == 'yday':\n                        if all([x.endswith(':001:00:00:00.000') for x in formatted]):\n                            formatted = [x.split(':', 1)[0] for x in formatted]\n                return formatted\n            elif self._converter.format == 'byear_str':\n                return Time(values, format='byear', scale=self._converter.scale).byear_str\n            elif self._converter.format == 'jyear_str':\n                return Time(values, format='jyear', scale=self._converter.scale).jyear_str\n            else:\n                return super().format_ticks(values)\n\n    class MplTimeConverter(units.ConversionInterface):\n\n        def __init__(self, scale=None, format=None, simplify=None):\n\n            super().__init__()\n\n            self.format = format\n            self.scale = scale\n            self.simplify = simplify\n\n            # Keep track of original converter in case the context manager is\n            # used in a nested way.\n            self._original_converter = units.registry.get(Time)\n\n            units.registry[Time] = self\n\n        @property\n        def format(self):\n            return self._format\n\n        @format.setter\n        def format(self, value):\n            if value in UNSUPPORTED_FORMATS:\n                raise ValueError(f'time_support does not support format={value}')\n            self._format = value\n\n        def __enter__(self):\n            return self\n\n        def __exit__(self, type, value, tb):\n            if self._original_converter is None:\n                del units.registry[Time]\n            else:\n                units.registry[Time] = self._original_converter\n\n        def default_units(self, x, axis):\n            if isinstance(x, tuple):\n                x = x[0]\n            if self.format is None:\n                self.format = x.format\n            if self.scale is None:\n                self.scale = x.scale\n            return 'astropy_time'\n\n        def convert(self, value, unit, axis):\n            \"\"\"\n            Convert a Time value to a scalar or array.\n            \"\"\"\n            scaled = getattr(value, self.scale)\n            if self.format in YMDHMS_FORMATS:\n                return scaled.mjd\n            elif self.format == 'byear_str':\n                return scaled.byear\n            elif self.format == 'jyear_str':\n                return scaled.jyear\n            else:\n                return getattr(scaled, self.format)\n\n        def axisinfo(self, unit, axis):\n            \"\"\"\n            Return major and minor tick locators and formatters.\n            \"\"\"\n            majloc = AstropyTimeLocator(self)\n            majfmt = AstropyTimeFormatter(self)\n            return units.AxisInfo(majfmt=majfmt,\n                                  majloc=majloc,\n                                  label=f'Time ({self.scale})')\n\n    return MplTimeConverter(scale=scale, format=format, simplify=simplify)"},{"col":4,"comment":"null","endLoc":212,"header":"def __init__(self, a)","id":16012,"name":"__init__","nodeType":"Function","startLoc":208,"text":"def __init__(self, a):\n        super().__init__()\n        if a <= 0:\n            raise ValueError(\"a must be > 0\")\n        self.power = a"},{"className":"PowerStretch","col":0,"comment":"\n    A power stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = x^a\n\n    Parameters\n    ----------\n    a : float\n        The power index (see the above formula).  ``a`` must be greater\n        than 0.\n    ","endLoc":263,"id":16013,"nodeType":"Class","startLoc":188,"text":"class PowerStretch(BaseStretch):\n    r\"\"\"\n    A power stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = x^a\n\n    Parameters\n    ----------\n    a : float\n        The power index (see the above formula).  ``a`` must be greater\n        than 0.\n    \"\"\"\n\n    @property\n    def _supports_invalid_kw(self):\n        return True\n\n    def __init__(self, a):\n        super().__init__()\n        if a <= 0:\n            raise ValueError(\"a must be > 0\")\n        self.power = a\n\n    def __call__(self, values, clip=True, out=None, invalid=None):\n        \"\"\"\n        Transform values using this stretch.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values, which should already be normalized to the\n            [0:1] range.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n        invalid : None or float, optional\n            Value to assign NaN values generated by this class.  NaNs in\n            the input ``values`` array are not changed.  This option is\n            generally used with matplotlib normalization classes, where\n            the ``invalid`` value should map to the matplotlib colormap\n            \"under\" value (i.e., any finite value < 0).  If `None`, then\n            NaN values are not replaced.  This keyword has no effect if\n            ``clip=True``.\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        \"\"\"\n\n        values = _prepare(values, clip=clip, out=out)\n        replace_invalid = (not clip and invalid is not None\n                           and ((-1 < self.power < 0)\n                                or (0 < self.power < 1)))\n        with np.errstate(invalid='ignore'):\n            if replace_invalid:\n                idx = (values < 0)\n            np.power(values, self.power, out=values)\n\n        if replace_invalid:\n            # Assign new NaN (i.e., NaN not in the original input\n            # values, but generated by this class) to the invalid value.\n            values[idx] = invalid\n\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return PowerStretch(1. / self.power)"},{"col":4,"comment":"null","endLoc":206,"header":"@property\n    def _supports_invalid_kw(self)","id":16014,"name":"_supports_invalid_kw","nodeType":"Function","startLoc":204,"text":"@property\n    def _supports_invalid_kw(self):\n        return True"},{"col":4,"comment":"\n        Transform values using this stretch.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values, which should already be normalized to the\n            [0:1] range.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n        invalid : None or float, optional\n            Value to assign NaN values generated by this class.  NaNs in\n            the input ``values`` array are not changed.  This option is\n            generally used with matplotlib normalization classes, where\n            the ``invalid`` value should map to the matplotlib colormap\n            \"under\" value (i.e., any finite value < 0).  If `None`, then\n            NaN values are not replaced.  This keyword has no effect if\n            ``clip=True``.\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        ","endLoc":258,"header":"def __call__(self, values, clip=True, out=None, invalid=None)","id":16015,"name":"__call__","nodeType":"Function","startLoc":214,"text":"def __call__(self, values, clip=True, out=None, invalid=None):\n        \"\"\"\n        Transform values using this stretch.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values, which should already be normalized to the\n            [0:1] range.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n        invalid : None or float, optional\n            Value to assign NaN values generated by this class.  NaNs in\n            the input ``values`` array are not changed.  This option is\n            generally used with matplotlib normalization classes, where\n            the ``invalid`` value should map to the matplotlib colormap\n            \"under\" value (i.e., any finite value < 0).  If `None`, then\n            NaN values are not replaced.  This keyword has no effect if\n            ``clip=True``.\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        \"\"\"\n\n        values = _prepare(values, clip=clip, out=out)\n        replace_invalid = (not clip and invalid is not None\n                           and ((-1 < self.power < 0)\n                                or (0 < self.power < 1)))\n        with np.errstate(invalid='ignore'):\n            if replace_invalid:\n                idx = (values < 0)\n            np.power(values, self.power, out=values)\n\n        if replace_invalid:\n            # Assign new NaN (i.e., NaN not in the original input\n            # values, but generated by this class) to the invalid value.\n            values[idx] = invalid\n\n        return values"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":263,"header":"@property\n    def inverse(self)","id":16016,"name":"inverse","nodeType":"Function","startLoc":260,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return PowerStretch(1. / self.power)"},{"id":16017,"name":"astropy/visualization/scripts","nodeType":"Package"},{"fileName":"fits2bitmap.py","filePath":"astropy/visualization/scripts","id":16018,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\n\nfrom astropy.visualization.mpl_normalize import simple_norm\nfrom astropy import log\nfrom astropy.io.fits import getdata\n\n\ndef fits2bitmap(filename, ext=0, out_fn=None, stretch='linear',\n                power=1.0, asinh_a=0.1, min_cut=None, max_cut=None,\n                min_percent=None, max_percent=None, percent=None,\n                cmap='Greys_r'):\n    \"\"\"\n    Create a bitmap file from a FITS image, applying a stretching\n    transform between minimum and maximum cut levels and a matplotlib\n    colormap.\n\n    Parameters\n    ----------\n    filename : str\n        The filename of the FITS file.\n    ext : int\n        FITS extension name or number of the image to convert.  The\n        default is 0.\n    out_fn : str\n        The filename of the output bitmap image.  The type of bitmap\n        is determined by the filename extension (e.g. '.jpg', '.png').\n        The default is a PNG file with the same name as the FITS file.\n    stretch : {'linear', 'sqrt', 'power', log', 'asinh'}\n        The stretching function to apply to the image.  The default is\n        'linear'.\n    power : float, optional\n        The power index for ``stretch='power'``.  The default is 1.0.\n    asinh_a : float, optional\n        For ``stretch='asinh'``, the value where the asinh curve\n        transitions from linear to logarithmic behavior, expressed as a\n        fraction of the normalized image.  Must be in the range between\n        0 and 1.  The default is 0.1.\n    min_cut : float, optional\n        The pixel value of the minimum cut level.  Data values less than\n        ``min_cut`` will set to ``min_cut`` before stretching the image.\n        The default is the image minimum.  ``min_cut`` overrides\n        ``min_percent``.\n    max_cut : float, optional\n        The pixel value of the maximum cut level.  Data values greater\n        than ``min_cut`` will set to ``min_cut`` before stretching the\n        image.  The default is the image maximum.  ``max_cut`` overrides\n        ``max_percent``.\n    min_percent : float, optional\n        The percentile value used to determine the pixel value of\n        minimum cut level.  The default is 0.0.  ``min_percent``\n        overrides ``percent``.\n    max_percent : float, optional\n        The percentile value used to determine the pixel value of\n        maximum cut level.  The default is 100.0.  ``max_percent``\n        overrides ``percent``.\n    percent : float, optional\n        The percentage of the image values used to determine the pixel\n        values of the minimum and maximum cut levels.  The lower cut\n        level will set at the ``(100 - percent) / 2`` percentile, while\n        the upper cut level will be set at the ``(100 + percent) / 2``\n        percentile.  The default is 100.0.  ``percent`` is ignored if\n        either ``min_percent`` or ``max_percent`` is input.\n    cmap : str\n        The matplotlib color map name.  The default is 'Greys_r'.\n    \"\"\"\n\n    import matplotlib\n    import matplotlib.cm as cm\n    import matplotlib.image as mimg\n\n    # __main__ gives ext as a string\n    try:\n        ext = int(ext)\n    except ValueError:\n        pass\n\n    try:\n        image = getdata(filename, ext)\n    except Exception as e:\n        log.critical(e)\n        return 1\n\n    if image.ndim != 2:\n        log.critical(f'data in FITS extension {ext} is not a 2D array')\n\n    if out_fn is None:\n        out_fn = os.path.splitext(filename)[0]\n        if out_fn.endswith('.fits'):\n            out_fn = os.path.splitext(out_fn)[0]\n        out_fn += '.png'\n\n    # explicitly define the output format\n    out_format = os.path.splitext(out_fn)[1][1:]\n\n    try:\n        cm.get_cmap(cmap)\n    except ValueError:\n        log.critical(f'{cmap} is not a valid matplotlib colormap name.')\n        return 1\n\n    norm = simple_norm(image, stretch=stretch, power=power, asinh_a=asinh_a,\n                       min_cut=min_cut, max_cut=max_cut,\n                       min_percent=min_percent, max_percent=max_percent,\n                       percent=percent)\n\n    mimg.imsave(out_fn, norm(image), cmap=cmap, origin='lower',\n                format=out_format)\n    log.info(f'Saved file to {out_fn}.')\n\n\ndef main(args=None):\n\n    import argparse\n\n    parser = argparse.ArgumentParser(\n        description='Create a bitmap file from a FITS image.')\n    parser.add_argument('-e', '--ext', metavar='hdu', default=0,\n                        help='Specify the HDU extension number or name '\n                             '(Default is 0).')\n    parser.add_argument('-o', metavar='filename', type=str, default=None,\n                        help='Filename for the output image (Default is a '\n                        'PNG file with the same name as the FITS file).')\n    parser.add_argument('--stretch', type=str, default='linear',\n                        help='Type of image stretching (\"linear\", \"sqrt\", '\n                        '\"power\", \"log\", or \"asinh\") (Default is \"linear\").')\n    parser.add_argument('--power', type=float, default=1.0,\n                        help='Power index for \"power\" stretching (Default is '\n                             '1.0).')\n    parser.add_argument('--asinh_a', type=float, default=0.1,\n                        help='The value in normalized image where the asinh '\n                             'curve transitions from linear to logarithmic '\n                             'behavior (used only for \"asinh\" stretch) '\n                             '(Default is 0.1).')\n    parser.add_argument('--min_cut', type=float, default=None,\n                        help='The pixel value of the minimum cut level '\n                             '(Default is the image minimum).')\n    parser.add_argument('--max_cut', type=float, default=None,\n                        help='The pixel value of the maximum cut level '\n                             '(Default is the image maximum).')\n    parser.add_argument('--min_percent', type=float, default=None,\n                        help='The percentile value used to determine the '\n                             'minimum cut level (Default is 0).')\n    parser.add_argument('--max_percent', type=float, default=None,\n                        help='The percentile value used to determine the '\n                             'maximum cut level (Default is 100).')\n    parser.add_argument('--percent', type=float, default=None,\n                        help='The percentage of the image values used to '\n                             'determine the pixel values of the minimum and '\n                             'maximum cut levels (Default is 100).')\n    parser.add_argument('--cmap', metavar='colormap_name', type=str,\n                        default='Greys_r', help='matplotlib color map name '\n                                                '(Default is \"Greys_r\").')\n    parser.add_argument('filename', nargs='+',\n                        help='Path to one or more FITS files to convert')\n    args = parser.parse_args(args)\n\n    for filename in args.filename:\n        fits2bitmap(filename, ext=args.ext, out_fn=args.o,\n                    stretch=args.stretch, min_cut=args.min_cut,\n                    max_cut=args.max_cut, min_percent=args.min_percent,\n                    max_percent=args.max_percent, percent=args.percent,\n                    power=args.power, asinh_a=args.asinh_a, cmap=args.cmap)\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":212,"id":16019,"name":"power","nodeType":"Attribute","startLoc":212,"text":"self.power"},{"className":"LogStretch","col":0,"comment":"\n    A log stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{\\log{(a x + 1)}}{\\log{(a + 1)}}\n\n    Parameters\n    ----------\n    a : float\n        The ``a`` parameter used in the above formula.  ``a`` must be\n        greater than 0.  Default is 1000.\n    ","endLoc":434,"id":16020,"nodeType":"Class","startLoc":358,"text":"class LogStretch(BaseStretch):\n    r\"\"\"\n    A log stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{\\log{(a x + 1)}}{\\log{(a + 1)}}\n\n    Parameters\n    ----------\n    a : float\n        The ``a`` parameter used in the above formula.  ``a`` must be\n        greater than 0.  Default is 1000.\n    \"\"\"\n\n    @property\n    def _supports_invalid_kw(self):\n        return True\n\n    def __init__(self, a=1000.0):\n        super().__init__()\n        if a <= 0:  # singularity\n            raise ValueError(\"a must be > 0\")\n        self.exp = a\n\n    def __call__(self, values, clip=True, out=None, invalid=None):\n        \"\"\"\n        Transform values using this stretch.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values, which should already be normalized to the\n            [0:1] range.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n        invalid : None or float, optional\n            Value to assign NaN values generated by this class.  NaNs in\n            the input ``values`` array are not changed.  This option is\n            generally used with matplotlib normalization classes, where\n            the ``invalid`` value should map to the matplotlib colormap\n            \"under\" value (i.e., any finite value < 0).  If `None`, then\n            NaN values are not replaced.  This keyword has no effect if\n            ``clip=True``.\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        \"\"\"\n\n        values = _prepare(values, clip=clip, out=out)\n        replace_invalid = not clip and invalid is not None\n        with np.errstate(invalid='ignore'):\n            if replace_invalid:\n                idx = (values < 0)\n            np.multiply(values, self.exp, out=values)\n            np.add(values, 1., out=values)\n            np.log(values, out=values)\n            np.true_divide(values, np.log(self.exp + 1.), out=values)\n\n        if replace_invalid:\n            # Assign new NaN (i.e., NaN not in the original input\n            # values, but generated by this class) to the invalid value.\n            values[idx] = invalid\n\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return InvertedLogStretch(self.exp)"},{"col":4,"comment":"null","endLoc":376,"header":"@property\n    def _supports_invalid_kw(self)","id":16021,"name":"_supports_invalid_kw","nodeType":"Function","startLoc":374,"text":"@property\n    def _supports_invalid_kw(self):\n        return True"},{"col":4,"comment":"null","endLoc":382,"header":"def __init__(self, a=1000.0)","id":16022,"name":"__init__","nodeType":"Function","startLoc":378,"text":"def __init__(self, a=1000.0):\n        super().__init__()\n        if a <= 0:  # singularity\n            raise ValueError(\"a must be > 0\")\n        self.exp = a"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":121,"header":"@property\n    def inverse(self)","id":16023,"name":"inverse","nodeType":"Function","startLoc":118,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return LinearStretch(1. / self.slope, - self.intercept / self.slope)"},{"col":4,"comment":"\n        Transform values using this stretch.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values, which should already be normalized to the\n            [0:1] range.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n        invalid : None or float, optional\n            Value to assign NaN values generated by this class.  NaNs in\n            the input ``values`` array are not changed.  This option is\n            generally used with matplotlib normalization classes, where\n            the ``invalid`` value should map to the matplotlib colormap\n            \"under\" value (i.e., any finite value < 0).  If `None`, then\n            NaN values are not replaced.  This keyword has no effect if\n            ``clip=True``.\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        ","endLoc":429,"header":"def __call__(self, values, clip=True, out=None, invalid=None)","id":16024,"name":"__call__","nodeType":"Function","startLoc":384,"text":"def __call__(self, values, clip=True, out=None, invalid=None):\n        \"\"\"\n        Transform values using this stretch.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values, which should already be normalized to the\n            [0:1] range.\n        clip : bool, optional\n            If `True` (default), values outside the [0:1] range are\n            clipped to the [0:1] range.\n        out : ndarray, optional\n            If specified, the output values will be placed in this array\n            (typically used for in-place calculations).\n        invalid : None or float, optional\n            Value to assign NaN values generated by this class.  NaNs in\n            the input ``values`` array are not changed.  This option is\n            generally used with matplotlib normalization classes, where\n            the ``invalid`` value should map to the matplotlib colormap\n            \"under\" value (i.e., any finite value < 0).  If `None`, then\n            NaN values are not replaced.  This keyword has no effect if\n            ``clip=True``.\n\n        Returns\n        -------\n        result : ndarray\n            The transformed values.\n        \"\"\"\n\n        values = _prepare(values, clip=clip, out=out)\n        replace_invalid = not clip and invalid is not None\n        with np.errstate(invalid='ignore'):\n            if replace_invalid:\n                idx = (values < 0)\n            np.multiply(values, self.exp, out=values)\n            np.add(values, 1., out=values)\n            np.log(values, out=values)\n            np.true_divide(values, np.log(self.exp + 1.), out=values)\n\n        if replace_invalid:\n            # Assign new NaN (i.e., NaN not in the original input\n            # values, but generated by this class) to the invalid value.\n            values[idx] = invalid\n\n        return values"},{"attributeType":"null","col":8,"comment":"null","endLoc":108,"id":16025,"name":"intercept","nodeType":"Attribute","startLoc":108,"text":"self.intercept"},{"attributeType":"null","col":8,"comment":"null","endLoc":107,"id":16026,"name":"slope","nodeType":"Attribute","startLoc":107,"text":"self.slope"},{"className":"PowerDistStretch","col":0,"comment":"\n    An alternative power stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{a^x - 1}{a - 1}\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  ``a`` must be\n        greater than or equal to 0, but cannot be set to 1.  Default is\n        1000.\n    ","endLoc":299,"id":16027,"nodeType":"Class","startLoc":266,"text":"class PowerDistStretch(BaseStretch):\n    r\"\"\"\n    An alternative power stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{a^x - 1}{a - 1}\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  ``a`` must be\n        greater than or equal to 0, but cannot be set to 1.  Default is\n        1000.\n    \"\"\"\n\n    def __init__(self, a=1000.0):\n        if a < 0 or a == 1:  # singularity\n            raise ValueError(\"a must be >= 0, but cannot be set to 1\")\n        super().__init__()\n        self.exp = a\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.power(self.exp, values, out=values)\n        np.subtract(values, 1, out=values)\n        np.true_divide(values, self.exp - 1.0, out=values)\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return InvertedPowerDistStretch(a=self.exp)"},{"col":4,"comment":"null","endLoc":287,"header":"def __init__(self, a=1000.0)","id":16028,"name":"__init__","nodeType":"Function","startLoc":283,"text":"def __init__(self, a=1000.0):\n        if a < 0 or a == 1:  # singularity\n            raise ValueError(\"a must be >= 0, but cannot be set to 1\")\n        super().__init__()\n        self.exp = a"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":434,"header":"@property\n    def inverse(self)","id":16029,"name":"inverse","nodeType":"Function","startLoc":431,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return InvertedLogStretch(self.exp)"},{"col":4,"comment":"null","endLoc":294,"header":"def __call__(self, values, clip=True, out=None)","id":16030,"name":"__call__","nodeType":"Function","startLoc":289,"text":"def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.power(self.exp, values, out=values)\n        np.subtract(values, 1, out=values)\n        np.true_divide(values, self.exp - 1.0, out=values)\n        return values"},{"col":0,"comment":"\n    Return a Normalization class that can be used for displaying images\n    with Matplotlib.\n\n    This function enables only a subset of image stretching functions\n    available in `~astropy.visualization.mpl_normalize.ImageNormalize`.\n\n    This function is used by the\n    ``astropy.visualization.scripts.fits2bitmap`` script.\n\n    Parameters\n    ----------\n    data : ndarray\n        The image array.\n\n    stretch : {'linear', 'sqrt', 'power', log', 'asinh'}, optional\n        The stretch function to apply to the image.  The default is\n        'linear'.\n\n    power : float, optional\n        The power index for ``stretch='power'``.  The default is 1.0.\n\n    asinh_a : float, optional\n        For ``stretch='asinh'``, the value where the asinh curve\n        transitions from linear to logarithmic behavior, expressed as a\n        fraction of the normalized image.  Must be in the range between\n        0 and 1.  The default is 0.1.\n\n    min_cut : float, optional\n        The pixel value of the minimum cut level.  Data values less than\n        ``min_cut`` will set to ``min_cut`` before stretching the image.\n        The default is the image minimum.  ``min_cut`` overrides\n        ``min_percent``.\n\n    max_cut : float, optional\n        The pixel value of the maximum cut level.  Data values greater\n        than ``min_cut`` will set to ``min_cut`` before stretching the\n        image.  The default is the image maximum.  ``max_cut`` overrides\n        ``max_percent``.\n\n    min_percent : float, optional\n        The percentile value used to determine the pixel value of\n        minimum cut level.  The default is 0.0.  ``min_percent``\n        overrides ``percent``.\n\n    max_percent : float, optional\n        The percentile value used to determine the pixel value of\n        maximum cut level.  The default is 100.0.  ``max_percent``\n        overrides ``percent``.\n\n    percent : float, optional\n        The percentage of the image values used to determine the pixel\n        values of the minimum and maximum cut levels.  The lower cut\n        level will set at the ``(100 - percent) / 2`` percentile, while\n        the upper cut level will be set at the ``(100 + percent) / 2``\n        percentile.  The default is 100.0.  ``percent`` is ignored if\n        either ``min_percent`` or ``max_percent`` is input.\n\n    clip : bool, optional\n        If `True`, data values outside the [0:1] range are clipped to\n        the [0:1] range.\n\n    log_a : float, optional\n        The log index for ``stretch='log'``. The default is 1000.\n\n    invalid : None or float, optional\n        Value to assign NaN values generated by the normalization.  NaNs\n        in the input ``data`` array are not changed.  For matplotlib\n        normalization, the ``invalid`` value should map to the\n        matplotlib colormap \"under\" value (i.e., any finite value < 0).\n        If `None`, then NaN values are not replaced.  This keyword has\n        no effect if ``clip=True``.\n\n    Returns\n    -------\n    result : `ImageNormalize` instance\n        An `ImageNormalize` instance that can be used for displaying\n        images with Matplotlib.\n    ","endLoc":299,"header":"def simple_norm(data, stretch='linear', power=1.0, asinh_a=0.1, min_cut=None,\n                max_cut=None, min_percent=None, max_percent=None,\n                percent=None, clip=False, log_a=1000, invalid=-1.0)","id":16031,"name":"simple_norm","nodeType":"Function","startLoc":190,"text":"def simple_norm(data, stretch='linear', power=1.0, asinh_a=0.1, min_cut=None,\n                max_cut=None, min_percent=None, max_percent=None,\n                percent=None, clip=False, log_a=1000, invalid=-1.0):\n    \"\"\"\n    Return a Normalization class that can be used for displaying images\n    with Matplotlib.\n\n    This function enables only a subset of image stretching functions\n    available in `~astropy.visualization.mpl_normalize.ImageNormalize`.\n\n    This function is used by the\n    ``astropy.visualization.scripts.fits2bitmap`` script.\n\n    Parameters\n    ----------\n    data : ndarray\n        The image array.\n\n    stretch : {'linear', 'sqrt', 'power', log', 'asinh'}, optional\n        The stretch function to apply to the image.  The default is\n        'linear'.\n\n    power : float, optional\n        The power index for ``stretch='power'``.  The default is 1.0.\n\n    asinh_a : float, optional\n        For ``stretch='asinh'``, the value where the asinh curve\n        transitions from linear to logarithmic behavior, expressed as a\n        fraction of the normalized image.  Must be in the range between\n        0 and 1.  The default is 0.1.\n\n    min_cut : float, optional\n        The pixel value of the minimum cut level.  Data values less than\n        ``min_cut`` will set to ``min_cut`` before stretching the image.\n        The default is the image minimum.  ``min_cut`` overrides\n        ``min_percent``.\n\n    max_cut : float, optional\n        The pixel value of the maximum cut level.  Data values greater\n        than ``min_cut`` will set to ``min_cut`` before stretching the\n        image.  The default is the image maximum.  ``max_cut`` overrides\n        ``max_percent``.\n\n    min_percent : float, optional\n        The percentile value used to determine the pixel value of\n        minimum cut level.  The default is 0.0.  ``min_percent``\n        overrides ``percent``.\n\n    max_percent : float, optional\n        The percentile value used to determine the pixel value of\n        maximum cut level.  The default is 100.0.  ``max_percent``\n        overrides ``percent``.\n\n    percent : float, optional\n        The percentage of the image values used to determine the pixel\n        values of the minimum and maximum cut levels.  The lower cut\n        level will set at the ``(100 - percent) / 2`` percentile, while\n        the upper cut level will be set at the ``(100 + percent) / 2``\n        percentile.  The default is 100.0.  ``percent`` is ignored if\n        either ``min_percent`` or ``max_percent`` is input.\n\n    clip : bool, optional\n        If `True`, data values outside the [0:1] range are clipped to\n        the [0:1] range.\n\n    log_a : float, optional\n        The log index for ``stretch='log'``. The default is 1000.\n\n    invalid : None or float, optional\n        Value to assign NaN values generated by the normalization.  NaNs\n        in the input ``data`` array are not changed.  For matplotlib\n        normalization, the ``invalid`` value should map to the\n        matplotlib colormap \"under\" value (i.e., any finite value < 0).\n        If `None`, then NaN values are not replaced.  This keyword has\n        no effect if ``clip=True``.\n\n    Returns\n    -------\n    result : `ImageNormalize` instance\n        An `ImageNormalize` instance that can be used for displaying\n        images with Matplotlib.\n    \"\"\"\n\n    if percent is not None:\n        interval = PercentileInterval(percent)\n    elif min_percent is not None or max_percent is not None:\n        interval = AsymmetricPercentileInterval(min_percent or 0.,\n                                                max_percent or 100.)\n    elif min_cut is not None or max_cut is not None:\n        interval = ManualInterval(min_cut, max_cut)\n    else:\n        interval = MinMaxInterval()\n\n    if stretch == 'linear':\n        stretch = LinearStretch()\n    elif stretch == 'sqrt':\n        stretch = SqrtStretch()\n    elif stretch == 'power':\n        stretch = PowerStretch(power)\n    elif stretch == 'log':\n        stretch = LogStretch(log_a)\n    elif stretch == 'asinh':\n        stretch = AsinhStretch(asinh_a)\n    else:\n        raise ValueError(f'Unknown stretch: {stretch}.')\n\n    vmin, vmax = interval.get_limits(data)\n\n    return ImageNormalize(vmin=vmin, vmax=vmax, stretch=stretch, clip=clip,\n                          invalid=invalid)"},{"col":4,"comment":"null","endLoc":458,"header":"def __init__(self, a)","id":16032,"name":"__init__","nodeType":"Function","startLoc":454,"text":"def __init__(self, a):\n        super().__init__()\n        if a <= 0:  # singularity\n            raise ValueError(\"a must be > 0\")\n        self.exp = a"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":299,"header":"@property\n    def inverse(self)","id":16033,"name":"inverse","nodeType":"Function","startLoc":296,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return InvertedPowerDistStretch(a=self.exp)"},{"className":"LinearMapping","col":0,"comment":"\n    A linear map map of red, blue, green intensities into uint8 values.\n\n    A linear stretch from [minimum, maximum].\n    If one or both are omitted use image min and/or max to set them.\n\n    Parameters\n    ----------\n    minimum : float\n        Intensity that should be mapped to black (a scalar or array for R, G, B).\n    maximum : float\n        Intensity that should be mapped to white (a scalar).\n    ","endLoc":217,"id":16034,"nodeType":"Class","startLoc":179,"text":"class LinearMapping(Mapping):\n    \"\"\"\n    A linear map map of red, blue, green intensities into uint8 values.\n\n    A linear stretch from [minimum, maximum].\n    If one or both are omitted use image min and/or max to set them.\n\n    Parameters\n    ----------\n    minimum : float\n        Intensity that should be mapped to black (a scalar or array for R, G, B).\n    maximum : float\n        Intensity that should be mapped to white (a scalar).\n    \"\"\"\n\n    def __init__(self, minimum=None, maximum=None, image=None):\n        if minimum is None or maximum is None:\n            if image is None:\n                raise ValueError(\"you must provide an image if you don't \"\n                                 \"set both minimum and maximum\")\n            if minimum is None:\n                minimum = image.min()\n            if maximum is None:\n                maximum = image.max()\n\n        Mapping.__init__(self, minimum=minimum, image=image)\n        self.maximum = maximum\n\n        if maximum is None:\n            self._range = None\n        else:\n            if maximum == minimum:\n                raise ValueError(\"minimum and maximum values must not be equal\")\n            self._range = float(maximum - minimum)\n\n    def map_intensity_to_uint8(self, I):\n        with np.errstate(invalid='ignore', divide='ignore'):  # n.b. np.where can't and doesn't short-circuit\n            return np.where(I <= 0, 0,\n                            np.where(I >= self._range, self._uint8Max/I, self._uint8Max/self._range))"},{"col":4,"comment":"null","endLoc":212,"header":"def __init__(self, minimum=None, maximum=None, image=None)","id":16035,"name":"__init__","nodeType":"Function","startLoc":194,"text":"def __init__(self, minimum=None, maximum=None, image=None):\n        if minimum is None or maximum is None:\n            if image is None:\n                raise ValueError(\"you must provide an image if you don't \"\n                                 \"set both minimum and maximum\")\n            if minimum is None:\n                minimum = image.min()\n            if maximum is None:\n                maximum = image.max()\n\n        Mapping.__init__(self, minimum=minimum, image=image)\n        self.maximum = maximum\n\n        if maximum is None:\n            self._range = None\n        else:\n            if maximum == minimum:\n                raise ValueError(\"minimum and maximum values must not be equal\")\n            self._range = float(maximum - minimum)"},{"attributeType":"null","col":8,"comment":"null","endLoc":382,"id":16036,"name":"exp","nodeType":"Attribute","startLoc":382,"text":"self.exp"},{"col":0,"comment":"null","endLoc":238,"header":"@frame_transform_graph.transform(DynamicMatrixTransform,\n                                 ICRS, CustomBarycentricEcliptic)\ndef icrs_to_custombaryecliptic(from_coo, to_frame)","id":16037,"name":"icrs_to_custombaryecliptic","nodeType":"Function","startLoc":235,"text":"@frame_transform_graph.transform(DynamicMatrixTransform,\n                                 ICRS, CustomBarycentricEcliptic)\ndef icrs_to_custombaryecliptic(from_coo, to_frame):\n    return _obliquity_only_rotation_matrix(to_frame.obliquity)"},{"col":0,"comment":"null","endLoc":244,"header":"@frame_transform_graph.transform(DynamicMatrixTransform,\n                                 CustomBarycentricEcliptic, ICRS)\ndef custombaryecliptic_to_icrs(from_coo, to_frame)","id":16038,"name":"custombaryecliptic_to_icrs","nodeType":"Function","startLoc":241,"text":"@frame_transform_graph.transform(DynamicMatrixTransform,\n                                 CustomBarycentricEcliptic, ICRS)\ndef custombaryecliptic_to_icrs(from_coo, to_frame):\n    return icrs_to_custombaryecliptic(to_frame, from_coo).T"},{"col":4,"comment":"null","endLoc":324,"header":"def __init__(self, a=1000.0)","id":16039,"name":"__init__","nodeType":"Function","startLoc":320,"text":"def __init__(self, a=1000.0):\n        if a < 0 or a == 1:  # singularity\n            raise ValueError(\"a must be >= 0, but cannot be set to 1\")\n        super().__init__()\n        self.exp = a"},{"attributeType":"null","col":29,"comment":"null","endLoc":8,"id":16040,"name":"u","nodeType":"Attribute","startLoc":8,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":101,"id":16041,"name":"_NEED_ORIGIN_HINT","nodeType":"Attribute","startLoc":101,"text":"_NEED_ORIGIN_HINT"},{"col":0,"comment":"","endLoc":5,"header":"ecliptic_transforms.py#<anonymous>","id":16042,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nContains the transformation functions for getting to/from ecliptic systems.\n\"\"\"\n\n_NEED_ORIGIN_HINT = (\"The input {0} coordinates do not have length units. This \"\n                     \"probably means you created coordinates with lat/lon but \"\n                     \"no distance.  Heliocentric<->ICRS transforms cannot \"\n                     \"function in this case because there is an origin shift.\")\n\nframe_transform_graph._add_merged_transform(GeocentricMeanEcliptic, ICRS, GeocentricMeanEcliptic)\n\nframe_transform_graph._add_merged_transform(GeocentricTrueEcliptic, ICRS, GeocentricTrueEcliptic)\n\nframe_transform_graph._add_merged_transform(HeliocentricMeanEcliptic, ICRS, HeliocentricMeanEcliptic)\n\nframe_transform_graph._add_merged_transform(HeliocentricTrueEcliptic, ICRS, HeliocentricTrueEcliptic)\n\nframe_transform_graph._add_merged_transform(HeliocentricEclipticIAU76, ICRS, HeliocentricEclipticIAU76)\n\nframe_transform_graph._add_merged_transform(BarycentricMeanEcliptic, ICRS, BarycentricMeanEcliptic)\n\nframe_transform_graph._add_merged_transform(BarycentricTrueEcliptic, ICRS, BarycentricTrueEcliptic)\n\nframe_transform_graph._add_merged_transform(CustomBarycentricEcliptic, ICRS, CustomBarycentricEcliptic)"},{"col":4,"comment":"null","endLoc":217,"header":"def map_intensity_to_uint8(self, I)","id":16043,"name":"map_intensity_to_uint8","nodeType":"Function","startLoc":214,"text":"def map_intensity_to_uint8(self, I):\n        with np.errstate(invalid='ignore', divide='ignore'):  # n.b. np.where can't and doesn't short-circuit\n            return np.where(I <= 0, 0,\n                            np.where(I >= self._range, self._uint8Max/I, self._uint8Max/self._range))"},{"attributeType":"null","col":8,"comment":"null","endLoc":205,"id":16044,"name":"maximum","nodeType":"Attribute","startLoc":205,"text":"self.maximum"},{"attributeType":"null","col":8,"comment":"null","endLoc":287,"id":16045,"name":"exp","nodeType":"Attribute","startLoc":287,"text":"self.exp"},{"className":"InvertedPowerDistStretch","col":0,"comment":"\n    Inverse transformation for\n    `~astropy.image.scaling.PowerDistStretch`.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{\\log(y (a-1) + 1)}{\\log a}\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  ``a`` must be\n        greater than or equal to 0, but cannot be set to 1.  Default is\n        1000.\n    ","endLoc":336,"id":16046,"nodeType":"Class","startLoc":302,"text":"class InvertedPowerDistStretch(BaseStretch):\n    r\"\"\"\n    Inverse transformation for\n    `~astropy.image.scaling.PowerDistStretch`.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{\\log(y (a-1) + 1)}{\\log a}\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  ``a`` must be\n        greater than or equal to 0, but cannot be set to 1.  Default is\n        1000.\n    \"\"\"\n\n    def __init__(self, a=1000.0):\n        if a < 0 or a == 1:  # singularity\n            raise ValueError(\"a must be >= 0, but cannot be set to 1\")\n        super().__init__()\n        self.exp = a\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.multiply(values, self.exp - 1.0, out=values)\n        np.add(values, 1, out=values)\n        _logn(self.exp, values, out=values)\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return PowerDistStretch(a=self.exp)"},{"attributeType":"null","col":12,"comment":"null","endLoc":212,"id":16047,"name":"_range","nodeType":"Attribute","startLoc":212,"text":"self._range"},{"col":4,"comment":"null","endLoc":331,"header":"def __call__(self, values, clip=True, out=None)","id":16048,"name":"__call__","nodeType":"Function","startLoc":326,"text":"def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.multiply(values, self.exp - 1.0, out=values)\n        np.add(values, 1, out=values)\n        _logn(self.exp, values, out=values)\n        return values"},{"className":"AsinhStretch","col":0,"comment":"\n    An asinh stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{{\\rm asinh}(x / a)}{{\\rm asinh}(1 / a)}.\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  The value of\n        this parameter is where the asinh curve transitions from linear\n        to logarithmic behavior, expressed as a fraction of the\n        normalized image.  ``a`` must be greater than 0 and less than or\n        equal to 1 (0 < a <= 1).  Default is 0.1.\n    ","endLoc":509,"id":16049,"nodeType":"Class","startLoc":474,"text":"class AsinhStretch(BaseStretch):\n    r\"\"\"\n    An asinh stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{{\\rm asinh}(x / a)}{{\\rm asinh}(1 / a)}.\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  The value of\n        this parameter is where the asinh curve transitions from linear\n        to logarithmic behavior, expressed as a fraction of the\n        normalized image.  ``a`` must be greater than 0 and less than or\n        equal to 1 (0 < a <= 1).  Default is 0.1.\n    \"\"\"\n\n    def __init__(self, a=0.1):\n        super().__init__()\n        if a <= 0 or a > 1:\n            raise ValueError(\"a must be > 0 and <= 1\")\n        self.a = a\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.true_divide(values, self.a, out=values)\n        np.arcsinh(values, out=values)\n        np.true_divide(values, np.arcsinh(1. / self.a), out=values)\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return SinhStretch(a=1. / np.arcsinh(1. / self.a))"},{"col":4,"comment":"null","endLoc":497,"header":"def __init__(self, a=0.1)","id":16050,"name":"__init__","nodeType":"Function","startLoc":493,"text":"def __init__(self, a=0.1):\n        super().__init__()\n        if a <= 0 or a > 1:\n            raise ValueError(\"a must be > 0 and <= 1\")\n        self.a = a"},{"col":4,"comment":"null","endLoc":504,"header":"def __call__(self, values, clip=True, out=None)","id":16051,"name":"__call__","nodeType":"Function","startLoc":499,"text":"def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.true_divide(values, self.a, out=values)\n        np.arcsinh(values, out=values)\n        np.true_divide(values, np.arcsinh(1. / self.a), out=values)\n        return values"},{"col":0,"comment":"Calculate the log base n of x.","endLoc":28,"header":"def _logn(n, x, out=None)","id":16052,"name":"_logn","nodeType":"Function","startLoc":20,"text":"def _logn(n, x, out=None):\n    \"\"\"Calculate the log base n of x.\"\"\"\n    # We define this because numpy.lib.scimath.logn doesn't support out=\n    if out is None:\n        return np.log(x) / np.log(n)\n    else:\n        np.log(x, out=out)\n        np.true_divide(out, np.log(n), out=out)\n        return out"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":509,"header":"@property\n    def inverse(self)","id":16053,"name":"inverse","nodeType":"Function","startLoc":506,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return SinhStretch(a=1. / np.arcsinh(1. / self.a))"},{"className":"AsinhMapping","col":0,"comment":"\n    A mapping for an asinh stretch (preserving colours independent of brightness)\n\n    x = asinh(Q (I - minimum)/stretch)/Q\n\n    This reduces to a linear stretch if Q == 0\n\n    See https://ui.adsabs.harvard.edu/abs/2004PASP..116..133L\n\n    Parameters\n    ----------\n\n    minimum : float\n        Intensity that should be mapped to black (a scalar or array for R, G, B).\n    stretch : float\n        The linear stretch of the image.\n    Q : float\n        The asinh softening parameter.\n    ","endLoc":259,"id":16054,"nodeType":"Class","startLoc":220,"text":"class AsinhMapping(Mapping):\n    \"\"\"\n    A mapping for an asinh stretch (preserving colours independent of brightness)\n\n    x = asinh(Q (I - minimum)/stretch)/Q\n\n    This reduces to a linear stretch if Q == 0\n\n    See https://ui.adsabs.harvard.edu/abs/2004PASP..116..133L\n\n    Parameters\n    ----------\n\n    minimum : float\n        Intensity that should be mapped to black (a scalar or array for R, G, B).\n    stretch : float\n        The linear stretch of the image.\n    Q : float\n        The asinh softening parameter.\n    \"\"\"\n\n    def __init__(self, minimum, stretch, Q=8):\n        Mapping.__init__(self, minimum)\n\n        epsilon = 1.0/2**23            # 32bit floating point machine epsilon; sys.float_info.epsilon is 64bit\n        if abs(Q) < epsilon:\n            Q = 0.1\n        else:\n            Qmax = 1e10\n            if Q > Qmax:\n                Q = Qmax\n\n        frac = 0.1                  # gradient estimated using frac*stretch is _slope\n        self._slope = frac*self._uint8Max/np.arcsinh(frac*Q)\n\n        self._soften = Q/float(stretch)\n\n    def map_intensity_to_uint8(self, I):\n        with np.errstate(invalid='ignore', divide='ignore'):  # n.b. np.where can't and doesn't short-circuit\n            return np.where(I <= 0, 0, np.arcsinh(I*self._soften)*self._slope/I)"},{"col":4,"comment":"null","endLoc":255,"header":"def __init__(self, minimum, stretch, Q=8)","id":16055,"name":"__init__","nodeType":"Function","startLoc":241,"text":"def __init__(self, minimum, stretch, Q=8):\n        Mapping.__init__(self, minimum)\n\n        epsilon = 1.0/2**23            # 32bit floating point machine epsilon; sys.float_info.epsilon is 64bit\n        if abs(Q) < epsilon:\n            Q = 0.1\n        else:\n            Qmax = 1e10\n            if Q > Qmax:\n                Q = Qmax\n\n        frac = 0.1                  # gradient estimated using frac*stretch is _slope\n        self._slope = frac*self._uint8Max/np.arcsinh(frac*Q)\n\n        self._soften = Q/float(stretch)"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":336,"header":"@property\n    def inverse(self)","id":16056,"name":"inverse","nodeType":"Function","startLoc":333,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return PowerDistStretch(a=self.exp)"},{"col":4,"comment":"null","endLoc":533,"header":"def __init__(self, a=1./3.)","id":16057,"name":"__init__","nodeType":"Function","startLoc":529,"text":"def __init__(self, a=1./3.):\n        super().__init__()\n        if a <= 0 or a > 1:\n            raise ValueError(\"a must be > 0 and <= 1\")\n        self.a = a"},{"attributeType":"null","col":8,"comment":"null","endLoc":497,"id":16058,"name":"a","nodeType":"Attribute","startLoc":497,"text":"self.a"},{"className":"ImageNormalize","col":0,"comment":"\n    Normalization class to be used with Matplotlib.\n\n    Parameters\n    ----------\n    data : ndarray, optional\n        The image array.  This input is used only if ``interval`` is\n        also input.  ``data`` and ``interval`` are used to compute the\n        vmin and/or vmax values only if ``vmin`` or ``vmax`` are not\n        input.\n    interval : `~astropy.visualization.BaseInterval` subclass instance, optional\n        The interval object to apply to the input ``data`` to determine\n        the ``vmin`` and ``vmax`` values.  This input is used only if\n        ``data`` is also input.  ``data`` and ``interval`` are used to\n        compute the vmin and/or vmax values only if ``vmin`` or ``vmax``\n        are not input.\n    vmin, vmax : float, optional\n        The minimum and maximum levels to show for the data.  The\n        ``vmin`` and ``vmax`` inputs override any calculated values from\n        the ``interval`` and ``data`` inputs.\n    stretch : `~astropy.visualization.BaseStretch` subclass instance\n        The stretch object to apply to the data.  The default is\n        `~astropy.visualization.LinearStretch`.\n    clip : bool, optional\n        If `True`, data values outside the [0:1] range are clipped to\n        the [0:1] range.\n    invalid : None or float, optional\n        Value to assign NaN values generated by this class.  NaNs in the\n        input ``data`` array are not changed.  For matplotlib\n        normalization, the ``invalid`` value should map to the\n        matplotlib colormap \"under\" value (i.e., any finite value < 0).\n        If `None`, then NaN values are not replaced.  This keyword has\n        no effect if ``clip=True``.\n    ","endLoc":187,"id":16059,"nodeType":"Class","startLoc":32,"text":"class ImageNormalize(Normalize):\n    \"\"\"\n    Normalization class to be used with Matplotlib.\n\n    Parameters\n    ----------\n    data : ndarray, optional\n        The image array.  This input is used only if ``interval`` is\n        also input.  ``data`` and ``interval`` are used to compute the\n        vmin and/or vmax values only if ``vmin`` or ``vmax`` are not\n        input.\n    interval : `~astropy.visualization.BaseInterval` subclass instance, optional\n        The interval object to apply to the input ``data`` to determine\n        the ``vmin`` and ``vmax`` values.  This input is used only if\n        ``data`` is also input.  ``data`` and ``interval`` are used to\n        compute the vmin and/or vmax values only if ``vmin`` or ``vmax``\n        are not input.\n    vmin, vmax : float, optional\n        The minimum and maximum levels to show for the data.  The\n        ``vmin`` and ``vmax`` inputs override any calculated values from\n        the ``interval`` and ``data`` inputs.\n    stretch : `~astropy.visualization.BaseStretch` subclass instance\n        The stretch object to apply to the data.  The default is\n        `~astropy.visualization.LinearStretch`.\n    clip : bool, optional\n        If `True`, data values outside the [0:1] range are clipped to\n        the [0:1] range.\n    invalid : None or float, optional\n        Value to assign NaN values generated by this class.  NaNs in the\n        input ``data`` array are not changed.  For matplotlib\n        normalization, the ``invalid`` value should map to the\n        matplotlib colormap \"under\" value (i.e., any finite value < 0).\n        If `None`, then NaN values are not replaced.  This keyword has\n        no effect if ``clip=True``.\n    \"\"\"\n\n    def __init__(self, data=None, interval=None, vmin=None, vmax=None,\n                 stretch=LinearStretch(), clip=False, invalid=-1.0):\n        # this super call checks for matplotlib\n        super().__init__(vmin=vmin, vmax=vmax, clip=clip)\n\n        self.vmin = vmin\n        self.vmax = vmax\n\n        if stretch is None:\n            raise ValueError('stretch must be input')\n        if not isinstance(stretch, BaseStretch):\n            raise TypeError('stretch must be an instance of a BaseStretch '\n                            'subclass')\n        self.stretch = stretch\n\n        if interval is not None and not isinstance(interval, BaseInterval):\n            raise TypeError('interval must be an instance of a BaseInterval '\n                            'subclass')\n        self.interval = interval\n\n        self.inverse_stretch = stretch.inverse\n        self.clip = clip\n        self.invalid = invalid\n\n        # Define vmin and vmax if not None and data was input\n        if data is not None:\n            self._set_limits(data)\n\n    def _set_limits(self, data):\n        if self.vmin is not None and self.vmax is not None:\n            return\n\n        # Define vmin and vmax from the interval class if not None\n        if self.interval is None:\n            if self.vmin is None:\n                self.vmin = np.min(data[np.isfinite(data)])\n            if self.vmax is None:\n                self.vmax = np.max(data[np.isfinite(data)])\n        else:\n            _vmin, _vmax = self.interval.get_limits(data)\n            if self.vmin is None:\n                self.vmin = _vmin\n            if self.vmax is None:\n                self.vmax = _vmax\n\n    def __call__(self, values, clip=None, invalid=None):\n        \"\"\"\n        Transform values using this normalization.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values.\n        clip : bool, optional\n            If `True`, values outside the [0:1] range are clipped to the\n            [0:1] range.  If `None` then the ``clip`` value from the\n            `ImageNormalize` instance is used (the default of which is\n            `False`).\n        invalid : None or float, optional\n            Value to assign NaN values generated by this class.  NaNs in\n            the input ``data`` array are not changed.  For matplotlib\n            normalization, the ``invalid`` value should map to the\n            matplotlib colormap \"under\" value (i.e., any finite value <\n            0).  If `None`, then the `ImageNormalize` instance value is\n            used.  This keyword has no effect if ``clip=True``.\n        \"\"\"\n\n        if clip is None:\n            clip = self.clip\n\n        if invalid is None:\n            invalid = self.invalid\n\n        if isinstance(values, ma.MaskedArray):\n            if clip:\n                mask = False\n            else:\n                mask = values.mask\n            values = values.filled(self.vmax)\n        else:\n            mask = False\n\n        # Make sure scalars get broadcast to 1-d\n        if np.isscalar(values):\n            values = np.array([values], dtype=float)\n        else:\n            # copy because of in-place operations after\n            values = np.array(values, copy=True, dtype=float)\n\n        # Define vmin and vmax if not None\n        self._set_limits(values)\n\n        # Normalize based on vmin and vmax\n        np.subtract(values, self.vmin, out=values)\n        np.true_divide(values, self.vmax - self.vmin, out=values)\n\n        # Clip to the 0 to 1 range\n        if clip:\n            values = np.clip(values, 0., 1., out=values)\n\n        # Stretch values\n        if self.stretch._supports_invalid_kw:\n            values = self.stretch(values, out=values, clip=False,\n                                  invalid=invalid)\n        else:\n            values = self.stretch(values, out=values, clip=False)\n\n        # Convert to masked array for matplotlib\n        return ma.array(values, mask=mask)\n\n    def inverse(self, values, invalid=None):\n        # Find unstretched values in range 0 to 1\n        if self.inverse_stretch._supports_invalid_kw:\n            values_norm = self.inverse_stretch(values, clip=False,\n                                               invalid=invalid)\n        else:\n            values_norm = self.inverse_stretch(values, clip=False)\n\n        # Scale to original range\n        return values_norm * (self.vmax - self.vmin) + self.vmin"},{"attributeType":"null","col":8,"comment":"null","endLoc":324,"id":16060,"name":"exp","nodeType":"Attribute","startLoc":324,"text":"self.exp"},{"col":4,"comment":"null","endLoc":94,"header":"def __init__(self, data=None, interval=None, vmin=None, vmax=None,\n                 stretch=LinearStretch(), clip=False, invalid=-1.0)","id":16061,"name":"__init__","nodeType":"Function","startLoc":68,"text":"def __init__(self, data=None, interval=None, vmin=None, vmax=None,\n                 stretch=LinearStretch(), clip=False, invalid=-1.0):\n        # this super call checks for matplotlib\n        super().__init__(vmin=vmin, vmax=vmax, clip=clip)\n\n        self.vmin = vmin\n        self.vmax = vmax\n\n        if stretch is None:\n            raise ValueError('stretch must be input')\n        if not isinstance(stretch, BaseStretch):\n            raise TypeError('stretch must be an instance of a BaseStretch '\n                            'subclass')\n        self.stretch = stretch\n\n        if interval is not None and not isinstance(interval, BaseInterval):\n            raise TypeError('interval must be an instance of a BaseInterval '\n                            'subclass')\n        self.interval = interval\n\n        self.inverse_stretch = stretch.inverse\n        self.clip = clip\n        self.invalid = invalid\n\n        # Define vmin and vmax if not None and data was input\n        if data is not None:\n            self._set_limits(data)"},{"col":4,"comment":"null","endLoc":259,"header":"def map_intensity_to_uint8(self, I)","id":16062,"name":"map_intensity_to_uint8","nodeType":"Function","startLoc":257,"text":"def map_intensity_to_uint8(self, I):\n        with np.errstate(invalid='ignore', divide='ignore'):  # n.b. np.where can't and doesn't short-circuit\n            return np.where(I <= 0, 0, np.arcsinh(I*self._soften)*self._slope/I)"},{"className":"SquaredStretch","col":0,"comment":"\n    A convenience class for a power stretch of 2.\n\n    The stretch is given by:\n\n    .. math::\n        y = x^2\n    ","endLoc":355,"id":16063,"nodeType":"Class","startLoc":339,"text":"class SquaredStretch(PowerStretch):\n    r\"\"\"\n    A convenience class for a power stretch of 2.\n\n    The stretch is given by:\n\n    .. math::\n        y = x^2\n    \"\"\"\n\n    def __init__(self):\n        super().__init__(2)\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return SqrtStretch()"},{"attributeType":"null","col":8,"comment":"null","endLoc":255,"id":16064,"name":"_soften","nodeType":"Attribute","startLoc":255,"text":"self._soften"},{"col":4,"comment":"null","endLoc":350,"header":"def __init__(self)","id":16065,"name":"__init__","nodeType":"Function","startLoc":349,"text":"def __init__(self):\n        super().__init__(2)"},{"attributeType":"null","col":8,"comment":"null","endLoc":253,"id":16066,"name":"_slope","nodeType":"Attribute","startLoc":253,"text":"self._slope"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":355,"header":"@property\n    def inverse(self)","id":16067,"name":"inverse","nodeType":"Function","startLoc":352,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return SqrtStretch()"},{"className":"AsinhZScaleMapping","col":0,"comment":"\n    A mapping for an asinh stretch, estimating the linear stretch by zscale.\n\n    x = asinh(Q (I - z1)/(z2 - z1))/Q\n\n    Parameters\n    ----------\n    image1 : ndarray or a list of arrays\n        The image to analyse, or a list of 3 images to be converted to\n        an intensity image.\n    image2 : ndarray, optional\n        the second image to analyse (must be specified with image3).\n    image3 : ndarray, optional\n        the third image to analyse (must be specified with image2).\n    Q : float, optional\n        The asinh softening parameter. Default is 8.\n    pedestal : float or sequence(3), optional\n        The value, or array of 3 values, to subtract from the images; or None.\n\n    Notes\n    -----\n    pedestal, if not None, is removed from the images when calculating the\n    zscale stretch, and added back into Mapping.minimum[]\n    ","endLoc":327,"id":16068,"nodeType":"Class","startLoc":262,"text":"class AsinhZScaleMapping(AsinhMapping):\n    \"\"\"\n    A mapping for an asinh stretch, estimating the linear stretch by zscale.\n\n    x = asinh(Q (I - z1)/(z2 - z1))/Q\n\n    Parameters\n    ----------\n    image1 : ndarray or a list of arrays\n        The image to analyse, or a list of 3 images to be converted to\n        an intensity image.\n    image2 : ndarray, optional\n        the second image to analyse (must be specified with image3).\n    image3 : ndarray, optional\n        the third image to analyse (must be specified with image2).\n    Q : float, optional\n        The asinh softening parameter. Default is 8.\n    pedestal : float or sequence(3), optional\n        The value, or array of 3 values, to subtract from the images; or None.\n\n    Notes\n    -----\n    pedestal, if not None, is removed from the images when calculating the\n    zscale stretch, and added back into Mapping.minimum[]\n    \"\"\"\n\n    def __init__(self, image1, image2=None, image3=None, Q=8, pedestal=None):\n        \"\"\"\n        \"\"\"\n\n        if image2 is None or image3 is None:\n            if not (image2 is None and image3 is None):\n                raise ValueError(\"please specify either a single image \"\n                                 \"or three images.\")\n            image = [image1]\n        else:\n            image = [image1, image2, image3]\n\n        if pedestal is not None:\n            try:\n                len(pedestal)\n            except TypeError:\n                pedestal = 3*[pedestal]\n\n            if len(pedestal) != 3:\n                raise ValueError(\"please provide 1 or 3 pedestals.\")\n\n            image = list(image)        # needs to be mutable\n            for i, im in enumerate(image):\n                if pedestal[i] != 0.0:\n                    image[i] = im - pedestal[i]  # n.b. a copy\n        else:\n            pedestal = len(image)*[0.0]\n\n        image = compute_intensity(*image)\n\n        zscale_limits = ZScaleInterval().get_limits(image)\n        zscale = LinearMapping(*zscale_limits, image=image)\n        stretch = zscale.maximum - zscale.minimum[0]  # zscale.minimum is always a triple\n        minimum = zscale.minimum\n\n        for i, level in enumerate(pedestal):\n            minimum[i] += level\n\n        AsinhMapping.__init__(self, minimum, stretch, Q)\n        self._image = image"},{"col":0,"comment":"null","endLoc":96,"header":"def select_step_scalar(dv)","id":16069,"name":"select_step_scalar","nodeType":"Function","startLoc":85,"text":"def select_step_scalar(dv):\n\n    log10_dv = np.log10(dv)\n\n    base = np.floor(log10_dv)\n    frac = log10_dv - base\n\n    steps = np.log10([1, 2, 5, 10])\n\n    imin = np.argmin(np.abs(frac - steps))\n\n    return 10. ** (base + steps[imin])"},{"col":4,"comment":"\n        ","endLoc":327,"header":"def __init__(self, image1, image2=None, image3=None, Q=8, pedestal=None)","id":16070,"name":"__init__","nodeType":"Function","startLoc":288,"text":"def __init__(self, image1, image2=None, image3=None, Q=8, pedestal=None):\n        \"\"\"\n        \"\"\"\n\n        if image2 is None or image3 is None:\n            if not (image2 is None and image3 is None):\n                raise ValueError(\"please specify either a single image \"\n                                 \"or three images.\")\n            image = [image1]\n        else:\n            image = [image1, image2, image3]\n\n        if pedestal is not None:\n            try:\n                len(pedestal)\n            except TypeError:\n                pedestal = 3*[pedestal]\n\n            if len(pedestal) != 3:\n                raise ValueError(\"please provide 1 or 3 pedestals.\")\n\n            image = list(image)        # needs to be mutable\n            for i, im in enumerate(image):\n                if pedestal[i] != 0.0:\n                    image[i] = im - pedestal[i]  # n.b. a copy\n        else:\n            pedestal = len(image)*[0.0]\n\n        image = compute_intensity(*image)\n\n        zscale_limits = ZScaleInterval().get_limits(image)\n        zscale = LinearMapping(*zscale_limits, image=image)\n        stretch = zscale.maximum - zscale.minimum[0]  # zscale.minimum is always a triple\n        minimum = zscale.minimum\n\n        for i, level in enumerate(pedestal):\n            minimum[i] += level\n\n        AsinhMapping.__init__(self, minimum, stretch, Q)\n        self._image = image"},{"className":"InvertedLogStretch","col":0,"comment":"\n    Inverse transformation for `~astropy.image.scaling.LogStretch`.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{e^{y \\log{a + 1}} - 1}{a} \\\\\n        y = \\frac{e^{y} (a + 1) - 1}{a}\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  ``a`` must be\n        greater than 0.  Default is 1000.\n    ","endLoc":471,"id":16072,"nodeType":"Class","startLoc":437,"text":"class InvertedLogStretch(BaseStretch):\n    r\"\"\"\n    Inverse transformation for `~astropy.image.scaling.LogStretch`.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{e^{y \\log{a + 1}} - 1}{a} \\\\\n        y = \\frac{e^{y} (a + 1) - 1}{a}\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  ``a`` must be\n        greater than 0.  Default is 1000.\n    \"\"\"\n\n    def __init__(self, a):\n        super().__init__()\n        if a <= 0:  # singularity\n            raise ValueError(\"a must be > 0\")\n        self.exp = a\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.multiply(values, np.log(self.exp + 1.), out=values)\n        np.exp(values, out=values)\n        np.subtract(values, 1., out=values)\n        np.true_divide(values, self.exp, out=values)\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return LogStretch(self.exp)"},{"col":4,"comment":"null","endLoc":466,"header":"def __call__(self, values, clip=True, out=None)","id":16073,"name":"__call__","nodeType":"Function","startLoc":460,"text":"def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.multiply(values, np.log(self.exp + 1.), out=values)\n        np.exp(values, out=values)\n        np.subtract(values, 1., out=values)\n        np.true_divide(values, self.exp, out=values)\n        return values"},{"fileName":"__init__.py","filePath":"astropy/visualization/scripts","id":16074,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n"},{"id":16075,"name":"astropy/visualization/scripts/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/visualization/scripts/tests","id":16076,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n"},{"id":16077,"name":"astropy/visualization/wcsaxes","nodeType":"Package"},{"fileName":"ticks.py","filePath":"astropy/visualization/wcsaxes","id":16078,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom collections import defaultdict\n\nimport numpy as np\n\nfrom matplotlib.lines import Path, Line2D\nfrom matplotlib.transforms import Affine2D\nfrom matplotlib import rcParams\n\n\nclass Ticks(Line2D):\n    \"\"\"\n    Ticks are derived from Line2D, and note that ticks themselves\n    are markers. Thus, you should use set_mec, set_mew, etc.\n\n    To change the tick size (length), you need to use\n    set_ticksize. To change the direction of the ticks (ticks are\n    in opposite direction of ticklabels by default), use\n    set_tick_out(False).\n\n    Note that Matplotlib's defaults dictionary :data:`~matplotlib.rcParams`\n    contains default settings (color, size, width) of the form `xtick.*` and\n    `ytick.*`. In a WCS projection, there may not be a clear relationship\n    between axes of the projection and 'x' or 'y' axes. For this reason,\n    we read defaults from `xtick.*`. The following settings affect the\n    default appearance of ticks:\n\n    * `xtick.direction`\n    * `xtick.major.size`\n    * `xtick.major.width`\n    * `xtick.minor.size`\n    * `xtick.color`\n\n    Attributes\n    ----------\n    ticks_locs : dict\n        This is set when the ticks are drawn, and is a mapping from axis to\n        the locations of the ticks for that axis.\n    \"\"\"\n\n    def __init__(self, ticksize=None, tick_out=None, **kwargs):\n        if ticksize is None:\n            ticksize = rcParams['xtick.major.size']\n        self.set_ticksize(ticksize)\n        self.set_minor_ticksize(rcParams['xtick.minor.size'])\n        self.set_tick_out(rcParams['xtick.direction'] == 'out')\n        self.clear()\n        line2d_kwargs = {'color': rcParams['xtick.color'],\n                         'linewidth': rcParams['xtick.major.width']}\n        line2d_kwargs.update(kwargs)\n        Line2D.__init__(self, [0.], [0.], **line2d_kwargs)\n        self.set_visible_axes('all')\n        self._display_minor_ticks = False\n\n    def display_minor_ticks(self, display_minor_ticks):\n        self._display_minor_ticks = display_minor_ticks\n\n    def get_display_minor_ticks(self):\n        return self._display_minor_ticks\n\n    def set_tick_out(self, tick_out):\n        \"\"\"\n        set True if tick need to be rotated by 180 degree.\n        \"\"\"\n        self._tick_out = tick_out\n\n    def get_tick_out(self):\n        \"\"\"\n        Return True if the tick will be rotated by 180 degree.\n        \"\"\"\n        return self._tick_out\n\n    def set_ticksize(self, ticksize):\n        \"\"\"\n        set length of the ticks in points.\n        \"\"\"\n        self._ticksize = ticksize\n\n    def get_ticksize(self):\n        \"\"\"\n        Return length of the ticks in points.\n        \"\"\"\n        return self._ticksize\n\n    def set_minor_ticksize(self, ticksize):\n        \"\"\"\n        set length of the minor ticks in points.\n        \"\"\"\n        self._minor_ticksize = ticksize\n\n    def get_minor_ticksize(self):\n        \"\"\"\n        Return length of the minor ticks in points.\n        \"\"\"\n        return self._minor_ticksize\n\n    @property\n    def out_size(self):\n        if self._tick_out:\n            return self._ticksize\n        else:\n            return 0.\n\n    def set_visible_axes(self, visible_axes):\n        self._visible_axes = visible_axes\n\n    def get_visible_axes(self):\n        if self._visible_axes == 'all':\n            return self.world.keys()\n        else:\n            return [x for x in self._visible_axes if x in self.world]\n\n    def clear(self):\n        self.world = {}\n        self.pixel = {}\n        self.angle = {}\n        self.disp = {}\n        self.minor_world = {}\n        self.minor_pixel = {}\n        self.minor_angle = {}\n        self.minor_disp = {}\n\n    def add(self, axis, world, pixel, angle, axis_displacement):\n        if axis not in self.world:\n            self.world[axis] = [world]\n            self.pixel[axis] = [pixel]\n            self.angle[axis] = [angle]\n            self.disp[axis] = [axis_displacement]\n        else:\n            self.world[axis].append(world)\n            self.pixel[axis].append(pixel)\n            self.angle[axis].append(angle)\n            self.disp[axis].append(axis_displacement)\n\n    def get_minor_world(self):\n        return self.minor_world\n\n    def add_minor(self, minor_axis, minor_world, minor_pixel, minor_angle,\n                  minor_axis_displacement):\n        if minor_axis not in self.minor_world:\n            self.minor_world[minor_axis] = [minor_world]\n            self.minor_pixel[minor_axis] = [minor_pixel]\n            self.minor_angle[minor_axis] = [minor_angle]\n            self.minor_disp[minor_axis] = [minor_axis_displacement]\n        else:\n            self.minor_world[minor_axis].append(minor_world)\n            self.minor_pixel[minor_axis].append(minor_pixel)\n            self.minor_angle[minor_axis].append(minor_angle)\n            self.minor_disp[minor_axis].append(minor_axis_displacement)\n\n    def __len__(self):\n        return len(self.world)\n\n    _tickvert_path = Path([[0., 0.], [1., 0.]])\n\n    def draw(self, renderer):\n        \"\"\"\n        Draw the ticks.\n        \"\"\"\n        self.ticks_locs = defaultdict(list)\n\n        if not self.get_visible():\n            return\n\n        offset = renderer.points_to_pixels(self.get_ticksize())\n        self._draw_ticks(renderer, self.pixel, self.angle, offset)\n        if self._display_minor_ticks:\n            offset = renderer.points_to_pixels(self.get_minor_ticksize())\n            self._draw_ticks(renderer, self.minor_pixel, self.minor_angle, offset)\n\n    def _draw_ticks(self, renderer, pixel_array, angle_array, offset):\n        \"\"\"\n        Draw the minor ticks.\n        \"\"\"\n        path_trans = self.get_transform()\n\n        gc = renderer.new_gc()\n        gc.set_foreground(self.get_color())\n        gc.set_alpha(self.get_alpha())\n        gc.set_linewidth(self.get_linewidth())\n\n        marker_scale = Affine2D().scale(offset, offset)\n        marker_rotation = Affine2D()\n        marker_transform = marker_scale + marker_rotation\n\n        initial_angle = 180. if self.get_tick_out() else 0.\n\n        for axis in self.get_visible_axes():\n\n            if axis not in pixel_array:\n                continue\n\n            for loc, angle in zip(pixel_array[axis], angle_array[axis]):\n\n                # Set the rotation for this tick\n                marker_rotation.rotate_deg(initial_angle + angle)\n\n                # Draw the markers\n                locs = path_trans.transform_non_affine(np.array([loc, loc]))\n                renderer.draw_markers(gc, self._tickvert_path, marker_transform,\n                                      Path(locs), path_trans.get_affine())\n\n                # Reset the tick rotation before moving to the next tick\n                marker_rotation.clear()\n\n                self.ticks_locs[axis].append(locs)\n\n        gc.restore()\n"},{"col":4,"comment":"null","endLoc":111,"header":"def _set_limits(self, data)","id":16079,"name":"_set_limits","nodeType":"Function","startLoc":96,"text":"def _set_limits(self, data):\n        if self.vmin is not None and self.vmax is not None:\n            return\n\n        # Define vmin and vmax from the interval class if not None\n        if self.interval is None:\n            if self.vmin is None:\n                self.vmin = np.min(data[np.isfinite(data)])\n            if self.vmax is None:\n                self.vmax = np.max(data[np.isfinite(data)])\n        else:\n            _vmin, _vmax = self.interval.get_limits(data)\n            if self.vmin is None:\n                self.vmin = _vmin\n            if self.vmax is None:\n                self.vmax = _vmax"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":471,"header":"@property\n    def inverse(self)","id":16080,"name":"inverse","nodeType":"Function","startLoc":468,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return LogStretch(self.exp)"},{"attributeType":"null","col":8,"comment":"null","endLoc":458,"id":16081,"name":"exp","nodeType":"Attribute","startLoc":458,"text":"self.exp"},{"className":"Ticks","col":0,"comment":"\n    Ticks are derived from Line2D, and note that ticks themselves\n    are markers. Thus, you should use set_mec, set_mew, etc.\n\n    To change the tick size (length), you need to use\n    set_ticksize. To change the direction of the ticks (ticks are\n    in opposite direction of ticklabels by default), use\n    set_tick_out(False).\n\n    Note that Matplotlib's defaults dictionary :data:`~matplotlib.rcParams`\n    contains default settings (color, size, width) of the form `xtick.*` and\n    `ytick.*`. In a WCS projection, there may not be a clear relationship\n    between axes of the projection and 'x' or 'y' axes. For this reason,\n    we read defaults from `xtick.*`. The following settings affect the\n    default appearance of ticks:\n\n    * `xtick.direction`\n    * `xtick.major.size`\n    * `xtick.major.width`\n    * `xtick.minor.size`\n    * `xtick.color`\n\n    Attributes\n    ----------\n    ticks_locs : dict\n        This is set when the ticks are drawn, and is a mapping from axis to\n        the locations of the ticks for that axis.\n    ","endLoc":209,"id":16082,"nodeType":"Class","startLoc":12,"text":"class Ticks(Line2D):\n    \"\"\"\n    Ticks are derived from Line2D, and note that ticks themselves\n    are markers. Thus, you should use set_mec, set_mew, etc.\n\n    To change the tick size (length), you need to use\n    set_ticksize. To change the direction of the ticks (ticks are\n    in opposite direction of ticklabels by default), use\n    set_tick_out(False).\n\n    Note that Matplotlib's defaults dictionary :data:`~matplotlib.rcParams`\n    contains default settings (color, size, width) of the form `xtick.*` and\n    `ytick.*`. In a WCS projection, there may not be a clear relationship\n    between axes of the projection and 'x' or 'y' axes. For this reason,\n    we read defaults from `xtick.*`. The following settings affect the\n    default appearance of ticks:\n\n    * `xtick.direction`\n    * `xtick.major.size`\n    * `xtick.major.width`\n    * `xtick.minor.size`\n    * `xtick.color`\n\n    Attributes\n    ----------\n    ticks_locs : dict\n        This is set when the ticks are drawn, and is a mapping from axis to\n        the locations of the ticks for that axis.\n    \"\"\"\n\n    def __init__(self, ticksize=None, tick_out=None, **kwargs):\n        if ticksize is None:\n            ticksize = rcParams['xtick.major.size']\n        self.set_ticksize(ticksize)\n        self.set_minor_ticksize(rcParams['xtick.minor.size'])\n        self.set_tick_out(rcParams['xtick.direction'] == 'out')\n        self.clear()\n        line2d_kwargs = {'color': rcParams['xtick.color'],\n                         'linewidth': rcParams['xtick.major.width']}\n        line2d_kwargs.update(kwargs)\n        Line2D.__init__(self, [0.], [0.], **line2d_kwargs)\n        self.set_visible_axes('all')\n        self._display_minor_ticks = False\n\n    def display_minor_ticks(self, display_minor_ticks):\n        self._display_minor_ticks = display_minor_ticks\n\n    def get_display_minor_ticks(self):\n        return self._display_minor_ticks\n\n    def set_tick_out(self, tick_out):\n        \"\"\"\n        set True if tick need to be rotated by 180 degree.\n        \"\"\"\n        self._tick_out = tick_out\n\n    def get_tick_out(self):\n        \"\"\"\n        Return True if the tick will be rotated by 180 degree.\n        \"\"\"\n        return self._tick_out\n\n    def set_ticksize(self, ticksize):\n        \"\"\"\n        set length of the ticks in points.\n        \"\"\"\n        self._ticksize = ticksize\n\n    def get_ticksize(self):\n        \"\"\"\n        Return length of the ticks in points.\n        \"\"\"\n        return self._ticksize\n\n    def set_minor_ticksize(self, ticksize):\n        \"\"\"\n        set length of the minor ticks in points.\n        \"\"\"\n        self._minor_ticksize = ticksize\n\n    def get_minor_ticksize(self):\n        \"\"\"\n        Return length of the minor ticks in points.\n        \"\"\"\n        return self._minor_ticksize\n\n    @property\n    def out_size(self):\n        if self._tick_out:\n            return self._ticksize\n        else:\n            return 0.\n\n    def set_visible_axes(self, visible_axes):\n        self._visible_axes = visible_axes\n\n    def get_visible_axes(self):\n        if self._visible_axes == 'all':\n            return self.world.keys()\n        else:\n            return [x for x in self._visible_axes if x in self.world]\n\n    def clear(self):\n        self.world = {}\n        self.pixel = {}\n        self.angle = {}\n        self.disp = {}\n        self.minor_world = {}\n        self.minor_pixel = {}\n        self.minor_angle = {}\n        self.minor_disp = {}\n\n    def add(self, axis, world, pixel, angle, axis_displacement):\n        if axis not in self.world:\n            self.world[axis] = [world]\n            self.pixel[axis] = [pixel]\n            self.angle[axis] = [angle]\n            self.disp[axis] = [axis_displacement]\n        else:\n            self.world[axis].append(world)\n            self.pixel[axis].append(pixel)\n            self.angle[axis].append(angle)\n            self.disp[axis].append(axis_displacement)\n\n    def get_minor_world(self):\n        return self.minor_world\n\n    def add_minor(self, minor_axis, minor_world, minor_pixel, minor_angle,\n                  minor_axis_displacement):\n        if minor_axis not in self.minor_world:\n            self.minor_world[minor_axis] = [minor_world]\n            self.minor_pixel[minor_axis] = [minor_pixel]\n            self.minor_angle[minor_axis] = [minor_angle]\n            self.minor_disp[minor_axis] = [minor_axis_displacement]\n        else:\n            self.minor_world[minor_axis].append(minor_world)\n            self.minor_pixel[minor_axis].append(minor_pixel)\n            self.minor_angle[minor_axis].append(minor_angle)\n            self.minor_disp[minor_axis].append(minor_axis_displacement)\n\n    def __len__(self):\n        return len(self.world)\n\n    _tickvert_path = Path([[0., 0.], [1., 0.]])\n\n    def draw(self, renderer):\n        \"\"\"\n        Draw the ticks.\n        \"\"\"\n        self.ticks_locs = defaultdict(list)\n\n        if not self.get_visible():\n            return\n\n        offset = renderer.points_to_pixels(self.get_ticksize())\n        self._draw_ticks(renderer, self.pixel, self.angle, offset)\n        if self._display_minor_ticks:\n            offset = renderer.points_to_pixels(self.get_minor_ticksize())\n            self._draw_ticks(renderer, self.minor_pixel, self.minor_angle, offset)\n\n    def _draw_ticks(self, renderer, pixel_array, angle_array, offset):\n        \"\"\"\n        Draw the minor ticks.\n        \"\"\"\n        path_trans = self.get_transform()\n\n        gc = renderer.new_gc()\n        gc.set_foreground(self.get_color())\n        gc.set_alpha(self.get_alpha())\n        gc.set_linewidth(self.get_linewidth())\n\n        marker_scale = Affine2D().scale(offset, offset)\n        marker_rotation = Affine2D()\n        marker_transform = marker_scale + marker_rotation\n\n        initial_angle = 180. if self.get_tick_out() else 0.\n\n        for axis in self.get_visible_axes():\n\n            if axis not in pixel_array:\n                continue\n\n            for loc, angle in zip(pixel_array[axis], angle_array[axis]):\n\n                # Set the rotation for this tick\n                marker_rotation.rotate_deg(initial_angle + angle)\n\n                # Draw the markers\n                locs = path_trans.transform_non_affine(np.array([loc, loc]))\n                renderer.draw_markers(gc, self._tickvert_path, marker_transform,\n                                      Path(locs), path_trans.get_affine())\n\n                # Reset the tick rotation before moving to the next tick\n                marker_rotation.clear()\n\n                self.ticks_locs[axis].append(locs)\n\n        gc.restore()"},{"className":"SinhStretch","col":0,"comment":"\n    A sinh stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{{\\rm sinh}(x / a)}{{\\rm sinh}(1 / a)}\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  ``a`` must be\n        greater than 0 and less than or equal to 1 (0 < a <= 1).\n        Default is 1/3.\n    ","endLoc":545,"id":16083,"nodeType":"Class","startLoc":512,"text":"class SinhStretch(BaseStretch):\n    r\"\"\"\n    A sinh stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = \\frac{{\\rm sinh}(x / a)}{{\\rm sinh}(1 / a)}\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  ``a`` must be\n        greater than 0 and less than or equal to 1 (0 < a <= 1).\n        Default is 1/3.\n    \"\"\"\n\n    def __init__(self, a=1./3.):\n        super().__init__()\n        if a <= 0 or a > 1:\n            raise ValueError(\"a must be > 0 and <= 1\")\n        self.a = a\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.true_divide(values, self.a, out=values)\n        np.sinh(values, out=values)\n        np.true_divide(values, np.sinh(1. / self.a), out=values)\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return AsinhStretch(a=1. / np.sinh(1. / self.a))"},{"col":4,"comment":"null","endLoc":540,"header":"def __call__(self, values, clip=True, out=None)","id":16084,"name":"__call__","nodeType":"Function","startLoc":535,"text":"def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.true_divide(values, self.a, out=values)\n        np.sinh(values, out=values)\n        np.true_divide(values, np.sinh(1. / self.a), out=values)\n        return values"},{"col":4,"comment":"null","endLoc":54,"header":"def __init__(self, ticksize=None, tick_out=None, **kwargs)","id":16085,"name":"__init__","nodeType":"Function","startLoc":42,"text":"def __init__(self, ticksize=None, tick_out=None, **kwargs):\n        if ticksize is None:\n            ticksize = rcParams['xtick.major.size']\n        self.set_ticksize(ticksize)\n        self.set_minor_ticksize(rcParams['xtick.minor.size'])\n        self.set_tick_out(rcParams['xtick.direction'] == 'out')\n        self.clear()\n        line2d_kwargs = {'color': rcParams['xtick.color'],\n                         'linewidth': rcParams['xtick.major.width']}\n        line2d_kwargs.update(kwargs)\n        Line2D.__init__(self, [0.], [0.], **line2d_kwargs)\n        self.set_visible_axes('all')\n        self._display_minor_ticks = False"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":545,"header":"@property\n    def inverse(self)","id":16086,"name":"inverse","nodeType":"Function","startLoc":542,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return AsinhStretch(a=1. / np.sinh(1. / self.a))"},{"attributeType":"null","col":8,"comment":"null","endLoc":533,"id":16087,"name":"a","nodeType":"Attribute","startLoc":533,"text":"self.a"},{"className":"HistEqStretch","col":0,"comment":"\n    A histogram equalization stretch.\n\n    Parameters\n    ----------\n    data : array-like\n        The data defining the equalization.\n    values : array-like, optional\n        The input image values, which should already be normalized to\n        the [0:1] range.\n    ","endLoc":583,"id":16088,"nodeType":"Class","startLoc":548,"text":"class HistEqStretch(BaseStretch):\n    \"\"\"\n    A histogram equalization stretch.\n\n    Parameters\n    ----------\n    data : array-like\n        The data defining the equalization.\n    values : array-like, optional\n        The input image values, which should already be normalized to\n        the [0:1] range.\n    \"\"\"\n\n    def __init__(self, data, values=None):\n        # Assume data is not necessarily normalized at this point\n        self.data = np.sort(data.ravel())\n        self.data = self.data[np.isfinite(self.data)]\n        vmin = self.data.min()\n        vmax = self.data.max()\n        self.data = (self.data - vmin) / (vmax - vmin)\n\n        # Compute relative position of each pixel\n        if values is None:\n            self.values = np.linspace(0., 1., len(self.data))\n        else:\n            self.values = values\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        values[:] = np.interp(values, self.data, self.values)\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return InvertedHistEqStretch(self.data, values=self.values)"},{"col":4,"comment":"null","endLoc":573,"header":"def __init__(self, data, values=None)","id":16089,"name":"__init__","nodeType":"Function","startLoc":561,"text":"def __init__(self, data, values=None):\n        # Assume data is not necessarily normalized at this point\n        self.data = np.sort(data.ravel())\n        self.data = self.data[np.isfinite(self.data)]\n        vmin = self.data.min()\n        vmax = self.data.max()\n        self.data = (self.data - vmin) / (vmax - vmin)\n\n        # Compute relative position of each pixel\n        if values is None:\n            self.values = np.linspace(0., 1., len(self.data))\n        else:\n            self.values = values"},{"col":4,"comment":"\n        Transform values using this normalization.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values.\n        clip : bool, optional\n            If `True`, values outside the [0:1] range are clipped to the\n            [0:1] range.  If `None` then the ``clip`` value from the\n            `ImageNormalize` instance is used (the default of which is\n            `False`).\n        invalid : None or float, optional\n            Value to assign NaN values generated by this class.  NaNs in\n            the input ``data`` array are not changed.  For matplotlib\n            normalization, the ``invalid`` value should map to the\n            matplotlib colormap \"under\" value (i.e., any finite value <\n            0).  If `None`, then the `ImageNormalize` instance value is\n            used.  This keyword has no effect if ``clip=True``.\n        ","endLoc":176,"header":"def __call__(self, values, clip=None, invalid=None)","id":16090,"name":"__call__","nodeType":"Function","startLoc":113,"text":"def __call__(self, values, clip=None, invalid=None):\n        \"\"\"\n        Transform values using this normalization.\n\n        Parameters\n        ----------\n        values : array-like\n            The input values.\n        clip : bool, optional\n            If `True`, values outside the [0:1] range are clipped to the\n            [0:1] range.  If `None` then the ``clip`` value from the\n            `ImageNormalize` instance is used (the default of which is\n            `False`).\n        invalid : None or float, optional\n            Value to assign NaN values generated by this class.  NaNs in\n            the input ``data`` array are not changed.  For matplotlib\n            normalization, the ``invalid`` value should map to the\n            matplotlib colormap \"under\" value (i.e., any finite value <\n            0).  If `None`, then the `ImageNormalize` instance value is\n            used.  This keyword has no effect if ``clip=True``.\n        \"\"\"\n\n        if clip is None:\n            clip = self.clip\n\n        if invalid is None:\n            invalid = self.invalid\n\n        if isinstance(values, ma.MaskedArray):\n            if clip:\n                mask = False\n            else:\n                mask = values.mask\n            values = values.filled(self.vmax)\n        else:\n            mask = False\n\n        # Make sure scalars get broadcast to 1-d\n        if np.isscalar(values):\n            values = np.array([values], dtype=float)\n        else:\n            # copy because of in-place operations after\n            values = np.array(values, copy=True, dtype=float)\n\n        # Define vmin and vmax if not None\n        self._set_limits(values)\n\n        # Normalize based on vmin and vmax\n        np.subtract(values, self.vmin, out=values)\n        np.true_divide(values, self.vmax - self.vmin, out=values)\n\n        # Clip to the 0 to 1 range\n        if clip:\n            values = np.clip(values, 0., 1., out=values)\n\n        # Stretch values\n        if self.stretch._supports_invalid_kw:\n            values = self.stretch(values, out=values, clip=False,\n                                  invalid=invalid)\n        else:\n            values = self.stretch(values, out=values, clip=False)\n\n        # Convert to masked array for matplotlib\n        return ma.array(values, mask=mask)"},{"col":4,"comment":"\n        set length of the ticks in points.\n        ","endLoc":78,"header":"def set_ticksize(self, ticksize)","id":16091,"name":"set_ticksize","nodeType":"Function","startLoc":74,"text":"def set_ticksize(self, ticksize):\n        \"\"\"\n        set length of the ticks in points.\n        \"\"\"\n        self._ticksize = ticksize"},{"col":0,"comment":"\n    Create a bitmap file from a FITS image, applying a stretching\n    transform between minimum and maximum cut levels and a matplotlib\n    colormap.\n\n    Parameters\n    ----------\n    filename : str\n        The filename of the FITS file.\n    ext : int\n        FITS extension name or number of the image to convert.  The\n        default is 0.\n    out_fn : str\n        The filename of the output bitmap image.  The type of bitmap\n        is determined by the filename extension (e.g. '.jpg', '.png').\n        The default is a PNG file with the same name as the FITS file.\n    stretch : {'linear', 'sqrt', 'power', log', 'asinh'}\n        The stretching function to apply to the image.  The default is\n        'linear'.\n    power : float, optional\n        The power index for ``stretch='power'``.  The default is 1.0.\n    asinh_a : float, optional\n        For ``stretch='asinh'``, the value where the asinh curve\n        transitions from linear to logarithmic behavior, expressed as a\n        fraction of the normalized image.  Must be in the range between\n        0 and 1.  The default is 0.1.\n    min_cut : float, optional\n        The pixel value of the minimum cut level.  Data values less than\n        ``min_cut`` will set to ``min_cut`` before stretching the image.\n        The default is the image minimum.  ``min_cut`` overrides\n        ``min_percent``.\n    max_cut : float, optional\n        The pixel value of the maximum cut level.  Data values greater\n        than ``min_cut`` will set to ``min_cut`` before stretching the\n        image.  The default is the image maximum.  ``max_cut`` overrides\n        ``max_percent``.\n    min_percent : float, optional\n        The percentile value used to determine the pixel value of\n        minimum cut level.  The default is 0.0.  ``min_percent``\n        overrides ``percent``.\n    max_percent : float, optional\n        The percentile value used to determine the pixel value of\n        maximum cut level.  The default is 100.0.  ``max_percent``\n        overrides ``percent``.\n    percent : float, optional\n        The percentage of the image values used to determine the pixel\n        values of the minimum and maximum cut levels.  The lower cut\n        level will set at the ``(100 - percent) / 2`` percentile, while\n        the upper cut level will be set at the ``(100 + percent) / 2``\n        percentile.  The default is 100.0.  ``percent`` is ignored if\n        either ``min_percent`` or ``max_percent`` is input.\n    cmap : str\n        The matplotlib color map name.  The default is 'Greys_r'.\n    ","endLoc":110,"header":"def fits2bitmap(filename, ext=0, out_fn=None, stretch='linear',\n                power=1.0, asinh_a=0.1, min_cut=None, max_cut=None,\n                min_percent=None, max_percent=None, percent=None,\n                cmap='Greys_r')","id":16092,"name":"fits2bitmap","nodeType":"Function","startLoc":10,"text":"def fits2bitmap(filename, ext=0, out_fn=None, stretch='linear',\n                power=1.0, asinh_a=0.1, min_cut=None, max_cut=None,\n                min_percent=None, max_percent=None, percent=None,\n                cmap='Greys_r'):\n    \"\"\"\n    Create a bitmap file from a FITS image, applying a stretching\n    transform between minimum and maximum cut levels and a matplotlib\n    colormap.\n\n    Parameters\n    ----------\n    filename : str\n        The filename of the FITS file.\n    ext : int\n        FITS extension name or number of the image to convert.  The\n        default is 0.\n    out_fn : str\n        The filename of the output bitmap image.  The type of bitmap\n        is determined by the filename extension (e.g. '.jpg', '.png').\n        The default is a PNG file with the same name as the FITS file.\n    stretch : {'linear', 'sqrt', 'power', log', 'asinh'}\n        The stretching function to apply to the image.  The default is\n        'linear'.\n    power : float, optional\n        The power index for ``stretch='power'``.  The default is 1.0.\n    asinh_a : float, optional\n        For ``stretch='asinh'``, the value where the asinh curve\n        transitions from linear to logarithmic behavior, expressed as a\n        fraction of the normalized image.  Must be in the range between\n        0 and 1.  The default is 0.1.\n    min_cut : float, optional\n        The pixel value of the minimum cut level.  Data values less than\n        ``min_cut`` will set to ``min_cut`` before stretching the image.\n        The default is the image minimum.  ``min_cut`` overrides\n        ``min_percent``.\n    max_cut : float, optional\n        The pixel value of the maximum cut level.  Data values greater\n        than ``min_cut`` will set to ``min_cut`` before stretching the\n        image.  The default is the image maximum.  ``max_cut`` overrides\n        ``max_percent``.\n    min_percent : float, optional\n        The percentile value used to determine the pixel value of\n        minimum cut level.  The default is 0.0.  ``min_percent``\n        overrides ``percent``.\n    max_percent : float, optional\n        The percentile value used to determine the pixel value of\n        maximum cut level.  The default is 100.0.  ``max_percent``\n        overrides ``percent``.\n    percent : float, optional\n        The percentage of the image values used to determine the pixel\n        values of the minimum and maximum cut levels.  The lower cut\n        level will set at the ``(100 - percent) / 2`` percentile, while\n        the upper cut level will be set at the ``(100 + percent) / 2``\n        percentile.  The default is 100.0.  ``percent`` is ignored if\n        either ``min_percent`` or ``max_percent`` is input.\n    cmap : str\n        The matplotlib color map name.  The default is 'Greys_r'.\n    \"\"\"\n\n    import matplotlib\n    import matplotlib.cm as cm\n    import matplotlib.image as mimg\n\n    # __main__ gives ext as a string\n    try:\n        ext = int(ext)\n    except ValueError:\n        pass\n\n    try:\n        image = getdata(filename, ext)\n    except Exception as e:\n        log.critical(e)\n        return 1\n\n    if image.ndim != 2:\n        log.critical(f'data in FITS extension {ext} is not a 2D array')\n\n    if out_fn is None:\n        out_fn = os.path.splitext(filename)[0]\n        if out_fn.endswith('.fits'):\n            out_fn = os.path.splitext(out_fn)[0]\n        out_fn += '.png'\n\n    # explicitly define the output format\n    out_format = os.path.splitext(out_fn)[1][1:]\n\n    try:\n        cm.get_cmap(cmap)\n    except ValueError:\n        log.critical(f'{cmap} is not a valid matplotlib colormap name.')\n        return 1\n\n    norm = simple_norm(image, stretch=stretch, power=power, asinh_a=asinh_a,\n                       min_cut=min_cut, max_cut=max_cut,\n                       min_percent=min_percent, max_percent=max_percent,\n                       percent=percent)\n\n    mimg.imsave(out_fn, norm(image), cmap=cmap, origin='lower',\n                format=out_format)\n    log.info(f'Saved file to {out_fn}.')"},{"attributeType":"null","col":8,"comment":"null","endLoc":327,"id":16093,"name":"_image","nodeType":"Attribute","startLoc":327,"text":"self._image"},{"col":4,"comment":"\n        set length of the minor ticks in points.\n        ","endLoc":90,"header":"def set_minor_ticksize(self, ticksize)","id":16094,"name":"set_minor_ticksize","nodeType":"Function","startLoc":86,"text":"def set_minor_ticksize(self, ticksize):\n        \"\"\"\n        set length of the minor ticks in points.\n        \"\"\"\n        self._minor_ticksize = ticksize"},{"col":4,"comment":"\n        set True if tick need to be rotated by 180 degree.\n        ","endLoc":66,"header":"def set_tick_out(self, tick_out)","id":16095,"name":"set_tick_out","nodeType":"Function","startLoc":62,"text":"def set_tick_out(self, tick_out):\n        \"\"\"\n        set True if tick need to be rotated by 180 degree.\n        \"\"\"\n        self._tick_out = tick_out"},{"col":4,"comment":"null","endLoc":122,"header":"def clear(self)","id":16096,"name":"clear","nodeType":"Function","startLoc":114,"text":"def clear(self):\n        self.world = {}\n        self.pixel = {}\n        self.angle = {}\n        self.disp = {}\n        self.minor_world = {}\n        self.minor_pixel = {}\n        self.minor_angle = {}\n        self.minor_disp = {}"},{"col":4,"comment":"null","endLoc":106,"header":"def set_visible_axes(self, visible_axes)","id":16097,"name":"set_visible_axes","nodeType":"Function","startLoc":105,"text":"def set_visible_axes(self, visible_axes):\n        self._visible_axes = visible_axes"},{"col":4,"comment":"null","endLoc":57,"header":"def display_minor_ticks(self, display_minor_ticks)","id":16098,"name":"display_minor_ticks","nodeType":"Function","startLoc":56,"text":"def display_minor_ticks(self, display_minor_ticks):\n        self._display_minor_ticks = display_minor_ticks"},{"col":4,"comment":"null","endLoc":60,"header":"def get_display_minor_ticks(self)","id":16099,"name":"get_display_minor_ticks","nodeType":"Function","startLoc":59,"text":"def get_display_minor_ticks(self):\n        return self._display_minor_ticks"},{"col":4,"comment":"\n        Return True if the tick will be rotated by 180 degree.\n        ","endLoc":72,"header":"def get_tick_out(self)","id":16100,"name":"get_tick_out","nodeType":"Function","startLoc":68,"text":"def get_tick_out(self):\n        \"\"\"\n        Return True if the tick will be rotated by 180 degree.\n        \"\"\"\n        return self._tick_out"},{"col":4,"comment":"\n        Return length of the ticks in points.\n        ","endLoc":84,"header":"def get_ticksize(self)","id":16101,"name":"get_ticksize","nodeType":"Function","startLoc":80,"text":"def get_ticksize(self):\n        \"\"\"\n        Return length of the ticks in points.\n        \"\"\"\n        return self._ticksize"},{"col":4,"comment":"\n        Return length of the minor ticks in points.\n        ","endLoc":96,"header":"def get_minor_ticksize(self)","id":16102,"name":"get_minor_ticksize","nodeType":"Function","startLoc":92,"text":"def get_minor_ticksize(self):\n        \"\"\"\n        Return length of the minor ticks in points.\n        \"\"\"\n        return self._minor_ticksize"},{"col":4,"comment":"null","endLoc":103,"header":"@property\n    def out_size(self)","id":16103,"name":"out_size","nodeType":"Function","startLoc":98,"text":"@property\n    def out_size(self):\n        if self._tick_out:\n            return self._ticksize\n        else:\n            return 0."},{"col":4,"comment":"null","endLoc":112,"header":"def get_visible_axes(self)","id":16104,"name":"get_visible_axes","nodeType":"Function","startLoc":108,"text":"def get_visible_axes(self):\n        if self._visible_axes == 'all':\n            return self.world.keys()\n        else:\n            return [x for x in self._visible_axes if x in self.world]"},{"col":4,"comment":"null","endLoc":578,"header":"def __call__(self, values, clip=True, out=None)","id":16105,"name":"__call__","nodeType":"Function","startLoc":575,"text":"def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        values[:] = np.interp(values, self.data, self.values)\n        return values"},{"col":4,"comment":"null","endLoc":134,"header":"def add(self, axis, world, pixel, angle, axis_displacement)","id":16106,"name":"add","nodeType":"Function","startLoc":124,"text":"def add(self, axis, world, pixel, angle, axis_displacement):\n        if axis not in self.world:\n            self.world[axis] = [world]\n            self.pixel[axis] = [pixel]\n            self.angle[axis] = [angle]\n            self.disp[axis] = [axis_displacement]\n        else:\n            self.world[axis].append(world)\n            self.pixel[axis].append(pixel)\n            self.angle[axis].append(angle)\n            self.disp[axis].append(axis_displacement)"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":583,"header":"@property\n    def inverse(self)","id":16107,"name":"inverse","nodeType":"Function","startLoc":580,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return InvertedHistEqStretch(self.data, values=self.values)"},{"col":0,"comment":"null","endLoc":82,"header":"def select_step_hour(dv)","id":16108,"name":"select_step_hour","nodeType":"Function","startLoc":50,"text":"def select_step_hour(dv):\n\n    if dv > 15. * u.arcsec:\n\n        hour_limits_ = [1.5, 2.5, 3.5, 5, 7, 10, 15, 21, 36]\n        hour_steps_ = [1, 2, 3, 4, 6, 8, 12, 18, 24]\n        hour_units = [u.hourangle] * len(hour_steps_)\n\n        minsec_limits_ = [1.5, 2.5, 3.5, 4.5, 5.5, 8, 11, 14, 18, 25, 45]\n        minsec_steps_ = [1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30]\n\n        minute_limits_ = np.array(minsec_limits_) / 60.\n        minute_units = [15. * u.arcmin] * len(minute_limits_)\n\n        second_limits_ = np.array(minsec_limits_) / 3600.\n        second_units = [15. * u.arcsec] * len(second_limits_)\n\n        hour_limits = np.concatenate([second_limits_,\n                                      minute_limits_,\n                                      hour_limits_])\n\n        hour_steps = minsec_steps_ + minsec_steps_ + hour_steps_\n        hour_units = second_units + minute_units + hour_units\n\n        n = hour_limits.searchsorted(dv.to(u.hourangle))\n        step = hour_steps[n]\n        unit = hour_units[n]\n\n        return step * unit\n\n    else:\n\n        return select_step_scalar(dv.to_value(15. * u.arcsec)) * (15. * u.arcsec)"},{"col":4,"comment":"null","endLoc":604,"header":"def __init__(self, data, values=None)","id":16109,"name":"__init__","nodeType":"Function","startLoc":599,"text":"def __init__(self, data, values=None):\n        self.data = data[np.isfinite(data)]\n        if values is None:\n            self.values = np.linspace(0., 1., len(self.data))\n        else:\n            self.values = values"},{"attributeType":"null","col":8,"comment":"null","endLoc":567,"id":16110,"name":"data","nodeType":"Attribute","startLoc":567,"text":"self.data"},{"col":4,"comment":"null","endLoc":187,"header":"def inverse(self, values, invalid=None)","id":16111,"name":"inverse","nodeType":"Function","startLoc":178,"text":"def inverse(self, values, invalid=None):\n        # Find unstretched values in range 0 to 1\n        if self.inverse_stretch._supports_invalid_kw:\n            values_norm = self.inverse_stretch(values, clip=False,\n                                               invalid=invalid)\n        else:\n            values_norm = self.inverse_stretch(values, clip=False)\n\n        # Scale to original range\n        return values_norm * (self.vmax - self.vmin) + self.vmin"},{"attributeType":"null","col":12,"comment":"null","endLoc":573,"id":16112,"name":"values","nodeType":"Attribute","startLoc":573,"text":"self.values"},{"col":0,"comment":"null","endLoc":164,"header":"def main(args=None)","id":16113,"name":"main","nodeType":"Function","startLoc":113,"text":"def main(args=None):\n\n    import argparse\n\n    parser = argparse.ArgumentParser(\n        description='Create a bitmap file from a FITS image.')\n    parser.add_argument('-e', '--ext', metavar='hdu', default=0,\n                        help='Specify the HDU extension number or name '\n                             '(Default is 0).')\n    parser.add_argument('-o', metavar='filename', type=str, default=None,\n                        help='Filename for the output image (Default is a '\n                        'PNG file with the same name as the FITS file).')\n    parser.add_argument('--stretch', type=str, default='linear',\n                        help='Type of image stretching (\"linear\", \"sqrt\", '\n                        '\"power\", \"log\", or \"asinh\") (Default is \"linear\").')\n    parser.add_argument('--power', type=float, default=1.0,\n                        help='Power index for \"power\" stretching (Default is '\n                             '1.0).')\n    parser.add_argument('--asinh_a', type=float, default=0.1,\n                        help='The value in normalized image where the asinh '\n                             'curve transitions from linear to logarithmic '\n                             'behavior (used only for \"asinh\" stretch) '\n                             '(Default is 0.1).')\n    parser.add_argument('--min_cut', type=float, default=None,\n                        help='The pixel value of the minimum cut level '\n                             '(Default is the image minimum).')\n    parser.add_argument('--max_cut', type=float, default=None,\n                        help='The pixel value of the maximum cut level '\n                             '(Default is the image maximum).')\n    parser.add_argument('--min_percent', type=float, default=None,\n                        help='The percentile value used to determine the '\n                             'minimum cut level (Default is 0).')\n    parser.add_argument('--max_percent', type=float, default=None,\n                        help='The percentile value used to determine the '\n                             'maximum cut level (Default is 100).')\n    parser.add_argument('--percent', type=float, default=None,\n                        help='The percentage of the image values used to '\n                             'determine the pixel values of the minimum and '\n                             'maximum cut levels (Default is 100).')\n    parser.add_argument('--cmap', metavar='colormap_name', type=str,\n                        default='Greys_r', help='matplotlib color map name '\n                                                '(Default is \"Greys_r\").')\n    parser.add_argument('filename', nargs='+',\n                        help='Path to one or more FITS files to convert')\n    args = parser.parse_args(args)\n\n    for filename in args.filename:\n        fits2bitmap(filename, ext=args.ext, out_fn=args.o,\n                    stretch=args.stretch, min_cut=args.min_cut,\n                    max_cut=args.max_cut, min_percent=args.min_percent,\n                    max_percent=args.max_percent, percent=args.percent,\n                    power=args.power, asinh_a=args.asinh_a, cmap=args.cmap)"},{"attributeType":"BaseStretch","col":8,"comment":"null","endLoc":81,"id":16114,"name":"stretch","nodeType":"Attribute","startLoc":81,"text":"self.stretch"},{"attributeType":"null","col":8,"comment":"null","endLoc":88,"id":16115,"name":"inverse_stretch","nodeType":"Attribute","startLoc":88,"text":"self.inverse_stretch"},{"attributeType":"null","col":8,"comment":"null","endLoc":90,"id":16116,"name":"invalid","nodeType":"Attribute","startLoc":90,"text":"self.invalid"},{"className":"InvertedHistEqStretch","col":0,"comment":"\n    Inverse transformation for `~astropy.image.scaling.HistEqStretch`.\n\n    Parameters\n    ----------\n    data : array-like\n        The data defining the equalization.\n    values : array-like, optional\n        The input image values, which should already be normalized to\n        the [0:1] range.\n    ","endLoc":614,"id":16117,"nodeType":"Class","startLoc":586,"text":"class InvertedHistEqStretch(BaseStretch):\n    \"\"\"\n    Inverse transformation for `~astropy.image.scaling.HistEqStretch`.\n\n    Parameters\n    ----------\n    data : array-like\n        The data defining the equalization.\n    values : array-like, optional\n        The input image values, which should already be normalized to\n        the [0:1] range.\n    \"\"\"\n\n    def __init__(self, data, values=None):\n        self.data = data[np.isfinite(data)]\n        if values is None:\n            self.values = np.linspace(0., 1., len(self.data))\n        else:\n            self.values = values\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        values[:] = np.interp(values, self.values, self.data)\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return HistEqStretch(self.data, values=self.values)"},{"col":4,"comment":"null","endLoc":609,"header":"def __call__(self, values, clip=True, out=None)","id":16118,"name":"__call__","nodeType":"Function","startLoc":606,"text":"def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        values[:] = np.interp(values, self.values, self.data)\n        return values"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":614,"header":"@property\n    def inverse(self)","id":16119,"name":"inverse","nodeType":"Function","startLoc":611,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return HistEqStretch(self.data, values=self.values)"},{"attributeType":"null","col":8,"comment":"null","endLoc":74,"id":16120,"name":"vmax","nodeType":"Attribute","startLoc":74,"text":"self.vmax"},{"col":4,"comment":"null","endLoc":137,"header":"def get_minor_world(self)","id":16121,"name":"get_minor_world","nodeType":"Function","startLoc":136,"text":"def get_minor_world(self):\n        return self.minor_world"},{"col":4,"comment":"null","endLoc":150,"header":"def add_minor(self, minor_axis, minor_world, minor_pixel, minor_angle,\n                  minor_axis_displacement)","id":16122,"name":"add_minor","nodeType":"Function","startLoc":139,"text":"def add_minor(self, minor_axis, minor_world, minor_pixel, minor_angle,\n                  minor_axis_displacement):\n        if minor_axis not in self.minor_world:\n            self.minor_world[minor_axis] = [minor_world]\n            self.minor_pixel[minor_axis] = [minor_pixel]\n            self.minor_angle[minor_axis] = [minor_angle]\n            self.minor_disp[minor_axis] = [minor_axis_displacement]\n        else:\n            self.minor_world[minor_axis].append(minor_world)\n            self.minor_pixel[minor_axis].append(minor_pixel)\n            self.minor_angle[minor_axis].append(minor_angle)\n            self.minor_disp[minor_axis].append(minor_axis_displacement)"},{"attributeType":"null","col":8,"comment":"null","endLoc":600,"id":16123,"name":"data","nodeType":"Attribute","startLoc":600,"text":"self.data"},{"attributeType":"BaseInterval","col":8,"comment":"null","endLoc":86,"id":16124,"name":"interval","nodeType":"Attribute","startLoc":86,"text":"self.interval"},{"attributeType":"null","col":8,"comment":"null","endLoc":73,"id":16125,"name":"vmin","nodeType":"Attribute","startLoc":73,"text":"self.vmin"},{"attributeType":"null","col":12,"comment":"null","endLoc":604,"id":16126,"name":"values","nodeType":"Attribute","startLoc":604,"text":"self.values"},{"className":"ContrastBiasStretch","col":0,"comment":"\n    A stretch that takes into account contrast and bias.\n\n    The stretch is given by:\n\n    .. math::\n        y = (x - {\\rm bias}) * {\\rm contrast} + 0.5\n\n    and the output values are clipped to the [0:1] range.\n\n    Parameters\n    ----------\n    contrast : float\n        The contrast parameter (see the above formula).\n\n    bias : float\n        The bias parameter (see the above formula).\n    ","endLoc":659,"id":16127,"nodeType":"Class","startLoc":617,"text":"class ContrastBiasStretch(BaseStretch):\n    r\"\"\"\n    A stretch that takes into account contrast and bias.\n\n    The stretch is given by:\n\n    .. math::\n        y = (x - {\\rm bias}) * {\\rm contrast} + 0.5\n\n    and the output values are clipped to the [0:1] range.\n\n    Parameters\n    ----------\n    contrast : float\n        The contrast parameter (see the above formula).\n\n    bias : float\n        The bias parameter (see the above formula).\n    \"\"\"\n\n    def __init__(self, contrast, bias):\n        super().__init__()\n        self.contrast = contrast\n        self.bias = bias\n\n    def __call__(self, values, clip=True, out=None):\n        # As a special case here, we only clip *after* the\n        # transformation since it does not map [0:1] to [0:1]\n        values = _prepare(values, clip=False, out=out)\n\n        np.subtract(values, self.bias, out=values)\n        np.multiply(values, self.contrast, out=values)\n        np.add(values, 0.5, out=values)\n\n        if clip:\n            np.clip(values, 0, 1, out=values)\n\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return InvertedContrastBiasStretch(self.contrast, self.bias)"},{"col":4,"comment":"null","endLoc":640,"header":"def __init__(self, contrast, bias)","id":16128,"name":"__init__","nodeType":"Function","startLoc":637,"text":"def __init__(self, contrast, bias):\n        super().__init__()\n        self.contrast = contrast\n        self.bias = bias"},{"col":4,"comment":"null","endLoc":654,"header":"def __call__(self, values, clip=True, out=None)","id":16129,"name":"__call__","nodeType":"Function","startLoc":642,"text":"def __call__(self, values, clip=True, out=None):\n        # As a special case here, we only clip *after* the\n        # transformation since it does not map [0:1] to [0:1]\n        values = _prepare(values, clip=False, out=out)\n\n        np.subtract(values, self.bias, out=values)\n        np.multiply(values, self.contrast, out=values)\n        np.add(values, 0.5, out=values)\n\n        if clip:\n            np.clip(values, 0, 1, out=values)\n\n        return values"},{"fileName":"frame.py","filePath":"astropy/visualization/wcsaxes","id":16131,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport abc\nfrom collections import OrderedDict\n\nimport numpy as np\n\n\nfrom matplotlib import rcParams\nfrom matplotlib.lines import Line2D, Path\nfrom matplotlib.patches import PathPatch\n\n__all__ = ['RectangularFrame1D', 'Spine', 'BaseFrame', 'RectangularFrame', 'EllipticalFrame']\n\n\nclass Spine:\n    \"\"\"\n    A single side of an axes.\n\n    This does not need to be a straight line, but represents a 'side' when\n    determining which part of the frame to put labels and ticks on.\n    \"\"\"\n\n    def __init__(self, parent_axes, transform):\n\n        self.parent_axes = parent_axes\n        self.transform = transform\n\n        self.data = None\n        self.pixel = None\n        self.world = None\n\n    @property\n    def data(self):\n        return self._data\n\n    @data.setter\n    def data(self, value):\n        if value is None:\n            self._data = None\n            self._pixel = None\n            self._world = None\n        else:\n            self._data = value\n            self._pixel = self.parent_axes.transData.transform(self._data)\n            with np.errstate(invalid='ignore'):\n                self._world = self.transform.transform(self._data)\n            self._update_normal()\n\n    @property\n    def pixel(self):\n        return self._pixel\n\n    @pixel.setter\n    def pixel(self, value):\n        if value is None:\n            self._data = None\n            self._pixel = None\n            self._world = None\n        else:\n            self._data = self.parent_axes.transData.inverted().transform(self._data)\n            self._pixel = value\n            self._world = self.transform.transform(self._data)\n            self._update_normal()\n\n    @property\n    def world(self):\n        return self._world\n\n    @world.setter\n    def world(self, value):\n        if value is None:\n            self._data = None\n            self._pixel = None\n            self._world = None\n        else:\n            self._data = self.transform.transform(value)\n            self._pixel = self.parent_axes.transData.transform(self._data)\n            self._world = value\n            self._update_normal()\n\n    def _update_normal(self):\n        # Find angle normal to border and inwards, in display coordinate\n        dx = self.pixel[1:, 0] - self.pixel[:-1, 0]\n        dy = self.pixel[1:, 1] - self.pixel[:-1, 1]\n        self.normal_angle = np.degrees(np.arctan2(dx, -dy))\n\n    def _halfway_x_y_angle(self):\n        \"\"\"\n        Return the x, y, normal_angle values halfway along the spine\n        \"\"\"\n        x_disp, y_disp = self.pixel[:, 0], self.pixel[:, 1]\n        # Get distance along the path\n        d = np.hstack([0., np.cumsum(np.sqrt(np.diff(x_disp) ** 2 + np.diff(y_disp) ** 2))])\n        xcen = np.interp(d[-1] / 2., d, x_disp)\n        ycen = np.interp(d[-1] / 2., d, y_disp)\n\n        # Find segment along which the mid-point lies\n        imin = np.searchsorted(d, d[-1] / 2.) - 1\n\n        # Find normal of the axis label facing outwards on that segment\n        normal_angle = self.normal_angle[imin] + 180.\n        return xcen, ycen, normal_angle\n\n\nclass SpineXAligned(Spine):\n    \"\"\"\n    A single side of an axes, aligned with the X data axis.\n\n    This does not need to be a straight line, but represents a 'side' when\n    determining which part of the frame to put labels and ticks on.\n    \"\"\"\n\n    @property\n    def data(self):\n        return self._data\n\n    @data.setter\n    def data(self, value):\n        if value is None:\n            self._data = None\n            self._pixel = None\n            self._world = None\n        else:\n            self._data = value\n            self._pixel = self.parent_axes.transData.transform(self._data)\n            with np.errstate(invalid='ignore'):\n                self._world = self.transform.transform(self._data[:,0:1])\n            self._update_normal()\n\n    @property\n    def pixel(self):\n        return self._pixel\n\n    @pixel.setter\n    def pixel(self, value):\n        if value is None:\n            self._data = None\n            self._pixel = None\n            self._world = None\n        else:\n            self._data = self.parent_axes.transData.inverted().transform(self._data)\n            self._pixel = value\n            self._world = self.transform.transform(self._data[:,0:1])\n            self._update_normal()\n\n\nclass BaseFrame(OrderedDict, metaclass=abc.ABCMeta):\n    \"\"\"\n    Base class for frames, which are collections of\n    :class:`~astropy.visualization.wcsaxes.frame.Spine` instances.\n    \"\"\"\n\n    spine_class = Spine\n\n    def __init__(self, parent_axes, transform, path=None):\n\n        super().__init__()\n\n        self.parent_axes = parent_axes\n        self._transform = transform\n        self._linewidth = rcParams['axes.linewidth']\n        self._color = rcParams['axes.edgecolor']\n        self._path = path\n\n        for axis in self.spine_names:\n            self[axis] = self.spine_class(parent_axes, transform)\n\n    @property\n    def origin(self):\n        ymin, ymax = self.parent_axes.get_ylim()\n        return 'lower' if ymin < ymax else 'upper'\n\n    @property\n    def transform(self):\n        return self._transform\n\n    @transform.setter\n    def transform(self, value):\n        self._transform = value\n        for axis in self:\n            self[axis].transform = value\n\n    def _update_patch_path(self):\n\n        self.update_spines()\n        x, y = [], []\n        for axis in self:\n            x.append(self[axis].data[:, 0])\n            y.append(self[axis].data[:, 1])\n        vertices = np.vstack([np.hstack(x), np.hstack(y)]).transpose()\n\n        if self._path is None:\n            self._path = Path(vertices)\n        else:\n            self._path.vertices = vertices\n\n    @property\n    def patch(self):\n        self._update_patch_path()\n        return PathPatch(self._path, transform=self.parent_axes.transData,\n                         facecolor=rcParams['axes.facecolor'], edgecolor='white')\n\n    def draw(self, renderer):\n        for axis in self:\n            x, y = self[axis].pixel[:, 0], self[axis].pixel[:, 1]\n            line = Line2D(x, y, linewidth=self._linewidth, color=self._color, zorder=1000)\n            line.draw(renderer)\n\n    def sample(self, n_samples):\n\n        self.update_spines()\n\n        spines = OrderedDict()\n\n        for axis in self:\n\n            data = self[axis].data\n            p = np.linspace(0., 1., data.shape[0])\n            p_new = np.linspace(0., 1., n_samples)\n            spines[axis] = self.spine_class(self.parent_axes, self.transform)\n            spines[axis].data = np.array([np.interp(p_new, p, d) for d in data.T]).transpose()\n\n        return spines\n\n    def set_color(self, color):\n        \"\"\"\n        Sets the color of the frame.\n\n        Parameters\n        ----------\n        color : str\n            The color of the frame.\n        \"\"\"\n        self._color = color\n\n    def get_color(self):\n        return self._color\n\n    def set_linewidth(self, linewidth):\n        \"\"\"\n        Sets the linewidth of the frame.\n\n        Parameters\n        ----------\n        linewidth : float\n            The linewidth of the frame in points.\n        \"\"\"\n        self._linewidth = linewidth\n\n    def get_linewidth(self):\n        return self._linewidth\n\n    @abc.abstractmethod\n    def update_spines(self):\n        raise NotImplementedError(\"\")\n\n\nclass RectangularFrame1D(BaseFrame):\n    \"\"\"\n    A classic rectangular frame.\n    \"\"\"\n\n    spine_names = 'bt'\n    spine_class = SpineXAligned\n\n    def update_spines(self):\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        self['b'].data = np.array(([xmin, ymin], [xmax, ymin]))\n        self['t'].data = np.array(([xmax, ymax], [xmin, ymax]))\n\n    def _update_patch_path(self):\n\n        self.update_spines()\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        x = [xmin, xmax, xmax, xmin, xmin]\n        y = [ymin, ymin, ymax, ymax, ymin]\n\n        vertices = np.vstack([np.hstack(x), np.hstack(y)]).transpose()\n\n        if self._path is None:\n            self._path = Path(vertices)\n        else:\n            self._path.vertices = vertices\n\n    def draw(self, renderer):\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        x = [xmin, xmax, xmax, xmin, xmin]\n        y = [ymin, ymin, ymax, ymax, ymin]\n\n        line = Line2D(x, y, linewidth=self._linewidth, color=self._color, zorder=1000,\n                      transform=self.parent_axes.transData)\n        line.draw(renderer)\n\n\nclass RectangularFrame(BaseFrame):\n    \"\"\"\n    A classic rectangular frame.\n    \"\"\"\n\n    spine_names = 'brtl'\n\n    def update_spines(self):\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        self['b'].data = np.array(([xmin, ymin], [xmax, ymin]))\n        self['r'].data = np.array(([xmax, ymin], [xmax, ymax]))\n        self['t'].data = np.array(([xmax, ymax], [xmin, ymax]))\n        self['l'].data = np.array(([xmin, ymax], [xmin, ymin]))\n\n\nclass EllipticalFrame(BaseFrame):\n    \"\"\"\n    An elliptical frame.\n    \"\"\"\n\n    spine_names = 'chv'\n\n    def update_spines(self):\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        xmid = 0.5 * (xmax + xmin)\n        ymid = 0.5 * (ymax + ymin)\n\n        dx = xmid - xmin\n        dy = ymid - ymin\n\n        theta = np.linspace(0., 2 * np.pi, 1000)\n        self['c'].data = np.array([xmid + dx * np.cos(theta),\n                                   ymid + dy * np.sin(theta)]).transpose()\n        self['h'].data = np.array([np.linspace(xmin, xmax, 1000),\n                                   np.repeat(ymid, 1000)]).transpose()\n        self['v'].data = np.array([np.repeat(xmid, 1000),\n                                   np.linspace(ymin, ymax, 1000)]).transpose()\n\n    def _update_patch_path(self):\n        \"\"\"Override path patch to include only the outer ellipse,\n        not the major and minor axes in the middle.\"\"\"\n\n        self.update_spines()\n        vertices = self['c'].data\n\n        if self._path is None:\n            self._path = Path(vertices)\n        else:\n            self._path.vertices = vertices\n\n    def draw(self, renderer):\n        \"\"\"Override to draw only the outer ellipse,\n        not the major and minor axes in the middle.\n\n        FIXME: we may want to add a general method to give the user control\n        over which spines are drawn.\"\"\"\n        axis = 'c'\n        x, y = self[axis].pixel[:, 0], self[axis].pixel[:, 1]\n        line = Line2D(x, y, linewidth=self._linewidth, color=self._color, zorder=1000)\n        line.draw(renderer)\n"},{"col":4,"comment":"null","endLoc":153,"header":"def __len__(self)","id":16132,"name":"__len__","nodeType":"Function","startLoc":152,"text":"def __len__(self):\n        return len(self.world)"},{"col":4,"comment":"\n        Draw the ticks.\n        ","endLoc":170,"header":"def draw(self, renderer)","id":16133,"name":"draw","nodeType":"Function","startLoc":157,"text":"def draw(self, renderer):\n        \"\"\"\n        Draw the ticks.\n        \"\"\"\n        self.ticks_locs = defaultdict(list)\n\n        if not self.get_visible():\n            return\n\n        offset = renderer.points_to_pixels(self.get_ticksize())\n        self._draw_ticks(renderer, self.pixel, self.angle, offset)\n        if self._display_minor_ticks:\n            offset = renderer.points_to_pixels(self.get_minor_ticksize())\n            self._draw_ticks(renderer, self.minor_pixel, self.minor_angle, offset)"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":659,"header":"@property\n    def inverse(self)","id":16134,"name":"inverse","nodeType":"Function","startLoc":656,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return InvertedContrastBiasStretch(self.contrast, self.bias)"},{"attributeType":"null","col":8,"comment":"null","endLoc":89,"id":16135,"name":"clip","nodeType":"Attribute","startLoc":89,"text":"self.clip"},{"col":0,"comment":" A convenience function to call matplotlib's `matplotlib.pyplot.imshow`\n    function, using an `ImageNormalize` object as the normalization.\n\n    Parameters\n    ----------\n    data : 2D or 3D array-like\n        The data to show. Can be whatever `~matplotlib.pyplot.imshow` and\n        `ImageNormalize` both accept. See `~matplotlib.pyplot.imshow`.\n    ax : None or `~matplotlib.axes.Axes`, optional\n        If None, use pyplot's imshow.  Otherwise, calls ``imshow`` method of\n        the supplied axes.\n    **kwargs : dict, optional\n        All other keyword arguments are parsed first by the\n        `ImageNormalize` initializer, then to\n        `~matplotlib.pyplot.imshow`.\n\n    Returns\n    -------\n    result : tuple\n        A tuple containing the `~matplotlib.image.AxesImage` generated\n        by `~matplotlib.pyplot.imshow` as well as the `ImageNormalize`\n        instance.\n\n    Notes\n    -----\n    The ``norm`` matplotlib keyword is not supported.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n        from astropy.visualization import (imshow_norm, MinMaxInterval,\n                                           SqrtStretch)\n\n        # Generate and display a test image\n        image = np.arange(65536).reshape((256, 256))\n        fig = plt.figure()\n        ax = fig.add_subplot(1, 1, 1)\n        im, norm = imshow_norm(image, ax, origin='lower',\n                               interval=MinMaxInterval(),\n                               stretch=SqrtStretch())\n        fig.colorbar(im)\n    ","endLoc":375,"header":"def imshow_norm(data, ax=None, **kwargs)","id":16136,"name":"imshow_norm","nodeType":"Function","startLoc":306,"text":"def imshow_norm(data, ax=None, **kwargs):\n    \"\"\" A convenience function to call matplotlib's `matplotlib.pyplot.imshow`\n    function, using an `ImageNormalize` object as the normalization.\n\n    Parameters\n    ----------\n    data : 2D or 3D array-like\n        The data to show. Can be whatever `~matplotlib.pyplot.imshow` and\n        `ImageNormalize` both accept. See `~matplotlib.pyplot.imshow`.\n    ax : None or `~matplotlib.axes.Axes`, optional\n        If None, use pyplot's imshow.  Otherwise, calls ``imshow`` method of\n        the supplied axes.\n    **kwargs : dict, optional\n        All other keyword arguments are parsed first by the\n        `ImageNormalize` initializer, then to\n        `~matplotlib.pyplot.imshow`.\n\n    Returns\n    -------\n    result : tuple\n        A tuple containing the `~matplotlib.image.AxesImage` generated\n        by `~matplotlib.pyplot.imshow` as well as the `ImageNormalize`\n        instance.\n\n    Notes\n    -----\n    The ``norm`` matplotlib keyword is not supported.\n\n    Examples\n    --------\n    .. plot::\n        :include-source:\n\n        import numpy as np\n        import matplotlib.pyplot as plt\n        from astropy.visualization import (imshow_norm, MinMaxInterval,\n                                           SqrtStretch)\n\n        # Generate and display a test image\n        image = np.arange(65536).reshape((256, 256))\n        fig = plt.figure()\n        ax = fig.add_subplot(1, 1, 1)\n        im, norm = imshow_norm(image, ax, origin='lower',\n                               interval=MinMaxInterval(),\n                               stretch=SqrtStretch())\n        fig.colorbar(im)\n    \"\"\"\n    if 'X' in kwargs:\n        raise ValueError('Cannot give both ``X`` and ``data``')\n\n    if 'norm' in kwargs:\n        raise ValueError('There is no point in using imshow_norm if you give '\n                         'the ``norm`` keyword - use imshow directly if you '\n                         'want that.')\n\n    imshow_kwargs = dict(kwargs)\n\n    norm_kwargs = {'data': data}\n    for pname in _norm_sig.parameters:\n        if pname in kwargs:\n            norm_kwargs[pname] = imshow_kwargs.pop(pname)\n\n    imshow_kwargs['norm'] = ImageNormalize(**norm_kwargs)\n\n    if ax is None:\n        imshow_result = plt.imshow(data, **imshow_kwargs)\n    else:\n        imshow_result = ax.imshow(data, **imshow_kwargs)\n\n    return imshow_result, imshow_kwargs['norm']"},{"col":0,"comment":"\n    Return a Red/Green/Blue color image from up to 3 images using an asinh stretch.\n    The input images can be int or float, and in any range or bit-depth.\n\n    For a more detailed look at the use of this method, see the document\n    :ref:`astropy:astropy-visualization-rgb`.\n\n    Parameters\n    ----------\n    image_r : ndarray\n        Image to map to red.\n    image_g : ndarray\n        Image to map to green.\n    image_b : ndarray\n        Image to map to blue.\n    minimum : float\n        Intensity that should be mapped to black (a scalar or array for R, G, B).\n    stretch : float\n        The linear stretch of the image.\n    Q : float\n        The asinh softening parameter.\n    filename : str\n        Write the resulting RGB image to a file (file type determined\n        from extension).\n\n    Returns\n    -------\n    rgb : ndarray\n        RGB (integer, 8-bits per channel) color image as an NxNx3 numpy array.\n    ","endLoc":369,"header":"def make_lupton_rgb(image_r, image_g, image_b, minimum=0, stretch=5, Q=8,\n                    filename=None)","id":16137,"name":"make_lupton_rgb","nodeType":"Function","startLoc":330,"text":"def make_lupton_rgb(image_r, image_g, image_b, minimum=0, stretch=5, Q=8,\n                    filename=None):\n    \"\"\"\n    Return a Red/Green/Blue color image from up to 3 images using an asinh stretch.\n    The input images can be int or float, and in any range or bit-depth.\n\n    For a more detailed look at the use of this method, see the document\n    :ref:`astropy:astropy-visualization-rgb`.\n\n    Parameters\n    ----------\n    image_r : ndarray\n        Image to map to red.\n    image_g : ndarray\n        Image to map to green.\n    image_b : ndarray\n        Image to map to blue.\n    minimum : float\n        Intensity that should be mapped to black (a scalar or array for R, G, B).\n    stretch : float\n        The linear stretch of the image.\n    Q : float\n        The asinh softening parameter.\n    filename : str\n        Write the resulting RGB image to a file (file type determined\n        from extension).\n\n    Returns\n    -------\n    rgb : ndarray\n        RGB (integer, 8-bits per channel) color image as an NxNx3 numpy array.\n    \"\"\"\n    asinhMap = AsinhMapping(minimum, stretch, Q)\n    rgb = asinhMap.make_rgb_image(image_r, image_g, image_b)\n\n    if filename:\n        import matplotlib.image\n        matplotlib.image.imsave(filename, rgb, origin='lower')\n\n    return rgb"},{"col":4,"comment":"null","endLoc":680,"header":"def __init__(self, contrast, bias)","id":16138,"name":"__init__","nodeType":"Function","startLoc":677,"text":"def __init__(self, contrast, bias):\n        super().__init__()\n        self.contrast = contrast\n        self.bias = bias"},{"attributeType":"null","col":8,"comment":"null","endLoc":639,"id":16139,"name":"contrast","nodeType":"Attribute","startLoc":639,"text":"self.contrast"},{"attributeType":"null","col":8,"comment":"null","endLoc":640,"id":16140,"name":"bias","nodeType":"Attribute","startLoc":640,"text":"self.bias"},{"className":"Spine","col":0,"comment":"\n    A single side of an axes.\n\n    This does not need to be a straight line, but represents a 'side' when\n    determining which part of the frame to put labels and ticks on.\n    ","endLoc":104,"id":16141,"nodeType":"Class","startLoc":17,"text":"class Spine:\n    \"\"\"\n    A single side of an axes.\n\n    This does not need to be a straight line, but represents a 'side' when\n    determining which part of the frame to put labels and ticks on.\n    \"\"\"\n\n    def __init__(self, parent_axes, transform):\n\n        self.parent_axes = parent_axes\n        self.transform = transform\n\n        self.data = None\n        self.pixel = None\n        self.world = None\n\n    @property\n    def data(self):\n        return self._data\n\n    @data.setter\n    def data(self, value):\n        if value is None:\n            self._data = None\n            self._pixel = None\n            self._world = None\n        else:\n            self._data = value\n            self._pixel = self.parent_axes.transData.transform(self._data)\n            with np.errstate(invalid='ignore'):\n                self._world = self.transform.transform(self._data)\n            self._update_normal()\n\n    @property\n    def pixel(self):\n        return self._pixel\n\n    @pixel.setter\n    def pixel(self, value):\n        if value is None:\n            self._data = None\n            self._pixel = None\n            self._world = None\n        else:\n            self._data = self.parent_axes.transData.inverted().transform(self._data)\n            self._pixel = value\n            self._world = self.transform.transform(self._data)\n            self._update_normal()\n\n    @property\n    def world(self):\n        return self._world\n\n    @world.setter\n    def world(self, value):\n        if value is None:\n            self._data = None\n            self._pixel = None\n            self._world = None\n        else:\n            self._data = self.transform.transform(value)\n            self._pixel = self.parent_axes.transData.transform(self._data)\n            self._world = value\n            self._update_normal()\n\n    def _update_normal(self):\n        # Find angle normal to border and inwards, in display coordinate\n        dx = self.pixel[1:, 0] - self.pixel[:-1, 0]\n        dy = self.pixel[1:, 1] - self.pixel[:-1, 1]\n        self.normal_angle = np.degrees(np.arctan2(dx, -dy))\n\n    def _halfway_x_y_angle(self):\n        \"\"\"\n        Return the x, y, normal_angle values halfway along the spine\n        \"\"\"\n        x_disp, y_disp = self.pixel[:, 0], self.pixel[:, 1]\n        # Get distance along the path\n        d = np.hstack([0., np.cumsum(np.sqrt(np.diff(x_disp) ** 2 + np.diff(y_disp) ** 2))])\n        xcen = np.interp(d[-1] / 2., d, x_disp)\n        ycen = np.interp(d[-1] / 2., d, y_disp)\n\n        # Find segment along which the mid-point lies\n        imin = np.searchsorted(d, d[-1] / 2.) - 1\n\n        # Find normal of the axis label facing outwards on that segment\n        normal_angle = self.normal_angle[imin] + 180.\n        return xcen, ycen, normal_angle"},{"className":"InvertedContrastBiasStretch","col":0,"comment":"\n    Inverse transformation for ContrastBiasStretch.\n\n    Parameters\n    ----------\n    contrast : float\n        The contrast parameter (see\n        `~astropy.visualization.ConstrastBiasStretch).\n\n    bias : float\n        The bias parameter (see\n        `~astropy.visualization.ConstrastBiasStretch).\n    ","endLoc":698,"id":16142,"nodeType":"Class","startLoc":662,"text":"class InvertedContrastBiasStretch(BaseStretch):\n    \"\"\"\n    Inverse transformation for ContrastBiasStretch.\n\n    Parameters\n    ----------\n    contrast : float\n        The contrast parameter (see\n        `~astropy.visualization.ConstrastBiasStretch).\n\n    bias : float\n        The bias parameter (see\n        `~astropy.visualization.ConstrastBiasStretch).\n    \"\"\"\n\n    def __init__(self, contrast, bias):\n        super().__init__()\n        self.contrast = contrast\n        self.bias = bias\n\n    def __call__(self, values, clip=True, out=None):\n        # As a special case here, we only clip *after* the\n        # transformation since it does not map [0:1] to [0:1]\n        values = _prepare(values, clip=False, out=out)\n        np.subtract(values, 0.5, out=values)\n        np.true_divide(values, self.contrast, out=values)\n        np.add(values, self.bias, out=values)\n\n        if clip:\n            np.clip(values, 0, 1, out=values)\n\n        return values\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return ContrastBiasStretch(self.contrast, self.bias)"},{"col":4,"comment":"null","endLoc":693,"header":"def __call__(self, values, clip=True, out=None)","id":16143,"name":"__call__","nodeType":"Function","startLoc":682,"text":"def __call__(self, values, clip=True, out=None):\n        # As a special case here, we only clip *after* the\n        # transformation since it does not map [0:1] to [0:1]\n        values = _prepare(values, clip=False, out=out)\n        np.subtract(values, 0.5, out=values)\n        np.true_divide(values, self.contrast, out=values)\n        np.add(values, self.bias, out=values)\n\n        if clip:\n            np.clip(values, 0, 1, out=values)\n\n        return values"},{"col":4,"comment":"null","endLoc":32,"header":"def __init__(self, parent_axes, transform)","id":16144,"name":"__init__","nodeType":"Function","startLoc":25,"text":"def __init__(self, parent_axes, transform):\n\n        self.parent_axes = parent_axes\n        self.transform = transform\n\n        self.data = None\n        self.pixel = None\n        self.world = None"},{"col":4,"comment":"null","endLoc":36,"header":"@property\n    def data(self)","id":16145,"name":"data","nodeType":"Function","startLoc":34,"text":"@property\n    def data(self):\n        return self._data"},{"col":4,"comment":"null","endLoc":49,"header":"@data.setter\n    def data(self, value)","id":16146,"name":"data","nodeType":"Function","startLoc":38,"text":"@data.setter\n    def data(self, value):\n        if value is None:\n            self._data = None\n            self._pixel = None\n            self._world = None\n        else:\n            self._data = value\n            self._pixel = self.parent_axes.transData.transform(self._data)\n            with np.errstate(invalid='ignore'):\n                self._world = self.transform.transform(self._data)\n            self._update_normal()"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":698,"header":"@property\n    def inverse(self)","id":16147,"name":"inverse","nodeType":"Function","startLoc":695,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return ContrastBiasStretch(self.contrast, self.bias)"},{"attributeType":"null","col":16,"comment":"null","endLoc":10,"id":16148,"name":"np","nodeType":"Attribute","startLoc":10,"text":"np"},{"attributeType":"null","col":8,"comment":"null","endLoc":679,"id":16149,"name":"contrast","nodeType":"Attribute","startLoc":679,"text":"self.contrast"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":16150,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"attributeType":"null","col":8,"comment":"null","endLoc":680,"id":16151,"name":"bias","nodeType":"Attribute","startLoc":680,"text":"self.bias"},{"col":0,"comment":"","endLoc":8,"header":"lupton_rgb.py#<anonymous>","id":16152,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nCombine 3 images to produce a properly-scaled RGB image following Lupton et al. (2004).\n\nThe three images must be aligned and have the same pixel scale and size.\n\nFor details, see : https://ui.adsabs.harvard.edu/abs/2004PASP..116..133L\n\"\"\"\n\n__all__ = ['make_lupton_rgb']"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":16153,"name":"__all__","nodeType":"Attribute","startLoc":27,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":29,"id":16154,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":29,"text":"__doctest_requires__"},{"attributeType":"null","col":0,"comment":"null","endLoc":303,"id":16155,"name":"_norm_sig","nodeType":"Attribute","startLoc":303,"text":"_norm_sig"},{"className":"CompositeStretch","col":0,"comment":"\n    A combination of two stretches.\n\n    Parameters\n    ----------\n    stretch_1 : :class:`astropy.visualization.BaseStretch`\n        The first stretch to apply.\n    stretch_2 : :class:`astropy.visualization.BaseStretch`\n        The second stretch to apply.\n    ","endLoc":715,"id":16156,"nodeType":"Class","startLoc":701,"text":"class CompositeStretch(CompositeTransform, BaseStretch):\n    \"\"\"\n    A combination of two stretches.\n\n    Parameters\n    ----------\n    stretch_1 : :class:`astropy.visualization.BaseStretch`\n        The first stretch to apply.\n    stretch_2 : :class:`astropy.visualization.BaseStretch`\n        The second stretch to apply.\n    \"\"\"\n\n    def __call__(self, values, clip=True, out=None):\n        return self.transform_2(\n            self.transform_1(values, clip=clip, out=out), clip=clip, out=out)"},{"col":4,"comment":"null","endLoc":715,"header":"def __call__(self, values, clip=True, out=None)","id":16157,"name":"__call__","nodeType":"Function","startLoc":713,"text":"def __call__(self, values, clip=True, out=None):\n        return self.transform_2(\n            self.transform_1(values, clip=clip, out=out), clip=clip, out=out)"},{"fileName":"utils.py","filePath":"astropy/visualization/wcsaxes","id":16158,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport numpy as np\n\nfrom astropy import units as u\nfrom astropy.coordinates import BaseCoordinateFrame\n\n__all__ = ['select_step_degree', 'select_step_hour', 'select_step_scalar',\n           'transform_contour_set_inplace']\n\n\ndef select_step_degree(dv):\n\n    # Modified from axis_artist, supports astropy.units\n\n    if dv > 1. * u.arcsec:\n\n        degree_limits_ = [1.5, 3, 7, 13, 20, 40, 70, 120, 270, 520]\n        degree_steps_ = [1, 2, 5, 10, 15, 30, 45, 90, 180, 360]\n        degree_units = [u.degree] * len(degree_steps_)\n\n        minsec_limits_ = [1.5, 2.5, 3.5, 8, 11, 18, 25, 45]\n        minsec_steps_ = [1, 2, 3, 5, 10, 15, 20, 30]\n\n        minute_limits_ = np.array(minsec_limits_) / 60.\n        minute_units = [u.arcmin] * len(minute_limits_)\n\n        second_limits_ = np.array(minsec_limits_) / 3600.\n        second_units = [u.arcsec] * len(second_limits_)\n\n        degree_limits = np.concatenate([second_limits_,\n                                        minute_limits_,\n                                        degree_limits_])\n\n        degree_steps = minsec_steps_ + minsec_steps_ + degree_steps_\n        degree_units = second_units + minute_units + degree_units\n\n        n = degree_limits.searchsorted(dv.to(u.degree))\n        step = degree_steps[n]\n        unit = degree_units[n]\n\n        return step * unit\n\n    else:\n\n        return select_step_scalar(dv.to_value(u.arcsec)) * u.arcsec\n\n\ndef select_step_hour(dv):\n\n    if dv > 15. * u.arcsec:\n\n        hour_limits_ = [1.5, 2.5, 3.5, 5, 7, 10, 15, 21, 36]\n        hour_steps_ = [1, 2, 3, 4, 6, 8, 12, 18, 24]\n        hour_units = [u.hourangle] * len(hour_steps_)\n\n        minsec_limits_ = [1.5, 2.5, 3.5, 4.5, 5.5, 8, 11, 14, 18, 25, 45]\n        minsec_steps_ = [1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30]\n\n        minute_limits_ = np.array(minsec_limits_) / 60.\n        minute_units = [15. * u.arcmin] * len(minute_limits_)\n\n        second_limits_ = np.array(minsec_limits_) / 3600.\n        second_units = [15. * u.arcsec] * len(second_limits_)\n\n        hour_limits = np.concatenate([second_limits_,\n                                      minute_limits_,\n                                      hour_limits_])\n\n        hour_steps = minsec_steps_ + minsec_steps_ + hour_steps_\n        hour_units = second_units + minute_units + hour_units\n\n        n = hour_limits.searchsorted(dv.to(u.hourangle))\n        step = hour_steps[n]\n        unit = hour_units[n]\n\n        return step * unit\n\n    else:\n\n        return select_step_scalar(dv.to_value(15. * u.arcsec)) * (15. * u.arcsec)\n\n\ndef select_step_scalar(dv):\n\n    log10_dv = np.log10(dv)\n\n    base = np.floor(log10_dv)\n    frac = log10_dv - base\n\n    steps = np.log10([1, 2, 5, 10])\n\n    imin = np.argmin(np.abs(frac - steps))\n\n    return 10. ** (base + steps[imin])\n\n\ndef get_coord_meta(frame):\n\n    coord_meta = {}\n    coord_meta['type'] = ('longitude', 'latitude')\n    coord_meta['wrap'] = (None, None)\n    coord_meta['unit'] = (u.deg, u.deg)\n\n    from astropy.coordinates import frame_transform_graph\n\n    if isinstance(frame, str):\n        initial_frame = frame\n        frame = frame_transform_graph.lookup_name(frame)\n        if frame is None:\n            raise ValueError(f\"Unknown frame: {initial_frame}\")\n\n    if not isinstance(frame, BaseCoordinateFrame):\n        frame = frame()\n\n    names = list(frame.representation_component_names.keys())\n    coord_meta['name'] = names[:2]\n\n    return coord_meta\n\n\ndef transform_contour_set_inplace(cset, transform):\n    \"\"\"\n    Transform a contour set in-place using a specified\n    :class:`matplotlib.transform.Transform`\n\n    Using transforms with the native Matplotlib contour/contourf can be slow if\n    the transforms have a non-negligible overhead (which is the case for\n    WCS/SkyCoord transforms) since the transform is called for each individual\n    contour line. It is more efficient to stack all the contour lines together\n    temporarily and transform them in one go.\n    \"\"\"\n\n    # The contours are represented as paths grouped into levels. Each can have\n    # one or more paths. The approach we take here is to stack the vertices of\n    # all paths and transform them in one go. The pos_level list helps us keep\n    # track of where the set of segments for each overall contour level ends.\n    # The pos_segments list helps us keep track of where each segmnt ends for\n    # each contour level.\n    all_paths = []\n    pos_level = []\n    pos_segments = []\n\n    for collection in cset.collections:\n        paths = collection.get_paths()\n        if len(paths) == 0:\n            continue\n        all_paths.append(paths)\n        # The last item in pos isn't needed for np.split and in fact causes\n        # issues if we keep it because it will cause an extra empty array to be\n        # returned.\n        pos = np.cumsum([len(x) for x in paths])\n        pos_segments.append(pos[:-1])\n        pos_level.append(pos[-1])\n\n    # As above the last item isn't needed\n    pos_level = np.cumsum(pos_level)[:-1]\n\n    # Stack all the segments into a single (n, 2) array\n    vertices = [path.vertices for paths in all_paths for path in paths]\n    if len(vertices) > 0:\n        vertices = np.concatenate(vertices)\n    else:\n        return\n\n    # Transform all coordinates in one go\n    vertices = transform.transform(vertices)\n\n    # Split up into levels again\n    vertices = np.split(vertices, pos_level)\n\n    # Now re-populate the segments in the line collections\n    for ilevel, vert in enumerate(vertices):\n        vert = np.split(vert, pos_segments[ilevel])\n        for iseg, ivert in enumerate(vert):\n            all_paths[ilevel][iseg].vertices = ivert\n"},{"col":4,"comment":"\n        Draw the minor ticks.\n        ","endLoc":209,"header":"def _draw_ticks(self, renderer, pixel_array, angle_array, offset)","id":16159,"name":"_draw_ticks","nodeType":"Function","startLoc":172,"text":"def _draw_ticks(self, renderer, pixel_array, angle_array, offset):\n        \"\"\"\n        Draw the minor ticks.\n        \"\"\"\n        path_trans = self.get_transform()\n\n        gc = renderer.new_gc()\n        gc.set_foreground(self.get_color())\n        gc.set_alpha(self.get_alpha())\n        gc.set_linewidth(self.get_linewidth())\n\n        marker_scale = Affine2D().scale(offset, offset)\n        marker_rotation = Affine2D()\n        marker_transform = marker_scale + marker_rotation\n\n        initial_angle = 180. if self.get_tick_out() else 0.\n\n        for axis in self.get_visible_axes():\n\n            if axis not in pixel_array:\n                continue\n\n            for loc, angle in zip(pixel_array[axis], angle_array[axis]):\n\n                # Set the rotation for this tick\n                marker_rotation.rotate_deg(initial_angle + angle)\n\n                # Draw the markers\n                locs = path_trans.transform_non_affine(np.array([loc, loc]))\n                renderer.draw_markers(gc, self._tickvert_path, marker_transform,\n                                      Path(locs), path_trans.get_affine())\n\n                # Reset the tick rotation before moving to the next tick\n                marker_rotation.clear()\n\n                self.ticks_locs[axis].append(locs)\n\n        gc.restore()"},{"col":0,"comment":"","endLoc":4,"header":"mpl_normalize.py#<anonymous>","id":16160,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nNormalization class for Matplotlib that can be used to produce\ncolorbars.\n\"\"\"\n\ntry:\n    import matplotlib  # pylint: disable=W0611\n    from matplotlib.colors import Normalize\n    from matplotlib import pyplot as plt\nexcept ImportError:\n    class Normalize:\n        def __init__(self, *args, **kwargs):\n            raise ImportError('matplotlib is required in order to use this '\n                              'class.')\n\n__all__ = ['ImageNormalize', 'simple_norm', 'imshow_norm']\n\n__doctest_requires__ = {'*': ['matplotlib']}\n\n_norm_sig = inspect.signature(ImageNormalize)"},{"col":0,"comment":"null","endLoc":47,"header":"def select_step_degree(dv)","id":16161,"name":"select_step_degree","nodeType":"Function","startLoc":13,"text":"def select_step_degree(dv):\n\n    # Modified from axis_artist, supports astropy.units\n\n    if dv > 1. * u.arcsec:\n\n        degree_limits_ = [1.5, 3, 7, 13, 20, 40, 70, 120, 270, 520]\n        degree_steps_ = [1, 2, 5, 10, 15, 30, 45, 90, 180, 360]\n        degree_units = [u.degree] * len(degree_steps_)\n\n        minsec_limits_ = [1.5, 2.5, 3.5, 8, 11, 18, 25, 45]\n        minsec_steps_ = [1, 2, 3, 5, 10, 15, 20, 30]\n\n        minute_limits_ = np.array(minsec_limits_) / 60.\n        minute_units = [u.arcmin] * len(minute_limits_)\n\n        second_limits_ = np.array(minsec_limits_) / 3600.\n        second_units = [u.arcsec] * len(second_limits_)\n\n        degree_limits = np.concatenate([second_limits_,\n                                        minute_limits_,\n                                        degree_limits_])\n\n        degree_steps = minsec_steps_ + minsec_steps_ + degree_steps_\n        degree_units = second_units + minute_units + degree_units\n\n        n = degree_limits.searchsorted(dv.to(u.degree))\n        step = degree_steps[n]\n        unit = degree_units[n]\n\n        return step * unit\n\n    else:\n\n        return select_step_scalar(dv.to_value(u.arcsec)) * u.arcsec"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":16162,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":6,"header":"stretch.py#<anonymous>","id":16163,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nClasses that deal with stretching, i.e. mapping a range of [0:1] values onto\nanother set of [0:1] values with a transformation\n\"\"\"\n\n__all__ = [\"BaseStretch\", \"LinearStretch\", \"SqrtStretch\", \"PowerStretch\",\n           \"PowerDistStretch\", \"SquaredStretch\", \"LogStretch\", \"AsinhStretch\",\n           \"SinhStretch\", \"HistEqStretch\", \"ContrastBiasStretch\",\n           \"CompositeStretch\"]"},{"fileName":"patches.py","filePath":"astropy/visualization/wcsaxes","id":16164,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport numpy as np\nimport warnings\nfrom matplotlib.patches import Polygon\n\nfrom astropy import units as u\nfrom astropy.coordinates import SkyCoord\nfrom astropy.coordinates.representation import UnitSphericalRepresentation, SphericalRepresentation\nfrom astropy.coordinates.matrix_utilities import rotation_matrix, matrix_product\nfrom astropy.utils.exceptions import AstropyUserWarning\n\n\n__all__ = ['Quadrangle', 'SphericalCircle']\n\n# Monkey-patch the docs to fix CapStyle and JoinStyle subs.\n# TODO! delete when upstream fix matplotlib/matplotlib#19839\nPolygon.__init__.__doc__ = Polygon.__init__.__doc__.replace(\n    \"`.CapStyle`\", \"``matplotlib._enums.CapStyle``\")\nPolygon.__init__.__doc__ = Polygon.__init__.__doc__.replace(\n    \"`.JoinStyle`\", \"``matplotlib._enums.JoinStyle``\")\nPolygon.set_capstyle.__doc__ = Polygon.set_capstyle.__doc__.replace(\n    \"`.CapStyle`\", \"``matplotlib._enums.CapStyle``\")\nPolygon.set_joinstyle.__doc__ = Polygon.set_joinstyle.__doc__.replace(\n    \"`.JoinStyle`\", \"``matplotlib._enums.JoinStyle``\")\n\n\ndef _rotate_polygon(lon, lat, lon0, lat0):\n    \"\"\"\n    Given a polygon with vertices defined by (lon, lat), rotate the polygon\n    such that the North pole of the spherical coordinates is now at (lon0,\n    lat0). Therefore, to end up with a polygon centered on (lon0, lat0), the\n    polygon should initially be drawn around the North pole.\n    \"\"\"\n\n    # Create a representation object\n    polygon = UnitSphericalRepresentation(lon=lon, lat=lat)\n\n    # Determine rotation matrix to make it so that the circle is centered\n    # on the correct longitude/latitude.\n    m1 = rotation_matrix(-(0.5 * np.pi * u.radian - lat0), axis='y')\n    m2 = rotation_matrix(-lon0, axis='z')\n    transform_matrix = matrix_product(m2, m1)\n\n    # Apply 3D rotation\n    polygon = polygon.to_cartesian()\n    polygon = polygon.transform(transform_matrix)\n    polygon = UnitSphericalRepresentation.from_cartesian(polygon)\n\n    return polygon.lon, polygon.lat\n\n\nclass SphericalCircle(Polygon):\n    \"\"\"\n    Create a patch representing a spherical circle - that is, a circle that is\n    formed of all the points that are within a certain angle of the central\n    coordinates on a sphere. Here we assume that latitude goes from -90 to +90\n\n    This class is needed in cases where the user wants to add a circular patch\n    to a celestial image, since otherwise the circle will be distorted, because\n    a fixed interval in longitude corresponds to a different angle on the sky\n    depending on the latitude.\n\n    Parameters\n    ----------\n    center : tuple or `~astropy.units.Quantity` ['angle']\n        This can be either a tuple of two `~astropy.units.Quantity` objects, or\n        a single `~astropy.units.Quantity` array with two elements\n        or a `~astropy.coordinates.SkyCoord` object.\n    radius : `~astropy.units.Quantity` ['angle']\n        The radius of the circle\n    resolution : int, optional\n        The number of points that make up the circle - increase this to get a\n        smoother circle.\n    vertex_unit : `~astropy.units.Unit`\n        The units in which the resulting polygon should be defined - this\n        should match the unit that the transformation (e.g. the WCS\n        transformation) expects as input.\n\n    Notes\n    -----\n    Additional keyword arguments are passed to `~matplotlib.patches.Polygon`\n    \"\"\"\n\n    def __init__(self, center, radius, resolution=100, vertex_unit=u.degree, **kwargs):\n\n        # Extract longitude/latitude, either from a SkyCoord object, or\n        # from a tuple of two quantities or a single 2-element Quantity.\n        # The SkyCoord is converted to SphericalRepresentation, if not already.\n        if isinstance(center, SkyCoord):\n            rep_type = center.representation_type\n            if not issubclass(rep_type, (SphericalRepresentation,\n                                         UnitSphericalRepresentation)):\n                warnings.warn(f'Received `center` of representation type {rep_type} '\n                              'will be converted to SphericalRepresentation ',\n                              AstropyUserWarning)\n            longitude, latitude = center.spherical.lon, center.spherical.lat\n        else:\n            longitude, latitude = center\n\n        # Start off by generating the circle around the North pole\n        lon = np.linspace(0., 2 * np.pi, resolution + 1)[:-1] * u.radian\n        lat = np.repeat(0.5 * np.pi - radius.to_value(u.radian), resolution) * u.radian\n\n        lon, lat = _rotate_polygon(lon, lat, longitude, latitude)\n\n        # Extract new longitude/latitude in the requested units\n        lon = lon.to_value(vertex_unit)\n        lat = lat.to_value(vertex_unit)\n\n        # Create polygon vertices\n        vertices = np.array([lon, lat]).transpose()\n\n        super().__init__(vertices, **kwargs)\n\n\nclass Quadrangle(Polygon):\n    \"\"\"\n    Create a patch representing a latitude-longitude quadrangle.\n\n    The edges of the quadrangle lie on two lines of constant longitude and two\n    lines of constant latitude (or the equivalent component names in the\n    coordinate frame of interest, such as right ascension and declination).\n    Note that lines of constant latitude are not great circles.\n\n    Unlike `matplotlib.patches.Rectangle`, the edges of this patch will render\n    as curved lines if appropriate for the WCS transformation.\n\n    Parameters\n    ----------\n    anchor : tuple or `~astropy.units.Quantity` ['angle']\n        This can be either a tuple of two `~astropy.units.Quantity` objects, or\n        a single `~astropy.units.Quantity` array with two elements.\n    width : `~astropy.units.Quantity` ['angle']\n        The width of the quadrangle in longitude (or, e.g., right ascension)\n    height : `~astropy.units.Quantity` ['angle']\n        The height of the quadrangle in latitude (or, e.g., declination)\n    resolution : int, optional\n        The number of points that make up each side of the quadrangle -\n        increase this to get a smoother quadrangle.\n    vertex_unit : `~astropy.units.Unit` ['angle']\n        The units in which the resulting polygon should be defined - this\n        should match the unit that the transformation (e.g. the WCS\n        transformation) expects as input.\n\n    Notes\n    -----\n    Additional keyword arguments are passed to `~matplotlib.patches.Polygon`\n    \"\"\"\n\n    def __init__(self, anchor, width, height, resolution=100, vertex_unit=u.degree, **kwargs):\n\n        # Extract longitude/latitude, either from a tuple of two quantities, or\n        # a single 2-element Quantity.\n        longitude, latitude = u.Quantity(anchor).to_value(vertex_unit)\n\n        # Convert the quadrangle dimensions to the appropriate units\n        width = width.to_value(vertex_unit)\n        height = height.to_value(vertex_unit)\n\n        # Create progressions in longitude and latitude\n        lon_seq = longitude + np.linspace(0, width, resolution + 1)\n        lat_seq = latitude + np.linspace(0, height, resolution + 1)\n\n        # Trace the path of the quadrangle\n        lon = np.concatenate([lon_seq[:-1],\n                              np.repeat(lon_seq[-1], resolution),\n                              np.flip(lon_seq[1:]),\n                              np.repeat(lon_seq[0], resolution)])\n        lat = np.concatenate([np.repeat(lat_seq[0], resolution),\n                              lat_seq[:-1],\n                              np.repeat(lat_seq[-1], resolution),\n                              np.flip(lat_seq[1:])])\n\n        # Create polygon vertices\n        vertices = np.array([lon, lat]).transpose()\n\n        super().__init__(vertices, **kwargs)\n"},{"fileName":"coordinate_helpers.py","filePath":"astropy/visualization/wcsaxes","id":16165,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis file defines the classes used to represent a 'coordinate', which includes\naxes, ticks, tick labels, and grid lines.\n\"\"\"\n\nimport warnings\n\nimport numpy as np\n\nfrom matplotlib.ticker import Formatter\nfrom matplotlib.transforms import Affine2D, ScaledTranslation\nfrom matplotlib.patches import PathPatch\nfrom matplotlib.path import Path\nfrom matplotlib import rcParams\n\nfrom astropy import units as u\nfrom astropy.utils.exceptions import AstropyDeprecationWarning\n\nfrom .frame import RectangularFrame1D, EllipticalFrame\nfrom .formatter_locator import AngleFormatterLocator, ScalarFormatterLocator\nfrom .ticks import Ticks\nfrom .ticklabels import TickLabels\nfrom .axislabels import AxisLabels\nfrom .grid_paths import get_lon_lat_path, get_gridline_path\n\n__all__ = ['CoordinateHelper']\n\n\n# Matplotlib's gridlines use Line2D, but ours use PathPatch.\n# Patches take a slightly different format of linestyle argument.\nLINES_TO_PATCHES_LINESTYLE = {'-': 'solid',\n                              '--': 'dashed',\n                              '-.': 'dashdot',\n                              ':': 'dotted',\n                              'none': 'none',\n                              'None': 'none',\n                              ' ': 'none',\n                              '': 'none'}\n\n\ndef wrap_angle_at(values, coord_wrap):\n    # On ARM processors, np.mod emits warnings if there are NaN values in the\n    # array, although this doesn't seem to happen on other processors.\n    with np.errstate(invalid='ignore'):\n        return np.mod(values - coord_wrap, 360.) - (360. - coord_wrap)\n\n\nclass CoordinateHelper:\n    \"\"\"\n    Helper class to control one of the coordinates in the\n    :class:`~astropy.visualization.wcsaxes.WCSAxes`.\n\n    Parameters\n    ----------\n    parent_axes : :class:`~astropy.visualization.wcsaxes.WCSAxes`\n        The axes the coordinate helper belongs to.\n    parent_map : :class:`~astropy.visualization.wcsaxes.CoordinatesMap`\n        The :class:`~astropy.visualization.wcsaxes.CoordinatesMap` object this\n        coordinate belongs to.\n    transform : `~matplotlib.transforms.Transform`\n        The transform corresponding to this coordinate system.\n    coord_index : int\n        The index of this coordinate in the\n        :class:`~astropy.visualization.wcsaxes.CoordinatesMap`.\n    coord_type : {'longitude', 'latitude', 'scalar'}\n        The type of this coordinate, which is used to determine the wrapping and\n        boundary behavior of coordinates. Longitudes wrap at ``coord_wrap``,\n        latitudes have to be in the range -90 to 90, and scalars are unbounded\n        and do not wrap.\n    coord_unit : `~astropy.units.Unit`\n        The unit that this coordinate is in given the output of transform.\n    format_unit : `~astropy.units.Unit`, optional\n        The unit to use to display the coordinates.\n    coord_wrap : float\n        The angle at which the longitude wraps (defaults to 360)\n    frame : `~astropy.visualization.wcsaxes.frame.BaseFrame`\n        The frame of the :class:`~astropy.visualization.wcsaxes.WCSAxes`.\n    \"\"\"\n\n    def __init__(self, parent_axes=None, parent_map=None, transform=None,\n                 coord_index=None, coord_type='scalar', coord_unit=None,\n                 coord_wrap=None, frame=None, format_unit=None, default_label=None):\n\n        # Keep a reference to the parent axes and the transform\n        self.parent_axes = parent_axes\n        self.parent_map = parent_map\n        self.transform = transform\n        self.coord_index = coord_index\n        self.coord_unit = coord_unit\n        self._format_unit = format_unit\n        self.frame = frame\n        self.default_label = default_label or ''\n        self._auto_axislabel = True\n        # Disable auto label for elliptical frames as it puts labels in\n        # annoying places.\n        if issubclass(self.parent_axes.frame_class, EllipticalFrame):\n            self._auto_axislabel = False\n\n        self.set_coord_type(coord_type, coord_wrap)\n\n        # Initialize ticks\n        self.dpi_transform = Affine2D()\n        self.offset_transform = ScaledTranslation(0, 0, self.dpi_transform)\n        self.ticks = Ticks(transform=parent_axes.transData + self.offset_transform)\n\n        # Initialize tick labels\n        self.ticklabels = TickLabels(self.frame,\n                                     transform=None,  # display coordinates\n                                     figure=parent_axes.get_figure())\n        self.ticks.display_minor_ticks(rcParams['xtick.minor.visible'])\n        self.minor_frequency = 5\n\n        # Initialize axis labels\n        self.axislabels = AxisLabels(self.frame,\n                                     transform=None,  # display coordinates\n                                     figure=parent_axes.get_figure())\n\n        # Initialize container for the grid lines\n        self.grid_lines = []\n\n        # Initialize grid style. Take defaults from matplotlib.rcParams.\n        # Based on matplotlib.axis.YTick._get_gridline.\n        self.grid_lines_kwargs = {'visible': False,\n                                  'facecolor': 'none',\n                                  'edgecolor': rcParams['grid.color'],\n                                  'linestyle': LINES_TO_PATCHES_LINESTYLE[rcParams['grid.linestyle']],\n                                  'linewidth': rcParams['grid.linewidth'],\n                                  'alpha': rcParams['grid.alpha'],\n                                  'transform': self.parent_axes.transData}\n\n    def grid(self, draw_grid=True, grid_type=None, **kwargs):\n        \"\"\"\n        Plot grid lines for this coordinate.\n\n        Standard matplotlib appearance options (color, alpha, etc.) can be\n        passed as keyword arguments.\n\n        Parameters\n        ----------\n        draw_grid : bool\n            Whether to show the gridlines\n        grid_type : {'lines', 'contours'}\n            Whether to plot the contours by determining the grid lines in\n            world coordinates and then plotting them in world coordinates\n            (``'lines'``) or by determining the world coordinates at many\n            positions in the image and then drawing contours\n            (``'contours'``). The first is recommended for 2-d images, while\n            for 3-d (or higher dimensional) cubes, the ``'contours'`` option\n            is recommended. By default, 'lines' is used if the transform has\n            an inverse, otherwise 'contours' is used.\n        \"\"\"\n\n        if grid_type == 'lines' and not self.transform.has_inverse:\n            raise ValueError('The specified transform has no inverse, so the '\n                             'grid cannot be drawn using grid_type=\\'lines\\'')\n\n        if grid_type is None:\n            grid_type = 'lines' if self.transform.has_inverse else 'contours'\n\n        if grid_type in ('lines', 'contours'):\n            self._grid_type = grid_type\n        else:\n            raise ValueError(\"grid_type should be 'lines' or 'contours'\")\n\n        if 'color' in kwargs:\n            kwargs['edgecolor'] = kwargs.pop('color')\n\n        self.grid_lines_kwargs.update(kwargs)\n\n        if self.grid_lines_kwargs['visible']:\n            if not draw_grid:\n                self.grid_lines_kwargs['visible'] = False\n        else:\n            self.grid_lines_kwargs['visible'] = True\n\n    def set_coord_type(self, coord_type, coord_wrap=None):\n        \"\"\"\n        Set the coordinate type for the axis.\n\n        Parameters\n        ----------\n        coord_type : str\n            One of 'longitude', 'latitude' or 'scalar'\n        coord_wrap : float, optional\n            The value to wrap at for angular coordinates\n        \"\"\"\n\n        self.coord_type = coord_type\n\n        if coord_type == 'longitude' and coord_wrap is None:\n            self.coord_wrap = 360\n        elif coord_type != 'longitude' and coord_wrap is not None:\n            raise NotImplementedError('coord_wrap is not yet supported '\n                                      'for non-longitude coordinates')\n        else:\n            self.coord_wrap = coord_wrap\n\n        # Initialize tick formatter/locator\n        if coord_type == 'scalar':\n            self._coord_scale_to_deg = None\n            self._formatter_locator = ScalarFormatterLocator(unit=self.coord_unit)\n        elif coord_type in ['longitude', 'latitude']:\n            if self.coord_unit is u.deg:\n                self._coord_scale_to_deg = None\n            else:\n                self._coord_scale_to_deg = self.coord_unit.to(u.deg)\n            self._formatter_locator = AngleFormatterLocator(unit=self.coord_unit,\n                                                            format_unit=self._format_unit)\n        else:\n            raise ValueError(\"coord_type should be one of 'scalar', 'longitude', or 'latitude'\")\n\n    def set_major_formatter(self, formatter):\n        \"\"\"\n        Set the formatter to use for the major tick labels.\n\n        Parameters\n        ----------\n        formatter : str or `~matplotlib.ticker.Formatter`\n            The format or formatter to use.\n        \"\"\"\n        if isinstance(formatter, Formatter):\n            raise NotImplementedError()  # figure out how to swap out formatter\n        elif isinstance(formatter, str):\n            self._formatter_locator.format = formatter\n        else:\n            raise TypeError(\"formatter should be a string or a Formatter \"\n                            \"instance\")\n\n    def format_coord(self, value, format='auto'):\n        \"\"\"\n        Given the value of a coordinate, will format it according to the\n        format of the formatter_locator.\n\n        Parameters\n        ----------\n        value : float\n            The value to format\n        format : {'auto', 'ascii', 'latex'}, optional\n            The format to use - by default the formatting will be adjusted\n            depending on whether Matplotlib is using LaTeX or MathTex. To\n            get plain ASCII strings, use format='ascii'.\n        \"\"\"\n\n        if not hasattr(self, \"_fl_spacing\"):\n            return \"\"  # _update_ticks has not been called yet\n\n        fl = self._formatter_locator\n        if isinstance(fl, AngleFormatterLocator):\n\n            # Convert to degrees if needed\n            if self._coord_scale_to_deg is not None:\n                value *= self._coord_scale_to_deg\n\n            if self.coord_type == 'longitude':\n                value = wrap_angle_at(value, self.coord_wrap)\n            value = value * u.degree\n            value = value.to_value(fl._unit)\n\n        spacing = self._fl_spacing\n        string = fl.formatter(values=[value] * fl._unit, spacing=spacing, format=format)\n\n        return string[0]\n\n    def set_separator(self, separator):\n        \"\"\"\n        Set the separator to use for the angle major tick labels.\n\n        Parameters\n        ----------\n        separator : str or tuple or None\n            The separator between numbers in sexagesimal representation. Can be\n            either a string or a tuple (or `None` for default).\n        \"\"\"\n        if not (self._formatter_locator.__class__ == AngleFormatterLocator):\n            raise TypeError(\"Separator can only be specified for angle coordinates\")\n        if isinstance(separator, (str, tuple)) or separator is None:\n            self._formatter_locator.sep = separator\n        else:\n            raise TypeError(\"separator should be a string, a tuple, or None\")\n\n    def set_format_unit(self, unit, decimal=None, show_decimal_unit=True):\n        \"\"\"\n        Set the unit for the major tick labels.\n\n        Parameters\n        ----------\n        unit : class:`~astropy.units.Unit`\n            The unit to which the tick labels should be converted to.\n        decimal : bool, optional\n            Whether to use decimal formatting. By default this is `False`\n            for degrees or hours (which therefore use sexagesimal formatting)\n            and `True` for all other units.\n        show_decimal_unit : bool, optional\n            Whether to include units when in decimal mode.\n        \"\"\"\n        self._formatter_locator.format_unit = u.Unit(unit)\n        self._formatter_locator.decimal = decimal\n        self._formatter_locator.show_decimal_unit = show_decimal_unit\n\n    def get_format_unit(self):\n        \"\"\"\n        Get the unit for the major tick labels.\n        \"\"\"\n        return self._formatter_locator.format_unit\n\n    def set_ticks(self, values=None, spacing=None, number=None, size=None,\n                  width=None, color=None, alpha=None, direction=None,\n                  exclude_overlapping=None):\n        \"\"\"\n        Set the location and properties of the ticks.\n\n        At most one of the options from ``values``, ``spacing``, or\n        ``number`` can be specified.\n\n        Parameters\n        ----------\n        values : iterable, optional\n            The coordinate values at which to show the ticks.\n        spacing : float, optional\n            The spacing between ticks.\n        number : float, optional\n            The approximate number of ticks shown.\n        size : float, optional\n            The length of the ticks in points\n        color : str or tuple, optional\n            A valid Matplotlib color for the ticks\n        alpha : float, optional\n            The alpha value (transparency) for the ticks.\n        direction : {'in','out'}, optional\n            Whether the ticks should point inwards or outwards.\n        \"\"\"\n\n        if sum([values is None, spacing is None, number is None]) < 2:\n            raise ValueError(\"At most one of values, spacing, or number should \"\n                             \"be specified\")\n\n        if values is not None:\n            self._formatter_locator.values = values\n        elif spacing is not None:\n            self._formatter_locator.spacing = spacing\n        elif number is not None:\n            self._formatter_locator.number = number\n\n        if size is not None:\n            self.ticks.set_ticksize(size)\n\n        if width is not None:\n            self.ticks.set_linewidth(width)\n\n        if color is not None:\n            self.ticks.set_color(color)\n\n        if alpha is not None:\n            self.ticks.set_alpha(alpha)\n\n        if direction is not None:\n            if direction in ('in', 'out'):\n                self.ticks.set_tick_out(direction == 'out')\n            else:\n                raise ValueError(\"direction should be 'in' or 'out'\")\n\n        if exclude_overlapping is not None:\n            warnings.warn(\"exclude_overlapping= should be passed to \"\n                          \"set_ticklabel instead of set_ticks\",\n                          AstropyDeprecationWarning)\n            self.ticklabels.set_exclude_overlapping(exclude_overlapping)\n\n    def set_ticks_position(self, position):\n        \"\"\"\n        Set where ticks should appear\n\n        Parameters\n        ----------\n        position : str\n            The axes on which the ticks for this coordinate should appear.\n            Should be a string containing zero or more of ``'b'``, ``'t'``,\n            ``'l'``, ``'r'``. For example, ``'lb'`` will lead the ticks to be\n            shown on the left and bottom axis.\n        \"\"\"\n        self.ticks.set_visible_axes(position)\n\n    def set_ticks_visible(self, visible):\n        \"\"\"\n        Set whether ticks are visible or not.\n\n        Parameters\n        ----------\n        visible : bool\n            The visibility of ticks. Setting as ``False`` will hide ticks\n            along this coordinate.\n        \"\"\"\n        self.ticks.set_visible(visible)\n\n    def set_ticklabel(self, color=None, size=None, pad=None,\n                      exclude_overlapping=None, **kwargs):\n        \"\"\"\n        Set the visual properties for the tick labels.\n\n        Parameters\n        ----------\n        size : float, optional\n            The size of the ticks labels in points\n        color : str or tuple, optional\n            A valid Matplotlib color for the tick labels\n        pad : float, optional\n            Distance in points between tick and label.\n        exclude_overlapping : bool, optional\n            Whether to exclude tick labels that overlap over each other.\n        **kwargs\n            Other keyword arguments are passed to :class:`matplotlib.text.Text`.\n        \"\"\"\n        if size is not None:\n            self.ticklabels.set_size(size)\n        if color is not None:\n            self.ticklabels.set_color(color)\n        if pad is not None:\n            self.ticklabels.set_pad(pad)\n        if exclude_overlapping is not None:\n            self.ticklabels.set_exclude_overlapping(exclude_overlapping)\n        self.ticklabels.set(**kwargs)\n\n    def set_ticklabel_position(self, position):\n        \"\"\"\n        Set where tick labels should appear\n\n        Parameters\n        ----------\n        position : str\n            The axes on which the tick labels for this coordinate should\n            appear. Should be a string containing zero or more of ``'b'``,\n            ``'t'``, ``'l'``, ``'r'``. For example, ``'lb'`` will lead the\n            tick labels to be shown on the left and bottom axis.\n        \"\"\"\n        self.ticklabels.set_visible_axes(position)\n\n    def set_ticklabel_visible(self, visible):\n        \"\"\"\n        Set whether the tick labels are visible or not.\n\n        Parameters\n        ----------\n        visible : bool\n            The visibility of ticks. Setting as ``False`` will hide this\n            coordinate's tick labels.\n        \"\"\"\n        self.ticklabels.set_visible(visible)\n\n    def set_axislabel(self, text, minpad=1, **kwargs):\n        \"\"\"\n        Set the text and optionally visual properties for the axis label.\n\n        Parameters\n        ----------\n        text : str\n            The axis label text.\n        minpad : float, optional\n            The padding for the label in terms of axis label font size.\n        **kwargs\n            Keywords are passed to :class:`matplotlib.text.Text`. These\n            can include keywords to set the ``color``, ``size``, ``weight``, and\n            other text properties.\n        \"\"\"\n        fontdict = kwargs.pop('fontdict', None)\n\n        # NOTE: When using plt.xlabel/plt.ylabel, minpad can get set explicitly\n        # to None so we need to make sure that in that case we change to a\n        # default numerical value.\n        if minpad is None:\n            minpad = 1\n\n        self.axislabels.set_text(text)\n        self.axislabels.set_minpad(minpad)\n        self.axislabels.set(**kwargs)\n\n        if fontdict is not None:\n            self.axislabels.update(fontdict)\n\n    def get_axislabel(self):\n        \"\"\"\n        Get the text for the axis label\n\n        Returns\n        -------\n        label : str\n            The axis label\n        \"\"\"\n        return self.axislabels.get_text()\n\n    def set_auto_axislabel(self, auto_label):\n        \"\"\"\n        Render default axis labels if no explicit label is provided.\n\n        Parameters\n        ----------\n        auto_label : `bool`\n            `True` if default labels will be rendered.\n        \"\"\"\n        self._auto_axislabel = bool(auto_label)\n\n    def get_auto_axislabel(self):\n        \"\"\"\n        Render default axis labels if no explicit label is provided.\n\n        Returns\n        -------\n        auto_axislabel : `bool`\n            `True` if default labels will be rendered.\n        \"\"\"\n        return self._auto_axislabel\n\n    def _get_default_axislabel(self):\n        unit = self.get_format_unit() or self.coord_unit\n\n        if not unit or unit is u.one or self.coord_type in ('longitude', 'latitude'):\n            return f\"{self.default_label}\"\n        else:\n            return f\"{self.default_label} [{unit:latex}]\"\n\n    def set_axislabel_position(self, position):\n        \"\"\"\n        Set where axis labels should appear\n\n        Parameters\n        ----------\n        position : str\n            The axes on which the axis label for this coordinate should\n            appear. Should be a string containing zero or more of ``'b'``,\n            ``'t'``, ``'l'``, ``'r'``. For example, ``'lb'`` will lead the\n            axis label to be shown on the left and bottom axis.\n        \"\"\"\n        self.axislabels.set_visible_axes(position)\n\n    def set_axislabel_visibility_rule(self, rule):\n        \"\"\"\n        Set the rule used to determine when the axis label is drawn.\n\n        Parameters\n        ----------\n        rule : str\n            If the rule is 'always' axis labels will always be drawn on the\n            axis. If the rule is 'ticks' the label will only be drawn if ticks\n            were drawn on that axis. If the rule is 'labels' the axis label\n            will only be drawn if tick labels were drawn on that axis.\n        \"\"\"\n        self.axislabels.set_visibility_rule(rule)\n\n    def get_axislabel_visibility_rule(self, rule):\n        \"\"\"\n        Get the rule used to determine when the axis label is drawn.\n        \"\"\"\n        return self.axislabels.get_visibility_rule()\n\n    @property\n    def locator(self):\n        return self._formatter_locator.locator\n\n    @property\n    def formatter(self):\n        return self._formatter_locator.formatter\n\n    def _draw_grid(self, renderer):\n\n        renderer.open_group('grid lines')\n\n        self._update_ticks()\n\n        if self.grid_lines_kwargs['visible']:\n            if isinstance(self.frame, RectangularFrame1D):\n                self._update_grid_lines_1d()\n            else:\n                if self._grid_type == 'lines':\n                    self._update_grid_lines()\n                else:\n                    self._update_grid_contour()\n\n            if self._grid_type == 'lines':\n\n                frame_patch = self.frame.patch\n                for path in self.grid_lines:\n                    p = PathPatch(path, **self.grid_lines_kwargs)\n                    p.set_clip_path(frame_patch)\n                    p.draw(renderer)\n\n            elif self._grid is not None:\n\n                for line in self._grid.collections:\n                    line.set(**self.grid_lines_kwargs)\n                    line.draw(renderer)\n\n        renderer.close_group('grid lines')\n\n    def _draw_ticks(self, renderer, bboxes, ticklabels_bbox):\n        \"\"\"\n        Draw all ticks and ticklabels.\n        \"\"\"\n\n        renderer.open_group('ticks')\n        self.ticks.draw(renderer)\n        self.ticklabels.draw(renderer, bboxes=bboxes,\n                             ticklabels_bbox=ticklabels_bbox,\n                             tick_out_size=self.ticks.out_size)\n\n        renderer.close_group('ticks')\n\n    def _draw_axislabels(self, renderer, bboxes, ticklabels_bbox, visible_ticks):\n        # Render the default axis label if no axis label is set.\n        if self._auto_axislabel and not self.get_axislabel():\n            self.set_axislabel(self._get_default_axislabel())\n\n        renderer.open_group('axis labels')\n\n        self.axislabels.draw(renderer, bboxes=bboxes,\n                             ticklabels_bbox=ticklabels_bbox,\n                             coord_ticklabels_bbox=ticklabels_bbox[self],\n                             ticks_locs=self.ticks.ticks_locs,\n                             visible_ticks=visible_ticks)\n\n        renderer.close_group('axis labels')\n\n    def _update_ticks(self):\n\n        if self.coord_index is None:\n            return\n\n        # TODO: this method should be optimized for speed\n\n        # Here we determine the location and rotation of all the ticks. For\n        # each axis, we can check the intersections for the specific\n        # coordinate and once we have the tick positions, we can use the WCS\n        # to determine the rotations.\n\n        # Find the range of coordinates in all directions\n        coord_range = self.parent_map.get_coord_range()\n\n        # First find the ticks we want to show\n        tick_world_coordinates, self._fl_spacing = self.locator(*coord_range[self.coord_index])\n\n        if self.ticks.get_display_minor_ticks():\n            minor_ticks_w_coordinates = self._formatter_locator.minor_locator(self._fl_spacing, self.get_minor_frequency(), *coord_range[self.coord_index])\n\n        # We want to allow non-standard rectangular frames, so we just rely on\n        # the parent axes to tell us what the bounding frame is.\n        from . import conf\n        frame = self.frame.sample(conf.frame_boundary_samples)\n\n        self.ticks.clear()\n        self.ticklabels.clear()\n        self.lblinfo = []\n        self.lbl_world = []\n        # Look up parent axes' transform from data to figure coordinates.\n        #\n        # See:\n        # https://matplotlib.org/stable/tutorials/advanced/transforms_tutorial.html#the-transformation-pipeline\n        transData = self.parent_axes.transData\n        invertedTransLimits = transData.inverted()\n\n        for axis, spine in frame.items():\n\n            if not isinstance(self.frame, RectangularFrame1D):\n                # Determine tick rotation in display coordinates and compare to\n                # the normal angle in display coordinates.\n\n                pixel0 = spine.data\n                world0 = spine.world[:, self.coord_index]\n                with np.errstate(invalid='ignore'):\n                    world0 = self.transform.transform(pixel0)[:, self.coord_index]\n                axes0 = transData.transform(pixel0)\n\n                # Advance 2 pixels in figure coordinates\n                pixel1 = axes0.copy()\n                pixel1[:, 0] += 2.0\n                pixel1 = invertedTransLimits.transform(pixel1)\n                with np.errstate(invalid='ignore'):\n                    world1 = self.transform.transform(pixel1)[:, self.coord_index]\n\n                # Advance 2 pixels in figure coordinates\n                pixel2 = axes0.copy()\n                pixel2[:, 1] += 2.0 if self.frame.origin == 'lower' else -2.0\n                pixel2 = invertedTransLimits.transform(pixel2)\n                with np.errstate(invalid='ignore'):\n                    world2 = self.transform.transform(pixel2)[:, self.coord_index]\n\n                dx = (world1 - world0)\n                dy = (world2 - world0)\n\n                # Rotate by 90 degrees\n                dx, dy = -dy, dx\n\n                if self.coord_type == 'longitude':\n\n                    if self._coord_scale_to_deg is not None:\n                        dx *= self._coord_scale_to_deg\n                        dy *= self._coord_scale_to_deg\n\n                    # Here we wrap at 180 not self.coord_wrap since we want to\n                    # always ensure abs(dx) < 180 and abs(dy) < 180\n                    dx = wrap_angle_at(dx, 180.)\n                    dy = wrap_angle_at(dy, 180.)\n\n                tick_angle = np.degrees(np.arctan2(dy, dx))\n\n                normal_angle_full = np.hstack([spine.normal_angle, spine.normal_angle[-1]])\n                with np.errstate(invalid='ignore'):\n                    reset = (((normal_angle_full - tick_angle) % 360 > 90.) &\n                            ((tick_angle - normal_angle_full) % 360 > 90.))\n                tick_angle[reset] -= 180.\n\n            else:\n                rotation = 90 if axis == 'b' else -90\n                tick_angle = np.zeros((conf.frame_boundary_samples,)) + rotation\n\n            # We find for each interval the starting and ending coordinate,\n            # ensuring that we take wrapping into account correctly for\n            # longitudes.\n            w1 = spine.world[:-1, self.coord_index]\n            w2 = spine.world[1:, self.coord_index]\n\n            if self.coord_type == 'longitude':\n\n                if self._coord_scale_to_deg is not None:\n                    w1 = w1 * self._coord_scale_to_deg\n                    w2 = w2 * self._coord_scale_to_deg\n\n                w1 = wrap_angle_at(w1, self.coord_wrap)\n                w2 = wrap_angle_at(w2, self.coord_wrap)\n                with np.errstate(invalid='ignore'):\n                    w1[w2 - w1 > 180.] += 360\n                    w2[w1 - w2 > 180.] += 360\n\n                if self._coord_scale_to_deg is not None:\n                    w1 = w1 / self._coord_scale_to_deg\n                    w2 = w2 / self._coord_scale_to_deg\n\n            # For longitudes, we need to check ticks as well as ticks + 360,\n            # since the above can produce pairs such as 359 to 361 or 0.5 to\n            # 1.5, both of which would match a tick at 0.75. Otherwise we just\n            # check the ticks determined above.\n            self._compute_ticks(tick_world_coordinates, spine, axis, w1, w2, tick_angle)\n\n            if self.ticks.get_display_minor_ticks():\n                self._compute_ticks(minor_ticks_w_coordinates, spine, axis, w1,\n                                    w2, tick_angle, ticks='minor')\n\n        # format tick labels, add to scene\n        text = self.formatter(self.lbl_world * tick_world_coordinates.unit, spacing=self._fl_spacing)\n        for kwargs, txt in zip(self.lblinfo, text):\n            self.ticklabels.add(text=txt, **kwargs)\n\n    def _compute_ticks(self, tick_world_coordinates, spine, axis, w1, w2,\n                       tick_angle, ticks='major'):\n\n        if self.coord_type == 'longitude':\n            tick_world_coordinates_values = tick_world_coordinates.to_value(u.deg)\n            tick_world_coordinates_values = np.hstack([tick_world_coordinates_values,\n                                                       tick_world_coordinates_values + 360])\n            tick_world_coordinates_values *= u.deg.to(self.coord_unit)\n        else:\n            tick_world_coordinates_values = tick_world_coordinates.to_value(self.coord_unit)\n\n        for t in tick_world_coordinates_values:\n\n            # Find steps where a tick is present. We have to check\n            # separately for the case where the tick falls exactly on the\n            # frame points, otherwise we'll get two matches, one for w1 and\n            # one for w2.\n            with np.errstate(invalid='ignore'):\n                intersections = np.hstack([np.nonzero((t - w1) == 0)[0],\n                                           np.nonzero(((t - w1) * (t - w2)) < 0)[0]])\n\n            # But we also need to check for intersection with the last w2\n            if t - w2[-1] == 0:\n                intersections = np.append(intersections, len(w2) - 1)\n\n            # Loop over ticks, and find exact pixel coordinates by linear\n            # interpolation\n            for imin in intersections:\n\n                imax = imin + 1\n\n                if np.allclose(w1[imin], w2[imin], rtol=1.e-13, atol=1.e-13):\n                    continue  # tick is exactly aligned with frame\n                else:\n                    frac = (t - w1[imin]) / (w2[imin] - w1[imin])\n                    x_data_i = spine.data[imin, 0] + frac * (spine.data[imax, 0] - spine.data[imin, 0])\n                    y_data_i = spine.data[imin, 1] + frac * (spine.data[imax, 1] - spine.data[imin, 1])\n                    x_pix_i = spine.pixel[imin, 0] + frac * (spine.pixel[imax, 0] - spine.pixel[imin, 0])\n                    y_pix_i = spine.pixel[imin, 1] + frac * (spine.pixel[imax, 1] - spine.pixel[imin, 1])\n                    delta_angle = tick_angle[imax] - tick_angle[imin]\n                    if delta_angle > 180.:\n                        delta_angle -= 360.\n                    elif delta_angle < -180.:\n                        delta_angle += 360.\n                    angle_i = tick_angle[imin] + frac * delta_angle\n\n                if self.coord_type == 'longitude':\n\n                    if self._coord_scale_to_deg is not None:\n                        t *= self._coord_scale_to_deg\n\n                    world = wrap_angle_at(t, self.coord_wrap)\n\n                    if self._coord_scale_to_deg is not None:\n                        world /= self._coord_scale_to_deg\n\n                else:\n                    world = t\n\n                if ticks == 'major':\n\n                    self.ticks.add(axis=axis,\n                                   pixel=(x_data_i, y_data_i),\n                                   world=world,\n                                   angle=angle_i,\n                                   axis_displacement=imin + frac)\n\n                    # store information to pass to ticklabels.add\n                    # it's faster to format many ticklabels at once outside\n                    # of the loop\n                    self.lblinfo.append(dict(axis=axis,\n                                             pixel=(x_pix_i, y_pix_i),\n                                             world=world,\n                                             angle=spine.normal_angle[imin],\n                                             axis_displacement=imin + frac))\n                    self.lbl_world.append(world)\n\n                else:\n                    self.ticks.add_minor(minor_axis=axis,\n                                         minor_pixel=(x_data_i, y_data_i),\n                                         minor_world=world,\n                                         minor_angle=angle_i,\n                                         minor_axis_displacement=imin + frac)\n\n    def display_minor_ticks(self, display_minor_ticks):\n        \"\"\"\n        Display minor ticks for this coordinate.\n\n        Parameters\n        ----------\n        display_minor_ticks : bool\n            Whether or not to display minor ticks.\n        \"\"\"\n        self.ticks.display_minor_ticks(display_minor_ticks)\n\n    def get_minor_frequency(self):\n        return self.minor_frequency\n\n    def set_minor_frequency(self, frequency):\n        \"\"\"\n        Set the frequency of minor ticks per major ticks.\n\n        Parameters\n        ----------\n        frequency : int\n            The number of minor ticks per major ticks.\n        \"\"\"\n        self.minor_frequency = frequency\n\n    def _update_grid_lines_1d(self):\n        if self.coord_index is None:\n            return\n\n        x_ticks_pos = [a[0] for a in self.ticks.pixel['b']]\n\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        self.grid_lines = []\n        for x_coord in x_ticks_pos:\n            pixel = [[x_coord, ymin], [x_coord, ymax]]\n            self.grid_lines.append(Path(pixel))\n\n    def _update_grid_lines(self):\n\n        # For 3-d WCS with a correlated third axis, the *proper* way of\n        # drawing a grid should be to find the world coordinates of all pixels\n        # and drawing contours. What we are doing here assumes that we can\n        # define the grid lines with just two of the coordinates (and\n        # therefore assumes that the other coordinates are fixed and set to\n        # the value in the slice). Here we basically assume that if the WCS\n        # had a third axis, it has been abstracted away in the transformation.\n\n        if self.coord_index is None:\n            return\n\n        coord_range = self.parent_map.get_coord_range()\n\n        tick_world_coordinates, spacing = self.locator(*coord_range[self.coord_index])\n        tick_world_coordinates_values = tick_world_coordinates.to_value(self.coord_unit)\n\n        n_coord = len(tick_world_coordinates_values)\n\n        from . import conf\n        n_samples = conf.grid_samples\n\n        xy_world = np.zeros((n_samples * n_coord, 2))\n\n        self.grid_lines = []\n\n        for iw, w in enumerate(tick_world_coordinates_values):\n            subset = slice(iw * n_samples, (iw + 1) * n_samples)\n            if self.coord_index == 0:\n                xy_world[subset, 0] = np.repeat(w, n_samples)\n                xy_world[subset, 1] = np.linspace(coord_range[1][0], coord_range[1][1], n_samples)\n            else:\n                xy_world[subset, 0] = np.linspace(coord_range[0][0], coord_range[0][1], n_samples)\n                xy_world[subset, 1] = np.repeat(w, n_samples)\n\n        # We now convert all the world coordinates to pixel coordinates in a\n        # single go rather than doing this in the gridline to path conversion\n        # to fully benefit from vectorized coordinate transformations.\n\n        # Transform line to pixel coordinates\n        pixel = self.transform.inverted().transform(xy_world)\n\n        # Create round-tripped values for checking\n        xy_world_round = self.transform.transform(pixel)\n\n        for iw in range(n_coord):\n            subset = slice(iw * n_samples, (iw + 1) * n_samples)\n            self.grid_lines.append(self._get_gridline(xy_world[subset], pixel[subset], xy_world_round[subset]))\n\n    def _get_gridline(self, xy_world, pixel, xy_world_round):\n        if self.coord_type == 'scalar':\n            return get_gridline_path(xy_world, pixel)\n        else:\n            return get_lon_lat_path(xy_world, pixel, xy_world_round)\n\n    def _clear_grid_contour(self):\n        if hasattr(self, '_grid') and self._grid:\n            for line in self._grid.collections:\n                line.remove()\n\n    def _update_grid_contour(self):\n\n        if self.coord_index is None:\n            return\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        from . import conf\n        res = conf.contour_grid_samples\n\n        x, y = np.meshgrid(np.linspace(xmin, xmax, res),\n                           np.linspace(ymin, ymax, res))\n        pixel = np.array([x.ravel(), y.ravel()]).T\n        world = self.transform.transform(pixel)\n        field = world[:, self.coord_index].reshape(res, res).T\n\n        coord_range = self.parent_map.get_coord_range()\n\n        tick_world_coordinates, spacing = self.locator(*coord_range[self.coord_index])\n\n        # tick_world_coordinates is a Quantities array and we only needs its values\n        tick_world_coordinates_values = tick_world_coordinates.value\n\n        if self.coord_type == 'longitude':\n\n            # Find biggest gap in tick_world_coordinates and wrap in middle\n            # For now just assume spacing is equal, so any mid-point will do\n            mid = 0.5 * (tick_world_coordinates_values[0] + tick_world_coordinates_values[1])\n            field = wrap_angle_at(field, mid)\n            tick_world_coordinates_values = wrap_angle_at(tick_world_coordinates_values, mid)\n\n            # Replace wraps by NaN\n            with np.errstate(invalid='ignore'):\n                reset = (np.abs(np.diff(field[:, :-1], axis=0)) > 180) | (np.abs(np.diff(field[:-1, :], axis=1)) > 180)\n            field[:-1, :-1][reset] = np.nan\n            field[1:, :-1][reset] = np.nan\n            field[:-1, 1:][reset] = np.nan\n            field[1:, 1:][reset] = np.nan\n\n        if len(tick_world_coordinates_values) > 0:\n            with np.errstate(invalid='ignore'):\n                self._grid = self.parent_axes.contour(x, y, field.transpose(), levels=np.sort(tick_world_coordinates_values))\n        else:\n            self._grid = None\n\n    def tick_params(self, which='both', **kwargs):\n        \"\"\"\n        Method to set the tick and tick label parameters in the same way as the\n        :meth:`~matplotlib.axes.Axes.tick_params` method in Matplotlib.\n\n        This is provided for convenience, but the recommended API is to use\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticks`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticklabel`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticks_position`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticklabel_position`,\n        and :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.grid`.\n\n        Parameters\n        ----------\n        which : {'both', 'major', 'minor'}, optional\n            Which ticks to apply the settings to. By default, setting are\n            applied to both major and minor ticks. Note that if ``'minor'`` is\n            specified, only the length of the ticks can be set currently.\n        direction : {'in', 'out'}, optional\n            Puts ticks inside the axes, or outside the axes.\n        length : float, optional\n            Tick length in points.\n        width : float, optional\n            Tick width in points.\n        color : color, optional\n            Tick color (accepts any valid Matplotlib color)\n        pad : float, optional\n            Distance in points between tick and label.\n        labelsize : float or str, optional\n            Tick label font size in points or as a string (e.g., 'large').\n        labelcolor : color, optional\n            Tick label color (accepts any valid Matplotlib color)\n        colors : color, optional\n            Changes the tick color and the label color to the same value\n             (accepts any valid Matplotlib color).\n        bottom, top, left, right : bool, optional\n            Where to draw the ticks. Note that this will not work correctly if\n            the frame is not rectangular.\n        labelbottom, labeltop, labelleft, labelright : bool, optional\n            Where to draw the tick labels. Note that this will not work\n            correctly if the frame is not rectangular.\n        grid_color : color, optional\n            The color of the grid lines (accepts any valid Matplotlib color).\n        grid_alpha : float, optional\n            Transparency of grid lines: 0 (transparent) to 1 (opaque).\n        grid_linewidth : float, optional\n            Width of grid lines in points.\n        grid_linestyle : str, optional\n            The style of the grid lines (accepts any valid Matplotlib line\n            style).\n        \"\"\"\n\n        # First do some sanity checking on the keyword arguments\n\n        # colors= is a fallback default for color and labelcolor\n        if 'colors' in kwargs:\n            if 'color' not in kwargs:\n                kwargs['color'] = kwargs['colors']\n            if 'labelcolor' not in kwargs:\n                kwargs['labelcolor'] = kwargs['colors']\n\n        # The only property that can be set *specifically* for minor ticks is\n        # the length. In future we could consider having a separate Ticks instance\n        # for minor ticks so that e.g. the color can be set separately.\n        if which == 'minor':\n            if len(set(kwargs) - {'length'}) > 0:\n                raise ValueError(\"When setting which='minor', the only \"\n                                 \"property that can be set at the moment is \"\n                                 \"'length' (the minor tick length)\")\n            else:\n                if 'length' in kwargs:\n                    self.ticks.set_minor_ticksize(kwargs['length'])\n            return\n\n        # At this point, we can now ignore the 'which' argument.\n\n        # Set the tick arguments\n        self.set_ticks(size=kwargs.get('length'),\n                       width=kwargs.get('width'),\n                       color=kwargs.get('color'),\n                       direction=kwargs.get('direction'))\n\n        # Set the tick position\n        position = None\n        for arg in ('bottom', 'left', 'top', 'right'):\n            if arg in kwargs and position is None:\n                position = ''\n            if kwargs.get(arg):\n                position += arg[0]\n        if position is not None:\n            self.set_ticks_position(position)\n\n        # Set the tick label arguments.\n        self.set_ticklabel(color=kwargs.get('labelcolor'),\n                           size=kwargs.get('labelsize'),\n                           pad=kwargs.get('pad'))\n\n        # Set the tick label position\n        position = None\n        for arg in ('bottom', 'left', 'top', 'right'):\n            if 'label' + arg in kwargs and position is None:\n                position = ''\n            if kwargs.get('label' + arg):\n                position += arg[0]\n        if position is not None:\n            self.set_ticklabel_position(position)\n\n        # And the grid settings\n        if 'grid_color' in kwargs:\n            self.grid_lines_kwargs['edgecolor'] = kwargs['grid_color']\n        if 'grid_alpha' in kwargs:\n            self.grid_lines_kwargs['alpha'] = kwargs['grid_alpha']\n        if 'grid_linewidth' in kwargs:\n            self.grid_lines_kwargs['linewidth'] = kwargs['grid_linewidth']\n        if 'grid_linestyle' in kwargs:\n            if kwargs['grid_linestyle'] in LINES_TO_PATCHES_LINESTYLE:\n                self.grid_lines_kwargs['linestyle'] = LINES_TO_PATCHES_LINESTYLE[kwargs['grid_linestyle']]\n            else:\n                self.grid_lines_kwargs['linestyle'] = kwargs['grid_linestyle']\n"},{"col":4,"comment":"null","endLoc":87,"header":"def _update_normal(self)","id":16166,"name":"_update_normal","nodeType":"Function","startLoc":83,"text":"def _update_normal(self):\n        # Find angle normal to border and inwards, in display coordinate\n        dx = self.pixel[1:, 0] - self.pixel[:-1, 0]\n        dy = self.pixel[1:, 1] - self.pixel[:-1, 1]\n        self.normal_angle = np.degrees(np.arctan2(dx, -dy))"},{"className":"SphericalCircle","col":0,"comment":"\n    Create a patch representing a spherical circle - that is, a circle that is\n    formed of all the points that are within a certain angle of the central\n    coordinates on a sphere. Here we assume that latitude goes from -90 to +90\n\n    This class is needed in cases where the user wants to add a circular patch\n    to a celestial image, since otherwise the circle will be distorted, because\n    a fixed interval in longitude corresponds to a different angle on the sky\n    depending on the latitude.\n\n    Parameters\n    ----------\n    center : tuple or `~astropy.units.Quantity` ['angle']\n        This can be either a tuple of two `~astropy.units.Quantity` objects, or\n        a single `~astropy.units.Quantity` array with two elements\n        or a `~astropy.coordinates.SkyCoord` object.\n    radius : `~astropy.units.Quantity` ['angle']\n        The radius of the circle\n    resolution : int, optional\n        The number of points that make up the circle - increase this to get a\n        smoother circle.\n    vertex_unit : `~astropy.units.Unit`\n        The units in which the resulting polygon should be defined - this\n        should match the unit that the transformation (e.g. the WCS\n        transformation) expects as input.\n\n    Notes\n    -----\n    Additional keyword arguments are passed to `~matplotlib.patches.Polygon`\n    ","endLoc":115,"id":16167,"nodeType":"Class","startLoc":54,"text":"class SphericalCircle(Polygon):\n    \"\"\"\n    Create a patch representing a spherical circle - that is, a circle that is\n    formed of all the points that are within a certain angle of the central\n    coordinates on a sphere. Here we assume that latitude goes from -90 to +90\n\n    This class is needed in cases where the user wants to add a circular patch\n    to a celestial image, since otherwise the circle will be distorted, because\n    a fixed interval in longitude corresponds to a different angle on the sky\n    depending on the latitude.\n\n    Parameters\n    ----------\n    center : tuple or `~astropy.units.Quantity` ['angle']\n        This can be either a tuple of two `~astropy.units.Quantity` objects, or\n        a single `~astropy.units.Quantity` array with two elements\n        or a `~astropy.coordinates.SkyCoord` object.\n    radius : `~astropy.units.Quantity` ['angle']\n        The radius of the circle\n    resolution : int, optional\n        The number of points that make up the circle - increase this to get a\n        smoother circle.\n    vertex_unit : `~astropy.units.Unit`\n        The units in which the resulting polygon should be defined - this\n        should match the unit that the transformation (e.g. the WCS\n        transformation) expects as input.\n\n    Notes\n    -----\n    Additional keyword arguments are passed to `~matplotlib.patches.Polygon`\n    \"\"\"\n\n    def __init__(self, center, radius, resolution=100, vertex_unit=u.degree, **kwargs):\n\n        # Extract longitude/latitude, either from a SkyCoord object, or\n        # from a tuple of two quantities or a single 2-element Quantity.\n        # The SkyCoord is converted to SphericalRepresentation, if not already.\n        if isinstance(center, SkyCoord):\n            rep_type = center.representation_type\n            if not issubclass(rep_type, (SphericalRepresentation,\n                                         UnitSphericalRepresentation)):\n                warnings.warn(f'Received `center` of representation type {rep_type} '\n                              'will be converted to SphericalRepresentation ',\n                              AstropyUserWarning)\n            longitude, latitude = center.spherical.lon, center.spherical.lat\n        else:\n            longitude, latitude = center\n\n        # Start off by generating the circle around the North pole\n        lon = np.linspace(0., 2 * np.pi, resolution + 1)[:-1] * u.radian\n        lat = np.repeat(0.5 * np.pi - radius.to_value(u.radian), resolution) * u.radian\n\n        lon, lat = _rotate_polygon(lon, lat, longitude, latitude)\n\n        # Extract new longitude/latitude in the requested units\n        lon = lon.to_value(vertex_unit)\n        lat = lat.to_value(vertex_unit)\n\n        # Create polygon vertices\n        vertices = np.array([lon, lat]).transpose()\n\n        super().__init__(vertices, **kwargs)"},{"col":4,"comment":"null","endLoc":53,"header":"@property\n    def pixel(self)","id":16168,"name":"pixel","nodeType":"Function","startLoc":51,"text":"@property\n    def pixel(self):\n        return self._pixel"},{"col":4,"comment":"null","endLoc":65,"header":"@pixel.setter\n    def pixel(self, value)","id":16169,"name":"pixel","nodeType":"Function","startLoc":55,"text":"@pixel.setter\n    def pixel(self, value):\n        if value is None:\n            self._data = None\n            self._pixel = None\n            self._world = None\n        else:\n            self._data = self.parent_axes.transData.inverted().transform(self._data)\n            self._pixel = value\n            self._world = self.transform.transform(self._data)\n            self._update_normal()"},{"col":4,"comment":"null","endLoc":115,"header":"def __init__(self, center, radius, resolution=100, vertex_unit=u.degree, **kwargs)","id":16170,"name":"__init__","nodeType":"Function","startLoc":86,"text":"def __init__(self, center, radius, resolution=100, vertex_unit=u.degree, **kwargs):\n\n        # Extract longitude/latitude, either from a SkyCoord object, or\n        # from a tuple of two quantities or a single 2-element Quantity.\n        # The SkyCoord is converted to SphericalRepresentation, if not already.\n        if isinstance(center, SkyCoord):\n            rep_type = center.representation_type\n            if not issubclass(rep_type, (SphericalRepresentation,\n                                         UnitSphericalRepresentation)):\n                warnings.warn(f'Received `center` of representation type {rep_type} '\n                              'will be converted to SphericalRepresentation ',\n                              AstropyUserWarning)\n            longitude, latitude = center.spherical.lon, center.spherical.lat\n        else:\n            longitude, latitude = center\n\n        # Start off by generating the circle around the North pole\n        lon = np.linspace(0., 2 * np.pi, resolution + 1)[:-1] * u.radian\n        lat = np.repeat(0.5 * np.pi - radius.to_value(u.radian), resolution) * u.radian\n\n        lon, lat = _rotate_polygon(lon, lat, longitude, latitude)\n\n        # Extract new longitude/latitude in the requested units\n        lon = lon.to_value(vertex_unit)\n        lat = lat.to_value(vertex_unit)\n\n        # Create polygon vertices\n        vertices = np.array([lon, lat]).transpose()\n\n        super().__init__(vertices, **kwargs)"},{"col":0,"comment":"null","endLoc":120,"header":"def get_coord_meta(frame)","id":16171,"name":"get_coord_meta","nodeType":"Function","startLoc":99,"text":"def get_coord_meta(frame):\n\n    coord_meta = {}\n    coord_meta['type'] = ('longitude', 'latitude')\n    coord_meta['wrap'] = (None, None)\n    coord_meta['unit'] = (u.deg, u.deg)\n\n    from astropy.coordinates import frame_transform_graph\n\n    if isinstance(frame, str):\n        initial_frame = frame\n        frame = frame_transform_graph.lookup_name(frame)\n        if frame is None:\n            raise ValueError(f\"Unknown frame: {initial_frame}\")\n\n    if not isinstance(frame, BaseCoordinateFrame):\n        frame = frame()\n\n    names = list(frame.representation_component_names.keys())\n    coord_meta['name'] = names[:2]\n\n    return coord_meta"},{"col":4,"comment":"null","endLoc":69,"header":"@property\n    def world(self)","id":16172,"name":"world","nodeType":"Function","startLoc":67,"text":"@property\n    def world(self):\n        return self._world"},{"col":4,"comment":"null","endLoc":81,"header":"@world.setter\n    def world(self, value)","id":16173,"name":"world","nodeType":"Function","startLoc":71,"text":"@world.setter\n    def world(self, value):\n        if value is None:\n            self._data = None\n            self._pixel = None\n            self._world = None\n        else:\n            self._data = self.transform.transform(value)\n            self._pixel = self.parent_axes.transData.transform(self._data)\n            self._world = value\n            self._update_normal()"},{"className":"RectangularFrame1D","col":0,"comment":"\n    A classic rectangular frame.\n    ","endLoc":302,"id":16174,"nodeType":"Class","startLoc":260,"text":"class RectangularFrame1D(BaseFrame):\n    \"\"\"\n    A classic rectangular frame.\n    \"\"\"\n\n    spine_names = 'bt'\n    spine_class = SpineXAligned\n\n    def update_spines(self):\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        self['b'].data = np.array(([xmin, ymin], [xmax, ymin]))\n        self['t'].data = np.array(([xmax, ymax], [xmin, ymax]))\n\n    def _update_patch_path(self):\n\n        self.update_spines()\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        x = [xmin, xmax, xmax, xmin, xmin]\n        y = [ymin, ymin, ymax, ymax, ymin]\n\n        vertices = np.vstack([np.hstack(x), np.hstack(y)]).transpose()\n\n        if self._path is None:\n            self._path = Path(vertices)\n        else:\n            self._path.vertices = vertices\n\n    def draw(self, renderer):\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        x = [xmin, xmax, xmax, xmin, xmin]\n        y = [ymin, ymin, ymax, ymax, ymin]\n\n        line = Line2D(x, y, linewidth=self._linewidth, color=self._color, zorder=1000,\n                      transform=self.parent_axes.transData)\n        line.draw(renderer)"},{"className":"BaseFrame","col":0,"comment":"\n    Base class for frames, which are collections of\n    :class:`~astropy.visualization.wcsaxes.frame.Spine` instances.\n    ","endLoc":257,"id":16175,"nodeType":"Class","startLoc":149,"text":"class BaseFrame(OrderedDict, metaclass=abc.ABCMeta):\n    \"\"\"\n    Base class for frames, which are collections of\n    :class:`~astropy.visualization.wcsaxes.frame.Spine` instances.\n    \"\"\"\n\n    spine_class = Spine\n\n    def __init__(self, parent_axes, transform, path=None):\n\n        super().__init__()\n\n        self.parent_axes = parent_axes\n        self._transform = transform\n        self._linewidth = rcParams['axes.linewidth']\n        self._color = rcParams['axes.edgecolor']\n        self._path = path\n\n        for axis in self.spine_names:\n            self[axis] = self.spine_class(parent_axes, transform)\n\n    @property\n    def origin(self):\n        ymin, ymax = self.parent_axes.get_ylim()\n        return 'lower' if ymin < ymax else 'upper'\n\n    @property\n    def transform(self):\n        return self._transform\n\n    @transform.setter\n    def transform(self, value):\n        self._transform = value\n        for axis in self:\n            self[axis].transform = value\n\n    def _update_patch_path(self):\n\n        self.update_spines()\n        x, y = [], []\n        for axis in self:\n            x.append(self[axis].data[:, 0])\n            y.append(self[axis].data[:, 1])\n        vertices = np.vstack([np.hstack(x), np.hstack(y)]).transpose()\n\n        if self._path is None:\n            self._path = Path(vertices)\n        else:\n            self._path.vertices = vertices\n\n    @property\n    def patch(self):\n        self._update_patch_path()\n        return PathPatch(self._path, transform=self.parent_axes.transData,\n                         facecolor=rcParams['axes.facecolor'], edgecolor='white')\n\n    def draw(self, renderer):\n        for axis in self:\n            x, y = self[axis].pixel[:, 0], self[axis].pixel[:, 1]\n            line = Line2D(x, y, linewidth=self._linewidth, color=self._color, zorder=1000)\n            line.draw(renderer)\n\n    def sample(self, n_samples):\n\n        self.update_spines()\n\n        spines = OrderedDict()\n\n        for axis in self:\n\n            data = self[axis].data\n            p = np.linspace(0., 1., data.shape[0])\n            p_new = np.linspace(0., 1., n_samples)\n            spines[axis] = self.spine_class(self.parent_axes, self.transform)\n            spines[axis].data = np.array([np.interp(p_new, p, d) for d in data.T]).transpose()\n\n        return spines\n\n    def set_color(self, color):\n        \"\"\"\n        Sets the color of the frame.\n\n        Parameters\n        ----------\n        color : str\n            The color of the frame.\n        \"\"\"\n        self._color = color\n\n    def get_color(self):\n        return self._color\n\n    def set_linewidth(self, linewidth):\n        \"\"\"\n        Sets the linewidth of the frame.\n\n        Parameters\n        ----------\n        linewidth : float\n            The linewidth of the frame in points.\n        \"\"\"\n        self._linewidth = linewidth\n\n    def get_linewidth(self):\n        return self._linewidth\n\n    @abc.abstractmethod\n    def update_spines(self):\n        raise NotImplementedError(\"\")"},{"col":4,"comment":"null","endLoc":168,"header":"def __init__(self, parent_axes, transform, path=None)","id":16176,"name":"__init__","nodeType":"Function","startLoc":157,"text":"def __init__(self, parent_axes, transform, path=None):\n\n        super().__init__()\n\n        self.parent_axes = parent_axes\n        self._transform = transform\n        self._linewidth = rcParams['axes.linewidth']\n        self._color = rcParams['axes.edgecolor']\n        self._path = path\n\n        for axis in self.spine_names:\n            self[axis] = self.spine_class(parent_axes, transform)"},{"col":4,"comment":"\n        Return the x, y, normal_angle values halfway along the spine\n        ","endLoc":104,"header":"def _halfway_x_y_angle(self)","id":16177,"name":"_halfway_x_y_angle","nodeType":"Function","startLoc":89,"text":"def _halfway_x_y_angle(self):\n        \"\"\"\n        Return the x, y, normal_angle values halfway along the spine\n        \"\"\"\n        x_disp, y_disp = self.pixel[:, 0], self.pixel[:, 1]\n        # Get distance along the path\n        d = np.hstack([0., np.cumsum(np.sqrt(np.diff(x_disp) ** 2 + np.diff(y_disp) ** 2))])\n        xcen = np.interp(d[-1] / 2., d, x_disp)\n        ycen = np.interp(d[-1] / 2., d, y_disp)\n\n        # Find segment along which the mid-point lies\n        imin = np.searchsorted(d, d[-1] / 2.) - 1\n\n        # Find normal of the axis label facing outwards on that segment\n        normal_angle = self.normal_angle[imin] + 180.\n        return xcen, ycen, normal_angle"},{"col":0,"comment":"\n    Given a polygon with vertices defined by (lon, lat), rotate the polygon\n    such that the North pole of the spherical coordinates is now at (lon0,\n    lat0). Therefore, to end up with a polygon centered on (lon0, lat0), the\n    polygon should initially be drawn around the North pole.\n    ","endLoc":51,"header":"def _rotate_polygon(lon, lat, lon0, lat0)","id":16178,"name":"_rotate_polygon","nodeType":"Function","startLoc":29,"text":"def _rotate_polygon(lon, lat, lon0, lat0):\n    \"\"\"\n    Given a polygon with vertices defined by (lon, lat), rotate the polygon\n    such that the North pole of the spherical coordinates is now at (lon0,\n    lat0). Therefore, to end up with a polygon centered on (lon0, lat0), the\n    polygon should initially be drawn around the North pole.\n    \"\"\"\n\n    # Create a representation object\n    polygon = UnitSphericalRepresentation(lon=lon, lat=lat)\n\n    # Determine rotation matrix to make it so that the circle is centered\n    # on the correct longitude/latitude.\n    m1 = rotation_matrix(-(0.5 * np.pi * u.radian - lat0), axis='y')\n    m2 = rotation_matrix(-lon0, axis='z')\n    transform_matrix = matrix_product(m2, m1)\n\n    # Apply 3D rotation\n    polygon = polygon.to_cartesian()\n    polygon = polygon.transform(transform_matrix)\n    polygon = UnitSphericalRepresentation.from_cartesian(polygon)\n\n    return polygon.lon, polygon.lat"},{"col":4,"comment":"null","endLoc":173,"header":"@property\n    def origin(self)","id":16179,"name":"origin","nodeType":"Function","startLoc":170,"text":"@property\n    def origin(self):\n        ymin, ymax = self.parent_axes.get_ylim()\n        return 'lower' if ymin < ymax else 'upper'"},{"attributeType":"null","col":8,"comment":"null","endLoc":27,"id":16180,"name":"parent_axes","nodeType":"Attribute","startLoc":27,"text":"self.parent_axes"},{"attributeType":"None","col":12,"comment":"null","endLoc":41,"id":16181,"name":"_data","nodeType":"Attribute","startLoc":41,"text":"self._data"},{"attributeType":"null","col":8,"comment":"null","endLoc":28,"id":16182,"name":"transform","nodeType":"Attribute","startLoc":28,"text":"self.transform"},{"attributeType":"None","col":8,"comment":"null","endLoc":32,"id":16183,"name":"world","nodeType":"Attribute","startLoc":32,"text":"self.world"},{"attributeType":"None","col":8,"comment":"null","endLoc":30,"id":16184,"name":"data","nodeType":"Attribute","startLoc":30,"text":"self.data"},{"attributeType":"null","col":8,"comment":"null","endLoc":87,"id":16185,"name":"normal_angle","nodeType":"Attribute","startLoc":87,"text":"self.normal_angle"},{"col":4,"comment":"null","endLoc":177,"header":"@property\n    def transform(self)","id":16186,"name":"transform","nodeType":"Function","startLoc":175,"text":"@property\n    def transform(self):\n        return self._transform"},{"col":4,"comment":"null","endLoc":183,"header":"@transform.setter\n    def transform(self, value)","id":16187,"name":"transform","nodeType":"Function","startLoc":179,"text":"@transform.setter\n    def transform(self, value):\n        self._transform = value\n        for axis in self:\n            self[axis].transform = value"},{"col":4,"comment":"null","endLoc":197,"header":"def _update_patch_path(self)","id":16188,"name":"_update_patch_path","nodeType":"Function","startLoc":185,"text":"def _update_patch_path(self):\n\n        self.update_spines()\n        x, y = [], []\n        for axis in self:\n            x.append(self[axis].data[:, 0])\n            y.append(self[axis].data[:, 1])\n        vertices = np.vstack([np.hstack(x), np.hstack(y)]).transpose()\n\n        if self._path is None:\n            self._path = Path(vertices)\n        else:\n            self._path.vertices = vertices"},{"attributeType":"None","col":8,"comment":"null","endLoc":31,"id":16189,"name":"pixel","nodeType":"Attribute","startLoc":31,"text":"self.pixel"},{"attributeType":"None","col":12,"comment":"null","endLoc":43,"id":16190,"name":"_world","nodeType":"Attribute","startLoc":43,"text":"self._world"},{"attributeType":"None","col":12,"comment":"null","endLoc":42,"id":16191,"name":"_pixel","nodeType":"Attribute","startLoc":42,"text":"self._pixel"},{"className":"SpineXAligned","col":0,"comment":"\n    A single side of an axes, aligned with the X data axis.\n\n    This does not need to be a straight line, but represents a 'side' when\n    determining which part of the frame to put labels and ticks on.\n    ","endLoc":146,"id":16192,"nodeType":"Class","startLoc":107,"text":"class SpineXAligned(Spine):\n    \"\"\"\n    A single side of an axes, aligned with the X data axis.\n\n    This does not need to be a straight line, but represents a 'side' when\n    determining which part of the frame to put labels and ticks on.\n    \"\"\"\n\n    @property\n    def data(self):\n        return self._data\n\n    @data.setter\n    def data(self, value):\n        if value is None:\n            self._data = None\n            self._pixel = None\n            self._world = None\n        else:\n            self._data = value\n            self._pixel = self.parent_axes.transData.transform(self._data)\n            with np.errstate(invalid='ignore'):\n                self._world = self.transform.transform(self._data[:,0:1])\n            self._update_normal()\n\n    @property\n    def pixel(self):\n        return self._pixel\n\n    @pixel.setter\n    def pixel(self, value):\n        if value is None:\n            self._data = None\n            self._pixel = None\n            self._world = None\n        else:\n            self._data = self.parent_axes.transData.inverted().transform(self._data)\n            self._pixel = value\n            self._world = self.transform.transform(self._data[:,0:1])\n            self._update_normal()"},{"col":4,"comment":"null","endLoc":117,"header":"@property\n    def data(self)","id":16193,"name":"data","nodeType":"Function","startLoc":115,"text":"@property\n    def data(self):\n        return self._data"},{"col":4,"comment":"null","endLoc":130,"header":"@data.setter\n    def data(self, value)","id":16194,"name":"data","nodeType":"Function","startLoc":119,"text":"@data.setter\n    def data(self, value):\n        if value is None:\n            self._data = None\n            self._pixel = None\n            self._world = None\n        else:\n            self._data = value\n            self._pixel = self.parent_axes.transData.transform(self._data)\n            with np.errstate(invalid='ignore'):\n                self._world = self.transform.transform(self._data[:,0:1])\n            self._update_normal()"},{"col":4,"comment":"null","endLoc":257,"header":"@abc.abstractmethod\n    def update_spines(self)","id":16195,"name":"update_spines","nodeType":"Function","startLoc":255,"text":"@abc.abstractmethod\n    def update_spines(self):\n        raise NotImplementedError(\"\")"},{"col":4,"comment":"null","endLoc":203,"header":"@property\n    def patch(self)","id":16196,"name":"patch","nodeType":"Function","startLoc":199,"text":"@property\n    def patch(self):\n        self._update_patch_path()\n        return PathPatch(self._path, transform=self.parent_axes.transData,\n                         facecolor=rcParams['axes.facecolor'], edgecolor='white')"},{"col":4,"comment":"null","endLoc":209,"header":"def draw(self, renderer)","id":16197,"name":"draw","nodeType":"Function","startLoc":205,"text":"def draw(self, renderer):\n        for axis in self:\n            x, y = self[axis].pixel[:, 0], self[axis].pixel[:, 1]\n            line = Line2D(x, y, linewidth=self._linewidth, color=self._color, zorder=1000)\n            line.draw(renderer)"},{"col":4,"comment":"null","endLoc":225,"header":"def sample(self, n_samples)","id":16198,"name":"sample","nodeType":"Function","startLoc":211,"text":"def sample(self, n_samples):\n\n        self.update_spines()\n\n        spines = OrderedDict()\n\n        for axis in self:\n\n            data = self[axis].data\n            p = np.linspace(0., 1., data.shape[0])\n            p_new = np.linspace(0., 1., n_samples)\n            spines[axis] = self.spine_class(self.parent_axes, self.transform)\n            spines[axis].data = np.array([np.interp(p_new, p, d) for d in data.T]).transpose()\n\n        return spines"},{"col":0,"comment":"\n    Transform a contour set in-place using a specified\n    :class:`matplotlib.transform.Transform`\n\n    Using transforms with the native Matplotlib contour/contourf can be slow if\n    the transforms have a non-negligible overhead (which is the case for\n    WCS/SkyCoord transforms) since the transform is called for each individual\n    contour line. It is more efficient to stack all the contour lines together\n    temporarily and transform them in one go.\n    ","endLoc":177,"header":"def transform_contour_set_inplace(cset, transform)","id":16199,"name":"transform_contour_set_inplace","nodeType":"Function","startLoc":123,"text":"def transform_contour_set_inplace(cset, transform):\n    \"\"\"\n    Transform a contour set in-place using a specified\n    :class:`matplotlib.transform.Transform`\n\n    Using transforms with the native Matplotlib contour/contourf can be slow if\n    the transforms have a non-negligible overhead (which is the case for\n    WCS/SkyCoord transforms) since the transform is called for each individual\n    contour line. It is more efficient to stack all the contour lines together\n    temporarily and transform them in one go.\n    \"\"\"\n\n    # The contours are represented as paths grouped into levels. Each can have\n    # one or more paths. The approach we take here is to stack the vertices of\n    # all paths and transform them in one go. The pos_level list helps us keep\n    # track of where the set of segments for each overall contour level ends.\n    # The pos_segments list helps us keep track of where each segmnt ends for\n    # each contour level.\n    all_paths = []\n    pos_level = []\n    pos_segments = []\n\n    for collection in cset.collections:\n        paths = collection.get_paths()\n        if len(paths) == 0:\n            continue\n        all_paths.append(paths)\n        # The last item in pos isn't needed for np.split and in fact causes\n        # issues if we keep it because it will cause an extra empty array to be\n        # returned.\n        pos = np.cumsum([len(x) for x in paths])\n        pos_segments.append(pos[:-1])\n        pos_level.append(pos[-1])\n\n    # As above the last item isn't needed\n    pos_level = np.cumsum(pos_level)[:-1]\n\n    # Stack all the segments into a single (n, 2) array\n    vertices = [path.vertices for paths in all_paths for path in paths]\n    if len(vertices) > 0:\n        vertices = np.concatenate(vertices)\n    else:\n        return\n\n    # Transform all coordinates in one go\n    vertices = transform.transform(vertices)\n\n    # Split up into levels again\n    vertices = np.split(vertices, pos_level)\n\n    # Now re-populate the segments in the line collections\n    for ilevel, vert in enumerate(vertices):\n        vert = np.split(vert, pos_segments[ilevel])\n        for iseg, ivert in enumerate(vert):\n            all_paths[ilevel][iseg].vertices = ivert"},{"col":4,"comment":"\n        Sets the color of the frame.\n\n        Parameters\n        ----------\n        color : str\n            The color of the frame.\n        ","endLoc":236,"header":"def set_color(self, color)","id":16200,"name":"set_color","nodeType":"Function","startLoc":227,"text":"def set_color(self, color):\n        \"\"\"\n        Sets the color of the frame.\n\n        Parameters\n        ----------\n        color : str\n            The color of the frame.\n        \"\"\"\n        self._color = color"},{"col":4,"comment":"null","endLoc":239,"header":"def get_color(self)","id":16201,"name":"get_color","nodeType":"Function","startLoc":238,"text":"def get_color(self):\n        return self._color"},{"col":4,"comment":"\n        Sets the linewidth of the frame.\n\n        Parameters\n        ----------\n        linewidth : float\n            The linewidth of the frame in points.\n        ","endLoc":250,"header":"def set_linewidth(self, linewidth)","id":16202,"name":"set_linewidth","nodeType":"Function","startLoc":241,"text":"def set_linewidth(self, linewidth):\n        \"\"\"\n        Sets the linewidth of the frame.\n\n        Parameters\n        ----------\n        linewidth : float\n            The linewidth of the frame in points.\n        \"\"\"\n        self._linewidth = linewidth"},{"col":4,"comment":"null","endLoc":253,"header":"def get_linewidth(self)","id":16203,"name":"get_linewidth","nodeType":"Function","startLoc":252,"text":"def get_linewidth(self):\n        return self._linewidth"},{"attributeType":"null","col":4,"comment":"null","endLoc":155,"id":16204,"name":"spine_class","nodeType":"Attribute","startLoc":155,"text":"spine_class"},{"attributeType":"null","col":8,"comment":"null","endLoc":161,"id":16205,"name":"parent_axes","nodeType":"Attribute","startLoc":161,"text":"self.parent_axes"},{"attributeType":"null","col":8,"comment":"null","endLoc":162,"id":16206,"name":"_transform","nodeType":"Attribute","startLoc":162,"text":"self._transform"},{"attributeType":"null","col":8,"comment":"null","endLoc":163,"id":16207,"name":"_linewidth","nodeType":"Attribute","startLoc":163,"text":"self._linewidth"},{"attributeType":"null","col":8,"comment":"null","endLoc":164,"id":16208,"name":"_color","nodeType":"Attribute","startLoc":164,"text":"self._color"},{"attributeType":"null","col":8,"comment":"null","endLoc":165,"id":16209,"name":"_path","nodeType":"Attribute","startLoc":165,"text":"self._path"},{"col":4,"comment":"null","endLoc":274,"header":"def update_spines(self)","id":16210,"name":"update_spines","nodeType":"Function","startLoc":268,"text":"def update_spines(self):\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        self['b'].data = np.array(([xmin, ymin], [xmax, ymin]))\n        self['t'].data = np.array(([xmax, ymax], [xmin, ymax]))"},{"col":4,"comment":"null","endLoc":134,"header":"@property\n    def pixel(self)","id":16212,"name":"pixel","nodeType":"Function","startLoc":132,"text":"@property\n    def pixel(self):\n        return self._pixel"},{"col":4,"comment":"null","endLoc":146,"header":"@pixel.setter\n    def pixel(self, value)","id":16213,"name":"pixel","nodeType":"Function","startLoc":136,"text":"@pixel.setter\n    def pixel(self, value):\n        if value is None:\n            self._data = None\n            self._pixel = None\n            self._world = None\n        else:\n            self._data = self.parent_axes.transData.inverted().transform(self._data)\n            self._pixel = value\n            self._world = self.transform.transform(self._data[:,0:1])\n            self._update_normal()"},{"col":4,"comment":"null","endLoc":291,"header":"def _update_patch_path(self)","id":16214,"name":"_update_patch_path","nodeType":"Function","startLoc":276,"text":"def _update_patch_path(self):\n\n        self.update_spines()\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        x = [xmin, xmax, xmax, xmin, xmin]\n        y = [ymin, ymin, ymax, ymax, ymin]\n\n        vertices = np.vstack([np.hstack(x), np.hstack(y)]).transpose()\n\n        if self._path is None:\n            self._path = Path(vertices)\n        else:\n            self._path.vertices = vertices"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":16215,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"utils.py#<anonymous>","id":16216,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['select_step_degree', 'select_step_hour', 'select_step_scalar',\n           'transform_contour_set_inplace']"},{"col":4,"comment":"null","endLoc":302,"header":"def draw(self, renderer)","id":16217,"name":"draw","nodeType":"Function","startLoc":293,"text":"def draw(self, renderer):\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        x = [xmin, xmax, xmax, xmin, xmin]\n        y = [ymin, ymin, ymax, ymax, ymin]\n\n        line = Line2D(x, y, linewidth=self._linewidth, color=self._color, zorder=1000,\n                      transform=self.parent_axes.transData)\n        line.draw(renderer)"},{"fileName":"formatter_locator.py","filePath":"astropy/visualization/wcsaxes","id":16218,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\n# This file defines the AngleFormatterLocator class which is a class that\n# provides both a method for a formatter and one for a locator, for a given\n# label spacing. The advantage of keeping the two connected is that we need to\n# make sure that the formatter can correctly represent the spacing requested and\n# vice versa. For example, a format of dd:mm cannot work with a tick spacing\n# that is not a multiple of one arcminute.\n\nimport re\nimport warnings\n\nimport numpy as np\n\nfrom matplotlib import rcParams\n\nfrom astropy import units as u\nfrom astropy.units import UnitsError\nfrom astropy.coordinates import Angle\n\nDMS_RE = re.compile('^dd(:mm(:ss(.(s)+)?)?)?$')\nHMS_RE = re.compile('^hh(:mm(:ss(.(s)+)?)?)?$')\nDDEC_RE = re.compile('^d(.(d)+)?$')\nDMIN_RE = re.compile('^m(.(m)+)?$')\nDSEC_RE = re.compile('^s(.(s)+)?$')\nSCAL_RE = re.compile('^x(.(x)+)?$')\n\n\n# Units with custom representations - see the note where it is used inside\n# AngleFormatterLocator.formatter for more details.\n\nCUSTOM_UNITS = {\n    u.degree: u.def_unit('custom_degree', represents=u.degree,\n                         format={'generic': '\\xb0',\n                                 'latex': r'^\\circ',\n                                 'unicode': '°'}),\n    u.arcmin: u.def_unit('custom_arcmin', represents=u.arcmin,\n                         format={'generic': \"'\",\n                                 'latex': r'^\\prime',\n                                 'unicode': '′'}),\n    u.arcsec: u.def_unit('custom_arcsec', represents=u.arcsec,\n                         format={'generic': '\"',\n                                 'latex': r'^{\\prime\\prime}',\n                                 'unicode': '″'}),\n    u.hourangle: u.def_unit('custom_hourangle', represents=u.hourangle,\n                            format={'generic': 'h',\n                                    'latex': r'^{\\mathrm{h}}',\n                                    'unicode': r'$\\mathregular{^h}$'})}\n\n\nclass BaseFormatterLocator:\n    \"\"\"\n    A joint formatter/locator\n    \"\"\"\n\n    def __init__(self, values=None, number=None, spacing=None, format=None,\n                 unit=None, format_unit=None):\n\n        if len([x for x in (values, number, spacing) if x is None]) < 2:\n            raise ValueError(\"At most one of values/number/spacing can be specified\")\n\n        self._unit = unit\n        self._format_unit = format_unit or unit\n\n        if values is not None:\n            self.values = values\n        elif number is not None:\n            self.number = number\n        elif spacing is not None:\n            self.spacing = spacing\n        else:\n            self.number = 5\n\n        self.format = format\n\n    @property\n    def values(self):\n        return self._values\n\n    @values.setter\n    def values(self, values):\n        if not isinstance(values, u.Quantity) or (not values.ndim == 1):\n            raise TypeError(\"values should be an astropy.units.Quantity array\")\n        if not values.unit.is_equivalent(self._unit):\n            raise UnitsError(\"value should be in units compatible with \"\n                             \"coordinate units ({}) but found {}\".format(self._unit, values.unit))\n        self._number = None\n        self._spacing = None\n        self._values = values\n\n    @property\n    def number(self):\n        return self._number\n\n    @number.setter\n    def number(self, number):\n        self._number = number\n        self._spacing = None\n        self._values = None\n\n    @property\n    def spacing(self):\n        return self._spacing\n\n    @spacing.setter\n    def spacing(self, spacing):\n        self._number = None\n        self._spacing = spacing\n        self._values = None\n\n    def minor_locator(self, spacing, frequency, value_min, value_max):\n        if self.values is not None:\n            return [] * self._unit\n\n        minor_spacing = spacing.value / frequency\n        values = self._locate_values(value_min, value_max, minor_spacing)\n        index = np.where((values % frequency) == 0)\n        index = index[0][0]\n        values = np.delete(values, np.s_[index::frequency])\n        return values * minor_spacing * self._unit\n\n    @property\n    def format_unit(self):\n        return self._format_unit\n\n    @format_unit.setter\n    def format_unit(self, unit):\n        self._format_unit = u.Unit(unit)\n\n    @staticmethod\n    def _locate_values(value_min, value_max, spacing):\n        imin = np.ceil(value_min / spacing)\n        imax = np.floor(value_max / spacing)\n        values = np.arange(imin, imax + 1, dtype=int)\n        return values\n\n\nclass AngleFormatterLocator(BaseFormatterLocator):\n    \"\"\"\n    A joint formatter/locator\n    \"\"\"\n\n    def __init__(self, values=None, number=None, spacing=None, format=None,\n                 unit=None, decimal=None, format_unit=None, show_decimal_unit=True):\n\n        if unit is None:\n            unit = u.degree\n\n        if format_unit is None:\n            format_unit = unit\n\n        if format_unit not in (u.degree, u.hourangle, u.hour):\n            if decimal is False:\n                raise UnitsError(\"Units should be degrees or hours when using non-decimal (sexagesimal) mode\")\n\n        self._decimal = decimal\n        self._sep = None\n        self.show_decimal_unit = show_decimal_unit\n\n        super().__init__(values=values, number=number, spacing=spacing,\n                         format=format, unit=unit, format_unit=format_unit)\n\n    @property\n    def decimal(self):\n        decimal = self._decimal\n        if self.format_unit not in (u.degree, u.hourangle, u.hour):\n            if self._decimal is None:\n                decimal = True\n            elif self._decimal is False:\n                raise UnitsError(\"Units should be degrees or hours when using non-decimal (sexagesimal) mode\")\n        elif self._decimal is None:\n            decimal = False\n        return decimal\n\n    @decimal.setter\n    def decimal(self, value):\n        self._decimal = value\n\n    @property\n    def spacing(self):\n        return self._spacing\n\n    @spacing.setter\n    def spacing(self, spacing):\n        if spacing is not None and (not isinstance(spacing, u.Quantity) or\n                                    spacing.unit.physical_type != 'angle'):\n            raise TypeError(\"spacing should be an astropy.units.Quantity \"\n                            \"instance with units of angle\")\n        self._number = None\n        self._spacing = spacing\n        self._values = None\n\n    @property\n    def sep(self):\n        return self._sep\n\n    @sep.setter\n    def sep(self, separator):\n        self._sep = separator\n\n    @property\n    def format(self):\n        return self._format\n\n    @format.setter\n    def format(self, value):\n\n        self._format = value\n\n        if value is None:\n            return\n\n        if DMS_RE.match(value) is not None:\n            self._decimal = False\n            self._format_unit = u.degree\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n                self._fields = 3\n            else:\n                self._precision = 0\n                self._fields = value.count(':') + 1\n        elif HMS_RE.match(value) is not None:\n            self._decimal = False\n            self._format_unit = u.hourangle\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n                self._fields = 3\n            else:\n                self._precision = 0\n                self._fields = value.count(':') + 1\n        elif DDEC_RE.match(value) is not None:\n            self._decimal = True\n            self._format_unit = u.degree\n            self._fields = 1\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n            else:\n                self._precision = 0\n        elif DMIN_RE.match(value) is not None:\n            self._decimal = True\n            self._format_unit = u.arcmin\n            self._fields = 1\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n            else:\n                self._precision = 0\n        elif DSEC_RE.match(value) is not None:\n            self._decimal = True\n            self._format_unit = u.arcsec\n            self._fields = 1\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n            else:\n                self._precision = 0\n        else:\n            raise ValueError(f\"Invalid format: {value}\")\n\n        if self.spacing is not None and self.spacing < self.base_spacing:\n            warnings.warn(\"Spacing is too small - resetting spacing to match format\")\n            self.spacing = self.base_spacing\n\n        if self.spacing is not None:\n\n            ratio = (self.spacing / self.base_spacing).decompose().value\n            remainder = ratio - np.round(ratio)\n\n            if abs(remainder) > 1.e-10:\n                warnings.warn(\"Spacing is not a multiple of base spacing - resetting spacing to match format\")\n                self.spacing = self.base_spacing * max(1, round(ratio))\n\n    @property\n    def base_spacing(self):\n\n        if self.decimal:\n\n            spacing = self._format_unit / (10. ** self._precision)\n\n        else:\n\n            if self._fields == 1:\n                spacing = 1. * u.degree\n            elif self._fields == 2:\n                spacing = 1. * u.arcmin\n            elif self._fields == 3:\n                if self._precision == 0:\n                    spacing = 1. * u.arcsec\n                else:\n                    spacing = u.arcsec / (10. ** self._precision)\n\n        if self._format_unit is u.hourangle:\n            spacing *= 15\n\n        return spacing\n\n    def locator(self, value_min, value_max):\n\n        if self.values is not None:\n\n            # values were manually specified\n            return self.values, 1.1 * u.arcsec\n\n        else:\n\n            # In the special case where value_min is the same as value_max, we\n            # don't locate any ticks. This can occur for example when taking a\n            # slice for a cube (along the dimension sliced). We return a\n            # non-zero spacing in case the caller needs to format a single\n            # coordinate, e.g. for mousover.\n            if value_min == value_max:\n                return [] * self._unit, 1 * u.arcsec\n\n            if self.spacing is not None:\n\n                # spacing was manually specified\n                spacing_value = self.spacing.to_value(self._unit)\n\n            elif self.number is not None:\n\n                # number of ticks was specified, work out optimal spacing\n\n                # first compute the exact spacing\n                dv = abs(float(value_max - value_min)) / self.number * self._unit\n\n                if self.format is not None and dv < self.base_spacing:\n                    # if the spacing is less than the minimum spacing allowed by the format, simply\n                    # use the format precision instead.\n                    spacing_value = self.base_spacing.to_value(self._unit)\n                else:\n                    # otherwise we clip to the nearest 'sensible' spacing\n                    if self.decimal:\n                        from .utils import select_step_scalar\n                        spacing_value = select_step_scalar(dv.to_value(self._format_unit)) * self._format_unit.to(self._unit)\n                    else:\n                        if self._format_unit is u.degree:\n                            from .utils import select_step_degree\n                            spacing_value = select_step_degree(dv).to_value(self._unit)\n                        else:\n                            from .utils import select_step_hour\n                            spacing_value = select_step_hour(dv).to_value(self._unit)\n\n            # We now find the interval values as multiples of the spacing and\n            # generate the tick positions from this.\n            values = self._locate_values(value_min, value_max, spacing_value)\n            return values * spacing_value * self._unit, spacing_value * self._unit\n\n    def formatter(self, values, spacing, format='auto'):\n\n        if not isinstance(values, u.Quantity) and values is not None:\n            raise TypeError(\"values should be a Quantities array\")\n\n        if len(values) > 0:\n\n            decimal = self.decimal\n            unit = self._format_unit\n\n            if unit is u.hour:\n                unit = u.hourangle\n\n            if self.format is None:\n                if decimal:\n                    # Here we assume the spacing can be arbitrary, so for example\n                    # 1.000223 degrees, in which case we don't want to have a\n                    # format that rounds to degrees. So we find the number of\n                    # decimal places we get from representing the spacing as a\n                    # string in the desired units. The easiest way to find\n                    # the smallest number of decimal places required is to\n                    # format the number as a decimal float and strip any zeros\n                    # from the end. We do this rather than just trusting e.g.\n                    # str() because str(15.) == 15.0. We format using 10 decimal\n                    # places by default before stripping the zeros since this\n                    # corresponds to a resolution of less than a microarcecond,\n                    # which should be sufficient.\n                    spacing = spacing.to_value(unit)\n                    fields = 0\n                    precision = len(f\"{spacing:.10f}\".replace('0', ' ').strip().split('.', 1)[1])\n                else:\n                    spacing = spacing.to_value(unit / 3600)\n                    if spacing >= 3600:\n                        fields = 1\n                        precision = 0\n                    elif spacing >= 60:\n                        fields = 2\n                        precision = 0\n                    elif spacing >= 1:\n                        fields = 3\n                        precision = 0\n                    else:\n                        fields = 3\n                        precision = -int(np.floor(np.log10(spacing)))\n            else:\n                fields = self._fields\n                precision = self._precision\n\n            is_latex = format == 'latex' or (format == 'auto' and rcParams['text.usetex'])\n\n            if decimal:\n                # At the moment, the Angle class doesn't have a consistent way\n                # to always convert angles to strings in decimal form with\n                # symbols for units (instead of e.g 3arcsec). So as a workaround\n                # we take advantage of the fact that Angle.to_string converts\n                # the unit to a string manually when decimal=False and the unit\n                # is not strictly u.degree or u.hourangle\n                if self.show_decimal_unit:\n                    decimal = False\n                    sep = 'fromunit'\n                    if is_latex:\n                        fmt = 'latex'\n                    else:\n                        if unit is u.hourangle:\n                            fmt = 'unicode'\n                        else:\n                            fmt = None\n                    unit = CUSTOM_UNITS.get(unit, unit)\n                else:\n                    sep = None\n                    fmt = None\n            elif self.sep is not None:\n                sep = self.sep\n                fmt = None\n            else:\n                sep = 'fromunit'\n                if unit == u.degree:\n                    if is_latex:\n                        fmt = 'latex'\n                    else:\n                        sep = ('\\xb0', \"'\", '\"')\n                        fmt = None\n                else:\n                    if format == 'ascii':\n                        fmt = None\n                    elif is_latex:\n                        fmt = 'latex'\n                    else:\n                        # Here we still use LaTeX but this is for Matplotlib's\n                        # LaTeX engine - we can't use fmt='latex' as this\n                        # doesn't produce LaTeX output that respects the fonts.\n                        sep = (r'$\\mathregular{^h}$', r'$\\mathregular{^m}$', r'$\\mathregular{^s}$')\n                        fmt = None\n\n            angles = Angle(values)\n            string = angles.to_string(unit=unit,\n                                      precision=precision,\n                                      decimal=decimal,\n                                      fields=fields,\n                                      sep=sep,\n                                      format=fmt).tolist()\n\n            return string\n        else:\n            return []\n\n\nclass ScalarFormatterLocator(BaseFormatterLocator):\n    \"\"\"\n    A joint formatter/locator\n    \"\"\"\n\n    def __init__(self, values=None, number=None, spacing=None, format=None,\n                 unit=None, format_unit=None):\n\n        if unit is not None:\n            unit = unit\n            format_unit = format_unit or unit\n        elif spacing is not None:\n            unit = spacing.unit\n            format_unit = format_unit or spacing.unit\n        elif values is not None:\n            unit = values.unit\n            format_unit = format_unit or values.unit\n\n        super().__init__(values=values, number=number, spacing=spacing,\n                         format=format, unit=unit, format_unit=format_unit)\n\n    @property\n    def spacing(self):\n        return self._spacing\n\n    @spacing.setter\n    def spacing(self, spacing):\n        if spacing is not None and not isinstance(spacing, u.Quantity):\n            raise TypeError(\"spacing should be an astropy.units.Quantity instance\")\n        self._number = None\n        self._spacing = spacing\n        self._values = None\n\n    @property\n    def format(self):\n        return self._format\n\n    @format.setter\n    def format(self, value):\n\n        self._format = value\n\n        if value is None:\n            return\n\n        if SCAL_RE.match(value) is not None:\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n            else:\n                self._precision = 0\n\n            if self.spacing is not None and self.spacing < self.base_spacing:\n                warnings.warn(\"Spacing is too small - resetting spacing to match format\")\n                self.spacing = self.base_spacing\n\n            if self.spacing is not None:\n\n                ratio = (self.spacing / self.base_spacing).decompose().value\n                remainder = ratio - np.round(ratio)\n\n                if abs(remainder) > 1.e-10:\n                    warnings.warn(\"Spacing is not a multiple of base spacing - resetting spacing to match format\")\n                    self.spacing = self.base_spacing * max(1, round(ratio))\n\n        elif not value.startswith('%'):\n            raise ValueError(f\"Invalid format: {value}\")\n\n    @property\n    def base_spacing(self):\n        return self._format_unit / (10. ** self._precision)\n\n    def locator(self, value_min, value_max):\n\n        if self.values is not None:\n\n            # values were manually specified\n            return self.values, 1.1 * self._unit\n        else:\n\n            # In the special case where value_min is the same as value_max, we\n            # don't locate any ticks. This can occur for example when taking a\n            # slice for a cube (along the dimension sliced).\n            if value_min == value_max:\n                return [] * self._unit, 0 * self._unit\n\n            if self.spacing is not None:\n\n                # spacing was manually specified\n                spacing = self.spacing.to_value(self._unit)\n\n            elif self.number is not None:\n\n                # number of ticks was specified, work out optimal spacing\n\n                # first compute the exact spacing\n                dv = abs(float(value_max - value_min)) / self.number * self._unit\n\n                if self.format is not None and (not self.format.startswith('%')) and dv < self.base_spacing:\n                    # if the spacing is less than the minimum spacing allowed by the format, simply\n                    # use the format precision instead.\n                    spacing = self.base_spacing.to_value(self._unit)\n                else:\n                    from .utils import select_step_scalar\n                    spacing = select_step_scalar(dv.to_value(self._format_unit)) * self._format_unit.to(self._unit)\n\n            # We now find the interval values as multiples of the spacing and\n            # generate the tick positions from this\n\n            values = self._locate_values(value_min, value_max, spacing)\n            return values * spacing * self._unit, spacing * self._unit\n\n    def formatter(self, values, spacing, format='auto'):\n\n        if len(values) > 0:\n            if self.format is None:\n                if spacing.value < 1.:\n                    precision = -int(np.floor(np.log10(spacing.value)))\n                else:\n                    precision = 0\n            elif self.format.startswith('%'):\n                return [(self.format % x.value) for x in values]\n            else:\n                precision = self._precision\n\n            return [(\"{0:.\" + str(precision) + \"f}\").format(x.to_value(self._format_unit)) for x in values]\n\n        else:\n            return []\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":265,"id":16219,"name":"spine_names","nodeType":"Attribute","startLoc":265,"text":"spine_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":266,"id":16220,"name":"spine_class","nodeType":"Attribute","startLoc":266,"text":"spine_class"},{"attributeType":"null","col":12,"comment":"null","endLoc":289,"id":16221,"name":"_path","nodeType":"Attribute","startLoc":289,"text":"self._path"},{"className":"EllipticalFrame","col":0,"comment":"\n    An elliptical frame.\n    ","endLoc":370,"id":16222,"nodeType":"Class","startLoc":323,"text":"class EllipticalFrame(BaseFrame):\n    \"\"\"\n    An elliptical frame.\n    \"\"\"\n\n    spine_names = 'chv'\n\n    def update_spines(self):\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        xmid = 0.5 * (xmax + xmin)\n        ymid = 0.5 * (ymax + ymin)\n\n        dx = xmid - xmin\n        dy = ymid - ymin\n\n        theta = np.linspace(0., 2 * np.pi, 1000)\n        self['c'].data = np.array([xmid + dx * np.cos(theta),\n                                   ymid + dy * np.sin(theta)]).transpose()\n        self['h'].data = np.array([np.linspace(xmin, xmax, 1000),\n                                   np.repeat(ymid, 1000)]).transpose()\n        self['v'].data = np.array([np.repeat(xmid, 1000),\n                                   np.linspace(ymin, ymax, 1000)]).transpose()\n\n    def _update_patch_path(self):\n        \"\"\"Override path patch to include only the outer ellipse,\n        not the major and minor axes in the middle.\"\"\"\n\n        self.update_spines()\n        vertices = self['c'].data\n\n        if self._path is None:\n            self._path = Path(vertices)\n        else:\n            self._path.vertices = vertices\n\n    def draw(self, renderer):\n        \"\"\"Override to draw only the outer ellipse,\n        not the major and minor axes in the middle.\n\n        FIXME: we may want to add a general method to give the user control\n        over which spines are drawn.\"\"\"\n        axis = 'c'\n        x, y = self[axis].pixel[:, 0], self[axis].pixel[:, 1]\n        line = Line2D(x, y, linewidth=self._linewidth, color=self._color, zorder=1000)\n        line.draw(renderer)"},{"col":4,"comment":"null","endLoc":347,"header":"def update_spines(self)","id":16223,"name":"update_spines","nodeType":"Function","startLoc":330,"text":"def update_spines(self):\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        xmid = 0.5 * (xmax + xmin)\n        ymid = 0.5 * (ymax + ymin)\n\n        dx = xmid - xmin\n        dy = ymid - ymin\n\n        theta = np.linspace(0., 2 * np.pi, 1000)\n        self['c'].data = np.array([xmid + dx * np.cos(theta),\n                                   ymid + dy * np.sin(theta)]).transpose()\n        self['h'].data = np.array([np.linspace(xmin, xmax, 1000),\n                                   np.repeat(ymid, 1000)]).transpose()\n        self['v'].data = np.array([np.repeat(xmid, 1000),\n                                   np.linspace(ymin, ymax, 1000)]).transpose()"},{"attributeType":"None","col":12,"comment":"null","endLoc":122,"id":16224,"name":"_data","nodeType":"Attribute","startLoc":122,"text":"self._data"},{"attributeType":"None","col":12,"comment":"null","endLoc":124,"id":16225,"name":"_world","nodeType":"Attribute","startLoc":124,"text":"self._world"},{"attributeType":"None","col":12,"comment":"null","endLoc":123,"id":16226,"name":"_pixel","nodeType":"Attribute","startLoc":123,"text":"self._pixel"},{"className":"RectangularFrame","col":0,"comment":"\n    A classic rectangular frame.\n    ","endLoc":320,"id":16227,"nodeType":"Class","startLoc":305,"text":"class RectangularFrame(BaseFrame):\n    \"\"\"\n    A classic rectangular frame.\n    \"\"\"\n\n    spine_names = 'brtl'\n\n    def update_spines(self):\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        self['b'].data = np.array(([xmin, ymin], [xmax, ymin]))\n        self['r'].data = np.array(([xmax, ymin], [xmax, ymax]))\n        self['t'].data = np.array(([xmax, ymax], [xmin, ymax]))\n        self['l'].data = np.array(([xmin, ymax], [xmin, ymin]))"},{"col":4,"comment":"null","endLoc":320,"header":"def update_spines(self)","id":16228,"name":"update_spines","nodeType":"Function","startLoc":312,"text":"def update_spines(self):\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        self['b'].data = np.array(([xmin, ymin], [xmax, ymin]))\n        self['r'].data = np.array(([xmax, ymin], [xmax, ymax]))\n        self['t'].data = np.array(([xmax, ymax], [xmin, ymax]))\n        self['l'].data = np.array(([xmin, ymax], [xmin, ymin]))"},{"className":"Quadrangle","col":0,"comment":"\n    Create a patch representing a latitude-longitude quadrangle.\n\n    The edges of the quadrangle lie on two lines of constant longitude and two\n    lines of constant latitude (or the equivalent component names in the\n    coordinate frame of interest, such as right ascension and declination).\n    Note that lines of constant latitude are not great circles.\n\n    Unlike `matplotlib.patches.Rectangle`, the edges of this patch will render\n    as curved lines if appropriate for the WCS transformation.\n\n    Parameters\n    ----------\n    anchor : tuple or `~astropy.units.Quantity` ['angle']\n        This can be either a tuple of two `~astropy.units.Quantity` objects, or\n        a single `~astropy.units.Quantity` array with two elements.\n    width : `~astropy.units.Quantity` ['angle']\n        The width of the quadrangle in longitude (or, e.g., right ascension)\n    height : `~astropy.units.Quantity` ['angle']\n        The height of the quadrangle in latitude (or, e.g., declination)\n    resolution : int, optional\n        The number of points that make up each side of the quadrangle -\n        increase this to get a smoother quadrangle.\n    vertex_unit : `~astropy.units.Unit` ['angle']\n        The units in which the resulting polygon should be defined - this\n        should match the unit that the transformation (e.g. the WCS\n        transformation) expects as input.\n\n    Notes\n    -----\n    Additional keyword arguments are passed to `~matplotlib.patches.Polygon`\n    ","endLoc":179,"id":16229,"nodeType":"Class","startLoc":118,"text":"class Quadrangle(Polygon):\n    \"\"\"\n    Create a patch representing a latitude-longitude quadrangle.\n\n    The edges of the quadrangle lie on two lines of constant longitude and two\n    lines of constant latitude (or the equivalent component names in the\n    coordinate frame of interest, such as right ascension and declination).\n    Note that lines of constant latitude are not great circles.\n\n    Unlike `matplotlib.patches.Rectangle`, the edges of this patch will render\n    as curved lines if appropriate for the WCS transformation.\n\n    Parameters\n    ----------\n    anchor : tuple or `~astropy.units.Quantity` ['angle']\n        This can be either a tuple of two `~astropy.units.Quantity` objects, or\n        a single `~astropy.units.Quantity` array with two elements.\n    width : `~astropy.units.Quantity` ['angle']\n        The width of the quadrangle in longitude (or, e.g., right ascension)\n    height : `~astropy.units.Quantity` ['angle']\n        The height of the quadrangle in latitude (or, e.g., declination)\n    resolution : int, optional\n        The number of points that make up each side of the quadrangle -\n        increase this to get a smoother quadrangle.\n    vertex_unit : `~astropy.units.Unit` ['angle']\n        The units in which the resulting polygon should be defined - this\n        should match the unit that the transformation (e.g. the WCS\n        transformation) expects as input.\n\n    Notes\n    -----\n    Additional keyword arguments are passed to `~matplotlib.patches.Polygon`\n    \"\"\"\n\n    def __init__(self, anchor, width, height, resolution=100, vertex_unit=u.degree, **kwargs):\n\n        # Extract longitude/latitude, either from a tuple of two quantities, or\n        # a single 2-element Quantity.\n        longitude, latitude = u.Quantity(anchor).to_value(vertex_unit)\n\n        # Convert the quadrangle dimensions to the appropriate units\n        width = width.to_value(vertex_unit)\n        height = height.to_value(vertex_unit)\n\n        # Create progressions in longitude and latitude\n        lon_seq = longitude + np.linspace(0, width, resolution + 1)\n        lat_seq = latitude + np.linspace(0, height, resolution + 1)\n\n        # Trace the path of the quadrangle\n        lon = np.concatenate([lon_seq[:-1],\n                              np.repeat(lon_seq[-1], resolution),\n                              np.flip(lon_seq[1:]),\n                              np.repeat(lon_seq[0], resolution)])\n        lat = np.concatenate([np.repeat(lat_seq[0], resolution),\n                              lat_seq[:-1],\n                              np.repeat(lat_seq[-1], resolution),\n                              np.flip(lat_seq[1:])])\n\n        # Create polygon vertices\n        vertices = np.array([lon, lat]).transpose()\n\n        super().__init__(vertices, **kwargs)"},{"col":4,"comment":"null","endLoc":179,"header":"def __init__(self, anchor, width, height, resolution=100, vertex_unit=u.degree, **kwargs)","id":16230,"name":"__init__","nodeType":"Function","startLoc":152,"text":"def __init__(self, anchor, width, height, resolution=100, vertex_unit=u.degree, **kwargs):\n\n        # Extract longitude/latitude, either from a tuple of two quantities, or\n        # a single 2-element Quantity.\n        longitude, latitude = u.Quantity(anchor).to_value(vertex_unit)\n\n        # Convert the quadrangle dimensions to the appropriate units\n        width = width.to_value(vertex_unit)\n        height = height.to_value(vertex_unit)\n\n        # Create progressions in longitude and latitude\n        lon_seq = longitude + np.linspace(0, width, resolution + 1)\n        lat_seq = latitude + np.linspace(0, height, resolution + 1)\n\n        # Trace the path of the quadrangle\n        lon = np.concatenate([lon_seq[:-1],\n                              np.repeat(lon_seq[-1], resolution),\n                              np.flip(lon_seq[1:]),\n                              np.repeat(lon_seq[0], resolution)])\n        lat = np.concatenate([np.repeat(lat_seq[0], resolution),\n                              lat_seq[:-1],\n                              np.repeat(lat_seq[-1], resolution),\n                              np.flip(lat_seq[1:])])\n\n        # Create polygon vertices\n        vertices = np.array([lon, lat]).transpose()\n\n        super().__init__(vertices, **kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":310,"id":16232,"name":"spine_names","nodeType":"Attribute","startLoc":310,"text":"spine_names"},{"attributeType":"null","col":16,"comment":"null","endLoc":7,"id":16233,"name":"np","nodeType":"Attribute","startLoc":7,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":16234,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"frame.py#<anonymous>","id":16235,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['RectangularFrame1D', 'Spine', 'BaseFrame', 'RectangularFrame', 'EllipticalFrame']"},{"className":"BaseFormatterLocator","col":0,"comment":"\n    A joint formatter/locator\n    ","endLoc":136,"id":16236,"nodeType":"Class","startLoc":52,"text":"class BaseFormatterLocator:\n    \"\"\"\n    A joint formatter/locator\n    \"\"\"\n\n    def __init__(self, values=None, number=None, spacing=None, format=None,\n                 unit=None, format_unit=None):\n\n        if len([x for x in (values, number, spacing) if x is None]) < 2:\n            raise ValueError(\"At most one of values/number/spacing can be specified\")\n\n        self._unit = unit\n        self._format_unit = format_unit or unit\n\n        if values is not None:\n            self.values = values\n        elif number is not None:\n            self.number = number\n        elif spacing is not None:\n            self.spacing = spacing\n        else:\n            self.number = 5\n\n        self.format = format\n\n    @property\n    def values(self):\n        return self._values\n\n    @values.setter\n    def values(self, values):\n        if not isinstance(values, u.Quantity) or (not values.ndim == 1):\n            raise TypeError(\"values should be an astropy.units.Quantity array\")\n        if not values.unit.is_equivalent(self._unit):\n            raise UnitsError(\"value should be in units compatible with \"\n                             \"coordinate units ({}) but found {}\".format(self._unit, values.unit))\n        self._number = None\n        self._spacing = None\n        self._values = values\n\n    @property\n    def number(self):\n        return self._number\n\n    @number.setter\n    def number(self, number):\n        self._number = number\n        self._spacing = None\n        self._values = None\n\n    @property\n    def spacing(self):\n        return self._spacing\n\n    @spacing.setter\n    def spacing(self, spacing):\n        self._number = None\n        self._spacing = spacing\n        self._values = None\n\n    def minor_locator(self, spacing, frequency, value_min, value_max):\n        if self.values is not None:\n            return [] * self._unit\n\n        minor_spacing = spacing.value / frequency\n        values = self._locate_values(value_min, value_max, minor_spacing)\n        index = np.where((values % frequency) == 0)\n        index = index[0][0]\n        values = np.delete(values, np.s_[index::frequency])\n        return values * minor_spacing * self._unit\n\n    @property\n    def format_unit(self):\n        return self._format_unit\n\n    @format_unit.setter\n    def format_unit(self, unit):\n        self._format_unit = u.Unit(unit)\n\n    @staticmethod\n    def _locate_values(value_min, value_max, spacing):\n        imin = np.ceil(value_min / spacing)\n        imax = np.floor(value_max / spacing)\n        values = np.arange(imin, imax + 1, dtype=int)\n        return values"},{"col":4,"comment":"null","endLoc":75,"header":"def __init__(self, values=None, number=None, spacing=None, format=None,\n                 unit=None, format_unit=None)","id":16237,"name":"__init__","nodeType":"Function","startLoc":57,"text":"def __init__(self, values=None, number=None, spacing=None, format=None,\n                 unit=None, format_unit=None):\n\n        if len([x for x in (values, number, spacing) if x is None]) < 2:\n            raise ValueError(\"At most one of values/number/spacing can be specified\")\n\n        self._unit = unit\n        self._format_unit = format_unit or unit\n\n        if values is not None:\n            self.values = values\n        elif number is not None:\n            self.number = number\n        elif spacing is not None:\n            self.spacing = spacing\n        else:\n            self.number = 5\n\n        self.format = format"},{"fileName":"wcsapi.py","filePath":"astropy/visualization/wcsaxes","id":16238,"nodeType":"File","text":"# Functions/classes for WCSAxes related to APE14 WCSes\n\nimport numpy as np\n\nfrom astropy.coordinates import SkyCoord, ICRS, BaseCoordinateFrame\nfrom astropy import units as u\nfrom astropy.wcs import WCS\nfrom astropy.wcs.utils import local_partial_pixel_derivatives\nfrom astropy.wcs.wcsapi import SlicedLowLevelWCS\n\nfrom .frame import RectangularFrame, EllipticalFrame, RectangularFrame1D\nfrom .transforms import CurvedTransform\n\n__all__ = ['transform_coord_meta_from_wcs', 'WCSWorld2PixelTransform',\n           'WCSPixel2WorldTransform']\n\nIDENTITY = WCS(naxis=2)\nIDENTITY.wcs.ctype = [\"X\", \"Y\"]\nIDENTITY.wcs.crval = [0., 0.]\nIDENTITY.wcs.crpix = [1., 1.]\nIDENTITY.wcs.cdelt = [1., 1.]\n\n\ndef transform_coord_meta_from_wcs(wcs, frame_class, slices=None):\n\n    if slices is not None:\n        slices = tuple(slices)\n\n    if wcs.pixel_n_dim > 2:\n        if slices is None:\n            raise ValueError(\"WCS has more than 2 pixel dimensions, so \"\n                             \"'slices' should be set\")\n        elif len(slices) != wcs.pixel_n_dim:\n            raise ValueError(\"'slices' should have as many elements as WCS \"\n                             \"has pixel dimensions (should be {})\"\n                             .format(wcs.pixel_n_dim))\n\n    is_fits_wcs = isinstance(wcs, WCS) or (isinstance(wcs, SlicedLowLevelWCS) and isinstance(wcs._wcs, WCS))\n\n    coord_meta = {}\n    coord_meta['name'] = []\n    coord_meta['type'] = []\n    coord_meta['wrap'] = []\n    coord_meta['unit'] = []\n    coord_meta['visible'] = []\n    coord_meta['format_unit'] = []\n\n    for idx in range(wcs.world_n_dim):\n\n        axis_type = wcs.world_axis_physical_types[idx]\n        axis_unit = u.Unit(wcs.world_axis_units[idx])\n        coord_wrap = None\n        format_unit = axis_unit\n\n        coord_type = 'scalar'\n\n        if axis_type is not None:\n\n            axis_type_split = axis_type.split('.')\n\n            if \"pos.helioprojective.lon\" in axis_type:\n                coord_wrap = 180.\n                format_unit = u.arcsec\n                coord_type = \"longitude\"\n            elif \"pos.helioprojective.lat\" in axis_type:\n                format_unit = u.arcsec\n                coord_type = \"latitude\"\n            elif \"pos.heliographic.stonyhurst.lon\" in axis_type:\n                coord_wrap = 180.\n                format_unit = u.deg\n                coord_type = \"longitude\"\n            elif \"pos.heliographic.stonyhurst.lat\" in axis_type:\n                format_unit = u.deg\n                coord_type = \"latitude\"\n            elif \"pos.heliographic.carrington.lon\" in axis_type:\n                coord_wrap = 360.\n                format_unit = u.deg\n                coord_type = \"longitude\"\n            elif \"pos.heliographic.carrington.lat\" in axis_type:\n                format_unit = u.deg\n                coord_type = \"latitude\"\n            elif \"pos\" in axis_type_split:\n                if \"lon\" in axis_type_split:\n                    coord_type = \"longitude\"\n                elif \"lat\" in axis_type_split:\n                    coord_type = \"latitude\"\n                elif \"ra\" in axis_type_split:\n                    coord_type = \"longitude\"\n                    format_unit = u.hourangle\n                elif \"dec\" in axis_type_split:\n                    coord_type = \"latitude\"\n                elif \"alt\" in axis_type_split:\n                    coord_type = \"longitude\"\n                elif \"az\" in axis_type_split:\n                    coord_type = \"latitude\"\n                elif \"long\" in axis_type_split:\n                    coord_type = \"longitude\"\n\n        coord_meta['type'].append(coord_type)\n        coord_meta['wrap'].append(coord_wrap)\n        coord_meta['format_unit'].append(format_unit)\n        coord_meta['unit'].append(axis_unit)\n\n        # For FITS-WCS, for backward-compatibility, we need to make sure that we\n        # provide aliases based on CTYPE for the name.\n        if is_fits_wcs:\n            name = []\n            if isinstance(wcs, WCS):\n                name.append(wcs.wcs.ctype[idx].lower())\n                name.append(wcs.wcs.ctype[idx][:4].replace('-', '').lower())\n            elif isinstance(wcs, SlicedLowLevelWCS):\n                name.append(wcs._wcs.wcs.ctype[wcs._world_keep[idx]].lower())\n                name.append(wcs._wcs.wcs.ctype[wcs._world_keep[idx]][:4].replace('-', '').lower())\n            if name[0] == name[1]:\n                name = name[0:1]\n            if axis_type:\n                if axis_type not in name:\n                    name.insert(0, axis_type)\n            if wcs.world_axis_names and wcs.world_axis_names[idx]:\n                if wcs.world_axis_names[idx] not in name:\n                    name.append(wcs.world_axis_names[idx])\n            name = tuple(name) if len(name) > 1 else name[0]\n        else:\n            name = axis_type or ''\n            if wcs.world_axis_names:\n                name = (name, wcs.world_axis_names[idx]) if wcs.world_axis_names[idx] else name\n\n        coord_meta['name'].append(name)\n\n    coord_meta['default_axislabel_position'] = [''] * wcs.world_n_dim\n    coord_meta['default_ticklabel_position'] = [''] * wcs.world_n_dim\n    coord_meta['default_ticks_position'] = [''] * wcs.world_n_dim\n    # If the world axis has a name use it, else display the world axis physical type.\n    fallback_labels = [name[0] if isinstance(name, (list, tuple)) else name for name in coord_meta['name']]\n    coord_meta['default_axis_label'] = [wcs.world_axis_names[i] or fallback_label for i, fallback_label in enumerate(fallback_labels)]\n\n    transform_wcs, invert_xy, world_map = apply_slices(wcs, slices)\n\n    transform = WCSPixel2WorldTransform(transform_wcs, invert_xy=invert_xy)\n\n    for i in range(len(coord_meta['type'])):\n        coord_meta['visible'].append(i in world_map)\n\n    inv_all_corr = [False] * wcs.world_n_dim\n    m = transform_wcs.axis_correlation_matrix.copy()\n    if invert_xy:\n        inv_all_corr = np.all(m, axis=1)\n        m = m[:, ::-1]\n\n    if frame_class is RectangularFrame:\n\n        for i, spine_name in enumerate('bltr'):\n            pos = np.nonzero(m[:, i % 2])[0]\n            # If all the axes we have are correlated with each other and we\n            # have inverted the axes, then we need to reverse the index so we\n            # put the 'y' on the left.\n            if inv_all_corr[i % 2]:\n                pos = pos[::-1]\n\n            if len(pos) > 0:\n                index = world_map[pos[0]]\n                coord_meta['default_axislabel_position'][index] = spine_name\n                coord_meta['default_ticklabel_position'][index] = spine_name\n                coord_meta['default_ticks_position'][index] = spine_name\n                m[pos[0], :] = 0\n\n        # In the special and common case where the frame is rectangular and\n        # we are dealing with 2-d WCS (after slicing), we show all ticks on\n        # all axes for backward-compatibility.\n        if len(world_map) == 2:\n            for index in world_map:\n                coord_meta['default_ticks_position'][index] = 'bltr'\n\n    elif frame_class is RectangularFrame1D:\n        derivs = np.abs(local_partial_pixel_derivatives(transform_wcs, *[0]*transform_wcs.pixel_n_dim,\n                                                        normalize_by_world=False))[:, 0]\n        for i, spine_name in enumerate('bt'):\n            # Here we are iterating over the correlated axes in world axis order.\n            # We want to sort the correlated axes by their partial derivatives,\n            # so we put the most rapidly changing world axis on the bottom.\n            pos = np.nonzero(m[:, 0])[0]\n            order = np.argsort(derivs[pos])[::-1]  # Sort largest to smallest\n            pos = pos[order]\n            if len(pos) > 0:\n                index = world_map[pos[0]]\n                coord_meta['default_axislabel_position'][index] = spine_name\n                coord_meta['default_ticklabel_position'][index] = spine_name\n                coord_meta['default_ticks_position'][index] = spine_name\n                m[pos[0], :] = 0\n\n        # In the special and common case where the frame is rectangular and\n        # we are dealing with 2-d WCS (after slicing), we show all ticks on\n        # all axes for backward-compatibility.\n        if len(world_map) == 1:\n            for index in world_map:\n                coord_meta['default_ticks_position'][index] = 'bt'\n\n    elif frame_class is EllipticalFrame:\n\n        if 'longitude' in coord_meta['type']:\n            lon_idx = coord_meta['type'].index('longitude')\n            coord_meta['default_axislabel_position'][lon_idx] = 'h'\n            coord_meta['default_ticklabel_position'][lon_idx] = 'h'\n            coord_meta['default_ticks_position'][lon_idx] = 'h'\n\n        if 'latitude' in coord_meta['type']:\n            lat_idx = coord_meta['type'].index('latitude')\n            coord_meta['default_axislabel_position'][lat_idx] = 'c'\n            coord_meta['default_ticklabel_position'][lat_idx] = 'c'\n            coord_meta['default_ticks_position'][lat_idx] = 'c'\n\n    else:\n\n        for index in range(len(coord_meta['type'])):\n            if index in world_map:\n                coord_meta['default_axislabel_position'][index] = frame_class.spine_names\n                coord_meta['default_ticklabel_position'][index] = frame_class.spine_names\n                coord_meta['default_ticks_position'][index] = frame_class.spine_names\n\n    return transform, coord_meta\n\n\ndef apply_slices(wcs, slices):\n    \"\"\"\n    Take the input WCS and slices and return a sliced WCS for the transform and\n    a mapping of world axes in the sliced WCS to the input WCS.\n    \"\"\"\n    if isinstance(wcs, SlicedLowLevelWCS):\n        world_keep = list(wcs._world_keep)\n    else:\n        world_keep = list(range(wcs.world_n_dim))\n\n    # world_map is the index of the world axis in the input WCS for a given\n    # axis in the transform_wcs\n    world_map = list(range(wcs.world_n_dim))\n    transform_wcs = wcs\n    invert_xy = False\n    if slices is not None:\n        wcs_slice = list(slices)\n        wcs_slice[wcs_slice.index(\"x\")] = slice(None)\n        if 'y' in slices:\n            wcs_slice[wcs_slice.index(\"y\")] = slice(None)\n            invert_xy = slices.index('x') > slices.index('y')\n\n        transform_wcs = SlicedLowLevelWCS(wcs, wcs_slice[::-1])\n        world_map = tuple(world_keep.index(i) for i in transform_wcs._world_keep)\n\n    return transform_wcs, invert_xy, world_map\n\n\ndef wcsapi_to_celestial_frame(wcs):\n    for cls, _, kwargs, *_ in wcs.world_axis_object_classes.values():\n        if issubclass(cls, SkyCoord):\n            return kwargs.get('frame', ICRS())\n        elif issubclass(cls, BaseCoordinateFrame):\n            return cls(**kwargs)\n\n\nclass WCSWorld2PixelTransform(CurvedTransform):\n    \"\"\"\n    WCS transformation from world to pixel coordinates\n    \"\"\"\n\n    has_inverse = True\n    frame_in = None\n\n    def __init__(self, wcs, invert_xy=False):\n\n        super().__init__()\n\n        if wcs.pixel_n_dim > 2:\n            raise ValueError('Only pixel_n_dim =< 2 is supported')\n\n        self.wcs = wcs\n        self.invert_xy = invert_xy\n\n        self.frame_in = wcsapi_to_celestial_frame(wcs)\n\n    def __eq__(self, other):\n        return (isinstance(other, type(self)) and self.wcs is other.wcs and\n                self.invert_xy == other.invert_xy)\n\n    @property\n    def input_dims(self):\n        return self.wcs.world_n_dim\n\n    def transform(self, world):\n\n        # Convert to a list of arrays\n        world = list(world.T)\n\n        if len(world) != self.wcs.world_n_dim:\n            raise ValueError(f\"Expected {self.wcs.world_n_dim} world coordinates, got {len(world)} \")\n\n        if len(world[0]) == 0:\n            pixel = np.zeros((0, 2))\n        else:\n            pixel = self.wcs.world_to_pixel_values(*world)\n\n        if self.invert_xy:\n            pixel = pixel[::-1]\n\n        pixel = np.array(pixel).T\n\n        return pixel\n\n    transform_non_affine = transform\n\n    def inverted(self):\n        \"\"\"\n        Return the inverse of the transform\n        \"\"\"\n        return WCSPixel2WorldTransform(self.wcs, invert_xy=self.invert_xy)\n\n\nclass WCSPixel2WorldTransform(CurvedTransform):\n    \"\"\"\n    WCS transformation from pixel to world coordinates\n    \"\"\"\n\n    has_inverse = True\n\n    def __init__(self, wcs, invert_xy=False):\n\n        super().__init__()\n\n        if wcs.pixel_n_dim > 2:\n            raise ValueError('Only pixel_n_dim =< 2 is supported')\n\n        self.wcs = wcs\n        self.invert_xy = invert_xy\n\n        self.frame_out = wcsapi_to_celestial_frame(wcs)\n\n    def __eq__(self, other):\n        return (isinstance(other, type(self)) and self.wcs is other.wcs and\n                self.invert_xy == other.invert_xy)\n\n    @property\n    def output_dims(self):\n        return self.wcs.world_n_dim\n\n    def transform(self, pixel):\n\n        # Convert to a list of arrays\n        pixel = list(pixel.T)\n\n        if len(pixel) != self.wcs.pixel_n_dim:\n            raise ValueError(f\"Expected {self.wcs.pixel_n_dim} world coordinates, got {len(pixel)} \")\n\n        if self.invert_xy:\n            pixel = pixel[::-1]\n\n        if len(pixel[0]) == 0:\n            world = np.zeros((0, self.wcs.world_n_dim))\n        else:\n            world = self.wcs.pixel_to_world_values(*pixel)\n\n        if self.wcs.world_n_dim == 1:\n            world = [world]\n\n        world = np.array(world).T\n\n        return world\n\n    transform_non_affine = transform\n\n    def inverted(self):\n        \"\"\"\n        Return the inverse of the transform\n        \"\"\"\n        return WCSWorld2PixelTransform(self.wcs, invert_xy=self.invert_xy)\n"},{"className":"CurvedTransform","col":0,"comment":"\n    Abstract base class for non-affine curved transforms\n    ","endLoc":56,"id":16240,"nodeType":"Class","startLoc":25,"text":"class CurvedTransform(Transform, metaclass=abc.ABCMeta):\n    \"\"\"\n    Abstract base class for non-affine curved transforms\n    \"\"\"\n\n    input_dims = 2\n    output_dims = 2\n    is_separable = False\n\n    def transform_path(self, path):\n        \"\"\"\n        Transform a Matplotlib Path\n\n        Parameters\n        ----------\n        path : :class:`~matplotlib.path.Path`\n            The path to transform\n\n        Returns\n        -------\n        path : :class:`~matplotlib.path.Path`\n            The resulting path\n        \"\"\"\n        return Path(self.transform(path.vertices), path.codes)\n\n    transform_path_non_affine = transform_path\n\n    def transform(self, input):\n        raise NotImplementedError(\"\")\n\n    def inverted(self):\n        raise NotImplementedError(\"\")"},{"col":4,"comment":"null","endLoc":79,"header":"@property\n    def values(self)","id":16241,"name":"values","nodeType":"Function","startLoc":77,"text":"@property\n    def values(self):\n        return self._values"},{"col":4,"comment":"null","endLoc":90,"header":"@values.setter\n    def values(self, values)","id":16242,"name":"values","nodeType":"Function","startLoc":81,"text":"@values.setter\n    def values(self, values):\n        if not isinstance(values, u.Quantity) or (not values.ndim == 1):\n            raise TypeError(\"values should be an astropy.units.Quantity array\")\n        if not values.unit.is_equivalent(self._unit):\n            raise UnitsError(\"value should be in units compatible with \"\n                             \"coordinate units ({}) but found {}\".format(self._unit, values.unit))\n        self._number = None\n        self._spacing = None\n        self._values = values"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":16244,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":16245,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":13,"text":"__doctest_requires__"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":16246,"name":"UNSUPPORTED_FORMATS","nodeType":"Attribute","startLoc":15,"text":"UNSUPPORTED_FORMATS"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":16247,"name":"YMDHMS_FORMATS","nodeType":"Attribute","startLoc":16,"text":"YMDHMS_FORMATS"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":16248,"name":"STR_FORMATS","nodeType":"Attribute","startLoc":17,"text":"STR_FORMATS"},{"col":0,"comment":"","endLoc":4,"header":"time.py#<anonymous>","id":16249,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['time_support']\n\n__doctest_requires__ = {'time_support': ['matplotlib']}\n\nUNSUPPORTED_FORMATS = ('datetime', 'datetime64')\n\nYMDHMS_FORMATS = ('fits', 'iso', 'isot', 'yday')\n\nSTR_FORMATS = YMDHMS_FORMATS + ('byear_str', 'jyear_str')"},{"col":4,"comment":"\n        Transform a Matplotlib Path\n\n        Parameters\n        ----------\n        path : :class:`~matplotlib.path.Path`\n            The path to transform\n\n        Returns\n        -------\n        path : :class:`~matplotlib.path.Path`\n            The resulting path\n        ","endLoc":48,"header":"def transform_path(self, path)","id":16250,"name":"transform_path","nodeType":"Function","startLoc":34,"text":"def transform_path(self, path):\n        \"\"\"\n        Transform a Matplotlib Path\n\n        Parameters\n        ----------\n        path : :class:`~matplotlib.path.Path`\n            The path to transform\n\n        Returns\n        -------\n        path : :class:`~matplotlib.path.Path`\n            The resulting path\n        \"\"\"\n        return Path(self.transform(path.vertices), path.codes)"},{"col":4,"comment":"null","endLoc":94,"header":"@property\n    def number(self)","id":16251,"name":"number","nodeType":"Function","startLoc":92,"text":"@property\n    def number(self):\n        return self._number"},{"col":4,"comment":"null","endLoc":100,"header":"@number.setter\n    def number(self, number)","id":16252,"name":"number","nodeType":"Function","startLoc":96,"text":"@number.setter\n    def number(self, number):\n        self._number = number\n        self._spacing = None\n        self._values = None"},{"col":4,"comment":"null","endLoc":104,"header":"@property\n    def spacing(self)","id":16253,"name":"spacing","nodeType":"Function","startLoc":102,"text":"@property\n    def spacing(self):\n        return self._spacing"},{"col":4,"comment":"null","endLoc":110,"header":"@spacing.setter\n    def spacing(self, spacing)","id":16254,"name":"spacing","nodeType":"Function","startLoc":106,"text":"@spacing.setter\n    def spacing(self, spacing):\n        self._number = None\n        self._spacing = spacing\n        self._values = None"},{"col":4,"comment":"null","endLoc":121,"header":"def minor_locator(self, spacing, frequency, value_min, value_max)","id":16255,"name":"minor_locator","nodeType":"Function","startLoc":112,"text":"def minor_locator(self, spacing, frequency, value_min, value_max):\n        if self.values is not None:\n            return [] * self._unit\n\n        minor_spacing = spacing.value / frequency\n        values = self._locate_values(value_min, value_max, minor_spacing)\n        index = np.where((values % frequency) == 0)\n        index = index[0][0]\n        values = np.delete(values, np.s_[index::frequency])\n        return values * minor_spacing * self._unit"},{"col":4,"comment":"null","endLoc":53,"header":"def transform(self, input)","id":16256,"name":"transform","nodeType":"Function","startLoc":52,"text":"def transform(self, input):\n        raise NotImplementedError(\"\")"},{"col":4,"comment":"null","endLoc":56,"header":"def inverted(self)","id":16257,"name":"inverted","nodeType":"Function","startLoc":55,"text":"def inverted(self):\n        raise NotImplementedError(\"\")"},{"col":4,"comment":"Override path patch to include only the outer ellipse,\n        not the major and minor axes in the middle.","endLoc":359,"header":"def _update_patch_path(self)","id":16258,"name":"_update_patch_path","nodeType":"Function","startLoc":349,"text":"def _update_patch_path(self):\n        \"\"\"Override path patch to include only the outer ellipse,\n        not the major and minor axes in the middle.\"\"\"\n\n        self.update_spines()\n        vertices = self['c'].data\n\n        if self._path is None:\n            self._path = Path(vertices)\n        else:\n            self._path.vertices = vertices"},{"attributeType":"null","col":4,"comment":"null","endLoc":30,"id":16259,"name":"input_dims","nodeType":"Attribute","startLoc":30,"text":"input_dims"},{"attributeType":"null","col":4,"comment":"null","endLoc":31,"id":16260,"name":"output_dims","nodeType":"Attribute","startLoc":31,"text":"output_dims"},{"attributeType":"null","col":4,"comment":"null","endLoc":32,"id":16261,"name":"is_separable","nodeType":"Attribute","startLoc":32,"text":"is_separable"},{"attributeType":"function","col":4,"comment":"null","endLoc":50,"id":16262,"name":"transform_path_non_affine","nodeType":"Attribute","startLoc":50,"text":"transform_path_non_affine"},{"className":"WCSWorld2PixelTransform","col":0,"comment":"\n    WCS transformation from world to pixel coordinates\n    ","endLoc":313,"id":16263,"nodeType":"Class","startLoc":259,"text":"class WCSWorld2PixelTransform(CurvedTransform):\n    \"\"\"\n    WCS transformation from world to pixel coordinates\n    \"\"\"\n\n    has_inverse = True\n    frame_in = None\n\n    def __init__(self, wcs, invert_xy=False):\n\n        super().__init__()\n\n        if wcs.pixel_n_dim > 2:\n            raise ValueError('Only pixel_n_dim =< 2 is supported')\n\n        self.wcs = wcs\n        self.invert_xy = invert_xy\n\n        self.frame_in = wcsapi_to_celestial_frame(wcs)\n\n    def __eq__(self, other):\n        return (isinstance(other, type(self)) and self.wcs is other.wcs and\n                self.invert_xy == other.invert_xy)\n\n    @property\n    def input_dims(self):\n        return self.wcs.world_n_dim\n\n    def transform(self, world):\n\n        # Convert to a list of arrays\n        world = list(world.T)\n\n        if len(world) != self.wcs.world_n_dim:\n            raise ValueError(f\"Expected {self.wcs.world_n_dim} world coordinates, got {len(world)} \")\n\n        if len(world[0]) == 0:\n            pixel = np.zeros((0, 2))\n        else:\n            pixel = self.wcs.world_to_pixel_values(*world)\n\n        if self.invert_xy:\n            pixel = pixel[::-1]\n\n        pixel = np.array(pixel).T\n\n        return pixel\n\n    transform_non_affine = transform\n\n    def inverted(self):\n        \"\"\"\n        Return the inverse of the transform\n        \"\"\"\n        return WCSPixel2WorldTransform(self.wcs, invert_xy=self.invert_xy)"},{"col":4,"comment":"Override to draw only the outer ellipse,\n        not the major and minor axes in the middle.\n\n        FIXME: we may want to add a general method to give the user control\n        over which spines are drawn.","endLoc":370,"header":"def draw(self, renderer)","id":16264,"name":"draw","nodeType":"Function","startLoc":361,"text":"def draw(self, renderer):\n        \"\"\"Override to draw only the outer ellipse,\n        not the major and minor axes in the middle.\n\n        FIXME: we may want to add a general method to give the user control\n        over which spines are drawn.\"\"\"\n        axis = 'c'\n        x, y = self[axis].pixel[:, 0], self[axis].pixel[:, 1]\n        line = Line2D(x, y, linewidth=self._linewidth, color=self._color, zorder=1000)\n        line.draw(renderer)"},{"attributeType":"null","col":4,"comment":"null","endLoc":328,"id":16265,"name":"spine_names","nodeType":"Attribute","startLoc":328,"text":"spine_names"},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":16266,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"fileName":"ticklabels.py","filePath":"astropy/visualization/wcsaxes","id":16267,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport numpy as np\n\nfrom matplotlib import rcParams\nfrom matplotlib.text import Text\n\nfrom .frame import RectangularFrame\n\n\ndef sort_using(X, Y):\n    return [x for (y, x) in sorted(zip(Y, X))]\n\n\nclass TickLabels(Text):\n\n    def __init__(self, frame, *args, **kwargs):\n        self.clear()\n        self._frame = frame\n        super().__init__(*args, **kwargs)\n        self.set_clip_on(True)\n        self.set_visible_axes('all')\n        self.set_pad(rcParams['xtick.major.pad'])\n        self._exclude_overlapping = False\n\n        # Stale if either xy positions haven't been calculated, or if\n        # something changes that requires recomputing the positions\n        self._stale = True\n\n        # Check rcParams\n\n        if 'color' not in kwargs:\n            self.set_color(rcParams['xtick.color'])\n\n        if 'size' not in kwargs:\n            self.set_size(rcParams['xtick.labelsize'])\n\n    def clear(self):\n        self.world = {}\n        self.pixel = {}\n        self.angle = {}\n        self.text = {}\n        self.disp = {}\n\n    def add(self, axis, world, pixel, angle, text, axis_displacement):\n        if axis not in self.world:\n            self.world[axis] = [world]\n            self.pixel[axis] = [pixel]\n            self.angle[axis] = [angle]\n            self.text[axis] = [text]\n            self.disp[axis] = [axis_displacement]\n        else:\n            self.world[axis].append(world)\n            self.pixel[axis].append(pixel)\n            self.angle[axis].append(angle)\n            self.text[axis].append(text)\n            self.disp[axis].append(axis_displacement)\n        self._stale = True\n\n    def sort(self):\n        \"\"\"\n        Sort by axis displacement, which allows us to figure out which parts\n        of labels to not repeat.\n        \"\"\"\n        for axis in self.world:\n            self.world[axis] = sort_using(self.world[axis], self.disp[axis])\n            self.pixel[axis] = sort_using(self.pixel[axis], self.disp[axis])\n            self.angle[axis] = sort_using(self.angle[axis], self.disp[axis])\n            self.text[axis] = sort_using(self.text[axis], self.disp[axis])\n            self.disp[axis] = sort_using(self.disp[axis], self.disp[axis])\n        self._stale = True\n\n    def simplify_labels(self):\n        \"\"\"\n        Figure out which parts of labels can be dropped to avoid repetition.\n        \"\"\"\n        self.sort()\n        for axis in self.world:\n            t1 = self.text[axis][0]\n            for i in range(1, len(self.world[axis])):\n                t2 = self.text[axis][i]\n                if len(t1) != len(t2):\n                    t1 = self.text[axis][i]\n                    continue\n                start = 0\n                # In the following loop, we need to ignore the last character,\n                # hence the len(t1) - 1. This is because if we have two strings\n                # like 13d14m15s we want to make sure that we keep the last\n                # part (15s) even if the two labels are identical.\n                for j in range(len(t1) - 1):\n                    if t1[j] != t2[j]:\n                        break\n                    if t1[j] not in '-0123456789.':\n                        start = j + 1\n                t1 = self.text[axis][i]\n                if start != 0:\n                    starts_dollar = self.text[axis][i].startswith('$')\n                    self.text[axis][i] = self.text[axis][i][start:]\n                    if starts_dollar:\n                        self.text[axis][i] = '$' + self.text[axis][i]\n                # Remove any empty LaTeX inline math mode string\n                if self.text[axis][i] == '$$':\n                    self.text[axis][i] = ''\n\n        self._stale = True\n\n    def set_pad(self, value):\n        self._pad = value\n        self._stale = True\n\n    def get_pad(self):\n        return self._pad\n\n    def set_visible_axes(self, visible_axes):\n        self._visible_axes = visible_axes\n        self._stale = True\n\n    def get_visible_axes(self):\n        if self._visible_axes == 'all':\n            return self.world.keys()\n        else:\n            return [x for x in self._visible_axes if x in self.world]\n\n    def set_exclude_overlapping(self, exclude_overlapping):\n        self._exclude_overlapping = exclude_overlapping\n\n    def _set_xy_alignments(self, renderer, tick_out_size):\n        \"\"\"\n        Compute and set the x, y positions and the horizontal/vertical alignment of\n        each label.\n        \"\"\"\n        if not self._stale:\n            return\n\n        self.simplify_labels()\n        text_size = renderer.points_to_pixels(self.get_size())\n\n        visible_axes = self.get_visible_axes()\n        self.xy = {axis: {} for axis in visible_axes}\n        self.ha = {axis: {} for axis in visible_axes}\n        self.va = {axis: {} for axis in visible_axes}\n\n        for axis in visible_axes:\n            for i in range(len(self.world[axis])):\n                # In the event that the label is empty (which is not expected\n                # but could happen in unforeseen corner cases), we should just\n                # skip to the next label.\n                if self.text[axis][i] == '':\n                    continue\n\n                x, y = self.pixel[axis][i]\n                pad = renderer.points_to_pixels(self.get_pad() + tick_out_size)\n\n                if isinstance(self._frame, RectangularFrame):\n                    # This is just to preserve the current results, but can be\n                    # removed next time the reference images are re-generated.\n                    if np.abs(self.angle[axis][i]) < 45.:\n                        ha = 'right'\n                        va = 'bottom'\n                        dx = -pad\n                        dy = -text_size * 0.5\n                    elif np.abs(self.angle[axis][i] - 90.) < 45:\n                        ha = 'center'\n                        va = 'bottom'\n                        dx = 0\n                        dy = -text_size - pad\n                    elif np.abs(self.angle[axis][i] - 180.) < 45:\n                        ha = 'left'\n                        va = 'bottom'\n                        dx = pad\n                        dy = -text_size * 0.5\n                    else:\n                        ha = 'center'\n                        va = 'bottom'\n                        dx = 0\n                        dy = pad\n\n                    x = x + dx\n                    y = y + dy\n\n                else:\n                    # This is the more general code for arbitrarily oriented\n                    # axes\n\n                    # Set initial position and find bounding box\n                    self.set_text(self.text[axis][i])\n                    self.set_position((x, y))\n                    bb = super().get_window_extent(renderer)\n\n                    # Find width and height, as well as angle at which we\n                    # transition which side of the label we use to anchor the\n                    # label.\n                    width = bb.width\n                    height = bb.height\n\n                    # Project axis angle onto bounding box\n                    ax = np.cos(np.radians(self.angle[axis][i]))\n                    ay = np.sin(np.radians(self.angle[axis][i]))\n\n                    # Set anchor point for label\n                    if np.abs(self.angle[axis][i]) < 45.:\n                        dx = width\n                        dy = ay * height\n                    elif np.abs(self.angle[axis][i] - 90.) < 45:\n                        dx = ax * width\n                        dy = height\n                    elif np.abs(self.angle[axis][i] - 180.) < 45:\n                        dx = -width\n                        dy = ay * height\n                    else:\n                        dx = ax * width\n                        dy = -height\n\n                    dx *= 0.5\n                    dy *= 0.5\n\n                    # Find normalized vector along axis normal, so as to be\n                    # able to nudge the label away by a constant padding factor\n\n                    dist = np.hypot(dx, dy)\n\n                    ddx = dx / dist\n                    ddy = dy / dist\n\n                    dx += ddx * pad\n                    dy += ddy * pad\n\n                    x = x - dx\n                    y = y - dy\n\n                    ha = 'center'\n                    va = 'center'\n\n                self.xy[axis][i] = (x, y)\n                self.ha[axis][i] = ha\n                self.va[axis][i] = va\n\n        self._stale = False\n\n    def _get_bb(self, axis, i, renderer):\n        \"\"\"\n        Get the bounding box of an individual label. n.b. _set_xy_alignment()\n        must be called before this method.\n        \"\"\"\n        if self.text[axis][i] == '':\n            return\n\n        self.set_text(self.text[axis][i])\n        self.set_position(self.xy[axis][i])\n        self.set_ha(self.ha[axis][i])\n        self.set_va(self.va[axis][i])\n        return super().get_window_extent(renderer)\n\n    def draw(self, renderer, bboxes, ticklabels_bbox, tick_out_size):\n        if not self.get_visible():\n            return\n\n        self._set_xy_alignments(renderer, tick_out_size)\n\n        for axis in self.get_visible_axes():\n            for i in range(len(self.world[axis])):\n                # This implicitly sets the label text, position, alignment\n                bb = self._get_bb(axis, i, renderer)\n                if bb is None:\n                    continue\n\n                # TODO: the problem here is that we might get rid of a label\n                # that has a key starting bit such as -0:30 where the -0\n                # might be dropped from all other labels.\n\n                if not self._exclude_overlapping or bb.count_overlaps(bboxes) == 0:\n                    super().draw(renderer)\n                    bboxes.append(bb)\n                    ticklabels_bbox[axis].append(bb)\n"},{"attributeType":"null","col":29,"comment":"null","endLoc":8,"id":16268,"name":"u","nodeType":"Attribute","startLoc":8,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":16269,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":16270,"name":"__doc__","nodeType":"Attribute","startLoc":19,"text":"Polygon.__init__.__doc__"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":16271,"name":"__doc__","nodeType":"Attribute","startLoc":21,"text":"Polygon.__init__.__doc__"},{"col":4,"comment":"null","endLoc":277,"header":"def __init__(self, wcs, invert_xy=False)","id":16272,"name":"__init__","nodeType":"Function","startLoc":267,"text":"def __init__(self, wcs, invert_xy=False):\n\n        super().__init__()\n\n        if wcs.pixel_n_dim > 2:\n            raise ValueError('Only pixel_n_dim =< 2 is supported')\n\n        self.wcs = wcs\n        self.invert_xy = invert_xy\n\n        self.frame_in = wcsapi_to_celestial_frame(wcs)"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":16273,"name":"__doc__","nodeType":"Attribute","startLoc":23,"text":"Polygon.set_capstyle.__doc__"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":16274,"name":"__doc__","nodeType":"Attribute","startLoc":25,"text":"Polygon.set_joinstyle.__doc__"},{"col":0,"comment":"null","endLoc":256,"header":"def wcsapi_to_celestial_frame(wcs)","id":16275,"name":"wcsapi_to_celestial_frame","nodeType":"Function","startLoc":251,"text":"def wcsapi_to_celestial_frame(wcs):\n    for cls, _, kwargs, *_ in wcs.world_axis_object_classes.values():\n        if issubclass(cls, SkyCoord):\n            return kwargs.get('frame', ICRS())\n        elif issubclass(cls, BaseCoordinateFrame):\n            return cls(**kwargs)"},{"col":4,"comment":"null","endLoc":136,"header":"@staticmethod\n    def _locate_values(value_min, value_max, spacing)","id":16276,"name":"_locate_values","nodeType":"Function","startLoc":131,"text":"@staticmethod\n    def _locate_values(value_min, value_max, spacing):\n        imin = np.ceil(value_min / spacing)\n        imax = np.floor(value_max / spacing)\n        values = np.arange(imin, imax + 1, dtype=int)\n        return values"},{"col":4,"comment":"null","endLoc":125,"header":"@property\n    def format_unit(self)","id":16277,"name":"format_unit","nodeType":"Function","startLoc":123,"text":"@property\n    def format_unit(self):\n        return self._format_unit"},{"col":4,"comment":"null","endLoc":129,"header":"@format_unit.setter\n    def format_unit(self, unit)","id":16278,"name":"format_unit","nodeType":"Function","startLoc":127,"text":"@format_unit.setter\n    def format_unit(self, unit):\n        self._format_unit = u.Unit(unit)"},{"attributeType":"null","col":12,"comment":"null","endLoc":357,"id":16279,"name":"_path","nodeType":"Attribute","startLoc":357,"text":"self._path"},{"attributeType":"null","col":8,"comment":"null","endLoc":64,"id":16280,"name":"_format_unit","nodeType":"Attribute","startLoc":64,"text":"self._format_unit"},{"col":0,"comment":"","endLoc":4,"header":"patches.py#<anonymous>","id":16281,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['Quadrangle', 'SphericalCircle']\n\nPolygon.__init__.__doc__ = Polygon.__init__.__doc__.replace(\n    \"`.CapStyle`\", \"``matplotlib._enums.CapStyle``\")\n\nPolygon.__init__.__doc__ = Polygon.__init__.__doc__.replace(\n    \"`.JoinStyle`\", \"``matplotlib._enums.JoinStyle``\")\n\nPolygon.set_capstyle.__doc__ = Polygon.set_capstyle.__doc__.replace(\n    \"`.CapStyle`\", \"``matplotlib._enums.CapStyle``\")\n\nPolygon.set_joinstyle.__doc__ = Polygon.set_joinstyle.__doc__.replace(\n    \"`.JoinStyle`\", \"``matplotlib._enums.JoinStyle``\")"},{"className":"AngleFormatterLocator","col":0,"comment":"\n    A joint formatter/locator\n    ","endLoc":451,"id":16282,"nodeType":"Class","startLoc":139,"text":"class AngleFormatterLocator(BaseFormatterLocator):\n    \"\"\"\n    A joint formatter/locator\n    \"\"\"\n\n    def __init__(self, values=None, number=None, spacing=None, format=None,\n                 unit=None, decimal=None, format_unit=None, show_decimal_unit=True):\n\n        if unit is None:\n            unit = u.degree\n\n        if format_unit is None:\n            format_unit = unit\n\n        if format_unit not in (u.degree, u.hourangle, u.hour):\n            if decimal is False:\n                raise UnitsError(\"Units should be degrees or hours when using non-decimal (sexagesimal) mode\")\n\n        self._decimal = decimal\n        self._sep = None\n        self.show_decimal_unit = show_decimal_unit\n\n        super().__init__(values=values, number=number, spacing=spacing,\n                         format=format, unit=unit, format_unit=format_unit)\n\n    @property\n    def decimal(self):\n        decimal = self._decimal\n        if self.format_unit not in (u.degree, u.hourangle, u.hour):\n            if self._decimal is None:\n                decimal = True\n            elif self._decimal is False:\n                raise UnitsError(\"Units should be degrees or hours when using non-decimal (sexagesimal) mode\")\n        elif self._decimal is None:\n            decimal = False\n        return decimal\n\n    @decimal.setter\n    def decimal(self, value):\n        self._decimal = value\n\n    @property\n    def spacing(self):\n        return self._spacing\n\n    @spacing.setter\n    def spacing(self, spacing):\n        if spacing is not None and (not isinstance(spacing, u.Quantity) or\n                                    spacing.unit.physical_type != 'angle'):\n            raise TypeError(\"spacing should be an astropy.units.Quantity \"\n                            \"instance with units of angle\")\n        self._number = None\n        self._spacing = spacing\n        self._values = None\n\n    @property\n    def sep(self):\n        return self._sep\n\n    @sep.setter\n    def sep(self, separator):\n        self._sep = separator\n\n    @property\n    def format(self):\n        return self._format\n\n    @format.setter\n    def format(self, value):\n\n        self._format = value\n\n        if value is None:\n            return\n\n        if DMS_RE.match(value) is not None:\n            self._decimal = False\n            self._format_unit = u.degree\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n                self._fields = 3\n            else:\n                self._precision = 0\n                self._fields = value.count(':') + 1\n        elif HMS_RE.match(value) is not None:\n            self._decimal = False\n            self._format_unit = u.hourangle\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n                self._fields = 3\n            else:\n                self._precision = 0\n                self._fields = value.count(':') + 1\n        elif DDEC_RE.match(value) is not None:\n            self._decimal = True\n            self._format_unit = u.degree\n            self._fields = 1\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n            else:\n                self._precision = 0\n        elif DMIN_RE.match(value) is not None:\n            self._decimal = True\n            self._format_unit = u.arcmin\n            self._fields = 1\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n            else:\n                self._precision = 0\n        elif DSEC_RE.match(value) is not None:\n            self._decimal = True\n            self._format_unit = u.arcsec\n            self._fields = 1\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n            else:\n                self._precision = 0\n        else:\n            raise ValueError(f\"Invalid format: {value}\")\n\n        if self.spacing is not None and self.spacing < self.base_spacing:\n            warnings.warn(\"Spacing is too small - resetting spacing to match format\")\n            self.spacing = self.base_spacing\n\n        if self.spacing is not None:\n\n            ratio = (self.spacing / self.base_spacing).decompose().value\n            remainder = ratio - np.round(ratio)\n\n            if abs(remainder) > 1.e-10:\n                warnings.warn(\"Spacing is not a multiple of base spacing - resetting spacing to match format\")\n                self.spacing = self.base_spacing * max(1, round(ratio))\n\n    @property\n    def base_spacing(self):\n\n        if self.decimal:\n\n            spacing = self._format_unit / (10. ** self._precision)\n\n        else:\n\n            if self._fields == 1:\n                spacing = 1. * u.degree\n            elif self._fields == 2:\n                spacing = 1. * u.arcmin\n            elif self._fields == 3:\n                if self._precision == 0:\n                    spacing = 1. * u.arcsec\n                else:\n                    spacing = u.arcsec / (10. ** self._precision)\n\n        if self._format_unit is u.hourangle:\n            spacing *= 15\n\n        return spacing\n\n    def locator(self, value_min, value_max):\n\n        if self.values is not None:\n\n            # values were manually specified\n            return self.values, 1.1 * u.arcsec\n\n        else:\n\n            # In the special case where value_min is the same as value_max, we\n            # don't locate any ticks. This can occur for example when taking a\n            # slice for a cube (along the dimension sliced). We return a\n            # non-zero spacing in case the caller needs to format a single\n            # coordinate, e.g. for mousover.\n            if value_min == value_max:\n                return [] * self._unit, 1 * u.arcsec\n\n            if self.spacing is not None:\n\n                # spacing was manually specified\n                spacing_value = self.spacing.to_value(self._unit)\n\n            elif self.number is not None:\n\n                # number of ticks was specified, work out optimal spacing\n\n                # first compute the exact spacing\n                dv = abs(float(value_max - value_min)) / self.number * self._unit\n\n                if self.format is not None and dv < self.base_spacing:\n                    # if the spacing is less than the minimum spacing allowed by the format, simply\n                    # use the format precision instead.\n                    spacing_value = self.base_spacing.to_value(self._unit)\n                else:\n                    # otherwise we clip to the nearest 'sensible' spacing\n                    if self.decimal:\n                        from .utils import select_step_scalar\n                        spacing_value = select_step_scalar(dv.to_value(self._format_unit)) * self._format_unit.to(self._unit)\n                    else:\n                        if self._format_unit is u.degree:\n                            from .utils import select_step_degree\n                            spacing_value = select_step_degree(dv).to_value(self._unit)\n                        else:\n                            from .utils import select_step_hour\n                            spacing_value = select_step_hour(dv).to_value(self._unit)\n\n            # We now find the interval values as multiples of the spacing and\n            # generate the tick positions from this.\n            values = self._locate_values(value_min, value_max, spacing_value)\n            return values * spacing_value * self._unit, spacing_value * self._unit\n\n    def formatter(self, values, spacing, format='auto'):\n\n        if not isinstance(values, u.Quantity) and values is not None:\n            raise TypeError(\"values should be a Quantities array\")\n\n        if len(values) > 0:\n\n            decimal = self.decimal\n            unit = self._format_unit\n\n            if unit is u.hour:\n                unit = u.hourangle\n\n            if self.format is None:\n                if decimal:\n                    # Here we assume the spacing can be arbitrary, so for example\n                    # 1.000223 degrees, in which case we don't want to have a\n                    # format that rounds to degrees. So we find the number of\n                    # decimal places we get from representing the spacing as a\n                    # string in the desired units. The easiest way to find\n                    # the smallest number of decimal places required is to\n                    # format the number as a decimal float and strip any zeros\n                    # from the end. We do this rather than just trusting e.g.\n                    # str() because str(15.) == 15.0. We format using 10 decimal\n                    # places by default before stripping the zeros since this\n                    # corresponds to a resolution of less than a microarcecond,\n                    # which should be sufficient.\n                    spacing = spacing.to_value(unit)\n                    fields = 0\n                    precision = len(f\"{spacing:.10f}\".replace('0', ' ').strip().split('.', 1)[1])\n                else:\n                    spacing = spacing.to_value(unit / 3600)\n                    if spacing >= 3600:\n                        fields = 1\n                        precision = 0\n                    elif spacing >= 60:\n                        fields = 2\n                        precision = 0\n                    elif spacing >= 1:\n                        fields = 3\n                        precision = 0\n                    else:\n                        fields = 3\n                        precision = -int(np.floor(np.log10(spacing)))\n            else:\n                fields = self._fields\n                precision = self._precision\n\n            is_latex = format == 'latex' or (format == 'auto' and rcParams['text.usetex'])\n\n            if decimal:\n                # At the moment, the Angle class doesn't have a consistent way\n                # to always convert angles to strings in decimal form with\n                # symbols for units (instead of e.g 3arcsec). So as a workaround\n                # we take advantage of the fact that Angle.to_string converts\n                # the unit to a string manually when decimal=False and the unit\n                # is not strictly u.degree or u.hourangle\n                if self.show_decimal_unit:\n                    decimal = False\n                    sep = 'fromunit'\n                    if is_latex:\n                        fmt = 'latex'\n                    else:\n                        if unit is u.hourangle:\n                            fmt = 'unicode'\n                        else:\n                            fmt = None\n                    unit = CUSTOM_UNITS.get(unit, unit)\n                else:\n                    sep = None\n                    fmt = None\n            elif self.sep is not None:\n                sep = self.sep\n                fmt = None\n            else:\n                sep = 'fromunit'\n                if unit == u.degree:\n                    if is_latex:\n                        fmt = 'latex'\n                    else:\n                        sep = ('\\xb0', \"'\", '\"')\n                        fmt = None\n                else:\n                    if format == 'ascii':\n                        fmt = None\n                    elif is_latex:\n                        fmt = 'latex'\n                    else:\n                        # Here we still use LaTeX but this is for Matplotlib's\n                        # LaTeX engine - we can't use fmt='latex' as this\n                        # doesn't produce LaTeX output that respects the fonts.\n                        sep = (r'$\\mathregular{^h}$', r'$\\mathregular{^m}$', r'$\\mathregular{^s}$')\n                        fmt = None\n\n            angles = Angle(values)\n            string = angles.to_string(unit=unit,\n                                      precision=precision,\n                                      decimal=decimal,\n                                      fields=fields,\n                                      sep=sep,\n                                      format=fmt).tolist()\n\n            return string\n        else:\n            return []"},{"attributeType":"None","col":8,"comment":"null","endLoc":88,"id":16283,"name":"_number","nodeType":"Attribute","startLoc":88,"text":"self._number"},{"attributeType":"null","col":12,"comment":"null","endLoc":73,"id":16284,"name":"number","nodeType":"Attribute","startLoc":73,"text":"self.number"},{"attributeType":"null","col":8,"comment":"null","endLoc":63,"id":16285,"name":"_unit","nodeType":"Attribute","startLoc":63,"text":"self._unit"},{"attributeType":"null","col":12,"comment":"null","endLoc":71,"id":16286,"name":"spacing","nodeType":"Attribute","startLoc":71,"text":"self.spacing"},{"attributeType":"None","col":8,"comment":"null","endLoc":89,"id":16287,"name":"_spacing","nodeType":"Attribute","startLoc":89,"text":"self._spacing"},{"col":4,"comment":"null","endLoc":162,"header":"def __init__(self, values=None, number=None, spacing=None, format=None,\n                 unit=None, decimal=None, format_unit=None, show_decimal_unit=True)","id":16288,"name":"__init__","nodeType":"Function","startLoc":144,"text":"def __init__(self, values=None, number=None, spacing=None, format=None,\n                 unit=None, decimal=None, format_unit=None, show_decimal_unit=True):\n\n        if unit is None:\n            unit = u.degree\n\n        if format_unit is None:\n            format_unit = unit\n\n        if format_unit not in (u.degree, u.hourangle, u.hour):\n            if decimal is False:\n                raise UnitsError(\"Units should be degrees or hours when using non-decimal (sexagesimal) mode\")\n\n        self._decimal = decimal\n        self._sep = None\n        self.show_decimal_unit = show_decimal_unit\n\n        super().__init__(values=values, number=number, spacing=spacing,\n                         format=format, unit=unit, format_unit=format_unit)"},{"attributeType":"Quantity","col":8,"comment":"null","endLoc":90,"id":16289,"name":"_values","nodeType":"Attribute","startLoc":90,"text":"self._values"},{"attributeType":"null","col":12,"comment":"null","endLoc":67,"id":16290,"name":"values","nodeType":"Attribute","startLoc":67,"text":"self.values"},{"fileName":"__init__.py","filePath":"astropy/visualization/wcsaxes","id":16291,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# The following few lines skip this module when running tests if matplotlib is\n# not available (and will have no impact otherwise)\n\ntry:\n    import pytest\n    pytest.importorskip(\"matplotlib\")\n    del pytest\nexcept ImportError:\n    pass\n\nfrom .core import *\nfrom .coordinate_helpers import CoordinateHelper\nfrom .coordinates_map import CoordinatesMap\nfrom .patches import *\n\nfrom astropy import config as _config\n\n\nclass Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.visualization.wcsaxes`.\n    \"\"\"\n\n    coordinate_range_samples = _config.ConfigItem(50,\n        'The number of samples along each image axis when determining '\n        'the range of coordinates in a plot.')\n\n    frame_boundary_samples = _config.ConfigItem(1000,\n        'How many points to sample along the axes when determining '\n        'tick locations.')\n\n    grid_samples = _config.ConfigItem(1000,\n        'How many points to sample along grid lines.')\n\n    contour_grid_samples = _config.ConfigItem(200,\n        'The grid size to use when drawing a grid using contours')\n\n\nconf = Conf()\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":75,"id":16292,"name":"format","nodeType":"Attribute","startLoc":75,"text":"self.format"},{"attributeType":"null","col":4,"comment":"null","endLoc":155,"id":16293,"name":"_tickvert_path","nodeType":"Attribute","startLoc":155,"text":"_tickvert_path"},{"attributeType":"null","col":8,"comment":"null","endLoc":106,"id":16294,"name":"_visible_axes","nodeType":"Attribute","startLoc":106,"text":"self._visible_axes"},{"attributeType":"null","col":8,"comment":"null","endLoc":119,"id":16295,"name":"minor_world","nodeType":"Attribute","startLoc":119,"text":"self.minor_world"},{"attributeType":"null","col":8,"comment":"null","endLoc":118,"id":16296,"name":"disp","nodeType":"Attribute","startLoc":118,"text":"self.disp"},{"attributeType":"null","col":8,"comment":"null","endLoc":161,"id":16297,"name":"ticks_locs","nodeType":"Attribute","startLoc":161,"text":"self.ticks_locs"},{"attributeType":"null","col":8,"comment":"null","endLoc":122,"id":16298,"name":"minor_disp","nodeType":"Attribute","startLoc":122,"text":"self.minor_disp"},{"attributeType":"null","col":8,"comment":"null","endLoc":115,"id":16299,"name":"world","nodeType":"Attribute","startLoc":115,"text":"self.world"},{"attributeType":"null","col":8,"comment":"null","endLoc":120,"id":16300,"name":"minor_pixel","nodeType":"Attribute","startLoc":120,"text":"self.minor_pixel"},{"attributeType":"null","col":8,"comment":"null","endLoc":90,"id":16301,"name":"_minor_ticksize","nodeType":"Attribute","startLoc":90,"text":"self._minor_ticksize"},{"attributeType":"null","col":8,"comment":"null","endLoc":54,"id":16302,"name":"_display_minor_ticks","nodeType":"Attribute","startLoc":54,"text":"self._display_minor_ticks"},{"attributeType":"null","col":8,"comment":"null","endLoc":66,"id":16303,"name":"_tick_out","nodeType":"Attribute","startLoc":66,"text":"self._tick_out"},{"attributeType":"null","col":8,"comment":"null","endLoc":78,"id":16304,"name":"_ticksize","nodeType":"Attribute","startLoc":78,"text":"self._ticksize"},{"attributeType":"null","col":8,"comment":"null","endLoc":117,"id":16305,"name":"angle","nodeType":"Attribute","startLoc":117,"text":"self.angle"},{"attributeType":"null","col":8,"comment":"null","endLoc":116,"id":16306,"name":"pixel","nodeType":"Attribute","startLoc":116,"text":"self.pixel"},{"attributeType":"null","col":8,"comment":"null","endLoc":121,"id":16307,"name":"minor_angle","nodeType":"Attribute","startLoc":121,"text":"self.minor_angle"},{"attributeType":"null","col":16,"comment":"null","endLoc":5,"id":16308,"name":"np","nodeType":"Attribute","startLoc":5,"text":"np"},{"className":"ScalarFormatterLocator","col":0,"comment":"\n    A joint formatter/locator\n    ","endLoc":581,"id":16309,"nodeType":"Class","startLoc":454,"text":"class ScalarFormatterLocator(BaseFormatterLocator):\n    \"\"\"\n    A joint formatter/locator\n    \"\"\"\n\n    def __init__(self, values=None, number=None, spacing=None, format=None,\n                 unit=None, format_unit=None):\n\n        if unit is not None:\n            unit = unit\n            format_unit = format_unit or unit\n        elif spacing is not None:\n            unit = spacing.unit\n            format_unit = format_unit or spacing.unit\n        elif values is not None:\n            unit = values.unit\n            format_unit = format_unit or values.unit\n\n        super().__init__(values=values, number=number, spacing=spacing,\n                         format=format, unit=unit, format_unit=format_unit)\n\n    @property\n    def spacing(self):\n        return self._spacing\n\n    @spacing.setter\n    def spacing(self, spacing):\n        if spacing is not None and not isinstance(spacing, u.Quantity):\n            raise TypeError(\"spacing should be an astropy.units.Quantity instance\")\n        self._number = None\n        self._spacing = spacing\n        self._values = None\n\n    @property\n    def format(self):\n        return self._format\n\n    @format.setter\n    def format(self, value):\n\n        self._format = value\n\n        if value is None:\n            return\n\n        if SCAL_RE.match(value) is not None:\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n            else:\n                self._precision = 0\n\n            if self.spacing is not None and self.spacing < self.base_spacing:\n                warnings.warn(\"Spacing is too small - resetting spacing to match format\")\n                self.spacing = self.base_spacing\n\n            if self.spacing is not None:\n\n                ratio = (self.spacing / self.base_spacing).decompose().value\n                remainder = ratio - np.round(ratio)\n\n                if abs(remainder) > 1.e-10:\n                    warnings.warn(\"Spacing is not a multiple of base spacing - resetting spacing to match format\")\n                    self.spacing = self.base_spacing * max(1, round(ratio))\n\n        elif not value.startswith('%'):\n            raise ValueError(f\"Invalid format: {value}\")\n\n    @property\n    def base_spacing(self):\n        return self._format_unit / (10. ** self._precision)\n\n    def locator(self, value_min, value_max):\n\n        if self.values is not None:\n\n            # values were manually specified\n            return self.values, 1.1 * self._unit\n        else:\n\n            # In the special case where value_min is the same as value_max, we\n            # don't locate any ticks. This can occur for example when taking a\n            # slice for a cube (along the dimension sliced).\n            if value_min == value_max:\n                return [] * self._unit, 0 * self._unit\n\n            if self.spacing is not None:\n\n                # spacing was manually specified\n                spacing = self.spacing.to_value(self._unit)\n\n            elif self.number is not None:\n\n                # number of ticks was specified, work out optimal spacing\n\n                # first compute the exact spacing\n                dv = abs(float(value_max - value_min)) / self.number * self._unit\n\n                if self.format is not None and (not self.format.startswith('%')) and dv < self.base_spacing:\n                    # if the spacing is less than the minimum spacing allowed by the format, simply\n                    # use the format precision instead.\n                    spacing = self.base_spacing.to_value(self._unit)\n                else:\n                    from .utils import select_step_scalar\n                    spacing = select_step_scalar(dv.to_value(self._format_unit)) * self._format_unit.to(self._unit)\n\n            # We now find the interval values as multiples of the spacing and\n            # generate the tick positions from this\n\n            values = self._locate_values(value_min, value_max, spacing)\n            return values * spacing * self._unit, spacing * self._unit\n\n    def formatter(self, values, spacing, format='auto'):\n\n        if len(values) > 0:\n            if self.format is None:\n                if spacing.value < 1.:\n                    precision = -int(np.floor(np.log10(spacing.value)))\n                else:\n                    precision = 0\n            elif self.format.startswith('%'):\n                return [(self.format % x.value) for x in values]\n            else:\n                precision = self._precision\n\n            return [(\"{0:.\" + str(precision) + \"f}\").format(x.to_value(self._format_unit)) for x in values]\n\n        else:\n            return []"},{"col":4,"comment":"null","endLoc":473,"header":"def __init__(self, values=None, number=None, spacing=None, format=None,\n                 unit=None, format_unit=None)","id":16310,"name":"__init__","nodeType":"Function","startLoc":459,"text":"def __init__(self, values=None, number=None, spacing=None, format=None,\n                 unit=None, format_unit=None):\n\n        if unit is not None:\n            unit = unit\n            format_unit = format_unit or unit\n        elif spacing is not None:\n            unit = spacing.unit\n            format_unit = format_unit or spacing.unit\n        elif values is not None:\n            unit = values.unit\n            format_unit = format_unit or values.unit\n\n        super().__init__(values=values, number=number, spacing=spacing,\n                         format=format, unit=unit, format_unit=format_unit)"},{"col":4,"comment":"null","endLoc":281,"header":"def __eq__(self, other)","id":16311,"name":"__eq__","nodeType":"Function","startLoc":279,"text":"def __eq__(self, other):\n        return (isinstance(other, type(self)) and self.wcs is other.wcs and\n                self.invert_xy == other.invert_xy)"},{"col":4,"comment":"null","endLoc":285,"header":"@property\n    def input_dims(self)","id":16312,"name":"input_dims","nodeType":"Function","startLoc":283,"text":"@property\n    def input_dims(self):\n        return self.wcs.world_n_dim"},{"col":4,"comment":"null","endLoc":305,"header":"def transform(self, world)","id":16313,"name":"transform","nodeType":"Function","startLoc":287,"text":"def transform(self, world):\n\n        # Convert to a list of arrays\n        world = list(world.T)\n\n        if len(world) != self.wcs.world_n_dim:\n            raise ValueError(f\"Expected {self.wcs.world_n_dim} world coordinates, got {len(world)} \")\n\n        if len(world[0]) == 0:\n            pixel = np.zeros((0, 2))\n        else:\n            pixel = self.wcs.world_to_pixel_values(*world)\n\n        if self.invert_xy:\n            pixel = pixel[::-1]\n\n        pixel = np.array(pixel).T\n\n        return pixel"},{"className":"CoordinateHelper","col":0,"comment":"\n    Helper class to control one of the coordinates in the\n    :class:`~astropy.visualization.wcsaxes.WCSAxes`.\n\n    Parameters\n    ----------\n    parent_axes : :class:`~astropy.visualization.wcsaxes.WCSAxes`\n        The axes the coordinate helper belongs to.\n    parent_map : :class:`~astropy.visualization.wcsaxes.CoordinatesMap`\n        The :class:`~astropy.visualization.wcsaxes.CoordinatesMap` object this\n        coordinate belongs to.\n    transform : `~matplotlib.transforms.Transform`\n        The transform corresponding to this coordinate system.\n    coord_index : int\n        The index of this coordinate in the\n        :class:`~astropy.visualization.wcsaxes.CoordinatesMap`.\n    coord_type : {'longitude', 'latitude', 'scalar'}\n        The type of this coordinate, which is used to determine the wrapping and\n        boundary behavior of coordinates. Longitudes wrap at ``coord_wrap``,\n        latitudes have to be in the range -90 to 90, and scalars are unbounded\n        and do not wrap.\n    coord_unit : `~astropy.units.Unit`\n        The unit that this coordinate is in given the output of transform.\n    format_unit : `~astropy.units.Unit`, optional\n        The unit to use to display the coordinates.\n    coord_wrap : float\n        The angle at which the longitude wraps (defaults to 360)\n    frame : `~astropy.visualization.wcsaxes.frame.BaseFrame`\n        The frame of the :class:`~astropy.visualization.wcsaxes.WCSAxes`.\n    ","endLoc":1098,"id":16314,"nodeType":"Class","startLoc":50,"text":"class CoordinateHelper:\n    \"\"\"\n    Helper class to control one of the coordinates in the\n    :class:`~astropy.visualization.wcsaxes.WCSAxes`.\n\n    Parameters\n    ----------\n    parent_axes : :class:`~astropy.visualization.wcsaxes.WCSAxes`\n        The axes the coordinate helper belongs to.\n    parent_map : :class:`~astropy.visualization.wcsaxes.CoordinatesMap`\n        The :class:`~astropy.visualization.wcsaxes.CoordinatesMap` object this\n        coordinate belongs to.\n    transform : `~matplotlib.transforms.Transform`\n        The transform corresponding to this coordinate system.\n    coord_index : int\n        The index of this coordinate in the\n        :class:`~astropy.visualization.wcsaxes.CoordinatesMap`.\n    coord_type : {'longitude', 'latitude', 'scalar'}\n        The type of this coordinate, which is used to determine the wrapping and\n        boundary behavior of coordinates. Longitudes wrap at ``coord_wrap``,\n        latitudes have to be in the range -90 to 90, and scalars are unbounded\n        and do not wrap.\n    coord_unit : `~astropy.units.Unit`\n        The unit that this coordinate is in given the output of transform.\n    format_unit : `~astropy.units.Unit`, optional\n        The unit to use to display the coordinates.\n    coord_wrap : float\n        The angle at which the longitude wraps (defaults to 360)\n    frame : `~astropy.visualization.wcsaxes.frame.BaseFrame`\n        The frame of the :class:`~astropy.visualization.wcsaxes.WCSAxes`.\n    \"\"\"\n\n    def __init__(self, parent_axes=None, parent_map=None, transform=None,\n                 coord_index=None, coord_type='scalar', coord_unit=None,\n                 coord_wrap=None, frame=None, format_unit=None, default_label=None):\n\n        # Keep a reference to the parent axes and the transform\n        self.parent_axes = parent_axes\n        self.parent_map = parent_map\n        self.transform = transform\n        self.coord_index = coord_index\n        self.coord_unit = coord_unit\n        self._format_unit = format_unit\n        self.frame = frame\n        self.default_label = default_label or ''\n        self._auto_axislabel = True\n        # Disable auto label for elliptical frames as it puts labels in\n        # annoying places.\n        if issubclass(self.parent_axes.frame_class, EllipticalFrame):\n            self._auto_axislabel = False\n\n        self.set_coord_type(coord_type, coord_wrap)\n\n        # Initialize ticks\n        self.dpi_transform = Affine2D()\n        self.offset_transform = ScaledTranslation(0, 0, self.dpi_transform)\n        self.ticks = Ticks(transform=parent_axes.transData + self.offset_transform)\n\n        # Initialize tick labels\n        self.ticklabels = TickLabels(self.frame,\n                                     transform=None,  # display coordinates\n                                     figure=parent_axes.get_figure())\n        self.ticks.display_minor_ticks(rcParams['xtick.minor.visible'])\n        self.minor_frequency = 5\n\n        # Initialize axis labels\n        self.axislabels = AxisLabels(self.frame,\n                                     transform=None,  # display coordinates\n                                     figure=parent_axes.get_figure())\n\n        # Initialize container for the grid lines\n        self.grid_lines = []\n\n        # Initialize grid style. Take defaults from matplotlib.rcParams.\n        # Based on matplotlib.axis.YTick._get_gridline.\n        self.grid_lines_kwargs = {'visible': False,\n                                  'facecolor': 'none',\n                                  'edgecolor': rcParams['grid.color'],\n                                  'linestyle': LINES_TO_PATCHES_LINESTYLE[rcParams['grid.linestyle']],\n                                  'linewidth': rcParams['grid.linewidth'],\n                                  'alpha': rcParams['grid.alpha'],\n                                  'transform': self.parent_axes.transData}\n\n    def grid(self, draw_grid=True, grid_type=None, **kwargs):\n        \"\"\"\n        Plot grid lines for this coordinate.\n\n        Standard matplotlib appearance options (color, alpha, etc.) can be\n        passed as keyword arguments.\n\n        Parameters\n        ----------\n        draw_grid : bool\n            Whether to show the gridlines\n        grid_type : {'lines', 'contours'}\n            Whether to plot the contours by determining the grid lines in\n            world coordinates and then plotting them in world coordinates\n            (``'lines'``) or by determining the world coordinates at many\n            positions in the image and then drawing contours\n            (``'contours'``). The first is recommended for 2-d images, while\n            for 3-d (or higher dimensional) cubes, the ``'contours'`` option\n            is recommended. By default, 'lines' is used if the transform has\n            an inverse, otherwise 'contours' is used.\n        \"\"\"\n\n        if grid_type == 'lines' and not self.transform.has_inverse:\n            raise ValueError('The specified transform has no inverse, so the '\n                             'grid cannot be drawn using grid_type=\\'lines\\'')\n\n        if grid_type is None:\n            grid_type = 'lines' if self.transform.has_inverse else 'contours'\n\n        if grid_type in ('lines', 'contours'):\n            self._grid_type = grid_type\n        else:\n            raise ValueError(\"grid_type should be 'lines' or 'contours'\")\n\n        if 'color' in kwargs:\n            kwargs['edgecolor'] = kwargs.pop('color')\n\n        self.grid_lines_kwargs.update(kwargs)\n\n        if self.grid_lines_kwargs['visible']:\n            if not draw_grid:\n                self.grid_lines_kwargs['visible'] = False\n        else:\n            self.grid_lines_kwargs['visible'] = True\n\n    def set_coord_type(self, coord_type, coord_wrap=None):\n        \"\"\"\n        Set the coordinate type for the axis.\n\n        Parameters\n        ----------\n        coord_type : str\n            One of 'longitude', 'latitude' or 'scalar'\n        coord_wrap : float, optional\n            The value to wrap at for angular coordinates\n        \"\"\"\n\n        self.coord_type = coord_type\n\n        if coord_type == 'longitude' and coord_wrap is None:\n            self.coord_wrap = 360\n        elif coord_type != 'longitude' and coord_wrap is not None:\n            raise NotImplementedError('coord_wrap is not yet supported '\n                                      'for non-longitude coordinates')\n        else:\n            self.coord_wrap = coord_wrap\n\n        # Initialize tick formatter/locator\n        if coord_type == 'scalar':\n            self._coord_scale_to_deg = None\n            self._formatter_locator = ScalarFormatterLocator(unit=self.coord_unit)\n        elif coord_type in ['longitude', 'latitude']:\n            if self.coord_unit is u.deg:\n                self._coord_scale_to_deg = None\n            else:\n                self._coord_scale_to_deg = self.coord_unit.to(u.deg)\n            self._formatter_locator = AngleFormatterLocator(unit=self.coord_unit,\n                                                            format_unit=self._format_unit)\n        else:\n            raise ValueError(\"coord_type should be one of 'scalar', 'longitude', or 'latitude'\")\n\n    def set_major_formatter(self, formatter):\n        \"\"\"\n        Set the formatter to use for the major tick labels.\n\n        Parameters\n        ----------\n        formatter : str or `~matplotlib.ticker.Formatter`\n            The format or formatter to use.\n        \"\"\"\n        if isinstance(formatter, Formatter):\n            raise NotImplementedError()  # figure out how to swap out formatter\n        elif isinstance(formatter, str):\n            self._formatter_locator.format = formatter\n        else:\n            raise TypeError(\"formatter should be a string or a Formatter \"\n                            \"instance\")\n\n    def format_coord(self, value, format='auto'):\n        \"\"\"\n        Given the value of a coordinate, will format it according to the\n        format of the formatter_locator.\n\n        Parameters\n        ----------\n        value : float\n            The value to format\n        format : {'auto', 'ascii', 'latex'}, optional\n            The format to use - by default the formatting will be adjusted\n            depending on whether Matplotlib is using LaTeX or MathTex. To\n            get plain ASCII strings, use format='ascii'.\n        \"\"\"\n\n        if not hasattr(self, \"_fl_spacing\"):\n            return \"\"  # _update_ticks has not been called yet\n\n        fl = self._formatter_locator\n        if isinstance(fl, AngleFormatterLocator):\n\n            # Convert to degrees if needed\n            if self._coord_scale_to_deg is not None:\n                value *= self._coord_scale_to_deg\n\n            if self.coord_type == 'longitude':\n                value = wrap_angle_at(value, self.coord_wrap)\n            value = value * u.degree\n            value = value.to_value(fl._unit)\n\n        spacing = self._fl_spacing\n        string = fl.formatter(values=[value] * fl._unit, spacing=spacing, format=format)\n\n        return string[0]\n\n    def set_separator(self, separator):\n        \"\"\"\n        Set the separator to use for the angle major tick labels.\n\n        Parameters\n        ----------\n        separator : str or tuple or None\n            The separator between numbers in sexagesimal representation. Can be\n            either a string or a tuple (or `None` for default).\n        \"\"\"\n        if not (self._formatter_locator.__class__ == AngleFormatterLocator):\n            raise TypeError(\"Separator can only be specified for angle coordinates\")\n        if isinstance(separator, (str, tuple)) or separator is None:\n            self._formatter_locator.sep = separator\n        else:\n            raise TypeError(\"separator should be a string, a tuple, or None\")\n\n    def set_format_unit(self, unit, decimal=None, show_decimal_unit=True):\n        \"\"\"\n        Set the unit for the major tick labels.\n\n        Parameters\n        ----------\n        unit : class:`~astropy.units.Unit`\n            The unit to which the tick labels should be converted to.\n        decimal : bool, optional\n            Whether to use decimal formatting. By default this is `False`\n            for degrees or hours (which therefore use sexagesimal formatting)\n            and `True` for all other units.\n        show_decimal_unit : bool, optional\n            Whether to include units when in decimal mode.\n        \"\"\"\n        self._formatter_locator.format_unit = u.Unit(unit)\n        self._formatter_locator.decimal = decimal\n        self._formatter_locator.show_decimal_unit = show_decimal_unit\n\n    def get_format_unit(self):\n        \"\"\"\n        Get the unit for the major tick labels.\n        \"\"\"\n        return self._formatter_locator.format_unit\n\n    def set_ticks(self, values=None, spacing=None, number=None, size=None,\n                  width=None, color=None, alpha=None, direction=None,\n                  exclude_overlapping=None):\n        \"\"\"\n        Set the location and properties of the ticks.\n\n        At most one of the options from ``values``, ``spacing``, or\n        ``number`` can be specified.\n\n        Parameters\n        ----------\n        values : iterable, optional\n            The coordinate values at which to show the ticks.\n        spacing : float, optional\n            The spacing between ticks.\n        number : float, optional\n            The approximate number of ticks shown.\n        size : float, optional\n            The length of the ticks in points\n        color : str or tuple, optional\n            A valid Matplotlib color for the ticks\n        alpha : float, optional\n            The alpha value (transparency) for the ticks.\n        direction : {'in','out'}, optional\n            Whether the ticks should point inwards or outwards.\n        \"\"\"\n\n        if sum([values is None, spacing is None, number is None]) < 2:\n            raise ValueError(\"At most one of values, spacing, or number should \"\n                             \"be specified\")\n\n        if values is not None:\n            self._formatter_locator.values = values\n        elif spacing is not None:\n            self._formatter_locator.spacing = spacing\n        elif number is not None:\n            self._formatter_locator.number = number\n\n        if size is not None:\n            self.ticks.set_ticksize(size)\n\n        if width is not None:\n            self.ticks.set_linewidth(width)\n\n        if color is not None:\n            self.ticks.set_color(color)\n\n        if alpha is not None:\n            self.ticks.set_alpha(alpha)\n\n        if direction is not None:\n            if direction in ('in', 'out'):\n                self.ticks.set_tick_out(direction == 'out')\n            else:\n                raise ValueError(\"direction should be 'in' or 'out'\")\n\n        if exclude_overlapping is not None:\n            warnings.warn(\"exclude_overlapping= should be passed to \"\n                          \"set_ticklabel instead of set_ticks\",\n                          AstropyDeprecationWarning)\n            self.ticklabels.set_exclude_overlapping(exclude_overlapping)\n\n    def set_ticks_position(self, position):\n        \"\"\"\n        Set where ticks should appear\n\n        Parameters\n        ----------\n        position : str\n            The axes on which the ticks for this coordinate should appear.\n            Should be a string containing zero or more of ``'b'``, ``'t'``,\n            ``'l'``, ``'r'``. For example, ``'lb'`` will lead the ticks to be\n            shown on the left and bottom axis.\n        \"\"\"\n        self.ticks.set_visible_axes(position)\n\n    def set_ticks_visible(self, visible):\n        \"\"\"\n        Set whether ticks are visible or not.\n\n        Parameters\n        ----------\n        visible : bool\n            The visibility of ticks. Setting as ``False`` will hide ticks\n            along this coordinate.\n        \"\"\"\n        self.ticks.set_visible(visible)\n\n    def set_ticklabel(self, color=None, size=None, pad=None,\n                      exclude_overlapping=None, **kwargs):\n        \"\"\"\n        Set the visual properties for the tick labels.\n\n        Parameters\n        ----------\n        size : float, optional\n            The size of the ticks labels in points\n        color : str or tuple, optional\n            A valid Matplotlib color for the tick labels\n        pad : float, optional\n            Distance in points between tick and label.\n        exclude_overlapping : bool, optional\n            Whether to exclude tick labels that overlap over each other.\n        **kwargs\n            Other keyword arguments are passed to :class:`matplotlib.text.Text`.\n        \"\"\"\n        if size is not None:\n            self.ticklabels.set_size(size)\n        if color is not None:\n            self.ticklabels.set_color(color)\n        if pad is not None:\n            self.ticklabels.set_pad(pad)\n        if exclude_overlapping is not None:\n            self.ticklabels.set_exclude_overlapping(exclude_overlapping)\n        self.ticklabels.set(**kwargs)\n\n    def set_ticklabel_position(self, position):\n        \"\"\"\n        Set where tick labels should appear\n\n        Parameters\n        ----------\n        position : str\n            The axes on which the tick labels for this coordinate should\n            appear. Should be a string containing zero or more of ``'b'``,\n            ``'t'``, ``'l'``, ``'r'``. For example, ``'lb'`` will lead the\n            tick labels to be shown on the left and bottom axis.\n        \"\"\"\n        self.ticklabels.set_visible_axes(position)\n\n    def set_ticklabel_visible(self, visible):\n        \"\"\"\n        Set whether the tick labels are visible or not.\n\n        Parameters\n        ----------\n        visible : bool\n            The visibility of ticks. Setting as ``False`` will hide this\n            coordinate's tick labels.\n        \"\"\"\n        self.ticklabels.set_visible(visible)\n\n    def set_axislabel(self, text, minpad=1, **kwargs):\n        \"\"\"\n        Set the text and optionally visual properties for the axis label.\n\n        Parameters\n        ----------\n        text : str\n            The axis label text.\n        minpad : float, optional\n            The padding for the label in terms of axis label font size.\n        **kwargs\n            Keywords are passed to :class:`matplotlib.text.Text`. These\n            can include keywords to set the ``color``, ``size``, ``weight``, and\n            other text properties.\n        \"\"\"\n        fontdict = kwargs.pop('fontdict', None)\n\n        # NOTE: When using plt.xlabel/plt.ylabel, minpad can get set explicitly\n        # to None so we need to make sure that in that case we change to a\n        # default numerical value.\n        if minpad is None:\n            minpad = 1\n\n        self.axislabels.set_text(text)\n        self.axislabels.set_minpad(minpad)\n        self.axislabels.set(**kwargs)\n\n        if fontdict is not None:\n            self.axislabels.update(fontdict)\n\n    def get_axislabel(self):\n        \"\"\"\n        Get the text for the axis label\n\n        Returns\n        -------\n        label : str\n            The axis label\n        \"\"\"\n        return self.axislabels.get_text()\n\n    def set_auto_axislabel(self, auto_label):\n        \"\"\"\n        Render default axis labels if no explicit label is provided.\n\n        Parameters\n        ----------\n        auto_label : `bool`\n            `True` if default labels will be rendered.\n        \"\"\"\n        self._auto_axislabel = bool(auto_label)\n\n    def get_auto_axislabel(self):\n        \"\"\"\n        Render default axis labels if no explicit label is provided.\n\n        Returns\n        -------\n        auto_axislabel : `bool`\n            `True` if default labels will be rendered.\n        \"\"\"\n        return self._auto_axislabel\n\n    def _get_default_axislabel(self):\n        unit = self.get_format_unit() or self.coord_unit\n\n        if not unit or unit is u.one or self.coord_type in ('longitude', 'latitude'):\n            return f\"{self.default_label}\"\n        else:\n            return f\"{self.default_label} [{unit:latex}]\"\n\n    def set_axislabel_position(self, position):\n        \"\"\"\n        Set where axis labels should appear\n\n        Parameters\n        ----------\n        position : str\n            The axes on which the axis label for this coordinate should\n            appear. Should be a string containing zero or more of ``'b'``,\n            ``'t'``, ``'l'``, ``'r'``. For example, ``'lb'`` will lead the\n            axis label to be shown on the left and bottom axis.\n        \"\"\"\n        self.axislabels.set_visible_axes(position)\n\n    def set_axislabel_visibility_rule(self, rule):\n        \"\"\"\n        Set the rule used to determine when the axis label is drawn.\n\n        Parameters\n        ----------\n        rule : str\n            If the rule is 'always' axis labels will always be drawn on the\n            axis. If the rule is 'ticks' the label will only be drawn if ticks\n            were drawn on that axis. If the rule is 'labels' the axis label\n            will only be drawn if tick labels were drawn on that axis.\n        \"\"\"\n        self.axislabels.set_visibility_rule(rule)\n\n    def get_axislabel_visibility_rule(self, rule):\n        \"\"\"\n        Get the rule used to determine when the axis label is drawn.\n        \"\"\"\n        return self.axislabels.get_visibility_rule()\n\n    @property\n    def locator(self):\n        return self._formatter_locator.locator\n\n    @property\n    def formatter(self):\n        return self._formatter_locator.formatter\n\n    def _draw_grid(self, renderer):\n\n        renderer.open_group('grid lines')\n\n        self._update_ticks()\n\n        if self.grid_lines_kwargs['visible']:\n            if isinstance(self.frame, RectangularFrame1D):\n                self._update_grid_lines_1d()\n            else:\n                if self._grid_type == 'lines':\n                    self._update_grid_lines()\n                else:\n                    self._update_grid_contour()\n\n            if self._grid_type == 'lines':\n\n                frame_patch = self.frame.patch\n                for path in self.grid_lines:\n                    p = PathPatch(path, **self.grid_lines_kwargs)\n                    p.set_clip_path(frame_patch)\n                    p.draw(renderer)\n\n            elif self._grid is not None:\n\n                for line in self._grid.collections:\n                    line.set(**self.grid_lines_kwargs)\n                    line.draw(renderer)\n\n        renderer.close_group('grid lines')\n\n    def _draw_ticks(self, renderer, bboxes, ticklabels_bbox):\n        \"\"\"\n        Draw all ticks and ticklabels.\n        \"\"\"\n\n        renderer.open_group('ticks')\n        self.ticks.draw(renderer)\n        self.ticklabels.draw(renderer, bboxes=bboxes,\n                             ticklabels_bbox=ticklabels_bbox,\n                             tick_out_size=self.ticks.out_size)\n\n        renderer.close_group('ticks')\n\n    def _draw_axislabels(self, renderer, bboxes, ticklabels_bbox, visible_ticks):\n        # Render the default axis label if no axis label is set.\n        if self._auto_axislabel and not self.get_axislabel():\n            self.set_axislabel(self._get_default_axislabel())\n\n        renderer.open_group('axis labels')\n\n        self.axislabels.draw(renderer, bboxes=bboxes,\n                             ticklabels_bbox=ticklabels_bbox,\n                             coord_ticklabels_bbox=ticklabels_bbox[self],\n                             ticks_locs=self.ticks.ticks_locs,\n                             visible_ticks=visible_ticks)\n\n        renderer.close_group('axis labels')\n\n    def _update_ticks(self):\n\n        if self.coord_index is None:\n            return\n\n        # TODO: this method should be optimized for speed\n\n        # Here we determine the location and rotation of all the ticks. For\n        # each axis, we can check the intersections for the specific\n        # coordinate and once we have the tick positions, we can use the WCS\n        # to determine the rotations.\n\n        # Find the range of coordinates in all directions\n        coord_range = self.parent_map.get_coord_range()\n\n        # First find the ticks we want to show\n        tick_world_coordinates, self._fl_spacing = self.locator(*coord_range[self.coord_index])\n\n        if self.ticks.get_display_minor_ticks():\n            minor_ticks_w_coordinates = self._formatter_locator.minor_locator(self._fl_spacing, self.get_minor_frequency(), *coord_range[self.coord_index])\n\n        # We want to allow non-standard rectangular frames, so we just rely on\n        # the parent axes to tell us what the bounding frame is.\n        from . import conf\n        frame = self.frame.sample(conf.frame_boundary_samples)\n\n        self.ticks.clear()\n        self.ticklabels.clear()\n        self.lblinfo = []\n        self.lbl_world = []\n        # Look up parent axes' transform from data to figure coordinates.\n        #\n        # See:\n        # https://matplotlib.org/stable/tutorials/advanced/transforms_tutorial.html#the-transformation-pipeline\n        transData = self.parent_axes.transData\n        invertedTransLimits = transData.inverted()\n\n        for axis, spine in frame.items():\n\n            if not isinstance(self.frame, RectangularFrame1D):\n                # Determine tick rotation in display coordinates and compare to\n                # the normal angle in display coordinates.\n\n                pixel0 = spine.data\n                world0 = spine.world[:, self.coord_index]\n                with np.errstate(invalid='ignore'):\n                    world0 = self.transform.transform(pixel0)[:, self.coord_index]\n                axes0 = transData.transform(pixel0)\n\n                # Advance 2 pixels in figure coordinates\n                pixel1 = axes0.copy()\n                pixel1[:, 0] += 2.0\n                pixel1 = invertedTransLimits.transform(pixel1)\n                with np.errstate(invalid='ignore'):\n                    world1 = self.transform.transform(pixel1)[:, self.coord_index]\n\n                # Advance 2 pixels in figure coordinates\n                pixel2 = axes0.copy()\n                pixel2[:, 1] += 2.0 if self.frame.origin == 'lower' else -2.0\n                pixel2 = invertedTransLimits.transform(pixel2)\n                with np.errstate(invalid='ignore'):\n                    world2 = self.transform.transform(pixel2)[:, self.coord_index]\n\n                dx = (world1 - world0)\n                dy = (world2 - world0)\n\n                # Rotate by 90 degrees\n                dx, dy = -dy, dx\n\n                if self.coord_type == 'longitude':\n\n                    if self._coord_scale_to_deg is not None:\n                        dx *= self._coord_scale_to_deg\n                        dy *= self._coord_scale_to_deg\n\n                    # Here we wrap at 180 not self.coord_wrap since we want to\n                    # always ensure abs(dx) < 180 and abs(dy) < 180\n                    dx = wrap_angle_at(dx, 180.)\n                    dy = wrap_angle_at(dy, 180.)\n\n                tick_angle = np.degrees(np.arctan2(dy, dx))\n\n                normal_angle_full = np.hstack([spine.normal_angle, spine.normal_angle[-1]])\n                with np.errstate(invalid='ignore'):\n                    reset = (((normal_angle_full - tick_angle) % 360 > 90.) &\n                            ((tick_angle - normal_angle_full) % 360 > 90.))\n                tick_angle[reset] -= 180.\n\n            else:\n                rotation = 90 if axis == 'b' else -90\n                tick_angle = np.zeros((conf.frame_boundary_samples,)) + rotation\n\n            # We find for each interval the starting and ending coordinate,\n            # ensuring that we take wrapping into account correctly for\n            # longitudes.\n            w1 = spine.world[:-1, self.coord_index]\n            w2 = spine.world[1:, self.coord_index]\n\n            if self.coord_type == 'longitude':\n\n                if self._coord_scale_to_deg is not None:\n                    w1 = w1 * self._coord_scale_to_deg\n                    w2 = w2 * self._coord_scale_to_deg\n\n                w1 = wrap_angle_at(w1, self.coord_wrap)\n                w2 = wrap_angle_at(w2, self.coord_wrap)\n                with np.errstate(invalid='ignore'):\n                    w1[w2 - w1 > 180.] += 360\n                    w2[w1 - w2 > 180.] += 360\n\n                if self._coord_scale_to_deg is not None:\n                    w1 = w1 / self._coord_scale_to_deg\n                    w2 = w2 / self._coord_scale_to_deg\n\n            # For longitudes, we need to check ticks as well as ticks + 360,\n            # since the above can produce pairs such as 359 to 361 or 0.5 to\n            # 1.5, both of which would match a tick at 0.75. Otherwise we just\n            # check the ticks determined above.\n            self._compute_ticks(tick_world_coordinates, spine, axis, w1, w2, tick_angle)\n\n            if self.ticks.get_display_minor_ticks():\n                self._compute_ticks(minor_ticks_w_coordinates, spine, axis, w1,\n                                    w2, tick_angle, ticks='minor')\n\n        # format tick labels, add to scene\n        text = self.formatter(self.lbl_world * tick_world_coordinates.unit, spacing=self._fl_spacing)\n        for kwargs, txt in zip(self.lblinfo, text):\n            self.ticklabels.add(text=txt, **kwargs)\n\n    def _compute_ticks(self, tick_world_coordinates, spine, axis, w1, w2,\n                       tick_angle, ticks='major'):\n\n        if self.coord_type == 'longitude':\n            tick_world_coordinates_values = tick_world_coordinates.to_value(u.deg)\n            tick_world_coordinates_values = np.hstack([tick_world_coordinates_values,\n                                                       tick_world_coordinates_values + 360])\n            tick_world_coordinates_values *= u.deg.to(self.coord_unit)\n        else:\n            tick_world_coordinates_values = tick_world_coordinates.to_value(self.coord_unit)\n\n        for t in tick_world_coordinates_values:\n\n            # Find steps where a tick is present. We have to check\n            # separately for the case where the tick falls exactly on the\n            # frame points, otherwise we'll get two matches, one for w1 and\n            # one for w2.\n            with np.errstate(invalid='ignore'):\n                intersections = np.hstack([np.nonzero((t - w1) == 0)[0],\n                                           np.nonzero(((t - w1) * (t - w2)) < 0)[0]])\n\n            # But we also need to check for intersection with the last w2\n            if t - w2[-1] == 0:\n                intersections = np.append(intersections, len(w2) - 1)\n\n            # Loop over ticks, and find exact pixel coordinates by linear\n            # interpolation\n            for imin in intersections:\n\n                imax = imin + 1\n\n                if np.allclose(w1[imin], w2[imin], rtol=1.e-13, atol=1.e-13):\n                    continue  # tick is exactly aligned with frame\n                else:\n                    frac = (t - w1[imin]) / (w2[imin] - w1[imin])\n                    x_data_i = spine.data[imin, 0] + frac * (spine.data[imax, 0] - spine.data[imin, 0])\n                    y_data_i = spine.data[imin, 1] + frac * (spine.data[imax, 1] - spine.data[imin, 1])\n                    x_pix_i = spine.pixel[imin, 0] + frac * (spine.pixel[imax, 0] - spine.pixel[imin, 0])\n                    y_pix_i = spine.pixel[imin, 1] + frac * (spine.pixel[imax, 1] - spine.pixel[imin, 1])\n                    delta_angle = tick_angle[imax] - tick_angle[imin]\n                    if delta_angle > 180.:\n                        delta_angle -= 360.\n                    elif delta_angle < -180.:\n                        delta_angle += 360.\n                    angle_i = tick_angle[imin] + frac * delta_angle\n\n                if self.coord_type == 'longitude':\n\n                    if self._coord_scale_to_deg is not None:\n                        t *= self._coord_scale_to_deg\n\n                    world = wrap_angle_at(t, self.coord_wrap)\n\n                    if self._coord_scale_to_deg is not None:\n                        world /= self._coord_scale_to_deg\n\n                else:\n                    world = t\n\n                if ticks == 'major':\n\n                    self.ticks.add(axis=axis,\n                                   pixel=(x_data_i, y_data_i),\n                                   world=world,\n                                   angle=angle_i,\n                                   axis_displacement=imin + frac)\n\n                    # store information to pass to ticklabels.add\n                    # it's faster to format many ticklabels at once outside\n                    # of the loop\n                    self.lblinfo.append(dict(axis=axis,\n                                             pixel=(x_pix_i, y_pix_i),\n                                             world=world,\n                                             angle=spine.normal_angle[imin],\n                                             axis_displacement=imin + frac))\n                    self.lbl_world.append(world)\n\n                else:\n                    self.ticks.add_minor(minor_axis=axis,\n                                         minor_pixel=(x_data_i, y_data_i),\n                                         minor_world=world,\n                                         minor_angle=angle_i,\n                                         minor_axis_displacement=imin + frac)\n\n    def display_minor_ticks(self, display_minor_ticks):\n        \"\"\"\n        Display minor ticks for this coordinate.\n\n        Parameters\n        ----------\n        display_minor_ticks : bool\n            Whether or not to display minor ticks.\n        \"\"\"\n        self.ticks.display_minor_ticks(display_minor_ticks)\n\n    def get_minor_frequency(self):\n        return self.minor_frequency\n\n    def set_minor_frequency(self, frequency):\n        \"\"\"\n        Set the frequency of minor ticks per major ticks.\n\n        Parameters\n        ----------\n        frequency : int\n            The number of minor ticks per major ticks.\n        \"\"\"\n        self.minor_frequency = frequency\n\n    def _update_grid_lines_1d(self):\n        if self.coord_index is None:\n            return\n\n        x_ticks_pos = [a[0] for a in self.ticks.pixel['b']]\n\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        self.grid_lines = []\n        for x_coord in x_ticks_pos:\n            pixel = [[x_coord, ymin], [x_coord, ymax]]\n            self.grid_lines.append(Path(pixel))\n\n    def _update_grid_lines(self):\n\n        # For 3-d WCS with a correlated third axis, the *proper* way of\n        # drawing a grid should be to find the world coordinates of all pixels\n        # and drawing contours. What we are doing here assumes that we can\n        # define the grid lines with just two of the coordinates (and\n        # therefore assumes that the other coordinates are fixed and set to\n        # the value in the slice). Here we basically assume that if the WCS\n        # had a third axis, it has been abstracted away in the transformation.\n\n        if self.coord_index is None:\n            return\n\n        coord_range = self.parent_map.get_coord_range()\n\n        tick_world_coordinates, spacing = self.locator(*coord_range[self.coord_index])\n        tick_world_coordinates_values = tick_world_coordinates.to_value(self.coord_unit)\n\n        n_coord = len(tick_world_coordinates_values)\n\n        from . import conf\n        n_samples = conf.grid_samples\n\n        xy_world = np.zeros((n_samples * n_coord, 2))\n\n        self.grid_lines = []\n\n        for iw, w in enumerate(tick_world_coordinates_values):\n            subset = slice(iw * n_samples, (iw + 1) * n_samples)\n            if self.coord_index == 0:\n                xy_world[subset, 0] = np.repeat(w, n_samples)\n                xy_world[subset, 1] = np.linspace(coord_range[1][0], coord_range[1][1], n_samples)\n            else:\n                xy_world[subset, 0] = np.linspace(coord_range[0][0], coord_range[0][1], n_samples)\n                xy_world[subset, 1] = np.repeat(w, n_samples)\n\n        # We now convert all the world coordinates to pixel coordinates in a\n        # single go rather than doing this in the gridline to path conversion\n        # to fully benefit from vectorized coordinate transformations.\n\n        # Transform line to pixel coordinates\n        pixel = self.transform.inverted().transform(xy_world)\n\n        # Create round-tripped values for checking\n        xy_world_round = self.transform.transform(pixel)\n\n        for iw in range(n_coord):\n            subset = slice(iw * n_samples, (iw + 1) * n_samples)\n            self.grid_lines.append(self._get_gridline(xy_world[subset], pixel[subset], xy_world_round[subset]))\n\n    def _get_gridline(self, xy_world, pixel, xy_world_round):\n        if self.coord_type == 'scalar':\n            return get_gridline_path(xy_world, pixel)\n        else:\n            return get_lon_lat_path(xy_world, pixel, xy_world_round)\n\n    def _clear_grid_contour(self):\n        if hasattr(self, '_grid') and self._grid:\n            for line in self._grid.collections:\n                line.remove()\n\n    def _update_grid_contour(self):\n\n        if self.coord_index is None:\n            return\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        from . import conf\n        res = conf.contour_grid_samples\n\n        x, y = np.meshgrid(np.linspace(xmin, xmax, res),\n                           np.linspace(ymin, ymax, res))\n        pixel = np.array([x.ravel(), y.ravel()]).T\n        world = self.transform.transform(pixel)\n        field = world[:, self.coord_index].reshape(res, res).T\n\n        coord_range = self.parent_map.get_coord_range()\n\n        tick_world_coordinates, spacing = self.locator(*coord_range[self.coord_index])\n\n        # tick_world_coordinates is a Quantities array and we only needs its values\n        tick_world_coordinates_values = tick_world_coordinates.value\n\n        if self.coord_type == 'longitude':\n\n            # Find biggest gap in tick_world_coordinates and wrap in middle\n            # For now just assume spacing is equal, so any mid-point will do\n            mid = 0.5 * (tick_world_coordinates_values[0] + tick_world_coordinates_values[1])\n            field = wrap_angle_at(field, mid)\n            tick_world_coordinates_values = wrap_angle_at(tick_world_coordinates_values, mid)\n\n            # Replace wraps by NaN\n            with np.errstate(invalid='ignore'):\n                reset = (np.abs(np.diff(field[:, :-1], axis=0)) > 180) | (np.abs(np.diff(field[:-1, :], axis=1)) > 180)\n            field[:-1, :-1][reset] = np.nan\n            field[1:, :-1][reset] = np.nan\n            field[:-1, 1:][reset] = np.nan\n            field[1:, 1:][reset] = np.nan\n\n        if len(tick_world_coordinates_values) > 0:\n            with np.errstate(invalid='ignore'):\n                self._grid = self.parent_axes.contour(x, y, field.transpose(), levels=np.sort(tick_world_coordinates_values))\n        else:\n            self._grid = None\n\n    def tick_params(self, which='both', **kwargs):\n        \"\"\"\n        Method to set the tick and tick label parameters in the same way as the\n        :meth:`~matplotlib.axes.Axes.tick_params` method in Matplotlib.\n\n        This is provided for convenience, but the recommended API is to use\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticks`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticklabel`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticks_position`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticklabel_position`,\n        and :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.grid`.\n\n        Parameters\n        ----------\n        which : {'both', 'major', 'minor'}, optional\n            Which ticks to apply the settings to. By default, setting are\n            applied to both major and minor ticks. Note that if ``'minor'`` is\n            specified, only the length of the ticks can be set currently.\n        direction : {'in', 'out'}, optional\n            Puts ticks inside the axes, or outside the axes.\n        length : float, optional\n            Tick length in points.\n        width : float, optional\n            Tick width in points.\n        color : color, optional\n            Tick color (accepts any valid Matplotlib color)\n        pad : float, optional\n            Distance in points between tick and label.\n        labelsize : float or str, optional\n            Tick label font size in points or as a string (e.g., 'large').\n        labelcolor : color, optional\n            Tick label color (accepts any valid Matplotlib color)\n        colors : color, optional\n            Changes the tick color and the label color to the same value\n             (accepts any valid Matplotlib color).\n        bottom, top, left, right : bool, optional\n            Where to draw the ticks. Note that this will not work correctly if\n            the frame is not rectangular.\n        labelbottom, labeltop, labelleft, labelright : bool, optional\n            Where to draw the tick labels. Note that this will not work\n            correctly if the frame is not rectangular.\n        grid_color : color, optional\n            The color of the grid lines (accepts any valid Matplotlib color).\n        grid_alpha : float, optional\n            Transparency of grid lines: 0 (transparent) to 1 (opaque).\n        grid_linewidth : float, optional\n            Width of grid lines in points.\n        grid_linestyle : str, optional\n            The style of the grid lines (accepts any valid Matplotlib line\n            style).\n        \"\"\"\n\n        # First do some sanity checking on the keyword arguments\n\n        # colors= is a fallback default for color and labelcolor\n        if 'colors' in kwargs:\n            if 'color' not in kwargs:\n                kwargs['color'] = kwargs['colors']\n            if 'labelcolor' not in kwargs:\n                kwargs['labelcolor'] = kwargs['colors']\n\n        # The only property that can be set *specifically* for minor ticks is\n        # the length. In future we could consider having a separate Ticks instance\n        # for minor ticks so that e.g. the color can be set separately.\n        if which == 'minor':\n            if len(set(kwargs) - {'length'}) > 0:\n                raise ValueError(\"When setting which='minor', the only \"\n                                 \"property that can be set at the moment is \"\n                                 \"'length' (the minor tick length)\")\n            else:\n                if 'length' in kwargs:\n                    self.ticks.set_minor_ticksize(kwargs['length'])\n            return\n\n        # At this point, we can now ignore the 'which' argument.\n\n        # Set the tick arguments\n        self.set_ticks(size=kwargs.get('length'),\n                       width=kwargs.get('width'),\n                       color=kwargs.get('color'),\n                       direction=kwargs.get('direction'))\n\n        # Set the tick position\n        position = None\n        for arg in ('bottom', 'left', 'top', 'right'):\n            if arg in kwargs and position is None:\n                position = ''\n            if kwargs.get(arg):\n                position += arg[0]\n        if position is not None:\n            self.set_ticks_position(position)\n\n        # Set the tick label arguments.\n        self.set_ticklabel(color=kwargs.get('labelcolor'),\n                           size=kwargs.get('labelsize'),\n                           pad=kwargs.get('pad'))\n\n        # Set the tick label position\n        position = None\n        for arg in ('bottom', 'left', 'top', 'right'):\n            if 'label' + arg in kwargs and position is None:\n                position = ''\n            if kwargs.get('label' + arg):\n                position += arg[0]\n        if position is not None:\n            self.set_ticklabel_position(position)\n\n        # And the grid settings\n        if 'grid_color' in kwargs:\n            self.grid_lines_kwargs['edgecolor'] = kwargs['grid_color']\n        if 'grid_alpha' in kwargs:\n            self.grid_lines_kwargs['alpha'] = kwargs['grid_alpha']\n        if 'grid_linewidth' in kwargs:\n            self.grid_lines_kwargs['linewidth'] = kwargs['grid_linewidth']\n        if 'grid_linestyle' in kwargs:\n            if kwargs['grid_linestyle'] in LINES_TO_PATCHES_LINESTYLE:\n                self.grid_lines_kwargs['linestyle'] = LINES_TO_PATCHES_LINESTYLE[kwargs['grid_linestyle']]\n            else:\n                self.grid_lines_kwargs['linestyle'] = kwargs['grid_linestyle']"},{"fileName":"core.py","filePath":"astropy/visualization/wcsaxes","id":16315,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom functools import partial\nfrom collections import defaultdict\n\nimport numpy as np\n\nfrom matplotlib import rcParams\nfrom matplotlib.artist import Artist\nfrom matplotlib.axes import Axes, subplot_class_factory\nfrom matplotlib.transforms import Affine2D, Bbox, Transform\n\nimport astropy.units as u\nfrom astropy.coordinates import SkyCoord, BaseCoordinateFrame\nfrom astropy.wcs import WCS\nfrom astropy.wcs.wcsapi import BaseHighLevelWCS, BaseLowLevelWCS\n\nfrom .transforms import CoordinateTransform\nfrom .coordinates_map import CoordinatesMap\nfrom .utils import get_coord_meta, transform_contour_set_inplace\nfrom .frame import RectangularFrame, RectangularFrame1D\nfrom .wcsapi import IDENTITY, transform_coord_meta_from_wcs\n\n\n__all__ = ['WCSAxes', 'WCSAxesSubplot']\n\nVISUAL_PROPERTIES = ['facecolor', 'edgecolor', 'linewidth', 'alpha', 'linestyle']\n\n\nclass _WCSAxesArtist(Artist):\n    \"\"\"This is a dummy artist to enforce the correct z-order of axis ticks,\n    tick labels, and gridlines.\n\n    FIXME: This is a bit of a hack. ``Axes.draw`` sorts the artists by zorder\n    and then renders them in sequence. For normal Matplotlib axes, the ticks,\n    tick labels, and gridlines are included in this list of artists and hence\n    are automatically drawn in the correct order. However, ``WCSAxes`` disables\n    the native ticks, labels, and gridlines. Instead, ``WCSAxes.draw`` renders\n    ersatz ticks, labels, and gridlines by explicitly calling the functions\n    ``CoordinateHelper._draw_ticks``, ``CoordinateHelper._draw_grid``, etc.\n    This hack would not be necessary if ``WCSAxes`` drew ticks, tick labels,\n    and gridlines in the standary way.\"\"\"\n\n    def draw(self, renderer, *args, **kwargs):\n        self.axes.draw_wcsaxes(renderer)\n\n\nclass WCSAxes(Axes):\n    \"\"\"\n    The main axes class that can be used to show world coordinates from a WCS.\n\n    Parameters\n    ----------\n    fig : `~matplotlib.figure.Figure`\n        The figure to add the axes to\n    rect : list\n        The position of the axes in the figure in relative units. Should be\n        given as ``[left, bottom, width, height]``.\n    wcs : :class:`~astropy.wcs.WCS`, optional\n        The WCS for the data. If this is specified, ``transform`` cannot be\n        specified.\n    transform : `~matplotlib.transforms.Transform`, optional\n        The transform for the data. If this is specified, ``wcs`` cannot be\n        specified.\n    coord_meta : dict, optional\n        A dictionary providing additional metadata when ``transform`` is\n        specified. This should include the keys ``type``, ``wrap``, and\n        ``unit``. Each of these should be a list with as many items as the\n        dimension of the WCS. The ``type`` entries should be one of\n        ``longitude``, ``latitude``, or ``scalar``, the ``wrap`` entries should\n        give, for the longitude, the angle at which the coordinate wraps (and\n        `None` otherwise), and the ``unit`` should give the unit of the\n        coordinates as :class:`~astropy.units.Unit` instances. This can\n        optionally also include a ``format_unit`` entry giving the units to use\n        for the tick labels (if not specified, this defaults to ``unit``).\n    transData : `~matplotlib.transforms.Transform`, optional\n        Can be used to override the default data -> pixel mapping.\n    slices : tuple, optional\n        For WCS transformations with more than two dimensions, we need to\n        choose which dimensions are being shown in the 2D image. The slice\n        should contain one ``x`` entry, one ``y`` entry, and the rest of the\n        values should be integers indicating the slice through the data. The\n        order of the items in the slice should be the same as the order of the\n        dimensions in the :class:`~astropy.wcs.WCS`, and the opposite of the\n        order of the dimensions in Numpy. For example, ``(50, 'x', 'y')`` means\n        that the first WCS dimension (last Numpy dimension) will be sliced at\n        an index of 50, the second WCS and Numpy dimension will be shown on the\n        x axis, and the final WCS dimension (first Numpy dimension) will be\n        shown on the y-axis (and therefore the data will be plotted using\n        ``data[:, :, 50].transpose()``)\n    frame_class : type, optional\n        The class for the frame, which should be a subclass of\n        :class:`~astropy.visualization.wcsaxes.frame.BaseFrame`. The default is to use a\n        :class:`~astropy.visualization.wcsaxes.frame.RectangularFrame`\n    \"\"\"\n\n    def __init__(self, fig, rect, wcs=None, transform=None, coord_meta=None,\n                 transData=None, slices=None, frame_class=None,\n                 **kwargs):\n        \"\"\"\n        \"\"\"\n\n        super().__init__(fig, rect, **kwargs)\n        self._bboxes = []\n\n        if frame_class is not None:\n            self.frame_class = frame_class\n        elif (wcs is not None and (wcs.pixel_n_dim == 1 or\n                                   (slices is not None and 'y' not in slices))):\n            self.frame_class = RectangularFrame1D\n        else:\n            self.frame_class = RectangularFrame\n\n        if not (transData is None):\n            # User wants to override the transform for the final\n            # data->pixel mapping\n            self.transData = transData\n\n        self.reset_wcs(wcs=wcs, slices=slices, transform=transform, coord_meta=coord_meta)\n        self._hide_parent_artists()\n        self.format_coord = self._display_world_coords\n        self._display_coords_index = 0\n        fig.canvas.mpl_connect('key_press_event', self._set_cursor_prefs)\n        self.patch = self.coords.frame.patch\n        self._wcsaxesartist = _WCSAxesArtist()\n        self.add_artist(self._wcsaxesartist)\n        self._drawn = False\n\n    def _display_world_coords(self, x, y):\n\n        if not self._drawn:\n            return \"\"\n\n        if self._display_coords_index == -1:\n            return f\"{x} {y} (pixel)\"\n\n        pixel = np.array([x, y])\n\n        coords = self._all_coords[self._display_coords_index]\n\n        world = coords._transform.transform(np.array([pixel]))[0]\n\n        coord_strings = []\n        for idx, coord in enumerate(coords):\n            if coord.coord_index is not None:\n                coord_strings.append(coord.format_coord(world[coord.coord_index], format='ascii'))\n\n        coord_string = ' '.join(coord_strings)\n\n        if self._display_coords_index == 0:\n            system = \"world\"\n        else:\n            system = f\"world, overlay {self._display_coords_index}\"\n\n        coord_string = f\"{coord_string} ({system})\"\n\n        return coord_string\n\n    def _set_cursor_prefs(self, event, **kwargs):\n        if event.key == 'w':\n            self._display_coords_index += 1\n            if self._display_coords_index + 1 > len(self._all_coords):\n                self._display_coords_index = -1\n\n    def _hide_parent_artists(self):\n        # Turn off spines and current axes\n        for s in self.spines.values():\n            s.set_visible(False)\n\n        self.xaxis.set_visible(False)\n        if self.frame_class is not RectangularFrame1D:\n            self.yaxis.set_visible(False)\n\n    # We now overload ``imshow`` because we need to make sure that origin is\n    # set to ``lower`` for all images, which means that we need to flip RGB\n    # images.\n    def imshow(self, X, *args, **kwargs):\n        \"\"\"\n        Wrapper to Matplotlib's :meth:`~matplotlib.axes.Axes.imshow`.\n\n        If an RGB image is passed as a PIL object, it will be flipped\n        vertically and ``origin`` will be set to ``lower``, since WCS\n        transformations - like FITS files - assume that the origin is the lower\n        left pixel of the image (whereas RGB images have the origin in the top\n        left).\n\n        All arguments are passed to :meth:`~matplotlib.axes.Axes.imshow`.\n        \"\"\"\n\n        origin = kwargs.pop('origin', 'lower')\n\n        # plt.imshow passes origin as None, which we should default to lower.\n        if origin is None:\n            origin = 'lower'\n        elif origin == 'upper':\n            raise ValueError(\"Cannot use images with origin='upper' in WCSAxes.\")\n\n        # To check whether the image is a PIL image we can check if the data\n        # has a 'getpixel' attribute - this is what Matplotlib's AxesImage does\n\n        try:\n            from PIL.Image import Image, FLIP_TOP_BOTTOM\n        except ImportError:\n            # We don't need to worry since PIL is not installed, so user cannot\n            # have passed RGB image.\n            pass\n        else:\n            if isinstance(X, Image) or hasattr(X, 'getpixel'):\n                X = X.transpose(FLIP_TOP_BOTTOM)\n\n        return super().imshow(X, *args, origin=origin, **kwargs)\n\n    def contour(self, *args, **kwargs):\n        \"\"\"\n        Plot contours.\n\n        This is a custom implementation of :meth:`~matplotlib.axes.Axes.contour`\n        which applies the transform (if specified) to all contours in one go for\n        performance rather than to each contour line individually. All\n        positional and keyword arguments are the same as for\n        :meth:`~matplotlib.axes.Axes.contour`.\n        \"\"\"\n\n        # In Matplotlib, when calling contour() with a transform, each\n        # individual path in the contour map is transformed separately. However,\n        # this is much too slow for us since each call to the transforms results\n        # in an Astropy coordinate transformation, which has a non-negligible\n        # overhead - therefore a better approach is to override contour(), call\n        # the Matplotlib one with no transform, then apply the transform in one\n        # go to all the segments that make up the contour map.\n\n        transform = kwargs.pop('transform', None)\n\n        cset = super().contour(*args, **kwargs)\n\n        if transform is not None:\n            # The transform passed to self.contour will normally include\n            # a transData component at the end, but we can remove that since\n            # we are already working in data space.\n            transform = transform - self.transData\n            transform_contour_set_inplace(cset, transform)\n\n        return cset\n\n    def contourf(self, *args, **kwargs):\n        \"\"\"\n        Plot filled contours.\n\n        This is a custom implementation of :meth:`~matplotlib.axes.Axes.contourf`\n        which applies the transform (if specified) to all contours in one go for\n        performance rather than to each contour line individually. All\n        positional and keyword arguments are the same as for\n        :meth:`~matplotlib.axes.Axes.contourf`.\n        \"\"\"\n\n        # See notes for contour above.\n\n        transform = kwargs.pop('transform', None)\n\n        cset = super().contourf(*args, **kwargs)\n\n        if transform is not None:\n            # The transform passed to self.contour will normally include\n            # a transData component at the end, but we can remove that since\n            # we are already working in data space.\n            transform = transform - self.transData\n            transform_contour_set_inplace(cset, transform)\n\n        return cset\n\n    def plot_coord(self, *args, **kwargs):\n        \"\"\"\n        Plot `~astropy.coordinates.SkyCoord` or\n        `~astropy.coordinates.BaseCoordinateFrame` objects onto the axes.\n\n        The first argument to\n        :meth:`~astropy.visualization.wcsaxes.WCSAxes.plot_coord` should be a\n        coordinate, which will then be converted to the first two parameters to\n        `matplotlib.axes.Axes.plot`. All other arguments are the same as\n        `matplotlib.axes.Axes.plot`. If not specified a ``transform`` keyword\n        argument will be created based on the coordinate.\n\n        Parameters\n        ----------\n        coordinate : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate object to plot on the axes. This is converted to the\n            first two arguments to `matplotlib.axes.Axes.plot`.\n\n        See Also\n        --------\n        matplotlib.axes.Axes.plot :\n            This method is called from this function with all arguments passed to it.\n\n        \"\"\"\n\n        if isinstance(args[0], (SkyCoord, BaseCoordinateFrame)):\n\n            # Extract the frame from the first argument.\n            frame0 = args[0]\n            if isinstance(frame0, SkyCoord):\n                frame0 = frame0.frame\n\n            native_frame = self._transform_pixel2world.frame_out\n            # Transform to the native frame of the plot\n            frame0 = frame0.transform_to(native_frame)\n\n            plot_data = []\n            for coord in self.coords:\n                if coord.coord_type == 'longitude':\n                    plot_data.append(frame0.spherical.lon.to_value(u.deg))\n                elif coord.coord_type == 'latitude':\n                    plot_data.append(frame0.spherical.lat.to_value(u.deg))\n                else:\n                    raise NotImplementedError(\"Coordinates cannot be plotted with this \"\n                                              \"method because the WCS does not represent longitude/latitude.\")\n\n            if 'transform' in kwargs.keys():\n                raise TypeError(\"The 'transform' keyword argument is not allowed,\"\n                                \" as it is automatically determined by the input coordinate frame.\")\n\n            transform = self.get_transform(native_frame)\n            kwargs.update({'transform': transform})\n\n            args = tuple(plot_data) + args[1:]\n\n        return super().plot(*args, **kwargs)\n\n    def reset_wcs(self, wcs=None, slices=None, transform=None, coord_meta=None):\n        \"\"\"\n        Reset the current Axes, to use a new WCS object.\n        \"\"\"\n\n        # Here determine all the coordinate axes that should be shown.\n        if wcs is None and transform is None:\n\n            self.wcs = IDENTITY\n\n        else:\n\n            # We now force call 'set', which ensures the WCS object is\n            # consistent, which will only be important if the WCS has been set\n            # by hand. For example if the user sets a celestial WCS by hand and\n            # forgets to set the units, WCS.wcs.set() will do this.\n            if wcs is not None:\n                # Check if the WCS object is an instance of `astropy.wcs.WCS`\n                # This check is necessary as only `astropy.wcs.WCS` supports\n                # wcs.set() method\n                if isinstance(wcs, WCS):\n                    wcs.wcs.set()\n\n                if isinstance(wcs, BaseHighLevelWCS):\n                    wcs = wcs.low_level_wcs\n\n            self.wcs = wcs\n\n        # If we are making a new WCS, we need to preserve the path object since\n        # it may already be used by objects that have been plotted, and we need\n        # to continue updating it. CoordinatesMap will create a new frame\n        # instance, but we can tell that instance to keep using the old path.\n        if hasattr(self, 'coords'):\n            previous_frame = {'path': self.coords.frame._path,\n                              'color': self.coords.frame.get_color(),\n                              'linewidth': self.coords.frame.get_linewidth()}\n        else:\n            previous_frame = {'path': None}\n\n        if self.wcs is not None:\n\n            transform, coord_meta = transform_coord_meta_from_wcs(self.wcs, self.frame_class, slices=slices)\n\n        self.coords = CoordinatesMap(self,\n                                     transform=transform,\n                                     coord_meta=coord_meta,\n                                     frame_class=self.frame_class,\n                                     previous_frame_path=previous_frame['path'])\n\n        self._transform_pixel2world = transform\n\n        if previous_frame['path'] is not None:\n            self.coords.frame.set_color(previous_frame['color'])\n            self.coords.frame.set_linewidth(previous_frame['linewidth'])\n\n        self._all_coords = [self.coords]\n\n        # Common default settings for Rectangular Frame\n        for ind, pos in enumerate(coord_meta.get('default_axislabel_position', ['b', 'l'])):\n            self.coords[ind].set_axislabel_position(pos)\n\n        for ind, pos in enumerate(coord_meta.get('default_ticklabel_position', ['b', 'l'])):\n            self.coords[ind].set_ticklabel_position(pos)\n\n        for ind, pos in enumerate(coord_meta.get('default_ticks_position', ['bltr', 'bltr'])):\n            self.coords[ind].set_ticks_position(pos)\n\n        if rcParams['axes.grid']:\n            self.grid()\n\n    def draw_wcsaxes(self, renderer):\n        if not self.axison:\n            return\n        # Here need to find out range of all coordinates, and update range for\n        # each coordinate axis. For now, just assume it covers the whole sky.\n\n        self._bboxes = []\n        # This generates a structure like [coords][axis] = [...]\n        ticklabels_bbox = defaultdict(partial(defaultdict, list))\n\n        visible_ticks = []\n\n        for coords in self._all_coords:\n\n            coords.frame.update()\n            for coord in coords:\n                coord._draw_grid(renderer)\n\n        for coords in self._all_coords:\n\n            for coord in coords:\n                coord._draw_ticks(renderer, bboxes=self._bboxes,\n                                  ticklabels_bbox=ticklabels_bbox[coord])\n                visible_ticks.extend(coord.ticklabels.get_visible_axes())\n\n        for coords in self._all_coords:\n\n            for coord in coords:\n                coord._draw_axislabels(renderer, bboxes=self._bboxes,\n                                       ticklabels_bbox=ticklabels_bbox,\n                                       visible_ticks=visible_ticks)\n\n        self.coords.frame.draw(renderer)\n\n    def draw(self, renderer, **kwargs):\n        \"\"\"Draw the axes.\"\"\"\n\n        # Before we do any drawing, we need to remove any existing grid lines\n        # drawn with contours, otherwise if we try and remove the contours\n        # part way through drawing, we end up with the issue mentioned in\n        # https://github.com/astropy/astropy/issues/12446\n        for coords in self._all_coords:\n            for coord in coords:\n                coord._clear_grid_contour()\n\n        # In Axes.draw, the following code can result in the xlim and ylim\n        # values changing, so we need to force call this here to make sure that\n        # the limits are correct before we update the patch.\n        locator = self.get_axes_locator()\n        if locator:\n            pos = locator(self, renderer)\n            self.apply_aspect(pos)\n        else:\n            self.apply_aspect()\n\n        if self._axisbelow is True:\n            self._wcsaxesartist.set_zorder(0.5)\n        elif self._axisbelow is False:\n            self._wcsaxesartist.set_zorder(2.5)\n        else:\n            # 'line': above patches, below lines\n            self._wcsaxesartist.set_zorder(1.5)\n\n        # We need to make sure that that frame path is up to date\n        self.coords.frame._update_patch_path()\n\n        super().draw(renderer, **kwargs)\n\n        self._drawn = True\n\n    # Matplotlib internally sometimes calls set_xlabel(label=...).\n    def set_xlabel(self, xlabel=None, labelpad=1, loc=None, **kwargs):\n        \"\"\"Set x-label.\"\"\"\n        if xlabel is None:\n            xlabel = kwargs.pop('label', None)\n            if xlabel is None:\n                raise TypeError(\"set_xlabel() missing 1 required positional argument: 'xlabel'\")\n        for coord in self.coords:\n            if ('b' in coord.axislabels.get_visible_axes() or\n                'h' in coord.axislabels.get_visible_axes()):\n                coord.set_axislabel(xlabel, minpad=labelpad, **kwargs)\n                break\n\n    def set_ylabel(self, ylabel=None, labelpad=1, loc=None, **kwargs):\n        \"\"\"Set y-label\"\"\"\n        if ylabel is None:\n            ylabel = kwargs.pop('label', None)\n            if ylabel is None:\n                raise TypeError(\"set_ylabel() missing 1 required positional argument: 'ylabel'\")\n\n        if self.frame_class is RectangularFrame1D:\n            return super().set_ylabel(ylabel, labelpad=labelpad, **kwargs)\n\n        for coord in self.coords:\n            if ('l' in coord.axislabels.get_visible_axes() or\n                'c' in coord.axislabels.get_visible_axes()):\n                coord.set_axislabel(ylabel, minpad=labelpad, **kwargs)\n                break\n\n    def get_xlabel(self):\n        for coord in self.coords:\n            if ('b' in coord.axislabels.get_visible_axes() or\n                'h' in coord.axislabels.get_visible_axes()):\n                return coord.get_axislabel()\n\n    def get_ylabel(self):\n        if self.frame_class is RectangularFrame1D:\n            return super().get_ylabel()\n\n        for coord in self.coords:\n            if ('l' in coord.axislabels.get_visible_axes() or\n                'c' in coord.axislabels.get_visible_axes()):\n                return coord.get_axislabel()\n\n    def get_coords_overlay(self, frame, coord_meta=None):\n\n        # Here we can't use get_transform because that deals with\n        # pixel-to-pixel transformations when passing a WCS object.\n        if isinstance(frame, WCS):\n            transform, coord_meta = transform_coord_meta_from_wcs(frame, self.frame_class)\n        else:\n            transform = self._get_transform_no_transdata(frame)\n\n        if coord_meta is None:\n            coord_meta = get_coord_meta(frame)\n\n        coords = CoordinatesMap(self, transform=transform,\n                                coord_meta=coord_meta,\n                                frame_class=self.frame_class)\n\n        self._all_coords.append(coords)\n\n        # Common settings for overlay\n        coords[0].set_axislabel_position('t')\n        coords[1].set_axislabel_position('r')\n        coords[0].set_ticklabel_position('t')\n        coords[1].set_ticklabel_position('r')\n\n        self.overlay_coords = coords\n\n        return coords\n\n    def get_transform(self, frame):\n        \"\"\"\n        Return a transform from the specified frame to display coordinates.\n\n        This does not include the transData transformation\n\n        Parameters\n        ----------\n        frame : :class:`~astropy.wcs.WCS` or :class:`~matplotlib.transforms.Transform` or str\n            The ``frame`` parameter can have several possible types:\n                * :class:`~astropy.wcs.WCS` instance: assumed to be a\n                  transformation from pixel to world coordinates, where the\n                  world coordinates are the same as those in the WCS\n                  transformation used for this ``WCSAxes`` instance. This is\n                  used for example to show contours, since this involves\n                  plotting an array in pixel coordinates that are not the\n                  final data coordinate and have to be transformed to the\n                  common world coordinate system first.\n                * :class:`~matplotlib.transforms.Transform` instance: it is\n                  assumed to be a transform to the world coordinates that are\n                  part of the WCS used to instantiate this ``WCSAxes``\n                  instance.\n                * ``'pixel'`` or ``'world'``: return a transformation that\n                  allows users to plot in pixel/data coordinates (essentially\n                  an identity transform) and ``world`` (the default\n                  world-to-pixel transformation used to instantiate the\n                  ``WCSAxes`` instance).\n                * ``'fk5'`` or ``'galactic'``: return a transformation from\n                  the specified frame to the pixel/data coordinates.\n                * :class:`~astropy.coordinates.BaseCoordinateFrame` instance.\n        \"\"\"\n        return self._get_transform_no_transdata(frame).inverted() + self.transData\n\n    def _get_transform_no_transdata(self, frame):\n        \"\"\"\n        Return a transform from data to the specified frame\n        \"\"\"\n\n        if isinstance(frame, (BaseLowLevelWCS, BaseHighLevelWCS)):\n            if isinstance(frame, BaseHighLevelWCS):\n                frame = frame.low_level_wcs\n\n            transform, coord_meta = transform_coord_meta_from_wcs(frame, self.frame_class)\n            transform_world2pixel = transform.inverted()\n\n            if self._transform_pixel2world.frame_out == transform_world2pixel.frame_in:\n\n                return self._transform_pixel2world + transform_world2pixel\n\n            else:\n\n                return (self._transform_pixel2world +\n                        CoordinateTransform(self._transform_pixel2world.frame_out,\n                                            transform_world2pixel.frame_in) +\n                        transform_world2pixel)\n\n        elif isinstance(frame, str) and frame == 'pixel':\n\n            return Affine2D()\n\n        elif isinstance(frame, Transform):\n\n            return self._transform_pixel2world + frame\n\n        else:\n\n            if isinstance(frame, str) and frame == 'world':\n\n                return self._transform_pixel2world\n\n            else:\n\n                coordinate_transform = CoordinateTransform(self._transform_pixel2world.frame_out, frame)\n\n                if coordinate_transform.same_frames:\n                    return self._transform_pixel2world\n                else:\n                    return self._transform_pixel2world + coordinate_transform\n\n    def get_tightbbox(self, renderer, *args, **kwargs):\n\n        # FIXME: we should determine what to do with the extra arguments here.\n        # Note that the expected signature of this method is different in\n        # Matplotlib 3.x compared to 2.x, but we only support 3.x now.\n\n        if not self.get_visible():\n            return\n\n        bb = [b for b in self._bboxes if b and (b.width != 0 or b.height != 0)]\n        bb.append(super().get_tightbbox(renderer, *args, **kwargs))\n\n        if bb:\n            _bbox = Bbox.union(bb)\n            return _bbox\n        else:\n            return self.get_window_extent(renderer)\n\n    def grid(self, b=None, axis='both', *, which='major', **kwargs):\n        \"\"\"\n        Plot gridlines for both coordinates.\n\n        Standard matplotlib appearance options (color, alpha, etc.) can be\n        passed as keyword arguments. This behaves like `matplotlib.axes.Axes`\n        except that if no arguments are specified, the grid is shown rather\n        than toggled.\n\n        Parameters\n        ----------\n        b : bool\n            Whether to show the gridlines.\n        axis : 'both', 'x', 'y'\n            Which axis to turn the gridlines on/off for.\n        which : str\n            Currently only ``'major'`` is supported.\n        \"\"\"\n\n        if not hasattr(self, 'coords'):\n            return\n\n        if which != 'major':\n            raise NotImplementedError('Plotting the grid for the minor ticks is '\n                                      'not supported.')\n\n        if axis == 'both':\n            self.coords.grid(draw_grid=b, **kwargs)\n        elif axis == 'x':\n            self.coords[0].grid(draw_grid=b, **kwargs)\n        elif axis == 'y':\n            self.coords[1].grid(draw_grid=b, **kwargs)\n        else:\n            raise ValueError('axis should be one of x/y/both')\n\n    def tick_params(self, axis='both', **kwargs):\n        \"\"\"\n        Method to set the tick and tick label parameters in the same way as the\n        :meth:`~matplotlib.axes.Axes.tick_params` method in Matplotlib.\n\n        This is provided for convenience, but the recommended API is to use\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticks`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticklabel`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticks_position`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticklabel_position`,\n        and :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.grid`.\n\n        Parameters\n        ----------\n        axis : int or str, optional\n            Which axis to apply the parameters to. This defaults to 'both'\n            but this can also be set to an `int` or `str` that refers to the\n            axis to apply it to, following the valid values that can index\n            ``ax.coords``. Note that ``'x'`` and ``'y``' are also accepted in\n            the case of rectangular axes.\n        which : {'both', 'major', 'minor'}, optional\n            Which ticks to apply the settings to. By default, setting are\n            applied to both major and minor ticks. Note that if ``'minor'`` is\n            specified, only the length of the ticks can be set currently.\n        direction : {'in', 'out'}, optional\n            Puts ticks inside the axes, or outside the axes.\n        length : float, optional\n            Tick length in points.\n        width : float, optional\n            Tick width in points.\n        color : color, optional\n            Tick color (accepts any valid Matplotlib color)\n        pad : float, optional\n            Distance in points between tick and label.\n        labelsize : float or str, optional\n            Tick label font size in points or as a string (e.g., 'large').\n        labelcolor : color, optional\n            Tick label color (accepts any valid Matplotlib color)\n        colors : color, optional\n            Changes the tick color and the label color to the same value\n             (accepts any valid Matplotlib color).\n        bottom, top, left, right : bool, optional\n            Where to draw the ticks. Note that this can only be given if a\n            specific coordinate is specified via the ``axis`` argument, and it\n            will not work correctly if the frame is not rectangular.\n        labelbottom, labeltop, labelleft, labelright : bool, optional\n            Where to draw the tick labels. Note that this can only be given if a\n            specific coordinate is specified via the ``axis`` argument, and it\n            will not work correctly if the frame is not rectangular.\n        grid_color : color, optional\n            The color of the grid lines (accepts any valid Matplotlib color).\n        grid_alpha : float, optional\n            Transparency of grid lines: 0 (transparent) to 1 (opaque).\n        grid_linewidth : float, optional\n            Width of grid lines in points.\n        grid_linestyle : str, optional\n            The style of the grid lines (accepts any valid Matplotlib line\n            style).\n        \"\"\"\n\n        if not hasattr(self, 'coords'):\n            # Axes haven't been fully initialized yet, so just ignore, as\n            # Axes.__init__ calls this method\n            return\n\n        if axis == 'both':\n\n            for pos in ('bottom', 'left', 'top', 'right'):\n                if pos in kwargs:\n                    raise ValueError(f\"Cannot specify {pos}= when axis='both'\")\n                if 'label' + pos in kwargs:\n                    raise ValueError(f\"Cannot specify label{pos}= when axis='both'\")\n\n            for coord in self.coords:\n                coord.tick_params(**kwargs)\n\n        elif axis in self.coords:\n\n            self.coords[axis].tick_params(**kwargs)\n\n        elif axis in ('x', 'y') and self.frame_class is RectangularFrame:\n\n            spine = 'b' if axis == 'x' else 'l'\n\n            for coord in self.coords:\n                if spine in coord.axislabels.get_visible_axes():\n                    coord.tick_params(**kwargs)\n\n\n# In the following, we put the generated subplot class in a temporary class and\n# we then inherit it - if we don't do this, the generated class appears to\n# belong in matplotlib, not in WCSAxes, from the API's point of view.\n\n\nclass WCSAxesSubplot(subplot_class_factory(WCSAxes)):\n    \"\"\"\n    A subclass class for WCSAxes\n    \"\"\"\n    pass\n"},{"col":4,"comment":"null","endLoc":477,"header":"@property\n    def spacing(self)","id":16316,"name":"spacing","nodeType":"Function","startLoc":475,"text":"@property\n    def spacing(self):\n        return self._spacing"},{"col":4,"comment":"null","endLoc":485,"header":"@spacing.setter\n    def spacing(self, spacing)","id":16317,"name":"spacing","nodeType":"Function","startLoc":479,"text":"@spacing.setter\n    def spacing(self, spacing):\n        if spacing is not None and not isinstance(spacing, u.Quantity):\n            raise TypeError(\"spacing should be an astropy.units.Quantity instance\")\n        self._number = None\n        self._spacing = spacing\n        self._values = None"},{"col":4,"comment":"null","endLoc":131,"header":"def __init__(self, parent_axes=None, parent_map=None, transform=None,\n                 coord_index=None, coord_type='scalar', coord_unit=None,\n                 coord_wrap=None, frame=None, format_unit=None, default_label=None)","id":16318,"name":"__init__","nodeType":"Function","startLoc":82,"text":"def __init__(self, parent_axes=None, parent_map=None, transform=None,\n                 coord_index=None, coord_type='scalar', coord_unit=None,\n                 coord_wrap=None, frame=None, format_unit=None, default_label=None):\n\n        # Keep a reference to the parent axes and the transform\n        self.parent_axes = parent_axes\n        self.parent_map = parent_map\n        self.transform = transform\n        self.coord_index = coord_index\n        self.coord_unit = coord_unit\n        self._format_unit = format_unit\n        self.frame = frame\n        self.default_label = default_label or ''\n        self._auto_axislabel = True\n        # Disable auto label for elliptical frames as it puts labels in\n        # annoying places.\n        if issubclass(self.parent_axes.frame_class, EllipticalFrame):\n            self._auto_axislabel = False\n\n        self.set_coord_type(coord_type, coord_wrap)\n\n        # Initialize ticks\n        self.dpi_transform = Affine2D()\n        self.offset_transform = ScaledTranslation(0, 0, self.dpi_transform)\n        self.ticks = Ticks(transform=parent_axes.transData + self.offset_transform)\n\n        # Initialize tick labels\n        self.ticklabels = TickLabels(self.frame,\n                                     transform=None,  # display coordinates\n                                     figure=parent_axes.get_figure())\n        self.ticks.display_minor_ticks(rcParams['xtick.minor.visible'])\n        self.minor_frequency = 5\n\n        # Initialize axis labels\n        self.axislabels = AxisLabels(self.frame,\n                                     transform=None,  # display coordinates\n                                     figure=parent_axes.get_figure())\n\n        # Initialize container for the grid lines\n        self.grid_lines = []\n\n        # Initialize grid style. Take defaults from matplotlib.rcParams.\n        # Based on matplotlib.axis.YTick._get_gridline.\n        self.grid_lines_kwargs = {'visible': False,\n                                  'facecolor': 'none',\n                                  'edgecolor': rcParams['grid.color'],\n                                  'linestyle': LINES_TO_PATCHES_LINESTYLE[rcParams['grid.linestyle']],\n                                  'linewidth': rcParams['grid.linewidth'],\n                                  'alpha': rcParams['grid.alpha'],\n                                  'transform': self.parent_axes.transData}"},{"col":4,"comment":"null","endLoc":489,"header":"@property\n    def format(self)","id":16319,"name":"format","nodeType":"Function","startLoc":487,"text":"@property\n    def format(self):\n        return self._format"},{"col":4,"comment":"null","endLoc":519,"header":"@format.setter\n    def format(self, value)","id":16320,"name":"format","nodeType":"Function","startLoc":491,"text":"@format.setter\n    def format(self, value):\n\n        self._format = value\n\n        if value is None:\n            return\n\n        if SCAL_RE.match(value) is not None:\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n            else:\n                self._precision = 0\n\n            if self.spacing is not None and self.spacing < self.base_spacing:\n                warnings.warn(\"Spacing is too small - resetting spacing to match format\")\n                self.spacing = self.base_spacing\n\n            if self.spacing is not None:\n\n                ratio = (self.spacing / self.base_spacing).decompose().value\n                remainder = ratio - np.round(ratio)\n\n                if abs(remainder) > 1.e-10:\n                    warnings.warn(\"Spacing is not a multiple of base spacing - resetting spacing to match format\")\n                    self.spacing = self.base_spacing * max(1, round(ratio))\n\n        elif not value.startswith('%'):\n            raise ValueError(f\"Invalid format: {value}\")"},{"col":4,"comment":"null","endLoc":174,"header":"@property\n    def decimal(self)","id":16321,"name":"decimal","nodeType":"Function","startLoc":164,"text":"@property\n    def decimal(self):\n        decimal = self._decimal\n        if self.format_unit not in (u.degree, u.hourangle, u.hour):\n            if self._decimal is None:\n                decimal = True\n            elif self._decimal is False:\n                raise UnitsError(\"Units should be degrees or hours when using non-decimal (sexagesimal) mode\")\n        elif self._decimal is None:\n            decimal = False\n        return decimal"},{"className":"TickLabels","col":0,"comment":"null","endLoc":275,"id":16322,"nodeType":"Class","startLoc":16,"text":"class TickLabels(Text):\n\n    def __init__(self, frame, *args, **kwargs):\n        self.clear()\n        self._frame = frame\n        super().__init__(*args, **kwargs)\n        self.set_clip_on(True)\n        self.set_visible_axes('all')\n        self.set_pad(rcParams['xtick.major.pad'])\n        self._exclude_overlapping = False\n\n        # Stale if either xy positions haven't been calculated, or if\n        # something changes that requires recomputing the positions\n        self._stale = True\n\n        # Check rcParams\n\n        if 'color' not in kwargs:\n            self.set_color(rcParams['xtick.color'])\n\n        if 'size' not in kwargs:\n            self.set_size(rcParams['xtick.labelsize'])\n\n    def clear(self):\n        self.world = {}\n        self.pixel = {}\n        self.angle = {}\n        self.text = {}\n        self.disp = {}\n\n    def add(self, axis, world, pixel, angle, text, axis_displacement):\n        if axis not in self.world:\n            self.world[axis] = [world]\n            self.pixel[axis] = [pixel]\n            self.angle[axis] = [angle]\n            self.text[axis] = [text]\n            self.disp[axis] = [axis_displacement]\n        else:\n            self.world[axis].append(world)\n            self.pixel[axis].append(pixel)\n            self.angle[axis].append(angle)\n            self.text[axis].append(text)\n            self.disp[axis].append(axis_displacement)\n        self._stale = True\n\n    def sort(self):\n        \"\"\"\n        Sort by axis displacement, which allows us to figure out which parts\n        of labels to not repeat.\n        \"\"\"\n        for axis in self.world:\n            self.world[axis] = sort_using(self.world[axis], self.disp[axis])\n            self.pixel[axis] = sort_using(self.pixel[axis], self.disp[axis])\n            self.angle[axis] = sort_using(self.angle[axis], self.disp[axis])\n            self.text[axis] = sort_using(self.text[axis], self.disp[axis])\n            self.disp[axis] = sort_using(self.disp[axis], self.disp[axis])\n        self._stale = True\n\n    def simplify_labels(self):\n        \"\"\"\n        Figure out which parts of labels can be dropped to avoid repetition.\n        \"\"\"\n        self.sort()\n        for axis in self.world:\n            t1 = self.text[axis][0]\n            for i in range(1, len(self.world[axis])):\n                t2 = self.text[axis][i]\n                if len(t1) != len(t2):\n                    t1 = self.text[axis][i]\n                    continue\n                start = 0\n                # In the following loop, we need to ignore the last character,\n                # hence the len(t1) - 1. This is because if we have two strings\n                # like 13d14m15s we want to make sure that we keep the last\n                # part (15s) even if the two labels are identical.\n                for j in range(len(t1) - 1):\n                    if t1[j] != t2[j]:\n                        break\n                    if t1[j] not in '-0123456789.':\n                        start = j + 1\n                t1 = self.text[axis][i]\n                if start != 0:\n                    starts_dollar = self.text[axis][i].startswith('$')\n                    self.text[axis][i] = self.text[axis][i][start:]\n                    if starts_dollar:\n                        self.text[axis][i] = '$' + self.text[axis][i]\n                # Remove any empty LaTeX inline math mode string\n                if self.text[axis][i] == '$$':\n                    self.text[axis][i] = ''\n\n        self._stale = True\n\n    def set_pad(self, value):\n        self._pad = value\n        self._stale = True\n\n    def get_pad(self):\n        return self._pad\n\n    def set_visible_axes(self, visible_axes):\n        self._visible_axes = visible_axes\n        self._stale = True\n\n    def get_visible_axes(self):\n        if self._visible_axes == 'all':\n            return self.world.keys()\n        else:\n            return [x for x in self._visible_axes if x in self.world]\n\n    def set_exclude_overlapping(self, exclude_overlapping):\n        self._exclude_overlapping = exclude_overlapping\n\n    def _set_xy_alignments(self, renderer, tick_out_size):\n        \"\"\"\n        Compute and set the x, y positions and the horizontal/vertical alignment of\n        each label.\n        \"\"\"\n        if not self._stale:\n            return\n\n        self.simplify_labels()\n        text_size = renderer.points_to_pixels(self.get_size())\n\n        visible_axes = self.get_visible_axes()\n        self.xy = {axis: {} for axis in visible_axes}\n        self.ha = {axis: {} for axis in visible_axes}\n        self.va = {axis: {} for axis in visible_axes}\n\n        for axis in visible_axes:\n            for i in range(len(self.world[axis])):\n                # In the event that the label is empty (which is not expected\n                # but could happen in unforeseen corner cases), we should just\n                # skip to the next label.\n                if self.text[axis][i] == '':\n                    continue\n\n                x, y = self.pixel[axis][i]\n                pad = renderer.points_to_pixels(self.get_pad() + tick_out_size)\n\n                if isinstance(self._frame, RectangularFrame):\n                    # This is just to preserve the current results, but can be\n                    # removed next time the reference images are re-generated.\n                    if np.abs(self.angle[axis][i]) < 45.:\n                        ha = 'right'\n                        va = 'bottom'\n                        dx = -pad\n                        dy = -text_size * 0.5\n                    elif np.abs(self.angle[axis][i] - 90.) < 45:\n                        ha = 'center'\n                        va = 'bottom'\n                        dx = 0\n                        dy = -text_size - pad\n                    elif np.abs(self.angle[axis][i] - 180.) < 45:\n                        ha = 'left'\n                        va = 'bottom'\n                        dx = pad\n                        dy = -text_size * 0.5\n                    else:\n                        ha = 'center'\n                        va = 'bottom'\n                        dx = 0\n                        dy = pad\n\n                    x = x + dx\n                    y = y + dy\n\n                else:\n                    # This is the more general code for arbitrarily oriented\n                    # axes\n\n                    # Set initial position and find bounding box\n                    self.set_text(self.text[axis][i])\n                    self.set_position((x, y))\n                    bb = super().get_window_extent(renderer)\n\n                    # Find width and height, as well as angle at which we\n                    # transition which side of the label we use to anchor the\n                    # label.\n                    width = bb.width\n                    height = bb.height\n\n                    # Project axis angle onto bounding box\n                    ax = np.cos(np.radians(self.angle[axis][i]))\n                    ay = np.sin(np.radians(self.angle[axis][i]))\n\n                    # Set anchor point for label\n                    if np.abs(self.angle[axis][i]) < 45.:\n                        dx = width\n                        dy = ay * height\n                    elif np.abs(self.angle[axis][i] - 90.) < 45:\n                        dx = ax * width\n                        dy = height\n                    elif np.abs(self.angle[axis][i] - 180.) < 45:\n                        dx = -width\n                        dy = ay * height\n                    else:\n                        dx = ax * width\n                        dy = -height\n\n                    dx *= 0.5\n                    dy *= 0.5\n\n                    # Find normalized vector along axis normal, so as to be\n                    # able to nudge the label away by a constant padding factor\n\n                    dist = np.hypot(dx, dy)\n\n                    ddx = dx / dist\n                    ddy = dy / dist\n\n                    dx += ddx * pad\n                    dy += ddy * pad\n\n                    x = x - dx\n                    y = y - dy\n\n                    ha = 'center'\n                    va = 'center'\n\n                self.xy[axis][i] = (x, y)\n                self.ha[axis][i] = ha\n                self.va[axis][i] = va\n\n        self._stale = False\n\n    def _get_bb(self, axis, i, renderer):\n        \"\"\"\n        Get the bounding box of an individual label. n.b. _set_xy_alignment()\n        must be called before this method.\n        \"\"\"\n        if self.text[axis][i] == '':\n            return\n\n        self.set_text(self.text[axis][i])\n        self.set_position(self.xy[axis][i])\n        self.set_ha(self.ha[axis][i])\n        self.set_va(self.va[axis][i])\n        return super().get_window_extent(renderer)\n\n    def draw(self, renderer, bboxes, ticklabels_bbox, tick_out_size):\n        if not self.get_visible():\n            return\n\n        self._set_xy_alignments(renderer, tick_out_size)\n\n        for axis in self.get_visible_axes():\n            for i in range(len(self.world[axis])):\n                # This implicitly sets the label text, position, alignment\n                bb = self._get_bb(axis, i, renderer)\n                if bb is None:\n                    continue\n\n                # TODO: the problem here is that we might get rid of a label\n                # that has a key starting bit such as -0:30 where the -0\n                # might be dropped from all other labels.\n\n                if not self._exclude_overlapping or bb.count_overlaps(bboxes) == 0:\n                    super().draw(renderer)\n                    bboxes.append(bb)\n                    ticklabels_bbox[axis].append(bb)"},{"col":4,"comment":"null","endLoc":178,"header":"@decimal.setter\n    def decimal(self, value)","id":16323,"name":"decimal","nodeType":"Function","startLoc":176,"text":"@decimal.setter\n    def decimal(self, value):\n        self._decimal = value"},{"col":4,"comment":"null","endLoc":182,"header":"@property\n    def spacing(self)","id":16324,"name":"spacing","nodeType":"Function","startLoc":180,"text":"@property\n    def spacing(self):\n        return self._spacing"},{"col":4,"comment":"null","endLoc":192,"header":"@spacing.setter\n    def spacing(self, spacing)","id":16325,"name":"spacing","nodeType":"Function","startLoc":184,"text":"@spacing.setter\n    def spacing(self, spacing):\n        if spacing is not None and (not isinstance(spacing, u.Quantity) or\n                                    spacing.unit.physical_type != 'angle'):\n            raise TypeError(\"spacing should be an astropy.units.Quantity \"\n                            \"instance with units of angle\")\n        self._number = None\n        self._spacing = spacing\n        self._values = None"},{"col":4,"comment":"\n        Return the inverse of the transform\n        ","endLoc":313,"header":"def inverted(self)","id":16326,"name":"inverted","nodeType":"Function","startLoc":309,"text":"def inverted(self):\n        \"\"\"\n        Return the inverse of the transform\n        \"\"\"\n        return WCSPixel2WorldTransform(self.wcs, invert_xy=self.invert_xy)"},{"col":4,"comment":"null","endLoc":196,"header":"@property\n    def sep(self)","id":16327,"name":"sep","nodeType":"Function","startLoc":194,"text":"@property\n    def sep(self):\n        return self._sep"},{"col":4,"comment":"null","endLoc":200,"header":"@sep.setter\n    def sep(self, separator)","id":16328,"name":"sep","nodeType":"Function","startLoc":198,"text":"@sep.setter\n    def sep(self, separator):\n        self._sep = separator"},{"col":4,"comment":"null","endLoc":204,"header":"@property\n    def format(self)","id":16329,"name":"format","nodeType":"Function","startLoc":202,"text":"@property\n    def format(self):\n        return self._format"},{"col":4,"comment":"null","endLoc":270,"header":"@format.setter\n    def format(self, value)","id":16330,"name":"format","nodeType":"Function","startLoc":206,"text":"@format.setter\n    def format(self, value):\n\n        self._format = value\n\n        if value is None:\n            return\n\n        if DMS_RE.match(value) is not None:\n            self._decimal = False\n            self._format_unit = u.degree\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n                self._fields = 3\n            else:\n                self._precision = 0\n                self._fields = value.count(':') + 1\n        elif HMS_RE.match(value) is not None:\n            self._decimal = False\n            self._format_unit = u.hourangle\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n                self._fields = 3\n            else:\n                self._precision = 0\n                self._fields = value.count(':') + 1\n        elif DDEC_RE.match(value) is not None:\n            self._decimal = True\n            self._format_unit = u.degree\n            self._fields = 1\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n            else:\n                self._precision = 0\n        elif DMIN_RE.match(value) is not None:\n            self._decimal = True\n            self._format_unit = u.arcmin\n            self._fields = 1\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n            else:\n                self._precision = 0\n        elif DSEC_RE.match(value) is not None:\n            self._decimal = True\n            self._format_unit = u.arcsec\n            self._fields = 1\n            if '.' in value:\n                self._precision = len(value) - value.index('.') - 1\n            else:\n                self._precision = 0\n        else:\n            raise ValueError(f\"Invalid format: {value}\")\n\n        if self.spacing is not None and self.spacing < self.base_spacing:\n            warnings.warn(\"Spacing is too small - resetting spacing to match format\")\n            self.spacing = self.base_spacing\n\n        if self.spacing is not None:\n\n            ratio = (self.spacing / self.base_spacing).decompose().value\n            remainder = ratio - np.round(ratio)\n\n            if abs(remainder) > 1.e-10:\n                warnings.warn(\"Spacing is not a multiple of base spacing - resetting spacing to match format\")\n                self.spacing = self.base_spacing * max(1, round(ratio))"},{"col":4,"comment":"null","endLoc":37,"header":"def __init__(self, frame, *args, **kwargs)","id":16331,"name":"__init__","nodeType":"Function","startLoc":18,"text":"def __init__(self, frame, *args, **kwargs):\n        self.clear()\n        self._frame = frame\n        super().__init__(*args, **kwargs)\n        self.set_clip_on(True)\n        self.set_visible_axes('all')\n        self.set_pad(rcParams['xtick.major.pad'])\n        self._exclude_overlapping = False\n\n        # Stale if either xy positions haven't been calculated, or if\n        # something changes that requires recomputing the positions\n        self._stale = True\n\n        # Check rcParams\n\n        if 'color' not in kwargs:\n            self.set_color(rcParams['xtick.color'])\n\n        if 'size' not in kwargs:\n            self.set_size(rcParams['xtick.labelsize'])"},{"className":"CoordinateTransform","col":0,"comment":"null","endLoc":134,"id":16332,"nodeType":"Class","startLoc":59,"text":"class CoordinateTransform(CurvedTransform):\n\n    has_inverse = True\n\n    def __init__(self, input_system, output_system):\n        super().__init__()\n        self._input_system_name = input_system\n        self._output_system_name = output_system\n\n        if isinstance(self._input_system_name, str):\n            frame_cls = frame_transform_graph.lookup_name(self._input_system_name)\n            if frame_cls is None:\n                raise ValueError(f\"Frame {self._input_system_name} not found\")\n            else:\n                self.input_system = frame_cls()\n        elif isinstance(self._input_system_name, BaseCoordinateFrame):\n            self.input_system = self._input_system_name\n        else:\n            raise TypeError(\"input_system should be a WCS instance, string, or a coordinate frame instance\")\n\n        if isinstance(self._output_system_name, str):\n            frame_cls = frame_transform_graph.lookup_name(self._output_system_name)\n            if frame_cls is None:\n                raise ValueError(f\"Frame {self._output_system_name} not found\")\n            else:\n                self.output_system = frame_cls()\n\n        elif isinstance(self._output_system_name, BaseCoordinateFrame):\n            self.output_system = self._output_system_name\n        else:\n            raise TypeError(\"output_system should be a WCS instance, string, or a coordinate frame instance\")\n\n        if self.output_system == self.input_system:\n            self.same_frames = True\n        else:\n            self.same_frames = False\n\n    @property\n    def same_frames(self):\n        return self._same_frames\n\n    @same_frames.setter\n    def same_frames(self, same_frames):\n        self._same_frames = same_frames\n\n    def transform(self, input_coords):\n        \"\"\"\n        Transform one set of coordinates to another\n        \"\"\"\n        if self.same_frames:\n            return input_coords\n\n        input_coords = input_coords*u.deg\n        x_in, y_in = input_coords[:, 0], input_coords[:, 1]\n\n        c_in = SkyCoord(UnitSphericalRepresentation(x_in, y_in),\n                        frame=self.input_system)\n\n        # We often need to transform arrays that contain NaN values, and filtering\n        # out the NaN values would have a performance hit, so instead we just pass\n        # on all values and just ignore Numpy warnings\n        with np.errstate(all='ignore'):\n            c_out = c_in.transform_to(self.output_system)\n\n        lon = c_out.spherical.lon.deg\n        lat = c_out.spherical.lat.deg\n\n        return np.concatenate((lon[:, np.newaxis], lat[:, np.newaxis]), axis=1)\n\n    transform_non_affine = transform\n\n    def inverted(self):\n        \"\"\"\n        Return the inverse of the transform\n        \"\"\"\n        return CoordinateTransform(self._output_system_name, self._input_system_name)"},{"col":4,"comment":"null","endLoc":94,"header":"def __init__(self, input_system, output_system)","id":16333,"name":"__init__","nodeType":"Function","startLoc":63,"text":"def __init__(self, input_system, output_system):\n        super().__init__()\n        self._input_system_name = input_system\n        self._output_system_name = output_system\n\n        if isinstance(self._input_system_name, str):\n            frame_cls = frame_transform_graph.lookup_name(self._input_system_name)\n            if frame_cls is None:\n                raise ValueError(f\"Frame {self._input_system_name} not found\")\n            else:\n                self.input_system = frame_cls()\n        elif isinstance(self._input_system_name, BaseCoordinateFrame):\n            self.input_system = self._input_system_name\n        else:\n            raise TypeError(\"input_system should be a WCS instance, string, or a coordinate frame instance\")\n\n        if isinstance(self._output_system_name, str):\n            frame_cls = frame_transform_graph.lookup_name(self._output_system_name)\n            if frame_cls is None:\n                raise ValueError(f\"Frame {self._output_system_name} not found\")\n            else:\n                self.output_system = frame_cls()\n\n        elif isinstance(self._output_system_name, BaseCoordinateFrame):\n            self.output_system = self._output_system_name\n        else:\n            raise TypeError(\"output_system should be a WCS instance, string, or a coordinate frame instance\")\n\n        if self.output_system == self.input_system:\n            self.same_frames = True\n        else:\n            self.same_frames = False"},{"col":4,"comment":"null","endLoc":44,"header":"def clear(self)","id":16334,"name":"clear","nodeType":"Function","startLoc":39,"text":"def clear(self):\n        self.world = {}\n        self.pixel = {}\n        self.angle = {}\n        self.text = {}\n        self.disp = {}"},{"col":4,"comment":"null","endLoc":117,"header":"def set_visible_axes(self, visible_axes)","id":16335,"name":"set_visible_axes","nodeType":"Function","startLoc":115,"text":"def set_visible_axes(self, visible_axes):\n        self._visible_axes = visible_axes\n        self._stale = True"},{"col":4,"comment":"null","endLoc":110,"header":"def set_pad(self, value)","id":16336,"name":"set_pad","nodeType":"Function","startLoc":108,"text":"def set_pad(self, value):\n        self._pad = value\n        self._stale = True"},{"col":4,"comment":"null","endLoc":98,"header":"@property\n    def same_frames(self)","id":16337,"name":"same_frames","nodeType":"Function","startLoc":96,"text":"@property\n    def same_frames(self):\n        return self._same_frames"},{"col":4,"comment":"null","endLoc":102,"header":"@same_frames.setter\n    def same_frames(self, same_frames)","id":16338,"name":"same_frames","nodeType":"Function","startLoc":100,"text":"@same_frames.setter\n    def same_frames(self, same_frames):\n        self._same_frames = same_frames"},{"col":4,"comment":"\n        Transform one set of coordinates to another\n        ","endLoc":126,"header":"def transform(self, input_coords)","id":16339,"name":"transform","nodeType":"Function","startLoc":104,"text":"def transform(self, input_coords):\n        \"\"\"\n        Transform one set of coordinates to another\n        \"\"\"\n        if self.same_frames:\n            return input_coords\n\n        input_coords = input_coords*u.deg\n        x_in, y_in = input_coords[:, 0], input_coords[:, 1]\n\n        c_in = SkyCoord(UnitSphericalRepresentation(x_in, y_in),\n                        frame=self.input_system)\n\n        # We often need to transform arrays that contain NaN values, and filtering\n        # out the NaN values would have a performance hit, so instead we just pass\n        # on all values and just ignore Numpy warnings\n        with np.errstate(all='ignore'):\n            c_out = c_in.transform_to(self.output_system)\n\n        lon = c_out.spherical.lon.deg\n        lat = c_out.spherical.lat.deg\n\n        return np.concatenate((lon[:, np.newaxis], lat[:, np.newaxis]), axis=1)"},{"col":4,"comment":"null","endLoc":59,"header":"def add(self, axis, world, pixel, angle, text, axis_displacement)","id":16340,"name":"add","nodeType":"Function","startLoc":46,"text":"def add(self, axis, world, pixel, angle, text, axis_displacement):\n        if axis not in self.world:\n            self.world[axis] = [world]\n            self.pixel[axis] = [pixel]\n            self.angle[axis] = [angle]\n            self.text[axis] = [text]\n            self.disp[axis] = [axis_displacement]\n        else:\n            self.world[axis].append(world)\n            self.pixel[axis].append(pixel)\n            self.angle[axis].append(angle)\n            self.text[axis].append(text)\n            self.disp[axis].append(axis_displacement)\n        self._stale = True"},{"col":4,"comment":"null","endLoc":333,"header":"def __init__(self, wcs, invert_xy=False)","id":16341,"name":"__init__","nodeType":"Function","startLoc":323,"text":"def __init__(self, wcs, invert_xy=False):\n\n        super().__init__()\n\n        if wcs.pixel_n_dim > 2:\n            raise ValueError('Only pixel_n_dim =< 2 is supported')\n\n        self.wcs = wcs\n        self.invert_xy = invert_xy\n\n        self.frame_out = wcsapi_to_celestial_frame(wcs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":264,"id":16342,"name":"has_inverse","nodeType":"Attribute","startLoc":264,"text":"has_inverse"},{"attributeType":"None","col":4,"comment":"null","endLoc":265,"id":16343,"name":"frame_in","nodeType":"Attribute","startLoc":265,"text":"frame_in"},{"col":4,"comment":"null","endLoc":294,"header":"@property\n    def base_spacing(self)","id":16344,"name":"base_spacing","nodeType":"Function","startLoc":272,"text":"@property\n    def base_spacing(self):\n\n        if self.decimal:\n\n            spacing = self._format_unit / (10. ** self._precision)\n\n        else:\n\n            if self._fields == 1:\n                spacing = 1. * u.degree\n            elif self._fields == 2:\n                spacing = 1. * u.arcmin\n            elif self._fields == 3:\n                if self._precision == 0:\n                    spacing = 1. * u.arcsec\n                else:\n                    spacing = u.arcsec / (10. ** self._precision)\n\n        if self._format_unit is u.hourangle:\n            spacing *= 15\n\n        return spacing"},{"col":4,"comment":"null","endLoc":345,"header":"def locator(self, value_min, value_max)","id":16345,"name":"locator","nodeType":"Function","startLoc":296,"text":"def locator(self, value_min, value_max):\n\n        if self.values is not None:\n\n            # values were manually specified\n            return self.values, 1.1 * u.arcsec\n\n        else:\n\n            # In the special case where value_min is the same as value_max, we\n            # don't locate any ticks. This can occur for example when taking a\n            # slice for a cube (along the dimension sliced). We return a\n            # non-zero spacing in case the caller needs to format a single\n            # coordinate, e.g. for mousover.\n            if value_min == value_max:\n                return [] * self._unit, 1 * u.arcsec\n\n            if self.spacing is not None:\n\n                # spacing was manually specified\n                spacing_value = self.spacing.to_value(self._unit)\n\n            elif self.number is not None:\n\n                # number of ticks was specified, work out optimal spacing\n\n                # first compute the exact spacing\n                dv = abs(float(value_max - value_min)) / self.number * self._unit\n\n                if self.format is not None and dv < self.base_spacing:\n                    # if the spacing is less than the minimum spacing allowed by the format, simply\n                    # use the format precision instead.\n                    spacing_value = self.base_spacing.to_value(self._unit)\n                else:\n                    # otherwise we clip to the nearest 'sensible' spacing\n                    if self.decimal:\n                        from .utils import select_step_scalar\n                        spacing_value = select_step_scalar(dv.to_value(self._format_unit)) * self._format_unit.to(self._unit)\n                    else:\n                        if self._format_unit is u.degree:\n                            from .utils import select_step_degree\n                            spacing_value = select_step_degree(dv).to_value(self._unit)\n                        else:\n                            from .utils import select_step_hour\n                            spacing_value = select_step_hour(dv).to_value(self._unit)\n\n            # We now find the interval values as multiples of the spacing and\n            # generate the tick positions from this.\n            values = self._locate_values(value_min, value_max, spacing_value)\n            return values * spacing_value * self._unit, spacing_value * self._unit"},{"col":4,"comment":"\n        Set the coordinate type for the axis.\n\n        Parameters\n        ----------\n        coord_type : str\n            One of 'longitude', 'latitude' or 'scalar'\n        coord_wrap : float, optional\n            The value to wrap at for angular coordinates\n        ","endLoc":212,"header":"def set_coord_type(self, coord_type, coord_wrap=None)","id":16346,"name":"set_coord_type","nodeType":"Function","startLoc":178,"text":"def set_coord_type(self, coord_type, coord_wrap=None):\n        \"\"\"\n        Set the coordinate type for the axis.\n\n        Parameters\n        ----------\n        coord_type : str\n            One of 'longitude', 'latitude' or 'scalar'\n        coord_wrap : float, optional\n            The value to wrap at for angular coordinates\n        \"\"\"\n\n        self.coord_type = coord_type\n\n        if coord_type == 'longitude' and coord_wrap is None:\n            self.coord_wrap = 360\n        elif coord_type != 'longitude' and coord_wrap is not None:\n            raise NotImplementedError('coord_wrap is not yet supported '\n                                      'for non-longitude coordinates')\n        else:\n            self.coord_wrap = coord_wrap\n\n        # Initialize tick formatter/locator\n        if coord_type == 'scalar':\n            self._coord_scale_to_deg = None\n            self._formatter_locator = ScalarFormatterLocator(unit=self.coord_unit)\n        elif coord_type in ['longitude', 'latitude']:\n            if self.coord_unit is u.deg:\n                self._coord_scale_to_deg = None\n            else:\n                self._coord_scale_to_deg = self.coord_unit.to(u.deg)\n            self._formatter_locator = AngleFormatterLocator(unit=self.coord_unit,\n                                                            format_unit=self._format_unit)\n        else:\n            raise ValueError(\"coord_type should be one of 'scalar', 'longitude', or 'latitude'\")"},{"attributeType":"function","col":4,"comment":"null","endLoc":307,"id":16347,"name":"transform_non_affine","nodeType":"Attribute","startLoc":307,"text":"transform_non_affine"},{"attributeType":"null","col":8,"comment":"null","endLoc":275,"id":16348,"name":"invert_xy","nodeType":"Attribute","startLoc":275,"text":"self.invert_xy"},{"attributeType":"BaseCoordinateFrame","col":8,"comment":"null","endLoc":277,"id":16349,"name":"frame_in","nodeType":"Attribute","startLoc":277,"text":"self.frame_in"},{"col":4,"comment":"\n        Return the inverse of the transform\n        ","endLoc":134,"header":"def inverted(self)","id":16350,"name":"inverted","nodeType":"Function","startLoc":130,"text":"def inverted(self):\n        \"\"\"\n        Return the inverse of the transform\n        \"\"\"\n        return CoordinateTransform(self._output_system_name, self._input_system_name)"},{"attributeType":"{pixel_n_dim, world_axis_object_classes}","col":8,"comment":"null","endLoc":274,"id":16351,"name":"wcs","nodeType":"Attribute","startLoc":274,"text":"self.wcs"},{"className":"WCSPixel2WorldTransform","col":0,"comment":"\n    WCS transformation from pixel to world coordinates\n    ","endLoc":372,"id":16352,"nodeType":"Class","startLoc":316,"text":"class WCSPixel2WorldTransform(CurvedTransform):\n    \"\"\"\n    WCS transformation from pixel to world coordinates\n    \"\"\"\n\n    has_inverse = True\n\n    def __init__(self, wcs, invert_xy=False):\n\n        super().__init__()\n\n        if wcs.pixel_n_dim > 2:\n            raise ValueError('Only pixel_n_dim =< 2 is supported')\n\n        self.wcs = wcs\n        self.invert_xy = invert_xy\n\n        self.frame_out = wcsapi_to_celestial_frame(wcs)\n\n    def __eq__(self, other):\n        return (isinstance(other, type(self)) and self.wcs is other.wcs and\n                self.invert_xy == other.invert_xy)\n\n    @property\n    def output_dims(self):\n        return self.wcs.world_n_dim\n\n    def transform(self, pixel):\n\n        # Convert to a list of arrays\n        pixel = list(pixel.T)\n\n        if len(pixel) != self.wcs.pixel_n_dim:\n            raise ValueError(f\"Expected {self.wcs.pixel_n_dim} world coordinates, got {len(pixel)} \")\n\n        if self.invert_xy:\n            pixel = pixel[::-1]\n\n        if len(pixel[0]) == 0:\n            world = np.zeros((0, self.wcs.world_n_dim))\n        else:\n            world = self.wcs.pixel_to_world_values(*pixel)\n\n        if self.wcs.world_n_dim == 1:\n            world = [world]\n\n        world = np.array(world).T\n\n        return world\n\n    transform_non_affine = transform\n\n    def inverted(self):\n        \"\"\"\n        Return the inverse of the transform\n        \"\"\"\n        return WCSWorld2PixelTransform(self.wcs, invert_xy=self.invert_xy)"},{"col":4,"comment":"null","endLoc":337,"header":"def __eq__(self, other)","id":16353,"name":"__eq__","nodeType":"Function","startLoc":335,"text":"def __eq__(self, other):\n        return (isinstance(other, type(self)) and self.wcs is other.wcs and\n                self.invert_xy == other.invert_xy)"},{"col":4,"comment":"null","endLoc":523,"header":"@property\n    def base_spacing(self)","id":16354,"name":"base_spacing","nodeType":"Function","startLoc":521,"text":"@property\n    def base_spacing(self):\n        return self._format_unit / (10. ** self._precision)"},{"col":4,"comment":"null","endLoc":563,"header":"def locator(self, value_min, value_max)","id":16355,"name":"locator","nodeType":"Function","startLoc":525,"text":"def locator(self, value_min, value_max):\n\n        if self.values is not None:\n\n            # values were manually specified\n            return self.values, 1.1 * self._unit\n        else:\n\n            # In the special case where value_min is the same as value_max, we\n            # don't locate any ticks. This can occur for example when taking a\n            # slice for a cube (along the dimension sliced).\n            if value_min == value_max:\n                return [] * self._unit, 0 * self._unit\n\n            if self.spacing is not None:\n\n                # spacing was manually specified\n                spacing = self.spacing.to_value(self._unit)\n\n            elif self.number is not None:\n\n                # number of ticks was specified, work out optimal spacing\n\n                # first compute the exact spacing\n                dv = abs(float(value_max - value_min)) / self.number * self._unit\n\n                if self.format is not None and (not self.format.startswith('%')) and dv < self.base_spacing:\n                    # if the spacing is less than the minimum spacing allowed by the format, simply\n                    # use the format precision instead.\n                    spacing = self.base_spacing.to_value(self._unit)\n                else:\n                    from .utils import select_step_scalar\n                    spacing = select_step_scalar(dv.to_value(self._format_unit)) * self._format_unit.to(self._unit)\n\n            # We now find the interval values as multiples of the spacing and\n            # generate the tick positions from this\n\n            values = self._locate_values(value_min, value_max, spacing)\n            return values * spacing * self._unit, spacing * self._unit"},{"col":4,"comment":"null","endLoc":341,"header":"@property\n    def output_dims(self)","id":16356,"name":"output_dims","nodeType":"Function","startLoc":339,"text":"@property\n    def output_dims(self):\n        return self.wcs.world_n_dim"},{"col":4,"comment":"null","endLoc":364,"header":"def transform(self, pixel)","id":16357,"name":"transform","nodeType":"Function","startLoc":343,"text":"def transform(self, pixel):\n\n        # Convert to a list of arrays\n        pixel = list(pixel.T)\n\n        if len(pixel) != self.wcs.pixel_n_dim:\n            raise ValueError(f\"Expected {self.wcs.pixel_n_dim} world coordinates, got {len(pixel)} \")\n\n        if self.invert_xy:\n            pixel = pixel[::-1]\n\n        if len(pixel[0]) == 0:\n            world = np.zeros((0, self.wcs.world_n_dim))\n        else:\n            world = self.wcs.pixel_to_world_values(*pixel)\n\n        if self.wcs.world_n_dim == 1:\n            world = [world]\n\n        world = np.array(world).T\n\n        return world"},{"attributeType":"null","col":4,"comment":"null","endLoc":61,"id":16358,"name":"has_inverse","nodeType":"Attribute","startLoc":61,"text":"has_inverse"},{"attributeType":"function","col":4,"comment":"null","endLoc":128,"id":16359,"name":"transform_non_affine","nodeType":"Attribute","startLoc":128,"text":"transform_non_affine"},{"col":4,"comment":"\n        Return the inverse of the transform\n        ","endLoc":372,"header":"def inverted(self)","id":16360,"name":"inverted","nodeType":"Function","startLoc":368,"text":"def inverted(self):\n        \"\"\"\n        Return the inverse of the transform\n        \"\"\"\n        return WCSWorld2PixelTransform(self.wcs, invert_xy=self.invert_xy)"},{"attributeType":"null","col":12,"comment":"null","endLoc":87,"id":16361,"name":"output_system","nodeType":"Attribute","startLoc":87,"text":"self.output_system"},{"attributeType":"null","col":4,"comment":"null","endLoc":321,"id":16362,"name":"has_inverse","nodeType":"Attribute","startLoc":321,"text":"has_inverse"},{"attributeType":"function","col":4,"comment":"null","endLoc":366,"id":16363,"name":"transform_non_affine","nodeType":"Attribute","startLoc":366,"text":"transform_non_affine"},{"attributeType":"null","col":8,"comment":"null","endLoc":331,"id":16364,"name":"invert_xy","nodeType":"Attribute","startLoc":331,"text":"self.invert_xy"},{"attributeType":"{pixel_n_dim, world_axis_object_classes}","col":8,"comment":"null","endLoc":330,"id":16365,"name":"wcs","nodeType":"Attribute","startLoc":330,"text":"self.wcs"},{"attributeType":"BaseCoordinateFrame","col":8,"comment":"null","endLoc":333,"id":16366,"name":"frame_out","nodeType":"Attribute","startLoc":333,"text":"self.frame_out"},{"col":0,"comment":"null","endLoc":220,"header":"def transform_coord_meta_from_wcs(wcs, frame_class, slices=None)","id":16367,"name":"transform_coord_meta_from_wcs","nodeType":"Function","startLoc":24,"text":"def transform_coord_meta_from_wcs(wcs, frame_class, slices=None):\n\n    if slices is not None:\n        slices = tuple(slices)\n\n    if wcs.pixel_n_dim > 2:\n        if slices is None:\n            raise ValueError(\"WCS has more than 2 pixel dimensions, so \"\n                             \"'slices' should be set\")\n        elif len(slices) != wcs.pixel_n_dim:\n            raise ValueError(\"'slices' should have as many elements as WCS \"\n                             \"has pixel dimensions (should be {})\"\n                             .format(wcs.pixel_n_dim))\n\n    is_fits_wcs = isinstance(wcs, WCS) or (isinstance(wcs, SlicedLowLevelWCS) and isinstance(wcs._wcs, WCS))\n\n    coord_meta = {}\n    coord_meta['name'] = []\n    coord_meta['type'] = []\n    coord_meta['wrap'] = []\n    coord_meta['unit'] = []\n    coord_meta['visible'] = []\n    coord_meta['format_unit'] = []\n\n    for idx in range(wcs.world_n_dim):\n\n        axis_type = wcs.world_axis_physical_types[idx]\n        axis_unit = u.Unit(wcs.world_axis_units[idx])\n        coord_wrap = None\n        format_unit = axis_unit\n\n        coord_type = 'scalar'\n\n        if axis_type is not None:\n\n            axis_type_split = axis_type.split('.')\n\n            if \"pos.helioprojective.lon\" in axis_type:\n                coord_wrap = 180.\n                format_unit = u.arcsec\n                coord_type = \"longitude\"\n            elif \"pos.helioprojective.lat\" in axis_type:\n                format_unit = u.arcsec\n                coord_type = \"latitude\"\n            elif \"pos.heliographic.stonyhurst.lon\" in axis_type:\n                coord_wrap = 180.\n                format_unit = u.deg\n                coord_type = \"longitude\"\n            elif \"pos.heliographic.stonyhurst.lat\" in axis_type:\n                format_unit = u.deg\n                coord_type = \"latitude\"\n            elif \"pos.heliographic.carrington.lon\" in axis_type:\n                coord_wrap = 360.\n                format_unit = u.deg\n                coord_type = \"longitude\"\n            elif \"pos.heliographic.carrington.lat\" in axis_type:\n                format_unit = u.deg\n                coord_type = \"latitude\"\n            elif \"pos\" in axis_type_split:\n                if \"lon\" in axis_type_split:\n                    coord_type = \"longitude\"\n                elif \"lat\" in axis_type_split:\n                    coord_type = \"latitude\"\n                elif \"ra\" in axis_type_split:\n                    coord_type = \"longitude\"\n                    format_unit = u.hourangle\n                elif \"dec\" in axis_type_split:\n                    coord_type = \"latitude\"\n                elif \"alt\" in axis_type_split:\n                    coord_type = \"longitude\"\n                elif \"az\" in axis_type_split:\n                    coord_type = \"latitude\"\n                elif \"long\" in axis_type_split:\n                    coord_type = \"longitude\"\n\n        coord_meta['type'].append(coord_type)\n        coord_meta['wrap'].append(coord_wrap)\n        coord_meta['format_unit'].append(format_unit)\n        coord_meta['unit'].append(axis_unit)\n\n        # For FITS-WCS, for backward-compatibility, we need to make sure that we\n        # provide aliases based on CTYPE for the name.\n        if is_fits_wcs:\n            name = []\n            if isinstance(wcs, WCS):\n                name.append(wcs.wcs.ctype[idx].lower())\n                name.append(wcs.wcs.ctype[idx][:4].replace('-', '').lower())\n            elif isinstance(wcs, SlicedLowLevelWCS):\n                name.append(wcs._wcs.wcs.ctype[wcs._world_keep[idx]].lower())\n                name.append(wcs._wcs.wcs.ctype[wcs._world_keep[idx]][:4].replace('-', '').lower())\n            if name[0] == name[1]:\n                name = name[0:1]\n            if axis_type:\n                if axis_type not in name:\n                    name.insert(0, axis_type)\n            if wcs.world_axis_names and wcs.world_axis_names[idx]:\n                if wcs.world_axis_names[idx] not in name:\n                    name.append(wcs.world_axis_names[idx])\n            name = tuple(name) if len(name) > 1 else name[0]\n        else:\n            name = axis_type or ''\n            if wcs.world_axis_names:\n                name = (name, wcs.world_axis_names[idx]) if wcs.world_axis_names[idx] else name\n\n        coord_meta['name'].append(name)\n\n    coord_meta['default_axislabel_position'] = [''] * wcs.world_n_dim\n    coord_meta['default_ticklabel_position'] = [''] * wcs.world_n_dim\n    coord_meta['default_ticks_position'] = [''] * wcs.world_n_dim\n    # If the world axis has a name use it, else display the world axis physical type.\n    fallback_labels = [name[0] if isinstance(name, (list, tuple)) else name for name in coord_meta['name']]\n    coord_meta['default_axis_label'] = [wcs.world_axis_names[i] or fallback_label for i, fallback_label in enumerate(fallback_labels)]\n\n    transform_wcs, invert_xy, world_map = apply_slices(wcs, slices)\n\n    transform = WCSPixel2WorldTransform(transform_wcs, invert_xy=invert_xy)\n\n    for i in range(len(coord_meta['type'])):\n        coord_meta['visible'].append(i in world_map)\n\n    inv_all_corr = [False] * wcs.world_n_dim\n    m = transform_wcs.axis_correlation_matrix.copy()\n    if invert_xy:\n        inv_all_corr = np.all(m, axis=1)\n        m = m[:, ::-1]\n\n    if frame_class is RectangularFrame:\n\n        for i, spine_name in enumerate('bltr'):\n            pos = np.nonzero(m[:, i % 2])[0]\n            # If all the axes we have are correlated with each other and we\n            # have inverted the axes, then we need to reverse the index so we\n            # put the 'y' on the left.\n            if inv_all_corr[i % 2]:\n                pos = pos[::-1]\n\n            if len(pos) > 0:\n                index = world_map[pos[0]]\n                coord_meta['default_axislabel_position'][index] = spine_name\n                coord_meta['default_ticklabel_position'][index] = spine_name\n                coord_meta['default_ticks_position'][index] = spine_name\n                m[pos[0], :] = 0\n\n        # In the special and common case where the frame is rectangular and\n        # we are dealing with 2-d WCS (after slicing), we show all ticks on\n        # all axes for backward-compatibility.\n        if len(world_map) == 2:\n            for index in world_map:\n                coord_meta['default_ticks_position'][index] = 'bltr'\n\n    elif frame_class is RectangularFrame1D:\n        derivs = np.abs(local_partial_pixel_derivatives(transform_wcs, *[0]*transform_wcs.pixel_n_dim,\n                                                        normalize_by_world=False))[:, 0]\n        for i, spine_name in enumerate('bt'):\n            # Here we are iterating over the correlated axes in world axis order.\n            # We want to sort the correlated axes by their partial derivatives,\n            # so we put the most rapidly changing world axis on the bottom.\n            pos = np.nonzero(m[:, 0])[0]\n            order = np.argsort(derivs[pos])[::-1]  # Sort largest to smallest\n            pos = pos[order]\n            if len(pos) > 0:\n                index = world_map[pos[0]]\n                coord_meta['default_axislabel_position'][index] = spine_name\n                coord_meta['default_ticklabel_position'][index] = spine_name\n                coord_meta['default_ticks_position'][index] = spine_name\n                m[pos[0], :] = 0\n\n        # In the special and common case where the frame is rectangular and\n        # we are dealing with 2-d WCS (after slicing), we show all ticks on\n        # all axes for backward-compatibility.\n        if len(world_map) == 1:\n            for index in world_map:\n                coord_meta['default_ticks_position'][index] = 'bt'\n\n    elif frame_class is EllipticalFrame:\n\n        if 'longitude' in coord_meta['type']:\n            lon_idx = coord_meta['type'].index('longitude')\n            coord_meta['default_axislabel_position'][lon_idx] = 'h'\n            coord_meta['default_ticklabel_position'][lon_idx] = 'h'\n            coord_meta['default_ticks_position'][lon_idx] = 'h'\n\n        if 'latitude' in coord_meta['type']:\n            lat_idx = coord_meta['type'].index('latitude')\n            coord_meta['default_axislabel_position'][lat_idx] = 'c'\n            coord_meta['default_ticklabel_position'][lat_idx] = 'c'\n            coord_meta['default_ticks_position'][lat_idx] = 'c'\n\n    else:\n\n        for index in range(len(coord_meta['type'])):\n            if index in world_map:\n                coord_meta['default_axislabel_position'][index] = frame_class.spine_names\n                coord_meta['default_ticklabel_position'][index] = frame_class.spine_names\n                coord_meta['default_ticks_position'][index] = frame_class.spine_names\n\n    return transform, coord_meta"},{"attributeType":"null","col":12,"comment":"null","endLoc":94,"id":16368,"name":"same_frames","nodeType":"Attribute","startLoc":94,"text":"self.same_frames"},{"attributeType":"null","col":8,"comment":"null","endLoc":66,"id":16369,"name":"_output_system_name","nodeType":"Attribute","startLoc":66,"text":"self._output_system_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":65,"id":16370,"name":"_input_system_name","nodeType":"Attribute","startLoc":65,"text":"self._input_system_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":102,"id":16371,"name":"_same_frames","nodeType":"Attribute","startLoc":102,"text":"self._same_frames"},{"col":4,"comment":"\n        Sort by axis displacement, which allows us to figure out which parts\n        of labels to not repeat.\n        ","endLoc":72,"header":"def sort(self)","id":16372,"name":"sort","nodeType":"Function","startLoc":61,"text":"def sort(self):\n        \"\"\"\n        Sort by axis displacement, which allows us to figure out which parts\n        of labels to not repeat.\n        \"\"\"\n        for axis in self.world:\n            self.world[axis] = sort_using(self.world[axis], self.disp[axis])\n            self.pixel[axis] = sort_using(self.pixel[axis], self.disp[axis])\n            self.angle[axis] = sort_using(self.angle[axis], self.disp[axis])\n            self.text[axis] = sort_using(self.text[axis], self.disp[axis])\n            self.disp[axis] = sort_using(self.disp[axis], self.disp[axis])\n        self._stale = True"},{"attributeType":"null","col":12,"comment":"null","endLoc":75,"id":16373,"name":"input_system","nodeType":"Attribute","startLoc":75,"text":"self.input_system"},{"col":0,"comment":"null","endLoc":13,"header":"def sort_using(X, Y)","id":16374,"name":"sort_using","nodeType":"Function","startLoc":12,"text":"def sort_using(X, Y):\n    return [x for (y, x) in sorted(zip(Y, X))]"},{"col":4,"comment":"\n        Figure out which parts of labels can be dropped to avoid repetition.\n        ","endLoc":106,"header":"def simplify_labels(self)","id":16375,"name":"simplify_labels","nodeType":"Function","startLoc":74,"text":"def simplify_labels(self):\n        \"\"\"\n        Figure out which parts of labels can be dropped to avoid repetition.\n        \"\"\"\n        self.sort()\n        for axis in self.world:\n            t1 = self.text[axis][0]\n            for i in range(1, len(self.world[axis])):\n                t2 = self.text[axis][i]\n                if len(t1) != len(t2):\n                    t1 = self.text[axis][i]\n                    continue\n                start = 0\n                # In the following loop, we need to ignore the last character,\n                # hence the len(t1) - 1. This is because if we have two strings\n                # like 13d14m15s we want to make sure that we keep the last\n                # part (15s) even if the two labels are identical.\n                for j in range(len(t1) - 1):\n                    if t1[j] != t2[j]:\n                        break\n                    if t1[j] not in '-0123456789.':\n                        start = j + 1\n                t1 = self.text[axis][i]\n                if start != 0:\n                    starts_dollar = self.text[axis][i].startswith('$')\n                    self.text[axis][i] = self.text[axis][i][start:]\n                    if starts_dollar:\n                        self.text[axis][i] = '$' + self.text[axis][i]\n                # Remove any empty LaTeX inline math mode string\n                if self.text[axis][i] == '$$':\n                    self.text[axis][i] = ''\n\n        self._stale = True"},{"col":4,"comment":"null","endLoc":581,"header":"def formatter(self, values, spacing, format='auto')","id":16376,"name":"formatter","nodeType":"Function","startLoc":565,"text":"def formatter(self, values, spacing, format='auto'):\n\n        if len(values) > 0:\n            if self.format is None:\n                if spacing.value < 1.:\n                    precision = -int(np.floor(np.log10(spacing.value)))\n                else:\n                    precision = 0\n            elif self.format.startswith('%'):\n                return [(self.format % x.value) for x in values]\n            else:\n                precision = self._precision\n\n            return [(\"{0:.\" + str(precision) + \"f}\").format(x.to_value(self._format_unit)) for x in values]\n\n        else:\n            return []"},{"className":"CoordinatesMap","col":0,"comment":"\n    A container for coordinate helpers that represents a coordinate system.\n\n    This object can be used to access coordinate helpers by index (like a list)\n    or by name (like a dictionary).\n\n    Parameters\n    ----------\n    axes : :class:`~astropy.visualization.wcsaxes.WCSAxes`\n        The axes the coordinate map belongs to.\n    transform : `~matplotlib.transforms.Transform`, optional\n        The transform for the data.\n    coord_meta : dict, optional\n        A dictionary providing additional metadata. This should include the keys\n        ``type``, ``wrap``, and ``unit``. Each of these should be a list with as\n        many items as the dimension of the coordinate system. The ``type``\n        entries should be one of ``longitude``, ``latitude``, or ``scalar``, the\n        ``wrap`` entries should give, for the longitude, the angle at which the\n        coordinate wraps (and `None` otherwise), and the ``unit`` should give\n        the unit of the coordinates as :class:`~astropy.units.Unit` instances.\n        This can optionally also include a ``format_unit`` entry giving the\n        units to use for the tick labels (if not specified, this defaults to\n        ``unit``).\n    frame_class : type, optional\n        The class for the frame, which should be a subclass of\n        :class:`~astropy.visualization.wcsaxes.frame.BaseFrame`. The default is to use a\n        :class:`~astropy.visualization.wcsaxes.frame.RectangularFrame`\n    previous_frame_path : `~matplotlib.path.Path`, optional\n        When changing the WCS of the axes, the frame instance will change but\n        we might want to keep re-using the same underlying matplotlib\n        `~matplotlib.path.Path` - in that case, this can be passed to this\n        keyword argument.\n    ","endLoc":184,"id":16377,"nodeType":"Class","startLoc":11,"text":"class CoordinatesMap:\n    \"\"\"\n    A container for coordinate helpers that represents a coordinate system.\n\n    This object can be used to access coordinate helpers by index (like a list)\n    or by name (like a dictionary).\n\n    Parameters\n    ----------\n    axes : :class:`~astropy.visualization.wcsaxes.WCSAxes`\n        The axes the coordinate map belongs to.\n    transform : `~matplotlib.transforms.Transform`, optional\n        The transform for the data.\n    coord_meta : dict, optional\n        A dictionary providing additional metadata. This should include the keys\n        ``type``, ``wrap``, and ``unit``. Each of these should be a list with as\n        many items as the dimension of the coordinate system. The ``type``\n        entries should be one of ``longitude``, ``latitude``, or ``scalar``, the\n        ``wrap`` entries should give, for the longitude, the angle at which the\n        coordinate wraps (and `None` otherwise), and the ``unit`` should give\n        the unit of the coordinates as :class:`~astropy.units.Unit` instances.\n        This can optionally also include a ``format_unit`` entry giving the\n        units to use for the tick labels (if not specified, this defaults to\n        ``unit``).\n    frame_class : type, optional\n        The class for the frame, which should be a subclass of\n        :class:`~astropy.visualization.wcsaxes.frame.BaseFrame`. The default is to use a\n        :class:`~astropy.visualization.wcsaxes.frame.RectangularFrame`\n    previous_frame_path : `~matplotlib.path.Path`, optional\n        When changing the WCS of the axes, the frame instance will change but\n        we might want to keep re-using the same underlying matplotlib\n        `~matplotlib.path.Path` - in that case, this can be passed to this\n        keyword argument.\n    \"\"\"\n\n    def __init__(self, axes, transform=None, coord_meta=None,\n                 frame_class=RectangularFrame, previous_frame_path=None):\n\n        self._axes = axes\n        self._transform = transform\n\n        self.frame = frame_class(axes, self._transform, path=previous_frame_path)\n\n        # Set up coordinates\n        self._coords = []\n        self._aliases = {}\n\n        visible_count = 0\n\n        for index in range(len(coord_meta['type'])):\n\n            # Extract coordinate metadata\n            coord_type = coord_meta['type'][index]\n            coord_wrap = coord_meta['wrap'][index]\n            coord_unit = coord_meta['unit'][index]\n            name = coord_meta['name'][index]\n\n            visible = True\n            if 'visible' in coord_meta:\n                visible = coord_meta['visible'][index]\n\n            format_unit = None\n            if 'format_unit' in coord_meta:\n                format_unit = coord_meta['format_unit'][index]\n\n            default_label = name[0] if isinstance(name, (tuple, list)) else name\n            if 'default_axis_label' in coord_meta:\n                default_label = coord_meta['default_axis_label'][index]\n\n            coord_index = None\n            if visible:\n                visible_count += 1\n                coord_index = visible_count - 1\n\n            self._coords.append(CoordinateHelper(parent_axes=axes,\n                                                 parent_map=self,\n                                                 transform=self._transform,\n                                                 coord_index=coord_index,\n                                                 coord_type=coord_type,\n                                                 coord_wrap=coord_wrap,\n                                                 coord_unit=coord_unit,\n                                                 format_unit=format_unit,\n                                                 frame=self.frame,\n                                                 default_label=default_label))\n\n            # Set up aliases for coordinates\n            if isinstance(name, tuple):\n                for nm in name:\n                    nm = nm.lower()\n                    # Do not replace an alias already in the map if we have\n                    # more than one alias for this axis.\n                    if nm not in self._aliases:\n                        self._aliases[nm] = index\n            else:\n                self._aliases[name.lower()] = index\n\n    def __getitem__(self, item):\n        if isinstance(item, str):\n            return self._coords[self._aliases[item.lower()]]\n        else:\n            return self._coords[item]\n\n    def __contains__(self, item):\n        if isinstance(item, str):\n            return item.lower() in self._aliases\n        else:\n            return 0 <= item < len(self._coords)\n\n    def set_visible(self, visibility):\n        raise NotImplementedError()\n\n    def __iter__(self):\n        for coord in self._coords:\n            yield coord\n\n    def grid(self, draw_grid=True, grid_type=None, **kwargs):\n        \"\"\"\n        Plot gridlines for both coordinates.\n\n        Standard matplotlib appearance options (color, alpha, etc.) can be\n        passed as keyword arguments.\n\n        Parameters\n        ----------\n        draw_grid : bool\n            Whether to show the gridlines\n        grid_type : { 'lines' | 'contours' }\n            Whether to plot the contours by determining the grid lines in\n            world coordinates and then plotting them in world coordinates\n            (``'lines'``) or by determining the world coordinates at many\n            positions in the image and then drawing contours\n            (``'contours'``). The first is recommended for 2-d images, while\n            for 3-d (or higher dimensional) cubes, the ``'contours'`` option\n            is recommended. By default, 'lines' is used if the transform has\n            an inverse, otherwise 'contours' is used.\n        \"\"\"\n        for coord in self:\n            coord.grid(draw_grid=draw_grid, grid_type=grid_type, **kwargs)\n\n    def get_coord_range(self):\n        xmin, xmax = self._axes.get_xlim()\n\n        if isinstance(self.frame, RectangularFrame1D):\n            extent = [xmin, xmax]\n        else:\n            ymin, ymax = self._axes.get_ylim()\n            extent = [xmin, xmax, ymin, ymax]\n\n        return find_coordinate_range(self._transform,\n                                     extent,\n                                     [coord.coord_type for coord in self if coord.coord_index is not None],\n                                     [coord.coord_unit for coord in self if coord.coord_index is not None],\n                                     [coord.coord_wrap for coord in self if coord.coord_index is not None])\n\n    def _as_table(self):\n\n        # Import Table here to avoid importing the astropy.table package\n        # every time astropy.visualization.wcsaxes is imported.\n        from astropy.table import Table  # noqa\n\n        rows = []\n        for icoord, coord in enumerate(self._coords):\n            aliases = [key for key, value in self._aliases.items() if value == icoord]\n            row = OrderedDict([('index', icoord), ('aliases', ' '.join(aliases)),\n                               ('type', coord.coord_type), ('unit', coord.coord_unit),\n                               ('wrap', coord.coord_wrap), ('format_unit', coord.get_format_unit()),\n                               ('visible', 'no' if coord.coord_index is None else 'yes')])\n            rows.append(row)\n        return Table(rows=rows)\n\n    def __repr__(self):\n        s = f'<CoordinatesMap with {len(self._coords)} world coordinates:\\n\\n'\n        table = indent(str(self._as_table()), '  ')\n        return s + table + '\\n\\n>'"},{"col":4,"comment":"null","endLoc":451,"header":"def formatter(self, values, spacing, format='auto')","id":16378,"name":"formatter","nodeType":"Function","startLoc":347,"text":"def formatter(self, values, spacing, format='auto'):\n\n        if not isinstance(values, u.Quantity) and values is not None:\n            raise TypeError(\"values should be a Quantities array\")\n\n        if len(values) > 0:\n\n            decimal = self.decimal\n            unit = self._format_unit\n\n            if unit is u.hour:\n                unit = u.hourangle\n\n            if self.format is None:\n                if decimal:\n                    # Here we assume the spacing can be arbitrary, so for example\n                    # 1.000223 degrees, in which case we don't want to have a\n                    # format that rounds to degrees. So we find the number of\n                    # decimal places we get from representing the spacing as a\n                    # string in the desired units. The easiest way to find\n                    # the smallest number of decimal places required is to\n                    # format the number as a decimal float and strip any zeros\n                    # from the end. We do this rather than just trusting e.g.\n                    # str() because str(15.) == 15.0. We format using 10 decimal\n                    # places by default before stripping the zeros since this\n                    # corresponds to a resolution of less than a microarcecond,\n                    # which should be sufficient.\n                    spacing = spacing.to_value(unit)\n                    fields = 0\n                    precision = len(f\"{spacing:.10f}\".replace('0', ' ').strip().split('.', 1)[1])\n                else:\n                    spacing = spacing.to_value(unit / 3600)\n                    if spacing >= 3600:\n                        fields = 1\n                        precision = 0\n                    elif spacing >= 60:\n                        fields = 2\n                        precision = 0\n                    elif spacing >= 1:\n                        fields = 3\n                        precision = 0\n                    else:\n                        fields = 3\n                        precision = -int(np.floor(np.log10(spacing)))\n            else:\n                fields = self._fields\n                precision = self._precision\n\n            is_latex = format == 'latex' or (format == 'auto' and rcParams['text.usetex'])\n\n            if decimal:\n                # At the moment, the Angle class doesn't have a consistent way\n                # to always convert angles to strings in decimal form with\n                # symbols for units (instead of e.g 3arcsec). So as a workaround\n                # we take advantage of the fact that Angle.to_string converts\n                # the unit to a string manually when decimal=False and the unit\n                # is not strictly u.degree or u.hourangle\n                if self.show_decimal_unit:\n                    decimal = False\n                    sep = 'fromunit'\n                    if is_latex:\n                        fmt = 'latex'\n                    else:\n                        if unit is u.hourangle:\n                            fmt = 'unicode'\n                        else:\n                            fmt = None\n                    unit = CUSTOM_UNITS.get(unit, unit)\n                else:\n                    sep = None\n                    fmt = None\n            elif self.sep is not None:\n                sep = self.sep\n                fmt = None\n            else:\n                sep = 'fromunit'\n                if unit == u.degree:\n                    if is_latex:\n                        fmt = 'latex'\n                    else:\n                        sep = ('\\xb0', \"'\", '\"')\n                        fmt = None\n                else:\n                    if format == 'ascii':\n                        fmt = None\n                    elif is_latex:\n                        fmt = 'latex'\n                    else:\n                        # Here we still use LaTeX but this is for Matplotlib's\n                        # LaTeX engine - we can't use fmt='latex' as this\n                        # doesn't produce LaTeX output that respects the fonts.\n                        sep = (r'$\\mathregular{^h}$', r'$\\mathregular{^m}$', r'$\\mathregular{^s}$')\n                        fmt = None\n\n            angles = Angle(values)\n            string = angles.to_string(unit=unit,\n                                      precision=precision,\n                                      decimal=decimal,\n                                      fields=fields,\n                                      sep=sep,\n                                      format=fmt).tolist()\n\n            return string\n        else:\n            return []"},{"col":4,"comment":"null","endLoc":113,"header":"def get_pad(self)","id":16379,"name":"get_pad","nodeType":"Function","startLoc":112,"text":"def get_pad(self):\n        return self._pad"},{"col":4,"comment":"null","endLoc":123,"header":"def get_visible_axes(self)","id":16380,"name":"get_visible_axes","nodeType":"Function","startLoc":119,"text":"def get_visible_axes(self):\n        if self._visible_axes == 'all':\n            return self.world.keys()\n        else:\n            return [x for x in self._visible_axes if x in self.world]"},{"col":4,"comment":"null","endLoc":126,"header":"def set_exclude_overlapping(self, exclude_overlapping)","id":16381,"name":"set_exclude_overlapping","nodeType":"Function","startLoc":125,"text":"def set_exclude_overlapping(self, exclude_overlapping):\n        self._exclude_overlapping = exclude_overlapping"},{"col":4,"comment":"\n        Compute and set the x, y positions and the horizontal/vertical alignment of\n        each label.\n        ","endLoc":239,"header":"def _set_xy_alignments(self, renderer, tick_out_size)","id":16382,"name":"_set_xy_alignments","nodeType":"Function","startLoc":128,"text":"def _set_xy_alignments(self, renderer, tick_out_size):\n        \"\"\"\n        Compute and set the x, y positions and the horizontal/vertical alignment of\n        each label.\n        \"\"\"\n        if not self._stale:\n            return\n\n        self.simplify_labels()\n        text_size = renderer.points_to_pixels(self.get_size())\n\n        visible_axes = self.get_visible_axes()\n        self.xy = {axis: {} for axis in visible_axes}\n        self.ha = {axis: {} for axis in visible_axes}\n        self.va = {axis: {} for axis in visible_axes}\n\n        for axis in visible_axes:\n            for i in range(len(self.world[axis])):\n                # In the event that the label is empty (which is not expected\n                # but could happen in unforeseen corner cases), we should just\n                # skip to the next label.\n                if self.text[axis][i] == '':\n                    continue\n\n                x, y = self.pixel[axis][i]\n                pad = renderer.points_to_pixels(self.get_pad() + tick_out_size)\n\n                if isinstance(self._frame, RectangularFrame):\n                    # This is just to preserve the current results, but can be\n                    # removed next time the reference images are re-generated.\n                    if np.abs(self.angle[axis][i]) < 45.:\n                        ha = 'right'\n                        va = 'bottom'\n                        dx = -pad\n                        dy = -text_size * 0.5\n                    elif np.abs(self.angle[axis][i] - 90.) < 45:\n                        ha = 'center'\n                        va = 'bottom'\n                        dx = 0\n                        dy = -text_size - pad\n                    elif np.abs(self.angle[axis][i] - 180.) < 45:\n                        ha = 'left'\n                        va = 'bottom'\n                        dx = pad\n                        dy = -text_size * 0.5\n                    else:\n                        ha = 'center'\n                        va = 'bottom'\n                        dx = 0\n                        dy = pad\n\n                    x = x + dx\n                    y = y + dy\n\n                else:\n                    # This is the more general code for arbitrarily oriented\n                    # axes\n\n                    # Set initial position and find bounding box\n                    self.set_text(self.text[axis][i])\n                    self.set_position((x, y))\n                    bb = super().get_window_extent(renderer)\n\n                    # Find width and height, as well as angle at which we\n                    # transition which side of the label we use to anchor the\n                    # label.\n                    width = bb.width\n                    height = bb.height\n\n                    # Project axis angle onto bounding box\n                    ax = np.cos(np.radians(self.angle[axis][i]))\n                    ay = np.sin(np.radians(self.angle[axis][i]))\n\n                    # Set anchor point for label\n                    if np.abs(self.angle[axis][i]) < 45.:\n                        dx = width\n                        dy = ay * height\n                    elif np.abs(self.angle[axis][i] - 90.) < 45:\n                        dx = ax * width\n                        dy = height\n                    elif np.abs(self.angle[axis][i] - 180.) < 45:\n                        dx = -width\n                        dy = ay * height\n                    else:\n                        dx = ax * width\n                        dy = -height\n\n                    dx *= 0.5\n                    dy *= 0.5\n\n                    # Find normalized vector along axis normal, so as to be\n                    # able to nudge the label away by a constant padding factor\n\n                    dist = np.hypot(dx, dy)\n\n                    ddx = dx / dist\n                    ddy = dy / dist\n\n                    dx += ddx * pad\n                    dy += ddy * pad\n\n                    x = x - dx\n                    y = y - dy\n\n                    ha = 'center'\n                    va = 'center'\n\n                self.xy[axis][i] = (x, y)\n                self.ha[axis][i] = ha\n                self.va[axis][i] = va\n\n        self._stale = False"},{"attributeType":"None","col":8,"comment":"null","endLoc":483,"id":16383,"name":"_number","nodeType":"Attribute","startLoc":483,"text":"self._number"},{"col":4,"comment":"null","endLoc":105,"header":"def __init__(self, axes, transform=None, coord_meta=None,\n                 frame_class=RectangularFrame, previous_frame_path=None)","id":16384,"name":"__init__","nodeType":"Function","startLoc":46,"text":"def __init__(self, axes, transform=None, coord_meta=None,\n                 frame_class=RectangularFrame, previous_frame_path=None):\n\n        self._axes = axes\n        self._transform = transform\n\n        self.frame = frame_class(axes, self._transform, path=previous_frame_path)\n\n        # Set up coordinates\n        self._coords = []\n        self._aliases = {}\n\n        visible_count = 0\n\n        for index in range(len(coord_meta['type'])):\n\n            # Extract coordinate metadata\n            coord_type = coord_meta['type'][index]\n            coord_wrap = coord_meta['wrap'][index]\n            coord_unit = coord_meta['unit'][index]\n            name = coord_meta['name'][index]\n\n            visible = True\n            if 'visible' in coord_meta:\n                visible = coord_meta['visible'][index]\n\n            format_unit = None\n            if 'format_unit' in coord_meta:\n                format_unit = coord_meta['format_unit'][index]\n\n            default_label = name[0] if isinstance(name, (tuple, list)) else name\n            if 'default_axis_label' in coord_meta:\n                default_label = coord_meta['default_axis_label'][index]\n\n            coord_index = None\n            if visible:\n                visible_count += 1\n                coord_index = visible_count - 1\n\n            self._coords.append(CoordinateHelper(parent_axes=axes,\n                                                 parent_map=self,\n                                                 transform=self._transform,\n                                                 coord_index=coord_index,\n                                                 coord_type=coord_type,\n                                                 coord_wrap=coord_wrap,\n                                                 coord_unit=coord_unit,\n                                                 format_unit=format_unit,\n                                                 frame=self.frame,\n                                                 default_label=default_label))\n\n            # Set up aliases for coordinates\n            if isinstance(name, tuple):\n                for nm in name:\n                    nm = nm.lower()\n                    # Do not replace an alias already in the map if we have\n                    # more than one alias for this axis.\n                    if nm not in self._aliases:\n                        self._aliases[nm] = index\n            else:\n                self._aliases[name.lower()] = index"},{"attributeType":"null","col":16,"comment":"null","endLoc":507,"id":16385,"name":"spacing","nodeType":"Attribute","startLoc":507,"text":"self.spacing"},{"col":4,"comment":"null","endLoc":32,"header":"def __init__(self, frame, minpad=1, *args, **kwargs)","id":16386,"name":"__init__","nodeType":"Function","startLoc":15,"text":"def __init__(self, frame, minpad=1, *args, **kwargs):\n\n        # Use rcParams if the following parameters were not specified explicitly\n        if 'weight' not in kwargs:\n            kwargs['weight'] = rcParams['axes.labelweight']\n        if 'size' not in kwargs:\n            kwargs['size'] = rcParams['axes.labelsize']\n        if 'color' not in kwargs:\n            kwargs['color'] = rcParams['axes.labelcolor']\n\n        self._frame = frame\n        super().__init__(*args, **kwargs)\n        self.set_clip_on(True)\n        self.set_visible_axes('all')\n        self.set_ha('center')\n        self.set_va('center')\n        self._minpad = minpad\n        self._visibility_rule = 'labels'"},{"attributeType":"Quantity","col":8,"comment":"null","endLoc":484,"id":16387,"name":"_spacing","nodeType":"Attribute","startLoc":484,"text":"self._spacing"},{"attributeType":"None","col":8,"comment":"null","endLoc":485,"id":16388,"name":"_values","nodeType":"Attribute","startLoc":485,"text":"self._values"},{"attributeType":"null","col":16,"comment":"null","endLoc":501,"id":16389,"name":"_precision","nodeType":"Attribute","startLoc":501,"text":"self._precision"},{"attributeType":"{startswith} | None","col":8,"comment":"null","endLoc":494,"id":16390,"name":"_format","nodeType":"Attribute","startLoc":494,"text":"self._format"},{"attributeType":"null","col":16,"comment":"null","endLoc":14,"id":16391,"name":"np","nodeType":"Attribute","startLoc":14,"text":"np"},{"attributeType":"null","col":29,"comment":"null","endLoc":18,"id":16392,"name":"u","nodeType":"Attribute","startLoc":18,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":16393,"name":"DMS_RE","nodeType":"Attribute","startLoc":22,"text":"DMS_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":16394,"name":"HMS_RE","nodeType":"Attribute","startLoc":23,"text":"HMS_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":16395,"name":"DDEC_RE","nodeType":"Attribute","startLoc":24,"text":"DDEC_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":16396,"name":"DMIN_RE","nodeType":"Attribute","startLoc":25,"text":"DMIN_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":16397,"name":"DSEC_RE","nodeType":"Attribute","startLoc":26,"text":"DSEC_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":16398,"name":"SCAL_RE","nodeType":"Attribute","startLoc":27,"text":"SCAL_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":16399,"name":"CUSTOM_UNITS","nodeType":"Attribute","startLoc":33,"text":"CUSTOM_UNITS"},{"col":0,"comment":"","endLoc":11,"header":"formatter_locator.py#<anonymous>","id":16400,"name":"<anonymous>","nodeType":"Function","startLoc":11,"text":"DMS_RE = re.compile('^dd(:mm(:ss(.(s)+)?)?)?$')\n\nHMS_RE = re.compile('^hh(:mm(:ss(.(s)+)?)?)?$')\n\nDDEC_RE = re.compile('^d(.(d)+)?$')\n\nDMIN_RE = re.compile('^m(.(m)+)?$')\n\nDSEC_RE = re.compile('^s(.(s)+)?$')\n\nSCAL_RE = re.compile('^x(.(x)+)?$')\n\nCUSTOM_UNITS = {\n    u.degree: u.def_unit('custom_degree', represents=u.degree,\n                         format={'generic': '\\xb0',\n                                 'latex': r'^\\circ',\n                                 'unicode': '°'}),\n    u.arcmin: u.def_unit('custom_arcmin', represents=u.arcmin,\n                         format={'generic': \"'\",\n                                 'latex': r'^\\prime',\n                                 'unicode': '′'}),\n    u.arcsec: u.def_unit('custom_arcsec', represents=u.arcsec,\n                         format={'generic': '\"',\n                                 'latex': r'^{\\prime\\prime}',\n                                 'unicode': '″'}),\n    u.hourangle: u.def_unit('custom_hourangle', represents=u.hourangle,\n                            format={'generic': 'h',\n                                    'latex': r'^{\\mathrm{h}}',\n                                    'unicode': r'$\\mathregular{^h}$'})}"},{"col":4,"comment":"null","endLoc":41,"header":"def set_visible_axes(self, visible_axes)","id":16401,"name":"set_visible_axes","nodeType":"Function","startLoc":40,"text":"def set_visible_axes(self, visible_axes):\n        self._visible_axes = visible_axes"},{"col":4,"comment":"\n        Plot grid lines for this coordinate.\n\n        Standard matplotlib appearance options (color, alpha, etc.) can be\n        passed as keyword arguments.\n\n        Parameters\n        ----------\n        draw_grid : bool\n            Whether to show the gridlines\n        grid_type : {'lines', 'contours'}\n            Whether to plot the contours by determining the grid lines in\n            world coordinates and then plotting them in world coordinates\n            (``'lines'``) or by determining the world coordinates at many\n            positions in the image and then drawing contours\n            (``'contours'``). The first is recommended for 2-d images, while\n            for 3-d (or higher dimensional) cubes, the ``'contours'`` option\n            is recommended. By default, 'lines' is used if the transform has\n            an inverse, otherwise 'contours' is used.\n        ","endLoc":176,"header":"def grid(self, draw_grid=True, grid_type=None, **kwargs)","id":16402,"name":"grid","nodeType":"Function","startLoc":133,"text":"def grid(self, draw_grid=True, grid_type=None, **kwargs):\n        \"\"\"\n        Plot grid lines for this coordinate.\n\n        Standard matplotlib appearance options (color, alpha, etc.) can be\n        passed as keyword arguments.\n\n        Parameters\n        ----------\n        draw_grid : bool\n            Whether to show the gridlines\n        grid_type : {'lines', 'contours'}\n            Whether to plot the contours by determining the grid lines in\n            world coordinates and then plotting them in world coordinates\n            (``'lines'``) or by determining the world coordinates at many\n            positions in the image and then drawing contours\n            (``'contours'``). The first is recommended for 2-d images, while\n            for 3-d (or higher dimensional) cubes, the ``'contours'`` option\n            is recommended. By default, 'lines' is used if the transform has\n            an inverse, otherwise 'contours' is used.\n        \"\"\"\n\n        if grid_type == 'lines' and not self.transform.has_inverse:\n            raise ValueError('The specified transform has no inverse, so the '\n                             'grid cannot be drawn using grid_type=\\'lines\\'')\n\n        if grid_type is None:\n            grid_type = 'lines' if self.transform.has_inverse else 'contours'\n\n        if grid_type in ('lines', 'contours'):\n            self._grid_type = grid_type\n        else:\n            raise ValueError(\"grid_type should be 'lines' or 'contours'\")\n\n        if 'color' in kwargs:\n            kwargs['edgecolor'] = kwargs.pop('color')\n\n        self.grid_lines_kwargs.update(kwargs)\n\n        if self.grid_lines_kwargs['visible']:\n            if not draw_grid:\n                self.grid_lines_kwargs['visible'] = False\n        else:\n            self.grid_lines_kwargs['visible'] = True"},{"attributeType":"null","col":8,"comment":"null","endLoc":190,"id":16403,"name":"_number","nodeType":"Attribute","startLoc":190,"text":"self._number"},{"fileName":"coordinate_range.py","filePath":"astropy/visualization/wcsaxes","id":16404,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport warnings\n\nimport numpy as np\n\nfrom astropy import units as u\n\n# Algorithm inspired by PGSBOX from WCSLIB by M. Calabretta\n\nLONLAT = {'longitude', 'latitude'}\n\n\ndef wrap_180(values):\n    values_new = values % 360.\n    with np.errstate(invalid='ignore'):\n        values_new[values_new > 180.] -= 360\n    return values_new\n\n\ndef find_coordinate_range(transform, extent, coord_types, coord_units, coord_wraps):\n    \"\"\"\n    Find the range of coordinates to use for ticks/grids\n\n    Parameters\n    ----------\n    transform : func\n        Function to transform pixel to world coordinates. Should take two\n        values (the pixel coordinates) and return two values (the world\n        coordinates).\n    extent : iterable\n        The range of the image viewport in pixel coordinates, given as [xmin,\n        xmax, ymin, ymax].\n    coord_types : list of str\n        Whether each coordinate is a ``'longitude'``, ``'latitude'``, or\n        ``'scalar'`` value.\n    coord_units : list of `astropy.units.Unit`\n        The units for each coordinate.\n    coord_wraps : list of float\n        The wrap angles for longitudes.\n    \"\"\"\n    # Sample coordinates on a NX x NY grid.\n    from . import conf\n    if len(extent) == 4:\n        nx = ny = conf.coordinate_range_samples\n        x = np.linspace(extent[0], extent[1], nx + 1)\n        y = np.linspace(extent[2], extent[3], ny + 1)\n        xp, yp = np.meshgrid(x, y)\n        with np.errstate(invalid='ignore'):\n            world = transform.transform(np.vstack([xp.ravel(), yp.ravel()]).transpose())\n    else:\n        nx = conf.coordinate_range_samples\n        xp = np.linspace(extent[0], extent[1], nx + 1)[None]\n        with np.errstate(invalid='ignore'):\n            world = transform.transform(xp.T)\n\n    ranges = []\n\n    for coord_index, coord_type in enumerate(coord_types):\n\n        xw = world[:, coord_index].reshape(xp.shape)\n\n        if coord_type in LONLAT:\n\n            unit = coord_units[coord_index]\n            xw = xw * unit.to(u.deg)\n\n            # Iron out coordinates along first row\n            wjump = xw[0, 1:] - xw[0, :-1]\n            with np.errstate(invalid='ignore'):\n                reset = np.abs(wjump) > 180.\n            if np.any(reset):\n                wjump = wjump + np.sign(wjump) * 180.\n                wjump = 360. * (wjump / 360.).astype(int)\n                xw[0, 1:][reset] -= wjump[reset]\n\n            # Now iron out coordinates along all columns, starting with first row.\n            wjump = xw[1:] - xw[:1]\n            with np.errstate(invalid='ignore'):\n                reset = np.abs(wjump) > 180.\n            if np.any(reset):\n                wjump = wjump + np.sign(wjump) * 180.\n                wjump = 360. * (wjump / 360.).astype(int)\n                xw[1:][reset] -= wjump[reset]\n\n        with warnings.catch_warnings():\n            warnings.simplefilter(\"ignore\", RuntimeWarning)\n            xw_min = np.nanmin(xw)\n            xw_max = np.nanmax(xw)\n\n        # Check if range is smaller when normalizing to the range 0 to 360\n\n        if coord_type in LONLAT:\n\n            with warnings.catch_warnings():\n                warnings.simplefilter(\"ignore\", RuntimeWarning)\n                xw_min_check = np.nanmin(xw % 360.)\n                xw_max_check = np.nanmax(xw % 360.)\n\n            if xw_max_check - xw_min_check <= xw_max - xw_min < 360.:\n                xw_min = xw_min_check\n                xw_max = xw_max_check\n\n        # Check if range is smaller when normalizing to the range -180 to 180\n\n        if coord_type in LONLAT:\n\n            with warnings.catch_warnings():\n                warnings.simplefilter(\"ignore\", RuntimeWarning)\n                xw_min_check = np.nanmin(wrap_180(xw))\n                xw_max_check = np.nanmax(wrap_180(xw))\n\n            if xw_max_check - xw_min_check < 360. and xw_max - xw_min >= xw_max_check - xw_min_check:\n                xw_min = xw_min_check\n                xw_max = xw_max_check\n\n        x_range = xw_max - xw_min\n        if coord_type == 'longitude':\n            if x_range > 300.:\n                xw_min = coord_wraps[coord_index] - 360\n                xw_max = coord_wraps[coord_index] - np.spacing(360.)\n            elif xw_min < 0.:\n                xw_min = max(-180., xw_min - 0.1 * x_range)\n                xw_max = min(+180., xw_max + 0.1 * x_range)\n            else:\n                xw_min = max(0., xw_min - 0.1 * x_range)\n                xw_max = min(360., xw_max + 0.1 * x_range)\n        elif coord_type == 'latitude':\n            xw_min = max(-90., xw_min - 0.1 * x_range)\n            xw_max = min(+90., xw_max + 0.1 * x_range)\n\n        if coord_type in LONLAT:\n            xw_min *= u.deg.to(unit)\n            xw_max *= u.deg.to(unit)\n\n        ranges.append((xw_min, xw_max))\n\n    return ranges\n"},{"attributeType":"null","col":12,"comment":"null","endLoc":216,"id":16405,"name":"_format_unit","nodeType":"Attribute","startLoc":216,"text":"self._format_unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":158,"id":16406,"name":"_sep","nodeType":"Attribute","startLoc":158,"text":"self._sep"},{"col":0,"comment":"null","endLoc":19,"header":"def wrap_180(values)","id":16407,"name":"wrap_180","nodeType":"Function","startLoc":15,"text":"def wrap_180(values):\n    values_new = values % 360.\n    with np.errstate(invalid='ignore'):\n        values_new[values_new > 180.] -= 360\n    return values_new"},{"col":4,"comment":"\n        Set the formatter to use for the major tick labels.\n\n        Parameters\n        ----------\n        formatter : str or `~matplotlib.ticker.Formatter`\n            The format or formatter to use.\n        ","endLoc":229,"header":"def set_major_formatter(self, formatter)","id":16408,"name":"set_major_formatter","nodeType":"Function","startLoc":214,"text":"def set_major_formatter(self, formatter):\n        \"\"\"\n        Set the formatter to use for the major tick labels.\n\n        Parameters\n        ----------\n        formatter : str or `~matplotlib.ticker.Formatter`\n            The format or formatter to use.\n        \"\"\"\n        if isinstance(formatter, Formatter):\n            raise NotImplementedError()  # figure out how to swap out formatter\n        elif isinstance(formatter, str):\n            self._formatter_locator.format = formatter\n        else:\n            raise TypeError(\"formatter should be a string or a Formatter \"\n                            \"instance\")"},{"col":4,"comment":"\n        Given the value of a coordinate, will format it according to the\n        format of the formatter_locator.\n\n        Parameters\n        ----------\n        value : float\n            The value to format\n        format : {'auto', 'ascii', 'latex'}, optional\n            The format to use - by default the formatting will be adjusted\n            depending on whether Matplotlib is using LaTeX or MathTex. To\n            get plain ASCII strings, use format='ascii'.\n        ","endLoc":264,"header":"def format_coord(self, value, format='auto')","id":16409,"name":"format_coord","nodeType":"Function","startLoc":231,"text":"def format_coord(self, value, format='auto'):\n        \"\"\"\n        Given the value of a coordinate, will format it according to the\n        format of the formatter_locator.\n\n        Parameters\n        ----------\n        value : float\n            The value to format\n        format : {'auto', 'ascii', 'latex'}, optional\n            The format to use - by default the formatting will be adjusted\n            depending on whether Matplotlib is using LaTeX or MathTex. To\n            get plain ASCII strings, use format='ascii'.\n        \"\"\"\n\n        if not hasattr(self, \"_fl_spacing\"):\n            return \"\"  # _update_ticks has not been called yet\n\n        fl = self._formatter_locator\n        if isinstance(fl, AngleFormatterLocator):\n\n            # Convert to degrees if needed\n            if self._coord_scale_to_deg is not None:\n                value *= self._coord_scale_to_deg\n\n            if self.coord_type == 'longitude':\n                value = wrap_angle_at(value, self.coord_wrap)\n            value = value * u.degree\n            value = value.to_value(fl._unit)\n\n        spacing = self._fl_spacing\n        string = fl.formatter(values=[value] * fl._unit, spacing=spacing, format=format)\n\n        return string[0]"},{"attributeType":"function","col":12,"comment":"null","endLoc":261,"id":16410,"name":"spacing","nodeType":"Attribute","startLoc":261,"text":"self.spacing"},{"col":0,"comment":"null","endLoc":47,"header":"def wrap_angle_at(values, coord_wrap)","id":16411,"name":"wrap_angle_at","nodeType":"Function","startLoc":43,"text":"def wrap_angle_at(values, coord_wrap):\n    # On ARM processors, np.mod emits warnings if there are NaN values in the\n    # array, although this doesn't seem to happen on other processors.\n    with np.errstate(invalid='ignore'):\n        return np.mod(values - coord_wrap, 360.) - (360. - coord_wrap)"},{"attributeType":"null","col":8,"comment":"null","endLoc":191,"id":16412,"name":"_spacing","nodeType":"Attribute","startLoc":191,"text":"self._spacing"},{"col":0,"comment":"\n    Find the range of coordinates to use for ticks/grids\n\n    Parameters\n    ----------\n    transform : func\n        Function to transform pixel to world coordinates. Should take two\n        values (the pixel coordinates) and return two values (the world\n        coordinates).\n    extent : iterable\n        The range of the image viewport in pixel coordinates, given as [xmin,\n        xmax, ymin, ymax].\n    coord_types : list of str\n        Whether each coordinate is a ``'longitude'``, ``'latitude'``, or\n        ``'scalar'`` value.\n    coord_units : list of `astropy.units.Unit`\n        The units for each coordinate.\n    coord_wraps : list of float\n        The wrap angles for longitudes.\n    ","endLoc":139,"header":"def find_coordinate_range(transform, extent, coord_types, coord_units, coord_wraps)","id":16413,"name":"find_coordinate_range","nodeType":"Function","startLoc":22,"text":"def find_coordinate_range(transform, extent, coord_types, coord_units, coord_wraps):\n    \"\"\"\n    Find the range of coordinates to use for ticks/grids\n\n    Parameters\n    ----------\n    transform : func\n        Function to transform pixel to world coordinates. Should take two\n        values (the pixel coordinates) and return two values (the world\n        coordinates).\n    extent : iterable\n        The range of the image viewport in pixel coordinates, given as [xmin,\n        xmax, ymin, ymax].\n    coord_types : list of str\n        Whether each coordinate is a ``'longitude'``, ``'latitude'``, or\n        ``'scalar'`` value.\n    coord_units : list of `astropy.units.Unit`\n        The units for each coordinate.\n    coord_wraps : list of float\n        The wrap angles for longitudes.\n    \"\"\"\n    # Sample coordinates on a NX x NY grid.\n    from . import conf\n    if len(extent) == 4:\n        nx = ny = conf.coordinate_range_samples\n        x = np.linspace(extent[0], extent[1], nx + 1)\n        y = np.linspace(extent[2], extent[3], ny + 1)\n        xp, yp = np.meshgrid(x, y)\n        with np.errstate(invalid='ignore'):\n            world = transform.transform(np.vstack([xp.ravel(), yp.ravel()]).transpose())\n    else:\n        nx = conf.coordinate_range_samples\n        xp = np.linspace(extent[0], extent[1], nx + 1)[None]\n        with np.errstate(invalid='ignore'):\n            world = transform.transform(xp.T)\n\n    ranges = []\n\n    for coord_index, coord_type in enumerate(coord_types):\n\n        xw = world[:, coord_index].reshape(xp.shape)\n\n        if coord_type in LONLAT:\n\n            unit = coord_units[coord_index]\n            xw = xw * unit.to(u.deg)\n\n            # Iron out coordinates along first row\n            wjump = xw[0, 1:] - xw[0, :-1]\n            with np.errstate(invalid='ignore'):\n                reset = np.abs(wjump) > 180.\n            if np.any(reset):\n                wjump = wjump + np.sign(wjump) * 180.\n                wjump = 360. * (wjump / 360.).astype(int)\n                xw[0, 1:][reset] -= wjump[reset]\n\n            # Now iron out coordinates along all columns, starting with first row.\n            wjump = xw[1:] - xw[:1]\n            with np.errstate(invalid='ignore'):\n                reset = np.abs(wjump) > 180.\n            if np.any(reset):\n                wjump = wjump + np.sign(wjump) * 180.\n                wjump = 360. * (wjump / 360.).astype(int)\n                xw[1:][reset] -= wjump[reset]\n\n        with warnings.catch_warnings():\n            warnings.simplefilter(\"ignore\", RuntimeWarning)\n            xw_min = np.nanmin(xw)\n            xw_max = np.nanmax(xw)\n\n        # Check if range is smaller when normalizing to the range 0 to 360\n\n        if coord_type in LONLAT:\n\n            with warnings.catch_warnings():\n                warnings.simplefilter(\"ignore\", RuntimeWarning)\n                xw_min_check = np.nanmin(xw % 360.)\n                xw_max_check = np.nanmax(xw % 360.)\n\n            if xw_max_check - xw_min_check <= xw_max - xw_min < 360.:\n                xw_min = xw_min_check\n                xw_max = xw_max_check\n\n        # Check if range is smaller when normalizing to the range -180 to 180\n\n        if coord_type in LONLAT:\n\n            with warnings.catch_warnings():\n                warnings.simplefilter(\"ignore\", RuntimeWarning)\n                xw_min_check = np.nanmin(wrap_180(xw))\n                xw_max_check = np.nanmax(wrap_180(xw))\n\n            if xw_max_check - xw_min_check < 360. and xw_max - xw_min >= xw_max_check - xw_min_check:\n                xw_min = xw_min_check\n                xw_max = xw_max_check\n\n        x_range = xw_max - xw_min\n        if coord_type == 'longitude':\n            if x_range > 300.:\n                xw_min = coord_wraps[coord_index] - 360\n                xw_max = coord_wraps[coord_index] - np.spacing(360.)\n            elif xw_min < 0.:\n                xw_min = max(-180., xw_min - 0.1 * x_range)\n                xw_max = min(+180., xw_max + 0.1 * x_range)\n            else:\n                xw_min = max(0., xw_min - 0.1 * x_range)\n                xw_max = min(360., xw_max + 0.1 * x_range)\n        elif coord_type == 'latitude':\n            xw_min = max(-90., xw_min - 0.1 * x_range)\n            xw_max = min(+90., xw_max + 0.1 * x_range)\n\n        if coord_type in LONLAT:\n            xw_min *= u.deg.to(unit)\n            xw_max *= u.deg.to(unit)\n\n        ranges.append((xw_min, xw_max))\n\n    return ranges"},{"col":4,"comment":"\n        Set the separator to use for the angle major tick labels.\n\n        Parameters\n        ----------\n        separator : str or tuple or None\n            The separator between numbers in sexagesimal representation. Can be\n            either a string or a tuple (or `None` for default).\n        ","endLoc":281,"header":"def set_separator(self, separator)","id":16414,"name":"set_separator","nodeType":"Function","startLoc":266,"text":"def set_separator(self, separator):\n        \"\"\"\n        Set the separator to use for the angle major tick labels.\n\n        Parameters\n        ----------\n        separator : str or tuple or None\n            The separator between numbers in sexagesimal representation. Can be\n            either a string or a tuple (or `None` for default).\n        \"\"\"\n        if not (self._formatter_locator.__class__ == AngleFormatterLocator):\n            raise TypeError(\"Separator can only be specified for angle coordinates\")\n        if isinstance(separator, (str, tuple)) or separator is None:\n            self._formatter_locator.sep = separator\n        else:\n            raise TypeError(\"separator should be a string, a tuple, or None\")"},{"col":4,"comment":"\n        Set the unit for the major tick labels.\n\n        Parameters\n        ----------\n        unit : class:`~astropy.units.Unit`\n            The unit to which the tick labels should be converted to.\n        decimal : bool, optional\n            Whether to use decimal formatting. By default this is `False`\n            for degrees or hours (which therefore use sexagesimal formatting)\n            and `True` for all other units.\n        show_decimal_unit : bool, optional\n            Whether to include units when in decimal mode.\n        ","endLoc":300,"header":"def set_format_unit(self, unit, decimal=None, show_decimal_unit=True)","id":16415,"name":"set_format_unit","nodeType":"Function","startLoc":283,"text":"def set_format_unit(self, unit, decimal=None, show_decimal_unit=True):\n        \"\"\"\n        Set the unit for the major tick labels.\n\n        Parameters\n        ----------\n        unit : class:`~astropy.units.Unit`\n            The unit to which the tick labels should be converted to.\n        decimal : bool, optional\n            Whether to use decimal formatting. By default this is `False`\n            for degrees or hours (which therefore use sexagesimal formatting)\n            and `True` for all other units.\n        show_decimal_unit : bool, optional\n            Whether to include units when in decimal mode.\n        \"\"\"\n        self._formatter_locator.format_unit = u.Unit(unit)\n        self._formatter_locator.decimal = decimal\n        self._formatter_locator.show_decimal_unit = show_decimal_unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":192,"id":16416,"name":"_values","nodeType":"Attribute","startLoc":192,"text":"self._values"},{"attributeType":"null","col":16,"comment":"null","endLoc":218,"id":16417,"name":"_precision","nodeType":"Attribute","startLoc":218,"text":"self._precision"},{"col":4,"comment":"\n        Get the unit for the major tick labels.\n        ","endLoc":306,"header":"def get_format_unit(self)","id":16418,"name":"get_format_unit","nodeType":"Function","startLoc":302,"text":"def get_format_unit(self):\n        \"\"\"\n        Get the unit for the major tick labels.\n        \"\"\"\n        return self._formatter_locator.format_unit"},{"col":4,"comment":"\n        Set the location and properties of the ticks.\n\n        At most one of the options from ``values``, ``spacing``, or\n        ``number`` can be specified.\n\n        Parameters\n        ----------\n        values : iterable, optional\n            The coordinate values at which to show the ticks.\n        spacing : float, optional\n            The spacing between ticks.\n        number : float, optional\n            The approximate number of ticks shown.\n        size : float, optional\n            The length of the ticks in points\n        color : str or tuple, optional\n            A valid Matplotlib color for the ticks\n        alpha : float, optional\n            The alpha value (transparency) for the ticks.\n        direction : {'in','out'}, optional\n            Whether the ticks should point inwards or outwards.\n        ","endLoc":368,"header":"def set_ticks(self, values=None, spacing=None, number=None, size=None,\n                  width=None, color=None, alpha=None, direction=None,\n                  exclude_overlapping=None)","id":16419,"name":"set_ticks","nodeType":"Function","startLoc":308,"text":"def set_ticks(self, values=None, spacing=None, number=None, size=None,\n                  width=None, color=None, alpha=None, direction=None,\n                  exclude_overlapping=None):\n        \"\"\"\n        Set the location and properties of the ticks.\n\n        At most one of the options from ``values``, ``spacing``, or\n        ``number`` can be specified.\n\n        Parameters\n        ----------\n        values : iterable, optional\n            The coordinate values at which to show the ticks.\n        spacing : float, optional\n            The spacing between ticks.\n        number : float, optional\n            The approximate number of ticks shown.\n        size : float, optional\n            The length of the ticks in points\n        color : str or tuple, optional\n            A valid Matplotlib color for the ticks\n        alpha : float, optional\n            The alpha value (transparency) for the ticks.\n        direction : {'in','out'}, optional\n            Whether the ticks should point inwards or outwards.\n        \"\"\"\n\n        if sum([values is None, spacing is None, number is None]) < 2:\n            raise ValueError(\"At most one of values, spacing, or number should \"\n                             \"be specified\")\n\n        if values is not None:\n            self._formatter_locator.values = values\n        elif spacing is not None:\n            self._formatter_locator.spacing = spacing\n        elif number is not None:\n            self._formatter_locator.number = number\n\n        if size is not None:\n            self.ticks.set_ticksize(size)\n\n        if width is not None:\n            self.ticks.set_linewidth(width)\n\n        if color is not None:\n            self.ticks.set_color(color)\n\n        if alpha is not None:\n            self.ticks.set_alpha(alpha)\n\n        if direction is not None:\n            if direction in ('in', 'out'):\n                self.ticks.set_tick_out(direction == 'out')\n            else:\n                raise ValueError(\"direction should be 'in' or 'out'\")\n\n        if exclude_overlapping is not None:\n            warnings.warn(\"exclude_overlapping= should be passed to \"\n                          \"set_ticklabel instead of set_ticks\",\n                          AstropyDeprecationWarning)\n            self.ticklabels.set_exclude_overlapping(exclude_overlapping)"},{"attributeType":"null","col":8,"comment":"null","endLoc":159,"id":16420,"name":"show_decimal_unit","nodeType":"Attribute","startLoc":159,"text":"self.show_decimal_unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":209,"id":16421,"name":"_format","nodeType":"Attribute","startLoc":209,"text":"self._format"},{"attributeType":"null","col":16,"comment":"null","endLoc":219,"id":16422,"name":"_fields","nodeType":"Attribute","startLoc":219,"text":"self._fields"},{"attributeType":"null","col":8,"comment":"null","endLoc":157,"id":16423,"name":"_decimal","nodeType":"Attribute","startLoc":157,"text":"self._decimal"},{"className":"AxisLabels","col":0,"comment":"null","endLoc":137,"id":16424,"nodeType":"Class","startLoc":13,"text":"class AxisLabels(Text):\n\n    def __init__(self, frame, minpad=1, *args, **kwargs):\n\n        # Use rcParams if the following parameters were not specified explicitly\n        if 'weight' not in kwargs:\n            kwargs['weight'] = rcParams['axes.labelweight']\n        if 'size' not in kwargs:\n            kwargs['size'] = rcParams['axes.labelsize']\n        if 'color' not in kwargs:\n            kwargs['color'] = rcParams['axes.labelcolor']\n\n        self._frame = frame\n        super().__init__(*args, **kwargs)\n        self.set_clip_on(True)\n        self.set_visible_axes('all')\n        self.set_ha('center')\n        self.set_va('center')\n        self._minpad = minpad\n        self._visibility_rule = 'labels'\n\n    def get_minpad(self, axis):\n        try:\n            return self._minpad[axis]\n        except TypeError:\n            return self._minpad\n\n    def set_visible_axes(self, visible_axes):\n        self._visible_axes = visible_axes\n\n    def get_visible_axes(self):\n        if self._visible_axes == 'all':\n            return self._frame.keys()\n        else:\n            return [x for x in self._visible_axes if x in self._frame]\n\n    def set_minpad(self, minpad):\n        self._minpad = minpad\n\n    def set_visibility_rule(self, value):\n        allowed = ['always', 'labels', 'ticks']\n        if value not in allowed:\n            raise ValueError(f\"Axis label visibility rule must be one of{' / '.join(allowed)}\")\n\n        self._visibility_rule = value\n\n    def get_visibility_rule(self):\n        return self._visibility_rule\n\n    def draw(self, renderer, bboxes, ticklabels_bbox,\n             coord_ticklabels_bbox, ticks_locs, visible_ticks):\n\n        if not self.get_visible():\n            return\n\n        text_size = renderer.points_to_pixels(self.get_size())\n        # Flatten the bboxes for all coords and all axes\n        ticklabels_bbox_list = []\n        for bbcoord in ticklabels_bbox.values():\n            for bbaxis in bbcoord.values():\n                ticklabels_bbox_list += bbaxis\n\n        for axis in self.get_visible_axes():\n            if self.get_visibility_rule() == 'ticks':\n                if not ticks_locs[axis]:\n                    continue\n            elif self.get_visibility_rule() == 'labels':\n                if not coord_ticklabels_bbox:\n                    continue\n\n            padding = text_size * self.get_minpad(axis)\n\n            # Find position of the axis label. For now we pick the mid-point\n            # along the path but in future we could allow this to be a\n            # parameter.\n            x, y, normal_angle = self._frame[axis]._halfway_x_y_angle()\n\n            label_angle = (normal_angle - 90.) % 360.\n            if 135 < label_angle < 225:\n                label_angle += 180\n            self.set_rotation(label_angle)\n\n            # Find label position by looking at the bounding box of ticks'\n            # labels and the image. It sets the default padding at 1 times the\n            # axis label font size which can also be changed by setting\n            # the minpad parameter.\n\n            if isinstance(self._frame, RectangularFrame):\n\n                if len(ticklabels_bbox_list) > 0 and ticklabels_bbox_list[0] is not None:\n                    coord_ticklabels_bbox[axis] = [mtransforms.Bbox.union(ticklabels_bbox_list)]\n                else:\n                    coord_ticklabels_bbox[axis] = [None]\n\n                visible = axis in visible_ticks and coord_ticklabels_bbox[axis][0] is not None\n\n                if axis == 'l':\n                    if visible:\n                        x = coord_ticklabels_bbox[axis][0].xmin\n                    x = x - padding\n\n                elif axis == 'r':\n                    if visible:\n                        x = coord_ticklabels_bbox[axis][0].x1\n                    x = x + padding\n\n                elif axis == 'b':\n                    if visible:\n                        y = coord_ticklabels_bbox[axis][0].ymin\n                    y = y - padding\n\n                elif axis == 't':\n                    if visible:\n                        y = coord_ticklabels_bbox[axis][0].y1\n                    y = y + padding\n\n            else:  # arbitrary axis\n                x = x + np.cos(np.radians(normal_angle)) * (padding + text_size * 1.5)\n                y = y + np.sin(np.radians(normal_angle)) * (padding + text_size * 1.5)\n\n            self.set_position((x, y))\n            super().draw(renderer)\n\n            bb = super().get_window_extent(renderer)\n            bboxes.append(bb)"},{"col":4,"comment":"null","endLoc":38,"header":"def get_minpad(self, axis)","id":16425,"name":"get_minpad","nodeType":"Function","startLoc":34,"text":"def get_minpad(self, axis):\n        try:\n            return self._minpad[axis]\n        except TypeError:\n            return self._minpad"},{"col":4,"comment":"null","endLoc":47,"header":"def get_visible_axes(self)","id":16426,"name":"get_visible_axes","nodeType":"Function","startLoc":43,"text":"def get_visible_axes(self):\n        if self._visible_axes == 'all':\n            return self._frame.keys()\n        else:\n            return [x for x in self._visible_axes if x in self._frame]"},{"col":4,"comment":"null","endLoc":50,"header":"def set_minpad(self, minpad)","id":16427,"name":"set_minpad","nodeType":"Function","startLoc":49,"text":"def set_minpad(self, minpad):\n        self._minpad = minpad"},{"col":4,"comment":"null","endLoc":57,"header":"def set_visibility_rule(self, value)","id":16428,"name":"set_visibility_rule","nodeType":"Function","startLoc":52,"text":"def set_visibility_rule(self, value):\n        allowed = ['always', 'labels', 'ticks']\n        if value not in allowed:\n            raise ValueError(f\"Axis label visibility rule must be one of{' / '.join(allowed)}\")\n\n        self._visibility_rule = value"},{"col":4,"comment":"\n        Set where ticks should appear\n\n        Parameters\n        ----------\n        position : str\n            The axes on which the ticks for this coordinate should appear.\n            Should be a string containing zero or more of ``'b'``, ``'t'``,\n            ``'l'``, ``'r'``. For example, ``'lb'`` will lead the ticks to be\n            shown on the left and bottom axis.\n        ","endLoc":382,"header":"def set_ticks_position(self, position)","id":16429,"name":"set_ticks_position","nodeType":"Function","startLoc":370,"text":"def set_ticks_position(self, position):\n        \"\"\"\n        Set where ticks should appear\n\n        Parameters\n        ----------\n        position : str\n            The axes on which the ticks for this coordinate should appear.\n            Should be a string containing zero or more of ``'b'``, ``'t'``,\n            ``'l'``, ``'r'``. For example, ``'lb'`` will lead the ticks to be\n            shown on the left and bottom axis.\n        \"\"\"\n        self.ticks.set_visible_axes(position)"},{"col":4,"comment":"null","endLoc":60,"header":"def get_visibility_rule(self)","id":16430,"name":"get_visibility_rule","nodeType":"Function","startLoc":59,"text":"def get_visibility_rule(self):\n        return self._visibility_rule"},{"col":4,"comment":"null","endLoc":137,"header":"def draw(self, renderer, bboxes, ticklabels_bbox,\n             coord_ticklabels_bbox, ticks_locs, visible_ticks)","id":16431,"name":"draw","nodeType":"Function","startLoc":62,"text":"def draw(self, renderer, bboxes, ticklabels_bbox,\n             coord_ticklabels_bbox, ticks_locs, visible_ticks):\n\n        if not self.get_visible():\n            return\n\n        text_size = renderer.points_to_pixels(self.get_size())\n        # Flatten the bboxes for all coords and all axes\n        ticklabels_bbox_list = []\n        for bbcoord in ticklabels_bbox.values():\n            for bbaxis in bbcoord.values():\n                ticklabels_bbox_list += bbaxis\n\n        for axis in self.get_visible_axes():\n            if self.get_visibility_rule() == 'ticks':\n                if not ticks_locs[axis]:\n                    continue\n            elif self.get_visibility_rule() == 'labels':\n                if not coord_ticklabels_bbox:\n                    continue\n\n            padding = text_size * self.get_minpad(axis)\n\n            # Find position of the axis label. For now we pick the mid-point\n            # along the path but in future we could allow this to be a\n            # parameter.\n            x, y, normal_angle = self._frame[axis]._halfway_x_y_angle()\n\n            label_angle = (normal_angle - 90.) % 360.\n            if 135 < label_angle < 225:\n                label_angle += 180\n            self.set_rotation(label_angle)\n\n            # Find label position by looking at the bounding box of ticks'\n            # labels and the image. It sets the default padding at 1 times the\n            # axis label font size which can also be changed by setting\n            # the minpad parameter.\n\n            if isinstance(self._frame, RectangularFrame):\n\n                if len(ticklabels_bbox_list) > 0 and ticklabels_bbox_list[0] is not None:\n                    coord_ticklabels_bbox[axis] = [mtransforms.Bbox.union(ticklabels_bbox_list)]\n                else:\n                    coord_ticklabels_bbox[axis] = [None]\n\n                visible = axis in visible_ticks and coord_ticklabels_bbox[axis][0] is not None\n\n                if axis == 'l':\n                    if visible:\n                        x = coord_ticklabels_bbox[axis][0].xmin\n                    x = x - padding\n\n                elif axis == 'r':\n                    if visible:\n                        x = coord_ticklabels_bbox[axis][0].x1\n                    x = x + padding\n\n                elif axis == 'b':\n                    if visible:\n                        y = coord_ticklabels_bbox[axis][0].ymin\n                    y = y - padding\n\n                elif axis == 't':\n                    if visible:\n                        y = coord_ticklabels_bbox[axis][0].y1\n                    y = y + padding\n\n            else:  # arbitrary axis\n                x = x + np.cos(np.radians(normal_angle)) * (padding + text_size * 1.5)\n                y = y + np.sin(np.radians(normal_angle)) * (padding + text_size * 1.5)\n\n            self.set_position((x, y))\n            super().draw(renderer)\n\n            bb = super().get_window_extent(renderer)\n            bboxes.append(bb)"},{"col":4,"comment":"\n        Set whether ticks are visible or not.\n\n        Parameters\n        ----------\n        visible : bool\n            The visibility of ticks. Setting as ``False`` will hide ticks\n            along this coordinate.\n        ","endLoc":394,"header":"def set_ticks_visible(self, visible)","id":16432,"name":"set_ticks_visible","nodeType":"Function","startLoc":384,"text":"def set_ticks_visible(self, visible):\n        \"\"\"\n        Set whether ticks are visible or not.\n\n        Parameters\n        ----------\n        visible : bool\n            The visibility of ticks. Setting as ``False`` will hide ticks\n            along this coordinate.\n        \"\"\"\n        self.ticks.set_visible(visible)"},{"col":4,"comment":"\n        Set the visual properties for the tick labels.\n\n        Parameters\n        ----------\n        size : float, optional\n            The size of the ticks labels in points\n        color : str or tuple, optional\n            A valid Matplotlib color for the tick labels\n        pad : float, optional\n            Distance in points between tick and label.\n        exclude_overlapping : bool, optional\n            Whether to exclude tick labels that overlap over each other.\n        **kwargs\n            Other keyword arguments are passed to :class:`matplotlib.text.Text`.\n        ","endLoc":422,"header":"def set_ticklabel(self, color=None, size=None, pad=None,\n                      exclude_overlapping=None, **kwargs)","id":16433,"name":"set_ticklabel","nodeType":"Function","startLoc":396,"text":"def set_ticklabel(self, color=None, size=None, pad=None,\n                      exclude_overlapping=None, **kwargs):\n        \"\"\"\n        Set the visual properties for the tick labels.\n\n        Parameters\n        ----------\n        size : float, optional\n            The size of the ticks labels in points\n        color : str or tuple, optional\n            A valid Matplotlib color for the tick labels\n        pad : float, optional\n            Distance in points between tick and label.\n        exclude_overlapping : bool, optional\n            Whether to exclude tick labels that overlap over each other.\n        **kwargs\n            Other keyword arguments are passed to :class:`matplotlib.text.Text`.\n        \"\"\"\n        if size is not None:\n            self.ticklabels.set_size(size)\n        if color is not None:\n            self.ticklabels.set_color(color)\n        if pad is not None:\n            self.ticklabels.set_pad(pad)\n        if exclude_overlapping is not None:\n            self.ticklabels.set_exclude_overlapping(exclude_overlapping)\n        self.ticklabels.set(**kwargs)"},{"col":4,"comment":"\n        Set where tick labels should appear\n\n        Parameters\n        ----------\n        position : str\n            The axes on which the tick labels for this coordinate should\n            appear. Should be a string containing zero or more of ``'b'``,\n            ``'t'``, ``'l'``, ``'r'``. For example, ``'lb'`` will lead the\n            tick labels to be shown on the left and bottom axis.\n        ","endLoc":436,"header":"def set_ticklabel_position(self, position)","id":16434,"name":"set_ticklabel_position","nodeType":"Function","startLoc":424,"text":"def set_ticklabel_position(self, position):\n        \"\"\"\n        Set where tick labels should appear\n\n        Parameters\n        ----------\n        position : str\n            The axes on which the tick labels for this coordinate should\n            appear. Should be a string containing zero or more of ``'b'``,\n            ``'t'``, ``'l'``, ``'r'``. For example, ``'lb'`` will lead the\n            tick labels to be shown on the left and bottom axis.\n        \"\"\"\n        self.ticklabels.set_visible_axes(position)"},{"col":4,"comment":"\n        Set whether the tick labels are visible or not.\n\n        Parameters\n        ----------\n        visible : bool\n            The visibility of ticks. Setting as ``False`` will hide this\n            coordinate's tick labels.\n        ","endLoc":448,"header":"def set_ticklabel_visible(self, visible)","id":16435,"name":"set_ticklabel_visible","nodeType":"Function","startLoc":438,"text":"def set_ticklabel_visible(self, visible):\n        \"\"\"\n        Set whether the tick labels are visible or not.\n\n        Parameters\n        ----------\n        visible : bool\n            The visibility of ticks. Setting as ``False`` will hide this\n            coordinate's tick labels.\n        \"\"\"\n        self.ticklabels.set_visible(visible)"},{"col":4,"comment":"\n        Set the text and optionally visual properties for the axis label.\n\n        Parameters\n        ----------\n        text : str\n            The axis label text.\n        minpad : float, optional\n            The padding for the label in terms of axis label font size.\n        **kwargs\n            Keywords are passed to :class:`matplotlib.text.Text`. These\n            can include keywords to set the ``color``, ``size``, ``weight``, and\n            other text properties.\n        ","endLoc":478,"header":"def set_axislabel(self, text, minpad=1, **kwargs)","id":16436,"name":"set_axislabel","nodeType":"Function","startLoc":450,"text":"def set_axislabel(self, text, minpad=1, **kwargs):\n        \"\"\"\n        Set the text and optionally visual properties for the axis label.\n\n        Parameters\n        ----------\n        text : str\n            The axis label text.\n        minpad : float, optional\n            The padding for the label in terms of axis label font size.\n        **kwargs\n            Keywords are passed to :class:`matplotlib.text.Text`. These\n            can include keywords to set the ``color``, ``size``, ``weight``, and\n            other text properties.\n        \"\"\"\n        fontdict = kwargs.pop('fontdict', None)\n\n        # NOTE: When using plt.xlabel/plt.ylabel, minpad can get set explicitly\n        # to None so we need to make sure that in that case we change to a\n        # default numerical value.\n        if minpad is None:\n            minpad = 1\n\n        self.axislabels.set_text(text)\n        self.axislabels.set_minpad(minpad)\n        self.axislabels.set(**kwargs)\n\n        if fontdict is not None:\n            self.axislabels.update(fontdict)"},{"col":4,"comment":"\n        Get the text for the axis label\n\n        Returns\n        -------\n        label : str\n            The axis label\n        ","endLoc":489,"header":"def get_axislabel(self)","id":16437,"name":"get_axislabel","nodeType":"Function","startLoc":480,"text":"def get_axislabel(self):\n        \"\"\"\n        Get the text for the axis label\n\n        Returns\n        -------\n        label : str\n            The axis label\n        \"\"\"\n        return self.axislabels.get_text()"},{"col":4,"comment":"\n        Render default axis labels if no explicit label is provided.\n\n        Parameters\n        ----------\n        auto_label : `bool`\n            `True` if default labels will be rendered.\n        ","endLoc":500,"header":"def set_auto_axislabel(self, auto_label)","id":16438,"name":"set_auto_axislabel","nodeType":"Function","startLoc":491,"text":"def set_auto_axislabel(self, auto_label):\n        \"\"\"\n        Render default axis labels if no explicit label is provided.\n\n        Parameters\n        ----------\n        auto_label : `bool`\n            `True` if default labels will be rendered.\n        \"\"\"\n        self._auto_axislabel = bool(auto_label)"},{"col":4,"comment":"\n        Render default axis labels if no explicit label is provided.\n\n        Returns\n        -------\n        auto_axislabel : `bool`\n            `True` if default labels will be rendered.\n        ","endLoc":511,"header":"def get_auto_axislabel(self)","id":16439,"name":"get_auto_axislabel","nodeType":"Function","startLoc":502,"text":"def get_auto_axislabel(self):\n        \"\"\"\n        Render default axis labels if no explicit label is provided.\n\n        Returns\n        -------\n        auto_axislabel : `bool`\n            `True` if default labels will be rendered.\n        \"\"\"\n        return self._auto_axislabel"},{"col":4,"comment":"null","endLoc":519,"header":"def _get_default_axislabel(self)","id":16440,"name":"_get_default_axislabel","nodeType":"Function","startLoc":513,"text":"def _get_default_axislabel(self):\n        unit = self.get_format_unit() or self.coord_unit\n\n        if not unit or unit is u.one or self.coord_type in ('longitude', 'latitude'):\n            return f\"{self.default_label}\"\n        else:\n            return f\"{self.default_label} [{unit:latex}]\""},{"col":4,"comment":"\n        Set where axis labels should appear\n\n        Parameters\n        ----------\n        position : str\n            The axes on which the axis label for this coordinate should\n            appear. Should be a string containing zero or more of ``'b'``,\n            ``'t'``, ``'l'``, ``'r'``. For example, ``'lb'`` will lead the\n            axis label to be shown on the left and bottom axis.\n        ","endLoc":533,"header":"def set_axislabel_position(self, position)","id":16441,"name":"set_axislabel_position","nodeType":"Function","startLoc":521,"text":"def set_axislabel_position(self, position):\n        \"\"\"\n        Set where axis labels should appear\n\n        Parameters\n        ----------\n        position : str\n            The axes on which the axis label for this coordinate should\n            appear. Should be a string containing zero or more of ``'b'``,\n            ``'t'``, ``'l'``, ``'r'``. For example, ``'lb'`` will lead the\n            axis label to be shown on the left and bottom axis.\n        \"\"\"\n        self.axislabels.set_visible_axes(position)"},{"attributeType":"null","col":8,"comment":"null","endLoc":25,"id":16442,"name":"_frame","nodeType":"Attribute","startLoc":25,"text":"self._frame"},{"attributeType":"null","col":8,"comment":"null","endLoc":32,"id":16443,"name":"_visibility_rule","nodeType":"Attribute","startLoc":32,"text":"self._visibility_rule"},{"col":4,"comment":"\n        Set the rule used to determine when the axis label is drawn.\n\n        Parameters\n        ----------\n        rule : str\n            If the rule is 'always' axis labels will always be drawn on the\n            axis. If the rule is 'ticks' the label will only be drawn if ticks\n            were drawn on that axis. If the rule is 'labels' the axis label\n            will only be drawn if tick labels were drawn on that axis.\n        ","endLoc":547,"header":"def set_axislabel_visibility_rule(self, rule)","id":16444,"name":"set_axislabel_visibility_rule","nodeType":"Function","startLoc":535,"text":"def set_axislabel_visibility_rule(self, rule):\n        \"\"\"\n        Set the rule used to determine when the axis label is drawn.\n\n        Parameters\n        ----------\n        rule : str\n            If the rule is 'always' axis labels will always be drawn on the\n            axis. If the rule is 'ticks' the label will only be drawn if ticks\n            were drawn on that axis. If the rule is 'labels' the axis label\n            will only be drawn if tick labels were drawn on that axis.\n        \"\"\"\n        self.axislabels.set_visibility_rule(rule)"},{"attributeType":"null","col":8,"comment":"null","endLoc":41,"id":16445,"name":"_visible_axes","nodeType":"Attribute","startLoc":41,"text":"self._visible_axes"},{"attributeType":"null","col":8,"comment":"null","endLoc":31,"id":16446,"name":"_minpad","nodeType":"Attribute","startLoc":31,"text":"self._minpad"},{"col":4,"comment":"\n        Get the rule used to determine when the axis label is drawn.\n        ","endLoc":553,"header":"def get_axislabel_visibility_rule(self, rule)","id":16447,"name":"get_axislabel_visibility_rule","nodeType":"Function","startLoc":549,"text":"def get_axislabel_visibility_rule(self, rule):\n        \"\"\"\n        Get the rule used to determine when the axis label is drawn.\n        \"\"\"\n        return self.axislabels.get_visibility_rule()"},{"col":4,"comment":"null","endLoc":557,"header":"@property\n    def locator(self)","id":16448,"name":"locator","nodeType":"Function","startLoc":555,"text":"@property\n    def locator(self):\n        return self._formatter_locator.locator"},{"col":4,"comment":"null","endLoc":561,"header":"@property\n    def formatter(self)","id":16449,"name":"formatter","nodeType":"Function","startLoc":559,"text":"@property\n    def formatter(self):\n        return self._formatter_locator.formatter"},{"col":4,"comment":"null","endLoc":592,"header":"def _draw_grid(self, renderer)","id":16450,"name":"_draw_grid","nodeType":"Function","startLoc":563,"text":"def _draw_grid(self, renderer):\n\n        renderer.open_group('grid lines')\n\n        self._update_ticks()\n\n        if self.grid_lines_kwargs['visible']:\n            if isinstance(self.frame, RectangularFrame1D):\n                self._update_grid_lines_1d()\n            else:\n                if self._grid_type == 'lines':\n                    self._update_grid_lines()\n                else:\n                    self._update_grid_contour()\n\n            if self._grid_type == 'lines':\n\n                frame_patch = self.frame.patch\n                for path in self.grid_lines:\n                    p = PathPatch(path, **self.grid_lines_kwargs)\n                    p.set_clip_path(frame_patch)\n                    p.draw(renderer)\n\n            elif self._grid is not None:\n\n                for line in self._grid.collections:\n                    line.set(**self.grid_lines_kwargs)\n                    line.draw(renderer)\n\n        renderer.close_group('grid lines')"},{"col":0,"comment":"\n    Draw a curve, taking into account discontinuities.\n\n    Parameters\n    ----------\n    lon_lat : ndarray\n        The longitude and latitude values along the curve, given as a (n,2)\n        array.\n    pixel : ndarray\n        The pixel coordinates corresponding to ``lon_lat``\n    lon_lat_check : ndarray\n        The world coordinates derived from converting from ``pixel``, which is\n        used to ensure round-tripping.\n    ","endLoc":88,"header":"def get_lon_lat_path(lon_lat, pixel, lon_lat_check)","id":16451,"name":"get_lon_lat_path","nodeType":"Function","startLoc":17,"text":"def get_lon_lat_path(lon_lat, pixel, lon_lat_check):\n    \"\"\"\n    Draw a curve, taking into account discontinuities.\n\n    Parameters\n    ----------\n    lon_lat : ndarray\n        The longitude and latitude values along the curve, given as a (n,2)\n        array.\n    pixel : ndarray\n        The pixel coordinates corresponding to ``lon_lat``\n    lon_lat_check : ndarray\n        The world coordinates derived from converting from ``pixel``, which is\n        used to ensure round-tripping.\n    \"\"\"\n\n    # In some spherical projections, some parts of the curve are 'behind' or\n    # 'in front of' the plane of the image, so we find those by reversing the\n    # transformation and finding points where the result is not consistent.\n\n    sep = angular_separation(np.radians(lon_lat[:, 0]),\n                             np.radians(lon_lat[:, 1]),\n                             np.radians(lon_lat_check[:, 0]),\n                             np.radians(lon_lat_check[:, 1]))\n\n    # Define the relevant scale size using the separation between the first two points\n    scale_size = angular_separation(*np.radians(lon_lat[0, :]), *np.radians(lon_lat[1, :]))\n\n    with np.errstate(invalid='ignore'):\n\n        sep[sep > np.pi] -= 2. * np.pi\n\n        mask = np.abs(sep > ROUND_TRIP_RTOL * scale_size)\n\n    # Mask values with invalid pixel positions\n    mask = mask | np.isnan(pixel[:, 0]) | np.isnan(pixel[:, 1])\n\n    # We can now start to set up the codes for the Path.\n    codes = np.zeros(lon_lat.shape[0], dtype=np.uint8)\n    codes[:] = Path.LINETO\n    codes[0] = Path.MOVETO\n    codes[mask] = Path.MOVETO\n\n    # Also need to move to point *after* a hidden value\n    codes[1:][mask[:-1]] = Path.MOVETO\n\n    # We now go through and search for discontinuities in the curve that would\n    # be due to the curve going outside the field of view, invalid WCS values,\n    # or due to discontinuities in the projection.\n\n    # We start off by pre-computing the step in pixel coordinates from one\n    # point to the next. The idea is to look for large jumps that might indicate\n    # discontinuities.\n    step = np.sqrt((pixel[1:, 0] - pixel[:-1, 0]) ** 2 +\n                   (pixel[1:, 1] - pixel[:-1, 1]) ** 2)\n\n    # We search for discontinuities by looking for places where the step\n    # is larger by more than a given factor compared to the median\n    # discontinuous = step > DISCONT_FACTOR * np.median(step)\n    discontinuous = step[1:] > DISCONT_FACTOR * step[:-1]\n\n    # Skip over discontinuities\n    codes[2:][discontinuous] = Path.MOVETO\n\n    # The above missed the first step, so check that too\n    if step[0] > DISCONT_FACTOR * step[1]:\n        codes[1] = Path.MOVETO\n\n    # Create the path\n    path = Path(pixel, codes=codes)\n\n    return path"},{"col":4,"comment":"null","endLoc":749,"header":"def _update_ticks(self)","id":16452,"name":"_update_ticks","nodeType":"Function","startLoc":622,"text":"def _update_ticks(self):\n\n        if self.coord_index is None:\n            return\n\n        # TODO: this method should be optimized for speed\n\n        # Here we determine the location and rotation of all the ticks. For\n        # each axis, we can check the intersections for the specific\n        # coordinate and once we have the tick positions, we can use the WCS\n        # to determine the rotations.\n\n        # Find the range of coordinates in all directions\n        coord_range = self.parent_map.get_coord_range()\n\n        # First find the ticks we want to show\n        tick_world_coordinates, self._fl_spacing = self.locator(*coord_range[self.coord_index])\n\n        if self.ticks.get_display_minor_ticks():\n            minor_ticks_w_coordinates = self._formatter_locator.minor_locator(self._fl_spacing, self.get_minor_frequency(), *coord_range[self.coord_index])\n\n        # We want to allow non-standard rectangular frames, so we just rely on\n        # the parent axes to tell us what the bounding frame is.\n        from . import conf\n        frame = self.frame.sample(conf.frame_boundary_samples)\n\n        self.ticks.clear()\n        self.ticklabels.clear()\n        self.lblinfo = []\n        self.lbl_world = []\n        # Look up parent axes' transform from data to figure coordinates.\n        #\n        # See:\n        # https://matplotlib.org/stable/tutorials/advanced/transforms_tutorial.html#the-transformation-pipeline\n        transData = self.parent_axes.transData\n        invertedTransLimits = transData.inverted()\n\n        for axis, spine in frame.items():\n\n            if not isinstance(self.frame, RectangularFrame1D):\n                # Determine tick rotation in display coordinates and compare to\n                # the normal angle in display coordinates.\n\n                pixel0 = spine.data\n                world0 = spine.world[:, self.coord_index]\n                with np.errstate(invalid='ignore'):\n                    world0 = self.transform.transform(pixel0)[:, self.coord_index]\n                axes0 = transData.transform(pixel0)\n\n                # Advance 2 pixels in figure coordinates\n                pixel1 = axes0.copy()\n                pixel1[:, 0] += 2.0\n                pixel1 = invertedTransLimits.transform(pixel1)\n                with np.errstate(invalid='ignore'):\n                    world1 = self.transform.transform(pixel1)[:, self.coord_index]\n\n                # Advance 2 pixels in figure coordinates\n                pixel2 = axes0.copy()\n                pixel2[:, 1] += 2.0 if self.frame.origin == 'lower' else -2.0\n                pixel2 = invertedTransLimits.transform(pixel2)\n                with np.errstate(invalid='ignore'):\n                    world2 = self.transform.transform(pixel2)[:, self.coord_index]\n\n                dx = (world1 - world0)\n                dy = (world2 - world0)\n\n                # Rotate by 90 degrees\n                dx, dy = -dy, dx\n\n                if self.coord_type == 'longitude':\n\n                    if self._coord_scale_to_deg is not None:\n                        dx *= self._coord_scale_to_deg\n                        dy *= self._coord_scale_to_deg\n\n                    # Here we wrap at 180 not self.coord_wrap since we want to\n                    # always ensure abs(dx) < 180 and abs(dy) < 180\n                    dx = wrap_angle_at(dx, 180.)\n                    dy = wrap_angle_at(dy, 180.)\n\n                tick_angle = np.degrees(np.arctan2(dy, dx))\n\n                normal_angle_full = np.hstack([spine.normal_angle, spine.normal_angle[-1]])\n                with np.errstate(invalid='ignore'):\n                    reset = (((normal_angle_full - tick_angle) % 360 > 90.) &\n                            ((tick_angle - normal_angle_full) % 360 > 90.))\n                tick_angle[reset] -= 180.\n\n            else:\n                rotation = 90 if axis == 'b' else -90\n                tick_angle = np.zeros((conf.frame_boundary_samples,)) + rotation\n\n            # We find for each interval the starting and ending coordinate,\n            # ensuring that we take wrapping into account correctly for\n            # longitudes.\n            w1 = spine.world[:-1, self.coord_index]\n            w2 = spine.world[1:, self.coord_index]\n\n            if self.coord_type == 'longitude':\n\n                if self._coord_scale_to_deg is not None:\n                    w1 = w1 * self._coord_scale_to_deg\n                    w2 = w2 * self._coord_scale_to_deg\n\n                w1 = wrap_angle_at(w1, self.coord_wrap)\n                w2 = wrap_angle_at(w2, self.coord_wrap)\n                with np.errstate(invalid='ignore'):\n                    w1[w2 - w1 > 180.] += 360\n                    w2[w1 - w2 > 180.] += 360\n\n                if self._coord_scale_to_deg is not None:\n                    w1 = w1 / self._coord_scale_to_deg\n                    w2 = w2 / self._coord_scale_to_deg\n\n            # For longitudes, we need to check ticks as well as ticks + 360,\n            # since the above can produce pairs such as 359 to 361 or 0.5 to\n            # 1.5, both of which would match a tick at 0.75. Otherwise we just\n            # check the ticks determined above.\n            self._compute_ticks(tick_world_coordinates, spine, axis, w1, w2, tick_angle)\n\n            if self.ticks.get_display_minor_ticks():\n                self._compute_ticks(minor_ticks_w_coordinates, spine, axis, w1,\n                                    w2, tick_angle, ticks='minor')\n\n        # format tick labels, add to scene\n        text = self.formatter(self.lbl_world * tick_world_coordinates.unit, spacing=self._fl_spacing)\n        for kwargs, txt in zip(self.lblinfo, text):\n            self.ticklabels.add(text=txt, **kwargs)"},{"col":0,"comment":"\n    Take the input WCS and slices and return a sliced WCS for the transform and\n    a mapping of world axes in the sliced WCS to the input WCS.\n    ","endLoc":248,"header":"def apply_slices(wcs, slices)","id":16453,"name":"apply_slices","nodeType":"Function","startLoc":223,"text":"def apply_slices(wcs, slices):\n    \"\"\"\n    Take the input WCS and slices and return a sliced WCS for the transform and\n    a mapping of world axes in the sliced WCS to the input WCS.\n    \"\"\"\n    if isinstance(wcs, SlicedLowLevelWCS):\n        world_keep = list(wcs._world_keep)\n    else:\n        world_keep = list(range(wcs.world_n_dim))\n\n    # world_map is the index of the world axis in the input WCS for a given\n    # axis in the transform_wcs\n    world_map = list(range(wcs.world_n_dim))\n    transform_wcs = wcs\n    invert_xy = False\n    if slices is not None:\n        wcs_slice = list(slices)\n        wcs_slice[wcs_slice.index(\"x\")] = slice(None)\n        if 'y' in slices:\n            wcs_slice[wcs_slice.index(\"y\")] = slice(None)\n            invert_xy = slices.index('x') > slices.index('y')\n\n        transform_wcs = SlicedLowLevelWCS(wcs, wcs_slice[::-1])\n        world_map = tuple(world_keep.index(i) for i in transform_wcs._world_keep)\n\n    return transform_wcs, invert_xy, world_map"},{"col":0,"comment":"\n    Draw a grid line\n\n    Parameters\n    ----------\n    world : ndarray\n        The longitude and latitude values along the curve, given as a (n,2)\n        array.\n    pixel : ndarray\n        The pixel coordinates corresponding to ``lon_lat``\n    ","endLoc":123,"header":"def get_gridline_path(world, pixel)","id":16454,"name":"get_gridline_path","nodeType":"Function","startLoc":91,"text":"def get_gridline_path(world, pixel):\n    \"\"\"\n    Draw a grid line\n\n    Parameters\n    ----------\n    world : ndarray\n        The longitude and latitude values along the curve, given as a (n,2)\n        array.\n    pixel : ndarray\n        The pixel coordinates corresponding to ``lon_lat``\n    \"\"\"\n\n    # Mask values with invalid pixel positions\n    mask = np.isnan(pixel[:, 0]) | np.isnan(pixel[:, 1])\n\n    # We can now start to set up the codes for the Path.\n    codes = np.zeros(world.shape[0], dtype=np.uint8)\n    codes[:] = Path.LINETO\n    codes[0] = Path.MOVETO\n    codes[mask] = Path.MOVETO\n\n    # Also need to move to point *after* a hidden value\n    codes[1:][mask[:-1]] = Path.MOVETO\n\n    # We now go through and search for discontinuities in the curve that would\n    # be due to the curve going outside the field of view, invalid WCS values,\n    # or due to discontinuities in the projection.\n\n    # Create the path\n    path = Path(pixel, codes=codes)\n\n    return path"},{"col":4,"comment":"null","endLoc":163,"header":"def get_coord_range(self)","id":16455,"name":"get_coord_range","nodeType":"Function","startLoc":150,"text":"def get_coord_range(self):\n        xmin, xmax = self._axes.get_xlim()\n\n        if isinstance(self.frame, RectangularFrame1D):\n            extent = [xmin, xmax]\n        else:\n            ymin, ymax = self._axes.get_ylim()\n            extent = [xmin, xmax, ymin, ymax]\n\n        return find_coordinate_range(self._transform,\n                                     extent,\n                                     [coord.coord_type for coord in self if coord.coord_index is not None],\n                                     [coord.coord_unit for coord in self if coord.coord_index is not None],\n                                     [coord.coord_wrap for coord in self if coord.coord_index is not None])"},{"attributeType":"null","col":16,"comment":"null","endLoc":10,"id":16456,"name":"np","nodeType":"Attribute","startLoc":10,"text":"np"},{"attributeType":"null","col":29,"comment":"null","endLoc":18,"id":16457,"name":"u","nodeType":"Attribute","startLoc":18,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":16458,"name":"__all__","nodeType":"Attribute","startLoc":28,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":16459,"name":"LINES_TO_PATCHES_LINESTYLE","nodeType":"Attribute","startLoc":33,"text":"LINES_TO_PATCHES_LINESTYLE"},{"col":0,"comment":"","endLoc":6,"header":"coordinate_helpers.py#<anonymous>","id":16460,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis file defines the classes used to represent a 'coordinate', which includes\naxes, ticks, tick labels, and grid lines.\n\"\"\"\n\n__all__ = ['CoordinateHelper']\n\nLINES_TO_PATCHES_LINESTYLE = {'-': 'solid',\n                              '--': 'dashed',\n                              '-.': 'dashdot',\n                              ':': 'dotted',\n                              'none': 'none',\n                              'None': 'none',\n                              ' ': 'none',\n                              '': 'none'}"},{"col":4,"comment":"null","endLoc":111,"header":"def __getitem__(self, item)","id":16461,"name":"__getitem__","nodeType":"Function","startLoc":107,"text":"def __getitem__(self, item):\n        if isinstance(item, str):\n            return self._coords[self._aliases[item.lower()]]\n        else:\n            return self._coords[item]"},{"col":4,"comment":"null","endLoc":117,"header":"def __contains__(self, item)","id":16462,"name":"__contains__","nodeType":"Function","startLoc":113,"text":"def __contains__(self, item):\n        if isinstance(item, str):\n            return item.lower() in self._aliases\n        else:\n            return 0 <= item < len(self._coords)"},{"col":4,"comment":"null","endLoc":120,"header":"def set_visible(self, visibility)","id":16463,"name":"set_visible","nodeType":"Function","startLoc":119,"text":"def set_visible(self, visibility):\n        raise NotImplementedError()"},{"col":4,"comment":"null","endLoc":124,"header":"def __iter__(self)","id":16464,"name":"__iter__","nodeType":"Function","startLoc":122,"text":"def __iter__(self):\n        for coord in self._coords:\n            yield coord"},{"col":4,"comment":"\n        Plot gridlines for both coordinates.\n\n        Standard matplotlib appearance options (color, alpha, etc.) can be\n        passed as keyword arguments.\n\n        Parameters\n        ----------\n        draw_grid : bool\n            Whether to show the gridlines\n        grid_type : { 'lines' | 'contours' }\n            Whether to plot the contours by determining the grid lines in\n            world coordinates and then plotting them in world coordinates\n            (``'lines'``) or by determining the world coordinates at many\n            positions in the image and then drawing contours\n            (``'contours'``). The first is recommended for 2-d images, while\n            for 3-d (or higher dimensional) cubes, the ``'contours'`` option\n            is recommended. By default, 'lines' is used if the transform has\n            an inverse, otherwise 'contours' is used.\n        ","endLoc":148,"header":"def grid(self, draw_grid=True, grid_type=None, **kwargs)","id":16465,"name":"grid","nodeType":"Function","startLoc":126,"text":"def grid(self, draw_grid=True, grid_type=None, **kwargs):\n        \"\"\"\n        Plot gridlines for both coordinates.\n\n        Standard matplotlib appearance options (color, alpha, etc.) can be\n        passed as keyword arguments.\n\n        Parameters\n        ----------\n        draw_grid : bool\n            Whether to show the gridlines\n        grid_type : { 'lines' | 'contours' }\n            Whether to plot the contours by determining the grid lines in\n            world coordinates and then plotting them in world coordinates\n            (``'lines'``) or by determining the world coordinates at many\n            positions in the image and then drawing contours\n            (``'contours'``). The first is recommended for 2-d images, while\n            for 3-d (or higher dimensional) cubes, the ``'contours'`` option\n            is recommended. By default, 'lines' is used if the transform has\n            an inverse, otherwise 'contours' is used.\n        \"\"\"\n        for coord in self:\n            coord.grid(draw_grid=draw_grid, grid_type=grid_type, **kwargs)"},{"fileName":"grid_paths.py","filePath":"astropy/visualization/wcsaxes","id":16466,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport numpy as np\n\nfrom matplotlib.lines import Path\n\nfrom astropy.coordinates.angle_utilities import angular_separation\n\n# Tolerance for WCS round-tripping, relative to the scale size\nROUND_TRIP_RTOL = 1.\n\n# Tolerance for discontinuities relative to the median\nDISCONT_FACTOR = 10.\n\n\ndef get_lon_lat_path(lon_lat, pixel, lon_lat_check):\n    \"\"\"\n    Draw a curve, taking into account discontinuities.\n\n    Parameters\n    ----------\n    lon_lat : ndarray\n        The longitude and latitude values along the curve, given as a (n,2)\n        array.\n    pixel : ndarray\n        The pixel coordinates corresponding to ``lon_lat``\n    lon_lat_check : ndarray\n        The world coordinates derived from converting from ``pixel``, which is\n        used to ensure round-tripping.\n    \"\"\"\n\n    # In some spherical projections, some parts of the curve are 'behind' or\n    # 'in front of' the plane of the image, so we find those by reversing the\n    # transformation and finding points where the result is not consistent.\n\n    sep = angular_separation(np.radians(lon_lat[:, 0]),\n                             np.radians(lon_lat[:, 1]),\n                             np.radians(lon_lat_check[:, 0]),\n                             np.radians(lon_lat_check[:, 1]))\n\n    # Define the relevant scale size using the separation between the first two points\n    scale_size = angular_separation(*np.radians(lon_lat[0, :]), *np.radians(lon_lat[1, :]))\n\n    with np.errstate(invalid='ignore'):\n\n        sep[sep > np.pi] -= 2. * np.pi\n\n        mask = np.abs(sep > ROUND_TRIP_RTOL * scale_size)\n\n    # Mask values with invalid pixel positions\n    mask = mask | np.isnan(pixel[:, 0]) | np.isnan(pixel[:, 1])\n\n    # We can now start to set up the codes for the Path.\n    codes = np.zeros(lon_lat.shape[0], dtype=np.uint8)\n    codes[:] = Path.LINETO\n    codes[0] = Path.MOVETO\n    codes[mask] = Path.MOVETO\n\n    # Also need to move to point *after* a hidden value\n    codes[1:][mask[:-1]] = Path.MOVETO\n\n    # We now go through and search for discontinuities in the curve that would\n    # be due to the curve going outside the field of view, invalid WCS values,\n    # or due to discontinuities in the projection.\n\n    # We start off by pre-computing the step in pixel coordinates from one\n    # point to the next. The idea is to look for large jumps that might indicate\n    # discontinuities.\n    step = np.sqrt((pixel[1:, 0] - pixel[:-1, 0]) ** 2 +\n                   (pixel[1:, 1] - pixel[:-1, 1]) ** 2)\n\n    # We search for discontinuities by looking for places where the step\n    # is larger by more than a given factor compared to the median\n    # discontinuous = step > DISCONT_FACTOR * np.median(step)\n    discontinuous = step[1:] > DISCONT_FACTOR * step[:-1]\n\n    # Skip over discontinuities\n    codes[2:][discontinuous] = Path.MOVETO\n\n    # The above missed the first step, so check that too\n    if step[0] > DISCONT_FACTOR * step[1]:\n        codes[1] = Path.MOVETO\n\n    # Create the path\n    path = Path(pixel, codes=codes)\n\n    return path\n\n\ndef get_gridline_path(world, pixel):\n    \"\"\"\n    Draw a grid line\n\n    Parameters\n    ----------\n    world : ndarray\n        The longitude and latitude values along the curve, given as a (n,2)\n        array.\n    pixel : ndarray\n        The pixel coordinates corresponding to ``lon_lat``\n    \"\"\"\n\n    # Mask values with invalid pixel positions\n    mask = np.isnan(pixel[:, 0]) | np.isnan(pixel[:, 1])\n\n    # We can now start to set up the codes for the Path.\n    codes = np.zeros(world.shape[0], dtype=np.uint8)\n    codes[:] = Path.LINETO\n    codes[0] = Path.MOVETO\n    codes[mask] = Path.MOVETO\n\n    # Also need to move to point *after* a hidden value\n    codes[1:][mask[:-1]] = Path.MOVETO\n\n    # We now go through and search for discontinuities in the curve that would\n    # be due to the curve going outside the field of view, invalid WCS values,\n    # or due to discontinuities in the projection.\n\n    # Create the path\n    path = Path(pixel, codes=codes)\n\n    return path\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":16467,"name":"ROUND_TRIP_RTOL","nodeType":"Attribute","startLoc":11,"text":"ROUND_TRIP_RTOL"},{"col":4,"comment":"null","endLoc":179,"header":"def _as_table(self)","id":16468,"name":"_as_table","nodeType":"Function","startLoc":165,"text":"def _as_table(self):\n\n        # Import Table here to avoid importing the astropy.table package\n        # every time astropy.visualization.wcsaxes is imported.\n        from astropy.table import Table  # noqa\n\n        rows = []\n        for icoord, coord in enumerate(self._coords):\n            aliases = [key for key, value in self._aliases.items() if value == icoord]\n            row = OrderedDict([('index', icoord), ('aliases', ' '.join(aliases)),\n                               ('type', coord.coord_type), ('unit', coord.coord_unit),\n                               ('wrap', coord.coord_wrap), ('format_unit', coord.get_format_unit()),\n                               ('visible', 'no' if coord.coord_index is None else 'yes')])\n            rows.append(row)\n        return Table(rows=rows)"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":16469,"name":"DISCONT_FACTOR","nodeType":"Attribute","startLoc":14,"text":"DISCONT_FACTOR"},{"col":0,"comment":"","endLoc":4,"header":"grid_paths.py#<anonymous>","id":16470,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"ROUND_TRIP_RTOL = 1.\n\nDISCONT_FACTOR = 10."},{"col":4,"comment":"null","endLoc":847,"header":"def get_minor_frequency(self)","id":16471,"name":"get_minor_frequency","nodeType":"Function","startLoc":846,"text":"def get_minor_frequency(self):\n        return self.minor_frequency"},{"fileName":"transforms.py","filePath":"astropy/visualization/wcsaxes","id":16472,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\n# Note: This file includes code derived from pywcsgrid2\n#\n# This file contains Matplotlib transformation objects (e.g. from pixel to world\n# coordinates, but also world-to-world).\n\nimport abc\n\nimport numpy as np\n\nfrom matplotlib.path import Path\nfrom matplotlib.transforms import Transform\n\nfrom astropy import units as u\nfrom astropy.coordinates import (SkyCoord, frame_transform_graph,\n                                 UnitSphericalRepresentation,\n                                 BaseCoordinateFrame)\n\n__all__ = ['CurvedTransform', 'CoordinateTransform',\n           'World2PixelTransform', 'Pixel2WorldTransform']\n\n\nclass CurvedTransform(Transform, metaclass=abc.ABCMeta):\n    \"\"\"\n    Abstract base class for non-affine curved transforms\n    \"\"\"\n\n    input_dims = 2\n    output_dims = 2\n    is_separable = False\n\n    def transform_path(self, path):\n        \"\"\"\n        Transform a Matplotlib Path\n\n        Parameters\n        ----------\n        path : :class:`~matplotlib.path.Path`\n            The path to transform\n\n        Returns\n        -------\n        path : :class:`~matplotlib.path.Path`\n            The resulting path\n        \"\"\"\n        return Path(self.transform(path.vertices), path.codes)\n\n    transform_path_non_affine = transform_path\n\n    def transform(self, input):\n        raise NotImplementedError(\"\")\n\n    def inverted(self):\n        raise NotImplementedError(\"\")\n\n\nclass CoordinateTransform(CurvedTransform):\n\n    has_inverse = True\n\n    def __init__(self, input_system, output_system):\n        super().__init__()\n        self._input_system_name = input_system\n        self._output_system_name = output_system\n\n        if isinstance(self._input_system_name, str):\n            frame_cls = frame_transform_graph.lookup_name(self._input_system_name)\n            if frame_cls is None:\n                raise ValueError(f\"Frame {self._input_system_name} not found\")\n            else:\n                self.input_system = frame_cls()\n        elif isinstance(self._input_system_name, BaseCoordinateFrame):\n            self.input_system = self._input_system_name\n        else:\n            raise TypeError(\"input_system should be a WCS instance, string, or a coordinate frame instance\")\n\n        if isinstance(self._output_system_name, str):\n            frame_cls = frame_transform_graph.lookup_name(self._output_system_name)\n            if frame_cls is None:\n                raise ValueError(f\"Frame {self._output_system_name} not found\")\n            else:\n                self.output_system = frame_cls()\n\n        elif isinstance(self._output_system_name, BaseCoordinateFrame):\n            self.output_system = self._output_system_name\n        else:\n            raise TypeError(\"output_system should be a WCS instance, string, or a coordinate frame instance\")\n\n        if self.output_system == self.input_system:\n            self.same_frames = True\n        else:\n            self.same_frames = False\n\n    @property\n    def same_frames(self):\n        return self._same_frames\n\n    @same_frames.setter\n    def same_frames(self, same_frames):\n        self._same_frames = same_frames\n\n    def transform(self, input_coords):\n        \"\"\"\n        Transform one set of coordinates to another\n        \"\"\"\n        if self.same_frames:\n            return input_coords\n\n        input_coords = input_coords*u.deg\n        x_in, y_in = input_coords[:, 0], input_coords[:, 1]\n\n        c_in = SkyCoord(UnitSphericalRepresentation(x_in, y_in),\n                        frame=self.input_system)\n\n        # We often need to transform arrays that contain NaN values, and filtering\n        # out the NaN values would have a performance hit, so instead we just pass\n        # on all values and just ignore Numpy warnings\n        with np.errstate(all='ignore'):\n            c_out = c_in.transform_to(self.output_system)\n\n        lon = c_out.spherical.lon.deg\n        lat = c_out.spherical.lat.deg\n\n        return np.concatenate((lon[:, np.newaxis], lat[:, np.newaxis]), axis=1)\n\n    transform_non_affine = transform\n\n    def inverted(self):\n        \"\"\"\n        Return the inverse of the transform\n        \"\"\"\n        return CoordinateTransform(self._output_system_name, self._input_system_name)\n\n\nclass World2PixelTransform(CurvedTransform, metaclass=abc.ABCMeta):\n    \"\"\"\n    Base transformation from world to pixel coordinates\n    \"\"\"\n\n    has_inverse = True\n    frame_in = None\n\n    @property\n    @abc.abstractmethod\n    def input_dims(self):\n        \"\"\"\n        The number of input world dimensions\n        \"\"\"\n\n    @abc.abstractmethod\n    def transform(self, world):\n        \"\"\"\n        Transform world to pixel coordinates. You should pass in a NxM array\n        where N is the number of points to transform, and M is the number of\n        dimensions. This then returns the (x, y) pixel coordinates\n        as a Nx2 array.\n        \"\"\"\n\n    @abc.abstractmethod\n    def inverted(self):\n        \"\"\"\n        Return the inverse of the transform\n        \"\"\"\n\n\nclass Pixel2WorldTransform(CurvedTransform, metaclass=abc.ABCMeta):\n    \"\"\"\n    Base transformation from pixel to world coordinates\n    \"\"\"\n\n    has_inverse = True\n    frame_out = None\n\n    @property\n    @abc.abstractmethod\n    def output_dims(self):\n        \"\"\"\n        The number of output world dimensions\n        \"\"\"\n\n    @abc.abstractmethod\n    def transform(self, pixel):\n        \"\"\"\n        Transform pixel to world coordinates. You should pass in a Nx2 array\n        of (x, y) pixel coordinates to transform to world coordinates. This\n        will then return an NxM array where M is the number of dimensions.\n        \"\"\"\n\n    @abc.abstractmethod\n    def inverted(self):\n        \"\"\"\n        Return the inverse of the transform\n        \"\"\"\n"},{"className":"World2PixelTransform","col":0,"comment":"\n    Base transformation from world to pixel coordinates\n    ","endLoc":165,"id":16473,"nodeType":"Class","startLoc":137,"text":"class World2PixelTransform(CurvedTransform, metaclass=abc.ABCMeta):\n    \"\"\"\n    Base transformation from world to pixel coordinates\n    \"\"\"\n\n    has_inverse = True\n    frame_in = None\n\n    @property\n    @abc.abstractmethod\n    def input_dims(self):\n        \"\"\"\n        The number of input world dimensions\n        \"\"\"\n\n    @abc.abstractmethod\n    def transform(self, world):\n        \"\"\"\n        Transform world to pixel coordinates. You should pass in a NxM array\n        where N is the number of points to transform, and M is the number of\n        dimensions. This then returns the (x, y) pixel coordinates\n        as a Nx2 array.\n        \"\"\"\n\n    @abc.abstractmethod\n    def inverted(self):\n        \"\"\"\n        Return the inverse of the transform\n        \"\"\""},{"col":4,"comment":"\n        The number of input world dimensions\n        ","endLoc":150,"header":"@property\n    @abc.abstractmethod\n    def input_dims(self)","id":16474,"name":"input_dims","nodeType":"Function","startLoc":145,"text":"@property\n    @abc.abstractmethod\n    def input_dims(self):\n        \"\"\"\n        The number of input world dimensions\n        \"\"\""},{"col":4,"comment":"\n        Transform world to pixel coordinates. You should pass in a NxM array\n        where N is the number of points to transform, and M is the number of\n        dimensions. This then returns the (x, y) pixel coordinates\n        as a Nx2 array.\n        ","endLoc":159,"header":"@abc.abstractmethod\n    def transform(self, world)","id":16475,"name":"transform","nodeType":"Function","startLoc":152,"text":"@abc.abstractmethod\n    def transform(self, world):\n        \"\"\"\n        Transform world to pixel coordinates. You should pass in a NxM array\n        where N is the number of points to transform, and M is the number of\n        dimensions. This then returns the (x, y) pixel coordinates\n        as a Nx2 array.\n        \"\"\""},{"col":4,"comment":"\n        Return the inverse of the transform\n        ","endLoc":165,"header":"@abc.abstractmethod\n    def inverted(self)","id":16476,"name":"inverted","nodeType":"Function","startLoc":161,"text":"@abc.abstractmethod\n    def inverted(self):\n        \"\"\"\n        Return the inverse of the transform\n        \"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":142,"id":16477,"name":"has_inverse","nodeType":"Attribute","startLoc":142,"text":"has_inverse"},{"attributeType":"None","col":4,"comment":"null","endLoc":143,"id":16478,"name":"frame_in","nodeType":"Attribute","startLoc":143,"text":"frame_in"},{"className":"Pixel2WorldTransform","col":0,"comment":"\n    Base transformation from pixel to world coordinates\n    ","endLoc":195,"id":16479,"nodeType":"Class","startLoc":168,"text":"class Pixel2WorldTransform(CurvedTransform, metaclass=abc.ABCMeta):\n    \"\"\"\n    Base transformation from pixel to world coordinates\n    \"\"\"\n\n    has_inverse = True\n    frame_out = None\n\n    @property\n    @abc.abstractmethod\n    def output_dims(self):\n        \"\"\"\n        The number of output world dimensions\n        \"\"\"\n\n    @abc.abstractmethod\n    def transform(self, pixel):\n        \"\"\"\n        Transform pixel to world coordinates. You should pass in a Nx2 array\n        of (x, y) pixel coordinates to transform to world coordinates. This\n        will then return an NxM array where M is the number of dimensions.\n        \"\"\"\n\n    @abc.abstractmethod\n    def inverted(self):\n        \"\"\"\n        Return the inverse of the transform\n        \"\"\""},{"col":4,"comment":"\n        The number of output world dimensions\n        ","endLoc":181,"header":"@property\n    @abc.abstractmethod\n    def output_dims(self)","id":16480,"name":"output_dims","nodeType":"Function","startLoc":176,"text":"@property\n    @abc.abstractmethod\n    def output_dims(self):\n        \"\"\"\n        The number of output world dimensions\n        \"\"\""},{"col":4,"comment":"\n        Transform pixel to world coordinates. You should pass in a Nx2 array\n        of (x, y) pixel coordinates to transform to world coordinates. This\n        will then return an NxM array where M is the number of dimensions.\n        ","endLoc":189,"header":"@abc.abstractmethod\n    def transform(self, pixel)","id":16481,"name":"transform","nodeType":"Function","startLoc":183,"text":"@abc.abstractmethod\n    def transform(self, pixel):\n        \"\"\"\n        Transform pixel to world coordinates. You should pass in a Nx2 array\n        of (x, y) pixel coordinates to transform to world coordinates. This\n        will then return an NxM array where M is the number of dimensions.\n        \"\"\""},{"col":4,"comment":"\n        Return the inverse of the transform\n        ","endLoc":195,"header":"@abc.abstractmethod\n    def inverted(self)","id":16482,"name":"inverted","nodeType":"Function","startLoc":191,"text":"@abc.abstractmethod\n    def inverted(self):\n        \"\"\"\n        Return the inverse of the transform\n        \"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":173,"id":16483,"name":"has_inverse","nodeType":"Attribute","startLoc":173,"text":"has_inverse"},{"attributeType":"None","col":4,"comment":"null","endLoc":174,"id":16484,"name":"frame_out","nodeType":"Attribute","startLoc":174,"text":"frame_out"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":16485,"name":"__all__","nodeType":"Attribute","startLoc":21,"text":"__all__"},{"col":0,"comment":"","endLoc":9,"header":"transforms.py#<anonymous>","id":16486,"name":"<anonymous>","nodeType":"Function","startLoc":9,"text":"__all__ = ['CurvedTransform', 'CoordinateTransform',\n           'World2PixelTransform', 'Pixel2WorldTransform']"},{"fileName":"axislabels.py","filePath":"astropy/visualization/wcsaxes","id":16487,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport numpy as np\n\nfrom matplotlib import rcParams\nfrom matplotlib.text import Text\nimport matplotlib.transforms as mtransforms\n\nfrom .frame import RectangularFrame\n\n\nclass AxisLabels(Text):\n\n    def __init__(self, frame, minpad=1, *args, **kwargs):\n\n        # Use rcParams if the following parameters were not specified explicitly\n        if 'weight' not in kwargs:\n            kwargs['weight'] = rcParams['axes.labelweight']\n        if 'size' not in kwargs:\n            kwargs['size'] = rcParams['axes.labelsize']\n        if 'color' not in kwargs:\n            kwargs['color'] = rcParams['axes.labelcolor']\n\n        self._frame = frame\n        super().__init__(*args, **kwargs)\n        self.set_clip_on(True)\n        self.set_visible_axes('all')\n        self.set_ha('center')\n        self.set_va('center')\n        self._minpad = minpad\n        self._visibility_rule = 'labels'\n\n    def get_minpad(self, axis):\n        try:\n            return self._minpad[axis]\n        except TypeError:\n            return self._minpad\n\n    def set_visible_axes(self, visible_axes):\n        self._visible_axes = visible_axes\n\n    def get_visible_axes(self):\n        if self._visible_axes == 'all':\n            return self._frame.keys()\n        else:\n            return [x for x in self._visible_axes if x in self._frame]\n\n    def set_minpad(self, minpad):\n        self._minpad = minpad\n\n    def set_visibility_rule(self, value):\n        allowed = ['always', 'labels', 'ticks']\n        if value not in allowed:\n            raise ValueError(f\"Axis label visibility rule must be one of{' / '.join(allowed)}\")\n\n        self._visibility_rule = value\n\n    def get_visibility_rule(self):\n        return self._visibility_rule\n\n    def draw(self, renderer, bboxes, ticklabels_bbox,\n             coord_ticklabels_bbox, ticks_locs, visible_ticks):\n\n        if not self.get_visible():\n            return\n\n        text_size = renderer.points_to_pixels(self.get_size())\n        # Flatten the bboxes for all coords and all axes\n        ticklabels_bbox_list = []\n        for bbcoord in ticklabels_bbox.values():\n            for bbaxis in bbcoord.values():\n                ticklabels_bbox_list += bbaxis\n\n        for axis in self.get_visible_axes():\n            if self.get_visibility_rule() == 'ticks':\n                if not ticks_locs[axis]:\n                    continue\n            elif self.get_visibility_rule() == 'labels':\n                if not coord_ticklabels_bbox:\n                    continue\n\n            padding = text_size * self.get_minpad(axis)\n\n            # Find position of the axis label. For now we pick the mid-point\n            # along the path but in future we could allow this to be a\n            # parameter.\n            x, y, normal_angle = self._frame[axis]._halfway_x_y_angle()\n\n            label_angle = (normal_angle - 90.) % 360.\n            if 135 < label_angle < 225:\n                label_angle += 180\n            self.set_rotation(label_angle)\n\n            # Find label position by looking at the bounding box of ticks'\n            # labels and the image. It sets the default padding at 1 times the\n            # axis label font size which can also be changed by setting\n            # the minpad parameter.\n\n            if isinstance(self._frame, RectangularFrame):\n\n                if len(ticklabels_bbox_list) > 0 and ticklabels_bbox_list[0] is not None:\n                    coord_ticklabels_bbox[axis] = [mtransforms.Bbox.union(ticklabels_bbox_list)]\n                else:\n                    coord_ticklabels_bbox[axis] = [None]\n\n                visible = axis in visible_ticks and coord_ticklabels_bbox[axis][0] is not None\n\n                if axis == 'l':\n                    if visible:\n                        x = coord_ticklabels_bbox[axis][0].xmin\n                    x = x - padding\n\n                elif axis == 'r':\n                    if visible:\n                        x = coord_ticklabels_bbox[axis][0].x1\n                    x = x + padding\n\n                elif axis == 'b':\n                    if visible:\n                        y = coord_ticklabels_bbox[axis][0].ymin\n                    y = y - padding\n\n                elif axis == 't':\n                    if visible:\n                        y = coord_ticklabels_bbox[axis][0].y1\n                    y = y + padding\n\n            else:  # arbitrary axis\n                x = x + np.cos(np.radians(normal_angle)) * (padding + text_size * 1.5)\n                y = y + np.sin(np.radians(normal_angle)) * (padding + text_size * 1.5)\n\n            self.set_position((x, y))\n            super().draw(renderer)\n\n            bb = super().get_window_extent(renderer)\n            bboxes.append(bb)\n"},{"fileName":"coordinates_map.py","filePath":"astropy/visualization/wcsaxes","id":16488,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom textwrap import indent\nfrom collections import OrderedDict\n\nfrom .coordinate_helpers import CoordinateHelper\nfrom .frame import RectangularFrame, RectangularFrame1D\nfrom .coordinate_range import find_coordinate_range\n\n\nclass CoordinatesMap:\n    \"\"\"\n    A container for coordinate helpers that represents a coordinate system.\n\n    This object can be used to access coordinate helpers by index (like a list)\n    or by name (like a dictionary).\n\n    Parameters\n    ----------\n    axes : :class:`~astropy.visualization.wcsaxes.WCSAxes`\n        The axes the coordinate map belongs to.\n    transform : `~matplotlib.transforms.Transform`, optional\n        The transform for the data.\n    coord_meta : dict, optional\n        A dictionary providing additional metadata. This should include the keys\n        ``type``, ``wrap``, and ``unit``. Each of these should be a list with as\n        many items as the dimension of the coordinate system. The ``type``\n        entries should be one of ``longitude``, ``latitude``, or ``scalar``, the\n        ``wrap`` entries should give, for the longitude, the angle at which the\n        coordinate wraps (and `None` otherwise), and the ``unit`` should give\n        the unit of the coordinates as :class:`~astropy.units.Unit` instances.\n        This can optionally also include a ``format_unit`` entry giving the\n        units to use for the tick labels (if not specified, this defaults to\n        ``unit``).\n    frame_class : type, optional\n        The class for the frame, which should be a subclass of\n        :class:`~astropy.visualization.wcsaxes.frame.BaseFrame`. The default is to use a\n        :class:`~astropy.visualization.wcsaxes.frame.RectangularFrame`\n    previous_frame_path : `~matplotlib.path.Path`, optional\n        When changing the WCS of the axes, the frame instance will change but\n        we might want to keep re-using the same underlying matplotlib\n        `~matplotlib.path.Path` - in that case, this can be passed to this\n        keyword argument.\n    \"\"\"\n\n    def __init__(self, axes, transform=None, coord_meta=None,\n                 frame_class=RectangularFrame, previous_frame_path=None):\n\n        self._axes = axes\n        self._transform = transform\n\n        self.frame = frame_class(axes, self._transform, path=previous_frame_path)\n\n        # Set up coordinates\n        self._coords = []\n        self._aliases = {}\n\n        visible_count = 0\n\n        for index in range(len(coord_meta['type'])):\n\n            # Extract coordinate metadata\n            coord_type = coord_meta['type'][index]\n            coord_wrap = coord_meta['wrap'][index]\n            coord_unit = coord_meta['unit'][index]\n            name = coord_meta['name'][index]\n\n            visible = True\n            if 'visible' in coord_meta:\n                visible = coord_meta['visible'][index]\n\n            format_unit = None\n            if 'format_unit' in coord_meta:\n                format_unit = coord_meta['format_unit'][index]\n\n            default_label = name[0] if isinstance(name, (tuple, list)) else name\n            if 'default_axis_label' in coord_meta:\n                default_label = coord_meta['default_axis_label'][index]\n\n            coord_index = None\n            if visible:\n                visible_count += 1\n                coord_index = visible_count - 1\n\n            self._coords.append(CoordinateHelper(parent_axes=axes,\n                                                 parent_map=self,\n                                                 transform=self._transform,\n                                                 coord_index=coord_index,\n                                                 coord_type=coord_type,\n                                                 coord_wrap=coord_wrap,\n                                                 coord_unit=coord_unit,\n                                                 format_unit=format_unit,\n                                                 frame=self.frame,\n                                                 default_label=default_label))\n\n            # Set up aliases for coordinates\n            if isinstance(name, tuple):\n                for nm in name:\n                    nm = nm.lower()\n                    # Do not replace an alias already in the map if we have\n                    # more than one alias for this axis.\n                    if nm not in self._aliases:\n                        self._aliases[nm] = index\n            else:\n                self._aliases[name.lower()] = index\n\n    def __getitem__(self, item):\n        if isinstance(item, str):\n            return self._coords[self._aliases[item.lower()]]\n        else:\n            return self._coords[item]\n\n    def __contains__(self, item):\n        if isinstance(item, str):\n            return item.lower() in self._aliases\n        else:\n            return 0 <= item < len(self._coords)\n\n    def set_visible(self, visibility):\n        raise NotImplementedError()\n\n    def __iter__(self):\n        for coord in self._coords:\n            yield coord\n\n    def grid(self, draw_grid=True, grid_type=None, **kwargs):\n        \"\"\"\n        Plot gridlines for both coordinates.\n\n        Standard matplotlib appearance options (color, alpha, etc.) can be\n        passed as keyword arguments.\n\n        Parameters\n        ----------\n        draw_grid : bool\n            Whether to show the gridlines\n        grid_type : { 'lines' | 'contours' }\n            Whether to plot the contours by determining the grid lines in\n            world coordinates and then plotting them in world coordinates\n            (``'lines'``) or by determining the world coordinates at many\n            positions in the image and then drawing contours\n            (``'contours'``). The first is recommended for 2-d images, while\n            for 3-d (or higher dimensional) cubes, the ``'contours'`` option\n            is recommended. By default, 'lines' is used if the transform has\n            an inverse, otherwise 'contours' is used.\n        \"\"\"\n        for coord in self:\n            coord.grid(draw_grid=draw_grid, grid_type=grid_type, **kwargs)\n\n    def get_coord_range(self):\n        xmin, xmax = self._axes.get_xlim()\n\n        if isinstance(self.frame, RectangularFrame1D):\n            extent = [xmin, xmax]\n        else:\n            ymin, ymax = self._axes.get_ylim()\n            extent = [xmin, xmax, ymin, ymax]\n\n        return find_coordinate_range(self._transform,\n                                     extent,\n                                     [coord.coord_type for coord in self if coord.coord_index is not None],\n                                     [coord.coord_unit for coord in self if coord.coord_index is not None],\n                                     [coord.coord_wrap for coord in self if coord.coord_index is not None])\n\n    def _as_table(self):\n\n        # Import Table here to avoid importing the astropy.table package\n        # every time astropy.visualization.wcsaxes is imported.\n        from astropy.table import Table  # noqa\n\n        rows = []\n        for icoord, coord in enumerate(self._coords):\n            aliases = [key for key, value in self._aliases.items() if value == icoord]\n            row = OrderedDict([('index', icoord), ('aliases', ' '.join(aliases)),\n                               ('type', coord.coord_type), ('unit', coord.coord_unit),\n                               ('wrap', coord.coord_wrap), ('format_unit', coord.get_format_unit()),\n                               ('visible', 'no' if coord.coord_index is None else 'yes')])\n            rows.append(row)\n        return Table(rows=rows)\n\n    def __repr__(self):\n        s = f'<CoordinatesMap with {len(self._coords)} world coordinates:\\n\\n'\n        table = indent(str(self._as_table()), '  ')\n        return s + table + '\\n\\n>'\n"},{"id":16489,"name":"astropy/visualization/wcsaxes/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/visualization/wcsaxes/tests","id":16490,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# This sub-package makes use of image testing with the pytest-mpl package:\n#\n# https://pypi.org/project/pytest-mpl\n#\n# For more information on writing image tests, see the 'Image tests with\n# pytest-mpl' section of the developer docs.\n"},{"id":16491,"name":"astropy/visualization/wcsaxes/tests/data","nodeType":"Package"},{"id":16492,"name":"cube_header","nodeType":"TextFile","path":"astropy/visualization/wcsaxes/tests/data","text":"WCSAXES =                    3 / Number of coordinate axes                      \nCRPIX1  =               -799.0 / Pixel coordinate of reference point            \nCRPIX2  =            -4741.913 / Pixel coordinate of reference point            \nCRPIX3  =               -187.0 / Pixel coordinate of reference point            \nCDELT1  =         -0.006388889 / [deg] Coordinate increment at reference point  \nCDELT2  =          0.006388889 / [deg] Coordinate increment at reference point  \nCDELT3  =             66.42361 / [m s-1] Coordinate increment at reference point\nCUNIT1  = 'deg'                / Units of coordinate increment and value        \nCUNIT2  = 'deg'                / Units of coordinate increment and value        \nCUNIT3  = 'm s-1'              / Units of coordinate increment and value        \nCTYPE1  = 'RA---SFL'           / Right ascension, Sanson-Flamsteed projection   \nCTYPE2  = 'DEC--SFL'           / Declination, Sanson-Flamsteed projection       \nCTYPE3  = 'VOPT'               / Optical velocity (linear)                      \nCRVAL1  =        57.6599999999 / [deg] Coordinate value at reference point      \nCRVAL2  =                  0.0 / [deg] Coordinate value at reference point      \nCRVAL3  =       -9959.44378305 / [m s-1] Coordinate value at reference point    \nLONPOLE =                  0.0 / [deg] Native longitude of celestial pole       \nLATPOLE =                 90.0 / [deg] Native latitude of celestial pole        \nEQUINOX =                  0.0 / [yr] Equinox of equatorial coordinates         \nSPECSYS = 'LSRK'               / Reference frame of spectral coordinates        "},{"id":16493,"name":"slice_header","nodeType":"TextFile","path":"astropy/visualization/wcsaxes/tests/data","text":"WCSAXES =                    2 / Number of coordinate axes\nCRPIX1  =                  1.0 / Pixel coordinate of reference point\nCRPIX2  =                 99.0 / Pixel coordinate of reference point\nCDELT1  =     0.00416666666667 / [deg] Coordinate increment at reference point\nCDELT2  =               1000.0 / [m s-1] Coordinate increment at reference point\nCUNIT1  = 'deg'                / Units of coordinate increment and value\nCUNIT2  = 'm s-1'              / Units of coordinate increment and value\nCTYPE1  = 'OFFSET'             / Coordinate type code\nCTYPE2  = 'VRAD'               / Radio velocity (linear)\nCRVAL1  =                  0.0 / [deg] Coordinate value at reference point\nCRVAL2  =              50000.0 / [m s-1] Coordinate value at reference point\nLONPOLE =                  0.0 / [deg] Native longitude of celestial pole\nLATPOLE =                 90.0 / [deg] Native latitude of celestial pole\nRESTFRQ =         4829659400.0 / [Hz] Line rest frequency\nEQUINOX =               2000.0 / [yr] Equinox of equatorial coordinates\nSPECSYS = 'LSRK'               / Reference frame of spectral coordinates        "},{"id":16494,"name":"2MASS_k_header","nodeType":"TextFile","path":"astropy/visualization/wcsaxes/tests/data","text":"WCSAXES =                    2 / Number of coordinate axes                      \nCRPIX1  =                361.0 / Pixel coordinate of reference point            \nCRPIX2  =                360.5 / Pixel coordinate of reference point            \nCDELT1  =         -0.001388889 / [deg] Coordinate increment at reference point  \nCDELT2  =          0.001388889 / [deg] Coordinate increment at reference point  \nCUNIT1  = 'deg'                / Units of coordinate increment and value        \nCUNIT2  = 'deg'                / Units of coordinate increment and value        \nCTYPE1  = 'RA---TAN'           / Right ascension, gnomonic projection           \nCTYPE2  = 'DEC--TAN'           / Declination, gnomonic projection               \nCRVAL1  =                266.4 / [deg] Coordinate value at reference point      \nCRVAL2  =            -28.93333 / [deg] Coordinate value at reference point      \nLONPOLE =                180.0 / [deg] Native longitude of celestial pole       \nLATPOLE =            -28.93333 / [deg] Native latitude of celestial pole        \nEQUINOX =               2000.0 / [yr] Equinox of equatorial coordinates         "},{"id":16495,"name":"rosat_header","nodeType":"TextFile","path":"astropy/visualization/wcsaxes/tests/data","text":"WCSAXES =                    2 / Number of coordinate axes                      \nCRPIX1  =                240.5 / Pixel coordinate of reference point            \nCRPIX2  =                120.5 / Pixel coordinate of reference point            \nCDELT1  =               -0.675 / [deg] Coordinate increment at reference point  \nCDELT2  =                0.675 / [deg] Coordinate increment at reference point  \nCUNIT1  = 'deg'                / Units of coordinate increment and value        \nCUNIT2  = 'deg'                / Units of coordinate increment and value        \nCTYPE1  = 'GLON-AIT'           / galactic longitude, Hammer-Aitoff projection   \nCTYPE2  = 'GLAT-AIT'           / galactic latitude, Hammer-Aitoff projection    \nCRVAL1  =                  0.0 / [deg] Coordinate value at reference point      \nCRVAL2  =                  0.0 / [deg] Coordinate value at reference point      \nLONPOLE =                  0.0 / [deg] Native longitude of celestial pole       \nLATPOLE =                 90.0 / [deg] Native latitude of celestial pole        "},{"id":16496,"name":"msx_header","nodeType":"TextFile","path":"astropy/visualization/wcsaxes/tests/data","text":"WCSAXES =                    2 / Number of coordinate axes                      \nCRPIX1  =               75.907 / Pixel coordinate of reference point            \nCRPIX2  =              74.8485 / Pixel coordinate of reference point            \nCDELT1  =      -0.006666666828 / [deg] Coordinate increment at reference point  \nCDELT2  =       0.006666666828 / [deg] Coordinate increment at reference point  \nCUNIT1  = 'deg'                / Units of coordinate increment and value        \nCUNIT2  = 'deg'                / Units of coordinate increment and value        \nCTYPE1  = 'GLON-CAR'           / galactic longitude, plate caree projection     \nCTYPE2  = 'GLAT-CAR'           / galactic latitude, plate caree projection      \nCRVAL1  =                  0.0 / [deg] Coordinate value at reference point      \nCRVAL2  =                  0.0 / [deg] Coordinate value at reference point      \nLONPOLE =                  0.0 / [deg] Native longitude of celestial pole       \nLATPOLE =                 90.0 / [deg] Native latitude of celestial pole        "},{"id":16497,"name":"cextern/expat","nodeType":"Package"},{"id":16498,"name":"AUTHORS","nodeType":"TextFile","path":"cextern/expat","text":"Expat is brought to you by:\n\nClark Cooper\nFred L. Drake, Jr.\nGreg Stein\nJames Clark\nKarl Waclawek\nRhodri James\nSebastian Pipping\nSteven Solie\n"},{"id":16499,"name":".gitignore","nodeType":"TextFile","path":"cextern/expat","text":"/autom4te.cache/\nm4/\nCMakeFiles/\nTesting/\naclocal.m4\nCMakeCache.txt\ncmake_install.cmake\nCTestTestfile.cmake\ninstall_manifest.txt\nMakefile\n.deps\nMakefile.in\n.libs\n*.la\nconfigure\nconfig.cache\nconfig.log\nconfig.status\nexpat_config.h.in\nexpat_config.h\nlibtool\nexpat.ncb\nexpat.opt\n.project\nexpat.pc\n*.gcda\n*.gcno\n*.gcov\n*.nccout\n*.expand\n/callgraph.svg\n/libexpat.so.*\n/run.sh\nbuild__R*\ncoverage__R*\nsource__R*\n/expat-*.tar.bz2\n/expat-*.tar.bz2.asc\n/stamp-h1\n/libexpat*.dll\n/changelog\n"},{"id":16500,"name":"COPYING","nodeType":"TextFile","path":"cextern/expat","text":"Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper\nCopyright (c) 2001-2017 Expat maintainers\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"},{"id":16501,"name":"expat_config.h","nodeType":"TextFile","path":"cextern/expat","text":"/* expat_config.h.  Generated from expat_config.h.in by configure.  */\n/* expat_config.h.in.  Generated from configure.ac by autoheader.  */\n\n/* Define if building universal (internal helper macro) */\n/* #undef AC_APPLE_UNIVERSAL_BUILD */\n\n/* 1234 = LILENDIAN, 4321 = BIGENDIAN */\n#define BYTEORDER 1234\n\n/* Define to 1 if you have the `arc4random' function. */\n/* #undef HAVE_ARC4RANDOM */\n\n/* Define to 1 if you have the `arc4random_buf' function. */\n/* #undef HAVE_ARC4RANDOM_BUF */\n\n/* Define to 1 if you have the <dlfcn.h> header file. */\n#define HAVE_DLFCN_H 1\n\n/* Define to 1 if you have the <fcntl.h> header file. */\n#define HAVE_FCNTL_H 1\n\n/* Define to 1 if you have the `getpagesize' function. */\n#define HAVE_GETPAGESIZE 1\n\n/* Define to 1 if you have the `getrandom' function. */\n/* #undef HAVE_GETRANDOM */\n\n/* Define to 1 if you have the <inttypes.h> header file. */\n#define HAVE_INTTYPES_H 1\n\n/* Define to 1 if you have the `bsd' library (-lbsd). */\n/* #undef HAVE_LIBBSD */\n\n/* Define to 1 if you have the <memory.h> header file. */\n#define HAVE_MEMORY_H 1\n\n/* Define to 1 if you have a working `mmap' system call. */\n#define HAVE_MMAP 1\n\n/* Define to 1 if you have the <stdint.h> header file. */\n#define HAVE_STDINT_H 1\n\n/* Define to 1 if you have the <stdlib.h> header file. */\n#define HAVE_STDLIB_H 1\n\n/* Define to 1 if you have the <strings.h> header file. */\n#define HAVE_STRINGS_H 1\n\n/* Define to 1 if you have the <string.h> header file. */\n#define HAVE_STRING_H 1\n\n/* Define to 1 if you have `syscall' and `SYS_getrandom'. */\n/* #undef HAVE_SYSCALL_GETRANDOM */\n\n/* Define to 1 if you have the <sys/param.h> header file. */\n#define HAVE_SYS_PARAM_H 1\n\n/* Define to 1 if you have the <sys/stat.h> header file. */\n#define HAVE_SYS_STAT_H 1\n\n/* Define to 1 if you have the <sys/types.h> header file. */\n#define HAVE_SYS_TYPES_H 1\n\n/* Define to 1 if you have the <unistd.h> header file. */\n#define HAVE_UNISTD_H 1\n\n/* Define to the sub-directory where libtool stores uninstalled libraries. */\n#define LT_OBJDIR \".libs/\"\n\n/* Name of package */\n#define PACKAGE \"expat\"\n\n/* Define to the address where bug reports for this package should be sent. */\n#define PACKAGE_BUGREPORT \"expat-bugs@libexpat.org\"\n\n/* Define to the full name of this package. */\n#define PACKAGE_NAME \"expat\"\n\n/* Define to the full name and version of this package. */\n#define PACKAGE_STRING \"expat 2.2.9\"\n\n/* Define to the one symbol short name of this package. */\n#define PACKAGE_TARNAME \"expat\"\n\n/* Define to the home page for this package. */\n#define PACKAGE_URL \"\"\n\n/* Define to the version of this package. */\n#define PACKAGE_VERSION \"2.2.9\"\n\n/* Define to 1 if you have the ANSI C header files. */\n#define STDC_HEADERS 1\n\n/* Version number of package */\n#define VERSION \"2.2.9\"\n\n/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most\n   significant byte first (like Motorola and SPARC, unlike Intel). */\n#if defined AC_APPLE_UNIVERSAL_BUILD\n# if defined __BIG_ENDIAN__\n#  define WORDS_BIGENDIAN 1\n# endif\n#else\n# ifndef WORDS_BIGENDIAN\n/* #  undef WORDS_BIGENDIAN */\n# endif\n#endif\n\n/* Define to allow retrieving the byte offsets for attribute names and values.\n   */\n/* #undef XML_ATTR_INFO */\n\n/* Define to specify how much context to retain around the current parse\n   point. */\n#define XML_CONTEXT_BYTES 1024\n\n/* Define to include code reading entropy from `/dev/urandom'. */\n#define XML_DEV_URANDOM 1\n\n/* Define to make parameter entity parsing functionality available. */\n#define XML_DTD 1\n\n/* Define to make XML Namespaces functionality available. */\n#define XML_NS 1\n\n/* Define to empty if `const' does not conform to ANSI C. */\n/* #undef const */\n\n/* Define to `long int' if <sys/types.h> does not define. */\n/* #undef off_t */\n\n/* Define to `unsigned int' if <sys/types.h> does not define. */\n/* #undef size_t */\n"},{"id":16502,"name":"expat_config.h.in","nodeType":"TextFile","path":"cextern/expat","text":"/* expat_config.h.in.  Generated from configure.ac by autoheader.  */\n\n/* Define if building universal (internal helper macro) */\n#undef AC_APPLE_UNIVERSAL_BUILD\n\n/* 1234 = LILENDIAN, 4321 = BIGENDIAN */\n#undef BYTEORDER\n\n/* Define to 1 if you have the `arc4random' function. */\n#undef HAVE_ARC4RANDOM\n\n/* Define to 1 if you have the `arc4random_buf' function. */\n#undef HAVE_ARC4RANDOM_BUF\n\n/* Define to 1 if you have the <dlfcn.h> header file. */\n#undef HAVE_DLFCN_H\n\n/* Define to 1 if you have the <fcntl.h> header file. */\n#undef HAVE_FCNTL_H\n\n/* Define to 1 if you have the `getpagesize' function. */\n#undef HAVE_GETPAGESIZE\n\n/* Define to 1 if you have the `getrandom' function. */\n#undef HAVE_GETRANDOM\n\n/* Define to 1 if you have the <inttypes.h> header file. */\n#undef HAVE_INTTYPES_H\n\n/* Define to 1 if you have the `bsd' library (-lbsd). */\n#undef HAVE_LIBBSD\n\n/* Define to 1 if you have the <memory.h> header file. */\n#undef HAVE_MEMORY_H\n\n/* Define to 1 if you have a working `mmap' system call. */\n#undef HAVE_MMAP\n\n/* Define to 1 if you have the <stdint.h> header file. */\n#undef HAVE_STDINT_H\n\n/* Define to 1 if you have the <stdlib.h> header file. */\n#undef HAVE_STDLIB_H\n\n/* Define to 1 if you have the <strings.h> header file. */\n#undef HAVE_STRINGS_H\n\n/* Define to 1 if you have the <string.h> header file. */\n#undef HAVE_STRING_H\n\n/* Define to 1 if you have `syscall' and `SYS_getrandom'. */\n#undef HAVE_SYSCALL_GETRANDOM\n\n/* Define to 1 if you have the <sys/param.h> header file. */\n#undef HAVE_SYS_PARAM_H\n\n/* Define to 1 if you have the <sys/stat.h> header file. */\n#undef HAVE_SYS_STAT_H\n\n/* Define to 1 if you have the <sys/types.h> header file. */\n#undef HAVE_SYS_TYPES_H\n\n/* Define to 1 if you have the <unistd.h> header file. */\n#undef HAVE_UNISTD_H\n\n/* Define to the sub-directory where libtool stores uninstalled libraries. */\n#undef LT_OBJDIR\n\n/* Name of package */\n#undef PACKAGE\n\n/* Define to the address where bug reports for this package should be sent. */\n#undef PACKAGE_BUGREPORT\n\n/* Define to the full name of this package. */\n#undef PACKAGE_NAME\n\n/* Define to the full name and version of this package. */\n#undef PACKAGE_STRING\n\n/* Define to the one symbol short name of this package. */\n#undef PACKAGE_TARNAME\n\n/* Define to the home page for this package. */\n#undef PACKAGE_URL\n\n/* Define to the version of this package. */\n#undef PACKAGE_VERSION\n\n/* Define to 1 if you have the ANSI C header files. */\n#undef STDC_HEADERS\n\n/* Version number of package */\n#undef VERSION\n\n/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most\n   significant byte first (like Motorola and SPARC, unlike Intel). */\n#if defined AC_APPLE_UNIVERSAL_BUILD\n# if defined __BIG_ENDIAN__\n#  define WORDS_BIGENDIAN 1\n# endif\n#else\n# ifndef WORDS_BIGENDIAN\n#  undef WORDS_BIGENDIAN\n# endif\n#endif\n\n/* Define to allow retrieving the byte offsets for attribute names and values.\n   */\n#undef XML_ATTR_INFO\n\n/* Define to specify how much context to retain around the current parse\n   point. */\n#undef XML_CONTEXT_BYTES\n\n/* Define to include code reading entropy from `/dev/urandom'. */\n#undef XML_DEV_URANDOM\n\n/* Define to make parameter entity parsing functionality available. */\n#undef XML_DTD\n\n/* Define to make XML Namespaces functionality available. */\n#undef XML_NS\n\n/* Define to empty if `const' does not conform to ANSI C. */\n#undef const\n\n/* Define to `long int' if <sys/types.h> does not define. */\n#undef off_t\n\n/* Define to `unsigned int' if <sys/types.h> does not define. */\n#undef size_t\n"},{"attributeType":"null","col":16,"comment":"null","endLoc":3,"id":16503,"name":"np","nodeType":"Attribute","startLoc":3,"text":"np"},{"attributeType":"null","col":29,"comment":"null","endLoc":6,"id":16504,"name":"u","nodeType":"Attribute","startLoc":6,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":16505,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"attributeType":"WCS","col":0,"comment":"null","endLoc":17,"id":16506,"name":"IDENTITY","nodeType":"Attribute","startLoc":17,"text":"IDENTITY"},{"id":16507,"name":"Changes","nodeType":"TextFile","path":"cextern/expat","text":"NOTE: We are looking for help with a few things:\n      https://github.com/libexpat/libexpat/labels/help%20wanted\n      If you can help, please get in touch.  Thanks!\n\nRelease 2.2.9 Wed Septemper 25 2019\n        Other changes:\n                  examples: Drop executable bits from elements.c\n            #349  Windows: Change the name of the Windows DLLs from expat*.dll\n                    to libexpat*.dll once more (regression from 2.2.8, first\n                    fixed in 1.95.3, issue #61 on SourceForge today,\n                    was issue #432456 back then); needs a fix due\n                    case-insensitive file systems on Windows and the fact that\n                    Perl's XML::Parser::Expat compiles into Expat.dll.\n            #347  Windows: Only define _CRT_RAND_S if not defined\n                  Version info bumped from 7:10:6 to 7:11:6\n\n        Special thanks to:\n            Ben Wagner\n\nRelease 2.2.8 Fri Septemper 13 2019\n        Security fixes:\n       #317 #318  CVE-2019-15903 -- Fix heap overflow triggered by\n                    XML_GetCurrentLineNumber (or XML_GetCurrentColumnNumber),\n                    and deny internal entities closing the doctype;\n                    fixed in commit c20b758c332d9a13afbbb276d30db1d183a85d43\n\n        Bug fixes:\n            #240  Fix cases where XML_StopParser did not have any effect\n                    when called from inside of an end element handler\n            #341  xmlwf: Fix exit code for operation without \"-d DIRECTORY\";\n                    previously, only \"-d DIRECTORY\" would give you a proper\n                    exit code:\n                      # xmlwf -d . <<<'<not well-formed>' 2>/dev/null ; echo $?\n                      2\n                      # xmlwf <<<'<not well-formed>' 2>/dev/null ; echo $?\n                      0\n                    Now both cases return exit code 2.\n\n        Other changes:\n       #299 #302  Windows: Replace LoadLibrary hack to access\n                    unofficial API function SystemFunction036 (RtlGenRandom)\n                    by using official API function rand_s (needs WinXP+)\n            #325  Windows: Drop support for Visual Studio <=7.1/2003\n                    and document supported compilers in README.md\n            #286  Windows: Remove COM code from xmlwf; in case it turns\n                    out needed later, there will be a dedicated repository\n                    below https://github.com/libexpat/ for that code\n            #322  Windows: Remove explicit MSVC solution and project files.\n                    You can generate Visual Studio solution files through\n                    CMake, e.g.: cmake -G\"Visual Studio 15 2017\" .\n            #338  xmlwf: Make \"xmlwf -h\" help output more friendly\n            #339  examples: Improve elements.c\n       #244 #264  Autotools: Add argument --enable-xml-attr-info\n       #239 #301  Autotools: Add arguments\n                    --with-getrandom\n                    --without-getrandom\n                    --with-sys-getrandom\n                    --without-sys-getrandom\n       #312 #343  Autotools: Fix linking issues with \"./configure LD=clang\"\n                  Autotools: Fix \"make run-xmltest\" for out-of-source builds\n       #329 #336  CMake: Pull all options from Expat <=2.2.7 into namespace\n                    prefix EXPAT_ with the exception of DOCBOOK_TO_MAN:\n                    - BUILD_doc            -> EXPAT_BUILD_DOCS (plural)\n                    - BUILD_examples       -> EXPAT_BUILD_EXAMPLES\n                    - BUILD_shared         -> EXPAT_SHARED_LIBS\n                    - BUILD_tests          -> EXPAT_BUILD_TESTS\n                    - BUILD_tools          -> EXPAT_BUILD_TOOLS\n                    - DOCBOOK_TO_MAN       -> DOCBOOK_TO_MAN (unchanged)\n                    - INSTALL              -> EXPAT_ENABLE_INSTALL\n                    - MSVC_USE_STATIC_CRT  -> EXPAT_MSVC_STATIC_CRT\n                    - USE_libbsd           -> EXPAT_WITH_LIBBSD\n                    - WARNINGS_AS_ERRORS   -> EXPAT_WARNINGS_AS_ERRORS\n                    - XML_CONTEXT_BYTES    -> EXPAT_CONTEXT_BYTES\n                    - XML_DEV_URANDOM      -> EXPAT_DEV_URANDOM\n                    - XML_DTD              -> EXPAT_DTD\n                    - XML_NS               -> EXPAT_NS\n                    - XML_UNICODE          -> EXPAT_CHAR_TYPE=ushort (!)\n                    - XML_UNICODE_WCHAR_T  -> EXPAT_CHAR_TYPE=wchar_t (!)\n       #244 #264  CMake: Add argument -DEXPAT_ATTR_INFO=(ON|OFF),\n                    default OFF\n            #326  CMake: Add argument -DEXPAT_LARGE_SIZE=(ON|OFF),\n                    default OFF\n            #328  CMake: Add argument -DEXPAT_MIN_SIZE=(ON|OFF),\n                    default OFF\n       #239 #277  CMake: Add arguments\n                    -DEXPAT_WITH_GETRANDOM=(ON|OFF|AUTO), default AUTO\n                    -DEXPAT_WITH_SYS_GETRANDOM=(ON|OFF|AUTO), default AUTO\n            #326  CMake: Install expat_config.h to include directory\n            #326  CMake: Generate and install configuration files for\n                    future find_package(expat [..] CONFIG [..])\n                  CMake: Now produces a summary of applied configuration\n                  CMake: Require C++ compiler only when tests are enabled\n            #330  CMake: Fix compilation for 16bit character types,\n                    i.e. ex -DXML_UNICODE=ON (and ex -DXML_UNICODE_WCHAR_T=ON)\n            #265  CMake: Fix linking with MinGW\n            #330  CMake: Add full support for MinGW; to enable, use\n                    -DCMAKE_TOOLCHAIN_FILE=[expat]/cmake/mingw-toolchain.cmake\n            #330  CMake: Port \"make run-xmltest\" from GNU Autotools to CMake\n            #316  CMake: Windows: Make binary postfix match MSVC\n                    Old: expat[d].lib\n                    New: expat[w][d][MD|MT].lib\n                  CMake: Migrate files from Windows to Unix line endings\n            #308  CMake: Integrate OSS-Fuzz fuzzers, option\n                    -DEXPAT_BUILD_FUZZERS=(ON|OFF), default OFF\n             #14  Drop an OpenVMS support leftover\n    #235 #268 ..\n    #270 #310 ..\n  #313 #331 #333  Address compiler warnings\n    #282 #283 ..\n       #284 #285  Address cppcheck warnings\n       #294 #295  Address Clang Static Analyzer warnings\n        #24 #293  Mass-apply clang-format 9 (and ensure conformance during CI)\n                  Version info bumped from 7:9:6 to 7:10:6\n\n        Special thanks to:\n            David Loffredo\n            Joonun Jang\n            Khajapasha Mohammed\n            Kishore Kunche\n            Marco Maggi\n            Mitch Phillips\n            Rolf Ade\n            xantares\n            Zhongyuan Zhou\n\nRelease 2.2.7 Wed June 19 2019\n        Security fixes:\n       #186 #262  CVE-2018-20843 -- Fix extraction of namespace prefixes from\n                    XML names; XML names with multiple colons could end up in\n                    the wrong namespace, and take a high amount of RAM and CPU\n                    resources while processing, opening the door to\n                    use for denial-of-service attacks\n\n        Other changes:\n       #195 #197  Autotools/CMake: Utilize -fvisibility=hidden to stop\n                    exporting non-API symbols\n            #227  Autotools: Add --without-examples and --without-tests\n            #228  Autotools: Modernize configure.ac\n       #245 #246  Autotools: Fix check for -fvisibility=hidden for Clang\n       #247 #248  Autotools: Fix compilation for lack of docbook2x-man\n       #236 #258  Autotools: Produce .tar.{gz,lz,xz} release archives\n            #212  CMake: Make libdir of pkgconfig expat.pc support multilib\n       #158 #263  CMake: Build man page in PROJECT_BINARY_DIR not _SOURCE_DIR\n            #219  Remove fallback to bcopy, assume that memmove(3) exists\n            #257  Use portable \"/usr/bin/env bash\" shebang (e.g. for OpenBSD)\n            #243  Windows: Fix syntax of .def module definition files\n                  Version info bumped from 7:8:6 to 7:9:6\n\n        Special thanks to:\n            Benjamin Peterson\n            Caolán McNamara\n            Hanno Böck\n            KangLin\n            Kishore Kunche\n            Marco Maggi\n            Rhodri James\n            Sebastian Dröge\n            userwithuid\n            Yury Gribov\n\nRelease 2.2.6 Sun August 12 2018\n        Bug fixes:\n       #170 #206  Avoid doing arithmetic with NULL pointers in XML_GetBuffer\n       #204 #205  Fix 2.2.5 regression with suspend-resume while parsing\n                    a document like '<root/>'\n\n        Other changes:\n       #165 #168  Autotools: Fix docbook-related configure syntax error\n            #166  Autotools: Avoid grep option `-q` for Solaris\n            #167  Autotools: Support\n                    ./configure DOCBOOK_TO_MAN=\"xmlto man --skip-validation\"\n       #159 #167  Autotools: Support DOCBOOK_TO_MAN command which produces\n                    xmlwf.1 rather than XMLWF.1; also covers case insensitive\n                    file systems\n            #181  Autotools: Drop -rpath option passed to libtool\n            #188  Autotools: Detect and deny SGML docbook2man as ours is XML\n            #188  Autotools/CMake: Support command db2x_docbook2man as well\n            #174  CMake: Introduce option WARNINGS_AS_ERRORS, defaults to OFF\n       #184 #185  CMake: Introduce option MSVC_USE_STATIC_CRT, defaults to OFF\n       #207 #208  CMake: Introduce option XML_UNICODE and XML_UNICODE_WCHAR_T,\n                    both defaulting to OFF\n            #175  CMake: Prefer check_symbol_exists over check_function_exists\n            #176  CMake: Create the same pkg-config file as with GNU Autotools\n       #178 #179  CMake: Use GNUInstallDirs module to set proper defaults for\n                    install directories\n            #208  CMake: Utilize expat_config.h.cmake for XML_DEV_URANDOM\n            #180  Windows: Fix compilation of test suite for Visual Studio 2008\n  #131 #173 #202  Address compiler warnings\n  #187 #190 #200  Fix miscellaneous typos\n                  Version info bumped from 7:7:6 to 7:8:6\n\n        Special thanks to:\n            Anton Maklakov\n            Benjamin Peterson\n            Brad King\n            Franek Korta\n            Frank Rast\n            Joe Orton\n            luzpaz\n            Pedro Vicente\n            Rainer Jung\n            Rhodri James\n            Rolf Ade\n            Rolf Eike Beer\n            Thomas Beutlich\n            Tomasz Kłoczko\n\nRelease 2.2.5 Tue October 31 2017\n        Bug fixes:\n              #8  If the parser runs out of memory, make sure its internal\n                    state reflects the memory it actually has, not the memory\n                    it wanted to have.\n             #11  The default handler wasn't being called when it should for\n                    a SYSTEM or PUBLIC doctype if an entity declaration handler\n                    was registered.\n       #137 #138  Fix a case of mistakenly reported parsing success where\n                    XML_StopParser was called from an element handler\n            #162  Function XML_ErrorString was returning NULL rather than\n                    a message for code XML_ERROR_INVALID_ARGUMENT\n                    introduced with release 2.2.1\n\n        Other changes:\n            #106  xmlwf: Add argument -N adding notation declarations\n        #75 #106  Test suite: Resolve expected failure cases where xmlwf\n                    output was incomplete\n            #127  Windows: Fix test suite compilation\n       #126 #127  Windows: Fix compilation for Visual Studio 2012\n                  Windows: Upgrade shipped project files to Visual Studio 2017\n        #33 #132  tests: Mass-fix compilation for XML_UNICODE_WCHAR_T\n            #129  examples: Fix compilation for XML_UNICODE_WCHAR_T\n            #130  benchmark: Fix compilation for XML_UNICODE_WCHAR_T\n            #144  xmlwf: Fix compilation for XML_UNICODE_WCHAR_T; still needs\n                    Windows or MinGW for 2-byte wchar_t\n              #9  Address two Clang Static Analyzer false positives\n             #59  Resolve troublesome macros hiding parser struct membership\n                    and dereferencing that pointer\n              #6  Resolve superfluous internal malloc/realloc switch\n       #153 #155  Improve docbook2x-man detection\n            #160  Undefine NDEBUG in the test suite (rather than rejecting it)\n            #161  Address compiler warnings\n                  Version info bumped from 7:6:6 to 7:7:6\n\n        Special thanks to:\n            Benbuck Nason\n            Hans Wennborg\n            José Gutiérrez de la Concha\n            Pedro Monreal Gonzalez\n            Rhodri James\n            Rolf Ade\n            Stephen Groat\n                 and\n            Core Infrastructure Initiative\n\nRelease 2.2.4 Sat August 19 2017\n        Bug fixes:\n            #115  Fix copying of partial characters for UTF-8 input\n\n        Other changes:\n            #109  Fix \"make check\" for non-x86 architectures that default\n                    to unsigned type char (-128..127 rather than 0..255)\n            #109  coverage.sh: Cover -funsigned-char\n                  Autotools: Introduce --without-xmlwf argument\n             #65  Autotools: Replace handwritten Makefile with GNU Automake\n             #43  CMake: Auto-detect high quality entropy extractors, add new\n                    option USE_libbsd=ON to use arc4random_buf of libbsd\n             #74  CMake: Add -fno-strict-aliasing only where supported\n            #114  CMake: Always honor manually set BUILD_* options\n            #114  CMake: Compile man page if docbook2x-man is available, only\n            #117  Include file tests/xmltest.log.expected in source tarball\n                    (required for \"make run-xmltest\")\n            #117  Include (existing) Visual Studio 2013 files in source tarball\n                  Improve test suite error output\n            #111  Fix some typos in documentation\n                  Version info bumped from 7:5:6 to 7:6:6\n\n        Special thanks to:\n            Jakub Wilk\n            Joe Orton\n            Lin Tian\n            Rolf Eike Beer\n\nRelease 2.2.3 Wed August 2 2017\n        Security fixes:\n             #82  CVE-2017-11742 -- Windows: Fix DLL hijacking vulnerability\n                    using Steve Holme's LoadLibrary wrapper for/of cURL\n\n        Bug fixes:\n             #85  Fix a dangling pointer issue related to realloc\n\n        Other changes:\n                  Increase code coverage\n             #91  Linux: Allow getrandom to fail if nonblocking pool has not\n                    yet been initialized and read /dev/urandom then, instead.\n                    This is in line with what recent Python does.\n             #81  Pre-10.7/Lion macOS: Support entropy from arc4random\n             #86  Check that a UTF-16 encoding in an XML declaration has the\n                    right endianness\n        #4 #5 #7  Recover correctly when some reallocations fail\n                  Repair \"./configure && make\" for systems without any\n                    provider of high quality entropy\n                    and try reading /dev/urandom on those\n                  Ensure that user-defined character encodings have converter\n                    functions when they are needed\n                  Fix mis-leading description of argument -c in xmlwf.1\n                  Rely on macro HAVE_ARC4RANDOM_BUF (rather than __CloudABI__)\n                    for CloudABI\n            #100  Fix use of SIPHASH_MAIN in siphash.h\n             #23  Test suite: Fix memory leaks\n                  Version info bumped from 7:4:6 to 7:5:6\n\n        Special thanks to:\n            Chanho Park\n            Joe Orton\n            Pascal Cuoq\n            Rhodri James\n            Simon McVittie\n            Vadim Zeitlin\n            Viktor Szakats\n                 and\n            Core Infrastructure Initiative\n\nRelease 2.2.2 Wed July 12 2017\n        Security fixes:\n             #43  Protect against compilation without any source of high\n                    quality entropy enabled, e.g. with CMake build system;\n                    commit ff0207e6076e9828e536b8d9cd45c9c92069b895\n             #60  Windows with _UNICODE:\n                    Unintended use of LoadLibraryW with a non-wide string\n                    resulted in failure to load advapi32.dll and degradation\n                    in quality of used entropy when compiled with _UNICODE for\n                    Windows; you can launch existing binaries with\n                    EXPAT_ENTROPY_DEBUG=1 in the environment to inspect the\n                    quality of entropy used during runtime; commits\n                    * 95b95032f907ef1cd17ee7a9a1768010a825d61d\n                    * 73a5a2e9c081f49f2d775cf7ced864158b68dc80\n   [MOX-006]      Fix non-NULL parser parameter validation in XML_Parse;\n                    resulted in NULL dereference, previously;\n                    commit ac256dafdffc9622ab0dc2c62fcecb0dfcfa71fe\n\n        Bug fixes:\n             #69  Fix improper use of unsigned long long integer literals\n\n        Other changes:\n             #73  Start requiring a C99 compiler\n             #49  Fix \"==\" Bashism in configure script\n             #50  Fix too eager getrandom detection for Debian GNU/kFreeBSD\n             #52    and macOS\n             #51  Address lack of stdint.h in Visual Studio 2003 to 2008\n             #58  Address compile warnings\n             #68  Fix \"./buildconf.sh && ./configure\" for some versions\n                    of Dash for /bin/sh\n             #72  CMake: Ease use of Expat in context of a parent project\n                    with multiple CMakeLists.txt files\n             #72  CMake: Resolve mistaken executable permissions\n             #76  Address compile warning with -DNDEBUG (not recommended!)\n             #77  Address compile warning about macro redefinition\n\n        Special thanks to:\n            Alexander Bluhm\n            Ben Boeckel\n            Cătălin Răceanu\n            Kerin Millar\n            László Böszörményi\n            S. P. Zeidler\n            Segev Finer\n            Václav Slavík\n            Victor Stinner\n            Viktor Szakats\n                 and\n            Radically Open Security\n\nRelease 2.2.1 Sat June 17 2017\n        Security fixes:\n                  CVE-2017-9233 -- External entity infinite loop DoS\n                    Details: https://libexpat.github.io/doc/cve-2017-9233/\n                    Commit c4bf96bb51dd2a1b0e185374362ee136fe2c9d7f\n   [MOX-002]      CVE-2016-9063 -- Detect integer overflow; commit\n                    d4f735b88d9932bd5039df2335eefdd0723dbe20\n                    (Fixed version of existing downstream patches!)\n   (SF.net) #539  Fix regression from fix to CVE-2016-0718 cutting off\n                    longer tag names; commits\n                    * 896b6c1fd3b842f377d1b62135dccf0a579cf65d\n                    * af507cef2c93cb8d40062a0abe43a4f4e9158fb2\n             #16    * 0dbbf43fdb20f593ddf4fa1ff67288000dd4a7fd\n             #25  More integer overflow detection (function poolGrow); commits\n                    * 810b74e4703dcfdd8f404e3cb177d44684775143\n                    * 44178553f3539ce69d34abee77a05e879a7982ac\n   [MOX-002]      Detect overflow from len=INT_MAX call to XML_Parse; commits\n                    * 4be2cb5afcc018d996f34bbbce6374b7befad47f\n                    * 7e5b71b748491b6e459e5c9a1d090820f94544d8\n   [MOX-005] #30  Use high quality entropy for hash initialization:\n                    * arc4random_buf on BSD, systems with libbsd\n                      (when configured with --with-libbsd), CloudABI\n                    * RtlGenRandom on Windows XP / Server 2003 and later\n                    * getrandom on Linux 3.17+\n                    In a way, that's still part of CVE-2016-5300.\n                    https://github.com/libexpat/libexpat/pull/30/commits\n   [MOX-005]      For the low quality entropy extraction fallback code,\n                    the parser instance address can no longer leak, commit\n                    04ad658bd3079dd15cb60fc67087900f0ff4b083\n   [MOX-003]      Prevent use of uninitialised variable; commit\n   [MOX-004]        a4dc944f37b664a3ca7199c624a98ee37babdb4b\n                  Add missing parameter validation to public API functions\n                    and dedicated error code XML_ERROR_INVALID_ARGUMENT:\n   [MOX-006]        * NULL checks; commits\n                      * d37f74b2b7149a3a95a680c4c4cd2a451a51d60a (merge/many)\n                      * 9ed727064b675b7180c98cb3d4f75efba6966681\n                      * 6a747c837c50114dfa413994e07c0ba477be4534\n                    * Negative length (XML_Parse); commit\n   [MOX-002]          70db8d2538a10f4c022655d6895e4c3e78692e7f\n   [MOX-001] #35  Change hash algorithm to William Ahern's version of SipHash\n                    to go further with fixing CVE-2012-0876.\n                    https://github.com/libexpat/libexpat/pull/39/commits\n\n        Bug fixes:\n             #32  Fix sharing of hash salt across parsers;\n                    relevant where XML_ExternalEntityParserCreate is called\n                    prior to XML_Parse, in particular (e.g. FBReader)\n             #28  xmlwf: Auto-disable use of memory-mapping (and parsing\n                    as a single chunk) for files larger than ~1 GB (2^30 bytes)\n                    rather than failing with error \"out of memory\"\n              #3  Fix double free after malloc failure in DTD code; commit\n                    7ae9c3d3af433cd4defe95234eae7dc8ed15637f\n             #17  Fix memory leak on parser error for unbound XML attribute\n                    prefix with new namespaces defined in the same tag;\n                    found by Google's OSS-Fuzz; commits\n                    * 16f87daae5a16132e479e4f71862128c7a915c73\n                    * b47dbc9745932c160893d433220e462bd605f8cd\n                  xmlwf on Windows: Add missing calls to CloseHandle\n\n        New features:\n             #30  Introduced environment switch EXPAT_ENTROPY_DEBUG=1\n                    for runtime debugging of entropy extraction\n\n        Other changes:\n                  Increase code coverage\n             #33  Reject use of XML_UNICODE_WCHAR_T with sizeof(wchar_t) != 2;\n                    XML_UNICODE_WCHAR_T was never meant to be used outside\n                    of Windows; 4-byte wchar_t is common on Linux\n   (SF.net) #538  Start using -fno-strict-aliasing\n   (SF.net) #540  Support compilation against cloudlibc of CloudABI\n                  Allow MinGW cross-compilation\n   (SF.net) #534  CMake: Introduce option \"BUILD_doc\" (enabled by default)\n                    to bypass compilation of the xmlwf.1 man page\n   (SF.net)  pr2  CMake: Introduce option \"INSTALL\" (enabled by default)\n                    to bypass installation of expat files\n                  CMake: Fix ninja support\n                  Autotools: Add parameters --enable-xml-context [COUNT]\n                    and --disable-xml-context; default of context of 1024\n                    bytes enabled unchanged\n             #14  Drop AmigaOS 4.x code and includes\n             #14  Drop ancient build systems:\n                    * Borland C++ Builder\n                    * OpenVMS\n                    * Open Watcom\n                    * Visual Studio 6.0\n                    * Pre-X Mac OS (MPW Makefile)\n                    If you happen to rely on some of these, please get in\n                    touch for joining with maintenance.\n             #10  Move from WIN32 to _WIN32\n             #13  Fix \"make run-xmltest\" order instability\n                  Address compile warnings\n                  Bump version info from 7:2:6 to 7:3:6\n                  Add AUTHORS file\n\n        Infrastructure:\n              #1  Migrate from SourceForge to GitHub (except downloads):\n                    https://github.com/libexpat/\n              #1  Re-create http://libexpat.org/ project website\n                  Start utilizing Travis CI\n\n        Special thanks to:\n            Andy Wang\n            Don Lewis\n            Ed Schouten\n            Karl Waclawek\n            Pascal Cuoq\n            Rhodri James\n            Sergei Nikulov\n            Tobias Taschner\n            Viktor Szakats\n                 and\n            Core Infrastructure Initiative\n            Mozilla Foundation (MOSS Track 3: Secure Open Source)\n            Radically Open Security\n\nRelease 2.2.0 Tue June 21 2016\n        Security fixes:\n            #537  CVE-2016-0718 -- Fix crash on malformed input\n                  CVE-2016-4472 -- Improve insufficient fix to CVE-2015-1283 /\n                                   CVE-2015-2716 introduced with Expat 2.1.1\n            #499  CVE-2016-5300 -- Use more entropy for hash initialization\n                                   than the original fix to CVE-2012-0876\n            #519  CVE-2012-6702 -- Resolve troublesome internal call to srand\n                                   that was introduced with Expat 2.1.0\n                                   when addressing CVE-2012-0876 (issue #496)\n\n        Bug fixes:\n                  Fix uninitialized reads of size 1\n                    (e.g. in little2_updatePosition)\n                  Fix detection of UTF-8 character boundaries\n\n        Other changes:\n            #532  Fix compilation for Visual Studio 2010 (keyword \"C99\")\n                  Autotools: Resolve use of \"$<\" to better support bmake\n                  Autotools: Add QA script \"qa.sh\" (and make target \"qa\")\n                  Autotools: Respect CXXFLAGS if given\n                  Autotools: Fix \"make run-xmltest\"\n                  Autotools: Have \"make run-xmltest\" check for expected output\n             p90  CMake: Fix static build (BUILD_shared=OFF) on Windows\n            #536  CMake: Add soversion, support -DNO_SONAME=yes to bypass\n            #323  CMake: Add suffix \"d\" to differentiate debug from release\n                  CMake: Define WIN32 with CMake on Windows\n                  Annotate memory allocators for GCC\n                  Address all currently known compile warnings\n                  Make sure that API symbols remain visible despite\n                    -fvisibility=hidden\n                  Remove executable flag from source files\n                  Resolve COMPILED_FROM_DSP in favor of WIN32\n\n        Special thanks to:\n            Björn Lindahl\n            Christian Heimes\n            Cristian Rodríguez\n            Daniel Krügler\n            Gustavo Grieco\n            Karl Waclawek\n            László Böszörményi\n            Marco Grassi\n            Pascal Cuoq\n            Sergei Nikulov\n            Thomas Beutlich\n            Warren Young\n            Yann Droneaud\n\nRelease 2.1.1 Sat March 12 2016\n        Security fixes:\n            #582: CVE-2015-1283 - Multiple integer overflows in XML_GetBuffer\n\n        Bug fixes:\n            #502: Fix potential null pointer dereference\n            #520: Symbol XML_SetHashSalt was not exported\n            Output of \"xmlwf -h\" was incomplete\n\n        Other changes:\n            #503: Document behavior of calling XML_SetHashSalt with salt 0\n            Minor improvements to man page xmlwf(1)\n            Improvements to the experimental CMake build system\n            libtool now invoked with --verbose\n\nRelease 2.1.0 Sat March 24 2012\n        - Security fixes:\n          #2958794: CVE-2012-1148 - Memory leak in poolGrow.\n          #2895533: CVE-2012-1147 - Resource leak in readfilemap.c.\n          #3496608: CVE-2012-0876 - Hash DOS attack.\n          #2894085: CVE-2009-3560 - Buffer over-read and crash in big2_toUtf8().\n          #1990430: CVE-2009-3720 - Parser crash with special UTF-8 sequences.\n        - Bug Fixes:\n          #1742315: Harmful XML_ParserCreateNS suggestion.\n          #1785430: Expat build fails on linux-amd64 with gcc version>=4.1 -O3.\n          #1983953, 2517952, 2517962, 2649838: \n                Build modifications using autoreconf instead of buildconf.sh.\n          #2815947, #2884086: OBJEXT and EXEEXT support while building.\n          #2517938: xmlwf should return non-zero exit status if not well-formed.\n          #2517946: Wrong statement about XMLDecl in xmlwf.1 and xmlwf.sgml.\n          #2855609: Dangling positionPtr after error.\n          #2990652: CMake support.\n          #3010819: UNEXPECTED_STATE with a trailing \"%\" in entity value.\n          #3206497: Uninitialized memory returned from XML_Parse.\n          #3287849: make check fails on mingw-w64.\n        - Patches:\n          #1749198: pkg-config support.\n          #3010222: Fix for bug #3010819.\n          #3312568: CMake support.\n          #3446384: Report byte offsets for attr names and values.\n        - New Features / API changes:\n          Added new API member XML_SetHashSalt() that allows setting an initial\n                value (salt) for hash calculations. This is part of the fix for\n                bug #3496608 to randomize hash parameters.\n          When compiled with XML_ATTR_INFO defined, adds new API member\n                XML_GetAttributeInfo() that allows retrieving the byte\n                offsets for attribute names and values (patch #3446384).\n          Added CMake build system.\n                See bug #2990652 and patch #3312568.\n          Added run-benchmark target to Makefile.in - relies on testdata module\n                present in the same relative location as in the repository.\n          \nRelease 2.0.1 Tue June 5 2007\n        - Fixed bugs #1515266, #1515600: The character data handler's calling\n          of XML_StopParser() was not handled properly; if the parser was\n          stopped and the handler set to NULL, the parser would segfault.\n        - Fixed bug #1690883: Expat failed on EBCDIC systems as it assumed\n          some character constants to be ASCII encoded.\n        - Minor cleanups of the test harness.\n        - Fixed xmlwf bug #1513566: \"out of memory\" error on file size zero.\n        - Fixed outline.c bug #1543233: missing a final XML_ParserFree() call.\n        - Fixes and improvements for Windows platform:\n          bugs #1409451, #1476160, #1548182, #1602769, #1717322.\n        - Build fixes for various platforms:\n          HP-UX, Tru64, Solaris 9: patch #1437840, bug #1196180.\n          All Unix: #1554618 (refreshed config.sub/config.guess).\n                    #1490371, #1613457: support both, DESTDIR and INSTALL_ROOT,\n                    without relying on GNU-Make specific features.\n          #1647805: Patched configure.in to work better with Intel compiler.\n        - Fixes to Makefile.in to have make check work correctly:\n          bugs #1408143, #1535603, #1536684.\n        - Added Open Watcom support: patch #1523242.\n\nRelease 2.0.0 Wed Jan 11 2006\n        - We no longer use the \"check\" library for C unit testing; we\n          always use the (partial) internal implementation of the API.\n        - Report XML_NS setting via XML_GetFeatureList().\n        - Fixed headers for use from C++.\n        - XML_GetCurrentLineNumber() and  XML_GetCurrentColumnNumber()\n          now return unsigned integers.\n        - Added XML_LARGE_SIZE switch to enable 64-bit integers for\n          byte indexes and line/column numbers.\n        - Updated to use libtool 1.5.22 (the most recent).\n        - Added support for AmigaOS.\n        - Some mostly minor bug fixes. SF issues include: #1006708,\n          #1021776, #1023646, #1114960, #1156398, #1221160, #1271642.\n\nRelease 1.95.8 Fri Jul 23 2004\n        - Major new feature: suspend/resume.  Handlers can now request\n          that a parse be suspended for later resumption or aborted\n          altogether.  See \"Temporarily Stopping Parsing\" in the\n          documentation for more details.\n        - Some mostly minor bug fixes, but compilation should no\n          longer generate warnings on most platforms.  SF issues\n          include: #827319, #840173, #846309, #888329, #896188, #923913,\n          #928113, #961698, #985192.\n\nRelease 1.95.7 Mon Oct 20 2003\n        - Fixed enum XML_Status issue (reported on SourceForge many\n          times), so compilers that are properly picky will be happy.\n        - Introduced an XMLCALL macro to control the calling\n          convention used by the Expat API; this macro should be used\n          to annotate prototypes and definitions of callback\n          implementations in code compiled with a calling convention\n          other than the default convention for the host platform.\n        - Improved ability to build without the configure-generated\n          expat_config.h header.  This is useful for applications\n          which embed Expat rather than linking in the library.\n        - Fixed a variety of bugs: see SF issues #458907, #609603,\n          #676844, #679754, #692878, #692964, #695401, #699323, #699487,\n          #820946.\n        - Improved hash table lookups.\n        - Added more regression tests and improved documentation.\n\nRelease 1.95.6 Tue Jan 28 2003\n        - Added XML_FreeContentModel().\n        - Added XML_MemMalloc(), XML_MemRealloc(), XML_MemFree().\n        - Fixed a variety of bugs: see SF issues #615606, #616863,\n          #618199, #653180, #673791.\n        - Enhanced the regression test suite.\n        - Man page improvements: includes SF issue #632146.\n\nRelease 1.95.5 Fri Sep 6 2002\n        - Added XML_UseForeignDTD() for improved SAX2 support.\n        - Added XML_GetFeatureList().\n        - Defined XML_Bool type and the values XML_TRUE and XML_FALSE.\n        - Use an incomplete struct instead of a void* for the parser\n          (may not retain).\n        - Fixed UTF-8 decoding bug that caused legal UTF-8 to be rejected.\n        - Finally fixed bug where default handler would report DTD\n          events that were already handled by another handler.\n          Initial patch contributed by Darryl Miles.\n        - Removed unnecessary DllMain() function that caused static\n          linking into a DLL to be difficult.\n        - Added VC++ projects for building static libraries.\n        - Reduced line-length for all source code and headers to be\n          no longer than 80 characters, to help with AS/400 support.\n        - Reduced memory copying during parsing (SF patch #600964).\n        - Fixed a variety of bugs: see SF issues #580793, #434664,\n          #483514, #580503, #581069, #584041, #584183, #584832, #585537,\n          #596555, #596678, #598352, #598944, #599715, #600479, #600971.\n\nRelease 1.95.4 Fri Jul 12 2002\n        - Added support for VMS, contributed by Craig Berry.  See\n          vms/README.vms for more information.\n        - Added Mac OS (classic) support, with a makefile for MPW,\n          contributed by Thomas Wegner and Daryle Walker.\n        - Added Borland C++ Builder 5 / BCC 5.5 support, contributed\n          by Patrick McConnell (SF patch #538032).\n        - Fixed a variety of bugs: see SF issues #441449, #563184,\n          #564342, #566334, #566901, #569461, #570263, #575168, #579196.\n        - Made skippedEntityHandler conform to SAX2 (see source comment)\n        - Re-implemented WFC: Entity Declared from XML 1.0 spec and\n          added a new error \"entity declared in parameter entity\":\n          see SF bug report #569461 and SF patch #578161\n        - Re-implemented section 5.1 from XML 1.0 spec:\n          see SF bug report #570263 and SF patch #578161\n\nRelease 1.95.3 Mon Jun 3 2002\n        - Added a project to the MSVC workspace to create a wchar_t\n          version of the library; the DLLs are named libexpatw.dll.\n        - Changed the name of the Windows DLLs from expat.dll to\n          libexpat.dll; this fixes SF bug #432456.\n        - Added the XML_ParserReset() API function.\n        - Fixed XML_SetReturnNSTriplet() to work for element names.\n        - Made the XML_UNICODE builds usable (thanks, Karl!).\n        - Allow xmlwf to read from standard input.\n        - Install a man page for xmlwf on Unix systems.\n        - Fixed many bugs; see SF bug reports #231864, #461380, #464837,\n          #466885, #469226, #477667, #484419, #487840, #494749, #496505,\n          #547350.  Other bugs which we can't test as easily may also\n          have been fixed, especially in the area of build support.\n\nRelease 1.95.2 Fri Jul 27 2001\n        - More changes to make MSVC happy with the build; add a single\n          workspace to support both the library and xmlwf application.\n        - Added a Windows installer for Windows users; includes\n          xmlwf.exe.\n        - Added compile-time constants that can be used to determine the\n          Expat version\n        - Removed a lot of GNU-specific dependencies to aide portability\n          among the various Unix flavors.\n        - Fix the UTF-8 BOM bug.\n        - Cleaned up warning messages for several compilers.\n        - Added the -Wall, -Wstrict-prototypes options for GCC.\n\nRelease 1.95.1 Sun Oct 22 15:11:36 EDT 2000\n        - Changes to get expat to build under Microsoft compiler\n        - Removed all aborts and instead return an UNEXPECTED_STATE error.\n        - Fixed a bug where a stray '%' in an entity value would cause an\n          abort.\n        - Defined XML_SetEndNamespaceDeclHandler. Thanks to Darryl Miles for\n          finding this oversight.\n        - Changed default patterns in lib/Makefile.in to fit non-GNU makes\n          Thanks to robin@unrated.net for reporting and providing an\n          account to test on.\n        - The reference had the wrong label for XML_SetStartNamespaceDecl.\n          Reported by an anonymous user.\n\nRelease 1.95.0 Fri Sep 29 2000\n        - XML_ParserCreate_MM\n                Allows you to set a memory management suite to replace the\n                standard malloc,realloc, and free.\n        - XML_SetReturnNSTriplet\n                If you turn this feature on when namespace processing is in\n                effect, then qualified, prefixed element and attribute names\n                are returned as \"uri|name|prefix\" where '|' is whatever\n                separator character is used in namespace processing.\n        - Merged in features from perl-expat\n                o XML_SetElementDeclHandler\n                o XML_SetAttlistDeclHandler\n                o XML_SetXmlDeclHandler\n                o XML_SetEntityDeclHandler\n                o StartDoctypeDeclHandler takes 3 additional parameters:\n                        sysid, pubid, has_internal_subset\n                o Many paired handler setters (like XML_SetElementHandler)\n                  now have corresponding individual handler setters\n                o XML_GetInputContext for getting the input context of\n                  the current parse position.\n        - Added reference material\n        - Packaged into a distribution that builds a sharable library\n"},{"id":16508,"name":"README.md","nodeType":"TextFile","path":"cextern/expat","text":"[![Travis CI Build Status](https://travis-ci.org/libexpat/libexpat.svg?branch=master)](https://travis-ci.org/libexpat/libexpat)\n[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/libexpat/libexpat?svg=true)](https://ci.appveyor.com/project/libexpat/libexpat)\n[![Packaging status](https://repology.org/badge/tiny-repos/expat.svg)](https://repology.org/metapackage/expat/versions)\n\n\n# Expat, Release 2.2.9\n\nThis is Expat, a C library for parsing XML, started by\n[James Clark](https://en.wikipedia.org/wiki/James_Clark_(programmer)) in 1997.\nExpat is a stream-oriented XML parser.  This means that you register\nhandlers with the parser before starting the parse.  These handlers\nare called when the parser discovers the associated structures in the\ndocument being parsed.  A start tag is an example of the kind of\nstructures for which you may register handlers.\n\nExpat supports the following compilers:\n- GNU GCC >=4.5\n- LLVM Clang >=3.5\n- Microsoft Visual Studio >=8.0/2005\n\nWindows users should use the\n[`expat_win32` package](https://sourceforge.io/projects/expat/files/expat_win32/),\nwhich includes both precompiled libraries and executables, and source code for\ndevelopers.\n\nExpat is [free software](https://www.gnu.org/philosophy/free-sw.en.html).\nYou may copy, distribute, and modify it under the terms of the License\ncontained in the file\n[`COPYING`](https://github.com/libexpat/libexpat/blob/master/expat/COPYING)\ndistributed with this package.\nThis license is the same as the MIT/X Consortium license.\n\nIf you are building Expat from a check-out from the\n[Git repository](https://github.com/libexpat/libexpat/),\nyou need to run a script that generates the configure script using the\nGNU autoconf and libtool tools.  To do this, you need to have\nautoconf 2.58 or newer. Run the script like this:\n\n```console\n./buildconf.sh\n```\n\nOnce this has been done, follow the same instructions as for building\nfrom a source distribution.\n\nTo build Expat from a source distribution, you first run the\nconfiguration shell script in the top level distribution directory:\n\n```console\n./configure\n```\n\nThere are many options which you may provide to configure (which you\ncan discover by running configure with the `--help` option).  But the\none of most interest is the one that sets the installation directory.\nBy default, the configure script will set things up to install\nlibexpat into `/usr/local/lib`, `expat.h` into `/usr/local/include`, and\n`xmlwf` into `/usr/local/bin`.  If, for example, you'd prefer to install\ninto `/home/me/mystuff/lib`, `/home/me/mystuff/include`, and\n`/home/me/mystuff/bin`, you can tell `configure` about that with:\n\n```console\n./configure --prefix=/home/me/mystuff\n```\n\nAnother interesting option is to enable 64-bit integer support for\nline and column numbers and the over-all byte index:\n\n```console\n./configure CPPFLAGS=-DXML_LARGE_SIZE\n```\n\nHowever, such a modification would be a breaking change to the ABI\nand is therefore not recommended for general use &mdash; e.g. as part of\na Linux distribution &mdash; but rather for builds with special requirements.\n\nAfter running the configure script, the `make` command will build\nthings and `make install` will install things into their proper\nlocation.  Have a look at the `Makefile` to learn about additional\n`make` options.  Note that you need to have write permission into\nthe directories into which things will be installed.\n\nIf you are interested in building Expat to provide document\ninformation in UTF-16 encoding rather than the default UTF-8, follow\nthese instructions (after having run `make distclean`).\nPlease note that we configure with `--without-xmlwf` as xmlwf does not\nsupport this mode of compilation (yet):\n\n1. Mass-patch `Makefile.am` files to use `libexpatw.la` for a library name:\n   <br/>\n   `find -name Makefile.am -exec sed\n       -e 's,libexpat\\.la,libexpatw.la,'\n       -e 's,libexpat_la,libexpatw_la,'\n       -i {} +`\n\n1. Run `automake` to re-write `Makefile.in` files:<br/>\n   `automake`\n\n1. For UTF-16 output as unsigned short (and version/error strings as char),\n   run:<br/>\n   `./configure CPPFLAGS=-DXML_UNICODE --without-xmlwf`<br/>\n   For UTF-16 output as `wchar_t` (incl. version/error strings), run:<br/>\n   `./configure CFLAGS=\"-g -O2 -fshort-wchar\" CPPFLAGS=-DXML_UNICODE_WCHAR_T\n       --without-xmlwf`\n   <br/>Note: The latter requires libc compiled with `-fshort-wchar`, as well.\n\n1. Run `make` (which excludes xmlwf).\n\n1. Run `make install` (again, excludes xmlwf).\n\nUsing `DESTDIR` is supported.  It works as follows:\n\n```console\nmake install DESTDIR=/path/to/image\n```\n\noverrides the in-makefile set `DESTDIR`, because variable-setting priority is\n\n1. commandline\n1. in-makefile\n1. environment\n\nNote: This only applies to the Expat library itself, building UTF-16 versions\nof xmlwf and the tests is currently not supported.\n\nWhen using Expat with a project using autoconf for configuration, you\ncan use the probing macro in `conftools/expat.m4` to determine how to\ninclude Expat.  See the comments at the top of that file for more\ninformation.\n\nA reference manual is available in the file `doc/reference.html` in this\ndistribution.\n\n\nThe CMake build system is still *experimental* and will replace the primary\nbuild system based on GNU Autotools at some point when it is ready.\nFor an idea of the available (non-advanced) options for building with CMake:\n\n```console\n# rm -f CMakeCache.txt ; cmake -D_EXPAT_HELP=ON -LH . | grep -B1 ':.*=' | sed 's,^--$,,'\n// Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ...\nCMAKE_BUILD_TYPE:STRING=\n\n// Install path prefix, prepended onto install directories.\nCMAKE_INSTALL_PREFIX:PATH=/usr/local\n\n// Path to a program.\nDOCBOOK_TO_MAN:FILEPATH=/usr/bin/docbook2x-man\n\n// build man page for xmlwf\nEXPAT_BUILD_DOCS:BOOL=ON\n\n// build the examples for expat library\nEXPAT_BUILD_EXAMPLES:BOOL=ON\n\n// build fuzzers for the expat library\nEXPAT_BUILD_FUZZERS:BOOL=OFF\n\n// build the tests for expat library\nEXPAT_BUILD_TESTS:BOOL=ON\n\n// build the xmlwf tool for expat library\nEXPAT_BUILD_TOOLS:BOOL=ON\n\n// Character type to use (char|ushort|wchar_t) [default=char]\nEXPAT_CHAR_TYPE:STRING=char\n\n// install expat files in cmake install target\nEXPAT_ENABLE_INSTALL:BOOL=ON\n\n// Use /MT flag (static CRT) when compiling in MSVC\nEXPAT_MSVC_STATIC_CRT:BOOL=OFF\n\n// build a shared expat library\nEXPAT_SHARED_LIBS:BOOL=ON\n\n// Treat all compiler warnings as errors\nEXPAT_WARNINGS_AS_ERRORS:BOOL=OFF\n\n// Make use of getrandom function (ON|OFF|AUTO) [default=AUTO]\nEXPAT_WITH_GETRANDOM:STRING=AUTO\n\n// utilize libbsd (for arc4random_buf)\nEXPAT_WITH_LIBBSD:BOOL=OFF\n\n// Make use of syscall SYS_getrandom (ON|OFF|AUTO) [default=AUTO]\nEXPAT_WITH_SYS_GETRANDOM:STRING=AUTO\n```\n"},{"id":16509,"name":"README.txt","nodeType":"TextFile","path":"cextern/expat","text":"Note: astropy only requires the expat library, and hence in this bundled version,\nwe removed all other files except the required license and changelog.\n"},{"id":16510,"name":"cextern/expat/lib","nodeType":"Package"},{"id":16511,"name":"siphash.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* ==========================================================================\n * siphash.h - SipHash-2-4 in a single header file\n * --------------------------------------------------------------------------\n * Derived by William Ahern from the reference implementation[1] published[2]\n * by Jean-Philippe Aumasson and Daniel J. Berstein.\n * Minimal changes by Sebastian Pipping and Victor Stinner on top, see below.\n * Licensed under the CC0 Public Domain Dedication license.\n *\n * 1. https://www.131002.net/siphash/siphash24.c\n * 2. https://www.131002.net/siphash/\n * --------------------------------------------------------------------------\n * HISTORY:\n *\n * 2019-08-03  (Sebastian Pipping)\n *   - Mark part of sip24_valid as to be excluded from clang-format\n *   - Re-format code using clang-format 9\n *\n * 2018-07-08  (Anton Maklakov)\n *   - Add \"fall through\" markers for GCC's -Wimplicit-fallthrough\n *\n * 2017-11-03  (Sebastian Pipping)\n *   - Hide sip_tobin and sip_binof unless SIPHASH_TOBIN macro is defined\n *\n * 2017-07-25  (Vadim Zeitlin)\n *   - Fix use of SIPHASH_MAIN macro\n *\n * 2017-07-05  (Sebastian Pipping)\n *   - Use _SIP_ULL macro to not require a C++11 compiler if compiled as C++\n *   - Add const qualifiers at two places\n *   - Ensure <=80 characters line length (assuming tab width 4)\n *\n * 2017-06-23  (Victor Stinner)\n *   - Address Win64 compile warnings\n *\n * 2017-06-18  (Sebastian Pipping)\n *   - Clarify license note in the header\n *   - Address C89 issues:\n *     - Stop using inline keyword (and let compiler decide)\n *     - Replace _Bool by int\n *     - Turn macro siphash24 into a function\n *     - Address invalid conversion (void pointer) by explicit cast\n *   - Address lack of stdint.h for Visual Studio 2003 to 2008\n *   - Always expose sip24_valid (for self-tests)\n *\n * 2012-11-04 - Born.  (William Ahern)\n * --------------------------------------------------------------------------\n * USAGE:\n *\n * SipHash-2-4 takes as input two 64-bit words as the key, some number of\n * message bytes, and outputs a 64-bit word as the message digest. This\n * implementation employs two data structures: a struct sipkey for\n * representing the key, and a struct siphash for representing the hash\n * state.\n *\n * For converting a 16-byte unsigned char array to a key, use either the\n * macro sip_keyof or the routine sip_tokey. The former instantiates a\n * compound literal key, while the latter requires a key object as a\n * parameter.\n *\n * \tunsigned char secret[16];\n * \tarc4random_buf(secret, sizeof secret);\n * \tstruct sipkey *key = sip_keyof(secret);\n *\n * For hashing a message, use either the convenience macro siphash24 or the\n * routines sip24_init, sip24_update, and sip24_final.\n *\n * \tstruct siphash state;\n * \tvoid *msg;\n * \tsize_t len;\n * \tuint64_t hash;\n *\n * \tsip24_init(&state, key);\n * \tsip24_update(&state, msg, len);\n * \thash = sip24_final(&state);\n *\n * or\n *\n * \thash = siphash24(msg, len, key);\n *\n * To convert the 64-bit hash value to a canonical 8-byte little-endian\n * binary representation, use either the macro sip_binof or the routine\n * sip_tobin. The former instantiates and returns a compound literal array,\n * while the latter requires an array object as a parameter.\n * --------------------------------------------------------------------------\n * NOTES:\n *\n * o Neither sip_keyof, sip_binof, nor siphash24 will work with compilers\n *   lacking compound literal support. Instead, you must use the lower-level\n *   interfaces which take as parameters the temporary state objects.\n *\n * o Uppercase macros may evaluate parameters more than once. Lowercase\n *   macros should not exhibit any such side effects.\n * ==========================================================================\n */\n#ifndef SIPHASH_H\n#define SIPHASH_H\n\n#include <stddef.h> /* size_t */\n\n#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1600)\n/* For vs2003/7.1 up to vs2008/9.0; _MSC_VER 1600 is vs2010/10.0 */\ntypedef unsigned __int8 uint8_t;\ntypedef unsigned __int32 uint32_t;\ntypedef unsigned __int64 uint64_t;\n#else\n#  include <stdint.h> /* uint64_t uint32_t uint8_t */\n#endif\n\n/*\n * Workaround to not require a C++11 compiler for using ULL suffix\n * if this code is included and compiled as C++; related GCC warning is:\n * warning: use of C++11 long long integer constant [-Wlong-long]\n */\n#define _SIP_ULL(high, low) (((uint64_t)high << 32) | low)\n\n#define SIP_ROTL(x, b) (uint64_t)(((x) << (b)) | ((x) >> (64 - (b))))\n\n#define SIP_U32TO8_LE(p, v)                                                    \\\n  (p)[0] = (uint8_t)((v) >> 0);                                                \\\n  (p)[1] = (uint8_t)((v) >> 8);                                                \\\n  (p)[2] = (uint8_t)((v) >> 16);                                               \\\n  (p)[3] = (uint8_t)((v) >> 24);\n\n#define SIP_U64TO8_LE(p, v)                                                    \\\n  SIP_U32TO8_LE((p) + 0, (uint32_t)((v) >> 0));                                \\\n  SIP_U32TO8_LE((p) + 4, (uint32_t)((v) >> 32));\n\n#define SIP_U8TO64_LE(p)                                                       \\\n  (((uint64_t)((p)[0]) << 0) | ((uint64_t)((p)[1]) << 8)                       \\\n   | ((uint64_t)((p)[2]) << 16) | ((uint64_t)((p)[3]) << 24)                   \\\n   | ((uint64_t)((p)[4]) << 32) | ((uint64_t)((p)[5]) << 40)                   \\\n   | ((uint64_t)((p)[6]) << 48) | ((uint64_t)((p)[7]) << 56))\n\n#define SIPHASH_INITIALIZER                                                    \\\n  { 0, 0, 0, 0, {0}, 0, 0 }\n\nstruct siphash {\n  uint64_t v0, v1, v2, v3;\n\n  unsigned char buf[8], *p;\n  uint64_t c;\n}; /* struct siphash */\n\n#define SIP_KEYLEN 16\n\nstruct sipkey {\n  uint64_t k[2];\n}; /* struct sipkey */\n\n#define sip_keyof(k) sip_tokey(&(struct sipkey){{0}}, (k))\n\nstatic struct sipkey *\nsip_tokey(struct sipkey *key, const void *src) {\n  key->k[0] = SIP_U8TO64_LE((const unsigned char *)src);\n  key->k[1] = SIP_U8TO64_LE((const unsigned char *)src + 8);\n  return key;\n} /* sip_tokey() */\n\n#ifdef SIPHASH_TOBIN\n\n#  define sip_binof(v) sip_tobin((unsigned char[8]){0}, (v))\n\nstatic void *\nsip_tobin(void *dst, uint64_t u64) {\n  SIP_U64TO8_LE((unsigned char *)dst, u64);\n  return dst;\n} /* sip_tobin() */\n\n#endif /* SIPHASH_TOBIN */\n\nstatic void\nsip_round(struct siphash *H, const int rounds) {\n  int i;\n\n  for (i = 0; i < rounds; i++) {\n    H->v0 += H->v1;\n    H->v1 = SIP_ROTL(H->v1, 13);\n    H->v1 ^= H->v0;\n    H->v0 = SIP_ROTL(H->v0, 32);\n\n    H->v2 += H->v3;\n    H->v3 = SIP_ROTL(H->v3, 16);\n    H->v3 ^= H->v2;\n\n    H->v0 += H->v3;\n    H->v3 = SIP_ROTL(H->v3, 21);\n    H->v3 ^= H->v0;\n\n    H->v2 += H->v1;\n    H->v1 = SIP_ROTL(H->v1, 17);\n    H->v1 ^= H->v2;\n    H->v2 = SIP_ROTL(H->v2, 32);\n  }\n} /* sip_round() */\n\nstatic struct siphash *\nsip24_init(struct siphash *H, const struct sipkey *key) {\n  H->v0 = _SIP_ULL(0x736f6d65U, 0x70736575U) ^ key->k[0];\n  H->v1 = _SIP_ULL(0x646f7261U, 0x6e646f6dU) ^ key->k[1];\n  H->v2 = _SIP_ULL(0x6c796765U, 0x6e657261U) ^ key->k[0];\n  H->v3 = _SIP_ULL(0x74656462U, 0x79746573U) ^ key->k[1];\n\n  H->p = H->buf;\n  H->c = 0;\n\n  return H;\n} /* sip24_init() */\n\n#define sip_endof(a) (&(a)[sizeof(a) / sizeof *(a)])\n\nstatic struct siphash *\nsip24_update(struct siphash *H, const void *src, size_t len) {\n  const unsigned char *p = (const unsigned char *)src, *pe = p + len;\n  uint64_t m;\n\n  do {\n    while (p < pe && H->p < sip_endof(H->buf))\n      *H->p++ = *p++;\n\n    if (H->p < sip_endof(H->buf))\n      break;\n\n    m = SIP_U8TO64_LE(H->buf);\n    H->v3 ^= m;\n    sip_round(H, 2);\n    H->v0 ^= m;\n\n    H->p = H->buf;\n    H->c += 8;\n  } while (p < pe);\n\n  return H;\n} /* sip24_update() */\n\nstatic uint64_t\nsip24_final(struct siphash *H) {\n  const char left = (char)(H->p - H->buf);\n  uint64_t b = (H->c + left) << 56;\n\n  switch (left) {\n  case 7:\n    b |= (uint64_t)H->buf[6] << 48;\n    /* fall through */\n  case 6:\n    b |= (uint64_t)H->buf[5] << 40;\n    /* fall through */\n  case 5:\n    b |= (uint64_t)H->buf[4] << 32;\n    /* fall through */\n  case 4:\n    b |= (uint64_t)H->buf[3] << 24;\n    /* fall through */\n  case 3:\n    b |= (uint64_t)H->buf[2] << 16;\n    /* fall through */\n  case 2:\n    b |= (uint64_t)H->buf[1] << 8;\n    /* fall through */\n  case 1:\n    b |= (uint64_t)H->buf[0] << 0;\n    /* fall through */\n  case 0:\n    break;\n  }\n\n  H->v3 ^= b;\n  sip_round(H, 2);\n  H->v0 ^= b;\n  H->v2 ^= 0xff;\n  sip_round(H, 4);\n\n  return H->v0 ^ H->v1 ^ H->v2 ^ H->v3;\n} /* sip24_final() */\n\nstatic uint64_t\nsiphash24(const void *src, size_t len, const struct sipkey *key) {\n  struct siphash state = SIPHASH_INITIALIZER;\n  return sip24_final(sip24_update(sip24_init(&state, key), src, len));\n} /* siphash24() */\n\n/*\n * SipHash-2-4 output with\n * k = 00 01 02 ...\n * and\n * in = (empty string)\n * in = 00 (1 byte)\n * in = 00 01 (2 bytes)\n * in = 00 01 02 (3 bytes)\n * ...\n * in = 00 01 02 ... 3e (63 bytes)\n */\nstatic int\nsip24_valid(void) {\n  /* clang-format off */\n  static const unsigned char vectors[64][8] = {\n    { 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, },\n    { 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, },\n    { 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d, },\n    { 0x2d, 0x7e, 0xfb, 0xd7, 0x96, 0x66, 0x67, 0x85, },\n    { 0xb7, 0x87, 0x71, 0x27, 0xe0, 0x94, 0x27, 0xcf, },\n    { 0x8d, 0xa6, 0x99, 0xcd, 0x64, 0x55, 0x76, 0x18, },\n    { 0xce, 0xe3, 0xfe, 0x58, 0x6e, 0x46, 0xc9, 0xcb, },\n    { 0x37, 0xd1, 0x01, 0x8b, 0xf5, 0x00, 0x02, 0xab, },\n    { 0x62, 0x24, 0x93, 0x9a, 0x79, 0xf5, 0xf5, 0x93, },\n    { 0xb0, 0xe4, 0xa9, 0x0b, 0xdf, 0x82, 0x00, 0x9e, },\n    { 0xf3, 0xb9, 0xdd, 0x94, 0xc5, 0xbb, 0x5d, 0x7a, },\n    { 0xa7, 0xad, 0x6b, 0x22, 0x46, 0x2f, 0xb3, 0xf4, },\n    { 0xfb, 0xe5, 0x0e, 0x86, 0xbc, 0x8f, 0x1e, 0x75, },\n    { 0x90, 0x3d, 0x84, 0xc0, 0x27, 0x56, 0xea, 0x14, },\n    { 0xee, 0xf2, 0x7a, 0x8e, 0x90, 0xca, 0x23, 0xf7, },\n    { 0xe5, 0x45, 0xbe, 0x49, 0x61, 0xca, 0x29, 0xa1, },\n    { 0xdb, 0x9b, 0xc2, 0x57, 0x7f, 0xcc, 0x2a, 0x3f, },\n    { 0x94, 0x47, 0xbe, 0x2c, 0xf5, 0xe9, 0x9a, 0x69, },\n    { 0x9c, 0xd3, 0x8d, 0x96, 0xf0, 0xb3, 0xc1, 0x4b, },\n    { 0xbd, 0x61, 0x79, 0xa7, 0x1d, 0xc9, 0x6d, 0xbb, },\n    { 0x98, 0xee, 0xa2, 0x1a, 0xf2, 0x5c, 0xd6, 0xbe, },\n    { 0xc7, 0x67, 0x3b, 0x2e, 0xb0, 0xcb, 0xf2, 0xd0, },\n    { 0x88, 0x3e, 0xa3, 0xe3, 0x95, 0x67, 0x53, 0x93, },\n    { 0xc8, 0xce, 0x5c, 0xcd, 0x8c, 0x03, 0x0c, 0xa8, },\n    { 0x94, 0xaf, 0x49, 0xf6, 0xc6, 0x50, 0xad, 0xb8, },\n    { 0xea, 0xb8, 0x85, 0x8a, 0xde, 0x92, 0xe1, 0xbc, },\n    { 0xf3, 0x15, 0xbb, 0x5b, 0xb8, 0x35, 0xd8, 0x17, },\n    { 0xad, 0xcf, 0x6b, 0x07, 0x63, 0x61, 0x2e, 0x2f, },\n    { 0xa5, 0xc9, 0x1d, 0xa7, 0xac, 0xaa, 0x4d, 0xde, },\n    { 0x71, 0x65, 0x95, 0x87, 0x66, 0x50, 0xa2, 0xa6, },\n    { 0x28, 0xef, 0x49, 0x5c, 0x53, 0xa3, 0x87, 0xad, },\n    { 0x42, 0xc3, 0x41, 0xd8, 0xfa, 0x92, 0xd8, 0x32, },\n    { 0xce, 0x7c, 0xf2, 0x72, 0x2f, 0x51, 0x27, 0x71, },\n    { 0xe3, 0x78, 0x59, 0xf9, 0x46, 0x23, 0xf3, 0xa7, },\n    { 0x38, 0x12, 0x05, 0xbb, 0x1a, 0xb0, 0xe0, 0x12, },\n    { 0xae, 0x97, 0xa1, 0x0f, 0xd4, 0x34, 0xe0, 0x15, },\n    { 0xb4, 0xa3, 0x15, 0x08, 0xbe, 0xff, 0x4d, 0x31, },\n    { 0x81, 0x39, 0x62, 0x29, 0xf0, 0x90, 0x79, 0x02, },\n    { 0x4d, 0x0c, 0xf4, 0x9e, 0xe5, 0xd4, 0xdc, 0xca, },\n    { 0x5c, 0x73, 0x33, 0x6a, 0x76, 0xd8, 0xbf, 0x9a, },\n    { 0xd0, 0xa7, 0x04, 0x53, 0x6b, 0xa9, 0x3e, 0x0e, },\n    { 0x92, 0x59, 0x58, 0xfc, 0xd6, 0x42, 0x0c, 0xad, },\n    { 0xa9, 0x15, 0xc2, 0x9b, 0xc8, 0x06, 0x73, 0x18, },\n    { 0x95, 0x2b, 0x79, 0xf3, 0xbc, 0x0a, 0xa6, 0xd4, },\n    { 0xf2, 0x1d, 0xf2, 0xe4, 0x1d, 0x45, 0x35, 0xf9, },\n    { 0x87, 0x57, 0x75, 0x19, 0x04, 0x8f, 0x53, 0xa9, },\n    { 0x10, 0xa5, 0x6c, 0xf5, 0xdf, 0xcd, 0x9a, 0xdb, },\n    { 0xeb, 0x75, 0x09, 0x5c, 0xcd, 0x98, 0x6c, 0xd0, },\n    { 0x51, 0xa9, 0xcb, 0x9e, 0xcb, 0xa3, 0x12, 0xe6, },\n    { 0x96, 0xaf, 0xad, 0xfc, 0x2c, 0xe6, 0x66, 0xc7, },\n    { 0x72, 0xfe, 0x52, 0x97, 0x5a, 0x43, 0x64, 0xee, },\n    { 0x5a, 0x16, 0x45, 0xb2, 0x76, 0xd5, 0x92, 0xa1, },\n    { 0xb2, 0x74, 0xcb, 0x8e, 0xbf, 0x87, 0x87, 0x0a, },\n    { 0x6f, 0x9b, 0xb4, 0x20, 0x3d, 0xe7, 0xb3, 0x81, },\n    { 0xea, 0xec, 0xb2, 0xa3, 0x0b, 0x22, 0xa8, 0x7f, },\n    { 0x99, 0x24, 0xa4, 0x3c, 0xc1, 0x31, 0x57, 0x24, },\n    { 0xbd, 0x83, 0x8d, 0x3a, 0xaf, 0xbf, 0x8d, 0xb7, },\n    { 0x0b, 0x1a, 0x2a, 0x32, 0x65, 0xd5, 0x1a, 0xea, },\n    { 0x13, 0x50, 0x79, 0xa3, 0x23, 0x1c, 0xe6, 0x60, },\n    { 0x93, 0x2b, 0x28, 0x46, 0xe4, 0xd7, 0x06, 0x66, },\n    { 0xe1, 0x91, 0x5f, 0x5c, 0xb1, 0xec, 0xa4, 0x6c, },\n    { 0xf3, 0x25, 0x96, 0x5c, 0xa1, 0x6d, 0x62, 0x9f, },\n    { 0x57, 0x5f, 0xf2, 0x8e, 0x60, 0x38, 0x1b, 0xe5, },\n    { 0x72, 0x45, 0x06, 0xeb, 0x4c, 0x32, 0x8a, 0x95, }\n  };\n  /* clang-format on */\n\n  unsigned char in[64];\n  struct sipkey k;\n  size_t i;\n\n  sip_tokey(&k, \"\\000\\001\\002\\003\\004\\005\\006\\007\\010\\011\"\n                \"\\012\\013\\014\\015\\016\\017\");\n\n  for (i = 0; i < sizeof in; ++i) {\n    in[i] = (unsigned char)i;\n\n    if (siphash24(in, i, &k) != SIP_U8TO64_LE(vectors[i]))\n      return 0;\n  }\n\n  return 1;\n} /* sip24_valid() */\n\n#ifdef SIPHASH_MAIN\n\n#  include <stdio.h>\n\nint\nmain(void) {\n  const int ok = sip24_valid();\n\n  if (ok)\n    puts(\"OK\");\n  else\n    puts(\"FAIL\");\n\n  return ! ok;\n} /* main() */\n\n#endif /* SIPHASH_MAIN */\n\n#endif /* SIPHASH_H */\n"},{"id":16512,"name":"winconfig.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/*\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#ifndef WINCONFIG_H\n#define WINCONFIG_H\n\n#define WIN32_LEAN_AND_MEAN\n#include <windows.h>\n#undef WIN32_LEAN_AND_MEAN\n\n#include <memory.h>\n#include <string.h>\n\n#if defined(HAVE_EXPAT_CONFIG_H) /* e.g. MinGW */\n#  include <expat_config.h>\n#else /* !defined(HAVE_EXPAT_CONFIG_H) */\n\n#  define XML_NS 1\n#  define XML_DTD 1\n#  define XML_CONTEXT_BYTES 1024\n\n/* we will assume all Windows platforms are little endian */\n#  define BYTEORDER 1234\n\n#endif /* !defined(HAVE_EXPAT_CONFIG_H) */\n\n#endif /* ndef WINCONFIG_H */\n"},{"id":16513,"name":"latin1tab.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/*\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,\n    /* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,\n    /* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,\n    /* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,\n    /* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,\n    /* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,\n    /* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,\n    /* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,\n    /* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,\n    /* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,\n    /* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,\n    /* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,\n    /* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,\n    /* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME,\n    /* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,\n    /* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,\n    /* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,\n    /* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,\n    /* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n"},{"id":16514,"name":"libexpat.def","nodeType":"TextFile","path":"cextern/expat/lib","text":"; DEF file for MS VC++\n\nLIBRARY\nEXPORTS\n  XML_DefaultCurrent @1\n  XML_ErrorString @2\n  XML_ExpatVersion @3\n  XML_ExpatVersionInfo @4\n  XML_ExternalEntityParserCreate @5\n  XML_GetBase @6\n  XML_GetBuffer @7\n  XML_GetCurrentByteCount @8\n  XML_GetCurrentByteIndex @9\n  XML_GetCurrentColumnNumber @10\n  XML_GetCurrentLineNumber @11\n  XML_GetErrorCode @12\n  XML_GetIdAttributeIndex @13\n  XML_GetInputContext @14\n  XML_GetSpecifiedAttributeCount @15\n  XML_Parse @16\n  XML_ParseBuffer @17\n  XML_ParserCreate @18\n  XML_ParserCreateNS @19\n  XML_ParserCreate_MM @20\n  XML_ParserFree @21\n  XML_SetAttlistDeclHandler @22\n  XML_SetBase @23\n  XML_SetCdataSectionHandler @24\n  XML_SetCharacterDataHandler @25\n  XML_SetCommentHandler @26\n  XML_SetDefaultHandler @27\n  XML_SetDefaultHandlerExpand @28\n  XML_SetDoctypeDeclHandler @29\n  XML_SetElementDeclHandler @30\n  XML_SetElementHandler @31\n  XML_SetEncoding @32\n  XML_SetEndCdataSectionHandler @33\n  XML_SetEndDoctypeDeclHandler @34\n  XML_SetEndElementHandler @35\n  XML_SetEndNamespaceDeclHandler @36\n  XML_SetEntityDeclHandler @37\n  XML_SetExternalEntityRefHandler @38\n  XML_SetExternalEntityRefHandlerArg @39\n  XML_SetNamespaceDeclHandler @40\n  XML_SetNotStandaloneHandler @41\n  XML_SetNotationDeclHandler @42\n  XML_SetParamEntityParsing @43\n  XML_SetProcessingInstructionHandler @44\n  XML_SetReturnNSTriplet @45\n  XML_SetStartCdataSectionHandler @46\n  XML_SetStartDoctypeDeclHandler @47\n  XML_SetStartElementHandler @48\n  XML_SetStartNamespaceDeclHandler @49\n  XML_SetUnknownEncodingHandler @50\n  XML_SetUnparsedEntityDeclHandler @51\n  XML_SetUserData @52\n  XML_SetXmlDeclHandler @53\n  XML_UseParserAsHandlerArg @54\n; added with version 1.95.3\n  XML_ParserReset @55\n  XML_SetSkippedEntityHandler @56\n; added with version 1.95.5\n  XML_GetFeatureList @57\n  XML_UseForeignDTD @58\n; added with version 1.95.6\n  XML_FreeContentModel @59\n  XML_MemMalloc @60\n  XML_MemRealloc @61\n  XML_MemFree @62\n; added with version 1.95.8\n  XML_StopParser @63\n  XML_ResumeParser @64\n  XML_GetParsingStatus @65\n; added with version 2.1.1\n; XML_GetAttributeInfo @66\n  XML_SetHashSalt @67\n; added with version 2.2.5\n  _INTERNAL_trim_to_complete_utf8_characters @68\n"},{"id":16515,"name":"expat_external.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/*\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#ifndef Expat_External_INCLUDED\n#define Expat_External_INCLUDED 1\n\n/* External API definitions */\n\n/* Expat tries very hard to make the API boundary very specifically\n   defined.  There are two macros defined to control this boundary;\n   each of these can be defined before including this header to\n   achieve some different behavior, but doing so it not recommended or\n   tested frequently.\n\n   XMLCALL    - The calling convention to use for all calls across the\n                \"library boundary.\"  This will default to cdecl, and\n                try really hard to tell the compiler that's what we\n                want.\n\n   XMLIMPORT  - Whatever magic is needed to note that a function is\n                to be imported from a dynamically loaded library\n                (.dll, .so, or .sl, depending on your platform).\n\n   The XMLCALL macro was added in Expat 1.95.7.  The only one which is\n   expected to be directly useful in client code is XMLCALL.\n\n   Note that on at least some Unix versions, the Expat library must be\n   compiled with the cdecl calling convention as the default since\n   system headers may assume the cdecl convention.\n*/\n#ifndef XMLCALL\n#  if defined(_MSC_VER)\n#    define XMLCALL __cdecl\n#  elif defined(__GNUC__) && defined(__i386) && ! defined(__INTEL_COMPILER)\n#    define XMLCALL __attribute__((cdecl))\n#  else\n/* For any platform which uses this definition and supports more than\n   one calling convention, we need to extend this definition to\n   declare the convention used on that platform, if it's possible to\n   do so.\n\n   If this is the case for your platform, please file a bug report\n   with information on how to identify your platform via the C\n   pre-processor and how to specify the same calling convention as the\n   platform's malloc() implementation.\n*/\n#    define XMLCALL\n#  endif\n#endif /* not defined XMLCALL */\n\n#if ! defined(XML_STATIC) && ! defined(XMLIMPORT)\n#  ifndef XML_BUILDING_EXPAT\n/* using Expat from an application */\n\n#    if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__) && ! defined(__CYGWIN__)\n#      define XMLIMPORT __declspec(dllimport)\n#    endif\n\n#  endif\n#endif /* not defined XML_STATIC */\n\n#ifndef XML_ENABLE_VISIBILITY\n#  define XML_ENABLE_VISIBILITY 0\n#endif\n\n#if ! defined(XMLIMPORT) && XML_ENABLE_VISIBILITY\n#  define XMLIMPORT __attribute__((visibility(\"default\")))\n#endif\n\n/* If we didn't define it above, define it away: */\n#ifndef XMLIMPORT\n#  define XMLIMPORT\n#endif\n\n#if defined(__GNUC__)                                                          \\\n    && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))\n#  define XML_ATTR_MALLOC __attribute__((__malloc__))\n#else\n#  define XML_ATTR_MALLOC\n#endif\n\n#if defined(__GNUC__)                                                          \\\n    && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))\n#  define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))\n#else\n#  define XML_ATTR_ALLOC_SIZE(x)\n#endif\n\n#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef XML_UNICODE_WCHAR_T\n#  ifndef XML_UNICODE\n#    define XML_UNICODE\n#  endif\n#  if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2)\n#    error \"sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc\"\n#  endif\n#endif\n\n#ifdef XML_UNICODE /* Information is UTF-16 encoded. */\n#  ifdef XML_UNICODE_WCHAR_T\ntypedef wchar_t XML_Char;\ntypedef wchar_t XML_LChar;\n#  else\ntypedef unsigned short XML_Char;\ntypedef char XML_LChar;\n#  endif /* XML_UNICODE_WCHAR_T */\n#else    /* Information is UTF-8 encoded. */\ntypedef char XML_Char;\ntypedef char XML_LChar;\n#endif   /* XML_UNICODE */\n\n#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */\ntypedef long long XML_Index;\ntypedef unsigned long long XML_Size;\n#else\ntypedef long XML_Index;\ntypedef unsigned long XML_Size;\n#endif /* XML_LARGE_SIZE */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* not Expat_External_INCLUDED */\n"},{"id":16516,"name":"xmlrole.c","nodeType":"TextFile","path":"cextern/expat/lib","text":"/*\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#include <stddef.h>\n\n#ifdef _WIN32\n#  include \"winconfig.h\"\n#else\n#  ifdef HAVE_EXPAT_CONFIG_H\n#    include <expat_config.h>\n#  endif\n#endif /* ndef _WIN32 */\n\n#include \"expat_external.h\"\n#include \"internal.h\"\n#include \"xmlrole.h\"\n#include \"ascii.h\"\n\n/* Doesn't check:\n\n that ,| are not mixed in a model group\n content of literals\n\n*/\n\nstatic const char KW_ANY[] = {ASCII_A, ASCII_N, ASCII_Y, '\\0'};\nstatic const char KW_ATTLIST[]\n    = {ASCII_A, ASCII_T, ASCII_T, ASCII_L, ASCII_I, ASCII_S, ASCII_T, '\\0'};\nstatic const char KW_CDATA[]\n    = {ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\\0'};\nstatic const char KW_DOCTYPE[]\n    = {ASCII_D, ASCII_O, ASCII_C, ASCII_T, ASCII_Y, ASCII_P, ASCII_E, '\\0'};\nstatic const char KW_ELEMENT[]\n    = {ASCII_E, ASCII_L, ASCII_E, ASCII_M, ASCII_E, ASCII_N, ASCII_T, '\\0'};\nstatic const char KW_EMPTY[]\n    = {ASCII_E, ASCII_M, ASCII_P, ASCII_T, ASCII_Y, '\\0'};\nstatic const char KW_ENTITIES[] = {ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T,\n                                   ASCII_I, ASCII_E, ASCII_S, '\\0'};\nstatic const char KW_ENTITY[]\n    = {ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\\0'};\nstatic const char KW_FIXED[]\n    = {ASCII_F, ASCII_I, ASCII_X, ASCII_E, ASCII_D, '\\0'};\nstatic const char KW_ID[] = {ASCII_I, ASCII_D, '\\0'};\nstatic const char KW_IDREF[]\n    = {ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\\0'};\nstatic const char KW_IDREFS[]\n    = {ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\\0'};\n#ifdef XML_DTD\nstatic const char KW_IGNORE[]\n    = {ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\\0'};\n#endif\nstatic const char KW_IMPLIED[]\n    = {ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\\0'};\n#ifdef XML_DTD\nstatic const char KW_INCLUDE[]\n    = {ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\\0'};\n#endif\nstatic const char KW_NDATA[]\n    = {ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\\0'};\nstatic const char KW_NMTOKEN[]\n    = {ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\\0'};\nstatic const char KW_NMTOKENS[] = {ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K,\n                                   ASCII_E, ASCII_N, ASCII_S, '\\0'};\nstatic const char KW_NOTATION[] = {ASCII_N, ASCII_O, ASCII_T, ASCII_A, ASCII_T,\n                                   ASCII_I, ASCII_O, ASCII_N, '\\0'};\nstatic const char KW_PCDATA[]\n    = {ASCII_P, ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\\0'};\nstatic const char KW_PUBLIC[]\n    = {ASCII_P, ASCII_U, ASCII_B, ASCII_L, ASCII_I, ASCII_C, '\\0'};\nstatic const char KW_REQUIRED[] = {ASCII_R, ASCII_E, ASCII_Q, ASCII_U, ASCII_I,\n                                   ASCII_R, ASCII_E, ASCII_D, '\\0'};\nstatic const char KW_SYSTEM[]\n    = {ASCII_S, ASCII_Y, ASCII_S, ASCII_T, ASCII_E, ASCII_M, '\\0'};\n\n#ifndef MIN_BYTES_PER_CHAR\n#  define MIN_BYTES_PER_CHAR(enc) ((enc)->minBytesPerChar)\n#endif\n\n#ifdef XML_DTD\n#  define setTopLevel(state)                                                   \\\n    ((state)->handler                                                          \\\n     = ((state)->documentEntity ? internalSubset : externalSubset1))\n#else /* not XML_DTD */\n#  define setTopLevel(state) ((state)->handler = internalSubset)\n#endif /* not XML_DTD */\n\ntypedef int PTRCALL PROLOG_HANDLER(PROLOG_STATE *state, int tok,\n                                   const char *ptr, const char *end,\n                                   const ENCODING *enc);\n\nstatic PROLOG_HANDLER prolog0, prolog1, prolog2, doctype0, doctype1, doctype2,\n    doctype3, doctype4, doctype5, internalSubset, entity0, entity1, entity2,\n    entity3, entity4, entity5, entity6, entity7, entity8, entity9, entity10,\n    notation0, notation1, notation2, notation3, notation4, attlist0, attlist1,\n    attlist2, attlist3, attlist4, attlist5, attlist6, attlist7, attlist8,\n    attlist9, element0, element1, element2, element3, element4, element5,\n    element6, element7,\n#ifdef XML_DTD\n    externalSubset0, externalSubset1, condSect0, condSect1, condSect2,\n#endif /* XML_DTD */\n    declClose, error;\n\nstatic int FASTCALL common(PROLOG_STATE *state, int tok);\n\nstatic int PTRCALL\nprolog0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n        const ENCODING *enc) {\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    state->handler = prolog1;\n    return XML_ROLE_NONE;\n  case XML_TOK_XML_DECL:\n    state->handler = prolog1;\n    return XML_ROLE_XML_DECL;\n  case XML_TOK_PI:\n    state->handler = prolog1;\n    return XML_ROLE_PI;\n  case XML_TOK_COMMENT:\n    state->handler = prolog1;\n    return XML_ROLE_COMMENT;\n  case XML_TOK_BOM:\n    return XML_ROLE_NONE;\n  case XML_TOK_DECL_OPEN:\n    if (! XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end,\n                              KW_DOCTYPE))\n      break;\n    state->handler = doctype0;\n    return XML_ROLE_DOCTYPE_NONE;\n  case XML_TOK_INSTANCE_START:\n    state->handler = error;\n    return XML_ROLE_INSTANCE_START;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nprolog1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n        const ENCODING *enc) {\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_NONE;\n  case XML_TOK_PI:\n    return XML_ROLE_PI;\n  case XML_TOK_COMMENT:\n    return XML_ROLE_COMMENT;\n  case XML_TOK_BOM:\n    /* This case can never arise.  To reach this role function, the\n     * parse must have passed through prolog0 and therefore have had\n     * some form of input, even if only a space.  At that point, a\n     * byte order mark is no longer a valid character (though\n     * technically it should be interpreted as a non-breaking space),\n     * so will be rejected by the tokenizing stages.\n     */\n    return XML_ROLE_NONE; /* LCOV_EXCL_LINE */\n  case XML_TOK_DECL_OPEN:\n    if (! XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end,\n                              KW_DOCTYPE))\n      break;\n    state->handler = doctype0;\n    return XML_ROLE_DOCTYPE_NONE;\n  case XML_TOK_INSTANCE_START:\n    state->handler = error;\n    return XML_ROLE_INSTANCE_START;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nprolog2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n        const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_NONE;\n  case XML_TOK_PI:\n    return XML_ROLE_PI;\n  case XML_TOK_COMMENT:\n    return XML_ROLE_COMMENT;\n  case XML_TOK_INSTANCE_START:\n    state->handler = error;\n    return XML_ROLE_INSTANCE_START;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\ndoctype0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_DOCTYPE_NONE;\n  case XML_TOK_NAME:\n  case XML_TOK_PREFIXED_NAME:\n    state->handler = doctype1;\n    return XML_ROLE_DOCTYPE_NAME;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\ndoctype1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_DOCTYPE_NONE;\n  case XML_TOK_OPEN_BRACKET:\n    state->handler = internalSubset;\n    return XML_ROLE_DOCTYPE_INTERNAL_SUBSET;\n  case XML_TOK_DECL_CLOSE:\n    state->handler = prolog2;\n    return XML_ROLE_DOCTYPE_CLOSE;\n  case XML_TOK_NAME:\n    if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) {\n      state->handler = doctype3;\n      return XML_ROLE_DOCTYPE_NONE;\n    }\n    if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) {\n      state->handler = doctype2;\n      return XML_ROLE_DOCTYPE_NONE;\n    }\n    break;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\ndoctype2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_DOCTYPE_NONE;\n  case XML_TOK_LITERAL:\n    state->handler = doctype3;\n    return XML_ROLE_DOCTYPE_PUBLIC_ID;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\ndoctype3(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_DOCTYPE_NONE;\n  case XML_TOK_LITERAL:\n    state->handler = doctype4;\n    return XML_ROLE_DOCTYPE_SYSTEM_ID;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\ndoctype4(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_DOCTYPE_NONE;\n  case XML_TOK_OPEN_BRACKET:\n    state->handler = internalSubset;\n    return XML_ROLE_DOCTYPE_INTERNAL_SUBSET;\n  case XML_TOK_DECL_CLOSE:\n    state->handler = prolog2;\n    return XML_ROLE_DOCTYPE_CLOSE;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\ndoctype5(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_DOCTYPE_NONE;\n  case XML_TOK_DECL_CLOSE:\n    state->handler = prolog2;\n    return XML_ROLE_DOCTYPE_CLOSE;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\ninternalSubset(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n               const ENCODING *enc) {\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_NONE;\n  case XML_TOK_DECL_OPEN:\n    if (XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end,\n                            KW_ENTITY)) {\n      state->handler = entity0;\n      return XML_ROLE_ENTITY_NONE;\n    }\n    if (XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end,\n                            KW_ATTLIST)) {\n      state->handler = attlist0;\n      return XML_ROLE_ATTLIST_NONE;\n    }\n    if (XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end,\n                            KW_ELEMENT)) {\n      state->handler = element0;\n      return XML_ROLE_ELEMENT_NONE;\n    }\n    if (XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end,\n                            KW_NOTATION)) {\n      state->handler = notation0;\n      return XML_ROLE_NOTATION_NONE;\n    }\n    break;\n  case XML_TOK_PI:\n    return XML_ROLE_PI;\n  case XML_TOK_COMMENT:\n    return XML_ROLE_COMMENT;\n  case XML_TOK_PARAM_ENTITY_REF:\n    return XML_ROLE_PARAM_ENTITY_REF;\n  case XML_TOK_CLOSE_BRACKET:\n    state->handler = doctype5;\n    return XML_ROLE_DOCTYPE_NONE;\n  case XML_TOK_NONE:\n    return XML_ROLE_NONE;\n  }\n  return common(state, tok);\n}\n\n#ifdef XML_DTD\n\nstatic int PTRCALL\nexternalSubset0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n                const ENCODING *enc) {\n  state->handler = externalSubset1;\n  if (tok == XML_TOK_XML_DECL)\n    return XML_ROLE_TEXT_DECL;\n  return externalSubset1(state, tok, ptr, end, enc);\n}\n\nstatic int PTRCALL\nexternalSubset1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n                const ENCODING *enc) {\n  switch (tok) {\n  case XML_TOK_COND_SECT_OPEN:\n    state->handler = condSect0;\n    return XML_ROLE_NONE;\n  case XML_TOK_COND_SECT_CLOSE:\n    if (state->includeLevel == 0)\n      break;\n    state->includeLevel -= 1;\n    return XML_ROLE_NONE;\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_NONE;\n  case XML_TOK_CLOSE_BRACKET:\n    break;\n  case XML_TOK_NONE:\n    if (state->includeLevel)\n      break;\n    return XML_ROLE_NONE;\n  default:\n    return internalSubset(state, tok, ptr, end, enc);\n  }\n  return common(state, tok);\n}\n\n#endif /* XML_DTD */\n\nstatic int PTRCALL\nentity0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n        const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ENTITY_NONE;\n  case XML_TOK_PERCENT:\n    state->handler = entity1;\n    return XML_ROLE_ENTITY_NONE;\n  case XML_TOK_NAME:\n    state->handler = entity2;\n    return XML_ROLE_GENERAL_ENTITY_NAME;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nentity1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n        const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ENTITY_NONE;\n  case XML_TOK_NAME:\n    state->handler = entity7;\n    return XML_ROLE_PARAM_ENTITY_NAME;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nentity2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n        const ENCODING *enc) {\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ENTITY_NONE;\n  case XML_TOK_NAME:\n    if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) {\n      state->handler = entity4;\n      return XML_ROLE_ENTITY_NONE;\n    }\n    if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) {\n      state->handler = entity3;\n      return XML_ROLE_ENTITY_NONE;\n    }\n    break;\n  case XML_TOK_LITERAL:\n    state->handler = declClose;\n    state->role_none = XML_ROLE_ENTITY_NONE;\n    return XML_ROLE_ENTITY_VALUE;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nentity3(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n        const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ENTITY_NONE;\n  case XML_TOK_LITERAL:\n    state->handler = entity4;\n    return XML_ROLE_ENTITY_PUBLIC_ID;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nentity4(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n        const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ENTITY_NONE;\n  case XML_TOK_LITERAL:\n    state->handler = entity5;\n    return XML_ROLE_ENTITY_SYSTEM_ID;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nentity5(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n        const ENCODING *enc) {\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ENTITY_NONE;\n  case XML_TOK_DECL_CLOSE:\n    setTopLevel(state);\n    return XML_ROLE_ENTITY_COMPLETE;\n  case XML_TOK_NAME:\n    if (XmlNameMatchesAscii(enc, ptr, end, KW_NDATA)) {\n      state->handler = entity6;\n      return XML_ROLE_ENTITY_NONE;\n    }\n    break;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nentity6(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n        const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ENTITY_NONE;\n  case XML_TOK_NAME:\n    state->handler = declClose;\n    state->role_none = XML_ROLE_ENTITY_NONE;\n    return XML_ROLE_ENTITY_NOTATION_NAME;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nentity7(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n        const ENCODING *enc) {\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ENTITY_NONE;\n  case XML_TOK_NAME:\n    if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) {\n      state->handler = entity9;\n      return XML_ROLE_ENTITY_NONE;\n    }\n    if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) {\n      state->handler = entity8;\n      return XML_ROLE_ENTITY_NONE;\n    }\n    break;\n  case XML_TOK_LITERAL:\n    state->handler = declClose;\n    state->role_none = XML_ROLE_ENTITY_NONE;\n    return XML_ROLE_ENTITY_VALUE;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nentity8(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n        const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ENTITY_NONE;\n  case XML_TOK_LITERAL:\n    state->handler = entity9;\n    return XML_ROLE_ENTITY_PUBLIC_ID;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nentity9(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n        const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ENTITY_NONE;\n  case XML_TOK_LITERAL:\n    state->handler = entity10;\n    return XML_ROLE_ENTITY_SYSTEM_ID;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nentity10(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ENTITY_NONE;\n  case XML_TOK_DECL_CLOSE:\n    setTopLevel(state);\n    return XML_ROLE_ENTITY_COMPLETE;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nnotation0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n          const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_NOTATION_NONE;\n  case XML_TOK_NAME:\n    state->handler = notation1;\n    return XML_ROLE_NOTATION_NAME;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nnotation1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n          const ENCODING *enc) {\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_NOTATION_NONE;\n  case XML_TOK_NAME:\n    if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) {\n      state->handler = notation3;\n      return XML_ROLE_NOTATION_NONE;\n    }\n    if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) {\n      state->handler = notation2;\n      return XML_ROLE_NOTATION_NONE;\n    }\n    break;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nnotation2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n          const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_NOTATION_NONE;\n  case XML_TOK_LITERAL:\n    state->handler = notation4;\n    return XML_ROLE_NOTATION_PUBLIC_ID;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nnotation3(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n          const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_NOTATION_NONE;\n  case XML_TOK_LITERAL:\n    state->handler = declClose;\n    state->role_none = XML_ROLE_NOTATION_NONE;\n    return XML_ROLE_NOTATION_SYSTEM_ID;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nnotation4(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n          const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_NOTATION_NONE;\n  case XML_TOK_LITERAL:\n    state->handler = declClose;\n    state->role_none = XML_ROLE_NOTATION_NONE;\n    return XML_ROLE_NOTATION_SYSTEM_ID;\n  case XML_TOK_DECL_CLOSE:\n    setTopLevel(state);\n    return XML_ROLE_NOTATION_NO_SYSTEM_ID;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nattlist0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ATTLIST_NONE;\n  case XML_TOK_NAME:\n  case XML_TOK_PREFIXED_NAME:\n    state->handler = attlist1;\n    return XML_ROLE_ATTLIST_ELEMENT_NAME;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nattlist1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ATTLIST_NONE;\n  case XML_TOK_DECL_CLOSE:\n    setTopLevel(state);\n    return XML_ROLE_ATTLIST_NONE;\n  case XML_TOK_NAME:\n  case XML_TOK_PREFIXED_NAME:\n    state->handler = attlist2;\n    return XML_ROLE_ATTRIBUTE_NAME;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nattlist2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ATTLIST_NONE;\n  case XML_TOK_NAME: {\n    static const char *const types[] = {\n        KW_CDATA,  KW_ID,       KW_IDREF,   KW_IDREFS,\n        KW_ENTITY, KW_ENTITIES, KW_NMTOKEN, KW_NMTOKENS,\n    };\n    int i;\n    for (i = 0; i < (int)(sizeof(types) / sizeof(types[0])); i++)\n      if (XmlNameMatchesAscii(enc, ptr, end, types[i])) {\n        state->handler = attlist8;\n        return XML_ROLE_ATTRIBUTE_TYPE_CDATA + i;\n      }\n  }\n    if (XmlNameMatchesAscii(enc, ptr, end, KW_NOTATION)) {\n      state->handler = attlist5;\n      return XML_ROLE_ATTLIST_NONE;\n    }\n    break;\n  case XML_TOK_OPEN_PAREN:\n    state->handler = attlist3;\n    return XML_ROLE_ATTLIST_NONE;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nattlist3(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ATTLIST_NONE;\n  case XML_TOK_NMTOKEN:\n  case XML_TOK_NAME:\n  case XML_TOK_PREFIXED_NAME:\n    state->handler = attlist4;\n    return XML_ROLE_ATTRIBUTE_ENUM_VALUE;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nattlist4(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ATTLIST_NONE;\n  case XML_TOK_CLOSE_PAREN:\n    state->handler = attlist8;\n    return XML_ROLE_ATTLIST_NONE;\n  case XML_TOK_OR:\n    state->handler = attlist3;\n    return XML_ROLE_ATTLIST_NONE;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nattlist5(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ATTLIST_NONE;\n  case XML_TOK_OPEN_PAREN:\n    state->handler = attlist6;\n    return XML_ROLE_ATTLIST_NONE;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nattlist6(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ATTLIST_NONE;\n  case XML_TOK_NAME:\n    state->handler = attlist7;\n    return XML_ROLE_ATTRIBUTE_NOTATION_VALUE;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nattlist7(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ATTLIST_NONE;\n  case XML_TOK_CLOSE_PAREN:\n    state->handler = attlist8;\n    return XML_ROLE_ATTLIST_NONE;\n  case XML_TOK_OR:\n    state->handler = attlist6;\n    return XML_ROLE_ATTLIST_NONE;\n  }\n  return common(state, tok);\n}\n\n/* default value */\nstatic int PTRCALL\nattlist8(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ATTLIST_NONE;\n  case XML_TOK_POUND_NAME:\n    if (XmlNameMatchesAscii(enc, ptr + MIN_BYTES_PER_CHAR(enc), end,\n                            KW_IMPLIED)) {\n      state->handler = attlist1;\n      return XML_ROLE_IMPLIED_ATTRIBUTE_VALUE;\n    }\n    if (XmlNameMatchesAscii(enc, ptr + MIN_BYTES_PER_CHAR(enc), end,\n                            KW_REQUIRED)) {\n      state->handler = attlist1;\n      return XML_ROLE_REQUIRED_ATTRIBUTE_VALUE;\n    }\n    if (XmlNameMatchesAscii(enc, ptr + MIN_BYTES_PER_CHAR(enc), end,\n                            KW_FIXED)) {\n      state->handler = attlist9;\n      return XML_ROLE_ATTLIST_NONE;\n    }\n    break;\n  case XML_TOK_LITERAL:\n    state->handler = attlist1;\n    return XML_ROLE_DEFAULT_ATTRIBUTE_VALUE;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nattlist9(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ATTLIST_NONE;\n  case XML_TOK_LITERAL:\n    state->handler = attlist1;\n    return XML_ROLE_FIXED_ATTRIBUTE_VALUE;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nelement0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ELEMENT_NONE;\n  case XML_TOK_NAME:\n  case XML_TOK_PREFIXED_NAME:\n    state->handler = element1;\n    return XML_ROLE_ELEMENT_NAME;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nelement1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ELEMENT_NONE;\n  case XML_TOK_NAME:\n    if (XmlNameMatchesAscii(enc, ptr, end, KW_EMPTY)) {\n      state->handler = declClose;\n      state->role_none = XML_ROLE_ELEMENT_NONE;\n      return XML_ROLE_CONTENT_EMPTY;\n    }\n    if (XmlNameMatchesAscii(enc, ptr, end, KW_ANY)) {\n      state->handler = declClose;\n      state->role_none = XML_ROLE_ELEMENT_NONE;\n      return XML_ROLE_CONTENT_ANY;\n    }\n    break;\n  case XML_TOK_OPEN_PAREN:\n    state->handler = element2;\n    state->level = 1;\n    return XML_ROLE_GROUP_OPEN;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nelement2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ELEMENT_NONE;\n  case XML_TOK_POUND_NAME:\n    if (XmlNameMatchesAscii(enc, ptr + MIN_BYTES_PER_CHAR(enc), end,\n                            KW_PCDATA)) {\n      state->handler = element3;\n      return XML_ROLE_CONTENT_PCDATA;\n    }\n    break;\n  case XML_TOK_OPEN_PAREN:\n    state->level = 2;\n    state->handler = element6;\n    return XML_ROLE_GROUP_OPEN;\n  case XML_TOK_NAME:\n  case XML_TOK_PREFIXED_NAME:\n    state->handler = element7;\n    return XML_ROLE_CONTENT_ELEMENT;\n  case XML_TOK_NAME_QUESTION:\n    state->handler = element7;\n    return XML_ROLE_CONTENT_ELEMENT_OPT;\n  case XML_TOK_NAME_ASTERISK:\n    state->handler = element7;\n    return XML_ROLE_CONTENT_ELEMENT_REP;\n  case XML_TOK_NAME_PLUS:\n    state->handler = element7;\n    return XML_ROLE_CONTENT_ELEMENT_PLUS;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nelement3(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ELEMENT_NONE;\n  case XML_TOK_CLOSE_PAREN:\n    state->handler = declClose;\n    state->role_none = XML_ROLE_ELEMENT_NONE;\n    return XML_ROLE_GROUP_CLOSE;\n  case XML_TOK_CLOSE_PAREN_ASTERISK:\n    state->handler = declClose;\n    state->role_none = XML_ROLE_ELEMENT_NONE;\n    return XML_ROLE_GROUP_CLOSE_REP;\n  case XML_TOK_OR:\n    state->handler = element4;\n    return XML_ROLE_ELEMENT_NONE;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nelement4(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ELEMENT_NONE;\n  case XML_TOK_NAME:\n  case XML_TOK_PREFIXED_NAME:\n    state->handler = element5;\n    return XML_ROLE_CONTENT_ELEMENT;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nelement5(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ELEMENT_NONE;\n  case XML_TOK_CLOSE_PAREN_ASTERISK:\n    state->handler = declClose;\n    state->role_none = XML_ROLE_ELEMENT_NONE;\n    return XML_ROLE_GROUP_CLOSE_REP;\n  case XML_TOK_OR:\n    state->handler = element4;\n    return XML_ROLE_ELEMENT_NONE;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nelement6(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ELEMENT_NONE;\n  case XML_TOK_OPEN_PAREN:\n    state->level += 1;\n    return XML_ROLE_GROUP_OPEN;\n  case XML_TOK_NAME:\n  case XML_TOK_PREFIXED_NAME:\n    state->handler = element7;\n    return XML_ROLE_CONTENT_ELEMENT;\n  case XML_TOK_NAME_QUESTION:\n    state->handler = element7;\n    return XML_ROLE_CONTENT_ELEMENT_OPT;\n  case XML_TOK_NAME_ASTERISK:\n    state->handler = element7;\n    return XML_ROLE_CONTENT_ELEMENT_REP;\n  case XML_TOK_NAME_PLUS:\n    state->handler = element7;\n    return XML_ROLE_CONTENT_ELEMENT_PLUS;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\nelement7(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n         const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ELEMENT_NONE;\n  case XML_TOK_CLOSE_PAREN:\n    state->level -= 1;\n    if (state->level == 0) {\n      state->handler = declClose;\n      state->role_none = XML_ROLE_ELEMENT_NONE;\n    }\n    return XML_ROLE_GROUP_CLOSE;\n  case XML_TOK_CLOSE_PAREN_ASTERISK:\n    state->level -= 1;\n    if (state->level == 0) {\n      state->handler = declClose;\n      state->role_none = XML_ROLE_ELEMENT_NONE;\n    }\n    return XML_ROLE_GROUP_CLOSE_REP;\n  case XML_TOK_CLOSE_PAREN_QUESTION:\n    state->level -= 1;\n    if (state->level == 0) {\n      state->handler = declClose;\n      state->role_none = XML_ROLE_ELEMENT_NONE;\n    }\n    return XML_ROLE_GROUP_CLOSE_OPT;\n  case XML_TOK_CLOSE_PAREN_PLUS:\n    state->level -= 1;\n    if (state->level == 0) {\n      state->handler = declClose;\n      state->role_none = XML_ROLE_ELEMENT_NONE;\n    }\n    return XML_ROLE_GROUP_CLOSE_PLUS;\n  case XML_TOK_COMMA:\n    state->handler = element6;\n    return XML_ROLE_GROUP_SEQUENCE;\n  case XML_TOK_OR:\n    state->handler = element6;\n    return XML_ROLE_GROUP_CHOICE;\n  }\n  return common(state, tok);\n}\n\n#ifdef XML_DTD\n\nstatic int PTRCALL\ncondSect0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n          const ENCODING *enc) {\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_NONE;\n  case XML_TOK_NAME:\n    if (XmlNameMatchesAscii(enc, ptr, end, KW_INCLUDE)) {\n      state->handler = condSect1;\n      return XML_ROLE_NONE;\n    }\n    if (XmlNameMatchesAscii(enc, ptr, end, KW_IGNORE)) {\n      state->handler = condSect2;\n      return XML_ROLE_NONE;\n    }\n    break;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\ncondSect1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n          const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_NONE;\n  case XML_TOK_OPEN_BRACKET:\n    state->handler = externalSubset1;\n    state->includeLevel += 1;\n    return XML_ROLE_NONE;\n  }\n  return common(state, tok);\n}\n\nstatic int PTRCALL\ncondSect2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n          const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_NONE;\n  case XML_TOK_OPEN_BRACKET:\n    state->handler = externalSubset1;\n    return XML_ROLE_IGNORE_SECT;\n  }\n  return common(state, tok);\n}\n\n#endif /* XML_DTD */\n\nstatic int PTRCALL\ndeclClose(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n          const ENCODING *enc) {\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return state->role_none;\n  case XML_TOK_DECL_CLOSE:\n    setTopLevel(state);\n    return state->role_none;\n  }\n  return common(state, tok);\n}\n\n/* This function will only be invoked if the internal logic of the\n * parser has broken down.  It is used in two cases:\n *\n * 1: When the XML prolog has been finished.  At this point the\n * processor (the parser level above these role handlers) should\n * switch from prologProcessor to contentProcessor and reinitialise\n * the handler function.\n *\n * 2: When an error has been detected (via common() below).  At this\n * point again the processor should be switched to errorProcessor,\n * which will never call a handler.\n *\n * The result of this is that error() can only be called if the\n * processor switch failed to happen, which is an internal error and\n * therefore we shouldn't be able to provoke it simply by using the\n * library.  It is a necessary backstop, however, so we merely exclude\n * it from the coverage statistics.\n *\n * LCOV_EXCL_START\n */\nstatic int PTRCALL\nerror(PROLOG_STATE *state, int tok, const char *ptr, const char *end,\n      const ENCODING *enc) {\n  UNUSED_P(state);\n  UNUSED_P(tok);\n  UNUSED_P(ptr);\n  UNUSED_P(end);\n  UNUSED_P(enc);\n  return XML_ROLE_NONE;\n}\n/* LCOV_EXCL_STOP */\n\nstatic int FASTCALL\ncommon(PROLOG_STATE *state, int tok) {\n#ifdef XML_DTD\n  if (! state->documentEntity && tok == XML_TOK_PARAM_ENTITY_REF)\n    return XML_ROLE_INNER_PARAM_ENTITY_REF;\n#endif\n  state->handler = error;\n  return XML_ROLE_ERROR;\n}\n\nvoid\nXmlPrologStateInit(PROLOG_STATE *state) {\n  state->handler = prolog0;\n#ifdef XML_DTD\n  state->documentEntity = 1;\n  state->includeLevel = 0;\n  state->inEntityValue = 0;\n#endif /* XML_DTD */\n}\n\n#ifdef XML_DTD\n\nvoid\nXmlPrologStateInitExternalEntity(PROLOG_STATE *state) {\n  state->handler = externalSubset0;\n  state->documentEntity = 0;\n  state->includeLevel = 0;\n}\n\n#endif /* XML_DTD */\n"},{"attributeType":"null","col":16,"comment":"null","endLoc":6,"id":16517,"name":"np","nodeType":"Attribute","startLoc":6,"text":"np"},{"attributeType":"null","col":29,"comment":"null","endLoc":8,"id":16518,"name":"u","nodeType":"Attribute","startLoc":8,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":16519,"name":"LONLAT","nodeType":"Attribute","startLoc":12,"text":"LONLAT"},{"col":0,"comment":"","endLoc":4,"header":"coordinate_range.py#<anonymous>","id":16520,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"LONLAT = {'longitude', 'latitude'}"},{"id":16521,"name":"xmltok_ns.c","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* This file is included!\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#ifdef XML_TOK_NS_C\n\nconst ENCODING *\nNS(XmlGetUtf8InternalEncoding)(void) {\n  return &ns(internal_utf8_encoding).enc;\n}\n\nconst ENCODING *\nNS(XmlGetUtf16InternalEncoding)(void) {\n#  if BYTEORDER == 1234\n  return &ns(internal_little2_encoding).enc;\n#  elif BYTEORDER == 4321\n  return &ns(internal_big2_encoding).enc;\n#  else\n  const short n = 1;\n  return (*(const char *)&n ? &ns(internal_little2_encoding).enc\n                            : &ns(internal_big2_encoding).enc);\n#  endif\n}\n\nstatic const ENCODING *const NS(encodings)[] = {\n    &ns(latin1_encoding).enc, &ns(ascii_encoding).enc,\n    &ns(utf8_encoding).enc,   &ns(big2_encoding).enc,\n    &ns(big2_encoding).enc,   &ns(little2_encoding).enc,\n    &ns(utf8_encoding).enc /* NO_ENC */\n};\n\nstatic int PTRCALL\nNS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end,\n                   const char **nextTokPtr) {\n  return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_PROLOG_STATE,\n                  ptr, end, nextTokPtr);\n}\n\nstatic int PTRCALL\nNS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end,\n                    const char **nextTokPtr) {\n  return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_CONTENT_STATE,\n                  ptr, end, nextTokPtr);\n}\n\nint\nNS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr,\n                    const char *name) {\n  int i = getEncodingIndex(name);\n  if (i == UNKNOWN_ENC)\n    return 0;\n  SET_INIT_ENC_INDEX(p, i);\n  p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog);\n  p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent);\n  p->initEnc.updatePosition = initUpdatePosition;\n  p->encPtr = encPtr;\n  *encPtr = &(p->initEnc);\n  return 1;\n}\n\nstatic const ENCODING *\nNS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) {\n#  define ENCODING_MAX 128\n  char buf[ENCODING_MAX];\n  char *p = buf;\n  int i;\n  XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1);\n  if (ptr != end)\n    return 0;\n  *p = 0;\n  if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2)\n    return enc;\n  i = getEncodingIndex(buf);\n  if (i == UNKNOWN_ENC)\n    return 0;\n  return NS(encodings)[i];\n}\n\nint\nNS(XmlParseXmlDecl)(int isGeneralTextEntity, const ENCODING *enc,\n                    const char *ptr, const char *end, const char **badPtr,\n                    const char **versionPtr, const char **versionEndPtr,\n                    const char **encodingName, const ENCODING **encoding,\n                    int *standalone) {\n  return doParseXmlDecl(NS(findEncoding), isGeneralTextEntity, enc, ptr, end,\n                        badPtr, versionPtr, versionEndPtr, encodingName,\n                        encoding, standalone);\n}\n\n#endif /* XML_TOK_NS_C */\n"},{"col":4,"comment":"\n        Get the bounding box of an individual label. n.b. _set_xy_alignment()\n        must be called before this method.\n        ","endLoc":253,"header":"def _get_bb(self, axis, i, renderer)","id":16522,"name":"_get_bb","nodeType":"Function","startLoc":241,"text":"def _get_bb(self, axis, i, renderer):\n        \"\"\"\n        Get the bounding box of an individual label. n.b. _set_xy_alignment()\n        must be called before this method.\n        \"\"\"\n        if self.text[axis][i] == '':\n            return\n\n        self.set_text(self.text[axis][i])\n        self.set_position(self.xy[axis][i])\n        self.set_ha(self.ha[axis][i])\n        self.set_va(self.va[axis][i])\n        return super().get_window_extent(renderer)"},{"id":16523,"name":"Makefile.am","nodeType":"TextFile","path":"cextern/expat/lib","text":"#\n#                          __  __            _\n#                       ___\\ \\/ /_ __   __ _| |_\n#                      / _ \\\\  /| '_ \\ / _` | __|\n#                     |  __//  \\| |_) | (_| | |_\n#                      \\___/_/\\_\\ .__/ \\__,_|\\__|\n#                               |_| XML parser\n#\n# Copyright (c) 2017 Expat development team\n# Licensed under the MIT license:\n#\n# Permission is  hereby granted,  free of charge,  to any  person obtaining\n# a  copy  of  this  software   and  associated  documentation  files  (the\n# \"Software\"),  to  deal in  the  Software  without restriction,  including\n# without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n# distribute, sublicense, and/or sell copies of the Software, and to permit\n# persons  to whom  the Software  is  furnished to  do so,  subject to  the\n# following conditions:\n#\n# The above copyright  notice and this permission notice  shall be included\n# in all copies or substantial portions of the Software.\n#\n# THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n# EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n# NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n# DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n# USE OR OTHER DEALINGS IN THE SOFTWARE.\n\ninclude_HEADERS = \\\n    ../expat_config.h \\\n    expat.h \\\n    expat_external.h\n\nlib_LTLIBRARIES = libexpat.la\n\nlibexpat_la_LDFLAGS = \\\n    -no-undefined \\\n    -version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@\n\nlibexpat_la_SOURCES = \\\n    xmlparse.c \\\n    xmltok.c \\\n    xmlrole.c\n\ndoc_DATA = \\\n    ../AUTHORS \\\n    ../Changes\n\ninstall-data-hook:\n\tcd \"$(DESTDIR)$(docdir)\" && $(am__mv) Changes changelog\n\nuninstall-local:\n\t$(RM) \"$(DESTDIR)$(docdir)/changelog\"\n\nEXTRA_DIST = \\\n    ascii.h \\\n    asciitab.h \\\n    expat_external.h \\\n    expat.h \\\n    iasciitab.h \\\n    internal.h \\\n    latin1tab.h \\\n    libexpat.def \\\n    libexpatw.def \\\n    nametab.h \\\n    siphash.h \\\n    utf8tab.h \\\n    winconfig.h \\\n    xmlrole.h \\\n    xmltok.h \\\n    xmltok_impl.c \\\n    xmltok_impl.h \\\n    xmltok_ns.c\n"},{"id":16524,"name":"ascii.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/*\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#define ASCII_A 0x41\n#define ASCII_B 0x42\n#define ASCII_C 0x43\n#define ASCII_D 0x44\n#define ASCII_E 0x45\n#define ASCII_F 0x46\n#define ASCII_G 0x47\n#define ASCII_H 0x48\n#define ASCII_I 0x49\n#define ASCII_J 0x4A\n#define ASCII_K 0x4B\n#define ASCII_L 0x4C\n#define ASCII_M 0x4D\n#define ASCII_N 0x4E\n#define ASCII_O 0x4F\n#define ASCII_P 0x50\n#define ASCII_Q 0x51\n#define ASCII_R 0x52\n#define ASCII_S 0x53\n#define ASCII_T 0x54\n#define ASCII_U 0x55\n#define ASCII_V 0x56\n#define ASCII_W 0x57\n#define ASCII_X 0x58\n#define ASCII_Y 0x59\n#define ASCII_Z 0x5A\n\n#define ASCII_a 0x61\n#define ASCII_b 0x62\n#define ASCII_c 0x63\n#define ASCII_d 0x64\n#define ASCII_e 0x65\n#define ASCII_f 0x66\n#define ASCII_g 0x67\n#define ASCII_h 0x68\n#define ASCII_i 0x69\n#define ASCII_j 0x6A\n#define ASCII_k 0x6B\n#define ASCII_l 0x6C\n#define ASCII_m 0x6D\n#define ASCII_n 0x6E\n#define ASCII_o 0x6F\n#define ASCII_p 0x70\n#define ASCII_q 0x71\n#define ASCII_r 0x72\n#define ASCII_s 0x73\n#define ASCII_t 0x74\n#define ASCII_u 0x75\n#define ASCII_v 0x76\n#define ASCII_w 0x77\n#define ASCII_x 0x78\n#define ASCII_y 0x79\n#define ASCII_z 0x7A\n\n#define ASCII_0 0x30\n#define ASCII_1 0x31\n#define ASCII_2 0x32\n#define ASCII_3 0x33\n#define ASCII_4 0x34\n#define ASCII_5 0x35\n#define ASCII_6 0x36\n#define ASCII_7 0x37\n#define ASCII_8 0x38\n#define ASCII_9 0x39\n\n#define ASCII_TAB 0x09\n#define ASCII_SPACE 0x20\n#define ASCII_EXCL 0x21\n#define ASCII_QUOT 0x22\n#define ASCII_AMP 0x26\n#define ASCII_APOS 0x27\n#define ASCII_MINUS 0x2D\n#define ASCII_PERIOD 0x2E\n#define ASCII_COLON 0x3A\n#define ASCII_SEMI 0x3B\n#define ASCII_LT 0x3C\n#define ASCII_EQUALS 0x3D\n#define ASCII_GT 0x3E\n#define ASCII_LSQB 0x5B\n#define ASCII_RSQB 0x5D\n#define ASCII_UNDERSCORE 0x5F\n#define ASCII_LPAREN 0x28\n#define ASCII_RPAREN 0x29\n#define ASCII_FF 0x0C\n#define ASCII_SLASH 0x2F\n#define ASCII_HASH 0x23\n#define ASCII_PIPE 0x7C\n#define ASCII_COMMA 0x2C\n"},{"id":16525,"name":"xmlrole.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/*\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#ifndef XmlRole_INCLUDED\n#define XmlRole_INCLUDED 1\n\n#ifdef __VMS\n/*      0        1         2         3      0        1         2         3\n        1234567890123456789012345678901     1234567890123456789012345678901 */\n#  define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt\n#endif\n\n#include \"xmltok.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nenum {\n  XML_ROLE_ERROR = -1,\n  XML_ROLE_NONE = 0,\n  XML_ROLE_XML_DECL,\n  XML_ROLE_INSTANCE_START,\n  XML_ROLE_DOCTYPE_NONE,\n  XML_ROLE_DOCTYPE_NAME,\n  XML_ROLE_DOCTYPE_SYSTEM_ID,\n  XML_ROLE_DOCTYPE_PUBLIC_ID,\n  XML_ROLE_DOCTYPE_INTERNAL_SUBSET,\n  XML_ROLE_DOCTYPE_CLOSE,\n  XML_ROLE_GENERAL_ENTITY_NAME,\n  XML_ROLE_PARAM_ENTITY_NAME,\n  XML_ROLE_ENTITY_NONE,\n  XML_ROLE_ENTITY_VALUE,\n  XML_ROLE_ENTITY_SYSTEM_ID,\n  XML_ROLE_ENTITY_PUBLIC_ID,\n  XML_ROLE_ENTITY_COMPLETE,\n  XML_ROLE_ENTITY_NOTATION_NAME,\n  XML_ROLE_NOTATION_NONE,\n  XML_ROLE_NOTATION_NAME,\n  XML_ROLE_NOTATION_SYSTEM_ID,\n  XML_ROLE_NOTATION_NO_SYSTEM_ID,\n  XML_ROLE_NOTATION_PUBLIC_ID,\n  XML_ROLE_ATTRIBUTE_NAME,\n  XML_ROLE_ATTRIBUTE_TYPE_CDATA,\n  XML_ROLE_ATTRIBUTE_TYPE_ID,\n  XML_ROLE_ATTRIBUTE_TYPE_IDREF,\n  XML_ROLE_ATTRIBUTE_TYPE_IDREFS,\n  XML_ROLE_ATTRIBUTE_TYPE_ENTITY,\n  XML_ROLE_ATTRIBUTE_TYPE_ENTITIES,\n  XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN,\n  XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS,\n  XML_ROLE_ATTRIBUTE_ENUM_VALUE,\n  XML_ROLE_ATTRIBUTE_NOTATION_VALUE,\n  XML_ROLE_ATTLIST_NONE,\n  XML_ROLE_ATTLIST_ELEMENT_NAME,\n  XML_ROLE_IMPLIED_ATTRIBUTE_VALUE,\n  XML_ROLE_REQUIRED_ATTRIBUTE_VALUE,\n  XML_ROLE_DEFAULT_ATTRIBUTE_VALUE,\n  XML_ROLE_FIXED_ATTRIBUTE_VALUE,\n  XML_ROLE_ELEMENT_NONE,\n  XML_ROLE_ELEMENT_NAME,\n  XML_ROLE_CONTENT_ANY,\n  XML_ROLE_CONTENT_EMPTY,\n  XML_ROLE_CONTENT_PCDATA,\n  XML_ROLE_GROUP_OPEN,\n  XML_ROLE_GROUP_CLOSE,\n  XML_ROLE_GROUP_CLOSE_REP,\n  XML_ROLE_GROUP_CLOSE_OPT,\n  XML_ROLE_GROUP_CLOSE_PLUS,\n  XML_ROLE_GROUP_CHOICE,\n  XML_ROLE_GROUP_SEQUENCE,\n  XML_ROLE_CONTENT_ELEMENT,\n  XML_ROLE_CONTENT_ELEMENT_REP,\n  XML_ROLE_CONTENT_ELEMENT_OPT,\n  XML_ROLE_CONTENT_ELEMENT_PLUS,\n  XML_ROLE_PI,\n  XML_ROLE_COMMENT,\n#ifdef XML_DTD\n  XML_ROLE_TEXT_DECL,\n  XML_ROLE_IGNORE_SECT,\n  XML_ROLE_INNER_PARAM_ENTITY_REF,\n#endif /* XML_DTD */\n  XML_ROLE_PARAM_ENTITY_REF\n};\n\ntypedef struct prolog_state {\n  int(PTRCALL *handler)(struct prolog_state *state, int tok, const char *ptr,\n                        const char *end, const ENCODING *enc);\n  unsigned level;\n  int role_none;\n#ifdef XML_DTD\n  unsigned includeLevel;\n  int documentEntity;\n  int inEntityValue;\n#endif /* XML_DTD */\n} PROLOG_STATE;\n\nvoid XmlPrologStateInit(PROLOG_STATE *);\n#ifdef XML_DTD\nvoid XmlPrologStateInitExternalEntity(PROLOG_STATE *);\n#endif /* XML_DTD */\n\n#define XmlTokenRole(state, tok, ptr, end, enc)                                \\\n  (((state)->handler)(state, tok, ptr, end, enc))\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* not XmlRole_INCLUDED */\n"},{"id":16526,"name":"xmltok_impl.c","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* This file is included!\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#ifdef XML_TOK_IMPL_C\n\n#  ifndef IS_INVALID_CHAR\n#    define IS_INVALID_CHAR(enc, ptr, n) (0)\n#  endif\n\n#  define INVALID_LEAD_CASE(n, ptr, nextTokPtr)                                \\\n  case BT_LEAD##n:                                                             \\\n    if (end - ptr < n)                                                         \\\n      return XML_TOK_PARTIAL_CHAR;                                             \\\n    if (IS_INVALID_CHAR(enc, ptr, n)) {                                        \\\n      *(nextTokPtr) = (ptr);                                                   \\\n      return XML_TOK_INVALID;                                                  \\\n    }                                                                          \\\n    ptr += n;                                                                  \\\n    break;\n\n#  define INVALID_CASES(ptr, nextTokPtr)                                       \\\n    INVALID_LEAD_CASE(2, ptr, nextTokPtr)                                      \\\n    INVALID_LEAD_CASE(3, ptr, nextTokPtr)                                      \\\n    INVALID_LEAD_CASE(4, ptr, nextTokPtr)                                      \\\n  case BT_NONXML:                                                              \\\n  case BT_MALFORM:                                                             \\\n  case BT_TRAIL:                                                               \\\n    *(nextTokPtr) = (ptr);                                                     \\\n    return XML_TOK_INVALID;\n\n#  define CHECK_NAME_CASE(n, enc, ptr, end, nextTokPtr)                        \\\n  case BT_LEAD##n:                                                             \\\n    if (end - ptr < n)                                                         \\\n      return XML_TOK_PARTIAL_CHAR;                                             \\\n    if (! IS_NAME_CHAR(enc, ptr, n)) {                                         \\\n      *nextTokPtr = ptr;                                                       \\\n      return XML_TOK_INVALID;                                                  \\\n    }                                                                          \\\n    ptr += n;                                                                  \\\n    break;\n\n#  define CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)                          \\\n  case BT_NONASCII:                                                            \\\n    if (! IS_NAME_CHAR_MINBPC(enc, ptr)) {                                     \\\n      *nextTokPtr = ptr;                                                       \\\n      return XML_TOK_INVALID;                                                  \\\n    }                                                                          \\\n    /* fall through */                                                         \\\n  case BT_NMSTRT:                                                              \\\n  case BT_HEX:                                                                 \\\n  case BT_DIGIT:                                                               \\\n  case BT_NAME:                                                                \\\n  case BT_MINUS:                                                               \\\n    ptr += MINBPC(enc);                                                        \\\n    break;                                                                     \\\n    CHECK_NAME_CASE(2, enc, ptr, end, nextTokPtr)                              \\\n    CHECK_NAME_CASE(3, enc, ptr, end, nextTokPtr)                              \\\n    CHECK_NAME_CASE(4, enc, ptr, end, nextTokPtr)\n\n#  define CHECK_NMSTRT_CASE(n, enc, ptr, end, nextTokPtr)                      \\\n  case BT_LEAD##n:                                                             \\\n    if (end - ptr < n)                                                         \\\n      return XML_TOK_PARTIAL_CHAR;                                             \\\n    if (! IS_NMSTRT_CHAR(enc, ptr, n)) {                                       \\\n      *nextTokPtr = ptr;                                                       \\\n      return XML_TOK_INVALID;                                                  \\\n    }                                                                          \\\n    ptr += n;                                                                  \\\n    break;\n\n#  define CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)                        \\\n  case BT_NONASCII:                                                            \\\n    if (! IS_NMSTRT_CHAR_MINBPC(enc, ptr)) {                                   \\\n      *nextTokPtr = ptr;                                                       \\\n      return XML_TOK_INVALID;                                                  \\\n    }                                                                          \\\n    /* fall through */                                                         \\\n  case BT_NMSTRT:                                                              \\\n  case BT_HEX:                                                                 \\\n    ptr += MINBPC(enc);                                                        \\\n    break;                                                                     \\\n    CHECK_NMSTRT_CASE(2, enc, ptr, end, nextTokPtr)                            \\\n    CHECK_NMSTRT_CASE(3, enc, ptr, end, nextTokPtr)                            \\\n    CHECK_NMSTRT_CASE(4, enc, ptr, end, nextTokPtr)\n\n#  ifndef PREFIX\n#    define PREFIX(ident) ident\n#  endif\n\n#  define HAS_CHARS(enc, ptr, end, count) (end - ptr >= count * MINBPC(enc))\n\n#  define HAS_CHAR(enc, ptr, end) HAS_CHARS(enc, ptr, end, 1)\n\n#  define REQUIRE_CHARS(enc, ptr, end, count)                                  \\\n    {                                                                          \\\n      if (! HAS_CHARS(enc, ptr, end, count)) {                                 \\\n        return XML_TOK_PARTIAL;                                                \\\n      }                                                                        \\\n    }\n\n#  define REQUIRE_CHAR(enc, ptr, end) REQUIRE_CHARS(enc, ptr, end, 1)\n\n/* ptr points to character following \"<!-\" */\n\nstatic int PTRCALL\nPREFIX(scanComment)(const ENCODING *enc, const char *ptr, const char *end,\n                    const char **nextTokPtr) {\n  if (HAS_CHAR(enc, ptr, end)) {\n    if (! CHAR_MATCHES(enc, ptr, ASCII_MINUS)) {\n      *nextTokPtr = ptr;\n      return XML_TOK_INVALID;\n    }\n    ptr += MINBPC(enc);\n    while (HAS_CHAR(enc, ptr, end)) {\n      switch (BYTE_TYPE(enc, ptr)) {\n        INVALID_CASES(ptr, nextTokPtr)\n      case BT_MINUS:\n        ptr += MINBPC(enc);\n        REQUIRE_CHAR(enc, ptr, end);\n        if (CHAR_MATCHES(enc, ptr, ASCII_MINUS)) {\n          ptr += MINBPC(enc);\n          REQUIRE_CHAR(enc, ptr, end);\n          if (! CHAR_MATCHES(enc, ptr, ASCII_GT)) {\n            *nextTokPtr = ptr;\n            return XML_TOK_INVALID;\n          }\n          *nextTokPtr = ptr + MINBPC(enc);\n          return XML_TOK_COMMENT;\n        }\n        break;\n      default:\n        ptr += MINBPC(enc);\n        break;\n      }\n    }\n  }\n  return XML_TOK_PARTIAL;\n}\n\n/* ptr points to character following \"<!\" */\n\nstatic int PTRCALL\nPREFIX(scanDecl)(const ENCODING *enc, const char *ptr, const char *end,\n                 const char **nextTokPtr) {\n  REQUIRE_CHAR(enc, ptr, end);\n  switch (BYTE_TYPE(enc, ptr)) {\n  case BT_MINUS:\n    return PREFIX(scanComment)(enc, ptr + MINBPC(enc), end, nextTokPtr);\n  case BT_LSQB:\n    *nextTokPtr = ptr + MINBPC(enc);\n    return XML_TOK_COND_SECT_OPEN;\n  case BT_NMSTRT:\n  case BT_HEX:\n    ptr += MINBPC(enc);\n    break;\n  default:\n    *nextTokPtr = ptr;\n    return XML_TOK_INVALID;\n  }\n  while (HAS_CHAR(enc, ptr, end)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n    case BT_PERCNT:\n      REQUIRE_CHARS(enc, ptr, end, 2);\n      /* don't allow <!ENTITY% foo \"whatever\"> */\n      switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) {\n      case BT_S:\n      case BT_CR:\n      case BT_LF:\n      case BT_PERCNT:\n        *nextTokPtr = ptr;\n        return XML_TOK_INVALID;\n      }\n      /* fall through */\n    case BT_S:\n    case BT_CR:\n    case BT_LF:\n      *nextTokPtr = ptr;\n      return XML_TOK_DECL_OPEN;\n    case BT_NMSTRT:\n    case BT_HEX:\n      ptr += MINBPC(enc);\n      break;\n    default:\n      *nextTokPtr = ptr;\n      return XML_TOK_INVALID;\n    }\n  }\n  return XML_TOK_PARTIAL;\n}\n\nstatic int PTRCALL\nPREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end,\n                      int *tokPtr) {\n  int upper = 0;\n  UNUSED_P(enc);\n  *tokPtr = XML_TOK_PI;\n  if (end - ptr != MINBPC(enc) * 3)\n    return 1;\n  switch (BYTE_TO_ASCII(enc, ptr)) {\n  case ASCII_x:\n    break;\n  case ASCII_X:\n    upper = 1;\n    break;\n  default:\n    return 1;\n  }\n  ptr += MINBPC(enc);\n  switch (BYTE_TO_ASCII(enc, ptr)) {\n  case ASCII_m:\n    break;\n  case ASCII_M:\n    upper = 1;\n    break;\n  default:\n    return 1;\n  }\n  ptr += MINBPC(enc);\n  switch (BYTE_TO_ASCII(enc, ptr)) {\n  case ASCII_l:\n    break;\n  case ASCII_L:\n    upper = 1;\n    break;\n  default:\n    return 1;\n  }\n  if (upper)\n    return 0;\n  *tokPtr = XML_TOK_XML_DECL;\n  return 1;\n}\n\n/* ptr points to character following \"<?\" */\n\nstatic int PTRCALL\nPREFIX(scanPi)(const ENCODING *enc, const char *ptr, const char *end,\n               const char **nextTokPtr) {\n  int tok;\n  const char *target = ptr;\n  REQUIRE_CHAR(enc, ptr, end);\n  switch (BYTE_TYPE(enc, ptr)) {\n    CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)\n  default:\n    *nextTokPtr = ptr;\n    return XML_TOK_INVALID;\n  }\n  while (HAS_CHAR(enc, ptr, end)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n      CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)\n    case BT_S:\n    case BT_CR:\n    case BT_LF:\n      if (! PREFIX(checkPiTarget)(enc, target, ptr, &tok)) {\n        *nextTokPtr = ptr;\n        return XML_TOK_INVALID;\n      }\n      ptr += MINBPC(enc);\n      while (HAS_CHAR(enc, ptr, end)) {\n        switch (BYTE_TYPE(enc, ptr)) {\n          INVALID_CASES(ptr, nextTokPtr)\n        case BT_QUEST:\n          ptr += MINBPC(enc);\n          REQUIRE_CHAR(enc, ptr, end);\n          if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {\n            *nextTokPtr = ptr + MINBPC(enc);\n            return tok;\n          }\n          break;\n        default:\n          ptr += MINBPC(enc);\n          break;\n        }\n      }\n      return XML_TOK_PARTIAL;\n    case BT_QUEST:\n      if (! PREFIX(checkPiTarget)(enc, target, ptr, &tok)) {\n        *nextTokPtr = ptr;\n        return XML_TOK_INVALID;\n      }\n      ptr += MINBPC(enc);\n      REQUIRE_CHAR(enc, ptr, end);\n      if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {\n        *nextTokPtr = ptr + MINBPC(enc);\n        return tok;\n      }\n      /* fall through */\n    default:\n      *nextTokPtr = ptr;\n      return XML_TOK_INVALID;\n    }\n  }\n  return XML_TOK_PARTIAL;\n}\n\nstatic int PTRCALL\nPREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr, const char *end,\n                         const char **nextTokPtr) {\n  static const char CDATA_LSQB[]\n      = {ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, ASCII_LSQB};\n  int i;\n  UNUSED_P(enc);\n  /* CDATA[ */\n  REQUIRE_CHARS(enc, ptr, end, 6);\n  for (i = 0; i < 6; i++, ptr += MINBPC(enc)) {\n    if (! CHAR_MATCHES(enc, ptr, CDATA_LSQB[i])) {\n      *nextTokPtr = ptr;\n      return XML_TOK_INVALID;\n    }\n  }\n  *nextTokPtr = ptr;\n  return XML_TOK_CDATA_SECT_OPEN;\n}\n\nstatic int PTRCALL\nPREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, const char *end,\n                        const char **nextTokPtr) {\n  if (ptr >= end)\n    return XML_TOK_NONE;\n  if (MINBPC(enc) > 1) {\n    size_t n = end - ptr;\n    if (n & (MINBPC(enc) - 1)) {\n      n &= ~(MINBPC(enc) - 1);\n      if (n == 0)\n        return XML_TOK_PARTIAL;\n      end = ptr + n;\n    }\n  }\n  switch (BYTE_TYPE(enc, ptr)) {\n  case BT_RSQB:\n    ptr += MINBPC(enc);\n    REQUIRE_CHAR(enc, ptr, end);\n    if (! CHAR_MATCHES(enc, ptr, ASCII_RSQB))\n      break;\n    ptr += MINBPC(enc);\n    REQUIRE_CHAR(enc, ptr, end);\n    if (! CHAR_MATCHES(enc, ptr, ASCII_GT)) {\n      ptr -= MINBPC(enc);\n      break;\n    }\n    *nextTokPtr = ptr + MINBPC(enc);\n    return XML_TOK_CDATA_SECT_CLOSE;\n  case BT_CR:\n    ptr += MINBPC(enc);\n    REQUIRE_CHAR(enc, ptr, end);\n    if (BYTE_TYPE(enc, ptr) == BT_LF)\n      ptr += MINBPC(enc);\n    *nextTokPtr = ptr;\n    return XML_TOK_DATA_NEWLINE;\n  case BT_LF:\n    *nextTokPtr = ptr + MINBPC(enc);\n    return XML_TOK_DATA_NEWLINE;\n    INVALID_CASES(ptr, nextTokPtr)\n  default:\n    ptr += MINBPC(enc);\n    break;\n  }\n  while (HAS_CHAR(enc, ptr, end)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n#  define LEAD_CASE(n)                                                         \\\n  case BT_LEAD##n:                                                             \\\n    if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) {                       \\\n      *nextTokPtr = ptr;                                                       \\\n      return XML_TOK_DATA_CHARS;                                               \\\n    }                                                                          \\\n    ptr += n;                                                                  \\\n    break;\n      LEAD_CASE(2)\n      LEAD_CASE(3)\n      LEAD_CASE(4)\n#  undef LEAD_CASE\n    case BT_NONXML:\n    case BT_MALFORM:\n    case BT_TRAIL:\n    case BT_CR:\n    case BT_LF:\n    case BT_RSQB:\n      *nextTokPtr = ptr;\n      return XML_TOK_DATA_CHARS;\n    default:\n      ptr += MINBPC(enc);\n      break;\n    }\n  }\n  *nextTokPtr = ptr;\n  return XML_TOK_DATA_CHARS;\n}\n\n/* ptr points to character following \"</\" */\n\nstatic int PTRCALL\nPREFIX(scanEndTag)(const ENCODING *enc, const char *ptr, const char *end,\n                   const char **nextTokPtr) {\n  REQUIRE_CHAR(enc, ptr, end);\n  switch (BYTE_TYPE(enc, ptr)) {\n    CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)\n  default:\n    *nextTokPtr = ptr;\n    return XML_TOK_INVALID;\n  }\n  while (HAS_CHAR(enc, ptr, end)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n      CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)\n    case BT_S:\n    case BT_CR:\n    case BT_LF:\n      for (ptr += MINBPC(enc); HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) {\n        switch (BYTE_TYPE(enc, ptr)) {\n        case BT_S:\n        case BT_CR:\n        case BT_LF:\n          break;\n        case BT_GT:\n          *nextTokPtr = ptr + MINBPC(enc);\n          return XML_TOK_END_TAG;\n        default:\n          *nextTokPtr = ptr;\n          return XML_TOK_INVALID;\n        }\n      }\n      return XML_TOK_PARTIAL;\n#  ifdef XML_NS\n    case BT_COLON:\n      /* no need to check qname syntax here,\n         since end-tag must match exactly */\n      ptr += MINBPC(enc);\n      break;\n#  endif\n    case BT_GT:\n      *nextTokPtr = ptr + MINBPC(enc);\n      return XML_TOK_END_TAG;\n    default:\n      *nextTokPtr = ptr;\n      return XML_TOK_INVALID;\n    }\n  }\n  return XML_TOK_PARTIAL;\n}\n\n/* ptr points to character following \"&#X\" */\n\nstatic int PTRCALL\nPREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr, const char *end,\n                       const char **nextTokPtr) {\n  if (HAS_CHAR(enc, ptr, end)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n    case BT_DIGIT:\n    case BT_HEX:\n      break;\n    default:\n      *nextTokPtr = ptr;\n      return XML_TOK_INVALID;\n    }\n    for (ptr += MINBPC(enc); HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) {\n      switch (BYTE_TYPE(enc, ptr)) {\n      case BT_DIGIT:\n      case BT_HEX:\n        break;\n      case BT_SEMI:\n        *nextTokPtr = ptr + MINBPC(enc);\n        return XML_TOK_CHAR_REF;\n      default:\n        *nextTokPtr = ptr;\n        return XML_TOK_INVALID;\n      }\n    }\n  }\n  return XML_TOK_PARTIAL;\n}\n\n/* ptr points to character following \"&#\" */\n\nstatic int PTRCALL\nPREFIX(scanCharRef)(const ENCODING *enc, const char *ptr, const char *end,\n                    const char **nextTokPtr) {\n  if (HAS_CHAR(enc, ptr, end)) {\n    if (CHAR_MATCHES(enc, ptr, ASCII_x))\n      return PREFIX(scanHexCharRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);\n    switch (BYTE_TYPE(enc, ptr)) {\n    case BT_DIGIT:\n      break;\n    default:\n      *nextTokPtr = ptr;\n      return XML_TOK_INVALID;\n    }\n    for (ptr += MINBPC(enc); HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) {\n      switch (BYTE_TYPE(enc, ptr)) {\n      case BT_DIGIT:\n        break;\n      case BT_SEMI:\n        *nextTokPtr = ptr + MINBPC(enc);\n        return XML_TOK_CHAR_REF;\n      default:\n        *nextTokPtr = ptr;\n        return XML_TOK_INVALID;\n      }\n    }\n  }\n  return XML_TOK_PARTIAL;\n}\n\n/* ptr points to character following \"&\" */\n\nstatic int PTRCALL\nPREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,\n                const char **nextTokPtr) {\n  REQUIRE_CHAR(enc, ptr, end);\n  switch (BYTE_TYPE(enc, ptr)) {\n    CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)\n  case BT_NUM:\n    return PREFIX(scanCharRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);\n  default:\n    *nextTokPtr = ptr;\n    return XML_TOK_INVALID;\n  }\n  while (HAS_CHAR(enc, ptr, end)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n      CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)\n    case BT_SEMI:\n      *nextTokPtr = ptr + MINBPC(enc);\n      return XML_TOK_ENTITY_REF;\n    default:\n      *nextTokPtr = ptr;\n      return XML_TOK_INVALID;\n    }\n  }\n  return XML_TOK_PARTIAL;\n}\n\n/* ptr points to character following first character of attribute name */\n\nstatic int PTRCALL\nPREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,\n                 const char **nextTokPtr) {\n#  ifdef XML_NS\n  int hadColon = 0;\n#  endif\n  while (HAS_CHAR(enc, ptr, end)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n      CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)\n#  ifdef XML_NS\n    case BT_COLON:\n      if (hadColon) {\n        *nextTokPtr = ptr;\n        return XML_TOK_INVALID;\n      }\n      hadColon = 1;\n      ptr += MINBPC(enc);\n      REQUIRE_CHAR(enc, ptr, end);\n      switch (BYTE_TYPE(enc, ptr)) {\n        CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)\n      default:\n        *nextTokPtr = ptr;\n        return XML_TOK_INVALID;\n      }\n      break;\n#  endif\n    case BT_S:\n    case BT_CR:\n    case BT_LF:\n      for (;;) {\n        int t;\n\n        ptr += MINBPC(enc);\n        REQUIRE_CHAR(enc, ptr, end);\n        t = BYTE_TYPE(enc, ptr);\n        if (t == BT_EQUALS)\n          break;\n        switch (t) {\n        case BT_S:\n        case BT_LF:\n        case BT_CR:\n          break;\n        default:\n          *nextTokPtr = ptr;\n          return XML_TOK_INVALID;\n        }\n      }\n      /* fall through */\n    case BT_EQUALS: {\n      int open;\n#  ifdef XML_NS\n      hadColon = 0;\n#  endif\n      for (;;) {\n        ptr += MINBPC(enc);\n        REQUIRE_CHAR(enc, ptr, end);\n        open = BYTE_TYPE(enc, ptr);\n        if (open == BT_QUOT || open == BT_APOS)\n          break;\n        switch (open) {\n        case BT_S:\n        case BT_LF:\n        case BT_CR:\n          break;\n        default:\n          *nextTokPtr = ptr;\n          return XML_TOK_INVALID;\n        }\n      }\n      ptr += MINBPC(enc);\n      /* in attribute value */\n      for (;;) {\n        int t;\n        REQUIRE_CHAR(enc, ptr, end);\n        t = BYTE_TYPE(enc, ptr);\n        if (t == open)\n          break;\n        switch (t) {\n          INVALID_CASES(ptr, nextTokPtr)\n        case BT_AMP: {\n          int tok = PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, &ptr);\n          if (tok <= 0) {\n            if (tok == XML_TOK_INVALID)\n              *nextTokPtr = ptr;\n            return tok;\n          }\n          break;\n        }\n        case BT_LT:\n          *nextTokPtr = ptr;\n          return XML_TOK_INVALID;\n        default:\n          ptr += MINBPC(enc);\n          break;\n        }\n      }\n      ptr += MINBPC(enc);\n      REQUIRE_CHAR(enc, ptr, end);\n      switch (BYTE_TYPE(enc, ptr)) {\n      case BT_S:\n      case BT_CR:\n      case BT_LF:\n        break;\n      case BT_SOL:\n        goto sol;\n      case BT_GT:\n        goto gt;\n      default:\n        *nextTokPtr = ptr;\n        return XML_TOK_INVALID;\n      }\n      /* ptr points to closing quote */\n      for (;;) {\n        ptr += MINBPC(enc);\n        REQUIRE_CHAR(enc, ptr, end);\n        switch (BYTE_TYPE(enc, ptr)) {\n          CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)\n        case BT_S:\n        case BT_CR:\n        case BT_LF:\n          continue;\n        case BT_GT:\n        gt:\n          *nextTokPtr = ptr + MINBPC(enc);\n          return XML_TOK_START_TAG_WITH_ATTS;\n        case BT_SOL:\n        sol:\n          ptr += MINBPC(enc);\n          REQUIRE_CHAR(enc, ptr, end);\n          if (! CHAR_MATCHES(enc, ptr, ASCII_GT)) {\n            *nextTokPtr = ptr;\n            return XML_TOK_INVALID;\n          }\n          *nextTokPtr = ptr + MINBPC(enc);\n          return XML_TOK_EMPTY_ELEMENT_WITH_ATTS;\n        default:\n          *nextTokPtr = ptr;\n          return XML_TOK_INVALID;\n        }\n        break;\n      }\n      break;\n    }\n    default:\n      *nextTokPtr = ptr;\n      return XML_TOK_INVALID;\n    }\n  }\n  return XML_TOK_PARTIAL;\n}\n\n/* ptr points to character following \"<\" */\n\nstatic int PTRCALL\nPREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,\n               const char **nextTokPtr) {\n#  ifdef XML_NS\n  int hadColon;\n#  endif\n  REQUIRE_CHAR(enc, ptr, end);\n  switch (BYTE_TYPE(enc, ptr)) {\n    CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)\n  case BT_EXCL:\n    ptr += MINBPC(enc);\n    REQUIRE_CHAR(enc, ptr, end);\n    switch (BYTE_TYPE(enc, ptr)) {\n    case BT_MINUS:\n      return PREFIX(scanComment)(enc, ptr + MINBPC(enc), end, nextTokPtr);\n    case BT_LSQB:\n      return PREFIX(scanCdataSection)(enc, ptr + MINBPC(enc), end, nextTokPtr);\n    }\n    *nextTokPtr = ptr;\n    return XML_TOK_INVALID;\n  case BT_QUEST:\n    return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr);\n  case BT_SOL:\n    return PREFIX(scanEndTag)(enc, ptr + MINBPC(enc), end, nextTokPtr);\n  default:\n    *nextTokPtr = ptr;\n    return XML_TOK_INVALID;\n  }\n#  ifdef XML_NS\n  hadColon = 0;\n#  endif\n  /* we have a start-tag */\n  while (HAS_CHAR(enc, ptr, end)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n      CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)\n#  ifdef XML_NS\n    case BT_COLON:\n      if (hadColon) {\n        *nextTokPtr = ptr;\n        return XML_TOK_INVALID;\n      }\n      hadColon = 1;\n      ptr += MINBPC(enc);\n      REQUIRE_CHAR(enc, ptr, end);\n      switch (BYTE_TYPE(enc, ptr)) {\n        CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)\n      default:\n        *nextTokPtr = ptr;\n        return XML_TOK_INVALID;\n      }\n      break;\n#  endif\n    case BT_S:\n    case BT_CR:\n    case BT_LF: {\n      ptr += MINBPC(enc);\n      while (HAS_CHAR(enc, ptr, end)) {\n        switch (BYTE_TYPE(enc, ptr)) {\n          CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)\n        case BT_GT:\n          goto gt;\n        case BT_SOL:\n          goto sol;\n        case BT_S:\n        case BT_CR:\n        case BT_LF:\n          ptr += MINBPC(enc);\n          continue;\n        default:\n          *nextTokPtr = ptr;\n          return XML_TOK_INVALID;\n        }\n        return PREFIX(scanAtts)(enc, ptr, end, nextTokPtr);\n      }\n      return XML_TOK_PARTIAL;\n    }\n    case BT_GT:\n    gt:\n      *nextTokPtr = ptr + MINBPC(enc);\n      return XML_TOK_START_TAG_NO_ATTS;\n    case BT_SOL:\n    sol:\n      ptr += MINBPC(enc);\n      REQUIRE_CHAR(enc, ptr, end);\n      if (! CHAR_MATCHES(enc, ptr, ASCII_GT)) {\n        *nextTokPtr = ptr;\n        return XML_TOK_INVALID;\n      }\n      *nextTokPtr = ptr + MINBPC(enc);\n      return XML_TOK_EMPTY_ELEMENT_NO_ATTS;\n    default:\n      *nextTokPtr = ptr;\n      return XML_TOK_INVALID;\n    }\n  }\n  return XML_TOK_PARTIAL;\n}\n\nstatic int PTRCALL\nPREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,\n                   const char **nextTokPtr) {\n  if (ptr >= end)\n    return XML_TOK_NONE;\n  if (MINBPC(enc) > 1) {\n    size_t n = end - ptr;\n    if (n & (MINBPC(enc) - 1)) {\n      n &= ~(MINBPC(enc) - 1);\n      if (n == 0)\n        return XML_TOK_PARTIAL;\n      end = ptr + n;\n    }\n  }\n  switch (BYTE_TYPE(enc, ptr)) {\n  case BT_LT:\n    return PREFIX(scanLt)(enc, ptr + MINBPC(enc), end, nextTokPtr);\n  case BT_AMP:\n    return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);\n  case BT_CR:\n    ptr += MINBPC(enc);\n    if (! HAS_CHAR(enc, ptr, end))\n      return XML_TOK_TRAILING_CR;\n    if (BYTE_TYPE(enc, ptr) == BT_LF)\n      ptr += MINBPC(enc);\n    *nextTokPtr = ptr;\n    return XML_TOK_DATA_NEWLINE;\n  case BT_LF:\n    *nextTokPtr = ptr + MINBPC(enc);\n    return XML_TOK_DATA_NEWLINE;\n  case BT_RSQB:\n    ptr += MINBPC(enc);\n    if (! HAS_CHAR(enc, ptr, end))\n      return XML_TOK_TRAILING_RSQB;\n    if (! CHAR_MATCHES(enc, ptr, ASCII_RSQB))\n      break;\n    ptr += MINBPC(enc);\n    if (! HAS_CHAR(enc, ptr, end))\n      return XML_TOK_TRAILING_RSQB;\n    if (! CHAR_MATCHES(enc, ptr, ASCII_GT)) {\n      ptr -= MINBPC(enc);\n      break;\n    }\n    *nextTokPtr = ptr;\n    return XML_TOK_INVALID;\n    INVALID_CASES(ptr, nextTokPtr)\n  default:\n    ptr += MINBPC(enc);\n    break;\n  }\n  while (HAS_CHAR(enc, ptr, end)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n#  define LEAD_CASE(n)                                                         \\\n  case BT_LEAD##n:                                                             \\\n    if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) {                       \\\n      *nextTokPtr = ptr;                                                       \\\n      return XML_TOK_DATA_CHARS;                                               \\\n    }                                                                          \\\n    ptr += n;                                                                  \\\n    break;\n      LEAD_CASE(2)\n      LEAD_CASE(3)\n      LEAD_CASE(4)\n#  undef LEAD_CASE\n    case BT_RSQB:\n      if (HAS_CHARS(enc, ptr, end, 2)) {\n        if (! CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) {\n          ptr += MINBPC(enc);\n          break;\n        }\n        if (HAS_CHARS(enc, ptr, end, 3)) {\n          if (! CHAR_MATCHES(enc, ptr + 2 * MINBPC(enc), ASCII_GT)) {\n            ptr += MINBPC(enc);\n            break;\n          }\n          *nextTokPtr = ptr + 2 * MINBPC(enc);\n          return XML_TOK_INVALID;\n        }\n      }\n      /* fall through */\n    case BT_AMP:\n    case BT_LT:\n    case BT_NONXML:\n    case BT_MALFORM:\n    case BT_TRAIL:\n    case BT_CR:\n    case BT_LF:\n      *nextTokPtr = ptr;\n      return XML_TOK_DATA_CHARS;\n    default:\n      ptr += MINBPC(enc);\n      break;\n    }\n  }\n  *nextTokPtr = ptr;\n  return XML_TOK_DATA_CHARS;\n}\n\n/* ptr points to character following \"%\" */\n\nstatic int PTRCALL\nPREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,\n                    const char **nextTokPtr) {\n  REQUIRE_CHAR(enc, ptr, end);\n  switch (BYTE_TYPE(enc, ptr)) {\n    CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)\n  case BT_S:\n  case BT_LF:\n  case BT_CR:\n  case BT_PERCNT:\n    *nextTokPtr = ptr;\n    return XML_TOK_PERCENT;\n  default:\n    *nextTokPtr = ptr;\n    return XML_TOK_INVALID;\n  }\n  while (HAS_CHAR(enc, ptr, end)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n      CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)\n    case BT_SEMI:\n      *nextTokPtr = ptr + MINBPC(enc);\n      return XML_TOK_PARAM_ENTITY_REF;\n    default:\n      *nextTokPtr = ptr;\n      return XML_TOK_INVALID;\n    }\n  }\n  return XML_TOK_PARTIAL;\n}\n\nstatic int PTRCALL\nPREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end,\n                      const char **nextTokPtr) {\n  REQUIRE_CHAR(enc, ptr, end);\n  switch (BYTE_TYPE(enc, ptr)) {\n    CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)\n  default:\n    *nextTokPtr = ptr;\n    return XML_TOK_INVALID;\n  }\n  while (HAS_CHAR(enc, ptr, end)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n      CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)\n    case BT_CR:\n    case BT_LF:\n    case BT_S:\n    case BT_RPAR:\n    case BT_GT:\n    case BT_PERCNT:\n    case BT_VERBAR:\n      *nextTokPtr = ptr;\n      return XML_TOK_POUND_NAME;\n    default:\n      *nextTokPtr = ptr;\n      return XML_TOK_INVALID;\n    }\n  }\n  return -XML_TOK_POUND_NAME;\n}\n\nstatic int PTRCALL\nPREFIX(scanLit)(int open, const ENCODING *enc, const char *ptr, const char *end,\n                const char **nextTokPtr) {\n  while (HAS_CHAR(enc, ptr, end)) {\n    int t = BYTE_TYPE(enc, ptr);\n    switch (t) {\n      INVALID_CASES(ptr, nextTokPtr)\n    case BT_QUOT:\n    case BT_APOS:\n      ptr += MINBPC(enc);\n      if (t != open)\n        break;\n      if (! HAS_CHAR(enc, ptr, end))\n        return -XML_TOK_LITERAL;\n      *nextTokPtr = ptr;\n      switch (BYTE_TYPE(enc, ptr)) {\n      case BT_S:\n      case BT_CR:\n      case BT_LF:\n      case BT_GT:\n      case BT_PERCNT:\n      case BT_LSQB:\n        return XML_TOK_LITERAL;\n      default:\n        return XML_TOK_INVALID;\n      }\n    default:\n      ptr += MINBPC(enc);\n      break;\n    }\n  }\n  return XML_TOK_PARTIAL;\n}\n\nstatic int PTRCALL\nPREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,\n                  const char **nextTokPtr) {\n  int tok;\n  if (ptr >= end)\n    return XML_TOK_NONE;\n  if (MINBPC(enc) > 1) {\n    size_t n = end - ptr;\n    if (n & (MINBPC(enc) - 1)) {\n      n &= ~(MINBPC(enc) - 1);\n      if (n == 0)\n        return XML_TOK_PARTIAL;\n      end = ptr + n;\n    }\n  }\n  switch (BYTE_TYPE(enc, ptr)) {\n  case BT_QUOT:\n    return PREFIX(scanLit)(BT_QUOT, enc, ptr + MINBPC(enc), end, nextTokPtr);\n  case BT_APOS:\n    return PREFIX(scanLit)(BT_APOS, enc, ptr + MINBPC(enc), end, nextTokPtr);\n  case BT_LT: {\n    ptr += MINBPC(enc);\n    REQUIRE_CHAR(enc, ptr, end);\n    switch (BYTE_TYPE(enc, ptr)) {\n    case BT_EXCL:\n      return PREFIX(scanDecl)(enc, ptr + MINBPC(enc), end, nextTokPtr);\n    case BT_QUEST:\n      return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr);\n    case BT_NMSTRT:\n    case BT_HEX:\n    case BT_NONASCII:\n    case BT_LEAD2:\n    case BT_LEAD3:\n    case BT_LEAD4:\n      *nextTokPtr = ptr - MINBPC(enc);\n      return XML_TOK_INSTANCE_START;\n    }\n    *nextTokPtr = ptr;\n    return XML_TOK_INVALID;\n  }\n  case BT_CR:\n    if (ptr + MINBPC(enc) == end) {\n      *nextTokPtr = end;\n      /* indicate that this might be part of a CR/LF pair */\n      return -XML_TOK_PROLOG_S;\n    }\n    /* fall through */\n  case BT_S:\n  case BT_LF:\n    for (;;) {\n      ptr += MINBPC(enc);\n      if (! HAS_CHAR(enc, ptr, end))\n        break;\n      switch (BYTE_TYPE(enc, ptr)) {\n      case BT_S:\n      case BT_LF:\n        break;\n      case BT_CR:\n        /* don't split CR/LF pair */\n        if (ptr + MINBPC(enc) != end)\n          break;\n        /* fall through */\n      default:\n        *nextTokPtr = ptr;\n        return XML_TOK_PROLOG_S;\n      }\n    }\n    *nextTokPtr = ptr;\n    return XML_TOK_PROLOG_S;\n  case BT_PERCNT:\n    return PREFIX(scanPercent)(enc, ptr + MINBPC(enc), end, nextTokPtr);\n  case BT_COMMA:\n    *nextTokPtr = ptr + MINBPC(enc);\n    return XML_TOK_COMMA;\n  case BT_LSQB:\n    *nextTokPtr = ptr + MINBPC(enc);\n    return XML_TOK_OPEN_BRACKET;\n  case BT_RSQB:\n    ptr += MINBPC(enc);\n    if (! HAS_CHAR(enc, ptr, end))\n      return -XML_TOK_CLOSE_BRACKET;\n    if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) {\n      REQUIRE_CHARS(enc, ptr, end, 2);\n      if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_GT)) {\n        *nextTokPtr = ptr + 2 * MINBPC(enc);\n        return XML_TOK_COND_SECT_CLOSE;\n      }\n    }\n    *nextTokPtr = ptr;\n    return XML_TOK_CLOSE_BRACKET;\n  case BT_LPAR:\n    *nextTokPtr = ptr + MINBPC(enc);\n    return XML_TOK_OPEN_PAREN;\n  case BT_RPAR:\n    ptr += MINBPC(enc);\n    if (! HAS_CHAR(enc, ptr, end))\n      return -XML_TOK_CLOSE_PAREN;\n    switch (BYTE_TYPE(enc, ptr)) {\n    case BT_AST:\n      *nextTokPtr = ptr + MINBPC(enc);\n      return XML_TOK_CLOSE_PAREN_ASTERISK;\n    case BT_QUEST:\n      *nextTokPtr = ptr + MINBPC(enc);\n      return XML_TOK_CLOSE_PAREN_QUESTION;\n    case BT_PLUS:\n      *nextTokPtr = ptr + MINBPC(enc);\n      return XML_TOK_CLOSE_PAREN_PLUS;\n    case BT_CR:\n    case BT_LF:\n    case BT_S:\n    case BT_GT:\n    case BT_COMMA:\n    case BT_VERBAR:\n    case BT_RPAR:\n      *nextTokPtr = ptr;\n      return XML_TOK_CLOSE_PAREN;\n    }\n    *nextTokPtr = ptr;\n    return XML_TOK_INVALID;\n  case BT_VERBAR:\n    *nextTokPtr = ptr + MINBPC(enc);\n    return XML_TOK_OR;\n  case BT_GT:\n    *nextTokPtr = ptr + MINBPC(enc);\n    return XML_TOK_DECL_CLOSE;\n  case BT_NUM:\n    return PREFIX(scanPoundName)(enc, ptr + MINBPC(enc), end, nextTokPtr);\n#  define LEAD_CASE(n)                                                         \\\n  case BT_LEAD##n:                                                             \\\n    if (end - ptr < n)                                                         \\\n      return XML_TOK_PARTIAL_CHAR;                                             \\\n    if (IS_NMSTRT_CHAR(enc, ptr, n)) {                                         \\\n      ptr += n;                                                                \\\n      tok = XML_TOK_NAME;                                                      \\\n      break;                                                                   \\\n    }                                                                          \\\n    if (IS_NAME_CHAR(enc, ptr, n)) {                                           \\\n      ptr += n;                                                                \\\n      tok = XML_TOK_NMTOKEN;                                                   \\\n      break;                                                                   \\\n    }                                                                          \\\n    *nextTokPtr = ptr;                                                         \\\n    return XML_TOK_INVALID;\n    LEAD_CASE(2)\n    LEAD_CASE(3)\n    LEAD_CASE(4)\n#  undef LEAD_CASE\n  case BT_NMSTRT:\n  case BT_HEX:\n    tok = XML_TOK_NAME;\n    ptr += MINBPC(enc);\n    break;\n  case BT_DIGIT:\n  case BT_NAME:\n  case BT_MINUS:\n#  ifdef XML_NS\n  case BT_COLON:\n#  endif\n    tok = XML_TOK_NMTOKEN;\n    ptr += MINBPC(enc);\n    break;\n  case BT_NONASCII:\n    if (IS_NMSTRT_CHAR_MINBPC(enc, ptr)) {\n      ptr += MINBPC(enc);\n      tok = XML_TOK_NAME;\n      break;\n    }\n    if (IS_NAME_CHAR_MINBPC(enc, ptr)) {\n      ptr += MINBPC(enc);\n      tok = XML_TOK_NMTOKEN;\n      break;\n    }\n    /* fall through */\n  default:\n    *nextTokPtr = ptr;\n    return XML_TOK_INVALID;\n  }\n  while (HAS_CHAR(enc, ptr, end)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n      CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)\n    case BT_GT:\n    case BT_RPAR:\n    case BT_COMMA:\n    case BT_VERBAR:\n    case BT_LSQB:\n    case BT_PERCNT:\n    case BT_S:\n    case BT_CR:\n    case BT_LF:\n      *nextTokPtr = ptr;\n      return tok;\n#  ifdef XML_NS\n    case BT_COLON:\n      ptr += MINBPC(enc);\n      switch (tok) {\n      case XML_TOK_NAME:\n        REQUIRE_CHAR(enc, ptr, end);\n        tok = XML_TOK_PREFIXED_NAME;\n        switch (BYTE_TYPE(enc, ptr)) {\n          CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)\n        default:\n          tok = XML_TOK_NMTOKEN;\n          break;\n        }\n        break;\n      case XML_TOK_PREFIXED_NAME:\n        tok = XML_TOK_NMTOKEN;\n        break;\n      }\n      break;\n#  endif\n    case BT_PLUS:\n      if (tok == XML_TOK_NMTOKEN) {\n        *nextTokPtr = ptr;\n        return XML_TOK_INVALID;\n      }\n      *nextTokPtr = ptr + MINBPC(enc);\n      return XML_TOK_NAME_PLUS;\n    case BT_AST:\n      if (tok == XML_TOK_NMTOKEN) {\n        *nextTokPtr = ptr;\n        return XML_TOK_INVALID;\n      }\n      *nextTokPtr = ptr + MINBPC(enc);\n      return XML_TOK_NAME_ASTERISK;\n    case BT_QUEST:\n      if (tok == XML_TOK_NMTOKEN) {\n        *nextTokPtr = ptr;\n        return XML_TOK_INVALID;\n      }\n      *nextTokPtr = ptr + MINBPC(enc);\n      return XML_TOK_NAME_QUESTION;\n    default:\n      *nextTokPtr = ptr;\n      return XML_TOK_INVALID;\n    }\n  }\n  return -tok;\n}\n\nstatic int PTRCALL\nPREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *end,\n                          const char **nextTokPtr) {\n  const char *start;\n  if (ptr >= end)\n    return XML_TOK_NONE;\n  else if (! HAS_CHAR(enc, ptr, end)) {\n    /* This line cannot be executed.  The incoming data has already\n     * been tokenized once, so incomplete characters like this have\n     * already been eliminated from the input.  Retaining the paranoia\n     * check is still valuable, however.\n     */\n    return XML_TOK_PARTIAL; /* LCOV_EXCL_LINE */\n  }\n  start = ptr;\n  while (HAS_CHAR(enc, ptr, end)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n#  define LEAD_CASE(n)                                                         \\\n  case BT_LEAD##n:                                                             \\\n    ptr += n;                                                                  \\\n    break;\n      LEAD_CASE(2)\n      LEAD_CASE(3)\n      LEAD_CASE(4)\n#  undef LEAD_CASE\n    case BT_AMP:\n      if (ptr == start)\n        return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);\n      *nextTokPtr = ptr;\n      return XML_TOK_DATA_CHARS;\n    case BT_LT:\n      /* this is for inside entity references */\n      *nextTokPtr = ptr;\n      return XML_TOK_INVALID;\n    case BT_LF:\n      if (ptr == start) {\n        *nextTokPtr = ptr + MINBPC(enc);\n        return XML_TOK_DATA_NEWLINE;\n      }\n      *nextTokPtr = ptr;\n      return XML_TOK_DATA_CHARS;\n    case BT_CR:\n      if (ptr == start) {\n        ptr += MINBPC(enc);\n        if (! HAS_CHAR(enc, ptr, end))\n          return XML_TOK_TRAILING_CR;\n        if (BYTE_TYPE(enc, ptr) == BT_LF)\n          ptr += MINBPC(enc);\n        *nextTokPtr = ptr;\n        return XML_TOK_DATA_NEWLINE;\n      }\n      *nextTokPtr = ptr;\n      return XML_TOK_DATA_CHARS;\n    case BT_S:\n      if (ptr == start) {\n        *nextTokPtr = ptr + MINBPC(enc);\n        return XML_TOK_ATTRIBUTE_VALUE_S;\n      }\n      *nextTokPtr = ptr;\n      return XML_TOK_DATA_CHARS;\n    default:\n      ptr += MINBPC(enc);\n      break;\n    }\n  }\n  *nextTokPtr = ptr;\n  return XML_TOK_DATA_CHARS;\n}\n\nstatic int PTRCALL\nPREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, const char *end,\n                       const char **nextTokPtr) {\n  const char *start;\n  if (ptr >= end)\n    return XML_TOK_NONE;\n  else if (! HAS_CHAR(enc, ptr, end)) {\n    /* This line cannot be executed.  The incoming data has already\n     * been tokenized once, so incomplete characters like this have\n     * already been eliminated from the input.  Retaining the paranoia\n     * check is still valuable, however.\n     */\n    return XML_TOK_PARTIAL; /* LCOV_EXCL_LINE */\n  }\n  start = ptr;\n  while (HAS_CHAR(enc, ptr, end)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n#  define LEAD_CASE(n)                                                         \\\n  case BT_LEAD##n:                                                             \\\n    ptr += n;                                                                  \\\n    break;\n      LEAD_CASE(2)\n      LEAD_CASE(3)\n      LEAD_CASE(4)\n#  undef LEAD_CASE\n    case BT_AMP:\n      if (ptr == start)\n        return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);\n      *nextTokPtr = ptr;\n      return XML_TOK_DATA_CHARS;\n    case BT_PERCNT:\n      if (ptr == start) {\n        int tok = PREFIX(scanPercent)(enc, ptr + MINBPC(enc), end, nextTokPtr);\n        return (tok == XML_TOK_PERCENT) ? XML_TOK_INVALID : tok;\n      }\n      *nextTokPtr = ptr;\n      return XML_TOK_DATA_CHARS;\n    case BT_LF:\n      if (ptr == start) {\n        *nextTokPtr = ptr + MINBPC(enc);\n        return XML_TOK_DATA_NEWLINE;\n      }\n      *nextTokPtr = ptr;\n      return XML_TOK_DATA_CHARS;\n    case BT_CR:\n      if (ptr == start) {\n        ptr += MINBPC(enc);\n        if (! HAS_CHAR(enc, ptr, end))\n          return XML_TOK_TRAILING_CR;\n        if (BYTE_TYPE(enc, ptr) == BT_LF)\n          ptr += MINBPC(enc);\n        *nextTokPtr = ptr;\n        return XML_TOK_DATA_NEWLINE;\n      }\n      *nextTokPtr = ptr;\n      return XML_TOK_DATA_CHARS;\n    default:\n      ptr += MINBPC(enc);\n      break;\n    }\n  }\n  *nextTokPtr = ptr;\n  return XML_TOK_DATA_CHARS;\n}\n\n#  ifdef XML_DTD\n\nstatic int PTRCALL\nPREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, const char *end,\n                         const char **nextTokPtr) {\n  int level = 0;\n  if (MINBPC(enc) > 1) {\n    size_t n = end - ptr;\n    if (n & (MINBPC(enc) - 1)) {\n      n &= ~(MINBPC(enc) - 1);\n      end = ptr + n;\n    }\n  }\n  while (HAS_CHAR(enc, ptr, end)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n      INVALID_CASES(ptr, nextTokPtr)\n    case BT_LT:\n      ptr += MINBPC(enc);\n      REQUIRE_CHAR(enc, ptr, end);\n      if (CHAR_MATCHES(enc, ptr, ASCII_EXCL)) {\n        ptr += MINBPC(enc);\n        REQUIRE_CHAR(enc, ptr, end);\n        if (CHAR_MATCHES(enc, ptr, ASCII_LSQB)) {\n          ++level;\n          ptr += MINBPC(enc);\n        }\n      }\n      break;\n    case BT_RSQB:\n      ptr += MINBPC(enc);\n      REQUIRE_CHAR(enc, ptr, end);\n      if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) {\n        ptr += MINBPC(enc);\n        REQUIRE_CHAR(enc, ptr, end);\n        if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {\n          ptr += MINBPC(enc);\n          if (level == 0) {\n            *nextTokPtr = ptr;\n            return XML_TOK_IGNORE_SECT;\n          }\n          --level;\n        }\n      }\n      break;\n    default:\n      ptr += MINBPC(enc);\n      break;\n    }\n  }\n  return XML_TOK_PARTIAL;\n}\n\n#  endif /* XML_DTD */\n\nstatic int PTRCALL\nPREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,\n                   const char **badPtr) {\n  ptr += MINBPC(enc);\n  end -= MINBPC(enc);\n  for (; HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n    case BT_DIGIT:\n    case BT_HEX:\n    case BT_MINUS:\n    case BT_APOS:\n    case BT_LPAR:\n    case BT_RPAR:\n    case BT_PLUS:\n    case BT_COMMA:\n    case BT_SOL:\n    case BT_EQUALS:\n    case BT_QUEST:\n    case BT_CR:\n    case BT_LF:\n    case BT_SEMI:\n    case BT_EXCL:\n    case BT_AST:\n    case BT_PERCNT:\n    case BT_NUM:\n#  ifdef XML_NS\n    case BT_COLON:\n#  endif\n      break;\n    case BT_S:\n      if (CHAR_MATCHES(enc, ptr, ASCII_TAB)) {\n        *badPtr = ptr;\n        return 0;\n      }\n      break;\n    case BT_NAME:\n    case BT_NMSTRT:\n      if (! (BYTE_TO_ASCII(enc, ptr) & ~0x7f))\n        break;\n      /* fall through */\n    default:\n      switch (BYTE_TO_ASCII(enc, ptr)) {\n      case 0x24: /* $ */\n      case 0x40: /* @ */\n        break;\n      default:\n        *badPtr = ptr;\n        return 0;\n      }\n      break;\n    }\n  }\n  return 1;\n}\n\n/* This must only be called for a well-formed start-tag or empty\n   element tag.  Returns the number of attributes.  Pointers to the\n   first attsMax attributes are stored in atts.\n*/\n\nstatic int PTRCALL\nPREFIX(getAtts)(const ENCODING *enc, const char *ptr, int attsMax,\n                ATTRIBUTE *atts) {\n  enum { other, inName, inValue } state = inName;\n  int nAtts = 0;\n  int open = 0; /* defined when state == inValue;\n                   initialization just to shut up compilers */\n\n  for (ptr += MINBPC(enc);; ptr += MINBPC(enc)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n#  define START_NAME                                                           \\\n    if (state == other) {                                                      \\\n      if (nAtts < attsMax) {                                                   \\\n        atts[nAtts].name = ptr;                                                \\\n        atts[nAtts].normalized = 1;                                            \\\n      }                                                                        \\\n      state = inName;                                                          \\\n    }\n#  define LEAD_CASE(n)                                                         \\\n  case BT_LEAD##n:                                                             \\\n    START_NAME ptr += (n - MINBPC(enc));                                       \\\n    break;\n      LEAD_CASE(2)\n      LEAD_CASE(3)\n      LEAD_CASE(4)\n#  undef LEAD_CASE\n    case BT_NONASCII:\n    case BT_NMSTRT:\n    case BT_HEX:\n      START_NAME\n      break;\n#  undef START_NAME\n    case BT_QUOT:\n      if (state != inValue) {\n        if (nAtts < attsMax)\n          atts[nAtts].valuePtr = ptr + MINBPC(enc);\n        state = inValue;\n        open = BT_QUOT;\n      } else if (open == BT_QUOT) {\n        state = other;\n        if (nAtts < attsMax)\n          atts[nAtts].valueEnd = ptr;\n        nAtts++;\n      }\n      break;\n    case BT_APOS:\n      if (state != inValue) {\n        if (nAtts < attsMax)\n          atts[nAtts].valuePtr = ptr + MINBPC(enc);\n        state = inValue;\n        open = BT_APOS;\n      } else if (open == BT_APOS) {\n        state = other;\n        if (nAtts < attsMax)\n          atts[nAtts].valueEnd = ptr;\n        nAtts++;\n      }\n      break;\n    case BT_AMP:\n      if (nAtts < attsMax)\n        atts[nAtts].normalized = 0;\n      break;\n    case BT_S:\n      if (state == inName)\n        state = other;\n      else if (state == inValue && nAtts < attsMax && atts[nAtts].normalized\n               && (ptr == atts[nAtts].valuePtr\n                   || BYTE_TO_ASCII(enc, ptr) != ASCII_SPACE\n                   || BYTE_TO_ASCII(enc, ptr + MINBPC(enc)) == ASCII_SPACE\n                   || BYTE_TYPE(enc, ptr + MINBPC(enc)) == open))\n        atts[nAtts].normalized = 0;\n      break;\n    case BT_CR:\n    case BT_LF:\n      /* This case ensures that the first attribute name is counted\n         Apart from that we could just change state on the quote. */\n      if (state == inName)\n        state = other;\n      else if (state == inValue && nAtts < attsMax)\n        atts[nAtts].normalized = 0;\n      break;\n    case BT_GT:\n    case BT_SOL:\n      if (state != inValue)\n        return nAtts;\n      break;\n    default:\n      break;\n    }\n  }\n  /* not reached */\n}\n\nstatic int PTRFASTCALL\nPREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) {\n  int result = 0;\n  /* skip &# */\n  UNUSED_P(enc);\n  ptr += 2 * MINBPC(enc);\n  if (CHAR_MATCHES(enc, ptr, ASCII_x)) {\n    for (ptr += MINBPC(enc); ! CHAR_MATCHES(enc, ptr, ASCII_SEMI);\n         ptr += MINBPC(enc)) {\n      int c = BYTE_TO_ASCII(enc, ptr);\n      switch (c) {\n      case ASCII_0:\n      case ASCII_1:\n      case ASCII_2:\n      case ASCII_3:\n      case ASCII_4:\n      case ASCII_5:\n      case ASCII_6:\n      case ASCII_7:\n      case ASCII_8:\n      case ASCII_9:\n        result <<= 4;\n        result |= (c - ASCII_0);\n        break;\n      case ASCII_A:\n      case ASCII_B:\n      case ASCII_C:\n      case ASCII_D:\n      case ASCII_E:\n      case ASCII_F:\n        result <<= 4;\n        result += 10 + (c - ASCII_A);\n        break;\n      case ASCII_a:\n      case ASCII_b:\n      case ASCII_c:\n      case ASCII_d:\n      case ASCII_e:\n      case ASCII_f:\n        result <<= 4;\n        result += 10 + (c - ASCII_a);\n        break;\n      }\n      if (result >= 0x110000)\n        return -1;\n    }\n  } else {\n    for (; ! CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) {\n      int c = BYTE_TO_ASCII(enc, ptr);\n      result *= 10;\n      result += (c - ASCII_0);\n      if (result >= 0x110000)\n        return -1;\n    }\n  }\n  return checkCharRefNumber(result);\n}\n\nstatic int PTRCALL\nPREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr,\n                             const char *end) {\n  UNUSED_P(enc);\n  switch ((end - ptr) / MINBPC(enc)) {\n  case 2:\n    if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_t)) {\n      switch (BYTE_TO_ASCII(enc, ptr)) {\n      case ASCII_l:\n        return ASCII_LT;\n      case ASCII_g:\n        return ASCII_GT;\n      }\n    }\n    break;\n  case 3:\n    if (CHAR_MATCHES(enc, ptr, ASCII_a)) {\n      ptr += MINBPC(enc);\n      if (CHAR_MATCHES(enc, ptr, ASCII_m)) {\n        ptr += MINBPC(enc);\n        if (CHAR_MATCHES(enc, ptr, ASCII_p))\n          return ASCII_AMP;\n      }\n    }\n    break;\n  case 4:\n    switch (BYTE_TO_ASCII(enc, ptr)) {\n    case ASCII_q:\n      ptr += MINBPC(enc);\n      if (CHAR_MATCHES(enc, ptr, ASCII_u)) {\n        ptr += MINBPC(enc);\n        if (CHAR_MATCHES(enc, ptr, ASCII_o)) {\n          ptr += MINBPC(enc);\n          if (CHAR_MATCHES(enc, ptr, ASCII_t))\n            return ASCII_QUOT;\n        }\n      }\n      break;\n    case ASCII_a:\n      ptr += MINBPC(enc);\n      if (CHAR_MATCHES(enc, ptr, ASCII_p)) {\n        ptr += MINBPC(enc);\n        if (CHAR_MATCHES(enc, ptr, ASCII_o)) {\n          ptr += MINBPC(enc);\n          if (CHAR_MATCHES(enc, ptr, ASCII_s))\n            return ASCII_APOS;\n        }\n      }\n      break;\n    }\n  }\n  return 0;\n}\n\nstatic int PTRCALL\nPREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1,\n                         const char *end1, const char *ptr2) {\n  UNUSED_P(enc);\n  for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) {\n    if (end1 - ptr1 < MINBPC(enc)) {\n      /* This line cannot be executed.  The incoming data has already\n       * been tokenized once, so incomplete characters like this have\n       * already been eliminated from the input.  Retaining the\n       * paranoia check is still valuable, however.\n       */\n      return 0; /* LCOV_EXCL_LINE */\n    }\n    if (! CHAR_MATCHES(enc, ptr1, *ptr2))\n      return 0;\n  }\n  return ptr1 == end1;\n}\n\nstatic int PTRFASTCALL\nPREFIX(nameLength)(const ENCODING *enc, const char *ptr) {\n  const char *start = ptr;\n  for (;;) {\n    switch (BYTE_TYPE(enc, ptr)) {\n#  define LEAD_CASE(n)                                                         \\\n  case BT_LEAD##n:                                                             \\\n    ptr += n;                                                                  \\\n    break;\n      LEAD_CASE(2)\n      LEAD_CASE(3)\n      LEAD_CASE(4)\n#  undef LEAD_CASE\n    case BT_NONASCII:\n    case BT_NMSTRT:\n#  ifdef XML_NS\n    case BT_COLON:\n#  endif\n    case BT_HEX:\n    case BT_DIGIT:\n    case BT_NAME:\n    case BT_MINUS:\n      ptr += MINBPC(enc);\n      break;\n    default:\n      return (int)(ptr - start);\n    }\n  }\n}\n\nstatic const char *PTRFASTCALL\nPREFIX(skipS)(const ENCODING *enc, const char *ptr) {\n  for (;;) {\n    switch (BYTE_TYPE(enc, ptr)) {\n    case BT_LF:\n    case BT_CR:\n    case BT_S:\n      ptr += MINBPC(enc);\n      break;\n    default:\n      return ptr;\n    }\n  }\n}\n\nstatic void PTRCALL\nPREFIX(updatePosition)(const ENCODING *enc, const char *ptr, const char *end,\n                       POSITION *pos) {\n  while (HAS_CHAR(enc, ptr, end)) {\n    switch (BYTE_TYPE(enc, ptr)) {\n#  define LEAD_CASE(n)                                                         \\\n  case BT_LEAD##n:                                                             \\\n    ptr += n;                                                                  \\\n    break;\n      LEAD_CASE(2)\n      LEAD_CASE(3)\n      LEAD_CASE(4)\n#  undef LEAD_CASE\n    case BT_LF:\n      pos->columnNumber = (XML_Size)-1;\n      pos->lineNumber++;\n      ptr += MINBPC(enc);\n      break;\n    case BT_CR:\n      pos->lineNumber++;\n      ptr += MINBPC(enc);\n      if (HAS_CHAR(enc, ptr, end) && BYTE_TYPE(enc, ptr) == BT_LF)\n        ptr += MINBPC(enc);\n      pos->columnNumber = (XML_Size)-1;\n      break;\n    default:\n      ptr += MINBPC(enc);\n      break;\n    }\n    pos->columnNumber++;\n  }\n}\n\n#  undef DO_LEAD_CASE\n#  undef MULTIBYTE_CASES\n#  undef INVALID_CASES\n#  undef CHECK_NAME_CASE\n#  undef CHECK_NAME_CASES\n#  undef CHECK_NMSTRT_CASE\n#  undef CHECK_NMSTRT_CASES\n\n#endif /* XML_TOK_IMPL_C */\n"},{"id":16527,"name":"nametab.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/*\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nstatic const unsigned namingBitmap[] = {\n    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,\n    0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,\n    0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x04000000,\n    0x87FFFFFE, 0x07FFFFFE, 0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF,\n    0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,\n    0xFFFFE00F, 0xFC31FFFF, 0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,\n    0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000, 0x00000000, 0x00000000,\n    0x00000000, 0x00000000, 0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,\n    0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, 0xFFFF0003, 0xFFFFFFFF,\n    0xFFFF199F, 0x033FCFFF, 0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,\n    0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF, 0x00000000, 0x07FFFFFE,\n    0x000007FE, 0xFFFE0000, 0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060,\n    0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003, 0xFFF99FE0, 0x03C5FDFF,\n    0xB0000000, 0x00030003, 0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000,\n    0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001, 0xFFF99FE0, 0x23CDFDFF,\n    0xB0000000, 0x00000003, 0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000,\n    0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003, 0xFFFDDFE0, 0x03EFFDFF,\n    0x40000000, 0x00000003, 0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003,\n    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFE, 0x000D7FFF,\n    0x0000003F, 0x00000000, 0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000,\n    0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF, 0x00000000, 0x00000000,\n    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,\n    0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF, 0x0007DAED, 0x50000000,\n    0x82315001, 0x002C62AB, 0x40000000, 0xF580C900, 0x00000007, 0x02010800,\n    0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0FFFFFFF, 0xFFFFFFFF,\n    0xFFFFFFFF, 0x03FFFFFF, 0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,\n    0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, 0x00000000, 0x00004C40,\n    0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000000,\n    0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF, 0x001FFFFF, 0xFFFFFFFE,\n    0xFFFFFFFF, 0x07FFFFFF, 0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000,\n    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF,\n    0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,\n    0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000000F,\n    0x00000000, 0x00000000, 0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE,\n    0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF, 0x00FFFFFF, 0x00000000,\n    0xFFFF0000, 0xFFFFFFFF, 0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000,\n    0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003, 0xFFFFD7C0, 0xFFFFFFFB,\n    0x547F7FFF, 0x000FFFFD, 0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,\n    0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, 0x00000000, 0xFFFE0000,\n    0x027FFFFF, 0xFFFFFFFE, 0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,\n    0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF, 0xFFFFFFFF, 0x7CFFFFFF,\n    0xFFEF7FFF, 0x03FF3DFF, 0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,\n    0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF, 0xFFF987E4, 0xD36DFDFF,\n    0x5E003987, 0x001FFFC0, 0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,\n    0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3, 0xD63DC7EC, 0xC3BFC718,\n    0x00803DC7, 0x0000FF80, 0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,\n    0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3, 0xFFFDDFEC, 0xC3FFFDFF,\n    0x00803DCF, 0x0000FFC3, 0x00000000, 0x00000000, 0x00000000, 0x00000000,\n    0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000, 0xFEF02596, 0x3BFF6CAE,\n    0x03FF3F5F, 0x00000000, 0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,\n    0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000,\n    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,\n    0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF, 0x661FFFFF, 0xFFFFFFFE,\n    0xFFFFFFFF, 0x77FFFFFF,\n};\nstatic const unsigned char nmstrtPages[] = {\n    0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x09, 0x0A, 0x0B,\n    0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, 0x00, 0x14, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00,\n};\nstatic const unsigned char namePages[] = {\n    0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00, 0x00, 0x1F, 0x20, 0x21,\n    0x22, 0x23, 0x24, 0x25, 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, 0x26, 0x14, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00,\n};\n"},{"id":16528,"name":"utf8tab.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/*\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,\n    /* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,\n    /* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,\n    /* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,\n    /* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,\n    /* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,\n    /* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,\n    /* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,\n    /* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,\n    /* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,\n    /* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,\n    /* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,\n    /* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,\n    /* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,\n    /* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,\n    /* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,\n    /* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,\n    /* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,\n    /* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,\n    /* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,\n    /* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,\n    /* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,\n    /* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,\n    /* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,\n    /* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,\n    /* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,\n    /* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,\n    /* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,\n    /* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4,\n    /* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML,\n    /* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,\n    /* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM,\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":16529,"name":"ctype","nodeType":"Attribute","startLoc":18,"text":"IDENTITY.wcs.ctype"},{"id":16530,"name":".gitignore","nodeType":"TextFile","path":"cextern/expat/lib","text":"Makefile\n.libs\n*.lo\nDebug\nDebug-w\nRelease\nRelease-w\nexpat.ncb\nexpat.opt\nexpat.plg\nDebug_static\nDebug-w_static\nRelease_static\nRelease-w_static\nexpat_static.plg\nexpatw.plg\nexpatw_static.plg\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":16531,"name":"crval","nodeType":"Attribute","startLoc":19,"text":"IDENTITY.wcs.crval"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":16532,"name":"crpix","nodeType":"Attribute","startLoc":20,"text":"IDENTITY.wcs.crpix"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":16533,"name":"cdelt","nodeType":"Attribute","startLoc":21,"text":"IDENTITY.wcs.cdelt"},{"id":16534,"name":"libexpatw.def","nodeType":"TextFile","path":"cextern/expat/lib","text":"; DEF file for MS VC++\n\nLIBRARY\nEXPORTS\n  XML_DefaultCurrent @1\n  XML_ErrorString @2\n  XML_ExpatVersion @3\n  XML_ExpatVersionInfo @4\n  XML_ExternalEntityParserCreate @5\n  XML_GetBase @6\n  XML_GetBuffer @7\n  XML_GetCurrentByteCount @8\n  XML_GetCurrentByteIndex @9\n  XML_GetCurrentColumnNumber @10\n  XML_GetCurrentLineNumber @11\n  XML_GetErrorCode @12\n  XML_GetIdAttributeIndex @13\n  XML_GetInputContext @14\n  XML_GetSpecifiedAttributeCount @15\n  XML_Parse @16\n  XML_ParseBuffer @17\n  XML_ParserCreate @18\n  XML_ParserCreateNS @19\n  XML_ParserCreate_MM @20\n  XML_ParserFree @21\n  XML_SetAttlistDeclHandler @22\n  XML_SetBase @23\n  XML_SetCdataSectionHandler @24\n  XML_SetCharacterDataHandler @25\n  XML_SetCommentHandler @26\n  XML_SetDefaultHandler @27\n  XML_SetDefaultHandlerExpand @28\n  XML_SetDoctypeDeclHandler @29\n  XML_SetElementDeclHandler @30\n  XML_SetElementHandler @31\n  XML_SetEncoding @32\n  XML_SetEndCdataSectionHandler @33\n  XML_SetEndDoctypeDeclHandler @34\n  XML_SetEndElementHandler @35\n  XML_SetEndNamespaceDeclHandler @36\n  XML_SetEntityDeclHandler @37\n  XML_SetExternalEntityRefHandler @38\n  XML_SetExternalEntityRefHandlerArg @39\n  XML_SetNamespaceDeclHandler @40\n  XML_SetNotStandaloneHandler @41\n  XML_SetNotationDeclHandler @42\n  XML_SetParamEntityParsing @43\n  XML_SetProcessingInstructionHandler @44\n  XML_SetReturnNSTriplet @45\n  XML_SetStartCdataSectionHandler @46\n  XML_SetStartDoctypeDeclHandler @47\n  XML_SetStartElementHandler @48\n  XML_SetStartNamespaceDeclHandler @49\n  XML_SetUnknownEncodingHandler @50\n  XML_SetUnparsedEntityDeclHandler @51\n  XML_SetUserData @52\n  XML_SetXmlDeclHandler @53\n  XML_UseParserAsHandlerArg @54\n; added with version 1.95.3\n  XML_ParserReset @55\n  XML_SetSkippedEntityHandler @56\n; added with version 1.95.5\n  XML_GetFeatureList @57\n  XML_UseForeignDTD @58\n; added with version 1.95.6\n  XML_FreeContentModel @59\n  XML_MemMalloc @60\n  XML_MemRealloc @61\n  XML_MemFree @62\n; added with version 1.95.8\n  XML_StopParser @63\n  XML_ResumeParser @64\n  XML_GetParsingStatus @65\n; added with version 2.1.1\n; XML_GetAttributeInfo @66\n  XML_SetHashSalt @67\n; added with version 2.2.5\n  _INTERNAL_trim_to_complete_utf8_characters @68\n"},{"col":0,"comment":"","endLoc":3,"header":"wcsapi.py#<anonymous>","id":16535,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['transform_coord_meta_from_wcs', 'WCSWorld2PixelTransform',\n           'WCSPixel2WorldTransform']\n\nIDENTITY = WCS(naxis=2)\n\nIDENTITY.wcs.ctype = [\"X\", \"Y\"]\n\nIDENTITY.wcs.crval = [0., 0.]\n\nIDENTITY.wcs.crpix = [1., 1.]\n\nIDENTITY.wcs.cdelt = [1., 1.]"},{"id":16536,"name":"xmltok_impl.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/*\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nenum {\n  BT_NONXML,   /* e.g. noncharacter-FFFF */\n  BT_MALFORM,  /* illegal, with regard to encoding */\n  BT_LT,       /* less than = \"<\" */\n  BT_AMP,      /* ampersand = \"&\" */\n  BT_RSQB,     /* right square bracket = \"[\" */\n  BT_LEAD2,    /* lead byte of a 2-byte UTF-8 character */\n  BT_LEAD3,    /* lead byte of a 3-byte UTF-8 character */\n  BT_LEAD4,    /* lead byte of a 4-byte UTF-8 character */\n  BT_TRAIL,    /* trailing unit, e.g. second 16-bit unit of a 4-byte char. */\n  BT_CR,       /* carriage return = \"\\r\" */\n  BT_LF,       /* line feed = \"\\n\" */\n  BT_GT,       /* greater than = \">\" */\n  BT_QUOT,     /* quotation character = \"\\\"\" */\n  BT_APOS,     /* aposthrophe = \"'\" */\n  BT_EQUALS,   /* equal sign = \"=\" */\n  BT_QUEST,    /* question mark = \"?\" */\n  BT_EXCL,     /* exclamation mark = \"!\" */\n  BT_SOL,      /* solidus, slash = \"/\" */\n  BT_SEMI,     /* semicolon = \";\" */\n  BT_NUM,      /* number sign = \"#\" */\n  BT_LSQB,     /* left square bracket = \"[\" */\n  BT_S,        /* white space, e.g. \"\\t\", \" \"[, \"\\r\"] */\n  BT_NMSTRT,   /* non-hex name start letter = \"G\"..\"Z\" + \"g\"..\"z\" + \"_\" */\n  BT_COLON,    /* colon = \":\" */\n  BT_HEX,      /* hex letter = \"A\"..\"F\" + \"a\"..\"f\" */\n  BT_DIGIT,    /* digit = \"0\"..\"9\" */\n  BT_NAME,     /* dot and middle dot = \".\" + chr(0xb7) */\n  BT_MINUS,    /* minus = \"-\" */\n  BT_OTHER,    /* known not to be a name or name start character */\n  BT_NONASCII, /* might be a name or name start character */\n  BT_PERCNT,   /* percent sign = \"%\" */\n  BT_LPAR,     /* left parenthesis = \"(\" */\n  BT_RPAR,     /* right parenthesis = \"(\" */\n  BT_AST,      /* asterisk = \"*\" */\n  BT_PLUS,     /* plus sign = \"+\" */\n  BT_COMMA,    /* comma = \",\" */\n  BT_VERBAR    /* vertical bar = \"|\" */\n};\n\n#include <stddef.h>\n"},{"id":16537,"name":"xmltok.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/*\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#ifndef XmlTok_INCLUDED\n#define XmlTok_INCLUDED 1\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* The following token may be returned by XmlContentTok */\n#define XML_TOK_TRAILING_RSQB                                                  \\\n  -5 /* ] or ]] at the end of the scan; might be                               \\\n        start of illegal ]]> sequence */\n/* The following tokens may be returned by both XmlPrologTok and\n   XmlContentTok.\n*/\n#define XML_TOK_NONE -4 /* The string to be scanned is empty */\n#define XML_TOK_TRAILING_CR                                                    \\\n  -3                            /* A CR at the end of the scan;                \\\n                                   might be part of CRLF sequence */\n#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */\n#define XML_TOK_PARTIAL -1      /* only part of a token */\n#define XML_TOK_INVALID 0\n\n/* The following tokens are returned by XmlContentTok; some are also\n   returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok.\n*/\n#define XML_TOK_START_TAG_WITH_ATTS 1\n#define XML_TOK_START_TAG_NO_ATTS 2\n#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag <e/> */\n#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4\n#define XML_TOK_END_TAG 5\n#define XML_TOK_DATA_CHARS 6\n#define XML_TOK_DATA_NEWLINE 7\n#define XML_TOK_CDATA_SECT_OPEN 8\n#define XML_TOK_ENTITY_REF 9\n#define XML_TOK_CHAR_REF 10 /* numeric character reference */\n\n/* The following tokens may be returned by both XmlPrologTok and\n   XmlContentTok.\n*/\n#define XML_TOK_PI 11       /* processing instruction */\n#define XML_TOK_XML_DECL 12 /* XML decl or text decl */\n#define XML_TOK_COMMENT 13\n#define XML_TOK_BOM 14 /* Byte order mark */\n\n/* The following tokens are returned only by XmlPrologTok */\n#define XML_TOK_PROLOG_S 15\n#define XML_TOK_DECL_OPEN 16  /* <!foo */\n#define XML_TOK_DECL_CLOSE 17 /* > */\n#define XML_TOK_NAME 18\n#define XML_TOK_NMTOKEN 19\n#define XML_TOK_POUND_NAME 20 /* #name */\n#define XML_TOK_OR 21         /* | */\n#define XML_TOK_PERCENT 22\n#define XML_TOK_OPEN_PAREN 23\n#define XML_TOK_CLOSE_PAREN 24\n#define XML_TOK_OPEN_BRACKET 25\n#define XML_TOK_CLOSE_BRACKET 26\n#define XML_TOK_LITERAL 27\n#define XML_TOK_PARAM_ENTITY_REF 28\n#define XML_TOK_INSTANCE_START 29\n\n/* The following occur only in element type declarations */\n#define XML_TOK_NAME_QUESTION 30        /* name? */\n#define XML_TOK_NAME_ASTERISK 31        /* name* */\n#define XML_TOK_NAME_PLUS 32            /* name+ */\n#define XML_TOK_COND_SECT_OPEN 33       /* <![ */\n#define XML_TOK_COND_SECT_CLOSE 34      /* ]]> */\n#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */\n#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */\n#define XML_TOK_CLOSE_PAREN_PLUS 37     /* )+ */\n#define XML_TOK_COMMA 38\n\n/* The following token is returned only by XmlAttributeValueTok */\n#define XML_TOK_ATTRIBUTE_VALUE_S 39\n\n/* The following token is returned only by XmlCdataSectionTok */\n#define XML_TOK_CDATA_SECT_CLOSE 40\n\n/* With namespace processing this is returned by XmlPrologTok for a\n   name with a colon.\n*/\n#define XML_TOK_PREFIXED_NAME 41\n\n#ifdef XML_DTD\n#  define XML_TOK_IGNORE_SECT 42\n#endif /* XML_DTD */\n\n#ifdef XML_DTD\n#  define XML_N_STATES 4\n#else /* not XML_DTD */\n#  define XML_N_STATES 3\n#endif /* not XML_DTD */\n\n#define XML_PROLOG_STATE 0\n#define XML_CONTENT_STATE 1\n#define XML_CDATA_SECTION_STATE 2\n#ifdef XML_DTD\n#  define XML_IGNORE_SECTION_STATE 3\n#endif /* XML_DTD */\n\n#define XML_N_LITERAL_TYPES 2\n#define XML_ATTRIBUTE_VALUE_LITERAL 0\n#define XML_ENTITY_VALUE_LITERAL 1\n\n/* The size of the buffer passed to XmlUtf8Encode must be at least this. */\n#define XML_UTF8_ENCODE_MAX 4\n/* The size of the buffer passed to XmlUtf16Encode must be at least this. */\n#define XML_UTF16_ENCODE_MAX 2\n\ntypedef struct position {\n  /* first line and first column are 0 not 1 */\n  XML_Size lineNumber;\n  XML_Size columnNumber;\n} POSITION;\n\ntypedef struct {\n  const char *name;\n  const char *valuePtr;\n  const char *valueEnd;\n  char normalized;\n} ATTRIBUTE;\n\nstruct encoding;\ntypedef struct encoding ENCODING;\n\ntypedef int(PTRCALL *SCANNER)(const ENCODING *, const char *, const char *,\n                              const char **);\n\nenum XML_Convert_Result {\n  XML_CONVERT_COMPLETED = 0,\n  XML_CONVERT_INPUT_INCOMPLETE = 1,\n  XML_CONVERT_OUTPUT_EXHAUSTED\n  = 2 /* and therefore potentially input remaining as well */\n};\n\nstruct encoding {\n  SCANNER scanners[XML_N_STATES];\n  SCANNER literalScanners[XML_N_LITERAL_TYPES];\n  int(PTRCALL *nameMatchesAscii)(const ENCODING *, const char *, const char *,\n                                 const char *);\n  int(PTRFASTCALL *nameLength)(const ENCODING *, const char *);\n  const char *(PTRFASTCALL *skipS)(const ENCODING *, const char *);\n  int(PTRCALL *getAtts)(const ENCODING *enc, const char *ptr, int attsMax,\n                        ATTRIBUTE *atts);\n  int(PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr);\n  int(PTRCALL *predefinedEntityName)(const ENCODING *, const char *,\n                                     const char *);\n  void(PTRCALL *updatePosition)(const ENCODING *, const char *ptr,\n                                const char *end, POSITION *);\n  int(PTRCALL *isPublicId)(const ENCODING *enc, const char *ptr,\n                           const char *end, const char **badPtr);\n  enum XML_Convert_Result(PTRCALL *utf8Convert)(const ENCODING *enc,\n                                                const char **fromP,\n                                                const char *fromLim, char **toP,\n                                                const char *toLim);\n  enum XML_Convert_Result(PTRCALL *utf16Convert)(const ENCODING *enc,\n                                                 const char **fromP,\n                                                 const char *fromLim,\n                                                 unsigned short **toP,\n                                                 const unsigned short *toLim);\n  int minBytesPerChar;\n  char isUtf8;\n  char isUtf16;\n};\n\n/* Scan the string starting at ptr until the end of the next complete\n   token, but do not scan past eptr.  Return an integer giving the\n   type of token.\n\n   Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set.\n\n   Return XML_TOK_PARTIAL when the string does not contain a complete\n   token; nextTokPtr will not be set.\n\n   Return XML_TOK_INVALID when the string does not start a valid\n   token; nextTokPtr will be set to point to the character which made\n   the token invalid.\n\n   Otherwise the string starts with a valid token; nextTokPtr will be\n   set to point to the character following the end of that token.\n\n   Each data character counts as a single token, but adjacent data\n   characters may be returned together.  Similarly for characters in\n   the prolog outside literals, comments and processing instructions.\n*/\n\n#define XmlTok(enc, state, ptr, end, nextTokPtr)                               \\\n  (((enc)->scanners[state])(enc, ptr, end, nextTokPtr))\n\n#define XmlPrologTok(enc, ptr, end, nextTokPtr)                                \\\n  XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr)\n\n#define XmlContentTok(enc, ptr, end, nextTokPtr)                               \\\n  XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr)\n\n#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr)                          \\\n  XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr)\n\n#ifdef XML_DTD\n\n#  define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr)                       \\\n    XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr)\n\n#endif /* XML_DTD */\n\n/* This is used for performing a 2nd-level tokenization on the content\n   of a literal that has already been returned by XmlTok.\n*/\n#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr)                  \\\n  (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr))\n\n#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr)                        \\\n  XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr)\n\n#define XmlEntityValueTok(enc, ptr, end, nextTokPtr)                           \\\n  XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr)\n\n#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2)                             \\\n  (((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2))\n\n#define XmlNameLength(enc, ptr) (((enc)->nameLength)(enc, ptr))\n\n#define XmlSkipS(enc, ptr) (((enc)->skipS)(enc, ptr))\n\n#define XmlGetAttributes(enc, ptr, attsMax, atts)                              \\\n  (((enc)->getAtts)(enc, ptr, attsMax, atts))\n\n#define XmlCharRefNumber(enc, ptr) (((enc)->charRefNumber)(enc, ptr))\n\n#define XmlPredefinedEntityName(enc, ptr, end)                                 \\\n  (((enc)->predefinedEntityName)(enc, ptr, end))\n\n#define XmlUpdatePosition(enc, ptr, end, pos)                                  \\\n  (((enc)->updatePosition)(enc, ptr, end, pos))\n\n#define XmlIsPublicId(enc, ptr, end, badPtr)                                   \\\n  (((enc)->isPublicId)(enc, ptr, end, badPtr))\n\n#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim)                        \\\n  (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim))\n\n#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim)                       \\\n  (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim))\n\ntypedef struct {\n  ENCODING initEnc;\n  const ENCODING **encPtr;\n} INIT_ENCODING;\n\nint XmlParseXmlDecl(int isGeneralTextEntity, const ENCODING *enc,\n                    const char *ptr, const char *end, const char **badPtr,\n                    const char **versionPtr, const char **versionEndPtr,\n                    const char **encodingNamePtr,\n                    const ENCODING **namedEncodingPtr, int *standalonePtr);\n\nint XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);\nconst ENCODING *XmlGetUtf8InternalEncoding(void);\nconst ENCODING *XmlGetUtf16InternalEncoding(void);\nint FASTCALL XmlUtf8Encode(int charNumber, char *buf);\nint FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf);\nint XmlSizeOfUnknownEncoding(void);\n\ntypedef int(XMLCALL *CONVERTER)(void *userData, const char *p);\n\nENCODING *XmlInitUnknownEncoding(void *mem, int *table, CONVERTER convert,\n                                 void *userData);\n\nint XmlParseXmlDeclNS(int isGeneralTextEntity, const ENCODING *enc,\n                      const char *ptr, const char *end, const char **badPtr,\n                      const char **versionPtr, const char **versionEndPtr,\n                      const char **encodingNamePtr,\n                      const ENCODING **namedEncodingPtr, int *standalonePtr);\n\nint XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);\nconst ENCODING *XmlGetUtf8InternalEncodingNS(void);\nconst ENCODING *XmlGetUtf16InternalEncodingNS(void);\nENCODING *XmlInitUnknownEncodingNS(void *mem, int *table, CONVERTER convert,\n                                   void *userData);\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* not XmlTok_INCLUDED */\n"},{"id":16538,"name":"internal.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* internal.h\n\n   Internal definitions used by Expat.  This is not needed to compile\n   client code.\n\n   The following calling convention macros are defined for frequently\n   called functions:\n\n   FASTCALL    - Used for those internal functions that have a simple\n                 body and a low number of arguments and local variables.\n\n   PTRCALL     - Used for functions called though function pointers.\n\n   PTRFASTCALL - Like PTRCALL, but for low number of arguments.\n\n   inline      - Used for selected internal functions for which inlining\n                 may improve performance on some platforms.\n\n   Note: Use of these macros is based on judgement, not hard rules,\n         and therefore subject to change.\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#if defined(__GNUC__) && defined(__i386__) && ! defined(__MINGW32__)\n/* We'll use this version by default only where we know it helps.\n\n   regparm() generates warnings on Solaris boxes.   See SF bug #692878.\n\n   Instability reported with egcs on a RedHat Linux 7.3.\n   Let's comment out:\n   #define FASTCALL __attribute__((stdcall, regparm(3)))\n   and let's try this:\n*/\n#  define FASTCALL __attribute__((regparm(3)))\n#  define PTRFASTCALL __attribute__((regparm(3)))\n#endif\n\n/* Using __fastcall seems to have an unexpected negative effect under\n   MS VC++, especially for function pointers, so we won't use it for\n   now on that platform. It may be reconsidered for a future release\n   if it can be made more effective.\n   Likely reason: __fastcall on Windows is like stdcall, therefore\n   the compiler cannot perform stack optimizations for call clusters.\n*/\n\n/* Make sure all of these are defined if they aren't already. */\n\n#ifndef FASTCALL\n#  define FASTCALL\n#endif\n\n#ifndef PTRCALL\n#  define PTRCALL\n#endif\n\n#ifndef PTRFASTCALL\n#  define PTRFASTCALL\n#endif\n\n#ifndef XML_MIN_SIZE\n#  if ! defined(__cplusplus) && ! defined(inline)\n#    ifdef __GNUC__\n#      define inline __inline\n#    endif /* __GNUC__ */\n#  endif\n#endif /* XML_MIN_SIZE */\n\n#ifdef __cplusplus\n#  define inline inline\n#else\n#  ifndef inline\n#    define inline\n#  endif\n#endif\n\n#ifndef UNUSED_P\n#  define UNUSED_P(p) (void)p\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef XML_ENABLE_VISIBILITY\n#  if XML_ENABLE_VISIBILITY\n__attribute__((visibility(\"default\")))\n#  endif\n#endif\nvoid\n_INTERNAL_trim_to_complete_utf8_characters(const char *from,\n                                           const char **fromLimRef);\n\n#ifdef __cplusplus\n}\n#endif\n"},{"id":16539,"name":"asciitab.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/*\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,\n    /* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,\n    /* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,\n    /* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML,\n    /* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,\n    /* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,\n    /* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,\n    /* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,\n    /* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,\n    /* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,\n    /* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,\n    /* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,\n    /* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,\n    /* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,\n    /* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,\n    /* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,\n    /* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,\n    /* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,\n    /* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,\n    /* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,\n    /* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,\n    /* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,\n    /* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,\n    /* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,\n"},{"id":16540,"name":"expat.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/*\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#ifndef Expat_INCLUDED\n#define Expat_INCLUDED 1\n\n#include <stdlib.h>\n#include \"expat_external.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nstruct XML_ParserStruct;\ntypedef struct XML_ParserStruct *XML_Parser;\n\ntypedef unsigned char XML_Bool;\n#define XML_TRUE ((XML_Bool)1)\n#define XML_FALSE ((XML_Bool)0)\n\n/* The XML_Status enum gives the possible return values for several\n   API functions.  The preprocessor #defines are included so this\n   stanza can be added to code that still needs to support older\n   versions of Expat 1.95.x:\n\n   #ifndef XML_STATUS_OK\n   #define XML_STATUS_OK    1\n   #define XML_STATUS_ERROR 0\n   #endif\n\n   Otherwise, the #define hackery is quite ugly and would have been\n   dropped.\n*/\nenum XML_Status {\n  XML_STATUS_ERROR = 0,\n#define XML_STATUS_ERROR XML_STATUS_ERROR\n  XML_STATUS_OK = 1,\n#define XML_STATUS_OK XML_STATUS_OK\n  XML_STATUS_SUSPENDED = 2\n#define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED\n};\n\nenum XML_Error {\n  XML_ERROR_NONE,\n  XML_ERROR_NO_MEMORY,\n  XML_ERROR_SYNTAX,\n  XML_ERROR_NO_ELEMENTS,\n  XML_ERROR_INVALID_TOKEN,\n  XML_ERROR_UNCLOSED_TOKEN,\n  XML_ERROR_PARTIAL_CHAR,\n  XML_ERROR_TAG_MISMATCH,\n  XML_ERROR_DUPLICATE_ATTRIBUTE,\n  XML_ERROR_JUNK_AFTER_DOC_ELEMENT,\n  XML_ERROR_PARAM_ENTITY_REF,\n  XML_ERROR_UNDEFINED_ENTITY,\n  XML_ERROR_RECURSIVE_ENTITY_REF,\n  XML_ERROR_ASYNC_ENTITY,\n  XML_ERROR_BAD_CHAR_REF,\n  XML_ERROR_BINARY_ENTITY_REF,\n  XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,\n  XML_ERROR_MISPLACED_XML_PI,\n  XML_ERROR_UNKNOWN_ENCODING,\n  XML_ERROR_INCORRECT_ENCODING,\n  XML_ERROR_UNCLOSED_CDATA_SECTION,\n  XML_ERROR_EXTERNAL_ENTITY_HANDLING,\n  XML_ERROR_NOT_STANDALONE,\n  XML_ERROR_UNEXPECTED_STATE,\n  XML_ERROR_ENTITY_DECLARED_IN_PE,\n  XML_ERROR_FEATURE_REQUIRES_XML_DTD,\n  XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING,\n  /* Added in 1.95.7. */\n  XML_ERROR_UNBOUND_PREFIX,\n  /* Added in 1.95.8. */\n  XML_ERROR_UNDECLARING_PREFIX,\n  XML_ERROR_INCOMPLETE_PE,\n  XML_ERROR_XML_DECL,\n  XML_ERROR_TEXT_DECL,\n  XML_ERROR_PUBLICID,\n  XML_ERROR_SUSPENDED,\n  XML_ERROR_NOT_SUSPENDED,\n  XML_ERROR_ABORTED,\n  XML_ERROR_FINISHED,\n  XML_ERROR_SUSPEND_PE,\n  /* Added in 2.0. */\n  XML_ERROR_RESERVED_PREFIX_XML,\n  XML_ERROR_RESERVED_PREFIX_XMLNS,\n  XML_ERROR_RESERVED_NAMESPACE_URI,\n  /* Added in 2.2.1. */\n  XML_ERROR_INVALID_ARGUMENT\n};\n\nenum XML_Content_Type {\n  XML_CTYPE_EMPTY = 1,\n  XML_CTYPE_ANY,\n  XML_CTYPE_MIXED,\n  XML_CTYPE_NAME,\n  XML_CTYPE_CHOICE,\n  XML_CTYPE_SEQ\n};\n\nenum XML_Content_Quant {\n  XML_CQUANT_NONE,\n  XML_CQUANT_OPT,\n  XML_CQUANT_REP,\n  XML_CQUANT_PLUS\n};\n\n/* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be\n   XML_CQUANT_NONE, and the other fields will be zero or NULL.\n   If type == XML_CTYPE_MIXED, then quant will be NONE or REP and\n   numchildren will contain number of elements that may be mixed in\n   and children point to an array of XML_Content cells that will be\n   all of XML_CTYPE_NAME type with no quantification.\n\n   If type == XML_CTYPE_NAME, then the name points to the name, and\n   the numchildren field will be zero and children will be NULL. The\n   quant fields indicates any quantifiers placed on the name.\n\n   CHOICE and SEQ will have name NULL, the number of children in\n   numchildren and children will point, recursively, to an array\n   of XML_Content cells.\n\n   The EMPTY, ANY, and MIXED types will only occur at top level.\n*/\n\ntypedef struct XML_cp XML_Content;\n\nstruct XML_cp {\n  enum XML_Content_Type type;\n  enum XML_Content_Quant quant;\n  XML_Char *name;\n  unsigned int numchildren;\n  XML_Content *children;\n};\n\n/* This is called for an element declaration. See above for\n   description of the model argument. It's the caller's responsibility\n   to free model when finished with it.\n*/\ntypedef void(XMLCALL *XML_ElementDeclHandler)(void *userData,\n                                              const XML_Char *name,\n                                              XML_Content *model);\n\nXMLPARSEAPI(void)\nXML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl);\n\n/* The Attlist declaration handler is called for *each* attribute. So\n   a single Attlist declaration with multiple attributes declared will\n   generate multiple calls to this handler. The \"default\" parameter\n   may be NULL in the case of the \"#IMPLIED\" or \"#REQUIRED\"\n   keyword. The \"isrequired\" parameter will be true and the default\n   value will be NULL in the case of \"#REQUIRED\". If \"isrequired\" is\n   true and default is non-NULL, then this is a \"#FIXED\" default.\n*/\ntypedef void(XMLCALL *XML_AttlistDeclHandler)(\n    void *userData, const XML_Char *elname, const XML_Char *attname,\n    const XML_Char *att_type, const XML_Char *dflt, int isrequired);\n\nXMLPARSEAPI(void)\nXML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl);\n\n/* The XML declaration handler is called for *both* XML declarations\n   and text declarations. The way to distinguish is that the version\n   parameter will be NULL for text declarations. The encoding\n   parameter may be NULL for XML declarations. The standalone\n   parameter will be -1, 0, or 1 indicating respectively that there\n   was no standalone parameter in the declaration, that it was given\n   as no, or that it was given as yes.\n*/\ntypedef void(XMLCALL *XML_XmlDeclHandler)(void *userData,\n                                          const XML_Char *version,\n                                          const XML_Char *encoding,\n                                          int standalone);\n\nXMLPARSEAPI(void)\nXML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler xmldecl);\n\ntypedef struct {\n  void *(*malloc_fcn)(size_t size);\n  void *(*realloc_fcn)(void *ptr, size_t size);\n  void (*free_fcn)(void *ptr);\n} XML_Memory_Handling_Suite;\n\n/* Constructs a new parser; encoding is the encoding specified by the\n   external protocol or NULL if there is none specified.\n*/\nXMLPARSEAPI(XML_Parser)\nXML_ParserCreate(const XML_Char *encoding);\n\n/* Constructs a new parser and namespace processor.  Element type\n   names and attribute names that belong to a namespace will be\n   expanded; unprefixed attribute names are never expanded; unprefixed\n   element type names are expanded only if there is a default\n   namespace. The expanded name is the concatenation of the namespace\n   URI, the namespace separator character, and the local part of the\n   name.  If the namespace separator is '\\0' then the namespace URI\n   and the local part will be concatenated without any separator.\n   It is a programming error to use the separator '\\0' with namespace\n   triplets (see XML_SetReturnNSTriplet).\n*/\nXMLPARSEAPI(XML_Parser)\nXML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);\n\n/* Constructs a new parser using the memory management suite referred to\n   by memsuite. If memsuite is NULL, then use the standard library memory\n   suite. If namespaceSeparator is non-NULL it creates a parser with\n   namespace processing as described above. The character pointed at\n   will serve as the namespace separator.\n\n   All further memory operations used for the created parser will come from\n   the given suite.\n*/\nXMLPARSEAPI(XML_Parser)\nXML_ParserCreate_MM(const XML_Char *encoding,\n                    const XML_Memory_Handling_Suite *memsuite,\n                    const XML_Char *namespaceSeparator);\n\n/* Prepare a parser object to be re-used.  This is particularly\n   valuable when memory allocation overhead is disproportionately high,\n   such as when a large number of small documnents need to be parsed.\n   All handlers are cleared from the parser, except for the\n   unknownEncodingHandler. The parser's external state is re-initialized\n   except for the values of ns and ns_triplets.\n\n   Added in Expat 1.95.3.\n*/\nXMLPARSEAPI(XML_Bool)\nXML_ParserReset(XML_Parser parser, const XML_Char *encoding);\n\n/* atts is array of name/value pairs, terminated by 0;\n   names and values are 0 terminated.\n*/\ntypedef void(XMLCALL *XML_StartElementHandler)(void *userData,\n                                               const XML_Char *name,\n                                               const XML_Char **atts);\n\ntypedef void(XMLCALL *XML_EndElementHandler)(void *userData,\n                                             const XML_Char *name);\n\n/* s is not 0 terminated. */\ntypedef void(XMLCALL *XML_CharacterDataHandler)(void *userData,\n                                                const XML_Char *s, int len);\n\n/* target and data are 0 terminated */\ntypedef void(XMLCALL *XML_ProcessingInstructionHandler)(void *userData,\n                                                        const XML_Char *target,\n                                                        const XML_Char *data);\n\n/* data is 0 terminated */\ntypedef void(XMLCALL *XML_CommentHandler)(void *userData, const XML_Char *data);\n\ntypedef void(XMLCALL *XML_StartCdataSectionHandler)(void *userData);\ntypedef void(XMLCALL *XML_EndCdataSectionHandler)(void *userData);\n\n/* This is called for any characters in the XML document for which\n   there is no applicable handler.  This includes both characters that\n   are part of markup which is of a kind that is not reported\n   (comments, markup declarations), or characters that are part of a\n   construct which could be reported but for which no handler has been\n   supplied. The characters are passed exactly as they were in the XML\n   document except that they will be encoded in UTF-8 or UTF-16.\n   Line boundaries are not normalized. Note that a byte order mark\n   character is not passed to the default handler. There are no\n   guarantees about how characters are divided between calls to the\n   default handler: for example, a comment might be split between\n   multiple calls.\n*/\ntypedef void(XMLCALL *XML_DefaultHandler)(void *userData, const XML_Char *s,\n                                          int len);\n\n/* This is called for the start of the DOCTYPE declaration, before\n   any DTD or internal subset is parsed.\n*/\ntypedef void(XMLCALL *XML_StartDoctypeDeclHandler)(void *userData,\n                                                   const XML_Char *doctypeName,\n                                                   const XML_Char *sysid,\n                                                   const XML_Char *pubid,\n                                                   int has_internal_subset);\n\n/* This is called for the start of the DOCTYPE declaration when the\n   closing > is encountered, but after processing any external\n   subset.\n*/\ntypedef void(XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);\n\n/* This is called for entity declarations. The is_parameter_entity\n   argument will be non-zero if the entity is a parameter entity, zero\n   otherwise.\n\n   For internal entities (<!ENTITY foo \"bar\">), value will\n   be non-NULL and systemId, publicID, and notationName will be NULL.\n   The value string is NOT nul-terminated; the length is provided in\n   the value_length argument. Since it is legal to have zero-length\n   values, do not use this argument to test for internal entities.\n\n   For external entities, value will be NULL and systemId will be\n   non-NULL. The publicId argument will be NULL unless a public\n   identifier was provided. The notationName argument will have a\n   non-NULL value only for unparsed entity declarations.\n\n   Note that is_parameter_entity can't be changed to XML_Bool, since\n   that would break binary compatibility.\n*/\ntypedef void(XMLCALL *XML_EntityDeclHandler)(\n    void *userData, const XML_Char *entityName, int is_parameter_entity,\n    const XML_Char *value, int value_length, const XML_Char *base,\n    const XML_Char *systemId, const XML_Char *publicId,\n    const XML_Char *notationName);\n\nXMLPARSEAPI(void)\nXML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler);\n\n/* OBSOLETE -- OBSOLETE -- OBSOLETE\n   This handler has been superseded by the EntityDeclHandler above.\n   It is provided here for backward compatibility.\n\n   This is called for a declaration of an unparsed (NDATA) entity.\n   The base argument is whatever was set by XML_SetBase. The\n   entityName, systemId and notationName arguments will never be\n   NULL. The other arguments may be.\n*/\ntypedef void(XMLCALL *XML_UnparsedEntityDeclHandler)(\n    void *userData, const XML_Char *entityName, const XML_Char *base,\n    const XML_Char *systemId, const XML_Char *publicId,\n    const XML_Char *notationName);\n\n/* This is called for a declaration of notation.  The base argument is\n   whatever was set by XML_SetBase. The notationName will never be\n   NULL.  The other arguments can be.\n*/\ntypedef void(XMLCALL *XML_NotationDeclHandler)(void *userData,\n                                               const XML_Char *notationName,\n                                               const XML_Char *base,\n                                               const XML_Char *systemId,\n                                               const XML_Char *publicId);\n\n/* When namespace processing is enabled, these are called once for\n   each namespace declaration. The call to the start and end element\n   handlers occur between the calls to the start and end namespace\n   declaration handlers. For an xmlns attribute, prefix will be\n   NULL.  For an xmlns=\"\" attribute, uri will be NULL.\n*/\ntypedef void(XMLCALL *XML_StartNamespaceDeclHandler)(void *userData,\n                                                     const XML_Char *prefix,\n                                                     const XML_Char *uri);\n\ntypedef void(XMLCALL *XML_EndNamespaceDeclHandler)(void *userData,\n                                                   const XML_Char *prefix);\n\n/* This is called if the document is not standalone, that is, it has an\n   external subset or a reference to a parameter entity, but does not\n   have standalone=\"yes\". If this handler returns XML_STATUS_ERROR,\n   then processing will not continue, and the parser will return a\n   XML_ERROR_NOT_STANDALONE error.\n   If parameter entity parsing is enabled, then in addition to the\n   conditions above this handler will only be called if the referenced\n   entity was actually read.\n*/\ntypedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData);\n\n/* This is called for a reference to an external parsed general\n   entity.  The referenced entity is not automatically parsed.  The\n   application can parse it immediately or later using\n   XML_ExternalEntityParserCreate.\n\n   The parser argument is the parser parsing the entity containing the\n   reference; it can be passed as the parser argument to\n   XML_ExternalEntityParserCreate.  The systemId argument is the\n   system identifier as specified in the entity declaration; it will\n   not be NULL.\n\n   The base argument is the system identifier that should be used as\n   the base for resolving systemId if systemId was relative; this is\n   set by XML_SetBase; it may be NULL.\n\n   The publicId argument is the public identifier as specified in the\n   entity declaration, or NULL if none was specified; the whitespace\n   in the public identifier will have been normalized as required by\n   the XML spec.\n\n   The context argument specifies the parsing context in the format\n   expected by the context argument to XML_ExternalEntityParserCreate;\n   context is valid only until the handler returns, so if the\n   referenced entity is to be parsed later, it must be copied.\n   context is NULL only when the entity is a parameter entity.\n\n   The handler should return XML_STATUS_ERROR if processing should not\n   continue because of a fatal error in the handling of the external\n   entity.  In this case the calling parser will return an\n   XML_ERROR_EXTERNAL_ENTITY_HANDLING error.\n\n   Note that unlike other handlers the first argument is the parser,\n   not userData.\n*/\ntypedef int(XMLCALL *XML_ExternalEntityRefHandler)(XML_Parser parser,\n                                                   const XML_Char *context,\n                                                   const XML_Char *base,\n                                                   const XML_Char *systemId,\n                                                   const XML_Char *publicId);\n\n/* This is called in two situations:\n   1) An entity reference is encountered for which no declaration\n      has been read *and* this is not an error.\n   2) An internal entity reference is read, but not expanded, because\n      XML_SetDefaultHandler has been called.\n   Note: skipped parameter entities in declarations and skipped general\n         entities in attribute values cannot be reported, because\n         the event would be out of sync with the reporting of the\n         declarations or attribute values\n*/\ntypedef void(XMLCALL *XML_SkippedEntityHandler)(void *userData,\n                                                const XML_Char *entityName,\n                                                int is_parameter_entity);\n\n/* This structure is filled in by the XML_UnknownEncodingHandler to\n   provide information to the parser about encodings that are unknown\n   to the parser.\n\n   The map[b] member gives information about byte sequences whose\n   first byte is b.\n\n   If map[b] is c where c is >= 0, then b by itself encodes the\n   Unicode scalar value c.\n\n   If map[b] is -1, then the byte sequence is malformed.\n\n   If map[b] is -n, where n >= 2, then b is the first byte of an\n   n-byte sequence that encodes a single Unicode scalar value.\n\n   The data member will be passed as the first argument to the convert\n   function.\n\n   The convert function is used to convert multibyte sequences; s will\n   point to a n-byte sequence where map[(unsigned char)*s] == -n.  The\n   convert function must return the Unicode scalar value represented\n   by this byte sequence or -1 if the byte sequence is malformed.\n\n   The convert function may be NULL if the encoding is a single-byte\n   encoding, that is if map[b] >= -1 for all bytes b.\n\n   When the parser is finished with the encoding, then if release is\n   not NULL, it will call release passing it the data member; once\n   release has been called, the convert function will not be called\n   again.\n\n   Expat places certain restrictions on the encodings that are supported\n   using this mechanism.\n\n   1. Every ASCII character that can appear in a well-formed XML document,\n      other than the characters\n\n      $@\\^`{}~\n\n      must be represented by a single byte, and that byte must be the\n      same byte that represents that character in ASCII.\n\n   2. No character may require more than 4 bytes to encode.\n\n   3. All characters encoded must have Unicode scalar values <=\n      0xFFFF, (i.e., characters that would be encoded by surrogates in\n      UTF-16 are  not allowed).  Note that this restriction doesn't\n      apply to the built-in support for UTF-8 and UTF-16.\n\n   4. No Unicode character may be encoded by more than one distinct\n      sequence of bytes.\n*/\ntypedef struct {\n  int map[256];\n  void *data;\n  int(XMLCALL *convert)(void *data, const char *s);\n  void(XMLCALL *release)(void *data);\n} XML_Encoding;\n\n/* This is called for an encoding that is unknown to the parser.\n\n   The encodingHandlerData argument is that which was passed as the\n   second argument to XML_SetUnknownEncodingHandler.\n\n   The name argument gives the name of the encoding as specified in\n   the encoding declaration.\n\n   If the callback can provide information about the encoding, it must\n   fill in the XML_Encoding structure, and return XML_STATUS_OK.\n   Otherwise it must return XML_STATUS_ERROR.\n\n   If info does not describe a suitable encoding, then the parser will\n   return an XML_UNKNOWN_ENCODING error.\n*/\ntypedef int(XMLCALL *XML_UnknownEncodingHandler)(void *encodingHandlerData,\n                                                 const XML_Char *name,\n                                                 XML_Encoding *info);\n\nXMLPARSEAPI(void)\nXML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start,\n                      XML_EndElementHandler end);\n\nXMLPARSEAPI(void)\nXML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetCharacterDataHandler(XML_Parser parser,\n                            XML_CharacterDataHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetProcessingInstructionHandler(XML_Parser parser,\n                                    XML_ProcessingInstructionHandler handler);\nXMLPARSEAPI(void)\nXML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetCdataSectionHandler(XML_Parser parser,\n                           XML_StartCdataSectionHandler start,\n                           XML_EndCdataSectionHandler end);\n\nXMLPARSEAPI(void)\nXML_SetStartCdataSectionHandler(XML_Parser parser,\n                                XML_StartCdataSectionHandler start);\n\nXMLPARSEAPI(void)\nXML_SetEndCdataSectionHandler(XML_Parser parser,\n                              XML_EndCdataSectionHandler end);\n\n/* This sets the default handler and also inhibits expansion of\n   internal entities. These entity references will be passed to the\n   default handler, or to the skipped entity handler, if one is set.\n*/\nXMLPARSEAPI(void)\nXML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler);\n\n/* This sets the default handler but does not inhibit expansion of\n   internal entities.  The entity reference will not be passed to the\n   default handler.\n*/\nXMLPARSEAPI(void)\nXML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start,\n                          XML_EndDoctypeDeclHandler end);\n\nXMLPARSEAPI(void)\nXML_SetStartDoctypeDeclHandler(XML_Parser parser,\n                               XML_StartDoctypeDeclHandler start);\n\nXMLPARSEAPI(void)\nXML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end);\n\nXMLPARSEAPI(void)\nXML_SetUnparsedEntityDeclHandler(XML_Parser parser,\n                                 XML_UnparsedEntityDeclHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetNamespaceDeclHandler(XML_Parser parser,\n                            XML_StartNamespaceDeclHandler start,\n                            XML_EndNamespaceDeclHandler end);\n\nXMLPARSEAPI(void)\nXML_SetStartNamespaceDeclHandler(XML_Parser parser,\n                                 XML_StartNamespaceDeclHandler start);\n\nXMLPARSEAPI(void)\nXML_SetEndNamespaceDeclHandler(XML_Parser parser,\n                               XML_EndNamespaceDeclHandler end);\n\nXMLPARSEAPI(void)\nXML_SetNotStandaloneHandler(XML_Parser parser,\n                            XML_NotStandaloneHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetExternalEntityRefHandler(XML_Parser parser,\n                                XML_ExternalEntityRefHandler handler);\n\n/* If a non-NULL value for arg is specified here, then it will be\n   passed as the first argument to the external entity ref handler\n   instead of the parser object.\n*/\nXMLPARSEAPI(void)\nXML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg);\n\nXMLPARSEAPI(void)\nXML_SetSkippedEntityHandler(XML_Parser parser,\n                            XML_SkippedEntityHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetUnknownEncodingHandler(XML_Parser parser,\n                              XML_UnknownEncodingHandler handler,\n                              void *encodingHandlerData);\n\n/* This can be called within a handler for a start element, end\n   element, processing instruction or character data.  It causes the\n   corresponding markup to be passed to the default handler.\n*/\nXMLPARSEAPI(void)\nXML_DefaultCurrent(XML_Parser parser);\n\n/* If do_nst is non-zero, and namespace processing is in effect, and\n   a name has a prefix (i.e. an explicit namespace qualifier) then\n   that name is returned as a triplet in a single string separated by\n   the separator character specified when the parser was created: URI\n   + sep + local_name + sep + prefix.\n\n   If do_nst is zero, then namespace information is returned in the\n   default manner (URI + sep + local_name) whether or not the name\n   has a prefix.\n\n   Note: Calling XML_SetReturnNSTriplet after XML_Parse or\n     XML_ParseBuffer has no effect.\n*/\n\nXMLPARSEAPI(void)\nXML_SetReturnNSTriplet(XML_Parser parser, int do_nst);\n\n/* This value is passed as the userData argument to callbacks. */\nXMLPARSEAPI(void)\nXML_SetUserData(XML_Parser parser, void *userData);\n\n/* Returns the last value set by XML_SetUserData or NULL. */\n#define XML_GetUserData(parser) (*(void **)(parser))\n\n/* This is equivalent to supplying an encoding argument to\n   XML_ParserCreate. On success XML_SetEncoding returns non-zero,\n   zero otherwise.\n   Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer\n     has no effect and returns XML_STATUS_ERROR.\n*/\nXMLPARSEAPI(enum XML_Status)\nXML_SetEncoding(XML_Parser parser, const XML_Char *encoding);\n\n/* If this function is called, then the parser will be passed as the\n   first argument to callbacks instead of userData.  The userData will\n   still be accessible using XML_GetUserData.\n*/\nXMLPARSEAPI(void)\nXML_UseParserAsHandlerArg(XML_Parser parser);\n\n/* If useDTD == XML_TRUE is passed to this function, then the parser\n   will assume that there is an external subset, even if none is\n   specified in the document. In such a case the parser will call the\n   externalEntityRefHandler with a value of NULL for the systemId\n   argument (the publicId and context arguments will be NULL as well).\n   Note: For the purpose of checking WFC: Entity Declared, passing\n     useDTD == XML_TRUE will make the parser behave as if the document\n     had a DTD with an external subset.\n   Note: If this function is called, then this must be done before\n     the first call to XML_Parse or XML_ParseBuffer, since it will\n     have no effect after that.  Returns\n     XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING.\n   Note: If the document does not have a DOCTYPE declaration at all,\n     then startDoctypeDeclHandler and endDoctypeDeclHandler will not\n     be called, despite an external subset being parsed.\n   Note: If XML_DTD is not defined when Expat is compiled, returns\n     XML_ERROR_FEATURE_REQUIRES_XML_DTD.\n   Note: If parser == NULL, returns XML_ERROR_INVALID_ARGUMENT.\n*/\nXMLPARSEAPI(enum XML_Error)\nXML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);\n\n/* Sets the base to be used for resolving relative URIs in system\n   identifiers in declarations.  Resolving relative identifiers is\n   left to the application: this value will be passed through as the\n   base argument to the XML_ExternalEntityRefHandler,\n   XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base\n   argument will be copied.  Returns XML_STATUS_ERROR if out of memory,\n   XML_STATUS_OK otherwise.\n*/\nXMLPARSEAPI(enum XML_Status)\nXML_SetBase(XML_Parser parser, const XML_Char *base);\n\nXMLPARSEAPI(const XML_Char *)\nXML_GetBase(XML_Parser parser);\n\n/* Returns the number of the attribute/value pairs passed in last call\n   to the XML_StartElementHandler that were specified in the start-tag\n   rather than defaulted. Each attribute/value pair counts as 2; thus\n   this correspondds to an index into the atts array passed to the\n   XML_StartElementHandler.  Returns -1 if parser == NULL.\n*/\nXMLPARSEAPI(int)\nXML_GetSpecifiedAttributeCount(XML_Parser parser);\n\n/* Returns the index of the ID attribute passed in the last call to\n   XML_StartElementHandler, or -1 if there is no ID attribute or\n   parser == NULL.  Each attribute/value pair counts as 2; thus this\n   correspondds to an index into the atts array passed to the\n   XML_StartElementHandler.\n*/\nXMLPARSEAPI(int)\nXML_GetIdAttributeIndex(XML_Parser parser);\n\n#ifdef XML_ATTR_INFO\n/* Source file byte offsets for the start and end of attribute names and values.\n   The value indices are exclusive of surrounding quotes; thus in a UTF-8 source\n   file an attribute value of \"blah\" will yield:\n   info->valueEnd - info->valueStart = 4 bytes.\n*/\ntypedef struct {\n  XML_Index nameStart;  /* Offset to beginning of the attribute name. */\n  XML_Index nameEnd;    /* Offset after the attribute name's last byte. */\n  XML_Index valueStart; /* Offset to beginning of the attribute value. */\n  XML_Index valueEnd;   /* Offset after the attribute value's last byte. */\n} XML_AttrInfo;\n\n/* Returns an array of XML_AttrInfo structures for the attribute/value pairs\n   passed in last call to the XML_StartElementHandler that were specified\n   in the start-tag rather than defaulted. Each attribute/value pair counts\n   as 1; thus the number of entries in the array is\n   XML_GetSpecifiedAttributeCount(parser) / 2.\n*/\nXMLPARSEAPI(const XML_AttrInfo *)\nXML_GetAttributeInfo(XML_Parser parser);\n#endif\n\n/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is\n   detected.  The last call to XML_Parse must have isFinal true; len\n   may be zero for this call (or any other).\n\n   Though the return values for these functions has always been\n   described as a Boolean value, the implementation, at least for the\n   1.95.x series, has always returned exactly one of the XML_Status\n   values.\n*/\nXMLPARSEAPI(enum XML_Status)\nXML_Parse(XML_Parser parser, const char *s, int len, int isFinal);\n\nXMLPARSEAPI(void *)\nXML_GetBuffer(XML_Parser parser, int len);\n\nXMLPARSEAPI(enum XML_Status)\nXML_ParseBuffer(XML_Parser parser, int len, int isFinal);\n\n/* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return.\n   Must be called from within a call-back handler, except when aborting\n   (resumable = 0) an already suspended parser. Some call-backs may\n   still follow because they would otherwise get lost. Examples:\n   - endElementHandler() for empty elements when stopped in\n     startElementHandler(),\n   - endNameSpaceDeclHandler() when stopped in endElementHandler(),\n   and possibly others.\n\n   Can be called from most handlers, including DTD related call-backs,\n   except when parsing an external parameter entity and resumable != 0.\n   Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise.\n   Possible error codes:\n   - XML_ERROR_SUSPENDED: when suspending an already suspended parser.\n   - XML_ERROR_FINISHED: when the parser has already finished.\n   - XML_ERROR_SUSPEND_PE: when suspending while parsing an external PE.\n\n   When resumable != 0 (true) then parsing is suspended, that is,\n   XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED.\n   Otherwise, parsing is aborted, that is, XML_Parse() and XML_ParseBuffer()\n   return XML_STATUS_ERROR with error code XML_ERROR_ABORTED.\n\n   *Note*:\n   This will be applied to the current parser instance only, that is, if\n   there is a parent parser then it will continue parsing when the\n   externalEntityRefHandler() returns. It is up to the implementation of\n   the externalEntityRefHandler() to call XML_StopParser() on the parent\n   parser (recursively), if one wants to stop parsing altogether.\n\n   When suspended, parsing can be resumed by calling XML_ResumeParser().\n*/\nXMLPARSEAPI(enum XML_Status)\nXML_StopParser(XML_Parser parser, XML_Bool resumable);\n\n/* Resumes parsing after it has been suspended with XML_StopParser().\n   Must not be called from within a handler call-back. Returns same\n   status codes as XML_Parse() or XML_ParseBuffer().\n   Additional error code XML_ERROR_NOT_SUSPENDED possible.\n\n   *Note*:\n   This must be called on the most deeply nested child parser instance\n   first, and on its parent parser only after the child parser has finished,\n   to be applied recursively until the document entity's parser is restarted.\n   That is, the parent parser will not resume by itself and it is up to the\n   application to call XML_ResumeParser() on it at the appropriate moment.\n*/\nXMLPARSEAPI(enum XML_Status)\nXML_ResumeParser(XML_Parser parser);\n\nenum XML_Parsing { XML_INITIALIZED, XML_PARSING, XML_FINISHED, XML_SUSPENDED };\n\ntypedef struct {\n  enum XML_Parsing parsing;\n  XML_Bool finalBuffer;\n} XML_ParsingStatus;\n\n/* Returns status of parser with respect to being initialized, parsing,\n   finished, or suspended and processing the final buffer.\n   XXX XML_Parse() and XML_ParseBuffer() should return XML_ParsingStatus,\n   XXX with XML_FINISHED_OK or XML_FINISHED_ERROR replacing XML_FINISHED\n*/\nXMLPARSEAPI(void)\nXML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status);\n\n/* Creates an XML_Parser object that can parse an external general\n   entity; context is a '\\0'-terminated string specifying the parse\n   context; encoding is a '\\0'-terminated string giving the name of\n   the externally specified encoding, or NULL if there is no\n   externally specified encoding.  The context string consists of a\n   sequence of tokens separated by formfeeds (\\f); a token consisting\n   of a name specifies that the general entity of the name is open; a\n   token of the form prefix=uri specifies the namespace for a\n   particular prefix; a token of the form =uri specifies the default\n   namespace.  This can be called at any point after the first call to\n   an ExternalEntityRefHandler so longer as the parser has not yet\n   been freed.  The new parser is completely independent and may\n   safely be used in a separate thread.  The handlers and userData are\n   initialized from the parser argument.  Returns NULL if out of memory.\n   Otherwise returns a new XML_Parser object.\n*/\nXMLPARSEAPI(XML_Parser)\nXML_ExternalEntityParserCreate(XML_Parser parser, const XML_Char *context,\n                               const XML_Char *encoding);\n\nenum XML_ParamEntityParsing {\n  XML_PARAM_ENTITY_PARSING_NEVER,\n  XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE,\n  XML_PARAM_ENTITY_PARSING_ALWAYS\n};\n\n/* Controls parsing of parameter entities (including the external DTD\n   subset). If parsing of parameter entities is enabled, then\n   references to external parameter entities (including the external\n   DTD subset) will be passed to the handler set with\n   XML_SetExternalEntityRefHandler.  The context passed will be 0.\n\n   Unlike external general entities, external parameter entities can\n   only be parsed synchronously.  If the external parameter entity is\n   to be parsed, it must be parsed during the call to the external\n   entity ref handler: the complete sequence of\n   XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and\n   XML_ParserFree calls must be made during this call.  After\n   XML_ExternalEntityParserCreate has been called to create the parser\n   for the external parameter entity (context must be 0 for this\n   call), it is illegal to make any calls on the old parser until\n   XML_ParserFree has been called on the newly created parser.\n   If the library has been compiled without support for parameter\n   entity parsing (ie without XML_DTD being defined), then\n   XML_SetParamEntityParsing will return 0 if parsing of parameter\n   entities is requested; otherwise it will return non-zero.\n   Note: If XML_SetParamEntityParsing is called after XML_Parse or\n      XML_ParseBuffer, then it has no effect and will always return 0.\n   Note: If parser == NULL, the function will do nothing and return 0.\n*/\nXMLPARSEAPI(int)\nXML_SetParamEntityParsing(XML_Parser parser,\n                          enum XML_ParamEntityParsing parsing);\n\n/* Sets the hash salt to use for internal hash calculations.\n   Helps in preventing DoS attacks based on predicting hash\n   function behavior. This must be called before parsing is started.\n   Returns 1 if successful, 0 when called after parsing has started.\n   Note: If parser == NULL, the function will do nothing and return 0.\n*/\nXMLPARSEAPI(int)\nXML_SetHashSalt(XML_Parser parser, unsigned long hash_salt);\n\n/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then\n   XML_GetErrorCode returns information about the error.\n*/\nXMLPARSEAPI(enum XML_Error)\nXML_GetErrorCode(XML_Parser parser);\n\n/* These functions return information about the current parse\n   location.  They may be called from any callback called to report\n   some parse event; in this case the location is the location of the\n   first of the sequence of characters that generated the event.  When\n   called from callbacks generated by declarations in the document\n   prologue, the location identified isn't as neatly defined, but will\n   be within the relevant markup.  When called outside of the callback\n   functions, the position indicated will be just past the last parse\n   event (regardless of whether there was an associated callback).\n\n   They may also be called after returning from a call to XML_Parse\n   or XML_ParseBuffer.  If the return value is XML_STATUS_ERROR then\n   the location is the location of the character at which the error\n   was detected; otherwise the location is the location of the last\n   parse event, as described above.\n\n   Note: XML_GetCurrentLineNumber and XML_GetCurrentColumnNumber\n   return 0 to indicate an error.\n   Note: XML_GetCurrentByteIndex returns -1 to indicate an error.\n*/\nXMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser);\nXMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser);\nXMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser);\n\n/* Return the number of bytes in the current event.\n   Returns 0 if the event is in an internal entity.\n*/\nXMLPARSEAPI(int)\nXML_GetCurrentByteCount(XML_Parser parser);\n\n/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets\n   the integer pointed to by offset to the offset within this buffer\n   of the current parse position, and sets the integer pointed to by size\n   to the size of this buffer (the number of input bytes). Otherwise\n   returns a NULL pointer. Also returns a NULL pointer if a parse isn't\n   active.\n\n   NOTE: The character pointer returned should not be used outside\n   the handler that makes the call.\n*/\nXMLPARSEAPI(const char *)\nXML_GetInputContext(XML_Parser parser, int *offset, int *size);\n\n/* For backwards compatibility with previous versions. */\n#define XML_GetErrorLineNumber XML_GetCurrentLineNumber\n#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber\n#define XML_GetErrorByteIndex XML_GetCurrentByteIndex\n\n/* Frees the content model passed to the element declaration handler */\nXMLPARSEAPI(void)\nXML_FreeContentModel(XML_Parser parser, XML_Content *model);\n\n/* Exposing the memory handling functions used in Expat */\nXMLPARSEAPI(void *)\nXML_ATTR_MALLOC\nXML_ATTR_ALLOC_SIZE(2)\nXML_MemMalloc(XML_Parser parser, size_t size);\n\nXMLPARSEAPI(void *)\nXML_ATTR_ALLOC_SIZE(3)\nXML_MemRealloc(XML_Parser parser, void *ptr, size_t size);\n\nXMLPARSEAPI(void)\nXML_MemFree(XML_Parser parser, void *ptr);\n\n/* Frees memory used by the parser. */\nXMLPARSEAPI(void)\nXML_ParserFree(XML_Parser parser);\n\n/* Returns a string describing the error. */\nXMLPARSEAPI(const XML_LChar *)\nXML_ErrorString(enum XML_Error code);\n\n/* Return a string containing the version number of this expat */\nXMLPARSEAPI(const XML_LChar *)\nXML_ExpatVersion(void);\n\ntypedef struct {\n  int major;\n  int minor;\n  int micro;\n} XML_Expat_Version;\n\n/* Return an XML_Expat_Version structure containing numeric version\n   number information for this version of expat.\n*/\nXMLPARSEAPI(XML_Expat_Version)\nXML_ExpatVersionInfo(void);\n\n/* Added in Expat 1.95.5. */\nenum XML_FeatureEnum {\n  XML_FEATURE_END = 0,\n  XML_FEATURE_UNICODE,\n  XML_FEATURE_UNICODE_WCHAR_T,\n  XML_FEATURE_DTD,\n  XML_FEATURE_CONTEXT_BYTES,\n  XML_FEATURE_MIN_SIZE,\n  XML_FEATURE_SIZEOF_XML_CHAR,\n  XML_FEATURE_SIZEOF_XML_LCHAR,\n  XML_FEATURE_NS,\n  XML_FEATURE_LARGE_SIZE,\n  XML_FEATURE_ATTR_INFO\n  /* Additional features must be added to the end of this enum. */\n};\n\ntypedef struct {\n  enum XML_FeatureEnum feature;\n  const XML_LChar *name;\n  long int value;\n} XML_Feature;\n\nXMLPARSEAPI(const XML_Feature *)\nXML_GetFeatureList(void);\n\n/* Expat follows the semantic versioning convention.\n   See http://semver.org.\n*/\n#define XML_MAJOR_VERSION 2\n#define XML_MINOR_VERSION 2\n#define XML_MICRO_VERSION 9\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* not Expat_INCLUDED */\n"},{"id":16541,"name":"Makefile.in","nodeType":"TextFile","path":"cextern/expat/lib","text":"# Makefile.in generated by automake 1.13.4 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994-2013 Free Software Foundation, Inc.\n\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n#\n#                          __  __            _\n#                       ___\\ \\/ /_ __   __ _| |_\n#                      / _ \\\\  /| '_ \\ / _` | __|\n#                     |  __//  \\| |_) | (_| | |_\n#                      \\___/_/\\_\\ .__/ \\__,_|\\__|\n#                               |_| XML parser\n#\n# Copyright (c) 2017 Expat development team\n# Licensed under the MIT license:\n#\n# Permission is  hereby granted,  free of charge,  to any  person obtaining\n# a  copy  of  this  software   and  associated  documentation  files  (the\n# \"Software\"),  to  deal in  the  Software  without restriction,  including\n# without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n# distribute, sublicense, and/or sell copies of the Software, and to permit\n# persons  to whom  the Software  is  furnished to  do so,  subject to  the\n# following conditions:\n#\n# The above copyright  notice and this permission notice  shall be included\n# in all copies or substantial portions of the Software.\n#\n# THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n# EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n# NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n# DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n# USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\nVPATH = @srcdir@\nam__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'\nam__make_running_with_option = \\\n  case $${target_option-} in \\\n      ?) ;; \\\n      *) echo \"am__make_running_with_option: internal error: invalid\" \\\n              \"target option '$${target_option-}' specified\" >&2; \\\n         exit 1;; \\\n  esac; \\\n  has_opt=no; \\\n  sane_makeflags=$$MAKEFLAGS; \\\n  if $(am__is_gnu_make); then \\\n    sane_makeflags=$$MFLAGS; \\\n  else \\\n    case $$MAKEFLAGS in \\\n      *\\\\[\\ \\\t]*) \\\n        bs=\\\\; \\\n        sane_makeflags=`printf '%s\\n' \"$$MAKEFLAGS\" \\\n          | sed \"s/$$bs$$bs[$$bs $$bs\t]*//g\"`;; \\\n    esac; \\\n  fi; \\\n  skip_next=no; \\\n  strip_trailopt () \\\n  { \\\n    flg=`printf '%s\\n' \"$$flg\" | sed \"s/$$1.*$$//\"`; \\\n  }; \\\n  for flg in $$sane_makeflags; do \\\n    test $$skip_next = yes && { skip_next=no; continue; }; \\\n    case $$flg in \\\n      *=*|--*) continue;; \\\n        -*I) strip_trailopt 'I'; skip_next=yes;; \\\n      -*I?*) strip_trailopt 'I';; \\\n        -*O) strip_trailopt 'O'; skip_next=yes;; \\\n      -*O?*) strip_trailopt 'O';; \\\n        -*l) strip_trailopt 'l'; skip_next=yes;; \\\n      -*l?*) strip_trailopt 'l';; \\\n      -[dEDm]) skip_next=yes;; \\\n      -[JT]) skip_next=yes;; \\\n    esac; \\\n    case $$flg in \\\n      *$$target_option*) has_opt=yes; break;; \\\n    esac; \\\n  done; \\\n  test $$has_opt = yes\nam__make_dryrun = (target_option=n; $(am__make_running_with_option))\nam__make_keepgoing = (target_option=k; $(am__make_running_with_option))\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\nsubdir = lib\nDIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \\\n\t$(top_srcdir)/conftools/depcomp $(include_HEADERS)\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \\\n\t$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \\\n\t$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \\\n\t$(top_srcdir)/acinclude.m4 \\\n\t$(top_srcdir)/conftools/ax-require-defined.m4 \\\n\t$(top_srcdir)/conftools/ax-check-compile-flag.m4 \\\n\t$(top_srcdir)/conftools/ax-check-link-flag.m4 \\\n\t$(top_srcdir)/conftools/ax-append-flag.m4 \\\n\t$(top_srcdir)/conftools/ax-append-compile-flags.m4 \\\n\t$(top_srcdir)/conftools/ax-append-link-flags.m4 \\\n\t$(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \\\n\t$(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(install_sh) -d\nCONFIG_HEADER = $(top_builddir)/expat_config.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nam__vpath_adj_setup = srcdirstrip=`echo \"$(srcdir)\" | sed 's|.|.|g'`;\nam__vpath_adj = case $$p in \\\n    $(srcdir)/*) f=`echo \"$$p\" | sed \"s|^$$srcdirstrip/||\"`;; \\\n    *) f=$$p;; \\\n  esac;\nam__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;\nam__install_max = 40\nam__nobase_strip_setup = \\\n  srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*|]/\\\\\\\\&/g'`\nam__nobase_strip = \\\n  for p in $$list; do echo \"$$p\"; done | sed -e \"s|$$srcdirstrip/||\"\nam__nobase_list = $(am__nobase_strip_setup); \\\n  for p in $$list; do echo \"$$p $$p\"; done | \\\n  sed \"s| $$srcdirstrip/| |;\"' / .*\\//!s/ .*/ ./; s,\\( .*\\)/[^/]*$$,\\1,' | \\\n  $(AWK) 'BEGIN { files[\".\"] = \"\" } { files[$$2] = files[$$2] \" \" $$1; \\\n    if (++n[$$2] == $(am__install_max)) \\\n      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = \"\" } } \\\n    END { for (dir in files) print dir, files[dir] }'\nam__base_list = \\\n  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\\n/ /g' | \\\n  sed '$$!N;$$!N;$$!N;$$!N;s/\\n/ /g'\nam__uninstall_files_from_dir = { \\\n  test -z \"$$files\" \\\n    || { test ! -d \"$$dir\" && test ! -f \"$$dir\" && test ! -r \"$$dir\"; } \\\n    || { echo \" ( cd '$$dir' && rm -f\" $$files \")\"; \\\n         $(am__cd) \"$$dir\" && rm -f $$files; }; \\\n  }\nam__installdirs = \"$(DESTDIR)$(libdir)\" \"$(DESTDIR)$(docdir)\" \\\n\t\"$(DESTDIR)$(includedir)\"\nLTLIBRARIES = $(lib_LTLIBRARIES)\nlibexpat_la_LIBADD =\nam_libexpat_la_OBJECTS = xmlparse.lo xmltok.lo xmlrole.lo\nlibexpat_la_OBJECTS = $(am_libexpat_la_OBJECTS)\nAM_V_lt = $(am__v_lt_@AM_V@)\nam__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)\nam__v_lt_0 = --silent\nam__v_lt_1 = \nlibexpat_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \\\n\t$(libexpat_la_LDFLAGS) $(LDFLAGS) -o $@\nAM_V_P = $(am__v_P_@AM_V@)\nam__v_P_ = $(am__v_P_@AM_DEFAULT_V@)\nam__v_P_0 = false\nam__v_P_1 = :\nAM_V_GEN = $(am__v_GEN_@AM_V@)\nam__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)\nam__v_GEN_0 = @echo \"  GEN     \" $@;\nam__v_GEN_1 = \nAM_V_at = $(am__v_at_@AM_V@)\nam__v_at_ = $(am__v_at_@AM_DEFAULT_V@)\nam__v_at_0 = @\nam__v_at_1 = \nDEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)\ndepcomp = $(SHELL) $(top_srcdir)/conftools/depcomp\nam__depfiles_maybe = depfiles\nam__mv = mv -f\nCOMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \\\n\t$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)\nLTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \\\n\t$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \\\n\t$(AM_CFLAGS) $(CFLAGS)\nAM_V_CC = $(am__v_CC_@AM_V@)\nam__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)\nam__v_CC_0 = @echo \"  CC      \" $@;\nam__v_CC_1 = \nCCLD = $(CC)\nLINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \\\n\t$(AM_LDFLAGS) $(LDFLAGS) -o $@\nAM_V_CCLD = $(am__v_CCLD_@AM_V@)\nam__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)\nam__v_CCLD_0 = @echo \"  CCLD    \" $@;\nam__v_CCLD_1 = \nSOURCES = $(libexpat_la_SOURCES)\nDIST_SOURCES = $(libexpat_la_SOURCES)\nam__can_run_installinfo = \\\n  case $$AM_UPDATE_INFO_DIR in \\\n    n|no|NO) false;; \\\n    *) (install-info --version) >/dev/null 2>&1;; \\\n  esac\nDATA = $(doc_DATA)\nHEADERS = $(include_HEADERS)\nam__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)\n# Read a list of newline-separated strings from the standard input,\n# and print each of them once, without duplicates.  Input order is\n# *not* preserved.\nam__uniquify_input = $(AWK) '\\\n  BEGIN { nonempty = 0; } \\\n  { items[$$0] = 1; nonempty = 1; } \\\n  END { if (nonempty) { for (i in items) print i; }; } \\\n'\n# Make sure the list of sources is unique.  This is necessary because,\n# e.g., the same source file might be shared among _SOURCES variables\n# for different programs/libraries.\nam__define_uniq_tagged_files = \\\n  list='$(am__tagged_files)'; \\\n  unique=`for i in $$list; do \\\n    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n  done | $(am__uniquify_input)`\nETAGS = etags\nCTAGS = ctags\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nFILEMAP = @FILEMAP@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBAGE = @LIBAGE@\nLIBCURRENT = @LIBCURRENT@\nLIBOBJS = @LIBOBJS@\nLIBREVISION = @LIBREVISION@\nLIBS = @LIBS@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nLT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@\nMAKEINFO = @MAKEINFO@\nMANIFEST_TOOL = @MANIFEST_TOOL@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_AR = @ac_ct_AR@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget_alias = @target_alias@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\ninclude_HEADERS = \\\n    ../expat_config.h \\\n    expat.h \\\n    expat_external.h\n\nlib_LTLIBRARIES = libexpat.la\nlibexpat_la_LDFLAGS = \\\n    -no-undefined \\\n    -version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@\n\nlibexpat_la_SOURCES = \\\n    xmlparse.c \\\n    xmltok.c \\\n    xmlrole.c\n\ndoc_DATA = \\\n    ../AUTHORS \\\n    ../Changes\n\nEXTRA_DIST = \\\n    ascii.h \\\n    asciitab.h \\\n    expat_external.h \\\n    expat.h \\\n    iasciitab.h \\\n    internal.h \\\n    latin1tab.h \\\n    libexpat.def \\\n    libexpatw.def \\\n    nametab.h \\\n    siphash.h \\\n    utf8tab.h \\\n    winconfig.h \\\n    xmlrole.h \\\n    xmltok.h \\\n    xmltok_impl.c \\\n    xmltok_impl.h \\\n    xmltok_ns.c\n\nall: all-am\n\n.SUFFIXES:\n.SUFFIXES: .c .lo .o .obj\n$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --gnu lib/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure:  $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4):  $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\ninstall-libLTLIBRARIES: $(lib_LTLIBRARIES)\n\t@$(NORMAL_INSTALL)\n\t@list='$(lib_LTLIBRARIES)'; test -n \"$(libdir)\" || list=; \\\n\tlist2=; for p in $$list; do \\\n\t  if test -f $$p; then \\\n\t    list2=\"$$list2 $$p\"; \\\n\t  else :; fi; \\\n\tdone; \\\n\ttest -z \"$$list2\" || { \\\n\t  echo \" $(MKDIR_P) '$(DESTDIR)$(libdir)'\"; \\\n\t  $(MKDIR_P) \"$(DESTDIR)$(libdir)\" || exit 1; \\\n\t  echo \" $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'\"; \\\n\t  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 \"$(DESTDIR)$(libdir)\"; \\\n\t}\n\nuninstall-libLTLIBRARIES:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(lib_LTLIBRARIES)'; test -n \"$(libdir)\" || list=; \\\n\tfor p in $$list; do \\\n\t  $(am__strip_dir) \\\n\t  echo \" $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'\"; \\\n\t  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f \"$(DESTDIR)$(libdir)/$$f\"; \\\n\tdone\n\nclean-libLTLIBRARIES:\n\t-test -z \"$(lib_LTLIBRARIES)\" || rm -f $(lib_LTLIBRARIES)\n\t@list='$(lib_LTLIBRARIES)'; \\\n\tlocs=`for p in $$list; do echo $$p; done | \\\n\t      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \\\n\t      sort -u`; \\\n\ttest -z \"$$locs\" || { \\\n\t  echo rm -f $${locs}; \\\n\t  rm -f $${locs}; \\\n\t}\n\nlibexpat.la: $(libexpat_la_OBJECTS) $(libexpat_la_DEPENDENCIES) $(EXTRA_libexpat_la_DEPENDENCIES) \n\t$(AM_V_CCLD)$(libexpat_la_LINK) -rpath $(libdir) $(libexpat_la_OBJECTS) $(libexpat_la_LIBADD) $(LIBS)\n\nmostlyclean-compile:\n\t-rm -f *.$(OBJEXT)\n\ndistclean-compile:\n\t-rm -f *.tab.c\n\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlparse.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlrole.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmltok.Plo@am__quote@\n\n.c.o:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\t$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(AM_V_CC@am__nodep@)$(COMPILE) -c $<\n\n.c.obj:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\t$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`\n\n.c.lo:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\t$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\ninstall-docDATA: $(doc_DATA)\n\t@$(NORMAL_INSTALL)\n\t@list='$(doc_DATA)'; test -n \"$(docdir)\" || list=; \\\n\tif test -n \"$$list\"; then \\\n\t  echo \" $(MKDIR_P) '$(DESTDIR)$(docdir)'\"; \\\n\t  $(MKDIR_P) \"$(DESTDIR)$(docdir)\" || exit 1; \\\n\tfi; \\\n\tfor p in $$list; do \\\n\t  if test -f \"$$p\"; then d=; else d=\"$(srcdir)/\"; fi; \\\n\t  echo \"$$d$$p\"; \\\n\tdone | $(am__base_list) | \\\n\twhile read files; do \\\n\t  echo \" $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'\"; \\\n\t  $(INSTALL_DATA) $$files \"$(DESTDIR)$(docdir)\" || exit $$?; \\\n\tdone\n\nuninstall-docDATA:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(doc_DATA)'; test -n \"$(docdir)\" || list=; \\\n\tfiles=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \\\n\tdir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir)\ninstall-includeHEADERS: $(include_HEADERS)\n\t@$(NORMAL_INSTALL)\n\t@list='$(include_HEADERS)'; test -n \"$(includedir)\" || list=; \\\n\tif test -n \"$$list\"; then \\\n\t  echo \" $(MKDIR_P) '$(DESTDIR)$(includedir)'\"; \\\n\t  $(MKDIR_P) \"$(DESTDIR)$(includedir)\" || exit 1; \\\n\tfi; \\\n\tfor p in $$list; do \\\n\t  if test -f \"$$p\"; then d=; else d=\"$(srcdir)/\"; fi; \\\n\t  echo \"$$d$$p\"; \\\n\tdone | $(am__base_list) | \\\n\twhile read files; do \\\n\t  echo \" $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'\"; \\\n\t  $(INSTALL_HEADER) $$files \"$(DESTDIR)$(includedir)\" || exit $$?; \\\n\tdone\n\nuninstall-includeHEADERS:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(include_HEADERS)'; test -n \"$(includedir)\" || list=; \\\n\tfiles=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \\\n\tdir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)\n\nID: $(am__tagged_files)\n\t$(am__define_uniq_tagged_files); mkid -fID $$unique\ntags: tags-am\nTAGS: tags\n\ntags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)\n\tset x; \\\n\there=`pwd`; \\\n\t$(am__define_uniq_tagged_files); \\\n\tshift; \\\n\tif test -z \"$(ETAGS_ARGS)$$*$$unique\"; then :; else \\\n\t  test -n \"$$unique\" || unique=$$empty_fix; \\\n\t  if test $$# -gt 0; then \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      \"$$@\" $$unique; \\\n\t  else \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      $$unique; \\\n\t  fi; \\\n\tfi\nctags: ctags-am\n\nCTAGS: ctags\nctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)\n\t$(am__define_uniq_tagged_files); \\\n\ttest -z \"$(CTAGS_ARGS)$$unique\" \\\n\t  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \\\n\t     $$unique\n\nGTAGS:\n\there=`$(am__cd) $(top_builddir) && pwd` \\\n\t  && $(am__cd) $(top_srcdir) \\\n\t  && gtags -i $(GTAGS_ARGS) \"$$here\"\ncscopelist: cscopelist-am\n\ncscopelist-am: $(am__tagged_files)\n\tlist='$(am__tagged_files)'; \\\n\tcase \"$(srcdir)\" in \\\n\t  [\\\\/]* | ?:[\\\\/]*) sdir=\"$(srcdir)\" ;; \\\n\t  *) sdir=$(subdir)/$(srcdir) ;; \\\n\tesac; \\\n\tfor i in $$list; do \\\n\t  if test -f \"$$i\"; then \\\n\t    echo \"$(subdir)/$$i\"; \\\n\t  else \\\n\t    echo \"$$sdir/$$i\"; \\\n\t  fi; \\\n\tdone >> $(top_builddir)/cscope.files\n\ndistclean-tags:\n\t-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS)\ninstalldirs:\n\tfor dir in \"$(DESTDIR)$(libdir)\" \"$(DESTDIR)$(docdir)\" \"$(DESTDIR)$(includedir)\"; do \\\n\t  test -z \"$$dir\" || $(MKDIR_P) \"$$dir\"; \\\n\tdone\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\tif test -z '$(STRIP)'; then \\\n\t  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t    install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t      install; \\\n\telse \\\n\t  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t    install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t    \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\" install; \\\n\tfi\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libLTLIBRARIES clean-libtool \\\n\tmostlyclean-am\n\ndistclean: distclean-am\n\t-rm -rf ./$(DEPDIR)\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-compile distclean-generic \\\n\tdistclean-tags\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am: install-docDATA install-includeHEADERS\n\t@$(NORMAL_INSTALL)\n\t$(MAKE) $(AM_MAKEFLAGS) install-data-hook\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am: install-libLTLIBRARIES\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -rf ./$(DEPDIR)\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-compile mostlyclean-generic \\\n\tmostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am: uninstall-docDATA uninstall-includeHEADERS \\\n\tuninstall-libLTLIBRARIES uninstall-local\n\n.MAKE: install-am install-data-am install-strip\n\n.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \\\n\tclean-libLTLIBRARIES clean-libtool cscopelist-am ctags \\\n\tctags-am distclean distclean-compile distclean-generic \\\n\tdistclean-libtool distclean-tags distdir dvi dvi-am html \\\n\thtml-am info info-am install install-am install-data \\\n\tinstall-data-am install-data-hook install-docDATA install-dvi \\\n\tinstall-dvi-am install-exec install-exec-am install-html \\\n\tinstall-html-am install-includeHEADERS install-info \\\n\tinstall-info-am install-libLTLIBRARIES install-man install-pdf \\\n\tinstall-pdf-am install-ps install-ps-am install-strip \\\n\tinstallcheck installcheck-am installdirs maintainer-clean \\\n\tmaintainer-clean-generic mostlyclean mostlyclean-compile \\\n\tmostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \\\n\ttags tags-am uninstall uninstall-am uninstall-docDATA \\\n\tuninstall-includeHEADERS uninstall-libLTLIBRARIES \\\n\tuninstall-local\n\n\ninstall-data-hook:\n\tcd \"$(DESTDIR)$(docdir)\" && $(am__mv) Changes changelog\n\nuninstall-local:\n\t$(RM) \"$(DESTDIR)$(docdir)/changelog\"\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"},{"id":16542,"name":"xmltok.c","nodeType":"TextFile","path":"cextern/expat/lib","text":"/*\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#include <stddef.h>\n#include <string.h> /* memcpy */\n\n#if defined(_MSC_VER) && (_MSC_VER <= 1700)\n/* for vs2012/11.0/1700 and earlier Visual Studio compilers */\n#  define bool int\n#  define false 0\n#  define true 1\n#else\n#  include <stdbool.h>\n#endif\n\n#ifdef _WIN32\n#  include \"winconfig.h\"\n#else\n#  ifdef HAVE_EXPAT_CONFIG_H\n#    include <expat_config.h>\n#  endif\n#endif /* ndef _WIN32 */\n\n#include \"expat_external.h\"\n#include \"internal.h\"\n#include \"xmltok.h\"\n#include \"nametab.h\"\n\n#ifdef XML_DTD\n#  define IGNORE_SECTION_TOK_VTABLE , PREFIX(ignoreSectionTok)\n#else\n#  define IGNORE_SECTION_TOK_VTABLE /* as nothing */\n#endif\n\n#define VTABLE1                                                                \\\n  {PREFIX(prologTok), PREFIX(contentTok),                                      \\\n   PREFIX(cdataSectionTok) IGNORE_SECTION_TOK_VTABLE},                         \\\n      {PREFIX(attributeValueTok), PREFIX(entityValueTok)},                     \\\n      PREFIX(nameMatchesAscii), PREFIX(nameLength), PREFIX(skipS),             \\\n      PREFIX(getAtts), PREFIX(charRefNumber), PREFIX(predefinedEntityName),    \\\n      PREFIX(updatePosition), PREFIX(isPublicId)\n\n#define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16)\n\n#define UCS2_GET_NAMING(pages, hi, lo)                                         \\\n  (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1u << ((lo)&0x1F)))\n\n/* A 2 byte UTF-8 representation splits the characters 11 bits between\n   the bottom 5 and 6 bits of the bytes.  We need 8 bits to index into\n   pages, 3 bits to add to that index and 5 bits to generate the mask.\n*/\n#define UTF8_GET_NAMING2(pages, byte)                                          \\\n  (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3)                         \\\n                + ((((byte)[0]) & 3) << 1) + ((((byte)[1]) >> 5) & 1)]         \\\n   & (1u << (((byte)[1]) & 0x1F)))\n\n/* A 3 byte UTF-8 representation splits the characters 16 bits between\n   the bottom 4, 6 and 6 bits of the bytes.  We need 8 bits to index\n   into pages, 3 bits to add to that index and 5 bits to generate the\n   mask.\n*/\n#define UTF8_GET_NAMING3(pages, byte)                                          \\\n  (namingBitmap                                                                \\\n       [((pages)[((((byte)[0]) & 0xF) << 4) + ((((byte)[1]) >> 2) & 0xF)]      \\\n         << 3)                                                                 \\\n        + ((((byte)[1]) & 3) << 1) + ((((byte)[2]) >> 5) & 1)]                 \\\n   & (1u << (((byte)[2]) & 0x1F)))\n\n#define UTF8_GET_NAMING(pages, p, n)                                           \\\n  ((n) == 2                                                                    \\\n       ? UTF8_GET_NAMING2(pages, (const unsigned char *)(p))                   \\\n       : ((n) == 3 ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) : 0))\n\n/* Detection of invalid UTF-8 sequences is based on Table 3.1B\n   of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/\n   with the additional restriction of not allowing the Unicode\n   code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE).\n   Implementation details:\n     (A & 0x80) == 0     means A < 0x80\n   and\n     (A & 0xC0) == 0xC0  means A > 0xBF\n*/\n\n#define UTF8_INVALID2(p)                                                       \\\n  ((*p) < 0xC2 || ((p)[1] & 0x80) == 0 || ((p)[1] & 0xC0) == 0xC0)\n\n#define UTF8_INVALID3(p)                                                       \\\n  (((p)[2] & 0x80) == 0                                                        \\\n   || ((*p) == 0xEF && (p)[1] == 0xBF ? (p)[2] > 0xBD                          \\\n                                      : ((p)[2] & 0xC0) == 0xC0)               \\\n   || ((*p) == 0xE0                                                            \\\n           ? (p)[1] < 0xA0 || ((p)[1] & 0xC0) == 0xC0                          \\\n           : ((p)[1] & 0x80) == 0                                              \\\n                 || ((*p) == 0xED ? (p)[1] > 0x9F : ((p)[1] & 0xC0) == 0xC0)))\n\n#define UTF8_INVALID4(p)                                                       \\\n  (((p)[3] & 0x80) == 0 || ((p)[3] & 0xC0) == 0xC0 || ((p)[2] & 0x80) == 0     \\\n   || ((p)[2] & 0xC0) == 0xC0                                                  \\\n   || ((*p) == 0xF0                                                            \\\n           ? (p)[1] < 0x90 || ((p)[1] & 0xC0) == 0xC0                          \\\n           : ((p)[1] & 0x80) == 0                                              \\\n                 || ((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0)))\n\nstatic int PTRFASTCALL\nisNever(const ENCODING *enc, const char *p) {\n  UNUSED_P(enc);\n  UNUSED_P(p);\n  return 0;\n}\n\nstatic int PTRFASTCALL\nutf8_isName2(const ENCODING *enc, const char *p) {\n  UNUSED_P(enc);\n  return UTF8_GET_NAMING2(namePages, (const unsigned char *)p);\n}\n\nstatic int PTRFASTCALL\nutf8_isName3(const ENCODING *enc, const char *p) {\n  UNUSED_P(enc);\n  return UTF8_GET_NAMING3(namePages, (const unsigned char *)p);\n}\n\n#define utf8_isName4 isNever\n\nstatic int PTRFASTCALL\nutf8_isNmstrt2(const ENCODING *enc, const char *p) {\n  UNUSED_P(enc);\n  return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p);\n}\n\nstatic int PTRFASTCALL\nutf8_isNmstrt3(const ENCODING *enc, const char *p) {\n  UNUSED_P(enc);\n  return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p);\n}\n\n#define utf8_isNmstrt4 isNever\n\nstatic int PTRFASTCALL\nutf8_isInvalid2(const ENCODING *enc, const char *p) {\n  UNUSED_P(enc);\n  return UTF8_INVALID2((const unsigned char *)p);\n}\n\nstatic int PTRFASTCALL\nutf8_isInvalid3(const ENCODING *enc, const char *p) {\n  UNUSED_P(enc);\n  return UTF8_INVALID3((const unsigned char *)p);\n}\n\nstatic int PTRFASTCALL\nutf8_isInvalid4(const ENCODING *enc, const char *p) {\n  UNUSED_P(enc);\n  return UTF8_INVALID4((const unsigned char *)p);\n}\n\nstruct normal_encoding {\n  ENCODING enc;\n  unsigned char type[256];\n#ifdef XML_MIN_SIZE\n  int(PTRFASTCALL *byteType)(const ENCODING *, const char *);\n  int(PTRFASTCALL *isNameMin)(const ENCODING *, const char *);\n  int(PTRFASTCALL *isNmstrtMin)(const ENCODING *, const char *);\n  int(PTRFASTCALL *byteToAscii)(const ENCODING *, const char *);\n  int(PTRCALL *charMatches)(const ENCODING *, const char *, int);\n#endif /* XML_MIN_SIZE */\n  int(PTRFASTCALL *isName2)(const ENCODING *, const char *);\n  int(PTRFASTCALL *isName3)(const ENCODING *, const char *);\n  int(PTRFASTCALL *isName4)(const ENCODING *, const char *);\n  int(PTRFASTCALL *isNmstrt2)(const ENCODING *, const char *);\n  int(PTRFASTCALL *isNmstrt3)(const ENCODING *, const char *);\n  int(PTRFASTCALL *isNmstrt4)(const ENCODING *, const char *);\n  int(PTRFASTCALL *isInvalid2)(const ENCODING *, const char *);\n  int(PTRFASTCALL *isInvalid3)(const ENCODING *, const char *);\n  int(PTRFASTCALL *isInvalid4)(const ENCODING *, const char *);\n};\n\n#define AS_NORMAL_ENCODING(enc) ((const struct normal_encoding *)(enc))\n\n#ifdef XML_MIN_SIZE\n\n#  define STANDARD_VTABLE(E)                                                   \\\n    E##byteType, E##isNameMin, E##isNmstrtMin, E##byteToAscii, E##charMatches,\n\n#else\n\n#  define STANDARD_VTABLE(E) /* as nothing */\n\n#endif\n\n#define NORMAL_VTABLE(E)                                                       \\\n  E##isName2, E##isName3, E##isName4, E##isNmstrt2, E##isNmstrt3,              \\\n      E##isNmstrt4, E##isInvalid2, E##isInvalid3, E##isInvalid4\n\n#define NULL_VTABLE                                                            \\\n  /* isName2 */ NULL, /* isName3 */ NULL, /* isName4 */ NULL,                  \\\n      /* isNmstrt2 */ NULL, /* isNmstrt3 */ NULL, /* isNmstrt4 */ NULL,        \\\n      /* isInvalid2 */ NULL, /* isInvalid3 */ NULL, /* isInvalid4 */ NULL\n\nstatic int FASTCALL checkCharRefNumber(int);\n\n#include \"xmltok_impl.h\"\n#include \"ascii.h\"\n\n#ifdef XML_MIN_SIZE\n#  define sb_isNameMin isNever\n#  define sb_isNmstrtMin isNever\n#endif\n\n#ifdef XML_MIN_SIZE\n#  define MINBPC(enc) ((enc)->minBytesPerChar)\n#else\n/* minimum bytes per character */\n#  define MINBPC(enc) 1\n#endif\n\n#define SB_BYTE_TYPE(enc, p)                                                   \\\n  (((struct normal_encoding *)(enc))->type[(unsigned char)*(p)])\n\n#ifdef XML_MIN_SIZE\nstatic int PTRFASTCALL\nsb_byteType(const ENCODING *enc, const char *p) {\n  return SB_BYTE_TYPE(enc, p);\n}\n#  define BYTE_TYPE(enc, p) (AS_NORMAL_ENCODING(enc)->byteType(enc, p))\n#else\n#  define BYTE_TYPE(enc, p) SB_BYTE_TYPE(enc, p)\n#endif\n\n#ifdef XML_MIN_SIZE\n#  define BYTE_TO_ASCII(enc, p) (AS_NORMAL_ENCODING(enc)->byteToAscii(enc, p))\nstatic int PTRFASTCALL\nsb_byteToAscii(const ENCODING *enc, const char *p) {\n  UNUSED_P(enc);\n  return *p;\n}\n#else\n#  define BYTE_TO_ASCII(enc, p) (*(p))\n#endif\n\n#define IS_NAME_CHAR(enc, p, n) (AS_NORMAL_ENCODING(enc)->isName##n(enc, p))\n#define IS_NMSTRT_CHAR(enc, p, n) (AS_NORMAL_ENCODING(enc)->isNmstrt##n(enc, p))\n#define IS_INVALID_CHAR(enc, p, n)                                             \\\n  (AS_NORMAL_ENCODING(enc)->isInvalid##n(enc, p))\n\n#ifdef XML_MIN_SIZE\n#  define IS_NAME_CHAR_MINBPC(enc, p)                                          \\\n    (AS_NORMAL_ENCODING(enc)->isNameMin(enc, p))\n#  define IS_NMSTRT_CHAR_MINBPC(enc, p)                                        \\\n    (AS_NORMAL_ENCODING(enc)->isNmstrtMin(enc, p))\n#else\n#  define IS_NAME_CHAR_MINBPC(enc, p) (0)\n#  define IS_NMSTRT_CHAR_MINBPC(enc, p) (0)\n#endif\n\n#ifdef XML_MIN_SIZE\n#  define CHAR_MATCHES(enc, p, c)                                              \\\n    (AS_NORMAL_ENCODING(enc)->charMatches(enc, p, c))\nstatic int PTRCALL\nsb_charMatches(const ENCODING *enc, const char *p, int c) {\n  UNUSED_P(enc);\n  return *p == c;\n}\n#else\n/* c is an ASCII character */\n#  define CHAR_MATCHES(enc, p, c) (*(p) == c)\n#endif\n\n#define PREFIX(ident) normal_##ident\n#define XML_TOK_IMPL_C\n#include \"xmltok_impl.c\"\n#undef XML_TOK_IMPL_C\n\n#undef MINBPC\n#undef BYTE_TYPE\n#undef BYTE_TO_ASCII\n#undef CHAR_MATCHES\n#undef IS_NAME_CHAR\n#undef IS_NAME_CHAR_MINBPC\n#undef IS_NMSTRT_CHAR\n#undef IS_NMSTRT_CHAR_MINBPC\n#undef IS_INVALID_CHAR\n\nenum { /* UTF8_cvalN is value of masked first byte of N byte sequence */\n       UTF8_cval1 = 0x00,\n       UTF8_cval2 = 0xc0,\n       UTF8_cval3 = 0xe0,\n       UTF8_cval4 = 0xf0\n};\n\nvoid\n_INTERNAL_trim_to_complete_utf8_characters(const char *from,\n                                           const char **fromLimRef) {\n  const char *fromLim = *fromLimRef;\n  size_t walked = 0;\n  for (; fromLim > from; fromLim--, walked++) {\n    const unsigned char prev = (unsigned char)fromLim[-1];\n    if ((prev & 0xf8u)\n        == 0xf0u) { /* 4-byte character, lead by 0b11110xxx byte */\n      if (walked + 1 >= 4) {\n        fromLim += 4 - 1;\n        break;\n      } else {\n        walked = 0;\n      }\n    } else if ((prev & 0xf0u)\n               == 0xe0u) { /* 3-byte character, lead by 0b1110xxxx byte */\n      if (walked + 1 >= 3) {\n        fromLim += 3 - 1;\n        break;\n      } else {\n        walked = 0;\n      }\n    } else if ((prev & 0xe0u)\n               == 0xc0u) { /* 2-byte character, lead by 0b110xxxxx byte */\n      if (walked + 1 >= 2) {\n        fromLim += 2 - 1;\n        break;\n      } else {\n        walked = 0;\n      }\n    } else if ((prev & 0x80u)\n               == 0x00u) { /* 1-byte character, matching 0b0xxxxxxx */\n      break;\n    }\n  }\n  *fromLimRef = fromLim;\n}\n\nstatic enum XML_Convert_Result PTRCALL\nutf8_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,\n            char **toP, const char *toLim) {\n  bool input_incomplete = false;\n  bool output_exhausted = false;\n\n  /* Avoid copying partial characters (due to limited space). */\n  const ptrdiff_t bytesAvailable = fromLim - *fromP;\n  const ptrdiff_t bytesStorable = toLim - *toP;\n  UNUSED_P(enc);\n  if (bytesAvailable > bytesStorable) {\n    fromLim = *fromP + bytesStorable;\n    output_exhausted = true;\n  }\n\n  /* Avoid copying partial characters (from incomplete input). */\n  {\n    const char *const fromLimBefore = fromLim;\n    _INTERNAL_trim_to_complete_utf8_characters(*fromP, &fromLim);\n    if (fromLim < fromLimBefore) {\n      input_incomplete = true;\n    }\n  }\n\n  {\n    const ptrdiff_t bytesToCopy = fromLim - *fromP;\n    memcpy(*toP, *fromP, bytesToCopy);\n    *fromP += bytesToCopy;\n    *toP += bytesToCopy;\n  }\n\n  if (output_exhausted) /* needs to go first */\n    return XML_CONVERT_OUTPUT_EXHAUSTED;\n  else if (input_incomplete)\n    return XML_CONVERT_INPUT_INCOMPLETE;\n  else\n    return XML_CONVERT_COMPLETED;\n}\n\nstatic enum XML_Convert_Result PTRCALL\nutf8_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim,\n             unsigned short **toP, const unsigned short *toLim) {\n  enum XML_Convert_Result res = XML_CONVERT_COMPLETED;\n  unsigned short *to = *toP;\n  const char *from = *fromP;\n  while (from < fromLim && to < toLim) {\n    switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) {\n    case BT_LEAD2:\n      if (fromLim - from < 2) {\n        res = XML_CONVERT_INPUT_INCOMPLETE;\n        goto after;\n      }\n      *to++ = (unsigned short)(((from[0] & 0x1f) << 6) | (from[1] & 0x3f));\n      from += 2;\n      break;\n    case BT_LEAD3:\n      if (fromLim - from < 3) {\n        res = XML_CONVERT_INPUT_INCOMPLETE;\n        goto after;\n      }\n      *to++ = (unsigned short)(((from[0] & 0xf) << 12) | ((from[1] & 0x3f) << 6)\n                               | (from[2] & 0x3f));\n      from += 3;\n      break;\n    case BT_LEAD4: {\n      unsigned long n;\n      if (toLim - to < 2) {\n        res = XML_CONVERT_OUTPUT_EXHAUSTED;\n        goto after;\n      }\n      if (fromLim - from < 4) {\n        res = XML_CONVERT_INPUT_INCOMPLETE;\n        goto after;\n      }\n      n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12)\n          | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f);\n      n -= 0x10000;\n      to[0] = (unsigned short)((n >> 10) | 0xD800);\n      to[1] = (unsigned short)((n & 0x3FF) | 0xDC00);\n      to += 2;\n      from += 4;\n    } break;\n    default:\n      *to++ = *from++;\n      break;\n    }\n  }\n  if (from < fromLim)\n    res = XML_CONVERT_OUTPUT_EXHAUSTED;\nafter:\n  *fromP = from;\n  *toP = to;\n  return res;\n}\n\n#ifdef XML_NS\nstatic const struct normal_encoding utf8_encoding_ns\n    = {{VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0},\n       {\n#  include \"asciitab.h\"\n#  include \"utf8tab.h\"\n       },\n       STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)};\n#endif\n\nstatic const struct normal_encoding utf8_encoding\n    = {{VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0},\n       {\n#define BT_COLON BT_NMSTRT\n#include \"asciitab.h\"\n#undef BT_COLON\n#include \"utf8tab.h\"\n       },\n       STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)};\n\n#ifdef XML_NS\n\nstatic const struct normal_encoding internal_utf8_encoding_ns\n    = {{VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0},\n       {\n#  include \"iasciitab.h\"\n#  include \"utf8tab.h\"\n       },\n       STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)};\n\n#endif\n\nstatic const struct normal_encoding internal_utf8_encoding\n    = {{VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0},\n       {\n#define BT_COLON BT_NMSTRT\n#include \"iasciitab.h\"\n#undef BT_COLON\n#include \"utf8tab.h\"\n       },\n       STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)};\n\nstatic enum XML_Convert_Result PTRCALL\nlatin1_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,\n              char **toP, const char *toLim) {\n  UNUSED_P(enc);\n  for (;;) {\n    unsigned char c;\n    if (*fromP == fromLim)\n      return XML_CONVERT_COMPLETED;\n    c = (unsigned char)**fromP;\n    if (c & 0x80) {\n      if (toLim - *toP < 2)\n        return XML_CONVERT_OUTPUT_EXHAUSTED;\n      *(*toP)++ = (char)((c >> 6) | UTF8_cval2);\n      *(*toP)++ = (char)((c & 0x3f) | 0x80);\n      (*fromP)++;\n    } else {\n      if (*toP == toLim)\n        return XML_CONVERT_OUTPUT_EXHAUSTED;\n      *(*toP)++ = *(*fromP)++;\n    }\n  }\n}\n\nstatic enum XML_Convert_Result PTRCALL\nlatin1_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim,\n               unsigned short **toP, const unsigned short *toLim) {\n  UNUSED_P(enc);\n  while (*fromP < fromLim && *toP < toLim)\n    *(*toP)++ = (unsigned char)*(*fromP)++;\n\n  if ((*toP == toLim) && (*fromP < fromLim))\n    return XML_CONVERT_OUTPUT_EXHAUSTED;\n  else\n    return XML_CONVERT_COMPLETED;\n}\n\n#ifdef XML_NS\n\nstatic const struct normal_encoding latin1_encoding_ns\n    = {{VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0},\n       {\n#  include \"asciitab.h\"\n#  include \"latin1tab.h\"\n       },\n       STANDARD_VTABLE(sb_) NULL_VTABLE};\n\n#endif\n\nstatic const struct normal_encoding latin1_encoding\n    = {{VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0},\n       {\n#define BT_COLON BT_NMSTRT\n#include \"asciitab.h\"\n#undef BT_COLON\n#include \"latin1tab.h\"\n       },\n       STANDARD_VTABLE(sb_) NULL_VTABLE};\n\nstatic enum XML_Convert_Result PTRCALL\nascii_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,\n             char **toP, const char *toLim) {\n  UNUSED_P(enc);\n  while (*fromP < fromLim && *toP < toLim)\n    *(*toP)++ = *(*fromP)++;\n\n  if ((*toP == toLim) && (*fromP < fromLim))\n    return XML_CONVERT_OUTPUT_EXHAUSTED;\n  else\n    return XML_CONVERT_COMPLETED;\n}\n\n#ifdef XML_NS\n\nstatic const struct normal_encoding ascii_encoding_ns\n    = {{VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0},\n       {\n#  include \"asciitab.h\"\n           /* BT_NONXML == 0 */\n       },\n       STANDARD_VTABLE(sb_) NULL_VTABLE};\n\n#endif\n\nstatic const struct normal_encoding ascii_encoding\n    = {{VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0},\n       {\n#define BT_COLON BT_NMSTRT\n#include \"asciitab.h\"\n#undef BT_COLON\n           /* BT_NONXML == 0 */\n       },\n       STANDARD_VTABLE(sb_) NULL_VTABLE};\n\nstatic int PTRFASTCALL\nunicode_byte_type(char hi, char lo) {\n  switch ((unsigned char)hi) {\n  /* 0xD800–0xDBFF first 16-bit code unit or high surrogate (W1) */\n  case 0xD8:\n  case 0xD9:\n  case 0xDA:\n  case 0xDB:\n    return BT_LEAD4;\n  /* 0xDC00–0xDFFF second 16-bit code unit or low surrogate (W2) */\n  case 0xDC:\n  case 0xDD:\n  case 0xDE:\n  case 0xDF:\n    return BT_TRAIL;\n  case 0xFF:\n    switch ((unsigned char)lo) {\n    case 0xFF: /* noncharacter-FFFF */\n    case 0xFE: /* noncharacter-FFFE */\n      return BT_NONXML;\n    }\n    break;\n  }\n  return BT_NONASCII;\n}\n\n#define DEFINE_UTF16_TO_UTF8(E)                                                \\\n  static enum XML_Convert_Result PTRCALL E##toUtf8(                            \\\n      const ENCODING *enc, const char **fromP, const char *fromLim,            \\\n      char **toP, const char *toLim) {                                         \\\n    const char *from = *fromP;                                                 \\\n    UNUSED_P(enc);                                                             \\\n    fromLim = from + (((fromLim - from) >> 1) << 1); /* shrink to even */      \\\n    for (; from < fromLim; from += 2) {                                        \\\n      int plane;                                                               \\\n      unsigned char lo2;                                                       \\\n      unsigned char lo = GET_LO(from);                                         \\\n      unsigned char hi = GET_HI(from);                                         \\\n      switch (hi) {                                                            \\\n      case 0:                                                                  \\\n        if (lo < 0x80) {                                                       \\\n          if (*toP == toLim) {                                                 \\\n            *fromP = from;                                                     \\\n            return XML_CONVERT_OUTPUT_EXHAUSTED;                               \\\n          }                                                                    \\\n          *(*toP)++ = lo;                                                      \\\n          break;                                                               \\\n        }                                                                      \\\n        /* fall through */                                                     \\\n      case 0x1:                                                                \\\n      case 0x2:                                                                \\\n      case 0x3:                                                                \\\n      case 0x4:                                                                \\\n      case 0x5:                                                                \\\n      case 0x6:                                                                \\\n      case 0x7:                                                                \\\n        if (toLim - *toP < 2) {                                                \\\n          *fromP = from;                                                       \\\n          return XML_CONVERT_OUTPUT_EXHAUSTED;                                 \\\n        }                                                                      \\\n        *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2);                      \\\n        *(*toP)++ = ((lo & 0x3f) | 0x80);                                      \\\n        break;                                                                 \\\n      default:                                                                 \\\n        if (toLim - *toP < 3) {                                                \\\n          *fromP = from;                                                       \\\n          return XML_CONVERT_OUTPUT_EXHAUSTED;                                 \\\n        }                                                                      \\\n        /* 16 bits divided 4, 6, 6 amongst 3 bytes */                          \\\n        *(*toP)++ = ((hi >> 4) | UTF8_cval3);                                  \\\n        *(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80);                    \\\n        *(*toP)++ = ((lo & 0x3f) | 0x80);                                      \\\n        break;                                                                 \\\n      case 0xD8:                                                               \\\n      case 0xD9:                                                               \\\n      case 0xDA:                                                               \\\n      case 0xDB:                                                               \\\n        if (toLim - *toP < 4) {                                                \\\n          *fromP = from;                                                       \\\n          return XML_CONVERT_OUTPUT_EXHAUSTED;                                 \\\n        }                                                                      \\\n        if (fromLim - from < 4) {                                              \\\n          *fromP = from;                                                       \\\n          return XML_CONVERT_INPUT_INCOMPLETE;                                 \\\n        }                                                                      \\\n        plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1;                   \\\n        *(*toP)++ = (char)((plane >> 2) | UTF8_cval4);                         \\\n        *(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80);         \\\n        from += 2;                                                             \\\n        lo2 = GET_LO(from);                                                    \\\n        *(*toP)++ = (((lo & 0x3) << 4) | ((GET_HI(from) & 0x3) << 2)           \\\n                     | (lo2 >> 6) | 0x80);                                     \\\n        *(*toP)++ = ((lo2 & 0x3f) | 0x80);                                     \\\n        break;                                                                 \\\n      }                                                                        \\\n    }                                                                          \\\n    *fromP = from;                                                             \\\n    if (from < fromLim)                                                        \\\n      return XML_CONVERT_INPUT_INCOMPLETE;                                     \\\n    else                                                                       \\\n      return XML_CONVERT_COMPLETED;                                            \\\n  }\n\n#define DEFINE_UTF16_TO_UTF16(E)                                               \\\n  static enum XML_Convert_Result PTRCALL E##toUtf16(                           \\\n      const ENCODING *enc, const char **fromP, const char *fromLim,            \\\n      unsigned short **toP, const unsigned short *toLim) {                     \\\n    enum XML_Convert_Result res = XML_CONVERT_COMPLETED;                       \\\n    UNUSED_P(enc);                                                             \\\n    fromLim = *fromP + (((fromLim - *fromP) >> 1) << 1); /* shrink to even */  \\\n    /* Avoid copying first half only of surrogate */                           \\\n    if (fromLim - *fromP > ((toLim - *toP) << 1)                               \\\n        && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) {                             \\\n      fromLim -= 2;                                                            \\\n      res = XML_CONVERT_INPUT_INCOMPLETE;                                      \\\n    }                                                                          \\\n    for (; *fromP < fromLim && *toP < toLim; *fromP += 2)                      \\\n      *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP);                      \\\n    if ((*toP == toLim) && (*fromP < fromLim))                                 \\\n      return XML_CONVERT_OUTPUT_EXHAUSTED;                                     \\\n    else                                                                       \\\n      return res;                                                              \\\n  }\n\n#define SET2(ptr, ch) (((ptr)[0] = ((ch)&0xff)), ((ptr)[1] = ((ch) >> 8)))\n#define GET_LO(ptr) ((unsigned char)(ptr)[0])\n#define GET_HI(ptr) ((unsigned char)(ptr)[1])\n\nDEFINE_UTF16_TO_UTF8(little2_)\nDEFINE_UTF16_TO_UTF16(little2_)\n\n#undef SET2\n#undef GET_LO\n#undef GET_HI\n\n#define SET2(ptr, ch) (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch)&0xFF)))\n#define GET_LO(ptr) ((unsigned char)(ptr)[1])\n#define GET_HI(ptr) ((unsigned char)(ptr)[0])\n\nDEFINE_UTF16_TO_UTF8(big2_)\nDEFINE_UTF16_TO_UTF16(big2_)\n\n#undef SET2\n#undef GET_LO\n#undef GET_HI\n\n#define LITTLE2_BYTE_TYPE(enc, p)                                              \\\n  ((p)[1] == 0 ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)]  \\\n               : unicode_byte_type((p)[1], (p)[0]))\n#define LITTLE2_BYTE_TO_ASCII(p) ((p)[1] == 0 ? (p)[0] : -1)\n#define LITTLE2_CHAR_MATCHES(p, c) ((p)[1] == 0 && (p)[0] == c)\n#define LITTLE2_IS_NAME_CHAR_MINBPC(p)                                         \\\n  UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0])\n#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(p)                                       \\\n  UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0])\n\n#ifdef XML_MIN_SIZE\n\nstatic int PTRFASTCALL\nlittle2_byteType(const ENCODING *enc, const char *p) {\n  return LITTLE2_BYTE_TYPE(enc, p);\n}\n\nstatic int PTRFASTCALL\nlittle2_byteToAscii(const ENCODING *enc, const char *p) {\n  UNUSED_P(enc);\n  return LITTLE2_BYTE_TO_ASCII(p);\n}\n\nstatic int PTRCALL\nlittle2_charMatches(const ENCODING *enc, const char *p, int c) {\n  UNUSED_P(enc);\n  return LITTLE2_CHAR_MATCHES(p, c);\n}\n\nstatic int PTRFASTCALL\nlittle2_isNameMin(const ENCODING *enc, const char *p) {\n  UNUSED_P(enc);\n  return LITTLE2_IS_NAME_CHAR_MINBPC(p);\n}\n\nstatic int PTRFASTCALL\nlittle2_isNmstrtMin(const ENCODING *enc, const char *p) {\n  UNUSED_P(enc);\n  return LITTLE2_IS_NMSTRT_CHAR_MINBPC(p);\n}\n\n#  undef VTABLE\n#  define VTABLE VTABLE1, little2_toUtf8, little2_toUtf16\n\n#else /* not XML_MIN_SIZE */\n\n#  undef PREFIX\n#  define PREFIX(ident) little2_##ident\n#  define MINBPC(enc) 2\n/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */\n#  define BYTE_TYPE(enc, p) LITTLE2_BYTE_TYPE(enc, p)\n#  define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(p)\n#  define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(p, c)\n#  define IS_NAME_CHAR(enc, p, n) 0\n#  define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(p)\n#  define IS_NMSTRT_CHAR(enc, p, n) (0)\n#  define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(p)\n\n#  define XML_TOK_IMPL_C\n#  include \"xmltok_impl.c\"\n#  undef XML_TOK_IMPL_C\n\n#  undef MINBPC\n#  undef BYTE_TYPE\n#  undef BYTE_TO_ASCII\n#  undef CHAR_MATCHES\n#  undef IS_NAME_CHAR\n#  undef IS_NAME_CHAR_MINBPC\n#  undef IS_NMSTRT_CHAR\n#  undef IS_NMSTRT_CHAR_MINBPC\n#  undef IS_INVALID_CHAR\n\n#endif /* not XML_MIN_SIZE */\n\n#ifdef XML_NS\n\nstatic const struct normal_encoding little2_encoding_ns\n    = {{VTABLE, 2, 0,\n#  if BYTEORDER == 1234\n        1\n#  else\n        0\n#  endif\n       },\n       {\n#  include \"asciitab.h\"\n#  include \"latin1tab.h\"\n       },\n       STANDARD_VTABLE(little2_) NULL_VTABLE};\n\n#endif\n\nstatic const struct normal_encoding little2_encoding\n    = {{VTABLE, 2, 0,\n#if BYTEORDER == 1234\n        1\n#else\n        0\n#endif\n       },\n       {\n#define BT_COLON BT_NMSTRT\n#include \"asciitab.h\"\n#undef BT_COLON\n#include \"latin1tab.h\"\n       },\n       STANDARD_VTABLE(little2_) NULL_VTABLE};\n\n#if BYTEORDER != 4321\n\n#  ifdef XML_NS\n\nstatic const struct normal_encoding internal_little2_encoding_ns\n    = {{VTABLE, 2, 0, 1},\n       {\n#    include \"iasciitab.h\"\n#    include \"latin1tab.h\"\n       },\n       STANDARD_VTABLE(little2_) NULL_VTABLE};\n\n#  endif\n\nstatic const struct normal_encoding internal_little2_encoding\n    = {{VTABLE, 2, 0, 1},\n       {\n#  define BT_COLON BT_NMSTRT\n#  include \"iasciitab.h\"\n#  undef BT_COLON\n#  include \"latin1tab.h\"\n       },\n       STANDARD_VTABLE(little2_) NULL_VTABLE};\n\n#endif\n\n#define BIG2_BYTE_TYPE(enc, p)                                                 \\\n  ((p)[0] == 0                                                                 \\\n       ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]]        \\\n       : unicode_byte_type((p)[0], (p)[1]))\n#define BIG2_BYTE_TO_ASCII(p) ((p)[0] == 0 ? (p)[1] : -1)\n#define BIG2_CHAR_MATCHES(p, c) ((p)[0] == 0 && (p)[1] == c)\n#define BIG2_IS_NAME_CHAR_MINBPC(p)                                            \\\n  UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1])\n#define BIG2_IS_NMSTRT_CHAR_MINBPC(p)                                          \\\n  UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1])\n\n#ifdef XML_MIN_SIZE\n\nstatic int PTRFASTCALL\nbig2_byteType(const ENCODING *enc, const char *p) {\n  return BIG2_BYTE_TYPE(enc, p);\n}\n\nstatic int PTRFASTCALL\nbig2_byteToAscii(const ENCODING *enc, const char *p) {\n  UNUSED_P(enc);\n  return BIG2_BYTE_TO_ASCII(p);\n}\n\nstatic int PTRCALL\nbig2_charMatches(const ENCODING *enc, const char *p, int c) {\n  UNUSED_P(enc);\n  return BIG2_CHAR_MATCHES(p, c);\n}\n\nstatic int PTRFASTCALL\nbig2_isNameMin(const ENCODING *enc, const char *p) {\n  UNUSED_P(enc);\n  return BIG2_IS_NAME_CHAR_MINBPC(p);\n}\n\nstatic int PTRFASTCALL\nbig2_isNmstrtMin(const ENCODING *enc, const char *p) {\n  UNUSED_P(enc);\n  return BIG2_IS_NMSTRT_CHAR_MINBPC(p);\n}\n\n#  undef VTABLE\n#  define VTABLE VTABLE1, big2_toUtf8, big2_toUtf16\n\n#else /* not XML_MIN_SIZE */\n\n#  undef PREFIX\n#  define PREFIX(ident) big2_##ident\n#  define MINBPC(enc) 2\n/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */\n#  define BYTE_TYPE(enc, p) BIG2_BYTE_TYPE(enc, p)\n#  define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(p)\n#  define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(p, c)\n#  define IS_NAME_CHAR(enc, p, n) 0\n#  define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(p)\n#  define IS_NMSTRT_CHAR(enc, p, n) (0)\n#  define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(p)\n\n#  define XML_TOK_IMPL_C\n#  include \"xmltok_impl.c\"\n#  undef XML_TOK_IMPL_C\n\n#  undef MINBPC\n#  undef BYTE_TYPE\n#  undef BYTE_TO_ASCII\n#  undef CHAR_MATCHES\n#  undef IS_NAME_CHAR\n#  undef IS_NAME_CHAR_MINBPC\n#  undef IS_NMSTRT_CHAR\n#  undef IS_NMSTRT_CHAR_MINBPC\n#  undef IS_INVALID_CHAR\n\n#endif /* not XML_MIN_SIZE */\n\n#ifdef XML_NS\n\nstatic const struct normal_encoding big2_encoding_ns\n    = {{VTABLE, 2, 0,\n#  if BYTEORDER == 4321\n        1\n#  else\n        0\n#  endif\n       },\n       {\n#  include \"asciitab.h\"\n#  include \"latin1tab.h\"\n       },\n       STANDARD_VTABLE(big2_) NULL_VTABLE};\n\n#endif\n\nstatic const struct normal_encoding big2_encoding\n    = {{VTABLE, 2, 0,\n#if BYTEORDER == 4321\n        1\n#else\n        0\n#endif\n       },\n       {\n#define BT_COLON BT_NMSTRT\n#include \"asciitab.h\"\n#undef BT_COLON\n#include \"latin1tab.h\"\n       },\n       STANDARD_VTABLE(big2_) NULL_VTABLE};\n\n#if BYTEORDER != 1234\n\n#  ifdef XML_NS\n\nstatic const struct normal_encoding internal_big2_encoding_ns\n    = {{VTABLE, 2, 0, 1},\n       {\n#    include \"iasciitab.h\"\n#    include \"latin1tab.h\"\n       },\n       STANDARD_VTABLE(big2_) NULL_VTABLE};\n\n#  endif\n\nstatic const struct normal_encoding internal_big2_encoding\n    = {{VTABLE, 2, 0, 1},\n       {\n#  define BT_COLON BT_NMSTRT\n#  include \"iasciitab.h\"\n#  undef BT_COLON\n#  include \"latin1tab.h\"\n       },\n       STANDARD_VTABLE(big2_) NULL_VTABLE};\n\n#endif\n\n#undef PREFIX\n\nstatic int FASTCALL\nstreqci(const char *s1, const char *s2) {\n  for (;;) {\n    char c1 = *s1++;\n    char c2 = *s2++;\n    if (ASCII_a <= c1 && c1 <= ASCII_z)\n      c1 += ASCII_A - ASCII_a;\n    if (ASCII_a <= c2 && c2 <= ASCII_z)\n      /* The following line will never get executed.  streqci() is\n       * only called from two places, both of which guarantee to put\n       * upper-case strings into s2.\n       */\n      c2 += ASCII_A - ASCII_a; /* LCOV_EXCL_LINE */\n    if (c1 != c2)\n      return 0;\n    if (! c1)\n      break;\n  }\n  return 1;\n}\n\nstatic void PTRCALL\ninitUpdatePosition(const ENCODING *enc, const char *ptr, const char *end,\n                   POSITION *pos) {\n  UNUSED_P(enc);\n  normal_updatePosition(&utf8_encoding.enc, ptr, end, pos);\n}\n\nstatic int\ntoAscii(const ENCODING *enc, const char *ptr, const char *end) {\n  char buf[1];\n  char *p = buf;\n  XmlUtf8Convert(enc, &ptr, end, &p, p + 1);\n  if (p == buf)\n    return -1;\n  else\n    return buf[0];\n}\n\nstatic int FASTCALL\nisSpace(int c) {\n  switch (c) {\n  case 0x20:\n  case 0xD:\n  case 0xA:\n  case 0x9:\n    return 1;\n  }\n  return 0;\n}\n\n/* Return 1 if there's just optional white space or there's an S\n   followed by name=val.\n*/\nstatic int\nparsePseudoAttribute(const ENCODING *enc, const char *ptr, const char *end,\n                     const char **namePtr, const char **nameEndPtr,\n                     const char **valPtr, const char **nextTokPtr) {\n  int c;\n  char open;\n  if (ptr == end) {\n    *namePtr = NULL;\n    return 1;\n  }\n  if (! isSpace(toAscii(enc, ptr, end))) {\n    *nextTokPtr = ptr;\n    return 0;\n  }\n  do {\n    ptr += enc->minBytesPerChar;\n  } while (isSpace(toAscii(enc, ptr, end)));\n  if (ptr == end) {\n    *namePtr = NULL;\n    return 1;\n  }\n  *namePtr = ptr;\n  for (;;) {\n    c = toAscii(enc, ptr, end);\n    if (c == -1) {\n      *nextTokPtr = ptr;\n      return 0;\n    }\n    if (c == ASCII_EQUALS) {\n      *nameEndPtr = ptr;\n      break;\n    }\n    if (isSpace(c)) {\n      *nameEndPtr = ptr;\n      do {\n        ptr += enc->minBytesPerChar;\n      } while (isSpace(c = toAscii(enc, ptr, end)));\n      if (c != ASCII_EQUALS) {\n        *nextTokPtr = ptr;\n        return 0;\n      }\n      break;\n    }\n    ptr += enc->minBytesPerChar;\n  }\n  if (ptr == *namePtr) {\n    *nextTokPtr = ptr;\n    return 0;\n  }\n  ptr += enc->minBytesPerChar;\n  c = toAscii(enc, ptr, end);\n  while (isSpace(c)) {\n    ptr += enc->minBytesPerChar;\n    c = toAscii(enc, ptr, end);\n  }\n  if (c != ASCII_QUOT && c != ASCII_APOS) {\n    *nextTokPtr = ptr;\n    return 0;\n  }\n  open = (char)c;\n  ptr += enc->minBytesPerChar;\n  *valPtr = ptr;\n  for (;; ptr += enc->minBytesPerChar) {\n    c = toAscii(enc, ptr, end);\n    if (c == open)\n      break;\n    if (! (ASCII_a <= c && c <= ASCII_z) && ! (ASCII_A <= c && c <= ASCII_Z)\n        && ! (ASCII_0 <= c && c <= ASCII_9) && c != ASCII_PERIOD\n        && c != ASCII_MINUS && c != ASCII_UNDERSCORE) {\n      *nextTokPtr = ptr;\n      return 0;\n    }\n  }\n  *nextTokPtr = ptr + enc->minBytesPerChar;\n  return 1;\n}\n\nstatic const char KW_version[]\n    = {ASCII_v, ASCII_e, ASCII_r, ASCII_s, ASCII_i, ASCII_o, ASCII_n, '\\0'};\n\nstatic const char KW_encoding[] = {ASCII_e, ASCII_n, ASCII_c, ASCII_o, ASCII_d,\n                                   ASCII_i, ASCII_n, ASCII_g, '\\0'};\n\nstatic const char KW_standalone[]\n    = {ASCII_s, ASCII_t, ASCII_a, ASCII_n, ASCII_d, ASCII_a,\n       ASCII_l, ASCII_o, ASCII_n, ASCII_e, '\\0'};\n\nstatic const char KW_yes[] = {ASCII_y, ASCII_e, ASCII_s, '\\0'};\n\nstatic const char KW_no[] = {ASCII_n, ASCII_o, '\\0'};\n\nstatic int\ndoParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, const char *,\n                                                 const char *),\n               int isGeneralTextEntity, const ENCODING *enc, const char *ptr,\n               const char *end, const char **badPtr, const char **versionPtr,\n               const char **versionEndPtr, const char **encodingName,\n               const ENCODING **encoding, int *standalone) {\n  const char *val = NULL;\n  const char *name = NULL;\n  const char *nameEnd = NULL;\n  ptr += 5 * enc->minBytesPerChar;\n  end -= 2 * enc->minBytesPerChar;\n  if (! parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)\n      || ! name) {\n    *badPtr = ptr;\n    return 0;\n  }\n  if (! XmlNameMatchesAscii(enc, name, nameEnd, KW_version)) {\n    if (! isGeneralTextEntity) {\n      *badPtr = name;\n      return 0;\n    }\n  } else {\n    if (versionPtr)\n      *versionPtr = val;\n    if (versionEndPtr)\n      *versionEndPtr = ptr;\n    if (! parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) {\n      *badPtr = ptr;\n      return 0;\n    }\n    if (! name) {\n      if (isGeneralTextEntity) {\n        /* a TextDecl must have an EncodingDecl */\n        *badPtr = ptr;\n        return 0;\n      }\n      return 1;\n    }\n  }\n  if (XmlNameMatchesAscii(enc, name, nameEnd, KW_encoding)) {\n    int c = toAscii(enc, val, end);\n    if (! (ASCII_a <= c && c <= ASCII_z) && ! (ASCII_A <= c && c <= ASCII_Z)) {\n      *badPtr = val;\n      return 0;\n    }\n    if (encodingName)\n      *encodingName = val;\n    if (encoding)\n      *encoding = encodingFinder(enc, val, ptr - enc->minBytesPerChar);\n    if (! parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) {\n      *badPtr = ptr;\n      return 0;\n    }\n    if (! name)\n      return 1;\n  }\n  if (! XmlNameMatchesAscii(enc, name, nameEnd, KW_standalone)\n      || isGeneralTextEntity) {\n    *badPtr = name;\n    return 0;\n  }\n  if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_yes)) {\n    if (standalone)\n      *standalone = 1;\n  } else if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_no)) {\n    if (standalone)\n      *standalone = 0;\n  } else {\n    *badPtr = val;\n    return 0;\n  }\n  while (isSpace(toAscii(enc, ptr, end)))\n    ptr += enc->minBytesPerChar;\n  if (ptr != end) {\n    *badPtr = ptr;\n    return 0;\n  }\n  return 1;\n}\n\nstatic int FASTCALL\ncheckCharRefNumber(int result) {\n  switch (result >> 8) {\n  case 0xD8:\n  case 0xD9:\n  case 0xDA:\n  case 0xDB:\n  case 0xDC:\n  case 0xDD:\n  case 0xDE:\n  case 0xDF:\n    return -1;\n  case 0:\n    if (latin1_encoding.type[result] == BT_NONXML)\n      return -1;\n    break;\n  case 0xFF:\n    if (result == 0xFFFE || result == 0xFFFF)\n      return -1;\n    break;\n  }\n  return result;\n}\n\nint FASTCALL\nXmlUtf8Encode(int c, char *buf) {\n  enum {\n    /* minN is minimum legal resulting value for N byte sequence */\n    min2 = 0x80,\n    min3 = 0x800,\n    min4 = 0x10000\n  };\n\n  if (c < 0)\n    return 0; /* LCOV_EXCL_LINE: this case is always eliminated beforehand */\n  if (c < min2) {\n    buf[0] = (char)(c | UTF8_cval1);\n    return 1;\n  }\n  if (c < min3) {\n    buf[0] = (char)((c >> 6) | UTF8_cval2);\n    buf[1] = (char)((c & 0x3f) | 0x80);\n    return 2;\n  }\n  if (c < min4) {\n    buf[0] = (char)((c >> 12) | UTF8_cval3);\n    buf[1] = (char)(((c >> 6) & 0x3f) | 0x80);\n    buf[2] = (char)((c & 0x3f) | 0x80);\n    return 3;\n  }\n  if (c < 0x110000) {\n    buf[0] = (char)((c >> 18) | UTF8_cval4);\n    buf[1] = (char)(((c >> 12) & 0x3f) | 0x80);\n    buf[2] = (char)(((c >> 6) & 0x3f) | 0x80);\n    buf[3] = (char)((c & 0x3f) | 0x80);\n    return 4;\n  }\n  return 0; /* LCOV_EXCL_LINE: this case too is eliminated before calling */\n}\n\nint FASTCALL\nXmlUtf16Encode(int charNum, unsigned short *buf) {\n  if (charNum < 0)\n    return 0;\n  if (charNum < 0x10000) {\n    buf[0] = (unsigned short)charNum;\n    return 1;\n  }\n  if (charNum < 0x110000) {\n    charNum -= 0x10000;\n    buf[0] = (unsigned short)((charNum >> 10) + 0xD800);\n    buf[1] = (unsigned short)((charNum & 0x3FF) + 0xDC00);\n    return 2;\n  }\n  return 0;\n}\n\nstruct unknown_encoding {\n  struct normal_encoding normal;\n  CONVERTER convert;\n  void *userData;\n  unsigned short utf16[256];\n  char utf8[256][4];\n};\n\n#define AS_UNKNOWN_ENCODING(enc) ((const struct unknown_encoding *)(enc))\n\nint\nXmlSizeOfUnknownEncoding(void) {\n  return sizeof(struct unknown_encoding);\n}\n\nstatic int PTRFASTCALL\nunknown_isName(const ENCODING *enc, const char *p) {\n  const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);\n  int c = uenc->convert(uenc->userData, p);\n  if (c & ~0xFFFF)\n    return 0;\n  return UCS2_GET_NAMING(namePages, c >> 8, c & 0xFF);\n}\n\nstatic int PTRFASTCALL\nunknown_isNmstrt(const ENCODING *enc, const char *p) {\n  const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);\n  int c = uenc->convert(uenc->userData, p);\n  if (c & ~0xFFFF)\n    return 0;\n  return UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xFF);\n}\n\nstatic int PTRFASTCALL\nunknown_isInvalid(const ENCODING *enc, const char *p) {\n  const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);\n  int c = uenc->convert(uenc->userData, p);\n  return (c & ~0xFFFF) || checkCharRefNumber(c) < 0;\n}\n\nstatic enum XML_Convert_Result PTRCALL\nunknown_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,\n               char **toP, const char *toLim) {\n  const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);\n  char buf[XML_UTF8_ENCODE_MAX];\n  for (;;) {\n    const char *utf8;\n    int n;\n    if (*fromP == fromLim)\n      return XML_CONVERT_COMPLETED;\n    utf8 = uenc->utf8[(unsigned char)**fromP];\n    n = *utf8++;\n    if (n == 0) {\n      int c = uenc->convert(uenc->userData, *fromP);\n      n = XmlUtf8Encode(c, buf);\n      if (n > toLim - *toP)\n        return XML_CONVERT_OUTPUT_EXHAUSTED;\n      utf8 = buf;\n      *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP]\n                 - (BT_LEAD2 - 2));\n    } else {\n      if (n > toLim - *toP)\n        return XML_CONVERT_OUTPUT_EXHAUSTED;\n      (*fromP)++;\n    }\n    memcpy(*toP, utf8, n);\n    *toP += n;\n  }\n}\n\nstatic enum XML_Convert_Result PTRCALL\nunknown_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim,\n                unsigned short **toP, const unsigned short *toLim) {\n  const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);\n  while (*fromP < fromLim && *toP < toLim) {\n    unsigned short c = uenc->utf16[(unsigned char)**fromP];\n    if (c == 0) {\n      c = (unsigned short)uenc->convert(uenc->userData, *fromP);\n      *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP]\n                 - (BT_LEAD2 - 2));\n    } else\n      (*fromP)++;\n    *(*toP)++ = c;\n  }\n\n  if ((*toP == toLim) && (*fromP < fromLim))\n    return XML_CONVERT_OUTPUT_EXHAUSTED;\n  else\n    return XML_CONVERT_COMPLETED;\n}\n\nENCODING *\nXmlInitUnknownEncoding(void *mem, int *table, CONVERTER convert,\n                       void *userData) {\n  int i;\n  struct unknown_encoding *e = (struct unknown_encoding *)mem;\n  memcpy(mem, &latin1_encoding, sizeof(struct normal_encoding));\n  for (i = 0; i < 128; i++)\n    if (latin1_encoding.type[i] != BT_OTHER\n        && latin1_encoding.type[i] != BT_NONXML && table[i] != i)\n      return 0;\n  for (i = 0; i < 256; i++) {\n    int c = table[i];\n    if (c == -1) {\n      e->normal.type[i] = BT_MALFORM;\n      /* This shouldn't really get used. */\n      e->utf16[i] = 0xFFFF;\n      e->utf8[i][0] = 1;\n      e->utf8[i][1] = 0;\n    } else if (c < 0) {\n      if (c < -4)\n        return 0;\n      /* Multi-byte sequences need a converter function */\n      if (! convert)\n        return 0;\n      e->normal.type[i] = (unsigned char)(BT_LEAD2 - (c + 2));\n      e->utf8[i][0] = 0;\n      e->utf16[i] = 0;\n    } else if (c < 0x80) {\n      if (latin1_encoding.type[c] != BT_OTHER\n          && latin1_encoding.type[c] != BT_NONXML && c != i)\n        return 0;\n      e->normal.type[i] = latin1_encoding.type[c];\n      e->utf8[i][0] = 1;\n      e->utf8[i][1] = (char)c;\n      e->utf16[i] = (unsigned short)(c == 0 ? 0xFFFF : c);\n    } else if (checkCharRefNumber(c) < 0) {\n      e->normal.type[i] = BT_NONXML;\n      /* This shouldn't really get used. */\n      e->utf16[i] = 0xFFFF;\n      e->utf8[i][0] = 1;\n      e->utf8[i][1] = 0;\n    } else {\n      if (c > 0xFFFF)\n        return 0;\n      if (UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xff))\n        e->normal.type[i] = BT_NMSTRT;\n      else if (UCS2_GET_NAMING(namePages, c >> 8, c & 0xff))\n        e->normal.type[i] = BT_NAME;\n      else\n        e->normal.type[i] = BT_OTHER;\n      e->utf8[i][0] = (char)XmlUtf8Encode(c, e->utf8[i] + 1);\n      e->utf16[i] = (unsigned short)c;\n    }\n  }\n  e->userData = userData;\n  e->convert = convert;\n  if (convert) {\n    e->normal.isName2 = unknown_isName;\n    e->normal.isName3 = unknown_isName;\n    e->normal.isName4 = unknown_isName;\n    e->normal.isNmstrt2 = unknown_isNmstrt;\n    e->normal.isNmstrt3 = unknown_isNmstrt;\n    e->normal.isNmstrt4 = unknown_isNmstrt;\n    e->normal.isInvalid2 = unknown_isInvalid;\n    e->normal.isInvalid3 = unknown_isInvalid;\n    e->normal.isInvalid4 = unknown_isInvalid;\n  }\n  e->normal.enc.utf8Convert = unknown_toUtf8;\n  e->normal.enc.utf16Convert = unknown_toUtf16;\n  return &(e->normal.enc);\n}\n\n/* If this enumeration is changed, getEncodingIndex and encodings\nmust also be changed. */\nenum {\n  UNKNOWN_ENC = -1,\n  ISO_8859_1_ENC = 0,\n  US_ASCII_ENC,\n  UTF_8_ENC,\n  UTF_16_ENC,\n  UTF_16BE_ENC,\n  UTF_16LE_ENC,\n  /* must match encodingNames up to here */\n  NO_ENC\n};\n\nstatic const char KW_ISO_8859_1[]\n    = {ASCII_I, ASCII_S, ASCII_O,     ASCII_MINUS, ASCII_8, ASCII_8,\n       ASCII_5, ASCII_9, ASCII_MINUS, ASCII_1,     '\\0'};\nstatic const char KW_US_ASCII[]\n    = {ASCII_U, ASCII_S, ASCII_MINUS, ASCII_A, ASCII_S,\n       ASCII_C, ASCII_I, ASCII_I,     '\\0'};\nstatic const char KW_UTF_8[]\n    = {ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_8, '\\0'};\nstatic const char KW_UTF_16[]\n    = {ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, '\\0'};\nstatic const char KW_UTF_16BE[]\n    = {ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1,\n       ASCII_6, ASCII_B, ASCII_E, '\\0'};\nstatic const char KW_UTF_16LE[]\n    = {ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1,\n       ASCII_6, ASCII_L, ASCII_E, '\\0'};\n\nstatic int FASTCALL\ngetEncodingIndex(const char *name) {\n  static const char *const encodingNames[] = {\n      KW_ISO_8859_1, KW_US_ASCII, KW_UTF_8, KW_UTF_16, KW_UTF_16BE, KW_UTF_16LE,\n  };\n  int i;\n  if (name == NULL)\n    return NO_ENC;\n  for (i = 0; i < (int)(sizeof(encodingNames) / sizeof(encodingNames[0])); i++)\n    if (streqci(name, encodingNames[i]))\n      return i;\n  return UNKNOWN_ENC;\n}\n\n/* For binary compatibility, we store the index of the encoding\n   specified at initialization in the isUtf16 member.\n*/\n\n#define INIT_ENC_INDEX(enc) ((int)(enc)->initEnc.isUtf16)\n#define SET_INIT_ENC_INDEX(enc, i) ((enc)->initEnc.isUtf16 = (char)i)\n\n/* This is what detects the encoding.  encodingTable maps from\n   encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of\n   the external (protocol) specified encoding; state is\n   XML_CONTENT_STATE if we're parsing an external text entity, and\n   XML_PROLOG_STATE otherwise.\n*/\n\nstatic int\ninitScan(const ENCODING *const *encodingTable, const INIT_ENCODING *enc,\n         int state, const char *ptr, const char *end, const char **nextTokPtr) {\n  const ENCODING **encPtr;\n\n  if (ptr >= end)\n    return XML_TOK_NONE;\n  encPtr = enc->encPtr;\n  if (ptr + 1 == end) {\n    /* only a single byte available for auto-detection */\n#ifndef XML_DTD /* FIXME */\n    /* a well-formed document entity must have more than one byte */\n    if (state != XML_CONTENT_STATE)\n      return XML_TOK_PARTIAL;\n#endif\n    /* so we're parsing an external text entity... */\n    /* if UTF-16 was externally specified, then we need at least 2 bytes */\n    switch (INIT_ENC_INDEX(enc)) {\n    case UTF_16_ENC:\n    case UTF_16LE_ENC:\n    case UTF_16BE_ENC:\n      return XML_TOK_PARTIAL;\n    }\n    switch ((unsigned char)*ptr) {\n    case 0xFE:\n    case 0xFF:\n    case 0xEF: /* possibly first byte of UTF-8 BOM */\n      if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC && state == XML_CONTENT_STATE)\n        break;\n      /* fall through */\n    case 0x00:\n    case 0x3C:\n      return XML_TOK_PARTIAL;\n    }\n  } else {\n    switch (((unsigned char)ptr[0] << 8) | (unsigned char)ptr[1]) {\n    case 0xFEFF:\n      if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC && state == XML_CONTENT_STATE)\n        break;\n      *nextTokPtr = ptr + 2;\n      *encPtr = encodingTable[UTF_16BE_ENC];\n      return XML_TOK_BOM;\n    /* 00 3C is handled in the default case */\n    case 0x3C00:\n      if ((INIT_ENC_INDEX(enc) == UTF_16BE_ENC\n           || INIT_ENC_INDEX(enc) == UTF_16_ENC)\n          && state == XML_CONTENT_STATE)\n        break;\n      *encPtr = encodingTable[UTF_16LE_ENC];\n      return XmlTok(*encPtr, state, ptr, end, nextTokPtr);\n    case 0xFFFE:\n      if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC && state == XML_CONTENT_STATE)\n        break;\n      *nextTokPtr = ptr + 2;\n      *encPtr = encodingTable[UTF_16LE_ENC];\n      return XML_TOK_BOM;\n    case 0xEFBB:\n      /* Maybe a UTF-8 BOM (EF BB BF) */\n      /* If there's an explicitly specified (external) encoding\n         of ISO-8859-1 or some flavour of UTF-16\n         and this is an external text entity,\n         don't look for the BOM,\n         because it might be a legal data.\n      */\n      if (state == XML_CONTENT_STATE) {\n        int e = INIT_ENC_INDEX(enc);\n        if (e == ISO_8859_1_ENC || e == UTF_16BE_ENC || e == UTF_16LE_ENC\n            || e == UTF_16_ENC)\n          break;\n      }\n      if (ptr + 2 == end)\n        return XML_TOK_PARTIAL;\n      if ((unsigned char)ptr[2] == 0xBF) {\n        *nextTokPtr = ptr + 3;\n        *encPtr = encodingTable[UTF_8_ENC];\n        return XML_TOK_BOM;\n      }\n      break;\n    default:\n      if (ptr[0] == '\\0') {\n        /* 0 isn't a legal data character. Furthermore a document\n           entity can only start with ASCII characters.  So the only\n           way this can fail to be big-endian UTF-16 if it it's an\n           external parsed general entity that's labelled as\n           UTF-16LE.\n        */\n        if (state == XML_CONTENT_STATE && INIT_ENC_INDEX(enc) == UTF_16LE_ENC)\n          break;\n        *encPtr = encodingTable[UTF_16BE_ENC];\n        return XmlTok(*encPtr, state, ptr, end, nextTokPtr);\n      } else if (ptr[1] == '\\0') {\n        /* We could recover here in the case:\n            - parsing an external entity\n            - second byte is 0\n            - no externally specified encoding\n            - no encoding declaration\n           by assuming UTF-16LE.  But we don't, because this would mean when\n           presented just with a single byte, we couldn't reliably determine\n           whether we needed further bytes.\n        */\n        if (state == XML_CONTENT_STATE)\n          break;\n        *encPtr = encodingTable[UTF_16LE_ENC];\n        return XmlTok(*encPtr, state, ptr, end, nextTokPtr);\n      }\n      break;\n    }\n  }\n  *encPtr = encodingTable[INIT_ENC_INDEX(enc)];\n  return XmlTok(*encPtr, state, ptr, end, nextTokPtr);\n}\n\n#define NS(x) x\n#define ns(x) x\n#define XML_TOK_NS_C\n#include \"xmltok_ns.c\"\n#undef XML_TOK_NS_C\n#undef NS\n#undef ns\n\n#ifdef XML_NS\n\n#  define NS(x) x##NS\n#  define ns(x) x##_ns\n\n#  define XML_TOK_NS_C\n#  include \"xmltok_ns.c\"\n#  undef XML_TOK_NS_C\n\n#  undef NS\n#  undef ns\n\nENCODING *\nXmlInitUnknownEncodingNS(void *mem, int *table, CONVERTER convert,\n                         void *userData) {\n  ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData);\n  if (enc)\n    ((struct normal_encoding *)enc)->type[ASCII_COLON] = BT_COLON;\n  return enc;\n}\n\n#endif /* XML_NS */\n"},{"id":16543,"name":"iasciitab.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/*\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */\n/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,\n    /* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,\n    /* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,\n    /* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML,\n    /* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,\n    /* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,\n    /* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,\n    /* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,\n    /* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,\n    /* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,\n    /* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,\n    /* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,\n    /* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,\n    /* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,\n    /* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,\n    /* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,\n    /* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,\n    /* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,\n    /* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,\n    /* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,\n    /* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,\n    /* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,\n    /* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,\n    /* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,\n    /* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,\n"},{"id":16544,"name":"xmlparse.c","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* f519f27c7c3b79fee55aeb8b1e53b7384b079d9118bf3a62eb3a60986a6742f2 (2.2.9+)\n                            __  __            _\n                         ___\\ \\/ /_ __   __ _| |_\n                        / _ \\\\  /| '_ \\ / _` | __|\n                       |  __//  \\| |_) | (_| | |_\n                        \\___/_/\\_\\ .__/ \\__,_|\\__|\n                                 |_| XML parser\n\n   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\n   Copyright (c) 2000-2017 Expat development team\n   Licensed under the MIT license:\n\n   Permission is  hereby granted,  free of charge,  to any  person obtaining\n   a  copy  of  this  software   and  associated  documentation  files  (the\n   \"Software\"),  to  deal in  the  Software  without restriction,  including\n   without  limitation the  rights  to use,  copy,  modify, merge,  publish,\n   distribute, sublicense, and/or sell copies of the Software, and to permit\n   persons  to whom  the Software  is  furnished to  do so,  subject to  the\n   following conditions:\n\n   The above copyright  notice and this permission notice  shall be included\n   in all copies or substantial portions of the Software.\n\n   THE  SOFTWARE  IS  PROVIDED  \"AS  IS\",  WITHOUT  WARRANTY  OF  ANY  KIND,\n   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF\n   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR\n   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n   USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#if ! defined(_GNU_SOURCE)\n#  define _GNU_SOURCE 1 /* syscall prototype */\n#endif\n\n#ifdef _WIN32\n/* force stdlib to define rand_s() */\n#  if ! defined(_CRT_RAND_S)\n#    define _CRT_RAND_S\n#  endif\n#endif\n\n#include <stddef.h>\n#include <string.h> /* memset(), memcpy() */\n#include <assert.h>\n#include <limits.h> /* UINT_MAX */\n#include <stdio.h>  /* fprintf */\n#include <stdlib.h> /* getenv, rand_s */\n\n#ifdef _WIN32\n#  define getpid GetCurrentProcessId\n#else\n#  include <sys/time.h>  /* gettimeofday() */\n#  include <sys/types.h> /* getpid() */\n#  include <unistd.h>    /* getpid() */\n#  include <fcntl.h>     /* O_RDONLY */\n#  include <errno.h>\n#endif\n\n#define XML_BUILDING_EXPAT 1\n\n#ifdef _WIN32\n#  include \"winconfig.h\"\n#elif defined(HAVE_EXPAT_CONFIG_H)\n#  include <expat_config.h>\n#endif /* ndef _WIN32 */\n\n#include \"ascii.h\"\n#include \"expat.h\"\n#include \"siphash.h\"\n\n#if defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM)\n#  if defined(HAVE_GETRANDOM)\n#    include <sys/random.h> /* getrandom */\n#  else\n#    include <unistd.h>      /* syscall */\n#    include <sys/syscall.h> /* SYS_getrandom */\n#  endif\n#  if ! defined(GRND_NONBLOCK)\n#    define GRND_NONBLOCK 0x0001\n#  endif /* defined(GRND_NONBLOCK) */\n#endif   /* defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) */\n\n#if defined(HAVE_LIBBSD)                                                       \\\n    && (defined(HAVE_ARC4RANDOM_BUF) || defined(HAVE_ARC4RANDOM))\n#  include <bsd/stdlib.h>\n#endif\n\n#if defined(_WIN32) && ! defined(LOAD_LIBRARY_SEARCH_SYSTEM32)\n#  define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800\n#endif\n\n#if ! defined(HAVE_GETRANDOM) && ! defined(HAVE_SYSCALL_GETRANDOM)             \\\n    && ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM)            \\\n    && ! defined(XML_DEV_URANDOM) && ! defined(_WIN32)                         \\\n    && ! defined(XML_POOR_ENTROPY)\n#  error You do not have support for any sources of high quality entropy \\\n    enabled.  For end user security, that is probably not what you want. \\\n    \\\n    Your options include: \\\n      * Linux + glibc >=2.25 (getrandom): HAVE_GETRANDOM, \\\n      * Linux + glibc <2.25 (syscall SYS_getrandom): HAVE_SYSCALL_GETRANDOM, \\\n      * BSD / macOS >=10.7 (arc4random_buf): HAVE_ARC4RANDOM_BUF, \\\n      * BSD / macOS <10.7 (arc4random): HAVE_ARC4RANDOM, \\\n      * libbsd (arc4random_buf): HAVE_ARC4RANDOM_BUF + HAVE_LIBBSD, \\\n      * libbsd (arc4random): HAVE_ARC4RANDOM + HAVE_LIBBSD, \\\n      * Linux / BSD / macOS (/dev/urandom): XML_DEV_URANDOM \\\n      * Windows (rand_s): _WIN32. \\\n    \\\n    If insist on not using any of these, bypass this error by defining \\\n    XML_POOR_ENTROPY; you have been warned. \\\n    \\\n    If you have reasons to patch this detection code away or need changes \\\n    to the build system, please open a bug.  Thank you!\n#endif\n\n#ifdef XML_UNICODE\n#  define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX\n#  define XmlConvert XmlUtf16Convert\n#  define XmlGetInternalEncoding XmlGetUtf16InternalEncoding\n#  define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS\n#  define XmlEncode XmlUtf16Encode\n/* Using pointer subtraction to convert to integer type. */\n#  define MUST_CONVERT(enc, s)                                                 \\\n    (! (enc)->isUtf16 || (((char *)(s) - (char *)NULL) & 1))\ntypedef unsigned short ICHAR;\n#else\n#  define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX\n#  define XmlConvert XmlUtf8Convert\n#  define XmlGetInternalEncoding XmlGetUtf8InternalEncoding\n#  define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS\n#  define XmlEncode XmlUtf8Encode\n#  define MUST_CONVERT(enc, s) (! (enc)->isUtf8)\ntypedef char ICHAR;\n#endif\n\n#ifndef XML_NS\n\n#  define XmlInitEncodingNS XmlInitEncoding\n#  define XmlInitUnknownEncodingNS XmlInitUnknownEncoding\n#  undef XmlGetInternalEncodingNS\n#  define XmlGetInternalEncodingNS XmlGetInternalEncoding\n#  define XmlParseXmlDeclNS XmlParseXmlDecl\n\n#endif\n\n#ifdef XML_UNICODE\n\n#  ifdef XML_UNICODE_WCHAR_T\n#    define XML_T(x) (const wchar_t) x\n#    define XML_L(x) L##x\n#  else\n#    define XML_T(x) (const unsigned short)x\n#    define XML_L(x) x\n#  endif\n\n#else\n\n#  define XML_T(x) x\n#  define XML_L(x) x\n\n#endif\n\n/* Round up n to be a multiple of sz, where sz is a power of 2. */\n#define ROUND_UP(n, sz) (((n) + ((sz)-1)) & ~((sz)-1))\n\n/* Do safe (NULL-aware) pointer arithmetic */\n#define EXPAT_SAFE_PTR_DIFF(p, q) (((p) && (q)) ? ((p) - (q)) : 0)\n\n#include \"internal.h\"\n#include \"xmltok.h\"\n#include \"xmlrole.h\"\n\ntypedef const XML_Char *KEY;\n\ntypedef struct {\n  KEY name;\n} NAMED;\n\ntypedef struct {\n  NAMED **v;\n  unsigned char power;\n  size_t size;\n  size_t used;\n  const XML_Memory_Handling_Suite *mem;\n} HASH_TABLE;\n\nstatic size_t keylen(KEY s);\n\nstatic void copy_salt_to_sipkey(XML_Parser parser, struct sipkey *key);\n\n/* For probing (after a collision) we need a step size relative prime\n   to the hash table size, which is a power of 2. We use double-hashing,\n   since we can calculate a second hash value cheaply by taking those bits\n   of the first hash value that were discarded (masked out) when the table\n   index was calculated: index = hash & mask, where mask = table->size - 1.\n   We limit the maximum step size to table->size / 4 (mask >> 2) and make\n   it odd, since odd numbers are always relative prime to a power of 2.\n*/\n#define SECOND_HASH(hash, mask, power)                                         \\\n  ((((hash) & ~(mask)) >> ((power)-1)) & ((mask) >> 2))\n#define PROBE_STEP(hash, mask, power)                                          \\\n  ((unsigned char)((SECOND_HASH(hash, mask, power)) | 1))\n\ntypedef struct {\n  NAMED **p;\n  NAMED **end;\n} HASH_TABLE_ITER;\n\n#define INIT_TAG_BUF_SIZE 32 /* must be a multiple of sizeof(XML_Char) */\n#define INIT_DATA_BUF_SIZE 1024\n#define INIT_ATTS_SIZE 16\n#define INIT_ATTS_VERSION 0xFFFFFFFF\n#define INIT_BLOCK_SIZE 1024\n#define INIT_BUFFER_SIZE 1024\n\n#define EXPAND_SPARE 24\n\ntypedef struct binding {\n  struct prefix *prefix;\n  struct binding *nextTagBinding;\n  struct binding *prevPrefixBinding;\n  const struct attribute_id *attId;\n  XML_Char *uri;\n  int uriLen;\n  int uriAlloc;\n} BINDING;\n\ntypedef struct prefix {\n  const XML_Char *name;\n  BINDING *binding;\n} PREFIX;\n\ntypedef struct {\n  const XML_Char *str;\n  const XML_Char *localPart;\n  const XML_Char *prefix;\n  int strLen;\n  int uriLen;\n  int prefixLen;\n} TAG_NAME;\n\n/* TAG represents an open element.\n   The name of the element is stored in both the document and API\n   encodings.  The memory buffer 'buf' is a separately-allocated\n   memory area which stores the name.  During the XML_Parse()/\n   XMLParseBuffer() when the element is open, the memory for the 'raw'\n   version of the name (in the document encoding) is shared with the\n   document buffer.  If the element is open across calls to\n   XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to\n   contain the 'raw' name as well.\n\n   A parser re-uses these structures, maintaining a list of allocated\n   TAG objects in a free list.\n*/\ntypedef struct tag {\n  struct tag *parent;  /* parent of this element */\n  const char *rawName; /* tagName in the original encoding */\n  int rawNameLength;\n  TAG_NAME name; /* tagName in the API encoding */\n  char *buf;     /* buffer for name components */\n  char *bufEnd;  /* end of the buffer */\n  BINDING *bindings;\n} TAG;\n\ntypedef struct {\n  const XML_Char *name;\n  const XML_Char *textPtr;\n  int textLen;   /* length in XML_Chars */\n  int processed; /* # of processed bytes - when suspended */\n  const XML_Char *systemId;\n  const XML_Char *base;\n  const XML_Char *publicId;\n  const XML_Char *notation;\n  XML_Bool open;\n  XML_Bool is_param;\n  XML_Bool is_internal; /* true if declared in internal subset outside PE */\n} ENTITY;\n\ntypedef struct {\n  enum XML_Content_Type type;\n  enum XML_Content_Quant quant;\n  const XML_Char *name;\n  int firstchild;\n  int lastchild;\n  int childcnt;\n  int nextsib;\n} CONTENT_SCAFFOLD;\n\n#define INIT_SCAFFOLD_ELEMENTS 32\n\ntypedef struct block {\n  struct block *next;\n  int size;\n  XML_Char s[1];\n} BLOCK;\n\ntypedef struct {\n  BLOCK *blocks;\n  BLOCK *freeBlocks;\n  const XML_Char *end;\n  XML_Char *ptr;\n  XML_Char *start;\n  const XML_Memory_Handling_Suite *mem;\n} STRING_POOL;\n\n/* The XML_Char before the name is used to determine whether\n   an attribute has been specified. */\ntypedef struct attribute_id {\n  XML_Char *name;\n  PREFIX *prefix;\n  XML_Bool maybeTokenized;\n  XML_Bool xmlns;\n} ATTRIBUTE_ID;\n\ntypedef struct {\n  const ATTRIBUTE_ID *id;\n  XML_Bool isCdata;\n  const XML_Char *value;\n} DEFAULT_ATTRIBUTE;\n\ntypedef struct {\n  unsigned long version;\n  unsigned long hash;\n  const XML_Char *uriName;\n} NS_ATT;\n\ntypedef struct {\n  const XML_Char *name;\n  PREFIX *prefix;\n  const ATTRIBUTE_ID *idAtt;\n  int nDefaultAtts;\n  int allocDefaultAtts;\n  DEFAULT_ATTRIBUTE *defaultAtts;\n} ELEMENT_TYPE;\n\ntypedef struct {\n  HASH_TABLE generalEntities;\n  HASH_TABLE elementTypes;\n  HASH_TABLE attributeIds;\n  HASH_TABLE prefixes;\n  STRING_POOL pool;\n  STRING_POOL entityValuePool;\n  /* false once a parameter entity reference has been skipped */\n  XML_Bool keepProcessing;\n  /* true once an internal or external PE reference has been encountered;\n     this includes the reference to an external subset */\n  XML_Bool hasParamEntityRefs;\n  XML_Bool standalone;\n#ifdef XML_DTD\n  /* indicates if external PE has been read */\n  XML_Bool paramEntityRead;\n  HASH_TABLE paramEntities;\n#endif /* XML_DTD */\n  PREFIX defaultPrefix;\n  /* === scaffolding for building content model === */\n  XML_Bool in_eldecl;\n  CONTENT_SCAFFOLD *scaffold;\n  unsigned contentStringLen;\n  unsigned scaffSize;\n  unsigned scaffCount;\n  int scaffLevel;\n  int *scaffIndex;\n} DTD;\n\ntypedef struct open_internal_entity {\n  const char *internalEventPtr;\n  const char *internalEventEndPtr;\n  struct open_internal_entity *next;\n  ENTITY *entity;\n  int startTagLevel;\n  XML_Bool betweenDecl; /* WFC: PE Between Declarations */\n} OPEN_INTERNAL_ENTITY;\n\ntypedef enum XML_Error PTRCALL Processor(XML_Parser parser, const char *start,\n                                         const char *end, const char **endPtr);\n\nstatic Processor prologProcessor;\nstatic Processor prologInitProcessor;\nstatic Processor contentProcessor;\nstatic Processor cdataSectionProcessor;\n#ifdef XML_DTD\nstatic Processor ignoreSectionProcessor;\nstatic Processor externalParEntProcessor;\nstatic Processor externalParEntInitProcessor;\nstatic Processor entityValueProcessor;\nstatic Processor entityValueInitProcessor;\n#endif /* XML_DTD */\nstatic Processor epilogProcessor;\nstatic Processor errorProcessor;\nstatic Processor externalEntityInitProcessor;\nstatic Processor externalEntityInitProcessor2;\nstatic Processor externalEntityInitProcessor3;\nstatic Processor externalEntityContentProcessor;\nstatic Processor internalEntityProcessor;\n\nstatic enum XML_Error handleUnknownEncoding(XML_Parser parser,\n                                            const XML_Char *encodingName);\nstatic enum XML_Error processXmlDecl(XML_Parser parser, int isGeneralTextEntity,\n                                     const char *s, const char *next);\nstatic enum XML_Error initializeEncoding(XML_Parser parser);\nstatic enum XML_Error doProlog(XML_Parser parser, const ENCODING *enc,\n                               const char *s, const char *end, int tok,\n                               const char *next, const char **nextPtr,\n                               XML_Bool haveMore, XML_Bool allowClosingDoctype);\nstatic enum XML_Error processInternalEntity(XML_Parser parser, ENTITY *entity,\n                                            XML_Bool betweenDecl);\nstatic enum XML_Error doContent(XML_Parser parser, int startTagLevel,\n                                const ENCODING *enc, const char *start,\n                                const char *end, const char **endPtr,\n                                XML_Bool haveMore);\nstatic enum XML_Error doCdataSection(XML_Parser parser, const ENCODING *,\n                                     const char **startPtr, const char *end,\n                                     const char **nextPtr, XML_Bool haveMore);\n#ifdef XML_DTD\nstatic enum XML_Error doIgnoreSection(XML_Parser parser, const ENCODING *,\n                                      const char **startPtr, const char *end,\n                                      const char **nextPtr, XML_Bool haveMore);\n#endif /* XML_DTD */\n\nstatic void freeBindings(XML_Parser parser, BINDING *bindings);\nstatic enum XML_Error storeAtts(XML_Parser parser, const ENCODING *,\n                                const char *s, TAG_NAME *tagNamePtr,\n                                BINDING **bindingsPtr);\nstatic enum XML_Error addBinding(XML_Parser parser, PREFIX *prefix,\n                                 const ATTRIBUTE_ID *attId, const XML_Char *uri,\n                                 BINDING **bindingsPtr);\nstatic int defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata,\n                           XML_Bool isId, const XML_Char *dfltValue,\n                           XML_Parser parser);\nstatic enum XML_Error storeAttributeValue(XML_Parser parser, const ENCODING *,\n                                          XML_Bool isCdata, const char *,\n                                          const char *, STRING_POOL *);\nstatic enum XML_Error appendAttributeValue(XML_Parser parser, const ENCODING *,\n                                           XML_Bool isCdata, const char *,\n                                           const char *, STRING_POOL *);\nstatic ATTRIBUTE_ID *getAttributeId(XML_Parser parser, const ENCODING *enc,\n                                    const char *start, const char *end);\nstatic int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *);\nstatic enum XML_Error storeEntityValue(XML_Parser parser, const ENCODING *enc,\n                                       const char *start, const char *end);\nstatic int reportProcessingInstruction(XML_Parser parser, const ENCODING *enc,\n                                       const char *start, const char *end);\nstatic int reportComment(XML_Parser parser, const ENCODING *enc,\n                         const char *start, const char *end);\nstatic void reportDefault(XML_Parser parser, const ENCODING *enc,\n                          const char *start, const char *end);\n\nstatic const XML_Char *getContext(XML_Parser parser);\nstatic XML_Bool setContext(XML_Parser parser, const XML_Char *context);\n\nstatic void FASTCALL normalizePublicId(XML_Char *s);\n\nstatic DTD *dtdCreate(const XML_Memory_Handling_Suite *ms);\n/* do not call if m_parentParser != NULL */\nstatic void dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms);\nstatic void dtdDestroy(DTD *p, XML_Bool isDocEntity,\n                       const XML_Memory_Handling_Suite *ms);\nstatic int dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd,\n                   const XML_Memory_Handling_Suite *ms);\nstatic int copyEntityTable(XML_Parser oldParser, HASH_TABLE *, STRING_POOL *,\n                           const HASH_TABLE *);\nstatic NAMED *lookup(XML_Parser parser, HASH_TABLE *table, KEY name,\n                     size_t createSize);\nstatic void FASTCALL hashTableInit(HASH_TABLE *,\n                                   const XML_Memory_Handling_Suite *ms);\nstatic void FASTCALL hashTableClear(HASH_TABLE *);\nstatic void FASTCALL hashTableDestroy(HASH_TABLE *);\nstatic void FASTCALL hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *);\nstatic NAMED *FASTCALL hashTableIterNext(HASH_TABLE_ITER *);\n\nstatic void FASTCALL poolInit(STRING_POOL *,\n                              const XML_Memory_Handling_Suite *ms);\nstatic void FASTCALL poolClear(STRING_POOL *);\nstatic void FASTCALL poolDestroy(STRING_POOL *);\nstatic XML_Char *poolAppend(STRING_POOL *pool, const ENCODING *enc,\n                            const char *ptr, const char *end);\nstatic XML_Char *poolStoreString(STRING_POOL *pool, const ENCODING *enc,\n                                 const char *ptr, const char *end);\nstatic XML_Bool FASTCALL poolGrow(STRING_POOL *pool);\nstatic const XML_Char *FASTCALL poolCopyString(STRING_POOL *pool,\n                                               const XML_Char *s);\nstatic const XML_Char *poolCopyStringN(STRING_POOL *pool, const XML_Char *s,\n                                       int n);\nstatic const XML_Char *FASTCALL poolAppendString(STRING_POOL *pool,\n                                                 const XML_Char *s);\n\nstatic int FASTCALL nextScaffoldPart(XML_Parser parser);\nstatic XML_Content *build_model(XML_Parser parser);\nstatic ELEMENT_TYPE *getElementType(XML_Parser parser, const ENCODING *enc,\n                                    const char *ptr, const char *end);\n\nstatic XML_Char *copyString(const XML_Char *s,\n                            const XML_Memory_Handling_Suite *memsuite);\n\nstatic unsigned long generate_hash_secret_salt(XML_Parser parser);\nstatic XML_Bool startParsing(XML_Parser parser);\n\nstatic XML_Parser parserCreate(const XML_Char *encodingName,\n                               const XML_Memory_Handling_Suite *memsuite,\n                               const XML_Char *nameSep, DTD *dtd);\n\nstatic void parserInit(XML_Parser parser, const XML_Char *encodingName);\n\n#define poolStart(pool) ((pool)->start)\n#define poolEnd(pool) ((pool)->ptr)\n#define poolLength(pool) ((pool)->ptr - (pool)->start)\n#define poolChop(pool) ((void)--(pool->ptr))\n#define poolLastChar(pool) (((pool)->ptr)[-1])\n#define poolDiscard(pool) ((pool)->ptr = (pool)->start)\n#define poolFinish(pool) ((pool)->start = (pool)->ptr)\n#define poolAppendChar(pool, c)                                                \\\n  (((pool)->ptr == (pool)->end && ! poolGrow(pool))                            \\\n       ? 0                                                                     \\\n       : ((*((pool)->ptr)++ = c), 1))\n\nstruct XML_ParserStruct {\n  /* The first member must be m_userData so that the XML_GetUserData\n     macro works. */\n  void *m_userData;\n  void *m_handlerArg;\n  char *m_buffer;\n  const XML_Memory_Handling_Suite m_mem;\n  /* first character to be parsed */\n  const char *m_bufferPtr;\n  /* past last character to be parsed */\n  char *m_bufferEnd;\n  /* allocated end of m_buffer */\n  const char *m_bufferLim;\n  XML_Index m_parseEndByteIndex;\n  const char *m_parseEndPtr;\n  XML_Char *m_dataBuf;\n  XML_Char *m_dataBufEnd;\n  XML_StartElementHandler m_startElementHandler;\n  XML_EndElementHandler m_endElementHandler;\n  XML_CharacterDataHandler m_characterDataHandler;\n  XML_ProcessingInstructionHandler m_processingInstructionHandler;\n  XML_CommentHandler m_commentHandler;\n  XML_StartCdataSectionHandler m_startCdataSectionHandler;\n  XML_EndCdataSectionHandler m_endCdataSectionHandler;\n  XML_DefaultHandler m_defaultHandler;\n  XML_StartDoctypeDeclHandler m_startDoctypeDeclHandler;\n  XML_EndDoctypeDeclHandler m_endDoctypeDeclHandler;\n  XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler;\n  XML_NotationDeclHandler m_notationDeclHandler;\n  XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler;\n  XML_EndNamespaceDeclHandler m_endNamespaceDeclHandler;\n  XML_NotStandaloneHandler m_notStandaloneHandler;\n  XML_ExternalEntityRefHandler m_externalEntityRefHandler;\n  XML_Parser m_externalEntityRefHandlerArg;\n  XML_SkippedEntityHandler m_skippedEntityHandler;\n  XML_UnknownEncodingHandler m_unknownEncodingHandler;\n  XML_ElementDeclHandler m_elementDeclHandler;\n  XML_AttlistDeclHandler m_attlistDeclHandler;\n  XML_EntityDeclHandler m_entityDeclHandler;\n  XML_XmlDeclHandler m_xmlDeclHandler;\n  const ENCODING *m_encoding;\n  INIT_ENCODING m_initEncoding;\n  const ENCODING *m_internalEncoding;\n  const XML_Char *m_protocolEncodingName;\n  XML_Bool m_ns;\n  XML_Bool m_ns_triplets;\n  void *m_unknownEncodingMem;\n  void *m_unknownEncodingData;\n  void *m_unknownEncodingHandlerData;\n  void(XMLCALL *m_unknownEncodingRelease)(void *);\n  PROLOG_STATE m_prologState;\n  Processor *m_processor;\n  enum XML_Error m_errorCode;\n  const char *m_eventPtr;\n  const char *m_eventEndPtr;\n  const char *m_positionPtr;\n  OPEN_INTERNAL_ENTITY *m_openInternalEntities;\n  OPEN_INTERNAL_ENTITY *m_freeInternalEntities;\n  XML_Bool m_defaultExpandInternalEntities;\n  int m_tagLevel;\n  ENTITY *m_declEntity;\n  const XML_Char *m_doctypeName;\n  const XML_Char *m_doctypeSysid;\n  const XML_Char *m_doctypePubid;\n  const XML_Char *m_declAttributeType;\n  const XML_Char *m_declNotationName;\n  const XML_Char *m_declNotationPublicId;\n  ELEMENT_TYPE *m_declElementType;\n  ATTRIBUTE_ID *m_declAttributeId;\n  XML_Bool m_declAttributeIsCdata;\n  XML_Bool m_declAttributeIsId;\n  DTD *m_dtd;\n  const XML_Char *m_curBase;\n  TAG *m_tagStack;\n  TAG *m_freeTagList;\n  BINDING *m_inheritedBindings;\n  BINDING *m_freeBindingList;\n  int m_attsSize;\n  int m_nSpecifiedAtts;\n  int m_idAttIndex;\n  ATTRIBUTE *m_atts;\n  NS_ATT *m_nsAtts;\n  unsigned long m_nsAttsVersion;\n  unsigned char m_nsAttsPower;\n#ifdef XML_ATTR_INFO\n  XML_AttrInfo *m_attInfo;\n#endif\n  POSITION m_position;\n  STRING_POOL m_tempPool;\n  STRING_POOL m_temp2Pool;\n  char *m_groupConnector;\n  unsigned int m_groupSize;\n  XML_Char m_namespaceSeparator;\n  XML_Parser m_parentParser;\n  XML_ParsingStatus m_parsingStatus;\n#ifdef XML_DTD\n  XML_Bool m_isParamEntity;\n  XML_Bool m_useForeignDTD;\n  enum XML_ParamEntityParsing m_paramEntityParsing;\n#endif\n  unsigned long m_hash_secret_salt;\n};\n\n#define MALLOC(parser, s) (parser->m_mem.malloc_fcn((s)))\n#define REALLOC(parser, p, s) (parser->m_mem.realloc_fcn((p), (s)))\n#define FREE(parser, p) (parser->m_mem.free_fcn((p)))\n\nXML_Parser XMLCALL\nXML_ParserCreate(const XML_Char *encodingName) {\n  return XML_ParserCreate_MM(encodingName, NULL, NULL);\n}\n\nXML_Parser XMLCALL\nXML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep) {\n  XML_Char tmp[2];\n  *tmp = nsSep;\n  return XML_ParserCreate_MM(encodingName, NULL, tmp);\n}\n\nstatic const XML_Char implicitContext[]\n    = {ASCII_x,     ASCII_m,     ASCII_l,      ASCII_EQUALS, ASCII_h,\n       ASCII_t,     ASCII_t,     ASCII_p,      ASCII_COLON,  ASCII_SLASH,\n       ASCII_SLASH, ASCII_w,     ASCII_w,      ASCII_w,      ASCII_PERIOD,\n       ASCII_w,     ASCII_3,     ASCII_PERIOD, ASCII_o,      ASCII_r,\n       ASCII_g,     ASCII_SLASH, ASCII_X,      ASCII_M,      ASCII_L,\n       ASCII_SLASH, ASCII_1,     ASCII_9,      ASCII_9,      ASCII_8,\n       ASCII_SLASH, ASCII_n,     ASCII_a,      ASCII_m,      ASCII_e,\n       ASCII_s,     ASCII_p,     ASCII_a,      ASCII_c,      ASCII_e,\n       '\\0'};\n\n/* To avoid warnings about unused functions: */\n#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM)\n\n#  if defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM)\n\n/* Obtain entropy on Linux 3.17+ */\nstatic int\nwriteRandomBytes_getrandom_nonblock(void *target, size_t count) {\n  int success = 0; /* full count bytes written? */\n  size_t bytesWrittenTotal = 0;\n  const unsigned int getrandomFlags = GRND_NONBLOCK;\n\n  do {\n    void *const currentTarget = (void *)((char *)target + bytesWrittenTotal);\n    const size_t bytesToWrite = count - bytesWrittenTotal;\n\n    const int bytesWrittenMore =\n#    if defined(HAVE_GETRANDOM)\n        getrandom(currentTarget, bytesToWrite, getrandomFlags);\n#    else\n        syscall(SYS_getrandom, currentTarget, bytesToWrite, getrandomFlags);\n#    endif\n\n    if (bytesWrittenMore > 0) {\n      bytesWrittenTotal += bytesWrittenMore;\n      if (bytesWrittenTotal >= count)\n        success = 1;\n    }\n  } while (! success && (errno == EINTR));\n\n  return success;\n}\n\n#  endif /* defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) */\n\n#  if ! defined(_WIN32) && defined(XML_DEV_URANDOM)\n\n/* Extract entropy from /dev/urandom */\nstatic int\nwriteRandomBytes_dev_urandom(void *target, size_t count) {\n  int success = 0; /* full count bytes written? */\n  size_t bytesWrittenTotal = 0;\n\n  const int fd = open(\"/dev/urandom\", O_RDONLY);\n  if (fd < 0) {\n    return 0;\n  }\n\n  do {\n    void *const currentTarget = (void *)((char *)target + bytesWrittenTotal);\n    const size_t bytesToWrite = count - bytesWrittenTotal;\n\n    const ssize_t bytesWrittenMore = read(fd, currentTarget, bytesToWrite);\n\n    if (bytesWrittenMore > 0) {\n      bytesWrittenTotal += bytesWrittenMore;\n      if (bytesWrittenTotal >= count)\n        success = 1;\n    }\n  } while (! success && (errno == EINTR));\n\n  close(fd);\n  return success;\n}\n\n#  endif /* ! defined(_WIN32) && defined(XML_DEV_URANDOM) */\n\n#endif /* ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) */\n\n#if defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF)\n\nstatic void\nwriteRandomBytes_arc4random(void *target, size_t count) {\n  size_t bytesWrittenTotal = 0;\n\n  while (bytesWrittenTotal < count) {\n    const uint32_t random32 = arc4random();\n    size_t i = 0;\n\n    for (; (i < sizeof(random32)) && (bytesWrittenTotal < count);\n         i++, bytesWrittenTotal++) {\n      const uint8_t random8 = (uint8_t)(random32 >> (i * 8));\n      ((uint8_t *)target)[bytesWrittenTotal] = random8;\n    }\n  }\n}\n\n#endif /* defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF) */\n\n#ifdef _WIN32\n\n/* Obtain entropy on Windows using the rand_s() function which\n * generates cryptographically secure random numbers.  Internally it\n * uses RtlGenRandom API which is present in Windows XP and later.\n */\nstatic int\nwriteRandomBytes_rand_s(void *target, size_t count) {\n  size_t bytesWrittenTotal = 0;\n\n  while (bytesWrittenTotal < count) {\n    unsigned int random32 = 0;\n    size_t i = 0;\n\n    if (rand_s(&random32))\n      return 0; /* failure */\n\n    for (; (i < sizeof(random32)) && (bytesWrittenTotal < count);\n         i++, bytesWrittenTotal++) {\n      const uint8_t random8 = (uint8_t)(random32 >> (i * 8));\n      ((uint8_t *)target)[bytesWrittenTotal] = random8;\n    }\n  }\n  return 1; /* success */\n}\n\n#endif /* _WIN32 */\n\n#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM)\n\nstatic unsigned long\ngather_time_entropy(void) {\n#  ifdef _WIN32\n  FILETIME ft;\n  GetSystemTimeAsFileTime(&ft); /* never fails */\n  return ft.dwHighDateTime ^ ft.dwLowDateTime;\n#  else\n  struct timeval tv;\n  int gettimeofday_res;\n\n  gettimeofday_res = gettimeofday(&tv, NULL);\n\n#    if defined(NDEBUG)\n  (void)gettimeofday_res;\n#    else\n  assert(gettimeofday_res == 0);\n#    endif /* defined(NDEBUG) */\n\n  /* Microseconds time is <20 bits entropy */\n  return tv.tv_usec;\n#  endif\n}\n\n#endif /* ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) */\n\nstatic unsigned long\nENTROPY_DEBUG(const char *label, unsigned long entropy) {\n  const char *const EXPAT_ENTROPY_DEBUG = getenv(\"EXPAT_ENTROPY_DEBUG\");\n  if (EXPAT_ENTROPY_DEBUG && ! strcmp(EXPAT_ENTROPY_DEBUG, \"1\")) {\n    fprintf(stderr, \"Entropy: %s --> 0x%0*lx (%lu bytes)\\n\", label,\n            (int)sizeof(entropy) * 2, entropy, (unsigned long)sizeof(entropy));\n  }\n  return entropy;\n}\n\nstatic unsigned long\ngenerate_hash_secret_salt(XML_Parser parser) {\n  unsigned long entropy;\n  (void)parser;\n\n  /* \"Failproof\" high quality providers: */\n#if defined(HAVE_ARC4RANDOM_BUF)\n  arc4random_buf(&entropy, sizeof(entropy));\n  return ENTROPY_DEBUG(\"arc4random_buf\", entropy);\n#elif defined(HAVE_ARC4RANDOM)\n  writeRandomBytes_arc4random((void *)&entropy, sizeof(entropy));\n  return ENTROPY_DEBUG(\"arc4random\", entropy);\n#else\n  /* Try high quality providers first .. */\n#  ifdef _WIN32\n  if (writeRandomBytes_rand_s((void *)&entropy, sizeof(entropy))) {\n    return ENTROPY_DEBUG(\"rand_s\", entropy);\n  }\n#  elif defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM)\n  if (writeRandomBytes_getrandom_nonblock((void *)&entropy, sizeof(entropy))) {\n    return ENTROPY_DEBUG(\"getrandom\", entropy);\n  }\n#  endif\n#  if ! defined(_WIN32) && defined(XML_DEV_URANDOM)\n  if (writeRandomBytes_dev_urandom((void *)&entropy, sizeof(entropy))) {\n    return ENTROPY_DEBUG(\"/dev/urandom\", entropy);\n  }\n#  endif /* ! defined(_WIN32) && defined(XML_DEV_URANDOM) */\n  /* .. and self-made low quality for backup: */\n\n  /* Process ID is 0 bits entropy if attacker has local access */\n  entropy = gather_time_entropy() ^ getpid();\n\n  /* Factors are 2^31-1 and 2^61-1 (Mersenne primes M31 and M61) */\n  if (sizeof(unsigned long) == 4) {\n    return ENTROPY_DEBUG(\"fallback(4)\", entropy * 2147483647);\n  } else {\n    return ENTROPY_DEBUG(\"fallback(8)\",\n                         entropy * (unsigned long)2305843009213693951ULL);\n  }\n#endif\n}\n\nstatic unsigned long\nget_hash_secret_salt(XML_Parser parser) {\n  if (parser->m_parentParser != NULL)\n    return get_hash_secret_salt(parser->m_parentParser);\n  return parser->m_hash_secret_salt;\n}\n\nstatic XML_Bool /* only valid for root parser */\nstartParsing(XML_Parser parser) {\n  /* hash functions must be initialized before setContext() is called */\n  if (parser->m_hash_secret_salt == 0)\n    parser->m_hash_secret_salt = generate_hash_secret_salt(parser);\n  if (parser->m_ns) {\n    /* implicit context only set for root parser, since child\n       parsers (i.e. external entity parsers) will inherit it\n    */\n    return setContext(parser, implicitContext);\n  }\n  return XML_TRUE;\n}\n\nXML_Parser XMLCALL\nXML_ParserCreate_MM(const XML_Char *encodingName,\n                    const XML_Memory_Handling_Suite *memsuite,\n                    const XML_Char *nameSep) {\n  return parserCreate(encodingName, memsuite, nameSep, NULL);\n}\n\nstatic XML_Parser\nparserCreate(const XML_Char *encodingName,\n             const XML_Memory_Handling_Suite *memsuite, const XML_Char *nameSep,\n             DTD *dtd) {\n  XML_Parser parser;\n\n  if (memsuite) {\n    XML_Memory_Handling_Suite *mtemp;\n    parser = (XML_Parser)memsuite->malloc_fcn(sizeof(struct XML_ParserStruct));\n    if (parser != NULL) {\n      mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem);\n      mtemp->malloc_fcn = memsuite->malloc_fcn;\n      mtemp->realloc_fcn = memsuite->realloc_fcn;\n      mtemp->free_fcn = memsuite->free_fcn;\n    }\n  } else {\n    XML_Memory_Handling_Suite *mtemp;\n    parser = (XML_Parser)malloc(sizeof(struct XML_ParserStruct));\n    if (parser != NULL) {\n      mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem);\n      mtemp->malloc_fcn = malloc;\n      mtemp->realloc_fcn = realloc;\n      mtemp->free_fcn = free;\n    }\n  }\n\n  if (! parser)\n    return parser;\n\n  parser->m_buffer = NULL;\n  parser->m_bufferLim = NULL;\n\n  parser->m_attsSize = INIT_ATTS_SIZE;\n  parser->m_atts\n      = (ATTRIBUTE *)MALLOC(parser, parser->m_attsSize * sizeof(ATTRIBUTE));\n  if (parser->m_atts == NULL) {\n    FREE(parser, parser);\n    return NULL;\n  }\n#ifdef XML_ATTR_INFO\n  parser->m_attInfo = (XML_AttrInfo *)MALLOC(\n      parser, parser->m_attsSize * sizeof(XML_AttrInfo));\n  if (parser->m_attInfo == NULL) {\n    FREE(parser, parser->m_atts);\n    FREE(parser, parser);\n    return NULL;\n  }\n#endif\n  parser->m_dataBuf\n      = (XML_Char *)MALLOC(parser, INIT_DATA_BUF_SIZE * sizeof(XML_Char));\n  if (parser->m_dataBuf == NULL) {\n    FREE(parser, parser->m_atts);\n#ifdef XML_ATTR_INFO\n    FREE(parser, parser->m_attInfo);\n#endif\n    FREE(parser, parser);\n    return NULL;\n  }\n  parser->m_dataBufEnd = parser->m_dataBuf + INIT_DATA_BUF_SIZE;\n\n  if (dtd)\n    parser->m_dtd = dtd;\n  else {\n    parser->m_dtd = dtdCreate(&parser->m_mem);\n    if (parser->m_dtd == NULL) {\n      FREE(parser, parser->m_dataBuf);\n      FREE(parser, parser->m_atts);\n#ifdef XML_ATTR_INFO\n      FREE(parser, parser->m_attInfo);\n#endif\n      FREE(parser, parser);\n      return NULL;\n    }\n  }\n\n  parser->m_freeBindingList = NULL;\n  parser->m_freeTagList = NULL;\n  parser->m_freeInternalEntities = NULL;\n\n  parser->m_groupSize = 0;\n  parser->m_groupConnector = NULL;\n\n  parser->m_unknownEncodingHandler = NULL;\n  parser->m_unknownEncodingHandlerData = NULL;\n\n  parser->m_namespaceSeparator = ASCII_EXCL;\n  parser->m_ns = XML_FALSE;\n  parser->m_ns_triplets = XML_FALSE;\n\n  parser->m_nsAtts = NULL;\n  parser->m_nsAttsVersion = 0;\n  parser->m_nsAttsPower = 0;\n\n  parser->m_protocolEncodingName = NULL;\n\n  poolInit(&parser->m_tempPool, &(parser->m_mem));\n  poolInit(&parser->m_temp2Pool, &(parser->m_mem));\n  parserInit(parser, encodingName);\n\n  if (encodingName && ! parser->m_protocolEncodingName) {\n    XML_ParserFree(parser);\n    return NULL;\n  }\n\n  if (nameSep) {\n    parser->m_ns = XML_TRUE;\n    parser->m_internalEncoding = XmlGetInternalEncodingNS();\n    parser->m_namespaceSeparator = *nameSep;\n  } else {\n    parser->m_internalEncoding = XmlGetInternalEncoding();\n  }\n\n  return parser;\n}\n\nstatic void\nparserInit(XML_Parser parser, const XML_Char *encodingName) {\n  parser->m_processor = prologInitProcessor;\n  XmlPrologStateInit(&parser->m_prologState);\n  if (encodingName != NULL) {\n    parser->m_protocolEncodingName = copyString(encodingName, &(parser->m_mem));\n  }\n  parser->m_curBase = NULL;\n  XmlInitEncoding(&parser->m_initEncoding, &parser->m_encoding, 0);\n  parser->m_userData = NULL;\n  parser->m_handlerArg = NULL;\n  parser->m_startElementHandler = NULL;\n  parser->m_endElementHandler = NULL;\n  parser->m_characterDataHandler = NULL;\n  parser->m_processingInstructionHandler = NULL;\n  parser->m_commentHandler = NULL;\n  parser->m_startCdataSectionHandler = NULL;\n  parser->m_endCdataSectionHandler = NULL;\n  parser->m_defaultHandler = NULL;\n  parser->m_startDoctypeDeclHandler = NULL;\n  parser->m_endDoctypeDeclHandler = NULL;\n  parser->m_unparsedEntityDeclHandler = NULL;\n  parser->m_notationDeclHandler = NULL;\n  parser->m_startNamespaceDeclHandler = NULL;\n  parser->m_endNamespaceDeclHandler = NULL;\n  parser->m_notStandaloneHandler = NULL;\n  parser->m_externalEntityRefHandler = NULL;\n  parser->m_externalEntityRefHandlerArg = parser;\n  parser->m_skippedEntityHandler = NULL;\n  parser->m_elementDeclHandler = NULL;\n  parser->m_attlistDeclHandler = NULL;\n  parser->m_entityDeclHandler = NULL;\n  parser->m_xmlDeclHandler = NULL;\n  parser->m_bufferPtr = parser->m_buffer;\n  parser->m_bufferEnd = parser->m_buffer;\n  parser->m_parseEndByteIndex = 0;\n  parser->m_parseEndPtr = NULL;\n  parser->m_declElementType = NULL;\n  parser->m_declAttributeId = NULL;\n  parser->m_declEntity = NULL;\n  parser->m_doctypeName = NULL;\n  parser->m_doctypeSysid = NULL;\n  parser->m_doctypePubid = NULL;\n  parser->m_declAttributeType = NULL;\n  parser->m_declNotationName = NULL;\n  parser->m_declNotationPublicId = NULL;\n  parser->m_declAttributeIsCdata = XML_FALSE;\n  parser->m_declAttributeIsId = XML_FALSE;\n  memset(&parser->m_position, 0, sizeof(POSITION));\n  parser->m_errorCode = XML_ERROR_NONE;\n  parser->m_eventPtr = NULL;\n  parser->m_eventEndPtr = NULL;\n  parser->m_positionPtr = NULL;\n  parser->m_openInternalEntities = NULL;\n  parser->m_defaultExpandInternalEntities = XML_TRUE;\n  parser->m_tagLevel = 0;\n  parser->m_tagStack = NULL;\n  parser->m_inheritedBindings = NULL;\n  parser->m_nSpecifiedAtts = 0;\n  parser->m_unknownEncodingMem = NULL;\n  parser->m_unknownEncodingRelease = NULL;\n  parser->m_unknownEncodingData = NULL;\n  parser->m_parentParser = NULL;\n  parser->m_parsingStatus.parsing = XML_INITIALIZED;\n#ifdef XML_DTD\n  parser->m_isParamEntity = XML_FALSE;\n  parser->m_useForeignDTD = XML_FALSE;\n  parser->m_paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;\n#endif\n  parser->m_hash_secret_salt = 0;\n}\n\n/* moves list of bindings to m_freeBindingList */\nstatic void FASTCALL\nmoveToFreeBindingList(XML_Parser parser, BINDING *bindings) {\n  while (bindings) {\n    BINDING *b = bindings;\n    bindings = bindings->nextTagBinding;\n    b->nextTagBinding = parser->m_freeBindingList;\n    parser->m_freeBindingList = b;\n  }\n}\n\nXML_Bool XMLCALL\nXML_ParserReset(XML_Parser parser, const XML_Char *encodingName) {\n  TAG *tStk;\n  OPEN_INTERNAL_ENTITY *openEntityList;\n\n  if (parser == NULL)\n    return XML_FALSE;\n\n  if (parser->m_parentParser)\n    return XML_FALSE;\n  /* move m_tagStack to m_freeTagList */\n  tStk = parser->m_tagStack;\n  while (tStk) {\n    TAG *tag = tStk;\n    tStk = tStk->parent;\n    tag->parent = parser->m_freeTagList;\n    moveToFreeBindingList(parser, tag->bindings);\n    tag->bindings = NULL;\n    parser->m_freeTagList = tag;\n  }\n  /* move m_openInternalEntities to m_freeInternalEntities */\n  openEntityList = parser->m_openInternalEntities;\n  while (openEntityList) {\n    OPEN_INTERNAL_ENTITY *openEntity = openEntityList;\n    openEntityList = openEntity->next;\n    openEntity->next = parser->m_freeInternalEntities;\n    parser->m_freeInternalEntities = openEntity;\n  }\n  moveToFreeBindingList(parser, parser->m_inheritedBindings);\n  FREE(parser, parser->m_unknownEncodingMem);\n  if (parser->m_unknownEncodingRelease)\n    parser->m_unknownEncodingRelease(parser->m_unknownEncodingData);\n  poolClear(&parser->m_tempPool);\n  poolClear(&parser->m_temp2Pool);\n  FREE(parser, (void *)parser->m_protocolEncodingName);\n  parser->m_protocolEncodingName = NULL;\n  parserInit(parser, encodingName);\n  dtdReset(parser->m_dtd, &parser->m_mem);\n  return XML_TRUE;\n}\n\nenum XML_Status XMLCALL\nXML_SetEncoding(XML_Parser parser, const XML_Char *encodingName) {\n  if (parser == NULL)\n    return XML_STATUS_ERROR;\n  /* Block after XML_Parse()/XML_ParseBuffer() has been called.\n     XXX There's no way for the caller to determine which of the\n     XXX possible error cases caused the XML_STATUS_ERROR return.\n  */\n  if (parser->m_parsingStatus.parsing == XML_PARSING\n      || parser->m_parsingStatus.parsing == XML_SUSPENDED)\n    return XML_STATUS_ERROR;\n\n  /* Get rid of any previous encoding name */\n  FREE(parser, (void *)parser->m_protocolEncodingName);\n\n  if (encodingName == NULL)\n    /* No new encoding name */\n    parser->m_protocolEncodingName = NULL;\n  else {\n    /* Copy the new encoding name into allocated memory */\n    parser->m_protocolEncodingName = copyString(encodingName, &(parser->m_mem));\n    if (! parser->m_protocolEncodingName)\n      return XML_STATUS_ERROR;\n  }\n  return XML_STATUS_OK;\n}\n\nXML_Parser XMLCALL\nXML_ExternalEntityParserCreate(XML_Parser oldParser, const XML_Char *context,\n                               const XML_Char *encodingName) {\n  XML_Parser parser = oldParser;\n  DTD *newDtd = NULL;\n  DTD *oldDtd;\n  XML_StartElementHandler oldStartElementHandler;\n  XML_EndElementHandler oldEndElementHandler;\n  XML_CharacterDataHandler oldCharacterDataHandler;\n  XML_ProcessingInstructionHandler oldProcessingInstructionHandler;\n  XML_CommentHandler oldCommentHandler;\n  XML_StartCdataSectionHandler oldStartCdataSectionHandler;\n  XML_EndCdataSectionHandler oldEndCdataSectionHandler;\n  XML_DefaultHandler oldDefaultHandler;\n  XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler;\n  XML_NotationDeclHandler oldNotationDeclHandler;\n  XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler;\n  XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler;\n  XML_NotStandaloneHandler oldNotStandaloneHandler;\n  XML_ExternalEntityRefHandler oldExternalEntityRefHandler;\n  XML_SkippedEntityHandler oldSkippedEntityHandler;\n  XML_UnknownEncodingHandler oldUnknownEncodingHandler;\n  XML_ElementDeclHandler oldElementDeclHandler;\n  XML_AttlistDeclHandler oldAttlistDeclHandler;\n  XML_EntityDeclHandler oldEntityDeclHandler;\n  XML_XmlDeclHandler oldXmlDeclHandler;\n  ELEMENT_TYPE *oldDeclElementType;\n\n  void *oldUserData;\n  void *oldHandlerArg;\n  XML_Bool oldDefaultExpandInternalEntities;\n  XML_Parser oldExternalEntityRefHandlerArg;\n#ifdef XML_DTD\n  enum XML_ParamEntityParsing oldParamEntityParsing;\n  int oldInEntityValue;\n#endif\n  XML_Bool oldns_triplets;\n  /* Note that the new parser shares the same hash secret as the old\n     parser, so that dtdCopy and copyEntityTable can lookup values\n     from hash tables associated with either parser without us having\n     to worry which hash secrets each table has.\n  */\n  unsigned long oldhash_secret_salt;\n\n  /* Validate the oldParser parameter before we pull everything out of it */\n  if (oldParser == NULL)\n    return NULL;\n\n  /* Stash the original parser contents on the stack */\n  oldDtd = parser->m_dtd;\n  oldStartElementHandler = parser->m_startElementHandler;\n  oldEndElementHandler = parser->m_endElementHandler;\n  oldCharacterDataHandler = parser->m_characterDataHandler;\n  oldProcessingInstructionHandler = parser->m_processingInstructionHandler;\n  oldCommentHandler = parser->m_commentHandler;\n  oldStartCdataSectionHandler = parser->m_startCdataSectionHandler;\n  oldEndCdataSectionHandler = parser->m_endCdataSectionHandler;\n  oldDefaultHandler = parser->m_defaultHandler;\n  oldUnparsedEntityDeclHandler = parser->m_unparsedEntityDeclHandler;\n  oldNotationDeclHandler = parser->m_notationDeclHandler;\n  oldStartNamespaceDeclHandler = parser->m_startNamespaceDeclHandler;\n  oldEndNamespaceDeclHandler = parser->m_endNamespaceDeclHandler;\n  oldNotStandaloneHandler = parser->m_notStandaloneHandler;\n  oldExternalEntityRefHandler = parser->m_externalEntityRefHandler;\n  oldSkippedEntityHandler = parser->m_skippedEntityHandler;\n  oldUnknownEncodingHandler = parser->m_unknownEncodingHandler;\n  oldElementDeclHandler = parser->m_elementDeclHandler;\n  oldAttlistDeclHandler = parser->m_attlistDeclHandler;\n  oldEntityDeclHandler = parser->m_entityDeclHandler;\n  oldXmlDeclHandler = parser->m_xmlDeclHandler;\n  oldDeclElementType = parser->m_declElementType;\n\n  oldUserData = parser->m_userData;\n  oldHandlerArg = parser->m_handlerArg;\n  oldDefaultExpandInternalEntities = parser->m_defaultExpandInternalEntities;\n  oldExternalEntityRefHandlerArg = parser->m_externalEntityRefHandlerArg;\n#ifdef XML_DTD\n  oldParamEntityParsing = parser->m_paramEntityParsing;\n  oldInEntityValue = parser->m_prologState.inEntityValue;\n#endif\n  oldns_triplets = parser->m_ns_triplets;\n  /* Note that the new parser shares the same hash secret as the old\n     parser, so that dtdCopy and copyEntityTable can lookup values\n     from hash tables associated with either parser without us having\n     to worry which hash secrets each table has.\n  */\n  oldhash_secret_salt = parser->m_hash_secret_salt;\n\n#ifdef XML_DTD\n  if (! context)\n    newDtd = oldDtd;\n#endif /* XML_DTD */\n\n  /* Note that the magical uses of the pre-processor to make field\n     access look more like C++ require that `parser' be overwritten\n     here.  This makes this function more painful to follow than it\n     would be otherwise.\n  */\n  if (parser->m_ns) {\n    XML_Char tmp[2];\n    *tmp = parser->m_namespaceSeparator;\n    parser = parserCreate(encodingName, &parser->m_mem, tmp, newDtd);\n  } else {\n    parser = parserCreate(encodingName, &parser->m_mem, NULL, newDtd);\n  }\n\n  if (! parser)\n    return NULL;\n\n  parser->m_startElementHandler = oldStartElementHandler;\n  parser->m_endElementHandler = oldEndElementHandler;\n  parser->m_characterDataHandler = oldCharacterDataHandler;\n  parser->m_processingInstructionHandler = oldProcessingInstructionHandler;\n  parser->m_commentHandler = oldCommentHandler;\n  parser->m_startCdataSectionHandler = oldStartCdataSectionHandler;\n  parser->m_endCdataSectionHandler = oldEndCdataSectionHandler;\n  parser->m_defaultHandler = oldDefaultHandler;\n  parser->m_unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler;\n  parser->m_notationDeclHandler = oldNotationDeclHandler;\n  parser->m_startNamespaceDeclHandler = oldStartNamespaceDeclHandler;\n  parser->m_endNamespaceDeclHandler = oldEndNamespaceDeclHandler;\n  parser->m_notStandaloneHandler = oldNotStandaloneHandler;\n  parser->m_externalEntityRefHandler = oldExternalEntityRefHandler;\n  parser->m_skippedEntityHandler = oldSkippedEntityHandler;\n  parser->m_unknownEncodingHandler = oldUnknownEncodingHandler;\n  parser->m_elementDeclHandler = oldElementDeclHandler;\n  parser->m_attlistDeclHandler = oldAttlistDeclHandler;\n  parser->m_entityDeclHandler = oldEntityDeclHandler;\n  parser->m_xmlDeclHandler = oldXmlDeclHandler;\n  parser->m_declElementType = oldDeclElementType;\n  parser->m_userData = oldUserData;\n  if (oldUserData == oldHandlerArg)\n    parser->m_handlerArg = parser->m_userData;\n  else\n    parser->m_handlerArg = parser;\n  if (oldExternalEntityRefHandlerArg != oldParser)\n    parser->m_externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg;\n  parser->m_defaultExpandInternalEntities = oldDefaultExpandInternalEntities;\n  parser->m_ns_triplets = oldns_triplets;\n  parser->m_hash_secret_salt = oldhash_secret_salt;\n  parser->m_parentParser = oldParser;\n#ifdef XML_DTD\n  parser->m_paramEntityParsing = oldParamEntityParsing;\n  parser->m_prologState.inEntityValue = oldInEntityValue;\n  if (context) {\n#endif /* XML_DTD */\n    if (! dtdCopy(oldParser, parser->m_dtd, oldDtd, &parser->m_mem)\n        || ! setContext(parser, context)) {\n      XML_ParserFree(parser);\n      return NULL;\n    }\n    parser->m_processor = externalEntityInitProcessor;\n#ifdef XML_DTD\n  } else {\n    /* The DTD instance referenced by parser->m_dtd is shared between the\n       document's root parser and external PE parsers, therefore one does not\n       need to call setContext. In addition, one also *must* not call\n       setContext, because this would overwrite existing prefix->binding\n       pointers in parser->m_dtd with ones that get destroyed with the external\n       PE parser. This would leave those prefixes with dangling pointers.\n    */\n    parser->m_isParamEntity = XML_TRUE;\n    XmlPrologStateInitExternalEntity(&parser->m_prologState);\n    parser->m_processor = externalParEntInitProcessor;\n  }\n#endif /* XML_DTD */\n  return parser;\n}\n\nstatic void FASTCALL\ndestroyBindings(BINDING *bindings, XML_Parser parser) {\n  for (;;) {\n    BINDING *b = bindings;\n    if (! b)\n      break;\n    bindings = b->nextTagBinding;\n    FREE(parser, b->uri);\n    FREE(parser, b);\n  }\n}\n\nvoid XMLCALL\nXML_ParserFree(XML_Parser parser) {\n  TAG *tagList;\n  OPEN_INTERNAL_ENTITY *entityList;\n  if (parser == NULL)\n    return;\n  /* free m_tagStack and m_freeTagList */\n  tagList = parser->m_tagStack;\n  for (;;) {\n    TAG *p;\n    if (tagList == NULL) {\n      if (parser->m_freeTagList == NULL)\n        break;\n      tagList = parser->m_freeTagList;\n      parser->m_freeTagList = NULL;\n    }\n    p = tagList;\n    tagList = tagList->parent;\n    FREE(parser, p->buf);\n    destroyBindings(p->bindings, parser);\n    FREE(parser, p);\n  }\n  /* free m_openInternalEntities and m_freeInternalEntities */\n  entityList = parser->m_openInternalEntities;\n  for (;;) {\n    OPEN_INTERNAL_ENTITY *openEntity;\n    if (entityList == NULL) {\n      if (parser->m_freeInternalEntities == NULL)\n        break;\n      entityList = parser->m_freeInternalEntities;\n      parser->m_freeInternalEntities = NULL;\n    }\n    openEntity = entityList;\n    entityList = entityList->next;\n    FREE(parser, openEntity);\n  }\n\n  destroyBindings(parser->m_freeBindingList, parser);\n  destroyBindings(parser->m_inheritedBindings, parser);\n  poolDestroy(&parser->m_tempPool);\n  poolDestroy(&parser->m_temp2Pool);\n  FREE(parser, (void *)parser->m_protocolEncodingName);\n#ifdef XML_DTD\n  /* external parameter entity parsers share the DTD structure\n     parser->m_dtd with the root parser, so we must not destroy it\n  */\n  if (! parser->m_isParamEntity && parser->m_dtd)\n#else\n  if (parser->m_dtd)\n#endif /* XML_DTD */\n    dtdDestroy(parser->m_dtd, (XML_Bool)! parser->m_parentParser,\n               &parser->m_mem);\n  FREE(parser, (void *)parser->m_atts);\n#ifdef XML_ATTR_INFO\n  FREE(parser, (void *)parser->m_attInfo);\n#endif\n  FREE(parser, parser->m_groupConnector);\n  FREE(parser, parser->m_buffer);\n  FREE(parser, parser->m_dataBuf);\n  FREE(parser, parser->m_nsAtts);\n  FREE(parser, parser->m_unknownEncodingMem);\n  if (parser->m_unknownEncodingRelease)\n    parser->m_unknownEncodingRelease(parser->m_unknownEncodingData);\n  FREE(parser, parser);\n}\n\nvoid XMLCALL\nXML_UseParserAsHandlerArg(XML_Parser parser) {\n  if (parser != NULL)\n    parser->m_handlerArg = parser;\n}\n\nenum XML_Error XMLCALL\nXML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD) {\n  if (parser == NULL)\n    return XML_ERROR_INVALID_ARGUMENT;\n#ifdef XML_DTD\n  /* block after XML_Parse()/XML_ParseBuffer() has been called */\n  if (parser->m_parsingStatus.parsing == XML_PARSING\n      || parser->m_parsingStatus.parsing == XML_SUSPENDED)\n    return XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING;\n  parser->m_useForeignDTD = useDTD;\n  return XML_ERROR_NONE;\n#else\n  return XML_ERROR_FEATURE_REQUIRES_XML_DTD;\n#endif\n}\n\nvoid XMLCALL\nXML_SetReturnNSTriplet(XML_Parser parser, int do_nst) {\n  if (parser == NULL)\n    return;\n  /* block after XML_Parse()/XML_ParseBuffer() has been called */\n  if (parser->m_parsingStatus.parsing == XML_PARSING\n      || parser->m_parsingStatus.parsing == XML_SUSPENDED)\n    return;\n  parser->m_ns_triplets = do_nst ? XML_TRUE : XML_FALSE;\n}\n\nvoid XMLCALL\nXML_SetUserData(XML_Parser parser, void *p) {\n  if (parser == NULL)\n    return;\n  if (parser->m_handlerArg == parser->m_userData)\n    parser->m_handlerArg = parser->m_userData = p;\n  else\n    parser->m_userData = p;\n}\n\nenum XML_Status XMLCALL\nXML_SetBase(XML_Parser parser, const XML_Char *p) {\n  if (parser == NULL)\n    return XML_STATUS_ERROR;\n  if (p) {\n    p = poolCopyString(&parser->m_dtd->pool, p);\n    if (! p)\n      return XML_STATUS_ERROR;\n    parser->m_curBase = p;\n  } else\n    parser->m_curBase = NULL;\n  return XML_STATUS_OK;\n}\n\nconst XML_Char *XMLCALL\nXML_GetBase(XML_Parser parser) {\n  if (parser == NULL)\n    return NULL;\n  return parser->m_curBase;\n}\n\nint XMLCALL\nXML_GetSpecifiedAttributeCount(XML_Parser parser) {\n  if (parser == NULL)\n    return -1;\n  return parser->m_nSpecifiedAtts;\n}\n\nint XMLCALL\nXML_GetIdAttributeIndex(XML_Parser parser) {\n  if (parser == NULL)\n    return -1;\n  return parser->m_idAttIndex;\n}\n\n#ifdef XML_ATTR_INFO\nconst XML_AttrInfo *XMLCALL\nXML_GetAttributeInfo(XML_Parser parser) {\n  if (parser == NULL)\n    return NULL;\n  return parser->m_attInfo;\n}\n#endif\n\nvoid XMLCALL\nXML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start,\n                      XML_EndElementHandler end) {\n  if (parser == NULL)\n    return;\n  parser->m_startElementHandler = start;\n  parser->m_endElementHandler = end;\n}\n\nvoid XMLCALL\nXML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler start) {\n  if (parser != NULL)\n    parser->m_startElementHandler = start;\n}\n\nvoid XMLCALL\nXML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler end) {\n  if (parser != NULL)\n    parser->m_endElementHandler = end;\n}\n\nvoid XMLCALL\nXML_SetCharacterDataHandler(XML_Parser parser,\n                            XML_CharacterDataHandler handler) {\n  if (parser != NULL)\n    parser->m_characterDataHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetProcessingInstructionHandler(XML_Parser parser,\n                                    XML_ProcessingInstructionHandler handler) {\n  if (parser != NULL)\n    parser->m_processingInstructionHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler) {\n  if (parser != NULL)\n    parser->m_commentHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetCdataSectionHandler(XML_Parser parser,\n                           XML_StartCdataSectionHandler start,\n                           XML_EndCdataSectionHandler end) {\n  if (parser == NULL)\n    return;\n  parser->m_startCdataSectionHandler = start;\n  parser->m_endCdataSectionHandler = end;\n}\n\nvoid XMLCALL\nXML_SetStartCdataSectionHandler(XML_Parser parser,\n                                XML_StartCdataSectionHandler start) {\n  if (parser != NULL)\n    parser->m_startCdataSectionHandler = start;\n}\n\nvoid XMLCALL\nXML_SetEndCdataSectionHandler(XML_Parser parser,\n                              XML_EndCdataSectionHandler end) {\n  if (parser != NULL)\n    parser->m_endCdataSectionHandler = end;\n}\n\nvoid XMLCALL\nXML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler) {\n  if (parser == NULL)\n    return;\n  parser->m_defaultHandler = handler;\n  parser->m_defaultExpandInternalEntities = XML_FALSE;\n}\n\nvoid XMLCALL\nXML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler) {\n  if (parser == NULL)\n    return;\n  parser->m_defaultHandler = handler;\n  parser->m_defaultExpandInternalEntities = XML_TRUE;\n}\n\nvoid XMLCALL\nXML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start,\n                          XML_EndDoctypeDeclHandler end) {\n  if (parser == NULL)\n    return;\n  parser->m_startDoctypeDeclHandler = start;\n  parser->m_endDoctypeDeclHandler = end;\n}\n\nvoid XMLCALL\nXML_SetStartDoctypeDeclHandler(XML_Parser parser,\n                               XML_StartDoctypeDeclHandler start) {\n  if (parser != NULL)\n    parser->m_startDoctypeDeclHandler = start;\n}\n\nvoid XMLCALL\nXML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end) {\n  if (parser != NULL)\n    parser->m_endDoctypeDeclHandler = end;\n}\n\nvoid XMLCALL\nXML_SetUnparsedEntityDeclHandler(XML_Parser parser,\n                                 XML_UnparsedEntityDeclHandler handler) {\n  if (parser != NULL)\n    parser->m_unparsedEntityDeclHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler) {\n  if (parser != NULL)\n    parser->m_notationDeclHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetNamespaceDeclHandler(XML_Parser parser,\n                            XML_StartNamespaceDeclHandler start,\n                            XML_EndNamespaceDeclHandler end) {\n  if (parser == NULL)\n    return;\n  parser->m_startNamespaceDeclHandler = start;\n  parser->m_endNamespaceDeclHandler = end;\n}\n\nvoid XMLCALL\nXML_SetStartNamespaceDeclHandler(XML_Parser parser,\n                                 XML_StartNamespaceDeclHandler start) {\n  if (parser != NULL)\n    parser->m_startNamespaceDeclHandler = start;\n}\n\nvoid XMLCALL\nXML_SetEndNamespaceDeclHandler(XML_Parser parser,\n                               XML_EndNamespaceDeclHandler end) {\n  if (parser != NULL)\n    parser->m_endNamespaceDeclHandler = end;\n}\n\nvoid XMLCALL\nXML_SetNotStandaloneHandler(XML_Parser parser,\n                            XML_NotStandaloneHandler handler) {\n  if (parser != NULL)\n    parser->m_notStandaloneHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetExternalEntityRefHandler(XML_Parser parser,\n                                XML_ExternalEntityRefHandler handler) {\n  if (parser != NULL)\n    parser->m_externalEntityRefHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg) {\n  if (parser == NULL)\n    return;\n  if (arg)\n    parser->m_externalEntityRefHandlerArg = (XML_Parser)arg;\n  else\n    parser->m_externalEntityRefHandlerArg = parser;\n}\n\nvoid XMLCALL\nXML_SetSkippedEntityHandler(XML_Parser parser,\n                            XML_SkippedEntityHandler handler) {\n  if (parser != NULL)\n    parser->m_skippedEntityHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetUnknownEncodingHandler(XML_Parser parser,\n                              XML_UnknownEncodingHandler handler, void *data) {\n  if (parser == NULL)\n    return;\n  parser->m_unknownEncodingHandler = handler;\n  parser->m_unknownEncodingHandlerData = data;\n}\n\nvoid XMLCALL\nXML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl) {\n  if (parser != NULL)\n    parser->m_elementDeclHandler = eldecl;\n}\n\nvoid XMLCALL\nXML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl) {\n  if (parser != NULL)\n    parser->m_attlistDeclHandler = attdecl;\n}\n\nvoid XMLCALL\nXML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler) {\n  if (parser != NULL)\n    parser->m_entityDeclHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler handler) {\n  if (parser != NULL)\n    parser->m_xmlDeclHandler = handler;\n}\n\nint XMLCALL\nXML_SetParamEntityParsing(XML_Parser parser,\n                          enum XML_ParamEntityParsing peParsing) {\n  if (parser == NULL)\n    return 0;\n  /* block after XML_Parse()/XML_ParseBuffer() has been called */\n  if (parser->m_parsingStatus.parsing == XML_PARSING\n      || parser->m_parsingStatus.parsing == XML_SUSPENDED)\n    return 0;\n#ifdef XML_DTD\n  parser->m_paramEntityParsing = peParsing;\n  return 1;\n#else\n  return peParsing == XML_PARAM_ENTITY_PARSING_NEVER;\n#endif\n}\n\nint XMLCALL\nXML_SetHashSalt(XML_Parser parser, unsigned long hash_salt) {\n  if (parser == NULL)\n    return 0;\n  if (parser->m_parentParser)\n    return XML_SetHashSalt(parser->m_parentParser, hash_salt);\n  /* block after XML_Parse()/XML_ParseBuffer() has been called */\n  if (parser->m_parsingStatus.parsing == XML_PARSING\n      || parser->m_parsingStatus.parsing == XML_SUSPENDED)\n    return 0;\n  parser->m_hash_secret_salt = hash_salt;\n  return 1;\n}\n\nenum XML_Status XMLCALL\nXML_Parse(XML_Parser parser, const char *s, int len, int isFinal) {\n  if ((parser == NULL) || (len < 0) || ((s == NULL) && (len != 0))) {\n    if (parser != NULL)\n      parser->m_errorCode = XML_ERROR_INVALID_ARGUMENT;\n    return XML_STATUS_ERROR;\n  }\n  switch (parser->m_parsingStatus.parsing) {\n  case XML_SUSPENDED:\n    parser->m_errorCode = XML_ERROR_SUSPENDED;\n    return XML_STATUS_ERROR;\n  case XML_FINISHED:\n    parser->m_errorCode = XML_ERROR_FINISHED;\n    return XML_STATUS_ERROR;\n  case XML_INITIALIZED:\n    if (parser->m_parentParser == NULL && ! startParsing(parser)) {\n      parser->m_errorCode = XML_ERROR_NO_MEMORY;\n      return XML_STATUS_ERROR;\n    }\n    /* fall through */\n  default:\n    parser->m_parsingStatus.parsing = XML_PARSING;\n  }\n\n  if (len == 0) {\n    parser->m_parsingStatus.finalBuffer = (XML_Bool)isFinal;\n    if (! isFinal)\n      return XML_STATUS_OK;\n    parser->m_positionPtr = parser->m_bufferPtr;\n    parser->m_parseEndPtr = parser->m_bufferEnd;\n\n    /* If data are left over from last buffer, and we now know that these\n       data are the final chunk of input, then we have to check them again\n       to detect errors based on that fact.\n    */\n    parser->m_errorCode\n        = parser->m_processor(parser, parser->m_bufferPtr,\n                              parser->m_parseEndPtr, &parser->m_bufferPtr);\n\n    if (parser->m_errorCode == XML_ERROR_NONE) {\n      switch (parser->m_parsingStatus.parsing) {\n      case XML_SUSPENDED:\n        /* It is hard to be certain, but it seems that this case\n         * cannot occur.  This code is cleaning up a previous parse\n         * with no new data (since len == 0).  Changing the parsing\n         * state requires getting to execute a handler function, and\n         * there doesn't seem to be an opportunity for that while in\n         * this circumstance.\n         *\n         * Given the uncertainty, we retain the code but exclude it\n         * from coverage tests.\n         *\n         * LCOV_EXCL_START\n         */\n        XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr,\n                          parser->m_bufferPtr, &parser->m_position);\n        parser->m_positionPtr = parser->m_bufferPtr;\n        return XML_STATUS_SUSPENDED;\n        /* LCOV_EXCL_STOP */\n      case XML_INITIALIZED:\n      case XML_PARSING:\n        parser->m_parsingStatus.parsing = XML_FINISHED;\n        /* fall through */\n      default:\n        return XML_STATUS_OK;\n      }\n    }\n    parser->m_eventEndPtr = parser->m_eventPtr;\n    parser->m_processor = errorProcessor;\n    return XML_STATUS_ERROR;\n  }\n#ifndef XML_CONTEXT_BYTES\n  else if (parser->m_bufferPtr == parser->m_bufferEnd) {\n    const char *end;\n    int nLeftOver;\n    enum XML_Status result;\n    /* Detect overflow (a+b > MAX <==> b > MAX-a) */\n    if (len > ((XML_Size)-1) / 2 - parser->m_parseEndByteIndex) {\n      parser->m_errorCode = XML_ERROR_NO_MEMORY;\n      parser->m_eventPtr = parser->m_eventEndPtr = NULL;\n      parser->m_processor = errorProcessor;\n      return XML_STATUS_ERROR;\n    }\n    parser->m_parseEndByteIndex += len;\n    parser->m_positionPtr = s;\n    parser->m_parsingStatus.finalBuffer = (XML_Bool)isFinal;\n\n    parser->m_errorCode\n        = parser->m_processor(parser, s, parser->m_parseEndPtr = s + len, &end);\n\n    if (parser->m_errorCode != XML_ERROR_NONE) {\n      parser->m_eventEndPtr = parser->m_eventPtr;\n      parser->m_processor = errorProcessor;\n      return XML_STATUS_ERROR;\n    } else {\n      switch (parser->m_parsingStatus.parsing) {\n      case XML_SUSPENDED:\n        result = XML_STATUS_SUSPENDED;\n        break;\n      case XML_INITIALIZED:\n      case XML_PARSING:\n        if (isFinal) {\n          parser->m_parsingStatus.parsing = XML_FINISHED;\n          return XML_STATUS_OK;\n        }\n      /* fall through */\n      default:\n        result = XML_STATUS_OK;\n      }\n    }\n\n    XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr, end,\n                      &parser->m_position);\n    nLeftOver = s + len - end;\n    if (nLeftOver) {\n      if (parser->m_buffer == NULL\n          || nLeftOver > parser->m_bufferLim - parser->m_buffer) {\n        /* avoid _signed_ integer overflow */\n        char *temp = NULL;\n        const int bytesToAllocate = (int)((unsigned)len * 2U);\n        if (bytesToAllocate > 0) {\n          temp = (char *)REALLOC(parser, parser->m_buffer, bytesToAllocate);\n        }\n        if (temp == NULL) {\n          parser->m_errorCode = XML_ERROR_NO_MEMORY;\n          parser->m_eventPtr = parser->m_eventEndPtr = NULL;\n          parser->m_processor = errorProcessor;\n          return XML_STATUS_ERROR;\n        }\n        parser->m_buffer = temp;\n        parser->m_bufferLim = parser->m_buffer + bytesToAllocate;\n      }\n      memcpy(parser->m_buffer, end, nLeftOver);\n    }\n    parser->m_bufferPtr = parser->m_buffer;\n    parser->m_bufferEnd = parser->m_buffer + nLeftOver;\n    parser->m_positionPtr = parser->m_bufferPtr;\n    parser->m_parseEndPtr = parser->m_bufferEnd;\n    parser->m_eventPtr = parser->m_bufferPtr;\n    parser->m_eventEndPtr = parser->m_bufferPtr;\n    return result;\n  }\n#endif /* not defined XML_CONTEXT_BYTES */\n  else {\n    void *buff = XML_GetBuffer(parser, len);\n    if (buff == NULL)\n      return XML_STATUS_ERROR;\n    else {\n      memcpy(buff, s, len);\n      return XML_ParseBuffer(parser, len, isFinal);\n    }\n  }\n}\n\nenum XML_Status XMLCALL\nXML_ParseBuffer(XML_Parser parser, int len, int isFinal) {\n  const char *start;\n  enum XML_Status result = XML_STATUS_OK;\n\n  if (parser == NULL)\n    return XML_STATUS_ERROR;\n  switch (parser->m_parsingStatus.parsing) {\n  case XML_SUSPENDED:\n    parser->m_errorCode = XML_ERROR_SUSPENDED;\n    return XML_STATUS_ERROR;\n  case XML_FINISHED:\n    parser->m_errorCode = XML_ERROR_FINISHED;\n    return XML_STATUS_ERROR;\n  case XML_INITIALIZED:\n    if (parser->m_parentParser == NULL && ! startParsing(parser)) {\n      parser->m_errorCode = XML_ERROR_NO_MEMORY;\n      return XML_STATUS_ERROR;\n    }\n    /* fall through */\n  default:\n    parser->m_parsingStatus.parsing = XML_PARSING;\n  }\n\n  start = parser->m_bufferPtr;\n  parser->m_positionPtr = start;\n  parser->m_bufferEnd += len;\n  parser->m_parseEndPtr = parser->m_bufferEnd;\n  parser->m_parseEndByteIndex += len;\n  parser->m_parsingStatus.finalBuffer = (XML_Bool)isFinal;\n\n  parser->m_errorCode = parser->m_processor(\n      parser, start, parser->m_parseEndPtr, &parser->m_bufferPtr);\n\n  if (parser->m_errorCode != XML_ERROR_NONE) {\n    parser->m_eventEndPtr = parser->m_eventPtr;\n    parser->m_processor = errorProcessor;\n    return XML_STATUS_ERROR;\n  } else {\n    switch (parser->m_parsingStatus.parsing) {\n    case XML_SUSPENDED:\n      result = XML_STATUS_SUSPENDED;\n      break;\n    case XML_INITIALIZED:\n    case XML_PARSING:\n      if (isFinal) {\n        parser->m_parsingStatus.parsing = XML_FINISHED;\n        return result;\n      }\n    default:; /* should not happen */\n    }\n  }\n\n  XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr,\n                    parser->m_bufferPtr, &parser->m_position);\n  parser->m_positionPtr = parser->m_bufferPtr;\n  return result;\n}\n\nvoid *XMLCALL\nXML_GetBuffer(XML_Parser parser, int len) {\n  if (parser == NULL)\n    return NULL;\n  if (len < 0) {\n    parser->m_errorCode = XML_ERROR_NO_MEMORY;\n    return NULL;\n  }\n  switch (parser->m_parsingStatus.parsing) {\n  case XML_SUSPENDED:\n    parser->m_errorCode = XML_ERROR_SUSPENDED;\n    return NULL;\n  case XML_FINISHED:\n    parser->m_errorCode = XML_ERROR_FINISHED;\n    return NULL;\n  default:;\n  }\n\n  if (len > EXPAT_SAFE_PTR_DIFF(parser->m_bufferLim, parser->m_bufferEnd)) {\n#ifdef XML_CONTEXT_BYTES\n    int keep;\n#endif /* defined XML_CONTEXT_BYTES */\n    /* Do not invoke signed arithmetic overflow: */\n    int neededSize = (int)((unsigned)len\n                           + (unsigned)EXPAT_SAFE_PTR_DIFF(\n                               parser->m_bufferEnd, parser->m_bufferPtr));\n    if (neededSize < 0) {\n      parser->m_errorCode = XML_ERROR_NO_MEMORY;\n      return NULL;\n    }\n#ifdef XML_CONTEXT_BYTES\n    keep = (int)EXPAT_SAFE_PTR_DIFF(parser->m_bufferPtr, parser->m_buffer);\n    if (keep > XML_CONTEXT_BYTES)\n      keep = XML_CONTEXT_BYTES;\n    neededSize += keep;\n#endif /* defined XML_CONTEXT_BYTES */\n    if (neededSize\n        <= EXPAT_SAFE_PTR_DIFF(parser->m_bufferLim, parser->m_buffer)) {\n#ifdef XML_CONTEXT_BYTES\n      if (keep < EXPAT_SAFE_PTR_DIFF(parser->m_bufferPtr, parser->m_buffer)) {\n        int offset\n            = (int)EXPAT_SAFE_PTR_DIFF(parser->m_bufferPtr, parser->m_buffer)\n              - keep;\n        /* The buffer pointers cannot be NULL here; we have at least some bytes\n         * in the buffer */\n        memmove(parser->m_buffer, &parser->m_buffer[offset],\n                parser->m_bufferEnd - parser->m_bufferPtr + keep);\n        parser->m_bufferEnd -= offset;\n        parser->m_bufferPtr -= offset;\n      }\n#else\n      if (parser->m_buffer && parser->m_bufferPtr) {\n        memmove(parser->m_buffer, parser->m_bufferPtr,\n                EXPAT_SAFE_PTR_DIFF(parser->m_bufferEnd, parser->m_bufferPtr));\n        parser->m_bufferEnd\n            = parser->m_buffer\n              + EXPAT_SAFE_PTR_DIFF(parser->m_bufferEnd, parser->m_bufferPtr);\n        parser->m_bufferPtr = parser->m_buffer;\n      }\n#endif /* not defined XML_CONTEXT_BYTES */\n    } else {\n      char *newBuf;\n      int bufferSize\n          = (int)EXPAT_SAFE_PTR_DIFF(parser->m_bufferLim, parser->m_bufferPtr);\n      if (bufferSize == 0)\n        bufferSize = INIT_BUFFER_SIZE;\n      do {\n        /* Do not invoke signed arithmetic overflow: */\n        bufferSize = (int)(2U * (unsigned)bufferSize);\n      } while (bufferSize < neededSize && bufferSize > 0);\n      if (bufferSize <= 0) {\n        parser->m_errorCode = XML_ERROR_NO_MEMORY;\n        return NULL;\n      }\n      newBuf = (char *)MALLOC(parser, bufferSize);\n      if (newBuf == 0) {\n        parser->m_errorCode = XML_ERROR_NO_MEMORY;\n        return NULL;\n      }\n      parser->m_bufferLim = newBuf + bufferSize;\n#ifdef XML_CONTEXT_BYTES\n      if (parser->m_bufferPtr) {\n        memcpy(newBuf, &parser->m_bufferPtr[-keep],\n               EXPAT_SAFE_PTR_DIFF(parser->m_bufferEnd, parser->m_bufferPtr)\n                   + keep);\n        FREE(parser, parser->m_buffer);\n        parser->m_buffer = newBuf;\n        parser->m_bufferEnd\n            = parser->m_buffer\n              + EXPAT_SAFE_PTR_DIFF(parser->m_bufferEnd, parser->m_bufferPtr)\n              + keep;\n        parser->m_bufferPtr = parser->m_buffer + keep;\n      } else {\n        /* This must be a brand new buffer with no data in it yet */\n        parser->m_bufferEnd = newBuf;\n        parser->m_bufferPtr = parser->m_buffer = newBuf;\n      }\n#else\n      if (parser->m_bufferPtr) {\n        memcpy(newBuf, parser->m_bufferPtr,\n               EXPAT_SAFE_PTR_DIFF(parser->m_bufferEnd, parser->m_bufferPtr));\n        FREE(parser, parser->m_buffer);\n        parser->m_bufferEnd\n            = newBuf\n              + EXPAT_SAFE_PTR_DIFF(parser->m_bufferEnd, parser->m_bufferPtr);\n      } else {\n        /* This must be a brand new buffer with no data in it yet */\n        parser->m_bufferEnd = newBuf;\n      }\n      parser->m_bufferPtr = parser->m_buffer = newBuf;\n#endif /* not defined XML_CONTEXT_BYTES */\n    }\n    parser->m_eventPtr = parser->m_eventEndPtr = NULL;\n    parser->m_positionPtr = NULL;\n  }\n  return parser->m_bufferEnd;\n}\n\nenum XML_Status XMLCALL\nXML_StopParser(XML_Parser parser, XML_Bool resumable) {\n  if (parser == NULL)\n    return XML_STATUS_ERROR;\n  switch (parser->m_parsingStatus.parsing) {\n  case XML_SUSPENDED:\n    if (resumable) {\n      parser->m_errorCode = XML_ERROR_SUSPENDED;\n      return XML_STATUS_ERROR;\n    }\n    parser->m_parsingStatus.parsing = XML_FINISHED;\n    break;\n  case XML_FINISHED:\n    parser->m_errorCode = XML_ERROR_FINISHED;\n    return XML_STATUS_ERROR;\n  default:\n    if (resumable) {\n#ifdef XML_DTD\n      if (parser->m_isParamEntity) {\n        parser->m_errorCode = XML_ERROR_SUSPEND_PE;\n        return XML_STATUS_ERROR;\n      }\n#endif\n      parser->m_parsingStatus.parsing = XML_SUSPENDED;\n    } else\n      parser->m_parsingStatus.parsing = XML_FINISHED;\n  }\n  return XML_STATUS_OK;\n}\n\nenum XML_Status XMLCALL\nXML_ResumeParser(XML_Parser parser) {\n  enum XML_Status result = XML_STATUS_OK;\n\n  if (parser == NULL)\n    return XML_STATUS_ERROR;\n  if (parser->m_parsingStatus.parsing != XML_SUSPENDED) {\n    parser->m_errorCode = XML_ERROR_NOT_SUSPENDED;\n    return XML_STATUS_ERROR;\n  }\n  parser->m_parsingStatus.parsing = XML_PARSING;\n\n  parser->m_errorCode = parser->m_processor(\n      parser, parser->m_bufferPtr, parser->m_parseEndPtr, &parser->m_bufferPtr);\n\n  if (parser->m_errorCode != XML_ERROR_NONE) {\n    parser->m_eventEndPtr = parser->m_eventPtr;\n    parser->m_processor = errorProcessor;\n    return XML_STATUS_ERROR;\n  } else {\n    switch (parser->m_parsingStatus.parsing) {\n    case XML_SUSPENDED:\n      result = XML_STATUS_SUSPENDED;\n      break;\n    case XML_INITIALIZED:\n    case XML_PARSING:\n      if (parser->m_parsingStatus.finalBuffer) {\n        parser->m_parsingStatus.parsing = XML_FINISHED;\n        return result;\n      }\n    default:;\n    }\n  }\n\n  XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr,\n                    parser->m_bufferPtr, &parser->m_position);\n  parser->m_positionPtr = parser->m_bufferPtr;\n  return result;\n}\n\nvoid XMLCALL\nXML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status) {\n  if (parser == NULL)\n    return;\n  assert(status != NULL);\n  *status = parser->m_parsingStatus;\n}\n\nenum XML_Error XMLCALL\nXML_GetErrorCode(XML_Parser parser) {\n  if (parser == NULL)\n    return XML_ERROR_INVALID_ARGUMENT;\n  return parser->m_errorCode;\n}\n\nXML_Index XMLCALL\nXML_GetCurrentByteIndex(XML_Parser parser) {\n  if (parser == NULL)\n    return -1;\n  if (parser->m_eventPtr)\n    return (XML_Index)(parser->m_parseEndByteIndex\n                       - (parser->m_parseEndPtr - parser->m_eventPtr));\n  return -1;\n}\n\nint XMLCALL\nXML_GetCurrentByteCount(XML_Parser parser) {\n  if (parser == NULL)\n    return 0;\n  if (parser->m_eventEndPtr && parser->m_eventPtr)\n    return (int)(parser->m_eventEndPtr - parser->m_eventPtr);\n  return 0;\n}\n\nconst char *XMLCALL\nXML_GetInputContext(XML_Parser parser, int *offset, int *size) {\n#ifdef XML_CONTEXT_BYTES\n  if (parser == NULL)\n    return NULL;\n  if (parser->m_eventPtr && parser->m_buffer) {\n    if (offset != NULL)\n      *offset = (int)(parser->m_eventPtr - parser->m_buffer);\n    if (size != NULL)\n      *size = (int)(parser->m_bufferEnd - parser->m_buffer);\n    return parser->m_buffer;\n  }\n#else\n  (void)parser;\n  (void)offset;\n  (void)size;\n#endif /* defined XML_CONTEXT_BYTES */\n  return (char *)0;\n}\n\nXML_Size XMLCALL\nXML_GetCurrentLineNumber(XML_Parser parser) {\n  if (parser == NULL)\n    return 0;\n  if (parser->m_eventPtr && parser->m_eventPtr >= parser->m_positionPtr) {\n    XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr,\n                      parser->m_eventPtr, &parser->m_position);\n    parser->m_positionPtr = parser->m_eventPtr;\n  }\n  return parser->m_position.lineNumber + 1;\n}\n\nXML_Size XMLCALL\nXML_GetCurrentColumnNumber(XML_Parser parser) {\n  if (parser == NULL)\n    return 0;\n  if (parser->m_eventPtr && parser->m_eventPtr >= parser->m_positionPtr) {\n    XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr,\n                      parser->m_eventPtr, &parser->m_position);\n    parser->m_positionPtr = parser->m_eventPtr;\n  }\n  return parser->m_position.columnNumber;\n}\n\nvoid XMLCALL\nXML_FreeContentModel(XML_Parser parser, XML_Content *model) {\n  if (parser != NULL)\n    FREE(parser, model);\n}\n\nvoid *XMLCALL\nXML_MemMalloc(XML_Parser parser, size_t size) {\n  if (parser == NULL)\n    return NULL;\n  return MALLOC(parser, size);\n}\n\nvoid *XMLCALL\nXML_MemRealloc(XML_Parser parser, void *ptr, size_t size) {\n  if (parser == NULL)\n    return NULL;\n  return REALLOC(parser, ptr, size);\n}\n\nvoid XMLCALL\nXML_MemFree(XML_Parser parser, void *ptr) {\n  if (parser != NULL)\n    FREE(parser, ptr);\n}\n\nvoid XMLCALL\nXML_DefaultCurrent(XML_Parser parser) {\n  if (parser == NULL)\n    return;\n  if (parser->m_defaultHandler) {\n    if (parser->m_openInternalEntities)\n      reportDefault(parser, parser->m_internalEncoding,\n                    parser->m_openInternalEntities->internalEventPtr,\n                    parser->m_openInternalEntities->internalEventEndPtr);\n    else\n      reportDefault(parser, parser->m_encoding, parser->m_eventPtr,\n                    parser->m_eventEndPtr);\n  }\n}\n\nconst XML_LChar *XMLCALL\nXML_ErrorString(enum XML_Error code) {\n  switch (code) {\n  case XML_ERROR_NONE:\n    return NULL;\n  case XML_ERROR_NO_MEMORY:\n    return XML_L(\"out of memory\");\n  case XML_ERROR_SYNTAX:\n    return XML_L(\"syntax error\");\n  case XML_ERROR_NO_ELEMENTS:\n    return XML_L(\"no element found\");\n  case XML_ERROR_INVALID_TOKEN:\n    return XML_L(\"not well-formed (invalid token)\");\n  case XML_ERROR_UNCLOSED_TOKEN:\n    return XML_L(\"unclosed token\");\n  case XML_ERROR_PARTIAL_CHAR:\n    return XML_L(\"partial character\");\n  case XML_ERROR_TAG_MISMATCH:\n    return XML_L(\"mismatched tag\");\n  case XML_ERROR_DUPLICATE_ATTRIBUTE:\n    return XML_L(\"duplicate attribute\");\n  case XML_ERROR_JUNK_AFTER_DOC_ELEMENT:\n    return XML_L(\"junk after document element\");\n  case XML_ERROR_PARAM_ENTITY_REF:\n    return XML_L(\"illegal parameter entity reference\");\n  case XML_ERROR_UNDEFINED_ENTITY:\n    return XML_L(\"undefined entity\");\n  case XML_ERROR_RECURSIVE_ENTITY_REF:\n    return XML_L(\"recursive entity reference\");\n  case XML_ERROR_ASYNC_ENTITY:\n    return XML_L(\"asynchronous entity\");\n  case XML_ERROR_BAD_CHAR_REF:\n    return XML_L(\"reference to invalid character number\");\n  case XML_ERROR_BINARY_ENTITY_REF:\n    return XML_L(\"reference to binary entity\");\n  case XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF:\n    return XML_L(\"reference to external entity in attribute\");\n  case XML_ERROR_MISPLACED_XML_PI:\n    return XML_L(\"XML or text declaration not at start of entity\");\n  case XML_ERROR_UNKNOWN_ENCODING:\n    return XML_L(\"unknown encoding\");\n  case XML_ERROR_INCORRECT_ENCODING:\n    return XML_L(\"encoding specified in XML declaration is incorrect\");\n  case XML_ERROR_UNCLOSED_CDATA_SECTION:\n    return XML_L(\"unclosed CDATA section\");\n  case XML_ERROR_EXTERNAL_ENTITY_HANDLING:\n    return XML_L(\"error in processing external entity reference\");\n  case XML_ERROR_NOT_STANDALONE:\n    return XML_L(\"document is not standalone\");\n  case XML_ERROR_UNEXPECTED_STATE:\n    return XML_L(\"unexpected parser state - please send a bug report\");\n  case XML_ERROR_ENTITY_DECLARED_IN_PE:\n    return XML_L(\"entity declared in parameter entity\");\n  case XML_ERROR_FEATURE_REQUIRES_XML_DTD:\n    return XML_L(\"requested feature requires XML_DTD support in Expat\");\n  case XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING:\n    return XML_L(\"cannot change setting once parsing has begun\");\n  /* Added in 1.95.7. */\n  case XML_ERROR_UNBOUND_PREFIX:\n    return XML_L(\"unbound prefix\");\n  /* Added in 1.95.8. */\n  case XML_ERROR_UNDECLARING_PREFIX:\n    return XML_L(\"must not undeclare prefix\");\n  case XML_ERROR_INCOMPLETE_PE:\n    return XML_L(\"incomplete markup in parameter entity\");\n  case XML_ERROR_XML_DECL:\n    return XML_L(\"XML declaration not well-formed\");\n  case XML_ERROR_TEXT_DECL:\n    return XML_L(\"text declaration not well-formed\");\n  case XML_ERROR_PUBLICID:\n    return XML_L(\"illegal character(s) in public id\");\n  case XML_ERROR_SUSPENDED:\n    return XML_L(\"parser suspended\");\n  case XML_ERROR_NOT_SUSPENDED:\n    return XML_L(\"parser not suspended\");\n  case XML_ERROR_ABORTED:\n    return XML_L(\"parsing aborted\");\n  case XML_ERROR_FINISHED:\n    return XML_L(\"parsing finished\");\n  case XML_ERROR_SUSPEND_PE:\n    return XML_L(\"cannot suspend in external parameter entity\");\n  /* Added in 2.0.0. */\n  case XML_ERROR_RESERVED_PREFIX_XML:\n    return XML_L(\n        \"reserved prefix (xml) must not be undeclared or bound to another namespace name\");\n  case XML_ERROR_RESERVED_PREFIX_XMLNS:\n    return XML_L(\"reserved prefix (xmlns) must not be declared or undeclared\");\n  case XML_ERROR_RESERVED_NAMESPACE_URI:\n    return XML_L(\n        \"prefix must not be bound to one of the reserved namespace names\");\n  /* Added in 2.2.5. */\n  case XML_ERROR_INVALID_ARGUMENT: /* Constant added in 2.2.1, already */\n    return XML_L(\"invalid argument\");\n  }\n  return NULL;\n}\n\nconst XML_LChar *XMLCALL\nXML_ExpatVersion(void) {\n  /* V1 is used to string-ize the version number. However, it would\n     string-ize the actual version macro *names* unless we get them\n     substituted before being passed to V1. CPP is defined to expand\n     a macro, then rescan for more expansions. Thus, we use V2 to expand\n     the version macros, then CPP will expand the resulting V1() macro\n     with the correct numerals. */\n  /* ### I'm assuming cpp is portable in this respect... */\n\n#define V1(a, b, c) XML_L(#a) XML_L(\".\") XML_L(#b) XML_L(\".\") XML_L(#c)\n#define V2(a, b, c) XML_L(\"expat_\") V1(a, b, c)\n\n  return V2(XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION);\n\n#undef V1\n#undef V2\n}\n\nXML_Expat_Version XMLCALL\nXML_ExpatVersionInfo(void) {\n  XML_Expat_Version version;\n\n  version.major = XML_MAJOR_VERSION;\n  version.minor = XML_MINOR_VERSION;\n  version.micro = XML_MICRO_VERSION;\n\n  return version;\n}\n\nconst XML_Feature *XMLCALL\nXML_GetFeatureList(void) {\n  static const XML_Feature features[]\n      = {{XML_FEATURE_SIZEOF_XML_CHAR, XML_L(\"sizeof(XML_Char)\"),\n          sizeof(XML_Char)},\n         {XML_FEATURE_SIZEOF_XML_LCHAR, XML_L(\"sizeof(XML_LChar)\"),\n          sizeof(XML_LChar)},\n#ifdef XML_UNICODE\n         {XML_FEATURE_UNICODE, XML_L(\"XML_UNICODE\"), 0},\n#endif\n#ifdef XML_UNICODE_WCHAR_T\n         {XML_FEATURE_UNICODE_WCHAR_T, XML_L(\"XML_UNICODE_WCHAR_T\"), 0},\n#endif\n#ifdef XML_DTD\n         {XML_FEATURE_DTD, XML_L(\"XML_DTD\"), 0},\n#endif\n#ifdef XML_CONTEXT_BYTES\n         {XML_FEATURE_CONTEXT_BYTES, XML_L(\"XML_CONTEXT_BYTES\"),\n          XML_CONTEXT_BYTES},\n#endif\n#ifdef XML_MIN_SIZE\n         {XML_FEATURE_MIN_SIZE, XML_L(\"XML_MIN_SIZE\"), 0},\n#endif\n#ifdef XML_NS\n         {XML_FEATURE_NS, XML_L(\"XML_NS\"), 0},\n#endif\n#ifdef XML_LARGE_SIZE\n         {XML_FEATURE_LARGE_SIZE, XML_L(\"XML_LARGE_SIZE\"), 0},\n#endif\n#ifdef XML_ATTR_INFO\n         {XML_FEATURE_ATTR_INFO, XML_L(\"XML_ATTR_INFO\"), 0},\n#endif\n         {XML_FEATURE_END, NULL, 0}};\n\n  return features;\n}\n\n/* Initially tag->rawName always points into the parse buffer;\n   for those TAG instances opened while the current parse buffer was\n   processed, and not yet closed, we need to store tag->rawName in a more\n   permanent location, since the parse buffer is about to be discarded.\n*/\nstatic XML_Bool\nstoreRawNames(XML_Parser parser) {\n  TAG *tag = parser->m_tagStack;\n  while (tag) {\n    int bufSize;\n    int nameLen = sizeof(XML_Char) * (tag->name.strLen + 1);\n    char *rawNameBuf = tag->buf + nameLen;\n    /* Stop if already stored.  Since m_tagStack is a stack, we can stop\n       at the first entry that has already been copied; everything\n       below it in the stack is already been accounted for in a\n       previous call to this function.\n    */\n    if (tag->rawName == rawNameBuf)\n      break;\n    /* For re-use purposes we need to ensure that the\n       size of tag->buf is a multiple of sizeof(XML_Char).\n    */\n    bufSize = nameLen + ROUND_UP(tag->rawNameLength, sizeof(XML_Char));\n    if (bufSize > tag->bufEnd - tag->buf) {\n      char *temp = (char *)REALLOC(parser, tag->buf, bufSize);\n      if (temp == NULL)\n        return XML_FALSE;\n      /* if tag->name.str points to tag->buf (only when namespace\n         processing is off) then we have to update it\n      */\n      if (tag->name.str == (XML_Char *)tag->buf)\n        tag->name.str = (XML_Char *)temp;\n      /* if tag->name.localPart is set (when namespace processing is on)\n         then update it as well, since it will always point into tag->buf\n      */\n      if (tag->name.localPart)\n        tag->name.localPart\n            = (XML_Char *)temp + (tag->name.localPart - (XML_Char *)tag->buf);\n      tag->buf = temp;\n      tag->bufEnd = temp + bufSize;\n      rawNameBuf = temp + nameLen;\n    }\n    memcpy(rawNameBuf, tag->rawName, tag->rawNameLength);\n    tag->rawName = rawNameBuf;\n    tag = tag->parent;\n  }\n  return XML_TRUE;\n}\n\nstatic enum XML_Error PTRCALL\ncontentProcessor(XML_Parser parser, const char *start, const char *end,\n                 const char **endPtr) {\n  enum XML_Error result\n      = doContent(parser, 0, parser->m_encoding, start, end, endPtr,\n                  (XML_Bool)! parser->m_parsingStatus.finalBuffer);\n  if (result == XML_ERROR_NONE) {\n    if (! storeRawNames(parser))\n      return XML_ERROR_NO_MEMORY;\n  }\n  return result;\n}\n\nstatic enum XML_Error PTRCALL\nexternalEntityInitProcessor(XML_Parser parser, const char *start,\n                            const char *end, const char **endPtr) {\n  enum XML_Error result = initializeEncoding(parser);\n  if (result != XML_ERROR_NONE)\n    return result;\n  parser->m_processor = externalEntityInitProcessor2;\n  return externalEntityInitProcessor2(parser, start, end, endPtr);\n}\n\nstatic enum XML_Error PTRCALL\nexternalEntityInitProcessor2(XML_Parser parser, const char *start,\n                             const char *end, const char **endPtr) {\n  const char *next = start; /* XmlContentTok doesn't always set the last arg */\n  int tok = XmlContentTok(parser->m_encoding, start, end, &next);\n  switch (tok) {\n  case XML_TOK_BOM:\n    /* If we are at the end of the buffer, this would cause the next stage,\n       i.e. externalEntityInitProcessor3, to pass control directly to\n       doContent (by detecting XML_TOK_NONE) without processing any xml text\n       declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent.\n    */\n    if (next == end && ! parser->m_parsingStatus.finalBuffer) {\n      *endPtr = next;\n      return XML_ERROR_NONE;\n    }\n    start = next;\n    break;\n  case XML_TOK_PARTIAL:\n    if (! parser->m_parsingStatus.finalBuffer) {\n      *endPtr = start;\n      return XML_ERROR_NONE;\n    }\n    parser->m_eventPtr = start;\n    return XML_ERROR_UNCLOSED_TOKEN;\n  case XML_TOK_PARTIAL_CHAR:\n    if (! parser->m_parsingStatus.finalBuffer) {\n      *endPtr = start;\n      return XML_ERROR_NONE;\n    }\n    parser->m_eventPtr = start;\n    return XML_ERROR_PARTIAL_CHAR;\n  }\n  parser->m_processor = externalEntityInitProcessor3;\n  return externalEntityInitProcessor3(parser, start, end, endPtr);\n}\n\nstatic enum XML_Error PTRCALL\nexternalEntityInitProcessor3(XML_Parser parser, const char *start,\n                             const char *end, const char **endPtr) {\n  int tok;\n  const char *next = start; /* XmlContentTok doesn't always set the last arg */\n  parser->m_eventPtr = start;\n  tok = XmlContentTok(parser->m_encoding, start, end, &next);\n  parser->m_eventEndPtr = next;\n\n  switch (tok) {\n  case XML_TOK_XML_DECL: {\n    enum XML_Error result;\n    result = processXmlDecl(parser, 1, start, next);\n    if (result != XML_ERROR_NONE)\n      return result;\n    switch (parser->m_parsingStatus.parsing) {\n    case XML_SUSPENDED:\n      *endPtr = next;\n      return XML_ERROR_NONE;\n    case XML_FINISHED:\n      return XML_ERROR_ABORTED;\n    default:\n      start = next;\n    }\n  } break;\n  case XML_TOK_PARTIAL:\n    if (! parser->m_parsingStatus.finalBuffer) {\n      *endPtr = start;\n      return XML_ERROR_NONE;\n    }\n    return XML_ERROR_UNCLOSED_TOKEN;\n  case XML_TOK_PARTIAL_CHAR:\n    if (! parser->m_parsingStatus.finalBuffer) {\n      *endPtr = start;\n      return XML_ERROR_NONE;\n    }\n    return XML_ERROR_PARTIAL_CHAR;\n  }\n  parser->m_processor = externalEntityContentProcessor;\n  parser->m_tagLevel = 1;\n  return externalEntityContentProcessor(parser, start, end, endPtr);\n}\n\nstatic enum XML_Error PTRCALL\nexternalEntityContentProcessor(XML_Parser parser, const char *start,\n                               const char *end, const char **endPtr) {\n  enum XML_Error result\n      = doContent(parser, 1, parser->m_encoding, start, end, endPtr,\n                  (XML_Bool)! parser->m_parsingStatus.finalBuffer);\n  if (result == XML_ERROR_NONE) {\n    if (! storeRawNames(parser))\n      return XML_ERROR_NO_MEMORY;\n  }\n  return result;\n}\n\nstatic enum XML_Error\ndoContent(XML_Parser parser, int startTagLevel, const ENCODING *enc,\n          const char *s, const char *end, const char **nextPtr,\n          XML_Bool haveMore) {\n  /* save one level of indirection */\n  DTD *const dtd = parser->m_dtd;\n\n  const char **eventPP;\n  const char **eventEndPP;\n  if (enc == parser->m_encoding) {\n    eventPP = &parser->m_eventPtr;\n    eventEndPP = &parser->m_eventEndPtr;\n  } else {\n    eventPP = &(parser->m_openInternalEntities->internalEventPtr);\n    eventEndPP = &(parser->m_openInternalEntities->internalEventEndPtr);\n  }\n  *eventPP = s;\n\n  for (;;) {\n    const char *next = s; /* XmlContentTok doesn't always set the last arg */\n    int tok = XmlContentTok(enc, s, end, &next);\n    *eventEndPP = next;\n    switch (tok) {\n    case XML_TOK_TRAILING_CR:\n      if (haveMore) {\n        *nextPtr = s;\n        return XML_ERROR_NONE;\n      }\n      *eventEndPP = end;\n      if (parser->m_characterDataHandler) {\n        XML_Char c = 0xA;\n        parser->m_characterDataHandler(parser->m_handlerArg, &c, 1);\n      } else if (parser->m_defaultHandler)\n        reportDefault(parser, enc, s, end);\n      /* We are at the end of the final buffer, should we check for\n         XML_SUSPENDED, XML_FINISHED?\n      */\n      if (startTagLevel == 0)\n        return XML_ERROR_NO_ELEMENTS;\n      if (parser->m_tagLevel != startTagLevel)\n        return XML_ERROR_ASYNC_ENTITY;\n      *nextPtr = end;\n      return XML_ERROR_NONE;\n    case XML_TOK_NONE:\n      if (haveMore) {\n        *nextPtr = s;\n        return XML_ERROR_NONE;\n      }\n      if (startTagLevel > 0) {\n        if (parser->m_tagLevel != startTagLevel)\n          return XML_ERROR_ASYNC_ENTITY;\n        *nextPtr = s;\n        return XML_ERROR_NONE;\n      }\n      return XML_ERROR_NO_ELEMENTS;\n    case XML_TOK_INVALID:\n      *eventPP = next;\n      return XML_ERROR_INVALID_TOKEN;\n    case XML_TOK_PARTIAL:\n      if (haveMore) {\n        *nextPtr = s;\n        return XML_ERROR_NONE;\n      }\n      return XML_ERROR_UNCLOSED_TOKEN;\n    case XML_TOK_PARTIAL_CHAR:\n      if (haveMore) {\n        *nextPtr = s;\n        return XML_ERROR_NONE;\n      }\n      return XML_ERROR_PARTIAL_CHAR;\n    case XML_TOK_ENTITY_REF: {\n      const XML_Char *name;\n      ENTITY *entity;\n      XML_Char ch = (XML_Char)XmlPredefinedEntityName(\n          enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar);\n      if (ch) {\n        if (parser->m_characterDataHandler)\n          parser->m_characterDataHandler(parser->m_handlerArg, &ch, 1);\n        else if (parser->m_defaultHandler)\n          reportDefault(parser, enc, s, next);\n        break;\n      }\n      name = poolStoreString(&dtd->pool, enc, s + enc->minBytesPerChar,\n                             next - enc->minBytesPerChar);\n      if (! name)\n        return XML_ERROR_NO_MEMORY;\n      entity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, 0);\n      poolDiscard(&dtd->pool);\n      /* First, determine if a check for an existing declaration is needed;\n         if yes, check that the entity exists, and that it is internal,\n         otherwise call the skipped entity or default handler.\n      */\n      if (! dtd->hasParamEntityRefs || dtd->standalone) {\n        if (! entity)\n          return XML_ERROR_UNDEFINED_ENTITY;\n        else if (! entity->is_internal)\n          return XML_ERROR_ENTITY_DECLARED_IN_PE;\n      } else if (! entity) {\n        if (parser->m_skippedEntityHandler)\n          parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);\n        else if (parser->m_defaultHandler)\n          reportDefault(parser, enc, s, next);\n        break;\n      }\n      if (entity->open)\n        return XML_ERROR_RECURSIVE_ENTITY_REF;\n      if (entity->notation)\n        return XML_ERROR_BINARY_ENTITY_REF;\n      if (entity->textPtr) {\n        enum XML_Error result;\n        if (! parser->m_defaultExpandInternalEntities) {\n          if (parser->m_skippedEntityHandler)\n            parser->m_skippedEntityHandler(parser->m_handlerArg, entity->name,\n                                           0);\n          else if (parser->m_defaultHandler)\n            reportDefault(parser, enc, s, next);\n          break;\n        }\n        result = processInternalEntity(parser, entity, XML_FALSE);\n        if (result != XML_ERROR_NONE)\n          return result;\n      } else if (parser->m_externalEntityRefHandler) {\n        const XML_Char *context;\n        entity->open = XML_TRUE;\n        context = getContext(parser);\n        entity->open = XML_FALSE;\n        if (! context)\n          return XML_ERROR_NO_MEMORY;\n        if (! parser->m_externalEntityRefHandler(\n                parser->m_externalEntityRefHandlerArg, context, entity->base,\n                entity->systemId, entity->publicId))\n          return XML_ERROR_EXTERNAL_ENTITY_HANDLING;\n        poolDiscard(&parser->m_tempPool);\n      } else if (parser->m_defaultHandler)\n        reportDefault(parser, enc, s, next);\n      break;\n    }\n    case XML_TOK_START_TAG_NO_ATTS:\n      /* fall through */\n    case XML_TOK_START_TAG_WITH_ATTS: {\n      TAG *tag;\n      enum XML_Error result;\n      XML_Char *toPtr;\n      if (parser->m_freeTagList) {\n        tag = parser->m_freeTagList;\n        parser->m_freeTagList = parser->m_freeTagList->parent;\n      } else {\n        tag = (TAG *)MALLOC(parser, sizeof(TAG));\n        if (! tag)\n          return XML_ERROR_NO_MEMORY;\n        tag->buf = (char *)MALLOC(parser, INIT_TAG_BUF_SIZE);\n        if (! tag->buf) {\n          FREE(parser, tag);\n          return XML_ERROR_NO_MEMORY;\n        }\n        tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE;\n      }\n      tag->bindings = NULL;\n      tag->parent = parser->m_tagStack;\n      parser->m_tagStack = tag;\n      tag->name.localPart = NULL;\n      tag->name.prefix = NULL;\n      tag->rawName = s + enc->minBytesPerChar;\n      tag->rawNameLength = XmlNameLength(enc, tag->rawName);\n      ++parser->m_tagLevel;\n      {\n        const char *rawNameEnd = tag->rawName + tag->rawNameLength;\n        const char *fromPtr = tag->rawName;\n        toPtr = (XML_Char *)tag->buf;\n        for (;;) {\n          int bufSize;\n          int convLen;\n          const enum XML_Convert_Result convert_res\n              = XmlConvert(enc, &fromPtr, rawNameEnd, (ICHAR **)&toPtr,\n                           (ICHAR *)tag->bufEnd - 1);\n          convLen = (int)(toPtr - (XML_Char *)tag->buf);\n          if ((fromPtr >= rawNameEnd)\n              || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) {\n            tag->name.strLen = convLen;\n            break;\n          }\n          bufSize = (int)(tag->bufEnd - tag->buf) << 1;\n          {\n            char *temp = (char *)REALLOC(parser, tag->buf, bufSize);\n            if (temp == NULL)\n              return XML_ERROR_NO_MEMORY;\n            tag->buf = temp;\n            tag->bufEnd = temp + bufSize;\n            toPtr = (XML_Char *)temp + convLen;\n          }\n        }\n      }\n      tag->name.str = (XML_Char *)tag->buf;\n      *toPtr = XML_T('\\0');\n      result = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings));\n      if (result)\n        return result;\n      if (parser->m_startElementHandler)\n        parser->m_startElementHandler(parser->m_handlerArg, tag->name.str,\n                                      (const XML_Char **)parser->m_atts);\n      else if (parser->m_defaultHandler)\n        reportDefault(parser, enc, s, next);\n      poolClear(&parser->m_tempPool);\n      break;\n    }\n    case XML_TOK_EMPTY_ELEMENT_NO_ATTS:\n      /* fall through */\n    case XML_TOK_EMPTY_ELEMENT_WITH_ATTS: {\n      const char *rawName = s + enc->minBytesPerChar;\n      enum XML_Error result;\n      BINDING *bindings = NULL;\n      XML_Bool noElmHandlers = XML_TRUE;\n      TAG_NAME name;\n      name.str = poolStoreString(&parser->m_tempPool, enc, rawName,\n                                 rawName + XmlNameLength(enc, rawName));\n      if (! name.str)\n        return XML_ERROR_NO_MEMORY;\n      poolFinish(&parser->m_tempPool);\n      result = storeAtts(parser, enc, s, &name, &bindings);\n      if (result != XML_ERROR_NONE) {\n        freeBindings(parser, bindings);\n        return result;\n      }\n      poolFinish(&parser->m_tempPool);\n      if (parser->m_startElementHandler) {\n        parser->m_startElementHandler(parser->m_handlerArg, name.str,\n                                      (const XML_Char **)parser->m_atts);\n        noElmHandlers = XML_FALSE;\n      }\n      if (parser->m_endElementHandler) {\n        if (parser->m_startElementHandler)\n          *eventPP = *eventEndPP;\n        parser->m_endElementHandler(parser->m_handlerArg, name.str);\n        noElmHandlers = XML_FALSE;\n      }\n      if (noElmHandlers && parser->m_defaultHandler)\n        reportDefault(parser, enc, s, next);\n      poolClear(&parser->m_tempPool);\n      freeBindings(parser, bindings);\n    }\n      if ((parser->m_tagLevel == 0)\n          && (parser->m_parsingStatus.parsing != XML_FINISHED)) {\n        if (parser->m_parsingStatus.parsing == XML_SUSPENDED)\n          parser->m_processor = epilogProcessor;\n        else\n          return epilogProcessor(parser, next, end, nextPtr);\n      }\n      break;\n    case XML_TOK_END_TAG:\n      if (parser->m_tagLevel == startTagLevel)\n        return XML_ERROR_ASYNC_ENTITY;\n      else {\n        int len;\n        const char *rawName;\n        TAG *tag = parser->m_tagStack;\n        parser->m_tagStack = tag->parent;\n        tag->parent = parser->m_freeTagList;\n        parser->m_freeTagList = tag;\n        rawName = s + enc->minBytesPerChar * 2;\n        len = XmlNameLength(enc, rawName);\n        if (len != tag->rawNameLength\n            || memcmp(tag->rawName, rawName, len) != 0) {\n          *eventPP = rawName;\n          return XML_ERROR_TAG_MISMATCH;\n        }\n        --parser->m_tagLevel;\n        if (parser->m_endElementHandler) {\n          const XML_Char *localPart;\n          const XML_Char *prefix;\n          XML_Char *uri;\n          localPart = tag->name.localPart;\n          if (parser->m_ns && localPart) {\n            /* localPart and prefix may have been overwritten in\n               tag->name.str, since this points to the binding->uri\n               buffer which gets re-used; so we have to add them again\n            */\n            uri = (XML_Char *)tag->name.str + tag->name.uriLen;\n            /* don't need to check for space - already done in storeAtts() */\n            while (*localPart)\n              *uri++ = *localPart++;\n            prefix = (XML_Char *)tag->name.prefix;\n            if (parser->m_ns_triplets && prefix) {\n              *uri++ = parser->m_namespaceSeparator;\n              while (*prefix)\n                *uri++ = *prefix++;\n            }\n            *uri = XML_T('\\0');\n          }\n          parser->m_endElementHandler(parser->m_handlerArg, tag->name.str);\n        } else if (parser->m_defaultHandler)\n          reportDefault(parser, enc, s, next);\n        while (tag->bindings) {\n          BINDING *b = tag->bindings;\n          if (parser->m_endNamespaceDeclHandler)\n            parser->m_endNamespaceDeclHandler(parser->m_handlerArg,\n                                              b->prefix->name);\n          tag->bindings = tag->bindings->nextTagBinding;\n          b->nextTagBinding = parser->m_freeBindingList;\n          parser->m_freeBindingList = b;\n          b->prefix->binding = b->prevPrefixBinding;\n        }\n        if ((parser->m_tagLevel == 0)\n            && (parser->m_parsingStatus.parsing != XML_FINISHED)) {\n          if (parser->m_parsingStatus.parsing == XML_SUSPENDED)\n            parser->m_processor = epilogProcessor;\n          else\n            return epilogProcessor(parser, next, end, nextPtr);\n        }\n      }\n      break;\n    case XML_TOK_CHAR_REF: {\n      int n = XmlCharRefNumber(enc, s);\n      if (n < 0)\n        return XML_ERROR_BAD_CHAR_REF;\n      if (parser->m_characterDataHandler) {\n        XML_Char buf[XML_ENCODE_MAX];\n        parser->m_characterDataHandler(parser->m_handlerArg, buf,\n                                       XmlEncode(n, (ICHAR *)buf));\n      } else if (parser->m_defaultHandler)\n        reportDefault(parser, enc, s, next);\n    } break;\n    case XML_TOK_XML_DECL:\n      return XML_ERROR_MISPLACED_XML_PI;\n    case XML_TOK_DATA_NEWLINE:\n      if (parser->m_characterDataHandler) {\n        XML_Char c = 0xA;\n        parser->m_characterDataHandler(parser->m_handlerArg, &c, 1);\n      } else if (parser->m_defaultHandler)\n        reportDefault(parser, enc, s, next);\n      break;\n    case XML_TOK_CDATA_SECT_OPEN: {\n      enum XML_Error result;\n      if (parser->m_startCdataSectionHandler)\n        parser->m_startCdataSectionHandler(parser->m_handlerArg);\n      /* BEGIN disabled code */\n      /* Suppose you doing a transformation on a document that involves\n         changing only the character data.  You set up a defaultHandler\n         and a characterDataHandler.  The defaultHandler simply copies\n         characters through.  The characterDataHandler does the\n         transformation and writes the characters out escaping them as\n         necessary.  This case will fail to work if we leave out the\n         following two lines (because & and < inside CDATA sections will\n         be incorrectly escaped).\n\n         However, now we have a start/endCdataSectionHandler, so it seems\n         easier to let the user deal with this.\n      */\n      else if (0 && parser->m_characterDataHandler)\n        parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf,\n                                       0);\n      /* END disabled code */\n      else if (parser->m_defaultHandler)\n        reportDefault(parser, enc, s, next);\n      result = doCdataSection(parser, enc, &next, end, nextPtr, haveMore);\n      if (result != XML_ERROR_NONE)\n        return result;\n      else if (! next) {\n        parser->m_processor = cdataSectionProcessor;\n        return result;\n      }\n    } break;\n    case XML_TOK_TRAILING_RSQB:\n      if (haveMore) {\n        *nextPtr = s;\n        return XML_ERROR_NONE;\n      }\n      if (parser->m_characterDataHandler) {\n        if (MUST_CONVERT(enc, s)) {\n          ICHAR *dataPtr = (ICHAR *)parser->m_dataBuf;\n          XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)parser->m_dataBufEnd);\n          parser->m_characterDataHandler(\n              parser->m_handlerArg, parser->m_dataBuf,\n              (int)(dataPtr - (ICHAR *)parser->m_dataBuf));\n        } else\n          parser->m_characterDataHandler(\n              parser->m_handlerArg, (XML_Char *)s,\n              (int)((XML_Char *)end - (XML_Char *)s));\n      } else if (parser->m_defaultHandler)\n        reportDefault(parser, enc, s, end);\n      /* We are at the end of the final buffer, should we check for\n         XML_SUSPENDED, XML_FINISHED?\n      */\n      if (startTagLevel == 0) {\n        *eventPP = end;\n        return XML_ERROR_NO_ELEMENTS;\n      }\n      if (parser->m_tagLevel != startTagLevel) {\n        *eventPP = end;\n        return XML_ERROR_ASYNC_ENTITY;\n      }\n      *nextPtr = end;\n      return XML_ERROR_NONE;\n    case XML_TOK_DATA_CHARS: {\n      XML_CharacterDataHandler charDataHandler = parser->m_characterDataHandler;\n      if (charDataHandler) {\n        if (MUST_CONVERT(enc, s)) {\n          for (;;) {\n            ICHAR *dataPtr = (ICHAR *)parser->m_dataBuf;\n            const enum XML_Convert_Result convert_res = XmlConvert(\n                enc, &s, next, &dataPtr, (ICHAR *)parser->m_dataBufEnd);\n            *eventEndPP = s;\n            charDataHandler(parser->m_handlerArg, parser->m_dataBuf,\n                            (int)(dataPtr - (ICHAR *)parser->m_dataBuf));\n            if ((convert_res == XML_CONVERT_COMPLETED)\n                || (convert_res == XML_CONVERT_INPUT_INCOMPLETE))\n              break;\n            *eventPP = s;\n          }\n        } else\n          charDataHandler(parser->m_handlerArg, (XML_Char *)s,\n                          (int)((XML_Char *)next - (XML_Char *)s));\n      } else if (parser->m_defaultHandler)\n        reportDefault(parser, enc, s, next);\n    } break;\n    case XML_TOK_PI:\n      if (! reportProcessingInstruction(parser, enc, s, next))\n        return XML_ERROR_NO_MEMORY;\n      break;\n    case XML_TOK_COMMENT:\n      if (! reportComment(parser, enc, s, next))\n        return XML_ERROR_NO_MEMORY;\n      break;\n    default:\n      /* All of the tokens produced by XmlContentTok() have their own\n       * explicit cases, so this default is not strictly necessary.\n       * However it is a useful safety net, so we retain the code and\n       * simply exclude it from the coverage tests.\n       *\n       * LCOV_EXCL_START\n       */\n      if (parser->m_defaultHandler)\n        reportDefault(parser, enc, s, next);\n      break;\n      /* LCOV_EXCL_STOP */\n    }\n    *eventPP = s = next;\n    switch (parser->m_parsingStatus.parsing) {\n    case XML_SUSPENDED:\n      *nextPtr = next;\n      return XML_ERROR_NONE;\n    case XML_FINISHED:\n      return XML_ERROR_ABORTED;\n    default:;\n    }\n  }\n  /* not reached */\n}\n\n/* This function does not call free() on the allocated memory, merely\n * moving it to the parser's m_freeBindingList where it can be freed or\n * reused as appropriate.\n */\nstatic void\nfreeBindings(XML_Parser parser, BINDING *bindings) {\n  while (bindings) {\n    BINDING *b = bindings;\n\n    /* m_startNamespaceDeclHandler will have been called for this\n     * binding in addBindings(), so call the end handler now.\n     */\n    if (parser->m_endNamespaceDeclHandler)\n      parser->m_endNamespaceDeclHandler(parser->m_handlerArg, b->prefix->name);\n\n    bindings = bindings->nextTagBinding;\n    b->nextTagBinding = parser->m_freeBindingList;\n    parser->m_freeBindingList = b;\n    b->prefix->binding = b->prevPrefixBinding;\n  }\n}\n\n/* Precondition: all arguments must be non-NULL;\n   Purpose:\n   - normalize attributes\n   - check attributes for well-formedness\n   - generate namespace aware attribute names (URI, prefix)\n   - build list of attributes for startElementHandler\n   - default attributes\n   - process namespace declarations (check and report them)\n   - generate namespace aware element name (URI, prefix)\n*/\nstatic enum XML_Error\nstoreAtts(XML_Parser parser, const ENCODING *enc, const char *attStr,\n          TAG_NAME *tagNamePtr, BINDING **bindingsPtr) {\n  DTD *const dtd = parser->m_dtd; /* save one level of indirection */\n  ELEMENT_TYPE *elementType;\n  int nDefaultAtts;\n  const XML_Char **appAtts; /* the attribute list for the application */\n  int attIndex = 0;\n  int prefixLen;\n  int i;\n  int n;\n  XML_Char *uri;\n  int nPrefixes = 0;\n  BINDING *binding;\n  const XML_Char *localPart;\n\n  /* lookup the element type name */\n  elementType\n      = (ELEMENT_TYPE *)lookup(parser, &dtd->elementTypes, tagNamePtr->str, 0);\n  if (! elementType) {\n    const XML_Char *name = poolCopyString(&dtd->pool, tagNamePtr->str);\n    if (! name)\n      return XML_ERROR_NO_MEMORY;\n    elementType = (ELEMENT_TYPE *)lookup(parser, &dtd->elementTypes, name,\n                                         sizeof(ELEMENT_TYPE));\n    if (! elementType)\n      return XML_ERROR_NO_MEMORY;\n    if (parser->m_ns && ! setElementTypePrefix(parser, elementType))\n      return XML_ERROR_NO_MEMORY;\n  }\n  nDefaultAtts = elementType->nDefaultAtts;\n\n  /* get the attributes from the tokenizer */\n  n = XmlGetAttributes(enc, attStr, parser->m_attsSize, parser->m_atts);\n  if (n + nDefaultAtts > parser->m_attsSize) {\n    int oldAttsSize = parser->m_attsSize;\n    ATTRIBUTE *temp;\n#ifdef XML_ATTR_INFO\n    XML_AttrInfo *temp2;\n#endif\n    parser->m_attsSize = n + nDefaultAtts + INIT_ATTS_SIZE;\n    temp = (ATTRIBUTE *)REALLOC(parser, (void *)parser->m_atts,\n                                parser->m_attsSize * sizeof(ATTRIBUTE));\n    if (temp == NULL) {\n      parser->m_attsSize = oldAttsSize;\n      return XML_ERROR_NO_MEMORY;\n    }\n    parser->m_atts = temp;\n#ifdef XML_ATTR_INFO\n    temp2 = (XML_AttrInfo *)REALLOC(parser, (void *)parser->m_attInfo,\n                                    parser->m_attsSize * sizeof(XML_AttrInfo));\n    if (temp2 == NULL) {\n      parser->m_attsSize = oldAttsSize;\n      return XML_ERROR_NO_MEMORY;\n    }\n    parser->m_attInfo = temp2;\n#endif\n    if (n > oldAttsSize)\n      XmlGetAttributes(enc, attStr, n, parser->m_atts);\n  }\n\n  appAtts = (const XML_Char **)parser->m_atts;\n  for (i = 0; i < n; i++) {\n    ATTRIBUTE *currAtt = &parser->m_atts[i];\n#ifdef XML_ATTR_INFO\n    XML_AttrInfo *currAttInfo = &parser->m_attInfo[i];\n#endif\n    /* add the name and value to the attribute list */\n    ATTRIBUTE_ID *attId\n        = getAttributeId(parser, enc, currAtt->name,\n                         currAtt->name + XmlNameLength(enc, currAtt->name));\n    if (! attId)\n      return XML_ERROR_NO_MEMORY;\n#ifdef XML_ATTR_INFO\n    currAttInfo->nameStart\n        = parser->m_parseEndByteIndex - (parser->m_parseEndPtr - currAtt->name);\n    currAttInfo->nameEnd\n        = currAttInfo->nameStart + XmlNameLength(enc, currAtt->name);\n    currAttInfo->valueStart = parser->m_parseEndByteIndex\n                              - (parser->m_parseEndPtr - currAtt->valuePtr);\n    currAttInfo->valueEnd = parser->m_parseEndByteIndex\n                            - (parser->m_parseEndPtr - currAtt->valueEnd);\n#endif\n    /* Detect duplicate attributes by their QNames. This does not work when\n       namespace processing is turned on and different prefixes for the same\n       namespace are used. For this case we have a check further down.\n    */\n    if ((attId->name)[-1]) {\n      if (enc == parser->m_encoding)\n        parser->m_eventPtr = parser->m_atts[i].name;\n      return XML_ERROR_DUPLICATE_ATTRIBUTE;\n    }\n    (attId->name)[-1] = 1;\n    appAtts[attIndex++] = attId->name;\n    if (! parser->m_atts[i].normalized) {\n      enum XML_Error result;\n      XML_Bool isCdata = XML_TRUE;\n\n      /* figure out whether declared as other than CDATA */\n      if (attId->maybeTokenized) {\n        int j;\n        for (j = 0; j < nDefaultAtts; j++) {\n          if (attId == elementType->defaultAtts[j].id) {\n            isCdata = elementType->defaultAtts[j].isCdata;\n            break;\n          }\n        }\n      }\n\n      /* normalize the attribute value */\n      result = storeAttributeValue(\n          parser, enc, isCdata, parser->m_atts[i].valuePtr,\n          parser->m_atts[i].valueEnd, &parser->m_tempPool);\n      if (result)\n        return result;\n      appAtts[attIndex] = poolStart(&parser->m_tempPool);\n      poolFinish(&parser->m_tempPool);\n    } else {\n      /* the value did not need normalizing */\n      appAtts[attIndex] = poolStoreString(&parser->m_tempPool, enc,\n                                          parser->m_atts[i].valuePtr,\n                                          parser->m_atts[i].valueEnd);\n      if (appAtts[attIndex] == 0)\n        return XML_ERROR_NO_MEMORY;\n      poolFinish(&parser->m_tempPool);\n    }\n    /* handle prefixed attribute names */\n    if (attId->prefix) {\n      if (attId->xmlns) {\n        /* deal with namespace declarations here */\n        enum XML_Error result = addBinding(parser, attId->prefix, attId,\n                                           appAtts[attIndex], bindingsPtr);\n        if (result)\n          return result;\n        --attIndex;\n      } else {\n        /* deal with other prefixed names later */\n        attIndex++;\n        nPrefixes++;\n        (attId->name)[-1] = 2;\n      }\n    } else\n      attIndex++;\n  }\n\n  /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */\n  parser->m_nSpecifiedAtts = attIndex;\n  if (elementType->idAtt && (elementType->idAtt->name)[-1]) {\n    for (i = 0; i < attIndex; i += 2)\n      if (appAtts[i] == elementType->idAtt->name) {\n        parser->m_idAttIndex = i;\n        break;\n      }\n  } else\n    parser->m_idAttIndex = -1;\n\n  /* do attribute defaulting */\n  for (i = 0; i < nDefaultAtts; i++) {\n    const DEFAULT_ATTRIBUTE *da = elementType->defaultAtts + i;\n    if (! (da->id->name)[-1] && da->value) {\n      if (da->id->prefix) {\n        if (da->id->xmlns) {\n          enum XML_Error result = addBinding(parser, da->id->prefix, da->id,\n                                             da->value, bindingsPtr);\n          if (result)\n            return result;\n        } else {\n          (da->id->name)[-1] = 2;\n          nPrefixes++;\n          appAtts[attIndex++] = da->id->name;\n          appAtts[attIndex++] = da->value;\n        }\n      } else {\n        (da->id->name)[-1] = 1;\n        appAtts[attIndex++] = da->id->name;\n        appAtts[attIndex++] = da->value;\n      }\n    }\n  }\n  appAtts[attIndex] = 0;\n\n  /* expand prefixed attribute names, check for duplicates,\n     and clear flags that say whether attributes were specified */\n  i = 0;\n  if (nPrefixes) {\n    int j; /* hash table index */\n    unsigned long version = parser->m_nsAttsVersion;\n    int nsAttsSize = (int)1 << parser->m_nsAttsPower;\n    unsigned char oldNsAttsPower = parser->m_nsAttsPower;\n    /* size of hash table must be at least 2 * (# of prefixed attributes) */\n    if ((nPrefixes << 1)\n        >> parser->m_nsAttsPower) { /* true for m_nsAttsPower = 0 */\n      NS_ATT *temp;\n      /* hash table size must also be a power of 2 and >= 8 */\n      while (nPrefixes >> parser->m_nsAttsPower++)\n        ;\n      if (parser->m_nsAttsPower < 3)\n        parser->m_nsAttsPower = 3;\n      nsAttsSize = (int)1 << parser->m_nsAttsPower;\n      temp = (NS_ATT *)REALLOC(parser, parser->m_nsAtts,\n                               nsAttsSize * sizeof(NS_ATT));\n      if (! temp) {\n        /* Restore actual size of memory in m_nsAtts */\n        parser->m_nsAttsPower = oldNsAttsPower;\n        return XML_ERROR_NO_MEMORY;\n      }\n      parser->m_nsAtts = temp;\n      version = 0; /* force re-initialization of m_nsAtts hash table */\n    }\n    /* using a version flag saves us from initializing m_nsAtts every time */\n    if (! version) { /* initialize version flags when version wraps around */\n      version = INIT_ATTS_VERSION;\n      for (j = nsAttsSize; j != 0;)\n        parser->m_nsAtts[--j].version = version;\n    }\n    parser->m_nsAttsVersion = --version;\n\n    /* expand prefixed names and check for duplicates */\n    for (; i < attIndex; i += 2) {\n      const XML_Char *s = appAtts[i];\n      if (s[-1] == 2) { /* prefixed */\n        ATTRIBUTE_ID *id;\n        const BINDING *b;\n        unsigned long uriHash;\n        struct siphash sip_state;\n        struct sipkey sip_key;\n\n        copy_salt_to_sipkey(parser, &sip_key);\n        sip24_init(&sip_state, &sip_key);\n\n        ((XML_Char *)s)[-1] = 0; /* clear flag */\n        id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0);\n        if (! id || ! id->prefix) {\n          /* This code is walking through the appAtts array, dealing\n           * with (in this case) a prefixed attribute name.  To be in\n           * the array, the attribute must have already been bound, so\n           * has to have passed through the hash table lookup once\n           * already.  That implies that an entry for it already\n           * exists, so the lookup above will return a pointer to\n           * already allocated memory.  There is no opportunaity for\n           * the allocator to fail, so the condition above cannot be\n           * fulfilled.\n           *\n           * Since it is difficult to be certain that the above\n           * analysis is complete, we retain the test and merely\n           * remove the code from coverage tests.\n           */\n          return XML_ERROR_NO_MEMORY; /* LCOV_EXCL_LINE */\n        }\n        b = id->prefix->binding;\n        if (! b)\n          return XML_ERROR_UNBOUND_PREFIX;\n\n        for (j = 0; j < b->uriLen; j++) {\n          const XML_Char c = b->uri[j];\n          if (! poolAppendChar(&parser->m_tempPool, c))\n            return XML_ERROR_NO_MEMORY;\n        }\n\n        sip24_update(&sip_state, b->uri, b->uriLen * sizeof(XML_Char));\n\n        while (*s++ != XML_T(ASCII_COLON))\n          ;\n\n        sip24_update(&sip_state, s, keylen(s) * sizeof(XML_Char));\n\n        do { /* copies null terminator */\n          if (! poolAppendChar(&parser->m_tempPool, *s))\n            return XML_ERROR_NO_MEMORY;\n        } while (*s++);\n\n        uriHash = (unsigned long)sip24_final(&sip_state);\n\n        { /* Check hash table for duplicate of expanded name (uriName).\n             Derived from code in lookup(parser, HASH_TABLE *table, ...).\n          */\n          unsigned char step = 0;\n          unsigned long mask = nsAttsSize - 1;\n          j = uriHash & mask; /* index into hash table */\n          while (parser->m_nsAtts[j].version == version) {\n            /* for speed we compare stored hash values first */\n            if (uriHash == parser->m_nsAtts[j].hash) {\n              const XML_Char *s1 = poolStart(&parser->m_tempPool);\n              const XML_Char *s2 = parser->m_nsAtts[j].uriName;\n              /* s1 is null terminated, but not s2 */\n              for (; *s1 == *s2 && *s1 != 0; s1++, s2++)\n                ;\n              if (*s1 == 0)\n                return XML_ERROR_DUPLICATE_ATTRIBUTE;\n            }\n            if (! step)\n              step = PROBE_STEP(uriHash, mask, parser->m_nsAttsPower);\n            j < step ? (j += nsAttsSize - step) : (j -= step);\n          }\n        }\n\n        if (parser->m_ns_triplets) { /* append namespace separator and prefix */\n          parser->m_tempPool.ptr[-1] = parser->m_namespaceSeparator;\n          s = b->prefix->name;\n          do {\n            if (! poolAppendChar(&parser->m_tempPool, *s))\n              return XML_ERROR_NO_MEMORY;\n          } while (*s++);\n        }\n\n        /* store expanded name in attribute list */\n        s = poolStart(&parser->m_tempPool);\n        poolFinish(&parser->m_tempPool);\n        appAtts[i] = s;\n\n        /* fill empty slot with new version, uriName and hash value */\n        parser->m_nsAtts[j].version = version;\n        parser->m_nsAtts[j].hash = uriHash;\n        parser->m_nsAtts[j].uriName = s;\n\n        if (! --nPrefixes) {\n          i += 2;\n          break;\n        }\n      } else                     /* not prefixed */\n        ((XML_Char *)s)[-1] = 0; /* clear flag */\n    }\n  }\n  /* clear flags for the remaining attributes */\n  for (; i < attIndex; i += 2)\n    ((XML_Char *)(appAtts[i]))[-1] = 0;\n  for (binding = *bindingsPtr; binding; binding = binding->nextTagBinding)\n    binding->attId->name[-1] = 0;\n\n  if (! parser->m_ns)\n    return XML_ERROR_NONE;\n\n  /* expand the element type name */\n  if (elementType->prefix) {\n    binding = elementType->prefix->binding;\n    if (! binding)\n      return XML_ERROR_UNBOUND_PREFIX;\n    localPart = tagNamePtr->str;\n    while (*localPart++ != XML_T(ASCII_COLON))\n      ;\n  } else if (dtd->defaultPrefix.binding) {\n    binding = dtd->defaultPrefix.binding;\n    localPart = tagNamePtr->str;\n  } else\n    return XML_ERROR_NONE;\n  prefixLen = 0;\n  if (parser->m_ns_triplets && binding->prefix->name) {\n    for (; binding->prefix->name[prefixLen++];)\n      ; /* prefixLen includes null terminator */\n  }\n  tagNamePtr->localPart = localPart;\n  tagNamePtr->uriLen = binding->uriLen;\n  tagNamePtr->prefix = binding->prefix->name;\n  tagNamePtr->prefixLen = prefixLen;\n  for (i = 0; localPart[i++];)\n    ; /* i includes null terminator */\n  n = i + binding->uriLen + prefixLen;\n  if (n > binding->uriAlloc) {\n    TAG *p;\n    uri = (XML_Char *)MALLOC(parser, (n + EXPAND_SPARE) * sizeof(XML_Char));\n    if (! uri)\n      return XML_ERROR_NO_MEMORY;\n    binding->uriAlloc = n + EXPAND_SPARE;\n    memcpy(uri, binding->uri, binding->uriLen * sizeof(XML_Char));\n    for (p = parser->m_tagStack; p; p = p->parent)\n      if (p->name.str == binding->uri)\n        p->name.str = uri;\n    FREE(parser, binding->uri);\n    binding->uri = uri;\n  }\n  /* if m_namespaceSeparator != '\\0' then uri includes it already */\n  uri = binding->uri + binding->uriLen;\n  memcpy(uri, localPart, i * sizeof(XML_Char));\n  /* we always have a namespace separator between localPart and prefix */\n  if (prefixLen) {\n    uri += i - 1;\n    *uri = parser->m_namespaceSeparator; /* replace null terminator */\n    memcpy(uri + 1, binding->prefix->name, prefixLen * sizeof(XML_Char));\n  }\n  tagNamePtr->str = binding->uri;\n  return XML_ERROR_NONE;\n}\n\n/* addBinding() overwrites the value of prefix->binding without checking.\n   Therefore one must keep track of the old value outside of addBinding().\n*/\nstatic enum XML_Error\naddBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId,\n           const XML_Char *uri, BINDING **bindingsPtr) {\n  static const XML_Char xmlNamespace[]\n      = {ASCII_h,      ASCII_t,     ASCII_t,     ASCII_p,      ASCII_COLON,\n         ASCII_SLASH,  ASCII_SLASH, ASCII_w,     ASCII_w,      ASCII_w,\n         ASCII_PERIOD, ASCII_w,     ASCII_3,     ASCII_PERIOD, ASCII_o,\n         ASCII_r,      ASCII_g,     ASCII_SLASH, ASCII_X,      ASCII_M,\n         ASCII_L,      ASCII_SLASH, ASCII_1,     ASCII_9,      ASCII_9,\n         ASCII_8,      ASCII_SLASH, ASCII_n,     ASCII_a,      ASCII_m,\n         ASCII_e,      ASCII_s,     ASCII_p,     ASCII_a,      ASCII_c,\n         ASCII_e,      '\\0'};\n  static const int xmlLen = (int)sizeof(xmlNamespace) / sizeof(XML_Char) - 1;\n  static const XML_Char xmlnsNamespace[]\n      = {ASCII_h,     ASCII_t,      ASCII_t, ASCII_p, ASCII_COLON,  ASCII_SLASH,\n         ASCII_SLASH, ASCII_w,      ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w,\n         ASCII_3,     ASCII_PERIOD, ASCII_o, ASCII_r, ASCII_g,      ASCII_SLASH,\n         ASCII_2,     ASCII_0,      ASCII_0, ASCII_0, ASCII_SLASH,  ASCII_x,\n         ASCII_m,     ASCII_l,      ASCII_n, ASCII_s, ASCII_SLASH,  '\\0'};\n  static const int xmlnsLen\n      = (int)sizeof(xmlnsNamespace) / sizeof(XML_Char) - 1;\n\n  XML_Bool mustBeXML = XML_FALSE;\n  XML_Bool isXML = XML_TRUE;\n  XML_Bool isXMLNS = XML_TRUE;\n\n  BINDING *b;\n  int len;\n\n  /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */\n  if (*uri == XML_T('\\0') && prefix->name)\n    return XML_ERROR_UNDECLARING_PREFIX;\n\n  if (prefix->name && prefix->name[0] == XML_T(ASCII_x)\n      && prefix->name[1] == XML_T(ASCII_m)\n      && prefix->name[2] == XML_T(ASCII_l)) {\n    /* Not allowed to bind xmlns */\n    if (prefix->name[3] == XML_T(ASCII_n) && prefix->name[4] == XML_T(ASCII_s)\n        && prefix->name[5] == XML_T('\\0'))\n      return XML_ERROR_RESERVED_PREFIX_XMLNS;\n\n    if (prefix->name[3] == XML_T('\\0'))\n      mustBeXML = XML_TRUE;\n  }\n\n  for (len = 0; uri[len]; len++) {\n    if (isXML && (len > xmlLen || uri[len] != xmlNamespace[len]))\n      isXML = XML_FALSE;\n\n    if (! mustBeXML && isXMLNS\n        && (len > xmlnsLen || uri[len] != xmlnsNamespace[len]))\n      isXMLNS = XML_FALSE;\n  }\n  isXML = isXML && len == xmlLen;\n  isXMLNS = isXMLNS && len == xmlnsLen;\n\n  if (mustBeXML != isXML)\n    return mustBeXML ? XML_ERROR_RESERVED_PREFIX_XML\n                     : XML_ERROR_RESERVED_NAMESPACE_URI;\n\n  if (isXMLNS)\n    return XML_ERROR_RESERVED_NAMESPACE_URI;\n\n  if (parser->m_namespaceSeparator)\n    len++;\n  if (parser->m_freeBindingList) {\n    b = parser->m_freeBindingList;\n    if (len > b->uriAlloc) {\n      XML_Char *temp = (XML_Char *)REALLOC(\n          parser, b->uri, sizeof(XML_Char) * (len + EXPAND_SPARE));\n      if (temp == NULL)\n        return XML_ERROR_NO_MEMORY;\n      b->uri = temp;\n      b->uriAlloc = len + EXPAND_SPARE;\n    }\n    parser->m_freeBindingList = b->nextTagBinding;\n  } else {\n    b = (BINDING *)MALLOC(parser, sizeof(BINDING));\n    if (! b)\n      return XML_ERROR_NO_MEMORY;\n    b->uri\n        = (XML_Char *)MALLOC(parser, sizeof(XML_Char) * (len + EXPAND_SPARE));\n    if (! b->uri) {\n      FREE(parser, b);\n      return XML_ERROR_NO_MEMORY;\n    }\n    b->uriAlloc = len + EXPAND_SPARE;\n  }\n  b->uriLen = len;\n  memcpy(b->uri, uri, len * sizeof(XML_Char));\n  if (parser->m_namespaceSeparator)\n    b->uri[len - 1] = parser->m_namespaceSeparator;\n  b->prefix = prefix;\n  b->attId = attId;\n  b->prevPrefixBinding = prefix->binding;\n  /* NULL binding when default namespace undeclared */\n  if (*uri == XML_T('\\0') && prefix == &parser->m_dtd->defaultPrefix)\n    prefix->binding = NULL;\n  else\n    prefix->binding = b;\n  b->nextTagBinding = *bindingsPtr;\n  *bindingsPtr = b;\n  /* if attId == NULL then we are not starting a namespace scope */\n  if (attId && parser->m_startNamespaceDeclHandler)\n    parser->m_startNamespaceDeclHandler(parser->m_handlerArg, prefix->name,\n                                        prefix->binding ? uri : 0);\n  return XML_ERROR_NONE;\n}\n\n/* The idea here is to avoid using stack for each CDATA section when\n   the whole file is parsed with one call.\n*/\nstatic enum XML_Error PTRCALL\ncdataSectionProcessor(XML_Parser parser, const char *start, const char *end,\n                      const char **endPtr) {\n  enum XML_Error result\n      = doCdataSection(parser, parser->m_encoding, &start, end, endPtr,\n                       (XML_Bool)! parser->m_parsingStatus.finalBuffer);\n  if (result != XML_ERROR_NONE)\n    return result;\n  if (start) {\n    if (parser->m_parentParser) { /* we are parsing an external entity */\n      parser->m_processor = externalEntityContentProcessor;\n      return externalEntityContentProcessor(parser, start, end, endPtr);\n    } else {\n      parser->m_processor = contentProcessor;\n      return contentProcessor(parser, start, end, endPtr);\n    }\n  }\n  return result;\n}\n\n/* startPtr gets set to non-null if the section is closed, and to null if\n   the section is not yet closed.\n*/\nstatic enum XML_Error\ndoCdataSection(XML_Parser parser, const ENCODING *enc, const char **startPtr,\n               const char *end, const char **nextPtr, XML_Bool haveMore) {\n  const char *s = *startPtr;\n  const char **eventPP;\n  const char **eventEndPP;\n  if (enc == parser->m_encoding) {\n    eventPP = &parser->m_eventPtr;\n    *eventPP = s;\n    eventEndPP = &parser->m_eventEndPtr;\n  } else {\n    eventPP = &(parser->m_openInternalEntities->internalEventPtr);\n    eventEndPP = &(parser->m_openInternalEntities->internalEventEndPtr);\n  }\n  *eventPP = s;\n  *startPtr = NULL;\n\n  for (;;) {\n    const char *next;\n    int tok = XmlCdataSectionTok(enc, s, end, &next);\n    *eventEndPP = next;\n    switch (tok) {\n    case XML_TOK_CDATA_SECT_CLOSE:\n      if (parser->m_endCdataSectionHandler)\n        parser->m_endCdataSectionHandler(parser->m_handlerArg);\n      /* BEGIN disabled code */\n      /* see comment under XML_TOK_CDATA_SECT_OPEN */\n      else if (0 && parser->m_characterDataHandler)\n        parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf,\n                                       0);\n      /* END disabled code */\n      else if (parser->m_defaultHandler)\n        reportDefault(parser, enc, s, next);\n      *startPtr = next;\n      *nextPtr = next;\n      if (parser->m_parsingStatus.parsing == XML_FINISHED)\n        return XML_ERROR_ABORTED;\n      else\n        return XML_ERROR_NONE;\n    case XML_TOK_DATA_NEWLINE:\n      if (parser->m_characterDataHandler) {\n        XML_Char c = 0xA;\n        parser->m_characterDataHandler(parser->m_handlerArg, &c, 1);\n      } else if (parser->m_defaultHandler)\n        reportDefault(parser, enc, s, next);\n      break;\n    case XML_TOK_DATA_CHARS: {\n      XML_CharacterDataHandler charDataHandler = parser->m_characterDataHandler;\n      if (charDataHandler) {\n        if (MUST_CONVERT(enc, s)) {\n          for (;;) {\n            ICHAR *dataPtr = (ICHAR *)parser->m_dataBuf;\n            const enum XML_Convert_Result convert_res = XmlConvert(\n                enc, &s, next, &dataPtr, (ICHAR *)parser->m_dataBufEnd);\n            *eventEndPP = next;\n            charDataHandler(parser->m_handlerArg, parser->m_dataBuf,\n                            (int)(dataPtr - (ICHAR *)parser->m_dataBuf));\n            if ((convert_res == XML_CONVERT_COMPLETED)\n                || (convert_res == XML_CONVERT_INPUT_INCOMPLETE))\n              break;\n            *eventPP = s;\n          }\n        } else\n          charDataHandler(parser->m_handlerArg, (XML_Char *)s,\n                          (int)((XML_Char *)next - (XML_Char *)s));\n      } else if (parser->m_defaultHandler)\n        reportDefault(parser, enc, s, next);\n    } break;\n    case XML_TOK_INVALID:\n      *eventPP = next;\n      return XML_ERROR_INVALID_TOKEN;\n    case XML_TOK_PARTIAL_CHAR:\n      if (haveMore) {\n        *nextPtr = s;\n        return XML_ERROR_NONE;\n      }\n      return XML_ERROR_PARTIAL_CHAR;\n    case XML_TOK_PARTIAL:\n    case XML_TOK_NONE:\n      if (haveMore) {\n        *nextPtr = s;\n        return XML_ERROR_NONE;\n      }\n      return XML_ERROR_UNCLOSED_CDATA_SECTION;\n    default:\n      /* Every token returned by XmlCdataSectionTok() has its own\n       * explicit case, so this default case will never be executed.\n       * We retain it as a safety net and exclude it from the coverage\n       * statistics.\n       *\n       * LCOV_EXCL_START\n       */\n      *eventPP = next;\n      return XML_ERROR_UNEXPECTED_STATE;\n      /* LCOV_EXCL_STOP */\n    }\n\n    *eventPP = s = next;\n    switch (parser->m_parsingStatus.parsing) {\n    case XML_SUSPENDED:\n      *nextPtr = next;\n      return XML_ERROR_NONE;\n    case XML_FINISHED:\n      return XML_ERROR_ABORTED;\n    default:;\n    }\n  }\n  /* not reached */\n}\n\n#ifdef XML_DTD\n\n/* The idea here is to avoid using stack for each IGNORE section when\n   the whole file is parsed with one call.\n*/\nstatic enum XML_Error PTRCALL\nignoreSectionProcessor(XML_Parser parser, const char *start, const char *end,\n                       const char **endPtr) {\n  enum XML_Error result\n      = doIgnoreSection(parser, parser->m_encoding, &start, end, endPtr,\n                        (XML_Bool)! parser->m_parsingStatus.finalBuffer);\n  if (result != XML_ERROR_NONE)\n    return result;\n  if (start) {\n    parser->m_processor = prologProcessor;\n    return prologProcessor(parser, start, end, endPtr);\n  }\n  return result;\n}\n\n/* startPtr gets set to non-null is the section is closed, and to null\n   if the section is not yet closed.\n*/\nstatic enum XML_Error\ndoIgnoreSection(XML_Parser parser, const ENCODING *enc, const char **startPtr,\n                const char *end, const char **nextPtr, XML_Bool haveMore) {\n  const char *next;\n  int tok;\n  const char *s = *startPtr;\n  const char **eventPP;\n  const char **eventEndPP;\n  if (enc == parser->m_encoding) {\n    eventPP = &parser->m_eventPtr;\n    *eventPP = s;\n    eventEndPP = &parser->m_eventEndPtr;\n  } else {\n    /* It's not entirely clear, but it seems the following two lines\n     * of code cannot be executed.  The only occasions on which 'enc'\n     * is not 'encoding' are when this function is called\n     * from the internal entity processing, and IGNORE sections are an\n     * error in internal entities.\n     *\n     * Since it really isn't clear that this is true, we keep the code\n     * and just remove it from our coverage tests.\n     *\n     * LCOV_EXCL_START\n     */\n    eventPP = &(parser->m_openInternalEntities->internalEventPtr);\n    eventEndPP = &(parser->m_openInternalEntities->internalEventEndPtr);\n    /* LCOV_EXCL_STOP */\n  }\n  *eventPP = s;\n  *startPtr = NULL;\n  tok = XmlIgnoreSectionTok(enc, s, end, &next);\n  *eventEndPP = next;\n  switch (tok) {\n  case XML_TOK_IGNORE_SECT:\n    if (parser->m_defaultHandler)\n      reportDefault(parser, enc, s, next);\n    *startPtr = next;\n    *nextPtr = next;\n    if (parser->m_parsingStatus.parsing == XML_FINISHED)\n      return XML_ERROR_ABORTED;\n    else\n      return XML_ERROR_NONE;\n  case XML_TOK_INVALID:\n    *eventPP = next;\n    return XML_ERROR_INVALID_TOKEN;\n  case XML_TOK_PARTIAL_CHAR:\n    if (haveMore) {\n      *nextPtr = s;\n      return XML_ERROR_NONE;\n    }\n    return XML_ERROR_PARTIAL_CHAR;\n  case XML_TOK_PARTIAL:\n  case XML_TOK_NONE:\n    if (haveMore) {\n      *nextPtr = s;\n      return XML_ERROR_NONE;\n    }\n    return XML_ERROR_SYNTAX; /* XML_ERROR_UNCLOSED_IGNORE_SECTION */\n  default:\n    /* All of the tokens that XmlIgnoreSectionTok() returns have\n     * explicit cases to handle them, so this default case is never\n     * executed.  We keep it as a safety net anyway, and remove it\n     * from our test coverage statistics.\n     *\n     * LCOV_EXCL_START\n     */\n    *eventPP = next;\n    return XML_ERROR_UNEXPECTED_STATE;\n    /* LCOV_EXCL_STOP */\n  }\n  /* not reached */\n}\n\n#endif /* XML_DTD */\n\nstatic enum XML_Error\ninitializeEncoding(XML_Parser parser) {\n  const char *s;\n#ifdef XML_UNICODE\n  char encodingBuf[128];\n  /* See comments abount `protoclEncodingName` in parserInit() */\n  if (! parser->m_protocolEncodingName)\n    s = NULL;\n  else {\n    int i;\n    for (i = 0; parser->m_protocolEncodingName[i]; i++) {\n      if (i == sizeof(encodingBuf) - 1\n          || (parser->m_protocolEncodingName[i] & ~0x7f) != 0) {\n        encodingBuf[0] = '\\0';\n        break;\n      }\n      encodingBuf[i] = (char)parser->m_protocolEncodingName[i];\n    }\n    encodingBuf[i] = '\\0';\n    s = encodingBuf;\n  }\n#else\n  s = parser->m_protocolEncodingName;\n#endif\n  if ((parser->m_ns ? XmlInitEncodingNS : XmlInitEncoding)(\n          &parser->m_initEncoding, &parser->m_encoding, s))\n    return XML_ERROR_NONE;\n  return handleUnknownEncoding(parser, parser->m_protocolEncodingName);\n}\n\nstatic enum XML_Error\nprocessXmlDecl(XML_Parser parser, int isGeneralTextEntity, const char *s,\n               const char *next) {\n  const char *encodingName = NULL;\n  const XML_Char *storedEncName = NULL;\n  const ENCODING *newEncoding = NULL;\n  const char *version = NULL;\n  const char *versionend;\n  const XML_Char *storedversion = NULL;\n  int standalone = -1;\n  if (! (parser->m_ns ? XmlParseXmlDeclNS : XmlParseXmlDecl)(\n          isGeneralTextEntity, parser->m_encoding, s, next, &parser->m_eventPtr,\n          &version, &versionend, &encodingName, &newEncoding, &standalone)) {\n    if (isGeneralTextEntity)\n      return XML_ERROR_TEXT_DECL;\n    else\n      return XML_ERROR_XML_DECL;\n  }\n  if (! isGeneralTextEntity && standalone == 1) {\n    parser->m_dtd->standalone = XML_TRUE;\n#ifdef XML_DTD\n    if (parser->m_paramEntityParsing\n        == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE)\n      parser->m_paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;\n#endif /* XML_DTD */\n  }\n  if (parser->m_xmlDeclHandler) {\n    if (encodingName != NULL) {\n      storedEncName = poolStoreString(\n          &parser->m_temp2Pool, parser->m_encoding, encodingName,\n          encodingName + XmlNameLength(parser->m_encoding, encodingName));\n      if (! storedEncName)\n        return XML_ERROR_NO_MEMORY;\n      poolFinish(&parser->m_temp2Pool);\n    }\n    if (version) {\n      storedversion\n          = poolStoreString(&parser->m_temp2Pool, parser->m_encoding, version,\n                            versionend - parser->m_encoding->minBytesPerChar);\n      if (! storedversion)\n        return XML_ERROR_NO_MEMORY;\n    }\n    parser->m_xmlDeclHandler(parser->m_handlerArg, storedversion, storedEncName,\n                             standalone);\n  } else if (parser->m_defaultHandler)\n    reportDefault(parser, parser->m_encoding, s, next);\n  if (parser->m_protocolEncodingName == NULL) {\n    if (newEncoding) {\n      /* Check that the specified encoding does not conflict with what\n       * the parser has already deduced.  Do we have the same number\n       * of bytes in the smallest representation of a character?  If\n       * this is UTF-16, is it the same endianness?\n       */\n      if (newEncoding->minBytesPerChar != parser->m_encoding->minBytesPerChar\n          || (newEncoding->minBytesPerChar == 2\n              && newEncoding != parser->m_encoding)) {\n        parser->m_eventPtr = encodingName;\n        return XML_ERROR_INCORRECT_ENCODING;\n      }\n      parser->m_encoding = newEncoding;\n    } else if (encodingName) {\n      enum XML_Error result;\n      if (! storedEncName) {\n        storedEncName = poolStoreString(\n            &parser->m_temp2Pool, parser->m_encoding, encodingName,\n            encodingName + XmlNameLength(parser->m_encoding, encodingName));\n        if (! storedEncName)\n          return XML_ERROR_NO_MEMORY;\n      }\n      result = handleUnknownEncoding(parser, storedEncName);\n      poolClear(&parser->m_temp2Pool);\n      if (result == XML_ERROR_UNKNOWN_ENCODING)\n        parser->m_eventPtr = encodingName;\n      return result;\n    }\n  }\n\n  if (storedEncName || storedversion)\n    poolClear(&parser->m_temp2Pool);\n\n  return XML_ERROR_NONE;\n}\n\nstatic enum XML_Error\nhandleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName) {\n  if (parser->m_unknownEncodingHandler) {\n    XML_Encoding info;\n    int i;\n    for (i = 0; i < 256; i++)\n      info.map[i] = -1;\n    info.convert = NULL;\n    info.data = NULL;\n    info.release = NULL;\n    if (parser->m_unknownEncodingHandler(parser->m_unknownEncodingHandlerData,\n                                         encodingName, &info)) {\n      ENCODING *enc;\n      parser->m_unknownEncodingMem = MALLOC(parser, XmlSizeOfUnknownEncoding());\n      if (! parser->m_unknownEncodingMem) {\n        if (info.release)\n          info.release(info.data);\n        return XML_ERROR_NO_MEMORY;\n      }\n      enc = (parser->m_ns ? XmlInitUnknownEncodingNS : XmlInitUnknownEncoding)(\n          parser->m_unknownEncodingMem, info.map, info.convert, info.data);\n      if (enc) {\n        parser->m_unknownEncodingData = info.data;\n        parser->m_unknownEncodingRelease = info.release;\n        parser->m_encoding = enc;\n        return XML_ERROR_NONE;\n      }\n    }\n    if (info.release != NULL)\n      info.release(info.data);\n  }\n  return XML_ERROR_UNKNOWN_ENCODING;\n}\n\nstatic enum XML_Error PTRCALL\nprologInitProcessor(XML_Parser parser, const char *s, const char *end,\n                    const char **nextPtr) {\n  enum XML_Error result = initializeEncoding(parser);\n  if (result != XML_ERROR_NONE)\n    return result;\n  parser->m_processor = prologProcessor;\n  return prologProcessor(parser, s, end, nextPtr);\n}\n\n#ifdef XML_DTD\n\nstatic enum XML_Error PTRCALL\nexternalParEntInitProcessor(XML_Parser parser, const char *s, const char *end,\n                            const char **nextPtr) {\n  enum XML_Error result = initializeEncoding(parser);\n  if (result != XML_ERROR_NONE)\n    return result;\n\n  /* we know now that XML_Parse(Buffer) has been called,\n     so we consider the external parameter entity read */\n  parser->m_dtd->paramEntityRead = XML_TRUE;\n\n  if (parser->m_prologState.inEntityValue) {\n    parser->m_processor = entityValueInitProcessor;\n    return entityValueInitProcessor(parser, s, end, nextPtr);\n  } else {\n    parser->m_processor = externalParEntProcessor;\n    return externalParEntProcessor(parser, s, end, nextPtr);\n  }\n}\n\nstatic enum XML_Error PTRCALL\nentityValueInitProcessor(XML_Parser parser, const char *s, const char *end,\n                         const char **nextPtr) {\n  int tok;\n  const char *start = s;\n  const char *next = start;\n  parser->m_eventPtr = start;\n\n  for (;;) {\n    tok = XmlPrologTok(parser->m_encoding, start, end, &next);\n    parser->m_eventEndPtr = next;\n    if (tok <= 0) {\n      if (! parser->m_parsingStatus.finalBuffer && tok != XML_TOK_INVALID) {\n        *nextPtr = s;\n        return XML_ERROR_NONE;\n      }\n      switch (tok) {\n      case XML_TOK_INVALID:\n        return XML_ERROR_INVALID_TOKEN;\n      case XML_TOK_PARTIAL:\n        return XML_ERROR_UNCLOSED_TOKEN;\n      case XML_TOK_PARTIAL_CHAR:\n        return XML_ERROR_PARTIAL_CHAR;\n      case XML_TOK_NONE: /* start == end */\n      default:\n        break;\n      }\n      /* found end of entity value - can store it now */\n      return storeEntityValue(parser, parser->m_encoding, s, end);\n    } else if (tok == XML_TOK_XML_DECL) {\n      enum XML_Error result;\n      result = processXmlDecl(parser, 0, start, next);\n      if (result != XML_ERROR_NONE)\n        return result;\n      /* At this point, m_parsingStatus.parsing cannot be XML_SUSPENDED.  For\n       * that to happen, a parameter entity parsing handler must have attempted\n       * to suspend the parser, which fails and raises an error.  The parser can\n       * be aborted, but can't be suspended.\n       */\n      if (parser->m_parsingStatus.parsing == XML_FINISHED)\n        return XML_ERROR_ABORTED;\n      *nextPtr = next;\n      /* stop scanning for text declaration - we found one */\n      parser->m_processor = entityValueProcessor;\n      return entityValueProcessor(parser, next, end, nextPtr);\n    }\n    /* If we are at the end of the buffer, this would cause XmlPrologTok to\n       return XML_TOK_NONE on the next call, which would then cause the\n       function to exit with *nextPtr set to s - that is what we want for other\n       tokens, but not for the BOM - we would rather like to skip it;\n       then, when this routine is entered the next time, XmlPrologTok will\n       return XML_TOK_INVALID, since the BOM is still in the buffer\n    */\n    else if (tok == XML_TOK_BOM && next == end\n             && ! parser->m_parsingStatus.finalBuffer) {\n      *nextPtr = next;\n      return XML_ERROR_NONE;\n    }\n    /* If we get this token, we have the start of what might be a\n       normal tag, but not a declaration (i.e. it doesn't begin with\n       \"<!\").  In a DTD context, that isn't legal.\n    */\n    else if (tok == XML_TOK_INSTANCE_START) {\n      *nextPtr = next;\n      return XML_ERROR_SYNTAX;\n    }\n    start = next;\n    parser->m_eventPtr = start;\n  }\n}\n\nstatic enum XML_Error PTRCALL\nexternalParEntProcessor(XML_Parser parser, const char *s, const char *end,\n                        const char **nextPtr) {\n  const char *next = s;\n  int tok;\n\n  tok = XmlPrologTok(parser->m_encoding, s, end, &next);\n  if (tok <= 0) {\n    if (! parser->m_parsingStatus.finalBuffer && tok != XML_TOK_INVALID) {\n      *nextPtr = s;\n      return XML_ERROR_NONE;\n    }\n    switch (tok) {\n    case XML_TOK_INVALID:\n      return XML_ERROR_INVALID_TOKEN;\n    case XML_TOK_PARTIAL:\n      return XML_ERROR_UNCLOSED_TOKEN;\n    case XML_TOK_PARTIAL_CHAR:\n      return XML_ERROR_PARTIAL_CHAR;\n    case XML_TOK_NONE: /* start == end */\n    default:\n      break;\n    }\n  }\n  /* This would cause the next stage, i.e. doProlog to be passed XML_TOK_BOM.\n     However, when parsing an external subset, doProlog will not accept a BOM\n     as valid, and report a syntax error, so we have to skip the BOM\n  */\n  else if (tok == XML_TOK_BOM) {\n    s = next;\n    tok = XmlPrologTok(parser->m_encoding, s, end, &next);\n  }\n\n  parser->m_processor = prologProcessor;\n  return doProlog(parser, parser->m_encoding, s, end, tok, next, nextPtr,\n                  (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_TRUE);\n}\n\nstatic enum XML_Error PTRCALL\nentityValueProcessor(XML_Parser parser, const char *s, const char *end,\n                     const char **nextPtr) {\n  const char *start = s;\n  const char *next = s;\n  const ENCODING *enc = parser->m_encoding;\n  int tok;\n\n  for (;;) {\n    tok = XmlPrologTok(enc, start, end, &next);\n    if (tok <= 0) {\n      if (! parser->m_parsingStatus.finalBuffer && tok != XML_TOK_INVALID) {\n        *nextPtr = s;\n        return XML_ERROR_NONE;\n      }\n      switch (tok) {\n      case XML_TOK_INVALID:\n        return XML_ERROR_INVALID_TOKEN;\n      case XML_TOK_PARTIAL:\n        return XML_ERROR_UNCLOSED_TOKEN;\n      case XML_TOK_PARTIAL_CHAR:\n        return XML_ERROR_PARTIAL_CHAR;\n      case XML_TOK_NONE: /* start == end */\n      default:\n        break;\n      }\n      /* found end of entity value - can store it now */\n      return storeEntityValue(parser, enc, s, end);\n    }\n    start = next;\n  }\n}\n\n#endif /* XML_DTD */\n\nstatic enum XML_Error PTRCALL\nprologProcessor(XML_Parser parser, const char *s, const char *end,\n                const char **nextPtr) {\n  const char *next = s;\n  int tok = XmlPrologTok(parser->m_encoding, s, end, &next);\n  return doProlog(parser, parser->m_encoding, s, end, tok, next, nextPtr,\n                  (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_TRUE);\n}\n\nstatic enum XML_Error\ndoProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end,\n         int tok, const char *next, const char **nextPtr, XML_Bool haveMore,\n         XML_Bool allowClosingDoctype) {\n#ifdef XML_DTD\n  static const XML_Char externalSubsetName[] = {ASCII_HASH, '\\0'};\n#endif /* XML_DTD */\n  static const XML_Char atypeCDATA[]\n      = {ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\\0'};\n  static const XML_Char atypeID[] = {ASCII_I, ASCII_D, '\\0'};\n  static const XML_Char atypeIDREF[]\n      = {ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\\0'};\n  static const XML_Char atypeIDREFS[]\n      = {ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\\0'};\n  static const XML_Char atypeENTITY[]\n      = {ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\\0'};\n  static const XML_Char atypeENTITIES[]\n      = {ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T,\n         ASCII_I, ASCII_E, ASCII_S, '\\0'};\n  static const XML_Char atypeNMTOKEN[]\n      = {ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\\0'};\n  static const XML_Char atypeNMTOKENS[]\n      = {ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K,\n         ASCII_E, ASCII_N, ASCII_S, '\\0'};\n  static const XML_Char notationPrefix[]\n      = {ASCII_N, ASCII_O, ASCII_T, ASCII_A,      ASCII_T,\n         ASCII_I, ASCII_O, ASCII_N, ASCII_LPAREN, '\\0'};\n  static const XML_Char enumValueSep[] = {ASCII_PIPE, '\\0'};\n  static const XML_Char enumValueStart[] = {ASCII_LPAREN, '\\0'};\n\n  /* save one level of indirection */\n  DTD *const dtd = parser->m_dtd;\n\n  const char **eventPP;\n  const char **eventEndPP;\n  enum XML_Content_Quant quant;\n\n  if (enc == parser->m_encoding) {\n    eventPP = &parser->m_eventPtr;\n    eventEndPP = &parser->m_eventEndPtr;\n  } else {\n    eventPP = &(parser->m_openInternalEntities->internalEventPtr);\n    eventEndPP = &(parser->m_openInternalEntities->internalEventEndPtr);\n  }\n\n  for (;;) {\n    int role;\n    XML_Bool handleDefault = XML_TRUE;\n    *eventPP = s;\n    *eventEndPP = next;\n    if (tok <= 0) {\n      if (haveMore && tok != XML_TOK_INVALID) {\n        *nextPtr = s;\n        return XML_ERROR_NONE;\n      }\n      switch (tok) {\n      case XML_TOK_INVALID:\n        *eventPP = next;\n        return XML_ERROR_INVALID_TOKEN;\n      case XML_TOK_PARTIAL:\n        return XML_ERROR_UNCLOSED_TOKEN;\n      case XML_TOK_PARTIAL_CHAR:\n        return XML_ERROR_PARTIAL_CHAR;\n      case -XML_TOK_PROLOG_S:\n        tok = -tok;\n        break;\n      case XML_TOK_NONE:\n#ifdef XML_DTD\n        /* for internal PE NOT referenced between declarations */\n        if (enc != parser->m_encoding\n            && ! parser->m_openInternalEntities->betweenDecl) {\n          *nextPtr = s;\n          return XML_ERROR_NONE;\n        }\n        /* WFC: PE Between Declarations - must check that PE contains\n           complete markup, not only for external PEs, but also for\n           internal PEs if the reference occurs between declarations.\n        */\n        if (parser->m_isParamEntity || enc != parser->m_encoding) {\n          if (XmlTokenRole(&parser->m_prologState, XML_TOK_NONE, end, end, enc)\n              == XML_ROLE_ERROR)\n            return XML_ERROR_INCOMPLETE_PE;\n          *nextPtr = s;\n          return XML_ERROR_NONE;\n        }\n#endif /* XML_DTD */\n        return XML_ERROR_NO_ELEMENTS;\n      default:\n        tok = -tok;\n        next = end;\n        break;\n      }\n    }\n    role = XmlTokenRole(&parser->m_prologState, tok, s, next, enc);\n    switch (role) {\n    case XML_ROLE_XML_DECL: {\n      enum XML_Error result = processXmlDecl(parser, 0, s, next);\n      if (result != XML_ERROR_NONE)\n        return result;\n      enc = parser->m_encoding;\n      handleDefault = XML_FALSE;\n    } break;\n    case XML_ROLE_DOCTYPE_NAME:\n      if (parser->m_startDoctypeDeclHandler) {\n        parser->m_doctypeName\n            = poolStoreString(&parser->m_tempPool, enc, s, next);\n        if (! parser->m_doctypeName)\n          return XML_ERROR_NO_MEMORY;\n        poolFinish(&parser->m_tempPool);\n        parser->m_doctypePubid = NULL;\n        handleDefault = XML_FALSE;\n      }\n      parser->m_doctypeSysid = NULL; /* always initialize to NULL */\n      break;\n    case XML_ROLE_DOCTYPE_INTERNAL_SUBSET:\n      if (parser->m_startDoctypeDeclHandler) {\n        parser->m_startDoctypeDeclHandler(\n            parser->m_handlerArg, parser->m_doctypeName, parser->m_doctypeSysid,\n            parser->m_doctypePubid, 1);\n        parser->m_doctypeName = NULL;\n        poolClear(&parser->m_tempPool);\n        handleDefault = XML_FALSE;\n      }\n      break;\n#ifdef XML_DTD\n    case XML_ROLE_TEXT_DECL: {\n      enum XML_Error result = processXmlDecl(parser, 1, s, next);\n      if (result != XML_ERROR_NONE)\n        return result;\n      enc = parser->m_encoding;\n      handleDefault = XML_FALSE;\n    } break;\n#endif /* XML_DTD */\n    case XML_ROLE_DOCTYPE_PUBLIC_ID:\n#ifdef XML_DTD\n      parser->m_useForeignDTD = XML_FALSE;\n      parser->m_declEntity = (ENTITY *)lookup(\n          parser, &dtd->paramEntities, externalSubsetName, sizeof(ENTITY));\n      if (! parser->m_declEntity)\n        return XML_ERROR_NO_MEMORY;\n#endif /* XML_DTD */\n      dtd->hasParamEntityRefs = XML_TRUE;\n      if (parser->m_startDoctypeDeclHandler) {\n        XML_Char *pubId;\n        if (! XmlIsPublicId(enc, s, next, eventPP))\n          return XML_ERROR_PUBLICID;\n        pubId = poolStoreString(&parser->m_tempPool, enc,\n                                s + enc->minBytesPerChar,\n                                next - enc->minBytesPerChar);\n        if (! pubId)\n          return XML_ERROR_NO_MEMORY;\n        normalizePublicId(pubId);\n        poolFinish(&parser->m_tempPool);\n        parser->m_doctypePubid = pubId;\n        handleDefault = XML_FALSE;\n        goto alreadyChecked;\n      }\n      /* fall through */\n    case XML_ROLE_ENTITY_PUBLIC_ID:\n      if (! XmlIsPublicId(enc, s, next, eventPP))\n        return XML_ERROR_PUBLICID;\n    alreadyChecked:\n      if (dtd->keepProcessing && parser->m_declEntity) {\n        XML_Char *tem\n            = poolStoreString(&dtd->pool, enc, s + enc->minBytesPerChar,\n                              next - enc->minBytesPerChar);\n        if (! tem)\n          return XML_ERROR_NO_MEMORY;\n        normalizePublicId(tem);\n        parser->m_declEntity->publicId = tem;\n        poolFinish(&dtd->pool);\n        /* Don't suppress the default handler if we fell through from\n         * the XML_ROLE_DOCTYPE_PUBLIC_ID case.\n         */\n        if (parser->m_entityDeclHandler && role == XML_ROLE_ENTITY_PUBLIC_ID)\n          handleDefault = XML_FALSE;\n      }\n      break;\n    case XML_ROLE_DOCTYPE_CLOSE:\n      if (allowClosingDoctype != XML_TRUE) {\n        /* Must not close doctype from within expanded parameter entities */\n        return XML_ERROR_INVALID_TOKEN;\n      }\n\n      if (parser->m_doctypeName) {\n        parser->m_startDoctypeDeclHandler(\n            parser->m_handlerArg, parser->m_doctypeName, parser->m_doctypeSysid,\n            parser->m_doctypePubid, 0);\n        poolClear(&parser->m_tempPool);\n        handleDefault = XML_FALSE;\n      }\n      /* parser->m_doctypeSysid will be non-NULL in the case of a previous\n         XML_ROLE_DOCTYPE_SYSTEM_ID, even if parser->m_startDoctypeDeclHandler\n         was not set, indicating an external subset\n      */\n#ifdef XML_DTD\n      if (parser->m_doctypeSysid || parser->m_useForeignDTD) {\n        XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs;\n        dtd->hasParamEntityRefs = XML_TRUE;\n        if (parser->m_paramEntityParsing\n            && parser->m_externalEntityRefHandler) {\n          ENTITY *entity = (ENTITY *)lookup(parser, &dtd->paramEntities,\n                                            externalSubsetName, sizeof(ENTITY));\n          if (! entity) {\n            /* The external subset name \"#\" will have already been\n             * inserted into the hash table at the start of the\n             * external entity parsing, so no allocation will happen\n             * and lookup() cannot fail.\n             */\n            return XML_ERROR_NO_MEMORY; /* LCOV_EXCL_LINE */\n          }\n          if (parser->m_useForeignDTD)\n            entity->base = parser->m_curBase;\n          dtd->paramEntityRead = XML_FALSE;\n          if (! parser->m_externalEntityRefHandler(\n                  parser->m_externalEntityRefHandlerArg, 0, entity->base,\n                  entity->systemId, entity->publicId))\n            return XML_ERROR_EXTERNAL_ENTITY_HANDLING;\n          if (dtd->paramEntityRead) {\n            if (! dtd->standalone && parser->m_notStandaloneHandler\n                && ! parser->m_notStandaloneHandler(parser->m_handlerArg))\n              return XML_ERROR_NOT_STANDALONE;\n          }\n          /* if we didn't read the foreign DTD then this means that there\n             is no external subset and we must reset dtd->hasParamEntityRefs\n          */\n          else if (! parser->m_doctypeSysid)\n            dtd->hasParamEntityRefs = hadParamEntityRefs;\n          /* end of DTD - no need to update dtd->keepProcessing */\n        }\n        parser->m_useForeignDTD = XML_FALSE;\n      }\n#endif /* XML_DTD */\n      if (parser->m_endDoctypeDeclHandler) {\n        parser->m_endDoctypeDeclHandler(parser->m_handlerArg);\n        handleDefault = XML_FALSE;\n      }\n      break;\n    case XML_ROLE_INSTANCE_START:\n#ifdef XML_DTD\n      /* if there is no DOCTYPE declaration then now is the\n         last chance to read the foreign DTD\n      */\n      if (parser->m_useForeignDTD) {\n        XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs;\n        dtd->hasParamEntityRefs = XML_TRUE;\n        if (parser->m_paramEntityParsing\n            && parser->m_externalEntityRefHandler) {\n          ENTITY *entity = (ENTITY *)lookup(parser, &dtd->paramEntities,\n                                            externalSubsetName, sizeof(ENTITY));\n          if (! entity)\n            return XML_ERROR_NO_MEMORY;\n          entity->base = parser->m_curBase;\n          dtd->paramEntityRead = XML_FALSE;\n          if (! parser->m_externalEntityRefHandler(\n                  parser->m_externalEntityRefHandlerArg, 0, entity->base,\n                  entity->systemId, entity->publicId))\n            return XML_ERROR_EXTERNAL_ENTITY_HANDLING;\n          if (dtd->paramEntityRead) {\n            if (! dtd->standalone && parser->m_notStandaloneHandler\n                && ! parser->m_notStandaloneHandler(parser->m_handlerArg))\n              return XML_ERROR_NOT_STANDALONE;\n          }\n          /* if we didn't read the foreign DTD then this means that there\n             is no external subset and we must reset dtd->hasParamEntityRefs\n          */\n          else\n            dtd->hasParamEntityRefs = hadParamEntityRefs;\n          /* end of DTD - no need to update dtd->keepProcessing */\n        }\n      }\n#endif /* XML_DTD */\n      parser->m_processor = contentProcessor;\n      return contentProcessor(parser, s, end, nextPtr);\n    case XML_ROLE_ATTLIST_ELEMENT_NAME:\n      parser->m_declElementType = getElementType(parser, enc, s, next);\n      if (! parser->m_declElementType)\n        return XML_ERROR_NO_MEMORY;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_NAME:\n      parser->m_declAttributeId = getAttributeId(parser, enc, s, next);\n      if (! parser->m_declAttributeId)\n        return XML_ERROR_NO_MEMORY;\n      parser->m_declAttributeIsCdata = XML_FALSE;\n      parser->m_declAttributeType = NULL;\n      parser->m_declAttributeIsId = XML_FALSE;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_TYPE_CDATA:\n      parser->m_declAttributeIsCdata = XML_TRUE;\n      parser->m_declAttributeType = atypeCDATA;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_TYPE_ID:\n      parser->m_declAttributeIsId = XML_TRUE;\n      parser->m_declAttributeType = atypeID;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_TYPE_IDREF:\n      parser->m_declAttributeType = atypeIDREF;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_TYPE_IDREFS:\n      parser->m_declAttributeType = atypeIDREFS;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_TYPE_ENTITY:\n      parser->m_declAttributeType = atypeENTITY;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_TYPE_ENTITIES:\n      parser->m_declAttributeType = atypeENTITIES;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN:\n      parser->m_declAttributeType = atypeNMTOKEN;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS:\n      parser->m_declAttributeType = atypeNMTOKENS;\n    checkAttListDeclHandler:\n      if (dtd->keepProcessing && parser->m_attlistDeclHandler)\n        handleDefault = XML_FALSE;\n      break;\n    case XML_ROLE_ATTRIBUTE_ENUM_VALUE:\n    case XML_ROLE_ATTRIBUTE_NOTATION_VALUE:\n      if (dtd->keepProcessing && parser->m_attlistDeclHandler) {\n        const XML_Char *prefix;\n        if (parser->m_declAttributeType) {\n          prefix = enumValueSep;\n        } else {\n          prefix = (role == XML_ROLE_ATTRIBUTE_NOTATION_VALUE ? notationPrefix\n                                                              : enumValueStart);\n        }\n        if (! poolAppendString(&parser->m_tempPool, prefix))\n          return XML_ERROR_NO_MEMORY;\n        if (! poolAppend(&parser->m_tempPool, enc, s, next))\n          return XML_ERROR_NO_MEMORY;\n        parser->m_declAttributeType = parser->m_tempPool.start;\n        handleDefault = XML_FALSE;\n      }\n      break;\n    case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE:\n    case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE:\n      if (dtd->keepProcessing) {\n        if (! defineAttribute(parser->m_declElementType,\n                              parser->m_declAttributeId,\n                              parser->m_declAttributeIsCdata,\n                              parser->m_declAttributeIsId, 0, parser))\n          return XML_ERROR_NO_MEMORY;\n        if (parser->m_attlistDeclHandler && parser->m_declAttributeType) {\n          if (*parser->m_declAttributeType == XML_T(ASCII_LPAREN)\n              || (*parser->m_declAttributeType == XML_T(ASCII_N)\n                  && parser->m_declAttributeType[1] == XML_T(ASCII_O))) {\n            /* Enumerated or Notation type */\n            if (! poolAppendChar(&parser->m_tempPool, XML_T(ASCII_RPAREN))\n                || ! poolAppendChar(&parser->m_tempPool, XML_T('\\0')))\n              return XML_ERROR_NO_MEMORY;\n            parser->m_declAttributeType = parser->m_tempPool.start;\n            poolFinish(&parser->m_tempPool);\n          }\n          *eventEndPP = s;\n          parser->m_attlistDeclHandler(\n              parser->m_handlerArg, parser->m_declElementType->name,\n              parser->m_declAttributeId->name, parser->m_declAttributeType, 0,\n              role == XML_ROLE_REQUIRED_ATTRIBUTE_VALUE);\n          poolClear(&parser->m_tempPool);\n          handleDefault = XML_FALSE;\n        }\n      }\n      break;\n    case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE:\n    case XML_ROLE_FIXED_ATTRIBUTE_VALUE:\n      if (dtd->keepProcessing) {\n        const XML_Char *attVal;\n        enum XML_Error result = storeAttributeValue(\n            parser, enc, parser->m_declAttributeIsCdata,\n            s + enc->minBytesPerChar, next - enc->minBytesPerChar, &dtd->pool);\n        if (result)\n          return result;\n        attVal = poolStart(&dtd->pool);\n        poolFinish(&dtd->pool);\n        /* ID attributes aren't allowed to have a default */\n        if (! defineAttribute(\n                parser->m_declElementType, parser->m_declAttributeId,\n                parser->m_declAttributeIsCdata, XML_FALSE, attVal, parser))\n          return XML_ERROR_NO_MEMORY;\n        if (parser->m_attlistDeclHandler && parser->m_declAttributeType) {\n          if (*parser->m_declAttributeType == XML_T(ASCII_LPAREN)\n              || (*parser->m_declAttributeType == XML_T(ASCII_N)\n                  && parser->m_declAttributeType[1] == XML_T(ASCII_O))) {\n            /* Enumerated or Notation type */\n            if (! poolAppendChar(&parser->m_tempPool, XML_T(ASCII_RPAREN))\n                || ! poolAppendChar(&parser->m_tempPool, XML_T('\\0')))\n              return XML_ERROR_NO_MEMORY;\n            parser->m_declAttributeType = parser->m_tempPool.start;\n            poolFinish(&parser->m_tempPool);\n          }\n          *eventEndPP = s;\n          parser->m_attlistDeclHandler(\n              parser->m_handlerArg, parser->m_declElementType->name,\n              parser->m_declAttributeId->name, parser->m_declAttributeType,\n              attVal, role == XML_ROLE_FIXED_ATTRIBUTE_VALUE);\n          poolClear(&parser->m_tempPool);\n          handleDefault = XML_FALSE;\n        }\n      }\n      break;\n    case XML_ROLE_ENTITY_VALUE:\n      if (dtd->keepProcessing) {\n        enum XML_Error result = storeEntityValue(\n            parser, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar);\n        if (parser->m_declEntity) {\n          parser->m_declEntity->textPtr = poolStart(&dtd->entityValuePool);\n          parser->m_declEntity->textLen\n              = (int)(poolLength(&dtd->entityValuePool));\n          poolFinish(&dtd->entityValuePool);\n          if (parser->m_entityDeclHandler) {\n            *eventEndPP = s;\n            parser->m_entityDeclHandler(\n                parser->m_handlerArg, parser->m_declEntity->name,\n                parser->m_declEntity->is_param, parser->m_declEntity->textPtr,\n                parser->m_declEntity->textLen, parser->m_curBase, 0, 0, 0);\n            handleDefault = XML_FALSE;\n          }\n        } else\n          poolDiscard(&dtd->entityValuePool);\n        if (result != XML_ERROR_NONE)\n          return result;\n      }\n      break;\n    case XML_ROLE_DOCTYPE_SYSTEM_ID:\n#ifdef XML_DTD\n      parser->m_useForeignDTD = XML_FALSE;\n#endif /* XML_DTD */\n      dtd->hasParamEntityRefs = XML_TRUE;\n      if (parser->m_startDoctypeDeclHandler) {\n        parser->m_doctypeSysid = poolStoreString(&parser->m_tempPool, enc,\n                                                 s + enc->minBytesPerChar,\n                                                 next - enc->minBytesPerChar);\n        if (parser->m_doctypeSysid == NULL)\n          return XML_ERROR_NO_MEMORY;\n        poolFinish(&parser->m_tempPool);\n        handleDefault = XML_FALSE;\n      }\n#ifdef XML_DTD\n      else\n        /* use externalSubsetName to make parser->m_doctypeSysid non-NULL\n           for the case where no parser->m_startDoctypeDeclHandler is set */\n        parser->m_doctypeSysid = externalSubsetName;\n#endif /* XML_DTD */\n      if (! dtd->standalone\n#ifdef XML_DTD\n          && ! parser->m_paramEntityParsing\n#endif /* XML_DTD */\n          && parser->m_notStandaloneHandler\n          && ! parser->m_notStandaloneHandler(parser->m_handlerArg))\n        return XML_ERROR_NOT_STANDALONE;\n#ifndef XML_DTD\n      break;\n#else  /* XML_DTD */\n      if (! parser->m_declEntity) {\n        parser->m_declEntity = (ENTITY *)lookup(\n            parser, &dtd->paramEntities, externalSubsetName, sizeof(ENTITY));\n        if (! parser->m_declEntity)\n          return XML_ERROR_NO_MEMORY;\n        parser->m_declEntity->publicId = NULL;\n      }\n#endif /* XML_DTD */\n      /* fall through */\n    case XML_ROLE_ENTITY_SYSTEM_ID:\n      if (dtd->keepProcessing && parser->m_declEntity) {\n        parser->m_declEntity->systemId\n            = poolStoreString(&dtd->pool, enc, s + enc->minBytesPerChar,\n                              next - enc->minBytesPerChar);\n        if (! parser->m_declEntity->systemId)\n          return XML_ERROR_NO_MEMORY;\n        parser->m_declEntity->base = parser->m_curBase;\n        poolFinish(&dtd->pool);\n        /* Don't suppress the default handler if we fell through from\n         * the XML_ROLE_DOCTYPE_SYSTEM_ID case.\n         */\n        if (parser->m_entityDeclHandler && role == XML_ROLE_ENTITY_SYSTEM_ID)\n          handleDefault = XML_FALSE;\n      }\n      break;\n    case XML_ROLE_ENTITY_COMPLETE:\n      if (dtd->keepProcessing && parser->m_declEntity\n          && parser->m_entityDeclHandler) {\n        *eventEndPP = s;\n        parser->m_entityDeclHandler(\n            parser->m_handlerArg, parser->m_declEntity->name,\n            parser->m_declEntity->is_param, 0, 0, parser->m_declEntity->base,\n            parser->m_declEntity->systemId, parser->m_declEntity->publicId, 0);\n        handleDefault = XML_FALSE;\n      }\n      break;\n    case XML_ROLE_ENTITY_NOTATION_NAME:\n      if (dtd->keepProcessing && parser->m_declEntity) {\n        parser->m_declEntity->notation\n            = poolStoreString(&dtd->pool, enc, s, next);\n        if (! parser->m_declEntity->notation)\n          return XML_ERROR_NO_MEMORY;\n        poolFinish(&dtd->pool);\n        if (parser->m_unparsedEntityDeclHandler) {\n          *eventEndPP = s;\n          parser->m_unparsedEntityDeclHandler(\n              parser->m_handlerArg, parser->m_declEntity->name,\n              parser->m_declEntity->base, parser->m_declEntity->systemId,\n              parser->m_declEntity->publicId, parser->m_declEntity->notation);\n          handleDefault = XML_FALSE;\n        } else if (parser->m_entityDeclHandler) {\n          *eventEndPP = s;\n          parser->m_entityDeclHandler(\n              parser->m_handlerArg, parser->m_declEntity->name, 0, 0, 0,\n              parser->m_declEntity->base, parser->m_declEntity->systemId,\n              parser->m_declEntity->publicId, parser->m_declEntity->notation);\n          handleDefault = XML_FALSE;\n        }\n      }\n      break;\n    case XML_ROLE_GENERAL_ENTITY_NAME: {\n      if (XmlPredefinedEntityName(enc, s, next)) {\n        parser->m_declEntity = NULL;\n        break;\n      }\n      if (dtd->keepProcessing) {\n        const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next);\n        if (! name)\n          return XML_ERROR_NO_MEMORY;\n        parser->m_declEntity = (ENTITY *)lookup(parser, &dtd->generalEntities,\n                                                name, sizeof(ENTITY));\n        if (! parser->m_declEntity)\n          return XML_ERROR_NO_MEMORY;\n        if (parser->m_declEntity->name != name) {\n          poolDiscard(&dtd->pool);\n          parser->m_declEntity = NULL;\n        } else {\n          poolFinish(&dtd->pool);\n          parser->m_declEntity->publicId = NULL;\n          parser->m_declEntity->is_param = XML_FALSE;\n          /* if we have a parent parser or are reading an internal parameter\n             entity, then the entity declaration is not considered \"internal\"\n          */\n          parser->m_declEntity->is_internal\n              = ! (parser->m_parentParser || parser->m_openInternalEntities);\n          if (parser->m_entityDeclHandler)\n            handleDefault = XML_FALSE;\n        }\n      } else {\n        poolDiscard(&dtd->pool);\n        parser->m_declEntity = NULL;\n      }\n    } break;\n    case XML_ROLE_PARAM_ENTITY_NAME:\n#ifdef XML_DTD\n      if (dtd->keepProcessing) {\n        const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next);\n        if (! name)\n          return XML_ERROR_NO_MEMORY;\n        parser->m_declEntity = (ENTITY *)lookup(parser, &dtd->paramEntities,\n                                                name, sizeof(ENTITY));\n        if (! parser->m_declEntity)\n          return XML_ERROR_NO_MEMORY;\n        if (parser->m_declEntity->name != name) {\n          poolDiscard(&dtd->pool);\n          parser->m_declEntity = NULL;\n        } else {\n          poolFinish(&dtd->pool);\n          parser->m_declEntity->publicId = NULL;\n          parser->m_declEntity->is_param = XML_TRUE;\n          /* if we have a parent parser or are reading an internal parameter\n             entity, then the entity declaration is not considered \"internal\"\n          */\n          parser->m_declEntity->is_internal\n              = ! (parser->m_parentParser || parser->m_openInternalEntities);\n          if (parser->m_entityDeclHandler)\n            handleDefault = XML_FALSE;\n        }\n      } else {\n        poolDiscard(&dtd->pool);\n        parser->m_declEntity = NULL;\n      }\n#else  /* not XML_DTD */\n      parser->m_declEntity = NULL;\n#endif /* XML_DTD */\n      break;\n    case XML_ROLE_NOTATION_NAME:\n      parser->m_declNotationPublicId = NULL;\n      parser->m_declNotationName = NULL;\n      if (parser->m_notationDeclHandler) {\n        parser->m_declNotationName\n            = poolStoreString(&parser->m_tempPool, enc, s, next);\n        if (! parser->m_declNotationName)\n          return XML_ERROR_NO_MEMORY;\n        poolFinish(&parser->m_tempPool);\n        handleDefault = XML_FALSE;\n      }\n      break;\n    case XML_ROLE_NOTATION_PUBLIC_ID:\n      if (! XmlIsPublicId(enc, s, next, eventPP))\n        return XML_ERROR_PUBLICID;\n      if (parser\n              ->m_declNotationName) { /* means m_notationDeclHandler != NULL */\n        XML_Char *tem = poolStoreString(&parser->m_tempPool, enc,\n                                        s + enc->minBytesPerChar,\n                                        next - enc->minBytesPerChar);\n        if (! tem)\n          return XML_ERROR_NO_MEMORY;\n        normalizePublicId(tem);\n        parser->m_declNotationPublicId = tem;\n        poolFinish(&parser->m_tempPool);\n        handleDefault = XML_FALSE;\n      }\n      break;\n    case XML_ROLE_NOTATION_SYSTEM_ID:\n      if (parser->m_declNotationName && parser->m_notationDeclHandler) {\n        const XML_Char *systemId = poolStoreString(&parser->m_tempPool, enc,\n                                                   s + enc->minBytesPerChar,\n                                                   next - enc->minBytesPerChar);\n        if (! systemId)\n          return XML_ERROR_NO_MEMORY;\n        *eventEndPP = s;\n        parser->m_notationDeclHandler(\n            parser->m_handlerArg, parser->m_declNotationName, parser->m_curBase,\n            systemId, parser->m_declNotationPublicId);\n        handleDefault = XML_FALSE;\n      }\n      poolClear(&parser->m_tempPool);\n      break;\n    case XML_ROLE_NOTATION_NO_SYSTEM_ID:\n      if (parser->m_declNotationPublicId && parser->m_notationDeclHandler) {\n        *eventEndPP = s;\n        parser->m_notationDeclHandler(\n            parser->m_handlerArg, parser->m_declNotationName, parser->m_curBase,\n            0, parser->m_declNotationPublicId);\n        handleDefault = XML_FALSE;\n      }\n      poolClear(&parser->m_tempPool);\n      break;\n    case XML_ROLE_ERROR:\n      switch (tok) {\n      case XML_TOK_PARAM_ENTITY_REF:\n        /* PE references in internal subset are\n           not allowed within declarations. */\n        return XML_ERROR_PARAM_ENTITY_REF;\n      case XML_TOK_XML_DECL:\n        return XML_ERROR_MISPLACED_XML_PI;\n      default:\n        return XML_ERROR_SYNTAX;\n      }\n#ifdef XML_DTD\n    case XML_ROLE_IGNORE_SECT: {\n      enum XML_Error result;\n      if (parser->m_defaultHandler)\n        reportDefault(parser, enc, s, next);\n      handleDefault = XML_FALSE;\n      result = doIgnoreSection(parser, enc, &next, end, nextPtr, haveMore);\n      if (result != XML_ERROR_NONE)\n        return result;\n      else if (! next) {\n        parser->m_processor = ignoreSectionProcessor;\n        return result;\n      }\n    } break;\n#endif /* XML_DTD */\n    case XML_ROLE_GROUP_OPEN:\n      if (parser->m_prologState.level >= parser->m_groupSize) {\n        if (parser->m_groupSize) {\n          {\n            char *const new_connector = (char *)REALLOC(\n                parser, parser->m_groupConnector, parser->m_groupSize *= 2);\n            if (new_connector == NULL) {\n              parser->m_groupSize /= 2;\n              return XML_ERROR_NO_MEMORY;\n            }\n            parser->m_groupConnector = new_connector;\n          }\n\n          if (dtd->scaffIndex) {\n            int *const new_scaff_index = (int *)REALLOC(\n                parser, dtd->scaffIndex, parser->m_groupSize * sizeof(int));\n            if (new_scaff_index == NULL)\n              return XML_ERROR_NO_MEMORY;\n            dtd->scaffIndex = new_scaff_index;\n          }\n        } else {\n          parser->m_groupConnector\n              = (char *)MALLOC(parser, parser->m_groupSize = 32);\n          if (! parser->m_groupConnector) {\n            parser->m_groupSize = 0;\n            return XML_ERROR_NO_MEMORY;\n          }\n        }\n      }\n      parser->m_groupConnector[parser->m_prologState.level] = 0;\n      if (dtd->in_eldecl) {\n        int myindex = nextScaffoldPart(parser);\n        if (myindex < 0)\n          return XML_ERROR_NO_MEMORY;\n        assert(dtd->scaffIndex != NULL);\n        dtd->scaffIndex[dtd->scaffLevel] = myindex;\n        dtd->scaffLevel++;\n        dtd->scaffold[myindex].type = XML_CTYPE_SEQ;\n        if (parser->m_elementDeclHandler)\n          handleDefault = XML_FALSE;\n      }\n      break;\n    case XML_ROLE_GROUP_SEQUENCE:\n      if (parser->m_groupConnector[parser->m_prologState.level] == ASCII_PIPE)\n        return XML_ERROR_SYNTAX;\n      parser->m_groupConnector[parser->m_prologState.level] = ASCII_COMMA;\n      if (dtd->in_eldecl && parser->m_elementDeclHandler)\n        handleDefault = XML_FALSE;\n      break;\n    case XML_ROLE_GROUP_CHOICE:\n      if (parser->m_groupConnector[parser->m_prologState.level] == ASCII_COMMA)\n        return XML_ERROR_SYNTAX;\n      if (dtd->in_eldecl\n          && ! parser->m_groupConnector[parser->m_prologState.level]\n          && (dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type\n              != XML_CTYPE_MIXED)) {\n        dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type\n            = XML_CTYPE_CHOICE;\n        if (parser->m_elementDeclHandler)\n          handleDefault = XML_FALSE;\n      }\n      parser->m_groupConnector[parser->m_prologState.level] = ASCII_PIPE;\n      break;\n    case XML_ROLE_PARAM_ENTITY_REF:\n#ifdef XML_DTD\n    case XML_ROLE_INNER_PARAM_ENTITY_REF:\n      dtd->hasParamEntityRefs = XML_TRUE;\n      if (! parser->m_paramEntityParsing)\n        dtd->keepProcessing = dtd->standalone;\n      else {\n        const XML_Char *name;\n        ENTITY *entity;\n        name = poolStoreString(&dtd->pool, enc, s + enc->minBytesPerChar,\n                               next - enc->minBytesPerChar);\n        if (! name)\n          return XML_ERROR_NO_MEMORY;\n        entity = (ENTITY *)lookup(parser, &dtd->paramEntities, name, 0);\n        poolDiscard(&dtd->pool);\n        /* first, determine if a check for an existing declaration is needed;\n           if yes, check that the entity exists, and that it is internal,\n           otherwise call the skipped entity handler\n        */\n        if (parser->m_prologState.documentEntity\n            && (dtd->standalone ? ! parser->m_openInternalEntities\n                                : ! dtd->hasParamEntityRefs)) {\n          if (! entity)\n            return XML_ERROR_UNDEFINED_ENTITY;\n          else if (! entity->is_internal) {\n            /* It's hard to exhaustively search the code to be sure,\n             * but there doesn't seem to be a way of executing the\n             * following line.  There are two cases:\n             *\n             * If 'standalone' is false, the DTD must have no\n             * parameter entities or we wouldn't have passed the outer\n             * 'if' statement.  That measn the only entity in the hash\n             * table is the external subset name \"#\" which cannot be\n             * given as a parameter entity name in XML syntax, so the\n             * lookup must have returned NULL and we don't even reach\n             * the test for an internal entity.\n             *\n             * If 'standalone' is true, it does not seem to be\n             * possible to create entities taking this code path that\n             * are not internal entities, so fail the test above.\n             *\n             * Because this analysis is very uncertain, the code is\n             * being left in place and merely removed from the\n             * coverage test statistics.\n             */\n            return XML_ERROR_ENTITY_DECLARED_IN_PE; /* LCOV_EXCL_LINE */\n          }\n        } else if (! entity) {\n          dtd->keepProcessing = dtd->standalone;\n          /* cannot report skipped entities in declarations */\n          if ((role == XML_ROLE_PARAM_ENTITY_REF)\n              && parser->m_skippedEntityHandler) {\n            parser->m_skippedEntityHandler(parser->m_handlerArg, name, 1);\n            handleDefault = XML_FALSE;\n          }\n          break;\n        }\n        if (entity->open)\n          return XML_ERROR_RECURSIVE_ENTITY_REF;\n        if (entity->textPtr) {\n          enum XML_Error result;\n          XML_Bool betweenDecl\n              = (role == XML_ROLE_PARAM_ENTITY_REF ? XML_TRUE : XML_FALSE);\n          result = processInternalEntity(parser, entity, betweenDecl);\n          if (result != XML_ERROR_NONE)\n            return result;\n          handleDefault = XML_FALSE;\n          break;\n        }\n        if (parser->m_externalEntityRefHandler) {\n          dtd->paramEntityRead = XML_FALSE;\n          entity->open = XML_TRUE;\n          if (! parser->m_externalEntityRefHandler(\n                  parser->m_externalEntityRefHandlerArg, 0, entity->base,\n                  entity->systemId, entity->publicId)) {\n            entity->open = XML_FALSE;\n            return XML_ERROR_EXTERNAL_ENTITY_HANDLING;\n          }\n          entity->open = XML_FALSE;\n          handleDefault = XML_FALSE;\n          if (! dtd->paramEntityRead) {\n            dtd->keepProcessing = dtd->standalone;\n            break;\n          }\n        } else {\n          dtd->keepProcessing = dtd->standalone;\n          break;\n        }\n      }\n#endif /* XML_DTD */\n      if (! dtd->standalone && parser->m_notStandaloneHandler\n          && ! parser->m_notStandaloneHandler(parser->m_handlerArg))\n        return XML_ERROR_NOT_STANDALONE;\n      break;\n\n      /* Element declaration stuff */\n\n    case XML_ROLE_ELEMENT_NAME:\n      if (parser->m_elementDeclHandler) {\n        parser->m_declElementType = getElementType(parser, enc, s, next);\n        if (! parser->m_declElementType)\n          return XML_ERROR_NO_MEMORY;\n        dtd->scaffLevel = 0;\n        dtd->scaffCount = 0;\n        dtd->in_eldecl = XML_TRUE;\n        handleDefault = XML_FALSE;\n      }\n      break;\n\n    case XML_ROLE_CONTENT_ANY:\n    case XML_ROLE_CONTENT_EMPTY:\n      if (dtd->in_eldecl) {\n        if (parser->m_elementDeclHandler) {\n          XML_Content *content\n              = (XML_Content *)MALLOC(parser, sizeof(XML_Content));\n          if (! content)\n            return XML_ERROR_NO_MEMORY;\n          content->quant = XML_CQUANT_NONE;\n          content->name = NULL;\n          content->numchildren = 0;\n          content->children = NULL;\n          content->type = ((role == XML_ROLE_CONTENT_ANY) ? XML_CTYPE_ANY\n                                                          : XML_CTYPE_EMPTY);\n          *eventEndPP = s;\n          parser->m_elementDeclHandler(\n              parser->m_handlerArg, parser->m_declElementType->name, content);\n          handleDefault = XML_FALSE;\n        }\n        dtd->in_eldecl = XML_FALSE;\n      }\n      break;\n\n    case XML_ROLE_CONTENT_PCDATA:\n      if (dtd->in_eldecl) {\n        dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type\n            = XML_CTYPE_MIXED;\n        if (parser->m_elementDeclHandler)\n          handleDefault = XML_FALSE;\n      }\n      break;\n\n    case XML_ROLE_CONTENT_ELEMENT:\n      quant = XML_CQUANT_NONE;\n      goto elementContent;\n    case XML_ROLE_CONTENT_ELEMENT_OPT:\n      quant = XML_CQUANT_OPT;\n      goto elementContent;\n    case XML_ROLE_CONTENT_ELEMENT_REP:\n      quant = XML_CQUANT_REP;\n      goto elementContent;\n    case XML_ROLE_CONTENT_ELEMENT_PLUS:\n      quant = XML_CQUANT_PLUS;\n    elementContent:\n      if (dtd->in_eldecl) {\n        ELEMENT_TYPE *el;\n        const XML_Char *name;\n        int nameLen;\n        const char *nxt\n            = (quant == XML_CQUANT_NONE ? next : next - enc->minBytesPerChar);\n        int myindex = nextScaffoldPart(parser);\n        if (myindex < 0)\n          return XML_ERROR_NO_MEMORY;\n        dtd->scaffold[myindex].type = XML_CTYPE_NAME;\n        dtd->scaffold[myindex].quant = quant;\n        el = getElementType(parser, enc, s, nxt);\n        if (! el)\n          return XML_ERROR_NO_MEMORY;\n        name = el->name;\n        dtd->scaffold[myindex].name = name;\n        nameLen = 0;\n        for (; name[nameLen++];)\n          ;\n        dtd->contentStringLen += nameLen;\n        if (parser->m_elementDeclHandler)\n          handleDefault = XML_FALSE;\n      }\n      break;\n\n    case XML_ROLE_GROUP_CLOSE:\n      quant = XML_CQUANT_NONE;\n      goto closeGroup;\n    case XML_ROLE_GROUP_CLOSE_OPT:\n      quant = XML_CQUANT_OPT;\n      goto closeGroup;\n    case XML_ROLE_GROUP_CLOSE_REP:\n      quant = XML_CQUANT_REP;\n      goto closeGroup;\n    case XML_ROLE_GROUP_CLOSE_PLUS:\n      quant = XML_CQUANT_PLUS;\n    closeGroup:\n      if (dtd->in_eldecl) {\n        if (parser->m_elementDeclHandler)\n          handleDefault = XML_FALSE;\n        dtd->scaffLevel--;\n        dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel]].quant = quant;\n        if (dtd->scaffLevel == 0) {\n          if (! handleDefault) {\n            XML_Content *model = build_model(parser);\n            if (! model)\n              return XML_ERROR_NO_MEMORY;\n            *eventEndPP = s;\n            parser->m_elementDeclHandler(\n                parser->m_handlerArg, parser->m_declElementType->name, model);\n          }\n          dtd->in_eldecl = XML_FALSE;\n          dtd->contentStringLen = 0;\n        }\n      }\n      break;\n      /* End element declaration stuff */\n\n    case XML_ROLE_PI:\n      if (! reportProcessingInstruction(parser, enc, s, next))\n        return XML_ERROR_NO_MEMORY;\n      handleDefault = XML_FALSE;\n      break;\n    case XML_ROLE_COMMENT:\n      if (! reportComment(parser, enc, s, next))\n        return XML_ERROR_NO_MEMORY;\n      handleDefault = XML_FALSE;\n      break;\n    case XML_ROLE_NONE:\n      switch (tok) {\n      case XML_TOK_BOM:\n        handleDefault = XML_FALSE;\n        break;\n      }\n      break;\n    case XML_ROLE_DOCTYPE_NONE:\n      if (parser->m_startDoctypeDeclHandler)\n        handleDefault = XML_FALSE;\n      break;\n    case XML_ROLE_ENTITY_NONE:\n      if (dtd->keepProcessing && parser->m_entityDeclHandler)\n        handleDefault = XML_FALSE;\n      break;\n    case XML_ROLE_NOTATION_NONE:\n      if (parser->m_notationDeclHandler)\n        handleDefault = XML_FALSE;\n      break;\n    case XML_ROLE_ATTLIST_NONE:\n      if (dtd->keepProcessing && parser->m_attlistDeclHandler)\n        handleDefault = XML_FALSE;\n      break;\n    case XML_ROLE_ELEMENT_NONE:\n      if (parser->m_elementDeclHandler)\n        handleDefault = XML_FALSE;\n      break;\n    } /* end of big switch */\n\n    if (handleDefault && parser->m_defaultHandler)\n      reportDefault(parser, enc, s, next);\n\n    switch (parser->m_parsingStatus.parsing) {\n    case XML_SUSPENDED:\n      *nextPtr = next;\n      return XML_ERROR_NONE;\n    case XML_FINISHED:\n      return XML_ERROR_ABORTED;\n    default:\n      s = next;\n      tok = XmlPrologTok(enc, s, end, &next);\n    }\n  }\n  /* not reached */\n}\n\nstatic enum XML_Error PTRCALL\nepilogProcessor(XML_Parser parser, const char *s, const char *end,\n                const char **nextPtr) {\n  parser->m_processor = epilogProcessor;\n  parser->m_eventPtr = s;\n  for (;;) {\n    const char *next = NULL;\n    int tok = XmlPrologTok(parser->m_encoding, s, end, &next);\n    parser->m_eventEndPtr = next;\n    switch (tok) {\n    /* report partial linebreak - it might be the last token */\n    case -XML_TOK_PROLOG_S:\n      if (parser->m_defaultHandler) {\n        reportDefault(parser, parser->m_encoding, s, next);\n        if (parser->m_parsingStatus.parsing == XML_FINISHED)\n          return XML_ERROR_ABORTED;\n      }\n      *nextPtr = next;\n      return XML_ERROR_NONE;\n    case XML_TOK_NONE:\n      *nextPtr = s;\n      return XML_ERROR_NONE;\n    case XML_TOK_PROLOG_S:\n      if (parser->m_defaultHandler)\n        reportDefault(parser, parser->m_encoding, s, next);\n      break;\n    case XML_TOK_PI:\n      if (! reportProcessingInstruction(parser, parser->m_encoding, s, next))\n        return XML_ERROR_NO_MEMORY;\n      break;\n    case XML_TOK_COMMENT:\n      if (! reportComment(parser, parser->m_encoding, s, next))\n        return XML_ERROR_NO_MEMORY;\n      break;\n    case XML_TOK_INVALID:\n      parser->m_eventPtr = next;\n      return XML_ERROR_INVALID_TOKEN;\n    case XML_TOK_PARTIAL:\n      if (! parser->m_parsingStatus.finalBuffer) {\n        *nextPtr = s;\n        return XML_ERROR_NONE;\n      }\n      return XML_ERROR_UNCLOSED_TOKEN;\n    case XML_TOK_PARTIAL_CHAR:\n      if (! parser->m_parsingStatus.finalBuffer) {\n        *nextPtr = s;\n        return XML_ERROR_NONE;\n      }\n      return XML_ERROR_PARTIAL_CHAR;\n    default:\n      return XML_ERROR_JUNK_AFTER_DOC_ELEMENT;\n    }\n    parser->m_eventPtr = s = next;\n    switch (parser->m_parsingStatus.parsing) {\n    case XML_SUSPENDED:\n      *nextPtr = next;\n      return XML_ERROR_NONE;\n    case XML_FINISHED:\n      return XML_ERROR_ABORTED;\n    default:;\n    }\n  }\n}\n\nstatic enum XML_Error\nprocessInternalEntity(XML_Parser parser, ENTITY *entity, XML_Bool betweenDecl) {\n  const char *textStart, *textEnd;\n  const char *next;\n  enum XML_Error result;\n  OPEN_INTERNAL_ENTITY *openEntity;\n\n  if (parser->m_freeInternalEntities) {\n    openEntity = parser->m_freeInternalEntities;\n    parser->m_freeInternalEntities = openEntity->next;\n  } else {\n    openEntity\n        = (OPEN_INTERNAL_ENTITY *)MALLOC(parser, sizeof(OPEN_INTERNAL_ENTITY));\n    if (! openEntity)\n      return XML_ERROR_NO_MEMORY;\n  }\n  entity->open = XML_TRUE;\n  entity->processed = 0;\n  openEntity->next = parser->m_openInternalEntities;\n  parser->m_openInternalEntities = openEntity;\n  openEntity->entity = entity;\n  openEntity->startTagLevel = parser->m_tagLevel;\n  openEntity->betweenDecl = betweenDecl;\n  openEntity->internalEventPtr = NULL;\n  openEntity->internalEventEndPtr = NULL;\n  textStart = (char *)entity->textPtr;\n  textEnd = (char *)(entity->textPtr + entity->textLen);\n  /* Set a safe default value in case 'next' does not get set */\n  next = textStart;\n\n#ifdef XML_DTD\n  if (entity->is_param) {\n    int tok\n        = XmlPrologTok(parser->m_internalEncoding, textStart, textEnd, &next);\n    result = doProlog(parser, parser->m_internalEncoding, textStart, textEnd,\n                      tok, next, &next, XML_FALSE, XML_FALSE);\n  } else\n#endif /* XML_DTD */\n    result = doContent(parser, parser->m_tagLevel, parser->m_internalEncoding,\n                       textStart, textEnd, &next, XML_FALSE);\n\n  if (result == XML_ERROR_NONE) {\n    if (textEnd != next && parser->m_parsingStatus.parsing == XML_SUSPENDED) {\n      entity->processed = (int)(next - textStart);\n      parser->m_processor = internalEntityProcessor;\n    } else {\n      entity->open = XML_FALSE;\n      parser->m_openInternalEntities = openEntity->next;\n      /* put openEntity back in list of free instances */\n      openEntity->next = parser->m_freeInternalEntities;\n      parser->m_freeInternalEntities = openEntity;\n    }\n  }\n  return result;\n}\n\nstatic enum XML_Error PTRCALL\ninternalEntityProcessor(XML_Parser parser, const char *s, const char *end,\n                        const char **nextPtr) {\n  ENTITY *entity;\n  const char *textStart, *textEnd;\n  const char *next;\n  enum XML_Error result;\n  OPEN_INTERNAL_ENTITY *openEntity = parser->m_openInternalEntities;\n  if (! openEntity)\n    return XML_ERROR_UNEXPECTED_STATE;\n\n  entity = openEntity->entity;\n  textStart = ((char *)entity->textPtr) + entity->processed;\n  textEnd = (char *)(entity->textPtr + entity->textLen);\n  /* Set a safe default value in case 'next' does not get set */\n  next = textStart;\n\n#ifdef XML_DTD\n  if (entity->is_param) {\n    int tok\n        = XmlPrologTok(parser->m_internalEncoding, textStart, textEnd, &next);\n    result = doProlog(parser, parser->m_internalEncoding, textStart, textEnd,\n                      tok, next, &next, XML_FALSE, XML_TRUE);\n  } else\n#endif /* XML_DTD */\n    result = doContent(parser, openEntity->startTagLevel,\n                       parser->m_internalEncoding, textStart, textEnd, &next,\n                       XML_FALSE);\n\n  if (result != XML_ERROR_NONE)\n    return result;\n  else if (textEnd != next\n           && parser->m_parsingStatus.parsing == XML_SUSPENDED) {\n    entity->processed = (int)(next - (char *)entity->textPtr);\n    return result;\n  } else {\n    entity->open = XML_FALSE;\n    parser->m_openInternalEntities = openEntity->next;\n    /* put openEntity back in list of free instances */\n    openEntity->next = parser->m_freeInternalEntities;\n    parser->m_freeInternalEntities = openEntity;\n  }\n\n#ifdef XML_DTD\n  if (entity->is_param) {\n    int tok;\n    parser->m_processor = prologProcessor;\n    tok = XmlPrologTok(parser->m_encoding, s, end, &next);\n    return doProlog(parser, parser->m_encoding, s, end, tok, next, nextPtr,\n                    (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_TRUE);\n  } else\n#endif /* XML_DTD */\n  {\n    parser->m_processor = contentProcessor;\n    /* see externalEntityContentProcessor vs contentProcessor */\n    return doContent(parser, parser->m_parentParser ? 1 : 0, parser->m_encoding,\n                     s, end, nextPtr,\n                     (XML_Bool)! parser->m_parsingStatus.finalBuffer);\n  }\n}\n\nstatic enum XML_Error PTRCALL\nerrorProcessor(XML_Parser parser, const char *s, const char *end,\n               const char **nextPtr) {\n  UNUSED_P(s);\n  UNUSED_P(end);\n  UNUSED_P(nextPtr);\n  return parser->m_errorCode;\n}\n\nstatic enum XML_Error\nstoreAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata,\n                    const char *ptr, const char *end, STRING_POOL *pool) {\n  enum XML_Error result\n      = appendAttributeValue(parser, enc, isCdata, ptr, end, pool);\n  if (result)\n    return result;\n  if (! isCdata && poolLength(pool) && poolLastChar(pool) == 0x20)\n    poolChop(pool);\n  if (! poolAppendChar(pool, XML_T('\\0')))\n    return XML_ERROR_NO_MEMORY;\n  return XML_ERROR_NONE;\n}\n\nstatic enum XML_Error\nappendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata,\n                     const char *ptr, const char *end, STRING_POOL *pool) {\n  DTD *const dtd = parser->m_dtd; /* save one level of indirection */\n  for (;;) {\n    const char *next;\n    int tok = XmlAttributeValueTok(enc, ptr, end, &next);\n    switch (tok) {\n    case XML_TOK_NONE:\n      return XML_ERROR_NONE;\n    case XML_TOK_INVALID:\n      if (enc == parser->m_encoding)\n        parser->m_eventPtr = next;\n      return XML_ERROR_INVALID_TOKEN;\n    case XML_TOK_PARTIAL:\n      if (enc == parser->m_encoding)\n        parser->m_eventPtr = ptr;\n      return XML_ERROR_INVALID_TOKEN;\n    case XML_TOK_CHAR_REF: {\n      XML_Char buf[XML_ENCODE_MAX];\n      int i;\n      int n = XmlCharRefNumber(enc, ptr);\n      if (n < 0) {\n        if (enc == parser->m_encoding)\n          parser->m_eventPtr = ptr;\n        return XML_ERROR_BAD_CHAR_REF;\n      }\n      if (! isCdata && n == 0x20 /* space */\n          && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))\n        break;\n      n = XmlEncode(n, (ICHAR *)buf);\n      /* The XmlEncode() functions can never return 0 here.  That\n       * error return happens if the code point passed in is either\n       * negative or greater than or equal to 0x110000.  The\n       * XmlCharRefNumber() functions will all return a number\n       * strictly less than 0x110000 or a negative value if an error\n       * occurred.  The negative value is intercepted above, so\n       * XmlEncode() is never passed a value it might return an\n       * error for.\n       */\n      for (i = 0; i < n; i++) {\n        if (! poolAppendChar(pool, buf[i]))\n          return XML_ERROR_NO_MEMORY;\n      }\n    } break;\n    case XML_TOK_DATA_CHARS:\n      if (! poolAppend(pool, enc, ptr, next))\n        return XML_ERROR_NO_MEMORY;\n      break;\n    case XML_TOK_TRAILING_CR:\n      next = ptr + enc->minBytesPerChar;\n      /* fall through */\n    case XML_TOK_ATTRIBUTE_VALUE_S:\n    case XML_TOK_DATA_NEWLINE:\n      if (! isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))\n        break;\n      if (! poolAppendChar(pool, 0x20))\n        return XML_ERROR_NO_MEMORY;\n      break;\n    case XML_TOK_ENTITY_REF: {\n      const XML_Char *name;\n      ENTITY *entity;\n      char checkEntityDecl;\n      XML_Char ch = (XML_Char)XmlPredefinedEntityName(\n          enc, ptr + enc->minBytesPerChar, next - enc->minBytesPerChar);\n      if (ch) {\n        if (! poolAppendChar(pool, ch))\n          return XML_ERROR_NO_MEMORY;\n        break;\n      }\n      name = poolStoreString(&parser->m_temp2Pool, enc,\n                             ptr + enc->minBytesPerChar,\n                             next - enc->minBytesPerChar);\n      if (! name)\n        return XML_ERROR_NO_MEMORY;\n      entity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, 0);\n      poolDiscard(&parser->m_temp2Pool);\n      /* First, determine if a check for an existing declaration is needed;\n         if yes, check that the entity exists, and that it is internal.\n      */\n      if (pool == &dtd->pool) /* are we called from prolog? */\n        checkEntityDecl =\n#ifdef XML_DTD\n            parser->m_prologState.documentEntity &&\n#endif /* XML_DTD */\n            (dtd->standalone ? ! parser->m_openInternalEntities\n                             : ! dtd->hasParamEntityRefs);\n      else /* if (pool == &parser->m_tempPool): we are called from content */\n        checkEntityDecl = ! dtd->hasParamEntityRefs || dtd->standalone;\n      if (checkEntityDecl) {\n        if (! entity)\n          return XML_ERROR_UNDEFINED_ENTITY;\n        else if (! entity->is_internal)\n          return XML_ERROR_ENTITY_DECLARED_IN_PE;\n      } else if (! entity) {\n        /* Cannot report skipped entity here - see comments on\n           parser->m_skippedEntityHandler.\n        if (parser->m_skippedEntityHandler)\n          parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);\n        */\n        /* Cannot call the default handler because this would be\n           out of sync with the call to the startElementHandler.\n        if ((pool == &parser->m_tempPool) && parser->m_defaultHandler)\n          reportDefault(parser, enc, ptr, next);\n        */\n        break;\n      }\n      if (entity->open) {\n        if (enc == parser->m_encoding) {\n          /* It does not appear that this line can be executed.\n           *\n           * The \"if (entity->open)\" check catches recursive entity\n           * definitions.  In order to be called with an open\n           * entity, it must have gone through this code before and\n           * been through the recursive call to\n           * appendAttributeValue() some lines below.  That call\n           * sets the local encoding (\"enc\") to the parser's\n           * internal encoding (internal_utf8 or internal_utf16),\n           * which can never be the same as the principle encoding.\n           * It doesn't appear there is another code path that gets\n           * here with entity->open being TRUE.\n           *\n           * Since it is not certain that this logic is watertight,\n           * we keep the line and merely exclude it from coverage\n           * tests.\n           */\n          parser->m_eventPtr = ptr; /* LCOV_EXCL_LINE */\n        }\n        return XML_ERROR_RECURSIVE_ENTITY_REF;\n      }\n      if (entity->notation) {\n        if (enc == parser->m_encoding)\n          parser->m_eventPtr = ptr;\n        return XML_ERROR_BINARY_ENTITY_REF;\n      }\n      if (! entity->textPtr) {\n        if (enc == parser->m_encoding)\n          parser->m_eventPtr = ptr;\n        return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF;\n      } else {\n        enum XML_Error result;\n        const XML_Char *textEnd = entity->textPtr + entity->textLen;\n        entity->open = XML_TRUE;\n        result = appendAttributeValue(parser, parser->m_internalEncoding,\n                                      isCdata, (char *)entity->textPtr,\n                                      (char *)textEnd, pool);\n        entity->open = XML_FALSE;\n        if (result)\n          return result;\n      }\n    } break;\n    default:\n      /* The only token returned by XmlAttributeValueTok() that does\n       * not have an explicit case here is XML_TOK_PARTIAL_CHAR.\n       * Getting that would require an entity name to contain an\n       * incomplete XML character (e.g. \\xE2\\x82); however previous\n       * tokenisers will have already recognised and rejected such\n       * names before XmlAttributeValueTok() gets a look-in.  This\n       * default case should be retained as a safety net, but the code\n       * excluded from coverage tests.\n       *\n       * LCOV_EXCL_START\n       */\n      if (enc == parser->m_encoding)\n        parser->m_eventPtr = ptr;\n      return XML_ERROR_UNEXPECTED_STATE;\n      /* LCOV_EXCL_STOP */\n    }\n    ptr = next;\n  }\n  /* not reached */\n}\n\nstatic enum XML_Error\nstoreEntityValue(XML_Parser parser, const ENCODING *enc,\n                 const char *entityTextPtr, const char *entityTextEnd) {\n  DTD *const dtd = parser->m_dtd; /* save one level of indirection */\n  STRING_POOL *pool = &(dtd->entityValuePool);\n  enum XML_Error result = XML_ERROR_NONE;\n#ifdef XML_DTD\n  int oldInEntityValue = parser->m_prologState.inEntityValue;\n  parser->m_prologState.inEntityValue = 1;\n#endif /* XML_DTD */\n  /* never return Null for the value argument in EntityDeclHandler,\n     since this would indicate an external entity; therefore we\n     have to make sure that entityValuePool.start is not null */\n  if (! pool->blocks) {\n    if (! poolGrow(pool))\n      return XML_ERROR_NO_MEMORY;\n  }\n\n  for (;;) {\n    const char *next;\n    int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next);\n    switch (tok) {\n    case XML_TOK_PARAM_ENTITY_REF:\n#ifdef XML_DTD\n      if (parser->m_isParamEntity || enc != parser->m_encoding) {\n        const XML_Char *name;\n        ENTITY *entity;\n        name = poolStoreString(&parser->m_tempPool, enc,\n                               entityTextPtr + enc->minBytesPerChar,\n                               next - enc->minBytesPerChar);\n        if (! name) {\n          result = XML_ERROR_NO_MEMORY;\n          goto endEntityValue;\n        }\n        entity = (ENTITY *)lookup(parser, &dtd->paramEntities, name, 0);\n        poolDiscard(&parser->m_tempPool);\n        if (! entity) {\n          /* not a well-formedness error - see XML 1.0: WFC Entity Declared */\n          /* cannot report skipped entity here - see comments on\n             parser->m_skippedEntityHandler\n          if (parser->m_skippedEntityHandler)\n            parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);\n          */\n          dtd->keepProcessing = dtd->standalone;\n          goto endEntityValue;\n        }\n        if (entity->open) {\n          if (enc == parser->m_encoding)\n            parser->m_eventPtr = entityTextPtr;\n          result = XML_ERROR_RECURSIVE_ENTITY_REF;\n          goto endEntityValue;\n        }\n        if (entity->systemId) {\n          if (parser->m_externalEntityRefHandler) {\n            dtd->paramEntityRead = XML_FALSE;\n            entity->open = XML_TRUE;\n            if (! parser->m_externalEntityRefHandler(\n                    parser->m_externalEntityRefHandlerArg, 0, entity->base,\n                    entity->systemId, entity->publicId)) {\n              entity->open = XML_FALSE;\n              result = XML_ERROR_EXTERNAL_ENTITY_HANDLING;\n              goto endEntityValue;\n            }\n            entity->open = XML_FALSE;\n            if (! dtd->paramEntityRead)\n              dtd->keepProcessing = dtd->standalone;\n          } else\n            dtd->keepProcessing = dtd->standalone;\n        } else {\n          entity->open = XML_TRUE;\n          result = storeEntityValue(\n              parser, parser->m_internalEncoding, (char *)entity->textPtr,\n              (char *)(entity->textPtr + entity->textLen));\n          entity->open = XML_FALSE;\n          if (result)\n            goto endEntityValue;\n        }\n        break;\n      }\n#endif /* XML_DTD */\n      /* In the internal subset, PE references are not legal\n         within markup declarations, e.g entity values in this case. */\n      parser->m_eventPtr = entityTextPtr;\n      result = XML_ERROR_PARAM_ENTITY_REF;\n      goto endEntityValue;\n    case XML_TOK_NONE:\n      result = XML_ERROR_NONE;\n      goto endEntityValue;\n    case XML_TOK_ENTITY_REF:\n    case XML_TOK_DATA_CHARS:\n      if (! poolAppend(pool, enc, entityTextPtr, next)) {\n        result = XML_ERROR_NO_MEMORY;\n        goto endEntityValue;\n      }\n      break;\n    case XML_TOK_TRAILING_CR:\n      next = entityTextPtr + enc->minBytesPerChar;\n      /* fall through */\n    case XML_TOK_DATA_NEWLINE:\n      if (pool->end == pool->ptr && ! poolGrow(pool)) {\n        result = XML_ERROR_NO_MEMORY;\n        goto endEntityValue;\n      }\n      *(pool->ptr)++ = 0xA;\n      break;\n    case XML_TOK_CHAR_REF: {\n      XML_Char buf[XML_ENCODE_MAX];\n      int i;\n      int n = XmlCharRefNumber(enc, entityTextPtr);\n      if (n < 0) {\n        if (enc == parser->m_encoding)\n          parser->m_eventPtr = entityTextPtr;\n        result = XML_ERROR_BAD_CHAR_REF;\n        goto endEntityValue;\n      }\n      n = XmlEncode(n, (ICHAR *)buf);\n      /* The XmlEncode() functions can never return 0 here.  That\n       * error return happens if the code point passed in is either\n       * negative or greater than or equal to 0x110000.  The\n       * XmlCharRefNumber() functions will all return a number\n       * strictly less than 0x110000 or a negative value if an error\n       * occurred.  The negative value is intercepted above, so\n       * XmlEncode() is never passed a value it might return an\n       * error for.\n       */\n      for (i = 0; i < n; i++) {\n        if (pool->end == pool->ptr && ! poolGrow(pool)) {\n          result = XML_ERROR_NO_MEMORY;\n          goto endEntityValue;\n        }\n        *(pool->ptr)++ = buf[i];\n      }\n    } break;\n    case XML_TOK_PARTIAL:\n      if (enc == parser->m_encoding)\n        parser->m_eventPtr = entityTextPtr;\n      result = XML_ERROR_INVALID_TOKEN;\n      goto endEntityValue;\n    case XML_TOK_INVALID:\n      if (enc == parser->m_encoding)\n        parser->m_eventPtr = next;\n      result = XML_ERROR_INVALID_TOKEN;\n      goto endEntityValue;\n    default:\n      /* This default case should be unnecessary -- all the tokens\n       * that XmlEntityValueTok() can return have their own explicit\n       * cases -- but should be retained for safety.  We do however\n       * exclude it from the coverage statistics.\n       *\n       * LCOV_EXCL_START\n       */\n      if (enc == parser->m_encoding)\n        parser->m_eventPtr = entityTextPtr;\n      result = XML_ERROR_UNEXPECTED_STATE;\n      goto endEntityValue;\n      /* LCOV_EXCL_STOP */\n    }\n    entityTextPtr = next;\n  }\nendEntityValue:\n#ifdef XML_DTD\n  parser->m_prologState.inEntityValue = oldInEntityValue;\n#endif /* XML_DTD */\n  return result;\n}\n\nstatic void FASTCALL\nnormalizeLines(XML_Char *s) {\n  XML_Char *p;\n  for (;; s++) {\n    if (*s == XML_T('\\0'))\n      return;\n    if (*s == 0xD)\n      break;\n  }\n  p = s;\n  do {\n    if (*s == 0xD) {\n      *p++ = 0xA;\n      if (*++s == 0xA)\n        s++;\n    } else\n      *p++ = *s++;\n  } while (*s);\n  *p = XML_T('\\0');\n}\n\nstatic int\nreportProcessingInstruction(XML_Parser parser, const ENCODING *enc,\n                            const char *start, const char *end) {\n  const XML_Char *target;\n  XML_Char *data;\n  const char *tem;\n  if (! parser->m_processingInstructionHandler) {\n    if (parser->m_defaultHandler)\n      reportDefault(parser, enc, start, end);\n    return 1;\n  }\n  start += enc->minBytesPerChar * 2;\n  tem = start + XmlNameLength(enc, start);\n  target = poolStoreString(&parser->m_tempPool, enc, start, tem);\n  if (! target)\n    return 0;\n  poolFinish(&parser->m_tempPool);\n  data = poolStoreString(&parser->m_tempPool, enc, XmlSkipS(enc, tem),\n                         end - enc->minBytesPerChar * 2);\n  if (! data)\n    return 0;\n  normalizeLines(data);\n  parser->m_processingInstructionHandler(parser->m_handlerArg, target, data);\n  poolClear(&parser->m_tempPool);\n  return 1;\n}\n\nstatic int\nreportComment(XML_Parser parser, const ENCODING *enc, const char *start,\n              const char *end) {\n  XML_Char *data;\n  if (! parser->m_commentHandler) {\n    if (parser->m_defaultHandler)\n      reportDefault(parser, enc, start, end);\n    return 1;\n  }\n  data = poolStoreString(&parser->m_tempPool, enc,\n                         start + enc->minBytesPerChar * 4,\n                         end - enc->minBytesPerChar * 3);\n  if (! data)\n    return 0;\n  normalizeLines(data);\n  parser->m_commentHandler(parser->m_handlerArg, data);\n  poolClear(&parser->m_tempPool);\n  return 1;\n}\n\nstatic void\nreportDefault(XML_Parser parser, const ENCODING *enc, const char *s,\n              const char *end) {\n  if (MUST_CONVERT(enc, s)) {\n    enum XML_Convert_Result convert_res;\n    const char **eventPP;\n    const char **eventEndPP;\n    if (enc == parser->m_encoding) {\n      eventPP = &parser->m_eventPtr;\n      eventEndPP = &parser->m_eventEndPtr;\n    } else {\n      /* To get here, two things must be true; the parser must be\n       * using a character encoding that is not the same as the\n       * encoding passed in, and the encoding passed in must need\n       * conversion to the internal format (UTF-8 unless XML_UNICODE\n       * is defined).  The only occasions on which the encoding passed\n       * in is not the same as the parser's encoding are when it is\n       * the internal encoding (e.g. a previously defined parameter\n       * entity, already converted to internal format).  This by\n       * definition doesn't need conversion, so the whole branch never\n       * gets executed.\n       *\n       * For safety's sake we don't delete these lines and merely\n       * exclude them from coverage statistics.\n       *\n       * LCOV_EXCL_START\n       */\n      eventPP = &(parser->m_openInternalEntities->internalEventPtr);\n      eventEndPP = &(parser->m_openInternalEntities->internalEventEndPtr);\n      /* LCOV_EXCL_STOP */\n    }\n    do {\n      ICHAR *dataPtr = (ICHAR *)parser->m_dataBuf;\n      convert_res\n          = XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)parser->m_dataBufEnd);\n      *eventEndPP = s;\n      parser->m_defaultHandler(parser->m_handlerArg, parser->m_dataBuf,\n                               (int)(dataPtr - (ICHAR *)parser->m_dataBuf));\n      *eventPP = s;\n    } while ((convert_res != XML_CONVERT_COMPLETED)\n             && (convert_res != XML_CONVERT_INPUT_INCOMPLETE));\n  } else\n    parser->m_defaultHandler(parser->m_handlerArg, (XML_Char *)s,\n                             (int)((XML_Char *)end - (XML_Char *)s));\n}\n\nstatic int\ndefineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, XML_Bool isCdata,\n                XML_Bool isId, const XML_Char *value, XML_Parser parser) {\n  DEFAULT_ATTRIBUTE *att;\n  if (value || isId) {\n    /* The handling of default attributes gets messed up if we have\n       a default which duplicates a non-default. */\n    int i;\n    for (i = 0; i < type->nDefaultAtts; i++)\n      if (attId == type->defaultAtts[i].id)\n        return 1;\n    if (isId && ! type->idAtt && ! attId->xmlns)\n      type->idAtt = attId;\n  }\n  if (type->nDefaultAtts == type->allocDefaultAtts) {\n    if (type->allocDefaultAtts == 0) {\n      type->allocDefaultAtts = 8;\n      type->defaultAtts = (DEFAULT_ATTRIBUTE *)MALLOC(\n          parser, type->allocDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));\n      if (! type->defaultAtts) {\n        type->allocDefaultAtts = 0;\n        return 0;\n      }\n    } else {\n      DEFAULT_ATTRIBUTE *temp;\n      int count = type->allocDefaultAtts * 2;\n      temp = (DEFAULT_ATTRIBUTE *)REALLOC(parser, type->defaultAtts,\n                                          (count * sizeof(DEFAULT_ATTRIBUTE)));\n      if (temp == NULL)\n        return 0;\n      type->allocDefaultAtts = count;\n      type->defaultAtts = temp;\n    }\n  }\n  att = type->defaultAtts + type->nDefaultAtts;\n  att->id = attId;\n  att->value = value;\n  att->isCdata = isCdata;\n  if (! isCdata)\n    attId->maybeTokenized = XML_TRUE;\n  type->nDefaultAtts += 1;\n  return 1;\n}\n\nstatic int\nsetElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType) {\n  DTD *const dtd = parser->m_dtd; /* save one level of indirection */\n  const XML_Char *name;\n  for (name = elementType->name; *name; name++) {\n    if (*name == XML_T(ASCII_COLON)) {\n      PREFIX *prefix;\n      const XML_Char *s;\n      for (s = elementType->name; s != name; s++) {\n        if (! poolAppendChar(&dtd->pool, *s))\n          return 0;\n      }\n      if (! poolAppendChar(&dtd->pool, XML_T('\\0')))\n        return 0;\n      prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool),\n                                sizeof(PREFIX));\n      if (! prefix)\n        return 0;\n      if (prefix->name == poolStart(&dtd->pool))\n        poolFinish(&dtd->pool);\n      else\n        poolDiscard(&dtd->pool);\n      elementType->prefix = prefix;\n      break;\n    }\n  }\n  return 1;\n}\n\nstatic ATTRIBUTE_ID *\ngetAttributeId(XML_Parser parser, const ENCODING *enc, const char *start,\n               const char *end) {\n  DTD *const dtd = parser->m_dtd; /* save one level of indirection */\n  ATTRIBUTE_ID *id;\n  const XML_Char *name;\n  if (! poolAppendChar(&dtd->pool, XML_T('\\0')))\n    return NULL;\n  name = poolStoreString(&dtd->pool, enc, start, end);\n  if (! name)\n    return NULL;\n  /* skip quotation mark - its storage will be re-used (like in name[-1]) */\n  ++name;\n  id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, name,\n                              sizeof(ATTRIBUTE_ID));\n  if (! id)\n    return NULL;\n  if (id->name != name)\n    poolDiscard(&dtd->pool);\n  else {\n    poolFinish(&dtd->pool);\n    if (! parser->m_ns)\n      ;\n    else if (name[0] == XML_T(ASCII_x) && name[1] == XML_T(ASCII_m)\n             && name[2] == XML_T(ASCII_l) && name[3] == XML_T(ASCII_n)\n             && name[4] == XML_T(ASCII_s)\n             && (name[5] == XML_T('\\0') || name[5] == XML_T(ASCII_COLON))) {\n      if (name[5] == XML_T('\\0'))\n        id->prefix = &dtd->defaultPrefix;\n      else\n        id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, name + 6,\n                                      sizeof(PREFIX));\n      id->xmlns = XML_TRUE;\n    } else {\n      int i;\n      for (i = 0; name[i]; i++) {\n        /* attributes without prefix are *not* in the default namespace */\n        if (name[i] == XML_T(ASCII_COLON)) {\n          int j;\n          for (j = 0; j < i; j++) {\n            if (! poolAppendChar(&dtd->pool, name[j]))\n              return NULL;\n          }\n          if (! poolAppendChar(&dtd->pool, XML_T('\\0')))\n            return NULL;\n          id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes,\n                                        poolStart(&dtd->pool), sizeof(PREFIX));\n          if (! id->prefix)\n            return NULL;\n          if (id->prefix->name == poolStart(&dtd->pool))\n            poolFinish(&dtd->pool);\n          else\n            poolDiscard(&dtd->pool);\n          break;\n        }\n      }\n    }\n  }\n  return id;\n}\n\n#define CONTEXT_SEP XML_T(ASCII_FF)\n\nstatic const XML_Char *\ngetContext(XML_Parser parser) {\n  DTD *const dtd = parser->m_dtd; /* save one level of indirection */\n  HASH_TABLE_ITER iter;\n  XML_Bool needSep = XML_FALSE;\n\n  if (dtd->defaultPrefix.binding) {\n    int i;\n    int len;\n    if (! poolAppendChar(&parser->m_tempPool, XML_T(ASCII_EQUALS)))\n      return NULL;\n    len = dtd->defaultPrefix.binding->uriLen;\n    if (parser->m_namespaceSeparator)\n      len--;\n    for (i = 0; i < len; i++) {\n      if (! poolAppendChar(&parser->m_tempPool,\n                           dtd->defaultPrefix.binding->uri[i])) {\n        /* Because of memory caching, I don't believe this line can be\n         * executed.\n         *\n         * This is part of a loop copying the default prefix binding\n         * URI into the parser's temporary string pool.  Previously,\n         * that URI was copied into the same string pool, with a\n         * terminating NUL character, as part of setContext().  When\n         * the pool was cleared, that leaves a block definitely big\n         * enough to hold the URI on the free block list of the pool.\n         * The URI copy in getContext() therefore cannot run out of\n         * memory.\n         *\n         * If the pool is used between the setContext() and\n         * getContext() calls, the worst it can do is leave a bigger\n         * block on the front of the free list.  Given that this is\n         * all somewhat inobvious and program logic can be changed, we\n         * don't delete the line but we do exclude it from the test\n         * coverage statistics.\n         */\n        return NULL; /* LCOV_EXCL_LINE */\n      }\n    }\n    needSep = XML_TRUE;\n  }\n\n  hashTableIterInit(&iter, &(dtd->prefixes));\n  for (;;) {\n    int i;\n    int len;\n    const XML_Char *s;\n    PREFIX *prefix = (PREFIX *)hashTableIterNext(&iter);\n    if (! prefix)\n      break;\n    if (! prefix->binding) {\n      /* This test appears to be (justifiable) paranoia.  There does\n       * not seem to be a way of injecting a prefix without a binding\n       * that doesn't get errored long before this function is called.\n       * The test should remain for safety's sake, so we instead\n       * exclude the following line from the coverage statistics.\n       */\n      continue; /* LCOV_EXCL_LINE */\n    }\n    if (needSep && ! poolAppendChar(&parser->m_tempPool, CONTEXT_SEP))\n      return NULL;\n    for (s = prefix->name; *s; s++)\n      if (! poolAppendChar(&parser->m_tempPool, *s))\n        return NULL;\n    if (! poolAppendChar(&parser->m_tempPool, XML_T(ASCII_EQUALS)))\n      return NULL;\n    len = prefix->binding->uriLen;\n    if (parser->m_namespaceSeparator)\n      len--;\n    for (i = 0; i < len; i++)\n      if (! poolAppendChar(&parser->m_tempPool, prefix->binding->uri[i]))\n        return NULL;\n    needSep = XML_TRUE;\n  }\n\n  hashTableIterInit(&iter, &(dtd->generalEntities));\n  for (;;) {\n    const XML_Char *s;\n    ENTITY *e = (ENTITY *)hashTableIterNext(&iter);\n    if (! e)\n      break;\n    if (! e->open)\n      continue;\n    if (needSep && ! poolAppendChar(&parser->m_tempPool, CONTEXT_SEP))\n      return NULL;\n    for (s = e->name; *s; s++)\n      if (! poolAppendChar(&parser->m_tempPool, *s))\n        return 0;\n    needSep = XML_TRUE;\n  }\n\n  if (! poolAppendChar(&parser->m_tempPool, XML_T('\\0')))\n    return NULL;\n  return parser->m_tempPool.start;\n}\n\nstatic XML_Bool\nsetContext(XML_Parser parser, const XML_Char *context) {\n  DTD *const dtd = parser->m_dtd; /* save one level of indirection */\n  const XML_Char *s = context;\n\n  while (*context != XML_T('\\0')) {\n    if (*s == CONTEXT_SEP || *s == XML_T('\\0')) {\n      ENTITY *e;\n      if (! poolAppendChar(&parser->m_tempPool, XML_T('\\0')))\n        return XML_FALSE;\n      e = (ENTITY *)lookup(parser, &dtd->generalEntities,\n                           poolStart(&parser->m_tempPool), 0);\n      if (e)\n        e->open = XML_TRUE;\n      if (*s != XML_T('\\0'))\n        s++;\n      context = s;\n      poolDiscard(&parser->m_tempPool);\n    } else if (*s == XML_T(ASCII_EQUALS)) {\n      PREFIX *prefix;\n      if (poolLength(&parser->m_tempPool) == 0)\n        prefix = &dtd->defaultPrefix;\n      else {\n        if (! poolAppendChar(&parser->m_tempPool, XML_T('\\0')))\n          return XML_FALSE;\n        prefix\n            = (PREFIX *)lookup(parser, &dtd->prefixes,\n                               poolStart(&parser->m_tempPool), sizeof(PREFIX));\n        if (! prefix)\n          return XML_FALSE;\n        if (prefix->name == poolStart(&parser->m_tempPool)) {\n          prefix->name = poolCopyString(&dtd->pool, prefix->name);\n          if (! prefix->name)\n            return XML_FALSE;\n        }\n        poolDiscard(&parser->m_tempPool);\n      }\n      for (context = s + 1; *context != CONTEXT_SEP && *context != XML_T('\\0');\n           context++)\n        if (! poolAppendChar(&parser->m_tempPool, *context))\n          return XML_FALSE;\n      if (! poolAppendChar(&parser->m_tempPool, XML_T('\\0')))\n        return XML_FALSE;\n      if (addBinding(parser, prefix, NULL, poolStart(&parser->m_tempPool),\n                     &parser->m_inheritedBindings)\n          != XML_ERROR_NONE)\n        return XML_FALSE;\n      poolDiscard(&parser->m_tempPool);\n      if (*context != XML_T('\\0'))\n        ++context;\n      s = context;\n    } else {\n      if (! poolAppendChar(&parser->m_tempPool, *s))\n        return XML_FALSE;\n      s++;\n    }\n  }\n  return XML_TRUE;\n}\n\nstatic void FASTCALL\nnormalizePublicId(XML_Char *publicId) {\n  XML_Char *p = publicId;\n  XML_Char *s;\n  for (s = publicId; *s; s++) {\n    switch (*s) {\n    case 0x20:\n    case 0xD:\n    case 0xA:\n      if (p != publicId && p[-1] != 0x20)\n        *p++ = 0x20;\n      break;\n    default:\n      *p++ = *s;\n    }\n  }\n  if (p != publicId && p[-1] == 0x20)\n    --p;\n  *p = XML_T('\\0');\n}\n\nstatic DTD *\ndtdCreate(const XML_Memory_Handling_Suite *ms) {\n  DTD *p = (DTD *)ms->malloc_fcn(sizeof(DTD));\n  if (p == NULL)\n    return p;\n  poolInit(&(p->pool), ms);\n  poolInit(&(p->entityValuePool), ms);\n  hashTableInit(&(p->generalEntities), ms);\n  hashTableInit(&(p->elementTypes), ms);\n  hashTableInit(&(p->attributeIds), ms);\n  hashTableInit(&(p->prefixes), ms);\n#ifdef XML_DTD\n  p->paramEntityRead = XML_FALSE;\n  hashTableInit(&(p->paramEntities), ms);\n#endif /* XML_DTD */\n  p->defaultPrefix.name = NULL;\n  p->defaultPrefix.binding = NULL;\n\n  p->in_eldecl = XML_FALSE;\n  p->scaffIndex = NULL;\n  p->scaffold = NULL;\n  p->scaffLevel = 0;\n  p->scaffSize = 0;\n  p->scaffCount = 0;\n  p->contentStringLen = 0;\n\n  p->keepProcessing = XML_TRUE;\n  p->hasParamEntityRefs = XML_FALSE;\n  p->standalone = XML_FALSE;\n  return p;\n}\n\nstatic void\ndtdReset(DTD *p, const XML_Memory_Handling_Suite *ms) {\n  HASH_TABLE_ITER iter;\n  hashTableIterInit(&iter, &(p->elementTypes));\n  for (;;) {\n    ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter);\n    if (! e)\n      break;\n    if (e->allocDefaultAtts != 0)\n      ms->free_fcn(e->defaultAtts);\n  }\n  hashTableClear(&(p->generalEntities));\n#ifdef XML_DTD\n  p->paramEntityRead = XML_FALSE;\n  hashTableClear(&(p->paramEntities));\n#endif /* XML_DTD */\n  hashTableClear(&(p->elementTypes));\n  hashTableClear(&(p->attributeIds));\n  hashTableClear(&(p->prefixes));\n  poolClear(&(p->pool));\n  poolClear(&(p->entityValuePool));\n  p->defaultPrefix.name = NULL;\n  p->defaultPrefix.binding = NULL;\n\n  p->in_eldecl = XML_FALSE;\n\n  ms->free_fcn(p->scaffIndex);\n  p->scaffIndex = NULL;\n  ms->free_fcn(p->scaffold);\n  p->scaffold = NULL;\n\n  p->scaffLevel = 0;\n  p->scaffSize = 0;\n  p->scaffCount = 0;\n  p->contentStringLen = 0;\n\n  p->keepProcessing = XML_TRUE;\n  p->hasParamEntityRefs = XML_FALSE;\n  p->standalone = XML_FALSE;\n}\n\nstatic void\ndtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms) {\n  HASH_TABLE_ITER iter;\n  hashTableIterInit(&iter, &(p->elementTypes));\n  for (;;) {\n    ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter);\n    if (! e)\n      break;\n    if (e->allocDefaultAtts != 0)\n      ms->free_fcn(e->defaultAtts);\n  }\n  hashTableDestroy(&(p->generalEntities));\n#ifdef XML_DTD\n  hashTableDestroy(&(p->paramEntities));\n#endif /* XML_DTD */\n  hashTableDestroy(&(p->elementTypes));\n  hashTableDestroy(&(p->attributeIds));\n  hashTableDestroy(&(p->prefixes));\n  poolDestroy(&(p->pool));\n  poolDestroy(&(p->entityValuePool));\n  if (isDocEntity) {\n    ms->free_fcn(p->scaffIndex);\n    ms->free_fcn(p->scaffold);\n  }\n  ms->free_fcn(p);\n}\n\n/* Do a deep copy of the DTD. Return 0 for out of memory, non-zero otherwise.\n   The new DTD has already been initialized.\n*/\nstatic int\ndtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd,\n        const XML_Memory_Handling_Suite *ms) {\n  HASH_TABLE_ITER iter;\n\n  /* Copy the prefix table. */\n\n  hashTableIterInit(&iter, &(oldDtd->prefixes));\n  for (;;) {\n    const XML_Char *name;\n    const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter);\n    if (! oldP)\n      break;\n    name = poolCopyString(&(newDtd->pool), oldP->name);\n    if (! name)\n      return 0;\n    if (! lookup(oldParser, &(newDtd->prefixes), name, sizeof(PREFIX)))\n      return 0;\n  }\n\n  hashTableIterInit(&iter, &(oldDtd->attributeIds));\n\n  /* Copy the attribute id table. */\n\n  for (;;) {\n    ATTRIBUTE_ID *newA;\n    const XML_Char *name;\n    const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter);\n\n    if (! oldA)\n      break;\n    /* Remember to allocate the scratch byte before the name. */\n    if (! poolAppendChar(&(newDtd->pool), XML_T('\\0')))\n      return 0;\n    name = poolCopyString(&(newDtd->pool), oldA->name);\n    if (! name)\n      return 0;\n    ++name;\n    newA = (ATTRIBUTE_ID *)lookup(oldParser, &(newDtd->attributeIds), name,\n                                  sizeof(ATTRIBUTE_ID));\n    if (! newA)\n      return 0;\n    newA->maybeTokenized = oldA->maybeTokenized;\n    if (oldA->prefix) {\n      newA->xmlns = oldA->xmlns;\n      if (oldA->prefix == &oldDtd->defaultPrefix)\n        newA->prefix = &newDtd->defaultPrefix;\n      else\n        newA->prefix = (PREFIX *)lookup(oldParser, &(newDtd->prefixes),\n                                        oldA->prefix->name, 0);\n    }\n  }\n\n  /* Copy the element type table. */\n\n  hashTableIterInit(&iter, &(oldDtd->elementTypes));\n\n  for (;;) {\n    int i;\n    ELEMENT_TYPE *newE;\n    const XML_Char *name;\n    const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter);\n    if (! oldE)\n      break;\n    name = poolCopyString(&(newDtd->pool), oldE->name);\n    if (! name)\n      return 0;\n    newE = (ELEMENT_TYPE *)lookup(oldParser, &(newDtd->elementTypes), name,\n                                  sizeof(ELEMENT_TYPE));\n    if (! newE)\n      return 0;\n    if (oldE->nDefaultAtts) {\n      newE->defaultAtts = (DEFAULT_ATTRIBUTE *)ms->malloc_fcn(\n          oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));\n      if (! newE->defaultAtts) {\n        return 0;\n      }\n    }\n    if (oldE->idAtt)\n      newE->idAtt = (ATTRIBUTE_ID *)lookup(oldParser, &(newDtd->attributeIds),\n                                           oldE->idAtt->name, 0);\n    newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts;\n    if (oldE->prefix)\n      newE->prefix = (PREFIX *)lookup(oldParser, &(newDtd->prefixes),\n                                      oldE->prefix->name, 0);\n    for (i = 0; i < newE->nDefaultAtts; i++) {\n      newE->defaultAtts[i].id = (ATTRIBUTE_ID *)lookup(\n          oldParser, &(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0);\n      newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata;\n      if (oldE->defaultAtts[i].value) {\n        newE->defaultAtts[i].value\n            = poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value);\n        if (! newE->defaultAtts[i].value)\n          return 0;\n      } else\n        newE->defaultAtts[i].value = NULL;\n    }\n  }\n\n  /* Copy the entity tables. */\n  if (! copyEntityTable(oldParser, &(newDtd->generalEntities), &(newDtd->pool),\n                        &(oldDtd->generalEntities)))\n    return 0;\n\n#ifdef XML_DTD\n  if (! copyEntityTable(oldParser, &(newDtd->paramEntities), &(newDtd->pool),\n                        &(oldDtd->paramEntities)))\n    return 0;\n  newDtd->paramEntityRead = oldDtd->paramEntityRead;\n#endif /* XML_DTD */\n\n  newDtd->keepProcessing = oldDtd->keepProcessing;\n  newDtd->hasParamEntityRefs = oldDtd->hasParamEntityRefs;\n  newDtd->standalone = oldDtd->standalone;\n\n  /* Don't want deep copying for scaffolding */\n  newDtd->in_eldecl = oldDtd->in_eldecl;\n  newDtd->scaffold = oldDtd->scaffold;\n  newDtd->contentStringLen = oldDtd->contentStringLen;\n  newDtd->scaffSize = oldDtd->scaffSize;\n  newDtd->scaffLevel = oldDtd->scaffLevel;\n  newDtd->scaffIndex = oldDtd->scaffIndex;\n\n  return 1;\n} /* End dtdCopy */\n\nstatic int\ncopyEntityTable(XML_Parser oldParser, HASH_TABLE *newTable,\n                STRING_POOL *newPool, const HASH_TABLE *oldTable) {\n  HASH_TABLE_ITER iter;\n  const XML_Char *cachedOldBase = NULL;\n  const XML_Char *cachedNewBase = NULL;\n\n  hashTableIterInit(&iter, oldTable);\n\n  for (;;) {\n    ENTITY *newE;\n    const XML_Char *name;\n    const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter);\n    if (! oldE)\n      break;\n    name = poolCopyString(newPool, oldE->name);\n    if (! name)\n      return 0;\n    newE = (ENTITY *)lookup(oldParser, newTable, name, sizeof(ENTITY));\n    if (! newE)\n      return 0;\n    if (oldE->systemId) {\n      const XML_Char *tem = poolCopyString(newPool, oldE->systemId);\n      if (! tem)\n        return 0;\n      newE->systemId = tem;\n      if (oldE->base) {\n        if (oldE->base == cachedOldBase)\n          newE->base = cachedNewBase;\n        else {\n          cachedOldBase = oldE->base;\n          tem = poolCopyString(newPool, cachedOldBase);\n          if (! tem)\n            return 0;\n          cachedNewBase = newE->base = tem;\n        }\n      }\n      if (oldE->publicId) {\n        tem = poolCopyString(newPool, oldE->publicId);\n        if (! tem)\n          return 0;\n        newE->publicId = tem;\n      }\n    } else {\n      const XML_Char *tem\n          = poolCopyStringN(newPool, oldE->textPtr, oldE->textLen);\n      if (! tem)\n        return 0;\n      newE->textPtr = tem;\n      newE->textLen = oldE->textLen;\n    }\n    if (oldE->notation) {\n      const XML_Char *tem = poolCopyString(newPool, oldE->notation);\n      if (! tem)\n        return 0;\n      newE->notation = tem;\n    }\n    newE->is_param = oldE->is_param;\n    newE->is_internal = oldE->is_internal;\n  }\n  return 1;\n}\n\n#define INIT_POWER 6\n\nstatic XML_Bool FASTCALL\nkeyeq(KEY s1, KEY s2) {\n  for (; *s1 == *s2; s1++, s2++)\n    if (*s1 == 0)\n      return XML_TRUE;\n  return XML_FALSE;\n}\n\nstatic size_t\nkeylen(KEY s) {\n  size_t len = 0;\n  for (; *s; s++, len++)\n    ;\n  return len;\n}\n\nstatic void\ncopy_salt_to_sipkey(XML_Parser parser, struct sipkey *key) {\n  key->k[0] = 0;\n  key->k[1] = get_hash_secret_salt(parser);\n}\n\nstatic unsigned long FASTCALL\nhash(XML_Parser parser, KEY s) {\n  struct siphash state;\n  struct sipkey key;\n  (void)sip24_valid;\n  copy_salt_to_sipkey(parser, &key);\n  sip24_init(&state, &key);\n  sip24_update(&state, s, keylen(s) * sizeof(XML_Char));\n  return (unsigned long)sip24_final(&state);\n}\n\nstatic NAMED *\nlookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize) {\n  size_t i;\n  if (table->size == 0) {\n    size_t tsize;\n    if (! createSize)\n      return NULL;\n    table->power = INIT_POWER;\n    /* table->size is a power of 2 */\n    table->size = (size_t)1 << INIT_POWER;\n    tsize = table->size * sizeof(NAMED *);\n    table->v = (NAMED **)table->mem->malloc_fcn(tsize);\n    if (! table->v) {\n      table->size = 0;\n      return NULL;\n    }\n    memset(table->v, 0, tsize);\n    i = hash(parser, name) & ((unsigned long)table->size - 1);\n  } else {\n    unsigned long h = hash(parser, name);\n    unsigned long mask = (unsigned long)table->size - 1;\n    unsigned char step = 0;\n    i = h & mask;\n    while (table->v[i]) {\n      if (keyeq(name, table->v[i]->name))\n        return table->v[i];\n      if (! step)\n        step = PROBE_STEP(h, mask, table->power);\n      i < step ? (i += table->size - step) : (i -= step);\n    }\n    if (! createSize)\n      return NULL;\n\n    /* check for overflow (table is half full) */\n    if (table->used >> (table->power - 1)) {\n      unsigned char newPower = table->power + 1;\n      size_t newSize = (size_t)1 << newPower;\n      unsigned long newMask = (unsigned long)newSize - 1;\n      size_t tsize = newSize * sizeof(NAMED *);\n      NAMED **newV = (NAMED **)table->mem->malloc_fcn(tsize);\n      if (! newV)\n        return NULL;\n      memset(newV, 0, tsize);\n      for (i = 0; i < table->size; i++)\n        if (table->v[i]) {\n          unsigned long newHash = hash(parser, table->v[i]->name);\n          size_t j = newHash & newMask;\n          step = 0;\n          while (newV[j]) {\n            if (! step)\n              step = PROBE_STEP(newHash, newMask, newPower);\n            j < step ? (j += newSize - step) : (j -= step);\n          }\n          newV[j] = table->v[i];\n        }\n      table->mem->free_fcn(table->v);\n      table->v = newV;\n      table->power = newPower;\n      table->size = newSize;\n      i = h & newMask;\n      step = 0;\n      while (table->v[i]) {\n        if (! step)\n          step = PROBE_STEP(h, newMask, newPower);\n        i < step ? (i += newSize - step) : (i -= step);\n      }\n    }\n  }\n  table->v[i] = (NAMED *)table->mem->malloc_fcn(createSize);\n  if (! table->v[i])\n    return NULL;\n  memset(table->v[i], 0, createSize);\n  table->v[i]->name = name;\n  (table->used)++;\n  return table->v[i];\n}\n\nstatic void FASTCALL\nhashTableClear(HASH_TABLE *table) {\n  size_t i;\n  for (i = 0; i < table->size; i++) {\n    table->mem->free_fcn(table->v[i]);\n    table->v[i] = NULL;\n  }\n  table->used = 0;\n}\n\nstatic void FASTCALL\nhashTableDestroy(HASH_TABLE *table) {\n  size_t i;\n  for (i = 0; i < table->size; i++)\n    table->mem->free_fcn(table->v[i]);\n  table->mem->free_fcn(table->v);\n}\n\nstatic void FASTCALL\nhashTableInit(HASH_TABLE *p, const XML_Memory_Handling_Suite *ms) {\n  p->power = 0;\n  p->size = 0;\n  p->used = 0;\n  p->v = NULL;\n  p->mem = ms;\n}\n\nstatic void FASTCALL\nhashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table) {\n  iter->p = table->v;\n  iter->end = iter->p + table->size;\n}\n\nstatic NAMED *FASTCALL\nhashTableIterNext(HASH_TABLE_ITER *iter) {\n  while (iter->p != iter->end) {\n    NAMED *tem = *(iter->p)++;\n    if (tem)\n      return tem;\n  }\n  return NULL;\n}\n\nstatic void FASTCALL\npoolInit(STRING_POOL *pool, const XML_Memory_Handling_Suite *ms) {\n  pool->blocks = NULL;\n  pool->freeBlocks = NULL;\n  pool->start = NULL;\n  pool->ptr = NULL;\n  pool->end = NULL;\n  pool->mem = ms;\n}\n\nstatic void FASTCALL\npoolClear(STRING_POOL *pool) {\n  if (! pool->freeBlocks)\n    pool->freeBlocks = pool->blocks;\n  else {\n    BLOCK *p = pool->blocks;\n    while (p) {\n      BLOCK *tem = p->next;\n      p->next = pool->freeBlocks;\n      pool->freeBlocks = p;\n      p = tem;\n    }\n  }\n  pool->blocks = NULL;\n  pool->start = NULL;\n  pool->ptr = NULL;\n  pool->end = NULL;\n}\n\nstatic void FASTCALL\npoolDestroy(STRING_POOL *pool) {\n  BLOCK *p = pool->blocks;\n  while (p) {\n    BLOCK *tem = p->next;\n    pool->mem->free_fcn(p);\n    p = tem;\n  }\n  p = pool->freeBlocks;\n  while (p) {\n    BLOCK *tem = p->next;\n    pool->mem->free_fcn(p);\n    p = tem;\n  }\n}\n\nstatic XML_Char *\npoolAppend(STRING_POOL *pool, const ENCODING *enc, const char *ptr,\n           const char *end) {\n  if (! pool->ptr && ! poolGrow(pool))\n    return NULL;\n  for (;;) {\n    const enum XML_Convert_Result convert_res = XmlConvert(\n        enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end);\n    if ((convert_res == XML_CONVERT_COMPLETED)\n        || (convert_res == XML_CONVERT_INPUT_INCOMPLETE))\n      break;\n    if (! poolGrow(pool))\n      return NULL;\n  }\n  return pool->start;\n}\n\nstatic const XML_Char *FASTCALL\npoolCopyString(STRING_POOL *pool, const XML_Char *s) {\n  do {\n    if (! poolAppendChar(pool, *s))\n      return NULL;\n  } while (*s++);\n  s = pool->start;\n  poolFinish(pool);\n  return s;\n}\n\nstatic const XML_Char *\npoolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n) {\n  if (! pool->ptr && ! poolGrow(pool)) {\n    /* The following line is unreachable given the current usage of\n     * poolCopyStringN().  Currently it is called from exactly one\n     * place to copy the text of a simple general entity.  By that\n     * point, the name of the entity is already stored in the pool, so\n     * pool->ptr cannot be NULL.\n     *\n     * If poolCopyStringN() is used elsewhere as it well might be,\n     * this line may well become executable again.  Regardless, this\n     * sort of check shouldn't be removed lightly, so we just exclude\n     * it from the coverage statistics.\n     */\n    return NULL; /* LCOV_EXCL_LINE */\n  }\n  for (; n > 0; --n, s++) {\n    if (! poolAppendChar(pool, *s))\n      return NULL;\n  }\n  s = pool->start;\n  poolFinish(pool);\n  return s;\n}\n\nstatic const XML_Char *FASTCALL\npoolAppendString(STRING_POOL *pool, const XML_Char *s) {\n  while (*s) {\n    if (! poolAppendChar(pool, *s))\n      return NULL;\n    s++;\n  }\n  return pool->start;\n}\n\nstatic XML_Char *\npoolStoreString(STRING_POOL *pool, const ENCODING *enc, const char *ptr,\n                const char *end) {\n  if (! poolAppend(pool, enc, ptr, end))\n    return NULL;\n  if (pool->ptr == pool->end && ! poolGrow(pool))\n    return NULL;\n  *(pool->ptr)++ = 0;\n  return pool->start;\n}\n\nstatic size_t\npoolBytesToAllocateFor(int blockSize) {\n  /* Unprotected math would be:\n  ** return offsetof(BLOCK, s) + blockSize * sizeof(XML_Char);\n  **\n  ** Detect overflow, avoiding _signed_ overflow undefined behavior\n  ** For a + b * c we check b * c in isolation first, so that addition of a\n  ** on top has no chance of making us accept a small non-negative number\n  */\n  const size_t stretch = sizeof(XML_Char); /* can be 4 bytes */\n\n  if (blockSize <= 0)\n    return 0;\n\n  if (blockSize > (int)(INT_MAX / stretch))\n    return 0;\n\n  {\n    const int stretchedBlockSize = blockSize * (int)stretch;\n    const int bytesToAllocate\n        = (int)(offsetof(BLOCK, s) + (unsigned)stretchedBlockSize);\n    if (bytesToAllocate < 0)\n      return 0;\n\n    return (size_t)bytesToAllocate;\n  }\n}\n\nstatic XML_Bool FASTCALL\npoolGrow(STRING_POOL *pool) {\n  if (pool->freeBlocks) {\n    if (pool->start == 0) {\n      pool->blocks = pool->freeBlocks;\n      pool->freeBlocks = pool->freeBlocks->next;\n      pool->blocks->next = NULL;\n      pool->start = pool->blocks->s;\n      pool->end = pool->start + pool->blocks->size;\n      pool->ptr = pool->start;\n      return XML_TRUE;\n    }\n    if (pool->end - pool->start < pool->freeBlocks->size) {\n      BLOCK *tem = pool->freeBlocks->next;\n      pool->freeBlocks->next = pool->blocks;\n      pool->blocks = pool->freeBlocks;\n      pool->freeBlocks = tem;\n      memcpy(pool->blocks->s, pool->start,\n             (pool->end - pool->start) * sizeof(XML_Char));\n      pool->ptr = pool->blocks->s + (pool->ptr - pool->start);\n      pool->start = pool->blocks->s;\n      pool->end = pool->start + pool->blocks->size;\n      return XML_TRUE;\n    }\n  }\n  if (pool->blocks && pool->start == pool->blocks->s) {\n    BLOCK *temp;\n    int blockSize = (int)((unsigned)(pool->end - pool->start) * 2U);\n    size_t bytesToAllocate;\n\n    /* NOTE: Needs to be calculated prior to calling `realloc`\n             to avoid dangling pointers: */\n    const ptrdiff_t offsetInsideBlock = pool->ptr - pool->start;\n\n    if (blockSize < 0) {\n      /* This condition traps a situation where either more than\n       * INT_MAX/2 bytes have already been allocated.  This isn't\n       * readily testable, since it is unlikely that an average\n       * machine will have that much memory, so we exclude it from the\n       * coverage statistics.\n       */\n      return XML_FALSE; /* LCOV_EXCL_LINE */\n    }\n\n    bytesToAllocate = poolBytesToAllocateFor(blockSize);\n    if (bytesToAllocate == 0)\n      return XML_FALSE;\n\n    temp = (BLOCK *)pool->mem->realloc_fcn(pool->blocks,\n                                           (unsigned)bytesToAllocate);\n    if (temp == NULL)\n      return XML_FALSE;\n    pool->blocks = temp;\n    pool->blocks->size = blockSize;\n    pool->ptr = pool->blocks->s + offsetInsideBlock;\n    pool->start = pool->blocks->s;\n    pool->end = pool->start + blockSize;\n  } else {\n    BLOCK *tem;\n    int blockSize = (int)(pool->end - pool->start);\n    size_t bytesToAllocate;\n\n    if (blockSize < 0) {\n      /* This condition traps a situation where either more than\n       * INT_MAX bytes have already been allocated (which is prevented\n       * by various pieces of program logic, not least this one, never\n       * mind the unlikelihood of actually having that much memory) or\n       * the pool control fields have been corrupted (which could\n       * conceivably happen in an extremely buggy user handler\n       * function).  Either way it isn't readily testable, so we\n       * exclude it from the coverage statistics.\n       */\n      return XML_FALSE; /* LCOV_EXCL_LINE */\n    }\n\n    if (blockSize < INIT_BLOCK_SIZE)\n      blockSize = INIT_BLOCK_SIZE;\n    else {\n      /* Detect overflow, avoiding _signed_ overflow undefined behavior */\n      if ((int)((unsigned)blockSize * 2U) < 0) {\n        return XML_FALSE;\n      }\n      blockSize *= 2;\n    }\n\n    bytesToAllocate = poolBytesToAllocateFor(blockSize);\n    if (bytesToAllocate == 0)\n      return XML_FALSE;\n\n    tem = (BLOCK *)pool->mem->malloc_fcn(bytesToAllocate);\n    if (! tem)\n      return XML_FALSE;\n    tem->size = blockSize;\n    tem->next = pool->blocks;\n    pool->blocks = tem;\n    if (pool->ptr != pool->start)\n      memcpy(tem->s, pool->start, (pool->ptr - pool->start) * sizeof(XML_Char));\n    pool->ptr = tem->s + (pool->ptr - pool->start);\n    pool->start = tem->s;\n    pool->end = tem->s + blockSize;\n  }\n  return XML_TRUE;\n}\n\nstatic int FASTCALL\nnextScaffoldPart(XML_Parser parser) {\n  DTD *const dtd = parser->m_dtd; /* save one level of indirection */\n  CONTENT_SCAFFOLD *me;\n  int next;\n\n  if (! dtd->scaffIndex) {\n    dtd->scaffIndex = (int *)MALLOC(parser, parser->m_groupSize * sizeof(int));\n    if (! dtd->scaffIndex)\n      return -1;\n    dtd->scaffIndex[0] = 0;\n  }\n\n  if (dtd->scaffCount >= dtd->scaffSize) {\n    CONTENT_SCAFFOLD *temp;\n    if (dtd->scaffold) {\n      temp = (CONTENT_SCAFFOLD *)REALLOC(\n          parser, dtd->scaffold, dtd->scaffSize * 2 * sizeof(CONTENT_SCAFFOLD));\n      if (temp == NULL)\n        return -1;\n      dtd->scaffSize *= 2;\n    } else {\n      temp = (CONTENT_SCAFFOLD *)MALLOC(parser, INIT_SCAFFOLD_ELEMENTS\n                                                    * sizeof(CONTENT_SCAFFOLD));\n      if (temp == NULL)\n        return -1;\n      dtd->scaffSize = INIT_SCAFFOLD_ELEMENTS;\n    }\n    dtd->scaffold = temp;\n  }\n  next = dtd->scaffCount++;\n  me = &dtd->scaffold[next];\n  if (dtd->scaffLevel) {\n    CONTENT_SCAFFOLD *parent\n        = &dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]];\n    if (parent->lastchild) {\n      dtd->scaffold[parent->lastchild].nextsib = next;\n    }\n    if (! parent->childcnt)\n      parent->firstchild = next;\n    parent->lastchild = next;\n    parent->childcnt++;\n  }\n  me->firstchild = me->lastchild = me->childcnt = me->nextsib = 0;\n  return next;\n}\n\nstatic void\nbuild_node(XML_Parser parser, int src_node, XML_Content *dest,\n           XML_Content **contpos, XML_Char **strpos) {\n  DTD *const dtd = parser->m_dtd; /* save one level of indirection */\n  dest->type = dtd->scaffold[src_node].type;\n  dest->quant = dtd->scaffold[src_node].quant;\n  if (dest->type == XML_CTYPE_NAME) {\n    const XML_Char *src;\n    dest->name = *strpos;\n    src = dtd->scaffold[src_node].name;\n    for (;;) {\n      *(*strpos)++ = *src;\n      if (! *src)\n        break;\n      src++;\n    }\n    dest->numchildren = 0;\n    dest->children = NULL;\n  } else {\n    unsigned int i;\n    int cn;\n    dest->numchildren = dtd->scaffold[src_node].childcnt;\n    dest->children = *contpos;\n    *contpos += dest->numchildren;\n    for (i = 0, cn = dtd->scaffold[src_node].firstchild; i < dest->numchildren;\n         i++, cn = dtd->scaffold[cn].nextsib) {\n      build_node(parser, cn, &(dest->children[i]), contpos, strpos);\n    }\n    dest->name = NULL;\n  }\n}\n\nstatic XML_Content *\nbuild_model(XML_Parser parser) {\n  DTD *const dtd = parser->m_dtd; /* save one level of indirection */\n  XML_Content *ret;\n  XML_Content *cpos;\n  XML_Char *str;\n  int allocsize = (dtd->scaffCount * sizeof(XML_Content)\n                   + (dtd->contentStringLen * sizeof(XML_Char)));\n\n  ret = (XML_Content *)MALLOC(parser, allocsize);\n  if (! ret)\n    return NULL;\n\n  str = (XML_Char *)(&ret[dtd->scaffCount]);\n  cpos = &ret[1];\n\n  build_node(parser, 0, ret, &cpos, &str);\n  return ret;\n}\n\nstatic ELEMENT_TYPE *\ngetElementType(XML_Parser parser, const ENCODING *enc, const char *ptr,\n               const char *end) {\n  DTD *const dtd = parser->m_dtd; /* save one level of indirection */\n  const XML_Char *name = poolStoreString(&dtd->pool, enc, ptr, end);\n  ELEMENT_TYPE *ret;\n\n  if (! name)\n    return NULL;\n  ret = (ELEMENT_TYPE *)lookup(parser, &dtd->elementTypes, name,\n                               sizeof(ELEMENT_TYPE));\n  if (! ret)\n    return NULL;\n  if (ret->name != name)\n    poolDiscard(&dtd->pool);\n  else {\n    poolFinish(&dtd->pool);\n    if (! setElementTypePrefix(parser, ret))\n      return NULL;\n  }\n  return ret;\n}\n\nstatic XML_Char *\ncopyString(const XML_Char *s, const XML_Memory_Handling_Suite *memsuite) {\n  int charsRequired = 0;\n  XML_Char *result;\n\n  /* First determine how long the string is */\n  while (s[charsRequired] != 0) {\n    charsRequired++;\n  }\n  /* Include the terminator */\n  charsRequired++;\n\n  /* Now allocate space for the copy */\n  result = memsuite->malloc_fcn(charsRequired * sizeof(XML_Char));\n  if (result == NULL)\n    return NULL;\n  /* Copy the original into place */\n  memcpy(result, s, charsRequired * sizeof(XML_Char));\n  return result;\n}\n"},{"id":16545,"name":"cextern/wcslib","nodeType":"Package"},{"id":16546,"name":"README","nodeType":"TextFile","path":"cextern/wcslib","text":"------------------------------------------------------------------------------\n                         WCSLIB 7.7 and PGSBOX 7.7\n------------------------------------------------------------------------------\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under\n  the terms of the GNU Lesser General Public License as published by the\n  Free Software Foundation, either version 3 of the License, or (at your\n  option) any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: README,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n------------------------------------------------------------------------------\n\nPlease refer to\n\n  ./INSTALL\t\t...Installation instructions.\n\n  ./html/index.html\t...The WCSLIB programmer's manual in HTML format.\n  ./wcslib.pdf\t\t...The WCSLIB programmer's manual in PDF format.\n\n  ./CHANGES\t\t...Log of changes made to WCSLIB.\n\n  ./THANKS\t\t...List of contributors to WCSLIB.\n\n  ./VALIDATION\t\t...List of platforms on which the installation\n\t\t\t   procedures and test suite were exercised.\n\n  ./COPYING\t\t...A copy of the GNU General Public License, v3.0.\n  ./COPYING.LESSER\t...A copy of the Lesser GNU General Public License.\n"},{"id":16547,"name":"wcslib.pc.in","nodeType":"TextFile","path":"cextern/wcslib","text":"prefix=@prefix@\nexec_prefix=@exec_prefix@\nlibdir=@libdir@\nincludedir=@includedir@/wcslib\n\nName: WCSLIB\nDescription: An implementation of the FITS World Coordinate System standard\nVersion: @PACKAGE_VERSION@\nRequires:\nLibs: -L${libdir} -lwcs -lm\nCflags: -I${includedir}\n"},{"id":16548,"name":"COPYING","nodeType":"TextFile","path":"cextern/wcslib","text":"                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n"},{"id":16549,"name":"COPYING.LESSER","nodeType":"TextFile","path":"cextern/wcslib","text":"\t\t   GNU LESSER GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n\n  This version of the GNU Lesser General Public License incorporates\nthe terms and conditions of version 3 of the GNU General Public\nLicense, supplemented by the additional permissions listed below.\n\n  0. Additional Definitions.\n\n  As used herein, \"this License\" refers to version 3 of the GNU Lesser\nGeneral Public License, and the \"GNU GPL\" refers to version 3 of the GNU\nGeneral Public License.\n\n  \"The Library\" refers to a covered work governed by this License,\nother than an Application or a Combined Work as defined below.\n\n  An \"Application\" is any work that makes use of an interface provided\nby the Library, but which is not otherwise based on the Library.\nDefining a subclass of a class defined by the Library is deemed a mode\nof using an interface provided by the Library.\n\n  A \"Combined Work\" is a work produced by combining or linking an\nApplication with the Library.  The particular version of the Library\nwith which the Combined Work was made is also called the \"Linked\nVersion\".\n\n  The \"Minimal Corresponding Source\" for a Combined Work means the\nCorresponding Source for the Combined Work, excluding any source code\nfor portions of the Combined Work that, considered in isolation, are\nbased on the Application, and not on the Linked Version.\n\n  The \"Corresponding Application Code\" for a Combined Work means the\nobject code and/or source code for the Application, including any data\nand utility programs needed for reproducing the Combined Work from the\nApplication, but excluding the System Libraries of the Combined Work.\n\n  1. Exception to Section 3 of the GNU GPL.\n\n  You may convey a covered work under sections 3 and 4 of this License\nwithout being bound by section 3 of the GNU GPL.\n\n  2. Conveying Modified Versions.\n\n  If you modify a copy of the Library, and, in your modifications, a\nfacility refers to a function or data to be supplied by an Application\nthat uses the facility (other than as an argument passed when the\nfacility is invoked), then you may convey a copy of the modified\nversion:\n\n   a) under this License, provided that you make a good faith effort to\n   ensure that, in the event an Application does not supply the\n   function or data, the facility still operates, and performs\n   whatever part of its purpose remains meaningful, or\n\n   b) under the GNU GPL, with none of the additional permissions of\n   this License applicable to that copy.\n\n  3. Object Code Incorporating Material from Library Header Files.\n\n  The object code form of an Application may incorporate material from\na header file that is part of the Library.  You may convey such object\ncode under terms of your choice, provided that, if the incorporated\nmaterial is not limited to numerical parameters, data structure\nlayouts and accessors, or small macros, inline functions and templates\n(ten or fewer lines in length), you do both of the following:\n\n   a) Give prominent notice with each copy of the object code that the\n   Library is used in it and that the Library and its use are\n   covered by this License.\n\n   b) Accompany the object code with a copy of the GNU GPL and this license\n   document.\n\n  4. Combined Works.\n\n  You may convey a Combined Work under terms of your choice that,\ntaken together, effectively do not restrict modification of the\nportions of the Library contained in the Combined Work and reverse\nengineering for debugging such modifications, if you also do each of\nthe following:\n\n   a) Give prominent notice with each copy of the Combined Work that\n   the Library is used in it and that the Library and its use are\n   covered by this License.\n\n   b) Accompany the Combined Work with a copy of the GNU GPL and this license\n   document.\n\n   c) For a Combined Work that displays copyright notices during\n   execution, include the copyright notice for the Library among\n   these notices, as well as a reference directing the user to the\n   copies of the GNU GPL and this license document.\n\n   d) Do one of the following:\n\n       0) Convey the Minimal Corresponding Source under the terms of this\n       License, and the Corresponding Application Code in a form\n       suitable for, and under terms that permit, the user to\n       recombine or relink the Application with a modified version of\n       the Linked Version to produce a modified Combined Work, in the\n       manner specified by section 6 of the GNU GPL for conveying\n       Corresponding Source.\n\n       1) Use a suitable shared library mechanism for linking with the\n       Library.  A suitable mechanism is one that (a) uses at run time\n       a copy of the Library already present on the user's computer\n       system, and (b) will operate properly with a modified version\n       of the Library that is interface-compatible with the Linked\n       Version.\n\n   e) Provide Installation Information, but only if you would otherwise\n   be required to provide such information under section 6 of the\n   GNU GPL, and only to the extent that such information is\n   necessary to install and execute a modified version of the\n   Combined Work produced by recombining or relinking the\n   Application with a modified version of the Linked Version. (If\n   you use option 4d0, the Installation Information must accompany\n   the Minimal Corresponding Source and Corresponding Application\n   Code. If you use option 4d1, you must provide the Installation\n   Information in the manner specified by section 6 of the GNU GPL\n   for conveying Corresponding Source.)\n\n  5. Combined Libraries.\n\n  You may place library facilities that are a work based on the\nLibrary side by side in a single library together with other library\nfacilities that are not Applications and are not covered by this\nLicense, and convey such a combined library under terms of your\nchoice, if you do both of the following:\n\n   a) Accompany the combined library with a copy of the same work based\n   on the Library, uncombined with any other library facilities,\n   conveyed under the terms of this License.\n\n   b) Give prominent notice with the combined library that part of it\n   is a work based on the Library, and explaining where to find the\n   accompanying uncombined form of the same work.\n\n  6. Revised Versions of the GNU Lesser General Public License.\n\n  The Free Software Foundation may publish revised and/or new versions\nof the GNU Lesser General Public License from time to time. Such new\nversions will be similar in spirit to the present version, but may\ndiffer in detail to address new problems or concerns.\n\n  Each version is given a distinguishing version number. If the\nLibrary as you received it specifies that a certain numbered version\nof the GNU Lesser General Public License \"or any later version\"\napplies to it, you have the option of following the terms and\nconditions either of that published version or of any later version\npublished by the Free Software Foundation. If the Library as you\nreceived it does not specify a version number of the GNU Lesser\nGeneral Public License, you may choose any version of the GNU Lesser\nGeneral Public License ever published by the Free Software Foundation.\n\n  If the Library as you received it specifies that a proxy can decide\nwhether future versions of the GNU Lesser General Public License shall\napply, that proxy's public statement of acceptance of any version is\npermanent authorization for you to choose that version for the\nLibrary.\n"},{"id":16550,"name":"wcsconfig_f77.h.in","nodeType":"TextFile","path":"cextern/wcslib","text":"/*============================================================================\n*\n* wcsconfig_f77.h is generated from wcsconfig_f77.h.in by 'configure'.  It\n* contains C preprocessor definitions for building the WCSLIB 7.7 Fortran\n* wrappers.\n*\n* Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n* http://www.atnf.csiro.au/people/Mark.Calabretta\n* $Id: wcsconfig_f77.h.in,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n/* Integer array type large enough to hold an address.  Set here to int[2] for\n * 64-bit addresses, but could be defined as int* on 32-bit machines. */\ntypedef int iptr[2];\n\n/* Macro for mangling Fortran subroutine names that do not contain\n * underscores.  Typically a name like \"WCSINI\" (case-insensitive) will become\n * something like \"wcsini_\" (case-sensitive).  The Fortran wrappers, which are\n * written in C, are preprocessed into names that match the latter.  The macro\n * takes two arguments which specify the name in lower and upper case. */\n#undef F77_FUNC\n"},{"id":16551,"name":"wcsconfig_tests.h.in","nodeType":"TextFile","path":"cextern/wcslib","text":"/*============================================================================\n*\n* wcsconfig_test.h is generated from wcsconfig_test.h.in by 'configure'.  It\n* contains C preprocessor definitions for compiling the WCSLIB 7.7 test/demo\n* programs.\n*\n* Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n* http://www.atnf.csiro.au/people/Mark.Calabretta\n* $Id: wcsconfig_tests.h.in,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <wcsconfig.h>\n\n/* Define to 1 if the CFITSIO library is available. */\n#undef HAVE_CFITSIO\n\n/* Define to the printf format modifier for size_t type. */\n#undef MODZ\n"},{"col":4,"comment":"null","endLoc":275,"header":"def draw(self, renderer, bboxes, ticklabels_bbox, tick_out_size)","id":16552,"name":"draw","nodeType":"Function","startLoc":255,"text":"def draw(self, renderer, bboxes, ticklabels_bbox, tick_out_size):\n        if not self.get_visible():\n            return\n\n        self._set_xy_alignments(renderer, tick_out_size)\n\n        for axis in self.get_visible_axes():\n            for i in range(len(self.world[axis])):\n                # This implicitly sets the label text, position, alignment\n                bb = self._get_bb(axis, i, renderer)\n                if bb is None:\n                    continue\n\n                # TODO: the problem here is that we might get rid of a label\n                # that has a key starting bit such as -0:30 where the -0\n                # might be dropped from all other labels.\n\n                if not self._exclude_overlapping or bb.count_overlaps(bboxes) == 0:\n                    super().draw(renderer)\n                    bboxes.append(bb)\n                    ticklabels_bbox[axis].append(bb)"},{"id":16553,"name":"flavours","nodeType":"TextFile","path":"cextern/wcslib","text":"#-----------------------------------------------------------------------------\n# Makefile overrides for various combinations of architecture, operating\n# system and compiler.  Used for development and testing only, not required\n# for building WCSLIB.\n#\n# Variables like CC and CFLAGS are exported into the environment so that they\n# will be seen by 'configure'.  Thus, normal usage is as follows:\n#\n#   make distclean\n#   make FLAVOUR=Linux configure\n#   make\n#\n# Reminder: add '-d' to FLFLAGS for debugging.\n#\n# $Id: flavours,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n#-----------------------------------------------------------------------------\n\n# The list of FLAVOURs can be set on the command line.\nF := $(shell echo $(FLAVOURS) | tr a-z A-Z)\nifeq \"$F\" \"\"\n  F :=\n  FLAVOURS := \"\"\nendif\n\nifeq \"$F\" \"LINUX\"\n  override FLAVOURS := \"\" Linux Linuxp\nendif\n\nifeq \"$F\" \"SUN\"\n  override FLAVOURS := \"\" SUN/GNU SUN/GNU3 SUN/GNUp SUN/ANSI\nendif\n\nifeq \"$F\" \"PURE\"\n  override FLAVOURS := SUN/Pure SUN/Quant\nendif\n\nF :=\n\n\n# Quench warnings about padding in foreign structs, particularly in fitsio.h.\nifneq \"$(findstring $(SUBDIR),C Fortran pgsbox)\" \"\"\n  WPADDED := -Wpadded\nendif\n\n\n# Linux with gcc/gfortran (also works for Darwin).\nifeq \"$(FLAVOUR)\" \"Linux\"\n  F := $(FLAVOUR)\n  INSTRUMENT      := -fsanitize=address -fsanitize=undefined\n  INSTRUMENT      += -fstack-protector-strong\n  CWARNINGS       := -Wall -Wextra -Wno-clobbered -Wno-long-long\n  ifeq \"$(INSTRUMENT)\" \"\"\n    # The instrumentation options produce copious \"padding\" warnings.\n    CWARNINGS     += $(WPADDED)\n  endif\n  FWARNINGS       := -Wall -Wno-surprising\n  export CC       := gcc -std=c99 -pedantic\n  export CPPFLAGS :=\n  export CFLAGS   := -g -O0 $(INSTRUMENT) $(CWARNINGS)\n  export F77      := gfortran\n  export FFLAGS   := -g -O0 -fimplicit-none -I. $(INSTRUMENT) $(FWARNINGS)\n  export LDFLAGS  := $(INSTRUMENT)\n  ifdef VALGRIND\n    override VALGRIND := valgrind -v --leak-check=full --show-leak-kinds=all\n    override VALGRIND += --track-origins=yes\n  endif\nendif\n\nifeq \"$(FLAVOUR)\" \"Linux11\"\n  F := $(FLAVOUR)\n  INSTRUMENT      := -fsanitize=address -fsanitize=undefined\n  INSTRUMENT      += -fstack-protector-strong\n  CWARNINGS       := -Wall -Wextra -Wno-clobbered -Wno-long-long\n  ifeq \"$(INSTRUMENT)\" \"\"\n    # The instrumentation options produce copious \"padding\" warnings.\n    CWARNINGS     += $(WPADDED)\n  endif\n  FWARNINGS       := -Wall -Wno-surprising\n  export CC       := gcc-11.1.0 -std=c99 -pedantic\n  export CPPFLAGS := -D_FORTIFY_SOURCE=2\n  export CFLAGS   := -g -O0 $(INSTRUMENT) $(CWARNINGS)\n  export F77      := gfortran-11.1.0\n  export FFLAGS   := -g -O0 -fimplicit-none -I. $(INSTRUMENT) $(FWARNINGS)\n  export LDFLAGS  := $(INSTRUMENT)\n  export LD_RUN_PATH := /usr/local/lib64\n  ifdef VALGRIND\n    override VALGRIND := valgrind -v --leak-check=full --show-leak-kinds=all\n    override VALGRIND += --track-origins=yes\n  endif\nendif\n\nifeq \"$(FLAVOUR)\" \"Linuxp\"\n  F := $(FLAVOUR)\n  export CC       := gcc -std=c99 -pedantic\n  export CPPFLAGS :=\n  export CFLAGS   := -pg -g -O -Wall -Wextra -Wno-long-long $(WPADDED)\n  export FFLAGS   := -pg -a -g -O -fimplicit-none -Wall -I.\n  export LDFLAGS  := -pg -g $(filter -L%, $(LDFLAGS))\n  override EXTRA_CLEAN := gmon.out bb.out\nendif\n\n\n# Solaris with gcc/gfortran 4.x (lynx).\nifeq \"$(FLAVOUR)\" \"SUN/GNU\"\n  F := $(FLAVOUR)\n  export CC       := gcc -std=c99\n  export CPPFLAGS :=\n  export CFLAGS   := -g -Wall -Wno-long-long $(WPADDED)\n  export F77      := gfortran\n  export FFLAGS   := -g -fimplicit-none -Wall -I.\n  LD      := gcc\nendif\n\nifeq \"$(FLAVOUR)\" \"SUN/GNU3\"\n  F := $(FLAVOUR)\n  export CC       := gcc-3.1.1 -std=c99\n  export CPPFLAGS :=\n  export CFLAGS   := -g -Wall -Wno-long-long $(WPADDED)\n  export F77      := g77-3.1.1\n  export FFLAGS   := -g -Wimplicit -Wunused -Wno-globals -I.\n  LD      := gcc-3.1.1\nendif\n\nifeq \"$(FLAVOUR)\" \"SUN/GNUp\"\n  F := $(FLAVOUR)\n  export CC       := gcc -std=c99 -pedantic\n  export CPPFLAGS :=\n  export CFLAGS   := -pg -a -g -O -Wall -Wno-long-long $(WPADDED)\n  export FFLAGS   := -pg -a -g -O -fimplicit-none -Wall -I.\n  export LDFLAGS  := -pg -a -g $(filter -L%, $(LDFLAGS))\n  override EXTRA_CLEAN := gmon.out bb.out\nendif\n\n\n# Solaris with SUN cc/f77.\nifeq \"$(FLAVOUR)\" \"SUN/ANSI\"\n  F := $(FLAVOUR)\n  WCSTRIG := NATIVE\n  export CC       := cc\n  export CFLAGS   := -g -I/usr/local/include\n  export F77      := f77\n  export FFLAGS   := -g -erroff=WDECL_LOCAL_NOTUSED\n  LD      := f77\nendif\n\n\n# Purify and quantify in Solaris.\nifeq \"$(FLAVOUR)\" \"SUN/Pure\"\n  F := $(FLAVOUR)\n  WCSTRIG := NATIVE\n  export CC       := purify gcc\n  export CFLAGS   := -g\n  export F77      := purify gcc\n  export FFLAGS   := -g -Wimplicit -Wno-globals -I.\n  export LDFLAGS  := $(filter -L%, $(LDFLAGS))\n  override EXTRA_CLEAN := *_pure_p*.[ao] *.pcv .pure ../C/*_pure_p*.[ao]\nendif\n\nifeq \"$(FLAVOUR)\" \"SUN/Quant\"\n  F := $(FLAVOUR)\n  WCSTRIG := NATIVE\n  export CC       := quantify gcc\n  export CFLAGS   := -g\n  export F77      := quantify gcc\n  export FFLAGS   := -g -Wimplicit -Wno-globals -I.\n  export LDFLAGS  := $(filter -L%, $(LDFLAGS))\n  override EXTRA_CLEAN := *_pure_q*.[ao] .pure\nendif\n\n\n# Check FLAVOUR.\nifneq \"$F\" \"$(FLAVOUR)\"\n  override FLAVOUR := unrecognised\nendif\n\n# Check VALGRIND.\nifeq \"$(findstring valgrind, $(VALGRIND))\" \"valgrind\"\n  override MODE := interactive\nelse\n  # Unrecognised.\n  override VALGRIND :=\nendif\n\n# Check MODE.\nifeq \"$(MODE)\" \"interactive\"\n  # Important not to have output batched when running the test programs.\n  MAKEFLAGS := $(filter-out -Otarget,$(MAKEFLAGS)) -Onone\nelse\n  # Unrecognised.\n  override MODE :=\nendif\n\n\n# gmake uses FC in place of configure's F77.\nifdef F77\n  FC := $(F77)\nendif\n\nifndef TIMER\n  TIMER := date +\"%a %Y/%m/%d %X %z, executing on $$HOST\"\nendif\n\nifdef FLAVOUR\n  TIMER := $(TIMER) ; echo \"    with $(FLAVOUR) FLAVOUR.\"\nendif\n\n# Experimental (see http://upstream-tracker.org/versions/wcslib.html).\napi-sanity-check :\n\t-@ $(RM) -r $@/\n\t @ mkdir $@/\n\t @ cp C/*.h C/$(SHRLIB) $@/\n\t @ echo \"<version>$(LIBVER)</version>\" > $@/opts.xml\n\t @ echo \"<headers>.</headers>\" >> $@/opts.xml\n\t @ echo \"<libs>.</libs>\" >> $@/opts.xml\n\t @ echo \"<gcc_options>-Dwtbarr=wtbarr_s</gcc_options>\" >> $@/opts.xml\n\t   cd $@ && api-sanity-checker -lib WCSLIB -d opts.xml \\\n\t     -show-retval -gen -build -run\n\nshow ::\n\t-@ echo 'For code development...'\n\t-@ echo '  FLAVOURS    := $(FLAVOURS)'\n\t-@ echo '  FLAVOUR     := $(FLAVOUR)'\n\t-@ echo '  MODE        := $(MODE)'\n\t-@ echo '  VALGRIND    := $(VALGRIND)'\n\t-@ echo '  EXTRA_CLEAN := $(EXTRA_CLEAN)'\n\t-@ echo ''\n"},{"id":16554,"name":"VALIDATION","nodeType":"TextFile","path":"cextern/wcslib","text":"Platforms on which the installation procedures and test suite were exercised.\n\nWCSLIB version 7.7 (2021/07/12)\n-------------------------------\n\n* Dell Latitude E6530 (Intel Core i7-3740QM, 4 cores, 8 processors, x86_64)\n  KDE Neon User Edition 5.22 (over Kubuntu 20.04, (focal))\n  uname -r (kernel version): 5.4.0-77-generic\n  gcc --version: gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0\n  gfortran --version: GNU Fortran (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0\n\n    and\n\n  gcc --version: gcc (GCC) 11.1.0 (local build)\n  gfortran --version: GNU Fortran (GCC) 11.1.0 (local build)\n\n\nWCSLIB version 7.6 (2021/04/13)\n-------------------------------\n\n* Dell Latitude E6530 (Intel Core i7-3740QM, 4 cores, 8 processors, x86_64)\n  KDE Neon User Edition 5.21 (over Kubuntu 20.04, (focal))\n  uname -r (kernel version): 5.4.0-67-generic\n  gcc --version: gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0\n  gfortran --version: GNU Fortran (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0\n\n\nWCSLIB version 7.5 (2021/03/20)\n-------------------------------\n\n* Dell Latitude XPS 15 9560 (Intel Core i7-7700HQ, 4 cores, 8 CPUs, x86_64)\n  KDE Neon User Edition 5.20 (over Kubuntu 20.04, (focal))\n  uname -r (kernel version): 5.4.0-62-generic\n  gcc --version: gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0\n  gfortran --version: GNU Fortran (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0\n\n\nWCSLIB version 7.4 (2021/01/31)\n-------------------------------\n\n* Dell Latitude XPS 15 9560 (Intel Core i7-7700HQ, 4 cores, 8 CPUs, x86_64)\n  KDE Neon User Edition 5.20 (over Kubuntu 20.04, (focal))\n  uname -r (kernel version): 5.4.0-62-generic\n  gcc --version: gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0\n  gfortran --version: GNU Fortran (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0\n\n\nWCSLIB version 7.3.1 (2020/08/17)\n---------------------------------\n\n* Dell Latitude XPS 15 9560 (Intel Core i7-7700HQ, 4 cores, 8 CPUs, x86_64)\n  KDE Neon User Edition 5.19 (over Kubuntu 18.04, (bionic))\n  uname -r (kernel version): 4.15.0-112-generic\n  gcc --version: gcc (GCC) 9.2.0 (local build)\n  gfortran --version: GNU Fortran (GCC) 9.2.0 (local build)\n\n\nWCSLIB version 7.3 (2020/06/03)\n-------------------------------\n\n* Dell Latitude XPS 15 9560 (Intel Core i7-7700HQ, 4 cores, 8 CPUs, x86_64)\n  KDE Neon User Edition 5.18 (over Kubuntu 18.04, (bionic))\n  uname -r (kernel version): 4.15.0-88-generic\n  gcc --version: gcc (GCC) 9.2.0 (local build)\n  gfortran --version: GNU Fortran (GCC) 9.2.0 (local build)\n\n\nWCSLIB version 7.2 (2020/03/09)\n-------------------------------\n\n* Dell Latitude XPS 15 9560 (Intel Core i7-7700HQ, 4 cores, 8 CPUs, x86_64)\n  KDE Neon User Edition 5.18 (over Kubuntu 18.04, (bionic))\n  uname -r (kernel version): 4.15.0-88-generic\n  gcc --version: gcc (GCC) 9.2.0 (local build)\n  gfortran --version: GNU Fortran (GCC) 9.2.0 (local build)\n\n\nWCSLIB version 7.1 (2020/01/01)\n-------------------------------\n\n* Dell Latitude XPS 15 9560 (Intel Core i7-7700HQ, 4 cores, 8 CPUs, x86_64)\n  KDE Neon User Edition 5.17 (over Kubuntu 18.04, (bionic))\n  uname -r (kernel version): 4.15.0-70-generic\n  gcc --version: gcc (GCC) 9.2.0 (local build)\n  gfortran --version: GNU Fortran (GCC) 9.2.0 (local build)\n\n* Dell Latitude D610 (Intel Pentium M, 1 processor, i686)\n  Debian linux 4.0 (etch)\n  uname -r (kernel version): 2.6.18-6-686\n  gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)\n  gfortran --version: GNU Fortran 95 (GCC) 4.1.2 20061115 (prerelease)\n                      (Debian 4.1.1-21)\n\n\nWCSLIB version 6.3 (2019/07/12)\n-------------------------------\n\n* Dell Latitude XPS 15 9560 (Intel Core i7-7700HQ, 4 cores, 8 CPUs, x86_64)\n  KDE Neon User Edition 5.15 (over Kubuntu 18.04, (bionic))\n  uname -r (kernel version): 4.15.0-50-generic\n  gcc-8 --version: gcc-8 (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0\n  gfortran-8 --version: GNU Fortran (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0\n\n\nWCSLIB version 6.1 (2018/10/19)\n-------------------------------\n\n* Dell Latitude XPS 15 9560 (Intel Core i7-7700HQ, 4 cores, 8 CPUs, x86_64)\n  KDE Neon User Edition 5.13 (over Kubuntu 18.04, (bionic))\n  uname -r (kernel version): 4.15.0-29-generic\n  gcc --version: gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0\n  gfortran --version: GNU Fortran (Ubuntu 7.3.0-16ubuntu3) 7.3.0\n\n* Dell Latitude D610 (Intel Pentium M, 1 processor, i686)\n  Debian linux 4.0 (etch)\n  uname -r (kernel version): 2.6.18-6-686\n  gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)\n  gfortran --version: GNU Fortran 95 (GCC) 4.1.2 20061115 (prerelease)\n                      (Debian 4.1.1-21)\n\n\nWCSLIB version 5.20 (2018/10/05)\n--------------------------------\n\n* Dell Latitude XPS 15 9560 (Intel Core i7-7700HQ, 4 cores, 8 CPUs, x86_64)\n  KDE Neon User Edition 5.13 (over Kubuntu 18.04, (bionic))\n  uname -r (kernel version): 4.15.0-29-generic\n  gcc --version: gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0\n  gfortran --version: GNU Fortran (Ubuntu 7.3.0-16ubuntu3) 7.3.0\n\n\nWCSLIB version 5.19 (2018/07/27)\n--------------------------------\n\n* Dell Latitude E6530 (Intel Core i7-3740QM, 4 cores, 8 processors, x86_64)\n  Debian linux 8.10 (jessie)\n  uname -r (kernel version): 3.16.0-4-amd64\n  gcc --version: gcc-8.1.0 (GCC) 8.1.0 (local build)\n  gfortran --version: GNU Fortran (GCC) 8.1.0 (local build)\n\n    and\n\n  gcc --version: gcc (Debian 4.9.2-10) 4.9.2\n  gfortran --version: GNU Fortran (Debian 4.9.2-10) 4.9.2\n\n\nWCSLIB version 5.18 (2018/01/10)\n--------------------------------\n\n* Dell Latitude XPS 15 9560 (Intel Core i7-7700HQ, 4 cores, 8 CPUs, x86_64)\n  KDE Neon User Edition 5.11 (over Kubuntu 16.04, (xenial))\n  uname -r (kernel version): 4.10.0-40-generic\n  gcc --version: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609\n  gfortran --version: GNU Fortran (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609\n\n\nWCSLIB version 5.17 (2017/09/18)\n--------------------------------\n\n* Dell Latitude E6530 (Intel Core i7-3740QM, 4 cores, 8 processors, x86_64)\n  Debian linux 8.9 (jessie)\n  uname -r (kernel version): 3.16.0-4-amd64\n  gcc --version: gcc (Debian 4.9.2-10) 4.9.2\n  gfortran --version: GNU Fortran (Debian 4.9.2-10) 4.9.2\n\n\nWCSLIB version 5.16 (2017/01/15)\n--------------------------------\n\n* Dell Latitude D620 (Intel Centrino T2300, 2 processors, i686)\n  Debian linux 8.6 (jessie)\n  uname -r (kernel version): 3.16.0-4-686-pae\n  gcc --version: gcc (Debian 4.9.2-10) 4.9.2\n  gfortran --version: GNU Fortran (Debian 4.9.2-10) 4.9.2\n\n\nWCSLIB version 5.15 (2016/04/05)\n--------------------------------\n\n* Dell Latitude D620 (Intel Centrino T2300, 2 processors, i686)\n  Debian linux 8.3 (jessie)\n  uname -r (kernel version): 3.16.0-4-686-pae\n  gcc --version: gcc (Debian 4.9.2-10) 4.9.2\n  gfortran --version: GNU Fortran (Debian 4.9.2-10) 4.9.2\n\n\nWCSLIB version 5.14 (2016/02/07)\n--------------------------------\n\n* Dell Latitude D620 (Intel Centrino T2300, 2 processors, i686)\n  Debian linux 8.3 (jessie)\n  uname -r (kernel version): 3.16.0-4-686-pae\n  gcc --version: gcc (Debian 4.9.2-10) 4.9.2\n  gfortran --version: GNU Fortran (Debian 4.9.2-10) 4.9.2\n\n\nWCSLIB version 5.13 (2016/01/26)\n--------------------------------\n\n* Dell Latitude D620 (Intel Centrino T2300, 2 processors, i686)\n  Debian linux 8.3 (jessie)\n  uname -r (kernel version): 3.16.0-4-686-pae\n  gcc --version: gcc (Debian 4.9.2-10) 4.9.2\n  gfortran --version: GNU Fortran (Debian 4.9.2-10) 4.9.2\n\n\nWCSLIB version 5.12 (2015/11/15)\n--------------------------------\n\n* Dell Latitude D620 (Intel Centrino T2300, 2 processors, i686)\n  Debian linux 8.0 (jessie)\n  uname -r (kernel version): 3.16.0-4-686-pae\n  gcc --version: gcc (Debian 4.9.2-10) 4.9.2\n  gfortran --version: GNU Fortran (Debian 4.9.2-10) 4.9.2\n\n\nWCSLIB version 5.11 (2015/10/18)\n--------------------------------\n\n* Dell Latitude D620 (Intel Centrino T2300, 2 processors, i686)\n  Debian linux 8.0 (jessie)\n  uname -r (kernel version): 3.16.0-4-686-pae\n  gcc --version: gcc (Debian 4.9.2-10) 4.9.2\n  gfortran --version: GNU Fortran (Debian 4.9.2-10) 4.9.2\n\n\nWCSLIB version 5.10 (2015/10/09)\n--------------------------------\n\n* Dell Latitude D620 (Intel Centrino T2300, 2 processors, i686)\n  Debian linux 8.0 (jessie)\n  uname -r (kernel version): 3.16.0-4-686-pae\n  gcc --version: gcc (Debian 4.9.2-10) 4.9.2\n  gfortran --version: GNU Fortran (Debian 4.9.2-10) 4.9.2\n\n\nWCSLIB version 5.9 (2015/07/21)\n-------------------------------\n\n* Dell Latitude D620 (Intel Centrino T2300, 2 processors, i686)\n  Debian linux 8.0 (jessie)\n  uname -r (kernel version): 3.16.0-4-686-pae\n  gcc --version: gcc (Debian 4.9.2-10) 4.9.2\n  gfortran --version: GNU Fortran (Debian 4.9.2-10) 4.9.2\n\n\nWCSLIB version 5.8 (2015/07/08)\n-------------------------------\n\n* Dell Latitude D620 (Intel Centrino T2300, 2 processors, i686)\n  Debian linux 8.0 (jessie)\n  uname -r (kernel version): 3.16.0-4-686-pae\n  gcc --version: gcc (Debian 4.9.2-10) 4.9.2\n  gfortran --version: GNU Fortran (Debian 4.9.2-10) 4.9.2\n\n\nWCSLIB version 5.7 (2015/06/29)\n-------------------------------\n\n* Dell Latitude D620 (Intel Centrino T2300, 2 processors, i686)\n  Debian linux 8.0 (jessie)\n  uname -r (kernel version): 3.16.0-4-686-pae\n  gcc --version: gcc (Debian 4.9.2-10) 4.9.2\n  gfortran --version: GNU Fortran (Debian 4.9.2-10) 4.9.2\n\n\nWCSLIB version 5.6 (2015/06/14)\n-------------------------------\n\n* Dell Latitude D620 (Intel Centrino T2300, 2 processors, i686)\n  Debian linux 8.0 (jessie)\n  uname -r (kernel version): 3.16.0-4-686-pae\n  gcc --version: gcc (Debian 4.9.2-10) 4.9.2\n  gfortran --version: GNU Fortran (Debian 4.9.2-10) 4.9.2\n\n\nWCSLIB version 5.5 (2015/05/05)\n-------------------------------\n\n* Dell Latitude D620 (Intel Centrino T2300, 2 processors, i686)\n  Debian linux 7.8 (wheezy)\n  uname -r (kernel version): 3.2.0-4-686-pae\n  gcc --version: gcc (Debian 4.7.2-5) 4.7.2\n  gfortran --version: GNU Fortran (Debian 4.7.2-5) 4.7.2\n\n\nWCSLIB version 5.4 (2015/04/21)\n-------------------------------\n\n* Dell Latitude D620 (Intel Centrino T2300, 2 processors, i686)\n  Debian linux 7.8 (wheezy)\n  uname -r (kernel version): 3.2.0-4-686-pae\n  gcc --version: gcc (Debian 4.7.2-5) 4.7.2\n  gfortran --version: GNU Fortran (Debian 4.7.2-5) 4.7.2\n\n\nWCSLIB version 5.3 (2015/04/21)\n-------------------------------\n\n* Dell Latitude D620 (Intel Centrino T2300, 2 processors, i686)\n  Debian linux 7.8 (wheezy)\n  uname -r (kernel version): 3.2.0-4-686-pae\n  gcc --version: gcc (Debian 4.7.2-5) 4.7.2\n  gfortran --version: GNU Fortran (Debian 4.7.2-5) 4.7.2\n\n\nWCSLIB version 5.2 beta release (2015/04/15)\n--------------------------------------------\n\n* Dell Latitude D620 (Intel Centrino T2300, 2 processors, i686)\n  Debian linux 7.8 (wheezy)\n  uname -r (kernel version): 3.2.0-4-686-pae\n  gcc --version: gcc (Debian 4.7.2-5) 4.7.2\n  gfortran --version: GNU Fortran (Debian 4.7.2-5) 4.7.2\n\n* Dell PowerEdge R710 (Intel Xeon E5530, 8 processors, amd64)\n  Debian linux 7.8 (wheezy)\n  uname -r (kernel version): 3.2.0-4-amd64\n  gcc --version: gcc (Debian 4.7.2-5) 4.7.2\n  gfortran --version: GNU Fortran (Debian 4.7.2-5) 4.7.2\n  (Non-graphical tests only.)\n\n* Mac Mini (Intel Core i7, 4 cores, x86_64)\n  MacOSX 10.9.5 (13F1066)\n  uname -r (kernel version): Darwin 13.4.0\n  gcc --version: gcc (GCC) 4.8.3\n  gfortran --version: GNU Fortran (GCC) 4.8.3\n  (Non-graphical tests only.)\n\n\nWCSLIB version 5.1 beta release (2015/04/07)\n--------------------------------------------\n\n* Dell Latitude D620 (Intel Centrino T2300, 2 processors, i686)\n  Debian linux 7.8 (wheezy)\n  uname -r (kernel version): 3.2.0-4-686-pae\n  gcc --version: gcc (Debian 4.7.2-5) 4.7.2\n  gfortran --version: GNU Fortran (Debian 4.7.2-5) 4.7.2\n\n\nWCSLIB version 5.0 beta release (2015/04/05)\n--------------------------------------------\n\n* Dell Latitude D620 (Intel Centrino T2300, 2 processors, i686)\n  Debian linux 7.8 (wheezy)\n  uname -r (kernel version): 3.2.0-4-686-pae\n  gcc --version: gcc (Debian 4.7.2-5) 4.7.2\n  gfortran --version: GNU Fortran (Debian 4.7.2-5) 4.7.2\n\n* Dell PowerEdge R710 (Intel Xeon E5530, 8 processors, amd64)\n  Debian linux 7.8 (wheezy)\n  uname -r (kernel version): 3.2.0-4-amd64\n  gcc --version: gcc (Debian 4.7.2-5) 4.7.2\n  gfortran --version: GNU Fortran (Debian 4.7.2-5) 4.7.2\n  (Non-graphical tests only.)\n\n* Dell PowerEdge R820 (Intel Xeon E5-4620, 32 processors, amd64)\n  Debian linux 6.0.10 (squeeze)\n  uname -r (kernel version): 3.2.0-0.bpo.4-amd64\n  gcc --version: gcc (Debian 4.4.5-8) 4.4.5\n  gfortran --version: GNU Fortran (Debian 4.4.5-8) 4.4.5\n  (Non-graphical tests only.)\n\n* Mac Mini (Intel Core i7, 4 cores, x86_64)\n  MacOSX 10.9.5 (13F1066)\n  uname -r (kernel version): Darwin 13.4.0\n  gcc --version: gcc (GCC) 4.8.3\n  gfortran --version: GNU Fortran (GCC) 4.8.3\n  (Non-graphical tests only.)\n\n\nWCSLIB version 4.23 (2014/05/11)\n--------------------------------\n\n* Dell Latitude D620 (Intel Centrino, i686) running Debian linux 7.0 (wheezy)\n  uname -r (kernel version): 3.2.0-4-686-pae\n  gcc --version: gcc (Debian 4.7.2-5) 4.7.2\n  gfortran --version: GNU Fortran (Debian 4.7.2-5) 4.7.2\n\n\nWCSLIB version 4.22 (2014/04/13)\n--------------------------------\n\n* Dell Latitude D620 (Intel Centrino, i686) running Debian linux 7.0 (wheezy)\n  uname -r (kernel version): 3.2.0-4-686-pae\n  gcc --version: gcc (Debian 4.7.2-5) 4.7.2\n  gfortran --version: GNU Fortran (Debian 4.7.2-5) 4.7.2\n\n\n* Dell PowerEdge R710 (Intel Xeon, x86_64) running Debian linux 6.0.9 (squeeze)\n  uname -r (kernel version): 2.6.32-5-amd64\n  gcc --version: gcc (Debian 4.4.5-8) 4.4.5\n  gfortran --version: GNU Fortran (Debian 4.4.5-8) 4.4.5\n\n\n* Mac Mini (Intel Core 2 Duo) running MacOSX 10.6.8 (10K549)\n  uname -r (kernel version): 10.8.0\n  gcc --version: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1\n                 (Apple Inc. build 5666) (dot 3)\n  gfortran --version: GNU Fortran (GCC) 4.5.0 20100107 (experimental)\n  (Non-graphics tests only.)\n\n\nWCSLIB version 4.21 (2014/03/24)\n--------------------------------\n\n* Dell Latitude D620 (Intel Centrino, i686) running Debian linux 7.0 (wheezy)\n  uname -r (kernel version): 3.2.0-4-686-pae\n  gcc --version: gcc (Debian 4.7.2-5) 4.7.2\n  gfortran --version: GNU Fortran (Debian 4.7.2-5) 4.7.2\n\n\nWCSLIB version 4.20 (2013/12/18)\n--------------------------------\n\n* Dell Latitude D620 (Intel Centrino, i686) running Debian linux 7.0 (wheezy)\n  uname -r (kernel version): 3.2.0-4-686-pae\n  gcc --version: gcc (Debian 4.7.2-5) 4.7.2\n  gfortran --version: GNU Fortran (Debian 4.7.2-5) 4.7.2\n\n\nWCSLIB version 4.19 (2013/09/30)\n--------------------------------\n\n* Dell Latitude D620 (Intel Centrino, i686) running Debian linux 7.0 (wheezy)\n  uname -r (kernel version): 3.2.0-4-686-pae\n  gcc --version: gcc (Debian 4.7.2-5) 4.7.2\n  gfortran --version: GNU Fortran (Debian 4.7.2-5) 4.7.2\n\n\nWCSLIB version 4.18 (2013/07/12)\n--------------------------------\n\n* Dell Latitude D620 (Intel Centrino, i686) running Debian linux 7.0 (wheezy)\n  uname -r (kernel version): 3.2.0-4-686-pae\n  gcc --version: gcc (Debian 4.7.2-5) 4.7.2\n  gfortran --version: GNU Fortran (Debian 4.7.2-5) 4.7.2\n\n\nWCSLIB version 4.17 (2013/01/29)\n--------------------------------\n\n* Dell Latitude D620 (Intel Centrino, i686) running Debian linux 5.0.9 (lenny)\n  uname -r (kernel version): 2.6.26-2-686\n  gcc --version: gcc (Debian 4.3.2-1.1) 4.3.2\n  gfortran --version: GNU Fortran (Debian 4.3.2-1.1) 4.3.2\n\n\nWCSLIB version 4.15 (2012/09/26)\n--------------------------------\n\n* Dell Latitude D620 (Intel Centrino, i686) running Debian linux 5.0.9 (lenny)\n  uname -r (kernel version): 2.6.26-2-686\n  gcc --version: gcc (Debian 4.3.2-1.1) 4.3.2\n  gfortran --version: GNU Fortran (Debian 4.3.2-1.1) 4.3.2\n\n\nWCSLIB version 4.14 (2012/07/13)\n--------------------------------\n\n* Dell Latitude D620 (Intel Centrino, i686) running Debian linux 5.0.9 (lenny)\n  uname -r (kernel version): 2.6.26-2-686\n  gcc --version: gcc (Debian 4.3.2-1.1) 4.3.2\n  gfortran --version: GNU Fortran (Debian 4.3.2-1.1) 4.3.2\n\n\n* MacBook Pro (Intel Core 2 Duo) running MacOSX 10.7.3 (11D50)\n  uname -r (Darwin kernel version): 11.3.0\n  gcc --version: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1\n                 (Apple Inc. build 5658) (LLVM build 2336.1.00)\n  gfortran --version: GNU Fortran (GCC) 4.6.1\n  (Non-graphics tests only.)\n\n\nWCSLIB version 4.13.1 (2012/03/15)\n----------------------------------\n\n* Dell Latitude D630 (Intel Centrino, i686) running Debian linux 5.0.9 (lenny)\n  uname -r (kernel version): 2.6.32-bpo.5-686\n  gcc --version: gcc (Debian 4.3.2-1.1) 4.3.2\n  gfortran --version: GNU Fortran (Debian 4.3.2-1.1) 4.3.2\n\n\n* MacBook Pro (Intel Core 2 Duo) running MacOSX 10.7.3 (11D50)\n  uname -r (Darwin kernel version): 11.3.0\n  gcc --version: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1\n                 (Apple Inc. build 5658) (LLVM build 2336.1.00)\n  gfortran --version: GNU Fortran (GCC) 4.6.1\n  (Non-graphics tests only.)\n\n\nWCSLIB version 4.10 (2012/02/06)\n--------------------------------\n\n* Dell Latitude D630 (Intel Centrino, i686) running Debian linux 5.0.9 (lenny)\n  uname -r (kernel version): 2.6.32-bpo.5-686\n  gcc --version: gcc (Debian 4.3.2-1.1) 4.3.2\n  gfortran --version: GNU Fortran (Debian 4.3.2-1.1) 4.3.2\n\n\nWCSLIB version 4.8 (2011/08/15)\n-------------------------------\n\n* Dell Latitude D620 (Intel Centrino Duo, i686), Debian linux 4.0 (etch)\n  uname -r (kernel version): 2.6.24-1-686 (32-bit)\n  gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)\n  g77 --version: GNU Fortran (GCC) 3.4.6 (Debian 3.4.6-5)\n\n\n* Dell PowerEdge 2950 (Intel Xeon, 8 x X5460), Debian linux 5.0.8 (lenny)\n  uname -r (kernel version): 2.6.26-2-amd64 (64-bit)\n  gcc --version: gcc (Debian 4.3.2-1.1) 4.3.2\n  gfortran --version: GNU Fortran (Debian 4.3.2-1.1) 4.3.2\n\n\n* Marvell SheevaPlug (Feroceon 88FR131 rev 1 ARM v5L), Debian linux 6.0\n  (squeeze)\n  uname -r (kernel version): 2.6.32-5-kirkwood\n  gcc --version: gcc (Debian 4.4.5-8) 4.4.5\n  gfortran --version: GNU Fortran (Debian 4.4.5-8) 4.4.5\n\n\n* Mac mini (Intel Core 2 Duo) running MacOSX 10.6.2 (10C540)\n  uname -r (Darwin kernel version): 10.2.0\n  gcc --version: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1\n                 (Apple Inc. build 5646)\n  gfortran --version: GNU Fortran (GCC) 4.5.0 20100107 (experimental)\n\n\n* Enterprise 450 Model 2250 (Sparc, sun4u 64-bit), SunOS 5.9 (Solaris 9)\n  uname -r (SunOS version): 5.9\n  gcc --version: gcc (GCC) 4.5.1\n  gfortran --version: GNU Fortran (GCC) 4.5.1\n\n\nWCSLIB version 4.7 (2011/02/07)\n-------------------------------\n\n* Dell Latitude D630 (Intel Centrino, i686) running Debian linux 4.0 (etch)\n  uname -r (kernel version): 2.6.24-1-686\n  gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)\n  g77 --version: GNU Fortran (GCC) 3.4.6 (Debian 3.4.6-5)\n\n\n* Sun SunFire V20z (AMD Opteron, x86_64) running Debian linux 4.0 (etch)\n  uname -r (kernel version): 2.6.18-6-amd64\n  gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)\n  g77 --version: GNU Fortran (GCC) 3.4.6 (Debian 3.4.6-5)\n\n\n* Enterprise 450 Model 2250 (Sparc, sun4u 64-bit), SunOS 5.9 (Solaris 9)\n  uname -r (SunOS version): 5.9\n  gcc --version: gcc (GCC) 4.5.1\n  gfortran --version: GNU Fortran (GCC) 4.5.1\n\n    and\n\n  cc -V: cc: Sun WorkShop 6 update 2 C 5.3 Patch 111679-14 2004/02/20\n  f77 -V: f77: Sun WorkShop 6 update 2 FORTRAN 77 5.3 Patch 111691-07\n          2004/04/23\n\n\n* Mac Xserve (Quad-Core Intel Xeon) running MacOSX 10.6.5 (10H575)\n  uname -r (Darwin kernel version): 10.5.0\n  gcc --version: 4.2.1 (Apple Inc. build 5664)\n  gfortran --version: GNU Fortran (GCC) 4.5.0 20100107 (experimental)\n\n\n* Mac mini (Intel Core 2 Duo) running MacOSX 10.6.2 (10C540)\n  uname -r (Darwin kernel version): 10.2.0\n  gcc --version: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1\n                 (Apple Inc. build 5646)\n  gfortran --version: GNU Fortran (GCC) 4.5.0 20100107 (experimental)\n\n\n* Mac mini (Intel Core Duo) running MacOSX 10.4.9 (8P2137)\n  uname -r (Darwin kernel version): 8.9.1\n  gcc --version: gcc (GCC) 4.3.0 20070316 (experimental)\n  g77 --version: GNU Fortran (GCC) 3.4.0\n\n\nWCSLIB version 4.5 (2010/07/16)\n-------------------------------\n\n* Dell Latitude D630 (Intel Centrino, i686) running Debian linux 4.0 (etch)\n  uname -r (kernel version): 2.6.24-1-686\n  gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)\n  g77 --version: GNU Fortran (GCC) 3.4.6 (Debian 3.4.6-5)\n\n    and\n\n  gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)\n  ifort -V: Intel(R) Fortran Compiler for 32-bit applications, Version 8.1\n            Build 20041118Z Package ID: l_fc_pc_8.1.023\n\n\n* Mac mini (Intel Core 2 Duo, i386) running MacOSX 10.6.2 (10C540)\n  uname -r (Darwin kernel version): 10.2.0\n  gcc --version: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1\n                 (Apple Inc. build 5646)\n  gfortran --version: GNU Fortran (GCC) 4.5.0 20100107 (experimental)\n\n\n* Mac mini (Intel Core Duo, i386) running MacOSX 10.4.9 (8P2137)\n  uname -r (Darwin kernel version): 8.9.1\n  gcc --version: gcc (GCC) 4.3.0 20070316 (experimental)\n  g77 --version: GNU Fortran (GCC) 3.4.0\n\n    and\n\n  gcc --version: gcc (GCC) 4.3.0 20070316 (experimental)\n  gfortran --version: GNU Fortran (GCC) 4.3.0 20070316 (experimental)\n\n\n* Sun SunFire V20z (AMD Opteron, x86_64) running Debian linux 4.0 (etch)\n  uname -r (kernel version): 2.6.18-6-amd64\n  gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)\n  g77 --version: GNU Fortran (GCC) 3.4.6 (Debian 3.4.6-5)\n\n    and\n\n  gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)\n  gfortran --version: GNU Fortran 95 (GCC) 4.1.2 20061115 (prerelease)\n                      (Debian 4.1.1-21)\n\n\n* Sun Ultra-60 (Sparc, sun4u) running SunOS 5.6 (Solaris 2.6)\n  uname -r (SunOS version): 5.6\n  gcc --version: 2.95.3\n  g77 --version: GNU Fortran 0.5.25 20010315 (release)\n\n    and\n\n  cc -V: cc: Sun WorkShop 6 update 2 C 5.3 Patch 111679-14 2004/02/20\n  f77 -V: f77: Sun WorkShop 6 update 2 FORTRAN 77 5.3 Patch 111691-07\n          2004/04/23\n\n\n\nWCSLIB version 4.4 (2009/08/06)\n-------------------------------\n\n* Dell Latitude D630 (Intel Centrino, i686) running Debian linux 4.0 (etch)\n  uname -r (kernel version): 2.6.24-1-686\n  gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)\n  g77 --version: GNU Fortran (GCC) 3.4.6 (Debian 3.4.6-5)\n\n\n* Mac mini (Intel Core Duo, i386) running MacOSX 10.4.9 (8P2137)\n  uname -r (Darwin kernel version): 8.9.1\n  gcc --version: gcc (GCC) 4.3.0 20070316 (experimental)\n  g77 --version: GNU Fortran (GCC) 3.4.0\n\n    and\n\n  gcc --version: gcc (GCC) 4.3.0 20070316 (experimental)\n  gfortran --version: GNU Fortran (GCC) 4.3.0 20070316 (experimental)\n\n\n* Sun SunFire V20z (AMD Opteron, x86_64) running Debian linux 4.0 (etch)\n  uname -r (kernel version): 2.6.18-6-amd64\n  gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)\n  g77 --version: GNU Fortran (GCC) 3.4.6 (Debian 3.4.6-5)\n\n    and\n\n  gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)\n  gfortran --version: GNU Fortran 95 (GCC) 4.1.2 20061115 (prerelease)\n                      (Debian 4.1.1-21)\n\n\n* Sun SunBlade 1000 (Sparc, sun4u) running SunOS 5.8 (Solaris 2.8)\n  uname -r (SunOS version): 5.8\n  gcc --version: 2.95.3\n  g77 --version: GNU Fortran 0.5.25 20010315 (release)\n\n    and\n\n  cc -V: cc: Sun WorkShop 6 update 2 C 5.3 Patch 111679-14 2004/02/20\n  f77 -V: f77: Sun WorkShop 6 update 2 FORTRAN 77 5.3 Patch 111691-07\n          2004/04/23\n\n------------------------------------------------------------------------------\n$Id: VALIDATION,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n"},{"id":16555,"name":"makedefs.in","nodeType":"TextFile","path":"cextern/wcslib","text":"#-----------------------------------------------------------------------------\n# GNU makefile definitions for building WCSLIB 7.7\n#\n# makedefs is generated from makedefs.in by configure.  It contains variable\n# definitions and some general-purpose rules for building WCSLIB.\n#\n# Targets defined here\n# --------------------\n#   printenv:  Print the environment as seen within makefile rules.\n#   show:      Print the values of all makefile variables used.\n#\n# Notes:\n#   1) If you need to make changes then it may be preferable to modify\n#      makedefs.in (not makedefs).  The makefile will detect this and\n#      automatically re-run config.status to regenerate makedefs.\n#\n#   2) There are three choices for trigd functions - cosd(), sind(), tand(),\n#      acosd(), asind(), atand(), and atan2d(), made by setting WCSTRIG:\n#\n#      1: Use the wrapper functions supplied with WCSLIB (default):\n#         WCSTRIG := WRAPPER\n#\n#      2: Use native trigd functions supplied in a mathematics library such\n#         as libsunmath (you will also need to add the library to the LIBS\n#         variable below):\n#         WCSTRIG := NATIVE\n#\n#      3: Use C preprocessor macro implementations of the trigd functions\n#         (this method is typically 20% faster but may lead to rounding\n#         errors near the poles):\n#         WCSTRIG := MACRO\n#\n#   3) Variables for creating the shared (dynamic) library are currently\n#      only set by 'configure' if the GNU C compiler is used.  However,\n#      you can set these variables by hand, preferably in makedefs.in.\n#\n#      Shared libraries require position-independent code (PIC) which imposes\n#      a performance overhead.  Consequently the static libraries are\n#      compiled separately without this option.\n#\n#      The shared library will be installed with version number, e.g. as\n#      libwcs.so.7.7 or libwcs.7.7.dylib with or without the symlink\n#      required to make it visible to the linker (controlled by the SHRLN\n#      variable).  On Macs it is deliberately not created because its very\n#      existence precludes static linking with the cctools linker.  You can\n#      still link dynamically by using -lwcs.7.7.\n#\n#   4) PGPLOT is Tim Pearson's Fortran graphics library with separate C\n#      interface available from astro.caltech.edu.  It is only required by\n#      one utility, wcsgrid, and the test programs that plot test grids\n#      (tprj2, tcel1, tcel2, tspc, ttab2, ttab3, twcsmix, and tpih2).  You can\n#      skip these by setting PGPLOTLIB to blank.\n#\n#      It is difficult for configure to deduce what auxiliary graphics\n#      libraries may be needed for PGPLOT since it depends on which of many\n#      possible graphics drivers were selected when PGPLOT was installed.\n#      Therefore it is quite likely that you will need to add additional\n#      libraries to PGPLOTLIB.\n#\n#   5) CFITSIO is Bill Pence's FITS I/O library written in C with Fortran\n#      wrappers, available from http://heasarc.gsfc.nasa.gov/fitsio.\n#\n#      CFITSIO is required by three utilities, HPXcvt, wcsgrid, and wcsware,\n#      and also by the test programs twcstab and twcshdr.  wcsware and the\n#      test programs use fits_read_wcstab() which is implemented by\n#      getwcstab.c.  However, this implementation is included in CFITSIO post\n#      3.004beta, so getwcstab.c is required here only for older releases\n#      (controlled by variable GETWCSTAB).  getwcstab.o itself is not inserted\n#      into the WCSLIB object library.\n#\n#      If available, CFITSIO is also optionally used for test programs\n#      tfitshdr, tbth1, tpih1 and tpih2 by setting preprocessor macro\n#      -DDO_CFITSIO.\n#\n# Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n# http://www.atnf.csiro.au/people/Mark.Calabretta\n# $Id: makedefs.in,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n#-----------------------------------------------------------------------------\n# Version.\n  LIBVER    := @LIBVER@\n  WCSLIBPKG := wcslib-@PACKAGE_VERSION@\n\n# Additional options for GNU make added by configure.\n  MAKEFLAGS += @MAKEFLAGS@\n\n# System architecture.\n  ARCH     := @ARCH@\n\n# Flex and options.\n  FLEX     := @FLEX@\n  FLFLAGS  := @FLFLAGS@\n\n# C preprocessor and options.\n  CPP      := @CPP@\n  CPPFLAGS := @CPPFLAGS@ @DEFS@\n  WCSTRIG  := WRAPPER\n\n# C compiler and options.\n  CC       := @CC@\n  CFLAGS   := @CFLAGS@\n\n# Fortran compiler and options.\n  FC       := @F77@\n  FFLAGS   := @FFLAGS@\n\n# Static object library.\n  WCSLIB   := libwcs-$(LIBVER).a\n  ARFLAGS  := @ARFLAGS@\n  RANLIB   := @RANLIB@\n\n# Shared (dynamic) library (see note 3 above).\n  SHRLIB   := @SHRLIB@\n  SONAME   := @SONAME@\n  SHRFLAGS := @SHRFLAGS@\n  SHRLD    := @SHRLD@\n  SHRLN    := @SHRLN@\n\n# What subdirectories to build.\n  SUBDIRS  := @SUBDIRS@\n  TSTDIRS  := @TSTDIRS@\n\n# Top of the 'make install' hierarchy: pgsbox -> Fortran -> C.\n  INSTDIR  := @INSTDIR@\n\n# Installation utilities and locations.\n  LN_S     := @LN_S@\n  INSTALL  := @INSTALL@\n\n  # Needed for the definitions provided by autoconf.\n  prefix          := @prefix@\n  exec_prefix     := @exec_prefix@\n  datarootdir     := @datarootdir@\n  PACKAGE_TARNAME := @PACKAGE_TARNAME@\n  docdir          := @docdir@\n\n  LIBDIR   := $(DESTDIR)@libdir@\n  BINDIR   := $(DESTDIR)@bindir@\n  INCDIR   := $(DESTDIR)@includedir@/wcslib-$(LIBVER)\n  INCLINK  := $(DESTDIR)@includedir@/wcslib\n  DOCDIR   := $(DESTDIR)@docdir@\n  DOCLINK  := $(dir $(DESTDIR)@docdir@)wcslib\n  HTMLDIR  := $(DESTDIR)@htmldir@\n  PDFDIR   := $(DESTDIR)@pdfdir@\n  MANDIR   := $(DESTDIR)@mandir@\n\n# For putting timestamps in the build log.\n  TIMER    := date +\"%a %Y/%m/%d %X %z, executing on $$HOST\"\n\n\n# The remaining options are for building utilities and test programs.\n# -------------------------------------------------------------------\n# Linker options (use CC for linking).\n  LD       = $(CC)\n  LDFLAGS := @LDFLAGS@\n\n# PGPLOT (see note 4 above).\n  PGPLOTINC := @PGPLOTINC@\n  PGPLOTLIB := @PGPLOTLIB@\n\n# CFITSIO (see note 5 above).\n  CFITSIOINC := @CFITSIOINC@\n  CFITSIOLIB := @CFITSIOLIB@\n  GETWCSTAB  := @GETWCSTAB@\n\n# Libraries required by the above Fortran compiler.\n  FLIBS := @FLIBS@\n\n# Libraries required by WCSLIB itself.\n  LIBS := @LIBS@\n\n# Default observer coordinates for sundazel.  May be set as environment\n# variables, either generally or in $HOME/.sundazelrc, which is read by\n# configure.\n  OBSLNG := @OBSLNG@\n  OBSLAT := @OBSLAT@\n  OBSTZ  := @OBSTZ@\n\n#-----------------------------------------------------------------------------\n# You shouldn't need to change anything below here.\n#-----------------------------------------------------------------------------\n\nSHELL := /bin/sh\nVPATH := ..\n\n# Common targets.\n.PHONY : all build FORCE printenv show\n\nall : show\n\t-@ echo ''\n\t @ $(MAKE) build\n\nFORCE :\n\n# Print the environment as seen by makefile rules.\nprintenv :\n\t-@ printenv | sort\n\n# Print variable definitions.\nshow :: wcsconfig.h\n\t-@ echo ''\n\t-@ uname -a\n\t-@ echo ''\n\t-@ $(MAKE) --version | head -1\n\t-@ echo '  SUBDIR      := $(SUBDIR)'\n\t-@ echo '  MAKEFLAGS   := $(MAKEFLAGS)'\n\t-@ echo ''\n\t-@ echo 'For building and installing $(WCSLIBPKG)...'\n\t-@ echo '  ARCH        := $(ARCH)'\n\t-@ echo '  FLEX        := $(FLEX)'\n\t-@ echo '  FLFLAGS     := $(FLFLAGS)'\n\t-@ echo '  CPP         := $(CPP)'\n\t-@ echo '  CPPFLAGS    := $(CPPFLAGS)'\n\t-@ echo '  WCSTRIG     := $(WCSTRIG)'\n\t-@ echo '  CC          := $(CC)'\n\t-@ echo '  CFLAGS      := $(CFLAGS)'\n\t-@ echo '  FC          := $(FC)'\n\t-@ echo '  FFLAGS      := $(FFLAGS)'\n\t-@ echo '  WCSLIB      := $(WCSLIB)'\n\t-@ echo '  ARFLAGS     := $(ARFLAGS)'\n\t-@ echo '  RANLIB      := $(RANLIB)'\n\t-@ echo '  SHRLIB      := $(SHRLIB)'\n\t-@ echo '  SONAME      := $(SONAME)'\n\t-@ echo '  SHRFLAGS    := $(SHRFLAGS)'\n\t-@ echo '  SHRLD       := $(SHRLD)'\n\t-@ echo '  SHRLN       := $(SHRLN)'\n\t-@ echo '  LN_S        := $(LN_S)'\n\t-@ echo '  INSTALL     := $(INSTALL)'\n\t-@ echo '  LIBDIR      := $(LIBDIR)'\n\t-@ echo '  BINDIR      := $(BINDIR)'\n\t-@ echo '  INCDIR      := $(INCDIR)'\n\t-@ echo '  INCLINK     := $(INCLINK)'\n\t-@ echo '  DOCDIR      := $(DOCDIR)'\n\t-@ echo '  DOCLINK     := $(DOCLINK)'\n\t-@ echo '  HTMLDIR     := $(HTMLDIR)'\n\t-@ echo '  PDFDIR      := $(PDFDIR)'\n\t-@ echo '  MANDIR      := $(MANDIR)'\n\t-@ echo '  TIMER       := $(TIMER)'\n\t-@ echo ''\n\t-@ echo 'Important wcsconfig.h defines...'\n\t-@ echo \"  `grep HAVE_SINCOS $<`\"\n\t-@ echo \"  `grep WCSLIB_INT64 $<`\"\n\t-@ echo ''\n\t-@ echo 'To build utilities and test programs...'\n\t-@ echo '  LD          := $(LD)'\n\t-@ echo '  LDFLAGS     := $(LDFLAGS)'\n\t-@ echo '  PGPLOTINC   := $(PGPLOTINC)'\n\t-@ echo '  PGPLOTLIB   := $(PGPLOTLIB)'\n\t-@ echo '  CFITSIOINC  := $(CFITSIOINC)'\n\t-@ echo '  CFITSIOLIB  := $(CFITSIOLIB)'\n\t-@ echo '  GETWCSTAB   := $(GETWCSTAB)'\n\t-@ echo '  FLIBS       := $(FLIBS)'\n\t-@ echo '  LIBS        := $(LIBS)'\n\t-@ echo ''\n\t-@ echo 'Default observer coordinates for sundazel...'\n\t-@ echo '  OBSLNG      := $(OBSLNG)'\n\t-@ echo '  OBSLAT      := $(OBSLAT)'\n\t-@ echo '  OBSTZ       := $(OBSTZ)'\n\t-@ echo ''\n\n# Code development overrides, for use in the code subdirectories.\nFLAVOUR := @FLAVOUR@\n-include ../flavours\n"},{"id":16556,"name":"GNUmakefile","nodeType":"TextFile","path":"cextern/wcslib","text":"#-----------------------------------------------------------------------------\n# GNU makefile for building WCSLIB 7.7\n#\n# Summary of the main targets\n# ---------------------------\n#   all:       Do 'make all' in each subdirectory (excluding ./doxygen).\n#   check:     Do 'make check' in each subdirectory (compile and run tests).\n#   tests:     Do 'make tests' in each subdirectory (compile test programs but\n#              don't run them).\n#   install:   Do 'make install' in each subdirectory.\n#   uninstall: Deletes installed files (this release only), including the\n#              sharable library.\n#   clean:     Recursively delete intermediate files produced as part of the\n#              build, e.g. object modules, core dumps, etc.\n#   cleaner:   Recursively clean, and also delete test executables, test\n#              input and output, and intermediates produced in compiling the\n#              programmers' manual.\n#   distclean (or realclean): Recursively delete all platform-dependent files\n#              generated during the build, preserving only the programmers'\n#              manual and man pages (which are normally provided pre-built).\n#              It is the one to use between builds for multiple platforms.\n#   cleanest:  Like distclean, but deletes everything that can be regenerated\n#              from the source files, including the programmers' manual and\n#              man pages, but excluding 'configure'.\n#   show:      Print the values of important variables used in this and the\n#              other makefiles.\n#   writable:  Run chmod recursively to make all sources writable.\n#\n# Notes:\n#   1) If you need to make changes then preferably modify makedefs.in instead.\n#\n#   2) Refer also to the makefiles in subdirectories, particularly\n#      C/GNUmakefile.\n#\n# Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n# http://www.atnf.csiro.au/people/Mark.Calabretta\n# $Id: GNUmakefile,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n#-----------------------------------------------------------------------------\n# Get configure settings.\nSUBDIR := .\ninclude makedefs\n\nifeq \"$(CHECK)\" \"nopgplot\"\n  TSTDIRS := $(filter-out pgsbox,$(TSTDIRS))\nendif\n\n.PHONY : build check chmod clean cleaner cleanest distclean install \\\n         realclean show tests uninstall writable\n\nbuild :\n\t-@ for DIR in $(SUBDIRS) ; do \\\n\t     echo '' ; \\\n\t     $(TIMER) ; \\\n\t     $(MAKE) -k -C $$DIR build ; \\\n\t   done\n\ncheck tests :: show\n\t-@ echo ''\n\t-@ $(TIMER)\n\t @ for DIR in $(SUBDIRS) ; do \\\n\t     echo '' ; \\\n\t     $(MAKE) -i -C $$DIR cleaner build ; \\\n\t   done\n\t-@ echo ''\n\t @ for DIR in $(TSTDIRS) ; do \\\n\t     echo '' ; \\\n\t     $(TIMER) ; \\\n\t     $(MAKE) -k -C $$DIR $@ ; \\\n\t   done\n\ncheck ::\n\t-@ echo ''\n\t-@ echo 'Summary of results for non-graphical tests'\n\t-@ echo '------------------------------------------'\n\t-@ cat ./*/test_results\n\t @ if grep 'FAIL:' ./*/test_results > /dev/null ; then \\\n\t     exit 1 ; \\\n\t   else \\\n\t     exit 0 ; \\\n\t   fi\n\ninstall :\n\t @ for DIR in $(INSTDIR) ; do \\\n\t     $(MAKE) -k -C $$DIR $@ ; \\\n\t   done\n\t   if [ ! -d \"$(LIBDIR)/pkgconfig\" ] ; then \\\n\t     $(INSTALL) -d -m 775 $(LIBDIR)/pkgconfig ; \\\n\t   fi\n\t   $(INSTALL) -m 444 wcslib.pc $(LIBDIR)/pkgconfig/wcslib.pc\n\t   $(INSTALL) -m 444 wcsconfig.h wcsconfig_f77.h $(INCDIR)\n\t-  if [ ! -d \"$(DOCDIR)\" ] ; then \\\n\t     $(INSTALL) -d -m 775 $(DOCDIR) ; \\\n\t   fi\n\t   $(INSTALL) -m 444 CHANGES COPYING* README $(DOCDIR)\n\t-  if [ -h $(DOCLINK) ] ; then \\\n\t     $(RM) $(DOCLINK) ; \\\n\t     $(LN_S) $(notdir $(DOCDIR)) $(DOCLINK) ; \\\n\t   fi\n\t-  if [ ! -d \"$(PDFDIR)\" ] ; then \\\n\t     $(INSTALL) -d -m 775 $(PDFDIR) ; \\\n\t   fi\n\t   $(INSTALL) -m 444 wcslib.pdf $(PDFDIR)\n\t-  if [ ! -d \"$(HTMLDIR)/html\" ] ; then \\\n\t     $(INSTALL) -d -m 775 $(HTMLDIR)/html ; \\\n\t   fi\n\t   $(INSTALL) -m 444 html/* $(HTMLDIR)/html\n\nuninstall :\n\t @ for DIR in $(INSTDIR) ; do \\\n\t     $(MAKE) -k -C $$DIR $@ ; \\\n\t   done\n\t-  cd $(LIBDIR) && $(RM) pkgconfig/wcslib.pc\n\t-  cd $(INCDIR) && $(RM) wcsconfig*.h\n\t-  $(RM) $(DOCLINK)\n\t-  $(RM) $(DOCDIR)\n\t-  $(RM) $(PDFDIR)\n\t-  $(RM) $(HTMLDIR)\n\nclean cleaner :\n\t   for DIR in $(SUBDIRS) doxygen ; do \\\n\t     $(MAKE) -C $$DIR $@ ; \\\n\t   done\n\ncleanest distclean realclean :\n\t   for DIR in $(SUBDIRS) doxygen ; do \\\n\t     $(MAKE) -C $$DIR $@ ; \\\n\t   done\n\t-  $(RM) *.log\n\t-  $(RM) -r autom4te.cache autoscan.log\n\t-  $(RM) -r api-sanity-check\n\t-  $(RM) confdefs.h conftest.*\n\t-  $(RM) config.log config.status configure.lineno\n\t-  $(RM) makedefs wcslib.pc\n\t-  $(RM) wcsconfig.h wcsconfig_*.h\n\t-  $(RM) wcslib-*.tar.gz\n\nshow ::\n\t-@ echo 'Subdirectories to be built...'\n\t-@ echo '  SUBDIRS     := $(SUBDIRS)'\n\t-@ echo '  TSTDIRS     := $(TSTDIRS)'\n\t-@ echo ''\n\nwritable :\n\t  chmod -R u+w .\n\nGNUmakefile : makedefs ;\n\nmakedefs : makedefs.in config.status\n\t-@ echo ''\n\t-@ $(TIMER)\n\t   ./config.status\n\nconfig.status : configure\n\t-@ echo ''\n\t-@ $(TIMER)\n\t-@ echo ''\n\t-@ echo \"Environment variables that affect 'configure':\"\n\t-@ echo \"  FLEX     = $${FLEX-(undefined)}\"\n\t-@ echo \"  FLFLAGS  = $${FLFLAGS-(undefined)}\"\n\t-@ echo \"  CPP      = $${CPP-(undefined)}\"\n\t-@ echo \"  CPPFLAGS = $${CPPFLAGS-(undefined)}\"\n\t-@ echo \"  CC       = $${CC-(undefined)}\"\n\t-@ echo \"  CFLAGS   = $${CFLAGS-(undefined)}\"\n\t-@ echo \"  F77      = $${F77-(undefined)}\"\n\t-@ echo \"  FFLAGS   = $${FFLAGS-(undefined)}\"\n\t-@ echo \"  ARFLAGS  = $${ARFLAGS-(undefined)}\"\n\t-@ echo \"  LDFLAGS  = $${LDFLAGS-(undefined)}\"\n\t-@ echo ''\n\t   ./configure --no-create\n\n\n#-----------------------------------------------------------------------------\n# These are for code management.\n\n.PHONY : dist\n\ndist :\n\t   $(MAKE) -C doxygen cleanest build\n\t   $(MAKE) -C utils man\n\t   $(MAKE) distclean\n\t-@ echo $(WCSLIBPKG)/C/RCS        >  wcslib.X\n\t-@ echo $(WCSLIBPKG)/C/flexed/RCS >> wcslib.X\n\t-@ echo $(WCSLIBPKG)/C/test/RCS   >> wcslib.X\n\t-@ echo $(WCSLIBPKG)/doxygen/RCS  >> wcslib.X\n\t-@ echo $(WCSLIBPKG)/Fortran/RCS  >> wcslib.X\n\t-@ echo $(WCSLIBPKG)/Fortran/test/RCS >> wcslib.X\n\t-@ echo $(WCSLIBPKG)/makedefs     >> wcslib.X\n\t-@ echo $(WCSLIBPKG)/other        >> wcslib.X\n\t-@ echo $(WCSLIBPKG)/pgsbox/RCS   >> wcslib.X\n\t-@ echo $(WCSLIBPKG)/RCS          >> wcslib.X\n\t-@ echo $(WCSLIBPKG)/TODO         >> wcslib.X\n\t-@ echo $(WCSLIBPKG)/utils/RCS    >> wcslib.X\n\t-@ echo $(WCSLIBPKG)/wcslib.T     >> wcslib.X\n\t-@ echo $(WCSLIBPKG)/wcslib.X     >> wcslib.X\n\t   rm -f $(WCSLIBPKG).tar.bz2\n\t   tar cf - -C .. -X wcslib.X $(WCSLIBPKG) | \\\n\t     tar t | \\\n\t     grep -v '/$$' | \\\n\t     sort > wcslib.T\n\t   rm -f wcslib.X\n\t   tar cvf $(WCSLIBPKG).tar -C .. -T wcslib.T\n\t   rm -f wcslib.T\n\t   bzip2 $(WCSLIBPKG).tar\n\t   chmod 444 $(WCSLIBPKG).tar.bz2\n\ninstall_dist :\n\t   scp -p $(WCSLIBPKG).tar.bz2 cal103@venice:/nfs/ftp/software/wcslib/\n\t   mv -f  $(WCSLIBPKG).tar.bz2 ../wcslib-releases/\n\t   ssh cal103@venice \"cd /nfs/ftp/software/wcslib/ && \\\n\t     rm -f wcslib.tar.bz2 && \\\n\t     ln -s $(WCSLIBPKG).tar.bz2 wcslib.tar.bz2\"\n\t   cp -fp CHANGES wcslib.pdf ~/public_html/WCS/\n\t   rsync --archive --delete html/ ~/public_html/WCS/wcslib/\n\nconfigure : configure.ac\n\t-@ echo ''\n\t-@ $(TIMER)\n\t   autoconf\n\n# Code development overrides must be included specifically before 'configure'\n# generates makedefs.\n-include flavours\n"},{"id":16557,"name":"INSTALL","nodeType":"TextFile","path":"cextern/wcslib","text":"------------------------------------------------------------------------------\nWCSLIB 7.7 and PGSBOX 7.7 INSTALLATION\n--------------------------------------\n\nWCSLIB requires an ANSI C compiler with standard ANSI C environment, that is,\na standard C library and header files as defined in Appendix B of Kernigan &\nRitchie, 2nd ed.\n\nIf you are running a typical Linux distro and have installed WCSLIB before,\nthen all you should need to do is\n\n  tar pxvf wcslib-7.7.tar.bz2\n  cd wcslib-7.7\n  make install\n\nOtherwise, read on.\n\nInstallation of WCSLIB is handled by GNU autoconf; GNU make (referred to here\nas 'gmake') must be used.  The WCSLIB distribution also includes PGSBOX (refer\nto the README file).  To unpack the tar file, type\n\n  bzcat wcslib-7.7.tar.bz2 | tar pvxf -\n  cd wcslib-7.7\n\nthen if you do not need to specify any configuration options, simply run\n\n  gmake\n\nThis will run 'configure' to generate \"makedefs\" which is included by the top-\nlevel GNUmakefile and those in each subdirectory, and then build 'libwcs.a',\nwhich includes both the C library and Fortran wrappers, and also libpgsbox.a.\n\n(WARNING: The build may fail with gmake 3.79, upgrade to 3.79.1 or later.)\n\nconfigure tries to determine the location of the PGPLOT and CFITSIO libraries\nrequired by some utilities (wcsware, wcsgrid) and programs in the test suite.\nIf it fails to find them you can, if you wish, tailor the few variables found\nat the start of \"makedefs\".  Of course you do not need to exercise the test\nsuite in order to build and install the library - if configure fails to find\nanything required for that it will issue an explicit error message.\n\nTo build and exercise the test suite use\n\n  gmake check\n\nTo install the object libraries and header files, do\n\n  gmake install\n\n\nTWEAKING THE INSTALLATION DEFAULTS\n----------------------------------\n\nBy default the library and header files are installed in the lib and include\nsubdirectories of /usr/local/.  To change this, or any other options, run\nconfigure separately before gmake:\n\n  ./configure --prefix=/some/other/dir\n  gmake\n\nUse\n\n  ./configure --help\n\nto list configure's options.  Useful options are\n\n  --with-pgplotinc\n  --with-pgplotlib\n  --with-cfitsioinc\n  --with-cfitsiolib\n\nWhich allow additional directories to be added to the library and include\nfile search path.\n\nInstallation of WCSLIB differs a little from most packages in that all\nconfigurable makefile variables are defined in a single file, \"makedefs\",\nwhich configure generates from \"makedefs.in\".  If you need to redefine any of\nthe makefile variables you can modify makedefs, or preferably makedefs.in.\nThe makefile will automatically detect this and re-run config.status to\nre-generate a new makedefs.  configure also creates four header files:\n\n  wcsconfig.h: Contains general purpose preprocessor definitions.  It is\n    included by the other wcsconfig header files.\n\n  wcsconfig_f77.h: By common convention the WCSLIB Fortran wrappers have\n    been written (in C) using function names in lower case with an\n    underscore (\"_\") suffix.  wcsconfig_f77.h defines a preprocessor macro,\n    F77_FUNC(name,NAME), that may redefine these to suit different name\n    mangling schemes used by some Fortran compilers.\n\n  wcsconfig_tests.h: Contains C preprocessor definitions for compiling the\n    test/demo programs.\n\n  wcsconfig_utils.h: Contains C preprocessor macro definitions for compiling\n    the utility programs provided with WCSLIB.\n\nIf you do have trouble building the library please send me config.log.\n\n\nThe INSTALL file provided with GNU autoconf 2.53 is appended without change.\n\n\nAuthor: Mark Calabretta, Australia Telescope National Facility, CSIRO.\nhttp://www.atnf.csiro.au/people/Mark.Calabretta\n$Id: INSTALL,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n\n==============================================================================\n\nCopyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software\nFoundation, Inc.\n\n   This file is free documentation; the Free Software Foundation gives\nunlimited permission to copy, distribute and modify it.\n\nBasic Installation\n==================\n\n   These are generic installation instructions.\n\n   The `configure' shell script attempts to guess correct values for\nvarious system-dependent variables used during compilation.  It uses\nthose values to create a `Makefile' in each directory of the package.\nIt may also create one or more `.h' files containing system-dependent\ndefinitions.  Finally, it creates a shell script `config.status' that\nyou can run in the future to recreate the current configuration, and a\nfile `config.log' containing compiler output (useful mainly for\ndebugging `configure').\n\n   It can also use an optional file (typically called `config.cache'\nand enabled with `--cache-file=config.cache' or simply `-C') that saves\nthe results of its tests to speed up reconfiguring.  (Caching is\ndisabled by default to prevent problems with accidental use of stale\ncache files.)\n\n   If you need to do unusual things to compile the package, please try\nto figure out how `configure' could check whether to do them, and mail\ndiffs or instructions to the address given in the `README' so they can\nbe considered for the next release.  If you are using the cache, and at\nsome point `config.cache' contains results you don't want to keep, you\nmay remove or edit it.\n\n   The file `configure.ac' (or `configure.in') is used to create\n`configure' by a program called `autoconf'.  You only need\n`configure.ac' if you want to change it or regenerate `configure' using\na newer version of `autoconf'.\n\nThe simplest way to compile this package is:\n\n  1. `cd' to the directory containing the package's source code and type\n     `./configure' to configure the package for your system.  If you're\n     using `csh' on an old version of System V, you might need to type\n     `sh ./configure' instead to prevent `csh' from trying to execute\n     `configure' itself.\n\n     Running `configure' takes awhile.  While running, it prints some\n     messages telling which features it is checking for.\n\n  2. Type `make' to compile the package.\n\n  3. Optionally, type `make check' to run any self-tests that come with\n     the package.\n\n  4. Type `make install' to install the programs and any data files and\n     documentation.\n\n  5. You can remove the program binaries and object files from the\n     source code directory by typing `make clean'.  To also remove the\n     files that `configure' created (so you can compile the package for\n     a different kind of computer), type `make distclean'.  There is\n     also a `make maintainer-clean' target, but that is intended mainly\n     for the package's developers.  If you use it, you may have to get\n     all sorts of other programs in order to regenerate files that came\n     with the distribution.\n\nCompilers and Options\n=====================\n\n   Some systems require unusual options for compilation or linking that\nthe `configure' script does not know about.  Run `./configure --help'\nfor details on some of the pertinent environment variables.\n\n   You can give `configure' initial values for variables by setting\nthem in the environment.  You can do that on the command line like this:\n\n     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix\n\n   *Note Defining Variables::, for more details.\n\nCompiling For Multiple Architectures\n====================================\n\n   You can compile the package for more than one kind of computer at the\nsame time, by placing the object files for each architecture in their\nown directory.  To do this, you must use a version of `make' that\nsupports the `VPATH' variable, such as GNU `make'.  `cd' to the\ndirectory where you want the object files and executables to go and run\nthe `configure' script.  `configure' automatically checks for the\nsource code in the directory that `configure' is in and in `..'.\n\n   If you have to use a `make' that does not support the `VPATH'\nvariable, you have to compile the package for one architecture at a\ntime in the source code directory.  After you have installed the\npackage for one architecture, use `make distclean' before reconfiguring\nfor another architecture.\n\nInstallation Names\n==================\n\n   By default, `make install' will install the package's files in\n`/usr/local/bin', `/usr/local/man', etc.  You can specify an\ninstallation prefix other than `/usr/local' by giving `configure' the\noption `--prefix=PATH'.\n\n   You can specify separate installation prefixes for\narchitecture-specific files and architecture-independent files.  If you\ngive `configure' the option `--exec-prefix=PATH', the package will use\nPATH as the prefix for installing programs and libraries.\nDocumentation and other data files will still use the regular prefix.\n\n   In addition, if you use an unusual directory layout you can give\noptions like `--bindir=PATH' to specify different values for particular\nkinds of files.  Run `configure --help' for a list of the directories\nyou can set and what kinds of files go in them.\n\n   If the package supports it, you can cause programs to be installed\nwith an extra prefix or suffix on their names by giving `configure' the\noption `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.\n\nOptional Features\n=================\n\n   Some packages pay attention to `--enable-FEATURE' options to\n`configure', where FEATURE indicates an optional part of the package.\nThey may also pay attention to `--with-PACKAGE' options, where PACKAGE\nis something like `gnu-as' or `x' (for the X Window System).  The\n`README' should mention any `--enable-' and `--with-' options that the\npackage recognizes.\n\n   For packages that use the X Window System, `configure' can usually\nfind the X include and library files automatically, but if it doesn't,\nyou can use the `configure' options `--x-includes=DIR' and\n`--x-libraries=DIR' to specify their locations.\n\nSpecifying the System Type\n==========================\n\n   There may be some features `configure' cannot figure out\nautomatically, but needs to determine by the type of machine the package\nwill run on.  Usually, assuming the package is built to be run on the\n_same_ architectures, `configure' can figure that out, but if it prints\na message saying it cannot guess the machine type, give it the\n`--build=TYPE' option.  TYPE can either be a short name for the system\ntype, such as `sun4', or a canonical name which has the form:\n\n     CPU-COMPANY-SYSTEM\n\nwhere SYSTEM can have one of these forms:\n\n     OS KERNEL-OS\n\n   See the file `config.sub' for the possible values of each field.  If\n`config.sub' isn't included in this package, then this package doesn't\nneed to know the machine type.\n\n   If you are _building_ compiler tools for cross-compiling, you should\nuse the `--target=TYPE' option to select the type of system they will\nproduce code for.\n\n   If you want to _use_ a cross compiler, that generates code for a\nplatform different from the build platform, you should specify the\n\"host\" platform (i.e., that on which the generated programs will\neventually be run) with `--host=TYPE'.\n\nSharing Defaults\n================\n\n   If you want to set default values for `configure' scripts to share,\nyou can create a site shell script called `config.site' that gives\ndefault values for variables like `CC', `cache_file', and `prefix'.\n`configure' looks for `PREFIX/share/config.site' if it exists, then\n`PREFIX/etc/config.site' if it exists.  Or, you can set the\n`CONFIG_SITE' environment variable to the location of the site script.\nA warning: not all `configure' scripts look for a site script.\n\nDefining Variables\n==================\n\n   Variables not defined in a site shell script can be set in the\nenvironment passed to `configure'.  However, some packages may run\nconfigure again during the build, and the customized values of these\nvariables may be lost.  In order to avoid this problem, you should set\nthem in the `configure' command line, using `VAR=value'.  For example:\n\n     ./configure CC=/usr/local2/bin/gcc\n\nwill cause the specified gcc to be used as the C compiler (unless it is\noverridden in the site shell script).\n\n`configure' Invocation\n======================\n\n   `configure' recognizes the following options to control how it\noperates.\n\n`--help'\n`-h'\n     Print a summary of the options to `configure', and exit.\n\n`--version'\n`-V'\n     Print the version of Autoconf used to generate the `configure'\n     script, and exit.\n\n`--cache-file=FILE'\n     Enable the cache: use and save the results of the tests in FILE,\n     traditionally `config.cache'.  FILE defaults to `/dev/null' to\n     disable caching.\n\n`--config-cache'\n`-C'\n     Alias for `--cache-file=config.cache'.\n\n`--quiet'\n`--silent'\n`-q'\n     Do not print messages saying which checks are being made.  To\n     suppress all normal output, redirect it to `/dev/null' (any error\n     messages will still be shown).\n\n`--srcdir=DIR'\n     Look for the package's source code in directory DIR.  Usually\n     `configure' can determine that directory automatically.\n\n`configure' also accepts some other, not widely useful, options.  Run\n`configure --help' for more details.\n\n"},{"id":16558,"name":"wcsconfig.h.in","nodeType":"TextFile","path":"cextern/wcslib","text":"/*============================================================================\n*\n* wcsconfig.h is generated from wcsconfig.h.in by 'configure'.  It contains\n* C preprocessor macro definitions for compiling WCSLIB 7.7\n*\n* Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n* http://www.atnf.csiro.au/people/Mark.Calabretta\n* $Id: wcsconfig.h.in,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n/* wcslib_version() is available (as of 5.0). */\n#define HAVE_WCSLIB_VERSION\n\n/* WCSLIB library version number. */\n#undef WCSLIB_VERSION\n\n/* Define to 1 if sincos() is available. */\n#undef HAVE_SINCOS\n\n/* 64-bit integer data type. */\n#undef WCSLIB_INT64\n"},{"id":16559,"name":"configure.ac","nodeType":"TextFile","path":"cextern/wcslib","text":"#-----------------------------------------------------------------------------\n# Process this file with autoconf-2.53 or later to produce a configure script.\n#-----------------------------------------------------------------------------\n# Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n# http://www.atnf.csiro.au/people/Mark.Calabretta\n# $Id: configure.ac,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n#-----------------------------------------------------------------------------\n\nAC_INIT([WCSLIB], [7.7], [mark@calabretta.id.au], [wcslib-7.7])\nAC_PREREQ([2.53])\nAC_REVISION([$Revision: 7.7 $])\nAC_SUBST([PACKAGE_VERSION])\nAC_DEFINE_UNQUOTED([WCSLIB_VERSION], [$PACKAGE_VERSION], [Define wcslib version])\n\n# Library version number, same as package version.\nLIBVER=\"$PACKAGE_VERSION\"\nAC_SUBST([LIBVER])\n\nAC_CONFIG_SRCDIR([C/wcs.h])\nAC_CONFIG_AUX_DIR([config])\n\n# Get the system type.\nAC_CANONICAL_HOST\nARCH=\"${host_cpu}-$host_os\"\nAC_SUBST([ARCH])\n\n\n# Look for Flex.\nAC_ARG_ENABLE([flex], [AS_HELP_STRING([--disable-flex],\n            [don't apply flex (use pre-generated sources)])], [])\nif test \"x$enable_flex\" = xno ; then\n  FLEX=\n  AC_MSG_WARN([Generation of flex sources disabled by request, using\n           pre-generated sources.])\n\nelse\n  AC_CHECK_PROG([FLEX], [flex], [flex], [], [], [])\n  if test \"x$FLEX\" = xflex ; then\n    # Version 2.6.0 or later is required.\n    V=`flex --version | awk '{print $2}'`\n    W=`echo $V | awk -F. '{if ((($1*100 + $2)*100 + $3) < 20600) print \"no\"}'`\n    if test \"x$W\" != x ; then\n      AC_MSG_WARN([Flex version $V is too old, ignored.])\n      FLEX=\n    else\n      AC_MSG_NOTICE([Using Flex version $V.])\n    fi\n  fi\n\n  if test \"x$FLEX\" = x ; then\n    AC_MSG_WARN([Flex version 2.6.0 or later does not appear to be\n           available, will use pre-generated sources.])\n  fi\nfi\n\n\n# Look for an ANSI C compiler.\nAC_PROG_CPP\nAC_PROG_CC\nAC_PROG_CC_STDC\nAC_C_CONST\nAC_TYPE_SIZE_T\nif test \"x$ac_cv_prog_cc_stdc\" = xno -o \\\n        \"x$ac_cv_c_const\"      = xno -o \\\n        \"x$ac_cv_type_size_t\"  = xno; then\n  AC_MSG_ERROR([\n    -------------------------------------------------------\n    An ANSI standard C library is required to build WCSLIB.\n\n    ERROR: WCSLIB configuration failure.\n    -------------------------------------------------------], [1])\nfi\n\n# Check for data types (suggested by autoscan - off_t is only required by\n# fitshdr).\nAC_TYPE_OFF_T\nAC_TYPE_INT8_T\nAC_TYPE_INT16_T\nAC_TYPE_INT32_T\nAC_TYPE_UINT8_T\nAC_TYPE_UINT16_T\nAC_TYPE_UINT32_T\n\n# Check for ANSI C headers.\nAC_HEADER_STDC\nAC_CHECK_HEADERS([ctype.h errno.h limits.h locale.h math.h setjmp.h stdarg.h \\\n                  stdio.h stdlib.h string.h])\nif test \"x$ac_cv_header_stdc\" = xno; then\n  AC_MSG_ERROR([\n    -------------------------------------------------------------------\n    An ANSI standard C library is required to build WCSLIB.  One of the\n    ANSI C header files it requires is missing or unusable.\n\n    ERROR: WCSLIB configuration failure.\n    -------------------------------------------------------------------], [1])\nfi\n\n# Flex uses fileno() and other POSIX features whose prototypes are only\n# available from glibc's stdio.h with an appropriate preprocessor macro\n# definition.  This cannot be set within the flex description file itself\n# as stdio.h is included in the generated C code before any part of the\n# description.  See fileno(3) and feature_test_macros(7).\nif test \"x$ac_cv_c_compiler_gnu\" = xyes ; then\n  FLFLAGS=\"$FLFLAGS -D_POSIX_C_SOURCE=1\"\nfi\nAC_SUBST([FLFLAGS])\n\n# Checks for ANSI C library functions (suggested by autoscan - fseeko and\n# stat are only required by fitshdr).\nAC_CHECK_LIB([m], [floor])\nAC_FUNC_FSEEKO\nAC_FUNC_MALLOC\nAC_FUNC_REALLOC\nAC_FUNC_SETVBUF_REVERSED\nAC_FUNC_STAT\nAC_FUNC_VPRINTF\nAC_CHECK_FUNCS([floor memset pow setlocale sqrt strchr strstr])\n\n# System libraries that may be required by WCSLIB itself.\n# SunOS, extra maths functions.\nAC_CHECK_LIB([sunmath], [cosd], [LIBS=\"-lsunmath $LIBS\"], [], [])\n\n# See if we can find sincos().\nAC_CHECK_FUNCS([sincos])\n\n# Check the size and availability of integer data types.\nAC_CHECK_SIZEOF([int])\nAC_CHECK_SIZEOF([long int])\nAC_CHECK_SIZEOF([long long int])\n\n# 64-bit integer data type; use long long int preferentially since that\n# accords with \"%lld\" formatting used in fitshdr.l, e.g.\n#                int   size_t  long int  long long int\n#                ---   ------  --------  -------------\n#   gcc x86:      32     32       32          64\n#   gcc x86_64:   32     64       64          64\nif test \"x$ac_cv_sizeof_long_long_int\" = x8; then\n  AC_DEFINE([WCSLIB_INT64], [long long int], [64-bit integer data type.])\nelif test \"x$ac_cv_sizeof_long_int\" = x8; then\n  AC_DEFINE([WCSLIB_INT64], [long int], [64-bit integer data type.])\nelif test \"x$ac_cv_sizeof_int\" = x8; then\n  AC_DEFINE([WCSLIB_INT64], [int], [64-bit integer data type.])\nfi\n\n# Does printf() have the z modifier for size_t type?  Important for 64-bit.\nAC_MSG_CHECKING([for printf z format modifier for size_t type])\nAC_RUN_IFELSE(\n  [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],\n                   [[char buf[64];\n                     if (sprintf(buf, \"%zu\", (size_t)1) != 1)\n                       return 1;\n                     else if (strcmp(buf, \"1\"))\n                       return 2;]])],\n  AC_DEFINE([MODZ], [\"z\"], [printf format modifier for size_t type.])\n    AC_MSG_RESULT(yes),\n  AC_DEFINE([MODZ], [\"\"],  [printf format modifier for size_t type.])\n    AC_MSG_RESULT(no),\n  AC_DEFINE([MODZ], [\"\"],  [printf format modifier for size_t type.])\n    AC_MSG_RESULT(assumed not)\n)\n\n\n# Starting values, may be augmented later.\nSUBDIRS=\"C\"\nTSTDIRS=\"C\"\nINSTDIR=\"C\"\n\n\n# Ways of specifying the Fortran compiler, in order of precedence:\n#   configure --enable-fortran=<compiler>\n#   F77=<compiler> configure    ...bash\n#\n# Ways of disabling Fortran:\n#   configure --disable-fortran\n#   configure --enable-fortran=no\n#   F77=no configure            ...bash\nAC_ARG_ENABLE([fortran], [AS_HELP_STRING([--enable-fortran=ARG],\n            [Fortran compiler to use])], [])\nAC_ARG_ENABLE([fortran], [AS_HELP_STRING([--disable-fortran],\n            [don't build the Fortran wrappers or PGSBOX])], [])\nif test \"x$enable_fortran\" != x -a \"x$enable_fortran\" != xyes ; then\n  F77=\"$enable_fortran\"\nfi\n\nif test \"x$F77\" = xno ; then\n  F77=\n\n  AC_MSG_WARN([Compilation of Fortran wrappers and PGSBOX disabled.])\n\nelse\n  if test \"x$F77\" = x ; then\n    # Look for a Fortran compiler.\n    AC_PROG_F77([gfortran g77 f77 ifort xlf frt pgf77 fl32 af77 fort77 f90 \\\n                 xlf90 pgf90 epcf90 f95 fort xlf95 lf95 g95])\n  fi\n\n  if test \"x$F77\" = x; then\n    AC_MSG_WARN([\n      ------------------------------------------------------------------\n      Fortran compiler not found, will skip Fortran wrappers and PGSBOX.\n      ------------------------------------------------------------------])\n\n    # Best guess at Fortran name mangling for use if a compiler does ever\n    # become available.\n    AC_DEFINE([F77_FUNC(name,NAME)], [name ## _])\n\n  else\n    if test \"x$ac_cv_f77_compiler_gnu\" = xyes ; then\n      if test \"x$F77\" = xg77 -o \"x$F77\" = xf77 ; then\n        # Not recognized by gfortran.\n        FFLAGS=\"$FFLAGS -Wno-globals\"\n      fi\n    fi\n\n    AC_MSG_CHECKING(whether $F77 accepts -I)\n    AC_LANG_PUSH(Fortran 77)\n    FFLAGS_save=$FFLAGS\n    FFLAGS=-I.\n    AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], []),\n      [FFLAGS=\"$FFLAGS_save -I.\"; AC_MSG_RESULT(yes)],\n      [FFLAGS=\"$FFLAGS_save\"; AC_MSG_RESULT(no)])\n    AC_LANG_POP()\n\n    # Libraries required by the Fortran compiler itself (sets FLIBS).\n    # Required by utilities and test programs written in C that link to\n    # Fortran object modules such as pgsbox.\n    AC_F77_LIBRARY_LDFLAGS\n\n    # Tidy up FLIBS.\n    dirs=\n    libs=\n    for flib in $FLIBS\n    do\n      case \"$flib\" in\n      -L*)  \n        dir=`echo \"$flib\" | sed -e 's/-L//'`\n        dir=-L`cd \"$dir\" && pwd`\n        dirs=\"$dirs $dir\"\n        ;;  \n      *) \n        libs=\"$libs $flib\"\n        ;;  \n      esac\n    done\n\n    dirs=`for dir in $dirs ; do echo \"$dir\" ; done | sort -u | xargs`\n\n    FLIBS=\"$dirs$libs\"\n\n    # F77 name mangling (defines the F77_FUNC preprocessor macro).\n    AC_F77_WRAPPERS\n\n    SUBDIRS=\"C Fortran\"\n    TSTDIRS=\"C Fortran\"\n    INSTDIR=\"Fortran\"\n  fi\nfi\n\n\n# System-dependent system libraries (for building the sharable library).\n#-----------------------------------------------------------------------\n# Darwin (contains stubs for long double).\nAC_CHECK_LIB([SystemStubs], [printf\\$LDBLStub], [LIBS=\"$LIBS -lSystemStubs\"],\n             [], [])\n\n\n# Library and installation utilities.\n#------------------------------------\n# Static library generation.\n# Ensure \"non-deterministic\" archives are produced during the build process.\nar rU conftest.a > /dev/null 2>&1 && ARFLAGS=\"U\"\nrm -f conftest.a\nAC_SUBST([ARFLAGS])\nAC_PROG_RANLIB\n\n# Shared library generation - gcc only.\n# Ways of disabling shared libraries:\n#   configure --disable-shared\n#   configure --enable-shared=no\nAC_ARG_ENABLE([shared], [AS_HELP_STRING([--disable-shared],\n            [don't build the WCS shared libraries])], [])\n\nSHRLIB=\nSONAME=\nSHRFLAGS=\nSHRLD=\nSHRSFX=\nSHRLN=\n\nif test \"x$ac_cv_c_compiler_gnu\" = xyes ; then\n  if test \"x$enable_shared\" = xno ; then\n    AC_MSG_WARN([Generation of WCS shared libraries disabled.])\n\n  else\n    SHVER=`echo \"$LIBVER\" | sed -e 's/\\..*$//'`\n\n    # Note that -fPIC is on by default for Macs, this just makes it obvious.\n    SHRFLAGS=\"-fPIC\"\n    SHRLD=\"\\$(CC) \\$(SHRFLAGS)\"\n\n    case \"$host_os\" in\n    darwin*)\n      SHRLIB=\"libwcs.$LIBVER.dylib\"\n      SONAME=\"libwcs.$SHVER.dylib\"\n      SHRLD=\"$SHRLD -dynamiclib -single_module\"\n      SHRLD=\"$SHRLD -compatibility_version $SHVER -current_version $LIBVER -install_name \\$(SONAME)\"\n      SHRLN=\"libwcs.dylib\"\n\n      case \"$host_cpu\" in\n      powerpc*)\n        # Switch off -fPIC (not applicable for PowerPC Macs).\n        CFLAGS=\"$CFLAGS -mdynamic-no-pic\"\n        ;;\n      esac\n      ;;\n    *mingw*)\n      SHRLIB=\"libwcs.dll.$LIBVER\"\n      SONAME=\"libwcs.dll.$SHVER\"\n      SHRLD=\"$SHRLD -shared -Wl,-h\\$(SONAME)\"\n      SHRLN=\"libwcs.dll\"\n      ;;\n    *)\n      # Covers Linux and Solaris at least.\n      SHRLIB=\"libwcs.so.$LIBVER\"\n      SONAME=\"libwcs.so.$SHVER\"\n      SHRLD=\"$SHRLD -shared -Wl,-h\\$(SONAME)\"\n      SHRLN=\"libwcs.so\"\n      ;;\n    esac\n  fi\nfi\n\nAC_SUBST([SHRLIB])\nAC_SUBST([SONAME])\nAC_SUBST([SHRFLAGS])\nAC_SUBST([SHRLD])\nAC_SUBST([SHRSFX])\nAC_SUBST([SHRLN])\n\n# Installation utilities.\nAC_PROG_LN_S\nAC_PROG_INSTALL\n\n# Older versions of GNU make do not have the -O option, which only facilitates\n# legibility of the output from parallel builds (make -j).\nmake --help | grep '\\-O' >/dev/null 2>&1 && MAKEFLAGS=\"-Otarget\"\nAC_SUBST([MAKEFLAGS])\n\nAC_MSG_NOTICE([End of primary configuration.\n])\n\n\n# The following are required to build utilities and test programs.\n# ----------------------------------------------------------------\nAC_MSG_NOTICE([Looking for libraries etc. for utilities and test suite...])\n\n# Check for other quasi-standard header files.\nAC_CHECK_HEADERS([unistd.h])\n\n# Large file support.\nAC_FUNC_FSEEKO\nAC_SYS_LARGEFILE\n\n\n# Extra places to look for third-party libraries and header files.\nLIBDIRS=\n\nAC_ARG_WITH([cfitsio], [AS_HELP_STRING([--without-cfitsio],\n            [eschew CFITSIO])], [])\nif test \"x$with_cfitsio\" = xno ; then\n  AC_MSG_WARN([CFITSIO disabled.])\nelse\n  AC_ARG_WITH([cfitsiolib], [AS_HELP_STRING([--with-cfitsiolib=DIR],\n              [directory containing cfitsio library])], [])\n  if test \"x$with_cfitsiolib\" != x ; then\n    LIBDIRS=\"$LIBDIRS $with_cfitsiolib\"\n  fi\n\n  AC_ARG_WITH([cfitsioinc], [AS_HELP_STRING([--with-cfitsioinc=DIR],\n              [directory containing cfitsio header files])], [])\n  if test \"x$with_cfitsioinc\" != x ; then\n    CFITSIO_INCDIRS=\"$with_cfitsioinc\"\n  fi\n\n  CFITSIO_INCDIRS=\"$CFITSIO_INCDIRS   \\\n           /usr/local/cfitsio/include \\\n           /local/cfitsio/include\"\n\n  LIBDIRS=\"$LIBDIRS           \\\n           /usr/local/cfitsio/lib \\\n           /local/cfitsio/lib\"\nfi\n\nAC_ARG_WITH([pgplot], [AS_HELP_STRING([--without-pgplot],\n            [eschew PGPLOT])], [])\nif test \"x$with_pgplot\" = xno ; then\n  AC_MSG_WARN([PGPLOT disabled.])\nelse\n  AC_ARG_WITH([pgplotlib], [AS_HELP_STRING([--with-pgplotlib=DIR],\n              [directory containing pgplot library])], [])\n  if test \"x$with_pgplotlib\" != x ; then\n    LIBDIRS=\"$LIBDIRS $with_pgplotlib\"\n  fi\n\n  AC_ARG_WITH([pgplotinc], [AS_HELP_STRING([--with-pgplotinc=DIR],\n              [directory containing pgplot header files])], [])\n  if test \"x$with_pgplotinc\" != x ; then\n    PGPLOT_INCDIRS=\"$with_pgplotinc\"\n  fi\n\n  PGPLOT_INCDIRS=\"$PGPLOT_INCDIRS    \\\n           /usr/local/pgplot/include \\\n           /local/pgplot/include\"\n\n  LIBDIRS=\"$LIBDIRS           \\\n           /usr/local/pgplot/lib  \\\n           /local/pgplot/lib\"\nfi\n\n\nif test \"x$with_cfitsio\" != xno -o \\\n        \"x$with_pgplot\"  != xno ; then\n  LIBDIRS=\"$LIBDIRS           \\\n           /usr/local/lib     \\\n           /local/lib         \\\n           /opt/local/lib     \\\n           /opt/SUNWspro/lib  \\\n           /sw/lib\"\n\n  for LIBDIR in $LIBDIRS ; do\n    AC_CHECK_FILE([$LIBDIR], [LDFLAGS=\"$LDFLAGS -L$LIBDIR\"], [continue])\n  done\n\n  # Generic include directories.\n  INCDIRS=\"/usr/local/include \\\n           /local/include     \\\n           /opt/local/include \\\n           /sw/include        \\\n           /local             \\\n           /usr/include\"\n\n\n  # CFITSIO.\n  if test \"x$with_cfitsio\" != xno ; then\n    # Search for CFITSIO.\n    for INCDIR in $CFITSIO_INCDIRS $INCDIRS ; do\n      AC_CHECK_FILE([$INCDIR/cfitsio/fitsio.h],\n                    [CFITSIOINC=\"-I$INCDIR/cfitsio\"; break])\n      AC_CHECK_FILE([$INCDIR/fitsio.h], [CFITSIOINC=\"-I$INCDIR\"; break])\n    done\n\n    AC_CHECK_LIB([socket],  [recv],   [CFITSIOLIB=\"-lsocket\"], [], [$LIBS])\n    AC_CHECK_LIB([cfitsio], [ffopen], [CFITSIOLIB=\"-lcfitsio $CFITSIOLIB\"], [],\n                 [$CFITSIOLIB $LIBS])\n\n    if test \"x$CFITSIOINC\" = x -o \"x$CFITSIOLIB\" = x; then\n      AC_MSG_WARN([CFITSIO not found, skipping CFITSIO-dependent tests.])\n    else\n      AC_MSG_NOTICE([CFITSIO appears to be available.])\n      AC_DEFINE([HAVE_CFITSIO], [1], [Define to 1 if CFITSIO is available.])\n\n      # Check for fits_read_wcstab, present in CFITSIO 3.004beta and later.\n      AC_CHECK_LIB([cfitsio], [fits_read_wcstab], [GETWCSTAB=],\n                   [GETWCSTAB=getwcstab.o], [$CFITSIOLIB $LIBS])\n      if test \"x$GETWCSTAB\" != x ; then\n        AC_MSG_WARN([fits_read_wcstab not found in CFITSIO, will use\n                        getwcstab.c to compile test programs.])\n      fi\n    fi\n  fi\n\n  # PGPLOT.\n  if test \"x$F77\" != x -a \"x$with_pgplot\" != xno ; then\n    # Search for PGPLOT.\n    for INCDIR in $PGPLOT_INCDIRS $INCDIRS ; do\n      AC_CHECK_FILE([$INCDIR/pgplot/cpgplot.h],\n                    [PGPLOTINC=\"-I$INCDIR/pgplot\"; break])\n      AC_CHECK_FILE([$INCDIR/cpgplot.h], [PGPLOTINC=\"-I$INCDIR\"; break])\n    done\n\n    # FLIBS (found above via AC_F77_LIBRARY_LDFLAGS) only helps if PGPLOT was\n    # built using the same Fortran compiler that we are using here.\n\n    # PGPLOT compiled by the SUN Fortran compiler but linked with something\n    # else.\n    AC_CHECK_LIB([M77],     [iand_],     [PGPLOTLIB=\"-lM77 $PGPLOTLIB\"],\n                 [], [$PGPLOTLIB $LIBS])\n    AC_CHECK_LIB([F77],     [f77_init],  [PGPLOTLIB=\"-lF77 $PGPLOTLIB\"],\n                 [], [$PGPLOTLIB $LIBS])\n\n    if test \"x$F77\" != xg77; then\n      # For PGPLOT compiled with g77 but linked with something else.\n      AC_CHECK_LIB([frtbegin], [main],     [PGPLOTLIB=\"-lfrtbegin $PGPLOTLIB\"],\n                   [], [$PGPLOTLIB $LIBS])\n      AC_CHECK_LIB([g2c],      [gerror_],  [PGPLOTLIB=\"-lg2c $PGPLOTLIB\"],\n                   [], [$PGPLOTLIB $LIBS])\n    fi\n\n    if test \"x$F77\" != xgfortran; then\n      # For PGPLOT compiled with gfortran but linked with something else.\n      # Note that if gfortran itself is driving the linker it can be harmful\n      # to add -lgfortran to the link list without also adding -lgfortranbegin.\n      # Doing so stops gfortran from adding -lgfortranbegin which is needed to\n      # resolve \"main\".\n      AC_CHECK_LIB([gfortran], [_gfortran_abort],\n                   [PGPLOTLIB=\"-lgfortran $PGPLOTLIB\"], [],\n                   [$PGPLOTLIB $LIBS])\n    fi\n\n    # Search for X11 includes and libraries.\n    AC_PATH_X\n    if test \"x$no_x\" = x; then\n      if test \"x$ac_x_libraries\" != x ; then\n        # Not needed for systems that keep the X11 libraries in /usr/lib.\n        LDFLAGS=\"$LDFLAGS -L$ac_x_libraries\"\n      fi\n      PGPLOTLIB=\"-lX11 $PGPLOTLIB\"\n    fi\n\n    # It is possible that other libraries may be required depending on what\n    # graphics drivers were installed with PGPLOT.\n    AC_CHECK_LIB([z],       [deflate],   [PGPLOTLIB=\"-lz $PGPLOTLIB\"],\n                 [], [$PGPLOTLIB $LIBS])\n    AC_CHECK_LIB([png],     [png_error], [PGPLOTLIB=\"-lpng $PGPLOTLIB\"],\n                 [], [$PGPLOTLIB $LIBS])\n    AC_CHECK_LIB([pgplot],  [pgbeg_],    [PGPLOTLIB=\"-lpgplot $PGPLOTLIB\"],\n                 [], [$PGPLOTLIB $FLIBS $LIBS])\n    AC_CHECK_LIB([cpgplot], [cpgbeg],    [PGPLOTLIB=\"-lcpgplot $PGPLOTLIB\"],\n                 [PGPLOTLIB=], [$PGPLOTLIB $FLIBS $LIBS])\n\n    # Only need the PGPLOT include file to build PGSBOX.\n    if test \"x$PGPLOTINC\" != x; then\n      SUBDIRS=\"$SUBDIRS pgsbox\"\n      INSTDIR=\"pgsbox\"\n    fi\n\n    # Also need the PGPLOT library to build pgtest and cpgtest.\n    if test \"x$PGPLOTLIB\" = x; then\n      AC_MSG_WARN([PGPLOT not found, skipping PGPLOT-dependent tests.])\n    else\n      AC_MSG_NOTICE([PGPLOT appears to be available.])\n\n      TSTDIRS=\"$TSTDIRS pgsbox\"\n    fi\n  fi\nfi\n\n\n# Utilities are compiled last since they need the libraries.\n# Ways of disabling them:\n#   configure --disable-utils\n#   configure --enable-utils=no\nAC_ARG_ENABLE([utils], [AS_HELP_STRING([--disable-utils],\n            [don't build the WCS utilities])], [])\nif test \"x$enable_utils\" = xno ; then\n  AC_MSG_WARN([Compilation of WCS utilities disabled.])\nelse\n  SUBDIRS=\"$SUBDIRS utils\"\n  INSTDIR=\"$INSTDIR utils\"\nfi\n\n# Default observer coordinates for sundazel.\nif test -f \"$HOME/.sundazelrc\"; then\n  . \"$HOME/.sundazelrc\"\nfi\n\nif test \"x$OBSLNG\" = x; then\n  OBSLNG=0.0\n  OBSLAT=0.0\n  OBSTZ=0.0\nfi\n\n\nAC_SUBST([CFITSIOINC])\nAC_SUBST([CFITSIOLIB])\nAC_SUBST([GETWCSTAB])\n\nAC_SUBST([PGPLOTINC])\nAC_SUBST([PGPLOTLIB])\n\nAC_SUBST([SUBDIRS])\nAC_SUBST([TSTDIRS])\nAC_SUBST([INSTDIR])\n\nAC_SUBST([OBSLNG])\nAC_SUBST([OBSLAT])\nAC_SUBST([OBSTZ])\n\nAC_MSG_NOTICE([End of auxiliary configuration.\n])\n\nAC_SUBST([FLAVOUR])\n\n\n# Do it.\nAC_MSG_NOTICE([Configuring files...])\nAC_CONFIG_FILES([makedefs wcslib.pc])\nAC_CONFIG_HEADERS([wcsconfig.h wcsconfig_f77.h wcsconfig_tests.h wcsconfig_utils.h])\nAC_OUTPUT\n"},{"id":16560,"name":"wcsconfig_utils.h.in","nodeType":"TextFile","path":"cextern/wcslib","text":"/*============================================================================\n*\n* wcsconfig_utils.h is generated from wcsconfig_utils.h.in by 'configure'.\n* It contains C preprocessor macro definitions for compiling the WCSLIB 7.7\n* utilities.\n*\n* Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n* http://www.atnf.csiro.au/people/Mark.Calabretta\n* $Id: wcsconfig_utils.h.in,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <wcsconfig.h>\n\n/* Definitions for Large File Support (LFS), i.e. files larger than 2GiB, for\n * the fitshdr utility. */\n\n/* Define to 1 if fseeko() is available (for small or large files). */\n#undef HAVE_FSEEKO\n\n/* Define _LARGEFILE_SOURCE to get prototypes from stdio.h for the LFS\n * functions fseeko() and ftello() which use an off_t argument in place of a\n * long. */\n#undef _LARGEFILE_SOURCE\n\n/* There seems to be a bug in autoconf that causes _LARGEFILE_SOURCE not to be\n * set in Linux.  This dreadful kludge gets around it for now. */\n#if (defined HAVE_FSEEKO && !defined _LARGEFILE_SOURCE)\n#define _LARGEFILE_SOURCE\n#endif\n\n/* Number of bits in a file offset (off_t) on systems where it can be set. */\n#undef _FILE_OFFSET_BITS\n\n/* Define for large files needed on AIX-type systems. */\n#undef _LARGE_FILES\n"},{"id":16561,"name":"cextern/wcslib/C","nodeType":"Package"},{"id":16562,"name":"cel.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: cel.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n#include \"wcserr.h\"\n#include \"wcsmath.h\"\n#include \"wcsprintf.h\"\n#include \"wcstrig.h\"\n#include \"sph.h\"\n#include \"cel.h\"\n\nconst int CELSET = 137;\n\n// Map status return value to message.\nconst char *cel_errmsg[] = {\n  \"Success\",\n  \"Null celprm pointer passed\",\n  \"Invalid projection parameters\",\n  \"Invalid coordinate transformation parameters\",\n  \"Ill-conditioned coordinate transformation parameters\",\n  \"One or more of the (x,y) coordinates were invalid\",\n  \"One or more of the (lng,lat) coordinates were invalid\"};\n\n// Map error returns for lower-level routines.\nconst int cel_prjerr[] = {\n  CELERR_SUCCESS,\t\t//  0: PRJERR_SUCCESS\n  CELERR_NULL_POINTER,\t\t//  1: PRJERR_NULL_POINTER\n  CELERR_BAD_PARAM,\t\t//  2: PRJERR_BAD_PARAM\n  CELERR_BAD_PIX,\t\t//  3: PRJERR_BAD_PIX\n  CELERR_BAD_WORLD\t\t//  4: PRJERR_BAD_WORLD\n};\n\n// Convenience macro for invoking wcserr_set().\n#define CEL_ERRMSG(status) WCSERR_SET(status), cel_errmsg[status]\n\n//----------------------------------------------------------------------------\n\nint celini(struct celprm *cel)\n\n{\n  register int k;\n\n  if (cel == 0x0) return CELERR_NULL_POINTER;\n\n  cel->flag = 0;\n\n  cel->offset = 0;\n  cel->phi0   = UNDEFINED;\n  cel->theta0 = UNDEFINED;\n  cel->ref[0] =   0.0;\n  cel->ref[1] =   0.0;\n  cel->ref[2] = UNDEFINED;\n  cel->ref[3] = +90.0;\n\n  for (k = 0; k < 5; cel->euler[k++] = 0.0);\n  cel->latpreq = -1;\n\n  cel->err = 0x0;\n\n  return cel_prjerr[prjini(&(cel->prj))];\n}\n\n//----------------------------------------------------------------------------\n\nint celfree(struct celprm *cel)\n\n{\n  if (cel == 0x0) return CELERR_NULL_POINTER;\n\n  wcserr_clear(&(cel->err));\n\n  return cel_prjerr[prjfree(&(cel->prj))];\n}\n\n//----------------------------------------------------------------------------\n\nint celsize(const struct celprm *cel, int sizes[2])\n\n{\n  if (cel == 0x0) {\n    sizes[0] = sizes[1] = 0;\n    return CELERR_SUCCESS;\n  }\n\n  // Base size, in bytes.\n  sizes[0] = sizeof(struct celprm);\n\n  // Total size of allocated memory, in bytes.\n  sizes[1] = 0;\n\n  int exsizes[2];\n\n  // celprm::prj.\n  prjsize(&(cel->prj), exsizes);\n  sizes[1] += exsizes[1];\n\n  // celprm::err.\n  wcserr_size(cel->err, exsizes);\n  sizes[1] += exsizes[0] + exsizes[1];\n\n  return CELERR_SUCCESS;\n}\n\n//----------------------------------------------------------------------------\n\nint celprt(const struct celprm *cel)\n\n{\n  int i;\n\n  if (cel == 0x0) return CELERR_NULL_POINTER;\n\n  wcsprintf(\"      flag: %d\\n\",  cel->flag);\n  wcsprintf(\"     offset: %d\\n\",  cel->offset);\n  if (undefined(cel->phi0)) {\n    wcsprintf(\"       phi0: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"       phi0: %9f\\n\", cel->phi0);\n  }\n  if (undefined(cel->theta0)) {\n    wcsprintf(\"     theta0: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"     theta0: %9f\\n\", cel->theta0);\n  }\n  wcsprintf(\"        ref:\");\n  for (i = 0; i < 4; i++) {\n    wcsprintf(\"  %#- 11.5g\", cel->ref[i]);\n  }\n  wcsprintf(\"\\n\");\n  wcsprintf(\"        prj: (see below)\\n\");\n\n  wcsprintf(\"      euler:\");\n  for (i = 0; i < 5; i++) {\n    wcsprintf(\"  %#- 11.5g\", cel->euler[i]);\n  }\n  wcsprintf(\"\\n\");\n  wcsprintf(\"    latpreq: %d\", cel->latpreq);\n  if (cel->latpreq == 0) {\n    wcsprintf(\" (not required)\\n\");\n  } else if (cel->latpreq == 1) {\n    wcsprintf(\" (disambiguation)\\n\");\n  } else if (cel->latpreq == 2) {\n    wcsprintf(\" (specification)\\n\");\n  } else {\n    wcsprintf(\" (UNDEFINED)\\n\");\n  }\n  wcsprintf(\"     isolat: %d\\n\", cel->isolat);\n\n  WCSPRINTF_PTR(\"        err: \", cel->err, \"\\n\");\n  if (cel->err) {\n    wcserr_prt(cel->err, \"             \");\n  }\n\n  wcsprintf(\"\\n\");\n  wcsprintf(\"   prj.*\\n\");\n  prjprt(&(cel->prj));\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint celperr(const struct celprm *cel, const char *prefix)\n\n{\n  if (cel == 0x0) return CELERR_NULL_POINTER;\n\n  if (cel->err && wcserr_prt(cel->err, prefix) == 0) {\n    wcserr_prt(cel->prj.err, prefix);\n  }\n\n  return 0;\n}\n\n\n//----------------------------------------------------------------------------\n\nint celset(struct celprm *cel)\n\n{\n  static const char *function = \"celset\";\n\n  int status;\n  const double tol = 1.0e-10;\n  double clat0, cphip, cthe0, lat0, lng0, phip, slat0, slz, sphip, sthe0;\n  double latp, latp1, latp2, lngp;\n  double u, v, x, y, z;\n  struct prjprm *celprj;\n  struct wcserr **err;\n\n  if (cel == 0x0) return CELERR_NULL_POINTER;\n  err = &(cel->err);\n\n  // Initialize the projection driver routines.\n  celprj = &(cel->prj);\n  if (cel->offset) {\n    celprj->phi0   = cel->phi0;\n    celprj->theta0 = cel->theta0;\n  } else {\n    // Ensure that these are undefined - no fiducial offset.\n    celprj->phi0   = UNDEFINED;\n    celprj->theta0 = UNDEFINED;\n  }\n\n  if ((status = prjset(celprj))) {\n    return wcserr_set(CEL_ERRMSG(cel_prjerr[status]));\n  }\n\n  // Defaults set by the projection routines.\n  if (undefined(cel->phi0)) {\n    cel->phi0 = celprj->phi0;\n  }\n\n  if (undefined(cel->theta0)) {\n    cel->theta0 = celprj->theta0;\n\n  } else if (fabs(cel->theta0) > 90.0) {\n    if (fabs(cel->theta0) > 90.0 + tol) {\n      return wcserr_set(WCSERR_SET(CELERR_BAD_COORD_TRANS),\n        \"Invalid coordinate transformation parameters: theta0 > 90\");\n    }\n\n    if (cel->theta0 > 90.0) {\n      cel->theta0 =  90.0;\n    } else {\n      cel->theta0 = -90.0;\n    }\n  }\n\n\n  lng0 = cel->ref[0];\n  lat0 = cel->ref[1];\n  phip = cel->ref[2];\n  latp = cel->ref[3];\n\n  // Set default for native longitude of the celestial pole?\n  if (undefined(phip) || phip == 999.0) {\n    phip = (lat0 < cel->theta0) ? 180.0 : 0.0;\n    phip += cel->phi0;\n\n    if (phip < -180.0) {\n      phip += 360.0;\n    } else if (phip > 180.0) {\n      phip -= 360.0;\n    }\n\n    cel->ref[2] = phip;\n  }\n\n\n  // Compute celestial coordinates of the native pole.\n  cel->latpreq = 0;\n  if (cel->theta0 == 90.0) {\n    // Fiducial point at the native pole.\n    lngp = lng0;\n    latp = lat0;\n\n  } else {\n    // Fiducial point away from the native pole.\n    sincosd(lat0, &slat0, &clat0);\n    sincosd(cel->theta0, &sthe0, &cthe0);\n\n    if (phip == cel->phi0) {\n      sphip = 0.0;\n      cphip = 1.0;\n\n      u = cel->theta0;\n      v = 90.0 - lat0;\n\n    } else {\n      sincosd(phip - cel->phi0, &sphip, &cphip);\n\n      x = cthe0*cphip;\n      y = sthe0;\n      z = sqrt(x*x + y*y);\n      if (z == 0.0) {\n        if (slat0 != 0.0) {\n          return wcserr_set(WCSERR_SET(CELERR_BAD_COORD_TRANS),\n            \"Invalid coordinate description:\\n\"\n            \"lat0 == 0 is required for |phip - phi0| = 90 and theta0 == 0\");\n        }\n\n        // latp determined solely by LATPOLEa in this case.\n        cel->latpreq = 2;\n        if (latp > 90.0) {\n          latp = 90.0;\n        } else if (latp < -90.0) {\n          latp = -90.0;\n        }\n\n        // Avert a spurious compiler warning.\n\tu = v = 0.0;\n\n      } else {\n        slz = slat0/z;\n        if (fabs(slz) > 1.0) {\n          if ((fabs(slz) - 1.0) < tol) {\n            if (slz > 0.0) {\n              slz = 1.0;\n            } else {\n              slz = -1.0;\n            }\n          } else {\n            return wcserr_set(WCSERR_SET(CELERR_BAD_COORD_TRANS),\n              \"Invalid coordinate description:\\n|lat0| <= %.3f is required \"\n              \"for these values of phip, phi0, and theta0\", asind(z));\n          }\n        }\n\n        u = atan2d(y,x);\n        v = acosd(slz);\n      }\n    }\n\n    if (cel->latpreq == 0) {\n      latp1 = u + v;\n      if (latp1 > 180.0) {\n        latp1 -= 360.0;\n      } else if (latp1 < -180.0) {\n        latp1 += 360.0;\n      }\n\n      latp2 = u - v;\n      if (latp2 > 180.0) {\n        latp2 -= 360.0;\n      } else if (latp2 < -180.0) {\n        latp2 += 360.0;\n      }\n\n      if (fabs(latp1) < 90.0+tol &&\n          fabs(latp2) < 90.0+tol) {\n        // There are two valid solutions for latp.\n        cel->latpreq = 1;\n      }\n\n      if (fabs(latp-latp1) < fabs(latp-latp2)) {\n        if (fabs(latp1) < 90.0+tol) {\n          latp = latp1;\n        } else {\n          latp = latp2;\n        }\n      } else {\n        if (fabs(latp2) < 90.0+tol) {\n          latp = latp2;\n        } else {\n          latp = latp1;\n        }\n      }\n\n      // Account for rounding error.\n      if (fabs(latp) < 90.0+tol) {\n        if (latp > 90.0) {\n          latp =  90.0;\n        } else if (latp < -90.0) {\n          latp = -90.0;\n        }\n      }\n    }\n\n    z = cosd(latp)*clat0;\n    if (fabs(z) < tol) {\n      if (fabs(clat0) < tol) {\n        // Celestial pole at the fiducial point.\n        lngp = lng0;\n\n      } else if (latp > 0.0) {\n        // Celestial north pole at the native pole.\n        lngp = lng0 + phip - cel->phi0 - 180.0;\n\n      } else {\n        // Celestial south pole at the native pole.\n        lngp = lng0 - phip + cel->phi0;\n      }\n\n    } else {\n      x = (sthe0 - sind(latp)*slat0)/z;\n      y =  sphip*cthe0/clat0;\n      if (x == 0.0 && y == 0.0) {\n        // Sanity check (shouldn't be possible).\n        return wcserr_set(WCSERR_SET(CELERR_BAD_COORD_TRANS),\n          \"Invalid coordinate transformation parameters, internal error\");\n      }\n      lngp = lng0 - atan2d(y,x);\n    }\n\n    // Make celestial longitude of the native pole the same sign as at the\n    // fiducial point.\n    if (lng0 >= 0.0) {\n      if (lngp < 0.0) {\n        lngp += 360.0;\n      } else if (lngp > 360.0) {\n        lngp -= 360.0;\n      }\n    } else {\n      if (lngp > 0.0) {\n        lngp -= 360.0;\n      } else if (lngp < -360.0) {\n        lngp += 360.0;\n      }\n    }\n  }\n\n  // Reset LATPOLEa.\n  cel->ref[3] = latp;\n\n  // Set the Euler angles.\n  cel->euler[0] = lngp;\n  cel->euler[1] = 90.0 - latp;\n  cel->euler[2] = phip;\n  sincosd(cel->euler[1], &cel->euler[4], &cel->euler[3]);\n  cel->isolat = (cel->euler[4] == 0.0);\n  cel->flag = CELSET;\n\n  // Check for ill-conditioned parameters.\n  if (fabs(latp) > 90.0+tol) {\n    return wcserr_set(WCSERR_SET(CELERR_ILL_COORD_TRANS),\n      \"Ill-conditioned coordinate transformation parameters\\nNo valid \"\n      \"solution for latp for these values of phip, phi0, and theta0\");\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint celx2s(\n  struct celprm *cel,\n  int nx,\n  int ny,\n  int sxy,\n  int sll,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  double lng[],\n  double lat[],\n  int    stat[])\n\n{\n  static const char *function = \"celx2s\";\n\n  int    istat, nphi, status = 0;\n  struct prjprm *celprj;\n  struct wcserr **err;\n\n  // Initialize.\n  if (cel == 0x0) return CELERR_NULL_POINTER;\n  err = &(cel->err);\n\n  if (cel->flag != CELSET) {\n    if ((status = celset(cel))) return status;\n  }\n\n  // Apply spherical deprojection.\n  celprj = &(cel->prj);\n  if ((istat = celprj->prjx2s(celprj, nx, ny, sxy, 1, x, y, phi, theta,\n                               stat))) {\n    if (istat) {\n      status = wcserr_set(CEL_ERRMSG(cel_prjerr[istat]));\n      if (status != CELERR_BAD_PIX) {\n        return status;\n      }\n    }\n  }\n\n  nphi = (ny > 0) ? (nx*ny) : nx;\n\n  // Compute celestial coordinates.\n  sphx2s(cel->euler, nphi, 0, 1, sll, phi, theta, lng, lat);\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint cels2x(\n  struct celprm *cel,\n  int nlng,\n  int nlat,\n  int sll,\n  int sxy,\n  const double lng[],\n  const double lat[],\n  double phi[],\n  double theta[],\n  double x[],\n  double y[],\n  int    stat[])\n\n{\n  static const char *function = \"cels2x\";\n\n  int    istat, nphi, ntheta, status = 0;\n  struct prjprm *celprj;\n  struct wcserr **err;\n\n  // Initialize.\n  if (cel == 0x0) return CELERR_NULL_POINTER;\n  err = &(cel->err);\n\n  if (cel->flag != CELSET) {\n    if ((status = celset(cel))) return status;\n  }\n\n  // Compute native coordinates.\n  sphs2x(cel->euler, nlng, nlat, sll, 1, lng, lat, phi, theta);\n\n  if (cel->isolat) {\n    // Constant celestial latitude -> constant native latitude.\n    nphi   = nlng;\n    ntheta = nlat;\n  } else {\n    nphi   = (nlat > 0) ? (nlng*nlat) : nlng;\n    ntheta = 0;\n  }\n\n  // Apply the spherical projection.\n  celprj = &(cel->prj);\n  if ((istat = celprj->prjs2x(celprj, nphi, ntheta, 1, sxy, phi, theta, x, y,\n                               stat))) {\n    if (istat) {\n      status = wcserr_set(CEL_ERRMSG(cel_prjerr[istat]));\n      if (status != CELERR_BAD_WORLD) {\n        return status;\n      }\n    }\n  }\n\n  return status;\n}\n"},{"id":16563,"name":"wcsutil.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsutil.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <ctype.h>\n#include <locale.h>\n#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"wcsutil.h\"\n#include \"wcsmath.h\"\n\n//----------------------------------------------------------------------------\n\nvoid wcsdealloc(void *ptr)\n\n{\n  free(ptr);\n\n  return;\n}\n\n//----------------------------------------------------------------------------\n\nvoid wcsutil_strcvt(int n, char c, int nt, const char src[], char dst[])\n\n{\n  if (n <= 0) return;\n\n  if (c != '\\0') c = ' ';\n\n  if (src == 0x0) {\n    if (dst) {\n      memset(dst, c, n);\n    }\n\n  } else {\n    // Copy to the first NULL character.\n    int j;\n    for (j = 0; j < n; j++) {\n      if ((dst[j] = src[j]) == '\\0') {\n        break;\n      }\n    }\n\n    if (j < n) {\n      // The given string is null-terminated.\n      memset(dst+j, c, n-j);\n\n    } else {\n      // The given string is not null-terminated.\n      if (c == '\\0') {\n        // Work backwards, looking for the first non-blank.\n        for (j = n - 1; j >= 0; j--) {\n          if (dst[j] != ' ') {\n            break;\n          }\n        }\n\n        j++;\n\tif (j == n && !nt) {\n\t  dst[n-1] = '\\0';\n\t} else {\n          memset(dst+j, '\\0', n-j);\n\t}\n      }\n    }\n  }\n\n  if (nt) dst[n] = '\\0';\n\n  return;\n}\n\n//----------------------------------------------------------------------------\n\nvoid wcsutil_blank_fill(int n, char c[])\n\n{\n  if (n <= 0) return;\n\n  if (c == 0x0) {\n    return;\n  }\n\n  // Replace the terminating null and all successive characters.\n  for (int j = 0; j < n; j++) {\n    if (c[j] == '\\0') {\n      memset(c+j, ' ', n-j);\n      break;\n    }\n  }\n\n  return;\n}\n\n//----------------------------------------------------------------------------\n\nvoid wcsutil_null_fill(int n, char c[])\n\n{\n  if (n <= 0) return;\n\n  if (c == 0x0) {\n    return;\n  }\n\n  // Find the first NULL character.\n  int j;\n  for (j = 0; j < n; j++) {\n    if (c[j] == '\\0') {\n      break;\n    }\n  }\n\n  // Ensure null-termination.\n  if (j == n) {\n    j = n - 1;\n    c[j] = '\\0';\n  }\n\n  // Work backwards, looking for the first non-blank.\n  j--;\n  for (; j > 0; j--) {\n    if (c[j] != ' ') {\n      break;\n    }\n  }\n\n  if (++j < n) {\n    memset(c+j, '\\0', n-j);\n  }\n\n  return;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsutil_all_ival(int nelem, int ival, const int iarr[])\n\n{\n  for (int i = 0; i < nelem; i++) {\n    if (iarr[i] != ival) return 0;\n  }\n\n  return 1;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsutil_all_dval(int nelem, double dval, const double darr[])\n\n{\n  for (int i = 0; i < nelem; i++) {\n    if (darr[i] != dval) return 0;\n  }\n\n  return 1;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsutil_all_sval(int nelem, const char *sval, const char (*sarr)[72])\n\n{\n  for (int i = 0; i < nelem; i++) {\n    if (strncmp(sarr[i], sval, 72)) return 0;\n  }\n\n  return 1;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsutil_allEq(int nvec, int nelem, const double *first)\n\n{\n  if (nvec <= 0 || nelem <= 0) return 0;\n\n  double v0 = *first;\n  for (const double *vp = first+nelem; vp < first + nvec*nelem; vp += nelem) {\n    if (*vp != v0) return 0;\n  }\n\n  return 1;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsutil_dblEq(\n  int nelem,\n  double tol,\n  const double *darr1,\n  const double *darr2)\n\n{\n  if (nelem == 0) return 1;\n  if (nelem  < 0) return 0;\n\n  if (darr1 == 0x0 && darr2 == 0x0) return 1;\n\n  if (tol == 0.0) {\n    // Handled separately for speed of execution.\n    for (int i = 0; i < nelem; i++) {\n      double dval1 = (darr1 ? darr1[i] : UNDEFINED);\n      double dval2 = (darr2 ? darr2[i] : UNDEFINED);\n\n      // Undefined values must match exactly.\n      if (dval1 == UNDEFINED && dval2 != UNDEFINED) return 0;\n      if (dval1 != UNDEFINED && dval2 == UNDEFINED) return 0;\n\n      if (dval1 != dval2) return 0;\n    }\n\n  } else {\n    for (int i = 0; i < nelem; i++) {\n      double dval1 = (darr1 ? darr1[i] : UNDEFINED);\n      double dval2 = (darr2 ? darr2[i] : UNDEFINED);\n\n      // Undefined values must match exactly.\n      if (dval1 == UNDEFINED && dval2 != UNDEFINED) return 0;\n      if (dval1 != UNDEFINED && dval2 == UNDEFINED) return 0;\n\n      // Otherwise, compare within the specified tolerance.\n      if (fabs(dval1 - dval2) > 0.5*tol) return 0;\n    }\n  }\n\n  return 1;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsutil_intEq(int nelem, const int *iarr1, const int *iarr2)\n\n{\n  if (nelem == 0) return 1;\n  if (nelem  < 0) return 0;\n\n  if (iarr1 == 0x0 && iarr2 == 0x0) return 1;\n\n  for (int i = 0; i < nelem; i++) {\n    int ival1 = (iarr1 ?  iarr1[i] : 0);\n    int ival2 = (iarr2 ?  iarr2[i] : 0);\n\n    if (ival1 != ival2) return 0;\n  }\n\n  return 1;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsutil_strEq(int nelem, char (*sarr1)[72], char (*sarr2)[72])\n\n{\n  if (nelem == 0) return 1;\n  if (nelem  < 0) return 0;\n\n  if (sarr1 == 0x0 && sarr2 == 0x0) return 1;\n\n  for (int i = 0; i < nelem; i++) {\n    char *sval1 = (sarr1 ?  sarr1[i] : \"\");\n    char *sval2 = (sarr2 ?  sarr2[i] : \"\");\n\n    if (strncmp(sval1, sval2, 72)) return 0;\n  }\n\n  return 1;\n}\n\n//----------------------------------------------------------------------------\n\nvoid wcsutil_setAll(int nvec, int nelem, double *first)\n\n{\n  if (nvec <= 0 || nelem <= 0) return;\n\n  double v0 = *first;\n  for (double *vp = first+nelem; vp < first + nvec*nelem; vp += nelem) {\n    *vp = v0;\n  }\n}\n\n//----------------------------------------------------------------------------\n\nvoid wcsutil_setAli(int nvec, int nelem, int *first)\n\n{\n  if (nvec <= 0 || nelem <= 0) return;\n\n  int v0 = *first;\n  for (int *vp = first+nelem; vp < first + nvec*nelem; vp += nelem) {\n    *vp = v0;\n  }\n}\n\n//----------------------------------------------------------------------------\n\nvoid wcsutil_setBit(int nelem, const int *sel, int bits, int *array)\n\n{\n  if (bits == 0 || nelem <= 0) return;\n\n  if (sel == 0x0) {\n    // All elements selected.\n    for (int *arrp = array; arrp < array + nelem; arrp++) {\n      *arrp |= bits;\n    }\n\n  } else {\n    // Some elements selected.\n    for (int *arrp = array; arrp < array + nelem; arrp++) {\n      if (*(sel++)) *arrp |= bits;\n    }\n  }\n}\n\n//----------------------------------------------------------------------------\n\nchar *wcsutil_fptr2str(void (*fptr)(void), char hext[19])\n\n{\n  // Test for little-endian addresses.\n  int *(ip[2]), j[2], le = 1;\n  ip[0] = j;\n  ip[1] = j + 1;\n  unsigned char *p = (unsigned char *)(&fptr);\n  if ((unsigned char *)ip[0] < (unsigned char *)ip[1]) {\n    // Little-endian, reverse it.\n    p += sizeof(fptr) - 1;\n    le = -1;\n  }\n\n  char *t = hext;\n  sprintf(t, \"0x0\");\n  t += 2;\n\n  int gotone = 0;\n  for (size_t i = 0; i < sizeof(fptr); i++) {\n    // Skip leading zeroes.\n    if (*p) gotone = 1;\n\n    if (gotone) {\n      sprintf(t, \"%02x\", *p);\n      t += 2;\n    }\n\n    p += le;\n  }\n\n  return hext;\n}\n\n//----------------------------------------------------------------------------\n\nstatic void wcsutil_locale_to_dot(char *buf)\n\n{\n  struct lconv *locale_data = localeconv();\n  const char *decimal_point = locale_data->decimal_point;\n\n  if (decimal_point[0] != '.' || decimal_point[1] != 0) {\n    size_t decimal_point_len = strlen(decimal_point);\n    char *inbuf = buf;\n    char *outbuf = buf;\n\n    for ( ; *inbuf; inbuf++) {\n      if (strncmp(inbuf, decimal_point, decimal_point_len) == 0) {\n        *outbuf++ = '.';\n        inbuf += decimal_point_len - 1;\n      } else {\n        *outbuf++ = *inbuf;\n      }\n    }\n\n    *outbuf = '\\0';\n  }\n}\n\n\nvoid wcsutil_double2str(char *buf, const char *format, double value)\n\n{\n  sprintf(buf, format, value);\n  wcsutil_locale_to_dot(buf);\n\n  // Look for a decimal point or exponent.\n  char *bp = buf;\n  while (*bp) {\n    if (*bp != ' ') {\n      if (*bp == '.') return;\n      if (*bp == 'e') return;\n      if (*bp == 'E') return;\n    }\n    bp++;\n  }\n\n  // Not found, add a fractional part.\n  bp = buf;\n  if (*bp == ' ') {\n    char *cp = buf + 1;\n    if (*cp == ' ') cp++;\n\n    while (*cp) {\n      *bp = *cp;\n      bp++;\n      cp++;\n    }\n\n    *bp = '.';\n    bp++;\n    if (bp < cp) *bp = '0';\n  }\n}\n\n//----------------------------------------------------------------------------\n\nstatic const char *wcsutil_dot_to_locale(const char *inbuf, char *outbuf)\n\n{\n  struct lconv *locale_data = localeconv();\n  const char *decimal_point = locale_data->decimal_point;\n\n  if (decimal_point[0] != '.' || decimal_point[1] != 0) {\n    char *out = outbuf;\n    size_t decimal_point_len = strlen(decimal_point);\n\n    for ( ; *inbuf; inbuf++) {\n      if (*inbuf == '.') {\n        memcpy(out, decimal_point, decimal_point_len);\n        out += decimal_point_len;\n      } else {\n        *out++ = *inbuf;\n      }\n    }\n\n    *out = '\\0';\n\n    return outbuf;\n  } else {\n    return inbuf;\n  }\n}\n\n\nint wcsutil_str2double(const char *buf, double *value)\n\n{\n  char ctmp[72];\n  return sscanf(wcsutil_dot_to_locale(buf, ctmp), \"%lf\", value) < 1;\n}\n\n\nint wcsutil_str2double2(const char *buf, double *value)\n\n{\n  value[0] = 0.0;\n  value[1] = 0.0;\n\n  // Get the integer part.\n  char ltmp[72];\n  if (sscanf(wcsutil_dot_to_locale(buf, ltmp), \"%lf\", value) < 1) {\n    return 1;\n  }\n  value[0] = floor(value[0]);\n\n  char ctmp[72];\n  strcpy(ctmp, buf);\n\n  // Look for a decimal point.\n  char *dptr = strchr(ctmp, '.');\n\n  // Look for an exponent.\n  char *eptr;\n  if ((eptr = strchr(ctmp, 'E')) == NULL) {\n    if ((eptr = strchr(ctmp, 'D')) == NULL) {\n      if ((eptr = strchr(ctmp, 'e')) == NULL) {\n        eptr = strchr(ctmp, 'd');\n      }\n    }\n  }\n\n  int exp = 0;\n  if (eptr) {\n    // Get the exponent.\n    if (sscanf(eptr+1, \"%d\", &exp) < 1) {\n      return 1;\n    }\n\n    if (!dptr) {\n      dptr = eptr;\n      eptr++;\n    }\n\n    if (dptr+exp <= ctmp) {\n      // There is only a fractional part.\n      return sscanf(wcsutil_dot_to_locale(buf, ctmp), \"%lf\", value+1) < 1;\n    } else if (eptr <= dptr+exp+1) {\n      // There is no fractional part.\n      return 0;\n    }\n  }\n\n  // Get the fractional part.\n  if (dptr) {\n    char *cptr = ctmp;\n    while (cptr <= dptr+exp) {\n      if ('0' < *cptr && *cptr <= '9') *cptr = '0';\n      cptr++;\n    }\n\n    if (sscanf(wcsutil_dot_to_locale(ctmp, ltmp), \"%lf\", value+1) < 1) {\n      return 1;\n    }\n  }\n\n  return 0;\n}\n"},{"id":16564,"name":"sph.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: sph.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the sph routines\n* ---------------------------\n* Routines in this suite implement the spherical coordinate transformations\n* defined by the FITS World Coordinate System (WCS) standard\n*\n=   \"Representations of world coordinates in FITS\",\n=   Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (WCS Paper I)\n=\n=   \"Representations of celestial coordinates in FITS\",\n=   Calabretta, M.R., & Greisen, E.W. 2002, A&A, 395, 1077 (WCS Paper II)\n*\n* The transformations are implemented via separate functions, sphx2s() and\n* sphs2x(), for the spherical rotation in each direction.\n*\n* A utility function, sphdpa(), computes the angular distances and position\n* angles from a given point on the sky to a number of other points.  sphpad()\n* does the complementary operation - computes the coordinates of points offset\n* by the given angular distances and position angles from a given point on the\n* sky.\n*\n*\n* sphx2s() - Rotation in the pixel-to-world direction\n* ---------------------------------------------------\n* sphx2s() transforms native coordinates of a projection to celestial\n* coordinates.\n*\n* Given:\n*   eul       const double[5]\n*                       Euler angles for the transformation:\n*                         0: Celestial longitude of the native pole [deg].\n*                         1: Celestial colatitude of the native pole, or\n*                            native colatitude of the celestial pole [deg].\n*                         2: Native longitude of the celestial pole [deg].\n*                         3: cos(eul[1])\n*                         4: sin(eul[1])\n*\n*   nphi,\n*   ntheta    int       Vector lengths.\n*\n*   spt,sxy   int       Vector strides.\n*\n*   phi,theta const double[]\n*                       Longitude and latitude in the native coordinate\n*                       system of the projection [deg].\n*\n* Returned:\n*   lng,lat   double[]  Celestial longitude and latitude [deg].  These may\n*                       refer to the same storage as phi and theta\n*                       respectively.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*\n*\n* sphs2x() - Rotation in the world-to-pixel direction\n* ---------------------------------------------------\n* sphs2x() transforms celestial coordinates to the native coordinates of a\n* projection.\n*\n* Given:\n*   eul       const double[5]\n*                       Euler angles for the transformation:\n*                         0: Celestial longitude of the native pole [deg].\n*                         1: Celestial colatitude of the native pole, or\n*                            native colatitude of the celestial pole [deg].\n*                         2: Native longitude of the celestial pole [deg].\n*                         3: cos(eul[1])\n*                         4: sin(eul[1])\n*\n*   nlng,nlat int       Vector lengths.\n*\n*   sll,spt   int       Vector strides.\n*\n*   lng,lat   const double[]\n*                       Celestial longitude and latitude [deg].\n*\n* Returned:\n*   phi,theta double[]  Longitude and latitude in the native coordinate system\n*                       of the projection [deg].  These may refer to the same\n*                       storage as lng and lat respectively.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*\n*\n* sphdpa() - Compute angular distance and position angle\n* ------------------------------------------------------\n* sphdpa() computes the angular distance and generalized position angle (see\n* notes) from a \"reference\" point to a number of \"field\" points on the sphere.\n* The points must be specified consistently in any spherical coordinate\n* system.\n*\n* sphdpa() is complementary to sphpad().\n*\n* Given:\n*   nfield    int       The number of field points.\n*\n*   lng0,lat0 double    Spherical coordinates of the reference point [deg].\n*\n*   lng,lat   const double[]\n*                       Spherical coordinates of the field points [deg].\n*\n* Returned:\n*   dist,pa   double[]  Angular distances and position angles [deg].  These\n*                       may refer to the same storage as lng and lat\n*                       respectively.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*\n* Notes:\n*   1. sphdpa() uses sphs2x() to rotate coordinates so that the reference\n*      point is at the north pole of the new system with the north pole of the\n*      old system at zero longitude in the new.  The Euler angles required by\n*      sphs2x() for this rotation are\n*\n=        eul[0] = lng0;\n=        eul[1] = 90.0 - lat0;\n=        eul[2] =  0.0;\n*\n*      The angular distance and generalized position angle are readily\n*      obtained from the longitude and latitude of the field point in the new\n*      system.  This applies even if the reference point is at one of the\n*      poles, in which case the \"position angle\" returned is as would be\n*      computed for a reference point at (lng0,+90-epsilon) or\n*      (lng0,-90+epsilon), in the limit as epsilon goes to zero.\n*\n*      It is evident that the coordinate system in which the two points are\n*      expressed is irrelevant to the determination of the angular separation\n*      between the points.  However, this is not true of the generalized\n*      position angle.\n*\n*      The generalized position angle is here defined as the angle of\n*      intersection of the great circle containing the reference and field\n*      points with that containing the reference point and the pole.  It has\n*      its normal meaning when the the reference and field points are\n*      specified in equatorial coordinates (right ascension and declination).\n*\n*      Interchanging the reference and field points changes the position angle\n*      in a non-intuitive way (because the sum of the angles of a spherical\n*      triangle normally exceeds 180 degrees).\n*\n*      The position angle is undefined if the reference and field points are\n*      coincident or antipodal.  This may be detected by checking for a\n*      distance of 0 or 180 degrees (within rounding tolerance).  sphdpa()\n*      will return an arbitrary position angle in such circumstances.\n*\n*\n* sphpad() - Compute field points offset from a given point\n* ---------------------------------------------------------\n* sphpad() computes the coordinates of a set of points that are offset by the\n* specified angular distances and position angles from a given \"reference\"\n* point on the sky.  The distances and position angles must be specified\n* consistently in any spherical coordinate system.\n*\n* sphpad() is complementary to sphdpa().\n*\n* Given:\n*   nfield    int       The number of field points.\n*\n*   lng0,lat0 double    Spherical coordinates of the reference point [deg].\n*\n*   dist,pa   const double[]\n*                       Angular distances and position angles [deg].\n*\n* Returned:\n*   lng,lat   double[]  Spherical coordinates of the field points [deg].\n*                       These may refer to the same storage as dist and pa\n*                       respectively.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*\n* Notes:\n*   1: sphpad() is implemented analogously to sphdpa() although using sphx2s()\n*      for the inverse transformation.  In particular, when the reference\n*      point is at one of the poles, \"position angle\" is interpreted as though\n*      the reference point was at (lng0,+90-epsilon) or (lng0,-90+epsilon), in\n*      the limit as epsilon goes to zero.\n*\n*   Applying sphpad() with the distances and position angles computed by\n*   sphdpa() should return the original field points.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_SPH\n#define WCSLIB_SPH\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\nint sphx2s(const double eul[5], int nphi, int ntheta, int spt, int sxy,\n           const double phi[], const double theta[],\n           double lng[], double lat[]);\n\nint sphs2x(const double eul[5], int nlng, int nlat, int sll , int spt,\n           const double lng[], const double lat[],\n           double phi[], double theta[]);\n\nint sphdpa(int nfield, double lng0, double lat0,\n           const double lng[], const double lat[],\n           double dist[], double pa[]);\n\nint sphpad(int nfield, double lng0, double lat0,\n           const double dist[], const double pa[],\n           double lng[], double lat[]);\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WCSLIB_SPH\n"},{"id":16565,"name":"wcsfix.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsfix.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the wcsfix routines\n* ------------------------------\n* Routines in this suite identify and translate various forms of construct\n* known to occur in FITS headers that violate the FITS World Coordinate System\n* (WCS) standard described in\n*\n=   \"Representations of world coordinates in FITS\",\n=   Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (WCS Paper I)\n=\n=   \"Representations of celestial coordinates in FITS\",\n=   Calabretta, M.R., & Greisen, E.W. 2002, A&A, 395, 1077 (WCS Paper II)\n=\n=   \"Representations of spectral coordinates in FITS\",\n=   Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L.\n=   2006, A&A, 446, 747 (WCS Paper III)\n=\n=   \"Representations of time coordinates in FITS -\n=    Time and relative dimension in space\",\n=   Rots, A.H., Bunclark, P.S., Calabretta, M.R., Allen, S.L.,\n=   Manchester, R.N., & Thompson, W.T. 2015, A&A, 574, A36 (WCS Paper VII)\n*\n* Repairs effected by these routines range from the translation of\n* non-standard values for standard WCS keywords, to the repair of malformed\n* coordinate representations.  Some routines are also provided to check the\n* consistency of pairs of keyvalues that define the same measure in two\n* different ways, for example, as a date and an MJD.\n*\n* A separate routine, wcspcx(), \"regularizes\" the linear transformation matrix\n* component (PCi_j) of the coordinate transformation to make it more human-\n* readable.  Where a coordinate description was constructed from CDi_j, it\n* decomposes it into PCi_j + CDELTi in a meaningful way.  Optionally, it can\n* also diagonalize the PCi_j matrix (as far as possible), i.e. undo a\n* transposition of axes in the intermediate pixel coordinate system.\n*\n* Non-standard keyvalues:\n* -----------------------\n*   AIPS-convention celestial projection types, NCP and GLS, and spectral\n*   types, 'FREQ-LSR', 'FELO-HEL', etc., set in CTYPEia are translated\n*   on-the-fly by wcsset() but without modifying the relevant ctype[], pv[] or\n*   specsys members of the wcsprm struct.  That is, only the information\n*   extracted from ctype[] is translated when wcsset() fills in wcsprm::cel\n*   (celprm struct) or wcsprm::spc (spcprm struct).\n*\n*   On the other hand, these routines do change the values of wcsprm::ctype[],\n*   wcsprm::pv[], wcsprm::specsys and other wcsprm struct members as\n*   appropriate to produce the same result as if the FITS header itself had\n*   been translated.\n*\n*   Auxiliary WCS header information not used directly by WCSLIB may also be\n*   translated.  For example, the older DATE-OBS date format (wcsprm::dateobs)\n*   is recast to year-2000 standard form, and MJD-OBS (wcsprm::mjdobs) will be\n*   deduced from it if not already set.\n*\n*   Certain combinations of keyvalues that result in malformed coordinate\n*   systems, as described in Sect. 7.3.4 of Paper I, may also be repaired.\n*   These are handled by cylfix().\n*\n* Non-standard keywords:\n* ----------------------\n*   The AIPS-convention CROTAn keywords are recognized as quasi-standard\n*   and as such are accomodated by wcsprm::crota[] and translated to\n*   wcsprm::pc[][] by wcsset().  These are not dealt with here, nor are any\n*   other non-standard keywords since these routines work only on the contents\n*   of a wcsprm struct and do not deal with FITS headers per se.  In\n*   particular, they do not identify or translate CD00i00j, PC00i00j, PROJPn,\n*   EPOCH, VELREF or VSOURCEa keywords; this may be done by the FITS WCS\n*   header parser supplied with WCSLIB, refer to wcshdr.h.\n*\n* wcsfix() and wcsfixi() apply all of the corrections handled by the following\n* specific functions, which may also be invoked separately:\n*\n*   - cdfix(): Sets the diagonal element of the CDi_ja matrix to 1.0 if all\n*     CDi_ja keywords associated with a particular axis are omitted.\n*\n*   - datfix(): recast an older DATE-OBS date format in dateobs to year-2000\n*     standard form.  Derive dateref from mjdref if not already set.\n*     Alternatively, if dateref is set and mjdref isn't, then derive mjdref\n*     from it.  If both are set, then check consistency.  Likewise for dateobs\n*     and mjdobs; datebeg and mjdbeg; dateavg and mjdavg; and dateend and\n*     mjdend.\n*\n*   - obsfix(): if only one half of obsgeo[] is set, then derive the other\n*     half from it.  If both halves are set, then check consistency.\n*\n*   - unitfix(): translate some commonly used but non-standard unit strings in\n*     the CUNITia keyvalues, e.g. 'DEG' -> 'deg'.\n*\n*   - spcfix(): translate AIPS-convention spectral types, 'FREQ-LSR',\n*     'FELO-HEL', etc., in ctype[] as set from CTYPEia.\n*\n*   - celfix(): translate AIPS-convention celestial projection types, NCP and\n*     GLS, in ctype[] as set from CTYPEia.\n*\n*   - cylfix(): fixes WCS keyvalues for malformed cylindrical projections that\n*     suffer from the problem described in Sect. 7.3.4 of Paper I.\n*\n*\n* wcsfix() - Translate a non-standard WCS struct\n* ----------------------------------------------\n* wcsfix() is identical to wcsfixi(), but lacks the info argument.\n*\n*\n* wcsfixi() - Translate a non-standard WCS struct\n* -----------------------------------------------\n* wcsfixi() applies all of the corrections handled separately by cdfix(),\n* datfix(), obsfix(), unitfix(), spcfix(), celfix(), and cylfix().\n*\n* Given:\n*   ctrl      int       Do potentially unsafe translations of non-standard\n*                       unit strings as described in the usage notes to\n*                       wcsutrn().\n*\n*   naxis     const int []\n*                       Image axis lengths.  If this array pointer is set to\n*                       zero then cylfix() will not be invoked.\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.\n*\n* Returned:\n*   stat      int [NWCSFIX]\n*                       Status returns from each of the functions.  Use the\n*                       preprocessor macros NWCSFIX to dimension this vector\n*                       and CDFIX, DATFIX, OBSFIX, UNITFIX, SPCFIX, CELFIX,\n*                       and CYLFIX to access its elements.  A status value\n*                       of -2 is set for functions that were not invoked.\n*\n*   info      struct wcserr [NWCSFIX]\n*                       Status messages from each of the functions.  Use the\n*                       preprocessor macros NWCSFIX to dimension this vector\n*                       and CDFIX, DATFIX, OBSFIX, UNITFIX, SPCFIX, CELFIX,\n*                       and CYLFIX to access its elements.\n*\n*                       Note that the memory allocated by wcsfixi() for the\n*                       message in each wcserr struct (wcserr::msg, if\n*                       non-zero) must be freed by the user.  See\n*                       wcsdealloc().\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: One or more of the translation functions\n*                            returned an error.\n*\n*\n* cdfix() - Fix erroneously omitted CDi_ja keywords\n* -------------------------------------------------\n* cdfix() sets the diagonal element of the CDi_ja matrix to unity if all\n* CDi_ja keywords associated with a given axis were omitted.  According to WCS\n* Paper I, if any CDi_ja keywords at all are given in a FITS header then those\n* not given default to zero.  This results in a singular matrix with an\n* intersecting row and column of zeros.\n*\n* cdfix() is expected to be invoked before wcsset(), which will fail if these\n* errors have not been corrected.\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                        -1: No change required (not an error).\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*\n*\n* datfix() - Translate DATE-OBS and derive MJD-OBS or vice versa\n* --------------------------------------------------------------\n* datfix() translates the old DATE-OBS date format set in wcsprm::dateobs to\n* year-2000 standard form (yyyy-mm-ddThh:mm:ss).  It derives wcsprm::dateref\n* from wcsprm::mjdref if not already set.  Alternatively, if dateref is set\n* and mjdref isn't, then it derives mjdref from it.  If both are set but\n* disagree by more than 0.001 day (86.4 seconds) then an error status is\n* returned.  Likewise for wcsprm::dateobs and wcsprm::mjdobs; wcsprm::datebeg\n* and wcsprm::mjdbeg; wcsprm::dateavg and wcsprm::mjdavg; and wcsprm::dateend\n* and wcsprm::mjdend.\n*\n* If neither dateobs nor mjdobs are set, but wcsprm::jepoch (primarily) or\n* wcsprm::bepoch is, then both are derived from it.  If jepoch and/or bepoch\n* are set but disagree with dateobs or mjdobs by more than 0.000002 year\n* (63.2 seconds), an informative message is produced.\n*\n* The translations done by datfix() do not affect and are not affected by\n* wcsset().\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.\n*                       wcsprm::dateref and/or wcsprm::mjdref may be changed.\n*                       wcsprm::dateobs and/or wcsprm::mjdobs may be changed.\n*                       wcsprm::datebeg and/or wcsprm::mjdbeg may be changed.\n*                       wcsprm::dateavg and/or wcsprm::mjdavg may be changed.\n*                       wcsprm::dateend and/or wcsprm::mjdend may be changed.\n*\n* Function return value:\n*             int       Status return value:\n*                        -1: No change required (not an error).\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         5: Invalid parameter value.\n*\n*                       For returns >= 0, a detailed message, whether\n*                       informative or an error message, may be set in\n*                       wcsprm::err if enabled, see wcserr_enable(), with\n*                       wcsprm::err.status set to FIXERR_DATE_FIX.\n*\n* Notes:\n*   1: The MJD algorithms used by datfix() are from D.A. Hatcher, 1984, QJRAS,\n*      25, 53-55, as modified by P.T. Wallace for use in SLALIB subroutines\n*      CLDJ and DJCL.\n*\n*\n* obsfix() - complete the OBSGEO-[XYZLBH] vector of observatory coordinates\n* -------------------------------------------------------------------------\n* obsfix() completes the wcsprm::obsgeo vector of observatory coordinates.\n* That is, if only the (x,y,z) Cartesian coordinate triplet or the (l,b,h)\n* geodetic coordinate triplet are set, then it derives the other triplet from\n* it.  If both triplets are set, then it checks for consistency at the level\n* of 1 metre.\n*\n* The operations done by obsfix() do not affect and are not affected by\n* wcsset().\n*\n* Given:\n*   ctrl      int       Flag that controls behaviour if one triplet is\n*                       defined and the other is only partially defined:\n*                         0: Reset only the undefined elements of an\n*                            incomplete coordinate triplet.\n*                         1: Reset all elements of an incomplete triplet.\n*                         2: Don't make any changes, check for consistency\n*                            only.  Returns an error if either of the two\n*                            triplets is incomplete.\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.\n*                       wcsprm::obsgeo may be changed.\n*\n* Function return value:\n*             int       Status return value:\n*                        -1: No change required (not an error).\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         5: Invalid parameter value.\n*\n*                       For returns >= 0, a detailed message, whether\n*                       informative or an error message, may be set in\n*                       wcsprm::err if enabled, see wcserr_enable(), with\n*                       wcsprm::err.status set to FIXERR_OBS_FIX.\n*\n* Notes:\n*   1: While the International Terrestrial Reference System (ITRS) is based\n*      solely on Cartesian coordinates, it recommends the use of the GRS80\n*      ellipsoid in converting to geodetic coordinates.  However, while WCS\n*      Paper III recommends ITRS Cartesian coordinates, Paper VII prescribes\n*      the use of the IAU(1976) ellipsoid for geodetic coordinates, and\n*      consequently that is what is used here.\n*\n*   2: For reference, parameters of commonly used global reference ellipsoids:\n*\n=          a (m)          1/f                    Standard\n=        ---------  -------------  --------------------------------\n=        6378140    298.2577        IAU(1976)\n=        6378137    298.257222101   GRS80\n=        6378137    298.257223563   WGS84\n=        6378136    298.257         IERS(1989)\n=        6378136.6  298.25642       IERS(2003,2010), IAU(2009/2012)\n*\n*      where f = (a - b) / a is the flattening, and a and b are the semi-major\n*      and semi-minor radii in metres.\n*\n*   3: The transformation from geodetic (lng,lat,hgt) to Cartesian (x,y,z) is\n*\n=        x = (n + hgt)*coslng*coslat,\n=        y = (n + hgt)*sinlng*coslat,\n=        z = (n*(1.0 - e^2) + hgt)*sinlat,\n*\n*      where the \"prime vertical radius\", n, is a function of latitude\n*\n=        n = a / sqrt(1 - (e*sinlat)^2),\n*\n*      and a, the equatorial radius, and e^2 = (2 - f)*f, the (first)\n*      eccentricity of the ellipsoid, are constants.  obsfix() inverts these\n*      iteratively by writing\n*\n=           x = rho*coslng*coslat,\n=           y = rho*sinlng*coslat,\n=        zeta = rho*sinlat,\n*\n*      where\n*\n=         rho = n + hgt,\n=             = sqrt(x^2 + y^2 + zeta^2),\n=        zeta = z / (1 - n*e^2/rho),\n*\n*      and iterating over the value of zeta.  Since e is small, a good first\n*      approximation is given by zeta = z.\n*\n*\n* unitfix() - Correct aberrant CUNITia keyvalues\n* ----------------------------------------------\n* unitfix() applies wcsutrn() to translate non-standard CUNITia keyvalues,\n* e.g. 'DEG' -> 'deg', also stripping off unnecessary whitespace.\n*\n* unitfix() is expected to be invoked before wcsset(), which will fail if\n* non-standard CUNITia keyvalues have not been translated.\n*\n* Given:\n*   ctrl      int       Do potentially unsafe translations described in the\n*                       usage notes to wcsutrn().\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                        -1: No change required (not an error).\n*                         0: Success (an alias was applied).\n*                         1: Null wcsprm pointer passed.\n*\n*                       When units are translated (i.e. 0 is returned), an\n*                       informative message is set in wcsprm::err if enabled,\n*                       see wcserr_enable(), with wcsprm::err.status set to\n*                       FIXERR_UNITS_ALIAS.\n*\n*\n* spcfix() - Translate AIPS-convention spectral types\n* ---------------------------------------------------\n* spcfix() translates AIPS-convention spectral coordinate types,\n* '{FREQ,FELO,VELO}-{LSR,HEL,OBS}' (e.g. 'FREQ-OBS', 'FELO-HEL', 'VELO-LSR')\n* set in wcsprm::ctype[], subject to VELREF set in wcsprm::velref.\n*\n* Note that if wcs::specsys is already set then it will not be overridden.\n*\n* AIPS-convention spectral types set in CTYPEia are translated on-the-fly by\n* wcsset() but without modifying wcsprm::ctype[] or wcsprm::specsys.  That is,\n* only the information extracted from wcsprm::ctype[] is translated when\n* wcsset() fills in wcsprm::spc (spcprm struct).  spcfix() modifies\n* wcsprm::ctype[] so that if the header is subsequently written out, e.g. by\n* wcshdo(), then it will contain translated CTYPEia keyvalues.\n*\n* The operations done by spcfix() do not affect and are not affected by\n* wcsset().\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.  wcsprm::ctype[]\n*                       and/or wcsprm::specsys may be changed.\n*\n* Function return value:\n*             int       Status return value:\n*                        -1: No change required (not an error).\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Linear transformation matrix is singular.\n*                         4: Inconsistent or unrecognized coordinate axis\n*                            types.\n*                         5: Invalid parameter value.\n*                         6: Invalid coordinate transformation parameters.\n*                         7: Ill-conditioned coordinate transformation\n*                            parameters.\n*\n*                       For returns >= 0, a detailed message, whether\n*                       informative or an error message, may be set in\n*                       wcsprm::err if enabled, see wcserr_enable(), with\n*                       wcsprm::err.status set to FIXERR_SPC_UPDTE.\n*\n*\n* celfix() - Translate AIPS-convention celestial projection types\n* ---------------------------------------------------------------\n* celfix() translates AIPS-convention celestial projection types, NCP and\n* GLS, set in the ctype[] member of the wcsprm struct.\n*\n* Two additional pv[] keyvalues are created when translating NCP, and three\n* are created when translating GLS with non-zero reference point.  If the pv[]\n* array was initially allocated by wcsini() then the array will be expanded if\n* necessary.  Otherwise, error 2 will be returned if sufficient empty slots\n* are not already available for use.\n*\n* AIPS-convention celestial projection types set in CTYPEia are translated\n* on-the-fly by wcsset() but without modifying wcsprm::ctype[], wcsprm::pv[],\n* or wcsprm::npv.  That is, only the information extracted from\n* wcsprm::ctype[] is translated when wcsset() fills in wcsprm::cel (celprm\n* struct).  celfix() modifies wcsprm::ctype[], wcsprm::pv[], and wcsprm::npv\n* so that if the header is subsequently written out, e.g. by wcshdo(), then it\n* will contain translated CTYPEia keyvalues and the relevant PVi_ma.\n*\n* The operations done by celfix() do not affect and are not affected by\n* wcsset().  However, it uses information in the wcsprm struct provided by\n* wcsset(), and will invoke it if necessary.\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.  wcsprm::ctype[]\n*                       and/or wcsprm::pv[] may be changed.\n*\n* Function return value:\n*             int       Status return value:\n*                        -1: No change required (not an error).\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Linear transformation matrix is singular.\n*                         4: Inconsistent or unrecognized coordinate axis\n*                            types.\n*                         5: Invalid parameter value.\n*                         6: Invalid coordinate transformation parameters.\n*                         7: Ill-conditioned coordinate transformation\n*                            parameters.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       wcsprm::err if enabled, see wcserr_enable().\n*\n*\n* cylfix() - Fix malformed cylindrical projections\n* ------------------------------------------------\n* cylfix() fixes WCS keyvalues for malformed cylindrical projections that\n* suffer from the problem described in Sect. 7.3.4 of Paper I.\n*\n* cylfix() requires the wcsprm struct to have been set up by wcsset(), and\n* will invoke it if necessary.  After modification, the struct is reset on\n* return with an explicit call to wcsset().\n*\n* Given:\n*   naxis     const int []\n*                       Image axis lengths.\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                        -1: No change required (not an error).\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Linear transformation matrix is singular.\n*                         4: Inconsistent or unrecognized coordinate axis\n*                            types.\n*                         5: Invalid parameter value.\n*                         6: Invalid coordinate transformation parameters.\n*                         7: Ill-conditioned coordinate transformation\n*                            parameters.\n*                         8: All of the corner pixel coordinates are invalid.\n*                         9: Could not determine reference pixel coordinate.\n*                        10: Could not determine reference pixel value.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       wcsprm::err if enabled, see wcserr_enable().\n*\n*\n* wcspcx() - regularize PCi_j\n* ---------------------------\n* wcspcx() \"regularizes\" the linear transformation matrix component of the\n* coordinate transformation (PCi_ja) to make it more human-readable.\n*\n* Normally, upon encountering a FITS header containing a CDi_ja matrix,\n* wcsset() simply treats it as PCi_ja and sets CDELTia to unity.  However,\n* wcspcx() decomposes CDi_ja into PCi_ja and CDELTia in such a way that\n* CDELTia form meaningful scaling parameters.  In practice, the residual\n* PCi_ja matrix will often then be orthogonal, i.e. unity, or describing a\n* pure rotation, axis permutation, or reflection, or a combination thereof.\n*\n* The decomposition is based on normalizing the length in the transformed\n* system (i.e. intermediate pixel coordinates) of the orthonormal basis\n* vectors of the pixel coordinate system.  This deviates slightly from the\n* prescription given by Eq. (4) of WCS Paper I, namely Sum(j=1,N)(PCi_ja)² = 1,\n* in replacing the sum over j with the sum over i.  Consequently, the columns\n* of PCi_ja will consist of unit vectors.  In practice, especially in cubes\n* and higher dimensional images, at least some pairs of these unit vectors, if\n* not all, will often be orthogonal or close to orthogonal.\n*\n* The sign of CDELTia is chosen to make the PCi_ja matrix as close to the,\n* possibly permuted, unit matrix as possible, except that where the coordinate\n* description contains a pair of celestial axes, the sign of CDELTia is set\n* negative for the longitude axis and positive for the latitude axis.\n*\n* Optionally, rows of the PCi_ja matrix may also be permuted to diagonalize\n* it as far as possible, thus undoing any transposition of axes in the\n* intermediate pixel coordinate system.\n*\n* If the coordinate description contains a celestial plane, then the angle of\n* rotation of each of the basis vectors associated with the celestial axes is\n* returned.  For a pure rotation the two angles should be identical.  Any\n* difference between them is a measure of axis skewness.\n*\n* The decomposition is not performed for axes involving a sequent distortion\n* function that is defined in terms of CDi_ja, such as TPV, TNX, or ZPX, which\n* always are.  The independent variables of the polynomial are therefore\n* intermediate world coordinates rather than intermediate pixel coordinates.\n* Because sequent distortions are always applied before CDELTia, if CDi_ja was\n* translated to PCi_ja plus CDELTia, then the distortion would be altered\n* unless the polynomial coefficients were also adjusted to account for the\n* change of scale.\n*\n* wcspcx() requires the wcsprm struct to have been set up by wcsset(), and\n* will invoke it if necessary.  The wcsprm struct is reset on return with an\n* explicit call to wcsset().\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.\n*\n* Given:\n*   dopc      int       If 1, then PCi_ja and CDELTia, as given, will be\n*                       recomposed according to the above prescription.  If 0,\n*                       the operation is restricted to decomposing CDi_ja.\n*\n*   permute   int       If 1, then after decomposition (or recomposition),\n*                       permute rows of PCi_ja to make the axes of the\n*                       intermediate pixel coordinate system match as closely\n*                       as possible those of the pixel coordinates.  That is,\n*                       make it as close to a diagonal matrix as possible.\n*                       However, celestial axes are special in always being\n*                       paired, with the longitude axis preceding the latitude\n*                       axis.\n*\n*                       All WCS entities indexed by i, such as CTYPEia,\n*                       CRVALia, CDELTia, etc., including coordinate lookup\n*                       tables, will also be permuted as necessary to account\n*                       for the change to PCi_ja.  This does not apply to\n*                       CRPIXja, nor prior distortion functions.  These\n*                       operate on pixel coordinates, which are not affected\n*                       by the permutation.\n*\n* Returned:\n*   rotn      double[2] Rotation angle [deg] of each basis vector associated\n*                       with the celestial axes.  For a pure rotation the two\n*                       angles should be identical.  Any difference between\n*                       them is a measure of axis skewness.\n*\n*                       May be set to the NULL pointer if this information is\n*                       not required.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         2: Memory allocation failed.\n*                         5: CDi_j matrix not used.\n*                         6: Sequent distortion function present.\n*\n*\n* Global variable: const char *wcsfix_errmsg[] - Status return messages\n* ---------------------------------------------------------------------\n* Error messages to match the status value returned from each function.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_WCSFIX\n#define WCSLIB_WCSFIX\n\n#include \"wcs.h\"\n#include \"wcserr.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define CDFIX    0\n#define DATFIX   1\n#define OBSFIX   2\n#define UNITFIX  3\n#define SPCFIX   4\n#define CELFIX   5\n#define CYLFIX   6\n#define NWCSFIX  7\n\nextern const char *wcsfix_errmsg[];\n#define cylfix_errmsg wcsfix_errmsg\n\nenum wcsfix_errmsg_enum {\n  FIXERR_OBSGEO_FIX       = -5, // Observatory coordinates amended.\n  FIXERR_DATE_FIX         = -4, // Date string reformatted.\n  FIXERR_SPC_UPDATE       = -3, // Spectral axis type modified.\n  FIXERR_UNITS_ALIAS      = -2,\t// Units alias translation.\n  FIXERR_NO_CHANGE        = -1,\t// No change.\n  FIXERR_SUCCESS          =  0,\t// Success.\n  FIXERR_NULL_POINTER     =  1,\t// Null wcsprm pointer passed.\n  FIXERR_MEMORY           =  2,\t// Memory allocation failed.\n  FIXERR_SINGULAR_MTX     =  3,\t// Linear transformation matrix is singular.\n  FIXERR_BAD_CTYPE        =  4,\t// Inconsistent or unrecognized coordinate\n\t\t\t\t// axis types.\n  FIXERR_BAD_PARAM        =  5,\t// Invalid parameter value.\n  FIXERR_BAD_COORD_TRANS  =  6,\t// Invalid coordinate transformation\n\t\t\t\t// parameters.\n  FIXERR_ILL_COORD_TRANS  =  7,\t// Ill-conditioned coordinate transformation\n\t\t\t\t// parameters.\n  FIXERR_BAD_CORNER_PIX   =  8,\t// All of the corner pixel coordinates are\n\t\t\t\t// invalid.\n  FIXERR_NO_REF_PIX_COORD =  9,\t// Could not determine reference pixel\n\t\t\t\t// coordinate.\n  FIXERR_NO_REF_PIX_VAL   = 10\t// Could not determine reference pixel value.\n};\n\nint wcsfix(int ctrl, const int naxis[], struct wcsprm *wcs, int stat[]);\n\nint wcsfixi(int ctrl, const int naxis[], struct wcsprm *wcs, int stat[],\n            struct wcserr info[]);\n\nint cdfix(struct wcsprm *wcs);\n\nint datfix(struct wcsprm *wcs);\n\nint obsfix(int ctrl, struct wcsprm *wcs);\n\nint unitfix(int ctrl, struct wcsprm *wcs);\n\nint spcfix(struct wcsprm *wcs);\n\nint celfix(struct wcsprm *wcs);\n\nint cylfix(const int naxis[], struct wcsprm *wcs);\n\nint wcspcx(struct wcsprm *wcs, int dopc, int permute, double rotn[2]);\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WCSLIB_WCSFIX\n"},{"id":16566,"name":"wcsprintf.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsprintf.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <stdarg.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n#include \"wcsprintf.h\"\n\nstatic FILE  *wcsprintf_file = 0x0;\nstatic char  *wcsprintf_buff = 0x0;\nstatic char  *wcsprintf_bufp = 0x0;\nstatic size_t wcsprintf_size = 0;\n\n//----------------------------------------------------------------------------\n\nint wcsprintf_set(FILE *wcsout)\n\n{\n  if (wcsout != 0x0) {\n    // Output to file.\n    wcsprintf_file = wcsout;\n\n    if (wcsprintf_buff != 0x0) {\n      // Release the buffer.\n      free(wcsprintf_buff);\n      wcsprintf_buff = 0x0;\n    }\n\n  } else {\n    // Output to buffer.\n    wcsprintf_file = 0x0;\n\n    if (wcsprintf_buff == 0x0) {\n      // Allocate a buffer.\n      wcsprintf_buff = malloc(1024);\n      if (wcsprintf_buff == NULL) {\n        return 1;\n      }\n      wcsprintf_size = 1024;\n    }\n\n    // Reset pointer to the start of the buffer.\n    wcsprintf_bufp = wcsprintf_buff;\n    *wcsprintf_bufp = '\\0';\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nconst char *wcsprintf_buf(void)\n\n{\n  return wcsprintf_buff;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsprintf(const char *format, ...)\n\n{\n  char *realloc_buff;\n  int  nbytes;\n  size_t  used;\n  va_list arg_list;\n\n  if (wcsprintf_buff == 0x0 && wcsprintf_file == 0x0) {\n    // Send output to stdout if wcsprintf_set() hasn't been called.\n    wcsprintf_file = stdout;\n  }\n\n  va_start(arg_list, format);\n\n  if (wcsprintf_file) {\n    // Output to file.\n    nbytes = vfprintf(wcsprintf_file, format, arg_list);\n\n  } else {\n    // Output to buffer.\n    used = wcsprintf_bufp - wcsprintf_buff;\n    if (wcsprintf_size - used < 128) {\n      // Expand the buffer.\n      wcsprintf_size += 1024;\n      realloc_buff = realloc(wcsprintf_buff, wcsprintf_size);\n      if (realloc_buff == NULL) {\n        free(wcsprintf_buff);\n        wcsprintf_buff = 0x0;\n        return 1;\n      }\n      wcsprintf_buff = realloc_buff;\n      wcsprintf_bufp = wcsprintf_buff + used;\n    }\n\n    nbytes = vsprintf(wcsprintf_bufp, format, arg_list);\n    wcsprintf_bufp += nbytes;\n  }\n\n  va_end(arg_list);\n\n  return nbytes;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsfprintf(FILE *stream, const char *format, ...)\n\n{\n  char *realloc_buff;\n  int  nbytes;\n  size_t  used;\n  va_list arg_list;\n\n  if (wcsprintf_buff == 0x0 && wcsprintf_file == 0x0) {\n    // Send output to stream if wcsprintf_set() hasn't been called.\n    wcsprintf_file = stream;\n  }\n\n  va_start(arg_list, format);\n\n  if (wcsprintf_file) {\n    // Output to file.\n    nbytes = vfprintf(wcsprintf_file, format, arg_list);\n\n  } else {\n    // Output to buffer.\n    used = wcsprintf_bufp - wcsprintf_buff;\n    if (wcsprintf_size - used < 128) {\n      // Expand the buffer.\n      wcsprintf_size += 1024;\n      realloc_buff = realloc(wcsprintf_buff, wcsprintf_size);\n      if (realloc_buff == NULL) {\n        free(wcsprintf_buff);\n        wcsprintf_buff = 0x0;\n        return 1;\n      }\n      wcsprintf_buff = realloc_buff;\n      wcsprintf_bufp = wcsprintf_buff + used;\n    }\n\n    nbytes = vsprintf(wcsprintf_bufp, format, arg_list);\n    wcsprintf_bufp += nbytes;\n  }\n\n  va_end(arg_list);\n\n  return nbytes;\n}\n"},{"id":16567,"name":"wcstrig.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcstrig.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the wcstrig routines\n* -------------------------------\n* When dealing with celestial coordinate systems and spherical projections\n* (some moreso than others) it is often desirable to use an angular measure\n* that provides an exact representation of the latitude of the north or south\n* pole.  The WCSLIB routines use the following trigonometric functions that\n* take or return angles in degrees:\n*\n*   - cosd()\n*   - sind()\n*   - tand()\n*   - acosd()\n*   - asind()\n*   - atand()\n*   - atan2d()\n*   - sincosd()\n*\n* These \"trigd\" routines are expected to handle angles that are a multiple of\n* 90 degrees returning an exact result.  Some C implementations provide these\n* as part of a system library and in such cases it may (or may not!) be\n* preferable to use them.  WCSLIB provides wrappers on the standard trig\n* functions based on radian measure, adding tests for multiples of 90 degrees.\n*\n* However, wcstrig.h also provides the choice of using preprocessor macro\n* implementations of the trigd functions that don't test for multiples of\n* 90 degrees (compile with -DWCSTRIG_MACRO).  These are typically 20% faster\n* but may lead to problems near the poles.\n*\n*\n* cosd() - Cosine of an angle in degrees\n* --------------------------------------\n* cosd() returns the cosine of an angle given in degrees.\n*\n* Given:\n*   angle     double    [deg].\n*\n* Function return value:\n*             double    Cosine of the angle.\n*\n*\n* sind() - Sine of an angle in degrees\n* ------------------------------------\n* sind() returns the sine of an angle given in degrees.\n*\n* Given:\n*   angle     double    [deg].\n*\n* Function return value:\n*             double    Sine of the angle.\n*\n*\n* sincosd() - Sine and cosine of an angle in degrees\n* --------------------------------------------------\n* sincosd() returns the sine and cosine of an angle given in degrees.\n*\n* Given:\n*   angle     double    [deg].\n*\n* Returned:\n*   sin       *double   Sine of the angle.\n*\n*   cos       *double   Cosine of the angle.\n*\n* Function return value:\n*             void\n*\n*\n* tand() - Tangent of an angle in degrees\n* ---------------------------------------\n* tand() returns the tangent of an angle given in degrees.\n*\n* Given:\n*   angle     double    [deg].\n*\n* Function return value:\n*             double    Tangent of the angle.\n*\n*\n* acosd() - Inverse cosine, returning angle in degrees\n* ----------------------------------------------------\n* acosd() returns the inverse cosine in degrees.\n*\n* Given:\n*   x         double    in the range [-1,1].\n*\n* Function return value:\n*             double    Inverse cosine of x [deg].\n*\n*\n* asind() - Inverse sine, returning angle in degrees\n* --------------------------------------------------\n* asind() returns the inverse sine in degrees.\n*\n* Given:\n*   y         double    in the range [-1,1].\n*\n* Function return value:\n*             double    Inverse sine of y [deg].\n*\n*\n* atand() - Inverse tangent, returning angle in degrees\n* -----------------------------------------------------\n* atand() returns the inverse tangent in degrees.\n*\n* Given:\n*   s         double\n*\n* Function return value:\n*             double    Inverse tangent of s [deg].\n*\n*\n* atan2d() - Polar angle of (x,y), in degrees\n* -------------------------------------------\n* atan2d() returns the polar angle, beta, in degrees, of polar coordinates\n* (rho,beta) corresponding to Cartesian coordinates (x,y).  It is equivalent\n* to the arg(x,y) function of WCS Paper II, though with transposed arguments.\n*\n* Given:\n*   y         double    Cartesian y-coordinate.\n*\n*   x         double    Cartesian x-coordinate.\n*\n* Function return value:\n*             double    Polar angle of (x,y) [deg].\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_WCSTRIG\n#define WCSLIB_WCSTRIG\n\n#include <math.h>\n\n#include \"wcsconfig.h\"\n\n#ifdef HAVE_SINCOS\n  void sincos(double angle, double *sin, double *cos);\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n#ifdef WCSTRIG_MACRO\n\n// Macro implementation of the trigd functions.\n#include \"wcsmath.h\"\n\n#define cosd(X) cos((X)*D2R)\n#define sind(X) sin((X)*D2R)\n#define tand(X) tan((X)*D2R)\n#define acosd(X) acos(X)*R2D\n#define asind(X) asin(X)*R2D\n#define atand(X) atan(X)*R2D\n#define atan2d(Y,X) atan2(Y,X)*R2D\n#ifdef HAVE_SINCOS\n  #define sincosd(X,S,C) sincos((X)*D2R,(S),(C))\n#else\n  #define sincosd(X,S,C) *(S) = sin((X)*D2R); *(C) = cos((X)*D2R);\n#endif\n\n#else\n\n// Use WCSLIB wrappers or native trigd functions.\n\ndouble cosd(double angle);\ndouble sind(double angle);\nvoid sincosd(double angle, double *sin, double *cos);\ndouble tand(double angle);\ndouble acosd(double x);\ndouble asind(double y);\ndouble atand(double s);\ndouble atan2d(double y, double x);\n\n// Domain tolerance for asin() and acos() functions.\n#define WCSTRIG_TOL 1e-10\n\n#endif // WCSTRIG_MACRO\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WCSLIB_WCSTRIG\n"},{"id":16568,"name":"wcserr.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  Module author: Michael Droettboom\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcserr.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <stdarg.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"wcserr.h\"\n#include \"wcsprintf.h\"\n\nstatic int wcserr_enabled = 0;\n\n//----------------------------------------------------------------------------\n\nint wcserr_enable(int enable)\n\n{\n  return wcserr_enabled = (enable ? 1 : 0);\n}\n\n//----------------------------------------------------------------------------\n\nint wcserr_size(const struct wcserr *err, int sizes[2])\n\n{\n  if (err == 0x0) {\n    sizes[0] = sizes[1] = 0;\n    return 0;\n  }\n\n  // Base size, in bytes.\n  sizes[0] = sizeof(struct wcserr);\n\n  // Total size of allocated memory, in bytes.\n  sizes[1] = 0;\n\n  if (err->msg) {\n    sizes[1] += strlen(err->msg) + 1;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint wcserr_prt(const struct wcserr *err, const char *prefix)\n\n{\n  if (!wcserr_enabled) {\n    wcsprintf(\"Error messaging is not enabled, use wcserr_enable().\\n\");\n    return 2;\n  }\n\n  if (err == 0x0) {\n    return 0;\n  }\n\n  if (err->status) {\n    if (prefix == 0x0) prefix = \"\";\n\n    if (err->status > 0) {\n      wcsprintf(\"%sERROR %d in %s() at line %d of file %s:\\n%s%s.\\n\",\n        prefix, err->status, err->function, err->line_no, err->file, prefix,\n        err->msg);\n    } else {\n      // An informative message only.\n      wcsprintf(\"%sINFORMATIVE message from %s() at line %d of file \"\n        \"%s:\\n%s%s.\\n\", prefix, err->function, err->line_no, err->file,\n        prefix, err->msg);\n    }\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint wcserr_clear(struct wcserr **errp)\n\n{\n  if (*errp) {\n    if ((*errp)->msg) {\n      free((*errp)->msg);\n    }\n    free(*errp);\n    *errp = 0x0;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint wcserr_set(\n  struct wcserr **errp,\n  int status,\n  const char *function,\n  const char *file,\n  int line_no,\n  const char *format,\n  ...)\n\n{\n  int  msglen;\n  struct wcserr *err;\n  va_list argp;\n\n  if (!wcserr_enabled) return status;\n\n  if (errp == 0x0) {\n    return status;\n  }\n  err = *errp;\n\n  if (status) {\n    if (err == 0x0) {\n      *errp = err = calloc(1, sizeof(struct wcserr));\n    }\n\n    if (err == 0x0) {\n      return status;\n    }\n\n    err->status   = status;\n    err->function = function;\n    err->file     = file;\n    err->line_no  = line_no;\n    err->msg      = 0x0;\n\n    // Determine the required message buffer size.\n    va_start(argp, format);\n    msglen = vsnprintf(0x0, 0, format, argp) + 1;\n    va_end(argp);\n\n    if (msglen <= 0 || (err->msg = malloc(msglen)) == 0x0) {\n      wcserr_clear(errp);\n      return status;\n    }\n\n    // Write the message.\n    va_start(argp, format);\n    msglen = vsnprintf(err->msg, msglen, format, argp);\n    va_end(argp);\n\n    if (msglen < 0) {\n      wcserr_clear(errp);\n    }\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint wcserr_copy(const struct wcserr *src, struct wcserr *dst)\n\n{\n  size_t msglen;\n\n  if (src == 0x0) {\n    if (dst) {\n      memset(dst, 0, sizeof(struct wcserr));\n    }\n    return 0;\n  }\n\n  if (dst) {\n    memcpy(dst, src, sizeof(struct wcserr));\n\n    if (src->msg) {\n      msglen = strlen(src->msg) + 1;\n      if ((dst->msg = malloc(msglen))) {\n        strcpy(dst->msg, src->msg);\n      }\n    }\n  }\n\n  return src->status;\n}\n"},{"id":16569,"name":"wcslib.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcslib.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n* Summary of wcslib.h\n* -------------------\n* This header file is provided purely for convenience.  Use it to include all\n* of the separate WCSLIB headers.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_WCSLIB\n#define WCSLIB_WCSLIB\n\n#include \"cel.h\"\n#include \"dis.h\"\n#include \"fitshdr.h\"\n#include \"lin.h\"\n#include \"log.h\"\n#include \"prj.h\"\n#include \"spc.h\"\n#include \"sph.h\"\n#include \"spx.h\"\n#include \"tab.h\"\n#include \"wcs.h\"\n#include \"wcserr.h\"\n#include \"wcsfix.h\"\n#include \"wcshdr.h\"\n#include \"wcsmath.h\"\n#include \"wcsprintf.h\"\n#include \"wcstrig.h\"\n#include \"wcsunits.h\"\n#include \"wcsutil.h\"\n#include \"wtbarr.h\"\n\n#endif // WCSLIB_WCSLIB\n"},{"id":16570,"name":"lin.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: lin.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the lin routines\n* ---------------------------\n* Routines in this suite apply the linear transformation defined by the FITS\n* World Coordinate System (WCS) standard, as described in\n*\n=   \"Representations of world coordinates in FITS\",\n=   Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (WCS Paper I)\n*\n* These routines are based on the linprm struct which contains all information\n* needed for the computations.  The struct contains some members that must be\n* set by the user, and others that are maintained by these routines, somewhat\n* like a C++ class but with no encapsulation.\n*\n* Six routines, linini(), lininit(), lindis(), lindist() lincpy(), and\n* linfree() are provided to manage the linprm struct, linsize() computes its\n* total size including allocated memory, and linprt() prints its contents.\n*\n* linperr() prints the error message(s) (if any) stored in a linprm struct,\n* and the disprm structs that it may contain.\n*\n* A setup routine, linset(), computes intermediate values in the linprm struct\n* from parameters in it that were supplied by the user.  The struct always\n* needs to be set up by linset() but need not be called explicitly - refer to\n* the explanation of linprm::flag.\n*\n* linp2x() and linx2p() implement the WCS linear transformations.\n*\n* An auxiliary routine, linwarp(), computes various measures of the distortion\n* over a specified range of pixel coordinates.\n*\n* An auxiliary matrix inversion routine, matinv(), is included.  It uses\n* LU-triangular factorization with scaled partial pivoting.\n*\n*\n* linini() - Default constructor for the linprm struct\n* ----------------------------------------------------\n* linini() is a thin wrapper on lininit().  It invokes it with ndpmax set\n* to -1 which causes it to use the value of the global variable NDPMAX.  It\n* is thereby potentially thread-unsafe if NDPMAX is altered dynamically via\n* disndp().  Use lininit() for a thread-safe alternative in this case.\n*\n*\n* lininit() - Default constructor for the linprm struct\n* -----------------------------------------------------\n* lininit() allocates memory for arrays in a linprm struct and sets all\n* members of the struct to default values.\n*\n* PLEASE NOTE: every linprm struct must be initialized by lininit(), possibly\n* repeatedly.  On the first invokation, and only the first invokation,\n* linprm::flag must be set to -1 to initialize memory management, regardless\n* of whether lininit() will actually be used to allocate memory.\n*\n* Given:\n*   alloc     int       If true, allocate memory unconditionally for arrays in\n*                       the linprm struct.\n*\n*                       If false, it is assumed that pointers to these arrays\n*                       have been set by the user except if they are null\n*                       pointers in which case memory will be allocated for\n*                       them regardless.  (In other words, setting alloc true\n*                       saves having to initalize these pointers to zero.)\n*\n*   naxis     int       The number of world coordinate axes, used to determine\n*                       array sizes.\n*\n* Given and returned:\n*   lin       struct linprm*\n*                       Linear transformation parameters.  Note that, in order\n*                       to initialize memory management linprm::flag should be\n*                       set to -1 when lin is initialized for the first time\n*                       (memory leaks may result if it had already been\n*                       initialized).\n*\n* Given:\n*   ndpmax    int       The number of DPja or DQia keywords to allocate space\n*                       for.  If set to -1, the value of the global variable\n*                       NDPMAX will be used.  This is potentially\n*                       thread-unsafe if disndp() is being used dynamically to\n*                       alter its value.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null linprm pointer passed.\n*                         2: Memory allocation failed.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       linprm::err if enabled, see wcserr_enable().\n*\n*\n* lindis() - Assign a distortion to a linprm struct\n* -------------------------------------------------\n* lindis() is a thin wrapper on lindist().   It invokes it with ndpmax set\n* to -1 which causes the value of the global variable NDPMAX to be used (by\n* disinit()).  It is thereby potentially thread-unsafe if NDPMAX is altered\n* dynamically via disndp().  Use lindist() for a thread-safe alternative in\n* this case.\n*\n*\n* lindist() - Assign a distortion to a linprm struct\n* --------------------------------------------------\n* lindist() may be used to assign the address of a disprm struct to\n* linprm::dispre or linprm::disseq.  The linprm struct must already have been\n* initialized by lininit().\n*\n* The disprm struct must have been allocated from the heap (e.g. using\n* malloc(), calloc(), etc.).  lindist() will immediately initialize it via a\n* call to disini() using the value of linprm::naxis.  Subsequently, it will be\n* reinitialized by calls to lininit(), and freed by linfree(), neither of\n* which would happen if the disprm struct was assigned directly.\n*\n* If the disprm struct had previously been assigned via lindist(), it will be\n* freed before reassignment.  It is also permissable for a null disprm pointer\n* to be assigned to disable the distortion correction.\n*\n* Given:\n*   sequence  int       Is it a prior or sequent distortion?\n*                         1: Prior,   the assignment is to linprm::dispre.\n*                         2: Sequent, the assignment is to linprm::disseq.\n*\n*                       Anything else is an error.\n*\n* Given and returned:\n*   lin       struct linprm*\n*                       Linear transformation parameters.\n*\n*   dis       struct disprm*\n*                       Distortion function parameters.\n*\n* Given:\n*   ndpmax    int       The number of DPja or DQia keywords to allocate space\n*                       for.  If set to -1, the value of the global variable\n*                       NDPMAX will be used.  This is potentially\n*                       thread-unsafe if disndp() is being used dynamically to\n*                       alter its value.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null linprm pointer passed.\n*                         4: Invalid sequence.\n*\n*\n* lincpy() - Copy routine for the linprm struct\n* ---------------------------------------------\n* lincpy() does a deep copy of one linprm struct to another, using lininit()\n* to allocate memory for its arrays if required.  Only the \"information to be\n* provided\" part of the struct is copied; a call to linset() is required to\n* initialize the remainder.\n*\n* Given:\n*   alloc     int       If true, allocate memory for the crpix, pc, and cdelt\n*                       arrays in the destination.  Otherwise, it is assumed\n*                       that pointers to these arrays have been set by the\n*                       user except if they are null pointers in which case\n*                       memory will be allocated for them regardless.\n*\n*   linsrc    const struct linprm*\n*                       Struct to copy from.\n*\n* Given and returned:\n*   lindst    struct linprm*\n*                       Struct to copy to.  linprm::flag should be set to -1\n*                       if lindst was not previously initialized (memory leaks\n*                       may result if it was previously initialized).\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null linprm pointer passed.\n*                         2: Memory allocation failed.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       linprm::err if enabled, see wcserr_enable().\n*\n*\n* linfree() - Destructor for the linprm struct\n* --------------------------------------------\n* linfree() frees memory allocated for the linprm arrays by lininit() and/or\n* linset().  lininit() keeps a record of the memory it allocates and linfree()\n* will only attempt to free this.\n*\n* PLEASE NOTE: linfree() must not be invoked on a linprm struct that was not\n* initialized by lininit().\n*\n* Given:\n*   lin       struct linprm*\n*                       Linear transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null linprm pointer passed.\n*\n*\n* linsize() - Compute the size of a linprm struct\n* -----------------------------------------------\n* linsize() computes the full size of a linprm struct, including allocated\n* memory.\n*\n* Given:\n*   lin       const struct linprm*\n*                       Linear transformation parameters.\n*\n*                       If NULL, the base size of the struct and the allocated\n*                       size are both set to zero.\n*\n* Returned:\n*   sizes     int[2]    The first element is the base size of the struct as\n*                       returned by sizeof(struct linprm).\n*\n*                       The second element is the total size of memory\n*                       allocated in the struct, in bytes, assuming that the\n*                       allocation was done by linini().  This figure includes\n*                       memory allocated for members of constituent structs,\n*                       such as linprm::dispre.\n*\n*                       It is not an error for the struct not to have been set\n*                       up via linset(), which normally results in additional\n*                       memory allocation.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*\n*\n* linprt() - Print routine for the linprm struct\n* ----------------------------------------------\n* linprt() prints the contents of a linprm struct using wcsprintf().  Mainly\n* intended for diagnostic purposes.\n*\n* Given:\n*   lin       const struct linprm*\n*                       Linear transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null linprm pointer passed.\n*\n*\n* linperr() - Print error messages from a linprm struct\n* -----------------------------------------------------\n* linperr() prints the error message(s) (if any) stored in a linprm struct,\n* and the disprm structs that it may contain.  If there are no errors then\n* nothing is printed.  It uses wcserr_prt(), q.v.\n*\n* Given:\n*   lin       const struct linprm*\n*                       Coordinate transformation parameters.\n*\n*   prefix    const char *\n*                       If non-NULL, each output line will be prefixed with\n*                       this string.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null linprm pointer passed.\n*\n*\n* linset() - Setup routine for the linprm struct\n* ----------------------------------------------\n* linset(), if necessary, allocates memory for the linprm::piximg and\n* linprm::imgpix arrays and sets up the linprm struct according to information\n* supplied within it - refer to the explanation of linprm::flag.\n*\n* Note that this routine need not be called directly; it will be invoked by\n* linp2x() and linx2p() if the linprm::flag is anything other than a\n* predefined magic value.\n*\n* Given and returned:\n*   lin       struct linprm*\n*                       Linear transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null linprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: PCi_ja matrix is singular.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       linprm::err if enabled, see wcserr_enable().\n*\n*\n* linp2x() - Pixel-to-world linear transformation\n* -----------------------------------------------\n* linp2x() transforms pixel coordinates to intermediate world coordinates.\n*\n* Given and returned:\n*   lin       struct linprm*\n*                       Linear transformation parameters.\n*\n* Given:\n*   ncoord,\n*   nelem     int       The number of coordinates, each of vector length nelem\n*                       but containing lin.naxis coordinate elements.\n*\n*   pixcrd    const double[ncoord][nelem]\n*                       Array of pixel coordinates.\n*\n* Returned:\n*   imgcrd    double[ncoord][nelem]\n*                       Array of intermediate world coordinates.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null linprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: PCi_ja matrix is singular.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       linprm::err if enabled, see wcserr_enable().\n*\n*\n* linx2p() - World-to-pixel linear transformation\n* -----------------------------------------------\n* linx2p() transforms intermediate world coordinates to pixel coordinates.\n*\n* Given and returned:\n*   lin       struct linprm*\n*                       Linear transformation parameters.\n*\n* Given:\n*   ncoord,\n*   nelem     int       The number of coordinates, each of vector length nelem\n*                       but containing lin.naxis coordinate elements.\n*\n*   imgcrd   const double[ncoord][nelem]\n*                       Array of intermediate world coordinates.\n*\n* Returned:\n*   pixcrd    double[ncoord][nelem]\n*                       Array of pixel coordinates.\n*\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null linprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: PCi_ja matrix is singular.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       linprm::err if enabled, see wcserr_enable().\n*\n*\n* linwarp() - Compute measures of distortion\n* ------------------------------------------\n* linwarp() computes various measures of the distortion over a specified range\n* of pixel coordinates.\n*\n* All distortion measures are specified as an offset in pixel coordinates,\n* as given directly by prior distortions.  The offset in intermediate pixel\n* coordinates given by sequent distortions is translated back to pixel\n* coordinates by applying the inverse of the linear transformation matrix\n* (PCi_ja or CDi_ja).  The difference may be significant if the matrix\n* introduced a scaling.\n*\n* If all distortions are prior, then linwarp() uses diswarp(), q.v.\n*\n* Given and returned:\n*   lin       struct linprm*\n*                       Linear transformation parameters plus distortions.\n*\n* Given:\n*   pixblc    const double[naxis]\n*                       Start of the range of pixel coordinates (i.e. \"bottom\n*                       left-hand corner\" in the conventional FITS image\n*                       display orientation).  May be specified as a NULL\n*                       pointer which is interpreted as (1,1,...).\n*\n*   pixtrc    const double[naxis]\n*                       End of the range of pixel coordinates (i.e. \"top\n*                       right-hand corner\" in the conventional FITS image\n*                       display orientation).\n*\n*   pixsamp   const double[naxis]\n*                       If positive or zero, the increment on the particular\n*                       axis, starting at pixblc[].  Zero is interpreted as a\n*                       unit increment.  pixsamp may also be specified as a\n*                       NULL pointer which is interpreted as all zeroes, i.e.\n*                       unit increments on all axes.\n*\n*                       If negative, the grid size on the particular axis (the\n*                       absolute value being rounded to the nearest integer).\n*                       For example, if pixsamp is (-128.0,-128.0,...) then\n*                       each axis will be sampled at 128 points between\n*                       pixblc[] and pixtrc[] inclusive.  Use caution when\n*                       using this option on non-square images.\n*\n* Returned:\n*   nsamp     int*      The number of pixel coordinates sampled.\n*\n*                       Can be specified as a NULL pointer if not required.\n*\n*   maxdis    double[naxis]\n*                       For each individual distortion function, the\n*                       maximum absolute value of the distortion.\n*\n*                       Can be specified as a NULL pointer if not required.\n*\n*   maxtot    double*   For the combination of all distortion functions, the\n*                       maximum absolute value of the distortion.\n*\n*                       Can be specified as a NULL pointer if not required.\n*\n*   avgdis    double[naxis]\n*                       For each individual distortion function, the\n*                       mean value of the distortion.\n*\n*                       Can be specified as a NULL pointer if not required.\n*\n*   avgtot    double*   For the combination of all distortion functions, the\n*                       mean value of the distortion.\n*\n*                       Can be specified as a NULL pointer if not required.\n*\n*   rmsdis    double[naxis]\n*                       For each individual distortion function, the\n*                       root mean square deviation of the distortion.\n*\n*                       Can be specified as a NULL pointer if not required.\n*\n*   rmstot    double*   For the combination of all distortion functions, the\n*                       root mean square deviation of the distortion.\n*\n*                       Can be specified as a NULL pointer if not required.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null linprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Invalid parameter.\n*                         4: Distort error.\n*\n*\n* linprm struct - Linear transformation parameters\n* ------------------------------------------------\n* The linprm struct contains all of the information required to perform a\n* linear transformation.  It consists of certain members that must be set by\n* the user (\"given\") and others that are set by the WCSLIB routines\n* (\"returned\").\n*\n*   int flag\n*     (Given and returned) This flag must be set to zero whenever any of the\n*     following members of the linprm struct are set or modified:\n*\n*       - linprm::naxis (q.v., not normally set by the user),\n*       - linprm::pc,\n*       - linprm::cdelt,\n*       - linprm::dispre.\n*       - linprm::disseq.\n*\n*     This signals the initialization routine, linset(), to recompute the\n*     returned members of the linprm struct.  linset() will reset flag to\n*     indicate that this has been done.\n*\n*     PLEASE NOTE: flag should be set to -1 when lininit() is called for the\n*     first time for a particular linprm struct in order to initialize memory\n*     management.  It must ONLY be used on the first initialization otherwise\n*     memory leaks may result.\n*\n*   int naxis\n*     (Given or returned) Number of pixel and world coordinate elements.\n*\n*     If lininit() is used to initialize the linprm struct (as would normally\n*     be the case) then it will set naxis from the value passed to it as a\n*     function argument.  The user should not subsequently modify it.\n*\n*   double *crpix\n*     (Given) Pointer to the first element of an array of double containing\n*     the coordinate reference pixel, CRPIXja.\n*\n*     It is not necessary to reset the linprm struct (via linset()) when\n*     linprm::crpix is changed.\n*\n*   double *pc\n*     (Given) Pointer to the first element of the PCi_ja (pixel coordinate)\n*     transformation matrix.  The expected order is\n*\n=       struct linprm lin;\n=       lin.pc = {PC1_1, PC1_2, PC2_1, PC2_2};\n*\n*     This may be constructed conveniently from a 2-D array via\n*\n=       double m[2][2] = {{PC1_1, PC1_2},\n=                         {PC2_1, PC2_2}};\n*\n*     which is equivalent to\n*\n=       double m[2][2];\n=       m[0][0] = PC1_1;\n=       m[0][1] = PC1_2;\n=       m[1][0] = PC2_1;\n=       m[1][1] = PC2_2;\n*\n*     The storage order for this 2-D array is the same as for the 1-D array,\n*     whence\n*\n=       lin.pc = *m;\n*\n*     would be legitimate.\n*\n*   double *cdelt\n*     (Given) Pointer to the first element of an array of double containing\n*     the coordinate increments, CDELTia.\n*\n*   struct disprm *dispre\n*     (Given) Pointer to a disprm struct holding parameters for prior\n*     distortion functions, or a null (0x0) pointer if there are none.\n*\n*     Function lindist() may be used to assign a disprm pointer to a linprm\n*     struct, allowing it to take control of any memory allocated for it, as\n*     in the following example:\n*\n=       void add_distortion(struct linprm *lin)\n=       {\n=         struct disprm *dispre;\n=\n=         dispre = malloc(sizeof(struct disprm));\n=         dispre->flag = -1;\n=         lindist(1, lin, dispre, ndpmax);\n=           :\n=          (Set up dispre.)\n=           :\n=\n=         return;\n=       }\n*\n*     Here, after the distortion function parameters etc. are copied into\n*     dispre, dispre is assigned using lindist() which takes control of the\n*     allocated memory.  It will be freed later when linfree() is invoked on\n*     the linprm struct.\n*\n*     Consider also the following erroneous code:\n*\n=       void bad_code(struct linprm *lin)\n=       {\n=         struct disprm dispre;\n=\n=         dispre.flag = -1;\n=         lindist(1, lin, &dispre, ndpmax);   // WRONG.\n=           :\n=\n=         return;\n=       }\n*\n*     Here, dispre is declared as a struct, rather than a pointer.  When the\n*     function returns, dispre will go out of scope and its memory will most\n*     likely be reused, thereby trashing its contents.  Later, a segfault will\n*     occur when linfree() tries to free dispre's stale address.\n*\n*   struct disprm *disseq\n*     (Given) Pointer to a disprm struct holding parameters for sequent\n*     distortion functions, or a null (0x0) pointer if there are none.\n*\n*     Refer to the comments and examples given for disprm::dispre.\n*\n*   double *piximg\n*     (Returned) Pointer to the first element of the matrix containing the\n*     product of the CDELTia diagonal matrix and the PCi_ja matrix.\n*\n*   double *imgpix\n*     (Returned) Pointer to the first element of the inverse of the\n*     linprm::piximg matrix.\n*\n*   int i_naxis\n*     (Returned) The dimension of linprm::piximg and linprm::imgpix (normally\n*     equal to naxis).\n*\n*   int unity\n*     (Returned) True if the linear transformation matrix is unity.\n*\n*   int affine\n*     (Returned) True if there are no distortions.\n*\n*   int simple\n*     (Returned) True if unity and no distortions.\n*\n*   struct wcserr *err\n*     (Returned) If enabled, when an error status is returned, this struct\n*     contains detailed information about the error, see wcserr_enable().\n*\n*   double *tmpcrd\n*     (For internal use only.)\n*   int m_flag\n*     (For internal use only.)\n*   int m_naxis\n*     (For internal use only.)\n*   double *m_crpix\n*     (For internal use only.)\n*   double *m_pc\n*     (For internal use only.)\n*   double *m_cdelt\n*     (For internal use only.)\n*   struct disprm *m_dispre\n*     (For internal use only.)\n*   struct disprm *m_disseq\n*     (For internal use only.)\n*\n*\n* Global variable: const char *lin_errmsg[] - Status return messages\n* ------------------------------------------------------------------\n* Error messages to match the status value returned from each function.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_LIN\n#define WCSLIB_LIN\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\nextern const char *lin_errmsg[];\n\nenum lin_errmsg_enum {\n  LINERR_SUCCESS      = 0,\t// Success.\n  LINERR_NULL_POINTER = 1,\t// Null linprm pointer passed.\n  LINERR_MEMORY       = 2,\t// Memory allocation failed.\n  LINERR_SINGULAR_MTX = 3,\t// PCi_ja matrix is singular.\n  LINERR_DISTORT_INIT = 4,\t// Failed to initialise distortions.\n  LINERR_DISTORT      = 5,\t// Distort error.\n  LINERR_DEDISTORT    = 6\t// De-distort error.\n};\n\nstruct linprm {\n  // Initialization flag (see the prologue above).\n  //--------------------------------------------------------------------------\n  int flag;\t\t\t// Set to zero to force initialization.\n\n  // Parameters to be provided (see the prologue above).\n  //--------------------------------------------------------------------------\n  int naxis;\t\t\t// The number of axes, given by NAXIS.\n  double *crpix;\t\t// CRPIXja keywords for each pixel axis.\n  double *pc;\t\t\t// PCi_ja  linear transformation matrix.\n  double *cdelt;\t\t// CDELTia keywords for each coord axis.\n  struct disprm *dispre;\t// Prior   distortion parameters, if any.\n  struct disprm *disseq;\t// Sequent distortion parameters, if any.\n\n  // Information derived from the parameters supplied.\n  //--------------------------------------------------------------------------\n  double *piximg;\t\t// Product of CDELTia and PCi_ja matrices.\n  double *imgpix;\t\t// Inverse of the piximg matrix.\n  int    i_naxis;\t\t// Dimension of piximg and imgpix.\n  int    unity;\t\t\t// True if the PCi_ja matrix is unity.\n  int    affine;\t\t// True if there are no distortions.\n  int    simple;\t\t// True if unity and no distortions.\n\n  // Error handling, if enabled.\n  //--------------------------------------------------------------------------\n  struct wcserr *err;\n\n  // Private - the remainder are for internal use.\n  //--------------------------------------------------------------------------\n  double *tmpcrd;\n\n  int    m_flag, m_naxis;\n  double *m_crpix, *m_pc, *m_cdelt;\n  struct disprm *m_dispre, *m_disseq;\n};\n\n// Size of the linprm struct in int units, used by the Fortran wrappers.\n#define LINLEN (sizeof(struct linprm)/sizeof(int))\n\n\nint linini(int alloc, int naxis, struct linprm *lin);\n\nint lininit(int alloc, int naxis, struct linprm *lin, int ndpmax);\n\nint lindis(int sequence, struct linprm *lin, struct disprm *dis);\n\nint lindist(int sequence, struct linprm *lin, struct disprm *dis, int ndpmax);\n\nint lincpy(int alloc, const struct linprm *linsrc, struct linprm *lindst);\n\nint linfree(struct linprm *lin);\n\nint linsize(const struct linprm *lin, int sizes[2]);\n\nint linprt(const struct linprm *lin);\n\nint linperr(const struct linprm *lin, const char *prefix);\n\nint linset(struct linprm *lin);\n\nint linp2x(struct linprm *lin, int ncoord, int nelem, const double pixcrd[],\n           double imgcrd[]);\n\nint linx2p(struct linprm *lin, int ncoord, int nelem, const double imgcrd[],\n           double pixcrd[]);\n\nint linwarp(struct linprm *lin, const double pixblc[], const double pixtrc[],\n            const double pixsamp[], int *nsamp,\n            double maxdis[], double *maxtot,\n            double avgdis[], double *avgtot,\n            double rmsdis[], double *rmstot);\n\nint matinv(int n, const double mat[], double inv[]);\n\n\n// Deprecated.\n#define linini_errmsg lin_errmsg\n#define lincpy_errmsg lin_errmsg\n#define linfree_errmsg lin_errmsg\n#define linprt_errmsg lin_errmsg\n#define linset_errmsg lin_errmsg\n#define linp2x_errmsg lin_errmsg\n#define linx2p_errmsg lin_errmsg\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WCSLIB_LIN\n"},{"id":16571,"name":"wcs.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcs.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the wcs routines\n* ---------------------------\n* Routines in this suite implement the FITS World Coordinate System (WCS)\n* standard which defines methods to be used for computing world coordinates\n* from image pixel coordinates, and vice versa.  The standard, and proposed\n* extensions for handling distortions, are described in\n*\n=   \"Representations of world coordinates in FITS\",\n=   Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (WCS Paper I)\n=\n=   \"Representations of celestial coordinates in FITS\",\n=   Calabretta, M.R., & Greisen, E.W. 2002, A&A, 395, 1077 (WCS Paper II)\n=\n=   \"Representations of spectral coordinates in FITS\",\n=   Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L.\n=   2006, A&A, 446, 747 (WCS Paper III)\n=\n=   \"Representations of distortions in FITS world coordinate systems\",\n=   Calabretta, M.R. et al. (WCS Paper IV, draft dated 2004/04/22),\n=   available from http://www.atnf.csiro.au/people/Mark.Calabretta\n=\n=   \"Mapping on the HEALPix grid\",\n=   Calabretta, M.R., & Roukema, B.F. 2007, MNRAS, 381, 865 (WCS Paper V)\n=\n=   \"Representing the 'Butterfly' Projection in FITS -- Projection Code XPH\",\n=   Calabretta, M.R., & Lowe, S.R. 2013, PASA, 30, e050 (WCS Paper VI)\n=\n=   \"Representations of time coordinates in FITS -\n=    Time and relative dimension in space\",\n=   Rots, A.H., Bunclark, P.S., Calabretta, M.R., Allen, S.L.,\n=   Manchester, R.N., & Thompson, W.T. 2015, A&A, 574, A36 (WCS Paper VII)\n*\n* These routines are based on the wcsprm struct which contains all information\n* needed for the computations.  The struct contains some members that must be\n* set by the user, and others that are maintained by these routines, somewhat\n* like a C++ class but with no encapsulation.\n*\n* wcsnpv(), wcsnps(), wcsini(), wcsinit(), wcssub(), wcsfree(), and wcstrim(),\n* are provided to manage the wcsprm struct, wcssize() computes its total size\n* including allocated memory, and wcsprt() prints its contents.  Refer to the\n* description of the wcsprm struct for an explanation of the anticipated usage\n* of these routines.  wcscopy(), which does a deep copy of one wcsprm struct\n* to another, is defined as a preprocessor macro function that invokes\n* wcssub().\n*\n* wcsperr() prints the error message(s) (if any) stored in a wcsprm struct,\n* and the linprm, celprm, prjprm, spcprm, and tabprm structs that it contains.\n*\n* A setup routine, wcsset(), computes intermediate values in the wcsprm struct\n* from parameters in it that were supplied by the user.  The struct always\n* needs to be set up by wcsset() but this need not be called explicitly -\n* refer to the explanation of wcsprm::flag.\n*\n* wcsp2s() and wcss2p() implement the WCS world coordinate transformations.\n* In fact, they are high level driver routines for the WCS linear,\n* logarithmic, celestial, spectral and tabular transformation routines\n* described in lin.h, log.h, cel.h, spc.h and tab.h.\n*\n* Given either the celestial longitude or latitude plus an element of the\n* pixel coordinate a hybrid routine, wcsmix(), iteratively solves for the\n* unknown elements.\n*\n* wcsccs() changes the celestial coordinate system of a wcsprm struct, for\n* example, from equatorial to galactic, and wcssptr() translates the spectral\n* axis.  For example, a 'FREQ' axis may be translated into 'ZOPT-F2W' and vice\n* versa.\n*\n* wcslib_version() returns the WCSLIB version number.\n*\n* Quadcube projections:\n* ---------------------\n*   The quadcube projections (TSC, CSC, QSC) may be represented in FITS in\n*   either of two ways:\n*\n*     a: The six faces may be laid out in one plane and numbered as follows:\n*\n=                                 0\n=\n=                        4  3  2  1  4  3  2\n=\n=                                 5\n*\n*        Faces 2, 3 and 4 may appear on one side or the other (or both).  The\n*        world-to-pixel routines map faces 2, 3 and 4 to the left but the\n*        pixel-to-world routines accept them on either side.\n*\n*     b: The \"COBE\" convention in which the six faces are stored in a\n*        three-dimensional structure using a CUBEFACE axis indexed from\n*        0 to 5 as above.\n*\n*   These routines support both methods; wcsset() determines which is being\n*   used by the presence or absence of a CUBEFACE axis in ctype[].  wcsp2s()\n*   and wcss2p() translate the CUBEFACE axis representation to the single\n*   plane representation understood by the lower-level WCSLIB projection\n*   routines.\n*\n*\n* wcsnpv() - Memory allocation for PVi_ma\n* ---------------------------------------\n* wcsnpv() sets or gets the value of NPVMAX (default 64).  This global\n* variable controls the number of pvcard structs, for holding PVi_ma\n* keyvalues, that wcsini() should allocate space for.  It is also used by\n* wcsinit() as the default value of npvmax.\n*\n* PLEASE NOTE: This function is not thread-safe.\n*\n* Given:\n*   n         int       Value of NPVMAX; ignored if < 0.  Use a value less\n*                       than zero to get the current value.\n*\n* Function return value:\n*             int       Current value of NPVMAX.\n*\n*\n* wcsnps() - Memory allocation for PSi_ma\n* ---------------------------------------\n* wcsnps() sets or gets the value of NPSMAX (default 8).  This global variable\n* controls the number of pscard structs, for holding PSi_ma keyvalues, that\n* wcsini() should allocate space for.  It is also used by wcsinit() as the\n* default value of npsmax.\n*\n* PLEASE NOTE: This function is not thread-safe.\n*\n* Given:\n*   n         int       Value of NPSMAX; ignored if < 0.  Use a value less\n*                       than zero to get the current value.\n*\n* Function return value:\n*             int       Current value of NPSMAX.\n*\n*\n* wcsini() - Default constructor for the wcsprm struct\n* ----------------------------------------------------\n* wcsini() is a thin wrapper on wcsinit().  It invokes it with npvmax,\n* npsmax, and ndpmax set to -1 which causes it to use the values of the\n* global variables NDPMAX, NPSMAX, and NDPMAX.  It is thereby potentially\n* thread-unsafe if these variables are altered dynamically via wcsnpv(),\n* wcsnps(), and disndp().  Use wcsinit() for a thread-safe alternative in\n* this case.\n*\n*\n* wcsinit() - Default constructor for the wcsprm struct\n* -----------------------------------------------------\n* wcsinit() optionally allocates memory for arrays in a wcsprm struct and sets\n* all members of the struct to default values.\n*\n* PLEASE NOTE: every wcsprm struct should be initialized by wcsinit(),\n* possibly repeatedly.  On the first invokation, and only the first\n* invokation, wcsprm::flag must be set to -1 to initialize memory management,\n* regardless of whether wcsinit() will actually be used to allocate memory.\n*\n* Given:\n*   alloc     int       If true, allocate memory unconditionally for the\n*                       crpix, etc. arrays.  Please note that memory is never\n*                       allocated by wcsinit() for the auxprm, tabprm, nor\n*                       wtbarr structs.\n*\n*                       If false, it is assumed that pointers to these arrays\n*                       have been set by the user except if they are null\n*                       pointers in which case memory will be allocated for\n*                       them regardless.  (In other words, setting alloc true\n*                       saves having to initalize these pointers to zero.)\n*\n*   naxis     int       The number of world coordinate axes.  This is used to\n*                       determine the length of the various wcsprm vectors and\n*                       matrices and therefore the amount of memory to\n*                       allocate for them.\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.\n*\n*                       Note that, in order to initialize memory management,\n*                       wcsprm::flag should be set to -1 when wcs is\n*                       initialized for the first time (memory leaks may\n*                       result if it had already been initialized).\n*\n* Given:\n*   npvmax    int       The number of PVi_ma keywords to allocate space for.\n*                       If set to -1, the value of the global variable NPVMAX\n*                       will be used.  This is potentially thread-unsafe if\n*                       wcsnpv() is being used dynamically to alter its value.\n*\n*   npsmax    int       The number of PSi_ma keywords to allocate space for.\n*                       If set to -1, the value of the global variable NPSMAX\n*                       will be used.  This is potentially thread-unsafe if\n*                       wcsnps() is being used dynamically to alter its value.\n*\n*   ndpmax    int       The number of DPja or DQia keywords to allocate space\n*                       for.  If set to -1, the value of the global variable\n*                       NDPMAX will be used.  This is potentially\n*                       thread-unsafe if disndp() is being used dynamically to\n*                       alter its value.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         2: Memory allocation failed.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       wcsprm::err if enabled, see wcserr_enable().\n*\n*\n* wcsauxi() - Default constructor for the auxprm struct\n* -----------------------------------------------------\n* wcsauxi() optionally allocates memory for an auxprm struct, attaches it to\n* wcsprm, and sets all members of the struct to default values.\n*\n* Given:\n*   alloc     int       If true, allocate memory unconditionally for the\n*                       auxprm struct.\n*\n*                       If false, it is assumed that wcsprm::aux has already\n*                       been set to point to an auxprm struct, in which case\n*                       the user is responsible for managing that memory.\n*                       However, if wcsprm::aux is a null pointer, memory will\n*                       be allocated regardless.  (In other words, setting\n*                       alloc true saves having to initalize the pointer to\n*                       zero.)\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         2: Memory allocation failed.\n*\n*\n* wcssub() - Subimage extraction routine for the wcsprm struct\n* ------------------------------------------------------------\n* wcssub() extracts the coordinate description for a subimage from a wcsprm\n* struct.  It does a deep copy, using wcsinit() to allocate memory for its\n* arrays if required.  Only the \"information to be provided\" part of the\n* struct is extracted.  Consequently, wcsset() need not have been, and won't\n* be invoked on the struct from which the subimage is extracted.  A call to\n* wcsset() is required to set up the subimage struct.\n*\n* The world coordinate system of the subimage must be separable in the sense\n* that the world coordinates at any point in the subimage must depend only on\n* the pixel coordinates of the axes extracted.  In practice, this means that\n* the linear transformation matrix of the original image must not contain\n* non-zero off-diagonal terms that associate any of the subimage axes with any\n* of the non-subimage axes.  Likewise, if any distortions are associated with\n* the subimage axes, they must not depend on any of the axes that are not\n* being extracted.\n*\n* Note that while the required elements of the tabprm array are extracted, the\n* wtbarr array is not.  (Thus it is not appropriate to call wcssub() after\n* wcstab() but before filling the tabprm structs - refer to wcshdr.h.)\n*\n* wcssub() can also add axes to a wcsprm struct.  The new axes will be created\n* using the defaults set by wcsinit() which produce a simple, unnamed, linear\n* axis with world coordinate equal to the pixel coordinate.  These default\n* values can be changed afterwards, before invoking wcsset().\n*\n* Given:\n*   alloc     int       If true, allocate memory for the crpix, etc. arrays in\n*                       the destination.  Otherwise, it is assumed that\n*                       pointers to these arrays have been set by the user\n*                       except if they are null pointers in which case memory\n*                       will be allocated for them regardless.\n*\n*   wcssrc    const struct wcsprm*\n*                       Struct to extract from.\n*\n* Given and returned:\n*   nsub      int*\n*   axes      int[]     Vector of length *nsub containing the image axis\n*                       numbers (1-relative) to extract.  Order is\n*                       significant; axes[0] is the axis number of the input\n*                       image that corresponds to the first axis in the\n*                       subimage, etc.\n*\n*                       Use an axis number of 0 to create a new axis using\n*                       the defaults set by wcsinit().  They can be changed\n*                       later.\n*\n*                       nsub (the pointer) may be set to zero, and so also may\n*                       *nsub, which is interpreted to mean all axes in the\n*                       input image; the number of axes will be returned if\n*                       nsub != 0x0.  axes itself (the pointer) may be set to\n*                       zero to indicate the first *nsub axes in their\n*                       original order.\n*\n*                       Set both nsub (or *nsub) and axes to zero to do a deep\n*                       copy of one wcsprm struct to another.\n*\n*                       Subimage extraction by coordinate axis type may be\n*                       done by setting the elements of axes[] to the\n*                       following special preprocessor macro values:\n*\n*                         WCSSUB_LONGITUDE: Celestial longitude.\n*                         WCSSUB_LATITUDE:  Celestial latitude.\n*                         WCSSUB_CUBEFACE:  Quadcube CUBEFACE axis.\n*                         WCSSUB_SPECTRAL:  Spectral axis.\n*                         WCSSUB_STOKES:    Stokes axis.\n*\n*                       Refer to the notes (below) for further usage examples.\n*\n*                       On return, *nsub will be set to the number of axes in\n*                       the subimage; this may be zero if there were no axes\n*                       of the required type(s) (in which case no memory will\n*                       be allocated).  axes[] will contain the axis numbers\n*                       that were extracted, or 0 for newly created axes.  The\n*                       vector length must be sufficient to contain all axis\n*                       numbers.  No checks are performed to verify that the\n*                       coordinate axes are consistent, this is done by\n*                       wcsset().\n*\n*   wcsdst    struct wcsprm*\n*                       Struct describing the subimage.  wcsprm::flag should\n*                       be set to -1 if wcsdst was not previously initialized\n*                       (memory leaks may result if it was previously\n*                       initialized).\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         2: Memory allocation failed.\n*                        12: Invalid subimage specification.\n*                        13: Non-separable subimage coordinate system.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       wcsprm::err if enabled, see wcserr_enable().\n*\n* Notes:\n*   1: Combinations of subimage axes of particular types may be extracted in\n*      the same order as they occur in the input image by combining\n*      preprocessor codes, for example\n*\n=        *nsub = 1;\n=        axes[0] = WCSSUB_LONGITUDE | WCSSUB_LATITUDE | WCSSUB_SPECTRAL;\n*\n*      would extract the longitude, latitude, and spectral axes in the same\n*      order as the input image.  If one of each were present, *nsub = 3 would\n*      be returned.\n*\n*      For convenience, WCSSUB_CELESTIAL is defined as the combination\n*      WCSSUB_LONGITUDE | WCSSUB_LATITUDE | WCSSUB_CUBEFACE.\n*\n*      The codes may also be negated to extract all but the types specified,\n*      for example\n*\n=        *nsub = 4;\n=        axes[0] = WCSSUB_LONGITUDE;\n=        axes[1] = WCSSUB_LATITUDE;\n=        axes[2] = WCSSUB_CUBEFACE;\n=        axes[3] = -(WCSSUB_SPECTRAL | WCSSUB_STOKES);\n*\n*      The last of these specifies all axis types other than spectral or\n*      Stokes.  Extraction is done in the order specified by axes[] a\n*      longitude axis (if present) would be extracted first (via axes[0]) and\n*      not subsequently (via axes[3]).  Likewise for the latitude and cubeface\n*      axes in this example.\n*\n*      From the foregoing, it is apparent that the value of *nsub returned may\n*      be less than or greater than that given.  However, it will never exceed\n*      the number of axes in the input image (plus the number of newly-created\n*      axes if any were specified on input).\n*\n*\n* wcscompare() - Compare two wcsprm structs for equality\n* ------------------------------------------------------\n* wcscompare() compares two wcsprm structs for equality.\n*\n* Given:\n*   cmp       int       A bit field controlling the strictness of the\n*                       comparison.  When 0, all fields must be identical.\n*\n*                       The following constants may be or'ed together to\n*                       relax the comparison:\n*                         WCSCOMPARE_ANCILLARY: Ignore ancillary keywords\n*                           that don't change the WCS transformation, such\n*                           as DATE-OBS or EQUINOX.\n*                         WCSCOMPARE_TILING: Ignore integral differences in\n*                           CRPIXja.  This is the 'tiling' condition, where\n*                           two WCSes cover different regions of the same\n*                           map projection and align on the same map grid.\n*                         WCSCOMPARE_CRPIX: Ignore any differences at all in\n*                           CRPIXja.  The two WCSes cover different regions\n*                           of the same map projection but may not align on\n*                           the same map grid.  Overrides WCSCOMPARE_TILING.\n*\n*   tol       double    Tolerance for comparison of floating-point values.\n*                       For example, for tol == 1e-6, all floating-point\n*                       values in the structs must be equal to the first 6\n*                       decimal places.  A value of 0 implies exact equality.\n*\n*   wcs1      const struct wcsprm*\n*                       The first wcsprm struct to compare.\n*\n*   wcs2      const struct wcsprm*\n*                       The second wcsprm struct to compare.\n*\n* Returned:\n*   equal     int*      Non-zero when the given structs are equal.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null pointer passed.\n*\n*\n* wcscopy() macro - Copy routine for the wcsprm struct\n* ----------------------------------------------------\n* wcscopy() does a deep copy of one wcsprm struct to another.  As of\n* WCSLIB 3.6, it is implemented as a preprocessor macro that invokes\n* wcssub() with the nsub and axes pointers both set to zero.\n*\n*\n* wcsfree() - Destructor for the wcsprm struct\n* --------------------------------------------\n* wcsfree() frees memory allocated for the wcsprm arrays by wcsinit() and/or\n* wcsset().  wcsinit() records the memory it allocates and wcsfree() will only\n* attempt to free this.\n*\n* PLEASE NOTE: wcsfree() must not be invoked on a wcsprm struct that was not\n* initialized by wcsinit().\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*\n*\n* wcstrim() - Free unused arrays in the wcsprm struct\n* ---------------------------------------------------\n* wcstrim() frees memory allocated by wcsinit() for arrays in the wcsprm\n* struct that remains unused after it has been set up by wcsset().\n*\n* The free'd array members are associated with FITS WCS keyrecords that are\n* rarely used and usually just bloat the struct: wcsprm::crota, wcsprm::colax,\n* wcsprm::cname, wcsprm::crder, wcsprm::csyer, wcsprm::czphs, and\n* wcsprm::cperi.  If unused, wcsprm::pv, wcsprm::ps, and wcsprm::cd are also\n* freed.\n*\n* Once these arrays have been freed, a test such as\n=\n=        if (!undefined(wcs->cname[i])) {...}\n=\n* must be protected as follows\n=\n=        if (wcs->cname && !undefined(wcs->cname[i])) {...}\n=\n* In addition, if wcsprm::npv is non-zero but less than wcsprm::npvmax, then\n* the unused space in wcsprm::pv will be recovered (using realloc()).\n* Likewise for wcsprm::ps.\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                        14: wcsprm struct is unset.\n*\n*\n* wcssize() - Compute the size of a wcsprm struct\n* -----------------------------------------------\n* wcssize() computes the full size of a wcsprm struct, including allocated\n* memory.\n*\n* Given:\n*   wcs       const struct wcsprm*\n*                       Coordinate transformation parameters.\n*\n*                       If NULL, the base size of the struct and the allocated\n*                       size are both set to zero.\n*\n* Returned:\n*   sizes     int[2]    The first element is the base size of the struct as\n*                       returned by sizeof(struct wcsprm).  The second element\n*                       is the total allocated size, in bytes, assuming that\n*                       the allocation was done by wcsini().  This figure\n*                       includes memory allocated for members of constituent\n*                       structs, such as wcsprm::lin.\n*\n*                       It is not an error for the struct not to have been set\n*                       up via wcsset(), which normally results in additional\n*                       memory allocation. \n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*\n*\n* auxsize() - Compute the size of a auxprm struct\n* -----------------------------------------------\n* auxsize() computes the full size of a auxprm struct, including allocated\n* memory.\n*\n* Given:\n*   aux       const struct auxprm*\n*                       Auxiliary coordinate information.\n*\n*                       If NULL, the base size of the struct and the allocated\n*                       size are both set to zero.\n*\n* Returned:\n*   sizes     int[2]    The first element is the base size of the struct as\n*                       returned by sizeof(struct auxprm).  The second element\n*                       is the total allocated size, in bytes, currently zero.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*\n*\n* wcsprt() - Print routine for the wcsprm struct\n* ----------------------------------------------\n* wcsprt() prints the contents of a wcsprm struct using wcsprintf().  Mainly\n* intended for diagnostic purposes.\n*\n* Given:\n*   wcs       const struct wcsprm*\n*                       Coordinate transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*\n*\n* wcsperr() - Print error messages from a wcsprm struct\n* -----------------------------------------------------\n* wcsperr() prints the error message(s), if any, stored in a wcsprm struct,\n* and the linprm, celprm, prjprm, spcprm, and tabprm structs that it contains.\n* If there are no errors then nothing is printed.  It uses wcserr_prt(), q.v.\n*\n* Given:\n*   wcs       const struct wcsprm*\n*                       Coordinate transformation parameters.\n*\n*   prefix    const char *\n*                       If non-NULL, each output line will be prefixed with\n*                       this string.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*\n*\n* wcsbchk() - Enable/disable bounds checking\n* ------------------------------------------\n* wcsbchk() is used to control bounds checking in the projection routines.\n* Note that wcsset() always enables bounds checking.  wcsbchk() will invoke\n* wcsset() on the wcsprm struct beforehand if necessary.\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.\n*\n* Given:\n*   bounds    int       If bounds&1 then enable strict bounds checking for the\n*                       spherical-to-Cartesian (s2x) transformation for the\n*                       AZP, SZP, TAN, SIN, ZPN, and COP projections.\n*\n*                       If bounds&2 then enable strict bounds checking for the\n*                       Cartesian-to-spherical (x2s) transformation for the\n*                       HPX and XPH projections.\n*\n*                       If bounds&4 then enable bounds checking on the native\n*                       coordinates returned by the Cartesian-to-spherical\n*                       (x2s) transformations using prjchk().\n*\n*                       Zero it to disable all checking.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*\n*\n* wcsset() - Setup routine for the wcsprm struct\n* ----------------------------------------------\n* wcsset() sets up a wcsprm struct according to information supplied within\n* it (refer to the description of the wcsprm struct).\n*\n* wcsset() recognizes the NCP projection and converts it to the equivalent SIN\n* projection and likewise translates GLS into SFL.  It also translates the\n* AIPS spectral types ('FREQ-LSR', 'FELO-HEL', etc.), possibly changing the\n* input header keywords wcsprm::ctype and/or wcsprm::specsys if necessary.\n*\n* Note that this routine need not be called directly; it will be invoked by\n* wcsp2s() and wcss2p() if the wcsprm::flag is anything other than a\n* predefined magic value.\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Linear transformation matrix is singular.\n*                         4: Inconsistent or unrecognized coordinate axis\n*                            types.\n*                         5: Invalid parameter value.\n*                         6: Invalid coordinate transformation parameters.\n*                         7: Ill-conditioned coordinate transformation\n*                            parameters.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       wcsprm::err if enabled, see wcserr_enable().\n*\n* Notes:\n*   1: wcsset() always enables strict bounds checking in the projection\n*      routines (via a call to prjini()).  Use wcsbchk() to modify\n*      bounds-checking after wcsset() is invoked.\n*\n*\n* wcsp2s() - Pixel-to-world transformation\n* ----------------------------------------\n* wcsp2s() transforms pixel coordinates to world coordinates.\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.\n*\n* Given:\n*   ncoord,\n*   nelem     int       The number of coordinates, each of vector length\n*                       nelem but containing wcs.naxis coordinate elements.\n*                       Thus nelem must equal or exceed the value of the\n*                       NAXIS keyword unless ncoord == 1, in which case nelem\n*                       is not used.\n*\n*   pixcrd    const double[ncoord][nelem]\n*                       Array of pixel coordinates.\n*\n* Returned:\n*   imgcrd    double[ncoord][nelem]\n*                       Array of intermediate world coordinates.  For\n*                       celestial axes, imgcrd[][wcs.lng] and\n*                       imgcrd[][wcs.lat] are the projected x-, and\n*                       y-coordinates in pseudo \"degrees\".  For spectral\n*                       axes, imgcrd[][wcs.spec] is the intermediate spectral\n*                       coordinate, in SI units.\n*\n*   phi,theta double[ncoord]\n*                       Longitude and latitude in the native coordinate system\n*                       of the projection [deg].\n*\n*   world     double[ncoord][nelem]\n*                       Array of world coordinates.  For celestial axes,\n*                       world[][wcs.lng] and world[][wcs.lat] are the\n*                       celestial longitude and latitude [deg].  For\n*                       spectral axes, imgcrd[][wcs.spec] is the intermediate\n*                       spectral coordinate, in SI units.\n*\n*   stat      int[ncoord]\n*                       Status return value for each coordinate:\n*                         0: Success.\n*                        1+: A bit mask indicating invalid pixel coordinate\n*                            element(s).\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Linear transformation matrix is singular.\n*                         4: Inconsistent or unrecognized coordinate axis\n*                            types.\n*                         5: Invalid parameter value.\n*                         6: Invalid coordinate transformation parameters.\n*                         7: Ill-conditioned coordinate transformation\n*                            parameters.\n*                         8: One or more of the pixel coordinates were\n*                            invalid, as indicated by the stat vector.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       wcsprm::err if enabled, see wcserr_enable().\n*\n*\n* wcss2p() - World-to-pixel transformation\n* ----------------------------------------\n* wcss2p() transforms world coordinates to pixel coordinates.\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.\n*\n* Given:\n*   ncoord,\n*   nelem     int       The number of coordinates, each of vector length nelem\n*                       but containing wcs.naxis coordinate elements.  Thus\n*                       nelem must equal or exceed the value of the NAXIS\n*                       keyword unless ncoord == 1, in which case nelem is not\n*                       used.\n*\n*   world     const double[ncoord][nelem]\n*                       Array of world coordinates.  For celestial axes,\n*                       world[][wcs.lng] and world[][wcs.lat] are the\n*                       celestial longitude and latitude [deg]. For spectral\n*                       axes, world[][wcs.spec] is the spectral coordinate, in\n*                       SI units.\n*\n* Returned:\n*   phi,theta double[ncoord]\n*                       Longitude and latitude in the native coordinate\n*                       system of the projection [deg].\n*\n*   imgcrd    double[ncoord][nelem]\n*                       Array of intermediate world coordinates.  For\n*                       celestial axes, imgcrd[][wcs.lng] and\n*                       imgcrd[][wcs.lat] are the projected x-, and\n*                       y-coordinates in pseudo \"degrees\".  For quadcube\n*                       projections with a CUBEFACE axis the face number is\n*                       also returned in imgcrd[][wcs.cubeface].  For\n*                       spectral axes, imgcrd[][wcs.spec] is the intermediate\n*                       spectral coordinate, in SI units.\n*\n*   pixcrd    double[ncoord][nelem]\n*                       Array of pixel coordinates.\n*\n*   stat      int[ncoord]\n*                       Status return value for each coordinate:\n*                         0: Success.\n*                        1+: A bit mask indicating invalid world coordinate\n*                            element(s).\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Linear transformation matrix is singular.\n*                         4: Inconsistent or unrecognized coordinate axis\n*                            types.\n*                         5: Invalid parameter value.\n*                         6: Invalid coordinate transformation parameters.\n*                         7: Ill-conditioned coordinate transformation\n*                            parameters.\n*                         9: One or more of the world coordinates were\n*                            invalid, as indicated by the stat vector.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       wcsprm::err if enabled, see wcserr_enable().\n*\n*\n* wcsmix() - Hybrid coordinate transformation\n* -------------------------------------------\n* wcsmix(), given either the celestial longitude or latitude plus an element\n* of the pixel coordinate, solves for the remaining elements by iterating on\n* the unknown celestial coordinate element using wcss2p().  Refer also to the\n* notes below.\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Indices for the celestial coordinates obtained\n*                       by parsing the wcsprm::ctype[].\n*\n* Given:\n*   mixpix    int       Which element of the pixel coordinate is given.\n*\n*   mixcel    int       Which element of the celestial coordinate is given:\n*                         1: Celestial longitude is given in\n*                            world[wcs.lng], latitude returned in\n*                            world[wcs.lat].\n*                         2: Celestial latitude is given in\n*                            world[wcs.lat], longitude returned in\n*                            world[wcs.lng].\n*\n*   vspan     const double[2]\n*                       Solution interval for the celestial coordinate [deg].\n*                       The ordering of the two limits is irrelevant.\n*                       Longitude ranges may be specified with any convenient\n*                       normalization, for example [-120,+120] is the same as\n*                       [240,480], except that the solution will be returned\n*                       with the same normalization, i.e. lie within the\n*                       interval specified.\n*\n*   vstep     const double\n*                       Step size for solution search [deg].  If zero, a\n*                       sensible, although perhaps non-optimal default will be\n*                       used.\n*\n*   viter     int       If a solution is not found then the step size will be\n*                       halved and the search recommenced.  viter controls how\n*                       many times the step size is halved.  The allowed range\n*                       is 5 - 10.\n*\n* Given and returned:\n*   world     double[naxis]\n*                       World coordinate elements.  world[wcs.lng] and\n*                       world[wcs.lat] are the celestial longitude and\n*                       latitude [deg].  Which is given and which returned\n*                       depends on the value of mixcel.  All other elements\n*                       are given.\n*\n* Returned:\n*   phi,theta double[naxis]\n*                       Longitude and latitude in the native coordinate\n*                       system of the projection [deg].\n*\n*   imgcrd    double[naxis]\n*                       Image coordinate elements.  imgcrd[wcs.lng] and\n*                       imgcrd[wcs.lat] are the projected x-, and\n*                       y-coordinates in pseudo \"degrees\".\n*\n* Given and returned:\n*   pixcrd    double[naxis]\n*                       Pixel coordinate.  The element indicated by mixpix is\n*                       given and the remaining elements are returned.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Linear transformation matrix is singular.\n*                         4: Inconsistent or unrecognized coordinate axis\n*                            types.\n*                         5: Invalid parameter value.\n*                         6: Invalid coordinate transformation parameters.\n*                         7: Ill-conditioned coordinate transformation\n*                            parameters.\n*                        10: Invalid world coordinate.\n*                        11: No solution found in the specified interval.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       wcsprm::err if enabled, see wcserr_enable().\n*\n* Notes:\n*   1: Initially the specified solution interval is checked to see if it's a\n*      \"crossing\" interval.  If it isn't, a search is made for a crossing\n*      solution by iterating on the unknown celestial coordinate starting at\n*      the upper limit of the solution interval and decrementing by the\n*      specified step size.  A crossing is indicated if the trial value of the\n*      pixel coordinate steps through the value specified.  If a crossing\n*      interval is found then the solution is determined by a modified form of\n*      \"regula falsi\" division of the crossing interval.  If no crossing\n*      interval was found within the specified solution interval then a search\n*      is made for a \"non-crossing\" solution as may arise from a point of\n*      tangency.  The process is complicated by having to make allowance for\n*      the discontinuities that occur in all map projections.\n*\n*      Once one solution has been determined others may be found by subsequent\n*      invokations of wcsmix() with suitably restricted solution intervals.\n*\n*      Note the circumstance that arises when the solution point lies at a\n*      native pole of a projection in which the pole is represented as a\n*      finite curve, for example the zenithals and conics.  In such cases two\n*      or more valid solutions may exist but wcsmix() only ever returns one.\n*\n*      Because of its generality wcsmix() is very compute-intensive.  For\n*      compute-limited applications more efficient special-case solvers could\n*      be written for simple projections, for example non-oblique cylindrical\n*      projections.\n*\n*\n* wcsccs() - Change celestial coordinate system\n* ---------------------------------------------\n* wcsccs() changes the celestial coordinate system of a wcsprm struct.  For\n* example, from equatorial to galactic coordinates.\n*\n* Parameters that define the spherical coordinate transformation, essentially\n* being three Euler angles, must be provided.  Thereby wcsccs() does not need\n* prior knowledge of specific celestial coordinate systems.  It also has the\n* advantage of making it completely general.\n*\n* Auxiliary members of the wcsprm struct relating to equatorial celestial\n* coordinate systems may also be changed.\n*\n* Only orthodox spherical coordinate systems are supported.  That is, they\n* must be right-handed, with latitude increasing from zero at the equator to\n* +90 degrees at the pole.  This precludes systems such as aziumuth and zenith\n* distance, which, however, could be handled as negative azimuth and\n* elevation.\n*\n* PLEASE NOTE: Information in the wcsprm struct relating to the original\n* coordinate system will be overwritten and therefore lost.  If this is\n* undesirable, invoke wcsccs() on a copy of the struct made with wcssub().\n* The wcsprm struct is reset on return with an explicit call to wcsset().\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.  Particular\n*                       \"values to be given\" elements of the wcsprm struct\n*                       are modified.\n*\n* Given:\n*   lng2p1,\n*   lat2p1    double    Longitude and latitude in the new celestial coordinate\n*                       system of the pole (i.e. latitude +90) of the original\n*                       system [deg].  See notes 1 and 2 below.\n*\n*   lng1p2    double    Longitude in the original celestial coordinate system\n*                       of the pole (i.e. latitude +90) of the new system\n*                       [deg].  See note 1 below.\n*\n*   clng,clat const char*\n*                       Longitude and latitude identifiers of the new CTYPEia\n*                       celestial axis codes, without trailing dashes.  For\n*                       example, \"RA\" and \"DEC\" or \"GLON\" and \"GLAT\".  Up to\n*                       four characters are used, longer strings need not be\n*                       null-terminated.\n*\n*   radesys   const char*\n*                       Used when transforming to equatorial coordinates,\n*                       identified by clng == \"RA\" and clat = \"DEC\".  May be\n*                       set to the null pointer to preserve the current value.\n*                       Up to 71 characters are used, longer strings need not\n*                       be null-terminated.\n*\n*                       If the new coordinate system is anything other than\n*                       equatorial, then wcsprm::radesys will be cleared.\n*\n*   equinox   double    Used when transforming to equatorial coordinates.  May\n*                       be set to zero to preserve the current value.\n*\n*                       If the new coordinate system is not equatorial, then\n*                       wcsprm::equinox will be marked as undefined.\n*\n*   alt       const char*\n*                       Character code for alternate coordinate descriptions\n*                       (i.e. the 'a' in keyword names such as CTYPEia).  This\n*                       is blank for the primary coordinate description, or\n*                       one of the 26 upper-case letters, A-Z.  May be set to\n*                       the null pointer, or null string if no change is\n*                       required.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                        12: Invalid subimage specification (no celestial\n*                            axes).\n*\n* Notes:\n*   1: Follows the prescription given in WCS Paper II, Sect. 2.7 for changing\n*      celestial coordinates.\n*\n*      The implementation takes account of indeterminacies that arise in that\n*      prescription in the particular cases where one of the poles of the new\n*      system is at the fiducial point, or one of them is at the native pole.\n*\n*   2: If lat2p1 == +90, i.e. where the poles of the two coordinate systems\n*      coincide, then the spherical coordinate transformation becomes a simple\n*      change in origin of longitude given by\n*      lng2 = lng1 + (lng2p1 - lng1p2 - 180), and lat2 = lat1, where\n*      (lng2,lat2) are coordinates in the new system, and (lng1,lat1) are\n*      coordinates in the original system.\n*\n*      Likewise, if lat2p1 == -90, then lng2 = -lng1 + (lng2p1 + lng1p2), and\n*      lat2 = -lat1.\n*\n*   3: For example, if the original coordinate system is B1950 equatorial and\n*      the desired new coordinate system is galactic, then\n*\n*      - (lng2p1,lat2p1) are the galactic coordinates of the B1950 celestial\n*        pole, defined by the IAU to be (123.0,+27.4), and lng1p2 is the B1950\n*        right ascension of the galactic pole, defined as 192.25.  Clearly\n*        these coordinates are fixed for a particular coordinate\n*        transformation.\n*\n*      - (clng,clat) would be 'GLON' and 'GLAT', these being the FITS standard\n*        identifiers for galactic coordinates.\n*\n*      - Since the new coordinate system is not equatorial, wcsprm::radesys\n*        and wcsprm::equinox will be cleared.\n*\n*   4. The coordinates required for some common transformations (obtained from\n*      https://ned.ipac.caltech.edu/coordinate_calculator) are as follows:\n*\n=      (123.0000,+27.4000) galactic coordinates of B1950 celestial pole,\n=      (192.2500,+27.4000) B1950 equatorial coordinates of galactic pole.\n*\n=      (122.9319,+27.1283) galactic coordinates of J2000 celestial pole,\n=      (192.8595,+27.1283) J2000 equatorial coordinates of galactic pole.\n*\n=      (359.6774,+89.7217) B1950 equatorial coordinates of J2000 pole,\n=      (180.3162,+89.7217) J2000 equatorial coordinates of B1950 pole.\n*\n=      (270.0000,+66.5542) B1950 equatorial coordinates of B1950 ecliptic pole,\n=      ( 90.0000,+66.5542) B1950 ecliptic coordinates of B1950 celestial pole.\n*\n=      (270.0000,+66.5607) J2000 equatorial coordinates of J2000 ecliptic pole,\n=      ( 90.0000,+66.5607) J2000 ecliptic coordinates of J2000 celestial pole.\n*\n=      ( 26.7315,+15.6441) supergalactic coordinates of B1950 celestial pole,\n=      (283.1894,+15.6441) B1950 equatorial coordinates of supergalactic pole.\n*\n=      ( 26.4505,+15.7089) supergalactic coordinates of J2000 celestial pole,\n=      (283.7542,+15.7089) J2000 equatorial coordinates of supergalactic pole.\n*\n*\n* wcssptr() - Spectral axis translation\n* -------------------------------------\n* wcssptr() translates the spectral axis in a wcsprm struct.  For example, a\n* 'FREQ' axis may be translated into 'ZOPT-F2W' and vice versa.\n*\n* PLEASE NOTE: Information in the wcsprm struct relating to the original\n* coordinate system will be overwritten and therefore lost.  If this is\n* undesirable, invoke wcssptr() on a copy of the struct made with wcssub().\n* The wcsprm struct is reset on return with an explicit call to wcsset().\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.\n*\n*   i         int*      Index of the spectral axis (0-relative).  If given < 0\n*                       it will be set to the first spectral axis identified\n*                       from the ctype[] keyvalues in the wcsprm struct.\n*\n*   ctype     char[9]   Desired spectral CTYPEia.  Wildcarding may be used as\n*                       for the ctypeS2 argument to spctrn() as described in\n*                       the prologue of spc.h, i.e. if the final three\n*                       characters are specified as \"???\", or if just the\n*                       eighth character is specified as '?', the correct\n*                       algorithm code will be substituted and returned.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Linear transformation matrix is singular.\n*                         4: Inconsistent or unrecognized coordinate axis\n*                            types.\n*                         5: Invalid parameter value.\n*                         6: Invalid coordinate transformation parameters.\n*                         7: Ill-conditioned coordinate transformation\n*                            parameters.\n*                        12: Invalid subimage specification (no spectral\n*                            axis).\n*\n*                       For returns > 1, a detailed error message is set in\n*                       wcsprm::err if enabled, see wcserr_enable().\n*\n*\n* wcslib_version() - WCSLIB version number\n* ----------------------------------------\n* wcslib_version() returns the WCSLIB version number.\n*\n* The major version number changes when the ABI changes or when the license\n* conditions change.  ABI changes typically result from a change to the\n* contents of one of the structs.  The major version number is used to\n* distinguish between incompatible versions of the sharable library.\n*\n* The minor version number changes with new functionality or bug fixes that do\n* not involve a change in the ABI.\n*\n* The auxiliary version number (which is often absent) signals changes to the\n* documentation, test suite, build procedures, or any other change that does\n* not affect the compiled library.\n*\n* Returned:\n*   vers[3]   int[3]    The broken-down version number:\n*                         0: Major version number.\n*                         1: Minor version number.\n*                         2: Auxiliary version number (zero if absent).\n*                       May be given as a null pointer if not required.\n*\n* Function return value:\n*             char*     A null-terminated, statically allocated string\n*                       containing the version number in the usual form, i.e.\n*                       \"<major>.<minor>.<auxiliary>\".\n*\n*\n* wcsprm struct - Coordinate transformation parameters\n* ----------------------------------------------------\n* The wcsprm struct contains information required to transform world\n* coordinates.  It consists of certain members that must be set by the user\n* (\"given\") and others that are set by the WCSLIB routines (\"returned\").\n* While the addresses of the arrays themselves may be set by wcsinit() if it\n* (optionally) allocates memory, their contents must be set by the user.\n*\n* Some parameters that are given are not actually required for transforming\n* coordinates.  These are described as \"auxiliary\"; the struct simply provides\n* a place to store them, though they may be used by wcshdo() in constructing a\n* FITS header from a wcsprm struct.  Some of the returned values are supplied\n* for informational purposes and others are for internal use only as\n* indicated.\n*\n* In practice, it is expected that a WCS parser would scan the FITS header to\n* determine the number of coordinate axes.  It would then use wcsinit() to\n* allocate memory for arrays in the wcsprm struct and set default values.\n* Then as it reread the header and identified each WCS keyrecord it would load\n* the value into the relevant wcsprm array element.  This is essentially what\n* wcspih() does - refer to the prologue of wcshdr.h.  As the final step,\n* wcsset() is invoked, either directly or indirectly, to set the derived\n* members of the wcsprm struct.  wcsset() strips off trailing blanks in all\n* string members and null-fills the character array.\n*\n*   int flag\n*     (Given and returned) This flag must be set to zero whenever any of the\n*     following wcsprm struct members are set or changed:\n*\n*       - wcsprm::naxis (q.v., not normally set by the user),\n*       - wcsprm::crpix,\n*       - wcsprm::pc,\n*       - wcsprm::cdelt,\n*       - wcsprm::crval,\n*       - wcsprm::cunit,\n*       - wcsprm::ctype,\n*       - wcsprm::lonpole,\n*       - wcsprm::latpole,\n*       - wcsprm::restfrq,\n*       - wcsprm::restwav,\n*       - wcsprm::npv,\n*       - wcsprm::pv,\n*       - wcsprm::nps,\n*       - wcsprm::ps,\n*       - wcsprm::cd,\n*       - wcsprm::crota,\n*       - wcsprm::altlin,\n*       - wcsprm::ntab,\n*       - wcsprm::nwtb,\n*       - wcsprm::tab,\n*       - wcsprm::wtb.\n*\n*     This signals the initialization routine, wcsset(), to recompute the\n*     returned members of the linprm, celprm, spcprm, and tabprm structs.\n*     wcsset() will reset flag to indicate that this has been done.\n*\n*     PLEASE NOTE: flag should be set to -1 when wcsinit() is called for the\n*     first time for a particular wcsprm struct in order to initialize memory\n*     management.  It must ONLY be used on the first initialization otherwise\n*     memory leaks may result.\n*\n*   int naxis\n*     (Given or returned) Number of pixel and world coordinate elements.\n*\n*     If wcsinit() is used to initialize the linprm struct (as would normally\n*     be the case) then it will set naxis from the value passed to it as a\n*     function argument.  The user should not subsequently modify it.\n*\n*   double *crpix\n*     (Given) Address of the first element of an array of double containing\n*     the coordinate reference pixel, CRPIXja.\n*\n*   double *pc\n*     (Given) Address of the first element of the PCi_ja (pixel coordinate)\n*     transformation matrix.  The expected order is\n*\n=       struct wcsprm wcs;\n=       wcs.pc = {PC1_1, PC1_2, PC2_1, PC2_2};\n*\n*     This may be constructed conveniently from a 2-D array via\n*\n=       double m[2][2] = {{PC1_1, PC1_2},\n=                         {PC2_1, PC2_2}};\n*\n*     which is equivalent to\n*\n=       double m[2][2];\n=       m[0][0] = PC1_1;\n=       m[0][1] = PC1_2;\n=       m[1][0] = PC2_1;\n=       m[1][1] = PC2_2;\n*\n*     The storage order for this 2-D array is the same as for the 1-D array,\n*     whence\n*\n=       wcs.pc = *m;\n*\n*     would be legitimate.\n*\n*   double *cdelt\n*     (Given) Address of the first element of an array of double containing\n*     the coordinate increments, CDELTia.\n*\n*   double *crval\n*     (Given) Address of the first element of an array of double containing\n*     the coordinate reference values, CRVALia.\n*\n*   char (*cunit)[72]\n*     (Given) Address of the first element of an array of char[72] containing\n*     the CUNITia keyvalues which define the units of measurement of the\n*     CRVALia, CDELTia, and CDi_ja keywords.\n*\n*     As CUNITia is an optional header keyword, cunit[][72] may be left blank\n*     but otherwise is expected to contain a standard units specification as\n*     defined by WCS Paper I.  Utility function wcsutrn(), described in\n*     wcsunits.h, is available to translate commonly used non-standard units\n*     specifications but this must be done as a separate step before invoking\n*     wcsset().\n*\n*     For celestial axes, if cunit[][72] is not blank, wcsset() uses\n*     wcsunits() to parse it and scale cdelt[], crval[], and cd[][*] to\n*     degrees.  It then resets cunit[][72] to \"deg\".\n*\n*     For spectral axes, if cunit[][72] is not blank, wcsset() uses wcsunits()\n*     to parse it and scale cdelt[], crval[], and cd[][*] to SI units.  It\n*     then resets cunit[][72] accordingly.\n*\n*     wcsset() ignores cunit[][72] for other coordinate types; cunit[][72] may\n*     be used to label coordinate values.\n*\n*     These variables accomodate the longest allowed string-valued FITS\n*     keyword, being limited to 68 characters, plus the null-terminating\n*     character.\n*\n*   char (*ctype)[72]\n*     (Given) Address of the first element of an array of char[72] containing\n*     the coordinate axis types, CTYPEia.\n*\n*     The ctype[][72] keyword values must be in upper case and there must be\n*     zero or one pair of matched celestial axis types, and zero or one\n*     spectral axis.  The ctype[][72] strings should be padded with blanks on\n*     the right and null-terminated so that they are at least eight characters\n*     in length.\n*\n*     These variables accomodate the longest allowed string-valued FITS\n*     keyword, being limited to 68 characters, plus the null-terminating\n*     character.\n*\n*   double lonpole\n*     (Given and returned) The native longitude of the celestial pole, phi_p,\n*     given by LONPOLEa [deg] or by PVi_2a [deg] attached to the longitude\n*     axis which takes precedence if defined, and ...\n*   double latpole\n*     (Given and returned) ... the native latitude of the celestial pole,\n*     theta_p, given by LATPOLEa [deg] or by PVi_3a [deg] attached to the\n*     longitude axis which takes precedence if defined.\n*\n*     lonpole and latpole may be left to default to values set by wcsinit()\n*     (see celprm::ref), but in any case they will be reset by wcsset() to\n*     the values actually used.  Note therefore that if the wcsprm struct is\n*     reused without resetting them, whether directly or via wcsinit(), they\n*     will no longer have their default values.\n*\n*   double restfrq\n*     (Given) The rest frequency [Hz], and/or ...\n*   double restwav\n*     (Given) ... the rest wavelength in vacuo [m], only one of which need be\n*     given, the other should be set to zero.\n*\n*   int npv\n*     (Given) The number of entries in the wcsprm::pv[] array.\n*\n*   int npvmax\n*     (Given or returned) The length of the wcsprm::pv[] array.\n*\n*     npvmax will be set by wcsinit() if it allocates memory for wcsprm::pv[],\n*     otherwise it must be set by the user.  See also wcsnpv().\n*\n*   struct pvcard *pv\n*     (Given) Address of the first element of an array of length npvmax of\n*     pvcard structs.\n*\n*     As a FITS header parser encounters each PVi_ma keyword it should load it\n*     into a pvcard struct in the array and increment npv.  wcsset()\n*     interprets these as required.\n*\n*     Note that, if they were not given, wcsset() resets the entries for\n*     PVi_1a, PVi_2a, PVi_3a, and PVi_4a for longitude axis i to match\n*     phi_0 and theta_0 (the native longitude and latitude of the reference\n*     point), LONPOLEa and LATPOLEa respectively.\n*\n*   int nps\n*     (Given) The number of entries in the wcsprm::ps[] array.\n*\n*   int npsmax\n*     (Given or returned) The length of the wcsprm::ps[] array.\n*\n*     npsmax will be set by wcsinit() if it allocates memory for wcsprm::ps[],\n*     otherwise it must be set by the user.  See also wcsnps().\n*\n*   struct pscard *ps\n*     (Given) Address of the first element of an array of length npsmax of\n*     pscard structs.\n*\n*     As a FITS header parser encounters each PSi_ma keyword it should load it\n*     into a pscard struct in the array and increment nps.  wcsset()\n*     interprets these as required (currently no PSi_ma keyvalues are\n*     recognized).\n*\n*   double *cd\n*     (Given) For historical compatibility, the wcsprm struct supports two\n*     alternate specifications of the linear transformation matrix, those\n*     associated with the CDi_ja keywords, and ...\n*   double *crota\n*     (Given) ... those associated with the CROTAi keywords.  Although these\n*     may not formally co-exist with PCi_ja, the approach taken here is simply\n*     to ignore them if given in conjunction with PCi_ja.\n*\n*   int altlin\n*     (Given) altlin is a bit flag that denotes which of the PCi_ja, CDi_ja\n*     and CROTAi keywords are present in the header:\n*\n*     - Bit 0: PCi_ja is present.\n*\n*     - Bit 1: CDi_ja is present.\n*\n*       Matrix elements in the IRAF convention are equivalent to the product\n*       CDi_ja = CDELTia * PCi_ja, but the defaults differ from that of the\n*       PCi_ja matrix.  If one or more CDi_ja keywords are present then all\n*       unspecified CDi_ja default to zero.  If no CDi_ja (or CROTAi) keywords\n*       are present, then the header is assumed to be in PCi_ja form whether\n*       or not any PCi_ja keywords are present since this results in an\n*       interpretation of CDELTia consistent with the original FITS\n*       specification.\n*\n*       While CDi_ja may not formally co-exist with PCi_ja, it may co-exist\n*       with CDELTia and CROTAi which are to be ignored.\n*\n*     - Bit 2: CROTAi is present.\n*\n*       In the AIPS convention, CROTAi may only be associated with the\n*       latitude axis of a celestial axis pair.  It specifies a rotation in\n*       the image plane that is applied AFTER the CDELTia; any other CROTAi\n*       keywords are ignored.\n*\n*       CROTAi may not formally co-exist with PCi_ja.\n*\n*       CROTAi and CDELTia may formally co-exist with CDi_ja but if so are to\n*       be ignored.\n*\n*     - Bit 3: PCi_ja + CDELTia was derived from CDi_ja by wcspcx().\n*\n*       This bit is set by wcspcx() when it derives PCi_ja and CDELTia from\n*       CDi_ja via an orthonormal decomposition.  In particular, it signals\n*       wcsset() not to replace PCi_ja by a copy of CDi_ja with CDELTia set\n*       to unity.\n*\n*     CDi_ja and CROTAi keywords, if found, are to be stored in the wcsprm::cd\n*     and wcsprm::crota arrays which are dimensioned similarly to wcsprm::pc\n*     and wcsprm::cdelt.  FITS header parsers should use the following\n*     procedure:\n*\n*     - Whenever a PCi_ja keyword is encountered: altlin |= 1;\n*\n*     - Whenever a CDi_ja keyword is encountered: altlin |= 2;\n*\n*     - Whenever a CROTAi keyword is encountered: altlin |= 4;\n*\n*     If none of these bits are set the PCi_ja representation results, i.e.\n*     wcsprm::pc and wcsprm::cdelt will be used as given.\n*\n*     These alternate specifications of the linear transformation matrix are\n*     translated immediately to PCi_ja by wcsset() and are invisible to the\n*     lower-level WCSLIB routines.  In particular, unless bit 3 is also set,\n*     wcsset() resets wcsprm::cdelt to unity if CDi_ja is present (and no\n*     PCi_ja).\n*\n*     If CROTAi are present but none is associated with the latitude axis\n*     (and no PCi_ja or CDi_ja), then wcsset() reverts to a unity PCi_ja\n*     matrix.\n*\n*   int velref\n*     (Given) AIPS velocity code VELREF, refer to spcaips().\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::velref is changed.\n*\n*   char alt[4]\n*     (Given, auxiliary) Character code for alternate coordinate descriptions\n*     (i.e. the 'a' in keyword names such as CTYPEia).  This is blank for the\n*     primary coordinate description, or one of the 26 upper-case letters,\n*     A-Z.\n*\n*     An array of four characters is provided for alignment purposes, only the\n*     first is used.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::alt is changed.\n*\n*   int colnum\n*     (Given, auxiliary) Where the coordinate representation is associated\n*     with an image-array column in a FITS binary table, this variable may be\n*     used to record the relevant column number.\n*\n*     It should be set to zero for an image header or pixel list.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::colnum is changed.\n*\n*   int *colax\n*     (Given, auxiliary) Address of the first element of an array of int\n*     recording the column numbers for each axis in a pixel list.\n*\n*     The array elements should be set to zero for an image header or image\n*     array in a binary table.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::colax is changed.\n*\n*   char (*cname)[72]\n*     (Given, auxiliary) The address of the first element of an array of\n*     char[72] containing the coordinate axis names, CNAMEia.\n*\n*     These variables accomodate the longest allowed string-valued FITS\n*     keyword, being limited to 68 characters, plus the null-terminating\n*     character.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::cname is changed.\n*\n*   double *crder\n*     (Given, auxiliary) Address of the first element of an array of double\n*     recording the random error in the coordinate value, CRDERia.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::crder is changed.\n*\n*   double *csyer\n*     (Given, auxiliary) Address of the first element of an array of double\n*     recording the systematic error in the coordinate value, CSYERia.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::csyer is changed.\n*\n*   double *czphs\n*     (Given, auxiliary) Address of the first element of an array of double\n*     recording the time at the zero point of a phase axis, CZPHSia.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::czphs is changed.\n*\n*   double *cperi\n*     (Given, auxiliary) Address of the first element of an array of double\n*     recording the period of a phase axis, CPERIia.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::cperi is changed.\n*\n*   char wcsname[72]\n*     (Given, auxiliary) The name given to the coordinate representation,\n*     WCSNAMEa.  This variable accomodates the longest allowed string-valued\n*     FITS keyword, being limited to 68 characters, plus the null-terminating\n*     character.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::wcsname is changed.\n*\n*   char timesys[72]\n*     (Given, auxiliary) TIMESYS keyvalue, being the time scale (UTC, TAI,\n*     etc.) in which all other time-related auxiliary header values are\n*     recorded.  Also defines the time scale for an image axis with CTYPEia\n*     set to 'TIME'.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::timesys is changed.\n*\n*   char trefpos[72]\n*     (Given, auxiliary) TREFPOS keyvalue, being the location in space where\n*     the recorded time is valid.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::trefpos is changed.\n*\n*   char trefdir[72]\n*     (Given, auxiliary) TREFDIR keyvalue, being the reference direction used\n*     in calculating a pathlength delay.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::trefdir is changed.\n*\n*   char plephem[72]\n*     (Given, auxiliary) PLEPHEM keyvalue, being the Solar System ephemeris\n*     used for calculating a pathlength delay.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::plephem is changed.\n*\n*   char timeunit[72]\n*     (Given, auxiliary) TIMEUNIT keyvalue, being the time units in which\n*     the following header values are expressed: TSTART, TSTOP, TIMEOFFS,\n*     TIMSYER, TIMRDER, TIMEDEL.  It also provides the default value for\n*     CUNITia for time axes.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::timeunit is changed.\n*\n*   char dateref[72]\n*     (Given, auxiliary) DATEREF keyvalue, being the date of a reference epoch\n*     relative to which other time measurements refer.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::dateref is changed.\n*\n*   double mjdref[2]\n*     (Given, auxiliary) MJDREF keyvalue, equivalent to DATEREF expressed as\n*     a Modified Julian Date (MJD = JD - 2400000.5).  The value is given as\n*     the sum of the two-element vector, allowing increased precision.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::mjdref is changed.\n*\n*   double timeoffs\n*     (Given, auxiliary) TIMEOFFS keyvalue, being a time offset, which may be\n*     used, for example, to provide a uniform clock correction for times\n*     referenced to DATEREF.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::timeoffs is changed.\n*\n*   char dateobs[72]\n*     (Given, auxiliary) DATE-OBS keyvalue, being the date at the start of the\n*     observation unless otherwise explained in the DATE-OBS keycomment, in\n*     ISO format, yyyy-mm-ddThh:mm:ss.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::dateobs is changed.\n*\n*   char datebeg[72]\n*     (Given, auxiliary) DATE-BEG keyvalue, being the date at the start of the\n*     observation in ISO format, yyyy-mm-ddThh:mm:ss.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::datebeg is changed.\n*\n*   char dateavg[72]\n*     (Given, auxiliary) DATE-AVG keyvalue, being the date at a representative\n*     mid-point of the observation in ISO format, yyyy-mm-ddThh:mm:ss.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::dateavg is changed.\n*\n*   char dateend[72]\n*     (Given, auxiliary) DATE-END keyvalue, baing the date at the end of the\n*     observation in ISO format, yyyy-mm-ddThh:mm:ss.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::dateend is changed.\n*\n*   double mjdobs\n*     (Given, auxiliary) MJD-OBS keyvalue, equivalent to DATE-OBS expressed\n*     as a Modified Julian Date (MJD = JD - 2400000.5).\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::mjdobs is changed.\n*\n*   double mjdbeg\n*     (Given, auxiliary) MJD-BEG keyvalue, equivalent to DATE-BEG expressed\n*     as a Modified Julian Date (MJD = JD - 2400000.5).\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::mjdbeg is changed.\n*\n*   double mjdavg\n*     (Given, auxiliary) MJD-AVG keyvalue, equivalent to DATE-AVG expressed\n*     as a Modified Julian Date (MJD = JD - 2400000.5).\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::mjdavg is changed.\n*\n*   double mjdend\n*     (Given, auxiliary) MJD-END keyvalue, equivalent to DATE-END expressed\n*     as a Modified Julian Date (MJD = JD - 2400000.5).\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::mjdend is changed.\n*\n*   double jepoch\n*     (Given, auxiliary) JEPOCH keyvalue, equivalent to DATE-OBS expressed\n*     as a Julian epoch.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::jepoch is changed.\n*\n*   double bepoch\n*     (Given, auxiliary) BEPOCH keyvalue, equivalent to DATE-OBS expressed\n*     as a Besselian epoch\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::bepoch is changed.\n*\n*   double tstart\n*     (Given, auxiliary) TSTART keyvalue, equivalent to DATE-BEG expressed\n*     as a time in units of TIMEUNIT relative to DATEREF+TIMEOFFS.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::tstart is changed.\n*\n*   double tstop\n*     (Given, auxiliary) TSTOP keyvalue, equivalent to DATE-END expressed\n*     as a time in units of TIMEUNIT relative to DATEREF+TIMEOFFS.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::tstop is changed.\n*\n*   double xposure\n*     (Given, auxiliary) XPOSURE keyvalue, being the effective exposure time\n*     in units of TIMEUNIT.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::xposure is changed.\n*\n*   double telapse\n*     (Given, auxiliary) TELAPSE keyvalue, equivalent to the elapsed time\n*     between DATE-BEG and DATE-END, in units of TIMEUNIT.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::telapse is changed.\n*\n*   double timsyer\n*     (Given, auxiliary) TIMSYER keyvalue, being the absolute error of the\n*     time values, in units of TIMEUNIT.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::timsyer is changed.\n*\n*   double timrder\n*     (Given, auxiliary) TIMRDER keyvalue, being the accuracy of time stamps\n*     relative to each other, in units of TIMEUNIT.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::timrder is changed.\n*\n*   double timedel\n*     (Given, auxiliary) TIMEDEL keyvalue, being the resolution of the time\n*     stamps.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::timedel is changed.\n*\n*   double timepixr\n*     (Given, auxiliary) TIMEPIXR keyvalue, being the relative position of the\n*     time stamps in binned time intervals, a value between 0.0 and 1.0.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::timepixr is changed.\n*\n*   double obsgeo[6]\n*     (Given, auxiliary) Location of the observer in a standard terrestrial\n*     reference frame.  The first three give ITRS Cartesian coordinates\n*     OBSGEO-X [m],   OBSGEO-Y [m],   OBSGEO-Z [m], and the second three give\n*     OBSGEO-L [deg], OBSGEO-B [deg], OBSGEO-H [m], which are related through\n*     a standard transformation.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::obsgeo is changed.\n*\n*   char obsorbit[72]\n*     (Given, auxiliary) OBSORBIT keyvalue, being the URI, URL, or name of an\n*     orbit ephemeris file giving spacecraft coordinates relating to TREFPOS.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::obsorbit is changed.\n*\n*   char radesys[72]\n*     (Given, auxiliary) The equatorial or ecliptic coordinate system type,\n*     RADESYSa.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::radesys is changed.\n*\n*   double equinox\n*     (Given, auxiliary) The equinox associated with dynamical equatorial or\n*     ecliptic coordinate systems, EQUINOXa (or EPOCH in older headers).  Not\n*     applicable to ICRS equatorial or ecliptic coordinates.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::equinox is changed.\n*\n*   char specsys[72]\n*     (Given, auxiliary) Spectral reference frame (standard of rest),\n*     SPECSYSa.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::specsys is changed.\n*\n*   char ssysobs[72]\n*     (Given, auxiliary) The spectral reference frame in which there is no\n*     differential variation in the spectral coordinate across the\n*     field-of-view, SSYSOBSa.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::ssysobs is changed.\n*\n*   double velosys\n*     (Given, auxiliary) The relative radial velocity [m/s] between the\n*     observer and the selected standard of rest in the direction of the\n*     celestial reference coordinate, VELOSYSa.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::velosys is changed.\n*\n*   double zsource\n*     (Given, auxiliary) The redshift, ZSOURCEa, of the source.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::zsource is changed.\n*\n*   char ssyssrc[72]\n*     (Given, auxiliary) The spectral reference frame (standard of rest),\n*     SSYSSRCa, in which wcsprm::zsource was measured.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::ssyssrc is changed.\n*\n*   double velangl\n*     (Given, auxiliary) The angle [deg] that should be used to decompose an\n*     observed velocity into radial and transverse components.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::velangl is changed.\n*\n*   struct auxprm *aux\n*     (Given, auxiliary) This struct holds auxiliary coordinate system\n*     information of a specialist nature.  While these parameters may be\n*     widely recognized within particular fields of astronomy, they differ\n*     from the above auxiliary parameters in not being defined by any of the\n*     FITS WCS standards.  Collecting them together in a separate struct that\n*     is allocated only when required helps to control bloat in the size of\n*     the wcsprm struct.\n*\n*   int ntab\n*     (Given) See wcsprm::tab.\n*\n*   int nwtb\n*     (Given) See wcsprm::wtb.\n*\n*   struct tabprm *tab\n*     (Given) Address of the first element of an array of ntab tabprm structs\n*     for which memory has been allocated.  These are used to store tabular\n*     transformation parameters.\n*\n*     Although technically wcsprm::ntab and tab are \"given\", they will\n*     normally be set by invoking wcstab(), whether directly or indirectly.\n*\n*     The tabprm structs contain some members that must be supplied and others\n*     that are derived.  The information to be supplied comes primarily from\n*     arrays stored in one or more FITS binary table extensions.  These\n*     arrays, referred to here as \"wcstab arrays\", are themselves located by\n*     parameters stored in the FITS image header.\n*\n*   struct wtbarr *wtb\n*     (Given) Address of the first element of an array of nwtb wtbarr structs\n*     for which memory has been allocated.  These are used in extracting\n*     wcstab arrays from a FITS binary table.\n*\n*     Although technically wcsprm::nwtb and wtb are \"given\", they will\n*     normally be set by invoking wcstab(), whether directly or indirectly.\n*\n*   char lngtyp[8]\n*     (Returned) Four-character WCS celestial longitude and ...\n*   char lattyp[8]\n*     (Returned) ... latitude axis types. e.g. \"RA\", \"DEC\", \"GLON\", \"GLAT\",\n*     etc. extracted from 'RA--', 'DEC-', 'GLON', 'GLAT', etc. in the first\n*     four characters of CTYPEia but with trailing dashes removed.  (Declared\n*     as char[8] for alignment reasons.)\n*\n*   int lng\n*     (Returned) Index for the longitude coordinate, and ...\n*   int lat\n*     (Returned) ... index for the latitude coordinate, and ...\n*   int spec\n*     (Returned) ... index for the spectral coordinate in the imgcrd[][] and\n*     world[][] arrays in the API of wcsp2s(), wcss2p() and wcsmix().\n*\n*     These may also serve as indices into the pixcrd[][] array provided that\n*     the PCi_ja matrix does not transpose axes.\n*\n*   int cubeface\n*     (Returned) Index into the pixcrd[][] array for the CUBEFACE axis.  This\n*     is used for quadcube projections where the cube faces are stored on a\n*     separate axis (see wcs.h).\n*\n*   int *types\n*     (Returned) Address of the first element of an array of int containing a\n*     four-digit type code for each axis.\n*\n*     - First digit (i.e. 1000s):\n*       - 0: Non-specific coordinate type.\n*       - 1: Stokes coordinate.\n*       - 2: Celestial coordinate (including CUBEFACE).\n*       - 3: Spectral coordinate.\n*\n*     - Second digit (i.e. 100s):\n*       - 0: Linear axis.\n*       - 1: Quantized axis (STOKES, CUBEFACE).\n*       - 2: Non-linear celestial axis.\n*       - 3: Non-linear spectral axis.\n*       - 4: Logarithmic axis.\n*       - 5: Tabular axis.\n*\n*     - Third digit (i.e. 10s):\n*       - 0: Group number, e.g. lookup table number, being an index into the\n*            tabprm array (see above).\n*\n*     - The fourth digit is used as a qualifier depending on the axis type.\n*\n*       - For celestial axes:\n*         - 0: Longitude coordinate.\n*         - 1: Latitude coordinate.\n*         - 2: CUBEFACE number.\n*\n*       - For lookup tables: the axis number in a multidimensional table.\n*\n*     CTYPEia in \"4-3\" form with unrecognized algorithm code will have its\n*     type set to -1 and generate an error.\n*\n*   struct linprm lin\n*     (Returned) Linear transformation parameters (usage is described in the\n*     prologue to lin.h).\n*\n*   struct celprm cel\n*     (Returned) Celestial transformation parameters (usage is described in\n*     the prologue to cel.h).\n*\n*   struct spcprm spc\n*     (Returned) Spectral transformation parameters (usage is described in the\n*     prologue to spc.h).\n*\n*   struct wcserr *err\n*     (Returned) If enabled, when an error status is returned, this struct\n*     contains detailed information about the error, see wcserr_enable().\n*\n*   int m_flag\n*     (For internal use only.)\n*   int m_naxis\n*     (For internal use only.)\n*   double *m_crpix\n*     (For internal use only.)\n*   double *m_pc\n*     (For internal use only.)\n*   double *m_cdelt\n*     (For internal use only.)\n*   double *m_crval\n*     (For internal use only.)\n*   char (*m_cunit)[72]\n*     (For internal use only.)\n*   char (*m_ctype)[72]\n*     (For internal use only.)\n*   struct pvcard *m_pv\n*     (For internal use only.)\n*   struct pscard *m_ps\n*     (For internal use only.)\n*   double *m_cd\n*     (For internal use only.)\n*   double *m_crota\n*     (For internal use only.)\n*   int *m_colax\n*     (For internal use only.)\n*   char (*m_cname)[72]\n*     (For internal use only.)\n*   double *m_crder\n*     (For internal use only.)\n*   double *m_csyer\n*     (For internal use only.)\n*   double *m_czphs\n*     (For internal use only.)\n*   double *m_cperi\n*     (For internal use only.)\n*   struct tabprm *m_tab\n*     (For internal use only.)\n*   struct wtbarr *m_wtb\n*     (For internal use only.)\n*\n*\n* pvcard struct - Store for PVi_ma keyrecords\n* -------------------------------------------\n* The pvcard struct is used to pass the parsed contents of PVi_ma keyrecords\n* to wcsset() via the wcsprm struct.\n*\n* All members of this struct are to be set by the user.\n*\n*   int i\n*     (Given) Axis number (1-relative), as in the FITS PVi_ma keyword.  If\n*     i == 0, wcsset() will replace it with the latitude axis number.\n*\n*   int m\n*     (Given) Parameter number (non-negative), as in the FITS PVi_ma keyword.\n*\n*   double value\n*     (Given) Parameter value.\n*\n*\n* pscard struct - Store for PSi_ma keyrecords\n* -------------------------------------------\n* The pscard struct is used to pass the parsed contents of PSi_ma keyrecords\n* to wcsset() via the wcsprm struct.\n*\n* All members of this struct are to be set by the user.\n*\n*   int i\n*     (Given) Axis number (1-relative), as in the FITS PSi_ma keyword.\n*\n*   int m\n*     (Given) Parameter number (non-negative), as in the FITS PSi_ma keyword.\n*\n*   char value[72]\n*     (Given) Parameter value.\n*\n*\n* auxprm struct - Additional auxiliary parameters\n* -----------------------------------------------\n* The auxprm struct holds auxiliary coordinate system information of a\n* specialist nature.  It is anticipated that this struct will expand in future\n* to accomodate additional parameters.\n*\n* All members of this struct are to be set by the user.\n*\n*   double rsun_ref\n*     (Given, auxiliary) Reference radius of the Sun used in coordinate\n*     calculations (m).\n*\n*   double dsun_obs\n*     (Given, auxiliary) Distance between the centre of the Sun and the\n*     observer (m).\n*\n*   double crln_obs\n*     (Given, auxiliary) Carrington heliographic longitude of the observer\n*     (deg).\n*\n*   double hgln_obs\n*     (Given, auxiliary) Stonyhurst heliographic longitude of the observer\n*     (deg).\n*\n*   double hglt_obs\n*     (Given, auxiliary) Heliographic latitude (Carrington or Stonyhurst) of\n*     the observer (deg).\n*\n*\n* Global variable: const char *wcs_errmsg[] - Status return messages\n* ------------------------------------------------------------------\n* Error messages to match the status value returned from each function.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_WCS\n#define WCSLIB_WCS\n\n#include \"lin.h\"\n#include \"cel.h\"\n#include \"spc.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#define wtbarr wtbarr_s\t\t// See prologue of wtbarr.h.\n#endif\n\n#define WCSSUB_LONGITUDE 0x1001\n#define WCSSUB_LATITUDE  0x1002\n#define WCSSUB_CUBEFACE  0x1004\n#define WCSSUB_CELESTIAL 0x1007\n#define WCSSUB_SPECTRAL  0x1008\n#define WCSSUB_STOKES    0x1010\n\n\n#define WCSCOMPARE_ANCILLARY 0x0001\n#define WCSCOMPARE_TILING    0x0002\n#define WCSCOMPARE_CRPIX     0x0004\n\n\nextern const char *wcs_errmsg[];\n\nenum wcs_errmsg_enum {\n  WCSERR_SUCCESS         =  0,\t// Success.\n  WCSERR_NULL_POINTER    =  1,\t// Null wcsprm pointer passed.\n  WCSERR_MEMORY          =  2,\t// Memory allocation failed.\n  WCSERR_SINGULAR_MTX    =  3,\t// Linear transformation matrix is singular.\n  WCSERR_BAD_CTYPE       =  4,\t// Inconsistent or unrecognized coordinate\n\t\t\t\t// axis type.\n  WCSERR_BAD_PARAM       =  5,\t// Invalid parameter value.\n  WCSERR_BAD_COORD_TRANS =  6,\t// Unrecognized coordinate transformation\n\t\t\t\t// parameter.\n  WCSERR_ILL_COORD_TRANS =  7,\t// Ill-conditioned coordinate transformation\n\t\t\t\t// parameter.\n  WCSERR_BAD_PIX         =  8,\t// One or more of the pixel coordinates were\n\t\t\t\t// invalid.\n  WCSERR_BAD_WORLD       =  9,\t// One or more of the world coordinates were\n\t\t\t\t// invalid.\n  WCSERR_BAD_WORLD_COORD = 10,\t// Invalid world coordinate.\n  WCSERR_NO_SOLUTION     = 11,\t// No solution found in the specified\n\t\t\t\t// interval.\n  WCSERR_BAD_SUBIMAGE    = 12,\t// Invalid subimage specification.\n  WCSERR_NON_SEPARABLE   = 13,\t// Non-separable subimage coordinate system.\n  WCSERR_UNSET           = 14 \t// wcsprm struct is unset.\n};\n\n\n// Struct used for storing PVi_ma keywords.\nstruct pvcard {\n  int i;\t\t\t// Axis number, as in PVi_ma (1-relative).\n  int m;\t\t\t// Parameter number, ditto  (0-relative).\n  double value;\t\t\t// Parameter value.\n};\n\n// Size of the pvcard struct in int units, used by the Fortran wrappers.\n#define PVLEN (sizeof(struct pvcard)/sizeof(int))\n\n// Struct used for storing PSi_ma keywords.\nstruct pscard {\n  int i;\t\t\t// Axis number, as in PSi_ma (1-relative).\n  int m;\t\t\t// Parameter number, ditto  (0-relative).\n  char value[72];\t\t// Parameter value.\n};\n\n// Size of the pscard struct in int units, used by the Fortran wrappers.\n#define PSLEN (sizeof(struct pscard)/sizeof(int))\n\n// Struct used to hold additional auxiliary parameters.\nstruct auxprm {\n  double rsun_ref;              // Solar radius.\n  double dsun_obs;              // Distance from Sun centre to observer.\n  double crln_obs;              // Carrington heliographic lng of observer.\n  double hgln_obs;              // Stonyhurst heliographic lng of observer.\n  double hglt_obs;              // Heliographic latitude of observer.\n};\n\n// Size of the auxprm struct in int units, used by the Fortran wrappers.\n#define AUXLEN (sizeof(struct auxprm)/sizeof(int))\n\n\nstruct wcsprm {\n  // Initialization flag (see the prologue above).\n  //--------------------------------------------------------------------------\n  int    flag;\t\t\t// Set to zero to force initialization.\n\n  // FITS header keyvalues to be provided (see the prologue above).\n  //--------------------------------------------------------------------------\n  int    naxis;\t\t\t// Number of axes (pixel and coordinate).\n  double *crpix;\t\t// CRPIXja keyvalues for each pixel axis.\n  double *pc;\t\t\t// PCi_ja  linear transformation matrix.\n  double *cdelt;\t\t// CDELTia keyvalues for each coord axis.\n  double *crval;\t\t// CRVALia keyvalues for each coord axis.\n\n  char   (*cunit)[72];\t\t// CUNITia keyvalues for each coord axis.\n  char   (*ctype)[72];\t\t// CTYPEia keyvalues for each coord axis.\n\n  double lonpole;\t\t// LONPOLEa keyvalue.\n  double latpole;\t\t// LATPOLEa keyvalue.\n\n  double restfrq;\t\t// RESTFRQa keyvalue.\n  double restwav;\t\t// RESTWAVa keyvalue.\n\n  int    npv;\t\t\t// Number of PVi_ma keywords, and the\n  int    npvmax;\t\t// number for which space was allocated.\n  struct pvcard *pv;\t\t// PVi_ma keywords for each i and m.\n\n  int    nps;\t\t\t// Number of PSi_ma keywords, and the\n  int    npsmax;\t\t// number for which space was allocated.\n  struct pscard *ps;\t\t// PSi_ma keywords for each i and m.\n\n  // Alternative header keyvalues (see the prologue above).\n  //--------------------------------------------------------------------------\n  double *cd;\t\t\t// CDi_ja linear transformation matrix.\n  double *crota;\t\t// CROTAi keyvalues for each coord axis.\n  int    altlin;\t\t// Alternative representations\n\t\t\t\t//   Bit 0: PCi_ja is present,\n\t\t\t\t//   Bit 1: CDi_ja is present,\n\t\t\t\t//   Bit 2: CROTAi is present.\n  int    velref;\t\t// AIPS velocity code, VELREF.\n\n  // Auxiliary coordinate system information of a general nature.  Not\n  // used by WCSLIB.  Refer to the prologue comments above for a brief\n  // explanation of these values.\n  char   alt[4];\n  int    colnum;\n  int    *colax;\n\t\t\t\t// Auxiliary coordinate axis information.\n  char   (*cname)[72];\n  double *crder;\n  double *csyer;\n  double *czphs;\n  double *cperi;\n\n  char   wcsname[72];\n\t\t\t\t// Time reference system and measurement.\n  char   timesys[72], trefpos[72], trefdir[72], plephem[72];\n  char   timeunit[72];\n  char   dateref[72];\n  double mjdref[2];\n  double timeoffs;\n\t\t\t\t// Data timestamps and durations.\n  char   dateobs[72], datebeg[72], dateavg[72], dateend[72];\n  double mjdobs, mjdbeg, mjdavg, mjdend;\n  double jepoch, bepoch;\n  double tstart, tstop;\n  double xposure, telapse;\n\t\t\t\t// Timing accuracy.\n  double timsyer, timrder;\n  double timedel, timepixr;\n\t\t\t\t// Spatial & celestial reference frame.\n  double obsgeo[6];\n  char   obsorbit[72];\n  char   radesys[72];\n  double equinox;\n  char   specsys[72];\n  char   ssysobs[72];\n  double velosys;\n  double zsource;\n  char   ssyssrc[72];\n  double velangl;\n\n  // Additional auxiliary coordinate system information of a specialist\n  // nature.  Not used by WCSLIB.  Refer to the prologue comments above.\n  struct auxprm *aux;\n\n  // Coordinate lookup tables (see the prologue above).\n  //--------------------------------------------------------------------------\n  int    ntab;\t\t\t// Number of separate tables.\n  int    nwtb;\t\t\t// Number of wtbarr structs.\n  struct tabprm *tab;\t\t// Tabular transformation parameters.\n  struct wtbarr *wtb;\t\t// Array of wtbarr structs.\n\n  //--------------------------------------------------------------------------\n  // Information derived from the FITS header keyvalues by wcsset().\n  //--------------------------------------------------------------------------\n  char   lngtyp[8], lattyp[8];\t// Celestial axis types, e.g. RA, DEC.\n  int    lng, lat, spec;\t// Longitude, latitude and spectral axis\n\t\t\t\t// indices (0-relative).\n  int    cubeface;\t\t// True if there is a CUBEFACE axis.\n  int    *types;\t\t// Coordinate type codes for each axis.\n\n  struct linprm lin;\t\t//    Linear transformation parameters.\n  struct celprm cel;\t\t// Celestial transformation parameters.\n  struct spcprm spc;\t\t//  Spectral transformation parameters.\n\n  //--------------------------------------------------------------------------\n  //             THE REMAINDER OF THE WCSPRM STRUCT IS PRIVATE.\n  //--------------------------------------------------------------------------\n\n  // Error handling, if enabled.\n  //--------------------------------------------------------------------------\n  struct wcserr *err;\n\n  // Memory management.\n  //--------------------------------------------------------------------------\n  int    m_flag, m_naxis;\n  double *m_crpix, *m_pc, *m_cdelt, *m_crval;\n  char  (*m_cunit)[72], (*m_ctype)[72];\n  struct pvcard *m_pv;\n  struct pscard *m_ps;\n  double *m_cd, *m_crota;\n  int    *m_colax;\n  char  (*m_cname)[72];\n  double *m_crder, *m_csyer, *m_czphs, *m_cperi;\n  struct auxprm *m_aux;\n  struct tabprm *m_tab;\n  struct wtbarr *m_wtb;\n};\n\n// Size of the wcsprm struct in int units, used by the Fortran wrappers.\n#define WCSLEN (sizeof(struct wcsprm)/sizeof(int))\n\n\nint wcsnpv(int n);\n\nint wcsnps(int n);\n\nint wcsini(int alloc, int naxis, struct wcsprm *wcs);\n\nint wcsinit(int alloc, int naxis, struct wcsprm *wcs, int npvmax, int npsmax,\n            int ndpmax);\n\nint wcsauxi(int alloc, struct wcsprm *wcs);\n\nint wcssub(int alloc, const struct wcsprm *wcssrc, int *nsub, int axes[],\n           struct wcsprm *wcsdst);\n\nint wcscompare(int cmp, double tol, const struct wcsprm *wcs1,\n               const struct wcsprm *wcs2, int *equal);\n\nint wcsfree(struct wcsprm *wcs);\n\nint wcstrim(struct wcsprm *wcs);\n\nint wcssize(const struct wcsprm *wcs, int sizes[2]);\n\nint auxsize(const struct auxprm *aux, int sizes[2]);\n\nint wcsprt(const struct wcsprm *wcs);\n\nint wcsperr(const struct wcsprm *wcs, const char *prefix);\n\nint wcsbchk(struct wcsprm *wcs, int bounds);\n\nint wcsset(struct wcsprm *wcs);\n\nint wcsp2s(struct wcsprm *wcs, int ncoord, int nelem, const double pixcrd[],\n           double imgcrd[], double phi[], double theta[], double world[],\n           int stat[]);\n\nint wcss2p(struct wcsprm *wcs, int ncoord, int nelem, const double world[],\n           double phi[], double theta[], double imgcrd[], double pixcrd[],\n           int stat[]);\n\nint wcsmix(struct wcsprm *wcs, int mixpix, int mixcel, const double vspan[2],\n           double vstep, int viter, double world[], double phi[],\n           double theta[], double imgcrd[], double pixcrd[]);\n\nint wcsccs(struct wcsprm *wcs, double lng2p1, double lat2p1, double lng1p2,\n           const char *clng, const char *clat, const char *radesys,\n           double equinox, const char *alt);\n\nint wcssptr(struct wcsprm *wcs, int *i, char ctype[9]);\n\nconst char* wcslib_version(int vers[3]);\n\n// Defined mainly for backwards compatibility, use wcssub() instead.\n#define wcscopy(alloc, wcssrc, wcsdst) wcssub(alloc, wcssrc, 0x0, 0x0, wcsdst)\n\n\n// Deprecated.\n#define wcsini_errmsg wcs_errmsg\n#define wcssub_errmsg wcs_errmsg\n#define wcscopy_errmsg wcs_errmsg\n#define wcsfree_errmsg wcs_errmsg\n#define wcsprt_errmsg wcs_errmsg\n#define wcsset_errmsg wcs_errmsg\n#define wcsp2s_errmsg wcs_errmsg\n#define wcss2p_errmsg wcs_errmsg\n#define wcsmix_errmsg wcs_errmsg\n\n#ifdef __cplusplus\n#undef wtbarr\n}\n#endif\n\n#endif // WCSLIB_WCS\n"},{"id":16572,"name":"fitshdr.l","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: fitshdr.l,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* fitshdr.l is a Flex description file containing a lexical scanner\n* definition for extracting keywords and keyvalues from a FITS header.\n*\n* It requires Flex v2.5.4 or later.\n*\n* Refer to fitshdr.h for a description of the user interface and operating\n* notes.\n*\n*===========================================================================*/\n\n/* Options. */\n%option full\n%option never-interactive\n%option noinput\n%option nounput\n%option noyywrap\n%option outfile=\"fitshdr.c\"\n%option prefix=\"fitshdr\"\n%option reentrant\n%option extra-type=\"struct fitshdr_extra *\"\n\n/* Keywords. */\nKEYCHR\t[-_A-Z0-9]\nKW1\t{KEYCHR}{1}\" \"{7}\nKW2\t{KEYCHR}{2}\" \"{6}\nKW3\t{KEYCHR}{3}\" \"{5}\nKW4\t{KEYCHR}{4}\" \"{4}\nKW5\t{KEYCHR}{5}\" \"{3}\nKW6\t{KEYCHR}{6}\" \"{2}\nKW7\t{KEYCHR}{7}\" \"{1}\nKW8\t{KEYCHR}{8}\nKEYWORD\t({KW1}|{KW2}|{KW3}|{KW4}|{KW5}|{KW6}|{KW7}|{KW8})\n\n/* Keyvalue data types. */\nLOGICAL\t[TF]\nINT32\t[+-]?0*[0-9]{1,9}\nINT64\t[+-]?0*[0-9]{10,18}\nINTVL\t[+-]?0*[0-9]{19,}\nINTEGER\t[+-]?[0-9]+\nFLOAT\t[+-]?([0-9]+\\.?[0-9]*|\\.[0-9]+)([eEdD][+-]?[0-9]+)?\nICOMPLX\t\\(\" \"*{INTEGER}\" \"*,\" \"*{INTEGER}\" \"*\\)\nFCOMPLX\t\\(\" \"*{FLOAT}\" \"*,\" \"*{FLOAT}\" \"*\\)\nSTRING\t'([^']|'')*'\n\n/* Characters forming standard unit strings (jwBIQX are not used). */\nUNITSTR \\[[-+*/^(). 0-9a-zA-Z]+\\]\n\n/* Exclusive start states. */\n%x VALUE INLINE UNITS COMMENT ERROR FLUSH\n\n%{\n#include <math.h>\n#include <limits.h>\n#include <setjmp.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"fitshdr.h\"\n#include \"wcsutil.h\"\n\n// User data associated with yyscanner.\nstruct fitshdr_extra {\n  // Values passed to YY_INPUT.\n  const char *hdr;\n  int  nkeyrec;\n\n  // Used in preempting the call to exit() by yy_fatal_error().\n  jmp_buf abort_jmp_env;\n};\n\n#define YY_DECL int fitshdr_scanner(const char header[], int nkeyrec, \\\n  int nkeyids, struct fitskeyid keyids[], int *nreject, \\\n  struct fitskey **keys, yyscan_t yyscanner)\n\n#define YY_INPUT(inbuff, count, bufsize) \\\n\t{ \\\n\t  if (yyextra->nkeyrec) { \\\n\t    strncpy(inbuff, yyextra->hdr, 80); \\\n\t    inbuff[80] = '\\n'; \\\n\t    yyextra->hdr += 80; \\\n\t    yyextra->nkeyrec--; \\\n\t    count = 81; \\\n\t  } else { \\\n\t    count = YY_NULL; \\\n\t  } \\\n\t}\n\n// Preempt the call to exit() by yy_fatal_error().\n#define exit(status) longjmp(yyextra->abort_jmp_env, status);\n\n// Internal helper functions.\nstatic YY_DECL;\nstatic void nullfill(char cptr[], int len);\n\n// Map status return value to message.\nconst char *fitshdr_errmsg[] = {\n   \"Success\",\n   \"Null fitskey pointer-pointer passed\",\n   \"Memory allocation failed\",\n   \"Fatal error returned by Flex parser\"};\n\n%}\n\n%%\n\tchar ctmp[72];\n\t\n\tif (keys == 0x0) {\n\t  return FITSHDRERR_NULL_POINTER;\n\t}\n\t\n\t// Allocate memory for the required number of fitskey structs.\n\t// Recall that calloc() initializes allocated memory to zero.\n\tstruct fitskey *kptr;\n\tif (!(kptr = *keys = calloc(nkeyrec, sizeof(struct fitskey)))) {\n\t  return FITSHDRERR_MEMORY;\n\t}\n\t\n\t// Initialize returned values.\n\t*nreject = 0;\n\t\n\t// Initialize keyids[].\n\tstruct fitskeyid *iptr = keyids;\n\tfor (int j = 0; j < nkeyids; j++, iptr++) {\n\t  iptr->count  = 0;\n\t  iptr->idx[0] = -1;\n\t  iptr->idx[1] = -1;\n\t}\n\n\tint keyno = 0;\n\t\n\tint blank = 0;\n\tint continuation = 0;\n\tint end = 0;\n\t\n\t#ifdef WCSLIB_INT64\n\t  #define asString(S) stringize(S)\n\t  #define stringize(S) #S\n\t\n\t  const char *int64fmt;\n\t  if (strcmp(asString(WCSLIB_INT64), \"long long int\") == 0) {\n\t    int64fmt = \"%lld\";\n\t  } else if (strcmp(asString(WCSLIB_INT64), \"long int\") == 0) {\n\t    int64fmt = \"%ld\";\n\t  } else if (strcmp(asString(WCSLIB_INT64), \"int\") == 0) {\n\t    int64fmt = \"%d\";\n\t  } else {\n\t    return FITSHDRERR_DATA_TYPE;\n\t  }\n\t#endif\n\t\n\t// User data associated with yyscanner.\n\tyyextra->hdr = header;\n\tyyextra->nkeyrec = nkeyrec;\n\t\n\t// Return here via longjmp() invoked by yy_fatal_error().\n\tif (setjmp(yyextra->abort_jmp_env)) {\n\t  return FITSHDRERR_FLEX_PARSER;\n\t}\n\t\n\tBEGIN(INITIAL);\n\n^\" \"{80} {\n\t  // A completely blank keyrecord.\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  yyless(0);\n\t  blank = 1;\n\t  BEGIN(COMMENT);\n\t}\n\n^(COMMENT|HISTORY|\" \"{8}) {\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  BEGIN(COMMENT);\n\t}\n\n^END\" \"{77} {\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  end = 1;\n\t  BEGIN(FLUSH);\n\t}\n\n^END\" \"{5}=\" \"+ {\n\t  // Illegal END keyrecord.\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  kptr->status |= FITSHDR_KEYREC;\n\t  BEGIN(VALUE);\n\t}\n\n^END\" \"{5} {\n\t  // Illegal END keyrecord.\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  kptr->status |= FITSHDR_KEYREC;\n\t  BEGIN(COMMENT);\n\t}\n\n^{KEYWORD}=\" \"+ {\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  BEGIN(VALUE);\n\t}\n\n^CONTINUE\"  \"+{STRING} {\n\t  // Continued string keyvalue.\n\t  strncpy(kptr->keyword, yytext, 8);\n\t\n\t  if (keyno > 0 && (kptr-1)->type%10 == 8) {\n\t    // Put back the string keyvalue.\n\t    int k;\n\t    for (k = 10; yytext[k] != '\\''; k++);\n\t    yyless(k);\n\t    continuation = 1;\n\t    BEGIN(VALUE);\n\t\n\t  } else {\n\t    // Not a valid continuation.\n\t    yyless(8);\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\n^{KEYWORD} {\n\t  // Keyword without value.\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  BEGIN(COMMENT);\n\t}\n\n^.{8}=\" \"+ {\n\t  // Illegal keyword, carry on regardless.\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  kptr->status |= FITSHDR_KEYWORD;\n\t  BEGIN(VALUE);\n\t}\n\n^.{8}\t{\n\t  // Illegal keyword, carry on regardless.\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  kptr->status |= FITSHDR_KEYWORD;\n\t  BEGIN(COMMENT);\n\t}\n\n<VALUE>\" \"*/\\/ {\n\t  // Null keyvalue.\n\t  BEGIN(INLINE);\n\t}\n\n<VALUE>{LOGICAL} {\n\t  // Logical keyvalue.\n\t  kptr->type = 1;\n\t  kptr->keyvalue.i = (*yytext == 'T');\n\t  BEGIN(INLINE);\n\t}\n\n<VALUE>{INT32} {\n\t  // 32-bit signed integer keyvalue.\n\t  kptr->type = 2;\n\t  if (sscanf(yytext, \"%d\", &(kptr->keyvalue.i)) < 1) {\n\t    kptr->status |= FITSHDR_KEYVALUE;\n\t    BEGIN(ERROR);\n\t  }\n\t\n\t  BEGIN(INLINE);\n\t}\n\n<VALUE>{INT64} {\n\t  // 64-bit signed integer keyvalue (up to 18 digits).\n\t  double dtmp;\n\t  if (wcsutil_str2double(yytext, &dtmp)) {\n\t    kptr->status |= FITSHDR_KEYVALUE;\n\t    BEGIN(ERROR);\n\t\n\t  } else if (INT_MIN <= dtmp && dtmp <= INT_MAX) {\n\t    // Can be accomodated as a 32-bit signed integer.\n\t    kptr->type = 2;\n\t    if (sscanf(yytext, \"%d\", &(kptr->keyvalue.i)) < 1) {\n\t      kptr->status |= FITSHDR_KEYVALUE;\n\t      BEGIN(ERROR);\n\t    }\n\t\n\t  } else {\n\t    // 64-bit signed integer.\n\t    kptr->type = 3;\n\t    #ifdef WCSLIB_INT64\n\t      // Native 64-bit integer is available.\n\t      if (sscanf(yytext, int64fmt, &(kptr->keyvalue.k)) < 1) {\n\t        kptr->status |= FITSHDR_KEYVALUE;\n\t        BEGIN(ERROR);\n\t      }\n\t    #else\n\t      // 64-bit integer (up to 18 digits) implemented as int[3].\n\t      kptr->keyvalue.k[2] = 0;\n\t\n\t      sprintf(ctmp, \"%%%dd%%9d\", yyleng-9);\n\t      if (sscanf(yytext, ctmp, kptr->keyvalue.k+1,\n\t                 kptr->keyvalue.k) < 1) {\n\t        kptr->status |= FITSHDR_KEYVALUE;\n\t        BEGIN(ERROR);\n\t      } else if (*yytext == '-') {\n\t        kptr->keyvalue.k[0] *= -1;\n\t      }\n\t    #endif\n\t  }\n\t\n\t  BEGIN(INLINE);\n\t}\n\n<VALUE>{INTVL} {\n\t  // Very long integer keyvalue (and 19-digit int64).\n\t  kptr->type = 4;\n\t  strcpy(ctmp, yytext);\n\t  int j, k = yyleng;\n\t  for (j = 0; j < 8; j++) {\n\t    // Read it backwards.\n\t    k -= 9;\n\t    if (k < 0) k = 0;\n\t    if (sscanf(ctmp+k, \"%d\", kptr->keyvalue.l+j) < 1) {\n\t      kptr->status |= FITSHDR_KEYVALUE;\n\t      BEGIN(ERROR);\n\t    }\n\t    if (*yytext == '-') {\n\t      kptr->keyvalue.l[j] = -abs(kptr->keyvalue.l[j]);\n\t    }\n\t\n\t    if (k == 0) break;\n\t    ctmp[k] = '\\0';\n\t  }\n\t\n\t  // Can it be accomodated as a 64-bit signed integer?\n\t  if (j == 2 && abs(kptr->keyvalue.l[2]) <=  9 &&\n\t                abs(kptr->keyvalue.l[1]) <=  223372036 &&\n\t                    kptr->keyvalue.l[0]  <=  854775807 &&\n\t                    kptr->keyvalue.l[0]  >= -854775808) {\n\t    kptr->type = 3;\n\t\n\t    #ifdef WCSLIB_INT64\n\t      // Native 64-bit integer is available.\n\t      kptr->keyvalue.l[2] = 0;\n\t      if (sscanf(yytext, int64fmt, &(kptr->keyvalue.k)) < 1) {\n\t        kptr->status |= FITSHDR_KEYVALUE;\n\t        BEGIN(ERROR);\n\t      }\n\t    #endif\n\t  }\n\t\n\t  BEGIN(INLINE);\n\t}\n\n<VALUE>{FLOAT} {\n\t  // Float keyvalue.\n\t  kptr->type = 5;\n\t  if (wcsutil_str2double(yytext, &(kptr->keyvalue.f))) {\n\t    kptr->status |= FITSHDR_KEYVALUE;\n\t    BEGIN(ERROR);\n\t  }\n\t\n\t  BEGIN(INLINE);\n\t}\n\n<VALUE>{ICOMPLX} {\n\t  // Integer complex keyvalue.\n\t  kptr->type = 6;\n\t  if (sscanf(yytext, \"(%lf,%lf)\", kptr->keyvalue.c,\n\t      kptr->keyvalue.c+1) < 2) {\n\t    kptr->status |= FITSHDR_KEYVALUE;\n\t    BEGIN(ERROR);\n\t  }\n\t\n\t  BEGIN(INLINE);\n\t}\n\n<VALUE>{FCOMPLX} {\n\t  // Floating point complex keyvalue.\n\t  kptr->type = 7;\n\t\n\t  char *cptr;\n\t  int k;\n\t  for (cptr = ctmp, k = 1; yytext[k] != ','; cptr++, k++) {\n\t    *cptr = yytext[k];\n\t  }\n\t  *cptr = '\\0';\n\t\n\t  if (wcsutil_str2double(ctmp, kptr->keyvalue.c)) {\n\t    kptr->status |= FITSHDR_KEYVALUE;\n\t    BEGIN(ERROR);\n\t  }\n\t\n\t  for (cptr = ctmp, k++; yytext[k] != ')'; cptr++, k++) {\n\t    *cptr = yytext[k];\n\t  }\n\t  *cptr = '\\0';\n\t\n\t  if (wcsutil_str2double(ctmp, kptr->keyvalue.c+1)) {\n\t    kptr->status |= FITSHDR_KEYVALUE;\n\t    BEGIN(ERROR);\n\t  }\n\t\n\t  BEGIN(INLINE);\n\t}\n\n<VALUE>{STRING} {\n\t  // String keyvalue.\n\t  kptr->type = 8;\n\t  char *cptr = kptr->keyvalue.s;\n\t  strcpy(cptr, yytext+1);\n\t\n\t  // Squeeze out repeated quotes.\n\t  int k = 0;\n\t  for (int j = 0; j < 72; j++) {\n\t    if (k < j) {\n\t      cptr[k] = cptr[j];\n\t    }\n\t\n\t    if (cptr[j] == '\\0') {\n\t      if (k) cptr[k-1] = '\\0';\n\t      break;\n\t    } else if (cptr[j] == '\\'' && cptr[j+1] == '\\'') {\n\t      j++;\n\t    }\n\t\n\t    k++;\n\t  }\n\t\n\t  if (*cptr) {\n\t    // Retain the initial blank in all-blank strings.\n\t    nullfill(cptr+1, 71);\n\t  } else {\n\t    nullfill(cptr, 72);\n\t  }\n\t\n\t  BEGIN(INLINE);\n\t}\n\n<VALUE>. {\n\t  kptr->status |= FITSHDR_KEYVALUE;\n\t  BEGIN(ERROR);\n\t}\n\n<INLINE>\" \"*$ {\n\t  BEGIN(FLUSH);\n\t}\n\n<INLINE>\" \"*\\/\" \"*$ {\n\t  BEGIN(FLUSH);\n\t}\n\n<INLINE>\" \"*\\/\" \"* {\n\t  BEGIN(UNITS);\n\t}\n\n<INLINE>\" \" {\n\t  kptr->status |= FITSHDR_COMMENT;\n\t  BEGIN(ERROR);\n\t}\n\n<INLINE>. {\n\t  // Keyvalue parsing must now also be suspect.\n\t  kptr->status |= FITSHDR_COMMENT;\n\t  kptr->type = 0;\n\t  BEGIN(ERROR);\n\t}\n\n<UNITS>{UNITSTR} {\n\t  kptr->ulen = yyleng;\n\t  yymore();\n\t  BEGIN(COMMENT);\n\t}\n\n<UNITS>. {\n\t  yymore();\n\t  BEGIN(COMMENT);\n\t}\n\n<COMMENT>.* {\n\t  strcpy(kptr->comment, yytext);\n\t  nullfill(kptr->comment, 84);\n\t  BEGIN(FLUSH);\n\t}\n\n<ERROR>.* {\n\t  if (!continuation) kptr->type = -abs(kptr->type);\n\t\n\t  sprintf(kptr->comment, \"%.80s\", yyextra->hdr-80);\n\t  kptr->comment[80] = '\\0';\n\t  nullfill(kptr->comment+80, 4);\n\t\n\t  BEGIN(FLUSH);\n\t}\n\n<FLUSH>.*\\n {\n\t  // Discard the rest of the input line.\n\t  kptr->keyno = ++keyno;\n\t\n\t  // Null-fill the keyword.\n\t  kptr->keyword[8] = '\\0';\n\t  nullfill(kptr->keyword, 12);\n\t\n\t  // Do indexing.\n\t  iptr = keyids;\n\t  kptr->keyid = -1;\n\t  for (int j = 0; j < nkeyids; j++, iptr++) {\n\t    int k;\n\t    char *cptr = iptr->name;\n\t    cptr[8] = '\\0';\n\t    nullfill(cptr, 12);\n\t    for (k = 0; k < 8; k++, cptr++) {\n\t      if (*cptr != '.' && *cptr != kptr->keyword[k]) break;\n\t    }\n\t\n\t    if (k == 8) {\n\t      // Found a match.\n\t      iptr->count++;\n\t      if (iptr->idx[0] == -1) {\n\t        iptr->idx[0] = keyno-1;\n\t      } else {\n\t        iptr->idx[1] = keyno-1;\n\t      }\n\t\n\t      kptr->keyno = -abs(kptr->keyno);\n\t      if (kptr->keyid < 0) kptr->keyid = j;\n\t    }\n\t  }\n\t\n\t  // Deal with continued strings.\n\t  if (continuation) {\n\t    // Tidy up the previous string keyvalue.\n\t    if ((kptr-1)->type == 8) (kptr-1)->type += 10;\n\t    char *cptr = (kptr-1)->keyvalue.s;\n\t    if (cptr[strlen(cptr)-1] == '&') cptr[strlen(cptr)-1] = '\\0';\n\t\n\t    kptr->type = (kptr-1)->type + 10;\n\t  }\n\t\n\t  // Check for keyrecords following the END keyrecord.\n\t  if (end && (end++ > 1) && !blank) {\n\t    kptr->status |= FITSHDR_TRAILER;\n\t  }\n\t  if (kptr->status) (*nreject)++;\n\t\n\t  kptr++;\n\t  blank = 0;\n\t  continuation = 0;\n\t\n\t  BEGIN(INITIAL);\n\t}\n\n<<EOF>>\t{\n\t  // End-of-input.\n\t  return 0;\n\t}\n\n%%\n\n/*----------------------------------------------------------------------------\n* External interface to the scanner.\n*---------------------------------------------------------------------------*/\n\nint fitshdr(\n  const char header[],\n  int nkeyrec,\n  int nkeyids,\n  struct fitskeyid keyids[],\n  int *nreject,\n  struct fitskey **keys)\n\n{\n  // Function prototypes.\n  int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner);\n  int yylex_destroy(yyscan_t yyscanner);\n\n  struct fitshdr_extra extra;\n  yyscan_t yyscanner;\n  yylex_init_extra(&extra, &yyscanner);\n  int status = fitshdr_scanner(header, nkeyrec, nkeyids, keyids, nreject,\n                               keys, yyscanner);\n  yylex_destroy(yyscanner);\n\n  return status;\n}\n\n/*----------------------------------------------------------------------------\n* Pad a string with null characters.\n*---------------------------------------------------------------------------*/\n\nvoid nullfill(char cptr[], int len)\n\n{\n  // Propagate the terminating null to the end of the string.\n  int j;\n  for (j = 0; j < len; j++) {\n    if (cptr[j] == '\\0') {\n      for (int k = j+1; k < len; k++) {\n        cptr[k] = '\\0';\n      }\n      break;\n    }\n  }\n\n  // Remove trailing blanks.\n  for (int k = j-1; k >= 0; k--) {\n    if (cptr[k] != ' ') break;\n    cptr[k] = '\\0';\n  }\n\n  return;\n}\n"},{"id":16573,"name":"spc.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: spc.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"wcserr.h\"\n#include \"wcsmath.h\"\n#include \"wcsprintf.h\"\n#include \"wcstrig.h\"\n#include \"wcsutil.h\"\n#include \"spc.h\"\n#include \"spx.h\"\n\n// Spectral algorithm codes.\n#define F2S 100;\t\t// Axis linear in frequency.\n#define W2S 200;\t\t// Axis linear in vacuum wavelengths.\n#define A2S 300;\t\t// Axis linear in air wavelengths.\n#define V2S 400;\t\t// Axis linear in velocity.\n#define GRI 500;\t\t// Grism in vacuum.\n#define GRA 600;\t\t// Grism in air.\n\n// S-type spectral variables.\n#define FREQ  0;\t\t// Frequency-like.\n#define AFRQ  1;\t\t// Frequency-like.\n#define ENER  2;\t\t// Frequency-like.\n#define WAVN  3;\t\t// Frequency-like.\n#define VRAD  4;\t\t// Frequency-like.\n#define WAVE 10;\t\t// Vacuum wavelength-like.\n#define VOPT 11;\t\t// Vacuum wavelength-like.\n#define ZOPT 12;\t\t// Vacuum wavelength-like.\n#define AWAV 20;\t\t// Air wavelength-like.\n#define VELO 30;\t\t// Velocity-like.\n#define BETA 31;\t\t// Velocity-like.\n\n\n// Map status return value to message.\nconst char *spc_errmsg[] = {\n  \"Success\",\n  \"Null spcprm pointer passed\",\n  \"Invalid spectral parameters\",\n  \"One or more of x coordinates were invalid\",\n  \"One or more of the spec coordinates were invalid\"};\n\n// Map error returns for lower-level routines.  SPXERR_BAD_INSPEC_COORD\n// maps to either SPCERR_BAD_X or SPCERR_BAD_SPEC depending on context.\nconst int spc_spxerr[] = {\n\n  SPCERR_SUCCESS,\t\t//  0: SPXERR_SUCCESS\n  SPCERR_NULL_POINTER,\t\t//  1: SPXERR_NULL_POINTER\n  SPCERR_BAD_SPEC_PARAMS,\t//  2: SPXERR_BAD_SPEC_PARAMS\n  SPCERR_BAD_SPEC_PARAMS\t//  3: SPXERR_BAD_SPEC_VAR\n\t\t\t\t//  4: SPXERR_BAD_INSPEC_COORD\n};\n\n// Convenience macro for invoking wcserr_set().\n#define SPC_ERRMSG(status) WCSERR_SET(status), spc_errmsg[status]\n\n\n#define C 2.99792458e8\n\n//----------------------------------------------------------------------------\n\nint spcini(struct spcprm *spc)\n\n{\n  register int k;\n\n  if (spc == 0x0) return SPCERR_NULL_POINTER;\n\n  spc->flag = 0;\n\n  memset(spc->type, 0, 8);\n  strcpy(spc->type, \"    \");\n  strcpy(spc->code, \"   \");\n\n  spc->crval = UNDEFINED;\n  spc->restfrq =  0.0;\n  spc->restwav =  0.0;\n\n  for (k = 0; k < 7; k++) {\n    spc->pv[k] = UNDEFINED;\n  }\n\n  for (k = 0; k < 6; k++) {\n    spc->w[k] = 0.0;\n  }\n\n  spc->isGrism  = 0;\n  spc->padding1 = 0;\n\n  spc->err = 0x0;\n\n  spc->padding2 = 0x0;\n  spc->spxX2P = 0x0;\n  spc->spxP2S = 0x0;\n  spc->spxS2P = 0x0;\n  spc->spxP2X = 0x0;\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint spcfree(struct spcprm *spc)\n\n{\n  if (spc == 0x0) return SPCERR_NULL_POINTER;\n\n  wcserr_clear(&(spc->err));\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint spcsize(const struct spcprm *spc, int sizes[2])\n\n{\n  if (spc == 0x0) {\n    sizes[0] = sizes[1] = 0;\n    return SPCERR_SUCCESS;\n  }\n\n  // Base size, in bytes.\n  sizes[0] = sizeof(struct spcprm);\n\n  // Total size of allocated memory, in bytes.\n  sizes[1] = 0;\n\n  int exsizes[2];\n\n  // spcprm::err.\n  wcserr_size(spc->err, exsizes);\n  sizes[1] += exsizes[0] + exsizes[1];\n\n  return SPCERR_SUCCESS;\n}\n\n//----------------------------------------------------------------------------\n\nint spcprt(const struct spcprm *spc)\n\n{\n  char hext[32];\n  int  i;\n\n  if (spc == 0x0) return SPCERR_NULL_POINTER;\n\n  wcsprintf(\"       flag: %d\\n\", spc->flag);\n  wcsprintf(\"       type: \\\"%s\\\"\\n\", spc->type);\n  wcsprintf(\"       code: \\\"%s\\\"\\n\", spc->code);\n  if (undefined(spc->crval)) {\n    wcsprintf(\"      crval: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"      crval: %#- 11.5g\\n\", spc->crval);\n  }\n  wcsprintf(\"    restfrq: %f\\n\", spc->restfrq);\n  wcsprintf(\"    restwav: %f\\n\", spc->restwav);\n\n  wcsprintf(\"         pv:\");\n  if (spc->isGrism) {\n    for (i = 0; i < 5; i++) {\n      if (undefined(spc->pv[i])) {\n        wcsprintf(\"  UNDEFINED   \");\n      } else {\n        wcsprintf(\"  %#- 11.5g\", spc->pv[i]);\n      }\n    }\n    wcsprintf(\"\\n            \");\n    for (i = 5; i < 7; i++) {\n      if (undefined(spc->pv[i])) {\n        wcsprintf(\"  UNDEFINED   \");\n      } else {\n        wcsprintf(\"  %#- 11.5g\", spc->pv[i]);\n      }\n    }\n    wcsprintf(\"\\n\");\n\n  } else {\n    wcsprintf(\" (not used)\\n\");\n  }\n\n  wcsprintf(\"          w:\");\n  for (i = 0; i < 3; i++) {\n    wcsprintf(\"  %#- 11.5g\", spc->w[i]);\n  }\n  if (spc->isGrism) {\n    wcsprintf(\"\\n            \");\n    for (i = 3; i < 6; i++) {\n      wcsprintf(\"  %#- 11.5g\", spc->w[i]);\n    }\n    wcsprintf(\"\\n\");\n  } else {\n    wcsprintf(\"  (remainder unused)\\n\");\n  }\n\n  wcsprintf(\"    isGrism: %d\\n\", spc->isGrism);\n\n  WCSPRINTF_PTR(\"        err: \", spc->err, \"\\n\");\n  if (spc->err) {\n    wcserr_prt(spc->err, \"             \");\n  }\n\n  wcsprintf(\"     spxX2P: %s\\n\",\n    wcsutil_fptr2str((void (*)(void))spc->spxX2P, hext));\n  wcsprintf(\"     spxP2S: %s\\n\",\n    wcsutil_fptr2str((void (*)(void))spc->spxP2S, hext));\n  wcsprintf(\"     spxS2P: %s\\n\",\n    wcsutil_fptr2str((void (*)(void))spc->spxS2P, hext));\n  wcsprintf(\"     spxP2X: %s\\n\",\n    wcsutil_fptr2str((void (*)(void))spc->spxP2X, hext));\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint spcperr(const struct spcprm *spc, const char *prefix)\n\n{\n  if (spc == 0x0) return SPCERR_NULL_POINTER;\n\n  if (spc->err) {\n    wcserr_prt(spc->err, prefix);\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint spcset(struct spcprm *spc)\n\n{\n  static const char *function = \"spcset\";\n\n  char   ctype[9], ptype, xtype;\n  int    restreq, status;\n  double alpha, beta_r, crvalX, dn_r, dXdS, epsilon, G, m, lambda_r, n_r,\n         t, restfrq, restwav, theta;\n  struct wcserr **err;\n\n  if (spc == 0x0) return SPCERR_NULL_POINTER;\n  err = &(spc->err);\n\n  if (undefined(spc->crval)) {\n    return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n      \"Spectral crval is undefined\");\n  }\n\n  memset((spc->type)+4, 0, 4);\n  spc->code[3] = '\\0';\n  wcsutil_blank_fill(4, spc->type);\n  wcsutil_blank_fill(3, spc->code);\n  spc->w[0] = 0.0;\n\n\n  // Analyse the spectral axis type.\n  memset(ctype, 0, 9);\n  memcpy(ctype, spc->type, 4);\n  if (*(spc->code) != ' ') {\n    sprintf(ctype+4, \"-%s\", spc->code);\n  }\n  restfrq = spc->restfrq;\n  restwav = spc->restwav;\n  if ((status = spcspxe(ctype, spc->crval, restfrq, restwav, &ptype, &xtype,\n                        &restreq, &crvalX, &dXdS, &(spc->err)))) {\n    return status;\n  }\n\n  // Satisfy rest frequency/wavelength requirements.\n  if (restreq) {\n    if (restreq == 3 && restfrq == 0.0 && restwav == 0.0) {\n      // VRAD-V2F, VOPT-V2W, and ZOPT-V2W require the rest frequency or\n      // wavelength for the S-P and P-X transformations but not for S-X\n      // so supply a phoney value.\n      restwav = 1.0;\n    }\n\n    if (restfrq == 0.0) {\n      restfrq = C/restwav;\n    } else {\n      restwav = C/restfrq;\n    }\n\n    if (ptype == 'F') {\n      spc->w[0] = restfrq;\n    } else if (ptype != 'V') {\n      spc->w[0] = restwav;\n    } else {\n      if (xtype == 'F') {\n        spc->w[0] = restfrq;\n      } else {\n        spc->w[0] = restwav;\n      }\n    }\n  }\n\n  spc->w[1] = crvalX;\n  spc->w[2] = dXdS;\n\n\n  // Set pointers-to-functions for the linear part of the transformation.\n  if (ptype == 'F') {\n    if (strcmp(spc->type, \"FREQ\") == 0) {\n      // Frequency.\n      spc->flag = FREQ;\n      spc->spxP2S = 0x0;\n      spc->spxS2P = 0x0;\n\n    } else if (strcmp(spc->type, \"AFRQ\") == 0) {\n      // Angular frequency.\n      spc->flag = AFRQ;\n      spc->spxP2S = freqafrq;\n      spc->spxS2P = afrqfreq;\n\n    } else if (strcmp(spc->type, \"ENER\") == 0) {\n      // Photon energy.\n      spc->flag = ENER;\n      spc->spxP2S = freqener;\n      spc->spxS2P = enerfreq;\n\n    } else if (strcmp(spc->type, \"WAVN\") == 0) {\n      // Wave number.\n      spc->flag = WAVN;\n      spc->spxP2S = freqwavn;\n      spc->spxS2P = wavnfreq;\n\n    } else if (strcmp(spc->type, \"VRAD\") == 0) {\n      // Radio velocity.\n      spc->flag = VRAD;\n      spc->spxP2S = freqvrad;\n      spc->spxS2P = vradfreq;\n    }\n\n  } else if (ptype == 'W') {\n    if (strcmp(spc->type, \"WAVE\") == 0) {\n      // Vacuum wavelengths.\n      spc->flag = WAVE;\n      spc->spxP2S = 0x0;\n      spc->spxS2P = 0x0;\n\n    } else if (strcmp(spc->type, \"VOPT\") == 0) {\n      // Optical velocity.\n      spc->flag = VOPT;\n      spc->spxP2S = wavevopt;\n      spc->spxS2P = voptwave;\n\n    } else if (strcmp(spc->type, \"ZOPT\") == 0) {\n      // Redshift.\n      spc->flag = ZOPT;\n      spc->spxP2S = wavezopt;\n      spc->spxS2P = zoptwave;\n    }\n\n  } else if (ptype == 'A') {\n    if (strcmp(spc->type, \"AWAV\") == 0) {\n      // Air wavelengths.\n      spc->flag = AWAV;\n      spc->spxP2S = 0x0;\n      spc->spxS2P = 0x0;\n    }\n\n  } else if (ptype == 'V') {\n    if (strcmp(spc->type, \"VELO\") == 0) {\n      // Relativistic velocity.\n      spc->flag = VELO;\n      spc->spxP2S = 0x0;\n      spc->spxS2P = 0x0;\n\n    } else if (strcmp(spc->type, \"BETA\") == 0) {\n      // Velocity ratio (v/c).\n      spc->flag = BETA;\n      spc->spxP2S = velobeta;\n      spc->spxS2P = betavelo;\n    }\n  }\n\n\n  // Set pointers-to-functions for the non-linear part of the spectral\n  // transformation.\n  spc->isGrism = 0;\n  if (xtype == 'F') {\n    // Axis is linear in frequency.\n    if (ptype == 'F') {\n      spc->spxX2P = 0x0;\n      spc->spxP2X = 0x0;\n\n    } else if (ptype == 'W') {\n      spc->spxX2P = freqwave;\n      spc->spxP2X = wavefreq;\n\n    } else if (ptype == 'A') {\n      spc->spxX2P = freqawav;\n      spc->spxP2X = awavfreq;\n\n    } else if (ptype == 'V') {\n      spc->spxX2P = freqvelo;\n      spc->spxP2X = velofreq;\n    }\n\n    spc->flag += F2S;\n\n  } else if (xtype == 'W' || xtype == 'w') {\n    // Axis is linear in vacuum wavelengths.\n    if (ptype == 'F') {\n      spc->spxX2P = wavefreq;\n      spc->spxP2X = freqwave;\n\n    } else if (ptype == 'W') {\n      spc->spxX2P = 0x0;\n      spc->spxP2X = 0x0;\n\n    } else if (ptype == 'A') {\n      spc->spxX2P = waveawav;\n      spc->spxP2X = awavwave;\n\n    } else if (ptype == 'V') {\n      spc->spxX2P = wavevelo;\n      spc->spxP2X = velowave;\n    }\n\n    if (xtype == 'W') {\n      spc->flag += W2S;\n    } else {\n      // Grism in vacuum.\n      spc->isGrism = 1;\n      spc->flag += GRI;\n    }\n\n  } else if (xtype == 'A' || xtype == 'a') {\n    // Axis is linear in air wavelengths.\n    if (ptype == 'F') {\n      spc->spxX2P = awavfreq;\n      spc->spxP2X = freqawav;\n\n    } else if (ptype == 'W') {\n      spc->spxX2P = awavwave;\n      spc->spxP2X = waveawav;\n\n    } else if (ptype == 'A') {\n      spc->spxX2P = 0x0;\n      spc->spxP2X = 0x0;\n\n    } else if (ptype == 'V') {\n      spc->spxX2P = awavvelo;\n      spc->spxP2X = veloawav;\n    }\n\n    if (xtype == 'A') {\n      spc->flag += A2S;\n    } else {\n      // Grism in air.\n      spc->isGrism = 2;\n      spc->flag += GRA;\n    }\n\n  } else if (xtype == 'V') {\n    // Axis is linear in relativistic velocity.\n    if (ptype == 'F') {\n      spc->spxX2P = velofreq;\n      spc->spxP2X = freqvelo;\n\n    } else if (ptype == 'W') {\n      spc->spxX2P = velowave;\n      spc->spxP2X = wavevelo;\n\n    } else if (ptype == 'A') {\n      spc->spxX2P = veloawav;\n      spc->spxP2X = awavvelo;\n\n    } else if (ptype == 'V') {\n      spc->spxX2P = 0x0;\n      spc->spxP2X = 0x0;\n    }\n\n    spc->flag += V2S;\n  }\n\n\n  // Check for grism axes.\n  if (spc->isGrism) {\n    // Axis is linear in \"grism parameter\"; work in wavelength.\n    lambda_r = crvalX;\n\n    // Set defaults.\n    if (undefined(spc->pv[0])) spc->pv[0] = 0.0;\n    if (undefined(spc->pv[1])) spc->pv[1] = 0.0;\n    if (undefined(spc->pv[2])) spc->pv[2] = 0.0;\n    if (undefined(spc->pv[3])) spc->pv[3] = 1.0;\n    if (undefined(spc->pv[4])) spc->pv[4] = 0.0;\n    if (undefined(spc->pv[5])) spc->pv[5] = 0.0;\n    if (undefined(spc->pv[6])) spc->pv[6] = 0.0;\n\n    // Compute intermediaries.\n    G       = spc->pv[0];\n    m       = spc->pv[1];\n    alpha   = spc->pv[2];\n    n_r     = spc->pv[3];\n    dn_r    = spc->pv[4];\n    epsilon = spc->pv[5];\n    theta   = spc->pv[6];\n\n    t = G*m/cosd(epsilon);\n    beta_r = asind(t*lambda_r - n_r*sind(alpha));\n\n    t -= dn_r*sind(alpha);\n\n    spc->w[1] = -tand(theta);\n    spc->w[2] *= t / (cosd(beta_r)*cosd(theta)*cosd(theta));\n    spc->w[3] = beta_r + theta;\n    spc->w[4] = (n_r - dn_r*lambda_r)*sind(alpha);\n    spc->w[5] = 1.0 / t;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint spcx2s(\n  struct spcprm *spc,\n  int nx,\n  int sx,\n  int sspec,\n  const double x[],\n  double spec[],\n  int stat[])\n\n{\n  static const char *function = \"spcx2s\";\n\n  int statP2S, status = 0, statX2P;\n  double beta;\n  register int ix;\n  register int *statp;\n  register const double *xp;\n  register double *specp;\n  struct wcserr **err;\n\n  // Initialize.\n  if (spc == 0x0) return SPCERR_NULL_POINTER;\n  err = &(spc->err);\n\n  if (spc->flag == 0) {\n    if ((status = spcset(spc))) return status;\n  }\n\n  // Convert intermediate world coordinate x to X.\n  xp = x;\n  specp = spec;\n  statp = stat;\n  for (ix = 0; ix < nx; ix++, xp += sx, specp += sspec) {\n    *specp = spc->w[1] + (*xp)*spc->w[2];\n    *(statp++) = 0;\n  }\n\n  // If X is the grism parameter then convert it to wavelength.\n  if (spc->isGrism) {\n    specp = spec;\n    for (ix = 0; ix < nx; ix++, specp += sspec) {\n      beta = atand(*specp) + spc->w[3];\n      *specp = (sind(beta) + spc->w[4]) * spc->w[5];\n    }\n  }\n\n  // Apply the non-linear step of the algorithm chain to convert the\n  // X-type spectral variable to P-type intermediate spectral variable.\n  if (spc->spxX2P) {\n    if ((statX2P = spc->spxX2P(spc->w[0], nx, sspec, sspec, spec, spec,\n                               stat))) {\n      if (statX2P == SPXERR_BAD_INSPEC_COORD) {\n        status = SPCERR_BAD_X;\n      } else if (statX2P == SPXERR_BAD_SPEC_PARAMS) {\n        return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n          \"Invalid spectral parameters: Frequency or wavelength is 0\");\n      } else {\n        return wcserr_set(SPC_ERRMSG(spc_spxerr[statX2P]));\n      }\n    }\n  }\n\n  // Apply the linear step of the algorithm chain to convert P-type\n  // intermediate spectral variable to the required S-type variable.\n  if (spc->spxP2S) {\n    if ((statP2S = spc->spxP2S(spc->w[0], nx, sspec, sspec, spec, spec,\n                               stat))) {\n      if (statP2S == SPXERR_BAD_INSPEC_COORD) {\n        status = SPCERR_BAD_X;\n      } else if (statP2S == SPXERR_BAD_SPEC_PARAMS) {\n        return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n          \"Invalid spectral parameters: Frequency or wavelength is 0\");\n      } else {\n        return wcserr_set(SPC_ERRMSG(spc_spxerr[statP2S]));\n      }\n    }\n  }\n\n  if (status) {\n    wcserr_set(SPC_ERRMSG(status));\n  }\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint spcs2x(\n  struct spcprm *spc,\n  int nspec,\n  int sspec,\n  int sx,\n  const double spec[],\n  double x[],\n  int stat[])\n\n{\n  static const char *function = \"spcs2x\";\n\n  int statP2X, status = 0, statS2P;\n  double beta, s;\n  register int ispec;\n  register int *statp;\n  register const double *specp;\n  register double *xp;\n  struct wcserr **err;\n\n  // Initialize.\n  if (spc == 0x0) return SPCERR_NULL_POINTER;\n  err = &(spc->err);\n\n  if (spc->flag == 0) {\n    if ((status = spcset(spc))) return status;\n  }\n\n  // Apply the linear step of the algorithm chain to convert the S-type\n  // spectral variable to P-type intermediate spectral variable.\n  if (spc->spxS2P) {\n    if ((statS2P = spc->spxS2P(spc->w[0], nspec, sspec, sx, spec, x, stat))) {\n      if (statS2P == SPXERR_BAD_INSPEC_COORD) {\n        status = SPCERR_BAD_SPEC;\n      } else if (statS2P == SPXERR_BAD_SPEC_PARAMS) {\n        return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n          \"Invalid spectral parameters: Frequency or wavelength is 0\");\n      } else {\n        return wcserr_set(SPC_ERRMSG(spc_spxerr[statS2P]));\n      }\n    }\n\n  } else {\n    // Just a copy.\n    xp = x;\n    specp = spec;\n    statp = stat;\n    for (ispec = 0; ispec < nspec; ispec++, specp += sspec, xp += sx) {\n      *xp = *specp;\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Apply the non-linear step of the algorithm chain to convert P-type\n  // intermediate spectral variable to X-type spectral variable.\n  if (spc->spxP2X) {\n    if ((statP2X = spc->spxP2X(spc->w[0], nspec, sx, sx, x, x, stat))) {\n      if (statP2X == SPCERR_BAD_SPEC) {\n        status = SPCERR_BAD_SPEC;\n      } else if (statP2X == SPXERR_BAD_SPEC_PARAMS) {\n        return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n          \"Invalid spectral parameters: Frequency or wavelength is 0\");\n      } else {\n        return wcserr_set(SPC_ERRMSG(spc_spxerr[statP2X]));\n      }\n    }\n  }\n\n  if (spc->isGrism) {\n    // Convert X-type spectral variable (wavelength) to grism parameter.\n    xp = x;\n    statp = stat;\n    for (ispec = 0; ispec < nspec; ispec++, xp += sx, statp++) {\n      if (*statp) continue;\n\n      s = *xp/spc->w[5] - spc->w[4];\n      if (fabs(s) <= 1.0) {\n        beta = asind(s);\n        *xp = tand(beta - spc->w[3]);\n      } else {\n        *statp = 1;\n      }\n    }\n  }\n\n\n  // Convert X-type spectral variable to intermediate world coordinate x.\n  xp = x;\n  statp = stat;\n  for (ispec = 0; ispec < nspec; ispec++, xp += sx) {\n    if (*(statp++)) continue;\n\n    *xp -= spc->w[1];\n    *xp /= spc->w[2];\n  }\n\n  if (status) {\n    wcserr_set(SPC_ERRMSG(status));\n  }\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint spctyp(\n  const char ctypei[9],\n  char stype[],\n  char scode[],\n  char sname[],\n  char units[],\n  char *ptype,\n  char *xtype,\n  int  *restreq)\n\n{\n  return spctype(\n    ctypei, stype, scode, sname, units, ptype, xtype, restreq, NULL);\n}\n\n// : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :\n\nint spctype(\n  const char ctypei[9],\n  char stype[],\n  char scode[],\n  char sname[],\n  char units[],\n  char *ptype,\n  char *xtype,\n  int  *restreq,\n  struct wcserr **err)\n\n{\n  static const char *function = \"spctype\";\n\n  char ctype[9], ptype_t, sname_t[32], units_t[8], xtype_t;\n  int  restreq_t = 0;\n\n  if (err) *err = 0x0;\n\n  // Copy with blank padding.\n  sprintf(ctype, \"%-8.8s\", ctypei);\n  ctype[8] = '\\0';\n\n  // Validate the S-type spectral variable.\n  if (strncmp(ctype, \"FREQ\", 4) == 0) {\n    strcpy(sname_t, \"Frequency\");\n    strcpy(units_t, \"Hz\");\n    ptype_t = 'F';\n  } else if (strncmp(ctype, \"AFRQ\", 4) == 0) {\n    strcpy(sname_t, \"Angular frequency\");\n    strcpy(units_t, \"rad/s\");\n    ptype_t = 'F';\n  } else if (strncmp(ctype, \"ENER\", 4) == 0) {\n    strcpy(sname_t, \"Photon energy\");\n    strcpy(units_t, \"J\");\n    ptype_t = 'F';\n  } else if (strncmp(ctype, \"WAVN\", 4) == 0) {\n    strcpy(sname_t, \"Wavenumber\");\n    strcpy(units_t, \"/m\");\n    ptype_t = 'F';\n  } else if (strncmp(ctype, \"VRAD\", 4) == 0) {\n    strcpy(sname_t, \"Radio velocity\");\n    strcpy(units_t, \"m/s\");\n    ptype_t = 'F';\n    restreq_t = 1;\n  } else if (strncmp(ctype, \"WAVE\", 4) == 0) {\n    strcpy(sname_t, \"Vacuum wavelength\");\n    strcpy(units_t, \"m\");\n    ptype_t = 'W';\n  } else if (strncmp(ctype, \"VOPT\", 4) == 0) {\n    strcpy(sname_t, \"Optical velocity\");\n    strcpy(units_t, \"m/s\");\n    ptype_t = 'W';\n    restreq_t = 1;\n  } else if (strncmp(ctype, \"ZOPT\", 4) == 0) {\n    strcpy(sname_t, \"Redshift\");\n    strcpy(units_t, \"\");\n    ptype_t = 'W';\n    restreq_t = 1;\n  } else if (strncmp(ctype, \"AWAV\", 4) == 0) {\n    strcpy(sname_t, \"Air wavelength\");\n    strcpy(units_t, \"m\");\n    ptype_t = 'A';\n  } else if (strncmp(ctype, \"VELO\", 4) == 0) {\n    strcpy(sname_t, \"Relativistic velocity\");\n    strcpy(units_t, \"m/s\");\n    ptype_t = 'V';\n  } else if (strncmp(ctype, \"BETA\", 4) == 0) {\n    strcpy(sname_t, \"Velocity ratio (v/c)\");\n    strcpy(units_t, \"\");\n    ptype_t = 'V';\n  } else {\n    return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n      \"Unknown spectral type '%s'\", ctype);\n  }\n\n\n  // Determine X-type and validate the spectral algorithm code.\n  if ((xtype_t = ctype[5]) == ' ') {\n    // The algorithm code must be completely blank.\n    if (strcmp(ctype+4, \"    \") != 0) {\n      return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n        \"Invalid spectral algorithm '%s'\", ctype+4);\n    }\n\n    xtype_t = ptype_t;\n\n  } else if (ctype[4] != '-') {\n    return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n      \"Invalid spectral type '%s'\", ctype);\n\n  } else if (strcmp(ctype+5, \"LOG\") == 0 || strcmp(ctype+5, \"TAB\") == 0) {\n    // Logarithmic or tabular axis, not linear in any spectral type.\n\n  } else if (xtype_t == 'G') {\n    // Validate the algorithm code.\n    if (ctype[6] != 'R') {\n      return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n        \"Invalid spectral algorithm '%s'\", xtype_t);\n    }\n\n    // Grism coordinates...\n    if (ctype[7] == 'I') {\n      // ...in vacuum.\n      xtype_t = 'w';\n    } else if (ctype[7] == 'A') {\n      // ...in air.\n      xtype_t = 'a';\n    } else {\n      return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n        \"Invalid spectral algorithm '%s'\", xtype_t);\n    }\n\n  } else if (ctype[6] != '2') {\n    // Algorithm code has invalid syntax.\n    return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n      \"Invalid spectral algorithm syntax '%s'\", xtype_t);\n  } else if (ctype[7] != ptype_t && ctype[7] != '?') {\n    // The P-, and S-type variables are inconsistent.\n    return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n      \"In spectral type '%s', P- and S-type variables are inconsistent\",\n      ctype);\n\n  } else if (ctype[7] == ctype[5]) {\n    // Degenerate algorithm code.\n    sprintf(ctype+4, \"    \");\n  }\n\n\n  // Rest freq/wavelength required for transformation between P and X?\n  if (strchr(\"FWAwa\", (int)xtype_t)) {\n    if (ptype_t == 'V') {\n      restreq_t += 2;\n    }\n  } else if (xtype_t == 'V') {\n    if (strchr(\"FWAwa\", (int)ptype_t)) {\n      restreq_t += 2;\n    }\n  } else if (strchr(\"LT\", (int)xtype_t) == 0) {\n    // Invalid X-type variable code.\n    return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n      \"In spectral type '%s', invalid X-type variable code\", ctype);\n  }\n\n\n  // Copy results.\n  if (stype) {\n    memcpy(stype, ctype, 4);\n    stype[4] = '\\0';\n  }\n  if (scode) strcpy(scode, ctype+5);\n  if (sname) strcpy(sname, sname_t);\n  if (units) strcpy(units, units_t);\n  if (ptype) *ptype = ptype_t;\n  if (xtype) *xtype = xtype_t;\n  if (restreq) *restreq = restreq_t;\n\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint spcspx(\n  const char ctypeS[9],\n  double crvalS,\n  double restfrq,\n  double restwav,\n  char *ptype,\n  char *xtype,\n  int *restreq,\n  double *crvalX,\n  double *dXdS)\n\n{\n  return spcspxe(ctypeS, crvalS, restfrq, restwav, ptype, xtype, restreq,\n                 crvalX, dXdS, 0x0);\n}\n\n// : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :\n\nint spcspxe(\n  const char ctypeS[9],\n  double crvalS,\n  double restfrq,\n  double restwav,\n  char *ptype,\n  char *xtype,\n  int *restreq,\n  double *crvalX,\n  double *dXdS,\n  struct wcserr **err)\n\n{\n  static const char *function = \"spcspxe\";\n\n  char scode[4], stype[5], type[8];\n  int  status;\n  double dPdS, dXdP;\n  struct spxprm spx;\n\n\n  // Analyse the spectral axis code.\n  if ((status = spctype(ctypeS, stype, scode, 0x0, 0x0, ptype, xtype, restreq,\n                        err))) {\n    return status;\n  }\n\n  if (strchr(\"LT\", (int)(*xtype))) {\n    // Can't handle logarithmic or tabular coordinates.\n    return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n      \"Can't handle logarithmic or tabular coordinates\");\n  }\n\n  // Do we have rest frequency and/or wavelength as required?\n  if ((*restreq)%3 && restfrq == 0.0 && restwav == 0.0) {\n    return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n      \"Missing required rest frequency or wavelength\");\n  }\n\n  // Compute all spectral parameters and their derivatives.\n  strcpy(type, stype);\n  spx.err = (err ? *err : 0x0);\n  if ((status = specx(type, crvalS, restfrq, restwav, &spx))) {\n    status = spc_spxerr[status];\n    if (err) {\n      if ((*err = spx.err)) {\n        (*err)->status = status;\n      }\n    } else {\n      wcserr_clear(&(spx.err));\n    }\n    return status;\n  }\n\n\n  // Transform S-P (linear) and P-X (non-linear).\n  dPdS = 0.0;\n  dXdP = 0.0;\n  if (*ptype == 'F') {\n    if (strcmp(stype, \"FREQ\") == 0) {\n      dPdS = 1.0;\n    } else if (strcmp(stype, \"AFRQ\") == 0) {\n      dPdS = spx.dfreqafrq;\n    } else if (strcmp(stype, \"ENER\") == 0) {\n      dPdS = spx.dfreqener;\n    } else if (strcmp(stype, \"WAVN\") == 0) {\n      dPdS = spx.dfreqwavn;\n    } else if (strcmp(stype, \"VRAD\") == 0) {\n      dPdS = spx.dfreqvrad;\n    }\n\n    if (*xtype == 'F') {\n      *crvalX = spx.freq;\n      dXdP = 1.0;\n    } else if (*xtype == 'W' || *xtype == 'w') {\n      *crvalX = spx.wave;\n      dXdP = spx.dwavefreq;\n    } else if (*xtype == 'A' || *xtype == 'a') {\n      *crvalX = spx.awav;\n      dXdP = spx.dawavfreq;\n    } else if (*xtype == 'V') {\n      *crvalX = spx.velo;\n      dXdP = spx.dvelofreq;\n    }\n\n  } else if (*ptype == 'W' || *ptype == 'w') {\n    if (strcmp(stype, \"WAVE\") == 0) {\n      dPdS = 1.0;\n    } else if (strcmp(stype, \"VOPT\") == 0) {\n      dPdS = spx.dwavevopt;\n    } else if (strcmp(stype, \"ZOPT\") == 0) {\n      dPdS = spx.dwavezopt;\n    }\n\n    if (*xtype == 'F') {\n      *crvalX = spx.freq;\n      dXdP = spx.dfreqwave;\n    } else if (*xtype == 'W' || *xtype == 'w') {\n      *crvalX = spx.wave;\n      dXdP = 1.0;\n    } else if (*xtype == 'A' || *xtype == 'a') {\n      *crvalX = spx.awav;\n      dXdP = spx.dawavwave;\n    } else if (*xtype == 'V') {\n      *crvalX = spx.velo;\n      dXdP = spx.dvelowave;\n    }\n\n  } else if (*ptype == 'A' || *ptype == 'a') {\n    if (strcmp(stype, \"AWAV\") == 0) {\n      dPdS = 1.0;\n    }\n\n    if (*xtype == 'F') {\n      *crvalX = spx.freq;\n      dXdP = spx.dfreqawav;\n    } else if (*xtype == 'W' || *xtype == 'w') {\n      *crvalX = spx.wave;\n      dXdP = spx.dwaveawav;\n    } else if (*xtype == 'A' || *xtype == 'a') {\n      *crvalX = spx.awav;\n      dXdP = 1.0;\n    } else if (*xtype == 'V') {\n      *crvalX = spx.velo;\n      dXdP = spx.dveloawav;\n    }\n\n  } else if (*ptype == 'V') {\n    if (strcmp(stype, \"VELO\") == 0) {\n      dPdS = 1.0;\n    } else if (strcmp(stype, \"BETA\") == 0) {\n      dPdS = spx.dvelobeta;\n    }\n\n    if (*xtype == 'F') {\n      *crvalX = spx.freq;\n      dXdP = spx.dfreqvelo;\n    } else if (*xtype == 'W' || *xtype == 'w') {\n      *crvalX = spx.wave;\n      dXdP = spx.dwavevelo;\n    } else if (*xtype == 'A' || *xtype == 'a') {\n      *crvalX = spx.awav;\n      dXdP = spx.dawavvelo;\n    } else if (*xtype == 'V') {\n      *crvalX = spx.velo;\n      dXdP = 1.0;\n    }\n  }\n\n  *dXdS = dXdP * dPdS;\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint spcxps(\n  const char ctypeS[9],\n  double crvalX,\n  double restfrq,\n  double restwav,\n  char *ptype,\n  char *xtype,\n  int *restreq,\n  double *crvalS,\n  double *dSdX)\n\n{\n  return spcxpse(ctypeS, crvalX, restfrq, restwav, ptype, xtype, restreq,\n                 crvalS, dSdX, NULL);\n}\n\n// : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :\n\nint spcxpse(\n  const char ctypeS[9],\n  double crvalX,\n  double restfrq,\n  double restwav,\n  char *ptype,\n  char *xtype,\n  int *restreq,\n  double *crvalS,\n  double *dSdX,\n  struct wcserr **err)\n\n{\n  static const char *function = \"spcxpse\";\n\n  char scode[4], stype[5], type[8];\n  int  status;\n  double dPdX, dSdP;\n  struct spxprm spx;\n\n  // Analyse the spectral axis type.\n  if ((status = spctype(ctypeS, stype, scode, 0x0, 0x0, ptype, xtype, restreq,\n                        err))) {\n    return status;\n  }\n\n  if (strchr(\"LT\", (int)(*xtype))) {\n    // Can't handle logarithmic or tabular coordinates.\n    return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n      \"Can't handle logarithmic or tabular coordinates\");\n  }\n\n  // Do we have rest frequency and/or wavelength as required?\n  if ((*restreq)%3 && restfrq == 0.0 && restwav == 0.0) {\n    return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n      \"Missing required rest frequency or wavelength\");\n  }\n\n  // Compute all spectral parameters and their derivatives.\n  if (*xtype == 'F') {\n    strcpy(type, \"FREQ\");\n  } else if (*xtype == 'W' || *xtype == 'w') {\n    strcpy(type, \"WAVE\");\n  } else if (*xtype == 'A' || *xtype == 'a') {\n    strcpy(type, \"AWAV\");\n  } else if (*xtype == 'V') {\n    strcpy(type, \"VELO\");\n  }\n\n  spx.err = (err ? *err : 0x0);\n  if (specx(type, crvalX, restfrq, restwav, &spx)) {\n    status = spc_spxerr[status];\n    if (err) {\n      if ((*err = spx.err)) {\n        (*err)->status = status;\n      }\n    } else {\n      wcserr_clear(&(spx.err));\n    }\n    return status;\n  }\n\n\n  // Transform X-P (non-linear) and P-S (linear).\n  dPdX = 0.0;\n  dSdP = 0.0;\n  if (*ptype == 'F') {\n    if (*xtype == 'F') {\n      dPdX = 1.0;\n    } else if (*xtype == 'W' || *xtype == 'w') {\n      dPdX = spx.dfreqwave;\n    } else if (*xtype == 'A' || *xtype == 'a') {\n      dPdX = spx.dfreqawav;\n    } else if (*xtype == 'V') {\n      dPdX = spx.dfreqvelo;\n    }\n\n    if (strcmp(stype, \"FREQ\") == 0) {\n      *crvalS = spx.freq;\n      dSdP = 1.0;\n    } else if (strcmp(stype, \"AFRQ\") == 0) {\n      *crvalS = spx.afrq;\n      dSdP = spx.dafrqfreq;\n    } else if (strcmp(stype, \"ENER\") == 0) {\n      *crvalS = spx.ener;\n      dSdP = spx.denerfreq;\n    } else if (strcmp(stype, \"WAVN\") == 0) {\n      *crvalS = spx.wavn;\n      dSdP = spx.dwavnfreq;\n    } else if (strcmp(stype, \"VRAD\") == 0) {\n      *crvalS = spx.vrad;\n      dSdP = spx.dvradfreq;\n    }\n\n  } else if (*ptype == 'W') {\n    if (*xtype == 'F') {\n      dPdX = spx.dwavefreq;\n    } else if (*xtype == 'W' || *xtype == 'w') {\n      dPdX = 1.0;\n    } else if (*xtype == 'A' || *xtype == 'a') {\n      dPdX = spx.dwaveawav;\n    } else if (*xtype == 'V') {\n      dPdX = spx.dwavevelo;\n    }\n\n    if (strcmp(stype, \"WAVE\") == 0) {\n      *crvalS = spx.wave;\n      dSdP = 1.0;\n    } else if (strcmp(stype, \"VOPT\") == 0) {\n      *crvalS = spx.vopt;\n      dSdP = spx.dvoptwave;\n    } else if (strcmp(stype, \"ZOPT\") == 0) {\n      *crvalS = spx.zopt;\n      dSdP = spx.dzoptwave;\n    }\n\n  } else if (*ptype == 'A') {\n    if (*xtype == 'F') {\n      dPdX = spx.dawavfreq;\n    } else if (*xtype == 'W' || *xtype == 'w') {\n      dPdX = spx.dawavwave;\n    } else if (*xtype == 'A' || *xtype == 'a') {\n      dPdX = 1.0;\n    } else if (*xtype == 'V') {\n      dPdX = spx.dawavvelo;\n    }\n\n    if (strcmp(stype, \"AWAV\") == 0) {\n      *crvalS = spx.awav;\n      dSdP = 1.0;\n    }\n\n  } else if (*ptype == 'V') {\n    if (*xtype == 'F') {\n      dPdX = spx.dvelofreq;\n    } else if (*xtype == 'W' || *xtype == 'w') {\n      dPdX = spx.dvelowave;\n    } else if (*xtype == 'A' || *xtype == 'a') {\n      dPdX = spx.dveloawav;\n    } else if (*xtype == 'V') {\n      dPdX = 1.0;\n    }\n\n    if (strcmp(stype, \"VELO\") == 0) {\n      *crvalS = spx.velo;\n      dSdP = 1.0;\n    } else if (strcmp(stype, \"BETA\") == 0) {\n      *crvalS = spx.beta;\n      dSdP = spx.dbetavelo;\n    }\n  }\n\n  *dSdX = dSdP * dPdX;\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint spctrn(\n  const char ctypeS1[9],\n  double crvalS1,\n  double cdeltS1,\n  double restfrq,\n  double restwav,\n  char   ctypeS2[9],\n  double *crvalS2,\n  double *cdeltS2)\n\n{\n  return spctrne(ctypeS1, crvalS1, cdeltS1, restfrq, restwav,\n                 ctypeS2, crvalS2, cdeltS2, NULL);\n}\n\n// : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :\n\nint spctrne(\n  const char ctypeS1[9],\n  double crvalS1,\n  double cdeltS1,\n  double restfrq,\n  double restwav,\n  char   ctypeS2[9],\n  double *crvalS2,\n  double *cdeltS2,\n  struct wcserr **err)\n\n{\n  static const char *function = \"spctrne\";\n\n  char *cp, ptype1, ptype2, stype1[5], stype2[5], xtype1, xtype2;\n  int  restreq, status;\n  double crvalX, dS2dX, dXdS1;\n\n  if (restfrq == 0.0 && restwav == 0.0) {\n    // If translating between two velocity-characteristic types, or between\n    // two wave-characteristic types, then we may need to set a dummy rest\n    // frequency or wavelength to perform the calculations.\n    strncpy(stype1, ctypeS1, 4);\n    strncpy(stype2, ctypeS2, 4);\n    stype1[4] = stype2[4] = '\\0';\n    if ((strstr(\"VRAD VOPT ZOPT VELO BETA\", stype1) != 0x0) ==\n        (strstr(\"VRAD VOPT ZOPT VELO BETA\", stype2) != 0x0)) {\n      restwav = 1.0;\n    }\n  }\n\n  if ((status = spcspxe(ctypeS1, crvalS1, restfrq, restwav, &ptype1, &xtype1,\n                        &restreq, &crvalX, &dXdS1, err))) {\n    return status;\n  }\n\n  // Pad with blanks.\n  ctypeS2[8] = '\\0';\n  for (cp = ctypeS2; *cp; cp++);\n  while (cp < ctypeS2+8) *(cp++) = ' ';\n\n  if (strncmp(ctypeS2+5, \"???\", 3) == 0) {\n    // Set the algorithm code if required.\n    if (xtype1 == 'w') {\n      strcpy(ctypeS2+5, \"GRI\");\n    } else if (xtype1 == 'a') {\n      strcpy(ctypeS2+5, \"GRA\");\n    } else {\n      ctypeS2[5] = xtype1;\n      ctypeS2[6] = '2';\n    }\n  }\n\n  if ((status = spcxpse(ctypeS2, crvalX, restfrq, restwav, &ptype2, &xtype2,\n                        &restreq, crvalS2, &dS2dX, err))) {\n    return status;\n  }\n\n  // Are the X-types compatible?\n  if (xtype2 != xtype1) {\n    return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS),\n      \"Incompatible X-types '%c' and '%c'\", xtype1, xtype2);\n  }\n\n  if (ctypeS2[7] == '?') {\n    if (ptype2 == xtype2) {\n      strcpy(ctypeS2+4, \"    \");\n    } else {\n      ctypeS2[7] = ptype2;\n    }\n  }\n\n  *cdeltS2 = dS2dX * dXdS1 * cdeltS1;\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint spcaips(\n  const char ctypeA[9],\n  int  velref,\n  char ctype[9],\n  char specsys[9])\n\n{\n  const char *frames[] = {\"LSRK\", \"BARYCENT\", \"TOPOCENT\",\n                          \"LSRD\", \"GEOCENTR\", \"SOURCE\", \"GALACTOC\"};\n  char *fcode;\n  int  ivf, status;\n\n  // Make a null-filled copy of ctypeA.\n  if (ctype != ctypeA) strncpy(ctype, ctypeA, 8);\n  ctype[8] = '\\0';\n  wcsutil_null_fill(9, ctype);\n  *specsys = '\\0';\n\n  // Is it a recognized AIPS-convention type?\n  status = SPCERR_NO_CHANGE;\n  if (strncmp(ctype, \"FREQ\", 4) == 0 ||\n      strncmp(ctype, \"VELO\", 4) == 0 ||\n      strncmp(ctype, \"FELO\", 4) == 0) {\n    // Look for the Doppler frame.\n    if (*(fcode = ctype+4)) {\n      if (strcmp(fcode, \"-LSR\") == 0) {\n        strcpy(specsys, \"LSRK\");\n      } else if (strcmp(fcode, \"-HEL\") == 0) {\n        strcpy(specsys, \"BARYCENT\");\n      } else if (strcmp(fcode, \"-OBS\") == 0) {\n        strcpy(specsys, \"TOPOCENT\");\n      } else {\n        // Not a recognized AIPS spectral type.\n        return SPCERR_NO_CHANGE;\n      }\n\n      *fcode = '\\0';\n      status = 0;\n    }\n\n    // VELREF takes precedence if present.\n    ivf = velref%256;\n    if (0 < ivf && ivf <= 7) {\n      strcpy(specsys, frames[ivf-1]);\n      status = 0;\n    } else if (ivf) {\n      status = SPCERR_BAD_SPEC_PARAMS;\n    }\n\n    if (strcmp(ctype, \"VELO\") == 0) {\n      // Check that we found an AIPS-convention Doppler frame.\n      if (*specsys) {\n        // 'VELO' in AIPS means radio or optical depending on VELREF.\n        ivf = velref/256;\n        if (ivf == 0) {\n          strcpy(ctype, \"VOPT\");\n        } else if (ivf == 1) {\n          strcpy(ctype, \"VRAD\");\n        } else {\n          status = SPCERR_BAD_SPEC_PARAMS;\n        }\n      }\n    } else if (strcmp(ctype, \"FELO\") == 0) {\n      // Uniform in frequency but expressed as an optical velocity (strictly\n      // we should also have found an AIPS-convention Doppler frame).\n      strcpy(ctype, \"VOPT-F2W\");\n      if (status < 0) status = 0;\n    }\n  }\n\n  return status;\n}\n"},{"id":16574,"name":"wcsutrn.l","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsutrn.l,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* wcsutrn.l is a Flex description file containing the definition of a lexical\n* scanner that translates non-standard FITS units specifications.\n*\n* It requires Flex v2.5.4 or later.\n*\n* Refer to wcsunits.h for a description of the user interface and operating\n* notes.\n*\n*===========================================================================*/\n\n/* Options. */\n%option full\n%option never-interactive\n%option noinput\n%option noyywrap\n%option outfile=\"wcsutrn.c\"\n%option prefix=\"wcsutrn\"\n%option reentrant\n%option extra-type=\"struct wcsutrn_extra *\"\n\n/* Exclusive start states. */\n%x NEXT FLUSH\n\n%{\n#include <setjmp.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"wcserr.h\"\n#include \"wcsunits.h\"\n\n// User data associated with yyscanner.\nstruct wcsutrn_extra {\n  // Used in preempting the call to exit() by yy_fatal_error().\n  jmp_buf abort_jmp_env;\n};\n\n#define YY_DECL int wcsutrne_scanner(int ctrl, char unitstr[], \\\n struct wcserr **err, yyscan_t yyscanner)\n\n// Dummy definition to circumvent compiler warnings.\n#define YY_INPUT(inbuff, count, bufsize) { count = YY_NULL; }\n\n// Preempt the call to exit() by yy_fatal_error().\n#define exit(status) longjmp(yyextra->abort_jmp_env, status);\n\n// Internal helper functions.\nstatic YY_DECL;\n\n%}\n\n%%\n\tstatic const char *function = \"wcsutrne_scanner\";\n\t\n\tif (err) *err = 0x0;\n\t\n\tchar orig[80], subs[80];\n\t*orig = '\\0';\n\t*subs = '\\0';\n\t\n\tint bracket = 0;\n\tint unsafe  = 0;\n\tint status  = -1;\n\t\n\tyy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);\n\tyy_scan_string(unitstr, yyscanner);\n\t*unitstr = '\\0';\n\t\n\t// Return here via longjmp() invoked by yy_fatal_error().\n\tif (setjmp(yyextra->abort_jmp_env)) {\n\t  return wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR),\n\t    \"Internal units translator error\");\n\t}\n\t\n\tBEGIN(INITIAL);\n\t\n\t#ifdef DEBUG\n\tfprintf(stderr, \"\\n%s ->\\n\", unitstr);\n\t#endif\n\n^\" \"*\"[\" {\n\t  // Looks like a keycomment.\n\t  strcat(unitstr, \"[\");\n\t  bracket = 1;\n\t}\n\n\" \"+\t  // Discard leading whitespace.\n\n[^A-Za-z] {\n\t  // Non-alphabetic character.\n\t  strcat(unitstr, yytext);\n\t  if (bracket && *yytext == ']') {\n\t    BEGIN(FLUSH);\n\t  }\n\t}\n\nAngstroms|angstroms? {\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"Angstrom\");\n\t  BEGIN(NEXT);\n\t}\n\narcmins|ARCMINS? {\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"arcmin\");\n\t  BEGIN(NEXT);\n\t}\n\narcsecs|ARCSECS? {\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"arcsec\");\n\t  BEGIN(NEXT);\n\t}\n\nBEAM\t{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"beam\");\n\t  BEGIN(NEXT);\n\t}\n\nByte\t{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"byte\");\n\t  BEGIN(NEXT);\n\t}\n\ndays?|DAYS? {\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"d\");\n\t  BEGIN(NEXT);\n\t}\n\nD\t{\n\t  unsafe = 1;\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, (ctrl & 4) ? \"d\" : \"D\");\n\t  BEGIN(NEXT);\n\t}\n\ndegrees?|Deg|Degrees?|DEG|DEGREES? {\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"deg\");\n\t  BEGIN(NEXT);\n\t}\n\nGHZ\t{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"GHz\");\n\t  BEGIN(NEXT);\n\t}\n\nhr|HR\t{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"h\");\n\t  BEGIN(NEXT);\n\t}\n\nH\t{\n\t  unsafe = 1;\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, (ctrl & 2) ? \"h\" : \"H\");\n\t  BEGIN(NEXT);\n\t}\n\nhz|HZ\t{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"Hz\");\n\t  BEGIN(NEXT);\n\t}\n\nKHZ\t{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"kHz\");\n\t  BEGIN(NEXT);\n\t}\n\nJY\t{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"Jy\");\n\t  BEGIN(NEXT);\n\t}\n\n[kK]elvins?|KELVINS? {\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"K\");\n\t  BEGIN(NEXT);\n\t}\n\nKM\t{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"km\");\n\t  BEGIN(NEXT);\n\t}\n\nmetres?|meters?|M|METRES?|METERS? {\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"m\");\n\t  BEGIN(NEXT);\n\t}\n\nMIN\t{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"min\");\n\t  BEGIN(NEXT);\n\t}\n\nMHZ\t{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"MHz\");\n\t  BEGIN(NEXT);\n\t}\n\nOhm\t{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"ohm\");\n\t  BEGIN(NEXT);\n\t}\n\n[pP]ascals?|PASCALS? {\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"Pa\");\n\t  BEGIN(NEXT);\n\t}\n\npixels|PIXELS? {\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"pixel\");\n\t  BEGIN(NEXT);\n\t}\n\nradians?|RAD|RADIANS? {\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"rad\");\n\t  BEGIN(NEXT);\n\t}\n\nsec|seconds?|SEC|SECONDS? {\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"s\");\n\t  BEGIN(NEXT);\n\t}\n\nS\t{\n\t  unsafe = 1;\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, (ctrl & 1) ? \"s\" : \"S\");\n\t  BEGIN(NEXT);\n\t}\n\n[vV]olts?|VOLTS? {\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"V\");\n\t  BEGIN(NEXT);\n\t}\n\nyears?|YR|YEARS? {\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"yr\");\n\t  BEGIN(NEXT);\n\t}\n\n[A-Za-z]+ {\n\t  // Not a recognized alias.\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, orig);\n\t  BEGIN(NEXT);\n\t}\n\n<NEXT>[A-Za-z]+ {\n\t  // Reject the alias match.\n\t  strcat(orig, yytext);\n\t  strcpy(subs, orig);\n\t}\n\n<NEXT>\" \"+[^A-Za-z] {\n\t  // Discard separating whitespace.\n\t  unput(yytext[yyleng-1]);\n\t}\n\n<NEXT>\" \"+[A-Za-z] {\n\t  // Compress separating whitespace.\n\t  strcat(unitstr, subs);\n\t  strcat(unitstr, \" \");\n\t  if (strcmp(orig, subs)) status = 0;\n\t  unput(yytext[yyleng-1]);\n\t  *subs = '\\0';\n\t  BEGIN(INITIAL);\n\t}\n\n<NEXT>.\t{\n\t  // Copy anything else unchanged.\n\t  strcat(unitstr, subs);\n\t  if (strcmp(orig, subs)) status = 0;\n\t  unput(*yytext);\n\t  *subs = '\\0';\n\t  BEGIN(INITIAL);\n\t}\n\n<FLUSH>.* {\n\t  // Copy out remaining input.\n\t  strcat(unitstr, yytext);\n\t}\n\n<<EOF>>\t{\n\t  // End-of-string.\n\t  if (*subs) {\n\t    strcat(unitstr, subs);\n\t    if (strcmp(orig, subs)) status = 0;\n\t  }\n\t\n\t  if (unsafe) {\n\t    return wcserr_set(WCSERR_SET(UNITSERR_UNSAFE_TRANS),\n\t      \"Unsafe unit translation in '%s'\", unitstr);\n\t  }\n\t  return status;\n\t}\n\n%%\n\n/*----------------------------------------------------------------------------\n* External interface to the scanner.\n*---------------------------------------------------------------------------*/\n\nint wcsutrne(\n  int ctrl,\n  char unitstr[],\n  struct wcserr **err)\n\n{\n  // Function prototypes.\n  int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner);\n  int yylex_destroy(yyscan_t yyscanner);\n\n  struct wcsutrn_extra extra;\n  yyscan_t yyscanner;\n  yylex_init_extra(&extra, &yyscanner);\n  int status = wcsutrne_scanner(ctrl, unitstr, err, yyscanner);\n  yylex_destroy(yyscanner);\n\n  return status;\n}\n"},{"id":16575,"name":"dis.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: dis.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the dis routines\n* ---------------------------\n* Routines in this suite implement extensions to the FITS World Coordinate\n* System (WCS) standard proposed by\n*\n=   \"Representations of distortions in FITS world coordinate systems\",\n=   Calabretta, M.R. et al. (WCS Paper IV, draft dated 2004/04/22),\n=   available from http://www.atnf.csiro.au/people/Mark.Calabretta\n*\n* In brief, a distortion function may occupy one of two positions in the WCS\n* algorithm chain.  Prior distortions precede the linear transformation\n* matrix, whether it be PCi_ja or CDi_ja, and sequent distortions follow it.\n* WCS Paper IV defines FITS keywords used to specify parameters for predefined\n* distortion functions.  The following are used for prior distortions:\n*\n=   CPDISja   ...(string-valued, identifies the distortion function)\n=   DPja      ...(record-valued, parameters)\n=   CPERRja   ...(floating-valued, maximum value)\n*\n* Their counterparts for sequent distortions are CQDISia, DQia, and CQERRia.\n* An additional floating-valued keyword, DVERRa, records the maximum value of\n* the combined distortions.\n*\n* DPja and DQia are \"record-valued\".  Syntactically, the keyvalues are\n* standard FITS strings, but they are to be interpreted in a special way.\n* The general form is\n*\n=   DPja = '<field-specifier>: <float>'\n*\n* where the field-specifier consists of a sequence of fields separated by\n* periods, and the ': ' between the field-specifier and the floating-point\n* value is part of the record syntax.  For example:\n*\n=   DP1 = 'AXIS.1: 1'\n*\n* Certain field-specifiers are defined for all distortion functions, while\n* others are defined only for particular distortions.  Refer to WCS Paper IV\n* for further details.  wcspih() parses all distortion keywords and loads them\n* into a disprm struct for analysis by disset() which knows (or possibly does\n* not know) how to interpret them.  Of the Paper IV distortion functions, only\n* the general Polynomial distortion is currently implemented here.\n*\n* TPV - the TPV \"projection\":\n* ---------------------------\n* The distortion function component of the TPV celestial \"projection\" is also\n* supported.  The TPV projection, originally proposed in a draft of WCS Paper\n* II, consists of a TAN projection with sequent polynomial distortion, the\n* coefficients of which are encoded in PVi_ma keyrecords.  Full details may be\n* found at the registry of FITS conventions:\n*\n=   http://fits.gsfc.nasa.gov/registry/tpvwcs/tpv.html\n*\n* Internally, wcsset() changes TPV to a TAN projection, translates the PVi_ma\n* keywords to DQia and loads them into a disprm struct.  These DQia keyrecords\n* have the form\n*\n=   DQia = 'TPV.m: <value>'\n*\n* where i, a, m, and the value for each DQia match each PVi_ma.  Consequently,\n* WCSLIB would handle a FITS header containing these keywords, along with\n* CQDISia = 'TPV' and the required DQia.NAXES and DQia.AXIS.ihat keywords.\n*\n* Note that, as defined, TPV assumes that CDi_ja is used to define the linear\n* transformation.  The section on historical idiosyncrasies (below) cautions\n* about translating CDi_ja to PCi_ja plus CDELTia in this case.\n*\n* SIP - Simple Imaging Polynomial:\n* --------------------------------\n* These routines also support the Simple Imaging Polynomial (SIP), whose\n* design was influenced by early drafts of WCS Paper IV.  It is described in\n* detail in\n*\n=   http://fits.gsfc.nasa.gov/registry/sip.html\n*\n* SIP, which is defined only as a prior distortion for 2-D celestial images,\n* has the interesting feature that it records an approximation to the inverse\n* polynomial distortion function.  This is used by disx2p() to provide an\n* initial estimate for its more precise iterative inversion.  The\n* special-purpose keywords used by SIP are parsed and translated by wcspih()\n* as follows:\n*\n=    A_p_q = <value>   ->   DP1 = 'SIP.FWD.p_q: <value>'\n=   AP_p_q = <value>   ->   DP1 = 'SIP.REV.p_q: <value>'\n=    B_p_q = <value>   ->   DP2 = 'SIP.FWD.p_q: <value>'\n=   BP_p_q = <value>   ->   DP2 = 'SIP.REV.p_q: <value>'\n=   A_DMAX = <value>   ->   DPERR1 = <value>\n=   B_DMAX = <value>   ->   DPERR2 = <value>\n*\n* SIP's A_ORDER and B_ORDER keywords are not used.  WCSLIB would recognise a\n* FITS header containing the above keywords, along with CPDISja = 'SIP' and\n* the required DPja.NAXES keywords.\n*\n* DSS - Digitized Sky Survey:\n* ---------------------------\n* The Digitized Sky Survey resulted from the production of the Guide Star\n* Catalogue for the Hubble Space Telescope.  Plate solutions based on a\n* polynomial distortion function were encoded in FITS using non-standard\n* keywords.  Sect. 5.2 of WCS Paper IV describes how DSS coordinates may be\n* translated to a sequent Polynomial distortion using two auxiliary variables.\n* That translation is based on optimising the non-distortion component of the\n* plate solution.\n*\n* Following Paper IV, wcspih() translates the non-distortion component of DSS\n* coordinates to standard WCS keywords (CRPIXja, PCi_ja, CRVALia, etc), and\n* fills a wcsprm struct with their values.  It encodes the DSS polynomial\n* coefficients as\n*\n=    AMDXm = <value>   ->   DQ1 = 'AMD.m: <value>'\n=    AMDYm = <value>   ->   DQ2 = 'AMD.m: <value>'\n*\n* WCSLIB would recognise a FITS header containing the above keywords, along\n* with CQDISia = 'DSS' and the required DQia.NAXES keywords.\n*\n* WAT - the TNX and ZPX \"projections\":\n* ------------------------------------\n* The TNX and ZPX \"projections\" add a polynomial distortion function to the\n* standard TAN and ZPN projections respectively.  Unusually, the polynomial\n* may be expressed as the sum of Chebyshev or Legendre polynomials, or as a\n* simple sum of monomials, as described in\n*\n=   http://fits.gsfc.nasa.gov/registry/tnx/tnx-doc.html\n=   http://fits.gsfc.nasa.gov/registry/zpxwcs/zpx.html\n*\n* The polynomial coefficients are encoded in special-purpose WATi_n keywords\n* as a set of continued strings, thus providing the name for this distortion\n* type.  WATi_n are parsed and translated by wcspih() into the following set:\n*\n=    DQi = 'WAT.POLY: <value>'\n=    DQi = 'WAT.XMIN: <value>'\n=    DQi = 'WAT.XMAX: <value>'\n=    DQi = 'WAT.YMIN: <value>'\n=    DQi = 'WAT.YMAX: <value>'\n=    DQi = 'WAT.CHBY.m_n: <value>'  or\n=    DQi = 'WAT.LEGR.m_n: <value>'  or\n=    DQi = 'WAT.MONO.m_n: <value>'\n*\n* along with CQDISia = 'WAT' and the required DPja.NAXES keywords.  For ZPX,\n* the ZPN projection parameters are also encoded in WATi_n, and wcspih()\n* translates these to standard PVi_ma.\n*\n* Note that, as defined, TNX and ZPX assume that CDi_ja is used to define the\n* linear transformation.  The section on historical idiosyncrasies (below)\n* cautions about translating CDi_ja to PCi_ja plus CDELTia in this case.\n*\n* TPD - Template Polynomial Distortion:\n* -------------------------------------\n* The \"Template Polynomial Distortion\" (TPD) is a superset of the TPV, SIP,\n* DSS, and WAT (TNX & ZPX) polynomial distortions that also supports 1-D usage\n* and inversions.  Like TPV, SIP, and DSS, the form of the polynomial is fixed\n* (the \"template\") and only the coefficients for the required terms are set\n* non-zero.  TPD generalizes TPV in going to 9th degree, SIP by accomodating\n* TPV's linear and radial terms, and DSS in both respects.  While in theory\n* the degree of the WAT polynomial distortion in unconstrained, in practice it\n* is limited to values that can be handled by TPD.\n*\n* Within WCSLIB, TPV, SIP, DSS, and WAT are all implemented as special cases\n* of TPD.  Indeed, TPD was developed precisely for that purpose.  WAT\n* distortions expressed as the sum of Chebyshev or Legendre polynomials are\n* expanded for TPD as a simple sum of monomials.  Moreover, the general\n* Polynomial distortion is translated and implemented internally as TPD\n* whenever possible.\n*\n* However, WCSLIB also recognizes 'TPD' as a distortion function in its own\n* right (i.e. a recognized value of CPDISja or CQDISia), for use as both prior\n* and sequent distortions.  Its DPja and DQia keyrecords have the form\n*\n=   DPja = 'TPD.FWD.m: <value>'\n=   DPja = 'TPD.REV.m: <value>'\n*\n* for the forward and reverse distortion functions.  Moreover, like the\n* general Polynomial distortion, TPD supports auxiliary variables, though only\n* as a linear transformation of pixel coordinates (p1,p2):\n*\n=   x = a0 + a1*p1 + a2*p2\n=   y = b0 + b1*p1 + b2*p2\n*\n* where the coefficients of the auxiliary variables (x,y) are recorded as\n*\n=   DPja = 'AUX.1.COEFF.0: a0'      ...default 0.0\n=   DPja = 'AUX.1.COEFF.1: a1'      ...default 1.0\n=   DPja = 'AUX.1.COEFF.2: a2'      ...default 0.0\n=   DPja = 'AUX.2.COEFF.0: b0'      ...default 0.0\n=   DPja = 'AUX.2.COEFF.1: b1'      ...default 0.0\n=   DPja = 'AUX.2.COEFF.2: b2'      ...default 1.0\n*\n* Though nowhere near as powerful, in typical applications TPD is considerably\n* faster than the general Polynomial distortion.  As TPD has a finite and not\n* too large number of possible terms (60), the coefficients for each can be\n* stored (by disset()) in a fixed location in the disprm::dparm[] array.  A\n* large part of the speedup then arises from evaluating the polynomial using\n* Horner's scheme.\n*\n* Separate implementations for polynomials of each degree, and conditionals\n* for 1-D polynomials and 2-D polynomials with and without the radial\n* variable, ensure that unused terms mostly do not impose a significant\n* computational overhead.\n*\n* The TPD terms are as follows\n*\n=   0: 1     4: xx      12: xxxx      24: xxxxxx      40: xxxxxxxx\n=            5: xy      13: xxxy      25: xxxxxy      41: xxxxxxxy\n=   1: x     6: yy      14: xxyy      26: xxxxyy      42: xxxxxxyy\n=   2: y                15: xyyy      27: xxxyyy      43: xxxxxyyy\n=   3: r     7: xxx     16: yyyy      28: xxyyyy      44: xxxxyyyy\n=            8: xxy                   29: xyyyyy      45: xxxyyyyy\n=            9: xyy     17: xxxxx     30: yyyyyy      46: xxyyyyyy\n=           10: yyy     18: xxxxy                     47: xyyyyyyy\n=           11: rrr     19: xxxyy     31: xxxxxxx     48: yyyyyyyy\n=                       20: xxyyy     32: xxxxxxy\n=                       21: xyyyy     33: xxxxxyy     49: xxxxxxxxx\n=                       22: yyyyy     34: xxxxyyy     50: xxxxxxxxy\n=                       23: rrrrr     35: xxxyyyy     51: xxxxxxxyy\n=                                     36: xxyyyyy     52: xxxxxxyyy\n=                                     37: xyyyyyy     53: xxxxxyyyy\n=                                     38: yyyyyyy     54: xxxxyyyyy\n=                                     39: rrrrrrr     55: xxxyyyyyy\n=                                                     56: xxyyyyyyy\n=                                                     57: xyyyyyyyy\n=                                                     58: yyyyyyyyy\n=                                                     59: rrrrrrrrr\n*\n* where r = sqrt(xx + yy).  Note that even powers of r are excluded since they\n* can be accomodated by powers of (xx + yy).\n*\n* Note here that \"x\" refers to the axis to which the distortion function is\n* attached, with \"y\" being the complementary axis.  So, for example, with\n* longitude on axis 1 and latitude on axis 2, for TPD attached to axis 1, \"x\"\n* refers to axis 1 and \"y\" to axis 2.  For TPD attached to axis 2, \"x\" refers\n* to axis 2, and \"y\" to axis 1.\n*\n* TPV uses all terms up to 39.  The m in its PVi_ma keywords translates\n* directly to the TPD coefficient number.\n*\n* SIP uses all terms except for 0, 3, 11, 23, 39, and 59, with terms 1 and 2\n* only used for the inverse.  Its A_p_q, etc. keywords must be translated\n* using a map.\n*\n* DSS uses terms 0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 17, 19, and 21.  The presence\n* of a non-zero constant term arises through the use of auxiliary variables\n* with origin offset from the reference point of the TAN projection.  However,\n* in the translation given by WCS Paper IV, the distortion polynomial is zero,\n* or very close to zero, at the reference pixel itself.  The mapping between\n* DSS's AMDXm (or AMDYm) keyvalues and TPD coefficients, while still simple,\n* is not quite as straightforward as for TPV and SIP.\n*\n* WAT uses all but the radial terms, namely 3, 11, 23, 39, and 59.  While the\n* mapping between WAT's monomial coefficients and TPD is fairly simple, for\n* its expression in terms of a sum of Chebyshev or Legendre polynomials it is\n* much less so.\n*\n* Historical idiosyncrasies:\n* --------------------------\n* In addition to the above, some historical distortion functions have further\n* idiosyncrasies that must be taken into account when translating them to TPD.\n*\n* WCS Paper IV specifies that a distortion function returns a correction to be\n* added to pixel coordinates (prior distortion) or intermediate pixel\n* coordinates (sequent distortion).  The correction is meant to be small so\n* that ignoring the distortion function, i.e. setting the correction to zero,\n* produces a commensurately small error.\n*\n* However, rather than an additive correction, some historical distortion\n* functions (TPV, DSS) define a polynomial that returns the corrected\n* coordinates directly.\n*\n* The difference between the two approaches is readily accounted for simply by\n* adding or subtracting 1 from the coefficient of the first degree term of the\n* polynomial.  However, it opens the way for considerable confusion.\n*\n* Additional to the formalism of WCS Paper IV, both the Polynomial and TPD\n* distortion functions recognise a keyword\n*\n=   DPja = 'DOCORR: 0'\n*\n* which is meant to apply generally to indicate that the distortion function\n* returns the corrected coordinates directly.  Any other value for DOCORR (or\n* its absence) indicates that the distortion function returns an additive\n* correction.\n*\n* WCS Paper IV also specifies that the independent variables of a distortion\n* function are pixel coordinates (prior distortion) or intermediate pixel\n* coordinates (sequent distortion).\n*\n* On the contrary, the independent variables of the SIP polynomial are pixel\n* coordinate offsets from the reference pixel.  This is readily handled via\n* the renormalisation parameters\n*\n=   DPja = 'OFFSET.jhat: <value>'\n*\n* where the value corresponds to CRPIXja.\n*\n* Likewise, because TPV, TNX, and ZPX are defined in terms of CDi_ja, the\n* independent variables of the polynomial are intermediate world coordinates\n* rather than intermediate pixel coordinates.  Because sequent distortions\n* are always applied before CDELTia, if CDi_ja is translated to PCi_ja plus\n* CDELTia, then either CDELTia must be unity, or the distortion polynomial\n* coefficients must be adjusted to account for the change of scale.\n*\n* Summary of the dis routines:\n* ----------------------------\n* These routines apply the distortion functions defined by the extension to\n* the FITS WCS standard proposed in Paper IV.  They are based on the disprm\n* struct which contains all information needed for the computations.  The\n* struct contains some members that must be set by the user, and others that\n* are maintained by these routines, somewhat like a C++ class but with no\n* encapsulation.\n*\n* dpfill(), dpkeyi(), and dpkeyd() are provided to manage the dpkey struct.\n*\n* disndp(), disini(), disinit(), discpy(), and disfree() are provided to\n* manage the disprm struct, dissize() computes its total size including\n* allocated memory, and disprt() prints its contents.\n*\n* disperr() prints the error message(s) (if any) stored in a disprm struct.\n*\n* wcshdo() normally writes SIP and TPV headers in their native form if at all\n* possible.  However, dishdo() may be used to set a flag that tells it to\n* write the header in the form of the TPD translation used internally.\n*\n* A setup routine, disset(), computes intermediate values in the disprm struct\n* from parameters in it that were supplied by the user.  The struct always\n* needs to be set up by disset(), though disset() need not be called\n* explicitly - refer to the explanation of disprm::flag.\n*\n* disp2x() and disx2p() implement the WCS distortion functions, disp2x() using\n* separate functions, such as dispoly() and tpd7(), to do the computation.\n*\n* An auxiliary routine, diswarp(), computes various measures of the distortion\n* over a specified range of coordinates.\n*\n* PLEASE NOTE: Distortions are not yet handled by wcsbth(), or wcscompare().\n*\n*\n* disndp() - Memory allocation for DPja and DQia\n* ----------------------------------------------\n* disndp() sets or gets the value of NDPMAX (default 256).  This global\n* variable controls the maximum number of dpkey structs, for holding DPja or\n* DQia keyvalues, that disini() should allocate space for.  It is also used by\n* disinit() as the default value of ndpmax.\n*\n* PLEASE NOTE: This function is not thread-safe.\n*\n* Given:\n*   n         int       Value of NDPMAX; ignored if < 0.  Use a value less\n*                       than zero to get the current value.\n*\n* Function return value:\n*             int       Current value of NDPMAX.\n*\n*\n* dpfill() - Fill the contents of a dpkey struct\n* ----------------------------------------------\n* dpfill() is a utility routine to aid in filling the contents of the dpkey\n* struct.  No checks are done on the validity of the inputs.\n*\n* WCS Paper IV specifies the syntax of a record-valued keyword as\n*\n=   keyword = '<field-specifier>: <float>'\n*\n* However, some DPja and DQia record values, such as those of DPja.NAXES and\n* DPja.AXIS.j, are intrinsically integer-valued.  While FITS header parsers\n* are not expected to know in advance which of DPja and DQia are integral and\n* which are floating point, if the record's value parses as an integer (i.e.\n* without decimal point or exponent), then preferably enter it into the dpkey\n* struct as an integer.  Either way, it doesn't matter as disset() accepts\n* either data type for all record values.\n*\n* Given and returned:\n*   dp        struct dpkey*\n*                       Store for DPja and DQia keyvalues.\n*\n* Given:\n*   keyword   const char *\n*   field     const char *\n*                       These arguments are concatenated with an intervening\n*                       \".\" to construct the full record field name, i.e.\n*                       including the keyword name, DPja or DQia (but\n*                       excluding the colon delimiter which is NOT part of the\n*                       name).  Either may be given as a NULL pointer.  Set\n*                       both NULL to omit setting this component of the\n*                       struct.\n*\n*   j         int       Axis number (1-relative), i.e. the j in DPja or\n*                       i in DQia.  Can be given as 0, in which case the axis\n*                       number will be obtained from the keyword component of\n*                       the field name which must either have been given or\n*                       preset.\n*\n*                       If j is non-zero, and keyword was given, then the\n*                       value of j will be used to fill in the axis number.\n*\n*   type      int       Data type of the record's value\n*                         0: Integer,\n*                         1: Floating point.\n*\n*   i         int       For type == 0, the integer value of the record.\n*\n*   f         double    For type == 1, the floating point value of the record.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*\n*\n* dpkeyi() - Get the data value in a dpkey struct as int\n* ------------------------------------------------------\n* dpkeyi() returns the data value in a dpkey struct as an integer value.\n*\n* Given and returned:\n*   dp        const struct dpkey *\n*                       Parsed contents of a DPja or DQia keyrecord.\n*\n* Function return value:\n*             int       The record's value as int.\n*\n*\n* dpkeyd() - Get the data value in a dpkey struct as double\n* ---------------------------------------------------------\n* dpkeyd() returns the data value in a dpkey struct as a floating point\n* value.\n*\n* Given and returned:\n*   dp        const struct dpkey *\n*                       Parsed contents of a DPja or DQia keyrecord.\n*\n* Function return value:\n*             double    The record's value as double.\n*\n*\n* disini() - Default constructor for the disprm struct\n* ----------------------------------------------------\n* disini() is a thin wrapper on disinit().  It invokes it with ndpmax set\n* to -1 which causes it to use the value of the global variable NDPMAX.  It\n* is thereby potentially thread-unsafe if NDPMAX is altered dynamically via\n* disndp().  Use disinit() for a thread-safe alternative in this case.\n*\n*\n* disinit() - Default constructor for the disprm struct\n* ----------------------------------------------------\n* disinit() allocates memory for arrays in a disprm struct and sets all\n* members of the struct to default values.\n*\n* PLEASE NOTE: every disprm struct must be initialized by disinit(), possibly\n* repeatedly.  On the first invokation, and only the first invokation,\n* disprm::flag must be set to -1 to initialize memory management, regardless\n* of whether disinit() will actually be used to allocate memory.\n*\n* Given:\n*   alloc     int       If true, allocate memory unconditionally for arrays in\n*                       the disprm struct.\n*\n*                       If false, it is assumed that pointers to these arrays\n*                       have been set by the user except if they are null\n*                       pointers in which case memory will be allocated for\n*                       them regardless.  (In other words, setting alloc true\n*                       saves having to initalize these pointers to zero.)\n*\n*   naxis     int       The number of world coordinate axes, used to determine\n*                       array sizes.\n*\n* Given and returned:\n*   dis       struct disprm*\n*                       Distortion function parameters.  Note that, in order\n*                       to initialize memory management disprm::flag must be\n*                       set to -1 when dis is initialized for the first time\n*                       (memory leaks may result if it had already been\n*                       initialized).\n*\n* Given:\n*   ndpmax    int       The number of DPja or DQia keywords to allocate space\n*                       for.  If set to -1, the value of the global variable\n*                       NDPMAX will be used.  This is potentially\n*                       thread-unsafe if disndp() is being used dynamically to\n*                       alter its value.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null disprm pointer passed.\n*                         2: Memory allocation failed.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       disprm::err if enabled, see wcserr_enable().\n*\n*\n* discpy() - Copy routine for the disprm struct\n* ---------------------------------------------\n* discpy() does a deep copy of one disprm struct to another, using disinit()\n* to allocate memory unconditionally for its arrays if required.  Only the\n* \"information to be provided\" part of the struct is copied; a call to\n* disset() is required to initialize the remainder.\n*\n* Given:\n*   alloc     int       If true, allocate memory unconditionally for arrays in\n*                       the destination.  Otherwise, it is assumed that\n*                       pointers to these arrays have been set by the user\n*                       except if they are null pointers in which case memory\n*                       will be allocated for them regardless.\n*\n*   dissrc    const struct disprm*\n*                       Struct to copy from.\n*\n* Given and returned:\n*   disdst    struct disprm*\n*                       Struct to copy to.  disprm::flag should be set to -1\n*                       if disdst was not previously initialized (memory leaks\n*                       may result if it was previously initialized).\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null disprm pointer passed.\n*                         2: Memory allocation failed.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       disprm::err if enabled, see wcserr_enable().\n*\n*\n* disfree() - Destructor for the disprm struct\n* --------------------------------------------\n* disfree() frees memory allocated for the disprm arrays by disinit().\n* disinit() keeps a record of the memory it allocates and disfree() will only\n* attempt to free this.\n*\n* PLEASE NOTE: disfree() must not be invoked on a disprm struct that was not\n* initialized by disinit().\n*\n* Given:\n*   dis       struct disprm*\n*                       Distortion function parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null disprm pointer passed.\n*\n*\n* dissize() - Compute the size of a disprm struct\n* -----------------------------------------------\n* dissize() computes the full size of a disprm struct, including allocated\n* memory.\n*\n* Given:\n*   dis       const struct disprm*\n*                       Distortion function parameters.\n*\n*                       If NULL, the base size of the struct and the allocated\n*                       size are both set to zero.\n*\n* Returned:\n*   sizes     int[2]    The first element is the base size of the struct as\n*                       returned by sizeof(struct disprm).  The second element\n*                       is the total allocated size, in bytes, assuming that\n*                       the allocation was done by disini().  This figure\n*                       includes memory allocated for members of constituent\n*                       structs, such as disprm::dp.\n*\n*                       It is not an error for the struct not to have been set\n*                       up via tabset(), which normally results in additional\n*                       memory allocation. \n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*\n*\n* disprt() - Print routine for the disprm struct\n* ----------------------------------------------\n* disprt() prints the contents of a disprm struct using wcsprintf().  Mainly\n* intended for diagnostic purposes.\n*\n* Given:\n*   dis       const struct disprm*\n*                       Distortion function parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null disprm pointer passed.\n*\n*\n* disperr() - Print error messages from a disprm struct\n* -----------------------------------------------------\n* disperr() prints the error message(s) (if any) stored in a disprm struct.\n* If there are no errors then nothing is printed.  It uses wcserr_prt(), q.v.\n*\n* Given:\n*   dis       const struct disprm*\n*                       Distortion function parameters.\n*\n*   prefix    const char *\n*                       If non-NULL, each output line will be prefixed with\n*                       this string.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null disprm pointer passed.\n*\n*\n* dishdo() - write FITS headers using TPD\n* ---------------------------------------\n* dishdo() sets a flag that tells wcshdo() to write FITS headers in the form\n* of the TPD translation used internally.  Normally SIP and TPV would be\n* written in their native form if at all possible.\n*\n* Given and returned:\n*   dis       struct disprm*\n*                       Distortion function parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null disprm pointer passed.\n*                         3: No TPD translation.\n*\n*\n* disset() - Setup routine for the disprm struct\n* ----------------------------------------------\n* disset(), sets up the disprm struct according to information supplied within\n* it - refer to the explanation of disprm::flag.\n*\n* Note that this routine need not be called directly; it will be invoked by\n* disp2x() and disx2p() if the disprm::flag is anything other than a\n* predefined magic value.\n*\n* Given and returned:\n*   dis       struct disprm*\n*                       Distortion function parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null disprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Invalid parameter.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       disprm::err if enabled, see wcserr_enable().\n*\n*\n* disp2x() - Apply distortion function\n* ------------------------------------\n* disp2x() applies the distortion functions.  By definition, the distortion\n* is in the pixel-to-world direction.\n*\n* Depending on the point in the algorithm chain at which it is invoked,\n* disp2x() may transform pixel coordinates to corrected pixel coordinates, or\n* intermediate pixel coordinates to corrected intermediate pixel coordinates,\n* or image coordinates to corrected image coordinates.\n*\n*\n* Given and returned:\n*   dis       struct disprm*\n*                       Distortion function parameters.\n*\n* Given:\n*   rawcrd    const double[naxis]\n*                       Array of coordinates.\n*\n* Returned:\n*   discrd    double[naxis]\n*                       Array of coordinates to which the distortion functions\n*                       have been applied.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null disprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Invalid parameter.\n*                         4: Distort error.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       disprm::err if enabled, see wcserr_enable().\n*\n*\n* disx2p() - Apply de-distortion function\n* ---------------------------------------\n* disx2p() applies the inverse of the distortion functions.  By definition,\n* the de-distortion is in the world-to-pixel direction.\n*\n* Depending on the point in the algorithm chain at which it is invoked,\n* disx2p() may transform corrected pixel coordinates to pixel coordinates, or\n* corrected intermediate pixel coordinates to intermediate pixel coordinates,\n* or corrected image coordinates to image coordinates.\n*\n* disx2p() iteratively solves for the inverse using disp2x().  It assumes\n* that the distortion is small and the functions are well-behaved, being\n* continuous and with continuous derivatives.  Also that, to first order\n* in the neighbourhood of the solution, discrd[j] ~= a + b*rawcrd[j], i.e.\n* independent of rawcrd[i], where i != j.  This is effectively equivalent to\n* assuming that the distortion functions are separable to first order.\n* Furthermore, a is assumed to be small, and b close to unity.\n*\n* If disprm::disx2p() is defined, then disx2p() uses it to provide an initial\n* estimate for its more precise iterative inversion.\n*\n* Given and returned:\n*   dis       struct disprm*\n*                       Distortion function parameters.\n*\n* Given:\n*   discrd    const double[naxis]\n*                       Array of coordinates.\n*\n* Returned:\n*   rawcrd    double[naxis]\n*                       Array of coordinates to which the inverse distortion\n*                       functions have been applied.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null disprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Invalid parameter.\n*                         5: De-distort error.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       disprm::err if enabled, see wcserr_enable().\n*\n*\n* diswarp() - Compute measures of distortion\n* ------------------------------------------\n* diswarp() computes various measures of the distortion over a specified range\n* of coordinates.\n*\n* For prior distortions, the measures may be interpreted simply as an offset\n* in pixel coordinates.  For sequent distortions, the interpretation depends\n* on the nature of the linear transformation matrix (PCi_ja or CDi_ja).  If\n* the latter introduces a scaling, then the measures will also be scaled.\n* Note also that the image domain, which is rectangular in pixel coordinates,\n* may be rotated, skewed, and/or stretched in intermediate pixel coordinates,\n* and in general cannot be defined using pixblc[] and pixtrc[].\n*\n* PLEASE NOTE: the measures of total distortion may be essentially meaningless\n* if there are multiple sequent distortions with different scaling.\n*\n* See also linwarp().\n*\n* Given and returned:\n*   dis       struct disprm*\n*                       Distortion function parameters.\n*\n* Given:\n*   pixblc    const double[naxis]\n*                       Start of the range of pixel coordinates (for prior\n*                       distortions), or intermediate pixel coordinates (for\n*                       sequent distortions).  May be specified as a NULL\n*                       pointer which is interpreted as (1,1,...).\n*\n*   pixtrc    const double[naxis]\n*                       End of the range of pixel coordinates (prior) or\n*                       intermediate pixel coordinates (sequent).\n*\n*   pixsamp   const double[naxis]\n*                       If positive or zero, the increment on the particular\n*                       axis, starting at pixblc[].  Zero is interpreted as a\n*                       unit increment.  pixsamp may also be specified as a\n*                       NULL pointer which is interpreted as all zeroes, i.e.\n*                       unit increments on all axes.\n*\n*                       If negative, the grid size on the particular axis (the\n*                       absolute value being rounded to the nearest integer).\n*                       For example, if pixsamp is (-128.0,-128.0,...) then\n*                       each axis will be sampled at 128 points between\n*                       pixblc[] and pixtrc[] inclusive.  Use caution when\n*                       using this option on non-square images.\n*\n* Returned:\n*   nsamp     int*      The number of pixel coordinates sampled.\n*\n*                       Can be specified as a NULL pointer if not required.\n*\n*   maxdis    double[naxis]\n*                       For each individual distortion function, the\n*                       maximum absolute value of the distortion.\n*\n*                       Can be specified as a NULL pointer if not required.\n*\n*   maxtot    double*   For the combination of all distortion functions, the\n*                       maximum absolute value of the distortion.\n*\n*                       Can be specified as a NULL pointer if not required.\n*\n*   avgdis    double[naxis]\n*                       For each individual distortion function, the\n*                       mean value of the distortion.\n*\n*                       Can be specified as a NULL pointer if not required.\n*\n*   avgtot    double*   For the combination of all distortion functions, the\n*                       mean value of the distortion.\n*\n*                       Can be specified as a NULL pointer if not required.\n*\n*   rmsdis    double[naxis]\n*                       For each individual distortion function, the\n*                       root mean square deviation of the distortion.\n*\n*                       Can be specified as a NULL pointer if not required.\n*\n*   rmstot    double*   For the combination of all distortion functions, the\n*                       root mean square deviation of the distortion.\n*\n*                       Can be specified as a NULL pointer if not required.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null disprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Invalid parameter.\n*                         4: Distort error.\n*\n*\n* disprm struct - Distortion parameters\n* -------------------------------------\n* The disprm struct contains all of the information required to apply a set of\n* distortion functions.  It consists of certain members that must be set by\n* the user (\"given\") and others that are set by the WCSLIB routines\n* (\"returned\").  While the addresses of the arrays themselves may be set by\n* disinit() if it (optionally) allocates memory, their contents must be set by\n* the user.\n*\n*   int flag\n*     (Given and returned) This flag must be set to zero whenever any of the\n*     following members of the disprm struct are set or modified:\n*\n*       - disprm::naxis,\n*       - disprm::dtype,\n*       - disprm::ndp,\n*       - disprm::dp.\n*\n*     This signals the initialization routine, disset(), to recompute the\n*     returned members of the disprm struct.  disset() will reset flag to\n*     indicate that this has been done.\n*\n*     PLEASE NOTE: flag must be set to -1 when disinit() is called for the\n*     first time for a particular disprm struct in order to initialize memory\n*     management.  It must ONLY be used on the first initialization otherwise\n*     memory leaks may result.\n*\n*   int naxis\n*     (Given or returned) Number of pixel and world coordinate elements.\n*\n*     If disinit() is used to initialize the disprm struct (as would normally\n*     be the case) then it will set naxis from the value passed to it as a\n*     function argument.  The user should not subsequently modify it.\n*\n*   char (*dtype)[72]\n*     (Given) Pointer to the first element of an array of char[72] containing\n*     the name of the distortion function for each axis.\n*\n*   int ndp\n*     (Given) The number of entries in the disprm::dp[] array.\n*\n*   int ndpmax\n*     (Given) The length of the disprm::dp[] array.\n*\n*     ndpmax will be set by disinit() if it allocates memory for disprm::dp[],\n*     otherwise it must be set by the user.  See also disndp().\n*\n*   struct dpkey dp\n*     (Given) Address of the first element of an array of length ndpmax of\n*     dpkey structs.\n*\n*     As a FITS header parser encounters each DPja or DQia keyword it should\n*     load it into a dpkey struct in the array and increment ndp.  However,\n*     note that a single disprm struct must hold only DPja or DQia keyvalues,\n*     not both.  disset() interprets them as required by the particular\n*     distortion function.\n*\n*   double *maxdis\n*     (Given) Pointer to the first element of an array of double specifying\n*     the maximum absolute value of the distortion for each axis computed over\n*     the whole image.\n*\n*     It is not necessary to reset the disprm struct (via disset()) when\n*     disprm::maxdis is changed.\n*\n*   double totdis\n*     (Given) The maximum absolute value of the combination of all distortion\n*     functions specified as an offset in pixel coordinates computed over the\n*     whole image.\n*\n*     It is not necessary to reset the disprm struct (via disset()) when\n*     disprm::totdis is changed.\n*\n*   int *docorr\n*     (Returned) Pointer to the first element of an array of int containing\n*     flags that indicate the mode of correction for each axis.\n*\n*     If docorr is zero, the distortion function returns the corrected\n*     coordinates directly.  Any other value indicates that the distortion\n*     function computes a correction to be added to pixel coordinates (prior\n*     distortion) or intermediate pixel coordinates (sequent distortion).\n*\n*   int *Nhat\n*     (Returned) Pointer to the first element of an array of int containing\n*     the number of coordinate axes that form the independent variables of the\n*     distortion function for each axis.\n*\n*   int **axmap\n*     (Returned) Pointer to the first element of an array of int* containing\n*     pointers to the first elements of the axis mapping arrays for each axis.\n*\n*     An axis mapping associates the independent variables of a distortion\n*     function with the 0-relative image axis number.  For example, consider\n*     an image with a spectrum on the first axis (axis 0), followed by RA\n*     (axis 1), Dec (axis2), and time (axis 3) axes.  For a distortion in\n*     (RA,Dec) and no distortion on the spectral or time axes, the axis\n*     mapping arrays, axmap[j][], would be\n*\n=       j=0: [-1, -1, -1, -1]   ...no  distortion on spectral axis,\n=         1: [ 1,  2, -1, -1]   ...RA  distortion depends on RA and Dec,\n=         2: [ 2,  1, -1, -1]   ...Dec distortion depends on Dec and RA,\n=         3: [-1, -1, -1, -1]   ...no  distortion on time axis,\n*\n*     where -1 indicates that there is no corresponding independent\n*     variable.\n*\n*   double **offset\n*     (Returned) Pointer to the first element of an array of double*\n*     containing pointers to the first elements of arrays of offsets used to\n*     renormalize the independent variables of the distortion function for\n*     each axis.\n*\n*     The offsets are subtracted from the independent variables before\n*     scaling.\n*\n*   double **scale\n*     (Returned) Pointer to the first element of an array of double*\n*     containing pointers to the first elements of arrays of scales used to\n*     renormalize the independent variables of the distortion function for\n*     each axis.\n*\n*     The scale is applied to the independent variables after the offsets are\n*     subtracted.\n*\n*   int **iparm\n*     (Returned) Pointer to the first element of an array of int*\n*     containing pointers to the first elements of the arrays of integer\n*     distortion parameters for each axis.\n*\n*   double **dparm\n*     (Returned) Pointer to the first element of an array of double*\n*     containing pointers to the first elements of the arrays of floating\n*     point distortion parameters for each axis.\n*\n*   int i_naxis\n*     (Returned) Dimension of the internal arrays (normally equal to naxis).\n*\n*   int ndis\n*     (Returned) The number of distortion functions.\n*\n*   struct wcserr *err\n*     (Returned) If enabled, when an error status is returned, this struct\n*     contains detailed information about the error, see wcserr_enable().\n*\n*   int (**disp2x)(DISP2X_ARGS)\n*     (For internal use only.)\n*   int (**disx2p)(DISX2P_ARGS)\n*     (For internal use only.)\n*   double *tmpmem\n*     (For internal use only.)\n*   int m_flag\n*     (For internal use only.)\n*   int m_naxis\n*     (For internal use only.)\n*   char (*m_dtype)[72]\n*     (For internal use only.)\n*   double **m_dp\n*     (For internal use only.)\n*   double *m_maxdis\n*     (For internal use only.)\n*\n*\n* dpkey struct - Store for DPja and DQia keyvalues\n* ------------------------------------------------\n* The dpkey struct is used to pass the parsed contents of DPja or DQia\n* keyrecords to disset() via the disprm struct.  A disprm struct must hold\n* only DPja or DQia keyvalues, not both.\n*\n* All members of this struct are to be set by the user.\n*\n*   char field[72]\n*     (Given) The full field name of the record, including the keyword name.\n*     Note that the colon delimiter separating the field name and the value in\n*     record-valued keyvalues is not part of the field name.  For example, in\n*     the following:\n*\n=       DP3A = 'AXIS.1: 2'\n*\n*     the full record field name is \"DP3A.AXIS.1\", and the record's value\n*     is 2.\n*\n*   int j\n*     (Given) Axis number (1-relative), i.e. the j in DPja or i in DQia.\n*\n*   int type\n*     (Given) The data type of the record's value\n*       - 0: Integer (stored as an int),\n*       - 1: Floating point (stored as a double).\n*\n*   union value\n*     (Given) A union comprised of\n*       - dpkey::i,\n*       - dpkey::f,\n*\n*     the record's value.\n*\n*\n* Global variable: const char *dis_errmsg[] - Status return messages\n* ------------------------------------------------------------------\n* Error messages to match the status value returned from each function.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_DIS\n#define WCSLIB_DIS\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\nextern const char *dis_errmsg[];\n\nenum dis_errmsg_enum {\n  DISERR_SUCCESS      = 0,\t// Success.\n  DISERR_NULL_POINTER = 1,\t// Null disprm pointer passed.\n  DISERR_MEMORY       = 2,\t// Memory allocation failed.\n  DISERR_BAD_PARAM    = 3,\t// Invalid parameter value.\n  DISERR_DISTORT      = 4,\t// Distortion error.\n  DISERR_DEDISTORT    = 5\t// De-distortion error.\n};\n\n// For use in declaring distortion function prototypes (= DISX2P_ARGS).\n#define DISP2X_ARGS int inverse, const int iparm[], const double dparm[], \\\nint ncrd, const double rawcrd[], double *discrd\n\n// For use in declaring de-distortion function prototypes (= DISP2X_ARGS).\n#define DISX2P_ARGS int inverse, const int iparm[], const double dparm[], \\\nint ncrd, const double discrd[], double *rawcrd\n\n\n// Struct used for storing DPja and DQia keyvalues.\nstruct dpkey {\n  char field[72];\t\t// Full record field name (no colon).\n  int j;\t\t\t// Axis number, as in DPja (1-relative).\n  int type;\t\t\t// Data type of value.\n  union {\n    int    i;\t\t\t// Integer record value.\n    double f;\t\t\t// Floating point record value.\n  } value;\t\t\t// Record value.\n};\n\n// Size of the dpkey struct in int units, used by the Fortran wrappers.\n#define DPLEN (sizeof(struct dpkey)/sizeof(int))\n\n\nstruct disprm {\n  // Initialization flag (see the prologue above).\n  //--------------------------------------------------------------------------\n  int flag;\t\t\t// Set to zero to force initialization.\n\n  // Parameters to be provided (see the prologue above).\n  //--------------------------------------------------------------------------\n  int naxis;\t\t\t// The number of pixel coordinate elements,\n\t\t\t\t// given by NAXIS.\n  char   (*dtype)[72];\t\t// For each axis, the distortion type.\n  int    ndp;\t\t\t// Number of DPja or DQia keywords, and the\n  int    ndpmax;\t\t// number for which space was allocated.\n  struct dpkey *dp;\t\t// DPja or DQia keyvalues (not both).\n  double *maxdis;\t\t// For each axis, the maximum distortion.\n  double totdis;\t\t// The maximum combined distortion.\n\n  // Information derived from the parameters supplied.\n  //--------------------------------------------------------------------------\n  int    *docorr;\t\t// For each axis, the mode of correction.\n  int    *Nhat;\t\t\t// For each axis, the number of coordinate\n\t\t\t\t// axes that form the independent variables\n\t\t\t\t// of the distortion function.\n  int    **axmap;\t\t// For each axis, the axis mapping array.\n  double **offset;\t\t// For each axis, renormalization offsets.\n  double **scale;\t\t// For each axis, renormalization scales.\n  int    **iparm;\t\t// For each axis, the array of integer\n\t\t\t\t// distortion parameters.\n  double **dparm;\t\t// For each axis, the array of floating\n\t\t\t\t// point distortion parameters.\n  int    i_naxis;\t\t// Dimension of the internal arrays.\n  int    ndis;\t\t\t// The number of distortion functions.\n\n  // Error handling, if enabled.\n  //--------------------------------------------------------------------------\n  struct wcserr *err;\n\n  // Private - the remainder are for internal use.\n  //--------------------------------------------------------------------------\n  int (**disp2x)(DISP2X_ARGS);\t// For each axis, pointers to the\n  int (**disx2p)(DISX2P_ARGS);\t// distortion function and its inverse.\n\n  double *tmpmem;\n\n  int    m_flag, m_naxis;\t// The remainder are for memory management.\n  char   (*m_dtype)[72];\n  struct dpkey *m_dp;\n  double *m_maxdis;\n};\n\n// Size of the disprm struct in int units, used by the Fortran wrappers.\n#define DISLEN (sizeof(struct disprm)/sizeof(int))\n\n\nint disndp(int n);\n\nint dpfill(struct dpkey *dp, const char *keyword, const char *field, int j,\n           int type, int i, double f);\n\nint    dpkeyi(const struct dpkey *dp);\n\ndouble dpkeyd(const struct dpkey *dp);\n\nint disini(int alloc, int naxis, struct disprm *dis);\n\nint disinit(int alloc, int naxis, struct disprm *dis, int ndpmax);\n\nint discpy(int alloc, const struct disprm *dissrc, struct disprm *disdst);\n\nint disfree(struct disprm *dis);\n\nint dissize(const struct disprm *dis, int sizes[2]);\n\nint disprt(const struct disprm *dis);\n\nint disperr(const struct disprm *dis, const char *prefix);\n\nint dishdo(struct disprm *dis);\n\nint disset(struct disprm *dis);\n\nint disp2x(struct disprm *dis, const double rawcrd[], double discrd[]);\n\nint disx2p(struct disprm *dis, const double discrd[], double rawcrd[]);\n\nint diswarp(struct disprm *dis, const double pixblc[], const double pixtrc[],\n            const double pixsamp[], int *nsamp,\n            double maxdis[], double *maxtot,\n            double avgdis[], double *avgtot,\n            double rmsdis[], double *rmstot);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WCSLIB_DIS\n"},{"id":16576,"name":"wcspih.l","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcspih.l,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* wcspih.l is a Flex description file containing the definition of a lexical\n* scanner for parsing the WCS keyrecords from a FITS primary image or image\n* extension header.\n*\n* wcspih.l requires Flex v2.5.4 or later.  Refer to wcshdr.h for a description\n* of the user interface and operating notes.\n*\n* Implementation notes\n* --------------------\n* Use of the WCSAXESa keyword is not mandatory.  Its default value is \"the\n* larger of NAXIS and the largest index of these keywords [i.e. CRPIXj, PCi_j\n* or CDi_j, CDELTi, CTYPEi, CRVALi, and CUNITi] found in the FITS header\".\n* Consequently the definition of WCSAXESa effectively invalidates the use of\n* NAXIS for determining the number of coordinate axes and forces a preliminary\n* pass through the header to determine the \"largest index\" in headers where\n* WCSAXESa was omitted.\n*\n* Furthermore, since the use of WCSAXESa is optional, there is no way to\n* determine the number of coordinate representations (the \"a\" value) other\n* than by parsing all of the WCS keywords in the header; even if WCSAXESa was\n* specified for some representations it cannot be known in advance whether it\n* was specified for all of those present in the header.\n*\n* Hence the definition of WCSAXESa forces the scanner to be implemented in two\n* passes.  The first pass is used to determine the number of coordinate\n* representations (up to 27) and the number of coordinate axes in each.\n* Effectively WCSAXESa is ignored unless it exceeds the \"largest index\" in\n* which case the keywords for the extra axes assume their default values.  The\n* number of PVi_ma and PSi_ma keywords in each representation is also counted\n* in the first pass.\n*\n* On completion of the first pass, memory is allocated for an array of the\n* required number of wcsprm structs and each of these is initialized\n* appropriately.  These structs are filled in the second pass.\n*\n* The parser does not check for duplicated keywords, it accepts the last\n* encountered.\n*\n*===========================================================================*/\n\n/* Options. */\n%option full\n%option never-interactive\n%option noinput\n%option noyywrap\n%option outfile=\"wcspih.c\"\n%option prefix=\"wcspih\"\n%option reentrant\n%option extra-type=\"struct wcspih_extra *\"\n\n/* Indices for parameterized keywords. */\nZ1\t[0-9]\nZ2\t[0-9]{2}\nZ3\t[0-9]{3}\nZ4\t[0-9]{4}\nZ5\t[0-9]{5}\nZ6\t[0-9]{6}\n\nI1\t[1-9]\nI2\t[1-9][0-9]\nI3\t[1-9][0-9]{2}\nI4\t[1-9][0-9]{3}\n\n/* Alternate coordinate system identifier. */\nALT\t[ A-Z]\n\n/* Keyvalue data types. */\nINTEGER\t[+-]?[0-9]+\nFLOAT\t[+-]?([0-9]+\\.?[0-9]*|\\.[0-9]+)([eEdD][+-]?[0-9]+)?\nSTRING\t'([^']|'')*'\nRECORD\t'[^']*'\nFIELD\t[a-zA-Z_][a-zA-Z_0-9.]*\n\n/* Inline comment syntax. */\nINLINE \" \"*(\\/.*)?\n\n/* Exclusive start states. */\n%x CCia CCi_ja CCCCCia CCi_ma CCCCCCCa CCCCCCCC\n%x CROTAi PROJPn SIP2 SIP3 DSSAMDXY PLTDECSN\n%x VALUE INTEGER_VAL FLOAT_VAL FLOAT2_VAL STRING_VAL\n%x RECORD_VAL RECFIELD RECCOLON RECVALUE RECEND\n%x COMMENT\n%x DISCARD ERROR FLUSH\n\n%{\n#include <math.h>\n#include <setjmp.h>\n#include <stddef.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"wcsmath.h\"\n#include \"wcsprintf.h\"\n#include \"wcsutil.h\"\n\n#include \"dis.h\"\n#include \"wcs.h\"\n#include \"wcshdr.h\"\n\n#define INTEGER 0\n#define FLOAT   1\n#define FLOAT2  2\n#define STRING  3\n#define RECORD  4\n\n#define PRIOR   1\n#define SEQUENT 2\n\n#define SIP     1\n#define DSS     2\n#define WAT     3\n\n// User data associated with yyscanner.\nstruct wcspih_extra {\n  // Values passed to YY_INPUT.\n  char *hdr;\n  int  nkeyrec;\n\n  // Used in preempting the call to exit() by yy_fatal_error().\n  jmp_buf abort_jmp_env;\n};\n\n#define YY_DECL int wcspih_scanner(char *header, int nkeyrec, int relax, \\\n int ctrl, int *nreject, int *nwcs, struct wcsprm **wcs, yyscan_t yyscanner)\n\n#define YY_INPUT(inbuff, count, bufsize) \\\n\t{ \\\n\t  if (yyextra->nkeyrec) { \\\n\t    strncpy(inbuff, yyextra->hdr, 80); \\\n\t    inbuff[80] = '\\n'; \\\n\t    yyextra->hdr += 80; \\\n\t    yyextra->nkeyrec--; \\\n\t    count = 81; \\\n\t  } else { \\\n\t    count = YY_NULL; \\\n\t  } \\\n\t}\n\n// Preempt the call to exit() by yy_fatal_error().\n#define exit(status) longjmp(yyextra->abort_jmp_env, status);\n\n// Internal helper functions.\nstatic YY_DECL;\nstatic int wcspih_final(int ndp[], int ndq[], int distran, double dsstmp[],\n             char *wat[], int *nwcs, struct wcsprm **wcs);\nstatic int wcspih_init1(int naxis, int alts[], int dpq[], int npv[],\n             int nps[], int ndp[], int ndq[], int auxprm, int distran,\n             int *nwcs, struct wcsprm **wcs);\nstatic void wcspih_pass1(int naxis, int i, int j, char a, int distype,\n             int alts[], int dpq[], int *npptr);\n\nstatic int wcspih_jdref(double *wptr,   const double *jdref);\nstatic int wcspih_jdrefi(double *wptr,  const double *jdrefi);\nstatic int wcspih_jdreff(double *wptr,  const double *jdreff);\nstatic int wcspih_epoch(double *wptr,   const double *epoch);\nstatic int wcspih_vsource(double *wptr, const double *vsource);\n\nstatic int wcspih_timepixr(double timepixr);\n\n%}\n\n%%\n\tint  p, q;\n\tchar *errmsg, errtxt[80], *keyname, strtmp[80], *wat[2], *watstr;\n\tint  alts[27], dpq[27], inttmp, ndp[27], ndq[27], nps[27], npv[27],\n\t     rectype;\n\tdouble dbltmp, dbl2tmp[2], dsstmp[20];\n\tstruct auxprm auxtem;\n\tstruct disprm distem;\n\tstruct wcsprm wcstem;\n\t\n\tint naxis = 0;\n\tfor (int ialt = 0; ialt < 27; ialt++) {\n\t  alts[ialt] = 0;\n\t  dpq[ialt]  = 0;\n\t  npv[ialt]  = 0;\n\t  nps[ialt]  = 0;\n\t  ndp[ialt]  = 0;\n\t  ndq[ialt]  = 0;\n\t}\n\t\n\t// Our handle on the input stream.\n\tchar *keyrec = header;\n\tchar *hptr = header;\n\tchar *keep = 0x0;\n\t\n\t// For keeping tallies of keywords found.\n\t*nreject = 0;\n\tint nvalid = 0;\n\tint nother = 0;\n\t\n\t// If strict, then also reject.\n\tif (relax & WCSHDR_strict) relax |= WCSHDR_reject;\n\t\n\t// Keyword indices, as used in the WCS papers, e.g. PCi_ja, PVi_ma.\n\tint i = 0;\n\tint j = 0;\n\tint m = 0;\n\tchar a = ' ';\n\t\n\t// For decoding the keyvalue.\n\tint valtype = -1;\n\tint distype =  0;\n\tvoid *vptr  = 0x0;\n\t\n\t// For keywords that require special handling.\n\tint altlin  = 0;\n\tint *npptr  = 0x0;\n\tint (*chekval)(double) = 0x0;\n\tint (*special)(double *, const double *) = 0x0;\n\tint auxprm  = 0;\n\tint naux    = 0;\n\tint distran = 0;\n\tint sipflag = 0;\n\tint dssflag = 0;\n\tint watflag = 0;\n\tint watn    = 0;\n\t\n\t// The data structures produced.\n\t*nwcs = 0;\n\t*wcs  = 0x0;\n\t\n\t// Control variables.\n\tint ipass = 1;\n\tint npass = 2;\n\t\n\t// User data associated with yyscanner.\n\tyyextra->hdr = header;\n\tyyextra->nkeyrec = nkeyrec;\n\t\n\t// Return here via longjmp() invoked by yy_fatal_error().\n\tif (setjmp(yyextra->abort_jmp_env)) {\n\t  return WCSHDRERR_PARSER;\n\t}\n\t\n\tBEGIN(INITIAL);\n\n\n^NAXIS\"   = \"\" \"*{INTEGER}{INLINE} {\n\t  keyname = \"NAXISn\";\n\t\n\t  if (ipass == 1) {\n\t    sscanf(yytext, \"NAXIS   = %d\", &naxis);\n\t    if (naxis < 0) naxis = 0;\n\t    BEGIN(FLUSH);\n\t\n\t  } else {\n\t    sscanf(yytext, \"NAXIS   = %d\", &i);\n\t\n\t    if (i < 0) {\n\t      errmsg = \"negative value of NAXIS ignored\";\n\t      BEGIN(ERROR);\n\t    } else {\n\t      BEGIN(DISCARD);\n\t    }\n\t  }\n\t}\n\n^WCSAXES{ALT}=\" \"\" \"*{INTEGER} {\n\t  sscanf(yytext, \"WCSAXES%c= %d\", &a, &i);\n\t\n\t  if (i < 0) {\n\t    errmsg = \"negative value of WCSAXESa ignored\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    valtype = INTEGER;\n\t    vptr    = 0x0;\n\t\n\t    keyname = \"WCSAXESa\";\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\n^CRPIX\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crpix);\n\t\n\t  keyname = \"CRPIXja\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^PC\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pc);\n\t  altlin = 1;\n\t\n\t  keyname = \"PCi_ja\";\n\t  BEGIN(CCi_ja);\n\t}\n\n^CD\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cd);\n\t  altlin = 2;\n\t\n\t  keyname = \"CDi_ja\";\n\t  BEGIN(CCi_ja);\n\t}\n\n^CDELT\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cdelt);\n\t\n\t  keyname = \"CDELTia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^CROTA\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crota);\n\t  altlin = 4;\n\t\n\t  keyname = \"CROTAn\";\n\t  BEGIN(CROTAi);\n\t}\n\n^CUNIT\t{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cunit);\n\t\n\t  keyname = \"CUNITia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^CTYPE\t{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ctype);\n\t\n\t  keyname = \"CTYPEia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^CRVAL\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crval);\n\t\n\t  keyname = \"CRVALia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^LONPOLE {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.lonpole);\n\t\n\t  keyname = \"LONPOLEa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\n^LATPOLE {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.latpole);\n\t\n\t  keyname = \"LATPOLEa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\n^RESTFRQ {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.restfrq);\n\t\n\t  keyname = \"RESTFRQa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\n^RESTFREQ {\n\t  if (relax & WCSHDR_strict) {\n\t    errmsg = \"the RESTFREQ keyword is deprecated, use RESTFRQa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    valtype = FLOAT;\n\t    vptr    = &(wcstem.restfrq);\n\t\n\t    unput(' ');\n\t\n\t    keyname = \"RESTFREQ\";\n\t    BEGIN(CCCCCCCa);\n\t  }\n\t}\n\n^RESTWAV {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.restwav);\n\t\n\t  keyname = \"RESTWAVa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\n^PV\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pv);\n\t  npptr   = npv;\n\t\n\t  keyname = \"PVi_ma\";\n\t  BEGIN(CCi_ma);\n\t}\n\n^PROJP\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pv);\n\t  npptr   = npv;\n\t\n\t  keyname = \"PROJPn\";\n\t  BEGIN(PROJPn);\n\t}\n\n^PS\t{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ps);\n\t  npptr   = nps;\n\t\n\t  keyname = \"PSi_ma\";\n\t  BEGIN(CCi_ma);\n\t}\n\n^VELREF{ALT}\" \" {\n\t  sscanf(yytext, \"VELREF%c\", &a);\n\t\n\t  if (relax & WCSHDR_strict) {\n\t    errmsg = \"the VELREF keyword is deprecated, use SPECSYSa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else if ((a == ' ') || (relax & WCSHDR_VELREFa)) {\n\t    valtype = INTEGER;\n\t    vptr    = &(wcstem.velref);\n\t\n\t    unput(a);\n\t\n\t    keyname = \"VELREF\";\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"VELREF keyword may not have an alternate version code\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^CNAME\t{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cname);\n\t\n\t  keyname = \"CNAMEia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^CRDER\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crder);\n\t\n\t  keyname = \"CRDERia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^CSYER\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.csyer);\n\t\n\t  keyname = \"CSYERia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^CZPHS\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.czphs);\n\t\n\t  keyname = \"CZPHSia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^CPERI\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cperi);\n\t\n\t  keyname = \"CPERIia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^WCSNAME {\n\t  valtype = STRING;\n\t  vptr    = wcstem.wcsname;\n\t\n\t  keyname = \"WCSNAMEa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\n^TIMESYS\" \" {\n\t  valtype = STRING;\n\t  vptr    = wcstem.timesys;\n\t\n\t  keyname = \"TIMESYS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TREFPOS\" \" {\n\t  valtype = STRING;\n\t  vptr    = wcstem.trefpos;\n\t\n\t  keyname = \"TREFPOS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TREFDIR\" \" {\n\t  valtype = STRING;\n\t  vptr    = wcstem.trefdir;\n\t\n\t  keyname = \"TREFDIR\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^PLEPHEM\" \" {\n\t  valtype = STRING;\n\t  vptr    = wcstem.plephem;\n\t\n\t  keyname = \"PLEPHEM\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TIMEUNIT {\n\t  valtype = STRING;\n\t  vptr    = wcstem.timeunit;\n\t\n\t  keyname = \"TIMEUNIT\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^DATEREF\" \" |\n^DATE-REF {\n\t  if ((yytext[4] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = STRING;\n\t    vptr    = wcstem.dateref;\n\t\n\t    keyname = \"DATEREF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the DATE-REF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^MJDREF\"  \" |\n^MJD-REF\" \" {\n\t  if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = FLOAT2;\n\t    vptr    = wcstem.mjdref;\n\t\n\t    keyname = \"MJDREF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the MJD-REF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^MJDREFI\" \" |\n^MJD-REFI {\n\t  if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    // Actually integer, but treated as float.\n\t    valtype = FLOAT;\n\t    vptr    = wcstem.mjdref;\n\t\n\t    keyname = \"MJDREFI\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the MJD-REFI keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^MJDREFF\" \" |\n^MJD-REFF {\n\t  if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = FLOAT;\n\t    vptr    = wcstem.mjdref + 1;\n\t\n\t    keyname = \"MJDREFF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the MJD-REFF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^JDREF\"   \" |\n^JD-REF\"  \" {\n\t  if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = FLOAT2;\n\t    vptr    = wcstem.mjdref;\n\t    special = wcspih_jdref;\n\t\n\t    keyname = \"JDREF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the JD-REF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^JDREFI\"  \" |\n^JD-REFI {\n\t  if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    // Actually integer, but treated as float.\n\t    valtype = FLOAT;\n\t    vptr    = wcstem.mjdref;\n\t    special = wcspih_jdrefi;\n\t\n\t    keyname = \"JDREFI\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the JD-REFI keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^JDREFF\"  \" |\n^JD-REFF {\n\t  if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = FLOAT;\n\t    vptr    = wcstem.mjdref;\n\t    special = wcspih_jdreff;\n\t\n\t    keyname = \"JDREFF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the JD-REFF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^TIMEOFFS {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timeoffs);\n\t\n\t  keyname = \"TIMEOFFS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^DATE-OBS {\n\t  valtype = STRING;\n\t  vptr    = wcstem.dateobs;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"DATE-OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^DATE-BEG {\n\t  valtype = STRING;\n\t  vptr    = wcstem.datebeg;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"DATE-BEG\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^DATE-AVG {\n\t  valtype = STRING;\n\t  vptr    = wcstem.dateavg;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"DATE-AVG\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^DATE-END {\n\t  valtype = STRING;\n\t  vptr    = wcstem.dateend;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"DATE-END\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^MJD-OBS\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdobs);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"MJD-OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^MJD-BEG\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdbeg);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"MJD-BEG\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^MJD-AVG\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdavg);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"MJD-AVG\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^MJD-END\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdend);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"MJD-END\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^JEPOCH\"  \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.jepoch);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"JEPOCH\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^BEPOCH\"  \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.bepoch);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"BEPOCH\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TSTART\"  \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.tstart);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TSTART\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TSTOP\"   \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.tstop);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TSTOP\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^XPOSURE\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.xposure);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"XPOSURE\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TELAPSE\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.telapse);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TELAPSE\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TIMSYER\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timsyer);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TIMSYER\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TIMRDER\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timrder);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TIMRDER\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TIMEDEL\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timedel);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TIMEDEL\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TIMEPIXR {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timepixr);\n\t  chekval = wcspih_timepixr;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TIMEPIXR\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^OBSGEO-X {\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-X\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^OBSGEO-Y {\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 1;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-Y\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^OBSGEO-Z {\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 2;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-Z\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^OBSGEO-L {\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 3;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-L\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^OBSGEO-B {\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 4;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-B\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^OBSGEO-H {\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 5;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-H\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^OBSORBIT {\n\t  valtype = STRING;\n\t  vptr    = wcstem.obsorbit;\n\t\n\t  keyname = \"OBSORBIT\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^RADESYS {\n\t  valtype = STRING;\n\t  vptr    = wcstem.radesys;\n\t\n\t  keyname = \"RADESYSa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\n^RADECSYS {\n\t  if (relax & WCSHDR_RADECSYS) {\n\t    valtype = STRING;\n\t    vptr    = wcstem.radesys;\n\t\n\t    unput(' ');\n\t\n\t    keyname = \"RADECSYS\";\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the RADECSYS keyword is deprecated, use RADESYSa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^EPOCH{ALT}\"  \" {\n\t  sscanf(yytext, \"EPOCH%c\", &a);\n\t\n\t  if (relax & WCSHDR_strict) {\n\t    errmsg = \"the EPOCH keyword is deprecated, use EQUINOXa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else if (a == ' ' || relax & WCSHDR_EPOCHa) {\n\t    valtype = FLOAT;\n\t    vptr    = &(wcstem.equinox);\n\t    special = wcspih_epoch;\n\t\n\t    unput(a);\n\t\n\t    keyname = \"EPOCH\";\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"EPOCH keyword may not have an alternate version code\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^EQUINOX {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.equinox);\n\t\n\t  keyname = \"EQUINOXa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\n^SPECSYS {\n\t  valtype = STRING;\n\t  vptr    = wcstem.specsys;\n\t\n\t  keyname = \"SPECSYSa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\n^SSYSOBS {\n\t  valtype = STRING;\n\t  vptr    = wcstem.ssysobs;\n\t\n\t  keyname = \"SSYSOBSa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\n^VELOSYS {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.velosys);\n\t\n\t  keyname = \"VELOSYSa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\n^VSOURCE{ALT} {\n\t  if (relax & WCSHDR_VSOURCE) {\n\t    valtype = FLOAT;\n\t    vptr    = &(wcstem.zsource);\n\t    special = wcspih_vsource;\n\t\n\t    yyless(7);\n\t\n\t    keyname = \"VSOURCEa\";\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the VSOURCEa keyword is deprecated, use ZSOURCEa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^ZSOURCE {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.zsource);\n\t\n\t  keyname = \"ZSOURCEa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\n^SSYSSRC {\n\t  valtype = STRING;\n\t  vptr    = wcstem.ssyssrc;\n\t\n\t  keyname = \"SSYSSRCa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\n^VELANGL {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.velangl);\n\t\n\t  keyname = \"VELANGLa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\n^RSUN_REF {\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.rsun_ref);\n\t\n\t  keyname = \"RSUN_REF\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^DSUN_OBS {\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.dsun_obs);\n\t\n\t  keyname = \"DSUN_OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^CRLN_OBS {\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.crln_obs);\n\t\n\t  keyname = \"CRLN_OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^HGLN_OBS {\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.hgln_obs);\n\t\n\t  keyname = \"HGLN_OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^CRLT_OBS |\n^HGLT_OBS {\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.hglt_obs);\n\t\n\t  keyname = \"HGLT_OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^CPDIS\t{\n\t  valtype = STRING;\n\t  distype = PRIOR;\n\t  vptr    = &(distem.dtype);\n\t\n\t  keyname = \"CPDISja\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^CQDIS\t{\n\t  valtype = STRING;\n\t  distype = SEQUENT;\n\t  vptr    = &(distem.dtype);\n\t\n\t  keyname = \"CQDISia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^DP\t{\n\t  valtype = RECORD;\n\t  distype = PRIOR;\n\t  vptr    = &(distem.dp);\n\t  npptr   = ndp;\n\t\n\t  keyname = \"DPja\";\n\t  BEGIN(CCia);\n\t}\n\n^DQ\t{\n\t  valtype = RECORD;\n\t  distype = SEQUENT;\n\t  vptr    = &(distem.dp);\n\t  npptr   = ndq;\n\t\n\t  keyname = \"DQia\";\n\t  BEGIN(CCia);\n\t}\n\n^CPERR\t{\n\t  valtype = FLOAT;\n\t  distype = PRIOR;\n\t  vptr    = &(distem.maxdis);\n\t\n\t  keyname = \"CPERRja\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^CQERR\t{\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = &(distem.maxdis);\n\t\n\t  keyname = \"CQERRia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^DVERR\t{\n\t  valtype = FLOAT;\n\t  distype = PRIOR;\n\t  vptr    = &(distem.totdis);\n\t\n\t  keyname = \"DVERRa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\n^A_ORDER\" \" {\n\t  // SIP: axis 1 polynomial degree (not stored).\n\t  valtype = INTEGER;\n\t  distype = PRIOR;\n\t  vptr    = 0x0;\n\t\n\t  i = 1;\n\t  a = ' ';\n\t\n\t  keyname = \"A_ORDER\";\n\t  BEGIN(VALUE);\n\t}\n\n^B_ORDER\" \" {\n\t  // SIP: axis 2 polynomial degree (not stored).\n\t  valtype = INTEGER;\n\t  distype = PRIOR;\n\t  vptr    = 0x0;\n\t\n\t  i = 2;\n\t  a = ' ';\n\t\n\t  keyname = \"B_ORDER\";\n\t  BEGIN(VALUE);\n\t}\n\n^AP_ORDER {\n\t  // SIP: axis 1 inverse polynomial degree (not stored).\n\t  valtype = INTEGER;\n\t  distype = PRIOR;\n\t  vptr    = 0x0;\n\t\n\t  i = 1;\n\t  a = ' ';\n\t\n\t  keyname = \"AP_ORDER\";\n\t  BEGIN(VALUE);\n\t}\n\n^BP_ORDER {\n\t  // SIP: axis 2 inverse polynomial degree (not stored).\n\t  valtype = INTEGER;\n\t  distype = PRIOR;\n\t  vptr    = 0x0;\n\t\n\t  i = 2;\n\t  a = ' ';\n\t\n\t  keyname = \"BP_ORDER\";\n\t  BEGIN(VALUE);\n\t}\n\n^A_DMAX\"  \" {\n\t  // SIP: axis 1 maximum distortion.\n\t  valtype = FLOAT;\n\t  distype = PRIOR;\n\t  vptr    = &(distem.maxdis);\n\t\n\t  i = 1;\n\t  a = ' ';\n\t\n\t  keyname = \"A_DMAX\";\n\t  BEGIN(VALUE);\n\t}\n\n^B_DMAX\"  \" {\n\t  // SIP: axis 2 maximum distortion.\n\t  valtype = FLOAT;\n\t  distype = PRIOR;\n\t  vptr    = &(distem.maxdis);\n\t\n\t  i = 2;\n\t  a = ' ';\n\t\n\t  keyname = \"B_DMAX\";\n\t  BEGIN(VALUE);\n\t}\n\n^A_\t{\n\t  // SIP: axis 1 polynomial coefficient.\n\t  i = 1;\n\t  sipflag = 2;\n\t\n\t  keyname = \"A_p_q\";\n\t  BEGIN(SIP2);\n\t}\n\n^B_\t{\n\t  // SIP: axis 2 polynomial coefficient.\n\t  i = 2;\n\t  sipflag = 2;\n\t\n\t  keyname = \"B_p_q\";\n\t  BEGIN(SIP2);\n\t}\n\n^AP_\t{\n\t  // SIP: axis 1 inverse polynomial coefficient.\n\t  i = 1;\n\t  sipflag = 3;\n\t\n\t  keyname = \"AP_p_q\";\n\t  BEGIN(SIP3);\n\t}\n\n^BP_\t{\n\t  // SIP: axis 2 inverse polynomial coefficient.\n\t  i = 2;\n\t  sipflag = 3;\n\t\n\t  keyname = \"BP_p_q\";\n\t  BEGIN(SIP3);\n\t}\n\n^CNPIX1\"  \" {\n\t  // DSS: LLH corner pixel coordinate 1.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"CNPIX1\";\n\t  BEGIN(VALUE);\n\t}\n\n^CNPIX2\"  \" {\n\t  // DSS: LLH corner pixel coordinate 2.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+1;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"CNPIX1\";\n\t  BEGIN(VALUE);\n\t}\n\n^PPO3\"    \" {\n\t  // DSS: plate centre x-coordinate in micron.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+2;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PPO3\";\n\t  BEGIN(VALUE);\n\t}\n\n^PPO6\"    \" {\n\t  // DSS: plate centre y-coordinate in micron.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+3;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PPO6\";\n\t  BEGIN(VALUE);\n\t}\n\n^XPIXELSZ {\n\t  // DSS: pixel x-dimension in micron.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+4;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"XPIXELSZ\";\n\t  BEGIN(VALUE);\n\t}\n\n^YPIXELSZ {\n\t  // DSS: pixel y-dimension in micron.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+5;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"YPIXELSZ\";\n\t  BEGIN(VALUE);\n\t}\n\n^PLTRAH\"  \" {\n\t  // DSS: plate centre, right ascension - hours.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+6;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PLTRAH\";\n\t  BEGIN(VALUE);\n\t}\n\n^PLTRAM\"  \" {\n\t  // DSS: plate centre, right ascension - minutes.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+7;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PLTRAM\";\n\t  BEGIN(VALUE);\n\t}\n\n^PLTRAS\"  \" {\n\t  // DSS: plate centre, right ascension - seconds.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+8;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PLTRAS\";\n\t  BEGIN(VALUE);\n\t}\n\n^PLTDECSN {\n\t  // DSS: plate centre, declination - sign.\n\t  valtype = STRING;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+9;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PLTDECSN\";\n\t  BEGIN(PLTDECSN);\n\t}\n\n^PLTDECD\" \" {\n\t  // DSS: plate centre, declination - degrees.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+10;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PLTDECD\";\n\t  BEGIN(VALUE);\n\t}\n\n^PLTDECM\" \" {\n\t  // DSS: plate centre, declination - arcmin.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+11;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PLTDECM\";\n\t  BEGIN(VALUE);\n\t}\n\n^PLTDECS\" \" {\n\t  // DSS: plate centre, declination - arcsec.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+12;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PLTDECS\";\n\t  BEGIN(VALUE);\n\t}\n\n^PLATEID\" \" {\n\t  // DSS: plate identification (insufficient to trigger DSS).\n\t  valtype = STRING;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+13;\n\t  dssflag = 2;\n\t  distran = 0;\n\t\n\t  keyname = \"PLATEID\";\n\t  BEGIN(VALUE);\n\t}\n\n^AMDX\t{\n\t  // DSS: axis 1 polynomial coefficient.\n\t  i = 1;\n\t  dssflag = 3;\n\t\n\t  keyname = \"AMDXm\";\n\t  BEGIN(DSSAMDXY);\n\t}\n\n^AMDY\t{\n\t  // DSS: axis 2 polynomial coefficient.\n\t  i = 2;\n\t  dssflag = 3;\n\t\n\t  keyname = \"AMDYm\";\n\t  BEGIN(DSSAMDXY);\n\t}\n\n^WAT[12]_{Z3} {\n\t  // TNX or ZPX: string-encoded data array.\n\t  sscanf(yytext, \"WAT%d_%d\", &i, &m);\n\t  if (watn < m) watn = m;\n\t  watflag = 1;\n\t\n\t  valtype = STRING;\n\t  distype = SEQUENT;\n\t  vptr = wat[i-1] + 68*(m-1);\n\t\n\t  a = ' ';\n\t  distran = WAT;\n\t\n\t  keyname = \"WATi_m\";\n\t  BEGIN(VALUE);\n\t}\n\n^END\" \"{77} {\n\t  if (yyextra->nkeyrec) {\n\t    yyextra->nkeyrec = 0;\n\t    errmsg = \"keyrecords following the END keyrecord were ignored\";\n\t    BEGIN(ERROR);\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^.\t{\n\t  BEGIN(DISCARD);\n\t}\n\n<CCia>{I1}{ALT}\"    \" |\n<CCia>{I2}{ALT}\"   \"  |\n<CCCCCia>{I1}{ALT}\" \" |\n<CCCCCia>{I2}{ALT} {\n\t  sscanf(yytext, \"%d%c\", &i, &a);\n\t  BEGIN(VALUE);\n\t}\n\n<CCia>0{I1}{ALT}\"   \"    |\n<CCia>0{Z1}{I1}{ALT}\"  \" |\n<CCia>0{Z2}{I1}{ALT}\" \"  |\n<CCia>0{Z3}{I1}{ALT}     |\n<CCia>0{Z4}{I1}          |\n<CCCCCia>0{I1}{ALT}      |\n<CCCCCia>0{Z1}{I1} {\n\t  if (relax & WCSHDR_reject) {\n\t    // Violates the basic FITS standard.\n\t    errmsg = \"indices in parameterized keywords must not have \"\n\t             \"leading zeroes\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCia>{Z1}{ALT}\"    \" |\n<CCia>{Z2}{ALT}\"   \"  |\n<CCia>{Z3}{ALT}\"  \"   |\n<CCia>{Z4}{ALT}\" \"    |\n<CCia>{Z5}{ALT}       |\n<CCia>{Z6}            |\n<CCCCCia>{Z1}{ALT}\" \" |\n<CCCCCia>{Z2}{ALT}    |\n<CCCCCia>{Z3} {\n\t  // Anything that has fallen through to this point must contain\n\t  // an invalid axis number.\n\t  errmsg = \"axis number must exceed 0\";\n\t  BEGIN(ERROR);\n\t}\n\n<CCia>. {\n\t  // Let it go.\n\t  BEGIN(DISCARD);\n\t}\n\n<CCCCCia>. {\n\t  if (relax & WCSHDR_reject) {\n\t    // Looks too much like a FITS WCS keyword not to flag it.\n\t    errmsg = errtxt;\n\t    sprintf(errmsg, \"keyword looks very much like %s but isn't\",\n\t      keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Let it go.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCi_ja>{I1}_{I1}{ALT}\"  \" |\n<CCi_ja>{I1}_{I2}{ALT}\" \" |\n<CCi_ja>{I2}_{I1}{ALT}\" \" |\n<CCi_ja>{I2}_{I2}{ALT} {\n\t  sscanf(yytext, \"%d_%d%c\", &i, &j, &a);\n\t  BEGIN(VALUE);\n\t}\n\n\n<CCi_ja>0{I1}_{I1}{ALT}\" \" |\n<CCi_ja>{I1}_0{I1}{ALT}\" \" |\n<CCi_ja>00{I1}_{I1}{ALT} |\n<CCi_ja>0{I1}_0{I1}{ALT} |\n<CCi_ja>{I1}_00{I1}{ALT} |\n<CCi_ja>000{I1}_{I1} |\n<CCi_ja>00{I1}_0{I1} |\n<CCi_ja>0{I1}_00{I1} |\n<CCi_ja>{I1}_000{I1} |\n<CCi_ja>0{I1}_{I2}{ALT} |\n<CCi_ja>{I1}_0{I2}{ALT} |\n<CCi_ja>00{I1}_{I2} |\n<CCi_ja>0{I1}_0{I2} |\n<CCi_ja>{I1}_00{I2} |\n<CCi_ja>0{I2}_{I1}{ALT} |\n<CCi_ja>{I2}_0{I1}{ALT} |\n<CCi_ja>00{I2}_{I1} |\n<CCi_ja>0{I2}_0{I1} |\n<CCi_ja>{I2}_00{I1} |\n<CCi_ja>0{I2}_{I2} |\n<CCi_ja>{I2}_0{I2} {\n\t  if (((altlin == 1) && (relax & WCSHDR_PC0i_0ja)) ||\n\t      ((altlin == 2) && (relax & WCSHDR_CD0i_0ja))) {\n\t    sscanf(yytext, \"%d_%d%c\", &i, &j, &a);\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"indices in parameterized keywords must not have \"\n\t             \"leading zeroes\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCi_ja>{Z1}_{Z1}{ALT}\"  \" |\n<CCi_ja>{Z2}_{Z1}{ALT}\" \" |\n<CCi_ja>{Z1}_{Z2}{ALT}\" \" |\n<CCi_ja>{Z3}_{Z1}{ALT} |\n<CCi_ja>{Z2}_{Z2}{ALT} |\n<CCi_ja>{Z1}_{Z3}{ALT} |\n<CCi_ja>{Z4}_{Z1} |\n<CCi_ja>{Z3}_{Z2} |\n<CCi_ja>{Z2}_{Z3} |\n<CCi_ja>{Z1}_{Z4} {\n\t  // Anything that has fallen through to this point must contain\n\t  // an invalid axis number.\n\t  errmsg = \"axis number must exceed 0\";\n\t  BEGIN(ERROR);\n\t}\n\n<CCi_ja>{Z1}-{Z1}{ALT}\"  \" |\n<CCi_ja>{Z2}-{Z1}{ALT}\" \" |\n<CCi_ja>{Z1}-{Z2}{ALT}\" \" |\n<CCi_ja>{Z3}-{Z1}{ALT} |\n<CCi_ja>{Z2}-{Z2}{ALT} |\n<CCi_ja>{Z1}-{Z3}{ALT} |\n<CCi_ja>{Z4}-{Z1} |\n<CCi_ja>{Z3}-{Z2} |\n<CCi_ja>{Z2}-{Z3} |\n<CCi_ja>{Z1}-{Z4} {\n\t  errmsg = errtxt;\n\t  sprintf(errmsg, \"%s keyword must use an underscore, not a dash\",\n\t    keyname);\n\t  BEGIN(ERROR);\n\t}\n\n<CCi_ja>{Z2}{I1}{Z2}{I1} {\n\t  // This covers the defunct forms CD00i00j and PC00i00j.\n\t  if (((altlin == 1) && (relax & WCSHDR_PC00i00j)) ||\n\t      ((altlin == 2) && (relax & WCSHDR_CD00i00j))) {\n\t    sscanf(yytext, \"%3d%3d\", &i, &j);\n\t    a = ' ';\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"this form of the %s keyword is deprecated, use %s\",\n\t      keyname, keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCi_ja>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<CCCCCCCa>{ALT} |\n<CCCCCCCC>. {\n\t  if (YY_START == CCCCCCCa) {\n\t    sscanf(yytext, \"%c\", &a);\n\t  } else {\n\t    unput(yytext[0]);\n\t    a = 0;\n\t  }\n\t\n\t  BEGIN(VALUE);\n\t}\n\n<CCCCCCCa>. {\n\t  if (relax & WCSHDR_reject) {\n\t    // Looks too much like a FITS WCS keyword not to flag it.\n\t    errmsg = errtxt;\n\t    sprintf(errmsg, \"invalid alternate code, keyword resembles %s \"\n\t      \"but isn't\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCi_ma>{I1}_{Z1}{ALT}\"  \" |\n<CCi_ma>{I1}_{I2}{ALT}\" \" |\n<CCi_ma>{I2}_{Z1}{ALT}\" \" |\n<CCi_ma>{I2}_{I2}{ALT} {\n\t  sscanf(yytext, \"%d_%d%c\", &i, &m, &a);\n\t  BEGIN(VALUE);\n\t}\n\n<CCi_ma>0{I1}_{Z1}{ALT}\" \" |\n<CCi_ma>{I1}_0{Z1}{ALT}\" \" |\n<CCi_ma>00{I1}_{Z1}{ALT} |\n<CCi_ma>0{I1}_0{Z1}{ALT} |\n<CCi_ma>{I1}_00{Z1}{ALT} |\n<CCi_ma>000{I1}_{Z1} |\n<CCi_ma>00{I1}_0{Z1} |\n<CCi_ma>0{I1}_00{Z1} |\n<CCi_ma>{I1}_000{Z1} |\n<CCi_ma>0{I1}_{I2}{ALT} |\n<CCi_ma>{I1}_0{I2}{ALT} |\n<CCi_ma>00{I1}_{I2} |\n<CCi_ma>0{I1}_0{I2} |\n<CCi_ma>{I1}_00{I2} |\n<CCi_ma>0{I2}_{Z1}{ALT} |\n<CCi_ma>{I2}_0{Z1}{ALT} |\n<CCi_ma>00{I2}_{Z1} |\n<CCi_ma>0{I2}_0{Z1} |\n<CCi_ma>{I2}_00{Z1} |\n<CCi_ma>0{I2}_{I2} |\n<CCi_ma>{I2}_0{I2} {\n\t  if (((valtype == FLOAT)  && (relax & WCSHDR_PV0i_0ma)) ||\n\t      ((valtype == STRING) && (relax & WCSHDR_PS0i_0ma))) {\n\t    sscanf(yytext, \"%d_%d%c\", &i, &m, &a);\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"indices in parameterized keywords must not have \"\n\t             \"leading zeroes\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCi_ma>{Z1}_{Z1}{ALT}\"  \" |\n<CCi_ma>{Z2}_{Z1}{ALT}\" \" |\n<CCi_ma>{Z1}_{Z2}{ALT}\" \" |\n<CCi_ma>{Z3}_{Z1}{ALT} |\n<CCi_ma>{Z2}_{Z2}{ALT} |\n<CCi_ma>{Z1}_{Z3}{ALT} |\n<CCi_ma>{Z4}_{Z1} |\n<CCi_ma>{Z3}_{Z2} |\n<CCi_ma>{Z2}_{Z3} |\n<CCi_ma>{Z1}_{Z4} {\n\t  // Anything that has fallen through to this point must contain\n\t  // an invalid axis number.\n\t  errmsg = \"axis number must exceed 0\";\n\t  BEGIN(ERROR);\n\t}\n\n<CCi_ma>{Z1}-{Z1}{ALT}\"  \" |\n<CCi_ma>{Z2}-{Z1}{ALT}\" \" |\n<CCi_ma>{Z1}-{Z2}{ALT}\" \" |\n<CCi_ma>{Z3}-{Z1}{ALT} |\n<CCi_ma>{Z2}-{Z2}{ALT} |\n<CCi_ma>{Z1}-{Z3}{ALT} |\n<CCi_ma>{Z4}-{Z1} |\n<CCi_ma>{Z3}-{Z2} |\n<CCi_ma>{Z2}-{Z3} |\n<CCi_ma>{Z1}-{Z4} {\n\t  errmsg = errtxt;\n\t  sprintf(errmsg, \"%s keyword must use an underscore, not a dash\",\n\t    keyname);\n\t  BEGIN(ERROR);\n\t}\n\n<CCi_ma>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<CROTAi>{Z1}{ALT}\" \" |\n<CROTAi>{Z2}{ALT} |\n<CROTAi>{Z3} {\n\t  a = ' ';\n\t  sscanf(yytext, \"%d%c\", &i, &a);\n\t\n\t  if (relax & WCSHDR_strict) {\n\t    errmsg = \"the CROTAn keyword is deprecated, use PCi_ja\";\n\t    BEGIN(ERROR);\n\t\n\t  } else if ((a == ' ') || (relax & WCSHDR_CROTAia)) {\n\t    yyless(0);\n\t    BEGIN(CCCCCia);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"CROTAn keyword may not have an alternate version code\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CROTAi>. {\n\t  yyless(0);\n\t  BEGIN(CCCCCia);\n\t}\n\n<PROJPn>{Z1}\"  \" {\n\t  if (relax & WCSHDR_PROJPn) {\n\t    sscanf(yytext, \"%d\", &m);\n\t    i = 0;\n\t    a = ' ';\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the PROJPn keyword is deprecated, use PVi_ma\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<PROJPn>{Z2}\" \" |\n<PROJPn>{Z3} {\n\t  if (relax & (WCSHDR_PROJPn | WCSHDR_reject)) {\n\t    errmsg = \"invalid PROJPn keyword\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<PROJPn>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<SIP2>{Z1}_{Z1}\"   \" |\n<SIP3>{Z1}_{Z1}\"  \" {\n\t  // SIP keywords.\n\t  valtype = FLOAT;\n\t  distype = PRIOR;\n\t  vptr    = &(distem.dp);\n\t  npptr   = ndp;\n\t\n\t  a = ' ';\n\t  distran = SIP;\n\t\n\t  sscanf(yytext, \"%d_%d\", &p, &q);\n\t  BEGIN(VALUE);\n\t}\n\n<SIP2>. |\n<SIP3>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<DSSAMDXY>{I1}\"   \" |\n<DSSAMDXY>{I2}\"  \" {\n\t  // DSS keywords.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = &(distem.dp);\n\t  npptr   = ndq;\n\t\n\t  a = ' ';\n\t  distran = DSS;\n\t\n\t  sscanf(yytext, \"%d\", &m);\n\t  BEGIN(VALUE);\n\t}\n\n<DSSAMDXY>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<PLTDECSN>=\" \"+{STRING} {\n\t  // Special handling for this iconic DSS keyword.\n\t  if (1 < ipass) {\n\t    // Look for a minus sign.\n\t    sscanf(yytext, \"= '%s\", strtmp);\n\t    dbltmp = strcmp(strtmp, \"-\") ? 1.0 : -1.0;\n\t  }\n\t\n\t  BEGIN(COMMENT);\n\t}\n\n<PLTDECSN>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<VALUE>=\" \"+ {\n\t  // Do checks on i, j & m.\n\t  if (99 < i || 99 < j || 99 < m) {\n\t    if (relax & WCSHDR_reject) {\n\t      if (99 < i || 99 < j) {\n\t        errmsg = \"axis number exceeds 99\";\n\t      } else if (m > 99) {\n\t        errmsg = \"parameter number exceeds 99\";\n\t      }\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      // Pretend we don't recognize it.\n\t      BEGIN(DISCARD);\n\t    }\n\t\n\t  } else {\n\t    if (valtype == INTEGER) {\n\t      BEGIN(INTEGER_VAL);\n\t    } else if (valtype == FLOAT) {\n\t      BEGIN(FLOAT_VAL);\n\t    } else if (valtype == FLOAT2) {\n\t      BEGIN(FLOAT2_VAL);\n\t    } else if (valtype == STRING) {\n\t      BEGIN(STRING_VAL);\n\t    } else if (valtype == RECORD) {\n\t      BEGIN(RECORD_VAL);\n\t    } else {\n\t      errmsg = errtxt;\n\t      sprintf(errmsg, \"internal parser ERROR, bad data type: %d\",\n\t        valtype);\n\t      BEGIN(ERROR);\n\t    }\n\t  }\n\t}\n\n<VALUE>. {\n\t  errmsg = \"invalid KEYWORD = VALUE syntax\";\n\t  BEGIN(ERROR);\n\t}\n\n<INTEGER_VAL>{INTEGER} {\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    // Read the keyvalue.\n\t    sscanf(yytext, \"%d\", &inttmp);\n\t\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\n<INTEGER_VAL>. {\n\t  errmsg = \"an integer value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\n<FLOAT_VAL>{FLOAT} {\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    // Read the keyvalue.\n\t    wcsutil_str2double(yytext, &dbltmp);\n\n\t    if (chekval && chekval(dbltmp)) {\n\t      errmsg = \"invalid keyvalue\";\n\t      BEGIN(ERROR);\n\t    } else {\n\t      BEGIN(COMMENT);\n\t    }\n\t  }\n\t}\n\n<FLOAT_VAL>. {\n\t  errmsg = \"a floating-point value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\n<FLOAT2_VAL>{FLOAT} {\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    // Read the keyvalue as integer and fractional parts.\n\t    wcsutil_str2double2(yytext, dbl2tmp);\n\t\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\n<FLOAT2_VAL>. {\n\t  errmsg = \"a floating-point value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\n<STRING_VAL>{STRING} {\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    // Read the keyvalue.\n\t    strcpy(strtmp, yytext+1);\n\t\n\t    // Squeeze out repeated quotes.\n\t    int ix = 0;\n\t    for (int jx = 0; jx < 72; jx++) {\n\t      if (ix < jx) {\n\t        strtmp[ix] = strtmp[jx];\n\t      }\n\t\n\t      if (strtmp[jx] == '\\0') {\n\t        if (ix) strtmp[ix-1] = '\\0';\n\t        break;\n\t      } else if (strtmp[jx] == '\\'' && strtmp[jx+1] == '\\'') {\n\t        jx++;\n\t      }\n\t\n\t      ix++;\n\t    }\n\t\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\n<STRING_VAL>. {\n\t  errmsg = \"a string value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\n<RECORD_VAL>{RECORD} {\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    yyless(1);\n\t\n\t    BEGIN(RECFIELD);\n\t  }\n\t}\n\n<RECORD_VAL>. {\n\t  errmsg = \"a record was expected\";\n\t  BEGIN(ERROR);\n\t}\n\n<RECFIELD>{FIELD} {\n\t  strcpy(strtmp, yytext);\n\t  BEGIN(RECCOLON);\n\t}\n\n<RECFIELD>. {\n\t  errmsg = \"invalid record field\";\n\t  BEGIN(ERROR);\n\t}\n\n<RECCOLON>:\" \"+ {\n\t  BEGIN(RECVALUE);\n\t}\n\n<RECCOLON>. {\n\t  errmsg = \"invalid record syntax\";\n\t  BEGIN(ERROR);\n\t}\n\n<RECVALUE>{INTEGER} {\n\t  rectype = 0;\n\t  sscanf(yytext, \"%d\", &inttmp);\n\t  BEGIN(RECEND);\n\t}\n\n<RECVALUE>{FLOAT} {\n\t  rectype = 1;\n\t  wcsutil_str2double(yytext, &dbltmp);\n\t  BEGIN(RECEND);\n\t}\n\n<RECVALUE>. {\n\t  errmsg = \"invalid record value\";\n\t  BEGIN(ERROR);\n\t}\n\n<RECEND>' {\n\t  BEGIN(COMMENT);\n\t}\n\n<COMMENT>{INLINE}$ {\n\t  if (ipass == 1) {\n\t    // Do first-pass bookkeeping.\n\t    wcspih_pass1(naxis, i, j, a, distype, alts, dpq, npptr);\n\t    BEGIN(FLUSH);\n\t\n\t  } else if (*wcs) {\n\t    // Store the value now that the keyrecord has been validated.\n\t    int gotone = 0;\n\t    for (int ialt = 0; ialt < *nwcs; ialt++) {\n\t      // The loop here is for keywords that apply\n\t      // to every alternate; these have a == 0.\n\t      if (a >= 'A') {\n\t        ialt = alts[a-'A'+1];\n\t        if (ialt < 0) break;\n\t      }\n\t      gotone = 1;\n\t\n\t      if (vptr) {\n\t        if (sipflag) {\n\t          // Translate a SIP keyword into DPja.\n\t          struct disprm *disp = (*wcs)->lin.dispre;\n\t          int ipx = (disp->ndp)++;\n\t\n\t          // SIP doesn't have alternates.\n\t\t  char keyword[16];\n\t          sprintf(keyword, \"DP%d\", i);\n\t          sprintf(strtmp, \"SIP.%s.%d_%d\", (sipflag==2)?\"FWD\":\"REV\",\n\t                  p, q);\n\t          if (valtype == INTEGER) {\n\t            dpfill(disp->dp+ipx, keyword, strtmp, i, 0, inttmp, 0.0);\n\t          } else {\n\t            dpfill(disp->dp+ipx, keyword, strtmp, i, 1, 0, dbltmp);\n\t          }\n\t\n\t        } else if (dssflag) {\n\t          // All DSS keywords require special handling.\n\t          if (dssflag == 1) {\n\t            // Temporary parameter for DSS used by wcspih_final().\n\t            *((double *)vptr) = dbltmp;\n\t\n\t          } else if (dssflag == 2) {\n\t            // Temporary parameter for DSS used by wcspih_final().\n\t            strcpy((char *)vptr, strtmp);\n\t\n\t          } else {\n\t            // Translate a DSS keyword into DQia.\n\t            if (m <= 13 || dbltmp != 0.0) {\n\t              struct disprm *disp = (*wcs)->lin.disseq;\n\t              int ipx = (disp->ndp)++;\n\t\n\t              // DSS doesn't have alternates.\n\t\t      char keyword[16];\n\t              sprintf(keyword, \"DQ%d\", i);\n\t              sprintf(strtmp, \"DSS.AMD.%d\", m);\n\t              dpfill(disp->dp+ipx, keyword, strtmp, i, 1, 0, dbltmp);\n\t\n\t              // Also required by wcspih_final().\n\t              if (m <= 3) {\n\t                dsstmp[13+(i-1)*3+m] = dbltmp;\n\t              }\n\t            }\n\t          }\n\t\n\t        } else if (watflag) {\n\t          // String array for TNX and ZPX used by wcspih_final().\n\t          strcpy((char *)vptr, strtmp);\n\t\n\t        } else {\n\t          // An \"ordinary\" keyword.\n\t          struct wcsprm *wcsp = *wcs + ialt;\n\t\t  struct disprm *disp;\n\t          void *wptr;\n\t          ptrdiff_t voff;\n\t          if (auxprm) {\n\t            // Additional auxiliary parameter.\n\t            struct auxprm *auxp = wcsp->aux;\n\t            voff = (char *)vptr - (char *)(&auxtem);\n\t            wptr = (void *)((char *)auxp + voff);\n\t\n\t          } else if (distype) {\n\t            // Distortion parameter of some kind.\n\t            if (distype == PRIOR) {\n\t              // Prior distortion.\n\t              disp = wcsp->lin.dispre;\n\t            } else {\n\t              // Sequent distortion.\n\t              disp = wcsp->lin.disseq;\n\t            }\n\t            voff = (char *)vptr - (char *)(&distem);\n\t            wptr = (void *)((char *)disp + voff);\n\t\n\t          } else {\n\t            // A parameter that lives directly in wcsprm.\n\t            voff = (char *)vptr - (char *)(&wcstem);\n\t            wptr = (void *)((char *)wcsp + voff);\n\t          }\n\t\n\t          if (valtype == INTEGER) {\n\t            *((int *)wptr) = inttmp;\n\t\n\t          } else if (valtype == FLOAT) {\n\t            // Apply keyword parameterization.\n\t            if (npptr == npv) {\n\t              int ipx = (wcsp->npv)++;\n\t              wcsp->pv[ipx].i = i;\n\t              wcsp->pv[ipx].m = m;\n\t              wptr = &(wcsp->pv[ipx].value);\n\t\n\t            } else if (j) {\n\t              wptr = *((double **)wptr) + (i - 1)*(wcsp->naxis)\n\t                                        + (j - 1);\n\t\n\t            } else if (i) {\n\t              wptr = *((double **)wptr) + (i - 1);\n\t            }\n\t\n\t            if (special) {\n\t              special(wptr, &dbltmp);\n\t            } else {\n\t              *((double *)wptr) = dbltmp;\n\t            }\n\t\n\t            // Flag presence of PCi_ja, or CDi_ja and/or CROTAia.\n\t            if (altlin) {\n\t              wcsp->altlin |= altlin;\n\t              altlin = 0;\n\t            }\n\t\n\t          } else if (valtype == FLOAT2) {\n\t            // Split MJDREF and JDREF into integer and fraction.\n\t            if (special) {\n\t              special(wptr, dbl2tmp);\n\t            } else {\n\t              *((double *)wptr) = dbl2tmp[0];\n\t              *((double *)wptr + 1) = dbl2tmp[1];\n\t            }\n\t\n\t          } else if (valtype == STRING) {\n\t            // Apply keyword parameterization.\n\t            if (npptr == nps) {\n\t              int ipx = (wcsp->nps)++;\n\t              wcsp->ps[ipx].i = i;\n\t              wcsp->ps[ipx].m = m;\n\t              wptr = wcsp->ps[ipx].value;\n\t\n\t            } else if (j) {\n\t              wptr = *((char (**)[72])wptr) +\n\t                      (i - 1)*(wcsp->naxis) + (j - 1);\n\t\n\t            } else if (i) {\n\t              wptr = *((char (**)[72])wptr) + (i - 1);\n\t            }\n\t\n\t            char *cptr = (char *)wptr;\n\t            strcpy(cptr, strtmp);\n\t\n\t          } else if (valtype == RECORD) {\n\t            int ipx = (disp->ndp)++;\n\t\n\t\t    char keyword[16];\n\t            if (a == ' ') {\n\t              sprintf(keyword, \"%.2s%d\", keyname, i);\n\t            } else {\n\t              sprintf(keyword, \"%.2s%d%c\", keyname, i, a);\n\t            }\n\t\n\t            dpfill(disp->dp+ipx, keyword, strtmp, i, rectype, inttmp,\n\t                   dbltmp);\n\t          }\n\t        }\n\t      }\n\t\n\t      if (a) break;\n\t    }\n\t\n\t    if (gotone) {\n\t      nvalid++;\n\t      if (ctrl == 4) {\n\t        if (distran || dssflag) {\n\t          wcsfprintf(stderr, \"%.80s\\n  Accepted (%d) as a \"\n\t            \"recognized WCS convention.\\n\", keyrec, nvalid);\n\t        } else {\n\t          wcsfprintf(stderr, \"%.80s\\n  Accepted (%d) as a \"\n\t            \"valid WCS keyrecord.\\n\", keyrec, nvalid);\n\t        }\n\t      }\n\t\n\t      BEGIN(FLUSH);\n\t\n\t    } else {\n\t      errmsg = \"syntactically valid WCS keyrecord has no effect\";\n\t      BEGIN(ERROR);\n\t    }\n\t\n\t  } else {\n\t    BEGIN(FLUSH);\n\t  }\n\t}\n\n<COMMENT>.*\" \"*\\/.*$ {\n\t  errmsg = \"invalid keyvalue\";\n\t  BEGIN(ERROR);\n\t}\n\n<COMMENT>[^ \\/\\n]*{INLINE}$ {\n\t  errmsg = \"invalid keyvalue\";\n\t  BEGIN(ERROR);\n\t}\n\n<COMMENT>\" \"+[^\\/\\n].*{INLINE}$ {\n\t  errmsg = \"invalid keyvalue or malformed keycomment\";\n\t  BEGIN(ERROR);\n\t}\n\n<COMMENT>.*$ {\n\t  errmsg = \"malformed keycomment\";\n\t  BEGIN(ERROR);\n\t}\n\n<DISCARD>.*$ {\n\t  if (ipass == npass) {\n\t    if (ctrl < 0) {\n\t      // Preserve discards.\n\t      keep = keyrec;\n\t\n\t    } else if (2 < ctrl) {\n\t      nother++;\n\t      wcsfprintf(stderr, \"%.80s\\n  Not a recognized WCS keyword.\\n\",\n\t        keyrec);\n\t    }\n\t  }\n\t  BEGIN(FLUSH);\n\t}\n\n<ERROR>.*$ {\n\t  if (ipass == npass) {\n\t    (*nreject)++;\n\t\n\t    if (ctrl%10 == -1) {\n\t      // Preserve rejects.\n\t      keep = keyrec;\n\t    }\n\t\n\t    if (1 < abs(ctrl%10)) {\n\t      wcsfprintf(stderr, \"%.80s\\n  Rejected (%d), %s.\\n\",\n\t        keyrec, *nreject, errmsg);\n\t    }\n\t  }\n\t  BEGIN(FLUSH);\n\t}\n\n<FLUSH>.*\\n {\n\t  if (ipass == npass && keep) {\n\t    if (hptr < keep) {\n\t      strncpy(hptr, keep, 80);\n\t    }\n\t    hptr += 80;\n\t  }\n\t\n\t  naux += auxprm;\n\t\n\t  // Throw away the rest of the line and reset for the next one.\n\t  i = j = 0;\n\t  m = 0;\n\t  a = ' ';\n\t\n\t  keyrec += 80;\n\t\n\t  valtype = -1;\n\t  distype =  0;\n\t  vptr    = 0x0;\n\t  keep    = 0x0;\n\t\n\t  altlin  = 0;\n\t  npptr   = 0x0;\n\t  chekval = 0x0;\n\t  special = 0x0;\n\t  auxprm  = 0;\n\t  sipflag = 0;\n\t  dssflag = 0;\n\t  watflag = 0;\n\t\n\t  BEGIN(INITIAL);\n\t}\n\n<<EOF>>\t {\n\t  // End-of-input.\n\t  int status;\n\t  if (ipass == 1) {\n\t    if ((status = wcspih_init1(naxis, alts, dpq, npv, nps, ndp, ndq,\n\t                               naux, distran, nwcs, wcs)) ||\n\t        (*nwcs == 0 && ctrl == 0)) {\n\t      return status;\n\t    }\n\t\n\t    if (2 < abs(ctrl%10)) {\n\t      if (*nwcs == 1) {\n\t        if (strcmp(wcs[0]->wcsname, \"DEFAULTS\") != 0) {\n\t          wcsfprintf(stderr, \"Found one coordinate representation.\\n\");\n\t        }\n\t      } else {\n\t        wcsfprintf(stderr, \"Found %d coordinate representations.\\n\",\n\t          *nwcs);\n\t      }\n\t    }\n\t\n\t    watstr = calloc(2*(watn*68 + 1), sizeof(char));\n\t    wat[0] = watstr;\n\t    wat[1] = watstr + watn*68 + 1;\n\t  }\n\t\n\t  if (ipass++ < npass) {\n\t    yyextra->hdr = header;\n\t    yyextra->nkeyrec = nkeyrec;\n\t    keyrec = header;\n\t    *nreject = 0;\n\t\n\t    i = j = 0;\n\t    m = 0;\n\t    a = ' ';\n\t\n\t    valtype = -1;\n\t    distype =  0;\n\t    vptr    = 0x0;\n\t\n\t    altlin  = 0;\n\t    npptr   = 0x0;\n\t    chekval = 0x0;\n\t    special = 0x0;\n\t    auxprm  = 0;\n\t    sipflag = 0;\n\t    dssflag = 0;\n\t    watflag = 0;\n\t\n\t    yyrestart(yyin, yyscanner);\n\t\n\t  } else {\n\t\n\t    if (ctrl < 0) {\n\t      *hptr = '\\0';\n\t    } else if (ctrl == 1) {\n\t      wcsfprintf(stderr, \"%d WCS keyrecord%s rejected.\\n\",\n\t        *nreject, (*nreject==1)?\" was\":\"s were\");\n\t    } else if (ctrl == 4) {\n\t      wcsfprintf(stderr, \"\\n\");\n\t      wcsfprintf(stderr, \"%5d keyrecord%s rejected for syntax or \"\n\t        \"other errors,\\n\", *nreject, (*nreject==1)?\" was\":\"s were\");\n\t      wcsfprintf(stderr, \"%5d %s recognized as syntactically valid, \"\n\t        \"and\\n\", nvalid, (nvalid==1)?\"was\":\"were\");\n\t      wcsfprintf(stderr, \"%5d other%s were not recognized as WCS \"\n\t        \"keyrecords.\\n\", nother, (nother==1)?\"\":\"s\");\n\t    }\n\t\n\t    status = wcspih_final(ndp, ndq, distran, dsstmp, wat, nwcs, wcs);\n\t    free(watstr);\n\t    return status;\n\t  }\n\t}\n\n%%\n\n/*----------------------------------------------------------------------------\n* External interface to the scanner.\n*---------------------------------------------------------------------------*/\n\nint wcspih(\n  char *header,\n  int nkeyrec,\n  int relax,\n  int ctrl,\n  int *nreject,\n  int *nwcs,\n  struct wcsprm **wcs)\n\n{\n  // Function prototypes.\n  int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner);\n  int yylex_destroy(yyscan_t yyscanner);\n\n  struct wcspih_extra extra;\n  yyscan_t yyscanner;\n  yylex_init_extra(&extra, &yyscanner);\n  int status = wcspih_scanner(header, nkeyrec, relax, ctrl, nreject, nwcs,\n                              wcs, yyscanner);\n  yylex_destroy(yyscanner);\n\n  return status;\n}\n\n\n/*----------------------------------------------------------------------------\n* Determine the number of coordinate representations (up to 27) and the\n* number of coordinate axes in each, which distortions are present, and the\n* number of PVi_ma, PSi_ma, DPja, and DQia keywords in each representation.\n*---------------------------------------------------------------------------*/\n\nvoid wcspih_pass1(\n  int naxis,\n  int i,\n  int j,\n  char a,\n  int distype,\n  int alts[],\n  int dpq[],\n  int *npptr)\n\n{\n  // On the first pass alts[] is used to determine the number of axes\n  // for each of the 27 possible alternate coordinate descriptions.\n  if (a == 0) {\n    return;\n  }\n\n  int ialt = 0;\n  if (a != ' ') {\n    ialt = a - 'A' + 1;\n  }\n\n  int *ip = alts + ialt;\n\n  if (*ip < naxis) {\n    *ip = naxis;\n  }\n\n  // i or j can be greater than naxis.\n  if (*ip < i) {\n    *ip = i;\n  }\n\n  if (*ip < j) {\n    *ip = j;\n  }\n\n  // Type of distortions present.\n  dpq[ialt] |= distype;\n\n  // Count PVi_ma, PSi_ma, DPja, or DQia keywords.\n  if (npptr) {\n    npptr[ialt]++;\n  }\n}\n\n\n/*----------------------------------------------------------------------------\n* Allocate memory for an array of the required number of wcsprm structs and\n* initialize each of them.\n*---------------------------------------------------------------------------*/\n\nint wcspih_init1(\n  int naxis,\n  int alts[],\n  int dpq[],\n  int npv[],\n  int nps[],\n  int ndp[],\n  int ndq[],\n  int naux,\n  int distran,\n  int *nwcs,\n  struct wcsprm **wcs)\n\n{\n  int status = 0;\n\n  // Find the number of coordinate descriptions.\n  *nwcs = 0;\n  for (int ialt = 0; ialt < 27; ialt++) {\n    if (alts[ialt]) (*nwcs)++;\n  }\n\n  int defaults;\n  if ((defaults = !(*nwcs) && naxis)) {\n    // NAXIS is non-zero but there were no WCS keywords with an alternate\n    // version code; create a default WCS with blank alternate version.\n    wcspih_pass1(naxis, 0, 0, ' ', 0, alts, dpq, 0x0);\n    *nwcs = 1;\n  }\n\n  if (*nwcs) {\n    // Allocate memory for the required number of wcsprm structs.\n    if ((*wcs = calloc(*nwcs, sizeof(struct wcsprm))) == 0x0) {\n      return WCSHDRERR_MEMORY;\n    }\n\n    int ndis = 0;\n    if (distran == SIP) {\n      // DPja.NAXES and DPja.OFFSET.j to be added for SIP (see below and\n      // wcspih_final()).\n      ndp[0] += 6;\n\n    } else if (distran == DSS) {\n      // DPja.NAXES to be added for DSS (see below and wcspih_final()).\n      ndq[0] += 2;\n    }\n\n    // Initialize each wcsprm struct.\n    struct wcsprm *wcsp = *wcs;\n    *nwcs = 0;\n    for (int ialt = 0; ialt < 27; ialt++) {\n      if (alts[ialt]) {\n        wcsp->flag = -1;\n        int npvmax = npv[ialt];\n        int npsmax = nps[ialt];\n        if ((status = wcsinit(1, alts[ialt], wcsp, npvmax, npsmax, -1))) {\n          wcsvfree(nwcs, wcs);\n          break;\n        }\n\n        // Record the alternate version code.\n        if (ialt) {\n          wcsp->alt[0] = 'A' + ialt - 1;\n        }\n\n        // Record in wcsname whether this is a default description.\n        if (defaults) {\n          strcpy(wcsp->wcsname, \"DEFAULTS\");\n        }\n\n        // Any additional auxiliary keywords present?\n        if (naux) {\n          if (wcsauxi(1, wcsp)) {\n            return WCSHDRERR_MEMORY;\n          }\n        }\n\n        // Any distortions present?\n        struct disprm *disp;\n        if (dpq[ialt] & 1) {\n          if ((disp = calloc(1, sizeof(struct disprm))) == 0x0) {\n            return WCSHDRERR_MEMORY;\n          }\n\n          // Attach it to linprm.  Also inits it.\n          ndis++;\n          int ndpmax = ndp[ialt];\n          disp->flag = -1;\n          lindist(1, &(wcsp->lin), disp, ndpmax);\n        }\n\n        if (dpq[ialt] & 2) {\n          if ((disp = calloc(1, sizeof(struct disprm))) == 0x0) {\n            return WCSHDRERR_MEMORY;\n          }\n\n          // Attach it to linprm.  Also inits it.\n          ndis++;\n          int ndpmax = ndq[ialt];\n          disp->flag = -1;\n          lindist(2, &(wcsp->lin), disp, ndpmax);\n        }\n\n        // On the second pass alts[] indexes the array of wcsprm structs.\n        alts[ialt] = (*nwcs)++;\n\n        wcsp++;\n\n      } else {\n        // Signal that there is no wcsprm for this alt.\n        alts[ialt] = -1;\n      }\n    }\n\n\n    // Translated distortion?  Neither SIP nor DSS have alternates, so the\n    // presence of keywords for either (not both together), as flagged by\n    // distran, necessarily refers to the primary representation.\n    if (distran == SIP) {\n      strcpy((*wcs)->lin.dispre->dtype[0], \"SIP\");\n      strcpy((*wcs)->lin.dispre->dtype[1], \"SIP\");\n\n      // SIP doesn't have axis mapping.\n      (*wcs)->lin.dispre->ndp = 6;\n      dpfill((*wcs)->lin.dispre->dp,   \"DP1\", \"NAXES\",  0, 0, 2, 0.0);\n      dpfill((*wcs)->lin.dispre->dp+3, \"DP2\", \"NAXES\",  0, 0, 2, 0.0);\n\n    } else if (distran == DSS) {\n      strcpy((*wcs)->lin.disseq->dtype[0], \"DSS\");\n      strcpy((*wcs)->lin.disseq->dtype[1], \"DSS\");\n\n      // The Paper IV translation of DSS doesn't require an axis mapping.\n      (*wcs)->lin.disseq->ndp = 2;\n      dpfill((*wcs)->lin.disseq->dp,   \"DQ1\", \"NAXES\",  0, 0, 2, 0.0);\n      dpfill((*wcs)->lin.disseq->dp+1, \"DQ2\", \"NAXES\",  0, 0, 2, 0.0);\n    }\n  }\n\n  return status;\n}\n\n\n/*----------------------------------------------------------------------------\n* Interpret the JDREF, JDREFI, and JDREFF keywords.\n*---------------------------------------------------------------------------*/\n\nint wcspih_jdref(double *mjdref, const double *jdref)\n\n{\n  // Set MJDREF from JDREF.\n  if (undefined(mjdref[0] && undefined(mjdref[1]))) {\n    mjdref[0] = jdref[0] - 2400000.0;\n    mjdref[1] = jdref[1] - 0.5;\n\n    if (mjdref[1] < 0.0) {\n      mjdref[0] -= 1.0;\n      mjdref[1] += 1.0;\n    }\n  }\n\n  return 0;\n}\n\nint wcspih_jdrefi(double *mjdref, const double *jdrefi)\n\n{\n  // Set the integer part of MJDREF from JDREFI.\n  if (undefined(mjdref[0])) {\n    mjdref[0] = *jdrefi - 2400000.5;\n  }\n\n  return 0;\n}\n\n\nint wcspih_jdreff(double *mjdref, const double *jdreff)\n\n{\n  // Set the fractional part of MJDREF from JDREFF.\n  if (undefined(mjdref[1])) {\n    mjdref[1] = *jdreff;\n  }\n\n  return 0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Interpret EPOCHa keywords.\n*---------------------------------------------------------------------------*/\n\nint wcspih_epoch(double *equinox, const double *epoch)\n\n{\n  // If EQUINOXa is currently undefined then set it from EPOCHa.\n  if (undefined(*equinox)) {\n    *equinox = *epoch;\n  }\n\n  return 0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Interpret VSOURCEa keywords.\n*---------------------------------------------------------------------------*/\n\nint wcspih_vsource(double *zsource, const double *vsource)\n\n{\n  const double c = 299792458.0;\n\n  // If ZSOURCEa is currently undefined then set it from VSOURCEa.\n  if (undefined(*zsource)) {\n    // Convert relativistic Doppler velocity to redshift.\n    double beta = *vsource/c;\n    *zsource = (1.0 + beta)/sqrt(1.0 - beta*beta) - 1.0;\n  }\n\n  return 0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Check validity of a TIMEPIXR keyvalue.\n*---------------------------------------------------------------------------*/\n\nint wcspih_timepixr(double timepixr)\n\n{\n  return (timepixr < 0.0 || 1.0 < timepixr);\n}\n\n\n/*----------------------------------------------------------------------------\n* Interpret special keywords encountered for each coordinate representation.\n*---------------------------------------------------------------------------*/\n\nint wcspih_final(\n  int ndp[],\n  int ndq[],\n  int distran,\n  double dsstmp[],\n  char *wat[],\n  int  *nwcs,\n  struct wcsprm **wcs)\n\n{\n  for (int ialt = 0; ialt < *nwcs; ialt++) {\n    // Interpret -TAB header keywords.\n    int status;\n    if ((status = wcstab(*wcs+ialt))) {\n       wcsvfree(nwcs, wcs);\n       return status;\n    }\n\n    if (ndp[ialt] && ndq[ialt]) {\n      // Prior and sequent distortions co-exist in this representation;\n      // ensure the latter gets DVERRa.\n      (*wcs+ialt)->lin.disseq->totdis = (*wcs+ialt)->lin.dispre->totdis;\n    }\n  }\n\n  // Translated distortion functions; apply only to the primary WCS.\n  struct wcsprm *wcsp = *wcs;\n  if (distran == SIP) {\n    // SIP doesn't have alternates, nor axis mapping.\n    struct disprm *disp = wcsp->lin.dispre;\n    dpfill(disp->dp+1, \"DP1\", \"OFFSET.1\",  0, 1, 0, wcsp->crpix[0]);\n    dpfill(disp->dp+2, \"DP1\", \"OFFSET.2\",  0, 1, 0, wcsp->crpix[1]);\n    dpfill(disp->dp+4, \"DP2\", \"OFFSET.1\",  0, 1, 0, wcsp->crpix[0]);\n    dpfill(disp->dp+5, \"DP2\", \"OFFSET.2\",  0, 1, 0, wcsp->crpix[1]);\n\n  } else if (distran == DSS) {\n    // DSS doesn't have alternates, nor axis mapping.  This translation\n    // follows Paper IV, Sect. 5.2 using the same variable names.\n    double CNPIX1 = dsstmp[0];\n    double CNPIX2 = dsstmp[1];\n\n    double Xc = dsstmp[2]/1000.0;\n    double Yc = dsstmp[3]/1000.0;\n    double Rx = dsstmp[4]/1000.0;\n    double Ry = dsstmp[5]/1000.0;\n\n    double A1 = dsstmp[14];\n    double A2 = dsstmp[15];\n    double A3 = dsstmp[16];\n    double B1 = dsstmp[17];\n    double B2 = dsstmp[18];\n    double B3 = dsstmp[19];\n    double S  = sqrt(fabs(A1*B1 - A2*B2));\n\n    double X0 = (A2*B3 - A3*B1) / (A1*B1 - A2*B2);\n    double Y0 = (A3*B2 - A1*B3) / (A1*B1 - A2*B2);\n\n    wcsp->crpix[0] = (Xc - X0)/Rx - (CNPIX1 - 0.5);\n    wcsp->crpix[1] = (Yc + Y0)/Ry - (CNPIX2 - 0.5);\n\n    wcsp->pc[0] =  A1*Rx/S;\n    wcsp->pc[1] = -A2*Ry/S;\n    wcsp->pc[2] = -B2*Rx/S;\n    wcsp->pc[3] =  B1*Ry/S;\n    wcsp->altlin = 1;\n\n    wcsp->cdelt[0] = -S/3600.0;\n    wcsp->cdelt[1] =  S/3600.0;\n\n    double *crval = wcsp->crval;\n    crval[0] = (dsstmp[6]  + (dsstmp[7]  + dsstmp[8] /60.0)/60.0)*15.0;\n    crval[1] =  dsstmp[10] + (dsstmp[11] + dsstmp[12]/60.0)/60.0;\n    if (dsstmp[9] == -1.0) crval[1] *= -1.0;\n\n    strcpy(wcsp->ctype[0], \"RA---TAN\");\n    strcpy(wcsp->ctype[1], \"DEC--TAN\");\n\n    sprintf(wcsp->wcsname, \"DSS PLATEID %.4s\", (char *)(dsstmp+13));\n\n    // Erase the approximate WCS provided in modern DSS headers.\n    wcsp->cd[0] = 0.0;\n    wcsp->cd[1] = 0.0;\n    wcsp->cd[2] = 0.0;\n    wcsp->cd[3] = 0.0;\n\n  } else if (distran == WAT) {\n    // TNX and ZPX don't have alternates, nor axis mapping.\n    char *wp;\n    int  omax, omin, wctrl[4];\n    double wval;\n    struct disprm *disp = wcsp->lin.disseq;\n\n    // Disassemble the core dump stored in the WATi_m strings.\n    int i, nterms = 0;\n    for (i = 0; i < 2; i++) {\n      char wtype[8];\n      sscanf(wat[i], \"wtype=%s\", wtype);\n\n      if (strcmp(wtype, \"tnx\") == 0) {\n        strcpy(disp->dtype[i], \"WAT-TNX\");\n      } else if (strcmp(wtype, \"zpx\") == 0) {\n        strcpy(disp->dtype[i], \"WAT-ZPX\");\n      } else {\n        // Could contain \"tan\" or something else to be ignored.\n        lindist(2, &(wcsp->lin), 0x0, 0);\n        return 0;\n      }\n\n      // The PROJPn parameters are duplicated on each ZPX axis.\n      if (i == 1 && strcmp(wtype, \"zpx\") == 0) {\n        // Take those on the second (latitude) axis ignoring the other.\n        // First we have to count them and allocate space in wcsprm.\n        wp = wat[i];\n\tint npv;\n        for (npv = 0; npv < 30; npv++) {\n          if ((wp = strstr(wp, \"projp\")) == 0x0) break;\n          wp += 5;\n        }\n\n        // Allocate space.\n        if (npv) {\n          wcsp->npvmax += npv;\n          wcsp->pv = realloc(wcsp->pv, wcsp->npvmax*sizeof(struct pvcard));\n          if (wcsp->pv == 0x0) {\n            return WCSHDRERR_MEMORY;\n          }\n\n          wcsp->m_pv = wcsp->pv;\n        }\n\n        // Copy the values.\n        wp = wat[i];\n        for (int ipv = wcsp->npv; ipv < wcsp->npvmax; ipv++) {\n          if ((wp = strstr(wp, \"projp\")) == 0x0) break;\n\n          int m;\n          sscanf(wp, \"projp%d=%lf\", &m, &wval);\n          wcsp->pv[ipv].i = 2;\n          wcsp->pv[ipv].m = m;\n          wcsp->pv[ipv].value = wval;\n\n          wp += 5;\n        }\n\n        wcsp->npv += npv;\n      }\n\n      // Read the control parameters.\n      if ((wp = strchr(wat[i], '\"')) == 0x0) {\n        return WCSHDRERR_PARSER;\n      }\n      wp++;\n\n      for (int m = 0; m < 4; m++) {\n        sscanf(wp, \"%d\", wctrl+m);\n        if ((wp = strchr(wp, ' ')) == 0x0) {\n          return WCSHDRERR_PARSER;\n        }\n        wp++;\n      }\n\n      // How many coefficients are we expecting?\n      omin = (wctrl[1] < wctrl[2]) ? wctrl[1] : wctrl[2];\n      omax = (wctrl[1] < wctrl[2]) ? wctrl[2] : wctrl[1];\n      if (wctrl[3] == 0) {\n        // No cross terms.\n        nterms += omin + omax;\n\n      } else if (wctrl[3] == 1) {\n        // Full cross terms.\n        nterms += omin*omax;\n\n      } else if (wctrl[3] == 2) {\n        // Half cross terms.\n        nterms += omin*omax - omin*(omin-1)/2;\n      }\n    }\n\n    // Allocate memory for dpkeys.\n    ndq[0] += 2*(1 + 1 + 4) + nterms;\n\n    disp->ndpmax += ndq[0];\n    disp->dp = realloc(disp->dp, disp->ndpmax*sizeof(struct dpkey));\n    if (disp->dp == 0x0) {\n      return WCSHDRERR_MEMORY;\n    }\n\n    disp->m_dp = disp->dp;\n\n\n    // Populate dpkeys.\n    int idp = disp->ndp;\n    for (i = 0; i < 2; i++) {\n      dpfill(disp->dp+(idp++), \"DQ\", \"NAXES\", i+1, 0, 2, 0.0);\n\n      // Read the control parameters.\n      if ((wp = strchr(wat[i], '\"')) == 0x0) {\n        return WCSHDRERR_PARSER;\n      }\n      wp++;\n\n      for (int m = 0; m < 4; m++) {\n        sscanf(wp, \"%d\", wctrl+m);\n        if ((wp = strchr(wp, ' ')) == 0x0) {\n          return WCSHDRERR_PARSER;\n        }\n        wp++;\n      }\n\n      // Polynomial type.\n      char wpoly[12];\n      dpfill(disp->dp+(idp++), \"DQ\", \"WAT.POLY\", i+1, 0, wctrl[0], 0.0);\n      if (wctrl[0] == 1) {\n        // Chebyshev polynomial.\n        strcpy(wpoly, \"CHBY\");\n      } else if (wctrl[0] == 2) {\n        // Legendre polynomial.\n        strcpy(wpoly, \"LEGR\");\n      } else if (wctrl[0] == 3) {\n        // Polynomial is the sum of monomials.\n        strcpy(wpoly, \"MONO\");\n      } else {\n        // Unknown code.\n        strcpy(wpoly, \"UNKN\");\n      }\n\n      // Read the scaling parameters.\n      char field[40];\n      for (int m = 0; m < 4; m++) {\n        sscanf(wp, \"%lf\", &wval);\n        sprintf(field, \"WAT.%c%s\", (m<2)?'X':'Y', (m%2)?\"MAX\":\"MIN\");\n        dpfill(disp->dp+(idp++), \"DQ\", field, i+1, 1, 0, wval);\n\n        if ((wp = strchr(wp, ' ')) == 0x0) {\n          return WCSHDRERR_PARSER;\n        }\n        wp++;\n      }\n\n      // Read the coefficients.\n      for (int n = 0; n < wctrl[2]; n++) {\n        for (int m = 0; m < wctrl[1]; m++) {\n          if (wctrl[3] == 0) {\n            if (m && n) continue;\n          } else if (wctrl[3] == 2) {\n            if (m+n > omax-1) continue;\n          }\n\n          sscanf(wp, \"%lf\", &wval);\n          if (wval == 0.0) continue;\n\n          sprintf(field, \"WAT.%s.%d_%d\", wpoly, m, n);\n          dpfill(disp->dp+(idp++), \"DQ\", field, i+1, 1, 0, wval);\n\n          if ((wp = strchr(wp, ' ')) == 0x0) {\n            return WCSHDRERR_PARSER;\n          }\n          wp++;\n        }\n      }\n    }\n\n    disp->ndp = idp;\n  }\n\n  return 0;\n}\n"},{"col":4,"comment":"null","endLoc":184,"header":"def __repr__(self)","id":16577,"name":"__repr__","nodeType":"Function","startLoc":181,"text":"def __repr__(self):\n        s = f'<CoordinatesMap with {len(self._coords)} world coordinates:\\n\\n'\n        table = indent(str(self._as_table()), '  ')\n        return s + table + '\\n\\n>'"},{"attributeType":"null","col":8,"comment":"null","endLoc":50,"id":16578,"name":"_transform","nodeType":"Attribute","startLoc":50,"text":"self._transform"},{"attributeType":"null","col":8,"comment":"null","endLoc":56,"id":16579,"name":"_aliases","nodeType":"Attribute","startLoc":56,"text":"self._aliases"},{"attributeType":"WCSAxes","col":8,"comment":"null","endLoc":49,"id":16580,"name":"_axes","nodeType":"Attribute","startLoc":49,"text":"self._axes"},{"id":16581,"name":"prj.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: prj.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the prj routines\n* ---------------------------\n* Routines in this suite  implement the spherical map projections defined by\n* the FITS World Coordinate System (WCS) standard, as described in\n*\n=   \"Representations of world coordinates in FITS\",\n=   Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (WCS Paper I)\n=\n=   \"Representations of celestial coordinates in FITS\",\n=   Calabretta, M.R., & Greisen, E.W. 2002, A&A, 395, 1077 (WCS Paper II)\n=\n=   \"Mapping on the HEALPix grid\",\n=   Calabretta, M.R., & Roukema, B.F. 2007, MNRAS, 381, 865 (WCS Paper V)\n=\n=   \"Representing the 'Butterfly' Projection in FITS -- Projection Code XPH\",\n=   Calabretta, M.R., & Lowe, S.R. 2013, PASA, 30, e050 (WCS Paper VI)\n*\n* These routines are based on the prjprm struct which contains all information\n* needed for the computations.  The struct contains some members that must be\n* set by the user, and others that are maintained by these routines, somewhat\n* like a C++ class but with no encapsulation.\n*\n* Routine prjini() is provided to initialize the prjprm struct with default\n* values, prjfree() reclaims any memory that may have been allocated to store\n* an error message, prjsize() computes its total size including allocated\n* memory, and prjprt() prints its contents.\n*\n* prjperr() prints the error message(s) (if any) stored in a prjprm struct.\n* prjbchk() performs bounds checking on native spherical coordinates.\n*\n* Setup routines for each projection with names of the form ???set(), where\n* \"???\" is the down-cased three-letter projection code, compute intermediate\n* values in the prjprm struct from parameters in it that were supplied by the\n* user.  The struct always needs to be set by the projection's setup routine\n* but that need not be called explicitly - refer to the explanation of\n* prjprm::flag.\n*\n* Each map projection is implemented via separate functions for the spherical\n* projection, ???s2x(), and deprojection, ???x2s().\n*\n* A set of driver routines, prjset(), prjx2s(), and prjs2x(), provides a\n* generic interface to the specific projection routines which they invoke\n* via pointers-to-functions stored in the prjprm struct.\n*\n* In summary, the routines are:\n*   - prjini()                Initialization routine for the prjprm struct.\n*   - prjfree()               Reclaim memory allocated for error messages.\n*   - prjsize()               Compute total size of a prjprm struct.\n*   - prjprt()                Print a prjprm struct.\n*   - prjperr()               Print error message (if any).\n*   - prjbchk()               Bounds checking on native coordinates.\n*\n*   - prjset(), prjx2s(), prjs2x():   Generic driver routines\n*\n*   - azpset(), azpx2s(), azps2x():   AZP (zenithal/azimuthal perspective)\n*   - szpset(), szpx2s(), szps2x():   SZP (slant zenithal perspective)\n*   - tanset(), tanx2s(), tans2x():   TAN (gnomonic)\n*   - stgset(), stgx2s(), stgs2x():   STG (stereographic)\n*   - sinset(), sinx2s(), sins2x():   SIN (orthographic/synthesis)\n*   - arcset(), arcx2s(), arcs2x():   ARC (zenithal/azimuthal equidistant)\n*   - zpnset(), zpnx2s(), zpns2x():   ZPN (zenithal/azimuthal polynomial)\n*   - zeaset(), zeax2s(), zeas2x():   ZEA (zenithal/azimuthal equal area)\n*   - airset(), airx2s(), airs2x():   AIR (Airy)\n*   - cypset(), cypx2s(), cyps2x():   CYP (cylindrical perspective)\n*   - ceaset(), ceax2s(), ceas2x():   CEA (cylindrical equal area)\n*   - carset(), carx2s(), cars2x():   CAR (Plate carree)\n*   - merset(), merx2s(), mers2x():   MER (Mercator)\n*   - sflset(), sflx2s(), sfls2x():   SFL (Sanson-Flamsteed)\n*   - parset(), parx2s(), pars2x():   PAR (parabolic)\n*   - molset(), molx2s(), mols2x():   MOL (Mollweide)\n*   - aitset(), aitx2s(), aits2x():   AIT (Hammer-Aitoff)\n*   - copset(), copx2s(), cops2x():   COP (conic perspective)\n*   - coeset(), coex2s(), coes2x():   COE (conic equal area)\n*   - codset(), codx2s(), cods2x():   COD (conic equidistant)\n*   - cooset(), coox2s(), coos2x():   COO (conic orthomorphic)\n*   - bonset(), bonx2s(), bons2x():   BON (Bonne)\n*   - pcoset(), pcox2s(), pcos2x():   PCO (polyconic)\n*   - tscset(), tscx2s(), tscs2x():   TSC (tangential spherical cube)\n*   - cscset(), cscx2s(), cscs2x():   CSC (COBE spherical cube)\n*   - qscset(), qscx2s(), qscs2x():   QSC (quadrilateralized spherical cube)\n*   - hpxset(), hpxx2s(), hpxs2x():   HPX (HEALPix)\n*   - xphset(), xphx2s(), xphs2x():   XPH (HEALPix polar, aka \"butterfly\")\n*\n* Argument checking (projection routines):\n* ----------------------------------------\n* The values of phi and theta (the native longitude and latitude) normally lie\n* in the range [-180,180] for phi, and [-90,90] for theta.  However, all\n* projection routines will accept any value of phi and will not normalize it.\n*\n* The projection routines do not explicitly check that theta lies within the\n* range [-90,90].  They do check for any value of theta that produces an\n* invalid argument to the projection equations (e.g. leading to division by\n* zero).  The projection routines for AZP, SZP, TAN, SIN, ZPN, and COP also\n* return error 2 if (phi,theta) corresponds to the overlapped (far) side of\n* the projection but also return the corresponding value of (x,y).  This\n* strict bounds checking may be relaxed at any time by setting\n* prjprm::bounds%2 to 0 (rather than 1); the projections need not be\n* reinitialized.\n*\n* Argument checking (deprojection routines):\n* ------------------------------------------\n* Error checking on the projected coordinates (x,y) is limited to that\n* required to ascertain whether a solution exists.  Where a solution does\n* exist, an optional check is made that the value of phi and theta obtained\n* lie within the ranges [-180,180] for phi, and [-90,90] for theta.  This\n* check, performed by prjbchk(), is enabled by default.  It may be disabled by\n* setting prjprm::bounds%4 to 0 (rather than 1); the projections need not be\n* reinitialized.\n*\n* Accuracy:\n* ---------\n* No warranty is given for the accuracy of these routines (refer to the\n* copyright notice); intending users must satisfy for themselves their\n* adequacy for the intended purpose.  However, closure to a precision of at\n* least 1E-10 degree of longitude and latitude has been verified for typical\n* projection parameters on the 1 degree graticule of native longitude and\n* latitude (to within 5 degrees of any latitude where the projection may\n* diverge).  Refer to the tprj1.c and tprj2.c test routines that accompany\n* this software.\n*\n*\n* prjini() - Default constructor for the prjprm struct\n* ----------------------------------------------------\n* prjini() sets all members of a prjprm struct to default values.  It should\n* be used to initialize every prjprm struct.\n*\n* PLEASE NOTE: If the prjprm struct has already been initialized, then before\n* reinitializing, it prjfree() should be used to free any memory that may have\n* been allocated to store an error message.  A memory leak may otherwise\n* result.\n*\n* Returned:\n*   prj       struct prjprm*\n*                       Projection parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null prjprm pointer passed.\n*\n*\n* prjfree() - Destructor for the prjprm struct\n* --------------------------------------------\n* prjfree() frees any memory that may have been allocated to store an error\n* message in the prjprm struct.\n*\n* Given:\n*   prj       struct prjprm*\n*                       Projection parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null prjprm pointer passed.\n*\n*\n* prjsize() - Compute the size of a prjprm struct\n* -----------------------------------------------\n* prjsize() computes the full size of a prjprm struct, including allocated\n* memory.\n*\n* Given:\n*   prj       const struct prjprm*\n*                       Projection parameters.\n*\n*                       If NULL, the base size of the struct and the allocated\n*                       size are both set to zero.\n*\n* Returned:\n*   sizes     int[2]    The first element is the base size of the struct as\n*                       returned by sizeof(struct prjprm).  The second element\n*                       is the total allocated size, in bytes.  This figure\n*                       includes memory allocated for the constituent struct,\n*                       prjprm::err.\n*\n*                       It is not an error for the struct not to have been set\n*                       up via prjset().\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*\n*\n* prjprt() - Print routine for the prjprm struct\n* ----------------------------------------------\n* prjprt() prints the contents of a prjprm struct using wcsprintf().  Mainly\n* intended for diagnostic purposes.\n*\n* Given:\n*   prj       const struct prjprm*\n*                       Projection parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null prjprm pointer passed.\n*\n*\n* prjperr() - Print error messages from a prjprm struct\n* -----------------------------------------------------\n* prjperr() prints the error message(s) (if any) stored in a prjprm struct.\n* If there are no errors then nothing is printed.  It uses wcserr_prt(), q.v.\n*\n* Given:\n*   prj       const struct prjprm*\n*                       Projection parameters.\n*\n*   prefix    const char *\n*                       If non-NULL, each output line will be prefixed with\n*                       this string.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null prjprm pointer passed.\n*\n*\n* prjbchk() - Bounds checking on native coordinates\n* -------------------------------------------------\n* prjbchk() performs bounds checking on native spherical coordinates.  As\n* returned by the deprojection (x2s) routines, native longitude is expected\n* to lie in the closed interval [-180,180], with latitude in [-90,90].\n*\n* A tolerance may be specified to provide a small allowance for numerical\n* imprecision.  Values that lie outside the allowed range by not more than\n* the specified tolerance will be adjusted back into range.\n*\n* If prjprm::bounds&4 is set, as it is by prjini(), then prjbchk() will be\n* invoked automatically by the Cartesian-to-spherical deprojection (x2s)\n* routines with an appropriate tolerance set for each projection.\n*\n* Given:\n*   tol       double    Tolerance for the bounds check [deg].\n*\n*   nphi,\n*   ntheta    int       Vector lengths.\n*\n*   spt       int       Vector stride.\n*\n* Given and returned:\n*   phi,theta double[]  Native longitude and latitude (phi,theta) [deg].\n*\n* Returned:\n*   stat      int[]     Status value for each vector element:\n*                         0: Valid value of (phi,theta).\n*                         1: Invalid value.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: One or more of the (phi,theta) coordinates\n*                            were, invalid, as indicated by the stat vector.\n*\n*\n* prjset() - Generic setup routine for the prjprm struct\n* ------------------------------------------------------\n* prjset() sets up a prjprm struct according to information supplied within\n* it.\n*\n* Note that this routine need not be called directly; it will be invoked by\n* prjx2s() and prjs2x() if prj.flag is anything other than a predefined magic\n* value.\n*\n* The one important distinction between prjset() and the setup routines for\n* the specific projections is that the projection code must be defined in the\n* prjprm struct in order for prjset() to identify the required projection.\n* Once prjset() has initialized the prjprm struct, prjx2s() and prjs2x() use\n* the pointers to the specific projection and deprojection routines contained\n* therein.\n*\n* Given and returned:\n*   prj       struct prjprm*\n*                       Projection parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null prjprm pointer passed.\n*                         2: Invalid projection parameters.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       prjprm::err if enabled, see wcserr_enable().\n*\n*\n* prjx2s() - Generic Cartesian-to-spherical deprojection\n* ------------------------------------------------------\n* Deproject Cartesian (x,y) coordinates in the plane of projection to native\n* spherical coordinates (phi,theta).\n*\n* The projection is that specified by prjprm::code.\n*\n* Given and returned:\n*   prj       struct prjprm*\n*                       Projection parameters.\n*\n* Given:\n*   nx,ny     int       Vector lengths.\n*\n*   sxy,spt   int       Vector strides.\n*\n*   x,y       const double[]\n*                       Projected coordinates.\n*\n* Returned:\n*   phi,theta double[]  Longitude and latitude (phi,theta) of the projected\n*                       point in native spherical coordinates [deg].\n*\n*   stat      int[]     Status value for each vector element:\n*                         0: Success.\n*                         1: Invalid value of (x,y).\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null prjprm pointer passed.\n*                         2: Invalid projection parameters.\n*                         3: One or more of the (x,y) coordinates were\n*                            invalid, as indicated by the stat vector.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       prjprm::err if enabled, see wcserr_enable().\n*\n*\n* prjs2x() - Generic spherical-to-Cartesian projection\n* ----------------------------------------------------\n* Project native spherical coordinates (phi,theta) to Cartesian (x,y)\n* coordinates in the plane of projection.\n*\n* The projection is that specified by prjprm::code.\n*\n* Given and returned:\n*   prj       struct prjprm*\n*                       Projection parameters.\n*\n* Given:\n*   nphi,\n*   ntheta    int       Vector lengths.\n*\n*   spt,sxy   int       Vector strides.\n*\n*   phi,theta const double[]\n*                       Longitude and latitude (phi,theta) of the projected\n*                       point in native spherical coordinates [deg].\n*\n* Returned:\n*   x,y       double[]  Projected coordinates.\n*\n*   stat      int[]     Status value for each vector element:\n*                         0: Success.\n*                         1: Invalid value of (phi,theta).\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null prjprm pointer passed.\n*                         2: Invalid projection parameters.\n*                         4: One or more of the (phi,theta) coordinates\n*                            were, invalid, as indicated by the stat vector.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       prjprm::err if enabled, see wcserr_enable().\n*\n*\n* ???set() - Specific setup routines for the prjprm struct\n* --------------------------------------------------------\n* Set up a prjprm struct for a particular projection according to information\n* supplied within it.\n*\n* Given and returned:\n*   prj       struct prjprm*\n*                       Projection parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null prjprm pointer passed.\n*                         2: Invalid projection parameters.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       prjprm::err if enabled, see wcserr_enable().\n*\n*\n* ???x2s() - Specific Cartesian-to-spherical deprojection routines\n* ----------------------------------------------------------------\n* Transform (x,y) coordinates in the plane of projection to native spherical\n* coordinates (phi,theta).\n*\n* Given and returned:\n*   prj       struct prjprm*\n*                       Projection parameters.\n*\n* Given:\n*   nx,ny     int       Vector lengths.\n*\n*   sxy,spt   int       Vector strides.\n*\n*   x,y       const double[]\n*                       Projected coordinates.\n*\n* Returned:\n*   phi,theta double[]  Longitude and latitude of the projected point in\n*                       native spherical coordinates [deg].\n*\n*   stat      int[]     Status value for each vector element:\n*                         0: Success.\n*                         1: Invalid value of (x,y).\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null prjprm pointer passed.\n*                         2: Invalid projection parameters.\n*                         3: One or more of the (x,y) coordinates were\n*                            invalid, as indicated by the stat vector.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       prjprm::err if enabled, see wcserr_enable().\n*\n*\n* ???s2x() - Specific spherical-to-Cartesian projection routines\n*---------------------------------------------------------------\n* Transform native spherical coordinates (phi,theta) to (x,y) coordinates in\n* the plane of projection.\n*\n* Given and returned:\n*   prj       struct prjprm*\n*                       Projection parameters.\n*\n* Given:\n*   nphi,\n*   ntheta    int       Vector lengths.\n*\n*   spt,sxy   int       Vector strides.\n*\n*   phi,theta const double[]\n*                       Longitude and latitude of the projected point in\n*                       native spherical coordinates [deg].\n*\n* Returned:\n*   x,y       double[]  Projected coordinates.\n*\n*   stat      int[]     Status value for each vector element:\n*                         0: Success.\n*                         1: Invalid value of (phi,theta).\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null prjprm pointer passed.\n*                         2: Invalid projection parameters.\n*                         4: One or more of the (phi,theta) coordinates\n*                            were, invalid, as indicated by the stat vector.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       prjprm::err if enabled, see wcserr_enable().\n*\n*\n* prjprm struct - Projection parameters\n* -------------------------------------\n* The prjprm struct contains all information needed to project or deproject\n* native spherical coordinates.  It consists of certain members that must be\n* set by the user (\"given\") and others that are set by the WCSLIB routines\n* (\"returned\").  Some of the latter are supplied for informational purposes\n* while others are for internal use only.\n*\n*   int flag\n*     (Given and returned) This flag must be set to zero whenever any of the\n*     following prjprm struct members are set or changed:\n*\n*       - prjprm::code,\n*       - prjprm::r0,\n*       - prjprm::pv[],\n*       - prjprm::phi0,\n*       - prjprm::theta0.\n*\n*     This signals the initialization routine (prjset() or ???set()) to\n*     recompute the returned members of the prjprm struct.  flag will then be\n*     reset to indicate that this has been done.\n*\n*     Note that flag need not be reset when prjprm::bounds is changed.\n*\n*   char code[4]\n*     (Given) Three-letter projection code defined by the FITS standard.\n*\n*   double r0\n*     (Given) The radius of the generating sphere for the projection, a linear\n*     scaling parameter.  If this is zero, it will be reset to its default\n*     value of 180/pi (the value for FITS WCS).\n*\n*   double pv[30]\n*     (Given) Projection parameters.  These correspond to the PVi_ma keywords\n*     in FITS, so pv[0] is PVi_0a, pv[1] is PVi_1a, etc., where i denotes the\n*     latitude-like axis.  Many projections use pv[1] (PVi_1a), some also use\n*     pv[2] (PVi_2a) and SZP uses pv[3] (PVi_3a).  ZPN is currently the only\n*     projection that uses any of the others.\n*\n*     Usage of the pv[] array as it applies to each projection is described in\n*     the prologue to each trio of projection routines in prj.c.\n*\n*   double phi0\n*     (Given) The native longitude, phi_0 [deg], and ...\n*   double theta0\n*     (Given) ... the native latitude, theta_0 [deg], of the reference point,\n*     i.e. the point (x,y) = (0,0).  If undefined (set to a magic value by\n*     prjini()) the initialization routine will set this to a\n*     projection-specific default.\n*\n*   int bounds\n*     (Given) Controls bounds checking.  If bounds&1 then enable strict bounds\n*     checking for the spherical-to-Cartesian (s2x) transformation for the\n*     AZP, SZP, TAN, SIN, ZPN, and COP projections.  If bounds&2 then enable\n*     strict bounds checking for the Cartesian-to-spherical transformation\n*     (x2s) for the HPX and XPH projections.  If bounds&4 then the Cartesian-\n*     to-spherical transformations (x2s) will invoke prjbchk() to perform\n*     bounds checking on the computed native coordinates, with a tolerance set\n*     to suit each projection.  bounds is set to 7 by prjini() by default\n*     which enables all checks.  Zero it to disable all checking.\n*\n*     It is not necessary to reset the prjprm struct (via prjset() or\n*     ???set()) when prjprm::bounds is changed.\n*\n* The remaining members of the prjprm struct are maintained by the setup\n* routines and must not be modified elsewhere:\n*\n*   char name[40]\n*     (Returned) Long name of the projection.\n*\n*     Provided for information only, not used by the projection routines.\n*\n*   int  category\n*     (Returned) Projection category matching the value of the relevant global\n*     variable:\n*\n*     - ZENITHAL,\n*     - CYLINDRICAL,\n*     - PSEUDOCYLINDRICAL,\n*     - CONVENTIONAL,\n*     - CONIC,\n*     - POLYCONIC,\n*     - QUADCUBE, and\n*     - HEALPIX.\n*\n*     The category name may be identified via the prj_categories character\n*     array, e.g.\n*\n=       struct prjprm prj;\n=         ...\n=       printf(\"%s\\n\", prj_categories[prj.category]);\n*\n*     Provided for information only, not used by the projection routines.\n*\n*   int  pvrange\n*     (Returned) Range of projection parameter indices: 100 times the first\n*     allowed index plus the number of parameters, e.g. TAN is 0 (no\n*     parameters), SZP is 103 (1 to 3), and ZPN is 30 (0 to 29).\n*\n*     Provided for information only, not used by the projection routines.\n*\n*   int  simplezen\n*     (Returned) True if the projection is a radially-symmetric zenithal\n*     projection.\n*\n*     Provided for information only, not used by the projection routines.\n*\n*   int  equiareal\n*     (Returned) True if the projection is equal area.\n*\n*     Provided for information only, not used by the projection routines.\n*\n*   int  conformal\n*     (Returned) True if the projection is conformal.\n*\n*     Provided for information only, not used by the projection routines.\n*\n*   int  global\n*     (Returned) True if the projection can represent the whole sphere in a\n*     finite, non-overlapped mapping.\n*\n*     Provided for information only, not used by the projection routines.\n*\n*   int  divergent\n*     (Returned) True if the projection diverges in latitude.\n*\n*     Provided for information only, not used by the projection routines.\n*\n*   double x0\n*     (Returned) The offset in x, and ...\n*   double y0\n*     (Returned) ... the offset in y used to force (x,y) = (0,0) at\n*     (phi_0,theta_0).\n*\n*   struct wcserr *err\n*     (Returned) If enabled, when an error status is returned, this struct\n*     contains detailed information about the error, see wcserr_enable().\n*\n*   void *padding\n*     (An unused variable inserted for alignment purposes only.)\n*\n*   double w[10]\n*     (Returned) Intermediate floating-point values derived from the\n*     projection parameters, cached here to save recomputation.\n*\n*     Usage of the w[] array as it applies to each projection is described in\n*     the prologue to each trio of projection routines in prj.c.\n*\n*   int n\n*     (Returned) Intermediate integer value (used only for the ZPN and HPX\n*     projections).\n*\n*   int (*prjx2s)(PRJX2S_ARGS)\n*     (Returned) Pointer to the spherical projection ...\n*   int (*prjs2x)(PRJ_ARGS)\n*     (Returned) ... and deprojection routines.\n*\n*\n* Global variable: const char *prj_errmsg[] - Status return messages\n* ------------------------------------------------------------------\n* Error messages to match the status value returned from each function.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_PROJ\n#define WCSLIB_PROJ\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n// Total number of projection parameters; 0 to PVN-1.\n#define PVN 30\n\nextern const char *prj_errmsg[];\n\nenum prj_errmsg_enum {\n  PRJERR_SUCCESS      = 0,\t// Success.\n  PRJERR_NULL_POINTER = 1,\t// Null prjprm pointer passed.\n  PRJERR_BAD_PARAM    = 2,\t// Invalid projection parameters.\n  PRJERR_BAD_PIX      = 3,\t// One or more of the (x, y) coordinates were\n\t\t\t\t// invalid.\n  PRJERR_BAD_WORLD    = 4\t// One or more of the (phi, theta) coordinates\n\t\t\t\t// were invalid.\n};\n\nextern const int CONIC, CONVENTIONAL, CYLINDRICAL, POLYCONIC,\n                 PSEUDOCYLINDRICAL, QUADCUBE, ZENITHAL, HEALPIX;\nextern const char prj_categories[9][32];\n\nextern const int  prj_ncode;\nextern const char prj_codes[28][4];\n\n#ifdef PRJX2S_ARGS\n#undef PRJX2S_ARGS\n#endif\n\n#ifdef PRJS2X_ARGS\n#undef PRJS2X_ARGS\n#endif\n\n// For use in declaring deprojection function prototypes.\n#define PRJX2S_ARGS struct prjprm *prj, int nx, int ny, int sxy, int spt, \\\nconst double x[], const double y[], double phi[], double theta[], int stat[]\n\n// For use in declaring projection function prototypes.\n#define PRJS2X_ARGS struct prjprm *prj, int nx, int ny, int sxy, int spt, \\\nconst double phi[], const double theta[], double x[], double y[], int stat[]\n\n\nstruct prjprm {\n  // Initialization flag (see the prologue above).\n  //--------------------------------------------------------------------------\n  int    flag;\t\t\t// Set to zero to force initialization.\n\n  // Parameters to be provided (see the prologue above).\n  //--------------------------------------------------------------------------\n  char   code[4];\t\t// Three-letter projection code.\n  double r0;\t\t\t// Radius of the generating sphere.\n  double pv[PVN];\t\t// Projection parameters.\n  double phi0, theta0;\t\t// Fiducial native coordinates.\n  int    bounds;\t\t// Controls bounds checking.\n\n  // Information derived from the parameters supplied.\n  //--------------------------------------------------------------------------\n  char   name[40];\t\t// Projection name.\n  int    category;\t\t// Projection category.\n  int    pvrange;\t\t// Range of projection parameter indices.\n  int    simplezen;\t\t// Is it a simple zenithal projection?\n  int    equiareal;\t\t// Is it an equal area projection?\n  int    conformal;\t\t// Is it a conformal projection?\n  int    global;\t\t// Can it map the whole sphere?\n  int    divergent;\t\t// Does the projection diverge in latitude?\n  double x0, y0;\t\t// Fiducial offsets.\n\n  // Error handling\n  //--------------------------------------------------------------------------\n  struct wcserr *err;\n\n  // Private\n  //--------------------------------------------------------------------------\n  void   *padding;\t\t// (Dummy inserted for alignment purposes.)\n  double w[10];\t\t\t// Intermediate values.\n  int    m, n;\t\t\t// Intermediate values.\n\n  int (*prjx2s)(PRJX2S_ARGS);\t// Pointers to the spherical projection and\n  int (*prjs2x)(PRJS2X_ARGS);\t// deprojection functions.\n};\n\n// Size of the prjprm struct in int units, used by the Fortran wrappers.\n#define PRJLEN (sizeof(struct prjprm)/sizeof(int))\n\n\nint prjini(struct prjprm *prj);\n\nint prjfree(struct prjprm *prj);\n\nint prjsize(const struct prjprm *prj, int sizes[2]);\n\nint prjprt(const struct prjprm *prj);\n\nint prjperr(const struct prjprm *prj, const char *prefix);\n\nint prjbchk(double tol, int nphi, int ntheta, int spt, double phi[],\n            double theta[], int stat[]);\n\n// Use the preprocessor to help declare function prototypes (see above).\nint prjset(struct prjprm *prj);\nint prjx2s(PRJX2S_ARGS);\nint prjs2x(PRJS2X_ARGS);\n\nint azpset(struct prjprm *prj);\nint azpx2s(PRJX2S_ARGS);\nint azps2x(PRJS2X_ARGS);\n\nint szpset(struct prjprm *prj);\nint szpx2s(PRJX2S_ARGS);\nint szps2x(PRJS2X_ARGS);\n\nint tanset(struct prjprm *prj);\nint tanx2s(PRJX2S_ARGS);\nint tans2x(PRJS2X_ARGS);\n\nint stgset(struct prjprm *prj);\nint stgx2s(PRJX2S_ARGS);\nint stgs2x(PRJS2X_ARGS);\n\nint sinset(struct prjprm *prj);\nint sinx2s(PRJX2S_ARGS);\nint sins2x(PRJS2X_ARGS);\n\nint arcset(struct prjprm *prj);\nint arcx2s(PRJX2S_ARGS);\nint arcs2x(PRJS2X_ARGS);\n\nint zpnset(struct prjprm *prj);\nint zpnx2s(PRJX2S_ARGS);\nint zpns2x(PRJS2X_ARGS);\n\nint zeaset(struct prjprm *prj);\nint zeax2s(PRJX2S_ARGS);\nint zeas2x(PRJS2X_ARGS);\n\nint airset(struct prjprm *prj);\nint airx2s(PRJX2S_ARGS);\nint airs2x(PRJS2X_ARGS);\n\nint cypset(struct prjprm *prj);\nint cypx2s(PRJX2S_ARGS);\nint cyps2x(PRJS2X_ARGS);\n\nint ceaset(struct prjprm *prj);\nint ceax2s(PRJX2S_ARGS);\nint ceas2x(PRJS2X_ARGS);\n\nint carset(struct prjprm *prj);\nint carx2s(PRJX2S_ARGS);\nint cars2x(PRJS2X_ARGS);\n\nint merset(struct prjprm *prj);\nint merx2s(PRJX2S_ARGS);\nint mers2x(PRJS2X_ARGS);\n\nint sflset(struct prjprm *prj);\nint sflx2s(PRJX2S_ARGS);\nint sfls2x(PRJS2X_ARGS);\n\nint parset(struct prjprm *prj);\nint parx2s(PRJX2S_ARGS);\nint pars2x(PRJS2X_ARGS);\n\nint molset(struct prjprm *prj);\nint molx2s(PRJX2S_ARGS);\nint mols2x(PRJS2X_ARGS);\n\nint aitset(struct prjprm *prj);\nint aitx2s(PRJX2S_ARGS);\nint aits2x(PRJS2X_ARGS);\n\nint copset(struct prjprm *prj);\nint copx2s(PRJX2S_ARGS);\nint cops2x(PRJS2X_ARGS);\n\nint coeset(struct prjprm *prj);\nint coex2s(PRJX2S_ARGS);\nint coes2x(PRJS2X_ARGS);\n\nint codset(struct prjprm *prj);\nint codx2s(PRJX2S_ARGS);\nint cods2x(PRJS2X_ARGS);\n\nint cooset(struct prjprm *prj);\nint coox2s(PRJX2S_ARGS);\nint coos2x(PRJS2X_ARGS);\n\nint bonset(struct prjprm *prj);\nint bonx2s(PRJX2S_ARGS);\nint bons2x(PRJS2X_ARGS);\n\nint pcoset(struct prjprm *prj);\nint pcox2s(PRJX2S_ARGS);\nint pcos2x(PRJS2X_ARGS);\n\nint tscset(struct prjprm *prj);\nint tscx2s(PRJX2S_ARGS);\nint tscs2x(PRJS2X_ARGS);\n\nint cscset(struct prjprm *prj);\nint cscx2s(PRJX2S_ARGS);\nint cscs2x(PRJS2X_ARGS);\n\nint qscset(struct prjprm *prj);\nint qscx2s(PRJX2S_ARGS);\nint qscs2x(PRJS2X_ARGS);\n\nint hpxset(struct prjprm *prj);\nint hpxx2s(PRJX2S_ARGS);\nint hpxs2x(PRJS2X_ARGS);\n\nint xphset(struct prjprm *prj);\nint xphx2s(PRJX2S_ARGS);\nint xphs2x(PRJS2X_ARGS);\n\n\n// Deprecated.\n#define prjini_errmsg prj_errmsg\n#define prjprt_errmsg prj_errmsg\n#define prjset_errmsg prj_errmsg\n#define prjx2s_errmsg prj_errmsg\n#define prjs2x_errmsg prj_errmsg\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WCSLIB_PROJ\n"},{"id":16582,"name":"wcsunits.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsunits.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <math.h>\n\n#include \"wcsunits.h\"\n\n// Map status return value to message.\nconst char *wcsunits_errmsg[] = {\n  \"Success\",\n  \"Invalid numeric multiplier\",\n  \"Dangling binary operator\",\n  \"Invalid symbol in INITIAL context\",\n  \"Function in invalid context\",\n  \"Invalid symbol in EXPON context\",\n  \"Unbalanced bracket\",\n  \"Unbalanced parenthesis\",\n  \"Consecutive binary operators\",\n  \"Internal parser error\",\n  \"Non-conformant unit specifications\",\n  \"Non-conformant functions\",\n  \"Potentially unsafe translation\"};\n\n\n// Unit types.\nconst char *wcsunits_types[] = {\n  \"plane angle\",\n  \"solid angle\",\n  \"charge\",\n  \"mole\",\n  \"temperature\",\n  \"luminous intensity\",\n  \"mass\",\n  \"length\",\n  \"time\",\n  \"beam\",\n  \"bin\",\n  \"bit\",\n  \"count\",\n  \"stellar magnitude\",\n  \"pixel\",\n  \"solar ratio\",\n  \"voxel\"};\n\nconst char *wcsunits_units[] = {\n  \"degree\",\n  \"steradian\",\n  \"Coulomb\",\n  \"mole\",\n  \"Kelvin\",\n  \"candela\",\n  \"kilogram\",\n  \"metre\",\n  \"second\",\n  \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"};\n\nconst char *wcsunits_funcs[] = {\n  \"none\",\n  \"log\",\n  \"ln\",\n  \"exp\"};\n\n//----------------------------------------------------------------------------\n\nint wcsunits(\n  const char have[],\n  const char want[],\n  double *scale,\n  double *offset,\n  double *power)\n\n{\n  return wcsunitse(have, want, scale, offset, power, 0x0);\n}\n\n//----------------------------------------------------------------------------\n\nint wcsunitse(\n  const char have[],\n  const char want[],\n  double *scale,\n  double *offset,\n  double *power,\n  struct wcserr **err)\n\n{\n  static const char *function = \"wcsunitse\";\n\n  int status;\n\n  int    func1;\n  double scale1, units1[WCSUNITS_NTYPE];\n  if ((status = wcsulexe(have, &func1, &scale1, units1, err))) {\n    return status;\n  }\n\n  int    func2;\n  double scale2, units2[WCSUNITS_NTYPE];\n  if ((status = wcsulexe(want, &func2, &scale2, units2, err))) {\n    return status;\n  }\n\n  // Check conformance.\n  for (int i = 0; i < WCSUNITS_NTYPE; i++) {\n    if (units1[i] != units2[i]) {\n      return wcserr_set(WCSERR_SET(UNITSERR_BAD_UNIT_SPEC),\n        \"Mismatched units type '%s': have '%s', want '%s'\",\n        wcsunits_types[i], have, want);\n    }\n  }\n\n  *scale  = 0.0;\n  *offset = 0.0;\n  *power  = 1.0;\n\n  switch (func1) {\n  case 0:\n    // No function.\n    if (func2) {\n      return wcserr_set(WCSERR_SET(UNITSERR_BAD_FUNCS),\n        \"Mismatched unit functions: have '%s' (%s), want '%s' (%s)\",\n        have, wcsunits_funcs[func1], want, wcsunits_funcs[func2]);\n    }\n\n    *scale = scale1 / scale2;\n    break;\n\n  case 1:\n    // log().\n    if (func2 == 1) {\n      // log().\n      *scale  = 1.0;\n      *offset = log10(scale1 / scale2);\n\n    } else if (func2 == 2) {\n      // ln().\n      *scale  = log(10.0);\n      *offset = log(scale1 / scale2);\n\n    } else {\n      return wcserr_set(WCSERR_SET(UNITSERR_BAD_FUNCS),\n        \"Mismatched unit functions: have '%s' (%s), want '%s' (%s)\",\n        have, wcsunits_funcs[func1], want, wcsunits_funcs[func2]);\n    }\n\n    break;\n\n  case 2:\n    // ln().\n    if (func2 == 1) {\n      // log().\n      *scale  = 1.0 / log(10.0);\n      *offset = log(scale1 / scale2);\n\n    } else if (func2 == 2) {\n      // ln().\n      *scale  = 1.0;\n      *offset = log(scale1 / scale2);\n\n    } else {\n      return wcserr_set(WCSERR_SET(UNITSERR_BAD_FUNCS),\n        \"Mismatched unit functions: have '%s' (%s), want '%s' (%s)\",\n        have, wcsunits_funcs[func1], want, wcsunits_funcs[func2]);\n    }\n\n    break;\n\n  case 3:\n    // exp().\n    if (func2 != 3) {\n      return wcserr_set(WCSERR_SET(UNITSERR_BAD_FUNCS),\n        \"Mismatched unit functions: have '%s' (%s), want '%s' (%s)\",\n        have, wcsunits_funcs[func1], want, wcsunits_funcs[func2]);\n    }\n\n    *scale = 1.0;\n    *power = scale1 / scale2;\n    break;\n\n  default:\n    // Internal parser error.\n    return wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR),\n      \"Internal units parser error\");\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsutrn(int ctrl, char unitstr[])\n\n{\n  return wcsutrne(ctrl, unitstr, 0x0);\n}\n\n//----------------------------------------------------------------------------\n\nint wcsulex(\n  const char unitstr[],\n  int    *func,\n  double *scale,\n  double units[WCSUNITS_NTYPE])\n\n{\n  return wcsulexe(unitstr, func, scale, units, 0x0);\n}\n"},{"id":16583,"name":"wcsutil.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsutil.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the wcsutil routines\n* -------------------------------\n* Simple utility functions.  With the exception of wcsdealloc(), these\n* functions are intended for internal use only by WCSLIB.\n*\n* The internal-use functions are documented here solely as an aid to\n* understanding the code.  They are not intended for external use - the API\n* may change without notice!\n*\n*\n* wcsdealloc() - free memory allocated by WCSLIB functions\n* --------------------------------------------------------\n* wcsdealloc() invokes the free() system routine to free memory.\n* Specifically, it is intended to free memory allocated (using calloc()) by\n* certain WCSLIB functions (e.g. wcshdo(), wcsfixi(), fitshdr()), which it is\n* the user's responsibility to deallocate.\n*\n* In certain situations, for example multithreading, it may be important that\n* this be done within the WCSLIB sharable library's runtime environment.\n*\n* PLEASE NOTE: wcsdealloc() must not be used in place of the destructors for\n* particular structs, such as wcsfree(), celfree(), etc.\n*\n* Given and returned:\n*   ptr       void*     Address of the allocated memory.\n*\n* Function return value:\n*             void\n*\n*\n* wcsutil_strcvt() - Copy character string with padding\n* -----------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_strcvt() copies one character string to another up to the specified\n* maximum number of characters.\n*\n* If the given string is null-terminated, then the NULL character copied to\n* the returned string, and all characters following it up to the specified\n* maximum, are replaced with the specified substitute character, either blank\n* or NULL.\n*\n* If the source string is not null-terminated and the substitute character is\n* blank, then copy the maximum number of characters and do nothing further.\n* However, if the substitute character is NULL, then the last character and\n* all consecutive blank characters preceding it will be replaced with NULLs.\n*\n* Used by the Fortran wrapper functions in translating C strings into Fortran\n* CHARACTER variables and vice versa.\n*\n* Given:\n*   n         int       Maximum number of characters to copy.\n*\n*   c         char      Substitute character, either NULL or blank (anything\n*                       other than NULL).\n*\n*   nt        int       If true, then dst is of length n+1, with the last\n*                       character always set to NULL.\n*\n*   src       char[]    Character string to be copied.  If null-terminated,\n*                       then need not be of length n, otherwise it must be.\n*\n* Returned:\n*   dst       char[]    Destination character string, which must be long\n*                       enough to hold n characters.  Note that this string\n*                       will not be null-terminated if the substitute\n*                       character is blank.\n*\n* Function return value:\n*             void\n*\n*\n* wcsutil_blank_fill() - Fill a character string with blanks\n* ----------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_blank_fill() pads a character sub-string with blanks starting with\n* the terminating NULL character (if any).\n*\n* Given:\n*   n         int       Length of the sub-string.\n*\n* Given and returned:\n*   c         char[]    The character sub-string, which will not be\n*                       null-terminated on return.\n*\n* Function return value:\n*             void\n*\n*\n* wcsutil_null_fill() - Fill a character string with NULLs\n* --------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_null_fill() strips trailing blanks from a string (or sub-string) and\n* propagates the terminating NULL character (if any) to the end of the string.\n*\n* If the string is not null-terminated, then the last character and all\n* consecutive blank characters preceding it will be replaced with NULLs.\n*\n* Mainly used in the C library to strip trailing blanks from FITS keyvalues.\n* Also used to make character strings intelligible in the GNU debugger, which\n* prints the rubbish following the terminating NULL character, thereby\n* obscuring the valid part of the string.\n*\n* Given:\n*   n         int       Number of characters.\n*\n* Given and returned:\n*   c         char[]    The character (sub-)string.\n*\n* Function return value:\n*             void\n*\n*\n* wcsutil_all_ival() - Test if all elements an int array have a given value\n* -------------------------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_all_ival() tests whether all elements of an array of type int all\n* have the specified value.\n*\n* Given:\n*   nelem     int       The length of the array.\n*\n*   ival      int       Value to be tested.\n*\n*   iarr      const int[]\n*                       Pointer to the first element of the array.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Not all equal.\n*                         1: All equal.\n*\n*\n* wcsutil_all_dval() - Test if all elements a double array have a given value\n* ---------------------------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_all_dval() tests whether all elements of an array of type double all\n* have the specified value.\n*\n* Given:\n*   nelem     int       The length of the array.\n*\n*   dval      int       Value to be tested.\n*\n*   darr      const double[]\n*                       Pointer to the first element of the array.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Not all equal.\n*                         1: All equal.\n*\n*\n* wcsutil_all_sval() - Test if all elements a string array have a given value\n* ---------------------------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_all_sval() tests whether the elements of an array of type\n* char (*)[72] all have the specified value.\n*\n* Given:\n*   nelem     int       The length of the array.\n*\n*   sval      const char *\n*                       String to be tested.\n*\n*   sarr      const char (*)[72]\n*                       Pointer to the first element of the array.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Not all equal.\n*                         1: All equal.\n*\n*\n* wcsutil_allEq() - Test for equality of a particular vector element\n* ------------------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_allEq() tests for equality of a particular element in a set of\n* vectors.\n*\n* Given:\n*   nvec      int       The number of vectors.\n*\n*   nelem     int       The length of each vector.\n*\n*   first     const double*\n*                       Pointer to the first element to test in the array.\n*                       The elements tested for equality are\n*\n=                         *first == *(first + nelem)\n=                                == *(first + nelem*2)\n=                                           :\n=                                == *(first + nelem*(nvec-1));\n*\n*                       The array might be dimensioned as\n*\n=                         double v[nvec][nelem];\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Not all equal.\n*                         1: All equal.\n*\n*\n* wcsutil_dblEq() - Test for equality of two arrays of type double\n* ----------------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_dblEq() tests for equality of two double-precision arrays.\n*\n* Given:\n*   nelem     int       The number of elements in each array.\n*\n*   tol       double    Tolerance for comparison of the floating-point values.\n*                       For example, for tol == 1e-6, all floating-point\n*                       values in the arrays must be equal to the first 6\n*                       decimal places.  A value of 0 implies exact equality.\n*\n*   arr1      const double*\n*                       The first array.\n*\n*   arr2      const double*\n*                       The second array\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Not equal.\n*                         1: Equal.\n*\n*\n* wcsutil_intEq() - Test for equality of two arrays of type int\n* -------------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_intEq() tests for equality of two int arrays.\n*\n* Given:\n*   nelem     int       The number of elements in each array.\n*\n*   arr1      const int*\n*                       The first array.\n*\n*   arr2      const int*\n*                       The second array\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Not equal.\n*                         1: Equal.\n*\n*\n* wcsutil_strEq() - Test for equality of two string arrays\n* --------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_strEq() tests for equality of two string arrays.\n*\n* Given:\n*   nelem     int       The number of elements in each array.\n*\n*   arr1      const char**\n*                       The first array.\n*\n*   arr2      const char**\n*                       The second array\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Not equal.\n*                         1: Equal.\n*\n*\n* wcsutil_setAll() - Set a particular vector element\n* --------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_setAll() sets the value of a particular element in a set of vectors\n* of type double.\n*\n* Given:\n*   nvec      int       The number of vectors.\n*\n*   nelem     int       The length of each vector.\n*\n* Given and returned:\n*   first     double*   Pointer to the first element in the array, the value\n*                       of which is used to set the others\n*\n=                         *(first + nelem) = *first;\n=                         *(first + nelem*2) = *first;\n=                                 :\n=                         *(first + nelem*(nvec-1)) = *first;\n*\n*                       The array might be dimensioned as\n*\n=                         double v[nvec][nelem];\n*\n* Function return value:\n*             void\n*\n*\n* wcsutil_setAli() - Set a particular vector element\n* --------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_setAli() sets the value of a particular element in a set of vectors\n* of type int.\n*\n* Given:\n*   nvec      int       The number of vectors.\n*\n*   nelem     int       The length of each vector.\n*\n* Given and returned:\n*   first     int*      Pointer to the first element in the array, the value\n*                       of which is used to set the others\n*\n=                         *(first + nelem) = *first;\n=                         *(first + nelem*2) = *first;\n=                                 :\n=                         *(first + nelem*(nvec-1)) = *first;\n*\n*                       The array might be dimensioned as\n*\n=                         int v[nvec][nelem];\n*\n* Function return value:\n*             void\n*\n*\n* wcsutil_setBit() - Set bits in selected elements of an array\n* ------------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_setBit() sets bits in selected elements of an array.\n*\n* Given:\n*   nelem     int       Number of elements in the array.\n*\n*   sel       const int*\n*                       Address of a selection array of length nelem.  May\n*                       be specified as the null pointer in which case all\n*                       elements are selected.\n*\n*   bits      int       Bit mask.\n*\n* Given and returned:\n*   array     int*      Address of the array of length nelem.\n*\n* Function return value:\n*             void\n*\n*\n* wcsutil_fptr2str() - Translate pointer-to-function to string\n* ------------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_fptr2str() translates a pointer-to-function to hexadecimal string\n* representation for output.  It is used by the various routines that print\n* the contents of WCSLIB structs, noting that it is not strictly legal to\n* type-pun a function pointer to void*.  See\n* http://stackoverflow.com/questions/2741683/how-to-format-a-function-pointer\n*\n* Given:\n*   fptr      void(*)() Pointer to function.\n*\n* Returned:\n*   hext      char[19]  Null-terminated string.  Should be at least 19 bytes\n*                       in size to accomodate a 64-bit address (16 bytes in\n*                       hex), plus the leading \"0x\" and trailing '\\0'.\n*\n* Function return value:\n*             char *    The address of hext.\n*\n*\n* wcsutil_double2str() - Translate double to string ignoring the locale\n* ---------------------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_double2str() converts a double to a string, but unlike sprintf() it\n* ignores the locale and always uses a '.' as the decimal separator.  Also,\n* unless it includes an exponent, the formatted value will always have a\n* fractional part, \".0\" being appended if necessary.\n*\n* Returned:\n*   buf       char *    The buffer to write the string into.\n*\n* Given:\n*   format    char *    The formatting directive, such as \"%f\".  This\n*                       may be any of the forms accepted by sprintf(), but\n*                       should only include a formatting directive and\n*                       nothing else.  For \"%g\" and \"%G\" formats, unless it\n*                       includes an exponent, the formatted value will always\n*                       have a fractional part, \".0\" being appended if\n*                       necessary.\n*\n*   value     double    The value to convert to a string.\n*\n*\n* wcsutil_str2double() - Translate string to a double, ignoring the locale\n* ------------------------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_str2double() converts a string to a double, but unlike sscanf() it\n* ignores the locale and always expects a '.' as the decimal separator.\n*\n* Given:\n*   buf       char *    The string containing the value\n*\n* Returned:\n*   value     double *  The double value parsed from the string.\n*\n*\n* wcsutil_str2double2() - Translate string to doubles, ignoring the locale\n* ------------------------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_str2double2() converts a string to a pair of doubles containing the\n* integer and fractional parts.  Unlike sscanf() it ignores the locale and\n* always expects a '.' as the decimal separator.\n*\n* Given:\n*   buf       char *    The string containing the value\n*\n* Returned:\n*   value     double[2] The double value, split into integer and fractional\n*                       parts, parsed from the string.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_WCSUTIL\n#define WCSLIB_WCSUTIL\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nvoid wcsdealloc(void *ptr);\n\nvoid wcsutil_strcvt(int n, char c, int nt, const char src[], char dst[]);\n\nvoid wcsutil_blank_fill(int n, char c[]);\nvoid wcsutil_null_fill (int n, char c[]);\n\nint  wcsutil_all_ival(int nelem, int ival, const int iarr[]);\nint  wcsutil_all_dval(int nelem, double dval, const double darr[]);\nint  wcsutil_all_sval(int nelem, const char *sval, const char (*sarr)[72]);\nint  wcsutil_allEq (int nvec, int nelem, const double *first);\n\nint  wcsutil_dblEq(int nelem, double tol, const double *arr1,\n                   const double *arr2);\nint  wcsutil_intEq(int nelem, const int *arr1, const int *arr2);\nint  wcsutil_strEq(int nelem, char (*arr1)[72], char (*arr2)[72]);\nvoid wcsutil_setAll(int nvec, int nelem, double *first);\nvoid wcsutil_setAli(int nvec, int nelem, int *first);\nvoid wcsutil_setBit(int nelem, const int *sel, int bits, int *array);\nchar *wcsutil_fptr2str(void (*fptr)(void), char hext[19]);\nvoid wcsutil_double2str(char *buf, const char *format, double value);\nint  wcsutil_str2double(const char *buf, double *value);\nint  wcsutil_str2double2(const char *buf, double *value);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WCSLIB_WCSUTIL\n"},{"id":16584,"name":"tab.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: tab.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"wcserr.h\"\n#include \"wcsmath.h\"\n#include \"wcsprintf.h\"\n#include \"wcsutil.h\"\n#include \"tab.h\"\n\nconst int TABSET = 137;\n\n// Map status return value to message.\nconst char *tab_errmsg[] = {\n  \"Success\",\n  \"Null tabprm pointer passed\",\n  \"Memory allocation failed\",\n  \"Invalid tabular parameters\",\n  \"One or more of the x coordinates were invalid\",\n  \"One or more of the world coordinates were invalid\"};\n\n// Convenience macro for invoking wcserr_set().\n#define TAB_ERRMSG(status) WCSERR_SET(status), tab_errmsg[status]\n\n//----------------------------------------------------------------------------\n\nint tabini(int alloc, int M, const int K[], struct tabprm *tab)\n\n{\n  static const char *function = \"tabini\";\n\n  if (tab == 0x0) return TABERR_NULL_POINTER;\n\n  // Initialize error message handling.\n  if (tab->flag == -1) {\n    tab->err = 0x0;\n  }\n  struct wcserr **err = &(tab->err);\n  wcserr_clear(err);\n\n\n  if (M <= 0) {\n    return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS),\n      \"M must be positive, got %d\", M);\n  }\n\n  // Determine the total number of elements in the coordinate array.\n  int N;\n  if (K) {\n    N = M;\n\n    for (int m = 0; m < M; m++) {\n      if (K[m] < 0) {\n        return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS),\n          \"Invalid tabular parameters: Each element of K must be \"\n          \"non-negative, got %d\", K[m]);\n      }\n\n      N *= K[m];\n    }\n\n  } else {\n    // Axis lengths as yet unknown.\n    N = 0;\n  }\n\n\n  // Initialize memory management.\n  if (tab->flag == -1 || tab->m_flag != TABSET) {\n    if (tab->flag == -1) {\n      tab->sense   = 0x0;\n      tab->p0      = 0x0;\n      tab->delta   = 0x0;\n      tab->extrema = 0x0;\n      tab->set_M   = 0;\n    }\n\n    tab->m_flag  = 0;\n    tab->m_M     = 0;\n    tab->m_N     = 0;\n    tab->m_K     = 0x0;\n    tab->m_map   = 0x0;\n    tab->m_crval = 0x0;\n    tab->m_index = 0x0;\n    tab->m_indxs = 0x0;\n    tab->m_coord = 0x0;\n\n  } else {\n    // Clear any outstanding signals set by wcstab().\n    for (int m = 0; m < tab->m_M; m++) {\n      if (tab->m_indxs[m] == (double *)0x1) tab->m_indxs[m] = 0x0;\n    }\n\n    if (tab->m_coord == (double *)0x1) tab->m_coord = 0x0;\n  }\n\n\n  // Allocate memory for arrays if required.\n  if (alloc ||\n     tab->K == 0x0 ||\n     tab->map == 0x0 ||\n     tab->crval == 0x0 ||\n     tab->index == 0x0 ||\n     tab->coord == 0x0) {\n\n    // Was sufficient allocated previously?\n    if (tab->m_flag == TABSET && (tab->m_M < M || tab->m_N < N)) {\n      // No, free it.\n      tabfree(tab);\n    }\n\n    if (alloc || tab->K == 0x0) {\n      if (tab->m_K) {\n        // In case the caller fiddled with it.\n        tab->K = tab->m_K;\n\n      } else {\n        if (!(tab->K = calloc(M, sizeof(int)))) {\n          return wcserr_set(TAB_ERRMSG(TABERR_MEMORY));\n        }\n\n        tab->m_flag = TABSET;\n        tab->m_M = M;\n        tab->m_K = tab->K;\n      }\n    }\n\n    if (alloc || tab->map == 0x0) {\n      if (tab->m_map) {\n        // In case the caller fiddled with it.\n        tab->map = tab->m_map;\n\n      } else {\n        if (!(tab->map = calloc(M, sizeof(int)))) {\n          return wcserr_set(TAB_ERRMSG(TABERR_MEMORY));\n        }\n\n        tab->m_flag = TABSET;\n        tab->m_M = M;\n        tab->m_map = tab->map;\n      }\n    }\n\n    if (alloc || tab->crval == 0x0) {\n      if (tab->m_crval) {\n        // In case the caller fiddled with it.\n        tab->crval = tab->m_crval;\n\n      } else {\n        if (!(tab->crval = calloc(M, sizeof(double)))) {\n          return wcserr_set(TAB_ERRMSG(TABERR_MEMORY));\n        }\n\n        tab->m_flag = TABSET;\n        tab->m_M = M;\n        tab->m_crval = tab->crval;\n      }\n    }\n\n    if (alloc || tab->index == 0x0) {\n      if (tab->m_index) {\n        // In case the caller fiddled with it.\n        tab->index = tab->m_index;\n\n      } else {\n        if (!(tab->index = calloc(M, sizeof(double *)))) {\n          return wcserr_set(TAB_ERRMSG(TABERR_MEMORY));\n        }\n\n        tab->m_flag = TABSET;\n        tab->m_M = M;\n        tab->m_N = N;\n        tab->m_index = tab->index;\n\n        if (!(tab->m_indxs = calloc(M, sizeof(double *)))) {\n          return wcserr_set(TAB_ERRMSG(TABERR_MEMORY));\n        }\n\n        // Recall that calloc() initializes these pointers to zero.\n        if (K) {\n          for (int m = 0; m < M; m++) {\n            if (K[m]) {\n              if (!(tab->index[m] = calloc(K[m], sizeof(double)))) {\n                return wcserr_set(TAB_ERRMSG(TABERR_MEMORY));\n              }\n\n              tab->m_indxs[m] = tab->index[m];\n            }\n          }\n        }\n      }\n    }\n\n    if (alloc || tab->coord == 0x0) {\n      if (tab->m_coord) {\n        // In case the caller fiddled with it.\n        tab->coord = tab->m_coord;\n\n      } else if (N) {\n        if (!(tab->coord = calloc(N, sizeof(double)))) {\n          return wcserr_set(TAB_ERRMSG(TABERR_MEMORY));\n        }\n\n        tab->m_flag = TABSET;\n        tab->m_M = M;\n        tab->m_N = N;\n        tab->m_coord = tab->coord;\n      }\n    }\n  }\n\n  tab->flag = 0;\n  tab->M = M;\n\n  // Set defaults.\n  for (int m = 0; m < M; m++) {\n    tab->map[m] = -1;\n    tab->crval[m] = 0.0;\n\n    if (K) {\n      tab->K[m] = K[m];\n      double *dp;\n      if ((dp = tab->index[m])) {\n        for (int k = 0; k < K[m]; k++) {\n          *(dp++) = k;\n        }\n      }\n    } else {\n      tab->K[m] = 0;\n    }\n  }\n\n  // Initialize the coordinate array.\n  for (double *dp = tab->coord; dp < tab->coord + N; dp++) {\n    *dp = UNDEFINED;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tabmem(struct tabprm *tab)\n\n{\n  static const char *function = \"tabmem\";\n\n  if (tab == 0x0) return TABERR_NULL_POINTER;\n  struct wcserr **err = &(tab->err);\n\n  if (tab->M == 0 || tab->K == 0x0) {\n    // Should have been set by this time.\n    return wcserr_set(WCSERR_SET(TABERR_MEMORY),\n      \"Null pointers in tabprm struct\");\n  }\n\n\n  int M = tab->M;\n  int N = tab->M;\n  for (int m = 0; m < M; m++) {\n    if (tab->K[m] < 0) {\n      return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS),\n        \"Invalid tabular parameters: Each element of K must be \"\n        \"non-negative, got %d\", M);\n    }\n\n    N *= tab->K[m];\n  }\n\n\n  if (tab->m_M == 0) {\n    tab->m_M = M;\n  } else if (tab->m_M < M) {\n    // Only possible if the user changed M.\n    return wcserr_set(WCSERR_SET(TABERR_MEMORY),\n      \"tabprm struct inconsistent\");\n  }\n\n  if (tab->m_N == 0) {\n    tab->m_N = N;\n  } else if (tab->m_N < N) {\n    // Only possible if the user changed K[].\n    return wcserr_set(WCSERR_SET(TABERR_MEMORY),\n      \"tabprm struct inconsistent\");\n  }\n\n  if (tab->m_K == 0x0) {\n    if ((tab->m_K = tab->K)) {\n      tab->m_flag = TABSET;\n    }\n  }\n\n  if (tab->m_map == 0x0) {\n    if ((tab->m_map = tab->map)) {\n      tab->m_flag = TABSET;\n    }\n  }\n\n  if (tab->m_crval == 0x0) {\n    if ((tab->m_crval = tab->crval)) {\n      tab->m_flag = TABSET;\n    }\n  }\n\n  if (tab->m_index == 0x0) {\n    if ((tab->m_index = tab->index)) {\n      tab->m_flag = TABSET;\n    }\n  }\n\n  for (int m = 0; m < tab->m_M; m++) {\n    if (tab->m_indxs[m] == 0x0 || tab->m_indxs[m] == (double *)0x1) {\n      if ((tab->m_indxs[m] = tab->index[m])) {\n        tab->m_flag = TABSET;\n      }\n    }\n  }\n\n  if (tab->m_coord == 0x0 || tab->m_coord == (double *)0x1) {\n    if ((tab->m_coord = tab->coord)) {\n      tab->m_flag = TABSET;\n    }\n  }\n\n  tab->flag = 0;\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tabcpy(int alloc, const struct tabprm *tabsrc, struct tabprm *tabdst)\n\n{\n  static const char *function = \"tabcpy\";\n\n  int status;\n\n  if (tabsrc == 0x0) return TABERR_NULL_POINTER;\n  if (tabdst == 0x0) return TABERR_NULL_POINTER;\n  struct wcserr **err = &(tabdst->err);\n\n  int M = tabsrc->M;\n  if (M <= 0) {\n    return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS),\n      \"M must be positive, got %d\", M);\n  }\n\n  if ((status = tabini(alloc, M, tabsrc->K, tabdst))) {\n    return status;\n  }\n\n  int N = M;\n  for (int m = 0; m < M; m++) {\n    tabdst->map[m]   = tabsrc->map[m];\n    tabdst->crval[m] = tabsrc->crval[m];\n    N *= tabsrc->K[m];\n  }\n\n  double *dstp, *srcp;\n  for (int m = 0; m < M; m++) {\n    if ((srcp = tabsrc->index[m])) {\n      dstp = tabdst->index[m];\n      for (int k = 0; k < tabsrc->K[m]; k++) {\n        *(dstp++) = *(srcp++);\n      }\n    }\n  }\n\n  srcp = tabsrc->coord;\n  dstp = tabdst->coord;\n  for (int n = 0; n < N; n++) {\n    *(dstp++) = *(srcp++);\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tabcmp(\n  int dummy,\n  double tol,\n  const struct tabprm *tab1,\n  const struct tabprm *tab2,\n  int *equal)\n\n{\n  // Avert nuisance compiler warnings about unused parameters.\n  (void)dummy;\n\n  if (tab1  == 0x0) return TABERR_NULL_POINTER;\n  if (tab2  == 0x0) return TABERR_NULL_POINTER;\n  if (equal == 0x0) return TABERR_NULL_POINTER;\n\n  *equal = 0;\n\n  if (tab1->M != tab2->M) {\n    return 0;\n  }\n\n  int M = tab1->M;\n\n  if (!wcsutil_intEq(M, tab1->K, tab2->K) ||\n      !wcsutil_intEq(M, tab1->map, tab2->map) ||\n      !wcsutil_dblEq(M, tol, tab1->crval, tab2->crval)) {\n    return 0;\n  }\n\n  int N = M;\n  for (int m = 0; m < M; m++) {\n    if (!wcsutil_dblEq(tab1->K[m], tol, tab1->index[m], tab2->index[m])) {\n      return 0;\n    }\n\n    N *= tab1->K[m];\n  }\n\n  if (!wcsutil_dblEq(N, tol, tab1->coord, tab2->coord)) {\n    return 0;\n  }\n\n  *equal = 1;\n\n  return 0;\n}\n\n\n//----------------------------------------------------------------------------\n\nint tabfree(struct tabprm *tab)\n\n{\n  if (tab == 0x0) return TABERR_NULL_POINTER;\n\n  if (tab->flag != -1) {\n    // Clear any outstanding signals set by wcstab().\n    for (int m = 0; m < tab->m_M; m++) {\n      if (tab->m_indxs[m] == (double *)0x1) tab->m_indxs[m] = 0x0;\n    }\n\n    if (tab->m_coord == (double *)0x1) tab->m_coord = 0x0;\n\n    // Free memory allocated by tabini().\n    if (tab->m_flag == TABSET) {\n      if (tab->K     == tab->m_K)     tab->K = 0x0;\n      if (tab->map   == tab->m_map)   tab->map = 0x0;\n      if (tab->crval == tab->m_crval) tab->crval = 0x0;\n      if (tab->index == tab->m_index) tab->index = 0x0;\n      if (tab->coord == tab->m_coord) tab->coord = 0x0;\n\n      if (tab->m_K)     free(tab->m_K);\n      if (tab->m_map)   free(tab->m_map);\n      if (tab->m_crval) free(tab->m_crval);\n\n      if (tab->m_index) {\n        for (int m = 0; m < tab->m_M; m++) {\n          if (tab->m_indxs[m]) free(tab->m_indxs[m]);\n        }\n        free(tab->m_index);\n        free(tab->m_indxs);\n      }\n\n      if (tab->m_coord) free(tab->m_coord);\n    }\n\n    // Free memory allocated by tabset().\n    if (tab->sense)   free(tab->sense);\n    if (tab->p0)      free(tab->p0);\n    if (tab->delta)   free(tab->delta);\n    if (tab->extrema) free(tab->extrema);\n  }\n\n  tab->m_flag  = 0;\n  tab->m_M     = 0;\n  tab->m_N     = 0;\n  tab->m_K     = 0x0;\n  tab->m_map   = 0x0;\n  tab->m_crval = 0x0;\n  tab->m_index = 0x0;\n  tab->m_indxs = 0x0;\n  tab->m_coord = 0x0;\n\n  tab->sense   = 0x0;\n  tab->p0      = 0x0;\n  tab->delta   = 0x0;\n  tab->extrema = 0x0;\n  tab->set_M   = 0;\n\n  wcserr_clear(&(tab->err));\n\n  tab->flag = 0;\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tabsize(const struct tabprm *tab, int sizes[2])\n\n{\n  if (tab == 0x0) {\n    sizes[0] = sizes[1] = 0;\n    return TABERR_SUCCESS;\n  }\n\n  // Base size, in bytes.\n  sizes[0] = sizeof(struct tabprm);\n\n  // Total size of allocated memory, in bytes.\n  sizes[1] = 0;\n\n  int exsizes[2];\n  int M = tab->M;\n\n  // tabprm::K[];\n  sizes[1] += M * sizeof(int);\n\n  // tabprm::map[];\n  sizes[1] += M * sizeof(int);\n\n  // tabprm::crval[];\n  sizes[1] += M * sizeof(double);\n\n  // tabprm::index[] and tabprm::m_indxs;\n  sizes[1] += 2*M * sizeof(double *);\n  for (int m = 0; m < M; m++) {\n    if (tab->index[m]) {\n      sizes[1] += tab->K[m] * sizeof(double);\n    }\n  }\n\n  // tabprm::coord[];\n  sizes[1] += M * tab->nc * sizeof(double);\n\n  // tab::err[].\n  wcserr_size(tab->err, exsizes);\n  sizes[1] += exsizes[0] + exsizes[1];\n\n  // The remaining arrays are allocated by tabset().\n  if (tab->flag != TABSET) {\n    return TABERR_SUCCESS;\n  }\n\n  // tabprm::sense[].\n  if (tab->sense) {\n    sizes[1] += M * sizeof(int);\n  }\n\n  // tabprm::p0[].\n  if (tab->p0) {\n    sizes[1] += M * sizeof(int);\n  }\n\n  // tabprm::delta[].\n  if (tab->delta) {\n    sizes[1] += M * sizeof(double);\n  }\n\n  // tabprm::extrema[].\n  int ne = (tab->nc / tab->K[0]) * 2 * M;\n  sizes[1] += ne * sizeof(double);\n\n  return TABERR_SUCCESS;\n}\n\n//----------------------------------------------------------------------------\n\nint tabprt(const struct tabprm *tab)\n\n{\n  char   *cp, text[128];\n  double *dp;\n\n  if (tab == 0x0) return TABERR_NULL_POINTER;\n\n  if (tab->flag != TABSET) {\n    wcsprintf(\"The tabprm struct is UNINITIALIZED.\\n\");\n    return 0;\n  }\n\n  wcsprintf(\"       flag: %d\\n\", tab->flag);\n  wcsprintf(\"          M: %d\\n\", tab->M);\n\n  // Array dimensions.\n  WCSPRINTF_PTR(\"          K: \", tab->K, \"\\n\");\n  wcsprintf(\"            \");\n  for (int m = 0; m < tab->M; m++) {\n    wcsprintf(\"%6d\", tab->K[m]);\n  }\n  wcsprintf(\"\\n\");\n\n  // Map vector.\n  WCSPRINTF_PTR(\"        map: \", tab->map, \"\\n\");\n  wcsprintf(\"            \");\n  for (int m = 0; m < tab->M; m++) {\n    wcsprintf(\"%6d\", tab->map[m]);\n  }\n  wcsprintf(\"\\n\");\n\n  // Reference index value.\n  WCSPRINTF_PTR(\"      crval: \", tab->crval, \"\\n\");\n  wcsprintf(\"            \");\n  for (int m = 0; m < tab->M; m++) {\n    wcsprintf(\"  %#- 11.5g\", tab->crval[m]);\n  }\n  wcsprintf(\"\\n\");\n\n  // Index vectors.\n  WCSPRINTF_PTR(\"      index: \", tab->index, \"\\n\");\n  for (int m = 0; m < tab->M; m++) {\n    wcsprintf(\"   index[%d]: \", m);\n    WCSPRINTF_PTR(\"\", tab->index[m], \"\");\n    if (tab->index[m]) {\n      for (int k = 0; k < tab->K[m]; k++) {\n        if (k%5 == 0) {\n          wcsprintf(\"\\n            \");\n        }\n        wcsprintf(\"  %#- 11.5g\", tab->index[m][k]);\n      }\n      wcsprintf(\"\\n\");\n    }\n  }\n\n  // Coordinate array.\n  WCSPRINTF_PTR(\"      coord: \", tab->coord, \"\\n\");\n  dp = tab->coord;\n  for (int n = 0; n < tab->nc; n++) {\n    // Array index.\n    int j = n;\n    cp = text;\n    for (int m = 0; m < tab->M; m++) {\n      int nd = (tab->K[m] < 10) ? 1 : 2;\n      sprintf(cp, \",%*d\", nd, j % tab->K[m] + 1);\n      j /= tab->K[m];\n      cp += strlen(cp);\n    }\n\n    wcsprintf(\"             (*%s)\", text);\n    for (int m = 0; m < tab->M; m++) {\n      wcsprintf(\"  %#- 11.5g\", *(dp++));\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  wcsprintf(\"         nc: %d\\n\", tab->nc);\n\n  WCSPRINTF_PTR(\"      sense: \", tab->sense, \"\\n\");\n  if (tab->sense) {\n    wcsprintf(\"            \");\n    for (int m = 0; m < tab->M; m++) {\n      wcsprintf(\"%6d\", tab->sense[m]);\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  WCSPRINTF_PTR(\"         p0: \", tab->p0, \"\\n\");\n  if (tab->p0) {\n    wcsprintf(\"            \");\n    for (int m = 0; m < tab->M; m++) {\n      wcsprintf(\"%6d\", tab->p0[m]);\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  WCSPRINTF_PTR(\"      delta: \", tab->delta, \"\\n\");\n  if (tab->delta) {\n    wcsprintf(\"            \");\n    for (int m = 0; m < tab->M; m++) {\n      wcsprintf(\"  %#- 11.5g\", tab->delta[m]);\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  WCSPRINTF_PTR(\"    extrema: \", tab->extrema, \"\\n\");\n  dp = tab->extrema;\n  for (int n = 0; n < tab->nc/tab->K[0]; n++) {\n    // Array index.\n    int j = n;\n    cp = text;\n    *cp = '\\0';\n    for (int m = 1; m < tab->M; m++) {\n      int nd = (tab->K[m] < 10) ? 1 : 2;\n      sprintf(cp, \",%*d\", nd, j % tab->K[m] + 1);\n      j /= tab->K[m];\n      cp += strlen(cp);\n    }\n\n    wcsprintf(\"             (*,*%s)\", text);\n    for (int m = 0; m < 2*tab->M; m++) {\n      if (m == tab->M) wcsprintf(\"->  \");\n      wcsprintf(\"  %#- 11.5g\", *(dp++));\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  WCSPRINTF_PTR(\"        err: \", tab->err, \"\\n\");\n  if (tab->err) {\n    wcserr_prt(tab->err, \"             \");\n  }\n\n  // Memory management.\n  wcsprintf(\"     m_flag: %d\\n\", tab->m_flag);\n  wcsprintf(\"        m_M: %d\\n\", tab->m_M);\n  wcsprintf(\"        m_N: %d\\n\", tab->m_N);\n\n  WCSPRINTF_PTR(\"        m_K: \", tab->m_K, \"\");\n  if (tab->m_K == tab->K) wcsprintf(\"  (= K)\");\n  wcsprintf(\"\\n\");\n\n  WCSPRINTF_PTR(\"      m_map: \", tab->m_map, \"\");\n  if (tab->m_map == tab->map) wcsprintf(\"  (= map)\");\n  wcsprintf(\"\\n\");\n\n  WCSPRINTF_PTR(\"    m_crval: \", tab->m_crval, \"\");\n  if (tab->m_crval == tab->crval) wcsprintf(\"  (= crval)\");\n  wcsprintf(\"\\n\");\n\n  WCSPRINTF_PTR(\"    m_index: \", tab->m_index, \"\");\n  if (tab->m_index == tab->index) wcsprintf(\"  (= index)\");\n  wcsprintf(\"\\n\");\n  for (int m = 0; m < tab->M; m++) {\n    wcsprintf(\" m_indxs[%d]: \", m);\n    WCSPRINTF_PTR(\"\", tab->m_indxs[m], \"\");\n    if (tab->m_indxs[m] == tab->index[m]) wcsprintf(\"  (= index[%d])\", m);\n    wcsprintf(\"\\n\");\n  }\n\n  WCSPRINTF_PTR(\"    m_coord: \", tab->m_coord, \"\");\n  if (tab->m_coord == tab->coord) wcsprintf(\"  (= coord)\");\n  wcsprintf(\"\\n\");\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tabperr(const struct tabprm *tab, const char *prefix)\n\n{\n  if (tab == 0x0) return TABERR_NULL_POINTER;\n\n  if (tab->err) {\n    wcserr_prt(tab->err, prefix);\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tabset(struct tabprm *tab)\n\n{\n  static const char *function = \"tabset\";\n\n  if (tab == 0x0) return TABERR_NULL_POINTER;\n  struct wcserr **err = &(tab->err);\n\n  // Check the number of tabular coordinate axes.\n  int M = tab->M;\n  if (M < 1) {\n    return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS),\n      \"Invalid tabular parameters: M must be positive, got %d\", M);\n  }\n\n  // Check the axis lengths.\n  if (!tab->K) {\n    return wcserr_set(WCSERR_SET(TABERR_MEMORY),\n      \"Null pointers in tabprm struct\");\n  }\n\n  tab->nc = 1;\n  for (int m = 0; m < M; m++) {\n    if (tab->K[m] < 1) {\n      return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS),\n        \"Invalid tabular parameters: Each element of K must be positive, \"\n        \"got %d\", tab->K[m]);\n    }\n\n    // Number of coordinate vectors in the coordinate array.\n    tab->nc *= tab->K[m];\n  }\n\n  // Check that the map vector is sensible.\n  if (!tab->map) {\n    return wcserr_set(WCSERR_SET(TABERR_MEMORY),\n      \"Null pointers in tabprm struct\");\n  }\n\n  for (int m = 0; m < M; m++) {\n    int i = tab->map[m];\n    if (i < 0) {\n      return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS),\n        \"Invalid tabular parameters: Each element of map must be \"\n        \"non-negative, got %d\", i);\n    }\n  }\n\n  // Check memory allocation for the remaining vectors.\n  if (!tab->crval || !tab->index || !tab->coord) {\n    return wcserr_set(WCSERR_SET(TABERR_MEMORY),\n      \"Null pointers in tabprm struct\");\n  }\n\n  // Take memory if signalled to by wcstab().\n  for (int m = 0; m < tab->m_M; m++) {\n    if (tab->m_indxs[m] == (double *)0x1 &&\n      (tab->m_indxs[m] = tab->index[m])) {\n      tab->m_flag = TABSET;\n    }\n  }\n\n  if (tab->m_coord == (double *)0x1 &&\n    (tab->m_coord = tab->coord)) {\n    tab->m_flag = TABSET;\n  }\n\n\n  // Allocate memory for work vectors.\n  if (tab->flag != TABSET || tab->set_M < M) {\n    // Free memory that may have been allocated previously.\n    if (tab->sense)   free(tab->sense);\n    if (tab->p0)      free(tab->p0);\n    if (tab->delta)   free(tab->delta);\n    if (tab->extrema) free(tab->extrema);\n\n    // Allocate memory for internal arrays.\n    if (!(tab->sense = calloc(M, sizeof(int)))) {\n      return wcserr_set(TAB_ERRMSG(TABERR_MEMORY));\n    }\n\n    if (!(tab->p0 = calloc(M, sizeof(int)))) {\n      free(tab->sense);\n      return wcserr_set(TAB_ERRMSG(TABERR_MEMORY));\n    }\n\n    if (!(tab->delta = calloc(M, sizeof(double)))) {\n      free(tab->sense);\n      free(tab->p0);\n      return wcserr_set(TAB_ERRMSG(TABERR_MEMORY));\n    }\n\n    int ne = (tab->nc / tab->K[0]) * 2 * M;\n    if (!(tab->extrema = calloc(ne, sizeof(double)))) {\n      free(tab->sense);\n      free(tab->p0);\n      free(tab->delta);\n      return wcserr_set(TAB_ERRMSG(TABERR_MEMORY));\n    }\n\n    tab->set_M = M;\n  }\n\n  // Check that the index vectors are monotonic.\n  int *Km = tab->K;\n  for (int m = 0; m < M; m++, Km++) {\n    tab->sense[m] = 0;\n\n    if (*Km > 1) {\n      double *Psi;\n      if ((Psi = tab->index[m]) == 0x0) {\n        // Default indexing.\n        tab->sense[m] = 1;\n\n      } else {\n        for (int k = 0; k < *Km-1; k++) {\n          switch (tab->sense[m]) {\n          case 0:\n            if (Psi[k] < Psi[k+1]) {\n              // Monotonic increasing.\n              tab->sense[m] = 1;\n            } else if (Psi[k] > Psi[k+1]) {\n              // Monotonic decreasing.\n              tab->sense[m] = -1;\n            }\n            break;\n\n          case 1:\n            if (Psi[k] > Psi[k+1]) {\n              // Should be monotonic increasing.\n              free(tab->sense);\n              free(tab->p0);\n              free(tab->delta);\n              free(tab->extrema);\n              return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS),\n                \"Invalid tabular parameters: Index vectors are not \"\n                \"monotonically increasing\");\n            }\n            break;\n\n          case -1:\n            if (Psi[k] < Psi[k+1]) {\n              // Should be monotonic decreasing.\n              free(tab->sense);\n              free(tab->p0);\n              free(tab->delta);\n              free(tab->extrema);\n              return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS),\n                \"Invalid tabular parameters: Index vectors are not \"\n                \"monotonically decreasing\");\n            }\n            break;\n          }\n        }\n      }\n\n      if (tab->sense[m] == 0) {\n        free(tab->sense);\n        free(tab->p0);\n        free(tab->delta);\n        free(tab->extrema);\n        return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS),\n          \"Invalid tabular parameters: Index vectors are not monotonic\");\n      }\n    }\n  }\n\n  // Find the extremal values of the coordinate elements in each row.\n  double *dcrd = tab->coord;\n  double *dmin = tab->extrema;\n  double *dmax = tab->extrema + M;\n  for (int ic = 0; ic < tab->nc; ic += tab->K[0]) {\n    for (int m = 0; m < M; m++, dcrd++) {\n      if (tab->K[0] > 1) {\n        // Extrapolate a little before the start of the row.\n        double dPsi;\n        double *Psi = tab->index[0];\n        if (Psi == 0x0) {\n          dPsi = 1.0;\n        } else {\n          dPsi = Psi[1] - Psi[0];\n        }\n\n        double dval = *dcrd;\n        if (dPsi != 0.0) {\n          dval -= 0.5 * (*(dcrd+M) - *dcrd)/dPsi;\n        }\n\n        *(dmax+m) = *(dmin+m) = dval;\n      } else {\n        *(dmax+m) = *(dmin+m) = *dcrd;\n      }\n    }\n\n    dcrd -= M;\n    for (int i = 0; i < tab->K[0]; i++) {\n      for (int m = 0; m < M; m++, dcrd++) {\n        if (*(dmax+m) < *dcrd) *(dmax+m) = *dcrd;\n        if (*(dmin+m) > *dcrd) *(dmin+m) = *dcrd;\n\n        if (tab->K[0] > 1 && i == tab->K[0]-1) {\n          // Extrapolate a little beyond the end of the row.\n          double dPsi;\n          double *Psi = tab->index[0];\n          if (Psi == 0x0) {\n            dPsi = 1.0;\n          } else {\n            dPsi = Psi[i] - Psi[i-1];\n          }\n\n          double dval = *dcrd;\n          if (dPsi != 0.0) {\n            dval += 0.5 * (*dcrd - *(dcrd-M))/dPsi;\n          }\n\n          if (*(dmax+m) < dval) *(dmax+m) = dval;\n          if (*(dmin+m) > dval) *(dmin+m) = dval;\n        }\n      }\n    }\n\n    dmin += 2*M;\n    dmax += 2*M;\n  }\n\n  tab->flag = TABSET;\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tabx2s(\n  struct tabprm *tab,\n  int ncoord,\n  int nelem,\n  const double x[],\n  double world[],\n  int stat[])\n\n{\n  static const char *function = \"tabx2s\";\n\n  int status;\n\n  if (tab == 0x0) return TABERR_NULL_POINTER;\n  struct wcserr **err = &(tab->err);\n\n  // Initialize if required.\n  if (tab->flag != TABSET) {\n    if ((status = tabset(tab))) return status;\n  }\n\n  // This is used a lot.\n  int M = tab->M;\n\n  status = 0;\n  register const double *xp = x;\n  register double *wp = world;\n  register int *statp = stat;\n  for (int n = 0; n < ncoord; n++) {\n    // Determine the indexes.\n    int *Km = tab->K;\n    for (int m = 0; m < M; m++, Km++) {\n      // N.B. psi_m and Upsilon_m are 1-relative FITS indexes.\n      int i = tab->map[m];\n      double psi_m = *(xp+i) + tab->crval[m];\n\n      double *Psi = tab->index[m];\n      double upsilon;\n      if (Psi == 0x0) {\n        // Default indexing is simple.\n        upsilon = psi_m;\n\n      } else {\n        // To ease confusion, decrement Psi so that we can use 1-relative\n        // C array indexing to match the 1-relative FITS indexing.\n        Psi--;\n\n        if (*Km == 1) {\n          // Index vector is degenerate.\n          if (Psi[1]-0.5 <= psi_m && psi_m <= Psi[1]+0.5) {\n            upsilon = psi_m;\n          } else {\n            *statp = 1;\n            status = wcserr_set(TAB_ERRMSG(TABERR_BAD_X));\n            goto next;\n          }\n\n        } else {\n          // Interpolate in the indexing vector.\n\t  int k;\n          if (tab->sense[m] == 1) {\n            // Monotonic increasing index values.\n            if (psi_m < Psi[1]) {\n              if (Psi[1] - 0.5*(Psi[2]-Psi[1]) <= psi_m) {\n                // Allow minor extrapolation.\n                k = 1;\n\n              } else {\n                // Index is out of range.\n                *statp = 1;\n                status = wcserr_set(TAB_ERRMSG(TABERR_BAD_X));\n                goto next;\n              }\n\n            } else if (Psi[*Km] < psi_m) {\n              if (psi_m <= Psi[*Km] + 0.5*(Psi[*Km]-Psi[*Km-1])) {\n                // Allow minor extrapolation.\n                k = *Km - 1;\n\n              } else {\n                // Index is out of range.\n                *statp = 1;\n                status = wcserr_set(TAB_ERRMSG(TABERR_BAD_X));\n                goto next;\n              }\n\n            } else {\n              for (k = 1; k < *Km; k++) {\n                if (psi_m < Psi[k]) {\n                  continue;\n                }\n                if (Psi[k] == psi_m && psi_m < Psi[k+1]) {\n                  break;\n                }\n                if (Psi[k] < psi_m && psi_m <= Psi[k+1]) {\n                  break;\n                }\n              }\n            }\n\n          } else {\n            // Monotonic decreasing index values.\n            if (psi_m > Psi[1]) {\n              if (Psi[1] + 0.5*(Psi[1]-Psi[2]) >= psi_m) {\n                // Allow minor extrapolation.\n                k = 1;\n\n              } else {\n                // Index is out of range.\n                *statp = 1;\n                status = wcserr_set(TAB_ERRMSG(TABERR_BAD_X));\n                goto next;\n              }\n\n            } else if (psi_m < Psi[*Km]) {\n              if (Psi[*Km] - 0.5*(Psi[*Km-1]-Psi[*Km]) <= psi_m) {\n                // Allow minor extrapolation.\n                k = *Km - 1;\n\n              } else {\n                // Index is out of range.\n                *statp = 1;\n                status = wcserr_set(TAB_ERRMSG(TABERR_BAD_X));\n                goto next;\n              }\n\n            } else {\n              for (k = 1; k < *Km; k++) {\n                if (psi_m > Psi[k]) {\n                  continue;\n                }\n                if (Psi[k] == psi_m && psi_m > Psi[k+1]) {\n                  break;\n                }\n                if (Psi[k] > psi_m && psi_m >= Psi[k+1]) {\n                  break;\n                }\n              }\n            }\n          }\n\n          upsilon = k + (psi_m - Psi[k]) / (Psi[k+1] - Psi[k]);\n        }\n      }\n\n      if (upsilon < 0.5 || upsilon > *Km + 0.5) {\n        // Index out of range.\n        *statp = 1;\n        status = wcserr_set(TAB_ERRMSG(TABERR_BAD_X));\n        goto next;\n      }\n\n      // Fiducial array indices and fractional offset.\n      // p1 is 1-relative while tab::p0 is 0-relative.\n      int p1 = (int)floor(upsilon);\n      tab->p0[m] = p1 - 1;\n      tab->delta[m] = upsilon - p1;\n\n      if (p1 == 0) {\n        // Extrapolation below p1 == 1.\n        tab->p0[m] += 1;\n        tab->delta[m] -= 1.0;\n      } else if (p1 == *Km && *Km > 1) {\n        // Extrapolation above p1 == K_m.\n        tab->p0[m] -= 1;\n        tab->delta[m] += 1.0;\n      }\n    }\n\n\n    // Now interpolate in the coordinate array; the M-dimensional linear\n    // interpolation algorithm is described in Sect. 3.4 of WCS Paper IV.\n    for (int m = 0; m < M; m++) {\n      int i = tab->map[m];\n      *(wp+i) = 0.0;\n    }\n\n    // Loop over the 2^M vertices surrounding P.\n    int nv = 1 << M;\n    for (int iv = 0; iv < nv; iv++) {\n      // Locate vertex in the coordinate array and compute its weight.\n      int offset = 0;\n      double wgt = 1.0;\n      for (int m = M-1; m >= 0; m--) {\n        offset *= tab->K[m];\n        offset += tab->p0[m];\n        if (iv & (1 << m)) {\n          if (tab->K[m] > 1) offset++;\n          wgt *= tab->delta[m];\n        } else {\n          wgt *= 1.0 - tab->delta[m];\n        }\n      }\n\n      if (wgt == 0.0) continue;\n\n      // Add the contribution from this vertex to each element.\n      double *coord = tab->coord + offset*M;\n      for (int m = 0; m < M; m++) {\n        int i = tab->map[m];\n        *(wp+i) += *(coord++) * wgt;\n      }\n\n      if (wgt == 1.0) break;\n    }\n\n    *statp = 0;\n\nnext:\n    xp += nelem;\n    wp += nelem;\n    statp++;\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\n// Helper functions used only by tabs2x().\nstatic int tabedge(struct tabprm *);\nstatic int tabrow(struct tabprm *, const double *);\nstatic int tabvox(struct tabprm *, const double *, int, double **,\n                  unsigned int *);\n\nint tabs2x(\n  struct tabprm* tab,\n  int ncoord,\n  int nelem,\n  const double world[],\n  double x[],\n  int stat[])\n\n{\n  static const char *function = \"tabs2x\";\n\n  int status;\n\n  if (tab == 0x0) return TABERR_NULL_POINTER;\n  struct wcserr **err = &(tab->err);\n\n  // Initialize if required.\n  if (tab->flag != TABSET) {\n    if ((status = tabset(tab))) return status;\n  }\n\n  // This is used a lot.\n  int M = tab->M;\n\n  double **tabcoord = 0x0;\n  int nv = 0;\n  if (M > 1) {\n    nv = 1 << M;\n    tabcoord = calloc(nv, sizeof(double *));\n  }\n\n\n  status = 0;\n  register const double *wp = world;\n  register double *xp = x;\n  register int *statp = stat;\n  for (int n = 0; n < ncoord; n++) {\n    // Locate this coordinate in the coordinate array.\n    int edge = 0;\n    for (int m = 0; m < M; m++) {\n      tab->p0[m] = 0;\n    }\n\n    int ic;\n    for (ic = 0; ic < tab->nc; ic++) {\n      if (tab->p0[0] == 0) {\n        // New row, could it contain a solution?\n        if (edge || tabrow(tab, wp)) {\n          // No, skip it.\n          ic += tab->K[0];\n          if (1 < M) {\n            tab->p0[1]++;\n            edge = tabedge(tab);\n          }\n\n          // Because ic will be incremented when the loop is reentered.\n          ic--;\n          continue;\n        }\n      }\n\n      if (M == 1) {\n        // Deal with the one-dimensional case separately for efficiency.\n        double w = wp[tab->map[0]];\n        if (w == tab->coord[0]) {\n          tab->p0[0] = 0;\n          tab->delta[0] = 0.0;\n          break;\n\n        } else if (ic < tab->nc - 1) {\n          if (((tab->coord[ic] <= w && w <= tab->coord[ic+1]) ||\n               (tab->coord[ic] >= w && w >= tab->coord[ic+1])) &&\n               (tab->index[0] == 0x0 ||\n                tab->index[0][ic] != tab->index[0][ic+1])) {\n            tab->p0[0] = ic;\n            tab->delta[0] = (w - tab->coord[ic]) /\n                            (tab->coord[ic+1] - tab->coord[ic]);\n            break;\n          }\n        }\n\n      } else {\n        // Multi-dimensional tables are harder.\n        if (!edge) {\n          // Addresses of the coordinates for each corner of the \"voxel\".\n          for (int iv = 0; iv < nv; iv++) {\n            int offset = 0;\n            for (int m = M-1; m >= 0; m--) {\n              offset *= tab->K[m];\n              offset += tab->p0[m];\n              if ((iv & (1 << m)) && (tab->K[m] > 1)) offset++;\n            }\n            tabcoord[iv] = tab->coord + offset*M;\n          }\n\n          if (tabvox(tab, wp, 0, tabcoord, 0x0) == 0) {\n            // Found a solution.\n            break;\n          }\n        }\n\n        // Next voxel.\n        tab->p0[0]++;\n        edge = tabedge(tab);\n      }\n    }\n\n\n    if (ic == tab->nc) {\n      // Coordinate not found; allow minor extrapolation.\n      if (M == 1) {\n        // Should there be a solution?\n        double w = wp[tab->map[0]];\n        if (tab->extrema[0] <= w && w <= tab->extrema[1]) {\n          double *dcrd = tab->coord;\n          for (int i = 0; i < 2; i++) {\n            if (i) dcrd += tab->K[0] - 2;\n\n            double delta = (w - *dcrd) / (*(dcrd+1) - *dcrd);\n\n            if (i == 0) {\n              if (-0.5 <= delta && delta <= 0.0) {\n                tab->p0[0] = 0;\n                tab->delta[0] = delta;\n                ic = 0;\n                break;\n              }\n            } else {\n              if (1.0 <= delta && delta <= 1.5) {\n                tab->p0[0] = tab->K[0] - 1;\n                tab->delta[0] = delta - 1.0;\n                ic = 0;\n              }\n            }\n          }\n        }\n\n      } else {\n        // Multi-dimensional tables.\n        // >>> TBD <<<\n      }\n    }\n\n\n    if (ic == tab->nc) {\n      // Coordinate not found.\n      *statp = 1;\n      status = wcserr_set(TAB_ERRMSG(TABERR_BAD_WORLD));\n\n    } else {\n      // Determine the intermediate world coordinates.\n      int *Km = tab->K;\n      for (int m = 0; m < M; m++, Km++) {\n        // N.B. Upsilon_m and psi_m are 1-relative FITS indexes.\n        double upsilon = (tab->p0[m] + 1) + tab->delta[m];\n\n        if (upsilon < 0.5 || upsilon > *Km + 0.5) {\n          // Index out of range.\n          *statp = 1;\n          status = wcserr_set(TAB_ERRMSG(TABERR_BAD_WORLD));\n\n        } else {\n          // Do inverse lookup of the index vector.\n          double *Psi = tab->index[m];\n          double psi_m;\n          if (Psi == 0x0) {\n            // Default indexing.\n            psi_m = upsilon;\n\n          } else {\n            // Decrement Psi and use 1-relative C array indexing to match the\n            // 1-relative FITS indexing.\n            Psi--;\n\n            if (*Km == 1) {\n              // Degenerate index vector.\n              psi_m = Psi[1];\n            } else {\n              int k = (int)(upsilon);\n              psi_m = Psi[k];\n              if (k < *Km) {\n                psi_m += (upsilon - k) * (Psi[k+1] - Psi[k]);\n              }\n            }\n          }\n\n          xp[tab->map[m]] = psi_m - tab->crval[m];\n        }\n      }\n      *statp = 0;\n    }\n\n    wp += nelem;\n    xp += nelem;\n    statp++;\n  }\n\n  if (tabcoord) free(tabcoord);\n\n  return status;\n}\n\n/*----------------------------------------------------------------------------\n* Convenience routine to check whether tabprm::p0 has been incremented beyond\n* the end of an index vector and if so move it to the start of the next one.\n* Returns 1 if tabprm::p0 is sitting at the end of any non-degenerate index\n* vector.\n*---------------------------------------------------------------------------*/\n\nint tabedge(struct tabprm* tab)\n\n{\n  int edge = 0;\n\n  for (int m = 0; m < tab->M; m++) {\n    if (tab->p0[m] == tab->K[m]) {\n      // p0 has been incremented beyond the end of an index vector, point it\n      // to the next one.\n      tab->p0[m] = 0;\n      if (m < tab->M-1) {\n        tab->p0[m+1]++;\n      }\n    } else if (tab->p0[m] == tab->K[m]-1 && tab->K[m] > 1) {\n      // p0 is sitting at the end of a non-degenerate index vector.\n      edge = 1;\n    }\n  }\n\n  return edge;\n}\n\n/*----------------------------------------------------------------------------\n* Quick test to see whether the world coordinate indicated by wp could lie\n* somewhere along (or near) the row of the image indexed by tabprm::p0.\n* Return 0 if so, 1 otherwise.\n*\n* tabprm::p0 selects a particular row of the image, p0[0] being ignored (i.e.\n* treated as zero).  Adjacent rows that delimit a row of \"voxels\" are formed\n* by incrementing elements other than p0[0] in all binary combinations.  N.B.\n* these are not the same as the voxels (pixels) that are indexed by, and\n* centred on, integral pixel coordinates in FITS.\n*\n* To see why it is necessary to examine the adjacent rows, consider the 2-D\n* case where the first world coordinate element is constant along each row.\n* If the first element of wp has value 0.5, and its value in the row indexed\n* by p0 has value 0, and in the next row it has value 1, then it is clear that\n* the solution lies in neither row but somewhere between them.  Thus both rows\n* will be involved in finding the solution.\n*\n* tabprm::extrema is the address of the first element of a 1-D array that\n* records the minimum and maximum value of each element of the coordinate\n* vector in each row of the coordinate array, treated as though it were\n* defined as\n*\n*   double extrema[K_M]...[K_2][2][M]\n*\n* The minimum is recorded in the first element of the compressed K_1\n* dimension, then the maximum.\n*---------------------------------------------------------------------------*/\n\nint tabrow(struct tabprm* tab, const double *wp)\n\n{\n  const double tol = 1e-10;\n\n  int M = tab->M;\n\n  // The number of corners in a \"voxel\".  We need examine only half this\n  // number of rows.  The extra factor of two will be used to select between\n  // the minimal and maximal values in each row.\n  unsigned int nv = 1 << M;\n\n  unsigned int eq = 0;\n  unsigned int lt = 0;\n  unsigned int gt = 0;\n  for (unsigned int iv = 0; iv < nv; iv++) {\n    // Find the index into tabprm::extrema for this row.\n    int offset = 0;\n    for (int m = M-1; m > 0; m--) {\n      offset *= tab->K[m];\n      offset += tab->p0[m];\n\n      // Select the row.\n      if (iv & (1 << m)) {\n        if (tab->K[m] > 1) offset++;\n      }\n    }\n\n    // The K_1 dimension has length 2 (see prologue).\n    offset *= 2;\n\n    // Select the minimum on even numbered iterations, else the maximum.\n    if (iv & 1) offset++;\n\n    // The last dimension has length M (see prologue).\n    offset *= M;\n\n    // Address of the extremal elements (min or max) for this row.\n    double *cp = tab->extrema + offset;\n\n    // For each coordinate element, we only need to find one row where its\n    // minimum value is less than that of wp, and one row where the maximum\n    // value is greater.  That doesn't mean that there is a solution, only\n    // that there might be.\n    for (int m = 0; m < M; m++, cp++) {\n      // Apply the axis mapping.\n      double w = wp[tab->map[m]];\n\n      // Finally the test itself; set bits in the bitmask.\n      if (fabs(*cp - w) < tol) {\n        eq |= (1 << m);\n      } else if (*cp < w) {\n        lt |= (1 << m);\n      } else if (*cp > w) {\n        gt |= (1 << m);\n      }\n    }\n\n    // Have all bits been switched on?\n    if ((lt | eq) == nv-1 && (gt | eq) == nv-1) {\n      // A solution could lie within this row of voxels.\n      return 0;\n    }\n  }\n\n  // No solution in this row.\n  return 1;\n}\n\n/*----------------------------------------------------------------------------\n* Does the world coordinate indicated by wp lie within the voxel indexed by\n* tabprm::p0?  If so, do a binary chop of the interior of the voxel to find\n* it and return 0, with tabprm::delta set to the solution.  Else return 1.\n*\n* As in tabrow(), a \"voxel\" is formed by incrementing the elements of\n* tabprm::p0 in all binary combinations.  Note that these are not the same as\n* the voxels (pixels) that are indexed by, and centred on, integral pixel\n* coordinates in FITS.\n*\n* tabvox() calls itself recursively.  When called from outside, level, being\n* the level of recursion, should be given as zero.  tabcoord is an array\n* holding the addresses of the coordinates for each corner of the voxel.\n* vox is the address of a work array (vox2) used during recursive calls to\n* dissect the voxel.  It is ignored when tabvox() is called from outside\n* (level == 0).\n*\n* It is assumed that the image dimensions are no greater than 32.\n----------------------------------------------------------------------------*/\n\nint tabvox(\n  struct tabprm* tab,\n  const double *wp,\n  int level,\n  double **tabcoord,\n  unsigned int *vox)\n\n{\n  const double tol = 1e-10;\n\n  int M = tab->M;\n\n  // The number of corners in a voxel.\n  unsigned int nv = 1 << M;\n\n  double dv = 1.0;\n  for (int i = 0; i < level; i++) {\n    dv /= 2.0;\n  }\n\n  // Could the coordinate lie within this voxel (level == 0) or sub-voxel\n  // (level > 0)?  We use the fact that with linear interpolation the\n  // coordinate elements are extremal in a corner and test each one.\n  unsigned int lt = 0;\n  unsigned int gt = 0;\n  unsigned int eq = 0;\n  for (unsigned int iv = 0; iv < nv; iv++) {\n    // Select a corner of the sub-voxel.\n    double coord[32];\n    for (int m = 0; m < M; m++) {\n      coord[m] = 0.0;\n      tab->delta[m] = level ? dv*vox[m] : 0.0;\n\n      if (iv & (1 << m)) {\n        tab->delta[m] += dv;\n      }\n    }\n\n    // Compute the coordinates of this corner of the sub-voxel by linear\n    // interpolation using the weighting algorithm described in Sect. 3.4 of\n    // WCS Paper IV.\n    for (unsigned int jv = 0; jv < nv; jv++) {\n      // Find the weight for this corner of the parent voxel.\n      double wgt = 1.0;\n      for (int m = 0; m < M; m++) {\n        if (jv & (1 << m)) {\n          wgt *= tab->delta[m];\n        } else {\n          wgt *= 1.0 - tab->delta[m];\n        }\n      }\n\n      if (wgt == 0.0) continue;\n\n      // Add its contribution to each coordinate element.\n      double *cp = tabcoord[jv];\n      for (int m = 0; m < M; m++) {\n        coord[m] += *(cp++) * wgt;\n      }\n\n      if (wgt == 1.0) break;\n    }\n\n    // Coordinate elements are minimal or maximal in a corner.\n    unsigned int et = 0;\n    for (int m = 0; m < M; m++) {\n      // Apply the axis mapping.\n      double w = wp[tab->map[m]];\n\n      // Finally the test itself; set bits in the bitmask.\n      if (fabs(coord[m] - w) < tol) {\n        et |= (1 << m);\n      } else if (coord[m] < w) {\n        lt |= (1 << m);\n      } else if (coord[m] > w) {\n        gt |= (1 << m);\n      }\n    }\n\n    if (et == nv-1) {\n      // We've stumbled across a solution in this corner of the sub-voxel.\n      return 0;\n    }\n\n    eq |= et;\n  }\n\n  // Could the coordinate lie within this sub-voxel?\n  if ((lt | eq) == nv-1 && (gt | eq) == nv-1) {\n    // Yes it could, but does it?\n\n    // Is it time to stop the recursion?\n    if (level == 31) {\n      // We have a solution, squeeze out the last bit of juice.\n      dv /= 2.0;\n      for (int m = 0; m < M; m++) {\n        tab->delta[m] = dv * (2.0*vox[m] + 1.0);\n      }\n\n      return 0;\n    }\n\n    // Subdivide the sub-voxel and try again for each subdivision.\n    for (unsigned int iv = 0; iv < nv; iv++) {\n      // Select the subdivision.\n      unsigned int vox2[32];\n      for (int m = 0; m < M; m++) {\n        vox2[m] = level ? 2*vox[m] : 0;\n        if (iv & (1 << m)) {\n          vox2[m]++;\n        }\n      }\n\n      // Recurse.\n      if (tabvox(tab, wp, level+1, tabcoord, vox2) == 0) {\n        return 0;\n      }\n    }\n  }\n\n  // No solution in this sub-voxel.\n  return 1;\n}\n"},{"id":16585,"name":"spc.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: spc.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the spc routines\n* ---------------------------\n* Routines in this suite implement the part of the FITS World Coordinate\n* System (WCS) standard that deals with spectral coordinates, as described in\n*\n=   \"Representations of world coordinates in FITS\",\n=   Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (WCS Paper I)\n=\n=   \"Representations of spectral coordinates in FITS\",\n=   Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L.\n=   2006, A&A, 446, 747 (WCS Paper III)\n*\n* These routines define methods to be used for computing spectral world\n* coordinates from intermediate world coordinates (a linear transformation\n* of image pixel coordinates), and vice versa.  They are based on the spcprm\n* struct which contains all information needed for the computations.  The\n* struct contains some members that must be set by the user, and others that\n* are maintained by these routines, somewhat like a C++ class but with no\n* encapsulation.\n*\n* Routine spcini() is provided to initialize the spcprm struct with default\n* values, spcfree() reclaims any memory that may have been allocated to store\n* an error message, spcsize() computes its total size including allocated\n* memory, and spcprt() prints its contents.\n*\n* spcperr() prints the error message(s) (if any) stored in a spcprm struct.\n*\n* A setup routine, spcset(), computes intermediate values in the spcprm struct\n* from parameters in it that were supplied by the user.  The struct always\n* needs to be set up by spcset() but it need not be called explicitly - refer\n* to the explanation of spcprm::flag.\n*\n* spcx2s() and spcs2x() implement the WCS spectral coordinate transformations.\n* In fact, they are high level driver routines for the lower level spectral\n* coordinate transformation routines described in spx.h.\n*\n* A number of routines are provided to aid in analysing or synthesising sets\n* of FITS spectral axis keywords:\n*\n*   - spctype() checks a spectral CTYPEia keyword for validity and returns\n*     information derived from it.\n*\n*   - Spectral keyword analysis routine spcspxe() computes the values of the\n*     X-type spectral variables for the S-type variables supplied.\n*\n*   - Spectral keyword synthesis routine, spcxpse(), computes the S-type\n*     variables for the X-types supplied.\n*\n*   - Given a set of spectral keywords, a translation routine, spctrne(),\n*     produces the corresponding set for the specified spectral CTYPEia.\n*\n*   - spcaips() translates AIPS-convention spectral CTYPEia and VELREF\n*     keyvalues.\n*\n* Spectral variable types - S, P, and X:\n* --------------------------------------\n* A few words of explanation are necessary regarding spectral variable types\n* in FITS.\n*\n* Every FITS spectral axis has three associated spectral variables:\n*\n*   S-type: the spectral variable in which coordinates are to be\n*     expressed.  Each S-type is encoded as four characters and is\n*     linearly related to one of four basic types as follows:\n*\n*     F (Frequency):\n*       - 'FREQ':  frequency\n*       - 'AFRQ':  angular frequency\n*       - 'ENER':  photon energy\n*       - 'WAVN':  wave number\n*       - 'VRAD':  radio velocity\n*\n*     W (Wavelength in vacuo):\n*       - 'WAVE':  wavelength\n*       - 'VOPT':  optical velocity\n*       - 'ZOPT':  redshift\n*\n*     A (wavelength in Air):\n*       - 'AWAV':  wavelength in air\n*\n*     V (Velocity):\n*       - 'VELO':  relativistic velocity\n*       - 'BETA':  relativistic beta factor\n*\n*     The S-type forms the first four characters of the CTYPEia keyvalue,\n*     and CRVALia and CDELTia are expressed as S-type quantities so that\n*     they provide a first-order approximation to the S-type variable at\n*     the reference point.\n*\n*     Note that 'AFRQ', angular frequency, is additional to the variables\n*     defined in WCS Paper III.\n*\n*   P-type: the basic spectral variable (F, W, A, or V) with which the\n*     S-type variable is associated (see list above).\n*\n*     For non-grism axes, the P-type is encoded as the eighth character of\n*     CTYPEia.\n*\n*   X-type: the basic spectral variable (F, W, A, or V) for which the\n*     spectral axis is linear, grisms excluded (see below).\n*\n*     For non-grism axes, the X-type is encoded as the sixth character of\n*     CTYPEia.\n*\n*   Grisms: Grism axes have normal S-, and P-types but the axis is linear,\n*     not in any spectral variable, but in a special \"grism parameter\".\n*     The X-type spectral variable is either W or A for grisms in vacuo or\n*     air respectively, but is encoded as 'w' or 'a' to indicate that an\n*     additional transformation is required to convert to or from the\n*     grism parameter.  The spectral algorithm code for grisms also has a\n*     special encoding in CTYPEia, either 'GRI' (in vacuo) or 'GRA' (in air).\n*\n* In the algorithm chain, the non-linear transformation occurs between the\n* X-type and the P-type variables; the transformation between P-type and\n* S-type variables is always linear.\n*\n* When the P-type and X-type variables are the same, the spectral axis is\n* linear in the S-type variable and the second four characters of CTYPEia\n* are blank.  This can never happen for grism axes.\n*\n* As an example, correlating radio spectrometers always produce spectra that\n* are regularly gridded in frequency; a redshift scale on such a spectrum is\n* non-linear.  The required value of CTYPEia would be 'ZOPT-F2W', where the\n* desired S-type is 'ZOPT' (redshift), the P-type is necessarily 'W'\n* (wavelength), and the X-type is 'F' (frequency) by the nature of the\n* instrument.\n*\n* Air-to-vacuum wavelength conversion:\n* ------------------------------------\n* Please refer to the prologue of spx.h for important comments relating to the\n* air-to-vacuum wavelength conversion.\n*\n* Argument checking:\n* ------------------\n* The input spectral values are only checked for values that would result in\n* floating point exceptions.  In particular, negative frequencies and\n* wavelengths are allowed, as are velocities greater than the speed of\n* light.  The same is true for the spectral parameters - rest frequency and\n* wavelength.\n*\n* Accuracy:\n* ---------\n* No warranty is given for the accuracy of these routines (refer to the\n* copyright notice); intending users must satisfy for themselves their\n* adequacy for the intended purpose.  However, closure effectively to within\n* double precision rounding error was demonstrated by test routine tspc.c\n* which accompanies this software.\n*\n*\n* spcini() - Default constructor for the spcprm struct\n* ----------------------------------------------------\n* spcini() sets all members of a spcprm struct to default values.  It should\n* be used to initialize every spcprm struct.\n*\n* PLEASE NOTE: If the spcprm struct has already been initialized, then before\n* reinitializing, it spcfree() should be used to free any memory that may have\n* been allocated to store an error message.  A memory leak may otherwise\n* result.\n*\n* Given and returned:\n*   spc       struct spcprm*\n*                       Spectral transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null spcprm pointer passed.\n*\n*\n* spcfree() - Destructor for the spcprm struct\n* --------------------------------------------\n* spcfree() frees any memory that may have been allocated to store an error\n* message in the spcprm struct.\n*\n* Given:\n*   spc       struct spcprm*\n*                       Spectral transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null spcprm pointer passed.\n*\n*\n* spcsize() - Compute the size of a spcprm struct\n* -----------------------------------------------\n* spcsize() computes the full size of a spcprm struct, including allocated\n* memory.\n*\n* Given:\n*   spc       const struct spcprm*\n*                       Spectral transformation parameters.\n*\n*                       If NULL, the base size of the struct and the allocated\n*                       size are both set to zero.\n*\n* Returned:\n*   sizes     int[2]    The first element is the base size of the struct as\n*                       returned by sizeof(struct spcprm).  The second element\n*                       is the total allocated size, in bytes.  This figure\n*                       includes memory allocated for the constituent struct,\n*                       spcprm::err.\n*\n*                       It is not an error for the struct not to have been set\n*                       up via spcset().\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*\n*\n* spcprt() - Print routine for the spcprm struct\n* ----------------------------------------------\n* spcprt() prints the contents of a spcprm struct using wcsprintf().  Mainly\n* intended for diagnostic purposes.\n*\n* Given:\n*   spc       const struct spcprm*\n*                       Spectral transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null spcprm pointer passed.\n*\n*\n* spcperr() - Print error messages from a spcprm struct\n* -----------------------------------------------------\n* spcperr() prints the error message(s) (if any) stored in a spcprm struct.\n* If there are no errors then nothing is printed.  It uses wcserr_prt(), q.v.\n*\n* Given:\n*   spc       const struct spcprm*\n*                       Spectral transformation parameters.\n*\n*   prefix    const char *\n*                       If non-NULL, each output line will be prefixed with\n*                       this string.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null spcprm pointer passed.\n*\n*\n* spcset() - Setup routine for the spcprm struct\n* ----------------------------------------------\n* spcset() sets up a spcprm struct according to information supplied within\n* it.\n*\n* Note that this routine need not be called directly; it will be invoked by\n* spcx2s() and spcs2x() if spcprm::flag is anything other than a predefined\n* magic value.\n*\n* Given and returned:\n*   spc       struct spcprm*\n*                       Spectral transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null spcprm pointer passed.\n*                         2: Invalid spectral parameters.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       spcprm::err if enabled, see wcserr_enable().\n*\n*\n* spcx2s() - Transform to spectral coordinates\n* --------------------------------------------\n* spcx2s() transforms intermediate world coordinates to spectral coordinates.\n*\n* Given and returned:\n*   spc       struct spcprm*\n*                       Spectral transformation parameters.\n*\n* Given:\n*   nx        int       Vector length.\n*\n*   sx        int       Vector stride.\n*\n*   sspec     int       Vector stride.\n*\n*   x         const double[]\n*                       Intermediate world coordinates, in SI units.\n*\n* Returned:\n*   spec      double[]  Spectral coordinates, in SI units.\n*\n*   stat      int[]     Status return value status for each vector element:\n*                         0: Success.\n*                         1: Invalid value of x.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null spcprm pointer passed.\n*                         2: Invalid spectral parameters.\n*                         3: One or more of the x coordinates were invalid,\n*                            as indicated by the stat vector.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       spcprm::err if enabled, see wcserr_enable().\n*\n*\n* spcs2x() - Transform spectral coordinates\n* -----------------------------------------\n* spcs2x() transforms spectral world coordinates to intermediate world\n* coordinates.\n*\n* Given and returned:\n*   spc       struct spcprm*\n*                       Spectral transformation parameters.\n*\n* Given:\n*   nspec     int       Vector length.\n*\n*   sspec     int       Vector stride.\n*\n*   sx        int       Vector stride.\n*\n*   spec      const double[]\n*                       Spectral coordinates, in SI units.\n*\n* Returned:\n*   x         double[]  Intermediate world coordinates, in SI units.\n*\n*   stat      int[]     Status return value status for each vector element:\n*                         0: Success.\n*                         1: Invalid value of spec.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null spcprm pointer passed.\n*                         2: Invalid spectral parameters.\n*                         4: One or more of the spec coordinates were\n*                            invalid, as indicated by the stat vector.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       spcprm::err if enabled, see wcserr_enable().\n*\n*\n* spctype() - Spectral CTYPEia keyword analysis\n* ---------------------------------------------\n* spctype() checks whether a CTYPEia keyvalue is a valid spectral axis type\n* and if so returns information derived from it relating to the associated S-,\n* P-, and X-type spectral variables (see explanation above).\n*\n* The return arguments are guaranteed not be modified if CTYPEia is not a\n* valid spectral type; zero-pointers may be specified for any that are not of\n* interest.\n*\n* A deprecated form of this function, spctyp(), lacks the wcserr** parameter.\n*\n* Given:\n*   ctype     const char[9]\n*                       The CTYPEia keyvalue, (eight characters with null\n*                       termination).\n*\n* Returned:\n*   stype     char[]    The four-letter name of the S-type spectral variable\n*                       copied or translated from ctype.  If a non-zero\n*                       pointer is given, the array must accomodate a null-\n*                       terminated string of length 5.\n*\n*   scode     char[]    The three-letter spectral algorithm code copied or\n*                       translated from ctype.  Logarithmic ('LOG') and\n*                       tabular ('TAB') codes are also recognized.  If a\n*                       non-zero pointer is given, the array must accomodate a\n*                       null-terminated string of length 4.\n*\n*   sname     char[]    Descriptive name of the S-type spectral variable.\n*                       If a non-zero pointer is given, the array must\n*                       accomodate a null-terminated string of length 22.\n*\n*   units     char[]    SI units of the S-type spectral variable.  If a\n*                       non-zero pointer is given, the array must accomodate a\n*                       null-terminated string of length 8.\n*\n*   ptype     char*     Character code for the P-type spectral variable\n*                       derived from ctype, one of 'F', 'W', 'A', or 'V'.\n*\n*   xtype     char*     Character code for the X-type spectral variable\n*                       derived from ctype, one of 'F', 'W', 'A', or 'V'.\n*                       Also, 'w' and 'a' are synonymous to 'W' and 'A' for\n*                       grisms in vacuo and air respectively.  Set to 'L' or\n*                       'T' for logarithmic ('LOG') and tabular ('TAB') axes.\n*\n*   restreq   int*      Multivalued flag that indicates whether rest\n*                       frequency or wavelength is required to compute\n*                       spectral variables for this CTYPEia:\n*                         0: Not required.\n*                         1: Required for the conversion between S- and\n*                            P-types (e.g. 'ZOPT-F2W').\n*                         2: Required for the conversion between P- and\n*                            X-types (e.g. 'BETA-W2V').\n*                         3: Required for the conversion between S- and\n*                            P-types, and between P- and X-types, but not\n*                            between S- and X-types (this applies only for\n*                            'VRAD-V2F', 'VOPT-V2W', and 'ZOPT-V2W').\n*                        Thus the rest frequency or wavelength is required for\n*                        spectral coordinate computations (i.e. between S- and\n*                        X-types) only if restreq%3 != 0.\n*\n*   err       struct wcserr **\n*                       If enabled, for function return values > 1, this\n*                       struct will contain a detailed error message, see\n*                       wcserr_enable().  May be NULL if an error message is\n*                       not desired.  Otherwise, the user is responsible for\n*                       deleting the memory allocated for the wcserr struct.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         2: Invalid spectral parameters (not a spectral\n*                            CTYPEia).\n*\n*\n* spcspxe() - Spectral keyword analysis\n* ------------------------------------\n* spcspxe() analyses the CTYPEia and CRVALia FITS spectral axis keyword values\n* and returns information about the associated X-type spectral variable.\n*\n* A deprecated form of this function, spcspx(), lacks the wcserr** parameter.\n*\n* Given:\n*   ctypeS    const char[9]\n*                       Spectral axis type, i.e. the CTYPEia keyvalue, (eight\n*                       characters with null termination).  For non-grism\n*                       axes, the character code for the P-type spectral\n*                       variable in the algorithm code (i.e. the eighth\n*                       character of CTYPEia) may be set to '?' (it will not\n*                       be reset).\n*\n*   crvalS    double    Value of the S-type spectral variable at the reference\n*                       point, i.e. the CRVALia keyvalue, SI units.\n*\n*   restfrq,\n*   restwav   double    Rest frequency [Hz] and rest wavelength in vacuo [m],\n*                       only one of which need be given, the other should be\n*                       set to zero.\n*\n* Returned:\n*   ptype     char*     Character code for the P-type spectral variable\n*                       derived from ctypeS, one of 'F', 'W', 'A', or 'V'.\n*\n*   xtype     char*     Character code for the X-type spectral variable\n*                       derived from ctypeS, one of 'F', 'W', 'A', or 'V'.\n*                       Also, 'w' and 'a' are synonymous to 'W' and 'A' for\n*                       grisms in vacuo and air respectively; crvalX and dXdS\n*                       (see below) will conform to these.\n*\n*   restreq   int*      Multivalued flag that indicates whether rest frequency\n*                       or wavelength is required to compute spectral\n*                       variables for this CTYPEia, as for spctype().\n*\n*   crvalX    double*   Value of the X-type spectral variable at the reference\n*                       point, SI units.\n*\n*   dXdS      double*   The derivative, dX/dS, evaluated at the reference\n*                       point, SI units.  Multiply the CDELTia keyvalue by\n*                       this to get the pixel spacing in the X-type spectral\n*                       coordinate.\n*\n*   err       struct wcserr **\n*                       If enabled, for function return values > 1, this\n*                       struct will contain a detailed error message, see\n*                       wcserr_enable().  May be NULL if an error message is\n*                       not desired.  Otherwise, the user is responsible for\n*                       deleting the memory allocated for the wcserr struct.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         2: Invalid spectral parameters.\n*\n*\n* spcxpse() - Spectral keyword synthesis\n* -------------------------------------\n* spcxpse(), for the spectral axis type specified and the value provided for\n* the X-type spectral variable at the reference point, deduces the value of\n* the FITS spectral axis keyword CRVALia and also the derivative dS/dX which\n* may be used to compute CDELTia.  See above for an explanation of the S-,\n* P-, and X-type spectral variables.\n*\n* A deprecated form of this function, spcxps(), lacks the wcserr** parameter.\n*\n* Given:\n*   ctypeS    const char[9]\n*                       The required spectral axis type, i.e. the CTYPEia\n*                       keyvalue, (eight characters with null termination).\n*                       For non-grism axes, the character code for the P-type\n*                       spectral variable in the algorithm code (i.e. the\n*                       eighth character of CTYPEia) may be set to '?' (it\n*                       will not be reset).\n*\n*   crvalX    double    Value of the X-type spectral variable at the reference\n*                       point (N.B. NOT the CRVALia keyvalue), SI units.\n*\n*   restfrq,\n*   restwav   double    Rest frequency [Hz] and rest wavelength in vacuo [m],\n*                       only one of which need be given, the other should be\n*                       set to zero.\n*\n* Returned:\n*   ptype     char*     Character code for the P-type spectral variable\n*                       derived from ctypeS, one of 'F', 'W', 'A', or 'V'.\n*\n*   xtype     char*     Character code for the X-type spectral variable\n*                       derived from ctypeS, one of 'F', 'W', 'A', or 'V'.\n*                       Also, 'w' and 'a' are synonymous to 'W' and 'A' for\n*                       grisms; crvalX and cdeltX must conform to these.\n*\n*   restreq   int*      Multivalued flag that indicates whether rest frequency\n*                       or wavelength is required to compute spectral\n*                       variables for this CTYPEia, as for spctype().\n*\n*   crvalS    double*   Value of the S-type spectral variable at the reference\n*                       point (i.e. the appropriate CRVALia keyvalue), SI\n*                       units.\n*\n*   dSdX      double*   The derivative, dS/dX, evaluated at the reference\n*                       point, SI units.  Multiply this by the pixel spacing\n*                       in the X-type spectral coordinate to get the CDELTia\n*                       keyvalue.\n*\n*   err       struct wcserr **\n*                       If enabled, for function return values > 1, this\n*                       struct will contain a detailed error message, see\n*                       wcserr_enable().  May be NULL if an error message is\n*                       not desired.  Otherwise, the user is responsible for\n*                       deleting the memory allocated for the wcserr struct.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         2: Invalid spectral parameters.\n*\n*\n* spctrne() - Spectral keyword translation\n* ---------------------------------------\n* spctrne() translates a set of FITS spectral axis keywords into the\n* corresponding set for the specified spectral axis type.  For example, a\n* 'FREQ' axis may be translated into 'ZOPT-F2W' and vice versa.\n*\n* A deprecated form of this function, spctrn(), lacks the wcserr** parameter.\n*\n* Given:\n*   ctypeS1   const char[9]\n*                       Spectral axis type, i.e. the CTYPEia keyvalue, (eight\n*                       characters with null termination).  For non-grism\n*                       axes, the character code for the P-type spectral\n*                       variable in the algorithm code (i.e. the eighth\n*                       character of CTYPEia) may be set to '?' (it will not\n*                       be reset).\n*\n*   crvalS1   double    Value of the S-type spectral variable at the reference\n*                       point, i.e. the CRVALia keyvalue, SI units.\n*\n*   cdeltS1   double    Increment of the S-type spectral variable at the\n*                       reference point, SI units.\n*\n*   restfrq,\n*   restwav   double    Rest frequency [Hz] and rest wavelength in vacuo [m],\n*                       only one of which need be given, the other should be\n*                       set to zero.  Neither are required if the translation\n*                       is between wave-characteristic types, or between\n*                       velocity-characteristic types.  E.g., required for\n*                       'FREQ'     -> 'ZOPT-F2W', but not required for\n*                       'VELO-F2V' -> 'ZOPT-F2W'.\n*\n* Given and returned:\n*   ctypeS2   char[9]   Required spectral axis type (eight characters with\n*                       null termination).  The first four characters are\n*                       required to be given and are never modified.  The\n*                       remaining four, the algorithm code, are completely\n*                       determined by, and must be consistent with, ctypeS1\n*                       and the first four characters of ctypeS2.  A non-zero\n*                       status value will be returned if they are inconsistent\n*                       (see below).  However, if the final three characters\n*                       are specified as \"???\", or if just the eighth\n*                       character is specified as '?', the correct algorithm\n*                       code will be substituted (applies for grism axes as\n*                       well as non-grism).\n*\n* Returned:\n*   crvalS2   double*   Value of the new S-type spectral variable at the\n*                       reference point, i.e. the new CRVALia keyvalue, SI\n*                       units.\n*\n*   cdeltS2   double*   Increment of the new S-type spectral variable at the\n*                       reference point, i.e. the new CDELTia keyvalue, SI\n*                       units.\n*\n*   err       struct wcserr **\n*                       If enabled, for function return values > 1, this\n*                       struct will contain a detailed error message, see\n*                       wcserr_enable().  May be NULL if an error message is\n*                       not desired.  Otherwise, the user is responsible for\n*                       deleting the memory allocated for the wcserr struct.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         2: Invalid spectral parameters.\n*\n*                       A status value of 2 will be returned if restfrq or\n*                       restwav are not specified when required, or if ctypeS1\n*                       or ctypeS2 are self-inconsistent, or have different\n*                       spectral X-type variables.\n*\n*\n* spcaips() - Translate AIPS-convention spectral keywords\n* -------------------------------------------------------\n* spcaips() translates AIPS-convention spectral CTYPEia and VELREF keyvalues.\n*\n* Given:\n*   ctypeA    const char[9]\n*                       CTYPEia keyvalue possibly containing an\n*                       AIPS-convention spectral code (eight characters, need\n*                       not be null-terminated).\n*\n*   velref    int       AIPS-convention VELREF code.  It has the following\n*                       integer values:\n*                         1: LSR kinematic, originally described simply as\n*                            \"LSR\" without distinction between the kinematic\n*                            and dynamic definitions.\n*                         2: Barycentric, originally described as \"HEL\"\n*                            meaning heliocentric.\n*                         3: Topocentric, originally described as \"OBS\"\n*                            meaning geocentric but widely interpreted as\n*                            topocentric.\n*                       AIPS++ extensions to VELREF are also recognized:\n*                         4: LSR dynamic.\n*                         5: Geocentric.\n*                         6: Source rest frame.\n*                         7: Galactocentric.\n*\n*                       For an AIPS 'VELO' axis, a radio convention velocity\n*                       (VRAD) is denoted by adding 256 to VELREF, otherwise\n*                       an optical velocity (VOPT) is indicated (this is not\n*                       applicable to 'FREQ' or 'FELO' axes).  Setting velref\n*                       to 0 or 256 chooses between optical and radio velocity\n*                       without specifying a Doppler frame, provided that a\n*                       frame is encoded in ctypeA.  If not, i.e. for\n*                       ctypeA = 'VELO', ctype will be returned as 'VELO'.\n*\n*                       VELREF takes precedence over CTYPEia in defining the\n*                       Doppler frame, e.g.\n*\n=                         ctypeA = 'VELO-HEL'\n=                         velref = 1\n*\n*                       returns ctype = 'VOPT' with specsys set to 'LSRK'.\n*\n*                       If omitted from the header, the default value of\n*                       VELREF is 0.\n*\n* Returned:\n*   ctype     char[9]   Translated CTYPEia keyvalue, or a copy of ctypeA if no\n*                       translation was performed (in which case any trailing\n*                       blanks in ctypeA will be replaced with nulls).\n*\n*   specsys   char[9]   Doppler reference frame indicated by VELREF or else\n*                       by CTYPEia with value corresponding to the SPECSYS\n*                       keyvalue in the FITS WCS standard.  May be returned\n*                       blank if neither specifies a Doppler frame, e.g.\n*                       ctypeA = 'FELO' and velref%256 == 0.\n*\n* Function return value:\n*             int       Status return value:\n*                        -1: No translation required (not an error).\n*                         0: Success.\n*                         2: Invalid value of VELREF.\n*\n*\n* spcprm struct - Spectral transformation parameters\n* --------------------------------------------------\n* The spcprm struct contains information required to transform spectral\n* coordinates.  It consists of certain members that must be set by the user\n* (\"given\") and others that are set by the WCSLIB routines (\"returned\").  Some\n* of the latter are supplied for informational purposes while others are for\n* internal use only.\n*\n*   int flag\n*     (Given and returned) This flag must be set to zero whenever any of the\n*     following spcprm structure members are set or changed:\n*\n*       - spcprm::type,\n*       - spcprm::code,\n*       - spcprm::crval,\n*       - spcprm::restfrq,\n*       - spcprm::restwav,\n*       - spcprm::pv[].\n*\n*     This signals the initialization routine, spcset(), to recompute the\n*     returned members of the spcprm struct.  spcset() will reset flag to\n*     indicate that this has been done.\n*\n*   char type[8]\n*     (Given) Four-letter spectral variable type, e.g \"ZOPT\" for\n*     CTYPEia = 'ZOPT-F2W'.  (Declared as char[8] for alignment reasons.)\n*\n*   char code[4]\n*     (Given) Three-letter spectral algorithm code, e.g \"F2W\" for\n*     CTYPEia = 'ZOPT-F2W'.\n*\n*   double crval\n*     (Given) Reference value (CRVALia), SI units.\n*\n*   double restfrq\n*     (Given) The rest frequency [Hz], and ...\n*\n*   double restwav\n*     (Given) ... the rest wavelength in vacuo [m], only one of which need be\n*     given, the other should be set to zero.  Neither are required if the\n*     X and S spectral variables are both wave-characteristic, or both\n*     velocity-characteristic, types.\n*\n*   double pv[7]\n*     (Given) Grism parameters for 'GRI' and 'GRA' algorithm codes:\n*       - 0: G, grating ruling density.\n*       - 1: m, interference order.\n*       - 2: alpha, angle of incidence [deg].\n*       - 3: n_r, refractive index at the reference wavelength, lambda_r.\n*       - 4: n'_r, dn/dlambda at the reference wavelength, lambda_r (/m).\n*       - 5: epsilon, grating tilt angle [deg].\n*       - 6: theta, detector tilt angle [deg].\n*\n* The remaining members of the spcprm struct are maintained by spcset() and\n* must not be modified elsewhere:\n*\n*   double w[6]\n*     (Returned) Intermediate values:\n*       - 0: Rest frequency or wavelength (SI).\n*       - 1: The value of the X-type spectral variable at the reference point\n*           (SI units).\n*       - 2: dX/dS at the reference point (SI units).\n*      The remainder are grism intermediates.\n*\n*   int isGrism\n*     (Returned) Grism coordinates?\n*       - 0: no,\n*       - 1: in vacuum,\n*       - 2: in air.\n*\n*   int padding1\n*     (An unused variable inserted for alignment purposes only.)\n*\n*   struct wcserr *err\n*     (Returned) If enabled, when an error status is returned, this struct\n*     contains detailed information about the error, see wcserr_enable().\n*\n*   void *padding2\n*     (An unused variable inserted for alignment purposes only.)\n*   int (*spxX2P)(SPX_ARGS)\n*     (Returned) The first and ...\n*   int (*spxP2S)(SPX_ARGS)\n*     (Returned) ... the second of the pointers to the transformation\n*     functions in the two-step algorithm chain X -> P -> S in the\n*     pixel-to-spectral direction where the non-linear transformation is from\n*     X to P.  The argument list, SPX_ARGS, is defined in spx.h.\n*\n*   int (*spxS2P)(SPX_ARGS)\n*     (Returned) The first and ...\n*   int (*spxP2X)(SPX_ARGS)\n*     (Returned) ... the second of the pointers to the transformation\n*     functions in the two-step algorithm chain S -> P -> X in the\n*     spectral-to-pixel direction where the non-linear transformation is from\n*     P to X.  The argument list, SPX_ARGS, is defined in spx.h.\n*\n*\n* Global variable: const char *spc_errmsg[] - Status return messages\n* ------------------------------------------------------------------\n* Error messages to match the status value returned from each function.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_SPC\n#define WCSLIB_SPC\n\n#include \"spx.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\nextern const char *spc_errmsg[];\n\nenum spc_errmsg_enum {\n  SPCERR_NO_CHANGE       = -1,\t// No change.\n  SPCERR_SUCCESS         =  0,\t// Success.\n  SPCERR_NULL_POINTER    =  1,\t// Null spcprm pointer passed.\n  SPCERR_BAD_SPEC_PARAMS =  2,\t// Invalid spectral parameters.\n  SPCERR_BAD_X           =  3,\t// One or more of x coordinates were\n\t\t\t\t// invalid.\n  SPCERR_BAD_SPEC        =  4 \t// One or more of the spec coordinates were\n\t\t\t\t// invalid.\n};\n\nstruct spcprm {\n  // Initialization flag (see the prologue above).\n  //--------------------------------------------------------------------------\n  int    flag;\t\t\t// Set to zero to force initialization.\n\n  // Parameters to be provided (see the prologue above).\n  //--------------------------------------------------------------------------\n  char   type[8];\t\t// Four-letter spectral variable type.\n  char   code[4];\t\t// Three-letter spectral algorithm code.\n\n  double crval;\t\t\t// Reference value (CRVALia), SI units.\n  double restfrq;\t\t// Rest frequency, Hz.\n  double restwav;\t\t// Rest wavelength, m.\n\n  double pv[7];\t\t\t// Grism parameters:\n\t\t\t\t//   0: G, grating ruling density.\n\t\t\t\t//   1: m, interference order.\n\t\t\t\t//   2: alpha, angle of incidence.\n\t\t\t\t//   3: n_r, refractive index at lambda_r.\n\t\t\t\t//   4: n'_r, dn/dlambda at lambda_r.\n\t\t\t\t//   5: epsilon, grating tilt angle.\n\t\t\t\t//   6: theta, detector tilt angle.\n\n  // Information derived from the parameters supplied.\n  //--------------------------------------------------------------------------\n  double w[6];\t\t\t// Intermediate values.\n\t\t\t\t//   0: Rest frequency or wavelength (SI).\n\t\t\t\t//   1: CRVALX (SI units).\n\t\t\t\t//   2: CDELTX/CDELTia = dX/dS (SI units).\n\t\t\t\t// The remainder are grism intermediates.\n\n  int    isGrism;\t\t// Grism coordinates?  1: vacuum, 2: air.\n  int    padding1;\t\t// (Dummy inserted for alignment purposes.)\n\n  // Error handling\n  //--------------------------------------------------------------------------\n  struct wcserr *err;\n\n  // Private\n  //--------------------------------------------------------------------------\n  void   *padding2;\t\t// (Dummy inserted for alignment purposes.)\n  int (*spxX2P)(SPX_ARGS);\t// Pointers to the transformation functions\n  int (*spxP2S)(SPX_ARGS);\t// in the two-step algorithm chain in the\n\t\t\t\t// pixel-to-spectral direction.\n\n  int (*spxS2P)(SPX_ARGS);\t// Pointers to the transformation functions\n  int (*spxP2X)(SPX_ARGS);\t// in the two-step algorithm chain in the\n\t\t\t\t// spectral-to-pixel direction.\n};\n\n// Size of the spcprm struct in int units, used by the Fortran wrappers.\n#define SPCLEN (sizeof(struct spcprm)/sizeof(int))\n\n\nint spcini(struct spcprm *spc);\n\nint spcfree(struct spcprm *spc);\n\nint spcsize(const struct spcprm *spc, int sizes[2]);\n\nint spcprt(const struct spcprm *spc);\n\nint spcperr(const struct spcprm *spc, const char *prefix);\n\nint spcset(struct spcprm *spc);\n\nint spcx2s(struct spcprm *spc, int nx, int sx, int sspec,\n           const double x[], double spec[], int stat[]);\n\nint spcs2x(struct spcprm *spc, int nspec, int sspec, int sx,\n           const double spec[], double x[], int stat[]);\n\nint spctype(const char ctype[9], char stype[], char scode[], char sname[],\n            char units[], char *ptype, char *xtype, int *restreq,\n            struct wcserr **err);\n\nint spcspxe(const char ctypeS[9], double crvalS, double restfrq,\n            double restwav, char *ptype, char *xtype, int *restreq,\n            double *crvalX, double *dXdS, struct wcserr **err);\n\nint spcxpse(const char ctypeS[9], double crvalX, double restfrq,\n            double restwav, char *ptype, char *xtype, int *restreq,\n            double *crvalS, double *dSdX, struct wcserr **err);\n\nint spctrne(const char ctypeS1[9], double crvalS1, double cdeltS1,\n            double restfrq, double restwav, char ctypeS2[9], double *crvalS2,\n            double *cdeltS2, struct wcserr **err);\n\nint spcaips(const char ctypeA[9], int velref, char ctype[9], char specsys[9]);\n\n\n// Deprecated.\n#define spcini_errmsg spc_errmsg\n#define spcprt_errmsg spc_errmsg\n#define spcset_errmsg spc_errmsg\n#define spcx2s_errmsg spc_errmsg\n#define spcs2x_errmsg spc_errmsg\n\nint spctyp(const char ctype[9], char stype[], char scode[], char sname[],\n           char units[], char *ptype, char *xtype, int *restreq);\nint spcspx(const char ctypeS[9], double crvalS, double restfrq,\n           double restwav, char *ptype, char *xtype, int *restreq,\n           double *crvalX, double *dXdS);\nint spcxps(const char ctypeS[9], double crvalX, double restfrq,\n           double restwav, char *ptype, char *xtype, int *restreq,\n           double *crvalS, double *dSdX);\nint spctrn(const char ctypeS1[9], double crvalS1, double cdeltS1,\n           double restfrq, double restwav, char ctypeS2[9], double *crvalS2,\n           double *cdeltS2);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WCSLIB_SPC\n"},{"id":16586,"name":"wcshdr.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcshdr.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <ctype.h>\n#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"wcserr.h\"\n#include \"wcsmath.h\"\n#include \"wcsutil.h\"\n#include \"wcshdr.h\"\n#include \"wtbarr.h\"\n#include \"tab.h\"\n#include \"dis.h\"\n#include \"wcs.h\"\n\nextern const int WCSSET;\n\nextern const int DIS_DOTPD;\n\n// Map status return value to message.\nconst char *wcshdr_errmsg[] = {\n  \"Success\",\n  \"Null wcsprm pointer passed\",\n  \"Memory allocation failed\",\n  \"Invalid column selection\",\n  \"Fatal error returned by Flex parser\",\n  \"Invalid tabular parameters\"};\n\n// Map error returns for lower-level routines.\nconst int wcshdr_taberr[] = {\n  WCSHDRERR_SUCCESS,\t\t//  0: TABERR_SUCCESS\n  WCSHDRERR_NULL_POINTER,\t//  1: TABERR_NULL_POINTER\n  WCSHDRERR_MEMORY,\t\t//  2: TABERR_MEMORY\n  WCSHDRERR_BAD_TABULAR_PARAMS\t//  3: TABERR_BAD_PARAMS\n\t\t\t\t//  4: TABERR_BAD_X\n\t\t\t\t//  5: TABERR_BAD_WORLD\n};\n\n// Convenience macro for invoking wcserr_set().\n#define WCSHDR_ERRMSG(status) WCSERR_SET(status), wcshdr_errmsg[status]\n\n// Internal helper functions, not for general use.\nstatic void wcshdo_format(int, int, const double [], char *);\nstatic void wcshdo_tpdterm(int, int, char *);\nstatic void wcshdo_util(int, const char [], const char [], int, const char [],\n  int, int, int, char, int, int [], char [], const char [], int *, char **,\n  int *);\n\n//----------------------------------------------------------------------------\n\nint wcstab(struct wcsprm *wcs)\n\n{\n  static const char *function = \"wcstab\";\n\n  char (*PSi_0a)[72] = 0x0, (*PSi_1a)[72] = 0x0, (*PSi_2a)[72] = 0x0;\n  int  *PVi_1a = 0x0, *PVi_2a = 0x0, *PVi_3a = 0x0, *tabax, *tabidx = 0x0;\n  int   getcrd, i, ip, itab, itabax, j, jtabax, m, naxis, ntabax, status;\n  struct wtbarr *wtbp;\n  struct tabprm *tabp;\n  struct wcserr **err;\n\n  if (wcs == 0x0) return WCSHDRERR_NULL_POINTER;\n  err = &(wcs->err);\n\n  // Free memory previously allocated by wcstab().\n  if (wcs->flag != -1 && wcs->m_flag == WCSSET) {\n    if (wcs->wtb == wcs->m_wtb) wcs->wtb = 0x0;\n    if (wcs->tab == wcs->m_tab) wcs->tab = 0x0;\n\n    if (wcs->m_wtb) free(wcs->m_wtb);\n    if (wcs->m_tab) {\n      for (j = 0; j < wcs->ntab; j++) {\n        tabfree(wcs->m_tab + j);\n      }\n\n      free(wcs->m_tab);\n    }\n  }\n\n  wcs->ntab = 0;\n  wcs->nwtb = 0;\n  wcs->wtb  = 0x0;\n  wcs->tab  = 0x0;\n\n\n  // Determine the number of -TAB axes.\n  naxis = wcs->naxis;\n  if (!(tabax = calloc(naxis, sizeof(int)))) {\n    return wcserr_set(WCSHDR_ERRMSG(WCSHDRERR_MEMORY));\n  }\n\n  ntabax = 0;\n  for (i = 0; i < naxis; i++) {\n    // Null fill.\n    wcsutil_null_fill(72, wcs->ctype[i]);\n\n    if (!strcmp(wcs->ctype[i]+4, \"-TAB\")) {\n      tabax[i] = ntabax++;\n    } else {\n      tabax[i] = -1;\n    }\n  }\n\n  if (ntabax == 0) {\n    // No lookup tables.\n    status = 0;\n    goto cleanup;\n  }\n\n\n  // Collect information from the PSi_ma and PVi_ma keyvalues.\n  if (!((PSi_0a = calloc(ntabax, sizeof(char[72]))) &&\n        (PVi_1a = calloc(ntabax, sizeof(int)))      &&\n        (PVi_2a = calloc(ntabax, sizeof(int)))      &&\n        (PSi_1a = calloc(ntabax, sizeof(char[72]))) &&\n        (PSi_2a = calloc(ntabax, sizeof(char[72]))) &&\n        (PVi_3a = calloc(ntabax, sizeof(int)))      &&\n        (tabidx = calloc(ntabax, sizeof(int))))) {\n    status = wcserr_set(WCSHDR_ERRMSG(WCSHDRERR_MEMORY));\n    goto cleanup;\n  }\n\n  for (itabax = 0; itabax < ntabax; itabax++) {\n    // Remember that calloc() zeroes allocated memory.\n    PVi_1a[itabax] = 1;\n    PVi_2a[itabax] = 1;\n    PVi_3a[itabax] = 1;\n  }\n\n  for (ip = 0; ip < wcs->nps; ip++) {\n    itabax = tabax[wcs->ps[ip].i - 1];\n    if (itabax >= 0) {\n      switch (wcs->ps[ip].m) {\n      case 0:\n        // EXTNAME.\n        strcpy(PSi_0a[itabax], wcs->ps[ip].value);\n        wcsutil_null_fill(72, PSi_0a[itabax]);\n        break;\n      case 1:\n        // TTYPEn for coordinate array.\n        strcpy(PSi_1a[itabax], wcs->ps[ip].value);\n        wcsutil_null_fill(72, PSi_1a[itabax]);\n        break;\n      case 2:\n        // TTYPEn for index vector.\n        strcpy(PSi_2a[itabax], wcs->ps[ip].value);\n        wcsutil_null_fill(72, PSi_2a[itabax]);\n        break;\n      }\n    }\n  }\n\n  for (ip = 0; ip < wcs->npv; ip++) {\n    itabax = tabax[wcs->pv[ip].i - 1];\n    if (itabax >= 0) {\n      switch (wcs->pv[ip].m) {\n      case 1:\n        // EXTVER.\n        PVi_1a[itabax] = (int)(wcs->pv[ip].value + 0.5);\n        break;\n      case 2:\n        // EXTLEVEL.\n        PVi_2a[itabax] = (int)(wcs->pv[ip].value + 0.5);\n        break;\n      case 3:\n        // Table axis number.\n        PVi_3a[itabax] = (int)(wcs->pv[ip].value + 0.5);\n        break;\n      }\n    }\n  }\n\n\n  // Determine the number of independent tables.\n  for (itabax = 0; itabax < ntabax; itabax++) {\n    // These have no defaults.\n    if (!PSi_0a[itabax][0] || !PSi_1a[itabax][0]) {\n      status = wcserr_set(WCSERR_SET(WCSHDRERR_BAD_TABULAR_PARAMS),\n        \"Invalid tabular parameters: PSi_0a and PSi_1a must be specified\");\n      goto cleanup;\n    }\n\n    tabidx[itabax] = -1;\n    for (jtabax = 0; jtabax < i; jtabax++) {\n      // EXTNAME, EXTVER, EXTLEVEL, and TTYPEn for the coordinate array\n      // must match for each axis of a multi-dimensional lookup table.\n      if (strcmp(PSi_0a[itabax], PSi_0a[jtabax]) == 0 &&\n          strcmp(PSi_1a[itabax], PSi_1a[jtabax]) == 0 &&\n          PVi_1a[itabax] == PVi_1a[jtabax] &&\n          PVi_2a[itabax] == PVi_2a[jtabax]) {\n        tabidx[itabax] = tabidx[jtabax];\n        break;\n      }\n    }\n\n    if (jtabax == itabax) {\n      tabidx[itabax] = wcs->ntab;\n      wcs->ntab++;\n    }\n  }\n\n  if (!(wcs->tab = calloc(wcs->ntab, sizeof(struct tabprm)))) {\n    status = wcserr_set(WCSHDR_ERRMSG(WCSHDRERR_MEMORY));\n    goto cleanup;\n  }\n  wcs->m_tab = wcs->tab;\n\n  // Table dimensionality; find the largest axis number.\n  for (itabax = 0; itabax < ntabax; itabax++) {\n    tabp = wcs->tab + tabidx[itabax];\n\n    // PVi_3a records the 1-relative table axis number.\n    if (PVi_3a[itabax] > tabp->M) {\n      tabp->M = PVi_3a[itabax];\n    }\n  }\n\n  for (itab = 0; itab < wcs->ntab; itab++) {\n    if ((status = tabini(1, wcs->tab[itab].M, 0, wcs->tab + itab))) {\n      status = wcserr_set(WCSHDR_ERRMSG(wcshdr_taberr[status]));\n      goto cleanup;\n    }\n  }\n\n\n  // Copy parameters into the tabprm structs.\n  for (i = 0; i < naxis; i++) {\n    if ((itabax = tabax[i]) < 0) {\n      // Not a -TAB axis.\n      continue;\n    }\n\n    // PVi_3a records the 1-relative table axis number.\n    m = PVi_3a[itabax] - 1;\n\n    tabp = wcs->tab + tabidx[itabax];\n    tabp->map[m] = i;\n    tabp->crval[m] = wcs->crval[i];\n  }\n\n  // Check for completeness.\n  for (itab = 0; itab < wcs->ntab; itab++) {\n    for (m = 0; m < wcs->tab[itab].M; m++) {\n      if (wcs->tab[itab].map[m] < 0) {\n        status = wcserr_set(WCSERR_SET(WCSHDRERR_BAD_TABULAR_PARAMS),\n          \"Invalid tabular parameters: the axis mapping is undefined\");\n        goto cleanup;\n      }\n    }\n  }\n\n\n  // Set up for reading the arrays; how many arrays are there?\n  for (itabax = 0; itabax < ntabax; itabax++) {\n    // Does this -TAB axis have a non-degenerate index array?\n    if (PSi_2a[itabax][0]) {\n      wcs->nwtb++;\n    }\n  }\n\n  // Add one coordinate array for each table.\n  wcs->nwtb += wcs->ntab;\n\n  // Allocate memory for structs to be returned.\n  if (!(wcs->wtb = calloc(wcs->nwtb, sizeof(struct wtbarr)))) {\n    wcs->nwtb = 0;\n\n    status = wcserr_set(WCSHDR_ERRMSG(WCSHDRERR_MEMORY));\n    goto cleanup;\n  }\n  wcs->m_wtb = wcs->wtb;\n\n  // Set pointers for the index and coordinate arrays.\n  wtbp = wcs->wtb;\n  for (itab = 0; itab < wcs->ntab; itab++) {\n    getcrd = 1;\n    for (itabax = 0; itabax < ntabax; itabax++) {\n      if (tabidx[itabax] != itab) continue;\n\n      if (getcrd) {\n        // Coordinate array.\n        wtbp->i = itabax + 1;\n        wtbp->m = PVi_3a[itabax];\n        wtbp->kind = 'c';\n\n        strcpy(wtbp->extnam, PSi_0a[itabax]);\n        wtbp->extver = PVi_1a[itabax];\n        wtbp->extlev = PVi_2a[itabax];\n        strcpy(wtbp->ttype, PSi_1a[itabax]);\n        wtbp->row    = 1L;\n        wtbp->ndim   = wcs->tab[itab].M + 1;\n        wtbp->dimlen = wcs->tab[itab].K;\n        wtbp->arrayp = &(wcs->tab[itab].coord);\n\n        // Signal for tabset() to take this memory.\n        wcs->tab[itab].m_coord = (double *)0x1;\n\n        wtbp++;\n        getcrd = 0;\n      }\n\n      if (PSi_2a[itabax][0]) {\n        // Index array.\n        wtbp->i = itabax + 1;\n        wtbp->m = PVi_3a[itabax];\n        wtbp->kind = 'i';\n\n        m = wtbp->m - 1;\n        strcpy(wtbp->extnam, PSi_0a[itabax]);\n        wtbp->extver = PVi_1a[itabax];\n        wtbp->extlev = PVi_2a[itabax];\n        strcpy(wtbp->ttype, PSi_2a[itabax]);\n        wtbp->row    = 1L;\n        wtbp->ndim   = 1;\n        wtbp->dimlen = wcs->tab[itab].K + m;\n        wtbp->arrayp = wcs->tab[itab].index + m;\n\n        // Signal for tabset() to take this memory.\n        wcs->tab[itab].m_indxs[m] = (double *)0x1;\n\n        wtbp++;\n      }\n    }\n  }\n\n  status = 0;\n\ncleanup:\n  if (tabax)  free(tabax);\n  if (tabidx) free(tabidx);\n  if (PSi_0a) free(PSi_0a);\n  if (PVi_1a) free(PVi_1a);\n  if (PVi_2a) free(PVi_2a);\n  if (PSi_1a) free(PSi_1a);\n  if (PSi_2a) free(PSi_2a);\n  if (PVi_3a) free(PVi_3a);\n\n  if (status) {\n    if (wcs->tab) free(wcs->tab);\n    if (wcs->wtb) free(wcs->wtb);\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsidx(int nwcs, struct wcsprm **wcs, int alts[27])\n\n{\n  int a, iwcs;\n  struct wcsprm *wcsp;\n\n  for (a = 0; a < 27; a++) {\n    alts[a] = -1;\n  }\n\n  if (wcs == 0x0) {\n    return WCSHDRERR_NULL_POINTER;\n  }\n\n  wcsp = *wcs;\n  for (iwcs = 0; iwcs < nwcs; iwcs++, wcsp++) {\n    if (wcsp->colnum || wcsp->colax[0]) continue;\n\n    if (wcsp->alt[0] == ' ') {\n      a = 0;\n    } else {\n      a = wcsp->alt[0] - 'A' + 1;\n    }\n\n    alts[a] = iwcs;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsbdx(int nwcs, struct wcsprm **wcs, int type, short alts[1000][28])\n\n{\n  short  *ip;\n  int    a, i, icol, iwcs;\n  struct wcsprm *wcsp;\n\n  for (ip = alts[0]; ip < alts[0] + 28*1000; ip++) {\n    *ip = -1;\n  }\n\n  for (icol = 0; icol < 1000; icol++) {\n    alts[icol][27] = 0;\n  }\n\n  if (wcs == 0x0) {\n    return WCSHDRERR_NULL_POINTER;\n  }\n\n  wcsp = *wcs;\n  for (iwcs = 0; iwcs < nwcs; iwcs++, wcsp++) {\n    if (wcsp->alt[0] == ' ') {\n      a = 0;\n    } else {\n      a = wcsp->alt[0] - 'A' + 1;\n    }\n\n    if (type) {\n      // Pixel list.\n      if (wcsp->colax[0]) {\n        for (i = 0; i < wcsp->naxis; i++) {\n          alts[wcsp->colax[i]][a]  = iwcs;\n          alts[wcsp->colax[i]][27]++;\n        }\n      } else if (!wcsp->colnum) {\n        alts[0][a]  = iwcs;\n        alts[0][27]++;\n      }\n\n    } else {\n      // Binary table image array.\n      if (wcsp->colnum) {\n        alts[wcsp->colnum][a] = iwcs;\n        alts[wcsp->colnum][27]++;\n      } else if (!wcsp->colax[0]) {\n        alts[0][a]  = iwcs;\n        alts[0][27]++;\n      }\n    }\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsvfree(int *nwcs, struct wcsprm **wcs)\n\n{\n  int a, status = 0;\n  struct wcsprm *wcsp;\n\n  if (wcs == 0x0) {\n    return WCSHDRERR_NULL_POINTER;\n  }\n\n  wcsp = *wcs;\n  for (a = 0; a < *nwcs; a++, wcsp++) {\n    status |= wcsfree(wcsp);\n  }\n\n  free(*wcs);\n\n  *nwcs = 0;\n  *wcs = 0x0;\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n// Matching the definitions in dis.c.\n#define I_DTYPE   0\t// Distortion type code.\n#define I_NIPARM  1\t// Full (allocated) length of iparm[].\n#define I_NDPARM  2\t// No. of parameters in dparm[], excl. work space.\n#define I_TPDNCO  3\t// No. of TPD coefficients, forward...\n#define I_TPDINV  4\t// ...and inverse.\n#define I_TPDAUX  5\t// True if auxiliary variables are used.\n#define I_TPDRAD  6\t// True if the radial variable is used.\n\nint wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header)\n\n// ::: CUBEFACE and STOKES handling?\n\n{\n  static const char *function = \"wcshdo\";\n\n  const char axid[] = \"xyxuvu\", *cp;\n  const int  nTPD[] = {1, 4, 7, 12, 17, 24, 31, 40, 49, 60};\n\n  char alt, comment[72], ctemp[32], *ctypei, format[16], fmt01[8],\n       keyvalue[96], keyword[16], *kp, obsg[8] = \"OBSG?\",\n       obsgeo[8] = \"OBSGEO-?\", pq, ptype, xtype, term[16], timeunit[16],\n       tpdsrc[24], xyz[] = \"XYZ\";\n  int  *axmap, bintab, *colax, colnum, degree, direct = 0, doaux = 0, dofmt,\n       dosip, dotpd, dotpv, i, idis, idp, *iparm, j, jhat, k, kp0, kpi, m,\n       naxis, ncoeff, Nhat, p, pixlist, precision, primage, q, status = 0;\n  double *dparm, keyval;\n  struct auxprm *aux;\n  struct disprm *dis;\n  struct dpkey  *keyp;\n  struct wcserr **err;\n\n  *nkeyrec = 0;\n  *header  = 0x0;\n\n  if (wcs == 0x0) return WCSHDRERR_NULL_POINTER;\n  err = &(wcs->err);\n\n  if (wcs->flag != WCSSET) {\n    if ((status = wcsset(wcs))) return status;\n  }\n\n  if ((naxis = wcs->naxis) == 0) {\n    return 0;\n  }\n\n\n  // These are mainly for convenience.\n  alt = wcs->alt[0];\n  if (alt == ' ') alt = '\\0';\n  colnum = wcs->colnum;\n  colax  = wcs->colax;\n\n  primage = 0;\n  bintab  = 0;\n  pixlist = 0;\n  if (colnum) {\n    bintab  = 1;\n  } else if (colax[0]) {\n    pixlist = 1;\n  } else {\n    primage = 1;\n  }\n\n\n  // Initialize floating point format control.\n  *format = '\\0';\n  if (ctrl & WCSHDO_P17) {\n    strcpy(format, \"% 20.17G\");\n  } else if (ctrl & WCSHDO_P16) {\n    strcpy(format, \"% 20.16G\");\n  } else if (ctrl & WCSHDO_P15) {\n    strcpy(format, \"% 20.15G\");\n  } else if (ctrl & WCSHDO_P14) {\n    strcpy(format, \"% 20.14G\");\n  } else if (ctrl & WCSHDO_P13) {\n    strcpy(format, \"% 20.13G\");\n  } else if (ctrl & WCSHDO_P12) {\n    strcpy(format, \"%20.12G\");\n  }\n\n  if (*format && (ctrl & WCSHDO_EFMT)) {\n    if (format[6] == 'G') {\n      format[6] = 'E';\n    } else {\n      format[7] = 'E';\n    }\n  }\n\n  dofmt = (*format == '\\0');\n\n\n  // WCS dimension.\n  if (!pixlist) {\n    sprintf(keyvalue, \"%20d\", naxis);\n    wcshdo_util(ctrl, \"WCSAXES\", \"WCAX\", 0, 0x0, 0, 0, 0, alt, colnum, colax,\n      keyvalue, \"Number of coordinate axes\", nkeyrec, header, &status);\n  }\n\n  // Reference pixel coordinates.\n  if (dofmt) wcshdo_format('G', naxis, wcs->crpix, format);\n  for (j = 0; j < naxis; j++) {\n    wcsutil_double2str(keyvalue, format, wcs->crpix[j]);\n    wcshdo_util(ctrl, \"CRPIX\", \"CRP\", WCSHDO_CRPXna, \"CRPX\", 0, j+1, 0, alt,\n      colnum, colax, keyvalue, \"Pixel coordinate of reference point\", nkeyrec,\n      header, &status);\n  }\n\n  // Linear transformation matrix.\n  if (dofmt) wcshdo_format('G', naxis*naxis, wcs->pc, format);\n  k = 0;\n  for (i = 0; i < naxis; i++) {\n    for (j = 0; j < naxis; j++, k++) {\n      if (i == j) {\n        if (wcs->pc[k] == 1.0) continue;\n      } else {\n        if (wcs->pc[k] == 0.0) continue;\n      }\n\n      wcsutil_double2str(keyvalue, format, wcs->pc[k]);\n      wcshdo_util(ctrl, \"PC\", bintab ? \"PC\" : \"P\", WCSHDO_TPCn_ka,\n        bintab ? 0x0 : \"PC\", i+1, j+1, 0, alt, colnum, colax,\n        keyvalue, \"Coordinate transformation matrix element\",\n        nkeyrec, header, &status);\n    }\n  }\n\n  // Coordinate increment at reference point.\n  if (dofmt) wcshdo_format('G', naxis, wcs->cdelt, format);\n  for (i = 0; i < naxis; i++) {\n    wcsutil_double2str(keyvalue, format, wcs->cdelt[i]);\n    comment[0] = '\\0';\n    if (wcs->cunit[i][0]) sprintf(comment, \"[%s] \", wcs->cunit[i]);\n    strcat(comment, \"Coordinate increment at reference point\");\n    wcshdo_util(ctrl, \"CDELT\", \"CDE\", WCSHDO_CRPXna, \"CDLT\", i+1, 0, 0, alt,\n      colnum, colax, keyvalue, comment, nkeyrec, header, &status);\n  }\n\n  // Units of coordinate increment and reference value.\n  for (i = 0; i < naxis; i++) {\n    if (wcs->cunit[i][0] == '\\0') continue;\n\n    sprintf(keyvalue, \"'%s'\", wcs->cunit[i]);\n    wcshdo_util(ctrl, \"CUNIT\", \"CUN\", WCSHDO_CRPXna, \"CUNI\", i+1, 0, 0, alt,\n      colnum, colax, keyvalue, \"Units of coordinate increment and value\",\n      nkeyrec, header, &status);\n  }\n\n  // May need to alter ctype for particular distortions so do basic checks\n  // now.  Note that SIP, TPV, DSS, TNX, and ZPX are restricted to exactly\n  // two axes and cannot coexist with other distortion types.\n  dosip = 0;\n  dotpv = 0;\n  dotpd = 0;\n\n  if ((dis = wcs->lin.dispre)) {\n    for (i = 0; i < naxis; i++) {\n      if (strcmp(dis->dtype[i], \"SIP\") == 0) {\n        // Simple Imaging Polynomial (SIP).  Write it in its native form\n        // if possible, unless specifically requested to write it as TPD.\n        dotpd = (dis->iparm[i][I_DTYPE] & DIS_DOTPD);\n\n        if (!dotpd) {;\n          if (alt ||\n              dis->Nhat[0]      != 2 ||\n              dis->Nhat[1]      != 2 ||\n              dis->axmap[0][0]  != 0 ||\n              dis->axmap[0][1]  != 1 ||\n              dis->axmap[1][0]  != 0 ||\n              dis->axmap[1][1]  != 1 ||\n              dis->offset[0][0] != wcs->crpix[0] ||\n              dis->offset[0][1] != wcs->crpix[1] ||\n              dis->offset[1][0] != wcs->crpix[0] ||\n              dis->offset[1][1] != wcs->crpix[1] ||\n              dis->scale[0][0]  != 1.0 ||\n              dis->scale[0][1]  != 1.0 ||\n              dis->scale[1][0]  != 1.0 ||\n              dis->scale[1][1]  != 1.0) {\n            // Must have been read as a 'SIP' distortion, CPDISja = 'SIP'.\n            // Cannot be written as native SIP so write it as TPD.\n            dotpd = DIS_DOTPD;\n          } else if (strncmp(wcs->ctype[0], \"RA---TAN\", 8) ||\n                     strncmp(wcs->ctype[1], \"DEC--TAN\", 8)) {\n            // Must have been permuted by wcssub().\n            // Native SIP doesn't have axis mapping so write it as TPD.\n            dotpd = DIS_DOTPD;\n          }\n\n          if (dotpd) {\n            strcpy(tpdsrc, \"SIP coordinates\");\n          } else {\n            dosip = 1;\n          }\n        }\n\n        break;\n      }\n    }\n  }\n\n  if ((dis = wcs->lin.disseq)) {\n    for (i = 0; i < naxis; i++) {\n      if (strcmp(dis->dtype[i], \"TPV\") == 0) {\n        // TPV \"projection\".  Write it in its native form if possible,\n        // unless specifically requested to write it as TPD.\n        dotpd = (dis->iparm[i][I_DTYPE] & DIS_DOTPD);\n\n        if (!dotpd) {;\n          if (dis->axmap[wcs->lng][0] != wcs->lng ||\n              dis->axmap[wcs->lng][1] != wcs->lat ||\n              dis->axmap[wcs->lat][0] != wcs->lat ||\n              dis->axmap[wcs->lat][1] != wcs->lng ||\n              dis->offset[wcs->lng][wcs->lng] != 0.0 ||\n              dis->offset[wcs->lng][wcs->lat] != 0.0 ||\n              dis->offset[wcs->lat][wcs->lng] != 0.0 ||\n              dis->offset[wcs->lat][wcs->lat] != 0.0 ||\n              dis->scale[wcs->lng][wcs->lng]  != 1.0 ||\n              dis->scale[wcs->lng][wcs->lat]  != 1.0 ||\n              dis->scale[wcs->lat][wcs->lng]  != 1.0 ||\n              dis->scale[wcs->lat][wcs->lat]  != 1.0) {\n            // Must have been read as a 'TPV' distortion, CPDISja = 'TPV'.\n            // Cannot be written as native TPV so write it as TPD.\n            dotpd = DIS_DOTPD;\n          }\n\n          if (dotpd) {\n            strcpy(tpdsrc, \"TPV \\\"projection\\\"\");\n          } else {\n            dotpv = 1;\n          }\n        }\n\n        break;\n\n      } else if (strcmp(dis->dtype[i], \"DSS\") == 0) {\n        // Always written as TPD.\n        dotpd = DIS_DOTPD;\n        strcpy(tpdsrc, dis->dtype[i]);\n\n      } else if (strncmp(dis->dtype[i], \"WAT\", 3) == 0) {\n        // Always written as TPD.\n        dotpd = DIS_DOTPD;\n        strcpy(tpdsrc, dis->dtype[i]+4);\n\n        if (strcmp(dis->dtype[i], \"DSS\") == 0) {\n          strcpy(tpdsrc, wcs->wcsname);\n        } else {\n          strcat(tpdsrc, \" \\\"projection\\\"\");\n        }\n\n        break;\n      }\n    }\n  }\n\n  // Coordinate type.\n  for (i = 0; i < naxis; i++) {\n    if (wcs->ctype[i][0] == '\\0') continue;\n\n    sprintf(keyvalue, \"'%s'\", wcs->ctype[i]);\n    strcpy(comment, \"Coordinate type code\");\n\n    ctypei = keyvalue + 1;\n    if (i == wcs->lng || i == wcs->lat) {\n      // Alter ctype for particular distortions.\n      if (dosip) {\n        // It could have come in as CPDISja = 'SIP'.\n        strcpy(ctypei+8, \"-SIP'\");\n      } else if (dotpv) {\n        // Reinstate projection code edited by wcsset().\n        strcpy(ctypei+4, \"-TPV'\");\n      }\n\n      if (strncmp(ctypei+8, \"-SIP\", 4) == 0) {\n        strcpy(comment, \"TAN (gnomonic) projection + SIP distortions\");\n\n      } else if (strncmp(ctypei+4, \"-TPV\", 4) == 0) {\n        strcpy(comment, \"TAN (gnomonic) projection + distortions\");\n\n      } else {\n        if (strncmp(ctypei, \"RA--\", 4) == 0) {\n          strcpy(comment, \"Right ascension, \");\n\n        } else if (strncmp(ctypei, \"DEC-\", 4) == 0) {\n          strcpy(comment, \"Declination, \");\n\n        } else if (strncmp(ctypei+1, \"LON\", 3) == 0 ||\n                   strncmp(ctypei+1, \"LAT\", 3) == 0) {\n          ctypei[0] = toupper(ctypei[0]);\n\n          switch (ctypei[0]) {\n          case 'G':\n            strcpy(comment, \"galactic \");\n            break;\n          case 'E':\n            strcpy(comment, \"ecliptic \");\n            break;\n          case 'H':\n            strcpy(comment, \"helioecliptic \");\n            break;\n          case 'S':\n            strcpy(comment, \"supergalactic \");\n            break;\n          }\n\n          if (i == wcs->lng) {\n            strcat(comment, \"longitude, \");\n          } else {\n            strcat(comment, \"latitude, \");\n          }\n        }\n\n        strcat(comment, wcs->cel.prj.name);\n        strcat(comment, \" projection\");\n      }\n\n    } else if (i == wcs->spec) {\n      spctyp(wcs->ctype[i], 0x0, 0x0, comment, 0x0, &ptype, &xtype, 0x0);\n      if (ptype == xtype) {\n        strcat(comment, \" (linear)\");\n      } else {\n        switch (xtype) {\n        case 'F':\n          strcat(comment, \" (linear in frequency)\");\n          break;\n        case 'V':\n          strcat(comment, \" (linear in velocity)\");\n          break;\n        case 'W':\n          strcat(comment, \" (linear in wavelength)\");\n          break;\n        }\n      }\n    }\n\n    wcshdo_util(ctrl, \"CTYPE\", \"CTY\", WCSHDO_CRPXna, \"CTYP\", i+1, 0, 0, alt,\n      colnum, colax, keyvalue, comment, nkeyrec, header, &status);\n  }\n\n  // Coordinate value at reference point.\n  for (i = 0; i < naxis; i++) {\n    if (dofmt) wcshdo_format('G', 1, wcs->crval+i, format);\n    wcsutil_double2str(keyvalue, format, wcs->crval[i]);\n    comment[0] = '\\0';\n    if (wcs->cunit[i][0]) sprintf(comment, \"[%s] \", wcs->cunit[i]);\n    strcat(comment, \"Coordinate value at reference point\");\n    wcshdo_util(ctrl, \"CRVAL\", \"CRV\", WCSHDO_CRPXna, \"CRVL\", i+1, 0, 0, alt,\n      colnum, colax, keyvalue, comment, nkeyrec, header, &status);\n  }\n\n  // Parameter values.\n  if (dofmt) strcpy(format, \"%20.12G\");\n  for (k = 0; k < wcs->npv; k++) {\n    wcsutil_double2str(keyvalue, format, (wcs->pv[k]).value);\n    if ((wcs->pv[k]).i == (wcs->lng + 1)) {\n      switch ((wcs->pv[k]).m) {\n      case 1:\n        strcpy(comment, \"[deg] Native longitude of the reference point\");\n        break;\n      case 2:\n        strcpy(comment, \"[deg] Native latitude  of the reference point\");\n        break;\n      case 3:\n        if (primage) {\n          sprintf(keyword, \"LONPOLE%c\", alt);\n        } else if (bintab) {\n          sprintf(keyword, \"LONP%d%c\", colnum, alt);\n        } else {\n          sprintf(keyword, \"LONP%d%c\", colax[(wcs->pv[k]).i - 1], alt);\n        }\n        sprintf(comment, \"[deg] alias for %s (has precedence)\", keyword);\n        break;\n      case 4:\n        if (primage) {\n          sprintf(keyword, \"LATPOLE%c\", alt);\n        } else if (bintab) {\n          sprintf(keyword, \"LATP%d%c\", colnum, alt);\n        } else {\n          sprintf(keyword, \"LATP%d%c\", colax[(wcs->pv[k]).i - 1], alt);\n        }\n        sprintf(comment, \"[deg] alias for %s (has precedence)\", keyword);\n        break;\n      }\n    } else if ((wcs->pv[k]).i == (wcs->lat + 1)) {\n      sprintf(comment, \"%s projection parameter\", wcs->cel.prj.code);\n    } else {\n      strcpy(comment, \"Coordinate transformation parameter\");\n    }\n\n    wcshdo_util(ctrl, \"PV\", \"V\", WCSHDO_PVn_ma, \"PV\", wcs->pv[k].i, -1,\n      wcs->pv[k].m, alt, colnum, colax, keyvalue, comment,\n      nkeyrec, header, &status);\n  }\n\n  for (k = 0; k < wcs->nps; k++) {\n    sprintf(keyvalue, \"'%s'\", (wcs->ps[k]).value);\n    wcshdo_util(ctrl, \"PS\", \"S\", WCSHDO_PVn_ma, \"PS\", wcs->ps[k].i, -1,\n      wcs->ps[k].m, alt, colnum, colax, keyvalue,\n      \"Coordinate transformation parameter\",\n      nkeyrec, header, &status);\n  }\n\n  // Celestial and spectral transformation parameters.\n  if (!undefined(wcs->lonpole)) {\n    wcsutil_double2str(keyvalue, format, wcs->lonpole);\n    wcshdo_util(ctrl, \"LONPOLE\", \"LONP\", 0, 0x0, 0, 0, 0, alt,\n      colnum, colax, keyvalue, \"[deg] Native longitude of celestial pole\",\n      nkeyrec, header, &status);\n  }\n\n  if (!undefined(wcs->latpole)) {\n    wcsutil_double2str(keyvalue, format, wcs->latpole);\n    wcshdo_util(ctrl, \"LATPOLE\", \"LATP\", 0, 0x0, 0, 0, 0, alt,\n      colnum, colax, keyvalue, \"[deg] Native latitude of celestial pole\",\n      nkeyrec, header, &status);\n  }\n\n  if (wcs->restfrq != 0.0) {\n    wcsutil_double2str(keyvalue, format, wcs->restfrq);\n    wcshdo_util(ctrl, \"RESTFRQ\", \"RFRQ\", 0, 0x0, 0, 0, 0, alt,\n      colnum, colax, keyvalue, \"[Hz] Line rest frequency\",\n      nkeyrec, header, &status);\n  }\n\n  if (wcs->restwav != 0.0) {\n    wcsutil_double2str(keyvalue, format, wcs->restwav);\n    wcshdo_util(ctrl, \"RESTWAV\", \"RWAV\", 0, 0x0, 0, 0, 0, alt,\n      colnum, colax, keyvalue, \"[Hz] Line rest wavelength\",\n      nkeyrec, header, &status);\n  }\n\n  // - - - - - - - - - - - - - - - - -  Auxiliary coordinate axis information.\n  sprintf(timeunit, \"%.15s\", wcs->timeunit[0] ? wcs->timeunit : \"s\");\n\n  // Coordinate axis title.\n  if (wcs->cname) {\n    for (i = 0; i < naxis; i++) {\n      if (wcs->cname[i][0] == '\\0') continue;\n\n      sprintf(keyvalue, \"'%s'\", wcs->cname[i]);\n      wcshdo_util(ctrl, \"CNAME\", \"CNA\", WCSHDO_CNAMna, \"CNAM\", i+1, 0, 0,\n        alt, colnum, colax, keyvalue, \"Axis name for labelling purposes\",\n        nkeyrec, header, &status);\n    }\n  }\n\n  // Random error in coordinate.\n  if (wcs->crder) {\n    for (i = 0; i < naxis; i++) {\n      if (undefined(wcs->crder[i])) continue;\n\n      wcsutil_double2str(keyvalue, format, wcs->crder[i]);\n      comment[0] = '\\0';\n      if (wcs->cunit[i][0]) sprintf(comment, \"[%s] \", wcs->cunit[i]);\n      strcat(comment, \"Random error in coordinate\");\n      wcshdo_util(ctrl, \"CRDER\", \"CRD\", WCSHDO_CNAMna, \"CRDE\", i+1, 0, 0,\n        alt, colnum, colax, keyvalue, comment, nkeyrec, header, &status);\n    }\n  }\n\n  // Systematic error in coordinate.\n  if (wcs->csyer) {\n    for (i = 0; i < naxis; i++) {\n      if (undefined(wcs->csyer[i])) continue;\n\n      wcsutil_double2str(keyvalue, format, wcs->csyer[i]);\n      comment[0] = '\\0';\n      if (wcs->cunit[i][0]) sprintf(comment, \"[%s] \", wcs->cunit[i]);\n      strcat(comment, \"Systematic error in coordinate\");\n      wcshdo_util(ctrl, \"CSYER\", \"CSY\", WCSHDO_CNAMna, \"CSYE\", i+1, 0, 0,\n        alt, colnum, colax, keyvalue, comment, nkeyrec, header, &status);\n    }\n  }\n\n  // Time at zero point of phase axis.\n  if (wcs->czphs) {\n    for (i = 0; i < naxis; i++) {\n      if (undefined(wcs->czphs[i])) continue;\n\n      wcsutil_double2str(keyvalue, format, wcs->czphs[i]);\n      sprintf(comment, \"[%s] Time at zero point of phase axis\", timeunit);\n      wcshdo_util(ctrl, \"CZPHS\", \"CZP\", WCSHDO_CNAMna, \"CZPH\", i+1, 0, 0,\n        alt, colnum, colax, keyvalue, comment, nkeyrec, header, &status);\n    }\n  }\n\n  // Period of phase axis.\n  if (wcs->cperi) {\n    for (i = 0; i < naxis; i++) {\n      if (undefined(wcs->cperi[i])) continue;\n\n      wcsutil_double2str(keyvalue, format, wcs->cperi[i]);\n      sprintf(comment, \"[%s] Period of phase axis\", timeunit);\n      wcshdo_util(ctrl, \"CPERI\", \"CPR\", WCSHDO_CNAMna, \"CPER\", i+1, 0, 0,\n        alt, colnum, colax, keyvalue, comment, nkeyrec, header, &status);\n    }\n  }\n\n  // - - - - - - - - - - - - - - - - - - - - - - - -  Coordinate system title.\n\n  // Coordinate system title.\n  if (wcs->wcsname[0]) {\n    sprintf(keyvalue, \"'%s'\", wcs->wcsname);\n    if (bintab) {\n      wcshdo_util(ctrl, \"WCSNAME\", \"WCSN\", 0, 0x0, 0, 0, 0, alt,\n        colnum, colax, keyvalue, \"Coordinate system title\",\n        nkeyrec, header, &status);\n    } else {\n      // TWCS was a mistake.\n      wcshdo_util(ctrl, \"WCSNAME\", \"TWCS\", WCSHDO_WCSNna, \"WCSN\", 0, 0, 0,\n        alt, colnum, colax, keyvalue, \"Coordinate system title\",\n        nkeyrec, header, &status);\n    }\n  }\n\n  // - - - - - - - - - - - - - - - - -  Time reference system and measurement.\n\n  // Time scale.\n  if (wcs->timesys[0]) {\n    sprintf(keyvalue, \"'%s'\", wcs->timesys);\n    wcshdo_util(ctrl, \"TIMESYS\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      \"Time scale\", nkeyrec, header, &status);\n  }\n\n  // Time reference position.\n  if (wcs->trefpos[0]) {\n    sprintf(keyvalue, \"'%s'\", wcs->trefpos);\n    wcshdo_util(ctrl, \"TREFPOS\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      \"Time reference position\", nkeyrec, header, &status);\n  }\n\n  // Time reference direction.\n  if (wcs->trefdir[0]) {\n    sprintf(keyvalue, \"'%s'\", wcs->trefdir);\n    wcshdo_util(ctrl, \"TREFDIR\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      \"Time reference direction\", nkeyrec, header, &status);\n  }\n\n  // Ephemerides used for pathlength delay calculation.\n  if (wcs->plephem[0]) {\n    sprintf(keyvalue, \"'%s'\", wcs->plephem);\n    wcshdo_util(ctrl, \"PLEPHEM\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      \"Ephemerides used for pathlength delays\", nkeyrec, header, &status);\n  }\n\n  // Time units.\n  if (wcs->timeunit[0]) {\n    sprintf(keyvalue, \"'%s'\", wcs->timeunit);\n    wcshdo_util(ctrl, \"TIMEUNIT\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      \"Time units\", nkeyrec, header, &status);\n  }\n\n  // Fiducial (reference) time.\n  if (wcs->mjdref[0] == 0.0 && wcs->mjdref[1] == 0.0) {\n    // MJD of fiducial time (simplified if it takes its default value).\n    wcsutil_double2str(keyvalue, format, 0.0);\n    wcshdo_util(ctrl, \"MJDREF\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      \"[d] MJD of fiducial time\", nkeyrec, header, &status);\n\n  } else {\n    // ISO-8601 fiducial time.\n    if (wcs->dateref[0]) {\n      sprintf(keyvalue, \"'%s'\", wcs->dateref);\n      wcshdo_util(ctrl, \"DATEREF\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0,\n        keyvalue, \"ISO-8601 fiducial time\", nkeyrec, header, &status);\n    }\n\n    if (wcs->mjdref[1] == 0.0) {\n      // MJD of fiducial time (no fractional part).\n      if (!undefined(wcs->mjdref[0])) {\n        wcsutil_double2str(keyvalue, format, wcs->mjdref[0]);\n        wcshdo_util(ctrl, \"MJDREF\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0,\n          keyvalue, \"[d] MJD of fiducial time\", nkeyrec, header, &status);\n      }\n\n    } else {\n      // MJD of fiducial time, integer part.\n      if (!undefined(wcs->mjdref[0])) {\n        wcsutil_double2str(keyvalue, format, wcs->mjdref[0]);\n        wcshdo_util(ctrl, \"MJDREFI\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0,\n          keyvalue, \"[d] MJD of fiducial time, integer part\", nkeyrec,\n          header, &status);\n      }\n\n      // MJD of fiducial time, fractional part.\n      if (!undefined(wcs->mjdref[1])) {\n        wcsutil_double2str(keyvalue, format, wcs->mjdref[1]);\n        wcshdo_util(ctrl, \"MJDREFF\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0,\n          keyvalue, \"[d] MJD of fiducial time, fractional part\", nkeyrec,\n          header, &status);\n      }\n    }\n  }\n\n  // Clock correction.\n  if (!undefined(wcs->timeoffs)) {\n    wcsutil_double2str(keyvalue, format, wcs->timeoffs);\n    sprintf(comment, \"[%s] Clock correction\", timeunit);\n    wcshdo_util(ctrl, \"TIMEOFFS\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      comment, nkeyrec, header, &status);\n  }\n\n  // - - - - - - - - - - - - - - - - - - - - -  Data timestamps and durations.\n\n  // ISO-8601 time of observation.\n  if (wcs->dateobs[0]) {\n    sprintf(keyvalue, \"'%s'\", wcs->dateobs);\n    strcpy(comment, \"ISO-8601 time of observation\");\n\n    if (ctrl & 1) {\n      // Allow DOBSn.\n      wcshdo_util(ctrl, \"DATE-OBS\", \"DOBS\", WCSHDO_DOBSn, 0x0, 0, 0, 0, ' ',\n        colnum, colax, keyvalue, comment, nkeyrec, header, &status);\n    } else {\n      // Force DATE-OBS.\n      wcshdo_util(ctrl, \"DATE-OBS\", 0x0, 0, 0x0, 0, 0, 0, ' ',\n        0, 0x0, keyvalue, comment, nkeyrec, header, &status);\n    }\n  }\n\n  // MJD of observation.\n  if (!undefined(wcs->mjdobs)) {\n    wcsutil_double2str(keyvalue, format, wcs->mjdobs);\n    wcshdo_util(ctrl, \"MJD-OBS\", \"MJDOB\", 0, 0x0, 0, 0, 0, ' ',\n      colnum, colax, keyvalue, \"[d] MJD of observation\",\n      nkeyrec, header, &status);\n  }\n\n  // Julian epoch of observation.\n  if (!undefined(wcs->jepoch)) {\n    wcsutil_double2str(keyvalue, format, wcs->jepoch);\n    wcshdo_util(ctrl, \"JEPOCH\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      \"[a] Julian epoch of observation\", nkeyrec, header, &status);\n  }\n\n  // Besselian epoch of observation.\n  if (!undefined(wcs->bepoch)) {\n    wcsutil_double2str(keyvalue, format, wcs->bepoch);\n    wcshdo_util(ctrl, \"BEPOCH\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      \"[a] Besselian epoch of observation\", nkeyrec, header, &status);\n  }\n\n  // ISO-8601 time at start of observation.\n  if (wcs->datebeg[0]) {\n    sprintf(keyvalue, \"'%s'\", wcs->datebeg);\n    wcshdo_util(ctrl, \"DATE-BEG\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      \"ISO-8601 time at start of observation\", nkeyrec, header, &status);\n  }\n\n  // MJD at start of observation.\n  if (!undefined(wcs->mjdbeg)) {\n    wcsutil_double2str(keyvalue, format, wcs->mjdbeg);\n    wcshdo_util(ctrl, \"MJD-BEG\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      \"[d] MJD at start of observation\", nkeyrec, header, &status);\n  }\n\n  // Time elapsed at start since fiducial time.\n  if (!undefined(wcs->tstart)) {\n    wcsutil_double2str(keyvalue, format, wcs->tstart);\n    sprintf(comment, \"[%s] Time elapsed since fiducial time at start\",\n      timeunit);\n    wcshdo_util(ctrl, \"TSTART\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      comment, nkeyrec, header, &status);\n  }\n\n  // ISO-8601 time at midpoint of observation.\n  if (wcs->dateavg[0]) {\n    sprintf(keyvalue, \"'%s'\", wcs->dateavg);\n    wcshdo_util(ctrl, \"DATE-AVG\", \"DAVG\", 0, 0x0, 0, 0, 0, ' ',\n      colnum, colax, keyvalue, \"ISO-8601 time at midpoint of observation\",\n      nkeyrec, header, &status);\n  }\n\n  // MJD at midpoint of observation.\n  if (!undefined(wcs->mjdavg)) {\n    wcsutil_double2str(keyvalue, format, wcs->mjdavg);\n    wcshdo_util(ctrl, \"MJD-AVG\", \"MJDA\", 0, 0x0, 0, 0, 0, ' ',\n      colnum, colax, keyvalue, \"[d] MJD at midpoint of observation\",\n      nkeyrec, header, &status);\n  }\n\n  // ISO-8601 time at end of observation.\n  if (wcs->dateend[0]) {\n    sprintf(keyvalue, \"'%s'\", wcs->dateend);\n    wcshdo_util(ctrl, \"DATE-END\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      \"ISO-8601 time at end of observation\", nkeyrec, header, &status);\n  }\n\n  // MJD at end of observation.\n  if (!undefined(wcs->mjdend)) {\n    wcsutil_double2str(keyvalue, format, wcs->mjdend);\n    wcshdo_util(ctrl, \"MJD-END\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      \"[d] MJD at end of observation\", nkeyrec, header, &status);\n  }\n\n  // Time elapsed at end since fiducial time.\n  if (!undefined(wcs->tstop)) {\n    wcsutil_double2str(keyvalue, format, wcs->tstop);\n    sprintf(comment, \"[%s] Time elapsed since fiducial time at end\",\n      timeunit);\n    wcshdo_util(ctrl, \"TSTOP\", \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      comment, nkeyrec, header, &status);\n  }\n\n  // Exposure (integration) time.\n  if (!undefined(wcs->xposure)) {\n    wcsutil_double2str(keyvalue, format, wcs->xposure);\n    sprintf(comment, \"[%s] Exposure (integration) time\", timeunit);\n    wcshdo_util(ctrl, \"XPOSURE\", \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      comment, nkeyrec, header, &status);\n  }\n\n  // Elapsed time (start to stop).\n  if (!undefined(wcs->telapse)) {\n    wcsutil_double2str(keyvalue, format, wcs->telapse);\n    sprintf(comment, \"[%s] Elapsed time (start to stop)\", timeunit);\n    wcshdo_util(ctrl, \"TELAPSE\", \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      comment, nkeyrec, header, &status);\n  }\n\n  // - - - - - - - - - - - - - - - - - - - - - - - - - - - -  Timing accuracy.\n\n  // Systematic error in time measurements.\n  if (!undefined(wcs->timsyer)) {\n    wcsutil_double2str(keyvalue, format, wcs->timsyer);\n    sprintf(comment, \"[%s] Systematic error in time measurements\", timeunit);\n    wcshdo_util(ctrl, \"TIMSYER\", \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      comment, nkeyrec, header, &status);\n  }\n\n  // Relative error in time measurements.\n  if (!undefined(wcs->timrder)) {\n    wcsutil_double2str(keyvalue, format, wcs->timrder);\n    sprintf(comment, \"[%s] Relative error in time measurements\", timeunit);\n    wcshdo_util(ctrl, \"TIMRDER\", \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      comment, nkeyrec, header, &status);\n  }\n\n  // Time resolution.\n  if (!undefined(wcs->timedel)) {\n    wcsutil_double2str(keyvalue, format, wcs->timedel);\n    sprintf(comment, \"[%s] Time resolution\", timeunit);\n    wcshdo_util(ctrl, \"TIMEDEL\", \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      comment, nkeyrec, header, &status);\n  }\n\n  // Reference position of timestamp in binned data.\n  if (!undefined(wcs->timepixr)) {\n    wcsutil_double2str(keyvalue, format, wcs->timepixr);\n    wcshdo_util(ctrl, \"TIMEPIXR\", \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      \"Reference position of timestamp in binned data\", nkeyrec, header,\n      &status);\n  }\n\n  // - - - - - - - - - - - - - - - - - -  Spatial & celestial reference frame.\n\n  // Observatory coordinates.\n  if (!undefined(wcs->obsgeo[0]) &&\n      !undefined(wcs->obsgeo[1]) &&\n      !undefined(wcs->obsgeo[2])) {\n\n    for (k = 0; k < 3; k++) {\n      wcsutil_double2str(keyvalue, format, wcs->obsgeo[k]);\n      sprintf(comment, \"[m] observatory %c-coordinate\", xyz[k]);\n      obsgeo[7] = xyz[k];\n      obsg[4]   = xyz[k];\n      wcshdo_util(ctrl, obsgeo, obsg, 0, 0x0, 0, 0, 0, ' ',\n        colnum, colax, keyvalue, comment, nkeyrec, header, &status);\n    }\n\n  } else if (\n      !undefined(wcs->obsgeo[3]) &&\n      !undefined(wcs->obsgeo[4]) &&\n      !undefined(wcs->obsgeo[5])) {\n\n    wcsutil_double2str(keyvalue, format, wcs->obsgeo[3]);\n    wcshdo_util(ctrl, \"OBSGEO-L\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      \"[deg] IAU(1976) observatory longitude\", nkeyrec, header, &status);\n\n    wcsutil_double2str(keyvalue, format, wcs->obsgeo[4]);\n    wcshdo_util(ctrl, \"OBSGEO-B\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      \"[deg] IAU(1976) observatory latitude\", nkeyrec, header, &status);\n\n    wcsutil_double2str(keyvalue, format, wcs->obsgeo[5]);\n    wcshdo_util(ctrl, \"OBSGEO-L\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      \"[m]   IAU(1976) observatory height\", nkeyrec, header, &status);\n  }\n\n  // Spacecraft orbit ephemeris file.\n  if (wcs->obsorbit[0]) {\n    sprintf(keyvalue, \"'%s'\", wcs->obsorbit);\n    wcshdo_util(ctrl, \"OBSORBIT\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue,\n      \"Spacecraft orbit ephemeris file\", nkeyrec, header, &status);\n  }\n\n  // Equatorial coordinate system type.\n  if (wcs->radesys[0]) {\n    sprintf(keyvalue, \"'%s'\", wcs->radesys);\n    wcshdo_util(ctrl, \"RADESYS\", \"RADE\", 0, 0x0, 0, 0, 0, alt, colnum, colax,\n      keyvalue, \"Equatorial coordinate system\", nkeyrec, header, &status);\n  }\n\n  // Equinox of equatorial coordinate system.\n  if (!undefined(wcs->equinox)) {\n    wcsutil_double2str(keyvalue, format, wcs->equinox);\n    wcshdo_util(ctrl, \"EQUINOX\", \"EQUI\", 0, 0x0, 0, 0, 0, alt, colnum, colax,\n      keyvalue, \"[yr] Equinox of equatorial coordinates\", nkeyrec, header,\n      &status);\n  }\n\n  // Reference frame of spectral coordinates.\n  if (wcs->specsys[0]) {\n    sprintf(keyvalue, \"'%s'\", wcs->specsys);\n    wcshdo_util(ctrl, \"SPECSYS\", \"SPEC\", 0, 0x0, 0, 0, 0, alt, colnum, colax,\n      keyvalue, \"Reference frame of spectral coordinates\", nkeyrec, header,\n      &status);\n  }\n\n  // Reference frame of spectral observation.\n  if (wcs->ssysobs[0]) {\n    sprintf(keyvalue, \"'%s'\", wcs->ssysobs);\n    wcshdo_util(ctrl, \"SSYSOBS\", \"SOBS\", 0, 0x0, 0, 0, 0, alt, colnum, colax,\n      keyvalue, \"Reference frame of spectral observation\", nkeyrec, header,\n      &status);\n  }\n\n  // Observer's velocity towards source.\n  if (!undefined(wcs->velosys)) {\n    wcsutil_double2str(keyvalue, format, wcs->velosys);\n    wcshdo_util(ctrl, \"VELOSYS\", \"VSYS\", 0, 0x0, 0, 0, 0, alt, colnum, colax,\n      keyvalue, \"[m/s] Velocity towards source\", nkeyrec, header, &status);\n  }\n\n  // Redshift of the source.\n  if (!undefined(wcs->zsource)) {\n    wcsutil_double2str(keyvalue, format, wcs->zsource);\n    wcshdo_util(ctrl, \"ZSOURCE\", \"ZSOU\", 0, 0x0, 0, 0, 0, alt, colnum, colax,\n      keyvalue, \"Redshift of the source\", nkeyrec, header, &status);\n  }\n\n  // Reference frame of source redshift.\n  if (wcs->ssyssrc[0]) {\n    sprintf(keyvalue, \"'%s'\", wcs->ssyssrc);\n    wcshdo_util(ctrl, \"SSYSSRC\", \"SSRC\", 0, 0x0, 0, 0, 0, alt, colnum, colax,\n      keyvalue, \"Reference frame of source redshift\", nkeyrec, header,\n      &status);\n  }\n\n  // Velocity orientation angle.\n  if (!undefined(wcs->velangl)) {\n    wcsutil_double2str(keyvalue, format, wcs->velangl);\n    wcshdo_util(ctrl, \"VELANGL\", \"VANG\", 0, 0x0, 0, 0, 0, alt, colnum, colax,\n      keyvalue, \"[deg] Velocity orientation angle\", nkeyrec, header, &status);\n  }\n\n  // - - - - - - - - - - - - - - - - - - - -  Additional auxiliary parameters.\n\n  if ((aux = wcs->aux)) {\n    if (!undefined(aux->rsun_ref)) {\n      wcsutil_double2str(keyvalue, format, aux->rsun_ref);\n      wcshdo_util(ctrl, \"RSUN_REF\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0,\n        keyvalue, \"[m] Solar radius\", nkeyrec, header, &status);\n    }\n\n    if (!undefined(aux->dsun_obs)) {\n      wcsutil_double2str(keyvalue, format, aux->dsun_obs);\n      wcshdo_util(ctrl, \"DSUN_OBS\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0,\n        keyvalue, \"[m] Distance from centre of Sun to observer\", nkeyrec,\n        header, &status);\n    }\n\n    if (!undefined(aux->crln_obs)) {\n      wcsutil_double2str(keyvalue, format, aux->crln_obs);\n      wcshdo_util(ctrl, \"CRLN_OBS\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0,\n        keyvalue, \"[deg] Carrington heliographic lng of observer\", nkeyrec,\n        header, &status);\n\n      if (!undefined(aux->hglt_obs)) {\n        wcsutil_double2str(keyvalue, format, aux->hglt_obs);\n        wcshdo_util(ctrl, \"CRLT_OBS\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0,\n          keyvalue, \"[deg] Heliographic latitude of observer\", nkeyrec,\n          header, &status);\n      }\n    }\n\n    if (!undefined(aux->hgln_obs)) {\n      wcsutil_double2str(keyvalue, format, aux->hgln_obs);\n      wcshdo_util(ctrl, \"HGLN_OBS\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0,\n        keyvalue, \"[deg] Stonyhurst heliographic lng of observer\", nkeyrec,\n        header, &status);\n\n      if (!undefined(aux->hglt_obs)) {\n        wcsutil_double2str(keyvalue, format, aux->hglt_obs);\n        wcshdo_util(ctrl, \"HGLT_OBS\", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0,\n          keyvalue, \"[deg] Heliographic latitude of observer\", nkeyrec,\n          header, &status);\n      }\n    }\n  }\n\n  // - - - - - - - - - - - - - - - - - - - - - Distortion function parameters.\n\n  if (dosip) {\n    // Simple Imaging Polynomial (SIP) is handled by translating its dpkey\n    // records.  Determine a suitable numerical precision for the\n    // polynomial coefficients to avoid trailing zeroes common to all of\n    // them.\n    dis = wcs->lin.dispre;\n    if (dofmt) {\n      keyp = dis->dp;\n      kp0  = 2;\n      for (idp = 0; idp < dis->ndp; idp++, keyp++) {\n        cp = strchr(keyp->field, '.') + 1;\n        if (strncmp(cp, \"SIP.\", 4) != 0) continue;\n        wcsutil_double2str(keyvalue, \"%20.13E\", dpkeyd(keyp));\n\n        kpi = 15;\n        while (kp0 < kpi && keyvalue[kpi] == '0') kpi--;\n        kp0 = kpi;\n      }\n\n      precision = kp0 - 2;\n      if (precision < 1)  precision = 1;\n      if (13 < precision) precision = 13;\n      sprintf(format, \"%%20.%dE\", precision);\n    }\n\n    // Ensure the coefficients are written in a human-readable sequence.\n    for (j = 0; j <= 1; j++) {\n      // Distortion function polynomial coefficients.\n      wcshdo_util(ctrl, \"\", \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0, \"\", \"\",\n        nkeyrec, header, &status);\n\n      if (j == 0) {\n        strcpy(keyword, \"A_\");\n      } else {\n        strcpy(keyword, \"B_\");\n      }\n\n      ncoeff = dis->iparm[j][I_TPDNCO];\n      for (degree = 0; degree <= 9; degree++) {\n        if (ncoeff <= nTPD[degree]) break;\n      }\n\n      strcpy(keyword+2, \"ORDER\");\n      sprintf(keyvalue, \"%20d\", degree);\n      sprintf(comment, \"SIP polynomial degree, axis %d, pixel-to-sky\", j+1);\n      wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0,\n        keyvalue, comment, nkeyrec, header, &status);\n\n      keyp = dis->dp;\n      for (idp = 0; idp < dis->ndp; idp++, keyp++) {\n        if (keyp->j != j+1) continue;\n        if ((keyval = dpkeyd(keyp)) == 0.0) continue;\n\n        cp = strchr(keyp->field, '.') + 1;\n        if (strncmp(cp, \"SIP.FWD.\", 8) != 0) continue;\n        cp += 8;\n        strcpy(keyword+2, cp);\n        sscanf(cp, \"%d_%d\", &p, &q);\n        strncpy(term, \"xxxxxxxxx\", p);\n        strncpy(term+p, \"yyyyyyyyy\", q);\n        term[p+q] = '\\0';\n\n        wcsutil_double2str(keyvalue, format, keyval);\n        sprintf(comment, \"SIP distortion coefficient: %s\", term);\n        wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0,\n          keyvalue, comment, nkeyrec, header, &status);\n      }\n\n      if (dis->maxdis[j] != 0.0) {\n        strcpy(keyword+2, \"DMAX\");\n        wcsutil_double2str(keyvalue, \"%20.3f\", dis->maxdis[j]);\n        wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0,\n          keyvalue, \"Maximum value of distortion function\", nkeyrec,\n          header, &status);\n      }\n\n      // Inverse distortion function polynomial coefficients.\n      if (dis->disx2p == 0x0) continue;\n\n      wcshdo_util(ctrl, \"\", \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0, \"\", \"\",\n        nkeyrec, header, &status);\n\n      if (j == 0) {\n        strcpy(keyword, \"AP_\");\n      } else {\n        strcpy(keyword, \"BP_\");\n      }\n\n      ncoeff = dis->iparm[j][I_NDPARM] - dis->iparm[j][I_TPDNCO];\n      for (degree = 0; degree <= 9; degree++) {\n        if (ncoeff <= nTPD[degree]) break;\n      }\n\n      strcpy(keyword+3, \"ORDER\");\n      sprintf(keyvalue, \"%20d\", degree);\n      sprintf(comment, \"SIP polynomial degree, axis %d, sky-to-pixel\", j+1);\n      wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0,\n        keyvalue, comment, nkeyrec, header, &status);\n\n      keyp = dis->dp;\n      for (idp = 0; idp < dis->ndp; idp++, keyp++) {\n        if (keyp->j != j+1) continue;\n        if ((keyval = dpkeyd(keyp)) == 0.0) continue;\n\n        cp = strchr(keyp->field, '.') + 1;\n        if (strncmp(cp, \"SIP.REV.\", 8) != 0) continue;\n        cp += 8;\n        strcpy(keyword+3, cp);\n        sscanf(cp, \"%d_%d\", &p, &q);\n        strncpy(term, \"xxxxxxxxx\", p);\n        strncpy(term+p, \"yyyyyyyyy\", q);\n        term[p+q] = '\\0';\n\n        wcsutil_double2str(keyvalue, format, keyval);\n        sprintf(comment, \"SIP inverse coefficient: %s\", term);\n        wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0,\n          keyvalue, comment, nkeyrec, header, &status);\n      }\n    }\n  }\n\n  for (idis = 0; idis < 2; idis++) {\n    if (idis == 0 && (dis = wcs->lin.dispre) == 0x0) continue;\n    if (idis == 1 && (dis = wcs->lin.disseq) == 0x0) continue;\n\n    for (j = 0; j < naxis; j++) {\n      if (dis->disp2x[j] == 0x0) continue;\n\n      iparm = dis->iparm[j];\n      dparm = dis->dparm[j];\n\n      // Identify the distortion type.\n      if (dotpv) {\n        // TPV \"projection\" is handled by translating its dpkey records,\n        // which were originally translated from PVi_ma by wcsset(), or\n        // possibly input directly as a CQDISia = 'TPV' distortion type.\n        // Determine a suitable numerical precision for the polynomial\n        // coefficients to avoid trailing zeroes common to all of them.\n        if (dofmt) wcshdo_format('E', iparm[I_NDPARM], dparm, format);\n        sprintf(fmt01, \"%.3ss\", format);\n\n        wcshdo_util(ctrl, \"\", \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0, \"\", \"\",\n          nkeyrec, header, &status);\n\n        // Distortion function polynomial coefficients.\n        sprintf(keyword, \"PV%d_\", j+1);\n        kp = keyword + strlen(keyword);\n\n        keyp = dis->dp;\n        for (idp = 0; idp < dis->ndp; idp++, keyp++) {\n          if (keyp->j != j+1) continue;\n          if ((keyval = dpkeyd(keyp)) == 0.0) continue;\n\n          cp = strchr(keyp->field, '.') + 1;\n          if (strncmp(cp, \"TPV.\", 4) != 0) continue;\n          strcpy(kp, cp+4);\n\n          // Identify the term of the TPV polynomial for human readers.\n          sscanf(cp+4, \"%d\", &m);\n          wcshdo_tpdterm(m, j == wcs->lng, term);\n          sprintf(comment, \"TPV coefficient: %s\", term);\n\n          if (keyval == 1.0) {\n            sprintf(keyvalue, fmt01, \"1.0\");\n          } else {\n            wcsutil_double2str(keyvalue, format, keyval);\n          }\n          wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n            keyvalue, comment, nkeyrec, header, &status);\n        }\n\n      } else if (strcmp(dis->dtype[j], \"TPD\") == 0 || dotpd ||\n                 strcmp(dis->dtype[j], \"Polynomial\")  == 0 ||\n                 strcmp(dis->dtype[j], \"Polynomial*\") == 0) {\n        // One of the Paper IV type polynomial distortions.\n        wcshdo_util(ctrl, \"\", \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0, \"\", \"\",\n          nkeyrec, header, &status);\n\n        if (strcmp(dis->dtype[j], \"TPD\") == 0) {\n          // Pure TPD.\n          dotpd = 1;\n        } else if (strncmp(dis->dtype[j], \"Polynomial\", 10) == 0) {\n          // Polynomial distortion.  Write it as TPD by request?\n          dotpd = (iparm[I_DTYPE] & DIS_DOTPD);\n          strcpy(tpdsrc, \"Polynomial distortion\");\n        }\n\n        pq = idis ? 'Q' : 'P';\n        Nhat = dis->Nhat[j];\n\n        // CPDISja/CQDISia\n        sprintf(keyword, \"C%cDIS%d\", pq, j+1);\n        if (idis == 0) {\n          strcpy(comment, \"P = prior, \");\n        } else {\n          strcpy(comment, \"Q = sequent, \");\n        }\n\n        if (dotpd) {\n          strcpy(keyvalue, \"'TPD'\");\n          strcat(comment, \"Template Polynomial Distortion\");\n\n          // For identifying terms of the TPD polynomial.\n          axmap  = dis->axmap[j];\n          direct = 1;\n          doaux  = iparm[I_TPDAUX];\n          if (Nhat == 2) {\n            // Associate x with longitude, y with latitude.\n            if (axmap[0] == wcs->lng && axmap[1] == wcs->lat) {\n              direct = 1;\n            } else if (axmap[0] == wcs->lat && axmap[1] == wcs->lng) {\n              direct = 0;\n            } else {\n              // Non-celestial.\n              direct = (axmap[0] < axmap[1]);\n            }\n          }\n        } else {\n          strcpy(keyvalue, \"'Polynomial'\");\n          strcat(comment, \"general Polynomial distortion\");\n        }\n\n        wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n          keyvalue, comment, nkeyrec, header, &status);\n\n        // NAXES.\n        sprintf(keyword,  \"D%c%d\", pq, j+1);\n        sprintf(keyvalue, \"'NAXES:  %d'\", Nhat);\n        if (Nhat == 1) {\n          strcpy(comment,  \"One independent variable\");\n        } else if (Nhat == 2) {\n          strcpy(comment,  \"Two independent variables\");\n        } else {\n          strcpy(comment,  \"Number of independent variables\");\n        }\n        wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n          keyvalue, comment, nkeyrec, header, &status);\n\n        // AXIS.jhat\n        for (jhat = 0; jhat < Nhat; jhat++) {\n          axmap = dis->axmap[j];\n          sprintf(keyvalue, \"'AXIS.%d: %d'\", jhat+1, axmap[jhat]+1);\n          if (jhat == 0) {\n            strcpy(comment, \"1st\");\n          } else if (jhat == 1) {\n            strcpy(comment, \"2nd\");\n          } else if (jhat == 2) {\n            strcpy(comment, \"3rd\");\n          } else {\n            sprintf(comment, \"%dth\", jhat+1);\n          }\n\n          sprintf(comment+strlen(comment), \" independent variable: axis %d\",\n            axmap[jhat]+1);\n          if (dotpd) {\n            // axid is \"xyxuvu\".\n            cp = axid;\n            if (!direct) cp++;\n            if (doaux) cp += 3;\n            sprintf(comment+strlen(comment), \" (= %c)\", cp[jhat]);\n          }\n\n          wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n            keyvalue, comment, nkeyrec, header, &status);\n        }\n\n        // OFFSET.jhat\n        if (dofmt) wcshdo_format('f', Nhat, dis->offset[j], format);\n        for (jhat = 0; jhat < Nhat; jhat++) {\n          if (dis->offset[j][jhat] == 0.0) continue;\n\n          wcsutil_double2str(ctemp, format, dis->offset[j][jhat]);\n          sprintf(keyvalue, \"'OFFSET.%d: %s'\", jhat+1, ctemp);\n          sprintf(comment, \"Variable %d renormalization offset\", jhat+1);\n\n          wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n            keyvalue, comment, nkeyrec, header, &status);\n        }\n\n        // SCALE.jhat\n        if (dofmt) wcshdo_format('f', Nhat, dis->scale[j], format);\n        for (jhat = 0; jhat < Nhat; jhat++) {\n          if (dis->scale[j][jhat] == 1.0) continue;\n\n          wcsutil_double2str(ctemp, format, dis->scale[j][jhat]);\n          sprintf(keyvalue, \"'SCALE.%d: %s'\", jhat+1, ctemp);\n          sprintf(comment, \"Variable %d renormalization scale\", jhat+1);\n\n          wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n            keyvalue, comment, nkeyrec, header, &status);\n        }\n\n        // Does the distortion function compute a correction?\n        if (dis->docorr[j]) {\n          wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n            \"'DOCORR: 1'\", \"Distortion function computes a correction\",\n            nkeyrec, header, &status);\n        } else {\n          wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n            \"'DOCORR: 0'\", \"Distortion function computes coordinates\",\n            nkeyrec, header, &status);\n        }\n\n        if (dotpd) {\n          // Template Polynomial Distortion (TPD).  As it may have been\n          // translated from SIP, TPV, DSS, TNX, ZPX, or perhaps\n          // Polynomial, the dpkey records may not relate to TPD.\n          // Output is therefore handled via dparm.\n          if (dofmt) wcshdo_format('E', iparm[I_NDPARM], dparm, format);\n          sprintf(fmt01, \"%.3ss\", format);\n\n          // AUX.jhat.COEFF.m\n          if (doaux) {\n            for (idp = 0; idp < 6; idp++) {\n              if (dparm[idp] == 0.0) {\n                sprintf(ctemp, fmt01, \"0.0\");\n              } else if (dparm[idp] == 1.0) {\n                sprintf(ctemp, fmt01, \"1.0\");\n              } else {\n                wcsutil_double2str(ctemp, format, dparm[idp]);\n              }\n\n              if (idp < 3) {\n                sprintf(keyvalue, \"'AUX.1.COEFF.%d: %s'\", idp%3, ctemp);\n                sprintf(comment, \"TPD: x = c0 + c1*u + c2*v\");\n              } else {\n                sprintf(keyvalue, \"'AUX.2.COEFF.%d: %s'\", idp%3, ctemp);\n                sprintf(comment, \"TPD: y = d0 + d1*u + d2*v\");\n              }\n\n              wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n                keyvalue, comment, nkeyrec, header, &status);\n\n            }\n\n            dparm += 6;\n          }\n\n          // TPD.FWD.m\n          for (idp = 0; idp < iparm[I_TPDNCO]; idp++) {\n            if (dparm[idp] == 0.0) continue;\n\n            if (dparm[idp] == 1.0) {\n              sprintf(ctemp, fmt01, \"1.0\");\n            } else {\n              wcsutil_double2str(ctemp, format, dparm[idp]);\n            }\n\n            m = idp;\n            sprintf(keyvalue, \"'TPD.FWD.%d:%s %s'\", m, (m<10)?\" \":\"\", ctemp);\n            wcshdo_tpdterm(m, direct, term);\n            sprintf(comment, \"TPD coefficient: %s\", term);\n\n            wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n              keyvalue, comment, nkeyrec, header, &status);\n          }\n\n          // CPERRja/CQERRia\n          if (dis->maxdis[j] != 0.0) {\n            sprintf(keyword,  \"C%cERR%d\", pq, j+1);\n            sprintf(keyvalue, \"%20.2f\", dis->maxdis[j]);\n            sprintf(comment, \"%sMaximum absolute value of distortion\",\n              idis?\"\":\"[pix] \");\n            wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n              keyvalue, comment, nkeyrec, header, &status);\n          }\n\n          // Inverse distortion function polynomial coefficients.\n          if (dis->disx2p[j] == 0x0) continue;\n\n          wcshdo_util(ctrl, \"\", \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0, \"\", \"\",\n            nkeyrec, header, &status);\n\n          // TPD.REV.m\n          sprintf(keyword,  \"D%c%d\", pq, j+1);\n          for (idp = iparm[I_TPDNCO]; idp < iparm[I_NDPARM]; idp++) {\n            if (dparm[idp] == 0.0) continue;\n\n            wcsutil_double2str(ctemp, format, dparm[idp]);\n            m = idp - iparm[I_TPDNCO];\n            sprintf(keyvalue, \"'TPD.REV.%d:%s %s'\", m, (m<10)?\" \":\"\", ctemp);\n            wcshdo_tpdterm(m, direct, term);\n            sprintf(comment, \"TPD coefficient: %s\", term);\n\n            wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n              keyvalue, comment, nkeyrec, header, &status);\n          }\n\n        } else {\n          // General polynomial distortion, handled via its dpkey records\n          // since iparm and dparm may hold a translation to TPD.\n\n          // Do auxiliary variables first.\n          keyp = dis->dp;\n          for (idp = 0; idp < dis->ndp; idp++, keyp++) {\n            if (keyp->j != j+1) continue;\n\n            cp = strchr(keyp->field, '.') + 1;\n            if (strncmp(cp, \"NAUX\", 4) != 0) continue;\n\n            sprintf(keyvalue, \"'%s: %d'\", cp, dpkeyi(keyp));\n            wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n              keyvalue, \"Number of auxiliary variables\", nkeyrec, header,\n              &status);\n\n            keyp = dis->dp;\n            for (idp = 0; idp < dis->ndp; idp++, keyp++) {\n              if (keyp->j != j+1) continue;\n\n              keyval = dpkeyd(keyp);\n\n              cp = strchr(keyp->field, '.') + 1;\n              if (strncmp(cp, \"AUX.\", 4) != 0) continue;\n\n              sscanf(cp+4, \"%d\", &m);\n              sprintf(keyvalue, \"'%s:\", cp);\n\n              cp = strchr(cp+4, '.') + 1;\n              kp = keyvalue + strlen(keyvalue);\n\n              if ((double)((int)keyval) == keyval) {\n                sprintf(kp, \"%4d'\", (int)keyval);\n              } else if (keyval == 0.5) {\n                strcat(kp, \" 0.5'\");\n              } else {\n                wcsutil_double2str(kp, \"%21.13E\", keyval);\n                strcat(keyvalue, \"'\");\n              }\n\n              sscanf(cp+6, \"%d\", &p);\n              if (strncmp(cp, \"POWER.\", 4) == 0) {\n                if (p) {\n                  sprintf(comment, \"Aux %d: var %d power\", m, p);\n                } else {\n                  sprintf(comment, \"Aux %d: power of sum of terms\", m);\n                }\n              } else {\n                if (p) {\n                  sprintf(comment, \"Aux %d: var %d coefficient\", m, p);\n                } else {\n                  sprintf(comment, \"Aux %d: offset term\", m);\n                }\n              }\n\n              wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n                keyvalue, comment, nkeyrec, header, &status);\n            }\n\n            break;\n          }\n\n          // Do polynomial terms.\n          keyp = dis->dp;\n          for (idp = 0; idp < dis->ndp; idp++, keyp++) {\n            if (keyp->j != j+1) continue;\n\n            cp = strchr(keyp->field, '.') + 1;\n            if (strncmp(cp, \"NTERMS\", 6) != 0) continue;\n\n            sprintf(keyvalue, \"'%s: %d'\", cp, dpkeyi(keyp));\n            wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n              keyvalue, \"Number of terms in the polynomial\", nkeyrec, header,\n              &status);\n          }\n\n          keyp = dis->dp;\n          for (idp = 0; idp < dis->ndp; idp++, keyp++) {\n            if (keyp->j != j+1) continue;\n\n            if ((keyval = dpkeyd(keyp)) == 0.0) continue;\n\n            cp = strchr(keyp->field, '.') + 1;\n            if (strncmp(cp, \"TERM.\", 5) != 0) continue;\n\n            sscanf(cp+5, \"%d\", &m);\n            sprintf(keyvalue, \"'%s:%s \", cp, (m<10)?\" \":\"\");\n\n            cp = strchr(cp+5, '.') + 1;\n            kp = keyvalue + strlen(keyvalue);\n            if (strncmp(cp, \"VAR.\", 4) == 0) {\n              if ((double)((int)keyval) == keyval) {\n                sprintf(kp, \"%20d\", (int)keyval);\n              } else {\n                wcsutil_double2str(kp, \"%20.13f\", keyval);\n              }\n\n              sscanf(cp+4, \"%d\", &p);\n              if (p <= Nhat) {\n                sprintf(comment, \"Poly term %d: var %d power\", m, p);\n              } else {\n                sprintf(comment, \"Poly term %d: aux %d power\", m, p-Nhat);\n              }\n\n            } else {\n              wcsutil_double2str(kp, \"%20.13E\", keyval);\n              sprintf(comment, \"Poly term %d: coefficient\", m);\n            }\n            strcat(keyvalue, \"'\");\n\n            wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n              keyvalue, comment, nkeyrec, header, &status);\n          }\n\n          // CPERRja/CQERRia\n          if (dis->maxdis[j] != 0.0) {\n            sprintf(keyword,  \"C%cERR%d\", pq, j+1);\n            sprintf(keyvalue, \"%20.2f\", dis->maxdis[j]);\n            sprintf(comment, \"%sMaximum absolute value of distortion\",\n              idis?\"\":\"[pix] \");\n            wcshdo_util(ctrl, keyword, \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n              keyvalue, comment, nkeyrec, header, &status);\n          }\n        }\n      }\n    }\n\n    // DVERRa\n    if (dis->totdis != 0.0) {\n      sprintf(keyvalue, \"%20.2f\", dis->totdis);\n      sprintf(comment, \"Maximum combined distortion\");\n      wcshdo_util(ctrl, \"DVERR\", \"\", 0, 0x0, 0, 0, 0, alt, 0, 0,\n        keyvalue, comment, nkeyrec, header, &status);\n    }\n  }\n\n\n  // Add identification.\n  wcshdo_util(ctrl, \"\", \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0, \"\", \"\",\n    nkeyrec, header, &status);\n\n  if (dotpd == DIS_DOTPD) {\n    // TPD by translation.\n    sprintf(comment, \"Translated from %s to TPD by WCSLIB %s\", tpdsrc,\n      wcslib_version(0x0));\n  } else {\n    sprintf(comment, \"WCS header keyrecords produced by WCSLIB %s\",\n      wcslib_version(0x0));\n  }\n\n  wcshdo_util(ctrl, \"COMMENT\", \"\", 0, 0x0, 0, 0, 0, ' ', 0, 0,\n    \"\", comment, nkeyrec, header, &status);\n\n\n  if (status == WCSHDRERR_MEMORY) {\n    wcserr_set(WCSHDR_ERRMSG(status));\n  }\n  return status;\n}\n\n//----------------------------------------------------------------------------\n// Determine a suitable floating point format for a set of parameters.\n\nvoid wcshdo_format(\n  int fmt,\n  int nval,\n  const double val[],\n  char *format)\n\n{\n  int emax = -999;\n  int emin = +999;\n  int precision = 0;\n  for (int i = 0; i < nval; i++) {\n    // Double precision has at least 15 significant digits, and up to 17:\n    // http://en.wikipedia.org/wiki/Double-precision_floating-point_format\n    char cval[24];\n    wcsutil_double2str(cval, \"%21.14E\", val[i]);\n\n    int cpi = 16;\n    while (2 < cpi && cval[cpi] == '0') cpi--;\n\n    // Precision for 'E' format.\n    cpi -= 2;\n    if (precision < cpi) precision = cpi;\n\n    // Range of significant digits for 'f' format.\n    int expon;\n    sscanf(cval+18, \"%d\", &expon);\n\n    if (emax < expon) emax = expon;\n    expon -= cpi;\n    if (expon < emin) emin = expon;\n  }\n\n\n  if (fmt == 'G') {\n    // Because e.g. writing 1e4 as 10000 requires an extra digit.\n    emax++;\n\n    if (emin < -15 || 15 < emax || 15 < (emax - emin)) {\n      fmt = 'E';\n    } else {\n      fmt = 'f';\n    }\n  }\n\n  if (fmt == 'f') {\n    precision = -emin;\n    if (precision < 1)  precision = 1;\n    if (17 < precision) precision = 17;\n    sprintf(format, \"%%20.%df\", precision);\n\n  } else {\n    if (precision < 1)  precision = 1;\n    if (14 < precision) precision = 14;\n    if (precision < 14) {\n      sprintf(format, \"%%20.%dE\", precision);\n    } else {\n      sprintf(format, \"%%21.%dE\", precision);\n    }\n  }\n}\n\n//----------------------------------------------------------------------------\n// Construct a string that identifies the term of a TPD or TPV polynomial.\n\nvoid wcshdo_tpdterm(\n  int m,\n  int direct,\n  char *term)\n\n{\n  const int nTPD[] = {1, 4, 7, 12, 17, 24, 31, 40, 49, 60};\n\n  int degree, k;\n\n  for (degree = 0; degree <= 9; degree++) {\n    if (m < nTPD[degree]) break;\n  }\n\n  if (degree == 0) {\n    strcpy(term, \"1\");\n\n  } else {\n    k = degree - (m - nTPD[degree-1]);\n\n    if (k < 0) {\n      memcpy(term, \"rrrrrrrrr\", degree);\n    } else if (direct) {\n      memcpy(term, \"xxxxxxxxx\", k);\n      memcpy(term+k, \"yyyyyyyyy\", degree-k);\n    } else {\n      memcpy(term, \"yyyyyyyyy\", k);\n      memcpy(term+k, \"xxxxxxxxx\", degree-k);\n    }\n\n    term[degree] = '\\0';\n  }\n}\n\n//----------------------------------------------------------------------------\n// Construct a keyrecord from the components given.\n\nvoid wcshdo_util(\n  int relax,\n  const char pikey[],\n  const char tbkey[],\n  int level,\n  const char tlkey[],\n  int i,\n  int j,\n  int m,\n  char alt,\n  int  btcol,\n  int  plcol[],\n  char keyvalue[],\n  const char keycomment[],\n  int  *nkeyrec,\n  char **header,\n  int  *status)\n\n{\n  char ch0, ch1, *hptr, keyword[32], *kptr;\n  int  nbyte, nc = 47, nv;\n\n  if (*status) return;\n\n  // Reallocate memory in blocks of 2880 bytes.\n  if ((*nkeyrec)%32 == 0) {\n    nbyte = ((*nkeyrec)/32 + 1) * 2880;\n    if (!(hptr = realloc(*header, nbyte))) {\n      *status = WCSHDRERR_MEMORY;\n      return;\n    }\n\n    *header = hptr;\n  }\n\n  // Construct the keyword.\n  if (alt == ' ') alt = '\\0';\n  if (btcol) {\n    // Binary table image array.\n    if (i > 0 && j) {\n      if (j > 0) {\n        sprintf(keyword, \"%d%d%s%d%c\", i, j, tbkey, btcol, alt);\n      } else {\n        sprintf(keyword, \"%d%s%d_%d%c\", i, tbkey, btcol, m, alt);\n      }\n    } else if (i > 0) {\n      sprintf(keyword, \"%d%s%d%c\", i, tbkey, btcol, alt);\n    } else if (j > 0) {\n      sprintf(keyword, \"%d%s%d%c\", j, tbkey, btcol, alt);\n    } else {\n      sprintf(keyword, \"%s%d%c\", tbkey, btcol, alt);\n    }\n\n    if ((strlen(keyword) < 8) && tlkey && (relax & level)) {\n      // Use the long form.\n      if (i > 0 && j) {\n        if (j > 0) {\n          sprintf(keyword, \"%d%d%s%d%c\", i, j, tlkey, btcol, alt);\n        } else {\n          sprintf(keyword, \"%d%s%d_%d%c\", i, tlkey, btcol, m, alt);\n        }\n      } else if (i > 0) {\n        sprintf(keyword, \"%d%s%d%c\", i, tlkey, btcol, alt);\n      } else if (j > 0) {\n        sprintf(keyword, \"%d%s%d%c\", j, tlkey, btcol, alt);\n      } else {\n        sprintf(keyword, \"%s%d%c\", tlkey, btcol, alt);\n      }\n    }\n\n  } else if (plcol && plcol[0]) {\n    // Pixel list.\n    if (i > 0 && j) {\n      if (j > 0) {\n        sprintf(keyword, \"T%s%d_%d%c\", tbkey, plcol[i-1], plcol[j-1], alt);\n      } else {\n        sprintf(keyword, \"T%s%d_%d%c\", tbkey, plcol[i-1], m, alt);\n      }\n    } else if (i > 0) {\n      sprintf(keyword, \"T%s%d%c\", tbkey, plcol[i-1], alt);\n    } else if (j > 0) {\n      sprintf(keyword, \"T%s%d%c\", tbkey, plcol[j-1], alt);\n    } else {\n      sprintf(keyword, \"%s%d%c\", tbkey, plcol[0], alt);\n    }\n\n    if ((strlen(keyword) < 8) && tlkey && (relax & level)) {\n      // Use the long form.\n      if (i > 0 && j) {\n        if (j > 0) {\n          sprintf(keyword, \"T%s%d_%d%c\", tlkey, plcol[i-1], plcol[j-1], alt);\n        } else {\n          sprintf(keyword, \"T%s%d_%d%c\", tlkey, plcol[i-1], m, alt);\n        }\n      } else if (i > 0) {\n        sprintf(keyword, \"T%s%d%c\", tlkey, plcol[i-1], alt);\n      } else if (j > 0) {\n        sprintf(keyword, \"T%s%d%c\", tlkey, plcol[j-1], alt);\n      } else {\n        sprintf(keyword, \"%s%d%c\", tlkey, plcol[0], alt);\n      }\n    }\n  } else {\n    if (i > 0 && j) {\n      if (j > 0) {\n        sprintf(keyword, \"%s%d_%d%c\", pikey, i, j, alt);\n      } else {\n        sprintf(keyword, \"%s%d_%d%c\", pikey, i, m, alt);\n      }\n    } else if (i > 0) {\n      sprintf(keyword, \"%s%d%c\", pikey, i, alt);\n    } else if (j > 0) {\n      sprintf(keyword, \"%s%d%c\", pikey, j, alt);\n    } else {\n      sprintf(keyword, \"%s%c\", pikey, alt);\n    }\n  }\n\n  // Double-up single-quotes in string keyvalues.\n  if (*keyvalue == '\\'') {\n    hptr = keyvalue + 1;\n    while (*hptr) {\n      if (*hptr == '\\'') {\n        kptr = hptr++;\n        if (*hptr) {\n          ch0 = *kptr;\n          while (*kptr) {\n            ch1 = *(++kptr);\n            *kptr = ch0;\n            ch0 = ch1;\n          }\n        } else {\n          break;\n        }\n      }\n\n      hptr++;\n    }\n\n    // Check length.\n    if (strlen(keyvalue) > 70) {\n      // Truncate.\n      keyvalue[69] = '\\'';\n      keyvalue[70] = '\\0';\n    }\n\n  } else {\n    // Check length.\n    if (strlen(keyvalue) > 70) {\n      // Truncate.\n      keyvalue[70] = '\\0';\n    }\n  }\n\n  if ((nv = strlen(keyvalue) > 20)) {\n    // Rob the keycomment to make space for the keyvalue.\n    nc -= (nv - 20);\n  }\n\n  hptr = *header + (80 * ((*nkeyrec)++));\n  if (*keyword == '\\0') {\n    sprintf(hptr, \"%80.80s\", \" \");\n  } else if (strcmp(keyword, \"COMMENT\") == 0) {\n    sprintf(hptr, \"%-8.8s %-71.71s\", keyword, keycomment);\n  } else {\n    sprintf(hptr, \"%-8.8s= %-20s / %-*.*s\", keyword, keyvalue, nc, nc,\n      keycomment);\n  }\n}\n"},{"id":16587,"name":"lin.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: lin.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"wcserr.h\"\n#include \"wcsprintf.h\"\n#include \"lin.h\"\n#include \"dis.h\"\n\nconst int LINSET = 137;\n\n// Map status return value to message.\nconst char *lin_errmsg[] = {\n  \"Success\",\n  \"Null linprm pointer passed\",\n  \"Memory allocation failed\",\n  \"PCi_ja matrix is singular\",\n  \"Failed to initialize distortion functions\",\n  \"Distort error\",\n  \"De-distort error\"};\n\n// Map error returns for lower-level routines.\nconst int lin_diserr[] = {\n  LINERR_SUCCESS,\t\t//  0: DISERR_SUCCESS\n  LINERR_NULL_POINTER,\t\t//  1: DISERR_NULL_POINTER\n  LINERR_MEMORY,\t\t//  2: DISERR_MEMORY\n  LINERR_DISTORT_INIT,\t\t//  3: DISERR_BAD_PARAM\n  LINERR_DISTORT,\t\t//  4: DISERR_DISTORT\n  LINERR_DEDISTORT\t\t//  5: DISERR_DEDISTORT\n};\n\n// Convenience macro for invoking wcserr_set().\n#define LIN_ERRMSG(status) WCSERR_SET(status), lin_errmsg[status]\n\n//----------------------------------------------------------------------------\n\nint linini(int alloc, int naxis, struct linprm *lin)\n\n{\n  return lininit(alloc, naxis, lin, -1);\n}\n\n//----------------------------------------------------------------------------\n\nint lininit(int alloc, int naxis, struct linprm *lin, int ndpmax)\n\n{\n  static const char *function = \"lininit\";\n\n  if (lin == 0x0) return LINERR_NULL_POINTER;\n\n  // Initialize error message handling.\n  if (lin->flag == -1) {\n    lin->err = 0x0;\n  }\n  struct wcserr **err = &(lin->err);\n  wcserr_clear(err);\n\n\n  // Initialize memory management.\n  if (lin->flag == -1 || lin->m_flag != LINSET) {\n    if (lin->flag == -1) {\n      lin->dispre = 0x0;\n      lin->disseq = 0x0;\n      lin->tmpcrd = 0x0;\n    }\n\n    lin->m_flag   = 0;\n    lin->m_naxis  = 0;\n    lin->m_crpix  = 0x0;\n    lin->m_pc     = 0x0;\n    lin->m_cdelt  = 0x0;\n    lin->m_dispre = 0x0;\n    lin->m_disseq = 0x0;\n  }\n\n  if (naxis < 0) {\n    return wcserr_set(WCSERR_SET(LINERR_MEMORY),\n      \"naxis must not be negative (got %d)\", naxis);\n  }\n\n\n  // Allocate memory for arrays if required.\n  if (alloc ||\n      lin->crpix  == 0x0 ||\n      lin->pc     == 0x0 ||\n      lin->cdelt  == 0x0) {\n\n    // Was sufficient allocated previously?\n    if (lin->m_flag == LINSET && lin->m_naxis < naxis) {\n      // No, free it.\n      linfree(lin);\n    }\n\n    if (alloc || lin->crpix == 0x0) {\n      if (lin->m_crpix) {\n        // In case the caller fiddled with it.\n        lin->crpix = lin->m_crpix;\n\n      } else {\n        if ((lin->crpix = calloc(naxis, sizeof(double))) == 0x0) {\n          return wcserr_set(LIN_ERRMSG(LINERR_MEMORY));\n        }\n\n        lin->m_flag  = LINSET;\n        lin->m_naxis = naxis;\n        lin->m_crpix = lin->crpix;\n      }\n    }\n\n    if (alloc || lin->pc == 0x0) {\n      if (lin->m_pc) {\n        // In case the caller fiddled with it.\n        lin->pc = lin->m_pc;\n\n      } else {\n        if ((lin->pc = calloc(naxis*naxis, sizeof(double))) == 0x0) {\n          linfree(lin);\n          return wcserr_set(LIN_ERRMSG(LINERR_MEMORY));\n        }\n\n        lin->m_flag  = LINSET;\n        lin->m_naxis = naxis;\n        lin->m_pc    = lin->pc;\n      }\n    }\n\n    if (alloc || lin->cdelt == 0x0) {\n      if (lin->m_cdelt) {\n        // In case the caller fiddled with it.\n        lin->cdelt = lin->m_cdelt;\n\n      } else {\n        if ((lin->cdelt = calloc(naxis, sizeof(double))) == 0x0) {\n          linfree(lin);\n          return wcserr_set(LIN_ERRMSG(LINERR_MEMORY));\n        }\n\n        lin->m_flag  = LINSET;\n        lin->m_naxis = naxis;\n        lin->m_cdelt = lin->cdelt;\n      }\n    }\n  }\n\n\n  // Reinitialize disprm structs if we are managing them.\n  if (lin->m_dispre) {\n    disinit(1, naxis, lin->dispre, ndpmax);\n  }\n\n  if (lin->m_disseq) {\n    disinit(1, naxis, lin->disseq, ndpmax);\n  }\n\n\n  // Free memory allocated by linset().\n  if (lin->flag == LINSET) {\n    if (lin->piximg) free(lin->piximg);\n    if (lin->imgpix) free(lin->imgpix);\n    if (lin->tmpcrd) free(lin->tmpcrd);\n  }\n\n  lin->piximg  = 0x0;\n  lin->imgpix  = 0x0;\n  lin->i_naxis = 0;\n  lin->unity   = 0;\n  lin->affine  = 0;\n  lin->simple  = 0;\n  lin->tmpcrd  = 0x0;\n\n\n  lin->flag  = 0;\n  lin->naxis = naxis;\n\n\n  // CRPIXja defaults to 0.0.\n  for (int j = 0; j < naxis; j++) {\n    lin->crpix[j] = 0.0;\n  }\n\n  // PCi_ja defaults to the unit matrix.\n  double *pc = lin->pc;\n  for (int i = 0; i < naxis; i++) {\n    for (int j = 0; j < naxis; j++) {\n      if (j == i) {\n        *pc = 1.0;\n      } else {\n        *pc = 0.0;\n      }\n      pc++;\n    }\n  }\n\n  // CDELTia defaults to 1.0.\n  for (int i = 0; i < naxis; i++) {\n    lin->cdelt[i] = 1.0;\n  }\n\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint lindis(int sequence, struct linprm *lin, struct disprm *dis)\n\n{\n  return lindist(sequence, lin, dis, -1);\n}\n\n//----------------------------------------------------------------------------\n\nint lindist(int sequence, struct linprm *lin, struct disprm *dis, int ndpmax)\n\n{\n  static const char *function = \"lindist\";\n\n  if (lin == 0x0) return LINERR_NULL_POINTER;\n  struct wcserr **err = &(lin->err);\n\n  if (sequence == 1) {\n    if (lin->m_dispre) {\n      disfree(lin->m_dispre);\n      free(lin->m_dispre);\n    }\n\n    lin->dispre   = dis;\n    lin->m_flag   = LINSET;\n    lin->m_dispre = dis;\n\n  } else if (sequence == 2) {\n    if (lin->m_disseq) {\n      disfree(lin->m_disseq);\n      free(lin->m_disseq);\n    }\n\n    lin->disseq   = dis;\n    lin->m_flag   = LINSET;\n    lin->m_disseq = dis;\n\n  } else {\n    return wcserr_set(WCSERR_SET(LINERR_DISTORT_INIT),\n      \"Invalid sequence (%d)\", sequence);\n  }\n\n  if (dis) {\n    int status = disinit(1, lin->naxis, dis, ndpmax);\n    if (status) {\n      return wcserr_set(LIN_ERRMSG(lin_diserr[status]));\n    }\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint lincpy(int alloc, const struct linprm *linsrc, struct linprm *lindst)\n\n{\n  static const char *function = \"lincpy\";\n\n  if (linsrc == 0x0) return LINERR_NULL_POINTER;\n  if (lindst == 0x0) return LINERR_NULL_POINTER;\n  struct wcserr **err = &(lindst->err);\n\n  int naxis = linsrc->naxis;\n  if (naxis < 1) {\n    return wcserr_set(WCSERR_SET(LINERR_MEMORY),\n      \"naxis must be positive (got %d)\", naxis);\n  }\n\n  int status = lininit(alloc, naxis, lindst, 0);\n  if (status) {\n    return status;\n  }\n\n  const double *srcp = linsrc->crpix;\n  double *dstp = lindst->crpix;\n  for (int j = 0; j < naxis; j++) {\n    *(dstp++) = *(srcp++);\n  }\n\n  srcp = linsrc->pc;\n  dstp = lindst->pc;\n  for (int i = 0; i < naxis; i++) {\n    for (int j = 0; j < naxis; j++) {\n      *(dstp++) = *(srcp++);\n    }\n  }\n\n  srcp = linsrc->cdelt;\n  dstp = lindst->cdelt;\n  for (int i = 0; i < naxis; i++) {\n    *(dstp++) = *(srcp++);\n  }\n\n  if (linsrc->dispre) {\n    if (!lindst->dispre) {\n      if ((lindst->dispre = calloc(1, sizeof(struct disprm))) == 0x0) {\n        return wcserr_set(LIN_ERRMSG(LINERR_MEMORY));\n      }\n\n      lindst->m_dispre = lindst->dispre;\n    }\n\n    if ((status = discpy(alloc, linsrc->dispre, lindst->dispre))) {\n      status = wcserr_set(LIN_ERRMSG(lin_diserr[status]));\n      goto cleanup;\n    }\n  }\n\n  if (linsrc->disseq) {\n    if (!lindst->disseq) {\n      if ((lindst->disseq = calloc(1, sizeof(struct disprm))) == 0x0) {\n        return wcserr_set(LIN_ERRMSG(LINERR_MEMORY));\n      }\n\n      lindst->m_disseq = lindst->disseq;\n    }\n\n    if ((status = discpy(alloc, linsrc->disseq, lindst->disseq))) {\n      status = wcserr_set(LIN_ERRMSG(lin_diserr[status]));\n      goto cleanup;\n    }\n  }\n\ncleanup:\n  if (status) {\n    if (lindst->m_dispre) {\n      disfree(lindst->m_dispre);\n      free(lindst->m_dispre);\n      lindst->m_dispre = 0x0;\n      lindst->dispre = 0x0;\n    }\n\n    if (lindst->m_disseq) {\n      disfree(lindst->m_disseq);\n      free(lindst->m_disseq);\n      lindst->m_disseq = 0x0;\n      lindst->disseq = 0x0;\n    }\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint linfree(struct linprm *lin)\n\n{\n  if (lin == 0x0) return LINERR_NULL_POINTER;\n\n  if (lin->flag != -1) {\n    // Optionally allocated by lininit() for given parameters.\n    if (lin->m_flag == LINSET) {\n      if (lin->crpix  == lin->m_crpix)  lin->crpix  = 0x0;\n      if (lin->pc     == lin->m_pc)     lin->pc     = 0x0;\n      if (lin->cdelt  == lin->m_cdelt)  lin->cdelt  = 0x0;\n      if (lin->dispre == lin->m_dispre) lin->dispre = 0x0;\n      if (lin->disseq == lin->m_disseq) lin->disseq = 0x0;\n\n      if (lin->m_crpix)  free(lin->m_crpix);\n      if (lin->m_pc)     free(lin->m_pc);\n      if (lin->m_cdelt)  free(lin->m_cdelt);\n\n      if (lin->m_dispre) {\n        disfree(lin->m_dispre);\n        free(lin->m_dispre);\n      }\n\n      if (lin->m_disseq) {\n        disfree(lin->m_disseq);\n        free(lin->m_disseq);\n      }\n    }\n\n    // Allocated unconditionally by linset().\n    if (lin->piximg) free(lin->piximg);\n    if (lin->imgpix) free(lin->imgpix);\n    if (lin->tmpcrd) free(lin->tmpcrd);\n  }\n\n\n  lin->m_flag   = 0;\n  lin->m_naxis  = 0;\n  lin->m_crpix  = 0x0;\n  lin->m_pc     = 0x0;\n  lin->m_cdelt  = 0x0;\n  lin->m_dispre = 0x0;\n  lin->m_disseq = 0x0;\n\n  lin->piximg   = 0x0;\n  lin->imgpix   = 0x0;\n  lin->i_naxis  = 0;\n\n  lin->tmpcrd   = 0x0;\n\n  wcserr_clear(&(lin->err));\n\n  lin->flag = 0;\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint linsize(const struct linprm *lin, int sizes[2])\n\n{\n  if (lin == 0x0) {\n    sizes[0] = sizes[1] = 0;\n    return LINERR_SUCCESS;\n  }\n\n  // Base size, in bytes.\n  sizes[0] = sizeof(struct linprm);\n\n  // Total size of allocated memory, in bytes.\n  sizes[1] = 0;\n\n  int naxis = lin->naxis;\n\n  // linprm::crpix[].\n  sizes[1] += naxis * sizeof(double);\n\n  // linprm::pc[].\n  sizes[1] += naxis*naxis * sizeof(double);\n\n  // linprm::cdelt[].\n  sizes[1] += naxis * sizeof(double);\n\n  // linprm::dispre[].\n  int exsizes[2];\n  dissize(lin->dispre, exsizes);\n  sizes[1] += exsizes[0] + exsizes[1];\n\n  // linprm::disseq[].\n  dissize(lin->disseq, exsizes);\n  sizes[1] += exsizes[0] + exsizes[1];\n\n  // linprm::err[].\n  wcserr_size(lin->err, exsizes);\n  sizes[1] += exsizes[0] + exsizes[1];\n\n  // The remaining arrays are allocated unconditionally by linset().\n  if (lin->flag != LINSET) {\n    return LINERR_SUCCESS;\n  }\n\n  // linprm::piximg[].\n  sizes[1] += naxis*naxis * sizeof(double);\n\n  // linprm::imgpix[].\n  sizes[1] += naxis*naxis * sizeof(double);\n\n  // linprm::tmpcrd[].\n  sizes[1] += naxis * sizeof(double);\n\n  return LINERR_SUCCESS;\n}\n\n//----------------------------------------------------------------------------\n\nint linprt(const struct linprm *lin)\n\n{\n  if (lin == 0x0) return LINERR_NULL_POINTER;\n\n  if (lin->flag != LINSET) {\n    wcsprintf(\"The linprm struct is UNINITIALIZED.\\n\");\n    return 0;\n  }\n  wcsprintf(\"       flag: %d\\n\", lin->flag);\n\n  // Parameters supplied.\n  wcsprintf(\"      naxis: %d\\n\", lin->naxis);\n\n  WCSPRINTF_PTR(\"      crpix: \", lin->crpix, \"\\n\");\n  wcsprintf(\"            \");\n  for (int j = 0; j < lin->naxis; j++) {\n    wcsprintf(\"  %#- 11.5g\", lin->crpix[j]);\n  }\n  wcsprintf(\"\\n\");\n\n  int k = 0;\n  WCSPRINTF_PTR(\"         pc: \", lin->pc, \"\\n\");\n  for (int i = 0; i < lin->naxis; i++) {\n    wcsprintf(\"    pc[%d][]:\", i);\n    for (int j = 0; j < lin->naxis; j++) {\n      wcsprintf(\"  %#- 11.5g\", lin->pc[k++]);\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  WCSPRINTF_PTR(\"      cdelt: \", lin->cdelt, \"\\n\");\n  wcsprintf(\"            \");\n  for (int i = 0; i < lin->naxis; i++) {\n    wcsprintf(\"  %#- 11.5g\", lin->cdelt[i]);\n  }\n  wcsprintf(\"\\n\");\n\n  WCSPRINTF_PTR(\"     dispre: \", lin->dispre, \"\");\n  if (lin->dispre != 0x0) wcsprintf(\"  (see below)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"     disseq: \", lin->disseq, \"\");\n  if (lin->disseq != 0x0) wcsprintf(\"  (see below)\");\n  wcsprintf(\"\\n\");\n\n  // Derived values.\n  if (lin->piximg == 0x0) {\n    wcsprintf(\"     piximg: (nil)\\n\");\n  } else {\n    int k = 0;\n    for (int i = 0; i < lin->naxis; i++) {\n      wcsprintf(\"piximg[%d][]:\", i);\n      for (int j = 0; j < lin->naxis; j++) {\n        wcsprintf(\"  %#- 11.5g\", lin->piximg[k++]);\n      }\n      wcsprintf(\"\\n\");\n    }\n  }\n\n  if (lin->imgpix == 0x0) {\n    wcsprintf(\"     imgpix: (nil)\\n\");\n  } else {\n    int k = 0;\n    for (int i = 0; i < lin->naxis; i++) {\n      wcsprintf(\"imgpix[%d][]:\", i);\n      for (int j = 0; j < lin->naxis; j++) {\n        wcsprintf(\"  %#- 11.5g\", lin->imgpix[k++]);\n      }\n      wcsprintf(\"\\n\");\n    }\n  }\n\n  wcsprintf(\"    i_naxis: %d\\n\", lin->i_naxis);\n  wcsprintf(\"      unity: %d\\n\", lin->unity);\n  wcsprintf(\"     affine: %d\\n\", lin->affine);\n  wcsprintf(\"     simple: %d\\n\", lin->simple);\n\n  // Error handling.\n  WCSPRINTF_PTR(\"        err: \", lin->err, \"\\n\");\n  if (lin->err) {\n    wcserr_prt(lin->err, \"             \");\n  }\n\n  // Work arrays.\n  WCSPRINTF_PTR(\"     tmpcrd: \", lin->tmpcrd, \"\\n\");\n\n  // Memory management.\n  wcsprintf(\"     m_flag: %d\\n\", lin->m_flag);\n  wcsprintf(\"    m_naxis: %d\\n\", lin->m_naxis);\n  WCSPRINTF_PTR(\"    m_crpix: \", lin->m_crpix, \"\");\n  if (lin->m_crpix == lin->crpix) wcsprintf(\"  (= crpix)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"       m_pc: \", lin->m_pc, \"\");\n  if (lin->m_pc == lin->pc) wcsprintf(\"  (= pc)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"    m_cdelt: \", lin->m_cdelt, \"\");\n  if (lin->m_cdelt == lin->cdelt) wcsprintf(\"  (= cdelt)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"   m_dispre: \", lin->m_dispre, \"\");\n  if (lin->dispre && lin->m_dispre == lin->dispre) wcsprintf(\"  (= dispre)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"   m_disseq: \", lin->m_disseq, \"\");\n  if (lin->disseq && lin->m_disseq == lin->disseq) wcsprintf(\"  (= disseq)\");\n  wcsprintf(\"\\n\");\n\n  // Distortion parameters (from above).\n  if (lin->dispre) {\n    wcsprintf(\"\\n\");\n    wcsprintf(\"dispre.*\\n\");\n    disprt(lin->dispre);\n  }\n\n  if (lin->disseq) {\n    wcsprintf(\"\\n\");\n    wcsprintf(\"disseq.*\\n\");\n    disprt(lin->disseq);\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint linperr(const struct linprm *lin, const char *prefix)\n\n{\n  if (lin == 0x0) return LINERR_NULL_POINTER;\n\n  if (lin->err && wcserr_prt(lin->err, prefix) == 0) {\n    if (lin->dispre) wcserr_prt(lin->dispre->err, prefix);\n    if (lin->disseq) wcserr_prt(lin->disseq->err, prefix);\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint linset(struct linprm *lin)\n\n{\n  static const char *function = \"linset\";\n\n  if (lin == 0x0) return LINERR_NULL_POINTER;\n  struct wcserr **err = &(lin->err);\n\n  int naxis = lin->naxis;\n\n  // Check for a unit matrix.\n  lin->unity = 1;\n  double *pc = lin->pc;\n  for (int i = 0; i < naxis; i++) {\n    for (int j = 0; j < naxis; j++) {\n      if (j == i) {\n        if (*(pc++) != 1.0) {\n          lin->unity = 0;\n          break;\n        }\n      } else {\n        if (*(pc++) != 0.0) {\n          lin->unity = 0;\n          break;\n        }\n      }\n    }\n  }\n\n\n  if (lin->unity) {\n    if (lin->flag == LINSET) {\n      // Free memory that may have been allocated previously.\n      if (lin->piximg) free(lin->piximg);\n      if (lin->imgpix) free(lin->imgpix);\n    }\n\n    lin->piximg  = 0x0;\n    lin->imgpix  = 0x0;\n    lin->i_naxis = 0;\n\n    // Check cdelt.\n    for (int i = 0; i < naxis; i++) {\n      if (lin->cdelt[i] == 0.0) {\n        return wcserr_set(LIN_ERRMSG(LINERR_SINGULAR_MTX));\n      }\n    }\n\n  } else {\n    if (lin->flag != LINSET || lin->i_naxis < naxis) {\n      if (lin->flag == LINSET) {\n        // Free memory that may have been allocated previously.\n        if (lin->piximg) free(lin->piximg);\n        if (lin->imgpix) free(lin->imgpix);\n      }\n\n      // Allocate memory for internal arrays.\n      if ((lin->piximg = calloc(naxis*naxis, sizeof(double))) == 0x0) {\n        return wcserr_set(LIN_ERRMSG(LINERR_MEMORY));\n      }\n\n      if ((lin->imgpix = calloc(naxis*naxis, sizeof(double))) == 0x0) {\n        free(lin->piximg);\n        return wcserr_set(LIN_ERRMSG(LINERR_MEMORY));\n      }\n\n      lin->i_naxis = naxis;\n    }\n\n    // Compute the pixel-to-image transformation matrix.\n    pc = lin->pc;\n    double *piximg = lin->piximg;\n    for (int i = 0; i < naxis; i++) {\n      if (lin->disseq == 0x0) {\n        // No sequent distortions.  Incorporate cdelt into piximg.\n        for (int j = 0; j < naxis; j++) {\n          *(piximg++) = lin->cdelt[i] * (*(pc++));\n        }\n      } else {\n        for (int j = 0; j < naxis; j++) {\n          *(piximg++) = *(pc++);\n        }\n      }\n    }\n\n    // Compute the image-to-pixel transformation matrix.\n    int status = matinv(naxis, lin->piximg, lin->imgpix);\n    if (status) {\n      return wcserr_set(LIN_ERRMSG(status));\n    }\n  }\n\n\n  // Set up the distortion functions.\n  lin->affine = 1;\n  if (lin->dispre) {\n    int status = disset(lin->dispre);\n    if (status) {\n      return wcserr_set(LIN_ERRMSG(lin_diserr[status]));\n    }\n\n    lin->affine = 0;\n  }\n\n  if (lin->disseq) {\n    int status = disset(lin->disseq);\n    if (status) {\n      return wcserr_set(LIN_ERRMSG(lin_diserr[status]));\n    }\n\n    lin->affine = 0;\n  }\n\n  lin->simple = lin->unity && lin->affine;\n\n\n  // Create work arrays.\n  if (lin->tmpcrd) free(lin->tmpcrd);\n  if ((lin->tmpcrd = calloc(naxis, sizeof(double))) == 0x0) {\n    linfree(lin);\n    return wcserr_set(LIN_ERRMSG(LINERR_MEMORY));\n  }\n\n\n  lin->flag = LINSET;\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint linp2x(\n  struct linprm *lin,\n  int ncoord,\n  int nelem,\n  const double pixcrd[],\n  double imgcrd[])\n\n{\n  static const char *function = \"linp2x\";\n\n  // Initialize.\n  if (lin == 0x0) return LINERR_NULL_POINTER;\n  struct wcserr **err = &(lin->err);\n\n  if (lin->flag != LINSET) {\n    int status = linset(lin);\n    if (status) {\n      return status;\n    }\n  }\n\n  int naxis = lin->naxis;\n\n\n  // Convert pixel coordinates to intermediate world coordinates.\n  register const double *pix = pixcrd;\n  register double *img = imgcrd;\n\n  if (lin->simple) {\n    // Handle the simplest and most common case with maximum efficiency.\n    int nelemn = nelem - naxis;\n    for (int k = 0; k < ncoord; k++) {\n      for (int i = 0; i < naxis; i++) {\n        *(img++) = lin->cdelt[i] * (*(pix++) - lin->crpix[i]);\n      }\n\n      pix += nelemn;\n      img += nelemn;\n    }\n\n  } else if (lin->affine) {\n    // No distortions.\n    int ndbl   = naxis * sizeof(double);\n    int nelemn = nelem - naxis;\n    for (int k = 0; k < ncoord; k++) {\n      memset(img, 0, ndbl);\n\n      for (int j = 0; j < naxis; j++) {\n        // cdelt will have been incorporated into piximg.\n        register double *piximg = lin->piximg + j;\n\n        // Column-wise multiplication allows this to be cached.\n        double temp = *(pix++) - lin->crpix[j];\n        for (int i = 0; i < naxis; i++, piximg += naxis) {\n          img[i] += *piximg * temp;\n        }\n      }\n\n      pix += nelemn;\n      img += nelem;\n    }\n\n  } else {\n    // Distortions are present.\n    int ndbl = naxis * sizeof(double);\n    register double *tmp  = lin->tmpcrd;\n\n    for (int k = 0; k < ncoord; k++) {\n      if (lin->dispre) {\n        int status = disp2x(lin->dispre, pix, tmp);\n        if (status) {\n          return wcserr_set(LIN_ERRMSG(lin_diserr[status]));\n        }\n      } else {\n        memcpy(tmp, pix, ndbl);\n      }\n\n      if (lin->unity) {\n        for (int i = 0; i < naxis; i++) {\n          img[i] = tmp[i] - lin->crpix[i];\n        }\n\n      } else {\n        for (int j = 0; j < naxis; j++) {\n          tmp[j] -= lin->crpix[j];\n        }\n\n        register double *piximg = lin->piximg;\n        for (int i = 0; i < naxis; i++) {\n          img[i] = 0.0;\n          for (int j = 0; j < naxis; j++) {\n            img[i] += *(piximg++) * tmp[j];\n          }\n        }\n      }\n\n      if (lin->disseq) {\n        int status = disp2x(lin->disseq, img, tmp);\n        if (status) {\n          return wcserr_set(LIN_ERRMSG(lin_diserr[status]));\n        }\n\n        // With sequent distortions, cdelt is not incorporated into piximg...\n        for (int i = 0; i < naxis; i++) {\n          img[i] = lin->cdelt[i] * tmp[i];\n        }\n\n      } else if (lin->unity) {\n        // ...nor if the matrix is unity.\n        for (int i = 0; i < naxis; i++) {\n          img[i] *= lin->cdelt[i];\n        }\n      }\n\n      pix += nelem;\n      img += nelem;\n    }\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint linx2p(\n  struct linprm *lin,\n  int ncoord,\n  int nelem,\n  const double imgcrd[],\n  double pixcrd[])\n\n{\n  static const char *function = \"linx2p\";\n\n  // Initialize.\n  if (lin == 0x0) return LINERR_NULL_POINTER;\n  struct wcserr **err = &(lin->err);\n\n  if (lin->flag != LINSET) {\n    int status = linset(lin);\n    if (status) {\n      return status;\n    }\n  }\n\n  int naxis = lin->naxis;\n\n\n  // Convert intermediate world coordinates to pixel coordinates.\n  register const double *img = imgcrd;\n  register double *pix = pixcrd;\n\n  if (lin->simple) {\n    // Handle the simplest and most common case with maximum efficiency.\n    int nelemn = nelem - naxis;\n    for (int k = 0; k < ncoord; k++) {\n      for (int j = 0; j < naxis; j++) {\n        *(pix++) = (*(img++) / lin->cdelt[j]) + lin->crpix[j];\n      }\n\n      img += nelemn;\n      pix += nelemn;\n    }\n\n  } else if (lin->affine) {\n    // No distortions.\n    int nelemn = nelem - naxis;\n    for (int k = 0; k < ncoord; k++) {\n      // cdelt will have been incorporated into imgpix.\n      register double *imgpix = lin->imgpix;\n\n      for (int j = 0; j < naxis; j++) {\n        *pix = 0.0;\n        for (int i = 0; i < naxis; i++) {\n          *pix += *imgpix * img[i];\n          imgpix++;\n        }\n\n        *(pix++) += lin->crpix[j];\n      }\n\n      img += nelem;\n      pix += nelemn;\n    }\n\n  } else {\n    // Distortions are present.\n    int ndbl = naxis * sizeof(double);\n    register double *tmp  = lin->tmpcrd;\n\n    for (int k = 0; k < ncoord; k++) {\n      if (lin->disseq) {\n        // With sequent distortions, cdelt is not incorporated into imgpix...\n        for (int i = 0; i < naxis; i++) {\n          tmp[i] = img[i] / lin->cdelt[i];\n        }\n\n        int status = disx2p(lin->disseq, tmp, pix);\n        if (status) {\n          return wcserr_set(LIN_ERRMSG(lin_diserr[status]));\n        }\n\n        memcpy(tmp, pix, ndbl);\n\n      } else if (lin->unity) {\n        // ...nor if the matrix is unity.\n        for (int i = 0; i < naxis; i++) {\n          tmp[i] = img[i] / lin->cdelt[i];\n        }\n\n      } else {\n        // cdelt will have been incorporated into imgpix.\n        memcpy(tmp, img, ndbl);\n      }\n\n      if (lin->unity) {\n        for (int j = 0; j < naxis; j++) {\n          pix[j] = tmp[j] + lin->crpix[j];\n        }\n\n      } else {\n        register double *imgpix = lin->imgpix;\n        for (int j = 0; j < naxis; j++) {\n          pix[j] = lin->crpix[j];\n          for (int i = 0; i < naxis; i++) {\n            pix[j] += *(imgpix++) * tmp[i];\n          }\n        }\n      }\n\n      if (lin->dispre) {\n        memcpy(tmp, pix, ndbl);\n\n        int status = disx2p(lin->dispre, tmp, pix);\n        if (status) {\n          return wcserr_set(LIN_ERRMSG(lin_diserr[status]));\n        }\n      }\n\n      img += nelem;\n      pix += nelem;\n    }\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint linwarp(\n  struct linprm *lin,\n  const double pixblc[],\n  const double pixtrc[],\n  const double pixsamp[],\n  int    *nsamp,\n  double maxdis[],\n  double *maxtot,\n  double avgdis[],\n  double *avgtot,\n  double rmsdis[],\n  double *rmstot)\n\n{\n  static const char *function = \"linwarp\";\n\n  // Initialize.\n  if (lin == 0x0) return LINERR_NULL_POINTER;\n  struct wcserr **err = &(lin->err);\n\n  int naxis = lin->naxis;\n\n  if (nsamp) *nsamp = 0;\n  for (int j = 0; j < naxis; j++) {\n    if (maxdis) maxdis[j] = 0.0;\n    if (avgdis) avgdis[j] = 0.0;\n    if (rmsdis) rmsdis[j] = 0.0;\n  }\n  if (maxtot) *maxtot = 0.0;\n  if (avgtot) *avgtot = 0.0;\n  if (rmstot) *rmstot = 0.0;\n\n  // Quick return if no distortions.\n  if (lin->affine) return 0;\n\n  // It's easier if there are no sequent distortions!\n  if (lin->disseq == 0x0) {\n    int status = diswarp(lin->dispre, pixblc, pixtrc, pixsamp, nsamp,\n                         maxdis, maxtot, avgdis, avgtot, rmsdis, rmstot);\n    return wcserr_set(LIN_ERRMSG(lin_diserr[status]));\n  }\n\n  // Make a reference copy of lin without distortions.\n  struct linprm affine;\n  affine.flag = -1;\n\n  int status = lincpy(1, lin, &affine) ||\n               lindist(1, &affine, 0x0, 0) ||\n               lindist(2, &affine, 0x0, 0) ||\n               linset(&affine);\n  if (status) {\n    return wcserr_set(LIN_ERRMSG(status));\n  }\n\n  // Work out increments on each axis.\n  int ncoord = 0;\n  for (int j = 0; j < naxis; j++) {\n    double *pixinc = lin->tmpcrd;\n    double pixspan = pixtrc[j] - (pixblc ? pixblc[j] : 1.0);\n\n    if (pixsamp == 0x0) {\n      pixinc[j] = 1.0;\n    } else if (pixsamp[j] == 0.0) {\n      pixinc[j] = 1.0;\n    } else if (pixsamp[j] > 0.0) {\n      pixinc[j] = pixsamp[j];\n    } else if (pixsamp[j] > -1.5) {\n      pixinc[j] = 2.0*pixspan;\n    } else {\n      pixinc[j] = pixspan / ((int)(-pixsamp[j] - 0.5));\n    }\n\n    if (j == 0) {\n      // Number of samples on axis 1.\n      ncoord = 1 + (int)((pixspan/pixinc[0]) + 0.5);\n    }\n  }\n\n  // Allocate memory in bulk for processing the image row by row.\n  double *pix0 = calloc((3*ncoord+4)*naxis, sizeof(double));\n  if (pix0 == 0x0) {\n    return wcserr_set(LIN_ERRMSG(LINERR_MEMORY));\n  }\n\n  // Carve up the allocated memory.\n  double *img    = pix0 + naxis*ncoord;\n  double *pix1   = img  + naxis*ncoord;\n  double *pixinc = pix1 + naxis*ncoord;\n  double *pixend = pixinc + naxis;\n  double *sumdis = pixend + naxis;\n  double *ssqdis = sumdis + naxis;\n\n\n  // Copy tmpcrd since linp2x() will overwrite it.\n  memcpy(pixinc, lin->tmpcrd, naxis*sizeof(double));\n\n  // Set up the array of pixel coordinates.\n  for (int j = 0; j < naxis; j++) {\n    pix0[j] = pixblc ? pixblc[j] : 1.0;\n    pixend[j] = pixtrc[j] + 0.5*pixinc[j];\n  }\n\n  double *pix0p = pix0 + naxis;\n  for (int i = 1; i < ncoord; i++) {\n    *(pix0p++) = pix0[0] + i*pixinc[0];\n\n    for (int j = 1; j < naxis; j++) {\n      *(pix0p++) = pix0[j];\n    }\n  }\n\n  // Initialize accumulators.\n  for (int j = 0; j < naxis; j++) {\n    sumdis[j] = 0.0;\n    ssqdis[j] = 0.0;\n  }\n  double sumtot = 0.0;\n  double ssqtot = 0.0;\n\n\n  // Loop over N dimensions.\n  int carry = 0;\n  while (carry == 0) {\n    int status;\n    if ((status = linp2x(lin, ncoord, naxis, pix0, img))) {\n      // (Preserve the error message set by linp2x().)\n      goto cleanup;\n    }\n\n    if ((status = linx2p(&affine, ncoord, naxis, img, pix1))) {\n      // (Preserve the error message set by linx2p().)\n      goto cleanup;\n    }\n\n    // Accumulate statistics.\n    double *pix0p = pix0;\n    double *pix1p = pix1;\n    for (int i = 0; i < ncoord; i++) {\n      (*nsamp)++;\n\n      double dssq = 0.0;\n      for (int j = 0; j < naxis; j++) {\n        double dpix = *(pix1p++) - *(pix0p++);\n        double dpx2 = dpix*dpix;\n\n        sumdis[j] += dpix;\n        ssqdis[j] += dpx2;\n\n        if (maxdis && (dpix = fabs(dpix)) > maxdis[j]) maxdis[j] = dpix;\n\n        dssq += dpx2;\n      }\n\n      double totdis = sqrt(dssq);\n      sumtot += totdis;\n      ssqtot += totdis*totdis;\n\n      if (maxtot && *maxtot < totdis) *maxtot = totdis;\n    }\n\n    // Next array of pixel coordinates.\n    for (int j = 1; j < naxis; j++) {\n      pix0[j] += pixinc[j];\n      if ((carry = (pix0[j] > pixend[j]))) {\n        pix0[j] = pixblc ? pixblc[j] : 1.0;\n      }\n\n      pix0p = pix0 + naxis + j;\n      for (int i = 1; i < ncoord; i++) {\n        *pix0p = pix0[j];\n        pix0p += naxis;\n      }\n\n      if (carry == 0) break;\n    }\n  }\n\n\n  // Compute the means and RMSs.\n  for (int j = 0; j < naxis; j++) {\n    ssqdis[j] /= *nsamp;\n    sumdis[j] /= *nsamp;\n    if (avgdis) avgdis[j] = sumdis[j];\n    if (rmsdis) rmsdis[j] = sqrt(ssqdis[j] - sumdis[j]*sumdis[j]);\n  }\n\n  ssqtot /= *nsamp;\n  sumtot /= *nsamp;\n  if (avgtot) *avgtot = sumtot;\n  if (rmstot) *rmstot = sqrt(ssqtot - sumtot*sumtot);\n\n\ncleanup:\n  linfree(&affine);\n  free(pix0);\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint matinv(int n, const double mat[], double inv[])\n\n{\n  // Allocate memory for internal arrays.\n  int *mxl = calloc(n, sizeof(int));\n  if (mxl == 0x0) {\n    return LINERR_MEMORY;\n  }\n\n  int *lxm = calloc(n, sizeof(int));\n  if (lxm == 0x0) {\n    free(mxl);\n    return LINERR_MEMORY;\n  }\n\n  double *rowmax = calloc(n, sizeof(double));\n  if (rowmax == 0x0) {\n    free(mxl);\n    free(lxm);\n    return LINERR_MEMORY;\n  }\n\n  double *lu = calloc(n*n, sizeof(double));\n  if (lu == 0x0) {\n    free(mxl);\n    free(lxm);\n    free(rowmax);\n    return LINERR_MEMORY;\n  }\n\n\n  // Initialize arrays.\n  register int ij = 0;\n  for (int i = 0; i < n; i++) {\n    // Vector that records row interchanges.\n    mxl[i] = i;\n\n    rowmax[i] = 0.0;\n\n    for (int j = 0; j < n; j++, ij++) {\n      double dtemp = fabs(mat[ij]);\n      if (dtemp > rowmax[i]) rowmax[i] = dtemp;\n\n      lu[ij] = mat[ij];\n    }\n\n    // A row of zeroes indicates a singular matrix.\n    if (rowmax[i] == 0.0) {\n      free(mxl);\n      free(lxm);\n      free(rowmax);\n      free(lu);\n      return LINERR_SINGULAR_MTX;\n    }\n  }\n\n\n  // Form the LU triangular factorization using scaled partial pivoting.\n  for (int k = 0; k < n; k++) {\n    // Decide whether to pivot.\n    int pivot = k;\n    double colmax = fabs(lu[k*n+k]) / rowmax[k];\n\n    for (int i = k+1; i < n; i++) {\n      register int ik = i*n + k;\n      double dtemp = fabs(lu[ik]) / rowmax[i];\n      if (dtemp > colmax) {\n        colmax = dtemp;\n        pivot = i;\n      }\n    }\n\n    if (pivot > k) {\n      // We must pivot, interchange the rows of the design matrix.\n      register int kj = k*n;\n      register int pj = pivot*n;\n      for (int j = 0; j < n; j++, pj++, kj++) {\n        double dtemp = lu[pj];\n        lu[pj] = lu[kj];\n        lu[kj] = dtemp;\n      }\n\n      // Amend the vector of row maxima.\n      double dtemp = rowmax[pivot];\n      rowmax[pivot] = rowmax[k];\n      rowmax[k] = dtemp;\n\n      // Record the interchange for later use.\n      int itemp = mxl[pivot];\n      mxl[pivot] = mxl[k];\n      mxl[k] = itemp;\n    }\n\n    // Gaussian elimination.\n    for (int i = k+1; i < n; i++) {\n      register int ik = i*n + k;\n\n      // Nothing to do if lu[ik] is zero.\n      if (lu[ik] != 0.0) {\n        // Save the scaling factor.\n        lu[ik] /= lu[k*n+k];\n\n        // Subtract rows.\n        for (int j = k+1; j < n; j++) {\n          lu[i*n+j] -= lu[ik]*lu[k*n+j];\n        }\n      }\n    }\n  }\n\n\n  // mxl[i] records which row of mat corresponds to row i of lu.\n  // lxm[i] records which row of lu  corresponds to row i of mat.\n  for (int i = 0; i < n; i++) {\n    lxm[mxl[i]] = i;\n  }\n\n\n  // Determine the inverse matrix.\n  ij = 0;\n  for (int i = 0; i < n; i++) {\n    for (int j = 0; j < n; j++, ij++) {\n      inv[ij] = 0.0;\n    }\n  }\n\n  for (int k = 0; k < n; k++) {\n    inv[lxm[k]*n+k] = 1.0;\n\n    // Forward substitution.\n    for (int i = lxm[k]+1; i < n; i++) {\n      for (int j = lxm[k]; j < i; j++) {\n        inv[i*n+k] -= lu[i*n+j]*inv[j*n+k];\n      }\n    }\n\n    // Backward substitution.\n    for (int i = n-1; i >= 0; i--) {\n      for (int j = i+1; j < n; j++) {\n        inv[i*n+k] -= lu[i*n+j]*inv[j*n+k];\n      }\n      inv[i*n+k] /= lu[i*n+i];\n    }\n  }\n\n  free(mxl);\n  free(lxm);\n  free(rowmax);\n  free(lu);\n\n  return 0;\n}\n"},{"id":16588,"name":"wcsprintf.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsprintf.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the wcsprintf routines\n* ---------------------------------\n* Routines in this suite allow diagnostic output from celprt(), linprt(),\n* prjprt(), spcprt(), tabprt(), wcsprt(), and wcserr_prt() to be redirected to\n* a file or captured in a string buffer.  Those routines all use wcsprintf()\n* for output.  Likewise wcsfprintf() is used by wcsbth() and wcspih().  Both\n* functions may be used by application programmers to have other output go to\n* the same place.\n*\n*\n* wcsprintf() - Print function used by WCSLIB diagnostic routines\n* ---------------------------------------------------------------\n* wcsprintf() is used by celprt(), linprt(), prjprt(), spcprt(), tabprt(),\n* wcsprt(), and wcserr_prt() for diagnostic output which by default goes to\n* stdout.  However, it may be redirected to a file or string buffer via\n* wcsprintf_set().\n*\n* Given:\n*   format    char*     Format string, passed to one of the printf(3) family\n*                       of stdio library functions.\n*\n*   ...       mixed     Argument list matching format, as per printf(3).\n*\n* Function return value:\n*             int       Number of bytes written.\n*\n*\n* wcsfprintf() - Print function used by WCSLIB diagnostic routines\n* ----------------------------------------------------------------\n* wcsfprintf() is used by wcsbth(), and wcspih() for diagnostic output which\n* they send to stderr.  However, it may be redirected to a file or string\n* buffer via wcsprintf_set().\n*\n* Given:\n*   stream    FILE*     The output stream if not overridden by a call to\n*                       wcsprintf_set().\n*\n*   format    char*     Format string, passed to one of the printf(3) family\n*                       of stdio library functions.\n*\n*   ...       mixed     Argument list matching format, as per printf(3).\n*\n* Function return value:\n*             int       Number of bytes written.\n*\n*\n* wcsprintf_set() - Set output disposition for wcsprintf() and wcsfprintf()\n* -------------------------------------------------------------------------\n* wcsprintf_set() sets the output disposition for wcsprintf() which is used by\n* the celprt(), linprt(), prjprt(), spcprt(), tabprt(), wcsprt(), and\n* wcserr_prt() routines, and for wcsfprintf() which is used by wcsbth() and\n* wcspih().\n*\n* Given:\n*   wcsout    FILE*     Pointer to an output stream that has been opened for\n*                       writing, e.g. by the fopen() stdio library function,\n*                       or one of the predefined stdio output streams - stdout\n*                       and stderr.  If zero (NULL), output is written to an\n*                       internally-allocated string buffer, the address of\n*                       which may be obtained by wcsprintf_buf().\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*\n*\n* wcsprintf_buf() - Get the address of the internal string buffer\n* ---------------------------------------------------------------\n* wcsprintf_buf() returns the address of the internal string buffer created\n* when wcsprintf_set() is invoked with its FILE* argument set to zero.\n*\n* Function return value:\n*             const char *\n*                       Address of the internal string buffer.  The user may\n*                       free this buffer by calling wcsprintf_set() with a\n*                       valid FILE*, e.g. stdout.  The free() stdlib library\n*                       function must NOT be invoked on this const pointer.\n*\n*\n* WCSPRINTF_PTR() macro - Print addresses in a consistent way\n* -----------------------------------------------------------\n* WCSPRINTF_PTR() is a preprocessor macro used to print addresses in a\n* consistent way.\n*\n* On some systems the \"%p\" format descriptor renders a NULL pointer as the\n* string \"0x0\".  On others, however, it produces \"0\" or even \"(nil)\".  On\n* some systems a non-zero address is prefixed with \"0x\", on others, not.\n*\n* The WCSPRINTF_PTR() macro ensures that a NULL pointer is always rendered as\n* \"0x0\" and that non-zero addresses are prefixed with \"0x\" thus providing\n* consistency, for example, for comparing the output of test programs.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_WCSPRINTF\n#define WCSLIB_WCSPRINTF\n\n#include <inttypes.h>\n#include <stdio.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define WCSPRINTF_PTR(str1, ptr, str2) \\\n  if (ptr) { \\\n    wcsprintf(\"%s%#\" PRIxPTR \"%s\", (str1), (uintptr_t)(ptr), (str2)); \\\n  } else { \\\n    wcsprintf(\"%s0x0%s\", (str1), (str2)); \\\n  }\n\nint wcsprintf_set(FILE *wcsout);\nint wcsprintf(const char *format, ...);\nint wcsfprintf(FILE *stream, const char *format, ...);\nconst char *wcsprintf_buf(void);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WCSLIB_WCSPRINTF\n"},{"id":16589,"name":"wtbarr.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wtbarr.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the wtbarr struct\n* ----------------------------\n* The wtbarr struct is used by wcstab() in extracting coordinate lookup tables\n* from a binary table extension (BINTABLE) and copying them into the tabprm\n* structs stored in wcsprm.\n*\n*\n* wtbarr struct - Extraction of coordinate lookup tables from BINTABLE\n* --------------------------------------------------------------------\n* Function wcstab(), which is invoked automatically by wcspih(), sets up an\n* array of wtbarr structs to assist in extracting coordinate lookup tables\n* from a binary table extension (BINTABLE) and copying them into the tabprm\n* structs stored in wcsprm.  Refer to the usage notes for wcspih() and\n* wcstab() in wcshdr.h, and also the prologue to tab.h.\n*\n* For C++ usage, because of a name space conflict with the wtbarr typedef\n* defined in CFITSIO header fitsio.h, the wtbarr struct is renamed to wtbarr_s\n* by preprocessor macro substitution with scope limited to wtbarr.h itself,\n* and similarly in wcs.h.\n*\n*   int i\n*     (Given) Image axis number.\n*\n*   int m\n*     (Given) wcstab array axis number for index vectors.\n*\n*   int kind\n*     (Given) Character identifying the wcstab array type:\n*       - c: coordinate array,\n*       - i: index vector.\n*\n*   char extnam[72]\n*     (Given) EXTNAME identifying the binary table extension.\n*\n*   int extver\n*     (Given) EXTVER identifying the binary table extension.\n*\n*   int extlev\n*     (Given) EXTLEV identifying the binary table extension.\n*\n*   char ttype[72]\n*     (Given) TTYPEn identifying the column of the binary table that contains\n*     the wcstab array.\n*\n*   long row\n*     (Given) Table row number.\n*\n*   int ndim\n*     (Given) Expected dimensionality of the wcstab array.\n*\n*   int *dimlen\n*     (Given) Address of the first element of an array of int of length ndim\n*     into which the wcstab array axis lengths are to be written.\n*\n*   double **arrayp\n*     (Given) Pointer to an array of double which is to be allocated by the\n*     user and into which the wcstab array is to be written.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_WTBARR\n#define WCSLIB_WTBARR\n\n#ifdef __cplusplus\nextern \"C\" {\n#define wtbarr wtbarr_s\t\t// See prologue above.\n#endif\n\t\t\t\t// For extracting wcstab arrays.  Matches\n\t\t\t\t// the wtbarr typedef defined in CFITSIO\n\t\t\t\t// header fitsio.h.\nstruct wtbarr {\n  int  i;\t\t\t// Image axis number.\n  int  m;\t\t\t// Array axis number for index vectors.\n  int  kind;\t\t\t// wcstab array type.\n  char extnam[72];\t\t// EXTNAME of binary table extension.\n  int  extver;\t\t\t// EXTVER  of binary table extension.\n  int  extlev;\t\t\t// EXTLEV  of binary table extension.\n  char ttype[72];\t\t// TTYPEn of column containing the array.\n  long row;\t\t\t// Table row number.\n  int  ndim;\t\t\t// Expected wcstab array dimensionality.\n  int  *dimlen;\t\t\t// Where to write the array axis lengths.\n  double **arrayp;\t\t// Where to write the address of the array\n\t\t\t\t// allocated to store the wcstab array.\n};\n\n#ifdef __cplusplus\n#undef wtbarr\n}\n#endif\n\n#endif // WCSLIB_WTBARR\n"},{"id":16590,"name":"wcsmath.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsmath.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of wcsmath.h\n* --------------------\n* Definition of mathematical constants used by WCSLIB.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_WCSMATH\n#define WCSLIB_WCSMATH\n\n#ifdef PI\n#undef PI\n#endif\n\n#ifdef D2R\n#undef D2R\n#endif\n\n#ifdef R2D\n#undef R2D\n#endif\n\n#ifdef SQRT2\n#undef SQRT2\n#endif\n\n#ifdef SQRT2INV\n#undef SQRT2INV\n#endif\n\n#define PI 3.141592653589793238462643\n#define D2R PI/180.0\n#define R2D 180.0/PI\n#define SQRT2 1.4142135623730950488\n#define SQRT2INV 1.0/SQRT2\n\n#ifdef UNDEFINED\n#undef UNDEFINED\n#endif\n\n#define UNDEFINED 987654321.0e99\n#define undefined(value) (value == UNDEFINED)\n\n#endif // WCSLIB_WCSMATH\n"},{"id":16591,"name":"cel.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: cel.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the cel routines\n* ---------------------------\n* Routines in this suite implement the part of the FITS World Coordinate\n* System (WCS) standard that deals with celestial coordinates, as described in\n*\n=   \"Representations of world coordinates in FITS\",\n=   Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (WCS Paper I)\n=\n=   \"Representations of celestial coordinates in FITS\",\n=   Calabretta, M.R., & Greisen, E.W. 2002, A&A, 395, 1077 (WCS Paper II)\n*\n* These routines define methods to be used for computing celestial world\n* coordinates from intermediate world coordinates (a linear transformation\n* of image pixel coordinates), and vice versa.  They are based on the celprm\n* struct which contains all information needed for the computations.  This\n* struct contains some elements that must be set by the user, and others that\n* are maintained by these routines, somewhat like a C++ class but with no\n* encapsulation.\n*\n* Routine celini() is provided to initialize the celprm struct with default\n* values, celfree() reclaims any memory that may have been allocated to store\n* an error message, celsize() computes its total size including allocated\n* memory, and celprt() prints its contents.\n*\n* celperr() prints the error message(s), if any, stored in a celprm struct and\n* the prjprm struct that it contains.\n*\n* A setup routine, celset(), computes intermediate values in the celprm struct\n* from parameters in it that were supplied by the user.  The struct always\n* needs to be set up by celset() but it need not be called explicitly - refer\n* to the explanation of celprm::flag.\n*\n* celx2s() and cels2x() implement the WCS celestial coordinate\n* transformations.  In fact, they are high level driver routines for the lower\n* level spherical coordinate rotation and projection routines described in\n* sph.h and prj.h.\n*\n*\n* celini() - Default constructor for the celprm struct\n* ----------------------------------------------------\n* celini() sets all members of a celprm struct to default values.  It should\n* be used to initialize every celprm struct.\n*\n* PLEASE NOTE: If the celprm struct has already been initialized, then before\n* reinitializing, it celfree() should be used to free any memory that may have\n* been allocated to store an error message.  A memory leak may otherwise\n* result.\n*\n* Returned:\n*   cel       struct celprm*\n*                       Celestial transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null celprm pointer passed.\n*\n*\n* celfree() - Destructor for the celprm struct\n* --------------------------------------------\n* celfree() frees any memory that may have been allocated to store an error\n* message in the celprm struct.\n*\n* Given:\n*   cel       struct celprm*\n*                       Celestial transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null celprm pointer passed.\n*\n*\n* celsize() - Compute the size of a celprm struct\n* -----------------------------------------------\n* celsize() computes the full size of a celprm struct, including allocated\n* memory.\n*\n* Given:\n*   cel       const struct celprm*\n*                       Celestial transformation parameters.\n*\n*                       If NULL, the base size of the struct and the allocated\n*                       size are both set to zero.\n*\n* Returned:\n*   sizes     int[2]    The first element is the base size of the struct as\n*                       returned by sizeof(struct celprm).  The second element\n*                       is the total allocated size, in bytes.  This figure\n*                       includes memory allocated for the constituent struct,\n*                       celprm::err.\n*\n*                       It is not an error for the struct not to have been set\n*                       up via celset().\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*\n*\n* celprt() - Print routine for the celprm struct\n* ----------------------------------------------\n* celprt() prints the contents of a celprm struct using wcsprintf().  Mainly\n* intended for diagnostic purposes.\n*\n* Given:\n*   cel       const struct celprm*\n*                       Celestial transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null celprm pointer passed.\n*\n*\n* celperr() - Print error messages from a celprm struct\n* -----------------------------------------------------\n* celperr() prints the error message(s), if any, stored in a celprm struct and\n* the prjprm struct that it contains.  If there are no errors then nothing is\n* printed.  It uses wcserr_prt(), q.v.\n*\n* Given:\n*   cel       const struct celprm*\n*                       Coordinate transformation parameters.\n*\n*   prefix    const char *\n*                       If non-NULL, each output line will be prefixed with\n*                       this string.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null celprm pointer passed.\n*\n*\n* celset() - Setup routine for the celprm struct\n* ----------------------------------------------\n* celset() sets up a celprm struct according to information supplied within\n* it.\n*\n* Note that this routine need not be called directly; it will be invoked by\n* celx2s() and cels2x() if celprm::flag is anything other than a predefined\n* magic value.\n*\n* Given and returned:\n*   cel       struct celprm*\n*                       Celestial transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null celprm pointer passed.\n*                         2: Invalid projection parameters.\n*                         3: Invalid coordinate transformation parameters.\n*                         4: Ill-conditioned coordinate transformation\n*                            parameters.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       celprm::err if enabled, see wcserr_enable().\n*\n*\n* celx2s() - Pixel-to-world celestial transformation\n* --------------------------------------------------\n* celx2s() transforms (x,y) coordinates in the plane of projection to\n* celestial coordinates (lng,lat).\n*\n* Given and returned:\n*   cel       struct celprm*\n*                       Celestial transformation parameters.\n*\n* Given:\n*   nx,ny     int       Vector lengths.\n*\n*   sxy,sll   int       Vector strides.\n*\n*   x,y       const double[]\n*                       Projected coordinates in pseudo \"degrees\".\n*\n* Returned:\n*   phi,theta double[]  Longitude and latitude (phi,theta) in the native\n*                       coordinate system of the projection [deg].\n*\n*   lng,lat   double[]  Celestial longitude and latitude (lng,lat) of the\n*                       projected point [deg].\n*\n*   stat      int[]     Status return value for each vector element:\n*                         0: Success.\n*                         1: Invalid value of (x,y).\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null celprm pointer passed.\n*                         2: Invalid projection parameters.\n*                         3: Invalid coordinate transformation parameters.\n*                         4: Ill-conditioned coordinate transformation\n*                            parameters.\n*                         5: One or more of the (x,y) coordinates were\n*                            invalid, as indicated by the stat vector.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       celprm::err if enabled, see wcserr_enable().\n*\n*\n* cels2x() - World-to-pixel celestial transformation\n* --------------------------------------------------\n* cels2x() transforms celestial coordinates (lng,lat) to (x,y) coordinates in\n* the plane of projection.\n*\n* Given and returned:\n*   cel       struct celprm*\n*                       Celestial transformation parameters.\n*\n* Given:\n*   nlng,nlat int       Vector lengths.\n*\n*   sll,sxy   int       Vector strides.\n*\n*   lng,lat   const double[]\n*                       Celestial longitude and latitude (lng,lat) of the\n*                       projected point [deg].\n*\n* Returned:\n*   phi,theta double[]  Longitude and latitude (phi,theta) in the native\n*                       coordinate system of the projection [deg].\n*\n*   x,y       double[]  Projected coordinates in pseudo \"degrees\".\n*\n*   stat      int[]     Status return value for each vector element:\n*                         0: Success.\n*                         1: Invalid value of (lng,lat).\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null celprm pointer passed.\n*                         2: Invalid projection parameters.\n*                         3: Invalid coordinate transformation parameters.\n*                         4: Ill-conditioned coordinate transformation\n*                            parameters.\n*                         6: One or more of the (lng,lat) coordinates were\n*                            invalid, as indicated by the stat vector.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       celprm::err if enabled, see wcserr_enable().\n*\n*\n* celprm struct - Celestial transformation parameters\n* ---------------------------------------------------\n* The celprm struct contains information required to transform celestial\n* coordinates.  It consists of certain members that must be set by the user\n* (\"given\") and others that are set by the WCSLIB routines (\"returned\").  Some\n* of the latter are supplied for informational purposes and others are for\n* internal use only.\n*\n* Returned celprm struct members must not be modified by the user.\n*\n*   int flag\n*     (Given and returned) This flag must be set to zero whenever any of the\n*     following celprm struct members are set or changed:\n*\n*       - celprm::offset,\n*       - celprm::phi0,\n*       - celprm::theta0,\n*       - celprm::ref[4],\n*       - celprm::prj:\n*         - prjprm::code,\n*         - prjprm::r0,\n*         - prjprm::pv[],\n*         - prjprm::phi0,\n*         - prjprm::theta0.\n*\n*     This signals the initialization routine, celset(), to recompute the\n*     returned members of the celprm struct.  celset() will reset flag to\n*     indicate that this has been done.\n*\n*   int offset\n*     (Given) If true (non-zero), an offset will be applied to (x,y) to\n*     force (x,y) = (0,0) at the fiducial point, (phi_0,theta_0).\n*     Default is 0 (false).\n*\n*   double phi0\n*     (Given) The native longitude, phi_0 [deg], and ...\n*\n*   double theta0\n*     (Given) ... the native latitude, theta_0 [deg], of the fiducial point,\n*     i.e. the point whose celestial coordinates are given in\n*     celprm::ref[1:2].  If undefined (set to a magic value by prjini()) the\n*     initialization routine, celset(), will set this to a projection-specific\n*     default.\n*\n*   double ref[4]\n*     (Given) The first pair of values should be set to the celestial\n*     longitude and latitude of the fiducial point [deg] - typically right\n*     ascension and declination.  These are given by the CRVALia keywords in\n*     FITS.\n*\n*     (Given and returned) The second pair of values are the native longitude,\n*     phi_p [deg], and latitude, theta_p [deg], of the celestial pole (the\n*     latter is the same as the celestial latitude of the native pole,\n*     delta_p) and these are given by the FITS keywords LONPOLEa and LATPOLEa\n*     (or by PVi_2a and PVi_3a attached to the longitude axis which take\n*     precedence if defined).\n*\n*     LONPOLEa defaults to phi_0 (see above) if the celestial latitude of the\n*     fiducial point of the projection is greater than or equal to the native\n*     latitude, otherwise phi_0 + 180 [deg].  (This is the condition for the\n*     celestial latitude to increase in the same direction as the native\n*     latitude at the fiducial point.)  ref[2] may be set to UNDEFINED (from\n*     wcsmath.h) or 999.0 to indicate that the correct default should be\n*     substituted.\n*\n*     theta_p, the native latitude of the celestial pole (or equally the\n*     celestial latitude of the native pole, delta_p) is often determined\n*     uniquely by CRVALia and LONPOLEa in which case LATPOLEa is ignored.\n*     However, in some circumstances there are two valid solutions for theta_p\n*     and LATPOLEa is used to choose between them.  LATPOLEa is set in ref[3]\n*     and the solution closest to this value is used to reset ref[3].  It is\n*     therefore legitimate, for example, to set ref[3] to +90.0 to choose the\n*     more northerly solution - the default if the LATPOLEa keyword is omitted\n*     from the FITS header.  For the special case where the fiducial point of\n*     the projection is at native latitude zero, its celestial latitude is\n*     zero, and LONPOLEa = +/- 90.0 then the celestial latitude of the native\n*     pole is not determined by the first three reference values and LATPOLEa\n*     specifies it completely.\n*\n*     The returned value, celprm::latpreq, specifies how LATPOLEa was actually\n*     used.\n*\n*   struct prjprm prj\n*     (Given and returned) Projection parameters described in the prologue to\n*     prj.h.\n*\n*   double euler[5]\n*     (Returned) Euler angles and associated intermediaries derived from the\n*     coordinate reference values.  The first three values are the Z-, X-, and\n*     Z'-Euler angles [deg], and the remaining two are the cosine and sine of\n*     the X-Euler angle.\n*\n*   int latpreq\n*     (Returned) For informational purposes, this indicates how the LATPOLEa\n*     keyword was used\n*       - 0: Not required, theta_p (== delta_p) was determined uniquely by the\n*            CRVALia and LONPOLEa keywords.\n*       - 1: Required to select between two valid solutions of theta_p.\n*       - 2: theta_p was specified solely by LATPOLEa.\n*\n*   int isolat\n*     (Returned) True if the spherical rotation preserves the magnitude of the\n*     latitude, which occurs iff the axes of the native and celestial\n*     coordinates are coincident.  It signals an opportunity to cache\n*     intermediate calculations common to all elements in a vector\n*     computation.\n*\n*   struct wcserr *err\n*     (Returned) If enabled, when an error status is returned, this struct\n*     contains detailed information about the error, see wcserr_enable().\n*\n*   void *padding\n*     (An unused variable inserted for alignment purposes only.)\n*\n* Global variable: const char *cel_errmsg[] - Status return messages\n* ------------------------------------------------------------------\n* Status messages to match the status value returned from each function.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_CEL\n#define WCSLIB_CEL\n\n#include \"prj.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\nextern const char *cel_errmsg[];\n\nenum cel_errmsg_enum {\n  CELERR_SUCCESS         = 0,\t// Success.\n  CELERR_NULL_POINTER    = 1,\t// Null celprm pointer passed.\n  CELERR_BAD_PARAM       = 2,\t// Invalid projection parameters.\n  CELERR_BAD_COORD_TRANS = 3,\t// Invalid coordinate transformation\n\t\t\t\t// parameters.\n  CELERR_ILL_COORD_TRANS = 4,\t// Ill-conditioned coordinated transformation\n\t\t\t\t// parameters.\n  CELERR_BAD_PIX         = 5,\t// One or more of the (x,y) coordinates were\n\t\t\t\t// invalid.\n  CELERR_BAD_WORLD       = 6 \t// One or more of the (lng,lat) coordinates\n\t\t\t\t// were invalid.\n};\n\nstruct celprm {\n  // Initialization flag (see the prologue above).\n  //--------------------------------------------------------------------------\n  int    flag;\t\t\t// Set to zero to force initialization.\n\n  // Parameters to be provided (see the prologue above).\n  //--------------------------------------------------------------------------\n  int    offset;\t\t// Force (x,y) = (0,0) at (phi_0,theta_0).\n  double phi0, theta0;\t\t// Native coordinates of fiducial point.\n  double ref[4];\t\t// Celestial coordinates of fiducial\n                                // point and native coordinates of\n                                // celestial pole.\n\n  struct prjprm prj;\t\t// Projection parameters (see prj.h).\n\n  // Information derived from the parameters supplied.\n  //--------------------------------------------------------------------------\n  double euler[5];\t\t// Euler angles and functions thereof.\n  int    latpreq;\t\t// LATPOLEa requirement.\n  int    isolat;\t\t// True if |latitude| is preserved.\n\n  // Error handling\n  //--------------------------------------------------------------------------\n  struct wcserr *err;\n\n  // Private\n  //--------------------------------------------------------------------------\n  void   *padding;\t\t// (Dummy inserted for alignment purposes.)\n};\n\n// Size of the celprm struct in int units, used by the Fortran wrappers.\n#define CELLEN (sizeof(struct celprm)/sizeof(int))\n\n\nint celini(struct celprm *cel);\n\nint celfree(struct celprm *cel);\n\nint celsize(const struct celprm *cel, int sizes[2]);\n\nint celprt(const struct celprm *cel);\n\nint celperr(const struct celprm *cel, const char *prefix);\n\nint celset(struct celprm *cel);\n\nint celx2s(struct celprm *cel, int nx, int ny, int sxy, int sll,\n           const double x[], const double y[],\n           double phi[], double theta[], double lng[], double lat[],\n           int stat[]);\n\nint cels2x(struct celprm *cel, int nlng, int nlat, int sll, int sxy,\n           const double lng[], const double lat[],\n           double phi[], double theta[], double x[], double y[],\n           int stat[]);\n\n\n// Deprecated.\n#define celini_errmsg cel_errmsg\n#define celprt_errmsg cel_errmsg\n#define celset_errmsg cel_errmsg\n#define celx2s_errmsg cel_errmsg\n#define cels2x_errmsg cel_errmsg\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WCSLIB_CEL\n"},{"id":16592,"name":"log.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: log.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <math.h>\n\n#include \"log.h\"\n\n// Map status return value to message.\nconst char *log_errmsg[] = {\n  \"Success\",\n  \"\",\n  \"Invalid log-coordinate reference value\",\n  \"One or more of the x coordinates were invalid\",\n  \"One or more of the world coordinates were invalid\"};\n\n\n//----------------------------------------------------------------------------\n\nint logx2s(\n  double crval,\n  int nx,\n  int sx,\n  int slogc,\n  const double x[],\n  double logc[],\n  int stat[])\n\n{\n  register int ix;\n  register int *statp;\n  register const double *xp;\n  register double *logcp;\n\n\n  if (crval <= 0.0) {\n    return LOGERR_BAD_LOG_REF_VAL;\n  }\n\n  xp = x;\n  logcp = logc;\n  statp = stat;\n  for (ix = 0; ix < nx; ix++, xp += sx, logcp += slogc) {\n    *logcp = crval * exp((*xp) / crval);\n    *(statp++) = 0;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint logs2x(\n  double crval,\n  int nlogc,\n  int slogc,\n  int sx,\n  const double logc[],\n  double x[],\n  int stat[])\n\n{\n  int status;\n  register int ilogc;\n  register int *statp;\n  register const double *logcp;\n  register double *xp;\n\n\n  if (crval <= 0.0) {\n    return LOGERR_BAD_LOG_REF_VAL;\n  }\n\n  xp = x;\n  logcp = logc;\n  statp = stat;\n  status = 0;\n  for (ilogc = 0; ilogc < nlogc; ilogc++, logcp += slogc, xp += sx) {\n    if (*logcp > 0.0) {\n      *xp = crval * log(*logcp / crval);\n      *(statp++) = 0;\n    } else {\n      *(statp++) = 1;\n      status = LOGERR_BAD_WORLD;\n    }\n  }\n\n  return status;\n}\n"},{"id":16593,"name":"wcshdr.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcshdr.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the wcshdr routines\n* ------------------------------\n* Routines in this suite are aimed at extracting WCS information from a FITS\n* file.  The information is encoded via keywords defined in\n*\n=   \"Representations of world coordinates in FITS\",\n=   Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (WCS Paper I)\n=\n=   \"Representations of celestial coordinates in FITS\",\n=   Calabretta, M.R., & Greisen, E.W. 2002, A&A, 395, 1077 (WCS Paper II)\n=\n=   \"Representations of spectral coordinates in FITS\",\n=   Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L.\n=   2006, A&A, 446, 747 (WCS Paper III)\n=\n=   \"Representations of distortions in FITS world coordinate systems\",\n=   Calabretta, M.R. et al. (WCS Paper IV, draft dated 2004/04/22),\n=   available from http://www.atnf.csiro.au/people/Mark.Calabretta\n=\n=   \"Representations of time coordinates in FITS -\n=    Time and relative dimension in space\",\n=   Rots, A.H., Bunclark, P.S., Calabretta, M.R., Allen, S.L.,\n=   Manchester, R.N., & Thompson, W.T. 2015, A&A, 574, A36 (WCS Paper VII)\n*\n* These routines provide the high-level interface between the FITS file and\n* the WCS coordinate transformation routines.\n*\n* Additionally, function wcshdo() is provided to write out the contents of a\n* wcsprm struct as a FITS header.\n*\n* Briefly, the anticipated sequence of operations is as follows:\n*\n*   - 1: Open the FITS file and read the image or binary table header, e.g.\n*        using CFITSIO routine fits_hdr2str().\n*\n*   - 2: Parse the header using wcspih() or wcsbth(); they will automatically\n*        interpret 'TAB' header keywords using wcstab().\n*\n*   - 3: Allocate memory for, and read 'TAB' arrays from the binary table\n*        extension, e.g. using CFITSIO routine fits_read_wcstab() - refer to\n*        the prologue of getwcstab.h.  wcsset() will automatically take\n*        control of this allocated memory, in particular causing it to be\n*        freed by wcsfree().\n*\n*   - 4: Translate non-standard WCS usage using wcsfix(), see wcsfix.h.\n*\n*   - 5: Initialize wcsprm struct(s) using wcsset() and calculate coordinates\n*        using wcsp2s() and/or wcss2p().  Refer to the prologue of wcs.h for a\n*        description of these and other high-level WCS coordinate\n*        transformation routines.\n*\n*   - 6: Clean up by freeing memory with wcsvfree().\n*\n* In detail:\n*\n* - wcspih() is a high-level FITS WCS routine that parses an image header.  It\n*   returns an array of up to 27 wcsprm structs on each of which it invokes\n*   wcstab().\n*\n* - wcsbth() is the analogue of wcspih() for use with binary tables; it\n*   handles image array and pixel list keywords.  As an extension of the FITS\n*   WCS standard, it also recognizes image header keywords which may be used\n*   to provide default values via an inheritance mechanism.\n*\n* - wcstab() assists in filling in members of the wcsprm struct associated\n*   with coordinate lookup tables ('TAB').  These are based on arrays stored\n*   in a FITS binary table extension (BINTABLE) that are located by PVi_ma\n*   keywords in the image header.\n*\n* - wcsidx() and wcsbdx() are utility routines that return the index for a\n*   specified alternate coordinate descriptor in the array of wcsprm structs\n*   returned by wcspih() or wcsbth().\n*\n* - wcsvfree() deallocates memory for an array of wcsprm structs, such as\n*   returned by wcspih() or wcsbth().\n*\n* - wcshdo() writes out a wcsprm struct as a FITS header.\n*\n*\n* wcspih() - FITS WCS parser routine for image headers\n* ----------------------------------------------------\n* wcspih() is a high-level FITS WCS routine that parses an image header,\n* either that of a primary HDU or of an image extension.  All WCS keywords\n* defined in Papers I, II, III, IV, and VII are recognized, and also those\n* used by the AIPS convention and certain other keywords that existed in early\n* drafts of the WCS papers as explained in wcsbth() note 5.  wcspih() also\n* handles keywords associated with non-standard distortion functions described\n* in the prologue of dis.h.\n*\n* Given a character array containing a FITS image header, wcspih() identifies\n* and reads all WCS keywords for the primary coordinate representation and up\n* to 26 alternate representations.  It returns this information as an array of\n* wcsprm structs.\n*\n* wcspih() invokes wcstab() on each of the wcsprm structs that it returns.\n*\n* Use wcsbth() in preference to wcspih() for FITS headers of unknown type;\n* wcsbth() can parse image headers as well as binary table and pixel list\n* headers, although it cannot handle keywords relating to distortion\n* functions, which may only exist in a primary image header.\n*\n* Given and returned:\n*   header    char[]    Character array containing the (entire) FITS image\n*                       header from which to identify and construct the\n*                       coordinate representations, for example, as might be\n*                       obtained conveniently via the CFITSIO routine\n*                       fits_hdr2str().\n*\n*                       Each header \"keyrecord\" (formerly \"card image\")\n*                       consists of exactly 80 7-bit ASCII printing characters\n*                       in the range 0x20 to 0x7e (which excludes NUL, BS,\n*                       TAB, LF, FF and CR) especially noting that the\n*                       keyrecords are NOT null-terminated.\n*\n*                       For negative values of ctrl (see below), header[] is\n*                       modified so that WCS keyrecords processed by wcspih()\n*                       are removed from it.\n*\n* Given:\n*   nkeyrec   int       Number of keyrecords in header[].\n*\n*   relax     int       Degree of permissiveness:\n*                         0: Recognize only FITS keywords defined by the\n*                            published WCS standard.\n*                         WCSHDR_all: Admit all recognized informal\n*                            extensions of the WCS standard.\n*                       Fine-grained control of the degree of permissiveness\n*                       is also possible as explained in wcsbth() note 5.\n*\n*   ctrl      int       Error reporting and other control options for invalid\n*                       WCS and other header keyrecords:\n*                           0: Do not report any rejected header keyrecords.\n*                           1: Produce a one-line message stating the number\n*                              of WCS keyrecords rejected (nreject).\n*                           2: Report each rejected keyrecord and the reason\n*                              why it was rejected.\n*                           3: As above, but also report all non-WCS\n*                              keyrecords that were discarded, and the number\n*                              of coordinate representations (nwcs) found.\n*                           4: As above, but also report the accepted WCS\n*                              keyrecords, with a summary of the number\n*                              accepted as well as rejected.\n*                       The report is written to stderr by default, or the\n*                       stream set by wcsprintf_set().\n*\n*                       For ctrl < 0, WCS keyrecords processed by wcspih()\n*                       are removed from header[]:\n*                          -1: Remove only valid WCS keyrecords whose values\n*                              were successfully extracted, nothing is\n*                              reported.\n*                          -2: As above, but also remove WCS keyrecords that\n*                              were rejected, reporting each one and the\n*                              reason that it was rejected.\n*                          -3: As above, and also report the number of\n*                              coordinate representations (nwcs) found.\n*                         -11: Same as -1 but preserving global WCS-related\n*                              keywords such as '{DATE,MJD}-{OBS,BEG,AVG,END}'\n*                              and the other basic time-related keywords, and\n*                              'OBSGEO-{X,Y,Z,L,B,H}'.\n*                       If any keyrecords are removed from header[] it will\n*                       be null-terminated (NUL not being a legal FITS header\n*                       character), otherwise it will contain its original\n*                       complement of nkeyrec keyrecords and possibly not be\n*                       null-terminated.\n*\n* Returned:\n*   nreject   int*      Number of WCS keywords rejected for syntax errors,\n*                       illegal values, etc.  Keywords not recognized as WCS\n*                       keywords are simply ignored.  Refer also to wcsbth()\n*                       note 5.\n*\n*   nwcs      int*      Number of coordinate representations found.\n*\n*   wcs       struct wcsprm**\n*                       Pointer to an array of wcsprm structs containing up to\n*                       27 coordinate representations.\n*\n*                       Memory for the array is allocated by wcspih() which\n*                       also invokes wcsini() for each struct to allocate\n*                       memory for internal arrays and initialize their\n*                       members to default values.  Refer also to wcsbth()\n*                       note 8.  Note that wcsset() is not invoked on these\n*                       structs.\n*\n*                       This allocated memory must be freed by the user, first\n*                       by invoking wcsfree() for each struct, and then by\n*                       freeing the array itself.  A routine, wcsvfree(), is\n*                       provided to do this (see below).\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         2: Memory allocation failed.\n*                         4: Fatal error returned by Flex parser.\n*\n* Notes:\n*   1: Refer to wcsbth() notes 1, 2, 3, 5, 7, and 8.\n*\n*\n* wcsbth() - FITS WCS parser routine for binary table and image headers\n* ---------------------------------------------------------------------\n* wcsbth() is a high-level FITS WCS routine that parses a binary table header.\n* It handles image array and pixel list WCS keywords which may be present\n* together in one header.\n*\n* As an extension of the FITS WCS standard, wcsbth() also recognizes image\n* header keywords in a binary table header.  These may be used to provide\n* default values via an inheritance mechanism discussed in note 5 (c.f.\n* WCSHDR_AUXIMG and WCSHDR_ALLIMG), or may instead result in wcsprm structs\n* that are not associated with any particular column.  Thus wcsbth() can\n* handle primary image and image extension headers in addition to binary table\n* headers (it ignores NAXIS and does not rely on the presence of the TFIELDS\n* keyword).\n*\n* All WCS keywords defined in Papers I, II, III, and VII are recognized, and\n* also those used by the AIPS convention and certain other keywords that\n* existed in early drafts of the WCS papers as explained in note 5 below.\n*\n* wcsbth() sets the colnum or colax[] members of the wcsprm structs that it\n* returns with the column number of an image array or the column numbers\n* associated with each pixel coordinate element in a pixel list.  wcsprm\n* structs that are not associated with any particular column, as may be\n* derived from image header keywords, have colnum == 0.\n*\n* Note 6 below discusses the number of wcsprm structs returned by wcsbth(),\n* and the circumstances in which image header keywords cause a struct to be\n* created.  See also note 9 concerning the number of separate images that may\n* be stored in a pixel list.\n*\n* The API to wcsbth() is similar to that of wcspih() except for the addition\n* of extra arguments that may be used to restrict its operation.  Like\n* wcspih(), wcsbth() invokes wcstab() on each of the wcsprm structs that it\n* returns.\n*\n* Given and returned:\n*   header    char[]    Character array containing the (entire) FITS binary\n*                       table, primary image, or image extension header from\n*                       which to identify and construct the coordinate\n*                       representations, for example, as might be obtained\n*                       conveniently via the CFITSIO routine fits_hdr2str().\n*\n*                       Each header \"keyrecord\" (formerly \"card image\")\n*                       consists of exactly 80 7-bit ASCII printing\n*                       characters in the range 0x20 to 0x7e (which excludes\n*                       NUL, BS, TAB, LF, FF and CR) especially noting that\n*                       the keyrecords are NOT null-terminated.\n*\n*                       For negative values of ctrl (see below), header[] is\n*                       modified so that WCS keyrecords processed by wcsbth()\n*                       are removed from it.\n*\n* Given:\n*   nkeyrec   int       Number of keyrecords in header[].\n*\n*   relax     int       Degree of permissiveness:\n*                         0: Recognize only FITS keywords defined by the\n*                            published WCS standard.\n*                         WCSHDR_all: Admit all recognized informal\n*                            extensions of the WCS standard.\n*                       Fine-grained control of the degree of permissiveness\n*                       is also possible, as explained in note 5 below.\n*\n*   ctrl      int       Error reporting and other control options for invalid\n*                       WCS and other header keyrecords:\n*                           0: Do not report any rejected header keyrecords.\n*                           1: Produce a one-line message stating the number\n*                              of WCS keyrecords rejected (nreject).\n*                           2: Report each rejected keyrecord and the reason\n*                              why it was rejected.\n*                           3: As above, but also report all non-WCS\n*                              keyrecords that were discarded, and the number\n*                              of coordinate representations (nwcs) found.\n*                           4: As above, but also report the accepted WCS\n*                              keyrecords, with a summary of the number\n*                              accepted as well as rejected.\n*                       The report is written to stderr by default, or the\n*                       stream set by wcsprintf_set().\n*\n*                       For ctrl < 0, WCS keyrecords processed by wcsbth()\n*                       are removed from header[]:\n*                          -1: Remove only valid WCS keyrecords whose values\n*                              were successfully extracted, nothing is\n*                              reported.\n*                          -2: Also remove WCS keyrecords that were rejected,\n*                              reporting each one and the reason that it was\n*                              rejected.\n*                          -3: As above, and also report the number of\n*                              coordinate representations (nwcs) found.\n*                         -11: Same as -1 but preserving global WCS-related\n*                              keywords such as '{DATE,MJD}-{OBS,BEG,AVG,END}'\n*                              and the other basic time-related keywords, and\n*                              'OBSGEO-{X,Y,Z,L,B,H}'.\n*                       If any keyrecords are removed from header[] it will\n*                       be null-terminated (NUL not being a legal FITS header\n*                       character), otherwise it will contain its original\n*                       complement of nkeyrec keyrecords and possibly not be\n*                       null-terminated.\n*\n*   keysel    int       Vector of flag bits that may be used to restrict the\n*                       keyword types considered:\n*                         WCSHDR_IMGHEAD: Image header keywords.\n*                         WCSHDR_BIMGARR: Binary table image array.\n*                         WCSHDR_PIXLIST: Pixel list keywords.\n*                       If zero, there is no restriction.\n*\n*                       Keywords such as EQUIna or RFRQna that are common to\n*                       binary table image arrays and pixel lists (including\n*                       WCSNna and TWCSna, as explained in note 4 below) are\n*                       selected by both WCSHDR_BIMGARR and WCSHDR_PIXLIST.\n*                       Thus if inheritance via WCSHDR_ALLIMG is enabled as\n*                       discussed in note 5 and one of these shared keywords\n*                       is present, then WCSHDR_IMGHEAD and WCSHDR_PIXLIST\n*                       alone may be sufficient to cause the construction of\n*                       coordinate descriptions for binary table image arrays.\n*\n*   colsel    int*      Pointer to an array of table column numbers used to\n*                       restrict the keywords considered by wcsbth().\n*\n*                       A null pointer may be specified to indicate that there\n*                       is no restriction.  Otherwise, the magnitude of\n*                       cols[0] specifies the length of the array:\n*                         cols[0] > 0: the columns are included,\n*                         cols[0] < 0: the columns are excluded.\n*\n*                       For the pixel list keywords TPn_ka and TCn_ka (and\n*                       TPCn_ka and TCDn_ka if WCSHDR_LONGKEY is enabled), it\n*                       is an error for one column to be selected but not the\n*                       other.  This is unlike the situation with invalid\n*                       keyrecords, which are simply rejected, because the\n*                       error is not intrinsic to the header itself but\n*                       arises in the way that it is processed.\n*\n* Returned:\n*   nreject   int*      Number of WCS keywords rejected for syntax errors,\n*                       illegal values, etc.  Keywords not recognized as WCS\n*                       keywords are simply ignored, refer also to note 5\n*                       below.\n*\n*   nwcs      int*      Number of coordinate representations found.\n*\n*   wcs       struct wcsprm**\n*                       Pointer to an array of wcsprm structs containing up\n*                       to 27027 coordinate representations, refer to note 6\n*                       below.\n*\n*                       Memory for the array is allocated by wcsbth() which\n*                       also invokes wcsini() for each struct to allocate\n*                       memory for internal arrays and initialize their\n*                       members to default values.  Refer also to note 8\n*                       below.  Note that wcsset() is not invoked on these\n*                       structs.\n*\n*                       This allocated memory must be freed by the user, first\n*                       by invoking wcsfree() for each struct, and then by\n*                       freeing the array itself.  A routine, wcsvfree(), is\n*                       provided to do this (see below).\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Invalid column selection.\n*                         4: Fatal error returned by Flex parser.\n*\n* Notes:\n*   1: wcspih() determines the number of coordinate axes independently for\n*      each alternate coordinate representation (denoted by the \"a\" value in\n*      keywords like CTYPEia) from the higher of\n*\n*        a: NAXIS,\n*        b: WCSAXESa,\n*        c: The highest axis number in any parameterized WCS keyword.  The\n*           keyvalue, as well as the keyword, must be syntactically valid\n*           otherwise it will not be considered.\n*\n*      If none of these keyword types is present, i.e. if the header only\n*      contains auxiliary WCS keywords for a particular coordinate\n*      representation, then no coordinate description is constructed for it.\n*\n*      wcsbth() is similar except that it ignores the NAXIS keyword if given\n*      an image header to process.\n*\n*      The number of axes, which is returned as a member of the wcsprm\n*      struct, may differ for different coordinate representations of the\n*      same image.\n*\n*   2: wcspih() and wcsbth() enforce correct FITS \"keyword = value\" syntax\n*      with regard to \"= \" occurring in columns 9 and 10.\n*\n*      However, they do recognize free-format character (NOST 100-2.0,\n*      Sect. 5.2.1), integer (Sect. 5.2.3), and floating-point values\n*      (Sect. 5.2.4) for all keywords.\n*\n*   3: Where CROTAn, CDi_ja, and PCi_ja occur together in one header wcspih()\n*      and wcsbth() treat them as described in the prologue to wcs.h.\n*\n*   4: WCS Paper I mistakenly defined the pixel list form of WCSNAMEa as\n*      TWCSna instead of WCSNna; the 'T' is meant to substitute for the axis\n*      number in the binary table form of the keyword - note that keywords\n*      defined in WCS Papers II, III, and VII that are not parameterized by\n*      axis number have identical forms for binary tables and pixel lists.\n*      Consequently wcsbth() always treats WCSNna and TWCSna as equivalent.\n*\n*   5: wcspih() and wcsbth() interpret the \"relax\" argument as a vector of\n*      flag bits to provide fine-grained control over what non-standard WCS\n*      keywords to accept.  The flag bits are subject to change in future and\n*      should be set by using the preprocessor macros (see below) for the\n*      purpose.\n*\n*      - WCSHDR_none: Don't accept any extensions (not even those in the\n*              errata).  Treat non-conformant keywords in the same way as\n*              non-WCS keywords in the header, i.e. simply ignore them.\n*\n*      - WCSHDR_all: Accept all extensions recognized by the parser.\n*\n*      - WCSHDR_reject: Reject non-standard keyrecords (that are not otherwise\n*              explicitly accepted by one of the flags below).  A message will\n*              optionally be printed on stderr by default, or the stream set\n*              by wcsprintf_set(), as determined by the ctrl argument, and\n*              nreject will be incremented.\n*\n*              This flag may be used to signal the presence of non-standard\n*              keywords, otherwise they are simply passed over as though they\n*              did not exist in the header.  It is mainly intended for testing\n*              conformance of a FITS header to the WCS standard.\n*\n*              Keyrecords may be non-standard in several ways:\n*\n*                - The keyword may be syntactically valid but with keyvalue of\n*                  incorrect type or invalid syntax, or the keycomment may be\n*                  malformed.\n*\n*                - The keyword may strongly resemble a WCS keyword but not, in\n*                  fact, be one because it does not conform to the standard.\n*                  For example, \"CRPIX01\" looks like a CRPIXja keyword, but in\n*                  fact the leading zero on the axis number violates the basic\n*                  FITS standard.  Likewise, \"LONPOLE2\" is not a valid\n*                  LONPOLEa keyword in the WCS standard, and indeed there is\n*                  nothing the parser can sensibly do with it.\n*\n*                - Use of the keyword may be deprecated by the standard.  Such\n*                  will be rejected if not explicitly accepted via one of the\n*                  flags below.\n*\n*      - WCSHDR_strict: As for WCSHDR_reject, but also reject AIPS-convention\n*              keywords and all other deprecated usage that is not explicitly\n*              accepted.\n*\n*      - WCSHDR_CROTAia: Accept CROTAia (wcspih()),\n*                               iCROTna (wcsbth()),\n*                               TCROTna (wcsbth()).\n*      - WCSHDR_VELREFa: Accept VELREFa.\n*              wcspih() always recognizes the AIPS-convention keywords,\n*              CROTAn, EPOCH, and VELREF for the primary representation\n*              (a = ' ') but alternates are non-standard.\n*\n*              wcsbth() accepts EPOCHa and VELREFa only if WCSHDR_AUXIMG is\n*              also enabled.\n*\n*      - WCSHDR_CD00i00j: Accept CD00i00j (wcspih()).\n*      - WCSHDR_PC00i00j: Accept PC00i00j (wcspih()).\n*      - WCSHDR_PROJPn:   Accept PROJPn   (wcspih()).\n*              These appeared in early drafts of WCS Paper I+II (before they\n*              were split) and are equivalent to CDi_ja, PCi_ja, and PVi_ma\n*              for the primary representation (a = ' ').  PROJPn is\n*              equivalent to PVi_ma with m = n <= 9, and is associated\n*              exclusively with the latitude axis.\n*\n*      - WCSHDR_CD0i_0ja: Accept CD0i_0ja (wcspih()).\n*      - WCSHDR_PC0i_0ja: Accept PC0i_0ja (wcspih()).\n*      - WCSHDR_PV0i_0ma: Accept PV0i_0ja (wcspih()).\n*      - WCSHDR_PS0i_0ma: Accept PS0i_0ja (wcspih()).\n*              Allow the numerical index to have a leading zero in doubly-\n*              parameterized keywords, for example, PC01_01.  WCS Paper I\n*              (Sects 2.1.2 & 2.1.4) explicitly disallows leading zeroes.\n*              The FITS 3.0 standard document (Sect. 4.1.2.1) states that the\n*              index in singly-parameterized keywords (e.g. CTYPEia) \"shall\n*              not have leading zeroes\", and later in Sect. 8.1 that \"leading\n*              zeroes must not be used\" on PVi_ma and PSi_ma.  However, by an\n*              oversight, it is silent on PCi_ja and CDi_ja.\n*\n*      - WCSHDR_DOBSn (wcsbth() only): Allow DOBSn, the column-specific\n*              analogue of DATE-OBS.  By an oversight this was never formally\n*              defined in the standard.\n*\n*      - WCSHDR_OBSGLBHn (wcsbth() only): Allow OBSGLn, OBSGBn, and OBSGHn,\n*              the column-specific analogues of OBSGEO-L, OBSGEO-B, and\n*              OBSGEO-H.  By an oversight these were never formally defined in\n*              the standard.\n*\n*      - WCSHDR_RADECSYS: Accept RADECSYS.  This appeared in early drafts of\n*              WCS Paper I+II and was subsequently replaced by RADESYSa.\n*\n*              wcsbth() accepts RADECSYS only if WCSHDR_AUXIMG is also\n*              enabled.\n*\n*      - WCSHDR_EPOCHa:  Accept EPOCHa.\n*\n*      - WCSHDR_VSOURCE: Accept VSOURCEa or VSOUna (wcsbth()).  This appeared\n*              in early drafts of WCS Paper III and was subsequently dropped\n*              in favour of ZSOURCEa and ZSOUna.\n*\n*              wcsbth() accepts VSOURCEa only if WCSHDR_AUXIMG is also\n*              enabled.\n*\n*      - WCSHDR_DATEREF: Accept DATE-REF, MJD-REF, MJD-REFI, MJD-REFF, JDREF,\n*              JD-REFI, and JD-REFF as synonyms for the standard keywords,\n*              DATEREF, MJDREF, MJDREFI, MJDREFF, JDREF, JDREFI, and JDREFF.\n*              The latter buck the pattern set by the other date keywords\n*              ({DATE,MJD}-{OBS,BEG,AVG,END}), thereby increasing the\n*              potential for confusion and error.\n*\n*      - WCSHDR_LONGKEY (wcsbth() only): Accept long forms of the alternate\n*              binary table and pixel list WCS keywords, i.e. with \"a\" non-\n*              blank.  Specifically\n*\n#                jCRPXna  TCRPXna  :  jCRPXn  jCRPna  TCRPXn  TCRPna  CRPIXja\n#                   -     TPCn_ka  :    -     ijPCna    -     TPn_ka  PCi_ja\n#                   -     TCDn_ka  :    -     ijCDna    -     TCn_ka  CDi_ja\n#                iCDLTna  TCDLTna  :  iCDLTn  iCDEna  TCDLTn  TCDEna  CDELTia\n#                iCUNIna  TCUNIna  :  iCUNIn  iCUNna  TCUNIn  TCUNna  CUNITia\n#                iCTYPna  TCTYPna  :  iCTYPn  iCTYna  TCTYPn  TCTYna  CTYPEia\n#                iCRVLna  TCRVLna  :  iCRVLn  iCRVna  TCRVLn  TCRVna  CRVALia\n#                iPVn_ma  TPVn_ma  :    -     iVn_ma    -     TVn_ma  PVi_ma\n#                iPSn_ma  TPSn_ma  :    -     iSn_ma    -     TSn_ma  PSi_ma\n*\n*              where the primary and standard alternate forms together with\n*              the image-header equivalent are shown rightwards of the colon.\n*\n*              The long form of these keywords could be described as quasi-\n*              standard.  TPCn_ka, iPVn_ma, and TPVn_ma appeared by mistake\n*              in the examples in WCS Paper II and subsequently these and\n*              also TCDn_ka, iPSn_ma and TPSn_ma were legitimized by the\n*              errata to the WCS papers.\n*\n*              Strictly speaking, the other long forms are non-standard and\n*              in fact have never appeared in any draft of the WCS papers nor\n*              in the errata.  However, as natural extensions of the primary\n*              form they are unlikely to be written with any other intention.\n*              Thus it should be safe to accept them provided, of course,\n*              that the resulting keyword does not exceed the 8-character\n*              limit.\n*\n*              If WCSHDR_CNAMn is enabled then also accept\n*\n#                iCNAMna  TCNAMna  :   ---   iCNAna    ---   TCNAna  CNAMEia\n#                iCRDEna  TCRDEna  :   ---   iCRDna    ---   TCRDna  CRDERia\n#                iCSYEna  TCSYEna  :   ---   iCSYna    ---   TCSYna  CSYERia\n#                iCZPHna  TCZPHna  :   ---   iCZPna    ---   TCZPna  CZPHSia\n#                iCPERna  TCPERna  :   ---   iCPRna    ---   TCPRna  CPERIia\n*\n*              Note that CNAMEia, CRDERia, CSYERia, CZPHSia, CPERIia, and\n*              their variants are not used by WCSLIB but are stored in the\n*              wcsprm struct as auxiliary information.\n*\n*      - WCSHDR_CNAMn (wcsbth() only): Accept iCNAMn, iCRDEn, iCSYEn, iCZPHn,\n*              iCPERn, TCNAMn, TCRDEn, TCSYEn, TCZPHn, and TCPERn, i.e. with\n*              \"a\" blank.  While non-standard, these are the obvious analogues\n*              of iCTYPn, TCTYPn, etc.\n*\n*      - WCSHDR_AUXIMG (wcsbth() only): Allow the image-header form of an\n*              auxiliary WCS keyword with representation-wide scope to\n*              provide a default value for all images.  This default may be\n*              overridden by the column-specific form of the keyword.\n*\n*              For example, a keyword like EQUINOXa would apply to all image\n*              arrays in a binary table, or all pixel list columns with\n*              alternate representation \"a\" unless overridden by EQUIna.\n*\n*              Specifically the keywords are:\n*\n#                LONPOLEa  for LONPna\n#                LATPOLEa  for LATPna\n#                VELREF        -       ... (No column-specific form.)\n#                VELREFa       -       ... Only if WCSHDR_VELREFa is set.\n*\n*              whose keyvalues are actually used by WCSLIB, and also keywords\n*              providing auxiliary information that is simply stored in the\n*              wcsprm struct:\n*\n#                WCSNAMEa  for WCSNna  ... Or TWCSna (see below).\n#\n#                DATE-OBS  for DOBSn\n#                MJD-OBS   for MJDOBn\n#\n#                RADESYSa  for RADEna\n#                RADECSYS  for RADEna  ... Only if WCSHDR_RADECSYS is set.\n#                EPOCH         -       ... (No column-specific form.)\n#                EPOCHa        -       ... Only if WCSHDR_EPOCHa is set.\n#                EQUINOXa  for EQUIna\n*\n*              where the image-header keywords on the left provide default\n*              values for the column specific keywords on the right.\n*\n*              Note that, according to Sect. 8.1 of WCS Paper III, and\n*              Sect. 5.2 of WCS Paper VII, the following are always inherited:\n*\n#                RESTFREQ  for RFRQna\n#                RESTFRQa  for RFRQna\n#                RESTWAVa  for RWAVna\n*\n*              being those actually used by WCSLIB, together with the\n*              following auxiliary keywords, many of which do not have binary\n*              table equivalents and therefore can only be inherited:\n*\n#                TIMESYS       -\n#                TREFPOS   for TRPOSn\n#                TREFDIR   for TRDIRn\n#                PLEPHEM       -\n#                TIMEUNIT      -\n#                DATEREF       -\n#                MJDREF        -\n#                MJDREFI       -\n#                MJDREFF       -\n#                JDREF         -\n#                JDREFI        -\n#                JDREFF        -\n#                TIMEOFFS      -\n#\n#                DATE-BEG      -\n#                DATE-AVG  for DAVGn\n#                DATE-END      -\n#                MJD-BEG       -\n#                MJD-AVG   for MJDAn\n#                MJD-END       -\n#                JEPOCH        -\n#                BEPOCH        -\n#                TSTART        -\n#                TSTOP         -\n#                XPOSURE       -\n#                TELAPSE       -\n#\n#                TIMSYER       -\n#                TIMRDER       -\n#                TIMEDEL       -\n#                TIMEPIXR      -\n#\n#                OBSGEO-X  for OBSGXn\n#                OBSGEO-Y  for OBSGYn\n#                OBSGEO-Z  for OBSGZn\n#                OBSGEO-L  for OBSGLn\n#                OBSGEO-B  for OBSGBn\n#                OBSGEO-H  for OBSGHn\n#                OBSORBIT      -\n#\n#                SPECSYSa  for SPECna\n#                SSYSOBSa  for SOBSna\n#                VELOSYSa  for VSYSna\n#                VSOURCEa  for VSOUna  ... Only if WCSHDR_VSOURCE is set.\n#                ZSOURCEa  for ZSOUna\n#                SSYSSRCa  for SSRCna\n#                VELANGLa  for VANGna\n*\n*              Global image-header keywords, such as MJD-OBS, apply to all\n*              alternate representations, and would therefore provide a\n*              default value for all images in the header.\n*\n*              This auxiliary inheritance mechanism applies to binary table\n*              image arrays and pixel lists alike.  Most of these keywords\n*              have no default value, the exceptions being LONPOLEa and\n*              LATPOLEa, and also RADESYSa and EQUINOXa which provide\n*              defaults for each other.  Thus one potential difficulty in\n*              using WCSHDR_AUXIMG is that of erroneously inheriting one of\n*              these four keywords.\n*\n*              Also, beware of potential inconsistencies that may arise where,\n*              for example, DATE-OBS is inherited, but MJD-OBS is overridden\n*              by MJDOBn and specifies a different time.  Pairs in this\n*              category are:\n*\n=                    DATE-OBS/DOBSn       versus       MJD-OBS/MJDOBn\n=                    DATE-AVG/DAVGn       versus       MJD-AVG/MJDAn\n=                    RESTFRQa/RFRQna      versus      RESTWAVa/RWAVna\n=                OBSGEO-[XYZ]/OBSG[XYZ]n  versus  OBSGEO-[LBH]/OBSG[LBH]n\n*\n*              The wcsfixi() routines datfix() and obsfix() are provided to\n*              check the consistency of these and other such pairs of\n*              keywords.\n*\n*              Unlike WCSHDR_ALLIMG, the existence of one (or all) of these\n*              auxiliary WCS image header keywords will not by itself cause a\n*              wcsprm struct to be created for alternate representation \"a\".\n*              This is because they do not provide sufficient information to\n*              create a non-trivial coordinate representation when used in\n*              conjunction with the default values of those keywords that are\n*              parameterized by axis number, such as CTYPEia.\n*\n*      - WCSHDR_ALLIMG (wcsbth() only): Allow the image-header form of *all*\n*              image header WCS keywords to provide a default value for all\n*              image arrays in a binary table (n.b. not pixel list).  This\n*              default may be overridden by the column-specific form of the\n*              keyword.\n*\n*              For example, a keyword like CRPIXja would apply to all image\n*              arrays in a binary table with alternate representation \"a\"\n*              unless overridden by jCRPna.\n*\n*              Specifically the keywords are those listed above for\n*              WCSHDR_AUXIMG plus\n*\n#                WCSAXESa  for WCAXna\n*\n*              which defines the coordinate dimensionality, and the following\n*              keywords that are parameterized by axis number:\n*\n#                CRPIXja   for jCRPna\n#                PCi_ja    for ijPCna\n#                CDi_ja    for ijCDna\n#                CDELTia   for iCDEna\n#                CROTAi    for iCROTn\n#                CROTAia        -      ... Only if WCSHDR_CROTAia is set.\n#                CUNITia   for iCUNna\n#                CTYPEia   for iCTYna\n#                CRVALia   for iCRVna\n#                PVi_ma    for iVn_ma\n#                PSi_ma    for iSn_ma\n#\n#                CNAMEia   for iCNAna\n#                CRDERia   for iCRDna\n#                CSYERia   for iCSYna\n#                CZPHSia   for iCZPna\n#                CPERIia   for iCPRna\n*\n*              where the image-header keywords on the left provide default\n*              values for the column specific keywords on the right.\n*\n*              This full inheritance mechanism only applies to binary table\n*              image arrays, not pixel lists, because in the latter case\n*              there is no well-defined association between coordinate axis\n*              number and column number (see note 9 below).\n*\n*              Note that CNAMEia, CRDERia, CSYERia, and their variants are\n*              not used by WCSLIB but are stored in the wcsprm struct as\n*              auxiliary information.\n*\n*              Note especially that at least one wcsprm struct will be\n*              returned for each \"a\" found in one of the image header\n*              keywords listed above:\n*\n*              - If the image header keywords for \"a\" ARE NOT inherited by a\n*                binary table, then the struct will not be associated with\n*                any particular table column number and it is up to the user\n*                to provide an association.\n*\n*              - If the image header keywords for \"a\" ARE inherited by a\n*                binary table image array, then those keywords are considered\n*                to be \"exhausted\" and do not result in a separate wcsprm\n*                struct.\n*\n*      For example, to accept CD00i00j and PC00i00j and reject all other\n*      extensions, use\n*\n=        relax = WCSHDR_reject | WCSHDR_CD00i00j | WCSHDR_PC00i00j;\n*\n*      The parser always treats EPOCH as subordinate to EQUINOXa if both are\n*      present, and VSOURCEa is always subordinate to ZSOURCEa.\n*\n*      Likewise, VELREF is subordinate to the formalism of WCS Paper III, see\n*      spcaips().\n*\n*      Neither wcspih() nor wcsbth() currently recognize the AIPS-convention\n*      keywords ALTRPIX or ALTRVAL which effectively define an alternative\n*      representation for a spectral axis.\n*\n*   6: Depending on what flags have been set in its \"relax\" argument,\n*      wcsbth() could return as many as 27027 wcsprm structs:\n*\n*      - Up to 27 unattached representations derived from image header\n*        keywords.\n*\n*      - Up to 27 structs for each of up to 999 columns containing an image\n*        arrays.\n*\n*      - Up to 27 structs for a pixel list.\n*\n*      Note that it is considered legitimate for a column to contain an image\n*      array and also form part of a pixel list, and in particular that\n*      wcsbth() does not check the TFORM keyword for a pixel list column to\n*      check that it is scalar.\n*\n*      In practice, of course, a realistic binary table header is unlikely to\n*      contain more than a handful of images.\n*\n*      In order for wcsbth() to create a wcsprm struct for a particular\n*      coordinate representation, at least one WCS keyword that defines an\n*      axis number must be present, either directly or by inheritance if\n*      WCSHDR_ALLIMG is set.\n*\n*      When the image header keywords for an alternate representation are\n*      inherited by a binary table image array via WCSHDR_ALLIMG, those\n*      keywords are considered to be \"exhausted\" and do not result in a\n*      separate wcsprm struct.  Otherwise they do.\n*\n*   7: Neither wcspih() nor wcsbth() check for duplicated keywords, in most\n*      cases they accept the last encountered.\n*\n*   8: wcspih() and wcsbth() use wcsnpv() and wcsnps() (refer to the prologue\n*      of wcs.h) to match the size of the pv[] and ps[] arrays in the wcsprm\n*      structs to the number in the header.  Consequently there are no unused\n*      elements in the pv[] and ps[] arrays, indeed they will often be of\n*      zero length.\n*\n*   9: The FITS WCS standard for pixel lists assumes that a pixel list\n*      defines one and only one image, i.e. that each row of the binary table\n*      refers to just one event, e.g. the detection of a single photon or\n*      neutrino, for which the device \"pixel\" coordinates are stored in\n*      separate scalar columns of the table.\n*\n*      In the absence of a standard for pixel lists - or even an informal\n*      description! - let alone a formal mechanism for identifying the columns\n*      containing pixel coordinates (as opposed to pixel values or metadata\n*      recorded at the time the photon or neutrino was detected), WCS Paper I\n*      discusses how the WCS keywords themselves may be used to identify them.\n*\n*      In practice, however, pixel lists have been used to store multiple\n*      images.  Besides not specifying how to identify columns, the pixel list\n*      convention is also silent on the method to be used to associate table\n*      columns with image axes.\n*\n*      An additional shortcoming is the absence of a formal method for\n*      associating global binary-table WCS keywords, such as WCSNna or MJDOBn,\n*      with a pixel list image, whether one or several.\n*\n*      In light of these uncertainties, wcsbth() simply collects all WCS\n*      keywords for a particular pixel list coordinate representation (i.e.\n*      the \"a\" value in TCTYna) into one wcsprm struct.  However, these\n*      alternates need not be associated with the same table columns and this\n*      allows a pixel list to contain up to 27 separate images.  As usual, if\n*      one of these representations happened to contain more than two\n*      celestial axes, for example, then an error would result when wcsset()\n*      is invoked on it.  In this case the \"colsel\" argument could be used to\n*      restrict the columns used to construct the representation so that it\n*      only contained one pair of celestial axes.\n*\n*      Global, binary-table WCS keywords are considered to apply to the pixel\n*      list image with matching alternate (e.g. the \"a\" value in LONPna or\n*      EQUIna), regardless of the table columns the image occupies.  In other\n*      words, the column number is ignored (the \"n\" value in LONPna or\n*      EQUIna).  This also applies for global, binary-table WCS keywords that\n*      have no alternates, such as MJDOBn and OBSGXn, which match all images\n*      in a pixel list.  Take heed that this may lead to counterintuitive\n*      behaviour, especially where such a keyword references a column that\n*      does not store pixel coordinates, and moreso where the pixel list\n*      stores only a single image.  In fact, as the column number, n, is\n*      ignored for such keywords, it would make no difference even if they\n*      referenced non-existent columns.  Moreover, there is no requirement for\n*      consistency in the column numbers used for such keywords, even for\n*      OBSGXn, OBSGYn, and OBSGZn which are meant to define the elements of a\n*      coordinate vector.  Although it would surely be perverse to construct a\n*      pixel list like this, such a situation may still arise in practice\n*      where columns are deleted from a binary table.\n*\n*      The situation with global, binary-table WCS keywords becomes\n*      potentially even more confusing when image arrays and pixel list images\n*      coexist in one binary table.  In that case, a keyword such as MJDOBn\n*      may legitimately appear multiple times with n referencing different\n*      image arrays.  Which then is the one that applies to the pixel list\n*      images?  In this implementation, it is the last instance that appears\n*      in the header, whether or not it is also associated with an image\n*      array.\n*\n*\n* wcstab() - Tabular construction routine\n* ---------------------------------------\n* wcstab() assists in filling in the information in the wcsprm struct relating\n* to coordinate lookup tables.\n*\n* Tabular coordinates ('TAB') present certain difficulties in that the main\n* components of the lookup table - the multidimensional coordinate array plus\n* an index vector for each dimension - are stored in a FITS binary table\n* extension (BINTABLE).  Information required to locate these arrays is stored\n* in PVi_ma and PSi_ma keywords in the image header.\n*\n* wcstab() parses the PVi_ma and PSi_ma keywords associated with each 'TAB'\n* axis and allocates memory in the wcsprm struct for the required number of\n* tabprm structs.  It sets as much of the tabprm struct as can be gleaned from\n* the image header, and also sets up an array of wtbarr structs (described in\n* the prologue of wtbarr.h) to assist in extracting the required arrays from\n* the BINTABLE extension(s).\n*\n* It is then up to the user to allocate memory for, and copy arrays from the\n* BINTABLE extension(s) into the tabprm structs.  A CFITSIO routine,\n* fits_read_wcstab(), has been provided for this purpose, see getwcstab.h.\n* wcsset() will automatically take control of this allocated memory, in\n* particular causing it to be freed by wcsfree(); the user must not attempt\n* to free it after wcsset() has been called.\n*\n* Note that wcspih() and wcsbth() automatically invoke wcstab() on each of the\n* wcsprm structs that they return.\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters (see below).\n*\n*                       wcstab() sets ntab, tab, nwtb and wtb, allocating\n*                       memory for the tab and wtb arrays.  This allocated\n*                       memory will be freed automatically by wcsfree().\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Invalid tabular parameters.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       wcsprm::err if enabled, see wcserr_enable().\n*\n*\n* wcsidx() - Index alternate coordinate representations\n* -----------------------------------------------------\n* wcsidx() returns an array of 27 indices for the alternate coordinate\n* representations in the array of wcsprm structs returned by wcspih().  For\n* the array returned by wcsbth() it returns indices for the unattached\n* (colnum == 0) representations derived from image header keywords - use\n* wcsbdx() for those derived from binary table image arrays or pixel lists\n* keywords.\n*\n* Given:\n*   nwcs      int       Number of coordinate representations in the array.\n*\n*   wcs       const struct wcsprm**\n*                       Pointer to an array of wcsprm structs returned by\n*                       wcspih() or wcsbth().\n*\n* Returned:\n*   alts      int[27]   Index of each alternate coordinate representation in\n*                       the array: alts[0] for the primary, alts[1] for 'A',\n*                       etc., set to -1 if not present.\n*\n*                       For example, if there was no 'P' representation then\n*\n=                         alts['P'-'A'+1] == -1;\n*\n*                       Otherwise, the address of its wcsprm struct would be\n*\n=                         wcs + alts['P'-'A'+1];\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*\n*\n* wcsbdx() - Index alternate coordinate representions\n* ---------------------------------------------------\n* wcsbdx() returns an array of 999 x 27 indices for the alternate coordinate\n* representions for binary table image arrays xor pixel lists in the array of\n* wcsprm structs returned by wcsbth().  Use wcsidx() for the unattached\n* representations derived from image header keywords.\n*\n* Given:\n*   nwcs      int       Number of coordinate representations in the array.\n*\n*   wcs       const struct wcsprm**\n*                       Pointer to an array of wcsprm structs returned by\n*                       wcsbth().\n*\n*   type      int       Select the type of coordinate representation:\n*                         0: binary table image arrays,\n*                         1: pixel lists.\n*\n* Returned:\n*   alts      short[1000][28]\n*                       Index of each alternate coordinate represention in the\n*                       array: alts[col][0] for the primary, alts[col][1] for\n*                       'A', to alts[col][26] for 'Z', where col is the\n*                       1-relative column number, and col == 0 is used for\n*                       unattached image headers.  Set to -1 if not present.\n*\n*                       alts[col][27] counts the number of coordinate\n*                       representations of the chosen type for each column.\n*\n*                       For example, if there was no 'P' represention for\n*                       column 13 then\n*\n=                         alts[13]['P'-'A'+1] == -1;\n*\n*                       Otherwise, the address of its wcsprm struct would be\n*\n=                         wcs + alts[13]['P'-'A'+1];\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*\n*\n* wcsvfree() - Free the array of wcsprm structs\n* ---------------------------------------------\n* wcsvfree() frees the memory allocated by wcspih() or wcsbth() for the array\n* of wcsprm structs, first invoking wcsfree() on each of the array members.\n*\n* Given and returned:\n*   nwcs      int*      Number of coordinate representations found; set to 0\n*                       on return.\n*\n*   wcs       struct wcsprm**\n*                       Pointer to the array of wcsprm structs; set to 0x0 on\n*                       return.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*\n*\n* wcshdo() - Write out a wcsprm struct as a FITS header\n* -----------------------------------------------------\n* wcshdo() translates a wcsprm struct into a FITS header.  If the colnum\n* member of the struct is non-zero then a binary table image array header will\n* be produced.  Otherwise, if the colax[] member of the struct is set non-zero\n* then a pixel list header will be produced.  Otherwise, a primary image or\n* image extension header will be produced.\n*\n* If the struct was originally constructed from a header, e.g. by wcspih(),\n* the output header will almost certainly differ in a number of respects:\n*\n*   - The output header only contains WCS-related keywords.  In particular, it\n*     does not contain syntactically-required keywords such as SIMPLE, NAXIS,\n*     BITPIX, or END.\n*\n*   - Elements of the PCi_ja matrix will be written if and only if they differ\n*     from the unit matrix.  Thus, if the matrix is unity then no elements\n*     will be written.\n*\n*   - The redundant keywords MJDREF, JDREF, JDREFI, JDREFF, all of which\n*     duplicate MJDREFI + MJDREFF, are never written.  OBSGEO-[LBH] are not\n*     written if OBSGEO-[XYZ] are defined.\n*\n*   - Deprecated (e.g. CROTAn, RESTFREQ, VELREF, RADECSYS, EPOCH, VSOURCEa) or\n*     non-standard usage will be translated to standard (this is partially\n*     dependent on whether wcsfix() was applied).\n*\n*   - Additional keywords such as WCSAXESa, CUNITia, LONPOLEa and LATPOLEa may\n*     appear.\n*\n*   - Quantities will be converted to the units used internally, basically SI\n*     with the addition of degrees.\n*\n*   - Floating-point quantities may be given to a different decimal precision.\n*\n*   - The original keycomments will be lost, although wcshdo() tries hard to\n*     write meaningful comments.\n*\n*   - Keyword order will almost certainly be changed.\n*\n* Keywords can be translated between the image array, binary table, and pixel\n* lists forms by manipulating the colnum or colax[] members of the wcsprm\n* struct.\n*\n* Given:\n*   ctrl      int       Vector of flag bits that controls the degree of\n*                       permissiveness in departing from the published WCS\n*                       standard, and also controls the formatting of\n*                       floating-point keyvalues.  Set it to zero to get the\n*                       default behaviour.\n*\n*                       Flag bits for the degree of permissiveness:\n*                         WCSHDO_none: Recognize only FITS keywords defined by\n*                            the published WCS standard.\n*                         WCSHDO_all: Admit all recognized informal extensions\n*                            of the WCS standard.\n*                       Fine-grained control of the degree of permissiveness\n*                       is also possible as explained in the notes below.\n*\n*                       As for controlling floating-point formatting, by\n*                       default wcshdo() uses \"%20.12G\" for non-parameterized\n*                       keywords such as LONPOLEa, and attempts to make the\n*                       header more human-readable by using the same \"%f\"\n*                       format for all values of each of the following\n*                       parameterized keywords: CRPIXja, PCi_ja, and CDELTia\n*                       (n.b. excluding CRVALia).  Each has the same field\n*                       width and precision so that the decimal points line\n*                       up.  The precision, allowing for up to 15 significant\n*                       digits, is chosen so that there are no excess trailing\n*                       zeroes.  A similar formatting scheme applies by\n*                       default for distortion function parameters.\n*\n*                       However, where the values of, for example, CDELTia\n*                       differ by many orders of magnitude, the default\n*                       formatting scheme may cause unacceptable loss of\n*                       precision for the lower-valued keyvalues.  Thus the\n*                       default behaviour may be overridden:\n*                         WCSHDO_P12: Use \"%20.12G\" format for all floating-\n*                            point keyvalues (12 significant digits).\n*                         WCSHDO_P13: Use \"%21.13G\" format for all floating-\n*                            point keyvalues (13 significant digits).\n*                         WCSHDO_P14: Use \"%22.14G\" format for all floating-\n*                            point keyvalues (14 significant digits).\n*                         WCSHDO_P15: Use \"%23.15G\" format for all floating-\n*                            point keyvalues (15 significant digits).\n*                         WCSHDO_P16: Use \"%24.16G\" format for all floating-\n*                            point keyvalues (16 significant digits).\n*                         WCSHDO_P17: Use \"%25.17G\" format for all floating-\n*                            point keyvalues (17 significant digits).\n*                       If more than one of the above flags are set, the\n*                       highest number of significant digits prevails.  In\n*                       addition, there is an anciliary flag:\n*                         WCSHDO_EFMT: Use \"%E\" format instead of the default\n*                            \"%G\" format above.\n*                       Note that excess trailing zeroes are stripped off the\n*                       fractional part with \"%G\" (which never occurs with\n*                       \"%E\").  Note also that the higher-precision options\n*                       eat into the keycomment area.  In this regard,\n*                       WCSHDO_P14 causes minimal disruption with \"%G\" format,\n*                       while WCSHDO_P13 is appropriate with \"%E\".\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Pointer to a wcsprm struct containing coordinate\n*                       transformation parameters.  Will be initialized if\n*                       necessary.\n*\n* Returned:\n*   nkeyrec   int*      Number of FITS header keyrecords returned in the\n*                       \"header\" array.\n*\n*   header    char**    Pointer to an array of char holding the header.\n*                       Storage for the array is allocated by wcshdo() in\n*                       blocks of 2880 bytes (32 x 80-character keyrecords)\n*                       and must be freed by the user to avoid memory leaks.\n*                       See wcsdealloc().\n*\n*                       Each keyrecord is 80 characters long and is *NOT*\n*                       null-terminated, so the first keyrecord starts at\n*                       (*header)[0], the second at (*header)[80], etc.\n*\n* Function return value:\n*             int       Status return value (associated with wcs_errmsg[]):\n*                         0: Success.\n*                         1: Null wcsprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Linear transformation matrix is singular.\n*                         4: Inconsistent or unrecognized coordinate axis\n*                            types.\n*                         5: Invalid parameter value.\n*                         6: Invalid coordinate transformation parameters.\n*                         7: Ill-conditioned coordinate transformation\n*                            parameters.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       wcsprm::err if enabled, see wcserr_enable().\n*\n* Notes:\n*   1: wcshdo() interprets the \"relax\" argument as a vector of flag bits to\n*      provide fine-grained control over what non-standard WCS keywords to\n*      write.  The flag bits are subject to change in future and should be set\n*      by using the preprocessor macros (see below) for the purpose.\n*\n*      - WCSHDO_none: Don't use any extensions.\n*\n*      - WCSHDO_all: Write all recognized extensions, equivalent to setting\n*              each flag bit.\n*\n*      - WCSHDO_safe: Write all extensions that are considered to be safe and\n*              recommended.\n*\n*      - WCSHDO_DOBSn: Write DOBSn, the column-specific analogue of DATE-OBS\n*              for use in binary tables and pixel lists.  WCS Paper III\n*              introduced DATE-AVG and DAVGn but by an oversight DOBSn (the\n*              obvious analogy) was never formally defined by the standard.\n*              The alternative to using DOBSn is to write DATE-OBS which\n*              applies to the whole table.  This usage is considered to be\n*              safe and is recommended.\n*\n*      - WCSHDO_TPCn_ka: WCS Paper I defined\n*\n*              - TPn_ka and TCn_ka for pixel lists\n*\n*              but WCS Paper II uses TPCn_ka in one example and subsequently\n*              the errata for the WCS papers legitimized the use of\n*\n*              - TPCn_ka and TCDn_ka for pixel lists\n*\n*              provided that the keyword does not exceed eight characters.\n*              This usage is considered to be safe and is recommended because\n*              of the non-mnemonic terseness of the shorter forms.\n*\n*      - WCSHDO_PVn_ma: WCS Paper I defined\n*\n*              - iVn_ma and iSn_ma for bintables and\n*              - TVn_ma and TSn_ma for pixel lists\n*\n*              but WCS Paper II uses iPVn_ma and TPVn_ma in the examples and\n*              subsequently the errata for the WCS papers legitimized the use\n*              of\n*\n*              - iPVn_ma and iPSn_ma for bintables and\n*              - TPVn_ma and TPSn_ma for pixel lists\n*\n*              provided that the keyword does not exceed eight characters.\n*              This usage is considered to be safe and is recommended because\n*              of the non-mnemonic terseness of the shorter forms.\n*\n*      - WCSHDO_CRPXna: For historical reasons WCS Paper I defined\n*\n*              - jCRPXn, iCDLTn, iCUNIn, iCTYPn, and iCRVLn for bintables and\n*              - TCRPXn, TCDLTn, TCUNIn, TCTYPn, and TCRVLn for pixel lists\n*\n*              for use without an alternate version specifier.  However,\n*              because of the eight-character keyword constraint, in order to\n*              accommodate column numbers greater than 99 WCS Paper I also\n*              defined\n*\n*              - jCRPna, iCDEna, iCUNna, iCTYna and iCRVna for bintables and\n*              - TCRPna, TCDEna, TCUNna, TCTYna and TCRVna for pixel lists\n*\n*              for use with an alternate version specifier (the \"a\").  Like\n*              the PC, CD, PV, and PS keywords there is an obvious tendency to\n*              confuse these two forms for column numbers up to 99.  It is\n*              very unlikely that any parser would reject keywords in the\n*              first set with a non-blank alternate version specifier so this\n*              usage is considered to be safe and is recommended.\n*\n*      - WCSHDO_CNAMna: WCS Papers I and III defined\n*\n*              - iCNAna,  iCRDna,  and iCSYna  for bintables and\n*              - TCNAna,  TCRDna,  and TCSYna  for pixel lists\n*\n*              By analogy with the above, the long forms would be\n*\n*              - iCNAMna, iCRDEna, and iCSYEna for bintables and\n*              - TCNAMna, TCRDEna, and TCSYEna for pixel lists\n*\n*              Note that these keywords provide auxiliary information only,\n*              none of them are needed to compute world coordinates.  This\n*              usage is potentially unsafe and is not recommended at this\n*              time.\n*\n*      - WCSHDO_WCSNna: In light of wcsbth() note 4, write WCSNna instead of\n*              TWCSna for pixel lists.  While wcsbth() treats WCSNna and\n*              TWCSna as equivalent, other parsers may not.  Consequently,\n*              this usage is potentially unsafe and is not recommended at this\n*              time.\n*\n*\n* Global variable: const char *wcshdr_errmsg[] - Status return messages\n* ---------------------------------------------------------------------\n* Error messages to match the status value returned from each function.\n* Use wcs_errmsg[] for status returns from wcshdo().\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_WCSHDR\n#define WCSLIB_WCSHDR\n\n#include \"wcs.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define WCSHDR_none     0x00000000\n#define WCSHDR_all      0x000FFFFF\n#define WCSHDR_reject   0x10000000\n#define WCSHDR_strict   0x20000000\n\n#define WCSHDR_CROTAia  0x00000001\n#define WCSHDR_VELREFa  0x00000002\n#define WCSHDR_CD00i00j 0x00000004\n#define WCSHDR_PC00i00j 0x00000008\n#define WCSHDR_PROJPn   0x00000010\n#define WCSHDR_CD0i_0ja 0x00000020\n#define WCSHDR_PC0i_0ja 0x00000040\n#define WCSHDR_PV0i_0ma 0x00000080\n#define WCSHDR_PS0i_0ma 0x00000100\n#define WCSHDR_DOBSn    0x00000200\n#define WCSHDR_OBSGLBHn 0x00000400\n#define WCSHDR_RADECSYS 0x00000800\n#define WCSHDR_EPOCHa   0x00001000\n#define WCSHDR_VSOURCE  0x00002000\n#define WCSHDR_DATEREF  0x00004000\n#define WCSHDR_LONGKEY  0x00008000\n#define WCSHDR_CNAMn    0x00010000\n#define WCSHDR_AUXIMG   0x00020000\n#define WCSHDR_ALLIMG   0x00040000\n\n#define WCSHDR_IMGHEAD  0x00100000\n#define WCSHDR_BIMGARR  0x00200000\n#define WCSHDR_PIXLIST  0x00400000\n\n#define WCSHDO_none     0x00000\n#define WCSHDO_all      0x000FF\n#define WCSHDO_safe     0x0000F\n#define WCSHDO_DOBSn    0x00001\n#define WCSHDO_TPCn_ka  0x00002\n#define WCSHDO_PVn_ma   0x00004\n#define WCSHDO_CRPXna   0x00008\n#define WCSHDO_CNAMna   0x00010\n#define WCSHDO_WCSNna   0x00020\n#define WCSHDO_P12      0x01000\n#define WCSHDO_P13      0x02000\n#define WCSHDO_P14      0x04000\n#define WCSHDO_P15      0x08000\n#define WCSHDO_P16      0x10000\n#define WCSHDO_P17      0x20000\n#define WCSHDO_EFMT     0x40000\n\n\nextern const char *wcshdr_errmsg[];\n\nenum wcshdr_errmsg_enum {\n  WCSHDRERR_SUCCESS            = 0,\t// Success.\n  WCSHDRERR_NULL_POINTER       = 1,\t// Null wcsprm pointer passed.\n  WCSHDRERR_MEMORY             = 2,\t// Memory allocation failed.\n  WCSHDRERR_BAD_COLUMN         = 3,\t// Invalid column selection.\n  WCSHDRERR_PARSER             = 4,\t// Fatal error returned by Flex\n\t\t\t\t\t// parser.\n  WCSHDRERR_BAD_TABULAR_PARAMS = 5 \t// Invalid tabular parameters.\n};\n\nint wcspih(char *header, int nkeyrec, int relax, int ctrl, int *nreject,\n           int *nwcs, struct wcsprm **wcs);\n\nint wcsbth(char *header, int nkeyrec, int relax, int ctrl, int keysel,\n           int *colsel, int *nreject, int *nwcs, struct wcsprm **wcs);\n\nint wcstab(struct wcsprm *wcs);\n\nint wcsidx(int nwcs, struct wcsprm **wcs, int alts[27]);\n\nint wcsbdx(int nwcs, struct wcsprm **wcs, int type, short alts[1000][28]);\n\nint wcsvfree(int *nwcs, struct wcsprm **wcs);\n\nint wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header);\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WCSLIB_WCSHDR\n"},{"id":16594,"name":"getwcstab.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: getwcstab.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n* Summary of the getwcstab routines\n* ---------------------------------\n* fits_read_wcstab(), an implementation of a FITS table reading routine for\n* 'TAB' coordinates, is provided for CFITSIO programmers.  It has been\n* incorporated into CFITSIO as of v3.006 with the definitions in this file,\n* getwcstab.h, moved into fitsio.h.\n*\n* fits_read_wcstab() is not included in the WCSLIB object library but the\n* source code is presented here as it may be useful for programmers using an\n* older version of CFITSIO than 3.006, or as a programming template for\n* non-CFITSIO programmers.\n*\n*\n* fits_read_wcstab() - FITS 'TAB' table reading routine\n* ----------------------------------------------------\n* fits_read_wcstab() extracts arrays from a binary table required in\n* constructing 'TAB' coordinates.\n*\n* Given:\n*   fptr      fitsfile *\n*                       Pointer to the file handle returned, for example, by\n*                       the fits_open_file() routine in CFITSIO.\n*\n*   nwtb      int       Number of arrays to be read from the binary table(s).\n*\n* Given and returned:\n*   wtb       wtbarr *  Address of the first element of an array of wtbarr\n*                       typedefs.  This wtbarr typedef is defined to match the\n*                       wtbarr struct defined in WCSLIB.  An array of such\n*                       structs returned by the WCSLIB function wcstab() as\n*                       discussed in the notes below.\n*\n* Returned:\n*   status    int *     CFITSIO status value.\n*\n* Function return value:\n*             int       CFITSIO status value.\n*\n* Notes:\n*   1: In order to maintain WCSLIB and CFITSIO as independent libraries it is\n*      not permissible for any CFITSIO library code to include WCSLIB header\n*      files, or vice versa.  However, the CFITSIO function fits_read_wcstab()\n*      accepts an array of wtbarr structs defined in wcs.h within WCSLIB.\n*\n*      The problem therefore is to define the wtbarr struct within fitsio.h\n*      without including wcs.h, especially noting that wcs.h will often (but\n*      not always) be included together with fitsio.h in an applications\n*      program that uses fits_read_wcstab().\n*\n*      The solution adopted is for WCSLIB to define \"struct wtbarr\" while\n*      fitsio.h defines \"typedef wtbarr\" as an untagged struct with identical\n*      members.  This allows both wcs.h and fitsio.h to define a wtbarr data\n*      type without conflict by virtue of the fact that structure tags and\n*      typedef names share different name spaces in C; Appendix A, Sect. A11.1\n*      (p227) of the K&R ANSI edition states that:\n*\n=        Identifiers fall into several name spaces that do not interfere with\n=        one another; the same identifier may be used for different purposes,\n=        even in the same scope, if the uses are in different name spaces.\n=        These classes are: objects, functions, typedef names, and enum\n=        constants; labels; tags of structures, unions, and enumerations; and\n=        members of each structure or union individually.\n*\n*      Therefore, declarations within WCSLIB look like\n*\n=        struct wtbarr *w;\n*\n*      while within CFITSIO they are simply\n*\n=        wtbarr *w;\n*\n*      As suggested by the commonality of the names, these are really the same\n*      aggregate data type.  However, in passing a (struct wtbarr *) to\n*      fits_read_wcstab() a cast to (wtbarr *) is formally required.\n*\n*      When using WCSLIB and CFITSIO together in C++ the situation is\n*      complicated by the fact that typedefs and structs share the same\n*      namespace; C++ Annotated Reference Manual, Sect. 7.1.3 (p105).  In that\n*      case the wtbarr struct in wcs.h is renamed by preprocessor macro\n*      substitution to wtbarr_s to distinguish it from the typedef defined in\n*      fitsio.h.  However, the scope of this macro substitution is limited to\n*      wcs.h itself and CFITSIO programmer code, whether in C++ or C, should\n*      always use the wtbarr typedef.\n*\n*\n* wtbarr typedef\n* --------------\n* The wtbarr typedef is defined as a struct containing the following members:\n*\n*   int i\n*     Image axis number.\n*\n*   int m\n*     Array axis number for index vectors.\n*\n*   int kind\n*     Character identifying the array type:\n*       - c: coordinate array,\n*       - i: index vector.\n*\n*   char extnam[72]\n*     EXTNAME identifying the binary table extension.\n*\n*   int extver\n*     EXTVER identifying the binary table extension.\n*\n*   int extlev\n*     EXTLEV identifying the binary table extension.\n*\n*   char ttype[72]\n*     TTYPEn identifying the column of the binary table that contains the\n*     array.\n*\n*   long row\n*     Table row number.\n*\n*   int ndim\n*     Expected dimensionality of the array.\n*\n*   int *dimlen\n*     Address of the first element of an array of int of length ndim into\n*     which the array axis lengths are to be written.\n*\n*   double **arrayp\n*     Pointer to an array of double which is to be allocated by the user\n*     and into which the array is to be written.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_GETWCSTAB\n#define WCSLIB_GETWCSTAB\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include <fitsio.h>\n\ntypedef struct {\n  int  i;\t\t\t// Image axis number.\n  int  m;\t\t\t// Array axis number for index vectors.\n  int  kind;\t\t\t// Array type, 'c' (coord) or 'i' (index).\n  char extnam[72];\t\t// EXTNAME of binary table extension.\n  int  extver;\t\t\t// EXTVER  of binary table extension.\n  int  extlev;\t\t\t// EXTLEV  of binary table extension.\n  char ttype[72];\t\t// TTYPEn of column containing the array.\n  long row;\t\t\t// Table row number.\n  int  ndim;\t\t\t// Expected array dimensionality.\n  int  *dimlen;\t\t\t// Where to write the array axis lengths.\n  double **arrayp;\t\t// Where to write the address of the array\n\t\t\t\t// allocated to store the array.\n} wtbarr;\n\n\nint fits_read_wcstab(fitsfile *fptr, int nwtb, wtbarr *wtb, int *status);\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WCSLIB_GETWCSTAB\n"},{"id":16595,"name":"sph.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: sph.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <math.h>\n#include \"wcstrig.h\"\n#include \"sph.h\"\n\n#define copysign(X, Y) ((Y) < 0.0 ? -fabs(X) : fabs(X))\n\n#define tol 1.0e-5\n\n//----------------------------------------------------------------------------\n\nint sphx2s(\n  const double eul[5],\n  int nphi,\n  int ntheta,\n  int spt,\n  int sll,\n  const double phi[],\n  const double theta[],\n  double lng[],\n  double lat[])\n\n{\n  int jphi, mphi, mtheta, rowlen, rowoff;\n  double cosphi, costhe, costhe3, costhe4, dlng, dphi, sinphi, sinthe,\n         sinthe3, sinthe4, x, y, z;\n  register int iphi, itheta;\n  register const double *phip, *thetap;\n  register double *latp, *lngp;\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n\n  // Check for special-case rotations.\n  if (eul[4] == 0.0) {\n    if (eul[1] == 0.0) {\n      // Simple change in origin of longitude.\n      dlng = fmod(eul[0] + 180.0 - eul[2], 360.0);\n\n      jphi   = 0;\n      thetap = theta;\n      lngp   = lng;\n      latp   = lat;\n      for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n        phip = phi + (jphi%nphi)*spt;\n        for (iphi = 0; iphi < mphi; iphi++, phip += spt, jphi++) {\n          *lngp = *phip + dlng;\n          *latp = *thetap;\n\n          // Normalize the celestial longitude.\n          if (eul[0] >= 0.0) {\n            if (*lngp < 0.0) *lngp += 360.0;\n          } else {\n            if (*lngp > 0.0) *lngp -= 360.0;\n          }\n\n          if (*lngp > 360.0) {\n            *lngp -= 360.0;\n          } else if (*lngp < -360.0) {\n            *lngp += 360.0;\n          }\n\n          lngp += sll;\n          latp += sll;\n        }\n      }\n\n    } else {\n      // Pole-flip with change in origin of longitude.\n      dlng = fmod(eul[0] + eul[2], 360.0);\n\n      jphi   = 0;\n      thetap = theta;\n      lngp   = lng;\n      latp   = lat;\n      for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n        phip = phi + (jphi%nphi)*spt;\n        for (iphi = 0; iphi < mphi; iphi++, phip += spt, jphi++) {\n          *lngp = dlng - *phip;\n          *latp = -(*thetap);\n\n          // Normalize the celestial longitude.\n          if (eul[0] >= 0.0) {\n            if (*lngp < 0.0) *lngp += 360.0;\n          } else {\n            if (*lngp > 0.0) *lngp -= 360.0;\n          }\n\n          if (*lngp > 360.0) {\n            *lngp -= 360.0;\n          } else if (*lngp < -360.0) {\n            *lngp += 360.0;\n          }\n\n          lngp += sll;\n          latp += sll;\n        }\n      }\n    }\n\n    return 0;\n  }\n\n\n  // Do phi dependency.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sll;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sll, phip += spt) {\n    dphi = *phip - eul[2];\n\n    lngp = lng + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *lngp = dphi;\n      lngp += rowlen;\n    }\n  }\n\n\n  // Do theta dependency.\n  thetap = theta;\n  lngp = lng;\n  latp = lat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    sincosd(*thetap, &sinthe, &costhe);\n    costhe3 = costhe*eul[3];\n    costhe4 = costhe*eul[4];\n    sinthe3 = sinthe*eul[3];\n    sinthe4 = sinthe*eul[4];\n\n    for (iphi = 0; iphi < mphi; iphi++, lngp += sll, latp += sll) {\n      dphi = *lngp;\n      sincosd(dphi, &sinphi, &cosphi);\n\n      // Compute the celestial longitude.\n      x = sinthe4 - costhe3*cosphi;\n      if (fabs(x) < tol) {\n        // Rearrange formula to reduce roundoff errors.\n        x = -cosd(*thetap + eul[1]) + costhe3*(1.0 - cosphi);\n      }\n\n      y = -costhe*sinphi;\n      if (x != 0.0 || y != 0.0) {\n        dlng = atan2d(y, x);\n      } else {\n        // Change of origin of longitude.\n        if (eul[1] < 90.0) {\n          dlng =  dphi + 180.0;\n        } else {\n          dlng = -dphi;\n        }\n      }\n      *lngp = eul[0] + dlng;\n\n      // Normalize the celestial longitude.\n      if (eul[0] >= 0.0) {\n        if (*lngp < 0.0) *lngp += 360.0;\n      } else {\n        if (*lngp > 0.0) *lngp -= 360.0;\n      }\n\n      if (*lngp > 360.0) {\n        *lngp -= 360.0;\n      } else if (*lngp < -360.0) {\n        *lngp += 360.0;\n      }\n\n      // Compute the celestial latitude.\n      if (fmod(dphi,180.0) == 0.0) {\n        *latp = *thetap + cosphi*eul[1];\n        if (*latp >  90.0) *latp =  180.0 - *latp;\n        if (*latp < -90.0) *latp = -180.0 - *latp;\n      } else {\n        z = sinthe3 + costhe4*cosphi;\n        if (fabs(z) > 0.99) {\n          // Use an alternative formula for greater accuracy.\n          *latp = copysign(acosd(sqrt(x*x+y*y)), z);\n        } else {\n          *latp = asind(z);\n        }\n      }\n    }\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint sphs2x(\n  const double eul[5],\n  int nlng,\n  int nlat,\n  int sll,\n  int spt,\n  const double lng[],\n  const double lat[],\n  double phi[],\n  double theta[])\n\n{\n  int jlng, mlat, mlng, rowlen, rowoff;\n  double coslat, coslat3, coslat4, coslng, dlng, dphi, sinlat, sinlat3,\n         sinlat4, sinlng, x, y, z;\n  register int ilat, ilng;\n  register const double *latp, *lngp;\n  register double *phip, *thetap;\n\n  if (nlat > 0) {\n    mlng = nlng;\n    mlat = nlat;\n  } else {\n    mlng = 1;\n    mlat = 1;\n    nlat = nlng;\n  }\n\n\n  // Check for special-case rotations.\n  if (eul[4] == 0.0) {\n    if (eul[1] == 0.0) {\n      // Simple change in origin of longitude.\n      dphi = fmod(eul[2] - 180.0 - eul[0], 360.0);\n\n      jlng   = 0;\n      latp   = lat;\n      phip   = phi;\n      thetap = theta;\n      for (ilat = 0; ilat < nlat; ilat++, latp += sll) {\n        lngp = lng + (jlng%nlng)*sll;\n        for (ilng = 0; ilng < mlng; ilng++, lngp += sll, jlng++) {\n          *phip = fmod(*lngp + dphi, 360.0);\n          *thetap = *latp;\n\n          // Normalize the native longitude.\n          if (*phip > 180.0) {\n            *phip -= 360.0;\n          } else if (*phip < -180.0) {\n            *phip += 360.0;\n          }\n\n          phip   += spt;\n          thetap += spt;\n        }\n      }\n\n    } else {\n      // Pole-flip with change in origin of longitude.\n      dphi = fmod(eul[2] + eul[0], 360.0);\n\n      jlng   = 0;\n      latp   = lat;\n      phip   = phi;\n      thetap = theta;\n      for (ilat = 0; ilat < nlat; ilat++, latp += sll) {\n        lngp = lng + (jlng%nlng)*sll;\n        for (ilng = 0; ilng < mlng; ilng++, lngp += sll, jlng++) {\n          *phip = fmod(dphi - *lngp, 360.0);\n          *thetap = -(*latp);\n\n          // Normalize the native longitude.\n          if (*phip > 180.0) {\n            *phip -= 360.0;\n          } else if (*phip < -180.0) {\n            *phip += 360.0;\n          }\n\n          phip   += spt;\n          thetap += spt;\n        }\n      }\n    }\n\n    return 0;\n  }\n\n\n  // Do lng dependency.\n  lngp = lng;\n  rowoff = 0;\n  rowlen = nlng*spt;\n  for (ilng = 0; ilng < nlng; ilng++, rowoff += spt, lngp += sll) {\n    dlng = *lngp - eul[0];\n\n    phip = phi + rowoff;\n    thetap = theta;\n    for (ilat = 0; ilat < mlat; ilat++) {\n      *phip = dlng;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do lat dependency.\n  latp = lat;\n  phip   = phi;\n  thetap = theta;\n  for (ilat = 0; ilat < nlat; ilat++, latp += sll) {\n    sincosd(*latp, &sinlat, &coslat);\n    coslat3 = coslat*eul[3];\n    coslat4 = coslat*eul[4];\n    sinlat3 = sinlat*eul[3];\n    sinlat4 = sinlat*eul[4];\n\n    for (ilng = 0; ilng < mlng; ilng++, phip += spt, thetap += spt) {\n      dlng = *phip;\n      sincosd(dlng, &sinlng, &coslng);\n\n      // Compute the native longitude.\n      x = sinlat4 - coslat3*coslng;\n      if (fabs(x) < tol) {\n        // Rearrange formula to reduce roundoff errors.\n        x = -cosd(*latp+eul[1]) + coslat3*(1.0 - coslng);\n      }\n\n      y = -coslat*sinlng;\n      if (x != 0.0 || y != 0.0) {\n        dphi = atan2d(y, x);\n      } else {\n        // Change of origin of longitude.\n        if (eul[1] < 90.0) {\n          dphi =  dlng - 180.0;\n        } else {\n          dphi = -dlng;\n        }\n      }\n      *phip = fmod(eul[2] + dphi, 360.0);\n\n      // Normalize the native longitude.\n      if (*phip > 180.0) {\n        *phip -= 360.0;\n      } else if (*phip < -180.0) {\n        *phip += 360.0;\n      }\n\n      // Compute the native latitude.\n      if (fmod(dlng,180.0) == 0.0) {\n        *thetap = *latp + coslng*eul[1];\n        if (*thetap >  90.0) *thetap =  180.0 - *thetap;\n        if (*thetap < -90.0) *thetap = -180.0 - *thetap;\n      } else {\n        z = sinlat3 + coslat4*coslng;\n        if (fabs(z) > 0.99) {\n          // Use an alternative formula for greater accuracy.\n          *thetap = copysign(acosd(sqrt(x*x+y*y)), z);\n        } else {\n          *thetap = asind(z);\n        }\n      }\n    }\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint sphdpa(\n  int nfield,\n  double lng0,\n  double lat0,\n  const double lng[],\n  const double lat[],\n  double dist[],\n  double pa[])\n\n{\n  int i;\n  double eul[5];\n\n  // Set the Euler angles for the coordinate transformation.\n  eul[0] = lng0;\n  eul[1] = 90.0 - lat0;\n  eul[2] = 0.0;\n  eul[3] = cosd(eul[1]);\n  eul[4] = sind(eul[1]);\n\n  // Transform field points to the new system.\n  sphs2x(eul, nfield, 0, 1, 1, lng, lat, pa, dist);\n\n  for (i = 0; i < nfield; i++) {\n    // Angular distance is obtained from latitude in the new frame.\n    dist[i] = 90.0 - dist[i];\n\n    // Position angle is obtained from longitude in the new frame.\n    pa[i] = -pa[i];\n    if (pa[i] < -180.0) pa[i] += 360.0;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint sphpad(\n  int nfield,\n  double lng0,\n  double lat0,\n  const double dist[],\n  const double pa[],\n  double lng[],\n  double lat[])\n\n{\n  int i;\n  double eul[5];\n\n  // Set the Euler angles for the coordinate transformation.\n  eul[0] = lng0;\n  eul[1] = 90.0 - lat0;\n  eul[2] = 0.0;\n  eul[3] = cosd(eul[1]);\n  eul[4] = sind(eul[1]);\n\n  for (i = 0; i < nfield; i++) {\n    // Latitude in the new frame is obtained from angular distance.\n    lat[i] = 90.0 - dist[i];\n\n    // Longitude in the new frame is obtained from position angle.\n    lng[i] = -pa[i];\n  }\n\n  // Transform field points to the old system.\n  sphx2s(eul, nfield, 0, 1, 1, lng, lat, lng, lat);\n\n  return 0;\n}\n"},{"id":16596,"name":"prj.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: prj.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"wcserr.h\"\n#include \"wcsmath.h\"\n#include \"wcsprintf.h\"\n#include \"wcstrig.h\"\n#include \"wcsutil.h\"\n#include \"prj.h\"\n\n\n// Projection categories.\nconst int ZENITHAL          = 1;\nconst int CYLINDRICAL       = 2;\nconst int PSEUDOCYLINDRICAL = 3;\nconst int CONVENTIONAL      = 4;\nconst int CONIC             = 5;\nconst int POLYCONIC         = 6;\nconst int QUADCUBE          = 7;\nconst int HEALPIX           = 8;\n\nconst char prj_categories[9][32] =\n  {\"undefined\", \"zenithal\", \"cylindrical\", \"pseudocylindrical\",\n  \"conventional\", \"conic\", \"polyconic\", \"quadcube\", \"HEALPix\"};\n\n\n// Projection codes.\nconst int  prj_ncode = 28;\nconst char prj_codes[28][4] =\n  {\"AZP\", \"SZP\", \"TAN\", \"STG\", \"SIN\", \"ARC\", \"ZPN\", \"ZEA\", \"AIR\", \"CYP\",\n   \"CEA\", \"CAR\", \"MER\", \"COP\", \"COE\", \"COD\", \"COO\", \"SFL\", \"PAR\", \"MOL\",\n   \"AIT\", \"BON\", \"PCO\", \"TSC\", \"CSC\", \"QSC\", \"HPX\", \"XPH\"};\n\nconst int AZP = 101;\nconst int SZP = 102;\nconst int TAN = 103;\nconst int STG = 104;\nconst int SIN = 105;\nconst int ARC = 106;\nconst int ZPN = 107;\nconst int ZEA = 108;\nconst int AIR = 109;\nconst int CYP = 201;\nconst int CEA = 202;\nconst int CAR = 203;\nconst int MER = 204;\nconst int SFL = 301;\nconst int PAR = 302;\nconst int MOL = 303;\nconst int AIT = 401;\nconst int COP = 501;\nconst int COE = 502;\nconst int COD = 503;\nconst int COO = 504;\nconst int BON = 601;\nconst int PCO = 602;\nconst int TSC = 701;\nconst int CSC = 702;\nconst int QSC = 703;\nconst int HPX = 801;\nconst int XPH = 802;\n\n\n// Map status return value to message.\nconst char *prj_errmsg[] = {\n  \"Success\",\n  \"Null prjprm pointer passed\",\n  \"Invalid projection parameters\",\n  \"One or more of the (x,y) coordinates were invalid\",\n  \"One or more of the (phi,theta) coordinates were invalid\"};\n\n// Convenience macros for generating common error messages.\n#define PRJERR_BAD_PARAM_SET(function) \\\n  wcserr_set(&(prj->err), PRJERR_BAD_PARAM, function, __FILE__, __LINE__, \\\n    \"Invalid parameters for %s projection\", prj->name);\n\n#define PRJERR_BAD_PIX_SET(function) \\\n  wcserr_set(&(prj->err), PRJERR_BAD_PIX, function, __FILE__, __LINE__, \\\n    \"One or more of the (x, y) coordinates were invalid for %s projection\", \\\n    prj->name);\n\n#define PRJERR_BAD_WORLD_SET(function) \\\n  wcserr_set(&(prj->err), PRJERR_BAD_WORLD, function, __FILE__, __LINE__, \\\n    \"One or more of the (lat, lng) coordinates were invalid for \" \\\n    \"%s projection\", prj->name);\n\n#define copysign(X, Y) ((Y) < 0.0 ? -fabs(X) : fabs(X))\n\n\n/*============================================================================\n* Generic routines:\n*\n* prjini initializes a prjprm struct to default values.\n*\n* prjfree frees any memory that may have been allocated to store an error\n*        message in the prjprm struct.\n*\n* prjsize computed the size of a prjprm struct.\n*\n* prjprt prints the contents of a prjprm struct.\n*\n* prjbchk performs bounds checking on the native coordinates returned by the\n*        *x2s() routines.\n*\n* prjset invokes the specific initialization routine based on the projection\n*        code in the prjprm struct.\n*\n* prjx2s invokes the specific deprojection routine based on the pointer-to-\n*        function stored in the prjprm struct.\n*\n* prjs2x invokes the specific projection routine based on the pointer-to-\n*        function stored in the prjprm struct.\n*\n*---------------------------------------------------------------------------*/\n\nint prjini(struct prjprm *prj)\n\n{\n  register int k;\n\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = 0;\n\n  strcpy(prj->code, \"   \");\n  prj->pv[0]  = 0.0;\n  prj->pv[1]  = UNDEFINED;\n  prj->pv[2]  = UNDEFINED;\n  prj->pv[3]  = UNDEFINED;\n  for (k = 4; k < PVN; prj->pv[k++] = 0.0);\n  prj->r0     = 0.0;\n  prj->phi0   = UNDEFINED;\n  prj->theta0 = UNDEFINED;\n  prj->bounds = 7;\n\n  strcpy(prj->name, \"undefined\");\n  for (k = 9; k < 40; prj->name[k++] = '\\0');\n  prj->category  = 0;\n  prj->pvrange   = 0;\n  prj->simplezen = 0;\n  prj->equiareal = 0;\n  prj->conformal = 0;\n  prj->global    = 0;\n  prj->divergent = 0;\n  prj->x0 = 0.0;\n  prj->y0 = 0.0;\n\n  prj->err = 0x0;\n\n  prj->padding = 0x0;\n  for (k = 0; k < 10; prj->w[k++] = 0.0);\n  prj->m = 0;\n  prj->n = 0;\n  prj->prjx2s = 0x0;\n  prj->prjs2x = 0x0;\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint prjfree(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  wcserr_clear(&(prj->err));\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint prjsize(const struct prjprm *prj, int sizes[2])\n\n{\n  if (prj == 0x0) {\n    sizes[0] = sizes[1] = 0;\n    return PRJERR_SUCCESS;\n  }\n\n  // Base size, in bytes.\n  sizes[0] = sizeof(struct prjprm);\n\n  // Total size of allocated memory, in bytes.\n  sizes[1] = 0;\n\n  int exsizes[2];\n\n  // prjprm::err.\n  wcserr_size(prj->err, exsizes);\n  sizes[1] += exsizes[0] + exsizes[1];\n\n  return PRJERR_SUCCESS;\n}\n\n//----------------------------------------------------------------------------\n\nint prjprt(const struct prjprm *prj)\n\n{\n  char hext[32];\n  int  i, n;\n\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  wcsprintf(\"       flag: %d\\n\",  prj->flag);\n  wcsprintf(\"       code: \\\"%s\\\"\\n\",  prj->code);\n  wcsprintf(\"         r0: %9f\\n\", prj->r0);\n  wcsprintf(\"         pv:\");\n  if (prj->pvrange) {\n    n = (prj->pvrange)%100;\n\n    if (prj->pvrange/100) {\n      wcsprintf(\" (0)\");\n    } else {\n      wcsprintf(\" %#- 11.5g\", prj->pv[0]);\n      n--;\n    }\n\n    for (i = 1; i <= n; i++) {\n      if (i%5 == 1) {\n        wcsprintf(\"\\n           \");\n      }\n\n      if (undefined(prj->pv[i])) {\n        wcsprintf(\"  UNDEFINED   \");\n      } else {\n        wcsprintf(\"  %#- 11.5g\", prj->pv[i]);\n      }\n    }\n    wcsprintf(\"\\n\");\n  } else {\n    wcsprintf(\" (not used)\\n\");\n  }\n  if (undefined(prj->phi0)) {\n    wcsprintf(\"       phi0: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"       phi0: %9f\\n\", prj->phi0);\n  }\n  if (undefined(prj->theta0)) {\n    wcsprintf(\"     theta0: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"     theta0: %9f\\n\", prj->theta0);\n  }\n  wcsprintf(\"     bounds: %d\\n\",  prj->bounds);\n\n  wcsprintf(\"\\n\");\n  wcsprintf(\"       name: \\\"%s\\\"\\n\", prj->name);\n  wcsprintf(\"   category: %d (%s)\\n\", prj->category,\n                                      prj_categories[prj->category]);\n  wcsprintf(\"    pvrange: %d\\n\", prj->pvrange);\n  wcsprintf(\"  simplezen: %d\\n\", prj->simplezen);\n  wcsprintf(\"  equiareal: %d\\n\", prj->equiareal);\n  wcsprintf(\"  conformal: %d\\n\", prj->conformal);\n  wcsprintf(\"     global: %d\\n\", prj->global);\n  wcsprintf(\"  divergent: %d\\n\", prj->divergent);\n  wcsprintf(\"         x0: %f\\n\", prj->x0);\n  wcsprintf(\"         y0: %f\\n\", prj->y0);\n\n  WCSPRINTF_PTR(\"        err: \", prj->err, \"\\n\");\n  if (prj->err) {\n    wcserr_prt(prj->err, \"             \");\n  }\n\n  wcsprintf(\"        w[]:\");\n  for (i = 0; i < 5; i++) {\n    wcsprintf(\"  %#- 11.5g\", prj->w[i]);\n  }\n  wcsprintf(\"\\n            \");\n  for (i = 5; i < 10; i++) {\n    wcsprintf(\"  %#- 11.5g\", prj->w[i]);\n  }\n  wcsprintf(\"\\n\");\n  wcsprintf(\"          m: %d\\n\", prj->m);\n  wcsprintf(\"          n: %d\\n\", prj->n);\n  wcsprintf(\"     prjx2s: %s\\n\",\n    wcsutil_fptr2str((void (*)(void))prj->prjx2s, hext));\n  wcsprintf(\"     prjs2x: %s\\n\",\n    wcsutil_fptr2str((void (*)(void))prj->prjs2x, hext));\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint prjperr(const struct prjprm *prj, const char *prefix)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  if (prj->err) {\n    wcserr_prt(prj->err, prefix);\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint prjbchk(\n  double tol,\n  int nphi,\n  int ntheta,\n  int spt,\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int status = 0;\n  register int iphi, itheta, *statp;\n  register double *phip, *thetap;\n\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (itheta = 0; itheta < ntheta; itheta++) {\n    for (iphi = 0; iphi < nphi; iphi++, phip += spt, thetap += spt, statp++) {\n      // Skip values already marked as illegal.\n      if (*statp == 0) {\n        if (*phip < -180.0) {\n          if (*phip < -180.0-tol) {\n            *statp = 1;\n            status = 1;\n          } else {\n            *phip = -180.0;\n          }\n        } else if (180.0 < *phip) {\n          if (180.0+tol < *phip) {\n            *statp = 1;\n            status = 1;\n          } else {\n            *phip = 180.0;\n          }\n        }\n\n        if (*thetap < -90.0) {\n          if (*thetap < -90.0-tol) {\n            *statp = 1;\n            status = 1;\n          } else {\n            *thetap = -90.0;\n          }\n        } else if (90.0 < *thetap) {\n          if (90.0+tol < *thetap) {\n            *statp = 1;\n            status = 1;\n          } else {\n            *thetap = 90.0;\n          }\n        }\n      }\n    }\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint prjset(struct prjprm *prj)\n\n{\n  static const char *function = \"prjset\";\n\n  int status;\n  struct wcserr **err;\n\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  err = &(prj->err);\n\n  // Invoke the relevant initialization routine.\n  prj->code[3] = '\\0';\n  if (strcmp(prj->code, \"AZP\") == 0) {\n    status = azpset(prj);\n  } else if (strcmp(prj->code, \"SZP\") == 0) {\n    status = szpset(prj);\n  } else if (strcmp(prj->code, \"TAN\") == 0) {\n    status = tanset(prj);\n  } else if (strcmp(prj->code, \"STG\") == 0) {\n    status = stgset(prj);\n  } else if (strcmp(prj->code, \"SIN\") == 0) {\n    status = sinset(prj);\n  } else if (strcmp(prj->code, \"ARC\") == 0) {\n    status = arcset(prj);\n  } else if (strcmp(prj->code, \"ZPN\") == 0) {\n    status = zpnset(prj);\n  } else if (strcmp(prj->code, \"ZEA\") == 0) {\n    status = zeaset(prj);\n  } else if (strcmp(prj->code, \"AIR\") == 0) {\n    status = airset(prj);\n  } else if (strcmp(prj->code, \"CYP\") == 0) {\n    status = cypset(prj);\n  } else if (strcmp(prj->code, \"CEA\") == 0) {\n    status = ceaset(prj);\n  } else if (strcmp(prj->code, \"CAR\") == 0) {\n    status = carset(prj);\n  } else if (strcmp(prj->code, \"MER\") == 0) {\n    status = merset(prj);\n  } else if (strcmp(prj->code, \"SFL\") == 0) {\n    status = sflset(prj);\n  } else if (strcmp(prj->code, \"PAR\") == 0) {\n    status = parset(prj);\n  } else if (strcmp(prj->code, \"MOL\") == 0) {\n    status = molset(prj);\n  } else if (strcmp(prj->code, \"AIT\") == 0) {\n    status = aitset(prj);\n  } else if (strcmp(prj->code, \"COP\") == 0) {\n    status = copset(prj);\n  } else if (strcmp(prj->code, \"COE\") == 0) {\n    status = coeset(prj);\n  } else if (strcmp(prj->code, \"COD\") == 0) {\n    status = codset(prj);\n  } else if (strcmp(prj->code, \"COO\") == 0) {\n    status = cooset(prj);\n  } else if (strcmp(prj->code, \"BON\") == 0) {\n    status = bonset(prj);\n  } else if (strcmp(prj->code, \"PCO\") == 0) {\n    status = pcoset(prj);\n  } else if (strcmp(prj->code, \"TSC\") == 0) {\n    status = tscset(prj);\n  } else if (strcmp(prj->code, \"CSC\") == 0) {\n    status = cscset(prj);\n  } else if (strcmp(prj->code, \"QSC\") == 0) {\n    status = qscset(prj);\n  } else if (strcmp(prj->code, \"HPX\") == 0) {\n    status = hpxset(prj);\n  } else if (strcmp(prj->code, \"XPH\") == 0) {\n    status = xphset(prj);\n  } else {\n    // Unrecognized projection code.\n    status = wcserr_set(WCSERR_SET(PRJERR_BAD_PARAM),\n               \"Unrecognized projection code '%s'\", prj->code);\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint prjx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int status;\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag == 0) {\n    if ((status = prjset(prj))) return status;\n  }\n\n  return prj->prjx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat);\n}\n\n//----------------------------------------------------------------------------\n\nint prjs2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int status;\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag == 0) {\n    if ((status = prjset(prj))) return status;\n  }\n\n  return prj->prjs2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat);\n}\n\n/*============================================================================\n* Internal helper routine used by the *set() routines - not intended for\n* outside use.  It forces (x,y) = (0,0) at (phi0,theta0).\n*---------------------------------------------------------------------------*/\n\nint prjoff(\n  struct prjprm *prj,\n  const double phi0,\n  const double theta0)\n\n{\n  int    stat;\n  double x0, y0;\n\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->x0 = 0.0;\n  prj->y0 = 0.0;\n\n  if (undefined(prj->phi0) || undefined(prj->theta0)) {\n    // Set both to the projection-specific default if either undefined.\n    prj->phi0   = phi0;\n    prj->theta0 = theta0;\n\n  } else {\n    if (prj->prjs2x(prj, 1, 1, 1, 1, &(prj->phi0), &(prj->theta0), &x0, &y0,\n                    &stat)) {\n      return PRJERR_BAD_PARAM_SET(\"prjoff\");\n    }\n\n    prj->x0 = x0;\n    prj->y0 = y0;\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   AZP: zenithal/azimuthal perspective projection.\n*\n*   Given:\n*      prj->pv[1]   Distance parameter, mu in units of r0.\n*      prj->pv[2]   Tilt angle, gamma in degrees.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to  0.0 if undefined.\n*      prj->theta0  Reset to 90.0 if undefined.\n*\n*   Returned:\n*      prj->flag     AZP\n*      prj->code    \"AZP\"\n*      prj->x0      Offset in x.\n*      prj->y0      Offset in y.\n*      prj->w[0]    r0*(mu+1)\n*      prj->w[1]    tan(gamma)\n*      prj->w[2]    sec(gamma)\n*      prj->w[3]    cos(gamma)\n*      prj->w[4]    sin(gamma)\n*      prj->w[5]    asin(-1/mu) for |mu| >= 1, -90 otherwise\n*      prj->w[6]    mu*cos(gamma)\n*      prj->w[7]    1 if |mu*cos(gamma)| < 1, 0 otherwise\n*      prj->prjx2s  Pointer to azpx2s().\n*      prj->prjs2x  Pointer to azps2x().\n*===========================================================================*/\n\nint azpset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = AZP;\n  strcpy(prj->code, \"AZP\");\n\n  if (undefined(prj->pv[1])) prj->pv[1] = 0.0;\n  if (undefined(prj->pv[2])) prj->pv[2] = 0.0;\n  if (prj->r0 == 0.0) prj->r0 = R2D;\n\n  strcpy(prj->name, \"zenithal/azimuthal perspective\");\n  prj->category  = ZENITHAL;\n  prj->pvrange   = 102;\n  prj->simplezen = prj->pv[2] == 0.0;\n  prj->equiareal = 0;\n  prj->conformal = 0;\n  prj->global    = 0;\n  prj->divergent = prj->pv[1] <= 1.0;\n\n  prj->w[0] = prj->r0*(prj->pv[1] + 1.0);\n  if (prj->w[0] == 0.0) {\n    return PRJERR_BAD_PARAM_SET(\"azpset\");\n  }\n\n  prj->w[3] = cosd(prj->pv[2]);\n  if (prj->w[3] == 0.0) {\n    return PRJERR_BAD_PARAM_SET(\"azpset\");\n  }\n\n  prj->w[2] = 1.0/prj->w[3];\n  prj->w[4] = sind(prj->pv[2]);\n  prj->w[1] = prj->w[4] / prj->w[3];\n\n  if (fabs(prj->pv[1]) > 1.0) {\n    prj->w[5] = asind(-1.0/prj->pv[1]);\n  } else {\n    prj->w[5] = -90.0;\n  }\n\n  prj->w[6] = prj->pv[1] * prj->w[3];\n  prj->w[7] = (fabs(prj->w[6]) < 1.0) ? 1.0 : 0.0;\n\n  prj->prjx2s = azpx2s;\n  prj->prjs2x = azps2x;\n\n  return prjoff(prj, 0.0, 90.0);\n}\n\n//----------------------------------------------------------------------------\n\nint azpx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double a, b, q, r, s, t, xj, yj, yc, yc2;\n  const double tol = 1.0e-13;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != AZP) {\n    if ((status = azpset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xj = *xp + prj->x0;\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xj;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    yj = *yp + prj->y0;\n\n    yc  = yj*prj->w[3];\n    yc2 = yc*yc;\n\n    q = prj->w[0] + yj*prj->w[4];\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xj = *phip;\n\n      r = sqrt(xj*xj + yc2);\n      if (r == 0.0) {\n        *phip = 0.0;\n        *thetap = 90.0;\n        *(statp++) = 0;\n\n      } else {\n        *phip = atan2d(xj, -yc);\n\n        s = r / q;\n        t = s*prj->pv[1]/sqrt(s*s + 1.0);\n\n        s = atan2d(1.0, s);\n\n        if (fabs(t) > 1.0) {\n          if (fabs(t) > 1.0+tol) {\n            *thetap = 0.0;\n            *(statp++) = 1;\n            if (!status) status = PRJERR_BAD_PIX_SET(\"azpx2s\");\n            continue;\n          }\n          t = copysign(90.0, t);\n        } else {\n          t = asind(t);\n        }\n\n        a = s - t;\n        b = s + t + 180.0;\n\n        if (a > 90.0) a -= 360.0;\n        if (b > 90.0) b -= 360.0;\n\n        *thetap = (a > b) ? a : b;\n        *(statp++) = 0;\n      }\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"azpx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint azps2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double a, b, cosphi, costhe, r, s, sinphi, sinthe, t;\n  register int iphi, itheta, istat, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != AZP) {\n    if ((status = azpset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n  status = 0;\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    sincosd(*phip, &sinphi, &cosphi);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = sinphi;\n      *yp = cosphi;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    sincosd(*thetap, &sinthe, &costhe);\n\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      s = prj->w[1]*(*yp);\n      t = (prj->pv[1] + sinthe) + costhe*s;\n\n      if (t == 0.0) {\n        *xp = 0.0;\n        *yp = 0.0;\n        *(statp++) = 1;\n        if (!status) status = PRJERR_BAD_WORLD_SET(\"azps2x\");\n\n      } else {\n        r = prj->w[0]*costhe/t;\n\n        // Bounds checking.\n        istat = 0;\n        if (prj->bounds&1) {\n          if (*thetap < prj->w[5]) {\n            // Overlap.\n            istat = 1;\n            if (!status) status = PRJERR_BAD_WORLD_SET(\"azps2x\");\n\n          } else if (prj->w[7] > 0.0) {\n            // Divergence.\n            t = prj->pv[1] / sqrt(1.0 + s*s);\n\n            if (fabs(t) <= 1.0) {\n              s = atand(-s);\n              t = asind(t);\n              a = s - t;\n              b = s + t + 180.0;\n\n              if (a > 90.0) a -= 360.0;\n              if (b > 90.0) b -= 360.0;\n\n              if (*thetap < ((a > b) ? a : b)) {\n                istat = 1;\n                if (!status) status = PRJERR_BAD_WORLD_SET(\"azps2x\");\n              }\n            }\n          }\n        }\n\n        *xp =  r*(*xp) - prj->x0;\n        *yp = -r*(*yp)*prj->w[2] - prj->y0;\n        *(statp++) = istat;\n      }\n    }\n  }\n\n  return status;\n}\n\n/*============================================================================\n*   SZP: slant zenithal perspective projection.\n*\n*   Given:\n*      prj->pv[1]   Distance of the point of projection from the centre of the\n*                   generating sphere, mu in units of r0.\n*      prj->pv[2]   Native longitude, phi_c, and ...\n*      prj->pv[3]   Native latitude, theta_c, on the planewards side of the\n*                   intersection of the line through the point of projection\n*                   and the centre of the generating sphere, phi_c in degrees.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to  0.0 if undefined.\n*      prj->theta0  Reset to 90.0 if undefined.\n*\n*   Returned:\n*      prj->flag     SZP\n*      prj->code    \"SZP\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    1/r0\n*      prj->w[1]    xp = -mu*cos(theta_c)*sin(phi_c)\n*      prj->w[2]    yp =  mu*cos(theta_c)*cos(phi_c)\n*      prj->w[3]    zp =  mu*sin(theta_c) + 1\n*      prj->w[4]    r0*xp\n*      prj->w[5]    r0*yp\n*      prj->w[6]    r0*zp\n*      prj->w[7]    (zp - 1)^2\n*      prj->w[8]    asin(1-zp) if |1 - zp| < 1, -90 otherwise\n*      prj->prjx2s  Pointer to szpx2s().\n*      prj->prjs2x  Pointer to szps2x().\n*===========================================================================*/\n\nint szpset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = SZP;\n  strcpy(prj->code, \"SZP\");\n\n  if (undefined(prj->pv[1])) prj->pv[1] =  0.0;\n  if (undefined(prj->pv[2])) prj->pv[2] =  0.0;\n  if (undefined(prj->pv[3])) prj->pv[3] = 90.0;\n  if (prj->r0 == 0.0) prj->r0 = R2D;\n\n  strcpy(prj->name, \"slant zenithal perspective\");\n  prj->category  = ZENITHAL;\n  prj->pvrange   = 103;\n  prj->simplezen = prj->pv[3] == 90.0;\n  prj->equiareal = 0;\n  prj->conformal = 0;\n  prj->global    = 0;\n  prj->divergent = prj->pv[1] <= 1.0;\n\n  prj->w[0] = 1.0/prj->r0;\n\n  prj->w[3] = prj->pv[1] * sind(prj->pv[3]) + 1.0;\n  if (prj->w[3] == 0.0) {\n    return PRJERR_BAD_PARAM_SET(\"szpset\");\n  }\n\n  prj->w[1] = -prj->pv[1] * cosd(prj->pv[3]) * sind(prj->pv[2]);\n  prj->w[2] =  prj->pv[1] * cosd(prj->pv[3]) * cosd(prj->pv[2]);\n  prj->w[4] =  prj->r0 * prj->w[1];\n  prj->w[5] =  prj->r0 * prj->w[2];\n  prj->w[6] =  prj->r0 * prj->w[3];\n  prj->w[7] =  (prj->w[3] - 1.0) * prj->w[3] - 1.0;\n\n  if (fabs(prj->w[3] - 1.0) < 1.0) {\n    prj->w[8] = asind(1.0 - prj->w[3]);\n  } else {\n    prj->w[8] = -90.0;\n  }\n\n  prj->prjx2s = szpx2s;\n  prj->prjs2x = szps2x;\n\n  return prjoff(prj, 0.0, 90.0);\n}\n\n//----------------------------------------------------------------------------\n\nint szpx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double a, b, c, d, r2, sinth1, sinth2, sinthe, t, x1, xr, xy, y1, yr, z;\n  const double tol = 1.0e-13;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != SZP) {\n    if ((status = szpset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xr = (*xp + prj->x0)*prj->w[0];\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xr;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    yr = (*yp + prj->y0)*prj->w[0];\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xr = *phip;\n      r2 = xr*xr + yr*yr;\n\n      x1 = (xr - prj->w[1])/prj->w[3];\n      y1 = (yr - prj->w[2])/prj->w[3];\n      xy = xr*x1 + yr*y1;\n\n      if (r2 < 1.0e-10) {\n        // Use small angle formula.\n        z = r2/2.0;\n        *thetap = 90.0 - R2D*sqrt(r2/(1.0 + xy));\n\n      } else {\n        t = x1*x1 + y1*y1;\n        a = t + 1.0;\n        b = xy - t;\n        c = r2 - xy - xy + t - 1.0;\n        d = b*b - a*c;\n\n        // Check for a solution.\n        if (d < 0.0) {\n          *phip = 0.0;\n          *thetap = 0.0;\n          *(statp++) = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"szpx2s\");\n          continue;\n        }\n        d = sqrt(d);\n\n        // Choose solution closest to pole.\n        sinth1 = (-b + d)/a;\n        sinth2 = (-b - d)/a;\n        sinthe = (sinth1 > sinth2) ? sinth1 : sinth2;\n        if (sinthe > 1.0) {\n          if (sinthe-1.0 < tol) {\n            sinthe = 1.0;\n          } else {\n            sinthe = (sinth1 < sinth2) ? sinth1 : sinth2;\n          }\n        }\n\n        if (sinthe < -1.0) {\n          if (sinthe+1.0 > -tol) {\n            sinthe = -1.0;\n          }\n        }\n\n        if (sinthe > 1.0 || sinthe < -1.0) {\n          *phip   = 0.0;\n          *thetap = 0.0;\n          *(statp++) = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"szpx2s\");\n          continue;\n        }\n\n        *thetap = asind(sinthe);\n\n        z = 1.0 - sinthe;\n      }\n\n      *phip = atan2d(xr - x1*z, -(yr - y1*z));\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"szpx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint szps2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double a, b, cosphi, r, s, sinphi, t, u, v;\n  register int iphi, itheta, istat, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != SZP) {\n    if ((status = szpset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n  status = 0;\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    sincosd(*phip, &sinphi, &cosphi);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = sinphi;\n      *yp = cosphi;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    s = 1.0 - sind(*thetap);\n    t = prj->w[3] - s;\n\n    if (t == 0.0) {\n      for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n        *xp = 0.0;\n        *yp = 0.0;\n        *(statp++) = 1;\n      }\n\n      if (!status) status = PRJERR_BAD_WORLD_SET(\"szps2x\");\n\n    } else {\n      r = prj->w[6]*cosd(*thetap)/t;\n      u = prj->w[4]*s/t + prj->x0;\n      v = prj->w[5]*s/t + prj->y0;\n\n      for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n        // Bounds checking.\n        istat = 0;\n        if (prj->bounds&1) {\n          if (*thetap < prj->w[8]) {\n            // Divergence.\n            istat = 1;\n            if (!status) status = PRJERR_BAD_WORLD_SET(\"szps2x\");\n\n          } else if (fabs(prj->pv[1]) > 1.0) {\n            // Overlap.\n            s = prj->w[1]*(*xp) - prj->w[2]*(*yp);\n            t = 1.0/sqrt(prj->w[7] + s*s);\n\n            if (fabs(t) <= 1.0) {\n              s = atan2d(s, prj->w[3] - 1.0);\n              t = asind(t);\n              a = s - t;\n              b = s + t + 180.0;\n\n              if (a > 90.0) a -= 360.0;\n              if (b > 90.0) b -= 360.0;\n\n              if (*thetap < ((a > b) ? a : b)) {\n                istat = 1;\n                if (!status) status = PRJERR_BAD_WORLD_SET(\"szps2x\");\n              }\n            }\n          }\n        }\n\n        *xp =  r*(*xp) - u;\n        *yp = -r*(*yp) - v;\n        *(statp++) = istat;\n      }\n    }\n  }\n\n  return status;\n}\n\n\n/*============================================================================\n*   TAN: gnomonic projection.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to  0.0 if undefined.\n*      prj->theta0  Reset to 90.0 if undefined.\n*\n*   Returned:\n*      prj->flag     TAN\n*      prj->code    \"TAN\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->prjx2s  Pointer to tanx2s().\n*      prj->prjs2x  Pointer to tans2x().\n*===========================================================================*/\n\nint tanset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = TAN;\n  strcpy(prj->code, \"TAN\");\n\n  if (prj->r0 == 0.0) prj->r0 = R2D;\n\n  strcpy(prj->name, \"gnomonic\");\n  prj->category  = ZENITHAL;\n  prj->pvrange   = 0;\n  prj->simplezen = 1;\n  prj->equiareal = 0;\n  prj->conformal = 0;\n  prj->global    = 0;\n  prj->divergent = 1;\n\n  prj->prjx2s = tanx2s;\n  prj->prjs2x = tans2x;\n\n  return prjoff(prj, 0.0, 90.0);\n}\n\n//----------------------------------------------------------------------------\n\nint tanx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double r, xj, yj, yj2;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != TAN) {\n    if ((status = tanset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xj = *xp + prj->x0;\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xj;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    yj  = *yp + prj->y0;\n    yj2 = yj*yj;\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xj = *phip;\n\n      r = sqrt(xj*xj + yj2);\n      if (r == 0.0) {\n        *phip = 0.0;\n      } else {\n        *phip = atan2d(xj, -yj);\n      }\n\n      *thetap = atan2d(prj->r0, r);\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"tanx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint tans2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double cosphi, r, s, sinphi;\n  register int iphi, itheta, istat, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != TAN) {\n    if ((status = tanset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n  status = 0;\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    sincosd(*phip, &sinphi, &cosphi);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = sinphi;\n      *yp = cosphi;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    s = sind(*thetap);\n    if (s == 0.0) {\n      for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n        *xp = 0.0;\n        *yp = 0.0;\n        *(statp++) = 1;\n      }\n      if (!status) status = PRJERR_BAD_WORLD_SET(\"tans2x\");\n\n    } else {\n      r =  prj->r0*cosd(*thetap)/s;\n\n      // Bounds checking.\n      istat = 0;\n      if (prj->bounds&1) {\n        if (s < 0.0) {\n          istat = 1;\n          if (!status) status = PRJERR_BAD_WORLD_SET(\"tans2x\");\n        }\n      }\n\n      for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n        *xp =  r*(*xp) - prj->x0;\n        *yp = -r*(*yp) - prj->y0;\n        *(statp++) = istat;\n      }\n    }\n  }\n\n  return status;\n}\n\n/*============================================================================\n*   STG: stereographic projection.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to  0.0 if undefined.\n*      prj->theta0  Reset to 90.0 if undefined.\n*\n*   Returned:\n*      prj->flag     STG\n*      prj->code    \"STG\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    2*r0\n*      prj->w[1]    1/(2*r0)\n*      prj->prjx2s  Pointer to stgx2s().\n*      prj->prjs2x  Pointer to stgs2x().\n*===========================================================================*/\n\nint stgset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = STG;\n  strcpy(prj->code, \"STG\");\n\n  strcpy(prj->name, \"stereographic\");\n  prj->category  = ZENITHAL;\n  prj->pvrange   = 0;\n  prj->simplezen = 1;\n  prj->equiareal = 0;\n  prj->conformal = 1;\n  prj->global    = 0;\n  prj->divergent = 1;\n\n  if (prj->r0 == 0.0) {\n    prj->r0 = R2D;\n    prj->w[0] = 360.0/PI;\n    prj->w[1] = PI/360.0;\n  } else {\n    prj->w[0] = 2.0*prj->r0;\n    prj->w[1] = 1.0/prj->w[0];\n  }\n\n  prj->prjx2s = stgx2s;\n  prj->prjs2x = stgs2x;\n\n  return prjoff(prj, 0.0, 90.0);\n}\n\n//----------------------------------------------------------------------------\n\nint stgx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double r, xj, yj, yj2;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != STG) {\n    if ((status = stgset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xj = *xp + prj->x0;\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xj;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    yj  = *yp + prj->y0;\n    yj2 = yj*yj;\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xj  = *phip;\n\n      r = sqrt(xj*xj + yj2);\n      if (r == 0.0) {\n        *phip = 0.0;\n      } else {\n        *phip = atan2d(xj, -yj);\n      }\n\n      *thetap = 90.0 - 2.0*atand(r*prj->w[1]);\n      *(statp++) = 0;\n    }\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint stgs2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double cosphi, r, s, sinphi;\n  register int iphi, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != STG) {\n    if ((status = stgset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n  status = 0;\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    sincosd(*phip, &sinphi, &cosphi);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = sinphi;\n      *yp = cosphi;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    s = 1.0 + sind(*thetap);\n    if (s == 0.0) {\n      for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n        *xp = 0.0;\n        *yp = 0.0;\n        *(statp++) = 1;\n      }\n      if (!status) status = PRJERR_BAD_WORLD_SET(\"stgs2x\");\n\n    } else {\n      r = prj->w[0]*cosd(*thetap)/s;\n\n      for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n        *xp =  r*(*xp) - prj->x0;\n        *yp = -r*(*yp) - prj->y0;\n        *(statp++) = 0;\n      }\n    }\n  }\n\n  return status;\n}\n\n/*============================================================================\n*   SIN: orthographic/synthesis projection.\n*\n*   Given:\n*      prj->pv[1:2] Obliqueness parameters, xi and eta.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to  0.0 if undefined.\n*      prj->theta0  Reset to 90.0 if undefined.\n*\n*   Returned:\n*      prj->flag     SIN\n*      prj->code    \"SIN\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    1/r0\n*      prj->w[1]    xi**2 + eta**2\n*      prj->w[2]    xi**2 + eta**2 + 1\n*      prj->w[3]    xi**2 + eta**2 - 1\n*      prj->prjx2s  Pointer to sinx2s().\n*      prj->prjs2x  Pointer to sins2x().\n*===========================================================================*/\n\nint sinset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = SIN;\n  strcpy(prj->code, \"SIN\");\n\n  if (undefined(prj->pv[1])) prj->pv[1] = 0.0;\n  if (undefined(prj->pv[2])) prj->pv[2] = 0.0;\n  if (prj->r0 == 0.0) prj->r0 = R2D;\n\n  strcpy(prj->name, \"orthographic/synthesis\");\n  prj->category  = ZENITHAL;\n  prj->pvrange   = 102;\n  prj->simplezen = (prj->pv[1] == 0.0 && prj->pv[2] == 0.0);\n  prj->equiareal = 0;\n  prj->conformal = 0;\n  prj->global    = 0;\n  prj->divergent = 0;\n\n  prj->w[0] = 1.0/prj->r0;\n  prj->w[1] = prj->pv[1]*prj->pv[1] + prj->pv[2]*prj->pv[2];\n  prj->w[2] = prj->w[1] + 1.0;\n  prj->w[3] = prj->w[1] - 1.0;\n\n  prj->prjx2s = sinx2s;\n  prj->prjs2x = sins2x;\n\n  return prjoff(prj, 0.0, 90.0);\n}\n\n//----------------------------------------------------------------------------\n\nint sinx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  const double tol = 1.0e-13;\n  double a, b, c, d, eta, r2, sinth1, sinth2, sinthe, x0, xi, x1, xy, y0, y02,\n         y1, z;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != SIN) {\n    if ((status = sinset(prj))) return status;\n  }\n\n  xi  = prj->pv[1];\n  eta = prj->pv[2];\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    x0 = (*xp + prj->x0)*prj->w[0];\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = x0;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    y0 = (*yp + prj->y0)*prj->w[0];\n    y02 = y0*y0;\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      // Compute intermediaries.\n      x0 = *phip;\n      r2 = x0*x0 + y02;\n\n      if (prj->w[1] == 0.0) {\n        // Orthographic projection.\n        if (r2 != 0.0) {\n          *phip = atan2d(x0, -y0);\n        } else {\n          *phip = 0.0;\n        }\n\n        if (r2 < 0.5) {\n          *thetap = acosd(sqrt(r2));\n        } else if (r2 <= 1.0) {\n          *thetap = asind(sqrt(1.0 - r2));\n        } else {\n          *(statp++) = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"sinx2s\")\n          continue;\n        }\n\n      } else {\n        // \"Synthesis\" projection.\n        xy = x0*xi + y0*eta;\n\n        if (r2 < 1.0e-10) {\n          // Use small angle formula.\n          z = r2/2.0;\n          *thetap = 90.0 - R2D*sqrt(r2/(1.0 + xy));\n\n        } else {\n          a = prj->w[2];\n          b = xy - prj->w[1];\n          c = r2 - xy - xy + prj->w[3];\n          d = b*b - a*c;\n\n          // Check for a solution.\n          if (d < 0.0) {\n            *phip = 0.0;\n            *thetap = 0.0;\n            *(statp++) = 1;\n            if (!status) status = PRJERR_BAD_PIX_SET(\"sinx2s\")\n            continue;\n          }\n          d = sqrt(d);\n\n          // Choose solution closest to pole.\n          sinth1 = (-b + d)/a;\n          sinth2 = (-b - d)/a;\n          sinthe = (sinth1 > sinth2) ? sinth1 : sinth2;\n          if (sinthe > 1.0) {\n            if (sinthe-1.0 < tol) {\n              sinthe = 1.0;\n            } else {\n              sinthe = (sinth1 < sinth2) ? sinth1 : sinth2;\n            }\n          }\n\n          if (sinthe < -1.0) {\n            if (sinthe+1.0 > -tol) {\n              sinthe = -1.0;\n            }\n          }\n\n          if (sinthe > 1.0 || sinthe < -1.0) {\n            *phip = 0.0;\n            *thetap = 0.0;\n            *(statp++) = 1;\n            if (!status) status = PRJERR_BAD_PIX_SET(\"sinx2s\")\n            continue;\n          }\n\n          *thetap = asind(sinthe);\n          z = 1.0 - sinthe;\n        }\n\n        x1 = -y0 + eta*z;\n        y1 =  x0 -  xi*z;\n        if (x1 == 0.0 && y1 == 0.0) {\n          *phip = 0.0;\n        } else {\n          *phip = atan2d(y1,x1);\n        }\n      }\n\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"sinx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint sins2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double cosphi, costhe, sinphi, r, t, z, z1, z2;\n  register int iphi, itheta, istat, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != SIN) {\n    if ((status = sinset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n  status = 0;\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    sincosd(*phip, &sinphi, &cosphi);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = sinphi;\n      *yp = cosphi;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    t = (90.0 - fabs(*thetap))*D2R;\n    if (t < 1.0e-5) {\n      if (*thetap > 0.0) {\n         z = t*t/2.0;\n      } else {\n         z = 2.0 - t*t/2.0;\n      }\n      costhe = t;\n    } else {\n      z = 1.0 - sind(*thetap);\n      costhe = cosd(*thetap);\n    }\n    r = prj->r0*costhe;\n\n    if (prj->w[1] == 0.0) {\n      // Orthographic projection.\n      istat = 0;\n      if (prj->bounds&1) {\n        if (*thetap < 0.0) {\n          istat = 1;\n          if (!status) status = PRJERR_BAD_WORLD_SET(\"sins2x\");\n        }\n      }\n\n      for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n        *xp =  r*(*xp) - prj->x0;\n        *yp = -r*(*yp) - prj->y0;\n        *(statp++) = istat;\n      }\n\n    } else {\n      // \"Synthesis\" projection.\n      z *= prj->r0;\n      z1 = prj->pv[1]*z - prj->x0;\n      z2 = prj->pv[2]*z - prj->y0;\n\n      for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n        istat = 0;\n        if (prj->bounds&1) {\n          t = -atand(prj->pv[1]*(*xp) - prj->pv[2]*(*yp));\n          if (*thetap < t) {\n            istat = 1;\n            if (!status) status = PRJERR_BAD_WORLD_SET(\"sins2x\");\n          }\n        }\n\n        *xp =  r*(*xp) + z1;\n        *yp = -r*(*yp) + z2;\n        *(statp++) = istat;\n      }\n    }\n  }\n\n  return status;\n}\n\n/*============================================================================\n*   ARC: zenithal/azimuthal equidistant projection.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to  0.0 if undefined.\n*      prj->theta0  Reset to 90.0 if undefined.\n*\n*   Returned:\n*      prj->flag     ARC\n*      prj->code    \"ARC\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    r0*(pi/180)\n*      prj->w[1]    (180/pi)/r0\n*      prj->prjx2s  Pointer to arcx2s().\n*      prj->prjs2x  Pointer to arcs2x().\n*===========================================================================*/\n\nint arcset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = ARC;\n  strcpy(prj->code, \"ARC\");\n\n  strcpy(prj->name, \"zenithal/azimuthal equidistant\");\n  prj->category  = ZENITHAL;\n  prj->pvrange   = 0;\n  prj->simplezen = 1;\n  prj->equiareal = 0;\n  prj->conformal = 0;\n  prj->global    = 1;\n  prj->divergent = 0;\n\n  if (prj->r0 == 0.0) {\n    prj->r0 = R2D;\n    prj->w[0] = 1.0;\n    prj->w[1] = 1.0;\n  } else {\n    prj->w[0] = prj->r0*D2R;\n    prj->w[1] = 1.0/prj->w[0];\n  }\n\n  prj->prjx2s = arcx2s;\n  prj->prjs2x = arcs2x;\n\n  return prjoff(prj, 0.0, 90.0);\n}\n\n//----------------------------------------------------------------------------\n\nint arcx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double r, xj, yj, yj2;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != ARC) {\n    if ((status = arcset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xj = *xp + prj->x0;\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xj;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    yj  = *yp + prj->y0;\n    yj2 = yj*yj;\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xj = *phip;\n\n      r = sqrt(xj*xj + yj2);\n      if (r == 0.0) {\n        *phip = 0.0;\n        *thetap = 90.0;\n      } else {\n        *phip = atan2d(xj, -yj);\n        *thetap = 90.0 - r*prj->w[1];\n      }\n\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"arcx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint arcs2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double cosphi, r, sinphi;\n  register int iphi, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != ARC) {\n    if ((status = arcset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    sincosd(*phip, &sinphi, &cosphi);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = sinphi;\n      *yp = cosphi;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    r =  prj->w[0]*(90.0 - *thetap);\n\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      *xp =  r*(*xp) - prj->x0;\n      *yp = -r*(*yp) - prj->y0;\n      *(statp++) = 0;\n    }\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   ZPN: zenithal/azimuthal polynomial projection.\n*\n*   Given:\n*      prj->pv[]    Polynomial coefficients.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to  0.0 if undefined.\n*      prj->theta0  Reset to 90.0 if undefined.\n*\n*   Returned:\n*      prj->flag     ZPN\n*      prj->code    \"ZPN\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->n       Degree of the polynomial, N.\n*      prj->w[0]    Co-latitude of the first point of inflection, radian.\n*      prj->w[1]    Radius of the first point of inflection (N > 1), radian.\n*      prj->prjx2s  Pointer to zpnx2s().\n*      prj->prjs2x  Pointer to zpns2x().\n*===========================================================================*/\n\nint zpnset(struct prjprm *prj)\n\n{\n  int j, k, m;\n  double d, d1, d2, r, zd, zd1, zd2;\n  const double tol = 1.0e-13;\n\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  strcpy(prj->code, \"ZPN\");\n  prj->flag = ZPN;\n\n  if (undefined(prj->pv[1])) prj->pv[1] = 0.0;\n  if (undefined(prj->pv[2])) prj->pv[2] = 0.0;\n  if (undefined(prj->pv[3])) prj->pv[3] = 0.0;\n  if (prj->r0 == 0.0) prj->r0 = R2D;\n\n  strcpy(prj->name, \"zenithal/azimuthal polynomial\");\n  prj->category  = ZENITHAL;\n  prj->pvrange   = 30;\n  prj->simplezen = 1;\n  prj->equiareal = 0;\n  prj->conformal = 0;\n  prj->global    = 0;\n  prj->divergent = 0;\n\n  // Find the highest non-zero coefficient.\n  for (k = PVN-1; k >= 0 && prj->pv[k] == 0.0; k--);\n  if (k < 0) {\n    return PRJERR_BAD_PARAM_SET(\"zpnset\");\n  }\n\n  prj->n = k;\n\n  if (k < 2) {\n    // No point of inflection.\n    prj->w[0] = PI;\n\n  } else {\n    // Find the point of inflection closest to the pole.\n    zd1 = 0.0;\n    d1  = prj->pv[1];\n    if (d1 <= 0.0) {\n      return PRJERR_BAD_PARAM_SET(\"zpnset\");\n    }\n\n    // Find the point where the derivative first goes negative.\n    for (j = 0; j < 180; j++) {\n      zd2 = j*D2R;\n      d2  = 0.0;\n      for (m = k; m > 0; m--) {\n        d2 = d2*zd2 + m*prj->pv[m];\n      }\n\n      if (d2 <= 0.0) break;\n      zd1 = zd2;\n      d1  = d2;\n    }\n\n    if (j == 180) {\n      // No negative derivative -> no point of inflection.\n      zd = PI;\n      prj->global = 1;\n    } else {\n      // Find where the derivative is zero.\n      for (j = 1; j <= 10; j++) {\n        zd = zd1 - d1*(zd2-zd1)/(d2-d1);\n\n        d = 0.0;\n        for (m = k; m > 0; m--) {\n          d = d*zd + m*prj->pv[m];\n        }\n\n        if (fabs(d) < tol) break;\n\n        if (d < 0.0) {\n          zd2 = zd;\n          d2  = d;\n        } else {\n          zd1 = zd;\n          d1  = d;\n        }\n      }\n    }\n\n    r = 0.0;\n    for (m = k; m >= 0; m--) {\n      r = r*zd + prj->pv[m];\n    }\n    prj->w[0] = zd;\n    prj->w[1] = r;\n  }\n\n  prj->prjx2s = zpnx2s;\n  prj->prjs2x = zpns2x;\n\n  return prjoff(prj, 0.0, 90.0);\n}\n\n//----------------------------------------------------------------------------\n\nint zpnx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int j, k, m, mx, my, rowlen, rowoff, status;\n  double a, b, c, d, lambda, r, r1, r2, rt, xj, yj, yj2, zd, zd1, zd2;\n  const double tol = 1.0e-13;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != ZPN) {\n    if ((status = zpnset(prj))) return status;\n  }\n\n  k = prj->n;\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xj = *xp + prj->x0;\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xj;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    yj  = *yp + prj->y0;\n    yj2 = yj*yj;\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xj = *phip;\n\n      r = sqrt(xj*xj + yj2)/prj->r0;\n      if (r == 0.0) {\n        *phip = 0.0;\n      } else {\n        *phip = atan2d(xj, -yj);\n      }\n\n      if (k < 1) {\n        // Constant - no solution.\n        return PRJERR_BAD_PARAM_SET(\"zpnx2s\");\n\n      } else if (k == 1) {\n        // Linear.\n        zd = (r - prj->pv[0])/prj->pv[1];\n\n      } else if (k == 2) {\n        // Quadratic.\n        a = prj->pv[2];\n        b = prj->pv[1];\n        c = prj->pv[0] - r;\n\n        d = b*b - 4.0*a*c;\n        if (d < 0.0) {\n          *thetap = 0.0;\n          *(statp++) = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"zpnx2s\");\n          continue;\n        }\n        d = sqrt(d);\n\n        // Choose solution closest to pole.\n        zd1 = (-b + d)/(2.0*a);\n        zd2 = (-b - d)/(2.0*a);\n        zd  = (zd1<zd2) ? zd1 : zd2;\n        if (zd < -tol) zd = (zd1>zd2) ? zd1 : zd2;\n        if (zd < 0.0) {\n          if (zd < -tol) {\n            *thetap = 0.0;\n            *(statp++) = 1;\n            if (!status) status = PRJERR_BAD_PIX_SET(\"zpnx2s\");\n            continue;\n          }\n          zd = 0.0;\n        } else if (zd > PI) {\n          if (zd > PI+tol) {\n            *thetap = 0.0;\n            *(statp++) = 1;\n            if (!status) status = PRJERR_BAD_PIX_SET(\"zpnx2s\");\n            continue;\n          }\n          zd = PI;\n        }\n      } else {\n        // Higher order - solve iteratively.\n        zd1 = 0.0;\n        r1  = prj->pv[0];\n        zd2 = prj->w[0];\n        r2  = prj->w[1];\n\n        if (r < r1) {\n          if (r < r1-tol) {\n            *thetap = 0.0;\n            *(statp++) = 1;\n            if (!status) status = PRJERR_BAD_PIX_SET(\"zpnx2s\");\n            continue;\n          }\n          zd = zd1;\n        } else if (r > r2) {\n          if (r > r2+tol) {\n            *thetap = 0.0;\n            *(statp++) = 1;\n            if (!status) status = PRJERR_BAD_PIX_SET(\"zpnx2s\");\n            continue;\n          }\n          zd = zd2;\n        } else {\n          // Dissect the interval.\n          for (j = 0; j < 100; j++) {\n            lambda = (r2 - r)/(r2 - r1);\n            if (lambda < 0.1) {\n              lambda = 0.1;\n            } else if (lambda > 0.9) {\n              lambda = 0.9;\n            }\n\n            zd = zd2 - lambda*(zd2 - zd1);\n\n            rt = 0.0;\n            for (m = k; m >= 0; m--) {\n              rt = (rt * zd) + prj->pv[m];\n            }\n\n            if (rt < r) {\n              if (r-rt < tol) break;\n              r1 = rt;\n              zd1 = zd;\n            } else {\n              if (rt-r < tol) break;\n              r2 = rt;\n              zd2 = zd;\n            }\n\n            if (fabs(zd2-zd1) < tol) break;\n          }\n        }\n      }\n\n      *thetap = 90.0 - zd*R2D;\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"zpnx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint zpns2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int m, mphi, mtheta, rowlen, rowoff, status;\n  double cosphi, r, s, sinphi;\n  register int iphi, itheta, istat, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != ZPN) {\n    if ((status = zpnset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n  status = 0;\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    sincosd(*phip, &sinphi, &cosphi);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = sinphi;\n      *yp = cosphi;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    s = (90.0 - *thetap)*D2R;\n\n    r = 0.0;\n    for (m = prj->n; m >= 0; m--) {\n      r = r*s + prj->pv[m];\n    }\n    r *= prj->r0;\n\n    // Bounds checking.\n    istat = 0;\n    if (prj->bounds&1) {\n      if (s > prj->w[0]) {\n        istat = 1;\n        if (!status) status = PRJERR_BAD_WORLD_SET(\"zpns2x\");\n      }\n    }\n\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      *xp =  r*(*xp) - prj->x0;\n      *yp = -r*(*yp) - prj->y0;\n      *(statp++) = istat;\n    }\n  }\n\n  return status;\n}\n\n/*============================================================================\n*   ZEA: zenithal/azimuthal equal area projection.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to  0.0 if undefined.\n*      prj->theta0  Reset to 90.0 if undefined.\n*\n*   Returned:\n*      prj->flag     ZEA\n*      prj->code    \"ZEA\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    2*r0\n*      prj->w[1]    1/(2*r0)\n*      prj->prjx2s  Pointer to zeax2s().\n*      prj->prjs2x  Pointer to zeas2x().\n*===========================================================================*/\n\nint zeaset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = ZEA;\n  strcpy(prj->code, \"ZEA\");\n\n  strcpy(prj->name, \"zenithal/azimuthal equal area\");\n  prj->category  = ZENITHAL;\n  prj->pvrange   = 0;\n  prj->simplezen = 1;\n  prj->equiareal = 1;\n  prj->conformal = 0;\n  prj->global    = 1;\n  prj->divergent = 0;\n\n  if (prj->r0 == 0.0) {\n    prj->r0 = R2D;\n    prj->w[0] = 360.0/PI;\n    prj->w[1] = PI/360.0;\n  } else {\n    prj->w[0] = 2.0*prj->r0;\n    prj->w[1] = 1.0/prj->w[0];\n  }\n\n  prj->prjx2s = zeax2s;\n  prj->prjs2x = zeas2x;\n\n  return prjoff(prj, 0.0, 90.0);\n}\n\n//----------------------------------------------------------------------------\n\nint zeax2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double r, s, xj, yj, yj2;\n  const double tol = 1.0e-12;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != ZEA) {\n    if ((status = zeaset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xj = *xp + prj->x0;\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xj;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    yj  = *yp + prj->y0;\n    yj2 = yj*yj;\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xj  = *phip;\n\n      r = sqrt(xj*xj + yj2);\n      if (r == 0.0) {\n        *phip = 0.0;\n      } else {\n        *phip = atan2d(xj, -yj);\n      }\n\n      s = r*prj->w[1];\n      if (fabs(s) > 1.0) {\n        if (fabs(r - prj->w[0]) < tol) {\n          *thetap = -90.0;\n        } else {\n          *thetap = 0.0;\n          *(statp++) = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"zeax2s\");\n          continue;\n        }\n      } else {\n        *thetap = 90.0 - 2.0*asind(s);\n      }\n\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"zeax2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint zeas2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double cosphi, r, sinphi;\n  register int iphi, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != ZEA) {\n    if ((status = zeaset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    sincosd(*phip, &sinphi, &cosphi);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = sinphi;\n      *yp = cosphi;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    r =  prj->w[0]*sind((90.0 - *thetap)/2.0);\n\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      *xp =  r*(*xp) - prj->x0;\n      *yp = -r*(*yp) - prj->y0;\n      *(statp++) = 0;\n    }\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   AIR: Airy's projection.\n*\n*   Given:\n*      prj->pv[1]   Latitude theta_b within which the error is minimized, in\n*                   degrees.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to  0.0 if undefined.\n*      prj->theta0  Reset to 90.0 if undefined.\n*\n*   Returned:\n*      prj->flag     AIR\n*      prj->code    \"AIR\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    2*r0\n*      prj->w[1]    ln(cos(xi_b))/tan(xi_b)**2, where xi_b = (90-theta_b)/2\n*      prj->w[2]    1/2 - prj->w[1]\n*      prj->w[3]    2*r0*prj->w[2]\n*      prj->w[4]    tol, cutoff for using small angle approximation, in\n*                   radians.\n*      prj->w[5]    prj->w[2]*tol\n*      prj->w[6]    (180/pi)/prj->w[2]\n*      prj->prjx2s  Pointer to airx2s().\n*      prj->prjs2x  Pointer to airs2x().\n*===========================================================================*/\n\nint airset(struct prjprm *prj)\n\n{\n  const double tol = 1.0e-4;\n  double cosxi;\n\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = AIR;\n  strcpy(prj->code, \"AIR\");\n\n  if (undefined(prj->pv[1])) prj->pv[1] = 90.0;\n  if (prj->r0 == 0.0) prj->r0 = R2D;\n\n  strcpy(prj->name, \"Airy's zenithal\");\n  prj->category  = ZENITHAL;\n  prj->pvrange   = 101;\n  prj->simplezen = 1;\n  prj->equiareal = 0;\n  prj->conformal = 0;\n  prj->global    = 0;\n  prj->divergent = 1;\n\n  prj->w[0] = 2.0*prj->r0;\n  if (prj->pv[1] == 90.0) {\n    prj->w[1] = -0.5;\n    prj->w[2] =  1.0;\n  } else if (prj->pv[1] > -90.0) {\n    cosxi = cosd((90.0 - prj->pv[1])/2.0);\n    prj->w[1] = log(cosxi)*(cosxi*cosxi)/(1.0-cosxi*cosxi);\n    prj->w[2] = 0.5 - prj->w[1];\n  } else {\n    return PRJERR_BAD_PARAM_SET(\"airset\");\n  }\n\n  prj->w[3] = prj->w[0] * prj->w[2];\n  prj->w[4] = tol;\n  prj->w[5] = prj->w[2]*tol;\n  prj->w[6] = R2D/prj->w[2];\n\n  prj->prjx2s = airx2s;\n  prj->prjs2x = airs2x;\n\n  return prjoff(prj, 0.0, 90.0);\n}\n\n//----------------------------------------------------------------------------\n\nint airx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int k, mx, my, rowlen, rowoff, status;\n  double cosxi, lambda, r, r1, r2, rt, tanxi, x1, x2, xi, xj, yj, yj2;\n  const double tol = 1.0e-12;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != AIR) {\n    if ((status = airset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xj = *xp + prj->x0;\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xj;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    yj  = *yp + prj->y0;\n    yj2 = yj*yj;\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xj = *phip;\n\n      r = sqrt(xj*xj + yj2)/prj->w[0];\n      if (r == 0.0) {\n        *phip = 0.0;\n      } else {\n        *phip = atan2d(xj, -yj);\n      }\n\n\n      if (r == 0.0) {\n        xi = 0.0;\n      } else if (r < prj->w[5]) {\n        xi = r*prj->w[6];\n      } else {\n        // Find a solution interval.\n        x1 = x2 = 1.0;\n        r1 = r2 = 0.0;\n        for (k = 0; k < 30; k++) {\n          x2 = x1/2.0;\n          tanxi = sqrt(1.0-x2*x2)/x2;\n          r2 = -(log(x2)/tanxi + prj->w[1]*tanxi);\n\n          if (r2 >= r) break;\n          x1 = x2;\n          r1 = r2;\n        }\n        if (k == 30) {\n          *thetap = 0.0;\n          *(statp++) = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"airx2s\");\n          continue;\n        }\n\n        for (k = 0; k < 100; k++) {\n          // Weighted division of the interval.\n          lambda = (r2-r)/(r2-r1);\n          if (lambda < 0.1) {\n            lambda = 0.1;\n          } else if (lambda > 0.9) {\n            lambda = 0.9;\n          }\n          cosxi = x2 - lambda*(x2-x1);\n\n          tanxi = sqrt(1.0-cosxi*cosxi)/cosxi;\n          rt = -(log(cosxi)/tanxi + prj->w[1]*tanxi);\n\n          if (rt < r) {\n            if (r-rt < tol) break;\n            r1 = rt;\n            x1 = cosxi;\n          } else {\n            if (rt-r < tol) break;\n            r2 = rt;\n            x2 = cosxi;\n          }\n        }\n        if (k == 100) {\n          *thetap = 0.0;\n          *(statp++) = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"airx2s\");\n          continue;\n        }\n\n        xi = acosd(cosxi);\n      }\n\n      *thetap = 90.0 - 2.0*xi;\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"airx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint airs2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double cosphi, cosxi, r, tanxi, xi, sinphi;\n  register int iphi, itheta, istat, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != AIR) {\n    if ((status = airset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n  status = 0;\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    sincosd(*phip, &sinphi, &cosphi);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = sinphi;\n      *yp = cosphi;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    istat = 0;\n\n    if (*thetap == 90.0) {\n      r = 0.0;\n    } else if (*thetap > -90.0) {\n      xi = D2R*(90.0 - *thetap)/2.0;\n      if (xi < prj->w[4]) {\n        r = xi*prj->w[3];\n      } else {\n        cosxi = cosd((90.0 - *thetap)/2.0);\n        tanxi = sqrt(1.0 - cosxi*cosxi)/cosxi;\n        r = -prj->w[0]*(log(cosxi)/tanxi + prj->w[1]*tanxi);\n      }\n    } else {\n      r = 0.0;\n      istat = 1;\n      if (!status) status = PRJERR_BAD_WORLD_SET(\"airs2x\");\n    }\n\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      *xp =  r*(*xp) - prj->x0;\n      *yp = -r*(*yp) - prj->y0;\n      *(statp++) = istat;\n    }\n  }\n\n  return status;\n}\n\n/*============================================================================\n*   CYP: cylindrical perspective projection.\n*\n*   Given:\n*      prj->pv[1]   Distance of point of projection from the centre of the\n*                   generating sphere, mu, in units of r0.\n*      prj->pv[2]   Radius of the cylinder of projection, lambda, in units of\n*                   r0.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to 0.0 if undefined.\n*      prj->theta0  Reset to 0.0 if undefined.\n*\n*   Returned:\n*      prj->flag     CYP\n*      prj->code    \"CYP\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    r0*lambda*(pi/180)\n*      prj->w[1]    (180/pi)/(r0*lambda)\n*      prj->w[2]    r0*(mu + lambda)\n*      prj->w[3]    1/(r0*(mu + lambda))\n*      prj->prjx2s  Pointer to cypx2s().\n*      prj->prjs2x  Pointer to cyps2x().\n*===========================================================================*/\n\nint cypset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = CYP;\n  strcpy(prj->code, \"CYP\");\n\n  if (undefined(prj->pv[1])) prj->pv[1] = 1.0;\n  if (undefined(prj->pv[2])) prj->pv[2] = 1.0;\n\n  strcpy(prj->name, \"cylindrical perspective\");\n  prj->category  = CYLINDRICAL;\n  prj->pvrange   = 102;\n  prj->simplezen = 0;\n  prj->equiareal = 0;\n  prj->conformal = 0;\n  prj->global    = prj->pv[1] < -1.0 || 0.0 < prj->pv[1];\n  prj->divergent = !prj->global;\n\n  if (prj->r0 == 0.0) {\n    prj->r0 = R2D;\n\n    prj->w[0] = prj->pv[2];\n    if (prj->w[0] == 0.0) {\n      return PRJERR_BAD_PARAM_SET(\"cypset\");\n    }\n\n    prj->w[1] = 1.0/prj->w[0];\n\n    prj->w[2] = R2D*(prj->pv[1] + prj->pv[2]);\n    if (prj->w[2] == 0.0) {\n      return PRJERR_BAD_PARAM_SET(\"cypset\");\n    }\n\n    prj->w[3] = 1.0/prj->w[2];\n  } else {\n    prj->w[0] = prj->r0*prj->pv[2]*D2R;\n    if (prj->w[0] == 0.0) {\n      return PRJERR_BAD_PARAM_SET(\"cypset\");\n    }\n\n    prj->w[1] = 1.0/prj->w[0];\n\n    prj->w[2] = prj->r0*(prj->pv[1] + prj->pv[2]);\n    if (prj->w[2] == 0.0) {\n      return PRJERR_BAD_PARAM_SET(\"cypset\");\n    }\n\n    prj->w[3] = 1.0/prj->w[2];\n  }\n\n  prj->prjx2s = cypx2s;\n  prj->prjs2x = cyps2x;\n\n  return prjoff(prj, 0.0, 0.0);\n}\n\n//----------------------------------------------------------------------------\n\nint cypx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double eta, s, t;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != CYP) {\n    if ((status = cypset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    s = prj->w[1]*(*xp + prj->x0);\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = s;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  thetap = theta;\n  statp = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    eta = prj->w[3]*(*yp + prj->y0);\n    t = atan2d(eta,1.0) + asind(eta*prj->pv[1]/sqrt(eta*eta+1.0));\n\n    for (ix = 0; ix < mx; ix++, thetap += spt) {\n      *thetap = t;\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"cypx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint cyps2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double eta, xi;\n  register int iphi, itheta, istat, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != CYP) {\n    if ((status = cypset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n  status = 0;\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    xi = prj->w[0]*(*phip) - prj->x0;\n\n    xp = x + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = xi;\n      xp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    eta = prj->pv[1] + cosd(*thetap);\n\n    istat = 0;\n    if (eta == 0.0) {\n      istat = 1;\n      if (!status) status = PRJERR_BAD_WORLD_SET(\"cyps2x\");\n\n    } else {\n      eta = prj->w[2]*sind(*thetap)/eta;\n    }\n\n    eta -= prj->y0;\n    for (iphi = 0; iphi < mphi; iphi++, yp += sxy) {\n      *yp = eta;\n      *(statp++) = istat;\n    }\n  }\n\n  return status;\n}\n\n/*============================================================================\n*   CEA: cylindrical equal area projection.\n*\n*   Given:\n*      prj->pv[1]   Square of the cosine of the latitude at which the\n*                   projection is conformal, lambda.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to 0.0 if undefined.\n*      prj->theta0  Reset to 0.0 if undefined.\n*\n*   Returned:\n*      prj->flag     CEA\n*      prj->code    \"CEA\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    r0*(pi/180)\n*      prj->w[1]    (180/pi)/r0\n*      prj->w[2]    r0/lambda\n*      prj->w[3]    lambda/r0\n*      prj->prjx2s  Pointer to ceax2s().\n*      prj->prjs2x  Pointer to ceas2x().\n*===========================================================================*/\n\nint ceaset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = CEA;\n  strcpy(prj->code, \"CEA\");\n\n  if (undefined(prj->pv[1])) prj->pv[1] = 1.0;\n\n  strcpy(prj->name, \"cylindrical equal area\");\n  prj->category  = CYLINDRICAL;\n  prj->pvrange   = 101;\n  prj->simplezen = 0;\n  prj->equiareal = 1;\n  prj->conformal = 0;\n  prj->global    = 1;\n  prj->divergent = 0;\n\n  if (prj->r0 == 0.0) {\n    prj->r0 = R2D;\n    prj->w[0] = 1.0;\n    prj->w[1] = 1.0;\n    if (prj->pv[1] <= 0.0 || prj->pv[1] > 1.0) {\n      return PRJERR_BAD_PARAM_SET(\"ceaset\");\n    }\n    prj->w[2] = prj->r0/prj->pv[1];\n    prj->w[3] = prj->pv[1]/prj->r0;\n  } else {\n    prj->w[0] = prj->r0*D2R;\n    prj->w[1] = R2D/prj->r0;\n    if (prj->pv[1] <= 0.0 || prj->pv[1] > 1.0) {\n      return PRJERR_BAD_PARAM_SET(\"ceaset\");\n    }\n    prj->w[2] = prj->r0/prj->pv[1];\n    prj->w[3] = prj->pv[1]/prj->r0;\n  }\n\n  prj->prjx2s = ceax2s;\n  prj->prjs2x = ceas2x;\n\n  return prjoff(prj, 0.0, 0.0);\n}\n\n//----------------------------------------------------------------------------\n\nint ceax2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double s;\n  const double tol = 1.0e-13;\n  register int istat, ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != CEA) {\n    if ((status = ceaset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    s = prj->w[1]*(*xp + prj->x0);\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = s;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  thetap = theta;\n  statp = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    s = prj->w[3]*(*yp + prj->y0);\n\n    istat = 0;\n    if (fabs(s) > 1.0) {\n      if (fabs(s) > 1.0+tol) {\n        s = 0.0;\n        istat = 1;\n        if (!status) status = PRJERR_BAD_PIX_SET(\"ceax2s\");\n      } else {\n        s = copysign(90.0, s);\n      }\n    } else {\n      s = asind(s);\n    }\n\n    for (ix = 0; ix < mx; ix++, thetap += spt) {\n      *thetap = s;\n      *(statp++) = istat;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"ceax2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint ceas2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double eta, xi;\n  register int iphi, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != CEA) {\n    if ((status = ceaset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    xi = prj->w[0]*(*phip) - prj->x0;\n\n    xp = x + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = xi;\n      xp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    eta = prj->w[2]*sind(*thetap) - prj->y0;\n\n    for (iphi = 0; iphi < mphi; iphi++, yp += sxy) {\n      *yp = eta;\n      *(statp++) = 0;\n    }\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   CAR: Plate carree projection.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to 0.0 if undefined.\n*      prj->theta0  Reset to 0.0 if undefined.\n*\n*   Returned:\n*      prj->flag     CAR\n*      prj->code    \"CAR\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    r0*(pi/180)\n*      prj->w[1]    (180/pi)/r0\n*      prj->prjx2s  Pointer to carx2s().\n*      prj->prjs2x  Pointer to cars2x().\n*===========================================================================*/\n\nint carset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = CAR;\n  strcpy(prj->code, \"CAR\");\n\n  strcpy(prj->name, \"plate caree\");\n  prj->category  = CYLINDRICAL;\n  prj->pvrange   = 0;\n  prj->simplezen = 0;\n  prj->equiareal = 0;\n  prj->conformal = 0;\n  prj->global    = 1;\n  prj->divergent = 0;\n\n  if (prj->r0 == 0.0) {\n    prj->r0 = R2D;\n    prj->w[0] = 1.0;\n    prj->w[1] = 1.0;\n  } else {\n    prj->w[0] = prj->r0*D2R;\n    prj->w[1] = 1.0/prj->w[0];\n  }\n\n  prj->prjx2s = carx2s;\n  prj->prjs2x = cars2x;\n\n  return prjoff(prj, 0.0, 0.0);\n}\n\n//----------------------------------------------------------------------------\n\nint carx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double s, t;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != CAR) {\n    if ((status = carset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    s = prj->w[1]*(*xp + prj->x0);\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = s;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  thetap = theta;\n  statp = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    t = prj->w[1]*(*yp + prj->y0);\n\n    for (ix = 0; ix < mx; ix++, thetap += spt) {\n      *thetap = t;\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"carx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint cars2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double eta, xi;\n  register int iphi, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != CAR) {\n    if ((status = carset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    xi = prj->w[0]*(*phip) - prj->x0;\n\n    xp = x + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = xi;\n      xp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    eta = prj->w[0]*(*thetap) - prj->y0;\n\n    for (iphi = 0; iphi < mphi; iphi++, yp += sxy) {\n      *yp = eta;\n      *(statp++) = 0;\n    }\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   MER: Mercator's projection.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to 0.0 if undefined.\n*      prj->theta0  Reset to 0.0 if undefined.\n*\n*   Returned:\n*      prj->flag     MER\n*      prj->code    \"MER\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    r0*(pi/180)\n*      prj->w[1]    (180/pi)/r0\n*      prj->prjx2s  Pointer to merx2s().\n*      prj->prjs2x  Pointer to mers2x().\n*===========================================================================*/\n\nint merset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = MER;\n  strcpy(prj->code, \"MER\");\n\n  strcpy(prj->name, \"Mercator's\");\n  prj->category  = CYLINDRICAL;\n  prj->pvrange   = 0;\n  prj->simplezen = 0;\n  prj->equiareal = 0;\n  prj->conformal = 1;\n  prj->global    = 0;\n  prj->divergent = 1;\n\n  if (prj->r0 == 0.0) {\n    prj->r0 = R2D;\n    prj->w[0] = 1.0;\n    prj->w[1] = 1.0;\n  } else {\n    prj->w[0] = prj->r0*D2R;\n    prj->w[1] = 1.0/prj->w[0];\n  }\n\n  prj->prjx2s = merx2s;\n  prj->prjs2x = mers2x;\n\n  return prjoff(prj, 0.0, 0.0);\n}\n\n//----------------------------------------------------------------------------\n\nint merx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double s, t;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != MER) {\n    if ((status = merset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    s = prj->w[1]*(*xp + prj->x0);\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = s;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    t = 2.0*atand(exp((*yp + prj->y0)/prj->r0)) - 90.0;\n\n    for (ix = 0; ix < mx; ix++, thetap += spt) {\n      *thetap = t;\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"merx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint mers2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double eta, xi;\n  register int iphi, itheta, istat, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != MER) {\n    if ((status = merset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n  status = 0;\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    xi  = prj->w[0]*(*phip) - prj->x0;\n\n    xp = x + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = xi;\n      xp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    istat = 0;\n\n    if (*thetap <= -90.0 || *thetap >= 90.0) {\n      eta = 0.0;\n      istat = 1;\n      if (!status) status = PRJERR_BAD_WORLD_SET(\"mers2x\");\n    } else {\n      eta = prj->r0*log(tand((*thetap+90.0)/2.0)) - prj->y0;\n    }\n\n    for (iphi = 0; iphi < mphi; iphi++, yp += sxy) {\n      *yp = eta;\n      *(statp++) = istat;\n    }\n  }\n\n  return status;\n}\n\n/*============================================================================\n*   SFL: Sanson-Flamsteed (\"global sinusoid\") projection.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to 0.0 if undefined.\n*      prj->theta0  Reset to 0.0 if undefined.\n*\n*   Returned:\n*      prj->flag     SFL\n*      prj->code    \"SFL\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    r0*(pi/180)\n*      prj->w[1]    (180/pi)/r0\n*      prj->prjx2s  Pointer to sflx2s().\n*      prj->prjs2x  Pointer to sfls2x().\n*===========================================================================*/\n\nint sflset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = SFL;\n  strcpy(prj->code, \"SFL\");\n\n  strcpy(prj->name, \"Sanson-Flamsteed\");\n  prj->category  = PSEUDOCYLINDRICAL;\n  prj->pvrange   = 0;\n  prj->simplezen = 0;\n  prj->equiareal = 1;\n  prj->conformal = 0;\n  prj->global    = 1;\n  prj->divergent = 0;\n\n  if (prj->r0 == 0.0) {\n    prj->r0 = R2D;\n    prj->w[0] = 1.0;\n    prj->w[1] = 1.0;\n  } else {\n    prj->w[0] = prj->r0*D2R;\n    prj->w[1] = 1.0/prj->w[0];\n  }\n\n  prj->prjx2s = sflx2s;\n  prj->prjs2x = sfls2x;\n\n  return prjoff(prj, 0.0, 0.0);\n}\n\n//----------------------------------------------------------------------------\n\nint sflx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double s, t, yj;\n  register int istat, ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != SFL) {\n    if ((status = sflset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    s = prj->w[1]*(*xp + prj->x0);\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = s;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    yj = *yp + prj->y0;\n    s = cos(yj/prj->r0);\n\n    istat = 0;\n    if (s == 0.0) {\n      istat = 1;\n      if (!status) status = PRJERR_BAD_PIX_SET(\"sflx2s\");\n    } else {\n      s = 1.0/s;\n    }\n\n    t = prj->w[1]*yj;\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      *phip  *= s;\n      *thetap = t;\n      *(statp++) = istat;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-12, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"sflx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint sfls2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double eta, xi;\n  register int iphi, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != SFL) {\n    if ((status = sflset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    xi = prj->w[0]*(*phip);\n\n    xp = x + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = xi;\n      xp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    xi  = cosd(*thetap);\n    eta = prj->w[0]*(*thetap) - prj->y0;\n\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      *xp = xi*(*xp) - prj->x0;\n      *yp = eta;\n      *(statp++) = 0;\n    }\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   PAR: parabolic projection.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to 0.0 if undefined.\n*      prj->theta0  Reset to 0.0 if undefined.\n*\n*   Returned:\n*      prj->flag     PAR\n*      prj->code    \"PAR\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    r0*(pi/180)\n*      prj->w[1]    (180/pi)/r0\n*      prj->w[2]    pi*r0\n*      prj->w[3]    1/(pi*r0)\n*      prj->prjx2s  Pointer to parx2s().\n*      prj->prjs2x  Pointer to pars2x().\n*===========================================================================*/\n\nint parset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = PAR;\n  strcpy(prj->code, \"PAR\");\n\n  strcpy(prj->name, \"parabolic\");\n  prj->category  = PSEUDOCYLINDRICAL;\n  prj->pvrange   = 0;\n  prj->simplezen = 0;\n  prj->equiareal = 1;\n  prj->conformal = 0;\n  prj->global    = 1;\n  prj->divergent = 0;\n\n  if (prj->r0 == 0.0) {\n    prj->r0 = R2D;\n    prj->w[0] = 1.0;\n    prj->w[1] = 1.0;\n    prj->w[2] = 180.0;\n    prj->w[3] = 1.0/prj->w[2];\n  } else {\n    prj->w[0] = prj->r0*D2R;\n    prj->w[1] = 1.0/prj->w[0];\n    prj->w[2] = PI*prj->r0;\n    prj->w[3] = 1.0/prj->w[2];\n  }\n\n  prj->prjx2s = parx2s;\n  prj->prjs2x = pars2x;\n\n  return prjoff(prj, 0.0, 0.0);\n}\n\n//----------------------------------------------------------------------------\n\nint parx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double r, s, t, xj;\n  const double tol = 1.0e-13;\n  register int istat, ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != PAR) {\n    if ((status = parset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xj = *xp + prj->x0;\n    s = prj->w[1]*xj;\n    t = fabs(xj) - tol;\n\n    phip   = phi   + rowoff;\n    thetap = theta + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip   = s;\n      *thetap = t;\n      phip   += rowlen;\n      thetap += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    r = prj->w[3]*(*yp + prj->y0);\n\n    istat = 0;\n    if (r > 1.0 || r < -1.0) {\n      s = 0.0;\n      t = 0.0;\n      istat = 1;\n      if (!status) status = PRJERR_BAD_PIX_SET(\"parx2s\");\n\n    } else {\n      s = 1.0 - 4.0*r*r;\n      if (s == 0.0) {\n        // Deferred test.\n        istat = -1;\n      } else {\n        s = 1.0/s;\n      }\n\n      t = 3.0*asind(r);\n    }\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      if (istat < 0) {\n        if (*thetap < 0.0) {\n          *(statp++) = 0;\n        } else {\n          *(statp++) = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"parx2s\");\n        }\n      } else {\n        *(statp++) = istat;\n      }\n\n      *phip  *= s;\n      *thetap = t;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-12, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"parx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint pars2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double eta, s, xi;\n  register int iphi, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != PAR) {\n    if ((status = parset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    xi = prj->w[0]*(*phip);\n\n    xp = x + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = xi;\n      xp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    s = sind((*thetap)/3.0);\n    xi = (1.0 - 4.0*s*s);\n    eta = prj->w[2]*s - prj->y0;\n\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      *xp = xi*(*xp) - prj->x0;\n      *yp = eta;\n      *(statp++) = 0;\n    }\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   MOL: Mollweide's projection.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to 0.0 if undefined.\n*      prj->theta0  Reset to 0.0 if undefined.\n*\n*   Returned:\n*      prj->flag     MOL\n*      prj->code    \"MOL\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    sqrt(2)*r0\n*      prj->w[1]    sqrt(2)*r0/90\n*      prj->w[2]    1/(sqrt(2)*r0)\n*      prj->w[3]    90/r0\n*      prj->prjx2s  Pointer to molx2s().\n*      prj->prjs2x  Pointer to mols2x().\n*===========================================================================*/\n\nint molset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = MOL;\n  strcpy(prj->code, \"MOL\");\n\n  if (prj->r0 == 0.0) prj->r0 = R2D;\n\n  strcpy(prj->name, \"Mollweide's\");\n  prj->category  = PSEUDOCYLINDRICAL;\n  prj->pvrange   = 0;\n  prj->simplezen = 0;\n  prj->equiareal = 1;\n  prj->conformal = 0;\n  prj->global    = 1;\n  prj->divergent = 0;\n\n  prj->w[0] = SQRT2*prj->r0;\n  prj->w[1] = prj->w[0]/90.0;\n  prj->w[2] = 1.0/prj->w[0];\n  prj->w[3] = 90.0/prj->r0;\n  prj->w[4] = 2.0/PI;\n\n  prj->prjx2s = molx2s;\n  prj->prjs2x = mols2x;\n\n  return prjoff(prj, 0.0, 0.0);\n}\n\n//----------------------------------------------------------------------------\n\nint molx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double r, s, t, xj, y0, yj, z;\n  const double tol = 1.0e-12;\n  register int istat, ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != MOL) {\n    if ((status = molset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xj = *xp + prj->x0;\n    s = prj->w[3]*xj;\n    t = fabs(xj) - tol;\n\n    phip   = phi   + rowoff;\n    thetap = theta + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip   = s;\n      *thetap = t;\n      phip   += rowlen;\n      thetap += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    yj = *yp + prj->y0;\n    y0 = yj/prj->r0;\n    r  = 2.0 - y0*y0;\n\n    istat = 0;\n    if (r <= tol) {\n      if (r < -tol) {\n        istat = 1;\n        if (!status) status = PRJERR_BAD_PIX_SET(\"molx2s\");\n      } else {\n        // OK if fabs(x) < tol whence phi = 0.0.\n        istat = -1;\n      }\n\n      r = 0.0;\n      s = 0.0;\n\n    } else {\n      r = sqrt(r);\n      s = 1.0/r;\n    }\n\n    z = yj*prj->w[2];\n    if (fabs(z) > 1.0) {\n      if (fabs(z) > 1.0+tol) {\n        z = 0.0;\n        istat = 1;\n        if (!status) status = PRJERR_BAD_PIX_SET(\"molx2s\");\n      } else {\n        z = copysign(1.0, z) + y0*r/PI;\n      }\n    } else {\n      z = asin(z)*prj->w[4] + y0*r/PI;\n    }\n\n    if (fabs(z) > 1.0) {\n      if (fabs(z) > 1.0+tol) {\n        z = 0.0;\n        istat = 1;\n        if (!status) status = PRJERR_BAD_PIX_SET(\"molx2s\");\n      } else {\n        z = copysign(1.0, z);\n      }\n    }\n\n    t = asind(z);\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      if (istat < 0) {\n        if (*thetap < 0.0) {\n          *(statp++) = 0;\n        } else {\n          *(statp++) = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"molx2s\");\n        }\n      } else {\n        *(statp++) = istat;\n      }\n\n      *phip  *= s;\n      *thetap = t;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-11, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"molx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint mols2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int k, mphi, mtheta, rowlen, rowoff, status;\n  double eta, gamma, resid, u, v, v0, v1, xi;\n  const double tol = 1.0e-13;\n  register int iphi, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != MOL) {\n    if ((status = molset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    xi = prj->w[1]*(*phip);\n\n    xp = x + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = xi;\n      xp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    if (fabs(*thetap) == 90.0) {\n      xi  = 0.0;\n      eta = copysign(prj->w[0], *thetap);\n\n    } else if (*thetap == 0.0) {\n      xi  = 1.0;\n      eta = 0.0;\n\n    } else {\n      u  = PI*sind(*thetap);\n      v0 = -PI;\n      v1 =  PI;\n      v  = u;\n      for (k = 0; k < 100; k++) {\n        resid = (v - u) + sin(v);\n        if (resid < 0.0) {\n          if (resid > -tol) break;\n          v0 = v;\n        } else {\n          if (resid < tol) break;\n          v1 = v;\n        }\n        v = (v0 + v1)/2.0;\n      }\n\n      gamma = v/2.0;\n      xi  = cos(gamma);\n      eta = prj->w[0]*sin(gamma);\n    }\n\n    eta -= prj->y0;\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      *xp = xi*(*xp) - prj->x0;\n      *yp = eta;\n      *(statp++) = 0;\n    }\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   AIT: Hammer-Aitoff projection.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to 0.0 if undefined.\n*      prj->theta0  Reset to 0.0 if undefined.\n*\n*   Returned:\n*      prj->flag     AIT\n*      prj->code    \"AIT\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    2*r0**2\n*      prj->w[1]    1/(2*r0)**2\n*      prj->w[2]    1/(4*r0)**2\n*      prj->w[3]    1/(2*r0)\n*      prj->prjx2s  Pointer to aitx2s().\n*      prj->prjs2x  Pointer to aits2x().\n*===========================================================================*/\n\nint aitset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = AIT;\n  strcpy(prj->code, \"AIT\");\n\n  if (prj->r0 == 0.0) prj->r0 = R2D;\n\n  strcpy(prj->name, \"Hammer-Aitoff\");\n  prj->category  = CONVENTIONAL;\n  prj->pvrange   = 0;\n  prj->simplezen = 0;\n  prj->equiareal = 1;\n  prj->conformal = 0;\n  prj->global    = 1;\n  prj->divergent = 0;\n\n  prj->w[0] = 2.0*prj->r0*prj->r0;\n  prj->w[1] = 1.0/(2.0*prj->w[0]);\n  prj->w[2] = prj->w[1]/4.0;\n  prj->w[3] = 1.0/(2.0*prj->r0);\n\n  prj->prjx2s = aitx2s;\n  prj->prjs2x = aits2x;\n\n  return prjoff(prj, 0.0, 0.0);\n}\n\n//----------------------------------------------------------------------------\n\nint aitx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double s, t, x0, xj, y0, yj, yj2, z;\n  const double tol = 1.0e-13;\n  register int ix, iy, istat, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != AIT) {\n    if ((status = aitset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xj = *xp + prj->x0;\n    s  = 1.0 - xj*xj*prj->w[2];\n    t  = xj*prj->w[3];\n\n    phip   = phi   + rowoff;\n    thetap = theta + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip   = s;\n      *thetap = t;\n      phip   += rowlen;\n      thetap += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    yj  = *yp + prj->y0;\n    yj2 = yj*yj*prj->w[1];\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      s = *phip - yj2;\n\n      istat = 0;\n      if (s < 0.5) {\n        if (s < 0.5-tol) {\n          istat = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"aitx2s\");\n        }\n\n        s = 0.5;\n      }\n\n      z = sqrt(s);\n      x0 = 2.0*z*z - 1.0;\n      y0 = z*(*thetap);\n      if (x0 == 0.0 && y0 == 0.0) {\n        *phip = 0.0;\n      } else {\n        *phip = 2.0*atan2d(y0, x0);\n      }\n\n      t = z*yj/prj->r0;\n      if (fabs(t) > 1.0) {\n        if (fabs(t) > 1.0+tol) {\n          istat = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"aitx2s\");\n        }\n        t = copysign(90.0, t);\n\n      } else {\n        t = asind(t);\n      }\n\n      *thetap = t;\n      *(statp++) = istat;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"aitx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint aits2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double cosphi, costhe, sinphi, sinthe, w;\n  register int iphi, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != AIT) {\n    if ((status = aitset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    w = (*phip)/2.0;\n    sincosd(w, &sinphi, &cosphi);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = sinphi;\n      *yp = cosphi;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    sincosd(*thetap, &sinthe, &costhe);\n\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      w = sqrt(prj->w[0]/(1.0 + costhe*(*yp)));\n      *xp = 2.0*w*costhe*(*xp) - prj->x0;\n      *yp = w*sinthe - prj->y0;\n      *(statp++) = 0;\n    }\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   COP: conic perspective projection.\n*\n*   Given:\n*      prj->pv[1]   sigma = (theta2+theta1)/2\n*      prj->pv[2]   delta = (theta2-theta1)/2, where theta1 and theta2 are the\n*                   latitudes of the standard parallels, in degrees.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to sigma if undefined.\n*      prj->theta0  Reset to sigma if undefined.\n*\n*   Returned:\n*      prj->flag     COP\n*      prj->code    \"COP\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    C  = sin(sigma)\n*      prj->w[1]    1/C\n*      prj->w[2]    Y0 = r0*cos(delta)*cot(sigma)\n*      prj->w[3]    r0*cos(delta)\n*      prj->w[4]    1/(r0*cos(delta)\n*      prj->w[5]    cot(sigma)\n*      prj->prjx2s  Pointer to copx2s().\n*      prj->prjs2x  Pointer to cops2x().\n*===========================================================================*/\n\nint copset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = COP;\n  strcpy(prj->code, \"COP\");\n  strcpy(prj->name, \"conic perspective\");\n\n  if (undefined(prj->pv[1])) {\n    return PRJERR_BAD_PARAM_SET(\"copset\");\n  }\n  if (undefined(prj->pv[2])) prj->pv[2] = 0.0;\n  if (prj->r0 == 0.0) prj->r0 = R2D;\n\n  prj->category  = CONIC;\n  prj->pvrange   = 102;\n  prj->simplezen = 0;\n  prj->equiareal = 0;\n  prj->conformal = 0;\n  prj->global    = 0;\n  prj->divergent = 1;\n\n  prj->w[0] = sind(prj->pv[1]);\n  if (prj->w[0] == 0.0) {\n    return PRJERR_BAD_PARAM_SET(\"copset\");\n  }\n\n  prj->w[1] = 1.0/prj->w[0];\n\n  prj->w[3] = prj->r0*cosd(prj->pv[2]);\n  if (prj->w[3] == 0.0) {\n    return PRJERR_BAD_PARAM_SET(\"copset\");\n  }\n\n  prj->w[4] = 1.0/prj->w[3];\n  prj->w[5] = 1.0/tand(prj->pv[1]);\n\n  prj->w[2] = prj->w[3]*prj->w[5];\n\n  prj->prjx2s = copx2s;\n  prj->prjs2x = cops2x;\n\n  return prjoff(prj, 0.0, prj->pv[1]);\n}\n\n//----------------------------------------------------------------------------\n\nint copx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double alpha, dy, dy2, r, xj;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != COP) {\n    if ((status = copset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xj = *xp + prj->x0;\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xj;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    dy  = prj->w[2] - (*yp + prj->y0);\n    dy2 = dy*dy;\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xj = *phip;\n\n      r = sqrt(xj*xj + dy2);\n      if (prj->pv[1] < 0.0) r = -r;\n\n      if (r == 0.0) {\n        alpha = 0.0;\n      } else {\n        alpha = atan2d(xj/r, dy/r);\n      }\n\n      *phip = alpha*prj->w[1];\n      *thetap = prj->pv[1] + atand(prj->w[5] - r*prj->w[4]);\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"copx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint cops2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double alpha, cosalpha, r, s, t, sinalpha, y0;\n  register int iphi, itheta, istat, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != COP) {\n    if ((status = copset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n  status = 0;\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    alpha = prj->w[0]*(*phip);\n    sincosd(alpha, &sinalpha, &cosalpha);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = sinalpha;\n      *yp = cosalpha;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  y0 = prj->y0 - prj->w[2];\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    t = *thetap - prj->pv[1];\n    s = cosd(t);\n\n    istat = 0;\n    if (s == 0.0) {\n      // Latitude of divergence.\n      r = 0.0;\n      istat = 1;\n      if (!status) status = PRJERR_BAD_WORLD_SET(\"cops2x\");\n\n    } else if (fabs(*thetap) == 90.0) {\n      // Return an exact value at the poles.\n      r = 0.0;\n\n      // Bounds checking.\n      if (prj->bounds&1) {\n        if ((*thetap < 0.0) != (prj->pv[1] < 0.0)) {\n          istat = 1;\n          if (!status) status = PRJERR_BAD_WORLD_SET(\"cops2x\");\n        }\n      }\n\n    } else {\n      r = prj->w[2] - prj->w[3]*sind(t)/s;\n\n      // Bounds checking.\n      if (prj->bounds&1) {\n        if (r*prj->w[0] < 0.0) {\n          istat = 1;\n          if (!status) status = PRJERR_BAD_WORLD_SET(\"cops2x\");\n        }\n      }\n    }\n\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      *xp =  r*(*xp) - prj->x0;\n      *yp = -r*(*yp) - y0;\n      *(statp++) = istat;\n    }\n  }\n\n  return status;\n}\n\n/*============================================================================\n*   COE: conic equal area projection.\n*\n*   Given:\n*      prj->pv[1]   sigma = (theta2+theta1)/2\n*      prj->pv[2]   delta = (theta2-theta1)/2, where theta1 and theta2 are the\n*                   latitudes of the standard parallels, in degrees.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to sigma if undefined.\n*      prj->theta0  Reset to sigma if undefined.\n*\n*   Returned:\n*      prj->flag     COE\n*      prj->code    \"COE\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    C = (sin(theta1) + sin(theta2))/2\n*      prj->w[1]    1/C\n*      prj->w[2]    Y0 = chi*sqrt(psi - 2C*sind(sigma))\n*      prj->w[3]    chi = r0/C\n*      prj->w[4]    psi = 1 + sin(theta1)*sin(theta2)\n*      prj->w[5]    2C\n*      prj->w[6]    (1 + sin(theta1)*sin(theta2))*(r0/C)**2\n*      prj->w[7]    C/(2*r0**2)\n*      prj->w[8]    chi*sqrt(psi + 2C)\n*      prj->prjx2s  Pointer to coex2s().\n*      prj->prjs2x  Pointer to coes2x().\n*===========================================================================*/\n\nint coeset(struct prjprm *prj)\n\n{\n  double theta1, theta2;\n\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = COE;\n  strcpy(prj->code, \"COE\");\n  strcpy(prj->name, \"conic equal area\");\n\n  if (undefined(prj->pv[1])) {\n    return PRJERR_BAD_PARAM_SET(\"coeset\");\n  }\n  if (undefined(prj->pv[2])) prj->pv[2] = 0.0;\n  if (prj->r0 == 0.0) prj->r0 = R2D;\n\n  prj->category  = CONIC;\n  prj->pvrange   = 102;\n  prj->simplezen = 0;\n  prj->equiareal = 1;\n  prj->conformal = 0;\n  prj->global    = 1;\n  prj->divergent = 0;\n\n  theta1 = prj->pv[1] - prj->pv[2];\n  theta2 = prj->pv[1] + prj->pv[2];\n\n  prj->w[0] = (sind(theta1) + sind(theta2))/2.0;\n  if (prj->w[0] == 0.0) {\n    return PRJERR_BAD_PARAM_SET(\"coeset\");\n  }\n\n  prj->w[1] = 1.0/prj->w[0];\n\n  prj->w[3] = prj->r0/prj->w[0];\n  prj->w[4] = 1.0 + sind(theta1)*sind(theta2);\n  prj->w[5] = 2.0*prj->w[0];\n  prj->w[6] = prj->w[3]*prj->w[3]*prj->w[4];\n  prj->w[7] = 1.0/(2.0*prj->r0*prj->w[3]);\n  prj->w[8] = prj->w[3]*sqrt(prj->w[4] + prj->w[5]);\n\n  prj->w[2] = prj->w[3]*sqrt(prj->w[4] - prj->w[5]*sind(prj->pv[1]));\n\n  prj->prjx2s = coex2s;\n  prj->prjs2x = coes2x;\n\n  return prjoff(prj, 0.0, prj->pv[1]);\n}\n\n//----------------------------------------------------------------------------\n\nint coex2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double alpha, dy, dy2, r, t, w, xj;\n  const double tol = 1.0e-12;\n  register int ix, iy, istat, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != COE) {\n    if ((status = coeset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xj = *xp + prj->x0;\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xj;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    dy  = prj->w[2] - (*yp + prj->y0);\n    dy2 = dy*dy;\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xj = *phip;\n\n      r = sqrt(xj*xj + dy2);\n      if (prj->pv[1] < 0.0) r = -r;\n\n      if (r == 0.0) {\n        alpha = 0.0;\n      } else {\n        alpha = atan2d(xj/r, dy/r);\n      }\n\n      istat = 0;\n      if (fabs(r - prj->w[8]) < tol) {\n        t = -90.0;\n      } else {\n        w = (prj->w[6] - r*r)*prj->w[7];\n        if (fabs(w) > 1.0) {\n          if (fabs(w-1.0) < tol) {\n            t = 90.0;\n          } else if (fabs(w+1.0) < tol) {\n            t = -90.0;\n          } else {\n            t = 0.0;\n            istat = 1;\n            if (!status) status = PRJERR_BAD_PIX_SET(\"coex2s\");\n          }\n        } else {\n          t = asind(w);\n        }\n      }\n\n      *phip = alpha*prj->w[1];\n      *thetap = t;\n      *(statp++) = istat;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"coex2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint coes2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double alpha, cosalpha, r, sinalpha, y0;\n  register int iphi, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != COE) {\n    if ((status = coeset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    alpha = prj->w[0]*(*phip);\n    sincosd(alpha, &sinalpha, &cosalpha);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = sinalpha;\n      *yp = cosalpha;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  y0 = prj->y0 - prj->w[2];\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    if (*thetap == -90.0) {\n      r = prj->w[8];\n    } else {\n      r = prj->w[3]*sqrt(prj->w[4] - prj->w[5]*sind(*thetap));\n    }\n\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      *xp =  r*(*xp) - prj->x0;\n      *yp = -r*(*yp) - y0;\n      *(statp++) = 0;\n    }\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   COD: conic equidistant projection.\n*\n*   Given:\n*      prj->pv[1]   sigma = (theta2+theta1)/2\n*      prj->pv[2]   delta = (theta2-theta1)/2, where theta1 and theta2 are the\n*                   latitudes of the standard parallels, in degrees.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to sigma if undefined.\n*      prj->theta0  Reset to sigma if undefined.\n*\n*   Returned:\n*      prj->flag     COD\n*      prj->code    \"COD\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    C = r0*sin(sigma)*sin(delta)/delta\n*      prj->w[1]    1/C\n*      prj->w[2]    Y0 = delta*cot(delta)*cot(sigma)\n*      prj->w[3]    Y0 + sigma\n*      prj->prjx2s  Pointer to codx2s().\n*      prj->prjs2x  Pointer to cods2x().\n*===========================================================================*/\n\nint codset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = COD;\n  strcpy(prj->code, \"COD\");\n  strcpy(prj->name, \"conic equidistant\");\n\n  if (undefined(prj->pv[1])) {\n    return PRJERR_BAD_PARAM_SET(\"codset\");\n  }\n  if (undefined(prj->pv[2])) prj->pv[2] = 0.0;\n  if (prj->r0 == 0.0) prj->r0 = R2D;\n\n  prj->category  = CONIC;\n  prj->pvrange   = 102;\n  prj->simplezen = 0;\n  prj->equiareal = 0;\n  prj->conformal = 0;\n  prj->global    = 1;\n  prj->divergent = 0;\n\n  if (prj->pv[2] == 0.0) {\n    prj->w[0] = prj->r0*sind(prj->pv[1])*D2R;\n  } else {\n    prj->w[0] = prj->r0*sind(prj->pv[1])*sind(prj->pv[2])/prj->pv[2];\n  }\n\n  if (prj->w[0] == 0.0) {\n    return PRJERR_BAD_PARAM_SET(\"codset\");\n  }\n\n  prj->w[1] = 1.0/prj->w[0];\n  prj->w[2] = prj->r0*cosd(prj->pv[2])*cosd(prj->pv[1])/prj->w[0];\n  prj->w[3] = prj->w[2] + prj->pv[1];\n\n  prj->prjx2s = codx2s;\n  prj->prjs2x = cods2x;\n\n  return prjoff(prj, 0.0, prj->pv[1]);\n}\n\n//----------------------------------------------------------------------------\n\nint codx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double alpha, dy, dy2, r, xj;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != COD) {\n    if ((status = codset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xj = *xp + prj->x0;\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xj;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    dy  = prj->w[2] - (*yp + prj->y0);\n    dy2 = dy*dy;\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xj = *phip;\n\n      r = sqrt(xj*xj + dy2);\n      if (prj->pv[1] < 0.0) r = -r;\n\n      if (r == 0.0) {\n        alpha = 0.0;\n      } else {\n        alpha = atan2d(xj/r, dy/r);\n      }\n\n      *phip = alpha*prj->w[1];\n      *thetap = prj->w[3] - r;\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"codx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint cods2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double alpha, cosalpha, r, sinalpha, y0;\n  register int iphi, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != COD) {\n    if ((status = codset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    alpha = prj->w[0]*(*phip);\n    sincosd(alpha, &sinalpha, &cosalpha);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = sinalpha;\n      *yp = cosalpha;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  y0 = prj->y0 - prj->w[2];\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    r = prj->w[3] - *thetap;\n\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      *xp =  r*(*xp) - prj->x0;\n      *yp = -r*(*yp) - y0;\n      *(statp++) = 0;\n    }\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   COO: conic orthomorphic projection.\n*\n*   Given:\n*      prj->pv[1]   sigma = (theta2+theta1)/2\n*      prj->pv[2]   delta = (theta2-theta1)/2, where theta1 and theta2 are the\n*                   latitudes of the standard parallels, in degrees.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to sigma if undefined.\n*      prj->theta0  Reset to sigma if undefined.\n*\n*   Returned:\n*      prj->flag     COO\n*      prj->code    \"COO\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    C = ln(cos(theta2)/cos(theta1))/ln(tan(tau2)/tan(tau1))\n*                       where tau1 = (90 - theta1)/2\n*                             tau2 = (90 - theta2)/2\n*      prj->w[1]    1/C\n*      prj->w[2]    Y0 = psi*tan((90-sigma)/2)**C\n*      prj->w[3]    psi = (r0*cos(theta1)/C)/tan(tau1)**C\n*      prj->w[4]    1/psi\n*      prj->prjx2s  Pointer to coox2s().\n*      prj->prjs2x  Pointer to coos2x().\n*===========================================================================*/\n\nint cooset(struct prjprm *prj)\n\n{\n  double cos1, cos2, tan1, tan2, theta1, theta2;\n\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = COO;\n  strcpy(prj->code, \"COO\");\n  strcpy(prj->name, \"conic orthomorphic\");\n\n  if (undefined(prj->pv[1])) {\n    return PRJERR_BAD_PARAM_SET(\"cooset\");\n  }\n  if (undefined(prj->pv[2])) prj->pv[2] = 0.0;\n  if (prj->r0 == 0.0) prj->r0 = R2D;\n\n  prj->category  = CONIC;\n  prj->pvrange   = 102;\n  prj->simplezen = 0;\n  prj->equiareal = 0;\n  prj->conformal = 1;\n  prj->global    = 0;\n  prj->divergent = 1;\n\n  theta1 = prj->pv[1] - prj->pv[2];\n  theta2 = prj->pv[1] + prj->pv[2];\n\n  tan1 = tand((90.0 - theta1)/2.0);\n  cos1 = cosd(theta1);\n\n  if (theta1 == theta2) {\n    prj->w[0] = sind(theta1);\n  } else {\n    tan2 = tand((90.0 - theta2)/2.0);\n    cos2 = cosd(theta2);\n    prj->w[0] = log(cos2/cos1)/log(tan2/tan1);\n  }\n  if (prj->w[0] == 0.0) {\n    return PRJERR_BAD_PARAM_SET(\"cooset\");\n  }\n\n  prj->w[1] = 1.0/prj->w[0];\n\n  prj->w[3] = prj->r0*(cos1/prj->w[0])/pow(tan1,prj->w[0]);\n  if (prj->w[3] == 0.0) {\n    return PRJERR_BAD_PARAM_SET(\"cooset\");\n  }\n  prj->w[2] = prj->w[3]*pow(tand((90.0 - prj->pv[1])/2.0),prj->w[0]);\n  prj->w[4] = 1.0/prj->w[3];\n\n  prj->prjx2s = coox2s;\n  prj->prjs2x = coos2x;\n\n  return prjoff(prj, 0.0, prj->pv[1]);\n}\n\n//----------------------------------------------------------------------------\n\nint coox2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double alpha, dy, dy2, r, t, xj;\n  register int ix, iy, istat, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != COO) {\n    if ((status = cooset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xj = *xp + prj->x0;\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xj;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    dy  = prj->w[2] - (*yp + prj->y0);\n    dy2 = dy*dy;\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xj = *phip;\n\n      r = sqrt(xj*xj + dy2);\n      if (prj->pv[1] < 0.0) r = -r;\n\n      if (r == 0.0) {\n        alpha = 0.0;\n      } else {\n        alpha = atan2d(xj/r, dy/r);\n      }\n\n      istat = 0;\n      if (r == 0.0) {\n        if (prj->w[0] < 0.0) {\n          t = -90.0;\n        } else {\n          t = 0.0;\n          istat = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"coox2s\");\n        }\n      } else {\n        t = 90.0 - 2.0*atand(pow(r*prj->w[4],prj->w[1]));\n      }\n\n      *phip = alpha*prj->w[1];\n      *thetap = t;\n      *(statp++) = istat;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"coox2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint coos2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double alpha, cosalpha, r, sinalpha, y0;\n  register int iphi, itheta, istat, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != COO) {\n    if ((status = cooset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n  status = 0;\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    alpha = prj->w[0]*(*phip);\n    sincosd(alpha, &sinalpha, &cosalpha);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = sinalpha;\n      *yp = cosalpha;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  y0 = prj->y0 - prj->w[2];\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    istat = 0;\n\n    if (*thetap == -90.0) {\n      r = 0.0;\n      if (prj->w[0] >= 0.0) {\n        istat = 1;\n        if (!status) status = PRJERR_BAD_WORLD_SET(\"coos2x\");\n      }\n    } else {\n      r = prj->w[3]*pow(tand((90.0 - *thetap)/2.0),prj->w[0]);\n    }\n\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      *xp =  r*(*xp) - prj->x0;\n      *yp = -r*(*yp) - y0;\n      *(statp++) = istat;\n    }\n  }\n\n  return status;\n}\n\n/*============================================================================\n*   BON: Bonne's projection.\n*\n*   Given:\n*      prj->pv[1]   Bonne conformal latitude, theta1, in degrees.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to 0.0 if undefined.\n*      prj->theta0  Reset to 0.0 if undefined.\n*\n*   Returned:\n*      prj->flag     BON\n*      prj->code    \"BON\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[1]    r0*pi/180\n*      prj->w[2]    Y0 = r0*(cot(theta1) + theta1*pi/180)\n*      prj->prjx2s  Pointer to bonx2s().\n*      prj->prjs2x  Pointer to bons2x().\n*===========================================================================*/\n\nint bonset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = BON;\n  strcpy(prj->code, \"BON\");\n  strcpy(prj->name, \"Bonne's\");\n\n  if (undefined(prj->pv[1])) {\n    return PRJERR_BAD_PARAM_SET(\"bonset\");\n  }\n\n  if (prj->pv[1] == 0.0) {\n    // Sanson-Flamsteed.\n    return sflset(prj);\n  }\n\n  prj->category  = POLYCONIC;\n  prj->pvrange   = 101;\n  prj->simplezen = 0;\n  prj->equiareal = 1;\n  prj->conformal = 0;\n  prj->global    = 1;\n  prj->divergent = 0;\n\n  if (prj->r0 == 0.0) {\n    prj->r0 = R2D;\n    prj->w[1] = 1.0;\n    prj->w[2] = prj->r0*cosd(prj->pv[1])/sind(prj->pv[1]) + prj->pv[1];\n  } else {\n    prj->w[1] = prj->r0*D2R;\n    prj->w[2] = prj->r0*(cosd(prj->pv[1])/sind(prj->pv[1]) + prj->pv[1]*D2R);\n  }\n\n  prj->prjx2s = bonx2s;\n  prj->prjs2x = bons2x;\n\n  return prjoff(prj, 0.0, 0.0);\n}\n\n//----------------------------------------------------------------------------\n\nint bonx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double alpha, dy, dy2, costhe, r, s, t, xj;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->pv[1] == 0.0) {\n    // Sanson-Flamsteed.\n    return sflx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat);\n  }\n\n  if (prj->flag != BON) {\n    if ((status = bonset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xj = *xp + prj->x0;\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xj;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    dy  = prj->w[2] - (*yp + prj->y0);\n    dy2 = dy*dy;\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xj = *phip;\n\n      r = sqrt(xj*xj + dy2);\n      if (prj->pv[1] < 0.0) r = -r;\n\n      if (r == 0.0) {\n        alpha = 0.0;\n      } else {\n        alpha = atan2d(xj/r, dy/r);\n      }\n\n      t = (prj->w[2] - r)/prj->w[1];\n      costhe = cosd(t);\n      if (costhe == 0.0) {\n        s = 0.0;\n      } else {\n        s = alpha*(r/prj->r0)/costhe;\n      }\n\n      *phip = s;\n      *thetap = t;\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-11, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"bonx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint bons2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double alpha, cosalpha, r, s, sinalpha, y0;\n  register int iphi, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->pv[1] == 0.0) {\n    // Sanson-Flamsteed.\n    return sfls2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat);\n  }\n\n  if (prj->flag != BON) {\n    if ((status = bonset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n  y0 = prj->y0 - prj->w[2];\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    s = prj->r0*(*phip);\n\n    xp = x + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = s;\n      xp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    r = prj->w[2] - prj->w[1]*(*thetap);\n    s = cosd(*thetap)/r;\n\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      alpha = s*(*xp);\n      sincosd(alpha, &sinalpha, &cosalpha);\n      *xp =  r*sinalpha - prj->x0;\n      *yp = -r*cosalpha - y0;\n      *(statp++) = 0;\n    }\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   PCO: polyconic projection.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to 0.0 if undefined.\n*      prj->theta0  Reset to 0.0 if undefined.\n*\n*   Returned:\n*      prj->flag     PCO\n*      prj->code    \"PCO\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    r0*(pi/180)\n*      prj->w[1]    (180/pi)/r0\n*      prj->w[2]    2*r0\n*      prj->w[3]    (pi/180)/(2*r0)\n*      prj->prjx2s  Pointer to pcox2s().\n*      prj->prjs2x  Pointer to pcos2x().\n*===========================================================================*/\n\nint pcoset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = PCO;\n  strcpy(prj->code, \"PCO\");\n\n  strcpy(prj->name, \"polyconic\");\n  prj->category  = POLYCONIC;\n  prj->pvrange   = 0;\n  prj->simplezen = 0;\n  prj->equiareal = 0;\n  prj->conformal = 0;\n  prj->global    = 1;\n  prj->divergent = 0;\n\n  if (prj->r0 == 0.0) {\n    prj->r0 = R2D;\n    prj->w[0] = 1.0;\n    prj->w[1] = 1.0;\n    prj->w[2] = 360.0/PI;\n  } else {\n    prj->w[0] = prj->r0*D2R;\n    prj->w[1] = 1.0/prj->w[0];\n    prj->w[2] = 2.0*prj->r0;\n  }\n  prj->w[3] = D2R/prj->w[2];\n\n  prj->prjx2s = pcox2s;\n  prj->prjs2x = pcos2x;\n\n  return prjoff(prj, 0.0, 0.0);\n}\n\n//----------------------------------------------------------------------------\n\nint pcox2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double f, fneg, fpos, lambda, tanthe, the, theneg, thepos, w, x1, xj, xx,\n         yj, ymthe, y1;\n  const double tol = 1.0e-12;\n  register int ix, iy, k, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != PCO) {\n    if ((status = pcoset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xj = *xp + prj->x0;\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xj;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    yj = *yp + prj->y0;\n    w  = fabs(yj*prj->w[1]);\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xj = *phip;\n\n      if (w < tol) {\n        *phip = xj*prj->w[1];\n        *thetap = 0.0;\n\n      } else if (fabs(w-90.0) < tol) {\n        *phip = 0.0;\n        *thetap = copysign(90.0, yj);\n\n      } else {\n        if (w < 1.0e-4) {\n          // To avoid cot(theta) blowing up near theta == 0.\n          the    = yj / (prj->w[0] + prj->w[3]*xj*xj);\n          ymthe  = yj - prj->w[0]*the;\n          tanthe = tand(the);\n\n        } else {\n          // Iterative solution using weighted division of the interval.\n          thepos = yj / prj->w[0];\n          theneg = 0.0;\n\n          // Setting fneg = -fpos halves the interval in the first iter.\n          xx = xj*xj;\n          fpos  =  xx;\n          fneg  = -xx;\n\n          for (k = 0; k < 64; k++) {\n            // Weighted division of the interval.\n            lambda = fpos/(fpos-fneg);\n            if (lambda < 0.1) {\n              lambda = 0.1;\n            } else if (lambda > 0.9) {\n              lambda = 0.9;\n            }\n            the = thepos - lambda*(thepos-theneg);\n\n            // Compute the residue.\n            ymthe  = yj - prj->w[0]*the;\n            tanthe = tand(the);\n            f = xx + ymthe*(ymthe - prj->w[2]/tanthe);\n\n            // Check for convergence.\n            if (fabs(f) < tol) break;\n            if (fabs(thepos-theneg) < tol) break;\n\n            // Redefine the interval.\n            if (f > 0.0) {\n              thepos = the;\n              fpos = f;\n            } else {\n              theneg = the;\n              fneg = f;\n            }\n          }\n        }\n\n        x1 = prj->r0 - ymthe*tanthe;\n        y1 = xj*tanthe;\n        if (x1 == 0.0 && y1 == 0.0) {\n          *phip = 0.0;\n        } else {\n          *phip = atan2d(y1, x1)/sind(the);\n        }\n\n        *thetap = the;\n      }\n\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-12, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"pcox2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint pcos2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double cospsi, costhe, cotthe, sinpsi, sinthe, therad;\n  register int iphi, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != PCO) {\n    if ((status = pcoset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    xp = x + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = *phip;\n      xp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    if (*thetap == 0.0) {\n      for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n        *xp =  prj->w[0]*(*xp) - prj->x0;\n        *yp = -prj->y0;\n        *(statp++) = 0;\n      }\n\n    } else if (fabs(*thetap) < 1.0e-4) {\n      // To avoid cot(theta) blowing up near theta == 0.\n      for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n        *xp = prj->w[0]*(*xp)*cosd(*thetap) - prj->x0;\n        *yp = (prj->w[0] + prj->w[3]*(*xp)*(*xp))*(*thetap) - prj->y0;\n        *(statp++) = 0;\n      }\n\n    } else {\n      therad = (*thetap)*D2R;\n      sincosd(*thetap, &sinthe, &costhe);\n\n      for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n        sincosd((*xp)*sinthe, &sinpsi, &cospsi);\n        cotthe = costhe/sinthe;\n        *xp = prj->r0*cotthe*sinpsi - prj->x0;\n        *yp = prj->r0*(cotthe*(1.0 - cospsi) + therad) - prj->y0;\n        *(statp++) = 0;\n      }\n    }\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   TSC: tangential spherical cube projection.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to 0.0 if undefined.\n*      prj->theta0  Reset to 0.0 if undefined.\n*\n*   Returned:\n*      prj->flag     TSC\n*      prj->code    \"TSC\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    r0*(pi/4)\n*      prj->w[1]    (4/pi)/r0\n*      prj->prjx2s  Pointer to tscx2s().\n*      prj->prjs2x  Pointer to tscs2x().\n*===========================================================================*/\n\nint tscset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = TSC;\n  strcpy(prj->code, \"TSC\");\n\n  strcpy(prj->name, \"tangential spherical cube\");\n  prj->category  = QUADCUBE;\n  prj->pvrange   = 0;\n  prj->simplezen = 0;\n  prj->equiareal = 0;\n  prj->conformal = 0;\n  prj->global    = 1;\n  prj->divergent = 0;\n\n  if (prj->r0 == 0.0) {\n    prj->r0 = R2D;\n    prj->w[0] = 45.0;\n    prj->w[1] = 1.0/45.0;\n  } else {\n    prj->w[0] = prj->r0*PI/4.0;\n    prj->w[1] = 1.0/prj->w[0];\n  }\n\n  prj->prjx2s = tscx2s;\n  prj->prjs2x = tscs2x;\n\n  return prjoff(prj, 0.0, 0.0);\n}\n\n//----------------------------------------------------------------------------\n\nint tscx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double l, m, n, xf, yf;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != TSC) {\n    if ((status = tscset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xf = (*xp + prj->x0)*prj->w[1];\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xf;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    yf = (*yp + prj->y0)*prj->w[1];\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xf = *phip;\n\n      // Bounds checking.\n      if (fabs(xf) <= 1.0) {\n        if (fabs(yf) > 3.0) {\n          *phip = 0.0;\n          *thetap = 0.0;\n          *(statp++) = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"tscx2s\");\n          continue;\n        }\n      } else {\n        if (fabs(xf) > 7.0 || fabs(yf) > 1.0) {\n          *phip = 0.0;\n          *thetap = 0.0;\n          *(statp++) = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"tscx2s\");\n          continue;\n        }\n      }\n\n      // Map negative faces to the other side.\n      if (xf < -1.0) xf += 8.0;\n\n      // Determine the face.\n      if (xf > 5.0) {\n        // face = 4\n        xf = xf - 6.0;\n        m  = -1.0/sqrt(1.0 + xf*xf + yf*yf);\n        l  = -m*xf;\n        n  = -m*yf;\n      } else if (xf > 3.0) {\n        // face = 3\n        xf = xf - 4.0;\n        l  = -1.0/sqrt(1.0 + xf*xf + yf*yf);\n        m  =  l*xf;\n        n  = -l*yf;\n      } else if (xf > 1.0) {\n        // face = 2\n        xf = xf - 2.0;\n        m  =  1.0/sqrt(1.0 + xf*xf + yf*yf);\n        l  = -m*xf;\n        n  =  m*yf;\n      } else if (yf > 1.0) {\n        // face = 0\n        yf = yf - 2.0;\n        n  = 1.0/sqrt(1.0 + xf*xf + yf*yf);\n        l  = -n*yf;\n        m  =  n*xf;\n      } else if (yf < -1.0) {\n        // face = 5\n        yf = yf + 2.0;\n        n  = -1.0/sqrt(1.0 + xf*xf + yf*yf);\n        l  = -n*yf;\n        m  = -n*xf;\n      } else {\n        // face = 1\n        l  =  1.0/sqrt(1.0 + xf*xf + yf*yf);\n        m  =  l*xf;\n        n  =  l*yf;\n      }\n\n      if (l == 0.0 && m == 0.0) {\n        *phip = 0.0;\n      } else {\n        *phip = atan2d(m, l);\n      }\n\n      *thetap = asind(n);\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"tscx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint tscs2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int face, mphi, mtheta, rowlen, rowoff, status;\n  double cosphi, costhe, l, m, n, sinphi, sinthe, x0, xf, y0, yf, zeta;\n  const double tol = 1.0e-12;\n  register int iphi, istat, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != TSC) {\n    if ((status = tscset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n  status = 0;\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    sincosd(*phip, &sinphi, &cosphi);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = cosphi;\n      *yp = sinphi;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    sincosd(*thetap, &sinthe, &costhe);\n\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      l = costhe*(*xp);\n      m = costhe*(*yp);\n      n = sinthe;\n\n      face = 0;\n      zeta = n;\n      if (l > zeta) {\n        face = 1;\n        zeta = l;\n      }\n      if (m > zeta) {\n        face = 2;\n        zeta = m;\n      }\n      if (-l > zeta) {\n        face = 3;\n        zeta = -l;\n      }\n      if (-m > zeta) {\n        face = 4;\n        zeta = -m;\n      }\n      if (-n > zeta) {\n        face = 5;\n        zeta = -n;\n      }\n\n      switch (face) {\n      case 1:\n        xf =  m/zeta;\n        yf =  n/zeta;\n        x0 =  0.0;\n        y0 =  0.0;\n        break;\n      case 2:\n        xf = -l/zeta;\n        yf =  n/zeta;\n        x0 =  2.0;\n        y0 =  0.0;\n        break;\n      case 3:\n        xf = -m/zeta;\n        yf =  n/zeta;\n        x0 =  4.0;\n        y0 =  0.0;\n        break;\n      case 4:\n        xf =  l/zeta;\n        yf =  n/zeta;\n        x0 =  6.0;\n        y0 =  0.0;\n        break;\n      case 5:\n        xf =  m/zeta;\n        yf =  l/zeta;\n        x0 =  0.0;\n        y0 = -2.0;\n        break;\n      default:\n        // face == 0\n        xf =  m/zeta;\n        yf = -l/zeta;\n        x0 =  0.0;\n        y0 =  2.0;\n        break;\n      }\n\n      istat = 0;\n      if (fabs(xf) > 1.0) {\n        if (fabs(xf) > 1.0+tol) {\n          istat = 1;\n          if (!status) status = PRJERR_BAD_WORLD_SET(\"tscs2x\");\n        }\n        xf = copysign(1.0, xf);\n      }\n      if (fabs(yf) > 1.0) {\n        if (fabs(yf) > 1.0+tol) {\n          istat = 1;\n          if (!status) status = PRJERR_BAD_WORLD_SET(\"tscs2x\");\n        }\n        yf = copysign(1.0, yf);\n      }\n\n      *xp = prj->w[0]*(xf + x0) - prj->x0;\n      *yp = prj->w[0]*(yf + y0) - prj->y0;\n      *(statp++) = istat;\n    }\n  }\n\n  return status;\n}\n\n/*============================================================================\n*   CSC: COBE quadrilateralized spherical cube projection.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to 0.0 if undefined.\n*      prj->theta0  Reset to 0.0 if undefined.\n*\n*   Returned:\n*      prj->flag     CSC\n*      prj->code    \"CSC\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    r0*(pi/4)\n*      prj->w[1]    (4/pi)/r0\n*      prj->prjx2s  Pointer to cscx2s().\n*      prj->prjs2x  Pointer to cscs2x().\n*===========================================================================*/\n\nint cscset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = CSC;\n  strcpy(prj->code, \"CSC\");\n\n  strcpy(prj->name, \"COBE quadrilateralized spherical cube\");\n  prj->category  = QUADCUBE;\n  prj->pvrange   = 0;\n  prj->simplezen = 0;\n  prj->equiareal = 0;\n  prj->conformal = 0;\n  prj->global    = 1;\n  prj->divergent = 0;\n\n  if (prj->r0 == 0.0) {\n    prj->r0 = R2D;\n    prj->w[0] = 45.0;\n    prj->w[1] = 1.0/45.0;\n  } else {\n    prj->w[0] = prj->r0*PI/4.0;\n    prj->w[1] = 1.0/prj->w[0];\n  }\n\n  prj->prjx2s = cscx2s;\n  prj->prjs2x = cscs2x;\n\n  return prjoff(prj, 0.0, 0.0);\n}\n\n//----------------------------------------------------------------------------\n\nint cscx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int face, mx, my, rowlen, rowoff, status;\n  double l, m, n, t;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n  float chi, psi, xf, xx, yf, yy, z0, z1, z2, z3, z4, z5, z6;\n  const float p00 = -0.27292696f;\n  const float p10 = -0.07629969f;\n  const float p20 = -0.22797056f;\n  const float p30 =  0.54852384f;\n  const float p40 = -0.62930065f;\n  const float p50 =  0.25795794f;\n  const float p60 =  0.02584375f;\n  const float p01 = -0.02819452f;\n  const float p11 = -0.01471565f;\n  const float p21 =  0.48051509f;\n  const float p31 = -1.74114454f;\n  const float p41 =  1.71547508f;\n  const float p51 = -0.53022337f;\n  const float p02 =  0.27058160f;\n  const float p12 = -0.56800938f;\n  const float p22 =  0.30803317f;\n  const float p32 =  0.98938102f;\n  const float p42 = -0.83180469f;\n  const float p03 = -0.60441560f;\n  const float p13 =  1.50880086f;\n  const float p23 = -0.93678576f;\n  const float p33 =  0.08693841f;\n  const float p04 =  0.93412077f;\n  const float p14 = -1.41601920f;\n  const float p24 =  0.33887446f;\n  const float p05 = -0.63915306f;\n  const float p15 =  0.52032238f;\n  const float p06 =  0.14381585f;\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != CSC) {\n    if ((status = cscset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xf = (float)((*xp + prj->x0)*prj->w[1]);\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xf;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    yf = (float)((*yp + prj->y0)*prj->w[1]);\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xf = (float)(*phip);\n\n      // Bounds checking.\n      if (fabs((double)xf) <= 1.0) {\n        if (fabs((double)yf) > 3.0) {\n          *phip = 0.0;\n          *thetap = 0.0;\n          *(statp++) = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"cscx2s\");\n          continue;\n        }\n      } else {\n        if (fabs((double)xf) > 7.0 || fabs((double)yf) > 1.0) {\n          *phip = 0.0;\n          *thetap = 0.0;\n          *(statp++) = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"cscx2s\");\n          continue;\n        }\n      }\n\n      // Map negative faces to the other side.\n      if (xf < -1.0f) xf += 8.0f;\n\n      // Determine the face.\n      if (xf > 5.0f) {\n        face = 4;\n        xf = xf - 6.0f;\n      } else if (xf > 3.0f) {\n        face = 3;\n        xf = xf - 4.0f;\n      } else if (xf > 1.0f) {\n        face = 2;\n        xf = xf - 2.0f;\n      } else if (yf > 1.0f) {\n        face = 0;\n        yf = yf - 2.0f;\n      } else if (yf < -1.0f) {\n        face = 5;\n        yf = yf + 2.0f;\n      } else {\n        face = 1;\n      }\n\n      xx  =  xf*xf;\n      yy  =  yf*yf;\n\n      z0 = p00 + xx*(p10 + xx*(p20 + xx*(p30 + xx*(p40 + xx*(p50 +\n                 xx*(p60))))));\n      z1 = p01 + xx*(p11 + xx*(p21 + xx*(p31 + xx*(p41 + xx*(p51)))));\n      z2 = p02 + xx*(p12 + xx*(p22 + xx*(p32 + xx*(p42))));\n      z3 = p03 + xx*(p13 + xx*(p23 + xx*(p33)));\n      z4 = p04 + xx*(p14 + xx*(p24));\n      z5 = p05 + xx*(p15);\n      z6 = p06;\n\n      chi = z0 + yy*(z1 + yy*(z2 + yy*(z3 + yy*(z4 + yy*(z5 + yy*z6)))));\n      chi = xf + xf*(1.0f - xx)*chi;\n\n      z0 = p00 + yy*(p10 + yy*(p20 + yy*(p30 + yy*(p40 + yy*(p50 +\n                 yy*(p60))))));\n      z1 = p01 + yy*(p11 + yy*(p21 + yy*(p31 + yy*(p41 + yy*(p51)))));\n      z2 = p02 + yy*(p12 + yy*(p22 + yy*(p32 + yy*(p42))));\n      z3 = p03 + yy*(p13 + yy*(p23 + yy*(p33)));\n      z4 = p04 + yy*(p14 + yy*(p24));\n      z5 = p05 + yy*(p15);\n      z6 = p06;\n\n      psi = z0 + xx*(z1 + xx*(z2 + xx*(z3 + xx*(z4 + xx*(z5 + xx*z6)))));\n      psi = yf + yf*(1.0f - yy)*psi;\n\n      t = 1.0/sqrt((double)(chi*chi + psi*psi) + 1.0);\n      switch (face) {\n      case 1:\n        l =  t;\n        m =  chi*l;\n        n =  psi*l;\n        break;\n      case 2:\n        m =  t;\n        l = -chi*m;\n        n =  psi*m;\n        break;\n      case 3:\n        l = -t;\n        m =  chi*l;\n        n = -psi*l;\n        break;\n      case 4:\n        m = -t;\n        l = -chi*m;\n        n = -psi*m;\n        break;\n      case 5:\n        n = -t;\n        l = -psi*n;\n        m = -chi*n;\n        break;\n      default:\n        // face == 0\n        n =  t;\n        l = -psi*n;\n        m =  chi*n;\n        break;\n      }\n\n      if (l == 0.0 && m == 0.0) {\n        *phip = 0.0;\n      } else {\n        *phip = atan2d(m, l);\n      }\n\n      *thetap = asind(n);\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"cscx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint cscs2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int face, mphi, mtheta, rowlen, rowoff, status;\n  double cosphi, costhe, eta, l, m, n, sinphi, sinthe, xi, zeta;\n  const double tol = 1.0e-7;\n  register int iphi, istat, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n  float chi, chi2, chi2psi2, chi4, chipsi, psi, psi2, psi4, chi2co, psi2co,\n        x0, xf, y0, yf;\n  const float gstar  =  1.37484847732f;\n  const float mm     =  0.004869491981f;\n  const float gamma  = -0.13161671474f;\n  const float omega1 = -0.159596235474f;\n  const float d0  =  0.0759196200467f;\n  const float d1  = -0.0217762490699f;\n  const float c00 =  0.141189631152f;\n  const float c10 =  0.0809701286525f;\n  const float c01 = -0.281528535557f;\n  const float c11 =  0.15384112876f;\n  const float c20 = -0.178251207466f;\n  const float c02 =  0.106959469314f;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != CSC) {\n    if ((status = cscset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n  status = 0;\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    sincosd(*phip, &sinphi, &cosphi);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = cosphi;\n      *yp = sinphi;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    sincosd(*thetap, &sinthe, &costhe);\n\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      l = costhe*(*xp);\n      m = costhe*(*yp);\n      n = sinthe;\n\n      face = 0;\n      zeta = n;\n      if (l > zeta) {\n        face = 1;\n        zeta = l;\n      }\n      if (m > zeta) {\n        face = 2;\n        zeta = m;\n      }\n      if (-l > zeta) {\n        face = 3;\n        zeta = -l;\n      }\n      if (-m > zeta) {\n        face = 4;\n        zeta = -m;\n      }\n      if (-n > zeta) {\n        face = 5;\n        zeta = -n;\n      }\n\n      switch (face) {\n      case 1:\n        xi  =  m;\n        eta =  n;\n        x0  =  0.0;\n        y0  =  0.0;\n        break;\n      case 2:\n        xi  = -l;\n        eta =  n;\n        x0  =  2.0;\n        y0  =  0.0;\n        break;\n      case 3:\n        xi  = -m;\n        eta =  n;\n        x0  =  4.0;\n        y0  =  0.0;\n        break;\n      case 4:\n        xi  =  l;\n        eta =  n;\n        x0  =  6.0;\n        y0  =  0.0;\n        break;\n      case 5:\n        xi  =  m;\n        eta =  l;\n        x0  =  0.0;\n        y0  = -2.0;\n        break;\n      default:\n        // face == 0\n        xi  =  m;\n        eta = -l;\n        x0  =  0.0;\n        y0  =  2.0;\n        break;\n      }\n\n      chi = (float)( xi/zeta);\n      psi = (float)(eta/zeta);\n\n      chi2 = chi*chi;\n      psi2 = psi*psi;\n      chi2co = 1.0f - chi2;\n      psi2co = 1.0f - psi2;\n\n      // Avoid floating underflows.\n      chipsi = (float)fabs((double)(chi*psi));\n      chi4   = (chi2 > 1.0e-16f) ? chi2*chi2 : 0.0f;\n      psi4   = (psi2 > 1.0e-16f) ? psi2*psi2 : 0.0f;\n      chi2psi2 = (chipsi > 1.0e-16f) ? chi2*psi2 : 0.0f;\n\n      xf = chi*(chi2 + chi2co*(gstar + psi2*(gamma*chi2co + mm*chi2 +\n                psi2co*(c00 + c10*chi2 + c01*psi2 + c11*chi2psi2 + c20*chi4 +\n                c02*psi4)) + chi2*(omega1 - chi2co*(d0 + d1*chi2))));\n      yf = psi*(psi2 + psi2co*(gstar + chi2*(gamma*psi2co + mm*psi2 +\n                chi2co*(c00 + c10*psi2 + c01*chi2 + c11*chi2psi2 + c20*psi4 +\n                c02*chi4)) + psi2*(omega1 - psi2co*(d0 + d1*psi2))));\n\n      istat = 0;\n      if (fabs((double)xf) > 1.0) {\n        if (fabs((double)xf) > 1.0+tol) {\n          istat = 1;\n          if (!status) status = PRJERR_BAD_WORLD_SET(\"cscs2x\");\n        }\n        xf = (float)copysign(1.0, (double)xf);\n      }\n      if (fabs((double)yf) > 1.0) {\n        if (fabs((double)yf) > 1.0+tol) {\n          istat = 1;\n          if (!status) status = PRJERR_BAD_WORLD_SET(\"cscs2x\");\n        }\n        yf = (float)copysign(1.0, (double)yf);\n      }\n\n      *xp = prj->w[0]*(xf + x0) - prj->x0;\n      *yp = prj->w[0]*(yf + y0) - prj->y0;\n      *(statp++) = istat;\n    }\n  }\n\n  return status;\n}\n\n/*============================================================================\n*   QSC: quadrilaterilized spherical cube projection.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to 0.0 if undefined.\n*      prj->theta0  Reset to 0.0 if undefined.\n*\n*   Returned:\n*      prj->flag     QSC\n*      prj->code    \"QSC\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    r0*(pi/4)\n*      prj->w[1]    (4/pi)/r0\n*      prj->prjx2s  Pointer to qscx2s().\n*      prj->prjs2x  Pointer to qscs2x().\n*===========================================================================*/\n\nint qscset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = QSC;\n  strcpy(prj->code, \"QSC\");\n\n  strcpy(prj->name, \"quadrilateralized spherical cube\");\n  prj->category  = QUADCUBE;\n  prj->pvrange   = 0;\n  prj->simplezen = 0;\n  prj->equiareal = 1;\n  prj->conformal = 0;\n  prj->global    = 1;\n  prj->divergent = 0;\n\n  if (prj->r0 == 0.0) {\n    prj->r0 = R2D;\n    prj->w[0] = 45.0;\n    prj->w[1] = 1.0/45.0;\n  } else {\n    prj->w[0] = prj->r0*PI/4.0;\n    prj->w[1] = 1.0/prj->w[0];\n  }\n\n  prj->prjx2s = qscx2s;\n  prj->prjs2x = qscs2x;\n\n  return prjoff(prj, 0.0, 0.0);\n}\n\n//----------------------------------------------------------------------------\n\nint qscx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int direct, face, mx, my, rowlen, rowoff, status;\n  double cosw, l, m, n, omega, sinw, tau, xf, yf, w, zeco, zeta;\n  const double tol = 1.0e-12;\n  register int ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != QSC) {\n    if ((status = qscset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xf = (*xp + prj->x0)*prj->w[1];\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xf;\n      phip += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    yf = (*yp + prj->y0)*prj->w[1];\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xf = *phip;\n\n      // Bounds checking.\n      if (fabs(xf) <= 1.0) {\n        if (fabs(yf) > 3.0) {\n          *phip = 0.0;\n          *thetap = 0.0;\n          *(statp++) = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"qscx2s\");\n          continue;\n        }\n      } else {\n        if (fabs(xf) > 7.0 || fabs(yf) > 1.0) {\n          *phip = 0.0;\n          *thetap = 0.0;\n          *(statp++) = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"qscx2s\");\n          continue;\n        }\n      }\n\n      // Map negative faces to the other side.\n      if (xf < -1.0) xf += 8.0;\n\n      // Determine the face.\n      if (xf > 5.0) {\n        face = 4;\n        xf -= 6.0;\n      } else if (xf > 3.0) {\n        face = 3;\n        xf -= 4.0;\n      } else if (xf > 1.0) {\n        face = 2;\n        xf -= 2.0;\n      } else if (yf > 1.0) {\n        face = 0;\n        yf -= 2.0;\n      } else if (yf < -1.0) {\n        face = 5;\n        yf += 2.0;\n      } else {\n        face = 1;\n      }\n\n      direct = (fabs(xf) > fabs(yf));\n      if (direct) {\n        if (xf == 0.0) {\n          omega = 0.0;\n          tau  = 1.0;\n          zeta = 1.0;\n          zeco = 0.0;\n        } else {\n          w = 15.0*yf/xf;\n          omega = sind(w)/(cosd(w) - SQRT2INV);\n          tau  = 1.0 + omega*omega;\n          zeco = xf*xf*(1.0 - 1.0/sqrt(1.0 + tau));\n          zeta = 1.0 - zeco;\n        }\n      } else {\n        if (yf == 0.0) {\n          omega = 0.0;\n          tau  = 1.0;\n          zeta = 1.0;\n          zeco = 0.0;\n        } else {\n          w = 15.0*xf/yf;\n          sincosd(w, &sinw, &cosw);\n          omega = sinw/(cosw - SQRT2INV);\n          tau  = 1.0 + omega*omega;\n          zeco = yf*yf*(1.0 - 1.0/sqrt(1.0 + tau));\n          zeta = 1.0 - zeco;\n        }\n      }\n\n      if (zeta < -1.0) {\n        if (zeta < -1.0-tol) {\n          *phip = 0.0;\n          *thetap = 0.0;\n          *(statp++) = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"qscx2s\");\n          continue;\n        }\n\n        zeta = -1.0;\n        zeco =  2.0;\n        w    =  0.0;\n      } else {\n        w = sqrt(zeco*(2.0-zeco)/tau);\n      }\n\n      switch (face) {\n      case 1:\n        l = zeta;\n        if (direct) {\n          m = w;\n          if (xf < 0.0) m = -m;\n          n = m*omega;\n        } else {\n          n = w;\n          if (yf < 0.0) n = -n;\n          m = n*omega;\n        }\n        break;\n      case 2:\n        m = zeta;\n        if (direct) {\n          l = w;\n          if (xf > 0.0) l = -l;\n          n = -l*omega;\n        } else {\n          n = w;\n          if (yf < 0.0) n = -n;\n          l = -n*omega;\n        }\n        break;\n      case 3:\n        l = -zeta;\n        if (direct) {\n          m = w;\n          if (xf > 0.0) m = -m;\n          n = -m*omega;\n        } else {\n          n = w;\n          if (yf < 0.0) n = -n;\n          m = -n*omega;\n        }\n        break;\n      case 4:\n        m = -zeta;\n        if (direct) {\n          l = w;\n          if (xf < 0.0) l = -l;\n          n = l*omega;\n        } else {\n          n = w;\n          if (yf < 0.0) n = -n;\n          l = n*omega;\n        }\n        break;\n      case 5:\n        n = -zeta;\n        if (direct) {\n          m = w;\n          if (xf < 0.0) m = -m;\n          l = m*omega;\n        } else {\n          l = w;\n          if (yf < 0.0) l = -l;\n          m = l*omega;\n        }\n        break;\n      default:\n        // face == 0\n        n = zeta;\n        if (direct) {\n          m = w;\n          if (xf < 0.0) m = -m;\n          l = -m*omega;\n        } else {\n          l = w;\n          if (yf > 0.0) l = -l;\n          m = -l*omega;\n        }\n        break;\n      }\n\n      if (l == 0.0 && m == 0.0) {\n        *phip = 0.0;\n      } else {\n        *phip = atan2d(m, l);\n      }\n\n      *thetap = asind(n);\n      *(statp++) = 0;\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"qscx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint qscs2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int face, mphi, mtheta, rowlen, rowoff, status;\n  double cosphi, costhe, eta, l, m, n, omega, p, sinphi, sinthe, t, tau, x0,\n         xf, xi, y0, yf, zeco, zeta;\n  const double tol = 1.0e-12;\n  register int iphi, istat, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != QSC) {\n    if ((status = qscset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n  status = 0;\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    sincosd(*phip, &sinphi, &cosphi);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      *xp = cosphi;\n      *yp = sinphi;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    sincosd(*thetap, &sinthe, &costhe);\n\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      if (fabs(*thetap) == 90.0) {\n        *xp = -prj->x0;\n        *yp = copysign(2.0*prj->w[0], *thetap) - prj->y0;\n        *(statp++) = 0;\n        continue;\n      }\n\n      l = costhe*(*xp);\n      m = costhe*(*yp);\n      n = sinthe;\n\n      face = 0;\n      zeta = n;\n      if (l > zeta) {\n        face = 1;\n        zeta = l;\n      }\n      if (m > zeta) {\n        face = 2;\n        zeta = m;\n      }\n      if (-l > zeta) {\n        face = 3;\n        zeta = -l;\n      }\n      if (-m > zeta) {\n        face = 4;\n        zeta = -m;\n      }\n      if (-n > zeta) {\n        face = 5;\n        zeta = -n;\n      }\n\n      zeco = 1.0 - zeta;\n\n      switch (face) {\n      case 1:\n        xi  = m;\n        eta = n;\n        if (zeco < 1.0e-8) {\n          // Small angle formula.\n          t = (*thetap)*D2R;\n          p = atan2(*yp, *xp);\n          zeco = (p*p + t*t)/2.0;\n        }\n        x0 = 0.0;\n        y0 = 0.0;\n        break;\n      case 2:\n        xi  = -l;\n        eta =  n;\n        if (zeco < 1.0e-8) {\n          // Small angle formula.\n          t = (*thetap)*D2R;\n          p = atan2(*yp, *xp) - PI/2.0;\n          zeco = (p*p + t*t)/2.0;\n        }\n        x0 = 2.0;\n        y0 = 0.0;\n        break;\n      case 3:\n        xi  = -m;\n        eta =  n;\n        if (zeco < 1.0e-8) {\n          // Small angle formula.\n          t = (*thetap)*D2R;\n          p = atan2(*yp, *xp);\n          p -= copysign(PI, p);\n          zeco = (p*p + t*t)/2.0;\n        }\n        x0 = 4.0;\n        y0 = 0.0;\n        break;\n      case 4:\n        xi  = l;\n        eta = n;\n        if (zeco < 1.0e-8) {\n          // Small angle formula.\n          t = (*thetap)*D2R;\n          p = atan2(*yp, *xp) + PI/2.0;\n          zeco = (p*p + t*t)/2.0;\n        }\n        x0 = 6;\n        y0 = 0.0;\n        break;\n      case 5:\n        xi  =  m;\n        eta =  l;\n        if (zeco < 1.0e-8) {\n          // Small angle formula.\n          t = (*thetap + 90.0)*D2R;\n          zeco = t*t/2.0;\n        }\n        x0 =  0.0;\n        y0 = -2;\n         break;\n      default:\n        // face == 0\n        xi  =  m;\n        eta = -l;\n        if (zeco < 1.0e-8) {\n          // Small angle formula.\n          t = (90.0 - *thetap)*D2R;\n          zeco = t*t/2.0;\n        }\n        x0 = 0.0;\n        y0 = 2.0;\n        break;\n      }\n\n      xf = 0.0;\n      yf = 0.0;\n      if (xi != 0.0 || eta != 0.0) {\n        if (-xi > fabs(eta)) {\n          omega = eta/xi;\n          tau = 1.0 + omega*omega;\n          xf  = -sqrt(zeco/(1.0 - 1.0/sqrt(1.0+tau)));\n          yf  = (xf/15.0)*(atand(omega) - asind(omega/sqrt(tau+tau)));\n        } else if (xi > fabs(eta)) {\n          omega = eta/xi;\n          tau = 1.0 + omega*omega;\n          xf  =  sqrt(zeco/(1.0 - 1.0/sqrt(1.0+tau)));\n          yf  = (xf/15.0)*(atand(omega) - asind(omega/sqrt(tau+tau)));\n        } else if (-eta >= fabs(xi)) {\n          omega = xi/eta;\n          tau = 1.0 + omega*omega;\n          yf  = -sqrt(zeco/(1.0 - 1.0/sqrt(1.0+tau)));\n          xf  = (yf/15.0)*(atand(omega) - asind(omega/sqrt(tau+tau)));\n        } else if (eta >= fabs(xi)) {\n          omega = xi/eta;\n          tau = 1.0 + omega*omega;\n          yf  =  sqrt(zeco/(1.0 - 1.0/sqrt(1.0+tau)));\n          xf  = (yf/15.0)*(atand(omega) - asind(omega/sqrt(tau+tau)));\n        }\n      }\n\n      istat = 0;\n      if (fabs(xf) > 1.0) {\n        if (fabs(xf) > 1.0+tol) {\n          istat = 1;\n          if (!status) status = PRJERR_BAD_WORLD_SET(\"qscs2x\");\n        }\n        xf = copysign(1.0, xf);\n      }\n      if (fabs(yf) > 1.0) {\n        if (fabs(yf) > 1.0+tol) {\n          istat = 1;\n          if (!status) status = PRJERR_BAD_WORLD_SET(\"qscs2x\");\n        }\n        yf = copysign(1.0, yf);\n      }\n\n      *xp = prj->w[0]*(xf + x0) - prj->x0;\n      *yp = prj->w[0]*(yf + y0) - prj->y0;\n      *(statp++) = istat;\n    }\n  }\n\n  return status;\n}\n\n/*============================================================================\n*   HPX: HEALPix projection.\n*\n*   Given:\n*      prj->pv[1]   H - the number of facets in longitude.\n*      prj->pv[2]   K - the number of facets in latitude\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to 0.0 if undefined.\n*      prj->theta0  Reset to 0.0 if undefined.\n*\n*   Returned:\n*      prj->flag     HPX\n*      prj->code    \"HPX\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->m       True if H is odd.\n*      prj->n       True if K is odd.\n*      prj->w[0]    r0*(pi/180)\n*      prj->w[1]    (180/pi)/r0\n*      prj->w[2]    (K-1)/K\n*      prj->w[3]    90*K/H\n*      prj->w[4]    (K+1)/2\n*      prj->w[5]    90*(K-1)/H\n*      prj->w[6]    180/H\n*      prj->w[7]    H/360\n*      prj->w[8]    r0*(pi/180)*(90*K/H)\n*      prj->w[9]    r0*(pi/180)*(180/H)\n*      prj->prjx2s  Pointer to hpxx2s().\n*      prj->prjs2x  Pointer to hpxs2x().\n*===========================================================================*/\n\nint hpxset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = HPX;\n  strcpy(prj->code, \"HPX\");\n\n  if (undefined(prj->pv[1])) prj->pv[1] = 4.0;\n  if (undefined(prj->pv[2])) prj->pv[2] = 3.0;\n\n  strcpy(prj->name, \"HEALPix\");\n  prj->category  = HEALPIX;\n  prj->pvrange   = 102;\n  prj->simplezen = 0;\n  prj->equiareal = 1;\n  prj->conformal = 0;\n  prj->global    = 1;\n  prj->divergent = 0;\n\n  if (prj->pv[1] <= 0.0 || prj->pv[2] <= 0.0) {\n    return PRJERR_BAD_PARAM_SET(\"hpxset\");\n  }\n\n  prj->m = ((int)(prj->pv[1]+0.5))%2;\n  prj->n = ((int)(prj->pv[2]+0.5))%2;\n\n  if (prj->r0 == 0.0) {\n    prj->r0 = R2D;\n    prj->w[0] = 1.0;\n    prj->w[1] = 1.0;\n  } else {\n    prj->w[0] = prj->r0*D2R;\n    prj->w[1] = R2D/prj->r0;\n  }\n\n  prj->w[2] = (prj->pv[2] - 1.0) / prj->pv[2];\n  prj->w[3] = 90.0 * prj->pv[2] / prj->pv[1];\n  prj->w[4] = (prj->pv[2] + 1.0) / 2.0;\n  prj->w[5] = 90.0 * (prj->pv[2] - 1.0) / prj->pv[1];\n  prj->w[6] = 180.0 / prj->pv[1];\n  prj->w[7] = prj->pv[1] / 360.0;\n  prj->w[8] = prj->w[3] * prj->w[0];\n  prj->w[9] = prj->w[6] * prj->w[0];\n\n  prj->prjx2s = hpxx2s;\n  prj->prjs2x = hpxs2x;\n\n  return prjoff(prj, 0.0, 0.0);\n}\n\n//----------------------------------------------------------------------------\n\nint hpxx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int h, mx, my, offset, rowlen, rowoff, status;\n  double absy, r, s, sigma, slim, t, ylim, yr;\n  register int istat, ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != HPX) {\n    if ((status = hpxset(prj))) return status;\n  }\n\n  slim = prj->w[6] + 1e-12;\n  ylim = prj->w[9] * prj->w[4];\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    s = prj->w[1] * (*xp + prj->x0);\n    // x_c for K odd or theta > 0.\n    t = -180.0 + (2.0 * floor((*xp + 180.0) * prj->w[7]) + 1.0) * prj->w[6];\n    t = prj->w[1] * (*xp - t);\n\n    phip   = phi + rowoff;\n    thetap = theta + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      // theta[] is used to hold (x - x_c).\n      *phip   = s;\n      *thetap = t;\n      phip   += rowlen;\n      thetap += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    yr = prj->w[1]*(*yp + prj->y0);\n    absy = fabs(yr);\n\n    istat = 0;\n    if (absy <= prj->w[5]) {\n      // Equatorial regime.\n      t = asind(yr/prj->w[3]);\n      for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n        *thetap = t;\n        *(statp++) = 0;\n      }\n\n    } else if (absy <= ylim) {\n      // Polar regime.\n      offset = (prj->n || *yp > 0.0) ? 0 : 1;\n\n      sigma = prj->w[4] - absy / prj->w[6];\n\n      if (sigma == 0.0) {\n        s = 1e9;\n        t = 90.0;\n\n      } else {\n        t = 1.0 - sigma*sigma/prj->pv[2];\n        if (t < -1.0) {\n          s = 0.0;\n          t = 0.0;\n          istat = 1;\n          if (!status) status = PRJERR_BAD_PIX_SET(\"hpxx2s\");\n        } else {\n          s = 1.0/sigma;\n          t = asind(t);\n        }\n      }\n      if (*yp < 0.0) t = -t;\n\n      for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n        if (offset) {\n          // Offset the southern polar half-facets for even K.\n          h = (int)floor(*phip / prj->w[6]) + prj->m;\n          if (h%2) {\n            *thetap -= prj->w[6];\n          } else {\n            *thetap += prj->w[6];\n          }\n        }\n\n        // Recall that theta[] holds (x - x_c).\n        r = s * *thetap;\n\n        // Bounds checking.\n        if (prj->bounds&2) {\n          if (slim <= fabs(r)) {\n            istat = 1;\n            if (!status) status = PRJERR_BAD_PIX_SET(\"hpxx2s\");\n          }\n        }\n\n        if (r != 0.0) r -= *thetap;\n        *phip  += r;\n        *thetap = t;\n\n        *(statp++) = istat;\n      }\n\n    } else {\n      // Beyond latitude range.\n      for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n        *phip   = 0.0;\n        *thetap = 0.0;\n        *(statp++) = 1;\n      }\n      if (!status) status = PRJERR_BAD_PIX_SET(\"hpxx2s\");\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-12, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"hpxx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint hpxs2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int h, mphi, mtheta, offset, rowlen, rowoff, status;\n  double abssin, eta, sigma, sinthe, t, xi;\n  register int iphi, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != HPX) {\n    if ((status = hpxset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    xi = prj->w[0] * (*phip) - prj->x0;\n\n    // phi_c for K odd or theta > 0.\n    t = -180.0 + (2.0*floor((*phip+180.0) * prj->w[7]) + 1.0) * prj->w[6];\n    t = prj->w[0] * (*phip - t);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      // y[] is used to hold (phi - phi_c).\n      *xp = xi;\n      *yp = t;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    sinthe = sind(*thetap);\n    abssin = fabs(sinthe);\n\n    if (abssin <= prj->w[2]) {\n      // Equatorial regime.\n      eta = prj->w[8] * sinthe - prj->y0;\n      for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n        *yp = eta;\n        *(statp++) = 0;\n      }\n\n    } else {\n      // Polar regime.\n      offset = (prj->n || *thetap > 0.0) ? 0 : 1;\n\n      sigma = sqrt(prj->pv[2]*(1.0 - abssin));\n      xi = sigma - 1.0;\n\n      eta = prj->w[9] * (prj->w[4] - sigma);\n      if (*thetap < 0) eta = -eta;\n      eta -= prj->y0;\n\n      for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n        if (offset) {\n          // Offset the southern polar half-facets for even K.\n          h = (int)floor((*xp + prj->x0) / prj->w[9]) + prj->m;\n          if (h%2) {\n            *yp -= prj->w[9];\n          } else {\n            *yp += prj->w[9];\n          }\n        }\n\n        // Recall that y[] holds (phi - phi_c).\n        *xp += *yp * xi;\n        *yp = eta;\n        *(statp++) = 0;\n\n        // Put the phi = 180 meridian in the expected place.\n        if (180.0 < *xp) *xp = 360.0 - *xp;\n      }\n    }\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   XPH: HEALPix polar, aka \"butterfly\" projection.\n*\n*   Given and/or returned:\n*      prj->r0      Reset to 180/pi if 0.\n*      prj->phi0    Reset to 0.0 if undefined.\n*      prj->theta0  Reset to 0.0 if undefined.\n*\n*   Returned:\n*      prj->flag     XPH\n*      prj->code    \"XPH\"\n*      prj->x0      Fiducial offset in x.\n*      prj->y0      Fiducial offset in y.\n*      prj->w[0]    r0*(pi/180)/sqrt(2)\n*      prj->w[1]    (180/pi)/r0/sqrt(2)\n*      prj->w[2]    2/3\n*      prj->w[3]    tol (= 1e-4)\n*      prj->w[4]    sqrt(2/3)*(180/pi)\n*      prj->w[5]    90 - tol*sqrt(2/3)*(180/pi)\n*      prj->w[6]    sqrt(3/2)*(pi/180)\n*      prj->prjx2s  Pointer to xphx2s().\n*      prj->prjs2x  Pointer to xphs2x().\n*===========================================================================*/\n\nint xphset(struct prjprm *prj)\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  prj->flag = XPH;\n  strcpy(prj->code, \"XPH\");\n\n  strcpy(prj->name, \"butterfly\");\n  prj->category  = HEALPIX;\n  prj->pvrange   = 0;\n  prj->simplezen = 0;\n  prj->equiareal = 1;\n  prj->conformal = 0;\n  prj->global    = 1;\n  prj->divergent = 0;\n\n  if (prj->r0 == 0.0) {\n    prj->r0 = R2D;\n    prj->w[0] = 1.0;\n    prj->w[1] = 1.0;\n  } else {\n    prj->w[0] = prj->r0*D2R;\n    prj->w[1] = R2D/prj->r0;\n  }\n\n  prj->w[0] /= sqrt(2.0);\n  prj->w[1] /= sqrt(2.0);\n  prj->w[2]  = 2.0/3.0;\n  prj->w[3]  = 1e-4;\n  prj->w[4]  = sqrt(prj->w[2])*R2D;\n  prj->w[5]  = 90.0 - prj->w[3]*prj->w[4];\n  prj->w[6]  = sqrt(1.5)*D2R;\n\n  prj->prjx2s = xphx2s;\n  prj->prjs2x = xphs2x;\n\n  return prjoff(prj, 0.0, 90.0);\n}\n\n//----------------------------------------------------------------------------\n\nint xphx2s(\n  struct prjprm *prj,\n  int nx,\n  int ny,\n  int sxy,\n  int spt,\n  const double x[],\n  const double y[],\n  double phi[],\n  double theta[],\n  int stat[])\n\n{\n  int mx, my, rowlen, rowoff, status;\n  double abseta, eta, eta1, sigma, xi, xi1, xr, yr;\n  const double tol = 1.0e-12;\n  register int istat, ix, iy, *statp;\n  register const double *xp, *yp;\n  register double *phip, *thetap;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != XPH) {\n    if ((status = xphset(prj))) return status;\n  }\n\n  if (ny > 0) {\n    mx = nx;\n    my = ny;\n  } else {\n    mx = 1;\n    my = 1;\n    ny = nx;\n  }\n\n  status = 0;\n\n\n  // Do x dependence.\n  xp = x;\n  rowoff = 0;\n  rowlen = nx*spt;\n  for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) {\n    xr = (*xp + prj->x0)*prj->w[1];\n\n    phip = phi + rowoff;\n    for (iy = 0; iy < my; iy++) {\n      *phip = xr;\n      phip  += rowlen;\n    }\n  }\n\n\n  // Do y dependence.\n  yp = y;\n  phip   = phi;\n  thetap = theta;\n  statp  = stat;\n  for (iy = 0; iy < ny; iy++, yp += sxy) {\n    yr = (*yp + prj->y0)*prj->w[1];\n\n    for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) {\n      xr = *phip;\n\n      if (xr <= 0.0 && 0.0 < yr) {\n        xi1  = -xr - yr;\n        eta1 =  xr - yr;\n        *phip = -180.0;\n      } else if (xr < 0.0 && yr <= 0.0) {\n        xi1  =  xr - yr;\n        eta1 =  xr + yr;\n        *phip = -90.0;\n      } else if (0.0 <= xr && yr < 0.0) {\n        xi1  =  xr + yr;\n        eta1 = -xr + yr;\n        *phip = 0.0;\n      } else {\n        xi1  = -xr + yr;\n        eta1 = -xr - yr;\n        *phip = 90.0;\n      }\n\n      xi  = xi1  + 45.0;\n      eta = eta1 + 90.0;\n      abseta = fabs(eta);\n\n      if (abseta <= 90.0) {\n        if (abseta <= 45.0) {\n          // Equatorial regime.\n          *phip  += xi;\n          *thetap = asind(eta/67.5);\n          istat = 0;\n\n          // Bounds checking.\n          if (prj->bounds&2) {\n            if (45.0+tol < fabs(xi1)) {\n              istat = 1;\n              if (!status) status = PRJERR_BAD_PIX_SET(\"xphx2s\");\n            }\n          }\n\n          *(statp++) = istat;\n\n        } else {\n          // Polar regime.\n          sigma = (90.0 - abseta) / 45.0;\n\n          // Ensure an exact result for points on the boundary.\n          if (xr == 0.0) {\n            if (yr <= 0.0) {\n              *phip = 0.0;\n            } else {\n              *phip = 180.0;\n            }\n          } else if (yr == 0.0) {\n            if (xr < 0.0) {\n              *phip = -90.0;\n            } else {\n              *phip =  90.0;\n            }\n          } else {\n            *phip += 45.0 + xi1/sigma;\n          }\n\n          if (sigma < prj->w[3]) {\n            *thetap = 90.0 - sigma*prj->w[4];\n          } else {\n            *thetap = asind(1.0 - sigma*sigma/3.0);\n          }\n          if (eta < 0.0) *thetap = -(*thetap);\n\n          // Bounds checking.\n          istat = 0;\n          if (prj->bounds&2) {\n            if (eta < -45.0 && eta+90.0+tol < fabs(xi1)) {\n              istat = 1;\n              if (!status) status = PRJERR_BAD_PIX_SET(\"xphx2s\");\n            }\n          }\n\n          *(statp++) = istat;\n        }\n\n      } else {\n        // Beyond latitude range.\n        *phip   = 0.0;\n        *thetap = 0.0;\n        *(statp++) = 1;\n        if (!status) status = PRJERR_BAD_PIX_SET(\"xphx2s\");\n      }\n    }\n  }\n\n\n  // Do bounds checking on the native coordinates.\n  if (prj->bounds&4 && prjbchk(1.0e-12, nx, my, spt, phi, theta, stat)) {\n    if (!status) status = PRJERR_BAD_PIX_SET(\"xphx2s\");\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint xphs2x(\n  struct prjprm *prj,\n  int nphi,\n  int ntheta,\n  int spt,\n  int sxy,\n  const double phi[],\n  const double theta[],\n  double x[],\n  double y[],\n  int stat[])\n\n{\n  int mphi, mtheta, rowlen, rowoff, status;\n  double abssin, chi, eta, psi, sigma, sinthe, xi;\n  register int iphi, itheta, *statp;\n  register const double *phip, *thetap;\n  register double *xp, *yp;\n\n\n  // Initialize.\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n  if (prj->flag != XPH) {\n    if ((status = xphset(prj))) return status;\n  }\n\n  if (ntheta > 0) {\n    mphi   = nphi;\n    mtheta = ntheta;\n  } else {\n    mphi   = 1;\n    mtheta = 1;\n    ntheta = nphi;\n  }\n\n\n  // Do phi dependence.\n  phip = phi;\n  rowoff = 0;\n  rowlen = nphi*sxy;\n  for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) {\n    chi = *phip;\n    if (180.0 <= fabs(chi)) {\n      chi = fmod(chi, 360.0);\n      if (chi < -180.0) {\n        chi += 360.0;\n      } else if (180.0 <= chi) {\n        chi -= 360.0;\n      }\n    }\n\n    // phi is also recomputed from chi to avoid rounding problems.\n    chi += 180.0;\n    psi = fmod(chi, 90.0);\n\n    xp = x + rowoff;\n    yp = y + rowoff;\n    for (itheta = 0; itheta < mtheta; itheta++) {\n      // y[] is used to hold phi (rounded).\n      *xp = psi;\n      *yp = chi - 180.0;\n      xp += rowlen;\n      yp += rowlen;\n    }\n  }\n\n\n  // Do theta dependence.\n  thetap = theta;\n  xp = x;\n  yp = y;\n  statp = stat;\n  for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) {\n    sinthe = sind(*thetap);\n    abssin = fabs(sinthe);\n\n    for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) {\n      if (abssin <= prj->w[2]) {\n        // Equatorial regime.\n        xi  = *xp;\n        eta = 67.5 * sinthe;\n\n      } else {\n        // Polar regime.\n        if (*thetap < prj->w[5]) {\n          sigma = sqrt(3.0*(1.0 - abssin));\n        } else {\n          sigma = (90.0 - *thetap)*prj->w[6];\n        }\n\n        xi  = 45.0 + (*xp - 45.0)*sigma;\n        eta = 45.0 * (2.0 - sigma);\n        if (*thetap < 0.0) eta = -eta;\n      }\n\n      xi  -= 45.0;\n      eta -= 90.0;\n\n      // Recall that y[] holds phi.\n      if (*yp < -90.0) {\n        *xp = prj->w[0]*(-xi + eta) - prj->x0;\n        *yp = prj->w[0]*(-xi - eta) - prj->y0;\n\n      } else if (*yp <  0.0) {\n        *xp = prj->w[0]*(+xi + eta) - prj->x0;\n        *yp = prj->w[0]*(-xi + eta) - prj->y0;\n\n      } else if (*yp < 90.0) {\n        *xp = prj->w[0]*( xi - eta) - prj->x0;\n        *yp = prj->w[0]*( xi + eta) - prj->y0;\n\n      } else {\n        *xp = prj->w[0]*(-xi - eta) - prj->x0;\n        *yp = prj->w[0]*( xi - eta) - prj->y0;\n      }\n\n      *(statp++) = 0;\n    }\n  }\n\n  return 0;\n}\n"},{"id":16597,"name":"wcsulex.l","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsulex.l,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* wcsulex.l is a Flex description file containing the definition of a\n* recursive, multi-buffered lexical scanner and parser for FITS units\n* specifications.\n*\n* It requires Flex v2.5.4 or later.\n*\n* Refer to wcsunits.h for a description of the user interface and operating\n* notes.\n*\n*===========================================================================*/\n\n/* Options. */\n%option full\n%option never-interactive\n%option noinput\n%option noyywrap\n%option outfile=\"wcsulex.c\"\n%option prefix=\"wcsulex\"\n%option reentrant\n%option extra-type=\"struct wcsulex_extra *\"\n\n/* Exponents. */\nINTEGER\t  [+-]?[1-9][0-9]*\nFRAC\t  {INTEGER}\"/\"[1-9][0-9]*\nFLOAT\t  [+-]?([0-9]+\\.?[0-9]*|\\.[0-9]+)\n\n/* Metric prefixes. */\nSUB3\t  [munpfazy]\nSUBPREFIX [dc]|{SUB3}\nSUP3\t  [kMGTPEZY]\nSUPPREFIX da|h|{SUP3}\nPREFIX\t  {SUBPREFIX}|{SUPPREFIX}\n\n/* Basic and derived SI units. */\nBASIC\t  m|s|g|rad|sr|K|A|mol|cd\nDERIVED\t  Hz|J|W|V|N|Pa|C|[Oo]hm|S|F|Wb|T|H|lm|lx\nSI_UNIT\t  {BASIC}|{DERIVED}\n\n/* Additional recognized units: all metric prefixes allowed. */\nADD_ALL\t  eV|Jy|R|G|barn\n\n/* Additional recognized units: only super-metric prefixes allowed. */\nADD_SUP\t  a|yr|pc|bit|[bB]yte\n\n/* Additional recognized units: only sub-metric prefixes allowed. */\nADD_SUB\t  mag\n\n/* Additional recognized units for which NO metric prefixes are allowed. */\nGENERAL\t  deg|arcmin|arcsec|mas|turn|min|h|d|cy|erg|Ry|u|D\nASTRO\t  [Aa]ngstrom|AU|lyr|beam|solRad|solMass|solLum|Sun\nDEVICE\t  adu|bin|chan|count|ct|photon|ph|pixel|pix|voxel\nADD_NONE  {GENERAL}|{ASTRO}|{DEVICE}\n\n/* All additional recognized units. */\nADD_UNIT  {ADD_ALL}|{ADD_SUP}|{ADD_SUB}|{ADD_NONE}\n\n/* Exclusive start states. */\n%x PAREN PREFIX UNITS EXPON FLUSH\n\n%{\n#include <math.h>\n#include <setjmp.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n#include \"wcserr.h\"\n#include \"wcsmath.h\"\n#include \"wcsunits.h\"\n#include \"wcsutil.h\"\n\n// User data associated with yyscanner.\nstruct wcsulex_extra {\n  // Used in preempting the call to exit() by yy_fatal_error().\n  jmp_buf abort_jmp_env;\n};\n\n#define YY_DECL int wcsulexe_scanner(const char unitstr[], int *func, \\\n double *scale, double units[WCSUNITS_NTYPE], struct wcserr **err, \\\n yyscan_t yyscanner)\n\n// Dummy definition to circumvent compiler warnings.\n#define YY_INPUT(inbuff, count, bufsize) { count = YY_NULL; }\n\n// Preempt the call to exit() by yy_fatal_error().\n#define exit(status) longjmp(yyextra->abort_jmp_env, status);\n\n// Internal helper functions.\nstatic YY_DECL;\n\n%}\n\n%%\n\tstatic const char *function = \"wcsulexe_scanner\";\n\t\n\tvoid add(double *factor, double types[], double *expon, double *scale,\n\t    double units[]);\n\t\n\t// Initialise returned values.\n\t*func  = 0;\n\t*scale = 1.0;\n\t\n\tfor (int i = 0; i < WCSUNITS_NTYPE; i++) {\n\t  units[i] = 0.0;\n\t}\n\t\n\tif (err) *err = 0x0;\n\t\n\tdouble types[WCSUNITS_NTYPE];\n\tfor (int i = 0; i < WCSUNITS_NTYPE; i++) {\n\t  types[i] = 0.0;\n\t}\n\tdouble expon  = 1.0;\n\tdouble factor = 1.0;\n\t\n\tint bracket  = 0;\n\tint operator = 0;\n\tint paren    = 0;\n\tint status   = 0;\n\t\n\t// Avert a flex-induced memory leak.\n\tif (YY_CURRENT_BUFFER && YY_CURRENT_BUFFER->yy_input_file == stdin) {\n\t  yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);\n\t}\n\t\n\tyy_scan_string(unitstr, yyscanner);\n\t\n\t// Return here via longjmp() invoked by yy_fatal_error().\n\tif (setjmp(yyextra->abort_jmp_env)) {\n\t  return wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR),\n\t    \"Internal units parser error parsing '%s'\", unitstr);\n\t}\n\t\n\tBEGIN(INITIAL);\n\t\n\t#ifdef DEBUG\n\tfprintf(stderr, \"\\n%s ->\\n\", unitstr);\n\t#endif\n\n^\" \"+\t{\n\t  // Pretend initial whitespace doesn't exist.\n\t  yy_set_bol(1);\n\t}\n\n^\"[\"\t{\n\t  if (bracket++) {\n\t    BEGIN(FLUSH);\n\t  } else {\n\t    yy_set_bol(1);\n\t  }\n\t}\n\n^10[0-9] {\n\t  status = wcserr_set(WCSERR_SET(UNITSERR_BAD_NUM_MULTIPLIER),\n\t    \"Invalid exponent in '%s'\", unitstr);\n\t  BEGIN(FLUSH);\n\t}\n\n^10\t{\n\t  factor = 10.0;\n\t  BEGIN(EXPON);\n\t}\n\n^log\" \"*\"(\" {\n\t  *func = 1;\n\t  unput('(');\n\t  BEGIN(PAREN);\n\t}\n\n^ln\" \"*\"(\" {\n\t  *func = 2;\n\t  unput('(');\n\t  BEGIN(PAREN);\n\t}\n\n^exp\" \"*\"(\" {\n\t  *func = 3;\n\t  unput('(');\n\t  BEGIN(PAREN);\n\t}\n\n^[*.]\t{\n\t  // Leading binary multiply.\n\t  status = wcserr_set(WCSERR_SET(UNITSERR_DANGLING_BINOP),\n\t    \"Dangling binary operator in '%s'\", unitstr);\n\t  BEGIN(FLUSH);\n\t}\n\n\" \"+\t  // Discard whitespace in INITIAL context.\n\nsqrt\" \"*\"(\" {\n\t  expon /= 2.0;\n\t  unput('(');\n\t  BEGIN(PAREN);\n\t}\n\n\"(\"\t{\n\t  // Gather terms in parentheses.\n\t  yyless(0);\n\t  BEGIN(PAREN);\n\t}\n\n[*.]\t{\n\t  if (operator++) {\n\t    BEGIN(FLUSH);\n\t  }\n\t}\n\n^1\"/\" |\n\"/\"\t{\n\t  if (operator++) {\n\t    BEGIN(FLUSH);\n\t  } else {\n\t    expon *= -1.0;\n\t  }\n\t}\n\n{SI_UNIT}|{ADD_UNIT} {\n\t  operator = 0;\n\t  yyless(0);\n\t  BEGIN(UNITS);\n\t}\n\n{PREFIX}({SI_UNIT}|{ADD_ALL}) |\n{SUPPREFIX}{ADD_SUP} |\n{SUBPREFIX}{ADD_SUB} {\n\t  operator = 0;\n\t  yyless(0);\n\t  BEGIN(PREFIX);\n\t}\n\n\"]\"\t{\n\t  bracket = !bracket;\n\t  BEGIN(FLUSH);\n\t}\n\n.\t{\n\t  status = wcserr_set(WCSERR_SET(UNITSERR_BAD_INITIAL_SYMBOL),\n\t    \"Invalid symbol in INITIAL context in '%s'\", unitstr);\n\t  BEGIN(FLUSH);\n\t}\n\n<PAREN>\"(\" {\n\t  paren++;\n\t  operator = 0;\n\t  yymore();\n\t}\n\n<PAREN>\")\" {\n\t  paren--;\n\t  if (paren) {\n\t    // Not balanced yet.\n\t    yymore();\n\t\n\t  } else {\n\t    // Balanced; strip off the outer parentheses and recurse.\n\t    yytext[yyleng-1] = '\\0';\n\t\n\t    int func_r;\n\t    double factor_r;\n\t    status = wcsulexe(yytext+1, &func_r, &factor_r, types, err);\n\t\n\t    YY_BUFFER_STATE buf = YY_CURRENT_BUFFER;\n\t    yy_switch_to_buffer(buf, yyscanner);\n\t\n\t    if (func_r) {\n\t      status = wcserr_set(WCSERR_SET(UNITSERR_FUNCTION_CONTEXT),\n\t        \"Function in invalid context in '%s'\", unitstr);\n\t    }\n\t\n\t    if (status) {\n\t      BEGIN(FLUSH);\n\t    } else {\n\t      factor *= factor_r;\n\t      BEGIN(EXPON);\n\t    }\n\t  }\n\t}\n\n<PAREN>[^()]+ {\n\t  yymore();\n\t}\n\n<PREFIX>d {\n\t  factor = 1e-1;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>c {\n\t  factor = 1e-2;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>m {\n\t  factor = 1e-3;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>u {\n\t  factor = 1e-6;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>n {\n\t  factor = 1e-9;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>p {\n\t  factor = 1e-12;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>f {\n\t  factor = 1e-15;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>a {\n\t  factor = 1e-18;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>z {\n\t  factor = 1e-21;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>y {\n\t  factor = 1e-24;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>da {\n\t  factor = 1e+1;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>h {\n\t  factor = 1e+2;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>k {\n\t  factor = 1e+3;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>M {\n\t  factor = 1e+6;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>G {\n\t  factor = 1e+9;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>T {\n\t  factor = 1e+12;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>P {\n\t  factor = 1e+15;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>E {\n\t  factor = 1e+18;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>Z {\n\t  factor = 1e+21;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>Y {\n\t  factor = 1e+24;\n\t  BEGIN(UNITS);\n\t}\n\n<PREFIX>. {\n\t  // Internal parser error.\n\t  status = wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR),\n\t    \"Internal units parser error parsing '%s'\", unitstr);\n\t  BEGIN(FLUSH);\n\t}\n\n<UNITS>A {\n\t  // Ampere.\n\t  types[WCSUNITS_CHARGE] += 1.0;\n\t  types[WCSUNITS_TIME]   -= 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>a|yr {\n\t  // Julian year (annum).\n\t  factor *= 31557600.0;\n\t  types[WCSUNITS_TIME] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>adu {\n\t  // Analogue-to-digital converter units.\n\t  types[WCSUNITS_COUNT] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>[Aa]ngstrom {\n\t  // Angstrom.\n\t  factor *= 1e-10;\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>arcmin {\n\t  // Minute of arc.\n\t  factor /= 60.0;\n\t  types[WCSUNITS_PLANE_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>arcsec {\n\t  // Second of arc.\n\t  factor /= 3600.0;\n\t  types[WCSUNITS_PLANE_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>AU {\n\t  // Astronomical unit.\n\t  factor *= 1.49598e+11;\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>barn {\n\t  // Barn.\n\t  factor *= 1e-28;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>beam {\n\t  // Beam, as in Jy/beam.\n\t  types[WCSUNITS_BEAM] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>bin {\n\t  // Bin (e.g. histogram).\n\t  types[WCSUNITS_BIN] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>bit {\n\t  // Bit.\n\t  types[WCSUNITS_BIT] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>[bB]yte {\n\t  // Byte.\n\t  factor *= 8.0;\n\t  types[WCSUNITS_BIT] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>C {\n\t  // Coulomb.\n\t  types[WCSUNITS_CHARGE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>cd {\n\t  // Candela.\n\t  types[WCSUNITS_LUMINTEN] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>chan {\n\t  // Channel.\n\t  types[WCSUNITS_BIN] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>count|ct {\n\t  // Count.\n\t  types[WCSUNITS_COUNT] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>cy {\n\t  // Julian century.\n\t  factor *= 3155760000.0;\n\t  types[WCSUNITS_TIME] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>D {\n\t  // Debye.\n\t  factor *= 1e-29 / 3.0;\n\t  types[WCSUNITS_CHARGE] += 1.0;\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>d {\n\t  // Day.\n\t  factor *= 86400.0;\n\t  types[WCSUNITS_TIME] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>deg {\n\t  // Degree.\n\t  types[WCSUNITS_PLANE_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>erg {\n\t  // Erg.\n\t  factor *= 1e-7;\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>eV {\n\t  // Electron volt.\n\t  factor *= 1.6021765e-19;\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>F {\n\t  // Farad.\n\t  types[WCSUNITS_MASS]   -= 1.0;\n\t  types[WCSUNITS_LENGTH] -= 2.0;\n\t  types[WCSUNITS_TIME]   += 3.0;\n\t  types[WCSUNITS_CHARGE] += 2.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>G {\n\t  // Gauss.\n\t  factor *= 1e-4;\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_TIME]   += 1.0;\n\t  types[WCSUNITS_CHARGE] -= 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>g {\n\t  // Gram.\n\t  factor *= 1e-3;\n\t  types[WCSUNITS_MASS] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>H {\n\t  // Henry.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   += 2.0;\n\t  types[WCSUNITS_CHARGE] -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>h {\n\t  // Hour.\n\t  factor *= 3600.0;\n\t  types[WCSUNITS_TIME] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>Hz {\n\t  // Hertz.\n\t  types[WCSUNITS_TIME] -= 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>J {\n\t  // Joule.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>Jy {\n\t  // Jansky.\n\t  factor *= 1e-26;\n\t  types[WCSUNITS_MASS] += 1.0;\n\t  types[WCSUNITS_TIME] -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>K {\n\t  // Kelvin.\n\t  types[WCSUNITS_TEMPERATURE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>lm {\n\t  // Lumen.\n\t  types[WCSUNITS_LUMINTEN]    += 1.0;\n\t  types[WCSUNITS_SOLID_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>lx {\n\t  // Lux.\n\t  types[WCSUNITS_LUMINTEN]    += 1.0;\n\t  types[WCSUNITS_SOLID_ANGLE] += 1.0;\n\t  types[WCSUNITS_LENGTH]      -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>lyr {\n\t  // Light year.\n\t  factor *= 2.99792458e8 * 31557600.0;\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>m {\n\t  // Metre.\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>mag {\n\t  // Stellar magnitude.\n\t  types[WCSUNITS_MAGNITUDE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>mas {\n\t  // Milli-arcsec.\n\t  factor /= 3600e+3;\n\t  types[WCSUNITS_PLANE_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>min {\n\t  // Minute.\n\t  factor *= 60.0;\n\t  types[WCSUNITS_TIME] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>mol {\n\t  // Mole.\n\t  types[WCSUNITS_MOLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>N {\n\t  // Newton.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  types[WCSUNITS_TIME]   -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>[Oo]hm {\n\t  // Ohm.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   -= 1.0;\n\t  types[WCSUNITS_CHARGE] -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>Pa {\n\t  // Pascal.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] -= 1.0;\n\t  types[WCSUNITS_TIME]   -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>pc {\n\t  // Parsec.\n\t  factor *= 3.0857e16;\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>photon|ph {\n\t  // Photon.\n\t  types[WCSUNITS_COUNT] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>pixel|pix {\n\t  // Pixel.\n\t  types[WCSUNITS_PIXEL] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>R {\n\t  // Rayleigh.\n\t  factor *= 1e10 / (4.0 * PI);\n\t  types[WCSUNITS_LENGTH]      -= 2.0;\n\t  types[WCSUNITS_TIME]        -= 1.0;\n\t  types[WCSUNITS_SOLID_ANGLE] -= 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>rad {\n\t  // Radian.\n\t  factor *= 180.0 / PI;\n\t  types[WCSUNITS_PLANE_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>Ry {\n\t  // Rydberg.\n\t  factor *= 13.605692 * 1.6021765e-19;\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>S {\n\t  // Siemen.\n\t  types[WCSUNITS_MASS]   -= 1.0;\n\t  types[WCSUNITS_LENGTH] -= 2.0;\n\t  types[WCSUNITS_TIME]   += 1.0;\n\t  types[WCSUNITS_CHARGE] += 2.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>s {\n\t  // Second.\n\t  types[WCSUNITS_TIME] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>solLum {\n\t  // Solar luminosity.\n\t  factor *= 3.8268e26;\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   -= 3.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>solMass {\n\t  // Solar mass.\n\t  factor *= 1.9891e30;\n\t  types[WCSUNITS_MASS] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>solRad {\n\t  // Solar radius.\n\t  factor *= 6.9599e8;\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>sr {\n\t  // Steradian.\n\t  types[WCSUNITS_SOLID_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>Sun {\n\t  // Sun (with respect to).\n\t  types[WCSUNITS_SOLRATIO] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>T {\n\t  // Tesla.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_TIME]   += 1.0;\n\t  types[WCSUNITS_CHARGE] -= 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>turn {\n\t  // Turn.\n\t  factor *= 360.0;\n\t  types[WCSUNITS_PLANE_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>u {\n\t  // Unified atomic mass unit.\n\t  factor *= 1.6605387e-27;\n\t  types[WCSUNITS_MASS] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>V {\n\t  // Volt.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  types[WCSUNITS_TIME]   -= 2.0;\n\t  types[WCSUNITS_CHARGE] -= 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>voxel {\n\t  // Voxel.\n\t  types[WCSUNITS_VOXEL] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>W {\n\t  // Watt.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   -= 3.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>Wb {\n\t  // Weber.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   += 1.0;\n\t  types[WCSUNITS_CHARGE] -= 1.0;\n\t  BEGIN(EXPON);\n\t}\n\n<UNITS>. {\n\t  // Internal parser error.\n\t  status = wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR),\n\t    \"Internal units parser error parsing '%s'\", unitstr);\n\t  BEGIN(FLUSH);\n\t}\n\n<EXPON>\" \"*(\"**\"|^) {\n\t  // Exponentiation.\n\t  if (operator++) {\n\t    BEGIN(FLUSH);\n\t  }\n\t}\n\n<EXPON>\" \"*{INTEGER} {\n\t  int i;\n\t  sscanf(yytext, \" %d\", &i);\n\t  expon *= (double)i;\n\t  add(&factor, types, &expon, scale, units);\n\t  operator = 0;\n\t  BEGIN(INITIAL);\n\t}\n\n<EXPON>\" \"*\"(\"\" \"*{INTEGER}\" \"*\")\" {\n\t  int i;\n\t  sscanf(yytext, \" (%d)\", &i);\n\t  expon *= (double)i;\n\t  add(&factor, types, &expon, scale, units);\n\t  operator = 0;\n\t  BEGIN(INITIAL);\n\t}\n\n<EXPON>\" \"*\"(\"\" \"*{FRAC}\" \"*\")\" {\n\t  int i, j;\n\t  sscanf(yytext, \" (%d/%d)\", &i, &j);\n\t  expon *= (double)i / (double)j;\n\t  add(&factor, types, &expon, scale, units);\n\t  operator = 0;\n\t  BEGIN(INITIAL);\n\t}\n\n<EXPON>\" \"*\"(\"\" \"*{FLOAT}\" \"*\")\" {\n\t  char ctmp[72];\n\t  sscanf(yytext, \" (%s)\", ctmp);\n\t  double dexp;\n\t  wcsutil_str2double(ctmp, &dexp);\n\t  expon *= dexp;\n\t  add(&factor, types, &expon, scale, units);\n\t  operator = 0;\n\t  BEGIN(INITIAL);\n\t}\n\n<EXPON>\" \"*[.*]\" \"* {\n\t  // Multiply.\n\t  if (operator++) {\n\t    BEGIN(FLUSH);\n\t  } else {\n\t    add(&factor, types, &expon, scale, units);\n\t    BEGIN(INITIAL);\n\t  }\n\t}\n\n<EXPON>\" \"*\"(\" {\n\t  // Multiply.\n\t  if (operator) {\n\t    BEGIN(FLUSH);\n\t  } else {\n\t    add(&factor, types, &expon, scale, units);\n\t    unput('(');\n\t    BEGIN(INITIAL);\n\t  }\n\t}\n\n<EXPON>\" \"+ {\n\t  // Multiply.\n\t  if (operator) {\n\t    BEGIN(FLUSH);\n\t  } else {\n\t    add(&factor, types, &expon, scale, units);\n\t    BEGIN(INITIAL);\n\t  }\n\t}\n\n<EXPON>\" \"*\"/\"\" \"* {\n\t  // Divide.\n\t  if (operator++) {\n\t    BEGIN(FLUSH);\n\t  } else {\n\t    add(&factor, types, &expon, scale, units);\n\t    expon = -1.0;\n\t    BEGIN(INITIAL);\n\t  }\n\t}\n\n<EXPON>\" \"*\"]\" {\n\t  add(&factor, types, &expon, scale, units);\n\t  bracket = !bracket;\n\t  BEGIN(FLUSH);\n\t}\n\n<EXPON>. {\n\t  status = wcserr_set(WCSERR_SET(UNITSERR_BAD_EXPON_SYMBOL),\n\t    \"Invalid symbol in EXPON context in '%s'\", unitstr);\n\t  BEGIN(FLUSH);\n\t}\n\n<FLUSH>.* {\n\t  // Discard any remaining input.\n\t}\n\n<<EOF>>\t{\n\t  // End-of-string.\n\t  if (YY_START == EXPON) {\n\t    add(&factor, types, &expon, scale, units);\n\t  }\n\t\n\t  if (bracket) {\n\t    status = wcserr_set(WCSERR_SET(UNITSERR_UNBAL_BRACKET),\n\t      \"Unbalanced bracket in '%s'\", unitstr);\n\t  } else if (paren) {\n\t    status = wcserr_set(WCSERR_SET(UNITSERR_UNBAL_PAREN),\n\t      \"Unbalanced parenthesis in '%s'\", unitstr);\n\t  } else if (operator == 1) {\n\t    status = wcserr_set(WCSERR_SET(UNITSERR_DANGLING_BINOP),\n\t      \"Dangling binary operator in '%s'\", unitstr);\n\t  } else if (operator) {\n\t    status = wcserr_set(WCSERR_SET(UNITSERR_CONSEC_BINOPS),\n\t      \"Consecutive binary operators in '%s'\", unitstr);\n\t  #ifdef DEBUG\n\t  } else {\n\t    fprintf(stderr, \"EOS\\n\");\n\t  #endif\n\t  }\n\t\n\t  if (status) {\n\t    for (int i = 0; i < WCSUNITS_NTYPE; i++) {\n\t      units[i] = 0.0;\n\t      *scale = 0.0;\n\t    }\n\t  }\n\t\n\t  return status;\n\t}\n\n%%\n\n/*----------------------------------------------------------------------------\n* External interface to the scanner.\n*---------------------------------------------------------------------------*/\n\nint wcsulexe(\n  const char unitstr[],\n  int *func,\n  double *scale,\n  double units[WCSUNITS_NTYPE],\n  struct wcserr **err)\n\n{\n  // Function prototypes.\n  int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner);\n  int yylex_destroy(yyscan_t yyscanner);\n\n  struct wcsulex_extra extra;\n  yyscan_t yyscanner;\n  yylex_init_extra(&extra, &yyscanner);\n  int status = wcsulexe_scanner(unitstr, func, scale, units, err, yyscanner);\n  yylex_destroy(yyscanner);\n\n  return status;\n}\n\n\n/*----------------------------------------------------------------------------\n* Accumulate a term in a units specification and reset work variables.\n*---------------------------------------------------------------------------*/\n\nvoid add(\n  double *factor,\n  double types[],\n  double *expon,\n  double *scale,\n  double units[])\n\n{\n  *scale *= pow(*factor, *expon);\n\n  for (int i = 0; i < WCSUNITS_NTYPE; i++) {\n    units[i] += *expon * types[i];\n    types[i] = 0.0;\n  }\n\n  *expon  = 1.0;\n  *factor = 1.0;\n\n  return;\n}\n"},{"id":16598,"name":"wcstrig.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcstrig.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <math.h>\n#include <stdlib.h>\n#include \"wcsmath.h\"\n#include \"wcstrig.h\"\n\ndouble cosd(double angle)\n\n{\n  int i;\n\n  if (fmod(angle,90.0) == 0.0) {\n    i = abs((int)floor(angle/90.0 + 0.5))%4;\n    switch (i) {\n    case 0:\n      return 1.0;\n    case 1:\n      return 0.0;\n    case 2:\n      return -1.0;\n    case 3:\n      return 0.0;\n    }\n  }\n\n  return cos(angle*D2R);\n}\n\n//----------------------------------------------------------------------------\n\ndouble sind(double angle)\n\n{\n  int i;\n\n  if (fmod(angle,90.0) == 0.0) {\n    i = abs((int)floor(angle/90.0 - 0.5))%4;\n    switch (i) {\n    case 0:\n      return 1.0;\n    case 1:\n      return 0.0;\n    case 2:\n      return -1.0;\n    case 3:\n      return 0.0;\n    }\n  }\n\n  return sin(angle*D2R);\n}\n\n//----------------------------------------------------------------------------\n\nvoid sincosd(double angle, double *s, double *c)\n\n{\n  int i;\n\n  if (fmod(angle,90.0) == 0.0) {\n    i = abs((int)floor(angle/90.0 + 0.5))%4;\n    switch (i) {\n    case 0:\n      *s = 0.0;\n      *c = 1.0;\n      return;\n    case 1:\n      *s = (angle > 0.0) ? 1.0 : -1.0;\n      *c = 0.0;\n      return;\n    case 2:\n      *s =  0.0;\n      *c = -1.0;\n      return;\n    case 3:\n      *s = (angle > 0.0) ? -1.0 : 1.0;\n      *c = 0.0;\n      return;\n    }\n  }\n\n#ifdef HAVE_SINCOS\n  sincos(angle*D2R, s, c);\n#else\n  *s = sin(angle*D2R);\n  *c = cos(angle*D2R);\n#endif\n\n  return;\n}\n\n//----------------------------------------------------------------------------\n\ndouble tand(double angle)\n\n{\n  double resid;\n\n  resid = fmod(angle,360.0);\n  if (resid == 0.0 || fabs(resid) == 180.0) {\n    return 0.0;\n  } else if (resid == 45.0 || resid == 225.0) {\n    return 1.0;\n  } else if (resid == -135.0 || resid == -315.0) {\n    return -1.0;\n  }\n\n  return tan(angle*D2R);\n}\n\n//----------------------------------------------------------------------------\n\ndouble acosd(double v)\n\n{\n  if (v >= 1.0) {\n    if (v-1.0 <  WCSTRIG_TOL) return 0.0;\n  } else if (v == 0.0) {\n    return 90.0;\n  } else if (v <= -1.0) {\n    if (v+1.0 > -WCSTRIG_TOL) return 180.0;\n  }\n\n  return acos(v)*R2D;\n}\n\n//----------------------------------------------------------------------------\n\ndouble asind(double v)\n\n{\n  if (v <= -1.0) {\n    if (v+1.0 > -WCSTRIG_TOL) return -90.0;\n  } else if (v == 0.0) {\n    return 0.0;\n  } else if (v >= 1.0) {\n    if (v-1.0 <  WCSTRIG_TOL) return 90.0;\n  }\n\n  return asin(v)*R2D;\n}\n\n//----------------------------------------------------------------------------\n\ndouble atand(double v)\n\n{\n  if (v == -1.0) {\n    return -45.0;\n  } else if (v == 0.0) {\n    return 0.0;\n  } else if (v == 1.0) {\n    return 45.0;\n  }\n\n  return atan(v)*R2D;\n}\n\n//----------------------------------------------------------------------------\n\ndouble atan2d(double y, double x)\n\n{\n  if (y == 0.0) {\n    if (x >= 0.0) {\n      return 0.0;\n    } else if (x < 0.0) {\n      return 180.0;\n    }\n  } else if (x == 0.0) {\n    if (y > 0.0) {\n      return 90.0;\n    } else if (y < 0.0) {\n      return -90.0;\n    }\n   }\n\n   return atan2(y,x)*R2D;\n}\n"},{"id":16599,"name":"GNUmakefile","nodeType":"TextFile","path":"cextern/wcslib/C","text":"#-----------------------------------------------------------------------------\n# GNU makefile for building WCSLIB 7.7 and its test suite.\n#\n# Summary of the main targets\n# ---------------------------\n#   build:     Build the library.\n#\n#   clean:     Delete intermediate object files.\n#\n#   cleaner:   clean, and also delete the test executables.\n#\n#   cleanest (distclean or realclean): cleaner, and also delete the object\n#              library and the C source files generated by 'flex'.\n#\n#   check (or test): Compile and run the test programs.  By default they are\n#              executed in batch mode, and non-graphical tests only report\n#              \"PASS\" on success.  Use\n#\n#                make MODE=interactive check\n#\n#              to run them interactively with full diagnostic output.  To skip\n#              graphical tests even if PGPLOT is available, use\n#\n#                make CHECK=nopgplot check\n#\n#   tests:     Compile the test programs (but don't run them).\n#\n# Notes:\n#   1) If you need to make changes then preferably modify ../makedefs.in\n#      instead and re-run configure.\n#\n# Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n# http://www.atnf.csiro.au/people/Mark.Calabretta\n# $Id: GNUmakefile,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n#-----------------------------------------------------------------------------\n# Get configure settings.\nSUBDIR := C\ninclude ../makedefs\n\nFLEXMODS := $(patsubst %.l,%.c,$(wildcard *.l))\nMODULES  := $(sort \\\n              $(patsubst %.c,%.o, \\\n                $(filter-out getwcstab.c,$(wildcard *.c)) $(FLEXMODS)))\n\nifeq \"$(WCSTRIG)\" \"MACRO\"\n  CPPFLAGS += -DWCSTRIG_MACRO\n  MODULES  := $(filter-out wcstrig.o, $(MODULES))\nelse\n  ifeq \"$(WCSTRIG)\" \"NATIVE\"\n    MODULES := $(filter-out wcstrig.o, $(MODULES))\n  endif\nendif\n\nLIBLOCK := lib.lock\n\n# For building the sharable library.\nPICLIB := libwcs-PIC.a\n\nCPPFLAGS += -I. -I..\n\nvpath %.c  test\nvpath %.h  ..\nvpath %.in ..\n\n\n# For building and exercising the test suite\n# ------------------------------------------\n# Test programs that don't require CFITSIO or PGPLOT...\nTEST_N := tlin tdis1 tdis2 tlog tprj1 tsph tsphdpa tspx ttab1 twcs twcssub \\\n          tpih1 tbth1 tfitshdr tunits twcsfix twcscompare\n\n# ...and unofficial test programs.\nTEST_n := tdisiter tspcaips tspcspxe tspctrne twcs_locale\n\n# Test programs that require CFITSIO (they don't need PGPLOT).\nTEST_C := twcstab twcshdr tdis3 twcslint\n\n# Test programs that require PGPLOT but not PGSBOX.\nTEST_P := tspc tprj2 tcel1 tcel2 ttab2 ttab3 twcsmix\n\n# Test programs that require PGSBOX (and therefore PGPLOT).\nTEST_B := tpih2\n\n# Test program for POSIX threads (code development only).\nTEST_T := tpthreads\n\n# Test programs that are compiled but not automatically exercised.\nTEST_X := tsphdpa twcshdr\n\n\nTESTS  := $(TEST_N)\n\n# Do we have CFITSIO?\nDO_CFITSIO := 1\nifeq \"$(CFITSIOINC)\" \"\"\n  DO_CFITSIO := 0\nelse ifeq \"$(CFITSIOLIB)\" \"\"\n  DO_CFITSIO := 0\nendif\n\nifeq \"$(DO_CFITSIO)\" \"1\"\n  # Yes, add test programs that use it.\n  TESTS += $(TEST_C)\n  CFITSIO_CFLAGS := $(filter-out -Wpadded,$(CFLAGS))\nelse\n  # No, amend TEST_X.\n  TEST_X := $(filter-out $(TEST_C),$(TEST_X))\nendif\n\n# Do we have PGPLOT?\nDO_PGPLOT := 0\nifneq \"$(CHECK)\" \"nopgplot\"\n  DO_PGPLOT := 1\n  ifeq \"$(PGPLOTINC)\" \"\"\n    DO_PGPLOT := 0\n  else ifeq \"$(PGPLOTLIB)\" \"\"\n    DO_PGPLOT := 0\n  endif\n\n  ifeq \"$(DO_PGPLOT)\" \"1\"\n    # Yes, add test programs that use it.\n    TESTS += $(TEST_P) $(TEST_B)\n  else\n    # No, amend TEST_X.\n    TEST_X := $(filter-out $(TEST_P) $(TEST_B),$(TEST_X))\n  endif\nendif\n\n# Remove tests that aren't automatically exercised.\nTESTS := $(filter-out $(TEST_X), $(TESTS))\n\nPGSBOXLIB := ../pgsbox/libpgsbox-$(LIBVER).a\n\nADDRE := 0x[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]*\n\n# Pattern rules\n#--------------\n\nifeq \"$(FLEX)\" \"flex\"\n  %.c : %.l\n\t-@ echo ''\n\t-@ $(RM) $@\n\t   $(FLEX) $(FLFLAGS) -t $< | sed -e 's/^[\t ]*#/#/' > $@\nelse\n  %.c : %.l\n\t-@ echo ''\n\t-@ $(RM) $@\n\t   cp flexed/$@ .\nendif\n\n$(WCSLIB)(%.o) : %.c\n\t-@ echo ''\n\t   $(CC) $(CPPFLAGS) $(CFLAGS) -c $<\n\t @ if [ ! -f $(LIBLOCK) ] ; then \\\n\t     echo $(AR) r$(ARFLAGS) $(WCSLIB) $% ; \\\n\t     $(AR) r$(ARFLAGS) $(WCSLIB) $% ; \\\n\t     $(RM) $% ; \\\n\t   fi\n\n$(PICLIB)(%.o) : $(WCSLIB)(%.o)\n\t-@ echo ''\n\t   $(CC) $(CPPFLAGS) $(CFLAGS) $(SHRFLAGS) -c $(%:.o=.c)\n\t @ if [ ! -f $(LIBLOCK) ] ; then \\\n\t     echo $(AR) r$(ARFLAGS) $(PICLIB) $% ; \\\n\t     $(AR) r$(ARFLAGS) $(PICLIB) $% ; \\\n\t     $(RM) $% ; \\\n\t   fi\n\n# May need to create temporary symlinks to include file directories for\n# CFITSIO, etc. for the following two rules.\n%.i : %.c\n\t-@ echo ''\n\t-@ $(RM) $@\n\t   $(CPP) $(CPPFLAGS) $(CFLAGS) $< > $@\n\n# Print out include file dependencies.\n%.d : %.c\n\t-@ echo ''\n\t-@ $(CPP) $(CPPFLAGS) $(CFLAGS) $< | \\\n\t   sed -n -e 's|^# 1 \"\\([^/].*\\.h\\)\".*|\\1|p' | \\\n\t   sed -e 's|.*/||' | \\\n\t   sort -u\n\n%.fits : test/%.keyrec ../utils/tofits\n\t   ../utils/tofits < $< > $@\n\n# Use 'make VALGRIND=T run_%' to have VALGRIND defined (from flavours).\n# Use 'make VALGRIND=T check < /dev/null |& tee check_valgrind.log' to run\n# valgrind on the lot.\nrun_% : %\n\t-@ echo ''\n\t-@ $(TIMER)\n\t @ if [ '$(MODE)' = interactive -o '$(VALGRIND)' ] ; then \\\n\t     printf 'Press <CR> to run $<: ' ; \\\n\t     read DUMMY ; \\\n\t   fi ; \\\n\t   if [ '$(VALGRIND)' ] ; then \\\n\t     if [ '$<' = tunits ] ; then \\\n\t       $(VALGRIND) ./$< < test/units_test ; \\\n\t     else \\\n\t       $(VALGRIND) ./$< ; \\\n\t     fi ; \\\n\t   else \\\n\t     if [ '$(filter $<, $(TEST_N) $(TEST_C))' ] ; then \\\n\t       if [ '$<' = tunits ] ; then \\\n\t         if [ '$(MODE)' = interactive ] ; then \\\n\t           ./$< < test/units_test 2>&1 | tee $<.out ; \\\n\t         else \\\n\t           ./$< < test/units_test > $<.out 2>&1 ; \\\n\t         fi ; \\\n\t       else \\\n\t         if [ '$(MODE)' = interactive ] ; then \\\n\t           ./$< < /dev/null 2>&1 | tee $<.out ; \\\n\t         else \\\n\t           ./$< < /dev/null > $<.out 2>&1 ; \\\n\t         fi ; \\\n\t       fi ; \\\n\t       if grep 'FAIL:' $<.out > /dev/null ; then \\\n\t         if [ '$(MODE)' != interactive ] ; then \\\n\t           head -2 $<.out ; \\\n\t           grep 'FAIL:' $<.out ; \\\n\t         fi ; \\\n\t         echo 'FAIL: C/$<' >> test_results ; \\\n\t       elif grep 'PASS:' $<.out > /dev/null ; then \\\n\t         if [ '$(MODE)' != interactive ] ; then \\\n\t           head -2 $<.out ; \\\n\t           grep 'PASS:' $<.out ; \\\n\t         fi ; \\\n\t         echo 'PASS: C/$<' >> test_results ; \\\n\t       elif [ -f 'test/$<.out' ] ; then \\\n\t         trap 'rm -f run_$<.tmp' 0 1 2 3 15 ; \\\n\t         sed -e 's/$(ADDRE)/0x<address>/g' $<.out > \\\n\t           run_$<.tmp ; \\\n\t         mv -f run_$<.tmp $<.out ; \\\n\t         if cmp -s $<.out test/$<.out ; then \\\n\t           if [ '$(MODE)' != interactive ] ; then \\\n\t             head -2 $<.out ; \\\n\t           fi ; \\\n\t           echo 'PASS: Output agrees with C/test/$<.out' ; \\\n\t           echo 'PASS: C/$<' >> test_results ; \\\n\t         else \\\n\t           if [ '$(MODE)' != interactive ] ; then \\\n\t             cat $<.out ; \\\n\t           fi ; \\\n\t           echo '' ; \\\n\t           echo 'FAIL: Output disagrees with C/test/$<.out' ; \\\n\t           echo 'FAIL: C/$<' >> test_results ; \\\n\t         fi ; \\\n\t       elif [ '$(MODE)' != interactive ] ; then \\\n\t         cat $<.out ; \\\n\t         echo 'FAIL: C/$<' >> test_results ; \\\n\t       fi ; \\\n\t     elif [ '$(MODE)' = interactive ] ; then \\\n\t       ./$< ; \\\n\t     else \\\n\t       if [ '$<' = tcel2 ] ; then \\\n\t         echo N | ./$< ; \\\n\t       else \\\n\t         ./$< < /dev/null 2>&1 ; \\\n\t       fi ; \\\n\t     fi ; \\\n\t   fi\n\t-@ echo ''\n\n# Static and static pattern rules\n#--------------------------------\n\n.PHONY : build check clean cleaner cleanest distclean install lib realclean \\\n         run_% test tests uninstall\n\nbuild : lib\n\nlib : $(FLEXMODS)\n\t-@ echo ''\n\t-@ echo 'Building WCSLIB C library...'\n\t @ $(MAKE) --no-print-directory $(WCSLIB)\n\n$(WCSLIB) : $(LIBLOCK) $(MODULES:%=$(WCSLIB)(%))\n\t-@ echo ''\n\t @ set *.o ; \\\n\t     if [ \"$$1\" != \"*.o\" ] ; then \\\n\t       echo $(AR) r$(ARFLAGS) $@ *.o ; \\\n\t       $(AR) r$(ARFLAGS) $@ *.o ; \\\n\t       echo $(RANLIB) $@ ; \\\n\t       $(RANLIB) $@ ; \\\n\t       $(RM) *.o ; \\\n\t     fi\n\t-@ $(RM) $<\n\t @ if [ \"$(SHRLIB)\" != \"\" ] ; then \\\n\t     $(MAKE) --no-print-directory $(SHRLIB) ; \\\n\t   fi\n\n$(SHRLIB) : $(PICLIB)\n\t-@ echo ''\n\t-@ $(RM) -r tmp\n\t   mkdir tmp && \\\n\t     cd tmp && \\\n\t     trap 'cd .. ; $(RM) -r tmp' 0 1 2 3 15 ; \\\n\t     $(AR) x ../$(PICLIB) && \\\n\t     $(SHRLD) -o $@ *.o $(LDFLAGS) $(LIBS) && \\\n\t     mv $@ ..\n\n$(PICLIB) : $(LIBLOCK) $(MODULES:%=$(PICLIB)(%))\n\t-@ echo ''\n\t @ set *.o ; \\\n\t     if [ \"$$1\" != \"*.o\" ] ; then \\\n\t       echo $(AR) r$(ARFLAGS) $@ *.o ; \\\n\t       $(AR) r$(ARFLAGS) $@ *.o ; \\\n\t       $(RM) *.o ; \\\n\t     fi\n\t-@ $(RM) $<\n\n$(LIBLOCK) : FORCE\n\t @ $(RM) *.o\n\t @ touch $@\n\ninstall : build\n\t-  if [ ! -d \"$(LIBDIR)\" ] ; then \\\n\t     $(INSTALL) -d -m 775 $(LIBDIR) ; \\\n\t   fi\n\t   if [ \"$(ARFLAGS)\" = U ] ; then \\\n\t     $(RM) -r tmp ; \\\n\t     mkdir tmp && \\\n\t       cd tmp && \\\n\t       trap 'cd .. ; $(RM) -r tmp' 0 1 2 3 15 ; \\\n\t       $(AR) x ../$(WCSLIB) && \\\n\t       $(AR) rD $(WCSLIB) *.o && \\\n\t       $(INSTALL) -m 644 $(WCSLIB) $(LIBDIR) ; \\\n\t       cd .. ; \\\n\t       $(RM) -r tmp ; \\\n\t   else \\\n\t     $(INSTALL) -m 644 $(WCSLIB) $(LIBDIR) ; \\\n\t   fi\n\t   $(RANLIB) $(LIBDIR)/$(WCSLIB)\n\t-  if [ -h \"$(LIBDIR)/libwcs.a\" ] ; then \\\n\t     $(RM) $(LIBDIR)/libwcs.a ; \\\n\t   fi\n\t   $(LN_S) $(WCSLIB) $(LIBDIR)/libwcs.a\n\t   if [ \"$(SHRLIB)\" != \"\" ] ; then \\\n\t     $(INSTALL) -m 755 $(SHRLIB) $(LIBDIR) ; \\\n\t     if [ -h \"$(LIBDIR)/$(SONAME)\" ] ; then \\\n\t       $(RM) $(LIBDIR)/$(SONAME) ; \\\n\t     fi ; \\\n\t     $(LN_S) $(SHRLIB) $(LIBDIR)/$(SONAME) ; \\\n\t     if [ \"$(SHRLN)\" != \"\" ] ; then \\\n\t       if [ -h \"$(LIBDIR)/$(SHRLN)\" ] ; then \\\n\t         $(RM) $(LIBDIR)/$(SHRLN) ; \\\n\t       fi ; \\\n\t       $(LN_S) $(SONAME) $(LIBDIR)/$(SHRLN) ; \\\n\t     fi ; \\\n\t   fi\n\t-  if [ ! -d \"$(INCDIR)\" ] ; then \\\n\t     $(INSTALL) -d -m 775 $(INCDIR) ; \\\n\t   fi\n\t   $(INSTALL) -m 444 *.h $(INCDIR)\n\t-  $(RM) $(INCLINK)\n\t   $(LN_S) $(notdir $(INCDIR)) $(INCLINK)\n\nuninstall :\n\t-  cd $(LIBDIR) && $(RM) $(WCSLIB) $(SHRLN) $(SONAME) $(SHRLIB)\n\t-  $(RM) $(INCDIR)\n\t-  $(RM) $(INCLINK)\n\nclean :\n\t- $(RM) *.o $(LIBLOCK) *.i a.out t*.out core *.dSYM\n\t- $(RM) -r $(EXTRA_CLEAN)\n\ncleaner : clean\n\t-  $(RM) .gdb_history\n\t-  $(RM) $(TEST_N) $(TEST_n) $(TEST_T) $(TEST_X)\n\t-  $(RM) $(TEST_P) tdis3 tpih2 twcshdr twcslint twcstab\n\t-  $(RM) bth.fits fitshdr.fits pih.fits wcslint.fits wcspcx.fits\n\t-  $(RM) wcstab.fits SIP.fits SIPTPV.fits TPV3.fits TPV5.fits\n\t-  $(RM) TPV7.fits DSS.fits TNX.fits ZPX.fits\n\t-  $(RM) t*_cfitsio test_results\n\ncleanest distclean realclean : cleaner\n\t-  $(RM) ../wcsconfig.h ../wcsconfig_tests.h\n\t-  $(RM) fitshdr.c wcsbth.c wcspih.c wcsulex.c wcsutrn.c\n\t-  $(RM) $(PICLIB) libwcs-*.a libwcs.so.* libwcs.*.dylib\n\ncheck test : tests $(TESTS:%=run_%)\n\ntests : $(TESTS) $(TEST_X)\n\n# TEST_N and TEST_n programs (no special libraries required).\n$(TEST_N) $(TEST_n) : % : test/%.c $(WCSLIB)\n\t-@ echo ''\n\t   $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS) $(WCSLIB) $(LIBS)\n\t-@ $(RM) $@.o\n\n# TEST_N programs (optionally using CFITSIO).\ntpih1_cfitsio tbth1_cfitsio tfitshdr_cfitsio : %_cfitsio : test/%.c $(WCSLIB)\n\t-@ echo ''\n\t   $(CC) -DDO_CFITSIO $(CPPFLAGS) $(CFITSIOINC) $(CFITSIO_CFLAGS) \\\n\t     -o $@ $< $(LDFLAGS) $(CFITSIOLIB) $(WCSLIB) $(LIBS)\n\t-@ $(RM) $@.o\n\n# TEST_C programs (using CFITSIO).\ntwcstab : test/twcstab.c $(WCSLIB) $(GETWCSTAB)\n\t-@ echo ''\n\t   $(CC) $(CPPFLAGS) $(CFITSIOINC) $(CFITSIO_CFLAGS) -o $@ $< \\\n\t     $(GETWCSTAB) $(LDFLAGS) $(CFITSIOLIB) $(WCSLIB) $(LIBS)\n\t-@ $(RM) $@.o $(GETWCSTAB)\n\ntwcshdr : test/twcshdr.c $(WCSLIB) $(GETWCSTAB)\n\t-@ echo ''\n\t   $(CC) $(CPPFLAGS) $(CFITSIOINC) $(CFITSIO_CFLAGS) -o $@ $< \\\n\t     $(GETWCSTAB) $(LDFLAGS) $(CFITSIOLIB) $(WCSLIB) $(LIBS)\n\t-@ $(RM) $@.o $(GETWCSTAB)\n\ntdis3 : test/tdis3\n\t-@ echo ''\n\t   cp $< .\n\t-@ chmod a+x $@\n\ntwcslint : test/twcslint\n\t-@ echo ''\n\t   cp $< .\n\t-@ chmod a+x $@\n\n# TEST_P programs (using PGPLOT).\n$(TEST_P) : % : test/%.c $(WCSLIB)\n\t-@ echo ''\n\t   $(CC) $(CPPFLAGS) $(PGPLOTINC) $(CFLAGS) -c -o $@.o $<\n\t   $(LD) -o $@ $@.o $(LDFLAGS) $(PGPLOTLIB) $(WCSLIB) $(FLIBS) $(LIBS)\n\t-@ $(RM) $@.o\n\n# TEST_B programs (PGSBOX and PGPLOT).\ntpih2 : test/tpih2.c $(PGSBOXLIB) $(WCSLIB)\n\t-@ echo ''\n\t   $(CC) $(CPPFLAGS) -I../pgsbox $(PGPLOTINC) $(CFLAGS) -c -o $@.o $<\n\t   $(LD) -o $@ $@.o $(LDFLAGS) $(PGSBOXLIB) $(PGPLOTLIB) $(WCSLIB) \\\n\t     $(FLIBS) $(LIBS)\n\t-@ $(RM) $@.o\n\ntpih2_cfitsio : test/tpih2.c $(PGSBOXLIB) $(WCSLIB)\n\t-@ echo ''\n\t   $(CC) -DDO_CFITSIO $(CPPFLAGS) -I../pgsbox $(PGPLOTINC) \\\n\t     $(CFITSIOINC) $(CFITSIO_CFLAGS) -c -o $@.o $<\n\t   $(LD) -o $@ $@.o $(LDFLAGS) $(PGSBOXLIB) $(PGPLOTLIB) \\\n\t     $(CFITSIOLIB) $(WCSLIB) $(FLIBS) $(LIBS)\n\t-@ $(RM) $@.o\n\n# TEST_T programs (using POSIX threads).\ntpthreads : test/tpthreads.c $(WCSLIB)\n\t-@ echo ''\n\t   $(CC) $(CPPFLAGS) $(CFLAGS) -pthread -c -o $@.o $<\n\t   $(LD) -o $@ $@.o $(LDFLAGS) -pthread $(WCSLIB) -lpthread $(LIBS)\n\t-@ $(RM) $@.o\n\ngetwcstab.o : getwcstab.c getwcstab.h\n\t-@ echo ''\n\t   $(CC) $(CPPFLAGS) $(CFITSIO_CFLAGS) $(CFITSIOINC) -c $<\n\n$(PGSBOXLIB) :\n\t-@ echo ''\n\t   $(MAKE) -C ../pgsbox $(notdir $@)\n\n../utils/tofits : ../utils/tofits.c\n\t   $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $<\n\nGNUmakefile : ../makedefs ;\n\n../makedefs ../wcsconfig.h ../wcsconfig_tests.h : makedefs.in wcsconfig.h.in \\\n    wcsconfig_tests.h.in ../config.status\n\t-@ $(RM) ../wcsconfig.h ../wcsconfig_tests.h\n\t   cd .. && ./config.status\n\nshow ::\n\t-@ echo '  FLEXMODS    := $(FLEXMODS)'\n\t-@ echo '  MODULES     := $(MODULES)'\n\t-@ echo '  DO_CFITSIO  := $(DO_CFITSIO)'\n\t-@ echo '  DO_PGPLOT   := $(DO_PGPLOT)'\n\t-@ echo '  TESTS       := $(TESTS)'\n\t-@ echo '  TEST_X      := $(TEST_X)'\n\n# Dependencies (use the %.d pattern rule to list them)\n#-----------------------------------------------------\n\n$(WCSLIB)(cel.o)      : cel.h prj.h sph.h wcsconfig.h wcserr.h wcsmath.h \\\n                        wcsprintf.h wcstrig.h\n$(WCSLIB)(dis.o)      : dis.h wcserr.h wcsprintf.h wcsutil.h\n$(WCSLIB)(fitshdr.o)  : fitshdr.h wcsconfig.h wcsutil.h\n$(WCSLIB)(lin.o)      : dis.h lin.h wcserr.h wcsprintf.h\n$(WCSLIB)(log.o)      : log.h\n$(WCSLIB)(prj.o)      : prj.h wcsconfig.h wcserr.h wcsmath.h wcsprintf.h \\\n                        wcstrig.h wcsutil.h\n$(WCSLIB)(spc.o)      : spc.h spx.h wcsconfig.h wcserr.h wcsmath.h \\\n                        wcsprintf.h wcstrig.h wcsutil.h\n$(WCSLIB)(sph.o)      : sph.h wcsconfig.h wcstrig.h\n$(WCSLIB)(spx.o)      : spx.h wcserr.h wcsmath.h\n$(WCSLIB)(tab.o)      : tab.h wcserr.h wcsmath.h wcsprintf.h wcsutil.h\n$(WCSLIB)(wcs.o)      : cel.h dis.h lin.h log.h prj.h spc.h sph.h spx.h \\\n                        tab.h wcs.h wcsconfig.h wcserr.h wcsmath.h \\\n                        wcsprintf.h wcstrig.h wcsunits.h wcsutil.h\n$(WCSLIB)(wcsbth.o)   : cel.h lin.h prj.h spc.h spx.h wcs.h wcshdr.h \\\n                        wcsmath.h wcsprintf.h wcsutil.h\n$(WCSLIB)(wcserr.o)   : wcserr.h wcsprintf.h\n$(WCSLIB)(wcsfix.o)   : cel.h lin.h prj.h spc.h sph.h spx.h wcs.h wcserr.h \\\n                        wcsfix.h wcsmath.h wcsunits.h wcsutil.h\n$(WCSLIB)(wcshdr.o)   : cel.h dis.h lin.h prj.h spc.h spx.h tab.h wcs.h \\\n                        wcserr.h wcshdr.h wcsmath.h wcsutil.h\n$(WCSLIB)(wcspih.o)   : cel.h dis.h lin.h prj.h spc.h spx.h wcs.h wcshdr.h \\\n                        wcsmath.h wcsprintf.h wcsutil.h\n$(WCSLIB)(wcsprintf.o): wcsprintf.h\n$(WCSLIB)(wcstrig.o)  : wcsconfig.h wcsmath.h wcstrig.h\n$(WCSLIB)(wcsulex.o)  : wcserr.h wcsmath.h wcsunits.h wcsutil.h\n$(WCSLIB)(wcsunits.o) : wcserr.h wcsunits.h\n$(WCSLIB)(wcsutil.o)  : wcsmath.h wcsutil.h\n$(WCSLIB)(wcsutrn.o)  : wcserr.h wcsunits.h\n\ntbth1 tbth1_cfitsio : cel.h lin.h prj.h spc.h spx.h wcs.h wcsconfig.h \\\n                      wcsconfig_tests.h wcserr.h wcsfix.h wcshdr.h\ntcel1   : cel.h prj.h\ntcel2   : cel.h prj.h\ntfitshdr tfitshdr_cfitsio : cel.h fitshdr.h lin.h prj.h spc.h spx.h wcs.h \\\n                            wcsconfig.h wcsconfig_tests.h wcshdr.h\ntlin    : lin.h\ntdis1   : cel.h dis.h lin.h prj.h spc.h spx.h wcs.h wcserr.h wcshdr.h \\\n          wcsprintf.h\ntdis2   : cel.h lin.h prj.h spc.h spx.h wcs.h wcserr.h wcshdr.h wcsprintf.h\ntdisiter: cel.h dis.h lin.h prj.h spc.h spx.h wcs.h wcserr.h wcshdr.h \\\n          wcsprintf.h\ntlog    : log.h\ntpih1 tpih1_cfitsio : cel.h lin.h prj.h spc.h spx.h wcs.h wcsconfig.h \\\n                      wcsconfig_tests.h wcserr.h wcsfix.h wcshdr.h wcsprintf.h\ntpih2 tpih2_cfitsio : cel.h lin.h prj.h spc.h spx.h wcs.h wcsconfig.h \\\n                      wcsconfig_tests.h wcshdr.h\ntprj1   : prj.h wcsconfig.h wcstrig.h\ntprj2   : prj.h\ntspc    : spc.h spx.h wcsconfig.h wcstrig.h\ntspcaips: spc.h spx.h\ntspctrne: spc.h spx.h wcserr.h\ntsph    : sph.h wcsconfig.h wcstrig.h\ntsphdpa : sph.h\ntspx    : spx.h\nttab1   : tab.h\nttab2   : tab.h\nttab3   : prj.h tab.h\ntunits  : wcserr.h wcsunits.h\ntwcs    : cel.h dis.h fitshdr.h lin.h log.h prj.h spc.h sph.h spx.h tab.h \\\n          wcs.h wcsconfig.h wcsconfig_tests.h wcserr.h wcsfix.h wcshdr.h \\\n\t  wcslib.h wcsmath.h wcsprintf.h wcstrig.h wcsunits.h wcsutil.h\ntwcs_locale : cel.h lin.h prj.h spc.h spx.h wcs.h wcserr.h wcshdr.h \\\n              wcsprintf.h\ntwcsfix : cel.h lin.h prj.h spc.h spx.h wcs.h wcserr.h wcsfix.h \\\n          wcsprintf.h wcsunits.h\ntwcshdr : cel.h dis.h fitshdr.h getwcstab.h lin.h log.h prj.h spc.h sph.h \\\n          spx.h tab.h wcs.h wcsconfig.h wcserr.h wcsfix.h wcshdr.h wcslib.h \\\n          wcsmath.h wcsprintf.h wcstrig.h wcsunits.h wcsutil.h\ntwcsmix : cel.h lin.h prj.h spc.h sph.h spx.h wcs.h\ntwcssub : cel.h lin.h prj.h spc.h spx.h wcs.h wcserr.h\ntwcstab : cel.h dis.h fitshdr.h getwcstab.h lin.h log.h prj.h spc.h sph.h \\\n          spx.h tab.h wcs.h wcsconfig.h wcserr.h wcsfix.h wcshdr.h wcslib.h \\\n          wcsmath.h wcsprintf.h wcstrig.h wcsunits.h wcsutil.h\n\nrun_tdis1 : TPV3.fits TPV5.fits TPV7.fits\nrun_tdis2 : SIP.fits\nrun_tdis3 : DSS.fits SIPTPV.fits TNX.fits ZPX.fits\nrun_tbth1 run_tbth1_cfitsio : bth.fits\nrun_tfitshdr run_tfitshdr_cfitsio : fitshdr.fits\nrun_tpih1 run_tpih1_cfitsio : pih.fits\nrun_tpih2 run_tpih2_cfitsio : pih.fits\nrun_twcslint : wcslint.fits\nrun_twcs_locale : pih.fits\n"},{"id":16600,"name":"spx.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: spx.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the spx routines\n* ---------------------------\n* Routines in this suite implement the spectral coordinate systems recognized\n* by the FITS World Coordinate System (WCS) standard, as described in\n*\n=   \"Representations of world coordinates in FITS\",\n=   Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (WCS Paper I)\n=\n=   \"Representations of spectral coordinates in FITS\",\n=   Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L.\n=   2006, A&A, 446, 747 (WCS Paper III)\n*\n* specx() is a scalar routine that, given one spectral variable (e.g.\n* frequency), computes all the others (e.g. wavelength, velocity, etc.) plus\n* the required derivatives of each with respect to the others.  The results\n* are returned in the spxprm struct.\n*\n* spxperr() prints the error message(s) (if any) stored in a spxprm struct.\n*\n* The remaining routines are all vector conversions from one spectral\n* variable to another.  The API of these functions only differ in whether the\n* rest frequency or wavelength need be supplied.\n*\n* Non-linear:\n*   - freqwave()    frequency              ->  vacuum wavelength\n*   - wavefreq()    vacuum wavelength      ->  frequency\n*\n*   - freqawav()    frequency              ->  air wavelength\n*   - awavfreq()    air wavelength         ->  frequency\n*\n*   - freqvelo()    frequency              ->  relativistic velocity\n*   - velofreq()    relativistic velocity  ->  frequency\n*\n*   - waveawav()    vacuum wavelength      ->  air wavelength\n*   - awavwave()    air wavelength         ->  vacuum wavelength\n*\n*   - wavevelo()    vacuum wavelength      ->  relativistic velocity\n*   - velowave()    relativistic velocity  ->  vacuum wavelength\n*\n*   - awavvelo()    air wavelength         ->  relativistic velocity\n*   - veloawav()    relativistic velocity  ->  air wavelength\n*\n* Linear:\n*   - freqafrq()    frequency              ->  angular frequency\n*   - afrqfreq()    angular frequency      ->  frequency\n*\n*   - freqener()    frequency              ->  energy\n*   - enerfreq()    energy                 ->  frequency\n*\n*   - freqwavn()    frequency              ->  wave number\n*   - wavnfreq()    wave number            ->  frequency\n*\n*   - freqvrad()    frequency              ->  radio velocity\n*   - vradfreq()    radio velocity         ->  frequency\n*\n*   - wavevopt()    vacuum wavelength      ->  optical velocity\n*   - voptwave()    optical velocity       ->  vacuum wavelength\n*\n*   - wavezopt()    vacuum wavelength      ->  redshift\n*   - zoptwave()    redshift               ->  vacuum wavelength\n*\n*   - velobeta()    relativistic velocity  ->  beta (= v/c)\n*   - betavelo()    beta (= v/c)           ->  relativistic velocity\n*\n* These are the workhorse routines, to be used for fast transformations.\n* Conversions may be done \"in place\" by calling the routine with the output\n* vector set to the input.\n*\n* Air-to-vacuum wavelength conversion:\n* ------------------------------------\n* The air-to-vacuum wavelength conversion in early drafts of WCS Paper III\n* cites Cox (ed., 2000, Allen’s Astrophysical Quantities, AIP Press,\n* Springer-Verlag, New York), which itself derives from Edlén (1953, Journal\n* of the Optical Society of America, 43, 339).  This is the IAU standard,\n* adopted in 1957 and again in 1991.  No more recent IAU resolution replaces\n* this relation, and it is the one used by WCSLIB.\n*\n* However, the Cox relation was replaced in later drafts of Paper III, and as\n* eventually published, by the IUGG relation (1999, International Union of\n* Geodesy and Geophysics, comptes rendus of the 22nd General Assembly,\n* Birmingham UK, p111).  There is a nearly constant ratio between the two,\n* with IUGG/Cox = 1.000015 over most of the range between 200nm and 10,000nm.\n*\n* The IUGG relation itself is derived from the work of Ciddor (1996, Applied\n* Optics, 35, 1566), which is used directly by the Sloan Digital Sky Survey.\n* It agrees closely with Cox; longwards of 2500nm, the ratio Ciddor/Cox is\n* fixed at 1.000000021, decreasing only slightly, to 1.000000018, at 1000nm.\n*\n* The Cox, IUGG, and Ciddor relations all accurately provide the wavelength\n* dependence of the air-to-vacuum wavelength conversion.  However, for full\n* accuracy, the atmospheric temperature, pressure, and partial pressure of\n* water vapour must be taken into account.  These will determine a small,\n* wavelength-independent scale factor and offset, which is not considered by\n* WCS Paper III.\n*\n* WCS Paper III is also silent on the question of the range of validity of the\n* air-to-vacuum wavelength conversion.  Cox's relation would appear to be\n* valid in the range 200nm to 10,000nm.  Both the Cox and the Ciddor relations\n* have singularities below 200nm, with Cox's at 156nm and 83nm.  WCSLIB checks\n* neither the range of validity, nor for these singularities.\n*\n* Argument checking:\n* ------------------\n* The input spectral values are only checked for values that would result\n* in floating point exceptions.  In particular, negative frequencies and\n* wavelengths are allowed, as are velocities greater than the speed of\n* light.  The same is true for the spectral parameters - rest frequency and\n* wavelength.\n*\n* Accuracy:\n* ---------\n* No warranty is given for the accuracy of these routines (refer to the\n* copyright notice); intending users must satisfy for themselves their\n* adequacy for the intended purpose.  However, closure effectively to within\n* double precision rounding error was demonstrated by test routine tspec.c\n* which accompanies this software.\n*\n*\n* specx() - Spectral cross conversions (scalar)\n* ---------------------------------------------\n* Given one spectral variable specx() computes all the others, plus the\n* required derivatives of each with respect to the others.\n*\n* Given:\n*   type      const char*\n*                       The type of spectral variable given by spec, FREQ,\n*                       AFRQ, ENER, WAVN, VRAD, WAVE, VOPT, ZOPT, AWAV, VELO,\n*                       or BETA (case sensitive).\n*\n*   spec      double    The spectral variable given, in SI units.\n*\n*   restfrq,\n*   restwav   double    Rest frequency [Hz] or rest wavelength in vacuo [m],\n*                       only one of which need be given.  The other should be\n*                       set to zero.  If both are zero, only a subset of the\n*                       spectral variables can be computed, the remainder are\n*                       set to zero.  Specifically, given one of FREQ, AFRQ,\n*                       ENER, WAVN, WAVE, or AWAV the others can be computed\n*                       without knowledge of the rest frequency.  Likewise,\n*                       VRAD, VOPT, ZOPT, VELO, and BETA.\n*\n* Given and returned:\n*   specs     struct spxprm*\n*                       Data structure containing all spectral variables and\n*                       their derivatives, in SI units.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null spxprm pointer passed.\n*                         2: Invalid spectral parameters.\n*                         3: Invalid spectral variable.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       spxprm::err if enabled, see wcserr_enable().\n*\n* freqafrq(), afrqfreq(), freqener(), enerfreq(), freqwavn(), wavnfreq(),\n* freqwave(), wavefreq(), freqawav(), awavfreq(), waveawav(), awavwave(),\n* velobeta(), and betavelo() implement vector conversions between wave-like\n* or velocity-like spectral types (i.e. conversions that do not need the rest\n* frequency or wavelength).  They all have the same API.\n*\n*\n* spxperr() - Print error messages from a spxprm struct\n* -----------------------------------------------------\n* spxperr() prints the error message(s) (if any) stored in a spxprm struct.\n* If there are no errors then nothing is printed.  It uses wcserr_prt(), q.v.\n*\n* Given:\n*   spx       const struct spxprm*\n*                       Spectral variables and their derivatives.\n*\n*   prefix    const char *\n*                       If non-NULL, each output line will be prefixed with\n*                       this string.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null spxprm pointer passed.\n*\n*\n* freqafrq() - Convert frequency to angular frequency (vector)\n* ------------------------------------------------------------\n* freqafrq() converts frequency to angular frequency.\n*\n* Given:\n*   param     double    Ignored.\n*\n*   nspec     int       Vector length.\n*\n*   instep,\n*   outstep   int       Vector strides.\n*\n*   inspec    const double[]\n*                       Input spectral variables, in SI units.\n*\n* Returned:\n*   outspec   double[]  Output spectral variables, in SI units.\n*\n*   stat      int[]     Status return value for each vector element:\n*                         0: Success.\n*                         1: Invalid value of inspec.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         2: Invalid spectral parameters.\n*                         4: One or more of the inspec coordinates were\n*                            invalid, as indicated by the stat vector.\n*\n*\n* freqvelo(), velofreq(), freqvrad(), and vradfreq() implement vector\n* conversions between frequency and velocity spectral types.  They all have\n* the same API.\n*\n*\n* freqvelo() - Convert frequency to relativistic velocity (vector)\n* ----------------------------------------------------------------\n* freqvelo() converts frequency to relativistic velocity.\n*\n* Given:\n*   param     double    Rest frequency [Hz].\n*\n*   nspec     int       Vector length.\n*\n*   instep,\n*   outstep   int       Vector strides.\n*\n*   inspec    const double[]\n*                       Input spectral variables, in SI units.\n*\n* Returned:\n*   outspec   double[]  Output spectral variables, in SI units.\n*\n*   stat      int[]     Status return value for each vector element:\n*                         0: Success.\n*                         1: Invalid value of inspec.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         2: Invalid spectral parameters.\n*                         4: One or more of the inspec coordinates were\n*                            invalid, as indicated by the stat vector.\n*\n*\n* wavevelo(), velowave(), awavvelo(), veloawav(), wavevopt(), voptwave(),\n* wavezopt(), and zoptwave() implement vector conversions between wavelength\n* and velocity spectral types.  They all have the same API.\n*\n*\n* wavevelo() - Conversions between wavelength and velocity types (vector)\n* -----------------------------------------------------------------------\n* wavevelo() converts vacuum wavelength to relativistic velocity.\n*\n* Given:\n*   param     double    Rest wavelength in vacuo [m].\n*\n*   nspec     int       Vector length.\n*\n*   instep,\n*   outstep   int       Vector strides.\n*\n*   inspec    const double[]\n*                       Input spectral variables, in SI units.\n*\n* Returned:\n*   outspec   double[]  Output spectral variables, in SI units.\n*\n*   stat      int[]     Status return value for each vector element:\n*                         0: Success.\n*                         1: Invalid value of inspec.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         2: Invalid spectral parameters.\n*                         4: One or more of the inspec coordinates were\n*                            invalid, as indicated by the stat vector.\n*\n*\n* spxprm struct - Spectral variables and their derivatives\n* --------------------------------------------------------\n* The spxprm struct contains the value of all spectral variables and their\n* derivatives.   It is used solely by specx() which constructs it from\n* information provided via its function arguments.\n*\n* This struct should be considered read-only, no members need ever be set nor\n* should ever be modified by the user.\n*\n*   double restfrq\n*     (Returned) Rest frequency [Hz].\n*\n*   double restwav\n*     (Returned) Rest wavelength [m].\n*\n*   int wavetype\n*     (Returned) True if wave types have been computed, and ...\n*\n*   int velotype\n*     (Returned) ... true if velocity types have been computed; types are\n*     defined below.\n*\n*     If one or other of spxprm::restfrq and spxprm::restwav is given\n*     (non-zero) then all spectral variables may be computed.  If both are\n*     given, restfrq is used.  If restfrq and restwav are both zero, only wave\n*     characteristic xor velocity type spectral variables may be computed\n*     depending on the variable given.   These flags indicate what is\n*     available.\n*\n*   double freq\n*     (Returned) Frequency [Hz] (wavetype).\n*\n*   double afrq\n*     (Returned) Angular frequency [rad/s] (wavetype).\n*\n*   double ener\n*     (Returned) Photon energy [J] (wavetype).\n*\n*   double wavn\n*     (Returned) Wave number [/m] (wavetype).\n*\n*   double vrad\n*     (Returned) Radio velocity [m/s] (velotype).\n*\n*   double wave\n*     (Returned) Vacuum wavelength [m] (wavetype).\n*\n*   double vopt\n*     (Returned) Optical velocity [m/s] (velotype).\n*\n*   double zopt\n*     (Returned) Redshift [dimensionless] (velotype).\n*\n*   double awav\n*     (Returned) Air wavelength [m] (wavetype).\n*\n*   double velo\n*     (Returned) Relativistic velocity [m/s] (velotype).\n*\n*   double beta\n*     (Returned) Relativistic beta [dimensionless] (velotype).\n*\n*   double dfreqafrq\n*     (Returned) Derivative of frequency with respect to angular frequency\n*     [/rad] (constant, = 1 / 2*pi), and ...\n*   double dafrqfreq\n*     (Returned) ... vice versa [rad] (constant, = 2*pi, always available).\n*\n*   double dfreqener\n*     (Returned) Derivative of frequency with respect to photon energy\n*     [/J/s] (constant, = 1/h), and ...\n*   double denerfreq\n*     (Returned) ... vice versa [Js] (constant, = h, Planck's constant,\n*     always available).\n*\n*   double dfreqwavn\n*     (Returned) Derivative of frequency with respect to wave number [m/s]\n*     (constant, = c, the speed of light in vacuo), and ...\n*   double dwavnfreq\n*     (Returned) ... vice versa [s/m] (constant, = 1/c, always available).\n*\n*   double dfreqvrad\n*     (Returned) Derivative of frequency with respect to radio velocity [/m],\n*     and ...\n*   double dvradfreq\n*     (Returned) ... vice versa [m] (wavetype && velotype).\n*\n*   double dfreqwave\n*     (Returned) Derivative of frequency with respect to vacuum wavelength\n*     [/m/s], and ...\n*   double dwavefreq\n*     (Returned) ... vice versa [m s] (wavetype).\n*\n*   double dfreqawav\n*     (Returned) Derivative of frequency with respect to air wavelength,\n*     [/m/s], and ...\n*   double dawavfreq\n*     (Returned) ... vice versa [m s] (wavetype).\n*\n*   double dfreqvelo\n*     (Returned) Derivative of frequency with respect to relativistic\n*     velocity [/m], and ...\n*   double dvelofreq\n*     (Returned) ... vice versa [m] (wavetype && velotype).\n*\n*   double dwavevopt\n*     (Returned) Derivative of vacuum wavelength with respect to optical\n*     velocity [s], and ...\n*   double dvoptwave\n*     (Returned) ... vice versa [/s] (wavetype && velotype).\n*\n*   double dwavezopt\n*     (Returned) Derivative of vacuum wavelength with respect to redshift [m],\n*     and ...\n*   double dzoptwave\n*     (Returned) ... vice versa [/m] (wavetype && velotype).\n*\n*   double dwaveawav\n*     (Returned) Derivative of vacuum wavelength with respect to air\n*     wavelength [dimensionless], and ...\n*   double dawavwave\n*     (Returned) ... vice versa [dimensionless] (wavetype).\n*\n*   double dwavevelo\n*     (Returned) Derivative of vacuum wavelength with respect to relativistic\n*     velocity [s], and ...\n*   double dvelowave\n*     (Returned) ... vice versa [/s] (wavetype && velotype).\n*\n*   double dawavvelo\n*     (Returned) Derivative of air wavelength with respect to relativistic\n*     velocity [s], and ...\n*   double dveloawav\n*     (Returned) ... vice versa [/s] (wavetype && velotype).\n*\n*   double dvelobeta\n*     (Returned) Derivative of relativistic velocity with respect to\n*     relativistic beta [m/s] (constant, = c, the speed of light in vacuo),\n*     and ...\n*   double dbetavelo\n*     (Returned) ... vice versa [s/m] (constant, = 1/c, always available).\n*\n*   struct wcserr *err\n*     (Returned) If enabled, when an error status is returned, this struct\n*     contains detailed information about the error, see wcserr_enable().\n*\n*   void *padding\n*     (An unused variable inserted for alignment purposes only.)\n*\n* Global variable: const char *spx_errmsg[] - Status return messages\n* ------------------------------------------------------------------\n* Error messages to match the status value returned from each function.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_SPEC\n#define WCSLIB_SPEC\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nextern const char *spx_errmsg[];\n\nenum spx_errmsg {\n  SPXERR_SUCCESS          = 0,\t// Success.\n  SPXERR_NULL_POINTER     = 1,\t// Null spxprm pointer passed.\n  SPXERR_BAD_SPEC_PARAMS  = 2,\t// Invalid spectral parameters.\n  SPXERR_BAD_SPEC_VAR     = 3,\t// Invalid spectral variable.\n  SPXERR_BAD_INSPEC_COORD = 4 \t// One or more of the inspec coordinates were\n\t\t\t\t// invalid.\n};\n\nstruct spxprm {\n  double restfrq, restwav;\t// Rest frequency [Hz] and wavelength [m].\n\n  int wavetype, velotype;\t// True if wave/velocity types have been\n\t\t\t\t// computed; types are defined below.\n\n  // Spectral variables computed by specx().\n  //--------------------------------------------------------------------------\n  double freq,\t\t\t// wavetype: Frequency [Hz].\n         afrq,\t\t\t// wavetype: Angular frequency [rad/s].\n         ener,\t\t\t// wavetype: Photon energy [J].\n         wavn,\t\t\t// wavetype: Wave number [/m].\n         vrad,\t\t\t// velotype: Radio velocity [m/s].\n         wave,\t\t\t// wavetype: Vacuum wavelength [m].\n         vopt,\t\t\t// velotype: Optical velocity [m/s].\n         zopt,\t\t\t// velotype: Redshift.\n         awav,\t\t\t// wavetype: Air wavelength [m].\n         velo,\t\t\t// velotype: Relativistic velocity [m/s].\n         beta;\t\t\t// velotype: Relativistic beta.\n\n  // Derivatives of spectral variables computed by specx().\n  //--------------------------------------------------------------------------\n  double dfreqafrq, dafrqfreq,\t// Constant, always available.\n         dfreqener, denerfreq,\t// Constant, always available.\n         dfreqwavn, dwavnfreq,\t// Constant, always available.\n         dfreqvrad, dvradfreq,\t// wavetype && velotype.\n         dfreqwave, dwavefreq,\t// wavetype.\n         dfreqawav, dawavfreq,\t// wavetype.\n         dfreqvelo, dvelofreq,\t// wavetype && velotype.\n         dwavevopt, dvoptwave,\t// wavetype && velotype.\n         dwavezopt, dzoptwave,\t// wavetype && velotype.\n         dwaveawav, dawavwave,\t// wavetype.\n         dwavevelo, dvelowave,\t// wavetype && velotype.\n         dawavvelo, dveloawav,\t// wavetype && velotype.\n         dvelobeta, dbetavelo;\t// Constant, always available.\n\n  // Error handling\n  //--------------------------------------------------------------------------\n  struct wcserr *err;\n\n  // Private\n  //--------------------------------------------------------------------------\n  void   *padding;\t\t// (Dummy inserted for alignment purposes.)\n};\n\n// Size of the spxprm struct in int units, used by the Fortran wrappers.\n#define SPXLEN (sizeof(struct spxprm)/sizeof(int))\n\n\nint specx(const char *type, double spec, double restfrq, double restwav,\n          struct spxprm *specs);\n\nint spxperr(const struct spxprm *spx, const char *prefix);\n\n// For use in declaring function prototypes, e.g. in spcprm.\n#define SPX_ARGS double param, int nspec, int instep, int outstep, \\\n    const double inspec[], double outspec[], int stat[]\n\nint freqafrq(SPX_ARGS);\nint afrqfreq(SPX_ARGS);\n\nint freqener(SPX_ARGS);\nint enerfreq(SPX_ARGS);\n\nint freqwavn(SPX_ARGS);\nint wavnfreq(SPX_ARGS);\n\nint freqwave(SPX_ARGS);\nint wavefreq(SPX_ARGS);\n\nint freqawav(SPX_ARGS);\nint awavfreq(SPX_ARGS);\n\nint waveawav(SPX_ARGS);\nint awavwave(SPX_ARGS);\n\nint velobeta(SPX_ARGS);\nint betavelo(SPX_ARGS);\n\n\nint freqvelo(SPX_ARGS);\nint velofreq(SPX_ARGS);\n\nint freqvrad(SPX_ARGS);\nint vradfreq(SPX_ARGS);\n\n\nint wavevelo(SPX_ARGS);\nint velowave(SPX_ARGS);\n\nint awavvelo(SPX_ARGS);\nint veloawav(SPX_ARGS);\n\nint wavevopt(SPX_ARGS);\nint voptwave(SPX_ARGS);\n\nint wavezopt(SPX_ARGS);\nint zoptwave(SPX_ARGS);\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WCSLIB_SPEC\n"},{"id":16601,"name":"dis.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: dis.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"wcserr.h\"\n#include \"wcsprintf.h\"\n#include \"wcsutil.h\"\n#include \"dis.h\"\n\nconst int DISSET = 137;\n\nconst int DIS_TPD        =    1;\nconst int DIS_POLYNOMIAL =    2;\nconst int DIS_DOTPD      = 1024;\n\n// Maximum number of DPja or DQia keywords.\nint NDPMAX = 256;\n\n// Map status return value to message.\nconst char *dis_errmsg[] = {\n  \"Success\",\n  \"Null disprm pointer passed\",\n  \"Memory allocation failed\",\n  \"Invalid parameter value\",\n  \"Distort error\",\n  \"De-distort error\"};\n\n// Convenience macro for invoking wcserr_set().\n#define DIS_ERRMSG(status) WCSERR_SET(status), dis_errmsg[status]\n\n// Internal helper functions, not for general use.\nstatic int polyset(int j, struct disprm *dis);\nstatic int tpdset(int j, struct disprm *dis);\n\nstatic int pol2tpd(int j, struct disprm *dis);\nstatic int tpvset(int j, struct disprm *dis);\nstatic int sipset(int j, struct disprm *dis);\nstatic int dssset(int j, struct disprm *dis);\nstatic int watset(int j, struct disprm *dis);\nstatic int cheleg(int type, int m, int n, double coeffm[], double coeffn[]);\n\nstatic int dispoly(DISP2X_ARGS);\nstatic int tpd1(DISP2X_ARGS);\nstatic int tpd2(DISP2X_ARGS);\nstatic int tpd3(DISP2X_ARGS);\nstatic int tpd4(DISP2X_ARGS);\nstatic int tpd5(DISP2X_ARGS);\nstatic int tpd6(DISP2X_ARGS);\nstatic int tpd7(DISP2X_ARGS);\nstatic int tpd8(DISP2X_ARGS);\nstatic int tpd9(DISP2X_ARGS);\n\n// The first three iparm indices have meanings common to all distortion\n// functions.  They are used by disp2x(), disx2p(), disprt(), and dishdo().\n#define I_DTYPE   0\t// Distortion type code.\n#define I_NIPARM  1\t// Full (allocated) length of iparm[].\n#define I_NDPARM  2\t// No. of parameters in dparm[], excl. work space.\n\n//----------------------------------------------------------------------------\n\nint disndp(int ndpmax) { if (ndpmax >= 0) NDPMAX = ndpmax; return NDPMAX; }\n\n//----------------------------------------------------------------------------\n\nint dpfill(\n  struct dpkey *dp,\n  const char *keyword,\n  const char *field,\n  int j,\n  int type,\n  int i,\n  double f)\n\n{\n  if (keyword) {\n    if (field) {\n      if (j && 2 <= strlen(keyword)) {\n        // Fill in the axis number from the value given.\n        if (keyword[2] == '\\0') {\n          sprintf(dp->field, \"%s%d.%s\", keyword, j, field);\n        } else {\n          // Take care not to overwrite any alternate code.\n          char axno[8];\n          sprintf(dp->field, \"%s.%s\", keyword, field);\n          sprintf(axno, \"%d\", j);\n          dp->field[2] = axno[0];\n        }\n\n      } else {\n        sprintf(dp->field, \"%s.%s\", keyword, field);\n      }\n    } else {\n      strcpy(dp->field, keyword);\n    }\n  } else if (field) {\n    strcpy(dp->field, field);\n  }\n\n  if (j) {\n    dp->j = j;\n  } else {\n    // The field name must either be given or preset.\n    char *cp;\n    if ((cp = strpbrk(dp->field, \"0123456789\")) != 0x0) {\n      sscanf(cp, \"%d.\", &(dp->j));\n    }\n  }\n\n  if ((dp->type = type)) {\n    dp->value.f = f;\n  } else {\n    dp->value.i = i;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint dpkeyi(const struct dpkey *dp)\n\n{\n  if (dp->type != 0) {\n    return (int)dp->value.f;\n  }\n\n  return dp->value.i;\n}\n\n//----------------------------------------------------------------------------\n\ndouble dpkeyd(const struct dpkey *dp)\n\n{\n  if (dp->type == 0) {\n    return (double)dp->value.i;\n  }\n\n  return dp->value.f;\n}\n\n//----------------------------------------------------------------------------\n\nint disini(int alloc, int naxis, struct disprm *dis)\n\n{\n  return disinit(alloc, naxis, dis, -1);\n}\n\n//----------------------------------------------------------------------------\n\nint disinit(int alloc, int naxis, struct disprm *dis, int ndpmax)\n\n{\n  static const char *function = \"disinit\";\n\n  // Check inputs.\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n\n  if (ndpmax < 0) ndpmax = disndp(-1);\n\n\n  // Initialize error message handling.\n  if (dis->flag == -1) {\n    dis->err = 0x0;\n  }\n  struct wcserr **err = &(dis->err);\n  wcserr_clear(err);\n\n\n  // Initialize pointers.\n  if (dis->flag == -1 || dis->m_flag != DISSET) {\n    if (dis->flag == -1) {\n      dis->docorr = 0x0;\n      dis->Nhat   = 0x0;\n\n      dis->axmap  = 0x0;\n      dis->offset = 0x0;\n      dis->scale  = 0x0;\n      dis->iparm  = 0x0;\n      dis->dparm  = 0x0;\n\n      dis->disp2x = 0x0;\n      dis->disx2p = 0x0;\n      dis->tmpmem = 0x0;\n\n      dis->i_naxis = 0;\n    }\n\n    // Initialize memory management.\n    dis->m_flag   = 0;\n    dis->m_naxis  = 0;\n    dis->m_dtype  = 0x0;\n    dis->m_dp     = 0x0;\n    dis->m_maxdis = 0x0;\n  }\n\n  if (naxis < 0) {\n    return wcserr_set(WCSERR_SET(DISERR_MEMORY),\n      \"naxis must not be negative (got %d)\", naxis);\n  }\n\n\n  // Allocate memory for arrays if required.\n  if (alloc ||\n      dis->dtype  == 0x0 ||\n      (ndpmax && dis->dp == 0x0) ||\n      dis->maxdis == 0x0) {\n\n    // Was sufficient allocated previously?\n    if (dis->m_flag == DISSET &&\n       (dis->m_naxis < naxis  ||\n        dis->ndpmax  < ndpmax)) {\n      // No, free it.\n      disfree(dis);\n    }\n\n    if (alloc || dis->dtype == 0x0) {\n      if (dis->m_dtype) {\n        // In case the caller fiddled with it.\n        dis->dtype = dis->m_dtype;\n\n      } else {\n        if ((dis->dtype = calloc(naxis, sizeof(char [72]))) == 0x0) {\n          disfree(dis);\n          return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n        }\n\n        dis->m_flag  = DISSET;\n        dis->m_naxis = naxis;\n        dis->m_dtype = dis->dtype;\n      }\n    }\n\n    if (alloc || dis->dp == 0x0) {\n      if (dis->m_dp) {\n        // In case the caller fiddled with it.\n        dis->dp = dis->m_dp;\n\n      } else {\n        if (ndpmax) {\n          if ((dis->dp = calloc(ndpmax, sizeof(struct dpkey))) == 0x0) {\n            disfree(dis);\n            return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n          }\n        } else {\n          dis->dp = 0x0;\n        }\n\n        dis->ndpmax  = ndpmax;\n\n        dis->m_flag  = DISSET;\n        dis->m_naxis = naxis;\n        dis->m_dp    = dis->dp;\n      }\n    }\n\n    if (alloc || dis->maxdis == 0x0) {\n      if (dis->m_maxdis) {\n        // In case the caller fiddled with it.\n        dis->maxdis = dis->m_maxdis;\n\n      } else {\n        if ((dis->maxdis = calloc(naxis, sizeof(double))) == 0x0) {\n          disfree(dis);\n          return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n        }\n\n        dis->m_flag  = DISSET;\n        dis->m_naxis = naxis;\n        dis->m_maxdis = dis->maxdis;\n      }\n    }\n  }\n\n\n  // Set defaults.\n  dis->flag  = 0;\n  dis->naxis = naxis;\n\n  if (naxis) {\n    memset(dis->dtype, 0, naxis*sizeof(char [72]));\n  }\n\n  dis->ndp = 0;\n  if (ndpmax) {\n    memset(dis->dp, 0, ndpmax*sizeof(struct dpkey));\n  }\n\n  if (naxis) {\n    memset(dis->maxdis, 0, naxis*sizeof(double));\n  }\n  dis->totdis = 0.0;\n\n  return 0;\n}\n\n\n//----------------------------------------------------------------------------\n\nint discpy(int alloc, const struct disprm *dissrc, struct disprm *disdst)\n\n{\n  static const char *function = \"discpy\";\n\n  if (dissrc == 0x0) return DISERR_NULL_POINTER;\n  if (disdst == 0x0) return DISERR_NULL_POINTER;\n  struct wcserr **err = &(disdst->err);\n\n  int naxis = dissrc->naxis;\n  if (naxis < 1) {\n    return wcserr_set(WCSERR_SET(DISERR_MEMORY),\n      \"naxis must be positive (got %d)\", naxis);\n  }\n\n  int status;\n  if ((status = disinit(alloc, naxis, disdst, dissrc->ndpmax))) {\n    return status;\n  }\n\n  memcpy(disdst->dtype, dissrc->dtype, naxis*sizeof(char [72]));\n\n  disdst->ndp = dissrc->ndp;\n  memcpy(disdst->dp, dissrc->dp, dissrc->ndpmax*sizeof(struct dpkey));\n\n  memcpy(disdst->maxdis, dissrc->maxdis, naxis*sizeof(double));\n  disdst->totdis = dissrc->totdis;\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint disfree(struct disprm *dis)\n\n{\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n\n  if (dis->flag != -1) {\n    // Optionally allocated by disinit() for given parameters.\n    if (dis->m_flag == DISSET) {\n      if (dis->dtype  == dis->m_dtype)  dis->dtype  = 0x0;\n      if (dis->dp     == dis->m_dp)     dis->dp     = 0x0;\n      if (dis->maxdis == dis->m_maxdis) dis->maxdis = 0x0;\n\n      if (dis->m_dtype)  free(dis->m_dtype);\n      if (dis->m_dp)     free(dis->m_dp);\n      if (dis->m_maxdis) free(dis->m_maxdis);\n    }\n\n    // The remainder were allocated by disset().\n    if (dis->docorr) free(dis->docorr);\n    if (dis->Nhat)   free(dis->Nhat);\n\n    // Recall that axmap, offset, and scale were allocated in bulk.\n    if (dis->axmap  && dis->axmap[0])  free(dis->axmap[0]);\n    if (dis->offset && dis->offset[0]) free(dis->offset[0]);\n    if (dis->scale  && dis->scale[0])  free(dis->scale[0]);\n\n    if (dis->axmap)  free(dis->axmap);\n    if (dis->offset) free(dis->offset);\n    if (dis->scale)  free(dis->scale);\n\n    if (dis->iparm) {\n      for (int j = 0; j < dis->i_naxis; j++) {\n        if (dis->iparm[j]) free(dis->iparm[j]);\n      }\n      free(dis->iparm);\n    }\n\n    if (dis->dparm) {\n      for (int j = 0; j < dis->i_naxis; j++) {\n        if (dis->dparm[j]) free(dis->dparm[j]);\n      }\n      free(dis->dparm);\n    }\n\n    if (dis->disp2x) free(dis->disp2x);\n    if (dis->disx2p) free(dis->disx2p);\n    if (dis->tmpmem) free(dis->tmpmem);\n  }\n\n  dis->m_flag   = 0;\n  dis->m_naxis  = 0;\n  dis->m_dtype  = 0x0;\n  dis->m_dp     = 0x0;\n  dis->m_maxdis = 0x0;\n\n  dis->docorr = 0x0;\n  dis->Nhat   = 0x0;\n  dis->axmap  = 0x0;\n  dis->offset = 0x0;\n  dis->scale  = 0x0;\n  dis->iparm  = 0x0;\n  dis->dparm  = 0x0;\n  dis->disp2x = 0x0;\n  dis->disx2p = 0x0;\n  dis->tmpmem = 0x0;\n\n  wcserr_clear(&(dis->err));\n\n  dis->flag = 0;\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint dissize(const struct disprm *dis, int sizes[2])\n\n{\n  if (dis == 0x0) {\n    sizes[0] = sizes[1] = 0;\n    return DISERR_NULL_POINTER;\n  }\n\n  // Base size, in bytes.\n  sizes[0] = sizeof(struct disprm);\n\n  // Total size of allocated memory, in bytes.\n  sizes[1] = 0;\n\n  int naxis = dis->naxis;\n\n  // disprm::dtype[].\n  sizes[1] += naxis * sizeof(char [72]);\n\n  // disprm::dp[].\n  sizes[1] += dis->ndpmax * sizeof(struct dpkey);\n\n  // disprm::maxdis[].\n  sizes[1] += naxis * sizeof(double);\n\n  // dis::err[].\n  int exsizes[2];\n  wcserr_size(dis->err, exsizes);\n  sizes[1] += exsizes[0] + exsizes[1];\n\n  // The remaining arrays are allocated by disset().\n  if (dis->flag != DISSET) {\n    return DISERR_SUCCESS;\n  }\n\n  // dis::docorr[].\n  sizes[1] += naxis * sizeof(int *);\n\n  // dis::Nhat[].\n  sizes[1] += naxis * sizeof(int *);\n\n  // dis::axmap[][].\n  sizes[1] += naxis * sizeof(int *);\n  sizes[1] += naxis*naxis * sizeof(int);\n\n  // dis::offset[][].\n  sizes[1] += naxis * sizeof(double *);\n  sizes[1] += naxis*naxis * sizeof(double);\n\n  // dis::scale[][].\n  sizes[1] += naxis * sizeof(double *);\n  sizes[1] += naxis*naxis * sizeof(double);\n\n  // dis::iparm[][].\n  sizes[1] += naxis * sizeof(int *);\n  for (int j = 0; j < naxis; j++) {\n    if (dis->iparm[j]) {\n      sizes[1] += dis->iparm[j][I_NIPARM] * sizeof(int);\n    }\n  }\n\n  // dis::dparm[][].\n  sizes[1] += naxis * sizeof(double *);\n  for (int j = 0; j < naxis; j++) {\n    if (dis->dparm[j]) {\n      sizes[1] += dis->dparm[j][I_NDPARM] * sizeof(double);\n    }\n  }\n\n  // dis::disp2x[].\n  sizes[1] += naxis * sizeof(int (*)(DISP2X_ARGS));\n\n  // dis::disx2p[].\n  sizes[1] += naxis * sizeof(int (*)(DISX2P_ARGS));\n\n  // dis::tmpmem[].\n  sizes[1] += 5*naxis * sizeof(double);\n\n  return DISERR_SUCCESS;\n}\n\n//----------------------------------------------------------------------------\n\nint disprt(const struct disprm *dis)\n\n{\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n\n  if (dis->flag != DISSET) {\n    wcsprintf(\"The disprm struct is UNINITIALIZED.\\n\");\n    return 0;\n  }\n\n  int naxis = dis->naxis;\n\n\n  wcsprintf(\"       flag: %d\\n\", dis->flag);\n\n  // Parameters supplied.\n  wcsprintf(\"      naxis: %d\\n\", naxis);\n\n  WCSPRINTF_PTR(\"      dtype: \", dis->dtype, \"\\n\");\n  for (int j = 0; j < naxis; j++) {\n    wcsprintf(\"             \\\"%s\\\"\\n\", dis->dtype[j]);\n  }\n\n  wcsprintf(\"        ndp: %d\\n\", dis->ndp);\n  wcsprintf(\"     ndpmax: %d\\n\", dis->ndpmax);\n  WCSPRINTF_PTR(\"         dp: \", dis->dp, \"\\n\");\n  for (int i = 0; i < dis->ndp; i++) {\n    if (dis->dp[i].type) {\n      wcsprintf(\"             %3d%3d  %#- 11.5g  %.32s\\n\",\n        dis->dp[i].j, dis->dp[i].type, dis->dp[i].value.f, dis->dp[i].field);\n    } else {\n      wcsprintf(\"             %3d%3d  %11d  %.32s\\n\",\n        dis->dp[i].j, dis->dp[i].type, dis->dp[i].value.i, dis->dp[i].field);\n    }\n  }\n\n  WCSPRINTF_PTR(\"     maxdis: \", dis->maxdis, \"\\n\");\n  wcsprintf(\"            \");\n  for (int j = 0; j < naxis; j++) {\n    wcsprintf(\"  %#- 11.5g\", dis->maxdis[j]);\n  }\n  wcsprintf(\"\\n\");\n\n  wcsprintf(\"     totdis:  %#- 11.5g\\n\", dis->totdis);\n\n  // Derived values.\n  WCSPRINTF_PTR(\"     docorr: \", dis->docorr, \"\\n\");\n  wcsprintf(\"            \");\n  for (int j = 0; j < naxis; j++) {\n    wcsprintf(\"%6d\", dis->docorr[j]);\n  }\n  wcsprintf(\"\\n\");\n\n  WCSPRINTF_PTR(\"       Nhat: \", dis->Nhat, \"\\n\");\n  wcsprintf(\"            \");\n  for (int j = 0; j < naxis; j++) {\n    wcsprintf(\"%6d\", dis->Nhat[j]);\n  }\n  wcsprintf(\"\\n\");\n\n  WCSPRINTF_PTR(\"      axmap: \", dis->axmap, \"\\n\");\n  for (int j = 0; j < naxis; j++) {\n    wcsprintf(\" axmap[%d][]:\", j);\n    for (int jhat = 0; jhat < naxis; jhat++) {\n      wcsprintf(\"%6d\", dis->axmap[j][jhat]);\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  WCSPRINTF_PTR(\"     offset: \", dis->offset, \"\\n\");\n  for (int j = 0; j < naxis; j++) {\n    wcsprintf(\"offset[%d][]:\", j);\n    for (int jhat = 0; jhat < naxis; jhat++) {\n      wcsprintf(\"  %#- 11.5g\", dis->offset[j][jhat]);\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  WCSPRINTF_PTR(\"      scale: \", dis->scale, \"\\n\");\n  for (int j = 0; j < naxis; j++) {\n    wcsprintf(\" scale[%d][]:\", j);\n    for (int jhat = 0; jhat < naxis; jhat++) {\n      wcsprintf(\"  %#- 11.5g\", dis->scale[j][jhat]);\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  WCSPRINTF_PTR(\"      iparm: \", dis->iparm, \"\\n\");\n  for (int j = 0; j < naxis; j++) {\n    wcsprintf(\" iparm[%d]  : \", j);\n    WCSPRINTF_PTR(\"\", dis->iparm[j], \"\\n\");\n\n    if (dis->iparm[j]) {\n      wcsprintf(\" iparm[%d][]:\", j);\n      for (int k = 0; k < dis->iparm[j][I_NIPARM]; k++) {\n        if (k && k%5 == 0) {\n          wcsprintf(\"\\n            \");\n        }\n        wcsprintf(\"  %11d\", dis->iparm[j][k]);\n      }\n      wcsprintf(\"\\n\");\n    }\n  }\n\n  WCSPRINTF_PTR(\"      dparm: \", dis->dparm, \"\\n\");\n  for (int j = 0; j < naxis; j++) {\n    wcsprintf(\" dparm[%d]  : \", j);\n    WCSPRINTF_PTR(\"\", dis->dparm[j], \"\\n\");\n\n    if (dis->dparm[j]) {\n      wcsprintf(\" dparm[%d][]:\", j);\n      for (int k = 0; k < dis->iparm[j][I_NDPARM]; k++) {\n        if (k && k%5 == 0) {\n          wcsprintf(\"\\n            \");\n        }\n        wcsprintf(\"  %#- 11.5g\", dis->dparm[j][k]);\n      }\n      wcsprintf(\"\\n\");\n    }\n  }\n\n  wcsprintf(\"    i_naxis: %d\\n\", dis->i_naxis);\n  wcsprintf(\"       ndis: %d\\n\", dis->ndis);\n\n  // Error handling.\n  WCSPRINTF_PTR(\"        err: \", dis->err, \"\\n\");\n  if (dis->err) {\n    wcserr_prt(dis->err, \"             \");\n  }\n\n  // Work arrays.\n  char hext[32];\n  WCSPRINTF_PTR(\"     disp2x: \", dis->disp2x, \"\\n\");\n  for (int j = 0; j < naxis; j++) {\n    wcsprintf(\"  disp2x[%d]: %s\", j,\n      wcsutil_fptr2str((void (*)(void))dis->disp2x[j], hext));\n    if (dis->disp2x[j] == dispoly) {\n      wcsprintf(\"  (= dispoly)\\n\");\n    } else if (dis->disp2x[j] == tpd1) {\n      wcsprintf(\"  (= tpd1)\\n\");\n    } else if (dis->disp2x[j] == tpd2) {\n      wcsprintf(\"  (= tpd2)\\n\");\n    } else if (dis->disp2x[j] == tpd3) {\n      wcsprintf(\"  (= tpd3)\\n\");\n    } else if (dis->disp2x[j] == tpd4) {\n      wcsprintf(\"  (= tpd4)\\n\");\n    } else if (dis->disp2x[j] == tpd5) {\n      wcsprintf(\"  (= tpd5)\\n\");\n    } else if (dis->disp2x[j] == tpd6) {\n      wcsprintf(\"  (= tpd6)\\n\");\n    } else if (dis->disp2x[j] == tpd7) {\n      wcsprintf(\"  (= tpd7)\\n\");\n    } else if (dis->disp2x[j] == tpd8) {\n      wcsprintf(\"  (= tpd8)\\n\");\n    } else if (dis->disp2x[j] == tpd9) {\n      wcsprintf(\"  (= tpd9)\\n\");\n    } else {\n      wcsprintf(\"\\n\");\n    }\n  }\n  WCSPRINTF_PTR(\"     disx2p: \", dis->disx2p, \"\\n\");\n  for (int j = 0; j < naxis; j++) {\n    wcsprintf(\"  disx2p[%d]: %s\\n\", j,\n      wcsutil_fptr2str((void (*)(void))dis->disx2p[j], hext));\n  }\n  WCSPRINTF_PTR(\"     tmpmem: \", dis->tmpmem, \"\\n\");\n\n  // Memory management.\n  wcsprintf(\"     m_flag: %d\\n\", dis->m_flag);\n  wcsprintf(\"    m_naxis: %d\\n\", dis->m_naxis);\n  WCSPRINTF_PTR(\"    m_dtype: \", dis->m_dtype, \"\");\n  if (dis->m_dtype  == dis->dtype)  wcsprintf(\"  (= dtype)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"       m_dp: \", dis->m_dp, \"\");\n  if (dis->m_dp     == dis->dp)     wcsprintf(\"  (= dp)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"   m_maxdis: \", dis->m_maxdis, \"\");\n  if (dis->m_maxdis == dis->maxdis) wcsprintf(\"  (= maxdis)\");\n  wcsprintf(\"\\n\");\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint disperr(const struct disprm *dis, const char *prefix)\n\n{\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n\n  if (dis->err) {\n    wcserr_prt(dis->err, prefix);\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint dishdo(struct disprm *dis)\n\n{\n  static const char *function = \"dishdo\";\n\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  struct wcserr **err = &(dis->err);\n\n  int status = 0;\n  for (int j = 0; j < dis->naxis; j++) {\n    if (dis->iparm[j][I_DTYPE]) {\n      if (dis->iparm[j][I_DTYPE] == DIS_TPD) {\n        // Implemented as TPD...\n        if (strcmp(dis->dtype[j], \"TPD\") != 0) {\n          // ... but isn't TPD.\n          dis->iparm[j][I_DTYPE] |= DIS_DOTPD;\n        }\n      } else {\n        // Must be a Polynomial that can't be implemented as TPD.\n        status = wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Translation of %s to TPD is not possible\", dis->dtype[j]);\n      }\n    }\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint disset(struct disprm *dis)\n\n{\n  static const char *function = \"disset\";\n\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  struct wcserr **err = &(dis->err);\n\n  int naxis = dis->naxis;\n\n\n  // Do basic checks.\n  if (dis->ndp < 0) {\n    return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n      \"disprm::ndp is negative (%d)\", dis->ndp);\n  }\n\n  int ndis = 0;\n  for (int j = 0; j < naxis; j++) {\n    if (strlen(dis->dtype[j])) {\n      ndis++;\n      break;\n    }\n  }\n\n  char *dpq;\n  if (dis->ndp) {\n    // Is it prior or sequent?\n    if (dis->dp[0].field[1] == 'P') {\n      dpq = \"DPja\";\n    } else if (dis->dp[0].field[1] == 'Q') {\n      dpq = \"DQia\";\n    } else {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"disprm::dp[0].field (%s) is invalid\", dis->dp[0].field);\n    }\n\n  } else {\n    if (ndis) {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"No DPja or DQia keywords, NAXES at least is required for each \"\n        \"distortion\");\n    }\n\n    // A Clayton's distortion.  Avert compiler warnings about possible use of\n    // uninitialized variables.\n    dpq = 0x0;\n  }\n\n\n  // Free memory allocated separately for each axis.\n  for (int j = 0; j < dis->i_naxis; j++) {\n    if (dis->iparm[j]) free(dis->iparm[j]);\n    if (dis->dparm[j]) free(dis->dparm[j]);\n    dis->iparm[j] = 0x0;\n    dis->dparm[j] = 0x0;\n  }\n\n  // Allocate or reallocate memory, if necessary, for derived parameter and\n  // work arrays sized according to the number of axes.\n  if (dis->i_naxis < naxis) {\n    if (dis->i_naxis) {\n      free(dis->docorr);\n      free(dis->Nhat);\n\n      // Noting that axmap, offset, and scale are allocated in bulk.\n      free(dis->axmap[0]);\n      free(dis->axmap);\n      free(dis->offset[0]);\n      free(dis->offset);\n      free(dis->scale[0]);\n      free(dis->scale);\n\n      free(dis->iparm);\n      free(dis->dparm);\n\n      free(dis->disp2x);\n      free(dis->disx2p);\n\n      free(dis->tmpmem);\n    }\n\n    if ((dis->docorr = calloc(naxis, sizeof(int *))) == 0x0) {\n      disfree(dis);\n      return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n    }\n\n    if ((dis->Nhat = calloc(naxis, sizeof(int *))) == 0x0) {\n      disfree(dis);\n      return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n    }\n\n    // Allocate axmap[][] in bulk and then carve it up.\n    if ((dis->axmap = calloc(naxis, sizeof(int *))) == 0x0) {\n      disfree(dis);\n      return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n    }\n\n    if ((dis->axmap[0] = calloc(naxis*naxis, sizeof(int))) == 0x0) {\n      disfree(dis);\n      return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n    }\n\n    for (int j = 1; j < naxis; j++) {\n      dis->axmap[j] = dis->axmap[j-1] + naxis;\n    }\n\n    // Allocate offset[][] in bulk and then carve it up.\n    if ((dis->offset = calloc(naxis, sizeof(double *))) == 0x0) {\n      disfree(dis);\n      return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n    }\n\n    if ((dis->offset[0] = calloc(naxis*naxis, sizeof(double))) == 0x0) {\n      disfree(dis);\n      return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n    }\n\n    for (int j = 1; j < naxis; j++) {\n      dis->offset[j] = dis->offset[j-1] + naxis;\n    }\n\n    // Allocate scale[][] in bulk and then carve it up.\n    if ((dis->scale = calloc(naxis, sizeof(double *))) == 0x0) {\n      disfree(dis);\n      return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n    }\n\n    if ((dis->scale[0] = calloc(naxis*naxis, sizeof(double))) == 0x0) {\n      disfree(dis);\n      return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n    }\n\n    for (int j = 1; j < naxis; j++) {\n      dis->scale[j] = dis->scale[j-1] + naxis;\n    }\n\n    if ((dis->iparm = calloc(naxis, sizeof(int *))) == 0x0) {\n      disfree(dis);\n      return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n    }\n\n    if ((dis->dparm = calloc(naxis, sizeof(double *))) == 0x0) {\n      disfree(dis);\n      return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n    }\n\n    if ((dis->disp2x = calloc(naxis, sizeof(int (*)(DISP2X_ARGS)))) == 0x0) {\n      disfree(dis);\n      return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n    }\n\n    if ((dis->disx2p = calloc(naxis, sizeof(int (*)(DISX2P_ARGS)))) == 0x0) {\n      disfree(dis);\n      return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n    }\n\n    if ((dis->tmpmem = calloc(5*naxis, sizeof(double))) == 0x0) {\n      disfree(dis);\n      return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n    }\n\n    dis->i_naxis = naxis;\n  }\n\n  // Start with a clean slate.\n  for (int j = 0; j < naxis; j++) {\n    dis->docorr[j] = 1;\n  }\n\n  memset(dis->Nhat, 0, naxis*sizeof(int));\n\n  for (int jhat = 0; jhat < naxis*naxis; jhat++) {\n    dis->axmap[0][jhat] = -1;\n  }\n\n  memset(dis->offset[0], 0, naxis*naxis*sizeof(double));\n\n  for (int jhat = 0; jhat < naxis*naxis; jhat++) {\n    dis->scale[0][jhat] = 1.0;\n  }\n\n  // polyset() etc. must look after iparm[][] and dparm[][].\n\n  dis->i_naxis = naxis;\n  dis->ndis    = 0;\n\n  memset(dis->disp2x, 0, naxis*sizeof(int (*)(DISP2X_ARGS)));\n  memset(dis->disx2p, 0, naxis*sizeof(int (*)(DISX2P_ARGS)));\n  memset(dis->tmpmem, 0, naxis*sizeof(double));\n\n\n  // Handle DPja or DQia keywords common to all distortions.\n  struct dpkey *keyp = dis->dp;\n  for (int idp = 0; idp < dis->ndp; idp++, keyp++) {\n    // Check that they're all one kind or the other.\n    if (keyp->field[1] != dpq[1]) {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"disprm::dp appears to contain a mix of DPja and DQia keys\");\n    }\n\n    int j = keyp->j;\n\n    if (j < 1 || naxis < j) {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Invalid axis number (%d) in %s\", j, keyp->field);\n    }\n\n    char *fp;\n    if ((fp = strchr(keyp->field, '.')) == 0x0) {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Invalid record field name: %s\", j, keyp->field);\n    }\n    fp++;\n\n    // Convert to 0-relative axis number.\n    j--;\n\n    if (strncmp(fp, \"DOCORR\", 7) == 0) {\n      if (dpkeyi(keyp) == 0) {\n        dis->docorr[j] = 0;\n      }\n\n    } else if (strncmp(fp, \"NAXES\", 6) == 0) {\n      int Nhat = dpkeyi(keyp);\n      if (Nhat < 0 || naxis < Nhat) {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Invalid value of Nhat for %s distortion in %s: %d\", dis->dtype[j],\n          keyp->field, Nhat);\n      }\n\n      dis->Nhat[j] = Nhat;\n\n    } else if (strncmp(fp, \"AXIS.\", 5) == 0) {\n      int jhat;\n      sscanf(fp+5, \"%d\", &jhat);\n      if (jhat < 1 || naxis < jhat) {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Invalid axis in axis map for %s distortion in %s: %d\",\n          dis->dtype[j], keyp->field, jhat);\n      }\n\n      // N.B. axis numbers in the map are 0-relative.\n      dis->axmap[j][jhat-1] = dpkeyi(keyp) - 1;\n\n    } else if (strncmp(fp, \"OFFSET.\", 7) == 0) {\n      int jhat;\n      sscanf(fp+7, \"%d\", &jhat);\n      dis->offset[j][jhat-1] = dpkeyd(keyp);\n\n    } else if (strncmp(fp, \"SCALE.\", 6) == 0) {\n      int jhat;\n      sscanf(fp+6, \"%d\", &jhat);\n      dis->scale[j][jhat-1] = dpkeyd(keyp);\n    }\n  }\n\n  // Set defaults and do sanity checks on axmap[][].\n  for (int j = 0; j < naxis; j++) {\n    if (strlen(dis->dtype[j]) == 0) {\n      // No distortion on this axis, check that there are no parameters.\n      keyp = dis->dp;\n      for (int idp = 0; idp < dis->ndp; idp++, keyp++) {\n        if (keyp->j == j+1) {\n          return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n            \"No distortion type, yet %s keyvalues are present for axis %d\",\n            dpq, j+1);\n        }\n      }\n\n      continue;\n    }\n\n    // N.B. NAXES (Nhat) has no default value.\n    if (dis->Nhat[j] <= 0) {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"%s.NAXES was not set (or bad) for %s distortion on axis %d\",\n        dpq, dis->dtype[j], j+1);\n    }\n\n    // Set defaults for axmap[][].\n    int Nhat = dis->Nhat[j];\n    for (int jhat = 0; jhat < Nhat; jhat++) {\n      if (dis->axmap[j][jhat] == -1) {\n        dis->axmap[j][jhat] = jhat;\n      }\n    }\n\n    // Sanity check on the length of the axis map.\n    Nhat = 0;\n    for (int jhat = 0; jhat < naxis; jhat++) {\n      if (dis->axmap[j][jhat] != -1) Nhat = jhat+1;\n    }\n\n    if (Nhat != dis->Nhat[j]) {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Mismatch in length of axis map for %s distortion on axis %d\",\n        dis->dtype[j], j+1);\n    }\n\n    // Check uniqueness of entries in the axis map.\n    for (int jhat = 0; jhat < Nhat; jhat++) {\n      for (int k = 0; k < jhat; k++) {\n        if (dis->axmap[j][jhat] == dis->axmap[j][k]) {\n          return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n            \"Duplicated entry in axis map for %s distortion on axis %d\",\n            dis->dtype[j], j+1);\n        }\n      }\n    }\n  }\n\n\n  // Identify the distortion functions.\n  ndis = 0;\n  for (int j = 0; j < naxis; j++) {\n    if (strlen(dis->dtype[j]) == 0) {\n      // No distortion on this axis.\n      continue;\n    }\n\n    if (dis->Nhat[j] == 0) {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Empty axis map for %s distortion on axis %d\", dis->dtype[j], j+1);\n    }\n\n    // Invoke the specific setup functions for each distortion.\n    int status;\n    if (strcmp(dis->dtype[j], \"TPD\") == 0) {\n      // Template Polynomial Distortion.\n      if ((status = tpdset(j, dis))) {\n        // (Preserve the error message set by tpdset().)\n        return status;\n      }\n\n    } else if (strcmp(dis->dtype[j], \"TPV\") == 0) {\n      // TPV \"projection\".\n      if ((status = tpvset(j, dis))) {\n        // (Preserve the error message set by tpvset().)\n        return status;\n      }\n\n    } else if (strcmp(dis->dtype[j], \"SIP\") == 0) {\n      // Simple Imaging Polynomial (SIP).\n      if ((status = sipset(j, dis))) {\n        // (Preserve the error message set by sipset().)\n        return status;\n      }\n\n    } else if (strcmp(dis->dtype[j], \"DSS\") == 0) {\n      // Digitized Sky Survey (DSS).\n      if ((status = dssset(j, dis))) {\n        // (Preserve the error message set by dssset().)\n        return status;\n      }\n\n    } else if (strncmp(dis->dtype[j], \"WAT\", 3) == 0) {\n      // WAT (TNX or ZPX \"projections\").\n      if ((status = watset(j, dis))) {\n        // (Preserve the error message set by watset().)\n        return status;\n      }\n\n    } else if (strcmp(dis->dtype[j], \"Polynomial\")  == 0 ||\n               strcmp(dis->dtype[j], \"Polynomial*\") == 0) {\n      // General polynomial distortion.\n      if ((status = polyset(j, dis))) {\n        // (Preserve the error message set by polyset().)\n        return status;\n      }\n\n    } else {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Unrecognized/unimplemented distortion function: %s\", dis->dtype[j]);\n    }\n\n    ndis++;\n  }\n\n  dis->ndis = ndis;\n  dis->flag = DISSET;\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint disp2x(\n  struct disprm *dis,\n  const double rawcrd[],\n  double discrd[])\n\n{\n  static const char *function = \"disp2x\";\n\n  // Initialize.\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  struct wcserr **err = &(dis->err);\n\n  if (dis->flag != DISSET) {\n    int status;\n    if ((status = disset(dis))) return status;\n  }\n\n  int naxis = dis->naxis;\n\n\n  // Invoke the distortion functions for each axis.\n  double *tmpcrd = dis->tmpmem;\n  for (int j = 0; j < naxis; j++) {\n    if (dis->disp2x[j]) {\n      double *offset = dis->offset[j];\n      double *scale  = dis->scale[j];\n\n      int Nhat = dis->Nhat[j];\n      for (int jhat = 0; jhat < Nhat; jhat++) {\n        int axisj = dis->axmap[j][jhat];\n        tmpcrd[jhat] = (rawcrd[axisj] - offset[jhat])*scale[jhat];\n      }\n\n      double dtmp;\n      if ((dis->disp2x[j])(0, dis->iparm[j], dis->dparm[j], Nhat, tmpcrd,\n                           &dtmp)) {\n        return wcserr_set(DIS_ERRMSG(DISERR_DISTORT));\n      }\n\n      if (dis->docorr[j]) {\n        // Distortion function computes a correction to be applied.\n        discrd[j] = rawcrd[j] + dtmp;\n      } else {\n        // Distortion function computes corrected coordinates directly.\n        discrd[j] = dtmp;\n      }\n\n    } else {\n      discrd[j] = rawcrd[j];\n    }\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n// This function is intended for debugging purposes only.\n// No documentation or prototype is provided in dis.h.\n\nint disitermax(int itermax)\n\n{\n  static int ITERMAX = 30;\n\n  if (itermax >= 0) {\n    ITERMAX = itermax;\n  }\n\n  return ITERMAX;\n}\n\n//----------------------------------------------------------------------------\n\nint disx2p(\n  struct disprm *dis,\n  const double discrd[],\n  double rawcrd[])\n\n{\n  static const char *function = \"disx2p\";\n\n  const double TOL = 1.0e-13;\n\n  int status;\n\n  // Initialize.\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  struct wcserr **err = &(dis->err);\n\n  int naxis = dis->naxis;\n\n  // Carve up working memory, noting that disp2x() gets to it first.\n  double *dcrd0 = dis->tmpmem + naxis;\n  double *dcrd1 = dcrd0 + naxis;\n  double *rcrd1 = dcrd1 + naxis;\n  double *delta = rcrd1 + naxis;\n\n\n  // Zeroth approximation.  The assumption here and below is that the\n  // distortion is small so that, to first order in the neighbourhood of\n  // the solution, discrd[j] ~= a + b*rawcrd[j], i.e. independent of\n  // rawcrd[i], where i != j.  This is effectively equivalent to assuming\n  // that the distortion functions are separable to first order.\n  // Furthermore, a is assumed to be small, and b close to unity.\n  memcpy(rawcrd, discrd, naxis*sizeof(double));\n\n  // If available, use disprm::disx2p to improve the zeroth approximation.\n  for (int j = 0; j < naxis; j++) {\n    if (dis->disx2p[j]) {\n      double *offset = dis->offset[j];\n      double *scale  = dis->scale[j];\n      double *tmpcrd = dis->tmpmem;\n\n      int Nhat = dis->Nhat[j];\n      for (int jhat = 0; jhat < Nhat; jhat++) {\n        int axisj = dis->axmap[j][jhat];\n        tmpcrd[jhat] = (discrd[axisj] - offset[jhat])*scale[jhat];\n      }\n\n      double rtmp;\n      if ((status = (dis->disx2p[j])(1, dis->iparm[j], dis->dparm[j], Nhat,\n                                     tmpcrd, &rtmp))) {\n        return wcserr_set(DIS_ERRMSG(DISERR_DEDISTORT));\n      }\n\n      if (dis->docorr[j]) {\n        // Inverse distortion function computes a correction to be applied.\n        rawcrd[j] = discrd[j] + rtmp;\n      } else {\n        // Inverse distortion function computes corrected coordinates directly.\n        rawcrd[j] = rtmp;\n      }\n    }\n  }\n\n  // Quick return debugging hook, assumes inverse functions were defined.\n  int itermax;\n  if ((itermax = disitermax(-1)) == 0) {\n    return 0;\n  }\n\n\n  // Iteratively invert the (well-behaved!) distortion function.\n  int convergence, iter;\n  for (iter = 0; iter < itermax; iter++) {\n    if ((status = disp2x(dis, rawcrd, dcrd0))) {\n      return wcserr_set(DIS_ERRMSG(status));\n    }\n\n    // Check for convergence.\n    convergence = 1;\n    for (int j = 0; j < naxis; j++) {\n      delta[j] = discrd[j] - dcrd0[j];\n\n      double dd;\n      if (fabs(discrd[j]) < 1.0) {\n        dd = delta[j];\n      } else {\n        // TOL may be below the precision achievable from floating point\n        // subtraction, so switch to a fractional tolerance.\n        dd = delta[j] / discrd[j];\n      }\n\n      if (TOL < fabs(dd)) {\n        // No convergence yet on this axis.\n        convergence = 0;\n      }\n    }\n\n    if (convergence) break;\n\n    // Determine a suitable test point for computing the gradient.\n    for (int j = 0; j < naxis; j++) {\n      // Constrain the displacement.\n      delta[j] /= 2.0;\n      if (fabs(delta[j]) < 1.0e-6) {\n        if (delta[j] < 0.0) {\n          delta[j] = -1.0e-6;\n        } else {\n          delta[j] =  1.0e-6;\n        }\n      } else if (1.0 < fabs(delta[j])) {\n        if (delta[j] < 0.0) {\n          delta[j] = -1.0;\n        } else {\n          delta[j] =  1.0;\n        }\n      }\n    }\n\n    if (iter < itermax/2) {\n      // With the assumption of small distortions (as above), the gradient\n      // of discrd[j] should be dominated by the partial derivative with\n      // respect to rawcrd[j], and we can neglect partials with respect\n      // to rawcrd[i], where i != j.  Thus only one test point is needed,\n      // not one for each axis.\n      for (int j = 0; j < naxis; j++) {\n        rcrd1[j] = rawcrd[j] + delta[j];\n      }\n\n      // Compute discrd[] at the test point.\n      if ((status = disp2x(dis, rcrd1, dcrd1))) {\n        return wcserr_set(DIS_ERRMSG(status));\n      }\n\n      // Compute the next approximation.\n      for (int j = 0; j < naxis; j++) {\n        rawcrd[j] += (discrd[j] - dcrd0[j]) *\n                        (delta[j]/(dcrd1[j] - dcrd0[j]));\n      }\n\n    } else {\n      // Convergence should not take more than seven or so iterations.  As\n      // it is slow, try computing the gradient in full.\n      memcpy(rcrd1, rawcrd, naxis*sizeof(double));\n\n      for (int j = 0; j < naxis; j++) {\n        rcrd1[j] += delta[j];\n\n        // Compute discrd[] at the test point.\n        if ((status = disp2x(dis, rcrd1, dcrd1))) {\n          return wcserr_set(DIS_ERRMSG(status));\n        }\n\n        // Compute the next approximation.\n        rawcrd[j] += (discrd[j] - dcrd0[j]) *\n                       (delta[j]/(dcrd1[j] - dcrd0[j]));\n\n        rcrd1[j] -= delta[j];\n      }\n    }\n  }\n\n\n  if (!convergence) {\n    double residual = 0.0;\n    for (int j = 0; j < naxis; j++) {\n      double dd = discrd[j] - dcrd0[j] ;\n      residual += dd*dd;\n    }\n    residual = sqrt(residual);\n\n    return wcserr_set(WCSERR_SET(DISERR_DEDISTORT),\n      \"Convergence not achieved after %d iterations, residual %#7.2g\", iter,\n        residual);\n  }\n\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint diswarp(\n  struct disprm *dis,\n  const double pixblc[],\n  const double pixtrc[],\n  const double pixsamp[],\n  int    *nsamp,\n  double maxdis[],\n  double *maxtot,\n  double avgdis[],\n  double *avgtot,\n  double rmsdis[],\n  double *rmstot)\n\n{\n  static const char *function = \"diswarp\";\n\n  int status = 0;\n\n  // Initialize.\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  struct wcserr **err = &(dis->err);\n\n  int naxis = dis->naxis;\n\n  if (nsamp) *nsamp = 0;\n  for (int j = 0; j < naxis; j++) {\n    if (maxdis) maxdis[j] = 0.0;\n    if (avgdis) avgdis[j] = 0.0;\n    if (rmsdis) rmsdis[j] = 0.0;\n  }\n  if (maxtot) *maxtot = 0.0;\n  if (avgtot) *avgtot = 0.0;\n  if (rmstot) *rmstot = 0.0;\n\n  // Quick return if no distortions.\n  if (dis->ndis == 0) return 0;\n\n  // Carve up working memory, noting that disp2x() gets to it first.\n  double *pixinc = dis->tmpmem + naxis;\n  double *pixend = pixinc + naxis;\n  double *sumdis = pixend + naxis;\n  double *ssqdis = sumdis + naxis;\n\n  // Work out increments on each axis.\n  for (int j = 0; j < naxis; j++) {\n    double pixspan = pixtrc[j] - (pixblc ? pixblc[j] : 1.0);\n\n    if (pixsamp == 0x0) {\n      pixinc[j] = 1.0;\n    } else if (pixsamp[j] == 0.0) {\n      pixinc[j] = 1.0;\n    } else if (pixsamp[j] > 0.0) {\n      pixinc[j] = pixsamp[j];\n    } else if (pixsamp[j] > -1.5) {\n      pixinc[j] = 2.0*pixspan;\n    } else {\n      pixinc[j] = pixspan / ((int)(-pixsamp[j] - 0.5));\n    }\n  }\n\n  // Get some more memory for coordinate vectors.\n  double *pix0, *pix1;\n  if ((pix0 = calloc(2*naxis, sizeof(double))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  pix1 = pix0 + naxis;\n\n\n  // Set up the array of pixel coordinates.\n  for (int j = 0; j < naxis; j++) {\n    pix0[j] = pixblc ? pixblc[j] : 1.0;\n    pixend[j] = pixtrc[j] + 0.5*pixinc[j];\n  }\n\n  // Initialize accumulators.\n  for (int j = 0; j < naxis; j++) {\n    sumdis[j] = 0.0;\n    ssqdis[j] = 0.0;\n  }\n  double sumtot = 0.0;\n  double ssqtot = 0.0;\n\n\n  // Loop over N dimensions.\n  int carry = 0;\n  while (carry == 0) {\n    if ((status = disp2x(dis, pix0, pix1))) {\n      // (Preserve the error message set by disp2x().)\n      goto cleanup;\n    }\n\n    // Accumulate statistics.\n    (*nsamp)++;\n\n    double dssq = 0.0;\n    for (int j = 0; j < naxis; j++) {\n      double dpix = pix1[j] - pix0[j];\n      double dpx2 = dpix*dpix;\n\n      sumdis[j] += dpix;\n      ssqdis[j] += dpx2;\n\n      if (maxdis && (dpix = fabs(dpix)) > maxdis[j]) {\n        maxdis[j] = dpix;\n      }\n\n      dssq += dpx2;\n    }\n\n    double totdis = sqrt(dssq);\n    sumtot += totdis;\n    ssqtot += totdis*totdis;\n\n    if (maxtot && *maxtot < totdis) {\n      *maxtot = totdis;\n    }\n\n    // Next pixel.\n    for (int j = 0; j < naxis; j++) {\n      pix0[j] += pixinc[j];\n      if (pix0[j] < pixend[j]) {\n        carry = 0;\n        break;\n      }\n\n      pix0[j] = pixblc ? pixblc[j] : 1.0;\n      carry = 1;\n    }\n  }\n\n\n  // Compute the means and RMSs.\n  for (int j = 0; j < naxis; j++) {\n    ssqdis[j] /= *nsamp;\n    sumdis[j] /= *nsamp;\n    if (avgdis) avgdis[j] = sumdis[j];\n    if (rmsdis) rmsdis[j] = sqrt(ssqdis[j] - sumdis[j]*sumdis[j]);\n  }\n\n  ssqtot /= *nsamp;\n  sumtot /= *nsamp;\n  if (avgtot) *avgtot = sumtot;\n  if (rmstot) *rmstot = sqrt(ssqtot - sumtot*sumtot);\n\n\ncleanup:\n  free(pix0);\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint polyset(int j, struct disprm *dis)\n\n{\n  static const char *function = \"polyset\";\n\n  // Initialize.\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  struct wcserr **err = &(dis->err);\n\n  int naxis = dis->naxis;\n\n  char   id[32];\n  sprintf(id, \"Polynomial on axis %d\", j+1);\n\n\n  // Find the number of auxiliary variables and terms.\n  int K = 0;\n  int M = 0;\n  struct dpkey *keyp = dis->dp;\n  for (int idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    char *fp;\n    if ((fp = strchr(keyp->field, '.')) == 0x0) {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Invalid field name for %s: %s\", id, keyp->field);\n    }\n    fp++;\n\n    if (strcmp(fp, \"NAUX\") == 0) {\n      K = dpkeyi(keyp);\n    } else if (strcmp(fp, \"NTERMS\") == 0) {\n      M = dpkeyi(keyp);\n    }\n  }\n\n  if (K < 0) {\n    return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n      \"Invalid number of auxiliaries (%d) for %s\", K, id);\n  }\n\n  if (M <= 0) {\n    return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n      \"Invalid number of terms (%d) for %s\", M, id);\n  }\n\n  int Nhat = dis->Nhat[j];\n  int nKparm = 2*(Nhat + 1);\n  int nVar   = Nhat + K;\n  int nTparm = 1 + nVar;\n  int ndparm = K*nKparm + M*nTparm;\n\n// These iparm indices are specific to Polynomial.\n#define I_NIDX    3\t// No. of indexes in iparm[].\n#define I_LENDP   4\t// Full (allocated) length of dparm[].\n#define I_K       5\t// No. of auxiliary variables.\n#define I_M       6\t// No. of terms in the polynomial.\n#define I_NKPARM  7\t// No. of parameters used to define each auxiliary.\n#define I_NTPARM  8\t// No. of parameters used to define each term.\n#define I_NVAR    9\t// No. of independent + auxiliary variables.\n#define I_MNVAR  10\t// No. of powers (exponents) in the polynomial.\n#define I_DPOLY  11\t// dparm offset for polynomial coefficients.\n#define I_DAUX   12\t// dparm offset for auxiliary coefficients.\n#define I_DVPOW  13\t// dparm offset for integral powers of variables.\n#define I_MAXPOW 14\t// iparm offset for max powers.\n#define I_DPOFF  15\t// iparm offset for dparm offsets.\n#define I_FLAGS  16\t// iparm offset for flags.\n#define I_IPOW   17\t// iparm offset for integral powers.\n#define I_NPOLY  18\n\n  // Add extra for handling integer exponents.  See \"Optimization\" below.\n  int niparm = I_NPOLY + (2 + 2*M)*nVar;\n\n  // Add extra memory for temporaries.\n  int lendp = ndparm + K;\n\n  // Allocate memory for the indexes and parameter array.\n  if ((dis->iparm[j] = calloc(niparm, sizeof(int))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  if ((dis->dparm[j] = calloc(lendp, sizeof(double))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  // These help a bit to stop the code from turning into hieroglyphics.\n  int    *iparm = dis->iparm[j];\n  double *dparm = dis->dparm[j];\n\n\n  // Record the indexing parameters.  The first three are more widely used.\n  iparm[I_DTYPE]  = DIS_POLYNOMIAL;\n  iparm[I_NIPARM] = niparm;\n  iparm[I_NDPARM] = ndparm;\n\n  iparm[I_NIDX]   = I_NPOLY;\n  iparm[I_LENDP]  = lendp;\n  iparm[I_K]      = K;\n  iparm[I_M]      = M;\n  iparm[I_NKPARM] = nKparm;\n  iparm[I_NTPARM] = nTparm;\n  iparm[I_NVAR]   = nVar;\n  iparm[I_MNVAR]  = M*nVar;\n  iparm[I_DPOLY]  = K*nKparm;\n  iparm[I_DAUX]   = ndparm;\n  iparm[I_DVPOW]  = ndparm + K;\n  iparm[I_MAXPOW] = iparm[I_NIDX];\n  iparm[I_DPOFF]  = iparm[I_MAXPOW] + nVar;\n  iparm[I_FLAGS]  = iparm[I_DPOFF]  + nVar;\n  iparm[I_IPOW]   = iparm[I_FLAGS]  + M*nVar;\n\n  // Set default values of POWER for the auxiliary variables.\n  double *dptr = dparm + (1 + Nhat);\n  for (int k = 0; k < K; k++) {\n    for (int jhat = 0; jhat <= Nhat; jhat++) {\n      dptr[jhat] = 1.0;\n    }\n    dptr += nKparm;\n  }\n\n  // Set default values of COEFF for the independent variables.\n  dptr = dparm + iparm[I_DPOLY];\n  for (int m = 0; m < M; m++) {\n    *dptr = 1.0;\n    dptr += nTparm;\n  }\n\n  // Extract parameter values from DPja or DQia.\n  int i, k, m;\n  k = m = 0;\n  keyp = dis->dp;\n  for (int idp = 0; idp < dis->ndp; idp++, keyp++) {\n    // N.B. keyp->j is 1-relative, but j is 0-relative.\n    if (keyp->j-1 != j) continue;\n\n    char *fp = strchr(keyp->field, '.') + 1;\n\n    if (strncmp(fp, \"AUX.\", 4) == 0) {\n      // N.B. k here is 1-relative.\n      fp += 4;\n      sscanf(fp, \"%d\", &k);\n      if (k < 1 || K < k) {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Bad auxiliary variable (%d) for %s: %s\", k, id, keyp->field);\n      }\n\n      if ((fp = strchr(fp, '.')) == 0x0) {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Invalid field name for %s: %s\", id, keyp->field);\n      }\n      fp++;\n\n      int offset;\n      if (strncmp(fp, \"COEFF.\", 6) == 0) {\n        offset = 0;\n\n      } else if (strncmp(fp, \"POWER.\", 6) == 0) {\n        offset = 1 + Nhat;\n\n      } else {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Unrecognized field name for %s: %s\", id, keyp->field);\n      }\n\n      fp += 6;\n      int jhat;\n      sscanf(fp, \"%d\", &jhat);\n      if (jhat < 0 || naxis < jhat) {\n        // N.B. jhat == 0 is ok.\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Invalid axis number (%d) for %s: %s\", jhat, id, keyp->field);\n      }\n\n      i = (k-1)*nKparm + offset + jhat;\n      dparm[i] = dpkeyd(keyp);\n\n    } else if (strncmp(fp, \"TERM.\", 5) == 0) {\n      // N.B. m here is 1-relative.\n      fp += 5;\n      sscanf(fp, \"%d\", &m);\n      if (m < 1 || M < m) {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Bad term (%d) for %s: %s\", m, id, keyp->field);\n      }\n\n      if ((fp = strchr(fp, '.')) == 0x0) {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Invalid field name for %s: %s\", id, keyp->field);\n      }\n      fp++;\n\n      if (strcmp(fp, \"COEFF\") == 0) {\n        i = iparm[I_DPOLY] + (m-1)*nTparm;\n        dparm[i] = dpkeyd(keyp);\n\n      } else if (strncmp(fp, \"VAR.\", 4) == 0) {\n        // N.B. jhat here is 1-relative.\n        fp += 4;\n        int jhat;\n        sscanf(fp, \"%d\", &jhat);\n        if (jhat < 1 || naxis < jhat) {\n          return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Invalid axis number (%d) for %s: %s\", jhat, id, keyp->field);\n        }\n\n        i = iparm[I_DPOLY] + (m-1)*nTparm + 1 + (jhat-1);\n        double power = dpkeyd(keyp);\n        dparm[i] = power;\n\n      } else if (strncmp(fp, \"AUX.\", 4) == 0) {\n        // N.B. k here is 1-relative.\n        fp += 4;\n        sscanf(fp, \"%d\", &k);\n        if (k < 1 || K < k) {\n          return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n            \"Bad auxiliary variable (%d) for %s: %s\", k, id, keyp->field);\n        }\n\n        i = iparm[I_DPOLY] + (m-1)*nTparm + 1 + Nhat + (k-1);\n        double power = dpkeyd(keyp);\n        dparm[i] = power;\n\n      } else {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Unrecognized field name for %s: %s\", id, keyp->field);\n      }\n\n    } else if (strcmp(fp, \"DOCORR\") &&\n               strcmp(fp, \"NAXES\")  &&\n              strncmp(fp, \"AXIS.\",   5) &&\n              strncmp(fp, \"OFFSET.\", 7) &&\n              strncmp(fp, \"SCALE.\",  6) &&\n               strcmp(fp, \"NAUX\")   &&\n               strcmp(fp, \"NTERMS\")) {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Unrecognized field name for %s: %s\", id, keyp->field);\n    }\n  }\n\n\n  // Optimization: when the power is integral, it is faster to multiply\n  // ------------  repeatedly than call pow().  iparm[] is constructed as\n  //               follows:\n  //  I_NPOLY indexing parameters, as above,\n  //     nVar elements record the largest integral power for each variable,\n  //     nVar elements record offsets into dparm for each variable,\n  //   M*nVar flags to signal whether the power is integral,\n  //   M*nVar integral powers.\n  for (int ivar = 0; ivar < nVar; ivar++) {\n    // Want at least the first degree power for all variables.\n    i = iparm[I_MAXPOW] + ivar;\n    iparm[i] = 1;\n  }\n\n  for (int ivar = 0; ivar < nVar; ivar++) {\n    for (m = 0; m < M; m++) {\n      i = iparm[I_DPOLY] + m*nTparm + 1 + ivar;\n      double power = dparm[i];\n\n      // Is it integral?  (Positive, negative, or zero.)\n      int ipow = (int)power;\n      if (power == (double)ipow) {\n        // Signal that the power is integral.\n        i = iparm[I_FLAGS] + m*nVar + ivar;\n        if (ipow == 0) {\n          iparm[i] = 3;\n        } else {\n          iparm[i] = 1;\n        }\n\n        // The integral power itself.\n        i = iparm[I_IPOW] + m*nVar + ivar;\n        iparm[i] = ipow;\n      }\n\n      // Record the largest integral power for each variable.\n      i = iparm[I_MAXPOW] + ivar;\n      if (iparm[i] < abs(ipow)) {\n        iparm[i] = abs(ipow);\n      }\n    }\n  }\n\n  // How many of all powers of each variable will there be?\n  int npow = 0;\n  for (int ivar = 0; ivar < nVar; ivar++) {\n    // Offset into dparm.\n    i = iparm[I_DPOFF] + ivar;\n    iparm[i] = lendp + npow;\n\n    i = iparm[I_MAXPOW] + ivar;\n    npow += iparm[i];\n  }\n\n  // Expand dparm to store the extra powers.\n  if (npow) {\n    lendp += npow;\n    iparm[I_LENDP] = lendp;\n    if ((dis->dparm[j] = realloc(dparm, lendp*sizeof(double))) == 0x0) {\n      return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n    }\n  }\n\n  // No specialist de-distortions.\n  dis->disp2x[j] = dispoly;\n  dis->disx2p[j] = 0x0;\n\n  // Translate Polynomial to TPD if possible, it's much faster.\n  // However don't do it if the name was given as \"Polynomial*\".\n  if (strcmp(dis->dtype[j], \"Polynomial\") == 0) {\n    pol2tpd(j, dis);\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tpdset(int j, struct disprm *dis)\n\n{\n  static const char *function = \"tpdset\";\n\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  struct wcserr **err = &(dis->err);\n\n  char id[32];\n  sprintf(id, \"TPD on axis %d\", j+1);\n\n\n  // TPD distortion.\n  if (dis->Nhat[j] < 1 || 2 < dis->Nhat[j]) {\n    return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n      \"Axis map for %s must contain 1 or 2 entries, not %d\", id,\n      dis->Nhat[j]);\n  }\n\n  // Find the number of parameters.\n  int ncoeff[2] = {0, 0};\n  int doaux     = 0;\n  int doradial  = 0;\n  struct dpkey *keyp = dis->dp;\n  for (int idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    char *fp = strchr(keyp->field, '.') + 1;\n\n    if (strncmp(fp, \"TPD.\", 4) == 0) {\n      fp += 4;\n      int idis;\n      if (strncmp(fp, \"FWD.\", 4) == 0) {\n        idis = 0;\n\n      } else if (strncmp(fp, \"REV.\", 4) == 0) {\n        // TPD may provide a polynomial approximation for the inverse.\n        idis = 1;\n\n      } else {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Unrecognized field name for %s: %s\", id, keyp->field);\n      }\n\n      int k;\n      sscanf(fp+4, \"%d\", &k);\n      if (0 <= k && k <= 59) {\n        if (ncoeff[idis] < k+1) ncoeff[idis] = k+1;\n\n        // Any radial terms?\n        if (k == 3 || k == 11 || k == 23 || k == 39 || k == 59) {\n          doradial = 1;\n        }\n\n      } else {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Invalid parameter number (%d) for %s: %s\", k, id, keyp->field);\n      }\n\n    } else if (strncmp(fp, \"AUX.\", 4) == 0) {\n      // Flag usage of auxiliary variables.\n      doaux = 1;\n\n    } else if (strcmp(fp, \"DOCORR\") &&\n               strcmp(fp, \"NAXES\")  &&\n              strncmp(fp, \"AXIS.\",   5) &&\n              strncmp(fp, \"OFFSET.\", 7) &&\n              strncmp(fp, \"SCALE.\",  6)) {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Unrecognized field name for %s: %s\", id, keyp->field);\n    }\n  }\n\n  int (*(distpd[2]))(DISP2X_ARGS) = {0x0, 0x0};\n  for (int idis = 0; idis < 2; idis++) {\n    if (ncoeff[idis] <= 4) {\n      if (idis) {\n        // No inverse polynomial.\n        break;\n      }\n\n      // First degree.\n      ncoeff[idis] = 4;\n      distpd[idis] = tpd1;\n    } else if (ncoeff[idis] <= 7) {\n      // Second degree.\n      ncoeff[idis] = 7;\n      distpd[idis] = tpd2;\n    } else if (ncoeff[idis] <= 12) {\n      // Third degree.\n      ncoeff[idis] = 12;\n      distpd[idis] = tpd3;\n    } else if (ncoeff[idis] <= 17) {\n      // Fourth degree.\n      ncoeff[idis] = 17;\n      distpd[idis] = tpd4;\n    } else if (ncoeff[idis] <= 24) {\n      // Fifth degree.\n      ncoeff[idis] = 24;\n      distpd[idis] = tpd5;\n    } else if (ncoeff[idis] <= 31) {\n      // Sixth degree.\n      ncoeff[idis] = 31;\n      distpd[idis] = tpd6;\n    } else if (ncoeff[idis] <= 40) {\n      // Seventh degree.\n      ncoeff[idis] = 40;\n      distpd[idis] = tpd7;\n    } else if (ncoeff[idis] <= 49) {\n      // Eighth degree.\n      ncoeff[idis] = 49;\n      distpd[idis] = tpd8;\n    } else if (ncoeff[idis] <= 60) {\n      // Ninth degree.\n      ncoeff[idis] = 60;\n      distpd[idis] = tpd9;\n    } else {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Invalid number of parameters (%d) for %s\", ncoeff[idis], id);\n    }\n  }\n\n  // disx2p() only uses the inverse TPD, if present, to provide a better\n  // zeroth approximation.\n  dis->disp2x[j] = distpd[0];\n  dis->disx2p[j] = distpd[1];\n\n\n// These iparm indices are specific to TPD (matching definitions in wcshdr.c).\n#define I_TPDNCO  3\t// No. of TPD coefficients, forward...\n#define I_TPDINV  4\t// ...and inverse.\n#define I_TPDAUX  5\t// True if auxiliary variables are used.\n#define I_TPDRAD  6\t// True if the radial variable is used.\n#define I_NTPD    7\n\n  // Record indexing parameters.\n  int niparm = I_NTPD;\n  if ((dis->iparm[j] = calloc(niparm, sizeof(int))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  int ndparm = (doaux?6:0) + ncoeff[0] + ncoeff[1];\n\n  // The first three are more widely used.\n  dis->iparm[j][I_DTYPE]  = DIS_TPD;\n  dis->iparm[j][I_NIPARM] = niparm;\n  dis->iparm[j][I_NDPARM] = ndparm;\n\n  // Number of TPD coefficients.\n  dis->iparm[j][I_TPDNCO] = ncoeff[0];\n  dis->iparm[j][I_TPDINV] = ncoeff[1];\n\n  // Flag for presence of auxiliary variables.\n  dis->iparm[j][I_TPDAUX] = doaux;\n\n  // Flag for presence of radial terms.\n  dis->iparm[j][I_TPDRAD] = doradial;\n\n\n  // Allocate memory for the polynomial coefficients and fill it.\n  if ((dis->dparm[j] = calloc(ndparm, sizeof(double))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  // Set default auxiliary coefficients.\n  if (doaux) {\n    dis->dparm[j][1] = 1.0;\n    dis->dparm[j][5] = 1.0;\n  }\n\n  keyp = dis->dp;\n  for (int idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    char *fp = strchr(keyp->field, '.') + 1;\n\n    if (strncmp(fp, \"AUX.\", 4) == 0) {\n      // Auxiliary variables.\n      fp += 4;\n      int k;\n      sscanf(fp, \"%d\", &k);\n      if (k < 1 || 2 < k) {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Bad auxiliary variable (%d) for %s: %s\", k, id, keyp->field);\n      }\n\n      if ((fp = strchr(fp, '.')) == 0x0) {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Invalid field name for %s: %s\", id, keyp->field);\n      }\n      fp++;\n\n      if (strncmp(fp, \"COEFF.\", 6) != 0) {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Unrecognized field name for %s: %s\", id, keyp->field);\n      }\n\n      fp += 6;\n      int m;\n      sscanf(fp, \"%d\", &m);\n      if (m < 0 || 2 < m) {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Invalid coefficient number (%d) for %s: %s\", m, id, keyp->field);\n      }\n\n      int idis = 3*(k-1) + m;\n      dis->dparm[j][idis] = dpkeyd(keyp);\n\n    } else if (strncmp(fp, \"TPD.\", 4) == 0) {\n      fp += 4;\n      int idis = (doaux?6:0);\n      if (strncmp(fp, \"REV.\", 4) == 0) {\n        idis += ncoeff[0];\n      }\n\n      int k;\n      sscanf(fp+4, \"%d\", &k);\n      dis->dparm[j][idis+k] = dpkeyd(keyp);\n    }\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint pol2tpd(int j, struct disprm *dis)\n\n{\n  static const char *function = \"pol2tpd\";\n\n  static const int map[][10] = {{ 0,  2,  6, 10, 16, 22, 30, 38, 48, 58},\n                                { 1,  5,  9, 15, 21, 29, 37, 47, 57, -1},\n                                { 4,  8, 14, 20, 28, 36, 46, 56, -1, -1},\n                                { 7, 13, 19, 27, 35, 45, 55, -1, -1, -1},\n                                {12, 18, 26, 34, 44, 54, -1, -1, -1, -1},\n                                {17, 25, 33, 43, 53, -1, -1, -1, -1, -1},\n                                {24, 32, 42, 52, -1, -1, -1, -1, -1, -1},\n                                {31, 41, 51, -1, -1, -1, -1, -1, -1, -1},\n                                {40, 50, -1, -1, -1, -1, -1, -1, -1, -1},\n                                {49, -1, -1, -1, -1, -1, -1, -1, -1, -1}};\n\n  // Initialize.\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  struct wcserr **err = &(dis->err);\n\n  int    *iparm = dis->iparm[j];\n  double *dparm = dis->dparm[j];\n\n\n  // Check the number of independent variables, no more than two.\n  int Nhat = dis->Nhat[j];\n  if (2 < Nhat) return -1;\n\n  // Check auxiliaries: only one is allowed...\n  int K = iparm[I_K];\n  if (1 < K) return -1;\n  if (K) {\n    // ...and it must be radial.\n    if (dparm[0] != 0.0) return -1;\n    if (dparm[1] != 1.0) return -1;\n    if (dparm[2] != 1.0) return -1;\n    if (dparm[3] != 0.5) return -1;\n    if (dparm[4] != 2.0) return -1;\n    if (dparm[5] != 2.0) return -1;\n  }\n\n  // Check powers...\n  int *iflgp = iparm + iparm[I_FLAGS];\n  int *ipowp = iparm + iparm[I_IPOW];\n  int degree = 0;\n  for (int m = 0; m < iparm[I_M]; m++) {\n    int deg = 0;\n    for (int jhat = 0; jhat < Nhat; jhat++) {\n      // ...they must be positive integral.\n      if (*iflgp == 0)  return -1;\n      if (*ipowp < 0)   return -1;\n      deg += *ipowp;\n      iflgp++;\n      ipowp++;\n    }\n\n    // The polynomial degree can't be greater than 9.\n    if (9 < deg) return -1;\n\n    if (K) {\n      // Likewise for the radial variable.\n      if (*iflgp == 0)  return -1;\n      if (*ipowp) {\n        if (*ipowp < 0) return -1;\n        if (9 < *ipowp) return -1;\n\n        // Can't mix the radial and other terms.\n        if (deg)        return -1;\n\n        // Can't have even powers of the radial variable.\n        deg = *ipowp;\n        if (!(deg%2))   return -1;\n      }\n      iflgp++;\n      ipowp++;\n    }\n\n    if (degree < deg) degree = deg;\n  }\n\n\n  // OK, it ticks all the boxes.  Now translate it.\n  int ndparm = 0;\n  if (degree == 1) {\n    ndparm = 4;\n    dis->disp2x[j] = tpd1;\n  } else if (degree == 2) {\n    ndparm = 7;\n    dis->disp2x[j] = tpd2;\n  } else if (degree == 3) {\n    ndparm = 12;\n    dis->disp2x[j] = tpd3;\n  } else if (degree == 4) {\n    ndparm = 17;\n    dis->disp2x[j] = tpd4;\n  } else if (degree == 5) {\n    ndparm = 24;\n    dis->disp2x[j] = tpd5;\n  } else if (degree == 6) {\n    ndparm = 31;\n    dis->disp2x[j] = tpd6;\n  } else if (degree == 7) {\n    ndparm = 40;\n    dis->disp2x[j] = tpd7;\n  } else if (degree == 8) {\n    ndparm = 49;\n    dis->disp2x[j] = tpd8;\n  } else if (degree == 9) {\n    ndparm = 60;\n    dis->disp2x[j] = tpd9;\n  }\n\n  // No specialist de-distortions.\n  dis->disx2p[j] = 0x0;\n\n  // Record indexing parameters.\n  int niparm = I_NTPD;\n  int *tpd_iparm;\n  if ((tpd_iparm = calloc(niparm, sizeof(int))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  // The first three are more widely used.\n  tpd_iparm[I_DTYPE]  = DIS_TPD;\n  tpd_iparm[I_NIPARM] = niparm;\n  tpd_iparm[I_NDPARM] = ndparm;\n\n  // Number of TPD coefficients.\n  tpd_iparm[I_TPDNCO] = ndparm;\n  tpd_iparm[I_TPDINV] = 0;\n\n  // No auxiliary variables yet.\n  tpd_iparm[I_TPDAUX] = 0;\n\n  // Flag for presence of radial terms.\n  tpd_iparm[I_TPDRAD] = K;\n\n\n  // Allocate memory for the polynomial coefficients and fill it.\n  double *tpd_dparm;\n  if ((tpd_dparm = calloc(ndparm, sizeof(double))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  ipowp = iparm + iparm[I_IPOW];\n  double *dpolp = dparm + iparm[I_DPOLY];\n  for (int m = 0; m < iparm[I_M]; m++) {\n    if (K && ipowp[Nhat]) {\n      // The radial variable.\n      switch (ipowp[Nhat]) {\n      case 1:\n        tpd_dparm[3]  = *dpolp;\n        break;\n      case 3:\n        tpd_dparm[11] = *dpolp;\n        break;\n      case 5:\n        tpd_dparm[23] = *dpolp;\n        break;\n      case 7:\n        tpd_dparm[39] = *dpolp;\n        break;\n      case 9:\n        tpd_dparm[59] = *dpolp;\n        break;\n      }\n\n    } else {\n      // The independent variables.\n      int p[] = {0, 0};\n      for (int jhat = 0; jhat < Nhat; jhat++) {\n        p[jhat] = ipowp[jhat];\n      }\n\n      int n = map[p[0]][p[1]];\n      tpd_dparm[n] = *dpolp;\n    }\n\n\n    ipowp += iparm[I_NVAR];\n    dpolp += iparm[I_NVAR] + 1;\n  }\n\n\n  // Switch from Polynomial to TPD.\n  free(iparm);\n  free(dparm);\n  dis->iparm[j] = tpd_iparm;\n  dis->dparm[j] = tpd_dparm;\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tpvset(int j, struct disprm *dis)\n\n{\n  static const char *function = \"tpvset\";\n\n  // Initialize.\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  struct wcserr **err = &(dis->err);\n\n  // TPV \"projection\".\n  char id[32];\n  sprintf(id, \"TPV on axis %d\", j+1);\n\n  // TPV is a sequent distortion, applied to intermediate world coordinates\n  // (normally used with CDi_ja).  It computes corrected coordinates directly.\n  dis->docorr[j] = 0;\n\n  if (dis->Nhat[j] != 2) {\n    return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n      \"Axis map for %s must contain 2 entries, not %d\", id, dis->Nhat[j]);\n  }\n\n  // Find the number of parameters.\n  int ndparm   = 0;\n  int doradial = 0;\n  struct dpkey *keyp = dis->dp;\n  for (int idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    char *fp = strchr(keyp->field, '.') + 1;\n\n    if (strncmp(fp, \"TPV.\", 4) == 0) {\n      int k;\n      sscanf(fp+4, \"%d\", &k);\n      if (0 <= k && k <= 39) {\n        if (ndparm < k+1) ndparm = k+1;\n\n        // Any radial terms?\n        if (k == 3 || k == 11 || k == 23 || k == 39 || k == 59) {\n          doradial = 1;\n        }\n\n      } else {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Invalid parameter number (%d) for %s: %s\", k, id, keyp->field);\n      }\n\n    } else if (strcmp(fp, \"NAXES\")  &&\n              strncmp(fp, \"AXIS.\",   5) &&\n              strncmp(fp, \"OFFSET.\", 7) &&\n              strncmp(fp, \"SCALE.\",  6)) {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Unrecognized field name for %s: %s\", id, keyp->field);\n    }\n  }\n\n  // TPD is going to do the dirty work.\n  if (ndparm <= 4) {\n    // First degree.\n    ndparm = 4;\n    dis->disp2x[j] = tpd1;\n  } else if (ndparm <= 7) {\n    // Second degree.\n    ndparm = 7;\n    dis->disp2x[j] = tpd2;\n  } else if (ndparm <= 12) {\n    // Third degree.\n    ndparm = 12;\n    dis->disp2x[j] = tpd3;\n  } else if (ndparm <= 17) {\n    // Fourth degree.\n    ndparm = 17;\n    dis->disp2x[j] = tpd4;\n  } else if (ndparm <= 24) {\n    // Fifth degree.\n    ndparm = 24;\n    dis->disp2x[j] = tpd5;\n  } else if (ndparm <= 31) {\n    // Sixth degree.\n    ndparm = 31;\n    dis->disp2x[j] = tpd6;\n  } else if (ndparm <= 40) {\n    // Seventh degree.\n    ndparm = 40;\n    dis->disp2x[j] = tpd7;\n  } else {\n    // Could go to ninth degree, but that wouldn't be legit.\n    return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n      \"Invalid number of parameters (%d) for %s\", ndparm, id);\n  }\n\n  // No specialist de-distortions.\n  dis->disx2p[j] = 0x0;\n\n  // Record indexing parameters.\n  int niparm = I_NTPD;\n  if ((dis->iparm[j] = calloc(niparm, sizeof(int))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  // The first three are more widely used.\n  dis->iparm[j][I_DTYPE]  = DIS_TPD;\n  dis->iparm[j][I_NIPARM] = niparm;\n  dis->iparm[j][I_NDPARM] = ndparm;\n\n  // Number of TPD coefficients.\n  dis->iparm[j][I_TPDNCO] = ndparm;\n  dis->iparm[j][I_TPDINV] = 0;\n\n  // TPV never needs auxiliary variables.\n  dis->iparm[j][I_TPDAUX] = 0;\n\n  // Flag for presence of radial terms.\n  dis->iparm[j][I_TPDRAD] = doradial;\n\n\n  // Allocate memory for the polynomial coefficients and fill it.\n  if ((dis->dparm[j] = calloc(ndparm, sizeof(double))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  keyp = dis->dp;\n  for (int idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    char *fp = strchr(keyp->field, '.') + 1;\n\n    // One-to-one correspondence between TPV and TPD coefficients.\n    if (strncmp(fp, \"TPV.\", 4) == 0) {\n      int k;\n      sscanf(fp+4, \"%d\", &k);\n      dis->dparm[j][k] = dpkeyd(keyp);\n    }\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint sipset(int j, struct disprm *dis)\n\n{\n  static const char *function = \"sipset\";\n\n  static const int map[][10] = {{ 0,  2,  6, 10, 16, 22, 30, 38, 48, 58},\n                                { 1,  5,  9, 15, 21, 29, 37, 47, 57, -1},\n                                { 4,  8, 14, 20, 28, 36, 46, 56, -1, -1},\n                                { 7, 13, 19, 27, 35, 45, 55, -1, -1, -1},\n                                {12, 18, 26, 34, 44, 54, -1, -1, -1, -1},\n                                {17, 25, 33, 43, 53, -1, -1, -1, -1, -1},\n                                {24, 32, 42, 52, -1, -1, -1, -1, -1, -1},\n                                {31, 41, 51, -1, -1, -1, -1, -1, -1, -1},\n                                {40, 50, -1, -1, -1, -1, -1, -1, -1, -1},\n                                {49, -1, -1, -1, -1, -1, -1, -1, -1, -1}};\n\n  // Initialize.\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  struct wcserr **err = &(dis->err);\n\n  // Simple Imaging Polynomial.\n  char id[32];\n  sprintf(id, \"SIP on axis %d\", j+1);\n\n\n  // SIP is a prior distortion that computes an additive correction.\n  dis->docorr[j] = 1;\n\n  if (dis->Nhat[j] != 2) {\n    return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n      \"Axis map for %s must contain 2 entries, not %d\", id, dis->Nhat[j]);\n  }\n\n  // Find the polynomial degree, at least 1 for the forward function.\n  int degree[2] = {1, -1};\n  struct dpkey *keyp = dis->dp;\n  for (int idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    char *fp = strchr(keyp->field, '.') + 1;\n\n    if (strncmp(fp, \"SIP.\", 4) == 0) {\n      fp += 4;\n      int idis;\n      if (strncmp(fp, \"FWD.\", 4) == 0) {\n        idis = 0;\n\n      } else if (strncmp(fp, \"REV.\", 4) == 0) {\n        // SIP uses a polynomial approximation for the inverse.\n        idis = 1;\n\n      } else {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Unrecognized field name for %s: %s\", id, keyp->field);\n      }\n\n      fp += 4;\n      int p, q;\n      sscanf(fp, \"%d_%d\", &p, &q);\n      int deg = p + q;\n      if (p < 0 || 9 < p || q < 0 || 9 < q || 9 < deg) {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Invalid powers (%d, %d) for %s: %s\", p, q, id, keyp->field);\n      }\n\n      if (degree[idis] < deg) degree[idis] = deg;\n\n    } else if (strcmp(fp, \"NAXES\")  &&\n              strncmp(fp, \"AXIS.\",   5) &&\n              strncmp(fp, \"OFFSET.\", 7) &&\n              strncmp(fp, \"SCALE.\",  6)) {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Unrecognized field name for %s: %s\", id, keyp->field);\n    }\n  }\n\n  if (degree[1] == 0 ) degree[1] = 1;\n\n  // TPD is going to do the dirty work.\n  int (*(distpd[2]))(DISP2X_ARGS) = {0x0, 0x0}, ncoeff[2];\n  for (int idis = 0; idis < 2; idis++) {\n    ncoeff[idis] = 0;\n    if (degree[idis] == 1) {\n      ncoeff[idis] = 4;\n      distpd[idis] = tpd1;\n    } else if (degree[idis] == 2) {\n      ncoeff[idis] = 7;\n      distpd[idis] = tpd2;\n    } else if (degree[idis] == 3) {\n      ncoeff[idis] = 12;\n      distpd[idis] = tpd3;\n    } else if (degree[idis] == 4) {\n      ncoeff[idis] = 17;\n      distpd[idis] = tpd4;\n    } else if (degree[idis] == 5) {\n      ncoeff[idis] = 24;\n      distpd[idis] = tpd5;\n    } else if (degree[idis] == 6) {\n      ncoeff[idis] = 31;\n      distpd[idis] = tpd6;\n    } else if (degree[idis] == 7) {\n      ncoeff[idis] = 40;\n      distpd[idis] = tpd7;\n    } else if (degree[idis] == 8) {\n      ncoeff[idis] = 49;\n      distpd[idis] = tpd8;\n    } else if (degree[idis] == 9) {\n      ncoeff[idis] = 60;\n      distpd[idis] = tpd9;\n    }\n  }\n\n  // SIP uses a polynomial approximation to the inverse.  It's not very\n  // accurate but may provide disx2p() with a better zeroth approximation.\n  dis->disp2x[j] = distpd[0];\n  dis->disx2p[j] = distpd[1];\n\n\n  // Record indexing parameters.\n  int niparm = I_NTPD;\n  if ((dis->iparm[j] = calloc(niparm, sizeof(int))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  int ndparm = ncoeff[0] + ncoeff[1];\n\n  // The first three are more widely used.\n  dis->iparm[j][I_DTYPE]  = DIS_TPD;\n  dis->iparm[j][I_NIPARM] = niparm;\n  dis->iparm[j][I_NDPARM] = ndparm;\n\n  // Number of TPD coefficients.\n  dis->iparm[j][I_TPDNCO] = ncoeff[0];\n  dis->iparm[j][I_TPDINV] = ncoeff[1];\n\n  // SIP never needs auxiliary variables.\n  dis->iparm[j][I_TPDAUX] = 0;\n\n  // SIP never needs the radial terms.\n  dis->iparm[j][I_TPDRAD] = 0;\n\n\n  // Allocate memory for the polynomial coefficients and fill it.\n  if ((dis->dparm[j] = calloc(ndparm, sizeof(double))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  keyp = dis->dp;\n  for (int idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    char *fp = strchr(keyp->field, '.') + 1;\n\n    if (strncmp(fp, \"SIP.\", 4) == 0) {\n      fp += 4;\n      int idis;\n      if (strncmp(fp, \"FWD.\", 4) == 0) {\n        idis = 0;\n      } else {\n        idis = ncoeff[0];\n      }\n\n      int p, q;\n      sscanf(fp+4, \"%d_%d\", &p, &q);\n\n      // Map to TPD coefficient number.\n      idis += map[p][q];\n\n      dis->dparm[j][idis] = dpkeyd(keyp);\n    }\n  }\n\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint dssset(int j, struct disprm *dis)\n\n{\n  static const char *function = \"dssset\";\n\n  // Initialize.\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  struct wcserr **err = &(dis->err);\n\n  // Digitized Sky Survey.\n  char id[32];\n  sprintf(id, \"DSS on axis %d\", j+1);\n\n\n  // DSS is translated into a sequent distortion, applied to intermediate\n  // pixel coordinates.  It computes corrected coordinates directly.\n  dis->docorr[j] = 0;\n\n  if (dis->Nhat[j] != 2) {\n    return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n      \"Axis map for %s must contain 2 entries, not %d\", id, dis->Nhat[j]);\n  }\n\n  // Safe to assume the polynomial degree is 5 (or less).\n  int ncoeff = 24;\n  dis->disp2x[j] = tpd5;\n\n  // No specialist de-distortions.\n  dis->disx2p[j] = 0x0;\n\n\n  // Record indexing parameters.\n  int niparm = I_NTPD;\n  if ((dis->iparm[j] = calloc(niparm, sizeof(int))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  int ndparm = 6 + ncoeff;\n\n  // The first three are more widely used.\n  dis->iparm[j][I_DTYPE]  = DIS_TPD;\n  dis->iparm[j][I_NIPARM] = niparm;\n  dis->iparm[j][I_NDPARM] = ndparm;\n\n  // Number of TPD coefficients.\n  dis->iparm[j][I_TPDNCO] = ncoeff;\n  dis->iparm[j][I_TPDINV] = 0;\n\n  // DSS always needs auxiliary variables.\n  dis->iparm[j][I_TPDAUX] = 1;\n\n  // DSS never needs the radial terms.\n  dis->iparm[j][I_TPDRAD] = 0;\n\n\n  // Allocate memory for the polynomial coefficients and fill it.\n  if ((dis->dparm[j] = calloc(ndparm, sizeof(double))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  // This translation follows WCS Paper IV, Sect. 5.2 using the same\n  // variable names.  Find A1, A2, A3, B1, B2, and B3.\n  double A1, A2, A3, B1, B2, B3;\n  A1 = A2 = A3 = 0.0;\n  B1 = B2 = B3 = 0.0;\n  struct dpkey *keyp = dis->dp;\n  for (int idp = 0; idp < dis->ndp; idp++, keyp++) {\n    char *fp = strchr(keyp->field, '.') + 1;\n    if (strncmp(fp, \"DSS.AMD.\", 8) == 0) {\n      fp += 8;\n      int m;\n      sscanf(fp, \"%d\", &m);\n\n      if (m == 1) {\n        if (keyp->j == 1) {\n          A1 = dpkeyd(keyp);\n        } else {\n          B1 = dpkeyd(keyp);\n        }\n      } else if (m == 2) {\n        if (keyp->j == 1) {\n          A2 = dpkeyd(keyp);\n        } else {\n          B2 = dpkeyd(keyp);\n        }\n      } else if (m == 3) {\n        if (keyp->j == 1) {\n          A3 = dpkeyd(keyp);\n        } else {\n          B3 = dpkeyd(keyp);\n        }\n      }\n    }\n  }\n\n  double X0 = (A2*B3 - A3*B1) / (A1*B1 - A2*B2);\n  double Y0 = (A3*B2 - A1*B3) / (A1*B1 - A2*B2);\n\n  double S = sqrt(fabs(A1*B1 - A2*B2));\n  if (S == 0.0) {\n    return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n      \"Coefficient scale for %s is zero.\", id);\n  }\n\n  // Coefficients for the auxiliary variables.\n  double *dparm = dis->dparm[j];\n  if (j == 0) {\n    dparm[0] =  X0;\n    dparm[1] = -B1/S;\n    dparm[2] = -A2/S;\n    dparm[3] =  Y0;\n    dparm[4] =  B2/S;\n    dparm[5] =  A1/S;\n\n    // Change the sign of S for scaling the A coefficients.\n    S *= -1.0;\n\n  } else {\n    dparm[0] =  Y0;\n    dparm[1] =  B2/S;\n    dparm[2] =  A1/S;\n    dparm[3] =  X0;\n    dparm[4] = -B1/S;\n    dparm[5] = -A2/S;\n  }\n\n  // Translate DSS coefficients to TPD.\n  dparm += 6;\n  int degree = 3;\n  keyp = dis->dp;\n  for (int idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    char *fp = strchr(keyp->field, '.') + 1;\n\n    if (strncmp(fp, \"DSS.AMD.\", 8) == 0) {\n      // Skip zero coefficients.\n      double coeff = dpkeyd(keyp);\n      if (coeff == 0.0) continue;\n\n      fp += 8;\n      int m;\n      sscanf(fp, \"%d\", &m);\n\n      // Apply the coefficient scale factor.\n      coeff /= S;\n\n      if (m == 1) {\n        dparm[1]  = coeff;\n      } else if (m == 2) {\n        dparm[2]  = coeff;\n      } else if (m == 3) {\n        dparm[0]  = coeff;\n      } else if (m == 4) {\n        dparm[4] += coeff;\n      } else if (m == 5) {\n        dparm[5]  = coeff;\n      } else if (m == 6) {\n        dparm[6] += coeff;\n      } else if (m == 7) {\n        dparm[4] += coeff;\n        dparm[6] += coeff;\n      } else if (m == 8) {\n        dparm[7] += coeff;\n      } else if (m == 9) {\n        dparm[8]  = coeff;\n      } else if (m == 10) {\n        dparm[9] += coeff;\n      } else if (m == 11) {\n        dparm[10] = coeff;\n      } else if (m == 12) {\n        dparm[7] += coeff;\n        dparm[9] += coeff;\n      } else if (m == 13) {\n        dparm[17] = coeff;\n        dparm[19] = coeff * 2.0;\n        dparm[21] = coeff;\n        degree = 5;\n      } else if (coeff != 0.0) {\n        return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Invalid parameter for %s: %s\", m, id, keyp->field);\n      }\n\n    } else if (strcmp(fp, \"NAXES\")  &&\n              strncmp(fp, \"AXIS.\",   5) &&\n              strncmp(fp, \"OFFSET.\", 7) &&\n              strncmp(fp, \"SCALE.\",  6)) {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Unrecognized field name for %s: %s\", id, keyp->field);\n    }\n  }\n\n  // The DSS polynomial doesn't have 4th degree terms, and the 5th degree\n  // coefficient is often zero.\n  if (degree == 3) {\n    dis->iparm[j][I_TPDNCO] = 12;\n    dis->disp2x[j] = tpd3;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\n#define CHEBYSHEV 1\n#define LEGENDRE  2\n#define MONOMIAL  3\n\nint watset(int j, struct disprm *dis)\n\n{\n  static const char *function = \"watset\";\n\n  static const int map[][10] = {{ 0,  2,  6, 10, 16, 22, 30, 38, 48, 58},\n                                { 1,  5,  9, 15, 21, 29, 37, 47, 57, -1},\n                                { 4,  8, 14, 20, 28, 36, 46, 56, -1, -1},\n                                { 7, 13, 19, 27, 35, 45, 55, -1, -1, -1},\n                                {12, 18, 26, 34, 44, 54, -1, -1, -1, -1},\n                                {17, 25, 33, 43, 53, -1, -1, -1, -1, -1},\n                                {24, 32, 42, 52, -1, -1, -1, -1, -1, -1},\n                                {31, 41, 51, -1, -1, -1, -1, -1, -1, -1},\n                                {40, 50, -1, -1, -1, -1, -1, -1, -1, -1},\n                                {49, -1, -1, -1, -1, -1, -1, -1, -1, -1}};\n\n  // Initialize.\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  struct wcserr **err = &(dis->err);\n\n  // WAT (TNX or ZPX) Polynomial.\n  char id[32];\n  sprintf(id, \"WAT (%s) on axis %d\", dis->dtype[0]+4, j+1);\n\n\n  // WAT is a sequent distortion, applied to intermediate world coordinates\n  // (normally used with CDi_ja).  It computes an additive correction.\n  dis->docorr[j] = 1;\n\n  if (dis->Nhat[j] != 2) {\n    return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n      \"Axis map for %s must contain 2 entries, not %d\", id, dis->Nhat[j]);\n  }\n\n  // Find the polynomial degree (at least 1), kind, and domain.\n  int degree = 1;\n  int kind = 0;\n  double xmin = 0.0;\n  double xmax = 0.0;\n  double ymin = 0.0;\n  double ymax = 0.0;\n  struct dpkey *keyp = dis->dp;\n  for (int idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    char *fp = strchr(keyp->field, '.') + 1;\n\n    if (strncmp(fp, \"WAT.\", 4) == 0) {\n      fp += 4;\n      if (strncmp(fp, \"CHBY.\", 5) == 0 ||\n          strncmp(fp, \"LEGR.\", 5) == 0 ||\n          strncmp(fp, \"MONO.\", 5) == 0) {\n\n        fp += 5;\n        int m, n;\n        sscanf(fp, \"%d_%d\", &m, &n);\n        int deg = m + n;\n        if (m < 0 || 9 < m || n < 0 || 9 < n || 9 < deg) {\n          return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n          \"Invalid powers (%d, %d) for %s: %s\", m, n, id, keyp->field);\n        }\n\n        if (degree < deg) degree = deg;\n\n      } else if (strcmp(fp, \"POLY\") == 0) {\n        kind = dpkeyi(keyp);\n\n      } else if (strcmp(fp, \"XMIN\") == 0) {\n        xmin = dpkeyd(keyp);\n\n      } else if (strcmp(fp, \"XMAX\") == 0) {\n        xmax = dpkeyd(keyp);\n\n      } else if (strcmp(fp, \"YMIN\") == 0) {\n        ymin = dpkeyd(keyp);\n\n      } else if (strcmp(fp, \"YMAX\") == 0) {\n        ymax = dpkeyd(keyp);\n      }\n\n    } else if (strcmp(fp, \"NAXES\")  &&\n              strncmp(fp, \"AXIS.\",   5) &&\n              strncmp(fp, \"OFFSET.\", 7) &&\n              strncmp(fp, \"SCALE.\",  6)) {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Unrecognized field name for %s: %s\", id, keyp->field);\n    }\n  }\n\n  int doaux = (kind == 1 || kind == 2);\n\n  // TPD is going to do the dirty work.\n  int ncoeff = 0;\n  if (degree == 1) {\n    // First degree.\n    ncoeff = 4;\n    dis->disp2x[j] = tpd1;\n  } else if (degree == 2) {\n    // Second degree.\n    ncoeff = 7;\n    dis->disp2x[j] = tpd2;\n  } else if (degree == 3) {\n    // Third degree.\n    ncoeff = 12;\n    dis->disp2x[j] = tpd3;\n  } else if (degree == 4) {\n    // Fourth degree.\n    ncoeff = 17;\n    dis->disp2x[j] = tpd4;\n  } else if (degree == 5) {\n    // Fifth degree.\n    ncoeff = 24;\n    dis->disp2x[j] = tpd5;\n  } else if (degree == 6) {\n    // Sixth degree.\n    ncoeff = 31;\n    dis->disp2x[j] = tpd6;\n  } else if (degree == 7) {\n    // Seventh degree.\n    ncoeff = 40;\n    dis->disp2x[j] = tpd7;\n  } else if (degree == 8) {\n    // Eighth degree.\n    ncoeff = 49;\n    dis->disp2x[j] = tpd8;\n  } else if (degree == 9) {\n    // Ninth degree.\n    ncoeff = 60;\n    dis->disp2x[j] = tpd9;\n  }\n\n  // No specialist de-distortions.\n  dis->disx2p[j] = 0x0;\n\n\n  // Record indexing parameters.\n  int niparm = I_NTPD;\n  if ((dis->iparm[j] = calloc(niparm, sizeof(int))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  int *iparm = dis->iparm[j];\n\n  int ndparm = 6 + ncoeff;\n\n  // The first three are more widely used.\n  iparm[I_DTYPE]  = DIS_TPD;\n  iparm[I_NIPARM] = niparm;\n  iparm[I_NDPARM] = ndparm;\n\n  // Number of TPD coefficients.\n  iparm[I_TPDNCO] = ncoeff;\n  iparm[I_TPDINV] = 0;\n\n  // The Chebyshev and Legendre polynomials use auxiliary variables.\n  iparm[I_TPDAUX] = doaux;\n\n  // WAT never needs the radial terms.\n  iparm[I_TPDRAD] = 0;\n\n\n  // Allocate memory for the polynomial coefficients and fill it.\n  if ((dis->dparm[j] = calloc(ndparm, sizeof(double))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  double *dparm = dis->dparm[j];\n\n\n  // Coefficients for the auxiliary variables.\n  if (doaux) {\n    double x0 = (xmax + xmin)/2.0;\n    double dx = (xmax - xmin)/2.0;\n    if (dx == 0.0) {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"X-span for %s is zero\", id);\n    }\n\n    dparm[0] = -x0/dx;\n    dparm[1] = 1.0/dx;\n    dparm[2] = 0.0;\n\n    double y0 = (ymax + ymin)/2.0;\n    double dy = (ymax - ymin)/2.0;\n    if (dy == 0.0) {\n      return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM),\n        \"Y-span for %s is zero\", id);\n    }\n\n    dparm[3] = -y0/dy;\n    dparm[4] = 0.0;\n    dparm[5] = 1.0/dy;\n\n    dparm += 6;\n  }\n\n\n  // Unpack the polynomial coefficients.\n  keyp = dis->dp;\n  for (int idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    char *fp = strchr(keyp->field, '.') + 1;\n\n    if ((kind == CHEBYSHEV && strncmp(fp, \"WAT.CHBY.\", 9) == 0) ||\n        (kind == LEGENDRE  && strncmp(fp, \"WAT.LEGR.\", 9) == 0) ||\n        (kind == MONOMIAL  && strncmp(fp, \"WAT.MONO.\", 9) == 0)) {\n      fp += 9;\n\n      int m, n;\n      sscanf(fp, \"%d_%d\", &m, &n);\n\n      if (kind == MONOMIAL) {\n        // Monomial coefficient, maps simply to TPD coefficient number.\n        int idis = map[m][n];\n        dparm[idis] = dpkeyd(keyp);\n\n      } else {\n        // Coefficient of the product of two Chebyshev or two Legendre\n        // polynomials.  Find the corresponding monomial coefficients.\n        double coeff = dpkeyd(keyp);\n\n        double coeffm[10], coeffn[10];\n        cheleg(kind, m, n, coeffm, coeffn);\n        for (int im = 0; im <= m; im++) {\n          if (coeffm[im] == 0.0) continue;\n\n          for (int in = 0; in <= n; in++) {\n            if (coeffn[in] == 0.0) continue;\n\n            int idis = map[im][in];\n            dparm[idis] += coeff*coeffm[im]*coeffn[in];\n          }\n        }\n      }\n    }\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n// Compute the coefficients of Chebyshev or Legendre polynomials of degree\n// m and n.\n\nint cheleg(int kind, int m, int n, double coeffm[], double coeffn[])\n\n{\n  int N = (m > n) ? m : n;\n\n  // Allocate work arrays.\n  double *coeff[3];\n  coeff[0] = calloc(3*(N+1), sizeof(double));\n  coeff[1] = coeff[0] + (N+1);\n  coeff[2] = coeff[1] + (N+1);\n\n  for (int j = 0; j <= N; j++) {\n    int j0 =  j%3;\n\n    if (j == 0) {\n      coeff[0][0] = 1.0;\n\n    } else if (j == 1) {\n      coeff[1][1] = 1.0;\n\n    } else {\n      // Cyclic buffer indices.\n      int j1 = (j-1)%3;\n      int j2 = (j-2)%3;\n\n      memset(coeff[j0], 0, (N+1)*sizeof(double));\n\n      double d = (double)j;\n      for (int k = 0; k < N; k++) {\n        if (kind == CHEBYSHEV) {\n          coeff[j0][k+1] = 2.0 * coeff[j1][k];\n          coeff[j0][k]  -=       coeff[j2][k];\n        } else if (kind == LEGENDRE) {\n          coeff[j0][k+1] = ((2.0*d - 1.0) * coeff[j1][k]) / d;\n          coeff[j0][k]  -=     ((d - 1.0) * coeff[j2][k]) / d;\n        }\n      }\n    }\n\n    if (j == m) memcpy(coeffm, coeff[j0], (m+1)*sizeof(double));\n    if (j == n) memcpy(coeffn, coeff[j0], (n+1)*sizeof(double));\n  }\n\n  free(coeff[0]);\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint dispoly(\n  int dummy,\n  const int iparm[],\n  const double dparm[],\n  int Nhat,\n  const double rawcrd[],\n  double *discrd)\n\n{\n  // Avert nuisance compiler warnings about unused parameters.\n  (void)dummy;\n\n  // Check for zeroes.\n  for (int jhat = 0; jhat < Nhat; jhat++) {\n    if (rawcrd[jhat] == 0.0) {\n      *discrd = 0.0;\n      return 0;\n    }\n  }\n\n  // Working memory for auxiliaries &c. was allocated at the end of p[].\n  double *aux = (double *)(dparm + iparm[I_DAUX]);\n\n  // Compute the auxiliary variables.\n  for (int k = 0; k < iparm[I_K]; k++) {\n    const double *cptr = dparm + k*iparm[I_NKPARM];\n    const double *pptr = cptr + (1+Nhat);\n\n    aux[k] = *(cptr++);\n    double auxp0  = *(pptr++);\n\n    for (int jhat = 0; jhat < Nhat; jhat++) {\n      aux[k] += *(cptr++)*pow(rawcrd[jhat], *(pptr++));\n    }\n\n    aux[k] = pow(aux[k], auxp0);\n\n    // Check for zeroes.\n    if (aux[k] == 0.0) {\n      *discrd = 0.0;\n      return 0;\n    }\n  }\n\n\n  // Compute all required integral powers of the variables.\n  const int *imaxpow = iparm + iparm[I_MAXPOW];\n  double *dvarpow = (double *)(dparm + iparm[I_DVPOW]);\n\n  const int *imaxp = imaxpow;\n  double *dpowp = dvarpow;\n  for (int jhat = 0; jhat < Nhat; jhat++, imaxp++) {\n    double var = 1.0;\n    for (int ip = 0; ip < *imaxp; ip++, dpowp++) {\n      var *= rawcrd[jhat];\n      *dpowp = var;\n    }\n  }\n\n  for (int k = 0; k < iparm[I_K]; k++, imaxp++) {\n    double var = 1.0;\n    for (int ip = 0; ip < *imaxp; ip++, dpowp++) {\n      var *= aux[k];\n      *dpowp = var;\n    }\n  }\n\n  // Loop for each term of the polynomial.\n  *discrd = 0.0;\n  const int    *iflgp = iparm + iparm[I_FLAGS];\n  const int    *ipowp = iparm + iparm[I_IPOW];\n  const double *dpolp = dparm + iparm[I_DPOLY];\n  for (int m = 0; m < iparm[I_M]; m++) {\n    double term = *(dpolp++);\n\n    // Loop over all variables.\n    imaxp = imaxpow;\n    dpowp = dvarpow - 1;\n    for (int ivar = 0; ivar < iparm[I_NVAR]; ivar++) {\n      if (*iflgp & 2) {\n        // Nothing (zero power).\n\n      } else if (*iflgp) {\n        // Integral power.\n        if (*ipowp < 0) {\n          // Negative.\n          term /= dpowp[*ipowp];\n        } else {\n          // Positive.\n          term *= dpowp[*ipowp];\n        }\n\n      } else {\n        // Fractional power.\n        term *= pow(dpowp[0], *dpolp);\n      }\n\n      iflgp++;\n      ipowp++;\n      dpolp++;\n\n      dpowp += *imaxp;\n      imaxp++;\n    }\n\n    *discrd += term;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tpd1(\n  int inverse,\n  const int i[],\n  const double p[],\n  int Nhat,\n  const double rawcrd[],\n  double *discrd)\n\n{\n  if (i[I_TPDNCO+inverse] != 4 || 2 < Nhat) {\n    return 1;\n  }\n\n  double r, s;\n  double u = rawcrd[0];\n  double v = rawcrd[1];\n\n  // Auxiliary variables?\n  if (i[I_TPDAUX]) {\n    r = p[0] + p[1]*u + p[2]*v;\n    v = p[3] + p[4]*u + p[5]*v;\n    u = r;\n    p += 6;\n  }\n\n  if (inverse) p += i[I_TPDNCO];\n\n  // First degree.\n  *discrd = p[0] + u*p[1];\n\n  if (Nhat == 1) return 0;\n\n  *discrd += v*p[2];\n\n  // Radial terms?\n  if (i[I_TPDRAD]) {\n    s = u*u + v*v;\n    r = sqrt(s);\n\n    *discrd += r*p[3];\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tpd2(\n  int inverse,\n  const int i[],\n  const double p[],\n  int Nhat,\n  const double rawcrd[],\n  double *discrd)\n\n{\n  if (i[I_TPDNCO+inverse] != 7 || 2 < Nhat) {\n    return 1;\n  }\n\n  double r, s;\n  double u = rawcrd[0];\n  double v = rawcrd[1];\n\n  // Auxiliary variables?\n  if (i[I_TPDAUX]) {\n    r = p[0] + p[1]*u + p[2]*v;\n    v = p[3] + p[4]*u + p[5]*v;\n    u = r;\n    p += 6;\n  }\n\n  if (inverse) p += i[I_TPDNCO];\n\n  // Second degree.\n  *discrd = p[0] + u*(p[1] + u*(p[4]));\n\n  if (Nhat == 1) return 0;\n\n  *discrd +=\n      v*(p[2]  + v*(p[6]))\n    + u*(p[5])*v;\n\n  // Radial terms?\n  if (i[I_TPDRAD]) {\n    s = u*u + v*v;\n    r = sqrt(s);\n\n    *discrd += r*p[3];\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tpd3(\n  int inverse,\n  const int i[],\n  const double p[],\n  int Nhat,\n  const double rawcrd[],\n  double *discrd)\n\n{\n  if (i[I_TPDNCO+inverse] != 12 || 2 < Nhat) {\n    return 1;\n  }\n\n  double r, s;\n  double u = rawcrd[0];\n  double v = rawcrd[1];\n\n  // Auxiliary variables?\n  if (i[I_TPDAUX]) {\n    r = p[0] + p[1]*u + p[2]*v;\n    v = p[3] + p[4]*u + p[5]*v;\n    u = r;\n    p += 6;\n  }\n\n  if (inverse) p += i[I_TPDNCO];\n\n  // Third degree.\n  *discrd = p[0] + u*(p[1] + u*(p[4] + u*(p[7])));\n\n  if (Nhat == 1) return 0;\n\n  *discrd +=\n      v*(p[2]  + v*(p[6]  + v*(p[10])))\n    + u*(p[5]  + v*(p[9])\n    + u*(p[8]))*v;\n\n  // Radial terms?\n  if (i[I_TPDRAD]) {\n    s = u*u + v*v;\n    r = sqrt(s);\n\n    *discrd += r*(p[3] + s*(p[11]));\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tpd4(\n  int inverse,\n  const int i[],\n  const double p[],\n  int Nhat,\n  const double rawcrd[],\n  double *discrd)\n\n{\n  if (i[I_TPDNCO+inverse] != 17 || 2 < Nhat) {\n    return 1;\n  }\n\n  double r, s;\n  double u = rawcrd[0];\n  double v = rawcrd[1];\n\n  // Auxiliary variables?\n  if (i[I_TPDAUX]) {\n    r = p[0] + p[1]*u + p[2]*v;\n    v = p[3] + p[4]*u + p[5]*v;\n    u = r;\n    p += 6;\n  }\n\n  if (inverse) p += i[I_TPDNCO];\n\n  // Fourth degree.\n  *discrd = p[0] + u*(p[1] + u*(p[4] + u*(p[7] + u*(p[12]))));\n\n  if (Nhat == 1) return 0;\n\n  *discrd +=\n      v*(p[2]  + v*(p[6]  + v*(p[10] + v*(p[16]))))\n    + u*(p[5]  + v*(p[9]  + v*(p[15]))\n    + u*(p[8]  + v*(p[14])\n    + u*(p[13])))*v;\n\n  // Radial terms?\n  if (i[I_TPDRAD]) {\n    s = u*u + v*v;\n    r = sqrt(s);\n\n    *discrd += r*(p[3] + s*(p[11]));\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tpd5(\n  int inverse,\n  const int i[],\n  const double p[],\n  int Nhat,\n  const double rawcrd[],\n  double *discrd)\n\n{\n  if (i[I_TPDNCO+inverse] != 24 || 2 < Nhat) {\n    return 1;\n  }\n\n  double r, s;\n  double u = rawcrd[0];\n  double v = rawcrd[1];\n\n  // Auxiliary variables?\n  if (i[I_TPDAUX]) {\n    r = p[0] + p[1]*u + p[2]*v;\n    v = p[3] + p[4]*u + p[5]*v;\n    u = r;\n    p += 6;\n  }\n\n  if (inverse) p += i[I_TPDNCO];\n\n  // Fifth degree.\n  *discrd = p[0] + u*(p[1] + u*(p[4] + u*(p[7] + u*(p[12] + u*(p[17])))));\n\n  if (Nhat == 1) return 0;\n\n  *discrd +=\n      v*(p[2]  + v*(p[6]  + v*(p[10] + v*(p[16] + v*(p[22])))))\n    + u*(p[5]  + v*(p[9]  + v*(p[15] + v*(p[21])))\n    + u*(p[8]  + v*(p[14] + v*(p[20]))\n    + u*(p[13] + v*(p[19])\n    + u*(p[18]))))*v;\n\n  // Radial terms?\n  if (i[I_TPDRAD]) {\n    s = u*u + v*v;\n    r = sqrt(s);\n\n    *discrd += r*(p[3] + s*(p[11] + s*(p[23])));\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tpd6(\n  int inverse,\n  const int i[],\n  const double p[],\n  int Nhat,\n  const double rawcrd[],\n  double *discrd)\n\n{\n  if (i[I_TPDNCO+inverse] != 31 || 2 < Nhat) {\n    return 1;\n  }\n\n  double r, s;\n  double u = rawcrd[0];\n  double v = rawcrd[1];\n\n  // Auxiliary variables?\n  if (i[I_TPDAUX]) {\n    r = p[0] + p[1]*u + p[2]*v;\n    v = p[3] + p[4]*u + p[5]*v;\n    u = r;\n    p += 6;\n  }\n\n  if (inverse) p += i[I_TPDNCO];\n\n  // Sixth degree.\n  *discrd = p[0] + u*(p[1] + u*(p[4] + u*(p[7] + u*(p[12] + u*(p[17] + u*(p[24]))))));\n\n  if (Nhat == 1) return 0;\n\n  *discrd +=\n      v*(p[2]  + v*(p[6]  + v*(p[10] + v*(p[16] + v*(p[22] + v*(p[30]))))))\n    + u*(p[5]  + v*(p[9]  + v*(p[15] + v*(p[21] + v*(p[29]))))\n    + u*(p[8]  + v*(p[14] + v*(p[20] + v*(p[28])))\n    + u*(p[13] + v*(p[19] + v*(p[27]))\n    + u*(p[18] + v*(p[26])\n    + u*(p[25])))))*v;\n\n  // Radial terms?\n  if (i[I_TPDRAD]) {\n    s = u*u + v*v;\n    r = sqrt(s);\n\n    *discrd += r*(p[3] + s*(p[11] + s*(p[23])));\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tpd7(\n  int inverse,\n  const int i[],\n  const double p[],\n  int Nhat,\n  const double rawcrd[],\n  double *discrd)\n\n{\n  if (i[I_TPDNCO+inverse] != 40 || 2 < Nhat) {\n    return 1;\n  }\n\n  double r, s;\n  double u = rawcrd[0];\n  double v = rawcrd[1];\n\n  // Auxiliary variables?\n  if (i[I_TPDAUX]) {\n    r = p[0] + p[1]*u + p[2]*v;\n    v = p[3] + p[4]*u + p[5]*v;\n    u = r;\n    p += 6;\n  }\n\n  if (inverse) p += i[I_TPDNCO];\n\n  // Seventh degree.\n  *discrd = p[0] + u*(p[1] + u*(p[4] + u*(p[7] + u*(p[12] + u*(p[17] + u*(p[24] + u*(p[31])))))));\n\n  if (Nhat == 1) return 0;\n\n  *discrd +=\n      v*(p[2]  + v*(p[6]  + v*(p[10] + v*(p[16] + v*(p[22] + v*(p[30] + v*(p[38])))))))\n    + u*(p[5]  + v*(p[9]  + v*(p[15] + v*(p[21] + v*(p[29] + v*(p[37])))))\n    + u*(p[8]  + v*(p[14] + v*(p[20] + v*(p[28] + v*(p[36]))))\n    + u*(p[13] + v*(p[19] + v*(p[27] + v*(p[35])))\n    + u*(p[18] + v*(p[26] + v*(p[34]))\n    + u*(p[25] + v*(p[33])\n    + u*(p[32]))))))*v;\n\n  // Radial terms?\n  if (i[I_TPDRAD]) {\n    s = u*u + v*v;\n    r = sqrt(s);\n\n    *discrd += r*(p[3] + s*(p[11] + s*(p[23] + s*(p[39]))));\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tpd8(\n  int inverse,\n  const int i[],\n  const double p[],\n  int Nhat,\n  const double rawcrd[],\n  double *discrd)\n\n{\n  if (i[I_TPDNCO+inverse] != 49 || 2 < Nhat) {\n    return 1;\n  }\n\n  double r, s;\n  double u = rawcrd[0];\n  double v = rawcrd[1];\n\n  // Auxiliary variables?\n  if (i[I_TPDAUX]) {\n    r = p[0] + p[1]*u + p[2]*v;\n    v = p[3] + p[4]*u + p[5]*v;\n    u = r;\n    p += 6;\n  }\n\n  if (inverse) p += i[I_TPDNCO];\n\n  // Eighth degree.\n  *discrd = p[0] + u*(p[1] + u*(p[4] + u*(p[7] + u*(p[12] + u*(p[17] + u*(p[24] + u*(p[31] + u*(p[40]))))))));\n\n  if (Nhat == 1) return 0;\n\n  *discrd +=\n      v*(p[2]  + v*(p[6]  + v*(p[10] + v*(p[16] + v*(p[22] + v*(p[30] + v*(p[38] + v*(p[48]))))))))\n    + u*(p[5]  + v*(p[9]  + v*(p[15] + v*(p[21] + v*(p[29] + v*(p[37] + v*(p[47]))))))\n    + u*(p[8]  + v*(p[14] + v*(p[20] + v*(p[28] + v*(p[36] + v*(p[46])))))\n    + u*(p[13] + v*(p[19] + v*(p[27] + v*(p[35] + v*(p[45]))))\n    + u*(p[18] + v*(p[26] + v*(p[34] + v*(p[44])))\n    + u*(p[25] + v*(p[33] + v*(p[43]))\n    + u*(p[32] + v*(p[42])\n    + u*(p[41])))))))*v;\n\n  // Radial terms?\n  if (i[I_TPDRAD]) {\n    s = u*u + v*v;\n    r = sqrt(s);\n\n    *discrd += r*(p[3] + s*(p[11] + s*(p[23] + s*(p[39]))));\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint tpd9(\n  int inverse,\n  const int i[],\n  const double p[],\n  int Nhat,\n  const double rawcrd[],\n  double *discrd)\n\n{\n  if (i[I_TPDNCO+inverse] != 60 || 2 < Nhat) {\n    return 1;\n  }\n\n  double r, s;\n  double u = rawcrd[0];\n  double v = rawcrd[1];\n\n  // Auxiliary variables?\n  if (i[I_TPDAUX]) {\n    r = p[0] + p[1]*u + p[2]*v;\n    v = p[3] + p[4]*u + p[5]*v;\n    u = r;\n    p += 6;\n  }\n\n  if (inverse) p += i[I_TPDNCO];\n\n  // Ninth degree.\n  *discrd = p[0] + u*(p[1] + u*(p[4] + u*(p[7] + u*(p[12] + u*(p[17] + u*(p[24] + u*(p[31] + u*(p[40] + u*(p[49])))))))));\n\n  if (Nhat == 1) return 0;\n\n  *discrd +=\n      v*(p[2]  + v*(p[6]  + v*(p[10] + v*(p[16] + v*(p[22] + v*(p[30] + v*(p[38] + v*(p[48] + v*(p[58])))))))))\n    + u*(p[5]  + v*(p[9]  + v*(p[15] + v*(p[21] + v*(p[29] + v*(p[37] + v*(p[47] + v*(p[57])))))))\n    + u*(p[8]  + v*(p[14] + v*(p[20] + v*(p[28] + v*(p[36] + v*(p[46] + v*(p[56]))))))\n    + u*(p[13] + v*(p[19] + v*(p[27] + v*(p[35] + v*(p[45] + v*(p[55])))))\n    + u*(p[18] + v*(p[26] + v*(p[34] + v*(p[44] + v*(p[54]))))\n    + u*(p[25] + v*(p[33] + v*(p[43] + v*(p[53])))\n    + u*(p[32] + v*(p[42] + v*(p[52]))\n    + u*(p[41] + v*(p[51])\n    + u*(p[50]))))))))*v;\n\n  // Radial terms?\n  if (i[I_TPDRAD]) {\n    s = u*u + v*v;\n    r = sqrt(s);\n\n    *discrd += r*(p[3] + s*(p[11] + s*(p[23] + s*(p[39] + s*(p[59])))));\n  }\n\n  return 0;\n}\n"},{"id":16602,"name":"spx.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: spx.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <math.h>\n#include <stdio.h>\n#include <string.h>\n\n#include \"wcserr.h\"\n#include \"wcsmath.h\"\n#include \"spx.h\"\n\n\n// Map status return value to message.\nconst char *spx_errmsg[] = {\n  \"Success\",\n  \"Null spxprm pointer passed\",\n  \"Invalid spectral parameters\",\n  \"Invalid spectral variable\",\n  \"One or more of the inspec coordinates were invalid\"};\n\n// Convenience macro for invoking wcserr_set().\n#define SPX_ERRMSG(status) WCSERR_SET(status), spx_errmsg[status]\n\n#define C 2.99792458e8\n#define h 6.6260755e-34\n\n/*============================================================================\n*   Spectral cross conversions; given one spectral coordinate it computes all\n*   the others, plus the required derivatives of each with respect to the\n*   others.\n*===========================================================================*/\n\nint specx(\n  const char *type,\n  double spec,\n  double restfrq,\n  double restwav,\n  struct spxprm *spx)\n\n{\n  static const char *function = \"specx\";\n\n  register int k;\n  int haverest;\n  double beta, dwaveawav, gamma, n, s, t, u;\n  struct wcserr **err;\n\n  if (spx == 0x0) return SPXERR_NULL_POINTER;\n  err = &(spx->err);\n\n  haverest = 1;\n  if (restfrq == 0.0) {\n    if (restwav == 0.0) {\n      // No line rest frequency supplied.\n      haverest = 0;\n\n      // Temporarily set a dummy value for conversions.\n      spx->restwav = 1.0;\n    } else {\n      spx->restwav = restwav;\n    }\n    spx->restfrq = C/spx->restwav;\n\n  } else {\n    spx->restfrq = restfrq;\n    spx->restwav = C/restfrq;\n  }\n\n  spx->err = 0x0;\n\n  // Convert to frequency.\n  spx->wavetype = 0;\n  spx->velotype = 0;\n  if (strcmp(type, \"FREQ\") == 0) {\n    if (spec == 0.0) {\n      return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR),\n        \"Invalid spectral variable: frequency == 0\");\n    }\n    spx->freq = spec;\n    spx->wavetype = 1;\n\n  } else if (strcmp(type, \"AFRQ\") == 0) {\n    if (spec == 0.0) {\n      return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR),\n        \"Invalid spectral variable: frequency == 0\");\n    }\n    spx->freq = spec/(2.0*PI);\n    spx->wavetype = 1;\n\n  } else if (strcmp(type, \"ENER\") == 0) {\n    if (spec == 0.0) {\n      return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR),\n        \"Invalid spectral variable: frequency == 0\");\n    }\n    spx->freq = spec/h;\n    spx->wavetype = 1;\n\n  } else if (strcmp(type, \"WAVN\") == 0) {\n    if (spec == 0.0) {\n      return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR),\n        \"Invalid spectral variable: frequency == 0\");\n    }\n    spx->freq = spec*C;\n    spx->wavetype = 1;\n\n  } else if (strcmp(type, \"VRAD\") == 0) {\n    spx->freq = spx->restfrq*(1.0 - spec/C);\n    spx->velotype = 1;\n\n  } else if (strcmp(type, \"WAVE\") == 0) {\n    if (spec == 0.0) {\n      return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR),\n        \"Invalid spectral variable: frequency == 0\");\n    }\n    spx->freq = C/spec;\n    spx->wavetype = 1;\n\n  } else if (strcmp(type, \"VOPT\") == 0) {\n    s = 1.0 + spec/C;\n    if (s == 0.0) {\n      return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR),\n        \"Invalid spectral variable\");\n    }\n    spx->freq = spx->restfrq/s;\n    spx->velotype = 1;\n\n  } else if (strcmp(type, \"ZOPT\") == 0) {\n    s = 1.0 + spec;\n    if (s == 0.0) {\n      return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR),\n        \"Invalid spectral variable\");\n    }\n    spx->freq = spx->restfrq/s;\n    spx->velotype = 1;\n\n  } else if (strcmp(type, \"AWAV\") == 0) {\n    if (spec == 0.0) {\n      return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR),\n        \"Invalid spectral variable\");\n    }\n    s = 1.0/spec;\n    s *= s;\n    n  =   2.554e8 / (0.41e14 - s);\n    n += 294.981e8 / (1.46e14 - s);\n    n += 1.000064328;\n    spx->freq = C/(spec*n);\n    spx->wavetype = 1;\n\n  } else if (strcmp(type, \"VELO\") == 0) {\n    beta = spec/C;\n    if (fabs(beta) == 1.0) {\n      return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR),\n        \"Invalid spectral variable\");\n    }\n    spx->freq = spx->restfrq*(1.0 - beta)/sqrt(1.0 - beta*beta);\n    spx->velotype = 1;\n\n  } else if (strcmp(type, \"BETA\") == 0) {\n    if (fabs(spec) == 1.0) {\n      return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR),\n        \"Invalid spectral variable\");\n    }\n    spx->freq = spx->restfrq*(1.0 - spec)/sqrt(1.0 - spec*spec);\n    spx->velotype = 1;\n\n  } else {\n    // Unrecognized type.\n    return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_PARAMS),\n      \"Unrecognized spectral type '%s'\", type);\n  }\n\n\n  // Convert frequency to the other spectral types.\n  n = 1.0;\n  for (k = 0; k < 4; k++) {\n    s = n*spx->freq/C;\n    s *= s;\n    t = 0.41e14 - s;\n    u = 1.46e14 - s;\n    n = 1.000064328 + (2.554e8/t + 294.981e8/u);\n  }\n\n  dwaveawav = n - 2.0*s*(2.554e8/(t*t) + 294.981e8/(u*u));\n\n  s = spx->freq/spx->restfrq;\n\n  spx->ener = spx->freq*h;\n  spx->afrq = spx->freq*(2.0*PI);\n  spx->wavn = spx->freq/C;\n  spx->vrad = C*(1.0 - s);\n  spx->wave = C/spx->freq;\n  spx->awav = spx->wave/n;\n  spx->vopt = C*(1.0/s - 1.0);\n  spx->zopt = spx->vopt/C;\n  spx->velo = C*(1.0 - s*s)/(1.0 + s*s);\n  spx->beta = spx->velo/C;\n\n  // Compute the required derivatives.\n  gamma = 1.0/sqrt(1.0 - spx->beta*spx->beta);\n\n  spx->dfreqafrq = 1.0/(2.0*PI);\n  spx->dafrqfreq = 1.0/spx->dfreqafrq;\n\n  spx->dfreqener = 1.0/h;\n  spx->denerfreq = 1.0/spx->dfreqener;\n\n  spx->dfreqwavn = C;\n  spx->dwavnfreq = 1.0/spx->dfreqwavn;\n\n  spx->dfreqvrad = -spx->restfrq/C;\n  spx->dvradfreq = 1.0/spx->dfreqvrad;\n\n  spx->dfreqwave = -spx->freq/spx->wave;\n  spx->dwavefreq = 1.0/spx->dfreqwave;\n\n  spx->dfreqawav = spx->dfreqwave * dwaveawav;\n  spx->dawavfreq = 1.0/spx->dfreqawav;\n\n  spx->dfreqvelo = -gamma*spx->restfrq/(C + spx->velo);\n  spx->dvelofreq = 1.0/spx->dfreqvelo;\n\n  spx->dwavevopt = spx->restwav/C;\n  spx->dvoptwave = 1.0/spx->dwavevopt;\n\n  spx->dwavezopt = spx->restwav;\n  spx->dzoptwave = 1.0/spx->dwavezopt;\n\n  spx->dwaveawav = dwaveawav;\n  spx->dawavwave = 1.0/spx->dwaveawav;\n\n  spx->dwavevelo = gamma*spx->restwav/(C - spx->velo);\n  spx->dvelowave = 1.0/spx->dwavevelo;\n\n  spx->dawavvelo = spx->dwavevelo/dwaveawav;\n  spx->dveloawav = 1.0/spx->dawavvelo;\n\n  spx->dvelobeta = C;\n  spx->dbetavelo = 1.0/spx->dvelobeta;\n\n\n  // Reset values if no line rest frequency was supplied.\n  if (haverest) {\n    spx->wavetype = 1;\n    spx->velotype = 1;\n\n  } else {\n    spx->restfrq = 0.0;\n    spx->restwav = 0.0;\n\n    if (!spx->wavetype) {\n      // Don't have wave characteristic types.\n      spx->freq = 0.0;\n      spx->afrq = 0.0;\n      spx->ener = 0.0;\n      spx->wavn = 0.0;\n      spx->wave = 0.0;\n      spx->awav = 0.0;\n\n      spx->dfreqwave = 0.0;\n      spx->dwavefreq = 0.0;\n\n      spx->dfreqawav = 0.0;\n      spx->dawavfreq = 0.0;\n\n      spx->dwaveawav = 0.0;\n      spx->dawavwave = 0.0;\n\n    } else {\n      // Don't have velocity types.\n      spx->vrad = 0.0;\n      spx->vopt = 0.0;\n      spx->zopt = 0.0;\n      spx->velo = 0.0;\n      spx->beta = 0.0;\n    }\n\n    spx->dfreqvrad = 0.0;\n    spx->dvradfreq = 0.0;\n\n    spx->dfreqvelo = 0.0;\n    spx->dvelofreq = 0.0;\n\n    spx->dwavevopt = 0.0;\n    spx->dvoptwave = 0.0;\n\n    spx->dwavezopt = 0.0;\n    spx->dzoptwave = 0.0;\n\n    spx->dwavevelo = 0.0;\n    spx->dvelowave = 0.0;\n\n    spx->dawavvelo = 0.0;\n    spx->dveloawav = 0.0;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint spxperr(const struct spxprm *spx, const char *prefix)\n\n{\n  if (spx == 0x0) return SPXERR_NULL_POINTER;\n\n  if (spx->err) {\n    wcserr_prt(spx->err, prefix);\n  }\n\n  return 0;\n}\n\n\n/*============================================================================\n*   Conversions between frequency and vacuum wavelength.\n*===========================================================================*/\n\nint freqwave(\n  double dummy,\n  int nfreq,\n  int sfreq,\n  int swave,\n  const double freq[],\n  double wave[],\n  int stat[])\n\n{\n  int status = 0;\n  register int ifreq, *statp;\n  register const double *freqp;\n  register double *wavep;\n\n  // Avert nuisance compiler warnings about unused parameters.\n  (void)dummy;\n\n  freqp = freq;\n  wavep = wave;\n  statp = stat;\n  for (ifreq = 0; ifreq < nfreq; ifreq++) {\n    if (*freqp != 0.0) {\n      *wavep = C/(*freqp);\n      *(statp++) = 0;\n    } else {\n      *(statp++) = 1;\n      status = SPXERR_BAD_INSPEC_COORD;\n    }\n\n    freqp += sfreq;\n    wavep += swave;\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint wavefreq(\n  double dummy,\n  int nwave,\n  int swave,\n  int sfreq,\n  const double wave[],\n  double freq[],\n  int stat[])\n\n{\n  int status = 0;\n  register int iwave, *statp;\n  register const double *wavep;\n  register double *freqp;\n\n  // Avert nuisance compiler warnings about unused parameters.\n  (void)dummy;\n\n  wavep = wave;\n  freqp = freq;\n  statp = stat;\n  for (iwave = 0; iwave < nwave; iwave++) {\n    if (*wavep != 0.0) {\n      *freqp = C/(*wavep);\n      *(statp++) = 0;\n    } else {\n      *(statp++) = 1;\n      status = SPXERR_BAD_INSPEC_COORD;\n    }\n\n    wavep += swave;\n    freqp += sfreq;\n  }\n\n  return status;\n}\n\n/*============================================================================\n*   Conversions between frequency and air wavelength.\n*===========================================================================*/\n\nint freqawav(\n  double dummy,\n  int nfreq,\n  int sfreq,\n  int sawav,\n  const double freq[],\n  double awav[],\n  int stat[])\n\n{\n  int status;\n\n  if ((status = freqwave(dummy, nfreq, sfreq, sawav, freq, awav, stat))) {\n    return status;\n  }\n\n  return waveawav(dummy, nfreq, sawav, sawav, awav, awav, stat);\n}\n\n//----------------------------------------------------------------------------\n\nint awavfreq(\n  double dummy,\n  int nawav,\n  int sawav,\n  int sfreq,\n  const double awav[],\n  double freq[],\n  int stat[])\n\n{\n  int status;\n\n  if ((status = awavwave(dummy, nawav, sawav, sfreq, awav, freq, stat))) {\n    return status;\n  }\n\n  return wavefreq(dummy, nawav, sfreq, sfreq, freq, freq, stat);\n}\n\n/*============================================================================\n*   Conversions between frequency and relativistic velocity.\n*===========================================================================*/\n\nint freqvelo(\n  double restfrq,\n  int nfreq,\n  int sfreq,\n  int svelo,\n  const double freq[],\n  double velo[],\n  int stat[])\n\n{\n  double r, s;\n  register int ifreq, *statp;\n  register const double *freqp;\n  register double *velop;\n\n  r = restfrq*restfrq;\n\n  freqp = freq;\n  velop = velo;\n  statp = stat;\n  for (ifreq = 0; ifreq < nfreq; ifreq++) {\n    s = *freqp * *freqp;\n    *velop = C*(r - s)/(r + s);\n    *(statp++) = 0;\n\n    freqp += sfreq;\n    velop += svelo;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint velofreq(\n  double restfrq,\n  int nvelo,\n  int svelo,\n  int sfreq,\n  const double velo[],\n  double freq[],\n  int stat[])\n\n{\n  int status = 0;\n  double s;\n  register int ivelo, *statp;\n  register const double *velop;\n  register double *freqp;\n\n  velop = velo;\n  freqp = freq;\n  statp = stat;\n  for (ivelo = 0; ivelo < nvelo; ivelo++) {\n    s = C + *velop;\n    if (s != 0.0) {\n      *freqp = restfrq*sqrt((C - *velop)/s);\n      *(statp++) = 0;\n    } else {\n      *(statp++) = 1;\n      status = SPXERR_BAD_INSPEC_COORD;\n    }\n\n    velop += svelo;\n    freqp += sfreq;\n  }\n\n  return status;\n}\n\n/*============================================================================\n*   Conversions between vacuum wavelength and air wavelength.\n*===========================================================================*/\n\nint waveawav(\n  double dummy,\n  int nwave,\n  int swave,\n  int sawav,\n  const double wave[],\n  double awav[],\n  int stat[])\n\n{\n  int status = 0;\n  double n, s;\n  register int iwave, k, *statp;\n  register const double *wavep;\n  register double *awavp;\n\n  // Avert nuisance compiler warnings about unused parameters.\n  (void)dummy;\n\n  wavep = wave;\n  awavp = awav;\n  statp = stat;\n  for (iwave = 0; iwave < nwave; iwave++) {\n    if (*wavep != 0.0) {\n      n = 1.0;\n      for (k = 0; k < 4; k++) {\n        s  = n/(*wavep);\n        s *= s;\n        n  =   2.554e8 / (0.41e14 - s);\n        n += 294.981e8 / (1.46e14 - s);\n        n += 1.000064328;\n      }\n\n      *awavp = (*wavep)/n;\n      *(statp++) = 0;\n    } else {\n      *(statp++) = 1;\n      status = SPXERR_BAD_INSPEC_COORD;\n    }\n\n    wavep += swave;\n    awavp += sawav;\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint awavwave(\n  double dummy,\n  int nawav,\n  int sawav,\n  int swave,\n  const double awav[],\n  double wave[],\n  int stat[])\n\n{\n  int status = 0;\n  double n, s;\n  register int iawav, *statp;\n  register const double *awavp;\n  register double *wavep;\n\n  // Avert nuisance compiler warnings about unused parameters.\n  (void)dummy;\n\n  awavp = awav;\n  wavep = wave;\n  statp = stat;\n  for (iawav = 0; iawav < nawav; iawav++) {\n    if (*awavp != 0.0) {\n      s = 1.0/(*awavp);\n      s *= s;\n      n  =   2.554e8 / (0.41e14 - s);\n      n += 294.981e8 / (1.46e14 - s);\n      n += 1.000064328;\n      *wavep = (*awavp)*n;\n      *(statp++) = 0;\n    } else {\n      *(statp++) = 1;\n      status = SPXERR_BAD_INSPEC_COORD;\n    }\n\n    awavp += sawav;\n    wavep += swave;\n  }\n\n  return status;\n}\n\n/*============================================================================\n*   Conversions between vacuum wavelength and relativistic velocity.\n*===========================================================================*/\n\nint wavevelo(\n  double restwav,\n  int nwave,\n  int swave,\n  int svelo,\n  const double wave[],\n  double velo[],\n  int stat[])\n\n{\n  double r, s;\n  register int iwave, *statp;\n  register const double *wavep;\n  register double *velop;\n\n  r = restwav*restwav;\n\n  wavep = wave;\n  velop = velo;\n  statp = stat;\n  for (iwave = 0; iwave < nwave; iwave++) {\n    s = *wavep * *wavep;\n    *velop = C*(s - r)/(s + r);\n    *(statp++) = 0;\n\n    wavep += swave;\n    velop += svelo;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint velowave(\n  double restwav,\n  int nvelo,\n  int svelo,\n  int swave,\n  const double velo[],\n  double wave[],\n  int stat[])\n\n{\n  int status = 0;\n  double s;\n  register int ivelo, *statp;\n  register const double *velop;\n  register double *wavep;\n\n  velop = velo;\n  wavep = wave;\n  statp = stat;\n  for (ivelo = 0; ivelo < nvelo; ivelo++) {\n    s = C - *velop;\n    if (s != 0.0) {\n      *wavep = restwav*sqrt((C + *velop)/s);\n      *(statp++) = 0;\n    } else {\n      *(statp++) = 1;\n      status = SPXERR_BAD_INSPEC_COORD;\n    }\n\n    velop += svelo;\n    wavep += swave;\n  }\n\n  return status;\n}\n\n/*============================================================================\n*   Conversions between air wavelength and relativistic velocity.\n*===========================================================================*/\n\nint awavvelo(\n  double dummy,\n  int nawav,\n  int sawav,\n  int svelo,\n  const double awav[],\n  double velo[],\n  int stat[])\n\n{\n  int status;\n\n  if ((status = awavwave(dummy, nawav, sawav, svelo, awav, velo, stat))) {\n    return status;\n  }\n\n  return wavevelo(dummy, nawav, svelo, svelo, velo, velo, stat);\n}\n\n//----------------------------------------------------------------------------\n\nint veloawav(\n  double dummy,\n  int nvelo,\n  int svelo,\n  int sawav,\n  const double velo[],\n  double awav[],\n  int stat[])\n\n{\n  int status;\n\n  if ((status = velowave(dummy, nvelo, svelo, sawav, velo, awav, stat))) {\n    return status;\n  }\n\n  return waveawav(dummy, nvelo, sawav, sawav, awav, awav, stat);\n}\n\n/*============================================================================\n*   Conversions between frequency and angular frequency.\n*===========================================================================*/\n\nint freqafrq(\n  double dummy,\n  int nfreq,\n  int sfreq,\n  int safrq,\n  const double freq[],\n  double afrq[],\n  int stat[])\n\n{\n  register int ifreq, *statp;\n  register const double *freqp;\n  register double *afrqp;\n\n  // Avert nuisance compiler warnings about unused parameters.\n  (void)dummy;\n\n  freqp = freq;\n  afrqp = afrq;\n  statp = stat;\n  for (ifreq = 0; ifreq < nfreq; ifreq++) {\n    *afrqp = (*freqp)*(2.0*PI);\n    *(statp++) = 0;\n\n    freqp += sfreq;\n    afrqp += safrq;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint afrqfreq(\n  double dummy,\n  int nafrq,\n  int safrq,\n  int sfreq,\n  const double afrq[],\n  double freq[],\n  int stat[])\n\n{\n  register int iafrq, *statp;\n  register const double *afrqp;\n  register double *freqp;\n\n  // Avert nuisance compiler warnings about unused parameters.\n  (void)dummy;\n\n  afrqp = afrq;\n  freqp = freq;\n  statp = stat;\n  for (iafrq = 0; iafrq < nafrq; iafrq++) {\n    *freqp = (*afrqp)/(2.0*PI);\n    *(statp++) = 0;\n\n    afrqp += safrq;\n    freqp += sfreq;\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   Conversions between frequency and energy.\n*===========================================================================*/\n\nint freqener(\n  double dummy,\n  int nfreq,\n  int sfreq,\n  int sener,\n  const double freq[],\n  double ener[],\n  int stat[])\n\n{\n  register int ifreq, *statp;\n  register const double *freqp;\n  register double *enerp;\n\n  // Avert nuisance compiler warnings about unused parameters.\n  (void)dummy;\n\n  freqp = freq;\n  enerp = ener;\n  statp = stat;\n  for (ifreq = 0; ifreq < nfreq; ifreq++) {\n    *enerp = (*freqp)*h;\n    *(statp++) = 0;\n\n    freqp += sfreq;\n    enerp += sener;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint enerfreq(\n  double dummy,\n  int nener,\n  int sener,\n  int sfreq,\n  const double ener[],\n  double freq[],\n  int stat[])\n\n{\n  register int iener, *statp;\n  register const double *enerp;\n  register double *freqp;\n\n  // Avert nuisance compiler warnings about unused parameters.\n  (void)dummy;\n\n  enerp = ener;\n  freqp = freq;\n  statp = stat;\n  for (iener = 0; iener < nener; iener++) {\n    *freqp = (*enerp)/h;\n    *(statp++) = 0;\n\n    enerp += sener;\n    freqp += sfreq;\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   Conversions between frequency and wave number.\n*===========================================================================*/\n\nint freqwavn(\n  double dummy,\n  int nfreq,\n  int sfreq,\n  int swavn,\n  const double freq[],\n  double wavn[],\n  int stat[])\n\n{\n  register int ifreq, *statp;\n  register const double *freqp;\n  register double *wavnp;\n\n  // Avert nuisance compiler warnings about unused parameters.\n  (void)dummy;\n\n  freqp = freq;\n  wavnp = wavn;\n  statp = stat;\n  for (ifreq = 0; ifreq < nfreq; ifreq++) {\n    *wavnp = (*freqp)/C;\n    *(statp++) = 0;\n\n    freqp += sfreq;\n    wavnp += swavn;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint wavnfreq(\n  double dummy,\n  int nwavn,\n  int swavn,\n  int sfreq,\n  const double wavn[],\n  double freq[],\n  int stat[])\n\n{\n  register int iwavn, *statp;\n  register const double *wavnp;\n  register double *freqp;\n\n  // Avert nuisance compiler warnings about unused parameters.\n  (void)dummy;\n\n  wavnp = wavn;\n  freqp = freq;\n  statp = stat;\n  for (iwavn = 0; iwavn < nwavn; iwavn++) {\n    *freqp = (*wavnp)*C;\n    *(statp++) = 0;\n\n    wavnp += swavn;\n    freqp += sfreq;\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   Conversions between frequency and radio velocity.\n*===========================================================================*/\n\nint freqvrad(\n  double restfrq,\n  int nfreq,\n  int sfreq,\n  int svrad,\n  const double freq[],\n  double vrad[],\n  int stat[])\n\n{\n  double r;\n  register int ifreq, *statp;\n  register const double *freqp;\n  register double *vradp;\n\n  if (restfrq == 0.0) {\n    return SPXERR_BAD_SPEC_PARAMS;\n  }\n  r = C/restfrq;\n\n  freqp = freq;\n  vradp = vrad;\n  statp = stat;\n  for (ifreq = 0; ifreq < nfreq; ifreq++) {\n    *vradp = r*(restfrq - *freqp);\n    *(statp++) = 0;\n\n    freqp += sfreq;\n    vradp += svrad;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint vradfreq(\n  double restfrq,\n  int nvrad,\n  int svrad,\n  int sfreq,\n  const double vrad[],\n  double freq[],\n  int stat[])\n\n{\n  double r;\n  register int ivrad, *statp;\n  register const double *vradp;\n  register double *freqp;\n\n  r = restfrq/C;\n\n  vradp = vrad;\n  freqp = freq;\n  statp = stat;\n  for (ivrad = 0; ivrad < nvrad; ivrad++) {\n    *freqp = r*(C - *vradp);\n    *(statp++) = 0;\n    vradp += svrad;\n    freqp += sfreq;\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   Conversions between vacuum wavelength and optical velocity.\n*===========================================================================*/\n\nint wavevopt(\n  double restwav,\n  int nwave,\n  int swave,\n  int svopt,\n  const double wave[],\n  double vopt[],\n  int stat[])\n\n{\n  double r;\n  register int iwave, *statp;\n  register const double *wavep;\n  register double *voptp;\n\n  if (restwav == 0.0) {\n    return SPXERR_BAD_SPEC_PARAMS;\n  }\n  r = C/restwav;\n\n  wavep = wave;\n  voptp = vopt;\n  statp = stat;\n  for (iwave = 0; iwave < nwave; iwave++) {\n    *voptp = r*(*wavep) - C;\n    *(statp++) = 0;\n    wavep += swave;\n    voptp += svopt;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint voptwave(\n  double restwav,\n  int nvopt,\n  int svopt,\n  int swave,\n  const double vopt[],\n  double wave[],\n  int stat[])\n\n{\n  double r;\n  register int ivopt, *statp;\n  register const double *voptp;\n  register double *wavep;\n\n  r = restwav/C;\n\n  voptp = vopt;\n  wavep = wave;\n  statp = stat;\n  for (ivopt = 0; ivopt < nvopt; ivopt++) {\n    *wavep = r*(C + *voptp);\n    *(statp++) = 0;\n    voptp += svopt;\n    wavep += swave;\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   Conversions between vacuum wavelength and redshift.\n*===========================================================================*/\n\nint wavezopt(\n  double restwav,\n  int nwave,\n  int swave,\n  int szopt,\n  const double wave[],\n  double zopt[],\n  int stat[])\n\n{\n  double r;\n  register int iwave, *statp;\n  register const double *wavep;\n  register double *zoptp;\n\n  if (restwav == 0.0) {\n    return SPXERR_BAD_SPEC_PARAMS;\n  }\n  r = 1.0/restwav;\n\n  wavep = wave;\n  zoptp = zopt;\n  statp = stat;\n  for (iwave = 0; iwave < nwave; iwave++) {\n    *zoptp = r*(*wavep) - 1.0;\n    *(statp++) = 0;\n    wavep += swave;\n    zoptp += szopt;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint zoptwave(\n  double restwav,\n  int nzopt,\n  int szopt,\n  int swave,\n  const double zopt[],\n  double wave[],\n  int stat[])\n\n{\n  register int izopt, *statp;\n  register const double *zoptp;\n  register double *wavep;\n\n  zoptp = zopt;\n  wavep = wave;\n  statp = stat;\n  for (izopt = 0; izopt < nzopt; izopt++) {\n    *wavep = restwav*(1.0 + *zoptp);\n    *(statp++) = 0;\n    zoptp += szopt;\n    wavep += swave;\n  }\n\n  return 0;\n}\n\n/*============================================================================\n*   Conversions between relativistic velocity and beta (= v/c).\n*===========================================================================*/\n\nint velobeta(\n  double dummy,\n  int nvelo,\n  int svelo,\n  int sbeta,\n  const double velo[],\n  double beta[],\n  int stat[])\n\n{\n  register int ivelo, *statp;\n  register const double *velop;\n  register double *betap;\n\n  // Avert nuisance compiler warnings about unused parameters.\n  (void)dummy;\n\n  velop = velo;\n  betap = beta;\n  statp = stat;\n  for (ivelo = 0; ivelo < nvelo; ivelo++) {\n    *betap = (*velop)/C;\n    *(statp++) = 0;\n\n    velop += svelo;\n    betap += sbeta;\n  }\n\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint betavelo(\n  double dummy,\n  int nbeta,\n  int sbeta,\n  int svelo,\n  const double beta[],\n  double velo[],\n  int stat[])\n\n{\n  register int ibeta, *statp;\n  register const double *betap;\n  register double *velop;\n\n  // Avert nuisance compiler warnings about unused parameters.\n  (void)dummy;\n\n  betap = beta;\n  velop = velo;\n  statp = stat;\n  for (ibeta = 0; ibeta < nbeta; ibeta++) {\n    *velop = (*betap)*C;\n    *(statp++) = 0;\n\n    betap += sbeta;\n    velop += svelo;\n  }\n\n  return 0;\n}\n"},{"id":16603,"name":"wcserr.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  Module author: Michael Droettboom\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcserr.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n* Summary of the wcserr routines\n* ------------------------------\n* Most of the structs in WCSLIB contain a pointer to a wcserr struct as a\n* member.  Functions in WCSLIB that return an error status code can also\n* allocate and set a detailed error message in this struct, which also\n* identifies the function, source file, and line number where the error\n* occurred.\n*\n* For example:\n*\n=     struct prjprm prj;\n=     wcserr_enable(1);\n=     if (prjini(&prj)) {\n=       // Print the error message to stderr.\n=       wcsprintf_set(stderr);\n=       wcserr_prt(prj.err, 0x0);\n=     }\n*\n* A number of utility functions used in managing the wcserr struct are for\n* internal use only.  They are documented here solely as an aid to\n* understanding the code.  They are not intended for external use - the API\n* may change without notice!\n*\n*\n* wcserr struct - Error message handling\n* --------------------------------------\n* The wcserr struct contains the numeric error code, a textual description of\n* the error, and information about the function, source file, and line number\n* where the error was generated.\n*\n*   int status\n*     Numeric status code associated with the error, the meaning of which\n*     depends on the function that generated it.  See the documentation for\n*     the particular function.\n*\n*   int line_no\n*     Line number where the error occurred as given by the __LINE__\n*     preprocessor macro.\n*\n*   const char *function\n*     Name of the function where the error occurred.\n*\n*   const char *file\n*     Name of the source file where the error occurred as given by the\n*     __FILE__ preprocessor macro.\n*\n*   char *msg\n*     Informative error message.\n*\n*\n* wcserr_enable() - Enable/disable error messaging\n* ------------------------------------------------\n* wcserr_enable() enables or disables wcserr error messaging.  By default it\n* is disabled.\n*\n* PLEASE NOTE: This function is not thread-safe.\n*\n* Given:\n*   enable    int       If true (non-zero), enable error messaging, else\n*                       disable it.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Error messaging is disabled.\n*                         1: Error messaging is enabled.\n*\n*\n* wcserr_size() - Compute the size of a wcserr struct\n* ---------------------------------------------------\n* wcserr_size() computes the full size of a wcserr struct, including allocated\n* memory.\n*\n* Given:\n*   err       const struct wcserr*\n*                       The error object.\n*\n*                       If NULL, the base size of the struct and the allocated\n*                       size are both set to zero.\n*\n* Returned:\n*   sizes     int[2]    The first element is the base size of the struct as\n*                       returned by sizeof(struct wcserr).  The second element\n*                       is the total allocated size of the message buffer, in\n*                       bytes.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*\n*\n* wcserr_prt() - Print a wcserr struct\n* ------------------------------------\n* wcserr_prt() prints the error message (if any) contained in a wcserr struct.\n* It uses the wcsprintf() functions.\n*\n* Given:\n*   err       const struct wcserr*\n*                       The error object.  If NULL, nothing is printed.\n*\n*   prefix    const char *\n*                       If non-NULL, each output line will be prefixed with\n*                       this string.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         2: Error messaging is not enabled.\n*\n*\n* wcserr_clear() - Clear a wcserr struct\n* --------------------------------------\n* wcserr_clear() clears (deletes) a wcserr struct.\n*\n* Given and returned:\n*   err       struct wcserr**\n*                       The error object.  If NULL, nothing is done.  Set to\n*                       NULL on return.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*\n*\n* wcserr_set() - Fill in the contents of an error object\n* ------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcserr_set() fills a wcserr struct with information about an error.\n*\n* A convenience macro, WCSERR_SET, provides the source file and line number\n* information automatically.\n*\n* Given and returned:\n*   err       struct wcserr**\n*                       Error object.\n*\n*                       If err is NULL, returns the status code given without\n*                       setting an error message.\n*\n*                       If *err is NULL, allocates memory for a wcserr struct\n*                       (provided that status is non-zero).\n*\n* Given:\n*   status    int       Numeric status code to set.  If 0, then *err will be\n*                       deleted and *err will be returned as NULL.\n*\n*   function  const char *\n*                       Name of the function generating the error.  This\n*                       must point to a constant string, i.e. in the\n*                       initialized read-only data section (\"data\") of the\n*                       executable.\n*\n*   file      const char *\n*                       Name of the source file generating the error.  This\n*                       must point to a constant string, i.e. in the\n*                       initialized read-only data section (\"data\") of the\n*                       executable such as given by the __FILE__ preprocessor\n*                       macro.\n*\n*   line_no   int       Line number in the source file generating the error\n*                       such as given by the __LINE__ preprocessor macro.\n*\n*   format    const char *\n*                       Format string of the error message.  May contain\n*                       printf-style %-formatting codes.\n*\n*   ...       mixed     The remaining variable arguments are applied (like\n*                       printf) to the format string to generate the error\n*                       message.\n*\n* Function return value:\n*             int       The status return code passed in.\n*\n*\n* wcserr_copy() - Copy an error object\n* ------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcserr_copy() copies one error object to another.  Use of this function\n* should be avoided in general since the function, source file, and line\n* number information copied to the destination may lose its context.\n*\n* Given:\n*   src       const struct wcserr*\n*                       Source error object.  If src is NULL, dst is cleared.\n*\n* Returned:\n*   dst       struct wcserr*\n*                       Destination error object.  If NULL, no copy is made.\n*\n* Function return value:\n*             int       Numeric status code of the source error object.\n*\n*\n* WCSERR_SET() macro - Fill in the contents of an error object\n* ------------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* WCSERR_SET() is a preprocessor macro that helps to fill in the argument list\n* of wcserr_set().  It takes status as an argument of its own and provides the\n* name of the source file and the line number at the point where invoked.  It\n* assumes that the err and function arguments of wcserr_set() will be provided\n* by variables of the same names.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_WCSERR\n#define WCSLIB_WCSERR\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nstruct wcserr {\n  int  status;\t\t\t// Status code for the error.\n  int  line_no;\t\t\t// Line number where the error occurred.\n  const char *function;\t\t// Function name.\n  const char *file;\t\t// Source file name.\n  char *msg;\t\t\t// Informative error message.\n};\n\n// Size of the wcserr struct in int units, used by the Fortran wrappers.\n#define ERRLEN (sizeof(struct wcserr)/sizeof(int))\n\nint wcserr_enable(int enable);\n\nint wcserr_size(const struct wcserr *err, int sizes[2]);\n\nint wcserr_prt(const struct wcserr *err, const char *prefix);\n\nint wcserr_clear(struct wcserr **err);\n\n\n// INTERNAL USE ONLY -------------------------------------------------------\n\nint wcserr_set(struct wcserr **err, int status, const char *function,\n  const char *file, int line_no, const char *format, ...);\n\nint wcserr_copy(const struct wcserr *src, struct wcserr *dst);\n\n// Convenience macro for invoking wcserr_set().\n#define WCSERR_SET(status) err, status, function, __FILE__, __LINE__\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WSCLIB_WCSERR\n"},{"id":16604,"name":"fitshdr.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: fitshdr.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the fitshdr routines\n* -------------------------------\n* The Flexible Image Transport System (FITS), is a data format widely used in\n* astronomy for data interchange and archive.  It is described in\n*\n=   \"Definition of the Flexible Image Transport System (FITS), version 3.0\",\n=   Pence, W.D., Chiappetti, L., Page, C.G., Shaw, R.A., & Stobie, E. 2010,\n=   A&A, 524, A42 - http://dx.doi.org/10.1051/0004-6361/201015362\n*\n* See also http://fits.gsfc.nasa.gov\n*\n* fitshdr() is a generic FITS header parser provided to handle keyrecords that\n* are ignored by the WCS header parsers, wcspih() and wcsbth().  Typically the\n* latter may be set to remove WCS keyrecords from a header leaving fitshdr()\n* to handle the remainder.\n*\n*\n* fitshdr() - FITS header parser routine\n* --------------------------------------\n* fitshdr() parses a character array containing a FITS header, extracting\n* all keywords and their values into an array of fitskey structs.\n*\n* Given:\n*   header    const char []\n*                       Character array containing the (entire) FITS header,\n*                       for example, as might be obtained conveniently via the\n*                       CFITSIO routine fits_hdr2str().\n*\n*                       Each header \"keyrecord\" (formerly \"card image\")\n*                       consists of exactly 80 7-bit ASCII printing characters\n*                       in the range 0x20 to 0x7e (which excludes NUL, BS,\n*                       TAB, LF, FF and CR) especially noting that the\n*                       keyrecords are NOT null-terminated.\n*\n*   nkeyrec   int       Number of keyrecords in header[].\n*\n*   nkeyids   int       Number of entries in keyids[].\n*\n* Given and returned:\n*   keyids    struct fitskeyid []\n*                       While all keywords are extracted from the header,\n*                       keyids[] provides a convienient way of indexing them.\n*                       The fitskeyid struct contains three members;\n*                       fitskeyid::name must be set by the user while\n*                       fitskeyid::count and fitskeyid::idx are returned by\n*                       fitshdr().  All matched keywords will have their\n*                       fitskey::keyno member negated.\n*\n* Returned:\n*   nreject   int*      Number of header keyrecords rejected for syntax\n*                       errors.\n*\n*   keys      struct fitskey**\n*                       Pointer to an array of nkeyrec fitskey structs\n*                       containing all keywords and keyvalues extracted from\n*                       the header.\n*\n*                       Memory for the array is allocated by fitshdr() and\n*                       this must be freed by the user.  See wcsdealloc().\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null fitskey pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Fatal error returned by Flex parser.\n*                         4: Unrecognised data type.\n*\n* Notes:\n*   1: Keyword parsing is done in accordance with the syntax defined by\n*      NOST 100-2.0, noting the following points in particular:\n*\n*      a: Sect. 5.1.2.1 specifies that keywords be left-justified in columns\n*         1-8, blank-filled with no embedded spaces, composed only of the\n*         ASCII characters ABCDEFGHJKLMNOPQRSTUVWXYZ0123456789-_\n*\n*         fitshdr() accepts any characters in columns 1-8 but flags keywords\n*         that do not conform to standard syntax.\n*\n*      b: Sect. 5.1.2.2 defines the \"value indicator\" as the characters \"= \"\n*         occurring in columns 9 and 10.  If these are absent then the\n*         keyword has no value and columns 9-80 may contain any ASCII text\n*         (but see note 2 for CONTINUE keyrecords).  This is copied to the\n*         comment member of the fitskey struct.\n*\n*      c: Sect. 5.1.2.3 states that a keyword may have a null (undefined)\n*         value if the value/comment field, columns 11-80, consists entirely\n*         of spaces, possibly followed by a comment.\n*\n*      d: Sect. 5.1.1 states that trailing blanks in a string keyvalue are\n*         not significant and the parser always removes them.  A string\n*         containing nothing but blanks will be replaced with a single\n*         blank.\n*\n*         Sect. 5.2.1 also states that a quote character (') in a string\n*         value is to be represented by two successive quote characters and\n*         the parser removes the repeated quote.\n*\n*      e: The parser recognizes free-format character (NOST 100-2.0,\n*         Sect. 5.2.1), integer (Sect. 5.2.3), and floating-point values\n*         (Sect. 5.2.4) for all keywords.\n*\n*      f: Sect. 5.2.3 offers no comment on the size of an integer keyvalue\n*         except indirectly in limiting it to 70 digits.  The parser will\n*         translate an integer keyvalue to a 32-bit signed integer if it\n*         lies in the range -2147483648 to +2147483647, otherwise it\n*         interprets it as a 64-bit signed integer if possible, or else a\n*         \"very long\" integer (see fitskey::type).\n*\n*      g: END not followed by 77 blanks is not considered to be a legitimate\n*         end keyrecord.\n*\n*   2: The parser supports a generalization of the OGIP Long String Keyvalue\n*      Convention (v1.0) whereby strings may be continued onto successive\n*      header keyrecords.  A keyrecord contains a segment of a continued\n*      string if and only if\n*\n*      a: it contains the pseudo-keyword CONTINUE,\n*\n*      b: columns 9 and 10 are both blank,\n*\n*      c: columns 11 to 80 contain what would be considered a valid string\n*         keyvalue, including optional keycomment, if column 9 had contained\n*         '=',\n*\n*      d: the previous keyrecord contained either a valid string keyvalue or\n*         a valid CONTINUE keyrecord.\n*\n*      If any of these conditions is violated, the keyrecord is considered in\n*      isolation.\n*\n*      Syntax errors in keycomments in a continued string are treated more\n*      permissively than usual; the '/' delimiter may be omitted provided that\n*      parsing of the string keyvalue is not compromised.  However, the\n*      FITSHDR_COMMENT status bit will be set for the keyrecord (see\n*      fitskey::status).\n*\n*      As for normal strings, trailing blanks in a continued string are not\n*      significant.\n*\n*      In the OGIP convention \"the '&' character is used as the last non-blank\n*      character of the string to indicate that the string is (probably)\n*      continued on the following keyword\".  This additional syntax is not\n*      required by fitshdr(), but if '&' does occur as the last non-blank\n*      character of a continued string keyvalue then it will be removed, along\n*      with any trailing blanks.  However, blanks that occur before the '&'\n*      will be preserved.\n*\n*\n* fitskeyid struct - Keyword indexing\n* -----------------------------------\n* fitshdr() uses the fitskeyid struct to return indexing information for\n* specified keywords.  The struct contains three members, the first of which,\n* fitskeyid::name, must be set by the user with the remainder returned by\n* fitshdr().\n*\n*   char name[12]:\n*     (Given) Name of the required keyword.  This is to be set by the user;\n*     the '.' character may be used for wildcarding.  Trailing blanks will be\n*     replaced with nulls.\n*\n*   int count:\n*     (Returned) The number of matches found for the keyword.\n*\n*   int idx[2]:\n*     (Returned) Indices into keys[], the array of fitskey structs returned by\n*     fitshdr().  Note that these are 0-relative array indices, not keyrecord\n*     numbers.\n*\n*     If the keyword is found in the header the first index will be set to the\n*     array index of its first occurrence, otherwise it will be set to -1.\n*\n*     If multiples of the keyword are found, the second index will be set to\n*     the array index of its last occurrence, otherwise it will be set to -1.\n*\n*\n* fitskey struct - Keyword/value information\n* ------------------------------------------\n* fitshdr() returns an array of fitskey structs, each of which contains the\n* result of parsing one FITS header keyrecord.  All members of the fitskey\n* struct are returned by fitshdr(), none are given by the user.\n*\n*   int keyno\n*     (Returned) Keyrecord number (1-relative) in the array passed as input to\n*     fitshdr().  This will be negated if the keyword matched any specified in\n*     the keyids[] index.\n*\n*   int keyid\n*     (Returned) Index into the first entry in keyids[] with which the\n*     keyrecord matches, else -1.\n*\n*   int status\n*     (Returned) Status flag bit-vector for the header keyrecord employing the\n*     following bit masks defined as preprocessor macros:\n*\n*       - FITSHDR_KEYWORD:    Illegal keyword syntax.\n*       - FITSHDR_KEYVALUE:   Illegal keyvalue syntax.\n*       - FITSHDR_COMMENT:    Illegal keycomment syntax.\n*       - FITSHDR_KEYREC:     Illegal keyrecord, e.g. an END keyrecord with\n*                             trailing text.\n*       - FITSHDR_TRAILER:    Keyrecord following a valid END keyrecord.\n*\n*     The header keyrecord is syntactically correct if no bits are set.\n*\n*   char keyword[12]\n*     (Returned) Keyword name, null-filled for keywords of less than eight\n*     characters (trailing blanks replaced by nulls).\n*\n*     Use\n*\n=       sprintf(dst, \"%.8s\", keyword)\n*\n*     to copy it to a character array with null-termination, or\n*\n=       sprintf(dst, \"%8.8s\", keyword)\n*\n*     to blank-fill to eight characters followed by null-termination.\n*\n*   int type\n*     (Returned) Keyvalue data type:\n*       - 0: No keyvalue (both the value and type are undefined).\n*       - 1: Logical, represented as int.\n*       - 2: 32-bit signed integer.\n*       - 3: 64-bit signed integer (see below).\n*       - 4: Very long integer (see below).\n*       - 5: Floating point (stored as double).\n*       - 6: Integer complex (stored as double[2]).\n*       - 7: Floating point complex (stored as double[2]).\n*       - 8: String.\n*       - 8+10*n: Continued string (described below and in fitshdr() note 2).\n*\n*     A negative type indicates that a syntax error was encountered when\n*     attempting to parse a keyvalue of the particular type.\n*\n*     Comments on particular data types:\n*       - 64-bit signed integers lie in the range\n*\n=           (-9223372036854775808 <= int64 <  -2147483648) ||\n=                    (+2147483647 <  int64 <= +9223372036854775807)\n*\n*         A native 64-bit data type may be defined via preprocessor macro\n*         WCSLIB_INT64 defined in wcsconfig.h, e.g. as 'long long int'; this\n*         will be typedef'd to 'int64' here.  If WCSLIB_INT64 is not set, then\n*         int64 is typedef'd to int[3] instead and fitskey::keyvalue is to be\n*         computed as\n*\n=           ((keyvalue.k[2]) * 1000000000 +\n=             keyvalue.k[1]) * 1000000000 +\n=             keyvalue.k[0]\n*\n*         and may reported via\n*\n=            if (keyvalue.k[2]) {\n=              printf(\"%d%09d%09d\", keyvalue.k[2], abs(keyvalue.k[1]),\n=                                   abs(keyvalue.k[0]));\n=            } else {\n=              printf(\"%d%09d\", keyvalue.k[1], abs(keyvalue.k[0]));\n=            }\n*\n*         where keyvalue.k[0] and keyvalue.k[1] range from -999999999 to\n*         +999999999.\n*\n*       - Very long integers, up to 70 decimal digits in length, are encoded\n*         in keyvalue.l as an array of int[8], each of which stores 9 decimal\n*         digits.  fitskey::keyvalue is to be computed as\n*\n=           (((((((keyvalue.l[7]) * 1000000000 +\n=                  keyvalue.l[6]) * 1000000000 +\n=                  keyvalue.l[5]) * 1000000000 +\n=                  keyvalue.l[4]) * 1000000000 +\n=                  keyvalue.l[3]) * 1000000000 +\n=                  keyvalue.l[2]) * 1000000000 +\n=                  keyvalue.l[1]) * 1000000000 +\n=                  keyvalue.l[0]\n*\n*       - Continued strings are not reconstructed, they remain split over\n*         successive fitskey structs in the keys[] array returned by\n*         fitshdr().  fitskey::keyvalue data type, 8 + 10n, indicates the\n*         segment number, n, in the continuation.\n*\n*   int padding\n*     (An unused variable inserted for alignment purposes only.)\n*\n*   union keyvalue\n*     (Returned) A union comprised of\n*\n*       - fitskey::i,\n*       - fitskey::k,\n*       - fitskey::l,\n*       - fitskey::f,\n*       - fitskey::c,\n*       - fitskey::s,\n*\n*     used by the fitskey struct to contain the value associated with a\n*     keyword.\n*\n*   int i\n*     (Returned) Logical (fitskey::type == 1) and 32-bit signed integer\n*     (fitskey::type == 2) data types in the fitskey::keyvalue union.\n*\n*   int64 k\n*     (Returned) 64-bit signed integer (fitskey::type == 3) data type in the\n*     fitskey::keyvalue union.\n*\n*   int l[8]\n*     (Returned) Very long integer (fitskey::type == 4) data type in the\n*     fitskey::keyvalue union.\n*\n*   double f\n*     (Returned) Floating point (fitskey::type == 5) data type in the\n*     fitskey::keyvalue union.\n*\n*   double c[2]\n*     (Returned) Integer and floating point complex (fitskey::type == 6 || 7)\n*     data types in the fitskey::keyvalue union.\n*\n*   char s[72]\n*     (Returned) Null-terminated string (fitskey::type == 8) data type in the\n*     fitskey::keyvalue union.\n*\n*   int ulen\n*     (Returned) Where a keycomment contains a units string in the standard\n*     form, e.g. [m/s], the ulen member indicates its length, inclusive of\n*     square brackets.  Otherwise ulen is zero.\n*\n*   char comment[84]\n*     (Returned) Keycomment, i.e. comment associated with the keyword or, for\n*     keyrecords rejected because of syntax errors, the compete keyrecord\n*     itself with null-termination.\n*\n*     Comments are null-terminated with trailing spaces removed.  Leading\n*     spaces are also removed from keycomments (i.e. those immediately\n*     following the '/' character), but not from COMMENT or HISTORY keyrecords\n*     or keyrecords without a value indicator (\"= \" in columns 9-80).\n*\n*\n* Global variable: const char *fitshdr_errmsg[] - Status return messages\n* ----------------------------------------------------------------------\n* Error messages to match the status value returned from each function.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_FITSHDR\n#define WCSLIB_FITSHDR\n\n#include \"wcsconfig.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define FITSHDR_KEYWORD  0x01\n#define FITSHDR_KEYVALUE 0x02\n#define FITSHDR_COMMENT  0x04\n#define FITSHDR_KEYREC   0x08\n#define FITSHDR_CARD     0x08\t// Alias for backwards compatibility.\n#define FITSHDR_TRAILER  0x10\n\n\nextern const char *fitshdr_errmsg[];\n\nenum fitshdr_errmsg_enum {\n  FITSHDRERR_SUCCESS      = 0,\t// Success.\n  FITSHDRERR_NULL_POINTER = 1,\t// Null fitskey pointer passed.\n  FITSHDRERR_MEMORY       = 2,\t// Memory allocation failed.\n  FITSHDRERR_FLEX_PARSER  = 3,\t// Fatal error returned by Flex parser.\n  FITSHDRERR_DATA_TYPE    = 4 \t// Unrecognised data type.\n};\n\n#ifdef WCSLIB_INT64\n  typedef WCSLIB_INT64 int64;\n#else\n  typedef int int64[3];\n#endif\n\n\n// Struct used for indexing the keywords.\nstruct fitskeyid {\n  char name[12];\t\t// Keyword name, null-terminated.\n  int  count;\t\t\t// Number of occurrences of keyword.\n  int  idx[2];\t\t\t// Indices into fitskey array.\n};\n\n// Size of the fitskeyid struct in int units, used by the Fortran wrappers.\n#define KEYIDLEN (sizeof(struct fitskeyid)/sizeof(int))\n\n\n// Struct used for storing FITS keywords.\nstruct fitskey {\n  int  keyno;\t\t\t// Header keyrecord sequence number (1-rel).\n  int  keyid;\t\t\t// Index into fitskeyid[].\n  int  status;\t\t\t// Header keyrecord status bit flags.\n  char keyword[12];\t\t// Keyword name, null-filled.\n  int  type;\t\t\t// Keyvalue type (see above).\n  int  padding;\t\t\t// (Dummy inserted for alignment purposes.)\n  union {\n    int    i;\t\t\t// 32-bit integer and logical values.\n    int64  k;\t\t\t// 64-bit integer values.\n    int    l[8];\t\t// Very long signed integer values.\n    double f;\t\t\t// Floating point values.\n    double c[2];\t\t// Complex values.\n    char   s[72];\t\t// String values, null-terminated.\n  } keyvalue;\t\t\t// Keyvalue.\n  int  ulen;\t\t\t// Length of units string.\n  char comment[84];\t\t// Comment (or keyrecord), null-terminated.\n};\n\n// Size of the fitskey struct in int units, used by the Fortran wrappers.\n#define KEYLEN (sizeof(struct fitskey)/sizeof(int))\n\n\nint fitshdr(const char header[], int nkeyrec, int nkeyids,\n            struct fitskeyid keyids[], int *nreject, struct fitskey **keys);\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WCSLIB_FITSHDR\n"},{"id":16605,"name":"log.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: log.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the log routines\n* ---------------------------\n* Routines in this suite implement the part of the FITS World Coordinate\n* System (WCS) standard that deals with logarithmic coordinates, as described\n* in\n*\n*   \"Representations of world coordinates in FITS\",\n*   Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (WCS Paper I)\n*\n*   \"Representations of spectral coordinates in FITS\",\n*   Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L.\n*   2006, A&A, 446, 747 (WCS Paper III)\n*\n* These routines define methods to be used for computing logarithmic world\n* coordinates from intermediate world coordinates (a linear transformation of\n* image pixel coordinates), and vice versa.\n*\n* logx2s() and logs2x() implement the WCS logarithmic coordinate\n* transformations.\n*\n* Argument checking:\n* ------------------\n* The input log-coordinate values are only checked for values that would\n* result in floating point exceptions and the same is true for the\n* log-coordinate reference value.\n*\n* Accuracy:\n* ---------\n* No warranty is given for the accuracy of these routines (refer to the\n* copyright notice); intending users must satisfy for themselves their\n* adequacy for the intended purpose.  However, closure effectively to within\n* double precision rounding error was demonstrated by test routine tlog.c\n* which accompanies this software.\n*\n*\n* logx2s() - Transform to logarithmic coordinates\n* -----------------------------------------------\n* logx2s() transforms intermediate world coordinates to logarithmic\n* coordinates.\n*\n* Given and returned:\n*   crval     double    Log-coordinate reference value (CRVALia).\n*\n* Given:\n*   nx        int       Vector length.\n*\n*   sx        int       Vector stride.\n*\n*   slogc     int       Vector stride.\n*\n*   x         const double[]\n*                       Intermediate world coordinates, in SI units.\n*\n* Returned:\n*   logc      double[]  Logarithmic coordinates, in SI units.\n*\n*   stat      int[]     Status return value status for each vector element:\n*                         0: Success.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         2: Invalid log-coordinate reference value.\n*\n*\n* logs2x() - Transform logarithmic coordinates\n* --------------------------------------------\n* logs2x() transforms logarithmic world coordinates to intermediate world\n* coordinates.\n*\n* Given and returned:\n*   crval     double    Log-coordinate reference value (CRVALia).\n*\n* Given:\n*   nlogc     int       Vector length.\n*\n*   slogc     int       Vector stride.\n*\n*   sx        int       Vector stride.\n*\n*   logc      const double[]\n*                       Logarithmic coordinates, in SI units.\n*\n* Returned:\n*   x         double[]  Intermediate world coordinates, in SI units.\n*\n*   stat      int[]     Status return value status for each vector element:\n*                         0: Success.\n*                         1: Invalid value of logc.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         2: Invalid log-coordinate reference value.\n*                         4: One or more of the world-coordinate values\n*                            are incorrect, as indicated by the stat vector.\n*\n*\n* Global variable: const char *log_errmsg[] - Status return messages\n* ------------------------------------------------------------------\n* Error messages to match the status value returned from each function.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_LOG\n#define WCSLIB_LOG\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nextern const char *log_errmsg[];\n\nenum log_errmsg_enum {\n  LOGERR_SUCCESS         = 0,\t// Success.\n  LOGERR_NULL_POINTER    = 1,\t// Null pointer passed.\n  LOGERR_BAD_LOG_REF_VAL = 2,\t// Invalid log-coordinate reference value.\n  LOGERR_BAD_X           = 3,\t// One or more of the x coordinates were\n\t\t\t\t// invalid.\n  LOGERR_BAD_WORLD       = 4 \t// One or more of the world coordinates were\n\t\t\t\t// invalid.\n};\n\nint logx2s(double crval, int nx, int sx, int slogc, const double x[],\n           double logc[], int stat[]);\n\nint logs2x(double crval, int nlogc, int slogc, int sx, const double logc[],\n           double x[], int stat[]);\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WCSLIB_LOG\n"},{"id":16606,"name":"wcsfix.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsfix.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"lin.h\"\n#include \"sph.h\"\n#include \"tab.h\"\n#include \"wcs.h\"\n#include \"wcserr.h\"\n#include \"wcsfix.h\"\n#include \"wcsmath.h\"\n#include \"wcstrig.h\"\n#include \"wcsunits.h\"\n#include \"wcsutil.h\"\n#include \"wtbarr.h\"\n\nextern const int WCSSET;\n\n// Maximum number of coordinate axes that can be handled.\n#define NMAX 16\n\n// Map status return value to message.\nconst char *wcsfix_errmsg[] = {\n  \"Success\",\n  \"Null wcsprm pointer passed\",\n  \"Memory allocation failed\",\n  \"Linear transformation matrix is singular\",\n  \"Inconsistent or unrecognized coordinate axis types\",\n  \"Invalid parameter value\",\n  \"Invalid coordinate transformation parameters\",\n  \"Ill-conditioned coordinate transformation parameters\",\n  \"All of the corner pixel coordinates are invalid\",\n  \"Could not determine reference pixel coordinate\",\n  \"Could not determine reference pixel value\"};\n\n// Map error returns for lower-level routines.\nconst int fix_linerr[] = {\n  FIXERR_SUCCESS,\t\t//  0: LINERR_SUCCESS\n  FIXERR_NULL_POINTER,\t\t//  1: LINERR_NULL_POINTER\n  FIXERR_MEMORY,\t\t//  2: LINERR_MEMORY\n  FIXERR_SINGULAR_MTX,\t\t//  3: LINERR_SINGULAR_MTX\n  FIXERR_BAD_PARAM,\t\t//  4: LINERR_DISTORT_INIT\n  FIXERR_NO_REF_PIX_COORD,\t//  5: LINERR_DISTORT\n  FIXERR_NO_REF_PIX_VAL\t\t//  6: LINERR_DEDISTORT\n};\n\nconst int fix_wcserr[] = {\n  FIXERR_SUCCESS,\t\t//  0: WCSERR_SUCCESS\n  FIXERR_NULL_POINTER,\t\t//  1: WCSERR_NULL_POINTER\n  FIXERR_MEMORY,\t\t//  2: WCSERR_MEMORY\n  FIXERR_SINGULAR_MTX,\t\t//  3: WCSERR_SINGULAR_MTX\n  FIXERR_BAD_CTYPE,\t\t//  4: WCSERR_BAD_CTYPE\n  FIXERR_BAD_PARAM,\t\t//  5: WCSERR_BAD_PARAM\n  FIXERR_BAD_COORD_TRANS,\t//  6: WCSERR_BAD_COORD_TRANS\n  FIXERR_ILL_COORD_TRANS,\t//  7: WCSERR_ILL_COORD_TRANS\n  FIXERR_BAD_CORNER_PIX,\t//  8: WCSERR_BAD_PIX\n  FIXERR_NO_REF_PIX_VAL,\t//  9: WCSERR_BAD_WORLD\n  FIXERR_NO_REF_PIX_VAL \t// 10: WCSERR_BAD_WORLD_COORD\n\t\t\t\t//     ...others not used\n};\n\n// Convenience macro for invoking wcserr_set().\n#define WCSFIX_ERRMSG(status) WCSERR_SET(status), wcsfix_errmsg[status]\n\n//----------------------------------------------------------------------------\n\nint wcsfix(int ctrl, const int naxis[], struct wcsprm *wcs, int stat[])\n\n{\n  int status = 0;\n\n  if ((stat[CDFIX] = cdfix(wcs)) > 0) {\n    status = 1;\n  }\n\n  if ((stat[DATFIX] = datfix(wcs)) > 0) {\n    status = 1;\n  }\n\n  if ((stat[OBSFIX] = obsfix(0, wcs)) > 0) {\n    status = 1;\n  }\n\n  if ((stat[UNITFIX] = unitfix(ctrl, wcs)) > 0) {\n    status = 1;\n  }\n\n  if ((stat[SPCFIX] = spcfix(wcs)) > 0) {\n    status = 1;\n  }\n\n  if ((stat[CELFIX] = celfix(wcs)) > 0) {\n    status = 1;\n  }\n\n  if ((stat[CYLFIX] = cylfix(naxis, wcs)) > 0) {\n    status = 1;\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsfixi(\n  int ctrl,\n  const int naxis[],\n  struct wcsprm *wcs,\n  int stat[],\n  struct wcserr info[])\n\n{\n  int status = 0;\n\n  // Handling the status values returned from the sub-fixers is trickier than\n  // it might seem, especially considering that wcs->err may contain an error\n  // status on input which should be preserved if no translation errors occur.\n  // The simplest way seems to be to save a copy of wcs->err and clear it\n  // before each sub-fixer.  The last real error to occur, excluding\n  // informative messages, is the one returned.\n\n  // To get informative messages from spcfix() it must precede celfix() and\n  // cylfix().  The latter call wcsset() which also translates AIPS-convention\n  // spectral axes.\n  struct wcserr err;\n  wcserr_copy(wcs->err, &err);\n\n  for (int ifix = CDFIX; ifix < NWCSFIX; ifix++) {\n    // Clear (delete) wcs->err.\n    wcserr_clear(&(wcs->err));\n\n    switch (ifix) {\n    case CDFIX:\n      stat[ifix] = cdfix(wcs);\n      break;\n    case DATFIX:\n      stat[ifix] = datfix(wcs);\n      break;\n    case OBSFIX:\n      stat[ifix] = obsfix(0, wcs);\n      break;\n    case UNITFIX:\n      stat[ifix] = unitfix(ctrl, wcs);\n      break;\n    case SPCFIX:\n      stat[ifix] = spcfix(wcs);\n      break;\n    case CELFIX:\n      stat[ifix] = celfix(wcs);\n      break;\n    case CYLFIX:\n      stat[ifix] = cylfix(naxis, wcs);\n      break;\n    default:\n      continue;\n    }\n\n    if (stat[ifix] == FIXERR_NO_CHANGE) {\n      // No change => no message.\n      wcserr_copy(0x0, info+ifix);\n\n    } else if (stat[ifix] == 0) {\n      // Successful translation, but there may be an informative message.\n      if (wcs->err && wcs->err->status < 0) {\n        wcserr_copy(wcs->err, info+ifix);\n      } else {\n        wcserr_copy(0x0, info+ifix);\n      }\n\n    } else {\n      // An informative message or error message.\n      wcserr_copy(wcs->err, info+ifix);\n\n      if ((status = (stat[ifix] > 0))) {\n        // It was an error, replace the previous one.\n        wcserr_copy(wcs->err, &err);\n      }\n    }\n  }\n\n  // Restore the last error to occur.\n  if (err.status) {\n    wcserr_copy(&err, wcs->err);\n  } else {\n    wcserr_clear(&(wcs->err));\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint cdfix(struct wcsprm *wcs)\n\n{\n  if (wcs == 0x0) return FIXERR_NULL_POINTER;\n\n  if ((wcs->altlin & 1) || !(wcs->altlin & 2)) {\n    // Either we have PCi_ja or there are no CDi_ja.\n    return FIXERR_NO_CHANGE;\n  }\n\n  int naxis  = wcs->naxis;\n  int status = FIXERR_NO_CHANGE;\n  for (int i = 0; i < naxis; i++) {\n    // Row of zeros?\n    double *cd = wcs->cd + i*naxis;\n    for (int k = 0; k < naxis; k++, cd++) {\n      if (*cd != 0.0) goto next;\n    }\n\n    // Column of zeros?\n    cd = wcs->cd + i;\n    for (int k = 0; k < naxis; k++, cd += naxis) {\n      if (*cd != 0.0) goto next;\n    }\n\n    cd = wcs->cd + i * (naxis + 1);\n    *cd = 1.0;\n    status = FIXERR_SUCCESS;\n\nnext: ;\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nstatic int parse_date(const char *buf, int *hour, int *minute, double *sec)\n\n{\n  char ctmp[72];\n  if (sscanf(buf, \"%2d:%2d:%s\", hour, minute, ctmp) < 3 ||\n      wcsutil_str2double(ctmp, sec)) {\n    return 1;\n  }\n\n  return 0;\n}\n\n\nstatic void write_date(char *buf, int hour, int minute, double sec)\n\n{\n  char ctmp[32];\n  wcsutil_double2str(ctmp, \"%04.1f\", sec);\n  sprintf(buf, \"T%.2d:%.2d:%s\", hour, minute, ctmp);\n}\n\n\nstatic char *newline(char **cp)\n\n{\n  size_t k;\n  if ((k = strlen(*cp))) {\n    *cp += k;\n    strcat(*cp, \".\\n\");\n    *cp += 2;\n  }\n\n  return *cp;\n}\n\n\nint datfix(struct wcsprm *wcs)\n\n{\n  static const char *function = \"datfix\";\n\n  // MJD of J2000.0 and B1900.0.\n  const double mjd2000 = 51544.5;\n  const double mjd1900 = 15019.81352;\n\n  // Days per Julian year and per tropical year.\n  const double djy = 365.25;\n  const double dty = 365.242198781;\n\n  int  day, hour = 0, minute = 0, month, year;\n  double sec = 0.0;\n\n  if (wcs == 0x0) return FIXERR_NULL_POINTER;\n  struct wcserr **err = &(wcs->err);\n\n  char infomsg[512];\n  char *cp = infomsg;\n  *cp = '\\0';\n\n  int status = FIXERR_NO_CHANGE;\n\n  for (int i = 0; i < 5; i++) {\n    // MJDREF is split into integer and fractional parts, wheres MJDOBS and\n    // the rest are a single value.\n    const char *dateid;\n    char *date;\n    double *wcsmjd;\n    if (i == 0) {\n      // Note, DATEREF and MJDREF, not DATE-REF and MJD-REF (sigh).\n      dateid = \"REF\";\n      date   = wcs->dateref;\n      wcsmjd = wcs->mjdref;\n    } else if (i == 1) {\n      dateid = \"-OBS\";\n      date   = wcs->dateobs;\n      wcsmjd = &(wcs->mjdobs);\n    } else if (i == 2) {\n      dateid = \"-BEG\";\n      date   = wcs->datebeg;\n      wcsmjd = &(wcs->mjdbeg);\n    } else if (i == 3) {\n      dateid = \"-AVG\";\n      date   = wcs->dateavg;\n      wcsmjd = &(wcs->mjdavg);\n    } else if (i == 4) {\n      dateid = \"-END\";\n      date   = wcs->dateend;\n      wcsmjd = &(wcs->mjdend);\n    }\n\n    char orig_date[72];\n    strncpy(orig_date, date, 72);\n\n    if (date[0] == '\\0') {\n      // Fill in DATE from MJD if possible.\n\n      if (i == 1 && undefined(*wcsmjd)) {\n        // See if we have jepoch or bepoch.\n        if (!undefined(wcs->jepoch)) {\n          *wcsmjd = mjd2000 + (wcs->jepoch - 2000.0)*djy;\n          sprintf(newline(&cp), \"Set MJD-OBS to %.6f from JEPOCH\", *wcsmjd);\n          if (status == FIXERR_NO_CHANGE) status = FIXERR_SUCCESS;\n\n        } else if (!undefined(wcs->bepoch)) {\n          *wcsmjd = mjd1900 + (wcs->bepoch - 1900.0)*dty;\n          sprintf(newline(&cp), \"Set MJD-OBS to %.6f from BEPOCH\", *wcsmjd);\n          if (status == FIXERR_NO_CHANGE) status = FIXERR_SUCCESS;\n        }\n      }\n\n      if (undefined(*wcsmjd)) {\n        // No date information was provided.\n\n      } else {\n        // Calendar date from MJD, with allowance for MJD < 0.\n        double mjd[2], t;\n        if (i == 0) {\n          // MJDREF is already split into integer and fractional parts.\n          mjd[0] = wcsmjd[0];\n          mjd[1] = wcsmjd[1];\n          if (1.0 < mjd[1]) {\n            // Ensure the fractional part lies between 0 and +1.\n            t = floor(mjd[1]);\n            mjd[0] += t;\n            mjd[1] -= t;\n          }\n        } else {\n          // Split it into integer and fractional parts.\n          mjd[0] = floor(*wcsmjd);\n          mjd[1] = *wcsmjd - mjd[0];\n        }\n\n        int jd = 2400001 + (int)mjd[0];\n\n        int n4 =  4*(jd + ((2*((4*jd - 17918)/146097)*3)/4 + 1)/2 - 37);\n        int dd = 10*(((n4-237)%1461)/4) + 5;\n\n        year  = n4/1461 - 4712;\n        month = (2 + dd/306)%12 + 1;\n        day   = (dd%306)/10 + 1;\n        sprintf(date, \"%.4d-%.2d-%.2d\", year, month, day);\n\n        // Write time part only if non-zero.\n        if (0.0 < (t = mjd[1])) {\n          t *= 24.0;\n          hour = (int)t;\n          t = 60.0 * (t - hour);\n          minute = (int)t;\n          sec    = 60.0 * (t - minute);\n\n          // Round to 1ms.\n          dd = 60000*(60*hour + minute) + (int)(1000*(sec+0.0005));\n          hour = dd / 3600000;\n          dd -= 3600000 * hour;\n          minute = dd / 60000;\n          int msec = dd - 60000 * minute;\n          sprintf(date+10, \"T%.2d:%.2d:%.2d\", hour, minute, msec/1000);\n\n          // Write fractions of a second only if non-zero.\n          if (msec%1000) {\n            sprintf(date+19, \".%.3d\", msec%1000);\n          }\n        }\n      }\n\n    } else {\n      if (strlen(date) < 8) {\n        // Can't be a valid date.\n        status = FIXERR_BAD_PARAM;\n        sprintf(newline(&cp), \"Invalid DATE%s format '%s' is too short\",\n          dateid, date);\n        continue;\n      }\n\n      // Identify the date format.\n      if (date[4] == '-' && date[7] == '-') {\n        // Standard year-2000 form: CCYY-MM-DD[Thh:mm:ss[.sss...]]\n        if (sscanf(date, \"%4d-%2d-%2d\", &year, &month, &day) < 3) {\n          status = FIXERR_BAD_PARAM;\n          sprintf(newline(&cp), \"Invalid DATE%s format '%s'\", dateid, date);\n          continue;\n        }\n\n        if (date[10] == 'T') {\n          if (parse_date(date+11, &hour, &minute, &sec)) {\n            status = FIXERR_BAD_PARAM;\n            sprintf(newline(&cp), \"Invalid time in DATE%s '%s'\", dateid,\n              date+11);\n            continue;\n          }\n        } else if (date[10] == ' ') {\n          hour = 0;\n          minute = 0;\n          sec = 0.0;\n          if (parse_date(date+11, &hour, &minute, &sec)) {\n            write_date(date+10, hour, minute, sec);\n          } else {\n            date[10] = 'T';\n          }\n        }\n\n      } else if (date[4] == '/' && date[7] == '/') {\n        // Also allow CCYY/MM/DD[Thh:mm:ss[.sss...]]\n        if (sscanf(date, \"%4d/%2d/%2d\", &year, &month, &day) < 3) {\n          status = FIXERR_BAD_PARAM;\n          sprintf(newline(&cp), \"Invalid DATE%s format '%s'\", dateid, date);\n          continue;\n        }\n\n        if (date[10] == 'T') {\n          if (parse_date(date+11, &hour, &minute, &sec)) {\n            status = FIXERR_BAD_PARAM;\n            sprintf(newline(&cp), \"Invalid time in DATE%s '%s'\", dateid,\n              date+11);\n            continue;\n          }\n        } else if (date[10] == ' ') {\n          hour = 0;\n          minute = 0;\n          sec = 0.0;\n          if (parse_date(date+11, &hour, &minute, &sec)) {\n            write_date(date+10, hour, minute, sec);\n          } else {\n            date[10] = 'T';\n          }\n        }\n\n        // Looks ok, fix it up.\n        date[4]  = '-';\n        date[7]  = '-';\n\n      } else {\n        if (i == 1 && date[2] == '/' && date[5] == '/') {\n          // Old format DATE-OBS date: DD/MM/YY, also allowing DD/MM/CCYY.\n          if (sscanf(date, \"%2d/%2d/%4d\", &day, &month, &year) < 3) {\n            status = FIXERR_BAD_PARAM;\n            sprintf(newline(&cp), \"Invalid DATE%s format '%s'\", dateid,\n              date);\n            continue;\n          }\n\n        } else if (i == 1 && date[2] == '-' && date[5] == '-') {\n          // Also recognize DD-MM-YY and DD-MM-CCYY\n          if (sscanf(date, \"%2d-%2d-%4d\", &day, &month, &year) < 3) {\n            status = FIXERR_BAD_PARAM;\n            sprintf(newline(&cp), \"Invalid DATE%s format '%s'\", dateid,\n              date);\n            continue;\n          }\n\n        } else {\n          // Not a valid date format.\n          status = FIXERR_BAD_PARAM;\n          sprintf(newline(&cp), \"Invalid DATE%s format '%s'\", dateid, date);\n          continue;\n        }\n\n        if (year < 100) year += 1900;\n\n        // Doesn't have a time.\n        sprintf(date, \"%.4d-%.2d-%.2d\", year, month, day);\n      }\n\n      // Compute MJD.\n      double mjd[2];\n      mjd[0] = (double)((1461*(year - (12-month)/10 + 4712))/4\n               + (306*((month+9)%12) + 5)/10\n               - (3*((year - (12-month)/10 + 4900)/100))/4\n               + day - 2399904);\n      mjd[1] = (hour + (minute + sec/60.0)/60.0)/24.0;\n      double mjdsum = mjd[0] + mjd[1];\n\n      if (undefined(*wcsmjd)) {\n        if (i == 0) {\n          wcsmjd[0] = mjd[0];\n          wcsmjd[1] = mjd[1];\n        } else {\n          *wcsmjd = mjdsum;\n        }\n        sprintf(newline(&cp), \"Set MJD%s to %.6f from DATE%s\", dateid,\n          mjdsum, dateid);\n\n        if (status == FIXERR_NO_CHANGE) status = FIXERR_SUCCESS;\n\n      } else {\n        // Check for consistency.\n        double mjdtmp;\n        if (i == 0) {\n          mjdtmp = wcsmjd[0] + wcsmjd[1];\n        } else {\n          mjdtmp = *wcsmjd;\n        }\n\n        if (0.001 < fabs(mjdsum - mjdtmp)) {\n          status = FIXERR_BAD_PARAM;\n          sprintf(newline(&cp),\n            \"Invalid parameter values: MJD%s and DATE%s are inconsistent\",\n            dateid, dateid);\n        }\n      }\n\n      if (i == 1) {\n        if (!undefined(wcs->jepoch)) {\n          // Check consistency of JEPOCH.\n          double jepoch = 2000.0 + (*wcsmjd - mjd2000) / djy;\n\n          if (0.000002 < fabs(jepoch - wcs->jepoch)) {\n            // Informational only, no error.\n            sprintf(newline(&cp), \"JEPOCH is inconsistent with DATE-OBS\");\n          }\n        }\n\n        if (!undefined(wcs->bepoch)) {\n          // Check consistency of BEPOCH.\n          double bepoch = 1900.0 + (*wcsmjd - mjd1900) / dty;\n\n          if (0.000002 < fabs(bepoch - wcs->bepoch)) {\n            // Informational only, no error.\n            sprintf(newline(&cp), \"BEPOCH is inconsistent with DATE-OBS\");\n          }\n        }\n      }\n    }\n\n    if (strncmp(orig_date, date, 72)) {\n      if (orig_date[0] == '\\0') {\n        sprintf(newline(&cp), \"Set DATE%s to '%s' from MJD%s\", dateid, date,\n          dateid);\n      } else {\n        sprintf(newline(&cp), \"Changed DATE%s from '%s' to '%s'\", dateid,\n          orig_date, date);\n      }\n\n      if (status == FIXERR_NO_CHANGE) status = FIXERR_SUCCESS;\n    }\n  }\n\n  if (*infomsg) {\n    wcserr_set(WCSERR_SET(FIXERR_DATE_FIX), infomsg);\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint obsfix(int ctrl, struct wcsprm *wcs)\n\n{\n  static const char *function = \"obsfix\";\n\n  // IAU(1976) ellipsoid (as prescribed by WCS Paper VII).\n  const double a  = 6378140.0;\n  const double f  = 1.0 / 298.2577;\n  const double e2 = (2.0 - f)*f;\n\n  if (wcs == 0x0) return FIXERR_NULL_POINTER;\n  struct wcserr **err = &(wcs->err);\n\n  // Set masks for checking partially-defined coordinate triplets.\n  int havexyz = 7;\n  havexyz -= 1*undefined(wcs->obsgeo[0]);\n  havexyz -= 2*undefined(wcs->obsgeo[1]);\n  havexyz -= 4*undefined(wcs->obsgeo[2]);\n  int havelbh = 7;\n  havelbh -= 1*undefined(wcs->obsgeo[3]);\n  havelbh -= 2*undefined(wcs->obsgeo[4]);\n  havelbh -= 4*undefined(wcs->obsgeo[5]);\n\n  if (ctrl == 2) {\n    // Make no changes.\n    if (0 < havexyz && havexyz < 7) {\n      return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM),\n        \"Partially undefined Cartesian coordinate triplet\");\n    }\n\n    if (0 < havelbh && havelbh < 7) {\n      return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM),\n        \"Partially undefined Geodetic coordinate triplet\");\n    }\n\n    if (havexyz == 0 || havelbh == 0) {\n      return FIXERR_NO_CHANGE;\n    }\n  }\n\n  if (havexyz == 0 && havelbh == 0) {\n    return FIXERR_NO_CHANGE;\n  }\n\n\n  char infomsg[256];\n  infomsg[0] = '\\0';\n\n  int status = FIXERR_NO_CHANGE;\n\n  size_t k;\n  double x, y, z;\n  if (havelbh == 7) {\n    // Compute (x,y,z) from (lng,lat,hgt).\n    double coslat, coslng, sinlat, sinlng;\n    sincosd(wcs->obsgeo[3], &sinlng, &coslng);\n    sincosd(wcs->obsgeo[4], &sinlat, &coslat);\n    double n = a / sqrt(1.0 - e2*sinlat*sinlat);\n    double rho = n + wcs->obsgeo[5];\n\n    x = rho*coslng*coslat;\n    y = rho*sinlng*coslat;\n    z = (rho - n*e2)*sinlat;\n\n    if (havexyz < 7) {\n      // One or more of the Cartesian elements was undefined.\n      status = FIXERR_SUCCESS;\n      char *cp = infomsg;\n\n      if (ctrl == 1 || !(havexyz & 1)) {\n        wcs->obsgeo[0] = x;\n        sprintf(cp, \"%s OBSGEO-X to %12.3f from OBSGEO-[LBH]\",\n          (havexyz & 1) ? \"Reset\" : \"Set\", x);\n      }\n\n      if (ctrl == 1 || !(havexyz & 2)) {\n        wcs->obsgeo[1] = y;\n\n        if ((k = strlen(cp))) {\n          strcat(cp+k, \".\\n\");\n          cp += k + 2;\n        }\n\n        sprintf(cp, \"%s OBSGEO-Y to %12.3f from OBSGEO-[LBH]\",\n          (havexyz & 2) ? \"Reset\" : \"Set\", y);\n      }\n\n      if (ctrl == 1 || !(havexyz & 4)) {\n        wcs->obsgeo[2] = z;\n        if ((k = strlen(cp))) {\n          strcat(cp+k, \".\\n\");\n          cp += k + 2;\n        }\n\n        sprintf(cp, \"%s OBSGEO-Z to %12.3f from OBSGEO-[LBH]\",\n          (havexyz & 4) ? \"Reset\" : \"Set\", z);\n      }\n\n      wcserr_set(WCSERR_SET(FIXERR_OBSGEO_FIX), infomsg);\n\n      if (havexyz == 0) {\n        // Skip the consistency check.\n        return status;\n      }\n    }\n\n  } else if (havexyz == 7) {\n    // Compute (lng,lat,hgt) from (x,y,z).\n    x = wcs->obsgeo[0];\n    y = wcs->obsgeo[1];\n    z = wcs->obsgeo[2];\n    double r2 = x*x + y*y;\n\n    // Iterate over the value of zeta.\n    double coslat, coslng, sinlat, sinlng;\n    double n, rho, zeta = z;\n    for (int i = 0; i < 4; i++) {\n      rho = sqrt(r2 + zeta*zeta);\n      sinlat = zeta / rho;\n      n = a / sqrt(1.0 - e2*sinlat*sinlat);\n\n      zeta = z / (1.0 - n*e2/rho);\n    }\n\n    double lng = atan2d(y, x);\n    double lat = asind(sinlat);\n    double hgt = rho - n;\n\n    if (havelbh < 7) {\n      // One or more of the Geodetic elements was undefined.\n      status = FIXERR_SUCCESS;\n      char *cp = infomsg;\n\n      if (ctrl == 1 || !(havelbh & 1)) {\n        wcs->obsgeo[3] = lng;\n        sprintf(cp, \"%s OBSGEO-L to %12.6f from OBSGEO-[XYZ]\",\n          (havelbh & 1) ? \"Reset\" : \"Set\", lng);\n      }\n\n      if (ctrl == 1 || !(havelbh & 2)) {\n        wcs->obsgeo[4] = lat;\n        if ((k = strlen(cp))) {\n          strcat(cp+k, \".\\n\");\n          cp += k + 2;\n        }\n\n        sprintf(cp, \"%s OBSGEO-B to %12.6f from OBSGEO-[XYZ]\",\n          (havelbh & 2) ? \"Reset\" : \"Set\", lat);\n      }\n\n      if (ctrl == 1 || !(havelbh & 4)) {\n        wcs->obsgeo[5] = hgt;\n        if ((k = strlen(cp))) {\n          strcat(cp+k, \".\\n\");\n          cp += k + 2;\n        }\n\n        sprintf(cp, \"%s OBSGEO-H to %12.3f from OBSGEO-[XYZ]\",\n          (havelbh & 4) ? \"Reset\" : \"Set\", hgt);\n      }\n\n      wcserr_set(WCSERR_SET(FIXERR_OBSGEO_FIX), infomsg);\n\n      if (havelbh == 0) {\n        // Skip the consistency check.\n        return status;\n      }\n    }\n\n    // Compute (x,y,z) from (lng,lat,hgt) for consistency checking.\n    sincosd(wcs->obsgeo[3], &sinlng, &coslng);\n    sincosd(wcs->obsgeo[4], &sinlat, &coslat);\n    n = a / sqrt(1.0 - e2*sinlat*sinlat);\n    rho = n + wcs->obsgeo[5];\n\n    x = rho*coslng*coslat;\n    y = rho*sinlng*coslat;\n    z = (rho - n*e2)*sinlat;\n\n  } else {\n    return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM),\n      \"Observatory coordinates incomplete\");\n  }\n\n\n  // Check consistency.\n  double d, r2 = 0.0;\n  d = wcs->obsgeo[0] - x;\n  r2 += d*d;\n  d = wcs->obsgeo[1] - y;\n  r2 += d*d;\n  d = wcs->obsgeo[2] - z;\n  r2 += d*d;\n\n  if (1.0 < r2) {\n    d = sqrt(r2);\n    return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM),\n      \"Observatory coordinates inconsistent by %.1f metres\", d);\n  }\n\n  return status;\n}\n\n\n//----------------------------------------------------------------------------\n\nint unitfix(int ctrl, struct wcsprm *wcs)\n\n{\n  const char *function = \"unitfix\";\n\n  if (wcs == 0x0) return FIXERR_NULL_POINTER;\n  struct wcserr **err = &(wcs->err);\n\n  int status = FIXERR_NO_CHANGE;\n\n  char msg[512];\n  strncpy(msg, \"Changed units:\", 512);\n\n  for (int i = 0; i < wcs->naxis; i++) {\n    char orig_unit[72];\n    strncpy(orig_unit, wcs->cunit[i], 71);\n    int result = wcsutrne(ctrl, wcs->cunit[i], &(wcs->err));\n    if (result == 0 || result == 12) {\n      size_t msglen = strlen(msg);\n      if (msglen < 511) {\n        wcsutil_null_fill(72, orig_unit);\n        char msgtmp[192];\n        sprintf(msgtmp, \"\\n  '%s' -> '%s',\", orig_unit, wcs->cunit[i]);\n        strncpy(msg+msglen, msgtmp, 511-msglen);\n        status = FIXERR_UNITS_ALIAS;\n      }\n    }\n  }\n\n  if (status == FIXERR_UNITS_ALIAS) {\n    // Chop off the trailing \", \".\n    size_t msglen = strlen(msg) - 2;\n    msg[msglen] = '\\0';\n    wcserr_set(WCSERR_SET(FIXERR_UNITS_ALIAS), msg);\n\n    status = FIXERR_SUCCESS;\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint spcfix(struct wcsprm *wcs)\n\n{\n  static const char *function = \"spcfix\";\n\n  if (wcs == 0x0) return FIXERR_NULL_POINTER;\n  struct wcserr **err = &(wcs->err);\n\n  for (int i = 0; i < wcs->naxis; i++) {\n    // Translate an AIPS-convention spectral type if present.\n    char ctype[9], specsys[9];\n    int status = spcaips(wcs->ctype[i], wcs->velref, ctype, specsys);\n    if (status == FIXERR_SUCCESS) {\n      // An AIPS type was found but it may match what we already have.\n      status = FIXERR_NO_CHANGE;\n\n      // Was specsys translated?\n      if (wcs->specsys[0] == '\\0' && *specsys) {\n        strncpy(wcs->specsys, specsys, 9);\n        wcserr_set(WCSERR_SET(FIXERR_SPC_UPDATE),\n          \"Changed SPECSYS to '%s'\", specsys);\n        status = FIXERR_SUCCESS;\n      }\n\n      // Was ctype translated?  Have to null-fill for comparing them.\n      wcsutil_null_fill(9, wcs->ctype[i]);\n      if (strncmp(wcs->ctype[i], ctype, 9)) {\n        // ctype was translated...\n        if (status == FIXERR_SUCCESS) {\n          // ...and specsys was also.\n          wcserr_set(WCSERR_SET(FIXERR_SPC_UPDATE),\n            \"Changed CTYPE%d from '%s' to '%s', and SPECSYS to '%s' \"\n            \"(VELREF=%d)\", i+1, wcs->ctype[i], ctype, wcs->specsys,\n            wcs->velref);\n        } else {\n          wcserr_set(WCSERR_SET(FIXERR_SPC_UPDATE),\n            \"Changed CTYPE%d from '%s' to '%s' (VELREF=%d)\", i+1,\n            wcs->ctype[i], ctype, wcs->velref);\n          status = FIXERR_SUCCESS;\n        }\n\n        strncpy(wcs->ctype[i], ctype, 9);\n      }\n\n      // Tidy up.\n      if (status == FIXERR_SUCCESS) {\n        wcsutil_null_fill(72, wcs->ctype[i]);\n        wcsutil_null_fill(72, wcs->specsys);\n      }\n\n      // No need to check for others, wcsset() will fail if so.\n      return status;\n\n    } else if (status == SPCERR_BAD_SPEC_PARAMS) {\n      // An AIPS spectral type was found but with invalid velref.\n      return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM),\n        \"Invalid parameter value: velref = %d\", wcs->velref);\n    }\n  }\n\n  return FIXERR_NO_CHANGE;\n}\n\n//----------------------------------------------------------------------------\n\nint celfix(struct wcsprm *wcs)\n\n{\n  static const char *function = \"celfix\";\n\n  if (wcs == 0x0) return FIXERR_NULL_POINTER;\n  struct wcserr **err = &(wcs->err);\n\n  // Initialize if required.\n  int status;\n  if (wcs->flag != WCSSET) {\n    if ((status = wcsset(wcs))) return fix_wcserr[status];\n  }\n\n  // Was an NCP or GLS projection code translated?\n  if (wcs->lat >= 0) {\n    // Check ctype.\n    if (strcmp(wcs->ctype[wcs->lat]+5, \"NCP\") == 0) {\n      strcpy(wcs->ctype[wcs->lng]+5, \"SIN\");\n      strcpy(wcs->ctype[wcs->lat]+5, \"SIN\");\n\n      if (wcs->npvmax < wcs->npv + 2) {\n        // Allocate space for two more PVi_ma keyvalues.\n        if (wcs->m_flag == WCSSET && wcs->pv == wcs->m_pv) {\n          if (!(wcs->pv = calloc(wcs->npv+2, sizeof(struct pvcard)))) {\n            wcs->pv = wcs->m_pv;\n            return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY));\n          }\n\n          wcs->npvmax = wcs->npv + 2;\n          wcs->m_flag = WCSSET;\n\n          for (int k = 0; k < wcs->npv; k++) {\n            wcs->pv[k] = wcs->m_pv[k];\n          }\n\n          if (wcs->m_pv) free(wcs->m_pv);\n          wcs->m_pv = wcs->pv;\n\n        } else {\n          return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY));\n        }\n      }\n\n      struct celprm *wcscel = &(wcs->cel);\n      struct prjprm *wcsprj = &(wcscel->prj);\n      wcs->pv[wcs->npv].i = wcs->lat + 1;\n      wcs->pv[wcs->npv].m = 1;\n      wcs->pv[wcs->npv].value = wcsprj->pv[1];\n      (wcs->npv)++;\n\n      wcs->pv[wcs->npv].i = wcs->lat + 1;\n      wcs->pv[wcs->npv].m = 2;\n      wcs->pv[wcs->npv].value = wcsprj->pv[2];\n      (wcs->npv)++;\n\n      return FIXERR_SUCCESS;\n\n    } else if (strcmp(wcs->ctype[wcs->lat]+5, \"GLS\") == 0) {\n      strcpy(wcs->ctype[wcs->lng]+5, \"SFL\");\n      strcpy(wcs->ctype[wcs->lat]+5, \"SFL\");\n\n      if (wcs->crval[wcs->lng] != 0.0 || wcs->crval[wcs->lat] != 0.0) {\n        // In the AIPS convention, setting the reference longitude and\n        // latitude for GLS does not create an oblique graticule.  A non-zero\n        // reference longitude introduces an offset in longitude in the normal\n        // way, whereas a non-zero reference latitude simply translates the\n        // reference point (i.e. the map as a whole) to that latitude.  This\n        // might be effected by adjusting CRPIXja but that is complicated by\n        // the linear transformation and instead is accomplished here by\n        // setting theta_0.\n        if (wcs->npvmax < wcs->npv + 3) {\n          // Allocate space for three more PVi_ma keyvalues.\n          if (wcs->m_flag == WCSSET && wcs->pv == wcs->m_pv) {\n            if (!(wcs->pv = calloc(wcs->npv+3, sizeof(struct pvcard)))) {\n              wcs->pv = wcs->m_pv;\n              return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY));\n            }\n\n            wcs->npvmax = wcs->npv + 3;\n            wcs->m_flag = WCSSET;\n\n            for (int k = 0; k < wcs->npv; k++) {\n              wcs->pv[k] = wcs->m_pv[k];\n            }\n\n            if (wcs->m_pv) free(wcs->m_pv);\n            wcs->m_pv = wcs->pv;\n\n          } else {\n            return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY));\n          }\n        }\n\n        wcs->pv[wcs->npv].i = wcs->lng + 1;\n        wcs->pv[wcs->npv].m = 0;\n        wcs->pv[wcs->npv].value = 1.0;\n        (wcs->npv)++;\n\n        // Note that the reference longitude is still zero.\n        wcs->pv[wcs->npv].i = wcs->lng + 1;\n        wcs->pv[wcs->npv].m = 1;\n        wcs->pv[wcs->npv].value = 0.0;\n        (wcs->npv)++;\n\n        wcs->pv[wcs->npv].i = wcs->lng + 1;\n        wcs->pv[wcs->npv].m = 2;\n        wcs->pv[wcs->npv].value = wcs->crval[wcs->lat];\n        (wcs->npv)++;\n      }\n\n      return FIXERR_SUCCESS;\n    }\n  }\n\n  return FIXERR_NO_CHANGE;\n}\n\n//----------------------------------------------------------------------------\n\nint cylfix(const int naxis[], struct wcsprm *wcs)\n\n{\n  static const char *function = \"cylfix\";\n\n  if (naxis == 0x0) return FIXERR_NO_CHANGE;\n  if (wcs == 0x0) return FIXERR_NULL_POINTER;\n  struct wcserr **err = &(wcs->err);\n\n  // Initialize if required.\n  int status;\n  if (wcs->flag != WCSSET) {\n    if ((status = wcsset(wcs))) return fix_wcserr[status];\n  }\n\n  // Check that we have a cylindrical projection.\n  if (wcs->cel.prj.category != CYLINDRICAL) return FIXERR_NO_CHANGE;\n  if (wcs->naxis < 2) return FIXERR_NO_CHANGE;\n\n\n  // Compute the native longitude in each corner of the image.\n  unsigned short ncnr = 1 << wcs->naxis;\n\n  unsigned short indx[NMAX];\n  for (int k = 0; k < NMAX; k++) {\n    indx[k] = 1 << k;\n  }\n\n  int    stat[4];\n  double img[4][NMAX], phi[4], pix[4][NMAX], theta[4], world[4][NMAX];\n\n  double phimin =  1.0e99;\n  double phimax = -1.0e99;\n  for (unsigned short icnr = 0; icnr < ncnr;) {\n    // Do four corners at a time.\n    for (int j = 0; j < 4; j++, icnr++) {\n      double *pixj = pix[j];\n\n      for (int k = 0; k < wcs->naxis; k++) {\n        if (icnr & indx[k]) {\n          *(pixj++) = naxis[k] + 0.5;\n        } else {\n          *(pixj++) = 0.5;\n        }\n      }\n    }\n\n    if (!(status = wcsp2s(wcs, 4, NMAX, pix[0], img[0], phi, theta, world[0],\n                          stat))) {\n      for (int j = 0; j < 4; j++) {\n        if (phi[j] < phimin) phimin = phi[j];\n        if (phi[j] > phimax) phimax = phi[j];\n      }\n    }\n  }\n\n  if (phimin > phimax) return fix_wcserr[status];\n\n  // Any changes needed?\n  if (phimin >= -180.0 && phimax <= 180.0) return FIXERR_NO_CHANGE;\n\n\n  // Compute the new reference pixel coordinates.\n  double phi0 = (phimin + phimax) / 2.0;\n  double theta0 = 0.0;\n\n  double x, y;\n  if ((status = prjs2x(&(wcs->cel.prj), 1, 1, 1, 1, &phi0, &theta0, &x, &y,\n                       stat))) {\n    if (status == PRJERR_BAD_PARAM) {\n      status = FIXERR_BAD_PARAM;\n    } else {\n      status = FIXERR_NO_REF_PIX_COORD;\n    }\n    return wcserr_set(WCSFIX_ERRMSG(status));\n  }\n\n  for (int k = 0; k < wcs->naxis; k++) {\n    img[0][k] = 0.0;\n  }\n  img[0][wcs->lng] = x;\n  img[0][wcs->lat] = y;\n\n  if ((status = linx2p(&(wcs->lin), 1, 0, img[0], pix[0]))) {\n    return wcserr_set(WCSFIX_ERRMSG(fix_linerr[status]));\n  }\n\n\n  // Compute celestial coordinates at the new reference pixel.\n  if ((status = wcsp2s(wcs, 1, 0, pix[0], img[0], phi, theta, world[0],\n                       stat))) {\n    return fix_wcserr[status];\n  }\n\n  // Compute native coordinates of the celestial pole.\n  double lng =  0.0;\n  double lat = 90.0;\n  (void)sphs2x(wcs->cel.euler, 1, 1, 1, 1, &lng, &lat, phi, theta);\n\n  wcs->crpix[wcs->lng] = pix[0][wcs->lng];\n  wcs->crpix[wcs->lat] = pix[0][wcs->lat];\n  wcs->crval[wcs->lng] = world[0][wcs->lng];\n  wcs->crval[wcs->lat] = world[0][wcs->lat];\n  wcs->lonpole = phi[0] - phi0;\n\n  return wcsset(wcs);\n}\n\n//----------------------------------------------------------------------------\n\n// Helper function used only by wcspcx().\nstatic int unscramble(int n, int mapto[], int step, int type, void *vptr);\n\nint wcspcx(\n  struct wcsprm *wcs,\n  int dopc,\n  int permute,\n  double rotn[2])\n\n{\n  static const char *function = \"wcspcx\";\n\n  // Initialize if required.\n  if (wcs == 0x0) return FIXERR_NULL_POINTER;\n  struct wcserr **err = &(wcs->err);\n\n  int status;\n  if (wcs->flag != WCSSET) {\n    if ((status = wcsset(wcs))) return fix_wcserr[status];\n  }\n\n  // Check for CDi_j usage.\n  double *wcscd = wcs->cd;\n  if ((wcs->altlin & 1) || !(wcs->altlin & 2)) {\n    if ((wcs->altlin & 1) && dopc == 1) {\n      // Recompose PCi_j + CDELTi.\n      wcscd = wcs->pc;\n    } else {\n      return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM),\n        \"CDi_j is not used in this coordinate representation\");\n    }\n  }\n\n  // Check for sequent distortions.\n  if (wcs->lin.disseq) {\n    return wcserr_set(WCSERR_SET(FIXERR_BAD_COORD_TRANS),\n      \"Cannot handle coordinate descriptions containing sequent distortions\");\n  }\n\n\n  // Allocate memory in bulk for two nxn matrices.\n  int naxis = wcs->naxis;\n  double *mem;\n  if ((mem = calloc(2*naxis*naxis, sizeof(double))) == 0x0) {\n    return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY));\n  }\n\n  double *mat = mem;\n  double *inv = mem + naxis*naxis;\n\n  // Construct the transpose of CDi_j with each element squared.\n  double *matij = mat;\n  for (int i = 0; i < naxis; i++) {\n    double *cdji = wcscd + i;\n    for (int j = 0; j < naxis; j++) {\n      *(matij++) = (*cdji) * (*cdji);\n      cdji += naxis;\n    }\n  }\n\n  // Invert the matrix.\n  if ((status = matinv(naxis, mat, inv))) {\n    return wcserr_set(WCSERR_SET(FIXERR_SINGULAR_MTX),\n      \"No solution for CDi_j matrix decomposition\");\n  }\n\n  // Apply scaling.\n  double *invij = inv;\n  double *pcij = wcs->pc;\n  double *cdij = wcscd;\n  for (int i = 0; i < naxis; i++) {\n    double scl = 0.0;\n    for (int j = 0; j < naxis; j++) {\n      scl += *(invij++);\n    }\n\n    scl = sqrt(scl);\n    wcs->cdelt[i] /= scl;\n\n    for (int j = 0; j < naxis; j++) {\n      *(pcij++) = *(cdij++) * scl;\n    }\n  }\n\n  // mapto[i] records where row i of PCi_j should move to.\n  int *mapto = 0x0;\n  if ((mapto = (int*)malloc(naxis*sizeof(int))) == 0x0) {\n    free(mem);\n    return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY));\n  }\n\n  for (int i = 0; i < naxis; i++) {\n    mapto[i] = -1;\n  }\n\n  // Ensure that latitude always follows longitude.\n  if (wcs->lng >= 0 && wcs->lat >= 0) {\n    double *pci = wcs->pc + naxis*wcs->lng;\n\n    // Take the first non-zero element in the row.\n    for (int j = 0; j < naxis; j++) {\n      if (fabs(pci[j]) != 0.0) {\n        mapto[wcs->lng] = j;\n        break;\n      }\n    }\n\n    if (mapto[wcs->lng] == naxis-1) {\n      mapto[wcs->lng]--;\n    }\n\n    mapto[wcs->lat] = mapto[wcs->lng] + 1;\n  }\n\n  // Fill in the rest of the row permutation map.\n  for (int j = 0; j < naxis; j++) {\n    // Column j.\n    double *pcij = wcs->pc + j;\n    double colmax = 0.0;\n\n    // Look down the column to find the absolute maximum element.\n    for (int i = 0; i < naxis; i++, pcij += naxis) {\n      if (!(mapto[i] < 0)) {\n        // This row is already mapped.\n        continue;\n      }\n\n      if (fabs(*pcij) > colmax) {\n        mapto[i] = j;\n        colmax = fabs(*pcij);\n      }\n    }\n  }\n\n\n  // Fix the sign of CDELTi.  Celestial axes are special, otherwise diagonal\n  // elements of the correctly permuted matrix should be positive.\n  for (int i = 0; i < naxis; i++) {\n    int chsgn;\n    double *pci = wcs->pc + naxis*i;\n\n    // Celestial axes are special.\n    if (i == wcs->lng) {\n      // Longitude axis - force CDELTi < 0.0.\n      chsgn = (wcs->cdelt[i] > 0.0);\n    } else if (i == wcs->lat) {\n      // Latitude axis - force CDELTi > 0.0.\n      chsgn = (wcs->cdelt[i] < 0.0);\n    } else {\n      chsgn = (pci[mapto[i]] < 0.0);\n    }\n\n    if (chsgn) {\n      wcs->cdelt[i] = -wcs->cdelt[i];\n\n      for (int j = 0; j < naxis; j++) {\n        // Test needed to prevent negative zeros.\n        if (pci[j] != 0.0) {\n          pci[j] = -pci[j];\n        }\n      }\n    }\n  }\n\n  free(mem);\n\n  // Setting bit 3 in wcsprm::altlin stops wcsset() from reconstructing\n  // PCi_j and CDELTi from CDi_j.\n  wcs->altlin |= 8;\n\n\n  // Compute rotation angle of each basis vector of the celestial axes.\n  if (rotn) {\n    if (wcs->lng < 0 || wcs->lat < 0) {\n      // No celestial axes.\n      rotn[0] = 0.0;\n      rotn[1] = 0.0;\n\n    } else {\n      double x, y;\n      x =  wcs->pc[naxis*wcs->lng + mapto[wcs->lng]];\n      y =  wcs->pc[naxis*wcs->lat + mapto[wcs->lng]];\n      rotn[0] = atan2d(y, x);\n\n      y = -wcs->pc[naxis*wcs->lng + mapto[wcs->lat]];\n      x =  wcs->pc[naxis*wcs->lat + mapto[wcs->lat]];\n      rotn[1] = atan2d(y, x);\n    }\n  }\n\n\n  // Permute rows?\n  if (permute) {\n    // Check whether there's anything to unscramble.\n    int scrambled = 0;\n    for (int i = 0; i < naxis; i++) {\n      if (mapto[i] != i) {\n        scrambled = 1;\n        break;\n      }\n    }\n\n    if (scrambled) {\n      for (int i = 0; i < naxis; i++) {\n        // Do columns of the PCi_ja matrix.\n        if (unscramble(naxis, mapto, naxis, 1, wcs->pc + i)) goto cleanup;\n      }\n      if (unscramble(naxis, mapto, 1, 1, wcs->cdelt)) goto cleanup;\n      if (unscramble(naxis, mapto, 1, 1, wcs->crval)) goto cleanup;\n      if (unscramble(naxis, mapto, 1, 2, wcs->cunit)) goto cleanup;\n      if (unscramble(naxis, mapto, 1, 2, wcs->ctype)) goto cleanup;\n\n      for (int ipv = 0; ipv < wcs->npv; ipv++) {\n        // Noting that PVi_ma axis numbers are 1-relative.\n        int i = wcs->pv[ipv].i - 1;\n        wcs->pv[ipv].i = mapto[i] + 1;\n      }\n\n      for (int ips = 0; ips < wcs->nps; ips++) {\n        // Noting that PSi_ma axis numbers are 1-relative.\n        int i = wcs->ps[ips].i - 1;\n        wcs->ps[ips].i = mapto[i] + 1;\n      }\n\n      if (wcs->altlin & 2) {\n        for (int i = 0; i < naxis; i++) {\n          // Do columns of the CDi_ja matrix.\n          if (unscramble(naxis, mapto, naxis, 1, wcs->cd + i)) goto cleanup;\n        }\n      }\n\n      if (wcs->altlin & 4) {\n        if (unscramble(naxis, mapto, 1, 1, wcs->crota)) goto cleanup;\n      }\n\n      if (unscramble(naxis, mapto, 1, 3, wcs->colax)) goto cleanup;\n      if (unscramble(naxis, mapto, 1, 2, wcs->cname)) goto cleanup;\n      if (unscramble(naxis, mapto, 1, 1, wcs->crder)) goto cleanup;\n      if (unscramble(naxis, mapto, 1, 1, wcs->csyer)) goto cleanup;\n      if (unscramble(naxis, mapto, 1, 1, wcs->czphs)) goto cleanup;\n      if (unscramble(naxis, mapto, 1, 1, wcs->cperi)) goto cleanup;\n\n      // Coordinate lookup tables.\n      for (int itab = 0; itab < wcs->ntab; itab++) {\n        for (int m = 0; m < wcs->tab[itab].M; m++) {\n          int i = wcs->tab[itab].map[m];\n          wcs->tab[itab].map[m] = mapto[i];\n        }\n      }\n\n      for (int iwtb = 0; iwtb < wcs->nwtb; iwtb++) {\n        int i = wcs->wtb[iwtb].i;\n        wcs->wtb[iwtb].i = mapto[i];\n      }\n\n      // Distortions?  No.  Prior distortions operate on pixel coordinates and\n      // therefore are not permuted, and sequent distortions are not handled.\n    }\n  }\n\n  free(mapto);\n\n  // Reset the struct.\n  if ((status = wcsset(wcs))) return fix_wcserr[status];\n\n  return FIXERR_SUCCESS;\n\ncleanup:\n  if (mapto) free(mapto);\n  return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY));\n}\n\n\nint unscramble(\n  int n,\n  int mapto[],\n  int step,\n  int type,\n  void *vptr)\n\n{\n  if (step == 0) step = 1;\n\n  if (type == 1) {\n    double *dval = (double *)vptr;\n    double *dtmp;\n    if ((dtmp = (double *)malloc(n*sizeof(double))) == 0x0) {\n      return 1;\n    }\n\n    for (int i = 0; i < n; i++) {\n      dtmp[mapto[i]] = dval[i*step];\n    }\n\n    for (int i = 0; i < n; i++) {\n      dval[i*step] = dtmp[i];\n    }\n\n    free(dtmp);\n\n  } else if (type == 2) {\n    char (*cval)[72] = (char (*)[72])vptr;\n    char (*ctmp)[72];\n    if ((ctmp = (char (*)[72])malloc(n*72*sizeof(char))) == 0x0) {\n      return 1;\n    }\n\n    for (int i = 0; i < n; i++) {\n      memcpy(ctmp[mapto[i]], cval[i], 72);\n    }\n\n    for (int i = 0; i < n; i++) {\n      memcpy(cval[i], ctmp[i], 72);\n    }\n\n    free(ctmp);\n\n  } else if (type == 3) {\n    int *ival = (int *)vptr;\n    int *itmp;\n    if ((itmp = (int *)malloc(n*sizeof(int))) == 0x0) {\n      return 1;\n    }\n\n    for (int i = 0; i < n; i++) {\n      itmp[mapto[i]] = ival[i];\n    }\n\n    for (int i = 0; i < n; i++) {\n      ival[i] = itmp[i];\n    }\n\n    free(itmp);\n  }\n\n  return 0;\n}\n"},{"id":16607,"name":"getwcstab.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: getwcstab.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <stdlib.h>\n#include <string.h>\n\n#include <fitsio.h>\n\n#include \"getwcstab.h\"\n\n//----------------------------------------------------------------------------\n\nint fits_read_wcstab(\n  fitsfile   *fptr,\n  int  nwtb,\n  wtbarr *wtb,\n  int  *status)\n\n{\n  int  anynul, colnum, hdunum, iwtb, m, naxis, nostat;\n  long *naxes = 0, nelem;\n  wtbarr *wtbp;\n\n\n  if (*status) return *status;\n\n  if (fptr == 0) {\n    return (*status = NULL_INPUT_PTR);\n  }\n\n  if (nwtb == 0) return 0;\n\n  // Zero the array pointers.\n  wtbp = wtb;\n  for (iwtb = 0; iwtb < nwtb; iwtb++, wtbp++) {\n    *wtbp->arrayp = 0x0;\n  }\n\n  // Save HDU number so that we can move back to it later.\n  fits_get_hdu_num(fptr, &hdunum);\n\n  wtbp = wtb;\n  for (iwtb = 0; iwtb < nwtb; iwtb++, wtbp++) {\n    // Move to the required binary table extension.\n    if (fits_movnam_hdu(fptr, BINARY_TBL, (char *)(wtbp->extnam),\n        wtbp->extver, status)) {\n      goto cleanup;\n    }\n\n    // Locate the table column.\n    if (fits_get_colnum(fptr, CASEINSEN, (char *)(wtbp->ttype), &colnum,\n        status)) {\n      goto cleanup;\n    }\n\n    // Get the array dimensions and check for consistency.\n    if (wtbp->ndim < 1) {\n      *status = NEG_AXIS;\n      goto cleanup;\n    }\n\n    if (!(naxes = calloc(wtbp->ndim, sizeof(long)))) {\n      *status = MEMORY_ALLOCATION;\n      goto cleanup;\n    }\n\n    if (fits_read_tdim(fptr, colnum, wtbp->ndim, &naxis, naxes, status)) {\n      goto cleanup;\n    }\n\n    if (naxis != wtbp->ndim) {\n      if (wtbp->kind == 'c' && wtbp->ndim == 2) {\n        // Allow TDIMn to be omitted for degenerate coordinate arrays.\n        naxis = 2;\n        naxes[1] = naxes[0];\n        naxes[0] = 1;\n      } else {\n        *status = BAD_TDIM;\n        goto cleanup;\n      }\n    }\n\n    if (wtbp->kind == 'c') {\n      // Coordinate array; calculate the array size.\n      nelem = naxes[0];\n      for (m = 0; m < naxis-1; m++) {\n        *(wtbp->dimlen + m) = naxes[m+1];\n        nelem *= naxes[m+1];\n      }\n    } else {\n      // Index vector; check length.\n      if ((nelem = naxes[0]) != *(wtbp->dimlen)) {\n        // N.B. coordinate array precedes the index vectors.\n        *status = BAD_TDIM;\n        goto cleanup;\n      }\n    }\n\n    free(naxes);\n    naxes = 0;\n\n    // Allocate memory for the array.\n    if (!(*wtbp->arrayp = calloc((size_t)nelem, sizeof(double)))) {\n      *status = MEMORY_ALLOCATION;\n      goto cleanup;\n    }\n\n    // Read the array from the table.\n    if (fits_read_col_dbl(fptr, colnum, wtbp->row, 1L, nelem, 0.0,\n        *wtbp->arrayp, &anynul, status)) {\n      goto cleanup;\n    }\n  }\n\ncleanup:\n  // Move back to the starting HDU.\n  nostat = 0;\n  fits_movabs_hdu(fptr, hdunum, 0, &nostat);\n\n  // Release allocated memory.\n  if (naxes) free(naxes);\n  if (*status) {\n    wtbp = wtb;\n    for (iwtb = 0; iwtb < nwtb; iwtb++, wtbp++) {\n      if (*wtbp->arrayp) free(*wtbp->arrayp);\n    }\n  }\n\n  return *status;\n}\n"},{"id":16608,"name":"wcsunits.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsunits.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the wcsunits routines\n* --------------------------------\n* Routines in this suite deal with units specifications and conversions, as\n* described in\n*\n=   \"Representations of world coordinates in FITS\",\n=   Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (WCS Paper I)\n*\n* The Flexible Image Transport System (FITS), a data format widely used in\n* astronomy for data interchange and archive, is described in\n*\n=   \"Definition of the Flexible Image Transport System (FITS), version 3.0\",\n=   Pence, W.D., Chiappetti, L., Page, C.G., Shaw, R.A., & Stobie, E. 2010,\n=   A&A, 524, A42 - http://dx.doi.org/10.1051/0004-6361/201015362\n*\n* See also http://fits.gsfc.nasa.gov\n*\n* These routines perform basic units-related operations:\n*\n*   - wcsunitse(): given two unit specifications, derive the conversion from\n*     one to the other.\n*\n*   - wcsutrne(): translates certain commonly used but non-standard unit\n*     strings.  It is intended to be called before wcsulexe() which only\n*     handles standard FITS units specifications.\n*\n*   - wcsulexe(): parses a standard FITS units specification of arbitrary\n*     complexity, deriving the conversion to canonical units.\n*\n*\n* wcsunitse() - FITS units specification conversion\n* -------------------------------------------------\n* wcsunitse() derives the conversion from one system of units to another.\n*\n* A deprecated form of this function, wcsunits(), lacks the wcserr**\n* parameter.\n*\n* Given:\n*   have      const char []\n*                       FITS units specification to convert from (null-\n*                       terminated), with or without surrounding square\n*                       brackets (for inline specifications); text following\n*                       the closing bracket is ignored.\n*\n*   want      const char []\n*                       FITS units specification to convert to (null-\n*                       terminated), with or without surrounding square\n*                       brackets (for inline specifications); text following\n*                       the closing bracket is ignored.\n*\n* Returned:\n*   scale,\n*   offset,\n*   power     double*   Convert units using\n*\n=                         pow(scale*value + offset, power);\n*\n*                       Normally offset is zero except for log() or ln()\n*                       conversions, e.g. \"log(MHz)\" to \"ln(Hz)\".  Likewise,\n*                       power is normally unity except for exp() conversions,\n*                       e.g. \"exp(ms)\" to \"exp(/Hz)\".  Thus conversions\n*                       ordinarily consist of\n*\n=                         value *= scale;\n*\n*   err       struct wcserr **\n*                       If enabled, for function return values > 1, this\n*                       struct will contain a detailed error message, see\n*                       wcserr_enable().  May be NULL if an error message is\n*                       not desired.  Otherwise, the user is responsible for\n*                       deleting the memory allocated for the wcserr struct.\n*\n* Function return value:\n*             int       Status return value:\n*                          0: Success.\n*                        1-9: Status return from wcsulexe().\n*                         10: Non-conformant unit specifications.\n*                         11: Non-conformant functions.\n*\n*                       scale is zeroed on return if an error occurs.\n*\n*\n* wcsutrne() - Translation of non-standard unit specifications\n* ------------------------------------------------------------\n* wcsutrne() translates certain commonly used but non-standard unit strings,\n* e.g. \"DEG\", \"MHZ\", \"KELVIN\", that are not recognized by wcsulexe(), refer to\n* the notes below for a full list.  Compounds are also recognized, e.g.\n* \"JY/BEAM\" and \"KM/SEC/SEC\".  Extraneous embedded blanks are removed.\n*\n* A deprecated form of this function, wcsutrn(), lacks the wcserr** parameter.\n*\n* Given:\n*   ctrl      int       Although \"S\" is commonly used to represent seconds,\n*                       its translation to \"s\" is potentially unsafe since the\n*                       standard recognizes \"S\" formally as Siemens, however\n*                       rarely that may be used.  The same applies to \"H\" for\n*                       hours (Henry), and \"D\" for days (Debye).  This\n*                       bit-flag controls what to do in such cases:\n*                         1: Translate \"S\" to \"s\".\n*                         2: Translate \"H\" to \"h\".\n*                         4: Translate \"D\" to \"d\".\n*                       Thus ctrl == 0 doesn't do any unsafe translations,\n*                       whereas ctrl == 7 does all of them.\n*\n* Given and returned:\n*   unitstr   char []   Null-terminated character array containing the units\n*                       specification to be translated.\n*\n*                       Inline units specifications in a FITS header\n*                       keycomment are also handled.  If the first non-blank\n*                       character in unitstr is '[' then the unit string is\n*                       delimited by its matching ']'.  Blanks preceding '['\n*                       will be stripped off, but text following the closing\n*                       bracket will be preserved without modification.\n*\n*   err       struct wcserr **\n*                       If enabled, for function return values > 1, this\n*                       struct will contain a detailed error message, see\n*                       wcserr_enable().  May be NULL if an error message is\n*                       not desired.  Otherwise, the user is responsible for\n*                       deleting the memory allocated for the wcserr struct.\n*\n* Function return value:\n*             int       Status return value:\n*                        -1: No change was made, other than stripping blanks\n*                            (not an error).\n*                         0: Success.\n*                         9: Internal parser error.\n*                        12: Potentially unsafe translation, whether applied\n*                            or not (see notes).\n*\n* Notes:\n*   1: Translation of non-standard unit specifications: apart from leading and\n*      trailing blanks, a case-sensitive match is required for the aliases\n*      listed below, in particular the only recognized aliases with metric\n*      prefixes are \"KM\", \"KHZ\", \"MHZ\", and \"GHZ\".  Potentially unsafe\n*      translations of \"D\", \"H\", and \"S\", shown in parentheses, are optional.\n*\n=        Unit       Recognized aliases\n=        ----       ----------------------------------------------------------\n=        Angstrom   Angstroms angstrom angstroms\n=        arcmin     arcmins, ARCMIN, ARCMINS\n=        arcsec     arcsecs, ARCSEC, ARCSECS\n=        beam       BEAM\n=        byte       Byte\n=        d          day, days, (D), DAY, DAYS\n=        deg        degree, degrees, Deg, Degree, Degrees, DEG, DEGREE,\n=                   DEGREES\n=        GHz        GHZ\n=        h          hr, (H), HR\n=        Hz         hz, HZ\n=        kHz        KHZ\n=        Jy         JY\n=        K          kelvin, kelvins, Kelvin, Kelvins, KELVIN, KELVINS\n=        km         KM\n=        m          metre, meter, metres, meters, M, METRE, METER, METRES,\n=                   METERS\n=        min        MIN\n=        MHz        MHZ\n=        Ohm        ohm\n=        Pa         pascal, pascals, Pascal, Pascals, PASCAL, PASCALS\n=        pixel      pixels, PIXEL, PIXELS\n=        rad        radian, radians, RAD, RADIAN, RADIANS\n=        s          sec, second, seconds, (S), SEC, SECOND, SECONDS\n=        V          volt, volts, Volt, Volts, VOLT, VOLTS\n=        yr         year, years, YR, YEAR, YEARS\n*\n*      The aliases \"angstrom\", \"ohm\", and \"Byte\" for (Angstrom, Ohm, and byte)\n*      are recognized by wcsulexe() itself as an unofficial extension of the\n*      standard, but they are converted to the standard form here.\n*\n*\n* wcsulexe() - FITS units specification parser\n* --------------------------------------------\n* wcsulexe() parses a standard FITS units specification of arbitrary\n* complexity, deriving the scale factor required to convert to canonical\n* units - basically SI with degrees and \"dimensionless\" additions such as\n* byte, pixel and count.\n*\n* A deprecated form of this function, wcsulex(), lacks the wcserr** parameter.\n*\n* Given:\n*   unitstr   const char []\n*                       Null-terminated character array containing the units\n*                       specification, with or without surrounding square\n*                       brackets (for inline specifications); text following\n*                       the closing bracket is ignored.\n*\n* Returned:\n*   func      int*      Special function type, see note 4:\n*                         0: None\n*                         1: log()  ...base 10\n*                         2: ln()   ...base e\n*                         3: exp()\n*\n*   scale     double*   Scale factor for the unit specification; multiply a\n*                       value expressed in the given units by this factor to\n*                       convert it to canonical units.\n*\n*   units     double[WCSUNITS_NTYPE]\n*                       A units specification is decomposed into powers of 16\n*                       fundamental unit types: angle, mass, length, time,\n*                       count, pixel, etc.  Preprocessor macro WCSUNITS_NTYPE\n*                       is defined to dimension this vector, and others such\n*                       WCSUNITS_PLANE_ANGLE, WCSUNITS_LENGTH, etc. to access\n*                       its elements.\n*\n*                       Corresponding character strings, wcsunits_types[] and\n*                       wcsunits_units[], are predefined to describe each\n*                       quantity and its canonical units.\n*\n*   err       struct wcserr **\n*                       If enabled, for function return values > 1, this\n*                       struct will contain a detailed error message, see\n*                       wcserr_enable().  May be NULL if an error message is\n*                       not desired.  Otherwise, the user is responsible for\n*                       deleting the memory allocated for the wcserr struct.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Invalid numeric multiplier.\n*                         2: Dangling binary operator.\n*                         3: Invalid symbol in INITIAL context.\n*                         4: Function in invalid context.\n*                         5: Invalid symbol in EXPON context.\n*                         6: Unbalanced bracket.\n*                         7: Unbalanced parenthesis.\n*                         8: Consecutive binary operators.\n*                         9: Internal parser error.\n*\n*                       scale and units[] are zeroed on return if an error\n*                       occurs.\n*\n* Notes:\n*   1: wcsulexe() is permissive in accepting whitespace in all contexts in a\n*      units specification where it does not create ambiguity (e.g. not\n*      between a metric prefix and a basic unit string), including in strings\n*      like \"log (m ** 2)\" which is formally disallowed.\n*\n*   2: Supported extensions:\n*      - \"angstrom\" (OGIP usage) is allowed in addition to \"Angstrom\".\n*      - \"ohm\"      (OGIP usage) is allowed in addition to \"Ohm\".\n*      - \"Byte\"   (common usage) is allowed in addition to \"byte\".\n*\n*   3: Table 6 of WCS Paper I lists eleven units for which metric prefixes are\n*      allowed.  However, in this implementation only prefixes greater than\n*      unity are allowed for \"a\" (annum), \"yr\" (year), \"pc\" (parsec), \"bit\",\n*      and \"byte\", and only prefixes less than unity are allowed for \"mag\"\n*      (stellar magnitude).\n*\n*      Metric prefix \"P\" (peta) is specifically forbidden for \"a\" (annum) to\n*      avoid confusion with \"Pa\" (Pascal, not peta-annum).  Note that metric\n*      prefixes are specifically disallowed for \"h\" (hour) and \"d\" (day) so\n*      that \"ph\" (photons) cannot be interpreted as pico-hours, nor \"cd\"\n*      (candela) as centi-days.\n*\n*   4: Function types log(), ln() and exp() may only occur at the start of the\n*      units specification.  The scale and units[] returned for these refers\n*      to the string inside the function \"argument\", e.g. to \"MHz\" in log(MHz)\n*      for which a scale of 1e6 will be returned.\n*\n*\n* Global variable: const char *wcsunits_errmsg[] - Status return messages\n* -----------------------------------------------------------------------\n* Error messages to match the status value returned from each function.\n*\n*\n* Global variable: const char *wcsunits_types[] - Names of physical quantities\n* ----------------------------------------------------------------------------\n* Names for physical quantities to match the units vector returned by\n* wcsulexe():\n*   -  0: plane angle\n*   -  1: solid angle\n*   -  2: charge\n*   -  3: mole\n*   -  4: temperature\n*   -  5: luminous intensity\n*   -  6: mass\n*   -  7: length\n*   -  8: time\n*   -  9: beam\n*   - 10: bin\n*   - 11: bit\n*   - 12: count\n*   - 13: stellar magnitude\n*   - 14: pixel\n*   - 15: solar ratio\n*   - 16: voxel\n*\n*\n* Global variable: const char *wcsunits_units[] - Names of units\n* --------------------------------------------------------------\n* Names for the units (SI) to match the units vector returned by wcsulexe():\n*   -  0: degree\n*   -  1: steradian\n*   -  2: Coulomb\n*   -  3: mole\n*   -  4: Kelvin\n*   -  5: candela\n*   -  6: kilogram\n*   -  7: metre\n*   -  8: second\n*\n* The remainder are dimensionless.\n*===========================================================================*/\n\n#ifndef WCSLIB_WCSUNITS\n#define WCSLIB_WCSUNITS\n\n#include \"wcserr.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\nextern const char *wcsunits_errmsg[];\n\nenum wcsunits_errmsg_enum {\n  UNITSERR_SUCCESS            =  0,\t// Success.\n  UNITSERR_BAD_NUM_MULTIPLIER =  1,\t// Invalid numeric multiplier.\n  UNITSERR_DANGLING_BINOP     =  2,\t// Dangling binary operator.\n  UNITSERR_BAD_INITIAL_SYMBOL =  3,\t// Invalid symbol in INITIAL context.\n  UNITSERR_FUNCTION_CONTEXT   =  4,\t// Function in invalid context.\n  UNITSERR_BAD_EXPON_SYMBOL   =  5,\t// Invalid symbol in EXPON context.\n  UNITSERR_UNBAL_BRACKET      =  6,\t// Unbalanced bracket.\n  UNITSERR_UNBAL_PAREN        =  7,\t// Unbalanced parenthesis.\n  UNITSERR_CONSEC_BINOPS      =  8,\t// Consecutive binary operators.\n  UNITSERR_PARSER_ERROR       =  9,\t// Internal parser error.\n  UNITSERR_BAD_UNIT_SPEC      = 10,\t// Non-conformant unit specifications.\n  UNITSERR_BAD_FUNCS          = 11,\t// Non-conformant functions.\n  UNITSERR_UNSAFE_TRANS       = 12\t// Potentially unsafe translation.\n};\n\nextern const char *wcsunits_types[];\nextern const char *wcsunits_units[];\n\n#define WCSUNITS_PLANE_ANGLE 0\n#define WCSUNITS_SOLID_ANGLE 1\n#define WCSUNITS_CHARGE      2\n#define WCSUNITS_MOLE        3\n#define WCSUNITS_TEMPERATURE 4\n#define WCSUNITS_LUMINTEN    5\n#define WCSUNITS_MASS        6\n#define WCSUNITS_LENGTH      7\n#define WCSUNITS_TIME        8\n#define WCSUNITS_BEAM        9\n#define WCSUNITS_BIN        10\n#define WCSUNITS_BIT        11\n#define WCSUNITS_COUNT      12\n#define WCSUNITS_MAGNITUDE  13\n#define WCSUNITS_PIXEL      14\n#define WCSUNITS_SOLRATIO   15\n#define WCSUNITS_VOXEL      16\n\n#define WCSUNITS_NTYPE      17\n\n\nint wcsunitse(const char have[], const char want[], double *scale,\n              double *offset, double *power, struct wcserr **err);\n\nint wcsutrne(int ctrl, char unitstr[], struct wcserr **err);\n\nint wcsulexe(const char unitstr[], int *func, double *scale,\n             double units[WCSUNITS_NTYPE], struct wcserr **err);\n\n// Deprecated.\nint wcsunits(const char have[], const char want[], double *scale,\n             double *offset, double *power);\nint wcsutrn(int ctrl, char unitstr[]);\nint wcsulex(const char unitstr[], int *func, double *scale,\n            double units[WCSUNITS_NTYPE]);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WCSLIB_WCSUNITS\n"},{"id":16609,"name":"tab.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: tab.h,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 7.7 - C routines that implement the FITS World Coordinate System\n* (WCS) standard.  Refer to the README file provided with WCSLIB for an\n* overview of the library.\n*\n*\n* Summary of the tab routines\n* ---------------------------\n* Routines in this suite implement the part of the FITS World Coordinate\n* System (WCS) standard that deals with tabular coordinates, i.e. coordinates\n* that are defined via a lookup table, as described in\n*\n=   \"Representations of world coordinates in FITS\",\n=   Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (WCS Paper I)\n=\n=   \"Representations of spectral coordinates in FITS\",\n=   Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L.\n=   2006, A&A, 446, 747 (WCS Paper III)\n*\n* These routines define methods to be used for computing tabular world\n* coordinates from intermediate world coordinates (a linear transformation\n* of image pixel coordinates), and vice versa.  They are based on the tabprm\n* struct which contains all information needed for the computations.  The\n* struct contains some members that must be set by the user, and others that\n* are maintained by these routines, somewhat like a C++ class but with no\n* encapsulation.\n*\n* tabini(), tabmem(), tabcpy(), and tabfree() are provided to manage the\n* tabprm struct, tabsize() computes its total size including allocated memory,\n* and tabprt() prints its contents.\n*\n* tabperr() prints the error message(s) (if any) stored in a tabprm struct.\n*\n* A setup routine, tabset(), computes intermediate values in the tabprm struct\n* from parameters in it that were supplied by the user.  The struct always\n* needs to be set up by tabset() but it need not be called explicitly - refer\n* to the explanation of tabprm::flag.\n*\n* tabx2s() and tabs2x() implement the WCS tabular coordinate transformations.\n*\n* Accuracy:\n* ---------\n* No warranty is given for the accuracy of these routines (refer to the\n* copyright notice); intending users must satisfy for themselves their\n* adequacy for the intended purpose.  However, closure effectively to within\n* double precision rounding error was demonstrated by test routine ttab.c\n* which accompanies this software.\n*\n*\n* tabini() - Default constructor for the tabprm struct\n* ----------------------------------------------------\n* tabini() allocates memory for arrays in a tabprm struct and sets all members\n* of the struct to default values.\n*\n* PLEASE NOTE: every tabprm struct should be initialized by tabini(), possibly\n* repeatedly.  On the first invokation, and only the first invokation, the\n* flag member of the tabprm struct must be set to -1 to initialize memory\n* management, regardless of whether tabini() will actually be used to allocate\n* memory.\n*\n* Given:\n*   alloc     int       If true, allocate memory unconditionally for arrays in\n*                       the tabprm struct.\n*\n*                       If false, it is assumed that pointers to these arrays\n*                       have been set by the user except if they are null\n*                       pointers in which case memory will be allocated for\n*                       them regardless.  (In other words, setting alloc true\n*                       saves having to initalize these pointers to zero.)\n*\n*   M         int       The number of tabular coordinate axes.\n*\n*   K         const int[]\n*                       Vector of length M whose elements (K_1, K_2,... K_M)\n*                       record the lengths of the axes of the coordinate array\n*                       and of each indexing vector.  M and K[] are used to\n*                       determine the length of the various tabprm arrays and\n*                       therefore the amount of memory to allocate for them.\n*                       Their values are copied into the tabprm struct.\n*\n*                       It is permissible to set K (i.e. the address of the\n*                       array) to zero which has the same effect as setting\n*                       each element of K[] to zero.  In this case no memory\n*                       will be allocated for the index vectors or coordinate\n*                       array in the tabprm struct.  These together with the\n*                       K vector must be set separately before calling\n*                       tabset().\n*\n* Given and returned:\n*   tab       struct tabprm*\n*                       Tabular transformation parameters.  Note that, in\n*                       order to initialize memory management tabprm::flag\n*                       should be set to -1 when tab is initialized for the\n*                       first time (memory leaks may result if it had already\n*                       been initialized).\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null tabprm pointer passed.\n*                         2: Memory allocation failed.\n*                         3: Invalid tabular parameters.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       tabprm::err if enabled, see wcserr_enable().\n*\n*\n* tabmem() - Acquire tabular memory\n* ---------------------------------\n* tabmem() takes control of memory allocated by the user for arrays in the\n* tabprm struct.\n*\n* Given and returned:\n*   tab       struct tabprm*\n*                       Tabular transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null tabprm pointer passed.\n*                         2: Memory allocation failed.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       tabprm::err if enabled, see wcserr_enable().\n*\n*\n* tabcpy() - Copy routine for the tabprm struct\n* ---------------------------------------------\n* tabcpy() does a deep copy of one tabprm struct to another, using tabini() to\n* allocate memory for its arrays if required.  Only the \"information to be\n* provided\" part of the struct is copied; a call to tabset() is required to\n* set up the remainder.\n*\n* Given:\n*   alloc     int       If true, allocate memory unconditionally for arrays in\n*                       the tabprm struct.\n*\n*                       If false, it is assumed that pointers to these arrays\n*                       have been set by the user except if they are null\n*                       pointers in which case memory will be allocated for\n*                       them regardless.  (In other words, setting alloc true\n*                       saves having to initalize these pointers to zero.)\n*\n*   tabsrc    const struct tabprm*\n*                       Struct to copy from.\n*\n* Given and returned:\n*   tabdst    struct tabprm*\n*                       Struct to copy to.  tabprm::flag should be set to -1\n*                       if tabdst was not previously initialized (memory leaks\n*                       may result if it was previously initialized).\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null tabprm pointer passed.\n*                         2: Memory allocation failed.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       tabprm::err (associated with tabdst) if enabled, see\n*                       wcserr_enable().\n*\n*\n* tabcmp() - Compare two tabprm structs for equality\n* --------------------------------------------------\n* tabcmp() compares two tabprm structs for equality.\n*\n* Given:\n*   cmp       int       A bit field controlling the strictness of the\n*                       comparison.  At present, this value must always be 0,\n*                       indicating a strict comparison.  In the future, other\n*                       options may be added.\n*\n*   tol       double    Tolerance for comparison of floating-point values.\n*                       For example, for tol == 1e-6, all floating-point\n*                       values in the structs must be equal to the first 6\n*                       decimal places.  A value of 0 implies exact equality.\n*\n*   tab1      const struct tabprm*\n*                       The first tabprm struct to compare.\n*\n*   tab2      const struct tabprm*\n*                       The second tabprm struct to compare.\n*\n* Returned:\n*   equal     int*      Non-zero when the given structs are equal.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null pointer passed.\n*\n*\n* tabfree() - Destructor for the tabprm struct\n* --------------------------------------------\n* tabfree() frees memory allocated for the tabprm arrays by tabini().\n* tabini() records the memory it allocates and tabfree() will only attempt to\n* free this.\n*\n* PLEASE NOTE: tabfree() must not be invoked on a tabprm struct that was not\n* initialized by tabini().\n*\n* Returned:\n*   tab       struct tabprm*\n*                       Coordinate transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null tabprm pointer passed.\n*\n*\n* tabsize() - Compute the size of a tabprm struct\n* -----------------------------------------------\n* tabsize() computes the full size of a tabprm struct, including allocated\n* memory.\n*\n* Given:\n*   tab       const struct tabprm*\n*                       Tabular transformation parameters.\n*\n*                       If NULL, the base size of the struct and the allocated\n*                       size are both set to zero.\n*\n* Returned:\n*   sizes     int[2]    The first element is the base size of the struct as\n*                       returned by sizeof(struct tabprm).  The second element\n*                       is the total allocated size, in bytes, assuming that\n*                       the allocation was done by tabini().  This figure\n*                       includes memory allocated for the constituent struct,\n*                       tabprm::err.\n*\n*                       It is not an error for the struct not to have been set\n*                       up via tabset(), which normally results in additional\n*                       memory allocation. \n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*\n*\n* tabprt() - Print routine for the tabprm struct\n* ----------------------------------------------\n* tabprt() prints the contents of a tabprm struct using wcsprintf().  Mainly\n* intended for diagnostic purposes.\n*\n* Given:\n*   tab       const struct tabprm*\n*                       Tabular transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null tabprm pointer passed.\n*\n*\n* tabperr() - Print error messages from a tabprm struct\n* -----------------------------------------------------\n* tabperr() prints the error message(s) (if any) stored in a tabprm struct.\n* If there are no errors then nothing is printed.  It uses wcserr_prt(), q.v.\n*\n* Given:\n*   tab       const struct tabprm*\n*                       Tabular transformation parameters.\n*\n*   prefix    const char *\n*                       If non-NULL, each output line will be prefixed with\n*                       this string.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null tabprm pointer passed.\n*\n*\n* tabset() - Setup routine for the tabprm struct\n* -----------------------------------------------\n* tabset() allocates memory for work arrays in the tabprm struct and sets up\n* the struct according to information supplied within it.\n*\n* Note that this routine need not be called directly; it will be invoked by\n* tabx2s() and tabs2x() if tabprm::flag is anything other than a predefined\n* magic value.\n*\n* Given and returned:\n*   tab       struct tabprm*\n*                       Tabular transformation parameters.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null tabprm pointer passed.\n*                         3: Invalid tabular parameters.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       tabprm::err if enabled, see wcserr_enable().\n*\n*\n* tabx2s() - Pixel-to-world transformation\n* ----------------------------------------\n* tabx2s() transforms intermediate world coordinates to world coordinates\n* using coordinate lookup.\n*\n* Given and returned:\n*   tab       struct tabprm*\n*                       Tabular transformation parameters.\n*\n* Given:\n*   ncoord,\n*   nelem     int       The number of coordinates, each of vector length\n*                       nelem.\n*\n*   x         const double[ncoord][nelem]\n*                       Array of intermediate world coordinates, SI units.\n*\n* Returned:\n*   world     double[ncoord][nelem]\n*                       Array of world coordinates, in SI units.\n*\n*   stat      int[ncoord]\n*                       Status return value status for each coordinate:\n*                         0: Success.\n*                         1: Invalid intermediate world coordinate.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null tabprm pointer passed.\n*                         3: Invalid tabular parameters.\n*                         4: One or more of the x coordinates were invalid,\n*                            as indicated by the stat vector.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       tabprm::err if enabled, see wcserr_enable().\n*\n*\n* tabs2x() - World-to-pixel transformation\n* ----------------------------------------\n* tabs2x() transforms world coordinates to intermediate world coordinates.\n*\n* Given and returned:\n*   tab       struct tabprm*\n*                       Tabular transformation parameters.\n*\n* Given:\n*   ncoord,\n*   nelem     int       The number of coordinates, each of vector length\n*                       nelem.\n*   world     const double[ncoord][nelem]\n*                       Array of world coordinates, in SI units.\n*\n* Returned:\n*   x         double[ncoord][nelem]\n*                       Array of intermediate world coordinates, SI units.\n*   stat      int[ncoord]\n*                       Status return value status for each vector element:\n*                         0: Success.\n*                         1: Invalid world coordinate.\n*\n* Function return value:\n*             int       Status return value:\n*                         0: Success.\n*                         1: Null tabprm pointer passed.\n*                         3: Invalid tabular parameters.\n*                         5: One or more of the world coordinates were\n*                            invalid, as indicated by the stat vector.\n*\n*                       For returns > 1, a detailed error message is set in\n*                       tabprm::err if enabled, see wcserr_enable().\n*\n*\n* tabprm struct - Tabular transformation parameters\n* -------------------------------------------------\n* The tabprm struct contains information required to transform tabular\n* coordinates.  It consists of certain members that must be set by the user\n* (\"given\") and others that are set by the WCSLIB routines (\"returned\").  Some\n* of the latter are supplied for informational purposes while others are for\n* internal use only.\n*\n*   int flag\n*     (Given and returned) This flag must be set to zero whenever any of the\n*     following tabprm structure members are set or changed:\n*\n*       - tabprm::M (q.v., not normally set by the user),\n*       - tabprm::K (q.v., not normally set by the user),\n*       - tabprm::map,\n*       - tabprm::crval,\n*       - tabprm::index,\n*       - tabprm::coord.\n*\n*     This signals the initialization routine, tabset(), to recompute the\n*     returned members of the tabprm struct.  tabset() will reset flag to\n*     indicate that this has been done.\n*\n*     PLEASE NOTE: flag should be set to -1 when tabini() is called for the\n*     first time for a particular tabprm struct in order to initialize memory\n*     management.  It must ONLY be used on the first initialization otherwise\n*     memory leaks may result.\n*\n*   int M\n*     (Given or returned) Number of tabular coordinate axes.\n*\n*     If tabini() is used to initialize the tabprm struct (as would normally\n*     be the case) then it will set M from the value passed to it as a\n*     function argument.  The user should not subsequently modify it.\n*\n*   int *K\n*     (Given or returned) Pointer to the first element of a vector of length\n*     tabprm::M whose elements (K_1, K_2,... K_M) record the lengths of the\n*     axes of the coordinate array and of each indexing vector.\n*\n*     If tabini() is used to initialize the tabprm struct (as would normally\n*     be the case) then it will set K from the array passed to it as a\n*     function argument.  The user should not subsequently modify it.\n*\n*   int *map\n*     (Given) Pointer to the first element of a vector of length tabprm::M\n*     that defines the association between axis m in the M-dimensional\n*     coordinate array (1 <= m <= M) and the indices of the intermediate world\n*     coordinate and world coordinate arrays, x[] and world[], in the argument\n*     lists for tabx2s() and tabs2x().\n*\n*     When x[] and world[] contain the full complement of coordinate elements\n*     in image-order, as will usually be the case, then map[m-1] == i-1 for\n*     axis i in the N-dimensional image (1 <= i <= N).  In terms of the FITS\n*     keywords\n*\n*       map[PVi_3a - 1] == i - 1.\n*\n*     However, a different association may result if x[], for example, only\n*     contains a (relevant) subset of intermediate world coordinate elements.\n*     For example, if M == 1 for an image with N > 1, it is possible to fill\n*     x[] with the relevant coordinate element with nelem set to 1.  In this\n*     case map[0] = 0 regardless of the value of i.\n*\n*   double *crval\n*     (Given) Pointer to the first element of a vector of length tabprm::M\n*     whose elements contain the index value for the reference pixel for each\n*     of the tabular coordinate axes.\n*\n*   double **index\n*     (Given) Pointer to the first element of a vector of length tabprm::M of\n*     pointers to vectors of lengths (K_1, K_2,... K_M) of 0-relative indexes\n*     (see tabprm::K).\n*\n*     The address of any or all of these index vectors may be set to zero,\n*     i.e.\n*\n=       index[m] == 0;\n*\n*     this is interpreted as default indexing, i.e.\n*\n=       index[m][k] = k;\n*\n*   double *coord\n*     (Given) Pointer to the first element of the tabular coordinate array,\n*     treated as though it were defined as\n*\n=       double coord[K_M]...[K_2][K_1][M];\n*\n*     (see tabprm::K) i.e. with the M dimension varying fastest so that the\n*     M elements of a coordinate vector are stored contiguously in memory.\n*\n*   int nc\n*     (Returned) Total number of coordinate vectors in the coordinate array\n*     being the product K_1 * K_2 * ... * K_M (see tabprm::K).\n*\n*   int padding\n*     (An unused variable inserted for alignment purposes only.)\n*\n*   int *sense\n*     (Returned) Pointer to the first element of a vector of length tabprm::M\n*     whose elements indicate whether the corresponding indexing vector is\n*     monotonic increasing (+1), or decreasing (-1).\n*\n*   int *p0\n*     (Returned) Pointer to the first element of a vector of length tabprm::M\n*     of interpolated indices into the coordinate array such that Upsilon_m,\n*     as defined in Paper III, is equal to (p0[m] + 1) + tabprm::delta[m].\n*\n*   double *delta\n*     (Returned) Pointer to the first element of a vector of length tabprm::M\n*     of interpolated indices into the coordinate array such that Upsilon_m,\n*     as defined in Paper III, is equal to (tabprm::p0[m] + 1) + delta[m].\n*\n*   double *extrema\n*     (Returned) Pointer to the first element of an array that records the\n*     minimum and maximum value of each element of the coordinate vector in\n*     each row of the coordinate array, treated as though it were defined as\n*\n=       double extrema[K_M]...[K_2][2][M]\n*\n*     (see tabprm::K).  The minimum is recorded in the first element of the\n*     compressed K_1 dimension, then the maximum.  This array is used by the\n*     inverse table lookup function, tabs2x(), to speed up table searches.\n*\n*   struct wcserr *err\n*     (Returned) If enabled, when an error status is returned, this struct\n*     contains detailed information about the error, see wcserr_enable().\n*\n*   int m_flag\n*     (For internal use only.)\n*   int m_M\n*     (For internal use only.)\n*   int m_N\n*     (For internal use only.)\n*   int set_M\n*     (For internal use only.)\n*   int m_K\n*     (For internal use only.)\n*   int m_map\n*     (For internal use only.)\n*   int m_crval\n*     (For internal use only.)\n*   int m_index\n*     (For internal use only.)\n*   int m_indxs\n*     (For internal use only.)\n*   int m_coord\n*     (For internal use only.)\n*\n*\n* Global variable: const char *tab_errmsg[] - Status return messages\n* ------------------------------------------------------------------\n* Error messages to match the status value returned from each function.\n*\n*===========================================================================*/\n\n#ifndef WCSLIB_TAB\n#define WCSLIB_TAB\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\nextern const char *tab_errmsg[];\n\nenum tab_errmsg_enum {\n  TABERR_SUCCESS      = 0,\t// Success.\n  TABERR_NULL_POINTER = 1,\t// Null tabprm pointer passed.\n  TABERR_MEMORY       = 2,\t// Memory allocation failed.\n  TABERR_BAD_PARAMS   = 3,\t// Invalid tabular parameters.\n  TABERR_BAD_X        = 4,\t// One or more of the x coordinates were\n\t\t\t\t// invalid.\n  TABERR_BAD_WORLD    = 5\t// One or more of the world coordinates were\n\t\t\t\t// invalid.\n};\n\nstruct tabprm {\n  // Initialization flag (see the prologue above).\n  //--------------------------------------------------------------------------\n  int    flag;\t\t\t// Set to zero to force initialization.\n\n  // Parameters to be provided (see the prologue above).\n  //--------------------------------------------------------------------------\n  int    M;\t\t\t// Number of tabular coordinate axes.\n  int    *K;\t\t\t// Vector of length M whose elements\n\t\t\t\t// (K_1, K_2,... K_M) record the lengths of\n\t\t\t\t// the axes of the coordinate array and of\n\t\t\t\t// each indexing vector.\n  int    *map;\t\t\t// Vector of length M usually such that\n\t\t\t\t// map[m-1] == i-1 for coordinate array\n\t\t\t\t// axis m and image axis i (see above).\n  double *crval;\t\t// Vector of length M containing the index\n\t\t\t\t// value for the reference pixel for each\n\t\t\t\t// of the tabular coordinate axes.\n  double **index;\t\t// Vector of pointers to M indexing vectors\n\t\t\t\t// of lengths (K_1, K_2,... K_M).\n  double *coord;\t\t// (1+M)-dimensional tabular coordinate\n\t\t\t\t// array (see above).\n\n  // Information derived from the parameters supplied.\n  //--------------------------------------------------------------------------\n  int    nc;\t\t\t// Number of coordinate vectors (of length\n\t\t\t\t// M) in the coordinate array.\n  int    padding;\t\t// (Dummy inserted for alignment purposes.)\n  int    *sense;\t\t// Vector of M flags that indicate whether\n\t\t\t\t// the Mth indexing vector is monotonic\n\t\t\t\t// increasing, or else decreasing.\n  int    *p0;\t\t\t// Vector of M indices.\n  double *delta;\t\t// Vector of M increments.\n  double *extrema;\t\t// (1+M)-dimensional array of coordinate\n\t\t\t\t// extrema.\n\n  // Error handling\n  //--------------------------------------------------------------------------\n  struct wcserr *err;\n\n  // Private - the remainder are for memory management.\n  //--------------------------------------------------------------------------\n  int    m_flag, m_M, m_N;\n  int    set_M;\n  int    *m_K, *m_map;\n  double *m_crval, **m_index, **m_indxs, *m_coord;\n};\n\n// Size of the tabprm struct in int units, used by the Fortran wrappers.\n#define TABLEN (sizeof(struct tabprm)/sizeof(int))\n\n\nint tabini(int alloc, int M, const int K[], struct tabprm *tab);\n\nint tabmem(struct tabprm *tab);\n\nint tabcpy(int alloc, const struct tabprm *tabsrc, struct tabprm *tabdst);\n\nint tabcmp(int cmp, double tol, const struct tabprm *tab1,\n           const struct tabprm *tab2, int *equal);\n\nint tabfree(struct tabprm *tab);\n\nint tabsize(const struct tabprm *tab, int size[2]);\n\nint tabprt(const struct tabprm *tab);\n\nint tabperr(const struct tabprm *tab, const char *prefix);\n\nint tabset(struct tabprm *tab);\n\nint tabx2s(struct tabprm *tab, int ncoord, int nelem, const double x[],\n           double world[], int stat[]);\n\nint tabs2x(struct tabprm *tab, int ncoord, int nelem, const double world[],\n           double x[], int stat[]);\n\n\n// Deprecated.\n#define tabini_errmsg tab_errmsg\n#define tabcpy_errmsg tab_errmsg\n#define tabfree_errmsg tab_errmsg\n#define tabprt_errmsg tab_errmsg\n#define tabset_errmsg tab_errmsg\n#define tabx2s_errmsg tab_errmsg\n#define tabs2x_errmsg tab_errmsg\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // WCSLIB_TAB\n"},{"id":16610,"name":"wcsbth.l","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsbth.l,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* wcsbth.l is a Flex description file containing the definition of a lexical\n* scanner for parsing the WCS keyrecords for one or more image arrays and/or\n* pixel lists in a FITS binary table header.  It can also handle primary image\n* and image extension headers.\n*\n* wcsbth.l requires Flex v2.5.4 or later.  Refer to wcshdr.h for a description\n* of the user interface and operating notes.\n*\n* Implementation notes\n* --------------------\n* wcsbth() may be invoked with an option that causes it to recognize the\n* image-header form of WCS keywords as defaults for each alternate coordinate\n* representation (up to 27).  By design, with this option enabled wcsbth() can\n* also handle primary image and image extension headers, effectively treating\n* them as a single-column binary table though with WCS keywords of a different\n* form.\n*\n* NAXIS is always 2 for binary tables, it refers to the two-dimensional nature\n* of the table.  Thus NAXIS does not count the number of image axes in either\n* image arrays or pixels lists and for the latter there is not even a formal\n* equivalent of WCSAXESa.  Hence NAXIS is always ignored and a first pass\n* through the header is required to determine the number of images, the number\n* of alternate coordinate representations for each image (up to 27), and the\n* number of coordinate axes in each representation; this pass also counts the\n* number of iPVn_ma and iPSn_ma or TVk_ma and TSk_ma keywords in each\n* representation.\n*\n* On completion of the first pass, the association between column number and\n* axis number is defined for each representation of a pixel list.  Memory is\n* allocated for an array of the required number of wcsprm structs and each of\n* these is initialized appropriately.  These structs are filled in the second\n* pass.\n*\n* It is permissible for a scalar table column to contain degenerate (single-\n* point) image arrays and simultaneously form one axis of a pixel list.\n*\n* The parser does not check for duplicated keywords, for most keywords it\n* accepts the last encountered.\n*\n* wcsbth() does not currently handle the Green Bank convention.\n*\n*===========================================================================*/\n\n/* Options. */\n%option full\n%option never-interactive\n%option noinput\n%option noyywrap\n%option outfile=\"wcsbth.c\"\n%option prefix=\"wcsbth\"\n%option reentrant\n%option extra-type=\"struct wcsbth_extra *\"\n\n/* Indices for parameterized keywords. */\nZ1\t[0-9]\nZ2\t[0-9]{2}\nZ3\t[0-9]{3}\nZ4\t[0-9]{4}\n\nI1\t[1-9]\nI2\t[1-9][0-9]\nI3\t[1-9][0-9]{2}\nI4\t[1-9][0-9]{3}\n\n/* Alternate coordinate system identifier. */\nALT\t[ A-Z]\n\n/* Keyvalue data types. */\nINTEGER\t[+-]?[0-9]+\nFLOAT\t[+-]?([0-9]+\\.?[0-9]*|\\.[0-9]+)([eEdD][+-]?[0-9]+)?\nSTRING\t'([^']|'')*'\n\n/* Inline comment syntax. */\nINLINE \" \"*(\\/.*)?\n\n/* Exclusive start states. */\n%x CCCCCia   iCCCna iCCCCn    TCCCna TCCCCn\n%x CCi_ja    ijCCna           TCn_ka TCCn_ka\n%x CROTAi           iCROTn           TCROTn\n%x CCi_ma    iCn_ma iCCn_ma   TCn_ma TCCn_ma\n%x PROJPm\n%x CCCCCCCC CCCCCCCa\n%x CCCCna   CCCCCna\n%x CCCCn    CCCCCn\n%x VALUE INTEGER_VAL FLOAT_VAL FLOAT2_VAL STRING_VAL\n%x COMMENT DISCARD ERROR FLUSH\n\n%{\n#include <math.h>\n#include <setjmp.h>\n#include <stddef.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"wcs.h\"\n#include \"wcshdr.h\"\n#include \"wcsmath.h\"\n#include \"wcsprintf.h\"\n#include \"wcsutil.h\"\n\n\t\t\t// Codes used for keyvalue data types.\n#define INTEGER 0\n#define FLOAT   1\n#define FLOAT2  2\n#define STRING  3\n\n\t\t\t// Bit masks used for keyword types:\n#define IMGAUX  0x1\t// Auxiliary image header, e.g. LONPOLEa or\n\t\t\t// DATE-OBS.\n#define IMGAXIS 0x2\t// Image header with axis number, e.g.\n\t\t\t// CTYPEia.\n#define IMGHEAD 0x3\t// IMGAUX | IMGAXIS, i.e. image header of\n\t\t\t// either type.\n#define BIMGARR 0x4\t// Binary table image array, e.g. iCTYna.\n#define PIXLIST 0x8\t// Pixel list, e.g. TCTYna.\n#define BINTAB  0xC\t// BIMGARR | PIXLIST, i.e. binary table\n\t\t\t// image array (without axis number) or\n\t\t\t// pixel list, e.g. LONPna or OBSGXn.\n\n// User data associated with yyscanner.\nstruct wcsbth_extra {\n  // Values passed to YY_INPUT.\n  char *hdr;\n  int  nkeyrec;\n\n  // Used in preempting the call to exit() by yy_fatal_error().\n  jmp_buf abort_jmp_env;\n};\n\n#define YY_DECL int wcsbth_scanner(char *header, int nkeyrec, int relax, \\\n int ctrl, int keysel, int *colsel, int *nreject, int *nwcs, \\\n struct wcsprm **wcs, yyscan_t yyscanner)\n\n#define YY_INPUT(inbuff, count, bufsize) \\\n\t{ \\\n\t  if (yyextra->nkeyrec) { \\\n\t    strncpy(inbuff, yyextra->hdr, 80); \\\n\t    inbuff[80] = '\\n'; \\\n\t    yyextra->hdr += 80; \\\n\t    yyextra->nkeyrec--; \\\n\t    count = 81; \\\n\t  } else { \\\n\t    count = YY_NULL; \\\n\t  } \\\n\t}\n\n// Preempt the call to exit() by yy_fatal_error().\n#define exit(status) longjmp(yyextra->abort_jmp_env, status);\n\n// A convenience macro to get around incompatibilities between unput() and\n// yyless(): put yytext followed by a blank back onto the input stream.\n#define WCSBTH_PUTBACK \\\n  sprintf(strtmp, \"%s \", yytext); \\\n  size_t iz = strlen(strtmp); \\\n  while (iz) unput(strtmp[--iz]);\n\n// Struct used internally for header bookkeeping.\nstruct wcsbth_alts {\n  int ncol, ialt, icol, imgherit;\n  short int (*arridx)[27];\n  short int pixidx[27];\n  short int pad1;\n  unsigned int *pixlist;\n\n  unsigned char (*npv)[27];\n  unsigned char (*nps)[27];\n  unsigned char pixnpv[27];\n  unsigned char pixnps[27];\n  unsigned char pad2[2];\n};\n\n// Internal helper functions.\nstatic YY_DECL;\nstatic int wcsbth_colax(struct wcsprm *wcs, struct wcsbth_alts *alts, int k,\n        char a);\nstatic int wcsbth_final(struct wcsbth_alts *alts, int *nwcs,\n        struct wcsprm **wcs);\nstatic struct wcsprm *wcsbth_idx(struct wcsprm *wcs, struct wcsbth_alts *alts,\n        int keytype, int n, char a);\nstatic int wcsbth_init1(struct wcsbth_alts *alts, int auxprm, int *nwcs,\n        struct wcsprm **wcs);\nstatic int wcsbth_pass1(int keytype, int i, int j, int n, int k, char a,\n        char ptype, struct wcsbth_alts *alts);\n\n// Helper functions for keywords that require special handling.\nstatic int wcsbth_jdref(double *wptr,   const double *jdref);\nstatic int wcsbth_jdrefi(double *wptr,  const double *jdrefi);\nstatic int wcsbth_jdreff(double *wptr,  const double *jdreff);\nstatic int wcsbth_epoch(double *wptr,   const double *epoch);\nstatic int wcsbth_vsource(double *wptr, const double *vsource);\n\n// Helper functions for keyvalue validity checking.\nstatic int wcsbth_timepixr(double timepixr);\n\n%}\n\n%%\n\tchar *errmsg, errtxt[80], *keyname, strtmp[80];\n\tint    inttmp;\n\tdouble dbltmp, dbl2tmp[2];\n\tstruct auxprm auxtem;\n\tstruct wcsprm wcstem;\n\t\n\t// Initialize returned values.\n\t*nreject = 0;\n\t*nwcs = 0;\n\t*wcs  = 0x0;\n\t\n\t// Our handle on the input stream.\n\tchar *keyrec = header;\n\tchar *hptr = header;\n\tchar *keep = 0x0;\n\t\n\t// For keeping tallies of keywords found.\n\tint nvalid = 0;\n\tint nother = 0;\n\t\n\t// Used to flag image header keywords that are always inherited.\n\tint imherit = 1;\n\t\n\t// If strict, then also reject.\n\tif (relax & WCSHDR_strict) relax |= WCSHDR_reject;\n\t\n\t// Keyword indices, as used in the WCS papers, e.g. iVn_ma, TPn_ka.\n\tint i = 0;\n\tint j = 0;\n\tint k = 0;\n\tint n = 0;\n\tint m = 0;\n\tchar a = ' ';\n\t\n\t// Header bookkeeping.\n\tstruct wcsbth_alts alts;\n\talts.ncol = 0;\n\talts.arridx  = 0x0;\n\talts.pixlist = 0x0;\n\talts.npv = 0x0;\n\talts.nps = 0x0;\n\t\n\tfor (int ialt = 0; ialt < 27; ialt++) {\n\t  alts.pixidx[ialt] = 0;\n\t  alts.pixnpv[ialt] = 0;\n\t  alts.pixnps[ialt] = 0;\n\t}\n\t\n\t// For decoding the keyvalue.\n\tint keytype =  0;\n\tint valtype = -1;\n\tvoid *vptr  = 0x0;\n\t\n\t// For keywords that require special handling.\n\tint altlin = 0;\n\tchar ptype = ' ';\n\tint (*chekval)(double) = 0x0;\n\tint (*special)(double *, const double *) = 0x0;\n\tstruct auxprm *auxp = 0x0;\n\tint auxprm = 0;\n\tint naux   = 0;\n\t\n\t// Selection by column number.\n\tint nsel = colsel ? colsel[0] : 0;\n\tint incl = (nsel > 0);\n\tchar exclude[1000];\n\tfor (int icol = 0; icol < 1000; icol++) {\n\t  exclude[icol] = incl;\n\t}\n\tfor (int icol = 1; icol <= abs(nsel); icol++) {\n\t  int itmp = colsel[icol];\n\t  if (0 < itmp && itmp < 1000) {\n\t    exclude[itmp] = !incl;\n\t  }\n\t}\n\texclude[0] = 0;\n\t\n\t// Selection by keyword type.\n\tif (keysel) {\n\t  int itmp = keysel;\n\t  keysel = 0;\n\t  if (itmp & WCSHDR_IMGHEAD) keysel |= IMGHEAD;\n\t  if (itmp & WCSHDR_BIMGARR) keysel |= BIMGARR;\n\t  if (itmp & WCSHDR_PIXLIST) keysel |= PIXLIST;\n\t}\n\tif (keysel == 0) {\n\t  keysel = IMGHEAD | BINTAB;\n\t}\n\t\n\t// Control variables.\n\tint ipass = 1;\n\tint npass = 2;\n\t\n\t// User data associated with yyscanner.\n\tyyextra->hdr = header;\n\tyyextra->nkeyrec = nkeyrec;\n\t\n\t// Return here via longjmp() invoked by yy_fatal_error().\n\tif (setjmp(yyextra->abort_jmp_env)) {\n\t  return WCSHDRERR_PARSER;\n\t}\n\t\n\tBEGIN(INITIAL);\n\n\n^TFIELDS\" = \"\" \"*{INTEGER} {\n\t  if (ipass == 1) {\n\t    if (alts.ncol == 0) {\n\t      sscanf(yytext, \"TFIELDS = %d\", &(alts.ncol));\n\t      BEGIN(FLUSH);\n\t    } else {\n\t      errmsg = \"duplicate or out-of-sequence TFIELDS keyword\";\n\t      BEGIN(ERROR);\n\t    }\n\t\n\t  } else {\n\t    BEGIN(FLUSH);\n\t  }\n\t}\n\n^WCSAXES{ALT}=\" \"\" \"*{INTEGER} {\n\t  if (!(keysel & IMGAXIS)) {\n\t    // Ignore this key type.\n\t    BEGIN(DISCARD);\n\t\n\t  } else {\n\t    if (relax & WCSHDR_ALLIMG) {\n\t      sscanf(yytext, \"WCSAXES%c= %d\", &a, &i);\n\t\n\t      if (i < 0) {\n\t        errmsg = \"negative value of WCSAXESa ignored\";\n\t        BEGIN(ERROR);\n\t\n\t      } else {\n\t        valtype = INTEGER;\n\t        vptr    = 0x0;\n\t\n\t        keyname = \"WCSAXESa\";\n\t        keytype = IMGAXIS;\n\t        BEGIN(COMMENT);\n\t      }\n\t\n\t    } else if (relax & WCSHDR_reject) {\n\t      errmsg = \"image-header keyword WCSAXESa in binary table\";\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      // Pretend we don't recognize it.\n\t      BEGIN(DISCARD);\n\t    }\n\t  }\n\t}\n\n^WCAX{I1}{ALT}\"  = \"\" \"*{INTEGER} |\n^WCAX{I2}{ALT}\" = \"\" \"*{INTEGER}  |\n^WCAX{I3}{ALT}\"= \"\" \"*{INTEGER} {\n\t  keyname = \"WCAXna\";\n\t\n\t  // Note that a blank in the sscanf() format string matches zero or\n\t  // more of them in the input.\n\t  sscanf(yytext, \"WCAX%d%c = %d\", &n, &a, &i);\n\t\n\t  if (!(keysel & BIMGARR) || exclude[n]) {\n\t    // Ignore this key type or column.\n\t    BEGIN(DISCARD);\n\t\n\t  } else if (i < 0) {\n\t    errmsg = \"negative value of WCSAXESa ignored\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    valtype = INTEGER;\n\t    vptr    = 0x0;\n\t\n\t    keyname = \"WCAXna\";\n\t    keytype = IMGAXIS;\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\n^WCST{I1}{ALT}\"  = \"\" \"*{STRING} |\n^WCST{I2}{ALT}\" = \"\" \"*{STRING} |\n^WCST{I3}{ALT}\"= \"\" \"*{STRING} {\n\t  // Cross-reference supplier.\n\t  keyname = \"WCSTna\";\n\t  errmsg = \"cross-references are not implemented\";\n\t  BEGIN(ERROR);\n\t}\n\n^WCSX{I1}{ALT}\"  = \"\" \"*{STRING} |\n^WCSX{I2}{ALT}\" = \"\" \"*{STRING} |\n^WCSX{I3}{ALT}\"= \"\" \"*{STRING} {\n\t  // Cross-reference consumer.\n\t  keyname = \"WCSXna\";\n\t  errmsg = \"cross-references are not implemented\";\n\t  BEGIN(ERROR);\n\t}\n\n^CRPIX\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crpix);\n\t\n\t  keyname = \"CRPIXja\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^{I1}CRP  |\n^{I1}CRPX {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crpix);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"jCRPna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    keyname = \"jCRPXn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\n^TCRP\t|\n^TCRPX\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crpix);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCRPna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    keyname = \"TCRPXn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\n^PC\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pc);\n\t  altlin = 1;\n\t\n\t  keyname = \"PCi_ja\";\n\t  BEGIN(CCi_ja);\n\t}\n\n^{I2}PC\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pc);\n\t  altlin  = 1;\n\t\n\t  sscanf(yytext, \"%1d%1d\", &i, &j);\n\t\n\t  keyname = \"ijPCna\";\n\t  BEGIN(ijCCna);\n\t}\n\n^TP\t|\n^TPC\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pc);\n\t  altlin  = 1;\n\t\n\t  if (yyleng == 2) {\n\t    keyname = \"TPn_ka\";\n\t    BEGIN(TCn_ka);\n\t  } else {\n\t    keyname = \"TPCn_ka\";\n\t    BEGIN(TCCn_ka);\n\t  }\n\t}\n\n^CD\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cd);\n\t  altlin  = 2;\n\t\n\t  keyname = \"CDi_ja\";\n\t  BEGIN(CCi_ja);\n\t}\n\n^{I2}CD\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cd);\n\t  altlin  = 2;\n\t\n\t  sscanf(yytext, \"%1d%1d\", &i, &j);\n\t\n\t  keyname = \"ijCDna\";\n\t  BEGIN(ijCCna);\n\t}\n\n^TC\t|\n^TCD\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cd);\n\t  altlin  = 2;\n\t\n\t  if (yyleng == 2) {\n\t    keyname = \"TCn_ka\";\n\t    BEGIN(TCn_ka);\n\t  } else {\n\t    keyname = \"TCDn_ka\";\n\t    BEGIN(TCCn_ka);\n\t  }\n\t}\n\n^CDELT\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cdelt);\n\t\n\t  keyname = \"CDELTia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^{I1}CDE  |\n^{I1}CDLT {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cdelt);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCDEna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    keyname = \"iCDLTn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\n^TCDE\t|\n^TCDLT\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cdelt);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCDEna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    keyname = \"TCDLTn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\n^CROTA\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crota);\n\t  altlin  = 4;\n\t\n\t  keyname = \"CROTAi\";\n\t  BEGIN(CROTAi);\n\t}\n\n^{I1}CROT {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crota);\n\t  altlin  = 4;\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  keyname = \"iCROTn\";\n\t  BEGIN(iCROTn);\n\t}\n\n^TCROT\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crota);\n\t  altlin  = 4;\n\t\n\t  keyname = \"TCROTn\";\n\t  BEGIN(TCROTn);\n\t}\n\n^CUNIT\t{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cunit);\n\t\n\t  keyname = \"CUNITia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^{I1}CUN  |\n^{I1}CUNI {\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cunit);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCUNna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    keyname = \"iCUNIn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\n^TCUN\t|\n^TCUNI\t{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cunit);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCUNna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    keyname = \"TCUNIn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\n^CTYPE\t{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ctype);\n\t\n\t  keyname = \"CTYPEia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^{I1}CTY  |\n^{I1}CTYP {\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ctype);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCTYna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    keyname = \"iCTYPn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\n^TCTY\t|\n^TCTYP\t{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ctype);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCTYna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    keyname = \"TCTYPn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\n^CRVAL\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crval);\n\t\n\t  keyname = \"CRVALia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^{I1}CRV  |\n^{I1}CRVL {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crval);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCRVna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    keyname = \"iCRVLn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\n^TCRV\t|\n^TCRVL\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crval);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCRVna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    keyname = \"TCRVLn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\n^LONPOLE |\n^LONP\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.lonpole);\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"LONPOLEa\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"LONPna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\n^LATPOLE |\n^LATP\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.latpole);\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"LATPOLEa\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"LATPna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\n^RESTFREQ |\n^RESTFRQ  |\n^RFRQ\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.restfrq);\n\t\n\t  if (yyleng == 8) {\n\t    if (relax & WCSHDR_strict) {\n\t      errmsg = \"the RESTFREQ keyword is deprecated, use RESTFRQa\";\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      unput(' ');\n\t\n\t      keyname = \"RESTFREQ\";\n\t      BEGIN(CCCCCCCa);\n\t    }\n\t\n\t  } else if (yyleng == 7) {\n\t    keyname = \"RESTFRQa\";\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else {\n\t    keyname = \"RFRQna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\n^RESTWAV |\n^RWAV\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.restwav);\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"RESTWAVa\";\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"RWAVna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\n^PV\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pv);\n\t  ptype   = 'v';\n\t\n\t  keyname = \"PVi_ma\";\n\t  BEGIN(CCi_ma);\n\t}\n\n^{I1}V\t|\n^{I1}PV\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pv);\n\t  ptype   = 'v';\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 2) {\n\t    keyname = \"iVn_ma\";\n\t    BEGIN(iCn_ma);\n\t  } else {\n\t    keyname = \"iPVn_ma\";\n\t    BEGIN(iCCn_ma);\n\t  }\n\t}\n\n^TV\t|\n^TPV\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pv);\n\t  ptype   = 'v';\n\t\n\t  if (yyleng == 2) {\n\t    keyname = \"TVn_ma\";\n\t    BEGIN(TCn_ma);\n\t  } else {\n\t    keyname = \"TPVn_ma\";\n\t    BEGIN(TCCn_ma);\n\t  }\n\t}\n\n^PROJP\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pv);\n\t  ptype   = 'v';\n\t\n\t  keyname = \"PROJPm\";\n\t  BEGIN(PROJPm);\n\t}\n\n^PS\t{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ps);\n\t  ptype   = 's';\n\t\n\t  keyname = \"PSi_ma\";\n\t  BEGIN(CCi_ma);\n\t}\n\n^{I1}S\t|\n^{I1}PS\t{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ps);\n\t  ptype   = 's';\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 2) {\n\t    keyname = \"iSn_ma\";\n\t    BEGIN(iCn_ma);\n\t  } else {\n\t    keyname = \"iPSn_ma\";\n\t    BEGIN(iCCn_ma);\n\t  }\n\t}\n\n^TS\t|\n^TPS\t{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ps);\n\t  ptype   = 's';\n\t\n\t  if (yyleng == 2) {\n\t    keyname = \"TSn_ma\";\n\t    BEGIN(TCn_ma);\n\t  } else {\n\t    keyname = \"TPSn_ma\";\n\t    BEGIN(TCCn_ma);\n\t  }\n\t}\n\n^VELREF{ALT}\" \" {\n\t  sscanf(yytext, \"VELREF%c\", &a);\n\t\n\t  if (relax & WCSHDR_strict) {\n\t    errmsg = \"the VELREF keyword is deprecated, use SPECSYSa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else if (a == ' ' || (relax & WCSHDR_VELREFa)) {\n\t    valtype = INTEGER;\n\t    vptr    = &(wcstem.velref);\n\t\n\t    unput(a);\n\t\n\t    keyname = \"VELREF\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"VELREF keyword may not have an alternate version code\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^CNAME\t{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cname);\n\t\n\t  keyname = \"CNAMEia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^{I1}CNA  |\n^{I1}CNAM {\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cname);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCNAna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"iCNAMn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\n^TCNA\t|\n^TCNAM\t{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cname);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCNAna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"TCNAMn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\n^CRDER\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crder);\n\t\n\t  keyname = \"CRDERia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^{I1}CRD |\n^{I1}CRDE {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crder);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCRDna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"iCRDEn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\n^TCRD\t|\n^TCRDE\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crder);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCRDna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"TCRDEn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\n^CSYER\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.csyer);\n\t\n\t  keyname = \"CSYERia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^{I1}CSY  |\n^{I1}CSYE {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.csyer);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCSYna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"iCSYEn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\n^TCSY\t|\n^TCSYE\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.csyer);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCSYna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"TCSYEn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\n^CZPHS\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.czphs);\n\t\n\t  keyname = \"CZPHSia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^{I1}CZP  |\n^{I1}CZPH {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.czphs);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCZPna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"iCZPHn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\n^TCZP\t|\n^TCZPH\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.czphs);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCZPna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"TCZPHn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\n^CPERI\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cperi);\n\t\n\t  keyname = \"CPERIia\";\n\t  BEGIN(CCCCCia);\n\t}\n\n^{I1}CPR  |\n^{I1}CPER {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cperi);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCPRna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"iCPERn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\n^TCPR\t|\n^TCPER\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cperi);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCPRna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"TCPERn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\n^WCSNAME |\n^WCSN\t |\n^TWCS\t{\n\t  valtype = STRING;\n\t  vptr    = wcstem.wcsname;\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"WCSNAMEa\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else {\n\t    if (*yytext == 'W') {\n\t      keyname = \"WCSNna\";\n\t    } else {\n\t      keyname = \"TWCSna\";\n\t    }\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\n^TIMESYS\" \" {\n\t  valtype = STRING;\n\t  vptr    = wcstem.timesys;\n\t\n\t  keyname = \"TIMESYS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TREFPOS\" \" |\n^TRPOS  {\n\t  valtype = STRING;\n\t  vptr    = wcstem.trefpos;\n\t\n\t  if (yyleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"TREFPOS\";\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"TRPOSn\";\n\t    BEGIN(CCCCCn);\n\t  }\n\t}\n\n^TREFDIR\" \" |\n^TRDIR  {\n\t  valtype = STRING;\n\t  vptr    = wcstem.trefdir;\n\t\n\t  if (yyleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"TREFDIR\";\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"TRDIRn\";\n\t    BEGIN(CCCCCn);\n\t  }\n\t}\n\n^PLEPHEM\" \" {\n\t  valtype = STRING;\n\t  vptr    = wcstem.plephem;\n\t\n\t  keyname = \"PLEPHEM\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TIMEUNIT {\n\t  valtype = STRING;\n\t  vptr    = wcstem.timeunit;\n\t\n\t  keyname = \"TIMEUNIT\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^DATEREF\" \" |\n^DATE-REF {\n\t  if ((yytext[4] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = STRING;\n\t    vptr    = wcstem.dateref;\n\t\n\t    keyname = \"DATEREF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the DATE-REF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^MJDREF\"  \" |\n^MJD-REF\" \" {\n\t  if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = FLOAT2;\n\t    vptr    = wcstem.mjdref;\n\t\n\t    keyname = \"MJDREF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the MJD-REF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^MJDREFI\" \" |\n^MJD-REFI {\n\t  if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    // Actually integer, but treated as float.\n\t    valtype = FLOAT;\n\t    vptr    = wcstem.mjdref;\n\t\n\t    keyname = \"MJDREFI\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the MJD-REFI keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^MJDREFF\" \" |\n^MJD-REFF {\n\t  if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = FLOAT;\n\t    vptr    = wcstem.mjdref + 1;\n\t\n\t    keyname = \"MJDREFF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the MJD-REFF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^JDREF\"   \" |\n^JD-REF\"  \" {\n\t  if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = FLOAT2;\n\t    vptr    = wcstem.mjdref;\n\t    special = wcsbth_jdref;\n\t\n\t    keyname = \"JDREF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the JD-REF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^JDREFI\"  \" |\n^JD-REFI {\n\t  if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    // Actually integer, but treated as float.\n\t    valtype = FLOAT;\n\t    vptr    = wcstem.mjdref;\n\t    special = wcsbth_jdrefi;\n\t\n\t    keyname = \"JDREFI\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the JD-REFI keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^JDREFF\"  \" |\n^JD-REFF {\n\t  if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = FLOAT;\n\t    vptr    = wcstem.mjdref;\n\t    special = wcsbth_jdreff;\n\t\n\t    keyname = \"JDREFF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the JD-REFF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^TIMEOFFS {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timeoffs);\n\t\n\t  keyname = \"TIMEOFFS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^DATE-OBS {\n\t  valtype = STRING;\n\t  vptr    = wcstem.dateobs;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"DATE-OBS\";\n\t  imherit = 0;\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^DOBS{I1}\"   \" |\n^DOBS{I2}\"  \"  |\n^DOBS{I3}\" \" {\n\t  valtype = STRING;\n\t  vptr    = wcstem.dateobs;\n\t\n\t  if (relax & WCSHDR_DOBSn) {\n\t    yyless(4);\n\t\n\t    keyname = \"DOBSn\";\n\t    BEGIN(CCCCn);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"DOBSn keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^DATE-BEG {\n\t  valtype = STRING;\n\t  vptr    = wcstem.datebeg;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"DATE-BEG\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^DATE-AVG |\n^DAVG   {\n\t  valtype = STRING;\n\t  vptr    = wcstem.dateavg;\n\t\n\t  if (yyleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"DATE-AVG\";\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"DAVGn\";\n\t    BEGIN(CCCCn);\n\t  }\n\t}\n\n^DATE-END {\n\t  valtype = STRING;\n\t  vptr    = wcstem.dateend;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"DATE-END\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^MJD-OBS\" \" |\n^MJDOB\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdobs);\n\t\n\t  if (yyleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"MJD-OBS\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"MJDOBn\";\n\t    BEGIN(CCCCCn);\n\t  }\n\t}\n\n^MJD-BEG\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdbeg);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"MJD-BEG\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^MJD-AVG\" \" |\n^MJDA\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdavg);\n\t\n\t  if (yyleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"MJD-AVG\";\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"MJDAn\";\n\t    BEGIN(CCCCn);\n\t  }\n\t}\n\n^MJD-END\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdend);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"MJD-END\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^JEPOCH\"  \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.jepoch);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"JEPOCH\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^BEPOCH\"  \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.bepoch);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"BEPOCH\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TSTART\"  \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.tstart);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TSTART\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TSTOP\"   \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.tstop);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TSTOP\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^XPOSURE\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.xposure);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"XPOSURE\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TELAPSE\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.telapse);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TELAPSE\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TIMSYER\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timsyer);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TIMSYER\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TIMRDER\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timrder);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TIMRDER\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TIMEDEL\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timedel);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TIMEDEL\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^TIMEPIXR {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timepixr);\n\t  chekval = wcsbth_timepixr;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TIMEPIXR\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^OBSGEO-X |\n^OBSGX\t{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo;\n\t\n\t  if (yyleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"OBSGEO-X\";\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"OBSGXn\";\n\t    BEGIN(CCCCCn);\n\t  }\n\t}\n\n^OBSGEO-Y |\n^OBSGY\t{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 1;\n\t\n\t  if (yyleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"OBSGEO-Y\";\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"OBSGYn\";\n\t    BEGIN(CCCCCn);\n\t  }\n\t}\n\n^OBSGEO-Z |\n^OBSGZ\t{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 2;\n\t\n\t  if (yyleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"OBSGEO-Z\";\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"OBSGZn\";\n\t    BEGIN(CCCCCn);\n\t  }\n\t}\n\n^OBSGEO-L {\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 3;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-L\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^OBSGL{I1}\"  \" |\n^OBSGL{I2}\" \"  |\n^OBSGL{I3} {\n\t  valtype = STRING;\n\t  vptr    = wcstem.obsgeo + 3;\n\t\n\t  if (relax & WCSHDR_OBSGLBHn) {\n\t    yyless(5);\n\t\n\t    keyname = \"OBSGLn\";\n\t    BEGIN(CCCCCn);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"OBSGLn keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^OBSGEO-B {\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 4;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-B\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^OBSGB{I1}\"  \" |\n^OBSGB{I2}\" \"  |\n^OBSGB{I3} {\n\t  valtype = STRING;\n\t  vptr    = wcstem.obsgeo + 3;\n\t\n\t  if (relax & WCSHDR_OBSGLBHn) {\n\t    yyless(5);\n\t\n\t    keyname = \"OBSGBn\";\n\t    BEGIN(CCCCCn);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"OBSGBn keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^OBSGEO-H {\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 5;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-H\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^OBSGH{I1}\"  \" |\n^OBSGH{I2}\" \"  |\n^OBSGH{I3} {\n\t  valtype = STRING;\n\t  vptr    = wcstem.obsgeo + 3;\n\t\n\t  if (relax & WCSHDR_OBSGLBHn) {\n\t    yyless(5);\n\t\n\t    keyname = \"OBSGHn\";\n\t    BEGIN(CCCCCn);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"OBSGHn keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^OBSORBIT {\n\t  valtype = STRING;\n\t  vptr    = wcstem.obsorbit;\n\t\n\t  keyname = \"OBSORBIT\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^RADESYS |\n^RADE\t{\n\t  valtype = STRING;\n\t  vptr    = wcstem.radesys;\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"RADESYSa\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"RADEna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\n^RADECSYS {\n\t  if (relax & WCSHDR_RADECSYS) {\n\t    valtype = STRING;\n\t    vptr    = wcstem.radesys;\n\t\n\t    unput(' ');\n\t\n\t    keyname = \"RADECSYS\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the RADECSYS keyword is deprecated, use RADESYSa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^EPOCH{ALT}\"  \" {\n\t  sscanf(yytext, \"EPOCH%c\", &a);\n\t\n\t  if (relax & WCSHDR_strict) {\n\t    errmsg = \"the EPOCH keyword is deprecated, use EQUINOXa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else if (a == ' ' || (relax & WCSHDR_EPOCHa)) {\n\t    valtype = FLOAT;\n\t    vptr    = &(wcstem.equinox);\n\t    special = wcsbth_epoch;\n\t\n\t    unput(a);\n\t\n\t    keyname = \"EPOCH\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"EPOCH keyword may not have an alternate version code\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^EQUINOX |\n^EQUI\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.equinox);\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"EQUINOXa\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"EQUIna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\n^SPECSYS |\n^SPEC\t{\n\t  valtype = STRING;\n\t  vptr    = wcstem.specsys;\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"SPECSYSa\";\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"SPECna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\n^SSYSOBS |\n^SOBS\t{\n\t  valtype = STRING;\n\t  vptr    = wcstem.ssysobs;\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"SSYSOBSa\";\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"SOBSna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\n^VELOSYS |\n^VSYS\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.velosys);\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"VELOSYSa\";\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"VSYSna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\n^VSOURCE{ALT} {\n\t  if (relax & WCSHDR_VSOURCE) {\n\t    valtype = FLOAT;\n\t    vptr    = &(wcstem.zsource);\n\t    special = wcsbth_vsource;\n\t\n\t    yyless(7);\n\t\n\t    keyname = \"VSOURCEa\";\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the VSOURCEa keyword is deprecated, use ZSOURCEa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^VSOU{I1}{ALT}\"  \" |\n^VSOU{I2}{ALT}\" \"  |\n^VSOU{I3}{ALT} {\n\t  if (relax & WCSHDR_VSOURCE) {\n\t    valtype = FLOAT;\n\t    vptr    = &(wcstem.zsource);\n\t    special = wcsbth_vsource;\n\t\n\t    yyless(4);\n\t    keyname = \"VSOUna\";\n\t    BEGIN(CCCCna);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"VSOUna keyword is deprecated, use ZSOUna\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^ZSOURCE |\n^ZSOU\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.zsource);\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"ZSOURCEa\";\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"ZSOUna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\n^SSYSSRC |\n^SSRC\t{\n\t  valtype = STRING;\n\t  vptr    = wcstem.ssyssrc;\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"SSYSSRCa\";\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"SSRCna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\n^VELANGL |\n^VANG\t{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.velangl);\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"VELANGLa\";\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"VANGna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\n^RSUN_REF {\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.rsun_ref);\n\t\n\t  keyname = \"RSUN_REF\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^DSUN_OBS {\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.dsun_obs);\n\t\n\t  keyname = \"DSUN_OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^CRLN_OBS {\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.crln_obs);\n\t\n\t  keyname = \"CRLN_OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^HGLN_OBS {\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.hgln_obs);\n\t\n\t  keyname = \"HGLN_OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^CRLT_OBS |\n^HGLT_OBS {\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.hglt_obs);\n\t\n\t  keyname = \"HGLT_OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^END\" \"{77} {\n\t  if (yyextra->nkeyrec) {\n\t    yyextra->nkeyrec = 0;\n\t    errmsg = \"keyrecords following the END keyrecord were ignored\";\n\t    BEGIN(ERROR);\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n^.\t{\n\t  BEGIN(DISCARD);\n\t}\n\n<CCCCCia>{I1}{ALT}\" \" |\n<CCCCCia>{I2}{ALT} {\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    sscanf(yytext, \"%d%c\", &i, &a);\n\t    keytype = IMGAXIS;\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCCCCia>0{I1}{ALT} |\n<CCCCCia>00{I1} {\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    if (relax & WCSHDR_reject) {\n\t      // Violates the basic FITS standard.\n\t      errmsg = \"indices in parameterized keywords must not have \"\n\t               \"leading zeroes\";\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      // Pretend we don't recognize it.\n\t      BEGIN(DISCARD);\n\t    }\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"invalid image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCCCCia>0{ALT}\" \" |\n<CCCCCia>00{ALT} |\n<CCCCCia>{Z3} {\n\t  // Anything that has fallen through to this point must contain\n\t  // an invalid axis number.\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    errmsg = \"axis number must exceed 0\";\n\t    BEGIN(ERROR);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"invalid image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCCCCia>. {\n\t  if (relax & WCSHDR_reject) {\n\t    // Looks too much like a FITS WCS keyword not to flag it.\n\t    errmsg = errtxt;\n\t    sprintf(errmsg, \"keyword looks very much like %s but isn't\",\n\t      keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<iCCCCn>{I1}\"  \" |\n<iCCCCn>{I2}\" \"  |\n<iCCCCn>{I3}     |\n<TCCCCn>{I1}\"  \" |\n<TCCCCn>{I2}\" \"  |\n<TCCCCn>{I3} {\n\t  if (vptr) {\n\t    WCSBTH_PUTBACK;\n\t    BEGIN((YY_START == iCCCCn) ? iCCCna : TCCCna);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg, \"%s keyword is non-standard\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<iCCCCn>{I1}[A-Z]\" \" |\n<iCCCCn>{I2}[A-Z]    |\n<TCCCCn>{I1}[A-Z]\" \" |\n<TCCCCn>{I2}[A-Z] {\n\t  if (vptr && (relax & WCSHDR_LONGKEY)) {\n\t    WCSBTH_PUTBACK;\n\t    BEGIN((YY_START == iCCCCn) ? iCCCna : TCCCna);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    if (!vptr) {\n\t      sprintf(errmsg, \"%s keyword is non-standard\", keyname);\n\t    } else {\n\t      sprintf(errmsg,\n\t        \"%s keyword may not have an alternate version code\", keyname);\n\t    }\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<iCCCCn>. |\n<TCCCCn>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<iCCCna>{I1}{ALT}\"  \" |\n<iCCCna>{I2}{ALT}\" \"  |\n<iCCCna>{I3}{ALT}     |\n<TCCCna>{I1}{ALT}\"  \" |\n<TCCCna>{I2}{ALT}\" \"  |\n<TCCCna>{I3}{ALT} {\n\t  sscanf(yytext, \"%d%c\", &n, &a);\n\t  if (YY_START == TCCCna) i = wcsbth_colax(*wcs, &alts, n, a);\n\t  keytype = (YY_START == iCCCna) ? BIMGARR : PIXLIST;\n\t  BEGIN(VALUE);\n\t}\n\n<iCCCna>. |\n<TCCCna>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<CCi_ja>{I1}_{I1}{ALT}\"  \" |\n<CCi_ja>{I1}_{I2}{ALT}\" \" |\n<CCi_ja>{I2}_{I1}{ALT}\" \" |\n<CCi_ja>{I2}_{I2}{ALT} {\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    sscanf(yytext, \"%d_%d%c\", &i, &j, &a);\n\t    keytype = IMGAXIS;\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCi_ja>0{I1}_{I1}{ALT}\" \" |\n<CCi_ja>{I1}_0{I1}{ALT}\" \" |\n<CCi_ja>00{I1}_{I1}{ALT} |\n<CCi_ja>0{I1}_0{I1}{ALT} |\n<CCi_ja>{I1}_00{I1}{ALT} |\n<CCi_ja>000{I1}_{I1} |\n<CCi_ja>00{I1}_0{I1} |\n<CCi_ja>0{I1}_00{I1} |\n<CCi_ja>{I1}_000{I1} |\n<CCi_ja>0{I1}_{I2}{ALT} |\n<CCi_ja>{I1}_0{I2}{ALT} |\n<CCi_ja>00{I1}_{I2} |\n<CCi_ja>0{I1}_0{I2} |\n<CCi_ja>{I1}_00{I2} |\n<CCi_ja>0{I2}_{I1}{ALT} |\n<CCi_ja>{I2}_0{I1}{ALT} |\n<CCi_ja>00{I2}_{I1} |\n<CCi_ja>0{I2}_0{I1} |\n<CCi_ja>{I2}_00{I1} |\n<CCi_ja>0{I2}_{I2} |\n<CCi_ja>{I2}_0{I2} {\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    if (((altlin == 1) && (relax & WCSHDR_PC0i_0ja)) ||\n\t        ((altlin == 2) && (relax & WCSHDR_CD0i_0ja))) {\n\t      sscanf(yytext, \"%d_%d%c\", &i, &j, &a);\n\t      keytype = IMGAXIS;\n\t      BEGIN(VALUE);\n\t\n\t    } else if (relax & WCSHDR_reject) {\n\t      errmsg = \"indices in parameterized keywords must not have \"\n\t             \"leading zeroes\";\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      // Pretend we don't recognize it.\n\t      BEGIN(DISCARD);\n\t    }\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"invalid image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCi_ja>{Z1}_{Z1}{ALT}\"  \" |\n<CCi_ja>{Z2}_{Z1}{ALT}\" \" |\n<CCi_ja>{Z1}_{Z2}{ALT}\" \" |\n<CCi_ja>{Z3}_{Z1}{ALT} |\n<CCi_ja>{Z2}_{Z2}{ALT} |\n<CCi_ja>{Z1}_{Z3}{ALT} |\n<CCi_ja>{Z4}_{Z1} |\n<CCi_ja>{Z3}_{Z2} |\n<CCi_ja>{Z2}_{Z3} |\n<CCi_ja>{Z1}_{Z4} {\n\t  // Anything that has fallen through to this point must contain\n\t  // an invalid axis number.\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    errmsg = \"axis number must exceed 0\";\n\t    BEGIN(ERROR);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"invalid image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCi_ja>{Z1}-{Z1}{ALT}\"  \" |\n<CCi_ja>{Z2}-{Z1}{ALT}\" \" |\n<CCi_ja>{Z1}-{Z2}{ALT}\" \" |\n<CCi_ja>{Z3}-{Z1}{ALT} |\n<CCi_ja>{Z2}-{Z2}{ALT} |\n<CCi_ja>{Z1}-{Z3}{ALT} |\n<CCi_ja>{Z4}-{Z1} |\n<CCi_ja>{Z3}-{Z2} |\n<CCi_ja>{Z2}-{Z3} |\n<CCi_ja>{Z1}-{Z4} {\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg, \"%s keyword must use an underscore, not a dash\",\n\t      keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"invalid image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCi_ja>{Z1}{6} {\n\t  // This covers the defunct forms CD00i00j and PC00i00j.\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    if (((altlin == 1) && (relax & WCSHDR_PC00i00j)) ||\n\t        ((altlin == 2) && (relax & WCSHDR_CD00i00j))) {\n\t      sscanf(yytext, \"%3d%3d\", &i, &j);\n\t      a = ' ';\n\t      keytype = IMGAXIS;\n\t      BEGIN(VALUE);\n\t\n\t    } else if (relax & WCSHDR_reject) {\n\t      errmsg = errtxt;\n\t      sprintf(errmsg,\n\t        \"this form of the %s keyword is deprecated, use %s\",\n\t        keyname, keyname);\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      // Pretend we don't recognize it.\n\t      BEGIN(DISCARD);\n\t    }\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"deprecated image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCi_ja>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<ijCCna>{I1}{ALT}\"  \" |\n<ijCCna>{I2}{ALT}\" \"  |\n<ijCCna>{I3}{ALT} {\n\t  sscanf(yytext, \"%d%c\", &n, &a);\n\t  keytype = BIMGARR;\n\t  BEGIN(VALUE);\n\t}\n\n<TCCn_ka>{I1}_{I1}{ALT}\" \" |\n<TCCn_ka>{I1}_{I2}{ALT} |\n<TCCn_ka>{I2}_{I1}{ALT} |\n<TCCn_ka>{I1}_{I3} |\n<TCCn_ka>{I2}_{I2} |\n<TCCn_ka>{I3}_{I1} {\n\t  if (relax & WCSHDR_LONGKEY) {\n\t    WCSBTH_PUTBACK;\n\t    BEGIN(TCn_ka);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg, \"%s keyword is non-standard\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<TCCn_ka>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<TCn_ka>{I1}_{I1}{ALT}\"  \" |\n<TCn_ka>{I1}_{I2}{ALT}\" \" |\n<TCn_ka>{I2}_{I1}{ALT}\" \" |\n<TCn_ka>{I1}_{I3}{ALT} |\n<TCn_ka>{I2}_{I2}{ALT} |\n<TCn_ka>{I3}_{I1}{ALT} {\n\t  sscanf(yytext, \"%d_%d%c\", &n, &k, &a);\n\t  i = wcsbth_colax(*wcs, &alts, n, a);\n\t  j = wcsbth_colax(*wcs, &alts, k, a);\n\t  keytype = PIXLIST;\n\t  BEGIN(VALUE);\n\t}\n\n<TCn_ka>{I1}_{I4} |\n<TCn_ka>{I2}_{I3} |\n<TCn_ka>{I3}_{I2} |\n<TCn_ka>{I4}_{I1} {\n\t  sscanf(yytext, \"%d_%d\", &n, &k);\n\t  a = ' ';\n\t  i = wcsbth_colax(*wcs, &alts, n, a);\n\t  j = wcsbth_colax(*wcs, &alts, k, a);\n\t  keytype = PIXLIST;\n\t  BEGIN(VALUE);\n\t}\n\n<TCn_ka>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<CROTAi>{Z1}{ALT}\" \" |\n<CROTAi>{Z2}{ALT} |\n<CROTAi>{Z3} {\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    a = ' ';\n\t    sscanf(yytext, \"%d%c\", &i, &a);\n\t\n\t    if (relax & WCSHDR_strict) {\n\t      errmsg = \"the CROTAn keyword is deprecated, use PCi_ja\";\n\t      BEGIN(ERROR);\n\t\n\t    } else if (a == ' ' || relax & WCSHDR_CROTAia) {\n\t      yyless(0);\n\t      BEGIN(CCCCCia);\n\t\n\t    } else if (relax & WCSHDR_reject) {\n\t      errmsg = \"CROTAn keyword may not have an alternate version code\";\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      // Pretend we don't recognize it.\n\t      BEGIN(DISCARD);\n\t    }\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"deprecated image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CROTAi>. {\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    yyless(0);\n\t    BEGIN(CCCCCia);\n\t  } else {\n\t    // Let it go.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<iCROTn>{I1}\"  \" |\n<iCROTn>{I2}\" \"  |\n<iCROTn>{I3}     |\n<TCROTn>{I1}\"  \" |\n<TCROTn>{I2}\" \"  |\n<TCROTn>{I3} {\n\t  WCSBTH_PUTBACK;\n\t  BEGIN((YY_START == iCROTn) ? iCCCna : TCCCna);\n\t}\n\n<iCROTn>{I1}[A-Z]\" \" |\n<iCROTn>{I2}[A-Z]    |\n<TCROTn>{I1}[A-Z]\" \" |\n<TCROTn>{I2}[A-Z] {\n\t  if (relax & WCSHDR_CROTAia) {\n\t    WCSBTH_PUTBACK;\n\t    BEGIN((YY_START == iCROTn) ? iCCCna : TCCCna);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"%s keyword may not have an alternate version code\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<iCROTn>. |\n<TCROTn>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<CCCCCCCa>{ALT} |\n<CCCCCCCC>. {\n\t  // Image-header keyword.\n\t  if (imherit || (relax & (WCSHDR_AUXIMG | WCSHDR_ALLIMG))) {\n\t    if (YY_START == CCCCCCCa) {\n\t      sscanf(yytext, \"%c\", &a);\n\t    } else {\n\t      a = 0;\n\t      unput(yytext[0]);\n\t    }\n\t    keytype = IMGAUX;\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCCCCCCa>. {\n\t  if (relax & WCSHDR_reject) {\n\t    // Looks too much like a FITS WCS keyword not to flag it.\n\t    errmsg = errtxt;\n\t    sprintf(errmsg, \"invalid alternate code, keyword resembles %s \"\n\t      \"but isn't\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCCCna>{I1}{ALT}\"  \" |\n<CCCCna>{I2}{ALT}\" \"  |\n<CCCCna>{I3}{ALT}     |\n<CCCCCna>{I1}{ALT}\" \" |\n<CCCCCna>{I2}{ALT} {\n\t  sscanf(yytext, \"%d%c\", &n, &a);\n\t  keytype = BINTAB;\n\t  BEGIN(VALUE);\n\t}\n\n<CCCCCna>{I3} {\n\t  sscanf(yytext, \"%d\", &n);\n\t  a = ' ';\n\t  keytype = BINTAB;\n\t  BEGIN(VALUE);\n\t}\n\n<CCCCna>. |\n<CCCCCna>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<CCCCn>{I1}\"   \" |\n<CCCCn>{I2}\"  \"  |\n<CCCCn>{I3}\" \"   |\n<CCCCn>{I4}      |\n<CCCCCn>{I1}\"  \" |\n<CCCCCn>{I2}\" \"  |\n<CCCCCn>{I3} {\n\t  sscanf(yytext, \"%d\", &n);\n\t  a = 0;\n\t  keytype = BINTAB;\n\t  BEGIN(VALUE);\n\t}\n\n<CCCCn>. |\n<CCCCCn>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<CCi_ma>{I1}_{Z1}{ALT}\"  \" |\n<CCi_ma>{I1}_{I2}{ALT}\" \" |\n<CCi_ma>{I2}_{Z1}{ALT}\" \" |\n<CCi_ma>{I2}_{I2}{ALT} {\n\t  // Image-header keyword.\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    sscanf(yytext, \"%d_%d%c\", &i, &m, &a);\n\t    keytype = IMGAXIS;\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCi_ma>0{I1}_{Z1}{ALT}\" \" |\n<CCi_ma>{I1}_0{Z1}{ALT}\" \" |\n<CCi_ma>00{I1}_{Z1}{ALT} |\n<CCi_ma>0{I1}_0{Z1}{ALT} |\n<CCi_ma>{I1}_00{Z1}{ALT} |\n<CCi_ma>000{I1}_{Z1} |\n<CCi_ma>00{I1}_0{Z1} |\n<CCi_ma>0{I1}_00{Z1} |\n<CCi_ma>{I1}_000{Z1} |\n<CCi_ma>0{I1}_{I2}{ALT} |\n<CCi_ma>{I1}_0{I2}{ALT} |\n<CCi_ma>00{I1}_{I2} |\n<CCi_ma>0{I1}_0{I2} |\n<CCi_ma>{I1}_00{I2} |\n<CCi_ma>0{I2}_{Z1}{ALT} |\n<CCi_ma>{I2}_0{Z1}{ALT} |\n<CCi_ma>00{I2}_{Z1} |\n<CCi_ma>0{I2}_0{Z1} |\n<CCi_ma>{I2}_00{Z1} |\n<CCi_ma>0{I2}_{I2} |\n<CCi_ma>{I2}_0{I2} {\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    if (((valtype == FLOAT)  && (relax & WCSHDR_PV0i_0ma)) ||\n\t        ((valtype == STRING) && (relax & WCSHDR_PS0i_0ma))) {\n\t      sscanf(yytext, \"%d_%d%c\", &i, &m, &a);\n\t      keytype = IMGAXIS;\n\t      BEGIN(VALUE);\n\t\n\t    } else if (relax & WCSHDR_reject) {\n\t      errmsg = \"indices in parameterized keywords must not have \"\n\t               \"leading zeroes\";\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      // Pretend we don't recognize it.\n\t      BEGIN(DISCARD);\n\t    }\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"invalid image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCi_ma>{Z1}_{Z1}{ALT}\"  \" |\n<CCi_ma>{Z2}_{Z1}{ALT}\" \" |\n<CCi_ma>{Z1}_{Z2}{ALT}\" \" |\n<CCi_ma>{Z3}_{Z1}{ALT} |\n<CCi_ma>{Z2}_{Z2}{ALT} |\n<CCi_ma>{Z1}_{Z3}{ALT} |\n<CCi_ma>{Z4}_{Z1} |\n<CCi_ma>{Z3}_{Z2} |\n<CCi_ma>{Z2}_{Z3} |\n<CCi_ma>{Z1}_{Z4} {\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    // Anything that has fallen through to this point must contain\n\t    // an invalid parameter.\n\t    errmsg = \"axis number must exceed 0\";\n\t    BEGIN(ERROR);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"invalid image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<CCi_ma>{Z1}-{Z1}{ALT}\"  \" |\n<CCi_ma>{Z2}-{Z1}{ALT}\" \" |\n<CCi_ma>{Z1}-{Z2}{ALT}\" \" |\n<CCi_ma>{Z3}-{Z1}{ALT} |\n<CCi_ma>{Z2}-{Z2}{ALT} |\n<CCi_ma>{Z1}-{Z3}{ALT} |\n<CCi_ma>{Z4}-{Z1} |\n<CCi_ma>{Z3}-{Z2} |\n<CCi_ma>{Z2}-{Z3} |\n<CCi_ma>{Z1}-{Z4} {\n\t  errmsg = errtxt;\n\t  sprintf(errmsg, \"%s keyword must use an underscore, not a dash\",\n\t    keyname);\n\t  BEGIN(ERROR);\n\t}\n\n<CCi_ma>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<iCCn_ma>{I1}_{Z1}{ALT}\" \" |\n<iCCn_ma>{I1}_{I2}{ALT}    |\n<iCCn_ma>{I1}_{I3}         |\n<iCCn_ma>{I2}_{Z1}{ALT}    |\n<iCCn_ma>{I2}_{I2}         |\n<iCCn_ma>{I3}_{Z1}         |\n<TCCn_ma>{I1}_{Z1}{ALT}\" \" |\n<TCCn_ma>{I1}_{I2}{ALT}    |\n<TCCn_ma>{I1}_{I3}         |\n<TCCn_ma>{I2}_{Z1}{ALT}    |\n<TCCn_ma>{I2}_{I2}         |\n<TCCn_ma>{I3}_{Z1} {\n\t  if (relax & WCSHDR_LONGKEY) {\n\t    WCSBTH_PUTBACK;\n\t    BEGIN((YY_START == iCCn_ma) ? iCn_ma : TCn_ma);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg, \"the %s keyword is non-standard\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<iCCn_ma>. |\n<TCCn_ma>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<iCn_ma>{I1}_{Z1}{ALT}\"  \" |\n<iCn_ma>{I1}_{I2}{ALT}\" \"  |\n<iCn_ma>{I1}_{I3}{ALT}     |\n<iCn_ma>{I2}_{Z1}{ALT}\" \"  |\n<iCn_ma>{I2}_{I2}{ALT}     |\n<iCn_ma>{I3}_{Z1}{ALT}     |\n<TCn_ma>{I1}_{Z1}{ALT}\"  \" |\n<TCn_ma>{I1}_{I2}{ALT}\" \"  |\n<TCn_ma>{I1}_{I3}{ALT}     |\n<TCn_ma>{I2}_{Z1}{ALT}\" \"  |\n<TCn_ma>{I2}_{I2}{ALT}     |\n<TCn_ma>{I3}_{Z1}{ALT} {\n\t  sscanf(yytext, \"%d_%d%c\", &n, &m, &a);\n\t  if (YY_START == TCn_ma) i = wcsbth_colax(*wcs, &alts, n, a);\n\t  keytype = (YY_START == iCn_ma) ? BIMGARR : PIXLIST;\n\t  BEGIN(VALUE);\n\t}\n\n<iCn_ma>{I1}_{I4} |\n<iCn_ma>{I2}_{I3} |\n<iCn_ma>{I3}_{I2} |\n<iCn_ma>{I4}_{Z1} |\n<TCn_ma>{I1}_{I4} |\n<TCn_ma>{I2}_{I3} |\n<TCn_ma>{I3}_{I2} |\n<TCn_ma>{I4}_{Z1} {\n\t  // Invalid combinations will be flagged by <VALUE>.\n\t  sscanf(yytext, \"%d_%d\", &n, &m);\n\t  a = ' ';\n\t  if (YY_START == TCn_ma) i = wcsbth_colax(*wcs, &alts, n, a);\n\t  keytype = (YY_START == iCn_ma) ? BIMGARR : PIXLIST;\n\t  BEGIN(VALUE);\n\t}\n\n<iCn_ma>. |\n<TCn_ma>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<PROJPm>{Z1}\"  \" {\n\t  if (relax & WCSHDR_PROJPn) {\n\t    sscanf(yytext, \"%d\", &m);\n\t    i = 0;\n\t    a = ' ';\n\t    keytype = IMGAXIS;\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the PROJPn keyword is deprecated, use PVi_ma\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<PROJPm>{Z2}\" \" |\n<PROJPm>{Z3} {\n\t  if (relax & (WCSHDR_PROJPn | WCSHDR_reject)) {\n\t    errmsg = \"invalid PROJPn keyword\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\n<PROJPm>. {\n\t  BEGIN(DISCARD);\n\t}\n\n<VALUE>=\" \"+ {\n\t  // Do checks on i, j, m, n, k.\n\t  if (!(keytype & keysel)) {\n\t    // Selection by keyword type.\n\t    BEGIN(DISCARD);\n\t\n\t  } else if (exclude[n] || exclude[k]) {\n\t    // One or other column is not selected.\n\t    if (k && (exclude[n] != exclude[k])) {\n\t      // For keywords such as TCn_ka, both columns must be excluded.\n\t      // User error, so return immediately.\n\t      return WCSHDRERR_BAD_COLUMN;\n\t\n\t    } else {\n\t      BEGIN(DISCARD);\n\t    }\n\t\n\t  } else if (i > 99 || j > 99 || m > 99 || n > 999 || k > 999) {\n\t    if (relax & WCSHDR_reject) {\n\t      errmsg = errtxt;\n\t      if (i > 99 || j > 99) {\n\t        sprintf(errmsg, \"axis number exceeds 99\");\n\t      } else if (m > 99) {\n\t        sprintf(errmsg, \"parameter number exceeds 99\");\n\t      } else if (n > 999 || k > 999) {\n\t        sprintf(errmsg, \"column number exceeds 999\");\n\t      }\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      // Pretend we don't recognize it.\n\t      BEGIN(DISCARD);\n\t    }\n\t\n\t  } else if (ipass == 2 && npass == 3 && (keytype & BINTAB)) {\n\t    // Skip keyvalues that won't be inherited.\n\t    BEGIN(FLUSH);\n\t\n\t  } else {\n\t    if (ipass == 3 && (keytype & IMGHEAD)) {\n\t      // IMGHEAD keytypes are always dealt with on the second pass.\n\t      // However, they must be re-parsed in order to report errors.\n\t      vptr = 0x0;\n\t    }\n\t\n\t    if (valtype == INTEGER) {\n\t      BEGIN(INTEGER_VAL);\n\t    } else if (valtype == FLOAT) {\n\t      BEGIN(FLOAT_VAL);\n\t    } else if (valtype == FLOAT2) {\n\t      BEGIN(FLOAT2_VAL);\n\t    } else if (valtype == STRING) {\n\t      BEGIN(STRING_VAL);\n\t    } else {\n\t      errmsg = errtxt;\n\t      sprintf(errmsg, \"internal parser ERROR, bad data type: %d\",\n\t        valtype);\n\t      BEGIN(ERROR);\n\t    }\n\t  }\n\t}\n\n<VALUE>. {\n\t  errmsg = \"invalid KEYWORD = VALUE syntax\";\n\t  BEGIN(ERROR);\n\t}\n\n<INTEGER_VAL>{INTEGER} {\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    // Read the keyvalue.\n\t    sscanf(yytext, \"%d\", &inttmp);\n\t\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\n<INTEGER_VAL>. {\n\t  errmsg = \"an integer value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\n<FLOAT_VAL>{FLOAT} {\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    // Read the keyvalue.\n\t    wcsutil_str2double(yytext, &dbltmp);\n\t\n\t    if (chekval && chekval(dbltmp)) {\n\t      errmsg = \"invalid keyvalue\";\n\t      BEGIN(ERROR);\n\t    } else {\n\t      BEGIN(COMMENT);\n\t    }\n\t  }\n\t}\n\n<FLOAT_VAL>. {\n\t  errmsg = \"a floating-point value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\n<FLOAT2_VAL>{FLOAT} {\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    // Read the keyvalue as integer and fractional parts.\n\t    wcsutil_str2double2(yytext, dbl2tmp);\n\t\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\n<FLOAT2_VAL>. {\n\t  errmsg = \"a floating-point value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\n<STRING_VAL>{STRING} {\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    // Read the keyvalue.\n\t    strcpy(strtmp, yytext+1);\n\t\n\t    // Squeeze out repeated quotes.\n\t    int ix = 0;\n\t    for (int jx = 0; jx < 72; jx++) {\n\t      if (ix < jx) {\n\t        strtmp[ix] = strtmp[jx];\n\t      }\n\t\n\t      if (strtmp[jx] == '\\0') {\n\t        if (ix) strtmp[ix-1] = '\\0';\n\t        break;\n\t      } else if (strtmp[jx] == '\\'' && strtmp[jx+1] == '\\'') {\n\t        jx++;\n\t      }\n\t\n\t      ix++;\n\t    }\n\t\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\n<STRING_VAL>. {\n\t  errmsg = \"a string value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\n<COMMENT>{INLINE}$ {\n\t  if (ipass == 1) {\n\t    // Do first-pass bookkeeping.\n\t    wcsbth_pass1(keytype, i, j, n, k, a, ptype, &alts);\n\t    BEGIN(FLUSH);\n\t\n\t  } else if (*wcs) {\n\t    // Store the value now that the keyrecord has been validated.\n\t    alts.icol = 0;\n\t    alts.ialt = 0;\n\t\n\t    // Update each coordinate representation.\n\t    int gotone = 0;\n\t    struct wcsprm *wcsp;\n\t    while ((wcsp = wcsbth_idx(*wcs, &alts, keytype, n, a))) {\n\t      gotone = 1;\n\t\n\t      if (vptr) {\n\t        void *wptr;\n\t        if (auxprm) {\n\t          // Additional auxiliary parameter.\n\t          auxp = wcsp->aux;\n\t          ptrdiff_t voff = (char *)vptr - (char *)(&auxtem);\n\t          wptr = (void *)((char *)auxp + voff);\n\t        } else {\n\t          // A parameter that lives directly in wcsprm.\n\t          ptrdiff_t voff = (char *)vptr - (char *)(&wcstem);\n\t          wptr = (void *)((char *)wcsp + voff);\n\t        }\n\t\n\t        if (valtype == INTEGER) {\n\t          *((int *)wptr) = inttmp;\n\t\n\t        } else if (valtype == FLOAT) {\n\t          // Apply keyword parameterization.\n\t          if (ptype == 'v') {\n\t            int ipx = (wcsp->npv)++;\n\t            wcsp->pv[ipx].i = i;\n\t            wcsp->pv[ipx].m = m;\n\t            wptr = &(wcsp->pv[ipx].value);\n\t\n\t          } else if (j) {\n\t            wptr = *((double **)wptr) + (i - 1)*(wcsp->naxis)\n\t                                      + (j - 1);\n\t\n\t          } else if (i) {\n\t            wptr = *((double **)wptr) + (i - 1);\n\t          }\n\t\n\t          if (special) {\n\t            special(wptr, &dbltmp);\n\t          } else {\n\t            *((double *)wptr) = dbltmp;\n\t          }\n\t\n\t          // Flag the presence of PCi_ja, or CDi_ja and/or CROTAia.\n\t          if (altlin) {\n\t            wcsp->altlin |= altlin;\n\t            altlin = 0;\n\t          }\n\t\n\t          } else if (valtype == FLOAT2) {\n\t            // Split MJDREF and JDREF into integer and fraction.\n\t            if (special) {\n\t              special(wptr, dbl2tmp);\n\t            } else {\n\t              *((double *)wptr) = dbl2tmp[0];\n\t              *((double *)wptr + 1) = dbl2tmp[1];\n\t            }\n\t\n\t        } else if (valtype == STRING) {\n\t          // Apply keyword parameterization.\n\t          if (ptype == 's') {\n\t            int ipx = wcsp->nps++;\n\t            wcsp->ps[ipx].i = i;\n\t            wcsp->ps[ipx].m = m;\n\t            wptr = wcsp->ps[ipx].value;\n\t\n\t          } else if (j) {\n\t            wptr = *((char (**)[72])wptr) +\n\t                    (i - 1)*(wcsp->naxis) + (j - 1);\n\t\n\t          } else if (i) {\n\t            wptr = *((char (**)[72])wptr) + (i - 1);\n\t          }\n\t\n\t          char *cptr = (char *)wptr;\n\t          strcpy(cptr, strtmp);\n\t        }\n\t      }\n\t    }\n\t\n\t    if (ipass == npass) {\n\t      if (gotone) {\n\t        nvalid++;\n\t        if (ctrl == 4) {\n\t          wcsfprintf(stderr,\n\t            \"%.80s\\n  Accepted (%d) as a valid WCS keyrecord.\\n\",\n\t            keyrec, nvalid);\n\t        }\n\t\n\t        BEGIN(FLUSH);\n\t\n\t      } else {\n\t        errmsg = \"syntactically valid WCS keyrecord has no effect\";\n\t        BEGIN(ERROR);\n\t      }\n\t\n\t    } else {\n\t      BEGIN(FLUSH);\n\t    }\n\t\n\t  } else {\n\t    BEGIN(FLUSH);\n\t  }\n\t}\n\n<COMMENT>.*\" \"*\\/.*$ {\n\t  errmsg = \"invalid keyvalue\";\n\t  BEGIN(ERROR);\n\t}\n\n<COMMENT>[^ \\/\\n]*{INLINE}$ {\n\t  errmsg = \"invalid keyvalue\";\n\t  BEGIN(ERROR);\n\t}\n\n<COMMENT>\" \"+[^\\/\\n].*{INLINE}$ {\n\t  errmsg = \"invalid keyvalue or malformed keycomment\";\n\t  BEGIN(ERROR);\n\t}\n\n<COMMENT>.*$ {\n\t  errmsg = \"malformed keycomment\";\n\t  BEGIN(ERROR);\n\t}\n\n<DISCARD>.*$ {\n\t  if (ipass == npass) {\n\t    if (ctrl < 0) {\n\t      // Preserve discards.\n\t      keep = keyrec;\n\t\n\t    } else if (2 < ctrl) {\n\t      nother++;\n\t      wcsfprintf(stderr, \"%.80s\\n  Not a recognized WCS keyword.\\n\",\n\t        keyrec);\n\t    }\n\t  }\n\t  BEGIN(FLUSH);\n\t}\n\n<ERROR>.*$ {\n\t  if (ipass == npass) {\n\t    (*nreject)++;\n\t\n\t    if (ctrl%10 == -1) {\n\t      keep = keyrec;\n\t    }\n\t\n\t    if (1 < abs(ctrl%10)) {\n\t      wcsfprintf(stderr, \"%.80s\\n  Rejected (%d), %s.\\n\",\n\t        keyrec, *nreject, errmsg);\n\t    }\n\t  }\n\t  BEGIN(FLUSH);\n\t}\n\n<FLUSH>.*\\n {\n\t  if (ipass == npass && keep) {\n\t    if (hptr < keep) {\n\t      strncpy(hptr, keep, 80);\n\t    }\n\t    hptr += 80;\n\t  }\n\t\n\t  naux += auxprm;\n\t  auxprm = 0;\n\t\n\t  // Throw away the rest of the line and reset for the next one.\n\t  i = j = 0;\n\t  n = k = 0;\n\t  m = 0;\n\t  a = ' ';\n\t\n\t  keyrec += 80;\n\t\n\t  keytype =  0;\n\t  valtype = -1;\n\t  vptr    = 0x0;\n\t  keep    = 0x0;\n\t\n\t  altlin  = 0;\n\t  ptype   = ' ';\n\t  chekval = 0x0;\n\t  special = 0x0;\n\t\n\t  BEGIN(INITIAL);\n\t}\n\n<<EOF>>\t {\n\t  // End-of-input.\n\t  if (ipass == 1) {\n\t    int status;\n\t    if ((status = wcsbth_init1(&alts, naux, nwcs, wcs)) ||\n\t        (*nwcs == 0 && ctrl == 0)) {\n\t      return status;\n\t    }\n\t\n\t    if (2 < abs(ctrl%10)) {\n\t      if (*nwcs == 1) {\n\t        if (strcmp(wcs[0]->wcsname, \"DEFAULTS\") != 0) {\n\t          wcsfprintf(stderr, \"Found one coordinate representation.\\n\");\n\t        }\n\t      } else {\n\t        wcsfprintf(stderr, \"Found %d coordinate representations.\\n\",\n\t          *nwcs);\n\t      }\n\t    }\n\t\n\t    if (alts.imgherit) npass = 3;\n\t  }\n\t\n\t  if (ipass++ < npass) {\n\t    yyextra->hdr = header;\n\t    yyextra->nkeyrec = nkeyrec;\n\t    keyrec = header;\n\t    *nreject = 0;\n\t\n\t    imherit = 1;\n\t\n\t    i = j = 0;\n\t    k = n = 0;\n\t    m = 0;\n\t    a = ' ';\n\t\n\t    keytype =  0;\n\t    valtype = -1;\n\t    vptr    = 0x0;\n\t\n\t    altlin = 0;\n\t    ptype  = ' ';\n\t    chekval = 0x0;\n\t    special = 0x0;\n\t\n\t    yyrestart(yyin, yyscanner);\n\t\n\t  } else {\n\t\n\t    if (ctrl < 0) {\n\t      *hptr = '\\0';\n\t    } else if (ctrl == 1) {\n\t      wcsfprintf(stderr, \"%d WCS keyrecord%s rejected.\\n\",\n\t        *nreject, (*nreject==1)?\" was\":\"s were\");\n\t    } else if (ctrl == 4) {\n\t      wcsfprintf(stderr, \"\\n\");\n\t      wcsfprintf(stderr, \"%5d keyrecord%s rejected for syntax or \"\n\t        \"other errors,\\n\", *nreject, (*nreject==1)?\" was\":\"s were\");\n\t      wcsfprintf(stderr, \"%5d %s recognized as syntactically valid, \"\n\t        \"and\\n\", nvalid, (nvalid==1)?\"was\":\"were\");\n\t      wcsfprintf(stderr, \"%5d other%s were not recognized as WCS \"\n\t        \"keyrecords.\\n\", nother, (nother==1)?\"\":\"s\");\n\t    }\n\t\n\t    return wcsbth_final(&alts, nwcs, wcs);\n\t  }\n\t}\n\n%%\n\n/*----------------------------------------------------------------------------\n* External interface to the scanner.\n*---------------------------------------------------------------------------*/\n\nint wcsbth(\n  char *header,\n  int nkeyrec,\n  int relax,\n  int ctrl,\n  int keysel,\n  int *colsel,\n  int *nreject,\n  int *nwcs,\n  struct wcsprm **wcs)\n\n{\n  // Function prototypes.\n  int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner);\n  int yylex_destroy(yyscan_t yyscanner);\n\n  struct wcsbth_extra extra;\n  yyscan_t yyscanner;\n  yylex_init_extra(&extra, &yyscanner);\n  int status = wcsbth_scanner(header, nkeyrec, relax, ctrl, keysel, colsel,\n                              nreject, nwcs, wcs, yyscanner);\n  yylex_destroy(yyscanner);\n\n  return status;\n}\n\n/*----------------------------------------------------------------------------\n* Perform first-pass tasks:\n*\n* 1) Count the number of coordinate axes in each of the 27 possible alternate\n*    image-header coordinate representations.  Also count the number of PVi_ma\n*    and PSi_ma keywords in each representation.\n*\n* 2) Determine the number of binary table columns that have an image array\n*    with a coordinate representation (up to 999), and count the number of\n*    coordinate axes in each of the 27 possible alternates.  Also count the\n*    number of iVn_ma and iSn_ma keywords in each representation.\n*\n* 3) Determine the number of alternate pixel list coordinate representations\n*    (up to 27) and the table columns associated with each.  Also count the\n*    number of TVn_ma and TSn_ma keywords in each representation.\n*\n* In the first pass alts->arridx[icol][27] is used to determine the number of\n* axes in each of 27 possible image-header coordinate descriptions (icol == 0)\n* and each of the 27 possible coordinate representations for an image array in\n* each column.\n*\n* The elements of alts->pixlist[icol] are used as bit arrays to flag which of\n* the 27 possible pixel list coordinate representations are associated with\n* each table column.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_pass1(\n  int keytype,\n  int i,\n  int j,\n  int n,\n  int k,\n  char a,\n  char ptype,\n  struct wcsbth_alts *alts)\n\n{\n  if (a == 0) {\n    // Keywords such as DATE-OBS go along for the ride.\n    return 0;\n  }\n\n  int ncol = alts->ncol;\n\n  // Do we need to allocate memory for alts?\n  if (alts->arridx == 0x0) {\n    if (ncol == 0) {\n      // Can only happen if TFIELDS is missing or out-of-sequence.  If n and\n      // k are both zero then we may be processing an image header so leave\n      // ncol alone - the array will be realloc'd later if required.\n      if (n || k) {\n        // The header is mangled, assume the worst.\n        ncol = 999;\n      }\n    }\n\n    if (!(alts->arridx  =  calloc((1 + ncol)*27, sizeof(short int))) ||\n        !(alts->npv     =  calloc((1 + ncol)*27, sizeof(unsigned char)))  ||\n        !(alts->nps     =  calloc((1 + ncol)*27, sizeof(unsigned char)))  ||\n        !(alts->pixlist =  calloc((1 + ncol),    sizeof(unsigned int)))) {\n      if (alts->arridx)  free(alts->arridx);\n      if (alts->npv)     free(alts->npv);\n      if (alts->nps)     free(alts->nps);\n      if (alts->pixlist) free(alts->pixlist);\n      return WCSHDRERR_MEMORY;\n    }\n\n    alts->ncol = ncol;\n\n  } else if (n > ncol || k > ncol) {\n    // Can only happen if TFIELDS or the WCS keyword is wrong; carry on.\n    ncol = 999;\n    if (!(alts->arridx  = realloc(alts->arridx,\n                                    27*(1 + ncol)*sizeof(short int))) ||\n        !(alts->npv     = realloc(alts->npv,\n                                    27*(1 + ncol)*sizeof(unsigned char)))  ||\n        !(alts->nps     = realloc(alts->nps,\n                                    27*(1 + ncol)*sizeof(unsigned char)))  ||\n        !(alts->pixlist = realloc(alts->pixlist,\n                                       (1 + ncol)*sizeof(unsigned int)))) {\n      if (alts->arridx)  free(alts->arridx);\n      if (alts->npv)     free(alts->npv);\n      if (alts->nps)     free(alts->nps);\n      if (alts->pixlist) free(alts->pixlist);\n      return WCSHDRERR_MEMORY;\n    }\n\n    // Since realloc() doesn't initialize the extra memory.\n    for (int icol = (1 + alts->ncol); icol < (1 + ncol); icol++) {\n      for (int ialt = 0; ialt < 27; ialt++) {\n        alts->arridx[icol][ialt] = 0;\n        alts->npv[icol][ialt] = 0;\n        alts->nps[icol][ialt] = 0;\n        alts->pixlist[icol]   = 0;\n      }\n    }\n\n    alts->ncol = ncol;\n  }\n\n  int ialt = 0;\n  if (a != ' ') {\n    ialt = a - 'A' + 1;\n  }\n\n  // A BINTAB keytype such as LONPna, in conjunction with an IMGAXIS keytype\n  // causes a table column to be recognized as an image array.\n  if (keytype & IMGHEAD || keytype & BIMGARR) {\n    // n == 0 is expected for IMGHEAD keywords.\n    if (i == 0 && j == 0) {\n      if (alts->arridx[n][ialt] == 0) {\n        // Flag that an auxiliary keyword was seen.\n        alts->arridx[n][ialt] = -1;\n      }\n\n    } else {\n      // Record the maximum axis number found.\n      if (alts->arridx[n][ialt] < i) {\n        alts->arridx[n][ialt] = i;\n      }\n\n      if (alts->arridx[n][ialt] < j) {\n        alts->arridx[n][ialt] = j;\n      }\n    }\n\n    if (ptype == 'v') {\n      alts->npv[n][ialt]++;\n    } else if (ptype == 's') {\n      alts->nps[n][ialt]++;\n    }\n  }\n\n  // BINTAB keytypes, which apply both to pixel lists as well as binary table\n  // image arrays, never contribute to recognizing a table column as a pixel\n  // list axis.  A PIXLIST keytype is required for that.\n  if (keytype == PIXLIST) {\n    int mask = 1 << ialt;\n\n    // n > 0 for PIXLIST keytypes.\n    alts->pixlist[n] |= mask;\n    if (k) alts->pixlist[k] |= mask;\n\n    // Used as a flag over all columns.\n    alts->pixlist[0] |= mask;\n\n    if (ptype == 'v') {\n      alts->pixnpv[ialt]++;\n    } else if (ptype == 's') {\n      alts->pixnps[ialt]++;\n    }\n  }\n\n  return 0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Perform initializations at the end of the first pass:\n*\n* 1) Determine the required number of wcsprm structs, allocate memory for\n*    an array of them and initialize each one.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_init1(\n  struct wcsbth_alts *alts,\n  int naux,\n  int *nwcs,\n  struct wcsprm **wcs)\n\n{\n  int status = 0;\n\n  if (alts->arridx == 0x0) {\n    *nwcs = 0;\n    return 0;\n  }\n\n  // Determine the number of axes in each pixel list representation.\n  int ialt, mask, ncol = alts->ncol;\n  for (ialt = 0, mask = 1; ialt < 27; ialt++, mask <<= 1) {\n    alts->pixidx[ialt] = 0;\n\n    if (alts->pixlist[0] | mask) {\n      for (int icol = 1; icol <= ncol; icol++) {\n        if (alts->pixlist[icol] & mask) {\n          alts->pixidx[ialt]++;\n        }\n      }\n    }\n  }\n\n  // Find the total number of coordinate representations.\n  *nwcs = 0;\n  alts->imgherit = 0;\n  int inherit[27];\n  for (int ialt = 0; ialt < 27; ialt++) {\n    inherit[ialt] = 0;\n\n    for (int icol = 1; icol <= ncol; icol++) {\n      if (alts->arridx[icol][ialt] < 0) {\n        // No BIMGARR keytype but there's at least one BINTAB.\n        if (alts->arridx[0][ialt] > 0) {\n          // There is an IMGAXIS keytype that we will inherit, so count this\n          // representation.\n          alts->arridx[icol][ialt] = alts->arridx[0][ialt];\n        } else {\n          alts->arridx[icol][ialt] = 0;\n        }\n      }\n\n      if (alts->arridx[icol][ialt]) {\n        if (alts->arridx[0][ialt]) {\n          // All IMGHEAD keywords are inherited for this ialt.\n          inherit[ialt] = 1;\n\n          if (alts->arridx[icol][ialt] < alts->arridx[0][ialt]) {\n            // The extra axes are also inherited.\n            alts->arridx[icol][ialt] = alts->arridx[0][ialt];\n          }\n        }\n\n        (*nwcs)++;\n      }\n    }\n\n    // Count every \"a\" found in any IMGHEAD keyword...\n    if (alts->arridx[0][ialt]) {\n      if (inherit[ialt]) {\n        // ...but not if the IMGHEAD keywords will be inherited.\n        alts->arridx[0][ialt] = 0;\n        alts->imgherit = 1;\n      } else if (alts->arridx[0][ialt] > 0) {\n        (*nwcs)++;\n      }\n    }\n\n    // We need a struct for every \"a\" found in a PIXLIST keyword.\n    if (alts->pixidx[ialt]) {\n      (*nwcs)++;\n    }\n  }\n\n\n  if (*nwcs) {\n    // Allocate memory for the required number of wcsprm structs.\n    if (!(*wcs = calloc(*nwcs, sizeof(struct wcsprm)))) {\n      return WCSHDRERR_MEMORY;\n    }\n\n    // Initialize each wcsprm struct.\n    struct wcsprm *wcsp = *wcs;\n    *nwcs = 0;\n    for (int icol = 0; icol <= ncol; icol++) {\n      for (int ialt = 0; ialt < 27; ialt++) {\n        if (alts->arridx[icol][ialt] > 0) {\n          // Image-header representations that are not for inheritance\n          // (icol == 0) or binary table image array representations.\n          wcsp->flag = -1;\n          int npvmax = alts->npv[icol][ialt];\n          int npsmax = alts->nps[icol][ialt];\n          if ((status = wcsinit(1, (int)(alts->arridx[icol][ialt]), wcsp,\n                                npvmax, npsmax, -1))) {\n            wcsvfree(nwcs, wcs);\n            break;\n          }\n\n          // Record the alternate version code.\n          if (ialt) {\n            wcsp->alt[0] = 'A' + ialt - 1;\n          }\n\n          // Any additional auxiliary keywords present?\n          if (naux) {\n            if (wcsauxi(1, wcsp)) {\n              return WCSHDRERR_MEMORY;\n            }\n          }\n\n          // Record the table column number.\n          wcsp->colnum = icol;\n\n          // On the second pass alts->arridx[icol][27] indexes the array of\n          // wcsprm structs.\n          alts->arridx[icol][ialt] = (*nwcs)++;\n\n          wcsp++;\n\n        } else {\n          // Signal that this column has no WCS for this \"a\".\n          alts->arridx[icol][ialt] = -1;\n        }\n      }\n    }\n\n    for (int ialt = 0; ialt < 27; ialt++) {\n      if (alts->pixidx[ialt]) {\n        // Pixel lists representations.\n        wcsp->flag = -1;\n        int npvmax = alts->pixnpv[ialt];\n        int npsmax = alts->pixnps[ialt];\n        if ((status = wcsinit(1, (int)(alts->pixidx[ialt]), wcsp, npvmax,\n                              npsmax, -1))) {\n          wcsvfree(nwcs, wcs);\n          break;\n        }\n\n        // Record the alternate version code.\n        if (ialt) {\n          wcsp->alt[0] = 'A' + ialt - 1;\n        }\n\n        // Any additional auxiliary keywords present?\n        if (naux) {\n          if (wcsauxi(1, wcsp)) {\n            return WCSHDRERR_MEMORY;\n          }\n        }\n\n        // Record the pixel list column numbers.\n        int icol, ix, mask = (1 << ialt);\n        for (icol = 1, ix = 0; icol <= ncol; icol++) {\n          if (alts->pixlist[icol] & mask) {\n            wcsp->colax[ix++] = icol;\n          }\n        }\n\n        // alts->pixidx[] indexes the array of wcsprm structs.\n        alts->pixidx[ialt] = (*nwcs)++;\n\n        wcsp++;\n\n      } else {\n        // Signal that this column is not a pixel list axis for this \"a\".\n        alts->pixidx[ialt] = -1;\n      }\n    }\n  }\n\n  return status;\n}\n\n\n/*----------------------------------------------------------------------------\n* Return a pointer to the next wcsprm struct for a particular column number\n* and alternate.\n*---------------------------------------------------------------------------*/\n\nstruct wcsprm *wcsbth_idx(\n  struct wcsprm *wcs,\n  struct wcsbth_alts *alts,\n  int  keytype,\n  int  n,\n  char a)\n\n{\n  const char as[] = \" ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n\n  if (!wcs) return 0x0;\n\n  int iwcs = -1;\n  for (; iwcs < 0 && alts->ialt < 27; alts->ialt++) {\n    // Note that a == 0 applies to every alternate, otherwise this\n    // loop simply determines the appropriate value of alts->ialt.\n    if (a && a != as[alts->ialt]) continue;\n\n    if (keytype & (IMGHEAD | BIMGARR)) {\n      for (; iwcs < 0 && alts->icol <= alts->ncol; alts->icol++) {\n        // Image header keywords, n == 0, apply to all columns, otherwise this\n        // loop simply determines the appropriate value of alts->icol.\n        if (n && n != alts->icol) continue;\n        iwcs = alts->arridx[alts->icol][alts->ialt];\n      }\n\n      // Break out of the loop to stop alts->ialt from being incremented.\n      if (iwcs >= 0) break;\n\n      // Start from scratch for the next alts->ialt.\n      alts->icol = 0;\n    }\n\n    if (keytype & (IMGAUX | PIXLIST)) {\n      iwcs = alts->pixidx[alts->ialt];\n    }\n  }\n\n  return (iwcs >= 0) ? (wcs + iwcs) : 0x0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Return the axis number associated with the specified column number in a\n* particular pixel list coordinate representation.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_colax(\n  struct wcsprm *wcs,\n  struct wcsbth_alts *alts,\n  int n,\n  char a)\n\n{\n  if (!wcs) return 0;\n\n  struct wcsprm *wcsp = wcs;\n  if (a != ' ') {\n    wcsp += alts->pixidx[a-'A'+1];\n  }\n\n  for (int ix = 0; ix < wcsp->naxis; ix++) {\n    if (wcsp->colax[ix] == n) {\n      return ++ix;\n    }\n  }\n\n  return 0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Interpret the JDREF, JDREFI, and JDREFF keywords.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_jdref(double *mjdref, const double *jdref)\n\n{\n  // Set MJDREF from JDREF.\n  if (undefined(mjdref[0] && undefined(mjdref[1]))) {\n    mjdref[0] = jdref[0] - 2400000.0;\n    mjdref[1] = jdref[1] - 0.5;\n\n    if (mjdref[1] < 0.0) {\n      mjdref[0] -= 1.0;\n      mjdref[1] += 1.0;\n    }\n  }\n\n  return 0;\n}\n\nint wcsbth_jdrefi(double *mjdref, const double *jdrefi)\n\n{\n  // Set the integer part of MJDREF from JDREFI.\n  if (undefined(mjdref[0])) {\n    mjdref[0] = *jdrefi - 2400000.5;\n  }\n\n  return 0;\n}\n\n\nint wcsbth_jdreff(double *mjdref, const double *jdreff)\n\n{\n  // Set the fractional part of MJDREF from JDREFF.\n  if (undefined(mjdref[1])) {\n    mjdref[1] = *jdreff;\n  }\n\n  return 0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Interpret EPOCHa keywords.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_epoch(double *equinox, const double *epoch)\n\n{\n  // If EQUINOXa is currently undefined then set it from EPOCHa.\n  if (undefined(*equinox)) {\n    *equinox = *epoch;\n  }\n\n  return 0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Interpret VSOURCEa keywords.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_vsource(double *zsource, const double *vsource)\n\n{\n  const double c = 299792458.0;\n\n  // If ZSOURCEa is currently undefined then set it from VSOURCEa.\n  if (undefined(*zsource)) {\n    // Convert relativistic Doppler velocity to redshift.\n    double beta = *vsource/c;\n    *zsource = (1.0 + beta)/sqrt(1.0 - beta*beta) - 1.0;\n  }\n\n  return 0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Check validity of a TIMEPIXR keyvalue.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_timepixr(double timepixr)\n\n{\n  return (timepixr < 0.0 || 1.0 < timepixr);\n}\n\n\n/*----------------------------------------------------------------------------\n* Tie up loose ends.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_final(\n  struct wcsbth_alts *alts,\n  int *nwcs,\n  struct wcsprm **wcs)\n\n{\n  if (alts->arridx)  free(alts->arridx);\n  if (alts->npv)     free(alts->npv);\n  if (alts->nps)     free(alts->nps);\n  if (alts->pixlist) free(alts->pixlist);\n\n  for (int ialt = 0; ialt < *nwcs; ialt++) {\n    // Interpret -TAB header keywords.\n    int status;\n    if ((status = wcstab(*wcs+ialt))) {\n       wcsvfree(nwcs, wcs);\n       return status;\n    }\n  }\n\n  return 0;\n}\n"},{"id":16611,"name":"wcs.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcs.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*===========================================================================*/\n\n#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"wcserr.h\"\n#include \"wcsmath.h\"\n#include \"wcsprintf.h\"\n#include \"wcstrig.h\"\n#include \"wcsunits.h\"\n#include \"wcsutil.h\"\n#include \"wtbarr.h\"\n#include \"lin.h\"\n#include \"dis.h\"\n#include \"log.h\"\n#include \"spc.h\"\n#include \"prj.h\"\n#include \"sph.h\"\n#include \"cel.h\"\n#include \"tab.h\"\n#include \"wcs.h\"\n\nconst int WCSSET = 137;\n\n// Maximum number of PVi_ma and PSi_ma keywords.\nint NPVMAX = 64;\nint NPSMAX =  8;\n\n// Map status return value to message.\nconst char *wcs_errmsg[] = {\n  \"Success\",\n  \"Null wcsprm pointer passed\",\n  \"Memory allocation failed\",\n  \"Linear transformation matrix is singular\",\n  \"Inconsistent or unrecognized coordinate axis type\",\n  \"Invalid parameter value\",\n  \"Unrecognized coordinate transformation parameter\",\n  \"Ill-conditioned coordinate transformation parameter\",\n  \"One or more of the pixel coordinates were invalid\",\n  \"One or more of the world coordinates were invalid\",\n  \"Invalid world coordinate\",\n  \"No solution found in the specified interval\",\n  \"Invalid subimage specification\",\n  \"Non-separable subimage coordinate system\",\n  \"wcsprm struct is unset, use wcsset()\"};\n\n// Map error returns for lower-level routines.\nconst int wcs_linerr[] = {\n  WCSERR_SUCCESS,\t\t//  0: LINERR_SUCCESS\n  WCSERR_NULL_POINTER,\t\t//  1: LINERR_NULL_POINTER\n  WCSERR_MEMORY,\t\t//  2: LINERR_MEMORY\n  WCSERR_SINGULAR_MTX,\t\t//  3: LINERR_SINGULAR_MTX\n  WCSERR_BAD_PARAM,\t\t//  4: LINERR_DISTORT_INIT\n  WCSERR_BAD_PIX,\t\t//  5: LINERR_DISTORT\n  WCSERR_BAD_WORLD\t\t//  6: LINERR_DEDISTORT\n};\n\nconst int wcs_logerr[] = {\n  WCSERR_SUCCESS,\t\t//  0: LOGERR_SUCCESS\n  WCSERR_NULL_POINTER,\t\t//  1: LOGERR_NULL_POINTER\n  WCSERR_BAD_PARAM,\t\t//  2: LOGERR_BAD_LOG_REF_VAL\n  WCSERR_BAD_PIX,\t\t//  3: LOGERR_BAD_X\n  WCSERR_BAD_WORLD\t\t//  4: LOGERR_BAD_WORLD\n};\n\nconst int wcs_spcerr[] = {\n\t\t\t\t// -1: SPCERR_NO_CHANGE\n  WCSERR_SUCCESS,\t\t//  0: SPCERR_SUCCESS\n  WCSERR_NULL_POINTER,\t\t//  1: SPCERR_NULL_POINTER\n  WCSERR_BAD_PARAM,\t\t//  2: SPCERR_BAD_SPEC_PARAMS\n  WCSERR_BAD_PIX,\t\t//  3: SPCERR_BAD_X\n  WCSERR_BAD_WORLD\t\t//  4: SPCERR_BAD_SPEC\n};\n\nconst int wcs_celerr[] = {\n  WCSERR_SUCCESS,\t\t//  0: CELERR_SUCCESS\n  WCSERR_NULL_POINTER,\t\t//  1: CELERR_NULL_POINTER\n  WCSERR_BAD_PARAM,\t\t//  2: CELERR_BAD_PARAM\n  WCSERR_BAD_COORD_TRANS,\t//  3: CELERR_BAD_COORD_TRANS\n  WCSERR_ILL_COORD_TRANS,\t//  4: CELERR_ILL_COORD_TRANS\n  WCSERR_BAD_PIX,\t\t//  5: CELERR_BAD_PIX\n  WCSERR_BAD_WORLD\t\t//  6: CELERR_BAD_WORLD\n};\n\nconst int wcs_taberr[] = {\n  WCSERR_SUCCESS,\t\t//  0: TABERR_SUCCESS\n  WCSERR_NULL_POINTER,\t\t//  1: TABERR_NULL_POINTER\n  WCSERR_MEMORY,\t\t//  2: TABERR_MEMORY\n  WCSERR_BAD_PARAM,\t\t//  3: TABERR_BAD_PARAMS\n  WCSERR_BAD_PIX,\t\t//  4: TABERR_BAD_X\n  WCSERR_BAD_WORLD\t\t//  5: TABERR_BAD_WORLD\n};\n\n// Convenience macro for invoking wcserr_set().\n#define WCS_ERRMSG(status) WCSERR_SET(status), wcs_errmsg[status]\n\n#ifndef signbit\n#define signbit(X) ((X) < 0.0 ? 1 : 0)\n#endif\n\n// Internal helper functions, not for general use.\nstatic int wcs_types(struct wcsprm *);\nstatic int wcs_units(struct wcsprm *);\n\n//----------------------------------------------------------------------------\n\nint wcsnpv(int npvmax) { if (npvmax >= 0) NPVMAX = npvmax; return NPVMAX; }\nint wcsnps(int npsmax) { if (npsmax >= 0) NPSMAX = npsmax; return NPSMAX; }\n\n//----------------------------------------------------------------------------\n\nint wcsini(int alloc, int naxis, struct wcsprm *wcs)\n\n{\n  return wcsinit(alloc, naxis, wcs, -1, -1, -1);\n}\n\n//----------------------------------------------------------------------------\n\nint wcsinit(\n  int alloc,\n  int naxis,\n  struct wcsprm *wcs,\n  int npvmax,\n  int npsmax,\n  int ndpmax)\n\n{\n  static const char *function = \"wcsinit\";\n\n  int i, j, k, status;\n  double *cd;\n  struct wcserr **err;\n\n  // Check inputs.\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n\n  if (npvmax < 0) npvmax = wcsnpv(-1);\n  if (npsmax < 0) npsmax = wcsnps(-1);\n\n\n  // Initialize error message handling...\n  if (wcs->flag == -1) {\n    wcs->err = 0x0;\n  }\n  err = &(wcs->err);\n  wcserr_clear(err);\n\n  // ...and also in the contained structs in case we have to return due to\n  // an error before they can be initialized by their specialized routines,\n  // since wcsperr() assumes their wcserr pointers are valid.\n  if (wcs->flag == -1) {\n    wcs->lin.err = 0x0;\n    wcs->cel.err = 0x0;\n    wcs->spc.err = 0x0;\n  }\n  wcserr_clear(&(wcs->lin.err));\n  wcserr_clear(&(wcs->cel.err));\n  wcserr_clear(&(wcs->spc.err));\n\n\n  // Initialize pointers.\n  if (wcs->flag == -1 || wcs->m_flag != WCSSET) {\n    if (wcs->flag == -1) {\n      wcs->tab   = 0x0;\n      wcs->types = 0x0;\n      wcs->lin.flag = -1;\n    }\n\n    // Initialize memory management.\n    wcs->m_flag  = 0;\n    wcs->m_naxis = 0;\n    wcs->m_crpix = 0x0;\n    wcs->m_pc    = 0x0;\n    wcs->m_cdelt = 0x0;\n    wcs->m_crval = 0x0;\n    wcs->m_cunit = 0x0;\n    wcs->m_ctype = 0x0;\n    wcs->m_pv    = 0x0;\n    wcs->m_ps    = 0x0;\n    wcs->m_cd    = 0x0;\n    wcs->m_crota = 0x0;\n    wcs->m_colax = 0x0;\n    wcs->m_cname = 0x0;\n    wcs->m_crder = 0x0;\n    wcs->m_csyer = 0x0;\n    wcs->m_czphs = 0x0;\n    wcs->m_cperi = 0x0;\n    wcs->m_aux   = 0x0;\n    wcs->m_tab   = 0x0;\n    wcs->m_wtb   = 0x0;\n  }\n\n  if (naxis < 0) {\n    return wcserr_set(WCSERR_SET(WCSERR_MEMORY),\n      \"naxis must not be negative (got %d)\", naxis);\n  }\n\n\n  // Allocate memory for arrays if required.\n  if (alloc ||\n     wcs->crpix == 0x0 ||\n     wcs->pc    == 0x0 ||\n     wcs->cdelt == 0x0 ||\n     wcs->crval == 0x0 ||\n     wcs->cunit == 0x0 ||\n     wcs->ctype == 0x0 ||\n     (npvmax && wcs->pv == 0x0) ||\n     (npsmax && wcs->ps == 0x0) ||\n     wcs->cd    == 0x0 ||\n     wcs->crota == 0x0 ||\n     wcs->colax == 0x0 ||\n     wcs->cname == 0x0 ||\n     wcs->crder == 0x0 ||\n     wcs->csyer == 0x0 ||\n     wcs->czphs == 0x0 ||\n     wcs->cperi == 0x0) {\n\n    // Was sufficient allocated previously?\n    if (wcs->m_flag == WCSSET &&\n       (wcs->m_naxis < naxis  ||\n        wcs->npvmax  < npvmax ||\n        wcs->npsmax  < npsmax)) {\n      // No, free it.\n      wcsfree(wcs);\n    }\n\n    if (alloc || wcs->crpix == 0x0) {\n      if (wcs->m_crpix) {\n        // In case the caller fiddled with it.\n        wcs->crpix = wcs->m_crpix;\n\n      } else {\n        if ((wcs->crpix = calloc(naxis, sizeof(double))) == 0x0) {\n          return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n        }\n\n        wcs->m_flag  = WCSSET;\n        wcs->m_naxis = naxis;\n        wcs->m_crpix = wcs->crpix;\n      }\n    }\n\n    if (alloc || wcs->pc == 0x0) {\n      if (wcs->m_pc) {\n        // In case the caller fiddled with it.\n        wcs->pc = wcs->m_pc;\n\n      } else {\n        if ((wcs->pc = calloc(naxis*naxis, sizeof(double))) == 0x0) {\n          wcsfree(wcs);\n          return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n        }\n\n        wcs->m_flag  = WCSSET;\n        wcs->m_naxis = naxis;\n        wcs->m_pc    = wcs->pc;\n      }\n    }\n\n    if (alloc || wcs->cdelt == 0x0) {\n      if (wcs->m_cdelt) {\n        // In case the caller fiddled with it.\n        wcs->cdelt = wcs->m_cdelt;\n\n      } else {\n        if ((wcs->cdelt = calloc(naxis, sizeof(double))) == 0x0) {\n          wcsfree(wcs);\n          return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n        }\n\n        wcs->m_flag  = WCSSET;\n        wcs->m_naxis = naxis;\n        wcs->m_cdelt = wcs->cdelt;\n      }\n    }\n\n    if (alloc || wcs->crval == 0x0) {\n      if (wcs->m_crval) {\n        // In case the caller fiddled with it.\n        wcs->crval = wcs->m_crval;\n\n      } else {\n        if ((wcs->crval = calloc(naxis, sizeof(double))) == 0x0) {\n          wcsfree(wcs);\n          return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n        }\n\n        wcs->m_flag  = WCSSET;\n        wcs->m_naxis = naxis;\n        wcs->m_crval = wcs->crval;\n      }\n    }\n\n    if (alloc || wcs->cunit == 0x0) {\n      if (wcs->m_cunit) {\n        // In case the caller fiddled with it.\n        wcs->cunit = wcs->m_cunit;\n\n      } else {\n        if ((wcs->cunit = calloc(naxis, sizeof(char [72]))) == 0x0) {\n          wcsfree(wcs);\n          return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n        }\n\n        wcs->m_flag  = WCSSET;\n        wcs->m_naxis = naxis;\n        wcs->m_cunit = wcs->cunit;\n      }\n    }\n\n    if (alloc || wcs->ctype == 0x0) {\n      if (wcs->m_ctype) {\n        // In case the caller fiddled with it.\n        wcs->ctype = wcs->m_ctype;\n\n      } else {\n        if ((wcs->ctype = calloc(naxis, sizeof(char [72]))) == 0x0) {\n          wcsfree(wcs);\n          return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n        }\n\n        wcs->m_flag  = WCSSET;\n        wcs->m_naxis = naxis;\n        wcs->m_ctype = wcs->ctype;\n      }\n    }\n\n    if (alloc || wcs->pv == 0x0) {\n      if (wcs->m_pv) {\n        // In case the caller fiddled with it.\n        wcs->pv = wcs->m_pv;\n\n      } else {\n        if (npvmax) {\n          if ((wcs->pv = calloc(npvmax, sizeof(struct pvcard))) == 0x0) {\n            wcsfree(wcs);\n            return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n          }\n        } else {\n          wcs->pv = 0x0;\n        }\n\n        wcs->npvmax  = npvmax;\n\n        wcs->m_flag  = WCSSET;\n        wcs->m_naxis = naxis;\n        wcs->m_pv    = wcs->pv;\n      }\n    }\n\n    if (alloc || wcs->ps == 0x0) {\n      if (wcs->m_ps) {\n        // In case the caller fiddled with it.\n        wcs->ps = wcs->m_ps;\n\n      } else {\n        if (npsmax) {\n          if ((wcs->ps = calloc(npsmax, sizeof(struct pscard))) == 0x0) {\n            wcsfree(wcs);\n            return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n          }\n        } else {\n          wcs->ps = 0x0;\n        }\n\n        wcs->npsmax  = npsmax;\n\n        wcs->m_flag  = WCSSET;\n        wcs->m_naxis = naxis;\n        wcs->m_ps    = wcs->ps;\n      }\n    }\n\n    if (alloc || wcs->cd == 0x0) {\n      if (wcs->m_cd) {\n        // In case the caller fiddled with it.\n        wcs->cd = wcs->m_cd;\n\n      } else {\n        if ((wcs->cd = calloc(naxis*naxis, sizeof(double))) == 0x0) {\n          wcsfree(wcs);\n          return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n        }\n\n        wcs->m_flag  = WCSSET;\n        wcs->m_naxis = naxis;\n        wcs->m_cd    = wcs->cd;\n      }\n    }\n\n    if (alloc || wcs->crota == 0x0) {\n      if (wcs->m_crota) {\n        // In case the caller fiddled with it.\n        wcs->crota = wcs->m_crota;\n\n      } else {\n        if ((wcs->crota = calloc(naxis, sizeof(double))) == 0x0) {\n          wcsfree(wcs);\n          return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n        }\n\n        wcs->m_flag  = WCSSET;\n        wcs->m_naxis = naxis;\n        wcs->m_crota = wcs->crota;\n      }\n    }\n\n    if (alloc || wcs->colax == 0x0) {\n      if (wcs->m_colax) {\n        // In case the caller fiddled with it.\n        wcs->colax = wcs->m_colax;\n\n      } else {\n        if ((wcs->colax = calloc(naxis, sizeof(int))) == 0x0) {\n          wcsfree(wcs);\n          return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n        }\n\n        wcs->m_flag  = WCSSET;\n        wcs->m_naxis = naxis;\n        wcs->m_colax = wcs->colax;\n      }\n    }\n\n    if (alloc || wcs->cname == 0x0) {\n      if (wcs->m_cname) {\n        // In case the caller fiddled with it.\n        wcs->cname = wcs->m_cname;\n\n      } else {\n        if ((wcs->cname = calloc(naxis, sizeof(char [72]))) == 0x0) {\n          wcsfree(wcs);\n          return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n        }\n\n        wcs->m_flag  = WCSSET;\n        wcs->m_naxis = naxis;\n        wcs->m_cname = wcs->cname;\n      }\n    }\n\n    if (alloc || wcs->crder == 0x0) {\n      if (wcs->m_crder) {\n        // In case the caller fiddled with it.\n        wcs->crder = wcs->m_crder;\n\n      } else {\n        if ((wcs->crder = calloc(naxis, sizeof(double))) == 0x0) {\n          wcsfree(wcs);\n          return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n        }\n\n        wcs->m_flag  = WCSSET;\n        wcs->m_naxis = naxis;\n        wcs->m_crder = wcs->crder;\n      }\n    }\n\n    if (alloc || wcs->csyer == 0x0) {\n      if (wcs->m_csyer) {\n        // In case the caller fiddled with it.\n        wcs->csyer = wcs->m_csyer;\n\n      } else {\n        if ((wcs->csyer = calloc(naxis, sizeof(double))) == 0x0) {\n          wcsfree(wcs);\n          return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n        }\n\n        wcs->m_flag  = WCSSET;\n        wcs->m_naxis = naxis;\n        wcs->m_csyer = wcs->csyer;\n      }\n    }\n\n    if (alloc || wcs->czphs == 0x0) {\n      if (wcs->m_czphs) {\n        // In case the caller fiddled with it.\n        wcs->czphs = wcs->m_czphs;\n\n      } else {\n        if ((wcs->czphs = calloc(naxis, sizeof(double))) == 0x0) {\n          wcsfree(wcs);\n          return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n        }\n\n        wcs->m_flag  = WCSSET;\n        wcs->m_naxis = naxis;\n        wcs->m_czphs = wcs->czphs;\n      }\n    }\n\n    if (alloc || wcs->cperi == 0x0) {\n      if (wcs->m_cperi) {\n        // In case the caller fiddled with it.\n        wcs->cperi = wcs->m_cperi;\n\n      } else {\n        if ((wcs->cperi = calloc(naxis, sizeof(double))) == 0x0) {\n          wcsfree(wcs);\n          return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n        }\n\n        wcs->m_flag  = WCSSET;\n        wcs->m_naxis = naxis;\n        wcs->m_cperi = wcs->cperi;\n      }\n    }\n  }\n\n\n  wcs->flag  = 0;\n  wcs->naxis = naxis;\n\n\n  // Set defaults for the linear transformation.\n  wcs->lin.crpix  = wcs->crpix;\n  wcs->lin.pc     = wcs->pc;\n  wcs->lin.cdelt  = wcs->cdelt;\n  if ((status = lininit(0, naxis, &(wcs->lin), ndpmax))) {\n    return wcserr_set(WCS_ERRMSG(wcs_linerr[status]));\n  }\n\n\n  // CRVALia defaults to 0.0.\n  for (i = 0; i < naxis; i++) {\n    wcs->crval[i] = 0.0;\n  }\n\n\n  // CUNITia and CTYPEia are blank by default.\n  for (i = 0; i < naxis; i++) {\n    memset(wcs->cunit[i], 0, 72);\n    memset(wcs->ctype[i], 0, 72);\n  }\n\n\n  // Set defaults for the celestial transformation parameters.\n  wcs->lonpole = UNDEFINED;\n  wcs->latpole = +90.0;\n\n  // Set defaults for the spectral transformation parameters.\n  wcs->restfrq = 0.0;\n  wcs->restwav = 0.0;\n\n  // Default parameter values.\n  wcs->npv = 0;\n  for (k = 0; k < wcs->npvmax; k++) {\n    wcs->pv[k].i = 0;\n    wcs->pv[k].m = 0;\n    wcs->pv[k].value = 0.0;\n  }\n\n  wcs->nps = 0;\n  for (k = 0; k < wcs->npsmax; k++) {\n    wcs->ps[k].i = 0;\n    wcs->ps[k].m = 0;\n    memset(wcs->ps[k].value, 0, 72);\n  }\n\n  // Defaults for alternate linear transformations.\n  cd = wcs->cd;\n  for (i = 0; i < naxis; i++) {\n    for (j = 0; j < naxis; j++) {\n      *(cd++) = 0.0;\n    }\n  }\n  for (i = 0; i < naxis; i++) {\n    wcs->crota[i] = 0.0;\n  }\n  wcs->altlin = 0;\n  wcs->velref = 0;\n\n  // Defaults for auxiliary coordinate system information.\n  memset(wcs->alt, 0, 4);\n  wcs->alt[0] = ' ';\n  wcs->colnum = 0;\n\n  for (i = 0; i < naxis; i++) {\n    wcs->colax[i] = 0;\n    memset(wcs->cname[i], 0, 72);\n    wcs->crder[i] = UNDEFINED;\n    wcs->csyer[i] = UNDEFINED;\n    wcs->czphs[i] = UNDEFINED;\n    wcs->cperi[i] = UNDEFINED;\n  }\n\n  memset(wcs->wcsname, 0, 72);\n\n  memset(wcs->timesys,  0, 72);\n  memset(wcs->trefpos,  0, 72);\n  memset(wcs->trefdir,  0, 72);\n  memset(wcs->plephem,  0, 72);\n\n  memset(wcs->timeunit, 0, 72);\n  memset(wcs->dateref,  0, 72);\n  wcs->mjdref[0]  = UNDEFINED;\n  wcs->mjdref[1]  = UNDEFINED;\n  wcs->timeoffs   = UNDEFINED;\n\n  memset(wcs->dateobs, 0, 72);\n  memset(wcs->datebeg, 0, 72);\n  memset(wcs->dateavg, 0, 72);\n  memset(wcs->dateend, 0, 72);\n  wcs->mjdobs     = UNDEFINED;\n  wcs->mjdbeg     = UNDEFINED;\n  wcs->mjdavg     = UNDEFINED;\n  wcs->mjdend     = UNDEFINED;\n  wcs->jepoch     = UNDEFINED;\n  wcs->bepoch     = UNDEFINED;\n  wcs->tstart     = UNDEFINED;\n  wcs->tstop      = UNDEFINED;\n  wcs->xposure    = UNDEFINED;\n  wcs->telapse    = UNDEFINED;\n\n  wcs->timsyer    = UNDEFINED;\n  wcs->timrder    = UNDEFINED;\n  wcs->timedel    = UNDEFINED;\n  wcs->timepixr   = UNDEFINED;\n\n  wcs->obsgeo[0]  = UNDEFINED;\n  wcs->obsgeo[1]  = UNDEFINED;\n  wcs->obsgeo[2]  = UNDEFINED;\n  wcs->obsgeo[3]  = UNDEFINED;\n  wcs->obsgeo[4]  = UNDEFINED;\n  wcs->obsgeo[5]  = UNDEFINED;\n  memset(wcs->obsorbit, 0, 72);\n  memset(wcs->radesys,  0, 72);\n  wcs->equinox    = UNDEFINED;\n  memset(wcs->specsys,  0, 72);\n  memset(wcs->ssysobs,  0, 72);\n  wcs->velosys    = UNDEFINED;\n  wcs->zsource    = UNDEFINED;\n  memset(wcs->ssyssrc,  0, 72);\n  wcs->velangl    = UNDEFINED;\n\n  // No additional auxiliary coordinate system information.\n  wcs->aux  = 0x0;\n\n  // Tabular parameters.\n  wcs->ntab = 0;\n  wcs->tab  = 0x0;\n  wcs->nwtb = 0;\n  wcs->wtb  = 0x0;\n\n  // Reset derived values.\n  strcpy(wcs->lngtyp, \"    \");\n  strcpy(wcs->lattyp, \"    \");\n  wcs->lng  = -1;\n  wcs->lat  = -1;\n  wcs->spec = -1;\n  wcs->cubeface = -1;\n\n  celini(&(wcs->cel));\n  spcini(&(wcs->spc));\n\n  return WCSERR_SUCCESS;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsauxi(\n  int alloc,\n  struct wcsprm *wcs)\n\n{\n  static const char *function = \"wcsauxi\";\n\n  struct auxprm *aux;\n  struct wcserr **err;\n\n  // Check inputs.\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n  err = &(wcs->err);\n\n  // Allocate memory if required.\n  if (alloc || wcs->aux == 0x0) {\n    if (wcs->m_aux) {\n      // In case the caller fiddled with it.\n      wcs->aux = wcs->m_aux;\n\n    } else {\n      if ((wcs->aux = malloc(sizeof(struct auxprm))) == 0x0) {\n        return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n      }\n\n      wcs->m_aux = wcs->aux;\n    }\n  }\n\n  aux = wcs->aux;\n  aux->rsun_ref = UNDEFINED;\n  aux->dsun_obs = UNDEFINED;\n  aux->crln_obs = UNDEFINED;\n  aux->hgln_obs = UNDEFINED;\n  aux->hglt_obs = UNDEFINED;\n\n  return WCSERR_SUCCESS;\n}\n\n//----------------------------------------------------------------------------\n\nint wcssub(\n  int alloc,\n  const struct wcsprm *wcssrc,\n  int *nsub,\n  int axes[],\n  struct wcsprm *wcsdst)\n\n{\n  static const char *function = \"wcssub\";\n\n  const char *pq = \"PQ\";\n  char *c, ctypei[16], ctmp[16], *fp;\n  int  axis, axmap[32], cubeface, dealloc, dummy, i, idp, itab, *itmp = 0x0,\n       j, jhat, k, latitude, longitude, m, *map, msub, naxis, ndp, ndpmax,\n       Nhat, npv, npvmax, nps, npsmax, ntmp, other, spectral, status, stokes;\n  const double *srcp;\n  double *dstp;\n  struct tabprm *tab;\n  struct disprm *dissrc, *disdst;\n  struct dpkey  *dpsrc,  *dpdst;\n  struct wcserr **err;\n\n  if (wcssrc == 0x0) return WCSERR_NULL_POINTER;\n  if (wcsdst == 0x0) return WCSERR_NULL_POINTER;\n  err = &(wcsdst->err);\n\n  // N.B. we do not rely on the wcsprm struct having been set up.\n  if ((naxis = wcssrc->naxis) <= 0) {\n    return wcserr_set(WCSERR_SET(WCSERR_MEMORY),\n      \"naxis must be positive (got %d)\", naxis);\n  }\n\n  if (nsub == 0x0) {\n    nsub = &dummy;\n    *nsub = naxis;\n  } else if (*nsub == 0) {\n    *nsub = naxis;\n  }\n\n  // Allocate enough temporary storage to hold either axes[] xor map[].\n  ntmp = (*nsub <= naxis) ? naxis : *nsub;\n  if ((itmp = calloc(ntmp, sizeof(int))) == 0x0) {\n    return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n  }\n\n  if ((dealloc = (axes == 0x0))) {\n    // Construct an index array.\n    if ((axes = calloc(naxis, sizeof(int))) == 0x0) {\n      free(itmp);\n      return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n    }\n\n    for (i = 0; i < naxis; i++) {\n      axes[i] = i+1;\n    }\n  }\n\n  // So that we don't try to free uninitialized pointers on cleanup.\n  wcsdst->m_aux = 0x0;\n  wcsdst->m_tab = 0x0;\n\n\n  msub = 0;\n  for (j = 0; j < *nsub; j++) {\n    axis = axes[j];\n\n    if (abs(axis) > 0x1000) {\n      // Subimage extraction by type.\n      k = abs(axis) & 0xFF;\n\n      longitude = k & WCSSUB_LONGITUDE;\n      latitude  = k & WCSSUB_LATITUDE;\n      cubeface  = k & WCSSUB_CUBEFACE;\n      spectral  = k & WCSSUB_SPECTRAL;\n      stokes    = k & WCSSUB_STOKES;\n\n      if ((other = (axis < 0))) {\n        longitude = !longitude;\n        latitude  = !latitude;\n        cubeface  = !cubeface;\n        spectral  = !spectral;\n        stokes    = !stokes;\n      }\n\n      for (i = 0; i < naxis; i++) {\n        strncpy (ctypei, (char *)(wcssrc->ctype + i), 8);\n        ctypei[8] = '\\0';\n\n        // Find the last non-blank character.\n        c = ctypei + 8;\n        while (c-- > ctypei) {\n          if (*c == ' ') *c = '\\0';\n          if (*c != '\\0') break;\n        }\n\n        if (\n          strcmp(ctypei,   \"RA\")  == 0 ||\n          strcmp(ctypei+1, \"LON\") == 0 ||\n          strcmp(ctypei+2, \"LN\")  == 0 ||\n          strncmp(ctypei,   \"RA---\", 5) == 0 ||\n          strncmp(ctypei+1, \"LON-\", 4) == 0 ||\n          strncmp(ctypei+2, \"LN-\", 3) == 0) {\n          if (!longitude) {\n            continue;\n          }\n\n        } else if (\n          strcmp(ctypei,   \"DEC\") == 0 ||\n          strcmp(ctypei+1, \"LAT\") == 0 ||\n          strcmp(ctypei+2, \"LT\")  == 0 ||\n          strncmp(ctypei,   \"DEC--\", 5) == 0 ||\n          strncmp(ctypei+1, \"LAT-\", 4) == 0 ||\n          strncmp(ctypei+2, \"LT-\", 3) == 0) {\n          if (!latitude) {\n            continue;\n          }\n\n        } else if (strcmp(ctypei, \"CUBEFACE\") == 0) {\n          if (!cubeface) {\n            continue;\n          }\n\n        } else if ((\n          strncmp(ctypei, \"FREQ\", 4) == 0 ||\n          strncmp(ctypei, \"ENER\", 4) == 0 ||\n          strncmp(ctypei, \"WAVN\", 4) == 0 ||\n          strncmp(ctypei, \"VRAD\", 4) == 0 ||\n          strncmp(ctypei, \"WAVE\", 4) == 0 ||\n          strncmp(ctypei, \"VOPT\", 4) == 0 ||\n          strncmp(ctypei, \"ZOPT\", 4) == 0 ||\n          strncmp(ctypei, \"AWAV\", 4) == 0 ||\n          strncmp(ctypei, \"VELO\", 4) == 0 ||\n          strncmp(ctypei, \"BETA\", 4) == 0) &&\n          (ctypei[4] == '\\0' || ctypei[4] == '-')) {\n          if (!spectral) {\n            continue;\n          }\n\n        } else if (strcmp(ctypei, \"STOKES\") == 0) {\n          if (!stokes) {\n            continue;\n          }\n\n        } else if (!other) {\n          continue;\n        }\n\n        // This axis is wanted, but has it already been added?\n        for (k = 0; k < msub; k++) {\n          if (itmp[k] == i+1) {\n            break;\n          }\n        }\n        if (k == msub) itmp[msub++] = i+1;\n      }\n\n    } else if (0 < axis && axis <= naxis) {\n      // Check that the requested axis has not already been added.\n      for (k = 0; k < msub; k++) {\n        if (itmp[k] == axis) {\n          break;\n        }\n      }\n      if (k == msub) itmp[msub++] = axis;\n\n    } else if (axis == 0) {\n      // Graft on a new axis.\n      itmp[msub++] = 0;\n\n    } else {\n      status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_SUBIMAGE));\n      goto cleanup;\n    }\n  }\n\n  if ((*nsub = msub) == 0) {\n    // Zero out this struct.\n    status = wcsinit(alloc, 0, wcsdst, 0, 0, 0);\n    goto cleanup;\n  }\n\n  for (i = 0; i < *nsub; i++) {\n    axes[i] = itmp[i];\n  }\n\n\n  // Construct the inverse axis map (i is 0-relative, j is 1-relative):\n  // axes[i] == j means that output axis i+1 comes from input axis j,\n  // axes[i] == 0 means to create a new axis,\n  //  map[i] == j means that input axis i+1 goes to output axis j,\n  //  map[i] == 0 means that input axis i+1 is not used.\n  map = itmp;\n  for (i = 0; i < naxis; i++) {\n    map[i] = 0;\n  }\n\n  for (i = 0; i < *nsub; i++) {\n    if (axes[i] > 0) {\n      map[axes[i]-1] = i+1;\n    }\n  }\n\n\n  // Check that the subimage coordinate system is separable.  First check\n  // non-zero, off-diagonal elements of the linear transformation matrix.\n  srcp = wcssrc->pc;\n  for (i = 0; i < naxis; i++) {\n    for (j = 0; j < naxis; j++) {\n      if (*(srcp++) == 0.0 || j == i) continue;\n\n      if ((map[i] == 0) != (map[j] == 0)) {\n        status = wcserr_set(WCS_ERRMSG(WCSERR_NON_SEPARABLE));\n        goto cleanup;\n      }\n    }\n  }\n\n  // Now check for distortions that depend on other axes.  As the disprm\n  // struct may not have been initialized, we must parse the dpkey entries.\n  ndpmax = 0;\n  for (m = 0; m < 2; m++) {\n    if (m == 0) {\n      dissrc = wcssrc->lin.dispre;\n    } else {\n      dissrc = wcssrc->lin.disseq;\n    }\n\n    ndp = 0;\n    if (dissrc != 0x0) {\n      for (j = 0; j < naxis; j++) {\n        if (map[j] == 0) continue;\n\n        // Axis numbers in axmap[] are 0-relative.\n        for (jhat = 0; jhat < 32; jhat++) {\n          axmap[jhat] = -1;\n        }\n\n        Nhat = 0;\n        dpsrc = dissrc->dp;\n        for (idp = 0; idp < dissrc->ndp; idp++, dpsrc++) {\n          // Thorough error checking will be done later by disset().\n          if (dpsrc->j != j+1) continue;\n          if (dpsrc->field[1] != pq[m]) continue;\n          if ((fp = strchr(dpsrc->field, '.')) == 0x0) continue;\n          fp++;\n\n          ndp++;\n\n          if (strncmp(fp, \"NAXES\", 6) == 0) {\n            Nhat = dpkeyi(dpsrc);\n          } else if (strncmp(fp, \"AXIS.\", 5) == 0) {\n            sscanf(fp+5, \"%d\", &jhat);\n            axmap[jhat-1] = dpkeyi(dpsrc) - 1;\n          }\n        }\n\n        if (Nhat < 0 || (Nhat == 0 && 1 < ndp) || naxis < Nhat || 32 < Nhat) {\n          status = wcserr_set(WCSERR_SET(WCSERR_BAD_PARAM),\n            \"NAXES was not set (or bad) for %s distortion on axis %d\",\n            dissrc->dtype[j], j+1);\n          goto cleanup;\n        }\n\n        for (jhat = 0; jhat < Nhat; jhat++) {\n          if (axmap[jhat] < 0) {\n            axmap[jhat] = jhat;\n\n            // Make room for an additional DPja.AXIS.j record.\n            ndp++;\n          }\n\n          if (map[axmap[jhat]] == 0) {\n            // Distortion depends on an axis excluded from the subimage.\n            status = wcserr_set(WCS_ERRMSG(WCSERR_NON_SEPARABLE));\n            goto cleanup;\n          }\n        }\n      }\n    }\n\n    if (ndpmax < ndp) ndpmax = ndp;\n  }\n\n\n  // Number of PVi_ma records in the subimage.\n  npvmax = 0;\n  for (m = 0; m < wcssrc->npv; m++) {\n    i = wcssrc->pv[m].i;\n    if (i == 0 || (i > 0 && map[i-1])) {\n      npvmax++;\n    }\n  }\n\n  // Number of PSi_ma records in the subimage.\n  npsmax = 0;\n  for (m = 0; m < wcssrc->nps; m++) {\n    i = wcssrc->ps[m].i;\n    if (i > 0 && map[i-1]) {\n      npsmax++;\n    }\n  }\n\n  // Initialize the destination.\n  status = wcsinit(alloc, *nsub, wcsdst, npvmax, npsmax, ndpmax);\n\n  for (m = 0; m < 2; m++) {\n    if (m == 0) {\n      dissrc = wcssrc->lin.dispre;\n      disdst = wcsdst->lin.dispre;\n    } else {\n      dissrc = wcssrc->lin.disseq;\n      disdst = wcsdst->lin.disseq;\n    }\n\n    if (dissrc && !disdst) {\n      if ((disdst = calloc(1, sizeof(struct disprm))) == 0x0) {\n        return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n      }\n\n      // Also inits disdst.\n      disdst->flag = -1;\n      lindist(m+1, &(wcsdst->lin), disdst, ndpmax);\n    }\n  }\n\n  if (status) {\n    goto cleanup;\n  }\n\n\n  // Linear transformation.\n  srcp = wcssrc->crpix;\n  dstp = wcsdst->crpix;\n  for (j = 0; j < *nsub; j++, dstp++) {\n    if (axes[j] > 0) {\n      k = axes[j] - 1;\n      *dstp = *(srcp+k);\n    }\n  }\n\n  srcp = wcssrc->pc;\n  dstp = wcsdst->pc;\n  for (i = 0; i < *nsub; i++) {\n    for (j = 0; j < *nsub; j++, dstp++) {\n      if (axes[i] > 0 && axes[j] > 0) {\n        k = (axes[i]-1)*naxis + (axes[j]-1);\n        *dstp = *(srcp+k);\n      }\n    }\n  }\n\n  srcp = wcssrc->cdelt;\n  dstp = wcsdst->cdelt;\n  for (i = 0; i < *nsub; i++, dstp++) {\n    if (axes[i] > 0) {\n      k = axes[i] - 1;\n      *dstp = *(srcp+k);\n    }\n  }\n\n  // Coordinate reference value.\n  srcp = wcssrc->crval;\n  dstp = wcsdst->crval;\n  for (i = 0; i < *nsub; i++, dstp++) {\n    if (axes[i] > 0) {\n      k = axes[i] - 1;\n      *dstp = *(srcp+k);\n    }\n  }\n\n  // Coordinate units and type.\n  for (i = 0; i < *nsub; i++) {\n    if (axes[i] > 0) {\n      k = axes[i] - 1;\n      strncpy(wcsdst->cunit[i], wcssrc->cunit[k], 72);\n      strncpy(wcsdst->ctype[i], wcssrc->ctype[k], 72);\n    }\n  }\n\n  // Celestial and spectral transformation parameters.\n  wcsdst->lonpole = wcssrc->lonpole;\n  wcsdst->latpole = wcssrc->latpole;\n  wcsdst->restfrq = wcssrc->restfrq;\n  wcsdst->restwav = wcssrc->restwav;\n\n  // Parameter values.\n  npv = 0;\n  for (m = 0; m < wcssrc->npv; m++) {\n    i = wcssrc->pv[m].i;\n    if (i == 0) {\n      // i == 0 is a special code that means \"the latitude axis\".\n      wcsdst->pv[npv] = wcssrc->pv[m];\n      wcsdst->pv[npv].i = 0;\n      npv++;\n    } else if (i > 0 && map[i-1]) {\n      wcsdst->pv[npv] = wcssrc->pv[m];\n      wcsdst->pv[npv].i = map[i-1];\n      npv++;\n    }\n  }\n  wcsdst->npv = npv;\n\n  nps = 0;\n  for (m = 0; m < wcssrc->nps; m++) {\n    i = wcssrc->ps[m].i;\n    if (i > 0 && map[i-1]) {\n      wcsdst->ps[nps] = wcssrc->ps[m];\n      wcsdst->ps[nps].i = map[i-1];\n      nps++;\n    }\n  }\n  wcsdst->nps = nps;\n\n  // Alternate linear transformations.\n  if (wcssrc->cd) {\n    srcp = wcssrc->cd;\n    dstp = wcsdst->cd;\n    for (i = 0; i < *nsub; i++) {\n      for (j = 0; j < *nsub; j++, dstp++) {\n        if (axes[i] > 0 && axes[j] > 0) {\n          k = (axes[i]-1)*naxis + (axes[j]-1);\n          *dstp = *(srcp+k);\n        } else if (i == j && wcssrc->altlin & 2) {\n          // A new axis is being created where CDi_ja was present in the input\n          // header, so override the default value of 0 set by wcsinit().\n          *dstp = 1.0;\n        }\n      }\n    }\n  }\n\n  if (wcssrc->crota) {\n    srcp = wcssrc->crota;\n    dstp = wcsdst->crota;\n    for (i = 0; i < *nsub; i++, dstp++) {\n      if (axes[i] > 0) {\n        k = axes[i] - 1;\n        *dstp = *(srcp+k);\n      }\n    }\n  }\n\n  wcsdst->altlin = wcssrc->altlin;\n  wcsdst->velref = wcssrc->velref;\n\n  // Auxiliary coordinate system information.\n  strncpy(wcsdst->alt, wcssrc->alt, 4);\n  wcsdst->colnum = wcssrc->colnum;\n\n  for (i = 0; i < *nsub; i++) {\n    if (axes[i] > 0) {\n      k = axes[i] - 1;\n      if (wcssrc->colax) wcsdst->colax[i] = wcssrc->colax[k];\n      if (wcssrc->cname) strncpy(wcsdst->cname[i], wcssrc->cname[k], 72);\n      if (wcssrc->crder) wcsdst->crder[i] = wcssrc->crder[k];\n      if (wcssrc->csyer) wcsdst->csyer[i] = wcssrc->csyer[k];\n      if (wcssrc->czphs) wcsdst->czphs[i] = wcssrc->czphs[k];\n      if (wcssrc->cperi) wcsdst->cperi[i] = wcssrc->cperi[k];\n    }\n  }\n\n  strncpy(wcsdst->wcsname, wcssrc->wcsname, 72);\n\n  strncpy(wcsdst->timesys, wcssrc->timesys, 72);\n  strncpy(wcsdst->trefpos, wcssrc->trefpos, 72);\n  strncpy(wcsdst->trefdir, wcssrc->trefdir, 72);\n  strncpy(wcsdst->plephem, wcssrc->plephem, 72);\n\n  strncpy(wcsdst->timeunit, wcssrc->timeunit, 72);\n  strncpy(wcsdst->dateref,  wcssrc->dateref, 72);\n  wcsdst->mjdref[0] = wcssrc->mjdref[0];\n  wcsdst->mjdref[1] = wcssrc->mjdref[1];\n  wcsdst->timeoffs  = wcssrc->timeoffs;\n\n  strncpy(wcsdst->dateobs, wcssrc->dateobs, 72);\n  strncpy(wcsdst->datebeg, wcssrc->datebeg, 72);\n  strncpy(wcsdst->dateavg, wcssrc->dateavg, 72);\n  strncpy(wcsdst->dateend, wcssrc->dateend, 72);\n\n  wcsdst->mjdobs  = wcssrc->mjdobs;\n  wcsdst->mjdbeg  = wcssrc->mjdbeg;\n  wcsdst->mjdavg  = wcssrc->mjdavg;\n  wcsdst->mjdend  = wcssrc->mjdend;\n  wcsdst->jepoch  = wcssrc->jepoch;\n  wcsdst->bepoch  = wcssrc->bepoch;\n  wcsdst->tstart  = wcssrc->tstart;\n  wcsdst->tstop   = wcssrc->tstop;\n  wcsdst->xposure = wcssrc->xposure;\n  wcsdst->telapse = wcssrc->telapse;\n\n  wcsdst->timsyer  = wcssrc->timsyer;\n  wcsdst->timrder  = wcssrc->timrder;\n  wcsdst->timedel  = wcssrc->timedel;\n  wcsdst->timepixr = wcssrc->timepixr;\n\n  wcsdst->obsgeo[0] = wcssrc->obsgeo[0];\n  wcsdst->obsgeo[1] = wcssrc->obsgeo[1];\n  wcsdst->obsgeo[2] = wcssrc->obsgeo[2];\n  wcsdst->obsgeo[3] = wcssrc->obsgeo[3];\n  wcsdst->obsgeo[4] = wcssrc->obsgeo[4];\n  wcsdst->obsgeo[5] = wcssrc->obsgeo[5];\n\n  strncpy(wcsdst->obsorbit, wcssrc->obsorbit, 72);\n  strncpy(wcsdst->radesys,  wcssrc->radesys, 72);\n  wcsdst->equinox = wcssrc->equinox;\n  strncpy(wcsdst->specsys,  wcssrc->specsys, 72);\n  strncpy(wcsdst->ssysobs,  wcssrc->ssysobs, 72);\n  wcsdst->velosys = wcssrc->velosys;\n  wcsdst->zsource = wcssrc->zsource;\n  strncpy(wcsdst->ssyssrc,  wcssrc->ssyssrc, 72);\n  wcsdst->velangl = wcssrc->velangl;\n\n\n  // Additional auxiliary coordinate system information.\n  if (wcssrc->aux && !wcsdst->aux) {\n    if ((wcsdst->aux = calloc(1, sizeof(struct auxprm))) == 0x0) {\n      status = wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n      goto cleanup;\n    }\n\n    wcsdst->m_aux = wcsdst->aux;\n\n    wcsdst->aux->rsun_ref = wcssrc->aux->rsun_ref;\n    wcsdst->aux->dsun_obs = wcssrc->aux->dsun_obs;\n    wcsdst->aux->crln_obs = wcssrc->aux->crln_obs;\n    wcsdst->aux->hgln_obs = wcssrc->aux->hgln_obs;\n    wcsdst->aux->hglt_obs = wcssrc->aux->hglt_obs;\n  }\n\n\n  // Coordinate lookup tables; only copy what's needed.\n  wcsdst->ntab = 0;\n  for (itab = 0; itab < wcssrc->ntab; itab++) {\n    // Is this table wanted?\n    for (m = 0; m < wcssrc->tab[itab].M; m++) {\n      i = wcssrc->tab[itab].map[m];\n\n      if (map[i]) {\n        wcsdst->ntab++;\n        break;\n      }\n    }\n  }\n\n  if (wcsdst->ntab) {\n    // Allocate memory for tabprm structs.\n    if ((wcsdst->tab = calloc(wcsdst->ntab, sizeof(struct tabprm))) == 0x0) {\n      wcsdst->ntab = 0;\n\n      status = wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n      goto cleanup;\n    }\n\n    wcsdst->m_tab = wcsdst->tab;\n  }\n\n  tab = wcsdst->tab;\n  for (itab = 0; itab < wcssrc->ntab; itab++) {\n    for (m = 0; m < wcssrc->tab[itab].M; m++) {\n      i = wcssrc->tab[itab].map[m];\n\n      if (map[i]) {\n        if ((status = tabcpy(1, wcssrc->tab + itab, tab))) {\n          wcserr_set(WCS_ERRMSG(wcs_taberr[status]));\n          goto cleanup;\n        }\n\n        tab++;\n        break;\n      }\n    }\n  }\n\n\n  // Distortion parameters (in linprm).\n  for (m = 0; m < 2; m++) {\n    if (m == 0) {\n      dissrc = wcssrc->lin.dispre;\n      disdst = wcsdst->lin.dispre;\n    } else {\n      dissrc = wcssrc->lin.disseq;\n      disdst = wcsdst->lin.disseq;\n    }\n\n    if (dissrc) {\n      disdst->naxis = *nsub;\n\n      // Distortion type and maximum distortion (but not total distortion).\n      for (j = 0; j < *nsub; j++) {\n        if (axes[j] > 0) {\n          k = axes[j] - 1;\n          strncpy(disdst->dtype[j], dissrc->dtype[k], 72);\n          disdst->maxdis[j] = dissrc->maxdis[k];\n        }\n      }\n\n      // DPja or DQia keyvalues.\n      ndp = 0;\n      dpdst = disdst->dp;\n      for (j = 0; j < *nsub; j++) {\n        if (axes[j] == 0) continue;\n\n        // Determine the axis mapping.\n        for (jhat = 0; jhat < 32; jhat++) {\n          axmap[jhat] = -1;\n        }\n\n        Nhat = 0;\n        dpsrc = dissrc->dp;\n        for (idp = 0; idp < dissrc->ndp; idp++, dpsrc++) {\n          if (dpsrc->j != axes[j]) continue;\n          if (dpsrc->field[1] != pq[m]) continue;\n          if ((fp = strchr(dpsrc->field, '.')) == 0x0) continue;\n          fp++;\n\n          if (strncmp(fp, \"NAXES\", 6) == 0) {\n            Nhat = dpkeyi(dpsrc);\n          } else if (strncmp(fp, \"AXIS.\", 5) == 0) {\n            sscanf(fp+5, \"%d\", &jhat);\n            axmap[jhat-1] = dpkeyi(dpsrc) - 1;\n          }\n        }\n\n        for (jhat = 0; jhat < Nhat; jhat++) {\n          if (axmap[jhat] < 0) {\n            axmap[jhat] = jhat;\n          }\n        }\n\n        // Copy the DPja or DQia keyvalues.\n        dpsrc = dissrc->dp;\n        for (idp = 0; idp < dissrc->ndp; idp++, dpsrc++) {\n          if (dpsrc->j != axes[j]) continue;\n          if (dpsrc->field[1] != pq[m]) continue;\n          if ((fp = strchr(dpsrc->field, '.')) == 0x0) continue;\n          fp++;\n\n          if (strncmp(fp, \"AXIS.\", 5) == 0) {\n            // Skip it, we will create our own later.\n            continue;\n          }\n\n          *dpdst = *dpsrc;\n          sprintf(ctmp, \"%d\", j+1);\n          dpdst->field[2] = ctmp[0];\n          dpdst->j = j+1;\n\n          ndp++;\n          dpdst++;\n\n          if (strncmp(fp, \"NAXES\", 6) == 0) {\n            for (jhat = 0; jhat < Nhat; jhat++) {\n              strcpy(dpdst->field, dpsrc->field);\n              dpdst->field[2] = ctmp[0];\n              fp = strchr(dpdst->field, '.') + 1;\n              sprintf(fp, \"AXIS.%d\", jhat+1);\n              dpdst->j = j+1;\n              dpdst->type = 0;\n              dpdst->value.i = map[axmap[jhat]];\n\n              ndp++;\n              dpdst++;\n            }\n          }\n        }\n      }\n\n      disdst->ndp = ndp;\n    }\n  }\n\n\ncleanup:\n  if (itmp) free(itmp);\n  if (dealloc) {\n    free(axes);\n  }\n\n  if (status && wcsdst->m_aux) {\n    free(wcsdst->m_aux);\n    wcsdst->aux   = 0x0;\n    wcsdst->m_aux = 0x0;\n  }\n\n  if (status && wcsdst->m_tab) {\n    free(wcsdst->m_tab);\n    wcsdst->tab   = 0x0;\n    wcsdst->m_tab = 0x0;\n  }\n\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint wcscompare(\n  int cmp,\n  double tol,\n  const struct wcsprm *wcs1,\n  const struct wcsprm *wcs2,\n  int *equal)\n\n{\n  int i, j, naxis, naxis2;\n  double diff;\n  int tab_equal;\n  int status;\n\n  if (wcs1  == 0x0) return WCSERR_NULL_POINTER;\n  if (wcs2  == 0x0) return WCSERR_NULL_POINTER;\n  if (equal == 0x0) return WCSERR_NULL_POINTER;\n\n  *equal = 0;\n\n  if (wcs1->naxis != wcs2->naxis) {\n    return 0;\n  }\n\n  naxis = wcs1->naxis;\n  naxis2 = wcs1->naxis*wcs1->naxis;\n\n  if (cmp & WCSCOMPARE_CRPIX) {\n    // Don't compare crpix.\n  } else if (cmp & WCSCOMPARE_TILING) {\n    for (i = 0; i < naxis; ++i) {\n      diff = wcs1->crpix[i] - wcs2->crpix[i];\n      if ((double)(int)(diff) != diff) {\n        return 0;\n      }\n    }\n  } else {\n    if (!wcsutil_dblEq(naxis, tol, wcs1->crpix, wcs2->crpix)) {\n      return 0;\n    }\n  }\n\n  if (!wcsutil_dblEq(naxis2, tol, wcs1->pc, wcs2->pc) ||\n      !wcsutil_dblEq(naxis, tol, wcs1->cdelt, wcs2->cdelt) ||\n      !wcsutil_dblEq(naxis, tol, wcs1->crval, wcs2->crval) ||\n      !wcsutil_strEq(naxis, wcs1->cunit, wcs2->cunit) ||\n      !wcsutil_strEq(naxis, wcs1->ctype, wcs2->ctype) ||\n      !wcsutil_dblEq(1, tol, &wcs1->lonpole, &wcs2->lonpole) ||\n      !wcsutil_dblEq(1, tol, &wcs1->latpole, &wcs2->latpole) ||\n      !wcsutil_dblEq(1, tol, &wcs1->restfrq, &wcs2->restfrq) ||\n      !wcsutil_dblEq(1, tol, &wcs1->restwav, &wcs2->restwav) ||\n      wcs1->npv != wcs2->npv ||\n      wcs1->nps != wcs2->nps) {\n    return 0;\n  }\n\n  // Compare pv cards, which may not be in the same order\n  for (i = 0; i < wcs1->npv; ++i) {\n    for (j = 0; j < wcs2->npv; ++j) {\n      if (wcs1->pv[i].i == wcs2->pv[j].i &&\n          wcs1->pv[i].m == wcs2->pv[j].m) {\n        if (!wcsutil_dblEq(1, tol, &wcs1->pv[i].value, &wcs2->pv[j].value)) {\n          return 0;\n        }\n        break;\n      }\n    }\n    // We didn't find a match, so they are not equal\n    if (j == wcs2->npv) {\n      return 0;\n    }\n  }\n\n  // Compare ps cards, which may not be in the same order\n  for (i = 0; i < wcs1->nps; ++i) {\n    for (j = 0; j < wcs2->nps; ++j) {\n      if (wcs1->ps[i].i == wcs2->ps[j].i &&\n          wcs1->ps[i].m == wcs2->ps[j].m) {\n        if (strncmp(wcs1->ps[i].value, wcs2->ps[j].value, 72)) {\n          return 0;\n        }\n        break;\n      }\n    }\n    // We didn't find a match, so they are not equal\n    if (j == wcs2->nps) {\n      return 0;\n    }\n  }\n\n  if (wcs1->flag != WCSSET || wcs2->flag != WCSSET) {\n    if (!wcsutil_dblEq(naxis2, tol, wcs1->cd, wcs2->cd) ||\n        !wcsutil_dblEq(naxis, tol, wcs1->crota, wcs2->crota) ||\n        wcs1->altlin != wcs2->altlin ||\n        wcs1->velref != wcs2->velref) {\n      return 0;\n    }\n  }\n\n  if (!(cmp & WCSCOMPARE_ANCILLARY)) {\n    if (strncmp(wcs1->alt, wcs2->alt, 4) ||\n        wcs1->colnum != wcs2->colnum ||\n        !wcsutil_intEq(naxis, wcs1->colax, wcs2->colax) ||\n        !wcsutil_strEq(naxis, wcs1->cname, wcs2->cname) ||\n        !wcsutil_dblEq(naxis, tol, wcs1->crder, wcs2->crder) ||\n        !wcsutil_dblEq(naxis, tol, wcs1->csyer, wcs2->csyer) ||\n        !wcsutil_dblEq(naxis, tol, wcs1->czphs, wcs2->czphs) ||\n        !wcsutil_dblEq(naxis, tol, wcs1->cperi, wcs2->cperi) ||\n        strncmp(wcs1->wcsname,  wcs2->wcsname,  72) ||\n        strncmp(wcs1->timesys,  wcs2->timesys,  72) ||\n        strncmp(wcs1->trefpos,  wcs2->trefpos,  72) ||\n        strncmp(wcs1->trefdir,  wcs2->trefdir,  72) ||\n        strncmp(wcs1->plephem,  wcs2->plephem,  72) ||\n        strncmp(wcs1->timeunit, wcs2->timeunit, 72) ||\n        strncmp(wcs1->dateref,  wcs2->dateref,  72) ||\n        !wcsutil_dblEq(2, tol,  wcs1->mjdref,    wcs2->mjdref)   ||\n        !wcsutil_dblEq(1, tol, &wcs1->timeoffs, &wcs2->timeoffs) ||\n        strncmp(wcs1->dateobs,  wcs2->dateobs, 72) ||\n        strncmp(wcs1->datebeg,  wcs2->datebeg, 72) ||\n        strncmp(wcs1->dateavg,  wcs2->dateavg, 72) ||\n        strncmp(wcs1->dateend,  wcs2->dateend, 72) ||\n        !wcsutil_dblEq(1, tol, &wcs1->mjdobs,   &wcs2->mjdobs)   ||\n        !wcsutil_dblEq(1, tol, &wcs1->mjdbeg,   &wcs2->mjdbeg)   ||\n        !wcsutil_dblEq(1, tol, &wcs1->mjdavg,   &wcs2->mjdavg)   ||\n        !wcsutil_dblEq(1, tol, &wcs1->mjdend,   &wcs2->mjdend)   ||\n        !wcsutil_dblEq(1, tol, &wcs1->jepoch,   &wcs2->jepoch)   ||\n        !wcsutil_dblEq(1, tol, &wcs1->bepoch,   &wcs2->bepoch)   ||\n        !wcsutil_dblEq(1, tol, &wcs1->tstart,   &wcs2->tstart)   ||\n        !wcsutil_dblEq(1, tol, &wcs1->tstop,    &wcs2->tstop)    ||\n        !wcsutil_dblEq(1, tol, &wcs1->xposure,  &wcs2->xposure)  ||\n        !wcsutil_dblEq(1, tol, &wcs1->telapse,  &wcs2->telapse)  ||\n        !wcsutil_dblEq(1, tol, &wcs1->timsyer,  &wcs2->timsyer)  ||\n        !wcsutil_dblEq(1, tol, &wcs1->timrder,  &wcs2->timrder)  ||\n        !wcsutil_dblEq(1, tol, &wcs1->timedel,  &wcs2->timedel)  ||\n        !wcsutil_dblEq(1, tol, &wcs1->timepixr, &wcs2->timepixr) ||\n        !wcsutil_dblEq(6, tol,  wcs1->obsgeo,    wcs2->obsgeo)   ||\n        strncmp(wcs1->obsorbit, wcs2->obsorbit, 72) ||\n        strncmp(wcs1->radesys,  wcs2->radesys,  72) ||\n        !wcsutil_dblEq(1, tol, &wcs1->equinox,  &wcs2->equinox)  ||\n        strncmp(wcs1->specsys,  wcs2->specsys,  72) ||\n        strncmp(wcs1->ssysobs,  wcs2->ssysobs,  72) ||\n        !wcsutil_dblEq(1, tol, &wcs1->velosys,  &wcs2->velosys)  ||\n        !wcsutil_dblEq(1, tol, &wcs1->zsource,  &wcs2->zsource)  ||\n        strncmp(wcs1->ssyssrc,  wcs2->ssyssrc,  72) ||\n        !wcsutil_dblEq(1, tol, &wcs1->velangl,  &wcs2->velangl)) {\n      return 0;\n    }\n\n    // Compare additional auxiliary parameters.\n    if (wcs1->aux && wcs2->aux) {\n      if (!wcsutil_dblEq(1, tol, &wcs1->aux->rsun_ref, &wcs2->aux->rsun_ref) ||\n          !wcsutil_dblEq(1, tol, &wcs1->aux->dsun_obs, &wcs2->aux->dsun_obs) ||\n          !wcsutil_dblEq(1, tol, &wcs1->aux->crln_obs, &wcs2->aux->crln_obs) ||\n          !wcsutil_dblEq(1, tol, &wcs1->aux->hgln_obs, &wcs2->aux->hgln_obs) ||\n          !wcsutil_dblEq(1, tol, &wcs1->aux->hglt_obs, &wcs2->aux->hglt_obs)) {\n        return 0;\n      }\n    } else if (wcs1->aux || wcs2->aux) {\n      return 0;\n    }\n  }\n\n  // Compare tabular parameters\n  if (wcs1->ntab != wcs2->ntab) {\n    return 0;\n  }\n\n  for (i = 0; i < wcs1->ntab; ++i) {\n    if ((status = tabcmp(0, tol, &wcs1->tab[i], &wcs2->tab[i], &tab_equal))) {\n      return status;\n    }\n    if (!tab_equal) {\n      return 0;\n    }\n  }\n\n  *equal = 1;\n  return 0;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsfree(struct wcsprm *wcs)\n\n{\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n\n  if (wcs->flag == -1) {\n    wcs->lin.flag = -1;\n\n  } else {\n    // Optionally allocated by wcsinit() for given parameters.\n    if (wcs->m_flag == WCSSET) {\n      // Start by cleaning the slate.\n      if (wcs->crpix == wcs->m_crpix) wcs->crpix = 0x0;\n      if (wcs->pc    == wcs->m_pc)    wcs->pc    = 0x0;\n      if (wcs->cdelt == wcs->m_cdelt) wcs->cdelt = 0x0;\n      if (wcs->crval == wcs->m_crval) wcs->crval = 0x0;\n      if (wcs->cunit == wcs->m_cunit) wcs->cunit = 0x0;\n      if (wcs->ctype == wcs->m_ctype) wcs->ctype = 0x0;\n      if (wcs->pv    == wcs->m_pv)    wcs->pv    = 0x0;\n      if (wcs->ps    == wcs->m_ps)    wcs->ps    = 0x0;\n      if (wcs->cd    == wcs->m_cd)    wcs->cd    = 0x0;\n      if (wcs->crota == wcs->m_crota) wcs->crota = 0x0;\n      if (wcs->colax == wcs->m_colax) wcs->colax = 0x0;\n      if (wcs->cname == wcs->m_cname) wcs->cname = 0x0;\n      if (wcs->crder == wcs->m_crder) wcs->crder = 0x0;\n      if (wcs->csyer == wcs->m_csyer) wcs->csyer = 0x0;\n      if (wcs->czphs == wcs->m_czphs) wcs->czphs = 0x0;\n      if (wcs->cperi == wcs->m_cperi) wcs->cperi = 0x0;\n\n      if (wcs->aux   == wcs->m_aux)   wcs->aux   = 0x0;\n      if (wcs->tab   == wcs->m_tab)   wcs->tab   = 0x0;\n      if (wcs->wtb   == wcs->m_wtb)   wcs->wtb   = 0x0;\n\n      // Now release the memory.\n      if (wcs->m_crpix)  free(wcs->m_crpix);\n      if (wcs->m_pc)     free(wcs->m_pc);\n      if (wcs->m_cdelt)  free(wcs->m_cdelt);\n      if (wcs->m_crval)  free(wcs->m_crval);\n      if (wcs->m_cunit)  free(wcs->m_cunit);\n      if (wcs->m_ctype)  free(wcs->m_ctype);\n      if (wcs->m_pv)     free(wcs->m_pv);\n      if (wcs->m_ps)     free(wcs->m_ps);\n      if (wcs->m_cd)     free(wcs->m_cd);\n      if (wcs->m_crota)  free(wcs->m_crota);\n      if (wcs->m_colax)  free(wcs->m_colax);\n      if (wcs->m_cname)  free(wcs->m_cname);\n      if (wcs->m_crder)  free(wcs->m_crder);\n      if (wcs->m_csyer)  free(wcs->m_csyer);\n      if (wcs->m_czphs)  free(wcs->m_czphs);\n      if (wcs->m_cperi)  free(wcs->m_cperi);\n\n      // May have been allocated by wcspih() or wcssub().\n      if (wcs->m_aux) free(wcs->m_aux);\n\n      // Allocated unconditionally by wcstab().\n      if (wcs->m_tab) {\n        for (int itab = 0; itab < wcs->ntab; itab++) {\n          tabfree(wcs->m_tab + itab);\n        }\n\n        free(wcs->m_tab);\n      }\n      if (wcs->m_wtb) free(wcs->m_wtb);\n    }\n\n    // Allocated unconditionally by wcsset().\n    if (wcs->types) free(wcs->types);\n\n    if (wcs->lin.crpix == wcs->m_crpix) wcs->lin.crpix = 0x0;\n    if (wcs->lin.pc    == wcs->m_pc)    wcs->lin.pc    = 0x0;\n    if (wcs->lin.cdelt == wcs->m_cdelt) wcs->lin.cdelt = 0x0;\n  }\n\n  wcs->m_flag   = 0;\n  wcs->m_naxis  = 0x0;\n  wcs->m_crpix  = 0x0;\n  wcs->m_pc     = 0x0;\n  wcs->m_cdelt  = 0x0;\n  wcs->m_crval  = 0x0;\n  wcs->m_cunit  = 0x0;\n  wcs->m_ctype  = 0x0;\n  wcs->m_pv     = 0x0;\n  wcs->m_ps     = 0x0;\n  wcs->m_cd     = 0x0;\n  wcs->m_crota  = 0x0;\n  wcs->m_colax  = 0x0;\n  wcs->m_cname  = 0x0;\n  wcs->m_crder  = 0x0;\n  wcs->m_csyer  = 0x0;\n  wcs->m_czphs  = 0x0;\n  wcs->m_cperi  = 0x0;\n\n  wcs->m_aux    = 0x0;\n\n  wcs->ntab  = 0;\n  wcs->m_tab = 0x0;\n  wcs->nwtb  = 0;\n  wcs->m_wtb = 0x0;\n\n  wcs->types = 0x0;\n\n  wcserr_clear(&(wcs->err));\n\n  wcs->flag = 0;\n\n  linfree(&(wcs->lin));\n  celfree(&(wcs->cel));\n  spcfree(&(wcs->spc));\n\n  return WCSERR_SUCCESS;\n}\n\n//----------------------------------------------------------------------------\n\nint wcstrim(struct wcsprm *wcs)\n\n{\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n\n  if (wcs->m_flag != WCSSET) {\n    // Nothing to do.\n    return WCSERR_SUCCESS;\n  }\n\n  if (wcs->flag != WCSSET) {\n    return WCSERR_UNSET;\n  }\n\n  if (wcs->npv < wcs->npvmax) {\n    if (wcs->m_pv) {\n      if (wcs->npv == 0) {\n        free(wcs->m_pv);\n        wcs->pv = wcs->m_pv = 0x0;\n      } else {\n        size_t size = wcs->npv * sizeof(struct pvcard);\n        // No error if realloc() fails, it will leave the array untouched.\n        if ((wcs->pv = wcs->m_pv = realloc(wcs->m_pv, size))) {\n          wcs->npvmax = wcs->npv;\n        }\n      }\n    }\n  }\n\n  if (wcs->nps < wcs->npsmax) {\n    if (wcs->m_ps) {\n      if (wcs->nps == 0) {\n        free(wcs->m_ps);\n        wcs->ps = wcs->m_ps = 0x0;\n      } else {\n        size_t size = wcs->nps * sizeof(struct pscard);\n        // No error if realloc() fails, it will leave the array untouched.\n        if ((wcs->ps = wcs->m_ps = realloc(wcs->m_ps, size))) {\n          wcs->npsmax = wcs->nps;\n        }\n      }\n    }\n  }\n\n  if (!(wcs->altlin & 2)) {\n    if (wcs->m_cd) {\n      free(wcs->m_cd);\n      wcs->cd = wcs->m_cd = 0x0;\n    }\n  }\n\n  if (!(wcs->altlin & 4)) {\n    if (wcs->m_crota) {\n      free(wcs->m_crota);\n      wcs->crota = wcs->m_crota = 0x0;\n    }\n  }\n\n  if (wcs->colax) {\n    if (wcsutil_all_ival(wcs->naxis, 0, wcs->colax)) {\n      free(wcs->m_colax);\n      wcs->colax = wcs->m_colax = 0x0;\n    }\n  }\n\n  if (wcs->cname) {\n    if (wcsutil_all_sval(wcs->naxis, \"\", (const char (*)[72])wcs->cname)) {\n      free(wcs->m_cname);\n      wcs->cname = wcs->m_cname = 0x0;\n    }\n  }\n\n  if (wcs->crder) {\n    if (wcsutil_all_dval(wcs->naxis, UNDEFINED, wcs->crder)) {\n      free(wcs->m_crder);\n      wcs->crder = wcs->m_crder = 0x0;\n    }\n  }\n\n  if (wcs->csyer) {\n    if (wcsutil_all_dval(wcs->naxis, UNDEFINED, wcs->csyer)) {\n      free(wcs->m_csyer);\n      wcs->csyer = wcs->m_csyer = 0x0;\n    }\n  }\n\n  if (wcs->czphs) {\n    if (wcsutil_all_dval(wcs->naxis, UNDEFINED, wcs->czphs)) {\n      free(wcs->m_czphs);\n      wcs->czphs = wcs->m_czphs = 0x0;\n    }\n  }\n\n  if (wcs->cperi) {\n    if (wcsutil_all_dval(wcs->naxis, UNDEFINED, wcs->cperi)) {\n      free(wcs->m_cperi);\n      wcs->cperi = wcs->m_cperi = 0x0;\n    }\n  }\n\n  return WCSERR_SUCCESS;\n}\n\n//----------------------------------------------------------------------------\n\nint wcssize(const struct wcsprm *wcs, int sizes[2])\n\n{\n  if (wcs == 0x0) {\n    sizes[0] = sizes[1] = 0;\n    return WCSERR_SUCCESS;\n  }\n\n  // Base size, in bytes.\n  sizes[0] = sizeof(struct wcsprm);\n\n  // Total size of allocated memory, in bytes.\n  sizes[1] = 0;\n\n  int exsizes[2];\n  int naxis = wcs->naxis;\n\n  // wcsprm::crpix[].\n  sizes[1] += naxis * sizeof(double);\n\n  // wcsprm::pc[].\n  sizes[1] += naxis*naxis * sizeof(double);\n\n  // wcsprm::cdelt[].\n  sizes[1] += naxis * sizeof(double);\n\n  // wcsprm::crval[].\n  sizes[1] += naxis * sizeof(double);\n\n  // wcsprm::cunit[].\n  if (wcs->cunit) {\n    sizes[1] += naxis * sizeof(char [72]);\n  }\n\n  // wcsprm::ctype[].\n  sizes[1] += naxis * sizeof(char [72]);\n\n  // wcsprm::pv[].\n  if (wcs->pv) {\n    sizes[1] += wcs->npvmax * sizeof(struct pvcard);\n  }\n\n  // wcsprm::ps[].\n  if (wcs->ps) {\n    sizes[1] += wcs->npsmax * sizeof(struct pscard);\n  }\n\n  // wcsprm::cd[].\n  if (wcs->cd) {\n    sizes[1] += naxis*naxis * sizeof(double);\n  }\n\n  // wcsprm::crota[].\n  if (wcs->crota) {\n    sizes[1] += naxis * sizeof(double);\n  }\n\n  // wcsprm::colax[].\n  if (wcs->colax) {\n    sizes[1] += naxis * sizeof(int);\n  }\n\n  // wcsprm::cname[].\n  if (wcs->cname) {\n    sizes[1] += naxis * sizeof(char [72]);\n  }\n\n  // wcsprm::crder[].\n  if (wcs->crder) {\n    sizes[1] += naxis * sizeof(double);\n  }\n\n  // wcsprm::csyer[].\n  if (wcs->csyer) {\n    sizes[1] += naxis * sizeof(double);\n  }\n\n  // wcsprm::czphs[].\n  if (wcs->czphs) {\n    sizes[1] += naxis * sizeof(double);\n  }\n\n  // wcsprm::cperi[].\n  if (wcs->cperi) {\n    sizes[1] += naxis * sizeof(double);\n  }\n\n  // wcsprm::aux.\n  if (wcs->aux) {\n    sizes[1] += sizeof(struct auxprm);\n  }\n\n  // wcsprm::tab.\n  for (int itab = 0; itab < wcs->ntab; itab++) {\n    tabsize(wcs->tab + itab, exsizes);\n    sizes[1] += exsizes[0] + exsizes[1];\n  }\n\n  // wcsprm::wtb.\n  if (wcs->wtb) {\n    sizes[1] += wcs->nwtb * sizeof(struct wtbarr);\n  }\n\n  // wcsprm::lin.\n  linsize(&(wcs->lin), exsizes);\n  sizes[1] += exsizes[1];\n\n  // wcsprm::err.\n  wcserr_size(wcs->err, exsizes);\n  sizes[1] += exsizes[0] + exsizes[1];\n\n  return WCSERR_SUCCESS;\n}\n\n//----------------------------------------------------------------------------\n\nint auxsize(const struct auxprm *aux, int sizes[2])\n\n{\n  if (aux == 0x0) {\n    sizes[0] = sizes[1] = 0;\n    return WCSERR_SUCCESS;\n  }\n\n  // Base size, in bytes.\n  sizes[0] = sizeof(struct auxprm);\n\n  // Total size of allocated memory, in bytes.\n  sizes[1] = 0;\n\n  return WCSERR_SUCCESS;\n}\n\n\n//----------------------------------------------------------------------------\n\nstatic void wcsprt_auxc(const char *name, const char *value)\n{\n  if (value[0] == '\\0') {\n    wcsprintf(\"   %s: UNDEFINED\\n\", name);\n  } else {\n    wcsprintf(\"   %s: \\\"%s\\\"\\n\", name, value);\n  }\n}\n\nstatic void wcsprt_auxd(const char *name, double value)\n{\n  if (undefined(value)) {\n    wcsprintf(\"   %s: UNDEFINED\\n\", name);\n  } else {\n    wcsprintf(\"   %s:  %15.9f\\n\", name, value);\n  }\n}\n\nint wcsprt(const struct wcsprm *wcs)\n\n{\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n\n  if (wcs->flag != WCSSET) {\n    wcsprintf(\"The wcsprm struct is UNINITIALIZED.\\n\");\n    return WCSERR_SUCCESS;\n  }\n\n  wcsprintf(\"       flag: %d\\n\", wcs->flag);\n  wcsprintf(\"      naxis: %d\\n\", wcs->naxis);\n  WCSPRINTF_PTR(\"      crpix: \", wcs->crpix, \"\\n\");\n  wcsprintf(\"            \");\n  for (int i = 0; i < wcs->naxis; i++) {\n    wcsprintf(\"  %#- 11.5g\", wcs->crpix[i]);\n  }\n  wcsprintf(\"\\n\");\n\n  // Linear transformation.\n  int k = 0;\n  WCSPRINTF_PTR(\"         pc: \", wcs->pc, \"\\n\");\n  for (int i = 0; i < wcs->naxis; i++) {\n    wcsprintf(\"    pc[%d][]:\", i);\n    for (int j = 0; j < wcs->naxis; j++) {\n      wcsprintf(\"  %#- 11.5g\", wcs->pc[k++]);\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  // Coordinate increment at reference point.\n  WCSPRINTF_PTR(\"      cdelt: \", wcs->cdelt, \"\\n\");\n  wcsprintf(\"            \");\n  for (int i = 0; i < wcs->naxis; i++) {\n    wcsprintf(\"  %#- 11.5g\", wcs->cdelt[i]);\n  }\n  wcsprintf(\"\\n\");\n\n  // Coordinate value at reference point.\n  WCSPRINTF_PTR(\"      crval: \", wcs->crval, \"\\n\");\n  wcsprintf(\"            \");\n  for (int i = 0; i < wcs->naxis; i++) {\n    wcsprintf(\"  %#- 11.5g\", wcs->crval[i]);\n  }\n  wcsprintf(\"\\n\");\n\n  // Coordinate units and type.\n  WCSPRINTF_PTR(\"      cunit: \", wcs->cunit, \"\\n\");\n  for (int i = 0; i < wcs->naxis; i++) {\n    wcsprintf(\"             \\\"%s\\\"\\n\", wcs->cunit[i]);\n  }\n\n  WCSPRINTF_PTR(\"      ctype: \", wcs->ctype, \"\\n\");\n  for (int i = 0; i < wcs->naxis; i++) {\n    wcsprintf(\"             \\\"%s\\\"\\n\", wcs->ctype[i]);\n  }\n\n  // Celestial and spectral transformation parameters.\n  if (undefined(wcs->lonpole)) {\n    wcsprintf(\"    lonpole: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"    lonpole: %9f\\n\", wcs->lonpole);\n  }\n  wcsprintf(\"    latpole: %9f\\n\", wcs->latpole);\n  wcsprintf(\"    restfrq: %f\\n\", wcs->restfrq);\n  wcsprintf(\"    restwav: %f\\n\", wcs->restwav);\n\n  // Parameter values.\n  wcsprintf(\"        npv: %d\\n\", wcs->npv);\n  wcsprintf(\"     npvmax: %d\\n\", wcs->npvmax);\n  WCSPRINTF_PTR(\"         pv: \", wcs->pv, \"\\n\");\n  for (int k = 0; k < wcs->npv; k++) {\n    wcsprintf(\"             %3d%4d  %#- 11.5g\\n\", (wcs->pv[k]).i,\n      (wcs->pv[k]).m, (wcs->pv[k]).value);\n  }\n  wcsprintf(\"        nps: %d\\n\", wcs->nps);\n  wcsprintf(\"     npsmax: %d\\n\", wcs->npsmax);\n  WCSPRINTF_PTR(\"         ps: \", wcs->ps, \"\\n\");\n  for (int k = 0; k < wcs->nps; k++) {\n    wcsprintf(\"             %3d%4d  %s\\n\", (wcs->ps[k]).i,\n      (wcs->ps[k]).m, (wcs->ps[k]).value);\n  }\n\n  // Alternate linear transformations.\n  k = 0;\n  WCSPRINTF_PTR(\"         cd: \", wcs->cd, \"\\n\");\n  if (wcs->cd) {\n    for (int i = 0; i < wcs->naxis; i++) {\n      wcsprintf(\"    cd[%d][]:\", i);\n      for (int j = 0; j < wcs->naxis; j++) {\n        wcsprintf(\"  %#- 11.5g\", wcs->cd[k++]);\n      }\n      wcsprintf(\"\\n\");\n    }\n  }\n\n  WCSPRINTF_PTR(\"      crota: \", wcs->crota, \"\\n\");\n  if (wcs->crota) {\n    wcsprintf(\"            \");\n    for (int i = 0; i < wcs->naxis; i++) {\n      wcsprintf(\"  %#- 11.5g\", wcs->crota[i]);\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  wcsprintf(\"     altlin: %d\\n\", wcs->altlin);\n  wcsprintf(\"     velref: %d\\n\", wcs->velref);\n\n\n\n  // Auxiliary coordinate system information.\n  wcsprintf(\"        alt: '%c'\\n\", wcs->alt[0]);\n  wcsprintf(\"     colnum: %d\\n\", wcs->colnum);\n\n  WCSPRINTF_PTR(\"      colax: \", wcs->colax, \"\\n\");\n  if (wcs->colax) {\n    wcsprintf(\"           \");\n    for (int i = 0; i < wcs->naxis; i++) {\n      wcsprintf(\"  %5d\", wcs->colax[i]);\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  WCSPRINTF_PTR(\"      cname: \", wcs->cname, \"\\n\");\n  if (wcs->cname) {\n    for (int i = 0; i < wcs->naxis; i++) {\n      if (wcs->cname[i][0] == '\\0') {\n        wcsprintf(\"             UNDEFINED\\n\");\n      } else {\n        wcsprintf(\"             \\\"%s\\\"\\n\", wcs->cname[i]);\n      }\n    }\n  }\n\n  WCSPRINTF_PTR(\"      crder: \", wcs->crder, \"\\n\");\n  if (wcs->crder) {\n    wcsprintf(\"           \");\n    for (int i = 0; i < wcs->naxis; i++) {\n      if (undefined(wcs->crder[i])) {\n        wcsprintf(\"    UNDEFINED\");\n      } else {\n        wcsprintf(\"  %#- 11.5g\", wcs->crder[i]);\n      }\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  WCSPRINTF_PTR(\"      csyer: \", wcs->csyer, \"\\n\");\n  if (wcs->csyer) {\n    wcsprintf(\"           \");\n    for (int i = 0; i < wcs->naxis; i++) {\n      if (undefined(wcs->csyer[i])) {\n        wcsprintf(\"    UNDEFINED\");\n      } else {\n        wcsprintf(\"  %#- 11.5g\", wcs->csyer[i]);\n      }\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  WCSPRINTF_PTR(\"      czphs: \", wcs->czphs, \"\\n\");\n  if (wcs->czphs) {\n    wcsprintf(\"           \");\n    for (int i = 0; i < wcs->naxis; i++) {\n      if (undefined(wcs->czphs[i])) {\n        wcsprintf(\"    UNDEFINED\");\n      } else {\n        wcsprintf(\"  %#- 11.5g\", wcs->czphs[i]);\n      }\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  WCSPRINTF_PTR(\"      cperi: \", wcs->cperi, \"\\n\");\n  if (wcs->cperi) {\n    wcsprintf(\"           \");\n    for (int i = 0; i < wcs->naxis; i++) {\n      if (undefined(wcs->cperi[i])) {\n        wcsprintf(\"    UNDEFINED\");\n      } else {\n        wcsprintf(\"  %#- 11.5g\", wcs->cperi[i]);\n      }\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  wcsprt_auxc(\" wcsname\", wcs->wcsname);\n\n  wcsprt_auxc(\" timesys\", wcs->timesys);\n  wcsprt_auxc(\" trefpos\", wcs->trefpos);\n  wcsprt_auxc(\" trefdir\", wcs->trefdir);\n  wcsprt_auxc(\" plephem\", wcs->plephem);\n  wcsprt_auxc(\"timeunit\", wcs->timeunit);\n  wcsprt_auxc(\" dateref\", wcs->dateref);\n  wcsprintf(\"     mjdref: \");\n  for (int k = 0; k < 2; k++) {\n    if (undefined(wcs->mjdref[k])) {\n      wcsprintf(\"       UNDEFINED\");\n    } else {\n      wcsprintf(\" %15.9f\", wcs->mjdref[k]);\n    }\n  }\n  wcsprintf(\"\\n\");\n  wcsprt_auxd(\"timeoffs\", wcs->timeoffs);\n\n  wcsprt_auxc(\" dateobs\", wcs->dateobs);\n  wcsprt_auxc(\" datebeg\", wcs->datebeg);\n  wcsprt_auxc(\" dateavg\", wcs->dateavg);\n  wcsprt_auxc(\" dateend\", wcs->dateend);\n  wcsprt_auxd(\"  mjdobs\", wcs->mjdobs);\n  wcsprt_auxd(\"  mjdbeg\", wcs->mjdbeg);\n  wcsprt_auxd(\"  mjdavg\", wcs->mjdavg);\n  wcsprt_auxd(\"  mjdend\", wcs->mjdend);\n  wcsprt_auxd(\"  jepoch\", wcs->jepoch);\n  wcsprt_auxd(\"  bepoch\", wcs->bepoch);\n  wcsprt_auxd(\"  tstart\", wcs->tstart);\n  wcsprt_auxd(\"   tstop\", wcs->tstop);\n  wcsprt_auxd(\" xposure\", wcs->xposure);\n  wcsprt_auxd(\" telapse\", wcs->telapse);\n\n\n  wcsprt_auxd(\" timsyer\", wcs->timsyer);\n  wcsprt_auxd(\" timrder\", wcs->timrder);\n  wcsprt_auxd(\" timedel\", wcs->timedel);\n  wcsprt_auxd(\"timepixr\", wcs->timepixr);\n\n  wcsprintf(\"     obsgeo: \");\n  for (int k = 0; k < 3; k++) {\n    if (undefined(wcs->obsgeo[k])) {\n      wcsprintf(\"       UNDEFINED\");\n    } else {\n      wcsprintf(\" %15.6f\", wcs->obsgeo[k]);\n    }\n  }\n  wcsprintf(\"\\n             \");\n  for (int k = 3; k < 6; k++) {\n    if (undefined(wcs->obsgeo[k])) {\n      wcsprintf(\"       UNDEFINED\");\n    } else {\n      wcsprintf(\" %15.6f\", wcs->obsgeo[k]);\n    }\n  }\n  wcsprintf(\"\\n\");\n\n  wcsprt_auxc(\"obsorbit\", wcs->obsorbit);\n  wcsprt_auxc(\" radesys\", wcs->radesys);\n  wcsprt_auxd(\" equinox\", wcs->equinox);\n  wcsprt_auxc(\" specsys\", wcs->specsys);\n  wcsprt_auxc(\" ssysobs\", wcs->ssysobs);\n  wcsprt_auxd(\" velosys\", wcs->velosys);\n  wcsprt_auxd(\" zsource\", wcs->zsource);\n  wcsprt_auxc(\" ssyssrc\", wcs->ssyssrc);\n  wcsprt_auxd(\" velangl\", wcs->velangl);\n\n  // Additional auxiliary coordinate system information.\n  WCSPRINTF_PTR(\"        aux: \", wcs->aux, \"\\n\");\n  if (wcs->aux) {\n    wcsprt_auxd(\"rsun_ref\", wcs->aux->rsun_ref);\n    wcsprt_auxd(\"dsun_obs\", wcs->aux->dsun_obs);\n    wcsprt_auxd(\"crln_obs\", wcs->aux->crln_obs);\n    wcsprt_auxd(\"hgln_obs\", wcs->aux->hgln_obs);\n    wcsprt_auxd(\"hglt_obs\", wcs->aux->hglt_obs);\n  }\n\n  wcsprintf(\"       ntab: %d\\n\", wcs->ntab);\n  WCSPRINTF_PTR(\"        tab: \", wcs->tab, \"\");\n  if (wcs->tab != 0x0) wcsprintf(\"  (see below)\");\n  wcsprintf(\"\\n\");\n  wcsprintf(\"       nwtb: %d\\n\", wcs->nwtb);\n  WCSPRINTF_PTR(\"        wtb: \", wcs->wtb, \"\");\n  if (wcs->wtb != 0x0) wcsprintf(\"  (see below)\");\n  wcsprintf(\"\\n\");\n\n  // Derived values.\n  WCSPRINTF_PTR(\"      types: \", wcs->types, \"\\n           \");\n  for (int i = 0; i < wcs->naxis; i++) {\n    wcsprintf(\"%5d\", wcs->types[i]);\n  }\n  wcsprintf(\"\\n\");\n\n  wcsprintf(\"     lngtyp: \\\"%s\\\"\\n\", wcs->lngtyp);\n  wcsprintf(\"     lattyp: \\\"%s\\\"\\n\", wcs->lattyp);\n  wcsprintf(\"        lng: %d\\n\", wcs->lng);\n  wcsprintf(\"        lat: %d\\n\", wcs->lat);\n  wcsprintf(\"       spec: %d\\n\", wcs->spec);\n  wcsprintf(\"   cubeface: %d\\n\", wcs->cubeface);\n\n  WCSPRINTF_PTR(\"        err: \", wcs->err, \"\\n\");\n  if (wcs->err) {\n    wcserr_prt(wcs->err, \"             \");\n  }\n\n  wcsprintf(\"        lin: (see below)\\n\");\n  wcsprintf(\"        cel: (see below)\\n\");\n  wcsprintf(\"        spc: (see below)\\n\");\n\n  // Memory management.\n  wcsprintf(\"     m_flag: %d\\n\", wcs->m_flag);\n  wcsprintf(\"    m_naxis: %d\\n\", wcs->m_naxis);\n  WCSPRINTF_PTR(\"    m_crpix: \", wcs->m_crpix, \"\");\n  if (wcs->m_crpix == wcs->crpix) wcsprintf(\"  (= crpix)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"       m_pc: \", wcs->m_pc, \"\");\n  if (wcs->m_pc == wcs->pc) wcsprintf(\"  (= pc)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"    m_cdelt: \", wcs->m_cdelt, \"\");\n  if (wcs->m_cdelt == wcs->cdelt) wcsprintf(\"  (= cdelt)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"    m_crval: \", wcs->m_crval, \"\");\n  if (wcs->m_crval == wcs->crval) wcsprintf(\"  (= crval)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"    m_cunit: \", wcs->m_cunit, \"\");\n  if (wcs->m_cunit == wcs->cunit) wcsprintf(\"  (= cunit)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"    m_ctype: \", wcs->m_ctype, \"\");\n  if (wcs->m_ctype == wcs->ctype) wcsprintf(\"  (= ctype)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"       m_pv: \", wcs->m_pv, \"\");\n  if (wcs->m_pv == wcs->pv) wcsprintf(\"  (= pv)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"       m_ps: \", wcs->m_ps, \"\");\n  if (wcs->m_ps == wcs->ps) wcsprintf(\"  (= ps)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"       m_cd: \", wcs->m_cd, \"\");\n  if (wcs->m_cd == wcs->cd) wcsprintf(\"  (= cd)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"    m_crota: \", wcs->m_crota, \"\");\n  if (wcs->m_crota == wcs->crota) wcsprintf(\"  (= crota)\");\n  wcsprintf(\"\\n\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"    m_colax: \", wcs->m_colax, \"\");\n  if (wcs->m_colax == wcs->colax) wcsprintf(\"  (= colax)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"    m_cname: \", wcs->m_cname, \"\");\n  if (wcs->m_cname == wcs->cname) wcsprintf(\"  (= cname)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"    m_crder: \", wcs->m_crder, \"\");\n  if (wcs->m_crder == wcs->crder) wcsprintf(\"  (= crder)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"    m_csyer: \", wcs->m_csyer, \"\");\n  if (wcs->m_csyer == wcs->csyer) wcsprintf(\"  (= csyer)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"    m_czphs: \", wcs->m_czphs, \"\");\n  if (wcs->m_czphs == wcs->czphs) wcsprintf(\"  (= czphs)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"    m_cperi: \", wcs->m_cperi, \"\");\n  if (wcs->m_cperi == wcs->cperi) wcsprintf(\"  (= cperi)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"      m_aux: \", wcs->m_aux, \"\");\n  if (wcs->m_aux == wcs->aux) wcsprintf(\"  (= aux)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"      m_tab: \", wcs->m_tab, \"\");\n  if (wcs->m_tab == wcs->tab) wcsprintf(\"  (= tab)\");\n  wcsprintf(\"\\n\");\n  WCSPRINTF_PTR(\"      m_wtb: \", wcs->m_wtb, \"\");\n  if (wcs->m_wtb == wcs->wtb) wcsprintf(\"  (= wtb)\");\n  wcsprintf(\"\\n\");\n\n  // Tabular transformation parameters.\n  struct wtbarr *wtbp = wcs->wtb;\n  if (wtbp) {\n    for (int iwtb = 0; iwtb < wcs->nwtb; iwtb++, wtbp++) {\n      wcsprintf(\"\\n\");\n      wcsprintf(\"wtb[%d].*\\n\", iwtb);\n      wcsprintf(\"          i: %d\\n\", wtbp->i);\n      wcsprintf(\"          m: %d\\n\", wtbp->m);\n      wcsprintf(\"       kind: %c\\n\", wtbp->kind);\n      wcsprintf(\"     extnam: %s\\n\", wtbp->extnam);\n      wcsprintf(\"     extver: %d\\n\", wtbp->extver);\n      wcsprintf(\"     extlev: %d\\n\", wtbp->extlev);\n      wcsprintf(\"      ttype: %s\\n\", wtbp->ttype);\n      wcsprintf(\"        row: %ld\\n\", wtbp->row);\n      wcsprintf(\"       ndim: %d\\n\", wtbp->ndim);\n      WCSPRINTF_PTR(\"     dimlen: \", wtbp->dimlen, \"\\n\");\n      WCSPRINTF_PTR(\"     arrayp: \", wtbp->arrayp, \" -> \");\n      WCSPRINTF_PTR(\"\", *(wtbp->arrayp), \"\\n\");\n    }\n  }\n\n  if (wcs->tab) {\n    for (int itab = 0; itab < wcs->ntab; itab++) {\n      wcsprintf(\"\\n\");\n      wcsprintf(\"tab[%d].*\\n\", itab);\n      tabprt(wcs->tab + itab);\n    }\n  }\n\n  // Linear transformation parameters.\n  wcsprintf(\"\\n\");\n  wcsprintf(\"   lin.*\\n\");\n  linprt(&(wcs->lin));\n\n  // Celestial transformation parameters.\n  wcsprintf(\"\\n\");\n  wcsprintf(\"   cel.*\\n\");\n  celprt(&(wcs->cel));\n\n  // Spectral transformation parameters.\n  wcsprintf(\"\\n\");\n  wcsprintf(\"   spc.*\\n\");\n  spcprt(&(wcs->spc));\n\n  return WCSERR_SUCCESS;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsperr(const struct wcsprm *wcs, const char *prefix)\n\n{\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n\n  if (wcs->err && wcserr_prt(wcs->err, prefix) == 0) {\n    linperr(&(wcs->lin), prefix);\n    celperr(&(wcs->cel), prefix);\n    wcserr_prt(wcs->spc.err, prefix);\n    if (wcs->tab) {\n      for (int itab = 0; itab < wcs->ntab; itab++) {\n        wcserr_prt((wcs->tab + itab)->err, prefix);\n      }\n    }\n  }\n\n  return WCSERR_SUCCESS;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsbchk(struct wcsprm *wcs, int bounds)\n\n{\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n\n  if (wcs->flag != WCSSET) {\n    int status;\n    if ((status = wcsset(wcs))) return status;\n  }\n\n  wcs->cel.prj.bounds = bounds;\n\n  return WCSERR_SUCCESS;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsset(struct wcsprm *wcs)\n\n{\n  static const char *function = \"wcsset\";\n\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n  struct wcserr **err = &(wcs->err);\n\n  // Determine axis types from CTYPEia.\n  int status;\n  if ((status = wcs_types(wcs))) {\n    return status;\n  }\n\n  // Convert to canonical units.\n  if ((status = wcs_units(wcs))) {\n    return status;\n  }\n\n  int naxis = wcs->naxis;\n  if (32 < naxis) {\n    return wcserr_set(WCSERR_SET(WCSERR_BAD_PARAM),\n      \"naxis must not exceed 32 (got %d)\", naxis);\n  }\n\n\n  // Non-linear celestial axes present?\n  if (wcs->lng >= 0 && wcs->types[wcs->lng] == 2200) {\n    struct celprm *wcscel = &(wcs->cel);\n    celini(wcscel);\n\n    // CRVALia, LONPOLEa, and LATPOLEa keyvalues.\n    wcscel->ref[0] = wcs->crval[wcs->lng];\n    wcscel->ref[1] = wcs->crval[wcs->lat];\n    wcscel->ref[2] = wcs->lonpole;\n    wcscel->ref[3] = wcs->latpole;\n\n    // Do alias translation for TPU/TPV before dealing with PVi_ma.\n    struct prjprm *wcsprj = &(wcscel->prj);\n    strncpy(wcsprj->code, wcs->ctype[wcs->lng]+5, 3);\n    wcsprj->code[3] = '\\0';\n    if (strncmp(wcsprj->code, \"TPU\", 3) == 0 ||\n        strncmp(wcsprj->code, \"TPV\", 3) == 0) {\n      // Translate the PV parameters.\n      struct disprm *dis;\n      if ((dis = calloc(1, sizeof(struct disprm))) == 0x0) {\n        return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n      }\n\n      int ndpmax = 6 + wcs->npv;\n\n      // Attach it to linprm.  Also inits it.\n      char dpq[16];\n      struct linprm *wcslin = &(wcs->lin);\n      dis->flag = -1;\n      if (strncmp(wcsprj->code, \"TPU\", 3) == 0) {\n        // Prior distortion.\n        lindist(1, wcslin, dis, ndpmax);\n        strcpy(dpq, \"DP\");\n      } else {\n        // Sequent distortion.\n        lindist(2, wcslin, dis, ndpmax);\n        strcpy(dpq, \"DQ\");\n      }\n\n      // Yes, the distortion type is \"TPV\" even for TPU.\n      strcpy(dis->dtype[wcs->lng], \"TPV\");\n      strcpy(dis->dtype[wcs->lat], \"TPV\");\n\n      // Keep the keywords in axis-order to aid debugging.\n      struct dpkey *keyp = dis->dp;\n      dis->ndp = 0;\n\n      sprintf(dpq+2, \"%d\", wcs->lng+1);\n      dpfill(keyp++, dpq, \"NAXES\",  0, 0, 2, 0.0);\n      dpfill(keyp++, dpq, \"AXIS.1\", 0, 0, 1, 0.0);\n      dpfill(keyp++, dpq, \"AXIS.2\", 0, 0, 2, 0.0);\n      dis->ndp += 3;\n\n      // Copy distortion parameters for the longitude axis.\n      for (int k = 0; k < wcs->npv; k++) {\n        if (wcs->pv[k].i != wcs->lng+1) continue;\n        sprintf(keyp->field, \"%s.TPV.%d\", dpq, wcs->pv[k].m);\n        dpfill(keyp++, 0x0, 0x0, 0, 1, 0, wcs->pv[k].value);\n        dis->ndp++;\n      }\n\n      // Now the latitude axis.\n      sprintf(dpq+2, \"%d\", wcs->lat+1);\n      dpfill(keyp++, dpq, \"NAXES\",  0, 0, 2, 0.0);\n      dpfill(keyp++, dpq, \"AXIS.1\", 0, 0, 2, 0.0);\n      dpfill(keyp++, dpq, \"AXIS.2\", 0, 0, 1, 0.0);\n      dis->ndp += 3;\n\n      for (int k = 0; k < wcs->npv; k++) {\n        if (wcs->pv[k].i != wcs->lat+1) continue;\n        sprintf(keyp->field, \"%s.TPV.%d\", dpq, wcs->pv[k].m);\n        dpfill(keyp++, 0x0, 0x0, 0, 1, 0, wcs->pv[k].value);\n        dis->ndp++;\n      }\n\n      // Erase PVi_ma associated with the celestial axes.\n      int n = 0;\n      for (int k = 0; k < wcs->npv; k++) {\n        int i = wcs->pv[k].i - 1;\n        if (i == wcs->lng || i == wcs->lat) continue;\n\n        wcs->pv[n].i = wcs->pv[k].i;\n        wcs->pv[n].m = wcs->pv[k].m;\n        wcs->pv[n].value = wcs->pv[k].value;\n\n        n++;\n      }\n\n      wcs->npv = n;\n      strcpy(wcsprj->code, \"TAN\");\n\n      // As the PVi_ma have now been erased, ctype must be reset to prevent\n      // this translation from re-occurring if wcsset() is called again.\n      strcpy(wcs->ctype[wcs->lng]+5, \"TAN\");\n      strcpy(wcs->ctype[wcs->lat]+5, \"TAN\");\n\n    } else if (strncmp(wcsprj->code, \"TNX\", 3) == 0) {\n      // The WAT distortion should already have been encoded in disseq.\n      strcpy(wcsprj->code, \"TAN\");\n      strcpy(wcs->ctype[wcs->lng]+5, \"TAN\");\n      strcpy(wcs->ctype[wcs->lat]+5, \"TAN\");\n\n    } else if (strncmp(wcsprj->code, \"ZPX\", 3) == 0) {\n      // The WAT distortion should already have been encoded in disseq.\n      strcpy(wcsprj->code, \"ZPN\");\n      strcpy(wcs->ctype[wcs->lng]+5, \"ZPN\");\n      strcpy(wcs->ctype[wcs->lat]+5, \"ZPN\");\n    }\n\n    // PVi_ma keyvalues.\n    for (int k = 0; k < wcs->npv; k++) {\n      if (wcs->pv[k].i == 0) {\n        // From a PROJPn keyword.\n        wcs->pv[k].i = wcs->lat + 1;\n      }\n\n      int i = wcs->pv[k].i - 1;\n      int m = wcs->pv[k].m;\n\n      if (i == wcs->lat) {\n        // PVi_ma associated with latitude axis.\n        if (m < 30) {\n          wcsprj->pv[m] = wcs->pv[k].value;\n        }\n\n      } else if (i == wcs->lng) {\n        // PVi_ma associated with longitude axis.\n        switch (m) {\n        case 0:\n          wcscel->offset = (wcs->pv[k].value != 0.0);\n          break;\n        case 1:\n          wcscel->phi0   = wcs->pv[k].value;\n          break;\n        case 2:\n          wcscel->theta0 = wcs->pv[k].value;\n          break;\n        case 3:\n          // If present, overrides LONPOLEa.\n          wcscel->ref[2] = wcs->pv[k].value;\n          break;\n        case 4:\n          // If present, overrides LATPOLEa.\n          wcscel->ref[3] = wcs->pv[k].value;\n          break;\n        default:\n          return wcserr_set(WCSERR_SET(WCSERR_BAD_COORD_TRANS),\n            \"PV%i_%i%s: Unrecognized coordinate transformation parameter\",\n            i+1, m, wcs->alt);\n          break;\n        }\n      }\n    }\n\n    // Do simple alias translations.\n    if (strncmp(wcs->ctype[wcs->lng]+5, \"GLS\", 3) == 0) {\n      wcscel->offset = 1;\n      wcscel->phi0   = 0.0;\n      wcscel->theta0 = wcs->crval[wcs->lat];\n      strcpy(wcsprj->code, \"SFL\");\n\n    } else if (strncmp(wcs->ctype[wcs->lng]+5, \"NCP\", 3) == 0) {\n      // Convert NCP to SIN.\n      if (wcscel->ref[1] == 0.0) {\n        return wcserr_set(WCSERR_SET(WCSERR_BAD_PARAM),\n          \"Invalid projection: NCP blows up on the equator\");\n      }\n\n      strcpy(wcsprj->code, \"SIN\");\n      wcsprj->pv[1] = 0.0;\n      wcsprj->pv[2] = cosd(wcscel->ref[1])/sind(wcscel->ref[1]);\n    }\n\n    // Initialize the celestial transformation routines.\n    wcsprj->r0 = 0.0;\n    if ((status = celset(wcscel))) {\n      return wcserr_set(WCS_ERRMSG(wcs_celerr[status]));\n    }\n\n    // Update LONPOLE, LATPOLE, and PVi_ma keyvalues.\n    wcs->lonpole = wcscel->ref[2];\n    wcs->latpole = wcscel->ref[3];\n\n    for (int k = 0; k < wcs->npv; k++) {\n      int i = wcs->pv[k].i - 1;\n      int m = wcs->pv[k].m;\n\n      if (i == wcs->lng) {\n        switch (m) {\n        case 1:\n          wcs->pv[k].value = wcscel->phi0;\n          break;\n        case 2:\n          wcs->pv[k].value = wcscel->theta0;\n          break;\n        case 3:\n          wcs->pv[k].value = wcscel->ref[2];\n          break;\n        case 4:\n          wcs->pv[k].value = wcscel->ref[3];\n          break;\n        }\n      }\n    }\n  }\n\n\n  // Non-linear spectral axis present?\n  if (wcs->spec >= 0 && wcs->types[wcs->spec] == 3300) {\n    char scode[4], stype[5];\n    struct spcprm *wcsspc = &(wcs->spc);\n    spcini(wcsspc);\n    if ((status = spctype(wcs->ctype[wcs->spec], stype, scode, 0x0, 0x0, 0x0,\n                          0x0, 0x0, err))) {\n      return status;\n    }\n    strcpy(wcsspc->type, stype);\n    strcpy(wcsspc->code, scode);\n\n    // CRVALia, RESTFRQa, and RESTWAVa keyvalues.\n    wcsspc->crval = wcs->crval[wcs->spec];\n    wcsspc->restfrq = wcs->restfrq;\n    wcsspc->restwav = wcs->restwav;\n\n    // PVi_ma keyvalues.\n    for (int k = 0; k < wcs->npv; k++) {\n      int i = wcs->pv[k].i - 1;\n      int m = wcs->pv[k].m;\n\n      if (i == wcs->spec) {\n        // PVi_ma associated with grism axis.\n        if (m < 7) {\n          wcsspc->pv[m] = wcs->pv[k].value;\n        }\n      }\n    }\n\n    // Initialize the spectral transformation routines.\n    if ((status = spcset(wcsspc))) {\n      return wcserr_set(WCS_ERRMSG(wcs_spcerr[status]));\n    }\n  }\n\n\n  // Tabular axes present?\n  for (int itab = 0; itab < wcs->ntab; itab++) {\n    if ((status = tabset(wcs->tab + itab))) {\n      return wcserr_set(WCS_ERRMSG(wcs_taberr[status]));\n    }\n  }\n\n\n  // Initialize the linear transformation.\n  wcs->altlin &= 15;\n  if (wcs->altlin > 1 && !(wcs->altlin & 1)) {\n    double *pc = wcs->pc;\n\n    if ((wcs->altlin & 2) && !(wcs->altlin & 8)) {\n      // Copy CDi_ja to PCi_ja and reset CDELTia.\n      double *cd = wcs->cd;\n      for (int i = 0; i < naxis; i++) {\n        for (int j = 0; j < naxis; j++) {\n          *(pc++) = *(cd++);\n        }\n        wcs->cdelt[i] = 1.0;\n      }\n\n    } else if (wcs->altlin & 4) {\n      // Construct PCi_ja from CROTAia.\n      int i, j;\n      if ((i = wcs->lng) >= 0 && (j = wcs->lat) >= 0) {\n        double rho = wcs->crota[j];\n\n        if (wcs->cdelt[i] == 0.0) {\n          return wcserr_set(WCSERR_SET(WCSERR_SINGULAR_MTX),\n            \"Singular transformation matrix, CDELT%d is zero\", i+1);\n        }\n        double lambda = wcs->cdelt[j]/wcs->cdelt[i];\n\n        *(pc + i*naxis + i) = *(pc + j*naxis + j) = cosd(rho);\n        *(pc + i*naxis + j) = *(pc + j*naxis + i) = sind(rho);\n        *(pc + i*naxis + j) *= -lambda;\n        *(pc + j*naxis + i) /=  lambda;\n      }\n    }\n  }\n\n  wcs->lin.crpix  = wcs->crpix;\n  wcs->lin.pc     = wcs->pc;\n  wcs->lin.cdelt  = wcs->cdelt;\n  if ((status = linset(&(wcs->lin)))) {\n    return wcserr_set(WCS_ERRMSG(wcs_linerr[status]));\n  }\n\n\n  // Set defaults for radesys and equinox for equatorial or ecliptic.\n  if (strcmp(wcs->lngtyp, \"RA\")   == 0 ||\n      strcmp(wcs->lngtyp, \"ELON\") == 0 ||\n      strcmp(wcs->lngtyp, \"HLON\") == 0) {\n    if (wcs->radesys[0] == '\\0') {\n      if (undefined(wcs->equinox)) {\n        strcpy(wcs->radesys, \"ICRS\");\n      } else if (wcs->equinox < 1984.0) {\n        strcpy(wcs->radesys, \"FK4\");\n      } else {\n        strcpy(wcs->radesys, \"FK5\");\n      }\n\n    } else if (strcmp(wcs->radesys, \"ICRS\")  == 0 ||\n               strcmp(wcs->radesys, \"GAPPT\") == 0) {\n      // Equinox is not applicable for these coordinate systems.\n      wcs->equinox = UNDEFINED;\n\n    } else if (undefined(wcs->equinox)) {\n      if (strcmp(wcs->radesys, \"FK5\") == 0) {\n        wcs->equinox = 2000.0;\n      } else if (strcmp(wcs->radesys, \"FK4\") == 0 ||\n                 strcmp(wcs->radesys, \"FK4-NO-E\") == 0) {\n        wcs->equinox = 1950.0;\n      }\n    }\n\n  } else {\n    // No celestial axes, ensure that radesys and equinox are unset.\n    memset(wcs->radesys, 0, 72);\n    wcs->equinox = UNDEFINED;\n  }\n\n\n  // Strip off trailing blanks and null-fill auxiliary string members.\n  if (wcs->alt[0] == '\\0') wcs->alt[0] = ' ';\n  memset(wcs->alt+1, '\\0', 3);\n\n  for (int i = 0; i < naxis; i++) {\n    wcsutil_null_fill(72, wcs->cname[i]);\n  }\n  wcsutil_null_fill(72, wcs->wcsname);\n  wcsutil_null_fill(72, wcs->timesys);\n  wcsutil_null_fill(72, wcs->trefpos);\n  wcsutil_null_fill(72, wcs->trefdir);\n  wcsutil_null_fill(72, wcs->plephem);\n  wcsutil_null_fill(72, wcs->timeunit);\n  wcsutil_null_fill(72, wcs->dateref);\n  wcsutil_null_fill(72, wcs->dateobs);\n  wcsutil_null_fill(72, wcs->datebeg);\n  wcsutil_null_fill(72, wcs->dateavg);\n  wcsutil_null_fill(72, wcs->dateend);\n  wcsutil_null_fill(72, wcs->obsorbit);\n  wcsutil_null_fill(72, wcs->radesys);\n  wcsutil_null_fill(72, wcs->specsys);\n  wcsutil_null_fill(72, wcs->ssysobs);\n  wcsutil_null_fill(72, wcs->ssyssrc);\n\n  // MJDREF defaults to zero if no reference date keywords were defined.\n  if (wcs->dateref[0] == '\\0') {\n    if (undefined(wcs->mjdref[0])) {\n      wcs->mjdref[0] = 0.0;\n    }\n    if (undefined(wcs->mjdref[1])) {\n      wcs->mjdref[1] = 0.0;\n    }\n  }\n\n  wcs->flag = WCSSET;\n\n  return WCSERR_SUCCESS;\n}\n\n// : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :\n\nint wcs_types(struct wcsprm *wcs)\n\n{\n  static const char *function = \"wcs_types\";\n\n  const int  nalias = 6;\n  const char aliases [6][4] = {\"NCP\", \"GLS\", \"TPU\", \"TPV\", \"TNX\", \"ZPX\"};\n\n  const char *alt = \"\";\n  char ctypei[16], pcode[4], requir[16], scode[4], specsys[9];\n  int i, j, m, naxis, *ndx = 0x0, type;\n\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n  struct wcserr **err = &(wcs->err);\n\n  // Parse the CTYPEia keyvalues.\n  pcode[0]  = '\\0';\n  requir[0] = '\\0';\n  wcs->lng  = -1;\n  wcs->lat  = -1;\n  wcs->spec = -1;\n  wcs->cubeface = -1;\n\n  if (*(wcs->alt) != ' ') alt = wcs->alt;\n\n\n  naxis = wcs->naxis;\n  if (wcs->types) free(wcs->types);\n  if ((wcs->types = calloc(naxis, sizeof(int))) == 0x0) {\n    return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n  }\n\n  for (i = 0; i < naxis; i++) {\n    // Null fill.\n    wcsutil_null_fill(72, wcs->ctype[i]);\n\n    strncpy(ctypei, wcs->ctype[i], 15);\n    ctypei[15] = '\\0';\n\n    // Check for early Paper IV syntax (e.g. '-SIP' used by Spitzer).\n    if (strlen(ctypei) == 12 && ctypei[8] == '-') {\n      // Excise the \"4-3-3\" or \"8-3\"-form distortion code.\n      ctypei[8] = '\\0';\n\n      // Remove trailing dashes from \"8-3\"-form codes.\n      for (j = 7; j > 0; j--) {\n        if (ctypei[j] != '-') break;\n        ctypei[j] = '\\0';\n      }\n    }\n\n    // Logarithmic or tabular axis?\n    wcs->types[i] = 0;\n    if (strcmp(ctypei+4, \"-LOG\") == 0) {\n      // Logarithmic axis.\n      wcs->types[i] = 400;\n\n    } else if (strcmp(ctypei+4, \"-TAB\") == 0) {\n      // Tabular axis.\n      wcs->types[i] = 500;\n    }\n\n    if (wcs->types[i]) {\n      // Could have -LOG or -TAB with celestial or spectral types.\n      ctypei[4] = '\\0';\n\n      // Take care of things like 'FREQ-LOG' or 'RA---TAB'.\n      for (j = 3; j >= 0; j--) {\n        if (ctypei[j] != '-') break;\n        ctypei[j] = '\\0';\n      }\n    }\n\n    // Translate AIPS spectral types for spctyp().\n    if (spcaips(ctypei, wcs->velref, ctypei, specsys) == 0) {\n      strcpy(wcs->ctype[i], ctypei);\n      if (wcs->specsys[0] == '\\0') strcpy(wcs->specsys, specsys);\n    }\n\n    // Process linear axes.\n    if (!(strlen(ctypei) == 8 && ctypei[4] == '-')) {\n      // Identify Stokes, celestial and spectral types.\n      if (strcmp(ctypei, \"STOKES\") == 0) {\n        // STOKES axis.\n        wcs->types[i] = 1100;\n\n      } else if (strcmp(ctypei, \"RA\")  == 0 ||\n        strcmp(ctypei+1, \"LON\") == 0 ||\n        strcmp(ctypei+2, \"LN\")  == 0) {\n        // Longitude axis.\n        wcs->types[i] += 2000;\n        if (wcs->lng < 0) {\n          wcs->lng = i;\n          strcpy(wcs->lngtyp, ctypei);\n        }\n\n      } else if (strcmp(ctypei,   \"DEC\") == 0 ||\n                 strcmp(ctypei+1, \"LAT\") == 0 ||\n                 strcmp(ctypei+2, \"LT\")  == 0) {\n        // Latitude axis.\n        wcs->types[i] += 2001;\n        if (wcs->lat < 0) {\n          wcs->lat = i;\n          strcpy(wcs->lattyp, ctypei);\n        }\n\n      } else if (strcmp(ctypei, \"CUBEFACE\") == 0) {\n        // CUBEFACE axis.\n        if (wcs->cubeface == -1) {\n          wcs->types[i] = 2102;\n          wcs->cubeface = i;\n        } else {\n          // Multiple CUBEFACE axes!\n          return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE),\n            \"Multiple CUBEFACE axes (in CTYPE%d%.1s and CTYPE%d%.1s)\",\n            wcs->cubeface+1, alt, i+1, alt);\n        }\n\n      } else if (spctyp(ctypei, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0) == 0) {\n        // Spectral axis.\n        if (wcs->spec < 0) wcs->spec = i;\n        wcs->types[i] += 3000;\n      }\n\n      continue;\n    }\n\n\n    // CTYPEia is in \"4-3\" form; is it a recognized spectral type?\n    if (spctyp(ctypei, 0x0, scode, 0x0, 0x0, 0x0, 0x0, 0x0) == 0) {\n      // Non-linear spectral axis found.\n      wcs->types[i] = 3300;\n\n      // Check uniqueness.\n      if (wcs->spec >= 0) {\n        return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE),\n          \"Multiple spectral axes (in CTYPE%d%.1s and CTYPE%d%.1s)\",\n          wcs->spec+1, alt, i+1, alt);\n      }\n\n      wcs->spec = i;\n\n      continue;\n    }\n\n\n    // Is it a recognized celestial projection?\n    for (j = 0; j < prj_ncode; j++) {\n      if (strncmp(ctypei+5, prj_codes[j], 3) == 0) break;\n    }\n\n    if (j == prj_ncode) {\n      // Not a standard projection code, maybe it's an alias.\n      for (j = 0; j < nalias; j++) {\n        if (strncmp(ctypei+5, aliases[j], 3) == 0) break;\n      }\n\n      if (j == nalias) {\n        // Not a recognized algorithm code of any type.\n        wcs->types[i] = -1;\n        return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE),\n          \"Unrecognized projection code (%s in CTYPE%d%.1s)\",\n          ctypei+5, i+1, alt);\n      }\n    }\n\n    // Parse the celestial axis type.\n    wcs->types[i] = 2200;\n    if (*pcode == '\\0') {\n      // The first of the two celestial axes.\n      sprintf(pcode, \"%.3s\", ctypei+5);\n\n      if (strncmp(ctypei, \"RA--\", 4) == 0) {\n        wcs->lng = i;\n        strcpy(wcs->lngtyp, \"RA\");\n        strcpy(wcs->lattyp, \"DEC\");\n        ndx = &wcs->lat;\n        sprintf(requir, \"DEC--%s\", pcode);\n      } else if (strncmp(ctypei, \"DEC-\", 4) == 0) {\n        wcs->lat = i;\n        strcpy(wcs->lngtyp, \"RA\");\n        strcpy(wcs->lattyp, \"DEC\");\n        ndx = &wcs->lng;\n        sprintf(requir, \"RA---%s\", pcode);\n      } else if (strncmp(ctypei+1, \"LON\", 3) == 0) {\n        wcs->lng = i;\n        sprintf(wcs->lngtyp, \"%cLON\", ctypei[0]);\n        sprintf(wcs->lattyp, \"%cLAT\", ctypei[0]);\n        ndx = &wcs->lat;\n        sprintf(requir, \"%s-%s\", wcs->lattyp, pcode);\n      } else if (strncmp(ctypei+1, \"LAT\", 3) == 0) {\n        wcs->lat = i;\n        sprintf(wcs->lngtyp, \"%cLON\", ctypei[0]);\n        sprintf(wcs->lattyp, \"%cLAT\", ctypei[0]);\n        ndx = &wcs->lng;\n        sprintf(requir, \"%s-%s\", wcs->lngtyp, pcode);\n      } else if (strncmp(ctypei+2, \"LN\", 2) == 0) {\n        wcs->lng = i;\n        sprintf(wcs->lngtyp, \"%c%cLN\", ctypei[0], ctypei[1]);\n        sprintf(wcs->lattyp, \"%c%cLT\", ctypei[0], ctypei[1]);\n        ndx = &wcs->lat;\n        sprintf(requir, \"%s-%s\", wcs->lattyp, pcode);\n      } else if (strncmp(ctypei+2, \"LT\", 2) == 0) {\n        wcs->lat = i;\n        sprintf(wcs->lngtyp, \"%c%cLN\", ctypei[0], ctypei[1]);\n        sprintf(wcs->lattyp, \"%c%cLT\", ctypei[0], ctypei[1]);\n        ndx = &wcs->lng;\n        sprintf(requir, \"%s-%s\", wcs->lngtyp, pcode);\n      } else {\n        // Unrecognized celestial type.\n        wcs->types[i] = -1;\n\n        wcs->lng = -1;\n        wcs->lat = -1;\n        return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE),\n          \"Unrecognized celestial type (%5s in CTYPE%d%.1s)\",\n          ctypei, i+1, alt);\n      }\n\n      if (wcs->lat >= 0) wcs->types[i]++;\n\n    } else {\n      // Looking for the complementary celestial axis.\n      if (wcs->lat < 0) wcs->types[i]++;\n\n      if (strncmp(ctypei, requir, 8) != 0) {\n        // Inconsistent projection types.\n        wcs->lng = -1;\n        wcs->lat = -1;\n        return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE), \"Inconsistent \"\n          \"projection types (expected %s, got %s in CTYPE%d%.1s)\", requir,\n          ctypei, i+1, alt);\n      }\n\n      *ndx = i;\n      requir[0] = '\\0';\n    }\n  }\n\n  // Do we have a complementary pair of celestial axes?\n  if (strcmp(requir, \"\")) {\n    // Unmatched celestial axis.\n    wcs->lng = -1;\n    wcs->lat = -1;\n    return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE),\n      \"Unmatched celestial axes\");\n  }\n\n  // Table group numbers.\n  for (j = 0; j < wcs->ntab; j++) {\n    for (m = 0; m < wcs->tab[j].M; m++) {\n      // Get image axis number.\n      i = wcs->tab[j].map[m];\n\n      type = (wcs->types[i] / 100) % 10;\n      if (type != 5) {\n        return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE),\n          \"Table parameters set for non-table axis type\");\n      }\n      wcs->types[i] += 10 * j;\n    }\n  }\n\n  return WCSERR_SUCCESS;\n}\n\n// : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :\n\nint wcs_units(struct wcsprm *wcs)\n\n{\n  static const char *function = \"wcs_units\";\n\n  char ctype[9], units[16];\n  int  i, j, naxis;\n  double scale, offset, power;\n  struct wcserr *uniterr = 0x0, **err;\n\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n  err = &(wcs->err);\n\n  naxis = wcs->naxis;\n  for (i = 0; i < naxis; i++) {\n    // Squeeze out trailing blanks.\n    wcsutil_null_fill(72, wcs->cunit[i]);\n\n    // Use types set by wcs_types().\n    switch (wcs->types[i]/1000) {\n    case 2:\n      // Celestial axis.\n      strcpy(units, \"deg\");\n      break;\n\n    case 3:\n      // Spectral axis.\n      strncpy(ctype, wcs->ctype[i], 8);\n      ctype[8] = '\\0';\n      spctyp(ctype, 0x0, 0x0, 0x0, units, 0x0, 0x0, 0x0);\n      break;\n\n    default:\n      continue;\n    }\n\n    // Tabular axis, CDELTia and CRVALia relate to indices.\n    if ((wcs->types[i]/100)%10 == 5) {\n      continue;\n    }\n\n    if (wcs->cunit[i][0]) {\n      if (wcsunitse(wcs->cunit[i], units, &scale, &offset, &power,\n                    &uniterr)) {\n        if (uniterr) {\n          // uniterr will not be set if wcserr is not enabled.\n          wcserr_set(WCSERR_SET(WCSERR_BAD_COORD_TRANS),\n            \"In CUNIT%d%.1s: %s\", i+1, (*wcs->alt)?wcs->alt:\"\", uniterr->msg);\n          free(uniterr);\n        }\n        return WCSERR_BAD_COORD_TRANS;\n      }\n\n      if (scale != 1.0) {\n        wcs->cdelt[i] *= scale;\n        wcs->crval[i] *= scale;\n\n        for (j = 0; j < naxis; j++) {\n          *(wcs->cd + i*naxis + j) *= scale;\n        }\n\n        strcpy(wcs->cunit[i], units);\n      }\n\n    } else {\n      strcpy(wcs->cunit[i], units);\n    }\n  }\n\n  return WCSERR_SUCCESS;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsp2s(\n  struct wcsprm *wcs,\n  int ncoord,\n  int nelem,\n  const double pixcrd[],\n  double imgcrd[],\n  double phi[],\n  double theta[],\n  double world[],\n  int stat[])\n\n{\n  static const char *function = \"wcsp2s\";\n\n  int    bits, face, i, iso_x, iso_y, istat, *istatp, itab, k, m, nx, ny,\n        *statp, status, type;\n  double crvali, offset;\n  register double *img, *wrl;\n  struct celprm *wcscel = &(wcs->cel);\n  struct prjprm *wcsprj = &(wcscel->prj);\n  struct wcserr **err;\n\n  // Initialize if required.\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n  err = &(wcs->err);\n\n  if (wcs->flag != WCSSET) {\n    if ((status = wcsset(wcs))) return status;\n  }\n\n  // Sanity check.\n  if (ncoord < 1 || (ncoord > 1 && nelem < wcs->naxis)) {\n    return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE),\n      \"ncoord and/or nelem inconsistent with the wcsprm\");\n  }\n\n\n  // Apply pixel-to-world linear transformation.\n  if ((status = linp2x(&(wcs->lin), ncoord, nelem, pixcrd, imgcrd))) {\n    return wcserr_set(WCS_ERRMSG(wcs_linerr[status]));\n  }\n\n  // Initialize status vectors.\n  if ((istatp = calloc(ncoord, sizeof(int))) == 0x0) {\n    return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n  }\n\n  stat[0] = 0;\n  wcsutil_setAli(ncoord, 1, stat);\n\n\n  // Convert intermediate world coordinates to world coordinates.\n  for (i = 0; i < wcs->naxis; i++) {\n    // Extract the second digit of the axis type code.\n    type = (wcs->types[i] / 100) % 10;\n\n    if (type <= 1) {\n      // Linear or quantized coordinate axis.\n      img = imgcrd + i;\n      wrl = world  + i;\n      crvali = wcs->crval[i];\n      for (k = 0; k < ncoord; k++) {\n        *wrl = *img + crvali;\n        img += nelem;\n        wrl += nelem;\n      }\n\n    } else if (wcs->types[i] == 2200) {\n      // Convert celestial coordinates; do we have a CUBEFACE axis?\n      if (wcs->cubeface != -1) {\n        // Separation between faces.\n        if (wcsprj->r0 == 0.0) {\n          offset = 90.0;\n        } else {\n          offset = wcsprj->r0*PI/2.0;\n        }\n\n        // Lay out faces in a plane.\n        img = imgcrd;\n        statp = stat;\n        bits = (1 << i) | (1 << wcs->lat);\n        for (k = 0; k < ncoord; k++, statp++) {\n          face = (int)(*(img+wcs->cubeface) + 0.5);\n          if (fabs(*(img+wcs->cubeface) - face) > 1e-10) {\n            *statp |= bits;\n            status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_PIX));\n\n          } else {\n            *statp = 0;\n\n            switch (face) {\n            case 0:\n              *(img+wcs->lat) += offset;\n              break;\n            case 1:\n              break;\n            case 2:\n              *(img+i) += offset;\n              break;\n            case 3:\n              *(img+i) += offset*2;\n              break;\n            case 4:\n              *(img+i) += offset*3;\n              break;\n            case 5:\n              *(img+wcs->lat) -= offset;\n              break;\n            default:\n              *statp |= bits;\n              status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_PIX));\n            }\n          }\n\n          img += nelem;\n        }\n      }\n\n      // Check for constant x and/or y.\n      nx = ncoord;\n      ny = 0;\n\n      if ((iso_x = wcsutil_allEq(ncoord, nelem, imgcrd+i))) {\n        nx = 1;\n        ny = ncoord;\n      }\n      if ((iso_y = wcsutil_allEq(ncoord, nelem, imgcrd+wcs->lat))) {\n        ny = 1;\n      }\n\n      // Transform projection plane coordinates to celestial coordinates.\n      if ((istat = celx2s(wcscel, nx, ny, nelem, nelem, imgcrd+i,\n                          imgcrd+wcs->lat, phi, theta, world+i,\n                          world+wcs->lat, istatp))) {\n        if (istat) {\n          status = wcserr_set(WCS_ERRMSG(wcs_celerr[istat]));\n          if (status != WCSERR_BAD_PIX) {\n            goto cleanup;\n          }\n        }\n      }\n\n      // If x and y were both constant, replicate values.\n      if (iso_x && iso_y) {\n        wcsutil_setAll(ncoord, nelem, world+i);\n        wcsutil_setAll(ncoord, nelem, world+wcs->lat);\n        wcsutil_setAll(ncoord, 1, phi);\n        wcsutil_setAll(ncoord, 1, theta);\n        wcsutil_setAli(ncoord, 1, istatp);\n      }\n\n      if (istat == 5) {\n        bits = (1 << i) | (1 << wcs->lat);\n        wcsutil_setBit(ncoord, istatp, bits, stat);\n      }\n\n    } else if (type == 3 || type == 4) {\n      // Check for constant x.\n      nx = ncoord;\n      if ((iso_x = wcsutil_allEq(ncoord, nelem, imgcrd+i))) {\n        nx = 1;\n      }\n\n      istat = 0;\n      if (wcs->types[i] == 3300) {\n        // Spectral coordinates.\n        istat = spcx2s(&(wcs->spc), nx, nelem, nelem, imgcrd+i, world+i,\n                       istatp);\n        if (istat) {\n          status = wcserr_set(WCS_ERRMSG(wcs_spcerr[istat]));\n          if (status != WCSERR_BAD_PIX) {\n            goto cleanup;\n          }\n        }\n      } else if (type == 4) {\n        // Logarithmic coordinates.\n        istat = logx2s(wcs->crval[i], nx, nelem, nelem, imgcrd+i, world+i,\n                       istatp);\n        if (istat) {\n          status = wcserr_set(WCS_ERRMSG(wcs_logerr[istat]));\n          if (status != WCSERR_BAD_PIX) {\n            goto cleanup;\n          }\n        }\n      }\n\n      // If x was constant, replicate values.\n      if (iso_x) {\n        wcsutil_setAll(ncoord, nelem, world+i);\n        wcsutil_setAli(ncoord, 1, istatp);\n      }\n\n      if (istat == 3) {\n        wcsutil_setBit(ncoord, istatp, 1 << i, stat);\n      }\n    }\n  }\n\n\n  // Do tabular coordinates.\n  for (itab = 0; itab < wcs->ntab; itab++) {\n    istat = tabx2s(wcs->tab + itab, ncoord, nelem, imgcrd, world, istatp);\n\n    if (istat) {\n      status = wcserr_set(WCS_ERRMSG(wcs_taberr[istat]));\n\n      if (status != WCSERR_BAD_PIX) {\n        goto cleanup;\n\n      } else {\n        bits = 0;\n        for (m = 0; m < wcs->tab[itab].M; m++) {\n          bits |= 1 << wcs->tab[itab].map[m];\n        }\n        wcsutil_setBit(ncoord, istatp, bits, stat);\n      }\n    }\n  }\n\n\n  // Zero the unused world coordinate elements.\n  for (i = wcs->naxis; i < nelem; i++) {\n    world[i] = 0.0;\n    wcsutil_setAll(ncoord, nelem, world+i);\n  }\n\ncleanup:\n  free(istatp);\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint wcss2p(\n  struct wcsprm* wcs,\n  int ncoord,\n  int nelem,\n  const double world[],\n  double phi[],\n  double theta[],\n  double imgcrd[],\n  double pixcrd[],\n  int stat[])\n\n{\n  static const char *function = \"wcss2p\";\n\n  int    bits, i, isolat, isolng, isospec, istat, *istatp, itab, k, m, nlat,\n         nlng, nwrld, status, type;\n  double crvali, offset;\n  register const double *wrl;\n  register double *img;\n  struct celprm *wcscel = &(wcs->cel);\n  struct prjprm *wcsprj = &(wcscel->prj);\n  struct wcserr **err;\n\n\n  // Initialize if required.\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n  err = &(wcs->err);\n\n  if (wcs->flag != WCSSET) {\n    if ((status = wcsset(wcs))) return status;\n  }\n\n  // Sanity check.\n  if (ncoord < 1 || (ncoord > 1 && nelem < wcs->naxis)) {\n    return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE),\n      \"ncoord and/or nelem inconsistent with the wcsprm\");\n  }\n\n  // Initialize status vectors.\n  if ((istatp = calloc(ncoord, sizeof(int))) == 0x0) {\n    return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n  }\n\n  status = 0;\n  stat[0] = 0;\n  wcsutil_setAli(ncoord, 1, stat);\n\n\n  // Convert world coordinates to intermediate world coordinates.\n  for (i = 0; i < wcs->naxis; i++) {\n    // Extract the second digit of the axis type code.\n    type = (wcs->types[i] / 100) % 10;\n\n    if (type <= 1) {\n      // Linear or quantized coordinate axis.\n      wrl = world  + i;\n      img = imgcrd + i;\n      crvali = wcs->crval[i];\n      for (k = 0; k < ncoord; k++) {\n        *img = *wrl - crvali;\n        wrl += nelem;\n        img += nelem;\n      }\n\n    } else if (wcs->types[i] == 2200) {\n      // Celestial coordinates; check for constant lng and/or lat.\n      nlng = ncoord;\n      nlat = 0;\n\n      if ((isolng = wcsutil_allEq(ncoord, nelem, world+i))) {\n        nlng = 1;\n        nlat = ncoord;\n      }\n      if ((isolat = wcsutil_allEq(ncoord, nelem, world+wcs->lat))) {\n        nlat = 1;\n      }\n\n      // Transform celestial coordinates to projection plane coordinates.\n      if ((istat = cels2x(wcscel, nlng, nlat, nelem, nelem, world+i,\n                          world+wcs->lat, phi, theta, imgcrd+i,\n                          imgcrd+wcs->lat, istatp))) {\n        if (istat) {\n          status = wcserr_set(WCS_ERRMSG(wcs_celerr[istat]));\n          if (status != WCSERR_BAD_WORLD) {\n            goto cleanup;\n          }\n        }\n      }\n\n      // If lng and lat were both constant, replicate values.\n      if (isolng && isolat) {\n        wcsutil_setAll(ncoord, nelem, imgcrd+i);\n        wcsutil_setAll(ncoord, nelem, imgcrd+wcs->lat);\n        wcsutil_setAll(ncoord, 1, phi);\n        wcsutil_setAll(ncoord, 1, theta);\n        wcsutil_setAli(ncoord, 1, istatp);\n      }\n\n      if (istat == CELERR_BAD_WORLD) {\n        bits = (1 << i) | (1 << wcs->lat);\n        wcsutil_setBit(ncoord, istatp, bits, stat);\n      }\n\n      // Do we have a CUBEFACE axis?\n      if (wcs->cubeface != -1) {\n        // Separation between faces.\n        if (wcsprj->r0 == 0.0) {\n          offset = 90.0;\n        } else {\n          offset = wcsprj->r0*PI/2.0;\n        }\n\n        // Stack faces in a cube.\n        img = imgcrd;\n        for (k = 0; k < ncoord; k++) {\n          if (*(img+wcs->lat) < -0.5*offset) {\n            *(img+wcs->lat) += offset;\n            *(img+wcs->cubeface) = 5.0;\n          } else if (*(img+wcs->lat) > 0.5*offset) {\n            *(img+wcs->lat) -= offset;\n            *(img+wcs->cubeface) = 0.0;\n          } else if (*(img+i) > 2.5*offset) {\n            *(img+i) -= 3.0*offset;\n            *(img+wcs->cubeface) = 4.0;\n          } else if (*(img+i) > 1.5*offset) {\n            *(img+i) -= 2.0*offset;\n            *(img+wcs->cubeface) = 3.0;\n          } else if (*(img+i) > 0.5*offset) {\n            *(img+i) -= offset;\n            *(img+wcs->cubeface) = 2.0;\n          } else {\n            *(img+wcs->cubeface) = 1.0;\n          }\n\n          img += nelem;\n        }\n      }\n\n    } else if (type == 3 || type == 4) {\n      // Check for constancy.\n      nwrld = ncoord;\n      if ((isospec = wcsutil_allEq(ncoord, nelem, world+i))) {\n        nwrld = 1;\n      }\n\n      istat = 0;\n      if (wcs->types[i] == 3300) {\n        // Spectral coordinates.\n        istat = spcs2x(&(wcs->spc), nwrld, nelem, nelem, world+i,\n                       imgcrd+i, istatp);\n        if (istat) {\n          status = wcserr_set(WCS_ERRMSG(wcs_spcerr[istat]));\n          if (status != WCSERR_BAD_WORLD) {\n            goto cleanup;\n          }\n        }\n      } else if (type == 4) {\n        // Logarithmic coordinates.\n        istat = logs2x(wcs->crval[i], nwrld, nelem, nelem, world+i,\n                       imgcrd+i, istatp);\n        if (istat) {\n          status = wcserr_set(WCS_ERRMSG(wcs_logerr[istat]));\n          if (status != WCSERR_BAD_WORLD) {\n            goto cleanup;\n          }\n        }\n      }\n\n      // If constant, replicate values.\n      if (isospec) {\n        wcsutil_setAll(ncoord, nelem, imgcrd+i);\n        wcsutil_setAli(ncoord, 1, istatp);\n      }\n\n      if (istat == 4) {\n        wcsutil_setBit(ncoord, istatp, 1 << i, stat);\n      }\n    }\n  }\n\n\n  // Do tabular coordinates.\n  for (itab = 0; itab < wcs->ntab; itab++) {\n    istat = tabs2x(wcs->tab + itab, ncoord, nelem, world, imgcrd, istatp);\n\n    if (istat) {\n      status = wcserr_set(WCS_ERRMSG(wcs_taberr[istat]));\n\n      if (status == WCSERR_BAD_WORLD) {\n        bits = 0;\n        for (m = 0; m < wcs->tab[itab].M; m++) {\n          bits |= 1 << wcs->tab[itab].map[m];\n        }\n        wcsutil_setBit(ncoord, istatp, bits, stat);\n\n      } else {\n        goto cleanup;\n      }\n    }\n  }\n\n\n  // Zero the unused intermediate world coordinate elements.\n  for (i = wcs->naxis; i < nelem; i++) {\n    imgcrd[i] = 0.0;\n    wcsutil_setAll(ncoord, nelem, imgcrd+i);\n  }\n\n\n  // Apply world-to-pixel linear transformation.\n  if ((istat = linx2p(&(wcs->lin), ncoord, nelem, imgcrd, pixcrd))) {\n    status = wcserr_set(WCS_ERRMSG(wcs_linerr[istat]));\n    goto cleanup;\n  }\n\ncleanup:\n  free(istatp);\n  return status;\n}\n\n//----------------------------------------------------------------------------\n\nint wcsmix(\n  struct wcsprm *wcs,\n  int mixpix,\n  int mixcel,\n  const double vspan[2],\n  double vstep,\n  int viter,\n  double world[],\n  double phi[],\n  double theta[],\n  double imgcrd[],\n  double pixcrd[])\n\n{\n  static const char *function = \"wcsmix\";\n\n  const int niter = 60;\n  int    crossed, istep, iter, j, k, nstep, retry, stat[1], status;\n  const double tol  = 1.0e-10;\n  const double tol2 = 100.0*tol;\n  double *worldlat, *worldlng;\n  double lambda, span[2], step;\n  double pixmix;\n  double dlng, lng, lng0, lng0m, lng1, lng1m;\n  double dlat, lat, lat0, lat0m, lat1, lat1m;\n  double d, d0, d0m, d1, d1m, dx = 0.0;\n  double dabs, dmin, lmin;\n  double dphi, phi0, phi1;\n  struct celprm *wcscel = &(wcs->cel);\n  struct wcsprm wcs0;\n  struct wcserr **err;\n\n  // Initialize if required.\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n  err = &(wcs->err);\n\n  if (wcs->flag != WCSSET) {\n    if ((status = wcsset(wcs))) return status;\n  }\n\n  if (wcs->lng < 0 || wcs->lat < 0) {\n    return wcserr_set(WCSERR_SET(WCSERR_BAD_SUBIMAGE),\n      \"Image does not have celestial axes\");\n  }\n\n  worldlng = world + wcs->lng;\n  worldlat = world + wcs->lat;\n\n\n  // Check vspan.\n  if (vspan[0] <= vspan[1]) {\n    span[0] = vspan[0];\n    span[1] = vspan[1];\n  } else {\n    // Swap them.\n    span[0] = vspan[1];\n    span[1] = vspan[0];\n  }\n\n  // Check vstep.\n  step = fabs(vstep);\n  if (step == 0.0) {\n    step = (span[1] - span[0])/10.0;\n    if (step > 1.0 || step == 0.0) step = 1.0;\n  }\n\n  // Check viter.\n  nstep = viter;\n  if (nstep < 5) {\n    nstep = 5;\n  } else if (nstep > 10) {\n    nstep = 10;\n  }\n\n  // Given pixel element.\n  pixmix = pixcrd[mixpix];\n\n  // Iterate on the step size.\n  for (istep = 0; istep <= nstep; istep++) {\n    if (istep) step /= 2.0;\n\n    // Iterate on the sky coordinate between the specified range.\n    if (mixcel == 1) {\n      // Celestial longitude is given.\n\n      // Check whether the solution interval is a crossing interval.\n      lat0 = span[0];\n      *worldlat = lat0;\n      if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                           stat))) {\n        if (status == WCSERR_BAD_WORLD) {\n          status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n        }\n        return status;\n      }\n      d0 = pixcrd[mixpix] - pixmix;\n\n      dabs = fabs(d0);\n      if (dabs < tol) return WCSERR_SUCCESS;\n\n      lat1 = span[1];\n      *worldlat = lat1;\n      if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                           stat))) {\n        if (status == WCSERR_BAD_WORLD) {\n          status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n        }\n        return status;\n      }\n      d1 = pixcrd[mixpix] - pixmix;\n\n      dabs = fabs(d1);\n      if (dabs < tol) return WCSERR_SUCCESS;\n\n      lmin = lat1;\n      dmin = dabs;\n\n      // Check for a crossing point.\n      if (signbit(d0) != signbit(d1)) {\n        crossed = 1;\n        dx = d1;\n      } else {\n        crossed = 0;\n        lat0 = span[1];\n      }\n\n      for (retry = 0; retry < 4; retry++) {\n        // Refine the solution interval.\n        while (lat0 > span[0]) {\n          lat0 -= step;\n          if (lat0 < span[0]) lat0 = span[0];\n          *worldlat = lat0;\n          if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                               stat))) {\n            if (status == WCSERR_BAD_WORLD) {\n              status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n            }\n            return status;\n          }\n          d0 = pixcrd[mixpix] - pixmix;\n\n          // Check for a solution.\n          dabs = fabs(d0);\n          if (dabs < tol) return WCSERR_SUCCESS;\n\n          // Record the point of closest approach.\n          if (dabs < dmin) {\n            lmin = lat0;\n            dmin = dabs;\n          }\n\n          // Check for a crossing point.\n          if (signbit(d0) != signbit(d1)) {\n            crossed = 2;\n            dx = d0;\n            break;\n          }\n\n          // Advance to the next subinterval.\n          lat1 = lat0;\n          d1 = d0;\n        }\n\n        if (crossed) {\n          // A crossing point was found.\n          for (iter = 0; iter < niter; iter++) {\n            // Use regula falsi division of the interval.\n            lambda = d0/(d0-d1);\n            if (lambda < 0.1) {\n              lambda = 0.1;\n            } else if (lambda > 0.9) {\n              lambda = 0.9;\n            }\n\n            dlat = lat1 - lat0;\n            lat = lat0 + lambda*dlat;\n            *worldlat = lat;\n            if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                                 stat))) {\n              if (status == WCSERR_BAD_WORLD) {\n                status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n              }\n              return status;\n            }\n\n            // Check for a solution.\n            d = pixcrd[mixpix] - pixmix;\n            dabs = fabs(d);\n            if (dabs < tol) return WCSERR_SUCCESS;\n\n            if (dlat < tol) {\n              // An artifact of numerical imprecision.\n              if (dabs < tol2) return WCSERR_SUCCESS;\n\n              // Must be a discontinuity.\n              break;\n            }\n\n            // Record the point of closest approach.\n            if (dabs < dmin) {\n              lmin = lat;\n              dmin = dabs;\n            }\n\n            if (signbit(d0) == signbit(d)) {\n              lat0 = lat;\n              d0 = d;\n            } else {\n              lat1 = lat;\n              d1 = d;\n            }\n          }\n\n          // No convergence, must have been a discontinuity.\n          if (crossed == 1) lat0 = span[1];\n          lat1 = lat0;\n          d1 = dx;\n          crossed = 0;\n\n        } else {\n          // No crossing point; look for a tangent point.\n          if (lmin == span[0]) break;\n          if (lmin == span[1]) break;\n\n          lat = lmin;\n          lat0 = lat - step;\n          if (lat0 < span[0]) lat0 = span[0];\n          lat1 = lat + step;\n          if (lat1 > span[1]) lat1 = span[1];\n\n          *worldlat = lat0;\n          if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                               stat))) {\n            if (status == WCSERR_BAD_WORLD) {\n              status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n            }\n            return status;\n          }\n          d0 = fabs(pixcrd[mixpix] - pixmix);\n\n          d  = dmin;\n\n          *worldlat = lat1;\n          if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                               stat))) {\n            if (status == WCSERR_BAD_WORLD) {\n              status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n            }\n            return status;\n          }\n          d1 = fabs(pixcrd[mixpix] - pixmix);\n\n          for (iter = 0; iter < niter; iter++) {\n            lat0m = (lat0 + lat)/2.0;\n            *worldlat = lat0m;\n            if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                                 stat))) {\n              if (status == WCSERR_BAD_WORLD) {\n                status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n              }\n              return status;\n            }\n            d0m = fabs(pixcrd[mixpix] - pixmix);\n\n            if (d0m < tol) return WCSERR_SUCCESS;\n\n            lat1m = (lat1 + lat)/2.0;\n            *worldlat = lat1m;\n            if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                                 stat))) {\n              if (status == WCSERR_BAD_WORLD) {\n                status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n              }\n              return status;\n            }\n            d1m = fabs(pixcrd[mixpix] - pixmix);\n\n            if (d1m < tol) return WCSERR_SUCCESS;\n\n            if (d0m < d && d0m <= d1m) {\n              lat1 = lat;\n              d1   = d;\n              lat  = lat0m;\n              d    = d0m;\n            } else if (d1m < d) {\n              lat0 = lat;\n              d0   = d;\n              lat  = lat1m;\n              d    = d1m;\n            } else {\n              lat0 = lat0m;\n              d0   = d0m;\n              lat1 = lat1m;\n              d1   = d1m;\n            }\n          }\n        }\n      }\n\n    } else {\n      // Celestial latitude is given.\n\n      // Check whether the solution interval is a crossing interval.\n      lng0 = span[0];\n      *worldlng = lng0;\n      if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                           stat))) {\n        if (status == WCSERR_BAD_WORLD) {\n          status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n        }\n        return status;\n      }\n      d0 = pixcrd[mixpix] - pixmix;\n\n      dabs = fabs(d0);\n      if (dabs < tol) return WCSERR_SUCCESS;\n\n      lng1 = span[1];\n      *worldlng = lng1;\n      if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                           stat))) {\n        if (status == WCSERR_BAD_WORLD) {\n          status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n        }\n        return status;\n      }\n      d1 = pixcrd[mixpix] - pixmix;\n\n      dabs = fabs(d1);\n      if (dabs < tol) return WCSERR_SUCCESS;\n      lmin = lng1;\n      dmin = dabs;\n\n      // Check for a crossing point.\n      if (signbit(d0) != signbit(d1)) {\n        crossed = 1;\n        dx = d1;\n      } else {\n        crossed = 0;\n        lng0 = span[1];\n      }\n\n      for (retry = 0; retry < 4; retry++) {\n        // Refine the solution interval.\n        while (lng0 > span[0]) {\n          lng0 -= step;\n          if (lng0 < span[0]) lng0 = span[0];\n          *worldlng = lng0;\n          if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                               stat))) {\n            if (status == WCSERR_BAD_WORLD) {\n              status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n            }\n            return status;\n          }\n          d0 = pixcrd[mixpix] - pixmix;\n\n          // Check for a solution.\n          dabs = fabs(d0);\n          if (dabs < tol) return WCSERR_SUCCESS;\n\n          // Record the point of closest approach.\n          if (dabs < dmin) {\n            lmin = lng0;\n            dmin = dabs;\n          }\n\n          // Check for a crossing point.\n          if (signbit(d0) != signbit(d1)) {\n            crossed = 2;\n            dx = d0;\n            break;\n          }\n\n          // Advance to the next subinterval.\n          lng1 = lng0;\n          d1 = d0;\n        }\n\n        if (crossed) {\n          // A crossing point was found.\n          for (iter = 0; iter < niter; iter++) {\n            // Use regula falsi division of the interval.\n            lambda = d0/(d0-d1);\n            if (lambda < 0.1) {\n              lambda = 0.1;\n            } else if (lambda > 0.9) {\n              lambda = 0.9;\n            }\n\n            dlng = lng1 - lng0;\n            lng = lng0 + lambda*dlng;\n            *worldlng = lng;\n            if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                                 stat))) {\n              if (status == WCSERR_BAD_WORLD) {\n                status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n              }\n              return status;\n            }\n\n            // Check for a solution.\n            d = pixcrd[mixpix] - pixmix;\n            dabs = fabs(d);\n            if (dabs < tol) return WCSERR_SUCCESS;\n\n            if (dlng < tol) {\n              // An artifact of numerical imprecision.\n              if (dabs < tol2) return WCSERR_SUCCESS;\n\n              // Must be a discontinuity.\n              break;\n            }\n\n            // Record the point of closest approach.\n            if (dabs < dmin) {\n              lmin = lng;\n              dmin = dabs;\n            }\n\n            if (signbit(d0) == signbit(d)) {\n              lng0 = lng;\n              d0 = d;\n            } else {\n              lng1 = lng;\n              d1 = d;\n            }\n          }\n\n          // No convergence, must have been a discontinuity.\n          if (crossed == 1) lng0 = span[1];\n          lng1 = lng0;\n          d1 = dx;\n          crossed = 0;\n\n        } else {\n          // No crossing point; look for a tangent point.\n          if (lmin == span[0]) break;\n          if (lmin == span[1]) break;\n\n          lng = lmin;\n          lng0 = lng - step;\n          if (lng0 < span[0]) lng0 = span[0];\n          lng1 = lng + step;\n          if (lng1 > span[1]) lng1 = span[1];\n\n          *worldlng = lng0;\n          if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                               stat))) {\n            if (status == WCSERR_BAD_WORLD) {\n              status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n            }\n            return status;\n          }\n          d0 = fabs(pixcrd[mixpix] - pixmix);\n\n          d  = dmin;\n\n          *worldlng = lng1;\n          if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                               stat))) {\n            if (status == WCSERR_BAD_WORLD) {\n              status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n            }\n            return status;\n          }\n          d1 = fabs(pixcrd[mixpix] - pixmix);\n\n          for (iter = 0; iter < niter; iter++) {\n            lng0m = (lng0 + lng)/2.0;\n            *worldlng = lng0m;\n            if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                                 stat))) {\n              if (status == WCSERR_BAD_WORLD) {\n                status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n              }\n              return status;\n            }\n            d0m = fabs(pixcrd[mixpix] - pixmix);\n\n            if (d0m < tol) return WCSERR_SUCCESS;\n\n            lng1m = (lng1 + lng)/2.0;\n            *worldlng = lng1m;\n            if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                                 stat))) {\n              if (status == WCSERR_BAD_WORLD) {\n                status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n              }\n              return status;\n            }\n            d1m = fabs(pixcrd[mixpix] - pixmix);\n\n            if (d1m < tol) return WCSERR_SUCCESS;\n\n            if (d0m < d && d0m <= d1m) {\n              lng1 = lng;\n              d1   = d;\n              lng  = lng0m;\n              d    = d0m;\n            } else if (d1m < d) {\n              lng0 = lng;\n              d0   = d;\n              lng  = lng1m;\n              d    = d1m;\n            } else {\n              lng0 = lng0m;\n              d0   = d0m;\n              lng1 = lng1m;\n              d1   = d1m;\n            }\n          }\n        }\n      }\n    }\n  }\n\n\n  // Set cel0 to the unity transformation.\n  wcs0 = *wcs;\n  wcs0.cel.euler[0] = -90.0;\n  wcs0.cel.euler[1] =   0.0;\n  wcs0.cel.euler[2] =  90.0;\n  wcs0.cel.euler[3] =   1.0;\n  wcs0.cel.euler[4] =   0.0;\n\n  // No convergence, check for aberrant behaviour at a native pole.\n  *theta = -90.0;\n  for (j = 1; j <= 2; j++) {\n    // Could the celestial coordinate element map to a native pole?\n    *phi = 0.0;\n    *theta = -*theta;\n    sphx2s(wcscel->euler, 1, 1, 1, 1, phi, theta, &lng, &lat);\n\n    if (mixcel == 1) {\n      if (fabs(fmod(*worldlng-lng, 360.0)) > tol) continue;\n      if (lat < span[0]) continue;\n      if (lat > span[1]) continue;\n      *worldlat = lat;\n    } else {\n      if (fabs(*worldlat-lat) > tol) continue;\n      if (lng < span[0]) lng += 360.0;\n      if (lng > span[1]) lng -= 360.0;\n      if (lng < span[0]) continue;\n      if (lng > span[1]) continue;\n      *worldlng = lng;\n    }\n\n    // Is there a solution for the given pixel coordinate element?\n    lng = *worldlng;\n    lat = *worldlat;\n\n    // Feed native coordinates to wcss2p() with cel0 set to unity.\n    *worldlng = -180.0;\n    *worldlat = *theta;\n    if ((status = wcss2p(&wcs0, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                         stat))) {\n      wcserr_clear(err);\n      wcs->err = wcs0.err;\n      if (status == WCSERR_BAD_WORLD) {\n        status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n      }\n      return status;\n    }\n    d0 = pixcrd[mixpix] - pixmix;\n\n    // Check for a solution.\n    if (fabs(d0) < tol) {\n      // Recall saved world coordinates.\n      *worldlng = lng;\n      *worldlat = lat;\n      return WCSERR_SUCCESS;\n    }\n\n    // Search for a crossing interval.\n    phi0 = -180.0;\n    for (k = -179; k <= 180; k++) {\n      phi1 = (double) k;\n      *worldlng = phi1;\n      if ((status = wcss2p(&wcs0, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                           stat))) {\n        wcserr_clear(err);\n        wcs->err = wcs0.err;\n        if (status == WCSERR_BAD_WORLD) {\n          status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n        }\n        return status;\n      }\n      d1 = pixcrd[mixpix] - pixmix;\n\n      // Check for a solution.\n      dabs = fabs(d1);\n      if (dabs < tol) {\n        // Recall saved world coordinates.\n        *worldlng = lng;\n        *worldlat = lat;\n        return WCSERR_SUCCESS;\n      }\n\n      // Is it a crossing interval?\n      if (signbit(d0) != signbit(d1)) break;\n\n      phi0 = phi1;\n      d0 = d1;\n    }\n\n    for (iter = 1; iter <= niter; iter++) {\n      // Use regula falsi division of the interval.\n      lambda = d0/(d0-d1);\n      if (lambda < 0.1) {\n        lambda = 0.1;\n      } else if (lambda > 0.9) {\n        lambda = 0.9;\n      }\n\n      dphi = phi1 - phi0;\n      *worldlng = phi0 + lambda*dphi;\n      if ((status = wcss2p(&wcs0, 1, 0, world, phi, theta, imgcrd, pixcrd,\n                           stat))) {\n        wcserr_clear(err);\n        wcs->err = wcs0.err;\n        if (status == WCSERR_BAD_WORLD) {\n          status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD));\n        }\n        return status;\n      }\n\n      // Check for a solution.\n      d = pixcrd[mixpix] - pixmix;\n      dabs = fabs(d);\n      if (dabs < tol || (dphi < tol && dabs < tol2)) {\n        // Recall saved world coordinates.\n        *worldlng = lng;\n        *worldlat = lat;\n        return WCSERR_SUCCESS;\n      }\n\n      if (signbit(d0) == signbit(d)) {\n        phi0 = *worldlng;\n        d0 = d;\n      } else {\n        phi1 = *worldlng;\n        d1 = d;\n      }\n    }\n  }\n\n\n  // No solution.\n  return wcserr_set(WCS_ERRMSG(WCSERR_NO_SOLUTION));\n}\n\n//----------------------------------------------------------------------------\n\nint wcsccs(\n  struct wcsprm *wcs,\n  double lng2P1,\n  double lat2P1,\n  double lng1P2,\n  const char *clng,\n  const char *clat,\n  const char *radesys,\n  double equinox,\n  const char *alt)\n\n{\n  static const char *function = \"wcsccs\";\n\n  int status;\n\n  // Initialize if required.\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n  struct wcserr **err = &(wcs->err);\n\n  if (wcs->flag != WCSSET) {\n    if ((status = wcsset(wcs))) return status;\n  }\n\n  if (wcs->lng < 0 || wcs->lat < 0) {\n    return wcserr_set(WCSERR_SET(WCSERR_BAD_SUBIMAGE),\n      \"Image does not have celestial axes\");\n  }\n\n  // (lng1XX,lat1XX)  ...longitude and latitude of XX in the old system.\n  // (lng2XX,lat2XX)  ...longitude and latitude of XX in the new system.\n  // XX = NP          ...natuve pole,\n  //      P1          ...pole of the old system,\n  //      P2          ...pole of the new system,\n  //      FP          ...fiducial point.\n\n  // Set up the transformation from the old to the new system.\n  double euler12[5];\n  euler12[0] = lng2P1;\n  euler12[1] = 90.0 - lat2P1;\n  euler12[2] = lng1P2;\n  euler12[3] = cosd(euler12[1]);\n  euler12[4] = sind(euler12[1]);\n\n  // Transform coordinates of the fiducial point (FP) to the new system.\n  double lng1FP = wcs->crval[wcs->lng];\n  double lat1FP = wcs->crval[wcs->lat];\n  double lng2FP, lat2FP;\n  (void)sphx2s(euler12, 1, 1, 1, 1, &lng1FP, &lat1FP, &lng2FP, &lat2FP);\n\n  // Compute native coordinates of the new pole (noting lat1P2 == lat2P1).\n  double phiP2, thetaP2;\n  (void)sphs2x(wcs->cel.euler, 1, 1, 1, 1, &lng1P2, &lat2P1,\n               &phiP2, &thetaP2);\n\n  if (fabs(lat2FP) == 90.0 || fabs(thetaP2) == 90.0) {\n    // If one of the poles of the new system is at the fiducial point, then\n    // lng2FP is indeterminate, and if one of them is at the native pole, then\n    // phiP2 is indeterminate.  We have to work harder to obtain these values.\n\n    // Compute coordinates of the native pole (NP) in the old and new systems.\n    double phiNP = 0.0, thetaNP = 90.0;\n    double lng1NP, lat1NP;\n    (void)sphx2s(wcs->cel.euler, 1, 1, 1, 1, &phiNP, &thetaNP,\n                 &lng1NP, &lat1NP);\n\n    double lng2NP, lat2NP;\n    (void)sphx2s(euler12, 1, 1, 1, 1, &lng1NP, &lat1NP, &lng2NP, &lat2NP);\n\n    // Native latitude and longitude of the fiducial point, (phi0,theta0).\n    double phiFP   = wcs->cel.prj.phi0;\n    double thetaFP = wcs->cel.prj.theta0;\n\n    if (fabs(lat2NP) == 90.0) {\n      // Following WCS Paper II equations (3) and (4), we are free to choose\n      // phiP2 and set lng2NP accordingly.  So set phiP2 to its default value\n      // for the projection.\n      if (thetaFP < lat2FP) {\n        phiP2 = 0.0;\n      } else {\n        phiP2 = 180.0;\n      }\n\n      // Compute coordinates in the old system of test point X.\n      double phiX = 0.0, thetaX = 0.0;\n      double lng1X, lat1X;\n      (void)sphx2s(wcs->cel.euler, 1, 1, 1, 1, &phiX, &thetaX,\n                   &lng1X, &lat1X);\n\n      // Ensure that lng1X is not indeterminate.\n      if (fabs(lat1X) == 90.0) {\n        phiX = 90.0;\n        (void)sphx2s(wcs->cel.euler, 1, 1, 1, 1, &phiX, &thetaX,\n                     &lng1X, &lat1X);\n      }\n\n      // Compute coordinates in the new system of test point X.\n      double lng2X, lat2X;\n      (void)sphx2s(euler12, 1, 1, 1, 1, &lng1X, &lat1X, &lng2X, &lat2X);\n\n      // Apply WCS Paper II equations (3) and (4).\n      if (lat2NP == +90.0) {\n        lng2NP = lng2X + (phiP2 - phiX) + 180.0;\n      } else {\n        lng2NP = lng2X - (phiP2 - phiX);\n      }\n\n    } else {\n      // For (lng2NP + 90, 0), WCS Paper II equation (5) reduces to\n      // phi = phiP2 - 90.\n      double lng2X = lng2NP + 90.0;\n      double lat2X = 0.0;\n      double lng1X, lat1X;\n      (void)sphs2x(euler12, 1, 1, 1, 1, &lng2X, &lat2X, &lng1X, &lat1X);\n\n      double phiX, thetaX;\n      (void)sphs2x(wcs->cel.euler, 1, 1, 1, 1, &lng1X, &lat1X,\n                   &phiX, &thetaX);\n\n      phiP2 = phiX + 90.0;\n    }\n\n    // Compute the longitude of the fiducial point in the new system.\n    double eulerN2[5];\n    eulerN2[0] = lng2NP;\n    eulerN2[1] = 90.0 - lat2NP;\n    eulerN2[2] = phiP2;\n    eulerN2[3] = cosd(eulerN2[1]);\n    eulerN2[4] = sind(eulerN2[1]);\n\n    (void)sphx2s(eulerN2, 1, 1, 1, 1, &phiFP, &thetaFP, &lng2FP, &lat2FP);\n  }\n\n  // Update reference values in wcsprm.\n  wcs->flag = 0;\n  wcs->crval[wcs->lng] = lng2FP;\n  wcs->crval[wcs->lat] = lat2FP;\n  wcs->lonpole = phiP2;\n  wcs->latpole = thetaP2;\n\n  // Update wcsprm::ctype.\n  if (clng) {\n    strncpy(wcs->ctype[wcs->lng], clng, 4);\n    for (int i = 0; i < 4; i++) {\n      if (wcs->ctype[wcs->lng][i] == '\\0') {\n        wcs->ctype[wcs->lng][i] = '-';\n      }\n    }\n  }\n\n  if (clat) {\n    strncpy(wcs->ctype[wcs->lat], clat, 4);\n    for (int i = 0; i < 4; i++) {\n      if (wcs->ctype[wcs->lat][i] == '\\0') {\n        wcs->ctype[wcs->lat][i] = '-';\n      }\n    }\n  }\n\n  // Update auxiliary values.\n  if (strncmp(wcs->ctype[wcs->lng], \"RA--\", 4) == 0 &&\n      strncmp(wcs->ctype[wcs->lat], \"DEC-\", 4) == 0) {\n    // Transforming to equatorial coordinates.\n    if (radesys) {\n      strncpy(wcs->radesys, radesys, 71);\n    }\n\n    if (equinox != 0.0) {\n      wcs->equinox = equinox;\n    }\n  } else {\n    // Meaningless for other than equatorial coordinates.\n    memset(wcs->radesys, 0, 72);\n    wcs->equinox = UNDEFINED;\n  }\n\n  if (alt && *alt) {\n    wcs->alt[0] = *alt;\n  }\n\n  // Reset the struct.\n  if ((status = wcsset(wcs))) return status;\n\n  return WCSERR_SUCCESS;\n}\n\n//----------------------------------------------------------------------------\n\nint wcssptr(\n  struct wcsprm *wcs,\n  int  *i,\n  char ctype[9])\n\n{\n  static const char *function = \"wcssptr\";\n\n  int status;\n\n  // Initialize if required.\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n  struct wcserr **err = &(wcs->err);\n\n  if (wcs->flag != WCSSET) {\n    if ((status = wcsset(wcs))) return status;\n  }\n\n  int j;\n  if ((j = *i) < 0) {\n    if ((j = wcs->spec) < 0) {\n      // Look for a linear spectral axis.\n      for (j = 0; j < wcs->naxis; j++) {\n        if (wcs->types[j]/100 == 30) {\n          break;\n        }\n      }\n\n      if (j >= wcs->naxis) {\n        // No spectral axis.\n        return wcserr_set(WCSERR_SET(WCSERR_BAD_SUBIMAGE),\n          \"No spectral axis found\");\n      }\n    }\n\n    *i = j;\n  }\n\n  // Translate the spectral axis.\n  double cdelt, crval;\n  if ((status = spctrne(wcs->ctype[j], wcs->crval[j], wcs->cdelt[j],\n                        wcs->restfrq, wcs->restwav, ctype, &crval, &cdelt,\n                        &(wcs->spc.err)))) {\n    return wcserr_set(WCS_ERRMSG(wcs_spcerr[status]));\n  }\n\n\n  // Translate keyvalues.\n  wcs->flag = 0;\n  wcs->cdelt[j] = cdelt;\n  wcs->crval[j] = crval;\n  spctyp(ctype, 0x0, 0x0, 0x0, wcs->cunit[j], 0x0, 0x0, 0x0);\n  strcpy(wcs->ctype[j], ctype);\n\n  // This keeps things tidy if the spectral axis is linear.\n  spcfree(&(wcs->spc));\n  spcini(&(wcs->spc));\n\n  // Reset the struct.\n  if ((status = wcsset(wcs))) return status;\n\n  return WCSERR_SUCCESS;\n}\n\n//----------------------------------------------------------------------------\n\n#define STRINGIZE(s) STRINGIFY(s)\n#define STRINGIFY(s) #s\n\nconst char *wcslib_version(\n  int  vers[3])\n\n{\n  static const char *wcsver = STRINGIZE(WCSLIB_VERSION);\n\n  if (vers != 0x0) {\n    vers[2] = 0;\n    sscanf(wcsver, \"%d.%d.%d\", vers, vers+1, vers+2);\n  }\n\n  return wcsver;\n}\n"},{"id":16612,"name":"cextern/wcslib/C/flexed","nodeType":"Package"},{"id":16613,"name":"README","nodeType":"TextFile","path":"cextern/wcslib/C/flexed","text":"This directory contains C code generated by flex 2.6.4 under KDE Neon User\nEdition 5.19 (Kubuntu 18.04) from the Flex description files (*.l) in the\nparent directory.\n\nThese pre-generated source files may be used during installation if\nFlex 2.5.9 or later is not available on the build host.\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":55,"id":16614,"name":"_coords","nodeType":"Attribute","startLoc":55,"text":"self._coords"},{"attributeType":"null","col":8,"comment":"null","endLoc":52,"id":16615,"name":"frame","nodeType":"Attribute","startLoc":52,"text":"self.frame"},{"id":16616,"name":"wcsutrn.c","nodeType":"TextFile","path":"cextern/wcslib/C/flexed","text":"#line 2 \"wcsutrn.c\"\n\n#line 4 \"wcsutrn.c\"\n\n#define _POSIX_C_SOURCE 1\n#define  YY_INT_ALIGNED short int\n\n/* A lexical scanner generated by flex */\n\n#define FLEX_SCANNER\n#define YY_FLEX_MAJOR_VERSION 2\n#define YY_FLEX_MINOR_VERSION 6\n#define YY_FLEX_SUBMINOR_VERSION 4\n#if YY_FLEX_SUBMINOR_VERSION > 0\n#define FLEX_BETA\n#endif\n\n#ifdef yy_create_buffer\n#define wcsutrn_create_buffer_ALREADY_DEFINED\n#else\n#define yy_create_buffer wcsutrn_create_buffer\n#endif\n\n#ifdef yy_delete_buffer\n#define wcsutrn_delete_buffer_ALREADY_DEFINED\n#else\n#define yy_delete_buffer wcsutrn_delete_buffer\n#endif\n\n#ifdef yy_scan_buffer\n#define wcsutrn_scan_buffer_ALREADY_DEFINED\n#else\n#define yy_scan_buffer wcsutrn_scan_buffer\n#endif\n\n#ifdef yy_scan_string\n#define wcsutrn_scan_string_ALREADY_DEFINED\n#else\n#define yy_scan_string wcsutrn_scan_string\n#endif\n\n#ifdef yy_scan_bytes\n#define wcsutrn_scan_bytes_ALREADY_DEFINED\n#else\n#define yy_scan_bytes wcsutrn_scan_bytes\n#endif\n\n#ifdef yy_init_buffer\n#define wcsutrn_init_buffer_ALREADY_DEFINED\n#else\n#define yy_init_buffer wcsutrn_init_buffer\n#endif\n\n#ifdef yy_flush_buffer\n#define wcsutrn_flush_buffer_ALREADY_DEFINED\n#else\n#define yy_flush_buffer wcsutrn_flush_buffer\n#endif\n\n#ifdef yy_load_buffer_state\n#define wcsutrn_load_buffer_state_ALREADY_DEFINED\n#else\n#define yy_load_buffer_state wcsutrn_load_buffer_state\n#endif\n\n#ifdef yy_switch_to_buffer\n#define wcsutrn_switch_to_buffer_ALREADY_DEFINED\n#else\n#define yy_switch_to_buffer wcsutrn_switch_to_buffer\n#endif\n\n#ifdef yypush_buffer_state\n#define wcsutrnpush_buffer_state_ALREADY_DEFINED\n#else\n#define yypush_buffer_state wcsutrnpush_buffer_state\n#endif\n\n#ifdef yypop_buffer_state\n#define wcsutrnpop_buffer_state_ALREADY_DEFINED\n#else\n#define yypop_buffer_state wcsutrnpop_buffer_state\n#endif\n\n#ifdef yyensure_buffer_stack\n#define wcsutrnensure_buffer_stack_ALREADY_DEFINED\n#else\n#define yyensure_buffer_stack wcsutrnensure_buffer_stack\n#endif\n\n#ifdef yylex\n#define wcsutrnlex_ALREADY_DEFINED\n#else\n#define yylex wcsutrnlex\n#endif\n\n#ifdef yyrestart\n#define wcsutrnrestart_ALREADY_DEFINED\n#else\n#define yyrestart wcsutrnrestart\n#endif\n\n#ifdef yylex_init\n#define wcsutrnlex_init_ALREADY_DEFINED\n#else\n#define yylex_init wcsutrnlex_init\n#endif\n\n#ifdef yylex_init_extra\n#define wcsutrnlex_init_extra_ALREADY_DEFINED\n#else\n#define yylex_init_extra wcsutrnlex_init_extra\n#endif\n\n#ifdef yylex_destroy\n#define wcsutrnlex_destroy_ALREADY_DEFINED\n#else\n#define yylex_destroy wcsutrnlex_destroy\n#endif\n\n#ifdef yyget_debug\n#define wcsutrnget_debug_ALREADY_DEFINED\n#else\n#define yyget_debug wcsutrnget_debug\n#endif\n\n#ifdef yyset_debug\n#define wcsutrnset_debug_ALREADY_DEFINED\n#else\n#define yyset_debug wcsutrnset_debug\n#endif\n\n#ifdef yyget_extra\n#define wcsutrnget_extra_ALREADY_DEFINED\n#else\n#define yyget_extra wcsutrnget_extra\n#endif\n\n#ifdef yyset_extra\n#define wcsutrnset_extra_ALREADY_DEFINED\n#else\n#define yyset_extra wcsutrnset_extra\n#endif\n\n#ifdef yyget_in\n#define wcsutrnget_in_ALREADY_DEFINED\n#else\n#define yyget_in wcsutrnget_in\n#endif\n\n#ifdef yyset_in\n#define wcsutrnset_in_ALREADY_DEFINED\n#else\n#define yyset_in wcsutrnset_in\n#endif\n\n#ifdef yyget_out\n#define wcsutrnget_out_ALREADY_DEFINED\n#else\n#define yyget_out wcsutrnget_out\n#endif\n\n#ifdef yyset_out\n#define wcsutrnset_out_ALREADY_DEFINED\n#else\n#define yyset_out wcsutrnset_out\n#endif\n\n#ifdef yyget_leng\n#define wcsutrnget_leng_ALREADY_DEFINED\n#else\n#define yyget_leng wcsutrnget_leng\n#endif\n\n#ifdef yyget_text\n#define wcsutrnget_text_ALREADY_DEFINED\n#else\n#define yyget_text wcsutrnget_text\n#endif\n\n#ifdef yyget_lineno\n#define wcsutrnget_lineno_ALREADY_DEFINED\n#else\n#define yyget_lineno wcsutrnget_lineno\n#endif\n\n#ifdef yyset_lineno\n#define wcsutrnset_lineno_ALREADY_DEFINED\n#else\n#define yyset_lineno wcsutrnset_lineno\n#endif\n\n#ifdef yyget_column\n#define wcsutrnget_column_ALREADY_DEFINED\n#else\n#define yyget_column wcsutrnget_column\n#endif\n\n#ifdef yyset_column\n#define wcsutrnset_column_ALREADY_DEFINED\n#else\n#define yyset_column wcsutrnset_column\n#endif\n\n#ifdef yywrap\n#define wcsutrnwrap_ALREADY_DEFINED\n#else\n#define yywrap wcsutrnwrap\n#endif\n\n#ifdef yyalloc\n#define wcsutrnalloc_ALREADY_DEFINED\n#else\n#define yyalloc wcsutrnalloc\n#endif\n\n#ifdef yyrealloc\n#define wcsutrnrealloc_ALREADY_DEFINED\n#else\n#define yyrealloc wcsutrnrealloc\n#endif\n\n#ifdef yyfree\n#define wcsutrnfree_ALREADY_DEFINED\n#else\n#define yyfree wcsutrnfree\n#endif\n\n/* First, we deal with  platform-specific or compiler-specific issues. */\n\n/* begin standard C headers. */\n#include <stdio.h>\n#include <string.h>\n#include <errno.h>\n#include <stdlib.h>\n\n/* end standard C headers. */\n\n/* flex integer type definitions */\n\n#ifndef FLEXINT_H\n#define FLEXINT_H\n\n/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */\n\n#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\n\n/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,\n * if you want the limit (max/min) macros for int types. \n */\n#ifndef __STDC_LIMIT_MACROS\n#define __STDC_LIMIT_MACROS 1\n#endif\n\n#include <inttypes.h>\ntypedef int8_t flex_int8_t;\ntypedef uint8_t flex_uint8_t;\ntypedef int16_t flex_int16_t;\ntypedef uint16_t flex_uint16_t;\ntypedef int32_t flex_int32_t;\ntypedef uint32_t flex_uint32_t;\n#else\ntypedef signed char flex_int8_t;\ntypedef short int flex_int16_t;\ntypedef int flex_int32_t;\ntypedef unsigned char flex_uint8_t; \ntypedef unsigned short int flex_uint16_t;\ntypedef unsigned int flex_uint32_t;\n\n/* Limits of integral types. */\n#ifndef INT8_MIN\n#define INT8_MIN               (-128)\n#endif\n#ifndef INT16_MIN\n#define INT16_MIN              (-32767-1)\n#endif\n#ifndef INT32_MIN\n#define INT32_MIN              (-2147483647-1)\n#endif\n#ifndef INT8_MAX\n#define INT8_MAX               (127)\n#endif\n#ifndef INT16_MAX\n#define INT16_MAX              (32767)\n#endif\n#ifndef INT32_MAX\n#define INT32_MAX              (2147483647)\n#endif\n#ifndef UINT8_MAX\n#define UINT8_MAX              (255U)\n#endif\n#ifndef UINT16_MAX\n#define UINT16_MAX             (65535U)\n#endif\n#ifndef UINT32_MAX\n#define UINT32_MAX             (4294967295U)\n#endif\n\n#ifndef SIZE_MAX\n#define SIZE_MAX               (~(size_t)0)\n#endif\n\n#endif /* ! C99 */\n\n#endif /* ! FLEXINT_H */\n\n/* begin standard C++ headers. */\n\n/* TODO: this is always defined, so inline it */\n#define yyconst const\n\n#if defined(__GNUC__) && __GNUC__ >= 3\n#define yynoreturn __attribute__((__noreturn__))\n#else\n#define yynoreturn\n#endif\n\n/* Returned upon end-of-file. */\n#define YY_NULL 0\n\n/* Promotes a possibly negative, possibly signed char to an\n *   integer in range [0..255] for use as an array index.\n */\n#define YY_SC_TO_UI(c) ((YY_CHAR) (c))\n\n/* An opaque pointer. */\n#ifndef YY_TYPEDEF_YY_SCANNER_T\n#define YY_TYPEDEF_YY_SCANNER_T\ntypedef void* yyscan_t;\n#endif\n\n/* For convenience, these vars (plus the bison vars far below)\n   are macros in the reentrant scanner. */\n#define yyin yyg->yyin_r\n#define yyout yyg->yyout_r\n#define yyextra yyg->yyextra_r\n#define yyleng yyg->yyleng_r\n#define yytext yyg->yytext_r\n#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)\n#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)\n#define yy_flex_debug yyg->yy_flex_debug_r\n\n/* Enter a start condition.  This macro really ought to take a parameter,\n * but we do it the disgusting crufty way forced on us by the ()-less\n * definition of BEGIN.\n */\n#define BEGIN yyg->yy_start = 1 + 2 *\n/* Translate the current start state into a value that can be later handed\n * to BEGIN to return to the state.  The YYSTATE alias is for lex\n * compatibility.\n */\n#define YY_START ((yyg->yy_start - 1) / 2)\n#define YYSTATE YY_START\n/* Action number for EOF rule of a given start state. */\n#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)\n/* Special action meaning \"start processing a new file\". */\n#define YY_NEW_FILE yyrestart( yyin , yyscanner )\n#define YY_END_OF_BUFFER_CHAR 0\n\n/* Size of default input buffer. */\n#ifndef YY_BUF_SIZE\n#ifdef __ia64__\n/* On IA-64, the buffer size is 16k, not 8k.\n * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.\n * Ditto for the __ia64__ case accordingly.\n */\n#define YY_BUF_SIZE 32768\n#else\n#define YY_BUF_SIZE 16384\n#endif /* __ia64__ */\n#endif\n\n/* The state buf must be large enough to hold one state per character in the main buffer.\n */\n#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))\n\n#ifndef YY_TYPEDEF_YY_BUFFER_STATE\n#define YY_TYPEDEF_YY_BUFFER_STATE\ntypedef struct yy_buffer_state *YY_BUFFER_STATE;\n#endif\n\n#ifndef YY_TYPEDEF_YY_SIZE_T\n#define YY_TYPEDEF_YY_SIZE_T\ntypedef size_t yy_size_t;\n#endif\n\n#define EOB_ACT_CONTINUE_SCAN 0\n#define EOB_ACT_END_OF_FILE 1\n#define EOB_ACT_LAST_MATCH 2\n    \n#define YY_LESS_LINENO(n)\n#define YY_LINENO_REWIND_TO(ptr)\n    \n/* Return all but the first \"n\" matched characters back to the input stream. */\n#define yyless(n) \\\n\tdo \\\n\t\t{ \\\n\t\t/* Undo effects of setting up yytext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\t*yy_cp = yyg->yy_hold_char; \\\n\t\tYY_RESTORE_YY_MORE_OFFSET \\\n\t\tyyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \\\n\t\tYY_DO_BEFORE_ACTION; /* set up yytext again */ \\\n\t\t} \\\n\twhile ( 0 )\n#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )\n\n#ifndef YY_STRUCT_YY_BUFFER_STATE\n#define YY_STRUCT_YY_BUFFER_STATE\nstruct yy_buffer_state\n\t{\n\tFILE *yy_input_file;\n\n\tchar *yy_ch_buf;\t\t/* input buffer */\n\tchar *yy_buf_pos;\t\t/* current position in input buffer */\n\n\t/* Size of input buffer in bytes, not including room for EOB\n\t * characters.\n\t */\n\tint yy_buf_size;\n\n\t/* Number of characters read into yy_ch_buf, not including EOB\n\t * characters.\n\t */\n\tint yy_n_chars;\n\n\t/* Whether we \"own\" the buffer - i.e., we know we created it,\n\t * and can realloc() it to grow it, and should free() it to\n\t * delete it.\n\t */\n\tint yy_is_our_buffer;\n\n\t/* Whether this is an \"interactive\" input source; if so, and\n\t * if we're using stdio for input, then we want to use getc()\n\t * instead of fread(), to make sure we stop fetching input after\n\t * each newline.\n\t */\n\tint yy_is_interactive;\n\n\t/* Whether we're considered to be at the beginning of a line.\n\t * If so, '^' rules will be active on the next match, otherwise\n\t * not.\n\t */\n\tint yy_at_bol;\n\n    int yy_bs_lineno; /**< The line count. */\n    int yy_bs_column; /**< The column count. */\n\n\t/* Whether to try to fill the input buffer when we reach the\n\t * end of it.\n\t */\n\tint yy_fill_buffer;\n\n\tint yy_buffer_status;\n\n#define YY_BUFFER_NEW 0\n#define YY_BUFFER_NORMAL 1\n\t/* When an EOF's been seen but there's still some text to process\n\t * then we mark the buffer as YY_EOF_PENDING, to indicate that we\n\t * shouldn't try reading from the input source any more.  We might\n\t * still have a bunch of tokens to match, though, because of\n\t * possible backing-up.\n\t *\n\t * When we actually see the EOF, we change the status to \"new\"\n\t * (via yyrestart()), so that the user can continue scanning by\n\t * just pointing yyin at a new input file.\n\t */\n#define YY_BUFFER_EOF_PENDING 2\n\n\t};\n#endif /* !YY_STRUCT_YY_BUFFER_STATE */\n\n/* We provide macros for accessing buffer states in case in the\n * future we want to put the buffer states in a more general\n * \"scanner state\".\n *\n * Returns the top of the stack, or NULL.\n */\n#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \\\n                          ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \\\n                          : NULL)\n/* Same as previous macro, but useful when we know that the buffer stack is not\n * NULL or when we need an lvalue. For internal use only.\n */\n#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]\n\nvoid yyrestart ( FILE *input_file , yyscan_t yyscanner );\nvoid yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );\nYY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );\nvoid yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );\nvoid yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );\nvoid yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );\nvoid yypop_buffer_state ( yyscan_t yyscanner );\n\nstatic void yyensure_buffer_stack ( yyscan_t yyscanner );\nstatic void yy_load_buffer_state ( yyscan_t yyscanner );\nstatic void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );\n#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)\n\nYY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );\nYY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );\nYY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );\n\nvoid *yyalloc ( yy_size_t , yyscan_t yyscanner );\nvoid *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );\nvoid yyfree ( void * , yyscan_t yyscanner );\n\n#define yy_new_buffer yy_create_buffer\n#define yy_set_interactive(is_interactive) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){ \\\n        yyensure_buffer_stack (yyscanner); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \\\n\t}\n#define yy_set_bol(at_bol) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){\\\n        yyensure_buffer_stack (yyscanner); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \\\n\t}\n#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)\n\n/* Begin user sect3 */\n\n#define wcsutrnwrap(yyscanner) (/*CONSTCOND*/1)\n#define YY_SKIP_YYWRAP\ntypedef flex_uint8_t YY_CHAR;\n\ntypedef int yy_state_type;\n\n#define yytext_ptr yytext_r\n\nstatic const flex_int16_t yy_nxt[][128] =\n    {\n    {\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0\n    },\n\n    {\n        7,    8,    8,    8,    8,    8,    8,    8,    8,    8,\n        8,    8,    8,    8,    8,    8,    8,    8,    8,    8,\n        8,    8,    8,    8,    8,    8,    8,    8,    8,    8,\n        8,    8,    9,    8,    8,    8,    8,    8,    8,    8,\n        8,    8,    8,    8,    8,    8,    8,    8,    8,    8,\n        8,    8,    8,    8,    8,    8,    8,    8,    8,    8,\n        8,    8,    8,    8,    8,   10,   11,   12,   13,   12,\n\n       12,   14,   15,   12,   16,   17,   12,   18,   12,   19,\n       20,   12,   21,   22,   12,   12,   23,   12,   12,   24,\n       12,    8,    8,    8,    8,    8,    8,   25,   12,   12,\n       26,   12,   12,   12,   27,   12,   12,   28,   12,   29,\n       12,   12,   30,   12,   31,   32,   12,   12,   33,   12,\n       12,   34,   12,    8,    8,    8,    8,    8\n    },\n\n    {\n        7,    8,    8,    8,    8,    8,    8,    8,    8,    8,\n        8,    8,    8,    8,    8,    8,    8,    8,    8,    8,\n        8,    8,    8,    8,    8,    8,    8,    8,    8,    8,\n        8,    8,   35,    8,    8,    8,    8,    8,    8,    8,\n\n        8,    8,    8,    8,    8,    8,    8,    8,    8,    8,\n        8,    8,    8,    8,    8,    8,    8,    8,    8,    8,\n        8,    8,    8,    8,    8,   10,   11,   12,   13,   12,\n       12,   14,   15,   12,   16,   17,   12,   18,   12,   19,\n       20,   12,   21,   22,   12,   12,   23,   12,   12,   24,\n       12,   36,    8,    8,    8,    8,    8,   25,   12,   12,\n       26,   12,   12,   12,   27,   12,   12,   28,   12,   29,\n       12,   12,   30,   12,   31,   32,   12,   12,   33,   12,\n       12,   34,   12,    8,    8,    8,    8,    8\n    },\n\n    {\n        7,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n\n       38,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   39,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   37,   37,   37,   37,   37,   37,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   37,   37,   37,   37,   37\n    },\n\n    {\n        7,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       38,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   39,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   37,   37,   37,   37,   37,   37,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   37,   37,   37,   37,   37\n    },\n\n    {\n        7,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       38,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41\n    },\n\n    {\n        7,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       38,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n\n       41,   41,   41,   41,   41,   41,   41,   41\n    },\n\n    {\n       -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,\n       -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,\n       -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,\n       -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,\n       -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,\n       -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,\n       -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,\n       -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,\n       -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,\n\n       -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,\n       -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,\n       -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,\n       -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7\n    },\n\n    {\n        7,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,\n       -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,\n       -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,\n       -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,\n       -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,\n       -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,\n\n       -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,\n       -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,\n       -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,\n       -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,\n       -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,\n       -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,\n       -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8\n    },\n\n    {\n        7,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,\n       -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,\n       -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,\n\n       -9,   -9,   42,   -9,   -9,   -9,   -9,   -9,   -9,   -9,\n       -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,\n       -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,\n       -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,\n       -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,\n       -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,\n       -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,\n       -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,\n       -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,\n       -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9\n\n    },\n\n    {\n        7,  -10,  -10,  -10,  -10,  -10,  -10,  -10,  -10,  -10,\n      -10,  -10,  -10,  -10,  -10,  -10,  -10,  -10,  -10,  -10,\n      -10,  -10,  -10,  -10,  -10,  -10,  -10,  -10,  -10,  -10,\n      -10,  -10,  -10,  -10,  -10,  -10,  -10,  -10,  -10,  -10,\n      -10,  -10,  -10,  -10,  -10,  -10,  -10,  -10,  -10,  -10,\n      -10,  -10,  -10,  -10,  -10,  -10,  -10,  -10,  -10,  -10,\n      -10,  -10,  -10,  -10,  -10,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   44,   43,   43,   43,   43,   43,   43,   43,\n       43,  -10,  -10,  -10,  -10,  -10,  -10,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       45,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -10,  -10,  -10,  -10,  -10\n    },\n\n    {\n        7,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,\n      -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,\n      -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,\n      -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,\n      -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,\n      -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,  -11,\n      -11,  -11,  -11,  -11,  -11,   43,   43,   43,   43,   46,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -11,  -11,  -11,  -11,  -11,  -11,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   47,   43,  -11,  -11,  -11,  -11,  -11\n    },\n\n    {\n        7,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,\n      -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,\n      -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,\n      -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,\n\n      -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,\n      -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,\n      -12,  -12,  -12,  -12,  -12,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -12,  -12,  -12,  -12,  -12,  -12,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -12,  -12,  -12,  -12,  -12\n    },\n\n    {\n        7,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n      -13,  -13,  -13,  -13,  -13,   48,   43,   43,   43,   49,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -13,  -13,  -13,  -13,  -13,  -13,   43,   43,   43,\n       43,   50,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -13,  -13,  -13,  -13,  -13\n    },\n\n    {\n        7,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n      -14,  -14,  -14,  -14,  -14,   43,   43,   43,   43,   43,\n       43,   43,   51,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -14,  -14,  -14,  -14,  -14,  -14,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -14,  -14,  -14,  -14,  -14\n    },\n\n    {\n        7,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   52,   43,   43,   43,   43,   43,   43,   43,\n       53,  -15,  -15,  -15,  -15,  -15,  -15,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -15,  -15,  -15,  -15,  -15\n    },\n\n    {\n        7,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   54,\n       43,  -16,  -16,  -16,  -16,  -16,  -16,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,  -16,  -16,  -16,  -16,  -16\n    },\n\n    {\n        7,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n      -17,  -17,  -17,  -17,  -17,   43,   43,   43,   43,   55,\n       43,   43,   56,   43,   43,   43,   43,   57,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,  -17,  -17,  -17,  -17,  -17,  -17,   43,   43,   43,\n       43,   58,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -17,  -17,  -17,  -17,  -17\n    },\n\n    {\n        7,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n      -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n      -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n      -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n      -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n      -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n\n      -18,  -18,  -18,  -18,  -18,   43,   43,   43,   43,   59,\n       43,   43,   60,   61,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -18,  -18,  -18,  -18,  -18,  -18,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -18,  -18,  -18,  -18,  -18\n    },\n\n    {\n        7,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n\n      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n      -19,  -19,  -19,  -19,  -19,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -19,  -19,  -19,  -19,  -19,  -19,   43,   43,   43,\n       43,   43,   43,   43,   62,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -19,  -19,  -19,  -19,  -19\n\n    },\n\n    {\n        7,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,\n      -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,\n      -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,\n      -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,\n      -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,\n      -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,\n      -20,  -20,  -20,  -20,  -20,   63,   43,   43,   43,   43,\n       43,   43,   43,   64,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -20,  -20,  -20,  -20,  -20,  -20,   65,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -20,  -20,  -20,  -20,  -20\n    },\n\n    {\n        7,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n      -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n      -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n      -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n      -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n      -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n      -21,  -21,  -21,  -21,  -21,   66,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -21,  -21,  -21,  -21,  -21,  -21,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -21,  -21,  -21,  -21,  -21\n    },\n\n    {\n        7,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n\n      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n      -22,  -22,  -22,  -22,  -22,   43,   43,   43,   43,   67,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -22,  -22,  -22,  -22,  -22,  -22,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -22,  -22,  -22,  -22,  -22\n    },\n\n    {\n        7,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   68,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -23,  -23,  -23,  -23,  -23,  -23,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   69,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -23,  -23,  -23,  -23,  -23\n    },\n\n    {\n        7,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,   43,   43,   43,   43,   70,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   71,   43,   43,   43,   43,   43,   43,   43,\n       43,  -24,  -24,  -24,  -24,  -24,  -24,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -24,  -24,  -24,  -24,  -24\n    },\n\n    {\n        7,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,\n      -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,\n      -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,\n      -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,\n      -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,\n\n      -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,\n      -25,  -25,  -25,  -25,  -25,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -25,  -25,  -25,  -25,  -25,  -25,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       72,   43,   43,   43,   73,   43,   43,   43,   43,   43,\n       43,   43,   43,  -25,  -25,  -25,  -25,  -25\n    },\n\n    {\n        7,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -26,  -26,  -26,  -26,  -26,  -26,   74,   43,   43,\n       43,   75,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,  -26,  -26,  -26,  -26,  -26\n    },\n\n    {\n        7,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,  -27,  -27,  -27,  -27,  -27,  -27,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   52,   43,   43,   43,   43,   43,\n       43,   43,   53,  -27,  -27,  -27,  -27,  -27\n    },\n\n    {\n        7,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n\n      -28,  -28,  -28,  -28,  -28,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -28,  -28,  -28,  -28,  -28,  -28,   43,   43,   43,\n       43,   58,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -28,  -28,  -28,  -28,  -28\n    },\n\n    {\n        7,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -29,  -29,  -29,  -29,  -29,  -29,   43,   43,   43,\n       43,   76,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -29,  -29,  -29,  -29,  -29\n\n    },\n\n    {\n        7,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -30,  -30,  -30,  -30,  -30,  -30,   65,   43,   43,\n\n       43,   43,   43,   43,   43,   77,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -30,  -30,  -30,  -30,  -30\n    },\n\n    {\n        7,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -31,  -31,  -31,  -31,  -31,  -31,   78,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -31,  -31,  -31,  -31,  -31\n    },\n\n    {\n        7,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -32,  -32,  -32,  -32,  -32,  -32,   43,   43,   43,\n       43,   79,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -32,  -32,  -32,  -32,  -32\n    },\n\n    {\n        7,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -33,  -33,  -33,  -33,  -33,  -33,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   69,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -33,  -33,  -33,  -33,  -33\n    },\n\n    {\n        7,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -34,  -34,  -34,  -34,  -34,  -34,   43,   43,   43,\n       43,   80,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -34,  -34,  -34,  -34,  -34\n    },\n\n    {\n        7,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,   81,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,   82,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35\n    },\n\n    {\n        7,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36\n    },\n\n    {\n        7,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37\n    },\n\n    {\n        7,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38\n    },\n\n    {\n        7,   83,   83,   83,   83,   83,   83,   83,   83,   83,\n       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,\n       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,\n\n       83,   83,   84,   83,   83,   83,   83,   83,   83,   83,\n       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,\n       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,\n       83,   83,   83,   83,   83,   85,   85,   85,   85,   85,\n       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,\n       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,\n       85,   83,   83,   83,   83,   83,   83,   85,   85,   85,\n       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,\n       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,\n       85,   85,   85,   83,   83,   83,   83,   83\n\n    },\n\n    {\n        7,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,\n      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,\n      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,\n      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,\n      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,\n      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,\n      -40,  -40,  -40,  -40,  -40,   86,   86,   86,   86,   86,\n       86,   86,   86,   86,   86,   86,   86,   86,   86,   86,\n       86,   86,   86,   86,   86,   86,   86,   86,   86,   86,\n       86,  -40,  -40,  -40,  -40,  -40,  -40,   86,   86,   86,\n\n       86,   86,   86,   86,   86,   86,   86,   86,   86,   86,\n       86,   86,   86,   86,   86,   86,   86,   86,   86,   86,\n       86,   86,   86,  -40,  -40,  -40,  -40,  -40\n    },\n\n    {\n        7,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n      -41,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87\n    },\n\n    {\n        7,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,   42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42\n    },\n\n    {\n        7,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n\n      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n      -43,  -43,  -43,  -43,  -43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -43,  -43,  -43,  -43,  -43,  -43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -43,  -43,  -43,  -43,  -43\n    },\n\n    {\n        7,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,\n      -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,\n      -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,\n      -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,\n      -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,\n      -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,\n      -44,  -44,  -44,  -44,  -44,   43,   43,   88,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -44,  -44,  -44,  -44,  -44,  -44,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -44,  -44,  -44,  -44,  -44\n    },\n\n    {\n        7,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,\n      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,\n      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,\n      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,\n      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,\n\n      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,\n      -45,  -45,  -45,  -45,  -45,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -45,  -45,  -45,  -45,  -45,  -45,   43,   43,   43,\n       43,   43,   43,   89,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -45,  -45,  -45,  -45,  -45\n    },\n\n    {\n        7,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,\n      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,\n\n      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,\n      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,\n      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,\n      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,\n      -46,  -46,  -46,  -46,  -46,   90,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -46,  -46,  -46,  -46,  -46,  -46,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,  -46,  -46,  -46,  -46,  -46\n    },\n\n    {\n        7,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,\n      -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,\n      -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,\n      -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,\n      -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,\n      -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,\n      -47,  -47,  -47,  -47,  -47,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,  -47,  -47,  -47,  -47,  -47,  -47,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   91,   43,   43,   43,\n       43,   43,   43,  -47,  -47,  -47,  -47,  -47\n    },\n\n    {\n        7,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,\n\n      -48,  -48,  -48,  -48,  -48,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   92,\n       43,  -48,  -48,  -48,  -48,  -48,  -48,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -48,  -48,  -48,  -48,  -48\n    },\n\n    {\n        7,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,\n      -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,\n      -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,\n\n      -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,\n      -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,\n      -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,\n      -49,  -49,  -49,  -49,  -49,   43,   43,   43,   43,   43,\n       43,   93,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -49,  -49,  -49,  -49,  -49,  -49,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -49,  -49,  -49,  -49,  -49\n\n    },\n\n    {\n        7,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -50,  -50,  -50,  -50,  -50,  -50,   43,   43,   43,\n\n       43,   43,   43,   94,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -50,  -50,  -50,  -50,  -50\n    },\n\n    {\n        7,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       95,  -51,  -51,  -51,  -51,  -51,  -51,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -51,  -51,  -51,  -51,  -51\n    },\n\n    {\n        7,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n\n      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n      -52,  -52,  -52,  -52,  -52,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -52,  -52,  -52,  -52,  -52,  -52,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -52,  -52,  -52,  -52,  -52\n    },\n\n    {\n        7,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -53,  -53,  -53,  -53,  -53,  -53,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -53,  -53,  -53,  -53,  -53\n    },\n\n    {\n        7,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -54,  -54,  -54,  -54,  -54,  -54,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -54,  -54,  -54,  -54,  -54\n    },\n\n    {\n        7,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   96,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -55,  -55,  -55,  -55,  -55,  -55,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -55,  -55,  -55,  -55,  -55\n    },\n\n    {\n        7,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       97,  -56,  -56,  -56,  -56,  -56,  -56,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,  -56,  -56,  -56,  -56,  -56\n    },\n\n    {\n        7,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,  -57,  -57,  -57,  -57,  -57,  -57,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -57,  -57,  -57,  -57,  -57\n    },\n\n    {\n        7,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n\n      -58,  -58,  -58,  -58,  -58,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -58,  -58,  -58,  -58,  -58,  -58,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   98,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -58,  -58,  -58,  -58,  -58\n    },\n\n    {\n        7,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   99,   43,   43,   43,   43,   43,\n       43,  -59,  -59,  -59,  -59,  -59,  -59,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -59,  -59,  -59,  -59,  -59\n\n    },\n\n    {\n        7,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n      100,  -60,  -60,  -60,  -60,  -60,  -60,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -60,  -60,  -60,  -60,  -60\n    },\n\n    {\n        7,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,  101,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -61,  -61,  -61,  -61,  -61,  -61,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -61,  -61,  -61,  -61,  -61\n    },\n\n    {\n        7,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -62,  -62,  -62,  -62,  -62,  -62,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,  102,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -62,  -62,  -62,  -62,  -62\n    },\n\n    {\n        7,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  103,   43,   43,   43,   43,   43,   43,\n       43,  -63,  -63,  -63,  -63,  -63,  -63,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -63,  -63,  -63,  -63,  -63\n    },\n\n    {\n        7,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,  104,   43,\n       43,  -64,  -64,  -64,  -64,  -64,  -64,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -64,  -64,  -64,  -64,  -64\n    },\n\n    {\n        7,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -65,  -65,  -65,  -65,  -65,  -65,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,  105,   43,   43,   43,   43,\n       43,   43,   43,  -65,  -65,  -65,  -65,  -65\n    },\n\n    {\n        7,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,   43,   43,   43,  106,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -66,  -66,  -66,  -66,  -66,  -66,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,  -66,  -66,  -66,  -66,  -66\n    },\n\n    {\n        7,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,   43,   43,  107,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,  -67,  -67,  -67,  -67,  -67,  -67,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -67,  -67,  -67,  -67,  -67\n    },\n\n    {\n        7,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n\n      -68,  -68,  -68,  -68,  -68,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,  108,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -68,  -68,  -68,  -68,  -68,  -68,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -68,  -68,  -68,  -68,  -68\n    },\n\n    {\n        7,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -69,  -69,  -69,  -69,  -69,  -69,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,  109,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -69,  -69,  -69,  -69,  -69\n\n    },\n\n    {\n        7,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  110,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -70,  -70,  -70,  -70,  -70,  -70,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -70,  -70,  -70,  -70,  -70\n    },\n\n    {\n        7,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -71,  -71,  -71,  -71,  -71,  -71,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -71,  -71,  -71,  -71,  -71\n    },\n\n    {\n        7,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -72,  -72,  -72,  -72,  -72,  -72,   43,   43,   43,\n       43,   43,   43,  111,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -72,  -72,  -72,  -72,  -72\n    },\n\n    {\n        7,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -73,  -73,  -73,  -73,  -73,  -73,   43,   43,  112,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -73,  -73,  -73,  -73,  -73\n    },\n\n    {\n        7,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -74,  -74,  -74,  -74,  -74,  -74,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  113,   43,  -74,  -74,  -74,  -74,  -74\n    },\n\n    {\n        7,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -75,  -75,  -75,  -75,  -75,  -75,   43,   43,   43,\n       43,   43,   43,  114,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -75,  -75,  -75,  -75,  -75\n    },\n\n    {\n        7,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -76,  -76,  -76,  -76,  -76,  -76,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,  115,   43,   43,   43,\n\n       43,   43,   43,  -76,  -76,  -76,  -76,  -76\n    },\n\n    {\n        7,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,  -77,  -77,  -77,  -77,  -77,  -77,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n      116,   43,   43,  -77,  -77,  -77,  -77,  -77\n    },\n\n    {\n        7,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n\n      -78,  -78,  -78,  -78,  -78,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -78,  -78,  -78,  -78,  -78,  -78,   43,   43,   43,\n      117,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -78,  -78,  -78,  -78,  -78\n    },\n\n    {\n        7,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -79,  -79,  -79,  -79,  -79,  -79,   43,   43,  118,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -79,  -79,  -79,  -79,  -79\n\n    },\n\n    {\n        7,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -80,  -80,  -80,  -80,  -80,  -80,  119,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -80,  -80,  -80,  -80,  -80\n    },\n\n    {\n        7,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,   81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,   82,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81\n    },\n\n    {\n        7,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82\n    },\n\n    {\n        7,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83\n    },\n\n    {\n        7,   83,   83,   83,   83,   83,   83,   83,   83,   83,\n       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,\n       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,\n       83,   83,   84,   83,   83,   83,   83,   83,   83,   83,\n       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,\n       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,\n       83,   83,   83,   83,   83,   85,   85,   85,   85,   85,\n       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,\n\n       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,\n       85,   83,   83,   83,   83,   83,   83,   85,   85,   85,\n       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,\n       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,\n       85,   85,   85,   83,   83,   83,   83,   83\n    },\n\n    {\n        7,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85\n    },\n\n    {\n        7,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,   86,   86,   86,   86,   86,\n       86,   86,   86,   86,   86,   86,   86,   86,   86,   86,\n       86,   86,   86,   86,   86,   86,   86,   86,   86,   86,\n       86,  -86,  -86,  -86,  -86,  -86,  -86,   86,   86,   86,\n       86,   86,   86,   86,   86,   86,   86,   86,   86,   86,\n       86,   86,   86,   86,   86,   86,   86,   86,   86,   86,\n\n       86,   86,   86,  -86,  -86,  -86,  -86,  -86\n    },\n\n    {\n        7,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n      -87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87\n    },\n\n    {\n        7,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n\n      -88,  -88,  -88,  -88,  -88,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,  120,   43,   43,\n       43,   43,   43,  121,   43,   43,   43,   43,   43,   43,\n       43,  -88,  -88,  -88,  -88,  -88,  -88,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -88,  -88,  -88,  -88,  -88\n    },\n\n    {\n        7,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -89,  -89,  -89,  -89,  -89,  -89,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,  122,   43,   43,   43,   43,\n       43,   43,   43,  -89,  -89,  -89,  -89,  -89\n\n    },\n\n    {\n        7,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,  123,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -90,  -90,  -90,  -90,  -90,  -90,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -90,  -90,  -90,  -90,  -90\n    },\n\n    {\n        7,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -91,  -91,  -91,  -91,  -91,  -91,   43,   43,   43,\n       43,  124,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -91,  -91,  -91,  -91,  -91\n    },\n\n    {\n        7,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  125,   43,   43,   43,   43,   43,   43,\n       43,  -92,  -92,  -92,  -92,  -92,  -92,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -92,  -92,  -92,  -92,  -92\n    },\n\n    {\n        7,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,  126,   43,   43,   43,   43,   43,   43,   43,\n       43,  -93,  -93,  -93,  -93,  -93,  -93,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -93,  -93,  -93,  -93,  -93\n    },\n\n    {\n        7,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -94,  -94,  -94,  -94,  -94,  -94,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,  127,   43,   43,   43,   43,   43,\n       43,   43,   43,  -94,  -94,  -94,  -94,  -94\n    },\n\n    {\n        7,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -95,  -95,  -95,  -95,  -95,  -95,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -95,  -95,  -95,  -95,  -95\n    },\n\n    {\n        7,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,  128,   43,   43,   43,\n       43,  -96,  -96,  -96,  -96,  -96,  -96,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,  -96,  -96,  -96,  -96,  -96\n    },\n\n    {\n        7,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,  -97,  -97,  -97,  -97,  -97,  -97,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -97,  -97,  -97,  -97,  -97\n    },\n\n    {\n        7,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n\n      -98,  -98,  -98,  -98,  -98,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -98,  -98,  -98,  -98,  -98,  -98,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,  129,   43,\n       43,   43,   43,  -98,  -98,  -98,  -98,  -98\n    },\n\n    {\n        7,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,   43,   43,   43,   43,  130,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,  131,   43,   43,   43,   43,   43,   43,   43,\n       43,  -99,  -99,  -99,  -99,  -99,  -99,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  -99,  -99,  -99,  -99,  -99\n\n    },\n\n    {\n        7, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -100, -100, -100, -100, -100, -100,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -100, -100, -100, -100, -100\n    },\n\n    {\n        7, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -101, -101, -101, -101, -101, -101,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -101, -101, -101, -101, -101\n    },\n\n    {\n        7, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -102, -102, -102, -102, -102, -102,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -102, -102, -102, -102, -102\n    },\n\n    {\n        7, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103,   43,   43,  132,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -103, -103, -103, -103, -103, -103,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -103, -103, -103, -103, -103\n    },\n\n    {\n        7, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104,   43,   43,   43,   43,  133,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -104, -104, -104, -104, -104, -104,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -104, -104, -104, -104, -104\n    },\n\n    {\n        7, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -105, -105, -105, -105, -105, -105,   43,   43,  134,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -105, -105, -105, -105, -105\n    },\n\n    {\n        7, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106,   43,   43,   43,   43,   43,\n       43,   43,   43,  135,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -106, -106, -106, -106, -106, -106,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43, -106, -106, -106, -106, -106\n    },\n\n    {\n        7, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,  136,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43, -107, -107, -107, -107, -107, -107,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -107, -107, -107, -107, -107\n    },\n\n    {\n        7, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n\n     -108, -108, -108, -108, -108,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,  137,   43,   43,   43,   43,   43,\n       43, -108, -108, -108, -108, -108, -108,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -108, -108, -108, -108, -108\n    },\n\n    {\n        7, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -109, -109, -109, -109, -109, -109,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,  138,   43,   43,   43,\n       43,   43,   43, -109, -109, -109, -109, -109\n\n    },\n\n    {\n        7, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,  139,   43,   43,   43,   43,   43,   43,   43,\n       43, -110, -110, -110, -110, -110, -110,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -110, -110, -110, -110, -110\n    },\n\n    {\n        7, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -111, -111, -111, -111, -111, -111,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,  140,   43,   43,   43,   43,\n       43,   43,   43, -111, -111, -111, -111, -111\n    },\n\n    {\n        7, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -112, -112, -112, -112, -112, -112,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,  141,\n       43,   43,   43,   43,   43,  142,   43,   43,   43,   43,\n       43,   43,   43, -112, -112, -112, -112, -112\n    },\n\n    {\n        7, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -113, -113, -113, -113, -113, -113,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,  143,   43,   43,   43,   43,\n       43,   43,   43, -113, -113, -113, -113, -113\n    },\n\n    {\n        7, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -114, -114, -114, -114, -114, -114,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,  144,   43,   43,   43,   43,   43,\n       43,   43,   43, -114, -114, -114, -114, -114\n    },\n\n    {\n        7, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -115, -115, -115, -115, -115, -115,   43,   43,   43,\n       43,  145,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,  146,   43,   43,   43,   43,   43,\n       43,   43,   43, -115, -115, -115, -115, -115\n    },\n\n    {\n        7, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -116, -116, -116, -116, -116, -116,   43,   43,   43,\n       43,  147,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43, -116, -116, -116, -116, -116\n    },\n\n    {\n        7, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43, -117, -117, -117, -117, -117, -117,   43,   43,   43,\n       43,   43,   43,   43,   43,  148,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -117, -117, -117, -117, -117\n    },\n\n    {\n        7, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n\n     -118, -118, -118, -118, -118,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -118, -118, -118, -118, -118, -118,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  149,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -118, -118, -118, -118, -118\n    },\n\n    {\n        7, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -119, -119, -119, -119, -119, -119,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,  150,   43,   43,   43,   43,   43,\n       43,   43,   43, -119, -119, -119, -119, -119\n\n    },\n\n    {\n        7, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120,   43,   43,   43,   43,   43,\n       43,   43,   43,  151,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -120, -120, -120, -120, -120, -120,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -120, -120, -120, -120, -120\n    },\n\n    {\n        7, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121,   43,   43,   43,   43,  152,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -121, -121, -121, -121, -121, -121,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -121, -121, -121, -121, -121\n    },\n\n    {\n        7, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -122, -122, -122, -122, -122, -122,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,  153,   43,   43,   43,\n       43,   43,   43, -122, -122, -122, -122, -122\n    },\n\n    {\n        7, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -123, -123, -123, -123, -123, -123,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -123, -123, -123, -123, -123\n    },\n\n    {\n        7, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -124, -124, -124, -124, -124, -124,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -124, -124, -124, -124, -124\n    },\n\n    {\n        7, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -125, -125, -125, -125, -125, -125,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -125, -125, -125, -125, -125\n    },\n\n    {\n        7, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126,   43,   43,   43,   43,  154,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -126, -126, -126, -126, -126, -126,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43, -126, -126, -126, -126, -126\n    },\n\n    {\n        7, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43, -127, -127, -127, -127, -127, -127,   43,   43,   43,\n       43,  155,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -127, -127, -127, -127, -127\n    },\n\n    {\n        7, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n\n     -128, -128, -128, -128, -128,   43,   43,   43,   43,   43,\n       43,   43,   43,  156,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -128, -128, -128, -128, -128, -128,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -128, -128, -128, -128, -128\n    },\n\n    {\n        7, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -129, -129, -129, -129, -129, -129,   43,   43,   43,\n       43,   43,   43,   43,   43,  157,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -129, -129, -129, -129, -129\n\n    },\n\n    {\n        7, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,  158,   43,   43,   43,   43,   43,   43,   43,\n       43, -130, -130, -130, -130, -130, -130,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -130, -130, -130, -130, -130\n    },\n\n    {\n        7, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131,   43,   43,   43,   43,  159,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -131, -131, -131, -131, -131, -131,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -131, -131, -131, -131, -131\n    },\n\n    {\n        7, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132,  160,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -132, -132, -132, -132, -132, -132,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -132, -132, -132, -132, -132\n    },\n\n    {\n        7, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,  161,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -133, -133, -133, -133, -133, -133,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -133, -133, -133, -133, -133\n    },\n\n    {\n        7, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -134, -134, -134, -134, -134, -134,  162,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -134, -134, -134, -134, -134\n    },\n\n    {\n        7, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135,  163,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -135, -135, -135, -135, -135, -135,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -135, -135, -135, -135, -135\n    },\n\n    {\n        7, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,  164,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -136, -136, -136, -136, -136, -136,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43, -136, -136, -136, -136, -136\n    },\n\n    {\n        7, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  165,   43,   43,   43,   43,   43,   43,\n\n       43, -137, -137, -137, -137, -137, -137,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -137, -137, -137, -137, -137\n    },\n\n    {\n        7, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n\n     -138, -138, -138, -138, -138,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -138, -138, -138, -138, -138, -138,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,  166,   43,   43,   43,   43,\n       43,   43,   43, -138, -138, -138, -138, -138\n    },\n\n    {\n        7, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  167,   43,   43,   43,   43,   43,   43,\n       43, -139, -139, -139, -139, -139, -139,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -139, -139, -139, -139, -139\n\n    },\n\n    {\n        7, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -140, -140, -140, -140, -140, -140,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,  168,   43,   43,   43,\n       43,   43,   43, -140, -140, -140, -140, -140\n    },\n\n    {\n        7, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -141, -141, -141, -141, -141, -141,   43,   43,   43,\n       43,   43,   43,   43,   43,  169,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -141, -141, -141, -141, -141\n    },\n\n    {\n        7, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -142, -142, -142, -142, -142, -142,   43,   43,   43,\n       43,  170,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -142, -142, -142, -142, -142\n    },\n\n    {\n        7, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -143, -143, -143, -143, -143, -143,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -143, -143, -143, -143, -143\n    },\n\n    {\n        7, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -144, -144, -144, -144, -144, -144,   43,   43,   43,\n       43,  171,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -144, -144, -144, -144, -144\n    },\n\n    {\n        7, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -145, -145, -145, -145, -145, -145,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,  172,   43,   43,   43,   43,   43,\n       43,   43,   43, -145, -145, -145, -145, -145\n    },\n\n    {\n        7, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -146, -146, -146, -146, -146, -146,   43,   43,   43,\n       43,  173,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43, -146, -146, -146, -146, -146\n    },\n\n    {\n        7, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43, -147, -147, -147, -147, -147, -147,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,  174,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -147, -147, -147, -147, -147\n    },\n\n    {\n        7, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n\n     -148, -148, -148, -148, -148,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -148, -148, -148, -148, -148, -148,  175,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -148, -148, -148, -148, -148\n    },\n\n    {\n        7, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -149, -149, -149, -149, -149, -149,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n      176,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -149, -149, -149, -149, -149\n\n    },\n\n    {\n        7, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -150, -150, -150, -150, -150, -150,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   71,   43,   43,   43,   43,\n       43,   43,   43, -150, -150, -150, -150, -150\n    },\n\n    {\n        7, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,  177,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -151, -151, -151, -151, -151, -151,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -151, -151, -151, -151, -151\n    },\n\n    {\n        7, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152,   43,   43,  178,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -152, -152, -152, -152, -152, -152,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -152, -152, -152, -152, -152\n    },\n\n    {\n        7, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -153, -153, -153, -153, -153, -153,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,  179,   43,   43,   43,   43,   43,\n       43,   43,   43, -153, -153, -153, -153, -153\n    },\n\n    {\n        7, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154,   43,   43,   43,   43,  180,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -154, -154, -154, -154, -154, -154,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -154, -154, -154, -154, -154\n    },\n\n    {\n        7, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -155, -155, -155, -155, -155, -155,   43,   43,   43,\n       43,  181,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -155, -155, -155, -155, -155\n    },\n\n    {\n        7, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,  182,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -156, -156, -156, -156, -156, -156,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43, -156, -156, -156, -156, -156\n    },\n\n    {\n        7, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43, -157, -157, -157, -157, -157, -157,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n      183,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -157, -157, -157, -157, -157\n    },\n\n    {\n        7, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n\n     -158, -158, -158, -158, -158,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  184,   43,   43,   43,   43,   43,   43,\n       43, -158, -158, -158, -158, -158, -158,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -158, -158, -158, -158, -158\n    },\n\n    {\n        7, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  185,   43,   43,   43,   43,   43,   43,\n       43, -159, -159, -159, -159, -159, -159,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -159, -159, -159, -159, -159\n\n    },\n\n    {\n        7, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,  186,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -160, -160, -160, -160, -160, -160,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -160, -160, -160, -160, -160\n    },\n\n    {\n        7, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  187,   43,   43,   43,   43,   43,   43,\n       43, -161, -161, -161, -161, -161, -161,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -161, -161, -161, -161, -161\n    },\n\n    {\n        7, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -162, -162, -162, -162, -162, -162,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,  188,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -162, -162, -162, -162, -162\n    },\n\n    {\n        7, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,  189,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -163, -163, -163, -163, -163, -163,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -163, -163, -163, -163, -163\n    },\n\n    {\n        7, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164,   43,   43,   43,  190,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -164, -164, -164, -164, -164, -164,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -164, -164, -164, -164, -164\n    },\n\n    {\n        7, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -165, -165, -165, -165, -165, -165,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -165, -165, -165, -165, -165\n    },\n\n    {\n        7, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -166, -166, -166, -166, -166, -166,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43, -166, -166, -166, -166, -166\n    },\n\n    {\n        7, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43, -167, -167, -167, -167, -167, -167,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -167, -167, -167, -167, -167\n    },\n\n    {\n        7, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n\n     -168, -168, -168, -168, -168,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -168, -168, -168, -168, -168, -168,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,  191,   43,   43,   43,   43,   43,\n       43,   43,   43, -168, -168, -168, -168, -168\n    },\n\n    {\n        7, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -169, -169, -169, -169, -169, -169,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n      192,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -169, -169, -169, -169, -169\n\n    },\n\n    {\n        7, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -170, -170, -170, -170, -170, -170,   43,   43,  193,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -170, -170, -170, -170, -170\n    },\n\n    {\n        7, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -171, -171, -171, -171, -171, -171,   43,   43,   43,\n       43,  194,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -171, -171, -171, -171, -171\n    },\n\n    {\n        7, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -172, -172, -172, -172, -172, -172,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,  195,   43,   43,   43,   43,\n       43,   43,   43, -172, -172, -172, -172, -172\n    },\n\n    {\n        7, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -173, -173, -173, -173, -173, -173,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,  196,   43,   43,   43,   43,\n       43,   43,   43, -173, -173, -173, -173, -173\n    },\n\n    {\n        7, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -174, -174, -174, -174, -174, -174,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,  187,   43,   43,   43,   43,\n       43,   43,   43, -174, -174, -174, -174, -174\n    },\n\n    {\n        7, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -175, -175, -175, -175, -175, -175,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n      197,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -175, -175, -175, -175, -175\n    },\n\n    {\n        7, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -176, -176, -176, -176, -176, -176,   43,   43,   43,\n      198,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43, -176, -176, -176, -176, -176\n    },\n\n    {\n        7, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  199,   43,   43,   43,   43,   43,   43,\n\n       43, -177, -177, -177, -177, -177, -177,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -177, -177, -177, -177, -177\n    },\n\n    {\n        7, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n\n     -178, -178, -178, -178, -178,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  200,   43,   43,   43,   43,   43,   43,\n       43, -178, -178, -178, -178, -178, -178,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -178, -178, -178, -178, -178\n    },\n\n    {\n        7, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -179, -179, -179, -179, -179, -179,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  201,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -179, -179, -179, -179, -179\n\n    },\n\n    {\n        7, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  202,   43,   43,   43,   43,   43,   43,\n       43, -180, -180, -180, -180, -180, -180,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -180, -180, -180, -180, -180\n    },\n\n    {\n        7, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -181, -181, -181, -181, -181, -181,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,  203,   43,   43,   43,   43,\n       43,   43,   43, -181, -181, -181, -181, -181\n    },\n\n    {\n        7, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  204,   43,   43,   43,   43,   43,   43,\n       43, -182, -182, -182, -182, -182, -182,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -182, -182, -182, -182, -182\n    },\n\n    {\n        7, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -183, -183, -183, -183, -183, -183,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,  205,   43,   43,   43,   43,\n       43,   43,   43, -183, -183, -183, -183, -183\n    },\n\n    {\n        7, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -184, -184, -184, -184, -184, -184,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -184, -184, -184, -184, -184\n    },\n\n    {\n        7, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -185, -185, -185, -185, -185, -185,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -185, -185, -185, -185, -185\n    },\n\n    {\n        7, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  206,   43,   43,   43,   43,   43,   43,\n       43, -186, -186, -186, -186, -186, -186,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43, -186, -186, -186, -186, -186\n    },\n\n    {\n        7, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43, -187, -187, -187, -187, -187, -187,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -187, -187, -187, -187, -187\n    },\n\n    {\n        7, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n\n     -188, -188, -188, -188, -188,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -188, -188, -188, -188, -188, -188,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,  207,   43,   43,   43,   43,\n       43,   43,   43, -188, -188, -188, -188, -188\n    },\n\n    {\n        7, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  208,   43,   43,   43,   43,   43,   43,\n       43, -189, -189, -189, -189, -189, -189,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -189, -189, -189, -189, -189\n\n    },\n\n    {\n        7, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  209,   43,   43,   43,   43,   43,   43,\n       43, -190, -190, -190, -190, -190, -190,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -190, -190, -190, -190, -190\n    },\n\n    {\n        7, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -191, -191, -191, -191, -191, -191,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  210,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -191, -191, -191, -191, -191\n    },\n\n    {\n        7, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -192, -192, -192, -192, -192, -192,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,  199,   43,   43,   43,   43,\n       43,   43,   43, -192, -192, -192, -192, -192\n    },\n\n    {\n        7, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -193, -193, -193, -193, -193, -193,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,  200,   43,   43,   43,   43,\n       43,   43,   43, -193, -193, -193, -193, -193\n    },\n\n    {\n        7, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -194, -194, -194, -194, -194, -194,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,  211,   43,   43,   43,   43,\n       43,   43,   43, -194, -194, -194, -194, -194\n    },\n\n    {\n        7, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -195, -195, -195, -195, -195, -195,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -195, -195, -195, -195, -195\n    },\n\n    {\n        7, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -196, -196, -196, -196, -196, -196,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43, -196, -196, -196, -196, -196\n    },\n\n    {\n        7, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43, -197, -197, -197, -197, -197, -197,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,  212,   43,   43,   43,   43,\n       43,   43,   43, -197, -197, -197, -197, -197\n    },\n\n    {\n        7, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n\n     -198, -198, -198, -198, -198,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -198, -198, -198, -198, -198, -198,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,  213,   43,   43,   43,   43,\n       43,   43,   43, -198, -198, -198, -198, -198\n    },\n\n    {\n        7, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -199, -199, -199, -199, -199, -199,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -199, -199, -199, -199, -199\n\n    },\n\n    {\n        7, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -200, -200, -200, -200, -200, -200,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -200, -200, -200, -200, -200\n    },\n\n    {\n        7, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -201, -201, -201, -201, -201, -201,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,  214,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -201, -201, -201, -201, -201\n    },\n\n    {\n        7, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -202, -202, -202, -202, -202, -202,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -202, -202, -202, -202, -202\n    },\n\n    {\n        7, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -203, -203, -203, -203, -203, -203,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -203, -203, -203, -203, -203\n    },\n\n    {\n        7, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -204, -204, -204, -204, -204, -204,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -204, -204, -204, -204, -204\n    },\n\n    {\n        7, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -205, -205, -205, -205, -205, -205,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -205, -205, -205, -205, -205\n    },\n\n    {\n        7, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -206, -206, -206, -206, -206, -206,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43, -206, -206, -206, -206, -206\n    },\n\n    {\n        7, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43, -207, -207, -207, -207, -207, -207,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -207, -207, -207, -207, -207\n    },\n\n    {\n        7, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n\n     -208, -208, -208, -208, -208,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -208, -208, -208, -208, -208, -208,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -208, -208, -208, -208, -208\n    },\n\n    {\n        7, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -209, -209, -209, -209, -209, -209,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -209, -209, -209, -209, -209\n\n    },\n\n    {\n        7, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -210, -210, -210, -210, -210, -210,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,  215,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -210, -210, -210, -210, -210\n    },\n\n    {\n        7, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -211, -211, -211, -211, -211, -211,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -211, -211, -211, -211, -211\n    },\n\n    {\n        7, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -212, -212, -212, -212, -212, -212,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -212, -212, -212, -212, -212\n    },\n\n    {\n        7, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -213, -213, -213, -213, -213, -213,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43, -213, -213, -213, -213, -213\n    },\n\n    {\n        7, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -214, -214, -214, -214, -214, -214,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,  216,   43,   43,   43,   43,\n       43,   43,   43, -214, -214, -214, -214, -214\n    },\n\n    {\n        7, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -215, -215, -215, -215, -215, -215,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,  216,   43,   43,   43,   43,\n       43,   43,   43, -215, -215, -215, -215, -215\n    },\n\n    {\n        7, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -216, -216, -216, -216, -216, -216,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43, -216, -216, -216, -216, -216\n    },\n\n    } ;\n\nstatic yy_state_type yy_get_previous_state ( yyscan_t yyscanner );\nstatic yy_state_type yy_try_NUL_trans ( yy_state_type current_state  , yyscan_t yyscanner);\nstatic int yy_get_next_buffer ( yyscan_t yyscanner );\nstatic void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );\n\n/* Done after the current pattern has been matched and before the\n * corresponding action - sets up yytext.\n */\n#define YY_DO_BEFORE_ACTION \\\n\tyyg->yytext_ptr = yy_bp; \\\n\tyyleng = (int) (yy_cp - yy_bp); \\\n\tyyg->yy_hold_char = *yy_cp; \\\n\t*yy_cp = '\\0'; \\\n\tyyg->yy_c_buf_p = yy_cp;\n#define YY_NUM_RULES 37\n#define YY_END_OF_BUFFER 38\n/* This struct is not used in this scanner,\n   but its presence is necessary. */\nstruct yy_trans_info\n\t{\n\tflex_int32_t yy_verify;\n\tflex_int32_t yy_nxt;\n\t};\nstatic const flex_int16_t yy_accept[217] =\n    {   0,\n        0,    0,    0,    0,   36,   36,   38,    3,    2,   31,\n       31,   31,   10,   31,   14,   31,   31,   20,   31,   31,\n       31,   28,   31,   31,   31,   31,   31,   31,   31,   31,\n       31,   31,   31,   31,    2,    1,   35,   37,   35,   32,\n       36,    2,   31,   31,   31,   31,   31,   31,   31,   31,\n       31,   13,   15,   17,   31,   31,   19,   31,   31,   31,\n       31,   31,   31,   31,   31,   31,   31,   31,   31,   31,\n       30,   31,   31,   31,   31,   31,   31,   31,   31,   31,\n        2,    1,   33,   33,   34,   32,   36,   31,   31,   31,\n       31,    9,   11,   11,   12,   31,   16,   31,   31,   22,\n\n       21,   23,   31,   31,   31,   26,   27,   31,   31,   31,\n       31,   31,    9,   31,   31,   31,   31,   27,   31,   31,\n       31,   31,    7,    8,    9,   31,   31,   31,   31,   31,\n       31,   31,   31,   31,   31,   31,   29,   29,   30,   31,\n       31,   31,    9,   31,   31,   31,   31,   31,   31,   30,\n       31,   31,   31,   31,   31,   31,   31,   20,   20,   31,\n       25,   31,   31,   31,   29,   29,   30,   31,   31,   31,\n       31,   20,   20,   31,   31,   31,    5,    6,   31,   11,\n       11,   18,   18,   20,   20,   24,   25,   24,   26,   27,\n       31,   31,   31,   11,   20,   20,   26,   27,    5,    6,\n\n       31,   11,   11,   18,   18,   24,   24,   26,   27,   31,\n       11,   26,   27,   31,    4,    4\n    } ;\n\nstatic const yy_state_type yy_NUL_trans[217] =\n    {   0,\n        8,    8,   37,   37,   41,   41,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,   83,    0,\n       87,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,   83,    0,    0,   87,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0\n    } ;\n\n/* The intent behind this definition is that it'll catch\n * any uses of REJECT which flex missed.\n */\n#define REJECT reject_used_but_not_detected\n#define yymore() yymore_used_but_not_detected\n#define YY_MORE_ADJ 0\n#define YY_RESTORE_YY_MORE_OFFSET\n#line 1 \"wcsutrn.l\"\n/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsutrn.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* wcsutrn.l is a Flex description file containing the definition of a lexical\n* scanner that translates non-standard FITS units specifications.\n*\n* It requires Flex v2.5.4 or later.\n*\n* Refer to wcsunits.h for a description of the user interface and operating\n* notes.\n*\n*===========================================================================*/\n/* Options. */\n#define YY_NO_INPUT 1\n/* Exclusive start states. */\n\n#line 49 \"wcsutrn.l\"\n#include <setjmp.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"wcserr.h\"\n#include \"wcsunits.h\"\n\n// User data associated with yyscanner.\nstruct wcsutrn_extra {\n  // Used in preempting the call to exit() by yy_fatal_error().\n  jmp_buf abort_jmp_env;\n};\n\n#define YY_DECL int wcsutrne_scanner(int ctrl, char unitstr[], \\\n struct wcserr **err, yyscan_t yyscanner)\n\n// Dummy definition to circumvent compiler warnings.\n#define YY_INPUT(inbuff, count, bufsize) { count = YY_NULL; }\n\n// Preempt the call to exit() by yy_fatal_error().\n#define exit(status) longjmp(yyextra->abort_jmp_env, status);\n\n// Internal helper functions.\nstatic YY_DECL;\n\n#line 4449 \"wcsutrn.c\"\n#line 4450 \"wcsutrn.c\"\n\n#define INITIAL 0\n#define NEXT 1\n#define FLUSH 2\n\n#ifndef YY_NO_UNISTD_H\n/* Special case for \"unistd.h\", since it is non-ANSI. We include it way\n * down here because we want the user's section 1 to have been scanned first.\n * The user has a chance to override it with an option.\n */\n#include <unistd.h>\n#endif\n\n#define YY_EXTRA_TYPE struct wcsutrn_extra *\n\n/* Holds the entire state of the reentrant scanner. */\nstruct yyguts_t\n    {\n\n    /* User-defined. Not touched by flex. */\n    YY_EXTRA_TYPE yyextra_r;\n\n    /* The rest are the same as the globals declared in the non-reentrant scanner. */\n    FILE *yyin_r, *yyout_r;\n    size_t yy_buffer_stack_top; /**< index of top of stack. */\n    size_t yy_buffer_stack_max; /**< capacity of stack. */\n    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */\n    char yy_hold_char;\n    int yy_n_chars;\n    int yyleng_r;\n    char *yy_c_buf_p;\n    int yy_init;\n    int yy_start;\n    int yy_did_buffer_switch_on_eof;\n    int yy_start_stack_ptr;\n    int yy_start_stack_depth;\n    int *yy_start_stack;\n    yy_state_type yy_last_accepting_state;\n    char* yy_last_accepting_cpos;\n\n    int yylineno_r;\n    int yy_flex_debug_r;\n\n    char *yytext_r;\n    int yy_more_flag;\n    int yy_more_len;\n\n    }; /* end struct yyguts_t */\n\nstatic int yy_init_globals ( yyscan_t yyscanner );\n\nint yylex_init (yyscan_t* scanner);\n\nint yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);\n\n/* Accessor methods to globals.\n   These are made visible to non-reentrant scanners for convenience. */\n\nint yylex_destroy ( yyscan_t yyscanner );\n\nint yyget_debug ( yyscan_t yyscanner );\n\nvoid yyset_debug ( int debug_flag , yyscan_t yyscanner );\n\nYY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );\n\nvoid yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );\n\nFILE *yyget_in ( yyscan_t yyscanner );\n\nvoid yyset_in  ( FILE * _in_str , yyscan_t yyscanner );\n\nFILE *yyget_out ( yyscan_t yyscanner );\n\nvoid yyset_out  ( FILE * _out_str , yyscan_t yyscanner );\n\n\t\t\tint yyget_leng ( yyscan_t yyscanner );\n\nchar *yyget_text ( yyscan_t yyscanner );\n\nint yyget_lineno ( yyscan_t yyscanner );\n\nvoid yyset_lineno ( int _line_number , yyscan_t yyscanner );\n\nint yyget_column  ( yyscan_t yyscanner );\n\nvoid yyset_column ( int _column_no , yyscan_t yyscanner );\n\n/* Macros after this point can all be overridden by user definitions in\n * section 1.\n */\n\n#ifndef YY_SKIP_YYWRAP\n#ifdef __cplusplus\nextern \"C\" int yywrap ( yyscan_t yyscanner );\n#else\nextern int yywrap ( yyscan_t yyscanner );\n#endif\n#endif\n\n#ifndef YY_NO_UNPUT\n    \n    static void yyunput ( int c, char *buf_ptr  , yyscan_t yyscanner);\n    \n#endif\n\n#ifndef yytext_ptr\nstatic void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);\n#endif\n\n#ifdef YY_NEED_STRLEN\nstatic int yy_flex_strlen ( const char * , yyscan_t yyscanner);\n#endif\n\n#ifndef YY_NO_INPUT\n#ifdef __cplusplus\nstatic int yyinput ( yyscan_t yyscanner );\n#else\nstatic int input ( yyscan_t yyscanner );\n#endif\n\n#endif\n\n/* Amount of stuff to slurp up with each read. */\n#ifndef YY_READ_BUF_SIZE\n#ifdef __ia64__\n/* On IA-64, the buffer size is 16k, not 8k */\n#define YY_READ_BUF_SIZE 16384\n#else\n#define YY_READ_BUF_SIZE 8192\n#endif /* __ia64__ */\n#endif\n\n/* Copy whatever the last rule matched to the standard output. */\n#ifndef ECHO\n/* This used to be an fputs(), but since the string might contain NUL's,\n * we now use fwrite().\n */\n#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)\n#endif\n\n/* Gets input and stuffs it into \"buf\".  number of characters read, or YY_NULL,\n * is returned in \"result\".\n */\n#ifndef YY_INPUT\n#define YY_INPUT(buf,result,max_size) \\\n\terrno=0; \\\n\twhile ( (result = (int) read( fileno(yyin), buf, (yy_size_t) max_size )) < 0 ) \\\n\t{ \\\n\t\tif( errno != EINTR) \\\n\t\t{ \\\n\t\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" ); \\\n\t\t\tbreak; \\\n\t\t} \\\n\t\terrno=0; \\\n\t\tclearerr(yyin); \\\n\t}\\\n\\\n\n#endif\n\n/* No semi-colon after return; correct usage is to write \"yyterminate();\" -\n * we don't want an extra ';' after the \"return\" because that will cause\n * some compilers to complain about unreachable statements.\n */\n#ifndef yyterminate\n#define yyterminate() return YY_NULL\n#endif\n\n/* Number of entries by which start-condition stack grows. */\n#ifndef YY_START_STACK_INCR\n#define YY_START_STACK_INCR 25\n#endif\n\n/* Report a fatal error. */\n#ifndef YY_FATAL_ERROR\n#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)\n#endif\n\n/* end tables serialization structures and prototypes */\n\n/* Default declaration of generated scanner - a define so the user can\n * easily add parameters.\n */\n#ifndef YY_DECL\n#define YY_DECL_IS_OURS 1\n\nextern int yylex (yyscan_t yyscanner);\n\n#define YY_DECL int yylex (yyscan_t yyscanner)\n#endif /* !YY_DECL */\n\n/* Code executed at the beginning of each rule, after yytext and yyleng\n * have been set up.\n */\n#ifndef YY_USER_ACTION\n#define YY_USER_ACTION\n#endif\n\n/* Code executed at the end of each rule. */\n#ifndef YY_BREAK\n#define YY_BREAK /*LINTED*/break;\n#endif\n\n#define YY_RULE_SETUP \\\n\tif ( yyleng > 0 ) \\\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = \\\n\t\t\t\t(yytext[yyleng - 1] == '\\n'); \\\n\tYY_USER_ACTION\n\n/** The main scanner function which does all the work.\n */\nYY_DECL\n{\n\tyy_state_type yy_current_state;\n\tchar *yy_cp, *yy_bp;\n\tint yy_act;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif ( !yyg->yy_init )\n\t\t{\n\t\tyyg->yy_init = 1;\n\n#ifdef YY_USER_INIT\n\t\tYY_USER_INIT;\n#endif\n\n\t\tif ( ! yyg->yy_start )\n\t\t\tyyg->yy_start = 1;\t/* first start state */\n\n\t\tif ( ! yyin )\n\t\t\tyyin = stdin;\n\n\t\tif ( ! yyout )\n\t\t\tyyout = stdout;\n\n\t\tif ( ! YY_CURRENT_BUFFER ) {\n\t\t\tyyensure_buffer_stack (yyscanner);\n\t\t\tYY_CURRENT_BUFFER_LVALUE =\n\t\t\t\tyy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);\n\t\t}\n\n\t\tyy_load_buffer_state( yyscanner );\n\t\t}\n\n\t{\n#line 77 \"wcsutrn.l\"\n\n#line 79 \"wcsutrn.l\"\n\tstatic const char *function = \"wcsutrne_scanner\";\n\t\n\tif (err) *err = 0x0;\n\t\n\tchar orig[80], subs[80];\n\t*orig = '\\0';\n\t*subs = '\\0';\n\t\n\tint bracket = 0;\n\tint unsafe  = 0;\n\tint status  = -1;\n\t\n\tyy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);\n\tyy_scan_string(unitstr, yyscanner);\n\t*unitstr = '\\0';\n\t\n\t// Return here via longjmp() invoked by yy_fatal_error().\n\tif (setjmp(yyextra->abort_jmp_env)) {\n\t  return wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR),\n\t    \"Internal units translator error\");\n\t}\n\t\n\tBEGIN(INITIAL);\n\t\n#ifdef DEBUG\n\tfprintf(stderr, \"\\n%s ->\\n\", unitstr);\n#endif\n\n#line 4728 \"wcsutrn.c\"\n\n\twhile ( /*CONSTCOND*/1 )\t\t/* loops until end-of-file is reached */\n\t\t{\n\t\tyy_cp = yyg->yy_c_buf_p;\n\n\t\t/* Support of yytext. */\n\t\t*yy_cp = yyg->yy_hold_char;\n\n\t\t/* yy_bp points to the position in yy_ch_buf of the start of\n\t\t * the current run.\n\t\t */\n\t\tyy_bp = yy_cp;\n\n\t\tyy_current_state = yyg->yy_start;\n\t\tyy_current_state += YY_AT_BOL();\nyy_match:\n\t\twhile ( (yy_current_state = yy_nxt[yy_current_state][ YY_SC_TO_UI(*yy_cp) ]) > 0 )\n\t\t\t++yy_cp;\n\n\t\tyy_current_state = -yy_current_state;\n\nyy_find_action:\n\t\tyy_act = yy_accept[yy_current_state];\n\n\t\tYY_DO_BEFORE_ACTION;\n\ndo_action:\t/* This label is used only to access EOF actions. */\n\n\t\tswitch ( yy_act )\n\t{ /* beginning of action switch */\ncase 1:\nYY_RULE_SETUP\n#line 107 \"wcsutrn.l\"\n{\n\t  // Looks like a keycomment.\n\t  strcat(unitstr, \"[\");\n\t  bracket = 1;\n\t}\n\tYY_BREAK\ncase 2:\nYY_RULE_SETUP\n#line 113 \"wcsutrn.l\"\n// Discard leading whitespace.\n\tYY_BREAK\ncase 3:\n/* rule 3 can match eol */\nYY_RULE_SETUP\n#line 115 \"wcsutrn.l\"\n{\n\t  // Non-alphabetic character.\n\t  strcat(unitstr, yytext);\n\t  if (bracket && *yytext == ']') {\n\t    BEGIN(FLUSH);\n\t  }\n\t}\n\tYY_BREAK\ncase 4:\nYY_RULE_SETUP\n#line 123 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"Angstrom\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 5:\nYY_RULE_SETUP\n#line 129 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"arcmin\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 6:\nYY_RULE_SETUP\n#line 135 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"arcsec\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 7:\nYY_RULE_SETUP\n#line 141 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"beam\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 8:\nYY_RULE_SETUP\n#line 147 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"byte\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 9:\nYY_RULE_SETUP\n#line 153 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"d\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 10:\nYY_RULE_SETUP\n#line 159 \"wcsutrn.l\"\n{\n\t  unsafe = 1;\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, (ctrl & 4) ? \"d\" : \"D\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 11:\nYY_RULE_SETUP\n#line 166 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"deg\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 12:\nYY_RULE_SETUP\n#line 172 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"GHz\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 13:\nYY_RULE_SETUP\n#line 178 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"h\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 14:\nYY_RULE_SETUP\n#line 184 \"wcsutrn.l\"\n{\n\t  unsafe = 1;\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, (ctrl & 2) ? \"h\" : \"H\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 15:\nYY_RULE_SETUP\n#line 191 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"Hz\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 16:\nYY_RULE_SETUP\n#line 197 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"kHz\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 17:\nYY_RULE_SETUP\n#line 203 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"Jy\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 18:\nYY_RULE_SETUP\n#line 209 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"K\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 19:\nYY_RULE_SETUP\n#line 215 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"km\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 20:\nYY_RULE_SETUP\n#line 221 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"m\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 21:\nYY_RULE_SETUP\n#line 227 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"min\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 22:\nYY_RULE_SETUP\n#line 233 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"MHz\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 23:\nYY_RULE_SETUP\n#line 239 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"ohm\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 24:\nYY_RULE_SETUP\n#line 245 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"Pa\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 25:\nYY_RULE_SETUP\n#line 251 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"pixel\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 26:\nYY_RULE_SETUP\n#line 257 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"rad\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 27:\nYY_RULE_SETUP\n#line 263 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"s\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 28:\nYY_RULE_SETUP\n#line 269 \"wcsutrn.l\"\n{\n\t  unsafe = 1;\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, (ctrl & 1) ? \"s\" : \"S\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 29:\nYY_RULE_SETUP\n#line 276 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"V\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 30:\nYY_RULE_SETUP\n#line 282 \"wcsutrn.l\"\n{\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, \"yr\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 31:\nYY_RULE_SETUP\n#line 288 \"wcsutrn.l\"\n{\n\t  // Not a recognized alias.\n\t  strcpy(orig, yytext);\n\t  strcpy(subs, orig);\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 32:\nYY_RULE_SETUP\n#line 295 \"wcsutrn.l\"\n{\n\t  // Reject the alias match.\n\t  strcat(orig, yytext);\n\t  strcpy(subs, orig);\n\t}\n\tYY_BREAK\ncase 33:\n/* rule 33 can match eol */\nYY_RULE_SETUP\n#line 301 \"wcsutrn.l\"\n{\n\t  // Discard separating whitespace.\n\t  unput(yytext[yyleng-1]);\n\t}\n\tYY_BREAK\ncase 34:\nYY_RULE_SETUP\n#line 306 \"wcsutrn.l\"\n{\n\t  // Compress separating whitespace.\n\t  strcat(unitstr, subs);\n\t  strcat(unitstr, \" \");\n\t  if (strcmp(orig, subs)) status = 0;\n\t  unput(yytext[yyleng-1]);\n\t  *subs = '\\0';\n\t  BEGIN(INITIAL);\n\t}\n\tYY_BREAK\ncase 35:\nYY_RULE_SETUP\n#line 316 \"wcsutrn.l\"\n{\n\t  // Copy anything else unchanged.\n\t  strcat(unitstr, subs);\n\t  if (strcmp(orig, subs)) status = 0;\n\t  unput(*yytext);\n\t  *subs = '\\0';\n\t  BEGIN(INITIAL);\n\t}\n\tYY_BREAK\ncase 36:\nYY_RULE_SETUP\n#line 325 \"wcsutrn.l\"\n{\n\t  // Copy out remaining input.\n\t  strcat(unitstr, yytext);\n\t}\n\tYY_BREAK\ncase YY_STATE_EOF(INITIAL):\ncase YY_STATE_EOF(NEXT):\ncase YY_STATE_EOF(FLUSH):\n#line 330 \"wcsutrn.l\"\n{\n\t  // End-of-string.\n\t  if (*subs) {\n\t    strcat(unitstr, subs);\n\t    if (strcmp(orig, subs)) status = 0;\n\t  }\n\t\n\t  if (unsafe) {\n\t    return wcserr_set(WCSERR_SET(UNITSERR_UNSAFE_TRANS),\n\t      \"Unsafe unit translation in '%s'\", unitstr);\n\t  }\n\t  return status;\n\t}\n\tYY_BREAK\ncase 37:\nYY_RULE_SETUP\n#line 344 \"wcsutrn.l\"\nECHO;\n\tYY_BREAK\n#line 5115 \"wcsutrn.c\"\n\n\tcase YY_END_OF_BUFFER:\n\t\t{\n\t\t/* Amount of text matched not including the EOB char. */\n\t\tint yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;\n\n\t\t/* Undo the effects of YY_DO_BEFORE_ACTION. */\n\t\t*yy_cp = yyg->yy_hold_char;\n\t\tYY_RESTORE_YY_MORE_OFFSET\n\n\t\tif ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )\n\t\t\t{\n\t\t\t/* We're scanning a new file or input source.  It's\n\t\t\t * possible that this happened because the user\n\t\t\t * just pointed yyin at a new source and called\n\t\t\t * yylex().  If so, then we have to assure\n\t\t\t * consistency between YY_CURRENT_BUFFER and our\n\t\t\t * globals.  Here is the right place to do so, because\n\t\t\t * this is the first action (other than possibly a\n\t\t\t * back-up) that will match for the new input source.\n\t\t\t */\n\t\t\tyyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;\n\t\t\t}\n\n\t\t/* Note that here we test for yy_c_buf_p \"<=\" to the position\n\t\t * of the first EOB in the buffer, since yy_c_buf_p will\n\t\t * already have been incremented past the NUL character\n\t\t * (since all states make transitions on EOB to the\n\t\t * end-of-buffer state).  Contrast this with the test\n\t\t * in input().\n\t\t */\n\t\tif ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )\n\t\t\t{ /* This was really a NUL. */\n\t\t\tyy_state_type yy_next_state;\n\n\t\t\tyyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;\n\n\t\t\tyy_current_state = yy_get_previous_state( yyscanner );\n\n\t\t\t/* Okay, we're now positioned to make the NUL\n\t\t\t * transition.  We couldn't have\n\t\t\t * yy_get_previous_state() go ahead and do it\n\t\t\t * for us because it doesn't know how to deal\n\t\t\t * with the possibility of jamming (and we don't\n\t\t\t * want to build jamming into it because then it\n\t\t\t * will run more slowly).\n\t\t\t */\n\n\t\t\tyy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);\n\n\t\t\tyy_bp = yyg->yytext_ptr + YY_MORE_ADJ;\n\n\t\t\tif ( yy_next_state )\n\t\t\t\t{\n\t\t\t\t/* Consume the NUL. */\n\t\t\t\tyy_cp = ++yyg->yy_c_buf_p;\n\t\t\t\tyy_current_state = yy_next_state;\n\t\t\t\tgoto yy_match;\n\t\t\t\t}\n\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tyy_cp = yyg->yy_c_buf_p;\n\t\t\t\tgoto yy_find_action;\n\t\t\t\t}\n\t\t\t}\n\n\t\telse switch ( yy_get_next_buffer( yyscanner ) )\n\t\t\t{\n\t\t\tcase EOB_ACT_END_OF_FILE:\n\t\t\t\t{\n\t\t\t\tyyg->yy_did_buffer_switch_on_eof = 0;\n\n\t\t\t\tif ( yywrap( yyscanner ) )\n\t\t\t\t\t{\n\t\t\t\t\t/* Note: because we've taken care in\n\t\t\t\t\t * yy_get_next_buffer() to have set up\n\t\t\t\t\t * yytext, we can now set up\n\t\t\t\t\t * yy_c_buf_p so that if some total\n\t\t\t\t\t * hoser (like flex itself) wants to\n\t\t\t\t\t * call the scanner after we return the\n\t\t\t\t\t * YY_NULL, it'll still work - another\n\t\t\t\t\t * YY_NULL will get returned.\n\t\t\t\t\t */\n\t\t\t\t\tyyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;\n\n\t\t\t\t\tyy_act = YY_STATE_EOF(YY_START);\n\t\t\t\t\tgoto do_action;\n\t\t\t\t\t}\n\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\tif ( ! yyg->yy_did_buffer_switch_on_eof )\n\t\t\t\t\t\tYY_NEW_FILE;\n\t\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\tcase EOB_ACT_CONTINUE_SCAN:\n\t\t\t\tyyg->yy_c_buf_p =\n\t\t\t\t\tyyg->yytext_ptr + yy_amount_of_matched_text;\n\n\t\t\t\tyy_current_state = yy_get_previous_state( yyscanner );\n\n\t\t\t\tyy_cp = yyg->yy_c_buf_p;\n\t\t\t\tyy_bp = yyg->yytext_ptr + YY_MORE_ADJ;\n\t\t\t\tgoto yy_match;\n\n\t\t\tcase EOB_ACT_LAST_MATCH:\n\t\t\t\tyyg->yy_c_buf_p =\n\t\t\t\t&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];\n\n\t\t\t\tyy_current_state = yy_get_previous_state( yyscanner );\n\n\t\t\t\tyy_cp = yyg->yy_c_buf_p;\n\t\t\t\tyy_bp = yyg->yytext_ptr + YY_MORE_ADJ;\n\t\t\t\tgoto yy_find_action;\n\t\t\t}\n\t\tbreak;\n\t\t}\n\n\tdefault:\n\t\tYY_FATAL_ERROR(\n\t\t\t\"fatal flex scanner internal error--no action found\" );\n\t} /* end of action switch */\n\t\t} /* end of scanning one token */\n\t} /* end of user's declarations */\n} /* end of yylex */\n\n/* yy_get_next_buffer - try to read in a new buffer\n *\n * Returns a code representing an action:\n *\tEOB_ACT_LAST_MATCH -\n *\tEOB_ACT_CONTINUE_SCAN - continue scanning from current position\n *\tEOB_ACT_END_OF_FILE - end of file\n */\nstatic int yy_get_next_buffer (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tchar *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;\n\tchar *source = yyg->yytext_ptr;\n\tint number_to_move, i;\n\tint ret_val;\n\n\tif ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )\n\t\tYY_FATAL_ERROR(\n\t\t\"fatal flex scanner internal error--end of buffer missed\" );\n\n\tif ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )\n\t\t{ /* Don't try to fill the buffer, so this is an EOF. */\n\t\tif ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )\n\t\t\t{\n\t\t\t/* We matched a single character, the EOB, so\n\t\t\t * treat this as a final EOF.\n\t\t\t */\n\t\t\treturn EOB_ACT_END_OF_FILE;\n\t\t\t}\n\n\t\telse\n\t\t\t{\n\t\t\t/* We matched some text prior to the EOB, first\n\t\t\t * process it.\n\t\t\t */\n\t\t\treturn EOB_ACT_LAST_MATCH;\n\t\t\t}\n\t\t}\n\n\t/* Try to read more data. */\n\n\t/* First move last chars to start of buffer. */\n\tnumber_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);\n\n\tfor ( i = 0; i < number_to_move; ++i )\n\t\t*(dest++) = *(source++);\n\n\tif ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )\n\t\t/* don't do the read, it's not guaranteed to return an EOF,\n\t\t * just force an EOF\n\t\t */\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;\n\n\telse\n\t\t{\n\t\t\tint num_to_read =\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;\n\n\t\twhile ( num_to_read <= 0 )\n\t\t\t{ /* Not enough room in the buffer - grow it. */\n\n\t\t\t/* just a shorter name for the current buffer */\n\t\t\tYY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;\n\n\t\t\tint yy_c_buf_p_offset =\n\t\t\t\t(int) (yyg->yy_c_buf_p - b->yy_ch_buf);\n\n\t\t\tif ( b->yy_is_our_buffer )\n\t\t\t\t{\n\t\t\t\tint new_size = b->yy_buf_size * 2;\n\n\t\t\t\tif ( new_size <= 0 )\n\t\t\t\t\tb->yy_buf_size += b->yy_buf_size / 8;\n\t\t\t\telse\n\t\t\t\t\tb->yy_buf_size *= 2;\n\n\t\t\t\tb->yy_ch_buf = (char *)\n\t\t\t\t\t/* Include room in for 2 EOB chars. */\n\t\t\t\t\tyyrealloc( (void *) b->yy_ch_buf,\n\t\t\t\t\t\t\t (yy_size_t) (b->yy_buf_size + 2) , yyscanner );\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t/* Can't grow it, we don't own it. */\n\t\t\t\tb->yy_ch_buf = NULL;\n\n\t\t\tif ( ! b->yy_ch_buf )\n\t\t\t\tYY_FATAL_ERROR(\n\t\t\t\t\"fatal error - scanner input buffer overflow\" );\n\n\t\t\tyyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];\n\n\t\t\tnum_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -\n\t\t\t\t\t\tnumber_to_move - 1;\n\n\t\t\t}\n\n\t\tif ( num_to_read > YY_READ_BUF_SIZE )\n\t\t\tnum_to_read = YY_READ_BUF_SIZE;\n\n\t\t/* Read in more data. */\n\t\tYY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),\n\t\t\tyyg->yy_n_chars, num_to_read );\n\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;\n\t\t}\n\n\tif ( yyg->yy_n_chars == 0 )\n\t\t{\n\t\tif ( number_to_move == YY_MORE_ADJ )\n\t\t\t{\n\t\t\tret_val = EOB_ACT_END_OF_FILE;\n\t\t\tyyrestart( yyin  , yyscanner);\n\t\t\t}\n\n\t\telse\n\t\t\t{\n\t\t\tret_val = EOB_ACT_LAST_MATCH;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buffer_status =\n\t\t\t\tYY_BUFFER_EOF_PENDING;\n\t\t\t}\n\t\t}\n\n\telse\n\t\tret_val = EOB_ACT_CONTINUE_SCAN;\n\n\tif ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {\n\t\t/* Extend the array by 50%, plus the number we really need. */\n\t\tint new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(\n\t\t\t(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );\n\t\tif ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_get_next_buffer()\" );\n\t\t/* \"- 2\" to take care of EOB's */\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);\n\t}\n\n\tyyg->yy_n_chars += number_to_move;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;\n\n\tyyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];\n\n\treturn ret_val;\n}\n\n/* yy_get_previous_state - get the state just before the EOB char was reached */\n\n    static yy_state_type yy_get_previous_state (yyscan_t yyscanner)\n{\n\tyy_state_type yy_current_state;\n\tchar *yy_cp;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tyy_current_state = yyg->yy_start;\n\tyy_current_state += YY_AT_BOL();\n\n\tfor ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )\n\t\t{\n\t\tif ( *yy_cp )\n\t\t\t{\n\t\t\tyy_current_state = yy_nxt[yy_current_state][YY_SC_TO_UI(*yy_cp)];\n\t\t\t}\n\t\telse\n\t\t\tyy_current_state = yy_NUL_trans[yy_current_state];\n\t\t}\n\n\treturn yy_current_state;\n}\n\n/* yy_try_NUL_trans - try to make a transition on the NUL character\n *\n * synopsis\n *\tnext_state = yy_try_NUL_trans( current_state );\n */\n    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)\n{\n\tint yy_is_jam;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */\n\n\tyy_current_state = yy_NUL_trans[yy_current_state];\n\tyy_is_jam = (yy_current_state == 0);\n\n\t(void)yyg;\n\treturn yy_is_jam ? 0 : yy_current_state;\n}\n\n#ifndef YY_NO_UNPUT\n\n    static void yyunput (int c, char * yy_bp , yyscan_t yyscanner)\n{\n\tchar *yy_cp;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n    yy_cp = yyg->yy_c_buf_p;\n\n\t/* undo effects of setting up yytext */\n\t*yy_cp = yyg->yy_hold_char;\n\n\tif ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )\n\t\t{ /* need to shift things up to make room */\n\t\t/* +2 for EOB chars. */\n\t\tint number_to_move = yyg->yy_n_chars + 2;\n\t\tchar *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[\n\t\t\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];\n\t\tchar *source =\n\t\t\t\t&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];\n\n\t\twhile ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )\n\t\t\t*--dest = *--source;\n\n\t\tyy_cp += (int) (dest - source);\n\t\tyy_bp += (int) (dest - source);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars =\n\t\t\tyyg->yy_n_chars = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;\n\n\t\tif ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )\n\t\t\tYY_FATAL_ERROR( \"flex scanner push-back overflow\" );\n\t\t}\n\n\t*--yy_cp = (char) c;\n\n\tyyg->yytext_ptr = yy_bp;\n\tyyg->yy_hold_char = *yy_cp;\n\tyyg->yy_c_buf_p = yy_cp;\n}\n\n#endif\n\n#ifndef YY_NO_INPUT\n#ifdef __cplusplus\n    static int yyinput (yyscan_t yyscanner)\n#else\n    static int input  (yyscan_t yyscanner)\n#endif\n\n{\n\tint c;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\t*yyg->yy_c_buf_p = yyg->yy_hold_char;\n\n\tif ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )\n\t\t{\n\t\t/* yy_c_buf_p now points to the character we want to return.\n\t\t * If this occurs *before* the EOB characters, then it's a\n\t\t * valid NUL; if not, then we've hit the end of the buffer.\n\t\t */\n\t\tif ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )\n\t\t\t/* This was really a NUL. */\n\t\t\t*yyg->yy_c_buf_p = '\\0';\n\n\t\telse\n\t\t\t{ /* need more input */\n\t\t\tint offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);\n\t\t\t++yyg->yy_c_buf_p;\n\n\t\t\tswitch ( yy_get_next_buffer( yyscanner ) )\n\t\t\t\t{\n\t\t\t\tcase EOB_ACT_LAST_MATCH:\n\t\t\t\t\t/* This happens because yy_g_n_b()\n\t\t\t\t\t * sees that we've accumulated a\n\t\t\t\t\t * token and flags that we need to\n\t\t\t\t\t * try matching the token before\n\t\t\t\t\t * proceeding.  But for input(),\n\t\t\t\t\t * there's no matching to consider.\n\t\t\t\t\t * So convert the EOB_ACT_LAST_MATCH\n\t\t\t\t\t * to EOB_ACT_END_OF_FILE.\n\t\t\t\t\t */\n\n\t\t\t\t\t/* Reset buffer status. */\n\t\t\t\t\tyyrestart( yyin , yyscanner);\n\n\t\t\t\t\t/*FALLTHROUGH*/\n\n\t\t\t\tcase EOB_ACT_END_OF_FILE:\n\t\t\t\t\t{\n\t\t\t\t\tif ( yywrap( yyscanner ) )\n\t\t\t\t\t\treturn 0;\n\n\t\t\t\t\tif ( ! yyg->yy_did_buffer_switch_on_eof )\n\t\t\t\t\t\tYY_NEW_FILE;\n#ifdef __cplusplus\n\t\t\t\t\treturn yyinput(yyscanner);\n#else\n\t\t\t\t\treturn input(yyscanner);\n#endif\n\t\t\t\t\t}\n\n\t\t\t\tcase EOB_ACT_CONTINUE_SCAN:\n\t\t\t\t\tyyg->yy_c_buf_p = yyg->yytext_ptr + offset;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tc = *(unsigned char *) yyg->yy_c_buf_p;\t/* cast for 8-bit char's */\n\t*yyg->yy_c_buf_p = '\\0';\t/* preserve yytext */\n\tyyg->yy_hold_char = *++yyg->yy_c_buf_p;\n\n\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\\n');\n\n\treturn c;\n}\n#endif\t/* ifndef YY_NO_INPUT */\n\n/** Immediately switch to a different input stream.\n * @param input_file A readable stream.\n * @param yyscanner The scanner object.\n * @note This function does not reset the start condition to @c INITIAL .\n */\n    void yyrestart  (FILE * input_file , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif ( ! YY_CURRENT_BUFFER ){\n        yyensure_buffer_stack (yyscanner);\n\t\tYY_CURRENT_BUFFER_LVALUE =\n            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);\n\t}\n\n\tyy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);\n\tyy_load_buffer_state( yyscanner );\n}\n\n/** Switch to a different input buffer.\n * @param new_buffer The new input buffer.\n * @param yyscanner The scanner object.\n */\n    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\t/* TODO. We should be able to replace this entire function body\n\t * with\n\t *\t\tyypop_buffer_state();\n\t *\t\tyypush_buffer_state(new_buffer);\n     */\n\tyyensure_buffer_stack (yyscanner);\n\tif ( YY_CURRENT_BUFFER == new_buffer )\n\t\treturn;\n\n\tif ( YY_CURRENT_BUFFER )\n\t\t{\n\t\t/* Flush out information for old buffer. */\n\t\t*yyg->yy_c_buf_p = yyg->yy_hold_char;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;\n\t\t}\n\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\tyy_load_buffer_state( yyscanner );\n\n\t/* We don't actually know whether we did this switch during\n\t * EOF (yywrap()) processing, but the only time this flag\n\t * is looked at is after yywrap() is called, so it's safe\n\t * to go ahead and always set it.\n\t */\n\tyyg->yy_did_buffer_switch_on_eof = 1;\n}\n\nstatic void yy_load_buffer_state  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tyyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\tyyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;\n\tyyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;\n\tyyg->yy_hold_char = *yyg->yy_c_buf_p;\n}\n\n/** Allocate and initialize an input buffer state.\n * @param file A readable stream.\n * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.\n * @param yyscanner The scanner object.\n * @return the allocated buffer state.\n */\n    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)\n{\n\tYY_BUFFER_STATE b;\n    \n\tb = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );\n\n\tb->yy_buf_size = size;\n\n\t/* yy_ch_buf has to be 2 characters longer than the size given because\n\t * we need to put in 2 end-of-buffer characters.\n\t */\n\tb->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );\n\tif ( ! b->yy_ch_buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );\n\n\tb->yy_is_our_buffer = 1;\n\n\tyy_init_buffer( b, file , yyscanner);\n\n\treturn b;\n}\n\n/** Destroy the buffer.\n * @param b a buffer created with yy_create_buffer()\n * @param yyscanner The scanner object.\n */\n    void yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif ( ! b )\n\t\treturn;\n\n\tif ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */\n\t\tYY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;\n\n\tif ( b->yy_is_our_buffer )\n\t\tyyfree( (void *) b->yy_ch_buf , yyscanner );\n\n\tyyfree( (void *) b , yyscanner );\n}\n\n/* Initializes or reinitializes a buffer.\n * This function is sometimes called more than once on the same buffer,\n * such as during a yyrestart() or at EOF.\n */\n    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)\n\n{\n\tint oerrno = errno;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tyy_flush_buffer( b , yyscanner);\n\n\tb->yy_input_file = file;\n\tb->yy_fill_buffer = 1;\n\n    /* If b is the current buffer, then yy_init_buffer was _probably_\n     * called from yyrestart() or through yy_get_next_buffer.\n     * In that case, we don't want to reset the lineno or column.\n     */\n    if (b != YY_CURRENT_BUFFER){\n        b->yy_bs_lineno = 1;\n        b->yy_bs_column = 0;\n    }\n\n        b->yy_is_interactive = 0;\n    \n\terrno = oerrno;\n}\n\n/** Discard all buffered characters. On the next scan, YY_INPUT will be called.\n * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.\n * @param yyscanner The scanner object.\n */\n    void yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tif ( ! b )\n\t\treturn;\n\n\tb->yy_n_chars = 0;\n\n\t/* We always need two end-of-buffer characters.  The first causes\n\t * a transition to the end-of-buffer state.  The second causes\n\t * a jam in that state.\n\t */\n\tb->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;\n\tb->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;\n\n\tb->yy_buf_pos = &b->yy_ch_buf[0];\n\n\tb->yy_at_bol = 1;\n\tb->yy_buffer_status = YY_BUFFER_NEW;\n\n\tif ( b == YY_CURRENT_BUFFER )\n\t\tyy_load_buffer_state( yyscanner );\n}\n\n/** Pushes the new state onto the stack. The new state becomes\n *  the current state. This function will allocate the stack\n *  if necessary.\n *  @param new_buffer The new state.\n *  @param yyscanner The scanner object.\n */\nvoid yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tif (new_buffer == NULL)\n\t\treturn;\n\n\tyyensure_buffer_stack(yyscanner);\n\n\t/* This block is copied from yy_switch_to_buffer. */\n\tif ( YY_CURRENT_BUFFER )\n\t\t{\n\t\t/* Flush out information for old buffer. */\n\t\t*yyg->yy_c_buf_p = yyg->yy_hold_char;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;\n\t\t}\n\n\t/* Only push if top exists. Otherwise, replace top. */\n\tif (YY_CURRENT_BUFFER)\n\t\tyyg->yy_buffer_stack_top++;\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\n\t/* copied from yy_switch_to_buffer. */\n\tyy_load_buffer_state( yyscanner );\n\tyyg->yy_did_buffer_switch_on_eof = 1;\n}\n\n/** Removes and deletes the top of the stack, if present.\n *  The next element becomes the new top.\n *  @param yyscanner The scanner object.\n */\nvoid yypop_buffer_state (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tif (!YY_CURRENT_BUFFER)\n\t\treturn;\n\n\tyy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);\n\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\tif (yyg->yy_buffer_stack_top > 0)\n\t\t--yyg->yy_buffer_stack_top;\n\n\tif (YY_CURRENT_BUFFER) {\n\t\tyy_load_buffer_state( yyscanner );\n\t\tyyg->yy_did_buffer_switch_on_eof = 1;\n\t}\n}\n\n/* Allocates the stack if it does not exist.\n *  Guarantees space for at least one push.\n */\nstatic void yyensure_buffer_stack (yyscan_t yyscanner)\n{\n\tyy_size_t num_to_alloc;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif (!yyg->yy_buffer_stack) {\n\n\t\t/* First allocation is just for 2 elements, since we don't know if this\n\t\t * scanner will even need a stack. We use 2 instead of 1 to avoid an\n\t\t * immediate realloc on the next call.\n         */\n      num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */\n\t\tyyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc\n\t\t\t\t\t\t\t\t(num_to_alloc * sizeof(struct yy_buffer_state*)\n\t\t\t\t\t\t\t\t, yyscanner);\n\t\tif ( ! yyg->yy_buffer_stack )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in yyensure_buffer_stack()\" );\n\n\t\tmemset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));\n\n\t\tyyg->yy_buffer_stack_max = num_to_alloc;\n\t\tyyg->yy_buffer_stack_top = 0;\n\t\treturn;\n\t}\n\n\tif (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){\n\n\t\t/* Increase the buffer to prepare for a possible push. */\n\t\tyy_size_t grow_size = 8 /* arbitrary grow size */;\n\n\t\tnum_to_alloc = yyg->yy_buffer_stack_max + grow_size;\n\t\tyyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc\n\t\t\t\t\t\t\t\t(yyg->yy_buffer_stack,\n\t\t\t\t\t\t\t\tnum_to_alloc * sizeof(struct yy_buffer_state*)\n\t\t\t\t\t\t\t\t, yyscanner);\n\t\tif ( ! yyg->yy_buffer_stack )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in yyensure_buffer_stack()\" );\n\n\t\t/* zero only the new slots.*/\n\t\tmemset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));\n\t\tyyg->yy_buffer_stack_max = num_to_alloc;\n\t}\n}\n\n/** Setup the input buffer state to scan directly from a user-specified character buffer.\n * @param base the character buffer\n * @param size the size in bytes of the character buffer\n * @param yyscanner The scanner object.\n * @return the newly allocated buffer state object.\n */\nYY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)\n{\n\tYY_BUFFER_STATE b;\n    \n\tif ( size < 2 ||\n\t     base[size-2] != YY_END_OF_BUFFER_CHAR ||\n\t     base[size-1] != YY_END_OF_BUFFER_CHAR )\n\t\t/* They forgot to leave room for the EOB's. */\n\t\treturn NULL;\n\n\tb = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_scan_buffer()\" );\n\n\tb->yy_buf_size = (int) (size - 2);\t/* \"- 2\" to take care of EOB's */\n\tb->yy_buf_pos = b->yy_ch_buf = base;\n\tb->yy_is_our_buffer = 0;\n\tb->yy_input_file = NULL;\n\tb->yy_n_chars = b->yy_buf_size;\n\tb->yy_is_interactive = 0;\n\tb->yy_at_bol = 1;\n\tb->yy_fill_buffer = 0;\n\tb->yy_buffer_status = YY_BUFFER_NEW;\n\n\tyy_switch_to_buffer( b , yyscanner );\n\n\treturn b;\n}\n\n/** Setup the input buffer state to scan a string. The next call to yylex() will\n * scan from a @e copy of @a str.\n * @param yystr a NUL-terminated string to scan\n * @param yyscanner The scanner object.\n * @return the newly allocated buffer state object.\n * @note If you want to scan bytes that may contain NUL values, then use\n *       yy_scan_bytes() instead.\n */\nYY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)\n{\n    \n\treturn yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);\n}\n\n/** Setup the input buffer state to scan the given bytes. The next call to yylex() will\n * scan from a @e copy of @a bytes.\n * @param yybytes the byte buffer to scan\n * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.\n * @param yyscanner The scanner object.\n * @return the newly allocated buffer state object.\n */\nYY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len , yyscan_t yyscanner)\n{\n\tYY_BUFFER_STATE b;\n\tchar *buf;\n\tyy_size_t n;\n\tint i;\n    \n\t/* Get memory for full buffer, including space for trailing EOB's. */\n\tn = (yy_size_t) (_yybytes_len + 2);\n\tbuf = (char *) yyalloc( n , yyscanner );\n\tif ( ! buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_scan_bytes()\" );\n\n\tfor ( i = 0; i < _yybytes_len; ++i )\n\t\tbuf[i] = yybytes[i];\n\n\tbuf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;\n\n\tb = yy_scan_buffer( buf, n , yyscanner);\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"bad buffer in yy_scan_bytes()\" );\n\n\t/* It's okay to grow etc. this buffer, and we should throw it\n\t * away when we're done.\n\t */\n\tb->yy_is_our_buffer = 1;\n\n\treturn b;\n}\n\n#ifndef YY_EXIT_FAILURE\n#define YY_EXIT_FAILURE 2\n#endif\n\nstatic void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\tfprintf( stderr, \"%s\\n\", msg );\n\texit( YY_EXIT_FAILURE );\n}\n\n/* Redefine yyless() so it works in section 3 code. */\n\n#undef yyless\n#define yyless(n) \\\n\tdo \\\n\t\t{ \\\n\t\t/* Undo effects of setting up yytext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\tyytext[yyleng] = yyg->yy_hold_char; \\\n\t\tyyg->yy_c_buf_p = yytext + yyless_macro_arg; \\\n\t\tyyg->yy_hold_char = *yyg->yy_c_buf_p; \\\n\t\t*yyg->yy_c_buf_p = '\\0'; \\\n\t\tyyleng = yyless_macro_arg; \\\n\t\t} \\\n\twhile ( 0 )\n\n/* Accessor  methods (get/set functions) to struct members. */\n\n/** Get the user-defined data for this scanner.\n * @param yyscanner The scanner object.\n */\nYY_EXTRA_TYPE yyget_extra  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyextra;\n}\n\n/** Get the current line number.\n * @param yyscanner The scanner object.\n */\nint yyget_lineno  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        if (! YY_CURRENT_BUFFER)\n            return 0;\n    \n    return yylineno;\n}\n\n/** Get the current column number.\n * @param yyscanner The scanner object.\n */\nint yyget_column  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        if (! YY_CURRENT_BUFFER)\n            return 0;\n    \n    return yycolumn;\n}\n\n/** Get the input stream.\n * @param yyscanner The scanner object.\n */\nFILE *yyget_in  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyin;\n}\n\n/** Get the output stream.\n * @param yyscanner The scanner object.\n */\nFILE *yyget_out  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyout;\n}\n\n/** Get the length of the current token.\n * @param yyscanner The scanner object.\n */\nint yyget_leng  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyleng;\n}\n\n/** Get the current token.\n * @param yyscanner The scanner object.\n */\n\nchar *yyget_text  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yytext;\n}\n\n/** Set the user-defined data. This data is never touched by the scanner.\n * @param user_defined The data to be associated with this scanner.\n * @param yyscanner The scanner object.\n */\nvoid yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yyextra = user_defined ;\n}\n\n/** Set the current line number.\n * @param _line_number line number\n * @param yyscanner The scanner object.\n */\nvoid yyset_lineno (int  _line_number , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        /* lineno is only valid if an input buffer exists. */\n        if (! YY_CURRENT_BUFFER )\n           YY_FATAL_ERROR( \"yyset_lineno called with no buffer\" );\n    \n    yylineno = _line_number;\n}\n\n/** Set the current column.\n * @param _column_no column number\n * @param yyscanner The scanner object.\n */\nvoid yyset_column (int  _column_no , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        /* column is only valid if an input buffer exists. */\n        if (! YY_CURRENT_BUFFER )\n           YY_FATAL_ERROR( \"yyset_column called with no buffer\" );\n    \n    yycolumn = _column_no;\n}\n\n/** Set the input stream. This does not discard the current\n * input buffer.\n * @param _in_str A readable stream.\n * @param yyscanner The scanner object.\n * @see yy_switch_to_buffer\n */\nvoid yyset_in (FILE *  _in_str , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yyin = _in_str ;\n}\n\nvoid yyset_out (FILE *  _out_str , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yyout = _out_str ;\n}\n\nint yyget_debug  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yy_flex_debug;\n}\n\nvoid yyset_debug (int  _bdebug , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yy_flex_debug = _bdebug ;\n}\n\n/* Accessor methods for yylval and yylloc */\n\n/* User-visible API */\n\n/* yylex_init is special because it creates the scanner itself, so it is\n * the ONLY reentrant function that doesn't take the scanner as the last argument.\n * That's why we explicitly handle the declaration, instead of using our macros.\n */\nint yylex_init(yyscan_t* ptr_yy_globals)\n{\n    if (ptr_yy_globals == NULL){\n        errno = EINVAL;\n        return 1;\n    }\n\n    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );\n\n    if (*ptr_yy_globals == NULL){\n        errno = ENOMEM;\n        return 1;\n    }\n\n    /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */\n    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));\n\n    return yy_init_globals ( *ptr_yy_globals );\n}\n\n/* yylex_init_extra has the same functionality as yylex_init, but follows the\n * convention of taking the scanner as the last argument. Note however, that\n * this is a *pointer* to a scanner, as it will be allocated by this call (and\n * is the reason, too, why this function also must handle its own declaration).\n * The user defined value in the first argument will be available to yyalloc in\n * the yyextra field.\n */\nint yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )\n{\n    struct yyguts_t dummy_yyguts;\n\n    yyset_extra (yy_user_defined, &dummy_yyguts);\n\n    if (ptr_yy_globals == NULL){\n        errno = EINVAL;\n        return 1;\n    }\n\n    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );\n\n    if (*ptr_yy_globals == NULL){\n        errno = ENOMEM;\n        return 1;\n    }\n\n    /* By setting to 0xAA, we expose bugs in\n    yy_init_globals. Leave at 0x00 for releases. */\n    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));\n\n    yyset_extra (yy_user_defined, *ptr_yy_globals);\n\n    return yy_init_globals ( *ptr_yy_globals );\n}\n\nstatic int yy_init_globals (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    /* Initialization is the same as for the non-reentrant scanner.\n     * This function is called from yylex_destroy(), so don't allocate here.\n     */\n\n    yyg->yy_buffer_stack = NULL;\n    yyg->yy_buffer_stack_top = 0;\n    yyg->yy_buffer_stack_max = 0;\n    yyg->yy_c_buf_p = NULL;\n    yyg->yy_init = 0;\n    yyg->yy_start = 0;\n\n    yyg->yy_start_stack_ptr = 0;\n    yyg->yy_start_stack_depth = 0;\n    yyg->yy_start_stack =  NULL;\n\n/* Defined in main.c */\n#ifdef YY_STDINIT\n    yyin = stdin;\n    yyout = stdout;\n#else\n    yyin = NULL;\n    yyout = NULL;\n#endif\n\n    /* For future reference: Set errno on error, since we are called by\n     * yylex_init()\n     */\n    return 0;\n}\n\n/* yylex_destroy is for both reentrant and non-reentrant scanners. */\nint yylex_destroy  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n    /* Pop the buffer stack, destroying each element. */\n\twhile(YY_CURRENT_BUFFER){\n\t\tyy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );\n\t\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\t\tyypop_buffer_state(yyscanner);\n\t}\n\n\t/* Destroy the stack itself. */\n\tyyfree(yyg->yy_buffer_stack , yyscanner);\n\tyyg->yy_buffer_stack = NULL;\n\n    /* Destroy the start condition stack. */\n        yyfree( yyg->yy_start_stack , yyscanner );\n        yyg->yy_start_stack = NULL;\n\n    /* Reset the globals. This is important in a non-reentrant scanner so the next time\n     * yylex() is called, initialization will occur. */\n    yy_init_globals( yyscanner);\n\n    /* Destroy the main struct (reentrant only). */\n    yyfree ( yyscanner , yyscanner );\n    yyscanner = NULL;\n    return 0;\n}\n\n/*\n * Internal utility routines.\n */\n\n#ifndef yytext_ptr\nstatic void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\n\tint i;\n\tfor ( i = 0; i < n; ++i )\n\t\ts1[i] = s2[i];\n}\n#endif\n\n#ifdef YY_NEED_STRLEN\nstatic int yy_flex_strlen (const char * s , yyscan_t yyscanner)\n{\n\tint n;\n\tfor ( n = 0; s[n]; ++n )\n\t\t;\n\n\treturn n;\n}\n#endif\n\nvoid *yyalloc (yy_size_t  size , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\treturn malloc(size);\n}\n\nvoid *yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\n\t/* The cast to (char *) in the following accommodates both\n\t * implementations that use char* generic pointers, and those\n\t * that use void* generic pointers.  It works with the latter\n\t * because both ANSI C and C++ allow castless assignment from\n\t * any pointer type to void*, and deal with argument conversions\n\t * as though doing an assignment.\n\t */\n\treturn realloc(ptr, size);\n}\n\nvoid yyfree (void * ptr , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\tfree( (char *) ptr );\t/* see yyrealloc() for (char *) cast */\n}\n\n#define YYTABLES_NAME \"yytables\"\n\n#line 344 \"wcsutrn.l\"\n\n\n/*----------------------------------------------------------------------------\n* External interface to the scanner.\n*---------------------------------------------------------------------------*/\n\nint wcsutrne(\n  int ctrl,\n  char unitstr[],\n  struct wcserr **err)\n\n{\n  // Function prototypes.\n  int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner);\n  int yylex_destroy(yyscan_t yyscanner);\n\n  struct wcsutrn_extra extra;\n  yyscan_t yyscanner;\n  yylex_init_extra(&extra, &yyscanner);\n  int status = wcsutrne_scanner(ctrl, unitstr, err, yyscanner);\n  yylex_destroy(yyscanner);\n\n  return status;\n}\n\n"},{"id":16617,"name":"wcspih.c","nodeType":"TextFile","path":"cextern/wcslib/C/flexed","text":"#line 2 \"wcspih.c\"\n\n#line 4 \"wcspih.c\"\n\n#define _POSIX_C_SOURCE 1\n#define  YY_INT_ALIGNED short int\n\n/* A lexical scanner generated by flex */\n\n#define FLEX_SCANNER\n#define YY_FLEX_MAJOR_VERSION 2\n#define YY_FLEX_MINOR_VERSION 6\n#define YY_FLEX_SUBMINOR_VERSION 4\n#if YY_FLEX_SUBMINOR_VERSION > 0\n#define FLEX_BETA\n#endif\n\n#ifdef yy_create_buffer\n#define wcspih_create_buffer_ALREADY_DEFINED\n#else\n#define yy_create_buffer wcspih_create_buffer\n#endif\n\n#ifdef yy_delete_buffer\n#define wcspih_delete_buffer_ALREADY_DEFINED\n#else\n#define yy_delete_buffer wcspih_delete_buffer\n#endif\n\n#ifdef yy_scan_buffer\n#define wcspih_scan_buffer_ALREADY_DEFINED\n#else\n#define yy_scan_buffer wcspih_scan_buffer\n#endif\n\n#ifdef yy_scan_string\n#define wcspih_scan_string_ALREADY_DEFINED\n#else\n#define yy_scan_string wcspih_scan_string\n#endif\n\n#ifdef yy_scan_bytes\n#define wcspih_scan_bytes_ALREADY_DEFINED\n#else\n#define yy_scan_bytes wcspih_scan_bytes\n#endif\n\n#ifdef yy_init_buffer\n#define wcspih_init_buffer_ALREADY_DEFINED\n#else\n#define yy_init_buffer wcspih_init_buffer\n#endif\n\n#ifdef yy_flush_buffer\n#define wcspih_flush_buffer_ALREADY_DEFINED\n#else\n#define yy_flush_buffer wcspih_flush_buffer\n#endif\n\n#ifdef yy_load_buffer_state\n#define wcspih_load_buffer_state_ALREADY_DEFINED\n#else\n#define yy_load_buffer_state wcspih_load_buffer_state\n#endif\n\n#ifdef yy_switch_to_buffer\n#define wcspih_switch_to_buffer_ALREADY_DEFINED\n#else\n#define yy_switch_to_buffer wcspih_switch_to_buffer\n#endif\n\n#ifdef yypush_buffer_state\n#define wcspihpush_buffer_state_ALREADY_DEFINED\n#else\n#define yypush_buffer_state wcspihpush_buffer_state\n#endif\n\n#ifdef yypop_buffer_state\n#define wcspihpop_buffer_state_ALREADY_DEFINED\n#else\n#define yypop_buffer_state wcspihpop_buffer_state\n#endif\n\n#ifdef yyensure_buffer_stack\n#define wcspihensure_buffer_stack_ALREADY_DEFINED\n#else\n#define yyensure_buffer_stack wcspihensure_buffer_stack\n#endif\n\n#ifdef yylex\n#define wcspihlex_ALREADY_DEFINED\n#else\n#define yylex wcspihlex\n#endif\n\n#ifdef yyrestart\n#define wcspihrestart_ALREADY_DEFINED\n#else\n#define yyrestart wcspihrestart\n#endif\n\n#ifdef yylex_init\n#define wcspihlex_init_ALREADY_DEFINED\n#else\n#define yylex_init wcspihlex_init\n#endif\n\n#ifdef yylex_init_extra\n#define wcspihlex_init_extra_ALREADY_DEFINED\n#else\n#define yylex_init_extra wcspihlex_init_extra\n#endif\n\n#ifdef yylex_destroy\n#define wcspihlex_destroy_ALREADY_DEFINED\n#else\n#define yylex_destroy wcspihlex_destroy\n#endif\n\n#ifdef yyget_debug\n#define wcspihget_debug_ALREADY_DEFINED\n#else\n#define yyget_debug wcspihget_debug\n#endif\n\n#ifdef yyset_debug\n#define wcspihset_debug_ALREADY_DEFINED\n#else\n#define yyset_debug wcspihset_debug\n#endif\n\n#ifdef yyget_extra\n#define wcspihget_extra_ALREADY_DEFINED\n#else\n#define yyget_extra wcspihget_extra\n#endif\n\n#ifdef yyset_extra\n#define wcspihset_extra_ALREADY_DEFINED\n#else\n#define yyset_extra wcspihset_extra\n#endif\n\n#ifdef yyget_in\n#define wcspihget_in_ALREADY_DEFINED\n#else\n#define yyget_in wcspihget_in\n#endif\n\n#ifdef yyset_in\n#define wcspihset_in_ALREADY_DEFINED\n#else\n#define yyset_in wcspihset_in\n#endif\n\n#ifdef yyget_out\n#define wcspihget_out_ALREADY_DEFINED\n#else\n#define yyget_out wcspihget_out\n#endif\n\n#ifdef yyset_out\n#define wcspihset_out_ALREADY_DEFINED\n#else\n#define yyset_out wcspihset_out\n#endif\n\n#ifdef yyget_leng\n#define wcspihget_leng_ALREADY_DEFINED\n#else\n#define yyget_leng wcspihget_leng\n#endif\n\n#ifdef yyget_text\n#define wcspihget_text_ALREADY_DEFINED\n#else\n#define yyget_text wcspihget_text\n#endif\n\n#ifdef yyget_lineno\n#define wcspihget_lineno_ALREADY_DEFINED\n#else\n#define yyget_lineno wcspihget_lineno\n#endif\n\n#ifdef yyset_lineno\n#define wcspihset_lineno_ALREADY_DEFINED\n#else\n#define yyset_lineno wcspihset_lineno\n#endif\n\n#ifdef yyget_column\n#define wcspihget_column_ALREADY_DEFINED\n#else\n#define yyget_column wcspihget_column\n#endif\n\n#ifdef yyset_column\n#define wcspihset_column_ALREADY_DEFINED\n#else\n#define yyset_column wcspihset_column\n#endif\n\n#ifdef yywrap\n#define wcspihwrap_ALREADY_DEFINED\n#else\n#define yywrap wcspihwrap\n#endif\n\n#ifdef yyalloc\n#define wcspihalloc_ALREADY_DEFINED\n#else\n#define yyalloc wcspihalloc\n#endif\n\n#ifdef yyrealloc\n#define wcspihrealloc_ALREADY_DEFINED\n#else\n#define yyrealloc wcspihrealloc\n#endif\n\n#ifdef yyfree\n#define wcspihfree_ALREADY_DEFINED\n#else\n#define yyfree wcspihfree\n#endif\n\n/* First, we deal with  platform-specific or compiler-specific issues. */\n\n/* begin standard C headers. */\n#include <stdio.h>\n#include <string.h>\n#include <errno.h>\n#include <stdlib.h>\n\n/* end standard C headers. */\n\n/* flex integer type definitions */\n\n#ifndef FLEXINT_H\n#define FLEXINT_H\n\n/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */\n\n#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\n\n/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,\n * if you want the limit (max/min) macros for int types. \n */\n#ifndef __STDC_LIMIT_MACROS\n#define __STDC_LIMIT_MACROS 1\n#endif\n\n#include <inttypes.h>\ntypedef int8_t flex_int8_t;\ntypedef uint8_t flex_uint8_t;\ntypedef int16_t flex_int16_t;\ntypedef uint16_t flex_uint16_t;\ntypedef int32_t flex_int32_t;\ntypedef uint32_t flex_uint32_t;\n#else\ntypedef signed char flex_int8_t;\ntypedef short int flex_int16_t;\ntypedef int flex_int32_t;\ntypedef unsigned char flex_uint8_t; \ntypedef unsigned short int flex_uint16_t;\ntypedef unsigned int flex_uint32_t;\n\n/* Limits of integral types. */\n#ifndef INT8_MIN\n#define INT8_MIN               (-128)\n#endif\n#ifndef INT16_MIN\n#define INT16_MIN              (-32767-1)\n#endif\n#ifndef INT32_MIN\n#define INT32_MIN              (-2147483647-1)\n#endif\n#ifndef INT8_MAX\n#define INT8_MAX               (127)\n#endif\n#ifndef INT16_MAX\n#define INT16_MAX              (32767)\n#endif\n#ifndef INT32_MAX\n#define INT32_MAX              (2147483647)\n#endif\n#ifndef UINT8_MAX\n#define UINT8_MAX              (255U)\n#endif\n#ifndef UINT16_MAX\n#define UINT16_MAX             (65535U)\n#endif\n#ifndef UINT32_MAX\n#define UINT32_MAX             (4294967295U)\n#endif\n\n#ifndef SIZE_MAX\n#define SIZE_MAX               (~(size_t)0)\n#endif\n\n#endif /* ! C99 */\n\n#endif /* ! FLEXINT_H */\n\n/* begin standard C++ headers. */\n\n/* TODO: this is always defined, so inline it */\n#define yyconst const\n\n#if defined(__GNUC__) && __GNUC__ >= 3\n#define yynoreturn __attribute__((__noreturn__))\n#else\n#define yynoreturn\n#endif\n\n/* Returned upon end-of-file. */\n#define YY_NULL 0\n\n/* Promotes a possibly negative, possibly signed char to an\n *   integer in range [0..255] for use as an array index.\n */\n#define YY_SC_TO_UI(c) ((YY_CHAR) (c))\n\n/* An opaque pointer. */\n#ifndef YY_TYPEDEF_YY_SCANNER_T\n#define YY_TYPEDEF_YY_SCANNER_T\ntypedef void* yyscan_t;\n#endif\n\n/* For convenience, these vars (plus the bison vars far below)\n   are macros in the reentrant scanner. */\n#define yyin yyg->yyin_r\n#define yyout yyg->yyout_r\n#define yyextra yyg->yyextra_r\n#define yyleng yyg->yyleng_r\n#define yytext yyg->yytext_r\n#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)\n#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)\n#define yy_flex_debug yyg->yy_flex_debug_r\n\n/* Enter a start condition.  This macro really ought to take a parameter,\n * but we do it the disgusting crufty way forced on us by the ()-less\n * definition of BEGIN.\n */\n#define BEGIN yyg->yy_start = 1 + 2 *\n/* Translate the current start state into a value that can be later handed\n * to BEGIN to return to the state.  The YYSTATE alias is for lex\n * compatibility.\n */\n#define YY_START ((yyg->yy_start - 1) / 2)\n#define YYSTATE YY_START\n/* Action number for EOF rule of a given start state. */\n#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)\n/* Special action meaning \"start processing a new file\". */\n#define YY_NEW_FILE yyrestart( yyin , yyscanner )\n#define YY_END_OF_BUFFER_CHAR 0\n\n/* Size of default input buffer. */\n#ifndef YY_BUF_SIZE\n#ifdef __ia64__\n/* On IA-64, the buffer size is 16k, not 8k.\n * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.\n * Ditto for the __ia64__ case accordingly.\n */\n#define YY_BUF_SIZE 32768\n#else\n#define YY_BUF_SIZE 16384\n#endif /* __ia64__ */\n#endif\n\n/* The state buf must be large enough to hold one state per character in the main buffer.\n */\n#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))\n\n#ifndef YY_TYPEDEF_YY_BUFFER_STATE\n#define YY_TYPEDEF_YY_BUFFER_STATE\ntypedef struct yy_buffer_state *YY_BUFFER_STATE;\n#endif\n\n#ifndef YY_TYPEDEF_YY_SIZE_T\n#define YY_TYPEDEF_YY_SIZE_T\ntypedef size_t yy_size_t;\n#endif\n\n#define EOB_ACT_CONTINUE_SCAN 0\n#define EOB_ACT_END_OF_FILE 1\n#define EOB_ACT_LAST_MATCH 2\n    \n#define YY_LESS_LINENO(n)\n#define YY_LINENO_REWIND_TO(ptr)\n    \n/* Return all but the first \"n\" matched characters back to the input stream. */\n#define yyless(n) \\\n\tdo \\\n\t\t{ \\\n\t\t/* Undo effects of setting up yytext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\t*yy_cp = yyg->yy_hold_char; \\\n\t\tYY_RESTORE_YY_MORE_OFFSET \\\n\t\tyyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \\\n\t\tYY_DO_BEFORE_ACTION; /* set up yytext again */ \\\n\t\t} \\\n\twhile ( 0 )\n#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )\n\n#ifndef YY_STRUCT_YY_BUFFER_STATE\n#define YY_STRUCT_YY_BUFFER_STATE\nstruct yy_buffer_state\n\t{\n\tFILE *yy_input_file;\n\n\tchar *yy_ch_buf;\t\t/* input buffer */\n\tchar *yy_buf_pos;\t\t/* current position in input buffer */\n\n\t/* Size of input buffer in bytes, not including room for EOB\n\t * characters.\n\t */\n\tint yy_buf_size;\n\n\t/* Number of characters read into yy_ch_buf, not including EOB\n\t * characters.\n\t */\n\tint yy_n_chars;\n\n\t/* Whether we \"own\" the buffer - i.e., we know we created it,\n\t * and can realloc() it to grow it, and should free() it to\n\t * delete it.\n\t */\n\tint yy_is_our_buffer;\n\n\t/* Whether this is an \"interactive\" input source; if so, and\n\t * if we're using stdio for input, then we want to use getc()\n\t * instead of fread(), to make sure we stop fetching input after\n\t * each newline.\n\t */\n\tint yy_is_interactive;\n\n\t/* Whether we're considered to be at the beginning of a line.\n\t * If so, '^' rules will be active on the next match, otherwise\n\t * not.\n\t */\n\tint yy_at_bol;\n\n    int yy_bs_lineno; /**< The line count. */\n    int yy_bs_column; /**< The column count. */\n\n\t/* Whether to try to fill the input buffer when we reach the\n\t * end of it.\n\t */\n\tint yy_fill_buffer;\n\n\tint yy_buffer_status;\n\n#define YY_BUFFER_NEW 0\n#define YY_BUFFER_NORMAL 1\n\t/* When an EOF's been seen but there's still some text to process\n\t * then we mark the buffer as YY_EOF_PENDING, to indicate that we\n\t * shouldn't try reading from the input source any more.  We might\n\t * still have a bunch of tokens to match, though, because of\n\t * possible backing-up.\n\t *\n\t * When we actually see the EOF, we change the status to \"new\"\n\t * (via yyrestart()), so that the user can continue scanning by\n\t * just pointing yyin at a new input file.\n\t */\n#define YY_BUFFER_EOF_PENDING 2\n\n\t};\n#endif /* !YY_STRUCT_YY_BUFFER_STATE */\n\n/* We provide macros for accessing buffer states in case in the\n * future we want to put the buffer states in a more general\n * \"scanner state\".\n *\n * Returns the top of the stack, or NULL.\n */\n#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \\\n                          ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \\\n                          : NULL)\n/* Same as previous macro, but useful when we know that the buffer stack is not\n * NULL or when we need an lvalue. For internal use only.\n */\n#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]\n\nvoid yyrestart ( FILE *input_file , yyscan_t yyscanner );\nvoid yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );\nYY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );\nvoid yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );\nvoid yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );\nvoid yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );\nvoid yypop_buffer_state ( yyscan_t yyscanner );\n\nstatic void yyensure_buffer_stack ( yyscan_t yyscanner );\nstatic void yy_load_buffer_state ( yyscan_t yyscanner );\nstatic void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );\n#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)\n\nYY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );\nYY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );\nYY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );\n\nvoid *yyalloc ( yy_size_t , yyscan_t yyscanner );\nvoid *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );\nvoid yyfree ( void * , yyscan_t yyscanner );\n\n#define yy_new_buffer yy_create_buffer\n#define yy_set_interactive(is_interactive) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){ \\\n        yyensure_buffer_stack (yyscanner); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \\\n\t}\n#define yy_set_bol(at_bol) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){\\\n        yyensure_buffer_stack (yyscanner); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \\\n\t}\n#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)\n\n/* Begin user sect3 */\n\n#define wcspihwrap(yyscanner) (/*CONSTCOND*/1)\n#define YY_SKIP_YYWRAP\ntypedef flex_uint8_t YY_CHAR;\n\ntypedef int yy_state_type;\n\n#define yytext_ptr yytext_r\n\nstatic const flex_int16_t yy_nxt[][128] =\n    {\n    {\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0\n    },\n\n    {\n       55,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56\n    },\n\n    {\n       55,   57,   57,   57,   57,   57,   57,   57,   57,   57,\n       56,   57,   57,   57,   57,   57,   57,   57,   57,   57,\n       57,   57,   57,   57,   57,   57,   57,   57,   57,   57,\n       57,   57,   57,   57,   57,   57,   57,   57,   57,   57,\n\n       57,   57,   57,   57,   57,   57,   57,   57,   57,   57,\n       57,   57,   57,   57,   57,   57,   57,   57,   57,   57,\n       57,   57,   57,   57,   57,   58,   59,   60,   61,   62,\n       57,   57,   63,   57,   64,   57,   65,   66,   67,   68,\n       69,   57,   70,   71,   72,   57,   73,   74,   75,   76,\n       77,   57,   57,   57,   57,   57,   57,   57,   57,   57,\n       57,   57,   57,   57,   57,   57,   57,   57,   57,   57,\n       57,   57,   57,   57,   57,   57,   57,   57,   57,   57,\n       57,   57,   57,   57,   57,   57,   57,   57\n    },\n\n    {\n       55,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n\n       56,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78,   79,   80,\n       80,   80,   80,   80,   80,   80,   80,   80,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n\n       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78\n    },\n\n    {\n       55,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n       56,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78,   79,   80,\n       80,   80,   80,   80,   80,   80,   80,   80,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n\n       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,\n       78,   78,   78,   78,   78,   78,   78,   78\n    },\n\n    {\n       55,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       56,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   82,   83,\n\n       83,   83,   83,   83,   83,   83,   83,   83,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81\n    },\n\n    {\n       55,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       56,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   82,   83,\n       83,   83,   83,   83,   83,   83,   83,   83,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n\n       81,   81,   81,   81,   81,   81,   81,   81\n    },\n\n    {\n       55,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       56,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   85,   86,\n       86,   86,   86,   86,   86,   86,   86,   86,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n\n       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84\n    },\n\n    {\n       55,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       56,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   85,   86,\n       86,   86,   86,   86,   86,   86,   86,   86,   84,   84,\n\n       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       84,   84,   84,   84,   84,   84,   84,   84\n    },\n\n    {\n       55,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       56,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   88,   89,\n       89,   89,   89,   89,   89,   89,   89,   89,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87\n\n    },\n\n    {\n       55,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       56,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   88,   89,\n       89,   89,   89,   89,   89,   89,   89,   89,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87\n    },\n\n    {\n       55,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       56,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   91,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   91,   91,   91,   91,   91,\n\n       91,   91,   91,   91,   91,   91,   91,   91,   91,   91,\n       91,   91,   91,   91,   91,   91,   91,   91,   91,   91,\n       91,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90\n    },\n\n    {\n       55,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       56,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   91,   90,   90,   90,   90,   90,   90,   90,\n\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   91,   91,   91,   91,   91,\n       91,   91,   91,   91,   91,   91,   91,   91,   91,   91,\n       91,   91,   91,   91,   91,   91,   91,   91,   91,   91,\n       91,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90\n    },\n\n    {\n       55,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n\n       56,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92\n    },\n\n    {\n       55,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       56,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92\n    },\n\n    {\n       55,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       56,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   94,   94,\n\n       94,   94,   94,   94,   94,   94,   94,   94,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93\n    },\n\n    {\n       55,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       56,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   94,   94,\n       94,   94,   94,   94,   94,   94,   94,   94,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n\n       93,   93,   93,   93,   93,   93,   93,   93\n    },\n\n    {\n       55,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       56,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   96,   96,\n       96,   96,   96,   96,   96,   96,   96,   96,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95\n    },\n\n    {\n       55,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       56,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   96,   96,\n       96,   96,   96,   96,   96,   96,   96,   96,   95,   95,\n\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95\n    },\n\n    {\n       55,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       56,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   98,   98,\n       98,   98,   98,   98,   98,   98,   98,   98,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97\n\n    },\n\n    {\n       55,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       56,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   98,   98,\n       98,   98,   98,   98,   98,   98,   98,   98,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97\n    },\n\n    {\n       55,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       56,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99\n    },\n\n    {\n       55,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       56,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n\n       99,   99,   99,   99,   99,   99,   99,   99,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99\n    },\n\n    {\n       55,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n\n       56,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  102,\n      102,  102,  102,  102,  102,  102,  102,  102,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101\n    },\n\n    {\n       55,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n       56,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  102,\n      102,  102,  102,  102,  102,  102,  102,  102,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101\n    },\n\n    {\n       55,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n       56,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  104,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  103,  103,  103,  103,  103,  103,  103\n    },\n\n    {\n       55,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n       56,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  104,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n\n      103,  103,  103,  103,  103,  103,  103,  103\n    },\n\n    {\n       55,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n       56,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  106,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105\n    },\n\n    {\n       55,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n       56,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n\n      105,  106,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105\n    },\n\n    {\n       55,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n       56,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  108,  107,  108,  107,  107,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107\n\n    },\n\n    {\n       55,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n       56,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  108,  107,  108,  107,  107,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107\n    },\n\n    {\n       55,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n       56,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n      110,  110,  110,  111,  110,  111,  112,  110,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n\n      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110\n    },\n\n    {\n       55,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n       56,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n\n      110,  110,  110,  111,  110,  111,  112,  110,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110\n    },\n\n    {\n       55,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n\n       56,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n      114,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n      114,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n      114,  114,  114,  115,  114,  115,  116,  114,  117,  117,\n      117,  117,  117,  117,  117,  117,  117,  117,  114,  114,\n      114,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n      114,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n      114,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n      114,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n      114,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n\n      114,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n      114,  114,  114,  114,  114,  114,  114,  114\n    },\n\n    {\n       55,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n       56,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n      114,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n      114,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n      114,  114,  114,  115,  114,  115,  116,  114,  117,  117,\n      117,  117,  117,  117,  117,  117,  117,  117,  114,  114,\n      114,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n      114,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n\n      114,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n      114,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n      114,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n      114,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n      114,  114,  114,  114,  114,  114,  114,  114\n    },\n\n    {\n       55,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n       56,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  119,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118\n    },\n\n    {\n       55,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n       56,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  119,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n\n      118,  118,  118,  118,  118,  118,  118,  118\n    },\n\n    {\n       55,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n       56,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  121,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120\n    },\n\n    {\n       55,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n       56,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  121,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120\n    },\n\n    {\n       55,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n       56,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  123,  123,  123,  123,  123,\n      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,\n      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,\n      123,  122,  122,  122,  122,  123,  122,  123,  123,  123,\n      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,\n      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,\n      123,  123,  123,  122,  122,  122,  122,  122\n\n    },\n\n    {\n       55,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n       56,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  123,  123,  123,  123,  123,\n      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,\n      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,\n      123,  122,  122,  122,  122,  123,  122,  123,  123,  123,\n\n      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,\n      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,\n      123,  123,  123,  122,  122,  122,  122,  122\n    },\n\n    {\n       55,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n       56,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  125,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124\n    },\n\n    {\n       55,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n       56,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  125,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124\n    },\n\n    {\n       55,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n\n       56,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  127,  126,  127,  128,  126,  129,  129,\n      129,  129,  129,  129,  129,  129,  129,  129,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126\n    },\n\n    {\n       55,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n       56,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  127,  126,  127,  128,  126,  129,  129,\n      129,  129,  129,  129,  129,  129,  129,  129,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126\n    },\n\n    {\n       55,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,  130,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56\n    },\n\n    {\n       55,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,  130,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,\n\n       56,   56,   56,   56,   56,   56,   56,   56\n    },\n\n    {\n       55,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      132,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  133,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  134,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131\n    },\n\n    {\n       55,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      132,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  133,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  134,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131\n    },\n\n    {\n       55,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      136,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135\n\n    },\n\n    {\n       55,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      136,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135\n    },\n\n    {\n       55,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      138,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137\n    },\n\n    {\n       55,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      138,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137\n    },\n\n    {\n       55,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n\n      140,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139\n    },\n\n    {\n       55,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      140,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139\n    },\n\n    {\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55\n    },\n\n    {\n       55,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56\n    },\n\n    {\n       55,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57\n    },\n\n    {\n       55,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  141,  -58,  -58,\n      142,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  143,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58\n    },\n\n    {\n       55,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  144,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      145,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  146,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59\n\n    },\n\n    {\n       55,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  147,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  148,  -60,\n      149,  150,  151,  152,  153,  154,  -60,  -60,  -60,  -60,\n      155,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60\n    },\n\n    {\n       55,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  156,  -61,  -61,  -61,  -61,\n\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      157,  158,  -61,  159,  -61,  -61,  160,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61\n    },\n\n    {\n       55,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  161,  -62,\n      162,  163,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62\n    },\n\n    {\n       55,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  164,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63\n    },\n\n    {\n       55,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  165,  166,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64\n    },\n\n    {\n       55,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  167,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  168,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65\n    },\n\n    {\n       55,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  169,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66\n    },\n\n    {\n       55,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  170,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67\n    },\n\n    {\n       55,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n\n      -68,  -68,  -68,  -68,  -68,  -68,  171,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68\n    },\n\n    {\n       55,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  172,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  173,  -69,  -69,  -69,\n      174,  -69,  175,  176,  -69,  -69,  177,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69\n\n    },\n\n    {\n       55,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  178,  -70,  -70,  -70,  179,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  180,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70\n    },\n\n    {\n       55,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      181,  -71,  -71,  182,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71\n    },\n\n    {\n       55,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  183,\n      -72,  -72,  -72,  184,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  185,  186,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72\n    },\n\n    {\n       55,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  187,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  188,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73\n    },\n\n    {\n       55,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  189,  -74,  190,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74\n    },\n\n    {\n       55,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      191,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75\n    },\n\n    {\n       55,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      192,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76\n    },\n\n    {\n       55,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  193,  -77,  -77,  -77,  -77,  -77,  -77,\n\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77\n    },\n\n    {\n       55,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78\n    },\n\n    {\n       55,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n\n      -79,  -79,  194,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  195,  196,\n      196,  196,  196,  196,  196,  196,  196,  196,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  194,  194,  194,  194,  194,\n      194,  194,  194,  194,  194,  194,  194,  194,  194,  194,\n      194,  194,  194,  194,  194,  194,  194,  194,  194,  194,\n      194,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79\n\n    },\n\n    {\n       55,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  197,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  198,  198,\n      198,  198,  198,  198,  198,  198,  198,  198,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  197,  197,  197,  197,  197,\n      197,  197,  197,  197,  197,  197,  197,  197,  197,  197,\n      197,  197,  197,  197,  197,  197,  197,  197,  197,  197,\n      197,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80\n    },\n\n    {\n       55,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81\n    },\n\n    {\n       55,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n\n      -82,  -82,  -82,  -82,  -82,  199,  -82,  -82,  200,  201,\n      201,  201,  201,  201,  201,  201,  201,  201,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  202,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82\n    },\n\n    {\n       55,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  199,  -83,  -83,  203,  203,\n      203,  203,  203,  203,  203,  203,  203,  203,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  204,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83\n    },\n\n    {\n       55,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84\n    },\n\n    {\n       55,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  205,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  206,  207,\n\n      207,  207,  207,  207,  207,  207,  207,  207,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  205,  205,  205,  205,  205,\n      205,  205,  205,  205,  205,  205,  205,  205,  205,  205,\n      205,  205,  205,  205,  205,  205,  205,  205,  205,  205,\n      205,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85\n    },\n\n    {\n       55,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  208,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  209,  209,\n      209,  209,  209,  209,  209,  209,  209,  209,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  208,  208,  208,  208,  208,\n      208,  208,  208,  208,  208,  208,  208,  208,  208,  208,\n      208,  208,  208,  208,  208,  208,  208,  208,  208,  208,\n      208,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86\n    },\n\n    {\n       55,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87\n    },\n\n    {\n       55,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  210,  -88,  -88,  211,  212,\n      212,  212,  212,  212,  212,  212,  212,  212,  -88,  -88,\n\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  213,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88\n    },\n\n    {\n       55,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  210,  -89,  -89,  214,  214,\n      214,  214,  214,  214,  214,  214,  214,  214,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  215,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89\n\n    },\n\n    {\n       55,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90\n    },\n\n    {\n       55,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91\n    },\n\n    {\n       55,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92\n    },\n\n    {\n       55,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93\n    },\n\n    {\n       55,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  216,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  217,  217,\n      217,  217,  217,  217,  217,  217,  217,  217,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  216,  216,  216,  216,  216,\n      216,  216,  216,  216,  216,  216,  216,  216,  216,  216,\n\n      216,  216,  216,  216,  216,  216,  216,  216,  216,  216,\n      216,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94\n    },\n\n    {\n       55,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95\n    },\n\n    {\n       55,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  218,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  219,  219,\n      219,  219,  219,  219,  219,  219,  219,  219,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96\n    },\n\n    {\n       55,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97\n    },\n\n    {\n       55,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  220,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98\n    },\n\n    {\n       55,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99\n\n    },\n\n    {\n       55, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100,  221, -100, -100, -100, -100,\n\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100\n    },\n\n    {\n       55, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101\n    },\n\n    {\n       55, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102,  222, -102, -102, -102, -102, -102, -102, -102,\n\n     -102, -102, -102, -102, -102, -102, -102, -102,  223,  223,\n      223,  223,  223,  223,  223,  223,  223,  223, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102\n    },\n\n    {\n       55, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103\n    },\n\n    {\n       55, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104,  224, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104\n    },\n\n    {\n       55, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105\n    },\n\n    {\n       55, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106,  225, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n\n     -106, -106, -106, -106, -106, -106, -106, -106\n    },\n\n    {\n       55, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107\n    },\n\n    {\n       55, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108,  226,  226,\n      226,  226,  226,  226,  226,  226,  226,  226, -108, -108,\n\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108\n    },\n\n    {\n       55, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109,  226,  226,\n      226,  226,  226,  226,  226,  226,  226,  226, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109\n\n    },\n\n    {\n       55, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110\n    },\n\n    {\n       55, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111,  227, -111,  228,  228,\n      228,  228,  228,  228,  228,  228,  228,  228, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111\n    },\n\n    {\n       55, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n\n     -112, -112, -112, -112, -112, -112, -112, -112,  229,  229,\n      229,  229,  229,  229,  229,  229,  229,  229, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112\n    },\n\n    {\n       55, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113,  230, -113,  231,  231,\n      231,  231,  231,  231,  231,  231,  231,  231, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113,  232,  232,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n      232,  232, -113, -113, -113, -113, -113, -113, -113, -113,\n\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113\n    },\n\n    {\n       55, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114\n    },\n\n    {\n       55, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115,  233, -115,  234,  234,\n\n      234,  234,  234,  234,  234,  234,  234,  234, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115\n    },\n\n    {\n       55, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116,  235,  235,\n      235,  235,  235,  235,  235,  235,  235,  235, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n\n     -116, -116, -116, -116, -116, -116, -116, -116\n    },\n\n    {\n       55, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117,  236, -117,  237,  237,\n      237,  237,  237,  237,  237,  237,  237,  237, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117,  238,  238,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n      238,  238, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117\n    },\n\n    {\n       55, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118\n    },\n\n    {\n       55,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  240,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239\n\n    },\n\n    {\n       55, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120\n    },\n\n    {\n       55,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  242,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241\n    },\n\n    {\n       55, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122\n    },\n\n    {\n       55, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123,  243, -123,  243,  243,\n      243,  243,  243,  243,  243,  243,  243,  243, -123, -123,\n     -123, -123, -123, -123, -123,  243,  243,  243,  243,  243,\n      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,\n      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,\n      243, -123, -123, -123, -123,  243, -123,  243,  243,  243,\n      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,\n\n      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,\n      243,  243,  243, -123, -123, -123, -123, -123\n    },\n\n    {\n       55, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124\n    },\n\n    {\n       55, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125,  244, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125\n    },\n\n    {\n       55, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n\n     -126, -126, -126, -126, -126, -126, -126, -126\n    },\n\n    {\n       55, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127,  245, -127,  246,  246,\n      246,  246,  246,  246,  246,  246,  246,  246, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127\n    },\n\n    {\n       55, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128,  247,  247,\n      247,  247,  247,  247,  247,  247,  247,  247, -128, -128,\n\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128\n    },\n\n    {\n       55, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129,  248, -129,  249,  249,\n      249,  249,  249,  249,  249,  249,  249,  249, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129,  250,  250,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n      250,  250, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129\n\n    },\n\n    {\n       55, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130\n    },\n\n    {\n       55,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      252,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  253,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  254,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n\n      251,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  251\n    },\n\n    {\n       55, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132\n    },\n\n    {\n       55,  255,  255,  255,  255,  255,  255,  255,  255,  255,\n\n      256,  255,  255,  255,  255,  255,  255,  255,  255,  255,\n      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,\n      255,  255,  257,  255,  255,  255,  255,  255,  255,  255,\n      255,  255,  255,  255,  255,  255,  255,  258,  255,  255,\n      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,\n      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,\n      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,\n      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,\n      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,\n      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,\n\n      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,\n      255,  255,  255,  255,  255,  255,  255,  255\n    },\n\n    {\n       55,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      260,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  261,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  262,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259\n    },\n\n    {\n       55,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      264,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263\n    },\n\n    {\n       55, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n\n     -136, -136, -136, -136, -136, -136, -136, -136\n    },\n\n    {\n       55,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      266,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265\n    },\n\n    {\n       55, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138\n    },\n\n    {\n       55,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      268,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267\n\n    },\n\n    {\n       55, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140\n    },\n\n    {\n       55, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141,  269, -141,\n\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141\n    },\n\n    {\n       55, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142,  270, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142\n    },\n\n    {\n       55, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143,  271, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143,  272,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143\n    },\n\n    {\n       55, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n\n      273, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144\n    },\n\n    {\n       55, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145,  274, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145\n    },\n\n    {\n       55, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146,  275, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146,  276,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n\n     -146, -146, -146, -146, -146, -146, -146, -146\n    },\n\n    {\n       55, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147,  277,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147\n    },\n\n    {\n       55, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n\n     -148, -148, -148, -148, -148,  278, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n      279, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148\n    },\n\n    {\n       55, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149,  280,  281,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149\n\n    },\n\n    {\n       55, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150,  282,  283,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150\n    },\n\n    {\n       55, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151,  284, -151,\n\n     -151, -151, -151, -151, -151, -151,  285, -151, -151,  286,\n      287, -151, -151, -151, -151, -151,  288, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151\n    },\n\n    {\n       55, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152,  289,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152\n    },\n\n    {\n       55, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153,  290,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153\n    },\n\n    {\n       55, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154,  291, -154,\n\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154\n    },\n\n    {\n       55, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n      292, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155\n    },\n\n    {\n       55, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156,  293, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n\n     -156, -156, -156, -156, -156, -156, -156, -156\n    },\n\n    {\n       55, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157\n    },\n\n    {\n       55, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158\n    },\n\n    {\n       55, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159,  294, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159\n\n    },\n\n    {\n       55, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160,  295,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160\n    },\n\n    {\n       55, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161,  296, -161,\n\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161\n    },\n\n    {\n       55, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162,  297,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162\n    },\n\n    {\n       55, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163,  298, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163\n    },\n\n    {\n       55, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164,  299, -164, -164, -164,\n\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164\n    },\n\n    {\n       55, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165,  300, -165, -165, -165, -165,\n\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165,  301, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165\n    },\n\n    {\n       55, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n      302, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n\n     -166, -166, -166, -166, -166, -166, -166, -166\n    },\n\n    {\n       55, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167,  303, -167, -167, -167, -167, -167,\n\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167\n    },\n\n    {\n       55, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168,  304, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168\n    },\n\n    {\n       55, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169,  305, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169\n\n    },\n\n    {\n       55, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170,  306, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170\n    },\n\n    {\n       55, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171,  307, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171\n    },\n\n    {\n       55, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172\n    },\n\n    {\n       55, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173,  308, -173, -173, -173,  309,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173,  310, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173\n    },\n\n    {\n       55, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174,  311,\n\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174\n    },\n\n    {\n       55, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175,  312,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175\n    },\n\n    {\n       55, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n\n     -176, -176, -176, -176, -176, -176, -176, -176\n    },\n\n    {\n       55, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177\n    },\n\n    {\n       55, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n\n     -178, -178, -178, -178, -178, -178, -178, -178,  313, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178\n    },\n\n    {\n       55, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179,  314, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179\n\n    },\n\n    {\n       55, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180,  315, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180\n    },\n\n    {\n       55, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181,  316,\n\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181\n    },\n\n    {\n       55, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182,  317,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182\n    },\n\n    {\n       55, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183,  318, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183\n    },\n\n    {\n       55, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184,  319, -184, -184,\n\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184\n    },\n\n    {\n       55, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185,  320,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185\n    },\n\n    {\n       55, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186,  321, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n\n     -186, -186, -186, -186, -186, -186, -186, -186\n    },\n\n    {\n       55, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187,  322, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187\n    },\n\n    {\n       55, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188,  323,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188\n    },\n\n    {\n       55, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189,  324, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189\n\n    },\n\n    {\n       55, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190,  325, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190\n    },\n\n    {\n       55, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n\n     -191, -191, -191,  326, -191, -191, -191, -191, -191,  327,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191\n    },\n\n    {\n       55, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192,  328, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192\n    },\n\n    {\n       55, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193,  329,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193\n    },\n\n    {\n       55, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194,  330, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194\n    },\n\n    {\n       55, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195,  331, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195,  332,  333,\n\n      333,  333,  333,  333,  333,  333,  333,  333, -195, -195,\n     -195, -195, -195, -195, -195,  331,  331,  331,  331,  331,\n      331,  331,  331,  331,  331,  331,  331,  331,  331,  331,\n      331,  331,  331,  331,  331,  331,  331,  331,  331,  331,\n      331, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195\n    },\n\n    {\n       55, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196,  334, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196,  332,  333,\n      333,  333,  333,  333,  333,  333,  333,  333, -196, -196,\n     -196, -196, -196, -196, -196,  334,  334,  334,  334,  334,\n      334,  334,  334,  334,  334,  334,  334,  334,  334,  334,\n      334,  334,  334,  334,  334,  334,  334,  334,  334,  334,\n      334, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n\n     -196, -196, -196, -196, -196, -196, -196, -196\n    },\n\n    {\n       55, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197,  335, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197\n    },\n\n    {\n       55, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198,  336, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198,  337,  337,\n      337,  337,  337,  337,  337,  337,  337,  337, -198, -198,\n\n     -198, -198, -198, -198, -198,  336,  336,  336,  336,  336,\n      336,  336,  336,  336,  336,  336,  336,  336,  336,  336,\n      336,  336,  336,  336,  336,  336,  336,  336,  336,  336,\n      336, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198\n    },\n\n    {\n       55, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199,  338,  338,\n      338,  338,  338,  338,  338,  338,  338,  338, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199\n\n    },\n\n    {\n       55, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200,  339, -200, -200,  340,  341,\n      341,  341,  341,  341,  341,  341,  341,  341, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200,  342, -200, -200, -200, -200,\n\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200\n    },\n\n    {\n       55, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201,  339, -201, -201,  343,  344,\n      344,  344,  344,  344,  344,  344,  344,  344, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201,  345, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201\n    },\n\n    {\n       55, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n\n     -202, -202, -202, -202, -202, -202, -202, -202,  346,  346,\n      346,  346,  346,  346,  346,  346,  346,  346, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202\n    },\n\n    {\n       55, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203,  339, -203, -203,  347,  348,\n      348,  348,  348,  348,  348,  348,  348,  348, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203,  349, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203\n    },\n\n    {\n       55, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204,  350,  351,\n      351,  351,  351,  351,  351,  351,  351,  351, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204\n    },\n\n    {\n       55, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205,  352, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205\n    },\n\n    {\n       55, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206,  353, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206,  354,  355,\n      355,  355,  355,  355,  355,  355,  355,  355, -206, -206,\n     -206, -206, -206, -206, -206,  353,  353,  353,  353,  353,\n      353,  353,  353,  353,  353,  353,  353,  353,  353,  353,\n      353,  353,  353,  353,  353,  353,  353,  353,  353,  353,\n      353, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n\n     -206, -206, -206, -206, -206, -206, -206, -206\n    },\n\n    {\n       55, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207,  356, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207,  354,  355,\n      355,  355,  355,  355,  355,  355,  355,  355, -207, -207,\n     -207, -207, -207, -207, -207,  356,  356,  356,  356,  356,\n      356,  356,  356,  356,  356,  356,  356,  356,  356,  356,\n      356,  356,  356,  356,  356,  356,  356,  356,  356,  356,\n\n      356, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207\n    },\n\n    {\n       55, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208,  357, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208\n    },\n\n    {\n       55, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n\n     -209, -209,  358, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209,  354,  354,\n      354,  354,  354,  354,  354,  354,  354,  354, -209, -209,\n     -209, -209, -209, -209, -209,  358,  358,  358,  358,  358,\n      358,  358,  358,  358,  358,  358,  358,  358,  358,  358,\n      358,  358,  358,  358,  358,  358,  358,  358,  358,  358,\n      358, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209\n\n    },\n\n    {\n       55, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210,  359,  359,\n      359,  359,  359,  359,  359,  359,  359,  359, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210\n    },\n\n    {\n       55, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211,  360, -211, -211,  361,  362,\n      362,  362,  362,  362,  362,  362,  362,  362, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211,  363, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211\n    },\n\n    {\n       55, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n\n     -212, -212, -212, -212, -212,  360, -212, -212,  364,  364,\n      364,  364,  364,  364,  364,  364,  364,  364, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212,  365, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212\n    },\n\n    {\n       55, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213,  366,  366,\n      366,  366,  366,  366,  366,  366,  366,  366, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213\n    },\n\n    {\n       55, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214,  360, -214, -214,  367,  367,\n      367,  367,  367,  367,  367,  367,  367,  367, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214,  368, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214\n    },\n\n    {\n       55, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215,  369,  370,\n\n      370,  370,  370,  370,  370,  370,  370,  370, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215\n    },\n\n    {\n       55, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216,  371, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n\n     -216, -216, -216, -216, -216, -216, -216, -216\n    },\n\n    {\n       55, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217,  372, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217,  373,  373,\n      373,  373,  373,  373,  373,  373,  373,  373, -217, -217,\n     -217, -217, -217, -217, -217,  372,  372,  372,  372,  372,\n      372,  372,  372,  372,  372,  372,  372,  372,  372,  372,\n      372,  372,  372,  372,  372,  372,  372,  372,  372,  372,\n\n      372, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217\n    },\n\n    {\n       55, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218,  374, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218\n    },\n\n    {\n       55, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n\n     -219, -219,  375, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219,  376,  376,\n      376,  376,  376,  376,  376,  376,  376,  376, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219\n\n    },\n\n    {\n       55, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220,  377,  377,\n      377,  377,  377,  377,  377,  377,  377,  377, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220\n    },\n\n    {\n       55, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221,  378,  378,\n      378,  378,  378,  378,  378,  378,  378,  378, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221\n    },\n\n    {\n       55, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222,  379, -222, -222, -222, -222, -222, -222, -222,\n\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222\n    },\n\n    {\n       55, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223,  380, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223\n    },\n\n    {\n       55, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224,  224, -224, -224, -224, -224, -224, -224,  381,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224\n    },\n\n    {\n       55, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225,  225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225\n    },\n\n    {\n       55, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226,  226,  226,\n      226,  226,  226,  226,  226,  226,  226,  226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n\n     -226, -226, -226, -226, -226, -226, -226, -226\n    },\n\n    {\n       55, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227,  229,  229,\n      229,  229,  229,  229,  229,  229,  229,  229, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227\n    },\n\n    {\n       55, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228,  230, -228,  231,  231,\n      231,  231,  231,  231,  231,  231,  231,  231, -228, -228,\n\n     -228, -228, -228, -228, -228, -228, -228, -228,  232,  232,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n      232,  232, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228\n    },\n\n    {\n       55, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229,  229,  229,\n      229,  229,  229,  229,  229,  229,  229,  229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229,  232,  232,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n      232,  232, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229\n\n    },\n\n    {\n       55, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230,  382,  382,\n      382,  382,  382,  382,  382,  382,  382,  382, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230,  232,  232,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n\n      232,  232, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230\n    },\n\n    {\n       55, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231,  230, -231,  231,  231,\n      231,  231,  231,  231,  231,  231,  231,  231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231,  232,  232,\n\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n      232,  232, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231\n    },\n\n    {\n       55, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n\n     -232, -232, -232,  383, -232,  383, -232, -232,  384,  384,\n      384,  384,  384,  384,  384,  384,  384,  384, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232\n    },\n\n    {\n       55, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233,  235,  235,\n      235,  235,  235,  235,  235,  235,  235,  235, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233\n    },\n\n    {\n       55, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234,  236, -234,  237,  237,\n      237,  237,  237,  237,  237,  237,  237,  237, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234,  238,  238,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n      238,  238, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234\n    },\n\n    {\n       55, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235,  235,  235,\n\n      235,  235,  235,  235,  235,  235,  235,  235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235,  238,  238,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n      238,  238, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235\n    },\n\n    {\n       55, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236,  385,  385,\n      385,  385,  385,  385,  385,  385,  385,  385, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236,  238,  238,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n      238,  238, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n\n     -236, -236, -236, -236, -236, -236, -236, -236\n    },\n\n    {\n       55, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237,  236, -237,  237,  237,\n      237,  237,  237,  237,  237,  237,  237,  237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237,  238,  238,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n      238,  238, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237\n    },\n\n    {\n       55, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238,  386, -238,  386, -238, -238,  387,  387,\n      387,  387,  387,  387,  387,  387,  387,  387, -238, -238,\n\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238\n    },\n\n    {\n       55,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  240,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239\n\n    },\n\n    {\n       55, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240,  239,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240\n    },\n\n    {\n       55,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  242,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241\n    },\n\n    {\n       55, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242\n    },\n\n    {\n       55, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243,  243, -243,  243,  243,\n      243,  243,  243,  243,  243,  243,  243,  243, -243, -243,\n     -243, -243, -243, -243, -243,  243,  243,  243,  243,  243,\n      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,\n      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,\n      243, -243, -243, -243, -243,  243, -243,  243,  243,  243,\n      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,\n\n      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,\n      243,  243,  243, -243, -243, -243, -243, -243\n    },\n\n    {\n       55, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244,  244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244\n    },\n\n    {\n       55, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245,  247,  247,\n\n      247,  247,  247,  247,  247,  247,  247,  247, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245\n    },\n\n    {\n       55, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246,  248, -246,  249,  249,\n      249,  249,  249,  249,  249,  249,  249,  249, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246,  250,  250,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n      250,  250, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n\n     -246, -246, -246, -246, -246, -246, -246, -246\n    },\n\n    {\n       55, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247,  247,  247,\n      247,  247,  247,  247,  247,  247,  247,  247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247,  250,  250,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n      250,  250, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247\n    },\n\n    {\n       55, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248,  388,  388,\n      388,  388,  388,  388,  388,  388,  388,  388, -248, -248,\n\n     -248, -248, -248, -248, -248, -248, -248, -248,  250,  250,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n      250,  250, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248\n    },\n\n    {\n       55, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249,  248, -249,  249,  249,\n      249,  249,  249,  249,  249,  249,  249,  249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249,  250,  250,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n      250,  250, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249\n\n    },\n\n    {\n       55, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250,  389, -250,  389, -250, -250,  390,  390,\n      390,  390,  390,  390,  390,  390,  390,  390, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250\n    },\n\n    {\n       55,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      252,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  253,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  254,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n\n      251,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  251,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  251\n    },\n\n    {\n       55, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252\n    },\n\n    {\n       55,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n\n      252,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  253,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  254,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391\n    },\n\n    {\n       55,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      393,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  394,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  395,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392\n    },\n\n    {\n       55,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      397,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  398,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  399,  396,  396,\n\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396\n    },\n\n    {\n       55, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n\n     -256, -256, -256, -256, -256, -256, -256, -256\n    },\n\n    {\n       55,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      401,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  402,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  403,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n\n      400,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400\n    },\n\n    {\n       55,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      260,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  261,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  262,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259\n    },\n\n    {\n       55,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      260,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n\n      259,  259,  261,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  262,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259\n\n    },\n\n    {\n       55, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260\n    },\n\n    {\n       55,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      260,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  261,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  262,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259\n    },\n\n    {\n       55,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      260,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  261,  259,  259,  259,  259,  259,  259,  259,\n\n      259,  259,  259,  259,  259,  259,  259,  262,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259\n    },\n\n    {\n       55,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n\n      264,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n\n      263,  263,  263,  263,  263,  263,  263,  263,  263,  263,\n      263,  263,  263,  263,  263,  263,  263,  263\n    },\n\n    {\n       55, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264\n    },\n\n    {\n       55,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      266,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265\n    },\n\n    {\n       55, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n\n     -266, -266, -266, -266, -266, -266, -266, -266\n    },\n\n    {\n       55,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      268,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267\n    },\n\n    {\n       55, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268\n    },\n\n    {\n       55, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269,  404,  405,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269\n\n    },\n\n    {\n       55, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270,  406,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270\n    },\n\n    {\n       55, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n\n     -271, -271, -271, -271, -271, -271, -271,  407, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271\n    },\n\n    {\n       55, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272,  408, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272\n    },\n\n    {\n       55, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273,  409,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273\n    },\n\n    {\n       55, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274,  410,\n\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274\n    },\n\n    {\n       55, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275,  411, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275\n    },\n\n    {\n       55, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276,  412, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n\n     -276, -276, -276, -276, -276, -276, -276, -276\n    },\n\n    {\n       55, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277,  413, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277\n    },\n\n    {\n       55, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278,  414, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278\n    },\n\n    {\n       55, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279,  415, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279\n\n    },\n\n    {\n       55, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280,  416, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280\n    },\n\n    {\n       55, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281,  417, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281\n    },\n\n    {\n       55, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282,  418, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282\n    },\n\n    {\n       55, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283,  419, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283\n    },\n\n    {\n       55, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284,  420,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284\n    },\n\n    {\n       55, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285,  421, -285,\n     -285, -285, -285, -285,  422, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285\n    },\n\n    {\n       55, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286,  423, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n\n     -286, -286, -286, -286, -286, -286, -286, -286\n    },\n\n    {\n       55, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287,  424, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287\n    },\n\n    {\n       55, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n\n     -288, -288, -288, -288, -288,  425, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288\n    },\n\n    {\n       55, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289,  426,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289\n\n    },\n\n    {\n       55, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n      427, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290\n    },\n\n    {\n       55, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n\n     -291, -291, -291,  428, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291\n    },\n\n    {\n       55, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292,  429, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292\n    },\n\n    {\n       55, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293,  430,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293\n    },\n\n    {\n       55, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294,  431, -294,\n\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294\n    },\n\n    {\n       55, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295,  432, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295\n    },\n\n    {\n       55, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296,  433, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n\n     -296, -296, -296, -296, -296, -296, -296, -296\n    },\n\n    {\n       55, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297,  434, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297\n    },\n\n    {\n       55, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298,  435, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298\n    },\n\n    {\n       55, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299,  436, -299,\n     -299, -299, -299, -299,  437, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299\n\n    },\n\n    {\n       55, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300,  438, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300\n    },\n\n    {\n       55, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301,  439,\n\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301\n    },\n\n    {\n       55, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302,  440,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302\n    },\n\n    {\n       55, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n      441, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303\n    },\n\n    {\n       55, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n\n      442, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304\n    },\n\n    {\n       55, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305,  443, -305, -305, -305, -305,\n\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305,  444, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305\n    },\n\n    {\n       55, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306,  445, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n\n     -306, -306, -306, -306, -306, -306, -306, -306\n    },\n\n    {\n       55, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307,  446, -307, -307, -307, -307, -307, -307, -307,  447,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307\n    },\n\n    {\n       55, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308,  448, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308\n    },\n\n    {\n       55, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n      449, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309\n\n    },\n\n    {\n       55, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310,  450, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310,  451, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310\n    },\n\n    {\n       55, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311,  452, -311, -311,  453, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311\n    },\n\n    {\n       55, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312,  454, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312\n    },\n\n    {\n       55, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313,  455,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313\n    },\n\n    {\n       55, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n\n     -314, -314, -314, -314,  456, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314\n    },\n\n    {\n       55, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315,  457, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315\n    },\n\n    {\n       55, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316,  458, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n\n     -316, -316, -316, -316, -316, -316, -316, -316\n    },\n\n    {\n       55, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317,  459, -317, -317, -317, -317, -317, -317,\n\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317\n    },\n\n    {\n       55, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n\n     -318, -318, -318, -318, -318,  460, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318\n    },\n\n    {\n       55, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319,  461,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319,  462,  463, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319\n\n    },\n\n    {\n       55, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n      464, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320\n    },\n\n    {\n       55, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321,  465, -321, -321, -321, -321,\n\n     -321, -321, -321, -321, -321, -321, -321, -321, -321,  466,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321\n    },\n\n    {\n       55, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322,  467, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322,  468,\n     -322, -322,  469, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322\n    },\n\n    {\n       55, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323,  470, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323\n    },\n\n    {\n       55, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324,  471,\n      471, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324\n    },\n\n    {\n       55, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325,  472, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325,  473, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325\n    },\n\n    {\n       55, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326,  474, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n\n     -326, -326, -326, -326, -326, -326, -326, -326\n    },\n\n    {\n       55, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327,  475, -327, -327, -327, -327, -327, -327,\n\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327\n    },\n\n    {\n       55, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328,  476, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328\n    },\n\n    {\n       55, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329,  477, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329\n\n    },\n\n    {\n       55, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330,  478, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330\n    },\n\n    {\n       55, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331,  479, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331\n    },\n\n    {\n       55, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332,  480, -332, -332, -332, -332, -332, -332, -332,\n\n     -332, -332, -332, -332, -332, -332, -332, -332,  481,  482,\n      482,  482,  482,  482,  482,  482,  482,  482, -332, -332,\n     -332, -332, -332, -332, -332,  480,  480,  480,  480,  480,\n      480,  480,  480,  480,  480,  480,  480,  480,  480,  480,\n      480,  480,  480,  480,  480,  480,  480,  480,  480,  480,\n      480, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332\n    },\n\n    {\n       55, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333,  483, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333,  481,  482,\n      482,  482,  482,  482,  482,  482,  482,  482, -333, -333,\n     -333, -333, -333, -333, -333,  483,  483,  483,  483,  483,\n      483,  483,  483,  483,  483,  483,  483,  483,  483,  483,\n      483,  483,  483,  483,  483,  483,  483,  483,  483,  483,\n      483, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333\n    },\n\n    {\n       55, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334,  484, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334\n    },\n\n    {\n       55, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335,  485, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335\n    },\n\n    {\n       55, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336,  486, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n\n     -336, -336, -336, -336, -336, -336, -336, -336\n    },\n\n    {\n       55, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337,  480, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337,  487,  487,\n      487,  487,  487,  487,  487,  487,  487,  487, -337, -337,\n     -337, -337, -337, -337, -337,  480,  480,  480,  480,  480,\n      480,  480,  480,  480,  480,  480,  480,  480,  480,  480,\n      480,  480,  480,  480,  480,  480,  480,  480,  480,  480,\n\n      480, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337\n    },\n\n    {\n       55, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338,  488, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338,  489,  489,\n      489,  489,  489,  489,  489,  489,  489,  489, -338, -338,\n\n     -338, -338, -338, -338, -338,  488,  488,  488,  488,  488,\n      488,  488,  488,  488,  488,  488,  488,  488,  488,  488,\n      488,  488,  488,  488,  488,  488,  488,  488,  488,  488,\n      488, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338\n    },\n\n    {\n       55, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339,  490,  490,\n      490,  490,  490,  490,  490,  490,  490,  490, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339\n\n    },\n\n    {\n       55, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340,  491, -340, -340,  492,  493,\n      493,  493,  493,  493,  493,  493,  493,  493, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340,  494, -340, -340, -340, -340,\n\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340\n    },\n\n    {\n       55, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341,  491, -341, -341,  495,  495,\n      495,  495,  495,  495,  495,  495,  495,  495, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341,  496, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341\n    },\n\n    {\n       55, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n\n     -342, -342, -342, -342, -342, -342, -342, -342,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342\n    },\n\n    {\n       55, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343,  491, -343, -343,  492,  492,\n      492,  492,  492,  492,  492,  492,  492,  492, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343,  498, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343\n    },\n\n    {\n       55, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344,  491, -344, -344,  499,  499,\n      499,  499,  499,  499,  499,  499,  499,  499, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344,  498, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344\n    },\n\n    {\n       55, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345,  500,  501,\n\n      501,  501,  501,  501,  501,  501,  501,  501, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345\n    },\n\n    {\n       55, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346,  502, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346,  503,  503,\n      503,  503,  503,  503,  503,  503,  503,  503, -346, -346,\n     -346, -346, -346, -346, -346,  502,  502,  502,  502,  502,\n      502,  502,  502,  502,  502,  502,  502,  502,  502,  502,\n      502,  502,  502,  502,  502,  502,  502,  502,  502,  502,\n      502, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n\n     -346, -346, -346, -346, -346, -346, -346, -346\n    },\n\n    {\n       55, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347,  491, -347, -347,  492,  492,\n      492,  492,  492,  492,  492,  492,  492,  492, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n\n     -347, -347, -347, -347, -347,  494, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347\n    },\n\n    {\n       55, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348,  491, -348, -348,  499,  499,\n      499,  499,  499,  499,  499,  499,  499,  499, -348, -348,\n\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348,  494, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348\n    },\n\n    {\n       55, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349,  504,  505,\n      505,  505,  505,  505,  505,  505,  505,  505, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349\n\n    },\n\n    {\n       55, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350,  502, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350,  506,  507,\n      507,  507,  507,  507,  507,  507,  507,  507, -350, -350,\n     -350, -350, -350, -350, -350,  502,  502,  502,  502,  502,\n      502,  502,  502,  502,  502,  502,  502,  502,  502,  502,\n      502,  502,  502,  502,  502,  502,  502,  502,  502,  502,\n      502, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350\n    },\n\n    {\n       55, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351,  508, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351,  509,  509,\n      509,  509,  509,  509,  509,  509,  509,  509, -351, -351,\n     -351, -351, -351, -351, -351,  508,  508,  508,  508,  508,\n\n      508,  508,  508,  508,  508,  508,  508,  508,  508,  508,\n      508,  508,  508,  508,  508,  508,  508,  508,  508,  508,\n      508, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351\n    },\n\n    {\n       55, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352\n    },\n\n    {\n       55, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353\n    },\n\n    {\n       55, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354\n    },\n\n    {\n       55, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355\n    },\n\n    {\n       55, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n\n     -356, -356, -356, -356, -356, -356, -356, -356\n    },\n\n    {\n       55, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357\n    },\n\n    {\n       55, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358\n    },\n\n    {\n       55, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n\n     -359, -359,  510, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359,  511,  511,\n      511,  511,  511,  511,  511,  511,  511,  511, -359, -359,\n     -359, -359, -359, -359, -359,  510,  510,  510,  510,  510,\n      510,  510,  510,  510,  510,  510,  510,  510,  510,  510,\n      510,  510,  510,  510,  510,  510,  510,  510,  510,  510,\n      510, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359\n\n    },\n\n    {\n       55, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360,  512,  512,\n      512,  512,  512,  512,  512,  512,  512,  512, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360\n    },\n\n    {\n       55, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361,  513, -361, -361,  514,  515,\n      515,  515,  515,  515,  515,  515,  515,  515, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361,  516, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361\n    },\n\n    {\n       55, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n\n     -362, -362, -362, -362, -362,  513, -362, -362,  517,  517,\n      517,  517,  517,  517,  517,  517,  517,  517, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362,  518, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362\n    },\n\n    {\n       55, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363,  519,  519,\n      519,  519,  519,  519,  519,  519,  519,  519, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363\n    },\n\n    {\n       55, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364,  513, -364, -364,  514,  514,\n      514,  514,  514,  514,  514,  514,  514,  514, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364,  520, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364\n    },\n\n    {\n       55, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365,  521,  522,\n\n      522,  522,  522,  522,  522,  522,  522,  522, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365\n    },\n\n    {\n       55, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366,  523, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366,  524,  524,\n      524,  524,  524,  524,  524,  524,  524,  524, -366, -366,\n     -366, -366, -366, -366, -366,  523,  523,  523,  523,  523,\n      523,  523,  523,  523,  523,  523,  523,  523,  523,  523,\n      523,  523,  523,  523,  523,  523,  523,  523,  523,  523,\n      523, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n\n     -366, -366, -366, -366, -366, -366, -366, -366\n    },\n\n    {\n       55, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367,  513, -367, -367,  514,  514,\n      514,  514,  514,  514,  514,  514,  514,  514, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n\n     -367, -367, -367, -367, -367,  516, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367\n    },\n\n    {\n       55, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368,  525,  526,\n      526,  526,  526,  526,  526,  526,  526,  526, -368, -368,\n\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368\n    },\n\n    {\n       55, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n\n     -369, -369,  527, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369,  528,  529,\n      529,  529,  529,  529,  529,  529,  529,  529, -369, -369,\n     -369, -369, -369, -369, -369,  527,  527,  527,  527,  527,\n      527,  527,  527,  527,  527,  527,  527,  527,  527,  527,\n      527,  527,  527,  527,  527,  527,  527,  527,  527,  527,\n      527, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369\n\n    },\n\n    {\n       55, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370,  527, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370,  530,  530,\n      530,  530,  530,  530,  530,  530,  530,  530, -370, -370,\n     -370, -370, -370, -370, -370,  527,  527,  527,  527,  527,\n      527,  527,  527,  527,  527,  527,  527,  527,  527,  527,\n      527,  527,  527,  527,  527,  527,  527,  527,  527,  527,\n      527, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370\n    },\n\n    {\n       55, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371\n    },\n\n    {\n       55, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372\n    },\n\n    {\n       55, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373\n    },\n\n    {\n       55, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374\n    },\n\n    {\n       55, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375\n    },\n\n    {\n       55, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n\n     -376, -376, -376, -376, -376, -376, -376, -376\n    },\n\n    {\n       55, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377,  531, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377\n    },\n\n    {\n       55, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378,  532, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378\n    },\n\n    {\n       55, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n\n     -379, -379,  533, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379\n\n    },\n\n    {\n       55, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380,  534, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380\n    },\n\n    {\n       55,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  536,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535\n    },\n\n    {\n       55, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n\n     -382, -382, -382, -382, -382, -382, -382, -382,  382,  382,\n      382,  382,  382,  382,  382,  382,  382,  382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382,  232,  232,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n      232,  232, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382\n    },\n\n    {\n       55, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383,  384,  384,\n      384,  384,  384,  384,  384,  384,  384,  384, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383\n    },\n\n    {\n       55, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384,  384,  384,\n      384,  384,  384,  384,  384,  384,  384,  384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384\n    },\n\n    {\n       55, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385,  385,  385,\n\n      385,  385,  385,  385,  385,  385,  385,  385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385,  238,  238,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n      238,  238, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385\n    },\n\n    {\n       55, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386,  387,  387,\n      387,  387,  387,  387,  387,  387,  387,  387, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n\n     -386, -386, -386, -386, -386, -386, -386, -386\n    },\n\n    {\n       55, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387,  387,  387,\n      387,  387,  387,  387,  387,  387,  387,  387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387\n    },\n\n    {\n       55, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388,  388,  388,\n      388,  388,  388,  388,  388,  388,  388,  388, -388, -388,\n\n     -388, -388, -388, -388, -388, -388, -388, -388,  250,  250,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n      250,  250, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388\n    },\n\n    {\n       55, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389,  390,  390,\n      390,  390,  390,  390,  390,  390,  390,  390, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389\n\n    },\n\n    {\n       55, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390,  390,  390,\n      390,  390,  390,  390,  390,  390,  390,  390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390\n    },\n\n    {\n       55,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      537,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  538,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  539,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391\n    },\n\n    {\n       55,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      393,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  394,  392,  392,  392,  392,  392,  392,  392,\n\n      392,  392,  392,  392,  392,  392,  392,  395,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392\n    },\n\n    {\n       55, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393\n    },\n\n    {\n       55,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      393,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  394,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  395,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392\n    },\n\n    {\n       55,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      393,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  394,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  395,  392,  392,\n\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392\n    },\n\n    {\n       55,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      397,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  398,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  399,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n\n      396,  396,  396,  396,  396,  396,  396,  396\n    },\n\n    {\n       55, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397\n    },\n\n    {\n       55,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      397,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  398,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  399,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396\n    },\n\n    {\n       55,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      541,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n\n      540,  540,  542,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  543,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540\n\n    },\n\n    {\n       55,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      397,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  398,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  399,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396\n    },\n\n    {\n       55, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401\n    },\n\n    {\n       55,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      401,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  402,  400,  400,  400,  400,  400,  400,  400,\n\n      400,  400,  400,  400,  400,  400,  400,  403,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400\n    },\n\n    {\n       55,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n\n      545,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  546,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  547,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544\n    },\n\n    {\n       55, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404\n    },\n\n    {\n       55, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405\n    },\n\n    {\n       55, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406,  548, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n\n     -406, -406, -406, -406, -406, -406, -406, -406\n    },\n\n    {\n       55, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407,  549, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407\n    },\n\n    {\n       55, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n\n     -408, -408, -408, -408, -408, -408, -408, -408,  550, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408\n    },\n\n    {\n       55, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409,  551, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409\n\n    },\n\n    {\n       55, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410,  552, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410\n    },\n\n    {\n       55, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411,  553, -411, -411, -411, -411,\n\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411\n    },\n\n    {\n       55, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412,  554, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412\n    },\n\n    {\n       55, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413,  555, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413\n    },\n\n    {\n       55, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414,  556,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414\n    },\n\n    {\n       55, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415,  557, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415\n    },\n\n    {\n       55, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416,  558, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n\n     -416, -416, -416, -416, -416, -416, -416, -416\n    },\n\n    {\n       55, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417,  559, -417, -417, -417, -417, -417, -417,\n     -417, -417,  560, -417, -417, -417, -417, -417, -417, -417,\n\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417\n    },\n\n    {\n       55, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418,  561, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418\n    },\n\n    {\n       55, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419,  562, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419\n\n    },\n\n    {\n       55, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420,  563, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420\n    },\n\n    {\n       55, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421,  564, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421\n    },\n\n    {\n       55, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422,  565, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422\n    },\n\n    {\n       55, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423,  566, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423\n    },\n\n    {\n       55, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n\n     -424, -424, -424, -424, -424, -424, -424, -424,  567, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424\n    },\n\n    {\n       55, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425,  568, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425\n    },\n\n    {\n       55, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426,  569, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n\n     -426, -426, -426, -426, -426, -426, -426, -426\n    },\n\n    {\n       55, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427,  570,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427\n    },\n\n    {\n       55, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428,  571, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428\n    },\n\n    {\n       55, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429,  572, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429\n\n    },\n\n    {\n       55, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430,  573, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430,  574, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430\n    },\n\n    {\n       55, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431,  575, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431\n    },\n\n    {\n       55, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432,  576, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432\n    },\n\n    {\n       55, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433,  577, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433\n    },\n\n    {\n       55, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434,  578, -434, -434, -434, -434, -434, -434, -434,\n\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434\n    },\n\n    {\n       55, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435,  579, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435\n    },\n\n    {\n       55, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436,  580, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n\n     -436, -436, -436, -436, -436, -436, -436, -436\n    },\n\n    {\n       55, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n\n     -437, -437, -437, -437, -437,  581, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437\n    },\n\n    {\n       55, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n\n     -438, -438, -438, -438, -438, -438, -438, -438, -438,  582,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438\n    },\n\n    {\n       55, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n      583, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439\n\n    },\n\n    {\n       55, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440,  584, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440\n    },\n\n    {\n       55, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n\n     -441, -441, -441, -441, -441, -441, -441, -441, -441,  585,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441\n    },\n\n    {\n       55, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442,  586,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442\n    },\n\n    {\n       55, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443,  587,  588, -443, -443,  589,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443,  590,\n     -443, -443,  591, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443\n    },\n\n    {\n       55, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444,  592,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444\n    },\n\n    {\n       55, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445,  593, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445\n    },\n\n    {\n       55, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446,  594,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n\n     -446, -446, -446, -446, -446, -446, -446, -446\n    },\n\n    {\n       55, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447,  595, -447, -447, -447, -447, -447, -447, -447,\n\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447\n    },\n\n    {\n       55, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n\n     -448, -448, -448, -448, -448, -448, -448, -448, -448,  596,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448\n    },\n\n    {\n       55, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449,  597, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449\n\n    },\n\n    {\n       55, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450,  598,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450\n    },\n\n    {\n       55, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451,  599, -451, -451, -451, -451,\n\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451\n    },\n\n    {\n       55, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452,  600, -452, -452, -452, -452, -452, -452, -452,\n\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452\n    },\n\n    {\n       55, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453,  601, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453\n    },\n\n    {\n       55, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n\n      602, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454\n    },\n\n    {\n       55, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455,  603, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455,  604, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455\n    },\n\n    {\n       55, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n      605, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456,  606, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n\n     -456, -456, -456, -456, -456, -456, -456, -456\n    },\n\n    {\n       55, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n\n     -457, -457, -457, -457, -457,  607, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457\n    },\n\n    {\n       55, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458,  608, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458\n    },\n\n    {\n       55, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459,  609,\n     -459, -459, -459,  610, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459\n\n    },\n\n    {\n       55, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n      611, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460\n    },\n\n    {\n       55, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461,  612, -461,\n\n     -461, -461, -461, -461, -461, -461, -461, -461, -461,  613,\n      614, -461, -461,  615, -461,  616, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461\n    },\n\n    {\n       55, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462,  617, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462\n    },\n\n    {\n       55, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463,  618,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463\n    },\n\n    {\n       55, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464,  619, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n\n      620, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464\n    },\n\n    {\n       55, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465,  621, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465\n    },\n\n    {\n       55, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n      622, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n\n     -466, -466, -466, -466, -466, -466, -466, -466\n    },\n\n    {\n       55, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467,  623, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467\n    },\n\n    {\n       55, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468,  624, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468\n    },\n\n    {\n       55, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469,  625,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469\n\n    },\n\n    {\n       55, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470,  626, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470\n    },\n\n    {\n       55, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471,  627, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471\n    },\n\n    {\n       55, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472,  628, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472\n    },\n\n    {\n       55, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473,  629, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473\n    },\n\n    {\n       55, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474,  630,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474\n    },\n\n    {\n       55, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475,  631, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475\n    },\n\n    {\n       55, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476,  632,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n\n     -476, -476, -476, -476, -476, -476, -476, -476\n    },\n\n    {\n       55, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477,  633, -477, -477, -477, -477, -477, -477, -477,\n\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477\n    },\n\n    {\n       55, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478,  634, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478\n    },\n\n    {\n       55, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n\n     -479, -479,  635, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479\n\n    },\n\n    {\n       55, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480,  636, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480\n    },\n\n    {\n       55, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481,  637, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481,  638,  639,\n      639,  639,  639,  639,  639,  639,  639,  639, -481, -481,\n     -481, -481, -481, -481, -481,  637,  637,  637,  637,  637,\n\n      637,  637,  637,  637,  637,  637,  637,  637,  637,  637,\n      637,  637,  637,  637,  637,  637,  637,  637,  637,  637,\n      637, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481\n    },\n\n    {\n       55, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482,  640, -482, -482, -482, -482, -482, -482, -482,\n\n     -482, -482, -482, -482, -482, -482, -482, -482,  638,  639,\n      639,  639,  639,  639,  639,  639,  639,  639, -482, -482,\n     -482, -482, -482, -482, -482,  640,  640,  640,  640,  640,\n      640,  640,  640,  640,  640,  640,  640,  640,  640,  640,\n      640,  640,  640,  640,  640,  640,  640,  640,  640,  640,\n      640, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482\n    },\n\n    {\n       55, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483,  641, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483\n    },\n\n    {\n       55, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484,  642, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484\n    },\n\n    {\n       55, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485,  643, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485\n    },\n\n    {\n       55, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486,  644, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n\n     -486, -486, -486, -486, -486, -486, -486, -486\n    },\n\n    {\n       55, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487,  637, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487,  645,  645,\n      645,  645,  645,  645,  645,  645,  645,  645, -487, -487,\n     -487, -487, -487, -487, -487,  637,  637,  637,  637,  637,\n      637,  637,  637,  637,  637,  637,  637,  637,  637,  637,\n      637,  637,  637,  637,  637,  637,  637,  637,  637,  637,\n\n      637, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487\n    },\n\n    {\n       55, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488,  646, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488\n    },\n\n    {\n       55, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n\n     -489, -489,  647, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489,  648,  648,\n      648,  648,  648,  648,  648,  648,  648,  648, -489, -489,\n     -489, -489, -489, -489, -489,  647,  647,  647,  647,  647,\n      647,  647,  647,  647,  647,  647,  647,  647,  647,  647,\n      647,  647,  647,  647,  647,  647,  647,  647,  647,  647,\n      647, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489\n\n    },\n\n    {\n       55, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490,  649, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490,  650,  650,\n      650,  650,  650,  650,  650,  650,  650,  650, -490, -490,\n     -490, -490, -490, -490, -490,  649,  649,  649,  649,  649,\n      649,  649,  649,  649,  649,  649,  649,  649,  649,  649,\n      649,  649,  649,  649,  649,  649,  649,  649,  649,  649,\n      649, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490\n    },\n\n    {\n       55, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491,  651,  651,\n      651,  651,  651,  651,  651,  651,  651,  651, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491\n    },\n\n    {\n       55, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n\n     -492, -492, -492, -492, -492,  652, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492,  653, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492\n    },\n\n    {\n       55, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493,  652, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493,  654, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493\n    },\n\n    {\n       55, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494,  655,  655,\n      655,  655,  655,  655,  655,  655,  655,  655, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494\n    },\n\n    {\n       55, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495,  652, -495, -495,  656,  656,\n\n      656,  656,  656,  656,  656,  656,  656,  656, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495,  657, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495\n    },\n\n    {\n       55, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496,  658,  659,\n      659,  659,  659,  659,  659,  659,  659,  659, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n\n     -496, -496, -496, -496, -496, -496, -496, -496\n    },\n\n    {\n       55, -497, -497, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497, -497, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497, -497, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497,  660, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497, -497, -497, -497, -497, -497, -497,  661,  661,\n      661,  661,  661,  661,  661,  661,  661,  661, -497, -497,\n     -497, -497, -497, -497, -497,  660,  660,  660,  660,  660,\n      660,  660,  660,  660,  660,  660,  660,  660,  660,  660,\n      660,  660,  660,  660,  660,  660,  660,  660,  660,  660,\n\n      660, -497, -497, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497, -497, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497, -497, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497, -497, -497, -497, -497, -497, -497\n    },\n\n    {\n       55, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498,  662,  663,\n      663,  663,  663,  663,  663,  663,  663,  663, -498, -498,\n\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498\n    },\n\n    {\n       55, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499,  652, -499, -499,  656,  656,\n      656,  656,  656,  656,  656,  656,  656,  656, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499,  653, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499\n\n    },\n\n    {\n       55, -500, -500, -500, -500, -500, -500, -500, -500, -500,\n     -500, -500, -500, -500, -500, -500, -500, -500, -500, -500,\n     -500, -500, -500, -500, -500, -500, -500, -500, -500, -500,\n     -500, -500,  660, -500, -500, -500, -500, -500, -500, -500,\n     -500, -500, -500, -500, -500, -500, -500, -500,  664,  665,\n      665,  665,  665,  665,  665,  665,  665,  665, -500, -500,\n     -500, -500, -500, -500, -500,  660,  660,  660,  660,  660,\n      660,  660,  660,  660,  660,  660,  660,  660,  660,  660,\n      660,  660,  660,  660,  660,  660,  660,  660,  660,  660,\n      660, -500, -500, -500, -500, -500, -500, -500, -500, -500,\n\n     -500, -500, -500, -500, -500, -500, -500, -500, -500, -500,\n     -500, -500, -500, -500, -500, -500, -500, -500, -500, -500,\n     -500, -500, -500, -500, -500, -500, -500, -500\n    },\n\n    {\n       55, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501,  666, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501, -501, -501, -501, -501, -501, -501,  667,  667,\n      667,  667,  667,  667,  667,  667,  667,  667, -501, -501,\n     -501, -501, -501, -501, -501,  666,  666,  666,  666,  666,\n\n      666,  666,  666,  666,  666,  666,  666,  666,  666,  666,\n      666,  666,  666,  666,  666,  666,  666,  666,  666,  666,\n      666, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501, -501, -501, -501, -501, -501, -501\n    },\n\n    {\n       55, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502,  668, -502, -502, -502, -502, -502, -502, -502,\n\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502\n    },\n\n    {\n       55, -503, -503, -503, -503, -503, -503, -503, -503, -503,\n\n     -503, -503, -503, -503, -503, -503, -503, -503, -503, -503,\n     -503, -503, -503, -503, -503, -503, -503, -503, -503, -503,\n     -503, -503,  669, -503, -503, -503, -503, -503, -503, -503,\n     -503, -503, -503, -503, -503, -503, -503, -503,  670,  670,\n      670,  670,  670,  670,  670,  670,  670,  670, -503, -503,\n     -503, -503, -503, -503, -503,  669,  669,  669,  669,  669,\n      669,  669,  669,  669,  669,  669,  669,  669,  669,  669,\n      669,  669,  669,  669,  669,  669,  669,  669,  669,  669,\n      669, -503, -503, -503, -503, -503, -503, -503, -503, -503,\n     -503, -503, -503, -503, -503, -503, -503, -503, -503, -503,\n\n     -503, -503, -503, -503, -503, -503, -503, -503, -503, -503,\n     -503, -503, -503, -503, -503, -503, -503, -503\n    },\n\n    {\n       55, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504,  660, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504,  671,  672,\n      672,  672,  672,  672,  672,  672,  672,  672, -504, -504,\n     -504, -504, -504, -504, -504,  660,  660,  660,  660,  660,\n      660,  660,  660,  660,  660,  660,  660,  660,  660,  660,\n\n      660,  660,  660,  660,  660,  660,  660,  660,  660,  660,\n      660, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504\n    },\n\n    {\n       55, -505, -505, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505, -505, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505, -505, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505,  673, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505, -505, -505, -505, -505, -505, -505,  674,  674,\n\n      674,  674,  674,  674,  674,  674,  674,  674, -505, -505,\n     -505, -505, -505, -505, -505,  673,  673,  673,  673,  673,\n      673,  673,  673,  673,  673,  673,  673,  673,  673,  673,\n      673,  673,  673,  673,  673,  673,  673,  673,  673,  673,\n      673, -505, -505, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505, -505, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505, -505, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505, -505, -505, -505, -505, -505, -505\n    },\n\n    {\n       55, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506,  669, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506,  675,  676,\n      676,  676,  676,  676,  676,  676,  676,  676, -506, -506,\n     -506, -506, -506, -506, -506,  669,  669,  669,  669,  669,\n      669,  669,  669,  669,  669,  669,  669,  669,  669,  669,\n      669,  669,  669,  669,  669,  669,  669,  669,  669,  669,\n      669, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n\n     -506, -506, -506, -506, -506, -506, -506, -506\n    },\n\n    {\n       55, -507, -507, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507, -507, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507, -507, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507,  677, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507, -507, -507, -507, -507, -507, -507,  678,  678,\n      678,  678,  678,  678,  678,  678,  678,  678, -507, -507,\n     -507, -507, -507, -507, -507,  677,  677,  677,  677,  677,\n      677,  677,  677,  677,  677,  677,  677,  677,  677,  677,\n      677,  677,  677,  677,  677,  677,  677,  677,  677,  677,\n\n      677, -507, -507, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507, -507, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507, -507, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507, -507, -507, -507, -507, -507, -507\n    },\n\n    {\n       55, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508,  679, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508\n    },\n\n    {\n       55, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n\n     -509, -509,  680, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509,  670,  670,\n      670,  670,  670,  670,  670,  670,  670,  670, -509, -509,\n     -509, -509, -509, -509, -509,  680,  680,  680,  680,  680,\n      680,  680,  680,  680,  680,  680,  680,  680,  680,  680,\n      680,  680,  680,  680,  680,  680,  680,  680,  680,  680,\n      680, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509\n\n    },\n\n    {\n       55, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510,  681, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510\n    },\n\n    {\n       55, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511,  682, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511,  683,  683,\n      683,  683,  683,  683,  683,  683,  683,  683, -511, -511,\n     -511, -511, -511, -511, -511,  682,  682,  682,  682,  682,\n\n      682,  682,  682,  682,  682,  682,  682,  682,  682,  682,\n      682,  682,  682,  682,  682,  682,  682,  682,  682,  682,\n      682, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511\n    },\n\n    {\n       55, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512,  684, -512, -512, -512, -512, -512, -512, -512,\n\n     -512, -512, -512, -512, -512, -512, -512, -512,  685,  685,\n      685,  685,  685,  685,  685,  685,  685,  685, -512, -512,\n     -512, -512, -512, -512, -512,  684,  684,  684,  684,  684,\n      684,  684,  684,  684,  684,  684,  684,  684,  684,  684,\n      684,  684,  684,  684,  684,  684,  684,  684,  684,  684,\n      684, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512\n    },\n\n    {\n       55, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513,  686,  686,\n      686,  686,  686,  686,  686,  686,  686,  686, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513\n    },\n\n    {\n       55, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514,  687, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514,  688, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514\n    },\n\n    {\n       55, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515,  687, -515, -515, -515, -515,\n\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515,  689, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515\n    },\n\n    {\n       55, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516,  690,  690,\n      690,  690,  690,  690,  690,  690,  690,  690, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n\n     -516, -516, -516, -516, -516, -516, -516, -516\n    },\n\n    {\n       55, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517,  687, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n\n     -517, -517, -517, -517, -517,  691, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517\n    },\n\n    {\n       55, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518,  692,  693,\n      693,  693,  693,  693,  693,  693,  693,  693, -518, -518,\n\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518\n    },\n\n    {\n       55, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n\n     -519, -519,  694, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519,  695,  695,\n      695,  695,  695,  695,  695,  695,  695,  695, -519, -519,\n     -519, -519, -519, -519, -519,  694,  694,  694,  694,  694,\n      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,\n      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,\n      694, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519\n\n    },\n\n    {\n       55, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520,  696,  697,\n      697,  697,  697,  697,  697,  697,  697,  697, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520\n    },\n\n    {\n       55, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521,  698, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521,  699,  700,\n      700,  700,  700,  700,  700,  700,  700,  700, -521, -521,\n     -521, -521, -521, -521, -521,  698,  698,  698,  698,  698,\n\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521\n    },\n\n    {\n       55, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522,  698, -522, -522, -522, -522, -522, -522, -522,\n\n     -522, -522, -522, -522, -522, -522, -522, -522,  701,  701,\n      701,  701,  701,  701,  701,  701,  701,  701, -522, -522,\n     -522, -522, -522, -522, -522,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522\n    },\n\n    {\n       55, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523,  702, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523\n    },\n\n    {\n       55, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524,  703, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524,  704,  704,\n      704,  704,  704,  704,  704,  704,  704,  704, -524, -524,\n     -524, -524, -524, -524, -524,  703,  703,  703,  703,  703,\n      703,  703,  703,  703,  703,  703,  703,  703,  703,  703,\n\n      703,  703,  703,  703,  703,  703,  703,  703,  703,  703,\n      703, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524\n    },\n\n    {\n       55, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525,  705, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525,  706,  707,\n\n      707,  707,  707,  707,  707,  707,  707,  707, -525, -525,\n     -525, -525, -525, -525, -525,  705,  705,  705,  705,  705,\n      705,  705,  705,  705,  705,  705,  705,  705,  705,  705,\n      705,  705,  705,  705,  705,  705,  705,  705,  705,  705,\n      705, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525\n    },\n\n    {\n       55, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526,  705, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526,  708,  708,\n      708,  708,  708,  708,  708,  708,  708,  708, -526, -526,\n     -526, -526, -526, -526, -526,  705,  705,  705,  705,  705,\n      705,  705,  705,  705,  705,  705,  705,  705,  705,  705,\n      705,  705,  705,  705,  705,  705,  705,  705,  705,  705,\n      705, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n\n     -526, -526, -526, -526, -526, -526, -526, -526\n    },\n\n    {\n       55, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527,  709, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527\n    },\n\n    {\n       55, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528,  710, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528,  711,  712,\n      712,  712,  712,  712,  712,  712,  712,  712, -528, -528,\n\n     -528, -528, -528, -528, -528,  710,  710,  710,  710,  710,\n      710,  710,  710,  710,  710,  710,  710,  710,  710,  710,\n      710,  710,  710,  710,  710,  710,  710,  710,  710,  710,\n      710, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528\n    },\n\n    {\n       55, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n\n     -529, -529,  710, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529,  713,  713,\n      713,  713,  713,  713,  713,  713,  713,  713, -529, -529,\n     -529, -529, -529, -529, -529,  710,  710,  710,  710,  710,\n      710,  710,  710,  710,  710,  710,  710,  710,  710,  710,\n      710,  710,  710,  710,  710,  710,  710,  710,  710,  710,\n      710, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529\n\n    },\n\n    {\n       55, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530,  714, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530,  704,  704,\n      704,  704,  704,  704,  704,  704,  704,  704, -530, -530,\n     -530, -530, -530, -530, -530,  714,  714,  714,  714,  714,\n      714,  714,  714,  714,  714,  714,  714,  714,  714,  714,\n      714,  714,  714,  714,  714,  714,  714,  714,  714,  714,\n      714, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530\n    },\n\n    {\n       55, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531,  715, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531\n    },\n\n    {\n       55, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532,  716, -532, -532, -532, -532, -532, -532, -532,\n\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532\n    },\n\n    {\n       55, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533\n    },\n\n    {\n       55, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534\n    },\n\n    {\n       55,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  536,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535,  535,  535,\n      535,  535,  535,  535,  535,  535,  535,  535\n    },\n\n    {\n       55, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536,  535,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n\n     -536, -536, -536, -536, -536, -536, -536, -536\n    },\n\n    {\n       55, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537\n    },\n\n    {\n       55,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      537,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  538,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  539,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391\n    },\n\n    {\n       55,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      718,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n\n      717,  717,  719,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  720,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717\n\n    },\n\n    {\n       55,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      541,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  542,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  543,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540\n    },\n\n    {\n       55, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541\n    },\n\n    {\n       55,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      541,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  542,  540,  540,  540,  540,  540,  540,  540,\n\n      540,  540,  540,  540,  540,  540,  540,  543,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540\n    },\n\n    {\n       55,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n\n      541,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  542,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  543,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n\n      540,  540,  540,  540,  540,  540,  540,  540,  540,  540,\n      540,  540,  540,  540,  540,  540,  540,  540\n    },\n\n    {\n       55,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      545,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  546,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  547,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544\n    },\n\n    {\n       55, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545\n    },\n\n    {\n       55,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      545,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  546,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  547,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n\n      544,  544,  544,  544,  544,  544,  544,  544\n    },\n\n    {\n       55,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      545,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  546,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  547,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544,  544,  544,\n      544,  544,  544,  544,  544,  544,  544,  544\n    },\n\n    {\n       55, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n\n     -548, -548, -548, -548, -548, -548, -548, -548,  721, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548\n    },\n\n    {\n       55, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549,  722, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549\n\n    },\n\n    {\n       55, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550,  723,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550\n    },\n\n    {\n       55, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n\n     -551, -551,  724, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551\n    },\n\n    {\n       55, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552,  725, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552\n    },\n\n    {\n       55, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553,  726, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553\n    },\n\n    {\n       55, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554,  727,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554\n    },\n\n    {\n       55, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555\n    },\n\n    {\n       55, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n\n     -556, -556, -556, -556, -556, -556, -556, -556\n    },\n\n    {\n       55, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557,  728,\n      729, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557\n    },\n\n    {\n       55, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558\n    },\n\n    {\n       55, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559\n\n    },\n\n    {\n       55, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560\n    },\n\n    {\n       55, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561\n    },\n\n    {\n       55, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562\n    },\n\n    {\n       55, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563\n    },\n\n    {\n       55, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564,  730,\n\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564\n    },\n\n    {\n       55, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565,  731,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565\n    },\n\n    {\n       55, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n\n     -566, -566, -566, -566, -566, -566, -566, -566\n    },\n\n    {\n       55, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567\n    },\n\n    {\n       55, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568\n    },\n\n    {\n       55, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569\n\n    },\n\n    {\n       55, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570\n    },\n\n    {\n       55, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571\n    },\n\n    {\n       55, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572\n    },\n\n    {\n       55, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573,  732,  733, -573, -573,  734,\n     -573, -573, -573, -573, -573, -573, -573, -573, -573,  735,\n     -573, -573,  736, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573\n    },\n\n    {\n       55, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574,  737,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574\n    },\n\n    {\n       55, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575,  738,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575\n    },\n\n    {\n       55, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n\n     -576, -576, -576, -576, -576, -576, -576, -576\n    },\n\n    {\n       55, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577,  739, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577\n    },\n\n    {\n       55, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578,  740, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n\n     -578, -578, -578, -578, -578,  740,  740,  740,  740,  740,\n      740,  740,  740,  740,  740,  740,  740,  740,  740,  740,\n      740,  740,  740,  740,  740,  740,  740,  740,  740,  740,\n      740, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578\n    },\n\n    {\n       55, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579,  741,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579\n\n    },\n\n    {\n       55, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580,  742,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580\n    },\n\n    {\n       55, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n\n     -581, -581, -581, -581, -581, -581, -581, -581, -581,  743,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581\n    },\n\n    {\n       55, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n      744, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582\n    },\n\n    {\n       55, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n     -583, -583,  745, -583, -583, -583, -583, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n      746, -583, -583,  747, -583, -583, -583, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583, -583, -583\n    },\n\n    {\n       55, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584,  748, -584, -584, -584, -584, -584, -584, -584,\n\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584\n    },\n\n    {\n       55, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585,  749, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585\n    },\n\n    {\n       55, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586,  750, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n\n     -586, -586, -586, -586, -586, -586, -586, -586\n    },\n\n    {\n       55, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587,  751, -587, -587, -587,\n\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587\n    },\n\n    {\n       55, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n\n     -588, -588, -588, -588, -588, -588, -588, -588, -588,  752,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588\n    },\n\n    {\n       55, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589,  753, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589\n\n    },\n\n    {\n       55, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590,  754, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590\n    },\n\n    {\n       55, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591,  755,\n\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591\n    },\n\n    {\n       55, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n      756, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592\n    },\n\n    {\n       55, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593,  757, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593\n    },\n\n    {\n       55, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594,  758,\n\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594\n    },\n\n    {\n       55, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595,  759, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595\n    },\n\n    {\n       55, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596,  760, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n\n     -596, -596, -596, -596, -596, -596, -596, -596\n    },\n\n    {\n       55, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597,  761,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597\n    },\n\n    {\n       55, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n\n     -598, -598, -598, -598, -598, -598, -598,  762, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598\n    },\n\n    {\n       55, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599,  763, -599, -599, -599, -599,  764, -599, -599,\n     -599, -599, -599,  765, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599\n\n    },\n\n    {\n       55, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600,  766, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600\n    },\n\n    {\n       55, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601,  767, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601\n    },\n\n    {\n       55, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602\n    },\n\n    {\n       55, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603,  768, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603\n    },\n\n    {\n       55, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n\n     -604, -604, -604, -604, -604, -604, -604, -604, -604,  769,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604\n    },\n\n    {\n       55, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605,  770, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605\n    },\n\n    {\n       55, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606,  771, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n\n     -606, -606, -606, -606, -606, -606, -606, -606\n    },\n\n    {\n       55, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607,  772, -607, -607, -607, -607, -607, -607, -607,\n\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607\n    },\n\n    {\n       55, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608,  773,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608\n    },\n\n    {\n       55, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609,  774, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609\n\n    },\n\n    {\n       55, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610,  775, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610\n    },\n\n    {\n       55, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611,  776, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611\n    },\n\n    {\n       55, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612,  777,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612\n    },\n\n    {\n       55, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n\n     -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n     -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n     -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n     -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n     -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n     -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n      778, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n     -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n     -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n     -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n\n     -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n     -613, -613, -613, -613, -613, -613, -613, -613\n    },\n\n    {\n       55, -614, -614, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614,  779, -614, -614, -614, -614, -614, -614,\n\n     -614, -614, -614, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614, -614, -614, -614, -614, -614\n    },\n\n    {\n       55, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615,  780,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615\n    },\n\n    {\n       55, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n     -616, -616, -616, -616, -616, -616, -616, -616,  781, -616,\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n\n     -616, -616, -616, -616, -616, -616, -616, -616\n    },\n\n    {\n       55, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617,  782,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617\n    },\n\n    {\n       55, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n\n     -618, -618, -618, -618, -618, -618, -618, -618, -618,  783,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618\n    },\n\n    {\n       55, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619,  784, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619\n\n    },\n\n    {\n       55, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620,  785,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620\n    },\n\n    {\n       55, -621, -621, -621, -621, -621, -621, -621, -621, -621,\n     -621, -621, -621, -621, -621, -621, -621, -621, -621, -621,\n     -621, -621, -621, -621, -621, -621, -621, -621, -621, -621,\n     -621, -621, -621, -621, -621, -621, -621, -621, -621, -621,\n     -621, -621, -621, -621, -621, -621, -621, -621, -621, -621,\n     -621, -621, -621, -621, -621, -621, -621, -621, -621, -621,\n     -621, -621, -621, -621, -621, -621, -621, -621, -621, -621,\n\n     -621, -621, -621, -621, -621, -621, -621, -621, -621, -621,\n     -621, -621, -621, -621,  786, -621, -621, -621, -621, -621,\n     -621, -621, -621, -621, -621, -621, -621, -621, -621, -621,\n     -621, -621, -621, -621, -621, -621, -621, -621, -621, -621,\n     -621, -621, -621, -621, -621, -621, -621, -621, -621, -621,\n     -621, -621, -621, -621, -621, -621, -621, -621\n    },\n\n    {\n       55, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622,  787, -622, -622, -622, -622, -622, -622, -622,\n\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622\n    },\n\n    {\n       55, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n\n     -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n     -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n     -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n     -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n     -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n     -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n     -623,  788, -623, -623, -623, -623, -623, -623, -623, -623,\n     -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n     -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n     -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n\n     -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n     -623, -623, -623, -623, -623, -623, -623, -623\n    },\n\n    {\n       55, -624, -624, -624, -624, -624, -624, -624, -624, -624,\n     -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,\n     -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,\n     -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,\n     -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,\n     -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,\n     -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,\n     -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,\n\n     -624, -624, -624, -624, -624, -624, -624, -624, -624,  789,\n     -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,\n     -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,\n     -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,\n     -624, -624, -624, -624, -624, -624, -624, -624\n    },\n\n    {\n       55, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n      790, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625\n    },\n\n    {\n       55, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n     -626, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n\n     -626, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n     -626, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n     -626, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n     -626, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n     -626, -626, -626, -626, -626, -626, -626,  791, -626, -626,\n     -626, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n     -626, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n     -626, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n     -626, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n     -626, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n\n     -626, -626, -626, -626, -626, -626, -626, -626\n    },\n\n    {\n       55, -627, -627, -627, -627, -627, -627, -627, -627, -627,\n     -627, -627, -627, -627, -627, -627, -627, -627, -627, -627,\n     -627, -627, -627, -627, -627, -627, -627, -627, -627, -627,\n     -627, -627, -627, -627, -627, -627, -627, -627, -627, -627,\n     -627, -627, -627, -627, -627, -627, -627, -627,  792,  792,\n      792,  792,  792,  792,  792,  792,  792,  792, -627, -627,\n     -627, -627, -627, -627, -627, -627, -627, -627, -627, -627,\n     -627, -627, -627, -627, -627, -627, -627, -627, -627, -627,\n     -627, -627, -627, -627, -627, -627, -627, -627, -627, -627,\n\n     -627, -627, -627, -627, -627, -627, -627, -627, -627, -627,\n     -627, -627, -627, -627, -627, -627, -627, -627, -627, -627,\n     -627, -627, -627, -627, -627, -627, -627, -627, -627, -627,\n     -627, -627, -627, -627, -627, -627, -627, -627\n    },\n\n    {\n       55, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n\n     -628, -628, -628, -628, -628, -628, -628, -628, -628,  793,\n     -628, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628, -628, -628, -628, -628, -628, -628\n    },\n\n    {\n       55, -629, -629, -629, -629, -629, -629, -629, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629, -629, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629, -629, -629, -629,\n\n     -629, -629, -629, -629, -629, -629, -629, -629, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629, -629, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629, -629, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629, -629, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629,  794, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629, -629, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629, -629, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629, -629, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629, -629, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629, -629\n\n    },\n\n    {\n       55, -630, -630, -630, -630, -630, -630, -630, -630, -630,\n     -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,\n     -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,\n     -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,\n     -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,\n     -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,\n     -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,\n     -630, -630, -630, -630, -630, -630,  795, -630, -630, -630,\n     -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,\n     -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,\n\n     -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,\n     -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,\n     -630, -630, -630, -630, -630, -630, -630, -630\n    },\n\n    {\n       55, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631,  796, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631\n    },\n\n    {\n       55, -632, -632, -632, -632, -632, -632, -632, -632, -632,\n     -632, -632, -632, -632, -632, -632, -632, -632, -632, -632,\n     -632, -632, -632, -632, -632, -632, -632, -632, -632, -632,\n     -632, -632, -632, -632, -632, -632, -632, -632, -632, -632,\n\n     -632, -632, -632, -632, -632, -632, -632, -632, -632, -632,\n     -632, -632, -632, -632, -632, -632, -632, -632, -632, -632,\n     -632, -632, -632, -632, -632, -632, -632, -632, -632, -632,\n     -632, -632, -632, -632, -632, -632,  797, -632, -632, -632,\n     -632, -632, -632, -632, -632, -632, -632, -632, -632, -632,\n     -632, -632, -632, -632, -632, -632, -632, -632, -632, -632,\n     -632, -632, -632, -632, -632, -632, -632, -632, -632, -632,\n     -632, -632, -632, -632, -632, -632, -632, -632, -632, -632,\n     -632, -632, -632, -632, -632, -632, -632, -632\n    },\n\n    {\n       55, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633,  798, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633\n    },\n\n    {\n       55, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634,  799, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634\n    },\n\n    {\n       55, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635,  800, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635\n    },\n\n    {\n       55, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636,  801, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n\n     -636, -636, -636, -636, -636, -636, -636, -636\n    },\n\n    {\n       55, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637,  802, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637\n    },\n\n    {\n       55, -638, -638, -638, -638, -638, -638, -638, -638, -638,\n     -638, -638, -638, -638, -638, -638, -638, -638, -638, -638,\n     -638, -638, -638, -638, -638, -638, -638, -638, -638, -638,\n     -638, -638,  803, -638, -638, -638, -638, -638, -638, -638,\n     -638, -638, -638, -638, -638, -638, -638, -638,  804,  805,\n      805,  805,  805,  805,  805,  805,  805,  805, -638, -638,\n\n     -638, -638, -638, -638, -638,  803,  803,  803,  803,  803,\n      803,  803,  803,  803,  803,  803,  803,  803,  803,  803,\n      803,  803,  803,  803,  803,  803,  803,  803,  803,  803,\n      803, -638, -638, -638, -638, -638, -638, -638, -638, -638,\n     -638, -638, -638, -638, -638, -638, -638, -638, -638, -638,\n     -638, -638, -638, -638, -638, -638, -638, -638, -638, -638,\n     -638, -638, -638, -638, -638, -638, -638, -638\n    },\n\n    {\n       55, -639, -639, -639, -639, -639, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639, -639, -639,\n\n     -639, -639,  806, -639, -639, -639, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639,  804,  805,\n      805,  805,  805,  805,  805,  805,  805,  805, -639, -639,\n     -639, -639, -639, -639, -639,  806,  806,  806,  806,  806,\n      806,  806,  806,  806,  806,  806,  806,  806,  806,  806,\n      806,  806,  806,  806,  806,  806,  806,  806,  806,  806,\n      806, -639, -639, -639, -639, -639, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639\n\n    },\n\n    {\n       55, -640, -640, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640, -640, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640, -640, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640,  807, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640, -640, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640, -640, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640, -640, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640, -640, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640, -640, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640, -640, -640, -640, -640, -640, -640, -640, -640,\n\n     -640, -640, -640, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640, -640, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640, -640, -640, -640, -640, -640, -640\n    },\n\n    {\n       55, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641,  808, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641\n    },\n\n    {\n       55, -642, -642, -642, -642, -642, -642, -642, -642, -642,\n     -642, -642, -642, -642, -642, -642, -642, -642, -642, -642,\n     -642, -642, -642, -642, -642, -642, -642, -642, -642, -642,\n     -642, -642,  809, -642, -642, -642, -642, -642, -642, -642,\n\n     -642, -642, -642, -642, -642, -642, -642, -642, -642, -642,\n     -642, -642, -642, -642, -642, -642, -642, -642, -642, -642,\n     -642, -642, -642, -642, -642, -642, -642, -642, -642, -642,\n     -642, -642, -642, -642, -642, -642, -642, -642, -642, -642,\n     -642, -642, -642, -642, -642, -642, -642, -642, -642, -642,\n     -642, -642, -642, -642, -642, -642, -642, -642, -642, -642,\n     -642, -642, -642, -642, -642, -642, -642, -642, -642, -642,\n     -642, -642, -642, -642, -642, -642, -642, -642, -642, -642,\n     -642, -642, -642, -642, -642, -642, -642, -642\n    },\n\n    {\n       55, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643,  810, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643\n    },\n\n    {\n       55, -644, -644, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644, -644, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644, -644, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644,  811, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644, -644, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644, -644, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644, -644, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644, -644, -644, -644, -644, -644, -644, -644, -644,\n\n     -644, -644, -644, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644, -644, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644, -644, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644, -644, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644, -644, -644, -644, -644, -644, -644\n    },\n\n    {\n       55, -645, -645, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645, -645, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645, -645, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645,  803, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645, -645, -645, -645, -645, -645, -645,  804,  804,\n\n      804,  804,  804,  804,  804,  804,  804,  804, -645, -645,\n     -645, -645, -645, -645, -645,  803,  803,  803,  803,  803,\n      803,  803,  803,  803,  803,  803,  803,  803,  803,  803,\n      803,  803,  803,  803,  803,  803,  803,  803,  803,  803,\n      803, -645, -645, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645, -645, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645, -645, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645, -645, -645, -645, -645, -645, -645\n    },\n\n    {\n       55, -646, -646, -646, -646, -646, -646, -646, -646, -646,\n     -646, -646, -646, -646, -646, -646, -646, -646, -646, -646,\n\n     -646, -646, -646, -646, -646, -646, -646, -646, -646, -646,\n     -646, -646,  812, -646, -646, -646, -646, -646, -646, -646,\n     -646, -646, -646, -646, -646, -646, -646, -646, -646, -646,\n     -646, -646, -646, -646, -646, -646, -646, -646, -646, -646,\n     -646, -646, -646, -646, -646, -646, -646, -646, -646, -646,\n     -646, -646, -646, -646, -646, -646, -646, -646, -646, -646,\n     -646, -646, -646, -646, -646, -646, -646, -646, -646, -646,\n     -646, -646, -646, -646, -646, -646, -646, -646, -646, -646,\n     -646, -646, -646, -646, -646, -646, -646, -646, -646, -646,\n     -646, -646, -646, -646, -646, -646, -646, -646, -646, -646,\n\n     -646, -646, -646, -646, -646, -646, -646, -646\n    },\n\n    {\n       55, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647,  813, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n\n     -647, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647, -647, -647, -647, -647, -647, -647\n    },\n\n    {\n       55, -648, -648, -648, -648, -648, -648, -648, -648, -648,\n     -648, -648, -648, -648, -648, -648, -648, -648, -648, -648,\n     -648, -648, -648, -648, -648, -648, -648, -648, -648, -648,\n     -648, -648,  814, -648, -648, -648, -648, -648, -648, -648,\n     -648, -648, -648, -648, -648, -648, -648, -648,  815,  815,\n      815,  815,  815,  815,  815,  815,  815,  815, -648, -648,\n\n     -648, -648, -648, -648, -648,  814,  814,  814,  814,  814,\n      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,\n      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,\n      814, -648, -648, -648, -648, -648, -648, -648, -648, -648,\n     -648, -648, -648, -648, -648, -648, -648, -648, -648, -648,\n     -648, -648, -648, -648, -648, -648, -648, -648, -648, -648,\n     -648, -648, -648, -648, -648, -648, -648, -648\n    },\n\n    {\n       55, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n\n     -649, -649,  816, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649\n\n    },\n\n    {\n       55, -650, -650, -650, -650, -650, -650, -650, -650, -650,\n     -650, -650, -650, -650, -650, -650, -650, -650, -650, -650,\n     -650, -650, -650, -650, -650, -650, -650, -650, -650, -650,\n     -650, -650,  817, -650, -650, -650, -650, -650, -650, -650,\n     -650, -650, -650, -650, -650, -650, -650, -650,  818,  818,\n      818,  818,  818,  818,  818,  818,  818,  818, -650, -650,\n     -650, -650, -650, -650, -650,  817,  817,  817,  817,  817,\n      817,  817,  817,  817,  817,  817,  817,  817,  817,  817,\n      817,  817,  817,  817,  817,  817,  817,  817,  817,  817,\n      817, -650, -650, -650, -650, -650, -650, -650, -650, -650,\n\n     -650, -650, -650, -650, -650, -650, -650, -650, -650, -650,\n     -650, -650, -650, -650, -650, -650, -650, -650, -650, -650,\n     -650, -650, -650, -650, -650, -650, -650, -650\n    },\n\n    {\n       55, -651, -651, -651, -651, -651, -651, -651, -651, -651,\n     -651, -651, -651, -651, -651, -651, -651, -651, -651, -651,\n     -651, -651, -651, -651, -651, -651, -651, -651, -651, -651,\n     -651, -651,  819, -651, -651, -651, -651, -651, -651, -651,\n     -651, -651, -651, -651, -651, -651, -651, -651,  820,  820,\n      820,  820,  820,  820,  820,  820,  820,  820, -651, -651,\n     -651, -651, -651, -651, -651,  819,  819,  819,  819,  819,\n\n      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,\n      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,\n      819, -651, -651, -651, -651, -651, -651, -651, -651, -651,\n     -651, -651, -651, -651, -651, -651, -651, -651, -651, -651,\n     -651, -651, -651, -651, -651, -651, -651, -651, -651, -651,\n     -651, -651, -651, -651, -651, -651, -651, -651\n    },\n\n    {\n       55, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n\n     -652, -652, -652, -652, -652, -652, -652, -652,  821,  821,\n      821,  821,  821,  821,  821,  821,  821,  821, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652\n    },\n\n    {\n       55, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653,  822,  822,\n      822,  822,  822,  822,  822,  822,  822,  822, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653\n    },\n\n    {\n       55, -654, -654, -654, -654, -654, -654, -654, -654, -654,\n     -654, -654, -654, -654, -654, -654, -654, -654, -654, -654,\n     -654, -654, -654, -654, -654, -654, -654, -654, -654, -654,\n     -654, -654, -654, -654, -654, -654, -654, -654, -654, -654,\n     -654, -654, -654, -654, -654, -654, -654, -654,  822,  823,\n      823,  823,  823,  823,  823,  823,  823,  823, -654, -654,\n     -654, -654, -654, -654, -654, -654, -654, -654, -654, -654,\n     -654, -654, -654, -654, -654, -654, -654, -654, -654, -654,\n\n     -654, -654, -654, -654, -654, -654, -654, -654, -654, -654,\n     -654, -654, -654, -654, -654, -654, -654, -654, -654, -654,\n     -654, -654, -654, -654, -654, -654, -654, -654, -654, -654,\n     -654, -654, -654, -654, -654, -654, -654, -654, -654, -654,\n     -654, -654, -654, -654, -654, -654, -654, -654\n    },\n\n    {\n       55, -655, -655, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655,  824, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655, -655,  825,  825,\n\n      825,  825,  825,  825,  825,  825,  825,  825, -655, -655,\n     -655, -655, -655, -655, -655,  824,  824,  824,  824,  824,\n      824,  824,  824,  824,  824,  824,  824,  824,  824,  824,\n      824,  824,  824,  824,  824,  824,  824,  824,  824,  824,\n      824, -655, -655, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655, -655\n    },\n\n    {\n       55, -656, -656, -656, -656, -656, -656, -656, -656, -656,\n     -656, -656, -656, -656, -656, -656, -656, -656, -656, -656,\n\n     -656, -656, -656, -656, -656, -656, -656, -656, -656, -656,\n     -656, -656, -656, -656, -656, -656, -656, -656, -656, -656,\n     -656, -656, -656, -656, -656, -656, -656, -656, -656,  826,\n      826,  826,  826,  826,  826,  826,  826,  826, -656, -656,\n     -656, -656, -656, -656, -656, -656, -656, -656, -656, -656,\n     -656, -656, -656, -656, -656, -656, -656, -656, -656, -656,\n     -656, -656, -656, -656, -656, -656, -656, -656, -656, -656,\n     -656, -656, -656, -656, -656, -656, -656, -656, -656, -656,\n     -656, -656, -656, -656, -656, -656, -656, -656, -656, -656,\n     -656, -656, -656, -656, -656, -656, -656, -656, -656, -656,\n\n     -656, -656, -656, -656, -656, -656, -656, -656\n    },\n\n    {\n       55, -657, -657, -657, -657, -657, -657, -657, -657, -657,\n     -657, -657, -657, -657, -657, -657, -657, -657, -657, -657,\n     -657, -657, -657, -657, -657, -657, -657, -657, -657, -657,\n     -657, -657, -657, -657, -657, -657, -657, -657, -657, -657,\n     -657, -657, -657, -657, -657, -657, -657, -657,  822,  827,\n      827,  827,  827,  827,  827,  827,  827,  827, -657, -657,\n     -657, -657, -657, -657, -657, -657, -657, -657, -657, -657,\n     -657, -657, -657, -657, -657, -657, -657, -657, -657, -657,\n     -657, -657, -657, -657, -657, -657, -657, -657, -657, -657,\n\n     -657, -657, -657, -657, -657, -657, -657, -657, -657, -657,\n     -657, -657, -657, -657, -657, -657, -657, -657, -657, -657,\n     -657, -657, -657, -657, -657, -657, -657, -657, -657, -657,\n     -657, -657, -657, -657, -657, -657, -657, -657\n    },\n\n    {\n       55, -658, -658, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658, -658, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658, -658, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658,  824, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658, -658, -658, -658, -658, -658, -658,  825,  828,\n      828,  828,  828,  828,  828,  828,  828,  828, -658, -658,\n\n     -658, -658, -658, -658, -658,  824,  824,  824,  824,  824,\n      824,  824,  824,  824,  824,  824,  824,  824,  824,  824,\n      824,  824,  824,  824,  824,  824,  824,  824,  824,  824,\n      824, -658, -658, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658, -658, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658, -658, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658, -658, -658, -658, -658, -658, -658\n    },\n\n    {\n       55, -659, -659, -659, -659, -659, -659, -659, -659, -659,\n     -659, -659, -659, -659, -659, -659, -659, -659, -659, -659,\n     -659, -659, -659, -659, -659, -659, -659, -659, -659, -659,\n\n     -659, -659,  829, -659, -659, -659, -659, -659, -659, -659,\n     -659, -659, -659, -659, -659, -659, -659, -659,  830,  830,\n      830,  830,  830,  830,  830,  830,  830,  830, -659, -659,\n     -659, -659, -659, -659, -659,  829,  829,  829,  829,  829,\n      829,  829,  829,  829,  829,  829,  829,  829,  829,  829,\n      829,  829,  829,  829,  829,  829,  829,  829,  829,  829,\n      829, -659, -659, -659, -659, -659, -659, -659, -659, -659,\n     -659, -659, -659, -659, -659, -659, -659, -659, -659, -659,\n     -659, -659, -659, -659, -659, -659, -659, -659, -659, -659,\n     -659, -659, -659, -659, -659, -659, -659, -659\n\n    },\n\n    {\n       55, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660,  831, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n\n     -660, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660, -660, -660, -660, -660, -660, -660\n    },\n\n    {\n       55, -661, -661, -661, -661, -661, -661, -661, -661, -661,\n     -661, -661, -661, -661, -661, -661, -661, -661, -661, -661,\n     -661, -661, -661, -661, -661, -661, -661, -661, -661, -661,\n     -661, -661,  832, -661, -661, -661, -661, -661, -661, -661,\n     -661, -661, -661, -661, -661, -661, -661, -661,  833,  833,\n      833,  833,  833,  833,  833,  833,  833,  833, -661, -661,\n     -661, -661, -661, -661, -661,  832,  832,  832,  832,  832,\n\n      832,  832,  832,  832,  832,  832,  832,  832,  832,  832,\n      832,  832,  832,  832,  832,  832,  832,  832,  832,  832,\n      832, -661, -661, -661, -661, -661, -661, -661, -661, -661,\n     -661, -661, -661, -661, -661, -661, -661, -661, -661, -661,\n     -661, -661, -661, -661, -661, -661, -661, -661, -661, -661,\n     -661, -661, -661, -661, -661, -661, -661, -661\n    },\n\n    {\n       55, -662, -662, -662, -662, -662, -662, -662, -662, -662,\n     -662, -662, -662, -662, -662, -662, -662, -662, -662, -662,\n     -662, -662, -662, -662, -662, -662, -662, -662, -662, -662,\n     -662, -662,  824, -662, -662, -662, -662, -662, -662, -662,\n\n     -662, -662, -662, -662, -662, -662, -662, -662,  825,  834,\n      834,  834,  834,  834,  834,  834,  834,  834, -662, -662,\n     -662, -662, -662, -662, -662,  824,  824,  824,  824,  824,\n      824,  824,  824,  824,  824,  824,  824,  824,  824,  824,\n      824,  824,  824,  824,  824,  824,  824,  824,  824,  824,\n      824, -662, -662, -662, -662, -662, -662, -662, -662, -662,\n     -662, -662, -662, -662, -662, -662, -662, -662, -662, -662,\n     -662, -662, -662, -662, -662, -662, -662, -662, -662, -662,\n     -662, -662, -662, -662, -662, -662, -662, -662\n    },\n\n    {\n       55, -663, -663, -663, -663, -663, -663, -663, -663, -663,\n\n     -663, -663, -663, -663, -663, -663, -663, -663, -663, -663,\n     -663, -663, -663, -663, -663, -663, -663, -663, -663, -663,\n     -663, -663,  835, -663, -663, -663, -663, -663, -663, -663,\n     -663, -663, -663, -663, -663, -663, -663, -663,  836,  836,\n      836,  836,  836,  836,  836,  836,  836,  836, -663, -663,\n     -663, -663, -663, -663, -663,  835,  835,  835,  835,  835,\n      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,\n      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,\n      835, -663, -663, -663, -663, -663, -663, -663, -663, -663,\n     -663, -663, -663, -663, -663, -663, -663, -663, -663, -663,\n\n     -663, -663, -663, -663, -663, -663, -663, -663, -663, -663,\n     -663, -663, -663, -663, -663, -663, -663, -663\n    },\n\n    {\n       55, -664, -664, -664, -664, -664, -664, -664, -664, -664,\n     -664, -664, -664, -664, -664, -664, -664, -664, -664, -664,\n     -664, -664, -664, -664, -664, -664, -664, -664, -664, -664,\n     -664, -664,  832, -664, -664, -664, -664, -664, -664, -664,\n     -664, -664, -664, -664, -664, -664, -664, -664,  833,  837,\n      837,  837,  837,  837,  837,  837,  837,  837, -664, -664,\n     -664, -664, -664, -664, -664,  832,  832,  832,  832,  832,\n      832,  832,  832,  832,  832,  832,  832,  832,  832,  832,\n\n      832,  832,  832,  832,  832,  832,  832,  832,  832,  832,\n      832, -664, -664, -664, -664, -664, -664, -664, -664, -664,\n     -664, -664, -664, -664, -664, -664, -664, -664, -664, -664,\n     -664, -664, -664, -664, -664, -664, -664, -664, -664, -664,\n     -664, -664, -664, -664, -664, -664, -664, -664\n    },\n\n    {\n       55, -665, -665, -665, -665, -665, -665, -665, -665, -665,\n     -665, -665, -665, -665, -665, -665, -665, -665, -665, -665,\n     -665, -665, -665, -665, -665, -665, -665, -665, -665, -665,\n     -665, -665,  838, -665, -665, -665, -665, -665, -665, -665,\n     -665, -665, -665, -665, -665, -665, -665, -665,  839,  839,\n\n      839,  839,  839,  839,  839,  839,  839,  839, -665, -665,\n     -665, -665, -665, -665, -665,  838,  838,  838,  838,  838,\n      838,  838,  838,  838,  838,  838,  838,  838,  838,  838,\n      838,  838,  838,  838,  838,  838,  838,  838,  838,  838,\n      838, -665, -665, -665, -665, -665, -665, -665, -665, -665,\n     -665, -665, -665, -665, -665, -665, -665, -665, -665, -665,\n     -665, -665, -665, -665, -665, -665, -665, -665, -665, -665,\n     -665, -665, -665, -665, -665, -665, -665, -665\n    },\n\n    {\n       55, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666,  840, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n\n     -666, -666, -666, -666, -666, -666, -666, -666\n    },\n\n    {\n       55, -667, -667, -667, -667, -667, -667, -667, -667, -667,\n     -667, -667, -667, -667, -667, -667, -667, -667, -667, -667,\n     -667, -667, -667, -667, -667, -667, -667, -667, -667, -667,\n     -667, -667,  841, -667, -667, -667, -667, -667, -667, -667,\n     -667, -667, -667, -667, -667, -667, -667, -667,  833,  833,\n      833,  833,  833,  833,  833,  833,  833,  833, -667, -667,\n     -667, -667, -667, -667, -667,  841,  841,  841,  841,  841,\n      841,  841,  841,  841,  841,  841,  841,  841,  841,  841,\n      841,  841,  841,  841,  841,  841,  841,  841,  841,  841,\n\n      841, -667, -667, -667, -667, -667, -667, -667, -667, -667,\n     -667, -667, -667, -667, -667, -667, -667, -667, -667, -667,\n     -667, -667, -667, -667, -667, -667, -667, -667, -667, -667,\n     -667, -667, -667, -667, -667, -667, -667, -667\n    },\n\n    {\n       55, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668,  842, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n\n     -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668, -668, -668, -668, -668, -668, -668\n    },\n\n    {\n       55, -669, -669, -669, -669, -669, -669, -669, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669, -669, -669,\n\n     -669, -669,  843, -669, -669, -669, -669, -669, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669\n\n    },\n\n    {\n       55, -670, -670, -670, -670, -670, -670, -670, -670, -670,\n     -670, -670, -670, -670, -670, -670, -670, -670, -670, -670,\n     -670, -670, -670, -670, -670, -670, -670, -670, -670, -670,\n     -670, -670,  844, -670, -670, -670, -670, -670, -670, -670,\n     -670, -670, -670, -670, -670, -670, -670, -670,  845,  845,\n      845,  845,  845,  845,  845,  845,  845,  845, -670, -670,\n     -670, -670, -670, -670, -670,  844,  844,  844,  844,  844,\n      844,  844,  844,  844,  844,  844,  844,  844,  844,  844,\n      844,  844,  844,  844,  844,  844,  844,  844,  844,  844,\n      844, -670, -670, -670, -670, -670, -670, -670, -670, -670,\n\n     -670, -670, -670, -670, -670, -670, -670, -670, -670, -670,\n     -670, -670, -670, -670, -670, -670, -670, -670, -670, -670,\n     -670, -670, -670, -670, -670, -670, -670, -670\n    },\n\n    {\n       55, -671, -671, -671, -671, -671, -671, -671, -671, -671,\n     -671, -671, -671, -671, -671, -671, -671, -671, -671, -671,\n     -671, -671, -671, -671, -671, -671, -671, -671, -671, -671,\n     -671, -671,  832, -671, -671, -671, -671, -671, -671, -671,\n     -671, -671, -671, -671, -671, -671, -671, -671,  833,  846,\n      846,  846,  846,  846,  846,  846,  846,  846, -671, -671,\n     -671, -671, -671, -671, -671,  832,  832,  832,  832,  832,\n\n      832,  832,  832,  832,  832,  832,  832,  832,  832,  832,\n      832,  832,  832,  832,  832,  832,  832,  832,  832,  832,\n      832, -671, -671, -671, -671, -671, -671, -671, -671, -671,\n     -671, -671, -671, -671, -671, -671, -671, -671, -671, -671,\n     -671, -671, -671, -671, -671, -671, -671, -671, -671, -671,\n     -671, -671, -671, -671, -671, -671, -671, -671\n    },\n\n    {\n       55, -672, -672, -672, -672, -672, -672, -672, -672, -672,\n     -672, -672, -672, -672, -672, -672, -672, -672, -672, -672,\n     -672, -672, -672, -672, -672, -672, -672, -672, -672, -672,\n     -672, -672,  847, -672, -672, -672, -672, -672, -672, -672,\n\n     -672, -672, -672, -672, -672, -672, -672, -672,  848,  848,\n      848,  848,  848,  848,  848,  848,  848,  848, -672, -672,\n     -672, -672, -672, -672, -672,  847,  847,  847,  847,  847,\n      847,  847,  847,  847,  847,  847,  847,  847,  847,  847,\n      847,  847,  847,  847,  847,  847,  847,  847,  847,  847,\n      847, -672, -672, -672, -672, -672, -672, -672, -672, -672,\n     -672, -672, -672, -672, -672, -672, -672, -672, -672, -672,\n     -672, -672, -672, -672, -672, -672, -672, -672, -672, -672,\n     -672, -672, -672, -672, -672, -672, -672, -672\n    },\n\n    {\n       55, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n\n     -673, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n     -673, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n     -673, -673,  849, -673, -673, -673, -673, -673, -673, -673,\n     -673, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n     -673, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n     -673, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n     -673, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n     -673, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n     -673, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n     -673, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n\n     -673, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n     -673, -673, -673, -673, -673, -673, -673, -673\n    },\n\n    {\n       55, -674, -674, -674, -674, -674, -674, -674, -674, -674,\n     -674, -674, -674, -674, -674, -674, -674, -674, -674, -674,\n     -674, -674, -674, -674, -674, -674, -674, -674, -674, -674,\n     -674, -674,  850, -674, -674, -674, -674, -674, -674, -674,\n     -674, -674, -674, -674, -674, -674, -674, -674,  833,  833,\n      833,  833,  833,  833,  833,  833,  833,  833, -674, -674,\n     -674, -674, -674, -674, -674,  850,  850,  850,  850,  850,\n      850,  850,  850,  850,  850,  850,  850,  850,  850,  850,\n\n      850,  850,  850,  850,  850,  850,  850,  850,  850,  850,\n      850, -674, -674, -674, -674, -674, -674, -674, -674, -674,\n     -674, -674, -674, -674, -674, -674, -674, -674, -674, -674,\n     -674, -674, -674, -674, -674, -674, -674, -674, -674, -674,\n     -674, -674, -674, -674, -674, -674, -674, -674\n    },\n\n    {\n       55, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675,  844, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675, -675, -675, -675, -675, -675, -675,  845,  851,\n\n      851,  851,  851,  851,  851,  851,  851,  851, -675, -675,\n     -675, -675, -675, -675, -675,  844,  844,  844,  844,  844,\n      844,  844,  844,  844,  844,  844,  844,  844,  844,  844,\n      844,  844,  844,  844,  844,  844,  844,  844,  844,  844,\n      844, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675, -675, -675, -675, -675, -675, -675\n    },\n\n    {\n       55, -676, -676, -676, -676, -676, -676, -676, -676, -676,\n     -676, -676, -676, -676, -676, -676, -676, -676, -676, -676,\n\n     -676, -676, -676, -676, -676, -676, -676, -676, -676, -676,\n     -676, -676,  852, -676, -676, -676, -676, -676, -676, -676,\n     -676, -676, -676, -676, -676, -676, -676, -676,  853,  853,\n      853,  853,  853,  853,  853,  853,  853,  853, -676, -676,\n     -676, -676, -676, -676, -676,  852,  852,  852,  852,  852,\n      852,  852,  852,  852,  852,  852,  852,  852,  852,  852,\n      852,  852,  852,  852,  852,  852,  852,  852,  852,  852,\n      852, -676, -676, -676, -676, -676, -676, -676, -676, -676,\n     -676, -676, -676, -676, -676, -676, -676, -676, -676, -676,\n     -676, -676, -676, -676, -676, -676, -676, -676, -676, -676,\n\n     -676, -676, -676, -676, -676, -676, -676, -676\n    },\n\n    {\n       55, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677,  854, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677\n    },\n\n    {\n       55, -678, -678, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678, -678, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678, -678, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678,  855, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678, -678, -678, -678, -678, -678, -678,  845,  845,\n      845,  845,  845,  845,  845,  845,  845,  845, -678, -678,\n\n     -678, -678, -678, -678, -678,  855,  855,  855,  855,  855,\n      855,  855,  855,  855,  855,  855,  855,  855,  855,  855,\n      855,  855,  855,  855,  855,  855,  855,  855,  855,  855,\n      855, -678, -678, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678, -678, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678, -678, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678, -678, -678, -678, -678, -678, -678\n    },\n\n    {\n       55, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n\n     -679, -679,  856, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679\n\n    },\n\n    {\n       55, -680, -680, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680, -680, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680, -680, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680,  857, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680, -680, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680, -680, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680, -680, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680, -680, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680, -680, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680, -680, -680, -680, -680, -680, -680, -680, -680,\n\n     -680, -680, -680, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680, -680, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680, -680, -680, -680, -680, -680, -680\n    },\n\n    {\n       55, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681,  858, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681\n    },\n\n    {\n       55, -682, -682, -682, -682, -682, -682, -682, -682, -682,\n     -682, -682, -682, -682, -682, -682, -682, -682, -682, -682,\n     -682, -682, -682, -682, -682, -682, -682, -682, -682, -682,\n     -682, -682,  859, -682, -682, -682, -682, -682, -682, -682,\n\n     -682, -682, -682, -682, -682, -682, -682, -682, -682, -682,\n     -682, -682, -682, -682, -682, -682, -682, -682, -682, -682,\n     -682, -682, -682, -682, -682, -682, -682, -682, -682, -682,\n     -682, -682, -682, -682, -682, -682, -682, -682, -682, -682,\n     -682, -682, -682, -682, -682, -682, -682, -682, -682, -682,\n     -682, -682, -682, -682, -682, -682, -682, -682, -682, -682,\n     -682, -682, -682, -682, -682, -682, -682, -682, -682, -682,\n     -682, -682, -682, -682, -682, -682, -682, -682, -682, -682,\n     -682, -682, -682, -682, -682, -682, -682, -682\n    },\n\n    {\n       55, -683, -683, -683, -683, -683, -683, -683, -683, -683,\n\n     -683, -683, -683, -683, -683, -683, -683, -683, -683, -683,\n     -683, -683, -683, -683, -683, -683, -683, -683, -683, -683,\n     -683, -683,  860, -683, -683, -683, -683, -683, -683, -683,\n     -683, -683, -683, -683, -683, -683, -683, -683,  861,  861,\n      861,  861,  861,  861,  861,  861,  861,  861, -683, -683,\n     -683, -683, -683, -683, -683,  860,  860,  860,  860,  860,\n      860,  860,  860,  860,  860,  860,  860,  860,  860,  860,\n      860,  860,  860,  860,  860,  860,  860,  860,  860,  860,\n      860, -683, -683, -683, -683, -683, -683, -683, -683, -683,\n     -683, -683, -683, -683, -683, -683, -683, -683, -683, -683,\n\n     -683, -683, -683, -683, -683, -683, -683, -683, -683, -683,\n     -683, -683, -683, -683, -683, -683, -683, -683\n    },\n\n    {\n       55, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684,  862, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n\n     -684, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684\n    },\n\n    {\n       55, -685, -685, -685, -685, -685, -685, -685, -685, -685,\n     -685, -685, -685, -685, -685, -685, -685, -685, -685, -685,\n     -685, -685, -685, -685, -685, -685, -685, -685, -685, -685,\n     -685, -685,  863, -685, -685, -685, -685, -685, -685, -685,\n     -685, -685, -685, -685, -685, -685, -685, -685,  864,  864,\n\n      864,  864,  864,  864,  864,  864,  864,  864, -685, -685,\n     -685, -685, -685, -685, -685,  863,  863,  863,  863,  863,\n      863,  863,  863,  863,  863,  863,  863,  863,  863,  863,\n      863,  863,  863,  863,  863,  863,  863,  863,  863,  863,\n      863, -685, -685, -685, -685, -685, -685, -685, -685, -685,\n     -685, -685, -685, -685, -685, -685, -685, -685, -685, -685,\n     -685, -685, -685, -685, -685, -685, -685, -685, -685, -685,\n     -685, -685, -685, -685, -685, -685, -685, -685\n    },\n\n    {\n       55, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n     -686, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n\n     -686, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n     -686, -686,  865, -686, -686, -686, -686, -686, -686, -686,\n     -686, -686, -686, -686, -686, -686, -686, -686,  866,  866,\n      866,  866,  866,  866,  866,  866,  866,  866, -686, -686,\n     -686, -686, -686, -686, -686,  865,  865,  865,  865,  865,\n      865,  865,  865,  865,  865,  865,  865,  865,  865,  865,\n      865,  865,  865,  865,  865,  865,  865,  865,  865,  865,\n      865, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n     -686, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n     -686, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n\n     -686, -686, -686, -686, -686, -686, -686, -686\n    },\n\n    {\n       55, -687, -687, -687, -687, -687, -687, -687, -687, -687,\n     -687, -687, -687, -687, -687, -687, -687, -687, -687, -687,\n     -687, -687, -687, -687, -687, -687, -687, -687, -687, -687,\n     -687, -687, -687, -687, -687, -687, -687, -687, -687, -687,\n     -687, -687, -687, -687, -687, -687, -687, -687,  867,  867,\n      867,  867,  867,  867,  867,  867,  867,  867, -687, -687,\n     -687, -687, -687, -687, -687, -687, -687, -687, -687, -687,\n     -687, -687, -687, -687, -687, -687, -687, -687, -687, -687,\n     -687, -687, -687, -687, -687, -687, -687, -687, -687, -687,\n\n     -687, -687, -687, -687, -687, -687, -687, -687, -687, -687,\n     -687, -687, -687, -687, -687, -687, -687, -687, -687, -687,\n     -687, -687, -687, -687, -687, -687, -687, -687, -687, -687,\n     -687, -687, -687, -687, -687, -687, -687, -687\n    },\n\n    {\n       55, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688,  868,  868,\n      868,  868,  868,  868,  868,  868,  868,  868, -688, -688,\n\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688\n    },\n\n    {\n       55, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689,  869,  869,\n      869,  869,  869,  869,  869,  869,  869,  869, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689\n\n    },\n\n    {\n       55, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n     -690, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n     -690, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n     -690, -690,  870, -690, -690, -690, -690, -690, -690, -690,\n     -690, -690, -690, -690, -690, -690, -690, -690,  871,  871,\n      871,  871,  871,  871,  871,  871,  871,  871, -690, -690,\n     -690, -690, -690, -690, -690,  870,  870,  870,  870,  870,\n      870,  870,  870,  870,  870,  870,  870,  870,  870,  870,\n      870,  870,  870,  870,  870,  870,  870,  870,  870,  870,\n      870, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n\n     -690, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n     -690, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n     -690, -690, -690, -690, -690, -690, -690, -690\n    },\n\n    {\n       55, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691,  872,  872,\n      872,  872,  872,  872,  872,  872,  872,  872, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691\n    },\n\n    {\n       55, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n     -692, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n     -692, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n     -692, -692,  873, -692, -692, -692, -692, -692, -692, -692,\n\n     -692, -692, -692, -692, -692, -692, -692, -692,  874,  874,\n      874,  874,  874,  874,  874,  874,  874,  874, -692, -692,\n     -692, -692, -692, -692, -692,  873,  873,  873,  873,  873,\n      873,  873,  873,  873,  873,  873,  873,  873,  873,  873,\n      873,  873,  873,  873,  873,  873,  873,  873,  873,  873,\n      873, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n     -692, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n     -692, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n     -692, -692, -692, -692, -692, -692, -692, -692\n    },\n\n    {\n       55, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n\n     -693, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n     -693, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n     -693, -693,  873, -693, -693, -693, -693, -693, -693, -693,\n     -693, -693, -693, -693, -693, -693, -693, -693,  875,  875,\n      875,  875,  875,  875,  875,  875,  875,  875, -693, -693,\n     -693, -693, -693, -693, -693,  873,  873,  873,  873,  873,\n      873,  873,  873,  873,  873,  873,  873,  873,  873,  873,\n      873,  873,  873,  873,  873,  873,  873,  873,  873,  873,\n      873, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n     -693, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n\n     -693, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n     -693, -693, -693, -693, -693, -693, -693, -693\n    },\n\n    {\n       55, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694,  876, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694\n    },\n\n    {\n       55, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695,  877, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695,  878,  878,\n\n      878,  878,  878,  878,  878,  878,  878,  878, -695, -695,\n     -695, -695, -695, -695, -695,  877,  877,  877,  877,  877,\n      877,  877,  877,  877,  877,  877,  877,  877,  877,  877,\n      877,  877,  877,  877,  877,  877,  877,  877,  877,  877,\n      877, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695\n    },\n\n    {\n       55, -696, -696, -696, -696, -696, -696, -696, -696, -696,\n     -696, -696, -696, -696, -696, -696, -696, -696, -696, -696,\n\n     -696, -696, -696, -696, -696, -696, -696, -696, -696, -696,\n     -696, -696,  879, -696, -696, -696, -696, -696, -696, -696,\n     -696, -696, -696, -696, -696, -696, -696, -696,  880,  880,\n      880,  880,  880,  880,  880,  880,  880,  880, -696, -696,\n     -696, -696, -696, -696, -696,  879,  879,  879,  879,  879,\n      879,  879,  879,  879,  879,  879,  879,  879,  879,  879,\n      879,  879,  879,  879,  879,  879,  879,  879,  879,  879,\n      879, -696, -696, -696, -696, -696, -696, -696, -696, -696,\n     -696, -696, -696, -696, -696, -696, -696, -696, -696, -696,\n     -696, -696, -696, -696, -696, -696, -696, -696, -696, -696,\n\n     -696, -696, -696, -696, -696, -696, -696, -696\n    },\n\n    {\n       55, -697, -697, -697, -697, -697, -697, -697, -697, -697,\n     -697, -697, -697, -697, -697, -697, -697, -697, -697, -697,\n     -697, -697, -697, -697, -697, -697, -697, -697, -697, -697,\n     -697, -697,  879, -697, -697, -697, -697, -697, -697, -697,\n     -697, -697, -697, -697, -697, -697, -697, -697,  881,  881,\n      881,  881,  881,  881,  881,  881,  881,  881, -697, -697,\n     -697, -697, -697, -697, -697,  879,  879,  879,  879,  879,\n      879,  879,  879,  879,  879,  879,  879,  879,  879,  879,\n      879,  879,  879,  879,  879,  879,  879,  879,  879,  879,\n\n      879, -697, -697, -697, -697, -697, -697, -697, -697, -697,\n     -697, -697, -697, -697, -697, -697, -697, -697, -697, -697,\n     -697, -697, -697, -697, -697, -697, -697, -697, -697, -697,\n     -697, -697, -697, -697, -697, -697, -697, -697\n    },\n\n    {\n       55, -698, -698, -698, -698, -698, -698, -698, -698, -698,\n     -698, -698, -698, -698, -698, -698, -698, -698, -698, -698,\n     -698, -698, -698, -698, -698, -698, -698, -698, -698, -698,\n     -698, -698,  882, -698, -698, -698, -698, -698, -698, -698,\n     -698, -698, -698, -698, -698, -698, -698, -698, -698, -698,\n     -698, -698, -698, -698, -698, -698, -698, -698, -698, -698,\n\n     -698, -698, -698, -698, -698, -698, -698, -698, -698, -698,\n     -698, -698, -698, -698, -698, -698, -698, -698, -698, -698,\n     -698, -698, -698, -698, -698, -698, -698, -698, -698, -698,\n     -698, -698, -698, -698, -698, -698, -698, -698, -698, -698,\n     -698, -698, -698, -698, -698, -698, -698, -698, -698, -698,\n     -698, -698, -698, -698, -698, -698, -698, -698, -698, -698,\n     -698, -698, -698, -698, -698, -698, -698, -698\n    },\n\n    {\n       55, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n\n     -699, -699,  883, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699,  884,  884,\n      884,  884,  884,  884,  884,  884,  884,  884, -699, -699,\n     -699, -699, -699, -699, -699,  883,  883,  883,  883,  883,\n      883,  883,  883,  883,  883,  883,  883,  883,  883,  883,\n      883,  883,  883,  883,  883,  883,  883,  883,  883,  883,\n      883, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699\n\n    },\n\n    {\n       55, -700, -700, -700, -700, -700, -700, -700, -700, -700,\n     -700, -700, -700, -700, -700, -700, -700, -700, -700, -700,\n     -700, -700, -700, -700, -700, -700, -700, -700, -700, -700,\n     -700, -700,  883, -700, -700, -700, -700, -700, -700, -700,\n     -700, -700, -700, -700, -700, -700, -700, -700,  885,  885,\n      885,  885,  885,  885,  885,  885,  885,  885, -700, -700,\n     -700, -700, -700, -700, -700,  883,  883,  883,  883,  883,\n      883,  883,  883,  883,  883,  883,  883,  883,  883,  883,\n      883,  883,  883,  883,  883,  883,  883,  883,  883,  883,\n      883, -700, -700, -700, -700, -700, -700, -700, -700, -700,\n\n     -700, -700, -700, -700, -700, -700, -700, -700, -700, -700,\n     -700, -700, -700, -700, -700, -700, -700, -700, -700, -700,\n     -700, -700, -700, -700, -700, -700, -700, -700\n    },\n\n    {\n       55, -701, -701, -701, -701, -701, -701, -701, -701, -701,\n     -701, -701, -701, -701, -701, -701, -701, -701, -701, -701,\n     -701, -701, -701, -701, -701, -701, -701, -701, -701, -701,\n     -701, -701,  886, -701, -701, -701, -701, -701, -701, -701,\n     -701, -701, -701, -701, -701, -701, -701, -701,  878,  878,\n      878,  878,  878,  878,  878,  878,  878,  878, -701, -701,\n     -701, -701, -701, -701, -701,  886,  886,  886,  886,  886,\n\n      886,  886,  886,  886,  886,  886,  886,  886,  886,  886,\n      886,  886,  886,  886,  886,  886,  886,  886,  886,  886,\n      886, -701, -701, -701, -701, -701, -701, -701, -701, -701,\n     -701, -701, -701, -701, -701, -701, -701, -701, -701, -701,\n     -701, -701, -701, -701, -701, -701, -701, -701, -701, -701,\n     -701, -701, -701, -701, -701, -701, -701, -701\n    },\n\n    {\n       55, -702, -702, -702, -702, -702, -702, -702, -702, -702,\n     -702, -702, -702, -702, -702, -702, -702, -702, -702, -702,\n     -702, -702, -702, -702, -702, -702, -702, -702, -702, -702,\n     -702, -702,  887, -702, -702, -702, -702, -702, -702, -702,\n\n     -702, -702, -702, -702, -702, -702, -702, -702, -702, -702,\n     -702, -702, -702, -702, -702, -702, -702, -702, -702, -702,\n     -702, -702, -702, -702, -702, -702, -702, -702, -702, -702,\n     -702, -702, -702, -702, -702, -702, -702, -702, -702, -702,\n     -702, -702, -702, -702, -702, -702, -702, -702, -702, -702,\n     -702, -702, -702, -702, -702, -702, -702, -702, -702, -702,\n     -702, -702, -702, -702, -702, -702, -702, -702, -702, -702,\n     -702, -702, -702, -702, -702, -702, -702, -702, -702, -702,\n     -702, -702, -702, -702, -702, -702, -702, -702\n    },\n\n    {\n       55, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703,  888, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703\n    },\n\n    {\n       55, -704, -704, -704, -704, -704, -704, -704, -704, -704,\n     -704, -704, -704, -704, -704, -704, -704, -704, -704, -704,\n     -704, -704, -704, -704, -704, -704, -704, -704, -704, -704,\n     -704, -704,  889, -704, -704, -704, -704, -704, -704, -704,\n     -704, -704, -704, -704, -704, -704, -704, -704,  890,  890,\n      890,  890,  890,  890,  890,  890,  890,  890, -704, -704,\n     -704, -704, -704, -704, -704,  889,  889,  889,  889,  889,\n      889,  889,  889,  889,  889,  889,  889,  889,  889,  889,\n\n      889,  889,  889,  889,  889,  889,  889,  889,  889,  889,\n      889, -704, -704, -704, -704, -704, -704, -704, -704, -704,\n     -704, -704, -704, -704, -704, -704, -704, -704, -704, -704,\n     -704, -704, -704, -704, -704, -704, -704, -704, -704, -704,\n     -704, -704, -704, -704, -704, -704, -704, -704\n    },\n\n    {\n       55, -705, -705, -705, -705, -705, -705, -705, -705, -705,\n     -705, -705, -705, -705, -705, -705, -705, -705, -705, -705,\n     -705, -705, -705, -705, -705, -705, -705, -705, -705, -705,\n     -705, -705,  891, -705, -705, -705, -705, -705, -705, -705,\n     -705, -705, -705, -705, -705, -705, -705, -705, -705, -705,\n\n     -705, -705, -705, -705, -705, -705, -705, -705, -705, -705,\n     -705, -705, -705, -705, -705, -705, -705, -705, -705, -705,\n     -705, -705, -705, -705, -705, -705, -705, -705, -705, -705,\n     -705, -705, -705, -705, -705, -705, -705, -705, -705, -705,\n     -705, -705, -705, -705, -705, -705, -705, -705, -705, -705,\n     -705, -705, -705, -705, -705, -705, -705, -705, -705, -705,\n     -705, -705, -705, -705, -705, -705, -705, -705, -705, -705,\n     -705, -705, -705, -705, -705, -705, -705, -705\n    },\n\n    {\n       55, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n     -706, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n\n     -706, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n     -706, -706,  892, -706, -706, -706, -706, -706, -706, -706,\n     -706, -706, -706, -706, -706, -706, -706, -706,  893,  893,\n      893,  893,  893,  893,  893,  893,  893,  893, -706, -706,\n     -706, -706, -706, -706, -706,  892,  892,  892,  892,  892,\n      892,  892,  892,  892,  892,  892,  892,  892,  892,  892,\n      892,  892,  892,  892,  892,  892,  892,  892,  892,  892,\n      892, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n     -706, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n     -706, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n\n     -706, -706, -706, -706, -706, -706, -706, -706\n    },\n\n    {\n       55, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707,  892, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707,  894,  894,\n      894,  894,  894,  894,  894,  894,  894,  894, -707, -707,\n     -707, -707, -707, -707, -707,  892,  892,  892,  892,  892,\n      892,  892,  892,  892,  892,  892,  892,  892,  892,  892,\n      892,  892,  892,  892,  892,  892,  892,  892,  892,  892,\n\n      892, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707\n    },\n\n    {\n       55, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708,  895, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708,  878,  878,\n      878,  878,  878,  878,  878,  878,  878,  878, -708, -708,\n\n     -708, -708, -708, -708, -708,  895,  895,  895,  895,  895,\n      895,  895,  895,  895,  895,  895,  895,  895,  895,  895,\n      895,  895,  895,  895,  895,  895,  895,  895,  895,  895,\n      895, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708\n    },\n\n    {\n       55, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n\n     -709, -709,  896, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709\n\n    },\n\n    {\n       55, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710,  897, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710\n    },\n\n    {\n       55, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711,  898, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711,  899,  899,\n      899,  899,  899,  899,  899,  899,  899,  899, -711, -711,\n     -711, -711, -711, -711, -711,  898,  898,  898,  898,  898,\n\n      898,  898,  898,  898,  898,  898,  898,  898,  898,  898,\n      898,  898,  898,  898,  898,  898,  898,  898,  898,  898,\n      898, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711\n    },\n\n    {\n       55, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n     -712, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n     -712, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n     -712, -712,  898, -712, -712, -712, -712, -712, -712, -712,\n\n     -712, -712, -712, -712, -712, -712, -712, -712,  900,  900,\n      900,  900,  900,  900,  900,  900,  900,  900, -712, -712,\n     -712, -712, -712, -712, -712,  898,  898,  898,  898,  898,\n      898,  898,  898,  898,  898,  898,  898,  898,  898,  898,\n      898,  898,  898,  898,  898,  898,  898,  898,  898,  898,\n      898, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n     -712, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n     -712, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n     -712, -712, -712, -712, -712, -712, -712, -712\n    },\n\n    {\n       55, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n\n     -713, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n     -713, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n     -713, -713,  901, -713, -713, -713, -713, -713, -713, -713,\n     -713, -713, -713, -713, -713, -713, -713, -713,  890,  890,\n      890,  890,  890,  890,  890,  890,  890,  890, -713, -713,\n     -713, -713, -713, -713, -713,  901,  901,  901,  901,  901,\n      901,  901,  901,  901,  901,  901,  901,  901,  901,  901,\n      901,  901,  901,  901,  901,  901,  901,  901,  901,  901,\n      901, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n     -713, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n\n     -713, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n     -713, -713, -713, -713, -713, -713, -713, -713\n    },\n\n    {\n       55, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714,  902, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714\n    },\n\n    {\n       55, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715,  903, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715\n    },\n\n    {\n       55, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n\n     -716, -716, -716, -716, -716, -716, -716, -716\n    },\n\n    {\n       55,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      718,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  719,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  720,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717\n    },\n\n    {\n       55, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718\n    },\n\n    {\n       55,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      718,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n\n      717,  717,  719,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  720,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717\n\n    },\n\n    {\n       55,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      718,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  719,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  720,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717,  717,  717,\n      717,  717,  717,  717,  717,  717,  717,  717\n    },\n\n    {\n       55, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721,  904,\n\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721\n    },\n\n    {\n       55, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722,  905, -722, -722, -722, -722, -722, -722, -722,\n\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722\n    },\n\n    {\n       55, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723,  906, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723\n    },\n\n    {\n       55, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724,  907, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724\n    },\n\n    {\n       55, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725,  908,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725\n    },\n\n    {\n       55, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726,  909, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n\n     -726, -726, -726, -726, -726, -726, -726, -726\n    },\n\n    {\n       55, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727,  910, -727, -727, -727, -727, -727, -727, -727,\n\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727\n    },\n\n    {\n       55, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728,  911, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728\n    },\n\n    {\n       55, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n\n     -729, -729,  912, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729\n\n    },\n\n    {\n       55, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730,  913, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730\n    },\n\n    {\n       55, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731,  914, -731, -731, -731,\n\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731\n    },\n\n    {\n       55, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732,  915, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732\n    },\n\n    {\n       55, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n     -733, -733, -733, -733, -733, -733, -733, -733, -733,  916,\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n     -733, -733, -733, -733, -733, -733, -733, -733\n    },\n\n    {\n       55, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734,  917, -734,\n\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734\n    },\n\n    {\n       55, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735,  918, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735\n    },\n\n    {\n       55, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n     -736, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n\n     -736, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n     -736, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n     -736, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n     -736, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n     -736, -736, -736, -736, -736, -736, -736, -736, -736,  919,\n     -736, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n     -736, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n     -736, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n     -736, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n     -736, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n\n     -736, -736, -736, -736, -736, -736, -736, -736\n    },\n\n    {\n       55, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n      920, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737\n    },\n\n    {\n       55, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n\n     -738, -738, -738, -738, -738, -738,  921, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738\n    },\n\n    {\n       55, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n\n     -739, -739,  922, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739\n\n    },\n\n    {\n       55, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740,  923, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740\n    },\n\n    {\n       55, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741,  924, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741\n    },\n\n    {\n       55, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742,  925, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742\n    },\n\n    {\n       55, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743,  926, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743\n    },\n\n    {\n       55, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744,  927, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n      928, -744, -744,  929, -744, -744, -744, -744, -744, -744,\n\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744\n    },\n\n    {\n       55, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745,  930, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745\n    },\n\n    {\n       55, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746,  931, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n\n     -746, -746, -746, -746, -746, -746, -746, -746\n    },\n\n    {\n       55, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747,  932, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747\n    },\n\n    {\n       55, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748,  933, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748\n    },\n\n    {\n       55, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749,  934,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749\n\n    },\n\n    {\n       55, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750,  935,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750\n    },\n\n    {\n       55, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n\n     -751,  936, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751\n    },\n\n    {\n       55, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752,  937, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752\n    },\n\n    {\n       55, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753,  938, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753\n    },\n\n    {\n       55, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n\n     -754, -754, -754,  939, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754\n    },\n\n    {\n       55, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n      940, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755\n    },\n\n    {\n       55, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756,  941, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n      942, -756, -756,  943, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n\n     -756, -756, -756, -756, -756, -756, -756, -756\n    },\n\n    {\n       55, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757,  944, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757\n    },\n\n    {\n       55, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758,  945, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758\n    },\n\n    {\n       55, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759,  946, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759\n\n    },\n\n    {\n       55, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760,  947, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760\n    },\n\n    {\n       55, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n\n     -761, -761, -761, -761, -761, -761, -761,  948, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761\n    },\n\n    {\n       55, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762,  949, -762,\n     -762, -762, -762, -762, -762, -762, -762,  950, -762, -762,\n     -762, -762, -762,  951, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762\n    },\n\n    {\n       55, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763,  952, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763\n    },\n\n    {\n       55, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764,  953, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764\n    },\n\n    {\n       55, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765,  954, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765\n    },\n\n    {\n       55, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766,  955, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n\n     -766, -766, -766, -766, -766, -766, -766, -766\n    },\n\n    {\n       55, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767,  956, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767\n    },\n\n    {\n       55, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768,  957,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768\n    },\n\n    {\n       55, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769,  958, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769\n\n    },\n\n    {\n       55, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770,  959,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770,  960, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770\n    },\n\n    {\n       55, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771,  961, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771\n    },\n\n    {\n       55, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772,  962,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772\n    },\n\n    {\n       55, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773,  963, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773\n    },\n\n    {\n       55, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n\n     -774, -774, -774,  964, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774\n    },\n\n    {\n       55, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775,  965, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775\n    },\n\n    {\n       55, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776,  966,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n\n     -776, -776, -776, -776, -776, -776, -776, -776\n    },\n\n    {\n       55, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777,  967, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777\n    },\n\n    {\n       55, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n      968, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778\n    },\n\n    {\n       55, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779,  969, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779\n\n    },\n\n    {\n       55, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780,  970, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780\n    },\n\n    {\n       55, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n\n     -781, -781, -781,  971, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781\n    },\n\n    {\n       55, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782,  972, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782\n    },\n\n    {\n       55, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783,  973, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783\n    },\n\n    {\n       55, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n\n     -784, -784,  974, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784\n    },\n\n    {\n       55, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785,  975, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785\n    },\n\n    {\n       55, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786,  976, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n\n     -786, -786, -786, -786, -786, -786, -786, -786\n    },\n\n    {\n       55, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787,  977, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787\n    },\n\n    {\n       55, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788,  978, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788\n    },\n\n    {\n       55, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789,  979, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789\n\n    },\n\n    {\n       55, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790,  980, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790,  980,  980,  980,  980,  980,\n      980,  980,  980,  980,  980,  980,  980,  980,  980,  980,\n      980,  980,  980,  980,  980,  980,  980,  980,  980,  980,\n      980, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n\n     -790, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790, -790, -790, -790\n    },\n\n    {\n       55, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791,  981,\n\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791\n    },\n\n    {\n       55, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n\n     -792, -792, -792, -792, -792, -792, -792, -792,  982,  982,\n      982,  982,  982,  982,  982,  982,  982,  982, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792\n    },\n\n    {\n       55, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793,  983, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793\n    },\n\n    {\n       55, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794,  984,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794\n    },\n\n    {\n       55, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795,  985, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795\n    },\n\n    {\n       55, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796,  986,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n\n     -796, -796, -796, -796, -796, -796, -796, -796\n    },\n\n    {\n       55, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797,  987, -797, -797, -797, -797, -797, -797,\n\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797\n    },\n\n    {\n       55, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n\n     -798, -798, -798, -798, -798, -798, -798, -798, -798,  988,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798\n    },\n\n    {\n       55, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n\n     -799, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799\n\n    },\n\n    {\n       55, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800\n    },\n\n    {\n       55, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n\n     -801, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801, -801, -801, -801, -801, -801, -801\n    },\n\n    {\n       55, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802\n    },\n\n    {\n       55, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803\n    },\n\n    {\n       55, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n\n     -804, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804, -804, -804, -804, -804, -804, -804\n    },\n\n    {\n       55, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n\n     -805, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805, -805, -805, -805, -805, -805, -805\n    },\n\n    {\n       55, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n\n     -806, -806, -806, -806, -806, -806, -806, -806\n    },\n\n    {\n       55, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807\n    },\n\n    {\n       55, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808\n    },\n\n    {\n       55, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809\n\n    },\n\n    {\n       55, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n     -810, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n     -810, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n     -810, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n     -810, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n     -810, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n     -810, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n     -810, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n     -810, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n     -810, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n\n     -810, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n     -810, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n     -810, -810, -810, -810, -810, -810, -810, -810\n    },\n\n    {\n       55, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811\n    },\n\n    {\n       55, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n     -812, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n     -812, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n     -812, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n\n     -812, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n     -812, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n     -812, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n     -812, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n     -812, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n     -812, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n     -812, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n     -812, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n     -812, -812, -812, -812, -812, -812, -812, -812\n    },\n\n    {\n       55, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n\n     -813, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n     -813, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n     -813, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n     -813, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n     -813, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n     -813, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n     -813, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n     -813, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n     -813, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n     -813, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n\n     -813, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n     -813, -813, -813, -813, -813, -813, -813, -813\n    },\n\n    {\n       55, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814\n    },\n\n    {\n       55, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815\n    },\n\n    {\n       55, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n\n     -816, -816, -816, -816, -816, -816, -816, -816\n    },\n\n    {\n       55, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817\n    },\n\n    {\n       55, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n\n     -818, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, -818, -818, -818, -818, -818, -818\n    },\n\n    {\n       55, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819\n\n    },\n\n    {\n       55, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n\n     -820, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, -820, -820, -820, -820, -820, -820\n    },\n\n    {\n       55, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n\n     -821, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, -821, -821, -821, -821, -821, -821\n    },\n\n    {\n       55, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822\n    },\n\n    {\n       55, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n\n     -823, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n     -823, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n     -823, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n     -823, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n     -823, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n     -823, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n     -823, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n     -823, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n     -823, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n     -823, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n\n     -823, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n     -823, -823, -823, -823, -823, -823, -823, -823\n    },\n\n    {\n       55, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n\n     -824, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, -824, -824, -824, -824, -824, -824\n    },\n\n    {\n       55, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n\n     -825, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, -825, -825, -825, -825, -825, -825\n    },\n\n    {\n       55, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n     -826, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n\n     -826, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n     -826, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n     -826, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n     -826, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n     -826, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n     -826, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n     -826, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n     -826, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n     -826, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n     -826, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n\n     -826, -826, -826, -826, -826, -826, -826, -826\n    },\n\n    {\n       55, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n\n     -827, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827\n    },\n\n    {\n       55, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828\n    },\n\n    {\n       55, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n\n     -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829\n\n    },\n\n    {\n       55, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830\n    },\n\n    {\n       55, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831\n    },\n\n    {\n       55, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n     -832, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n     -832, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n     -832, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n\n     -832, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n     -832, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n     -832, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n     -832, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n     -832, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n     -832, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n     -832, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n     -832, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n     -832, -832, -832, -832, -832, -832, -832, -832\n    },\n\n    {\n       55, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n\n     -833, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n     -833, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n     -833, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n     -833, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n     -833, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n     -833, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n     -833, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n     -833, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n     -833, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n     -833, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n\n     -833, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n     -833, -833, -833, -833, -833, -833, -833, -833\n    },\n\n    {\n       55, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n\n     -834, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, -834, -834, -834, -834, -834, -834\n    },\n\n    {\n       55, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835\n    },\n\n    {\n       55, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n     -836, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n\n     -836, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n     -836, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n     -836, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n     -836, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n     -836, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n     -836, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n     -836, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n     -836, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n     -836, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n     -836, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n\n     -836, -836, -836, -836, -836, -836, -836, -836\n    },\n\n    {\n       55, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n\n     -837, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, -837, -837, -837, -837, -837, -837\n    },\n\n    {\n       55, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n\n     -838, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, -838, -838, -838, -838, -838, -838\n    },\n\n    {\n       55, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839\n\n    },\n\n    {\n       55, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n     -840, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n     -840, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n     -840, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n     -840, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n     -840, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n     -840, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n     -840, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n     -840, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n     -840, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n\n     -840, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n     -840, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n     -840, -840, -840, -840, -840, -840, -840, -840\n    },\n\n    {\n       55, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841\n    },\n\n    {\n       55, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842\n    },\n\n    {\n       55, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843\n    },\n\n    {\n       55, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n\n     -844, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, -844, -844, -844, -844, -844, -844\n    },\n\n    {\n       55, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845\n    },\n\n    {\n       55, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n     -846, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n\n     -846, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n     -846, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n     -846, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n     -846, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n     -846, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n     -846, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n     -846, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n     -846, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n     -846, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n     -846, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n\n     -846, -846, -846, -846, -846, -846, -846, -846\n    },\n\n    {\n       55, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847\n    },\n\n    {\n       55, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848\n    },\n\n    {\n       55, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n     -849, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n     -849, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n\n     -849, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n     -849, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n     -849, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n     -849, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n     -849, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n     -849, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n     -849, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n     -849, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n     -849, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n     -849, -849, -849, -849, -849, -849, -849, -849\n\n    },\n\n    {\n       55, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850\n    },\n\n    {\n       55, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851\n    },\n\n    {\n       55, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852\n    },\n\n    {\n       55, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853\n    },\n\n    {\n       55, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854\n    },\n\n    {\n       55, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855\n    },\n\n    {\n       55, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n\n     -856, -856, -856, -856, -856, -856, -856, -856\n    },\n\n    {\n       55, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857\n    },\n\n    {\n       55, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n\n     -858, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858, -858, -858, -858, -858, -858\n    },\n\n    {\n       55, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859\n\n    },\n\n    {\n       55, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n     -860, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n     -860, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n     -860, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n     -860, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n     -860, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n     -860, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n     -860, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n     -860, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n     -860, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n\n     -860, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n     -860, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n     -860, -860, -860, -860, -860, -860, -860, -860\n    },\n\n    {\n       55, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n\n     -861, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, -861, -861, -861, -861, -861, -861\n    },\n\n    {\n       55, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862\n    },\n\n    {\n       55, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863\n    },\n\n    {\n       55, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864\n    },\n\n    {\n       55, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n\n     -865, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, -865, -865, -865, -865, -865, -865\n    },\n\n    {\n       55, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n\n     -866, -866, -866, -866, -866, -866, -866, -866\n    },\n\n    {\n       55, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n\n     -867, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, -867, -867, -867, -867, -867, -867\n    },\n\n    {\n       55, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n\n     -868, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, -868, -868, -868, -868, -868, -868\n    },\n\n    {\n       55, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869\n\n    },\n\n    {\n       55, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n     -870, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n     -870, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n     -870, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n     -870, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n     -870, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n     -870, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n     -870, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n     -870, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n     -870, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n\n     -870, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n     -870, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n     -870, -870, -870, -870, -870, -870, -870, -870\n    },\n\n    {\n       55, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n\n     -871, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, -871, -871, -871, -871, -871, -871\n    },\n\n    {\n       55, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n     -872, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n     -872, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n     -872, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n\n     -872, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n     -872, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n     -872, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n     -872, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n     -872, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n     -872, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n     -872, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n     -872, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n     -872, -872, -872, -872, -872, -872, -872, -872\n    },\n\n    {\n       55, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873\n    },\n\n    {\n       55, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n\n     -874, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, -874, -874, -874, -874, -874, -874\n    },\n\n    {\n       55, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n\n     -875, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, -875, -875, -875, -875, -875, -875\n    },\n\n    {\n       55, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n     -876, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n\n     -876, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n     -876, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n     -876, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n     -876, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n     -876, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n     -876, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n     -876, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n     -876, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n     -876, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n     -876, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n\n     -876, -876, -876, -876, -876, -876, -876, -876\n    },\n\n    {\n       55, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877\n    },\n\n    {\n       55, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878\n    },\n\n    {\n       55, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n     -879, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n     -879, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n\n     -879, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n     -879, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n     -879, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n     -879, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n     -879, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n     -879, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n     -879, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n     -879, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n     -879, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n     -879, -879, -879, -879, -879, -879, -879, -879\n\n    },\n\n    {\n       55, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880\n    },\n\n    {\n       55, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n\n     -881, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, -881, -881, -881, -881, -881, -881\n    },\n\n    {\n       55, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n     -882, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n     -882, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n     -882, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n\n     -882, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n     -882, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n     -882, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n     -882, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n     -882, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n     -882, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n     -882, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n     -882, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n     -882, -882, -882, -882, -882, -882, -882, -882\n    },\n\n    {\n       55, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n\n     -883, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n     -883, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n     -883, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n     -883, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n     -883, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n     -883, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n     -883, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n     -883, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n     -883, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n     -883, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n\n     -883, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n     -883, -883, -883, -883, -883, -883, -883, -883\n    },\n\n    {\n       55, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884\n    },\n\n    {\n       55, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885\n    },\n\n    {\n       55, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n     -886, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n\n     -886, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n     -886, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n     -886, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n     -886, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n     -886, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n     -886, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n     -886, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n     -886, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n     -886, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n     -886, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n\n     -886, -886, -886, -886, -886, -886, -886, -886\n    },\n\n    {\n       55, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n\n     -887, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, -887, -887, -887, -887, -887, -887\n    },\n\n    {\n       55, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n\n     -888, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, -888, -888, -888, -888, -888, -888\n    },\n\n    {\n       55, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889\n\n    },\n\n    {\n       55, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890\n    },\n\n    {\n       55, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n\n     -891, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891\n    },\n\n    {\n       55, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n     -892, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n     -892, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n     -892, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n\n     -892, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n     -892, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n     -892, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n     -892, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n     -892, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n     -892, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n     -892, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n     -892, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n     -892, -892, -892, -892, -892, -892, -892, -892\n    },\n\n    {\n       55, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893\n    },\n\n    {\n       55, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n\n     -894, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, -894, -894, -894, -894, -894, -894\n    },\n\n    {\n       55, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895\n    },\n\n    {\n       55, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n\n     -896, -896, -896, -896, -896, -896, -896, -896\n    },\n\n    {\n       55, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n\n     -897, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, -897, -897, -897, -897, -897, -897\n    },\n\n    {\n       55, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898\n    },\n\n    {\n       55, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899\n\n    },\n\n    {\n       55, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900\n    },\n\n    {\n       55, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901\n    },\n\n    {\n       55, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902\n    },\n\n    {\n       55, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903\n    },\n\n    {\n       55, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n\n     -904, -904,  989, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904\n    },\n\n    {\n       55, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905,  990, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n\n     -905, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, -905, -905, -905, -905, -905, -905\n    },\n\n    {\n       55, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n     -906, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n\n     -906, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n     -906, -906,  991, -906, -906, -906, -906, -906, -906, -906,\n     -906, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n     -906, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n     -906, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n     -906, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n     -906, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n     -906, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n     -906, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n     -906, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n\n     -906, -906, -906, -906, -906, -906, -906, -906\n    },\n\n    {\n       55, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907,  992, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907\n    },\n\n    {\n       55, -908, -908, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908, -908, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908, -908, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908, -908, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908, -908, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908, -908, -908, -908, -908, -908, -908, -908, -908,\n\n     -908, -908, -908, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908, -908, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908,  993, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908, -908, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908, -908, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908, -908, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908, -908, -908, -908, -908, -908, -908\n    },\n\n    {\n       55, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n\n     -909, -909,  994, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909\n\n    },\n\n    {\n       55, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910,  995, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910\n    },\n\n    {\n       55, -911, -911, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911, -911, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911, -911, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911,  996, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911, -911, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911, -911, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911, -911, -911, -911, -911, -911, -911, -911, -911,\n\n     -911, -911, -911, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911, -911, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911, -911, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911, -911, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911, -911, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911, -911, -911, -911, -911, -911, -911\n    },\n\n    {\n       55, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912,  997, -912, -912, -912, -912, -912, -912, -912,\n\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912\n    },\n\n    {\n       55, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913,  998, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913\n    },\n\n    {\n       55, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n\n     -914, -914, -914,  999, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914\n    },\n\n    {\n       55, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, 1000, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915\n    },\n\n    {\n       55, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, 1001, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n\n     -916, -916, -916, -916, -916, -916, -916, -916\n    },\n\n    {\n       55, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, 1002, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917\n    },\n\n    {\n       55, -918, -918, -918, -918, -918, -918, -918, -918, -918,\n     -918, -918, -918, -918, -918, -918, -918, -918, -918, -918,\n     -918, -918, -918, -918, -918, -918, -918, -918, -918, -918,\n     -918, -918, -918, -918, -918, -918, -918, -918, -918, -918,\n     -918, -918, -918, -918, -918, -918, -918, -918, -918, -918,\n     -918, -918, -918, -918, -918, -918, -918, -918, -918, -918,\n\n     -918, -918, -918, -918, -918, -918, -918, -918, -918, -918,\n     -918, -918, -918, -918, -918, -918, -918, -918, -918, -918,\n     -918, -918, -918, 1003, -918, -918, -918, -918, -918, -918,\n     -918, -918, -918, -918, -918, -918, -918, -918, -918, -918,\n     -918, -918, -918, -918, -918, -918, -918, -918, -918, -918,\n     -918, -918, -918, -918, -918, -918, -918, -918, -918, -918,\n     -918, -918, -918, -918, -918, -918, -918, -918\n    },\n\n    {\n       55, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     1004, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919\n\n    },\n\n    {\n       55, -920, -920, -920, -920, -920, -920, -920, -920, -920,\n     -920, -920, -920, -920, -920, -920, -920, -920, -920, -920,\n     -920, -920, -920, -920, -920, -920, -920, -920, -920, -920,\n     -920, -920, 1005, -920, -920, -920, -920, -920, -920, -920,\n     -920, -920, -920, -920, -920, -920, -920, -920, -920, -920,\n     -920, -920, -920, -920, -920, -920, -920, -920, -920, -920,\n     -920, -920, -920, -920, -920, -920, -920, -920, -920, -920,\n     -920, -920, -920, -920, -920, -920, -920, -920, -920, -920,\n     -920, -920, -920, -920, -920, -920, -920, -920, -920, -920,\n     -920, -920, -920, -920, -920, -920, -920, -920, -920, -920,\n\n     -920, -920, -920, -920, -920, -920, -920, -920, -920, -920,\n     -920, -920, -920, -920, -920, -920, -920, -920, -920, -920,\n     -920, -920, -920, -920, -920, -920, -920, -920\n    },\n\n    {\n       55, -921, -921, -921, -921, -921, -921, -921, -921, -921,\n     -921, -921, -921, -921, -921, -921, -921, -921, -921, -921,\n     -921, -921, -921, -921, -921, -921, -921, -921, -921, -921,\n     -921, -921, -921, -921, -921, -921, -921, -921, -921, -921,\n     -921, -921, -921, -921, -921, -921, -921, -921, -921, -921,\n     -921, -921, -921, -921, -921, -921, -921, -921, -921, -921,\n     -921, -921, -921, -921, -921, -921, -921, -921, -921, -921,\n\n     -921, -921, -921, -921, -921, -921, -921, -921, -921, -921,\n     -921, -921, -921, 1006, -921, -921, -921, -921, -921, -921,\n     -921, -921, -921, -921, -921, -921, -921, -921, -921, -921,\n     -921, -921, -921, -921, -921, -921, -921, -921, -921, -921,\n     -921, -921, -921, -921, -921, -921, -921, -921, -921, -921,\n     -921, -921, -921, -921, -921, -921, -921, -921\n    },\n\n    {\n       55, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, 1007, -922, -922, -922, -922, -922, -922, -922,\n\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922\n    },\n\n    {\n       55, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, 1008, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923\n    },\n\n    {\n       55, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924\n    },\n\n    {\n       55, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, 1009, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925\n    },\n\n    {\n       55, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, 1010, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n\n     -926, -926, -926, -926, -926, -926, -926, -926\n    },\n\n    {\n       55, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, 1011, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927\n    },\n\n    {\n       55, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928\n    },\n\n    {\n       55, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929\n\n    },\n\n    {\n       55, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, 1012, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930\n    },\n\n    {\n       55, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, 1013, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931\n    },\n\n    {\n       55, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, 1014, -932, -932, -932, -932, -932, -932, -932,\n\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932\n    },\n\n    {\n       55, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, 1015, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933\n    },\n\n    {\n       55, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934\n    },\n\n    {\n       55, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935\n    },\n\n    {\n       55, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, 1016, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n\n     -936, -936, -936, -936, -936, -936, -936, -936\n    },\n\n    {\n       55, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, 1017, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937\n    },\n\n    {\n       55, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, 1018, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938\n    },\n\n    {\n       55, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n\n     -939, -939, 1019, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939\n\n    },\n\n    {\n       55, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, 1020, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     1021, -940, -940, 1022, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940\n    },\n\n    {\n       55, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, 1023, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941\n    },\n\n    {\n       55, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, 1024, -942, -942, -942, -942, -942, -942, -942,\n\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942\n    },\n\n    {\n       55, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, 1025, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943\n    },\n\n    {\n       55, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, 1026, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944\n    },\n\n    {\n       55, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, 1027, -945, -945, -945,\n     -945, -945, 1028, -945, -945, -945, 1029, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945, 1030, 1031,\n     1032, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945\n    },\n\n    {\n       55, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, 1033, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n\n     -946, -946, -946, -946, -946, -946, -946, -946\n    },\n\n    {\n       55, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, 1034, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947\n    },\n\n    {\n       55, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, 1035, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948\n    },\n\n    {\n       55, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n\n     -949, -949, 1036, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949\n\n    },\n\n    {\n       55, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, 1037, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950\n    },\n\n    {\n       55, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, 1038, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n\n     -951, -951, -951, -951, -951, -951, -951, -951, 1039, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951\n    },\n\n    {\n       55, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, 1040, -952, -952, -952, -952, -952, -952, -952,\n\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952\n    },\n\n    {\n       55, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, 1041, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953\n    },\n\n    {\n       55, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, 1042, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954\n    },\n\n    {\n       55, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, 1043, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955\n    },\n\n    {\n       55, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, 1044, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n\n     -956, -956, -956, -956, -956, -956, -956, -956\n    },\n\n    {\n       55, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, 1045, -957, -957, -957, -957, -957, -957,\n\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957\n    },\n\n    {\n       55, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958\n    },\n\n    {\n       55, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, 1046, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959\n\n    },\n\n    {\n       55, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960\n    },\n\n    {\n       55, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961\n    },\n\n    {\n       55, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     1047, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962\n    },\n\n    {\n       55, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963\n    },\n\n    {\n       55, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964\n    },\n\n    {\n       55, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965\n    },\n\n    {\n       55, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, 1048, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n\n     -966, -966, -966, -966, -966, -966, -966, -966\n    },\n\n    {\n       55, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, 1049, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967\n    },\n\n    {\n       55, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, 1050, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968\n    },\n\n    {\n       55, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, 1051, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969\n\n    },\n\n    {\n       55, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, 1052, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970\n    },\n\n    {\n       55, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, 1053, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971\n    },\n\n    {\n       55, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, 1054, -972, -972, -972, -972, -972, -972, -972,\n\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972\n    },\n\n    {\n       55, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, 1055, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973\n    },\n\n    {\n       55, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, 1056, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974\n    },\n\n    {\n       55, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, 1057, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975\n    },\n\n    {\n       55, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, 1058, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n\n     -976, -976, -976, -976, -976, -976, -976, -976\n    },\n\n    {\n       55, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, 1059, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977\n    },\n\n    {\n       55, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978\n    },\n\n    {\n       55, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979\n\n    },\n\n    {\n       55, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, 1060, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980\n    },\n\n    {\n       55, -981, -981, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, -981, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, -981, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, 1061, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, -981, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, -981, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, -981, -981, -981, 1061, 1061, 1061, 1061, 1061,\n\n     1061, 1061, 1061, 1061, 1061, 1061, 1061, 1061, 1061, 1061,\n     1061, 1061, 1061, 1061, 1061, 1061, 1061, 1061, 1061, 1061,\n     1061, -981, -981, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, -981, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, -981, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, -981, -981, -981, -981, -981, -981\n    },\n\n    {\n       55, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n\n     -982, -982, -982, -982, -982, -982, -982, -982, 1062, 1062,\n     1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982\n    },\n\n    {\n       55, -983, -983, -983, -983, -983, -983, -983, -983, -983,\n\n     -983, -983, -983, -983, -983, -983, -983, -983, -983, -983,\n     -983, -983, -983, -983, -983, -983, -983, -983, -983, -983,\n     -983, -983, 1063, -983, -983, -983, -983, -983, -983, -983,\n     -983, -983, -983, -983, -983, -983, -983, -983, -983, -983,\n     -983, -983, -983, -983, -983, -983, -983, -983, -983, -983,\n     -983, -983, -983, -983, -983, 1063, 1063, 1063, 1063, 1063,\n     1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,\n     1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,\n     1063, -983, -983, -983, -983, -983, -983, -983, -983, -983,\n     -983, -983, -983, -983, -983, -983, -983, -983, -983, -983,\n\n     -983, -983, -983, -983, -983, -983, -983, -983, -983, -983,\n     -983, -983, -983, -983, -983, -983, -983, -983\n    },\n\n    {\n       55, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984\n    },\n\n    {\n       55, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     1064, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985\n    },\n\n    {\n       55, -986, -986, -986, -986, -986, -986, -986, -986, -986,\n     -986, -986, -986, -986, -986, -986, -986, -986, -986, -986,\n\n     -986, -986, -986, -986, -986, -986, -986, -986, -986, -986,\n     -986, -986, 1065, -986, -986, -986, -986, -986, -986, -986,\n     -986, -986, -986, -986, -986, -986, -986, -986, -986, -986,\n     -986, -986, -986, -986, -986, -986, -986, -986, -986, -986,\n     -986, -986, -986, -986, -986, -986, -986, -986, -986, -986,\n     -986, -986, -986, -986, -986, -986, -986, -986, -986, -986,\n     -986, -986, -986, -986, -986, -986, -986, -986, -986, -986,\n     -986, -986, -986, -986, -986, -986, -986, -986, -986, -986,\n     -986, -986, -986, -986, -986, -986, -986, -986, -986, -986,\n     -986, -986, -986, -986, -986, -986, -986, -986, -986, -986,\n\n     -986, -986, -986, -986, -986, -986, -986, -986\n    },\n\n    {\n       55, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n\n     1066, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987\n    },\n\n    {\n       55, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988\n    },\n\n    {\n       55, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989\n\n    },\n\n    {\n       55, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n     -990, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n     -990, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n     -990, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n     -990, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n     -990, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n     -990, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n     -990, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n     -990, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n     -990, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n\n     -990, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n     -990, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n     -990, -990, -990, -990, -990, -990, -990, -990\n    },\n\n    {\n       55, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991\n    },\n\n    {\n       55, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n     -992, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n     -992, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n     -992, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n\n     -992, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n     -992, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n     -992, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n     -992, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n     -992, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n     -992, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n     -992, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n     -992, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n     -992, -992, -992, -992, -992, -992, -992, -992\n    },\n\n    {\n       55, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993\n    },\n\n    {\n       55, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994\n    },\n\n    {\n       55, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995\n    },\n\n    {\n       55, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n\n     -996, -996, -996, -996, -996, -996, -996, -996\n    },\n\n    {\n       55, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997\n    },\n\n    {\n       55, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998\n    },\n\n    {\n       55, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999\n\n    },\n\n    {\n       55,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000\n    },\n\n    {\n       55,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001\n    },\n\n    {\n       55,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002\n    },\n\n    {\n       55,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003\n    },\n\n    {\n       55,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004\n    },\n\n    {\n       55,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005\n    },\n\n    {\n       55,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006\n    },\n\n    {\n       55,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007, 1067,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007\n    },\n\n    {\n       55,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008\n    },\n\n    {\n       55,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009\n\n    },\n\n    {\n       55,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010\n    },\n\n    {\n       55,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011\n    },\n\n    {\n       55,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012\n    },\n\n    {\n       55,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013\n    },\n\n    {\n       55,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014\n    },\n\n    {\n       55,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015\n    },\n\n    {\n       55,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016\n    },\n\n    {\n       55,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017\n    },\n\n    {\n       55,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018\n    },\n\n    {\n       55,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019\n\n    },\n\n    {\n       55,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020\n    },\n\n    {\n       55,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021\n    },\n\n    {\n       55,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022\n    },\n\n    {\n       55,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023\n    },\n\n    {\n       55,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024\n    },\n\n    {\n       55,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025\n    },\n\n    {\n       55,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026, 1068,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026\n    },\n\n    {\n       55,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027\n    },\n\n    {\n       55,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028\n    },\n\n    {\n       55,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029\n\n    },\n\n    {\n       55,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030\n    },\n\n    {\n       55,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031\n    },\n\n    {\n       55,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032\n    },\n\n    {\n       55,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033\n    },\n\n    {\n       55,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034\n    },\n\n    {\n       55,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035\n    },\n\n    {\n       55,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036\n    },\n\n    {\n       55,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037\n    },\n\n    {\n       55,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038\n    },\n\n    {\n       55,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039\n\n    },\n\n    {\n       55,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040\n    },\n\n    {\n       55,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041\n    },\n\n    {\n       55,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042\n    },\n\n    {\n       55,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043\n    },\n\n    {\n       55,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044\n    },\n\n    {\n       55,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045\n    },\n\n    {\n       55,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046\n    },\n\n    {\n       55,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047\n    },\n\n    {\n       55,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048\n    },\n\n    {\n       55,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049\n\n    },\n\n    {\n       55,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050\n    },\n\n    {\n       55,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051\n    },\n\n    {\n       55,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052\n    },\n\n    {\n       55,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053\n    },\n\n    {\n       55,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054\n    },\n\n    {\n       55,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055\n    },\n\n    {\n       55,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056\n    },\n\n    {\n       55,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057\n    },\n\n    {\n       55,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058\n    },\n\n    {\n       55,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059\n\n    },\n\n    {\n       55,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060\n    },\n\n    {\n       55,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061\n    },\n\n    {\n       55,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062\n    },\n\n    {\n       55,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063, 1069,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063\n    },\n\n    {\n       55,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064\n    },\n\n    {\n       55,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065\n    },\n\n    {\n       55,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066\n    },\n\n    {\n       55,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067, 1070,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067\n    },\n\n    {\n       55,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068, 1071,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068\n    },\n\n    {\n       55,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n\n    -1069,-1069, 1072,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069\n\n    },\n\n    {\n       55,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070, 1073,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070\n    },\n\n    {\n       55,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071, 1074,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071, 1075,-1071, 1075,-1071,-1071, 1076, 1076,\n     1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071\n    },\n\n    {\n       55,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072, 1077,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n\n    -1072,-1072,-1072, 1078,-1072, 1078,-1072,-1072, 1079, 1079,\n     1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072\n    },\n\n    {\n       55,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073, 1080,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073\n    },\n\n    {\n       55,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074, 1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074, 1075,-1074, 1075,-1074,-1074, 1076, 1076,\n     1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074\n    },\n\n    {\n       55,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075, 1076, 1076,\n\n     1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075\n    },\n\n    {\n       55,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076, 1081,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076, 1082, 1076, 1076,\n     1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076\n    },\n\n    {\n       55,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077, 1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077, 1078,-1077, 1078,-1077,-1077, 1079, 1079,\n     1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077\n    },\n\n    {\n       55,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078, 1079, 1079,\n     1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079,-1078,-1078,\n\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078\n    },\n\n    {\n       55,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079, 1079, 1079,\n     1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079\n\n    },\n\n    {\n       55,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080, 1083,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080\n    },\n\n    {\n       55,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081, 1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081, 1082,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081\n    },\n\n    {\n       55, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n    -1082, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084\n    },\n\n    {\n       55,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083, 1085,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083\n    },\n\n    {\n       55, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n    -1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084,\n     1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084\n    },\n\n    {\n       55,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085, 1086,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085\n    },\n\n    {\n       55,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086, 1087,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086\n    },\n\n    {\n       55,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087, 1088,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087\n    },\n\n    {\n       55,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088, 1089,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088\n    },\n\n    {\n       55,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n\n    -1089,-1089, 1090,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089\n\n    },\n\n    {\n       55,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090, 1091,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090\n    },\n\n    {\n       55,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091, 1092,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091\n    },\n\n    {\n       55,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092, 1093,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092\n    },\n\n    {\n       55,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093, 1094,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093\n    },\n\n    {\n       55,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094, 1095,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094\n    },\n\n    {\n       55,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095, 1096,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095\n    },\n\n    {\n       55,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096, 1097,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096\n    },\n\n    {\n       55,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097, 1098,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097\n    },\n\n    {\n       55,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098, 1099,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098\n    },\n\n    {\n       55,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n\n    -1099,-1099, 1100,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099\n\n    },\n\n    {\n       55,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100, 1101,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100\n    },\n\n    {\n       55,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101, 1102,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101\n    },\n\n    {\n       55,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102, 1103,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102\n    },\n\n    {\n       55,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103, 1104,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103\n    },\n\n    {\n       55,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104, 1105,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104\n    },\n\n    {\n       55,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105, 1106,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105\n    },\n\n    {\n       55,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106, 1107,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106\n    },\n\n    {\n       55,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107, 1108,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107\n    },\n\n    {\n       55,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108, 1109,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108\n    },\n\n    {\n       55,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n\n    -1109,-1109, 1110,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109\n\n    },\n\n    {\n       55,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110, 1111,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110\n    },\n\n    {\n       55,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111, 1112,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111\n    },\n\n    {\n       55,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112, 1113,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112\n    },\n\n    {\n       55,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113, 1114,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113\n    },\n\n    {\n       55,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114, 1115,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114\n    },\n\n    {\n       55,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115, 1116,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115\n    },\n\n    {\n       55,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116, 1117,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116\n    },\n\n    {\n       55,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117, 1118,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117\n    },\n\n    {\n       55,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118, 1119,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118\n    },\n\n    {\n       55,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n\n    -1119,-1119, 1120,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119\n\n    },\n\n    {\n       55,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120, 1121,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120\n    },\n\n    {\n       55,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121, 1122,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121\n    },\n\n    {\n       55,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122, 1123,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122\n    },\n\n    {\n       55,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123, 1124,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123\n    },\n\n    {\n       55,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124, 1125,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124\n    },\n\n    {\n       55,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125, 1126,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125\n    },\n\n    {\n       55,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126, 1127,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126\n    },\n\n    {\n       55,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127, 1128,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127\n    },\n\n    {\n       55,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128, 1129,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128\n    },\n\n    {\n       55,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n\n    -1129,-1129, 1130,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129\n\n    },\n\n    {\n       55,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130, 1131,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130\n    },\n\n    {\n       55,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131, 1132,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131\n    },\n\n    {\n       55,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132, 1133,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132\n    },\n\n    {\n       55,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133, 1134,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133\n    },\n\n    {\n       55,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134, 1135,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134\n    },\n\n    {\n       55,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135, 1136,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135\n    },\n\n    {\n       55,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136, 1137,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136\n    },\n\n    {\n       55,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137, 1138,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137\n    },\n\n    {\n       55,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138, 1139,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138\n    },\n\n    {\n       55,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n\n    -1139,-1139, 1140,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139\n\n    },\n\n    {\n       55,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140, 1141,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140\n    },\n\n    {\n       55,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141, 1142,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141\n    },\n\n    {\n       55,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142, 1143,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142\n    },\n\n    {\n       55,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143, 1144,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143\n    },\n\n    {\n       55,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144, 1145,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144\n    },\n\n    {\n       55,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145, 1146,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145\n    },\n\n    {\n       55,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146, 1147,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146\n    },\n\n    {\n       55,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147, 1148,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147\n    },\n\n    {\n       55,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148, 1149,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148\n    },\n\n    {\n       55,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n\n    -1149,-1149, 1150,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149\n\n    },\n\n    {\n       55,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150, 1151,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150\n    },\n\n    {\n       55,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151\n    },\n\n    } ;\n\nstatic yy_state_type yy_get_previous_state ( yyscan_t yyscanner );\nstatic yy_state_type yy_try_NUL_trans ( yy_state_type current_state  , yyscan_t yyscanner);\nstatic int yy_get_next_buffer ( yyscan_t yyscanner );\nstatic void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );\n\n/* Done after the current pattern has been matched and before the\n * corresponding action - sets up yytext.\n */\n#define YY_DO_BEFORE_ACTION \\\n\tyyg->yytext_ptr = yy_bp; \\\n\tyyleng = (int) (yy_cp - yy_bp); \\\n\tyyg->yy_hold_char = *yy_cp; \\\n\t*yy_cp = '\\0'; \\\n\tyyg->yy_c_buf_p = yy_cp;\n#define YY_NUM_RULES 287\n#define YY_END_OF_BUFFER 288\n/* This struct is not used in this scanner,\n   but its presence is necessary. */\nstruct yy_trans_info\n\t{\n\tflex_int32_t yy_verify;\n\tflex_int32_t yy_nxt;\n\t};\nstatic const flex_int16_t yy_accept[1152] =\n    {   0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,  288,  287,  123,  123,  123,  123,\n      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,\n      123,  123,  123,  123,  123,  123,  123,  144,  144,  144,\n      192,  192,  192,  145,  145,  145,  241,  241,  241,  195,\n      193,  194,  245,  245,  249,  249,  252,  252,  253,  253,\n\n      256,  256,  258,  258,  260,  260,  262,  262,  261,  264,\n      264,  264,  263,  266,  266,  266,  265,  268,  268,  270,\n      270,  272,  271,  274,  274,  277,  277,  277,  275,  278,\n      287,  279,  287,  287,  287,  284,  287,  285,  287,  286,\n        0,    0,  101,    0,    0,  102,    5,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,   90,   91,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    4,    0,    0,    0,   18,   16,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,  259,  261,    0,  263,  263,  263,\n      263,    0,    0,  265,  265,  265,  265,    0,    0,  267,\n        0,  269,  271,  273,    0,  275,  276,  276,  275,    0,\n        0,  281,    0,    0,    0,  279,    0,    0,    0,  279,\n        0,    0,    0,  284,    0,  285,    0,  286,    0,  103,\n        0,    0,    0,  104,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,  141,  142,  143,  134,  133,  126,  127,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n      242,  243,  244,  246,  247,  248,    0,    0,    0,    0,\n        0,  263,    0,  263,  265,    0,  265,  276,    0,  276,\n        0,    0,  280,    0,    0,    0,  282,    0,    0,    0,\n\n      279,    0,    0,  119,  120,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,  254,  255,    0,  257,  283,    0,    0,    0,\n      280,    0,    0,    0,  279,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    6,   20,    0,   88,   24,   92,\n       89,   93,   21,    0,    0,    7,    3,   10,   22,    9,\n        8,   23,    0,    0,    0,   94,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,   17,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,  251,    0,  280,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,  135,  136,\n\n      137,  138,  139,  140,  132,  131,  130,  129,  128,  124,\n      125,  181,  183,  186,  190,  182,  185,  189,  184,  188,\n      187,  177,  155,  174,  178,  191,  166,  156,  152,  161,\n      172,  175,  179,  167,  164,  169,  157,  153,  162,  150,\n      159,  171,  173,  176,  180,  168,  165,  170,  148,  149,\n      158,  154,  163,  151,  160,  146,  147,  231,  233,  236,\n      240,  232,  235,  239,  234,  238,  237,  227,  205,  224,\n      228,  216,  202,  206,  211,  222,  225,  229,  214,  217,\n      219,  200,  203,  207,  212,  209,  221,  223,  226,  230,\n      198,  215,  218,  220,  199,  196,  201,  204,  208,  213,\n\n      210,  197,  250,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,   74,    0,    0,    0,   44,   42,    0,\n        0,    0,    0,   12,   11,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,   71,    0,   13,\n       15,    0,   75,   76,   80,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,   81,   77,    0,\n        0,    0,    0,   25,    0,    0,    0,   79,   97,   99,\n       95,   55,   98,  100,   96,  105,  106,   84,   86,   48,\n\n       47,   49,   46,   32,   31,   83,    0,   73,   85,   87,\n       40,   39,   43,   41,   54,   52,   51,   53,   50,   34,\n       38,   36,   33,   37,   35,    0,   68,   69,   67,   64,\n       65,   66,   70,  118,   29,  115,  116,  117,  114,  111,\n      112,  113,  107,  108,   72,   14,   82,   59,   62,   45,\n       63,   26,   30,   61,   60,   28,   27,   56,   57,   19,\n       78,  121,    0,  109,   58,  110,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    1,    0,    0,    2,    0,\n        1,    1,    0,    1,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n      122\n    } ;\n\nstatic const yy_state_type yy_NUL_trans[1152] =\n    {   0,\n       56,   57,   78,   78,   81,   81,   84,   84,   87,   87,\n       90,   90,   92,   92,   93,   93,   95,   95,   97,   97,\n       99,   99,  101,  101,  103,  103,  105,  105,  107,  107,\n      110,  110,  114,  114,  118,  118,  120,  120,  122,  122,\n      124,  124,  126,  126,   56,   56,  131,  131,  135,  135,\n      137,  137,  139,  139,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,  239,    0,\n      241,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n      251,    0,  255,  259,  263,    0,  265,    0,  267,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,  239,    0,\n      241,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n      251,    0,  391,  392,  396,    0,  400,  259,  259,    0,\n      259,  259,  263,    0,  265,    0,  267,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n      535,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n      391,  392,    0,  392,  392,  396,    0,  396,  540,  396,\n\n        0,  400,  544,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,  535,    0,    0,  391,  717,  540,\n        0,  540,  540,  544,    0,  544,  544,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,  717,    0,  717,  717,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0, 1084,    0, 1084,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0\n    } ;\n\n/* The intent behind this definition is that it'll catch\n * any uses of REJECT which flex missed.\n */\n#define REJECT reject_used_but_not_detected\n#define yymore() yymore_used_but_not_detected\n#define YY_MORE_ADJ 0\n#define YY_RESTORE_YY_MORE_OFFSET\n#line 1 \"wcspih.l\"\n/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcspih.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* wcspih.l is a Flex description file containing the definition of a lexical\n* scanner for parsing the WCS keyrecords from a FITS primary image or image\n* extension header.\n*\n* wcspih.l requires Flex v2.5.4 or later.  Refer to wcshdr.h for a description\n* of the user interface and operating notes.\n*\n* Implementation notes\n* --------------------\n* Use of the WCSAXESa keyword is not mandatory.  Its default value is \"the\n* larger of NAXIS and the largest index of these keywords [i.e. CRPIXj, PCi_j\n* or CDi_j, CDELTi, CTYPEi, CRVALi, and CUNITi] found in the FITS header\".\n* Consequently the definition of WCSAXESa effectively invalidates the use of\n* NAXIS for determining the number of coordinate axes and forces a preliminary\n* pass through the header to determine the \"largest index\" in headers where\n* WCSAXESa was omitted.\n*\n* Furthermore, since the use of WCSAXESa is optional, there is no way to\n* determine the number of coordinate representations (the \"a\" value) other\n* than by parsing all of the WCS keywords in the header; even if WCSAXESa was\n* specified for some representations it cannot be known in advance whether it\n* was specified for all of those present in the header.\n*\n* Hence the definition of WCSAXESa forces the scanner to be implemented in two\n* passes.  The first pass is used to determine the number of coordinate\n* representations (up to 27) and the number of coordinate axes in each.\n* Effectively WCSAXESa is ignored unless it exceeds the \"largest index\" in\n* which case the keywords for the extra axes assume their default values.  The\n* number of PVi_ma and PSi_ma keywords in each representation is also counted\n* in the first pass.\n*\n* On completion of the first pass, memory is allocated for an array of the\n* required number of wcsprm structs and each of these is initialized\n* appropriately.  These structs are filled in the second pass.\n*\n* The parser does not check for duplicated keywords, it accepts the last\n* encountered.\n*\n*===========================================================================*/\n/* Options. */\n#define YY_NO_INPUT 1\n/* Indices for parameterized keywords. */\n/* Alternate coordinate system identifier. */\n/* Keyvalue data types. */\n/* Inline comment syntax. */\n/* Exclusive start states. */\n\n\n\n\n\n\n#line 110 \"wcspih.l\"\n#include <math.h>\n#include <setjmp.h>\n#include <stddef.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"wcsmath.h\"\n#include \"wcsprintf.h\"\n#include \"wcsutil.h\"\n\n#include \"dis.h\"\n#include \"wcs.h\"\n#include \"wcshdr.h\"\n\n#define INTEGER 0\n#define FLOAT   1\n#define FLOAT2  2\n#define STRING  3\n#define RECORD  4\n\n#define PRIOR   1\n#define SEQUENT 2\n\n#define SIP     1\n#define DSS     2\n#define WAT     3\n\n// User data associated with yyscanner.\nstruct wcspih_extra {\n  // Values passed to YY_INPUT.\n  char *hdr;\n  int  nkeyrec;\n\n  // Used in preempting the call to exit() by yy_fatal_error().\n  jmp_buf abort_jmp_env;\n};\n\n#define YY_DECL int wcspih_scanner(char *header, int nkeyrec, int relax, \\\n int ctrl, int *nreject, int *nwcs, struct wcsprm **wcs, yyscan_t yyscanner)\n\n#define YY_INPUT(inbuff, count, bufsize) \\\n\t{ \\\n\t  if (yyextra->nkeyrec) { \\\n\t    strncpy(inbuff, yyextra->hdr, 80); \\\n\t    inbuff[80] = '\\n'; \\\n\t    yyextra->hdr += 80; \\\n\t    yyextra->nkeyrec--; \\\n\t    count = 81; \\\n\t  } else { \\\n\t    count = YY_NULL; \\\n\t  } \\\n\t}\n\n// Preempt the call to exit() by yy_fatal_error().\n#define exit(status) longjmp(yyextra->abort_jmp_env, status);\n\n// Internal helper functions.\nstatic YY_DECL;\nstatic int wcspih_final(int ndp[], int ndq[], int distran, double dsstmp[],\n             char *wat[], int *nwcs, struct wcsprm **wcs);\nstatic int wcspih_init1(int naxis, int alts[], int dpq[], int npv[],\n             int nps[], int ndp[], int ndq[], int auxprm, int distran,\n             int *nwcs, struct wcsprm **wcs);\nstatic void wcspih_pass1(int naxis, int i, int j, char a, int distype,\n             int alts[], int dpq[], int *npptr);\n\nstatic int wcspih_jdref(double *wptr,   const double *jdref);\nstatic int wcspih_jdrefi(double *wptr,  const double *jdrefi);\nstatic int wcspih_jdreff(double *wptr,  const double *jdreff);\nstatic int wcspih_epoch(double *wptr,   const double *epoch);\nstatic int wcspih_vsource(double *wptr, const double *vsource);\n\nstatic int wcspih_timepixr(double timepixr);\n\n#line 20918 \"wcspih.c\"\n#line 20919 \"wcspih.c\"\n\n#define INITIAL 0\n#define CCia 1\n#define CCi_ja 2\n#define CCCCCia 3\n#define CCi_ma 4\n#define CCCCCCCa 5\n#define CCCCCCCC 6\n#define CROTAi 7\n#define PROJPn 8\n#define SIP2 9\n#define SIP3 10\n#define DSSAMDXY 11\n#define PLTDECSN 12\n#define VALUE 13\n#define INTEGER_VAL 14\n#define FLOAT_VAL 15\n#define FLOAT2_VAL 16\n#define STRING_VAL 17\n#define RECORD_VAL 18\n#define RECFIELD 19\n#define RECCOLON 20\n#define RECVALUE 21\n#define RECEND 22\n#define COMMENT 23\n#define DISCARD 24\n#define ERROR 25\n#define FLUSH 26\n\n#ifndef YY_NO_UNISTD_H\n/* Special case for \"unistd.h\", since it is non-ANSI. We include it way\n * down here because we want the user's section 1 to have been scanned first.\n * The user has a chance to override it with an option.\n */\n#include <unistd.h>\n#endif\n\n#define YY_EXTRA_TYPE struct wcspih_extra *\n\n/* Holds the entire state of the reentrant scanner. */\nstruct yyguts_t\n    {\n\n    /* User-defined. Not touched by flex. */\n    YY_EXTRA_TYPE yyextra_r;\n\n    /* The rest are the same as the globals declared in the non-reentrant scanner. */\n    FILE *yyin_r, *yyout_r;\n    size_t yy_buffer_stack_top; /**< index of top of stack. */\n    size_t yy_buffer_stack_max; /**< capacity of stack. */\n    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */\n    char yy_hold_char;\n    int yy_n_chars;\n    int yyleng_r;\n    char *yy_c_buf_p;\n    int yy_init;\n    int yy_start;\n    int yy_did_buffer_switch_on_eof;\n    int yy_start_stack_ptr;\n    int yy_start_stack_depth;\n    int *yy_start_stack;\n    yy_state_type yy_last_accepting_state;\n    char* yy_last_accepting_cpos;\n\n    int yylineno_r;\n    int yy_flex_debug_r;\n\n    char *yytext_r;\n    int yy_more_flag;\n    int yy_more_len;\n\n    }; /* end struct yyguts_t */\n\nstatic int yy_init_globals ( yyscan_t yyscanner );\n\nint yylex_init (yyscan_t* scanner);\n\nint yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);\n\n/* Accessor methods to globals.\n   These are made visible to non-reentrant scanners for convenience. */\n\nint yylex_destroy ( yyscan_t yyscanner );\n\nint yyget_debug ( yyscan_t yyscanner );\n\nvoid yyset_debug ( int debug_flag , yyscan_t yyscanner );\n\nYY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );\n\nvoid yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );\n\nFILE *yyget_in ( yyscan_t yyscanner );\n\nvoid yyset_in  ( FILE * _in_str , yyscan_t yyscanner );\n\nFILE *yyget_out ( yyscan_t yyscanner );\n\nvoid yyset_out  ( FILE * _out_str , yyscan_t yyscanner );\n\n\t\t\tint yyget_leng ( yyscan_t yyscanner );\n\nchar *yyget_text ( yyscan_t yyscanner );\n\nint yyget_lineno ( yyscan_t yyscanner );\n\nvoid yyset_lineno ( int _line_number , yyscan_t yyscanner );\n\nint yyget_column  ( yyscan_t yyscanner );\n\nvoid yyset_column ( int _column_no , yyscan_t yyscanner );\n\n/* Macros after this point can all be overridden by user definitions in\n * section 1.\n */\n\n#ifndef YY_SKIP_YYWRAP\n#ifdef __cplusplus\nextern \"C\" int yywrap ( yyscan_t yyscanner );\n#else\nextern int yywrap ( yyscan_t yyscanner );\n#endif\n#endif\n\n#ifndef YY_NO_UNPUT\n    \n    static void yyunput ( int c, char *buf_ptr  , yyscan_t yyscanner);\n    \n#endif\n\n#ifndef yytext_ptr\nstatic void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);\n#endif\n\n#ifdef YY_NEED_STRLEN\nstatic int yy_flex_strlen ( const char * , yyscan_t yyscanner);\n#endif\n\n#ifndef YY_NO_INPUT\n#ifdef __cplusplus\nstatic int yyinput ( yyscan_t yyscanner );\n#else\nstatic int input ( yyscan_t yyscanner );\n#endif\n\n#endif\n\n/* Amount of stuff to slurp up with each read. */\n#ifndef YY_READ_BUF_SIZE\n#ifdef __ia64__\n/* On IA-64, the buffer size is 16k, not 8k */\n#define YY_READ_BUF_SIZE 16384\n#else\n#define YY_READ_BUF_SIZE 8192\n#endif /* __ia64__ */\n#endif\n\n/* Copy whatever the last rule matched to the standard output. */\n#ifndef ECHO\n/* This used to be an fputs(), but since the string might contain NUL's,\n * we now use fwrite().\n */\n#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)\n#endif\n\n/* Gets input and stuffs it into \"buf\".  number of characters read, or YY_NULL,\n * is returned in \"result\".\n */\n#ifndef YY_INPUT\n#define YY_INPUT(buf,result,max_size) \\\n\terrno=0; \\\n\twhile ( (result = (int) read( fileno(yyin), buf, (yy_size_t) max_size )) < 0 ) \\\n\t{ \\\n\t\tif( errno != EINTR) \\\n\t\t{ \\\n\t\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" ); \\\n\t\t\tbreak; \\\n\t\t} \\\n\t\terrno=0; \\\n\t\tclearerr(yyin); \\\n\t}\\\n\\\n\n#endif\n\n/* No semi-colon after return; correct usage is to write \"yyterminate();\" -\n * we don't want an extra ';' after the \"return\" because that will cause\n * some compilers to complain about unreachable statements.\n */\n#ifndef yyterminate\n#define yyterminate() return YY_NULL\n#endif\n\n/* Number of entries by which start-condition stack grows. */\n#ifndef YY_START_STACK_INCR\n#define YY_START_STACK_INCR 25\n#endif\n\n/* Report a fatal error. */\n#ifndef YY_FATAL_ERROR\n#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)\n#endif\n\n/* end tables serialization structures and prototypes */\n\n/* Default declaration of generated scanner - a define so the user can\n * easily add parameters.\n */\n#ifndef YY_DECL\n#define YY_DECL_IS_OURS 1\n\nextern int yylex (yyscan_t yyscanner);\n\n#define YY_DECL int yylex (yyscan_t yyscanner)\n#endif /* !YY_DECL */\n\n/* Code executed at the beginning of each rule, after yytext and yyleng\n * have been set up.\n */\n#ifndef YY_USER_ACTION\n#define YY_USER_ACTION\n#endif\n\n/* Code executed at the end of each rule. */\n#ifndef YY_BREAK\n#define YY_BREAK /*LINTED*/break;\n#endif\n\n#define YY_RULE_SETUP \\\n\tif ( yyleng > 0 ) \\\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = \\\n\t\t\t\t(yytext[yyleng - 1] == '\\n'); \\\n\tYY_USER_ACTION\n\n/** The main scanner function which does all the work.\n */\nYY_DECL\n{\n\tyy_state_type yy_current_state;\n\tchar *yy_cp, *yy_bp;\n\tint yy_act;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif ( !yyg->yy_init )\n\t\t{\n\t\tyyg->yy_init = 1;\n\n#ifdef YY_USER_INIT\n\t\tYY_USER_INIT;\n#endif\n\n\t\tif ( ! yyg->yy_start )\n\t\t\tyyg->yy_start = 1;\t/* first start state */\n\n\t\tif ( ! yyin )\n\t\t\tyyin = stdin;\n\n\t\tif ( ! yyout )\n\t\t\tyyout = stdout;\n\n\t\tif ( ! YY_CURRENT_BUFFER ) {\n\t\t\tyyensure_buffer_stack (yyscanner);\n\t\t\tYY_CURRENT_BUFFER_LVALUE =\n\t\t\t\tyy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);\n\t\t}\n\n\t\tyy_load_buffer_state( yyscanner );\n\t\t}\n\n\t{\n#line 187 \"wcspih.l\"\n\n#line 189 \"wcspih.l\"\n\tint  p, q;\n\tchar *errmsg, errtxt[80], *keyname, strtmp[80], *wat[2], *watstr;\n\tint  alts[27], dpq[27], inttmp, ndp[27], ndq[27], nps[27], npv[27],\n\t     rectype;\n\tdouble dbltmp, dbl2tmp[2], dsstmp[20];\n\tstruct auxprm auxtem;\n\tstruct disprm distem;\n\tstruct wcsprm wcstem;\n\t\n\tint naxis = 0;\n\tfor (int ialt = 0; ialt < 27; ialt++) {\n\t  alts[ialt] = 0;\n\t  dpq[ialt]  = 0;\n\t  npv[ialt]  = 0;\n\t  nps[ialt]  = 0;\n\t  ndp[ialt]  = 0;\n\t  ndq[ialt]  = 0;\n\t}\n\t\n\t// Our handle on the input stream.\n\tchar *keyrec = header;\n\tchar *hptr = header;\n\tchar *keep = 0x0;\n\t\n\t// For keeping tallies of keywords found.\n\t*nreject = 0;\n\tint nvalid = 0;\n\tint nother = 0;\n\t\n\t// If strict, then also reject.\n\tif (relax & WCSHDR_strict) relax |= WCSHDR_reject;\n\t\n\t// Keyword indices, as used in the WCS papers, e.g. PCi_ja, PVi_ma.\n\tint i = 0;\n\tint j = 0;\n\tint m = 0;\n\tchar a = ' ';\n\t\n\t// For decoding the keyvalue.\n\tint valtype = -1;\n\tint distype =  0;\n\tvoid *vptr  = 0x0;\n\t\n\t// For keywords that require special handling.\n\tint altlin  = 0;\n\tint *npptr  = 0x0;\n\tint (*chekval)(double) = 0x0;\n\tint (*special)(double *, const double *) = 0x0;\n\tint auxprm  = 0;\n\tint naux    = 0;\n\tint distran = 0;\n\tint sipflag = 0;\n\tint dssflag = 0;\n\tint watflag = 0;\n\tint watn    = 0;\n\t\n\t// The data structures produced.\n\t*nwcs = 0;\n\t*wcs  = 0x0;\n\t\n\t// Control variables.\n\tint ipass = 1;\n\tint npass = 2;\n\t\n\t// User data associated with yyscanner.\n\tyyextra->hdr = header;\n\tyyextra->nkeyrec = nkeyrec;\n\t\n\t// Return here via longjmp() invoked by yy_fatal_error().\n\tif (setjmp(yyextra->abort_jmp_env)) {\n\t  return WCSHDRERR_PARSER;\n\t}\n\t\n\tBEGIN(INITIAL);\n\n\n#line 21269 \"wcspih.c\"\n\n\twhile ( /*CONSTCOND*/1 )\t\t/* loops until end-of-file is reached */\n\t\t{\n\t\tyy_cp = yyg->yy_c_buf_p;\n\n\t\t/* Support of yytext. */\n\t\t*yy_cp = yyg->yy_hold_char;\n\n\t\t/* yy_bp points to the position in yy_ch_buf of the start of\n\t\t * the current run.\n\t\t */\n\t\tyy_bp = yy_cp;\n\n\t\tyy_current_state = yyg->yy_start;\n\t\tyy_current_state += YY_AT_BOL();\nyy_match:\n\t\twhile ( (yy_current_state = yy_nxt[yy_current_state][ YY_SC_TO_UI(*yy_cp) ]) > 0 )\n\t\t\t{\n\t\t\tif ( yy_accept[yy_current_state] )\n\t\t\t\t{\n\t\t\t\tyyg->yy_last_accepting_state = yy_current_state;\n\t\t\t\tyyg->yy_last_accepting_cpos = yy_cp;\n\t\t\t\t}\n\n\t\t\t++yy_cp;\n\t\t\t}\n\n\t\tyy_current_state = -yy_current_state;\n\nyy_find_action:\n\t\tyy_act = yy_accept[yy_current_state];\n\n\t\tYY_DO_BEFORE_ACTION;\n\ndo_action:\t/* This label is used only to access EOF actions. */\n\n\t\tswitch ( yy_act )\n\t{ /* beginning of action switch */\n\t\t\tcase 0: /* must back up */\n\t\t\t/* undo the effects of YY_DO_BEFORE_ACTION */\n\t\t\t*yy_cp = yyg->yy_hold_char;\n\t\t\tyy_cp = yyg->yy_last_accepting_cpos + 1;\n\t\t\tyy_current_state = yyg->yy_last_accepting_state;\n\t\t\tgoto yy_find_action;\n\ncase 1:\nYY_RULE_SETUP\n#line 265 \"wcspih.l\"\n{\n\t  keyname = \"NAXISn\";\n\t\n\t  if (ipass == 1) {\n\t    sscanf(yytext, \"NAXIS   = %d\", &naxis);\n\t    if (naxis < 0) naxis = 0;\n\t    BEGIN(FLUSH);\n\t\n\t  } else {\n\t    sscanf(yytext, \"NAXIS   = %d\", &i);\n\t\n\t    if (i < 0) {\n\t      errmsg = \"negative value of NAXIS ignored\";\n\t      BEGIN(ERROR);\n\t    } else {\n\t      BEGIN(DISCARD);\n\t    }\n\t  }\n\t}\n\tYY_BREAK\ncase 2:\nYY_RULE_SETUP\n#line 285 \"wcspih.l\"\n{\n\t  sscanf(yytext, \"WCSAXES%c= %d\", &a, &i);\n\t\n\t  if (i < 0) {\n\t    errmsg = \"negative value of WCSAXESa ignored\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    valtype = INTEGER;\n\t    vptr    = 0x0;\n\t\n\t    keyname = \"WCSAXESa\";\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\tYY_BREAK\ncase 3:\nYY_RULE_SETUP\n#line 301 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crpix);\n\t\n\t  keyname = \"CRPIXja\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 4:\nYY_RULE_SETUP\n#line 309 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pc);\n\t  altlin = 1;\n\t\n\t  keyname = \"PCi_ja\";\n\t  BEGIN(CCi_ja);\n\t}\n\tYY_BREAK\ncase 5:\nYY_RULE_SETUP\n#line 318 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cd);\n\t  altlin = 2;\n\t\n\t  keyname = \"CDi_ja\";\n\t  BEGIN(CCi_ja);\n\t}\n\tYY_BREAK\ncase 6:\nYY_RULE_SETUP\n#line 327 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cdelt);\n\t\n\t  keyname = \"CDELTia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 7:\nYY_RULE_SETUP\n#line 335 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crota);\n\t  altlin = 4;\n\t\n\t  keyname = \"CROTAn\";\n\t  BEGIN(CROTAi);\n\t}\n\tYY_BREAK\ncase 8:\nYY_RULE_SETUP\n#line 344 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cunit);\n\t\n\t  keyname = \"CUNITia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 9:\nYY_RULE_SETUP\n#line 352 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ctype);\n\t\n\t  keyname = \"CTYPEia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 10:\nYY_RULE_SETUP\n#line 360 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crval);\n\t\n\t  keyname = \"CRVALia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 11:\nYY_RULE_SETUP\n#line 368 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.lonpole);\n\t\n\t  keyname = \"LONPOLEa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\tYY_BREAK\ncase 12:\nYY_RULE_SETUP\n#line 376 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.latpole);\n\t\n\t  keyname = \"LATPOLEa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\tYY_BREAK\ncase 13:\nYY_RULE_SETUP\n#line 384 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.restfrq);\n\t\n\t  keyname = \"RESTFRQa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\tYY_BREAK\ncase 14:\nYY_RULE_SETUP\n#line 392 \"wcspih.l\"\n{\n\t  if (relax & WCSHDR_strict) {\n\t    errmsg = \"the RESTFREQ keyword is deprecated, use RESTFRQa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    valtype = FLOAT;\n\t    vptr    = &(wcstem.restfrq);\n\t\n\t    unput(' ');\n\t\n\t    keyname = \"RESTFREQ\";\n\t    BEGIN(CCCCCCCa);\n\t  }\n\t}\n\tYY_BREAK\ncase 15:\nYY_RULE_SETUP\n#line 408 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.restwav);\n\t\n\t  keyname = \"RESTWAVa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\tYY_BREAK\ncase 16:\nYY_RULE_SETUP\n#line 416 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pv);\n\t  npptr   = npv;\n\t\n\t  keyname = \"PVi_ma\";\n\t  BEGIN(CCi_ma);\n\t}\n\tYY_BREAK\ncase 17:\nYY_RULE_SETUP\n#line 425 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pv);\n\t  npptr   = npv;\n\t\n\t  keyname = \"PROJPn\";\n\t  BEGIN(PROJPn);\n\t}\n\tYY_BREAK\ncase 18:\nYY_RULE_SETUP\n#line 434 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ps);\n\t  npptr   = nps;\n\t\n\t  keyname = \"PSi_ma\";\n\t  BEGIN(CCi_ma);\n\t}\n\tYY_BREAK\ncase 19:\nYY_RULE_SETUP\n#line 443 \"wcspih.l\"\n{\n\t  sscanf(yytext, \"VELREF%c\", &a);\n\t\n\t  if (relax & WCSHDR_strict) {\n\t    errmsg = \"the VELREF keyword is deprecated, use SPECSYSa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else if ((a == ' ') || (relax & WCSHDR_VELREFa)) {\n\t    valtype = INTEGER;\n\t    vptr    = &(wcstem.velref);\n\t\n\t    unput(a);\n\t\n\t    keyname = \"VELREF\";\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"VELREF keyword may not have an alternate version code\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 20:\nYY_RULE_SETUP\n#line 468 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cname);\n\t\n\t  keyname = \"CNAMEia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 21:\nYY_RULE_SETUP\n#line 476 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crder);\n\t\n\t  keyname = \"CRDERia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 22:\nYY_RULE_SETUP\n#line 484 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.csyer);\n\t\n\t  keyname = \"CSYERia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 23:\nYY_RULE_SETUP\n#line 492 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.czphs);\n\t\n\t  keyname = \"CZPHSia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 24:\nYY_RULE_SETUP\n#line 500 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cperi);\n\t\n\t  keyname = \"CPERIia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 25:\nYY_RULE_SETUP\n#line 508 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.wcsname;\n\t\n\t  keyname = \"WCSNAMEa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\tYY_BREAK\ncase 26:\nYY_RULE_SETUP\n#line 516 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.timesys;\n\t\n\t  keyname = \"TIMESYS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 27:\nYY_RULE_SETUP\n#line 524 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.trefpos;\n\t\n\t  keyname = \"TREFPOS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 28:\nYY_RULE_SETUP\n#line 532 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.trefdir;\n\t\n\t  keyname = \"TREFDIR\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 29:\nYY_RULE_SETUP\n#line 540 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.plephem;\n\t\n\t  keyname = \"PLEPHEM\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 30:\nYY_RULE_SETUP\n#line 548 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.timeunit;\n\t\n\t  keyname = \"TIMEUNIT\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 31:\n#line 557 \"wcspih.l\"\ncase 32:\nYY_RULE_SETUP\n#line 557 \"wcspih.l\"\n{\n\t  if ((yytext[4] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = STRING;\n\t    vptr    = wcstem.dateref;\n\t\n\t    keyname = \"DATEREF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the DATE-REF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 33:\n#line 575 \"wcspih.l\"\ncase 34:\nYY_RULE_SETUP\n#line 575 \"wcspih.l\"\n{\n\t  if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = FLOAT2;\n\t    vptr    = wcstem.mjdref;\n\t\n\t    keyname = \"MJDREF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the MJD-REF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 35:\n#line 593 \"wcspih.l\"\ncase 36:\nYY_RULE_SETUP\n#line 593 \"wcspih.l\"\n{\n\t  if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    // Actually integer, but treated as float.\n\t    valtype = FLOAT;\n\t    vptr    = wcstem.mjdref;\n\t\n\t    keyname = \"MJDREFI\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the MJD-REFI keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 37:\n#line 612 \"wcspih.l\"\ncase 38:\nYY_RULE_SETUP\n#line 612 \"wcspih.l\"\n{\n\t  if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = FLOAT;\n\t    vptr    = wcstem.mjdref + 1;\n\t\n\t    keyname = \"MJDREFF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the MJD-REFF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 39:\n#line 630 \"wcspih.l\"\ncase 40:\nYY_RULE_SETUP\n#line 630 \"wcspih.l\"\n{\n\t  if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = FLOAT2;\n\t    vptr    = wcstem.mjdref;\n\t    special = wcspih_jdref;\n\t\n\t    keyname = \"JDREF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the JD-REF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 41:\n#line 649 \"wcspih.l\"\ncase 42:\nYY_RULE_SETUP\n#line 649 \"wcspih.l\"\n{\n\t  if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    // Actually integer, but treated as float.\n\t    valtype = FLOAT;\n\t    vptr    = wcstem.mjdref;\n\t    special = wcspih_jdrefi;\n\t\n\t    keyname = \"JDREFI\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the JD-REFI keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 43:\n#line 669 \"wcspih.l\"\ncase 44:\nYY_RULE_SETUP\n#line 669 \"wcspih.l\"\n{\n\t  if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = FLOAT;\n\t    vptr    = wcstem.mjdref;\n\t    special = wcspih_jdreff;\n\t\n\t    keyname = \"JDREFF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the JD-REFF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 45:\nYY_RULE_SETUP\n#line 687 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timeoffs);\n\t\n\t  keyname = \"TIMEOFFS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 46:\nYY_RULE_SETUP\n#line 695 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.dateobs;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"DATE-OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 47:\nYY_RULE_SETUP\n#line 704 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.datebeg;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"DATE-BEG\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 48:\nYY_RULE_SETUP\n#line 713 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.dateavg;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"DATE-AVG\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 49:\nYY_RULE_SETUP\n#line 722 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.dateend;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"DATE-END\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 50:\nYY_RULE_SETUP\n#line 731 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdobs);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"MJD-OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 51:\nYY_RULE_SETUP\n#line 740 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdbeg);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"MJD-BEG\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 52:\nYY_RULE_SETUP\n#line 749 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdavg);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"MJD-AVG\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 53:\nYY_RULE_SETUP\n#line 758 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdend);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"MJD-END\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 54:\nYY_RULE_SETUP\n#line 767 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.jepoch);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"JEPOCH\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 55:\nYY_RULE_SETUP\n#line 776 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.bepoch);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"BEPOCH\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 56:\nYY_RULE_SETUP\n#line 785 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.tstart);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TSTART\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 57:\nYY_RULE_SETUP\n#line 794 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.tstop);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TSTOP\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 58:\nYY_RULE_SETUP\n#line 803 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.xposure);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"XPOSURE\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 59:\nYY_RULE_SETUP\n#line 812 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.telapse);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TELAPSE\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 60:\nYY_RULE_SETUP\n#line 821 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timsyer);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TIMSYER\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 61:\nYY_RULE_SETUP\n#line 830 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timrder);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TIMRDER\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 62:\nYY_RULE_SETUP\n#line 839 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timedel);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TIMEDEL\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 63:\nYY_RULE_SETUP\n#line 848 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timepixr);\n\t  chekval = wcspih_timepixr;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TIMEPIXR\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 64:\nYY_RULE_SETUP\n#line 858 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-X\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 65:\nYY_RULE_SETUP\n#line 867 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 1;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-Y\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 66:\nYY_RULE_SETUP\n#line 876 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 2;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-Z\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 67:\nYY_RULE_SETUP\n#line 885 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 3;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-L\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 68:\nYY_RULE_SETUP\n#line 894 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 4;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-B\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 69:\nYY_RULE_SETUP\n#line 903 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 5;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-H\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 70:\nYY_RULE_SETUP\n#line 912 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.obsorbit;\n\t\n\t  keyname = \"OBSORBIT\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 71:\nYY_RULE_SETUP\n#line 920 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.radesys;\n\t\n\t  keyname = \"RADESYSa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\tYY_BREAK\ncase 72:\nYY_RULE_SETUP\n#line 928 \"wcspih.l\"\n{\n\t  if (relax & WCSHDR_RADECSYS) {\n\t    valtype = STRING;\n\t    vptr    = wcstem.radesys;\n\t\n\t    unput(' ');\n\t\n\t    keyname = \"RADECSYS\";\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the RADECSYS keyword is deprecated, use RADESYSa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 73:\nYY_RULE_SETUP\n#line 947 \"wcspih.l\"\n{\n\t  sscanf(yytext, \"EPOCH%c\", &a);\n\t\n\t  if (relax & WCSHDR_strict) {\n\t    errmsg = \"the EPOCH keyword is deprecated, use EQUINOXa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else if (a == ' ' || relax & WCSHDR_EPOCHa) {\n\t    valtype = FLOAT;\n\t    vptr    = &(wcstem.equinox);\n\t    special = wcspih_epoch;\n\t\n\t    unput(a);\n\t\n\t    keyname = \"EPOCH\";\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"EPOCH keyword may not have an alternate version code\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 74:\nYY_RULE_SETUP\n#line 973 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.equinox);\n\t\n\t  keyname = \"EQUINOXa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\tYY_BREAK\ncase 75:\nYY_RULE_SETUP\n#line 981 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.specsys;\n\t\n\t  keyname = \"SPECSYSa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\tYY_BREAK\ncase 76:\nYY_RULE_SETUP\n#line 989 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.ssysobs;\n\t\n\t  keyname = \"SSYSOBSa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\tYY_BREAK\ncase 77:\nYY_RULE_SETUP\n#line 997 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.velosys);\n\t\n\t  keyname = \"VELOSYSa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\tYY_BREAK\ncase 78:\nYY_RULE_SETUP\n#line 1005 \"wcspih.l\"\n{\n\t  if (relax & WCSHDR_VSOURCE) {\n\t    valtype = FLOAT;\n\t    vptr    = &(wcstem.zsource);\n\t    special = wcspih_vsource;\n\t\n\t    yyless(7);\n\t\n\t    keyname = \"VSOURCEa\";\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the VSOURCEa keyword is deprecated, use ZSOURCEa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 79:\nYY_RULE_SETUP\n#line 1025 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.zsource);\n\t\n\t  keyname = \"ZSOURCEa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\tYY_BREAK\ncase 80:\nYY_RULE_SETUP\n#line 1033 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.ssyssrc;\n\t\n\t  keyname = \"SSYSSRCa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\tYY_BREAK\ncase 81:\nYY_RULE_SETUP\n#line 1041 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.velangl);\n\t\n\t  keyname = \"VELANGLa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\tYY_BREAK\ncase 82:\nYY_RULE_SETUP\n#line 1049 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.rsun_ref);\n\t\n\t  keyname = \"RSUN_REF\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 83:\nYY_RULE_SETUP\n#line 1058 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.dsun_obs);\n\t\n\t  keyname = \"DSUN_OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 84:\nYY_RULE_SETUP\n#line 1067 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.crln_obs);\n\t\n\t  keyname = \"CRLN_OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 85:\nYY_RULE_SETUP\n#line 1076 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.hgln_obs);\n\t\n\t  keyname = \"HGLN_OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 86:\n#line 1086 \"wcspih.l\"\ncase 87:\nYY_RULE_SETUP\n#line 1086 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.hglt_obs);\n\t\n\t  keyname = \"HGLT_OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 88:\nYY_RULE_SETUP\n#line 1095 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  distype = PRIOR;\n\t  vptr    = &(distem.dtype);\n\t\n\t  keyname = \"CPDISja\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 89:\nYY_RULE_SETUP\n#line 1104 \"wcspih.l\"\n{\n\t  valtype = STRING;\n\t  distype = SEQUENT;\n\t  vptr    = &(distem.dtype);\n\t\n\t  keyname = \"CQDISia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 90:\nYY_RULE_SETUP\n#line 1113 \"wcspih.l\"\n{\n\t  valtype = RECORD;\n\t  distype = PRIOR;\n\t  vptr    = &(distem.dp);\n\t  npptr   = ndp;\n\t\n\t  keyname = \"DPja\";\n\t  BEGIN(CCia);\n\t}\n\tYY_BREAK\ncase 91:\nYY_RULE_SETUP\n#line 1123 \"wcspih.l\"\n{\n\t  valtype = RECORD;\n\t  distype = SEQUENT;\n\t  vptr    = &(distem.dp);\n\t  npptr   = ndq;\n\t\n\t  keyname = \"DQia\";\n\t  BEGIN(CCia);\n\t}\n\tYY_BREAK\ncase 92:\nYY_RULE_SETUP\n#line 1133 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  distype = PRIOR;\n\t  vptr    = &(distem.maxdis);\n\t\n\t  keyname = \"CPERRja\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 93:\nYY_RULE_SETUP\n#line 1142 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = &(distem.maxdis);\n\t\n\t  keyname = \"CQERRia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 94:\nYY_RULE_SETUP\n#line 1151 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  distype = PRIOR;\n\t  vptr    = &(distem.totdis);\n\t\n\t  keyname = \"DVERRa\";\n\t  BEGIN(CCCCCCCa);\n\t}\n\tYY_BREAK\ncase 95:\nYY_RULE_SETUP\n#line 1160 \"wcspih.l\"\n{\n\t  // SIP: axis 1 polynomial degree (not stored).\n\t  valtype = INTEGER;\n\t  distype = PRIOR;\n\t  vptr    = 0x0;\n\t\n\t  i = 1;\n\t  a = ' ';\n\t\n\t  keyname = \"A_ORDER\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 96:\nYY_RULE_SETUP\n#line 1173 \"wcspih.l\"\n{\n\t  // SIP: axis 2 polynomial degree (not stored).\n\t  valtype = INTEGER;\n\t  distype = PRIOR;\n\t  vptr    = 0x0;\n\t\n\t  i = 2;\n\t  a = ' ';\n\t\n\t  keyname = \"B_ORDER\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 97:\nYY_RULE_SETUP\n#line 1186 \"wcspih.l\"\n{\n\t  // SIP: axis 1 inverse polynomial degree (not stored).\n\t  valtype = INTEGER;\n\t  distype = PRIOR;\n\t  vptr    = 0x0;\n\t\n\t  i = 1;\n\t  a = ' ';\n\t\n\t  keyname = \"AP_ORDER\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 98:\nYY_RULE_SETUP\n#line 1199 \"wcspih.l\"\n{\n\t  // SIP: axis 2 inverse polynomial degree (not stored).\n\t  valtype = INTEGER;\n\t  distype = PRIOR;\n\t  vptr    = 0x0;\n\t\n\t  i = 2;\n\t  a = ' ';\n\t\n\t  keyname = \"BP_ORDER\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 99:\nYY_RULE_SETUP\n#line 1212 \"wcspih.l\"\n{\n\t  // SIP: axis 1 maximum distortion.\n\t  valtype = FLOAT;\n\t  distype = PRIOR;\n\t  vptr    = &(distem.maxdis);\n\t\n\t  i = 1;\n\t  a = ' ';\n\t\n\t  keyname = \"A_DMAX\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 100:\nYY_RULE_SETUP\n#line 1225 \"wcspih.l\"\n{\n\t  // SIP: axis 2 maximum distortion.\n\t  valtype = FLOAT;\n\t  distype = PRIOR;\n\t  vptr    = &(distem.maxdis);\n\t\n\t  i = 2;\n\t  a = ' ';\n\t\n\t  keyname = \"B_DMAX\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 101:\nYY_RULE_SETUP\n#line 1238 \"wcspih.l\"\n{\n\t  // SIP: axis 1 polynomial coefficient.\n\t  i = 1;\n\t  sipflag = 2;\n\t\n\t  keyname = \"A_p_q\";\n\t  BEGIN(SIP2);\n\t}\n\tYY_BREAK\ncase 102:\nYY_RULE_SETUP\n#line 1247 \"wcspih.l\"\n{\n\t  // SIP: axis 2 polynomial coefficient.\n\t  i = 2;\n\t  sipflag = 2;\n\t\n\t  keyname = \"B_p_q\";\n\t  BEGIN(SIP2);\n\t}\n\tYY_BREAK\ncase 103:\nYY_RULE_SETUP\n#line 1256 \"wcspih.l\"\n{\n\t  // SIP: axis 1 inverse polynomial coefficient.\n\t  i = 1;\n\t  sipflag = 3;\n\t\n\t  keyname = \"AP_p_q\";\n\t  BEGIN(SIP3);\n\t}\n\tYY_BREAK\ncase 104:\nYY_RULE_SETUP\n#line 1265 \"wcspih.l\"\n{\n\t  // SIP: axis 2 inverse polynomial coefficient.\n\t  i = 2;\n\t  sipflag = 3;\n\t\n\t  keyname = \"BP_p_q\";\n\t  BEGIN(SIP3);\n\t}\n\tYY_BREAK\ncase 105:\nYY_RULE_SETUP\n#line 1274 \"wcspih.l\"\n{\n\t  // DSS: LLH corner pixel coordinate 1.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"CNPIX1\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 106:\nYY_RULE_SETUP\n#line 1286 \"wcspih.l\"\n{\n\t  // DSS: LLH corner pixel coordinate 2.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+1;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"CNPIX1\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 107:\nYY_RULE_SETUP\n#line 1298 \"wcspih.l\"\n{\n\t  // DSS: plate centre x-coordinate in micron.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+2;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PPO3\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 108:\nYY_RULE_SETUP\n#line 1310 \"wcspih.l\"\n{\n\t  // DSS: plate centre y-coordinate in micron.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+3;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PPO6\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 109:\nYY_RULE_SETUP\n#line 1322 \"wcspih.l\"\n{\n\t  // DSS: pixel x-dimension in micron.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+4;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"XPIXELSZ\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 110:\nYY_RULE_SETUP\n#line 1334 \"wcspih.l\"\n{\n\t  // DSS: pixel y-dimension in micron.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+5;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"YPIXELSZ\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 111:\nYY_RULE_SETUP\n#line 1346 \"wcspih.l\"\n{\n\t  // DSS: plate centre, right ascension - hours.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+6;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PLTRAH\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 112:\nYY_RULE_SETUP\n#line 1358 \"wcspih.l\"\n{\n\t  // DSS: plate centre, right ascension - minutes.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+7;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PLTRAM\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 113:\nYY_RULE_SETUP\n#line 1370 \"wcspih.l\"\n{\n\t  // DSS: plate centre, right ascension - seconds.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+8;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PLTRAS\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 114:\nYY_RULE_SETUP\n#line 1382 \"wcspih.l\"\n{\n\t  // DSS: plate centre, declination - sign.\n\t  valtype = STRING;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+9;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PLTDECSN\";\n\t  BEGIN(PLTDECSN);\n\t}\n\tYY_BREAK\ncase 115:\nYY_RULE_SETUP\n#line 1394 \"wcspih.l\"\n{\n\t  // DSS: plate centre, declination - degrees.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+10;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PLTDECD\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 116:\nYY_RULE_SETUP\n#line 1406 \"wcspih.l\"\n{\n\t  // DSS: plate centre, declination - arcmin.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+11;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PLTDECM\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 117:\nYY_RULE_SETUP\n#line 1418 \"wcspih.l\"\n{\n\t  // DSS: plate centre, declination - arcsec.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+12;\n\t  dssflag = 1;\n\t  distran = DSS;\n\t\n\t  keyname = \"PLTDECS\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 118:\nYY_RULE_SETUP\n#line 1430 \"wcspih.l\"\n{\n\t  // DSS: plate identification (insufficient to trigger DSS).\n\t  valtype = STRING;\n\t  distype = SEQUENT;\n\t  vptr    = dsstmp+13;\n\t  dssflag = 2;\n\t  distran = 0;\n\t\n\t  keyname = \"PLATEID\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 119:\nYY_RULE_SETUP\n#line 1442 \"wcspih.l\"\n{\n\t  // DSS: axis 1 polynomial coefficient.\n\t  i = 1;\n\t  dssflag = 3;\n\t\n\t  keyname = \"AMDXm\";\n\t  BEGIN(DSSAMDXY);\n\t}\n\tYY_BREAK\ncase 120:\nYY_RULE_SETUP\n#line 1451 \"wcspih.l\"\n{\n\t  // DSS: axis 2 polynomial coefficient.\n\t  i = 2;\n\t  dssflag = 3;\n\t\n\t  keyname = \"AMDYm\";\n\t  BEGIN(DSSAMDXY);\n\t}\n\tYY_BREAK\ncase 121:\nYY_RULE_SETUP\n#line 1460 \"wcspih.l\"\n{\n\t  // TNX or ZPX: string-encoded data array.\n\t  sscanf(yytext, \"WAT%d_%d\", &i, &m);\n\t  if (watn < m) watn = m;\n\t  watflag = 1;\n\t\n\t  valtype = STRING;\n\t  distype = SEQUENT;\n\t  vptr = wat[i-1] + 68*(m-1);\n\t\n\t  a = ' ';\n\t  distran = WAT;\n\t\n\t  keyname = \"WATi_m\";\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 122:\nYY_RULE_SETUP\n#line 1477 \"wcspih.l\"\n{\n\t  if (yyextra->nkeyrec) {\n\t    yyextra->nkeyrec = 0;\n\t    errmsg = \"keyrecords following the END keyrecord were ignored\";\n\t    BEGIN(ERROR);\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 123:\nYY_RULE_SETUP\n#line 1487 \"wcspih.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 124:\n#line 1492 \"wcspih.l\"\ncase 125:\n#line 1493 \"wcspih.l\"\ncase 126:\n#line 1494 \"wcspih.l\"\ncase 127:\nYY_RULE_SETUP\n#line 1494 \"wcspih.l\"\n{\n\t  sscanf(yytext, \"%d%c\", &i, &a);\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 128:\n#line 1500 \"wcspih.l\"\ncase 129:\n#line 1501 \"wcspih.l\"\ncase 130:\n#line 1502 \"wcspih.l\"\ncase 131:\n#line 1503 \"wcspih.l\"\ncase 132:\n#line 1504 \"wcspih.l\"\ncase 133:\n#line 1505 \"wcspih.l\"\ncase 134:\nYY_RULE_SETUP\n#line 1505 \"wcspih.l\"\n{\n\t  if (relax & WCSHDR_reject) {\n\t    // Violates the basic FITS standard.\n\t    errmsg = \"indices in parameterized keywords must not have \"\n\t             \"leading zeroes\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 135:\n#line 1519 \"wcspih.l\"\ncase 136:\n#line 1520 \"wcspih.l\"\ncase 137:\n#line 1521 \"wcspih.l\"\ncase 138:\n#line 1522 \"wcspih.l\"\ncase 139:\n#line 1523 \"wcspih.l\"\ncase 140:\n#line 1524 \"wcspih.l\"\ncase 141:\n#line 1525 \"wcspih.l\"\ncase 142:\n#line 1526 \"wcspih.l\"\ncase 143:\nYY_RULE_SETUP\n#line 1526 \"wcspih.l\"\n{\n\t  // Anything that has fallen through to this point must contain\n\t  // an invalid axis number.\n\t  errmsg = \"axis number must exceed 0\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 144:\nYY_RULE_SETUP\n#line 1533 \"wcspih.l\"\n{\n\t  // Let it go.\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 145:\nYY_RULE_SETUP\n#line 1538 \"wcspih.l\"\n{\n\t  if (relax & WCSHDR_reject) {\n\t    // Looks too much like a FITS WCS keyword not to flag it.\n\t    errmsg = errtxt;\n\t    sprintf(errmsg, \"keyword looks very much like %s but isn't\",\n\t      keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Let it go.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 146:\n#line 1553 \"wcspih.l\"\ncase 147:\n#line 1554 \"wcspih.l\"\ncase 148:\n#line 1555 \"wcspih.l\"\ncase 149:\nYY_RULE_SETUP\n#line 1555 \"wcspih.l\"\n{\n\t  sscanf(yytext, \"%d_%d%c\", &i, &j, &a);\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 150:\n#line 1562 \"wcspih.l\"\ncase 151:\n#line 1563 \"wcspih.l\"\ncase 152:\n#line 1564 \"wcspih.l\"\ncase 153:\n#line 1565 \"wcspih.l\"\ncase 154:\n#line 1566 \"wcspih.l\"\ncase 155:\n#line 1567 \"wcspih.l\"\ncase 156:\n#line 1568 \"wcspih.l\"\ncase 157:\n#line 1569 \"wcspih.l\"\ncase 158:\n#line 1570 \"wcspih.l\"\ncase 159:\n#line 1571 \"wcspih.l\"\ncase 160:\n#line 1572 \"wcspih.l\"\ncase 161:\n#line 1573 \"wcspih.l\"\ncase 162:\n#line 1574 \"wcspih.l\"\ncase 163:\n#line 1575 \"wcspih.l\"\ncase 164:\n#line 1576 \"wcspih.l\"\ncase 165:\n#line 1577 \"wcspih.l\"\ncase 166:\n#line 1578 \"wcspih.l\"\ncase 167:\n#line 1579 \"wcspih.l\"\ncase 168:\n#line 1580 \"wcspih.l\"\ncase 169:\n#line 1581 \"wcspih.l\"\ncase 170:\nYY_RULE_SETUP\n#line 1581 \"wcspih.l\"\n{\n\t  if (((altlin == 1) && (relax & WCSHDR_PC0i_0ja)) ||\n\t      ((altlin == 2) && (relax & WCSHDR_CD0i_0ja))) {\n\t    sscanf(yytext, \"%d_%d%c\", &i, &j, &a);\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"indices in parameterized keywords must not have \"\n\t             \"leading zeroes\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 171:\n#line 1599 \"wcspih.l\"\ncase 172:\n#line 1600 \"wcspih.l\"\ncase 173:\n#line 1601 \"wcspih.l\"\ncase 174:\n#line 1602 \"wcspih.l\"\ncase 175:\n#line 1603 \"wcspih.l\"\ncase 176:\n#line 1604 \"wcspih.l\"\ncase 177:\n#line 1605 \"wcspih.l\"\ncase 178:\n#line 1606 \"wcspih.l\"\ncase 179:\n#line 1607 \"wcspih.l\"\ncase 180:\nYY_RULE_SETUP\n#line 1607 \"wcspih.l\"\n{\n\t  // Anything that has fallen through to this point must contain\n\t  // an invalid axis number.\n\t  errmsg = \"axis number must exceed 0\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 181:\n#line 1615 \"wcspih.l\"\ncase 182:\n#line 1616 \"wcspih.l\"\ncase 183:\n#line 1617 \"wcspih.l\"\ncase 184:\n#line 1618 \"wcspih.l\"\ncase 185:\n#line 1619 \"wcspih.l\"\ncase 186:\n#line 1620 \"wcspih.l\"\ncase 187:\n#line 1621 \"wcspih.l\"\ncase 188:\n#line 1622 \"wcspih.l\"\ncase 189:\n#line 1623 \"wcspih.l\"\ncase 190:\nYY_RULE_SETUP\n#line 1623 \"wcspih.l\"\n{\n\t  errmsg = errtxt;\n\t  sprintf(errmsg, \"%s keyword must use an underscore, not a dash\",\n\t    keyname);\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 191:\nYY_RULE_SETUP\n#line 1630 \"wcspih.l\"\n{\n\t  // This covers the defunct forms CD00i00j and PC00i00j.\n\t  if (((altlin == 1) && (relax & WCSHDR_PC00i00j)) ||\n\t      ((altlin == 2) && (relax & WCSHDR_CD00i00j))) {\n\t    sscanf(yytext, \"%3d%3d\", &i, &j);\n\t    a = ' ';\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"this form of the %s keyword is deprecated, use %s\",\n\t      keyname, keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 192:\nYY_RULE_SETUP\n#line 1651 \"wcspih.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 193:\n#line 1656 \"wcspih.l\"\ncase 194:\nYY_RULE_SETUP\n#line 1656 \"wcspih.l\"\n{\n\t  if (YY_START == CCCCCCCa) {\n\t    sscanf(yytext, \"%c\", &a);\n\t  } else {\n\t    unput(yytext[0]);\n\t    a = 0;\n\t  }\n\t\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 195:\nYY_RULE_SETUP\n#line 1667 \"wcspih.l\"\n{\n\t  if (relax & WCSHDR_reject) {\n\t    // Looks too much like a FITS WCS keyword not to flag it.\n\t    errmsg = errtxt;\n\t    sprintf(errmsg, \"invalid alternate code, keyword resembles %s \"\n\t      \"but isn't\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 196:\n#line 1682 \"wcspih.l\"\ncase 197:\n#line 1683 \"wcspih.l\"\ncase 198:\n#line 1684 \"wcspih.l\"\ncase 199:\nYY_RULE_SETUP\n#line 1684 \"wcspih.l\"\n{\n\t  sscanf(yytext, \"%d_%d%c\", &i, &m, &a);\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 200:\n#line 1690 \"wcspih.l\"\ncase 201:\n#line 1691 \"wcspih.l\"\ncase 202:\n#line 1692 \"wcspih.l\"\ncase 203:\n#line 1693 \"wcspih.l\"\ncase 204:\n#line 1694 \"wcspih.l\"\ncase 205:\n#line 1695 \"wcspih.l\"\ncase 206:\n#line 1696 \"wcspih.l\"\ncase 207:\n#line 1697 \"wcspih.l\"\ncase 208:\n#line 1698 \"wcspih.l\"\ncase 209:\n#line 1699 \"wcspih.l\"\ncase 210:\n#line 1700 \"wcspih.l\"\ncase 211:\n#line 1701 \"wcspih.l\"\ncase 212:\n#line 1702 \"wcspih.l\"\ncase 213:\n#line 1703 \"wcspih.l\"\ncase 214:\n#line 1704 \"wcspih.l\"\ncase 215:\n#line 1705 \"wcspih.l\"\ncase 216:\n#line 1706 \"wcspih.l\"\ncase 217:\n#line 1707 \"wcspih.l\"\ncase 218:\n#line 1708 \"wcspih.l\"\ncase 219:\n#line 1709 \"wcspih.l\"\ncase 220:\nYY_RULE_SETUP\n#line 1709 \"wcspih.l\"\n{\n\t  if (((valtype == FLOAT)  && (relax & WCSHDR_PV0i_0ma)) ||\n\t      ((valtype == STRING) && (relax & WCSHDR_PS0i_0ma))) {\n\t    sscanf(yytext, \"%d_%d%c\", &i, &m, &a);\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"indices in parameterized keywords must not have \"\n\t             \"leading zeroes\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 221:\n#line 1727 \"wcspih.l\"\ncase 222:\n#line 1728 \"wcspih.l\"\ncase 223:\n#line 1729 \"wcspih.l\"\ncase 224:\n#line 1730 \"wcspih.l\"\ncase 225:\n#line 1731 \"wcspih.l\"\ncase 226:\n#line 1732 \"wcspih.l\"\ncase 227:\n#line 1733 \"wcspih.l\"\ncase 228:\n#line 1734 \"wcspih.l\"\ncase 229:\n#line 1735 \"wcspih.l\"\ncase 230:\nYY_RULE_SETUP\n#line 1735 \"wcspih.l\"\n{\n\t  // Anything that has fallen through to this point must contain\n\t  // an invalid axis number.\n\t  errmsg = \"axis number must exceed 0\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 231:\n#line 1743 \"wcspih.l\"\ncase 232:\n#line 1744 \"wcspih.l\"\ncase 233:\n#line 1745 \"wcspih.l\"\ncase 234:\n#line 1746 \"wcspih.l\"\ncase 235:\n#line 1747 \"wcspih.l\"\ncase 236:\n#line 1748 \"wcspih.l\"\ncase 237:\n#line 1749 \"wcspih.l\"\ncase 238:\n#line 1750 \"wcspih.l\"\ncase 239:\n#line 1751 \"wcspih.l\"\ncase 240:\nYY_RULE_SETUP\n#line 1751 \"wcspih.l\"\n{\n\t  errmsg = errtxt;\n\t  sprintf(errmsg, \"%s keyword must use an underscore, not a dash\",\n\t    keyname);\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 241:\nYY_RULE_SETUP\n#line 1758 \"wcspih.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 242:\n#line 1763 \"wcspih.l\"\ncase 243:\n#line 1764 \"wcspih.l\"\ncase 244:\nYY_RULE_SETUP\n#line 1764 \"wcspih.l\"\n{\n\t  a = ' ';\n\t  sscanf(yytext, \"%d%c\", &i, &a);\n\t\n\t  if (relax & WCSHDR_strict) {\n\t    errmsg = \"the CROTAn keyword is deprecated, use PCi_ja\";\n\t    BEGIN(ERROR);\n\t\n\t  } else if ((a == ' ') || (relax & WCSHDR_CROTAia)) {\n\t    yyless(0);\n\t    BEGIN(CCCCCia);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"CROTAn keyword may not have an alternate version code\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 245:\nYY_RULE_SETUP\n#line 1786 \"wcspih.l\"\n{\n\t  yyless(0);\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 246:\nYY_RULE_SETUP\n#line 1791 \"wcspih.l\"\n{\n\t  if (relax & WCSHDR_PROJPn) {\n\t    sscanf(yytext, \"%d\", &m);\n\t    i = 0;\n\t    a = ' ';\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the PROJPn keyword is deprecated, use PVi_ma\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 247:\n#line 1808 \"wcspih.l\"\ncase 248:\nYY_RULE_SETUP\n#line 1808 \"wcspih.l\"\n{\n\t  if (relax & (WCSHDR_PROJPn | WCSHDR_reject)) {\n\t    errmsg = \"invalid PROJPn keyword\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 249:\nYY_RULE_SETUP\n#line 1818 \"wcspih.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 250:\n#line 1823 \"wcspih.l\"\ncase 251:\nYY_RULE_SETUP\n#line 1823 \"wcspih.l\"\n{\n\t  // SIP keywords.\n\t  valtype = FLOAT;\n\t  distype = PRIOR;\n\t  vptr    = &(distem.dp);\n\t  npptr   = ndp;\n\t\n\t  a = ' ';\n\t  distran = SIP;\n\t\n\t  sscanf(yytext, \"%d_%d\", &p, &q);\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 252:\n#line 1838 \"wcspih.l\"\ncase 253:\nYY_RULE_SETUP\n#line 1838 \"wcspih.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 254:\n#line 1843 \"wcspih.l\"\ncase 255:\nYY_RULE_SETUP\n#line 1843 \"wcspih.l\"\n{\n\t  // DSS keywords.\n\t  valtype = FLOAT;\n\t  distype = SEQUENT;\n\t  vptr    = &(distem.dp);\n\t  npptr   = ndq;\n\t\n\t  a = ' ';\n\t  distran = DSS;\n\t\n\t  sscanf(yytext, \"%d\", &m);\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 256:\nYY_RULE_SETUP\n#line 1857 \"wcspih.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 257:\n/* rule 257 can match eol */\nYY_RULE_SETUP\n#line 1861 \"wcspih.l\"\n{\n\t  // Special handling for this iconic DSS keyword.\n\t  if (1 < ipass) {\n\t    // Look for a minus sign.\n\t    sscanf(yytext, \"= '%s\", strtmp);\n\t    dbltmp = strcmp(strtmp, \"-\") ? 1.0 : -1.0;\n\t  }\n\t\n\t  BEGIN(COMMENT);\n\t}\n\tYY_BREAK\ncase 258:\nYY_RULE_SETUP\n#line 1872 \"wcspih.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 259:\nYY_RULE_SETUP\n#line 1876 \"wcspih.l\"\n{\n\t  // Do checks on i, j & m.\n\t  if (99 < i || 99 < j || 99 < m) {\n\t    if (relax & WCSHDR_reject) {\n\t      if (99 < i || 99 < j) {\n\t        errmsg = \"axis number exceeds 99\";\n\t      } else if (m > 99) {\n\t        errmsg = \"parameter number exceeds 99\";\n\t      }\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      // Pretend we don't recognize it.\n\t      BEGIN(DISCARD);\n\t    }\n\t\n\t  } else {\n\t    if (valtype == INTEGER) {\n\t      BEGIN(INTEGER_VAL);\n\t    } else if (valtype == FLOAT) {\n\t      BEGIN(FLOAT_VAL);\n\t    } else if (valtype == FLOAT2) {\n\t      BEGIN(FLOAT2_VAL);\n\t    } else if (valtype == STRING) {\n\t      BEGIN(STRING_VAL);\n\t    } else if (valtype == RECORD) {\n\t      BEGIN(RECORD_VAL);\n\t    } else {\n\t      errmsg = errtxt;\n\t      sprintf(errmsg, \"internal parser ERROR, bad data type: %d\",\n\t        valtype);\n\t      BEGIN(ERROR);\n\t    }\n\t  }\n\t}\n\tYY_BREAK\ncase 260:\nYY_RULE_SETUP\n#line 1912 \"wcspih.l\"\n{\n\t  errmsg = \"invalid KEYWORD = VALUE syntax\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 261:\nYY_RULE_SETUP\n#line 1917 \"wcspih.l\"\n{\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    // Read the keyvalue.\n\t    sscanf(yytext, \"%d\", &inttmp);\n\t\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\tYY_BREAK\ncase 262:\nYY_RULE_SETUP\n#line 1929 \"wcspih.l\"\n{\n\t  errmsg = \"an integer value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 263:\nYY_RULE_SETUP\n#line 1934 \"wcspih.l\"\n{\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    // Read the keyvalue.\n\t    wcsutil_str2double(yytext, &dbltmp);\n\n\t    if (chekval && chekval(dbltmp)) {\n\t      errmsg = \"invalid keyvalue\";\n\t      BEGIN(ERROR);\n\t    } else {\n\t      BEGIN(COMMENT);\n\t    }\n\t  }\n\t}\n\tYY_BREAK\ncase 264:\nYY_RULE_SETUP\n#line 1951 \"wcspih.l\"\n{\n\t  errmsg = \"a floating-point value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 265:\nYY_RULE_SETUP\n#line 1956 \"wcspih.l\"\n{\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    // Read the keyvalue as integer and fractional parts.\n\t    wcsutil_str2double2(yytext, dbl2tmp);\n\t\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\tYY_BREAK\ncase 266:\nYY_RULE_SETUP\n#line 1968 \"wcspih.l\"\n{\n\t  errmsg = \"a floating-point value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 267:\n/* rule 267 can match eol */\nYY_RULE_SETUP\n#line 1973 \"wcspih.l\"\n{\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    // Read the keyvalue.\n\t    strcpy(strtmp, yytext+1);\n\t\n\t    // Squeeze out repeated quotes.\n\t    int ix = 0;\n\t    for (int jx = 0; jx < 72; jx++) {\n\t      if (ix < jx) {\n\t        strtmp[ix] = strtmp[jx];\n\t      }\n\t\n\t      if (strtmp[jx] == '\\0') {\n\t        if (ix) strtmp[ix-1] = '\\0';\n\t        break;\n\t      } else if (strtmp[jx] == '\\'' && strtmp[jx+1] == '\\'') {\n\t        jx++;\n\t      }\n\t\n\t      ix++;\n\t    }\n\t\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\tYY_BREAK\ncase 268:\nYY_RULE_SETUP\n#line 2002 \"wcspih.l\"\n{\n\t  errmsg = \"a string value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 269:\n/* rule 269 can match eol */\nYY_RULE_SETUP\n#line 2007 \"wcspih.l\"\n{\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    yyless(1);\n\t\n\t    BEGIN(RECFIELD);\n\t  }\n\t}\n\tYY_BREAK\ncase 270:\nYY_RULE_SETUP\n#line 2018 \"wcspih.l\"\n{\n\t  errmsg = \"a record was expected\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 271:\nYY_RULE_SETUP\n#line 2023 \"wcspih.l\"\n{\n\t  strcpy(strtmp, yytext);\n\t  BEGIN(RECCOLON);\n\t}\n\tYY_BREAK\ncase 272:\nYY_RULE_SETUP\n#line 2028 \"wcspih.l\"\n{\n\t  errmsg = \"invalid record field\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 273:\nYY_RULE_SETUP\n#line 2033 \"wcspih.l\"\n{\n\t  BEGIN(RECVALUE);\n\t}\n\tYY_BREAK\ncase 274:\nYY_RULE_SETUP\n#line 2037 \"wcspih.l\"\n{\n\t  errmsg = \"invalid record syntax\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 275:\nYY_RULE_SETUP\n#line 2042 \"wcspih.l\"\n{\n\t  rectype = 0;\n\t  sscanf(yytext, \"%d\", &inttmp);\n\t  BEGIN(RECEND);\n\t}\n\tYY_BREAK\ncase 276:\nYY_RULE_SETUP\n#line 2048 \"wcspih.l\"\n{\n\t  rectype = 1;\n\t  wcsutil_str2double(yytext, &dbltmp);\n\t  BEGIN(RECEND);\n\t}\n\tYY_BREAK\ncase 277:\nYY_RULE_SETUP\n#line 2054 \"wcspih.l\"\n{\n\t  errmsg = \"invalid record value\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 278:\nYY_RULE_SETUP\n#line 2059 \"wcspih.l\"\n{\n\t  BEGIN(COMMENT);\n\t}\n\tYY_BREAK\ncase 279:\n*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */\nyyg->yy_c_buf_p = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up yytext again */\nYY_RULE_SETUP\n#line 2063 \"wcspih.l\"\n{\n\t  if (ipass == 1) {\n\t    // Do first-pass bookkeeping.\n\t    wcspih_pass1(naxis, i, j, a, distype, alts, dpq, npptr);\n\t    BEGIN(FLUSH);\n\t\n\t  } else if (*wcs) {\n\t    // Store the value now that the keyrecord has been validated.\n\t    int gotone = 0;\n\t    for (int ialt = 0; ialt < *nwcs; ialt++) {\n\t      // The loop here is for keywords that apply\n\t      // to every alternate; these have a == 0.\n\t      if (a >= 'A') {\n\t        ialt = alts[a-'A'+1];\n\t        if (ialt < 0) break;\n\t      }\n\t      gotone = 1;\n\t\n\t      if (vptr) {\n\t        if (sipflag) {\n\t          // Translate a SIP keyword into DPja.\n\t          struct disprm *disp = (*wcs)->lin.dispre;\n\t          int ipx = (disp->ndp)++;\n\t\n\t          // SIP doesn't have alternates.\n\t\t  char keyword[16];\n\t          sprintf(keyword, \"DP%d\", i);\n\t          sprintf(strtmp, \"SIP.%s.%d_%d\", (sipflag==2)?\"FWD\":\"REV\",\n\t                  p, q);\n\t          if (valtype == INTEGER) {\n\t            dpfill(disp->dp+ipx, keyword, strtmp, i, 0, inttmp, 0.0);\n\t          } else {\n\t            dpfill(disp->dp+ipx, keyword, strtmp, i, 1, 0, dbltmp);\n\t          }\n\t\n\t        } else if (dssflag) {\n\t          // All DSS keywords require special handling.\n\t          if (dssflag == 1) {\n\t            // Temporary parameter for DSS used by wcspih_final().\n\t            *((double *)vptr) = dbltmp;\n\t\n\t          } else if (dssflag == 2) {\n\t            // Temporary parameter for DSS used by wcspih_final().\n\t            strcpy((char *)vptr, strtmp);\n\t\n\t          } else {\n\t            // Translate a DSS keyword into DQia.\n\t            if (m <= 13 || dbltmp != 0.0) {\n\t              struct disprm *disp = (*wcs)->lin.disseq;\n\t              int ipx = (disp->ndp)++;\n\t\n\t              // DSS doesn't have alternates.\n\t\t      char keyword[16];\n\t              sprintf(keyword, \"DQ%d\", i);\n\t              sprintf(strtmp, \"DSS.AMD.%d\", m);\n\t              dpfill(disp->dp+ipx, keyword, strtmp, i, 1, 0, dbltmp);\n\t\n\t              // Also required by wcspih_final().\n\t              if (m <= 3) {\n\t                dsstmp[13+(i-1)*3+m] = dbltmp;\n\t              }\n\t            }\n\t          }\n\t\n\t        } else if (watflag) {\n\t          // String array for TNX and ZPX used by wcspih_final().\n\t          strcpy((char *)vptr, strtmp);\n\t\n\t        } else {\n\t          // An \"ordinary\" keyword.\n\t          struct wcsprm *wcsp = *wcs + ialt;\n\t\t  struct disprm *disp;\n\t          void *wptr;\n\t          ptrdiff_t voff;\n\t          if (auxprm) {\n\t            // Additional auxiliary parameter.\n\t            struct auxprm *auxp = wcsp->aux;\n\t            voff = (char *)vptr - (char *)(&auxtem);\n\t            wptr = (void *)((char *)auxp + voff);\n\t\n\t          } else if (distype) {\n\t            // Distortion parameter of some kind.\n\t            if (distype == PRIOR) {\n\t              // Prior distortion.\n\t              disp = wcsp->lin.dispre;\n\t            } else {\n\t              // Sequent distortion.\n\t              disp = wcsp->lin.disseq;\n\t            }\n\t            voff = (char *)vptr - (char *)(&distem);\n\t            wptr = (void *)((char *)disp + voff);\n\t\n\t          } else {\n\t            // A parameter that lives directly in wcsprm.\n\t            voff = (char *)vptr - (char *)(&wcstem);\n\t            wptr = (void *)((char *)wcsp + voff);\n\t          }\n\t\n\t          if (valtype == INTEGER) {\n\t            *((int *)wptr) = inttmp;\n\t\n\t          } else if (valtype == FLOAT) {\n\t            // Apply keyword parameterization.\n\t            if (npptr == npv) {\n\t              int ipx = (wcsp->npv)++;\n\t              wcsp->pv[ipx].i = i;\n\t              wcsp->pv[ipx].m = m;\n\t              wptr = &(wcsp->pv[ipx].value);\n\t\n\t            } else if (j) {\n\t              wptr = *((double **)wptr) + (i - 1)*(wcsp->naxis)\n\t                                        + (j - 1);\n\t\n\t            } else if (i) {\n\t              wptr = *((double **)wptr) + (i - 1);\n\t            }\n\t\n\t            if (special) {\n\t              special(wptr, &dbltmp);\n\t            } else {\n\t              *((double *)wptr) = dbltmp;\n\t            }\n\t\n\t            // Flag presence of PCi_ja, or CDi_ja and/or CROTAia.\n\t            if (altlin) {\n\t              wcsp->altlin |= altlin;\n\t              altlin = 0;\n\t            }\n\t\n\t          } else if (valtype == FLOAT2) {\n\t            // Split MJDREF and JDREF into integer and fraction.\n\t            if (special) {\n\t              special(wptr, dbl2tmp);\n\t            } else {\n\t              *((double *)wptr) = dbl2tmp[0];\n\t              *((double *)wptr + 1) = dbl2tmp[1];\n\t            }\n\t\n\t          } else if (valtype == STRING) {\n\t            // Apply keyword parameterization.\n\t            if (npptr == nps) {\n\t              int ipx = (wcsp->nps)++;\n\t              wcsp->ps[ipx].i = i;\n\t              wcsp->ps[ipx].m = m;\n\t              wptr = wcsp->ps[ipx].value;\n\t\n\t            } else if (j) {\n\t              wptr = *((char (**)[72])wptr) +\n\t                      (i - 1)*(wcsp->naxis) + (j - 1);\n\t\n\t            } else if (i) {\n\t              wptr = *((char (**)[72])wptr) + (i - 1);\n\t            }\n\t\n\t            char *cptr = (char *)wptr;\n\t            strcpy(cptr, strtmp);\n\t\n\t          } else if (valtype == RECORD) {\n\t            int ipx = (disp->ndp)++;\n\t\n\t\t    char keyword[16];\n\t            if (a == ' ') {\n\t              sprintf(keyword, \"%.2s%d\", keyname, i);\n\t            } else {\n\t              sprintf(keyword, \"%.2s%d%c\", keyname, i, a);\n\t            }\n\t\n\t            dpfill(disp->dp+ipx, keyword, strtmp, i, rectype, inttmp,\n\t                   dbltmp);\n\t          }\n\t        }\n\t      }\n\t\n\t      if (a) break;\n\t    }\n\t\n\t    if (gotone) {\n\t      nvalid++;\n\t      if (ctrl == 4) {\n\t        if (distran || dssflag) {\n\t          wcsfprintf(stderr, \"%.80s\\n  Accepted (%d) as a \"\n\t            \"recognized WCS convention.\\n\", keyrec, nvalid);\n\t        } else {\n\t          wcsfprintf(stderr, \"%.80s\\n  Accepted (%d) as a \"\n\t            \"valid WCS keyrecord.\\n\", keyrec, nvalid);\n\t        }\n\t      }\n\t\n\t      BEGIN(FLUSH);\n\t\n\t    } else {\n\t      errmsg = \"syntactically valid WCS keyrecord has no effect\";\n\t      BEGIN(ERROR);\n\t    }\n\t\n\t  } else {\n\t    BEGIN(FLUSH);\n\t  }\n\t}\n\tYY_BREAK\ncase 280:\n*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */\nyyg->yy_c_buf_p = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up yytext again */\nYY_RULE_SETUP\n#line 2263 \"wcspih.l\"\n{\n\t  errmsg = \"invalid keyvalue\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 281:\n*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */\nyyg->yy_c_buf_p = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up yytext again */\nYY_RULE_SETUP\n#line 2268 \"wcspih.l\"\n{\n\t  errmsg = \"invalid keyvalue\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 282:\n*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */\nyyg->yy_c_buf_p = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up yytext again */\nYY_RULE_SETUP\n#line 2273 \"wcspih.l\"\n{\n\t  errmsg = \"invalid keyvalue or malformed keycomment\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 283:\n*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */\nyyg->yy_c_buf_p = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up yytext again */\nYY_RULE_SETUP\n#line 2278 \"wcspih.l\"\n{\n\t  errmsg = \"malformed keycomment\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 284:\n*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */\nyyg->yy_c_buf_p = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up yytext again */\nYY_RULE_SETUP\n#line 2283 \"wcspih.l\"\n{\n\t  if (ipass == npass) {\n\t    if (ctrl < 0) {\n\t      // Preserve discards.\n\t      keep = keyrec;\n\t\n\t    } else if (2 < ctrl) {\n\t      nother++;\n\t      wcsfprintf(stderr, \"%.80s\\n  Not a recognized WCS keyword.\\n\",\n\t        keyrec);\n\t    }\n\t  }\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 285:\n*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */\nyyg->yy_c_buf_p = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up yytext again */\nYY_RULE_SETUP\n#line 2298 \"wcspih.l\"\n{\n\t  if (ipass == npass) {\n\t    (*nreject)++;\n\t\n\t    if (ctrl%10 == -1) {\n\t      // Preserve rejects.\n\t      keep = keyrec;\n\t    }\n\t\n\t    if (1 < abs(ctrl%10)) {\n\t      wcsfprintf(stderr, \"%.80s\\n  Rejected (%d), %s.\\n\",\n\t        keyrec, *nreject, errmsg);\n\t    }\n\t  }\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 286:\n/* rule 286 can match eol */\nYY_RULE_SETUP\n#line 2315 \"wcspih.l\"\n{\n\t  if (ipass == npass && keep) {\n\t    if (hptr < keep) {\n\t      strncpy(hptr, keep, 80);\n\t    }\n\t    hptr += 80;\n\t  }\n\t\n\t  naux += auxprm;\n\t\n\t  // Throw away the rest of the line and reset for the next one.\n\t  i = j = 0;\n\t  m = 0;\n\t  a = ' ';\n\t\n\t  keyrec += 80;\n\t\n\t  valtype = -1;\n\t  distype =  0;\n\t  vptr    = 0x0;\n\t  keep    = 0x0;\n\t\n\t  altlin  = 0;\n\t  npptr   = 0x0;\n\t  chekval = 0x0;\n\t  special = 0x0;\n\t  auxprm  = 0;\n\t  sipflag = 0;\n\t  dssflag = 0;\n\t  watflag = 0;\n\t\n\t  BEGIN(INITIAL);\n\t}\n\tYY_BREAK\ncase YY_STATE_EOF(INITIAL):\ncase YY_STATE_EOF(CCia):\ncase YY_STATE_EOF(CCi_ja):\ncase YY_STATE_EOF(CCCCCia):\ncase YY_STATE_EOF(CCi_ma):\ncase YY_STATE_EOF(CCCCCCCa):\ncase YY_STATE_EOF(CCCCCCCC):\ncase YY_STATE_EOF(CROTAi):\ncase YY_STATE_EOF(PROJPn):\ncase YY_STATE_EOF(SIP2):\ncase YY_STATE_EOF(SIP3):\ncase YY_STATE_EOF(DSSAMDXY):\ncase YY_STATE_EOF(PLTDECSN):\ncase YY_STATE_EOF(VALUE):\ncase YY_STATE_EOF(INTEGER_VAL):\ncase YY_STATE_EOF(FLOAT_VAL):\ncase YY_STATE_EOF(FLOAT2_VAL):\ncase YY_STATE_EOF(STRING_VAL):\ncase YY_STATE_EOF(RECORD_VAL):\ncase YY_STATE_EOF(RECFIELD):\ncase YY_STATE_EOF(RECCOLON):\ncase YY_STATE_EOF(RECVALUE):\ncase YY_STATE_EOF(RECEND):\ncase YY_STATE_EOF(COMMENT):\ncase YY_STATE_EOF(DISCARD):\ncase YY_STATE_EOF(ERROR):\ncase YY_STATE_EOF(FLUSH):\n#line 2349 \"wcspih.l\"\n{\n\t  // End-of-input.\n\t  int status;\n\t  if (ipass == 1) {\n\t    if ((status = wcspih_init1(naxis, alts, dpq, npv, nps, ndp, ndq,\n\t                               naux, distran, nwcs, wcs)) ||\n\t        (*nwcs == 0 && ctrl == 0)) {\n\t      return status;\n\t    }\n\t\n\t    if (2 < abs(ctrl%10)) {\n\t      if (*nwcs == 1) {\n\t        if (strcmp(wcs[0]->wcsname, \"DEFAULTS\") != 0) {\n\t          wcsfprintf(stderr, \"Found one coordinate representation.\\n\");\n\t        }\n\t      } else {\n\t        wcsfprintf(stderr, \"Found %d coordinate representations.\\n\",\n\t          *nwcs);\n\t      }\n\t    }\n\t\n\t    watstr = calloc(2*(watn*68 + 1), sizeof(char));\n\t    wat[0] = watstr;\n\t    wat[1] = watstr + watn*68 + 1;\n\t  }\n\t\n\t  if (ipass++ < npass) {\n\t    yyextra->hdr = header;\n\t    yyextra->nkeyrec = nkeyrec;\n\t    keyrec = header;\n\t    *nreject = 0;\n\t\n\t    i = j = 0;\n\t    m = 0;\n\t    a = ' ';\n\t\n\t    valtype = -1;\n\t    distype =  0;\n\t    vptr    = 0x0;\n\t\n\t    altlin  = 0;\n\t    npptr   = 0x0;\n\t    chekval = 0x0;\n\t    special = 0x0;\n\t    auxprm  = 0;\n\t    sipflag = 0;\n\t    dssflag = 0;\n\t    watflag = 0;\n\t\n\t    yyrestart(yyin, yyscanner);\n\t\n\t  } else {\n\t\n\t    if (ctrl < 0) {\n\t      *hptr = '\\0';\n\t    } else if (ctrl == 1) {\n\t      wcsfprintf(stderr, \"%d WCS keyrecord%s rejected.\\n\",\n\t        *nreject, (*nreject==1)?\" was\":\"s were\");\n\t    } else if (ctrl == 4) {\n\t      wcsfprintf(stderr, \"\\n\");\n\t      wcsfprintf(stderr, \"%5d keyrecord%s rejected for syntax or \"\n\t        \"other errors,\\n\", *nreject, (*nreject==1)?\" was\":\"s were\");\n\t      wcsfprintf(stderr, \"%5d %s recognized as syntactically valid, \"\n\t        \"and\\n\", nvalid, (nvalid==1)?\"was\":\"were\");\n\t      wcsfprintf(stderr, \"%5d other%s were not recognized as WCS \"\n\t        \"keyrecords.\\n\", nother, (nother==1)?\"\":\"s\");\n\t    }\n\t\n\t    status = wcspih_final(ndp, ndq, distran, dsstmp, wat, nwcs, wcs);\n\t    free(watstr);\n\t    return status;\n\t  }\n\t}\n\tYY_BREAK\ncase 287:\nYY_RULE_SETUP\n#line 2423 \"wcspih.l\"\nECHO;\n\tYY_BREAK\n#line 24160 \"wcspih.c\"\n\n\tcase YY_END_OF_BUFFER:\n\t\t{\n\t\t/* Amount of text matched not including the EOB char. */\n\t\tint yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;\n\n\t\t/* Undo the effects of YY_DO_BEFORE_ACTION. */\n\t\t*yy_cp = yyg->yy_hold_char;\n\t\tYY_RESTORE_YY_MORE_OFFSET\n\n\t\tif ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )\n\t\t\t{\n\t\t\t/* We're scanning a new file or input source.  It's\n\t\t\t * possible that this happened because the user\n\t\t\t * just pointed yyin at a new source and called\n\t\t\t * yylex().  If so, then we have to assure\n\t\t\t * consistency between YY_CURRENT_BUFFER and our\n\t\t\t * globals.  Here is the right place to do so, because\n\t\t\t * this is the first action (other than possibly a\n\t\t\t * back-up) that will match for the new input source.\n\t\t\t */\n\t\t\tyyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;\n\t\t\t}\n\n\t\t/* Note that here we test for yy_c_buf_p \"<=\" to the position\n\t\t * of the first EOB in the buffer, since yy_c_buf_p will\n\t\t * already have been incremented past the NUL character\n\t\t * (since all states make transitions on EOB to the\n\t\t * end-of-buffer state).  Contrast this with the test\n\t\t * in input().\n\t\t */\n\t\tif ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )\n\t\t\t{ /* This was really a NUL. */\n\t\t\tyy_state_type yy_next_state;\n\n\t\t\tyyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;\n\n\t\t\tyy_current_state = yy_get_previous_state( yyscanner );\n\n\t\t\t/* Okay, we're now positioned to make the NUL\n\t\t\t * transition.  We couldn't have\n\t\t\t * yy_get_previous_state() go ahead and do it\n\t\t\t * for us because it doesn't know how to deal\n\t\t\t * with the possibility of jamming (and we don't\n\t\t\t * want to build jamming into it because then it\n\t\t\t * will run more slowly).\n\t\t\t */\n\n\t\t\tyy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);\n\n\t\t\tyy_bp = yyg->yytext_ptr + YY_MORE_ADJ;\n\n\t\t\tif ( yy_next_state )\n\t\t\t\t{\n\t\t\t\t/* Consume the NUL. */\n\t\t\t\tyy_cp = ++yyg->yy_c_buf_p;\n\t\t\t\tyy_current_state = yy_next_state;\n\t\t\t\tgoto yy_match;\n\t\t\t\t}\n\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tyy_cp = yyg->yy_c_buf_p;\n\t\t\t\tgoto yy_find_action;\n\t\t\t\t}\n\t\t\t}\n\n\t\telse switch ( yy_get_next_buffer( yyscanner ) )\n\t\t\t{\n\t\t\tcase EOB_ACT_END_OF_FILE:\n\t\t\t\t{\n\t\t\t\tyyg->yy_did_buffer_switch_on_eof = 0;\n\n\t\t\t\tif ( yywrap( yyscanner ) )\n\t\t\t\t\t{\n\t\t\t\t\t/* Note: because we've taken care in\n\t\t\t\t\t * yy_get_next_buffer() to have set up\n\t\t\t\t\t * yytext, we can now set up\n\t\t\t\t\t * yy_c_buf_p so that if some total\n\t\t\t\t\t * hoser (like flex itself) wants to\n\t\t\t\t\t * call the scanner after we return the\n\t\t\t\t\t * YY_NULL, it'll still work - another\n\t\t\t\t\t * YY_NULL will get returned.\n\t\t\t\t\t */\n\t\t\t\t\tyyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;\n\n\t\t\t\t\tyy_act = YY_STATE_EOF(YY_START);\n\t\t\t\t\tgoto do_action;\n\t\t\t\t\t}\n\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\tif ( ! yyg->yy_did_buffer_switch_on_eof )\n\t\t\t\t\t\tYY_NEW_FILE;\n\t\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\tcase EOB_ACT_CONTINUE_SCAN:\n\t\t\t\tyyg->yy_c_buf_p =\n\t\t\t\t\tyyg->yytext_ptr + yy_amount_of_matched_text;\n\n\t\t\t\tyy_current_state = yy_get_previous_state( yyscanner );\n\n\t\t\t\tyy_cp = yyg->yy_c_buf_p;\n\t\t\t\tyy_bp = yyg->yytext_ptr + YY_MORE_ADJ;\n\t\t\t\tgoto yy_match;\n\n\t\t\tcase EOB_ACT_LAST_MATCH:\n\t\t\t\tyyg->yy_c_buf_p =\n\t\t\t\t&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];\n\n\t\t\t\tyy_current_state = yy_get_previous_state( yyscanner );\n\n\t\t\t\tyy_cp = yyg->yy_c_buf_p;\n\t\t\t\tyy_bp = yyg->yytext_ptr + YY_MORE_ADJ;\n\t\t\t\tgoto yy_find_action;\n\t\t\t}\n\t\tbreak;\n\t\t}\n\n\tdefault:\n\t\tYY_FATAL_ERROR(\n\t\t\t\"fatal flex scanner internal error--no action found\" );\n\t} /* end of action switch */\n\t\t} /* end of scanning one token */\n\t} /* end of user's declarations */\n} /* end of yylex */\n\n/* yy_get_next_buffer - try to read in a new buffer\n *\n * Returns a code representing an action:\n *\tEOB_ACT_LAST_MATCH -\n *\tEOB_ACT_CONTINUE_SCAN - continue scanning from current position\n *\tEOB_ACT_END_OF_FILE - end of file\n */\nstatic int yy_get_next_buffer (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tchar *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;\n\tchar *source = yyg->yytext_ptr;\n\tint number_to_move, i;\n\tint ret_val;\n\n\tif ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )\n\t\tYY_FATAL_ERROR(\n\t\t\"fatal flex scanner internal error--end of buffer missed\" );\n\n\tif ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )\n\t\t{ /* Don't try to fill the buffer, so this is an EOF. */\n\t\tif ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )\n\t\t\t{\n\t\t\t/* We matched a single character, the EOB, so\n\t\t\t * treat this as a final EOF.\n\t\t\t */\n\t\t\treturn EOB_ACT_END_OF_FILE;\n\t\t\t}\n\n\t\telse\n\t\t\t{\n\t\t\t/* We matched some text prior to the EOB, first\n\t\t\t * process it.\n\t\t\t */\n\t\t\treturn EOB_ACT_LAST_MATCH;\n\t\t\t}\n\t\t}\n\n\t/* Try to read more data. */\n\n\t/* First move last chars to start of buffer. */\n\tnumber_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);\n\n\tfor ( i = 0; i < number_to_move; ++i )\n\t\t*(dest++) = *(source++);\n\n\tif ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )\n\t\t/* don't do the read, it's not guaranteed to return an EOF,\n\t\t * just force an EOF\n\t\t */\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;\n\n\telse\n\t\t{\n\t\t\tint num_to_read =\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;\n\n\t\twhile ( num_to_read <= 0 )\n\t\t\t{ /* Not enough room in the buffer - grow it. */\n\n\t\t\t/* just a shorter name for the current buffer */\n\t\t\tYY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;\n\n\t\t\tint yy_c_buf_p_offset =\n\t\t\t\t(int) (yyg->yy_c_buf_p - b->yy_ch_buf);\n\n\t\t\tif ( b->yy_is_our_buffer )\n\t\t\t\t{\n\t\t\t\tint new_size = b->yy_buf_size * 2;\n\n\t\t\t\tif ( new_size <= 0 )\n\t\t\t\t\tb->yy_buf_size += b->yy_buf_size / 8;\n\t\t\t\telse\n\t\t\t\t\tb->yy_buf_size *= 2;\n\n\t\t\t\tb->yy_ch_buf = (char *)\n\t\t\t\t\t/* Include room in for 2 EOB chars. */\n\t\t\t\t\tyyrealloc( (void *) b->yy_ch_buf,\n\t\t\t\t\t\t\t (yy_size_t) (b->yy_buf_size + 2) , yyscanner );\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t/* Can't grow it, we don't own it. */\n\t\t\t\tb->yy_ch_buf = NULL;\n\n\t\t\tif ( ! b->yy_ch_buf )\n\t\t\t\tYY_FATAL_ERROR(\n\t\t\t\t\"fatal error - scanner input buffer overflow\" );\n\n\t\t\tyyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];\n\n\t\t\tnum_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -\n\t\t\t\t\t\tnumber_to_move - 1;\n\n\t\t\t}\n\n\t\tif ( num_to_read > YY_READ_BUF_SIZE )\n\t\t\tnum_to_read = YY_READ_BUF_SIZE;\n\n\t\t/* Read in more data. */\n\t\tYY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),\n\t\t\tyyg->yy_n_chars, num_to_read );\n\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;\n\t\t}\n\n\tif ( yyg->yy_n_chars == 0 )\n\t\t{\n\t\tif ( number_to_move == YY_MORE_ADJ )\n\t\t\t{\n\t\t\tret_val = EOB_ACT_END_OF_FILE;\n\t\t\tyyrestart( yyin  , yyscanner);\n\t\t\t}\n\n\t\telse\n\t\t\t{\n\t\t\tret_val = EOB_ACT_LAST_MATCH;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buffer_status =\n\t\t\t\tYY_BUFFER_EOF_PENDING;\n\t\t\t}\n\t\t}\n\n\telse\n\t\tret_val = EOB_ACT_CONTINUE_SCAN;\n\n\tif ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {\n\t\t/* Extend the array by 50%, plus the number we really need. */\n\t\tint new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(\n\t\t\t(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );\n\t\tif ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_get_next_buffer()\" );\n\t\t/* \"- 2\" to take care of EOB's */\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);\n\t}\n\n\tyyg->yy_n_chars += number_to_move;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;\n\n\tyyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];\n\n\treturn ret_val;\n}\n\n/* yy_get_previous_state - get the state just before the EOB char was reached */\n\n    static yy_state_type yy_get_previous_state (yyscan_t yyscanner)\n{\n\tyy_state_type yy_current_state;\n\tchar *yy_cp;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tyy_current_state = yyg->yy_start;\n\tyy_current_state += YY_AT_BOL();\n\n\tfor ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )\n\t\t{\n\t\tif ( *yy_cp )\n\t\t\t{\n\t\t\tyy_current_state = yy_nxt[yy_current_state][YY_SC_TO_UI(*yy_cp)];\n\t\t\t}\n\t\telse\n\t\t\tyy_current_state = yy_NUL_trans[yy_current_state];\n\t\tif ( yy_accept[yy_current_state] )\n\t\t\t{\n\t\t\tyyg->yy_last_accepting_state = yy_current_state;\n\t\t\tyyg->yy_last_accepting_cpos = yy_cp;\n\t\t\t}\n\t\t}\n\n\treturn yy_current_state;\n}\n\n/* yy_try_NUL_trans - try to make a transition on the NUL character\n *\n * synopsis\n *\tnext_state = yy_try_NUL_trans( current_state );\n */\n    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)\n{\n\tint yy_is_jam;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */\n\tchar *yy_cp = yyg->yy_c_buf_p;\n\n\tyy_current_state = yy_NUL_trans[yy_current_state];\n\tyy_is_jam = (yy_current_state == 0);\n\n\tif ( ! yy_is_jam )\n\t\t{\n\t\tif ( yy_accept[yy_current_state] )\n\t\t\t{\n\t\t\tyyg->yy_last_accepting_state = yy_current_state;\n\t\t\tyyg->yy_last_accepting_cpos = yy_cp;\n\t\t\t}\n\t\t}\n\n\t(void)yyg;\n\treturn yy_is_jam ? 0 : yy_current_state;\n}\n\n#ifndef YY_NO_UNPUT\n\n    static void yyunput (int c, char * yy_bp , yyscan_t yyscanner)\n{\n\tchar *yy_cp;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n    yy_cp = yyg->yy_c_buf_p;\n\n\t/* undo effects of setting up yytext */\n\t*yy_cp = yyg->yy_hold_char;\n\n\tif ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )\n\t\t{ /* need to shift things up to make room */\n\t\t/* +2 for EOB chars. */\n\t\tint number_to_move = yyg->yy_n_chars + 2;\n\t\tchar *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[\n\t\t\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];\n\t\tchar *source =\n\t\t\t\t&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];\n\n\t\twhile ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )\n\t\t\t*--dest = *--source;\n\n\t\tyy_cp += (int) (dest - source);\n\t\tyy_bp += (int) (dest - source);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars =\n\t\t\tyyg->yy_n_chars = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;\n\n\t\tif ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )\n\t\t\tYY_FATAL_ERROR( \"flex scanner push-back overflow\" );\n\t\t}\n\n\t*--yy_cp = (char) c;\n\n\tyyg->yytext_ptr = yy_bp;\n\tyyg->yy_hold_char = *yy_cp;\n\tyyg->yy_c_buf_p = yy_cp;\n}\n\n#endif\n\n#ifndef YY_NO_INPUT\n#ifdef __cplusplus\n    static int yyinput (yyscan_t yyscanner)\n#else\n    static int input  (yyscan_t yyscanner)\n#endif\n\n{\n\tint c;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\t*yyg->yy_c_buf_p = yyg->yy_hold_char;\n\n\tif ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )\n\t\t{\n\t\t/* yy_c_buf_p now points to the character we want to return.\n\t\t * If this occurs *before* the EOB characters, then it's a\n\t\t * valid NUL; if not, then we've hit the end of the buffer.\n\t\t */\n\t\tif ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )\n\t\t\t/* This was really a NUL. */\n\t\t\t*yyg->yy_c_buf_p = '\\0';\n\n\t\telse\n\t\t\t{ /* need more input */\n\t\t\tint offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);\n\t\t\t++yyg->yy_c_buf_p;\n\n\t\t\tswitch ( yy_get_next_buffer( yyscanner ) )\n\t\t\t\t{\n\t\t\t\tcase EOB_ACT_LAST_MATCH:\n\t\t\t\t\t/* This happens because yy_g_n_b()\n\t\t\t\t\t * sees that we've accumulated a\n\t\t\t\t\t * token and flags that we need to\n\t\t\t\t\t * try matching the token before\n\t\t\t\t\t * proceeding.  But for input(),\n\t\t\t\t\t * there's no matching to consider.\n\t\t\t\t\t * So convert the EOB_ACT_LAST_MATCH\n\t\t\t\t\t * to EOB_ACT_END_OF_FILE.\n\t\t\t\t\t */\n\n\t\t\t\t\t/* Reset buffer status. */\n\t\t\t\t\tyyrestart( yyin , yyscanner);\n\n\t\t\t\t\t/*FALLTHROUGH*/\n\n\t\t\t\tcase EOB_ACT_END_OF_FILE:\n\t\t\t\t\t{\n\t\t\t\t\tif ( yywrap( yyscanner ) )\n\t\t\t\t\t\treturn 0;\n\n\t\t\t\t\tif ( ! yyg->yy_did_buffer_switch_on_eof )\n\t\t\t\t\t\tYY_NEW_FILE;\n#ifdef __cplusplus\n\t\t\t\t\treturn yyinput(yyscanner);\n#else\n\t\t\t\t\treturn input(yyscanner);\n#endif\n\t\t\t\t\t}\n\n\t\t\t\tcase EOB_ACT_CONTINUE_SCAN:\n\t\t\t\t\tyyg->yy_c_buf_p = yyg->yytext_ptr + offset;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tc = *(unsigned char *) yyg->yy_c_buf_p;\t/* cast for 8-bit char's */\n\t*yyg->yy_c_buf_p = '\\0';\t/* preserve yytext */\n\tyyg->yy_hold_char = *++yyg->yy_c_buf_p;\n\n\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\\n');\n\n\treturn c;\n}\n#endif\t/* ifndef YY_NO_INPUT */\n\n/** Immediately switch to a different input stream.\n * @param input_file A readable stream.\n * @param yyscanner The scanner object.\n * @note This function does not reset the start condition to @c INITIAL .\n */\n    void yyrestart  (FILE * input_file , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif ( ! YY_CURRENT_BUFFER ){\n        yyensure_buffer_stack (yyscanner);\n\t\tYY_CURRENT_BUFFER_LVALUE =\n            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);\n\t}\n\n\tyy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);\n\tyy_load_buffer_state( yyscanner );\n}\n\n/** Switch to a different input buffer.\n * @param new_buffer The new input buffer.\n * @param yyscanner The scanner object.\n */\n    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\t/* TODO. We should be able to replace this entire function body\n\t * with\n\t *\t\tyypop_buffer_state();\n\t *\t\tyypush_buffer_state(new_buffer);\n     */\n\tyyensure_buffer_stack (yyscanner);\n\tif ( YY_CURRENT_BUFFER == new_buffer )\n\t\treturn;\n\n\tif ( YY_CURRENT_BUFFER )\n\t\t{\n\t\t/* Flush out information for old buffer. */\n\t\t*yyg->yy_c_buf_p = yyg->yy_hold_char;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;\n\t\t}\n\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\tyy_load_buffer_state( yyscanner );\n\n\t/* We don't actually know whether we did this switch during\n\t * EOF (yywrap()) processing, but the only time this flag\n\t * is looked at is after yywrap() is called, so it's safe\n\t * to go ahead and always set it.\n\t */\n\tyyg->yy_did_buffer_switch_on_eof = 1;\n}\n\nstatic void yy_load_buffer_state  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tyyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\tyyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;\n\tyyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;\n\tyyg->yy_hold_char = *yyg->yy_c_buf_p;\n}\n\n/** Allocate and initialize an input buffer state.\n * @param file A readable stream.\n * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.\n * @param yyscanner The scanner object.\n * @return the allocated buffer state.\n */\n    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)\n{\n\tYY_BUFFER_STATE b;\n    \n\tb = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );\n\n\tb->yy_buf_size = size;\n\n\t/* yy_ch_buf has to be 2 characters longer than the size given because\n\t * we need to put in 2 end-of-buffer characters.\n\t */\n\tb->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );\n\tif ( ! b->yy_ch_buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );\n\n\tb->yy_is_our_buffer = 1;\n\n\tyy_init_buffer( b, file , yyscanner);\n\n\treturn b;\n}\n\n/** Destroy the buffer.\n * @param b a buffer created with yy_create_buffer()\n * @param yyscanner The scanner object.\n */\n    void yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif ( ! b )\n\t\treturn;\n\n\tif ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */\n\t\tYY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;\n\n\tif ( b->yy_is_our_buffer )\n\t\tyyfree( (void *) b->yy_ch_buf , yyscanner );\n\n\tyyfree( (void *) b , yyscanner );\n}\n\n/* Initializes or reinitializes a buffer.\n * This function is sometimes called more than once on the same buffer,\n * such as during a yyrestart() or at EOF.\n */\n    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)\n\n{\n\tint oerrno = errno;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tyy_flush_buffer( b , yyscanner);\n\n\tb->yy_input_file = file;\n\tb->yy_fill_buffer = 1;\n\n    /* If b is the current buffer, then yy_init_buffer was _probably_\n     * called from yyrestart() or through yy_get_next_buffer.\n     * In that case, we don't want to reset the lineno or column.\n     */\n    if (b != YY_CURRENT_BUFFER){\n        b->yy_bs_lineno = 1;\n        b->yy_bs_column = 0;\n    }\n\n        b->yy_is_interactive = 0;\n    \n\terrno = oerrno;\n}\n\n/** Discard all buffered characters. On the next scan, YY_INPUT will be called.\n * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.\n * @param yyscanner The scanner object.\n */\n    void yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tif ( ! b )\n\t\treturn;\n\n\tb->yy_n_chars = 0;\n\n\t/* We always need two end-of-buffer characters.  The first causes\n\t * a transition to the end-of-buffer state.  The second causes\n\t * a jam in that state.\n\t */\n\tb->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;\n\tb->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;\n\n\tb->yy_buf_pos = &b->yy_ch_buf[0];\n\n\tb->yy_at_bol = 1;\n\tb->yy_buffer_status = YY_BUFFER_NEW;\n\n\tif ( b == YY_CURRENT_BUFFER )\n\t\tyy_load_buffer_state( yyscanner );\n}\n\n/** Pushes the new state onto the stack. The new state becomes\n *  the current state. This function will allocate the stack\n *  if necessary.\n *  @param new_buffer The new state.\n *  @param yyscanner The scanner object.\n */\nvoid yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tif (new_buffer == NULL)\n\t\treturn;\n\n\tyyensure_buffer_stack(yyscanner);\n\n\t/* This block is copied from yy_switch_to_buffer. */\n\tif ( YY_CURRENT_BUFFER )\n\t\t{\n\t\t/* Flush out information for old buffer. */\n\t\t*yyg->yy_c_buf_p = yyg->yy_hold_char;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;\n\t\t}\n\n\t/* Only push if top exists. Otherwise, replace top. */\n\tif (YY_CURRENT_BUFFER)\n\t\tyyg->yy_buffer_stack_top++;\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\n\t/* copied from yy_switch_to_buffer. */\n\tyy_load_buffer_state( yyscanner );\n\tyyg->yy_did_buffer_switch_on_eof = 1;\n}\n\n/** Removes and deletes the top of the stack, if present.\n *  The next element becomes the new top.\n *  @param yyscanner The scanner object.\n */\nvoid yypop_buffer_state (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tif (!YY_CURRENT_BUFFER)\n\t\treturn;\n\n\tyy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);\n\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\tif (yyg->yy_buffer_stack_top > 0)\n\t\t--yyg->yy_buffer_stack_top;\n\n\tif (YY_CURRENT_BUFFER) {\n\t\tyy_load_buffer_state( yyscanner );\n\t\tyyg->yy_did_buffer_switch_on_eof = 1;\n\t}\n}\n\n/* Allocates the stack if it does not exist.\n *  Guarantees space for at least one push.\n */\nstatic void yyensure_buffer_stack (yyscan_t yyscanner)\n{\n\tyy_size_t num_to_alloc;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif (!yyg->yy_buffer_stack) {\n\n\t\t/* First allocation is just for 2 elements, since we don't know if this\n\t\t * scanner will even need a stack. We use 2 instead of 1 to avoid an\n\t\t * immediate realloc on the next call.\n         */\n      num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */\n\t\tyyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc\n\t\t\t\t\t\t\t\t(num_to_alloc * sizeof(struct yy_buffer_state*)\n\t\t\t\t\t\t\t\t, yyscanner);\n\t\tif ( ! yyg->yy_buffer_stack )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in yyensure_buffer_stack()\" );\n\n\t\tmemset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));\n\n\t\tyyg->yy_buffer_stack_max = num_to_alloc;\n\t\tyyg->yy_buffer_stack_top = 0;\n\t\treturn;\n\t}\n\n\tif (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){\n\n\t\t/* Increase the buffer to prepare for a possible push. */\n\t\tyy_size_t grow_size = 8 /* arbitrary grow size */;\n\n\t\tnum_to_alloc = yyg->yy_buffer_stack_max + grow_size;\n\t\tyyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc\n\t\t\t\t\t\t\t\t(yyg->yy_buffer_stack,\n\t\t\t\t\t\t\t\tnum_to_alloc * sizeof(struct yy_buffer_state*)\n\t\t\t\t\t\t\t\t, yyscanner);\n\t\tif ( ! yyg->yy_buffer_stack )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in yyensure_buffer_stack()\" );\n\n\t\t/* zero only the new slots.*/\n\t\tmemset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));\n\t\tyyg->yy_buffer_stack_max = num_to_alloc;\n\t}\n}\n\n/** Setup the input buffer state to scan directly from a user-specified character buffer.\n * @param base the character buffer\n * @param size the size in bytes of the character buffer\n * @param yyscanner The scanner object.\n * @return the newly allocated buffer state object.\n */\nYY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)\n{\n\tYY_BUFFER_STATE b;\n    \n\tif ( size < 2 ||\n\t     base[size-2] != YY_END_OF_BUFFER_CHAR ||\n\t     base[size-1] != YY_END_OF_BUFFER_CHAR )\n\t\t/* They forgot to leave room for the EOB's. */\n\t\treturn NULL;\n\n\tb = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_scan_buffer()\" );\n\n\tb->yy_buf_size = (int) (size - 2);\t/* \"- 2\" to take care of EOB's */\n\tb->yy_buf_pos = b->yy_ch_buf = base;\n\tb->yy_is_our_buffer = 0;\n\tb->yy_input_file = NULL;\n\tb->yy_n_chars = b->yy_buf_size;\n\tb->yy_is_interactive = 0;\n\tb->yy_at_bol = 1;\n\tb->yy_fill_buffer = 0;\n\tb->yy_buffer_status = YY_BUFFER_NEW;\n\n\tyy_switch_to_buffer( b , yyscanner );\n\n\treturn b;\n}\n\n/** Setup the input buffer state to scan a string. The next call to yylex() will\n * scan from a @e copy of @a str.\n * @param yystr a NUL-terminated string to scan\n * @param yyscanner The scanner object.\n * @return the newly allocated buffer state object.\n * @note If you want to scan bytes that may contain NUL values, then use\n *       yy_scan_bytes() instead.\n */\nYY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)\n{\n    \n\treturn yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);\n}\n\n/** Setup the input buffer state to scan the given bytes. The next call to yylex() will\n * scan from a @e copy of @a bytes.\n * @param yybytes the byte buffer to scan\n * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.\n * @param yyscanner The scanner object.\n * @return the newly allocated buffer state object.\n */\nYY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len , yyscan_t yyscanner)\n{\n\tYY_BUFFER_STATE b;\n\tchar *buf;\n\tyy_size_t n;\n\tint i;\n    \n\t/* Get memory for full buffer, including space for trailing EOB's. */\n\tn = (yy_size_t) (_yybytes_len + 2);\n\tbuf = (char *) yyalloc( n , yyscanner );\n\tif ( ! buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_scan_bytes()\" );\n\n\tfor ( i = 0; i < _yybytes_len; ++i )\n\t\tbuf[i] = yybytes[i];\n\n\tbuf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;\n\n\tb = yy_scan_buffer( buf, n , yyscanner);\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"bad buffer in yy_scan_bytes()\" );\n\n\t/* It's okay to grow etc. this buffer, and we should throw it\n\t * away when we're done.\n\t */\n\tb->yy_is_our_buffer = 1;\n\n\treturn b;\n}\n\n#ifndef YY_EXIT_FAILURE\n#define YY_EXIT_FAILURE 2\n#endif\n\nstatic void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\tfprintf( stderr, \"%s\\n\", msg );\n\texit( YY_EXIT_FAILURE );\n}\n\n/* Redefine yyless() so it works in section 3 code. */\n\n#undef yyless\n#define yyless(n) \\\n\tdo \\\n\t\t{ \\\n\t\t/* Undo effects of setting up yytext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\tyytext[yyleng] = yyg->yy_hold_char; \\\n\t\tyyg->yy_c_buf_p = yytext + yyless_macro_arg; \\\n\t\tyyg->yy_hold_char = *yyg->yy_c_buf_p; \\\n\t\t*yyg->yy_c_buf_p = '\\0'; \\\n\t\tyyleng = yyless_macro_arg; \\\n\t\t} \\\n\twhile ( 0 )\n\n/* Accessor  methods (get/set functions) to struct members. */\n\n/** Get the user-defined data for this scanner.\n * @param yyscanner The scanner object.\n */\nYY_EXTRA_TYPE yyget_extra  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyextra;\n}\n\n/** Get the current line number.\n * @param yyscanner The scanner object.\n */\nint yyget_lineno  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        if (! YY_CURRENT_BUFFER)\n            return 0;\n    \n    return yylineno;\n}\n\n/** Get the current column number.\n * @param yyscanner The scanner object.\n */\nint yyget_column  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        if (! YY_CURRENT_BUFFER)\n            return 0;\n    \n    return yycolumn;\n}\n\n/** Get the input stream.\n * @param yyscanner The scanner object.\n */\nFILE *yyget_in  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyin;\n}\n\n/** Get the output stream.\n * @param yyscanner The scanner object.\n */\nFILE *yyget_out  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyout;\n}\n\n/** Get the length of the current token.\n * @param yyscanner The scanner object.\n */\nint yyget_leng  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyleng;\n}\n\n/** Get the current token.\n * @param yyscanner The scanner object.\n */\n\nchar *yyget_text  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yytext;\n}\n\n/** Set the user-defined data. This data is never touched by the scanner.\n * @param user_defined The data to be associated with this scanner.\n * @param yyscanner The scanner object.\n */\nvoid yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yyextra = user_defined ;\n}\n\n/** Set the current line number.\n * @param _line_number line number\n * @param yyscanner The scanner object.\n */\nvoid yyset_lineno (int  _line_number , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        /* lineno is only valid if an input buffer exists. */\n        if (! YY_CURRENT_BUFFER )\n           YY_FATAL_ERROR( \"yyset_lineno called with no buffer\" );\n    \n    yylineno = _line_number;\n}\n\n/** Set the current column.\n * @param _column_no column number\n * @param yyscanner The scanner object.\n */\nvoid yyset_column (int  _column_no , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        /* column is only valid if an input buffer exists. */\n        if (! YY_CURRENT_BUFFER )\n           YY_FATAL_ERROR( \"yyset_column called with no buffer\" );\n    \n    yycolumn = _column_no;\n}\n\n/** Set the input stream. This does not discard the current\n * input buffer.\n * @param _in_str A readable stream.\n * @param yyscanner The scanner object.\n * @see yy_switch_to_buffer\n */\nvoid yyset_in (FILE *  _in_str , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yyin = _in_str ;\n}\n\nvoid yyset_out (FILE *  _out_str , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yyout = _out_str ;\n}\n\nint yyget_debug  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yy_flex_debug;\n}\n\nvoid yyset_debug (int  _bdebug , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yy_flex_debug = _bdebug ;\n}\n\n/* Accessor methods for yylval and yylloc */\n\n/* User-visible API */\n\n/* yylex_init is special because it creates the scanner itself, so it is\n * the ONLY reentrant function that doesn't take the scanner as the last argument.\n * That's why we explicitly handle the declaration, instead of using our macros.\n */\nint yylex_init(yyscan_t* ptr_yy_globals)\n{\n    if (ptr_yy_globals == NULL){\n        errno = EINVAL;\n        return 1;\n    }\n\n    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );\n\n    if (*ptr_yy_globals == NULL){\n        errno = ENOMEM;\n        return 1;\n    }\n\n    /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */\n    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));\n\n    return yy_init_globals ( *ptr_yy_globals );\n}\n\n/* yylex_init_extra has the same functionality as yylex_init, but follows the\n * convention of taking the scanner as the last argument. Note however, that\n * this is a *pointer* to a scanner, as it will be allocated by this call (and\n * is the reason, too, why this function also must handle its own declaration).\n * The user defined value in the first argument will be available to yyalloc in\n * the yyextra field.\n */\nint yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )\n{\n    struct yyguts_t dummy_yyguts;\n\n    yyset_extra (yy_user_defined, &dummy_yyguts);\n\n    if (ptr_yy_globals == NULL){\n        errno = EINVAL;\n        return 1;\n    }\n\n    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );\n\n    if (*ptr_yy_globals == NULL){\n        errno = ENOMEM;\n        return 1;\n    }\n\n    /* By setting to 0xAA, we expose bugs in\n    yy_init_globals. Leave at 0x00 for releases. */\n    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));\n\n    yyset_extra (yy_user_defined, *ptr_yy_globals);\n\n    return yy_init_globals ( *ptr_yy_globals );\n}\n\nstatic int yy_init_globals (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    /* Initialization is the same as for the non-reentrant scanner.\n     * This function is called from yylex_destroy(), so don't allocate here.\n     */\n\n    yyg->yy_buffer_stack = NULL;\n    yyg->yy_buffer_stack_top = 0;\n    yyg->yy_buffer_stack_max = 0;\n    yyg->yy_c_buf_p = NULL;\n    yyg->yy_init = 0;\n    yyg->yy_start = 0;\n\n    yyg->yy_start_stack_ptr = 0;\n    yyg->yy_start_stack_depth = 0;\n    yyg->yy_start_stack =  NULL;\n\n/* Defined in main.c */\n#ifdef YY_STDINIT\n    yyin = stdin;\n    yyout = stdout;\n#else\n    yyin = NULL;\n    yyout = NULL;\n#endif\n\n    /* For future reference: Set errno on error, since we are called by\n     * yylex_init()\n     */\n    return 0;\n}\n\n/* yylex_destroy is for both reentrant and non-reentrant scanners. */\nint yylex_destroy  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n    /* Pop the buffer stack, destroying each element. */\n\twhile(YY_CURRENT_BUFFER){\n\t\tyy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );\n\t\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\t\tyypop_buffer_state(yyscanner);\n\t}\n\n\t/* Destroy the stack itself. */\n\tyyfree(yyg->yy_buffer_stack , yyscanner);\n\tyyg->yy_buffer_stack = NULL;\n\n    /* Destroy the start condition stack. */\n        yyfree( yyg->yy_start_stack , yyscanner );\n        yyg->yy_start_stack = NULL;\n\n    /* Reset the globals. This is important in a non-reentrant scanner so the next time\n     * yylex() is called, initialization will occur. */\n    yy_init_globals( yyscanner);\n\n    /* Destroy the main struct (reentrant only). */\n    yyfree ( yyscanner , yyscanner );\n    yyscanner = NULL;\n    return 0;\n}\n\n/*\n * Internal utility routines.\n */\n\n#ifndef yytext_ptr\nstatic void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\n\tint i;\n\tfor ( i = 0; i < n; ++i )\n\t\ts1[i] = s2[i];\n}\n#endif\n\n#ifdef YY_NEED_STRLEN\nstatic int yy_flex_strlen (const char * s , yyscan_t yyscanner)\n{\n\tint n;\n\tfor ( n = 0; s[n]; ++n )\n\t\t;\n\n\treturn n;\n}\n#endif\n\nvoid *yyalloc (yy_size_t  size , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\treturn malloc(size);\n}\n\nvoid *yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\n\t/* The cast to (char *) in the following accommodates both\n\t * implementations that use char* generic pointers, and those\n\t * that use void* generic pointers.  It works with the latter\n\t * because both ANSI C and C++ allow castless assignment from\n\t * any pointer type to void*, and deal with argument conversions\n\t * as though doing an assignment.\n\t */\n\treturn realloc(ptr, size);\n}\n\nvoid yyfree (void * ptr , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\tfree( (char *) ptr );\t/* see yyrealloc() for (char *) cast */\n}\n\n#define YYTABLES_NAME \"yytables\"\n\n#line 2423 \"wcspih.l\"\n\n\n/*----------------------------------------------------------------------------\n* External interface to the scanner.\n*---------------------------------------------------------------------------*/\n\nint wcspih(\n  char *header,\n  int nkeyrec,\n  int relax,\n  int ctrl,\n  int *nreject,\n  int *nwcs,\n  struct wcsprm **wcs)\n\n{\n  // Function prototypes.\n  int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner);\n  int yylex_destroy(yyscan_t yyscanner);\n\n  struct wcspih_extra extra;\n  yyscan_t yyscanner;\n  yylex_init_extra(&extra, &yyscanner);\n  int status = wcspih_scanner(header, nkeyrec, relax, ctrl, nreject, nwcs,\n                              wcs, yyscanner);\n  yylex_destroy(yyscanner);\n\n  return status;\n}\n\n\n/*----------------------------------------------------------------------------\n* Determine the number of coordinate representations (up to 27) and the\n* number of coordinate axes in each, which distortions are present, and the\n* number of PVi_ma, PSi_ma, DPja, and DQia keywords in each representation.\n*---------------------------------------------------------------------------*/\n\nvoid wcspih_pass1(\n  int naxis,\n  int i,\n  int j,\n  char a,\n  int distype,\n  int alts[],\n  int dpq[],\n  int *npptr)\n\n{\n  // On the first pass alts[] is used to determine the number of axes\n  // for each of the 27 possible alternate coordinate descriptions.\n  if (a == 0) {\n    return;\n  }\n\n  int ialt = 0;\n  if (a != ' ') {\n    ialt = a - 'A' + 1;\n  }\n\n  int *ip = alts + ialt;\n\n  if (*ip < naxis) {\n    *ip = naxis;\n  }\n\n  // i or j can be greater than naxis.\n  if (*ip < i) {\n    *ip = i;\n  }\n\n  if (*ip < j) {\n    *ip = j;\n  }\n\n  // Type of distortions present.\n  dpq[ialt] |= distype;\n\n  // Count PVi_ma, PSi_ma, DPja, or DQia keywords.\n  if (npptr) {\n    npptr[ialt]++;\n  }\n}\n\n\n/*----------------------------------------------------------------------------\n* Allocate memory for an array of the required number of wcsprm structs and\n* initialize each of them.\n*---------------------------------------------------------------------------*/\n\nint wcspih_init1(\n  int naxis,\n  int alts[],\n  int dpq[],\n  int npv[],\n  int nps[],\n  int ndp[],\n  int ndq[],\n  int naux,\n  int distran,\n  int *nwcs,\n  struct wcsprm **wcs)\n\n{\n  int status = 0;\n\n  // Find the number of coordinate descriptions.\n  *nwcs = 0;\n  for (int ialt = 0; ialt < 27; ialt++) {\n    if (alts[ialt]) (*nwcs)++;\n  }\n\n  int defaults;\n  if ((defaults = !(*nwcs) && naxis)) {\n    // NAXIS is non-zero but there were no WCS keywords with an alternate\n    // version code; create a default WCS with blank alternate version.\n    wcspih_pass1(naxis, 0, 0, ' ', 0, alts, dpq, 0x0);\n    *nwcs = 1;\n  }\n\n  if (*nwcs) {\n    // Allocate memory for the required number of wcsprm structs.\n    if ((*wcs = calloc(*nwcs, sizeof(struct wcsprm))) == 0x0) {\n      return WCSHDRERR_MEMORY;\n    }\n\n    int ndis = 0;\n    if (distran == SIP) {\n      // DPja.NAXES and DPja.OFFSET.j to be added for SIP (see below and\n      // wcspih_final()).\n      ndp[0] += 6;\n\n    } else if (distran == DSS) {\n      // DPja.NAXES to be added for DSS (see below and wcspih_final()).\n      ndq[0] += 2;\n    }\n\n    // Initialize each wcsprm struct.\n    struct wcsprm *wcsp = *wcs;\n    *nwcs = 0;\n    for (int ialt = 0; ialt < 27; ialt++) {\n      if (alts[ialt]) {\n        wcsp->flag = -1;\n        int npvmax = npv[ialt];\n        int npsmax = nps[ialt];\n        if ((status = wcsinit(1, alts[ialt], wcsp, npvmax, npsmax, -1))) {\n          wcsvfree(nwcs, wcs);\n          break;\n        }\n\n        // Record the alternate version code.\n        if (ialt) {\n          wcsp->alt[0] = 'A' + ialt - 1;\n        }\n\n        // Record in wcsname whether this is a default description.\n        if (defaults) {\n          strcpy(wcsp->wcsname, \"DEFAULTS\");\n        }\n\n        // Any additional auxiliary keywords present?\n        if (naux) {\n          if (wcsauxi(1, wcsp)) {\n            return WCSHDRERR_MEMORY;\n          }\n        }\n\n        // Any distortions present?\n        struct disprm *disp;\n        if (dpq[ialt] & 1) {\n          if ((disp = calloc(1, sizeof(struct disprm))) == 0x0) {\n            return WCSHDRERR_MEMORY;\n          }\n\n          // Attach it to linprm.  Also inits it.\n          ndis++;\n          int ndpmax = ndp[ialt];\n          disp->flag = -1;\n          lindist(1, &(wcsp->lin), disp, ndpmax);\n        }\n\n        if (dpq[ialt] & 2) {\n          if ((disp = calloc(1, sizeof(struct disprm))) == 0x0) {\n            return WCSHDRERR_MEMORY;\n          }\n\n          // Attach it to linprm.  Also inits it.\n          ndis++;\n          int ndpmax = ndq[ialt];\n          disp->flag = -1;\n          lindist(2, &(wcsp->lin), disp, ndpmax);\n        }\n\n        // On the second pass alts[] indexes the array of wcsprm structs.\n        alts[ialt] = (*nwcs)++;\n\n        wcsp++;\n\n      } else {\n        // Signal that there is no wcsprm for this alt.\n        alts[ialt] = -1;\n      }\n    }\n\n\n    // Translated distortion?  Neither SIP nor DSS have alternates, so the\n    // presence of keywords for either (not both together), as flagged by\n    // distran, necessarily refers to the primary representation.\n    if (distran == SIP) {\n      strcpy((*wcs)->lin.dispre->dtype[0], \"SIP\");\n      strcpy((*wcs)->lin.dispre->dtype[1], \"SIP\");\n\n      // SIP doesn't have axis mapping.\n      (*wcs)->lin.dispre->ndp = 6;\n      dpfill((*wcs)->lin.dispre->dp,   \"DP1\", \"NAXES\",  0, 0, 2, 0.0);\n      dpfill((*wcs)->lin.dispre->dp+3, \"DP2\", \"NAXES\",  0, 0, 2, 0.0);\n\n    } else if (distran == DSS) {\n      strcpy((*wcs)->lin.disseq->dtype[0], \"DSS\");\n      strcpy((*wcs)->lin.disseq->dtype[1], \"DSS\");\n\n      // The Paper IV translation of DSS doesn't require an axis mapping.\n      (*wcs)->lin.disseq->ndp = 2;\n      dpfill((*wcs)->lin.disseq->dp,   \"DQ1\", \"NAXES\",  0, 0, 2, 0.0);\n      dpfill((*wcs)->lin.disseq->dp+1, \"DQ2\", \"NAXES\",  0, 0, 2, 0.0);\n    }\n  }\n\n  return status;\n}\n\n\n/*----------------------------------------------------------------------------\n* Interpret the JDREF, JDREFI, and JDREFF keywords.\n*---------------------------------------------------------------------------*/\n\nint wcspih_jdref(double *mjdref, const double *jdref)\n\n{\n  // Set MJDREF from JDREF.\n  if (undefined(mjdref[0] && undefined(mjdref[1]))) {\n    mjdref[0] = jdref[0] - 2400000.0;\n    mjdref[1] = jdref[1] - 0.5;\n\n    if (mjdref[1] < 0.0) {\n      mjdref[0] -= 1.0;\n      mjdref[1] += 1.0;\n    }\n  }\n\n  return 0;\n}\n\nint wcspih_jdrefi(double *mjdref, const double *jdrefi)\n\n{\n  // Set the integer part of MJDREF from JDREFI.\n  if (undefined(mjdref[0])) {\n    mjdref[0] = *jdrefi - 2400000.5;\n  }\n\n  return 0;\n}\n\n\nint wcspih_jdreff(double *mjdref, const double *jdreff)\n\n{\n  // Set the fractional part of MJDREF from JDREFF.\n  if (undefined(mjdref[1])) {\n    mjdref[1] = *jdreff;\n  }\n\n  return 0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Interpret EPOCHa keywords.\n*---------------------------------------------------------------------------*/\n\nint wcspih_epoch(double *equinox, const double *epoch)\n\n{\n  // If EQUINOXa is currently undefined then set it from EPOCHa.\n  if (undefined(*equinox)) {\n    *equinox = *epoch;\n  }\n\n  return 0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Interpret VSOURCEa keywords.\n*---------------------------------------------------------------------------*/\n\nint wcspih_vsource(double *zsource, const double *vsource)\n\n{\n  const double c = 299792458.0;\n\n  // If ZSOURCEa is currently undefined then set it from VSOURCEa.\n  if (undefined(*zsource)) {\n    // Convert relativistic Doppler velocity to redshift.\n    double beta = *vsource/c;\n    *zsource = (1.0 + beta)/sqrt(1.0 - beta*beta) - 1.0;\n  }\n\n  return 0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Check validity of a TIMEPIXR keyvalue.\n*---------------------------------------------------------------------------*/\n\nint wcspih_timepixr(double timepixr)\n\n{\n  return (timepixr < 0.0 || 1.0 < timepixr);\n}\n\n\n/*----------------------------------------------------------------------------\n* Interpret special keywords encountered for each coordinate representation.\n*---------------------------------------------------------------------------*/\n\nint wcspih_final(\n  int ndp[],\n  int ndq[],\n  int distran,\n  double dsstmp[],\n  char *wat[],\n  int  *nwcs,\n  struct wcsprm **wcs)\n\n{\n  for (int ialt = 0; ialt < *nwcs; ialt++) {\n    // Interpret -TAB header keywords.\n    int status;\n    if ((status = wcstab(*wcs+ialt))) {\n       wcsvfree(nwcs, wcs);\n       return status;\n    }\n\n    if (ndp[ialt] && ndq[ialt]) {\n      // Prior and sequent distortions co-exist in this representation;\n      // ensure the latter gets DVERRa.\n      (*wcs+ialt)->lin.disseq->totdis = (*wcs+ialt)->lin.dispre->totdis;\n    }\n  }\n\n  // Translated distortion functions; apply only to the primary WCS.\n  struct wcsprm *wcsp = *wcs;\n  if (distran == SIP) {\n    // SIP doesn't have alternates, nor axis mapping.\n    struct disprm *disp = wcsp->lin.dispre;\n    dpfill(disp->dp+1, \"DP1\", \"OFFSET.1\",  0, 1, 0, wcsp->crpix[0]);\n    dpfill(disp->dp+2, \"DP1\", \"OFFSET.2\",  0, 1, 0, wcsp->crpix[1]);\n    dpfill(disp->dp+4, \"DP2\", \"OFFSET.1\",  0, 1, 0, wcsp->crpix[0]);\n    dpfill(disp->dp+5, \"DP2\", \"OFFSET.2\",  0, 1, 0, wcsp->crpix[1]);\n\n  } else if (distran == DSS) {\n    // DSS doesn't have alternates, nor axis mapping.  This translation\n    // follows Paper IV, Sect. 5.2 using the same variable names.\n    double CNPIX1 = dsstmp[0];\n    double CNPIX2 = dsstmp[1];\n\n    double Xc = dsstmp[2]/1000.0;\n    double Yc = dsstmp[3]/1000.0;\n    double Rx = dsstmp[4]/1000.0;\n    double Ry = dsstmp[5]/1000.0;\n\n    double A1 = dsstmp[14];\n    double A2 = dsstmp[15];\n    double A3 = dsstmp[16];\n    double B1 = dsstmp[17];\n    double B2 = dsstmp[18];\n    double B3 = dsstmp[19];\n    double S  = sqrt(fabs(A1*B1 - A2*B2));\n\n    double X0 = (A2*B3 - A3*B1) / (A1*B1 - A2*B2);\n    double Y0 = (A3*B2 - A1*B3) / (A1*B1 - A2*B2);\n\n    wcsp->crpix[0] = (Xc - X0)/Rx - (CNPIX1 - 0.5);\n    wcsp->crpix[1] = (Yc + Y0)/Ry - (CNPIX2 - 0.5);\n\n    wcsp->pc[0] =  A1*Rx/S;\n    wcsp->pc[1] = -A2*Ry/S;\n    wcsp->pc[2] = -B2*Rx/S;\n    wcsp->pc[3] =  B1*Ry/S;\n    wcsp->altlin = 1;\n\n    wcsp->cdelt[0] = -S/3600.0;\n    wcsp->cdelt[1] =  S/3600.0;\n\n    double *crval = wcsp->crval;\n    crval[0] = (dsstmp[6]  + (dsstmp[7]  + dsstmp[8] /60.0)/60.0)*15.0;\n    crval[1] =  dsstmp[10] + (dsstmp[11] + dsstmp[12]/60.0)/60.0;\n    if (dsstmp[9] == -1.0) crval[1] *= -1.0;\n\n    strcpy(wcsp->ctype[0], \"RA---TAN\");\n    strcpy(wcsp->ctype[1], \"DEC--TAN\");\n\n    sprintf(wcsp->wcsname, \"DSS PLATEID %.4s\", (char *)(dsstmp+13));\n\n    // Erase the approximate WCS provided in modern DSS headers.\n    wcsp->cd[0] = 0.0;\n    wcsp->cd[1] = 0.0;\n    wcsp->cd[2] = 0.0;\n    wcsp->cd[3] = 0.0;\n\n  } else if (distran == WAT) {\n    // TNX and ZPX don't have alternates, nor axis mapping.\n    char *wp;\n    int  omax, omin, wctrl[4];\n    double wval;\n    struct disprm *disp = wcsp->lin.disseq;\n\n    // Disassemble the core dump stored in the WATi_m strings.\n    int i, nterms = 0;\n    for (i = 0; i < 2; i++) {\n      char wtype[8];\n      sscanf(wat[i], \"wtype=%s\", wtype);\n\n      if (strcmp(wtype, \"tnx\") == 0) {\n        strcpy(disp->dtype[i], \"WAT-TNX\");\n      } else if (strcmp(wtype, \"zpx\") == 0) {\n        strcpy(disp->dtype[i], \"WAT-ZPX\");\n      } else {\n        // Could contain \"tan\" or something else to be ignored.\n        lindist(2, &(wcsp->lin), 0x0, 0);\n        return 0;\n      }\n\n      // The PROJPn parameters are duplicated on each ZPX axis.\n      if (i == 1 && strcmp(wtype, \"zpx\") == 0) {\n        // Take those on the second (latitude) axis ignoring the other.\n        // First we have to count them and allocate space in wcsprm.\n        wp = wat[i];\n\tint npv;\n        for (npv = 0; npv < 30; npv++) {\n          if ((wp = strstr(wp, \"projp\")) == 0x0) break;\n          wp += 5;\n        }\n\n        // Allocate space.\n        if (npv) {\n          wcsp->npvmax += npv;\n          wcsp->pv = realloc(wcsp->pv, wcsp->npvmax*sizeof(struct pvcard));\n          if (wcsp->pv == 0x0) {\n            return WCSHDRERR_MEMORY;\n          }\n\n          wcsp->m_pv = wcsp->pv;\n        }\n\n        // Copy the values.\n        wp = wat[i];\n        for (int ipv = wcsp->npv; ipv < wcsp->npvmax; ipv++) {\n          if ((wp = strstr(wp, \"projp\")) == 0x0) break;\n\n          int m;\n          sscanf(wp, \"projp%d=%lf\", &m, &wval);\n          wcsp->pv[ipv].i = 2;\n          wcsp->pv[ipv].m = m;\n          wcsp->pv[ipv].value = wval;\n\n          wp += 5;\n        }\n\n        wcsp->npv += npv;\n      }\n\n      // Read the control parameters.\n      if ((wp = strchr(wat[i], '\"')) == 0x0) {\n        return WCSHDRERR_PARSER;\n      }\n      wp++;\n\n      for (int m = 0; m < 4; m++) {\n        sscanf(wp, \"%d\", wctrl+m);\n        if ((wp = strchr(wp, ' ')) == 0x0) {\n          return WCSHDRERR_PARSER;\n        }\n        wp++;\n      }\n\n      // How many coefficients are we expecting?\n      omin = (wctrl[1] < wctrl[2]) ? wctrl[1] : wctrl[2];\n      omax = (wctrl[1] < wctrl[2]) ? wctrl[2] : wctrl[1];\n      if (wctrl[3] == 0) {\n        // No cross terms.\n        nterms += omin + omax;\n\n      } else if (wctrl[3] == 1) {\n        // Full cross terms.\n        nterms += omin*omax;\n\n      } else if (wctrl[3] == 2) {\n        // Half cross terms.\n        nterms += omin*omax - omin*(omin-1)/2;\n      }\n    }\n\n    // Allocate memory for dpkeys.\n    ndq[0] += 2*(1 + 1 + 4) + nterms;\n\n    disp->ndpmax += ndq[0];\n    disp->dp = realloc(disp->dp, disp->ndpmax*sizeof(struct dpkey));\n    if (disp->dp == 0x0) {\n      return WCSHDRERR_MEMORY;\n    }\n\n    disp->m_dp = disp->dp;\n\n\n    // Populate dpkeys.\n    int idp = disp->ndp;\n    for (i = 0; i < 2; i++) {\n      dpfill(disp->dp+(idp++), \"DQ\", \"NAXES\", i+1, 0, 2, 0.0);\n\n      // Read the control parameters.\n      if ((wp = strchr(wat[i], '\"')) == 0x0) {\n        return WCSHDRERR_PARSER;\n      }\n      wp++;\n\n      for (int m = 0; m < 4; m++) {\n        sscanf(wp, \"%d\", wctrl+m);\n        if ((wp = strchr(wp, ' ')) == 0x0) {\n          return WCSHDRERR_PARSER;\n        }\n        wp++;\n      }\n\n      // Polynomial type.\n      char wpoly[12];\n      dpfill(disp->dp+(idp++), \"DQ\", \"WAT.POLY\", i+1, 0, wctrl[0], 0.0);\n      if (wctrl[0] == 1) {\n        // Chebyshev polynomial.\n        strcpy(wpoly, \"CHBY\");\n      } else if (wctrl[0] == 2) {\n        // Legendre polynomial.\n        strcpy(wpoly, \"LEGR\");\n      } else if (wctrl[0] == 3) {\n        // Polynomial is the sum of monomials.\n        strcpy(wpoly, \"MONO\");\n      } else {\n        // Unknown code.\n        strcpy(wpoly, \"UNKN\");\n      }\n\n      // Read the scaling parameters.\n      char field[40];\n      for (int m = 0; m < 4; m++) {\n        sscanf(wp, \"%lf\", &wval);\n        sprintf(field, \"WAT.%c%s\", (m<2)?'X':'Y', (m%2)?\"MAX\":\"MIN\");\n        dpfill(disp->dp+(idp++), \"DQ\", field, i+1, 1, 0, wval);\n\n        if ((wp = strchr(wp, ' ')) == 0x0) {\n          return WCSHDRERR_PARSER;\n        }\n        wp++;\n      }\n\n      // Read the coefficients.\n      for (int n = 0; n < wctrl[2]; n++) {\n        for (int m = 0; m < wctrl[1]; m++) {\n          if (wctrl[3] == 0) {\n            if (m && n) continue;\n          } else if (wctrl[3] == 2) {\n            if (m+n > omax-1) continue;\n          }\n\n          sscanf(wp, \"%lf\", &wval);\n          if (wval == 0.0) continue;\n\n          sprintf(field, \"WAT.%s.%d_%d\", wpoly, m, n);\n          dpfill(disp->dp+(idp++), \"DQ\", field, i+1, 1, 0, wval);\n\n          if ((wp = strchr(wp, ' ')) == 0x0) {\n            return WCSHDRERR_PARSER;\n          }\n          wp++;\n        }\n      }\n    }\n\n    disp->ndp = idp;\n  }\n\n  return 0;\n}\n\n"},{"id":16618,"name":"fitshdr.c","nodeType":"TextFile","path":"cextern/wcslib/C/flexed","text":"#line 2 \"fitshdr.c\"\n\n#line 4 \"fitshdr.c\"\n\n#define _POSIX_C_SOURCE 1\n#define  YY_INT_ALIGNED short int\n\n/* A lexical scanner generated by flex */\n\n#define FLEX_SCANNER\n#define YY_FLEX_MAJOR_VERSION 2\n#define YY_FLEX_MINOR_VERSION 6\n#define YY_FLEX_SUBMINOR_VERSION 4\n#if YY_FLEX_SUBMINOR_VERSION > 0\n#define FLEX_BETA\n#endif\n\n#ifdef yy_create_buffer\n#define fitshdr_create_buffer_ALREADY_DEFINED\n#else\n#define yy_create_buffer fitshdr_create_buffer\n#endif\n\n#ifdef yy_delete_buffer\n#define fitshdr_delete_buffer_ALREADY_DEFINED\n#else\n#define yy_delete_buffer fitshdr_delete_buffer\n#endif\n\n#ifdef yy_scan_buffer\n#define fitshdr_scan_buffer_ALREADY_DEFINED\n#else\n#define yy_scan_buffer fitshdr_scan_buffer\n#endif\n\n#ifdef yy_scan_string\n#define fitshdr_scan_string_ALREADY_DEFINED\n#else\n#define yy_scan_string fitshdr_scan_string\n#endif\n\n#ifdef yy_scan_bytes\n#define fitshdr_scan_bytes_ALREADY_DEFINED\n#else\n#define yy_scan_bytes fitshdr_scan_bytes\n#endif\n\n#ifdef yy_init_buffer\n#define fitshdr_init_buffer_ALREADY_DEFINED\n#else\n#define yy_init_buffer fitshdr_init_buffer\n#endif\n\n#ifdef yy_flush_buffer\n#define fitshdr_flush_buffer_ALREADY_DEFINED\n#else\n#define yy_flush_buffer fitshdr_flush_buffer\n#endif\n\n#ifdef yy_load_buffer_state\n#define fitshdr_load_buffer_state_ALREADY_DEFINED\n#else\n#define yy_load_buffer_state fitshdr_load_buffer_state\n#endif\n\n#ifdef yy_switch_to_buffer\n#define fitshdr_switch_to_buffer_ALREADY_DEFINED\n#else\n#define yy_switch_to_buffer fitshdr_switch_to_buffer\n#endif\n\n#ifdef yypush_buffer_state\n#define fitshdrpush_buffer_state_ALREADY_DEFINED\n#else\n#define yypush_buffer_state fitshdrpush_buffer_state\n#endif\n\n#ifdef yypop_buffer_state\n#define fitshdrpop_buffer_state_ALREADY_DEFINED\n#else\n#define yypop_buffer_state fitshdrpop_buffer_state\n#endif\n\n#ifdef yyensure_buffer_stack\n#define fitshdrensure_buffer_stack_ALREADY_DEFINED\n#else\n#define yyensure_buffer_stack fitshdrensure_buffer_stack\n#endif\n\n#ifdef yylex\n#define fitshdrlex_ALREADY_DEFINED\n#else\n#define yylex fitshdrlex\n#endif\n\n#ifdef yyrestart\n#define fitshdrrestart_ALREADY_DEFINED\n#else\n#define yyrestart fitshdrrestart\n#endif\n\n#ifdef yylex_init\n#define fitshdrlex_init_ALREADY_DEFINED\n#else\n#define yylex_init fitshdrlex_init\n#endif\n\n#ifdef yylex_init_extra\n#define fitshdrlex_init_extra_ALREADY_DEFINED\n#else\n#define yylex_init_extra fitshdrlex_init_extra\n#endif\n\n#ifdef yylex_destroy\n#define fitshdrlex_destroy_ALREADY_DEFINED\n#else\n#define yylex_destroy fitshdrlex_destroy\n#endif\n\n#ifdef yyget_debug\n#define fitshdrget_debug_ALREADY_DEFINED\n#else\n#define yyget_debug fitshdrget_debug\n#endif\n\n#ifdef yyset_debug\n#define fitshdrset_debug_ALREADY_DEFINED\n#else\n#define yyset_debug fitshdrset_debug\n#endif\n\n#ifdef yyget_extra\n#define fitshdrget_extra_ALREADY_DEFINED\n#else\n#define yyget_extra fitshdrget_extra\n#endif\n\n#ifdef yyset_extra\n#define fitshdrset_extra_ALREADY_DEFINED\n#else\n#define yyset_extra fitshdrset_extra\n#endif\n\n#ifdef yyget_in\n#define fitshdrget_in_ALREADY_DEFINED\n#else\n#define yyget_in fitshdrget_in\n#endif\n\n#ifdef yyset_in\n#define fitshdrset_in_ALREADY_DEFINED\n#else\n#define yyset_in fitshdrset_in\n#endif\n\n#ifdef yyget_out\n#define fitshdrget_out_ALREADY_DEFINED\n#else\n#define yyget_out fitshdrget_out\n#endif\n\n#ifdef yyset_out\n#define fitshdrset_out_ALREADY_DEFINED\n#else\n#define yyset_out fitshdrset_out\n#endif\n\n#ifdef yyget_leng\n#define fitshdrget_leng_ALREADY_DEFINED\n#else\n#define yyget_leng fitshdrget_leng\n#endif\n\n#ifdef yyget_text\n#define fitshdrget_text_ALREADY_DEFINED\n#else\n#define yyget_text fitshdrget_text\n#endif\n\n#ifdef yyget_lineno\n#define fitshdrget_lineno_ALREADY_DEFINED\n#else\n#define yyget_lineno fitshdrget_lineno\n#endif\n\n#ifdef yyset_lineno\n#define fitshdrset_lineno_ALREADY_DEFINED\n#else\n#define yyset_lineno fitshdrset_lineno\n#endif\n\n#ifdef yyget_column\n#define fitshdrget_column_ALREADY_DEFINED\n#else\n#define yyget_column fitshdrget_column\n#endif\n\n#ifdef yyset_column\n#define fitshdrset_column_ALREADY_DEFINED\n#else\n#define yyset_column fitshdrset_column\n#endif\n\n#ifdef yywrap\n#define fitshdrwrap_ALREADY_DEFINED\n#else\n#define yywrap fitshdrwrap\n#endif\n\n#ifdef yyalloc\n#define fitshdralloc_ALREADY_DEFINED\n#else\n#define yyalloc fitshdralloc\n#endif\n\n#ifdef yyrealloc\n#define fitshdrrealloc_ALREADY_DEFINED\n#else\n#define yyrealloc fitshdrrealloc\n#endif\n\n#ifdef yyfree\n#define fitshdrfree_ALREADY_DEFINED\n#else\n#define yyfree fitshdrfree\n#endif\n\n/* First, we deal with  platform-specific or compiler-specific issues. */\n\n/* begin standard C headers. */\n#include <stdio.h>\n#include <string.h>\n#include <errno.h>\n#include <stdlib.h>\n\n/* end standard C headers. */\n\n/* flex integer type definitions */\n\n#ifndef FLEXINT_H\n#define FLEXINT_H\n\n/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */\n\n#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\n\n/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,\n * if you want the limit (max/min) macros for int types. \n */\n#ifndef __STDC_LIMIT_MACROS\n#define __STDC_LIMIT_MACROS 1\n#endif\n\n#include <inttypes.h>\ntypedef int8_t flex_int8_t;\ntypedef uint8_t flex_uint8_t;\ntypedef int16_t flex_int16_t;\ntypedef uint16_t flex_uint16_t;\ntypedef int32_t flex_int32_t;\ntypedef uint32_t flex_uint32_t;\n#else\ntypedef signed char flex_int8_t;\ntypedef short int flex_int16_t;\ntypedef int flex_int32_t;\ntypedef unsigned char flex_uint8_t; \ntypedef unsigned short int flex_uint16_t;\ntypedef unsigned int flex_uint32_t;\n\n/* Limits of integral types. */\n#ifndef INT8_MIN\n#define INT8_MIN               (-128)\n#endif\n#ifndef INT16_MIN\n#define INT16_MIN              (-32767-1)\n#endif\n#ifndef INT32_MIN\n#define INT32_MIN              (-2147483647-1)\n#endif\n#ifndef INT8_MAX\n#define INT8_MAX               (127)\n#endif\n#ifndef INT16_MAX\n#define INT16_MAX              (32767)\n#endif\n#ifndef INT32_MAX\n#define INT32_MAX              (2147483647)\n#endif\n#ifndef UINT8_MAX\n#define UINT8_MAX              (255U)\n#endif\n#ifndef UINT16_MAX\n#define UINT16_MAX             (65535U)\n#endif\n#ifndef UINT32_MAX\n#define UINT32_MAX             (4294967295U)\n#endif\n\n#ifndef SIZE_MAX\n#define SIZE_MAX               (~(size_t)0)\n#endif\n\n#endif /* ! C99 */\n\n#endif /* ! FLEXINT_H */\n\n/* begin standard C++ headers. */\n\n/* TODO: this is always defined, so inline it */\n#define yyconst const\n\n#if defined(__GNUC__) && __GNUC__ >= 3\n#define yynoreturn __attribute__((__noreturn__))\n#else\n#define yynoreturn\n#endif\n\n/* Returned upon end-of-file. */\n#define YY_NULL 0\n\n/* Promotes a possibly negative, possibly signed char to an\n *   integer in range [0..255] for use as an array index.\n */\n#define YY_SC_TO_UI(c) ((YY_CHAR) (c))\n\n/* An opaque pointer. */\n#ifndef YY_TYPEDEF_YY_SCANNER_T\n#define YY_TYPEDEF_YY_SCANNER_T\ntypedef void* yyscan_t;\n#endif\n\n/* For convenience, these vars (plus the bison vars far below)\n   are macros in the reentrant scanner. */\n#define yyin yyg->yyin_r\n#define yyout yyg->yyout_r\n#define yyextra yyg->yyextra_r\n#define yyleng yyg->yyleng_r\n#define yytext yyg->yytext_r\n#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)\n#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)\n#define yy_flex_debug yyg->yy_flex_debug_r\n\n/* Enter a start condition.  This macro really ought to take a parameter,\n * but we do it the disgusting crufty way forced on us by the ()-less\n * definition of BEGIN.\n */\n#define BEGIN yyg->yy_start = 1 + 2 *\n/* Translate the current start state into a value that can be later handed\n * to BEGIN to return to the state.  The YYSTATE alias is for lex\n * compatibility.\n */\n#define YY_START ((yyg->yy_start - 1) / 2)\n#define YYSTATE YY_START\n/* Action number for EOF rule of a given start state. */\n#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)\n/* Special action meaning \"start processing a new file\". */\n#define YY_NEW_FILE yyrestart( yyin , yyscanner )\n#define YY_END_OF_BUFFER_CHAR 0\n\n/* Size of default input buffer. */\n#ifndef YY_BUF_SIZE\n#ifdef __ia64__\n/* On IA-64, the buffer size is 16k, not 8k.\n * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.\n * Ditto for the __ia64__ case accordingly.\n */\n#define YY_BUF_SIZE 32768\n#else\n#define YY_BUF_SIZE 16384\n#endif /* __ia64__ */\n#endif\n\n/* The state buf must be large enough to hold one state per character in the main buffer.\n */\n#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))\n\n#ifndef YY_TYPEDEF_YY_BUFFER_STATE\n#define YY_TYPEDEF_YY_BUFFER_STATE\ntypedef struct yy_buffer_state *YY_BUFFER_STATE;\n#endif\n\n#ifndef YY_TYPEDEF_YY_SIZE_T\n#define YY_TYPEDEF_YY_SIZE_T\ntypedef size_t yy_size_t;\n#endif\n\n#define EOB_ACT_CONTINUE_SCAN 0\n#define EOB_ACT_END_OF_FILE 1\n#define EOB_ACT_LAST_MATCH 2\n    \n#define YY_LESS_LINENO(n)\n#define YY_LINENO_REWIND_TO(ptr)\n    \n/* Return all but the first \"n\" matched characters back to the input stream. */\n#define yyless(n) \\\n\tdo \\\n\t\t{ \\\n\t\t/* Undo effects of setting up yytext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\t*yy_cp = yyg->yy_hold_char; \\\n\t\tYY_RESTORE_YY_MORE_OFFSET \\\n\t\tyyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \\\n\t\tYY_DO_BEFORE_ACTION; /* set up yytext again */ \\\n\t\t} \\\n\twhile ( 0 )\n#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )\n\n#ifndef YY_STRUCT_YY_BUFFER_STATE\n#define YY_STRUCT_YY_BUFFER_STATE\nstruct yy_buffer_state\n\t{\n\tFILE *yy_input_file;\n\n\tchar *yy_ch_buf;\t\t/* input buffer */\n\tchar *yy_buf_pos;\t\t/* current position in input buffer */\n\n\t/* Size of input buffer in bytes, not including room for EOB\n\t * characters.\n\t */\n\tint yy_buf_size;\n\n\t/* Number of characters read into yy_ch_buf, not including EOB\n\t * characters.\n\t */\n\tint yy_n_chars;\n\n\t/* Whether we \"own\" the buffer - i.e., we know we created it,\n\t * and can realloc() it to grow it, and should free() it to\n\t * delete it.\n\t */\n\tint yy_is_our_buffer;\n\n\t/* Whether this is an \"interactive\" input source; if so, and\n\t * if we're using stdio for input, then we want to use getc()\n\t * instead of fread(), to make sure we stop fetching input after\n\t * each newline.\n\t */\n\tint yy_is_interactive;\n\n\t/* Whether we're considered to be at the beginning of a line.\n\t * If so, '^' rules will be active on the next match, otherwise\n\t * not.\n\t */\n\tint yy_at_bol;\n\n    int yy_bs_lineno; /**< The line count. */\n    int yy_bs_column; /**< The column count. */\n\n\t/* Whether to try to fill the input buffer when we reach the\n\t * end of it.\n\t */\n\tint yy_fill_buffer;\n\n\tint yy_buffer_status;\n\n#define YY_BUFFER_NEW 0\n#define YY_BUFFER_NORMAL 1\n\t/* When an EOF's been seen but there's still some text to process\n\t * then we mark the buffer as YY_EOF_PENDING, to indicate that we\n\t * shouldn't try reading from the input source any more.  We might\n\t * still have a bunch of tokens to match, though, because of\n\t * possible backing-up.\n\t *\n\t * When we actually see the EOF, we change the status to \"new\"\n\t * (via yyrestart()), so that the user can continue scanning by\n\t * just pointing yyin at a new input file.\n\t */\n#define YY_BUFFER_EOF_PENDING 2\n\n\t};\n#endif /* !YY_STRUCT_YY_BUFFER_STATE */\n\n/* We provide macros for accessing buffer states in case in the\n * future we want to put the buffer states in a more general\n * \"scanner state\".\n *\n * Returns the top of the stack, or NULL.\n */\n#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \\\n                          ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \\\n                          : NULL)\n/* Same as previous macro, but useful when we know that the buffer stack is not\n * NULL or when we need an lvalue. For internal use only.\n */\n#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]\n\nvoid yyrestart ( FILE *input_file , yyscan_t yyscanner );\nvoid yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );\nYY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );\nvoid yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );\nvoid yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );\nvoid yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );\nvoid yypop_buffer_state ( yyscan_t yyscanner );\n\nstatic void yyensure_buffer_stack ( yyscan_t yyscanner );\nstatic void yy_load_buffer_state ( yyscan_t yyscanner );\nstatic void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );\n#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)\n\nYY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );\nYY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );\nYY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );\n\nvoid *yyalloc ( yy_size_t , yyscan_t yyscanner );\nvoid *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );\nvoid yyfree ( void * , yyscan_t yyscanner );\n\n#define yy_new_buffer yy_create_buffer\n#define yy_set_interactive(is_interactive) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){ \\\n        yyensure_buffer_stack (yyscanner); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \\\n\t}\n#define yy_set_bol(at_bol) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){\\\n        yyensure_buffer_stack (yyscanner); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \\\n\t}\n#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)\n\n/* Begin user sect3 */\n\n#define fitshdrwrap(yyscanner) (/*CONSTCOND*/1)\n#define YY_SKIP_YYWRAP\ntypedef flex_uint8_t YY_CHAR;\n\ntypedef int yy_state_type;\n\n#define yytext_ptr yytext_r\n\nstatic const flex_int16_t yy_nxt[][128] =\n    {\n    {\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0\n    },\n\n    {\n       15,   16,   16,   16,   16,   16,   16,   16,   16,   16,\n       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,\n       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,\n       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,\n       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,\n       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,\n       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,\n\n       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,\n       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,\n       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,\n       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,\n       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,\n       16,   16,   16,   16,   16,   16,   16,   16\n    },\n\n    {\n       15,   17,   17,   17,   17,   17,   17,   17,   17,   17,\n       16,   17,   17,   17,   17,   17,   17,   17,   17,   17,\n       17,   17,   17,   17,   17,   17,   17,   17,   17,   17,\n       17,   17,   18,   17,   17,   17,   17,   17,   17,   17,\n\n       17,   17,   17,   17,   17,   19,   17,   17,   19,   19,\n       19,   19,   19,   19,   19,   19,   19,   19,   17,   17,\n       17,   17,   17,   17,   17,   19,   19,   20,   19,   21,\n       19,   19,   22,   19,   19,   19,   19,   19,   19,   19,\n       19,   19,   19,   19,   19,   19,   19,   19,   19,   19,\n       19,   17,   17,   17,   17,   19,   17,   17,   17,   17,\n       17,   17,   17,   17,   17,   17,   17,   17,   17,   17,\n       17,   17,   17,   17,   17,   17,   17,   17,   17,   17,\n       17,   17,   17,   17,   17,   17,   17,   17\n    },\n\n    {\n       15,   23,   23,   23,   23,   23,   23,   23,   23,   23,\n\n       16,   23,   23,   23,   23,   23,   23,   23,   23,   23,\n       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,\n       23,   23,   24,   23,   23,   23,   23,   23,   23,   25,\n       26,   23,   23,   27,   23,   27,   28,   29,   30,   31,\n       31,   31,   31,   31,   31,   31,   31,   31,   23,   23,\n       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,\n       32,   23,   23,   23,   23,   23,   23,   23,   23,   23,\n       23,   23,   23,   23,   32,   23,   23,   23,   23,   23,\n       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,\n       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,\n\n       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,\n       23,   23,   23,   23,   23,   23,   23,   23\n    },\n\n    {\n       15,   23,   23,   23,   23,   23,   23,   23,   23,   23,\n       16,   23,   23,   23,   23,   23,   23,   23,   23,   23,\n       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,\n       23,   23,   24,   23,   23,   23,   23,   23,   23,   25,\n       26,   23,   23,   27,   23,   27,   28,   29,   30,   31,\n       31,   31,   31,   31,   31,   31,   31,   31,   23,   23,\n       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,\n       32,   23,   23,   23,   23,   23,   23,   23,   23,   23,\n\n       23,   23,   23,   23,   32,   23,   23,   23,   23,   23,\n       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,\n       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,\n       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,\n       23,   23,   23,   23,   23,   23,   23,   23\n    },\n\n    {\n       15,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       34,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   35,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   33,   33,   33,   33,   33,   36,   33,   33,\n\n       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   33,   33,   33,   33,   33,   33\n    },\n\n    {\n       15,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       34,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n\n       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   35,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   33,   33,   33,   33,   33,   36,   33,   33,\n       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,\n\n       33,   33,   33,   33,   33,   33,   33,   33\n    },\n\n    {\n       15,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       16,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n\n       37,   38,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37\n    },\n\n    {\n       15,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       16,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   38,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,\n       37,   37,   37,   37,   37,   37,   37,   37\n    },\n\n    {\n       15,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       16,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39\n\n    },\n\n    {\n       15,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       16,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,\n       39,   39,   39,   39,   39,   39,   39,   39\n    },\n\n    {\n       15,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       16,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40\n    },\n\n    {\n       15,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       16,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40,   40,   40,\n       40,   40,   40,   40,   40,   40,   40,   40\n    },\n\n    {\n       15,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n\n       42,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41\n    },\n\n    {\n       15,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       42,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,\n       41,   41,   41,   41,   41,   41,   41,   41\n    },\n\n    {\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15\n    },\n\n    {\n       15,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16\n    },\n\n    {\n       15,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n      -17,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43\n    },\n\n    {\n       15,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n      -18,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   44,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43\n    },\n\n    {\n       15,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n      -19,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   45,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   46,   43,   43,   46,   46,\n       46,   46,   46,   46,   46,   46,   46,   46,   43,   43,\n       43,   43,   43,   43,   43,   46,   46,   46,   46,   46,\n       46,   46,   46,   46,   46,   46,   46,   46,   46,   46,\n       46,   46,   46,   46,   46,   46,   46,   46,   46,   46,\n       46,   43,   43,   43,   43,   46,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43\n\n    },\n\n    {\n       15,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n      -20,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   45,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   46,   43,   43,   46,   46,\n       46,   46,   46,   46,   46,   46,   46,   46,   43,   43,\n       43,   43,   43,   43,   43,   46,   46,   46,   46,   46,\n       46,   46,   46,   46,   46,   46,   46,   46,   46,   47,\n       46,   46,   46,   46,   46,   46,   46,   46,   46,   46,\n       46,   43,   43,   43,   43,   46,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43\n    },\n\n    {\n       15,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n      -21,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   45,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   46,   43,   43,   46,   46,\n       46,   46,   46,   46,   46,   46,   46,   46,   43,   43,\n       43,   43,   43,   43,   43,   46,   46,   46,   46,   46,\n\n       46,   46,   46,   46,   46,   46,   46,   46,   48,   46,\n       46,   46,   46,   46,   46,   46,   46,   46,   46,   46,\n       46,   43,   43,   43,   43,   46,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43\n    },\n\n    {\n       15,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n      -22,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   45,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   46,   43,   43,   46,   46,\n       46,   46,   46,   46,   46,   46,   46,   46,   43,   43,\n       43,   43,   43,   43,   43,   46,   46,   46,   46,   46,\n       46,   46,   46,   49,   46,   46,   46,   46,   46,   46,\n       46,   46,   46,   46,   46,   46,   46,   46,   46,   46,\n       46,   43,   43,   43,   43,   46,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43\n    },\n\n    {\n       15,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23\n    },\n\n    {\n       15,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,   50,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,   51,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24\n    },\n\n    {\n       15,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   53,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52\n    },\n\n    {\n       15,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,   54,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,   55,  -26,   55,   56,  -26,   57,   57,\n       57,   57,   57,   57,   57,   57,   57,   57,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26\n    },\n\n    {\n       15,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,   58,  -27,   59,   60,\n       60,   60,   60,   60,   60,   60,   60,   60,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27\n    },\n\n    {\n       15,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,   61,   61,\n       61,   61,   61,   61,   61,   61,   61,   61,  -28,  -28,\n\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28\n    },\n\n    {\n       15,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29\n\n    },\n\n    {\n       15,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,   62,  -30,   63,   64,\n       64,   64,   64,   64,   64,   64,   64,   64,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,   65,   65,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n\n       65,   65,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30\n    },\n\n    {\n       15,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,   62,  -31,   66,   66,\n       66,   66,   66,   66,   66,   66,   66,   66,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,   65,   65,\n\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n       65,   65,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31\n    },\n\n    {\n       15,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32\n    },\n\n    {\n       15,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33\n    },\n\n    {\n       15,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34\n    },\n\n    {\n       15,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n       67,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,   68,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,   69,  -35,  -35,\n\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35\n    },\n\n    {\n       15,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n       70,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,   71,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36\n    },\n\n    {\n       15,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37\n    },\n\n    {\n       15,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,   72,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n       72,   72,   72,   72,  -38,   72,   72,   72,   72,   72,\n       72,   72,   72,   72,   72,   72,   72,   72,  -38,  -38,\n\n      -38,  -38,  -38,  -38,  -38,   72,   72,   72,   72,   72,\n       72,   72,   72,   72,   72,   72,   72,   72,   72,   72,\n       72,   72,   72,   72,   72,   72,   72,   72,   72,   72,\n       72,  -38,  -38,  -38,   72,  -38,  -38,   72,   72,   72,\n       72,   72,   72,   72,   72,   72,   72,   72,   72,   72,\n       72,   72,   72,   72,   72,   72,   72,   72,   72,   72,\n       72,   72,   72,  -38,  -38,  -38,  -38,  -38\n    },\n\n    {\n       15,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n      -39,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73\n\n    },\n\n    {\n       15,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n      -40,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74\n    },\n\n    {\n       15,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       76,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75\n    },\n\n    {\n       15,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42\n    },\n\n    {\n       15,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n\n      -43,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77\n    },\n\n    {\n       15,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n      -44,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   78,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77\n    },\n\n    {\n       15,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n      -45,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   79,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77\n    },\n\n    {\n       15,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n      -46,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   80,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   81,   77,   77,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   77,   77,\n       77,   77,   77,   77,   77,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   77,   77,   77,   77,   81,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n\n       77,   77,   77,   77,   77,   77,   77,   77\n    },\n\n    {\n       15,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n      -47,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   80,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   81,   77,   77,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   77,   77,\n       77,   77,   77,   77,   77,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   82,   83,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n\n       81,   77,   77,   77,   77,   81,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77\n    },\n\n    {\n       15,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n      -48,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   80,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   81,   77,   77,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   77,   77,\n\n       77,   77,   77,   77,   77,   81,   81,   81,   84,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   77,   77,   77,   77,   81,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77\n    },\n\n    {\n       15,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n      -49,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n\n       77,   77,   80,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   81,   77,   77,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   77,   77,\n       77,   77,   77,   77,   77,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   85,   81,   81,   81,   81,   81,   81,\n       81,   77,   77,   77,   77,   81,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77\n\n    },\n\n    {\n       15,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,   50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,   51,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50\n    },\n\n    {\n       15,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51\n    },\n\n    {\n       15,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   53,\n\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,\n       52,   52,   52,   52,   52,   52,   52,   52\n    },\n\n    {\n       15,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,   52,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53\n    },\n\n    {\n       15,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,   54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,   55,  -54,   55,   56,  -54,   57,   57,\n       57,   57,   57,   57,   57,   57,   57,   57,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54\n    },\n\n    {\n       15,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,   56,  -55,   57,   57,\n\n       57,   57,   57,   57,   57,   57,   57,   57,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55\n    },\n\n    {\n       15,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,   86,   86,\n       86,   86,   86,   86,   86,   86,   86,   86,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56\n    },\n\n    {\n       15,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,   87,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,   88,  -57,   89,  -57,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,   91,   91,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n       91,   91,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57\n    },\n\n    {\n       15,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,   61,   61,\n       61,   61,   61,   61,   61,   61,   61,   61,  -58,  -58,\n\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58\n    },\n\n    {\n       15,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,   62,  -59,   63,   64,\n       64,   64,   64,   64,   64,   64,   64,   64,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,   65,   65,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n       65,   65,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59\n\n    },\n\n    {\n       15,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,   62,  -60,   66,   66,\n       66,   66,   66,   66,   66,   66,   66,   66,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,   65,   65,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n\n       65,   65,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60\n    },\n\n    {\n       15,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,   61,   61,\n       61,   61,   61,   61,   61,   61,   61,   61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,   65,   65,\n\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n       65,   65,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61\n    },\n\n    {\n       15,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,   65,   65,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n       65,   65,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62\n    },\n\n    {\n       15,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,   62,  -63,   93,   94,\n       94,   94,   94,   94,   94,   94,   94,   94,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,   65,   65,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n       65,   65,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63\n    },\n\n    {\n       15,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,   62,  -64,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,   65,   65,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n       65,   65,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64\n    },\n\n    {\n       15,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,   96,  -65,   96,  -65,  -65,   97,   97,\n\n       97,   97,   97,   97,   97,   97,   97,   97,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65\n    },\n\n    {\n       15,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,   62,  -66,   98,   98,\n       98,   98,   98,   98,   98,   98,   98,   98,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,   65,   65,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n       65,   65,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66\n    },\n\n    {\n       15,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67\n    },\n\n    {\n       15,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n       67,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,   68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,   69,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68\n    },\n\n    {\n       15,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n       70,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n\n      -69,  -69,   71,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69\n\n    },\n\n    {\n       15,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70\n    },\n\n    {\n       15,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n       70,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,   71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71\n    },\n\n    {\n       15,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,   72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n\n       72,   72,   72,   72,  -72,   72,   72,   72,   72,   72,\n       72,   72,   72,   72,   72,   72,   72,   72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,   72,   72,   72,   72,   72,\n       72,   72,   72,   72,   72,   72,   72,   72,   72,   72,\n       72,   72,   72,   72,   72,   72,   72,   72,   72,   72,\n       72,  -72,  -72,   99,   72,  -72,  -72,   72,   72,   72,\n       72,   72,   72,   72,   72,   72,   72,   72,   72,   72,\n       72,   72,   72,   72,   72,   72,   72,   72,   72,   72,\n       72,   72,   72,  -72,  -72,  -72,  -72,  -72\n    },\n\n    {\n       15,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n\n      -73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n\n       73,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       73,   73,   73,   73,   73,   73,   73,   73\n    },\n\n    {\n       15,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n      -74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,\n       74,   74,   74,   74,   74,   74,   74,   74\n    },\n\n    {\n       15,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       76,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,\n       75,   75,   75,   75,   75,   75,   75,   75\n    },\n\n    {\n       15,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76\n    },\n\n    {\n       15,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      -77,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100\n    },\n\n    {\n       15,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      -78,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  101,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100\n    },\n\n    {\n       15,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      -79,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n\n      100,  100,  102,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100\n\n    },\n\n    {\n       15,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      -80,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  103,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100\n    },\n\n    {\n       15,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      -81,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  104,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  105,  100,  100,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  100,  100,\n      100,  100,  100,  100,  100,  105,  105,  105,  105,  105,\n\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  100,  100,  100,  100,  105,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100\n    },\n\n    {\n       15,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      -82,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  104,  100,  100,  100,  100,  100,  100,  100,\n\n      100,  100,  100,  100,  100,  105,  100,  100,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  100,  100,\n      100,  100,  100,  100,  100,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  106,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  100,  100,  100,  100,  105,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100\n    },\n\n    {\n       15,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n\n      -83,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  104,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  105,  100,  100,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  100,  100,\n      100,  100,  100,  100,  100,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  107,  105,  105,  105,  105,  105,\n      105,  100,  100,  100,  100,  105,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100\n    },\n\n    {\n       15,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      -84,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  108,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  105,  100,  100,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  100,  100,\n      100,  100,  100,  100,  100,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  100,  100,  100,  100,  105,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100\n    },\n\n    {\n       15,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      -85,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  104,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  105,  100,  100,  105,  105,\n\n      105,  105,  105,  105,  105,  105,  105,  105,  100,  100,\n      100,  100,  100,  100,  100,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  109,  105,  105,  105,  105,  105,\n      105,  100,  100,  100,  100,  105,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,  100,  100,  100\n    },\n\n    {\n       15,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  110,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  111,  -86,  -86,  -86,   86,   86,\n       86,   86,   86,   86,   86,   86,   86,   86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,   91,   91,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n       91,   91,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86\n    },\n\n    {\n       15,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,   87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,   88,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87\n    },\n\n    {\n       15,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  112,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  113,  -88,  113,  114,  -88,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  -88,  -88,\n\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88\n    },\n\n    {\n       15,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n\n      -89,  -89,  110,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  111,  -89,  -89,  -89,  116,  116,\n      116,  116,  116,  116,  116,  116,  116,  116,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,   91,   91,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n       91,   91,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89\n\n    },\n\n    {\n       15,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,   87,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,   88,  -90,   89,  -90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,   91,   91,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n\n       91,   91,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90\n    },\n\n    {\n       15,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  117,  -91,  117,  -91,  -91,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91\n    },\n\n    {\n       15,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,   92,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,   65,   65,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n       65,   65,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92\n    },\n\n    {\n       15,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,   62,  -93,  119,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,   65,   65,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n       65,   65,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93\n    },\n\n    {\n       15,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,   62,  -94,  121,  121,\n      121,  121,  121,  121,  121,  121,  121,  121,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,   65,   65,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n       65,   65,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94\n    },\n\n    {\n       15,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,   62,  -95,  122,  122,\n\n      122,  122,  122,  122,  122,  122,  122,  122,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,   65,   65,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n       65,   65,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95\n    },\n\n    {\n       15,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96\n    },\n\n    {\n       15,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97\n    },\n\n    {\n       15,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,   62,  -98,  123,  123,\n      123,  123,  123,  123,  123,  123,  123,  123,  -98,  -98,\n\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,   65,   65,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n       65,   65,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98\n    },\n\n    {\n       15,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99\n\n    },\n\n    {\n       15,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n     -100,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124\n    },\n\n    {\n       15,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n     -101,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  125,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124\n    },\n\n    {\n       15,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n     -102,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  126,  124,  124,  124,  124,  124,  124,  124,\n\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124\n    },\n\n    {\n       15,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n\n     -103,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  127,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124\n    },\n\n    {\n       15,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n     -104,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  128,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124\n    },\n\n    {\n       15,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n     -105,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  129,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  130,  124,  124,  130,  130,\n\n      130,  130,  130,  130,  130,  130,  130,  130,  124,  124,\n      124,  124,  124,  124,  124,  130,  130,  130,  130,  130,\n      130,  130,  130,  130,  130,  130,  130,  130,  130,  130,\n      130,  130,  130,  130,  130,  130,  130,  130,  130,  130,\n      130,  124,  124,  124,  124,  130,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124\n    },\n\n    {\n       15,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n     -106,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  129,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  130,  124,  124,  130,  130,\n      130,  130,  130,  130,  130,  130,  130,  130,  124,  124,\n      124,  124,  124,  124,  124,  130,  130,  130,  130,  131,\n      130,  130,  130,  130,  130,  130,  130,  130,  130,  130,\n      130,  130,  130,  130,  130,  130,  130,  130,  130,  130,\n      130,  124,  124,  124,  124,  130,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n\n      124,  124,  124,  124,  124,  124,  124,  124\n    },\n\n    {\n       15,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n     -107,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  129,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  130,  124,  124,  130,  130,\n      130,  130,  130,  130,  130,  130,  130,  130,  124,  124,\n      124,  124,  124,  124,  124,  130,  130,  130,  130,  130,\n      130,  130,  130,  132,  130,  130,  130,  130,  130,  130,\n      130,  130,  130,  130,  130,  130,  130,  130,  130,  130,\n\n      130,  124,  124,  124,  124,  130,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124\n    },\n\n    {\n       15,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n     -108,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  133,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124\n    },\n\n    {\n       15,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n     -109,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n\n      124,  124,  129,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  130,  124,  124,  130,  130,\n      130,  130,  130,  130,  130,  130,  130,  130,  124,  124,\n      124,  124,  124,  124,  124,  130,  130,  130,  130,  130,\n      130,  130,  130,  130,  130,  130,  130,  130,  130,  134,\n      130,  130,  130,  130,  130,  130,  130,  130,  130,  130,\n      130,  124,  124,  124,  124,  130,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124\n\n    },\n\n    {\n       15, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110,  110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110,  111, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110\n    },\n\n    {\n       15, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111,  135, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111,  136, -111,  136,  114, -111,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111\n    },\n\n    {\n       15, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112,  112, -112, -112, -112, -112, -112, -112, -112,\n\n     -112, -112, -112,  113, -112,  113,  114, -112,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112\n    },\n\n    {\n       15, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113,  114, -113,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113\n    },\n\n    {\n       15, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114,  138,  138,\n      138,  138,  138,  138,  138,  138,  138,  138, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114\n    },\n\n    {\n       15, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115,  139, -115, -115, -115, -115, -115, -115, -115,\n     -115,  140, -115, -115, -115, -115,  141, -115,  142,  142,\n\n      142,  142,  142,  142,  142,  142,  142,  142, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115,  143,  143,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n      143,  143, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115\n    },\n\n    {\n       15, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116,  110, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116,  111, -116, -116, -116,  116,  116,\n      116,  116,  116,  116,  116,  116,  116,  116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116,   91,   91,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n       91,   91, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n\n     -116, -116, -116, -116, -116, -116, -116, -116\n    },\n\n    {\n       15, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117\n    },\n\n    {\n       15, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118,  110, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118,  111, -118, -118, -118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118, -118, -118,\n\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118\n    },\n\n    {\n       15, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119,   62, -119,  144,  145,\n      145,  145,  145,  145,  145,  145,  145,  145, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119,   65,   65,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n       65,   65, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119\n\n    },\n\n    {\n       15, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120,   62, -120,  146,  146,\n      146,  146,  146,  146,  146,  146,  146,  146, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120,   65,   65,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n\n       65,   65, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120\n    },\n\n    {\n       15, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121,   62, -121,  147,  147,\n      147,  147,  147,  147,  147,  147,  147,  147, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121,   65,   65,\n\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n       65,   65, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121\n    },\n\n    {\n       15, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n\n     -122, -122, -122, -122, -122, -122,   62, -122,  148,  148,\n      148,  148,  148,  148,  148,  148,  148,  148, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122,   65,   65,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n       65,   65, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122\n    },\n\n    {\n       15, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123,   62, -123,  149,  149,\n      149,  149,  149,  149,  149,  149,  149,  149, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123,   65,   65,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n       65,   65, -123, -123, -123, -123, -123, -123, -123, -123,\n\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123\n    },\n\n    {\n       15,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n     -124,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150\n    },\n\n    {\n       15,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n     -125,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  151,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150\n    },\n\n    {\n       15,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n     -126,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  152,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n\n      150,  150,  150,  150,  150,  150,  150,  150\n    },\n\n    {\n       15,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n     -127,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  153,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150\n    },\n\n    {\n       15,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n     -128,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  154,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150\n    },\n\n    {\n       15,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n     -129,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n\n      150,  150,  155,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150\n\n    },\n\n    {\n       15,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n     -130,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  156,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  157,  150,  150,  157,  157,\n      157,  157,  157,  157,  157,  157,  157,  157,  150,  150,\n      150,  150,  150,  150,  150,  157,  157,  157,  157,  157,\n      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,\n      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,\n      157,  150,  150,  150,  150,  157,  150,  150,  150,  150,\n\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150\n    },\n\n    {\n       15,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n     -131,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  156,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  157,  150,  150,  157,  157,\n      157,  157,  157,  157,  157,  157,  157,  157,  150,  150,\n      150,  150,  150,  150,  150,  157,  157,  157,  157,  157,\n\n      157,  157,  157,  157,  157,  157,  157,  157,  158,  157,\n      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,\n      157,  150,  150,  150,  150,  157,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150\n    },\n\n    {\n       15,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n     -132,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  156,  150,  150,  150,  150,  150,  150,  150,\n\n      150,  150,  150,  150,  150,  157,  150,  150,  157,  157,\n      157,  157,  157,  157,  157,  157,  157,  157,  150,  150,\n      150,  150,  150,  150,  150,  157,  157,  157,  157,  157,\n      157,  157,  157,  157,  157,  157,  157,  157,  159,  157,\n      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,\n      157,  150,  150,  150,  150,  157,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150\n    },\n\n    {\n       15,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n\n     -133,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  160,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150\n    },\n\n    {\n       15,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n     -134,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  156,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  157,  150,  150,  157,  157,\n      157,  157,  157,  157,  157,  157,  157,  157,  150,  150,\n      150,  150,  150,  150,  150,  157,  157,  157,  157,  157,\n      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,\n\n      157,  157,  161,  157,  157,  157,  157,  157,  157,  157,\n      157,  150,  150,  150,  150,  157,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,  150,  150,  150,  150\n    },\n\n    {\n       15, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135,  135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135,  136, -135,  136,  114, -135,  137,  137,\n\n      137,  137,  137,  137,  137,  137,  137,  137, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135\n    },\n\n    {\n       15, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136,  114, -136,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n\n     -136, -136, -136, -136, -136, -136, -136, -136\n    },\n\n    {\n       15, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137,  162, -137, -137, -137, -137, -137, -137, -137,\n     -137,  163, -137, -137, -137, -137,  141, -137,  164,  164,\n      164,  164,  164,  164,  164,  164,  164,  164, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137,  143,  143,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n      143,  143, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137\n    },\n\n    {\n       15, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138,  162, -138, -138, -138, -138, -138, -138, -138,\n     -138,  163, -138, -138, -138, -138, -138, -138,  138,  138,\n      138,  138,  138,  138,  138,  138,  138,  138, -138, -138,\n\n     -138, -138, -138, -138, -138, -138, -138, -138,  143,  143,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n      143,  143, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138\n    },\n\n    {\n       15, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n\n     -139, -139,  139, -139, -139, -139, -139, -139, -139, -139,\n     -139,  140, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139\n\n    },\n\n    {\n       15, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140\n    },\n\n    {\n       15, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141,  162, -141, -141, -141, -141, -141, -141, -141,\n     -141,  163, -141, -141, -141, -141, -141, -141,  165,  165,\n      165,  165,  165,  165,  165,  165,  165,  165, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141,  143,  143,\n\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n      143,  143, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141\n    },\n\n    {\n       15, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142,  139, -142, -142, -142, -142, -142, -142, -142,\n\n     -142,  140, -142, -142, -142, -142,  141, -142,  142,  142,\n      142,  142,  142,  142,  142,  142,  142,  142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142,  143,  143,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n      143,  143, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142\n    },\n\n    {\n       15, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143,  166, -143,  166, -143, -143,  167,  167,\n      167,  167,  167,  167,  167,  167,  167,  167, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143\n    },\n\n    {\n       15, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144,   62, -144,  168,  169,\n      169,  169,  169,  169,  169,  169,  169,  169, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144,   65,   65,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n       65,   65, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144\n    },\n\n    {\n       15, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145,   62, -145,  170,  170,\n\n      170,  170,  170,  170,  170,  170,  170,  170, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145,   65,   65,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n       65,   65, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145\n    },\n\n    {\n       15, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146,   62, -146,  171,  171,\n      171,  171,  171,  171,  171,  171,  171,  171, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146,   65,   65,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n       65,   65, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n\n     -146, -146, -146, -146, -146, -146, -146, -146\n    },\n\n    {\n       15, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147,   62, -147,  172,  172,\n      172,  172,  172,  172,  172,  172,  172,  172, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147,   65,   65,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n       65,   65, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147\n    },\n\n    {\n       15, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148,   62, -148,  173,  173,\n      173,  173,  173,  173,  173,  173,  173,  173, -148, -148,\n\n     -148, -148, -148, -148, -148, -148, -148, -148,   65,   65,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n       65,   65, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148\n    },\n\n    {\n       15, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149,   62, -149,  174,  174,\n      174,  174,  174,  174,  174,  174,  174,  174, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149,   65,   65,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n       65,   65, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149\n\n    },\n\n    {\n       15,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n     -150,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175\n    },\n\n    {\n       15,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n     -151,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  176,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175\n    },\n\n    {\n       15,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n     -152,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  177,  175,  175,  175,  175,  175,  175,  175,\n\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175\n    },\n\n    {\n       15,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n\n     -153,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  178,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175\n    },\n\n    {\n       15,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n     -154,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  179,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175\n    },\n\n    {\n       15,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n     -155,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  180,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175\n    },\n\n    {\n       15,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n     -156,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  181,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n\n      175,  175,  175,  175,  175,  175,  175,  175\n    },\n\n    {\n       15,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n     -157,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  182,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  183,  175,  175,  183,  183,\n      183,  183,  183,  183,  183,  183,  183,  183,  175,  175,\n      175,  175,  175,  175,  175,  183,  183,  183,  183,  183,\n      183,  183,  183,  183,  183,  183,  183,  183,  183,  183,\n      183,  183,  183,  183,  183,  183,  183,  183,  183,  183,\n\n      183,  175,  175,  175,  175,  183,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175\n    },\n\n    {\n       15,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n     -158,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  182,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  183,  175,  175,  183,  183,\n      183,  183,  183,  183,  183,  183,  183,  183,  175,  175,\n\n      175,  175,  175,  175,  175,  183,  183,  183,  183,  183,\n      183,  183,  183,  183,  183,  183,  183,  183,  183,  183,\n      183,  183,  183,  183,  184,  183,  183,  183,  183,  183,\n      183,  175,  175,  175,  175,  183,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175\n    },\n\n    {\n       15,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n     -159,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n\n      175,  175,  182,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  183,  175,  175,  183,  183,\n      183,  183,  183,  183,  183,  183,  183,  183,  175,  175,\n      175,  175,  175,  175,  175,  183,  183,  183,  183,  183,\n      183,  183,  183,  183,  183,  183,  183,  183,  183,  183,\n      183,  183,  183,  183,  183,  185,  183,  183,  183,  183,\n      183,  175,  175,  175,  175,  183,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175\n\n    },\n\n    {\n       15,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n     -160,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  186,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175\n    },\n\n    {\n       15,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n     -161,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  182,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  183,  175,  175,  183,  183,\n      183,  183,  183,  183,  183,  183,  183,  183,  175,  175,\n      175,  175,  175,  175,  175,  183,  183,  183,  183,  183,\n\n      183,  183,  183,  183,  183,  183,  183,  183,  183,  183,\n      183,  183,  183,  183,  183,  183,  183,  183,  183,  184,\n      183,  175,  175,  175,  175,  183,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,  175,  175,  175,  175,  175,  175,  175\n    },\n\n    {\n       15, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162,  162, -162, -162, -162, -162, -162, -162, -162,\n\n     -162,  163, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162\n    },\n\n    {\n       15, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163\n    },\n\n    {\n       15, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164,  162, -164, -164, -164, -164, -164, -164, -164,\n     -164,  163, -164, -164, -164, -164,  141, -164,  164,  164,\n      164,  164,  164,  164,  164,  164,  164,  164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164,  143,  143,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n      143,  143, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164\n    },\n\n    {\n       15, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165,  162, -165, -165, -165, -165, -165, -165, -165,\n     -165,  163, -165, -165, -165, -165, -165, -165,  165,  165,\n\n      165,  165,  165,  165,  165,  165,  165,  165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165,  143,  143,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n      143,  143, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165\n    },\n\n    {\n       15, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166,  167,  167,\n      167,  167,  167,  167,  167,  167,  167,  167, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n\n     -166, -166, -166, -166, -166, -166, -166, -166\n    },\n\n    {\n       15, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167,  162, -167, -167, -167, -167, -167, -167, -167,\n     -167,  163, -167, -167, -167, -167, -167, -167,  167,  167,\n      167,  167,  167,  167,  167,  167,  167,  167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167\n    },\n\n    {\n       15, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168,   62, -168,  187,  188,\n      188,  188,  188,  188,  188,  188,  188,  188, -168, -168,\n\n     -168, -168, -168, -168, -168, -168, -168, -168,   65,   65,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n       65,   65, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168\n    },\n\n    {\n       15, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169,   62, -169,  189,  189,\n      189,  189,  189,  189,  189,  189,  189,  189, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169,   65,   65,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n       65,   65, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169\n\n    },\n\n    {\n       15, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170,   62, -170,  190,  190,\n      190,  190,  190,  190,  190,  190,  190,  190, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170,   65,   65,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n\n       65,   65, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170\n    },\n\n    {\n       15, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171,   62, -171,  191,  191,\n      191,  191,  191,  191,  191,  191,  191,  191, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171,   65,   65,\n\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n       65,   65, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171\n    },\n\n    {\n       15, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n\n     -172, -172, -172, -172, -172, -172,   62, -172,  192,  192,\n      192,  192,  192,  192,  192,  192,  192,  192, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172,   65,   65,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n       65,   65, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172\n    },\n\n    {\n       15, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173,   62, -173,  193,  193,\n      193,  193,  193,  193,  193,  193,  193,  193, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173,   65,   65,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n       65,   65, -173, -173, -173, -173, -173, -173, -173, -173,\n\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173\n    },\n\n    {\n       15, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174,   62, -174,  194,  194,\n      194,  194,  194,  194,  194,  194,  194,  194, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174,   65,   65,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n       65,   65, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174\n    },\n\n    {\n       15,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n     -175,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195\n    },\n\n    {\n       15,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n     -176,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  196,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n\n      195,  195,  195,  195,  195,  195,  195,  195\n    },\n\n    {\n       15,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n     -177,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  197,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195\n    },\n\n    {\n       15,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n     -178,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  197,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195\n    },\n\n    {\n       15,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n     -179,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n\n      195,  195,  197,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195\n\n    },\n\n    {\n       15,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n     -180,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  197,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195\n    },\n\n    {\n       15,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n     -181,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  197,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195\n    },\n\n    {\n       15,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n     -182,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  197,  195,  195,  195,  195,  195,  195,  195,\n\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195\n    },\n\n    {\n       15,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n\n     -183,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  198,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  197,  195,  195,  197,  197,\n      197,  197,  197,  197,  197,  197,  197,  197,  195,  195,\n      195,  195,  195,  195,  195,  197,  197,  197,  197,  197,\n      197,  197,  197,  197,  197,  197,  197,  197,  197,  197,\n      197,  197,  197,  197,  197,  197,  197,  197,  197,  197,\n      197,  195,  195,  195,  195,  197,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195\n    },\n\n    {\n       15,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n     -184,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  198,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  197,  195,  195,  197,  197,\n      197,  197,  197,  197,  197,  197,  197,  197,  195,  195,\n      195,  195,  195,  195,  195,  197,  197,  197,  197,  197,\n      197,  197,  197,  197,  197,  197,  197,  197,  197,  197,\n\n      197,  197,  197,  197,  197,  197,  197,  197,  197,  197,\n      197,  195,  195,  195,  195,  197,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195\n    },\n\n    {\n       15,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n     -185,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  198,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  197,  195,  195,  197,  197,\n\n      197,  197,  197,  197,  197,  197,  197,  197,  195,  195,\n      195,  195,  195,  195,  195,  197,  197,  197,  197,  199,\n      197,  197,  197,  197,  197,  197,  197,  197,  197,  197,\n      197,  197,  197,  197,  197,  197,  197,  197,  197,  197,\n      197,  195,  195,  195,  195,  197,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195\n    },\n\n    {\n       15,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n     -186,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  200,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,  195,  195,  195,  195,\n\n      195,  195,  195,  195,  195,  195,  195,  195\n    },\n\n    {\n       15, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187,   62, -187,  201,  202,\n      202,  202,  202,  202,  202,  202,  202,  202, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187,   65,   65,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n       65,   65, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187\n    },\n\n    {\n       15, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188,   62, -188,  203,  203,\n      203,  203,  203,  203,  203,  203,  203,  203, -188, -188,\n\n     -188, -188, -188, -188, -188, -188, -188, -188,   65,   65,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n       65,   65, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188\n    },\n\n    {\n       15, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189,   62, -189,  204,  204,\n      204,  204,  204,  204,  204,  204,  204,  204, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189,   65,   65,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n       65,   65, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189\n\n    },\n\n    {\n       15, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190,   62, -190,  205,  205,\n      205,  205,  205,  205,  205,  205,  205,  205, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190,   65,   65,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n\n       65,   65, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190\n    },\n\n    {\n       15, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191,   62, -191,  206,  206,\n      206,  206,  206,  206,  206,  206,  206,  206, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191,   65,   65,\n\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n       65,   65, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191\n    },\n\n    {\n       15, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n\n     -192, -192, -192, -192, -192, -192,   62, -192,  207,  207,\n      207,  207,  207,  207,  207,  207,  207,  207, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192,   65,   65,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n       65,   65, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192\n    },\n\n    {\n       15, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193,   62, -193,  208,  208,\n      208,  208,  208,  208,  208,  208,  208,  208, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193,   65,   65,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n       65,   65, -193, -193, -193, -193, -193, -193, -193, -193,\n\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193\n    },\n\n    {\n       15, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194,   62, -194,  209,  209,\n      209,  209,  209,  209,  209,  209,  209,  209, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194,   65,   65,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n       65,   65, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194\n    },\n\n    {\n       15, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195,  210, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195\n    },\n\n    {\n       15, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196,  211, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196,  210, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n\n     -196, -196, -196, -196, -196, -196, -196, -196\n    },\n\n    {\n       15, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197,  212, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197\n    },\n\n    {\n       15, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n\n     -198,  212, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198\n    },\n\n    {\n       15, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n\n     -199, -199,  213, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199,  212, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199\n\n    },\n\n    {\n       15, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200,  214, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200,  215, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200\n    },\n\n    {\n       15, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201,   62, -201,  216,  217,\n      217,  217,  217,  217,  217,  217,  217,  217, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201,   65,   65,\n\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n       65,   65, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201\n    },\n\n    {\n       15, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n\n     -202, -202, -202, -202, -202, -202,   62, -202,  218,  218,\n      218,  218,  218,  218,  218,  218,  218,  218, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202,   65,   65,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n       65,   65, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202\n    },\n\n    {\n       15, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203,   62, -203,  219,  219,\n      219,  219,  219,  219,  219,  219,  219,  219, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203,   65,   65,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n       65,   65, -203, -203, -203, -203, -203, -203, -203, -203,\n\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203\n    },\n\n    {\n       15, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204,   62, -204,  220,  220,\n      220,  220,  220,  220,  220,  220,  220,  220, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204,   65,   65,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n       65,   65, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204\n    },\n\n    {\n       15, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205,   62, -205,  221,  221,\n\n      221,  221,  221,  221,  221,  221,  221,  221, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205,   65,   65,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n       65,   65, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205\n    },\n\n    {\n       15, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206,   62, -206,  222,  222,\n      222,  222,  222,  222,  222,  222,  222,  222, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206,   65,   65,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n       65,   65, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n\n     -206, -206, -206, -206, -206, -206, -206, -206\n    },\n\n    {\n       15, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207,   62, -207,  223,  223,\n      223,  223,  223,  223,  223,  223,  223,  223, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207,   65,   65,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n       65,   65, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207\n    },\n\n    {\n       15, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208,   62, -208,  224,  224,\n      224,  224,  224,  224,  224,  224,  224,  224, -208, -208,\n\n     -208, -208, -208, -208, -208, -208, -208, -208,   65,   65,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n       65,   65, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208\n    },\n\n    {\n       15, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209,   62, -209,  225,  225,\n      225,  225,  225,  225,  225,  225,  225,  225, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209,   65,   65,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n       65,   65, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209\n\n    },\n\n    {\n       15, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210,  226, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210\n    },\n\n    {\n       15, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211,  227, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211\n    },\n\n    {\n       15, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212,  228, -212, -212, -212, -212, -212, -212, -212,\n\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212\n    },\n\n    {\n       15, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213,  229, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213\n    },\n\n    {\n       15, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214,  230, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214\n    },\n\n    {\n       15, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215,  231, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215\n    },\n\n    {\n       15, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216,   62, -216,  232,  233,\n      233,  233,  233,  233,  233,  233,  233,  233, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216,   65,   65,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n       65,   65, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n\n     -216, -216, -216, -216, -216, -216, -216, -216\n    },\n\n    {\n       15, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217,   62, -217,  234,  234,\n      234,  234,  234,  234,  234,  234,  234,  234, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217,   65,   65,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n       65,   65, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217\n    },\n\n    {\n       15, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218,   62, -218,  235,  235,\n      235,  235,  235,  235,  235,  235,  235,  235, -218, -218,\n\n     -218, -218, -218, -218, -218, -218, -218, -218,   65,   65,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n       65,   65, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218\n    },\n\n    {\n       15, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219,   62, -219,  236,  236,\n      236,  236,  236,  236,  236,  236,  236,  236, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219,   65,   65,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n       65,   65, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219\n\n    },\n\n    {\n       15, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220,   62, -220,  237,  237,\n      237,  237,  237,  237,  237,  237,  237,  237, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220,   65,   65,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n\n       65,   65, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220\n    },\n\n    {\n       15, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221,   62, -221,  238,  238,\n      238,  238,  238,  238,  238,  238,  238,  238, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221,   65,   65,\n\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n       65,   65, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221\n    },\n\n    {\n       15, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n\n     -222, -222, -222, -222, -222, -222,   62, -222,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222,   65,   65,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n       65,   65, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222\n    },\n\n    {\n       15, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223,   62, -223,  240,  240,\n      240,  240,  240,  240,  240,  240,  240,  240, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223,   65,   65,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n       65,   65, -223, -223, -223, -223, -223, -223, -223, -223,\n\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223\n    },\n\n    {\n       15, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224,   62, -224,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224,   65,   65,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n       65,   65, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224\n    },\n\n    {\n       15, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225,   62, -225,  242,  242,\n\n      242,  242,  242,  242,  242,  242,  242,  242, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225,   65,   65,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n       65,   65, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225\n    },\n\n    {\n       15, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226,  226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n\n     -226, -226, -226, -226, -226, -226, -226, -226\n    },\n\n    {\n       15, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227,  243, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227\n    },\n\n    {\n       15, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228,  228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228\n    },\n\n    {\n       15, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n\n     -229, -229,  213, -229, -229, -229, -229, -229, -229,  244,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229\n\n    },\n\n    {\n       15, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230,  245, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230\n    },\n\n    {\n       15, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231,  231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231\n    },\n\n    {\n       15, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n\n     -232, -232, -232, -232, -232, -232,   62, -232,  246,  247,\n      247,  247,  247,  247,  247,  247,  247,  247, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232,   65,   65,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n       65,   65, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232\n    },\n\n    {\n       15, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233,   62, -233,  248,  248,\n      248,  248,  248,  248,  248,  248,  248,  248, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233,   65,   65,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n       65,   65, -233, -233, -233, -233, -233, -233, -233, -233,\n\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233\n    },\n\n    {\n       15, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234,   62, -234,  249,  249,\n      249,  249,  249,  249,  249,  249,  249,  249, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234,   65,   65,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n       65,   65, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234\n    },\n\n    {\n       15, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235,   62, -235,  250,  250,\n\n      250,  250,  250,  250,  250,  250,  250,  250, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235,   65,   65,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n       65,   65, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235\n    },\n\n    {\n       15, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236,   62, -236,  251,  251,\n      251,  251,  251,  251,  251,  251,  251,  251, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236,   65,   65,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n       65,   65, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n\n     -236, -236, -236, -236, -236, -236, -236, -236\n    },\n\n    {\n       15, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237,   62, -237,  252,  252,\n      252,  252,  252,  252,  252,  252,  252,  252, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237,   65,   65,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n       65,   65, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237\n    },\n\n    {\n       15, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238,   62, -238,  253,  253,\n      253,  253,  253,  253,  253,  253,  253,  253, -238, -238,\n\n     -238, -238, -238, -238, -238, -238, -238, -238,   65,   65,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n       65,   65, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238\n    },\n\n    {\n       15, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239,   62, -239,  254,  254,\n      254,  254,  254,  254,  254,  254,  254,  254, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239,   65,   65,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n       65,   65, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239\n\n    },\n\n    {\n       15, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240,   62, -240,  255,  255,\n      255,  255,  255,  255,  255,  255,  255,  255, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240,   65,   65,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n\n       65,   65, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240\n    },\n\n    {\n       15, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241,   62, -241,  256,  256,\n      256,  256,  256,  256,  256,  256,  256,  256, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241,   65,   65,\n\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n       65,   65, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241\n    },\n\n    {\n       15, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n\n     -242, -242, -242, -242, -242, -242,   62, -242,  257,  257,\n      257,  257,  257,  257,  257,  257,  257,  257, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242,   65,   65,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n       65,   65, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242\n    },\n\n    {\n       15, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243,  258, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243\n    },\n\n    {\n       15,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  260,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259\n    },\n\n    {\n       15, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245,  261, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245\n    },\n\n    {\n       15, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246,   62, -246,  262,  263,\n      263,  263,  263,  263,  263,  263,  263,  263, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246,   65,   65,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n       65,   65, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n\n     -246, -246, -246, -246, -246, -246, -246, -246\n    },\n\n    {\n       15, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247,   62, -247,  264,  264,\n      264,  264,  264,  264,  264,  264,  264,  264, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247,   65,   65,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n       65,   65, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247\n    },\n\n    {\n       15, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248,   62, -248,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  265, -248, -248,\n\n     -248, -248, -248, -248, -248, -248, -248, -248,   65,   65,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n       65,   65, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248\n    },\n\n    {\n       15, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249,   62, -249,  266,  266,\n      266,  266,  266,  266,  266,  266,  266,  266, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249,   65,   65,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n       65,   65, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249\n\n    },\n\n    {\n       15, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250,   62, -250,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250,   65,   65,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n\n       65,   65, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250\n    },\n\n    {\n       15, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251,   62, -251,  268,  268,\n      268,  268,  268,  268,  268,  268,  268,  268, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251,   65,   65,\n\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n       65,   65, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251\n    },\n\n    {\n       15, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n\n     -252, -252, -252, -252, -252, -252,   62, -252,  269,  269,\n      269,  269,  269,  269,  269,  269,  269,  269, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252,   65,   65,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n       65,   65, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252\n    },\n\n    {\n       15, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253,   62, -253,  270,  270,\n      270,  270,  270,  270,  270,  270,  270,  270, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253,   65,   65,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n       65,   65, -253, -253, -253, -253, -253, -253, -253, -253,\n\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253\n    },\n\n    {\n       15, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254,   62, -254,  271,  271,\n      271,  271,  271,  271,  271,  271,  271,  271, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254,   65,   65,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n       65,   65, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254\n    },\n\n    {\n       15, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255,   62, -255,  272,  272,\n\n      272,  272,  272,  272,  272,  272,  272,  272, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255,   65,   65,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n       65,   65, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255\n    },\n\n    {\n       15, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256,   62, -256,  273,  273,\n      273,  273,  273,  273,  273,  273,  273,  273, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256,   65,   65,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n       65,   65, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n\n     -256, -256, -256, -256, -256, -256, -256, -256\n    },\n\n    {\n       15, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257,   62, -257,  274,  274,\n      274,  274,  274,  274,  274,  274,  274,  274, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257,   65,   65,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n       65,   65, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257\n    },\n\n    {\n       15, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258,  275, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258\n    },\n\n    {\n       15,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  260,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259\n\n    },\n\n    {\n       15, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260,  259,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260\n    },\n\n    {\n       15, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261,  276, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261\n    },\n\n    {\n       15, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n\n     -262, -262, -262, -262, -262, -262,   62, -262,  277,  278,\n      278,  278,  278,  278,  278,  278,  278,  278, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262,   65,   65,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n       65,   65, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262\n    },\n\n    {\n       15, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263,   62, -263,  279,  279,\n      279,  279,  279,  279,  279,  279,  279,  279, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263,   65,   65,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n       65,   65, -263, -263, -263, -263, -263, -263, -263, -263,\n\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263\n    },\n\n    {\n       15, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264,   62, -264,  280,  280,\n      280,  280,  280,  280,  280,  280,  280,  280, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264,   65,   65,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n       65,   65, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264\n    },\n\n    {\n       15, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265,   62, -265,  281,  281,\n\n      281,  281,  281,  281,  281,  281,  281,  281, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265,   65,   65,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n       65,   65, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265\n    },\n\n    {\n       15, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266,   62, -266,  282,  282,\n      282,  282,  282,  282,  282,  282,  282,  282, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266,   65,   65,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n       65,   65, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n\n     -266, -266, -266, -266, -266, -266, -266, -266\n    },\n\n    {\n       15, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267,   62, -267,  283,  283,\n      283,  283,  283,  283,  283,  283,  283,  283, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267,   65,   65,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n       65,   65, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267\n    },\n\n    {\n       15, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268,   62, -268,  284,  284,\n      284,  284,  284,  284,  284,  284,  284,  284, -268, -268,\n\n     -268, -268, -268, -268, -268, -268, -268, -268,   65,   65,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n       65,   65, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268\n    },\n\n    {\n       15, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269,   62, -269,  285,  285,\n      285,  285,  285,  285,  285,  285,  285,  285, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269,   65,   65,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n       65,   65, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269\n\n    },\n\n    {\n       15, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270,   62, -270,  286,  286,\n      286,  286,  286,  286,  286,  286,  286,  286, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270,   65,   65,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n\n       65,   65, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270\n    },\n\n    {\n       15, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271,   62, -271,  287,  287,\n      287,  287,  287,  287,  287,  287,  287,  287, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271,   65,   65,\n\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n       65,   65, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271\n    },\n\n    {\n       15, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n\n     -272, -272, -272, -272, -272, -272,   62, -272,  288,  288,\n      288,  288,  288,  288,  288,  288,  288,  288, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272,   65,   65,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n       65,   65, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272\n    },\n\n    {\n       15, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273,   62, -273,  289,  289,\n      289,  289,  289,  289,  289,  289,  289,  289, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273,   65,   65,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n       65,   65, -273, -273, -273, -273, -273, -273, -273, -273,\n\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273\n    },\n\n    {\n       15, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274,   62, -274,  290,  290,\n      290,  290,  290,  290,  290,  290,  290,  290, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274,   65,   65,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n       65,   65, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274\n    },\n\n    {\n       15, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275,  291, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275\n    },\n\n    {\n       15, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276,  292, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n\n     -276, -276, -276, -276, -276, -276, -276, -276\n    },\n\n    {\n       15, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277,   62, -277,  293,  294,\n      294,  294,  294,  294,  294,  294,  294,  294, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277,   65,   65,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n       65,   65, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277\n    },\n\n    {\n       15, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278,   62, -278,  295,  295,\n      295,  295,  295,  295,  295,  295,  295,  295, -278, -278,\n\n     -278, -278, -278, -278, -278, -278, -278, -278,   65,   65,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n       65,   65, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278\n    },\n\n    {\n       15, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279,   62, -279,  296,  296,\n      296,  296,  296,  296,  296,  296,  296,  296, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279,   65,   65,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n       65,   65, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279\n\n    },\n\n    {\n       15, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280,   62, -280,  297,  297,\n      297,  297,  297,  297,  297,  297,  297,  297, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280,   65,   65,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n\n       65,   65, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280\n    },\n\n    {\n       15, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281,   62, -281,  298,  298,\n      298,  298,  298,  298,  298,  298,  298,  298, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281,   65,   65,\n\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n       65,   65, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281\n    },\n\n    {\n       15, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n\n     -282, -282, -282, -282, -282, -282,   62, -282,  299,  299,\n      299,  299,  299,  299,  299,  299,  299,  299, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282,   65,   65,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n       65,   65, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282\n    },\n\n    {\n       15, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283,   62, -283,  300,  300,\n      300,  300,  300,  300,  300,  300,  300,  300, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283,   65,   65,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n       65,   65, -283, -283, -283, -283, -283, -283, -283, -283,\n\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283\n    },\n\n    {\n       15, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284,   62, -284,  301,  301,\n      301,  301,  301,  301,  301,  301,  301,  301, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284,   65,   65,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n       65,   65, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284\n    },\n\n    {\n       15, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285,   62, -285,  302,  302,\n\n      302,  302,  302,  302,  302,  302,  302,  302, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285,   65,   65,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n       65,   65, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285\n    },\n\n    {\n       15, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286,   62, -286,  303,  303,\n      303,  303,  303,  303,  303,  303,  303,  303, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286,   65,   65,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n       65,   65, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n\n     -286, -286, -286, -286, -286, -286, -286, -286\n    },\n\n    {\n       15, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287,   62, -287,  304,  304,\n      304,  304,  304,  304,  304,  304,  304,  304, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287,   65,   65,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n       65,   65, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287\n    },\n\n    {\n       15, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288,   62, -288,  305,  305,\n      305,  305,  305,  305,  305,  305,  305,  305, -288, -288,\n\n     -288, -288, -288, -288, -288, -288, -288, -288,   65,   65,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n       65,   65, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288\n    },\n\n    {\n       15, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289,   62, -289,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289,   65,   65,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n       65,   65, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289\n\n    },\n\n    {\n       15, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290,   62, -290,  307,  307,\n      307,  307,  307,  307,  307,  307,  307,  307, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290,   65,   65,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n\n       65,   65, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290\n    },\n\n    {\n       15, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291,  308, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291\n    },\n\n    {\n       15, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292,  309, -292, -292, -292, -292, -292, -292, -292,\n\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292\n    },\n\n    {\n       15, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293,   62, -293,  310,  311,\n      311,  311,  311,  311,  311,  311,  311,  311, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293,   65,   65,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n       65,   65, -293, -293, -293, -293, -293, -293, -293, -293,\n\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293\n    },\n\n    {\n       15, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294,   62, -294,  312,  312,\n      312,  312,  312,  312,  312,  312,  312,  312, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294,   65,   65,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n       65,   65, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294\n    },\n\n    {\n       15, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295,   62, -295,  313,  313,\n\n      313,  313,  313,  313,  313,  313,  313,  313, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295,   65,   65,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n       65,   65, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295\n    },\n\n    {\n       15, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296,   62, -296,  314,  314,\n      314,  314,  314,  314,  314,  314,  314,  314, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296,   65,   65,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n       65,   65, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n\n     -296, -296, -296, -296, -296, -296, -296, -296\n    },\n\n    {\n       15, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297,   62, -297,  315,  315,\n      315,  315,  315,  315,  315,  315,  315,  315, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297,   65,   65,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n       65,   65, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297\n    },\n\n    {\n       15, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298,   62, -298,  316,  316,\n      316,  316,  316,  316,  316,  316,  316,  316, -298, -298,\n\n     -298, -298, -298, -298, -298, -298, -298, -298,   65,   65,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n       65,   65, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298\n    },\n\n    {\n       15, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299,   62, -299,  317,  317,\n      317,  317,  317,  317,  317,  317,  317,  317, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299,   65,   65,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n       65,   65, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299\n\n    },\n\n    {\n       15, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300,   62, -300,  318,  318,\n      318,  318,  318,  318,  318,  318,  318,  318, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300,   65,   65,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n\n       65,   65, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300\n    },\n\n    {\n       15, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301,   62, -301,  319,  319,\n      319,  319,  319,  319,  319,  319,  319,  319, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301,   65,   65,\n\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n       65,   65, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301\n    },\n\n    {\n       15, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n\n     -302, -302, -302, -302, -302, -302,   62, -302,  320,  320,\n      320,  320,  320,  320,  320,  320,  320,  320, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302,   65,   65,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n       65,   65, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302\n    },\n\n    {\n       15, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303,   62, -303,  321,  321,\n      321,  321,  321,  321,  321,  321,  321,  321, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303,   65,   65,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n       65,   65, -303, -303, -303, -303, -303, -303, -303, -303,\n\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303\n    },\n\n    {\n       15, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304,   62, -304,  322,  322,\n      322,  322,  322,  322,  322,  322,  322,  322, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304,   65,   65,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n       65,   65, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304\n    },\n\n    {\n       15, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305,   62, -305,  323,  323,\n\n      323,  323,  323,  323,  323,  323,  323,  323, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305,   65,   65,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n       65,   65, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305\n    },\n\n    {\n       15, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306,   62, -306,  324,  324,\n      324,  324,  324,  324,  324,  324,  324,  324, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306,   65,   65,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n       65,   65, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n\n     -306, -306, -306, -306, -306, -306, -306, -306\n    },\n\n    {\n       15, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307,   62, -307,  325,  325,\n      325,  325,  325,  325,  325,  325,  325,  325, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307,   65,   65,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n       65,   65, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307\n    },\n\n    {\n       15, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308,  326, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308\n    },\n\n    {\n       15, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n\n     -309, -309,  327, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309\n\n    },\n\n    {\n       15, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310,   62, -310,  328,  329,\n      329,  329,  329,  329,  329,  329,  329,  329, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310,   65,   65,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n\n       65,   65, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310\n    },\n\n    {\n       15, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311,   62, -311,  330,  330,\n      330,  330,  330,  330,  330,  330,  330,  330, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311,   65,   65,\n\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n       65,   65, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311\n    },\n\n    {\n       15, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n\n     -312, -312, -312, -312, -312, -312,   62, -312,  331,  331,\n      331,  331,  331,  331,  331,  331,  331,  331, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312,   65,   65,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n       65,   65, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312\n    },\n\n    {\n       15, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313,   62, -313,  332,  332,\n      332,  332,  332,  332,  332,  332,  332,  332, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313,   65,   65,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n       65,   65, -313, -313, -313, -313, -313, -313, -313, -313,\n\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313\n    },\n\n    {\n       15, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314,   62, -314,  333,  333,\n      333,  333,  333,  333,  333,  333,  333,  333, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314,   65,   65,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n       65,   65, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314\n    },\n\n    {\n       15, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315,   62, -315,  334,  334,\n\n      334,  334,  334,  334,  334,  334,  334,  334, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315,   65,   65,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n       65,   65, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315\n    },\n\n    {\n       15, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316,   62, -316,  335,  335,\n      335,  335,  335,  335,  335,  335,  335,  335, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316,   65,   65,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n       65,   65, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n\n     -316, -316, -316, -316, -316, -316, -316, -316\n    },\n\n    {\n       15, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317,   62, -317,  336,  336,\n      336,  336,  336,  336,  336,  336,  336,  336, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317,   65,   65,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n       65,   65, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317\n    },\n\n    {\n       15, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318,   62, -318,  337,  337,\n      337,  337,  337,  337,  337,  337,  337,  337, -318, -318,\n\n     -318, -318, -318, -318, -318, -318, -318, -318,   65,   65,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n       65,   65, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318\n    },\n\n    {\n       15, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319,   62, -319,  338,  338,\n      338,  338,  338,  338,  338,  338,  338,  338, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319,   65,   65,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n       65,   65, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319\n\n    },\n\n    {\n       15, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320,   62, -320,  339,  339,\n      339,  339,  339,  339,  339,  339,  339,  339, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320,   65,   65,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n\n       65,   65, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320\n    },\n\n    {\n       15, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321,   62, -321,  340,  340,\n      340,  340,  340,  340,  340,  340,  340,  340, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321,   65,   65,\n\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n       65,   65, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321\n    },\n\n    {\n       15, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n\n     -322, -322, -322, -322, -322, -322,   62, -322,  341,  341,\n      341,  341,  341,  341,  341,  341,  341,  341, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322,   65,   65,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n       65,   65, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322\n    },\n\n    {\n       15, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323,   62, -323,  342,  342,\n      342,  342,  342,  342,  342,  342,  342,  342, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323,   65,   65,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n       65,   65, -323, -323, -323, -323, -323, -323, -323, -323,\n\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323\n    },\n\n    {\n       15, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324,   62, -324,  343,  343,\n      343,  343,  343,  343,  343,  343,  343,  343, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324,   65,   65,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n       65,   65, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324\n    },\n\n    {\n       15, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325,   62, -325,  344,  344,\n\n      344,  344,  344,  344,  344,  344,  344,  344, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325,   65,   65,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n       65,   65, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325\n    },\n\n    {\n       15, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326,  345, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n\n     -326, -326, -326, -326, -326, -326, -326, -326\n    },\n\n    {\n       15, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327,  346, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327\n    },\n\n    {\n       15, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328,   62, -328,  347,  348,\n      348,  348,  348,  348,  348,  348,  348,  348, -328, -328,\n\n     -328, -328, -328, -328, -328, -328, -328, -328,   65,   65,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n       65,   65, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328\n    },\n\n    {\n       15, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329,   62, -329,  349,  349,\n      349,  349,  349,  349,  349,  349,  349,  349, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329,   65,   65,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n       65,   65, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329\n\n    },\n\n    {\n       15, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330,   62, -330,  350,  350,\n      350,  350,  350,  350,  350,  350,  350,  350, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330,   65,   65,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n\n       65,   65, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330\n    },\n\n    {\n       15, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331,   62, -331,  351,  351,\n      351,  351,  351,  351,  351,  351,  351,  351, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331,   65,   65,\n\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n       65,   65, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331\n    },\n\n    {\n       15, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n\n     -332, -332, -332, -332, -332, -332,   62, -332,  352,  352,\n      352,  352,  352,  352,  352,  352,  352,  352, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332,   65,   65,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n       65,   65, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332\n    },\n\n    {\n       15, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333,   62, -333,  353,  353,\n      353,  353,  353,  353,  353,  353,  353,  353, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333,   65,   65,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n       65,   65, -333, -333, -333, -333, -333, -333, -333, -333,\n\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333\n    },\n\n    {\n       15, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334,   62, -334,  354,  354,\n      354,  354,  354,  354,  354,  354,  354,  354, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334,   65,   65,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n       65,   65, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334\n    },\n\n    {\n       15, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335,   62, -335,  355,  355,\n\n      355,  355,  355,  355,  355,  355,  355,  355, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335,   65,   65,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n       65,   65, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335\n    },\n\n    {\n       15, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336,   62, -336,  356,  356,\n      356,  356,  356,  356,  356,  356,  356,  356, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336,   65,   65,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n       65,   65, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n\n     -336, -336, -336, -336, -336, -336, -336, -336\n    },\n\n    {\n       15, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337,   62, -337,  357,  357,\n      357,  357,  357,  357,  357,  357,  357,  357, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337,   65,   65,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n       65,   65, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337\n    },\n\n    {\n       15, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338,   62, -338,  358,  358,\n      358,  358,  358,  358,  358,  358,  358,  358, -338, -338,\n\n     -338, -338, -338, -338, -338, -338, -338, -338,   65,   65,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n       65,   65, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338\n    },\n\n    {\n       15, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339,   62, -339,  359,  359,\n      359,  359,  359,  359,  359,  359,  359,  359, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339,   65,   65,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n       65,   65, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339\n\n    },\n\n    {\n       15, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340,   62, -340,  360,  360,\n      360,  360,  360,  360,  360,  360,  360,  360, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340,   65,   65,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n\n       65,   65, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340\n    },\n\n    {\n       15, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341,   62, -341,  361,  361,\n      361,  361,  361,  361,  361,  361,  361,  361, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341,   65,   65,\n\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n       65,   65, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341\n    },\n\n    {\n       15, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n\n     -342, -342, -342, -342, -342, -342,   62, -342,  362,  362,\n      362,  362,  362,  362,  362,  362,  362,  362, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342,   65,   65,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n       65,   65, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342\n    },\n\n    {\n       15, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343,   62, -343,  363,  363,\n      363,  363,  363,  363,  363,  363,  363,  363, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343,   65,   65,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n       65,   65, -343, -343, -343, -343, -343, -343, -343, -343,\n\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343\n    },\n\n    {\n       15, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344,   62, -344,  364,  364,\n      364,  364,  364,  364,  364,  364,  364,  364, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344,   65,   65,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n       65,   65, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344\n    },\n\n    {\n       15, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345,  365, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345\n    },\n\n    {\n       15, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346,  366, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n\n     -346, -346, -346, -346, -346, -346, -346, -346\n    },\n\n    {\n       15, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347,   62, -347,  367,  368,\n      368,  368,  368,  368,  368,  368,  368,  368, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347,   65,   65,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n       65,   65, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347\n    },\n\n    {\n       15, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348,   62, -348,  369,  369,\n      369,  369,  369,  369,  369,  369,  369,  369, -348, -348,\n\n     -348, -348, -348, -348, -348, -348, -348, -348,   65,   65,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n       65,   65, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348\n    },\n\n    {\n       15, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349,   62, -349,  370,  370,\n      370,  370,  370,  370,  370,  370,  370,  370, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349,   65,   65,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n       65,   65, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349\n\n    },\n\n    {\n       15, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350,   62, -350,  371,  371,\n      371,  371,  371,  371,  371,  371,  371,  371, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350,   65,   65,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n\n       65,   65, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350\n    },\n\n    {\n       15, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351,   62, -351,  372,  372,\n      372,  372,  372,  372,  372,  372,  372,  372, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351,   65,   65,\n\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n       65,   65, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351\n    },\n\n    {\n       15, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n\n     -352, -352, -352, -352, -352, -352,   62, -352,  373,  373,\n      373,  373,  373,  373,  373,  373,  373,  373, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352,   65,   65,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n       65,   65, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352\n    },\n\n    {\n       15, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353,   62, -353,  374,  374,\n      374,  374,  374,  374,  374,  374,  374,  374, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353,   65,   65,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n       65,   65, -353, -353, -353, -353, -353, -353, -353, -353,\n\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353\n    },\n\n    {\n       15, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354,   62, -354,  375,  375,\n      375,  375,  375,  375,  375,  375,  375,  375, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354,   65,   65,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n       65,   65, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354\n    },\n\n    {\n       15, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355,   62, -355,  376,  376,\n\n      376,  376,  376,  376,  376,  376,  376,  376, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355,   65,   65,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n       65,   65, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355\n    },\n\n    {\n       15, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356,   62, -356,  377,  377,\n      377,  377,  377,  377,  377,  377,  377,  377, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356,   65,   65,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n       65,   65, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n\n     -356, -356, -356, -356, -356, -356, -356, -356\n    },\n\n    {\n       15, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357,   62, -357,  378,  378,\n      378,  378,  378,  378,  378,  378,  378,  378, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357,   65,   65,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n       65,   65, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357\n    },\n\n    {\n       15, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358,   62, -358,  379,  379,\n      379,  379,  379,  379,  379,  379,  379,  379, -358, -358,\n\n     -358, -358, -358, -358, -358, -358, -358, -358,   65,   65,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n       65,   65, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358\n    },\n\n    {\n       15, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359,   62, -359,  380,  380,\n      380,  380,  380,  380,  380,  380,  380,  380, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359,   65,   65,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n       65,   65, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359\n\n    },\n\n    {\n       15, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360,   62, -360,  381,  381,\n      381,  381,  381,  381,  381,  381,  381,  381, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360,   65,   65,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n\n       65,   65, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360\n    },\n\n    {\n       15, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361,   62, -361,  382,  382,\n      382,  382,  382,  382,  382,  382,  382,  382, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361,   65,   65,\n\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n       65,   65, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361\n    },\n\n    {\n       15, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n\n     -362, -362, -362, -362, -362, -362,   62, -362,  383,  383,\n      383,  383,  383,  383,  383,  383,  383,  383, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362,   65,   65,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n       65,   65, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362\n    },\n\n    {\n       15, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363,   62, -363,  384,  384,\n      384,  384,  384,  384,  384,  384,  384,  384, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363,   65,   65,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n       65,   65, -363, -363, -363, -363, -363, -363, -363, -363,\n\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363\n    },\n\n    {\n       15, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364,   62, -364,  385,  385,\n      385,  385,  385,  385,  385,  385,  385,  385, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364,   65,   65,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n       65,   65, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364\n    },\n\n    {\n       15, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365,  386, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365\n    },\n\n    {\n       15, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366,  387, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n\n     -366, -366, -366, -366, -366, -366, -366, -366\n    },\n\n    {\n       15, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367,   62, -367,  388,  389,\n      389,  389,  389,  389,  389,  389,  389,  389, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367,   65,   65,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n       65,   65, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367\n    },\n\n    {\n       15, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368,   62, -368,  390,  390,\n      390,  390,  390,  390,  390,  390,  390,  390, -368, -368,\n\n     -368, -368, -368, -368, -368, -368, -368, -368,   65,   65,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n       65,   65, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368\n    },\n\n    {\n       15, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369,   62, -369,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369,   65,   65,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n       65,   65, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369\n\n    },\n\n    {\n       15, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370,   62, -370,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370,   65,   65,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n\n       65,   65, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370\n    },\n\n    {\n       15, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371,   62, -371,  393,  393,\n      393,  393,  393,  393,  393,  393,  393,  393, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371,   65,   65,\n\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n       65,   65, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371\n    },\n\n    {\n       15, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n\n     -372, -372, -372, -372, -372, -372,   62, -372,  394,  394,\n      394,  394,  394,  394,  394,  394,  394,  394, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372,   65,   65,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n       65,   65, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372\n    },\n\n    {\n       15, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373,   62, -373,  395,  395,\n      395,  395,  395,  395,  395,  395,  395,  395, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373,   65,   65,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n       65,   65, -373, -373, -373, -373, -373, -373, -373, -373,\n\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373\n    },\n\n    {\n       15, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374,   62, -374,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374,   65,   65,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n       65,   65, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374\n    },\n\n    {\n       15, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375,   62, -375,  397,  397,\n\n      397,  397,  397,  397,  397,  397,  397,  397, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375,   65,   65,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n       65,   65, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375\n    },\n\n    {\n       15, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376,   62, -376,  398,  398,\n      398,  398,  398,  398,  398,  398,  398,  398, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376,   65,   65,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n       65,   65, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n\n     -376, -376, -376, -376, -376, -376, -376, -376\n    },\n\n    {\n       15, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377,   62, -377,  399,  399,\n      399,  399,  399,  399,  399,  399,  399,  399, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377,   65,   65,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n       65,   65, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377\n    },\n\n    {\n       15, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378,   62, -378,  400,  400,\n      400,  400,  400,  400,  400,  400,  400,  400, -378, -378,\n\n     -378, -378, -378, -378, -378, -378, -378, -378,   65,   65,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n       65,   65, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378\n    },\n\n    {\n       15, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379,   62, -379,  401,  401,\n      401,  401,  401,  401,  401,  401,  401,  401, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379,   65,   65,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n       65,   65, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379\n\n    },\n\n    {\n       15, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380,   62, -380,  402,  402,\n      402,  402,  402,  402,  402,  402,  402,  402, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380,   65,   65,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n\n       65,   65, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380\n    },\n\n    {\n       15, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381,   62, -381,  403,  403,\n      403,  403,  403,  403,  403,  403,  403,  403, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381,   65,   65,\n\n     -381, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n       65,   65, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381\n    },\n\n    {\n       15, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n\n     -382, -382, -382, -382, -382, -382,   62, -382,  404,  404,\n      404,  404,  404,  404,  404,  404,  404,  404, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382,   65,   65,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n       65,   65, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382\n    },\n\n    {\n       15, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383,   62, -383,  405,  405,\n      405,  405,  405,  405,  405,  405,  405,  405, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383,   65,   65,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n       65,   65, -383, -383, -383, -383, -383, -383, -383, -383,\n\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383\n    },\n\n    {\n       15, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384,   62, -384,  406,  406,\n      406,  406,  406,  406,  406,  406,  406,  406, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384,   65,   65,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n       65,   65, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384\n    },\n\n    {\n       15, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385,   62, -385,  407,  407,\n\n      407,  407,  407,  407,  407,  407,  407,  407, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385,   65,   65,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n       65,   65, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385\n    },\n\n    {\n       15, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386,  408, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n\n     -386, -386, -386, -386, -386, -386, -386, -386\n    },\n\n    {\n       15, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387,  409, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387\n    },\n\n    {\n       15, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388,   62, -388,  410,  411,\n      411,  411,  411,  411,  411,  411,  411,  411, -388, -388,\n\n     -388, -388, -388, -388, -388, -388, -388, -388,   65,   65,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n       65,   65, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388\n    },\n\n    {\n       15, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389,   62, -389,  412,  412,\n      412,  412,  412,  412,  412,  412,  412,  412, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389,   65,   65,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n       65,   65, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389\n\n    },\n\n    {\n       15, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390,   62, -390,  413,  413,\n      413,  413,  413,  413,  413,  413,  413,  413, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390,   65,   65,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n\n       65,   65, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390\n    },\n\n    {\n       15, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391,   62, -391,  414,  414,\n      414,  414,  414,  414,  414,  414,  414,  414, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391,   65,   65,\n\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n       65,   65, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391\n    },\n\n    {\n       15, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n\n     -392, -392, -392, -392, -392, -392,   62, -392,  415,  415,\n      415,  415,  415,  415,  415,  415,  415,  415, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392,   65,   65,\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n       65,   65, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392\n    },\n\n    {\n       15, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393,   62, -393,  416,  416,\n      416,  416,  416,  416,  416,  416,  416,  416, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393,   65,   65,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n       65,   65, -393, -393, -393, -393, -393, -393, -393, -393,\n\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393\n    },\n\n    {\n       15, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394,   62, -394,  417,  417,\n      417,  417,  417,  417,  417,  417,  417,  417, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394,   65,   65,\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n       65,   65, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394\n    },\n\n    {\n       15, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395,   62, -395,  418,  418,\n\n      418,  418,  418,  418,  418,  418,  418,  418, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395,   65,   65,\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n       65,   65, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395\n    },\n\n    {\n       15, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n     -396, -396, -396, -396, -396, -396,   62, -396,  419,  419,\n      419,  419,  419,  419,  419,  419,  419,  419, -396, -396,\n     -396, -396, -396, -396, -396, -396, -396, -396,   65,   65,\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n       65,   65, -396, -396, -396, -396, -396, -396, -396, -396,\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n\n     -396, -396, -396, -396, -396, -396, -396, -396\n    },\n\n    {\n       15, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397,   62, -397,  420,  420,\n      420,  420,  420,  420,  420,  420,  420,  420, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397,   65,   65,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n       65,   65, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397\n    },\n\n    {\n       15, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398,   62, -398,  421,  421,\n      421,  421,  421,  421,  421,  421,  421,  421, -398, -398,\n\n     -398, -398, -398, -398, -398, -398, -398, -398,   65,   65,\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n       65,   65, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398\n    },\n\n    {\n       15, -399, -399, -399, -399, -399, -399, -399, -399, -399,\n     -399, -399, -399, -399, -399, -399, -399, -399, -399, -399,\n     -399, -399, -399, -399, -399, -399, -399, -399, -399, -399,\n\n     -399, -399, -399, -399, -399, -399, -399, -399, -399, -399,\n     -399, -399, -399, -399, -399, -399,   62, -399,  422,  422,\n      422,  422,  422,  422,  422,  422,  422,  422, -399, -399,\n     -399, -399, -399, -399, -399, -399, -399, -399,   65,   65,\n     -399, -399, -399, -399, -399, -399, -399, -399, -399, -399,\n     -399, -399, -399, -399, -399, -399, -399, -399, -399, -399,\n     -399, -399, -399, -399, -399, -399, -399, -399, -399, -399,\n       65,   65, -399, -399, -399, -399, -399, -399, -399, -399,\n     -399, -399, -399, -399, -399, -399, -399, -399, -399, -399,\n     -399, -399, -399, -399, -399, -399, -399, -399\n\n    },\n\n    {\n       15, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400,   62, -400,  423,  423,\n      423,  423,  423,  423,  423,  423,  423,  423, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400,   65,   65,\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n\n       65,   65, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400\n    },\n\n    {\n       15, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401,   62, -401,  424,  424,\n      424,  424,  424,  424,  424,  424,  424,  424, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401,   65,   65,\n\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n       65,   65, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401\n    },\n\n    {\n       15, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n\n     -402, -402, -402, -402, -402, -402,   62, -402,  425,  425,\n      425,  425,  425,  425,  425,  425,  425,  425, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402,   65,   65,\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n       65,   65, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402\n    },\n\n    {\n       15, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n     -403, -403, -403, -403, -403, -403,   62, -403,  426,  426,\n      426,  426,  426,  426,  426,  426,  426,  426, -403, -403,\n     -403, -403, -403, -403, -403, -403, -403, -403,   65,   65,\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n       65,   65, -403, -403, -403, -403, -403, -403, -403, -403,\n\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n     -403, -403, -403, -403, -403, -403, -403, -403\n    },\n\n    {\n       15, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404,   62, -404,  427,  427,\n      427,  427,  427,  427,  427,  427,  427,  427, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404,   65,   65,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n       65,   65, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404\n    },\n\n    {\n       15, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405,   62, -405,  428,  428,\n\n      428,  428,  428,  428,  428,  428,  428,  428, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405,   65,   65,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n       65,   65, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405\n    },\n\n    {\n       15, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406,   62, -406,  429,  429,\n      429,  429,  429,  429,  429,  429,  429,  429, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406,   65,   65,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n       65,   65, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n\n     -406, -406, -406, -406, -406, -406, -406, -406\n    },\n\n    {\n       15, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407,   62, -407,  430,  430,\n      430,  430,  430,  430,  430,  430,  430,  430, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407,   65,   65,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n       65,   65, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407\n    },\n\n    {\n       15, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408,  431, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408\n    },\n\n    {\n       15, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n\n     -409, -409,  432, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409\n\n    },\n\n    {\n       15, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410,   62, -410,  410,  411,\n      411,  411,  411,  411,  411,  411,  411,  411, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410,   65,   65,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n\n       65,   65, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410\n    },\n\n    {\n       15, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411,   62, -411,  412,  412,\n      412,  412,  412,  412,  412,  412,  412,  412, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411,   65,   65,\n\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n       65,   65, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411\n    },\n\n    {\n       15, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n\n     -412, -412, -412, -412, -412, -412,   62, -412,  413,  413,\n      413,  413,  413,  413,  413,  413,  413,  413, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412,   65,   65,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n       65,   65, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412\n    },\n\n    {\n       15, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413,   62, -413,  414,  414,\n      414,  414,  414,  414,  414,  414,  414,  414, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413,   65,   65,\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n       65,   65, -413, -413, -413, -413, -413, -413, -413, -413,\n\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413\n    },\n\n    {\n       15, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414,   62, -414,  415,  415,\n      415,  415,  415,  415,  415,  415,  415,  415, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414,   65,   65,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n       65,   65, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414\n    },\n\n    {\n       15, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415,   62, -415,  416,  416,\n\n      416,  416,  416,  416,  416,  416,  416,  416, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415,   65,   65,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n       65,   65, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415\n    },\n\n    {\n       15, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416,   62, -416,  417,  417,\n      417,  417,  417,  417,  417,  417,  417,  417, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416,   65,   65,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n       65,   65, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n\n     -416, -416, -416, -416, -416, -416, -416, -416\n    },\n\n    {\n       15, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417,   62, -417,  418,  418,\n      418,  418,  418,  418,  418,  418,  418,  418, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417,   65,   65,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n       65,   65, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417\n    },\n\n    {\n       15, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418,   62, -418,  419,  419,\n      419,  419,  419,  419,  419,  419,  419,  419, -418, -418,\n\n     -418, -418, -418, -418, -418, -418, -418, -418,   65,   65,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n       65,   65, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418\n    },\n\n    {\n       15, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419,   62, -419,  420,  420,\n      420,  420,  420,  420,  420,  420,  420,  420, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419,   65,   65,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n       65,   65, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419\n\n    },\n\n    {\n       15, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420,   62, -420,  421,  421,\n      421,  421,  421,  421,  421,  421,  421,  421, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420,   65,   65,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n\n       65,   65, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420\n    },\n\n    {\n       15, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421,   62, -421,  422,  422,\n      422,  422,  422,  422,  422,  422,  422,  422, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421,   65,   65,\n\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n       65,   65, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421\n    },\n\n    {\n       15, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n\n     -422, -422, -422, -422, -422, -422,   62, -422,  423,  423,\n      423,  423,  423,  423,  423,  423,  423,  423, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422,   65,   65,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n       65,   65, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422\n    },\n\n    {\n       15, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423,   62, -423,  424,  424,\n      424,  424,  424,  424,  424,  424,  424,  424, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423,   65,   65,\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n       65,   65, -423, -423, -423, -423, -423, -423, -423, -423,\n\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423\n    },\n\n    {\n       15, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424,   62, -424,  425,  425,\n      425,  425,  425,  425,  425,  425,  425,  425, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424,   65,   65,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n       65,   65, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424\n    },\n\n    {\n       15, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425,   62, -425,  426,  426,\n\n      426,  426,  426,  426,  426,  426,  426,  426, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425,   65,   65,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n       65,   65, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425\n    },\n\n    {\n       15, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426,   62, -426,  427,  427,\n      427,  427,  427,  427,  427,  427,  427,  427, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426,   65,   65,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n       65,   65, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n\n     -426, -426, -426, -426, -426, -426, -426, -426\n    },\n\n    {\n       15, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427,   62, -427,  428,  428,\n      428,  428,  428,  428,  428,  428,  428,  428, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427,   65,   65,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n       65,   65, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427\n    },\n\n    {\n       15, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428,   62, -428,  429,  429,\n      429,  429,  429,  429,  429,  429,  429,  429, -428, -428,\n\n     -428, -428, -428, -428, -428, -428, -428, -428,   65,   65,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n       65,   65, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428\n    },\n\n    {\n       15, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429,   62, -429,  430,  430,\n      430,  430,  430,  430,  430,  430,  430,  430, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429,   65,   65,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n       65,   65, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429\n\n    },\n\n    {\n       15, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430,   62, -430,  430,  430,\n      430,  430,  430,  430,  430,  430,  430,  430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430,   65,   65,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n\n       65,   65, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430\n    },\n\n    {\n       15, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431,  433, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431\n    },\n\n    {\n       15, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432,  434, -432, -432, -432, -432, -432, -432, -432,\n\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432\n    },\n\n    {\n       15, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433,  435, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433\n    },\n\n    {\n       15, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434,  436, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434\n    },\n\n    {\n       15, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435,  437, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435\n    },\n\n    {\n       15, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436,  438, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n\n     -436, -436, -436, -436, -436, -436, -436, -436\n    },\n\n    {\n       15, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437,  439, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437\n    },\n\n    {\n       15, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438,  440, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438\n    },\n\n    {\n       15, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n\n     -439, -439,  441, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439\n\n    },\n\n    {\n       15, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440,  442, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440\n    },\n\n    {\n       15, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441,  443, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441\n    },\n\n    {\n       15, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442,  444, -442, -442, -442, -442, -442, -442, -442,\n\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442\n    },\n\n    {\n       15, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443,  445, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443\n    },\n\n    {\n       15, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444,  446, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444\n    },\n\n    {\n       15, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445,  447, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445\n    },\n\n    {\n       15, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446,  448, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n\n     -446, -446, -446, -446, -446, -446, -446, -446\n    },\n\n    {\n       15, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447,  449, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447\n    },\n\n    {\n       15, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448,  450, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448\n    },\n\n    {\n       15, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n\n     -449, -449,  451, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449\n\n    },\n\n    {\n       15, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450,  452, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450\n    },\n\n    {\n       15, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451,  453, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451\n    },\n\n    {\n       15, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452,  454, -452, -452, -452, -452, -452, -452, -452,\n\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452\n    },\n\n    {\n       15, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453,  455, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453\n    },\n\n    {\n       15, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454,  456, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454\n    },\n\n    {\n       15, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455,  457, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455\n    },\n\n    {\n       15, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456,  458, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n\n     -456, -456, -456, -456, -456, -456, -456, -456\n    },\n\n    {\n       15, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457,  459, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457\n    },\n\n    {\n       15, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458,  460, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458\n    },\n\n    {\n       15, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n\n     -459, -459,  461, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459\n\n    },\n\n    {\n       15, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460,  462, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460\n    },\n\n    {\n       15, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461,  463, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461\n    },\n\n    {\n       15, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462,  464, -462, -462, -462, -462, -462, -462, -462,\n\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462\n    },\n\n    {\n       15, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463,  465, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463\n    },\n\n    {\n       15, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464,  466, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464\n    },\n\n    {\n       15, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465,  467, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465\n    },\n\n    {\n       15, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466,  468, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n\n     -466, -466, -466, -466, -466, -466, -466, -466\n    },\n\n    {\n       15, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467,  469, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467\n    },\n\n    {\n       15, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468,  470, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468\n    },\n\n    {\n       15, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n\n     -469, -469,  471, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469\n\n    },\n\n    {\n       15, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470,  472, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470\n    },\n\n    {\n       15, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471,  473, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471\n    },\n\n    {\n       15, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472,  474, -472, -472, -472, -472, -472, -472, -472,\n\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472\n    },\n\n    {\n       15, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473,  475, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473\n    },\n\n    {\n       15, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474,  476, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474\n    },\n\n    {\n       15, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475,  477, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475\n    },\n\n    {\n       15, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476,  478, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n\n     -476, -476, -476, -476, -476, -476, -476, -476\n    },\n\n    {\n       15, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477,  479, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477\n    },\n\n    {\n       15, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478,  480, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478\n    },\n\n    {\n       15, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n\n     -479, -479,  481, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479\n\n    },\n\n    {\n       15, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480,  482, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480\n    },\n\n    {\n       15, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481,  483, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481\n    },\n\n    {\n       15, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482,  484, -482, -482, -482, -482, -482, -482, -482,\n\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482\n    },\n\n    {\n       15, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483,  485, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483\n    },\n\n    {\n       15, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484,  486, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484\n    },\n\n    {\n       15, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485,  487, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485\n    },\n\n    {\n       15, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486,  488, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n\n     -486, -486, -486, -486, -486, -486, -486, -486\n    },\n\n    {\n       15, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487,  489, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487\n    },\n\n    {\n       15, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488,  490, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488\n    },\n\n    {\n       15, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n\n     -489, -489,  491, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489\n\n    },\n\n    {\n       15, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490,  492, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490\n    },\n\n    {\n       15, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491,  493, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491\n    },\n\n    {\n       15, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492,  494, -492, -492, -492, -492, -492, -492, -492,\n\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492\n    },\n\n    {\n       15, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493,  495, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493\n    },\n\n    {\n       15, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494,  496, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494\n    },\n\n    {\n       15, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495,  497, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495\n    },\n\n    {\n       15, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496,  498, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n     -496, -496, -496, -496, -496, -496, -496, -496, -496, -496,\n\n     -496, -496, -496, -496, -496, -496, -496, -496\n    },\n\n    {\n       15, -497, -497, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497, -497, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497, -497, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497,  499, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497, -497, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497, -497, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497, -497, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497, -497, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497, -497, -497, -497, -497, -497, -497, -497, -497,\n\n     -497, -497, -497, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497, -497, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497, -497, -497, -497, -497, -497, -497, -497, -497,\n     -497, -497, -497, -497, -497, -497, -497, -497\n    },\n\n    {\n       15, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498,  500, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498\n    },\n\n    {\n       15, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n\n     -499, -499,  501, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499, -499, -499,\n     -499, -499, -499, -499, -499, -499, -499, -499\n\n    },\n\n    {\n       15, -500, -500, -500, -500, -500, -500, -500, -500, -500,\n     -500, -500, -500, -500, -500, -500, -500, -500, -500, -500,\n     -500, -500, -500, -500, -500, -500, -500, -500, -500, -500,\n     -500, -500,  502, -500, -500, -500, -500, -500, -500, -500,\n     -500, -500, -500, -500, -500, -500, -500, -500, -500, -500,\n     -500, -500, -500, -500, -500, -500, -500, -500, -500, -500,\n     -500, -500, -500, -500, -500, -500, -500, -500, -500, -500,\n     -500, -500, -500, -500, -500, -500, -500, -500, -500, -500,\n     -500, -500, -500, -500, -500, -500, -500, -500, -500, -500,\n     -500, -500, -500, -500, -500, -500, -500, -500, -500, -500,\n\n     -500, -500, -500, -500, -500, -500, -500, -500, -500, -500,\n     -500, -500, -500, -500, -500, -500, -500, -500, -500, -500,\n     -500, -500, -500, -500, -500, -500, -500, -500\n    },\n\n    {\n       15, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501,  503, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n\n     -501, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501, -501, -501, -501, -501, -501, -501\n    },\n\n    {\n       15, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502,  504, -502, -502, -502, -502, -502, -502, -502,\n\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502\n    },\n\n    {\n       15, -503, -503, -503, -503, -503, -503, -503, -503, -503,\n\n     -503, -503, -503, -503, -503, -503, -503, -503, -503, -503,\n     -503, -503, -503, -503, -503, -503, -503, -503, -503, -503,\n     -503, -503,  505, -503, -503, -503, -503, -503, -503, -503,\n     -503, -503, -503, -503, -503, -503, -503, -503, -503, -503,\n     -503, -503, -503, -503, -503, -503, -503, -503, -503, -503,\n     -503, -503, -503, -503, -503, -503, -503, -503, -503, -503,\n     -503, -503, -503, -503, -503, -503, -503, -503, -503, -503,\n     -503, -503, -503, -503, -503, -503, -503, -503, -503, -503,\n     -503, -503, -503, -503, -503, -503, -503, -503, -503, -503,\n     -503, -503, -503, -503, -503, -503, -503, -503, -503, -503,\n\n     -503, -503, -503, -503, -503, -503, -503, -503, -503, -503,\n     -503, -503, -503, -503, -503, -503, -503, -503\n    },\n\n    {\n       15, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504,  506, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n\n     -504, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504\n    },\n\n    {\n       15, -505, -505, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505, -505, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505, -505, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505,  507, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505, -505, -505, -505, -505, -505, -505, -505, -505,\n\n     -505, -505, -505, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505, -505, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505, -505, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505, -505, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505, -505, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505, -505, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505, -505, -505, -505, -505, -505, -505, -505, -505,\n     -505, -505, -505, -505, -505, -505, -505, -505\n    },\n\n    {\n       15, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506,  508, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n\n     -506, -506, -506, -506, -506, -506, -506, -506\n    },\n\n    {\n       15, -507, -507, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507, -507, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507, -507, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507,  509, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507, -507, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507, -507, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507, -507, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507, -507, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507, -507, -507, -507, -507, -507, -507, -507, -507,\n\n     -507, -507, -507, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507, -507, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507, -507, -507, -507, -507, -507, -507, -507, -507,\n     -507, -507, -507, -507, -507, -507, -507, -507\n    },\n\n    {\n       15, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508,  510, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508, -508, -508\n    },\n\n    {\n       15, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n\n     -509, -509,  511, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509\n\n    },\n\n    {\n       15, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510,  512, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510\n    },\n\n    {\n       15, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511,  513, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511\n    },\n\n    {\n       15, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512,  514, -512, -512, -512, -512, -512, -512, -512,\n\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512\n    },\n\n    {\n       15, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513,  515, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513\n    },\n\n    {\n       15, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514,  516, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514\n    },\n\n    {\n       15, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515,  517, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515\n    },\n\n    {\n       15, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516,  518, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n\n     -516, -516, -516, -516, -516, -516, -516, -516\n    },\n\n    {\n       15, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517,  519, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517\n    },\n\n    {\n       15, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518,  520, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518\n    },\n\n    {\n       15, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n\n     -519, -519,  521, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519\n\n    },\n\n    {\n       15, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520,  522, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520\n    },\n\n    {\n       15, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521,  523, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521\n    },\n\n    {\n       15, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522,  524, -522, -522, -522, -522, -522, -522, -522,\n\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522\n    },\n\n    {\n       15, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523,  525, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523\n    },\n\n    {\n       15, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524,  526, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524\n    },\n\n    {\n       15, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525,  527, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525\n    },\n\n    {\n       15, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526,  528, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n\n     -526, -526, -526, -526, -526, -526, -526, -526\n    },\n\n    {\n       15, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527,  529, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527\n    },\n\n    {\n       15, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528,  530, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528\n    },\n\n    {\n       15, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n\n     -529, -529,  531, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529\n\n    },\n\n    {\n       15, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530,  532, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530\n    },\n\n    {\n       15, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531,  533, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531\n    },\n\n    {\n       15, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532,  534, -532, -532, -532, -532, -532, -532, -532,\n\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532\n    },\n\n    {\n       15, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533,  535, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533\n    },\n\n    {\n       15, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534,  536, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534\n    },\n\n    {\n       15, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535,  537, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535\n    },\n\n    {\n       15, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536,  538, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n\n     -536, -536, -536, -536, -536, -536, -536, -536\n    },\n\n    {\n       15, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537,  539, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537\n    },\n\n    {\n       15, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538,  540, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538\n    },\n\n    {\n       15, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n\n     -539, -539,  541, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539\n\n    },\n\n    {\n       15, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540,  542, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540\n    },\n\n    {\n       15, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541,  543, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541\n    },\n\n    {\n       15, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542,  544, -542, -542, -542, -542, -542, -542, -542,\n\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542\n    },\n\n    {\n       15, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543,  545, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543\n    },\n\n    {\n       15, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544,  546, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544\n    },\n\n    {\n       15, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545,  547, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545\n    },\n\n    {\n       15, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546,  548, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n\n     -546, -546, -546, -546, -546, -546, -546, -546\n    },\n\n    {\n       15, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547,  549, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547\n    },\n\n    {\n       15, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548,  550, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548\n    },\n\n    {\n       15, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549\n\n    },\n\n    {\n       15, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550\n    },\n\n    } ;\n\nstatic yy_state_type yy_get_previous_state ( yyscan_t yyscanner );\nstatic yy_state_type yy_try_NUL_trans ( yy_state_type current_state  , yyscan_t yyscanner);\nstatic int yy_get_next_buffer ( yyscan_t yyscanner );\nstatic void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );\n\n/* Done after the current pattern has been matched and before the\n * corresponding action - sets up yytext.\n */\n#define YY_DO_BEFORE_ACTION \\\n\tyyg->yytext_ptr = yy_bp; \\\n\tyyg->yytext_ptr -= yyg->yy_more_len; \\\n\tyyleng = (int) (yy_cp - yyg->yytext_ptr); \\\n\tyyg->yy_hold_char = *yy_cp; \\\n\t*yy_cp = '\\0'; \\\n\tyyg->yy_c_buf_p = yy_cp;\n#define YY_NUM_RULES 31\n#define YY_END_OF_BUFFER 32\n/* This struct is not used in this scanner,\n   but its presence is necessary. */\nstruct yy_trans_info\n\t{\n\tflex_int32_t yy_verify;\n\tflex_int32_t yy_nxt;\n\t};\nstatic const flex_int16_t yy_accept[551] =\n    {   0,\n        0,    0,    0,    0,    0,    0,    0,    0,   28,   28,\n       29,   29,    0,    0,   32,   31,   31,   31,   31,   31,\n       31,   31,   20,   20,   20,   20,   20,   20,   11,   13,\n       13,   12,   25,   21,   24,   23,   27,   27,   28,   29,\n       31,   30,    0,    0,    0,    0,    0,    0,    0,    0,\n       11,    0,   19,    0,    0,    0,    0,    0,   13,   13,\n       16,   16,   13,   13,    0,   13,   21,    0,   23,   22,\n       23,    0,   28,   29,    0,   30,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,   16,   13,   13,   13,    0,   16,   13,   26,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,   13,   13,\n       13,   13,   13,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,   17,\n        0,    0,    0,   13,   13,   13,   13,   13,   13,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,   18,    0,    0,    0,    0,   13,   13,   13,\n       13,   13,   13,   13,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    2,    0,    0,   13,   13,   13,   13,\n       13,   13,   13,   13,   10,    2,    8,    8,    8,    5,\n\n       13,   13,   13,   13,   13,   13,   13,   13,   13,    0,\n        0,    0,    0,    0,    0,   13,   13,   13,   13,   13,\n       13,   13,   13,   13,   13,    9,    0,    6,    0,    0,\n        4,   13,   13,   13,   13,   13,   13,   13,   13,   13,\n       13,   14,    0,    0,    0,   13,   13,   13,   13,   13,\n       13,   13,   13,   13,   13,   14,   14,    0,    0,    7,\n        0,   13,   13,   13,   13,   13,   13,   13,   13,   13,\n       13,   14,   14,   14,    0,    0,   13,   13,   13,   13,\n       13,   13,   13,   13,   13,   13,   14,   14,   14,   14,\n        0,    0,   13,   13,   13,   13,   13,   13,   13,   13,\n\n       13,   13,   14,   14,   14,   14,   14,    0,    0,   13,\n       13,   13,   13,   13,   13,   13,   13,   13,   13,   14,\n       14,   14,   14,   14,   14,    0,    0,   13,   13,   13,\n       13,   13,   13,   13,   13,   13,   13,   14,   14,   14,\n       14,   14,   14,   14,    0,    0,   13,   13,   13,   13,\n       13,   13,   13,   13,   13,   13,   14,   14,   14,   14,\n       14,   14,   14,   14,    0,    0,   13,   13,   13,   13,\n       13,   13,   13,   13,   13,   13,   14,   14,   14,   14,\n       14,   14,   14,   14,   14,    0,    0,   13,   13,   13,\n       13,   13,   13,   13,   13,   13,   13,   14,   14,   14,\n\n       14,   14,   14,   14,   14,   14,   15,    0,    0,   13,\n       13,   13,   13,   13,   13,   13,   13,   13,   13,   14,\n       14,   14,   14,   14,   14,   14,   14,   14,   15,   15,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    1,    3\n    } ;\n\nstatic const yy_state_type yy_NUL_trans[551] =\n    {   0,\n       16,   17,   23,   23,   33,   33,   37,   37,   39,   39,\n       40,   40,   41,   41,    0,    0,   43,   43,   43,   43,\n       43,   43,    0,    0,   52,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,   73,   74,\n       75,    0,   77,   77,   77,   77,   77,   77,   77,    0,\n        0,   52,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,   73,   74,   75,    0,  100,  100,  100,  100,\n      100,  100,  100,  100,  100,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,  124,\n\n      124,  124,  124,  124,  124,  124,  124,  124,  124,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,  150,  150,  150,  150,  150,  150,  150,\n      150,  150,  150,  150,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,  175,\n      175,  175,  175,  175,  175,  175,  175,  175,  175,  175,\n      175,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,  195,  195,  195,  195,  195,  195,\n      195,  195,  195,  195,  195,  195,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,  259,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,  259,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0\n    } ;\n\n/* The intent behind this definition is that it'll catch\n * any uses of REJECT which flex missed.\n */\n#define REJECT reject_used_but_not_detected\n#define yymore() (yyg->yy_more_flag = 1)\n#define YY_MORE_ADJ yyg->yy_more_len\n#define YY_RESTORE_YY_MORE_OFFSET\n#line 1 \"fitshdr.l\"\n/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: fitshdr.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* fitshdr.l is a Flex description file containing a lexical scanner\n* definition for extracting keywords and keyvalues from a FITS header.\n*\n* It requires Flex v2.5.4 or later.\n*\n* Refer to fitshdr.h for a description of the user interface and operating\n* notes.\n*\n*===========================================================================*/\n/* Options. */\n#define YY_NO_INPUT 1\n/* Keywords. */\n/* Keyvalue data types. */\n/* Characters forming standard unit strings (jwBIQX are not used). */\n/* Exclusive start states. */\n\n#line 76 \"fitshdr.l\"\n#include <math.h>\n#include <limits.h>\n#include <setjmp.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"fitshdr.h\"\n#include \"wcsutil.h\"\n\n// User data associated with yyscanner.\nstruct fitshdr_extra {\n  // Values passed to YY_INPUT.\n  const char *hdr;\n  int  nkeyrec;\n\n  // Used in preempting the call to exit() by yy_fatal_error().\n  jmp_buf abort_jmp_env;\n};\n\n#define YY_DECL int fitshdr_scanner(const char header[], int nkeyrec, \\\n  int nkeyids, struct fitskeyid keyids[], int *nreject, \\\n  struct fitskey **keys, yyscan_t yyscanner)\n\n#define YY_INPUT(inbuff, count, bufsize) \\\n\t{ \\\n\t  if (yyextra->nkeyrec) { \\\n\t    strncpy(inbuff, yyextra->hdr, 80); \\\n\t    inbuff[80] = '\\n'; \\\n\t    yyextra->hdr += 80; \\\n\t    yyextra->nkeyrec--; \\\n\t    count = 81; \\\n\t  } else { \\\n\t    count = YY_NULL; \\\n\t  } \\\n\t}\n\n// Preempt the call to exit() by yy_fatal_error().\n#define exit(status) longjmp(yyextra->abort_jmp_env, status);\n\n// Internal helper functions.\nstatic YY_DECL;\nstatic void nullfill(char cptr[], int len);\n\n// Map status return value to message.\nconst char *fitshdr_errmsg[] = {\n   \"Success\",\n   \"Null fitskey pointer-pointer passed\",\n   \"Memory allocation failed\",\n   \"Fatal error returned by Flex parser\"};\n\n#line 10327 \"fitshdr.c\"\n#line 10328 \"fitshdr.c\"\n\n#define INITIAL 0\n#define VALUE 1\n#define INLINE 2\n#define UNITS 3\n#define COMMENT 4\n#define ERROR 5\n#define FLUSH 6\n\n#ifndef YY_NO_UNISTD_H\n/* Special case for \"unistd.h\", since it is non-ANSI. We include it way\n * down here because we want the user's section 1 to have been scanned first.\n * The user has a chance to override it with an option.\n */\n#include <unistd.h>\n#endif\n\n#define YY_EXTRA_TYPE struct fitshdr_extra *\n\n/* Holds the entire state of the reentrant scanner. */\nstruct yyguts_t\n    {\n\n    /* User-defined. Not touched by flex. */\n    YY_EXTRA_TYPE yyextra_r;\n\n    /* The rest are the same as the globals declared in the non-reentrant scanner. */\n    FILE *yyin_r, *yyout_r;\n    size_t yy_buffer_stack_top; /**< index of top of stack. */\n    size_t yy_buffer_stack_max; /**< capacity of stack. */\n    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */\n    char yy_hold_char;\n    int yy_n_chars;\n    int yyleng_r;\n    char *yy_c_buf_p;\n    int yy_init;\n    int yy_start;\n    int yy_did_buffer_switch_on_eof;\n    int yy_start_stack_ptr;\n    int yy_start_stack_depth;\n    int *yy_start_stack;\n    yy_state_type yy_last_accepting_state;\n    char* yy_last_accepting_cpos;\n\n    int yylineno_r;\n    int yy_flex_debug_r;\n\n    char *yytext_r;\n    int yy_more_flag;\n    int yy_more_len;\n\n    }; /* end struct yyguts_t */\n\nstatic int yy_init_globals ( yyscan_t yyscanner );\n\nint yylex_init (yyscan_t* scanner);\n\nint yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);\n\n/* Accessor methods to globals.\n   These are made visible to non-reentrant scanners for convenience. */\n\nint yylex_destroy ( yyscan_t yyscanner );\n\nint yyget_debug ( yyscan_t yyscanner );\n\nvoid yyset_debug ( int debug_flag , yyscan_t yyscanner );\n\nYY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );\n\nvoid yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );\n\nFILE *yyget_in ( yyscan_t yyscanner );\n\nvoid yyset_in  ( FILE * _in_str , yyscan_t yyscanner );\n\nFILE *yyget_out ( yyscan_t yyscanner );\n\nvoid yyset_out  ( FILE * _out_str , yyscan_t yyscanner );\n\n\t\t\tint yyget_leng ( yyscan_t yyscanner );\n\nchar *yyget_text ( yyscan_t yyscanner );\n\nint yyget_lineno ( yyscan_t yyscanner );\n\nvoid yyset_lineno ( int _line_number , yyscan_t yyscanner );\n\nint yyget_column  ( yyscan_t yyscanner );\n\nvoid yyset_column ( int _column_no , yyscan_t yyscanner );\n\n/* Macros after this point can all be overridden by user definitions in\n * section 1.\n */\n\n#ifndef YY_SKIP_YYWRAP\n#ifdef __cplusplus\nextern \"C\" int yywrap ( yyscan_t yyscanner );\n#else\nextern int yywrap ( yyscan_t yyscanner );\n#endif\n#endif\n\n#ifndef YY_NO_UNPUT\n    \n#endif\n\n#ifndef yytext_ptr\nstatic void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);\n#endif\n\n#ifdef YY_NEED_STRLEN\nstatic int yy_flex_strlen ( const char * , yyscan_t yyscanner);\n#endif\n\n#ifndef YY_NO_INPUT\n#ifdef __cplusplus\nstatic int yyinput ( yyscan_t yyscanner );\n#else\nstatic int input ( yyscan_t yyscanner );\n#endif\n\n#endif\n\n/* Amount of stuff to slurp up with each read. */\n#ifndef YY_READ_BUF_SIZE\n#ifdef __ia64__\n/* On IA-64, the buffer size is 16k, not 8k */\n#define YY_READ_BUF_SIZE 16384\n#else\n#define YY_READ_BUF_SIZE 8192\n#endif /* __ia64__ */\n#endif\n\n/* Copy whatever the last rule matched to the standard output. */\n#ifndef ECHO\n/* This used to be an fputs(), but since the string might contain NUL's,\n * we now use fwrite().\n */\n#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)\n#endif\n\n/* Gets input and stuffs it into \"buf\".  number of characters read, or YY_NULL,\n * is returned in \"result\".\n */\n#ifndef YY_INPUT\n#define YY_INPUT(buf,result,max_size) \\\n\terrno=0; \\\n\twhile ( (result = (int) read( fileno(yyin), buf, (yy_size_t) max_size )) < 0 ) \\\n\t{ \\\n\t\tif( errno != EINTR) \\\n\t\t{ \\\n\t\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" ); \\\n\t\t\tbreak; \\\n\t\t} \\\n\t\terrno=0; \\\n\t\tclearerr(yyin); \\\n\t}\\\n\\\n\n#endif\n\n/* No semi-colon after return; correct usage is to write \"yyterminate();\" -\n * we don't want an extra ';' after the \"return\" because that will cause\n * some compilers to complain about unreachable statements.\n */\n#ifndef yyterminate\n#define yyterminate() return YY_NULL\n#endif\n\n/* Number of entries by which start-condition stack grows. */\n#ifndef YY_START_STACK_INCR\n#define YY_START_STACK_INCR 25\n#endif\n\n/* Report a fatal error. */\n#ifndef YY_FATAL_ERROR\n#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)\n#endif\n\n/* end tables serialization structures and prototypes */\n\n/* Default declaration of generated scanner - a define so the user can\n * easily add parameters.\n */\n#ifndef YY_DECL\n#define YY_DECL_IS_OURS 1\n\nextern int yylex (yyscan_t yyscanner);\n\n#define YY_DECL int yylex (yyscan_t yyscanner)\n#endif /* !YY_DECL */\n\n/* Code executed at the beginning of each rule, after yytext and yyleng\n * have been set up.\n */\n#ifndef YY_USER_ACTION\n#define YY_USER_ACTION\n#endif\n\n/* Code executed at the end of each rule. */\n#ifndef YY_BREAK\n#define YY_BREAK /*LINTED*/break;\n#endif\n\n#define YY_RULE_SETUP \\\n\tif ( yyleng > 0 ) \\\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = \\\n\t\t\t\t(yytext[yyleng - 1] == '\\n'); \\\n\tYY_USER_ACTION\n\n/** The main scanner function which does all the work.\n */\nYY_DECL\n{\n\tyy_state_type yy_current_state;\n\tchar *yy_cp, *yy_bp;\n\tint yy_act;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif ( !yyg->yy_init )\n\t\t{\n\t\tyyg->yy_init = 1;\n\n#ifdef YY_USER_INIT\n\t\tYY_USER_INIT;\n#endif\n\n\t\tif ( ! yyg->yy_start )\n\t\t\tyyg->yy_start = 1;\t/* first start state */\n\n\t\tif ( ! yyin )\n\t\t\tyyin = stdin;\n\n\t\tif ( ! yyout )\n\t\t\tyyout = stdout;\n\n\t\tif ( ! YY_CURRENT_BUFFER ) {\n\t\t\tyyensure_buffer_stack (yyscanner);\n\t\t\tYY_CURRENT_BUFFER_LVALUE =\n\t\t\t\tyy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);\n\t\t}\n\n\t\tyy_load_buffer_state( yyscanner );\n\t\t}\n\n\t{\n#line 128 \"fitshdr.l\"\n\n#line 130 \"fitshdr.l\"\n\tchar ctmp[72];\n\t\n\tif (keys == 0x0) {\n\t  return FITSHDRERR_NULL_POINTER;\n\t}\n\t\n\t// Allocate memory for the required number of fitskey structs.\n\t// Recall that calloc() initializes allocated memory to zero.\n\tstruct fitskey *kptr;\n\tif (!(kptr = *keys = calloc(nkeyrec, sizeof(struct fitskey)))) {\n\t  return FITSHDRERR_MEMORY;\n\t}\n\t\n\t// Initialize returned values.\n\t*nreject = 0;\n\t\n\t// Initialize keyids[].\n\tstruct fitskeyid *iptr = keyids;\n\tfor (int j = 0; j < nkeyids; j++, iptr++) {\n\t  iptr->count  = 0;\n\t  iptr->idx[0] = -1;\n\t  iptr->idx[1] = -1;\n\t}\n\n\tint keyno = 0;\n\t\n\tint blank = 0;\n\tint continuation = 0;\n\tint end = 0;\n\t\n#ifdef WCSLIB_INT64\n#define asString(S) stringize(S)\n#define stringize(S) #S\n\t\n\t  const char *int64fmt;\n\t  if (strcmp(asString(WCSLIB_INT64), \"long long int\") == 0) {\n\t    int64fmt = \"%lld\";\n\t  } else if (strcmp(asString(WCSLIB_INT64), \"long int\") == 0) {\n\t    int64fmt = \"%ld\";\n\t  } else if (strcmp(asString(WCSLIB_INT64), \"int\") == 0) {\n\t    int64fmt = \"%d\";\n\t  } else {\n\t    return FITSHDRERR_DATA_TYPE;\n\t  }\n#endif\n\t\n\t// User data associated with yyscanner.\n\tyyextra->hdr = header;\n\tyyextra->nkeyrec = nkeyrec;\n\t\n\t// Return here via longjmp() invoked by yy_fatal_error().\n\tif (setjmp(yyextra->abort_jmp_env)) {\n\t  return FITSHDRERR_FLEX_PARSER;\n\t}\n\t\n\tBEGIN(INITIAL);\n\n#line 10637 \"fitshdr.c\"\n\n\twhile ( /*CONSTCOND*/1 )\t\t/* loops until end-of-file is reached */\n\t\t{\n\t\tyyg->yy_more_len = 0;\n\t\tif ( yyg->yy_more_flag )\n\t\t\t{\n\t\t\tyyg->yy_more_len = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);\n\t\t\tyyg->yy_more_flag = 0;\n\t\t\t}\n\t\tyy_cp = yyg->yy_c_buf_p;\n\n\t\t/* Support of yytext. */\n\t\t*yy_cp = yyg->yy_hold_char;\n\n\t\t/* yy_bp points to the position in yy_ch_buf of the start of\n\t\t * the current run.\n\t\t */\n\t\tyy_bp = yy_cp;\n\n\t\tyy_current_state = yyg->yy_start;\n\t\tyy_current_state += YY_AT_BOL();\nyy_match:\n\t\twhile ( (yy_current_state = yy_nxt[yy_current_state][ YY_SC_TO_UI(*yy_cp) ]) > 0 )\n\t\t\t{\n\t\t\tif ( yy_accept[yy_current_state] )\n\t\t\t\t{\n\t\t\t\tyyg->yy_last_accepting_state = yy_current_state;\n\t\t\t\tyyg->yy_last_accepting_cpos = yy_cp;\n\t\t\t\t}\n\n\t\t\t++yy_cp;\n\t\t\t}\n\n\t\tyy_current_state = -yy_current_state;\n\nyy_find_action:\n\t\tyy_act = yy_accept[yy_current_state];\n\n\t\tYY_DO_BEFORE_ACTION;\n\ndo_action:\t/* This label is used only to access EOF actions. */\n\n\t\tswitch ( yy_act )\n\t{ /* beginning of action switch */\n\t\t\tcase 0: /* must back up */\n\t\t\t/* undo the effects of YY_DO_BEFORE_ACTION */\n\t\t\t*yy_cp = yyg->yy_hold_char;\n\t\t\tyy_cp = yyg->yy_last_accepting_cpos + 1;\n\t\t\tyy_current_state = yyg->yy_last_accepting_state;\n\t\t\tgoto yy_find_action;\n\ncase 1:\nYY_RULE_SETUP\n#line 187 \"fitshdr.l\"\n{\n\t  // A completely blank keyrecord.\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  yyless(0);\n\t  blank = 1;\n\t  BEGIN(COMMENT);\n\t}\n\tYY_BREAK\ncase 2:\nYY_RULE_SETUP\n#line 195 \"fitshdr.l\"\n{\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  BEGIN(COMMENT);\n\t}\n\tYY_BREAK\ncase 3:\nYY_RULE_SETUP\n#line 200 \"fitshdr.l\"\n{\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  end = 1;\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 4:\nYY_RULE_SETUP\n#line 206 \"fitshdr.l\"\n{\n\t  // Illegal END keyrecord.\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  kptr->status |= FITSHDR_KEYREC;\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 5:\nYY_RULE_SETUP\n#line 213 \"fitshdr.l\"\n{\n\t  // Illegal END keyrecord.\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  kptr->status |= FITSHDR_KEYREC;\n\t  BEGIN(COMMENT);\n\t}\n\tYY_BREAK\ncase 6:\nYY_RULE_SETUP\n#line 220 \"fitshdr.l\"\n{\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 7:\n/* rule 7 can match eol */\nYY_RULE_SETUP\n#line 225 \"fitshdr.l\"\n{\n\t  // Continued string keyvalue.\n\t  strncpy(kptr->keyword, yytext, 8);\n\t\n\t  if (keyno > 0 && (kptr-1)->type%10 == 8) {\n\t    // Put back the string keyvalue.\n\t    int k;\n\t    for (k = 10; yytext[k] != '\\''; k++);\n\t    yyless(k);\n\t    continuation = 1;\n\t    BEGIN(VALUE);\n\t\n\t  } else {\n\t    // Not a valid continuation.\n\t    yyless(8);\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\tYY_BREAK\ncase 8:\nYY_RULE_SETUP\n#line 244 \"fitshdr.l\"\n{\n\t  // Keyword without value.\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  BEGIN(COMMENT);\n\t}\n\tYY_BREAK\ncase 9:\nYY_RULE_SETUP\n#line 250 \"fitshdr.l\"\n{\n\t  // Illegal keyword, carry on regardless.\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  kptr->status |= FITSHDR_KEYWORD;\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 10:\nYY_RULE_SETUP\n#line 257 \"fitshdr.l\"\n{\n\t  // Illegal keyword, carry on regardless.\n\t  strncpy(kptr->keyword, yytext, 8);\n\t  kptr->status |= FITSHDR_KEYWORD;\n\t  BEGIN(COMMENT);\n\t}\n\tYY_BREAK\ncase 11:\n*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */\nyyg->yy_c_buf_p = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up yytext again */\nYY_RULE_SETUP\n#line 264 \"fitshdr.l\"\n{\n\t  // Null keyvalue.\n\t  BEGIN(INLINE);\n\t}\n\tYY_BREAK\ncase 12:\nYY_RULE_SETUP\n#line 269 \"fitshdr.l\"\n{\n\t  // Logical keyvalue.\n\t  kptr->type = 1;\n\t  kptr->keyvalue.i = (*yytext == 'T');\n\t  BEGIN(INLINE);\n\t}\n\tYY_BREAK\ncase 13:\nYY_RULE_SETUP\n#line 276 \"fitshdr.l\"\n{\n\t  // 32-bit signed integer keyvalue.\n\t  kptr->type = 2;\n\t  if (sscanf(yytext, \"%d\", &(kptr->keyvalue.i)) < 1) {\n\t    kptr->status |= FITSHDR_KEYVALUE;\n\t    BEGIN(ERROR);\n\t  }\n\t\n\t  BEGIN(INLINE);\n\t}\n\tYY_BREAK\ncase 14:\nYY_RULE_SETUP\n#line 287 \"fitshdr.l\"\n{\n\t  // 64-bit signed integer keyvalue (up to 18 digits).\n\t  double dtmp;\n\t  if (wcsutil_str2double(yytext, &dtmp)) {\n\t    kptr->status |= FITSHDR_KEYVALUE;\n\t    BEGIN(ERROR);\n\t\n\t  } else if (INT_MIN <= dtmp && dtmp <= INT_MAX) {\n\t    // Can be accomodated as a 32-bit signed integer.\n\t    kptr->type = 2;\n\t    if (sscanf(yytext, \"%d\", &(kptr->keyvalue.i)) < 1) {\n\t      kptr->status |= FITSHDR_KEYVALUE;\n\t      BEGIN(ERROR);\n\t    }\n\t\n\t  } else {\n\t    // 64-bit signed integer.\n\t    kptr->type = 3;\n#ifdef WCSLIB_INT64\n\t      // Native 64-bit integer is available.\n\t      if (sscanf(yytext, int64fmt, &(kptr->keyvalue.k)) < 1) {\n\t        kptr->status |= FITSHDR_KEYVALUE;\n\t        BEGIN(ERROR);\n\t      }\n#else\n\t      // 64-bit integer (up to 18 digits) implemented as int[3].\n\t      kptr->keyvalue.k[2] = 0;\n\t\n\t      sprintf(ctmp, \"%%%dd%%9d\", yyleng-9);\n\t      if (sscanf(yytext, ctmp, kptr->keyvalue.k+1,\n\t                 kptr->keyvalue.k) < 1) {\n\t        kptr->status |= FITSHDR_KEYVALUE;\n\t        BEGIN(ERROR);\n\t      } else if (*yytext == '-') {\n\t        kptr->keyvalue.k[0] *= -1;\n\t      }\n#endif\n\t  }\n\t\n\t  BEGIN(INLINE);\n\t}\n\tYY_BREAK\ncase 15:\nYY_RULE_SETUP\n#line 329 \"fitshdr.l\"\n{\n\t  // Very long integer keyvalue (and 19-digit int64).\n\t  kptr->type = 4;\n\t  strcpy(ctmp, yytext);\n\t  int j, k = yyleng;\n\t  for (j = 0; j < 8; j++) {\n\t    // Read it backwards.\n\t    k -= 9;\n\t    if (k < 0) k = 0;\n\t    if (sscanf(ctmp+k, \"%d\", kptr->keyvalue.l+j) < 1) {\n\t      kptr->status |= FITSHDR_KEYVALUE;\n\t      BEGIN(ERROR);\n\t    }\n\t    if (*yytext == '-') {\n\t      kptr->keyvalue.l[j] = -abs(kptr->keyvalue.l[j]);\n\t    }\n\t\n\t    if (k == 0) break;\n\t    ctmp[k] = '\\0';\n\t  }\n\t\n\t  // Can it be accomodated as a 64-bit signed integer?\n\t  if (j == 2 && abs(kptr->keyvalue.l[2]) <=  9 &&\n\t                abs(kptr->keyvalue.l[1]) <=  223372036 &&\n\t                    kptr->keyvalue.l[0]  <=  854775807 &&\n\t                    kptr->keyvalue.l[0]  >= -854775808) {\n\t    kptr->type = 3;\n\t\n#ifdef WCSLIB_INT64\n\t      // Native 64-bit integer is available.\n\t      kptr->keyvalue.l[2] = 0;\n\t      if (sscanf(yytext, int64fmt, &(kptr->keyvalue.k)) < 1) {\n\t        kptr->status |= FITSHDR_KEYVALUE;\n\t        BEGIN(ERROR);\n\t      }\n#endif\n\t  }\n\t\n\t  BEGIN(INLINE);\n\t}\n\tYY_BREAK\ncase 16:\nYY_RULE_SETUP\n#line 370 \"fitshdr.l\"\n{\n\t  // Float keyvalue.\n\t  kptr->type = 5;\n\t  if (wcsutil_str2double(yytext, &(kptr->keyvalue.f))) {\n\t    kptr->status |= FITSHDR_KEYVALUE;\n\t    BEGIN(ERROR);\n\t  }\n\t\n\t  BEGIN(INLINE);\n\t}\n\tYY_BREAK\ncase 17:\nYY_RULE_SETUP\n#line 381 \"fitshdr.l\"\n{\n\t  // Integer complex keyvalue.\n\t  kptr->type = 6;\n\t  if (sscanf(yytext, \"(%lf,%lf)\", kptr->keyvalue.c,\n\t      kptr->keyvalue.c+1) < 2) {\n\t    kptr->status |= FITSHDR_KEYVALUE;\n\t    BEGIN(ERROR);\n\t  }\n\t\n\t  BEGIN(INLINE);\n\t}\n\tYY_BREAK\ncase 18:\nYY_RULE_SETUP\n#line 393 \"fitshdr.l\"\n{\n\t  // Floating point complex keyvalue.\n\t  kptr->type = 7;\n\t\n\t  char *cptr;\n\t  int k;\n\t  for (cptr = ctmp, k = 1; yytext[k] != ','; cptr++, k++) {\n\t    *cptr = yytext[k];\n\t  }\n\t  *cptr = '\\0';\n\t\n\t  if (wcsutil_str2double(ctmp, kptr->keyvalue.c)) {\n\t    kptr->status |= FITSHDR_KEYVALUE;\n\t    BEGIN(ERROR);\n\t  }\n\t\n\t  for (cptr = ctmp, k++; yytext[k] != ')'; cptr++, k++) {\n\t    *cptr = yytext[k];\n\t  }\n\t  *cptr = '\\0';\n\t\n\t  if (wcsutil_str2double(ctmp, kptr->keyvalue.c+1)) {\n\t    kptr->status |= FITSHDR_KEYVALUE;\n\t    BEGIN(ERROR);\n\t  }\n\t\n\t  BEGIN(INLINE);\n\t}\n\tYY_BREAK\ncase 19:\n/* rule 19 can match eol */\nYY_RULE_SETUP\n#line 422 \"fitshdr.l\"\n{\n\t  // String keyvalue.\n\t  kptr->type = 8;\n\t  char *cptr = kptr->keyvalue.s;\n\t  strcpy(cptr, yytext+1);\n\t\n\t  // Squeeze out repeated quotes.\n\t  int k = 0;\n\t  for (int j = 0; j < 72; j++) {\n\t    if (k < j) {\n\t      cptr[k] = cptr[j];\n\t    }\n\t\n\t    if (cptr[j] == '\\0') {\n\t      if (k) cptr[k-1] = '\\0';\n\t      break;\n\t    } else if (cptr[j] == '\\'' && cptr[j+1] == '\\'') {\n\t      j++;\n\t    }\n\t\n\t    k++;\n\t  }\n\t\n\t  if (*cptr) {\n\t    // Retain the initial blank in all-blank strings.\n\t    nullfill(cptr+1, 71);\n\t  } else {\n\t    nullfill(cptr, 72);\n\t  }\n\t\n\t  BEGIN(INLINE);\n\t}\n\tYY_BREAK\ncase 20:\nYY_RULE_SETUP\n#line 455 \"fitshdr.l\"\n{\n\t  kptr->status |= FITSHDR_KEYVALUE;\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 21:\n*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */\nyyg->yy_c_buf_p = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up yytext again */\nYY_RULE_SETUP\n#line 460 \"fitshdr.l\"\n{\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 22:\n*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */\nyyg->yy_c_buf_p = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up yytext again */\nYY_RULE_SETUP\n#line 464 \"fitshdr.l\"\n{\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 23:\nYY_RULE_SETUP\n#line 468 \"fitshdr.l\"\n{\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 24:\nYY_RULE_SETUP\n#line 472 \"fitshdr.l\"\n{\n\t  kptr->status |= FITSHDR_COMMENT;\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 25:\nYY_RULE_SETUP\n#line 477 \"fitshdr.l\"\n{\n\t  // Keyvalue parsing must now also be suspect.\n\t  kptr->status |= FITSHDR_COMMENT;\n\t  kptr->type = 0;\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 26:\nYY_RULE_SETUP\n#line 484 \"fitshdr.l\"\n{\n\t  kptr->ulen = yyleng;\n\t  yymore();\n\t  BEGIN(COMMENT);\n\t}\n\tYY_BREAK\ncase 27:\nYY_RULE_SETUP\n#line 490 \"fitshdr.l\"\n{\n\t  yymore();\n\t  BEGIN(COMMENT);\n\t}\n\tYY_BREAK\ncase 28:\nYY_RULE_SETUP\n#line 495 \"fitshdr.l\"\n{\n\t  strcpy(kptr->comment, yytext);\n\t  nullfill(kptr->comment, 84);\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 29:\nYY_RULE_SETUP\n#line 501 \"fitshdr.l\"\n{\n\t  if (!continuation) kptr->type = -abs(kptr->type);\n\t\n\t  sprintf(kptr->comment, \"%.80s\", yyextra->hdr-80);\n\t  kptr->comment[80] = '\\0';\n\t  nullfill(kptr->comment+80, 4);\n\t\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 30:\n/* rule 30 can match eol */\nYY_RULE_SETUP\n#line 511 \"fitshdr.l\"\n{\n\t  // Discard the rest of the input line.\n\t  kptr->keyno = ++keyno;\n\t\n\t  // Null-fill the keyword.\n\t  kptr->keyword[8] = '\\0';\n\t  nullfill(kptr->keyword, 12);\n\t\n\t  // Do indexing.\n\t  iptr = keyids;\n\t  kptr->keyid = -1;\n\t  for (int j = 0; j < nkeyids; j++, iptr++) {\n\t    int k;\n\t    char *cptr = iptr->name;\n\t    cptr[8] = '\\0';\n\t    nullfill(cptr, 12);\n\t    for (k = 0; k < 8; k++, cptr++) {\n\t      if (*cptr != '.' && *cptr != kptr->keyword[k]) break;\n\t    }\n\t\n\t    if (k == 8) {\n\t      // Found a match.\n\t      iptr->count++;\n\t      if (iptr->idx[0] == -1) {\n\t        iptr->idx[0] = keyno-1;\n\t      } else {\n\t        iptr->idx[1] = keyno-1;\n\t      }\n\t\n\t      kptr->keyno = -abs(kptr->keyno);\n\t      if (kptr->keyid < 0) kptr->keyid = j;\n\t    }\n\t  }\n\t\n\t  // Deal with continued strings.\n\t  if (continuation) {\n\t    // Tidy up the previous string keyvalue.\n\t    if ((kptr-1)->type == 8) (kptr-1)->type += 10;\n\t    char *cptr = (kptr-1)->keyvalue.s;\n\t    if (cptr[strlen(cptr)-1] == '&') cptr[strlen(cptr)-1] = '\\0';\n\t\n\t    kptr->type = (kptr-1)->type + 10;\n\t  }\n\t\n\t  // Check for keyrecords following the END keyrecord.\n\t  if (end && (end++ > 1) && !blank) {\n\t    kptr->status |= FITSHDR_TRAILER;\n\t  }\n\t  if (kptr->status) (*nreject)++;\n\t\n\t  kptr++;\n\t  blank = 0;\n\t  continuation = 0;\n\t\n\t  BEGIN(INITIAL);\n\t}\n\tYY_BREAK\ncase YY_STATE_EOF(INITIAL):\ncase YY_STATE_EOF(VALUE):\ncase YY_STATE_EOF(INLINE):\ncase YY_STATE_EOF(UNITS):\ncase YY_STATE_EOF(COMMENT):\ncase YY_STATE_EOF(ERROR):\ncase YY_STATE_EOF(FLUSH):\n#line 568 \"fitshdr.l\"\n{\n\t  // End-of-input.\n\t  return 0;\n\t}\n\tYY_BREAK\ncase 31:\nYY_RULE_SETUP\n#line 573 \"fitshdr.l\"\nECHO;\n\tYY_BREAK\n#line 11190 \"fitshdr.c\"\n\n\tcase YY_END_OF_BUFFER:\n\t\t{\n\t\t/* Amount of text matched not including the EOB char. */\n\t\tint yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;\n\n\t\t/* Undo the effects of YY_DO_BEFORE_ACTION. */\n\t\t*yy_cp = yyg->yy_hold_char;\n\t\tYY_RESTORE_YY_MORE_OFFSET\n\n\t\tif ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )\n\t\t\t{\n\t\t\t/* We're scanning a new file or input source.  It's\n\t\t\t * possible that this happened because the user\n\t\t\t * just pointed yyin at a new source and called\n\t\t\t * yylex().  If so, then we have to assure\n\t\t\t * consistency between YY_CURRENT_BUFFER and our\n\t\t\t * globals.  Here is the right place to do so, because\n\t\t\t * this is the first action (other than possibly a\n\t\t\t * back-up) that will match for the new input source.\n\t\t\t */\n\t\t\tyyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;\n\t\t\t}\n\n\t\t/* Note that here we test for yy_c_buf_p \"<=\" to the position\n\t\t * of the first EOB in the buffer, since yy_c_buf_p will\n\t\t * already have been incremented past the NUL character\n\t\t * (since all states make transitions on EOB to the\n\t\t * end-of-buffer state).  Contrast this with the test\n\t\t * in input().\n\t\t */\n\t\tif ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )\n\t\t\t{ /* This was really a NUL. */\n\t\t\tyy_state_type yy_next_state;\n\n\t\t\tyyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;\n\n\t\t\tyy_current_state = yy_get_previous_state( yyscanner );\n\n\t\t\t/* Okay, we're now positioned to make the NUL\n\t\t\t * transition.  We couldn't have\n\t\t\t * yy_get_previous_state() go ahead and do it\n\t\t\t * for us because it doesn't know how to deal\n\t\t\t * with the possibility of jamming (and we don't\n\t\t\t * want to build jamming into it because then it\n\t\t\t * will run more slowly).\n\t\t\t */\n\n\t\t\tyy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);\n\n\t\t\tyy_bp = yyg->yytext_ptr + YY_MORE_ADJ;\n\n\t\t\tif ( yy_next_state )\n\t\t\t\t{\n\t\t\t\t/* Consume the NUL. */\n\t\t\t\tyy_cp = ++yyg->yy_c_buf_p;\n\t\t\t\tyy_current_state = yy_next_state;\n\t\t\t\tgoto yy_match;\n\t\t\t\t}\n\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tyy_cp = yyg->yy_c_buf_p;\n\t\t\t\tgoto yy_find_action;\n\t\t\t\t}\n\t\t\t}\n\n\t\telse switch ( yy_get_next_buffer( yyscanner ) )\n\t\t\t{\n\t\t\tcase EOB_ACT_END_OF_FILE:\n\t\t\t\t{\n\t\t\t\tyyg->yy_did_buffer_switch_on_eof = 0;\n\n\t\t\t\tif ( yywrap( yyscanner ) )\n\t\t\t\t\t{\n\t\t\t\t\t/* Note: because we've taken care in\n\t\t\t\t\t * yy_get_next_buffer() to have set up\n\t\t\t\t\t * yytext, we can now set up\n\t\t\t\t\t * yy_c_buf_p so that if some total\n\t\t\t\t\t * hoser (like flex itself) wants to\n\t\t\t\t\t * call the scanner after we return the\n\t\t\t\t\t * YY_NULL, it'll still work - another\n\t\t\t\t\t * YY_NULL will get returned.\n\t\t\t\t\t */\n\t\t\t\t\tyyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;\n\n\t\t\t\t\tyy_act = YY_STATE_EOF(YY_START);\n\t\t\t\t\tgoto do_action;\n\t\t\t\t\t}\n\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\tif ( ! yyg->yy_did_buffer_switch_on_eof )\n\t\t\t\t\t\tYY_NEW_FILE;\n\t\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\tcase EOB_ACT_CONTINUE_SCAN:\n\t\t\t\tyyg->yy_c_buf_p =\n\t\t\t\t\tyyg->yytext_ptr + yy_amount_of_matched_text;\n\n\t\t\t\tyy_current_state = yy_get_previous_state( yyscanner );\n\n\t\t\t\tyy_cp = yyg->yy_c_buf_p;\n\t\t\t\tyy_bp = yyg->yytext_ptr + YY_MORE_ADJ;\n\t\t\t\tgoto yy_match;\n\n\t\t\tcase EOB_ACT_LAST_MATCH:\n\t\t\t\tyyg->yy_c_buf_p =\n\t\t\t\t&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];\n\n\t\t\t\tyy_current_state = yy_get_previous_state( yyscanner );\n\n\t\t\t\tyy_cp = yyg->yy_c_buf_p;\n\t\t\t\tyy_bp = yyg->yytext_ptr + YY_MORE_ADJ;\n\t\t\t\tgoto yy_find_action;\n\t\t\t}\n\t\tbreak;\n\t\t}\n\n\tdefault:\n\t\tYY_FATAL_ERROR(\n\t\t\t\"fatal flex scanner internal error--no action found\" );\n\t} /* end of action switch */\n\t\t} /* end of scanning one token */\n\t} /* end of user's declarations */\n} /* end of yylex */\n\n/* yy_get_next_buffer - try to read in a new buffer\n *\n * Returns a code representing an action:\n *\tEOB_ACT_LAST_MATCH -\n *\tEOB_ACT_CONTINUE_SCAN - continue scanning from current position\n *\tEOB_ACT_END_OF_FILE - end of file\n */\nstatic int yy_get_next_buffer (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tchar *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;\n\tchar *source = yyg->yytext_ptr;\n\tint number_to_move, i;\n\tint ret_val;\n\n\tif ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )\n\t\tYY_FATAL_ERROR(\n\t\t\"fatal flex scanner internal error--end of buffer missed\" );\n\n\tif ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )\n\t\t{ /* Don't try to fill the buffer, so this is an EOF. */\n\t\tif ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )\n\t\t\t{\n\t\t\t/* We matched a single character, the EOB, so\n\t\t\t * treat this as a final EOF.\n\t\t\t */\n\t\t\treturn EOB_ACT_END_OF_FILE;\n\t\t\t}\n\n\t\telse\n\t\t\t{\n\t\t\t/* We matched some text prior to the EOB, first\n\t\t\t * process it.\n\t\t\t */\n\t\t\treturn EOB_ACT_LAST_MATCH;\n\t\t\t}\n\t\t}\n\n\t/* Try to read more data. */\n\n\t/* First move last chars to start of buffer. */\n\tnumber_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);\n\n\tfor ( i = 0; i < number_to_move; ++i )\n\t\t*(dest++) = *(source++);\n\n\tif ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )\n\t\t/* don't do the read, it's not guaranteed to return an EOF,\n\t\t * just force an EOF\n\t\t */\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;\n\n\telse\n\t\t{\n\t\t\tint num_to_read =\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;\n\n\t\twhile ( num_to_read <= 0 )\n\t\t\t{ /* Not enough room in the buffer - grow it. */\n\n\t\t\t/* just a shorter name for the current buffer */\n\t\t\tYY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;\n\n\t\t\tint yy_c_buf_p_offset =\n\t\t\t\t(int) (yyg->yy_c_buf_p - b->yy_ch_buf);\n\n\t\t\tif ( b->yy_is_our_buffer )\n\t\t\t\t{\n\t\t\t\tint new_size = b->yy_buf_size * 2;\n\n\t\t\t\tif ( new_size <= 0 )\n\t\t\t\t\tb->yy_buf_size += b->yy_buf_size / 8;\n\t\t\t\telse\n\t\t\t\t\tb->yy_buf_size *= 2;\n\n\t\t\t\tb->yy_ch_buf = (char *)\n\t\t\t\t\t/* Include room in for 2 EOB chars. */\n\t\t\t\t\tyyrealloc( (void *) b->yy_ch_buf,\n\t\t\t\t\t\t\t (yy_size_t) (b->yy_buf_size + 2) , yyscanner );\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t/* Can't grow it, we don't own it. */\n\t\t\t\tb->yy_ch_buf = NULL;\n\n\t\t\tif ( ! b->yy_ch_buf )\n\t\t\t\tYY_FATAL_ERROR(\n\t\t\t\t\"fatal error - scanner input buffer overflow\" );\n\n\t\t\tyyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];\n\n\t\t\tnum_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -\n\t\t\t\t\t\tnumber_to_move - 1;\n\n\t\t\t}\n\n\t\tif ( num_to_read > YY_READ_BUF_SIZE )\n\t\t\tnum_to_read = YY_READ_BUF_SIZE;\n\n\t\t/* Read in more data. */\n\t\tYY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),\n\t\t\tyyg->yy_n_chars, num_to_read );\n\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;\n\t\t}\n\n\tif ( yyg->yy_n_chars == 0 )\n\t\t{\n\t\tif ( number_to_move == YY_MORE_ADJ )\n\t\t\t{\n\t\t\tret_val = EOB_ACT_END_OF_FILE;\n\t\t\tyyrestart( yyin  , yyscanner);\n\t\t\t}\n\n\t\telse\n\t\t\t{\n\t\t\tret_val = EOB_ACT_LAST_MATCH;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buffer_status =\n\t\t\t\tYY_BUFFER_EOF_PENDING;\n\t\t\t}\n\t\t}\n\n\telse\n\t\tret_val = EOB_ACT_CONTINUE_SCAN;\n\n\tif ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {\n\t\t/* Extend the array by 50%, plus the number we really need. */\n\t\tint new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(\n\t\t\t(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );\n\t\tif ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_get_next_buffer()\" );\n\t\t/* \"- 2\" to take care of EOB's */\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);\n\t}\n\n\tyyg->yy_n_chars += number_to_move;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;\n\n\tyyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];\n\n\treturn ret_val;\n}\n\n/* yy_get_previous_state - get the state just before the EOB char was reached */\n\n    static yy_state_type yy_get_previous_state (yyscan_t yyscanner)\n{\n\tyy_state_type yy_current_state;\n\tchar *yy_cp;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tyy_current_state = yyg->yy_start;\n\tyy_current_state += YY_AT_BOL();\n\n\tfor ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )\n\t\t{\n\t\tif ( *yy_cp )\n\t\t\t{\n\t\t\tyy_current_state = yy_nxt[yy_current_state][YY_SC_TO_UI(*yy_cp)];\n\t\t\t}\n\t\telse\n\t\t\tyy_current_state = yy_NUL_trans[yy_current_state];\n\t\tif ( yy_accept[yy_current_state] )\n\t\t\t{\n\t\t\tyyg->yy_last_accepting_state = yy_current_state;\n\t\t\tyyg->yy_last_accepting_cpos = yy_cp;\n\t\t\t}\n\t\t}\n\n\treturn yy_current_state;\n}\n\n/* yy_try_NUL_trans - try to make a transition on the NUL character\n *\n * synopsis\n *\tnext_state = yy_try_NUL_trans( current_state );\n */\n    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)\n{\n\tint yy_is_jam;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */\n\tchar *yy_cp = yyg->yy_c_buf_p;\n\n\tyy_current_state = yy_NUL_trans[yy_current_state];\n\tyy_is_jam = (yy_current_state == 0);\n\n\tif ( ! yy_is_jam )\n\t\t{\n\t\tif ( yy_accept[yy_current_state] )\n\t\t\t{\n\t\t\tyyg->yy_last_accepting_state = yy_current_state;\n\t\t\tyyg->yy_last_accepting_cpos = yy_cp;\n\t\t\t}\n\t\t}\n\n\t(void)yyg;\n\treturn yy_is_jam ? 0 : yy_current_state;\n}\n\n#ifndef YY_NO_UNPUT\n\n#endif\n\n#ifndef YY_NO_INPUT\n#ifdef __cplusplus\n    static int yyinput (yyscan_t yyscanner)\n#else\n    static int input  (yyscan_t yyscanner)\n#endif\n\n{\n\tint c;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\t*yyg->yy_c_buf_p = yyg->yy_hold_char;\n\n\tif ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )\n\t\t{\n\t\t/* yy_c_buf_p now points to the character we want to return.\n\t\t * If this occurs *before* the EOB characters, then it's a\n\t\t * valid NUL; if not, then we've hit the end of the buffer.\n\t\t */\n\t\tif ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )\n\t\t\t/* This was really a NUL. */\n\t\t\t*yyg->yy_c_buf_p = '\\0';\n\n\t\telse\n\t\t\t{ /* need more input */\n\t\t\tint offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);\n\t\t\t++yyg->yy_c_buf_p;\n\n\t\t\tswitch ( yy_get_next_buffer( yyscanner ) )\n\t\t\t\t{\n\t\t\t\tcase EOB_ACT_LAST_MATCH:\n\t\t\t\t\t/* This happens because yy_g_n_b()\n\t\t\t\t\t * sees that we've accumulated a\n\t\t\t\t\t * token and flags that we need to\n\t\t\t\t\t * try matching the token before\n\t\t\t\t\t * proceeding.  But for input(),\n\t\t\t\t\t * there's no matching to consider.\n\t\t\t\t\t * So convert the EOB_ACT_LAST_MATCH\n\t\t\t\t\t * to EOB_ACT_END_OF_FILE.\n\t\t\t\t\t */\n\n\t\t\t\t\t/* Reset buffer status. */\n\t\t\t\t\tyyrestart( yyin , yyscanner);\n\n\t\t\t\t\t/*FALLTHROUGH*/\n\n\t\t\t\tcase EOB_ACT_END_OF_FILE:\n\t\t\t\t\t{\n\t\t\t\t\tif ( yywrap( yyscanner ) )\n\t\t\t\t\t\treturn 0;\n\n\t\t\t\t\tif ( ! yyg->yy_did_buffer_switch_on_eof )\n\t\t\t\t\t\tYY_NEW_FILE;\n#ifdef __cplusplus\n\t\t\t\t\treturn yyinput(yyscanner);\n#else\n\t\t\t\t\treturn input(yyscanner);\n#endif\n\t\t\t\t\t}\n\n\t\t\t\tcase EOB_ACT_CONTINUE_SCAN:\n\t\t\t\t\tyyg->yy_c_buf_p = yyg->yytext_ptr + offset;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tc = *(unsigned char *) yyg->yy_c_buf_p;\t/* cast for 8-bit char's */\n\t*yyg->yy_c_buf_p = '\\0';\t/* preserve yytext */\n\tyyg->yy_hold_char = *++yyg->yy_c_buf_p;\n\n\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\\n');\n\n\treturn c;\n}\n#endif\t/* ifndef YY_NO_INPUT */\n\n/** Immediately switch to a different input stream.\n * @param input_file A readable stream.\n * @param yyscanner The scanner object.\n * @note This function does not reset the start condition to @c INITIAL .\n */\n    void yyrestart  (FILE * input_file , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif ( ! YY_CURRENT_BUFFER ){\n        yyensure_buffer_stack (yyscanner);\n\t\tYY_CURRENT_BUFFER_LVALUE =\n            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);\n\t}\n\n\tyy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);\n\tyy_load_buffer_state( yyscanner );\n}\n\n/** Switch to a different input buffer.\n * @param new_buffer The new input buffer.\n * @param yyscanner The scanner object.\n */\n    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\t/* TODO. We should be able to replace this entire function body\n\t * with\n\t *\t\tyypop_buffer_state();\n\t *\t\tyypush_buffer_state(new_buffer);\n     */\n\tyyensure_buffer_stack (yyscanner);\n\tif ( YY_CURRENT_BUFFER == new_buffer )\n\t\treturn;\n\n\tif ( YY_CURRENT_BUFFER )\n\t\t{\n\t\t/* Flush out information for old buffer. */\n\t\t*yyg->yy_c_buf_p = yyg->yy_hold_char;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;\n\t\t}\n\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\tyy_load_buffer_state( yyscanner );\n\n\t/* We don't actually know whether we did this switch during\n\t * EOF (yywrap()) processing, but the only time this flag\n\t * is looked at is after yywrap() is called, so it's safe\n\t * to go ahead and always set it.\n\t */\n\tyyg->yy_did_buffer_switch_on_eof = 1;\n}\n\nstatic void yy_load_buffer_state  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tyyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\tyyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;\n\tyyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;\n\tyyg->yy_hold_char = *yyg->yy_c_buf_p;\n}\n\n/** Allocate and initialize an input buffer state.\n * @param file A readable stream.\n * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.\n * @param yyscanner The scanner object.\n * @return the allocated buffer state.\n */\n    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)\n{\n\tYY_BUFFER_STATE b;\n    \n\tb = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );\n\n\tb->yy_buf_size = size;\n\n\t/* yy_ch_buf has to be 2 characters longer than the size given because\n\t * we need to put in 2 end-of-buffer characters.\n\t */\n\tb->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );\n\tif ( ! b->yy_ch_buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );\n\n\tb->yy_is_our_buffer = 1;\n\n\tyy_init_buffer( b, file , yyscanner);\n\n\treturn b;\n}\n\n/** Destroy the buffer.\n * @param b a buffer created with yy_create_buffer()\n * @param yyscanner The scanner object.\n */\n    void yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif ( ! b )\n\t\treturn;\n\n\tif ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */\n\t\tYY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;\n\n\tif ( b->yy_is_our_buffer )\n\t\tyyfree( (void *) b->yy_ch_buf , yyscanner );\n\n\tyyfree( (void *) b , yyscanner );\n}\n\n/* Initializes or reinitializes a buffer.\n * This function is sometimes called more than once on the same buffer,\n * such as during a yyrestart() or at EOF.\n */\n    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)\n\n{\n\tint oerrno = errno;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tyy_flush_buffer( b , yyscanner);\n\n\tb->yy_input_file = file;\n\tb->yy_fill_buffer = 1;\n\n    /* If b is the current buffer, then yy_init_buffer was _probably_\n     * called from yyrestart() or through yy_get_next_buffer.\n     * In that case, we don't want to reset the lineno or column.\n     */\n    if (b != YY_CURRENT_BUFFER){\n        b->yy_bs_lineno = 1;\n        b->yy_bs_column = 0;\n    }\n\n        b->yy_is_interactive = 0;\n    \n\terrno = oerrno;\n}\n\n/** Discard all buffered characters. On the next scan, YY_INPUT will be called.\n * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.\n * @param yyscanner The scanner object.\n */\n    void yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tif ( ! b )\n\t\treturn;\n\n\tb->yy_n_chars = 0;\n\n\t/* We always need two end-of-buffer characters.  The first causes\n\t * a transition to the end-of-buffer state.  The second causes\n\t * a jam in that state.\n\t */\n\tb->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;\n\tb->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;\n\n\tb->yy_buf_pos = &b->yy_ch_buf[0];\n\n\tb->yy_at_bol = 1;\n\tb->yy_buffer_status = YY_BUFFER_NEW;\n\n\tif ( b == YY_CURRENT_BUFFER )\n\t\tyy_load_buffer_state( yyscanner );\n}\n\n/** Pushes the new state onto the stack. The new state becomes\n *  the current state. This function will allocate the stack\n *  if necessary.\n *  @param new_buffer The new state.\n *  @param yyscanner The scanner object.\n */\nvoid yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tif (new_buffer == NULL)\n\t\treturn;\n\n\tyyensure_buffer_stack(yyscanner);\n\n\t/* This block is copied from yy_switch_to_buffer. */\n\tif ( YY_CURRENT_BUFFER )\n\t\t{\n\t\t/* Flush out information for old buffer. */\n\t\t*yyg->yy_c_buf_p = yyg->yy_hold_char;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;\n\t\t}\n\n\t/* Only push if top exists. Otherwise, replace top. */\n\tif (YY_CURRENT_BUFFER)\n\t\tyyg->yy_buffer_stack_top++;\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\n\t/* copied from yy_switch_to_buffer. */\n\tyy_load_buffer_state( yyscanner );\n\tyyg->yy_did_buffer_switch_on_eof = 1;\n}\n\n/** Removes and deletes the top of the stack, if present.\n *  The next element becomes the new top.\n *  @param yyscanner The scanner object.\n */\nvoid yypop_buffer_state (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tif (!YY_CURRENT_BUFFER)\n\t\treturn;\n\n\tyy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);\n\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\tif (yyg->yy_buffer_stack_top > 0)\n\t\t--yyg->yy_buffer_stack_top;\n\n\tif (YY_CURRENT_BUFFER) {\n\t\tyy_load_buffer_state( yyscanner );\n\t\tyyg->yy_did_buffer_switch_on_eof = 1;\n\t}\n}\n\n/* Allocates the stack if it does not exist.\n *  Guarantees space for at least one push.\n */\nstatic void yyensure_buffer_stack (yyscan_t yyscanner)\n{\n\tyy_size_t num_to_alloc;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif (!yyg->yy_buffer_stack) {\n\n\t\t/* First allocation is just for 2 elements, since we don't know if this\n\t\t * scanner will even need a stack. We use 2 instead of 1 to avoid an\n\t\t * immediate realloc on the next call.\n         */\n      num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */\n\t\tyyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc\n\t\t\t\t\t\t\t\t(num_to_alloc * sizeof(struct yy_buffer_state*)\n\t\t\t\t\t\t\t\t, yyscanner);\n\t\tif ( ! yyg->yy_buffer_stack )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in yyensure_buffer_stack()\" );\n\n\t\tmemset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));\n\n\t\tyyg->yy_buffer_stack_max = num_to_alloc;\n\t\tyyg->yy_buffer_stack_top = 0;\n\t\treturn;\n\t}\n\n\tif (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){\n\n\t\t/* Increase the buffer to prepare for a possible push. */\n\t\tyy_size_t grow_size = 8 /* arbitrary grow size */;\n\n\t\tnum_to_alloc = yyg->yy_buffer_stack_max + grow_size;\n\t\tyyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc\n\t\t\t\t\t\t\t\t(yyg->yy_buffer_stack,\n\t\t\t\t\t\t\t\tnum_to_alloc * sizeof(struct yy_buffer_state*)\n\t\t\t\t\t\t\t\t, yyscanner);\n\t\tif ( ! yyg->yy_buffer_stack )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in yyensure_buffer_stack()\" );\n\n\t\t/* zero only the new slots.*/\n\t\tmemset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));\n\t\tyyg->yy_buffer_stack_max = num_to_alloc;\n\t}\n}\n\n/** Setup the input buffer state to scan directly from a user-specified character buffer.\n * @param base the character buffer\n * @param size the size in bytes of the character buffer\n * @param yyscanner The scanner object.\n * @return the newly allocated buffer state object.\n */\nYY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)\n{\n\tYY_BUFFER_STATE b;\n    \n\tif ( size < 2 ||\n\t     base[size-2] != YY_END_OF_BUFFER_CHAR ||\n\t     base[size-1] != YY_END_OF_BUFFER_CHAR )\n\t\t/* They forgot to leave room for the EOB's. */\n\t\treturn NULL;\n\n\tb = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_scan_buffer()\" );\n\n\tb->yy_buf_size = (int) (size - 2);\t/* \"- 2\" to take care of EOB's */\n\tb->yy_buf_pos = b->yy_ch_buf = base;\n\tb->yy_is_our_buffer = 0;\n\tb->yy_input_file = NULL;\n\tb->yy_n_chars = b->yy_buf_size;\n\tb->yy_is_interactive = 0;\n\tb->yy_at_bol = 1;\n\tb->yy_fill_buffer = 0;\n\tb->yy_buffer_status = YY_BUFFER_NEW;\n\n\tyy_switch_to_buffer( b , yyscanner );\n\n\treturn b;\n}\n\n/** Setup the input buffer state to scan a string. The next call to yylex() will\n * scan from a @e copy of @a str.\n * @param yystr a NUL-terminated string to scan\n * @param yyscanner The scanner object.\n * @return the newly allocated buffer state object.\n * @note If you want to scan bytes that may contain NUL values, then use\n *       yy_scan_bytes() instead.\n */\nYY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)\n{\n    \n\treturn yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);\n}\n\n/** Setup the input buffer state to scan the given bytes. The next call to yylex() will\n * scan from a @e copy of @a bytes.\n * @param yybytes the byte buffer to scan\n * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.\n * @param yyscanner The scanner object.\n * @return the newly allocated buffer state object.\n */\nYY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len , yyscan_t yyscanner)\n{\n\tYY_BUFFER_STATE b;\n\tchar *buf;\n\tyy_size_t n;\n\tint i;\n    \n\t/* Get memory for full buffer, including space for trailing EOB's. */\n\tn = (yy_size_t) (_yybytes_len + 2);\n\tbuf = (char *) yyalloc( n , yyscanner );\n\tif ( ! buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_scan_bytes()\" );\n\n\tfor ( i = 0; i < _yybytes_len; ++i )\n\t\tbuf[i] = yybytes[i];\n\n\tbuf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;\n\n\tb = yy_scan_buffer( buf, n , yyscanner);\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"bad buffer in yy_scan_bytes()\" );\n\n\t/* It's okay to grow etc. this buffer, and we should throw it\n\t * away when we're done.\n\t */\n\tb->yy_is_our_buffer = 1;\n\n\treturn b;\n}\n\n#ifndef YY_EXIT_FAILURE\n#define YY_EXIT_FAILURE 2\n#endif\n\nstatic void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\tfprintf( stderr, \"%s\\n\", msg );\n\texit( YY_EXIT_FAILURE );\n}\n\n/* Redefine yyless() so it works in section 3 code. */\n\n#undef yyless\n#define yyless(n) \\\n\tdo \\\n\t\t{ \\\n\t\t/* Undo effects of setting up yytext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\tyytext[yyleng] = yyg->yy_hold_char; \\\n\t\tyyg->yy_c_buf_p = yytext + yyless_macro_arg; \\\n\t\tyyg->yy_hold_char = *yyg->yy_c_buf_p; \\\n\t\t*yyg->yy_c_buf_p = '\\0'; \\\n\t\tyyleng = yyless_macro_arg; \\\n\t\t} \\\n\twhile ( 0 )\n\n/* Accessor  methods (get/set functions) to struct members. */\n\n/** Get the user-defined data for this scanner.\n * @param yyscanner The scanner object.\n */\nYY_EXTRA_TYPE yyget_extra  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyextra;\n}\n\n/** Get the current line number.\n * @param yyscanner The scanner object.\n */\nint yyget_lineno  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        if (! YY_CURRENT_BUFFER)\n            return 0;\n    \n    return yylineno;\n}\n\n/** Get the current column number.\n * @param yyscanner The scanner object.\n */\nint yyget_column  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        if (! YY_CURRENT_BUFFER)\n            return 0;\n    \n    return yycolumn;\n}\n\n/** Get the input stream.\n * @param yyscanner The scanner object.\n */\nFILE *yyget_in  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyin;\n}\n\n/** Get the output stream.\n * @param yyscanner The scanner object.\n */\nFILE *yyget_out  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyout;\n}\n\n/** Get the length of the current token.\n * @param yyscanner The scanner object.\n */\nint yyget_leng  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyleng;\n}\n\n/** Get the current token.\n * @param yyscanner The scanner object.\n */\n\nchar *yyget_text  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yytext;\n}\n\n/** Set the user-defined data. This data is never touched by the scanner.\n * @param user_defined The data to be associated with this scanner.\n * @param yyscanner The scanner object.\n */\nvoid yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yyextra = user_defined ;\n}\n\n/** Set the current line number.\n * @param _line_number line number\n * @param yyscanner The scanner object.\n */\nvoid yyset_lineno (int  _line_number , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        /* lineno is only valid if an input buffer exists. */\n        if (! YY_CURRENT_BUFFER )\n           YY_FATAL_ERROR( \"yyset_lineno called with no buffer\" );\n    \n    yylineno = _line_number;\n}\n\n/** Set the current column.\n * @param _column_no column number\n * @param yyscanner The scanner object.\n */\nvoid yyset_column (int  _column_no , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        /* column is only valid if an input buffer exists. */\n        if (! YY_CURRENT_BUFFER )\n           YY_FATAL_ERROR( \"yyset_column called with no buffer\" );\n    \n    yycolumn = _column_no;\n}\n\n/** Set the input stream. This does not discard the current\n * input buffer.\n * @param _in_str A readable stream.\n * @param yyscanner The scanner object.\n * @see yy_switch_to_buffer\n */\nvoid yyset_in (FILE *  _in_str , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yyin = _in_str ;\n}\n\nvoid yyset_out (FILE *  _out_str , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yyout = _out_str ;\n}\n\nint yyget_debug  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yy_flex_debug;\n}\n\nvoid yyset_debug (int  _bdebug , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yy_flex_debug = _bdebug ;\n}\n\n/* Accessor methods for yylval and yylloc */\n\n/* User-visible API */\n\n/* yylex_init is special because it creates the scanner itself, so it is\n * the ONLY reentrant function that doesn't take the scanner as the last argument.\n * That's why we explicitly handle the declaration, instead of using our macros.\n */\nint yylex_init(yyscan_t* ptr_yy_globals)\n{\n    if (ptr_yy_globals == NULL){\n        errno = EINVAL;\n        return 1;\n    }\n\n    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );\n\n    if (*ptr_yy_globals == NULL){\n        errno = ENOMEM;\n        return 1;\n    }\n\n    /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */\n    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));\n\n    return yy_init_globals ( *ptr_yy_globals );\n}\n\n/* yylex_init_extra has the same functionality as yylex_init, but follows the\n * convention of taking the scanner as the last argument. Note however, that\n * this is a *pointer* to a scanner, as it will be allocated by this call (and\n * is the reason, too, why this function also must handle its own declaration).\n * The user defined value in the first argument will be available to yyalloc in\n * the yyextra field.\n */\nint yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )\n{\n    struct yyguts_t dummy_yyguts;\n\n    yyset_extra (yy_user_defined, &dummy_yyguts);\n\n    if (ptr_yy_globals == NULL){\n        errno = EINVAL;\n        return 1;\n    }\n\n    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );\n\n    if (*ptr_yy_globals == NULL){\n        errno = ENOMEM;\n        return 1;\n    }\n\n    /* By setting to 0xAA, we expose bugs in\n    yy_init_globals. Leave at 0x00 for releases. */\n    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));\n\n    yyset_extra (yy_user_defined, *ptr_yy_globals);\n\n    return yy_init_globals ( *ptr_yy_globals );\n}\n\nstatic int yy_init_globals (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    /* Initialization is the same as for the non-reentrant scanner.\n     * This function is called from yylex_destroy(), so don't allocate here.\n     */\n\n    yyg->yy_buffer_stack = NULL;\n    yyg->yy_buffer_stack_top = 0;\n    yyg->yy_buffer_stack_max = 0;\n    yyg->yy_c_buf_p = NULL;\n    yyg->yy_init = 0;\n    yyg->yy_start = 0;\n\n    yyg->yy_start_stack_ptr = 0;\n    yyg->yy_start_stack_depth = 0;\n    yyg->yy_start_stack =  NULL;\n\n/* Defined in main.c */\n#ifdef YY_STDINIT\n    yyin = stdin;\n    yyout = stdout;\n#else\n    yyin = NULL;\n    yyout = NULL;\n#endif\n\n    /* For future reference: Set errno on error, since we are called by\n     * yylex_init()\n     */\n    return 0;\n}\n\n/* yylex_destroy is for both reentrant and non-reentrant scanners. */\nint yylex_destroy  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n    /* Pop the buffer stack, destroying each element. */\n\twhile(YY_CURRENT_BUFFER){\n\t\tyy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );\n\t\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\t\tyypop_buffer_state(yyscanner);\n\t}\n\n\t/* Destroy the stack itself. */\n\tyyfree(yyg->yy_buffer_stack , yyscanner);\n\tyyg->yy_buffer_stack = NULL;\n\n    /* Destroy the start condition stack. */\n        yyfree( yyg->yy_start_stack , yyscanner );\n        yyg->yy_start_stack = NULL;\n\n    /* Reset the globals. This is important in a non-reentrant scanner so the next time\n     * yylex() is called, initialization will occur. */\n    yy_init_globals( yyscanner);\n\n    /* Destroy the main struct (reentrant only). */\n    yyfree ( yyscanner , yyscanner );\n    yyscanner = NULL;\n    return 0;\n}\n\n/*\n * Internal utility routines.\n */\n\n#ifndef yytext_ptr\nstatic void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\n\tint i;\n\tfor ( i = 0; i < n; ++i )\n\t\ts1[i] = s2[i];\n}\n#endif\n\n#ifdef YY_NEED_STRLEN\nstatic int yy_flex_strlen (const char * s , yyscan_t yyscanner)\n{\n\tint n;\n\tfor ( n = 0; s[n]; ++n )\n\t\t;\n\n\treturn n;\n}\n#endif\n\nvoid *yyalloc (yy_size_t  size , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\treturn malloc(size);\n}\n\nvoid *yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\n\t/* The cast to (char *) in the following accommodates both\n\t * implementations that use char* generic pointers, and those\n\t * that use void* generic pointers.  It works with the latter\n\t * because both ANSI C and C++ allow castless assignment from\n\t * any pointer type to void*, and deal with argument conversions\n\t * as though doing an assignment.\n\t */\n\treturn realloc(ptr, size);\n}\n\nvoid yyfree (void * ptr , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\tfree( (char *) ptr );\t/* see yyrealloc() for (char *) cast */\n}\n\n#define YYTABLES_NAME \"yytables\"\n\n#line 573 \"fitshdr.l\"\n\n\n/*----------------------------------------------------------------------------\n* External interface to the scanner.\n*---------------------------------------------------------------------------*/\n\nint fitshdr(\n  const char header[],\n  int nkeyrec,\n  int nkeyids,\n  struct fitskeyid keyids[],\n  int *nreject,\n  struct fitskey **keys)\n\n{\n  // Function prototypes.\n  int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner);\n  int yylex_destroy(yyscan_t yyscanner);\n\n  struct fitshdr_extra extra;\n  yyscan_t yyscanner;\n  yylex_init_extra(&extra, &yyscanner);\n  int status = fitshdr_scanner(header, nkeyrec, nkeyids, keyids, nreject,\n                               keys, yyscanner);\n  yylex_destroy(yyscanner);\n\n  return status;\n}\n\n/*----------------------------------------------------------------------------\n* Pad a string with null characters.\n*---------------------------------------------------------------------------*/\n\nvoid nullfill(char cptr[], int len)\n\n{\n  // Propagate the terminating null to the end of the string.\n  int j;\n  for (j = 0; j < len; j++) {\n    if (cptr[j] == '\\0') {\n      for (int k = j+1; k < len; k++) {\n        cptr[k] = '\\0';\n      }\n      break;\n    }\n  }\n\n  // Remove trailing blanks.\n  for (int k = j-1; k >= 0; k--) {\n    if (cptr[k] != ' ') break;\n    cptr[k] = '\\0';\n  }\n\n  return;\n}\n\n"},{"id":16619,"name":"wcsbth.c","nodeType":"TextFile","path":"cextern/wcslib/C/flexed","text":"#line 2 \"wcsbth.c\"\n\n#line 4 \"wcsbth.c\"\n\n#define _POSIX_C_SOURCE 1\n#define  YY_INT_ALIGNED short int\n\n/* A lexical scanner generated by flex */\n\n#define FLEX_SCANNER\n#define YY_FLEX_MAJOR_VERSION 2\n#define YY_FLEX_MINOR_VERSION 6\n#define YY_FLEX_SUBMINOR_VERSION 4\n#if YY_FLEX_SUBMINOR_VERSION > 0\n#define FLEX_BETA\n#endif\n\n#ifdef yy_create_buffer\n#define wcsbth_create_buffer_ALREADY_DEFINED\n#else\n#define yy_create_buffer wcsbth_create_buffer\n#endif\n\n#ifdef yy_delete_buffer\n#define wcsbth_delete_buffer_ALREADY_DEFINED\n#else\n#define yy_delete_buffer wcsbth_delete_buffer\n#endif\n\n#ifdef yy_scan_buffer\n#define wcsbth_scan_buffer_ALREADY_DEFINED\n#else\n#define yy_scan_buffer wcsbth_scan_buffer\n#endif\n\n#ifdef yy_scan_string\n#define wcsbth_scan_string_ALREADY_DEFINED\n#else\n#define yy_scan_string wcsbth_scan_string\n#endif\n\n#ifdef yy_scan_bytes\n#define wcsbth_scan_bytes_ALREADY_DEFINED\n#else\n#define yy_scan_bytes wcsbth_scan_bytes\n#endif\n\n#ifdef yy_init_buffer\n#define wcsbth_init_buffer_ALREADY_DEFINED\n#else\n#define yy_init_buffer wcsbth_init_buffer\n#endif\n\n#ifdef yy_flush_buffer\n#define wcsbth_flush_buffer_ALREADY_DEFINED\n#else\n#define yy_flush_buffer wcsbth_flush_buffer\n#endif\n\n#ifdef yy_load_buffer_state\n#define wcsbth_load_buffer_state_ALREADY_DEFINED\n#else\n#define yy_load_buffer_state wcsbth_load_buffer_state\n#endif\n\n#ifdef yy_switch_to_buffer\n#define wcsbth_switch_to_buffer_ALREADY_DEFINED\n#else\n#define yy_switch_to_buffer wcsbth_switch_to_buffer\n#endif\n\n#ifdef yypush_buffer_state\n#define wcsbthpush_buffer_state_ALREADY_DEFINED\n#else\n#define yypush_buffer_state wcsbthpush_buffer_state\n#endif\n\n#ifdef yypop_buffer_state\n#define wcsbthpop_buffer_state_ALREADY_DEFINED\n#else\n#define yypop_buffer_state wcsbthpop_buffer_state\n#endif\n\n#ifdef yyensure_buffer_stack\n#define wcsbthensure_buffer_stack_ALREADY_DEFINED\n#else\n#define yyensure_buffer_stack wcsbthensure_buffer_stack\n#endif\n\n#ifdef yylex\n#define wcsbthlex_ALREADY_DEFINED\n#else\n#define yylex wcsbthlex\n#endif\n\n#ifdef yyrestart\n#define wcsbthrestart_ALREADY_DEFINED\n#else\n#define yyrestart wcsbthrestart\n#endif\n\n#ifdef yylex_init\n#define wcsbthlex_init_ALREADY_DEFINED\n#else\n#define yylex_init wcsbthlex_init\n#endif\n\n#ifdef yylex_init_extra\n#define wcsbthlex_init_extra_ALREADY_DEFINED\n#else\n#define yylex_init_extra wcsbthlex_init_extra\n#endif\n\n#ifdef yylex_destroy\n#define wcsbthlex_destroy_ALREADY_DEFINED\n#else\n#define yylex_destroy wcsbthlex_destroy\n#endif\n\n#ifdef yyget_debug\n#define wcsbthget_debug_ALREADY_DEFINED\n#else\n#define yyget_debug wcsbthget_debug\n#endif\n\n#ifdef yyset_debug\n#define wcsbthset_debug_ALREADY_DEFINED\n#else\n#define yyset_debug wcsbthset_debug\n#endif\n\n#ifdef yyget_extra\n#define wcsbthget_extra_ALREADY_DEFINED\n#else\n#define yyget_extra wcsbthget_extra\n#endif\n\n#ifdef yyset_extra\n#define wcsbthset_extra_ALREADY_DEFINED\n#else\n#define yyset_extra wcsbthset_extra\n#endif\n\n#ifdef yyget_in\n#define wcsbthget_in_ALREADY_DEFINED\n#else\n#define yyget_in wcsbthget_in\n#endif\n\n#ifdef yyset_in\n#define wcsbthset_in_ALREADY_DEFINED\n#else\n#define yyset_in wcsbthset_in\n#endif\n\n#ifdef yyget_out\n#define wcsbthget_out_ALREADY_DEFINED\n#else\n#define yyget_out wcsbthget_out\n#endif\n\n#ifdef yyset_out\n#define wcsbthset_out_ALREADY_DEFINED\n#else\n#define yyset_out wcsbthset_out\n#endif\n\n#ifdef yyget_leng\n#define wcsbthget_leng_ALREADY_DEFINED\n#else\n#define yyget_leng wcsbthget_leng\n#endif\n\n#ifdef yyget_text\n#define wcsbthget_text_ALREADY_DEFINED\n#else\n#define yyget_text wcsbthget_text\n#endif\n\n#ifdef yyget_lineno\n#define wcsbthget_lineno_ALREADY_DEFINED\n#else\n#define yyget_lineno wcsbthget_lineno\n#endif\n\n#ifdef yyset_lineno\n#define wcsbthset_lineno_ALREADY_DEFINED\n#else\n#define yyset_lineno wcsbthset_lineno\n#endif\n\n#ifdef yyget_column\n#define wcsbthget_column_ALREADY_DEFINED\n#else\n#define yyget_column wcsbthget_column\n#endif\n\n#ifdef yyset_column\n#define wcsbthset_column_ALREADY_DEFINED\n#else\n#define yyset_column wcsbthset_column\n#endif\n\n#ifdef yywrap\n#define wcsbthwrap_ALREADY_DEFINED\n#else\n#define yywrap wcsbthwrap\n#endif\n\n#ifdef yyalloc\n#define wcsbthalloc_ALREADY_DEFINED\n#else\n#define yyalloc wcsbthalloc\n#endif\n\n#ifdef yyrealloc\n#define wcsbthrealloc_ALREADY_DEFINED\n#else\n#define yyrealloc wcsbthrealloc\n#endif\n\n#ifdef yyfree\n#define wcsbthfree_ALREADY_DEFINED\n#else\n#define yyfree wcsbthfree\n#endif\n\n/* First, we deal with  platform-specific or compiler-specific issues. */\n\n/* begin standard C headers. */\n#include <stdio.h>\n#include <string.h>\n#include <errno.h>\n#include <stdlib.h>\n\n/* end standard C headers. */\n\n/* flex integer type definitions */\n\n#ifndef FLEXINT_H\n#define FLEXINT_H\n\n/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */\n\n#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\n\n/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,\n * if you want the limit (max/min) macros for int types. \n */\n#ifndef __STDC_LIMIT_MACROS\n#define __STDC_LIMIT_MACROS 1\n#endif\n\n#include <inttypes.h>\ntypedef int8_t flex_int8_t;\ntypedef uint8_t flex_uint8_t;\ntypedef int16_t flex_int16_t;\ntypedef uint16_t flex_uint16_t;\ntypedef int32_t flex_int32_t;\ntypedef uint32_t flex_uint32_t;\n#else\ntypedef signed char flex_int8_t;\ntypedef short int flex_int16_t;\ntypedef int flex_int32_t;\ntypedef unsigned char flex_uint8_t; \ntypedef unsigned short int flex_uint16_t;\ntypedef unsigned int flex_uint32_t;\n\n/* Limits of integral types. */\n#ifndef INT8_MIN\n#define INT8_MIN               (-128)\n#endif\n#ifndef INT16_MIN\n#define INT16_MIN              (-32767-1)\n#endif\n#ifndef INT32_MIN\n#define INT32_MIN              (-2147483647-1)\n#endif\n#ifndef INT8_MAX\n#define INT8_MAX               (127)\n#endif\n#ifndef INT16_MAX\n#define INT16_MAX              (32767)\n#endif\n#ifndef INT32_MAX\n#define INT32_MAX              (2147483647)\n#endif\n#ifndef UINT8_MAX\n#define UINT8_MAX              (255U)\n#endif\n#ifndef UINT16_MAX\n#define UINT16_MAX             (65535U)\n#endif\n#ifndef UINT32_MAX\n#define UINT32_MAX             (4294967295U)\n#endif\n\n#ifndef SIZE_MAX\n#define SIZE_MAX               (~(size_t)0)\n#endif\n\n#endif /* ! C99 */\n\n#endif /* ! FLEXINT_H */\n\n/* begin standard C++ headers. */\n\n/* TODO: this is always defined, so inline it */\n#define yyconst const\n\n#if defined(__GNUC__) && __GNUC__ >= 3\n#define yynoreturn __attribute__((__noreturn__))\n#else\n#define yynoreturn\n#endif\n\n/* Returned upon end-of-file. */\n#define YY_NULL 0\n\n/* Promotes a possibly negative, possibly signed char to an\n *   integer in range [0..255] for use as an array index.\n */\n#define YY_SC_TO_UI(c) ((YY_CHAR) (c))\n\n/* An opaque pointer. */\n#ifndef YY_TYPEDEF_YY_SCANNER_T\n#define YY_TYPEDEF_YY_SCANNER_T\ntypedef void* yyscan_t;\n#endif\n\n/* For convenience, these vars (plus the bison vars far below)\n   are macros in the reentrant scanner. */\n#define yyin yyg->yyin_r\n#define yyout yyg->yyout_r\n#define yyextra yyg->yyextra_r\n#define yyleng yyg->yyleng_r\n#define yytext yyg->yytext_r\n#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)\n#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)\n#define yy_flex_debug yyg->yy_flex_debug_r\n\n/* Enter a start condition.  This macro really ought to take a parameter,\n * but we do it the disgusting crufty way forced on us by the ()-less\n * definition of BEGIN.\n */\n#define BEGIN yyg->yy_start = 1 + 2 *\n/* Translate the current start state into a value that can be later handed\n * to BEGIN to return to the state.  The YYSTATE alias is for lex\n * compatibility.\n */\n#define YY_START ((yyg->yy_start - 1) / 2)\n#define YYSTATE YY_START\n/* Action number for EOF rule of a given start state. */\n#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)\n/* Special action meaning \"start processing a new file\". */\n#define YY_NEW_FILE yyrestart( yyin , yyscanner )\n#define YY_END_OF_BUFFER_CHAR 0\n\n/* Size of default input buffer. */\n#ifndef YY_BUF_SIZE\n#ifdef __ia64__\n/* On IA-64, the buffer size is 16k, not 8k.\n * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.\n * Ditto for the __ia64__ case accordingly.\n */\n#define YY_BUF_SIZE 32768\n#else\n#define YY_BUF_SIZE 16384\n#endif /* __ia64__ */\n#endif\n\n/* The state buf must be large enough to hold one state per character in the main buffer.\n */\n#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))\n\n#ifndef YY_TYPEDEF_YY_BUFFER_STATE\n#define YY_TYPEDEF_YY_BUFFER_STATE\ntypedef struct yy_buffer_state *YY_BUFFER_STATE;\n#endif\n\n#ifndef YY_TYPEDEF_YY_SIZE_T\n#define YY_TYPEDEF_YY_SIZE_T\ntypedef size_t yy_size_t;\n#endif\n\n#define EOB_ACT_CONTINUE_SCAN 0\n#define EOB_ACT_END_OF_FILE 1\n#define EOB_ACT_LAST_MATCH 2\n    \n#define YY_LESS_LINENO(n)\n#define YY_LINENO_REWIND_TO(ptr)\n    \n/* Return all but the first \"n\" matched characters back to the input stream. */\n#define yyless(n) \\\n\tdo \\\n\t\t{ \\\n\t\t/* Undo effects of setting up yytext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\t*yy_cp = yyg->yy_hold_char; \\\n\t\tYY_RESTORE_YY_MORE_OFFSET \\\n\t\tyyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \\\n\t\tYY_DO_BEFORE_ACTION; /* set up yytext again */ \\\n\t\t} \\\n\twhile ( 0 )\n#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )\n\n#ifndef YY_STRUCT_YY_BUFFER_STATE\n#define YY_STRUCT_YY_BUFFER_STATE\nstruct yy_buffer_state\n\t{\n\tFILE *yy_input_file;\n\n\tchar *yy_ch_buf;\t\t/* input buffer */\n\tchar *yy_buf_pos;\t\t/* current position in input buffer */\n\n\t/* Size of input buffer in bytes, not including room for EOB\n\t * characters.\n\t */\n\tint yy_buf_size;\n\n\t/* Number of characters read into yy_ch_buf, not including EOB\n\t * characters.\n\t */\n\tint yy_n_chars;\n\n\t/* Whether we \"own\" the buffer - i.e., we know we created it,\n\t * and can realloc() it to grow it, and should free() it to\n\t * delete it.\n\t */\n\tint yy_is_our_buffer;\n\n\t/* Whether this is an \"interactive\" input source; if so, and\n\t * if we're using stdio for input, then we want to use getc()\n\t * instead of fread(), to make sure we stop fetching input after\n\t * each newline.\n\t */\n\tint yy_is_interactive;\n\n\t/* Whether we're considered to be at the beginning of a line.\n\t * If so, '^' rules will be active on the next match, otherwise\n\t * not.\n\t */\n\tint yy_at_bol;\n\n    int yy_bs_lineno; /**< The line count. */\n    int yy_bs_column; /**< The column count. */\n\n\t/* Whether to try to fill the input buffer when we reach the\n\t * end of it.\n\t */\n\tint yy_fill_buffer;\n\n\tint yy_buffer_status;\n\n#define YY_BUFFER_NEW 0\n#define YY_BUFFER_NORMAL 1\n\t/* When an EOF's been seen but there's still some text to process\n\t * then we mark the buffer as YY_EOF_PENDING, to indicate that we\n\t * shouldn't try reading from the input source any more.  We might\n\t * still have a bunch of tokens to match, though, because of\n\t * possible backing-up.\n\t *\n\t * When we actually see the EOF, we change the status to \"new\"\n\t * (via yyrestart()), so that the user can continue scanning by\n\t * just pointing yyin at a new input file.\n\t */\n#define YY_BUFFER_EOF_PENDING 2\n\n\t};\n#endif /* !YY_STRUCT_YY_BUFFER_STATE */\n\n/* We provide macros for accessing buffer states in case in the\n * future we want to put the buffer states in a more general\n * \"scanner state\".\n *\n * Returns the top of the stack, or NULL.\n */\n#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \\\n                          ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \\\n                          : NULL)\n/* Same as previous macro, but useful when we know that the buffer stack is not\n * NULL or when we need an lvalue. For internal use only.\n */\n#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]\n\nvoid yyrestart ( FILE *input_file , yyscan_t yyscanner );\nvoid yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );\nYY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );\nvoid yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );\nvoid yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );\nvoid yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );\nvoid yypop_buffer_state ( yyscan_t yyscanner );\n\nstatic void yyensure_buffer_stack ( yyscan_t yyscanner );\nstatic void yy_load_buffer_state ( yyscan_t yyscanner );\nstatic void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );\n#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)\n\nYY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );\nYY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );\nYY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );\n\nvoid *yyalloc ( yy_size_t , yyscan_t yyscanner );\nvoid *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );\nvoid yyfree ( void * , yyscan_t yyscanner );\n\n#define yy_new_buffer yy_create_buffer\n#define yy_set_interactive(is_interactive) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){ \\\n        yyensure_buffer_stack (yyscanner); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \\\n\t}\n#define yy_set_bol(at_bol) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){\\\n        yyensure_buffer_stack (yyscanner); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \\\n\t}\n#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)\n\n/* Begin user sect3 */\n\n#define wcsbthwrap(yyscanner) (/*CONSTCOND*/1)\n#define YY_SKIP_YYWRAP\ntypedef flex_uint8_t YY_CHAR;\n\ntypedef int yy_state_type;\n\n#define yytext_ptr yytext_r\n\nstatic const flex_int16_t yy_nxt[][128] =\n    {\n    {\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0\n    },\n\n    {\n       69,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70\n    },\n\n    {\n       69,   71,   71,   71,   71,   71,   71,   71,   71,   71,\n       70,   71,   71,   71,   71,   71,   71,   71,   71,   71,\n       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,\n       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,\n\n       71,   71,   71,   71,   71,   71,   71,   71,   71,   72,\n       72,   72,   72,   72,   72,   72,   72,   72,   71,   71,\n       71,   71,   71,   71,   71,   71,   73,   74,   75,   76,\n       71,   71,   77,   71,   78,   71,   79,   80,   71,   81,\n       82,   71,   83,   84,   85,   71,   86,   87,   88,   71,\n       89,   71,   71,   71,   71,   71,   71,   71,   71,   71,\n       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,\n       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,\n       71,   71,   71,   71,   71,   71,   71,   71\n    },\n\n    {\n       69,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n\n       70,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   91,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90\n    },\n\n    {\n       69,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       70,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   91,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90\n    },\n\n    {\n       69,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       70,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   94,\n\n       94,   94,   94,   94,   94,   94,   94,   94,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93\n    },\n\n    {\n       69,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       70,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   94,\n       94,   94,   94,   94,   94,   94,   94,   94,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n\n       93,   93,   93,   93,   93,   93,   93,   93\n    },\n\n    {\n       69,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       70,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   96,\n       96,   96,   96,   96,   96,   96,   96,   96,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95\n    },\n\n    {\n       69,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       70,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   96,\n       96,   96,   96,   96,   96,   96,   96,   96,   95,   95,\n\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95\n    },\n\n    {\n       69,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       70,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   98,\n       98,   98,   98,   98,   98,   98,   98,   98,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97\n\n    },\n\n    {\n       69,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       70,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   98,\n       98,   98,   98,   98,   98,   98,   98,   98,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,\n       97,   97,   97,   97,   97,   97,   97,   97\n    },\n\n    {\n       69,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       70,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99\n    },\n\n    {\n       69,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       70,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n\n       99,   99,   99,   99,   99,   99,   99,   99,   99,  100,\n      100,  100,  100,  100,  100,  100,  100,  100,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       99,   99,   99,   99,   99,   99,   99,   99\n    },\n\n    {\n       69,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n\n       70,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  102,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101\n    },\n\n    {\n       69,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n       70,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  102,  103,\n      103,  103,  103,  103,  103,  103,  103,  103,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101\n    },\n\n    {\n       69,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,  104,\n\n      104,  104,  104,  104,  104,  104,  104,  104,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70\n    },\n\n    {\n       69,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,  104,\n      104,  104,  104,  104,  104,  104,  104,  104,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,\n\n       70,   70,   70,   70,   70,   70,   70,   70\n    },\n\n    {\n       69,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n       70,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  106,\n      106,  106,  106,  106,  106,  106,  106,  106,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105\n    },\n\n    {\n       69,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n       70,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  106,\n      106,  106,  106,  106,  106,  106,  106,  106,  105,  105,\n\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n      105,  105,  105,  105,  105,  105,  105,  105\n    },\n\n    {\n       69,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n       70,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  108,\n      108,  108,  108,  108,  108,  108,  108,  108,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107\n\n    },\n\n    {\n       69,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n       70,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  108,\n      108,  108,  108,  108,  108,  108,  108,  108,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n      107,  107,  107,  107,  107,  107,  107,  107\n    },\n\n    {\n       69,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n       70,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n\n      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109\n    },\n\n    {\n       69,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n       70,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n\n      109,  109,  109,  109,  109,  109,  109,  109,  110,  110,\n      110,  110,  110,  110,  110,  110,  110,  110,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109\n    },\n\n    {\n       69,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n\n       70,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  112,\n      112,  112,  112,  112,  112,  112,  112,  112,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111\n    },\n\n    {\n       69,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n       70,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  112,\n      112,  112,  112,  112,  112,  112,  112,  112,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n      111,  111,  111,  111,  111,  111,  111,  111\n    },\n\n    {\n       69,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n       70,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  114,\n\n      114,  114,  114,  114,  114,  114,  114,  114,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113\n    },\n\n    {\n       69,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n       70,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  114,\n      114,  114,  114,  114,  114,  114,  114,  114,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n\n      113,  113,  113,  113,  113,  113,  113,  113\n    },\n\n    {\n       69,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n       70,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  116,  117,\n      117,  117,  117,  117,  117,  117,  117,  117,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115\n    },\n\n    {\n       69,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n       70,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  116,  117,\n      117,  117,  117,  117,  117,  117,  117,  117,  115,  115,\n\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115\n    },\n\n    {\n       69,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n       70,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  119,\n      119,  119,  119,  119,  119,  119,  119,  119,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118\n\n    },\n\n    {\n       69,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n       70,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  119,\n      119,  119,  119,  119,  119,  119,  119,  119,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n      118,  118,  118,  118,  118,  118,  118,  118\n    },\n\n    {\n       69,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n       70,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  121,\n      121,  121,  121,  121,  121,  121,  121,  121,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120\n    },\n\n    {\n       69,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n       70,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  121,\n      121,  121,  121,  121,  121,  121,  121,  121,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120\n    },\n\n    {\n       69,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n\n       70,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  123,\n      123,  123,  123,  123,  123,  123,  123,  123,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122\n    },\n\n    {\n       69,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n       70,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  123,\n      123,  123,  123,  123,  123,  123,  123,  123,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122\n    },\n\n    {\n       69,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n       70,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  125,\n\n      125,  125,  125,  125,  125,  125,  125,  125,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124\n    },\n\n    {\n       69,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n       70,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,\n\n      124,  124,  124,  124,  124,  124,  124,  124\n    },\n\n    {\n       69,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n       70,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  127,  127,\n      127,  127,  127,  127,  127,  127,  127,  127,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126\n    },\n\n    {\n       69,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n       70,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  127,  127,\n      127,  127,  127,  127,  127,  127,  127,  127,  126,  126,\n\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126\n    },\n\n    {\n       69,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n       70,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128\n\n    },\n\n    {\n       69,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n       70,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      128,  128,  128,  128,  128,  128,  128,  128\n    },\n\n    {\n       69,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n       70,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n      129,  129,  130,  129,  129,  129,  129,  129,  129,  129,\n      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n      129,  129,  129,  129,  129,  130,  130,  130,  130,  130,\n\n      130,  130,  130,  130,  130,  130,  130,  130,  130,  130,\n      130,  130,  130,  130,  130,  130,  130,  130,  130,  130,\n      130,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n      129,  129,  129,  129,  129,  129,  129,  129\n    },\n\n    {\n       69,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n       70,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n      129,  129,  130,  129,  129,  129,  129,  129,  129,  129,\n\n      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n      129,  129,  129,  129,  129,  130,  130,  130,  130,  130,\n      130,  130,  130,  130,  130,  130,  130,  130,  130,  130,\n      130,  130,  130,  130,  130,  130,  130,  130,  130,  130,\n      130,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n      129,  129,  129,  129,  129,  129,  129,  129\n    },\n\n    {\n       69,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n\n       70,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  132,\n      132,  132,  132,  132,  132,  132,  132,  132,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131\n    },\n\n    {\n       69,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n       70,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  132,\n      132,  132,  132,  132,  132,  132,  132,  132,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131\n    },\n\n    {\n       69,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n       70,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  134,\n\n      134,  134,  134,  134,  134,  134,  134,  134,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133\n    },\n\n    {\n       69,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n       70,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  134,\n      134,  134,  134,  134,  134,  134,  134,  134,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n      133,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n\n      133,  133,  133,  133,  133,  133,  133,  133\n    },\n\n    {\n       69,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n       70,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  136,\n      136,  136,  136,  136,  136,  136,  136,  136,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135\n    },\n\n    {\n       69,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n       70,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  136,\n      136,  136,  136,  136,  136,  136,  136,  136,  135,  135,\n\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135\n    },\n\n    {\n       69,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n       70,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  138,\n      138,  138,  138,  138,  138,  138,  138,  138,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137\n\n    },\n\n    {\n       69,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n       70,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  138,\n      138,  138,  138,  138,  138,  138,  138,  138,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,\n      137,  137,  137,  137,  137,  137,  137,  137\n    },\n\n    {\n       69,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n       70,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  140,  139,  139,  139,  139,  139,  139,  139,  139,\n\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139\n    },\n\n    {\n       69,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n       70,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  140,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,\n      139,  139,  139,  139,  139,  139,  139,  139\n    },\n\n    {\n       69,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n\n       70,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n      141,  141,  141,  142,  141,  142,  141,  141,  143,  143,\n      143,  143,  143,  143,  143,  143,  143,  143,  141,  141,\n      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n\n      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n      141,  141,  141,  141,  141,  141,  141,  141\n    },\n\n    {\n       69,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n       70,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n      141,  141,  141,  142,  141,  142,  141,  141,  143,  143,\n      143,  143,  143,  143,  143,  143,  143,  143,  141,  141,\n      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n\n      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,\n      141,  141,  141,  141,  141,  141,  141,  141\n    },\n\n    {\n       69,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n       70,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  145,  144,  145,  146,  144,  147,  147,\n\n      147,  147,  147,  147,  147,  147,  147,  147,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144\n    },\n\n    {\n       69,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n       70,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  145,  144,  145,  146,  144,  147,  147,\n      147,  147,  147,  147,  147,  147,  147,  147,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n\n      144,  144,  144,  144,  144,  144,  144,  144\n    },\n\n    {\n       69,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n       70,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      148,  148,  148,  149,  148,  149,  150,  148,  151,  151,\n      151,  151,  151,  151,  151,  151,  151,  151,  148,  148,\n      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n\n      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      148,  148,  148,  148,  148,  148,  148,  148\n    },\n\n    {\n       69,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n       70,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      148,  148,  148,  149,  148,  149,  150,  148,  151,  151,\n      151,  151,  151,  151,  151,  151,  151,  151,  148,  148,\n\n      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      148,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      148,  148,  148,  148,  148,  148,  148,  148\n    },\n\n    {\n       69,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n       70,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  153,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152\n\n    },\n\n    {\n       69,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n       70,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  153,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152\n    },\n\n    {\n       69,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      155,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  156,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  157,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n\n      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154\n    },\n\n    {\n       69,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      155,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  156,  154,  154,  154,  154,  154,  154,  154,\n\n      154,  154,  154,  154,  154,  154,  154,  157,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154\n    },\n\n    {\n       69,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n\n      159,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158\n    },\n\n    {\n       69,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      159,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158,  158,  158,\n      158,  158,  158,  158,  158,  158,  158,  158\n    },\n\n    {\n       69,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      161,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160\n    },\n\n    {\n       69,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      161,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,\n\n      160,  160,  160,  160,  160,  160,  160,  160\n    },\n\n    {\n       69,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      163,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162\n    },\n\n    {\n       69,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      163,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162,  162,  162,\n      162,  162,  162,  162,  162,  162,  162,  162\n    },\n\n    {\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69\n\n    },\n\n    {\n       69,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70\n    },\n\n    {\n       69,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71\n    },\n\n    {\n       69,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  164,  164,\n      164,  164,  164,  164,  164,  164,  164,  164,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  165,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      166,  -72,  -72,  167,  -72,  -72,  168,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72\n    },\n\n    {\n       69,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  169,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73\n    },\n\n    {\n       69,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  170,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  171,  -74,\n\n      172,  -74,  173,  174,  175,  176,  -74,  -74,  -74,  -74,\n      177,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74\n    },\n\n    {\n       69,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  178,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  179,\n      -75,  -75,  -75,  180,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75\n    },\n\n    {\n       69,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  181,  -76,\n      182,  183,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76\n    },\n\n    {\n       69,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  184,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77\n    },\n\n    {\n       69,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  185,  186,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78\n    },\n\n    {\n       69,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  187,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  188,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79\n\n    },\n\n    {\n       69,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  189,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80\n    },\n\n    {\n       69,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  190,  -81,  -81,  -81,\n\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81\n    },\n\n    {\n       69,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  191,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  192,  -82,  -82,  -82,\n      -82,  -82,  193,  194,  -82,  -82,  195,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82\n    },\n\n    {\n       69,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  196,  -83,  -83,  -83,  197,\n      198,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  199,  -83,  -83,  -83,  200,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83\n    },\n\n    {\n       69,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  201,\n\n      202,  -84,  -84,  203,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84\n    },\n\n    {\n       69,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  204,  -85,  205,\n      206,  -85,  -85,  207,  -85,  -85,  -85,  -85,  -85,  -85,\n      208,  -85,  209,  210,  -85,  -85,  211,  212,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85\n    },\n\n    {\n       69,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  213,  -86,  -86,  -86,  214,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  215,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86\n    },\n\n    {\n       69,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  216,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87\n    },\n\n    {\n       69,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      217,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88\n    },\n\n    {\n       69,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  218,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89\n\n    },\n\n    {\n       69,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90\n    },\n\n    {\n       69,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  219,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  220,  221,\n      221,  221,  221,  221,  221,  221,  221,  221,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  219,  219,  219,  219,  219,\n\n      219,  219,  219,  219,  219,  219,  219,  219,  219,  219,\n      219,  219,  219,  219,  219,  219,  219,  219,  219,  219,\n      219,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91\n    },\n\n    {\n       69,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  222,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  223,  223,\n      223,  223,  223,  223,  223,  223,  223,  223,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  222,  222,  222,  222,  222,\n      222,  222,  222,  222,  222,  222,  222,  222,  222,  222,\n      222,  222,  222,  222,  222,  222,  222,  222,  222,  222,\n      222,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92\n    },\n\n    {\n       69,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93\n    },\n\n    {\n       69,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  224,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  225,  225,\n      225,  225,  225,  225,  225,  225,  225,  225,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  224,  224,  224,  224,  224,\n      224,  224,  224,  224,  224,  224,  224,  224,  224,  224,\n\n      224,  224,  224,  224,  224,  224,  224,  224,  224,  224,\n      224,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94\n    },\n\n    {\n       69,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95\n    },\n\n    {\n       69,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  226,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  227,  227,\n      227,  227,  227,  227,  227,  227,  227,  227,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  228,  228,  228,  228,  228,\n      228,  228,  228,  228,  228,  228,  228,  228,  228,  228,\n      228,  228,  228,  228,  228,  228,  228,  228,  228,  228,\n      228,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96\n    },\n\n    {\n       69,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97\n    },\n\n    {\n       69,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  229,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  230,  230,\n      230,  230,  230,  230,  230,  230,  230,  230,  -98,  -98,\n\n      -98,  -98,  -98,  -98,  -98,  229,  229,  229,  229,  229,\n      229,  229,  229,  229,  229,  229,  229,  229,  229,  229,\n      229,  229,  229,  229,  229,  229,  229,  229,  229,  229,\n      229,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98\n    },\n\n    {\n       69,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99\n\n    },\n\n    {\n       69, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100,  231, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100,  232,  232,\n      232,  232,  232,  232,  232,  232,  232,  232, -100, -100,\n     -100, -100, -100, -100, -100,  233,  233,  233,  233,  233,\n      233,  233,  233,  233,  233,  233,  233,  233,  233,  233,\n      233,  233,  233,  233,  233,  233,  233,  233,  233,  233,\n      233, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100\n    },\n\n    {\n       69, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101\n    },\n\n    {\n       69, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n\n     -102, -102, -102, -102, -102,  234, -102, -102,  235,  236,\n      236,  236,  236,  236,  236,  236,  236,  236, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102,  237, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102\n    },\n\n    {\n       69, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103,  234, -103, -103,  238,  238,\n      238,  238,  238,  238,  238,  238,  238,  238, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103,  239, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103\n    },\n\n    {\n       69, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104,  240, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104,  241,  241,\n      241,  241,  241,  241,  241,  241,  241,  241, -104, -104,\n     -104, -104, -104, -104, -104,  240,  240,  240,  240,  240,\n      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,\n\n      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,\n      240, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104\n    },\n\n    {\n       69, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105\n    },\n\n    {\n       69, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106,  242,  242,\n      242,  242,  242,  242,  242,  242,  242,  242, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106,  243, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n\n     -106, -106, -106, -106, -106, -106, -106, -106\n    },\n\n    {\n       69, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107\n    },\n\n    {\n       69, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108,  244,  244,\n      244,  244,  244,  244,  244,  244,  244,  244, -108, -108,\n\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108,  245, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108\n    },\n\n    {\n       69, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109\n\n    },\n\n    {\n       69, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110,  246, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110,  247,  247,\n      247,  247,  247,  247,  247,  247,  247,  247, -110, -110,\n     -110, -110, -110, -110, -110,  246,  246,  246,  246,  246,\n      246,  246,  246,  246,  246,  246,  246,  246,  246,  246,\n      246,  246,  246,  246,  246,  246,  246,  246,  246,  246,\n      246, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110\n    },\n\n    {\n       69, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111\n    },\n\n    {\n       69, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112,  248, -112, -112, -112, -112, -112, -112, -112,\n\n     -112, -112, -112, -112, -112, -112, -112, -112,  249,  249,\n      249,  249,  249,  249,  249,  249,  249,  249, -112, -112,\n     -112, -112, -112, -112, -112,  250,  250,  250,  250,  250,\n      250,  250,  250,  250,  250,  250,  250,  250,  250,  250,\n      250,  250,  250,  250,  250,  250,  250,  250,  250,  250,\n      250, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112\n    },\n\n    {\n       69, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113\n    },\n\n    {\n       69, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114,  251, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114,  252,  252,\n      252,  252,  252,  252,  252,  252,  252,  252, -114, -114,\n     -114, -114, -114, -114, -114,  253,  253,  253,  253,  253,\n      253,  253,  253,  253,  253,  253,  253,  253,  253,  253,\n\n      253,  253,  253,  253,  253,  253,  253,  253,  253,  253,\n      253, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114\n    },\n\n    {\n       69, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115\n    },\n\n    {\n       69, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116,  254, -116, -116,  255,  256,\n      256,  256,  256,  256,  256,  256,  256,  256, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116,  257, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n\n     -116, -116, -116, -116, -116, -116, -116, -116\n    },\n\n    {\n       69, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117,  254, -117, -117,  258,  258,\n      258,  258,  258,  258,  258,  258,  258,  258, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n\n     -117, -117, -117, -117, -117,  259, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117\n    },\n\n    {\n       69, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118\n    },\n\n    {\n       69, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119,  260,  260,\n      260,  260,  260,  260,  260,  260,  260,  260, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119,  261, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119\n\n    },\n\n    {\n       69, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120\n    },\n\n    {\n       69, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121,  262,  262,\n      262,  262,  262,  262,  262,  262,  262,  262, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121,  263, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121\n    },\n\n    {\n       69, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122\n    },\n\n    {\n       69, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123,  264,  264,\n      264,  264,  264,  264,  264,  264,  264,  264, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123,  265, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123\n    },\n\n    {\n       69, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124\n    },\n\n    {\n       69, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125,  266,  266,\n\n      266,  266,  266,  266,  266,  266,  266,  266, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125,  267, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,\n     -125, -125, -125, -125, -125, -125, -125, -125\n    },\n\n    {\n       69, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n\n     -126, -126, -126, -126, -126, -126, -126, -126\n    },\n\n    {\n       69, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127,  268, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127,  269,  269,\n      269,  269,  269,  269,  269,  269,  269,  269, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127\n    },\n\n    {\n       69, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128\n    },\n\n    {\n       69, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129\n\n    },\n\n    {\n       69, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130\n    },\n\n    {\n       69, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131\n    },\n\n    {\n       69, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132,  270, -132, -132, -132, -132, -132, -132, -132,\n\n     -132, -132, -132, -132, -132, -132, -132, -132,  271,  271,\n      271,  271,  271,  271,  271,  271,  271,  271, -132, -132,\n     -132, -132, -132, -132, -132,  270,  270,  270,  270,  270,\n      270,  270,  270,  270,  270,  270,  270,  270,  270,  270,\n      270,  270,  270,  270,  270,  270,  270,  270,  270,  270,\n      270, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132\n    },\n\n    {\n       69, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133\n    },\n\n    {\n       69, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134,  272, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134,  273,  273,\n      273,  273,  273,  273,  273,  273,  273,  273, -134, -134,\n     -134, -134, -134, -134, -134,  272,  272,  272,  272,  272,\n      272,  272,  272,  272,  272,  272,  272,  272,  272,  272,\n\n      272,  272,  272,  272,  272,  272,  272,  272,  272,  272,\n      272, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134\n    },\n\n    {\n       69, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135\n    },\n\n    {\n       69, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136,  274, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136,  275,  275,\n      275,  275,  275,  275,  275,  275,  275,  275, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n\n     -136, -136, -136, -136, -136, -136, -136, -136\n    },\n\n    {\n       69, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137\n    },\n\n    {\n       69, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138,  276, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138,  277,  277,\n      277,  277,  277,  277,  277,  277,  277,  277, -138, -138,\n\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138\n    },\n\n    {\n       69, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139\n\n    },\n\n    {\n       69, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140,  278, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140\n    },\n\n    {\n       69, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141\n    },\n\n    {\n       69, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n\n     -142, -142, -142, -142, -142, -142, -142, -142,  279,  279,\n      279,  279,  279,  279,  279,  279,  279,  279, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142\n    },\n\n    {\n       69, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143,  279,  279,\n      279,  279,  279,  279,  279,  279,  279,  279, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143\n    },\n\n    {\n       69, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144\n    },\n\n    {\n       69, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145,  280, -145,  281,  281,\n\n      281,  281,  281,  281,  281,  281,  281,  281, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145\n    },\n\n    {\n       69, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146,  282,  282,\n      282,  282,  282,  282,  282,  282,  282,  282, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n\n     -146, -146, -146, -146, -146, -146, -146, -146\n    },\n\n    {\n       69, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147,  283, -147,  284,  284,\n      284,  284,  284,  284,  284,  284,  284,  284, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147,  285,  285,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n      285,  285, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147\n    },\n\n    {\n       69, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148\n    },\n\n    {\n       69, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149,  286, -149,  287,  287,\n      287,  287,  287,  287,  287,  287,  287,  287, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149\n\n    },\n\n    {\n       69, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150,  288,  288,\n      288,  288,  288,  288,  288,  288,  288,  288, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150\n    },\n\n    {\n       69, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151,  289, -151,  290,  290,\n      290,  290,  290,  290,  290,  290,  290,  290, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151,  291,  291,\n\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n      291,  291, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151\n    },\n\n    {\n       69, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152\n    },\n\n    {\n       69,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  293,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292\n    },\n\n    {\n       69,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      295,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  296,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  297,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n\n      294,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  294\n    },\n\n    {\n       69, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155\n    },\n\n    {\n       69,  298,  298,  298,  298,  298,  298,  298,  298,  298,\n      299,  298,  298,  298,  298,  298,  298,  298,  298,  298,\n\n      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,\n      298,  298,  300,  298,  298,  298,  298,  298,  298,  298,\n      298,  298,  298,  298,  298,  298,  298,  301,  298,  298,\n      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,\n      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,\n      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,\n      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,\n      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,\n      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,\n      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,\n\n      298,  298,  298,  298,  298,  298,  298,  298\n    },\n\n    {\n       69,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      303,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  304,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  305,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302\n    },\n\n    {\n       69,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      307,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306\n    },\n\n    {\n       69, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159\n\n    },\n\n    {\n       69,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      309,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308\n    },\n\n    {\n       69, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161\n    },\n\n    {\n       69,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      311,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310\n    },\n\n    {\n       69, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163\n    },\n\n    {\n       69, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164,  312, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n\n      313, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164\n    },\n\n    {\n       69, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165,  314, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165,  315, -165,\n      316, -165,  317,  318,  319,  320, -165, -165, -165, -165,\n      321, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165\n    },\n\n    {\n       69, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166,  322, -166, -166,  323, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n\n     -166, -166, -166, -166, -166, -166, -166, -166\n    },\n\n    {\n       69, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167\n    },\n\n    {\n       69, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168\n    },\n\n    {\n       69, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n      324, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169\n\n    },\n\n    {\n       69, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170,  325,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170\n    },\n\n    {\n       69, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171,  326, -171, -171, -171, -171,\n\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171\n    },\n\n    {\n       69, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172,  327,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172\n    },\n\n    {\n       69, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173,  328, -173,\n     -173, -173, -173, -173, -173, -173,  329, -173, -173,  330,\n      331, -173, -173, -173, -173, -173,  332, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173\n    },\n\n    {\n       69, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n\n     -174, -174, -174, -174, -174, -174, -174, -174, -174,  333,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174\n    },\n\n    {\n       69, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175,  334,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175\n    },\n\n    {\n       69, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176,  335, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n\n     -176, -176, -176, -176, -176, -176, -176, -176\n    },\n\n    {\n       69, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n      336, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177\n    },\n\n    {\n       69, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178,  337, -178,  338, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178\n    },\n\n    {\n       69, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179,  339, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179\n\n    },\n\n    {\n       69, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180,  340, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180\n    },\n\n    {\n       69, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181,  341, -181,\n\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181\n    },\n\n    {\n       69, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182,  342,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182\n    },\n\n    {\n       69, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183,  343, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183\n    },\n\n    {\n       69, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184,  344, -184, -184, -184,\n\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184\n    },\n\n    {\n       69, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185,  345, -185, -185, -185, -185,\n\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185,  346, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185\n    },\n\n    {\n       69, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n      347, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n\n     -186, -186, -186, -186, -186, -186, -186, -186\n    },\n\n    {\n       69, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187,  348, -187, -187, -187, -187, -187,\n\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187\n    },\n\n    {\n       69, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188,  349, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,\n     -188, -188, -188, -188, -188, -188, -188, -188\n    },\n\n    {\n       69, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189,  350, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189\n\n    },\n\n    {\n       69, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190,  351, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190\n    },\n\n    {\n       69, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191\n    },\n\n    {\n       69, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192,  352,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192\n    },\n\n    {\n       69, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193,  353,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193\n    },\n\n    {\n       69, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194\n    },\n\n    {\n       69, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195\n    },\n\n    {\n       69, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196,  354, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n\n     -196, -196, -196, -196, -196, -196, -196, -196\n    },\n\n    {\n       69, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197,  355, -197, -197, -197, -197, -197, -197,\n\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197\n    },\n\n    {\n       69, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198,  356, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198\n    },\n\n    {\n       69, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199,  357, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199\n\n    },\n\n    {\n       69, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200,  358, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200\n    },\n\n    {\n       69, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201,  359, -201, -201, -201,\n\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201\n    },\n\n    {\n       69, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202,  360,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202\n    },\n\n    {\n       69, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203,  361, -203, -203, -203, -203, -203, -203,  362,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203\n    },\n\n    {\n       69, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204,  363, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204,  364, -204,\n\n      365, -204,  366,  367,  368,  369, -204, -204, -204, -204,\n      370, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204\n    },\n\n    {\n       69, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205,  371, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205\n    },\n\n    {\n       69, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206,  372, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n\n     -206, -206, -206, -206, -206, -206, -206, -206\n    },\n\n    {\n       69, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207,  373, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207\n    },\n\n    {\n       69, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n\n     -208, -208, -208, -208, -208, -208, -208,  374, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208,  375, -208, -208,  376, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208\n    },\n\n    {\n       69, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209,  377,  378,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n      379, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209\n\n    },\n\n    {\n       69, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210,  380, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210\n    },\n\n    {\n       69, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211\n    },\n\n    {\n       69, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212,  381, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212\n    },\n\n    {\n       69, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213,  382, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213\n    },\n\n    {\n       69, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214,  383, -214, -214, -214,\n\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214\n    },\n\n    {\n       69, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215,  384,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215,  385,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215\n    },\n\n    {\n       69, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216,  386, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216,  387, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n\n     -216, -216, -216, -216, -216, -216, -216, -216\n    },\n\n    {\n       69, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217,  388,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217\n    },\n\n    {\n       69, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218,  389,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218\n    },\n\n    {\n       69, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n\n     -219, -219,  390, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219\n\n    },\n\n    {\n       69, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220,  391, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220,  392,  393,\n      393,  393,  393,  393,  393,  393,  393,  393, -220, -220,\n     -220, -220, -220, -220, -220,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391,  391,  391,  391,  391,  391,  391,  391,  391,  391,\n      391, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220\n    },\n\n    {\n       69, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221,  394, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392, -221, -221,\n     -221, -221, -221, -221, -221,  394,  394,  394,  394,  394,\n\n      394,  394,  394,  394,  394,  394,  394,  394,  394,  394,\n      394,  394,  394,  394,  394,  394,  394,  394,  394,  394,\n      394, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221\n    },\n\n    {\n       69, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222,  395, -222, -222, -222, -222, -222, -222, -222,\n\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222\n    },\n\n    {\n       69, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223,  396, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223,  392,  392,\n      392,  392,  392,  392,  392,  392,  392,  392, -223, -223,\n     -223, -223, -223, -223, -223,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396,  396,  396,\n      396, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223\n    },\n\n    {\n       69, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224,  397, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224\n    },\n\n    {\n       69, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225,  398, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225,  399,  399,\n\n      399,  399,  399,  399,  399,  399,  399,  399, -225, -225,\n     -225, -225, -225, -225, -225,  398,  398,  398,  398,  398,\n      398,  398,  398,  398,  398,  398,  398,  398,  398,  398,\n      398,  398,  398,  398,  398,  398,  398,  398,  398,  398,\n      398, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225\n    },\n\n    {\n       69, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226,  400, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n\n     -226, -226, -226, -226, -226, -226, -226, -226\n    },\n\n    {\n       69, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227,  401, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227,  402,  402,\n      402,  402,  402,  402,  402,  402,  402,  402, -227, -227,\n     -227, -227, -227, -227, -227,  403,  403,  403,  403,  403,\n      403,  403,  403,  403,  403,  403,  403,  403,  403,  403,\n      403,  403,  403,  403,  403,  403,  403,  403,  403,  403,\n\n      403, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227\n    },\n\n    {\n       69, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228,  404, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228\n    },\n\n    {\n       69, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n\n     -229, -229,  405, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229\n\n    },\n\n    {\n       69, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230,  406, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230,  407,  407,\n      407,  407,  407,  407,  407,  407,  407,  407, -230, -230,\n     -230, -230, -230, -230, -230,  406,  406,  406,  406,  406,\n      406,  406,  406,  406,  406,  406,  406,  406,  406,  406,\n      406,  406,  406,  406,  406,  406,  406,  406,  406,  406,\n      406, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230\n    },\n\n    {\n       69, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231,  408, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231\n    },\n\n    {\n       69, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232,  409, -232, -232, -232, -232, -232, -232, -232,\n\n     -232, -232, -232, -232, -232, -232, -232, -232,  410,  410,\n      410,  410,  410,  410,  410,  410,  410,  410, -232, -232,\n     -232, -232, -232, -232, -232,  411,  411,  411,  411,  411,\n      411,  411,  411,  411,  411,  411,  411,  411,  411,  411,\n      411,  411,  411,  411,  411,  411,  411,  411,  411,  411,\n      411, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232\n    },\n\n    {\n       69, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233,  412, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233\n    },\n\n    {\n       69, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234,  413,  413,\n      413,  413,  413,  413,  413,  413,  413,  413, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234\n    },\n\n    {\n       69, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235,  414, -235, -235,  415,  416,\n\n      416,  416,  416,  416,  416,  416,  416,  416, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235,  417, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235\n    },\n\n    {\n       69, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236,  414, -236, -236,  418,  418,\n      418,  418,  418,  418,  418,  418,  418,  418, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236,  419, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n\n     -236, -236, -236, -236, -236, -236, -236, -236\n    },\n\n    {\n       69, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237,  420,  420,\n      420,  420,  420,  420,  420,  420,  420,  420, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237\n    },\n\n    {\n       69, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238,  414, -238, -238,  421,  421,\n      421,  421,  421,  421,  421,  421,  421,  421, -238, -238,\n\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238,  422, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238\n    },\n\n    {\n       69, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239,  423,  424,\n      424,  424,  424,  424,  424,  424,  424,  424, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239\n\n    },\n\n    {\n       69, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240,  425, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240\n    },\n\n    {\n       69, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241,  426, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241,  427,  427,\n      427,  427,  427,  427,  427,  427,  427,  427, -241, -241,\n     -241, -241, -241, -241, -241,  426,  426,  426,  426,  426,\n\n      426,  426,  426,  426,  426,  426,  426,  426,  426,  426,\n      426,  426,  426,  426,  426,  426,  426,  426,  426,  426,\n      426, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241\n    },\n\n    {\n       69, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n\n     -242, -242, -242, -242, -242, -242, -242, -242,  428,  428,\n      428,  428,  428,  428,  428,  428,  428,  428, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242,  429, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242\n    },\n\n    {\n       69, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243,  430,\n      430,  430,  430,  430,  430,  430,  430,  430, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243\n    },\n\n    {\n       69, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244,  431,  431,\n      431,  431,  431,  431,  431,  431,  431,  431, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244,  432, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244\n    },\n\n    {\n       69, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245,  433,\n\n      433,  433,  433,  433,  433,  433,  433,  433, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245, -245, -245,\n     -245, -245, -245, -245, -245, -245, -245, -245\n    },\n\n    {\n       69, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246,  434, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n\n     -246, -246, -246, -246, -246, -246, -246, -246\n    },\n\n    {\n       69, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247,  435, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247,  436,  436,\n      436,  436,  436,  436,  436,  436,  436,  436, -247, -247,\n     -247, -247, -247, -247, -247,  435,  435,  435,  435,  435,\n      435,  435,  435,  435,  435,  435,  435,  435,  435,  435,\n      435,  435,  435,  435,  435,  435,  435,  435,  435,  435,\n\n      435, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247\n    },\n\n    {\n       69, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248,  437, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248\n    },\n\n    {\n       69, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n\n     -249, -249,  438, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249,  439,  439,\n      439,  439,  439,  439,  439,  439,  439,  439, -249, -249,\n     -249, -249, -249, -249, -249,  440,  440,  440,  440,  440,\n      440,  440,  440,  440,  440,  440,  440,  440,  440,  440,\n      440,  440,  440,  440,  440,  440,  440,  440,  440,  440,\n      440, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249\n\n    },\n\n    {\n       69, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250,  441, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250\n    },\n\n    {\n       69, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251,  442, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251\n    },\n\n    {\n       69, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252,  443, -252, -252, -252, -252, -252, -252, -252,\n\n     -252, -252, -252, -252, -252, -252, -252, -252,  444,  444,\n      444,  444,  444,  444,  444,  444,  444,  444, -252, -252,\n     -252, -252, -252, -252, -252,  445,  445,  445,  445,  445,\n      445,  445,  445,  445,  445,  445,  445,  445,  445,  445,\n      445,  445,  445,  445,  445,  445,  445,  445,  445,  445,\n      445, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252\n    },\n\n    {\n       69, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253,  446, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253\n    },\n\n    {\n       69, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254,  447,  447,\n      447,  447,  447,  447,  447,  447,  447,  447, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254\n    },\n\n    {\n       69, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255,  448, -255, -255,  449,  450,\n\n      450,  450,  450,  450,  450,  450,  450,  450, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255,  451, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255\n    },\n\n    {\n       69, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256,  448, -256, -256,  452,  452,\n      452,  452,  452,  452,  452,  452,  452,  452, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256,  453, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n\n     -256, -256, -256, -256, -256, -256, -256, -256\n    },\n\n    {\n       69, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257,  454,  454,\n      454,  454,  454,  454,  454,  454,  454,  454, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257\n    },\n\n    {\n       69, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258,  448, -258, -258,  455,  455,\n      455,  455,  455,  455,  455,  455,  455,  455, -258, -258,\n\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258,  456, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258\n    },\n\n    {\n       69, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259,  457,  458,\n      458,  458,  458,  458,  458,  458,  458,  458, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259\n\n    },\n\n    {\n       69, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260,  459,  459,\n      459,  459,  459,  459,  459,  459,  459,  459, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260,  460, -260, -260, -260, -260,\n\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260\n    },\n\n    {\n       69, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261,  461,  462,\n      462,  462,  462,  462,  462,  462,  462,  462, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261\n    },\n\n    {\n       69, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n\n     -262, -262, -262, -262, -262, -262, -262, -262,  463,  463,\n      463,  463,  463,  463,  463,  463,  463,  463, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262,  464, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262\n    },\n\n    {\n       69, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263,  465,  466,\n      466,  466,  466,  466,  466,  466,  466,  466, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263\n    },\n\n    {\n       69, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264,  467,  467,\n      467,  467,  467,  467,  467,  467,  467,  467, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264,  468, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264\n    },\n\n    {\n       69, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265,  469,  470,\n\n      470,  470,  470,  470,  470,  470,  470,  470, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265\n    },\n\n    {\n       69, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266,  471,  471,\n      471,  471,  471,  471,  471,  471,  471,  471, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266,  472, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n\n     -266, -266, -266, -266, -266, -266, -266, -266\n    },\n\n    {\n       69, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267,  473,  474,\n      474,  474,  474,  474,  474,  474,  474,  474, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267\n    },\n\n    {\n       69, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268,  475, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268\n    },\n\n    {\n       69, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n\n     -269, -269,  476, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269,  477,  477,\n      477,  477,  477,  477,  477,  477,  477,  477, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269\n\n    },\n\n    {\n       69, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270,  478, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270\n    },\n\n    {\n       69, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271,  479, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271,  480,  480,\n      480,  480,  480,  480,  480,  480,  480,  480, -271, -271,\n     -271, -271, -271, -271, -271,  479,  479,  479,  479,  479,\n\n      479,  479,  479,  479,  479,  479,  479,  479,  479,  479,\n      479,  479,  479,  479,  479,  479,  479,  479,  479,  479,\n      479, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271\n    },\n\n    {\n       69, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272,  481, -272, -272, -272, -272, -272, -272, -272,\n\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272\n    },\n\n    {\n       69, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273,  482, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273,  483,  483,\n      483,  483,  483,  483,  483,  483,  483,  483, -273, -273,\n     -273, -273, -273, -273, -273,  482,  482,  482,  482,  482,\n      482,  482,  482,  482,  482,  482,  482,  482,  482,  482,\n      482,  482,  482,  482,  482,  482,  482,  482,  482,  482,\n      482, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273\n    },\n\n    {\n       69, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274,  484, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274\n    },\n\n    {\n       69, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275,  485, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275,  486,  486,\n\n      486,  486,  486,  486,  486,  486,  486,  486, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275\n    },\n\n    {\n       69, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276,  487, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n\n     -276, -276, -276, -276, -276, -276, -276, -276\n    },\n\n    {\n       69, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277,  488, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277,  489,  489,\n      489,  489,  489,  489,  489,  489,  489,  489, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277\n    },\n\n    {\n       69, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278,  278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278\n    },\n\n    {\n       69, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279,  279,  279,\n      279,  279,  279,  279,  279,  279,  279,  279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279\n\n    },\n\n    {\n       69, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280,  282,  282,\n      282,  282,  282,  282,  282,  282,  282,  282, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280\n    },\n\n    {\n       69, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281,  283, -281,  284,  284,\n      284,  284,  284,  284,  284,  284,  284,  284, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281,  285,  285,\n\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n      285,  285, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281\n    },\n\n    {\n       69, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n\n     -282, -282, -282, -282, -282, -282, -282, -282,  282,  282,\n      282,  282,  282,  282,  282,  282,  282,  282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282,  285,  285,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n      285,  285, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282\n    },\n\n    {\n       69, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283,  490,  490,\n      490,  490,  490,  490,  490,  490,  490,  490, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283,  285,  285,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n      285,  285, -283, -283, -283, -283, -283, -283, -283, -283,\n\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283\n    },\n\n    {\n       69, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284,  283, -284,  284,  284,\n      284,  284,  284,  284,  284,  284,  284,  284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284,  285,  285,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n      285,  285, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284\n    },\n\n    {\n       69, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285,  491, -285,  491, -285, -285,  492,  492,\n\n      492,  492,  492,  492,  492,  492,  492,  492, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285\n    },\n\n    {\n       69, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286,  288,  288,\n      288,  288,  288,  288,  288,  288,  288,  288, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n\n     -286, -286, -286, -286, -286, -286, -286, -286\n    },\n\n    {\n       69, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287,  289, -287,  290,  290,\n      290,  290,  290,  290,  290,  290,  290,  290, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287,  291,  291,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n      291,  291, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287\n    },\n\n    {\n       69, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288,  288,  288,\n      288,  288,  288,  288,  288,  288,  288,  288, -288, -288,\n\n     -288, -288, -288, -288, -288, -288, -288, -288,  291,  291,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n      291,  291, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288\n    },\n\n    {\n       69, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289,  493,  493,\n      493,  493,  493,  493,  493,  493,  493,  493, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289,  291,  291,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n      291,  291, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289\n\n    },\n\n    {\n       69, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290,  289, -290,  290,  290,\n      290,  290,  290,  290,  290,  290,  290,  290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290,  291,  291,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n\n      291,  291, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290\n    },\n\n    {\n       69, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291,  494, -291,  494, -291, -291,  495,  495,\n      495,  495,  495,  495,  495,  495,  495,  495, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291\n    },\n\n    {\n       69,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  293,\n\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292,  292,  292,\n      292,  292,  292,  292,  292,  292,  292,  292\n    },\n\n    {\n       69, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293,  292,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293\n    },\n\n    {\n       69,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      295,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  296,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  297,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n\n      294,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  294,  294,  294,\n      294,  294,  294,  294,  294,  294,  294,  294\n    },\n\n    {\n       69, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295\n    },\n\n    {\n       69,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      295,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  296,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  297,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n\n      496,  496,  496,  496,  496,  496,  496,  496\n    },\n\n    {\n       69,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      498,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  499,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  500,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497\n    },\n\n    {\n       69,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      502,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  503,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  504,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501\n    },\n\n    {\n       69, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299\n\n    },\n\n    {\n       69,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      506,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  507,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  508,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n\n      505,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  505\n    },\n\n    {\n       69,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      303,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  304,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  305,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302\n    },\n\n    {\n       69,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      303,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  304,  302,  302,  302,  302,  302,  302,  302,\n\n      302,  302,  302,  302,  302,  302,  302,  305,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302\n    },\n\n    {\n       69, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303\n    },\n\n    {\n       69,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      303,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  304,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  305,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302\n    },\n\n    {\n       69,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      303,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  304,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  305,  302,  302,\n\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302,  302,  302,\n      302,  302,  302,  302,  302,  302,  302,  302\n    },\n\n    {\n       69,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      307,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,\n\n      306,  306,  306,  306,  306,  306,  306,  306\n    },\n\n    {\n       69, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307\n    },\n\n    {\n       69,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      309,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308,  308,  308,\n      308,  308,  308,  308,  308,  308,  308,  308\n    },\n\n    {\n       69, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309\n\n    },\n\n    {\n       69,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      311,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,\n      310,  310,  310,  310,  310,  310,  310,  310\n    },\n\n    {\n       69, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311\n    },\n\n    {\n       69, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312,  509, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312\n    },\n\n    {\n       69, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313,  510, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313\n    },\n\n    {\n       69, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314,  511,\n     -314, -314, -314, -314, -314, -314,  512, -314, -314, -314,\n\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314\n    },\n\n    {\n       69, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315,  513, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315\n    },\n\n    {\n       69, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316,  514,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316,  515, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n\n     -316, -316, -316, -316, -316, -316, -316, -316\n    },\n\n    {\n       69, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317,  516, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317,  517,\n      518, -317, -317, -317, -317, -317,  519, -317, -317, -317,\n\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317\n    },\n\n    {\n       69, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318,  520,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318\n    },\n\n    {\n       69, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319,  521,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319\n\n    },\n\n    {\n       69, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320,  522, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320\n    },\n\n    {\n       69, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n      523, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321\n    },\n\n    {\n       69, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322\n    },\n\n    {\n       69, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323\n    },\n\n    {\n       69, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324,  524,\n\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324\n    },\n\n    {\n       69, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325,  525, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325\n    },\n\n    {\n       69, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326,  526, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n\n     -326, -326, -326, -326, -326, -326, -326, -326\n    },\n\n    {\n       69, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327,  527, -327, -327, -327, -327, -327, -327, -327,\n\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327\n    },\n\n    {\n       69, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n\n     -328, -328, -328, -328, -328, -328, -328, -328, -328,  528,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328\n    },\n\n    {\n       69, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329,  529, -329,\n     -329, -329, -329, -329,  530, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329\n\n    },\n\n    {\n       69, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330,  531, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330\n    },\n\n    {\n       69, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n\n     -331, -331, -331,  532, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331\n    },\n\n    {\n       69, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332,  533, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332\n    },\n\n    {\n       69, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333,  534,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333\n    },\n\n    {\n       69, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n\n      535, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334\n    },\n\n    {\n       69, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335,  536, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335\n    },\n\n    {\n       69, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336,  537, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n\n     -336, -336, -336, -336, -336, -336, -336, -336\n    },\n\n    {\n       69, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337,  538,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337\n    },\n\n    {\n       69, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338,  539, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338\n    },\n\n    {\n       69, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339,  540, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339\n\n    },\n\n    {\n       69, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340,  541, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340\n    },\n\n    {\n       69, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341,  542, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341\n    },\n\n    {\n       69, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342,  543, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342\n    },\n\n    {\n       69, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343,  544, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343\n    },\n\n    {\n       69, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344,  545, -344,\n\n     -344, -344, -344, -344,  546, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344\n    },\n\n    {\n       69, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345,  547, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345\n    },\n\n    {\n       69, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346,  548,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n\n     -346, -346, -346, -346, -346, -346, -346, -346\n    },\n\n    {\n       69, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347,  549,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347\n    },\n\n    {\n       69, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n      550, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348\n    },\n\n    {\n       69, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n      551, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349\n\n    },\n\n    {\n       69, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350,  552, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350,  553, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350,  554,\n     -350, -350,  555, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350\n    },\n\n    {\n       69, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n\n     -351,  556, -351, -351, -351, -351, -351, -351, -351,  557,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351\n    },\n\n    {\n       69, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n      558, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352\n    },\n\n    {\n       69, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353,  559, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353\n    },\n\n    {\n       69, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354,  560,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354\n    },\n\n    {\n       69, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355,  561, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355\n    },\n\n    {\n       69, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356,  562, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n\n     -356, -356, -356, -356, -356, -356, -356, -356\n    },\n\n    {\n       69, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357,  563, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357\n    },\n\n    {\n       69, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358,  564, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358\n    },\n\n    {\n       69, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359,  565, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359\n\n    },\n\n    {\n       69, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360,  566, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360\n    },\n\n    {\n       69, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361,  567, -361, -361,\n\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361\n    },\n\n    {\n       69, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362,  568, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362\n    },\n\n    {\n       69, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363,  569,\n     -363, -363, -363, -363, -363, -363,  570, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363\n    },\n\n    {\n       69, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364,  571, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364\n    },\n\n    {\n       69, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365,  572,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365,  573, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365\n    },\n\n    {\n       69, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366,  574, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366,  575,\n      576, -366, -366, -366, -366, -366,  577, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n\n     -366, -366, -366, -366, -366, -366, -366, -366\n    },\n\n    {\n       69, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367,  578,\n\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367\n    },\n\n    {\n       69, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368,  579,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368\n    },\n\n    {\n       69, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369,  580, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369\n\n    },\n\n    {\n       69, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n      581, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370\n    },\n\n    {\n       69, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371,  582, -371, -371, -371, -371,\n\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371\n    },\n\n    {\n       69, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372,  583,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372\n    },\n\n    {\n       69, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373,  584,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373,  585,  586, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373\n    },\n\n    {\n       69, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374\n    },\n\n    {\n       69, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,\n     -375, -375, -375, -375, -375, -375, -375, -375\n    },\n\n    {\n       69, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n     -376, -376, -376, -376, -376, -376, -376, -376, -376, -376,\n\n     -376, -376, -376, -376, -376, -376, -376, -376\n    },\n\n    {\n       69, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377,  587, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377\n    },\n\n    {\n       69, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n      588, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378, -378, -378,\n     -378, -378, -378, -378, -378, -378, -378, -378\n    },\n\n    {\n       69, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379,  589,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379\n\n    },\n\n    {\n       69, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380,  590, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380,  591,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380, -380, -380,\n     -380, -380, -380, -380, -380, -380, -380, -380\n    },\n\n    {\n       69, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n\n     -381, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381,  592, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381, -381, -381,\n     -381, -381, -381, -381, -381, -381, -381, -381\n    },\n\n    {\n       69, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382,  593, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382, -382, -382,\n     -382, -382, -382, -382, -382, -382, -382, -382\n    },\n\n    {\n       69, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383,  594, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383,  595,\n     -383, -383,  596, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383\n    },\n\n    {\n       69, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n\n     -384, -384, -384, -384, -384,  597, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384, -384, -384,\n     -384, -384, -384, -384, -384, -384, -384, -384\n    },\n\n    {\n       69, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385,  598, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385, -385, -385,\n     -385, -385, -385, -385, -385, -385, -385, -385\n    },\n\n    {\n       69, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386,  599, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n     -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,\n\n     -386, -386, -386, -386, -386, -386, -386, -386\n    },\n\n    {\n       69, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387,  600, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387,  601, -387,\n     -387, -387, -387, -387,  602, -387, -387, -387,  603, -387,\n\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387, -387, -387,\n     -387, -387, -387, -387, -387, -387, -387, -387\n    },\n\n    {\n       69, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388,  604, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388, -388, -388,\n     -388, -388, -388, -388, -388, -388, -388, -388\n    },\n\n    {\n       69, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389,  605, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389\n\n    },\n\n    {\n       69, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390, -390, -390,\n     -390, -390, -390, -390, -390, -390, -390, -390\n    },\n\n    {\n       69, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391, -391, -391,\n     -391, -391, -391, -391, -391, -391, -391, -391\n    },\n\n    {\n       69, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392, -392, -392,\n     -392, -392, -392, -392, -392, -392, -392, -392\n    },\n\n    {\n       69, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n\n     -393, -393, -393, -393, -393, -393, -393, -393, -393, -393,\n     -393, -393, -393, -393, -393, -393, -393, -393\n    },\n\n    {\n       69, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394, -394, -394,\n     -394, -394, -394, -394, -394, -394, -394, -394\n    },\n\n    {\n       69, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395, -395, -395,\n     -395, -395, -395, -395, -395, -395, -395, -395\n    },\n\n    {\n       69, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n     -396, -396, -396, -396, -396, -396, -396, -396, -396, -396,\n\n     -396, -396, -396, -396, -396, -396, -396, -396\n    },\n\n    {\n       69, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397,  606, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397, -397, -397,\n     -397, -397, -397, -397, -397, -397, -397, -397\n    },\n\n    {\n       69, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398,  607, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398\n    },\n\n    {\n       69, -399, -399, -399, -399, -399, -399, -399, -399, -399,\n     -399, -399, -399, -399, -399, -399, -399, -399, -399, -399,\n     -399, -399, -399, -399, -399, -399, -399, -399, -399, -399,\n\n     -399, -399,  608, -399, -399, -399, -399, -399, -399, -399,\n     -399, -399, -399, -399, -399, -399, -399, -399, -399, -399,\n     -399, -399, -399, -399, -399, -399, -399, -399, -399, -399,\n     -399, -399, -399, -399, -399,  608,  608,  608,  608,  608,\n      608,  608,  608,  608,  608,  608,  608,  608,  608,  608,\n      608,  608,  608,  608,  608,  608,  608,  608,  608,  608,\n      608, -399, -399, -399, -399, -399, -399, -399, -399, -399,\n     -399, -399, -399, -399, -399, -399, -399, -399, -399, -399,\n     -399, -399, -399, -399, -399, -399, -399, -399, -399, -399,\n     -399, -399, -399, -399, -399, -399, -399, -399\n\n    },\n\n    {\n       69, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400, -400, -400,\n     -400, -400, -400, -400, -400, -400, -400, -400\n    },\n\n    {\n       69, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401, -401, -401,\n     -401, -401, -401, -401, -401, -401, -401, -401\n    },\n\n    {\n       69, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402, -402, -402,\n     -402, -402, -402, -402, -402, -402, -402, -402\n    },\n\n    {\n       69, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n\n     -403, -403, -403, -403, -403, -403, -403, -403, -403, -403,\n     -403, -403, -403, -403, -403, -403, -403, -403\n    },\n\n    {\n       69, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404, -404, -404,\n     -404, -404, -404, -404, -404, -404, -404, -404\n    },\n\n    {\n       69, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405,  609, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405, -405, -405,\n     -405, -405, -405, -405, -405, -405, -405, -405\n    },\n\n    {\n       69, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406,  610, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406, -406, -406,\n\n     -406, -406, -406, -406, -406, -406, -406, -406\n    },\n\n    {\n       69, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407,  611, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407,  611,  611,  611,  611,  611,\n      611,  611,  611,  611,  611,  611,  611,  611,  611,  611,\n      611,  611,  611,  611,  611,  611,  611,  611,  611,  611,\n\n      611, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407\n    },\n\n    {\n       69, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408, -408, -408,\n     -408, -408, -408, -408, -408, -408, -408, -408\n    },\n\n    {\n       69, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409, -409, -409,\n     -409, -409, -409, -409, -409, -409, -409, -409\n\n    },\n\n    {\n       69, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410, -410, -410,\n     -410, -410, -410, -410, -410, -410, -410, -410\n    },\n\n    {\n       69, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411\n    },\n\n    {\n       69, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412, -412, -412,\n     -412, -412, -412, -412, -412, -412, -412, -412\n    },\n\n    {\n       69, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413,  612, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413,  613,  613,\n      613,  613,  613,  613,  613,  613,  613,  613, -413, -413,\n     -413, -413, -413, -413, -413,  612,  612,  612,  612,  612,\n      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,\n      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,\n      612, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413\n    },\n\n    {\n       69, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414,  614,  614,\n      614,  614,  614,  614,  614,  614,  614,  614, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414, -414, -414,\n     -414, -414, -414, -414, -414, -414, -414, -414\n    },\n\n    {\n       69, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415,  615, -415, -415,  616,  617,\n\n      617,  617,  617,  617,  617,  617,  617,  617, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415,  618, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415\n    },\n\n    {\n       69, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416,  615, -416, -416,  619,  619,\n      619,  619,  619,  619,  619,  619,  619,  619, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416,  620, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416, -416, -416,\n\n     -416, -416, -416, -416, -416, -416, -416, -416\n    },\n\n    {\n       69, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417,  621,  621,\n      621,  621,  621,  621,  621,  621,  621,  621, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417, -417, -417,\n     -417, -417, -417, -417, -417, -417, -417, -417\n    },\n\n    {\n       69, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418,  615, -418, -418,  616,  616,\n      616,  616,  616,  616,  616,  616,  616,  616, -418, -418,\n\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418,  622, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418, -418, -418,\n     -418, -418, -418, -418, -418, -418, -418, -418\n    },\n\n    {\n       69, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419,  623,  624,\n      624,  624,  624,  624,  624,  624,  624,  624, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419\n\n    },\n\n    {\n       69, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420,  625, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420,  626,  626,\n      626,  626,  626,  626,  626,  626,  626,  626, -420, -420,\n     -420, -420, -420, -420, -420,  625,  625,  625,  625,  625,\n      625,  625,  625,  625,  625,  625,  625,  625,  625,  625,\n      625,  625,  625,  625,  625,  625,  625,  625,  625,  625,\n      625, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420, -420, -420, -420\n    },\n\n    {\n       69, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421,  615, -421, -421,  616,  616,\n      616,  616,  616,  616,  616,  616,  616,  616, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421,  618, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421\n    },\n\n    {\n       69, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n\n     -422, -422, -422, -422, -422, -422, -422, -422,  627,  628,\n      628,  628,  628,  628,  628,  628,  628,  628, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422, -422, -422,\n     -422, -422, -422, -422, -422, -422, -422, -422\n    },\n\n    {\n       69, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423,  625, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423,  629,  630,\n      630,  630,  630,  630,  630,  630,  630,  630, -423, -423,\n     -423, -423, -423, -423, -423,  625,  625,  625,  625,  625,\n      625,  625,  625,  625,  625,  625,  625,  625,  625,  625,\n      625,  625,  625,  625,  625,  625,  625,  625,  625,  625,\n      625, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n\n     -423, -423, -423, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423\n    },\n\n    {\n       69, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424,  631, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424,  632,  632,\n      632,  632,  632,  632,  632,  632,  632,  632, -424, -424,\n     -424, -424, -424, -424, -424,  631,  631,  631,  631,  631,\n      631,  631,  631,  631,  631,  631,  631,  631,  631,  631,\n\n      631,  631,  631,  631,  631,  631,  631,  631,  631,  631,\n      631, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424\n    },\n\n    {\n       69, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425,  633, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425, -425, -425,\n     -425, -425, -425, -425, -425, -425, -425, -425\n    },\n\n    {\n       69, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426,  634, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n     -426, -426, -426, -426, -426, -426, -426, -426, -426, -426,\n\n     -426, -426, -426, -426, -426, -426, -426, -426\n    },\n\n    {\n       69, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427,  635, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427,  635,  635,  635,  635,  635,\n      635,  635,  635,  635,  635,  635,  635,  635,  635,  635,\n      635,  635,  635,  635,  635,  635,  635,  635,  635,  635,\n\n      635, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427, -427, -427,\n     -427, -427, -427, -427, -427, -427, -427, -427\n    },\n\n    {\n       69, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428,  636,  636,\n      636,  636,  636,  636,  636,  636,  636,  636, -428, -428,\n\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428,  637, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,\n     -428, -428, -428, -428, -428, -428, -428, -428\n    },\n\n    {\n       69, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429,  638,\n      638,  638,  638,  638,  638,  638,  638,  638, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429, -429, -429,\n     -429, -429, -429, -429, -429, -429, -429, -429\n\n    },\n\n    {\n       69, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430,  639, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430,  640,  640,\n      640,  640,  640,  640,  640,  640,  640,  640, -430, -430,\n     -430, -430, -430, -430, -430,  639,  639,  639,  639,  639,\n      639,  639,  639,  639,  639,  639,  639,  639,  639,  639,\n      639,  639,  639,  639,  639,  639,  639,  639,  639,  639,\n      639, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430, -430, -430,\n     -430, -430, -430, -430, -430, -430, -430, -430\n    },\n\n    {\n       69, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431,  641, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431\n    },\n\n    {\n       69, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n\n     -432, -432, -432, -432, -432, -432, -432, -432, -432,  642,\n      642,  642,  642,  642,  642,  642,  642,  642, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432, -432, -432,\n     -432, -432, -432, -432, -432, -432, -432, -432\n    },\n\n    {\n       69, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433,  643, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433,  644,  644,\n      644,  644,  644,  644,  644,  644,  644,  644, -433, -433,\n     -433, -433, -433, -433, -433,  643,  643,  643,  643,  643,\n      643,  643,  643,  643,  643,  643,  643,  643,  643,  643,\n      643,  643,  643,  643,  643,  643,  643,  643,  643,  643,\n      643, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n\n     -433, -433, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433, -433, -433, -433\n    },\n\n    {\n       69, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434\n    },\n\n    {\n       69, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435\n    },\n\n    {\n       69, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n     -436, -436, -436, -436, -436, -436, -436, -436, -436, -436,\n\n     -436, -436, -436, -436, -436, -436, -436, -436\n    },\n\n    {\n       69, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437\n    },\n\n    {\n       69, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438\n    },\n\n    {\n       69, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439\n\n    },\n\n    {\n       69, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440\n    },\n\n    {\n       69, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441\n    },\n\n    {\n       69, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,\n     -442, -442, -442, -442, -442, -442, -442, -442\n    },\n\n    {\n       69, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n\n     -443, -443, -443, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443\n    },\n\n    {\n       69, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,\n     -444, -444, -444, -444, -444, -444, -444, -444\n    },\n\n    {\n       69, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445\n    },\n\n    {\n       69, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446, -446, -446,\n\n     -446, -446, -446, -446, -446, -446, -446, -446\n    },\n\n    {\n       69, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447,  645, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447,  646,  646,\n      646,  646,  646,  646,  646,  646,  646,  646, -447, -447,\n     -447, -447, -447, -447, -447,  645,  645,  645,  645,  645,\n      645,  645,  645,  645,  645,  645,  645,  645,  645,  645,\n      645,  645,  645,  645,  645,  645,  645,  645,  645,  645,\n\n      645, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447, -447, -447,\n     -447, -447, -447, -447, -447, -447, -447, -447\n    },\n\n    {\n       69, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448,  647,  647,\n      647,  647,  647,  647,  647,  647,  647,  647, -448, -448,\n\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448, -448, -448,\n     -448, -448, -448, -448, -448, -448, -448, -448\n    },\n\n    {\n       69, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449,  648, -449, -449,  649,  650,\n      650,  650,  650,  650,  650,  650,  650,  650, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449,  651, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449, -449, -449,\n     -449, -449, -449, -449, -449, -449, -449, -449\n\n    },\n\n    {\n       69, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450,  648, -450, -450,  652,  652,\n      652,  652,  652,  652,  652,  652,  652,  652, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450,  653, -450, -450, -450, -450,\n\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450, -450, -450,\n     -450, -450, -450, -450, -450, -450, -450, -450\n    },\n\n    {\n       69, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451,  654,  654,\n      654,  654,  654,  654,  654,  654,  654,  654, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451, -451, -451,\n     -451, -451, -451, -451, -451, -451, -451, -451\n    },\n\n    {\n       69, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n\n     -452, -452, -452, -452, -452,  648, -452, -452,  649,  649,\n      649,  649,  649,  649,  649,  649,  649,  649, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452,  655, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452, -452, -452,\n     -452, -452, -452, -452, -452, -452, -452, -452\n    },\n\n    {\n       69, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453,  656,  657,\n      657,  657,  657,  657,  657,  657,  657,  657, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n\n     -453, -453, -453, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453\n    },\n\n    {\n       69, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454,  658, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454,  659,  659,\n      659,  659,  659,  659,  659,  659,  659,  659, -454, -454,\n     -454, -454, -454, -454, -454,  658,  658,  658,  658,  658,\n      658,  658,  658,  658,  658,  658,  658,  658,  658,  658,\n\n      658,  658,  658,  658,  658,  658,  658,  658,  658,  658,\n      658, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454, -454, -454,\n     -454, -454, -454, -454, -454, -454, -454, -454\n    },\n\n    {\n       69, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455,  648, -455, -455,  649,  649,\n\n      649,  649,  649,  649,  649,  649,  649,  649, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455,  651, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455\n    },\n\n    {\n       69, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456,  660,  661,\n      661,  661,  661,  661,  661,  661,  661,  661, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456, -456, -456,\n\n     -456, -456, -456, -456, -456, -456, -456, -456\n    },\n\n    {\n       69, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457,  662, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457,  663,  664,\n      664,  664,  664,  664,  664,  664,  664,  664, -457, -457,\n     -457, -457, -457, -457, -457,  662,  662,  662,  662,  662,\n      662,  662,  662,  662,  662,  662,  662,  662,  662,  662,\n      662,  662,  662,  662,  662,  662,  662,  662,  662,  662,\n\n      662, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,\n     -457, -457, -457, -457, -457, -457, -457, -457\n    },\n\n    {\n       69, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458,  662, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458,  665,  665,\n      665,  665,  665,  665,  665,  665,  665,  665, -458, -458,\n\n     -458, -458, -458, -458, -458,  662,  662,  662,  662,  662,\n      662,  662,  662,  662,  662,  662,  662,  662,  662,  662,\n      662,  662,  662,  662,  662,  662,  662,  662,  662,  662,\n      662, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458\n    },\n\n    {\n       69, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459,  666,  666,\n      666,  666,  666,  666,  666,  666,  666,  666, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459,  667, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459\n\n    },\n\n    {\n       69, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460,  668,  669,\n      669,  669,  669,  669,  669,  669,  669,  669, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460\n    },\n\n    {\n       69, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461,  670, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461,  670,  670,  670,  670,  670,\n\n      670,  670,  670,  670,  670,  670,  670,  670,  670,  670,\n      670,  670,  670,  670,  670,  670,  670,  670,  670,  670,\n      670, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461, -461, -461, -461, -461\n    },\n\n    {\n       69, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462,  670, -462, -462, -462, -462, -462, -462, -462,\n\n     -462, -462, -462, -462, -462, -462, -462, -462,  671,  671,\n      671,  671,  671,  671,  671,  671,  671,  671, -462, -462,\n     -462, -462, -462, -462, -462,  670,  670,  670,  670,  670,\n      670,  670,  670,  670,  670,  670,  670,  670,  670,  670,\n      670,  670,  670,  670,  670,  670,  670,  670,  670,  670,\n      670, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462\n    },\n\n    {\n       69, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463,  672, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n\n     -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463\n    },\n\n    {\n       69, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464,  673,  674,\n      674,  674,  674,  674,  674,  674,  674,  674, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464\n    },\n\n    {\n       69, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465,  675, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465,  675,  675,  675,  675,  675,\n      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,\n      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,\n      675, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465, -465, -465,\n     -465, -465, -465, -465, -465, -465, -465, -465\n    },\n\n    {\n       69, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466,  675, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466,  676,  676,\n      676,  676,  676,  676,  676,  676,  676,  676, -466, -466,\n     -466, -466, -466, -466, -466,  675,  675,  675,  675,  675,\n      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,\n      675,  675,  675,  675,  675,  675,  675,  675,  675,  675,\n      675, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n     -466, -466, -466, -466, -466, -466, -466, -466, -466, -466,\n\n     -466, -466, -466, -466, -466, -466, -466, -466\n    },\n\n    {\n       69, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467,  677,  677,\n      677,  677,  677,  677,  677,  677,  677,  677, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n\n     -467, -467, -467, -467, -467,  678, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467, -467, -467,\n     -467, -467, -467, -467, -467, -467, -467, -467\n    },\n\n    {\n       69, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468,  679,  680,\n      680,  680,  680,  680,  680,  680,  680,  680, -468, -468,\n\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,\n     -468, -468, -468, -468, -468, -468, -468, -468\n    },\n\n    {\n       69, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n\n     -469, -469,  681, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469,  681,  681,  681,  681,  681,\n      681,  681,  681,  681,  681,  681,  681,  681,  681,  681,\n      681,  681,  681,  681,  681,  681,  681,  681,  681,  681,\n      681, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469\n\n    },\n\n    {\n       69, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470,  681, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470,  682,  682,\n      682,  682,  682,  682,  682,  682,  682,  682, -470, -470,\n     -470, -470, -470, -470, -470,  681,  681,  681,  681,  681,\n      681,  681,  681,  681,  681,  681,  681,  681,  681,  681,\n      681,  681,  681,  681,  681,  681,  681,  681,  681,  681,\n      681, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470, -470, -470,\n     -470, -470, -470, -470, -470, -470, -470, -470\n    },\n\n    {\n       69, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471,  683, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471, -471, -471,\n     -471, -471, -471, -471, -471, -471, -471, -471\n    },\n\n    {\n       69, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n\n     -472, -472, -472, -472, -472, -472, -472, -472,  684,  685,\n      685,  685,  685,  685,  685,  685,  685,  685, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,\n     -472, -472, -472, -472, -472, -472, -472, -472\n    },\n\n    {\n       69, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473,  686, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473,  686,  686,  686,  686,  686,\n      686,  686,  686,  686,  686,  686,  686,  686,  686,  686,\n      686,  686,  686,  686,  686,  686,  686,  686,  686,  686,\n      686, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473\n    },\n\n    {\n       69, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474,  686, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474,  687,  687,\n      687,  687,  687,  687,  687,  687,  687,  687, -474, -474,\n     -474, -474, -474, -474, -474,  686,  686,  686,  686,  686,\n      686,  686,  686,  686,  686,  686,  686,  686,  686,  686,\n\n      686,  686,  686,  686,  686,  686,  686,  686,  686,  686,\n      686, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474, -474, -474,\n     -474, -474, -474, -474, -474, -474, -474, -474\n    },\n\n    {\n       69, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475, -475, -475,\n     -475, -475, -475, -475, -475, -475, -475, -475\n    },\n\n    {\n       69, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n     -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,\n\n     -476, -476, -476, -476, -476, -476, -476, -476\n    },\n\n    {\n       69, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477, -477, -477,\n     -477, -477, -477, -477, -477, -477, -477, -477\n    },\n\n    {\n       69, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478,  688, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478, -478, -478,\n     -478, -478, -478, -478, -478, -478, -478, -478\n    },\n\n    {\n       69, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n\n     -479, -479,  689, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479\n\n    },\n\n    {\n       69, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480,  690, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480,  690,  690,  690,  690,  690,\n      690,  690,  690,  690,  690,  690,  690,  690,  690,  690,\n      690,  690,  690,  690,  690,  690,  690,  690,  690,  690,\n      690, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480, -480, -480, -480, -480, -480, -480\n    },\n\n    {\n       69, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481, -481, -481,\n     -481, -481, -481, -481, -481, -481, -481, -481\n    },\n\n    {\n       69, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482, -482, -482,\n     -482, -482, -482, -482, -482, -482, -482, -482\n    },\n\n    {\n       69, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n\n     -483, -483, -483, -483, -483, -483, -483, -483, -483, -483,\n     -483, -483, -483, -483, -483, -483, -483, -483\n    },\n\n    {\n       69, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484,  691, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484\n    },\n\n    {\n       69, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485,  692, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485\n    },\n\n    {\n       69, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486,  693, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486,  694,  694,\n      694,  694,  694,  694,  694,  694,  694,  694, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n     -486, -486, -486, -486, -486, -486, -486, -486, -486, -486,\n\n     -486, -486, -486, -486, -486, -486, -486, -486\n    },\n\n    {\n       69, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487\n    },\n\n    {\n       69, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488, -488, -488,\n     -488, -488, -488, -488, -488, -488, -488, -488\n    },\n\n    {\n       69, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489\n\n    },\n\n    {\n       69, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490,  490,  490,\n      490,  490,  490,  490,  490,  490,  490,  490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490,  285,  285,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n\n      285,  285, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490, -490\n    },\n\n    {\n       69, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491,  492,  492,\n      492,  492,  492,  492,  492,  492,  492,  492, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491, -491, -491,\n     -491, -491, -491, -491, -491, -491, -491, -491\n    },\n\n    {\n       69, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n\n     -492, -492, -492, -492, -492, -492, -492, -492,  492,  492,\n      492,  492,  492,  492,  492,  492,  492,  492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492, -492, -492,\n     -492, -492, -492, -492, -492, -492, -492, -492\n    },\n\n    {\n       69, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493,  493,  493,\n      493,  493,  493,  493,  493,  493,  493,  493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493,  291,  291,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n      291,  291, -493, -493, -493, -493, -493, -493, -493, -493,\n\n     -493, -493, -493, -493, -493, -493, -493, -493, -493, -493,\n     -493, -493, -493, -493, -493, -493, -493, -493\n    },\n\n    {\n       69, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494,  495,  495,\n      495,  495,  495,  495,  495,  495,  495,  495, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494, -494, -494,\n     -494, -494, -494, -494, -494, -494, -494, -494\n    },\n\n    {\n       69, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495,  495,  495,\n\n      495,  495,  495,  495,  495,  495,  495,  495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495, -495, -495,\n     -495, -495, -495, -495, -495, -495, -495, -495\n    },\n\n    {\n       69,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      695,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  696,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  697,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n\n      496,  496,  496,  496,  496,  496,  496,  496\n    },\n\n    {\n       69,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      498,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  499,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  500,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497\n    },\n\n    {\n       69, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498, -498, -498,\n     -498, -498, -498, -498, -498, -498, -498, -498\n    },\n\n    {\n       69,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      498,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n\n      497,  497,  499,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  500,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497\n\n    },\n\n    {\n       69,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      498,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  499,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  500,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497,  497,  497,\n      497,  497,  497,  497,  497,  497,  497,  497\n    },\n\n    {\n       69,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      502,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  503,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  504,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501\n    },\n\n    {\n       69, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502\n    },\n\n    {\n       69,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n\n      502,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  503,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  504,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501\n    },\n\n    {\n       69,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      699,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  700,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  701,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698\n    },\n\n    {\n       69,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      502,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  503,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  504,  501,  501,\n\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501,  501,  501,\n      501,  501,  501,  501,  501,  501,  501,  501\n    },\n\n    {\n       69, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n     -506, -506, -506, -506, -506, -506, -506, -506, -506, -506,\n\n     -506, -506, -506, -506, -506, -506, -506, -506\n    },\n\n    {\n       69,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      506,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  507,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  508,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n\n      505,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  505,  505,  505,\n      505,  505,  505,  505,  505,  505,  505,  505\n    },\n\n    {\n       69,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      703,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  704,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  705,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702\n    },\n\n    {\n       69, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,\n     -509, -509, -509, -509, -509, -509, -509, -509\n\n    },\n\n    {\n       69, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510, -510, -510,\n     -510, -510, -510, -510, -510, -510, -510, -510\n    },\n\n    {\n       69, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511, -511, -511,\n     -511, -511, -511, -511, -511, -511, -511, -511\n    },\n\n    {\n       69, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512,  706, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512, -512, -512,\n     -512, -512, -512, -512, -512, -512, -512, -512\n    },\n\n    {\n       69, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513,  707, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n\n     -513, -513, -513, -513, -513, -513, -513, -513, -513, -513,\n     -513, -513, -513, -513, -513, -513, -513, -513\n    },\n\n    {\n       69, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n\n     -514, -514,  708, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,\n     -514, -514, -514, -514, -514, -514, -514, -514\n    },\n\n    {\n       69, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515, -515, -515,\n     -515, -515, -515, -515, -515, -515, -515, -515\n    },\n\n    {\n       69, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516,  709,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n\n     -516, -516, -516, -516, -516, -516, -516, -516\n    },\n\n    {\n       69, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517,  710, -517, -517, -517, -517, -517,\n\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,\n     -517, -517, -517, -517, -517, -517, -517, -517\n    },\n\n    {\n       69, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518,  711, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518, -518, -518,\n     -518, -518, -518, -518, -518, -518, -518, -518\n    },\n\n    {\n       69, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519,  712, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519, -519, -519,\n     -519, -519, -519, -519, -519, -519, -519, -519\n\n    },\n\n    {\n       69, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520,  713,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520\n    },\n\n    {\n       69, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n      714, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521, -521, -521,\n     -521, -521, -521, -521, -521, -521, -521, -521\n    },\n\n    {\n       69, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522,  715, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,\n     -522, -522, -522, -522, -522, -522, -522, -522\n    },\n\n    {\n       69, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523,  716, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n\n     -523, -523, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523\n    },\n\n    {\n       69, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524,  717, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524, -524, -524,\n     -524, -524, -524, -524, -524, -524, -524, -524\n    },\n\n    {\n       69, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525,  718, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525, -525, -525,\n     -525, -525, -525, -525, -525, -525, -525, -525\n    },\n\n    {\n       69, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526,  719,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n     -526, -526, -526, -526, -526, -526, -526, -526, -526, -526,\n\n     -526, -526, -526, -526, -526, -526, -526, -526\n    },\n\n    {\n       69, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527,  720, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527\n    },\n\n    {\n       69, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528,  721, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528\n    },\n\n    {\n       69, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529,  722, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529\n\n    },\n\n    {\n       69, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530,  723, -530, -530, -530, -530,\n\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530, -530, -530,\n     -530, -530, -530, -530, -530, -530, -530, -530\n    },\n\n    {\n       69, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531,  724, -531, -531, -531, -531,\n\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,\n     -531, -531, -531, -531, -531, -531, -531, -531\n    },\n\n    {\n       69, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532,  725, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532, -532, -532,\n     -532, -532, -532, -532, -532, -532, -532, -532\n    },\n\n    {\n       69, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533,  726, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n\n     -533, -533, -533, -533, -533, -533, -533, -533, -533, -533,\n     -533, -533, -533, -533, -533, -533, -533, -533\n    },\n\n    {\n       69, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n\n     -534, -534,  727, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534, -534, -534,\n     -534, -534, -534, -534, -534, -534, -534, -534\n    },\n\n    {\n       69, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535,  728,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535, -535, -535,\n     -535, -535, -535, -535, -535, -535, -535, -535\n    },\n\n    {\n       69, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536,  729, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,\n\n     -536, -536, -536, -536, -536, -536, -536, -536\n    },\n\n    {\n       69, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537,  730, -537, -537, -537, -537, -537, -537,\n\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,\n     -537, -537, -537, -537, -537, -537, -537, -537\n    },\n\n    {\n       69, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538,  731, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538,  732, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538\n    },\n\n    {\n       69, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539\n\n    },\n\n    {\n       69, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540,  733,\n      733,  733,  733,  733,  733,  733,  733,  733, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540\n    },\n\n    {\n       69, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541,  734, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541\n    },\n\n    {\n       69, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542,  735, -542, -542, -542, -542, -542, -542, -542,\n\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,\n     -542, -542, -542, -542, -542, -542, -542, -542\n    },\n\n    {\n       69, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543,  736, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n\n     -543, -543, -543, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543\n    },\n\n    {\n       69, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544,  737, -544,\n\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544\n    },\n\n    {\n       69, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545,  738, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545\n    },\n\n    {\n       69, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546,  739, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n     -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,\n\n     -546, -546, -546, -546, -546, -546, -546, -546\n    },\n\n    {\n       69, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547,  740,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547\n    },\n\n    {\n       69, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n      741, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548, -548, -548,\n     -548, -548, -548, -548, -548, -548, -548, -548\n    },\n\n    {\n       69, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549,  742, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549, -549, -549,\n     -549, -549, -549, -549, -549, -549, -549, -549\n\n    },\n\n    {\n       69, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550,  743,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550\n    },\n\n    {\n       69, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n\n     -551, -551, -551, -551, -551, -551, -551, -551, -551,  744,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551\n    },\n\n    {\n       69, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552,  745,  746, -552, -552,  747,\n     -552, -552, -552, -552, -552, -552, -552, -552, -552,  748,\n     -552, -552,  749, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552, -552, -552,\n     -552, -552, -552, -552, -552, -552, -552, -552\n    },\n\n    {\n       69, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n\n     -553, -553, -553, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553\n    },\n\n    {\n       69, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554,  750, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554, -554, -554,\n     -554, -554, -554, -554, -554, -554, -554, -554\n    },\n\n    {\n       69, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555,  751,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555\n    },\n\n    {\n       69, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556,  752, -556, -556,  753,\n     -556, -556,  754, -556, -556, -556,  755, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556, -556, -556,  756,  757,\n      758, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n     -556, -556, -556, -556, -556, -556, -556, -556, -556, -556,\n\n     -556, -556, -556, -556, -556, -556, -556, -556\n    },\n\n    {\n       69, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557,  759, -557, -557, -557, -557, -557, -557, -557,\n\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557\n    },\n\n    {\n       69, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558,  760, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558, -558, -558,\n     -558, -558, -558, -558, -558, -558, -558, -558\n    },\n\n    {\n       69, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n      761, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559\n\n    },\n\n    {\n       69, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560,  762, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560,  763, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560\n    },\n\n    {\n       69, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n\n      764, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561,  765, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561\n    },\n\n    {\n       69, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562, -562, -562,\n     -562, -562, -562, -562, -562, -562, -562, -562\n    },\n\n    {\n       69, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563,  766, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n\n     -563, -563, -563, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563\n    },\n\n    {\n       69, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564\n    },\n\n    {\n       69, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565\n    },\n\n    {\n       69, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566,  767, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,\n\n     -566, -566, -566, -566, -566, -566, -566, -566\n    },\n\n    {\n       69, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567\n    },\n\n    {\n       69, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568,  768,\n     -568, -568, -568,  769, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568, -568, -568,\n     -568, -568, -568, -568, -568, -568, -568, -568\n    },\n\n    {\n       69, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569\n\n    },\n\n    {\n       69, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570,  770, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570, -570, -570,\n     -570, -570, -570, -570, -570, -570, -570, -570\n    },\n\n    {\n       69, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n\n     -571, -571, -571, -571, -571, -571, -571,  771, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571\n    },\n\n    {\n       69, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572,  772, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,\n     -572, -572, -572, -572, -572, -572, -572, -572\n    },\n\n    {\n       69, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n\n     -573, -573, -573, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573\n    },\n\n    {\n       69, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574,  773,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574\n    },\n\n    {\n       69, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575,  774, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575\n    },\n\n    {\n       69, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576,  775, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576, -576, -576,\n\n     -576, -576, -576, -576, -576, -576, -576, -576\n    },\n\n    {\n       69, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577,  776, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577\n    },\n\n    {\n       69, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n\n     -578, -578, -578, -578, -578, -578, -578, -578, -578,  777,\n     -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578\n    },\n\n    {\n       69, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n      778, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579\n\n    },\n\n    {\n       69, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580,  779, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580\n    },\n\n    {\n       69, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n\n     -581, -581,  780, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581\n    },\n\n    {\n       69, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n      781, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582, -582, -582,\n     -582, -582, -582, -582, -582, -582, -582, -582\n    },\n\n    {\n       69, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583,  782, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n\n     -583, -583, -583, -583, -583, -583, -583, -583, -583, -583,\n     -583, -583, -583, -583, -583, -583, -583, -583\n    },\n\n    {\n       69, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584,  783, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584,  784,\n\n      785, -584, -584,  786, -584,  787, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584\n    },\n\n    {\n       69, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585,  788, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585\n    },\n\n    {\n       69, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586,  789,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586, -586, -586,\n\n     -586, -586, -586, -586, -586, -586, -586, -586\n    },\n\n    {\n       69, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587,  790, -587, -587, -587, -587, -587, -587, -587,\n\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587\n    },\n\n    {\n       69, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n\n     -588, -588, -588, -588, -588, -588, -588, -588,  791, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n      792, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588\n    },\n\n    {\n       69, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589,  793, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589\n\n    },\n\n    {\n       69, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590,  794, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590, -590, -590,\n     -590, -590, -590, -590, -590, -590, -590, -590\n    },\n\n    {\n       69, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n      795, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591\n    },\n\n    {\n       69, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592, -592, -592,\n     -592, -592, -592, -592, -592, -592, -592, -592\n    },\n\n    {\n       69, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n\n     -593, -593, -593, -593, -593, -593, -593, -593, -593, -593,\n     -593, -593, -593, -593, -593, -593, -593, -593\n    },\n\n    {\n       69, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594,  796, -594,\n\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594\n    },\n\n    {\n       69, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595,  797, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595\n    },\n\n    {\n       69, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596,  798,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n     -596, -596, -596, -596, -596, -596, -596, -596, -596, -596,\n\n     -596, -596, -596, -596, -596, -596, -596, -596\n    },\n\n    {\n       69, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597,  799,\n      799,  799,  799,  799,  799,  799,  799,  799, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597,  800, -597, -597, -597, -597, -597, -597, -597,\n\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597\n    },\n\n    {\n       69, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598\n    },\n\n    {\n       69, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599, -599,  801,\n      801,  801,  801,  801,  801,  801,  801,  801, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599\n\n    },\n\n    {\n       69, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600,  802, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600\n    },\n\n    {\n       69, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601,  803, -601, -601, -601, -601,\n\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601\n    },\n\n    {\n       69, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n\n     -602, -602, -602, -602, -602, -602, -602, -602, -602,  804,\n      804,  804,  804,  804,  804,  804,  804,  804, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602, -602, -602,\n     -602, -602, -602, -602, -602, -602, -602, -602\n    },\n\n    {\n       69, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603, -603,  805,\n      805,  805,  805,  805,  805,  805,  805,  805, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n\n     -603, -603, -603, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603\n    },\n\n    {\n       69, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n\n     -604, -604, -604, -604, -604,  806, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604, -604, -604,\n     -604, -604, -604, -604, -604, -604, -604, -604\n    },\n\n    {\n       69, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605,  807, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605, -605, -605,\n     -605, -605, -605, -605, -605, -605, -605, -605\n    },\n\n    {\n       69, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606, -606, -606,\n\n     -606, -606, -606, -606, -606, -606, -606, -606\n    },\n\n    {\n       69, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607, -607, -607,\n     -607, -607, -607, -607, -607, -607, -607, -607\n    },\n\n    {\n       69, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608\n    },\n\n    {\n       69, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609\n\n    },\n\n    {\n       69, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610\n    },\n\n    {\n       69, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,\n     -611, -611, -611, -611, -611, -611, -611, -611\n    },\n\n    {\n       69, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612,  808, -612, -612, -612, -612, -612, -612, -612,\n\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612, -612, -612,\n     -612, -612, -612, -612, -612, -612, -612, -612\n    },\n\n    {\n       69, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n\n     -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n     -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n     -613, -613,  809, -613, -613, -613, -613, -613, -613, -613,\n     -613, -613, -613, -613, -613, -613, -613, -613,  810,  810,\n      810,  810,  810,  810,  810,  810,  810,  810, -613, -613,\n     -613, -613, -613, -613, -613,  809,  809,  809,  809,  809,\n      809,  809,  809,  809,  809,  809,  809,  809,  809,  809,\n      809,  809,  809,  809,  809,  809,  809,  809,  809,  809,\n      809, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n     -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n\n     -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,\n     -613, -613, -613, -613, -613, -613, -613, -613\n    },\n\n    {\n       69, -614, -614, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614,  811, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614, -614, -614, -614, -614, -614,  812,  812,\n      812,  812,  812,  812,  812,  812,  812,  812, -614, -614,\n     -614, -614, -614, -614, -614,  811,  811,  811,  811,  811,\n      811,  811,  811,  811,  811,  811,  811,  811,  811,  811,\n\n      811,  811,  811,  811,  811,  811,  811,  811,  811,  811,\n      811, -614, -614, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614, -614, -614, -614, -614, -614\n    },\n\n    {\n       69, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615,  813,  813,\n\n      813,  813,  813,  813,  813,  813,  813,  813, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615\n    },\n\n    {\n       69, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n     -616, -616, -616, -616, -616,  814, -616, -616,  815,  815,\n      815,  815,  815,  815,  815,  815,  815,  815, -616, -616,\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n     -616, -616, -616, -616, -616,  816, -616, -616, -616, -616,\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n     -616, -616, -616, -616, -616, -616, -616, -616, -616, -616,\n\n     -616, -616, -616, -616, -616, -616, -616, -616\n    },\n\n    {\n       69, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617,  814, -617, -617,  815,  815,\n      815,  815,  815,  815,  815,  815,  815,  815, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n\n     -617, -617, -617, -617, -617,  817, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617, -617, -617,\n     -617, -617, -617, -617, -617, -617, -617, -617\n    },\n\n    {\n       69, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618,  818,  818,\n      818,  818,  818,  818,  818,  818,  818,  818, -618, -618,\n\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618, -618, -618,\n     -618, -618, -618, -618, -618, -618, -618, -618\n    },\n\n    {\n       69, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619,  814, -619, -619,  815,  815,\n      815,  815,  815,  815,  815,  815,  815,  815, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619,  819, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619, -619, -619,\n     -619, -619, -619, -619, -619, -619, -619, -619\n\n    },\n\n    {\n       69, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620,  820,  821,\n      821,  821,  821,  821,  821,  821,  821,  821, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,\n     -620, -620, -620, -620, -620, -620, -620, -620\n    },\n\n    {\n       69, -621, -621, -621, -621, -621, -621, -621, -621, -621,\n     -621, -621, -621, -621, -621, -621, -621, -621, -621, -621,\n     -621, -621, -621, -621, -621, -621, -621, -621, -621, -621,\n     -621, -621,  822, -621, -621, -621, -621, -621, -621, -621,\n     -621, -621, -621, -621, -621, -621, -621, -621,  823,  823,\n      823,  823,  823,  823,  823,  823,  823,  823, -621, -621,\n     -621, -621, -621, -621, -621,  822,  822,  822,  822,  822,\n\n      822,  822,  822,  822,  822,  822,  822,  822,  822,  822,\n      822,  822,  822,  822,  822,  822,  822,  822,  822,  822,\n      822, -621, -621, -621, -621, -621, -621, -621, -621, -621,\n     -621, -621, -621, -621, -621, -621, -621, -621, -621, -621,\n     -621, -621, -621, -621, -621, -621, -621, -621, -621, -621,\n     -621, -621, -621, -621, -621, -621, -621, -621\n    },\n\n    {\n       69, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n\n     -622, -622, -622, -622, -622, -622, -622, -622,  824,  825,\n      825,  825,  825,  825,  825,  825,  825,  825, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,\n     -622, -622, -622, -622, -622, -622, -622, -622\n    },\n\n    {\n       69, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n\n     -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n     -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n     -623, -623,  822, -623, -623, -623, -623, -623, -623, -623,\n     -623, -623, -623, -623, -623, -623, -623, -623,  826,  827,\n      827,  827,  827,  827,  827,  827,  827,  827, -623, -623,\n     -623, -623, -623, -623, -623,  822,  822,  822,  822,  822,\n      822,  822,  822,  822,  822,  822,  822,  822,  822,  822,\n      822,  822,  822,  822,  822,  822,  822,  822,  822,  822,\n      822, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n     -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n\n     -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n     -623, -623, -623, -623, -623, -623, -623, -623\n    },\n\n    {\n       69, -624, -624, -624, -624, -624, -624, -624, -624, -624,\n     -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,\n     -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,\n     -624, -624,  828, -624, -624, -624, -624, -624, -624, -624,\n     -624, -624, -624, -624, -624, -624, -624, -624,  829,  829,\n      829,  829,  829,  829,  829,  829,  829,  829, -624, -624,\n     -624, -624, -624, -624, -624,  828,  828,  828,  828,  828,\n      828,  828,  828,  828,  828,  828,  828,  828,  828,  828,\n\n      828,  828,  828,  828,  828,  828,  828,  828,  828,  828,\n      828, -624, -624, -624, -624, -624, -624, -624, -624, -624,\n     -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,\n     -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,\n     -624, -624, -624, -624, -624, -624, -624, -624\n    },\n\n    {\n       69, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625,  830, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625, -625, -625, -625, -625, -625, -625\n    },\n\n    {\n       69, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n     -626, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n\n     -626, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n     -626, -626,  831, -626, -626, -626, -626, -626, -626, -626,\n     -626, -626, -626, -626, -626, -626, -626, -626,  832,  832,\n      832,  832,  832,  832,  832,  832,  832,  832, -626, -626,\n     -626, -626, -626, -626, -626,  831,  831,  831,  831,  831,\n      831,  831,  831,  831,  831,  831,  831,  831,  831,  831,\n      831,  831,  831,  831,  831,  831,  831,  831,  831,  831,\n      831, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n     -626, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n     -626, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n\n     -626, -626, -626, -626, -626, -626, -626, -626\n    },\n\n    {\n       69, -627, -627, -627, -627, -627, -627, -627, -627, -627,\n     -627, -627, -627, -627, -627, -627, -627, -627, -627, -627,\n     -627, -627, -627, -627, -627, -627, -627, -627, -627, -627,\n     -627, -627,  822, -627, -627, -627, -627, -627, -627, -627,\n     -627, -627, -627, -627, -627, -627, -627, -627,  833,  834,\n      834,  834,  834,  834,  834,  834,  834,  834, -627, -627,\n     -627, -627, -627, -627, -627,  822,  822,  822,  822,  822,\n      822,  822,  822,  822,  822,  822,  822,  822,  822,  822,\n      822,  822,  822,  822,  822,  822,  822,  822,  822,  822,\n\n      822, -627, -627, -627, -627, -627, -627, -627, -627, -627,\n     -627, -627, -627, -627, -627, -627, -627, -627, -627, -627,\n     -627, -627, -627, -627, -627, -627, -627, -627, -627, -627,\n     -627, -627, -627, -627, -627, -627, -627, -627\n    },\n\n    {\n       69, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628,  835, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628, -628, -628, -628, -628, -628, -628,  836,  836,\n      836,  836,  836,  836,  836,  836,  836,  836, -628, -628,\n\n     -628, -628, -628, -628, -628,  835,  835,  835,  835,  835,\n      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,\n      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,\n      835, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628, -628, -628, -628, -628, -628, -628\n    },\n\n    {\n       69, -629, -629, -629, -629, -629, -629, -629, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629, -629, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629, -629, -629, -629,\n\n     -629, -629,  831, -629, -629, -629, -629, -629, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629, -629,  837,  838,\n      838,  838,  838,  838,  838,  838,  838,  838, -629, -629,\n     -629, -629, -629, -629, -629,  831,  831,  831,  831,  831,\n      831,  831,  831,  831,  831,  831,  831,  831,  831,  831,\n      831,  831,  831,  831,  831,  831,  831,  831,  831,  831,\n      831, -629, -629, -629, -629, -629, -629, -629, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629, -629, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629, -629, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629, -629\n\n    },\n\n    {\n       69, -630, -630, -630, -630, -630, -630, -630, -630, -630,\n     -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,\n     -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,\n     -630, -630,  839, -630, -630, -630, -630, -630, -630, -630,\n     -630, -630, -630, -630, -630, -630, -630, -630,  840,  840,\n      840,  840,  840,  840,  840,  840,  840,  840, -630, -630,\n     -630, -630, -630, -630, -630,  839,  839,  839,  839,  839,\n      839,  839,  839,  839,  839,  839,  839,  839,  839,  839,\n      839,  839,  839,  839,  839,  839,  839,  839,  839,  839,\n      839, -630, -630, -630, -630, -630, -630, -630, -630, -630,\n\n     -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,\n     -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,\n     -630, -630, -630, -630, -630, -630, -630, -630\n    },\n\n    {\n       69, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631,  841, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631, -631, -631,\n     -631, -631, -631, -631, -631, -631, -631, -631\n    },\n\n    {\n       69, -632, -632, -632, -632, -632, -632, -632, -632, -632,\n     -632, -632, -632, -632, -632, -632, -632, -632, -632, -632,\n     -632, -632, -632, -632, -632, -632, -632, -632, -632, -632,\n     -632, -632,  842, -632, -632, -632, -632, -632, -632, -632,\n\n     -632, -632, -632, -632, -632, -632, -632, -632,  832,  832,\n      832,  832,  832,  832,  832,  832,  832,  832, -632, -632,\n     -632, -632, -632, -632, -632,  842,  842,  842,  842,  842,\n      842,  842,  842,  842,  842,  842,  842,  842,  842,  842,\n      842,  842,  842,  842,  842,  842,  842,  842,  842,  842,\n      842, -632, -632, -632, -632, -632, -632, -632, -632, -632,\n     -632, -632, -632, -632, -632, -632, -632, -632, -632, -632,\n     -632, -632, -632, -632, -632, -632, -632, -632, -632, -632,\n     -632, -632, -632, -632, -632, -632, -632, -632\n    },\n\n    {\n       69, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n\n     -633, -633, -633, -633, -633, -633, -633, -633, -633, -633,\n     -633, -633, -633, -633, -633, -633, -633, -633\n    },\n\n    {\n       69, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634, -634, -634,\n     -634, -634, -634, -634, -634, -634, -634, -634\n    },\n\n    {\n       69, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635, -635, -635,\n     -635, -635, -635, -635, -635, -635, -635, -635\n    },\n\n    {\n       69, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636,  843, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n     -636, -636, -636, -636, -636, -636, -636, -636, -636, -636,\n\n     -636, -636, -636, -636, -636, -636, -636, -636\n    },\n\n    {\n       69, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637,  844,\n      844,  844,  844,  844,  844,  844,  844,  844, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637\n    },\n\n    {\n       69, -638, -638, -638, -638, -638, -638, -638, -638, -638,\n     -638, -638, -638, -638, -638, -638, -638, -638, -638, -638,\n     -638, -638, -638, -638, -638, -638, -638, -638, -638, -638,\n     -638, -638,  845, -638, -638, -638, -638, -638, -638, -638,\n     -638, -638, -638, -638, -638, -638, -638, -638,  846,  846,\n      846,  846,  846,  846,  846,  846,  846,  846, -638, -638,\n\n     -638, -638, -638, -638, -638,  845,  845,  845,  845,  845,\n      845,  845,  845,  845,  845,  845,  845,  845,  845,  845,\n      845,  845,  845,  845,  845,  845,  845,  845,  845,  845,\n      845, -638, -638, -638, -638, -638, -638, -638, -638, -638,\n     -638, -638, -638, -638, -638, -638, -638, -638, -638, -638,\n     -638, -638, -638, -638, -638, -638, -638, -638, -638, -638,\n     -638, -638, -638, -638, -638, -638, -638, -638\n    },\n\n    {\n       69, -639, -639, -639, -639, -639, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639, -639, -639,\n\n     -639, -639,  847, -639, -639, -639, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639\n\n    },\n\n    {\n       69, -640, -640, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640, -640, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640, -640, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640,  848, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640, -640, -640, -640, -640, -640, -640,  849,  849,\n      849,  849,  849,  849,  849,  849,  849,  849, -640, -640,\n     -640, -640, -640, -640, -640,  848,  848,  848,  848,  848,\n      848,  848,  848,  848,  848,  848,  848,  848,  848,  848,\n      848,  848,  848,  848,  848,  848,  848,  848,  848,  848,\n      848, -640, -640, -640, -640, -640, -640, -640, -640, -640,\n\n     -640, -640, -640, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640, -640, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640, -640, -640, -640, -640, -640, -640\n    },\n\n    {\n       69, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641,  850,\n      850,  850,  850,  850,  850,  850,  850,  850, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641, -641, -641,\n     -641, -641, -641, -641, -641, -641, -641, -641\n    },\n\n    {\n       69, -642, -642, -642, -642, -642, -642, -642, -642, -642,\n     -642, -642, -642, -642, -642, -642, -642, -642, -642, -642,\n     -642, -642, -642, -642, -642, -642, -642, -642, -642, -642,\n     -642, -642,  851, -642, -642, -642, -642, -642, -642, -642,\n\n     -642, -642, -642, -642, -642, -642, -642, -642,  852,  852,\n      852,  852,  852,  852,  852,  852,  852,  852, -642, -642,\n     -642, -642, -642, -642, -642,  851,  851,  851,  851,  851,\n      851,  851,  851,  851,  851,  851,  851,  851,  851,  851,\n      851,  851,  851,  851,  851,  851,  851,  851,  851,  851,\n      851, -642, -642, -642, -642, -642, -642, -642, -642, -642,\n     -642, -642, -642, -642, -642, -642, -642, -642, -642, -642,\n     -642, -642, -642, -642, -642, -642, -642, -642, -642, -642,\n     -642, -642, -642, -642, -642, -642, -642, -642\n    },\n\n    {\n       69, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643,  853, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n\n     -643, -643, -643, -643, -643, -643, -643, -643, -643, -643,\n     -643, -643, -643, -643, -643, -643, -643, -643\n    },\n\n    {\n       69, -644, -644, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644, -644, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644, -644, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644,  854, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644, -644, -644, -644, -644, -644, -644,  855,  855,\n      855,  855,  855,  855,  855,  855,  855,  855, -644, -644,\n     -644, -644, -644, -644, -644,  854,  854,  854,  854,  854,\n      854,  854,  854,  854,  854,  854,  854,  854,  854,  854,\n\n      854,  854,  854,  854,  854,  854,  854,  854,  854,  854,\n      854, -644, -644, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644, -644, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644, -644, -644, -644, -644, -644, -644, -644, -644,\n     -644, -644, -644, -644, -644, -644, -644, -644\n    },\n\n    {\n       69, -645, -645, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645, -645, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645, -645, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645,  856, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645, -645, -645, -645, -645, -645, -645, -645, -645,\n\n     -645, -645, -645, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645, -645, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645, -645, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645, -645, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645, -645, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645, -645, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645, -645, -645, -645, -645, -645, -645, -645, -645,\n     -645, -645, -645, -645, -645, -645, -645, -645\n    },\n\n    {\n       69, -646, -646, -646, -646, -646, -646, -646, -646, -646,\n     -646, -646, -646, -646, -646, -646, -646, -646, -646, -646,\n\n     -646, -646, -646, -646, -646, -646, -646, -646, -646, -646,\n     -646, -646,  857, -646, -646, -646, -646, -646, -646, -646,\n     -646, -646, -646, -646, -646, -646, -646, -646,  858,  858,\n      858,  858,  858,  858,  858,  858,  858,  858, -646, -646,\n     -646, -646, -646, -646, -646,  857,  857,  857,  857,  857,\n      857,  857,  857,  857,  857,  857,  857,  857,  857,  857,\n      857,  857,  857,  857,  857,  857,  857,  857,  857,  857,\n      857, -646, -646, -646, -646, -646, -646, -646, -646, -646,\n     -646, -646, -646, -646, -646, -646, -646, -646, -646, -646,\n     -646, -646, -646, -646, -646, -646, -646, -646, -646, -646,\n\n     -646, -646, -646, -646, -646, -646, -646, -646\n    },\n\n    {\n       69, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647,  859, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647, -647, -647, -647, -647, -647, -647,  860,  860,\n      860,  860,  860,  860,  860,  860,  860,  860, -647, -647,\n     -647, -647, -647, -647, -647,  859,  859,  859,  859,  859,\n      859,  859,  859,  859,  859,  859,  859,  859,  859,  859,\n      859,  859,  859,  859,  859,  859,  859,  859,  859,  859,\n\n      859, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647, -647, -647, -647, -647, -647, -647\n    },\n\n    {\n       69, -648, -648, -648, -648, -648, -648, -648, -648, -648,\n     -648, -648, -648, -648, -648, -648, -648, -648, -648, -648,\n     -648, -648, -648, -648, -648, -648, -648, -648, -648, -648,\n     -648, -648, -648, -648, -648, -648, -648, -648, -648, -648,\n     -648, -648, -648, -648, -648, -648, -648, -648,  861,  861,\n      861,  861,  861,  861,  861,  861,  861,  861, -648, -648,\n\n     -648, -648, -648, -648, -648, -648, -648, -648, -648, -648,\n     -648, -648, -648, -648, -648, -648, -648, -648, -648, -648,\n     -648, -648, -648, -648, -648, -648, -648, -648, -648, -648,\n     -648, -648, -648, -648, -648, -648, -648, -648, -648, -648,\n     -648, -648, -648, -648, -648, -648, -648, -648, -648, -648,\n     -648, -648, -648, -648, -648, -648, -648, -648, -648, -648,\n     -648, -648, -648, -648, -648, -648, -648, -648\n    },\n\n    {\n       69, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649,  862, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649,  863, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649, -649, -649,\n     -649, -649, -649, -649, -649, -649, -649, -649\n\n    },\n\n    {\n       69, -650, -650, -650, -650, -650, -650, -650, -650, -650,\n     -650, -650, -650, -650, -650, -650, -650, -650, -650, -650,\n     -650, -650, -650, -650, -650, -650, -650, -650, -650, -650,\n     -650, -650, -650, -650, -650, -650, -650, -650, -650, -650,\n     -650, -650, -650, -650, -650,  862, -650, -650, -650, -650,\n     -650, -650, -650, -650, -650, -650, -650, -650, -650, -650,\n     -650, -650, -650, -650, -650, -650, -650, -650, -650, -650,\n     -650, -650, -650, -650, -650, -650, -650, -650, -650, -650,\n     -650, -650, -650, -650, -650, -650, -650, -650, -650, -650,\n     -650, -650, -650, -650, -650,  864, -650, -650, -650, -650,\n\n     -650, -650, -650, -650, -650, -650, -650, -650, -650, -650,\n     -650, -650, -650, -650, -650, -650, -650, -650, -650, -650,\n     -650, -650, -650, -650, -650, -650, -650, -650\n    },\n\n    {\n       69, -651, -651, -651, -651, -651, -651, -651, -651, -651,\n     -651, -651, -651, -651, -651, -651, -651, -651, -651, -651,\n     -651, -651, -651, -651, -651, -651, -651, -651, -651, -651,\n     -651, -651, -651, -651, -651, -651, -651, -651, -651, -651,\n     -651, -651, -651, -651, -651, -651, -651, -651,  865,  865,\n      865,  865,  865,  865,  865,  865,  865,  865, -651, -651,\n     -651, -651, -651, -651, -651, -651, -651, -651, -651, -651,\n\n     -651, -651, -651, -651, -651, -651, -651, -651, -651, -651,\n     -651, -651, -651, -651, -651, -651, -651, -651, -651, -651,\n     -651, -651, -651, -651, -651, -651, -651, -651, -651, -651,\n     -651, -651, -651, -651, -651, -651, -651, -651, -651, -651,\n     -651, -651, -651, -651, -651, -651, -651, -651, -651, -651,\n     -651, -651, -651, -651, -651, -651, -651, -651\n    },\n\n    {\n       69, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n\n     -652, -652, -652, -652, -652,  862, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652,  866, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652\n    },\n\n    {\n       69, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653,  867,  868,\n      868,  868,  868,  868,  868,  868,  868,  868, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n\n     -653, -653, -653, -653, -653, -653, -653, -653, -653, -653,\n     -653, -653, -653, -653, -653, -653, -653, -653\n    },\n\n    {\n       69, -654, -654, -654, -654, -654, -654, -654, -654, -654,\n     -654, -654, -654, -654, -654, -654, -654, -654, -654, -654,\n     -654, -654, -654, -654, -654, -654, -654, -654, -654, -654,\n     -654, -654,  869, -654, -654, -654, -654, -654, -654, -654,\n     -654, -654, -654, -654, -654, -654, -654, -654,  870,  870,\n      870,  870,  870,  870,  870,  870,  870,  870, -654, -654,\n     -654, -654, -654, -654, -654,  869,  869,  869,  869,  869,\n      869,  869,  869,  869,  869,  869,  869,  869,  869,  869,\n\n      869,  869,  869,  869,  869,  869,  869,  869,  869,  869,\n      869, -654, -654, -654, -654, -654, -654, -654, -654, -654,\n     -654, -654, -654, -654, -654, -654, -654, -654, -654, -654,\n     -654, -654, -654, -654, -654, -654, -654, -654, -654, -654,\n     -654, -654, -654, -654, -654, -654, -654, -654\n    },\n\n    {\n       69, -655, -655, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655, -655,  871,  872,\n\n      872,  872,  872,  872,  872,  872,  872,  872, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655, -655\n    },\n\n    {\n       69, -656, -656, -656, -656, -656, -656, -656, -656, -656,\n     -656, -656, -656, -656, -656, -656, -656, -656, -656, -656,\n\n     -656, -656, -656, -656, -656, -656, -656, -656, -656, -656,\n     -656, -656,  873, -656, -656, -656, -656, -656, -656, -656,\n     -656, -656, -656, -656, -656, -656, -656, -656,  874,  875,\n      875,  875,  875,  875,  875,  875,  875,  875, -656, -656,\n     -656, -656, -656, -656, -656,  873,  873,  873,  873,  873,\n      873,  873,  873,  873,  873,  873,  873,  873,  873,  873,\n      873,  873,  873,  873,  873,  873,  873,  873,  873,  873,\n      873, -656, -656, -656, -656, -656, -656, -656, -656, -656,\n     -656, -656, -656, -656, -656, -656, -656, -656, -656, -656,\n     -656, -656, -656, -656, -656, -656, -656, -656, -656, -656,\n\n     -656, -656, -656, -656, -656, -656, -656, -656\n    },\n\n    {\n       69, -657, -657, -657, -657, -657, -657, -657, -657, -657,\n     -657, -657, -657, -657, -657, -657, -657, -657, -657, -657,\n     -657, -657, -657, -657, -657, -657, -657, -657, -657, -657,\n     -657, -657,  873, -657, -657, -657, -657, -657, -657, -657,\n     -657, -657, -657, -657, -657, -657, -657, -657,  876,  876,\n      876,  876,  876,  876,  876,  876,  876,  876, -657, -657,\n     -657, -657, -657, -657, -657,  873,  873,  873,  873,  873,\n      873,  873,  873,  873,  873,  873,  873,  873,  873,  873,\n      873,  873,  873,  873,  873,  873,  873,  873,  873,  873,\n\n      873, -657, -657, -657, -657, -657, -657, -657, -657, -657,\n     -657, -657, -657, -657, -657, -657, -657, -657, -657, -657,\n     -657, -657, -657, -657, -657, -657, -657, -657, -657, -657,\n     -657, -657, -657, -657, -657, -657, -657, -657\n    },\n\n    {\n       69, -658, -658, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658, -658, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658, -658, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658,  877, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658, -658, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658, -658, -658, -658, -658, -658, -658, -658, -658,\n\n     -658, -658, -658, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658, -658, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658, -658, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658, -658, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658, -658, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658, -658, -658, -658, -658, -658, -658, -658, -658,\n     -658, -658, -658, -658, -658, -658, -658, -658\n    },\n\n    {\n       69, -659, -659, -659, -659, -659, -659, -659, -659, -659,\n     -659, -659, -659, -659, -659, -659, -659, -659, -659, -659,\n     -659, -659, -659, -659, -659, -659, -659, -659, -659, -659,\n\n     -659, -659,  878, -659, -659, -659, -659, -659, -659, -659,\n     -659, -659, -659, -659, -659, -659, -659, -659,  879,  879,\n      879,  879,  879,  879,  879,  879,  879,  879, -659, -659,\n     -659, -659, -659, -659, -659,  878,  878,  878,  878,  878,\n      878,  878,  878,  878,  878,  878,  878,  878,  878,  878,\n      878,  878,  878,  878,  878,  878,  878,  878,  878,  878,\n      878, -659, -659, -659, -659, -659, -659, -659, -659, -659,\n     -659, -659, -659, -659, -659, -659, -659, -659, -659, -659,\n     -659, -659, -659, -659, -659, -659, -659, -659, -659, -659,\n     -659, -659, -659, -659, -659, -659, -659, -659\n\n    },\n\n    {\n       69, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660,  880, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660, -660, -660, -660, -660, -660, -660,  881,  882,\n      882,  882,  882,  882,  882,  882,  882,  882, -660, -660,\n     -660, -660, -660, -660, -660,  880,  880,  880,  880,  880,\n      880,  880,  880,  880,  880,  880,  880,  880,  880,  880,\n      880,  880,  880,  880,  880,  880,  880,  880,  880,  880,\n      880, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n\n     -660, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660, -660, -660, -660, -660, -660, -660\n    },\n\n    {\n       69, -661, -661, -661, -661, -661, -661, -661, -661, -661,\n     -661, -661, -661, -661, -661, -661, -661, -661, -661, -661,\n     -661, -661, -661, -661, -661, -661, -661, -661, -661, -661,\n     -661, -661,  880, -661, -661, -661, -661, -661, -661, -661,\n     -661, -661, -661, -661, -661, -661, -661, -661,  883,  883,\n      883,  883,  883,  883,  883,  883,  883,  883, -661, -661,\n     -661, -661, -661, -661, -661,  880,  880,  880,  880,  880,\n\n      880,  880,  880,  880,  880,  880,  880,  880,  880,  880,\n      880,  880,  880,  880,  880,  880,  880,  880,  880,  880,\n      880, -661, -661, -661, -661, -661, -661, -661, -661, -661,\n     -661, -661, -661, -661, -661, -661, -661, -661, -661, -661,\n     -661, -661, -661, -661, -661, -661, -661, -661, -661, -661,\n     -661, -661, -661, -661, -661, -661, -661, -661\n    },\n\n    {\n       69, -662, -662, -662, -662, -662, -662, -662, -662, -662,\n     -662, -662, -662, -662, -662, -662, -662, -662, -662, -662,\n     -662, -662, -662, -662, -662, -662, -662, -662, -662, -662,\n     -662, -662,  884, -662, -662, -662, -662, -662, -662, -662,\n\n     -662, -662, -662, -662, -662, -662, -662, -662, -662, -662,\n     -662, -662, -662, -662, -662, -662, -662, -662, -662, -662,\n     -662, -662, -662, -662, -662, -662, -662, -662, -662, -662,\n     -662, -662, -662, -662, -662, -662, -662, -662, -662, -662,\n     -662, -662, -662, -662, -662, -662, -662, -662, -662, -662,\n     -662, -662, -662, -662, -662, -662, -662, -662, -662, -662,\n     -662, -662, -662, -662, -662, -662, -662, -662, -662, -662,\n     -662, -662, -662, -662, -662, -662, -662, -662, -662, -662,\n     -662, -662, -662, -662, -662, -662, -662, -662\n    },\n\n    {\n       69, -663, -663, -663, -663, -663, -663, -663, -663, -663,\n\n     -663, -663, -663, -663, -663, -663, -663, -663, -663, -663,\n     -663, -663, -663, -663, -663, -663, -663, -663, -663, -663,\n     -663, -663,  885, -663, -663, -663, -663, -663, -663, -663,\n     -663, -663, -663, -663, -663, -663, -663, -663,  886,  887,\n      887,  887,  887,  887,  887,  887,  887,  887, -663, -663,\n     -663, -663, -663, -663, -663,  885,  885,  885,  885,  885,\n      885,  885,  885,  885,  885,  885,  885,  885,  885,  885,\n      885,  885,  885,  885,  885,  885,  885,  885,  885,  885,\n      885, -663, -663, -663, -663, -663, -663, -663, -663, -663,\n     -663, -663, -663, -663, -663, -663, -663, -663, -663, -663,\n\n     -663, -663, -663, -663, -663, -663, -663, -663, -663, -663,\n     -663, -663, -663, -663, -663, -663, -663, -663\n    },\n\n    {\n       69, -664, -664, -664, -664, -664, -664, -664, -664, -664,\n     -664, -664, -664, -664, -664, -664, -664, -664, -664, -664,\n     -664, -664, -664, -664, -664, -664, -664, -664, -664, -664,\n     -664, -664,  885, -664, -664, -664, -664, -664, -664, -664,\n     -664, -664, -664, -664, -664, -664, -664, -664,  888,  888,\n      888,  888,  888,  888,  888,  888,  888,  888, -664, -664,\n     -664, -664, -664, -664, -664,  885,  885,  885,  885,  885,\n      885,  885,  885,  885,  885,  885,  885,  885,  885,  885,\n\n      885,  885,  885,  885,  885,  885,  885,  885,  885,  885,\n      885, -664, -664, -664, -664, -664, -664, -664, -664, -664,\n     -664, -664, -664, -664, -664, -664, -664, -664, -664, -664,\n     -664, -664, -664, -664, -664, -664, -664, -664, -664, -664,\n     -664, -664, -664, -664, -664, -664, -664, -664\n    },\n\n    {\n       69, -665, -665, -665, -665, -665, -665, -665, -665, -665,\n     -665, -665, -665, -665, -665, -665, -665, -665, -665, -665,\n     -665, -665, -665, -665, -665, -665, -665, -665, -665, -665,\n     -665, -665,  889, -665, -665, -665, -665, -665, -665, -665,\n     -665, -665, -665, -665, -665, -665, -665, -665,  879,  879,\n\n      879,  879,  879,  879,  879,  879,  879,  879, -665, -665,\n     -665, -665, -665, -665, -665,  889,  889,  889,  889,  889,\n      889,  889,  889,  889,  889,  889,  889,  889,  889,  889,\n      889,  889,  889,  889,  889,  889,  889,  889,  889,  889,\n      889, -665, -665, -665, -665, -665, -665, -665, -665, -665,\n     -665, -665, -665, -665, -665, -665, -665, -665, -665, -665,\n     -665, -665, -665, -665, -665, -665, -665, -665, -665, -665,\n     -665, -665, -665, -665, -665, -665, -665, -665\n    },\n\n    {\n       69, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666,  890, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n     -666, -666, -666, -666, -666, -666, -666, -666, -666, -666,\n\n     -666, -666, -666, -666, -666, -666, -666, -666\n    },\n\n    {\n       69, -667, -667, -667, -667, -667, -667, -667, -667, -667,\n     -667, -667, -667, -667, -667, -667, -667, -667, -667, -667,\n     -667, -667, -667, -667, -667, -667, -667, -667, -667, -667,\n     -667, -667, -667, -667, -667, -667, -667, -667, -667, -667,\n     -667, -667, -667, -667, -667, -667, -667, -667,  891,  892,\n      892,  892,  892,  892,  892,  892,  892,  892, -667, -667,\n     -667, -667, -667, -667, -667, -667, -667, -667, -667, -667,\n     -667, -667, -667, -667, -667, -667, -667, -667, -667, -667,\n     -667, -667, -667, -667, -667, -667, -667, -667, -667, -667,\n\n     -667, -667, -667, -667, -667, -667, -667, -667, -667, -667,\n     -667, -667, -667, -667, -667, -667, -667, -667, -667, -667,\n     -667, -667, -667, -667, -667, -667, -667, -667, -667, -667,\n     -667, -667, -667, -667, -667, -667, -667, -667\n    },\n\n    {\n       69, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668,  893, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n\n     -668, -668, -668, -668, -668,  893,  893,  893,  893,  893,\n      893,  893,  893,  893,  893,  893,  893,  893,  893,  893,\n      893,  893,  893,  893,  893,  893,  893,  893,  893,  893,\n      893, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,\n     -668, -668, -668, -668, -668, -668, -668, -668\n    },\n\n    {\n       69, -669, -669, -669, -669, -669, -669, -669, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669, -669, -669,\n\n     -669, -669,  893, -669, -669, -669, -669, -669, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669,  894,  894,\n      894,  894,  894,  894,  894,  894,  894,  894, -669, -669,\n     -669, -669, -669, -669, -669,  893,  893,  893,  893,  893,\n      893,  893,  893,  893,  893,  893,  893,  893,  893,  893,\n      893,  893,  893,  893,  893,  893,  893,  893,  893,  893,\n      893, -669, -669, -669, -669, -669, -669, -669, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669\n\n    },\n\n    {\n       69, -670, -670, -670, -670, -670, -670, -670, -670, -670,\n     -670, -670, -670, -670, -670, -670, -670, -670, -670, -670,\n     -670, -670, -670, -670, -670, -670, -670, -670, -670, -670,\n     -670, -670,  895, -670, -670, -670, -670, -670, -670, -670,\n     -670, -670, -670, -670, -670, -670, -670, -670, -670, -670,\n     -670, -670, -670, -670, -670, -670, -670, -670, -670, -670,\n     -670, -670, -670, -670, -670, -670, -670, -670, -670, -670,\n     -670, -670, -670, -670, -670, -670, -670, -670, -670, -670,\n     -670, -670, -670, -670, -670, -670, -670, -670, -670, -670,\n     -670, -670, -670, -670, -670, -670, -670, -670, -670, -670,\n\n     -670, -670, -670, -670, -670, -670, -670, -670, -670, -670,\n     -670, -670, -670, -670, -670, -670, -670, -670, -670, -670,\n     -670, -670, -670, -670, -670, -670, -670, -670\n    },\n\n    {\n       69, -671, -671, -671, -671, -671, -671, -671, -671, -671,\n     -671, -671, -671, -671, -671, -671, -671, -671, -671, -671,\n     -671, -671, -671, -671, -671, -671, -671, -671, -671, -671,\n     -671, -671,  896, -671, -671, -671, -671, -671, -671, -671,\n     -671, -671, -671, -671, -671, -671, -671, -671,  897,  897,\n      897,  897,  897,  897,  897,  897,  897,  897, -671, -671,\n     -671, -671, -671, -671, -671,  896,  896,  896,  896,  896,\n\n      896,  896,  896,  896,  896,  896,  896,  896,  896,  896,\n      896,  896,  896,  896,  896,  896,  896,  896,  896,  896,\n      896, -671, -671, -671, -671, -671, -671, -671, -671, -671,\n     -671, -671, -671, -671, -671, -671, -671, -671, -671, -671,\n     -671, -671, -671, -671, -671, -671, -671, -671, -671, -671,\n     -671, -671, -671, -671, -671, -671, -671, -671\n    },\n\n    {\n       69, -672, -672, -672, -672, -672, -672, -672, -672, -672,\n     -672, -672, -672, -672, -672, -672, -672, -672, -672, -672,\n     -672, -672, -672, -672, -672, -672, -672, -672, -672, -672,\n     -672, -672, -672, -672, -672, -672, -672, -672, -672, -672,\n\n     -672, -672, -672, -672, -672, -672, -672, -672,  898,  898,\n      898,  898,  898,  898,  898,  898,  898,  898, -672, -672,\n     -672, -672, -672, -672, -672, -672, -672, -672, -672, -672,\n     -672, -672, -672, -672, -672, -672, -672, -672, -672, -672,\n     -672, -672, -672, -672, -672, -672, -672, -672, -672, -672,\n     -672, -672, -672, -672, -672, -672, -672, -672, -672, -672,\n     -672, -672, -672, -672, -672, -672, -672, -672, -672, -672,\n     -672, -672, -672, -672, -672, -672, -672, -672, -672, -672,\n     -672, -672, -672, -672, -672, -672, -672, -672\n    },\n\n    {\n       69, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n\n     -673, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n     -673, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n     -673, -673,  899, -673, -673, -673, -673, -673, -673, -673,\n     -673, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n     -673, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n     -673, -673, -673, -673, -673,  899,  899,  899,  899,  899,\n      899,  899,  899,  899,  899,  899,  899,  899,  899,  899,\n      899,  899,  899,  899,  899,  899,  899,  899,  899,  899,\n      899, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n     -673, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n\n     -673, -673, -673, -673, -673, -673, -673, -673, -673, -673,\n     -673, -673, -673, -673, -673, -673, -673, -673\n    },\n\n    {\n       69, -674, -674, -674, -674, -674, -674, -674, -674, -674,\n     -674, -674, -674, -674, -674, -674, -674, -674, -674, -674,\n     -674, -674, -674, -674, -674, -674, -674, -674, -674, -674,\n     -674, -674,  899, -674, -674, -674, -674, -674, -674, -674,\n     -674, -674, -674, -674, -674, -674, -674, -674,  900,  900,\n      900,  900,  900,  900,  900,  900,  900,  900, -674, -674,\n     -674, -674, -674, -674, -674,  899,  899,  899,  899,  899,\n      899,  899,  899,  899,  899,  899,  899,  899,  899,  899,\n\n      899,  899,  899,  899,  899,  899,  899,  899,  899,  899,\n      899, -674, -674, -674, -674, -674, -674, -674, -674, -674,\n     -674, -674, -674, -674, -674, -674, -674, -674, -674, -674,\n     -674, -674, -674, -674, -674, -674, -674, -674, -674, -674,\n     -674, -674, -674, -674, -674, -674, -674, -674\n    },\n\n    {\n       69, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675,  901, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n\n     -675, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675, -675, -675, -675, -675, -675, -675\n    },\n\n    {\n       69, -676, -676, -676, -676, -676, -676, -676, -676, -676,\n     -676, -676, -676, -676, -676, -676, -676, -676, -676, -676,\n\n     -676, -676, -676, -676, -676, -676, -676, -676, -676, -676,\n     -676, -676,  902, -676, -676, -676, -676, -676, -676, -676,\n     -676, -676, -676, -676, -676, -676, -676, -676,  903,  903,\n      903,  903,  903,  903,  903,  903,  903,  903, -676, -676,\n     -676, -676, -676, -676, -676,  902,  902,  902,  902,  902,\n      902,  902,  902,  902,  902,  902,  902,  902,  902,  902,\n      902,  902,  902,  902,  902,  902,  902,  902,  902,  902,\n      902, -676, -676, -676, -676, -676, -676, -676, -676, -676,\n     -676, -676, -676, -676, -676, -676, -676, -676, -676, -676,\n     -676, -676, -676, -676, -676, -676, -676, -676, -676, -676,\n\n     -676, -676, -676, -676, -676, -676, -676, -676\n    },\n\n    {\n       69, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n\n     -677, -677, -677, -677, -677,  904, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677, -677, -677,\n     -677, -677, -677, -677, -677, -677, -677, -677\n    },\n\n    {\n       69, -678, -678, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678, -678, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678, -678, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678, -678, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678, -678, -678, -678, -678, -678, -678,  905,  906,\n      906,  906,  906,  906,  906,  906,  906,  906, -678, -678,\n\n     -678, -678, -678, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678, -678, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678, -678, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678, -678, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678, -678, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678, -678, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678, -678, -678, -678, -678, -678, -678\n    },\n\n    {\n       69, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n\n     -679, -679,  907, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679,  907,  907,  907,  907,  907,\n      907,  907,  907,  907,  907,  907,  907,  907,  907,  907,\n      907,  907,  907,  907,  907,  907,  907,  907,  907,  907,\n      907, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679\n\n    },\n\n    {\n       69, -680, -680, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680, -680, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680, -680, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680,  907, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680, -680, -680, -680, -680, -680, -680,  908,  908,\n      908,  908,  908,  908,  908,  908,  908,  908, -680, -680,\n     -680, -680, -680, -680, -680,  907,  907,  907,  907,  907,\n      907,  907,  907,  907,  907,  907,  907,  907,  907,  907,\n      907,  907,  907,  907,  907,  907,  907,  907,  907,  907,\n      907, -680, -680, -680, -680, -680, -680, -680, -680, -680,\n\n     -680, -680, -680, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680, -680, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680, -680, -680, -680, -680, -680, -680\n    },\n\n    {\n       69, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681,  909, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681, -681\n    },\n\n    {\n       69, -682, -682, -682, -682, -682, -682, -682, -682, -682,\n     -682, -682, -682, -682, -682, -682, -682, -682, -682, -682,\n     -682, -682, -682, -682, -682, -682, -682, -682, -682, -682,\n     -682, -682,  910, -682, -682, -682, -682, -682, -682, -682,\n\n     -682, -682, -682, -682, -682, -682, -682, -682,  911,  911,\n      911,  911,  911,  911,  911,  911,  911,  911, -682, -682,\n     -682, -682, -682, -682, -682,  910,  910,  910,  910,  910,\n      910,  910,  910,  910,  910,  910,  910,  910,  910,  910,\n      910,  910,  910,  910,  910,  910,  910,  910,  910,  910,\n      910, -682, -682, -682, -682, -682, -682, -682, -682, -682,\n     -682, -682, -682, -682, -682, -682, -682, -682, -682, -682,\n     -682, -682, -682, -682, -682, -682, -682, -682, -682, -682,\n     -682, -682, -682, -682, -682, -682, -682, -682\n    },\n\n    {\n       69, -683, -683, -683, -683, -683, -683, -683, -683, -683,\n\n     -683, -683, -683, -683, -683, -683, -683, -683, -683, -683,\n     -683, -683, -683, -683, -683, -683, -683, -683, -683, -683,\n     -683, -683, -683, -683, -683, -683, -683, -683, -683, -683,\n     -683, -683, -683, -683, -683, -683, -683, -683,  912,  912,\n      912,  912,  912,  912,  912,  912,  912,  912, -683, -683,\n     -683, -683, -683, -683, -683, -683, -683, -683, -683, -683,\n     -683, -683, -683, -683, -683, -683, -683, -683, -683, -683,\n     -683, -683, -683, -683, -683, -683, -683, -683, -683, -683,\n     -683, -683, -683, -683, -683, -683, -683, -683, -683, -683,\n     -683, -683, -683, -683, -683, -683, -683, -683, -683, -683,\n\n     -683, -683, -683, -683, -683, -683, -683, -683, -683, -683,\n     -683, -683, -683, -683, -683, -683, -683, -683\n    },\n\n    {\n       69, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684,  913, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684,  913,  913,  913,  913,  913,\n      913,  913,  913,  913,  913,  913,  913,  913,  913,  913,\n\n      913,  913,  913,  913,  913,  913,  913,  913,  913,  913,\n      913, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684\n    },\n\n    {\n       69, -685, -685, -685, -685, -685, -685, -685, -685, -685,\n     -685, -685, -685, -685, -685, -685, -685, -685, -685, -685,\n     -685, -685, -685, -685, -685, -685, -685, -685, -685, -685,\n     -685, -685,  913, -685, -685, -685, -685, -685, -685, -685,\n     -685, -685, -685, -685, -685, -685, -685, -685,  914,  914,\n\n      914,  914,  914,  914,  914,  914,  914,  914, -685, -685,\n     -685, -685, -685, -685, -685,  913,  913,  913,  913,  913,\n      913,  913,  913,  913,  913,  913,  913,  913,  913,  913,\n      913,  913,  913,  913,  913,  913,  913,  913,  913,  913,\n      913, -685, -685, -685, -685, -685, -685, -685, -685, -685,\n     -685, -685, -685, -685, -685, -685, -685, -685, -685, -685,\n     -685, -685, -685, -685, -685, -685, -685, -685, -685, -685,\n     -685, -685, -685, -685, -685, -685, -685, -685\n    },\n\n    {\n       69, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n     -686, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n\n     -686, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n     -686, -686,  915, -686, -686, -686, -686, -686, -686, -686,\n     -686, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n     -686, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n     -686, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n     -686, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n     -686, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n     -686, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n     -686, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n     -686, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n\n     -686, -686, -686, -686, -686, -686, -686, -686\n    },\n\n    {\n       69, -687, -687, -687, -687, -687, -687, -687, -687, -687,\n     -687, -687, -687, -687, -687, -687, -687, -687, -687, -687,\n     -687, -687, -687, -687, -687, -687, -687, -687, -687, -687,\n     -687, -687,  916, -687, -687, -687, -687, -687, -687, -687,\n     -687, -687, -687, -687, -687, -687, -687, -687,  917,  917,\n      917,  917,  917,  917,  917,  917,  917,  917, -687, -687,\n     -687, -687, -687, -687, -687,  916,  916,  916,  916,  916,\n      916,  916,  916,  916,  916,  916,  916,  916,  916,  916,\n      916,  916,  916,  916,  916,  916,  916,  916,  916,  916,\n\n      916, -687, -687, -687, -687, -687, -687, -687, -687, -687,\n     -687, -687, -687, -687, -687, -687, -687, -687, -687, -687,\n     -687, -687, -687, -687, -687, -687, -687, -687, -687, -687,\n     -687, -687, -687, -687, -687, -687, -687, -687\n    },\n\n    {\n       69, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688, -688, -688,\n     -688, -688, -688, -688, -688, -688, -688, -688\n    },\n\n    {\n       69, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689, -689, -689,\n     -689, -689, -689, -689, -689, -689, -689, -689\n\n    },\n\n    {\n       69, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n     -690, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n     -690, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n     -690, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n     -690, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n     -690, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n     -690, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n     -690, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n     -690, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n     -690, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n\n     -690, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n     -690, -690, -690, -690, -690, -690, -690, -690, -690, -690,\n     -690, -690, -690, -690, -690, -690, -690, -690\n    },\n\n    {\n       69, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691, -691, -691,\n     -691, -691, -691, -691, -691, -691, -691, -691\n    },\n\n    {\n       69, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n     -692, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n     -692, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n     -692, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n\n     -692, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n     -692, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n     -692, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n     -692, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n     -692, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n     -692, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n     -692, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n     -692, -692, -692, -692, -692, -692, -692, -692, -692, -692,\n     -692, -692, -692, -692, -692, -692, -692, -692\n    },\n\n    {\n       69, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n\n     -693, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n     -693, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n     -693, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n     -693, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n     -693, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n     -693, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n     -693, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n     -693, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n     -693, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n     -693, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n\n     -693, -693, -693, -693, -693, -693, -693, -693, -693, -693,\n     -693, -693, -693, -693, -693, -693, -693, -693\n    },\n\n    {\n       69, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694\n    },\n\n    {\n       69, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n\n     -695, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695\n    },\n\n    {\n       69,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      695,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  696,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  697,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n      496,  496,  496,  496,  496,  496,  496,  496,  496,  496,\n\n      496,  496,  496,  496,  496,  496,  496,  496\n    },\n\n    {\n       69,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      919,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  920,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  921,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918\n    },\n\n    {\n       69,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      699,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  700,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  701,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698\n    },\n\n    {\n       69, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n\n     -699, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699\n\n    },\n\n    {\n       69,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      699,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  700,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  701,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698\n    },\n\n    {\n       69,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      699,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  700,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  701,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,\n      698,  698,  698,  698,  698,  698,  698,  698\n    },\n\n    {\n       69,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      703,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  704,  702,  702,  702,  702,  702,  702,  702,\n\n      702,  702,  702,  702,  702,  702,  702,  705,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702\n    },\n\n    {\n       69, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n\n     -703, -703, -703, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703\n    },\n\n    {\n       69,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      703,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  704,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  705,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702\n    },\n\n    {\n       69,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      703,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  704,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  705,  702,  702,\n\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,\n      702,  702,  702,  702,  702,  702,  702,  702\n    },\n\n    {\n       69, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n     -706, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n\n     -706, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n     -706, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n     -706, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n     -706, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n     -706, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n     -706, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n     -706, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n     -706, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n     -706, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n     -706, -706, -706, -706, -706, -706, -706, -706, -706, -706,\n\n     -706, -706, -706, -706, -706, -706, -706, -706\n    },\n\n    {\n       69, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n\n     -707, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707\n    },\n\n    {\n       69, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n\n     -708, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708\n    },\n\n    {\n       69, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709, -709, -709,\n     -709, -709, -709, -709, -709, -709, -709, -709\n\n    },\n\n    {\n       69, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710\n    },\n\n    {\n       69, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n\n     -711, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711\n    },\n\n    {\n       69, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n     -712, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n     -712, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n     -712, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n\n     -712, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n     -712, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n     -712, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n     -712, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n     -712, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n     -712, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n     -712, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n     -712, -712, -712, -712, -712, -712, -712, -712, -712, -712,\n     -712, -712, -712, -712, -712, -712, -712, -712\n    },\n\n    {\n       69, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n\n     -713, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n     -713, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n     -713, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n     -713, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n     -713, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n     -713, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n     -713, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n     -713, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n     -713, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n     -713, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n\n     -713, -713, -713, -713, -713, -713, -713, -713, -713, -713,\n     -713, -713, -713, -713, -713, -713, -713, -713\n    },\n\n    {\n       69, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714\n    },\n\n    {\n       69, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715, -715, -715,\n     -715, -715, -715, -715, -715, -715, -715, -715\n    },\n\n    {\n       69, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n     -716, -716, -716, -716, -716, -716, -716, -716, -716, -716,\n\n     -716, -716, -716, -716, -716, -716, -716, -716\n    },\n\n    {\n       69, -717, -717, -717, -717, -717, -717, -717, -717, -717,\n     -717, -717, -717, -717, -717, -717, -717, -717, -717, -717,\n     -717, -717, -717, -717, -717, -717, -717, -717, -717, -717,\n     -717, -717, -717, -717, -717, -717, -717, -717, -717, -717,\n     -717, -717, -717, -717, -717, -717, -717, -717, -717, -717,\n     -717, -717, -717, -717, -717, -717, -717, -717, -717, -717,\n     -717, -717, -717, -717, -717, -717, -717, -717, -717, -717,\n     -717, -717,  922, -717, -717, -717, -717, -717, -717, -717,\n     -717, -717, -717, -717, -717, -717, -717, -717, -717, -717,\n\n     -717, -717, -717, -717, -717, -717, -717, -717, -717, -717,\n     -717, -717, -717, -717, -717, -717, -717, -717, -717, -717,\n     -717, -717, -717, -717, -717, -717, -717, -717, -717, -717,\n     -717, -717, -717, -717, -717, -717, -717, -717\n    },\n\n    {\n       69, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718\n    },\n\n    {\n       69, -719, -719, -719, -719, -719, -719, -719, -719, -719,\n     -719, -719, -719, -719, -719, -719, -719, -719, -719, -719,\n     -719, -719, -719, -719, -719, -719, -719, -719, -719, -719,\n\n     -719, -719, -719, -719, -719, -719, -719, -719, -719, -719,\n     -719, -719, -719, -719, -719, -719, -719, -719, -719, -719,\n     -719, -719, -719, -719, -719, -719, -719, -719, -719, -719,\n     -719, -719, -719, -719, -719, -719, -719, -719, -719, -719,\n     -719, -719, -719, -719, -719, -719, -719, -719, -719, -719,\n     -719, -719, -719, -719, -719, -719, -719, -719, -719, -719,\n     -719, -719, -719, -719, -719, -719, -719, -719, -719, -719,\n     -719, -719, -719, -719, -719, -719, -719, -719, -719, -719,\n     -719, -719, -719, -719, -719, -719, -719, -719, -719, -719,\n     -719, -719, -719, -719, -719, -719, -719, -719\n\n    },\n\n    {\n       69, -720, -720, -720, -720, -720, -720, -720, -720, -720,\n     -720, -720, -720, -720, -720, -720, -720, -720, -720, -720,\n     -720, -720, -720, -720, -720, -720, -720, -720, -720, -720,\n     -720, -720, -720, -720, -720, -720, -720, -720, -720, -720,\n     -720, -720, -720, -720, -720, -720, -720, -720, -720, -720,\n     -720, -720, -720, -720, -720, -720, -720, -720, -720, -720,\n     -720, -720, -720, -720, -720, -720, -720, -720, -720, -720,\n     -720, -720, -720, -720, -720, -720, -720, -720, -720, -720,\n     -720, -720, -720, -720, -720, -720, -720, -720, -720, -720,\n     -720, -720, -720, -720, -720, -720, -720, -720, -720, -720,\n\n     -720, -720, -720, -720, -720, -720, -720, -720, -720, -720,\n     -720, -720, -720, -720, -720, -720, -720, -720, -720, -720,\n     -720, -720, -720, -720, -720, -720, -720, -720\n    },\n\n    {\n       69, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721, -721, -721,\n     -721, -721, -721, -721, -721, -721, -721, -721\n    },\n\n    {\n       69, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722,  923,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722, -722, -722,\n     -722, -722, -722, -722, -722, -722, -722, -722\n    },\n\n    {\n       69, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723, -723,  924,\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n\n     -723, -723, -723, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723\n    },\n\n    {\n       69, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724, -724, -724,\n     -724, -724, -724, -724, -724, -724, -724, -724\n    },\n\n    {\n       69, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725, -725, -725,\n     -725, -725, -725, -725, -725, -725, -725, -725\n    },\n\n    {\n       69, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n     -726, -726, -726, -726, -726, -726, -726, -726, -726, -726,\n\n     -726, -726, -726, -726, -726, -726, -726, -726\n    },\n\n    {\n       69, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727, -727, -727,\n     -727, -727, -727, -727, -727, -727, -727, -727\n    },\n\n    {\n       69, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728, -728, -728,\n     -728, -728, -728, -728, -728, -728, -728, -728\n    },\n\n    {\n       69, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729, -729, -729,\n     -729, -729, -729, -729, -729, -729, -729, -729\n\n    },\n\n    {\n       69, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730, -730, -730,\n     -730, -730, -730, -730, -730, -730, -730, -730\n    },\n\n    {\n       69, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731,  925,  926, -731, -731,  927,\n\n     -731, -731, -731, -731, -731, -731, -731, -731, -731,  928,\n     -731, -731,  929, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731, -731, -731,\n     -731, -731, -731, -731, -731, -731, -731, -731\n    },\n\n    {\n       69, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732,  930,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732, -732, -732,\n     -732, -732, -732, -732, -732, -732, -732, -732\n    },\n\n    {\n       69, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n     -733, -733,  931, -733, -733, -733, -733, -733, -733, -733,\n     -733, -733, -733, -733, -733, -733, -733, -733,  932,  932,\n      932,  932,  932,  932,  932,  932,  932,  932, -733, -733,\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n\n     -733, -733, -733, -733, -733, -733, -733, -733, -733, -733,\n     -733, -733, -733, -733, -733, -733, -733, -733\n    },\n\n    {\n       69, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734,  933,\n\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734\n    },\n\n    {\n       69, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735,  934, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735\n    },\n\n    {\n       69, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n     -736, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n\n     -736, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n     -736, -736,  935, -736, -736, -736, -736, -736, -736, -736,\n     -736, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n     -736, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n     -736, -736, -736, -736, -736,  935,  935,  935,  935,  935,\n      935,  935,  935,  935,  935,  935,  935,  935,  935,  935,\n      935,  935,  935,  935,  935,  935,  935,  935,  935,  935,\n      935, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n     -736, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n     -736, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n\n     -736, -736, -736, -736, -736, -736, -736, -736\n    },\n\n    {\n       69, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737,  936,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737, -737, -737,\n     -737, -737, -737, -737, -737, -737, -737, -737\n    },\n\n    {\n       69, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738,  937,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738\n    },\n\n    {\n       69, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739,  938,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739\n\n    },\n\n    {\n       69, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n      939, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740, -740, -740,\n     -740, -740, -740, -740, -740, -740, -740, -740\n    },\n\n    {\n       69, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741,  940, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n\n      941, -741, -741,  942, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741\n    },\n\n    {\n       69, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742,  943, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742, -742, -742,\n     -742, -742, -742, -742, -742, -742, -742, -742\n    },\n\n    {\n       69, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743,  944, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n\n     -743, -743, -743, -743, -743, -743, -743, -743, -743, -743,\n     -743, -743, -743, -743, -743, -743, -743, -743\n    },\n\n    {\n       69, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744,  945, -744, -744, -744,\n\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744\n    },\n\n    {\n       69, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745,  946, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745\n    },\n\n    {\n       69, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746,  947,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746, -746, -746,\n\n     -746, -746, -746, -746, -746, -746, -746, -746\n    },\n\n    {\n       69, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747,  948, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747, -747, -747,\n     -747, -747, -747, -747, -747, -747, -747, -747\n    },\n\n    {\n       69, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n\n     -748, -748, -748, -748, -748, -748,  949, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748\n    },\n\n    {\n       69, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749,  950,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749\n\n    },\n\n    {\n       69, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750\n    },\n\n    {\n       69, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n\n      951, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751, -751, -751,\n     -751, -751, -751, -751, -751, -751, -751, -751\n    },\n\n    {\n       69, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n\n     -752, -752, -752, -752, -752, -752, -752, -752, -752,  952,\n      952,  952,  952,  952,  952,  952,  952,  952, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752, -752, -752,\n     -752, -752, -752, -752, -752, -752, -752, -752\n    },\n\n    {\n       69, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753, -753,  953,\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n\n     -753, -753, -753, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753\n    },\n\n    {\n       69, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754,  954,\n      954,  954,  954,  954,  954,  954,  954,  954, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754, -754, -754,\n     -754, -754, -754, -754, -754, -754, -754, -754\n    },\n\n    {\n       69, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755,  955,\n\n      955,  955,  955,  955,  955,  955,  955,  955, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755\n    },\n\n    {\n       69, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756, -756, -756,\n\n     -756, -756, -756, -756, -756, -756, -756, -756\n    },\n\n    {\n       69, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757\n    },\n\n    {\n       69, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758, -758, -758,\n     -758, -758, -758, -758, -758, -758, -758, -758\n    },\n\n    {\n       69, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759,  956, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759, -759, -759,\n     -759, -759, -759, -759, -759, -759, -759, -759\n\n    },\n\n    {\n       69, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760,  957,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760\n    },\n\n    {\n       69, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761\n    },\n\n    {\n       69, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762,  958, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762, -762, -762,\n     -762, -762, -762, -762, -762, -762, -762, -762\n    },\n\n    {\n       69, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763, -763,  959,\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n\n     -763, -763, -763, -763, -763, -763, -763, -763, -763, -763,\n     -763, -763, -763, -763, -763, -763, -763, -763\n    },\n\n    {\n       69, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n\n     -764, -764,  960, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764, -764, -764,\n     -764, -764, -764, -764, -764, -764, -764, -764\n    },\n\n    {\n       69, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765,  961, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765, -765, -765,\n     -765, -765, -765, -765, -765, -765, -765, -765\n    },\n\n    {\n       69, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766,  962, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766, -766, -766,\n\n     -766, -766, -766, -766, -766, -766, -766, -766\n    },\n\n    {\n       69, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767,  963,\n\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767, -767, -767,\n     -767, -767, -767, -767, -767, -767, -767, -767\n    },\n\n    {\n       69, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n\n     -768, -768, -768, -768, -768, -768,  964, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768\n    },\n\n    {\n       69, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769,  965, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769, -769, -769,\n     -769, -769, -769, -769, -769, -769, -769, -769\n\n    },\n\n    {\n       69, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770, -770, -770,\n     -770, -770, -770, -770, -770, -770, -770, -770\n    },\n\n    {\n       69, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771\n    },\n\n    {\n       69, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772, -772, -772,\n     -772, -772, -772, -772, -772, -772, -772, -772\n    },\n\n    {\n       69, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n\n     -773, -773, -773, -773, -773, -773, -773, -773, -773, -773,\n     -773, -773, -773, -773, -773, -773, -773, -773\n    },\n\n    {\n       69, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774, -774, -774,\n     -774, -774, -774, -774, -774, -774, -774, -774\n    },\n\n    {\n       69, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775, -775, -775,\n     -775, -775, -775, -775, -775, -775, -775, -775\n    },\n\n    {\n       69, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n     -776, -776, -776, -776, -776, -776, -776, -776, -776, -776,\n\n     -776, -776, -776, -776, -776, -776, -776, -776\n    },\n\n    {\n       69, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777, -777, -777,\n     -777, -777, -777, -777, -777, -777, -777, -777\n    },\n\n    {\n       69, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778, -778, -778,\n     -778, -778, -778, -778, -778, -778, -778, -778\n    },\n\n    {\n       69, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779, -779, -779,\n     -779, -779, -779, -779, -779, -779, -779, -779\n\n    },\n\n    {\n       69, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780\n    },\n\n    {\n       69, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781,  966, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781, -781, -781,\n     -781, -781, -781, -781, -781, -781, -781, -781\n    },\n\n    {\n       69, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782,  967, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782, -782, -782,\n     -782, -782, -782, -782, -782, -782, -782, -782\n    },\n\n    {\n       69, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783, -783,  968,\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n\n     -783, -783, -783, -783, -783, -783, -783, -783, -783, -783,\n     -783, -783, -783, -783, -783, -783, -783, -783\n    },\n\n    {\n       69, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n      969, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784, -784, -784,\n     -784, -784, -784, -784, -784, -784, -784, -784\n    },\n\n    {\n       69, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785,  970, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785\n    },\n\n    {\n       69, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786,  971,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n     -786, -786, -786, -786, -786, -786, -786, -786, -786, -786,\n\n     -786, -786, -786, -786, -786, -786, -786, -786\n    },\n\n    {\n       69, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787,  972, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787, -787, -787,\n     -787, -787, -787, -787, -787, -787, -787, -787\n    },\n\n    {\n       69, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n\n     -788, -788, -788, -788, -788, -788, -788, -788, -788,  973,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788, -788, -788,\n     -788, -788, -788, -788, -788, -788, -788, -788\n    },\n\n    {\n       69, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789,  974,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789, -789, -789,\n     -789, -789, -789, -789, -789, -789, -789, -789\n\n    },\n\n    {\n       69, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n\n     -790, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790, -790, -790, -790, -790, -790,\n     -790, -790, -790, -790, -790, -790, -790, -790\n    },\n\n    {\n       69, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n\n     -791, -791, -791,  975, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791, -791, -791,\n     -791, -791, -791, -791, -791, -791, -791, -791\n    },\n\n    {\n       69, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792,  976,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792, -792, -792,\n     -792, -792, -792, -792, -792, -792, -792, -792\n    },\n\n    {\n       69, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n\n     -793, -793, -793, -793, -793, -793, -793, -793, -793, -793,\n     -793, -793, -793, -793, -793, -793, -793, -793\n    },\n\n    {\n       69, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n\n     -794, -794, -794, -794,  977, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794, -794, -794,\n     -794, -794, -794, -794, -794, -794, -794, -794\n    },\n\n    {\n       69, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795,  978, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795, -795, -795,\n     -795, -795, -795, -795, -795, -795, -795, -795\n    },\n\n    {\n       69, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796,  979, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n\n     -796, -796, -796, -796, -796, -796, -796, -796\n    },\n\n    {\n       69, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797,  980,\n\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797, -797, -797,\n     -797, -797, -797, -797, -797, -797, -797, -797\n    },\n\n    {\n       69, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n      981, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798, -798, -798,\n     -798, -798, -798, -798, -798, -798, -798, -798\n    },\n\n    {\n       69, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n\n     -799, -799,  982, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799,  983,  983,\n      983,  983,  983,  983,  983,  983,  983,  983, -799, -799,\n     -799, -799, -799, -799, -799,  982,  982,  982,  982,  982,\n      982,  982,  982,  982,  982,  982,  982,  982,  982,  982,\n      982,  982,  982,  982,  982,  982,  982,  982,  982,  982,\n      982, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799\n\n    },\n\n    {\n       69, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800,  984, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800, -800, -800,\n     -800, -800, -800, -800, -800, -800, -800, -800\n    },\n\n    {\n       69, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801,  985, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801, -801, -801, -801, -801, -801, -801,  986,  986,\n      986,  986,  986,  986,  986,  986,  986,  986, -801, -801,\n     -801, -801, -801, -801, -801,  985,  985,  985,  985,  985,\n\n      985,  985,  985,  985,  985,  985,  985,  985,  985,  985,\n      985,  985,  985,  985,  985,  985,  985,  985,  985,  985,\n      985, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801, -801, -801, -801, -801, -801, -801, -801, -801,\n     -801, -801, -801, -801, -801, -801, -801, -801\n    },\n\n    {\n       69, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802,  987,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802, -802, -802,\n     -802, -802, -802, -802, -802, -802, -802, -802\n    },\n\n    {\n       69, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803,  988, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n\n     -803, -803, -803, -803, -803, -803, -803, -803, -803, -803,\n     -803, -803, -803, -803, -803, -803, -803, -803\n    },\n\n    {\n       69, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804,  989, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804, -804, -804, -804, -804, -804, -804,  990,  990,\n      990,  990,  990,  990,  990,  990,  990,  990, -804, -804,\n     -804, -804, -804, -804, -804,  989,  989,  989,  989,  989,\n      989,  989,  989,  989,  989,  989,  989,  989,  989,  989,\n\n      989,  989,  989,  989,  989,  989,  989,  989,  989,  989,\n      989, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804, -804, -804, -804, -804, -804, -804, -804, -804,\n     -804, -804, -804, -804, -804, -804, -804, -804\n    },\n\n    {\n       69, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805,  991, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805, -805, -805, -805, -805, -805, -805,  992,  992,\n\n      992,  992,  992,  992,  992,  992,  992,  992, -805, -805,\n     -805, -805, -805, -805, -805,  991,  991,  991,  991,  991,\n      991,  991,  991,  991,  991,  991,  991,  991,  991,  991,\n      991,  991,  991,  991,  991,  991,  991,  991,  991,  991,\n      991, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805, -805, -805, -805, -805, -805, -805, -805, -805,\n     -805, -805, -805, -805, -805, -805, -805, -805\n    },\n\n    {\n       69, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806,  993, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n     -806, -806, -806, -806, -806, -806, -806, -806, -806, -806,\n\n     -806, -806, -806, -806, -806, -806, -806, -806\n    },\n\n    {\n       69, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807,  994, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807, -807, -807,\n     -807, -807, -807, -807, -807, -807, -807, -807\n    },\n\n    {\n       69, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808,  995, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808, -808, -808,\n     -808, -808, -808, -808, -808, -808, -808, -808\n    },\n\n    {\n       69, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n\n     -809, -809,  996, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809, -809, -809,\n     -809, -809, -809, -809, -809, -809, -809, -809\n\n    },\n\n    {\n       69, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n     -810, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n     -810, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n     -810, -810,  997, -810, -810, -810, -810, -810, -810, -810,\n     -810, -810, -810, -810, -810, -810, -810, -810,  998,  998,\n      998,  998,  998,  998,  998,  998,  998,  998, -810, -810,\n     -810, -810, -810, -810, -810,  997,  997,  997,  997,  997,\n      997,  997,  997,  997,  997,  997,  997,  997,  997,  997,\n      997,  997,  997,  997,  997,  997,  997,  997,  997,  997,\n      997, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n\n     -810, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n     -810, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n     -810, -810, -810, -810, -810, -810, -810, -810\n    },\n\n    {\n       69, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811,  999, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811, -811, -811,\n     -811, -811, -811, -811, -811, -811, -811, -811\n    },\n\n    {\n       69, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n     -812, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n     -812, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n     -812, -812, 1000, -812, -812, -812, -812, -812, -812, -812,\n\n     -812, -812, -812, -812, -812, -812, -812, -812, 1001, 1001,\n     1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, -812, -812,\n     -812, -812, -812, -812, -812, 1000, 1000, 1000, 1000, 1000,\n     1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000,\n     1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000,\n     1000, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n     -812, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n     -812, -812, -812, -812, -812, -812, -812, -812, -812, -812,\n     -812, -812, -812, -812, -812, -812, -812, -812\n    },\n\n    {\n       69, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n\n     -813, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n     -813, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n     -813, -813, 1002, -813, -813, -813, -813, -813, -813, -813,\n     -813, -813, -813, -813, -813, -813, -813, -813, 1003, 1003,\n     1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, -813, -813,\n     -813, -813, -813, -813, -813, 1002, 1002, 1002, 1002, 1002,\n     1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002,\n     1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002,\n     1002, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n     -813, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n\n     -813, -813, -813, -813, -813, -813, -813, -813, -813, -813,\n     -813, -813, -813, -813, -813, -813, -813, -813\n    },\n\n    {\n       69, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, 1004, 1004,\n     1004, 1004, 1004, 1004, 1004, 1004, 1004, 1004, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814, -814, -814,\n     -814, -814, -814, -814, -814, -814, -814, -814\n    },\n\n    {\n       69, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, 1005, 1005,\n\n     1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815, -815, -815,\n     -815, -815, -815, -815, -815, -815, -815, -815\n    },\n\n    {\n       69, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, 1006, 1006,\n     1006, 1006, 1006, 1006, 1006, 1006, 1006, 1006, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n     -816, -816, -816, -816, -816, -816, -816, -816, -816, -816,\n\n     -816, -816, -816, -816, -816, -816, -816, -816\n    },\n\n    {\n       69, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, 1006, 1007,\n     1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817, -817, -817,\n     -817, -817, -817, -817, -817, -817, -817, -817\n    },\n\n    {\n       69, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, 1008, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, -818, -818, -818, -818, -818, -818, 1009, 1009,\n     1009, 1009, 1009, 1009, 1009, 1009, 1009, 1009, -818, -818,\n\n     -818, -818, -818, -818, -818, 1008, 1008, 1008, 1008, 1008,\n     1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008,\n     1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008,\n     1008, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, -818, -818, -818, -818, -818, -818, -818, -818,\n     -818, -818, -818, -818, -818, -818, -818, -818\n    },\n\n    {\n       69, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, 1006, 1010,\n     1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819, -819, -819,\n     -819, -819, -819, -819, -819, -819, -819, -819\n\n    },\n\n    {\n       69, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, 1008, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, -820, -820, -820, -820, -820, -820, 1009, 1011,\n     1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, -820, -820,\n     -820, -820, -820, -820, -820, 1008, 1008, 1008, 1008, 1008,\n     1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008,\n     1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008,\n     1008, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n\n     -820, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, -820, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, -820, -820, -820, -820, -820, -820\n    },\n\n    {\n       69, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, 1012, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, -821, -821, -821, -821, -821, -821, 1013, 1013,\n     1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, -821, -821,\n     -821, -821, -821, -821, -821, 1012, 1012, 1012, 1012, 1012,\n\n     1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012,\n     1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012,\n     1012, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, -821, -821, -821, -821, -821, -821, -821, -821,\n     -821, -821, -821, -821, -821, -821, -821, -821\n    },\n\n    {\n       69, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, 1014, -822, -822, -822, -822, -822, -822, -822,\n\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822, -822, -822,\n     -822, -822, -822, -822, -822, -822, -822, -822\n    },\n\n    {\n       69, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n\n     -823, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n     -823, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n     -823, -823, 1015, -823, -823, -823, -823, -823, -823, -823,\n     -823, -823, -823, -823, -823, -823, -823, -823, 1016, 1016,\n     1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, -823, -823,\n     -823, -823, -823, -823, -823, 1015, 1015, 1015, 1015, 1015,\n     1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015,\n     1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015,\n     1015, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n     -823, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n\n     -823, -823, -823, -823, -823, -823, -823, -823, -823, -823,\n     -823, -823, -823, -823, -823, -823, -823, -823\n    },\n\n    {\n       69, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, 1008, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, -824, -824, -824, -824, -824, -824, 1009, 1017,\n     1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, -824, -824,\n     -824, -824, -824, -824, -824, 1008, 1008, 1008, 1008, 1008,\n     1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008,\n\n     1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008,\n     1008, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, -824, -824, -824, -824, -824, -824, -824, -824,\n     -824, -824, -824, -824, -824, -824, -824, -824\n    },\n\n    {\n       69, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, 1018, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, -825, -825, -825, -825, -825, -825, 1019, 1019,\n\n     1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, -825, -825,\n     -825, -825, -825, -825, -825, 1018, 1018, 1018, 1018, 1018,\n     1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018,\n     1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018, 1018,\n     1018, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, -825, -825, -825, -825, -825, -825, -825, -825,\n     -825, -825, -825, -825, -825, -825, -825, -825\n    },\n\n    {\n       69, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n     -826, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n\n     -826, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n     -826, -826, 1015, -826, -826, -826, -826, -826, -826, -826,\n     -826, -826, -826, -826, -826, -826, -826, -826, 1016, 1020,\n     1020, 1020, 1020, 1020, 1020, 1020, 1020, 1020, -826, -826,\n     -826, -826, -826, -826, -826, 1015, 1015, 1015, 1015, 1015,\n     1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015,\n     1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015,\n     1015, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n     -826, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n     -826, -826, -826, -826, -826, -826, -826, -826, -826, -826,\n\n     -826, -826, -826, -826, -826, -826, -826, -826\n    },\n\n    {\n       69, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, 1021, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827, 1022, 1022,\n     1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, -827, -827,\n     -827, -827, -827, -827, -827, 1021, 1021, 1021, 1021, 1021,\n     1021, 1021, 1021, 1021, 1021, 1021, 1021, 1021, 1021, 1021,\n     1021, 1021, 1021, 1021, 1021, 1021, 1021, 1021, 1021, 1021,\n\n     1021, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827\n    },\n\n    {\n       69, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, 1023, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828, -828, -828,\n     -828, -828, -828, -828, -828, -828, -828, -828\n    },\n\n    {\n       69, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n\n     -829, -829, 1024, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829, 1016, 1016,\n     1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, -829, -829,\n     -829, -829, -829, -829, -829, 1024, 1024, 1024, 1024, 1024,\n     1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n     1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n     1024, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829\n\n    },\n\n    {\n       69, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, 1025, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830, -830, -830,\n     -830, -830, -830, -830, -830, -830, -830, -830\n    },\n\n    {\n       69, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, 1026, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831, -831, -831,\n     -831, -831, -831, -831, -831, -831, -831, -831\n    },\n\n    {\n       69, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n     -832, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n     -832, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n     -832, -832, 1027, -832, -832, -832, -832, -832, -832, -832,\n\n     -832, -832, -832, -832, -832, -832, -832, -832, 1028, 1028,\n     1028, 1028, 1028, 1028, 1028, 1028, 1028, 1028, -832, -832,\n     -832, -832, -832, -832, -832, 1027, 1027, 1027, 1027, 1027,\n     1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027,\n     1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027,\n     1027, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n     -832, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n     -832, -832, -832, -832, -832, -832, -832, -832, -832, -832,\n     -832, -832, -832, -832, -832, -832, -832, -832\n    },\n\n    {\n       69, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n\n     -833, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n     -833, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n     -833, -833, 1015, -833, -833, -833, -833, -833, -833, -833,\n     -833, -833, -833, -833, -833, -833, -833, -833, 1016, 1029,\n     1029, 1029, 1029, 1029, 1029, 1029, 1029, 1029, -833, -833,\n     -833, -833, -833, -833, -833, 1015, 1015, 1015, 1015, 1015,\n     1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015,\n     1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015,\n     1015, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n     -833, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n\n     -833, -833, -833, -833, -833, -833, -833, -833, -833, -833,\n     -833, -833, -833, -833, -833, -833, -833, -833\n    },\n\n    {\n       69, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, 1030, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, -834, -834, -834, -834, -834, -834, 1031, 1031,\n     1031, 1031, 1031, 1031, 1031, 1031, 1031, 1031, -834, -834,\n     -834, -834, -834, -834, -834, 1030, 1030, 1030, 1030, 1030,\n     1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030,\n\n     1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030,\n     1030, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, -834, -834, -834, -834, -834, -834, -834, -834,\n     -834, -834, -834, -834, -834, -834, -834, -834\n    },\n\n    {\n       69, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, 1032, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835, -835, -835,\n     -835, -835, -835, -835, -835, -835, -835, -835\n    },\n\n    {\n       69, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n     -836, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n\n     -836, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n     -836, -836, 1033, -836, -836, -836, -836, -836, -836, -836,\n     -836, -836, -836, -836, -836, -836, -836, -836, 1016, 1016,\n     1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, -836, -836,\n     -836, -836, -836, -836, -836, 1033, 1033, 1033, 1033, 1033,\n     1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033,\n     1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033,\n     1033, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n     -836, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n     -836, -836, -836, -836, -836, -836, -836, -836, -836, -836,\n\n     -836, -836, -836, -836, -836, -836, -836, -836\n    },\n\n    {\n       69, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, 1027, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, -837, -837, -837, -837, -837, -837, 1028, 1034,\n     1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, -837, -837,\n     -837, -837, -837, -837, -837, 1027, 1027, 1027, 1027, 1027,\n     1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027,\n     1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027,\n\n     1027, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, -837, -837, -837, -837, -837, -837, -837, -837,\n     -837, -837, -837, -837, -837, -837, -837, -837\n    },\n\n    {\n       69, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, 1035, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, -838, -838, -838, -838, -838, -838, 1036, 1036,\n     1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, -838, -838,\n\n     -838, -838, -838, -838, -838, 1035, 1035, 1035, 1035, 1035,\n     1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035,\n     1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035,\n     1035, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, -838, -838, -838, -838, -838, -838, -838, -838,\n     -838, -838, -838, -838, -838, -838, -838, -838\n    },\n\n    {\n       69, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n\n     -839, -839, 1037, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839, -839, -839,\n     -839, -839, -839, -839, -839, -839, -839, -839\n\n    },\n\n    {\n       69, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n     -840, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n     -840, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n     -840, -840, 1038, -840, -840, -840, -840, -840, -840, -840,\n     -840, -840, -840, -840, -840, -840, -840, -840, 1028, 1028,\n     1028, 1028, 1028, 1028, 1028, 1028, 1028, 1028, -840, -840,\n     -840, -840, -840, -840, -840, 1038, 1038, 1038, 1038, 1038,\n     1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,\n     1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,\n     1038, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n\n     -840, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n     -840, -840, -840, -840, -840, -840, -840, -840, -840, -840,\n     -840, -840, -840, -840, -840, -840, -840, -840\n    },\n\n    {\n       69, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, 1039, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841, -841, -841,\n     -841, -841, -841, -841, -841, -841, -841, -841\n    },\n\n    {\n       69, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, 1040, -842, -842, -842, -842, -842, -842, -842,\n\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842, -842, -842,\n     -842, -842, -842, -842, -842, -842, -842, -842\n    },\n\n    {\n       69, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, 1041,\n     1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n\n     -843, -843, -843, -843, -843, -843, -843, -843, -843, -843,\n     -843, -843, -843, -843, -843, -843, -843, -843\n    },\n\n    {\n       69, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, 1042, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, -844, -844, -844, -844, -844, -844, 1043, 1043,\n     1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, -844, -844,\n     -844, -844, -844, -844, -844, 1042, 1042, 1042, 1042, 1042,\n     1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042,\n\n     1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042,\n     1042, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, -844, -844, -844, -844, -844, -844, -844, -844,\n     -844, -844, -844, -844, -844, -844, -844, -844\n    },\n\n    {\n       69, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, 1044, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845, -845, -845,\n     -845, -845, -845, -845, -845, -845, -845, -845\n    },\n\n    {\n       69, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n     -846, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n\n     -846, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n     -846, -846, 1045, -846, -846, -846, -846, -846, -846, -846,\n     -846, -846, -846, -846, -846, -846, -846, -846, 1046, 1046,\n     1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, -846, -846,\n     -846, -846, -846, -846, -846, 1045, 1045, 1045, 1045, 1045,\n     1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045,\n     1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045,\n     1045, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n     -846, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n     -846, -846, -846, -846, -846, -846, -846, -846, -846, -846,\n\n     -846, -846, -846, -846, -846, -846, -846, -846\n    },\n\n    {\n       69, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, 1047, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847, -847, -847,\n     -847, -847, -847, -847, -847, -847, -847, -847\n    },\n\n    {\n       69, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, 1048, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848, -848, -848,\n     -848, -848, -848, -848, -848, -848, -848, -848\n    },\n\n    {\n       69, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n     -849, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n     -849, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n\n     -849, -849, 1049, -849, -849, -849, -849, -849, -849, -849,\n     -849, -849, -849, -849, -849, -849, -849, -849, 1050, 1050,\n     1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, -849, -849,\n     -849, -849, -849, -849, -849, 1049, 1049, 1049, 1049, 1049,\n     1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049,\n     1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049,\n     1049, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n     -849, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n     -849, -849, -849, -849, -849, -849, -849, -849, -849, -849,\n     -849, -849, -849, -849, -849, -849, -849, -849\n\n    },\n\n    {\n       69, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850, -850, -850,\n     -850, -850, -850, -850, -850, -850, -850, -850\n    },\n\n    {\n       69, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851, -851, -851,\n     -851, -851, -851, -851, -851, -851, -851, -851\n    },\n\n    {\n       69, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852, -852, -852,\n     -852, -852, -852, -852, -852, -852, -852, -852\n    },\n\n    {\n       69, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n\n     -853, -853, -853, -853, -853, -853, -853, -853, -853, -853,\n     -853, -853, -853, -853, -853, -853, -853, -853\n    },\n\n    {\n       69, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854, -854, -854,\n     -854, -854, -854, -854, -854, -854, -854, -854\n    },\n\n    {\n       69, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855, -855, -855,\n     -855, -855, -855, -855, -855, -855, -855, -855\n    },\n\n    {\n       69, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, 1051, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n     -856, -856, -856, -856, -856, -856, -856, -856, -856, -856,\n\n     -856, -856, -856, -856, -856, -856, -856, -856\n    },\n\n    {\n       69, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, 1052, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857, -857, -857, -857, -857, -857\n    },\n\n    {\n       69, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, 1053, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858, -858, -858, -858, -858, -858, 1054, 1054,\n     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, -858, -858,\n\n     -858, -858, -858, -858, -858, 1053, 1053, 1053, 1053, 1053,\n     1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053,\n     1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053,\n     1053, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858, -858, -858, -858, -858, -858\n    },\n\n    {\n       69, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n\n     -859, -859, 1055, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859, -859, -859,\n     -859, -859, -859, -859, -859, -859, -859, -859\n\n    },\n\n    {\n       69, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n     -860, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n     -860, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n     -860, -860, 1056, -860, -860, -860, -860, -860, -860, -860,\n     -860, -860, -860, -860, -860, -860, -860, -860, 1057, 1057,\n     1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, -860, -860,\n     -860, -860, -860, -860, -860, 1056, 1056, 1056, 1056, 1056,\n     1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056,\n     1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056,\n     1056, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n\n     -860, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n     -860, -860, -860, -860, -860, -860, -860, -860, -860, -860,\n     -860, -860, -860, -860, -860, -860, -860, -860\n    },\n\n    {\n       69, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, 1058, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, -861, -861, -861, -861, -861, -861, 1059, 1059,\n     1059, 1059, 1059, 1059, 1059, 1059, 1059, 1059, -861, -861,\n     -861, -861, -861, -861, -861, 1058, 1058, 1058, 1058, 1058,\n\n     1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058,\n     1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058,\n     1058, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, -861, -861, -861, -861, -861, -861, -861, -861,\n     -861, -861, -861, -861, -861, -861, -861, -861\n    },\n\n    {\n       69, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n\n     -862, -862, -862, -862, -862, -862, -862, -862, 1060, 1060,\n     1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862, -862, -862,\n     -862, -862, -862, -862, -862, -862, -862, -862\n    },\n\n    {\n       69, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863, 1061, 1061,\n     1061, 1061, 1061, 1061, 1061, 1061, 1061, 1061, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n\n     -863, -863, -863, -863, -863, -863, -863, -863, -863, -863,\n     -863, -863, -863, -863, -863, -863, -863, -863\n    },\n\n    {\n       69, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, 1062, 1062,\n     1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864, -864, -864,\n     -864, -864, -864, -864, -864, -864, -864, -864\n    },\n\n    {\n       69, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, 1063, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, -865, -865, -865, -865, -865, -865, 1064, 1064,\n\n     1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, -865, -865,\n     -865, -865, -865, -865, -865, 1063, 1063, 1063, 1063, 1063,\n     1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,\n     1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,\n     1063, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, -865, -865, -865, -865, -865, -865, -865, -865,\n     -865, -865, -865, -865, -865, -865, -865, -865\n    },\n\n    {\n       69, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, 1065, 1065,\n     1065, 1065, 1065, 1065, 1065, 1065, 1065, 1065, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n     -866, -866, -866, -866, -866, -866, -866, -866, -866, -866,\n\n     -866, -866, -866, -866, -866, -866, -866, -866\n    },\n\n    {\n       69, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, 1066, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, -867, -867, -867, -867, -867, -867, 1067, 1067,\n     1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, -867, -867,\n     -867, -867, -867, -867, -867, 1066, 1066, 1066, 1066, 1066,\n     1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066,\n     1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066,\n\n     1066, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, -867, -867, -867, -867, -867, -867, -867, -867,\n     -867, -867, -867, -867, -867, -867, -867, -867\n    },\n\n    {\n       69, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, 1066, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, -868, -868, -868, -868, -868, -868, 1068, 1068,\n     1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, -868, -868,\n\n     -868, -868, -868, -868, -868, 1066, 1066, 1066, 1066, 1066,\n     1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066,\n     1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066,\n     1066, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, -868, -868, -868, -868, -868, -868, -868, -868,\n     -868, -868, -868, -868, -868, -868, -868, -868\n    },\n\n    {\n       69, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n\n     -869, -869, 1069, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869, -869, -869,\n     -869, -869, -869, -869, -869, -869, -869, -869\n\n    },\n\n    {\n       69, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n     -870, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n     -870, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n     -870, -870, 1070, -870, -870, -870, -870, -870, -870, -870,\n     -870, -870, -870, -870, -870, -870, -870, -870, 1071, 1071,\n     1071, 1071, 1071, 1071, 1071, 1071, 1071, 1071, -870, -870,\n     -870, -870, -870, -870, -870, 1070, 1070, 1070, 1070, 1070,\n     1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070,\n     1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070,\n     1070, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n\n     -870, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n     -870, -870, -870, -870, -870, -870, -870, -870, -870, -870,\n     -870, -870, -870, -870, -870, -870, -870, -870\n    },\n\n    {\n       69, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, 1072, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, -871, -871, -871, -871, -871, -871, 1073, 1073,\n     1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, -871, -871,\n     -871, -871, -871, -871, -871, 1072, 1072, 1072, 1072, 1072,\n\n     1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072,\n     1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072,\n     1072, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, -871, -871, -871, -871, -871, -871, -871, -871,\n     -871, -871, -871, -871, -871, -871, -871, -871\n    },\n\n    {\n       69, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n     -872, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n     -872, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n     -872, -872, 1072, -872, -872, -872, -872, -872, -872, -872,\n\n     -872, -872, -872, -872, -872, -872, -872, -872, 1074, 1074,\n     1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, -872, -872,\n     -872, -872, -872, -872, -872, 1072, 1072, 1072, 1072, 1072,\n     1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072,\n     1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072, 1072,\n     1072, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n     -872, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n     -872, -872, -872, -872, -872, -872, -872, -872, -872, -872,\n     -872, -872, -872, -872, -872, -872, -872, -872\n    },\n\n    {\n       69, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, 1075, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n\n     -873, -873, -873, -873, -873, -873, -873, -873, -873, -873,\n     -873, -873, -873, -873, -873, -873, -873, -873\n    },\n\n    {\n       69, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, 1076, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, -874, -874, -874, -874, -874, -874, 1077, 1077,\n     1077, 1077, 1077, 1077, 1077, 1077, 1077, 1077, -874, -874,\n     -874, -874, -874, -874, -874, 1076, 1076, 1076, 1076, 1076,\n     1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076,\n\n     1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076,\n     1076, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, -874, -874, -874, -874, -874, -874, -874, -874,\n     -874, -874, -874, -874, -874, -874, -874, -874\n    },\n\n    {\n       69, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, 1076, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, -875, -875, -875, -875, -875, -875, 1078, 1078,\n\n     1078, 1078, 1078, 1078, 1078, 1078, 1078, 1078, -875, -875,\n     -875, -875, -875, -875, -875, 1076, 1076, 1076, 1076, 1076,\n     1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076,\n     1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076,\n     1076, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, -875, -875, -875, -875, -875, -875, -875, -875,\n     -875, -875, -875, -875, -875, -875, -875, -875\n    },\n\n    {\n       69, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n     -876, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n\n     -876, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n     -876, -876, 1079, -876, -876, -876, -876, -876, -876, -876,\n     -876, -876, -876, -876, -876, -876, -876, -876, 1071, 1071,\n     1071, 1071, 1071, 1071, 1071, 1071, 1071, 1071, -876, -876,\n     -876, -876, -876, -876, -876, 1079, 1079, 1079, 1079, 1079,\n     1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079,\n     1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079, 1079,\n     1079, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n     -876, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n     -876, -876, -876, -876, -876, -876, -876, -876, -876, -876,\n\n     -876, -876, -876, -876, -876, -876, -876, -876\n    },\n\n    {\n       69, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, 1080, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877, -877, -877,\n     -877, -877, -877, -877, -877, -877, -877, -877\n    },\n\n    {\n       69, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, 1081, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878, -878, -878,\n     -878, -878, -878, -878, -878, -878, -878, -878\n    },\n\n    {\n       69, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n     -879, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n     -879, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n\n     -879, -879, 1082, -879, -879, -879, -879, -879, -879, -879,\n     -879, -879, -879, -879, -879, -879, -879, -879, 1083, 1083,\n     1083, 1083, 1083, 1083, 1083, 1083, 1083, 1083, -879, -879,\n     -879, -879, -879, -879, -879, 1082, 1082, 1082, 1082, 1082,\n     1082, 1082, 1082, 1082, 1082, 1082, 1082, 1082, 1082, 1082,\n     1082, 1082, 1082, 1082, 1082, 1082, 1082, 1082, 1082, 1082,\n     1082, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n     -879, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n     -879, -879, -879, -879, -879, -879, -879, -879, -879, -879,\n     -879, -879, -879, -879, -879, -879, -879, -879\n\n    },\n\n    {\n       69, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, 1084, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880, -880, -880,\n     -880, -880, -880, -880, -880, -880, -880, -880\n    },\n\n    {\n       69, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, 1085, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, -881, -881, -881, -881, -881, -881, 1086, 1086,\n     1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, -881, -881,\n     -881, -881, -881, -881, -881, 1085, 1085, 1085, 1085, 1085,\n\n     1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085,\n     1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085,\n     1085, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, -881, -881, -881, -881, -881, -881, -881, -881,\n     -881, -881, -881, -881, -881, -881, -881, -881\n    },\n\n    {\n       69, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n     -882, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n     -882, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n     -882, -882, 1085, -882, -882, -882, -882, -882, -882, -882,\n\n     -882, -882, -882, -882, -882, -882, -882, -882, 1087, 1087,\n     1087, 1087, 1087, 1087, 1087, 1087, 1087, 1087, -882, -882,\n     -882, -882, -882, -882, -882, 1085, 1085, 1085, 1085, 1085,\n     1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085,\n     1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085, 1085,\n     1085, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n     -882, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n     -882, -882, -882, -882, -882, -882, -882, -882, -882, -882,\n     -882, -882, -882, -882, -882, -882, -882, -882\n    },\n\n    {\n       69, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n\n     -883, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n     -883, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n     -883, -883, 1088, -883, -883, -883, -883, -883, -883, -883,\n     -883, -883, -883, -883, -883, -883, -883, -883, 1071, 1071,\n     1071, 1071, 1071, 1071, 1071, 1071, 1071, 1071, -883, -883,\n     -883, -883, -883, -883, -883, 1088, 1088, 1088, 1088, 1088,\n     1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088,\n     1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088,\n     1088, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n     -883, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n\n     -883, -883, -883, -883, -883, -883, -883, -883, -883, -883,\n     -883, -883, -883, -883, -883, -883, -883, -883\n    },\n\n    {\n       69, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, 1089, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884, -884, -884,\n     -884, -884, -884, -884, -884, -884, -884, -884\n    },\n\n    {\n       69, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, 1090, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885, -885, -885,\n     -885, -885, -885, -885, -885, -885, -885, -885\n    },\n\n    {\n       69, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n     -886, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n\n     -886, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n     -886, -886, 1091, -886, -886, -886, -886, -886, -886, -886,\n     -886, -886, -886, -886, -886, -886, -886, -886, 1092, 1092,\n     1092, 1092, 1092, 1092, 1092, 1092, 1092, 1092, -886, -886,\n     -886, -886, -886, -886, -886, 1091, 1091, 1091, 1091, 1091,\n     1091, 1091, 1091, 1091, 1091, 1091, 1091, 1091, 1091, 1091,\n     1091, 1091, 1091, 1091, 1091, 1091, 1091, 1091, 1091, 1091,\n     1091, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n     -886, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n     -886, -886, -886, -886, -886, -886, -886, -886, -886, -886,\n\n     -886, -886, -886, -886, -886, -886, -886, -886\n    },\n\n    {\n       69, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, 1091, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, -887, -887, -887, -887, -887, -887, 1093, 1093,\n     1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, -887, -887,\n     -887, -887, -887, -887, -887, 1091, 1091, 1091, 1091, 1091,\n     1091, 1091, 1091, 1091, 1091, 1091, 1091, 1091, 1091, 1091,\n     1091, 1091, 1091, 1091, 1091, 1091, 1091, 1091, 1091, 1091,\n\n     1091, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, -887, -887, -887, -887, -887, -887, -887, -887,\n     -887, -887, -887, -887, -887, -887, -887, -887\n    },\n\n    {\n       69, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, 1094, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, -888, -888, -888, -888, -888, -888, 1083, 1083,\n     1083, 1083, 1083, 1083, 1083, 1083, 1083, 1083, -888, -888,\n\n     -888, -888, -888, -888, -888, 1094, 1094, 1094, 1094, 1094,\n     1094, 1094, 1094, 1094, 1094, 1094, 1094, 1094, 1094, 1094,\n     1094, 1094, 1094, 1094, 1094, 1094, 1094, 1094, 1094, 1094,\n     1094, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, -888, -888, -888, -888, -888, -888, -888, -888,\n     -888, -888, -888, -888, -888, -888, -888, -888\n    },\n\n    {\n       69, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n\n     -889, -889, 1095, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889, -889, -889,\n     -889, -889, -889, -889, -889, -889, -889, -889\n\n    },\n\n    {\n       69, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, 1096, 1096,\n     1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890, -890, -890,\n     -890, -890, -890, -890, -890, -890, -890, -890\n    },\n\n    {\n       69, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, 1097, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, 1097, 1097, 1097, 1097, 1097,\n\n     1097, 1097, 1097, 1097, 1097, 1097, 1097, 1097, 1097, 1097,\n     1097, 1097, 1097, 1097, 1097, 1097, 1097, 1097, 1097, 1097,\n     1097, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891, -891, -891,\n     -891, -891, -891, -891, -891, -891, -891, -891\n    },\n\n    {\n       69, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n     -892, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n     -892, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n     -892, -892, 1097, -892, -892, -892, -892, -892, -892, -892,\n\n     -892, -892, -892, -892, -892, -892, -892, -892, 1098, 1098,\n     1098, 1098, 1098, 1098, 1098, 1098, 1098, 1098, -892, -892,\n     -892, -892, -892, -892, -892, 1097, 1097, 1097, 1097, 1097,\n     1097, 1097, 1097, 1097, 1097, 1097, 1097, 1097, 1097, 1097,\n     1097, 1097, 1097, 1097, 1097, 1097, 1097, 1097, 1097, 1097,\n     1097, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n     -892, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n     -892, -892, -892, -892, -892, -892, -892, -892, -892, -892,\n     -892, -892, -892, -892, -892, -892, -892, -892\n    },\n\n    {\n       69, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, 1099, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n\n     -893, -893, -893, -893, -893, -893, -893, -893, -893, -893,\n     -893, -893, -893, -893, -893, -893, -893, -893\n    },\n\n    {\n       69, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, 1100, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, -894, -894, -894, -894, -894, -894, 1101, 1101,\n     1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, -894, -894,\n     -894, -894, -894, -894, -894, 1100, 1100, 1100, 1100, 1100,\n     1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100,\n\n     1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100,\n     1100, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, -894, -894, -894, -894, -894, -894, -894, -894,\n     -894, -894, -894, -894, -894, -894, -894, -894\n    },\n\n    {\n       69, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, 1102, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895, -895, -895,\n     -895, -895, -895, -895, -895, -895, -895, -895\n    },\n\n    {\n       69, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, 1103, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n     -896, -896, -896, -896, -896, -896, -896, -896, -896, -896,\n\n     -896, -896, -896, -896, -896, -896, -896, -896\n    },\n\n    {\n       69, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, 1104, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, -897, -897, -897, -897, -897, -897, 1105, 1105,\n     1105, 1105, 1105, 1105, 1105, 1105, 1105, 1105, -897, -897,\n     -897, -897, -897, -897, -897, 1104, 1104, 1104, 1104, 1104,\n     1104, 1104, 1104, 1104, 1104, 1104, 1104, 1104, 1104, 1104,\n     1104, 1104, 1104, 1104, 1104, 1104, 1104, 1104, 1104, 1104,\n\n     1104, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, -897, -897, -897, -897, -897, -897, -897, -897,\n     -897, -897, -897, -897, -897, -897, -897, -897\n    },\n\n    {\n       69, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898, -898, -898,\n     -898, -898, -898, -898, -898, -898, -898, -898\n    },\n\n    {\n       69, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899, -899, -899,\n     -899, -899, -899, -899, -899, -899, -899, -899\n\n    },\n\n    {\n       69, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900, -900, -900,\n     -900, -900, -900, -900, -900, -900, -900, -900\n    },\n\n    {\n       69, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901, -901, -901,\n     -901, -901, -901, -901, -901, -901, -901, -901\n    },\n\n    {\n       69, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902, -902, -902,\n     -902, -902, -902, -902, -902, -902, -902, -902\n    },\n\n    {\n       69, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n\n     -903, -903, -903, -903, -903, -903, -903, -903, -903, -903,\n     -903, -903, -903, -903, -903, -903, -903, -903\n    },\n\n    {\n       69, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, 1106, 1106,\n     1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904, -904, -904,\n     -904, -904, -904, -904, -904, -904, -904, -904\n    },\n\n    {\n       69, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, 1107, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n\n     -905, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, -905, -905, -905, 1107, 1107, 1107, 1107, 1107,\n     1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107,\n     1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107,\n     1107, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, -905, -905, -905, -905, -905, -905, -905, -905,\n     -905, -905, -905, -905, -905, -905, -905, -905\n    },\n\n    {\n       69, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n     -906, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n\n     -906, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n     -906, -906, 1107, -906, -906, -906, -906, -906, -906, -906,\n     -906, -906, -906, -906, -906, -906, -906, -906, 1108, 1108,\n     1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, -906, -906,\n     -906, -906, -906, -906, -906, 1107, 1107, 1107, 1107, 1107,\n     1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107,\n     1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107,\n     1107, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n     -906, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n     -906, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n\n     -906, -906, -906, -906, -906, -906, -906, -906\n    },\n\n    {\n       69, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, 1109, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907, -907, -907,\n     -907, -907, -907, -907, -907, -907, -907, -907\n    },\n\n    {\n       69, -908, -908, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908, -908, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908, -908, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908, 1110, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908, -908, -908, -908, -908, -908, -908, 1111, 1111,\n     1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, -908, -908,\n\n     -908, -908, -908, -908, -908, 1110, 1110, 1110, 1110, 1110,\n     1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,\n     1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,\n     1110, -908, -908, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908, -908, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908, -908, -908, -908, -908, -908, -908, -908, -908,\n     -908, -908, -908, -908, -908, -908, -908, -908\n    },\n\n    {\n       69, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n\n     -909, -909, 1112, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909\n\n    },\n\n    {\n       69, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, 1113, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910, -910, -910,\n     -910, -910, -910, -910, -910, -910, -910, -910\n    },\n\n    {\n       69, -911, -911, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911, -911, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911, -911, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911, 1114, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911, -911, -911, -911, -911, -911, -911, 1115, 1115,\n     1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, -911, -911,\n     -911, -911, -911, -911, -911, 1114, 1114, 1114, 1114, 1114,\n\n     1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114,\n     1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114,\n     1114, -911, -911, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911, -911, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911, -911, -911, -911, -911, -911, -911, -911, -911,\n     -911, -911, -911, -911, -911, -911, -911, -911\n    },\n\n    {\n       69, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912, -912, -912,\n     -912, -912, -912, -912, -912, -912, -912, -912\n    },\n\n    {\n       69, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n\n     -913, -913, -913, -913, -913, -913, -913, -913, -913, -913,\n     -913, -913, -913, -913, -913, -913, -913, -913\n    },\n\n    {\n       69, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914, -914, -914,\n     -914, -914, -914, -914, -914, -914, -914, -914\n    },\n\n    {\n       69, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915, -915, -915,\n     -915, -915, -915, -915, -915, -915, -915, -915\n    },\n\n    {\n       69, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n     -916, -916, -916, -916, -916, -916, -916, -916, -916, -916,\n\n     -916, -916, -916, -916, -916, -916, -916, -916\n    },\n\n    {\n       69, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917, -917, -917,\n     -917, -917, -917, -917, -917, -917, -917, -917\n    },\n\n    {\n       69,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      919,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  920,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  921,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918\n    },\n\n    {\n       69, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919, -919, -919,\n     -919, -919, -919, -919, -919, -919, -919, -919\n\n    },\n\n    {\n       69,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      919,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  920,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  921,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918\n    },\n\n    {\n       69,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      919,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  920,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  921,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918,  918,  918,\n      918,  918,  918,  918,  918,  918,  918,  918\n    },\n\n    {\n       69, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, 1116, -922, -922, -922, -922, -922, -922, -922,\n\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922, -922, -922,\n     -922, -922, -922, -922, -922, -922, -922, -922\n    },\n\n    {\n       69, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, 1117, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n\n     -923, -923, -923, -923, -923, -923, -923, -923, -923, -923,\n     -923, -923, -923, -923, -923, -923, -923, -923\n    },\n\n    {\n       69, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, 1118, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924, -924, -924,\n     -924, -924, -924, -924, -924, -924, -924, -924\n    },\n\n    {\n       69, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, 1119, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925, -925, -925,\n     -925, -925, -925, -925, -925, -925, -925, -925\n    },\n\n    {\n       69, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, 1120,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n     -926, -926, -926, -926, -926, -926, -926, -926, -926, -926,\n\n     -926, -926, -926, -926, -926, -926, -926, -926\n    },\n\n    {\n       69, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, 1121, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927, -927, -927,\n     -927, -927, -927, -927, -927, -927, -927, -927\n    },\n\n    {\n       69, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n\n     -928, -928, -928, -928, -928, -928, 1122, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928, -928, -928,\n     -928, -928, -928, -928, -928, -928, -928, -928\n    },\n\n    {\n       69, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, 1123,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929, -929, -929,\n     -929, -929, -929, -929, -929, -929, -929, -929\n\n    },\n\n    {\n       69, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     1124, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930, -930, -930,\n     -930, -930, -930, -930, -930, -930, -930, -930\n    },\n\n    {\n       69, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, 1125, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931, -931, -931,\n     -931, -931, -931, -931, -931, -931, -931, -931\n    },\n\n    {\n       69, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, 1126, -932, -932, -932, -932, -932, -932, -932,\n\n     -932, -932, -932, -932, -932, -932, -932, -932, 1127, 1127,\n     1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932, -932, -932,\n     -932, -932, -932, -932, -932, -932, -932, -932\n    },\n\n    {\n       69, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, 1128, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n\n     -933, -933, -933, -933, -933, -933, -933, -933, -933, -933,\n     -933, -933, -933, -933, -933, -933, -933, -933\n    },\n\n    {\n       69, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, 1129, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934, -934, -934,\n     -934, -934, -934, -934, -934, -934, -934, -934\n    },\n\n    {\n       69, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, 1130, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935, -935, -935,\n     -935, -935, -935, -935, -935, -935, -935, -935\n    },\n\n    {\n       69, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, 1131, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n     -936, -936, -936, -936, -936, -936, -936, -936, -936, -936,\n\n     -936, -936, -936, -936, -936, -936, -936, -936\n    },\n\n    {\n       69, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, 1132, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937, -937, -937,\n     -937, -937, -937, -937, -937, -937, -937, -937\n    },\n\n    {\n       69, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n\n     -938, -938, -938, -938, -938, -938, 1133, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938, -938, -938,\n     -938, -938, -938, -938, -938, -938, -938, -938\n    },\n\n    {\n       69, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n\n     -939, -939, 1134, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     1135, -939, -939, 1136, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939\n\n    },\n\n    {\n       69, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, 1137, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940, -940, -940,\n     -940, -940, -940, -940, -940, -940, -940, -940\n    },\n\n    {\n       69, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, 1138, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941, -941, -941,\n     -941, -941, -941, -941, -941, -941, -941, -941\n    },\n\n    {\n       69, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, 1139, -942, -942, -942, -942, -942, -942, -942,\n\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942, -942, -942,\n     -942, -942, -942, -942, -942, -942, -942, -942\n    },\n\n    {\n       69, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, 1140, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n\n     -943, -943, -943, -943, -943, -943, -943, -943, -943, -943,\n     -943, -943, -943, -943, -943, -943, -943, -943\n    },\n\n    {\n       69, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, 1141,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944, -944, -944,\n     -944, -944, -944, -944, -944, -944, -944, -944\n    },\n\n    {\n       69, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, 1142,\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945\n    },\n\n    {\n       69, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, 1143, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n     -946, -946, -946, -946, -946, -946, -946, -946, -946, -946,\n\n     -946, -946, -946, -946, -946, -946, -946, -946\n    },\n\n    {\n       69, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, 1144, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947, -947, -947,\n     -947, -947, -947, -947, -947, -947, -947, -947\n    },\n\n    {\n       69, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n\n     -948, -948, -948, -948, -948, -948, -948, -948, 1145, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948, -948, -948,\n     -948, -948, -948, -948, -948, -948, -948, -948\n    },\n\n    {\n       69, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, 1146, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949, -949, -949,\n     -949, -949, -949, -949, -949, -949, -949, -949\n\n    },\n\n    {\n       69, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     1147, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950, -950, -950,\n     -950, -950, -950, -950, -950, -950, -950, -950\n    },\n\n    {\n       69, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, 1148, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n\n     1149, -951, -951, 1150, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951, -951, -951,\n     -951, -951, -951, -951, -951, -951, -951, -951\n    },\n\n    {\n       69, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, 1151, -952, -952, -952, -952, -952, -952, -952,\n\n     -952, -952, -952, -952, -952, -952, -952, -952, 1152, 1152,\n     1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952, -952, -952,\n     -952, -952, -952, -952, -952, -952, -952, -952\n    },\n\n    {\n       69, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, 1153, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n\n     -953, -953, -953, -953, -953, -953, -953, -953, -953, -953,\n     -953, -953, -953, -953, -953, -953, -953, -953\n    },\n\n    {\n       69, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, 1154, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954, 1155, 1155,\n     1155, 1155, 1155, 1155, 1155, 1155, 1155, 1155, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954, -954, -954,\n     -954, -954, -954, -954, -954, -954, -954, -954\n    },\n\n    {\n       69, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, 1156, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, 1157, 1157,\n\n     1157, 1157, 1157, 1157, 1157, 1157, 1157, 1157, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955, -955, -955,\n     -955, -955, -955, -955, -955, -955, -955, -955\n    },\n\n    {\n       69, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, 1158, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n     -956, -956, -956, -956, -956, -956, -956, -956, -956, -956,\n\n     -956, -956, -956, -956, -956, -956, -956, -956\n    },\n\n    {\n       69, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, 1159, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957, -957, -957,\n     -957, -957, -957, -957, -957, -957, -957, -957\n    },\n\n    {\n       69, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, 1160,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958, -958, -958,\n     -958, -958, -958, -958, -958, -958, -958, -958\n    },\n\n    {\n       69, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, 1161, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959, -959, -959,\n     -959, -959, -959, -959, -959, -959, -959, -959\n\n    },\n\n    {\n       69, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, 1162,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, 1163, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960, -960, -960,\n     -960, -960, -960, -960, -960, -960, -960, -960\n    },\n\n    {\n       69, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, 1164, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961, -961, -961,\n     -961, -961, -961, -961, -961, -961, -961, -961\n    },\n\n    {\n       69, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, 1165,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962, -962, -962,\n     -962, -962, -962, -962, -962, -962, -962, -962\n    },\n\n    {\n       69, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, 1166, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n\n     -963, -963, -963, -963, -963, -963, -963, -963, -963, -963,\n     -963, -963, -963, -963, -963, -963, -963, -963\n    },\n\n    {\n       69, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n\n     -964, -964, -964, 1167, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964, -964, -964,\n     -964, -964, -964, -964, -964, -964, -964, -964\n    },\n\n    {\n       69, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, 1168, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965, -965, -965,\n     -965, -965, -965, -965, -965, -965, -965, -965\n    },\n\n    {\n       69, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, 1169,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n     -966, -966, -966, -966, -966, -966, -966, -966, -966, -966,\n\n     -966, -966, -966, -966, -966, -966, -966, -966\n    },\n\n    {\n       69, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, 1170, -967, -967, -967, -967, -967, -967,\n\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967, -967, -967,\n     -967, -967, -967, -967, -967, -967, -967, -967\n    },\n\n    {\n       69, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, 1171, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968, -968, -968,\n     -968, -968, -968, -968, -968, -968, -968, -968\n    },\n\n    {\n       69, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     1172, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969, -969, -969,\n     -969, -969, -969, -969, -969, -969, -969, -969\n\n    },\n\n    {\n       69, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, 1173, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970, -970, -970,\n     -970, -970, -970, -970, -970, -970, -970, -970\n    },\n\n    {\n       69, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, 1174, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971, -971, -971,\n     -971, -971, -971, -971, -971, -971, -971, -971\n    },\n\n    {\n       69, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, 1175, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972, -972, -972,\n     -972, -972, -972, -972, -972, -972, -972, -972\n    },\n\n    {\n       69, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, 1176, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n\n     -973, -973, -973, -973, -973, -973, -973, -973, -973, -973,\n     -973, -973, -973, -973, -973, -973, -973, -973\n    },\n\n    {\n       69, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n\n     -974, -974, 1177, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974, -974, -974,\n     -974, -974, -974, -974, -974, -974, -974, -974\n    },\n\n    {\n       69, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, 1178, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975, -975, -975,\n     -975, -975, -975, -975, -975, -975, -975, -975\n    },\n\n    {\n       69, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, 1179, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n     -976, -976, -976, -976, -976, -976, -976, -976, -976, -976,\n\n     -976, -976, -976, -976, -976, -976, -976, -976\n    },\n\n    {\n       69, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, 1180, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977, -977, -977,\n     -977, -977, -977, -977, -977, -977, -977, -977\n    },\n\n    {\n       69, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, 1181, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978, -978, -978,\n     -978, -978, -978, -978, -978, -978, -978, -978\n    },\n\n    {\n       69, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, 1182, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979, -979, -979,\n     -979, -979, -979, -979, -979, -979, -979, -979\n\n    },\n\n    {\n       69, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, 1183, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980, -980, -980,\n     -980, -980, -980, -980, -980, -980, -980, -980\n    },\n\n    {\n       69, -981, -981, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, -981, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, -981, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, 1184, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, -981, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, -981, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, -981, -981, -981, 1184, 1184, 1184, 1184, 1184,\n\n     1184, 1184, 1184, 1184, 1184, 1184, 1184, 1184, 1184, 1184,\n     1184, 1184, 1184, 1184, 1184, 1184, 1184, 1184, 1184, 1184,\n     1184, -981, -981, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, -981, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, -981, -981, -981, -981, -981, -981, -981, -981,\n     -981, -981, -981, -981, -981, -981, -981, -981\n    },\n\n    {\n       69, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, 1185, -982, -982, -982, -982, -982, -982, -982,\n\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982, -982, -982,\n     -982, -982, -982, -982, -982, -982, -982, -982\n    },\n\n    {\n       69, -983, -983, -983, -983, -983, -983, -983, -983, -983,\n\n     -983, -983, -983, -983, -983, -983, -983, -983, -983, -983,\n     -983, -983, -983, -983, -983, -983, -983, -983, -983, -983,\n     -983, -983, 1186, -983, -983, -983, -983, -983, -983, -983,\n     -983, -983, -983, -983, -983, -983, -983, -983, 1187, 1187,\n     1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, -983, -983,\n     -983, -983, -983, -983, -983, 1186, 1186, 1186, 1186, 1186,\n     1186, 1186, 1186, 1186, 1186, 1186, 1186, 1186, 1186, 1186,\n     1186, 1186, 1186, 1186, 1186, 1186, 1186, 1186, 1186, 1186,\n     1186, -983, -983, -983, -983, -983, -983, -983, -983, -983,\n     -983, -983, -983, -983, -983, -983, -983, -983, -983, -983,\n\n     -983, -983, -983, -983, -983, -983, -983, -983, -983, -983,\n     -983, -983, -983, -983, -983, -983, -983, -983\n    },\n\n    {\n       69, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, 1188,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984, -984, -984,\n     -984, -984, -984, -984, -984, -984, -984, -984\n    },\n\n    {\n       69, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, 1189, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985, -985, -985,\n     -985, -985, -985, -985, -985, -985, -985, -985\n    },\n\n    {\n       69, -986, -986, -986, -986, -986, -986, -986, -986, -986,\n     -986, -986, -986, -986, -986, -986, -986, -986, -986, -986,\n\n     -986, -986, -986, -986, -986, -986, -986, -986, -986, -986,\n     -986, -986, 1190, -986, -986, -986, -986, -986, -986, -986,\n     -986, -986, -986, -986, -986, -986, -986, -986, 1191, 1191,\n     1191, 1191, 1191, 1191, 1191, 1191, 1191, 1191, -986, -986,\n     -986, -986, -986, -986, -986, 1190, 1190, 1190, 1190, 1190,\n     1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190,\n     1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190,\n     1190, -986, -986, -986, -986, -986, -986, -986, -986, -986,\n     -986, -986, -986, -986, -986, -986, -986, -986, -986, -986,\n     -986, -986, -986, -986, -986, -986, -986, -986, -986, -986,\n\n     -986, -986, -986, -986, -986, -986, -986, -986\n    },\n\n    {\n       69, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, 1192, -987, -987, -987, -987, -987, -987,\n\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987, -987, -987,\n     -987, -987, -987, -987, -987, -987, -987, -987\n    },\n\n    {\n       69, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, 1193,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988, -988, -988,\n     -988, -988, -988, -988, -988, -988, -988, -988\n    },\n\n    {\n       69, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n\n     -989, -989, 1194, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989, -989, -989,\n     -989, -989, -989, -989, -989, -989, -989, -989\n\n    },\n\n    {\n       69, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n     -990, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n     -990, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n     -990, -990, 1195, -990, -990, -990, -990, -990, -990, -990,\n     -990, -990, -990, -990, -990, -990, -990, -990, 1196, 1196,\n     1196, 1196, 1196, 1196, 1196, 1196, 1196, 1196, -990, -990,\n     -990, -990, -990, -990, -990, 1195, 1195, 1195, 1195, 1195,\n     1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,\n     1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,\n     1195, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n\n     -990, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n     -990, -990, -990, -990, -990, -990, -990, -990, -990, -990,\n     -990, -990, -990, -990, -990, -990, -990, -990\n    },\n\n    {\n       69, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, 1197, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991, -991, -991,\n     -991, -991, -991, -991, -991, -991, -991, -991\n    },\n\n    {\n       69, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n     -992, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n     -992, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n     -992, -992, 1198, -992, -992, -992, -992, -992, -992, -992,\n\n     -992, -992, -992, -992, -992, -992, -992, -992, 1199, 1199,\n     1199, 1199, 1199, 1199, 1199, 1199, 1199, 1199, -992, -992,\n     -992, -992, -992, -992, -992, 1198, 1198, 1198, 1198, 1198,\n     1198, 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1198,\n     1198, 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1198, 1198,\n     1198, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n     -992, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n     -992, -992, -992, -992, -992, -992, -992, -992, -992, -992,\n     -992, -992, -992, -992, -992, -992, -992, -992\n    },\n\n    {\n       69, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, 1200,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n\n     -993, -993, -993, -993, -993, -993, -993, -993, -993, -993,\n     -993, -993, -993, -993, -993, -993, -993, -993\n    },\n\n    {\n       69, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, 1201,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994, -994, -994,\n     -994, -994, -994, -994, -994, -994, -994, -994\n    },\n\n    {\n       69, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995, -995, -995,\n     -995, -995, -995, -995, -995, -995, -995, -995\n    },\n\n    {\n       69, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n     -996, -996, -996, -996, -996, -996, -996, -996, -996, -996,\n\n     -996, -996, -996, -996, -996, -996, -996, -996\n    },\n\n    {\n       69, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997, -997, -997,\n     -997, -997, -997, -997, -997, -997, -997, -997\n    },\n\n    {\n       69, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998, -998, -998,\n     -998, -998, -998, -998, -998, -998, -998, -998\n    },\n\n    {\n       69, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999, -999, -999,\n     -999, -999, -999, -999, -999, -999, -999, -999\n\n    },\n\n    {\n       69,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,\n    -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000\n    },\n\n    {\n       69,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001,\n    -1001,-1001,-1001,-1001,-1001,-1001,-1001,-1001\n    },\n\n    {\n       69,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002,\n    -1002,-1002,-1002,-1002,-1002,-1002,-1002,-1002\n    },\n\n    {\n       69,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003,\n    -1003,-1003,-1003,-1003,-1003,-1003,-1003,-1003\n    },\n\n    {\n       69,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004,\n    -1004,-1004,-1004,-1004,-1004,-1004,-1004,-1004\n    },\n\n    {\n       69,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005,\n    -1005,-1005,-1005,-1005,-1005,-1005,-1005,-1005\n    },\n\n    {\n       69,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006,\n\n    -1006,-1006,-1006,-1006,-1006,-1006,-1006,-1006\n    },\n\n    {\n       69,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007,\n    -1007,-1007,-1007,-1007,-1007,-1007,-1007,-1007\n    },\n\n    {\n       69,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008,\n    -1008,-1008,-1008,-1008,-1008,-1008,-1008,-1008\n    },\n\n    {\n       69,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009,\n    -1009,-1009,-1009,-1009,-1009,-1009,-1009,-1009\n\n    },\n\n    {\n       69,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010,\n    -1010,-1010,-1010,-1010,-1010,-1010,-1010,-1010\n    },\n\n    {\n       69,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011,\n    -1011,-1011,-1011,-1011,-1011,-1011,-1011,-1011\n    },\n\n    {\n       69,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012,\n    -1012,-1012,-1012,-1012,-1012,-1012,-1012,-1012\n    },\n\n    {\n       69,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013,\n    -1013,-1013,-1013,-1013,-1013,-1013,-1013,-1013\n    },\n\n    {\n       69,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014,\n    -1014,-1014,-1014,-1014,-1014,-1014,-1014,-1014\n    },\n\n    {\n       69,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015,\n    -1015,-1015,-1015,-1015,-1015,-1015,-1015,-1015\n    },\n\n    {\n       69,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016,\n\n    -1016,-1016,-1016,-1016,-1016,-1016,-1016,-1016\n    },\n\n    {\n       69,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017,\n    -1017,-1017,-1017,-1017,-1017,-1017,-1017,-1017\n    },\n\n    {\n       69,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018,\n    -1018,-1018,-1018,-1018,-1018,-1018,-1018,-1018\n    },\n\n    {\n       69,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019,\n    -1019,-1019,-1019,-1019,-1019,-1019,-1019,-1019\n\n    },\n\n    {\n       69,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020,\n    -1020,-1020,-1020,-1020,-1020,-1020,-1020,-1020\n    },\n\n    {\n       69,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021,\n    -1021,-1021,-1021,-1021,-1021,-1021,-1021,-1021\n    },\n\n    {\n       69,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022,\n    -1022,-1022,-1022,-1022,-1022,-1022,-1022,-1022\n    },\n\n    {\n       69,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023,\n    -1023,-1023,-1023,-1023,-1023,-1023,-1023,-1023\n    },\n\n    {\n       69,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024,\n    -1024,-1024,-1024,-1024,-1024,-1024,-1024,-1024\n    },\n\n    {\n       69,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025,\n    -1025,-1025,-1025,-1025,-1025,-1025,-1025,-1025\n    },\n\n    {\n       69,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026,\n\n    -1026,-1026,-1026,-1026,-1026,-1026,-1026,-1026\n    },\n\n    {\n       69,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027,\n    -1027,-1027,-1027,-1027,-1027,-1027,-1027,-1027\n    },\n\n    {\n       69,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028,\n    -1028,-1028,-1028,-1028,-1028,-1028,-1028,-1028\n    },\n\n    {\n       69,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029,\n    -1029,-1029,-1029,-1029,-1029,-1029,-1029,-1029\n\n    },\n\n    {\n       69,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030,\n    -1030,-1030,-1030,-1030,-1030,-1030,-1030,-1030\n    },\n\n    {\n       69,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031,\n    -1031,-1031,-1031,-1031,-1031,-1031,-1031,-1031\n    },\n\n    {\n       69,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032,\n    -1032,-1032,-1032,-1032,-1032,-1032,-1032,-1032\n    },\n\n    {\n       69,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033,\n    -1033,-1033,-1033,-1033,-1033,-1033,-1033,-1033\n    },\n\n    {\n       69,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034,\n    -1034,-1034,-1034,-1034,-1034,-1034,-1034,-1034\n    },\n\n    {\n       69,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035,\n    -1035,-1035,-1035,-1035,-1035,-1035,-1035,-1035\n    },\n\n    {\n       69,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n\n    -1036,-1036,-1036,-1036,-1036,-1036,-1036,-1036\n    },\n\n    {\n       69,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037,-1037,-1037,-1037,-1037,-1037\n    },\n\n    {\n       69,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038,-1038,-1038,-1038,-1038,-1038\n    },\n\n    {\n       69,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039,-1039,-1039,-1039,-1039,-1039\n\n    },\n\n    {\n       69,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040,-1040,-1040,-1040,-1040,-1040\n    },\n\n    {\n       69,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041,\n    -1041,-1041,-1041,-1041,-1041,-1041,-1041,-1041\n    },\n\n    {\n       69,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042,\n    -1042,-1042,-1042,-1042,-1042,-1042,-1042,-1042\n    },\n\n    {\n       69,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043,\n    -1043,-1043,-1043,-1043,-1043,-1043,-1043,-1043\n    },\n\n    {\n       69,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044,\n    -1044,-1044,-1044,-1044,-1044,-1044,-1044,-1044\n    },\n\n    {\n       69,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045,\n    -1045,-1045,-1045,-1045,-1045,-1045,-1045,-1045\n    },\n\n    {\n       69,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046,\n\n    -1046,-1046,-1046,-1046,-1046,-1046,-1046,-1046\n    },\n\n    {\n       69,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047,\n    -1047,-1047,-1047,-1047,-1047,-1047,-1047,-1047\n    },\n\n    {\n       69,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048,\n    -1048,-1048,-1048,-1048,-1048,-1048,-1048,-1048\n    },\n\n    {\n       69,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049,\n    -1049,-1049,-1049,-1049,-1049,-1049,-1049,-1049\n\n    },\n\n    {\n       69,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050,\n    -1050,-1050,-1050,-1050,-1050,-1050,-1050,-1050\n    },\n\n    {\n       69,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051,\n    -1051,-1051,-1051,-1051,-1051,-1051,-1051,-1051\n    },\n\n    {\n       69,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052,\n    -1052,-1052,-1052,-1052,-1052,-1052,-1052,-1052\n    },\n\n    {\n       69,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053,\n    -1053,-1053,-1053,-1053,-1053,-1053,-1053,-1053\n    },\n\n    {\n       69,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054,\n    -1054,-1054,-1054,-1054,-1054,-1054,-1054,-1054\n    },\n\n    {\n       69,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055,\n    -1055,-1055,-1055,-1055,-1055,-1055,-1055,-1055\n    },\n\n    {\n       69,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056,\n\n    -1056,-1056,-1056,-1056,-1056,-1056,-1056,-1056\n    },\n\n    {\n       69,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057,\n    -1057,-1057,-1057,-1057,-1057,-1057,-1057,-1057\n    },\n\n    {\n       69,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058,\n    -1058,-1058,-1058,-1058,-1058,-1058,-1058,-1058\n    },\n\n    {\n       69,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059,\n    -1059,-1059,-1059,-1059,-1059,-1059,-1059,-1059\n\n    },\n\n    {\n       69,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060,\n    -1060,-1060,-1060,-1060,-1060,-1060,-1060,-1060\n    },\n\n    {\n       69,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061,\n    -1061,-1061,-1061,-1061,-1061,-1061,-1061,-1061\n    },\n\n    {\n       69,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062,\n    -1062,-1062,-1062,-1062,-1062,-1062,-1062,-1062\n    },\n\n    {\n       69,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063,\n    -1063,-1063,-1063,-1063,-1063,-1063,-1063,-1063\n    },\n\n    {\n       69,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064,\n    -1064,-1064,-1064,-1064,-1064,-1064,-1064,-1064\n    },\n\n    {\n       69,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065,\n    -1065,-1065,-1065,-1065,-1065,-1065,-1065,-1065\n    },\n\n    {\n       69,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066,\n\n    -1066,-1066,-1066,-1066,-1066,-1066,-1066,-1066\n    },\n\n    {\n       69,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067,\n    -1067,-1067,-1067,-1067,-1067,-1067,-1067,-1067\n    },\n\n    {\n       69,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068,\n    -1068,-1068,-1068,-1068,-1068,-1068,-1068,-1068\n    },\n\n    {\n       69,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069,\n    -1069,-1069,-1069,-1069,-1069,-1069,-1069,-1069\n\n    },\n\n    {\n       69,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070,\n    -1070,-1070,-1070,-1070,-1070,-1070,-1070,-1070\n    },\n\n    {\n       69,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071,\n    -1071,-1071,-1071,-1071,-1071,-1071,-1071,-1071\n    },\n\n    {\n       69,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072,\n    -1072,-1072,-1072,-1072,-1072,-1072,-1072,-1072\n    },\n\n    {\n       69,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073,\n    -1073,-1073,-1073,-1073,-1073,-1073,-1073,-1073\n    },\n\n    {\n       69,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074,\n    -1074,-1074,-1074,-1074,-1074,-1074,-1074,-1074\n    },\n\n    {\n       69,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075,\n    -1075,-1075,-1075,-1075,-1075,-1075,-1075,-1075\n    },\n\n    {\n       69,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076,\n\n    -1076,-1076,-1076,-1076,-1076,-1076,-1076,-1076\n    },\n\n    {\n       69,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077,\n    -1077,-1077,-1077,-1077,-1077,-1077,-1077,-1077\n    },\n\n    {\n       69,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078,\n    -1078,-1078,-1078,-1078,-1078,-1078,-1078,-1078\n    },\n\n    {\n       69,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079,\n    -1079,-1079,-1079,-1079,-1079,-1079,-1079,-1079\n\n    },\n\n    {\n       69,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080,\n    -1080,-1080,-1080,-1080,-1080,-1080,-1080,-1080\n    },\n\n    {\n       69,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081,\n    -1081,-1081,-1081,-1081,-1081,-1081,-1081,-1081\n    },\n\n    {\n       69,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,\n    -1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,\n    -1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,\n    -1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,\n\n    -1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,\n    -1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,\n    -1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,\n    -1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,\n    -1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,\n    -1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,\n    -1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,\n    -1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082,\n    -1082,-1082,-1082,-1082,-1082,-1082,-1082,-1082\n    },\n\n    {\n       69,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083,\n    -1083,-1083,-1083,-1083,-1083,-1083,-1083,-1083\n    },\n\n    {\n       69,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,\n    -1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,\n    -1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,\n    -1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,\n    -1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,\n    -1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,\n    -1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,\n    -1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,\n\n    -1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,\n    -1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,\n    -1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,\n    -1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084,\n    -1084,-1084,-1084,-1084,-1084,-1084,-1084,-1084\n    },\n\n    {\n       69,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085,\n    -1085,-1085,-1085,-1085,-1085,-1085,-1085,-1085\n    },\n\n    {\n       69,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086,\n\n    -1086,-1086,-1086,-1086,-1086,-1086,-1086,-1086\n    },\n\n    {\n       69,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087,\n    -1087,-1087,-1087,-1087,-1087,-1087,-1087,-1087\n    },\n\n    {\n       69,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088,\n    -1088,-1088,-1088,-1088,-1088,-1088,-1088,-1088\n    },\n\n    {\n       69,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089,\n    -1089,-1089,-1089,-1089,-1089,-1089,-1089,-1089\n\n    },\n\n    {\n       69,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090,\n    -1090,-1090,-1090,-1090,-1090,-1090,-1090,-1090\n    },\n\n    {\n       69,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091,\n    -1091,-1091,-1091,-1091,-1091,-1091,-1091,-1091\n    },\n\n    {\n       69,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092,\n    -1092,-1092,-1092,-1092,-1092,-1092,-1092,-1092\n    },\n\n    {\n       69,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093,\n    -1093,-1093,-1093,-1093,-1093,-1093,-1093,-1093\n    },\n\n    {\n       69,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094,\n    -1094,-1094,-1094,-1094,-1094,-1094,-1094,-1094\n    },\n\n    {\n       69,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095,\n    -1095,-1095,-1095,-1095,-1095,-1095,-1095,-1095\n    },\n\n    {\n       69,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096,\n\n    -1096,-1096,-1096,-1096,-1096,-1096,-1096,-1096\n    },\n\n    {\n       69,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097,\n    -1097,-1097,-1097,-1097,-1097,-1097,-1097,-1097\n    },\n\n    {\n       69,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098,\n    -1098,-1098,-1098,-1098,-1098,-1098,-1098,-1098\n    },\n\n    {\n       69,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099,\n    -1099,-1099,-1099,-1099,-1099,-1099,-1099,-1099\n\n    },\n\n    {\n       69,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100,\n    -1100,-1100,-1100,-1100,-1100,-1100,-1100,-1100\n    },\n\n    {\n       69,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101,\n    -1101,-1101,-1101,-1101,-1101,-1101,-1101,-1101\n    },\n\n    {\n       69,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102,\n    -1102,-1102,-1102,-1102,-1102,-1102,-1102,-1102\n    },\n\n    {\n       69,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103,\n    -1103,-1103,-1103,-1103,-1103,-1103,-1103,-1103\n    },\n\n    {\n       69,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104,\n    -1104,-1104,-1104,-1104,-1104,-1104,-1104,-1104\n    },\n\n    {\n       69,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105,\n    -1105,-1105,-1105,-1105,-1105,-1105,-1105,-1105\n    },\n\n    {\n       69,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106,\n\n    -1106,-1106,-1106,-1106,-1106,-1106,-1106,-1106\n    },\n\n    {\n       69,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107,\n    -1107,-1107,-1107,-1107,-1107,-1107,-1107,-1107\n    },\n\n    {\n       69,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108,\n    -1108,-1108,-1108,-1108,-1108,-1108,-1108,-1108\n    },\n\n    {\n       69,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109,\n    -1109,-1109,-1109,-1109,-1109,-1109,-1109,-1109\n\n    },\n\n    {\n       69,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110,\n    -1110,-1110,-1110,-1110,-1110,-1110,-1110,-1110\n    },\n\n    {\n       69,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111,\n    -1111,-1111,-1111,-1111,-1111,-1111,-1111,-1111\n    },\n\n    {\n       69,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112,\n    -1112,-1112,-1112,-1112,-1112,-1112,-1112,-1112\n    },\n\n    {\n       69,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113,\n    -1113,-1113,-1113,-1113,-1113,-1113,-1113,-1113\n    },\n\n    {\n       69,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114,\n    -1114,-1114,-1114,-1114,-1114,-1114,-1114,-1114\n    },\n\n    {\n       69,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115,\n    -1115,-1115,-1115,-1115,-1115,-1115,-1115,-1115\n    },\n\n    {\n       69,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116, 1202,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116,\n\n    -1116,-1116,-1116,-1116,-1116,-1116,-1116,-1116\n    },\n\n    {\n       69,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117, 1203,-1117,-1117,-1117,-1117,-1117,-1117,\n\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117,\n    -1117,-1117,-1117,-1117,-1117,-1117,-1117,-1117\n    },\n\n    {\n       69,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118, 1204,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118,\n    -1118,-1118,-1118,-1118,-1118,-1118,-1118,-1118\n    },\n\n    {\n       69,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119, 1205,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119,\n    -1119,-1119,-1119,-1119,-1119,-1119,-1119,-1119\n\n    },\n\n    {\n       69,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120, 1206,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120,\n    -1120,-1120,-1120,-1120,-1120,-1120,-1120,-1120\n    },\n\n    {\n       69,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121, 1207,-1121,\n\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121,\n    -1121,-1121,-1121,-1121,-1121,-1121,-1121,-1121\n    },\n\n    {\n       69,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122, 1208,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122,\n    -1122,-1122,-1122,-1122,-1122,-1122,-1122,-1122\n    },\n\n    {\n       69,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n     1209,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123,\n    -1123,-1123,-1123,-1123,-1123,-1123,-1123,-1123\n    },\n\n    {\n       69,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124, 1210,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124,\n    -1124,-1124,-1124,-1124,-1124,-1124,-1124,-1124\n    },\n\n    {\n       69,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125, 1211,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125,\n    -1125,-1125,-1125,-1125,-1125,-1125,-1125,-1125\n    },\n\n    {\n       69,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126, 1212,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126,\n\n    -1126,-1126,-1126,-1126,-1126,-1126,-1126,-1126\n    },\n\n    {\n       69,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127, 1213,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127,\n    -1127,-1127,-1127,-1127,-1127,-1127,-1127,-1127\n    },\n\n    {\n       69,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128, 1214,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128,\n    -1128,-1128,-1128,-1128,-1128,-1128,-1128,-1128\n    },\n\n    {\n       69,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n\n    -1129,-1129, 1215,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129,\n    -1129,-1129,-1129,-1129,-1129,-1129,-1129,-1129\n\n    },\n\n    {\n       69,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130, 1216,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130,\n    -1130,-1130,-1130,-1130,-1130,-1130,-1130,-1130\n    },\n\n    {\n       69,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131,\n    -1131,-1131,-1131,-1131,-1131,-1131,-1131,-1131\n    },\n\n    {\n       69,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132, 1217,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132,\n    -1132,-1132,-1132,-1132,-1132,-1132,-1132,-1132\n    },\n\n    {\n       69,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133, 1218,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133,\n    -1133,-1133,-1133,-1133,-1133,-1133,-1133,-1133\n    },\n\n    {\n       69,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134, 1219,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134,\n    -1134,-1134,-1134,-1134,-1134,-1134,-1134,-1134\n    },\n\n    {\n       69,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135,\n    -1135,-1135,-1135,-1135,-1135,-1135,-1135,-1135\n    },\n\n    {\n       69,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136,\n\n    -1136,-1136,-1136,-1136,-1136,-1136,-1136,-1136\n    },\n\n    {\n       69,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137, 1220,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137,\n    -1137,-1137,-1137,-1137,-1137,-1137,-1137,-1137\n    },\n\n    {\n       69,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138, 1221,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138,\n    -1138,-1138,-1138,-1138,-1138,-1138,-1138,-1138\n    },\n\n    {\n       69,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n\n    -1139,-1139, 1222,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139,\n    -1139,-1139,-1139,-1139,-1139,-1139,-1139,-1139\n\n    },\n\n    {\n       69,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140, 1223,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140,\n    -1140,-1140,-1140,-1140,-1140,-1140,-1140,-1140\n    },\n\n    {\n       69,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141,\n    -1141,-1141,-1141,-1141,-1141,-1141,-1141,-1141\n    },\n\n    {\n       69,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142,\n    -1142,-1142,-1142,-1142,-1142,-1142,-1142,-1142\n    },\n\n    {\n       69,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143, 1224,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143,\n    -1143,-1143,-1143,-1143,-1143,-1143,-1143,-1143\n    },\n\n    {\n       69,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144, 1225,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144,\n    -1144,-1144,-1144,-1144,-1144,-1144,-1144,-1144\n    },\n\n    {\n       69,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145, 1226,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145,\n    -1145,-1145,-1145,-1145,-1145,-1145,-1145,-1145\n    },\n\n    {\n       69,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146, 1227,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146,\n\n    -1146,-1146,-1146,-1146,-1146,-1146,-1146,-1146\n    },\n\n    {\n       69,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147, 1228,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n     1229,-1147,-1147, 1230,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147,\n    -1147,-1147,-1147,-1147,-1147,-1147,-1147,-1147\n    },\n\n    {\n       69,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148, 1231,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148,\n    -1148,-1148,-1148,-1148,-1148,-1148,-1148,-1148\n    },\n\n    {\n       69,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n\n    -1149,-1149, 1232,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149,\n    -1149,-1149,-1149,-1149,-1149,-1149,-1149,-1149\n\n    },\n\n    {\n       69,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150, 1233,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150,\n    -1150,-1150,-1150,-1150,-1150,-1150,-1150,-1150\n    },\n\n    {\n       69,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151, 1234,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151,\n    -1151,-1151,-1151,-1151,-1151,-1151,-1151,-1151\n    },\n\n    {\n       69,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,\n    -1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,\n    -1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,\n    -1152,-1152, 1235,-1152,-1152,-1152,-1152,-1152,-1152,-1152,\n\n    -1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152, 1236, 1236,\n     1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,-1152,-1152,\n    -1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,\n    -1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,\n    -1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,\n    -1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,\n    -1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,\n    -1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152,\n    -1152,-1152,-1152,-1152,-1152,-1152,-1152,-1152\n    },\n\n    {\n       69,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,\n\n    -1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,\n    -1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,\n    -1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,\n    -1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,\n    -1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,\n    -1153,-1153,-1153,-1153,-1153,-1153, 1237,-1153,-1153,-1153,\n    -1153,-1153, 1238,-1153,-1153,-1153, 1239,-1153,-1153,-1153,\n    -1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153, 1240, 1241,\n     1242,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,\n    -1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,\n\n    -1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,\n    -1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153\n    },\n\n    {\n       69,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,\n    -1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,\n    -1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,\n    -1154,-1154, 1243,-1154,-1154,-1154,-1154,-1154,-1154,-1154,\n    -1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,\n    -1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,\n    -1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,\n    -1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,\n\n    -1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,\n    -1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,\n    -1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,\n    -1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154,\n    -1154,-1154,-1154,-1154,-1154,-1154,-1154,-1154\n    },\n\n    {\n       69,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,\n    -1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,\n    -1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,\n    -1155,-1155, 1244,-1155,-1155,-1155,-1155,-1155,-1155,-1155,\n    -1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155, 1245, 1245,\n\n     1245, 1245, 1245, 1245, 1245, 1245, 1245, 1245,-1155,-1155,\n    -1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,\n    -1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,\n    -1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,\n    -1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,\n    -1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,\n    -1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155,\n    -1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155\n    },\n\n    {\n       69,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,\n    -1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,\n\n    -1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,\n    -1156,-1156, 1246,-1156,-1156,-1156,-1156,-1156,-1156,-1156,\n    -1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,\n    -1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,\n    -1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,\n    -1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,\n    -1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,\n    -1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,\n    -1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,\n    -1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156,\n\n    -1156,-1156,-1156,-1156,-1156,-1156,-1156,-1156\n    },\n\n    {\n       69,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,\n    -1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,\n    -1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,\n    -1157,-1157, 1247,-1157,-1157,-1157,-1157,-1157,-1157,-1157,\n    -1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157, 1248, 1248,\n     1248, 1248, 1248, 1248, 1248, 1248, 1248, 1248,-1157,-1157,\n    -1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,\n    -1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,\n    -1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,\n\n    -1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,\n    -1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,\n    -1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157,\n    -1157,-1157,-1157,-1157,-1157,-1157,-1157,-1157\n    },\n\n    {\n       69,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,\n    -1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,\n    -1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,\n    -1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,\n    -1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,\n    -1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,\n\n    -1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,\n    -1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,\n    -1158,-1158,-1158,-1158, 1249,-1158,-1158,-1158,-1158,-1158,\n    -1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,\n    -1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,\n    -1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158,\n    -1158,-1158,-1158,-1158,-1158,-1158,-1158,-1158\n    },\n\n    {\n       69,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,\n    -1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,\n    -1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,\n\n    -1159,-1159, 1250,-1159,-1159,-1159,-1159,-1159,-1159,-1159,\n    -1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,\n    -1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,\n    -1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,\n    -1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,\n    -1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,\n    -1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,\n    -1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,\n    -1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159,\n    -1159,-1159,-1159,-1159,-1159,-1159,-1159,-1159\n\n    },\n\n    {\n       69,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,\n    -1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,\n    -1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,\n    -1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,\n    -1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,\n    -1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,\n    -1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,\n    -1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,\n    -1160,-1160,-1160, 1251,-1160,-1160,-1160,-1160,-1160,-1160,\n    -1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,\n\n    -1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,\n    -1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160,\n    -1160,-1160,-1160,-1160,-1160,-1160,-1160,-1160\n    },\n\n    {\n       69,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,\n    -1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,\n    -1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,\n    -1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,\n    -1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,\n    -1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,\n    -1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,\n\n    -1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,\n    -1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,\n    -1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,\n    -1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,\n    -1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161,\n    -1161,-1161,-1161,-1161,-1161,-1161,-1161,-1161\n    },\n\n    {\n       69,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,\n    -1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,\n    -1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,\n    -1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,\n\n    -1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,\n    -1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,\n    -1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,\n    -1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,\n    -1162, 1252,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,\n    -1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,\n    -1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,\n    -1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162,\n    -1162,-1162,-1162,-1162,-1162,-1162,-1162,-1162\n    },\n\n    {\n       69,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,\n\n    -1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,\n    -1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,\n    -1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,\n    -1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,\n    -1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,\n    -1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,\n    -1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,\n    -1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,\n    -1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,\n    -1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,\n\n    -1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163,\n    -1163,-1163,-1163,-1163,-1163,-1163,-1163,-1163\n    },\n\n    {\n       69,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,\n    -1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,\n    -1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,\n    -1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,\n    -1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,\n    -1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,\n    -1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,\n    -1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,\n\n    -1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,\n    -1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,\n    -1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,\n    -1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164,\n    -1164,-1164,-1164,-1164,-1164,-1164,-1164,-1164\n    },\n\n    {\n       69,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,\n    -1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,\n    -1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,\n    -1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,\n    -1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,\n\n    -1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,\n    -1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,\n     1253,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,\n    -1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,\n    -1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,\n    -1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,\n    -1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165,\n    -1165,-1165,-1165,-1165,-1165,-1165,-1165,-1165\n    },\n\n    {\n       69,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,\n    -1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,\n\n    -1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,\n    -1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,\n    -1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,\n    -1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,\n    -1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,\n    -1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,\n    -1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,\n    -1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,\n    -1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,\n    -1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166,\n\n    -1166,-1166,-1166,-1166,-1166,-1166,-1166,-1166\n    },\n\n    {\n       69,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,\n    -1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,\n    -1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,\n    -1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,\n    -1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,\n    -1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,\n    -1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,\n    -1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,\n    -1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,\n\n    -1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,\n    -1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,\n    -1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167,\n    -1167,-1167,-1167,-1167,-1167,-1167,-1167,-1167\n    },\n\n    {\n       69,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,\n    -1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,\n    -1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,\n    -1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,\n    -1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,\n    -1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,\n\n    -1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,\n    -1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,\n    -1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,\n    -1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,\n    -1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,\n    -1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168,\n    -1168,-1168,-1168,-1168,-1168,-1168,-1168,-1168\n    },\n\n    {\n       69,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,\n    -1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,\n    -1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,\n\n    -1169,-1169, 1254,-1169,-1169,-1169,-1169,-1169,-1169,-1169,\n    -1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,\n    -1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,\n    -1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,\n    -1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,\n    -1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,\n    -1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,\n    -1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,\n    -1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169,\n    -1169,-1169,-1169,-1169,-1169,-1169,-1169,-1169\n\n    },\n\n    {\n       69,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,\n    -1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,\n    -1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,\n    -1170,-1170, 1255,-1170,-1170,-1170,-1170,-1170,-1170,-1170,\n    -1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,\n    -1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,\n    -1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,\n    -1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,\n    -1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,\n    -1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,\n\n    -1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,\n    -1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170,\n    -1170,-1170,-1170,-1170,-1170,-1170,-1170,-1170\n    },\n\n    {\n       69,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,\n    -1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,\n    -1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,\n    -1171,-1171, 1256,-1171,-1171,-1171,-1171,-1171,-1171,-1171,\n    -1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,\n    -1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,\n    -1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,\n\n    -1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,\n    -1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,\n    -1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,\n    -1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,\n    -1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171,\n    -1171,-1171,-1171,-1171,-1171,-1171,-1171,-1171\n    },\n\n    {\n       69,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,\n    -1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,\n    -1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,\n    -1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,\n\n    -1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,\n    -1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,\n    -1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,\n    -1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,\n    -1172,-1172,-1172, 1257,-1172,-1172,-1172,-1172,-1172,-1172,\n    -1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,\n    -1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,\n    -1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172,\n    -1172,-1172,-1172,-1172,-1172,-1172,-1172,-1172\n    },\n\n    {\n       69,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,\n\n    -1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,\n    -1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,\n    -1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,\n    -1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,\n    -1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,\n    -1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,\n    -1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,\n    -1173,-1173, 1258,-1173,-1173,-1173,-1173,-1173,-1173,-1173,\n    -1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,\n    -1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,\n\n    -1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173,\n    -1173,-1173,-1173,-1173,-1173,-1173,-1173,-1173\n    },\n\n    {\n       69,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,\n    -1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,\n    -1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,\n    -1174,-1174, 1259,-1174,-1174,-1174,-1174,-1174,-1174,-1174,\n    -1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,\n    -1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,\n    -1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,\n    -1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,\n\n    -1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,\n    -1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,\n    -1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,\n    -1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174,\n    -1174,-1174,-1174,-1174,-1174,-1174,-1174,-1174\n    },\n\n    {\n       69,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,\n    -1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,\n    -1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,\n    -1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,\n    -1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,\n\n    -1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,\n    -1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,\n    -1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,\n    -1175,-1175,-1175,-1175, 1260,-1175,-1175,-1175,-1175,-1175,\n    -1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,\n    -1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,\n    -1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175,\n    -1175,-1175,-1175,-1175,-1175,-1175,-1175,-1175\n    },\n\n    {\n       69,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,\n    -1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,\n\n    -1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,\n    -1176,-1176, 1261,-1176,-1176,-1176,-1176,-1176,-1176,-1176,\n    -1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,\n    -1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,\n    -1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,\n    -1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,\n    -1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,\n    -1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,\n    -1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,\n    -1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176,\n\n    -1176,-1176,-1176,-1176,-1176,-1176,-1176,-1176\n    },\n\n    {\n       69,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,\n    -1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,\n    -1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,\n    -1177,-1177, 1262,-1177,-1177,-1177,-1177,-1177,-1177,-1177,\n    -1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,\n    -1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,\n    -1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,\n    -1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,\n    -1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,\n\n    -1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,\n    -1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,\n    -1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177,\n    -1177,-1177,-1177,-1177,-1177,-1177,-1177,-1177\n    },\n\n    {\n       69,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,\n    -1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,\n    -1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,\n    -1178,-1178, 1263,-1178,-1178,-1178,-1178,-1178,-1178,-1178,\n    -1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,\n    -1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,\n\n    -1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,\n    -1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,\n    -1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,\n    -1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,\n    -1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,\n    -1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178,\n    -1178,-1178,-1178,-1178,-1178,-1178,-1178,-1178\n    },\n\n    {\n       69,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,\n    -1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,\n    -1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,\n\n    -1179,-1179, 1264,-1179,-1179,-1179,-1179,-1179,-1179,-1179,\n    -1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,\n    -1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,\n    -1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,\n    -1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,\n    -1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,\n    -1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,\n    -1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,\n    -1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179,\n    -1179,-1179,-1179,-1179,-1179,-1179,-1179,-1179\n\n    },\n\n    {\n       69,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,\n    -1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,\n    -1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,\n    -1180,-1180, 1265,-1180,-1180,-1180,-1180,-1180,-1180,-1180,\n    -1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,\n    -1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,\n    -1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,\n    -1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,\n    -1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,\n    -1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,\n\n    -1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,\n    -1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180,\n    -1180,-1180,-1180,-1180,-1180,-1180,-1180,-1180\n    },\n\n    {\n       69,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,\n    -1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,\n    -1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,\n    -1181,-1181, 1266,-1181,-1181,-1181,-1181,-1181,-1181,-1181,\n    -1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,\n    -1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,\n    -1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,\n\n    -1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,\n    -1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,\n    -1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,\n    -1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,\n    -1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181,\n    -1181,-1181,-1181,-1181,-1181,-1181,-1181,-1181\n    },\n\n    {\n       69,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,\n    -1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,\n    -1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,\n    -1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,\n\n    -1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,\n    -1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,\n    -1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,\n    -1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,\n    -1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,\n    -1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,\n    -1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,\n    -1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182,\n    -1182,-1182,-1182,-1182,-1182,-1182,-1182,-1182\n    },\n\n    {\n       69,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,\n\n    -1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,\n    -1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,\n    -1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,\n    -1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,\n    -1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,\n    -1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,\n    -1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,\n    -1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,\n    -1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,\n    -1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,\n\n    -1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183,\n    -1183,-1183,-1183,-1183,-1183,-1183,-1183,-1183\n    },\n\n    {\n       69,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,\n    -1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,\n    -1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,\n    -1184,-1184, 1267,-1184,-1184,-1184,-1184,-1184,-1184,-1184,\n    -1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,\n    -1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,\n    -1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,\n    -1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,\n\n    -1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,\n    -1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,\n    -1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,\n    -1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184,\n    -1184,-1184,-1184,-1184,-1184,-1184,-1184,-1184\n    },\n\n    {\n       69,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,\n    -1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,\n    -1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,\n    -1185,-1185, 1268,-1185,-1185,-1185,-1185,-1185,-1185,-1185,\n    -1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,\n\n    -1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,\n    -1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,\n    -1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,\n    -1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,\n    -1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,\n    -1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,\n    -1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185,\n    -1185,-1185,-1185,-1185,-1185,-1185,-1185,-1185\n    },\n\n    {\n       69,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,\n    -1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,\n\n    -1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,\n    -1186,-1186, 1269,-1186,-1186,-1186,-1186,-1186,-1186,-1186,\n    -1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,\n    -1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,\n    -1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,\n    -1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,\n    -1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,\n    -1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,\n    -1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,\n    -1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186,\n\n    -1186,-1186,-1186,-1186,-1186,-1186,-1186,-1186\n    },\n\n    {\n       69,-1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,\n    -1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,\n    -1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,\n    -1187,-1187, 1270,-1187,-1187,-1187,-1187,-1187,-1187,-1187,\n    -1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,\n    -1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,\n    -1187,-1187,-1187,-1187,-1187, 1270, 1270, 1270, 1270, 1270,\n     1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270,\n     1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270,\n\n     1270,-1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,\n    -1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,\n    -1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187,\n    -1187,-1187,-1187,-1187,-1187,-1187,-1187,-1187\n    },\n\n    {\n       69,-1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,\n    -1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,\n    -1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,\n    -1188,-1188, 1271,-1188,-1188,-1188,-1188,-1188,-1188,-1188,\n    -1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,\n    -1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,\n\n    -1188,-1188,-1188,-1188,-1188, 1271, 1271, 1271, 1271, 1271,\n     1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271,\n     1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271,\n     1271,-1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,\n    -1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,\n    -1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188,\n    -1188,-1188,-1188,-1188,-1188,-1188,-1188,-1188\n    },\n\n    {\n       69,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,\n    -1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,\n    -1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,\n\n    -1189,-1189, 1272,-1189,-1189,-1189,-1189,-1189,-1189,-1189,\n    -1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,\n    -1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,\n    -1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,\n    -1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,\n    -1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,\n    -1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,\n    -1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,\n    -1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189,\n    -1189,-1189,-1189,-1189,-1189,-1189,-1189,-1189\n\n    },\n\n    {\n       69,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,\n    -1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,\n    -1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,\n    -1190,-1190, 1273,-1190,-1190,-1190,-1190,-1190,-1190,-1190,\n    -1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,\n    -1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,\n    -1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,\n    -1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,\n    -1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,\n    -1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,\n\n    -1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,\n    -1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190,\n    -1190,-1190,-1190,-1190,-1190,-1190,-1190,-1190\n    },\n\n    {\n       69,-1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,\n    -1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,\n    -1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,\n    -1191,-1191, 1274,-1191,-1191,-1191,-1191,-1191,-1191,-1191,\n    -1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,\n    -1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,\n    -1191,-1191,-1191,-1191,-1191, 1274, 1274, 1274, 1274, 1274,\n\n     1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274,\n     1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274,\n     1274,-1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,\n    -1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,\n    -1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191,\n    -1191,-1191,-1191,-1191,-1191,-1191,-1191,-1191\n    },\n\n    {\n       69,-1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,\n    -1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,\n    -1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,\n    -1192,-1192, 1275,-1192,-1192,-1192,-1192,-1192,-1192,-1192,\n\n    -1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,\n    -1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,\n    -1192,-1192,-1192,-1192,-1192, 1275, 1275, 1275, 1275, 1275,\n     1275, 1275, 1275, 1275, 1275, 1275, 1275, 1275, 1275, 1275,\n     1275, 1275, 1275, 1275, 1275, 1275, 1275, 1275, 1275, 1275,\n     1275,-1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,\n    -1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,\n    -1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192,\n    -1192,-1192,-1192,-1192,-1192,-1192,-1192,-1192\n    },\n\n    {\n       69,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,\n\n    -1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,\n    -1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,\n    -1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,\n    -1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,\n    -1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,\n    -1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,\n    -1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,\n    -1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,\n    -1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,\n    -1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,\n\n    -1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193,\n    -1193,-1193,-1193,-1193,-1193,-1193,-1193,-1193\n    },\n\n    {\n       69,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,\n    -1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,\n    -1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,\n    -1194,-1194, 1276,-1194,-1194,-1194,-1194,-1194,-1194,-1194,\n    -1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,\n    -1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,\n    -1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,\n    -1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,\n\n    -1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,\n    -1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,\n    -1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,\n    -1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194,\n    -1194,-1194,-1194,-1194,-1194,-1194,-1194,-1194\n    },\n\n    {\n       69,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,\n    -1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,\n    -1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,\n    -1195,-1195, 1277,-1195,-1195,-1195,-1195,-1195,-1195,-1195,\n    -1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,\n\n    -1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,\n    -1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,\n    -1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,\n    -1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,\n    -1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,\n    -1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,\n    -1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195,\n    -1195,-1195,-1195,-1195,-1195,-1195,-1195,-1195\n    },\n\n    {\n       69,-1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,\n    -1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,\n\n    -1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,\n    -1196,-1196, 1278,-1196,-1196,-1196,-1196,-1196,-1196,-1196,\n    -1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,\n    -1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,\n    -1196,-1196,-1196,-1196,-1196, 1278, 1278, 1278, 1278, 1278,\n     1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278,\n     1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278,\n     1278,-1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,\n    -1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,\n    -1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196,\n\n    -1196,-1196,-1196,-1196,-1196,-1196,-1196,-1196\n    },\n\n    {\n       69,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,\n    -1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,\n    -1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,\n    -1197,-1197, 1279,-1197,-1197,-1197,-1197,-1197,-1197,-1197,\n    -1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,\n    -1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,\n    -1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,\n    -1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,\n    -1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,\n\n    -1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,\n    -1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,\n    -1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197,\n    -1197,-1197,-1197,-1197,-1197,-1197,-1197,-1197\n    },\n\n    {\n       69,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,\n    -1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,\n    -1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,\n    -1198,-1198, 1280,-1198,-1198,-1198,-1198,-1198,-1198,-1198,\n    -1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,\n    -1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,\n\n    -1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,\n    -1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,\n    -1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,\n    -1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,\n    -1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,\n    -1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198,\n    -1198,-1198,-1198,-1198,-1198,-1198,-1198,-1198\n    },\n\n    {\n       69,-1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,\n    -1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,\n    -1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,\n\n    -1199,-1199, 1281,-1199,-1199,-1199,-1199,-1199,-1199,-1199,\n    -1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,\n    -1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,\n    -1199,-1199,-1199,-1199,-1199, 1281, 1281, 1281, 1281, 1281,\n     1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,\n     1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,\n     1281,-1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,\n    -1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,\n    -1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199,\n    -1199,-1199,-1199,-1199,-1199,-1199,-1199,-1199\n\n    },\n\n    {\n       69,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,\n    -1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,\n    -1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,\n    -1200,-1200, 1282,-1200,-1200,-1200,-1200,-1200,-1200,-1200,\n    -1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,\n    -1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,\n    -1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,\n    -1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,\n    -1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,\n    -1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,\n\n    -1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,\n    -1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200,\n    -1200,-1200,-1200,-1200,-1200,-1200,-1200,-1200\n    },\n\n    {\n       69,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,\n    -1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,\n    -1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,\n    -1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,\n    -1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,\n    -1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,\n    -1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,\n\n    -1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,\n    -1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,\n    -1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,\n    -1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,\n    -1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201,\n    -1201,-1201,-1201,-1201,-1201,-1201,-1201,-1201\n    },\n\n    {\n       69,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,\n    -1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,\n    -1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,\n    -1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,\n\n    -1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,\n    -1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,\n    -1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,\n    -1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,\n    -1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,\n    -1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,\n    -1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,\n    -1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202,\n    -1202,-1202,-1202,-1202,-1202,-1202,-1202,-1202\n    },\n\n    {\n       69,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,\n\n    -1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,\n    -1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,\n    -1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,\n    -1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,\n    -1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,\n    -1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,\n    -1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,\n    -1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,\n    -1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,\n    -1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,\n\n    -1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203,\n    -1203,-1203,-1203,-1203,-1203,-1203,-1203,-1203\n    },\n\n    {\n       69,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,\n    -1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,\n    -1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,\n    -1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,\n    -1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,\n    -1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,\n    -1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,\n    -1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,\n\n    -1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,\n    -1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,\n    -1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,\n    -1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204,\n    -1204,-1204,-1204,-1204,-1204,-1204,-1204,-1204\n    },\n\n    {\n       69,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,\n    -1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,\n    -1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,\n    -1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,\n    -1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,\n\n    -1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,\n    -1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,\n    -1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,\n    -1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,\n    -1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,\n    -1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,\n    -1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205,\n    -1205,-1205,-1205,-1205,-1205,-1205,-1205,-1205\n    },\n\n    {\n       69,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,\n    -1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,\n\n    -1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,\n    -1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,\n    -1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,\n    -1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,\n    -1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,\n    -1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,\n    -1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,\n    -1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,\n    -1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,\n    -1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206,\n\n    -1206,-1206,-1206,-1206,-1206,-1206,-1206,-1206\n    },\n\n    {\n       69,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,\n    -1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,\n    -1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,\n    -1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,\n    -1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,\n    -1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,\n    -1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,\n    -1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,\n    -1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,\n\n    -1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,\n    -1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,\n    -1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207,\n    -1207,-1207,-1207,-1207,-1207,-1207,-1207,-1207\n    },\n\n    {\n       69,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,\n    -1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,\n    -1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,\n    -1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,\n    -1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,\n    -1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,\n\n    -1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,\n    -1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,\n    -1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,\n    -1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,\n    -1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,\n    -1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208,\n    -1208,-1208,-1208,-1208,-1208,-1208,-1208,-1208\n    },\n\n    {\n       69,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,\n    -1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,\n    -1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,\n\n    -1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,\n    -1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,\n    -1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,\n    -1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,\n    -1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,\n    -1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,\n    -1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,\n    -1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,\n    -1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209,\n    -1209,-1209,-1209,-1209,-1209,-1209,-1209,-1209\n\n    },\n\n    {\n       69,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,\n    -1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,\n    -1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,\n    -1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,\n    -1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,\n    -1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,\n    -1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,\n    -1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,\n    -1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,\n    -1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,\n\n    -1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,\n    -1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210,\n    -1210,-1210,-1210,-1210,-1210,-1210,-1210,-1210\n    },\n\n    {\n       69,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,\n    -1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,\n    -1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,\n    -1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,\n    -1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,\n    -1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,\n    -1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,\n\n    -1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,\n    -1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,\n    -1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,\n    -1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,\n    -1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211,\n    -1211,-1211,-1211,-1211,-1211,-1211,-1211,-1211\n    },\n\n    {\n       69,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,\n    -1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,\n    -1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,\n    -1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,\n\n    -1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,\n    -1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,\n    -1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,\n    -1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,\n    -1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,\n    -1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,\n    -1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,\n    -1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212,\n    -1212,-1212,-1212,-1212,-1212,-1212,-1212,-1212\n    },\n\n    {\n       69,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,\n\n    -1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,\n    -1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,\n    -1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,\n    -1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,\n    -1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,\n    -1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,\n    -1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,\n    -1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,\n    -1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,\n    -1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,\n\n    -1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213,\n    -1213,-1213,-1213,-1213,-1213,-1213,-1213,-1213\n    },\n\n    {\n       69,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,\n    -1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,\n    -1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,\n    -1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,\n    -1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,\n    -1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,\n    -1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,\n    -1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,\n\n    -1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,\n    -1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,\n    -1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,\n    -1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214,\n    -1214,-1214,-1214,-1214,-1214,-1214,-1214,-1214\n    },\n\n    {\n       69,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,\n    -1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,\n    -1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,\n    -1215,-1215, 1283,-1215,-1215,-1215,-1215,-1215,-1215,-1215,\n    -1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,\n\n    -1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,\n    -1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,\n    -1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,\n    -1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,\n    -1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,\n    -1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,\n    -1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215,\n    -1215,-1215,-1215,-1215,-1215,-1215,-1215,-1215\n    },\n\n    {\n       69,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,\n    -1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,\n\n    -1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,\n    -1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,\n    -1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,\n    -1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,\n    -1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,\n    -1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,\n    -1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,\n    -1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,\n    -1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,\n    -1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216,\n\n    -1216,-1216,-1216,-1216,-1216,-1216,-1216,-1216\n    },\n\n    {\n       69,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,\n    -1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,\n    -1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,\n    -1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,\n    -1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,\n    -1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,\n    -1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,\n    -1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,\n    -1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,\n\n    -1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,\n    -1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,\n    -1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217,\n    -1217,-1217,-1217,-1217,-1217,-1217,-1217,-1217\n    },\n\n    {\n       69,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,\n    -1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,\n    -1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,\n    -1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,\n    -1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,\n    -1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,\n\n    -1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,\n    -1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,\n    -1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,\n    -1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,\n    -1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,\n    -1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218,\n    -1218,-1218,-1218,-1218,-1218,-1218,-1218,-1218\n    },\n\n    {\n       69,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,\n    -1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,\n    -1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,\n\n    -1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,\n    -1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,\n    -1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,\n    -1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,\n    -1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,\n    -1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,\n    -1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,\n    -1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,\n    -1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219,\n    -1219,-1219,-1219,-1219,-1219,-1219,-1219,-1219\n\n    },\n\n    {\n       69,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,\n    -1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,\n    -1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,\n    -1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,\n    -1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,\n    -1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,\n    -1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,\n    -1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,\n    -1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,\n    -1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,\n\n    -1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,\n    -1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220,\n    -1220,-1220,-1220,-1220,-1220,-1220,-1220,-1220\n    },\n\n    {\n       69,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,\n    -1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,\n    -1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,\n    -1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,\n    -1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,\n    -1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,\n    -1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,\n\n    -1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,\n    -1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,\n    -1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,\n    -1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,\n    -1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221,\n    -1221,-1221,-1221,-1221,-1221,-1221,-1221,-1221\n    },\n\n    {\n       69,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,\n    -1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,\n    -1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,\n    -1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,\n\n    -1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,\n    -1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,\n    -1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,\n    -1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,\n    -1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,\n    -1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,\n    -1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,\n    -1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222,\n    -1222,-1222,-1222,-1222,-1222,-1222,-1222,-1222\n    },\n\n    {\n       69,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,\n\n    -1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,\n    -1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,\n    -1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,\n    -1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,\n    -1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,\n    -1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,\n    -1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,\n    -1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,\n    -1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,\n    -1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,\n\n    -1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223,\n    -1223,-1223,-1223,-1223,-1223,-1223,-1223,-1223\n    },\n\n    {\n       69,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,\n    -1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,\n    -1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,\n    -1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,\n    -1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,\n    -1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,\n    -1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,\n    -1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,\n\n    -1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,\n    -1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,\n    -1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,\n    -1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224,\n    -1224,-1224,-1224,-1224,-1224,-1224,-1224,-1224\n    },\n\n    {\n       69,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,\n    -1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,\n    -1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,\n    -1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,\n    -1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,\n\n    -1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,\n    -1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,\n    -1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,\n    -1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,\n    -1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,\n    -1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,\n    -1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225,\n    -1225,-1225,-1225,-1225,-1225,-1225,-1225,-1225\n    },\n\n    {\n       69,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,\n    -1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,\n\n    -1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,\n    -1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,\n    -1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,\n    -1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,\n    -1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,\n    -1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,\n    -1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,\n    -1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,\n    -1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,\n    -1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226,\n\n    -1226,-1226,-1226,-1226,-1226,-1226,-1226,-1226\n    },\n\n    {\n       69,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,\n    -1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,\n    -1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,\n    -1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,\n    -1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,\n    -1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,\n    -1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,\n    -1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,\n    -1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,\n\n    -1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,\n    -1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,\n    -1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227,\n    -1227,-1227,-1227,-1227,-1227,-1227,-1227,-1227\n    },\n\n    {\n       69,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,\n    -1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,\n    -1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,\n    -1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,\n    -1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,\n    -1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,\n\n    -1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,\n    -1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,\n    -1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,\n    -1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,\n    -1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,\n    -1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228,\n    -1228,-1228,-1228,-1228,-1228,-1228,-1228,-1228\n    },\n\n    {\n       69,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,\n    -1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,\n    -1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,\n\n    -1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,\n    -1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,\n    -1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,\n    -1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,\n    -1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,\n    -1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,\n    -1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,\n    -1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,\n    -1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229,\n    -1229,-1229,-1229,-1229,-1229,-1229,-1229,-1229\n\n    },\n\n    {\n       69,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,\n    -1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,\n    -1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,\n    -1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,\n    -1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,\n    -1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,\n    -1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,\n    -1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,\n    -1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,\n    -1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,\n\n    -1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,\n    -1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230,\n    -1230,-1230,-1230,-1230,-1230,-1230,-1230,-1230\n    },\n\n    {\n       69,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,\n    -1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,\n    -1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,\n    -1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,\n    -1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,\n    -1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,\n    -1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,\n\n    -1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,\n    -1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,\n    -1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,\n    -1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,\n    -1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231,\n    -1231,-1231,-1231,-1231,-1231,-1231,-1231,-1231\n    },\n\n    {\n       69,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,\n    -1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,\n    -1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,\n    -1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,\n\n    -1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,\n    -1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,\n    -1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,\n    -1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,\n    -1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,\n    -1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,\n    -1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,\n    -1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232,\n    -1232,-1232,-1232,-1232,-1232,-1232,-1232,-1232\n    },\n\n    {\n       69,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,\n\n    -1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,\n    -1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,\n    -1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,\n    -1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,\n    -1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,\n    -1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,\n    -1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,\n    -1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,\n    -1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,\n    -1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,\n\n    -1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233,\n    -1233,-1233,-1233,-1233,-1233,-1233,-1233,-1233\n    },\n\n    {\n       69,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,\n    -1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,\n    -1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,\n    -1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,\n    -1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,\n    -1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,\n    -1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,\n    -1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,\n\n    -1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,\n    -1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,\n    -1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,\n    -1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234,\n    -1234,-1234,-1234,-1234,-1234,-1234,-1234,-1234\n    },\n\n    {\n       69,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,\n    -1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,\n    -1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,\n    -1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,\n    -1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,\n\n    -1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,\n    -1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,\n    -1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,\n    -1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,\n    -1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,\n    -1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,\n    -1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235,\n    -1235,-1235,-1235,-1235,-1235,-1235,-1235,-1235\n    },\n\n    {\n       69,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,\n    -1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,\n\n    -1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,\n    -1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,\n    -1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,\n    -1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,\n    -1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,\n    -1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,\n    -1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,\n    -1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,\n    -1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,\n    -1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236,\n\n    -1236,-1236,-1236,-1236,-1236,-1236,-1236,-1236\n    },\n\n    {\n       69,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,\n    -1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,\n    -1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,\n    -1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,\n    -1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,\n    -1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,\n    -1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,\n    -1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,\n    -1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,\n\n    -1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,\n    -1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,\n    -1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237,\n    -1237,-1237,-1237,-1237,-1237,-1237,-1237,-1237\n    },\n\n    {\n       69,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,\n    -1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,\n    -1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,\n    -1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,\n    -1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,\n    -1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,\n\n    -1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,\n    -1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,\n    -1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,\n    -1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,\n    -1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,\n    -1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238,\n    -1238,-1238,-1238,-1238,-1238,-1238,-1238,-1238\n    },\n\n    {\n       69,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,\n    -1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,\n    -1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,\n\n    -1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,\n    -1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,\n    -1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,\n    -1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,\n    -1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,\n    -1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,\n    -1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,\n    -1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,\n    -1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239,\n    -1239,-1239,-1239,-1239,-1239,-1239,-1239,-1239\n\n    },\n\n    {\n       69,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,\n    -1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,\n    -1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,\n    -1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,\n    -1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,\n    -1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,\n    -1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,\n    -1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,\n    -1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,\n    -1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,\n\n    -1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,\n    -1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240,\n    -1240,-1240,-1240,-1240,-1240,-1240,-1240,-1240\n    },\n\n    {\n       69,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,\n    -1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,\n    -1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,\n    -1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,\n    -1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,\n    -1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,\n    -1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,\n\n    -1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,\n    -1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,\n    -1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,\n    -1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,\n    -1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241,\n    -1241,-1241,-1241,-1241,-1241,-1241,-1241,-1241\n    },\n\n    {\n       69,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,\n    -1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,\n    -1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,\n    -1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,\n\n    -1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,\n    -1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,\n    -1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,\n    -1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,\n    -1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,\n    -1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,\n    -1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,\n    -1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242,\n    -1242,-1242,-1242,-1242,-1242,-1242,-1242,-1242\n    },\n\n    {\n       69,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,\n\n    -1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,\n    -1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,\n    -1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,\n    -1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,\n    -1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,\n    -1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,\n    -1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,\n    -1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,\n    -1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,\n    -1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,\n\n    -1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243,\n    -1243,-1243,-1243,-1243,-1243,-1243,-1243,-1243\n    },\n\n    {\n       69,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,\n    -1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,\n    -1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,\n    -1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,\n    -1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,\n    -1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,\n    -1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,\n    -1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,\n\n    -1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,\n    -1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,\n    -1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,\n    -1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244,\n    -1244,-1244,-1244,-1244,-1244,-1244,-1244,-1244\n    },\n\n    {\n       69,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,\n    -1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,\n    -1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,\n    -1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,\n    -1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,\n\n    -1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,\n    -1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,\n    -1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,\n    -1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,\n    -1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,\n    -1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,\n    -1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245,\n    -1245,-1245,-1245,-1245,-1245,-1245,-1245,-1245\n    },\n\n    {\n       69,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,\n    -1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,\n\n    -1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,\n    -1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,\n    -1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,\n    -1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,\n    -1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,\n    -1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,\n    -1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,\n    -1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,\n    -1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,\n    -1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246,\n\n    -1246,-1246,-1246,-1246,-1246,-1246,-1246,-1246\n    },\n\n    {\n       69,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,\n    -1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,\n    -1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,\n    -1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,\n    -1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,\n    -1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,\n    -1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,\n    -1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,\n    -1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,\n\n    -1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,\n    -1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,\n    -1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247,\n    -1247,-1247,-1247,-1247,-1247,-1247,-1247,-1247\n    },\n\n    {\n       69,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,\n    -1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,\n    -1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,\n    -1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,\n    -1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,\n    -1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,\n\n    -1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,\n    -1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,\n    -1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,\n    -1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,\n    -1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,\n    -1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248,\n    -1248,-1248,-1248,-1248,-1248,-1248,-1248,-1248\n    },\n\n    {\n       69,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,\n    -1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,\n    -1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,\n\n    -1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,\n    -1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,\n    -1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,\n    -1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,\n    -1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,\n    -1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,\n    -1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,\n    -1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,\n    -1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249,\n    -1249,-1249,-1249,-1249,-1249,-1249,-1249,-1249\n\n    },\n\n    {\n       69,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,\n    -1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,\n    -1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,\n    -1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,\n    -1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,\n    -1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,\n    -1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,\n    -1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,\n    -1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,\n    -1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,\n\n    -1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,\n    -1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250,\n    -1250,-1250,-1250,-1250,-1250,-1250,-1250,-1250\n    },\n\n    {\n       69,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,\n    -1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,\n    -1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,\n    -1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,\n    -1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,\n    -1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,\n    -1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,\n\n    -1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,\n    -1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,\n    -1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,\n    -1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,\n    -1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251,\n    -1251,-1251,-1251,-1251,-1251,-1251,-1251,-1251\n    },\n\n    {\n       69,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,\n    -1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,\n    -1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,\n    -1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,\n\n    -1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,\n    -1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,\n    -1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,\n    -1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,\n    -1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,\n    -1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,\n    -1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,\n    -1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252,\n    -1252,-1252,-1252,-1252,-1252,-1252,-1252,-1252\n    },\n\n    {\n       69,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,\n\n    -1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,\n    -1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,\n    -1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,\n    -1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,\n    -1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,\n    -1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,\n    -1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,\n    -1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,\n    -1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,\n    -1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,\n\n    -1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253,\n    -1253,-1253,-1253,-1253,-1253,-1253,-1253,-1253\n    },\n\n    {\n       69,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,\n    -1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,\n    -1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,\n    -1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,\n    -1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,\n    -1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,\n    -1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,\n    -1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,\n\n    -1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,\n    -1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,\n    -1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,\n    -1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254,\n    -1254,-1254,-1254,-1254,-1254,-1254,-1254,-1254\n    },\n\n    {\n       69,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,\n    -1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,\n    -1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,\n    -1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,\n    -1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,\n\n    -1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,\n    -1255, 1284,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,\n    -1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,\n    -1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,\n    -1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,\n    -1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,\n    -1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255,\n    -1255,-1255,-1255,-1255,-1255,-1255,-1255,-1255\n    },\n\n    {\n       69,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,\n    -1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,\n\n    -1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,\n    -1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,\n    -1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,\n    -1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,\n    -1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,\n    -1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,\n    -1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,\n    -1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,\n    -1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,\n    -1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256,\n\n    -1256,-1256,-1256,-1256,-1256,-1256,-1256,-1256\n    },\n\n    {\n       69,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,\n    -1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,\n    -1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,\n    -1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,\n    -1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,\n    -1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,\n    -1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,\n    -1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,\n    -1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,\n\n    -1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,\n    -1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,\n    -1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257,\n    -1257,-1257,-1257,-1257,-1257,-1257,-1257,-1257\n    },\n\n    {\n       69,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,\n    -1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,\n    -1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,\n    -1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,\n    -1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,\n    -1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,\n\n    -1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,\n    -1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,\n    -1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,\n    -1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,\n    -1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,\n    -1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258,\n    -1258,-1258,-1258,-1258,-1258,-1258,-1258,-1258\n    },\n\n    {\n       69,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,\n    -1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,\n    -1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,\n\n    -1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,\n    -1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,\n    -1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,\n    -1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,\n    -1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,\n    -1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,\n    -1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,\n    -1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,\n    -1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259,\n    -1259,-1259,-1259,-1259,-1259,-1259,-1259,-1259\n\n    },\n\n    {\n       69,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,\n    -1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,\n    -1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,\n    -1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,\n    -1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,\n    -1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,\n    -1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,\n    -1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,\n    -1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,\n    -1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,\n\n    -1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,\n    -1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260,\n    -1260,-1260,-1260,-1260,-1260,-1260,-1260,-1260\n    },\n\n    {\n       69,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,\n    -1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,\n    -1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,\n    -1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,\n    -1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,\n    -1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,\n    -1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,\n\n    -1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,\n    -1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,\n    -1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,\n    -1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,\n    -1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261,\n    -1261,-1261,-1261,-1261,-1261,-1261,-1261,-1261\n    },\n\n    {\n       69,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,\n    -1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,\n    -1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,\n    -1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,\n\n    -1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,\n    -1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,\n    -1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,\n    -1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,\n    -1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,\n    -1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,\n    -1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,\n    -1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262,\n    -1262,-1262,-1262,-1262,-1262,-1262,-1262,-1262\n    },\n\n    {\n       69,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,\n\n    -1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,\n    -1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,\n    -1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,\n    -1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,\n    -1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,\n    -1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,\n    -1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,\n    -1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,\n    -1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,\n    -1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,\n\n    -1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263,\n    -1263,-1263,-1263,-1263,-1263,-1263,-1263,-1263\n    },\n\n    {\n       69,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,\n    -1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,\n    -1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,\n    -1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,\n    -1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,\n    -1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,\n    -1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,\n    -1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,\n\n    -1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,\n    -1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,\n    -1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,\n    -1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264,\n    -1264,-1264,-1264,-1264,-1264,-1264,-1264,-1264\n    },\n\n    {\n       69,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,\n    -1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,\n    -1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,\n    -1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,\n    -1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,\n\n    -1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,\n    -1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,\n    -1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,\n    -1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,\n    -1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,\n    -1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,\n    -1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265,\n    -1265,-1265,-1265,-1265,-1265,-1265,-1265,-1265\n    },\n\n    {\n       69,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,\n    -1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,\n\n    -1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,\n    -1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,\n    -1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,\n    -1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,\n    -1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,\n    -1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,\n    -1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,\n    -1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,\n    -1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,\n    -1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266,\n\n    -1266,-1266,-1266,-1266,-1266,-1266,-1266,-1266\n    },\n\n    {\n       69,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,\n    -1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,\n    -1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,\n    -1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,\n    -1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,\n    -1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,\n    -1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,\n    -1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,\n    -1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,\n\n    -1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,\n    -1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,\n    -1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267,\n    -1267,-1267,-1267,-1267,-1267,-1267,-1267,-1267\n    },\n\n    {\n       69,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,\n    -1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,\n    -1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,\n    -1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,\n    -1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,\n    -1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,\n\n    -1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,\n    -1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,\n    -1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,\n    -1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,\n    -1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,\n    -1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268,\n    -1268,-1268,-1268,-1268,-1268,-1268,-1268,-1268\n    },\n\n    {\n       69,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,\n    -1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,\n    -1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,\n\n    -1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,\n    -1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,\n    -1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,\n    -1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,\n    -1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,\n    -1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,\n    -1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,\n    -1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,\n    -1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269,\n    -1269,-1269,-1269,-1269,-1269,-1269,-1269,-1269\n\n    },\n\n    {\n       69,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,\n    -1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,\n    -1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,\n    -1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,\n    -1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,\n    -1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,\n    -1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,\n    -1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,\n    -1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,\n    -1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,\n\n    -1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,\n    -1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270,\n    -1270,-1270,-1270,-1270,-1270,-1270,-1270,-1270\n    },\n\n    {\n       69,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,\n    -1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,\n    -1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,\n    -1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,\n    -1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,\n    -1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,\n    -1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,\n\n    -1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,\n    -1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,\n    -1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,\n    -1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,\n    -1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271,\n    -1271,-1271,-1271,-1271,-1271,-1271,-1271,-1271\n    },\n\n    {\n       69,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,\n    -1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,\n    -1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,\n    -1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,\n\n    -1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,\n    -1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,\n    -1272, 1285,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,\n    -1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,\n    -1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,\n    -1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,\n    -1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,\n    -1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272,\n    -1272,-1272,-1272,-1272,-1272,-1272,-1272,-1272\n    },\n\n    {\n       69,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,\n\n    -1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,\n    -1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,\n    -1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,\n    -1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,\n    -1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,\n    -1273, 1286,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,\n    -1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,\n    -1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,\n    -1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,\n    -1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,\n\n    -1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273,\n    -1273,-1273,-1273,-1273,-1273,-1273,-1273,-1273\n    },\n\n    {\n       69,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,\n    -1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,\n    -1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,\n    -1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,\n    -1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,\n    -1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,\n    -1274, 1287,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,\n    -1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,\n\n    -1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,\n    -1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,\n    -1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,\n    -1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274,\n    -1274,-1274,-1274,-1274,-1274,-1274,-1274,-1274\n    },\n\n    {\n       69,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,\n    -1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,\n    -1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,\n    -1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,\n    -1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,\n\n    -1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,\n    -1275, 1288,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,\n    -1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,\n    -1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,\n    -1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,\n    -1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,\n    -1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275,\n    -1275,-1275,-1275,-1275,-1275,-1275,-1275,-1275\n    },\n\n    {\n       69,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,\n    -1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,\n\n    -1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,\n    -1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,\n    -1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,\n    -1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,\n    -1276, 1289,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,\n    -1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,\n    -1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,\n    -1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,\n    -1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,\n    -1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276,\n\n    -1276,-1276,-1276,-1276,-1276,-1276,-1276,-1276\n    },\n\n    {\n       69,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,\n    -1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,\n    -1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,\n    -1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,\n    -1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,\n    -1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,\n    -1277, 1290,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,\n    -1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,\n    -1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,\n\n    -1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,\n    -1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,\n    -1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277,\n    -1277,-1277,-1277,-1277,-1277,-1277,-1277,-1277\n    },\n\n    {\n       69,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,\n    -1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,\n    -1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,\n    -1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,\n    -1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,\n    -1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,\n\n    -1278, 1291,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,\n    -1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,\n    -1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,\n    -1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,\n    -1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,\n    -1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278,\n    -1278,-1278,-1278,-1278,-1278,-1278,-1278,-1278\n    },\n\n    {\n       69,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,\n    -1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,\n    -1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,\n\n    -1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,\n    -1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,\n    -1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,\n    -1279, 1292,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,\n    -1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,\n    -1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,\n    -1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,\n    -1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,\n    -1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279,\n    -1279,-1279,-1279,-1279,-1279,-1279,-1279,-1279\n\n    },\n\n    {\n       69,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,\n    -1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,\n    -1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,\n    -1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,\n    -1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,\n    -1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,\n    -1280, 1293,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,\n    -1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,\n    -1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,\n    -1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,\n\n    -1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,\n    -1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280,\n    -1280,-1280,-1280,-1280,-1280,-1280,-1280,-1280\n    },\n\n    {\n       69,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,\n    -1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,\n    -1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,\n    -1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,\n    -1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,\n    -1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,\n    -1281, 1294,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,\n\n    -1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,\n    -1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,\n    -1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,\n    -1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,\n    -1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281,\n    -1281,-1281,-1281,-1281,-1281,-1281,-1281,-1281\n    },\n\n    {\n       69,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,\n    -1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,\n    -1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,\n    -1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,\n\n    -1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,\n    -1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,\n    -1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,\n    -1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,\n    -1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,\n    -1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,\n    -1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,\n    -1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282,\n    -1282,-1282,-1282,-1282,-1282,-1282,-1282,-1282\n    },\n\n    {\n       69,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,\n\n    -1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,\n    -1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,\n    -1283,-1283, 1295,-1283,-1283,-1283,-1283,-1283,-1283,-1283,\n    -1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,\n    -1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,\n    -1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,\n    -1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,\n    -1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,\n    -1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,\n    -1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,\n\n    -1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283,\n    -1283,-1283,-1283,-1283,-1283,-1283,-1283,-1283\n    },\n\n    {\n       69,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,\n    -1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,\n    -1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,\n    -1284,-1284, 1296,-1284,-1284,-1284,-1284,-1284,-1284,-1284,\n    -1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,\n    -1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,\n    -1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,\n    -1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,\n\n    -1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,\n    -1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,\n    -1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,\n    -1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284,\n    -1284,-1284,-1284,-1284,-1284,-1284,-1284,-1284\n    },\n\n    {\n       69,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,\n    -1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,\n    -1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,\n    -1285,-1285, 1297,-1285,-1285,-1285,-1285,-1285,-1285,-1285,\n    -1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,\n\n    -1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,\n    -1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,\n    -1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,\n    -1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,\n    -1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,\n    -1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,\n    -1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285,\n    -1285,-1285,-1285,-1285,-1285,-1285,-1285,-1285\n    },\n\n    {\n       69,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,\n    -1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,\n\n    -1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,\n    -1286,-1286, 1298,-1286,-1286,-1286,-1286,-1286,-1286,-1286,\n    -1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,\n    -1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,\n    -1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,\n    -1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,\n    -1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,\n    -1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,\n    -1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,\n    -1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286,\n\n    -1286,-1286,-1286,-1286,-1286,-1286,-1286,-1286\n    },\n\n    {\n       69,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,\n    -1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,\n    -1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,\n    -1287,-1287, 1299,-1287,-1287,-1287,-1287,-1287,-1287,-1287,\n    -1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,\n    -1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,\n    -1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,\n    -1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,\n    -1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,\n\n    -1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,\n    -1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,\n    -1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287,\n    -1287,-1287,-1287,-1287,-1287,-1287,-1287,-1287\n    },\n\n    {\n       69,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,\n    -1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,\n    -1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,\n    -1288,-1288, 1300,-1288,-1288,-1288,-1288,-1288,-1288,-1288,\n    -1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,\n    -1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,\n\n    -1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,\n    -1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,\n    -1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,\n    -1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,\n    -1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,\n    -1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288,\n    -1288,-1288,-1288,-1288,-1288,-1288,-1288,-1288\n    },\n\n    {\n       69,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,\n    -1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,\n    -1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,\n\n    -1289,-1289, 1301,-1289,-1289,-1289,-1289,-1289,-1289,-1289,\n    -1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,\n    -1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,\n    -1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,\n    -1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,\n    -1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,\n    -1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,\n    -1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,\n    -1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289,\n    -1289,-1289,-1289,-1289,-1289,-1289,-1289,-1289\n\n    },\n\n    {\n       69,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,\n    -1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,\n    -1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,\n    -1290,-1290, 1302,-1290,-1290,-1290,-1290,-1290,-1290,-1290,\n    -1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,\n    -1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,\n    -1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,\n    -1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,\n    -1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,\n    -1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,\n\n    -1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,\n    -1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290,\n    -1290,-1290,-1290,-1290,-1290,-1290,-1290,-1290\n    },\n\n    {\n       69,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,\n    -1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,\n    -1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,\n    -1291,-1291, 1303,-1291,-1291,-1291,-1291,-1291,-1291,-1291,\n    -1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,\n    -1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,\n    -1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,\n\n    -1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,\n    -1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,\n    -1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,\n    -1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,\n    -1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291,\n    -1291,-1291,-1291,-1291,-1291,-1291,-1291,-1291\n    },\n\n    {\n       69,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,\n    -1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,\n    -1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,\n    -1292,-1292, 1304,-1292,-1292,-1292,-1292,-1292,-1292,-1292,\n\n    -1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,\n    -1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,\n    -1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,\n    -1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,\n    -1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,\n    -1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,\n    -1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,\n    -1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292,\n    -1292,-1292,-1292,-1292,-1292,-1292,-1292,-1292\n    },\n\n    {\n       69,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,\n\n    -1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,\n    -1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,\n    -1293,-1293, 1305,-1293,-1293,-1293,-1293,-1293,-1293,-1293,\n    -1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,\n    -1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,\n    -1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,\n    -1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,\n    -1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,\n    -1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,\n    -1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,\n\n    -1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293,\n    -1293,-1293,-1293,-1293,-1293,-1293,-1293,-1293\n    },\n\n    {\n       69,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,\n    -1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,\n    -1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,\n    -1294,-1294, 1306,-1294,-1294,-1294,-1294,-1294,-1294,-1294,\n    -1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,\n    -1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,\n    -1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,\n    -1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,\n\n    -1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,\n    -1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,\n    -1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,\n    -1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294,\n    -1294,-1294,-1294,-1294,-1294,-1294,-1294,-1294\n    },\n\n    {\n       69,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,\n    -1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,\n    -1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,\n    -1295,-1295, 1307,-1295,-1295,-1295,-1295,-1295,-1295,-1295,\n    -1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,\n\n    -1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,\n    -1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,\n    -1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,\n    -1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,\n    -1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,\n    -1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,\n    -1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295,\n    -1295,-1295,-1295,-1295,-1295,-1295,-1295,-1295\n    },\n\n    {\n       69,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,\n    -1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,\n\n    -1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,\n    -1296,-1296, 1308,-1296,-1296,-1296,-1296,-1296,-1296,-1296,\n    -1296,-1296,-1296, 1309,-1296, 1309,-1296,-1296, 1310, 1310,\n     1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310,-1296,-1296,\n    -1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,\n    -1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,\n    -1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,\n    -1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,\n    -1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,\n    -1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296,\n\n    -1296,-1296,-1296,-1296,-1296,-1296,-1296,-1296\n    },\n\n    {\n       69,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,\n    -1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,\n    -1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,\n    -1297,-1297, 1311,-1297,-1297,-1297,-1297,-1297,-1297,-1297,\n    -1297,-1297,-1297, 1312,-1297, 1312,-1297,-1297, 1313, 1313,\n     1313, 1313, 1313, 1313, 1313, 1313, 1313, 1313,-1297,-1297,\n    -1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,\n    -1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,\n    -1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,\n\n    -1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,\n    -1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,\n    -1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297,\n    -1297,-1297,-1297,-1297,-1297,-1297,-1297,-1297\n    },\n\n    {\n       69,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,\n    -1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,\n    -1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,\n    -1298,-1298, 1314,-1298,-1298,-1298,-1298,-1298,-1298,-1298,\n    -1298,-1298,-1298, 1315,-1298, 1315,-1298,-1298, 1316, 1316,\n     1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316,-1298,-1298,\n\n    -1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,\n    -1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,\n    -1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,\n    -1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,\n    -1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,\n    -1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298,\n    -1298,-1298,-1298,-1298,-1298,-1298,-1298,-1298\n    },\n\n    {\n       69,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,\n    -1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,\n    -1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,\n\n    -1299,-1299, 1317,-1299,-1299,-1299,-1299,-1299,-1299,-1299,\n    -1299,-1299,-1299, 1318,-1299, 1318,-1299,-1299, 1319, 1319,\n     1319, 1319, 1319, 1319, 1319, 1319, 1319, 1319,-1299,-1299,\n    -1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,\n    -1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,\n    -1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,\n    -1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,\n    -1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,\n    -1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299,\n    -1299,-1299,-1299,-1299,-1299,-1299,-1299,-1299\n\n    },\n\n    {\n       69,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,\n    -1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,\n    -1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,\n    -1300,-1300, 1320,-1300,-1300,-1300,-1300,-1300,-1300,-1300,\n    -1300,-1300,-1300, 1321,-1300, 1321,-1300,-1300, 1322, 1322,\n     1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,-1300,-1300,\n    -1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,\n    -1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,\n    -1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,\n    -1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,\n\n    -1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,\n    -1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300,\n    -1300,-1300,-1300,-1300,-1300,-1300,-1300,-1300\n    },\n\n    {\n       69,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,\n    -1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,\n    -1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,\n    -1301,-1301, 1323,-1301,-1301,-1301,-1301,-1301,-1301, 1324,\n    -1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,\n    -1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,\n    -1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,\n\n    -1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,\n    -1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,\n    -1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,\n    -1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,\n    -1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301,\n    -1301,-1301,-1301,-1301,-1301,-1301,-1301,-1301\n    },\n\n    {\n       69,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,\n    -1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,\n    -1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,\n    -1302,-1302, 1325,-1302,-1302,-1302,-1302,-1302,-1302, 1326,\n\n    -1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,\n    -1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,\n    -1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,\n    -1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,\n    -1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,\n    -1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,\n    -1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,\n    -1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302,\n    -1302,-1302,-1302,-1302,-1302,-1302,-1302,-1302\n    },\n\n    {\n       69,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,\n\n    -1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,\n    -1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,\n    -1303,-1303, 1327,-1303,-1303,-1303,-1303,-1303,-1303, 1328,\n    -1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,\n    -1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,\n    -1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,\n    -1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,\n    -1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,\n    -1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,\n    -1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,\n\n    -1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303,\n    -1303,-1303,-1303,-1303,-1303,-1303,-1303,-1303\n    },\n\n    {\n       69,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,\n    -1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,\n    -1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,\n    -1304,-1304, 1329,-1304,-1304,-1304,-1304,-1304,-1304, 1330,\n    -1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,\n    -1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,\n    -1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,\n    -1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,\n\n    -1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,\n    -1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,\n    -1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,\n    -1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304,\n    -1304,-1304,-1304,-1304,-1304,-1304,-1304,-1304\n    },\n\n    {\n       69,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,\n    -1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,\n    -1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,\n    -1305,-1305, 1331,-1305,-1305,-1305,-1305,-1305,-1305, 1332,\n    -1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,\n\n    -1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,\n    -1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,\n    -1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,\n    -1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,\n    -1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,\n    -1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,\n    -1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305,\n    -1305,-1305,-1305,-1305,-1305,-1305,-1305,-1305\n    },\n\n    {\n       69,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,\n    -1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,\n\n    -1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,\n    -1306,-1306, 1333,-1306,-1306,-1306,-1306,-1306,-1306, 1334,\n    -1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,\n    -1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,\n    -1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,\n    -1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,\n    -1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,\n    -1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,\n    -1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,\n    -1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306,\n\n    -1306,-1306,-1306,-1306,-1306,-1306,-1306,-1306\n    },\n\n    {\n       69,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,\n    -1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,\n    -1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,\n    -1307,-1307, 1335,-1307,-1307,-1307,-1307,-1307,-1307,-1307,\n    -1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,\n    -1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,\n    -1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,\n    -1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,\n    -1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,\n\n    -1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,\n    -1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,\n    -1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307,\n    -1307,-1307,-1307,-1307,-1307,-1307,-1307,-1307\n    },\n\n    {\n       69,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,\n    -1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,\n    -1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,\n    -1308,-1308, 1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,\n    -1308,-1308,-1308, 1309,-1308, 1309,-1308,-1308, 1310, 1310,\n     1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310,-1308,-1308,\n\n    -1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,\n    -1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,\n    -1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,\n    -1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,\n    -1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,\n    -1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308,\n    -1308,-1308,-1308,-1308,-1308,-1308,-1308,-1308\n    },\n\n    {\n       69,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,\n    -1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,\n    -1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,\n\n    -1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,\n    -1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309, 1310, 1310,\n     1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310,-1309,-1309,\n    -1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,\n    -1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,\n    -1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,\n    -1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,\n    -1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,\n    -1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309,\n    -1309,-1309,-1309,-1309,-1309,-1309,-1309,-1309\n\n    },\n\n    {\n       69,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,\n    -1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,\n    -1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,\n    -1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,\n    -1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310, 1310, 1310,\n     1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310,-1310,-1310,\n    -1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,\n    -1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,\n    -1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,\n    -1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,\n\n    -1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,\n    -1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310,\n    -1310,-1310,-1310,-1310,-1310,-1310,-1310,-1310\n    },\n\n    {\n       69,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,\n    -1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,\n    -1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,\n    -1311,-1311, 1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,\n    -1311,-1311,-1311, 1312,-1311, 1312,-1311,-1311, 1313, 1313,\n     1313, 1313, 1313, 1313, 1313, 1313, 1313, 1313,-1311,-1311,\n    -1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,\n\n    -1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,\n    -1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,\n    -1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,\n    -1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,\n    -1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311,\n    -1311,-1311,-1311,-1311,-1311,-1311,-1311,-1311\n    },\n\n    {\n       69,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,\n    -1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,\n    -1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,\n    -1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,\n\n    -1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312, 1313, 1313,\n     1313, 1313, 1313, 1313, 1313, 1313, 1313, 1313,-1312,-1312,\n    -1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,\n    -1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,\n    -1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,\n    -1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,\n    -1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,\n    -1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312,\n    -1312,-1312,-1312,-1312,-1312,-1312,-1312,-1312\n    },\n\n    {\n       69,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,\n\n    -1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,\n    -1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,\n    -1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,\n    -1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313, 1313, 1313,\n     1313, 1313, 1313, 1313, 1313, 1313, 1313, 1313,-1313,-1313,\n    -1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,\n    -1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,\n    -1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,\n    -1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,\n    -1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,\n\n    -1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313,\n    -1313,-1313,-1313,-1313,-1313,-1313,-1313,-1313\n    },\n\n    {\n       69,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,\n    -1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,\n    -1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,\n    -1314,-1314, 1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,\n    -1314,-1314,-1314, 1315,-1314, 1315,-1314,-1314, 1316, 1316,\n     1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316,-1314,-1314,\n    -1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,\n    -1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,\n\n    -1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,\n    -1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,\n    -1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,\n    -1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314,\n    -1314,-1314,-1314,-1314,-1314,-1314,-1314,-1314\n    },\n\n    {\n       69,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,\n    -1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,\n    -1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,\n    -1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,\n    -1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315, 1316, 1316,\n\n     1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316,-1315,-1315,\n    -1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,\n    -1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,\n    -1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,\n    -1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,\n    -1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,\n    -1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315,\n    -1315,-1315,-1315,-1315,-1315,-1315,-1315,-1315\n    },\n\n    {\n       69,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,\n    -1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,\n\n    -1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,\n    -1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,\n    -1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316, 1316, 1316,\n     1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316,-1316,-1316,\n    -1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,\n    -1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,\n    -1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,\n    -1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,\n    -1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,\n    -1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316,\n\n    -1316,-1316,-1316,-1316,-1316,-1316,-1316,-1316\n    },\n\n    {\n       69,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,\n    -1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,\n    -1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,\n    -1317,-1317, 1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,\n    -1317,-1317,-1317, 1318,-1317, 1318,-1317,-1317, 1319, 1319,\n     1319, 1319, 1319, 1319, 1319, 1319, 1319, 1319,-1317,-1317,\n    -1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,\n    -1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,\n    -1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,\n\n    -1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,\n    -1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,\n    -1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317,\n    -1317,-1317,-1317,-1317,-1317,-1317,-1317,-1317\n    },\n\n    {\n       69,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,\n    -1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,\n    -1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,\n    -1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,\n    -1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318, 1319, 1319,\n     1319, 1319, 1319, 1319, 1319, 1319, 1319, 1319,-1318,-1318,\n\n    -1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,\n    -1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,\n    -1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,\n    -1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,\n    -1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,\n    -1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318,\n    -1318,-1318,-1318,-1318,-1318,-1318,-1318,-1318\n    },\n\n    {\n       69,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,\n    -1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,\n    -1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,\n\n    -1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,\n    -1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319, 1319, 1319,\n     1319, 1319, 1319, 1319, 1319, 1319, 1319, 1319,-1319,-1319,\n    -1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,\n    -1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,\n    -1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,\n    -1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,\n    -1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,\n    -1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319,\n    -1319,-1319,-1319,-1319,-1319,-1319,-1319,-1319\n\n    },\n\n    {\n       69,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,\n    -1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,\n    -1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,\n    -1320,-1320, 1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,\n    -1320,-1320,-1320, 1321,-1320, 1321,-1320,-1320, 1322, 1322,\n     1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,-1320,-1320,\n    -1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,\n    -1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,\n    -1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,\n    -1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,\n\n    -1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,\n    -1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320,\n    -1320,-1320,-1320,-1320,-1320,-1320,-1320,-1320\n    },\n\n    {\n       69,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,\n    -1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,\n    -1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,\n    -1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,\n    -1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321, 1322, 1322,\n     1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,-1321,-1321,\n    -1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,\n\n    -1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,\n    -1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,\n    -1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,\n    -1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,\n    -1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321,\n    -1321,-1321,-1321,-1321,-1321,-1321,-1321,-1321\n    },\n\n    {\n       69,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,\n    -1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,\n    -1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,\n    -1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,\n\n    -1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322, 1322, 1322,\n     1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,-1322,-1322,\n    -1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,\n    -1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,\n    -1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,\n    -1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,\n    -1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,\n    -1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322,\n    -1322,-1322,-1322,-1322,-1322,-1322,-1322,-1322\n    },\n\n    {\n       69,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,\n\n    -1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,\n    -1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,\n    -1323,-1323, 1323,-1323,-1323,-1323,-1323,-1323,-1323, 1324,\n    -1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,\n    -1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,\n    -1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,\n    -1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,\n    -1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,\n    -1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,\n    -1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,\n\n    -1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323,\n    -1323,-1323,-1323,-1323,-1323,-1323,-1323,-1323\n    },\n\n    {\n       69, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1337,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336\n    },\n\n    {\n       69,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,\n    -1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,\n    -1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,\n    -1325,-1325, 1325,-1325,-1325,-1325,-1325,-1325,-1325, 1326,\n    -1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,\n\n    -1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,\n    -1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,\n    -1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,\n    -1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,\n    -1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,\n    -1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,\n    -1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325,\n    -1325,-1325,-1325,-1325,-1325,-1325,-1325,-1325\n    },\n\n    {\n       69, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1339,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338\n    },\n\n    {\n       69,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,\n    -1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,\n    -1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,\n    -1327,-1327, 1327,-1327,-1327,-1327,-1327,-1327,-1327, 1328,\n    -1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,\n    -1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,\n    -1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,\n    -1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,\n    -1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,\n\n    -1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,\n    -1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,\n    -1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327,\n    -1327,-1327,-1327,-1327,-1327,-1327,-1327,-1327\n    },\n\n    {\n       69, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1341,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340\n    },\n\n    {\n       69,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,\n    -1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,\n    -1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,\n\n    -1329,-1329, 1329,-1329,-1329,-1329,-1329,-1329,-1329, 1330,\n    -1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,\n    -1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,\n    -1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,\n    -1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,\n    -1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,\n    -1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,\n    -1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,\n    -1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329,\n    -1329,-1329,-1329,-1329,-1329,-1329,-1329,-1329\n\n    },\n\n    {\n       69, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1343,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342\n    },\n\n    {\n       69,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,\n    -1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,\n    -1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,\n    -1331,-1331, 1331,-1331,-1331,-1331,-1331,-1331,-1331, 1332,\n    -1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,\n    -1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,\n    -1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,\n\n    -1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,\n    -1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,\n    -1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,\n    -1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,\n    -1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331,\n    -1331,-1331,-1331,-1331,-1331,-1331,-1331,-1331\n    },\n\n    {\n       69, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1345,\n\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344\n    },\n\n    {\n       69,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,\n\n    -1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,\n    -1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,\n    -1333,-1333, 1333,-1333,-1333,-1333,-1333,-1333,-1333, 1334,\n    -1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,\n    -1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,\n    -1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,\n    -1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,\n    -1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,\n    -1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,\n    -1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,\n\n    -1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333,\n    -1333,-1333,-1333,-1333,-1333,-1333,-1333,-1333\n    },\n\n    {\n       69, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1347,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346\n    },\n\n    {\n       69,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,\n    -1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,\n    -1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,\n    -1335,-1335, 1348,-1335,-1335,-1335,-1335,-1335,-1335,-1335,\n    -1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,\n\n    -1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,\n    -1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,\n    -1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,\n    -1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,\n    -1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,\n    -1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,\n    -1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335,\n    -1335,-1335,-1335,-1335,-1335,-1335,-1335,-1335\n    },\n\n    {\n       69, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1337,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n\n     1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336\n    },\n\n    {\n       69,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,\n    -1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,\n    -1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,\n    -1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337, 1336,\n    -1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,\n    -1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,\n    -1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,\n    -1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,\n    -1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,\n\n    -1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,\n    -1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,\n    -1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337,\n    -1337,-1337,-1337,-1337,-1337,-1337,-1337,-1337\n    },\n\n    {\n       69, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1339,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,\n     1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338\n    },\n\n    {\n       69,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,\n    -1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,\n    -1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,\n\n    -1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339, 1338,\n    -1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,\n    -1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,\n    -1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,\n    -1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,\n    -1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,\n    -1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,\n    -1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,\n    -1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339,\n    -1339,-1339,-1339,-1339,-1339,-1339,-1339,-1339\n\n    },\n\n    {\n       69, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1341,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340,\n     1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340\n    },\n\n    {\n       69,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,\n    -1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,\n    -1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,\n    -1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341, 1340,\n    -1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,\n    -1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,\n    -1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,\n\n    -1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,\n    -1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,\n    -1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,\n    -1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,\n    -1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341,\n    -1341,-1341,-1341,-1341,-1341,-1341,-1341,-1341\n    },\n\n    {\n       69, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1343,\n\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342,\n     1342, 1342, 1342, 1342, 1342, 1342, 1342, 1342\n    },\n\n    {\n       69,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,\n\n    -1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,\n    -1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,\n    -1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343, 1342,\n    -1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,\n    -1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,\n    -1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,\n    -1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,\n    -1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,\n    -1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,\n    -1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,\n\n    -1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343,\n    -1343,-1343,-1343,-1343,-1343,-1343,-1343,-1343\n    },\n\n    {\n       69, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1345,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,\n     1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344\n    },\n\n    {\n       69,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,\n    -1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,\n    -1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,\n    -1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345, 1344,\n    -1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,\n\n    -1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,\n    -1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,\n    -1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,\n    -1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,\n    -1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,\n    -1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,\n    -1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345,\n    -1345,-1345,-1345,-1345,-1345,-1345,-1345,-1345\n    },\n\n    {\n       69, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1347,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346,\n\n     1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346\n    },\n\n    {\n       69,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,\n    -1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,\n    -1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,\n    -1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347, 1346,\n    -1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,\n    -1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,\n    -1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,\n    -1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,\n    -1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,\n\n    -1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,\n    -1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,\n    -1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347,\n    -1347,-1347,-1347,-1347,-1347,-1347,-1347,-1347\n    },\n\n    {\n       69,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,\n    -1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,\n    -1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,\n    -1348,-1348, 1349,-1348,-1348,-1348,-1348,-1348,-1348,-1348,\n    -1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,\n    -1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,\n\n    -1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,\n    -1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,\n    -1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,\n    -1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,\n    -1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,\n    -1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348,\n    -1348,-1348,-1348,-1348,-1348,-1348,-1348,-1348\n    },\n\n    {\n       69,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,\n    -1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,\n    -1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,\n\n    -1349,-1349, 1350,-1349,-1349,-1349,-1349,-1349,-1349,-1349,\n    -1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,\n    -1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,\n    -1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,\n    -1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,\n    -1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,\n    -1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,\n    -1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,\n    -1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349,\n    -1349,-1349,-1349,-1349,-1349,-1349,-1349,-1349\n\n    },\n\n    {\n       69,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,\n    -1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,\n    -1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,\n    -1350,-1350, 1351,-1350,-1350,-1350,-1350,-1350,-1350,-1350,\n    -1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,\n    -1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,\n    -1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,\n    -1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,\n    -1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,\n    -1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,\n\n    -1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,\n    -1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350,\n    -1350,-1350,-1350,-1350,-1350,-1350,-1350,-1350\n    },\n\n    {\n       69,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,\n    -1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,\n    -1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,\n    -1351,-1351, 1352,-1351,-1351,-1351,-1351,-1351,-1351,-1351,\n    -1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,\n    -1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,\n    -1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,\n\n    -1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,\n    -1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,\n    -1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,\n    -1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,\n    -1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351,\n    -1351,-1351,-1351,-1351,-1351,-1351,-1351,-1351\n    },\n\n    {\n       69,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,\n    -1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,\n    -1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,\n    -1352,-1352, 1353,-1352,-1352,-1352,-1352,-1352,-1352,-1352,\n\n    -1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,\n    -1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,\n    -1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,\n    -1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,\n    -1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,\n    -1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,\n    -1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,\n    -1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352,\n    -1352,-1352,-1352,-1352,-1352,-1352,-1352,-1352\n    },\n\n    {\n       69,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,\n\n    -1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,\n    -1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,\n    -1353,-1353, 1354,-1353,-1353,-1353,-1353,-1353,-1353,-1353,\n    -1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,\n    -1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,\n    -1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,\n    -1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,\n    -1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,\n    -1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,\n    -1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,\n\n    -1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353,\n    -1353,-1353,-1353,-1353,-1353,-1353,-1353,-1353\n    },\n\n    {\n       69,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,\n    -1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,\n    -1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,\n    -1354,-1354, 1355,-1354,-1354,-1354,-1354,-1354,-1354,-1354,\n    -1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,\n    -1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,\n    -1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,\n    -1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,\n\n    -1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,\n    -1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,\n    -1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,\n    -1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354,\n    -1354,-1354,-1354,-1354,-1354,-1354,-1354,-1354\n    },\n\n    {\n       69,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,\n    -1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,\n    -1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,\n    -1355,-1355, 1356,-1355,-1355,-1355,-1355,-1355,-1355,-1355,\n    -1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,\n\n    -1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,\n    -1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,\n    -1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,\n    -1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,\n    -1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,\n    -1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,\n    -1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355,\n    -1355,-1355,-1355,-1355,-1355,-1355,-1355,-1355\n    },\n\n    {\n       69,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,\n    -1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,\n\n    -1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,\n    -1356,-1356, 1357,-1356,-1356,-1356,-1356,-1356,-1356,-1356,\n    -1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,\n    -1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,\n    -1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,\n    -1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,\n    -1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,\n    -1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,\n    -1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,\n    -1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356,\n\n    -1356,-1356,-1356,-1356,-1356,-1356,-1356,-1356\n    },\n\n    {\n       69,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,\n    -1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,\n    -1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,\n    -1357,-1357, 1358,-1357,-1357,-1357,-1357,-1357,-1357,-1357,\n    -1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,\n    -1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,\n    -1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,\n    -1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,\n    -1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,\n\n    -1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,\n    -1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,\n    -1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357,\n    -1357,-1357,-1357,-1357,-1357,-1357,-1357,-1357\n    },\n\n    {\n       69,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,\n    -1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,\n    -1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,\n    -1358,-1358, 1359,-1358,-1358,-1358,-1358,-1358,-1358,-1358,\n    -1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,\n    -1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,\n\n    -1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,\n    -1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,\n    -1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,\n    -1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,\n    -1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,\n    -1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358,\n    -1358,-1358,-1358,-1358,-1358,-1358,-1358,-1358\n    },\n\n    {\n       69,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,\n    -1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,\n    -1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,\n\n    -1359,-1359, 1360,-1359,-1359,-1359,-1359,-1359,-1359,-1359,\n    -1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,\n    -1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,\n    -1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,\n    -1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,\n    -1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,\n    -1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,\n    -1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,\n    -1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359,\n    -1359,-1359,-1359,-1359,-1359,-1359,-1359,-1359\n\n    },\n\n    {\n       69,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,\n    -1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,\n    -1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,\n    -1360,-1360, 1361,-1360,-1360,-1360,-1360,-1360,-1360,-1360,\n    -1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,\n    -1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,\n    -1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,\n    -1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,\n    -1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,\n    -1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,\n\n    -1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,\n    -1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360,\n    -1360,-1360,-1360,-1360,-1360,-1360,-1360,-1360\n    },\n\n    {\n       69,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,\n    -1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,\n    -1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,\n    -1361,-1361, 1362,-1361,-1361,-1361,-1361,-1361,-1361,-1361,\n    -1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,\n    -1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,\n    -1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,\n\n    -1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,\n    -1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,\n    -1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,\n    -1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,\n    -1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361,\n    -1361,-1361,-1361,-1361,-1361,-1361,-1361,-1361\n    },\n\n    {\n       69,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,\n    -1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,\n    -1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,\n    -1362,-1362, 1363,-1362,-1362,-1362,-1362,-1362,-1362,-1362,\n\n    -1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,\n    -1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,\n    -1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,\n    -1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,\n    -1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,\n    -1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,\n    -1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,\n    -1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362,\n    -1362,-1362,-1362,-1362,-1362,-1362,-1362,-1362\n    },\n\n    {\n       69,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,\n\n    -1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,\n    -1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,\n    -1363,-1363, 1364,-1363,-1363,-1363,-1363,-1363,-1363,-1363,\n    -1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,\n    -1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,\n    -1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,\n    -1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,\n    -1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,\n    -1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,\n    -1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,\n\n    -1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363,\n    -1363,-1363,-1363,-1363,-1363,-1363,-1363,-1363\n    },\n\n    {\n       69,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,\n    -1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,\n    -1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,\n    -1364,-1364, 1365,-1364,-1364,-1364,-1364,-1364,-1364,-1364,\n    -1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,\n    -1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,\n    -1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,\n    -1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,\n\n    -1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,\n    -1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,\n    -1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,\n    -1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364,\n    -1364,-1364,-1364,-1364,-1364,-1364,-1364,-1364\n    },\n\n    {\n       69,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,\n    -1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,\n    -1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,\n    -1365,-1365, 1366,-1365,-1365,-1365,-1365,-1365,-1365,-1365,\n    -1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,\n\n    -1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,\n    -1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,\n    -1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,\n    -1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,\n    -1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,\n    -1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,\n    -1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365,\n    -1365,-1365,-1365,-1365,-1365,-1365,-1365,-1365\n    },\n\n    {\n       69,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,\n    -1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,\n\n    -1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,\n    -1366,-1366, 1367,-1366,-1366,-1366,-1366,-1366,-1366,-1366,\n    -1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,\n    -1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,\n    -1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,\n    -1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,\n    -1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,\n    -1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,\n    -1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,\n    -1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366,\n\n    -1366,-1366,-1366,-1366,-1366,-1366,-1366,-1366\n    },\n\n    {\n       69,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,\n    -1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,\n    -1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,\n    -1367,-1367, 1368,-1367,-1367,-1367,-1367,-1367,-1367,-1367,\n    -1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,\n    -1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,\n    -1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,\n    -1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,\n    -1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,\n\n    -1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,\n    -1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,\n    -1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367,\n    -1367,-1367,-1367,-1367,-1367,-1367,-1367,-1367\n    },\n\n    {\n       69,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,\n    -1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,\n    -1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,\n    -1368,-1368, 1369,-1368,-1368,-1368,-1368,-1368,-1368,-1368,\n    -1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,\n    -1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,\n\n    -1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,\n    -1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,\n    -1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,\n    -1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,\n    -1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,\n    -1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368,\n    -1368,-1368,-1368,-1368,-1368,-1368,-1368,-1368\n    },\n\n    {\n       69,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,\n    -1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,\n    -1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,\n\n    -1369,-1369, 1370,-1369,-1369,-1369,-1369,-1369,-1369,-1369,\n    -1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,\n    -1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,\n    -1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,\n    -1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,\n    -1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,\n    -1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,\n    -1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,\n    -1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369,\n    -1369,-1369,-1369,-1369,-1369,-1369,-1369,-1369\n\n    },\n\n    {\n       69,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,\n    -1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,\n    -1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,\n    -1370,-1370, 1371,-1370,-1370,-1370,-1370,-1370,-1370,-1370,\n    -1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,\n    -1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,\n    -1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,\n    -1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,\n    -1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,\n    -1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,\n\n    -1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,\n    -1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370,\n    -1370,-1370,-1370,-1370,-1370,-1370,-1370,-1370\n    },\n\n    {\n       69,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,\n    -1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,\n    -1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,\n    -1371,-1371, 1372,-1371,-1371,-1371,-1371,-1371,-1371,-1371,\n    -1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,\n    -1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,\n    -1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,\n\n    -1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,\n    -1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,\n    -1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,\n    -1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,\n    -1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371,\n    -1371,-1371,-1371,-1371,-1371,-1371,-1371,-1371\n    },\n\n    {\n       69,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,\n    -1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,\n    -1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,\n    -1372,-1372, 1373,-1372,-1372,-1372,-1372,-1372,-1372,-1372,\n\n    -1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,\n    -1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,\n    -1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,\n    -1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,\n    -1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,\n    -1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,\n    -1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,\n    -1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372,\n    -1372,-1372,-1372,-1372,-1372,-1372,-1372,-1372\n    },\n\n    {\n       69,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,\n\n    -1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,\n    -1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,\n    -1373,-1373, 1374,-1373,-1373,-1373,-1373,-1373,-1373,-1373,\n    -1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,\n    -1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,\n    -1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,\n    -1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,\n    -1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,\n    -1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,\n    -1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,\n\n    -1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373,\n    -1373,-1373,-1373,-1373,-1373,-1373,-1373,-1373\n    },\n\n    {\n       69,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,\n    -1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,\n    -1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,\n    -1374,-1374, 1375,-1374,-1374,-1374,-1374,-1374,-1374,-1374,\n    -1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,\n    -1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,\n    -1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,\n    -1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,\n\n    -1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,\n    -1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,\n    -1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,\n    -1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374,\n    -1374,-1374,-1374,-1374,-1374,-1374,-1374,-1374\n    },\n\n    {\n       69,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,\n    -1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,\n    -1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,\n    -1375,-1375, 1376,-1375,-1375,-1375,-1375,-1375,-1375,-1375,\n    -1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,\n\n    -1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,\n    -1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,\n    -1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,\n    -1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,\n    -1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,\n    -1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,\n    -1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375,\n    -1375,-1375,-1375,-1375,-1375,-1375,-1375,-1375\n    },\n\n    {\n       69,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,\n    -1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,\n\n    -1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,\n    -1376,-1376, 1377,-1376,-1376,-1376,-1376,-1376,-1376,-1376,\n    -1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,\n    -1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,\n    -1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,\n    -1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,\n    -1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,\n    -1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,\n    -1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,\n    -1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376,\n\n    -1376,-1376,-1376,-1376,-1376,-1376,-1376,-1376\n    },\n\n    {\n       69,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,\n    -1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,\n    -1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,\n    -1377,-1377, 1378,-1377,-1377,-1377,-1377,-1377,-1377,-1377,\n    -1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,\n    -1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,\n    -1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,\n    -1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,\n    -1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,\n\n    -1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,\n    -1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,\n    -1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377,\n    -1377,-1377,-1377,-1377,-1377,-1377,-1377,-1377\n    },\n\n    {\n       69,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,\n    -1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,\n    -1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,\n    -1378,-1378, 1379,-1378,-1378,-1378,-1378,-1378,-1378,-1378,\n    -1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,\n    -1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,\n\n    -1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,\n    -1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,\n    -1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,\n    -1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,\n    -1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,\n    -1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378,\n    -1378,-1378,-1378,-1378,-1378,-1378,-1378,-1378\n    },\n\n    {\n       69,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,\n    -1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,\n    -1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,\n\n    -1379,-1379, 1380,-1379,-1379,-1379,-1379,-1379,-1379,-1379,\n    -1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,\n    -1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,\n    -1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,\n    -1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,\n    -1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,\n    -1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,\n    -1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,\n    -1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379,\n    -1379,-1379,-1379,-1379,-1379,-1379,-1379,-1379\n\n    },\n\n    {\n       69,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,\n    -1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,\n    -1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,\n    -1380,-1380, 1381,-1380,-1380,-1380,-1380,-1380,-1380,-1380,\n    -1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,\n    -1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,\n    -1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,\n    -1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,\n    -1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,\n    -1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,\n\n    -1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,\n    -1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380,\n    -1380,-1380,-1380,-1380,-1380,-1380,-1380,-1380\n    },\n\n    {\n       69,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,\n    -1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,\n    -1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,\n    -1381,-1381, 1382,-1381,-1381,-1381,-1381,-1381,-1381,-1381,\n    -1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,\n    -1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,\n    -1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,\n\n    -1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,\n    -1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,\n    -1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,\n    -1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,\n    -1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381,\n    -1381,-1381,-1381,-1381,-1381,-1381,-1381,-1381\n    },\n\n    {\n       69,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,\n    -1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,\n    -1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,\n    -1382,-1382, 1383,-1382,-1382,-1382,-1382,-1382,-1382,-1382,\n\n    -1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,\n    -1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,\n    -1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,\n    -1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,\n    -1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,\n    -1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,\n    -1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,\n    -1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382,\n    -1382,-1382,-1382,-1382,-1382,-1382,-1382,-1382\n    },\n\n    {\n       69,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,\n\n    -1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,\n    -1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,\n    -1383,-1383, 1384,-1383,-1383,-1383,-1383,-1383,-1383,-1383,\n    -1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,\n    -1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,\n    -1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,\n    -1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,\n    -1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,\n    -1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,\n    -1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,\n\n    -1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383,\n    -1383,-1383,-1383,-1383,-1383,-1383,-1383,-1383\n    },\n\n    {\n       69,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,\n    -1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,\n    -1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,\n    -1384,-1384, 1385,-1384,-1384,-1384,-1384,-1384,-1384,-1384,\n    -1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,\n    -1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,\n    -1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,\n    -1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,\n\n    -1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,\n    -1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,\n    -1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,\n    -1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384,\n    -1384,-1384,-1384,-1384,-1384,-1384,-1384,-1384\n    },\n\n    {\n       69,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,\n    -1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,\n    -1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,\n    -1385,-1385, 1386,-1385,-1385,-1385,-1385,-1385,-1385,-1385,\n    -1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,\n\n    -1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,\n    -1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,\n    -1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,\n    -1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,\n    -1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,\n    -1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,\n    -1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385,\n    -1385,-1385,-1385,-1385,-1385,-1385,-1385,-1385\n    },\n\n    {\n       69,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,\n    -1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,\n\n    -1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,\n    -1386,-1386, 1387,-1386,-1386,-1386,-1386,-1386,-1386,-1386,\n    -1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,\n    -1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,\n    -1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,\n    -1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,\n    -1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,\n    -1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,\n    -1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,\n    -1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386,\n\n    -1386,-1386,-1386,-1386,-1386,-1386,-1386,-1386\n    },\n\n    {\n       69,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,\n    -1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,\n    -1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,\n    -1387,-1387, 1388,-1387,-1387,-1387,-1387,-1387,-1387,-1387,\n    -1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,\n    -1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,\n    -1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,\n    -1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,\n    -1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,\n\n    -1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,\n    -1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,\n    -1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387,\n    -1387,-1387,-1387,-1387,-1387,-1387,-1387,-1387\n    },\n\n    {\n       69,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,\n    -1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,\n    -1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,\n    -1388,-1388, 1389,-1388,-1388,-1388,-1388,-1388,-1388,-1388,\n    -1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,\n    -1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,\n\n    -1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,\n    -1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,\n    -1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,\n    -1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,\n    -1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,\n    -1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388,\n    -1388,-1388,-1388,-1388,-1388,-1388,-1388,-1388\n    },\n\n    {\n       69,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,\n    -1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,\n    -1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,\n\n    -1389,-1389, 1390,-1389,-1389,-1389,-1389,-1389,-1389,-1389,\n    -1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,\n    -1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,\n    -1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,\n    -1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,\n    -1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,\n    -1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,\n    -1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,\n    -1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389,\n    -1389,-1389,-1389,-1389,-1389,-1389,-1389,-1389\n\n    },\n\n    {\n       69,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,\n    -1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,\n    -1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,\n    -1390,-1390, 1391,-1390,-1390,-1390,-1390,-1390,-1390,-1390,\n    -1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,\n    -1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,\n    -1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,\n    -1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,\n    -1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,\n    -1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,\n\n    -1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,\n    -1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390,\n    -1390,-1390,-1390,-1390,-1390,-1390,-1390,-1390\n    },\n\n    {\n       69,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,\n    -1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,\n    -1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,\n    -1391,-1391, 1392,-1391,-1391,-1391,-1391,-1391,-1391,-1391,\n    -1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,\n    -1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,\n    -1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,\n\n    -1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,\n    -1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,\n    -1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,\n    -1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,\n    -1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391,\n    -1391,-1391,-1391,-1391,-1391,-1391,-1391,-1391\n    },\n\n    {\n       69,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,\n    -1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,\n    -1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,\n    -1392,-1392, 1393,-1392,-1392,-1392,-1392,-1392,-1392,-1392,\n\n    -1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,\n    -1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,\n    -1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,\n    -1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,\n    -1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,\n    -1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,\n    -1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,\n    -1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392,\n    -1392,-1392,-1392,-1392,-1392,-1392,-1392,-1392\n    },\n\n    {\n       69,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,\n\n    -1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,\n    -1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,\n    -1393,-1393, 1394,-1393,-1393,-1393,-1393,-1393,-1393,-1393,\n    -1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,\n    -1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,\n    -1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,\n    -1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,\n    -1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,\n    -1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,\n    -1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,\n\n    -1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393,\n    -1393,-1393,-1393,-1393,-1393,-1393,-1393,-1393\n    },\n\n    {\n       69,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,\n    -1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,\n    -1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,\n    -1394,-1394, 1395,-1394,-1394,-1394,-1394,-1394,-1394,-1394,\n    -1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,\n    -1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,\n    -1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,\n    -1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,\n\n    -1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,\n    -1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,\n    -1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,\n    -1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394,\n    -1394,-1394,-1394,-1394,-1394,-1394,-1394,-1394\n    },\n\n    {\n       69,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,\n    -1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,\n    -1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,\n    -1395,-1395, 1396,-1395,-1395,-1395,-1395,-1395,-1395,-1395,\n    -1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,\n\n    -1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,\n    -1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,\n    -1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,\n    -1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,\n    -1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,\n    -1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,\n    -1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395,\n    -1395,-1395,-1395,-1395,-1395,-1395,-1395,-1395\n    },\n\n    {\n       69,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,\n    -1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,\n\n    -1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,\n    -1396,-1396, 1397,-1396,-1396,-1396,-1396,-1396,-1396,-1396,\n    -1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,\n    -1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,\n    -1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,\n    -1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,\n    -1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,\n    -1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,\n    -1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,\n    -1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396,\n\n    -1396,-1396,-1396,-1396,-1396,-1396,-1396,-1396\n    },\n\n    {\n       69,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,\n    -1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,\n    -1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,\n    -1397,-1397, 1398,-1397,-1397,-1397,-1397,-1397,-1397,-1397,\n    -1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,\n    -1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,\n    -1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,\n    -1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,\n    -1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,\n\n    -1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,\n    -1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,\n    -1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397,\n    -1397,-1397,-1397,-1397,-1397,-1397,-1397,-1397\n    },\n\n    {\n       69,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,\n    -1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,\n    -1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,\n    -1398,-1398, 1399,-1398,-1398,-1398,-1398,-1398,-1398,-1398,\n    -1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,\n    -1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,\n\n    -1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,\n    -1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,\n    -1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,\n    -1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,\n    -1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,\n    -1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398,\n    -1398,-1398,-1398,-1398,-1398,-1398,-1398,-1398\n    },\n\n    {\n       69,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,\n    -1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,\n    -1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,\n\n    -1399,-1399, 1400,-1399,-1399,-1399,-1399,-1399,-1399,-1399,\n    -1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,\n    -1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,\n    -1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,\n    -1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,\n    -1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,\n    -1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,\n    -1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,\n    -1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399,\n    -1399,-1399,-1399,-1399,-1399,-1399,-1399,-1399\n\n    },\n\n    {\n       69,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,\n    -1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,\n    -1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,\n    -1400,-1400, 1401,-1400,-1400,-1400,-1400,-1400,-1400,-1400,\n    -1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,\n    -1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,\n    -1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,\n    -1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,\n    -1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,\n    -1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,\n\n    -1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,\n    -1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400,\n    -1400,-1400,-1400,-1400,-1400,-1400,-1400,-1400\n    },\n\n    {\n       69,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,\n    -1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,\n    -1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,\n    -1401,-1401, 1402,-1401,-1401,-1401,-1401,-1401,-1401,-1401,\n    -1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,\n    -1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,\n    -1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,\n\n    -1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,\n    -1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,\n    -1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,\n    -1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,\n    -1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401,\n    -1401,-1401,-1401,-1401,-1401,-1401,-1401,-1401\n    },\n\n    {\n       69,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,\n    -1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,\n    -1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,\n    -1402,-1402, 1403,-1402,-1402,-1402,-1402,-1402,-1402,-1402,\n\n    -1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,\n    -1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,\n    -1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,\n    -1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,\n    -1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,\n    -1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,\n    -1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,\n    -1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402,\n    -1402,-1402,-1402,-1402,-1402,-1402,-1402,-1402\n    },\n\n    {\n       69,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,\n\n    -1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,\n    -1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,\n    -1403,-1403, 1404,-1403,-1403,-1403,-1403,-1403,-1403,-1403,\n    -1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,\n    -1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,\n    -1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,\n    -1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,\n    -1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,\n    -1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,\n    -1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,\n\n    -1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403,\n    -1403,-1403,-1403,-1403,-1403,-1403,-1403,-1403\n    },\n\n    {\n       69,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,\n    -1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,\n    -1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,\n    -1404,-1404, 1405,-1404,-1404,-1404,-1404,-1404,-1404,-1404,\n    -1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,\n    -1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,\n    -1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,\n    -1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,\n\n    -1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,\n    -1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,\n    -1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,\n    -1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404,\n    -1404,-1404,-1404,-1404,-1404,-1404,-1404,-1404\n    },\n\n    {\n       69,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,\n    -1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,\n    -1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,\n    -1405,-1405, 1406,-1405,-1405,-1405,-1405,-1405,-1405,-1405,\n    -1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,\n\n    -1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,\n    -1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,\n    -1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,\n    -1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,\n    -1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,\n    -1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,\n    -1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405,\n    -1405,-1405,-1405,-1405,-1405,-1405,-1405,-1405\n    },\n\n    {\n       69,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,\n    -1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,\n\n    -1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,\n    -1406,-1406, 1407,-1406,-1406,-1406,-1406,-1406,-1406,-1406,\n    -1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,\n    -1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,\n    -1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,\n    -1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,\n    -1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,\n    -1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,\n    -1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,\n    -1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406,\n\n    -1406,-1406,-1406,-1406,-1406,-1406,-1406,-1406\n    },\n\n    {\n       69,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,\n    -1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,\n    -1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,\n    -1407,-1407, 1408,-1407,-1407,-1407,-1407,-1407,-1407,-1407,\n    -1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,\n    -1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,\n    -1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,\n    -1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,\n    -1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,\n\n    -1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,\n    -1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,\n    -1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407,\n    -1407,-1407,-1407,-1407,-1407,-1407,-1407,-1407\n    },\n\n    {\n       69,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,\n    -1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,\n    -1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,\n    -1408,-1408, 1409,-1408,-1408,-1408,-1408,-1408,-1408,-1408,\n    -1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,\n    -1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,\n\n    -1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,\n    -1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,\n    -1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,\n    -1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,\n    -1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,\n    -1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408,\n    -1408,-1408,-1408,-1408,-1408,-1408,-1408,-1408\n    },\n\n    {\n       69,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,\n    -1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,\n    -1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,\n\n    -1409,-1409, 1410,-1409,-1409,-1409,-1409,-1409,-1409,-1409,\n    -1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,\n    -1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,\n    -1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,\n    -1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,\n    -1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,\n    -1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,\n    -1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,\n    -1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409,\n    -1409,-1409,-1409,-1409,-1409,-1409,-1409,-1409\n\n    },\n\n    {\n       69,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,\n    -1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,\n    -1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,\n    -1410,-1410, 1411,-1410,-1410,-1410,-1410,-1410,-1410,-1410,\n    -1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,\n    -1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,\n    -1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,\n    -1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,\n    -1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,\n    -1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,\n\n    -1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,\n    -1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410,\n    -1410,-1410,-1410,-1410,-1410,-1410,-1410,-1410\n    },\n\n    {\n       69,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,\n    -1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,\n    -1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,\n    -1411,-1411, 1412,-1411,-1411,-1411,-1411,-1411,-1411,-1411,\n    -1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,\n    -1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,\n    -1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,\n\n    -1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,\n    -1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,\n    -1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,\n    -1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,\n    -1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411,\n    -1411,-1411,-1411,-1411,-1411,-1411,-1411,-1411\n    },\n\n    {\n       69,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,\n    -1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,\n    -1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,\n    -1412,-1412, 1413,-1412,-1412,-1412,-1412,-1412,-1412,-1412,\n\n    -1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,\n    -1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,\n    -1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,\n    -1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,\n    -1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,\n    -1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,\n    -1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,\n    -1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412,\n    -1412,-1412,-1412,-1412,-1412,-1412,-1412,-1412\n    },\n\n    {\n       69,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,\n\n    -1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,\n    -1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,\n    -1413,-1413, 1414,-1413,-1413,-1413,-1413,-1413,-1413,-1413,\n    -1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,\n    -1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,\n    -1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,\n    -1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,\n    -1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,\n    -1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,\n    -1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,\n\n    -1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413,\n    -1413,-1413,-1413,-1413,-1413,-1413,-1413,-1413\n    },\n\n    {\n       69,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,\n    -1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,\n    -1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,\n    -1414,-1414, 1415,-1414,-1414,-1414,-1414,-1414,-1414,-1414,\n    -1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,\n    -1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,\n    -1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,\n    -1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,\n\n    -1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,\n    -1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,\n    -1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,\n    -1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414,\n    -1414,-1414,-1414,-1414,-1414,-1414,-1414,-1414\n    },\n\n    {\n       69,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,\n    -1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,\n    -1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,\n    -1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,\n    -1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,\n\n    -1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,\n    -1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,\n    -1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,\n    -1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,\n    -1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,\n    -1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,\n    -1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415,\n    -1415,-1415,-1415,-1415,-1415,-1415,-1415,-1415\n    },\n\n    } ;\n\nstatic yy_state_type yy_get_previous_state ( yyscan_t yyscanner );\nstatic yy_state_type yy_try_NUL_trans ( yy_state_type current_state  , yyscan_t yyscanner);\nstatic int yy_get_next_buffer ( yyscan_t yyscanner );\nstatic void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );\n\n/* Done after the current pattern has been matched and before the\n * corresponding action - sets up yytext.\n */\n#define YY_DO_BEFORE_ACTION \\\n\tyyg->yytext_ptr = yy_bp; \\\n\tyyleng = (int) (yy_cp - yy_bp); \\\n\tyyg->yy_hold_char = *yy_cp; \\\n\t*yy_cp = '\\0'; \\\n\tyyg->yy_c_buf_p = yy_cp;\n#define YY_NUM_RULES 428\n#define YY_END_OF_BUFFER 429\n/* This struct is not used in this scanner,\n   but its presence is necessary. */\nstruct yy_trans_info\n\t{\n\tflex_int32_t yy_verify;\n\tflex_int32_t yy_nxt;\n\t};\nstatic const flex_int16_t yy_accept[1416] =\n    {   0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,  429,  428,\n      191,  191,  191,  191,  191,  191,  191,  191,  191,  191,\n      191,  191,  191,  191,  191,  191,  191,  191,  191,  199,\n      199,  199,  218,  218,  210,  210,  219,  219,  211,  211,\n\n      266,  266,  266,  428,  287,  287,  276,  276,  291,  291,\n      302,  302,  303,  303,  369,  369,  369,  404,  404,  382,\n      382,  405,  405,  383,  383,  409,  409,  305,  306,  304,\n      313,  313,  314,  314,  322,  322,  323,  323,  411,  411,\n      413,  413,  412,  415,  415,  415,  414,  417,  417,  417,\n      416,  419,  419,  428,  420,  428,  428,  428,  425,  428,\n      426,  428,  427,    0,    0,    0,   64,   58,    0,   21,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n       17,    0,    0,   63,   57,    0,    0,    0,    0,    0,\n\n        0,    0,    0,   23,    0,    0,    0,   19,    0,   66,\n       60,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,  410,  412,    0,\n      414,  414,  414,  414,    0,    0,  416,  416,  416,  416,\n        0,    0,  418,    0,  422,    0,    0,    0,  420,    0,\n\n        0,    0,  420,    0,    0,    0,  425,    0,  426,    0,\n      427,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,   65,   59,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,   24,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,   20,   67,   61,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,  196,\n      197,  198,  195,  194,  192,  193,    0,    0,    0,  200,\n\n      201,  202,  207,  206,    0,    0,    0,  203,  204,  205,\n      209,  208,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,  288,  289,  290,  292,  293,  294,  299,\n      298,  295,  296,  297,  301,  300,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,  406,  407,  408,    0,    0,    0,\n      310,  311,  312,    0,    0,    0,  319,  320,  321,  414,\n        0,  414,  416,    0,  416,    0,    0,  421,    0,    0,\n\n        0,  423,    0,    0,    0,  420,    0,    0,   22,   18,\n       26,    0,   70,    0,   90,   75,    0,   13,   44,   80,\n       39,   34,   85,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,  125,    0,\n        0,    0,    0,  167,    0,    0,    0,    0,    0,   51,\n       49,    0,  131,    0,    0,    0,    0,    0,    0,  163,\n        0,   54,    0,   56,  171,  169,  181,    0,   28,    0,\n       72,    0,   92,   77,    0,   15,   46,   82,   41,   36,\n       87,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,   96,  183,    0,    0,    0,    0,  173,    0,    0,\n\n       95,    0,    0,    0,  179,  212,  213,  214,  215,  216,\n      217,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,  267,  268,  269,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,  307,  308,  309,\n      315,  316,  317,  318,  424,    0,    0,    0,  421,    0,\n\n        0,    0,  420,    0,    0,   27,   71,   91,   76,   31,\n       14,   45,   81,   40,   35,   86,    0,   25,   69,   89,\n       74,    0,    0,   30,   12,   43,   79,   38,   33,   84,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,  128,\n        0,    0,    0,    0,    0,  144,  146,  148,    0,    0,\n       62,    0,    0,    0,    0,    0,    0,    0,    0,   29,\n       73,   93,   78,   32,   16,   47,   83,   42,   37,   88,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,  101,\n        0,    0,   99,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,  275,\n      272,  274,  270,  271,  273,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,  375,  373,  374,\n\n      370,  371,  372,    0,    0,    0,    0,    0,    0,    0,\n        0,  381,  379,  380,  376,  377,  378,    0,  421,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,  255,  257,  260,  264,  256,  259,\n\n      263,  258,  262,  261,  265,  251,  229,  248,  252,  240,\n      230,  226,  235,  246,  249,  253,  241,  238,  243,  231,\n      227,  236,  224,  233,  245,  247,  250,  254,  242,  239,\n      244,  222,  223,  232,  228,  237,  225,  234,  220,  221,\n      286,  282,  285,  279,  281,  284,  277,  278,  280,  283,\n      359,  361,  364,  368,  360,  363,  367,  362,  366,  365,\n      355,  333,  352,  356,  344,  330,  334,  339,  350,  353,\n      357,  342,  345,  347,  328,  331,  335,  340,  337,  349,\n      351,  354,  358,  326,  343,  346,  348,  327,  324,  329,\n      332,  336,  341,  338,  325,  399,  389,  398,  387,  388,\n\n      397,  384,  385,  386,  396,  403,  395,  402,  393,  394,\n      401,  390,  391,  392,  400,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n      166,    0,    0,    0,  117,  115,    0,    0,    0,    0,\n       50,   48,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n      162,    0,   53,   55,    0,  168,  170,  180,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,  182,  172,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,   94,    0,    0,    0,    0,    0,    0,    0,\n\n      178,  134,  186,  188,  124,  123,  126,  119,  105,  104,\n      120,  121,  122,  185,    0,  165,  187,  189,  113,  112,\n      116,  114,  133,  130,  129,  132,  127,  107,  111,  109,\n      106,  110,  108,  154,  155,  156,  153,  157,  149,  143,\n      145,  147,  158,  159,  160,  150,  151,  152,  161,  102,\n      164,   52,  184,  138,    0,  141,  118,  142,   97,  103,\n      140,  139,  100,   98,  135,  136,   68,  175,  176,  177,\n      174,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,  137,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    1,\n        0,    0,    3,    0,    0,    4,    0,    0,    5,    0,\n        0,    2,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    6,    0,    7,    0,\n        8,    0,    9,    0,   10,    0,   11,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,  190\n    } ;\n\nstatic const yy_state_type yy_NUL_trans[1416] =\n    {   0,\n       70,   71,   90,   90,   93,   93,   95,   95,   97,   97,\n       99,   99,  101,  101,   70,   70,  105,  105,  107,  107,\n      109,  109,  111,  111,  113,  113,  115,  115,  118,  118,\n      120,  120,  122,  122,  124,  124,  126,  126,  128,  128,\n      129,  129,  131,  131,  133,  133,  135,  135,  137,  137,\n      139,  139,  141,  141,  144,  144,  148,  148,  152,  152,\n      154,  154,  158,  158,  160,  160,  162,  162,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,  292,  294,    0,  298,  302,  306,    0,  308,\n        0,  310,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,  292,    0,  294,    0,  496,  497,  501,    0,  505,\n\n      302,  302,    0,  302,  302,  306,    0,  308,    0,  310,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,  496,  497,    0,  497,  497,\n\n      501,    0,  501,  698,  501,    0,  505,  702,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,  496,  918,  698,    0,  698,\n\n      698,  702,    0,  702,  702,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,  918,    0,  918,\n      918,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0, 1336,    0, 1338,    0, 1340,    0, 1342,\n        0, 1344,    0, 1346,    0, 1336,    0, 1338,    0, 1340,\n        0, 1342,    0, 1344,    0, 1346,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0\n    } ;\n\n/* The intent behind this definition is that it'll catch\n * any uses of REJECT which flex missed.\n */\n#define REJECT reject_used_but_not_detected\n#define yymore() yymore_used_but_not_detected\n#define YY_MORE_ADJ 0\n#define YY_RESTORE_YY_MORE_OFFSET\n#line 1 \"wcsbth.l\"\n/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsbth.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* wcsbth.l is a Flex description file containing the definition of a lexical\n* scanner for parsing the WCS keyrecords for one or more image arrays and/or\n* pixel lists in a FITS binary table header.  It can also handle primary image\n* and image extension headers.\n*\n* wcsbth.l requires Flex v2.5.4 or later.  Refer to wcshdr.h for a description\n* of the user interface and operating notes.\n*\n* Implementation notes\n* --------------------\n* wcsbth() may be invoked with an option that causes it to recognize the\n* image-header form of WCS keywords as defaults for each alternate coordinate\n* representation (up to 27).  By design, with this option enabled wcsbth() can\n* also handle primary image and image extension headers, effectively treating\n* them as a single-column binary table though with WCS keywords of a different\n* form.\n*\n* NAXIS is always 2 for binary tables, it refers to the two-dimensional nature\n* of the table.  Thus NAXIS does not count the number of image axes in either\n* image arrays or pixels lists and for the latter there is not even a formal\n* equivalent of WCSAXESa.  Hence NAXIS is always ignored and a first pass\n* through the header is required to determine the number of images, the number\n* of alternate coordinate representations for each image (up to 27), and the\n* number of coordinate axes in each representation; this pass also counts the\n* number of iPVn_ma and iPSn_ma or TVk_ma and TSk_ma keywords in each\n* representation.\n*\n* On completion of the first pass, the association between column number and\n* axis number is defined for each representation of a pixel list.  Memory is\n* allocated for an array of the required number of wcsprm structs and each of\n* these is initialized appropriately.  These structs are filled in the second\n* pass.\n*\n* It is permissible for a scalar table column to contain degenerate (single-\n* point) image arrays and simultaneously form one axis of a pixel list.\n*\n* The parser does not check for duplicated keywords, for most keywords it\n* accepts the last encountered.\n*\n* wcsbth() does not currently handle the Green Bank convention.\n*\n*===========================================================================*/\n/* Options. */\n#define YY_NO_INPUT 1\n/* Indices for parameterized keywords. */\n/* Alternate coordinate system identifier. */\n/* Keyvalue data types. */\n/* Inline comment syntax. */\n/* Exclusive start states. */\n\n\n\n\n\n\n\n\n\n\n#line 113 \"wcsbth.l\"\n#include <math.h>\n#include <setjmp.h>\n#include <stddef.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"wcs.h\"\n#include \"wcshdr.h\"\n#include \"wcsmath.h\"\n#include \"wcsprintf.h\"\n#include \"wcsutil.h\"\n\n\t\t\t// Codes used for keyvalue data types.\n#define INTEGER 0\n#define FLOAT   1\n#define FLOAT2  2\n#define STRING  3\n\n\t\t\t// Bit masks used for keyword types:\n#define IMGAUX  0x1\t// Auxiliary image header, e.g. LONPOLEa or\n\t\t\t// DATE-OBS.\n#define IMGAXIS 0x2\t// Image header with axis number, e.g.\n\t\t\t// CTYPEia.\n#define IMGHEAD 0x3\t// IMGAUX | IMGAXIS, i.e. image header of\n\t\t\t// either type.\n#define BIMGARR 0x4\t// Binary table image array, e.g. iCTYna.\n#define PIXLIST 0x8\t// Pixel list, e.g. TCTYna.\n#define BINTAB  0xC\t// BIMGARR | PIXLIST, i.e. binary table\n\t\t\t// image array (without axis number) or\n\t\t\t// pixel list, e.g. LONPna or OBSGXn.\n\n// User data associated with yyscanner.\nstruct wcsbth_extra {\n  // Values passed to YY_INPUT.\n  char *hdr;\n  int  nkeyrec;\n\n  // Used in preempting the call to exit() by yy_fatal_error().\n  jmp_buf abort_jmp_env;\n};\n\n#define YY_DECL int wcsbth_scanner(char *header, int nkeyrec, int relax, \\\n int ctrl, int keysel, int *colsel, int *nreject, int *nwcs, \\\n struct wcsprm **wcs, yyscan_t yyscanner)\n\n#define YY_INPUT(inbuff, count, bufsize) \\\n\t{ \\\n\t  if (yyextra->nkeyrec) { \\\n\t    strncpy(inbuff, yyextra->hdr, 80); \\\n\t    inbuff[80] = '\\n'; \\\n\t    yyextra->hdr += 80; \\\n\t    yyextra->nkeyrec--; \\\n\t    count = 81; \\\n\t  } else { \\\n\t    count = YY_NULL; \\\n\t  } \\\n\t}\n\n// Preempt the call to exit() by yy_fatal_error().\n#define exit(status) longjmp(yyextra->abort_jmp_env, status);\n\n// A convenience macro to get around incompatibilities between unput() and\n// yyless(): put yytext followed by a blank back onto the input stream.\n#define WCSBTH_PUTBACK \\\n  sprintf(strtmp, \"%s \", yytext); \\\n  size_t iz = strlen(strtmp); \\\n  while (iz) unput(strtmp[--iz]);\n\n// Struct used internally for header bookkeeping.\nstruct wcsbth_alts {\n  int ncol, ialt, icol, imgherit;\n  short int (*arridx)[27];\n  short int pixidx[27];\n  short int pad1;\n  unsigned int *pixlist;\n\n  unsigned char (*npv)[27];\n  unsigned char (*nps)[27];\n  unsigned char pixnpv[27];\n  unsigned char pixnps[27];\n  unsigned char pad2[2];\n};\n\n// Internal helper functions.\nstatic YY_DECL;\nstatic int wcsbth_colax(struct wcsprm *wcs, struct wcsbth_alts *alts, int k,\n        char a);\nstatic int wcsbth_final(struct wcsbth_alts *alts, int *nwcs,\n        struct wcsprm **wcs);\nstatic struct wcsprm *wcsbth_idx(struct wcsprm *wcs, struct wcsbth_alts *alts,\n        int keytype, int n, char a);\nstatic int wcsbth_init1(struct wcsbth_alts *alts, int auxprm, int *nwcs,\n        struct wcsprm **wcs);\nstatic int wcsbth_pass1(int keytype, int i, int j, int n, int k, char a,\n        char ptype, struct wcsbth_alts *alts);\n\n// Helper functions for keywords that require special handling.\nstatic int wcsbth_jdref(double *wptr,   const double *jdref);\nstatic int wcsbth_jdrefi(double *wptr,  const double *jdrefi);\nstatic int wcsbth_jdreff(double *wptr,  const double *jdreff);\nstatic int wcsbth_epoch(double *wptr,   const double *epoch);\nstatic int wcsbth_vsource(double *wptr, const double *vsource);\n\n// Helper functions for keyvalue validity checking.\nstatic int wcsbth_timepixr(double timepixr);\n\n#line 25582 \"wcsbth.c\"\n#line 25583 \"wcsbth.c\"\n\n#define INITIAL 0\n#define CCCCCia 1\n#define iCCCna 2\n#define iCCCCn 3\n#define TCCCna 4\n#define TCCCCn 5\n#define CCi_ja 6\n#define ijCCna 7\n#define TCn_ka 8\n#define TCCn_ka 9\n#define CROTAi 10\n#define iCROTn 11\n#define TCROTn 12\n#define CCi_ma 13\n#define iCn_ma 14\n#define iCCn_ma 15\n#define TCn_ma 16\n#define TCCn_ma 17\n#define PROJPm 18\n#define CCCCCCCC 19\n#define CCCCCCCa 20\n#define CCCCna 21\n#define CCCCCna 22\n#define CCCCn 23\n#define CCCCCn 24\n#define VALUE 25\n#define INTEGER_VAL 26\n#define FLOAT_VAL 27\n#define FLOAT2_VAL 28\n#define STRING_VAL 29\n#define COMMENT 30\n#define DISCARD 31\n#define ERROR 32\n#define FLUSH 33\n\n#ifndef YY_NO_UNISTD_H\n/* Special case for \"unistd.h\", since it is non-ANSI. We include it way\n * down here because we want the user's section 1 to have been scanned first.\n * The user has a chance to override it with an option.\n */\n#include <unistd.h>\n#endif\n\n#define YY_EXTRA_TYPE struct wcsbth_extra *\n\n/* Holds the entire state of the reentrant scanner. */\nstruct yyguts_t\n    {\n\n    /* User-defined. Not touched by flex. */\n    YY_EXTRA_TYPE yyextra_r;\n\n    /* The rest are the same as the globals declared in the non-reentrant scanner. */\n    FILE *yyin_r, *yyout_r;\n    size_t yy_buffer_stack_top; /**< index of top of stack. */\n    size_t yy_buffer_stack_max; /**< capacity of stack. */\n    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */\n    char yy_hold_char;\n    int yy_n_chars;\n    int yyleng_r;\n    char *yy_c_buf_p;\n    int yy_init;\n    int yy_start;\n    int yy_did_buffer_switch_on_eof;\n    int yy_start_stack_ptr;\n    int yy_start_stack_depth;\n    int *yy_start_stack;\n    yy_state_type yy_last_accepting_state;\n    char* yy_last_accepting_cpos;\n\n    int yylineno_r;\n    int yy_flex_debug_r;\n\n    char *yytext_r;\n    int yy_more_flag;\n    int yy_more_len;\n\n    }; /* end struct yyguts_t */\n\nstatic int yy_init_globals ( yyscan_t yyscanner );\n\nint yylex_init (yyscan_t* scanner);\n\nint yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);\n\n/* Accessor methods to globals.\n   These are made visible to non-reentrant scanners for convenience. */\n\nint yylex_destroy ( yyscan_t yyscanner );\n\nint yyget_debug ( yyscan_t yyscanner );\n\nvoid yyset_debug ( int debug_flag , yyscan_t yyscanner );\n\nYY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );\n\nvoid yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );\n\nFILE *yyget_in ( yyscan_t yyscanner );\n\nvoid yyset_in  ( FILE * _in_str , yyscan_t yyscanner );\n\nFILE *yyget_out ( yyscan_t yyscanner );\n\nvoid yyset_out  ( FILE * _out_str , yyscan_t yyscanner );\n\n\t\t\tint yyget_leng ( yyscan_t yyscanner );\n\nchar *yyget_text ( yyscan_t yyscanner );\n\nint yyget_lineno ( yyscan_t yyscanner );\n\nvoid yyset_lineno ( int _line_number , yyscan_t yyscanner );\n\nint yyget_column  ( yyscan_t yyscanner );\n\nvoid yyset_column ( int _column_no , yyscan_t yyscanner );\n\n/* Macros after this point can all be overridden by user definitions in\n * section 1.\n */\n\n#ifndef YY_SKIP_YYWRAP\n#ifdef __cplusplus\nextern \"C\" int yywrap ( yyscan_t yyscanner );\n#else\nextern int yywrap ( yyscan_t yyscanner );\n#endif\n#endif\n\n#ifndef YY_NO_UNPUT\n    \n    static void yyunput ( int c, char *buf_ptr  , yyscan_t yyscanner);\n    \n#endif\n\n#ifndef yytext_ptr\nstatic void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);\n#endif\n\n#ifdef YY_NEED_STRLEN\nstatic int yy_flex_strlen ( const char * , yyscan_t yyscanner);\n#endif\n\n#ifndef YY_NO_INPUT\n#ifdef __cplusplus\nstatic int yyinput ( yyscan_t yyscanner );\n#else\nstatic int input ( yyscan_t yyscanner );\n#endif\n\n#endif\n\n/* Amount of stuff to slurp up with each read. */\n#ifndef YY_READ_BUF_SIZE\n#ifdef __ia64__\n/* On IA-64, the buffer size is 16k, not 8k */\n#define YY_READ_BUF_SIZE 16384\n#else\n#define YY_READ_BUF_SIZE 8192\n#endif /* __ia64__ */\n#endif\n\n/* Copy whatever the last rule matched to the standard output. */\n#ifndef ECHO\n/* This used to be an fputs(), but since the string might contain NUL's,\n * we now use fwrite().\n */\n#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)\n#endif\n\n/* Gets input and stuffs it into \"buf\".  number of characters read, or YY_NULL,\n * is returned in \"result\".\n */\n#ifndef YY_INPUT\n#define YY_INPUT(buf,result,max_size) \\\n\terrno=0; \\\n\twhile ( (result = (int) read( fileno(yyin), buf, (yy_size_t) max_size )) < 0 ) \\\n\t{ \\\n\t\tif( errno != EINTR) \\\n\t\t{ \\\n\t\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" ); \\\n\t\t\tbreak; \\\n\t\t} \\\n\t\terrno=0; \\\n\t\tclearerr(yyin); \\\n\t}\\\n\\\n\n#endif\n\n/* No semi-colon after return; correct usage is to write \"yyterminate();\" -\n * we don't want an extra ';' after the \"return\" because that will cause\n * some compilers to complain about unreachable statements.\n */\n#ifndef yyterminate\n#define yyterminate() return YY_NULL\n#endif\n\n/* Number of entries by which start-condition stack grows. */\n#ifndef YY_START_STACK_INCR\n#define YY_START_STACK_INCR 25\n#endif\n\n/* Report a fatal error. */\n#ifndef YY_FATAL_ERROR\n#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)\n#endif\n\n/* end tables serialization structures and prototypes */\n\n/* Default declaration of generated scanner - a define so the user can\n * easily add parameters.\n */\n#ifndef YY_DECL\n#define YY_DECL_IS_OURS 1\n\nextern int yylex (yyscan_t yyscanner);\n\n#define YY_DECL int yylex (yyscan_t yyscanner)\n#endif /* !YY_DECL */\n\n/* Code executed at the beginning of each rule, after yytext and yyleng\n * have been set up.\n */\n#ifndef YY_USER_ACTION\n#define YY_USER_ACTION\n#endif\n\n/* Code executed at the end of each rule. */\n#ifndef YY_BREAK\n#define YY_BREAK /*LINTED*/break;\n#endif\n\n#define YY_RULE_SETUP \\\n\tif ( yyleng > 0 ) \\\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = \\\n\t\t\t\t(yytext[yyleng - 1] == '\\n'); \\\n\tYY_USER_ACTION\n\n/** The main scanner function which does all the work.\n */\nYY_DECL\n{\n\tyy_state_type yy_current_state;\n\tchar *yy_cp, *yy_bp;\n\tint yy_act;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif ( !yyg->yy_init )\n\t\t{\n\t\tyyg->yy_init = 1;\n\n#ifdef YY_USER_INIT\n\t\tYY_USER_INIT;\n#endif\n\n\t\tif ( ! yyg->yy_start )\n\t\t\tyyg->yy_start = 1;\t/* first start state */\n\n\t\tif ( ! yyin )\n\t\t\tyyin = stdin;\n\n\t\tif ( ! yyout )\n\t\t\tyyout = stdout;\n\n\t\tif ( ! YY_CURRENT_BUFFER ) {\n\t\t\tyyensure_buffer_stack (yyscanner);\n\t\t\tYY_CURRENT_BUFFER_LVALUE =\n\t\t\t\tyy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);\n\t\t}\n\n\t\tyy_load_buffer_state( yyscanner );\n\t\t}\n\n\t{\n#line 222 \"wcsbth.l\"\n\n#line 224 \"wcsbth.l\"\n\tchar *errmsg, errtxt[80], *keyname, strtmp[80];\n\tint    inttmp;\n\tdouble dbltmp, dbl2tmp[2];\n\tstruct auxprm auxtem;\n\tstruct wcsprm wcstem;\n\t\n\t// Initialize returned values.\n\t*nreject = 0;\n\t*nwcs = 0;\n\t*wcs  = 0x0;\n\t\n\t// Our handle on the input stream.\n\tchar *keyrec = header;\n\tchar *hptr = header;\n\tchar *keep = 0x0;\n\t\n\t// For keeping tallies of keywords found.\n\tint nvalid = 0;\n\tint nother = 0;\n\t\n\t// Used to flag image header keywords that are always inherited.\n\tint imherit = 1;\n\t\n\t// If strict, then also reject.\n\tif (relax & WCSHDR_strict) relax |= WCSHDR_reject;\n\t\n\t// Keyword indices, as used in the WCS papers, e.g. iVn_ma, TPn_ka.\n\tint i = 0;\n\tint j = 0;\n\tint k = 0;\n\tint n = 0;\n\tint m = 0;\n\tchar a = ' ';\n\t\n\t// Header bookkeeping.\n\tstruct wcsbth_alts alts;\n\talts.ncol = 0;\n\talts.arridx  = 0x0;\n\talts.pixlist = 0x0;\n\talts.npv = 0x0;\n\talts.nps = 0x0;\n\t\n\tfor (int ialt = 0; ialt < 27; ialt++) {\n\t  alts.pixidx[ialt] = 0;\n\t  alts.pixnpv[ialt] = 0;\n\t  alts.pixnps[ialt] = 0;\n\t}\n\t\n\t// For decoding the keyvalue.\n\tint keytype =  0;\n\tint valtype = -1;\n\tvoid *vptr  = 0x0;\n\t\n\t// For keywords that require special handling.\n\tint altlin = 0;\n\tchar ptype = ' ';\n\tint (*chekval)(double) = 0x0;\n\tint (*special)(double *, const double *) = 0x0;\n\tstruct auxprm *auxp = 0x0;\n\tint auxprm = 0;\n\tint naux   = 0;\n\t\n\t// Selection by column number.\n\tint nsel = colsel ? colsel[0] : 0;\n\tint incl = (nsel > 0);\n\tchar exclude[1000];\n\tfor (int icol = 0; icol < 1000; icol++) {\n\t  exclude[icol] = incl;\n\t}\n\tfor (int icol = 1; icol <= abs(nsel); icol++) {\n\t  int itmp = colsel[icol];\n\t  if (0 < itmp && itmp < 1000) {\n\t    exclude[itmp] = !incl;\n\t  }\n\t}\n\texclude[0] = 0;\n\t\n\t// Selection by keyword type.\n\tif (keysel) {\n\t  int itmp = keysel;\n\t  keysel = 0;\n\t  if (itmp & WCSHDR_IMGHEAD) keysel |= IMGHEAD;\n\t  if (itmp & WCSHDR_BIMGARR) keysel |= BIMGARR;\n\t  if (itmp & WCSHDR_PIXLIST) keysel |= PIXLIST;\n\t}\n\tif (keysel == 0) {\n\t  keysel = IMGHEAD | BINTAB;\n\t}\n\t\n\t// Control variables.\n\tint ipass = 1;\n\tint npass = 2;\n\t\n\t// User data associated with yyscanner.\n\tyyextra->hdr = header;\n\tyyextra->nkeyrec = nkeyrec;\n\t\n\t// Return here via longjmp() invoked by yy_fatal_error().\n\tif (setjmp(yyextra->abort_jmp_env)) {\n\t  return WCSHDRERR_PARSER;\n\t}\n\t\n\tBEGIN(INITIAL);\n\n\n#line 25969 \"wcsbth.c\"\n\n\twhile ( /*CONSTCOND*/1 )\t\t/* loops until end-of-file is reached */\n\t\t{\n\t\tyy_cp = yyg->yy_c_buf_p;\n\n\t\t/* Support of yytext. */\n\t\t*yy_cp = yyg->yy_hold_char;\n\n\t\t/* yy_bp points to the position in yy_ch_buf of the start of\n\t\t * the current run.\n\t\t */\n\t\tyy_bp = yy_cp;\n\n\t\tyy_current_state = yyg->yy_start;\n\t\tyy_current_state += YY_AT_BOL();\nyy_match:\n\t\twhile ( (yy_current_state = yy_nxt[yy_current_state][ YY_SC_TO_UI(*yy_cp) ]) > 0 )\n\t\t\t{\n\t\t\tif ( yy_accept[yy_current_state] )\n\t\t\t\t{\n\t\t\t\tyyg->yy_last_accepting_state = yy_current_state;\n\t\t\t\tyyg->yy_last_accepting_cpos = yy_cp;\n\t\t\t\t}\n\n\t\t\t++yy_cp;\n\t\t\t}\n\n\t\tyy_current_state = -yy_current_state;\n\nyy_find_action:\n\t\tyy_act = yy_accept[yy_current_state];\n\n\t\tYY_DO_BEFORE_ACTION;\n\ndo_action:\t/* This label is used only to access EOF actions. */\n\n\t\tswitch ( yy_act )\n\t{ /* beginning of action switch */\n\t\t\tcase 0: /* must back up */\n\t\t\t/* undo the effects of YY_DO_BEFORE_ACTION */\n\t\t\t*yy_cp = yyg->yy_hold_char;\n\t\t\tyy_cp = yyg->yy_last_accepting_cpos + 1;\n\t\t\tyy_current_state = yyg->yy_last_accepting_state;\n\t\t\tgoto yy_find_action;\n\ncase 1:\nYY_RULE_SETUP\n#line 329 \"wcsbth.l\"\n{\n\t  if (ipass == 1) {\n\t    if (alts.ncol == 0) {\n\t      sscanf(yytext, \"TFIELDS = %d\", &(alts.ncol));\n\t      BEGIN(FLUSH);\n\t    } else {\n\t      errmsg = \"duplicate or out-of-sequence TFIELDS keyword\";\n\t      BEGIN(ERROR);\n\t    }\n\t\n\t  } else {\n\t    BEGIN(FLUSH);\n\t  }\n\t}\n\tYY_BREAK\ncase 2:\nYY_RULE_SETUP\n#line 344 \"wcsbth.l\"\n{\n\t  if (!(keysel & IMGAXIS)) {\n\t    // Ignore this key type.\n\t    BEGIN(DISCARD);\n\t\n\t  } else {\n\t    if (relax & WCSHDR_ALLIMG) {\n\t      sscanf(yytext, \"WCSAXES%c= %d\", &a, &i);\n\t\n\t      if (i < 0) {\n\t        errmsg = \"negative value of WCSAXESa ignored\";\n\t        BEGIN(ERROR);\n\t\n\t      } else {\n\t        valtype = INTEGER;\n\t        vptr    = 0x0;\n\t\n\t        keyname = \"WCSAXESa\";\n\t        keytype = IMGAXIS;\n\t        BEGIN(COMMENT);\n\t      }\n\t\n\t    } else if (relax & WCSHDR_reject) {\n\t      errmsg = \"image-header keyword WCSAXESa in binary table\";\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      // Pretend we don't recognize it.\n\t      BEGIN(DISCARD);\n\t    }\n\t  }\n\t}\n\tYY_BREAK\ncase 3:\n#line 378 \"wcsbth.l\"\ncase 4:\n#line 379 \"wcsbth.l\"\ncase 5:\nYY_RULE_SETUP\n#line 379 \"wcsbth.l\"\n{\n\t  keyname = \"WCAXna\";\n\t\n\t  // Note that a blank in the sscanf() format string matches zero or\n\t  // more of them in the input.\n\t  sscanf(yytext, \"WCAX%d%c = %d\", &n, &a, &i);\n\t\n\t  if (!(keysel & BIMGARR) || exclude[n]) {\n\t    // Ignore this key type or column.\n\t    BEGIN(DISCARD);\n\t\n\t  } else if (i < 0) {\n\t    errmsg = \"negative value of WCSAXESa ignored\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    valtype = INTEGER;\n\t    vptr    = 0x0;\n\t\n\t    keyname = \"WCAXna\";\n\t    keytype = IMGAXIS;\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\tYY_BREAK\ncase 6:\n/* rule 6 can match eol */\n#line 405 \"wcsbth.l\"\ncase 7:\n/* rule 7 can match eol */\n#line 406 \"wcsbth.l\"\ncase 8:\n/* rule 8 can match eol */\nYY_RULE_SETUP\n#line 406 \"wcsbth.l\"\n{\n\t  // Cross-reference supplier.\n\t  keyname = \"WCSTna\";\n\t  errmsg = \"cross-references are not implemented\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 9:\n/* rule 9 can match eol */\n#line 414 \"wcsbth.l\"\ncase 10:\n/* rule 10 can match eol */\n#line 415 \"wcsbth.l\"\ncase 11:\n/* rule 11 can match eol */\nYY_RULE_SETUP\n#line 415 \"wcsbth.l\"\n{\n\t  // Cross-reference consumer.\n\t  keyname = \"WCSXna\";\n\t  errmsg = \"cross-references are not implemented\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 12:\nYY_RULE_SETUP\n#line 422 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crpix);\n\t\n\t  keyname = \"CRPIXja\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 13:\n#line 431 \"wcsbth.l\"\ncase 14:\nYY_RULE_SETUP\n#line 431 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crpix);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"jCRPna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    keyname = \"jCRPXn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 15:\n#line 447 \"wcsbth.l\"\ncase 16:\nYY_RULE_SETUP\n#line 447 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crpix);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCRPna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    keyname = \"TCRPXn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 17:\nYY_RULE_SETUP\n#line 460 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pc);\n\t  altlin = 1;\n\t\n\t  keyname = \"PCi_ja\";\n\t  BEGIN(CCi_ja);\n\t}\n\tYY_BREAK\ncase 18:\nYY_RULE_SETUP\n#line 469 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pc);\n\t  altlin  = 1;\n\t\n\t  sscanf(yytext, \"%1d%1d\", &i, &j);\n\t\n\t  keyname = \"ijPCna\";\n\t  BEGIN(ijCCna);\n\t}\n\tYY_BREAK\ncase 19:\n#line 481 \"wcsbth.l\"\ncase 20:\nYY_RULE_SETUP\n#line 481 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pc);\n\t  altlin  = 1;\n\t\n\t  if (yyleng == 2) {\n\t    keyname = \"TPn_ka\";\n\t    BEGIN(TCn_ka);\n\t  } else {\n\t    keyname = \"TPCn_ka\";\n\t    BEGIN(TCCn_ka);\n\t  }\n\t}\n\tYY_BREAK\ncase 21:\nYY_RULE_SETUP\n#line 495 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cd);\n\t  altlin  = 2;\n\t\n\t  keyname = \"CDi_ja\";\n\t  BEGIN(CCi_ja);\n\t}\n\tYY_BREAK\ncase 22:\nYY_RULE_SETUP\n#line 504 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cd);\n\t  altlin  = 2;\n\t\n\t  sscanf(yytext, \"%1d%1d\", &i, &j);\n\t\n\t  keyname = \"ijCDna\";\n\t  BEGIN(ijCCna);\n\t}\n\tYY_BREAK\ncase 23:\n#line 516 \"wcsbth.l\"\ncase 24:\nYY_RULE_SETUP\n#line 516 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cd);\n\t  altlin  = 2;\n\t\n\t  if (yyleng == 2) {\n\t    keyname = \"TCn_ka\";\n\t    BEGIN(TCn_ka);\n\t  } else {\n\t    keyname = \"TCDn_ka\";\n\t    BEGIN(TCCn_ka);\n\t  }\n\t}\n\tYY_BREAK\ncase 25:\nYY_RULE_SETUP\n#line 530 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cdelt);\n\t\n\t  keyname = \"CDELTia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 26:\n#line 539 \"wcsbth.l\"\ncase 27:\nYY_RULE_SETUP\n#line 539 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cdelt);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCDEna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    keyname = \"iCDLTn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 28:\n#line 555 \"wcsbth.l\"\ncase 29:\nYY_RULE_SETUP\n#line 555 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cdelt);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCDEna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    keyname = \"TCDLTn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 30:\nYY_RULE_SETUP\n#line 568 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crota);\n\t  altlin  = 4;\n\t\n\t  keyname = \"CROTAi\";\n\t  BEGIN(CROTAi);\n\t}\n\tYY_BREAK\ncase 31:\nYY_RULE_SETUP\n#line 577 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crota);\n\t  altlin  = 4;\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  keyname = \"iCROTn\";\n\t  BEGIN(iCROTn);\n\t}\n\tYY_BREAK\ncase 32:\nYY_RULE_SETUP\n#line 588 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crota);\n\t  altlin  = 4;\n\t\n\t  keyname = \"TCROTn\";\n\t  BEGIN(TCROTn);\n\t}\n\tYY_BREAK\ncase 33:\nYY_RULE_SETUP\n#line 597 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cunit);\n\t\n\t  keyname = \"CUNITia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 34:\n#line 606 \"wcsbth.l\"\ncase 35:\nYY_RULE_SETUP\n#line 606 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cunit);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCUNna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    keyname = \"iCUNIn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 36:\n#line 622 \"wcsbth.l\"\ncase 37:\nYY_RULE_SETUP\n#line 622 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cunit);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCUNna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    keyname = \"TCUNIn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 38:\nYY_RULE_SETUP\n#line 635 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ctype);\n\t\n\t  keyname = \"CTYPEia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 39:\n#line 644 \"wcsbth.l\"\ncase 40:\nYY_RULE_SETUP\n#line 644 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ctype);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCTYna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    keyname = \"iCTYPn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 41:\n#line 660 \"wcsbth.l\"\ncase 42:\nYY_RULE_SETUP\n#line 660 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ctype);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCTYna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    keyname = \"TCTYPn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 43:\nYY_RULE_SETUP\n#line 673 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crval);\n\t\n\t  keyname = \"CRVALia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 44:\n#line 682 \"wcsbth.l\"\ncase 45:\nYY_RULE_SETUP\n#line 682 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crval);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCRVna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    keyname = \"iCRVLn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 46:\n#line 698 \"wcsbth.l\"\ncase 47:\nYY_RULE_SETUP\n#line 698 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crval);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCRVna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    keyname = \"TCRVLn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 48:\n#line 712 \"wcsbth.l\"\ncase 49:\nYY_RULE_SETUP\n#line 712 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.lonpole);\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"LONPOLEa\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"LONPna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\tYY_BREAK\ncase 50:\n#line 727 \"wcsbth.l\"\ncase 51:\nYY_RULE_SETUP\n#line 727 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.latpole);\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"LATPOLEa\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"LATPna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\tYY_BREAK\ncase 52:\n#line 742 \"wcsbth.l\"\ncase 53:\n#line 743 \"wcsbth.l\"\ncase 54:\nYY_RULE_SETUP\n#line 743 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.restfrq);\n\t\n\t  if (yyleng == 8) {\n\t    if (relax & WCSHDR_strict) {\n\t      errmsg = \"the RESTFREQ keyword is deprecated, use RESTFRQa\";\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      unput(' ');\n\t\n\t      keyname = \"RESTFREQ\";\n\t      BEGIN(CCCCCCCa);\n\t    }\n\t\n\t  } else if (yyleng == 7) {\n\t    keyname = \"RESTFRQa\";\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else {\n\t    keyname = \"RFRQna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\tYY_BREAK\ncase 55:\n#line 770 \"wcsbth.l\"\ncase 56:\nYY_RULE_SETUP\n#line 770 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.restwav);\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"RESTWAVa\";\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"RWAVna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\tYY_BREAK\ncase 57:\nYY_RULE_SETUP\n#line 783 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pv);\n\t  ptype   = 'v';\n\t\n\t  keyname = \"PVi_ma\";\n\t  BEGIN(CCi_ma);\n\t}\n\tYY_BREAK\ncase 58:\n#line 793 \"wcsbth.l\"\ncase 59:\nYY_RULE_SETUP\n#line 793 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pv);\n\t  ptype   = 'v';\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 2) {\n\t    keyname = \"iVn_ma\";\n\t    BEGIN(iCn_ma);\n\t  } else {\n\t    keyname = \"iPVn_ma\";\n\t    BEGIN(iCCn_ma);\n\t  }\n\t}\n\tYY_BREAK\ncase 60:\n#line 810 \"wcsbth.l\"\ncase 61:\nYY_RULE_SETUP\n#line 810 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pv);\n\t  ptype   = 'v';\n\t\n\t  if (yyleng == 2) {\n\t    keyname = \"TVn_ma\";\n\t    BEGIN(TCn_ma);\n\t  } else {\n\t    keyname = \"TPVn_ma\";\n\t    BEGIN(TCCn_ma);\n\t  }\n\t}\n\tYY_BREAK\ncase 62:\nYY_RULE_SETUP\n#line 824 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pv);\n\t  ptype   = 'v';\n\t\n\t  keyname = \"PROJPm\";\n\t  BEGIN(PROJPm);\n\t}\n\tYY_BREAK\ncase 63:\nYY_RULE_SETUP\n#line 833 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ps);\n\t  ptype   = 's';\n\t\n\t  keyname = \"PSi_ma\";\n\t  BEGIN(CCi_ma);\n\t}\n\tYY_BREAK\ncase 64:\n#line 843 \"wcsbth.l\"\ncase 65:\nYY_RULE_SETUP\n#line 843 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ps);\n\t  ptype   = 's';\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 2) {\n\t    keyname = \"iSn_ma\";\n\t    BEGIN(iCn_ma);\n\t  } else {\n\t    keyname = \"iPSn_ma\";\n\t    BEGIN(iCCn_ma);\n\t  }\n\t}\n\tYY_BREAK\ncase 66:\n#line 860 \"wcsbth.l\"\ncase 67:\nYY_RULE_SETUP\n#line 860 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ps);\n\t  ptype   = 's';\n\t\n\t  if (yyleng == 2) {\n\t    keyname = \"TSn_ma\";\n\t    BEGIN(TCn_ma);\n\t  } else {\n\t    keyname = \"TPSn_ma\";\n\t    BEGIN(TCCn_ma);\n\t  }\n\t}\n\tYY_BREAK\ncase 68:\nYY_RULE_SETUP\n#line 874 \"wcsbth.l\"\n{\n\t  sscanf(yytext, \"VELREF%c\", &a);\n\t\n\t  if (relax & WCSHDR_strict) {\n\t    errmsg = \"the VELREF keyword is deprecated, use SPECSYSa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else if (a == ' ' || (relax & WCSHDR_VELREFa)) {\n\t    valtype = INTEGER;\n\t    vptr    = &(wcstem.velref);\n\t\n\t    unput(a);\n\t\n\t    keyname = \"VELREF\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"VELREF keyword may not have an alternate version code\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 69:\nYY_RULE_SETUP\n#line 900 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cname);\n\t\n\t  keyname = \"CNAMEia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 70:\n#line 909 \"wcsbth.l\"\ncase 71:\nYY_RULE_SETUP\n#line 909 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cname);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCNAna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"iCNAMn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 72:\n#line 926 \"wcsbth.l\"\ncase 73:\nYY_RULE_SETUP\n#line 926 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cname);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCNAna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"TCNAMn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 74:\nYY_RULE_SETUP\n#line 940 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crder);\n\t\n\t  keyname = \"CRDERia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 75:\n#line 949 \"wcsbth.l\"\ncase 76:\nYY_RULE_SETUP\n#line 949 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crder);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCRDna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"iCRDEn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 77:\n#line 966 \"wcsbth.l\"\ncase 78:\nYY_RULE_SETUP\n#line 966 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crder);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCRDna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"TCRDEn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 79:\nYY_RULE_SETUP\n#line 980 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.csyer);\n\t\n\t  keyname = \"CSYERia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 80:\n#line 989 \"wcsbth.l\"\ncase 81:\nYY_RULE_SETUP\n#line 989 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.csyer);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCSYna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"iCSYEn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 82:\n#line 1006 \"wcsbth.l\"\ncase 83:\nYY_RULE_SETUP\n#line 1006 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.csyer);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCSYna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"TCSYEn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 84:\nYY_RULE_SETUP\n#line 1020 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.czphs);\n\t\n\t  keyname = \"CZPHSia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 85:\n#line 1029 \"wcsbth.l\"\ncase 86:\nYY_RULE_SETUP\n#line 1029 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.czphs);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCZPna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"iCZPHn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 87:\n#line 1046 \"wcsbth.l\"\ncase 88:\nYY_RULE_SETUP\n#line 1046 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.czphs);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCZPna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"TCZPHn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 89:\nYY_RULE_SETUP\n#line 1060 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cperi);\n\t\n\t  keyname = \"CPERIia\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 90:\n#line 1069 \"wcsbth.l\"\ncase 91:\nYY_RULE_SETUP\n#line 1069 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cperi);\n\t\n\t  sscanf(yytext, \"%d\", &i);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"iCPRna\";\n\t    BEGIN(iCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"iCPERn\";\n\t    BEGIN(iCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 92:\n#line 1086 \"wcsbth.l\"\ncase 93:\nYY_RULE_SETUP\n#line 1086 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cperi);\n\t\n\t  if (yyleng == 4) {\n\t    keyname = \"TCPRna\";\n\t    BEGIN(TCCCna);\n\t  } else {\n\t    if (!(relax & WCSHDR_CNAMn)) vptr = 0x0;\n\t    keyname = \"TCPERn\";\n\t    BEGIN(TCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 94:\n#line 1101 \"wcsbth.l\"\ncase 95:\n#line 1102 \"wcsbth.l\"\ncase 96:\nYY_RULE_SETUP\n#line 1102 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.wcsname;\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"WCSNAMEa\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else {\n\t    if (*yytext == 'W') {\n\t      keyname = \"WCSNna\";\n\t    } else {\n\t      keyname = \"TWCSna\";\n\t    }\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\tYY_BREAK\ncase 97:\nYY_RULE_SETUP\n#line 1121 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.timesys;\n\t\n\t  keyname = \"TIMESYS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 98:\n#line 1130 \"wcsbth.l\"\ncase 99:\nYY_RULE_SETUP\n#line 1130 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.trefpos;\n\t\n\t  if (yyleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"TREFPOS\";\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"TRPOSn\";\n\t    BEGIN(CCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 100:\n#line 1145 \"wcsbth.l\"\ncase 101:\nYY_RULE_SETUP\n#line 1145 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.trefdir;\n\t\n\t  if (yyleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"TREFDIR\";\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"TRDIRn\";\n\t    BEGIN(CCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 102:\nYY_RULE_SETUP\n#line 1159 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.plephem;\n\t\n\t  keyname = \"PLEPHEM\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 103:\nYY_RULE_SETUP\n#line 1167 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.timeunit;\n\t\n\t  keyname = \"TIMEUNIT\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 104:\n#line 1176 \"wcsbth.l\"\ncase 105:\nYY_RULE_SETUP\n#line 1176 \"wcsbth.l\"\n{\n\t  if ((yytext[4] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = STRING;\n\t    vptr    = wcstem.dateref;\n\t\n\t    keyname = \"DATEREF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the DATE-REF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 106:\n#line 1194 \"wcsbth.l\"\ncase 107:\nYY_RULE_SETUP\n#line 1194 \"wcsbth.l\"\n{\n\t  if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = FLOAT2;\n\t    vptr    = wcstem.mjdref;\n\t\n\t    keyname = \"MJDREF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the MJD-REF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 108:\n#line 1212 \"wcsbth.l\"\ncase 109:\nYY_RULE_SETUP\n#line 1212 \"wcsbth.l\"\n{\n\t  if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    // Actually integer, but treated as float.\n\t    valtype = FLOAT;\n\t    vptr    = wcstem.mjdref;\n\t\n\t    keyname = \"MJDREFI\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the MJD-REFI keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 110:\n#line 1231 \"wcsbth.l\"\ncase 111:\nYY_RULE_SETUP\n#line 1231 \"wcsbth.l\"\n{\n\t  if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = FLOAT;\n\t    vptr    = wcstem.mjdref + 1;\n\t\n\t    keyname = \"MJDREFF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the MJD-REFF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 112:\n#line 1249 \"wcsbth.l\"\ncase 113:\nYY_RULE_SETUP\n#line 1249 \"wcsbth.l\"\n{\n\t  if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = FLOAT2;\n\t    vptr    = wcstem.mjdref;\n\t    special = wcsbth_jdref;\n\t\n\t    keyname = \"JDREF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the JD-REF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 114:\n#line 1268 \"wcsbth.l\"\ncase 115:\nYY_RULE_SETUP\n#line 1268 \"wcsbth.l\"\n{\n\t  if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    // Actually integer, but treated as float.\n\t    valtype = FLOAT;\n\t    vptr    = wcstem.mjdref;\n\t    special = wcsbth_jdrefi;\n\t\n\t    keyname = \"JDREFI\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the JD-REFI keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 116:\n#line 1288 \"wcsbth.l\"\ncase 117:\nYY_RULE_SETUP\n#line 1288 \"wcsbth.l\"\n{\n\t  if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) {\n\t    valtype = FLOAT;\n\t    vptr    = wcstem.mjdref;\n\t    special = wcsbth_jdreff;\n\t\n\t    keyname = \"JDREFF\";\n\t    BEGIN(CCCCCCCC);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the JD-REFF keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 118:\nYY_RULE_SETUP\n#line 1306 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timeoffs);\n\t\n\t  keyname = \"TIMEOFFS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 119:\nYY_RULE_SETUP\n#line 1314 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.dateobs;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"DATE-OBS\";\n\t  imherit = 0;\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 120:\n#line 1325 \"wcsbth.l\"\ncase 121:\n#line 1326 \"wcsbth.l\"\ncase 122:\nYY_RULE_SETUP\n#line 1326 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.dateobs;\n\t\n\t  if (relax & WCSHDR_DOBSn) {\n\t    yyless(4);\n\t\n\t    keyname = \"DOBSn\";\n\t    BEGIN(CCCCn);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"DOBSn keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 123:\nYY_RULE_SETUP\n#line 1345 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.datebeg;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"DATE-BEG\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 124:\n#line 1355 \"wcsbth.l\"\ncase 125:\nYY_RULE_SETUP\n#line 1355 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.dateavg;\n\t\n\t  if (yyleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"DATE-AVG\";\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"DAVGn\";\n\t    BEGIN(CCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 126:\nYY_RULE_SETUP\n#line 1369 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.dateend;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"DATE-END\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 127:\n#line 1379 \"wcsbth.l\"\ncase 128:\nYY_RULE_SETUP\n#line 1379 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdobs);\n\t\n\t  if (yyleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"MJD-OBS\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"MJDOBn\";\n\t    BEGIN(CCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 129:\nYY_RULE_SETUP\n#line 1394 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdbeg);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"MJD-BEG\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 130:\n#line 1404 \"wcsbth.l\"\ncase 131:\nYY_RULE_SETUP\n#line 1404 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdavg);\n\t\n\t  if (yyleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"MJD-AVG\";\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"MJDAn\";\n\t    BEGIN(CCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 132:\nYY_RULE_SETUP\n#line 1418 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdend);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"MJD-END\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 133:\nYY_RULE_SETUP\n#line 1427 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.jepoch);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"JEPOCH\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 134:\nYY_RULE_SETUP\n#line 1436 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.bepoch);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"BEPOCH\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 135:\nYY_RULE_SETUP\n#line 1445 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.tstart);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TSTART\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 136:\nYY_RULE_SETUP\n#line 1454 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.tstop);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TSTOP\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 137:\nYY_RULE_SETUP\n#line 1463 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.xposure);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"XPOSURE\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 138:\nYY_RULE_SETUP\n#line 1472 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.telapse);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TELAPSE\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 139:\nYY_RULE_SETUP\n#line 1481 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timsyer);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TIMSYER\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 140:\nYY_RULE_SETUP\n#line 1490 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timrder);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TIMRDER\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 141:\nYY_RULE_SETUP\n#line 1499 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timedel);\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TIMEDEL\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 142:\nYY_RULE_SETUP\n#line 1508 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.timepixr);\n\t  chekval = wcsbth_timepixr;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"TIMEPIXR\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 143:\n#line 1519 \"wcsbth.l\"\ncase 144:\nYY_RULE_SETUP\n#line 1519 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo;\n\t\n\t  if (yyleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"OBSGEO-X\";\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"OBSGXn\";\n\t    BEGIN(CCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 145:\n#line 1534 \"wcsbth.l\"\ncase 146:\nYY_RULE_SETUP\n#line 1534 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 1;\n\t\n\t  if (yyleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"OBSGEO-Y\";\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"OBSGYn\";\n\t    BEGIN(CCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 147:\n#line 1549 \"wcsbth.l\"\ncase 148:\nYY_RULE_SETUP\n#line 1549 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 2;\n\t\n\t  if (yyleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"OBSGEO-Z\";\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"OBSGZn\";\n\t    BEGIN(CCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 149:\nYY_RULE_SETUP\n#line 1563 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 3;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-L\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 150:\n#line 1573 \"wcsbth.l\"\ncase 151:\n#line 1574 \"wcsbth.l\"\ncase 152:\nYY_RULE_SETUP\n#line 1574 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.obsgeo + 3;\n\t\n\t  if (relax & WCSHDR_OBSGLBHn) {\n\t    yyless(5);\n\t\n\t    keyname = \"OBSGLn\";\n\t    BEGIN(CCCCCn);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"OBSGLn keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 153:\nYY_RULE_SETUP\n#line 1593 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 4;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-B\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 154:\n#line 1603 \"wcsbth.l\"\ncase 155:\n#line 1604 \"wcsbth.l\"\ncase 156:\nYY_RULE_SETUP\n#line 1604 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.obsgeo + 3;\n\t\n\t  if (relax & WCSHDR_OBSGLBHn) {\n\t    yyless(5);\n\t\n\t    keyname = \"OBSGBn\";\n\t    BEGIN(CCCCCn);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"OBSGBn keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 157:\nYY_RULE_SETUP\n#line 1623 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 5;\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-H\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 158:\n#line 1633 \"wcsbth.l\"\ncase 159:\n#line 1634 \"wcsbth.l\"\ncase 160:\nYY_RULE_SETUP\n#line 1634 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.obsgeo + 3;\n\t\n\t  if (relax & WCSHDR_OBSGLBHn) {\n\t    yyless(5);\n\t\n\t    keyname = \"OBSGHn\";\n\t    BEGIN(CCCCCn);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"OBSGHn keyword is non-standard\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 161:\nYY_RULE_SETUP\n#line 1653 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.obsorbit;\n\t\n\t  keyname = \"OBSORBIT\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 162:\n#line 1662 \"wcsbth.l\"\ncase 163:\nYY_RULE_SETUP\n#line 1662 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.radesys;\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"RADESYSa\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"RADEna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\tYY_BREAK\ncase 164:\nYY_RULE_SETUP\n#line 1676 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_RADECSYS) {\n\t    valtype = STRING;\n\t    vptr    = wcstem.radesys;\n\t\n\t    unput(' ');\n\t\n\t    keyname = \"RADECSYS\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the RADECSYS keyword is deprecated, use RADESYSa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 165:\nYY_RULE_SETUP\n#line 1696 \"wcsbth.l\"\n{\n\t  sscanf(yytext, \"EPOCH%c\", &a);\n\t\n\t  if (relax & WCSHDR_strict) {\n\t    errmsg = \"the EPOCH keyword is deprecated, use EQUINOXa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else if (a == ' ' || (relax & WCSHDR_EPOCHa)) {\n\t    valtype = FLOAT;\n\t    vptr    = &(wcstem.equinox);\n\t    special = wcsbth_epoch;\n\t\n\t    unput(a);\n\t\n\t    keyname = \"EPOCH\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"EPOCH keyword may not have an alternate version code\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 166:\n#line 1724 \"wcsbth.l\"\ncase 167:\nYY_RULE_SETUP\n#line 1724 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.equinox);\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"EQUINOXa\";\n\t    imherit = 0;\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"EQUIna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\tYY_BREAK\ncase 168:\n#line 1739 \"wcsbth.l\"\ncase 169:\nYY_RULE_SETUP\n#line 1739 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.specsys;\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"SPECSYSa\";\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"SPECna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\tYY_BREAK\ncase 170:\n#line 1753 \"wcsbth.l\"\ncase 171:\nYY_RULE_SETUP\n#line 1753 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.ssysobs;\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"SSYSOBSa\";\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"SOBSna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\tYY_BREAK\ncase 172:\n#line 1767 \"wcsbth.l\"\ncase 173:\nYY_RULE_SETUP\n#line 1767 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.velosys);\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"VELOSYSa\";\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"VSYSna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\tYY_BREAK\ncase 174:\nYY_RULE_SETUP\n#line 1780 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_VSOURCE) {\n\t    valtype = FLOAT;\n\t    vptr    = &(wcstem.zsource);\n\t    special = wcsbth_vsource;\n\t\n\t    yyless(7);\n\t\n\t    keyname = \"VSOURCEa\";\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the VSOURCEa keyword is deprecated, use ZSOURCEa\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 175:\n#line 1801 \"wcsbth.l\"\ncase 176:\n#line 1802 \"wcsbth.l\"\ncase 177:\nYY_RULE_SETUP\n#line 1802 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_VSOURCE) {\n\t    valtype = FLOAT;\n\t    vptr    = &(wcstem.zsource);\n\t    special = wcsbth_vsource;\n\t\n\t    yyless(4);\n\t    keyname = \"VSOUna\";\n\t    BEGIN(CCCCna);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"VSOUna keyword is deprecated, use ZSOUna\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 178:\n#line 1823 \"wcsbth.l\"\ncase 179:\nYY_RULE_SETUP\n#line 1823 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.zsource);\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"ZSOURCEa\";\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"ZSOUna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\tYY_BREAK\ncase 180:\n#line 1837 \"wcsbth.l\"\ncase 181:\nYY_RULE_SETUP\n#line 1837 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.ssyssrc;\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"SSYSSRCa\";\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"SSRCna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\tYY_BREAK\ncase 182:\n#line 1851 \"wcsbth.l\"\ncase 183:\nYY_RULE_SETUP\n#line 1851 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.velangl);\n\t\n\t  if (yyleng == 7) {\n\t    keyname = \"VELANGLa\";\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"VANGna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\tYY_BREAK\ncase 184:\nYY_RULE_SETUP\n#line 1864 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.rsun_ref);\n\t\n\t  keyname = \"RSUN_REF\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 185:\nYY_RULE_SETUP\n#line 1873 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.dsun_obs);\n\t\n\t  keyname = \"DSUN_OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 186:\nYY_RULE_SETUP\n#line 1882 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.crln_obs);\n\t\n\t  keyname = \"CRLN_OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 187:\nYY_RULE_SETUP\n#line 1891 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.hgln_obs);\n\t\n\t  keyname = \"HGLN_OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 188:\n#line 1901 \"wcsbth.l\"\ncase 189:\nYY_RULE_SETUP\n#line 1901 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  auxprm  = 1;\n\t  vptr    = &(auxtem.hglt_obs);\n\t\n\t  keyname = \"HGLT_OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 190:\nYY_RULE_SETUP\n#line 1910 \"wcsbth.l\"\n{\n\t  if (yyextra->nkeyrec) {\n\t    yyextra->nkeyrec = 0;\n\t    errmsg = \"keyrecords following the END keyrecord were ignored\";\n\t    BEGIN(ERROR);\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 191:\nYY_RULE_SETUP\n#line 1920 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 192:\n#line 1925 \"wcsbth.l\"\ncase 193:\nYY_RULE_SETUP\n#line 1925 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    sscanf(yytext, \"%d%c\", &i, &a);\n\t    keytype = IMGAXIS;\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 194:\n#line 1944 \"wcsbth.l\"\ncase 195:\nYY_RULE_SETUP\n#line 1944 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    if (relax & WCSHDR_reject) {\n\t      // Violates the basic FITS standard.\n\t      errmsg = \"indices in parameterized keywords must not have \"\n\t               \"leading zeroes\";\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      // Pretend we don't recognize it.\n\t      BEGIN(DISCARD);\n\t    }\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"invalid image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 196:\n#line 1970 \"wcsbth.l\"\ncase 197:\n#line 1971 \"wcsbth.l\"\ncase 198:\nYY_RULE_SETUP\n#line 1971 \"wcsbth.l\"\n{\n\t  // Anything that has fallen through to this point must contain\n\t  // an invalid axis number.\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    errmsg = \"axis number must exceed 0\";\n\t    BEGIN(ERROR);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"invalid image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 199:\nYY_RULE_SETUP\n#line 1990 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_reject) {\n\t    // Looks too much like a FITS WCS keyword not to flag it.\n\t    errmsg = errtxt;\n\t    sprintf(errmsg, \"keyword looks very much like %s but isn't\",\n\t      keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 200:\n#line 2005 \"wcsbth.l\"\ncase 201:\n#line 2006 \"wcsbth.l\"\ncase 202:\n#line 2007 \"wcsbth.l\"\ncase 203:\n#line 2008 \"wcsbth.l\"\ncase 204:\n#line 2009 \"wcsbth.l\"\ncase 205:\nYY_RULE_SETUP\n#line 2009 \"wcsbth.l\"\n{\n\t  if (vptr) {\n\t    WCSBTH_PUTBACK;\n\t    BEGIN((YY_START == iCCCCn) ? iCCCna : TCCCna);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg, \"%s keyword is non-standard\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 206:\n#line 2025 \"wcsbth.l\"\ncase 207:\n#line 2026 \"wcsbth.l\"\ncase 208:\n#line 2027 \"wcsbth.l\"\ncase 209:\nYY_RULE_SETUP\n#line 2027 \"wcsbth.l\"\n{\n\t  if (vptr && (relax & WCSHDR_LONGKEY)) {\n\t    WCSBTH_PUTBACK;\n\t    BEGIN((YY_START == iCCCCn) ? iCCCna : TCCCna);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    if (!vptr) {\n\t      sprintf(errmsg, \"%s keyword is non-standard\", keyname);\n\t    } else {\n\t      sprintf(errmsg,\n\t        \"%s keyword may not have an alternate version code\", keyname);\n\t    }\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 210:\n#line 2049 \"wcsbth.l\"\ncase 211:\nYY_RULE_SETUP\n#line 2049 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 212:\n#line 2054 \"wcsbth.l\"\ncase 213:\n#line 2055 \"wcsbth.l\"\ncase 214:\n#line 2056 \"wcsbth.l\"\ncase 215:\n#line 2057 \"wcsbth.l\"\ncase 216:\n#line 2058 \"wcsbth.l\"\ncase 217:\nYY_RULE_SETUP\n#line 2058 \"wcsbth.l\"\n{\n\t  sscanf(yytext, \"%d%c\", &n, &a);\n\t  if (YY_START == TCCCna) i = wcsbth_colax(*wcs, &alts, n, a);\n\t  keytype = (YY_START == iCCCna) ? BIMGARR : PIXLIST;\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 218:\n#line 2066 \"wcsbth.l\"\ncase 219:\nYY_RULE_SETUP\n#line 2066 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 220:\n#line 2071 \"wcsbth.l\"\ncase 221:\n#line 2072 \"wcsbth.l\"\ncase 222:\n#line 2073 \"wcsbth.l\"\ncase 223:\nYY_RULE_SETUP\n#line 2073 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    sscanf(yytext, \"%d_%d%c\", &i, &j, &a);\n\t    keytype = IMGAXIS;\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 224:\n#line 2092 \"wcsbth.l\"\ncase 225:\n#line 2093 \"wcsbth.l\"\ncase 226:\n#line 2094 \"wcsbth.l\"\ncase 227:\n#line 2095 \"wcsbth.l\"\ncase 228:\n#line 2096 \"wcsbth.l\"\ncase 229:\n#line 2097 \"wcsbth.l\"\ncase 230:\n#line 2098 \"wcsbth.l\"\ncase 231:\n#line 2099 \"wcsbth.l\"\ncase 232:\n#line 2100 \"wcsbth.l\"\ncase 233:\n#line 2101 \"wcsbth.l\"\ncase 234:\n#line 2102 \"wcsbth.l\"\ncase 235:\n#line 2103 \"wcsbth.l\"\ncase 236:\n#line 2104 \"wcsbth.l\"\ncase 237:\n#line 2105 \"wcsbth.l\"\ncase 238:\n#line 2106 \"wcsbth.l\"\ncase 239:\n#line 2107 \"wcsbth.l\"\ncase 240:\n#line 2108 \"wcsbth.l\"\ncase 241:\n#line 2109 \"wcsbth.l\"\ncase 242:\n#line 2110 \"wcsbth.l\"\ncase 243:\n#line 2111 \"wcsbth.l\"\ncase 244:\nYY_RULE_SETUP\n#line 2111 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    if (((altlin == 1) && (relax & WCSHDR_PC0i_0ja)) ||\n\t        ((altlin == 2) && (relax & WCSHDR_CD0i_0ja))) {\n\t      sscanf(yytext, \"%d_%d%c\", &i, &j, &a);\n\t      keytype = IMGAXIS;\n\t      BEGIN(VALUE);\n\t\n\t    } else if (relax & WCSHDR_reject) {\n\t      errmsg = \"indices in parameterized keywords must not have \"\n\t             \"leading zeroes\";\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      // Pretend we don't recognize it.\n\t      BEGIN(DISCARD);\n\t    }\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"invalid image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 245:\n#line 2142 \"wcsbth.l\"\ncase 246:\n#line 2143 \"wcsbth.l\"\ncase 247:\n#line 2144 \"wcsbth.l\"\ncase 248:\n#line 2145 \"wcsbth.l\"\ncase 249:\n#line 2146 \"wcsbth.l\"\ncase 250:\n#line 2147 \"wcsbth.l\"\ncase 251:\n#line 2148 \"wcsbth.l\"\ncase 252:\n#line 2149 \"wcsbth.l\"\ncase 253:\n#line 2150 \"wcsbth.l\"\ncase 254:\nYY_RULE_SETUP\n#line 2150 \"wcsbth.l\"\n{\n\t  // Anything that has fallen through to this point must contain\n\t  // an invalid axis number.\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    errmsg = \"axis number must exceed 0\";\n\t    BEGIN(ERROR);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"invalid image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 255:\n#line 2170 \"wcsbth.l\"\ncase 256:\n#line 2171 \"wcsbth.l\"\ncase 257:\n#line 2172 \"wcsbth.l\"\ncase 258:\n#line 2173 \"wcsbth.l\"\ncase 259:\n#line 2174 \"wcsbth.l\"\ncase 260:\n#line 2175 \"wcsbth.l\"\ncase 261:\n#line 2176 \"wcsbth.l\"\ncase 262:\n#line 2177 \"wcsbth.l\"\ncase 263:\n#line 2178 \"wcsbth.l\"\ncase 264:\nYY_RULE_SETUP\n#line 2178 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg, \"%s keyword must use an underscore, not a dash\",\n\t      keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"invalid image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 265:\nYY_RULE_SETUP\n#line 2197 \"wcsbth.l\"\n{\n\t  // This covers the defunct forms CD00i00j and PC00i00j.\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    if (((altlin == 1) && (relax & WCSHDR_PC00i00j)) ||\n\t        ((altlin == 2) && (relax & WCSHDR_CD00i00j))) {\n\t      sscanf(yytext, \"%3d%3d\", &i, &j);\n\t      a = ' ';\n\t      keytype = IMGAXIS;\n\t      BEGIN(VALUE);\n\t\n\t    } else if (relax & WCSHDR_reject) {\n\t      errmsg = errtxt;\n\t      sprintf(errmsg,\n\t        \"this form of the %s keyword is deprecated, use %s\",\n\t        keyname, keyname);\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      // Pretend we don't recognize it.\n\t      BEGIN(DISCARD);\n\t    }\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"deprecated image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 266:\nYY_RULE_SETUP\n#line 2231 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 267:\n#line 2236 \"wcsbth.l\"\ncase 268:\n#line 2237 \"wcsbth.l\"\ncase 269:\nYY_RULE_SETUP\n#line 2237 \"wcsbth.l\"\n{\n\t  sscanf(yytext, \"%d%c\", &n, &a);\n\t  keytype = BIMGARR;\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 270:\n#line 2244 \"wcsbth.l\"\ncase 271:\n#line 2245 \"wcsbth.l\"\ncase 272:\n#line 2246 \"wcsbth.l\"\ncase 273:\n#line 2247 \"wcsbth.l\"\ncase 274:\n#line 2248 \"wcsbth.l\"\ncase 275:\nYY_RULE_SETUP\n#line 2248 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_LONGKEY) {\n\t    WCSBTH_PUTBACK;\n\t    BEGIN(TCn_ka);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg, \"%s keyword is non-standard\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 276:\nYY_RULE_SETUP\n#line 2264 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 277:\n#line 2269 \"wcsbth.l\"\ncase 278:\n#line 2270 \"wcsbth.l\"\ncase 279:\n#line 2271 \"wcsbth.l\"\ncase 280:\n#line 2272 \"wcsbth.l\"\ncase 281:\n#line 2273 \"wcsbth.l\"\ncase 282:\nYY_RULE_SETUP\n#line 2273 \"wcsbth.l\"\n{\n\t  sscanf(yytext, \"%d_%d%c\", &n, &k, &a);\n\t  i = wcsbth_colax(*wcs, &alts, n, a);\n\t  j = wcsbth_colax(*wcs, &alts, k, a);\n\t  keytype = PIXLIST;\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 283:\n#line 2282 \"wcsbth.l\"\ncase 284:\n#line 2283 \"wcsbth.l\"\ncase 285:\n#line 2284 \"wcsbth.l\"\ncase 286:\nYY_RULE_SETUP\n#line 2284 \"wcsbth.l\"\n{\n\t  sscanf(yytext, \"%d_%d\", &n, &k);\n\t  a = ' ';\n\t  i = wcsbth_colax(*wcs, &alts, n, a);\n\t  j = wcsbth_colax(*wcs, &alts, k, a);\n\t  keytype = PIXLIST;\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 287:\nYY_RULE_SETUP\n#line 2293 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 288:\n#line 2298 \"wcsbth.l\"\ncase 289:\n#line 2299 \"wcsbth.l\"\ncase 290:\nYY_RULE_SETUP\n#line 2299 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    a = ' ';\n\t    sscanf(yytext, \"%d%c\", &i, &a);\n\t\n\t    if (relax & WCSHDR_strict) {\n\t      errmsg = \"the CROTAn keyword is deprecated, use PCi_ja\";\n\t      BEGIN(ERROR);\n\t\n\t    } else if (a == ' ' || relax & WCSHDR_CROTAia) {\n\t      yyless(0);\n\t      BEGIN(CCCCCia);\n\t\n\t    } else if (relax & WCSHDR_reject) {\n\t      errmsg = \"CROTAn keyword may not have an alternate version code\";\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      // Pretend we don't recognize it.\n\t      BEGIN(DISCARD);\n\t    }\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"deprecated image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 291:\nYY_RULE_SETUP\n#line 2333 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    yyless(0);\n\t    BEGIN(CCCCCia);\n\t  } else {\n\t    // Let it go.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 292:\n#line 2344 \"wcsbth.l\"\ncase 293:\n#line 2345 \"wcsbth.l\"\ncase 294:\n#line 2346 \"wcsbth.l\"\ncase 295:\n#line 2347 \"wcsbth.l\"\ncase 296:\n#line 2348 \"wcsbth.l\"\ncase 297:\nYY_RULE_SETUP\n#line 2348 \"wcsbth.l\"\n{\n\t  WCSBTH_PUTBACK;\n\t  BEGIN((YY_START == iCROTn) ? iCCCna : TCCCna);\n\t}\n\tYY_BREAK\ncase 298:\n#line 2354 \"wcsbth.l\"\ncase 299:\n#line 2355 \"wcsbth.l\"\ncase 300:\n#line 2356 \"wcsbth.l\"\ncase 301:\nYY_RULE_SETUP\n#line 2356 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_CROTAia) {\n\t    WCSBTH_PUTBACK;\n\t    BEGIN((YY_START == iCROTn) ? iCCCna : TCCCna);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"%s keyword may not have an alternate version code\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 302:\n#line 2374 \"wcsbth.l\"\ncase 303:\nYY_RULE_SETUP\n#line 2374 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 304:\n#line 2379 \"wcsbth.l\"\ncase 305:\nYY_RULE_SETUP\n#line 2379 \"wcsbth.l\"\n{\n\t  // Image-header keyword.\n\t  if (imherit || (relax & (WCSHDR_AUXIMG | WCSHDR_ALLIMG))) {\n\t    if (YY_START == CCCCCCCa) {\n\t      sscanf(yytext, \"%c\", &a);\n\t    } else {\n\t      a = 0;\n\t      unput(yytext[0]);\n\t    }\n\t    keytype = IMGAUX;\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 306:\nYY_RULE_SETUP\n#line 2403 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_reject) {\n\t    // Looks too much like a FITS WCS keyword not to flag it.\n\t    errmsg = errtxt;\n\t    sprintf(errmsg, \"invalid alternate code, keyword resembles %s \"\n\t      \"but isn't\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 307:\n#line 2418 \"wcsbth.l\"\ncase 308:\n#line 2419 \"wcsbth.l\"\ncase 309:\n#line 2420 \"wcsbth.l\"\ncase 310:\n#line 2421 \"wcsbth.l\"\ncase 311:\nYY_RULE_SETUP\n#line 2421 \"wcsbth.l\"\n{\n\t  sscanf(yytext, \"%d%c\", &n, &a);\n\t  keytype = BINTAB;\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 312:\nYY_RULE_SETUP\n#line 2427 \"wcsbth.l\"\n{\n\t  sscanf(yytext, \"%d\", &n);\n\t  a = ' ';\n\t  keytype = BINTAB;\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 313:\n#line 2435 \"wcsbth.l\"\ncase 314:\nYY_RULE_SETUP\n#line 2435 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 315:\n#line 2440 \"wcsbth.l\"\ncase 316:\n#line 2441 \"wcsbth.l\"\ncase 317:\n#line 2442 \"wcsbth.l\"\ncase 318:\n#line 2443 \"wcsbth.l\"\ncase 319:\n#line 2444 \"wcsbth.l\"\ncase 320:\n#line 2445 \"wcsbth.l\"\ncase 321:\nYY_RULE_SETUP\n#line 2445 \"wcsbth.l\"\n{\n\t  sscanf(yytext, \"%d\", &n);\n\t  a = 0;\n\t  keytype = BINTAB;\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 322:\n#line 2453 \"wcsbth.l\"\ncase 323:\nYY_RULE_SETUP\n#line 2453 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 324:\n#line 2458 \"wcsbth.l\"\ncase 325:\n#line 2459 \"wcsbth.l\"\ncase 326:\n#line 2460 \"wcsbth.l\"\ncase 327:\nYY_RULE_SETUP\n#line 2460 \"wcsbth.l\"\n{\n\t  // Image-header keyword.\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    sscanf(yytext, \"%d_%d%c\", &i, &m, &a);\n\t    keytype = IMGAXIS;\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 328:\n#line 2480 \"wcsbth.l\"\ncase 329:\n#line 2481 \"wcsbth.l\"\ncase 330:\n#line 2482 \"wcsbth.l\"\ncase 331:\n#line 2483 \"wcsbth.l\"\ncase 332:\n#line 2484 \"wcsbth.l\"\ncase 333:\n#line 2485 \"wcsbth.l\"\ncase 334:\n#line 2486 \"wcsbth.l\"\ncase 335:\n#line 2487 \"wcsbth.l\"\ncase 336:\n#line 2488 \"wcsbth.l\"\ncase 337:\n#line 2489 \"wcsbth.l\"\ncase 338:\n#line 2490 \"wcsbth.l\"\ncase 339:\n#line 2491 \"wcsbth.l\"\ncase 340:\n#line 2492 \"wcsbth.l\"\ncase 341:\n#line 2493 \"wcsbth.l\"\ncase 342:\n#line 2494 \"wcsbth.l\"\ncase 343:\n#line 2495 \"wcsbth.l\"\ncase 344:\n#line 2496 \"wcsbth.l\"\ncase 345:\n#line 2497 \"wcsbth.l\"\ncase 346:\n#line 2498 \"wcsbth.l\"\ncase 347:\n#line 2499 \"wcsbth.l\"\ncase 348:\nYY_RULE_SETUP\n#line 2499 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    if (((valtype == FLOAT)  && (relax & WCSHDR_PV0i_0ma)) ||\n\t        ((valtype == STRING) && (relax & WCSHDR_PS0i_0ma))) {\n\t      sscanf(yytext, \"%d_%d%c\", &i, &m, &a);\n\t      keytype = IMGAXIS;\n\t      BEGIN(VALUE);\n\t\n\t    } else if (relax & WCSHDR_reject) {\n\t      errmsg = \"indices in parameterized keywords must not have \"\n\t               \"leading zeroes\";\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      // Pretend we don't recognize it.\n\t      BEGIN(DISCARD);\n\t    }\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"invalid image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 349:\n#line 2530 \"wcsbth.l\"\ncase 350:\n#line 2531 \"wcsbth.l\"\ncase 351:\n#line 2532 \"wcsbth.l\"\ncase 352:\n#line 2533 \"wcsbth.l\"\ncase 353:\n#line 2534 \"wcsbth.l\"\ncase 354:\n#line 2535 \"wcsbth.l\"\ncase 355:\n#line 2536 \"wcsbth.l\"\ncase 356:\n#line 2537 \"wcsbth.l\"\ncase 357:\n#line 2538 \"wcsbth.l\"\ncase 358:\nYY_RULE_SETUP\n#line 2538 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    // Anything that has fallen through to this point must contain\n\t    // an invalid parameter.\n\t    errmsg = \"axis number must exceed 0\";\n\t    BEGIN(ERROR);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg,\n\t      \"invalid image-header keyword %s in binary table\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 359:\n#line 2558 \"wcsbth.l\"\ncase 360:\n#line 2559 \"wcsbth.l\"\ncase 361:\n#line 2560 \"wcsbth.l\"\ncase 362:\n#line 2561 \"wcsbth.l\"\ncase 363:\n#line 2562 \"wcsbth.l\"\ncase 364:\n#line 2563 \"wcsbth.l\"\ncase 365:\n#line 2564 \"wcsbth.l\"\ncase 366:\n#line 2565 \"wcsbth.l\"\ncase 367:\n#line 2566 \"wcsbth.l\"\ncase 368:\nYY_RULE_SETUP\n#line 2566 \"wcsbth.l\"\n{\n\t  errmsg = errtxt;\n\t  sprintf(errmsg, \"%s keyword must use an underscore, not a dash\",\n\t    keyname);\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 369:\nYY_RULE_SETUP\n#line 2573 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 370:\n#line 2578 \"wcsbth.l\"\ncase 371:\n#line 2579 \"wcsbth.l\"\ncase 372:\n#line 2580 \"wcsbth.l\"\ncase 373:\n#line 2581 \"wcsbth.l\"\ncase 374:\n#line 2582 \"wcsbth.l\"\ncase 375:\n#line 2583 \"wcsbth.l\"\ncase 376:\n#line 2584 \"wcsbth.l\"\ncase 377:\n#line 2585 \"wcsbth.l\"\ncase 378:\n#line 2586 \"wcsbth.l\"\ncase 379:\n#line 2587 \"wcsbth.l\"\ncase 380:\n#line 2588 \"wcsbth.l\"\ncase 381:\nYY_RULE_SETUP\n#line 2588 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_LONGKEY) {\n\t    WCSBTH_PUTBACK;\n\t    BEGIN((YY_START == iCCn_ma) ? iCn_ma : TCn_ma);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = errtxt;\n\t    sprintf(errmsg, \"the %s keyword is non-standard\", keyname);\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 382:\n#line 2605 \"wcsbth.l\"\ncase 383:\nYY_RULE_SETUP\n#line 2605 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 384:\n#line 2610 \"wcsbth.l\"\ncase 385:\n#line 2611 \"wcsbth.l\"\ncase 386:\n#line 2612 \"wcsbth.l\"\ncase 387:\n#line 2613 \"wcsbth.l\"\ncase 388:\n#line 2614 \"wcsbth.l\"\ncase 389:\n#line 2615 \"wcsbth.l\"\ncase 390:\n#line 2616 \"wcsbth.l\"\ncase 391:\n#line 2617 \"wcsbth.l\"\ncase 392:\n#line 2618 \"wcsbth.l\"\ncase 393:\n#line 2619 \"wcsbth.l\"\ncase 394:\n#line 2620 \"wcsbth.l\"\ncase 395:\nYY_RULE_SETUP\n#line 2620 \"wcsbth.l\"\n{\n\t  sscanf(yytext, \"%d_%d%c\", &n, &m, &a);\n\t  if (YY_START == TCn_ma) i = wcsbth_colax(*wcs, &alts, n, a);\n\t  keytype = (YY_START == iCn_ma) ? BIMGARR : PIXLIST;\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 396:\n#line 2628 \"wcsbth.l\"\ncase 397:\n#line 2629 \"wcsbth.l\"\ncase 398:\n#line 2630 \"wcsbth.l\"\ncase 399:\n#line 2631 \"wcsbth.l\"\ncase 400:\n#line 2632 \"wcsbth.l\"\ncase 401:\n#line 2633 \"wcsbth.l\"\ncase 402:\n#line 2634 \"wcsbth.l\"\ncase 403:\nYY_RULE_SETUP\n#line 2634 \"wcsbth.l\"\n{\n\t  // Invalid combinations will be flagged by <VALUE>.\n\t  sscanf(yytext, \"%d_%d\", &n, &m);\n\t  a = ' ';\n\t  if (YY_START == TCn_ma) i = wcsbth_colax(*wcs, &alts, n, a);\n\t  keytype = (YY_START == iCn_ma) ? BIMGARR : PIXLIST;\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 404:\n#line 2644 \"wcsbth.l\"\ncase 405:\nYY_RULE_SETUP\n#line 2644 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 406:\nYY_RULE_SETUP\n#line 2648 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_PROJPn) {\n\t    sscanf(yytext, \"%d\", &m);\n\t    i = 0;\n\t    a = ' ';\n\t    keytype = IMGAXIS;\n\t    BEGIN(VALUE);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"the PROJPn keyword is deprecated, use PVi_ma\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    // Pretend we don't recognize it.\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 407:\n#line 2667 \"wcsbth.l\"\ncase 408:\nYY_RULE_SETUP\n#line 2667 \"wcsbth.l\"\n{\n\t  if (relax & (WCSHDR_PROJPn | WCSHDR_reject)) {\n\t    errmsg = \"invalid PROJPn keyword\";\n\t    BEGIN(ERROR);\n\t\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 409:\nYY_RULE_SETUP\n#line 2677 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 410:\nYY_RULE_SETUP\n#line 2681 \"wcsbth.l\"\n{\n\t  // Do checks on i, j, m, n, k.\n\t  if (!(keytype & keysel)) {\n\t    // Selection by keyword type.\n\t    BEGIN(DISCARD);\n\t\n\t  } else if (exclude[n] || exclude[k]) {\n\t    // One or other column is not selected.\n\t    if (k && (exclude[n] != exclude[k])) {\n\t      // For keywords such as TCn_ka, both columns must be excluded.\n\t      // User error, so return immediately.\n\t      return WCSHDRERR_BAD_COLUMN;\n\t\n\t    } else {\n\t      BEGIN(DISCARD);\n\t    }\n\t\n\t  } else if (i > 99 || j > 99 || m > 99 || n > 999 || k > 999) {\n\t    if (relax & WCSHDR_reject) {\n\t      errmsg = errtxt;\n\t      if (i > 99 || j > 99) {\n\t        sprintf(errmsg, \"axis number exceeds 99\");\n\t      } else if (m > 99) {\n\t        sprintf(errmsg, \"parameter number exceeds 99\");\n\t      } else if (n > 999 || k > 999) {\n\t        sprintf(errmsg, \"column number exceeds 999\");\n\t      }\n\t      BEGIN(ERROR);\n\t\n\t    } else {\n\t      // Pretend we don't recognize it.\n\t      BEGIN(DISCARD);\n\t    }\n\t\n\t  } else if (ipass == 2 && npass == 3 && (keytype & BINTAB)) {\n\t    // Skip keyvalues that won't be inherited.\n\t    BEGIN(FLUSH);\n\t\n\t  } else {\n\t    if (ipass == 3 && (keytype & IMGHEAD)) {\n\t      // IMGHEAD keytypes are always dealt with on the second pass.\n\t      // However, they must be re-parsed in order to report errors.\n\t      vptr = 0x0;\n\t    }\n\t\n\t    if (valtype == INTEGER) {\n\t      BEGIN(INTEGER_VAL);\n\t    } else if (valtype == FLOAT) {\n\t      BEGIN(FLOAT_VAL);\n\t    } else if (valtype == FLOAT2) {\n\t      BEGIN(FLOAT2_VAL);\n\t    } else if (valtype == STRING) {\n\t      BEGIN(STRING_VAL);\n\t    } else {\n\t      errmsg = errtxt;\n\t      sprintf(errmsg, \"internal parser ERROR, bad data type: %d\",\n\t        valtype);\n\t      BEGIN(ERROR);\n\t    }\n\t  }\n\t}\n\tYY_BREAK\ncase 411:\nYY_RULE_SETUP\n#line 2743 \"wcsbth.l\"\n{\n\t  errmsg = \"invalid KEYWORD = VALUE syntax\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 412:\nYY_RULE_SETUP\n#line 2748 \"wcsbth.l\"\n{\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    // Read the keyvalue.\n\t    sscanf(yytext, \"%d\", &inttmp);\n\t\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\tYY_BREAK\ncase 413:\nYY_RULE_SETUP\n#line 2760 \"wcsbth.l\"\n{\n\t  errmsg = \"an integer value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 414:\nYY_RULE_SETUP\n#line 2765 \"wcsbth.l\"\n{\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    // Read the keyvalue.\n\t    wcsutil_str2double(yytext, &dbltmp);\n\t\n\t    if (chekval && chekval(dbltmp)) {\n\t      errmsg = \"invalid keyvalue\";\n\t      BEGIN(ERROR);\n\t    } else {\n\t      BEGIN(COMMENT);\n\t    }\n\t  }\n\t}\n\tYY_BREAK\ncase 415:\nYY_RULE_SETUP\n#line 2782 \"wcsbth.l\"\n{\n\t  errmsg = \"a floating-point value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 416:\nYY_RULE_SETUP\n#line 2787 \"wcsbth.l\"\n{\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    // Read the keyvalue as integer and fractional parts.\n\t    wcsutil_str2double2(yytext, dbl2tmp);\n\t\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\tYY_BREAK\ncase 417:\nYY_RULE_SETUP\n#line 2799 \"wcsbth.l\"\n{\n\t  errmsg = \"a floating-point value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 418:\n/* rule 418 can match eol */\nYY_RULE_SETUP\n#line 2804 \"wcsbth.l\"\n{\n\t  if (ipass == 1) {\n\t    BEGIN(COMMENT);\n\t\n\t  } else {\n\t    // Read the keyvalue.\n\t    strcpy(strtmp, yytext+1);\n\t\n\t    // Squeeze out repeated quotes.\n\t    int ix = 0;\n\t    for (int jx = 0; jx < 72; jx++) {\n\t      if (ix < jx) {\n\t        strtmp[ix] = strtmp[jx];\n\t      }\n\t\n\t      if (strtmp[jx] == '\\0') {\n\t        if (ix) strtmp[ix-1] = '\\0';\n\t        break;\n\t      } else if (strtmp[jx] == '\\'' && strtmp[jx+1] == '\\'') {\n\t        jx++;\n\t      }\n\t\n\t      ix++;\n\t    }\n\t\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\tYY_BREAK\ncase 419:\nYY_RULE_SETUP\n#line 2833 \"wcsbth.l\"\n{\n\t  errmsg = \"a string value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 420:\n*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */\nyyg->yy_c_buf_p = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up yytext again */\nYY_RULE_SETUP\n#line 2838 \"wcsbth.l\"\n{\n\t  if (ipass == 1) {\n\t    // Do first-pass bookkeeping.\n\t    wcsbth_pass1(keytype, i, j, n, k, a, ptype, &alts);\n\t    BEGIN(FLUSH);\n\t\n\t  } else if (*wcs) {\n\t    // Store the value now that the keyrecord has been validated.\n\t    alts.icol = 0;\n\t    alts.ialt = 0;\n\t\n\t    // Update each coordinate representation.\n\t    int gotone = 0;\n\t    struct wcsprm *wcsp;\n\t    while ((wcsp = wcsbth_idx(*wcs, &alts, keytype, n, a))) {\n\t      gotone = 1;\n\t\n\t      if (vptr) {\n\t        void *wptr;\n\t        if (auxprm) {\n\t          // Additional auxiliary parameter.\n\t          auxp = wcsp->aux;\n\t          ptrdiff_t voff = (char *)vptr - (char *)(&auxtem);\n\t          wptr = (void *)((char *)auxp + voff);\n\t        } else {\n\t          // A parameter that lives directly in wcsprm.\n\t          ptrdiff_t voff = (char *)vptr - (char *)(&wcstem);\n\t          wptr = (void *)((char *)wcsp + voff);\n\t        }\n\t\n\t        if (valtype == INTEGER) {\n\t          *((int *)wptr) = inttmp;\n\t\n\t        } else if (valtype == FLOAT) {\n\t          // Apply keyword parameterization.\n\t          if (ptype == 'v') {\n\t            int ipx = (wcsp->npv)++;\n\t            wcsp->pv[ipx].i = i;\n\t            wcsp->pv[ipx].m = m;\n\t            wptr = &(wcsp->pv[ipx].value);\n\t\n\t          } else if (j) {\n\t            wptr = *((double **)wptr) + (i - 1)*(wcsp->naxis)\n\t                                      + (j - 1);\n\t\n\t          } else if (i) {\n\t            wptr = *((double **)wptr) + (i - 1);\n\t          }\n\t\n\t          if (special) {\n\t            special(wptr, &dbltmp);\n\t          } else {\n\t            *((double *)wptr) = dbltmp;\n\t          }\n\t\n\t          // Flag the presence of PCi_ja, or CDi_ja and/or CROTAia.\n\t          if (altlin) {\n\t            wcsp->altlin |= altlin;\n\t            altlin = 0;\n\t          }\n\t\n\t          } else if (valtype == FLOAT2) {\n\t            // Split MJDREF and JDREF into integer and fraction.\n\t            if (special) {\n\t              special(wptr, dbl2tmp);\n\t            } else {\n\t              *((double *)wptr) = dbl2tmp[0];\n\t              *((double *)wptr + 1) = dbl2tmp[1];\n\t            }\n\t\n\t        } else if (valtype == STRING) {\n\t          // Apply keyword parameterization.\n\t          if (ptype == 's') {\n\t            int ipx = wcsp->nps++;\n\t            wcsp->ps[ipx].i = i;\n\t            wcsp->ps[ipx].m = m;\n\t            wptr = wcsp->ps[ipx].value;\n\t\n\t          } else if (j) {\n\t            wptr = *((char (**)[72])wptr) +\n\t                    (i - 1)*(wcsp->naxis) + (j - 1);\n\t\n\t          } else if (i) {\n\t            wptr = *((char (**)[72])wptr) + (i - 1);\n\t          }\n\t\n\t          char *cptr = (char *)wptr;\n\t          strcpy(cptr, strtmp);\n\t        }\n\t      }\n\t    }\n\t\n\t    if (ipass == npass) {\n\t      if (gotone) {\n\t        nvalid++;\n\t        if (ctrl == 4) {\n\t          wcsfprintf(stderr,\n\t            \"%.80s\\n  Accepted (%d) as a valid WCS keyrecord.\\n\",\n\t            keyrec, nvalid);\n\t        }\n\t\n\t        BEGIN(FLUSH);\n\t\n\t      } else {\n\t        errmsg = \"syntactically valid WCS keyrecord has no effect\";\n\t        BEGIN(ERROR);\n\t      }\n\t\n\t    } else {\n\t      BEGIN(FLUSH);\n\t    }\n\t\n\t  } else {\n\t    BEGIN(FLUSH);\n\t  }\n\t}\n\tYY_BREAK\ncase 421:\n*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */\nyyg->yy_c_buf_p = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up yytext again */\nYY_RULE_SETUP\n#line 2955 \"wcsbth.l\"\n{\n\t  errmsg = \"invalid keyvalue\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 422:\n*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */\nyyg->yy_c_buf_p = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up yytext again */\nYY_RULE_SETUP\n#line 2960 \"wcsbth.l\"\n{\n\t  errmsg = \"invalid keyvalue\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 423:\n*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */\nyyg->yy_c_buf_p = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up yytext again */\nYY_RULE_SETUP\n#line 2965 \"wcsbth.l\"\n{\n\t  errmsg = \"invalid keyvalue or malformed keycomment\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 424:\n*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */\nyyg->yy_c_buf_p = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up yytext again */\nYY_RULE_SETUP\n#line 2970 \"wcsbth.l\"\n{\n\t  errmsg = \"malformed keycomment\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 425:\n*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */\nyyg->yy_c_buf_p = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up yytext again */\nYY_RULE_SETUP\n#line 2975 \"wcsbth.l\"\n{\n\t  if (ipass == npass) {\n\t    if (ctrl < 0) {\n\t      // Preserve discards.\n\t      keep = keyrec;\n\t\n\t    } else if (2 < ctrl) {\n\t      nother++;\n\t      wcsfprintf(stderr, \"%.80s\\n  Not a recognized WCS keyword.\\n\",\n\t        keyrec);\n\t    }\n\t  }\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 426:\n*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */\nyyg->yy_c_buf_p = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up yytext again */\nYY_RULE_SETUP\n#line 2990 \"wcsbth.l\"\n{\n\t  if (ipass == npass) {\n\t    (*nreject)++;\n\t\n\t    if (ctrl%10 == -1) {\n\t      keep = keyrec;\n\t    }\n\t\n\t    if (1 < abs(ctrl%10)) {\n\t      wcsfprintf(stderr, \"%.80s\\n  Rejected (%d), %s.\\n\",\n\t        keyrec, *nreject, errmsg);\n\t    }\n\t  }\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 427:\n/* rule 427 can match eol */\nYY_RULE_SETUP\n#line 3006 \"wcsbth.l\"\n{\n\t  if (ipass == npass && keep) {\n\t    if (hptr < keep) {\n\t      strncpy(hptr, keep, 80);\n\t    }\n\t    hptr += 80;\n\t  }\n\t\n\t  naux += auxprm;\n\t  auxprm = 0;\n\t\n\t  // Throw away the rest of the line and reset for the next one.\n\t  i = j = 0;\n\t  n = k = 0;\n\t  m = 0;\n\t  a = ' ';\n\t\n\t  keyrec += 80;\n\t\n\t  keytype =  0;\n\t  valtype = -1;\n\t  vptr    = 0x0;\n\t  keep    = 0x0;\n\t\n\t  altlin  = 0;\n\t  ptype   = ' ';\n\t  chekval = 0x0;\n\t  special = 0x0;\n\t\n\t  BEGIN(INITIAL);\n\t}\n\tYY_BREAK\ncase YY_STATE_EOF(INITIAL):\ncase YY_STATE_EOF(CCCCCia):\ncase YY_STATE_EOF(iCCCna):\ncase YY_STATE_EOF(iCCCCn):\ncase YY_STATE_EOF(TCCCna):\ncase YY_STATE_EOF(TCCCCn):\ncase YY_STATE_EOF(CCi_ja):\ncase YY_STATE_EOF(ijCCna):\ncase YY_STATE_EOF(TCn_ka):\ncase YY_STATE_EOF(TCCn_ka):\ncase YY_STATE_EOF(CROTAi):\ncase YY_STATE_EOF(iCROTn):\ncase YY_STATE_EOF(TCROTn):\ncase YY_STATE_EOF(CCi_ma):\ncase YY_STATE_EOF(iCn_ma):\ncase YY_STATE_EOF(iCCn_ma):\ncase YY_STATE_EOF(TCn_ma):\ncase YY_STATE_EOF(TCCn_ma):\ncase YY_STATE_EOF(PROJPm):\ncase YY_STATE_EOF(CCCCCCCC):\ncase YY_STATE_EOF(CCCCCCCa):\ncase YY_STATE_EOF(CCCCna):\ncase YY_STATE_EOF(CCCCCna):\ncase YY_STATE_EOF(CCCCn):\ncase YY_STATE_EOF(CCCCCn):\ncase YY_STATE_EOF(VALUE):\ncase YY_STATE_EOF(INTEGER_VAL):\ncase YY_STATE_EOF(FLOAT_VAL):\ncase YY_STATE_EOF(FLOAT2_VAL):\ncase YY_STATE_EOF(STRING_VAL):\ncase YY_STATE_EOF(COMMENT):\ncase YY_STATE_EOF(DISCARD):\ncase YY_STATE_EOF(ERROR):\ncase YY_STATE_EOF(FLUSH):\n#line 3038 \"wcsbth.l\"\n{\n\t  // End-of-input.\n\t  if (ipass == 1) {\n\t    int status;\n\t    if ((status = wcsbth_init1(&alts, naux, nwcs, wcs)) ||\n\t        (*nwcs == 0 && ctrl == 0)) {\n\t      return status;\n\t    }\n\t\n\t    if (2 < abs(ctrl%10)) {\n\t      if (*nwcs == 1) {\n\t        if (strcmp(wcs[0]->wcsname, \"DEFAULTS\") != 0) {\n\t          wcsfprintf(stderr, \"Found one coordinate representation.\\n\");\n\t        }\n\t      } else {\n\t        wcsfprintf(stderr, \"Found %d coordinate representations.\\n\",\n\t          *nwcs);\n\t      }\n\t    }\n\t\n\t    if (alts.imgherit) npass = 3;\n\t  }\n\t\n\t  if (ipass++ < npass) {\n\t    yyextra->hdr = header;\n\t    yyextra->nkeyrec = nkeyrec;\n\t    keyrec = header;\n\t    *nreject = 0;\n\t\n\t    imherit = 1;\n\t\n\t    i = j = 0;\n\t    k = n = 0;\n\t    m = 0;\n\t    a = ' ';\n\t\n\t    keytype =  0;\n\t    valtype = -1;\n\t    vptr    = 0x0;\n\t\n\t    altlin = 0;\n\t    ptype  = ' ';\n\t    chekval = 0x0;\n\t    special = 0x0;\n\t\n\t    yyrestart(yyin, yyscanner);\n\t\n\t  } else {\n\t\n\t    if (ctrl < 0) {\n\t      *hptr = '\\0';\n\t    } else if (ctrl == 1) {\n\t      wcsfprintf(stderr, \"%d WCS keyrecord%s rejected.\\n\",\n\t        *nreject, (*nreject==1)?\" was\":\"s were\");\n\t    } else if (ctrl == 4) {\n\t      wcsfprintf(stderr, \"\\n\");\n\t      wcsfprintf(stderr, \"%5d keyrecord%s rejected for syntax or \"\n\t        \"other errors,\\n\", *nreject, (*nreject==1)?\" was\":\"s were\");\n\t      wcsfprintf(stderr, \"%5d %s recognized as syntactically valid, \"\n\t        \"and\\n\", nvalid, (nvalid==1)?\"was\":\"were\");\n\t      wcsfprintf(stderr, \"%5d other%s were not recognized as WCS \"\n\t        \"keyrecords.\\n\", nother, (nother==1)?\"\":\"s\");\n\t    }\n\t\n\t    return wcsbth_final(&alts, nwcs, wcs);\n\t  }\n\t}\n\tYY_BREAK\ncase 428:\nYY_RULE_SETUP\n#line 3106 \"wcsbth.l\"\nECHO;\n\tYY_BREAK\n#line 29652 \"wcsbth.c\"\n\n\tcase YY_END_OF_BUFFER:\n\t\t{\n\t\t/* Amount of text matched not including the EOB char. */\n\t\tint yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;\n\n\t\t/* Undo the effects of YY_DO_BEFORE_ACTION. */\n\t\t*yy_cp = yyg->yy_hold_char;\n\t\tYY_RESTORE_YY_MORE_OFFSET\n\n\t\tif ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )\n\t\t\t{\n\t\t\t/* We're scanning a new file or input source.  It's\n\t\t\t * possible that this happened because the user\n\t\t\t * just pointed yyin at a new source and called\n\t\t\t * yylex().  If so, then we have to assure\n\t\t\t * consistency between YY_CURRENT_BUFFER and our\n\t\t\t * globals.  Here is the right place to do so, because\n\t\t\t * this is the first action (other than possibly a\n\t\t\t * back-up) that will match for the new input source.\n\t\t\t */\n\t\t\tyyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;\n\t\t\t}\n\n\t\t/* Note that here we test for yy_c_buf_p \"<=\" to the position\n\t\t * of the first EOB in the buffer, since yy_c_buf_p will\n\t\t * already have been incremented past the NUL character\n\t\t * (since all states make transitions on EOB to the\n\t\t * end-of-buffer state).  Contrast this with the test\n\t\t * in input().\n\t\t */\n\t\tif ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )\n\t\t\t{ /* This was really a NUL. */\n\t\t\tyy_state_type yy_next_state;\n\n\t\t\tyyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;\n\n\t\t\tyy_current_state = yy_get_previous_state( yyscanner );\n\n\t\t\t/* Okay, we're now positioned to make the NUL\n\t\t\t * transition.  We couldn't have\n\t\t\t * yy_get_previous_state() go ahead and do it\n\t\t\t * for us because it doesn't know how to deal\n\t\t\t * with the possibility of jamming (and we don't\n\t\t\t * want to build jamming into it because then it\n\t\t\t * will run more slowly).\n\t\t\t */\n\n\t\t\tyy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);\n\n\t\t\tyy_bp = yyg->yytext_ptr + YY_MORE_ADJ;\n\n\t\t\tif ( yy_next_state )\n\t\t\t\t{\n\t\t\t\t/* Consume the NUL. */\n\t\t\t\tyy_cp = ++yyg->yy_c_buf_p;\n\t\t\t\tyy_current_state = yy_next_state;\n\t\t\t\tgoto yy_match;\n\t\t\t\t}\n\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tyy_cp = yyg->yy_c_buf_p;\n\t\t\t\tgoto yy_find_action;\n\t\t\t\t}\n\t\t\t}\n\n\t\telse switch ( yy_get_next_buffer( yyscanner ) )\n\t\t\t{\n\t\t\tcase EOB_ACT_END_OF_FILE:\n\t\t\t\t{\n\t\t\t\tyyg->yy_did_buffer_switch_on_eof = 0;\n\n\t\t\t\tif ( yywrap( yyscanner ) )\n\t\t\t\t\t{\n\t\t\t\t\t/* Note: because we've taken care in\n\t\t\t\t\t * yy_get_next_buffer() to have set up\n\t\t\t\t\t * yytext, we can now set up\n\t\t\t\t\t * yy_c_buf_p so that if some total\n\t\t\t\t\t * hoser (like flex itself) wants to\n\t\t\t\t\t * call the scanner after we return the\n\t\t\t\t\t * YY_NULL, it'll still work - another\n\t\t\t\t\t * YY_NULL will get returned.\n\t\t\t\t\t */\n\t\t\t\t\tyyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;\n\n\t\t\t\t\tyy_act = YY_STATE_EOF(YY_START);\n\t\t\t\t\tgoto do_action;\n\t\t\t\t\t}\n\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\tif ( ! yyg->yy_did_buffer_switch_on_eof )\n\t\t\t\t\t\tYY_NEW_FILE;\n\t\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\tcase EOB_ACT_CONTINUE_SCAN:\n\t\t\t\tyyg->yy_c_buf_p =\n\t\t\t\t\tyyg->yytext_ptr + yy_amount_of_matched_text;\n\n\t\t\t\tyy_current_state = yy_get_previous_state( yyscanner );\n\n\t\t\t\tyy_cp = yyg->yy_c_buf_p;\n\t\t\t\tyy_bp = yyg->yytext_ptr + YY_MORE_ADJ;\n\t\t\t\tgoto yy_match;\n\n\t\t\tcase EOB_ACT_LAST_MATCH:\n\t\t\t\tyyg->yy_c_buf_p =\n\t\t\t\t&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];\n\n\t\t\t\tyy_current_state = yy_get_previous_state( yyscanner );\n\n\t\t\t\tyy_cp = yyg->yy_c_buf_p;\n\t\t\t\tyy_bp = yyg->yytext_ptr + YY_MORE_ADJ;\n\t\t\t\tgoto yy_find_action;\n\t\t\t}\n\t\tbreak;\n\t\t}\n\n\tdefault:\n\t\tYY_FATAL_ERROR(\n\t\t\t\"fatal flex scanner internal error--no action found\" );\n\t} /* end of action switch */\n\t\t} /* end of scanning one token */\n\t} /* end of user's declarations */\n} /* end of yylex */\n\n/* yy_get_next_buffer - try to read in a new buffer\n *\n * Returns a code representing an action:\n *\tEOB_ACT_LAST_MATCH -\n *\tEOB_ACT_CONTINUE_SCAN - continue scanning from current position\n *\tEOB_ACT_END_OF_FILE - end of file\n */\nstatic int yy_get_next_buffer (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tchar *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;\n\tchar *source = yyg->yytext_ptr;\n\tint number_to_move, i;\n\tint ret_val;\n\n\tif ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )\n\t\tYY_FATAL_ERROR(\n\t\t\"fatal flex scanner internal error--end of buffer missed\" );\n\n\tif ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )\n\t\t{ /* Don't try to fill the buffer, so this is an EOF. */\n\t\tif ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )\n\t\t\t{\n\t\t\t/* We matched a single character, the EOB, so\n\t\t\t * treat this as a final EOF.\n\t\t\t */\n\t\t\treturn EOB_ACT_END_OF_FILE;\n\t\t\t}\n\n\t\telse\n\t\t\t{\n\t\t\t/* We matched some text prior to the EOB, first\n\t\t\t * process it.\n\t\t\t */\n\t\t\treturn EOB_ACT_LAST_MATCH;\n\t\t\t}\n\t\t}\n\n\t/* Try to read more data. */\n\n\t/* First move last chars to start of buffer. */\n\tnumber_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);\n\n\tfor ( i = 0; i < number_to_move; ++i )\n\t\t*(dest++) = *(source++);\n\n\tif ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )\n\t\t/* don't do the read, it's not guaranteed to return an EOF,\n\t\t * just force an EOF\n\t\t */\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;\n\n\telse\n\t\t{\n\t\t\tint num_to_read =\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;\n\n\t\twhile ( num_to_read <= 0 )\n\t\t\t{ /* Not enough room in the buffer - grow it. */\n\n\t\t\t/* just a shorter name for the current buffer */\n\t\t\tYY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;\n\n\t\t\tint yy_c_buf_p_offset =\n\t\t\t\t(int) (yyg->yy_c_buf_p - b->yy_ch_buf);\n\n\t\t\tif ( b->yy_is_our_buffer )\n\t\t\t\t{\n\t\t\t\tint new_size = b->yy_buf_size * 2;\n\n\t\t\t\tif ( new_size <= 0 )\n\t\t\t\t\tb->yy_buf_size += b->yy_buf_size / 8;\n\t\t\t\telse\n\t\t\t\t\tb->yy_buf_size *= 2;\n\n\t\t\t\tb->yy_ch_buf = (char *)\n\t\t\t\t\t/* Include room in for 2 EOB chars. */\n\t\t\t\t\tyyrealloc( (void *) b->yy_ch_buf,\n\t\t\t\t\t\t\t (yy_size_t) (b->yy_buf_size + 2) , yyscanner );\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t/* Can't grow it, we don't own it. */\n\t\t\t\tb->yy_ch_buf = NULL;\n\n\t\t\tif ( ! b->yy_ch_buf )\n\t\t\t\tYY_FATAL_ERROR(\n\t\t\t\t\"fatal error - scanner input buffer overflow\" );\n\n\t\t\tyyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];\n\n\t\t\tnum_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -\n\t\t\t\t\t\tnumber_to_move - 1;\n\n\t\t\t}\n\n\t\tif ( num_to_read > YY_READ_BUF_SIZE )\n\t\t\tnum_to_read = YY_READ_BUF_SIZE;\n\n\t\t/* Read in more data. */\n\t\tYY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),\n\t\t\tyyg->yy_n_chars, num_to_read );\n\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;\n\t\t}\n\n\tif ( yyg->yy_n_chars == 0 )\n\t\t{\n\t\tif ( number_to_move == YY_MORE_ADJ )\n\t\t\t{\n\t\t\tret_val = EOB_ACT_END_OF_FILE;\n\t\t\tyyrestart( yyin  , yyscanner);\n\t\t\t}\n\n\t\telse\n\t\t\t{\n\t\t\tret_val = EOB_ACT_LAST_MATCH;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buffer_status =\n\t\t\t\tYY_BUFFER_EOF_PENDING;\n\t\t\t}\n\t\t}\n\n\telse\n\t\tret_val = EOB_ACT_CONTINUE_SCAN;\n\n\tif ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {\n\t\t/* Extend the array by 50%, plus the number we really need. */\n\t\tint new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(\n\t\t\t(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );\n\t\tif ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_get_next_buffer()\" );\n\t\t/* \"- 2\" to take care of EOB's */\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);\n\t}\n\n\tyyg->yy_n_chars += number_to_move;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;\n\n\tyyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];\n\n\treturn ret_val;\n}\n\n/* yy_get_previous_state - get the state just before the EOB char was reached */\n\n    static yy_state_type yy_get_previous_state (yyscan_t yyscanner)\n{\n\tyy_state_type yy_current_state;\n\tchar *yy_cp;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tyy_current_state = yyg->yy_start;\n\tyy_current_state += YY_AT_BOL();\n\n\tfor ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )\n\t\t{\n\t\tif ( *yy_cp )\n\t\t\t{\n\t\t\tyy_current_state = yy_nxt[yy_current_state][YY_SC_TO_UI(*yy_cp)];\n\t\t\t}\n\t\telse\n\t\t\tyy_current_state = yy_NUL_trans[yy_current_state];\n\t\tif ( yy_accept[yy_current_state] )\n\t\t\t{\n\t\t\tyyg->yy_last_accepting_state = yy_current_state;\n\t\t\tyyg->yy_last_accepting_cpos = yy_cp;\n\t\t\t}\n\t\t}\n\n\treturn yy_current_state;\n}\n\n/* yy_try_NUL_trans - try to make a transition on the NUL character\n *\n * synopsis\n *\tnext_state = yy_try_NUL_trans( current_state );\n */\n    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)\n{\n\tint yy_is_jam;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */\n\tchar *yy_cp = yyg->yy_c_buf_p;\n\n\tyy_current_state = yy_NUL_trans[yy_current_state];\n\tyy_is_jam = (yy_current_state == 0);\n\n\tif ( ! yy_is_jam )\n\t\t{\n\t\tif ( yy_accept[yy_current_state] )\n\t\t\t{\n\t\t\tyyg->yy_last_accepting_state = yy_current_state;\n\t\t\tyyg->yy_last_accepting_cpos = yy_cp;\n\t\t\t}\n\t\t}\n\n\t(void)yyg;\n\treturn yy_is_jam ? 0 : yy_current_state;\n}\n\n#ifndef YY_NO_UNPUT\n\n    static void yyunput (int c, char * yy_bp , yyscan_t yyscanner)\n{\n\tchar *yy_cp;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n    yy_cp = yyg->yy_c_buf_p;\n\n\t/* undo effects of setting up yytext */\n\t*yy_cp = yyg->yy_hold_char;\n\n\tif ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )\n\t\t{ /* need to shift things up to make room */\n\t\t/* +2 for EOB chars. */\n\t\tint number_to_move = yyg->yy_n_chars + 2;\n\t\tchar *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[\n\t\t\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];\n\t\tchar *source =\n\t\t\t\t&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];\n\n\t\twhile ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )\n\t\t\t*--dest = *--source;\n\n\t\tyy_cp += (int) (dest - source);\n\t\tyy_bp += (int) (dest - source);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars =\n\t\t\tyyg->yy_n_chars = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;\n\n\t\tif ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )\n\t\t\tYY_FATAL_ERROR( \"flex scanner push-back overflow\" );\n\t\t}\n\n\t*--yy_cp = (char) c;\n\n\tyyg->yytext_ptr = yy_bp;\n\tyyg->yy_hold_char = *yy_cp;\n\tyyg->yy_c_buf_p = yy_cp;\n}\n\n#endif\n\n#ifndef YY_NO_INPUT\n#ifdef __cplusplus\n    static int yyinput (yyscan_t yyscanner)\n#else\n    static int input  (yyscan_t yyscanner)\n#endif\n\n{\n\tint c;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\t*yyg->yy_c_buf_p = yyg->yy_hold_char;\n\n\tif ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )\n\t\t{\n\t\t/* yy_c_buf_p now points to the character we want to return.\n\t\t * If this occurs *before* the EOB characters, then it's a\n\t\t * valid NUL; if not, then we've hit the end of the buffer.\n\t\t */\n\t\tif ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )\n\t\t\t/* This was really a NUL. */\n\t\t\t*yyg->yy_c_buf_p = '\\0';\n\n\t\telse\n\t\t\t{ /* need more input */\n\t\t\tint offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);\n\t\t\t++yyg->yy_c_buf_p;\n\n\t\t\tswitch ( yy_get_next_buffer( yyscanner ) )\n\t\t\t\t{\n\t\t\t\tcase EOB_ACT_LAST_MATCH:\n\t\t\t\t\t/* This happens because yy_g_n_b()\n\t\t\t\t\t * sees that we've accumulated a\n\t\t\t\t\t * token and flags that we need to\n\t\t\t\t\t * try matching the token before\n\t\t\t\t\t * proceeding.  But for input(),\n\t\t\t\t\t * there's no matching to consider.\n\t\t\t\t\t * So convert the EOB_ACT_LAST_MATCH\n\t\t\t\t\t * to EOB_ACT_END_OF_FILE.\n\t\t\t\t\t */\n\n\t\t\t\t\t/* Reset buffer status. */\n\t\t\t\t\tyyrestart( yyin , yyscanner);\n\n\t\t\t\t\t/*FALLTHROUGH*/\n\n\t\t\t\tcase EOB_ACT_END_OF_FILE:\n\t\t\t\t\t{\n\t\t\t\t\tif ( yywrap( yyscanner ) )\n\t\t\t\t\t\treturn 0;\n\n\t\t\t\t\tif ( ! yyg->yy_did_buffer_switch_on_eof )\n\t\t\t\t\t\tYY_NEW_FILE;\n#ifdef __cplusplus\n\t\t\t\t\treturn yyinput(yyscanner);\n#else\n\t\t\t\t\treturn input(yyscanner);\n#endif\n\t\t\t\t\t}\n\n\t\t\t\tcase EOB_ACT_CONTINUE_SCAN:\n\t\t\t\t\tyyg->yy_c_buf_p = yyg->yytext_ptr + offset;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tc = *(unsigned char *) yyg->yy_c_buf_p;\t/* cast for 8-bit char's */\n\t*yyg->yy_c_buf_p = '\\0';\t/* preserve yytext */\n\tyyg->yy_hold_char = *++yyg->yy_c_buf_p;\n\n\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\\n');\n\n\treturn c;\n}\n#endif\t/* ifndef YY_NO_INPUT */\n\n/** Immediately switch to a different input stream.\n * @param input_file A readable stream.\n * @param yyscanner The scanner object.\n * @note This function does not reset the start condition to @c INITIAL .\n */\n    void yyrestart  (FILE * input_file , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif ( ! YY_CURRENT_BUFFER ){\n        yyensure_buffer_stack (yyscanner);\n\t\tYY_CURRENT_BUFFER_LVALUE =\n            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);\n\t}\n\n\tyy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);\n\tyy_load_buffer_state( yyscanner );\n}\n\n/** Switch to a different input buffer.\n * @param new_buffer The new input buffer.\n * @param yyscanner The scanner object.\n */\n    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\t/* TODO. We should be able to replace this entire function body\n\t * with\n\t *\t\tyypop_buffer_state();\n\t *\t\tyypush_buffer_state(new_buffer);\n     */\n\tyyensure_buffer_stack (yyscanner);\n\tif ( YY_CURRENT_BUFFER == new_buffer )\n\t\treturn;\n\n\tif ( YY_CURRENT_BUFFER )\n\t\t{\n\t\t/* Flush out information for old buffer. */\n\t\t*yyg->yy_c_buf_p = yyg->yy_hold_char;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;\n\t\t}\n\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\tyy_load_buffer_state( yyscanner );\n\n\t/* We don't actually know whether we did this switch during\n\t * EOF (yywrap()) processing, but the only time this flag\n\t * is looked at is after yywrap() is called, so it's safe\n\t * to go ahead and always set it.\n\t */\n\tyyg->yy_did_buffer_switch_on_eof = 1;\n}\n\nstatic void yy_load_buffer_state  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tyyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\tyyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;\n\tyyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;\n\tyyg->yy_hold_char = *yyg->yy_c_buf_p;\n}\n\n/** Allocate and initialize an input buffer state.\n * @param file A readable stream.\n * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.\n * @param yyscanner The scanner object.\n * @return the allocated buffer state.\n */\n    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)\n{\n\tYY_BUFFER_STATE b;\n    \n\tb = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );\n\n\tb->yy_buf_size = size;\n\n\t/* yy_ch_buf has to be 2 characters longer than the size given because\n\t * we need to put in 2 end-of-buffer characters.\n\t */\n\tb->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );\n\tif ( ! b->yy_ch_buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );\n\n\tb->yy_is_our_buffer = 1;\n\n\tyy_init_buffer( b, file , yyscanner);\n\n\treturn b;\n}\n\n/** Destroy the buffer.\n * @param b a buffer created with yy_create_buffer()\n * @param yyscanner The scanner object.\n */\n    void yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif ( ! b )\n\t\treturn;\n\n\tif ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */\n\t\tYY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;\n\n\tif ( b->yy_is_our_buffer )\n\t\tyyfree( (void *) b->yy_ch_buf , yyscanner );\n\n\tyyfree( (void *) b , yyscanner );\n}\n\n/* Initializes or reinitializes a buffer.\n * This function is sometimes called more than once on the same buffer,\n * such as during a yyrestart() or at EOF.\n */\n    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)\n\n{\n\tint oerrno = errno;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tyy_flush_buffer( b , yyscanner);\n\n\tb->yy_input_file = file;\n\tb->yy_fill_buffer = 1;\n\n    /* If b is the current buffer, then yy_init_buffer was _probably_\n     * called from yyrestart() or through yy_get_next_buffer.\n     * In that case, we don't want to reset the lineno or column.\n     */\n    if (b != YY_CURRENT_BUFFER){\n        b->yy_bs_lineno = 1;\n        b->yy_bs_column = 0;\n    }\n\n        b->yy_is_interactive = 0;\n    \n\terrno = oerrno;\n}\n\n/** Discard all buffered characters. On the next scan, YY_INPUT will be called.\n * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.\n * @param yyscanner The scanner object.\n */\n    void yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tif ( ! b )\n\t\treturn;\n\n\tb->yy_n_chars = 0;\n\n\t/* We always need two end-of-buffer characters.  The first causes\n\t * a transition to the end-of-buffer state.  The second causes\n\t * a jam in that state.\n\t */\n\tb->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;\n\tb->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;\n\n\tb->yy_buf_pos = &b->yy_ch_buf[0];\n\n\tb->yy_at_bol = 1;\n\tb->yy_buffer_status = YY_BUFFER_NEW;\n\n\tif ( b == YY_CURRENT_BUFFER )\n\t\tyy_load_buffer_state( yyscanner );\n}\n\n/** Pushes the new state onto the stack. The new state becomes\n *  the current state. This function will allocate the stack\n *  if necessary.\n *  @param new_buffer The new state.\n *  @param yyscanner The scanner object.\n */\nvoid yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tif (new_buffer == NULL)\n\t\treturn;\n\n\tyyensure_buffer_stack(yyscanner);\n\n\t/* This block is copied from yy_switch_to_buffer. */\n\tif ( YY_CURRENT_BUFFER )\n\t\t{\n\t\t/* Flush out information for old buffer. */\n\t\t*yyg->yy_c_buf_p = yyg->yy_hold_char;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;\n\t\t}\n\n\t/* Only push if top exists. Otherwise, replace top. */\n\tif (YY_CURRENT_BUFFER)\n\t\tyyg->yy_buffer_stack_top++;\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\n\t/* copied from yy_switch_to_buffer. */\n\tyy_load_buffer_state( yyscanner );\n\tyyg->yy_did_buffer_switch_on_eof = 1;\n}\n\n/** Removes and deletes the top of the stack, if present.\n *  The next element becomes the new top.\n *  @param yyscanner The scanner object.\n */\nvoid yypop_buffer_state (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tif (!YY_CURRENT_BUFFER)\n\t\treturn;\n\n\tyy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);\n\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\tif (yyg->yy_buffer_stack_top > 0)\n\t\t--yyg->yy_buffer_stack_top;\n\n\tif (YY_CURRENT_BUFFER) {\n\t\tyy_load_buffer_state( yyscanner );\n\t\tyyg->yy_did_buffer_switch_on_eof = 1;\n\t}\n}\n\n/* Allocates the stack if it does not exist.\n *  Guarantees space for at least one push.\n */\nstatic void yyensure_buffer_stack (yyscan_t yyscanner)\n{\n\tyy_size_t num_to_alloc;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif (!yyg->yy_buffer_stack) {\n\n\t\t/* First allocation is just for 2 elements, since we don't know if this\n\t\t * scanner will even need a stack. We use 2 instead of 1 to avoid an\n\t\t * immediate realloc on the next call.\n         */\n      num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */\n\t\tyyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc\n\t\t\t\t\t\t\t\t(num_to_alloc * sizeof(struct yy_buffer_state*)\n\t\t\t\t\t\t\t\t, yyscanner);\n\t\tif ( ! yyg->yy_buffer_stack )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in yyensure_buffer_stack()\" );\n\n\t\tmemset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));\n\n\t\tyyg->yy_buffer_stack_max = num_to_alloc;\n\t\tyyg->yy_buffer_stack_top = 0;\n\t\treturn;\n\t}\n\n\tif (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){\n\n\t\t/* Increase the buffer to prepare for a possible push. */\n\t\tyy_size_t grow_size = 8 /* arbitrary grow size */;\n\n\t\tnum_to_alloc = yyg->yy_buffer_stack_max + grow_size;\n\t\tyyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc\n\t\t\t\t\t\t\t\t(yyg->yy_buffer_stack,\n\t\t\t\t\t\t\t\tnum_to_alloc * sizeof(struct yy_buffer_state*)\n\t\t\t\t\t\t\t\t, yyscanner);\n\t\tif ( ! yyg->yy_buffer_stack )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in yyensure_buffer_stack()\" );\n\n\t\t/* zero only the new slots.*/\n\t\tmemset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));\n\t\tyyg->yy_buffer_stack_max = num_to_alloc;\n\t}\n}\n\n/** Setup the input buffer state to scan directly from a user-specified character buffer.\n * @param base the character buffer\n * @param size the size in bytes of the character buffer\n * @param yyscanner The scanner object.\n * @return the newly allocated buffer state object.\n */\nYY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)\n{\n\tYY_BUFFER_STATE b;\n    \n\tif ( size < 2 ||\n\t     base[size-2] != YY_END_OF_BUFFER_CHAR ||\n\t     base[size-1] != YY_END_OF_BUFFER_CHAR )\n\t\t/* They forgot to leave room for the EOB's. */\n\t\treturn NULL;\n\n\tb = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_scan_buffer()\" );\n\n\tb->yy_buf_size = (int) (size - 2);\t/* \"- 2\" to take care of EOB's */\n\tb->yy_buf_pos = b->yy_ch_buf = base;\n\tb->yy_is_our_buffer = 0;\n\tb->yy_input_file = NULL;\n\tb->yy_n_chars = b->yy_buf_size;\n\tb->yy_is_interactive = 0;\n\tb->yy_at_bol = 1;\n\tb->yy_fill_buffer = 0;\n\tb->yy_buffer_status = YY_BUFFER_NEW;\n\n\tyy_switch_to_buffer( b , yyscanner );\n\n\treturn b;\n}\n\n/** Setup the input buffer state to scan a string. The next call to yylex() will\n * scan from a @e copy of @a str.\n * @param yystr a NUL-terminated string to scan\n * @param yyscanner The scanner object.\n * @return the newly allocated buffer state object.\n * @note If you want to scan bytes that may contain NUL values, then use\n *       yy_scan_bytes() instead.\n */\nYY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)\n{\n    \n\treturn yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);\n}\n\n/** Setup the input buffer state to scan the given bytes. The next call to yylex() will\n * scan from a @e copy of @a bytes.\n * @param yybytes the byte buffer to scan\n * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.\n * @param yyscanner The scanner object.\n * @return the newly allocated buffer state object.\n */\nYY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len , yyscan_t yyscanner)\n{\n\tYY_BUFFER_STATE b;\n\tchar *buf;\n\tyy_size_t n;\n\tint i;\n    \n\t/* Get memory for full buffer, including space for trailing EOB's. */\n\tn = (yy_size_t) (_yybytes_len + 2);\n\tbuf = (char *) yyalloc( n , yyscanner );\n\tif ( ! buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_scan_bytes()\" );\n\n\tfor ( i = 0; i < _yybytes_len; ++i )\n\t\tbuf[i] = yybytes[i];\n\n\tbuf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;\n\n\tb = yy_scan_buffer( buf, n , yyscanner);\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"bad buffer in yy_scan_bytes()\" );\n\n\t/* It's okay to grow etc. this buffer, and we should throw it\n\t * away when we're done.\n\t */\n\tb->yy_is_our_buffer = 1;\n\n\treturn b;\n}\n\n#ifndef YY_EXIT_FAILURE\n#define YY_EXIT_FAILURE 2\n#endif\n\nstatic void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\tfprintf( stderr, \"%s\\n\", msg );\n\texit( YY_EXIT_FAILURE );\n}\n\n/* Redefine yyless() so it works in section 3 code. */\n\n#undef yyless\n#define yyless(n) \\\n\tdo \\\n\t\t{ \\\n\t\t/* Undo effects of setting up yytext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\tyytext[yyleng] = yyg->yy_hold_char; \\\n\t\tyyg->yy_c_buf_p = yytext + yyless_macro_arg; \\\n\t\tyyg->yy_hold_char = *yyg->yy_c_buf_p; \\\n\t\t*yyg->yy_c_buf_p = '\\0'; \\\n\t\tyyleng = yyless_macro_arg; \\\n\t\t} \\\n\twhile ( 0 )\n\n/* Accessor  methods (get/set functions) to struct members. */\n\n/** Get the user-defined data for this scanner.\n * @param yyscanner The scanner object.\n */\nYY_EXTRA_TYPE yyget_extra  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyextra;\n}\n\n/** Get the current line number.\n * @param yyscanner The scanner object.\n */\nint yyget_lineno  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        if (! YY_CURRENT_BUFFER)\n            return 0;\n    \n    return yylineno;\n}\n\n/** Get the current column number.\n * @param yyscanner The scanner object.\n */\nint yyget_column  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        if (! YY_CURRENT_BUFFER)\n            return 0;\n    \n    return yycolumn;\n}\n\n/** Get the input stream.\n * @param yyscanner The scanner object.\n */\nFILE *yyget_in  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyin;\n}\n\n/** Get the output stream.\n * @param yyscanner The scanner object.\n */\nFILE *yyget_out  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyout;\n}\n\n/** Get the length of the current token.\n * @param yyscanner The scanner object.\n */\nint yyget_leng  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyleng;\n}\n\n/** Get the current token.\n * @param yyscanner The scanner object.\n */\n\nchar *yyget_text  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yytext;\n}\n\n/** Set the user-defined data. This data is never touched by the scanner.\n * @param user_defined The data to be associated with this scanner.\n * @param yyscanner The scanner object.\n */\nvoid yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yyextra = user_defined ;\n}\n\n/** Set the current line number.\n * @param _line_number line number\n * @param yyscanner The scanner object.\n */\nvoid yyset_lineno (int  _line_number , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        /* lineno is only valid if an input buffer exists. */\n        if (! YY_CURRENT_BUFFER )\n           YY_FATAL_ERROR( \"yyset_lineno called with no buffer\" );\n    \n    yylineno = _line_number;\n}\n\n/** Set the current column.\n * @param _column_no column number\n * @param yyscanner The scanner object.\n */\nvoid yyset_column (int  _column_no , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        /* column is only valid if an input buffer exists. */\n        if (! YY_CURRENT_BUFFER )\n           YY_FATAL_ERROR( \"yyset_column called with no buffer\" );\n    \n    yycolumn = _column_no;\n}\n\n/** Set the input stream. This does not discard the current\n * input buffer.\n * @param _in_str A readable stream.\n * @param yyscanner The scanner object.\n * @see yy_switch_to_buffer\n */\nvoid yyset_in (FILE *  _in_str , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yyin = _in_str ;\n}\n\nvoid yyset_out (FILE *  _out_str , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yyout = _out_str ;\n}\n\nint yyget_debug  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yy_flex_debug;\n}\n\nvoid yyset_debug (int  _bdebug , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yy_flex_debug = _bdebug ;\n}\n\n/* Accessor methods for yylval and yylloc */\n\n/* User-visible API */\n\n/* yylex_init is special because it creates the scanner itself, so it is\n * the ONLY reentrant function that doesn't take the scanner as the last argument.\n * That's why we explicitly handle the declaration, instead of using our macros.\n */\nint yylex_init(yyscan_t* ptr_yy_globals)\n{\n    if (ptr_yy_globals == NULL){\n        errno = EINVAL;\n        return 1;\n    }\n\n    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );\n\n    if (*ptr_yy_globals == NULL){\n        errno = ENOMEM;\n        return 1;\n    }\n\n    /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */\n    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));\n\n    return yy_init_globals ( *ptr_yy_globals );\n}\n\n/* yylex_init_extra has the same functionality as yylex_init, but follows the\n * convention of taking the scanner as the last argument. Note however, that\n * this is a *pointer* to a scanner, as it will be allocated by this call (and\n * is the reason, too, why this function also must handle its own declaration).\n * The user defined value in the first argument will be available to yyalloc in\n * the yyextra field.\n */\nint yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )\n{\n    struct yyguts_t dummy_yyguts;\n\n    yyset_extra (yy_user_defined, &dummy_yyguts);\n\n    if (ptr_yy_globals == NULL){\n        errno = EINVAL;\n        return 1;\n    }\n\n    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );\n\n    if (*ptr_yy_globals == NULL){\n        errno = ENOMEM;\n        return 1;\n    }\n\n    /* By setting to 0xAA, we expose bugs in\n    yy_init_globals. Leave at 0x00 for releases. */\n    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));\n\n    yyset_extra (yy_user_defined, *ptr_yy_globals);\n\n    return yy_init_globals ( *ptr_yy_globals );\n}\n\nstatic int yy_init_globals (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    /* Initialization is the same as for the non-reentrant scanner.\n     * This function is called from yylex_destroy(), so don't allocate here.\n     */\n\n    yyg->yy_buffer_stack = NULL;\n    yyg->yy_buffer_stack_top = 0;\n    yyg->yy_buffer_stack_max = 0;\n    yyg->yy_c_buf_p = NULL;\n    yyg->yy_init = 0;\n    yyg->yy_start = 0;\n\n    yyg->yy_start_stack_ptr = 0;\n    yyg->yy_start_stack_depth = 0;\n    yyg->yy_start_stack =  NULL;\n\n/* Defined in main.c */\n#ifdef YY_STDINIT\n    yyin = stdin;\n    yyout = stdout;\n#else\n    yyin = NULL;\n    yyout = NULL;\n#endif\n\n    /* For future reference: Set errno on error, since we are called by\n     * yylex_init()\n     */\n    return 0;\n}\n\n/* yylex_destroy is for both reentrant and non-reentrant scanners. */\nint yylex_destroy  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n    /* Pop the buffer stack, destroying each element. */\n\twhile(YY_CURRENT_BUFFER){\n\t\tyy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );\n\t\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\t\tyypop_buffer_state(yyscanner);\n\t}\n\n\t/* Destroy the stack itself. */\n\tyyfree(yyg->yy_buffer_stack , yyscanner);\n\tyyg->yy_buffer_stack = NULL;\n\n    /* Destroy the start condition stack. */\n        yyfree( yyg->yy_start_stack , yyscanner );\n        yyg->yy_start_stack = NULL;\n\n    /* Reset the globals. This is important in a non-reentrant scanner so the next time\n     * yylex() is called, initialization will occur. */\n    yy_init_globals( yyscanner);\n\n    /* Destroy the main struct (reentrant only). */\n    yyfree ( yyscanner , yyscanner );\n    yyscanner = NULL;\n    return 0;\n}\n\n/*\n * Internal utility routines.\n */\n\n#ifndef yytext_ptr\nstatic void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\n\tint i;\n\tfor ( i = 0; i < n; ++i )\n\t\ts1[i] = s2[i];\n}\n#endif\n\n#ifdef YY_NEED_STRLEN\nstatic int yy_flex_strlen (const char * s , yyscan_t yyscanner)\n{\n\tint n;\n\tfor ( n = 0; s[n]; ++n )\n\t\t;\n\n\treturn n;\n}\n#endif\n\nvoid *yyalloc (yy_size_t  size , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\treturn malloc(size);\n}\n\nvoid *yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\n\t/* The cast to (char *) in the following accommodates both\n\t * implementations that use char* generic pointers, and those\n\t * that use void* generic pointers.  It works with the latter\n\t * because both ANSI C and C++ allow castless assignment from\n\t * any pointer type to void*, and deal with argument conversions\n\t * as though doing an assignment.\n\t */\n\treturn realloc(ptr, size);\n}\n\nvoid yyfree (void * ptr , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\tfree( (char *) ptr );\t/* see yyrealloc() for (char *) cast */\n}\n\n#define YYTABLES_NAME \"yytables\"\n\n#line 3106 \"wcsbth.l\"\n\n\n/*----------------------------------------------------------------------------\n* External interface to the scanner.\n*---------------------------------------------------------------------------*/\n\nint wcsbth(\n  char *header,\n  int nkeyrec,\n  int relax,\n  int ctrl,\n  int keysel,\n  int *colsel,\n  int *nreject,\n  int *nwcs,\n  struct wcsprm **wcs)\n\n{\n  // Function prototypes.\n  int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner);\n  int yylex_destroy(yyscan_t yyscanner);\n\n  struct wcsbth_extra extra;\n  yyscan_t yyscanner;\n  yylex_init_extra(&extra, &yyscanner);\n  int status = wcsbth_scanner(header, nkeyrec, relax, ctrl, keysel, colsel,\n                              nreject, nwcs, wcs, yyscanner);\n  yylex_destroy(yyscanner);\n\n  return status;\n}\n\n/*----------------------------------------------------------------------------\n* Perform first-pass tasks:\n*\n* 1) Count the number of coordinate axes in each of the 27 possible alternate\n*    image-header coordinate representations.  Also count the number of PVi_ma\n*    and PSi_ma keywords in each representation.\n*\n* 2) Determine the number of binary table columns that have an image array\n*    with a coordinate representation (up to 999), and count the number of\n*    coordinate axes in each of the 27 possible alternates.  Also count the\n*    number of iVn_ma and iSn_ma keywords in each representation.\n*\n* 3) Determine the number of alternate pixel list coordinate representations\n*    (up to 27) and the table columns associated with each.  Also count the\n*    number of TVn_ma and TSn_ma keywords in each representation.\n*\n* In the first pass alts->arridx[icol][27] is used to determine the number of\n* axes in each of 27 possible image-header coordinate descriptions (icol == 0)\n* and each of the 27 possible coordinate representations for an image array in\n* each column.\n*\n* The elements of alts->pixlist[icol] are used as bit arrays to flag which of\n* the 27 possible pixel list coordinate representations are associated with\n* each table column.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_pass1(\n  int keytype,\n  int i,\n  int j,\n  int n,\n  int k,\n  char a,\n  char ptype,\n  struct wcsbth_alts *alts)\n\n{\n  if (a == 0) {\n    // Keywords such as DATE-OBS go along for the ride.\n    return 0;\n  }\n\n  int ncol = alts->ncol;\n\n  // Do we need to allocate memory for alts?\n  if (alts->arridx == 0x0) {\n    if (ncol == 0) {\n      // Can only happen if TFIELDS is missing or out-of-sequence.  If n and\n      // k are both zero then we may be processing an image header so leave\n      // ncol alone - the array will be realloc'd later if required.\n      if (n || k) {\n        // The header is mangled, assume the worst.\n        ncol = 999;\n      }\n    }\n\n    if (!(alts->arridx  =  calloc((1 + ncol)*27, sizeof(short int))) ||\n        !(alts->npv     =  calloc((1 + ncol)*27, sizeof(unsigned char)))  ||\n        !(alts->nps     =  calloc((1 + ncol)*27, sizeof(unsigned char)))  ||\n        !(alts->pixlist =  calloc((1 + ncol),    sizeof(unsigned int)))) {\n      if (alts->arridx)  free(alts->arridx);\n      if (alts->npv)     free(alts->npv);\n      if (alts->nps)     free(alts->nps);\n      if (alts->pixlist) free(alts->pixlist);\n      return WCSHDRERR_MEMORY;\n    }\n\n    alts->ncol = ncol;\n\n  } else if (n > ncol || k > ncol) {\n    // Can only happen if TFIELDS or the WCS keyword is wrong; carry on.\n    ncol = 999;\n    if (!(alts->arridx  = realloc(alts->arridx,\n                                    27*(1 + ncol)*sizeof(short int))) ||\n        !(alts->npv     = realloc(alts->npv,\n                                    27*(1 + ncol)*sizeof(unsigned char)))  ||\n        !(alts->nps     = realloc(alts->nps,\n                                    27*(1 + ncol)*sizeof(unsigned char)))  ||\n        !(alts->pixlist = realloc(alts->pixlist,\n                                       (1 + ncol)*sizeof(unsigned int)))) {\n      if (alts->arridx)  free(alts->arridx);\n      if (alts->npv)     free(alts->npv);\n      if (alts->nps)     free(alts->nps);\n      if (alts->pixlist) free(alts->pixlist);\n      return WCSHDRERR_MEMORY;\n    }\n\n    // Since realloc() doesn't initialize the extra memory.\n    for (int icol = (1 + alts->ncol); icol < (1 + ncol); icol++) {\n      for (int ialt = 0; ialt < 27; ialt++) {\n        alts->arridx[icol][ialt] = 0;\n        alts->npv[icol][ialt] = 0;\n        alts->nps[icol][ialt] = 0;\n        alts->pixlist[icol]   = 0;\n      }\n    }\n\n    alts->ncol = ncol;\n  }\n\n  int ialt = 0;\n  if (a != ' ') {\n    ialt = a - 'A' + 1;\n  }\n\n  // A BINTAB keytype such as LONPna, in conjunction with an IMGAXIS keytype\n  // causes a table column to be recognized as an image array.\n  if (keytype & IMGHEAD || keytype & BIMGARR) {\n    // n == 0 is expected for IMGHEAD keywords.\n    if (i == 0 && j == 0) {\n      if (alts->arridx[n][ialt] == 0) {\n        // Flag that an auxiliary keyword was seen.\n        alts->arridx[n][ialt] = -1;\n      }\n\n    } else {\n      // Record the maximum axis number found.\n      if (alts->arridx[n][ialt] < i) {\n        alts->arridx[n][ialt] = i;\n      }\n\n      if (alts->arridx[n][ialt] < j) {\n        alts->arridx[n][ialt] = j;\n      }\n    }\n\n    if (ptype == 'v') {\n      alts->npv[n][ialt]++;\n    } else if (ptype == 's') {\n      alts->nps[n][ialt]++;\n    }\n  }\n\n  // BINTAB keytypes, which apply both to pixel lists as well as binary table\n  // image arrays, never contribute to recognizing a table column as a pixel\n  // list axis.  A PIXLIST keytype is required for that.\n  if (keytype == PIXLIST) {\n    int mask = 1 << ialt;\n\n    // n > 0 for PIXLIST keytypes.\n    alts->pixlist[n] |= mask;\n    if (k) alts->pixlist[k] |= mask;\n\n    // Used as a flag over all columns.\n    alts->pixlist[0] |= mask;\n\n    if (ptype == 'v') {\n      alts->pixnpv[ialt]++;\n    } else if (ptype == 's') {\n      alts->pixnps[ialt]++;\n    }\n  }\n\n  return 0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Perform initializations at the end of the first pass:\n*\n* 1) Determine the required number of wcsprm structs, allocate memory for\n*    an array of them and initialize each one.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_init1(\n  struct wcsbth_alts *alts,\n  int naux,\n  int *nwcs,\n  struct wcsprm **wcs)\n\n{\n  int status = 0;\n\n  if (alts->arridx == 0x0) {\n    *nwcs = 0;\n    return 0;\n  }\n\n  // Determine the number of axes in each pixel list representation.\n  int ialt, mask, ncol = alts->ncol;\n  for (ialt = 0, mask = 1; ialt < 27; ialt++, mask <<= 1) {\n    alts->pixidx[ialt] = 0;\n\n    if (alts->pixlist[0] | mask) {\n      for (int icol = 1; icol <= ncol; icol++) {\n        if (alts->pixlist[icol] & mask) {\n          alts->pixidx[ialt]++;\n        }\n      }\n    }\n  }\n\n  // Find the total number of coordinate representations.\n  *nwcs = 0;\n  alts->imgherit = 0;\n  int inherit[27];\n  for (int ialt = 0; ialt < 27; ialt++) {\n    inherit[ialt] = 0;\n\n    for (int icol = 1; icol <= ncol; icol++) {\n      if (alts->arridx[icol][ialt] < 0) {\n        // No BIMGARR keytype but there's at least one BINTAB.\n        if (alts->arridx[0][ialt] > 0) {\n          // There is an IMGAXIS keytype that we will inherit, so count this\n          // representation.\n          alts->arridx[icol][ialt] = alts->arridx[0][ialt];\n        } else {\n          alts->arridx[icol][ialt] = 0;\n        }\n      }\n\n      if (alts->arridx[icol][ialt]) {\n        if (alts->arridx[0][ialt]) {\n          // All IMGHEAD keywords are inherited for this ialt.\n          inherit[ialt] = 1;\n\n          if (alts->arridx[icol][ialt] < alts->arridx[0][ialt]) {\n            // The extra axes are also inherited.\n            alts->arridx[icol][ialt] = alts->arridx[0][ialt];\n          }\n        }\n\n        (*nwcs)++;\n      }\n    }\n\n    // Count every \"a\" found in any IMGHEAD keyword...\n    if (alts->arridx[0][ialt]) {\n      if (inherit[ialt]) {\n        // ...but not if the IMGHEAD keywords will be inherited.\n        alts->arridx[0][ialt] = 0;\n        alts->imgherit = 1;\n      } else if (alts->arridx[0][ialt] > 0) {\n        (*nwcs)++;\n      }\n    }\n\n    // We need a struct for every \"a\" found in a PIXLIST keyword.\n    if (alts->pixidx[ialt]) {\n      (*nwcs)++;\n    }\n  }\n\n\n  if (*nwcs) {\n    // Allocate memory for the required number of wcsprm structs.\n    if (!(*wcs = calloc(*nwcs, sizeof(struct wcsprm)))) {\n      return WCSHDRERR_MEMORY;\n    }\n\n    // Initialize each wcsprm struct.\n    struct wcsprm *wcsp = *wcs;\n    *nwcs = 0;\n    for (int icol = 0; icol <= ncol; icol++) {\n      for (int ialt = 0; ialt < 27; ialt++) {\n        if (alts->arridx[icol][ialt] > 0) {\n          // Image-header representations that are not for inheritance\n          // (icol == 0) or binary table image array representations.\n          wcsp->flag = -1;\n          int npvmax = alts->npv[icol][ialt];\n          int npsmax = alts->nps[icol][ialt];\n          if ((status = wcsinit(1, (int)(alts->arridx[icol][ialt]), wcsp,\n                                npvmax, npsmax, -1))) {\n            wcsvfree(nwcs, wcs);\n            break;\n          }\n\n          // Record the alternate version code.\n          if (ialt) {\n            wcsp->alt[0] = 'A' + ialt - 1;\n          }\n\n          // Any additional auxiliary keywords present?\n          if (naux) {\n            if (wcsauxi(1, wcsp)) {\n              return WCSHDRERR_MEMORY;\n            }\n          }\n\n          // Record the table column number.\n          wcsp->colnum = icol;\n\n          // On the second pass alts->arridx[icol][27] indexes the array of\n          // wcsprm structs.\n          alts->arridx[icol][ialt] = (*nwcs)++;\n\n          wcsp++;\n\n        } else {\n          // Signal that this column has no WCS for this \"a\".\n          alts->arridx[icol][ialt] = -1;\n        }\n      }\n    }\n\n    for (int ialt = 0; ialt < 27; ialt++) {\n      if (alts->pixidx[ialt]) {\n        // Pixel lists representations.\n        wcsp->flag = -1;\n        int npvmax = alts->pixnpv[ialt];\n        int npsmax = alts->pixnps[ialt];\n        if ((status = wcsinit(1, (int)(alts->pixidx[ialt]), wcsp, npvmax,\n                              npsmax, -1))) {\n          wcsvfree(nwcs, wcs);\n          break;\n        }\n\n        // Record the alternate version code.\n        if (ialt) {\n          wcsp->alt[0] = 'A' + ialt - 1;\n        }\n\n        // Any additional auxiliary keywords present?\n        if (naux) {\n          if (wcsauxi(1, wcsp)) {\n            return WCSHDRERR_MEMORY;\n          }\n        }\n\n        // Record the pixel list column numbers.\n        int icol, ix, mask = (1 << ialt);\n        for (icol = 1, ix = 0; icol <= ncol; icol++) {\n          if (alts->pixlist[icol] & mask) {\n            wcsp->colax[ix++] = icol;\n          }\n        }\n\n        // alts->pixidx[] indexes the array of wcsprm structs.\n        alts->pixidx[ialt] = (*nwcs)++;\n\n        wcsp++;\n\n      } else {\n        // Signal that this column is not a pixel list axis for this \"a\".\n        alts->pixidx[ialt] = -1;\n      }\n    }\n  }\n\n  return status;\n}\n\n\n/*----------------------------------------------------------------------------\n* Return a pointer to the next wcsprm struct for a particular column number\n* and alternate.\n*---------------------------------------------------------------------------*/\n\nstruct wcsprm *wcsbth_idx(\n  struct wcsprm *wcs,\n  struct wcsbth_alts *alts,\n  int  keytype,\n  int  n,\n  char a)\n\n{\n  const char as[] = \" ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n\n  if (!wcs) return 0x0;\n\n  int iwcs = -1;\n  for (; iwcs < 0 && alts->ialt < 27; alts->ialt++) {\n    // Note that a == 0 applies to every alternate, otherwise this\n    // loop simply determines the appropriate value of alts->ialt.\n    if (a && a != as[alts->ialt]) continue;\n\n    if (keytype & (IMGHEAD | BIMGARR)) {\n      for (; iwcs < 0 && alts->icol <= alts->ncol; alts->icol++) {\n        // Image header keywords, n == 0, apply to all columns, otherwise this\n        // loop simply determines the appropriate value of alts->icol.\n        if (n && n != alts->icol) continue;\n        iwcs = alts->arridx[alts->icol][alts->ialt];\n      }\n\n      // Break out of the loop to stop alts->ialt from being incremented.\n      if (iwcs >= 0) break;\n\n      // Start from scratch for the next alts->ialt.\n      alts->icol = 0;\n    }\n\n    if (keytype & (IMGAUX | PIXLIST)) {\n      iwcs = alts->pixidx[alts->ialt];\n    }\n  }\n\n  return (iwcs >= 0) ? (wcs + iwcs) : 0x0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Return the axis number associated with the specified column number in a\n* particular pixel list coordinate representation.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_colax(\n  struct wcsprm *wcs,\n  struct wcsbth_alts *alts,\n  int n,\n  char a)\n\n{\n  if (!wcs) return 0;\n\n  struct wcsprm *wcsp = wcs;\n  if (a != ' ') {\n    wcsp += alts->pixidx[a-'A'+1];\n  }\n\n  for (int ix = 0; ix < wcsp->naxis; ix++) {\n    if (wcsp->colax[ix] == n) {\n      return ++ix;\n    }\n  }\n\n  return 0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Interpret the JDREF, JDREFI, and JDREFF keywords.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_jdref(double *mjdref, const double *jdref)\n\n{\n  // Set MJDREF from JDREF.\n  if (undefined(mjdref[0] && undefined(mjdref[1]))) {\n    mjdref[0] = jdref[0] - 2400000.0;\n    mjdref[1] = jdref[1] - 0.5;\n\n    if (mjdref[1] < 0.0) {\n      mjdref[0] -= 1.0;\n      mjdref[1] += 1.0;\n    }\n  }\n\n  return 0;\n}\n\nint wcsbth_jdrefi(double *mjdref, const double *jdrefi)\n\n{\n  // Set the integer part of MJDREF from JDREFI.\n  if (undefined(mjdref[0])) {\n    mjdref[0] = *jdrefi - 2400000.5;\n  }\n\n  return 0;\n}\n\n\nint wcsbth_jdreff(double *mjdref, const double *jdreff)\n\n{\n  // Set the fractional part of MJDREF from JDREFF.\n  if (undefined(mjdref[1])) {\n    mjdref[1] = *jdreff;\n  }\n\n  return 0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Interpret EPOCHa keywords.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_epoch(double *equinox, const double *epoch)\n\n{\n  // If EQUINOXa is currently undefined then set it from EPOCHa.\n  if (undefined(*equinox)) {\n    *equinox = *epoch;\n  }\n\n  return 0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Interpret VSOURCEa keywords.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_vsource(double *zsource, const double *vsource)\n\n{\n  const double c = 299792458.0;\n\n  // If ZSOURCEa is currently undefined then set it from VSOURCEa.\n  if (undefined(*zsource)) {\n    // Convert relativistic Doppler velocity to redshift.\n    double beta = *vsource/c;\n    *zsource = (1.0 + beta)/sqrt(1.0 - beta*beta) - 1.0;\n  }\n\n  return 0;\n}\n\n\n/*----------------------------------------------------------------------------\n* Check validity of a TIMEPIXR keyvalue.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_timepixr(double timepixr)\n\n{\n  return (timepixr < 0.0 || 1.0 < timepixr);\n}\n\n\n/*----------------------------------------------------------------------------\n* Tie up loose ends.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_final(\n  struct wcsbth_alts *alts,\n  int *nwcs,\n  struct wcsprm **wcs)\n\n{\n  if (alts->arridx)  free(alts->arridx);\n  if (alts->npv)     free(alts->npv);\n  if (alts->nps)     free(alts->nps);\n  if (alts->pixlist) free(alts->pixlist);\n\n  for (int ialt = 0; ialt < *nwcs; ialt++) {\n    // Interpret -TAB header keywords.\n    int status;\n    if ((status = wcstab(*wcs+ialt))) {\n       wcsvfree(nwcs, wcs);\n       return status;\n    }\n  }\n\n  return 0;\n}\n\n"},{"id":16620,"name":"cextern/wcslib/config","nodeType":"Package"},{"id":16621,"name":"config.sub","nodeType":"TextFile","path":"cextern/wcslib/config","text":"#! /bin/sh\n# Configuration validation subroutine script.\n#   Copyright 1992-2018 Free Software Foundation, Inc.\n\ntimestamp='2018-07-25'\n\n# This file is free software; you can redistribute it and/or modify it\n# under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n# General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, see <https://www.gnu.org/licenses/>.\n#\n# As a special exception to the GNU General Public License, if you\n# distribute this file as part of a program that contains a\n# configuration script generated by Autoconf, you may include it under\n# the same distribution terms that you use for the rest of that\n# program.  This Exception is an additional permission under section 7\n# of the GNU General Public License, version 3 (\"GPLv3\").\n\n\n# Please send patches to <config-patches@gnu.org>.\n#\n# Configuration subroutine to validate and canonicalize a configuration type.\n# Supply the specified configuration type as an argument.\n# If it is invalid, we print an error message on stderr and exit with code 1.\n# Otherwise, we print the canonical config type on stdout and succeed.\n\n# You can get the latest version of this script from:\n# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub\n\n# This file is supposed to be the same for all GNU packages\n# and recognize all the CPU types, system types and aliases\n# that are meaningful with *any* GNU software.\n# Each package is responsible for reporting which valid configurations\n# it does not support.  The user should be able to distinguish\n# a failure to support a valid configuration from a meaningless\n# configuration.\n\n# The goal of this file is to map all the various variations of a given\n# machine specification into a single specification in the form:\n#\tCPU_TYPE-MANUFACTURER-OPERATING_SYSTEM\n# or in some cases, the newer four-part form:\n#\tCPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM\n# It is wrong to echo any other type of specification.\n\nme=`echo \"$0\" | sed -e 's,.*/,,'`\n\nusage=\"\\\nUsage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS\n\nCanonicalize a configuration name.\n\nOptions:\n  -h, --help         print this help, then exit\n  -t, --time-stamp   print date of last modification, then exit\n  -v, --version      print version number, then exit\n\nReport bugs and patches to <config-patches@gnu.org>.\"\n\nversion=\"\\\nGNU config.sub ($timestamp)\n\nCopyright 1992-2018 Free Software Foundation, Inc.\n\nThis is free software; see the source for copying conditions.  There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\"\n\nhelp=\"\nTry \\`$me --help' for more information.\"\n\n# Parse command line\nwhile test $# -gt 0 ; do\n  case $1 in\n    --time-stamp | --time* | -t )\n       echo \"$timestamp\" ; exit ;;\n    --version | -v )\n       echo \"$version\" ; exit ;;\n    --help | --h* | -h )\n       echo \"$usage\"; exit ;;\n    -- )     # Stop option processing\n       shift; break ;;\n    - )\t# Use stdin as input.\n       break ;;\n    -* )\n       echo \"$me: invalid option $1$help\"\n       exit 1 ;;\n\n    *local*)\n       # First pass through any local machine types.\n       echo \"$1\"\n       exit ;;\n\n    * )\n       break ;;\n  esac\ndone\n\ncase $# in\n 0) echo \"$me: missing argument$help\" >&2\n    exit 1;;\n 1) ;;\n *) echo \"$me: too many arguments$help\" >&2\n    exit 1;;\nesac\n\n# Split fields of configuration type\nIFS=\"-\" read -r field1 field2 field3 field4 <<EOF\n$1\nEOF\n\n# Separate into logical components for further validation\ncase $1 in\n\t*-*-*-*-*)\n\t\techo Invalid configuration \\`\"$1\"\\': more than four components >&2\n\t\texit 1\n\t\t;;\n\t*-*-*-*)\n\t\tbasic_machine=$field1-$field2\n\t\tos=$field3-$field4\n\t\t;;\n\t*-*-*)\n\t\t# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two\n\t\t# parts\n\t\tmaybe_os=$field2-$field3\n\t\tcase $maybe_os in\n\t\t\tnto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \\\n\t\t\t| linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \\\n\t\t\t| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \\\n\t\t\t| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \\\n\t\t\t| storm-chaos* | os2-emx* | rtmk-nova*)\n\t\t\t\tbasic_machine=$field1\n\t\t\t\tos=$maybe_os\n\t\t\t\t;;\n\t\t\tandroid-linux)\n\t\t\t\tbasic_machine=$field1-unknown\n\t\t\t\tos=linux-android\n\t\t\t\t;;\n\t\t\t*)\n\t\t\t\tbasic_machine=$field1-$field2\n\t\t\t\tos=$field3\n\t\t\t\t;;\n\t\tesac\n\t\t;;\n\t*-*)\n\t\t# Second component is usually, but not always the OS\n\t\tcase $field2 in\n\t\t\t# Prevent following clause from handling this valid os\n\t\t\tsun*os*)\n\t\t\t\tbasic_machine=$field1\n\t\t\t\tos=$field2\n\t\t\t\t;;\n\t\t\t# Manufacturers\n\t\t\tdec* | mips* | sequent* | encore* | pc532* | sgi* | sony* \\\n\t\t\t| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \\\n\t\t\t| unicom* | ibm* | next | hp | isi* | apollo | altos* \\\n\t\t\t| convergent* | ncr* | news | 32* | 3600* | 3100* | hitachi* \\\n\t\t\t| c[123]* | convex* | sun | crds | omron* | dg | ultra | tti* \\\n\t\t\t| harris | dolphin | highlevel | gould | cbm | ns | masscomp \\\n\t\t\t| apple | axis | knuth | cray | microblaze* \\\n\t\t\t| sim | cisco | oki | wec | wrs | winbond)\n\t\t\t\tbasic_machine=$field1-$field2\n\t\t\t\tos=\n\t\t\t\t;;\n\t\t\t*)\n\t\t\t\tbasic_machine=$field1\n\t\t\t\tos=$field2\n\t\t\t\t;;\n\t\tesac\n\t\t;;\n\t*)\n\t\t# Convert single-component short-hands not valid as part of\n\t\t# multi-component configurations.\n\t\tcase $field1 in\n\t\t\t386bsd)\n\t\t\t\tbasic_machine=i386-pc\n\t\t\t\tos=bsd\n\t\t\t\t;;\n\t\t\ta29khif)\n\t\t\t\tbasic_machine=a29k-amd\n\t\t\t\tos=udi\n\t\t\t\t;;\n\t\t\tadobe68k)\n\t\t\t\tbasic_machine=m68010-adobe\n\t\t\t\tos=scout\n\t\t\t\t;;\n\t\t\tam29k)\n\t\t\t\tbasic_machine=a29k-none\n\t\t\t\tos=bsd\n\t\t\t\t;;\n\t\t\tamdahl)\n\t\t\t\tbasic_machine=580-amdahl\n\t\t\t\tos=sysv\n\t\t\t\t;;\n\t\t\tamigaos | amigados)\n\t\t\t\tbasic_machine=m68k-unknown\n\t\t\t\tos=amigaos\n\t\t\t\t;;\n\t\t\tamigaunix | amix)\n\t\t\t\tbasic_machine=m68k-unknown\n\t\t\t\tos=sysv4\n\t\t\t\t;;\n\t\t\tapollo68)\n\t\t\t\tbasic_machine=m68k-apollo\n\t\t\t\tos=sysv\n\t\t\t\t;;\n\t\t\tapollo68bsd)\n\t\t\t\tbasic_machine=m68k-apollo\n\t\t\t\tos=bsd\n\t\t\t\t;;\n\t\t\taros)\n\t\t\t\tbasic_machine=i386-pc\n\t\t\t\tos=aros\n\t\t\t\t;;\n\t\t\taux)\n\t\t\t\tbasic_machine=m68k-apple\n\t\t\t\tos=aux\n\t\t\t\t;;\n\t\t\tbalance)\n\t\t\t\tbasic_machine=ns32k-sequent\n\t\t\t\tos=dynix\n\t\t\t\t;;\n\t\t\tblackfin)\n\t\t\t\tbasic_machine=bfin-unknown\n\t\t\t\tos=linux\n\t\t\t\t;;\n\t\t\tcegcc)\n\t\t\t\tbasic_machine=arm-unknown\n\t\t\t\tos=cegcc\n\t\t\t\t;;\n\t\t\tcray)\n\t\t\t\tbasic_machine=j90-cray\n\t\t\t\tos=unicos\n\t\t\t\t;;\n\t\t\tcraynv)\n\t\t\t\tbasic_machine=craynv-cray\n\t\t\t\tos=unicosmp\n\t\t\t\t;;\n\t\t\tdelta88)\n\t\t\t\tbasic_machine=m88k-motorola\n\t\t\t\tos=sysv3\n\t\t\t\t;;\n\t\t\tdicos)\n\t\t\t\tbasic_machine=i686-pc\n\t\t\t\tos=dicos\n\t\t\t\t;;\n\t\t\tdjgpp)\n\t\t\t\tbasic_machine=i586-pc\n\t\t\t\tos=msdosdjgpp\n\t\t\t\t;;\n\t\t\tebmon29k)\n\t\t\t\tbasic_machine=a29k-amd\n\t\t\t\tos=ebmon\n\t\t\t\t;;\n\t\t\tes1800 | OSE68k | ose68k | ose | OSE)\n\t\t\t\tbasic_machine=m68k-ericsson\n\t\t\t\tos=ose\n\t\t\t\t;;\n\t\t\tgmicro)\n\t\t\t\tbasic_machine=tron-gmicro\n\t\t\t\tos=sysv\n\t\t\t\t;;\n\t\t\tgo32)\n\t\t\t\tbasic_machine=i386-pc\n\t\t\t\tos=go32\n\t\t\t\t;;\n\t\t\th8300hms)\n\t\t\t\tbasic_machine=h8300-hitachi\n\t\t\t\tos=hms\n\t\t\t\t;;\n\t\t\th8300xray)\n\t\t\t\tbasic_machine=h8300-hitachi\n\t\t\t\tos=xray\n\t\t\t\t;;\n\t\t\th8500hms)\n\t\t\t\tbasic_machine=h8500-hitachi\n\t\t\t\tos=hms\n\t\t\t\t;;\n\t\t\tharris)\n\t\t\t\tbasic_machine=m88k-harris\n\t\t\t\tos=sysv3\n\t\t\t\t;;\n\t\t\thp300bsd)\n\t\t\t\tbasic_machine=m68k-hp\n\t\t\t\tos=bsd\n\t\t\t\t;;\n\t\t\thp300hpux)\n\t\t\t\tbasic_machine=m68k-hp\n\t\t\t\tos=hpux\n\t\t\t\t;;\n\t\t\thppaosf)\n\t\t\t\tbasic_machine=hppa1.1-hp\n\t\t\t\tos=osf\n\t\t\t\t;;\n\t\t\thppro)\n\t\t\t\tbasic_machine=hppa1.1-hp\n\t\t\t\tos=proelf\n\t\t\t\t;;\n\t\t\ti386mach)\n\t\t\t\tbasic_machine=i386-mach\n\t\t\t\tos=mach\n\t\t\t\t;;\n\t\t\tvsta)\n\t\t\t\tbasic_machine=i386-pc\n\t\t\t\tos=vsta\n\t\t\t\t;;\n\t\t\tisi68 | isi)\n\t\t\t\tbasic_machine=m68k-isi\n\t\t\t\tos=sysv\n\t\t\t\t;;\n\t\t\tm68knommu)\n\t\t\t\tbasic_machine=m68k-unknown\n\t\t\t\tos=linux\n\t\t\t\t;;\n\t\t\tmagnum | m3230)\n\t\t\t\tbasic_machine=mips-mips\n\t\t\t\tos=sysv\n\t\t\t\t;;\n\t\t\tmerlin)\n\t\t\t\tbasic_machine=ns32k-utek\n\t\t\t\tos=sysv\n\t\t\t\t;;\n\t\t\tmingw64)\n\t\t\t\tbasic_machine=x86_64-pc\n\t\t\t\tos=mingw64\n\t\t\t\t;;\n\t\t\tmingw32)\n\t\t\t\tbasic_machine=i686-pc\n\t\t\t\tos=mingw32\n\t\t\t\t;;\n\t\t\tmingw32ce)\n\t\t\t\tbasic_machine=arm-unknown\n\t\t\t\tos=mingw32ce\n\t\t\t\t;;\n\t\t\tmonitor)\n\t\t\t\tbasic_machine=m68k-rom68k\n\t\t\t\tos=coff\n\t\t\t\t;;\n\t\t\tmorphos)\n\t\t\t\tbasic_machine=powerpc-unknown\n\t\t\t\tos=morphos\n\t\t\t\t;;\n\t\t\tmoxiebox)\n\t\t\t\tbasic_machine=moxie-unknown\n\t\t\t\tos=moxiebox\n\t\t\t\t;;\n\t\t\tmsdos)\n\t\t\t\tbasic_machine=i386-pc\n\t\t\t\tos=msdos\n\t\t\t\t;;\n\t\t\tmsys)\n\t\t\t\tbasic_machine=i686-pc\n\t\t\t\tos=msys\n\t\t\t\t;;\n\t\t\tmvs)\n\t\t\t\tbasic_machine=i370-ibm\n\t\t\t\tos=mvs\n\t\t\t\t;;\n\t\t\tnacl)\n\t\t\t\tbasic_machine=le32-unknown\n\t\t\t\tos=nacl\n\t\t\t\t;;\n\t\t\tncr3000)\n\t\t\t\tbasic_machine=i486-ncr\n\t\t\t\tos=sysv4\n\t\t\t\t;;\n\t\t\tnetbsd386)\n\t\t\t\tbasic_machine=i386-pc\n\t\t\t\tos=netbsd\n\t\t\t\t;;\n\t\t\tnetwinder)\n\t\t\t\tbasic_machine=armv4l-rebel\n\t\t\t\tos=linux\n\t\t\t\t;;\n\t\t\tnews | news700 | news800 | news900)\n\t\t\t\tbasic_machine=m68k-sony\n\t\t\t\tos=newsos\n\t\t\t\t;;\n\t\t\tnews1000)\n\t\t\t\tbasic_machine=m68030-sony\n\t\t\t\tos=newsos\n\t\t\t\t;;\n\t\t\tnecv70)\n\t\t\t\tbasic_machine=v70-nec\n\t\t\t\tos=sysv\n\t\t\t\t;;\n\t\t\tnh3000)\n\t\t\t\tbasic_machine=m68k-harris\n\t\t\t\tos=cxux\n\t\t\t\t;;\n\t\t\tnh[45]000)\n\t\t\t\tbasic_machine=m88k-harris\n\t\t\t\tos=cxux\n\t\t\t\t;;\n\t\t\tnindy960)\n\t\t\t\tbasic_machine=i960-intel\n\t\t\t\tos=nindy\n\t\t\t\t;;\n\t\t\tmon960)\n\t\t\t\tbasic_machine=i960-intel\n\t\t\t\tos=mon960\n\t\t\t\t;;\n\t\t\tnonstopux)\n\t\t\t\tbasic_machine=mips-compaq\n\t\t\t\tos=nonstopux\n\t\t\t\t;;\n\t\t\tos400)\n\t\t\t\tbasic_machine=powerpc-ibm\n\t\t\t\tos=os400\n\t\t\t\t;;\n\t\t\tOSE68000 | ose68000)\n\t\t\t\tbasic_machine=m68000-ericsson\n\t\t\t\tos=ose\n\t\t\t\t;;\n\t\t\tos68k)\n\t\t\t\tbasic_machine=m68k-none\n\t\t\t\tos=os68k\n\t\t\t\t;;\n\t\t\tparagon)\n\t\t\t\tbasic_machine=i860-intel\n\t\t\t\tos=osf\n\t\t\t\t;;\n\t\t\tparisc)\n\t\t\t\tbasic_machine=hppa-unknown\n\t\t\t\tos=linux\n\t\t\t\t;;\n\t\t\tpw32)\n\t\t\t\tbasic_machine=i586-unknown\n\t\t\t\tos=pw32\n\t\t\t\t;;\n\t\t\trdos | rdos64)\n\t\t\t\tbasic_machine=x86_64-pc\n\t\t\t\tos=rdos\n\t\t\t\t;;\n\t\t\trdos32)\n\t\t\t\tbasic_machine=i386-pc\n\t\t\t\tos=rdos\n\t\t\t\t;;\n\t\t\trom68k)\n\t\t\t\tbasic_machine=m68k-rom68k\n\t\t\t\tos=coff\n\t\t\t\t;;\n\t\t\tsa29200)\n\t\t\t\tbasic_machine=a29k-amd\n\t\t\t\tos=udi\n\t\t\t\t;;\n\t\t\tsei)\n\t\t\t\tbasic_machine=mips-sei\n\t\t\t\tos=seiux\n\t\t\t\t;;\n\t\t\tsps7)\n\t\t\t\tbasic_machine=m68k-bull\n\t\t\t\tos=sysv2\n\t\t\t\t;;\n\t\t\tstratus)\n\t\t\t\tbasic_machine=i860-stratus\n\t\t\t\tos=sysv4\n\t\t\t\t;;\n\t\t\tsun2os3)\n\t\t\t\tbasic_machine=m68000-sun\n\t\t\t\tos=sunos3\n\t\t\t\t;;\n\t\t\tsun2os4)\n\t\t\t\tbasic_machine=m68000-sun\n\t\t\t\tos=sunos4\n\t\t\t\t;;\n\t\t\tsun3os3)\n\t\t\t\tbasic_machine=m68k-sun\n\t\t\t\tos=sunos3\n\t\t\t\t;;\n\t\t\tsun3os4)\n\t\t\t\tbasic_machine=m68k-sun\n\t\t\t\tos=sunos4\n\t\t\t\t;;\n\t\t\tsun4os3)\n\t\t\t\tbasic_machine=sparc-sun\n\t\t\t\tos=sunos3\n\t\t\t\t;;\n\t\t\tsun4os4)\n\t\t\t\tbasic_machine=sparc-sun\n\t\t\t\tos=sunos4\n\t\t\t\t;;\n\t\t\tsun4sol2)\n\t\t\t\tbasic_machine=sparc-sun\n\t\t\t\tos=solaris2\n\t\t\t\t;;\n\t\t\tsv1)\n\t\t\t\tbasic_machine=sv1-cray\n\t\t\t\tos=unicos\n\t\t\t\t;;\n\t\t\tsymmetry)\n\t\t\t\tbasic_machine=i386-sequent\n\t\t\t\tos=dynix\n\t\t\t\t;;\n\t\t\tt3e)\n\t\t\t\tbasic_machine=alphaev5-cray\n\t\t\t\tos=unicos\n\t\t\t\t;;\n\t\t\tt90)\n\t\t\t\tbasic_machine=t90-cray\n\t\t\t\tos=unicos\n\t\t\t\t;;\n\t\t\ttoad1)\n\t\t\t\tbasic_machine=pdp10-xkl\n\t\t\t\tos=tops20\n\t\t\t\t;;\n\t\t\ttpf)\n\t\t\t\tbasic_machine=s390x-ibm\n\t\t\t\tos=tpf\n\t\t\t\t;;\n\t\t\tudi29k)\n\t\t\t\tbasic_machine=a29k-amd\n\t\t\t\tos=udi\n\t\t\t\t;;\n\t\t\tultra3)\n\t\t\t\tbasic_machine=a29k-nyu\n\t\t\t\tos=sym1\n\t\t\t\t;;\n\t\t\tv810 | necv810)\n\t\t\t\tbasic_machine=v810-nec\n\t\t\t\tos=none\n\t\t\t\t;;\n\t\t\tvaxv)\n\t\t\t\tbasic_machine=vax-dec\n\t\t\t\tos=sysv\n\t\t\t\t;;\n\t\t\tvms)\n\t\t\t\tbasic_machine=vax-dec\n\t\t\t\tos=vms\n\t\t\t\t;;\n\t\t\tvxworks960)\n\t\t\t\tbasic_machine=i960-wrs\n\t\t\t\tos=vxworks\n\t\t\t\t;;\n\t\t\tvxworks68)\n\t\t\t\tbasic_machine=m68k-wrs\n\t\t\t\tos=vxworks\n\t\t\t\t;;\n\t\t\tvxworks29k)\n\t\t\t\tbasic_machine=a29k-wrs\n\t\t\t\tos=vxworks\n\t\t\t\t;;\n\t\t\txbox)\n\t\t\t\tbasic_machine=i686-pc\n\t\t\t\tos=mingw32\n\t\t\t\t;;\n\t\t\tymp)\n\t\t\t\tbasic_machine=ymp-cray\n\t\t\t\tos=unicos\n\t\t\t\t;;\n\t\t\t*)\n\t\t\t\tbasic_machine=$1\n\t\t\t\tos=\n\t\t\t\t;;\n\t\tesac\n\t\t;;\nesac\n\n# Decode aliases for certain CPU-COMPANY combinations.\ncase $basic_machine in\n\t# Recognize the basic CPU types without company name.\n\t# Some are omitted here because they have special meanings below.\n\t1750a | 580 \\\n\t| a29k \\\n\t| aarch64 | aarch64_be \\\n\t| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \\\n\t| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \\\n\t| am33_2.0 \\\n\t| arc | arceb \\\n\t| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | armv[78][arm] \\\n\t| avr | avr32 \\\n\t| ba \\\n\t| be32 | be64 \\\n\t| bfin \\\n\t| c4x | c8051 | clipper | csky \\\n\t| d10v | d30v | dlx | dsp16xx \\\n\t| e2k | epiphany \\\n\t| fido | fr30 | frv | ft32 \\\n\t| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \\\n\t| hexagon \\\n\t| i370 | i860 | i960 | ia16 | ia64 \\\n\t| ip2k | iq2000 \\\n\t| k1om \\\n\t| le32 | le64 \\\n\t| lm32 \\\n\t| m32c | m32r | m32rle | m68000 | m68k | m88k \\\n\t| maxq | mb | microblaze | microblazeel | mcore | mep | metag \\\n\t| mips | mipsbe | mipseb | mipsel | mipsle \\\n\t| mips16 \\\n\t| mips64 | mips64el \\\n\t| mips64octeon | mips64octeonel \\\n\t| mips64orion | mips64orionel \\\n\t| mips64r5900 | mips64r5900el \\\n\t| mips64vr | mips64vrel \\\n\t| mips64vr4100 | mips64vr4100el \\\n\t| mips64vr4300 | mips64vr4300el \\\n\t| mips64vr5000 | mips64vr5000el \\\n\t| mips64vr5900 | mips64vr5900el \\\n\t| mipsisa32 | mipsisa32el \\\n\t| mipsisa32r2 | mipsisa32r2el \\\n\t| mipsisa32r6 | mipsisa32r6el \\\n\t| mipsisa64 | mipsisa64el \\\n\t| mipsisa64r2 | mipsisa64r2el \\\n\t| mipsisa64r6 | mipsisa64r6el \\\n\t| mipsisa64sb1 | mipsisa64sb1el \\\n\t| mipsisa64sr71k | mipsisa64sr71kel \\\n\t| mipsr5900 | mipsr5900el \\\n\t| mipstx39 | mipstx39el \\\n\t| mn10200 | mn10300 \\\n\t| moxie \\\n\t| mt \\\n\t| msp430 \\\n\t| nds32 | nds32le | nds32be \\\n\t| nfp \\\n\t| nios | nios2 | nios2eb | nios2el \\\n\t| ns16k | ns32k \\\n\t| open8 | or1k | or1knd | or32 \\\n\t| pdp10 | pj | pjl \\\n\t| powerpc | powerpc64 | powerpc64le | powerpcle \\\n\t| pru \\\n\t| pyramid \\\n\t| riscv | riscv32 | riscv64 \\\n\t| rl78 | rx \\\n\t| score \\\n\t| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \\\n\t| sh64 | sh64le \\\n\t| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \\\n\t| sparcv8 | sparcv9 | sparcv9b | sparcv9v \\\n\t| spu \\\n\t| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \\\n\t| ubicom32 \\\n\t| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \\\n\t| visium \\\n\t| wasm32 \\\n\t| x86 | xc16x | xstormy16 | xtensa \\\n\t| z8k | z80)\n\t\tbasic_machine=$basic_machine-unknown\n\t\t;;\n\tc54x)\n\t\tbasic_machine=tic54x-unknown\n\t\t;;\n\tc55x)\n\t\tbasic_machine=tic55x-unknown\n\t\t;;\n\tc6x)\n\t\tbasic_machine=tic6x-unknown\n\t\t;;\n\tleon|leon[3-9])\n\t\tbasic_machine=sparc-$basic_machine\n\t\t;;\n\tm6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)\n\t\tbasic_machine=$basic_machine-unknown\n\t\tos=${os:-none}\n\t\t;;\n\tm88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)\n\t\t;;\n\tm9s12z | m68hcs12z | hcs12z | s12z)\n\t\tbasic_machine=s12z-unknown\n\t\tos=${os:-none}\n\t\t;;\n\tms1)\n\t\tbasic_machine=mt-unknown\n\t\t;;\n\tstrongarm | thumb | xscale)\n\t\tbasic_machine=arm-unknown\n\t\t;;\n\txgate)\n\t\tbasic_machine=$basic_machine-unknown\n\t\tos=${os:-none}\n\t\t;;\n\txscaleeb)\n\t\tbasic_machine=armeb-unknown\n\t\t;;\n\n\txscaleel)\n\t\tbasic_machine=armel-unknown\n\t\t;;\n\n\t# We use `pc' rather than `unknown'\n\t# because (1) that's what they normally are, and\n\t# (2) the word \"unknown\" tends to confuse beginning users.\n\ti*86 | x86_64)\n\t  basic_machine=$basic_machine-pc\n\t  ;;\n\t# Recognize the basic CPU types with company name.\n\t580-* \\\n\t| a29k-* \\\n\t| aarch64-* | aarch64_be-* \\\n\t| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \\\n\t| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \\\n\t| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \\\n\t| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \\\n\t| avr-* | avr32-* \\\n\t| ba-* \\\n\t| be32-* | be64-* \\\n\t| bfin-* | bs2000-* \\\n\t| c[123]* | c30-* | [cjt]90-* | c4x-* \\\n\t| c8051-* | clipper-* | craynv-* | csky-* | cydra-* \\\n\t| d10v-* | d30v-* | dlx-* \\\n\t| e2k-* | elxsi-* \\\n\t| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \\\n\t| h8300-* | h8500-* \\\n\t| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \\\n\t| hexagon-* \\\n\t| i*86-* | i860-* | i960-* | ia16-* | ia64-* \\\n\t| ip2k-* | iq2000-* \\\n\t| k1om-* \\\n\t| le32-* | le64-* \\\n\t| lm32-* \\\n\t| m32c-* | m32r-* | m32rle-* \\\n\t| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \\\n\t| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \\\n\t| microblaze-* | microblazeel-* \\\n\t| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \\\n\t| mips16-* \\\n\t| mips64-* | mips64el-* \\\n\t| mips64octeon-* | mips64octeonel-* \\\n\t| mips64orion-* | mips64orionel-* \\\n\t| mips64r5900-* | mips64r5900el-* \\\n\t| mips64vr-* | mips64vrel-* \\\n\t| mips64vr4100-* | mips64vr4100el-* \\\n\t| mips64vr4300-* | mips64vr4300el-* \\\n\t| mips64vr5000-* | mips64vr5000el-* \\\n\t| mips64vr5900-* | mips64vr5900el-* \\\n\t| mipsisa32-* | mipsisa32el-* \\\n\t| mipsisa32r2-* | mipsisa32r2el-* \\\n\t| mipsisa32r6-* | mipsisa32r6el-* \\\n\t| mipsisa64-* | mipsisa64el-* \\\n\t| mipsisa64r2-* | mipsisa64r2el-* \\\n\t| mipsisa64r6-* | mipsisa64r6el-* \\\n\t| mipsisa64sb1-* | mipsisa64sb1el-* \\\n\t| mipsisa64sr71k-* | mipsisa64sr71kel-* \\\n\t| mipsr5900-* | mipsr5900el-* \\\n\t| mipstx39-* | mipstx39el-* \\\n\t| mmix-* \\\n\t| moxie-* \\\n\t| mt-* \\\n\t| msp430-* \\\n\t| nds32-* | nds32le-* | nds32be-* \\\n\t| nfp-* \\\n\t| nios-* | nios2-* | nios2eb-* | nios2el-* \\\n\t| none-* | np1-* | ns16k-* | ns32k-* \\\n\t| open8-* \\\n\t| or1k*-* \\\n\t| orion-* \\\n\t| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \\\n\t| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \\\n\t| pru-* \\\n\t| pyramid-* \\\n\t| riscv-* | riscv32-* | riscv64-* \\\n\t| rl78-* | romp-* | rs6000-* | rx-* \\\n\t| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \\\n\t| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \\\n\t| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \\\n\t| sparclite-* \\\n\t| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \\\n\t| tahoe-* \\\n\t| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \\\n\t| tile*-* \\\n\t| tron-* \\\n\t| ubicom32-* \\\n\t| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \\\n\t| vax-* \\\n\t| visium-* \\\n\t| wasm32-* \\\n\t| we32k-* \\\n\t| x86-* | x86_64-* | xc16x-* | xps100-* \\\n\t| xstormy16-* | xtensa*-* \\\n\t| ymp-* \\\n\t| z8k-* | z80-*)\n\t\t;;\n\t# Recognize the basic CPU types without company name, with glob match.\n\txtensa*)\n\t\tbasic_machine=$basic_machine-unknown\n\t\t;;\n\t# Recognize the various machine names and aliases which stand\n\t# for a CPU type and a company and sometimes even an OS.\n\t3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)\n\t\tbasic_machine=m68000-att\n\t\t;;\n\t3b*)\n\t\tbasic_machine=we32k-att\n\t\t;;\n\tabacus)\n\t\tbasic_machine=abacus-unknown\n\t\t;;\n\talliant | fx80)\n\t\tbasic_machine=fx80-alliant\n\t\t;;\n\taltos | altos3068)\n\t\tbasic_machine=m68k-altos\n\t\t;;\n\tamd64)\n\t\tbasic_machine=x86_64-pc\n\t\t;;\n\tamd64-*)\n\t\tbasic_machine=x86_64-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\t;;\n\tamiga | amiga-*)\n\t\tbasic_machine=m68k-unknown\n\t\t;;\n\tasmjs)\n\t\tbasic_machine=asmjs-unknown\n\t\t;;\n\tblackfin-*)\n\t\tbasic_machine=bfin-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\tos=linux\n\t\t;;\n\tbluegene*)\n\t\tbasic_machine=powerpc-ibm\n\t\tos=cnk\n\t\t;;\n\tc54x-*)\n\t\tbasic_machine=tic54x-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\t;;\n\tc55x-*)\n\t\tbasic_machine=tic55x-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\t;;\n\tc6x-*)\n\t\tbasic_machine=tic6x-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\t;;\n\tc90)\n\t\tbasic_machine=c90-cray\n\t\tos=${os:-unicos}\n\t\t;;\n\tconvex-c1)\n\t\tbasic_machine=c1-convex\n\t\tos=bsd\n\t\t;;\n\tconvex-c2)\n\t\tbasic_machine=c2-convex\n\t\tos=bsd\n\t\t;;\n\tconvex-c32)\n\t\tbasic_machine=c32-convex\n\t\tos=bsd\n\t\t;;\n\tconvex-c34)\n\t\tbasic_machine=c34-convex\n\t\tos=bsd\n\t\t;;\n\tconvex-c38)\n\t\tbasic_machine=c38-convex\n\t\tos=bsd\n\t\t;;\n\tcr16 | cr16-*)\n\t\tbasic_machine=cr16-unknown\n\t\tos=${os:-elf}\n\t\t;;\n\tcrds | unos)\n\t\tbasic_machine=m68k-crds\n\t\t;;\n\tcrisv32 | crisv32-* | etraxfs*)\n\t\tbasic_machine=crisv32-axis\n\t\t;;\n\tcris | cris-* | etrax*)\n\t\tbasic_machine=cris-axis\n\t\t;;\n\tcrx)\n\t\tbasic_machine=crx-unknown\n\t\tos=${os:-elf}\n\t\t;;\n\tda30 | da30-*)\n\t\tbasic_machine=m68k-da30\n\t\t;;\n\tdecstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)\n\t\tbasic_machine=mips-dec\n\t\t;;\n\tdecsystem10* | dec10*)\n\t\tbasic_machine=pdp10-dec\n\t\tos=tops10\n\t\t;;\n\tdecsystem20* | dec20*)\n\t\tbasic_machine=pdp10-dec\n\t\tos=tops20\n\t\t;;\n\tdelta | 3300 | motorola-3300 | motorola-delta \\\n\t      | 3300-motorola | delta-motorola)\n\t\tbasic_machine=m68k-motorola\n\t\t;;\n\tdpx20 | dpx20-*)\n\t\tbasic_machine=rs6000-bull\n\t\tos=${os:-bosx}\n\t\t;;\n\tdpx2*)\n\t\tbasic_machine=m68k-bull\n\t\tos=sysv3\n\t\t;;\n\te500v[12])\n\t\tbasic_machine=powerpc-unknown\n\t\tos=$os\"spe\"\n\t\t;;\n\te500v[12]-*)\n\t\tbasic_machine=powerpc-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\tos=$os\"spe\"\n\t\t;;\n\tencore | umax | mmax)\n\t\tbasic_machine=ns32k-encore\n\t\t;;\n\telxsi)\n\t\tbasic_machine=elxsi-elxsi\n\t\tos=${os:-bsd}\n\t\t;;\n\tfx2800)\n\t\tbasic_machine=i860-alliant\n\t\t;;\n\tgenix)\n\t\tbasic_machine=ns32k-ns\n\t\t;;\n\th3050r* | hiux*)\n\t\tbasic_machine=hppa1.1-hitachi\n\t\tos=hiuxwe2\n\t\t;;\n\thp300-*)\n\t\tbasic_machine=m68k-hp\n\t\t;;\n\thp3k9[0-9][0-9] | hp9[0-9][0-9])\n\t\tbasic_machine=hppa1.0-hp\n\t\t;;\n\thp9k2[0-9][0-9] | hp9k31[0-9])\n\t\tbasic_machine=m68000-hp\n\t\t;;\n\thp9k3[2-9][0-9])\n\t\tbasic_machine=m68k-hp\n\t\t;;\n\thp9k6[0-9][0-9] | hp6[0-9][0-9])\n\t\tbasic_machine=hppa1.0-hp\n\t\t;;\n\thp9k7[0-79][0-9] | hp7[0-79][0-9])\n\t\tbasic_machine=hppa1.1-hp\n\t\t;;\n\thp9k78[0-9] | hp78[0-9])\n\t\t# FIXME: really hppa2.0-hp\n\t\tbasic_machine=hppa1.1-hp\n\t\t;;\n\thp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)\n\t\t# FIXME: really hppa2.0-hp\n\t\tbasic_machine=hppa1.1-hp\n\t\t;;\n\thp9k8[0-9][13679] | hp8[0-9][13679])\n\t\tbasic_machine=hppa1.1-hp\n\t\t;;\n\thp9k8[0-9][0-9] | hp8[0-9][0-9])\n\t\tbasic_machine=hppa1.0-hp\n\t\t;;\n\ti370-ibm* | ibm*)\n\t\tbasic_machine=i370-ibm\n\t\t;;\n\ti*86v32)\n\t\tbasic_machine=`echo \"$1\" | sed -e 's/86.*/86-pc/'`\n\t\tos=sysv32\n\t\t;;\n\ti*86v4*)\n\t\tbasic_machine=`echo \"$1\" | sed -e 's/86.*/86-pc/'`\n\t\tos=sysv4\n\t\t;;\n\ti*86v)\n\t\tbasic_machine=`echo \"$1\" | sed -e 's/86.*/86-pc/'`\n\t\tos=sysv\n\t\t;;\n\ti*86sol2)\n\t\tbasic_machine=`echo \"$1\" | sed -e 's/86.*/86-pc/'`\n\t\tos=solaris2\n\t\t;;\n\tj90 | j90-cray)\n\t\tbasic_machine=j90-cray\n\t\tos=${os:-unicos}\n\t\t;;\n\tiris | iris4d)\n\t\tbasic_machine=mips-sgi\n\t\tcase $os in\n\t\t    irix*)\n\t\t\t;;\n\t\t    *)\n\t\t\tos=irix4\n\t\t\t;;\n\t\tesac\n\t\t;;\n\tleon-*|leon[3-9]-*)\n\t\tbasic_machine=sparc-`echo \"$basic_machine\" | sed 's/-.*//'`\n\t\t;;\n\tm68knommu-*)\n\t\tbasic_machine=m68k-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\tos=linux\n\t\t;;\n\tmicroblaze*)\n\t\tbasic_machine=microblaze-xilinx\n\t\t;;\n\tminiframe)\n\t\tbasic_machine=m68000-convergent\n\t\t;;\n\t*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)\n\t\tbasic_machine=m68k-atari\n\t\tos=mint\n\t\t;;\n\tmips3*-*)\n\t\tbasic_machine=`echo \"$basic_machine\" | sed -e 's/mips3/mips64/'`\n\t\t;;\n\tmips3*)\n\t\tbasic_machine=`echo \"$basic_machine\" | sed -e 's/mips3/mips64/'`-unknown\n\t\t;;\n\tms1-*)\n\t\tbasic_machine=`echo \"$basic_machine\" | sed -e 's/ms1-/mt-/'`\n\t\t;;\n\tnews-3600 | risc-news)\n\t\tbasic_machine=mips-sony\n\t\tos=newsos\n\t\t;;\n\tnext | m*-next)\n\t\tbasic_machine=m68k-next\n\t\tcase $os in\n\t\t    nextstep* )\n\t\t\t;;\n\t\t    ns2*)\n\t\t      os=nextstep2\n\t\t\t;;\n\t\t    *)\n\t\t      os=nextstep3\n\t\t\t;;\n\t\tesac\n\t\t;;\n\tnp1)\n\t\tbasic_machine=np1-gould\n\t\t;;\n\tneo-tandem)\n\t\tbasic_machine=neo-tandem\n\t\t;;\n\tnse-tandem)\n\t\tbasic_machine=nse-tandem\n\t\t;;\n\tnsr-tandem)\n\t\tbasic_machine=nsr-tandem\n\t\t;;\n\tnsv-tandem)\n\t\tbasic_machine=nsv-tandem\n\t\t;;\n\tnsx-tandem)\n\t\tbasic_machine=nsx-tandem\n\t\t;;\n\top50n-* | op60c-*)\n\t\tbasic_machine=hppa1.1-oki\n\t\tos=proelf\n\t\t;;\n\topenrisc | openrisc-*)\n\t\tbasic_machine=or32-unknown\n\t\t;;\n\tpa-hitachi)\n\t\tbasic_machine=hppa1.1-hitachi\n\t\tos=hiuxwe2\n\t\t;;\n\tparisc-*)\n\t\tbasic_machine=hppa-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\tos=linux\n\t\t;;\n\tpbd)\n\t\tbasic_machine=sparc-tti\n\t\t;;\n\tpbb)\n\t\tbasic_machine=m68k-tti\n\t\t;;\n\tpc532 | pc532-*)\n\t\tbasic_machine=ns32k-pc532\n\t\t;;\n\tpc98)\n\t\tbasic_machine=i386-pc\n\t\t;;\n\tpc98-*)\n\t\tbasic_machine=i386-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\t;;\n\tpentium | p5 | k5 | k6 | nexgen | viac3)\n\t\tbasic_machine=i586-pc\n\t\t;;\n\tpentiumpro | p6 | 6x86 | athlon | athlon_*)\n\t\tbasic_machine=i686-pc\n\t\t;;\n\tpentiumii | pentium2 | pentiumiii | pentium3)\n\t\tbasic_machine=i686-pc\n\t\t;;\n\tpentium4)\n\t\tbasic_machine=i786-pc\n\t\t;;\n\tpentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)\n\t\tbasic_machine=i586-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\t;;\n\tpentiumpro-* | p6-* | 6x86-* | athlon-*)\n\t\tbasic_machine=i686-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\t;;\n\tpentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)\n\t\tbasic_machine=i686-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\t;;\n\tpentium4-*)\n\t\tbasic_machine=i786-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\t;;\n\tpn)\n\t\tbasic_machine=pn-gould\n\t\t;;\n\tpower)\tbasic_machine=power-ibm\n\t\t;;\n\tppc | ppcbe)\tbasic_machine=powerpc-unknown\n\t\t;;\n\tppc-* | ppcbe-*)\n\t\tbasic_machine=powerpc-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\t;;\n\tppcle | powerpclittle)\n\t\tbasic_machine=powerpcle-unknown\n\t\t;;\n\tppcle-* | powerpclittle-*)\n\t\tbasic_machine=powerpcle-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\t;;\n\tppc64)\tbasic_machine=powerpc64-unknown\n\t\t;;\n\tppc64-*) basic_machine=powerpc64-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\t;;\n\tppc64le | powerpc64little)\n\t\tbasic_machine=powerpc64le-unknown\n\t\t;;\n\tppc64le-* | powerpc64little-*)\n\t\tbasic_machine=powerpc64le-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\t;;\n\tps2)\n\t\tbasic_machine=i386-ibm\n\t\t;;\n\trm[46]00)\n\t\tbasic_machine=mips-siemens\n\t\t;;\n\trtpc | rtpc-*)\n\t\tbasic_machine=romp-ibm\n\t\t;;\n\ts390 | s390-*)\n\t\tbasic_machine=s390-ibm\n\t\t;;\n\ts390x | s390x-*)\n\t\tbasic_machine=s390x-ibm\n\t\t;;\n\tsb1)\n\t\tbasic_machine=mipsisa64sb1-unknown\n\t\t;;\n\tsb1el)\n\t\tbasic_machine=mipsisa64sb1el-unknown\n\t\t;;\n\tsde)\n\t\tbasic_machine=mipsisa32-sde\n\t\tos=${os:-elf}\n\t\t;;\n\tsequent)\n\t\tbasic_machine=i386-sequent\n\t\t;;\n\tsh5el)\n\t\tbasic_machine=sh5le-unknown\n\t\t;;\n\tsimso-wrs)\n\t\tbasic_machine=sparclite-wrs\n\t\tos=vxworks\n\t\t;;\n\tspur)\n\t\tbasic_machine=spur-unknown\n\t\t;;\n\tst2000)\n\t\tbasic_machine=m68k-tandem\n\t\t;;\n\tstrongarm-* | thumb-*)\n\t\tbasic_machine=arm-`echo \"$basic_machine\" | sed 's/^[^-]*-//'`\n\t\t;;\n\tsun2)\n\t\tbasic_machine=m68000-sun\n\t\t;;\n\tsun3 | sun3-*)\n\t\tbasic_machine=m68k-sun\n\t\t;;\n\tsun4)\n\t\tbasic_machine=sparc-sun\n\t\t;;\n\tsun386 | sun386i | roadrunner)\n\t\tbasic_machine=i386-sun\n\t\t;;\n\ttile*)\n\t\tbasic_machine=$basic_machine-unknown\n\t\tos=linux-gnu\n\t\t;;\n\ttx39)\n\t\tbasic_machine=mipstx39-unknown\n\t\t;;\n\ttx39el)\n\t\tbasic_machine=mipstx39el-unknown\n\t\t;;\n\ttower | tower-32)\n\t\tbasic_machine=m68k-ncr\n\t\t;;\n\tvpp*|vx|vx-*)\n\t\tbasic_machine=f301-fujitsu\n\t\t;;\n\tw65*)\n\t\tbasic_machine=w65-wdc\n\t\tos=none\n\t\t;;\n\tw89k-*)\n\t\tbasic_machine=hppa1.1-winbond\n\t\tos=proelf\n\t\t;;\n\tx64)\n\t\tbasic_machine=x86_64-pc\n\t\t;;\n\txps | xps100)\n\t\tbasic_machine=xps100-honeywell\n\t\t;;\n\txscale-* | xscalee[bl]-*)\n\t\tbasic_machine=`echo \"$basic_machine\" | sed 's/^xscale/arm/'`\n\t\t;;\n\tnone)\n\t\tbasic_machine=none-none\n\t\tos=${os:-none}\n\t\t;;\n\n# Here we handle the default manufacturer of certain CPU types.  It is in\n# some cases the only manufacturer, in others, it is the most popular.\n\tw89k)\n\t\tbasic_machine=hppa1.1-winbond\n\t\t;;\n\top50n)\n\t\tbasic_machine=hppa1.1-oki\n\t\t;;\n\top60c)\n\t\tbasic_machine=hppa1.1-oki\n\t\t;;\n\tromp)\n\t\tbasic_machine=romp-ibm\n\t\t;;\n\tmmix)\n\t\tbasic_machine=mmix-knuth\n\t\t;;\n\trs6000)\n\t\tbasic_machine=rs6000-ibm\n\t\t;;\n\tvax)\n\t\tbasic_machine=vax-dec\n\t\t;;\n\tpdp11)\n\t\tbasic_machine=pdp11-dec\n\t\t;;\n\twe32k)\n\t\tbasic_machine=we32k-att\n\t\t;;\n\tsh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)\n\t\tbasic_machine=sh-unknown\n\t\t;;\n\tcydra)\n\t\tbasic_machine=cydra-cydrome\n\t\t;;\n\torion)\n\t\tbasic_machine=orion-highlevel\n\t\t;;\n\torion105)\n\t\tbasic_machine=clipper-highlevel\n\t\t;;\n\tmac | mpw | mac-mpw)\n\t\tbasic_machine=m68k-apple\n\t\t;;\n\tpmac | pmac-mpw)\n\t\tbasic_machine=powerpc-apple\n\t\t;;\n\t*)\n\t\techo Invalid configuration \\`\"$1\"\\': machine \\`\"$basic_machine\"\\' not recognized 1>&2\n\t\texit 1\n\t\t;;\nesac\n\n# Here we canonicalize certain aliases for manufacturers.\ncase $basic_machine in\n\t*-digital*)\n\t\tbasic_machine=`echo \"$basic_machine\" | sed 's/digital.*/dec/'`\n\t\t;;\n\t*-commodore*)\n\t\tbasic_machine=`echo \"$basic_machine\" | sed 's/commodore.*/cbm/'`\n\t\t;;\n\t*)\n\t\t;;\nesac\n\n# Decode manufacturer-specific aliases for certain operating systems.\n\nif [ x$os != x ]\nthen\ncase $os in\n\t# First match some system type aliases that might get confused\n\t# with valid system types.\n\t# solaris* is a basic system type, with this one exception.\n\tauroraux)\n\t\tos=auroraux\n\t\t;;\n\tbluegene*)\n\t\tos=cnk\n\t\t;;\n\tsolaris1 | solaris1.*)\n\t\tos=`echo $os | sed -e 's|solaris1|sunos4|'`\n\t\t;;\n\tsolaris)\n\t\tos=solaris2\n\t\t;;\n\tunixware*)\n\t\tos=sysv4.2uw\n\t\t;;\n\tgnu/linux*)\n\t\tos=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`\n\t\t;;\n\t# es1800 is here to avoid being matched by es* (a different OS)\n\tes1800*)\n\t\tos=ose\n\t\t;;\n\t# Some version numbers need modification\n\tchorusos*)\n\t\tos=chorusos\n\t\t;;\n\tisc)\n\t\tos=isc2.2\n\t\t;;\n\tsco6)\n\t\tos=sco5v6\n\t\t;;\n\tsco5)\n\t\tos=sco3.2v5\n\t\t;;\n\tsco4)\n\t\tos=sco3.2v4\n\t\t;;\n\tsco3.2.[4-9]*)\n\t\tos=`echo $os | sed -e 's/sco3.2./sco3.2v/'`\n\t\t;;\n\tsco3.2v[4-9]* | sco5v6*)\n\t\t# Don't forget version if it is 3.2v4 or newer.\n\t\t;;\n\tscout)\n\t\t# Don't match below\n\t\t;;\n\tsco*)\n\t\tos=sco3.2v2\n\t\t;;\n\tpsos*)\n\t\tos=psos\n\t\t;;\n\t# Now accept the basic system types.\n\t# The portable systems comes first.\n\t# Each alternative MUST end in a * to match a version number.\n\t# sysv* is not here because it comes later, after sysvr4.\n\tgnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \\\n\t     | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\\\n\t     | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \\\n\t     | sym* | kopensolaris* | plan9* \\\n\t     | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \\\n\t     | aos* | aros* | cloudabi* | sortix* \\\n\t     | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \\\n\t     | clix* | riscos* | uniplus* | iris* | rtu* | xenix* \\\n\t     | knetbsd* | mirbsd* | netbsd* \\\n\t     | bitrig* | openbsd* | solidbsd* | libertybsd* \\\n\t     | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \\\n\t     | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \\\n\t     | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \\\n\t     | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \\\n\t     | chorusrdb* | cegcc* | glidix* \\\n\t     | cygwin* | msys* | pe* | moss* | proelf* | rtems* \\\n\t     | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \\\n\t     | linux-newlib* | linux-musl* | linux-uclibc* \\\n\t     | uxpv* | beos* | mpeix* | udk* | moxiebox* \\\n\t     | interix* | uwin* | mks* | rhapsody* | darwin* \\\n\t     | openstep* | oskit* | conix* | pw32* | nonstopux* \\\n\t     | storm-chaos* | tops10* | tenex* | tops20* | its* \\\n\t     | os2* | vos* | palmos* | uclinux* | nucleus* \\\n\t     | morphos* | superux* | rtmk* | windiss* \\\n\t     | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \\\n\t     | skyos* | haiku* | rdos* | toppers* | drops* | es* \\\n\t     | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \\\n\t     | midnightbsd*)\n\t# Remember, each alternative MUST END IN *, to match a version number.\n\t\t;;\n\tqnx*)\n\t\tcase $basic_machine in\n\t\t    x86-* | i*86-*)\n\t\t\t;;\n\t\t    *)\n\t\t\tos=nto-$os\n\t\t\t;;\n\t\tesac\n\t\t;;\n\thiux*)\n\t\tos=hiuxwe2\n\t\t;;\n\tnto-qnx*)\n\t\t;;\n\tnto*)\n\t\tos=`echo $os | sed -e 's|nto|nto-qnx|'`\n\t\t;;\n\tsim | xray | os68k* | v88r* \\\n\t    | windows* | osx | abug | netware* | os9* \\\n\t    | macos* | mpw* | magic* | mmixware* | mon960* | lnews*)\n\t\t;;\n\tlinux-dietlibc)\n\t\tos=linux-dietlibc\n\t\t;;\n\tlinux*)\n\t\tos=`echo $os | sed -e 's|linux|linux-gnu|'`\n\t\t;;\n\tlynx*178)\n\t\tos=lynxos178\n\t\t;;\n\tlynx*5)\n\t\tos=lynxos5\n\t\t;;\n\tlynx*)\n\t\tos=lynxos\n\t\t;;\n\tmac*)\n\t\tos=`echo \"$os\" | sed -e 's|mac|macos|'`\n\t\t;;\n\topened*)\n\t\tos=openedition\n\t\t;;\n\tos400*)\n\t\tos=os400\n\t\t;;\n\tsunos5*)\n\t\tos=`echo \"$os\" | sed -e 's|sunos5|solaris2|'`\n\t\t;;\n\tsunos6*)\n\t\tos=`echo \"$os\" | sed -e 's|sunos6|solaris3|'`\n\t\t;;\n\twince*)\n\t\tos=wince\n\t\t;;\n\tutek*)\n\t\tos=bsd\n\t\t;;\n\tdynix*)\n\t\tos=bsd\n\t\t;;\n\tacis*)\n\t\tos=aos\n\t\t;;\n\tatheos*)\n\t\tos=atheos\n\t\t;;\n\tsyllable*)\n\t\tos=syllable\n\t\t;;\n\t386bsd)\n\t\tos=bsd\n\t\t;;\n\tctix* | uts*)\n\t\tos=sysv\n\t\t;;\n\tnova*)\n\t\tos=rtmk-nova\n\t\t;;\n\tns2)\n\t\tos=nextstep2\n\t\t;;\n\tnsk*)\n\t\tos=nsk\n\t\t;;\n\t# Preserve the version number of sinix5.\n\tsinix5.*)\n\t\tos=`echo $os | sed -e 's|sinix|sysv|'`\n\t\t;;\n\tsinix*)\n\t\tos=sysv4\n\t\t;;\n\ttpf*)\n\t\tos=tpf\n\t\t;;\n\ttriton*)\n\t\tos=sysv3\n\t\t;;\n\toss*)\n\t\tos=sysv3\n\t\t;;\n\tsvr4*)\n\t\tos=sysv4\n\t\t;;\n\tsvr3)\n\t\tos=sysv3\n\t\t;;\n\tsysvr4)\n\t\tos=sysv4\n\t\t;;\n\t# This must come after sysvr4.\n\tsysv*)\n\t\t;;\n\tose*)\n\t\tos=ose\n\t\t;;\n\t*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)\n\t\tos=mint\n\t\t;;\n\tzvmoe)\n\t\tos=zvmoe\n\t\t;;\n\tdicos*)\n\t\tos=dicos\n\t\t;;\n\tpikeos*)\n\t\t# Until real need of OS specific support for\n\t\t# particular features comes up, bare metal\n\t\t# configurations are quite functional.\n\t\tcase $basic_machine in\n\t\t    arm*)\n\t\t\tos=eabi\n\t\t\t;;\n\t\t    *)\n\t\t\tos=elf\n\t\t\t;;\n\t\tesac\n\t\t;;\n\tnacl*)\n\t\t;;\n\tios)\n\t\t;;\n\tnone)\n\t\t;;\n\t*-eabi)\n\t\t;;\n\t*)\n\t\techo Invalid configuration \\`\"$1\"\\': system \\`\"$os\"\\' not recognized 1>&2\n\t\texit 1\n\t\t;;\nesac\nelse\n\n# Here we handle the default operating systems that come with various machines.\n# The value should be what the vendor currently ships out the door with their\n# machine or put another way, the most popular os provided with the machine.\n\n# Note that if you're going to try to match \"-MANUFACTURER\" here (say,\n# \"-sun\"), then you have to tell the case statement up towards the top\n# that MANUFACTURER isn't an operating system.  Otherwise, code above\n# will signal an error saying that MANUFACTURER isn't an operating\n# system, and we'll never get to this point.\n\ncase $basic_machine in\n\tscore-*)\n\t\tos=elf\n\t\t;;\n\tspu-*)\n\t\tos=elf\n\t\t;;\n\t*-acorn)\n\t\tos=riscix1.2\n\t\t;;\n\tarm*-rebel)\n\t\tos=linux\n\t\t;;\n\tarm*-semi)\n\t\tos=aout\n\t\t;;\n\tc4x-* | tic4x-*)\n\t\tos=coff\n\t\t;;\n\tc8051-*)\n\t\tos=elf\n\t\t;;\n\tclipper-intergraph)\n\t\tos=clix\n\t\t;;\n\thexagon-*)\n\t\tos=elf\n\t\t;;\n\ttic54x-*)\n\t\tos=coff\n\t\t;;\n\ttic55x-*)\n\t\tos=coff\n\t\t;;\n\ttic6x-*)\n\t\tos=coff\n\t\t;;\n\t# This must come before the *-dec entry.\n\tpdp10-*)\n\t\tos=tops20\n\t\t;;\n\tpdp11-*)\n\t\tos=none\n\t\t;;\n\t*-dec | vax-*)\n\t\tos=ultrix4.2\n\t\t;;\n\tm68*-apollo)\n\t\tos=domain\n\t\t;;\n\ti386-sun)\n\t\tos=sunos4.0.2\n\t\t;;\n\tm68000-sun)\n\t\tos=sunos3\n\t\t;;\n\tm68*-cisco)\n\t\tos=aout\n\t\t;;\n\tmep-*)\n\t\tos=elf\n\t\t;;\n\tmips*-cisco)\n\t\tos=elf\n\t\t;;\n\tmips*-*)\n\t\tos=elf\n\t\t;;\n\tor32-*)\n\t\tos=coff\n\t\t;;\n\t*-tti)\t# must be before sparc entry or we get the wrong os.\n\t\tos=sysv3\n\t\t;;\n\tsparc-* | *-sun)\n\t\tos=sunos4.1.1\n\t\t;;\n\tpru-*)\n\t\tos=elf\n\t\t;;\n\t*-be)\n\t\tos=beos\n\t\t;;\n\t*-ibm)\n\t\tos=aix\n\t\t;;\n\t*-knuth)\n\t\tos=mmixware\n\t\t;;\n\t*-wec)\n\t\tos=proelf\n\t\t;;\n\t*-winbond)\n\t\tos=proelf\n\t\t;;\n\t*-oki)\n\t\tos=proelf\n\t\t;;\n\t*-hp)\n\t\tos=hpux\n\t\t;;\n\t*-hitachi)\n\t\tos=hiux\n\t\t;;\n\ti860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)\n\t\tos=sysv\n\t\t;;\n\t*-cbm)\n\t\tos=amigaos\n\t\t;;\n\t*-dg)\n\t\tos=dgux\n\t\t;;\n\t*-dolphin)\n\t\tos=sysv3\n\t\t;;\n\tm68k-ccur)\n\t\tos=rtu\n\t\t;;\n\tm88k-omron*)\n\t\tos=luna\n\t\t;;\n\t*-next)\n\t\tos=nextstep\n\t\t;;\n\t*-sequent)\n\t\tos=ptx\n\t\t;;\n\t*-crds)\n\t\tos=unos\n\t\t;;\n\t*-ns)\n\t\tos=genix\n\t\t;;\n\ti370-*)\n\t\tos=mvs\n\t\t;;\n\t*-gould)\n\t\tos=sysv\n\t\t;;\n\t*-highlevel)\n\t\tos=bsd\n\t\t;;\n\t*-encore)\n\t\tos=bsd\n\t\t;;\n\t*-sgi)\n\t\tos=irix\n\t\t;;\n\t*-siemens)\n\t\tos=sysv4\n\t\t;;\n\t*-masscomp)\n\t\tos=rtu\n\t\t;;\n\tf30[01]-fujitsu | f700-fujitsu)\n\t\tos=uxpv\n\t\t;;\n\t*-rom68k)\n\t\tos=coff\n\t\t;;\n\t*-*bug)\n\t\tos=coff\n\t\t;;\n\t*-apple)\n\t\tos=macos\n\t\t;;\n\t*-atari*)\n\t\tos=mint\n\t\t;;\n\t*-wrs)\n\t\tos=vxworks\n\t\t;;\n\t*)\n\t\tos=none\n\t\t;;\nesac\nfi\n\n# Here we handle the case where we know the os, and the CPU type, but not the\n# manufacturer.  We pick the logical manufacturer.\nvendor=unknown\ncase $basic_machine in\n\t*-unknown)\n\t\tcase $os in\n\t\t\triscix*)\n\t\t\t\tvendor=acorn\n\t\t\t\t;;\n\t\t\tsunos*)\n\t\t\t\tvendor=sun\n\t\t\t\t;;\n\t\t\tcnk*|-aix*)\n\t\t\t\tvendor=ibm\n\t\t\t\t;;\n\t\t\tbeos*)\n\t\t\t\tvendor=be\n\t\t\t\t;;\n\t\t\thpux*)\n\t\t\t\tvendor=hp\n\t\t\t\t;;\n\t\t\tmpeix*)\n\t\t\t\tvendor=hp\n\t\t\t\t;;\n\t\t\thiux*)\n\t\t\t\tvendor=hitachi\n\t\t\t\t;;\n\t\t\tunos*)\n\t\t\t\tvendor=crds\n\t\t\t\t;;\n\t\t\tdgux*)\n\t\t\t\tvendor=dg\n\t\t\t\t;;\n\t\t\tluna*)\n\t\t\t\tvendor=omron\n\t\t\t\t;;\n\t\t\tgenix*)\n\t\t\t\tvendor=ns\n\t\t\t\t;;\n\t\t\tclix*)\n\t\t\t\tvendor=intergraph\n\t\t\t\t;;\n\t\t\tmvs* | opened*)\n\t\t\t\tvendor=ibm\n\t\t\t\t;;\n\t\t\tos400*)\n\t\t\t\tvendor=ibm\n\t\t\t\t;;\n\t\t\tptx*)\n\t\t\t\tvendor=sequent\n\t\t\t\t;;\n\t\t\ttpf*)\n\t\t\t\tvendor=ibm\n\t\t\t\t;;\n\t\t\tvxsim* | vxworks* | windiss*)\n\t\t\t\tvendor=wrs\n\t\t\t\t;;\n\t\t\taux*)\n\t\t\t\tvendor=apple\n\t\t\t\t;;\n\t\t\thms*)\n\t\t\t\tvendor=hitachi\n\t\t\t\t;;\n\t\t\tmpw* | macos*)\n\t\t\t\tvendor=apple\n\t\t\t\t;;\n\t\t\t*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)\n\t\t\t\tvendor=atari\n\t\t\t\t;;\n\t\t\tvos*)\n\t\t\t\tvendor=stratus\n\t\t\t\t;;\n\t\tesac\n\t\tbasic_machine=`echo \"$basic_machine\" | sed \"s/unknown/$vendor/\"`\n\t\t;;\nesac\n\necho \"$basic_machine-$os\"\nexit\n\n# Local variables:\n# eval: (add-hook 'before-save-hook 'time-stamp)\n# time-stamp-start: \"timestamp='\"\n# time-stamp-format: \"%:y-%02m-%02d\"\n# time-stamp-end: \"'\"\n# End:\n"},{"className":"_WCSAxesArtist","col":0,"comment":"This is a dummy artist to enforce the correct z-order of axis ticks,\n    tick labels, and gridlines.\n\n    FIXME: This is a bit of a hack. ``Axes.draw`` sorts the artists by zorder\n    and then renders them in sequence. For normal Matplotlib axes, the ticks,\n    tick labels, and gridlines are included in this list of artists and hence\n    are automatically drawn in the correct order. However, ``WCSAxes`` disables\n    the native ticks, labels, and gridlines. Instead, ``WCSAxes.draw`` renders\n    ersatz ticks, labels, and gridlines by explicitly calling the functions\n    ``CoordinateHelper._draw_ticks``, ``CoordinateHelper._draw_grid``, etc.\n    This hack would not be necessary if ``WCSAxes`` drew ticks, tick labels,\n    and gridlines in the standary way.","endLoc":45,"id":16622,"nodeType":"Class","startLoc":30,"text":"class _WCSAxesArtist(Artist):\n    \"\"\"This is a dummy artist to enforce the correct z-order of axis ticks,\n    tick labels, and gridlines.\n\n    FIXME: This is a bit of a hack. ``Axes.draw`` sorts the artists by zorder\n    and then renders them in sequence. For normal Matplotlib axes, the ticks,\n    tick labels, and gridlines are included in this list of artists and hence\n    are automatically drawn in the correct order. However, ``WCSAxes`` disables\n    the native ticks, labels, and gridlines. Instead, ``WCSAxes.draw`` renders\n    ersatz ticks, labels, and gridlines by explicitly calling the functions\n    ``CoordinateHelper._draw_ticks``, ``CoordinateHelper._draw_grid``, etc.\n    This hack would not be necessary if ``WCSAxes`` drew ticks, tick labels,\n    and gridlines in the standary way.\"\"\"\n\n    def draw(self, renderer, *args, **kwargs):\n        self.axes.draw_wcsaxes(renderer)"},{"id":16623,"name":"wcsulex.c","nodeType":"TextFile","path":"cextern/wcslib/C/flexed","text":"#line 2 \"wcsulex.c\"\n\n#line 4 \"wcsulex.c\"\n\n#define _POSIX_C_SOURCE 1\n#define  YY_INT_ALIGNED short int\n\n/* A lexical scanner generated by flex */\n\n#define FLEX_SCANNER\n#define YY_FLEX_MAJOR_VERSION 2\n#define YY_FLEX_MINOR_VERSION 6\n#define YY_FLEX_SUBMINOR_VERSION 4\n#if YY_FLEX_SUBMINOR_VERSION > 0\n#define FLEX_BETA\n#endif\n\n#ifdef yy_create_buffer\n#define wcsulex_create_buffer_ALREADY_DEFINED\n#else\n#define yy_create_buffer wcsulex_create_buffer\n#endif\n\n#ifdef yy_delete_buffer\n#define wcsulex_delete_buffer_ALREADY_DEFINED\n#else\n#define yy_delete_buffer wcsulex_delete_buffer\n#endif\n\n#ifdef yy_scan_buffer\n#define wcsulex_scan_buffer_ALREADY_DEFINED\n#else\n#define yy_scan_buffer wcsulex_scan_buffer\n#endif\n\n#ifdef yy_scan_string\n#define wcsulex_scan_string_ALREADY_DEFINED\n#else\n#define yy_scan_string wcsulex_scan_string\n#endif\n\n#ifdef yy_scan_bytes\n#define wcsulex_scan_bytes_ALREADY_DEFINED\n#else\n#define yy_scan_bytes wcsulex_scan_bytes\n#endif\n\n#ifdef yy_init_buffer\n#define wcsulex_init_buffer_ALREADY_DEFINED\n#else\n#define yy_init_buffer wcsulex_init_buffer\n#endif\n\n#ifdef yy_flush_buffer\n#define wcsulex_flush_buffer_ALREADY_DEFINED\n#else\n#define yy_flush_buffer wcsulex_flush_buffer\n#endif\n\n#ifdef yy_load_buffer_state\n#define wcsulex_load_buffer_state_ALREADY_DEFINED\n#else\n#define yy_load_buffer_state wcsulex_load_buffer_state\n#endif\n\n#ifdef yy_switch_to_buffer\n#define wcsulex_switch_to_buffer_ALREADY_DEFINED\n#else\n#define yy_switch_to_buffer wcsulex_switch_to_buffer\n#endif\n\n#ifdef yypush_buffer_state\n#define wcsulexpush_buffer_state_ALREADY_DEFINED\n#else\n#define yypush_buffer_state wcsulexpush_buffer_state\n#endif\n\n#ifdef yypop_buffer_state\n#define wcsulexpop_buffer_state_ALREADY_DEFINED\n#else\n#define yypop_buffer_state wcsulexpop_buffer_state\n#endif\n\n#ifdef yyensure_buffer_stack\n#define wcsulexensure_buffer_stack_ALREADY_DEFINED\n#else\n#define yyensure_buffer_stack wcsulexensure_buffer_stack\n#endif\n\n#ifdef yylex\n#define wcsulexlex_ALREADY_DEFINED\n#else\n#define yylex wcsulexlex\n#endif\n\n#ifdef yyrestart\n#define wcsulexrestart_ALREADY_DEFINED\n#else\n#define yyrestart wcsulexrestart\n#endif\n\n#ifdef yylex_init\n#define wcsulexlex_init_ALREADY_DEFINED\n#else\n#define yylex_init wcsulexlex_init\n#endif\n\n#ifdef yylex_init_extra\n#define wcsulexlex_init_extra_ALREADY_DEFINED\n#else\n#define yylex_init_extra wcsulexlex_init_extra\n#endif\n\n#ifdef yylex_destroy\n#define wcsulexlex_destroy_ALREADY_DEFINED\n#else\n#define yylex_destroy wcsulexlex_destroy\n#endif\n\n#ifdef yyget_debug\n#define wcsulexget_debug_ALREADY_DEFINED\n#else\n#define yyget_debug wcsulexget_debug\n#endif\n\n#ifdef yyset_debug\n#define wcsulexset_debug_ALREADY_DEFINED\n#else\n#define yyset_debug wcsulexset_debug\n#endif\n\n#ifdef yyget_extra\n#define wcsulexget_extra_ALREADY_DEFINED\n#else\n#define yyget_extra wcsulexget_extra\n#endif\n\n#ifdef yyset_extra\n#define wcsulexset_extra_ALREADY_DEFINED\n#else\n#define yyset_extra wcsulexset_extra\n#endif\n\n#ifdef yyget_in\n#define wcsulexget_in_ALREADY_DEFINED\n#else\n#define yyget_in wcsulexget_in\n#endif\n\n#ifdef yyset_in\n#define wcsulexset_in_ALREADY_DEFINED\n#else\n#define yyset_in wcsulexset_in\n#endif\n\n#ifdef yyget_out\n#define wcsulexget_out_ALREADY_DEFINED\n#else\n#define yyget_out wcsulexget_out\n#endif\n\n#ifdef yyset_out\n#define wcsulexset_out_ALREADY_DEFINED\n#else\n#define yyset_out wcsulexset_out\n#endif\n\n#ifdef yyget_leng\n#define wcsulexget_leng_ALREADY_DEFINED\n#else\n#define yyget_leng wcsulexget_leng\n#endif\n\n#ifdef yyget_text\n#define wcsulexget_text_ALREADY_DEFINED\n#else\n#define yyget_text wcsulexget_text\n#endif\n\n#ifdef yyget_lineno\n#define wcsulexget_lineno_ALREADY_DEFINED\n#else\n#define yyget_lineno wcsulexget_lineno\n#endif\n\n#ifdef yyset_lineno\n#define wcsulexset_lineno_ALREADY_DEFINED\n#else\n#define yyset_lineno wcsulexset_lineno\n#endif\n\n#ifdef yyget_column\n#define wcsulexget_column_ALREADY_DEFINED\n#else\n#define yyget_column wcsulexget_column\n#endif\n\n#ifdef yyset_column\n#define wcsulexset_column_ALREADY_DEFINED\n#else\n#define yyset_column wcsulexset_column\n#endif\n\n#ifdef yywrap\n#define wcsulexwrap_ALREADY_DEFINED\n#else\n#define yywrap wcsulexwrap\n#endif\n\n#ifdef yyalloc\n#define wcsulexalloc_ALREADY_DEFINED\n#else\n#define yyalloc wcsulexalloc\n#endif\n\n#ifdef yyrealloc\n#define wcsulexrealloc_ALREADY_DEFINED\n#else\n#define yyrealloc wcsulexrealloc\n#endif\n\n#ifdef yyfree\n#define wcsulexfree_ALREADY_DEFINED\n#else\n#define yyfree wcsulexfree\n#endif\n\n/* First, we deal with  platform-specific or compiler-specific issues. */\n\n/* begin standard C headers. */\n#include <stdio.h>\n#include <string.h>\n#include <errno.h>\n#include <stdlib.h>\n\n/* end standard C headers. */\n\n/* flex integer type definitions */\n\n#ifndef FLEXINT_H\n#define FLEXINT_H\n\n/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */\n\n#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\n\n/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,\n * if you want the limit (max/min) macros for int types. \n */\n#ifndef __STDC_LIMIT_MACROS\n#define __STDC_LIMIT_MACROS 1\n#endif\n\n#include <inttypes.h>\ntypedef int8_t flex_int8_t;\ntypedef uint8_t flex_uint8_t;\ntypedef int16_t flex_int16_t;\ntypedef uint16_t flex_uint16_t;\ntypedef int32_t flex_int32_t;\ntypedef uint32_t flex_uint32_t;\n#else\ntypedef signed char flex_int8_t;\ntypedef short int flex_int16_t;\ntypedef int flex_int32_t;\ntypedef unsigned char flex_uint8_t; \ntypedef unsigned short int flex_uint16_t;\ntypedef unsigned int flex_uint32_t;\n\n/* Limits of integral types. */\n#ifndef INT8_MIN\n#define INT8_MIN               (-128)\n#endif\n#ifndef INT16_MIN\n#define INT16_MIN              (-32767-1)\n#endif\n#ifndef INT32_MIN\n#define INT32_MIN              (-2147483647-1)\n#endif\n#ifndef INT8_MAX\n#define INT8_MAX               (127)\n#endif\n#ifndef INT16_MAX\n#define INT16_MAX              (32767)\n#endif\n#ifndef INT32_MAX\n#define INT32_MAX              (2147483647)\n#endif\n#ifndef UINT8_MAX\n#define UINT8_MAX              (255U)\n#endif\n#ifndef UINT16_MAX\n#define UINT16_MAX             (65535U)\n#endif\n#ifndef UINT32_MAX\n#define UINT32_MAX             (4294967295U)\n#endif\n\n#ifndef SIZE_MAX\n#define SIZE_MAX               (~(size_t)0)\n#endif\n\n#endif /* ! C99 */\n\n#endif /* ! FLEXINT_H */\n\n/* begin standard C++ headers. */\n\n/* TODO: this is always defined, so inline it */\n#define yyconst const\n\n#if defined(__GNUC__) && __GNUC__ >= 3\n#define yynoreturn __attribute__((__noreturn__))\n#else\n#define yynoreturn\n#endif\n\n/* Returned upon end-of-file. */\n#define YY_NULL 0\n\n/* Promotes a possibly negative, possibly signed char to an\n *   integer in range [0..255] for use as an array index.\n */\n#define YY_SC_TO_UI(c) ((YY_CHAR) (c))\n\n/* An opaque pointer. */\n#ifndef YY_TYPEDEF_YY_SCANNER_T\n#define YY_TYPEDEF_YY_SCANNER_T\ntypedef void* yyscan_t;\n#endif\n\n/* For convenience, these vars (plus the bison vars far below)\n   are macros in the reentrant scanner. */\n#define yyin yyg->yyin_r\n#define yyout yyg->yyout_r\n#define yyextra yyg->yyextra_r\n#define yyleng yyg->yyleng_r\n#define yytext yyg->yytext_r\n#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)\n#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)\n#define yy_flex_debug yyg->yy_flex_debug_r\n\n/* Enter a start condition.  This macro really ought to take a parameter,\n * but we do it the disgusting crufty way forced on us by the ()-less\n * definition of BEGIN.\n */\n#define BEGIN yyg->yy_start = 1 + 2 *\n/* Translate the current start state into a value that can be later handed\n * to BEGIN to return to the state.  The YYSTATE alias is for lex\n * compatibility.\n */\n#define YY_START ((yyg->yy_start - 1) / 2)\n#define YYSTATE YY_START\n/* Action number for EOF rule of a given start state. */\n#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)\n/* Special action meaning \"start processing a new file\". */\n#define YY_NEW_FILE yyrestart( yyin , yyscanner )\n#define YY_END_OF_BUFFER_CHAR 0\n\n/* Size of default input buffer. */\n#ifndef YY_BUF_SIZE\n#ifdef __ia64__\n/* On IA-64, the buffer size is 16k, not 8k.\n * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.\n * Ditto for the __ia64__ case accordingly.\n */\n#define YY_BUF_SIZE 32768\n#else\n#define YY_BUF_SIZE 16384\n#endif /* __ia64__ */\n#endif\n\n/* The state buf must be large enough to hold one state per character in the main buffer.\n */\n#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))\n\n#ifndef YY_TYPEDEF_YY_BUFFER_STATE\n#define YY_TYPEDEF_YY_BUFFER_STATE\ntypedef struct yy_buffer_state *YY_BUFFER_STATE;\n#endif\n\n#ifndef YY_TYPEDEF_YY_SIZE_T\n#define YY_TYPEDEF_YY_SIZE_T\ntypedef size_t yy_size_t;\n#endif\n\n#define EOB_ACT_CONTINUE_SCAN 0\n#define EOB_ACT_END_OF_FILE 1\n#define EOB_ACT_LAST_MATCH 2\n    \n#define YY_LESS_LINENO(n)\n#define YY_LINENO_REWIND_TO(ptr)\n    \n/* Return all but the first \"n\" matched characters back to the input stream. */\n#define yyless(n) \\\n\tdo \\\n\t\t{ \\\n\t\t/* Undo effects of setting up yytext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\t*yy_cp = yyg->yy_hold_char; \\\n\t\tYY_RESTORE_YY_MORE_OFFSET \\\n\t\tyyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \\\n\t\tYY_DO_BEFORE_ACTION; /* set up yytext again */ \\\n\t\t} \\\n\twhile ( 0 )\n#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )\n\n#ifndef YY_STRUCT_YY_BUFFER_STATE\n#define YY_STRUCT_YY_BUFFER_STATE\nstruct yy_buffer_state\n\t{\n\tFILE *yy_input_file;\n\n\tchar *yy_ch_buf;\t\t/* input buffer */\n\tchar *yy_buf_pos;\t\t/* current position in input buffer */\n\n\t/* Size of input buffer in bytes, not including room for EOB\n\t * characters.\n\t */\n\tint yy_buf_size;\n\n\t/* Number of characters read into yy_ch_buf, not including EOB\n\t * characters.\n\t */\n\tint yy_n_chars;\n\n\t/* Whether we \"own\" the buffer - i.e., we know we created it,\n\t * and can realloc() it to grow it, and should free() it to\n\t * delete it.\n\t */\n\tint yy_is_our_buffer;\n\n\t/* Whether this is an \"interactive\" input source; if so, and\n\t * if we're using stdio for input, then we want to use getc()\n\t * instead of fread(), to make sure we stop fetching input after\n\t * each newline.\n\t */\n\tint yy_is_interactive;\n\n\t/* Whether we're considered to be at the beginning of a line.\n\t * If so, '^' rules will be active on the next match, otherwise\n\t * not.\n\t */\n\tint yy_at_bol;\n\n    int yy_bs_lineno; /**< The line count. */\n    int yy_bs_column; /**< The column count. */\n\n\t/* Whether to try to fill the input buffer when we reach the\n\t * end of it.\n\t */\n\tint yy_fill_buffer;\n\n\tint yy_buffer_status;\n\n#define YY_BUFFER_NEW 0\n#define YY_BUFFER_NORMAL 1\n\t/* When an EOF's been seen but there's still some text to process\n\t * then we mark the buffer as YY_EOF_PENDING, to indicate that we\n\t * shouldn't try reading from the input source any more.  We might\n\t * still have a bunch of tokens to match, though, because of\n\t * possible backing-up.\n\t *\n\t * When we actually see the EOF, we change the status to \"new\"\n\t * (via yyrestart()), so that the user can continue scanning by\n\t * just pointing yyin at a new input file.\n\t */\n#define YY_BUFFER_EOF_PENDING 2\n\n\t};\n#endif /* !YY_STRUCT_YY_BUFFER_STATE */\n\n/* We provide macros for accessing buffer states in case in the\n * future we want to put the buffer states in a more general\n * \"scanner state\".\n *\n * Returns the top of the stack, or NULL.\n */\n#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \\\n                          ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \\\n                          : NULL)\n/* Same as previous macro, but useful when we know that the buffer stack is not\n * NULL or when we need an lvalue. For internal use only.\n */\n#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]\n\nvoid yyrestart ( FILE *input_file , yyscan_t yyscanner );\nvoid yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );\nYY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );\nvoid yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );\nvoid yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );\nvoid yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );\nvoid yypop_buffer_state ( yyscan_t yyscanner );\n\nstatic void yyensure_buffer_stack ( yyscan_t yyscanner );\nstatic void yy_load_buffer_state ( yyscan_t yyscanner );\nstatic void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );\n#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)\n\nYY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );\nYY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );\nYY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );\n\nvoid *yyalloc ( yy_size_t , yyscan_t yyscanner );\nvoid *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );\nvoid yyfree ( void * , yyscan_t yyscanner );\n\n#define yy_new_buffer yy_create_buffer\n#define yy_set_interactive(is_interactive) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){ \\\n        yyensure_buffer_stack (yyscanner); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \\\n\t}\n#define yy_set_bol(at_bol) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){\\\n        yyensure_buffer_stack (yyscanner); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \\\n\t}\n#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)\n\n/* Begin user sect3 */\n\n#define wcsulexwrap(yyscanner) (/*CONSTCOND*/1)\n#define YY_SKIP_YYWRAP\ntypedef flex_uint8_t YY_CHAR;\n\ntypedef int yy_state_type;\n\n#define yytext_ptr yytext_r\n\nstatic const flex_int16_t yy_nxt[][128] =\n    {\n    {\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0\n    },\n\n    {\n       13,   14,   14,   14,   14,   14,   14,   14,   14,   14,\n       15,   14,   14,   14,   14,   14,   14,   14,   14,   14,\n       14,   14,   14,   14,   14,   14,   14,   14,   14,   14,\n       14,   14,   16,   14,   14,   14,   14,   14,   14,   14,\n       17,   14,   18,   14,   14,   14,   18,   19,   14,   14,\n       14,   14,   14,   14,   14,   14,   14,   14,   14,   14,\n       14,   14,   14,   14,   14,   20,   21,   22,   23,   24,\n\n       22,   25,   26,   14,   27,   28,   14,   24,   22,   29,\n       30,   14,   31,   32,   33,   14,   22,   34,   14,   24,\n       24,   14,   14,   35,   14,   14,   14,   36,   37,   38,\n       39,   40,   41,   28,   42,   14,   14,   24,   43,   44,\n       41,   29,   45,   14,   46,   47,   48,   49,   50,   14,\n       14,   51,   41,   14,   14,   14,   14,   14\n    },\n\n    {\n       13,   14,   14,   14,   14,   14,   14,   14,   14,   14,\n       15,   14,   14,   14,   14,   14,   14,   14,   14,   14,\n       14,   14,   14,   14,   14,   14,   14,   14,   14,   14,\n       14,   14,   52,   14,   14,   14,   14,   14,   14,   14,\n\n       17,   14,   53,   14,   14,   14,   53,   19,   14,   54,\n       14,   14,   14,   14,   14,   14,   14,   14,   14,   14,\n       14,   14,   14,   14,   14,   20,   21,   22,   23,   24,\n       22,   25,   26,   14,   27,   28,   14,   24,   22,   29,\n       30,   14,   31,   32,   33,   14,   22,   34,   14,   24,\n       24,   55,   14,   35,   14,   14,   14,   36,   37,   38,\n       39,   56,   41,   28,   42,   14,   14,   24,   57,   44,\n       41,   29,   45,   14,   46,   47,   48,   49,   50,   14,\n       14,   51,   41,   14,   14,   14,   14,   14\n    },\n\n    {\n       13,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       59,   60,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58\n    },\n\n    {\n       13,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       59,   60,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,\n       58,   58,   58,   58,   58,   58,   58,   58\n    },\n\n    {\n       13,   61,   61,   61,   61,   61,   61,   61,   61,   61,\n       15,   61,   61,   61,   61,   61,   61,   61,   61,   61,\n       61,   61,   61,   61,   61,   61,   61,   61,   61,   61,\n       61,   61,   61,   61,   61,   61,   61,   61,   61,   61,\n       61,   61,   61,   61,   61,   61,   61,   61,   61,   61,\n\n       61,   61,   61,   61,   61,   61,   61,   61,   61,   61,\n       61,   61,   61,   61,   61,   61,   61,   61,   61,   62,\n       61,   63,   61,   61,   61,   61,   61,   64,   61,   61,\n       65,   61,   61,   61,   66,   61,   61,   61,   61,   67,\n       68,   61,   61,   61,   61,   61,   61,   69,   61,   70,\n       71,   61,   72,   61,   73,   61,   61,   74,   61,   75,\n       76,   61,   77,   61,   61,   61,   61,   78,   61,   61,\n       61,   79,   80,   61,   61,   61,   61,   61\n    },\n\n    {\n       13,   61,   61,   61,   61,   61,   61,   61,   61,   61,\n       15,   61,   61,   61,   61,   61,   61,   61,   61,   61,\n\n       61,   61,   61,   61,   61,   61,   61,   61,   61,   61,\n       61,   61,   61,   61,   61,   61,   61,   61,   61,   61,\n       61,   61,   61,   61,   61,   61,   61,   61,   61,   61,\n       61,   61,   61,   61,   61,   61,   61,   61,   61,   61,\n       61,   61,   61,   61,   61,   61,   61,   61,   61,   62,\n       61,   63,   61,   61,   61,   61,   61,   64,   61,   61,\n       65,   61,   61,   61,   66,   61,   61,   61,   61,   67,\n       68,   61,   61,   61,   61,   61,   61,   69,   61,   70,\n       71,   61,   72,   61,   73,   61,   61,   74,   61,   75,\n       76,   61,   77,   61,   61,   61,   61,   78,   61,   61,\n\n       61,   79,   80,   61,   61,   61,   61,   61\n    },\n\n    {\n       13,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       15,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   82,   83,   84,   85,   81,\n       86,   87,   88,   81,   89,   90,   81,   81,   91,   92,\n       93,   81,   94,   95,   96,   81,   97,   98,   81,   81,\n\n       81,   81,   81,   81,   81,   81,   81,   99,  100,  101,\n      102,  103,   81,  104,  105,   81,   81,   81,  106,  107,\n       81,   92,  108,   81,  109,  110,  111,  112,  113,   81,\n       81,  114,   81,   81,   81,   81,   81,   81\n    },\n\n    {\n       13,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       15,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\n\n       81,   81,   81,   81,   81,   82,   83,   84,   85,   81,\n       86,   87,   88,   81,   89,   90,   81,   81,   91,   92,\n       93,   81,   94,   95,   96,   81,   97,   98,   81,   81,\n       81,   81,   81,   81,   81,   81,   81,   99,  100,  101,\n      102,  103,   81,  104,  105,   81,   81,   81,  106,  107,\n       81,   92,  108,   81,  109,  110,  111,  112,  113,   81,\n       81,  114,   81,   81,   81,   81,   81,   81\n    },\n\n    {\n       13,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n       15,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n\n      115,  115,  116,  115,  115,  115,  115,  115,  115,  115,\n      117,  115,  118,  119,  115,  119,  120,  121,  115,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  123,  124,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115\n\n    },\n\n    {\n       13,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n       15,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  116,  115,  115,  115,  115,  115,  115,  115,\n      117,  115,  118,  119,  115,  119,  120,  121,  115,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  123,  124,  115,  115,  115,  115,  115,\n\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n      115,  115,  115,  115,  115,  115,  115,  115\n    },\n\n    {\n       13,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n       15,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125\n    },\n\n    {\n       13,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n       15,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n      125,  125,  125,  125,  125,  125,  125,  125\n    },\n\n    {\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13,\n      -13,  -13,  -13,  -13,  -13,  -13,  -13,  -13\n    },\n\n    {\n       13,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n\n      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14,\n      -14,  -14,  -14,  -14,  -14,  -14,  -14,  -14\n    },\n\n    {\n       13,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,\n      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15\n    },\n\n    {\n       13,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  126,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,\n\n      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16\n    },\n\n    {\n       13,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n\n      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,\n      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17\n    },\n\n    {\n       13,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n      -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n      -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n      -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n      -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n      -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n\n      -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n      -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n      -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n      -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n      -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n      -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,\n      -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18\n    },\n\n    {\n       13,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n\n      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,\n      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19\n\n    },\n\n    {\n       13,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,\n      -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,\n      -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,\n      -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,\n      -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,\n      -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,\n      -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,\n      -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,\n      -20,  -20,  -20,  -20,  -20,  127,  -20,  -20,  -20,  -20,\n      -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,\n\n      -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,\n      128,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,\n      -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20\n    },\n\n    {\n       13,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n      -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n      -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n      -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n      -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n      -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n      -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n\n      -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n      -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n      -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n      -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n      -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,\n      -21,  129,  -21,  -21,  -21,  -21,  -21,  -21\n    },\n\n    {\n       13,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n\n      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,\n      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22\n    },\n\n    {\n       13,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,\n      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23\n    },\n\n    {\n       13,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  130,  131,  132,  -24,  -24,\n      132,  133,  134,  -24,  135,  130,  -24,  -24,  132,  136,\n\n      137,  -24,  133,  132,  132,  -24,  132,  138,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  139,  140,  141,\n      -24,  142,  -24,  130,  -24,  -24,  -24,  -24,  143,  144,\n      -24,  136,  145,  -24,  146,  147,  -24,  -24,  -24,  -24,\n      -24,  148,  -24,  -24,  -24,  -24,  -24,  -24\n    },\n\n    {\n       13,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,\n      -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,\n      -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,\n      -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,\n      -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,\n\n      -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,\n      -25,  -25,  -25,  -25,  -25,  130,  131,  132,  -25,  -25,\n      132,  133,  134,  -25,  135,  130,  -25,  -25,  132,  136,\n      137,  -25,  133,  132,  132,  -25,  132,  138,  -25,  -25,\n      -25,  -25,  -25,  -25,  -25,  -25,  -25,  139,  140,  141,\n      -25,  142,  -25,  130,  -25,  -25,  -25,  -25,  143,  144,\n      -25,  136,  145,  -25,  146,  147,  -25,  -25,  -25,  -25,\n      -25,  148,  -25,  -25,  -25,  -25,  -25,  -25\n    },\n\n    {\n       13,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,\n\n      -26,  -26,  149,  -26,  -26,  -26,  -26,  -26\n    },\n\n    {\n       13,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,\n      -27,  150,  -27,  -27,  -27,  -27,  -27,  -27\n    },\n\n    {\n       13,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,\n      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28\n    },\n\n    {\n       13,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  151,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,\n      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29\n\n    },\n\n    {\n       13,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  130,  131,  132,  -30,  -30,\n      132,  133,  134,  -30,  135,  130,  -30,  -30,  132,  136,\n      137,  -30,  133,  132,  132,  -30,  132,  138,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  152,  140,  141,\n\n      -30,  142,  -30,  130,  -30,  -30,  -30,  -30,  143,  144,\n      -30,  136,  145,  -30,  146,  147,  -30,  -30,  -30,  -30,\n      -30,  148,  -30,  -30,  -30,  -30,  -30,  -30\n    },\n\n    {\n       13,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,\n      -31,  153,  -31,  -31,  -31,  -31,  -31,  -31\n    },\n\n    {\n       13,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  154,  -32,  -32,\n      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32\n    },\n\n    {\n       13,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  130,  131,  132,  -33,  -33,\n      132,  133,  134,  -33,  135,  130,  -33,  -33,  132,  136,\n      137,  -33,  133,  132,  132,  -33,  132,  138,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  139,  140,  141,\n      -33,  142,  -33,  130,  -33,  -33,  -33,  -33,  143,  144,\n\n      -33,  136,  145,  -33,  146,  147,  -33,  -33,  -33,  -33,\n      -33,  148,  -33,  -33,  -33,  -33,  -33,  -33\n    },\n\n    {\n       13,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  149,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,\n      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34\n    },\n\n    {\n       13,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,\n      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35\n    },\n\n    {\n       13,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  130,  -36,  132,  -36,  -36,\n      132,  133,  134,  -36,  135,  130,  -36,  -36,  132,  136,\n      137,  -36,  133,  132,  132,  -36,  132,  138,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  155,  141,\n      156,  142,  -36,  130,  -36,  -36,  -36,  -36,  143,  157,\n      128,  136,  -36,  -36,  158,  147,  -36,  -36,  -36,  -36,\n\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36\n    },\n\n    {\n       13,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  159,  -37,  -37,\n      -37,  160,  -37,  -37,  -37,  161,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  129,  -37,  -37,  -37,  -37,  -37,  -37\n    },\n\n    {\n       13,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,\n\n      -38,  -38,  -38,  -38,  -38,  130,  -38,  132,  -38,  -38,\n      132,  133,  134,  -38,  135,  130,  -38,  -38,  132,  136,\n      137,  -38,  133,  132,  132,  -38,  132,  138,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  155,  141,\n      162,  142,  -38,  130,  163,  -38,  -38,  -38,  143,  157,\n      -38,  164,  -38,  -38,  146,  147,  165,  -38,  -38,  -38,\n      -38,  153,  -38,  -38,  -38,  -38,  -38,  -38\n    },\n\n    {\n       13,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,\n      -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,\n      -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,\n\n      -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,\n      -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,\n      -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,\n      -39,  -39,  -39,  -39,  -39,  130,  -39,  132,  -39,  -39,\n      132,  133,  134,  -39,  135,  130,  -39,  -39,  132,  136,\n      137,  -39,  133,  132,  132,  -39,  132,  138,  -39,  -39,\n      -39,  -39,  -39,  -39,  -39,  -39,  -39,  166,  155,  141,\n      -39,  167,  -39,  130,  -39,  -39,  -39,  -39,  143,  157,\n      -39,  136,  -39,  -39,  146,  147,  -39,  -39,  -39,  -39,\n      -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39\n\n    },\n\n    {\n       13,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,\n      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,\n      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,\n      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,\n      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,\n      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,\n      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,\n      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,\n      -40,  -40,  -40,  -40,  -40,  -40,  150,  -40,  -40,  -40,\n      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,\n\n      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,\n      -40,  -40,  -40,  -40,  168,  -40,  -40,  -40,  -40,  -40,\n      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40\n    },\n\n    {\n       13,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,\n      -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,\n      -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,\n      -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,\n      -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,\n      -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,\n      -41,  -41,  -41,  -41,  -41,  130,  -41,  132,  -41,  -41,\n\n      132,  133,  134,  -41,  135,  130,  -41,  -41,  132,  136,\n      137,  -41,  133,  132,  132,  -41,  132,  138,  -41,  -41,\n      -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  155,  141,\n      -41,  142,  -41,  130,  -41,  -41,  -41,  -41,  143,  157,\n      -41,  136,  -41,  -41,  146,  147,  -41,  -41,  -41,  -41,\n      -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41\n    },\n\n    {\n       13,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  130,  131,  132,  -42,  -42,\n      132,  133,  134,  -42,  135,  130,  -42,  -42,  132,  136,\n      137,  -42,  133,  132,  132,  -42,  132,  138,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  139,  140,  141,\n      -42,  142,  -42,  130,  -42,  -42,  -42,  -42,  143,  144,\n      -42,  136,  145,  -42,  146,  147,  -42,  -42,  -42,  -42,\n      -42,  148,  -42,  -42,  -42,  -42,  -42,  -42\n    },\n\n    {\n       13,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n\n      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  149,\n\n      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n      149,  169,  -43,  -43,  -43,  -43,  -43,  -43\n    },\n\n    {\n       13,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,\n      -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,\n      -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,\n      -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,\n      -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,\n      -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,\n      -44,  -44,  -44,  -44,  -44,  130,  -44,  132,  -44,  -44,\n      132,  133,  134,  -44,  135,  130,  -44,  -44,  132,  136,\n\n      137,  -44,  133,  132,  132,  -44,  132,  138,  -44,  -44,\n      -44,  -44,  -44,  -44,  -44,  -44,  -44,  170,  155,  141,\n      -44,  142,  -44,  130,  -44,  171,  -44,  -44,  143,  157,\n      -44,  172,  -44,  -44,  146,  147,  -44,  -44,  -44,  -44,\n      -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44\n    },\n\n    {\n       13,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,\n      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,\n      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,\n      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,\n      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,\n\n      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,\n      -45,  -45,  -45,  -45,  -45,  130,  -45,  132,  -45,  -45,\n      132,  133,  134,  -45,  135,  130,  -45,  -45,  132,  136,\n      137,  -45,  133,  132,  132,  -45,  132,  138,  -45,  -45,\n      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  155,  173,\n      -45,  142,  -45,  130,  174,  175,  -45,  -45,  143,  157,\n      -45,  136,  -45,  -45,  146,  147,  -45,  -45,  -45,  -45,\n      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45\n    },\n\n    {\n       13,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,\n      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,\n\n      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,\n      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,\n      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,\n      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,\n      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,\n      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,\n      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,\n      -46,  -46,  -46,  -46,  -46,  -46,  -46,  176,  -46,  -46,\n      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,\n      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,\n\n      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46\n    },\n\n    {\n       13,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,\n      -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,\n      -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,\n      -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,\n      -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,\n      -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,\n      -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,\n      -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,\n      -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,\n\n      -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,\n      -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,\n      -47,  177,  -47,  178,  162,  -47,  -47,  -47,  -47,  -47,\n      -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47\n    },\n\n    {\n       13,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,\n\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  179,  -48,  -48,\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48\n    },\n\n    {\n       13,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,\n      -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,\n      -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,\n\n      -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,\n      -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,\n      -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,\n      -49,  -49,  -49,  -49,  -49,  130,  -49,  132,  -49,  -49,\n      132,  133,  134,  -49,  135,  130,  -49,  -49,  132,  136,\n      137,  -49,  133,  132,  132,  -49,  132,  138,  -49,  -49,\n      -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  155,  141,\n      -49,  142,  -49,  130,  -49,  -49,  -49,  -49,  143,  157,\n      -49,  136,  -49,  -49,  146,  147,  -49,  -49,  -49,  -49,\n      -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49\n\n    },\n\n    {\n       13,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  180,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50\n    },\n\n    {\n       13,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  130,  -51,  132,  -51,  -51,\n\n      132,  133,  134,  -51,  135,  130,  -51,  -51,  132,  136,\n      137,  -51,  133,  132,  132,  -51,  132,  138,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  155,  141,\n      -51,  142,  -51,  130,  -51,  -51,  -51,  -51,  143,  157,\n      -51,  136,  -51,  -51,  181,  147,  -51,  -51,  -51,  -51,\n      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51\n    },\n\n    {\n       13,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n      -52,  -52,  182,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n\n      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,\n      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52\n    },\n\n    {\n       13,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,\n      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53\n    },\n\n    {\n       13,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  183,  184,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,\n      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54\n    },\n\n    {\n       13,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,\n      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55\n    },\n\n    {\n       13,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  150,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  168,  -56,  -56,  -56,  -56,  -56,\n\n      185,  -56,  -56,  -56,  -56,  -56,  -56,  -56\n    },\n\n    {\n       13,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  149,\n      186,  187,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n      149,  169,  -57,  -57,  -57,  -57,  -57,  -57\n    },\n\n    {\n       13,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      -58,  -58,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188\n    },\n\n    {\n       13,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59\n\n    },\n\n    {\n       13,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,\n      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60\n    },\n\n    {\n       13,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61\n    },\n\n    {\n       13,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,\n      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62\n    },\n\n    {\n       13,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,\n      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63\n    },\n\n    {\n       13,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,\n      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64\n    },\n\n    {\n       13,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65\n    },\n\n    {\n       13,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,\n\n      -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66\n    },\n\n    {\n       13,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,\n      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67\n    },\n\n    {\n       13,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68\n    },\n\n    {\n       13,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,\n      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69\n\n    },\n\n    {\n       13,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70\n    },\n\n    {\n       13,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  189,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71\n    },\n\n    {\n       13,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72\n    },\n\n    {\n       13,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,\n      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73\n    },\n\n    {\n       13,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74\n    },\n\n    {\n       13,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75\n    },\n\n    {\n       13,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,\n\n      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76\n    },\n\n    {\n       13,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77\n    },\n\n    {\n       13,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78\n    },\n\n    {\n       13,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,\n      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79\n\n    },\n\n    {\n       13,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80\n    },\n\n    {\n       13,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81\n    },\n\n    {\n       13,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  190,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      191,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,\n      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82\n    },\n\n    {\n       13,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n\n      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,\n      -83,  192,  -83,  -83,  -83,  -83,  -83,  -83\n    },\n\n    {\n       13,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,\n      -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84\n    },\n\n    {\n       13,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85\n    },\n\n    {\n       13,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86\n    },\n\n    {\n       13,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,\n      -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87\n    },\n\n    {\n       13,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  193,  -88,  -88,  -88,  -88,  -88\n    },\n\n    {\n       13,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  194,  -89,  -89,  -89,  -89,  -89,  -89\n\n    },\n\n    {\n       13,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90\n    },\n\n    {\n       13,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91\n    },\n\n    {\n       13,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  195,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92\n    },\n\n    {\n       13,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  196,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,\n      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93\n    },\n\n    {\n       13,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  197,  -94,  -94,  -94,  -94,  -94,  -94\n    },\n\n    {\n       13,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  198,  -95,  -95,\n      -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95\n    },\n\n    {\n       13,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,\n\n      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96\n    },\n\n    {\n       13,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97\n    },\n\n    {\n       13,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  199,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98\n    },\n\n    {\n       13,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      200,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      191,  -99,  -99,  -99,  201,  -99,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99\n\n    },\n\n    {\n       13, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100,  202, -100, -100,\n\n     -100,  203, -100, -100, -100,  204, -100, -100, -100, -100,\n     -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n     -100,  192, -100, -100, -100, -100, -100, -100\n    },\n\n    {\n       13, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n     -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,\n      205, -101, -101, -101,  206, -101, -101, -101, -101, -101,\n     -101,  207, -101, -101, -101, -101,  208, -101, -101, -101,\n     -101,  209, -101, -101, -101, -101, -101, -101\n    },\n\n    {\n       13, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102,  210, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,\n     -102, -102, -102, -102, -102, -102, -102, -102\n    },\n\n    {\n       13, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103,  211, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,\n\n     -103, -103, -103, -103,  212, -103, -103, -103, -103, -103,\n     -103, -103, -103, -103, -103, -103, -103, -103\n    },\n\n    {\n       13, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104\n    },\n\n    {\n       13, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n     -105, -105, -105, -105, -105, -105, -105, -105\n    },\n\n    {\n       13, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106,  213,\n     -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,\n\n      214,  215, -106, -106, -106, -106, -106, -106\n    },\n\n    {\n       13, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,\n\n     -107, -107, -107, -107, -107, -107, -107,  216, -107, -107,\n     -107, -107, -107, -107, -107,  217, -107, -107, -107, -107,\n     -107,  218, -107, -107, -107, -107, -107, -107, -107, -107,\n     -107, -107, -107, -107, -107, -107, -107, -107\n    },\n\n    {\n       13, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108,  219,\n     -108, -108, -108, -108,  220,  221, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108\n    },\n\n    {\n       13, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109,  222, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109\n\n    },\n\n    {\n       13, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n\n     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,\n     -110,  223, -110, -110,  224, -110, -110, -110, -110, -110,\n     -110, -110, -110, -110, -110, -110, -110, -110\n    },\n\n    {\n       13, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111,  225, -111, -111,\n     -111, -111, -111, -111, -111, -111, -111, -111\n    },\n\n    {\n       13, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,\n     -112, -112, -112, -112, -112, -112, -112, -112\n    },\n\n    {\n       13, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,\n\n     -113,  226, -113, -113, -113, -113, -113, -113, -113, -113,\n     -113, -113, -113, -113, -113, -113, -113, -113\n    },\n\n    {\n       13, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114,  227, -114, -114, -114, -114, -114,\n     -114, -114, -114, -114, -114, -114, -114, -114\n    },\n\n    {\n       13, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115, -115, -115, -115, -115, -115\n    },\n\n    {\n       13, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116,  228, -116, -116, -116, -116, -116, -116, -116,\n      229, -116,  230,  231, -116,  231,  232,  233, -116,  234,\n      234,  234,  234,  234,  234,  234,  234,  234, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116,  235,  236, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,\n\n     -116, -116, -116, -116, -116, -116, -116, -116\n    },\n\n    {\n       13, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117,  237, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117,  238, -117,  238,  239, -117,  240,  241,\n      241,  241,  241,  241,  241,  241,  241,  241, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117\n    },\n\n    {\n       13, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118,  242, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118,  236, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,\n     -118, -118, -118, -118, -118, -118, -118, -118\n    },\n\n    {\n       13, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119,  234,\n      234,  234,  234,  234,  234,  234,  234,  234, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,\n     -119, -119, -119, -119, -119, -119, -119, -119\n\n    },\n\n    {\n       13, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120,  242, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120\n    },\n\n    {\n       13, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121,  243, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121\n    },\n\n    {\n       13, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n\n     -122, -122, -122, -122, -122, -122, -122, -122,  244,  244,\n      244,  244,  244,  244,  244,  244,  244,  244, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,\n     -122, -122, -122, -122, -122, -122, -122, -122\n    },\n\n    {\n       13, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n\n     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,\n     -123, -123, -123, -123, -123, -123, -123, -123\n    },\n\n    {\n       13, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,\n     -124, -124, -124, -124, -124, -124, -124, -124\n    },\n\n    {\n       13,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n     -125,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245\n    },\n\n    {\n       13, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126,  126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,\n\n     -126, -126, -126, -126, -126, -126, -126, -126\n    },\n\n    {\n       13, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,\n     -127, -127, -127, -127, -127, -127, -127, -127\n    },\n\n    {\n       13, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128,  246, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128\n    },\n\n    {\n       13, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129,  247, -129, -129, -129,\n     -129, -129, -129, -129, -129, -129, -129, -129\n\n    },\n\n    {\n       13, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130\n    },\n\n    {\n       13, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,\n     -131,  248, -131, -131, -131, -131, -131, -131\n    },\n\n    {\n       13, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,\n     -132, -132, -132, -132, -132, -132, -132, -132\n    },\n\n    {\n       13, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n\n     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,\n     -133, -133, -133, -133, -133, -133, -133, -133\n    },\n\n    {\n       13, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,\n     -134, -134,  132, -134, -134, -134, -134, -134\n    },\n\n    {\n       13, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,\n     -135,  133, -135, -135, -135, -135, -135, -135\n    },\n\n    {\n       13, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136,  249, -136, -136, -136, -136, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,\n\n     -136, -136, -136, -136, -136, -136, -136, -136\n    },\n\n    {\n       13, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n\n     -137, -137, -137, -137, -137, -137, -137,  132, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,\n     -137, -137, -137, -137, -137, -137, -137, -137\n    },\n\n    {\n       13, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138,  132, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138\n    },\n\n    {\n       13, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,\n     -139, -139, -139, -139, -139, -139, -139, -139\n\n    },\n\n    {\n       13, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140,  250, -140, -140,\n\n     -140, -140, -140, -140, -140,  251, -140, -140, -140, -140,\n     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,\n     -140,  248, -140, -140, -140, -140, -140, -140\n    },\n\n    {\n       13, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n      130, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141\n    },\n\n    {\n       13, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142,  133, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,\n     -142, -142, -142, -142, -142, -142, -142, -142\n    },\n\n    {\n       13, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n     -143, -143, -143, -143, -143, -143, -143, -143, -143,  132,\n\n     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,\n      132, -143, -143, -143, -143, -143, -143, -143\n    },\n\n    {\n       13, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144,  252, -144, -144, -144, -144, -144, -144, -144, -144,\n     -144, -144, -144, -144, -144, -144, -144, -144\n    },\n\n    {\n       13, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145,  139,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145\n    },\n\n    {\n       13, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146,  253, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n\n     -146, -146, -146, -146, -146, -146, -146, -146\n    },\n\n    {\n       13, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147,  130, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147\n    },\n\n    {\n       13, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148,  139, -148, -148, -148, -148, -148,\n     -148, -148, -148, -148, -148, -148, -148, -148\n    },\n\n    {\n       13, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,\n     -149, -149, -149, -149, -149, -149, -149, -149\n\n    },\n\n    {\n       13, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,\n     -150, -150, -150, -150, -150, -150, -150, -150\n    },\n\n    {\n       13, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151,  149,\n     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,\n     -151, -151, -151, -151, -151, -151, -151, -151\n    },\n\n    {\n       13, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,\n     -152, -152, -152, -152, -152, -152, -152, -152\n    },\n\n    {\n       13, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n\n     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,\n     -153, -153, -153, -153, -153, -153, -153, -153\n    },\n\n    {\n       13, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n      127, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154\n    },\n\n    {\n       13, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155,  250, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155\n    },\n\n    {\n       13, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,\n     -156, -156, -156, -156, -156, -156, -156,  165, -156, -156,\n\n     -156, -156, -156, -156, -156, -156, -156, -156\n    },\n\n    {\n       13, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n\n     -157, -157, -157, -157, -157, -157, -157,  254, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157,  252, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157\n    },\n\n    {\n       13, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158,  253, -158,  255,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158\n    },\n\n    {\n       13, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159,  256, -159, -159, -159, -159, -159,\n     -159, -159, -159, -159, -159, -159, -159, -159\n\n    },\n\n    {\n       13, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160,  257, -160, -160,\n\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,\n     -160, -160, -160, -160, -160, -160, -160, -160\n    },\n\n    {\n       13, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,\n      165, -161, -161, -161, -161, -161,  258, -161, -161, -161,\n     -161, -161, -161, -161, -161, -161, -161, -161\n    },\n\n    {\n       13, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162, -162\n    },\n\n    {\n       13, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163,  259, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n\n     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,\n     -163, -163, -163, -163, -163, -163, -163, -163\n    },\n\n    {\n       13, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164,  249, -164, -164, -164, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164,  260, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164, -164\n    },\n\n    {\n       13, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165\n    },\n\n    {\n       13, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,\n     -166, -166, -166, -166, -166,  130,  131,  132, -166, -166,\n      132,  133,  134, -166,  135,  130, -166, -166,  132,  136,\n      137, -166,  133,  132,  132, -166,  132,  138, -166, -166,\n     -166, -166, -166, -166, -166, -166, -166,  139,  140,  141,\n     -166,  142, -166,  130, -166, -166, -166, -166,  143,  144,\n     -166,  136,  145, -166,  146,  147, -166, -166, -166, -166,\n\n     -166,  148, -166, -166, -166, -166, -166, -166\n    },\n\n    {\n       13, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167,  133, -167, -167, -167,\n\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167,  153, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167, -167, -167,\n     -167, -167, -167, -167, -167, -167, -167, -167\n    },\n\n    {\n       13, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168,  153, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168, -168, -168, -168\n    },\n\n    {\n       13, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169,  127, -169, -169, -169, -169, -169,\n     -169, -169, -169, -169, -169, -169, -169, -169\n\n    },\n\n    {\n       13, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170, -170, -170,\n\n     -170, -170, -170,  150, -170, -170, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170,  153, -170, -170, -170, -170,\n     -170, -170, -170, -170, -170, -170, -170, -170\n    },\n\n    {\n       13, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n      153, -171, -171, -171, -171, -171, -171, -171, -171, -171,\n     -171, -171, -171, -171, -171, -171, -171, -171\n    },\n\n    {\n       13, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172,  249, -172, -172, -172,  162, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172, -172, -172,\n     -172, -172, -172, -172, -172, -172, -172, -172\n    },\n\n    {\n       13, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n      130, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173\n    },\n\n    {\n       13, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174,  261, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174\n    },\n\n    {\n       13, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175, -175, -175,\n      262, -175, -175, -175, -175, -175, -175, -175\n    },\n\n    {\n       13, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n      162, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n\n     -176, -176, -176, -176, -176, -176, -176, -176\n    },\n\n    {\n       13, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177,  263, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177\n    },\n\n    {\n       13, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178,  264, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178\n    },\n\n    {\n       13, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179,  265, -179, -179, -179, -179, -179,\n     -179, -179, -179, -179, -179, -179, -179, -179\n\n    },\n\n    {\n       13, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n     -180, -180, -180, -180, -180, -180, -180, -180, -180, -180,\n      266, -180, -180, -180, -180, -180, -180, -180\n    },\n\n    {\n       13, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181,  253, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181, -181, -181,\n     -181, -181, -181, -181, -181, -181, -181, -181\n    },\n\n    {\n       13, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182,  182, -182, -182, -182, -182, -182, -182, -182,\n\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,\n     -182, -182, -182, -182, -182, -182, -182, -182\n    },\n\n    {\n       13, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n\n     -183, -183, -183, -183, -183, -183, -183, -183, -183, -183,\n     -183, -183, -183, -183, -183, -183, -183, -183\n    },\n\n    {\n       13, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184,  267,  267,\n      267,  267,  267,  267,  267,  267,  267,  267, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184, -184, -184,\n     -184, -184, -184, -184, -184, -184, -184, -184\n    },\n\n    {\n       13, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185,  268, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185\n    },\n\n    {\n       13, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186,  269, -186, -186, -186, -186, -186, -186, -186,\n      270, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186, -186, -186,\n\n     -186, -186, -186, -186, -186, -186, -186, -186\n    },\n\n    {\n       13, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187,  271, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187\n    },\n\n    {\n       13,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n     -188, -188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,\n      188,  188,  188,  188,  188,  188,  188,  188\n    },\n\n    {\n       13, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189\n\n    },\n\n    {\n       13, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190, -190, -190,\n     -190, -190, -190, -190, -190, -190, -190, -190\n    },\n\n    {\n       13, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191,  272, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191, -191, -191,\n     -191, -191, -191, -191, -191, -191, -191, -191\n    },\n\n    {\n       13, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192,  273, -192, -192, -192,\n     -192, -192, -192, -192, -192, -192, -192, -192\n    },\n\n    {\n       13, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n\n     -193, -193, -193, -193, -193, -193, -193, -193, -193, -193,\n     -193, -193, -193, -193, -193, -193, -193, -193\n    },\n\n    {\n       13, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194\n    },\n\n    {\n       13, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195,  274,\n     -195, -195, -195, -195, -195, -195, -195, -195, -195, -195,\n     -195, -195, -195, -195, -195, -195, -195, -195\n    },\n\n    {\n       13, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n     -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,\n\n     -196, -196, -196, -196, -196, -196, -196, -196\n    },\n\n    {\n       13, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197\n    },\n\n    {\n       13, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n      275, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198\n    },\n\n    {\n       13, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199\n\n    },\n\n    {\n       13, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n\n     -200, -200, -200, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200,  276, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200\n    },\n\n    {\n       13, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201,  277,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201\n    },\n\n    {\n       13, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202,  278, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202\n    },\n\n    {\n       13, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203,  279, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203\n    },\n\n    {\n       13, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n      280, -204, -204, -204, -204, -204,  281, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204\n    },\n\n    {\n       13, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205, -205, -205,\n     -205, -205, -205, -205, -205, -205, -205, -205\n    },\n\n    {\n       13, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206,  282, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n     -206, -206, -206, -206, -206, -206, -206, -206, -206, -206,\n\n     -206, -206, -206, -206, -206, -206, -206, -206\n    },\n\n    {\n       13, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207,  283, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207\n    },\n\n    {\n       13, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208, -208, -208,\n     -208, -208, -208, -208, -208, -208, -208, -208\n    },\n\n    {\n       13, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209, -209, -209,\n     -209, -209, -209, -209, -209, -209, -209, -209\n\n    },\n\n    {\n       13, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n\n     -210, -210, -210,  284, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210\n    },\n\n    {\n       13, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211\n    },\n\n    {\n       13, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212,  285, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212, -212, -212, -212\n    },\n\n    {\n       13, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n\n     -213, -213, -213, -213, -213, -213, -213, -213, -213, -213,\n     -213, -213, -213, -213, -213, -213, -213, -213\n    },\n\n    {\n       13, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,\n     -214, -214, -214, -214, -214, -214, -214, -214\n    },\n\n    {\n       13, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215,  286, -215, -215, -215, -215, -215,\n     -215, -215, -215, -215, -215, -215, -215, -215\n    },\n\n    {\n       13, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216,  287, -216, -216, -216, -216, -216, -216,\n     -216, -216, -216, -216, -216,  288, -216, -216, -216, -216,\n\n     -216, -216, -216, -216, -216, -216, -216, -216\n    },\n\n    {\n       13, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n      289, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217\n    },\n\n    {\n       13, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218,  290, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218\n    },\n\n    {\n       13, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219, -219, -219,\n     -219, -219, -219, -219, -219, -219, -219, -219\n\n    },\n\n    {\n       13, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n\n     -220, -220, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220,  291, -220, -220, -220, -220, -220, -220, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220\n    },\n\n    {\n       13, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n     -221, -221, -221, -221, -221, -221, -221, -221, -221, -221,\n      292, -221, -221, -221, -221, -221, -221, -221\n    },\n\n    {\n       13, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n      293, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222\n    },\n\n    {\n       13, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223,  294, -223,\n\n     -223, -223, -223, -223, -223, -223, -223, -223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223\n    },\n\n    {\n       13, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224\n    },\n\n    {\n       13, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225,  295, -225, -225, -225, -225, -225,\n     -225, -225, -225, -225, -225, -225, -225, -225\n    },\n\n    {\n       13, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226, -226, -226,\n\n      296, -226, -226, -226, -226, -226, -226, -226\n    },\n\n    {\n       13, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,\n     -227, -227, -227, -227, -227, -227, -227, -227\n    },\n\n    {\n       13, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228,  228, -228, -228, -228, -228, -228, -228, -228,\n      229, -228,  230,  231, -228,  231,  232,  233, -228,  234,\n      234,  234,  234,  234,  234,  234,  234,  234, -228, -228,\n\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228,  235,  236, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228, -228, -228,\n     -228, -228, -228, -228, -228, -228, -228, -228\n    },\n\n    {\n       13, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n\n     -229, -229,  237, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229,  238, -229,  238,  239, -229,  240,  241,\n      241,  241,  241,  241,  241,  241,  241,  241, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229\n\n    },\n\n    {\n       13, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230,  242, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230,  236, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230, -230, -230,\n     -230, -230, -230, -230, -230, -230, -230, -230\n    },\n\n    {\n       13, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231,  234,\n      234,  234,  234,  234,  234,  234,  234,  234, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231, -231, -231,\n     -231, -231, -231, -231, -231, -231, -231, -231\n    },\n\n    {\n       13, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232,  242, -232, -232, -232, -232, -232, -232, -232,\n\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232, -232, -232,\n     -232, -232, -232, -232, -232, -232, -232, -232\n    },\n\n    {\n       13, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233,  243, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n\n     -233, -233, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233, -233, -233\n    },\n\n    {\n       13, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234,  244,  244,\n      244,  244,  244,  244,  244,  244,  244,  244, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,\n     -234, -234, -234, -234, -234, -234, -234, -234\n    },\n\n    {\n       13, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235, -235, -235,\n     -235, -235, -235, -235, -235, -235, -235, -235\n    },\n\n    {\n       13, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n     -236, -236, -236, -236, -236, -236, -236, -236, -236, -236,\n\n     -236, -236, -236, -236, -236, -236, -236, -236\n    },\n\n    {\n       13, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237,  237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237,  238, -237,  238,  239, -237,  240,  241,\n      241,  241,  241,  241,  241,  241,  241,  241, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237, -237, -237,\n     -237, -237, -237, -237, -237, -237, -237, -237\n    },\n\n    {\n       13, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238,  239, -238,  240,  241,\n      241,  241,  241,  241,  241,  241,  241,  241, -238, -238,\n\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238\n    },\n\n    {\n       13, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239,  297,  297,\n      297,  297,  297,  297,  297,  297,  297,  297, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239, -239, -239,\n     -239, -239, -239, -239, -239, -239, -239, -239\n\n    },\n\n    {\n       13, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240,  298, -240, -240, -240, -240, -240, -240, -240,\n     -240,  299, -240, -240, -240, -240,  300, -240,  301,  301,\n      301,  301,  301,  301,  301,  301,  301,  301, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240, -240, -240,\n     -240, -240, -240, -240, -240, -240, -240, -240\n    },\n\n    {\n       13, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241,  302, -241, -241, -241, -241, -241, -241, -241,\n     -241,  303, -241, -241, -241, -241,  300,  304,  305,  305,\n      305,  305,  305,  305,  305,  305,  305,  305, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241, -241, -241,\n     -241, -241, -241, -241, -241, -241, -241, -241\n    },\n\n    {\n       13, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242,  242, -242, -242, -242, -242, -242, -242, -242,\n\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,\n     -242, -242, -242, -242, -242, -242, -242, -242\n    },\n\n    {\n       13, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243,  243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n\n     -243, -243, -243, -243, -243, -243, -243, -243, -243, -243,\n     -243, -243, -243, -243, -243, -243, -243, -243\n    },\n\n    {\n       13, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244,  244,  244,\n      244,  244,  244,  244,  244,  244,  244,  244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244, -244, -244,\n     -244, -244, -244, -244, -244, -244, -244, -244\n    },\n\n    {\n       13,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n     -245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,\n      245,  245,  245,  245,  245,  245,  245,  245\n    },\n\n    {\n       13, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246,  306, -246, -246, -246, -246,\n\n     -246, -246, -246, -246, -246, -246, -246, -246\n    },\n\n    {\n       13, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247,  258, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247, -247, -247,\n     -247, -247, -247, -247, -247, -247, -247, -247\n    },\n\n    {\n       13, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248,  307, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248\n    },\n\n    {\n       13, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249,  132,\n     -249, -249, -249, -249, -249, -249, -249, -249, -249, -249,\n     -249, -249, -249, -249, -249, -249, -249, -249\n\n    },\n\n    {\n       13, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n\n     -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250,  308, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250\n    },\n\n    {\n       13, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251,  139, -251, -251, -251,\n     -251, -251, -251, -251, -251, -251, -251, -251\n    },\n\n    {\n       13, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252,  130, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252, -252, -252,\n     -252, -252, -252, -252, -252, -252, -252, -252\n    },\n\n    {\n       13, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n      130, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n\n     -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,\n     -253, -253, -253, -253, -253, -253, -253, -253\n    },\n\n    {\n       13, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254,  309, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254\n    },\n\n    {\n       13, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255, -255,  310,\n     -255, -255, -255, -255, -255,  311, -255, -255, -255, -255,\n     -255, -255, -255, -255, -255, -255, -255, -255\n    },\n\n    {\n       13, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n     -256, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n      150, -256, -256, -256, -256, -256, -256, -256, -256, -256,\n\n     -256, -256, -256, -256, -256, -256, -256, -256\n    },\n\n    {\n       13, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257,  127,\n     -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,\n     -257, -257, -257, -257, -257, -257, -257, -257\n    },\n\n    {\n       13, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,\n     -258, -258, -258, -258, -258, -258, -258, -258\n    },\n\n    {\n       13, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n      165, -259, -259, -259, -259, -259, -259, -259, -259, -259,\n     -259, -259, -259, -259, -259, -259, -259, -259\n\n    },\n\n    {\n       13, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n\n     -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n      312, -260, -260, -260, -260, -260, -260, -260, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260\n    },\n\n    {\n       13, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261,  313, -261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261\n    },\n\n    {\n       13, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262,  314, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262\n    },\n\n    {\n       13, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263,  315,  316, -263, -263,\n     -263, -263,  317, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n\n     -263, -263, -263, -263, -263, -263, -263, -263, -263, -263,\n     -263, -263, -263, -263, -263, -263, -263, -263\n    },\n\n    {\n       13, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264,  318, -264, -264, -264,\n     -264, -264, -264, -264, -264, -264, -264, -264\n    },\n\n    {\n       13, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n      153, -265, -265, -265, -265, -265, -265, -265, -265, -265,\n     -265, -265, -265, -265, -265, -265, -265, -265\n    },\n\n    {\n       13, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266,  319, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n\n     -266, -266, -266, -266, -266, -266, -266, -266\n    },\n\n    {\n       13, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,\n     -267, -267, -267, -267, -267, -267, -267, -267\n    },\n\n    {\n       13, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268,  320, -268, -268, -268, -268, -268, -268, -268,\n      321, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268, -268, -268,\n     -268, -268, -268, -268, -268, -268, -268, -268\n    },\n\n    {\n       13, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n\n     -269, -269,  269, -269, -269, -269, -269, -269, -269, -269,\n      270, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269, -269, -269,\n     -269, -269, -269, -269, -269, -269, -269, -269\n\n    },\n\n    {\n       13, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270, -270, -270,\n     -270, -270, -270, -270, -270, -270, -270, -270\n    },\n\n    {\n       13, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271,  322, -271, -271, -271, -271, -271, -271, -271,\n      323, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271, -271, -271,\n     -271, -271, -271, -271, -271, -271, -271, -271\n    },\n\n    {\n       13, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272,  324, -272, -272, -272, -272,\n     -272, -272, -272, -272, -272, -272, -272, -272\n    },\n\n    {\n       13, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273,  325, -273, -273, -273, -273, -273, -273, -273, -273,\n\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273\n    },\n\n    {\n       13, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274, -274, -274,\n     -274, -274, -274, -274, -274, -274, -274, -274\n    },\n\n    {\n       13, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275\n    },\n\n    {\n       13, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n     -276, -276, -276, -276, -276, -276, -276, -276, -276, -276,\n\n     -276, -276, -276, -276, -276, -276, -276, -276\n    },\n\n    {\n       13, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n\n     -277, -277, -277, -277, -277, -277, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277, -277,  326,\n     -277, -277, -277, -277, -277,  327, -277, -277, -277, -277,\n     -277, -277, -277, -277, -277, -277, -277, -277\n    },\n\n    {\n       13, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n      328, -278, -278, -278, -278, -278, -278, -278, -278, -278,\n     -278, -278, -278, -278, -278, -278, -278, -278\n    },\n\n    {\n       13, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279,  329,\n     -279, -279, -279, -279, -279, -279, -279, -279, -279, -279,\n     -279, -279, -279, -279, -279, -279, -279, -279\n\n    },\n\n    {\n       13, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280, -280, -280,\n     -280, -280, -280, -280, -280, -280, -280, -280\n    },\n\n    {\n       13, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281, -281, -281,\n     -281, -281, -281, -281, -281, -281, -281, -281\n    },\n\n    {\n       13, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n      330, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282\n    },\n\n    {\n       13, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n\n      331, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283\n    },\n\n    {\n       13, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,\n     -284, -284, -284, -284, -284, -284, -284, -284\n    },\n\n    {\n       13, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285\n    },\n\n    {\n       13, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n     -286, -286, -286, -286, -286, -286, -286, -286, -286, -286,\n\n     -286, -286, -286, -286, -286, -286, -286, -286\n    },\n\n    {\n       13, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287\n    },\n\n    {\n       13, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288, -288, -288,\n     -288, -288, -288, -288, -288, -288, -288, -288\n    },\n\n    {\n       13, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289, -289, -289,\n     -289, -289, -289, -289, -289, -289, -289, -289\n\n    },\n\n    {\n       13, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,\n     -290, -290, -290, -290, -290, -290, -290, -290\n    },\n\n    {\n       13, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291,  332, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291\n    },\n\n    {\n       13, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292,  333, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292, -292, -292,\n     -292, -292, -292, -292, -292, -292, -292, -292\n    },\n\n    {\n       13, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n\n     -293, -293, -293, -293, -293, -293, -293, -293, -293, -293,\n     -293, -293, -293, -293, -293, -293, -293, -293\n    },\n\n    {\n       13, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294,  334,  335, -294, -294,\n\n     -294, -294,  336, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294, -294, -294,\n     -294, -294, -294, -294, -294, -294, -294, -294\n    },\n\n    {\n       13, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n      337, -295, -295, -295, -295, -295, -295, -295, -295, -295,\n     -295, -295, -295, -295, -295, -295, -295, -295\n    },\n\n    {\n       13, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296,  338, -296, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296, -296, -296,\n\n     -296, -296, -296, -296, -296, -296, -296, -296\n    },\n\n    {\n       13, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297,  298, -297, -297, -297, -297, -297, -297, -297,\n     -297,  299, -297, -297, -297, -297, -297, -297,  297,  297,\n      297,  297,  297,  297,  297,  297,  297,  297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297\n    },\n\n    {\n       13, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298,  298, -298, -298, -298, -298, -298, -298, -298,\n     -298,  299, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,\n     -298, -298, -298, -298, -298, -298, -298, -298\n    },\n\n    {\n       13, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299, -299, -299,\n     -299, -299, -299, -299, -299, -299, -299, -299\n\n    },\n\n    {\n       13, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300,  298, -300, -300, -300, -300, -300, -300, -300,\n     -300,  299, -300, -300, -300, -300, -300, -300,  339,  339,\n      339,  339,  339,  339,  339,  339,  339,  339, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,\n     -300, -300, -300, -300, -300, -300, -300, -300\n    },\n\n    {\n       13, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301,  298, -301, -301, -301, -301, -301, -301, -301,\n     -301,  299, -301, -301, -301, -301,  300, -301,  301,  301,\n      301,  301,  301,  301,  301,  301,  301,  301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,\n     -301, -301, -301, -301, -301, -301, -301, -301\n    },\n\n    {\n       13, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302,  302, -302, -302, -302, -302, -302, -302, -302,\n\n     -302,  303, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302, -302, -302,\n     -302, -302, -302, -302, -302, -302, -302, -302\n    },\n\n    {\n       13, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n\n     -303, -303, -303, -303, -303, -303, -303, -303, -303, -303,\n     -303, -303, -303, -303, -303, -303, -303, -303\n    },\n\n    {\n       13, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304,  340,\n      340,  340,  340,  340,  340,  340,  340,  340, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304\n    },\n\n    {\n       13, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305,  302, -305, -305, -305, -305, -305, -305, -305,\n     -305,  303, -305, -305, -305, -305,  300,  304,  305,  305,\n\n      305,  305,  305,  305,  305,  305,  305,  305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305\n    },\n\n    {\n       13, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306, -306, -306, -306, -306,\n     -306, -306, -306, -306, -306, -306,  341, -306, -306, -306,\n\n     -306, -306, -306, -306, -306, -306, -306, -306\n    },\n\n    {\n       13, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307,  139, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307, -307, -307,\n     -307, -307, -307, -307, -307, -307, -307, -307\n    },\n\n    {\n       13, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n      133, -308, -308, -308, -308, -308, -308, -308, -308, -308,\n     -308, -308, -308, -308, -308, -308, -308, -308\n    },\n\n    {\n       13, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309\n\n    },\n\n    {\n       13, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n\n     -310, -310, -310, -310, -310,  342, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310\n    },\n\n    {\n       13, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311,  343, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311, -311, -311,\n     -311, -311, -311, -311, -311, -311, -311, -311\n    },\n\n    {\n       13, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312,  165, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312\n    },\n\n    {\n       13, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n\n     -313,  344, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313\n    },\n\n    {\n       13, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314,  165, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314, -314, -314,\n     -314, -314, -314, -314, -314, -314, -314, -314\n    },\n\n    {\n       13, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315,  345, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315\n    },\n\n    {\n       13, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316,  346, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n     -316, -316, -316, -316, -316, -316, -316, -316, -316, -316,\n\n     -316, -316, -316, -316, -316, -316, -316, -316\n    },\n\n    {\n       13, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n\n     -317, -317, -317, -317, -317, -317, -317,  347, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317\n    },\n\n    {\n       13, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318,  348, -318, -318, -318, -318, -318, -318, -318,\n      349, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318\n    },\n\n    {\n       13, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319,  165, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319, -319, -319,\n     -319, -319, -319, -319, -319, -319, -319, -319\n\n    },\n\n    {\n       13, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320,  320, -320, -320, -320, -320, -320, -320, -320,\n      321, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320, -320, -320,\n     -320, -320, -320, -320, -320, -320, -320, -320\n    },\n\n    {\n       13, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321, -321, -321,\n     -321, -321, -321, -321, -321, -321, -321, -321\n    },\n\n    {\n       13, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322,  322, -322, -322, -322, -322, -322, -322, -322,\n\n      323, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322, -322, -322,\n     -322, -322, -322, -322, -322, -322, -322, -322\n    },\n\n    {\n       13, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n\n     -323, -323, -323, -323, -323, -323, -323, -323, -323, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323\n    },\n\n    {\n       13, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324,  350, -324, -324, -324,\n     -324, -324, -324, -324, -324, -324, -324, -324\n    },\n\n    {\n       13, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325\n    },\n\n    {\n       13, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326,  351, -326, -326, -326, -326,\n     -326, -326, -326, -326, -326, -326, -326, -326, -326, -326,\n\n     -326, -326, -326, -326, -326, -326, -326, -326\n    },\n\n    {\n       13, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327,  352, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327, -327\n    },\n\n    {\n       13, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328\n    },\n\n    {\n       13, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329\n\n    },\n\n    {\n       13, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330, -330, -330,\n     -330, -330, -330, -330, -330, -330, -330, -330\n    },\n\n    {\n       13, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331,  208, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331\n    },\n\n    {\n       13, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332,  353, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332\n    },\n\n    {\n       13, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333,  354, -333,\n\n     -333, -333, -333, -333, -333, -333, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333\n    },\n\n    {\n       13, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334,  355, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334\n    },\n\n    {\n       13, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335,  356, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335, -335, -335,\n     -335, -335, -335, -335, -335, -335, -335, -335\n    },\n\n    {\n       13, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336,  357, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n\n     -336, -336, -336, -336, -336, -336, -336, -336\n    },\n\n    {\n       13, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337\n    },\n\n    {\n       13, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338,  358, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338, -338, -338,\n     -338, -338, -338, -338, -338, -338, -338, -338\n    },\n\n    {\n       13, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n\n     -339, -339,  298, -339, -339, -339, -339, -339, -339, -339,\n     -339,  299, -339, -339, -339, -339, -339, -339,  339,  339,\n      339,  339,  339,  339,  339,  339,  339,  339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339\n\n    },\n\n    {\n       13, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340,  359, -340, -340, -340, -340, -340, -340, -340,\n     -340,  360, -340, -340, -340, -340, -340, -340,  361,  361,\n      361,  361,  361,  361,  361,  361,  361,  361, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340, -340, -340,\n     -340, -340, -340, -340, -340, -340, -340, -340\n    },\n\n    {\n       13, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341,  362, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341\n    },\n\n    {\n       13, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n      153, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342\n    },\n\n    {\n       13, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343,  153,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343\n    },\n\n    {\n       13, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n      165, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344\n    },\n\n    {\n       13, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345,  127,\n     -345, -345, -345, -345, -345, -345, -345, -345, -345, -345,\n     -345, -345, -345, -345, -345, -345, -345, -345\n    },\n\n    {\n       13, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346, -346, -346, -346, -346, -346,\n     -346, -346, -346, -346, -346,  363, -346, -346, -346, -346,\n\n     -346, -346, -346, -346, -346, -346, -346, -346\n    },\n\n    {\n       13, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n      127, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347, -347, -347,\n     -347, -347, -347, -347, -347, -347, -347, -347\n    },\n\n    {\n       13, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348,  348, -348, -348, -348, -348, -348, -348, -348,\n      349, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348, -348, -348,\n     -348, -348, -348, -348, -348, -348, -348, -348\n    },\n\n    {\n       13, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349, -349, -349,\n     -349, -349, -349, -349, -349, -349, -349, -349\n\n    },\n\n    {\n       13, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n\n     -350, -350, -350, -350, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350,  364, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350\n    },\n\n    {\n       13, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n      365, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351\n    },\n\n    {\n       13, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352,  366,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352, -352, -352,\n     -352, -352, -352, -352, -352, -352, -352, -352\n    },\n\n    {\n       13, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n\n      367, -353, -353, -353, -353, -353, -353, -353, -353, -353,\n     -353, -353, -353, -353, -353, -353, -353, -353\n    },\n\n    {\n       13, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354, -354, -354,\n     -354, -354, -354, -354, -354, -354, -354, -354\n    },\n\n    {\n       13, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355,  368,\n     -355, -355, -355, -355, -355, -355, -355, -355, -355, -355,\n     -355, -355, -355, -355, -355, -355, -355, -355\n    },\n\n    {\n       13, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356, -356, -356, -356, -356, -356,\n     -356, -356, -356, -356, -356,  369, -356, -356, -356, -356,\n\n     -356, -356, -356, -356, -356, -356, -356, -356\n    },\n\n    {\n       13, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n      370, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357, -357, -357,\n     -357, -357, -357, -357, -357, -357, -357, -357\n    },\n\n    {\n       13, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358, -358, -358,\n     -358, -358, -358, -358, -358, -358, -358, -358\n    },\n\n    {\n       13, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n\n     -359, -359,  359, -359, -359, -359, -359, -359, -359, -359,\n     -359,  360, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359, -359, -359,\n     -359, -359, -359, -359, -359, -359, -359, -359\n\n    },\n\n    {\n       13, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,\n     -360, -360, -360, -360, -360, -360, -360, -360\n    },\n\n    {\n       13, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361,  359, -361, -361, -361, -361, -361, -361, -361,\n     -361,  360, -361, -361, -361, -361, -361, -361,  361,  361,\n      361,  361,  361,  361,  361,  361,  361,  361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,\n     -361, -361, -361, -361, -361, -361, -361, -361\n    },\n\n    {\n       13, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362,  371, -362, -362, -362, -362, -362, -362, -362, -362,\n     -362, -362, -362, -362, -362, -362, -362, -362\n    },\n\n    {\n       13, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363, -363, -363,\n\n     -363, -363, -363, -363, -363,  127, -363, -363, -363, -363,\n     -363, -363, -363, -363, -363, -363, -363, -363\n    },\n\n    {\n       13, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364,  372, -364, -364, -364, -364, -364, -364, -364, -364,\n     -364, -364, -364, -364, -364, -364, -364, -364\n    },\n\n    {\n       13, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365, -365, -365,\n     -365, -365, -365, -365, -365, -365, -365, -365\n    },\n\n    {\n       13, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n     -366, -366, -366, -366, -366, -366, -366, -366, -366, -366,\n\n     -366, -366, -366, -366, -366, -366, -366, -366\n    },\n\n    {\n       13, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,\n     -367, -367, -367, -367, -367, -367, -367, -367\n    },\n\n    {\n       13, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368, -368, -368,\n     -368, -368, -368, -368, -368, -368, -368, -368\n    },\n\n    {\n       13, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369,  373, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369\n\n    },\n\n    {\n       13, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370, -370, -370,\n     -370, -370, -370, -370, -370, -370, -370, -370\n    },\n\n    {\n       13, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371,  127,\n     -371, -371, -371, -371, -371, -371, -371, -371, -371, -371,\n     -371, -371, -371, -371, -371, -371, -371, -371\n    },\n\n    {\n       13, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372,  374,\n     -372, -372, -372, -372, -372, -372, -372, -372, -372, -372,\n     -372, -372, -372, -372, -372, -372, -372, -372\n    },\n\n    {\n       13, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n\n     -373, -373, -373, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373\n    },\n\n    {\n       13, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374, -374, -374,\n     -374, -374, -374, -374, -374, -374, -374, -374\n    },\n\n    } ;\n\nstatic yy_state_type yy_get_previous_state ( yyscan_t yyscanner );\nstatic yy_state_type yy_try_NUL_trans ( yy_state_type current_state  , yyscan_t yyscanner);\nstatic int yy_get_next_buffer ( yyscan_t yyscanner );\nstatic void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );\n\n/* Done after the current pattern has been matched and before the\n * corresponding action - sets up yytext.\n */\n#define YY_DO_BEFORE_ACTION \\\n\tyyg->yytext_ptr = yy_bp; \\\n\tyyg->yytext_ptr -= yyg->yy_more_len; \\\n\tyyleng = (int) (yy_cp - yyg->yytext_ptr); \\\n\tyyg->yy_hold_char = *yy_cp; \\\n\t*yy_cp = '\\0'; \\\n\tyyg->yy_c_buf_p = yy_cp;\n#define YY_NUM_RULES 120\n#define YY_END_OF_BUFFER 121\n/* This struct is not used in this scanner,\n   but its presence is necessary. */\nstruct yy_trans_info\n\t{\n\tflex_int32_t yy_verify;\n\tflex_int32_t yy_nxt;\n\t};\nstatic const flex_int16_t yy_accept[375] =\n    {   0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n      119,  119,  121,   20,  120,    9,   11,   12,   14,   15,\n       20,   15,   15,   20,   15,   15,   15,   15,   20,   20,\n       15,   15,   15,   15,   19,   15,   20,   20,   15,   20,\n       20,   15,   20,   15,   20,   20,   15,   20,   15,   20,\n       20,    1,    8,   20,    2,   20,   20,   23,   21,   22,\n       44,   41,   38,   37,   40,   39,   43,   42,   31,   25,\n       24,   30,   35,   36,   26,   28,   29,   27,   33,   32,\n      107,   45,  107,   57,   62,   67,   68,   70,   73,   75,\n       84,  107,  107,   90,   93,  100,  103,  105,   46,  107,\n\n      107,   63,  107,   69,   71,  107,   79,  107,  107,   94,\n      107,  102,  107,  107,  118,  115,  114,  113,  118,  113,\n      116,  109,  117,  108,  119,    9,   15,    0,    0,   16,\n        0,   16,   16,   16,   16,    0,    0,   16,   17,    0,\n        0,    0,    0,   16,    0,    0,   16,    0,   15,   15,\n        0,   15,   15,    0,    0,    0,   16,    0,    0,    0,\n        0,   15,    0,    0,   15,    0,    0,    0,    0,    0,\n        0,    0,   15,   15,    0,    0,    0,    0,    0,    0,\n       15,    1,   13,    4,    0,    0,    0,   23,   34,   51,\n        0,    0,   72,   74,    0,   86,   92,    0,  106,    0,\n\n        0,    0,    0,    0,   58,    0,    0,   60,   61,    0,\n       66,    0,   76,   77,    0,    0,    0,    0,   87,   88,\n        0,    0,    0,   98,    0,    0,   46,  115,  114,  113,\n        0,  113,  116,  109,  117,  108,    0,    0,    0,    0,\n        0,  113,  116,  109,  119,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,   15,    0,    0,\n        0,   15,    0,    0,    0,    0,    3,    0,    0,    6,\n        0,    0,    0,   85,   99,   47,    0,    0,    0,   54,\n       55,    0,    0,   64,   65,   78,   80,   81,   82,   83,\n        0,   89,   91,    0,    0,    0,    0,    0,  112,    0,\n\n        0,    0,  110,    0,    0,    0,    0,    0,   18,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        7,    0,    5,    0,   56,    0,    0,   52,   53,   59,\n        0,    0,    0,    0,    0,    0,  101,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,   10,    0,\n        0,    0,    0,   89,    0,    0,    0,  104,    0,  111,\n        0,    0,    0,    0,   49,   50,   88,   95,    0,   97,\n        0,    0,   96,   48\n    } ;\n\nstatic const yy_state_type yy_NUL_trans[375] =\n    {   0,\n       14,   14,   58,   58,   61,   61,   81,   81,  115,  115,\n      125,  125,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,  188,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,  245,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,  188,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,  245,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0\n    } ;\n\n/* The intent behind this definition is that it'll catch\n * any uses of REJECT which flex missed.\n */\n#define REJECT reject_used_but_not_detected\n#define yymore() (yyg->yy_more_flag = 1)\n#define YY_MORE_ADJ yyg->yy_more_len\n#define YY_RESTORE_YY_MORE_OFFSET\n#line 1 \"wcsulex.l\"\n/*============================================================================\n  WCSLIB 7.7 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2021, Mark Calabretta\n\n  This file is part of WCSLIB.\n\n  WCSLIB is free software: you can redistribute it and/or modify it under the\n  terms of the GNU Lesser General Public License as published by the Free\n  Software Foundation, either version 3 of the License, or (at your option)\n  any later version.\n\n  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY\n  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n  more details.\n\n  You should have received a copy of the GNU Lesser General Public License\n  along with WCSLIB.  If not, see http://www.gnu.org/licenses.\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsulex.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $\n*=============================================================================\n*\n* wcsulex.l is a Flex description file containing the definition of a\n* recursive, multi-buffered lexical scanner and parser for FITS units\n* specifications.\n*\n* It requires Flex v2.5.4 or later.\n*\n* Refer to wcsunits.h for a description of the user interface and operating\n* notes.\n*\n*===========================================================================*/\n/* Options. */\n#define YY_NO_INPUT 1\n/* Exponents. */\n/* Metric prefixes. */\n/* Basic and derived SI units. */\n/* Additional recognized units: all metric prefixes allowed. */\n/* Additional recognized units: only super-metric prefixes allowed. */\n/* Additional recognized units: only sub-metric prefixes allowed. */\n/* Additional recognized units for which NO metric prefixes are allowed. */\n/* All additional recognized units. */\n/* Exclusive start states. */\n\n#line 85 \"wcsulex.l\"\n#include <math.h>\n#include <setjmp.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n#include \"wcserr.h\"\n#include \"wcsmath.h\"\n#include \"wcsunits.h\"\n#include \"wcsutil.h\"\n\n// User data associated with yyscanner.\nstruct wcsulex_extra {\n  // Used in preempting the call to exit() by yy_fatal_error().\n  jmp_buf abort_jmp_env;\n};\n\n#define YY_DECL int wcsulexe_scanner(const char unitstr[], int *func, \\\n double *scale, double units[WCSUNITS_NTYPE], struct wcserr **err, \\\n yyscan_t yyscanner)\n\n// Dummy definition to circumvent compiler warnings.\n#define YY_INPUT(inbuff, count, bufsize) { count = YY_NULL; }\n\n// Preempt the call to exit() by yy_fatal_error().\n#define exit(status) longjmp(yyextra->abort_jmp_env, status);\n\n// Internal helper functions.\nstatic YY_DECL;\n\n#line 7229 \"wcsulex.c\"\n#line 7230 \"wcsulex.c\"\n\n#define INITIAL 0\n#define PAREN 1\n#define PREFIX 2\n#define UNITS 3\n#define EXPON 4\n#define FLUSH 5\n\n#ifndef YY_NO_UNISTD_H\n/* Special case for \"unistd.h\", since it is non-ANSI. We include it way\n * down here because we want the user's section 1 to have been scanned first.\n * The user has a chance to override it with an option.\n */\n#include <unistd.h>\n#endif\n\n#define YY_EXTRA_TYPE struct wcsulex_extra *\n\n/* Holds the entire state of the reentrant scanner. */\nstruct yyguts_t\n    {\n\n    /* User-defined. Not touched by flex. */\n    YY_EXTRA_TYPE yyextra_r;\n\n    /* The rest are the same as the globals declared in the non-reentrant scanner. */\n    FILE *yyin_r, *yyout_r;\n    size_t yy_buffer_stack_top; /**< index of top of stack. */\n    size_t yy_buffer_stack_max; /**< capacity of stack. */\n    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */\n    char yy_hold_char;\n    int yy_n_chars;\n    int yyleng_r;\n    char *yy_c_buf_p;\n    int yy_init;\n    int yy_start;\n    int yy_did_buffer_switch_on_eof;\n    int yy_start_stack_ptr;\n    int yy_start_stack_depth;\n    int *yy_start_stack;\n    yy_state_type yy_last_accepting_state;\n    char* yy_last_accepting_cpos;\n\n    int yylineno_r;\n    int yy_flex_debug_r;\n\n    char *yytext_r;\n    int yy_more_flag;\n    int yy_more_len;\n\n    }; /* end struct yyguts_t */\n\nstatic int yy_init_globals ( yyscan_t yyscanner );\n\nint yylex_init (yyscan_t* scanner);\n\nint yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);\n\n/* Accessor methods to globals.\n   These are made visible to non-reentrant scanners for convenience. */\n\nint yylex_destroy ( yyscan_t yyscanner );\n\nint yyget_debug ( yyscan_t yyscanner );\n\nvoid yyset_debug ( int debug_flag , yyscan_t yyscanner );\n\nYY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );\n\nvoid yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );\n\nFILE *yyget_in ( yyscan_t yyscanner );\n\nvoid yyset_in  ( FILE * _in_str , yyscan_t yyscanner );\n\nFILE *yyget_out ( yyscan_t yyscanner );\n\nvoid yyset_out  ( FILE * _out_str , yyscan_t yyscanner );\n\n\t\t\tint yyget_leng ( yyscan_t yyscanner );\n\nchar *yyget_text ( yyscan_t yyscanner );\n\nint yyget_lineno ( yyscan_t yyscanner );\n\nvoid yyset_lineno ( int _line_number , yyscan_t yyscanner );\n\nint yyget_column  ( yyscan_t yyscanner );\n\nvoid yyset_column ( int _column_no , yyscan_t yyscanner );\n\n/* Macros after this point can all be overridden by user definitions in\n * section 1.\n */\n\n#ifndef YY_SKIP_YYWRAP\n#ifdef __cplusplus\nextern \"C\" int yywrap ( yyscan_t yyscanner );\n#else\nextern int yywrap ( yyscan_t yyscanner );\n#endif\n#endif\n\n#ifndef YY_NO_UNPUT\n    \n    static void yyunput ( int c, char *buf_ptr  , yyscan_t yyscanner);\n    \n#endif\n\n#ifndef yytext_ptr\nstatic void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);\n#endif\n\n#ifdef YY_NEED_STRLEN\nstatic int yy_flex_strlen ( const char * , yyscan_t yyscanner);\n#endif\n\n#ifndef YY_NO_INPUT\n#ifdef __cplusplus\nstatic int yyinput ( yyscan_t yyscanner );\n#else\nstatic int input ( yyscan_t yyscanner );\n#endif\n\n#endif\n\n/* Amount of stuff to slurp up with each read. */\n#ifndef YY_READ_BUF_SIZE\n#ifdef __ia64__\n/* On IA-64, the buffer size is 16k, not 8k */\n#define YY_READ_BUF_SIZE 16384\n#else\n#define YY_READ_BUF_SIZE 8192\n#endif /* __ia64__ */\n#endif\n\n/* Copy whatever the last rule matched to the standard output. */\n#ifndef ECHO\n/* This used to be an fputs(), but since the string might contain NUL's,\n * we now use fwrite().\n */\n#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)\n#endif\n\n/* Gets input and stuffs it into \"buf\".  number of characters read, or YY_NULL,\n * is returned in \"result\".\n */\n#ifndef YY_INPUT\n#define YY_INPUT(buf,result,max_size) \\\n\terrno=0; \\\n\twhile ( (result = (int) read( fileno(yyin), buf, (yy_size_t) max_size )) < 0 ) \\\n\t{ \\\n\t\tif( errno != EINTR) \\\n\t\t{ \\\n\t\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" ); \\\n\t\t\tbreak; \\\n\t\t} \\\n\t\terrno=0; \\\n\t\tclearerr(yyin); \\\n\t}\\\n\\\n\n#endif\n\n/* No semi-colon after return; correct usage is to write \"yyterminate();\" -\n * we don't want an extra ';' after the \"return\" because that will cause\n * some compilers to complain about unreachable statements.\n */\n#ifndef yyterminate\n#define yyterminate() return YY_NULL\n#endif\n\n/* Number of entries by which start-condition stack grows. */\n#ifndef YY_START_STACK_INCR\n#define YY_START_STACK_INCR 25\n#endif\n\n/* Report a fatal error. */\n#ifndef YY_FATAL_ERROR\n#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)\n#endif\n\n/* end tables serialization structures and prototypes */\n\n/* Default declaration of generated scanner - a define so the user can\n * easily add parameters.\n */\n#ifndef YY_DECL\n#define YY_DECL_IS_OURS 1\n\nextern int yylex (yyscan_t yyscanner);\n\n#define YY_DECL int yylex (yyscan_t yyscanner)\n#endif /* !YY_DECL */\n\n/* Code executed at the beginning of each rule, after yytext and yyleng\n * have been set up.\n */\n#ifndef YY_USER_ACTION\n#define YY_USER_ACTION\n#endif\n\n/* Code executed at the end of each rule. */\n#ifndef YY_BREAK\n#define YY_BREAK /*LINTED*/break;\n#endif\n\n#define YY_RULE_SETUP \\\n\tif ( yyleng > 0 ) \\\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = \\\n\t\t\t\t(yytext[yyleng - 1] == '\\n'); \\\n\tYY_USER_ACTION\n\n/** The main scanner function which does all the work.\n */\nYY_DECL\n{\n\tyy_state_type yy_current_state;\n\tchar *yy_cp, *yy_bp;\n\tint yy_act;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif ( !yyg->yy_init )\n\t\t{\n\t\tyyg->yy_init = 1;\n\n#ifdef YY_USER_INIT\n\t\tYY_USER_INIT;\n#endif\n\n\t\tif ( ! yyg->yy_start )\n\t\t\tyyg->yy_start = 1;\t/* first start state */\n\n\t\tif ( ! yyin )\n\t\t\tyyin = stdin;\n\n\t\tif ( ! yyout )\n\t\t\tyyout = stdout;\n\n\t\tif ( ! YY_CURRENT_BUFFER ) {\n\t\t\tyyensure_buffer_stack (yyscanner);\n\t\t\tYY_CURRENT_BUFFER_LVALUE =\n\t\t\t\tyy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);\n\t\t}\n\n\t\tyy_load_buffer_state( yyscanner );\n\t\t}\n\n\t{\n#line 116 \"wcsulex.l\"\n\n#line 118 \"wcsulex.l\"\n\tstatic const char *function = \"wcsulexe_scanner\";\n\t\n\tvoid add(double *factor, double types[], double *expon, double *scale,\n\t    double units[]);\n\t\n\t// Initialise returned values.\n\t*func  = 0;\n\t*scale = 1.0;\n\t\n\tfor (int i = 0; i < WCSUNITS_NTYPE; i++) {\n\t  units[i] = 0.0;\n\t}\n\t\n\tif (err) *err = 0x0;\n\t\n\tdouble types[WCSUNITS_NTYPE];\n\tfor (int i = 0; i < WCSUNITS_NTYPE; i++) {\n\t  types[i] = 0.0;\n\t}\n\tdouble expon  = 1.0;\n\tdouble factor = 1.0;\n\t\n\tint bracket  = 0;\n\tint operator = 0;\n\tint paren    = 0;\n\tint status   = 0;\n\t\n\t// Avert a flex-induced memory leak.\n\tif (YY_CURRENT_BUFFER && YY_CURRENT_BUFFER->yy_input_file == stdin) {\n\t  yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);\n\t}\n\t\n\tyy_scan_string(unitstr, yyscanner);\n\t\n\t// Return here via longjmp() invoked by yy_fatal_error().\n\tif (setjmp(yyextra->abort_jmp_env)) {\n\t  return wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR),\n\t    \"Internal units parser error parsing '%s'\", unitstr);\n\t}\n\t\n\tBEGIN(INITIAL);\n\t\n#ifdef DEBUG\n\tfprintf(stderr, \"\\n%s ->\\n\", unitstr);\n#endif\n\n#line 7529 \"wcsulex.c\"\n\n\twhile ( /*CONSTCOND*/1 )\t\t/* loops until end-of-file is reached */\n\t\t{\n\t\tyyg->yy_more_len = 0;\n\t\tif ( yyg->yy_more_flag )\n\t\t\t{\n\t\t\tyyg->yy_more_len = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);\n\t\t\tyyg->yy_more_flag = 0;\n\t\t\t}\n\t\tyy_cp = yyg->yy_c_buf_p;\n\n\t\t/* Support of yytext. */\n\t\t*yy_cp = yyg->yy_hold_char;\n\n\t\t/* yy_bp points to the position in yy_ch_buf of the start of\n\t\t * the current run.\n\t\t */\n\t\tyy_bp = yy_cp;\n\n\t\tyy_current_state = yyg->yy_start;\n\t\tyy_current_state += YY_AT_BOL();\nyy_match:\n\t\twhile ( (yy_current_state = yy_nxt[yy_current_state][ YY_SC_TO_UI(*yy_cp) ]) > 0 )\n\t\t\t{\n\t\t\tif ( yy_accept[yy_current_state] )\n\t\t\t\t{\n\t\t\t\tyyg->yy_last_accepting_state = yy_current_state;\n\t\t\t\tyyg->yy_last_accepting_cpos = yy_cp;\n\t\t\t\t}\n\n\t\t\t++yy_cp;\n\t\t\t}\n\n\t\tyy_current_state = -yy_current_state;\n\nyy_find_action:\n\t\tyy_act = yy_accept[yy_current_state];\n\n\t\tYY_DO_BEFORE_ACTION;\n\ndo_action:\t/* This label is used only to access EOF actions. */\n\n\t\tswitch ( yy_act )\n\t{ /* beginning of action switch */\n\t\t\tcase 0: /* must back up */\n\t\t\t/* undo the effects of YY_DO_BEFORE_ACTION */\n\t\t\t*yy_cp = yyg->yy_hold_char;\n\t\t\tyy_cp = yyg->yy_last_accepting_cpos + 1;\n\t\t\tyy_current_state = yyg->yy_last_accepting_state;\n\t\t\tgoto yy_find_action;\n\ncase 1:\nYY_RULE_SETUP\n#line 164 \"wcsulex.l\"\n{\n\t  // Pretend initial whitespace doesn't exist.\n\t  yy_set_bol(1);\n\t}\n\tYY_BREAK\ncase 2:\nYY_RULE_SETUP\n#line 169 \"wcsulex.l\"\n{\n\t  if (bracket++) {\n\t    BEGIN(FLUSH);\n\t  } else {\n\t    yy_set_bol(1);\n\t  }\n\t}\n\tYY_BREAK\ncase 3:\nYY_RULE_SETUP\n#line 177 \"wcsulex.l\"\n{\n\t  status = wcserr_set(WCSERR_SET(UNITSERR_BAD_NUM_MULTIPLIER),\n\t    \"Invalid exponent in '%s'\", unitstr);\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 4:\nYY_RULE_SETUP\n#line 183 \"wcsulex.l\"\n{\n\t  factor = 10.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 5:\nYY_RULE_SETUP\n#line 188 \"wcsulex.l\"\n{\n\t  *func = 1;\n\t  unput('(');\n\t  BEGIN(PAREN);\n\t}\n\tYY_BREAK\ncase 6:\nYY_RULE_SETUP\n#line 194 \"wcsulex.l\"\n{\n\t  *func = 2;\n\t  unput('(');\n\t  BEGIN(PAREN);\n\t}\n\tYY_BREAK\ncase 7:\nYY_RULE_SETUP\n#line 200 \"wcsulex.l\"\n{\n\t  *func = 3;\n\t  unput('(');\n\t  BEGIN(PAREN);\n\t}\n\tYY_BREAK\ncase 8:\nYY_RULE_SETUP\n#line 206 \"wcsulex.l\"\n{\n\t  // Leading binary multiply.\n\t  status = wcserr_set(WCSERR_SET(UNITSERR_DANGLING_BINOP),\n\t    \"Dangling binary operator in '%s'\", unitstr);\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 9:\nYY_RULE_SETUP\n#line 213 \"wcsulex.l\"\n// Discard whitespace in INITIAL context.\n\tYY_BREAK\ncase 10:\nYY_RULE_SETUP\n#line 215 \"wcsulex.l\"\n{\n\t  expon /= 2.0;\n\t  unput('(');\n\t  BEGIN(PAREN);\n\t}\n\tYY_BREAK\ncase 11:\nYY_RULE_SETUP\n#line 221 \"wcsulex.l\"\n{\n\t  // Gather terms in parentheses.\n\t  yyless(0);\n\t  BEGIN(PAREN);\n\t}\n\tYY_BREAK\ncase 12:\nYY_RULE_SETUP\n#line 227 \"wcsulex.l\"\n{\n\t  if (operator++) {\n\t    BEGIN(FLUSH);\n\t  }\n\t}\n\tYY_BREAK\ncase 13:\n#line 234 \"wcsulex.l\"\ncase 14:\nYY_RULE_SETUP\n#line 234 \"wcsulex.l\"\n{\n\t  if (operator++) {\n\t    BEGIN(FLUSH);\n\t  } else {\n\t    expon *= -1.0;\n\t  }\n\t}\n\tYY_BREAK\ncase 15:\nYY_RULE_SETUP\n#line 242 \"wcsulex.l\"\n{\n\t  operator = 0;\n\t  yyless(0);\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 16:\n#line 249 \"wcsulex.l\"\ncase 17:\n#line 250 \"wcsulex.l\"\ncase 18:\nYY_RULE_SETUP\n#line 250 \"wcsulex.l\"\n{\n\t  operator = 0;\n\t  yyless(0);\n\t  BEGIN(PREFIX);\n\t}\n\tYY_BREAK\ncase 19:\nYY_RULE_SETUP\n#line 256 \"wcsulex.l\"\n{\n\t  bracket = !bracket;\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 20:\nYY_RULE_SETUP\n#line 261 \"wcsulex.l\"\n{\n\t  status = wcserr_set(WCSERR_SET(UNITSERR_BAD_INITIAL_SYMBOL),\n\t    \"Invalid symbol in INITIAL context in '%s'\", unitstr);\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 21:\nYY_RULE_SETUP\n#line 267 \"wcsulex.l\"\n{\n\t  paren++;\n\t  operator = 0;\n\t  yymore();\n\t}\n\tYY_BREAK\ncase 22:\nYY_RULE_SETUP\n#line 273 \"wcsulex.l\"\n{\n\t  paren--;\n\t  if (paren) {\n\t    // Not balanced yet.\n\t    yymore();\n\t\n\t  } else {\n\t    // Balanced; strip off the outer parentheses and recurse.\n\t    yytext[yyleng-1] = '\\0';\n\t\n\t    int func_r;\n\t    double factor_r;\n\t    status = wcsulexe(yytext+1, &func_r, &factor_r, types, err);\n\t\n\t    YY_BUFFER_STATE buf = YY_CURRENT_BUFFER;\n\t    yy_switch_to_buffer(buf, yyscanner);\n\t\n\t    if (func_r) {\n\t      status = wcserr_set(WCSERR_SET(UNITSERR_FUNCTION_CONTEXT),\n\t        \"Function in invalid context in '%s'\", unitstr);\n\t    }\n\t\n\t    if (status) {\n\t      BEGIN(FLUSH);\n\t    } else {\n\t      factor *= factor_r;\n\t      BEGIN(EXPON);\n\t    }\n\t  }\n\t}\n\tYY_BREAK\ncase 23:\n/* rule 23 can match eol */\nYY_RULE_SETUP\n#line 304 \"wcsulex.l\"\n{\n\t  yymore();\n\t}\n\tYY_BREAK\ncase 24:\nYY_RULE_SETUP\n#line 308 \"wcsulex.l\"\n{\n\t  factor = 1e-1;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 25:\nYY_RULE_SETUP\n#line 313 \"wcsulex.l\"\n{\n\t  factor = 1e-2;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 26:\nYY_RULE_SETUP\n#line 318 \"wcsulex.l\"\n{\n\t  factor = 1e-3;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 27:\nYY_RULE_SETUP\n#line 323 \"wcsulex.l\"\n{\n\t  factor = 1e-6;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 28:\nYY_RULE_SETUP\n#line 328 \"wcsulex.l\"\n{\n\t  factor = 1e-9;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 29:\nYY_RULE_SETUP\n#line 333 \"wcsulex.l\"\n{\n\t  factor = 1e-12;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 30:\nYY_RULE_SETUP\n#line 338 \"wcsulex.l\"\n{\n\t  factor = 1e-15;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 31:\nYY_RULE_SETUP\n#line 343 \"wcsulex.l\"\n{\n\t  factor = 1e-18;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 32:\nYY_RULE_SETUP\n#line 348 \"wcsulex.l\"\n{\n\t  factor = 1e-21;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 33:\nYY_RULE_SETUP\n#line 353 \"wcsulex.l\"\n{\n\t  factor = 1e-24;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 34:\nYY_RULE_SETUP\n#line 358 \"wcsulex.l\"\n{\n\t  factor = 1e+1;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 35:\nYY_RULE_SETUP\n#line 363 \"wcsulex.l\"\n{\n\t  factor = 1e+2;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 36:\nYY_RULE_SETUP\n#line 368 \"wcsulex.l\"\n{\n\t  factor = 1e+3;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 37:\nYY_RULE_SETUP\n#line 373 \"wcsulex.l\"\n{\n\t  factor = 1e+6;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 38:\nYY_RULE_SETUP\n#line 378 \"wcsulex.l\"\n{\n\t  factor = 1e+9;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 39:\nYY_RULE_SETUP\n#line 383 \"wcsulex.l\"\n{\n\t  factor = 1e+12;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 40:\nYY_RULE_SETUP\n#line 388 \"wcsulex.l\"\n{\n\t  factor = 1e+15;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 41:\nYY_RULE_SETUP\n#line 393 \"wcsulex.l\"\n{\n\t  factor = 1e+18;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 42:\nYY_RULE_SETUP\n#line 398 \"wcsulex.l\"\n{\n\t  factor = 1e+21;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 43:\nYY_RULE_SETUP\n#line 403 \"wcsulex.l\"\n{\n\t  factor = 1e+24;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 44:\nYY_RULE_SETUP\n#line 408 \"wcsulex.l\"\n{\n\t  // Internal parser error.\n\t  status = wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR),\n\t    \"Internal units parser error parsing '%s'\", unitstr);\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 45:\nYY_RULE_SETUP\n#line 415 \"wcsulex.l\"\n{\n\t  // Ampere.\n\t  types[WCSUNITS_CHARGE] += 1.0;\n\t  types[WCSUNITS_TIME]   -= 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 46:\nYY_RULE_SETUP\n#line 422 \"wcsulex.l\"\n{\n\t  // Julian year (annum).\n\t  factor *= 31557600.0;\n\t  types[WCSUNITS_TIME] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 47:\nYY_RULE_SETUP\n#line 429 \"wcsulex.l\"\n{\n\t  // Analogue-to-digital converter units.\n\t  types[WCSUNITS_COUNT] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 48:\nYY_RULE_SETUP\n#line 435 \"wcsulex.l\"\n{\n\t  // Angstrom.\n\t  factor *= 1e-10;\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 49:\nYY_RULE_SETUP\n#line 442 \"wcsulex.l\"\n{\n\t  // Minute of arc.\n\t  factor /= 60.0;\n\t  types[WCSUNITS_PLANE_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 50:\nYY_RULE_SETUP\n#line 449 \"wcsulex.l\"\n{\n\t  // Second of arc.\n\t  factor /= 3600.0;\n\t  types[WCSUNITS_PLANE_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 51:\nYY_RULE_SETUP\n#line 456 \"wcsulex.l\"\n{\n\t  // Astronomical unit.\n\t  factor *= 1.49598e+11;\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 52:\nYY_RULE_SETUP\n#line 463 \"wcsulex.l\"\n{\n\t  // Barn.\n\t  factor *= 1e-28;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 53:\nYY_RULE_SETUP\n#line 470 \"wcsulex.l\"\n{\n\t  // Beam, as in Jy/beam.\n\t  types[WCSUNITS_BEAM] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 54:\nYY_RULE_SETUP\n#line 476 \"wcsulex.l\"\n{\n\t  // Bin (e.g. histogram).\n\t  types[WCSUNITS_BIN] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 55:\nYY_RULE_SETUP\n#line 482 \"wcsulex.l\"\n{\n\t  // Bit.\n\t  types[WCSUNITS_BIT] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 56:\nYY_RULE_SETUP\n#line 488 \"wcsulex.l\"\n{\n\t  // Byte.\n\t  factor *= 8.0;\n\t  types[WCSUNITS_BIT] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 57:\nYY_RULE_SETUP\n#line 495 \"wcsulex.l\"\n{\n\t  // Coulomb.\n\t  types[WCSUNITS_CHARGE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 58:\nYY_RULE_SETUP\n#line 501 \"wcsulex.l\"\n{\n\t  // Candela.\n\t  types[WCSUNITS_LUMINTEN] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 59:\nYY_RULE_SETUP\n#line 507 \"wcsulex.l\"\n{\n\t  // Channel.\n\t  types[WCSUNITS_BIN] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 60:\nYY_RULE_SETUP\n#line 513 \"wcsulex.l\"\n{\n\t  // Count.\n\t  types[WCSUNITS_COUNT] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 61:\nYY_RULE_SETUP\n#line 519 \"wcsulex.l\"\n{\n\t  // Julian century.\n\t  factor *= 3155760000.0;\n\t  types[WCSUNITS_TIME] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 62:\nYY_RULE_SETUP\n#line 526 \"wcsulex.l\"\n{\n\t  // Debye.\n\t  factor *= 1e-29 / 3.0;\n\t  types[WCSUNITS_CHARGE] += 1.0;\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 63:\nYY_RULE_SETUP\n#line 534 \"wcsulex.l\"\n{\n\t  // Day.\n\t  factor *= 86400.0;\n\t  types[WCSUNITS_TIME] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 64:\nYY_RULE_SETUP\n#line 541 \"wcsulex.l\"\n{\n\t  // Degree.\n\t  types[WCSUNITS_PLANE_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 65:\nYY_RULE_SETUP\n#line 547 \"wcsulex.l\"\n{\n\t  // Erg.\n\t  factor *= 1e-7;\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 66:\nYY_RULE_SETUP\n#line 556 \"wcsulex.l\"\n{\n\t  // Electron volt.\n\t  factor *= 1.6021765e-19;\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 67:\nYY_RULE_SETUP\n#line 565 \"wcsulex.l\"\n{\n\t  // Farad.\n\t  types[WCSUNITS_MASS]   -= 1.0;\n\t  types[WCSUNITS_LENGTH] -= 2.0;\n\t  types[WCSUNITS_TIME]   += 3.0;\n\t  types[WCSUNITS_CHARGE] += 2.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 68:\nYY_RULE_SETUP\n#line 574 \"wcsulex.l\"\n{\n\t  // Gauss.\n\t  factor *= 1e-4;\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_TIME]   += 1.0;\n\t  types[WCSUNITS_CHARGE] -= 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 69:\nYY_RULE_SETUP\n#line 583 \"wcsulex.l\"\n{\n\t  // Gram.\n\t  factor *= 1e-3;\n\t  types[WCSUNITS_MASS] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 70:\nYY_RULE_SETUP\n#line 590 \"wcsulex.l\"\n{\n\t  // Henry.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   += 2.0;\n\t  types[WCSUNITS_CHARGE] -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 71:\nYY_RULE_SETUP\n#line 599 \"wcsulex.l\"\n{\n\t  // Hour.\n\t  factor *= 3600.0;\n\t  types[WCSUNITS_TIME] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 72:\nYY_RULE_SETUP\n#line 606 \"wcsulex.l\"\n{\n\t  // Hertz.\n\t  types[WCSUNITS_TIME] -= 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 73:\nYY_RULE_SETUP\n#line 612 \"wcsulex.l\"\n{\n\t  // Joule.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 74:\nYY_RULE_SETUP\n#line 620 \"wcsulex.l\"\n{\n\t  // Jansky.\n\t  factor *= 1e-26;\n\t  types[WCSUNITS_MASS] += 1.0;\n\t  types[WCSUNITS_TIME] -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 75:\nYY_RULE_SETUP\n#line 628 \"wcsulex.l\"\n{\n\t  // Kelvin.\n\t  types[WCSUNITS_TEMPERATURE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 76:\nYY_RULE_SETUP\n#line 634 \"wcsulex.l\"\n{\n\t  // Lumen.\n\t  types[WCSUNITS_LUMINTEN]    += 1.0;\n\t  types[WCSUNITS_SOLID_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 77:\nYY_RULE_SETUP\n#line 641 \"wcsulex.l\"\n{\n\t  // Lux.\n\t  types[WCSUNITS_LUMINTEN]    += 1.0;\n\t  types[WCSUNITS_SOLID_ANGLE] += 1.0;\n\t  types[WCSUNITS_LENGTH]      -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 78:\nYY_RULE_SETUP\n#line 649 \"wcsulex.l\"\n{\n\t  // Light year.\n\t  factor *= 2.99792458e8 * 31557600.0;\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 79:\nYY_RULE_SETUP\n#line 656 \"wcsulex.l\"\n{\n\t  // Metre.\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 80:\nYY_RULE_SETUP\n#line 662 \"wcsulex.l\"\n{\n\t  // Stellar magnitude.\n\t  types[WCSUNITS_MAGNITUDE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 81:\nYY_RULE_SETUP\n#line 668 \"wcsulex.l\"\n{\n\t  // Milli-arcsec.\n\t  factor /= 3600e+3;\n\t  types[WCSUNITS_PLANE_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 82:\nYY_RULE_SETUP\n#line 675 \"wcsulex.l\"\n{\n\t  // Minute.\n\t  factor *= 60.0;\n\t  types[WCSUNITS_TIME] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 83:\nYY_RULE_SETUP\n#line 682 \"wcsulex.l\"\n{\n\t  // Mole.\n\t  types[WCSUNITS_MOLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 84:\nYY_RULE_SETUP\n#line 688 \"wcsulex.l\"\n{\n\t  // Newton.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  types[WCSUNITS_TIME]   -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 85:\nYY_RULE_SETUP\n#line 696 \"wcsulex.l\"\n{\n\t  // Ohm.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   -= 1.0;\n\t  types[WCSUNITS_CHARGE] -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 86:\nYY_RULE_SETUP\n#line 705 \"wcsulex.l\"\n{\n\t  // Pascal.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] -= 1.0;\n\t  types[WCSUNITS_TIME]   -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 87:\nYY_RULE_SETUP\n#line 713 \"wcsulex.l\"\n{\n\t  // Parsec.\n\t  factor *= 3.0857e16;\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 88:\nYY_RULE_SETUP\n#line 720 \"wcsulex.l\"\n{\n\t  // Photon.\n\t  types[WCSUNITS_COUNT] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 89:\nYY_RULE_SETUP\n#line 726 \"wcsulex.l\"\n{\n\t  // Pixel.\n\t  types[WCSUNITS_PIXEL] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 90:\nYY_RULE_SETUP\n#line 732 \"wcsulex.l\"\n{\n\t  // Rayleigh.\n\t  factor *= 1e10 / (4.0 * PI);\n\t  types[WCSUNITS_LENGTH]      -= 2.0;\n\t  types[WCSUNITS_TIME]        -= 1.0;\n\t  types[WCSUNITS_SOLID_ANGLE] -= 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 91:\nYY_RULE_SETUP\n#line 741 \"wcsulex.l\"\n{\n\t  // Radian.\n\t  factor *= 180.0 / PI;\n\t  types[WCSUNITS_PLANE_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 92:\nYY_RULE_SETUP\n#line 748 \"wcsulex.l\"\n{\n\t  // Rydberg.\n\t  factor *= 13.605692 * 1.6021765e-19;\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   -= 2.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 93:\nYY_RULE_SETUP\n#line 757 \"wcsulex.l\"\n{\n\t  // Siemen.\n\t  types[WCSUNITS_MASS]   -= 1.0;\n\t  types[WCSUNITS_LENGTH] -= 2.0;\n\t  types[WCSUNITS_TIME]   += 1.0;\n\t  types[WCSUNITS_CHARGE] += 2.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 94:\nYY_RULE_SETUP\n#line 766 \"wcsulex.l\"\n{\n\t  // Second.\n\t  types[WCSUNITS_TIME] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 95:\nYY_RULE_SETUP\n#line 772 \"wcsulex.l\"\n{\n\t  // Solar luminosity.\n\t  factor *= 3.8268e26;\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   -= 3.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 96:\nYY_RULE_SETUP\n#line 781 \"wcsulex.l\"\n{\n\t  // Solar mass.\n\t  factor *= 1.9891e30;\n\t  types[WCSUNITS_MASS] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 97:\nYY_RULE_SETUP\n#line 788 \"wcsulex.l\"\n{\n\t  // Solar radius.\n\t  factor *= 6.9599e8;\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 98:\nYY_RULE_SETUP\n#line 795 \"wcsulex.l\"\n{\n\t  // Steradian.\n\t  types[WCSUNITS_SOLID_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 99:\nYY_RULE_SETUP\n#line 801 \"wcsulex.l\"\n{\n\t  // Sun (with respect to).\n\t  types[WCSUNITS_SOLRATIO] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 100:\nYY_RULE_SETUP\n#line 807 \"wcsulex.l\"\n{\n\t  // Tesla.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_TIME]   += 1.0;\n\t  types[WCSUNITS_CHARGE] -= 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 101:\nYY_RULE_SETUP\n#line 815 \"wcsulex.l\"\n{\n\t  // Turn.\n\t  factor *= 360.0;\n\t  types[WCSUNITS_PLANE_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 102:\nYY_RULE_SETUP\n#line 822 \"wcsulex.l\"\n{\n\t  // Unified atomic mass unit.\n\t  factor *= 1.6605387e-27;\n\t  types[WCSUNITS_MASS] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 103:\nYY_RULE_SETUP\n#line 829 \"wcsulex.l\"\n{\n\t  // Volt.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  types[WCSUNITS_TIME]   -= 2.0;\n\t  types[WCSUNITS_CHARGE] -= 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 104:\nYY_RULE_SETUP\n#line 838 \"wcsulex.l\"\n{\n\t  // Voxel.\n\t  types[WCSUNITS_VOXEL] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 105:\nYY_RULE_SETUP\n#line 844 \"wcsulex.l\"\n{\n\t  // Watt.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   -= 3.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 106:\nYY_RULE_SETUP\n#line 852 \"wcsulex.l\"\n{\n\t  // Weber.\n\t  types[WCSUNITS_MASS]   += 1.0;\n\t  types[WCSUNITS_LENGTH] += 2.0;\n\t  types[WCSUNITS_TIME]   += 1.0;\n\t  types[WCSUNITS_CHARGE] -= 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 107:\nYY_RULE_SETUP\n#line 861 \"wcsulex.l\"\n{\n\t  // Internal parser error.\n\t  status = wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR),\n\t    \"Internal units parser error parsing '%s'\", unitstr);\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 108:\nYY_RULE_SETUP\n#line 868 \"wcsulex.l\"\n{\n\t  // Exponentiation.\n\t  if (operator++) {\n\t    BEGIN(FLUSH);\n\t  }\n\t}\n\tYY_BREAK\ncase 109:\nYY_RULE_SETUP\n#line 875 \"wcsulex.l\"\n{\n\t  int i;\n\t  sscanf(yytext, \" %d\", &i);\n\t  expon *= (double)i;\n\t  add(&factor, types, &expon, scale, units);\n\t  operator = 0;\n\t  BEGIN(INITIAL);\n\t}\n\tYY_BREAK\ncase 110:\nYY_RULE_SETUP\n#line 884 \"wcsulex.l\"\n{\n\t  int i;\n\t  sscanf(yytext, \" (%d)\", &i);\n\t  expon *= (double)i;\n\t  add(&factor, types, &expon, scale, units);\n\t  operator = 0;\n\t  BEGIN(INITIAL);\n\t}\n\tYY_BREAK\ncase 111:\nYY_RULE_SETUP\n#line 893 \"wcsulex.l\"\n{\n\t  int i, j;\n\t  sscanf(yytext, \" (%d/%d)\", &i, &j);\n\t  expon *= (double)i / (double)j;\n\t  add(&factor, types, &expon, scale, units);\n\t  operator = 0;\n\t  BEGIN(INITIAL);\n\t}\n\tYY_BREAK\ncase 112:\nYY_RULE_SETUP\n#line 902 \"wcsulex.l\"\n{\n\t  char ctmp[72];\n\t  sscanf(yytext, \" (%s)\", ctmp);\n\t  double dexp;\n\t  wcsutil_str2double(ctmp, &dexp);\n\t  expon *= dexp;\n\t  add(&factor, types, &expon, scale, units);\n\t  operator = 0;\n\t  BEGIN(INITIAL);\n\t}\n\tYY_BREAK\ncase 113:\nYY_RULE_SETUP\n#line 913 \"wcsulex.l\"\n{\n\t  // Multiply.\n\t  if (operator++) {\n\t    BEGIN(FLUSH);\n\t  } else {\n\t    add(&factor, types, &expon, scale, units);\n\t    BEGIN(INITIAL);\n\t  }\n\t}\n\tYY_BREAK\ncase 114:\nYY_RULE_SETUP\n#line 923 \"wcsulex.l\"\n{\n\t  // Multiply.\n\t  if (operator) {\n\t    BEGIN(FLUSH);\n\t  } else {\n\t    add(&factor, types, &expon, scale, units);\n\t    unput('(');\n\t    BEGIN(INITIAL);\n\t  }\n\t}\n\tYY_BREAK\ncase 115:\nYY_RULE_SETUP\n#line 934 \"wcsulex.l\"\n{\n\t  // Multiply.\n\t  if (operator) {\n\t    BEGIN(FLUSH);\n\t  } else {\n\t    add(&factor, types, &expon, scale, units);\n\t    BEGIN(INITIAL);\n\t  }\n\t}\n\tYY_BREAK\ncase 116:\nYY_RULE_SETUP\n#line 944 \"wcsulex.l\"\n{\n\t  // Divide.\n\t  if (operator++) {\n\t    BEGIN(FLUSH);\n\t  } else {\n\t    add(&factor, types, &expon, scale, units);\n\t    expon = -1.0;\n\t    BEGIN(INITIAL);\n\t  }\n\t}\n\tYY_BREAK\ncase 117:\nYY_RULE_SETUP\n#line 955 \"wcsulex.l\"\n{\n\t  add(&factor, types, &expon, scale, units);\n\t  bracket = !bracket;\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 118:\nYY_RULE_SETUP\n#line 961 \"wcsulex.l\"\n{\n\t  status = wcserr_set(WCSERR_SET(UNITSERR_BAD_EXPON_SYMBOL),\n\t    \"Invalid symbol in EXPON context in '%s'\", unitstr);\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 119:\nYY_RULE_SETUP\n#line 967 \"wcsulex.l\"\n{\n\t  // Discard any remaining input.\n\t}\n\tYY_BREAK\ncase YY_STATE_EOF(INITIAL):\ncase YY_STATE_EOF(PAREN):\ncase YY_STATE_EOF(PREFIX):\ncase YY_STATE_EOF(UNITS):\ncase YY_STATE_EOF(EXPON):\ncase YY_STATE_EOF(FLUSH):\n#line 971 \"wcsulex.l\"\n{\n\t  // End-of-string.\n\t  if (YY_START == EXPON) {\n\t    add(&factor, types, &expon, scale, units);\n\t  }\n\t\n\t  if (bracket) {\n\t    status = wcserr_set(WCSERR_SET(UNITSERR_UNBAL_BRACKET),\n\t      \"Unbalanced bracket in '%s'\", unitstr);\n\t  } else if (paren) {\n\t    status = wcserr_set(WCSERR_SET(UNITSERR_UNBAL_PAREN),\n\t      \"Unbalanced parenthesis in '%s'\", unitstr);\n\t  } else if (operator == 1) {\n\t    status = wcserr_set(WCSERR_SET(UNITSERR_DANGLING_BINOP),\n\t      \"Dangling binary operator in '%s'\", unitstr);\n\t  } else if (operator) {\n\t    status = wcserr_set(WCSERR_SET(UNITSERR_CONSEC_BINOPS),\n\t      \"Consecutive binary operators in '%s'\", unitstr);\n#ifdef DEBUG\n\t  } else {\n\t    fprintf(stderr, \"EOS\\n\");\n#endif\n\t  }\n\t\n\t  if (status) {\n\t    for (int i = 0; i < WCSUNITS_NTYPE; i++) {\n\t      units[i] = 0.0;\n\t      *scale = 0.0;\n\t    }\n\t  }\n\t\n\t  return status;\n\t}\n\tYY_BREAK\ncase 120:\nYY_RULE_SETUP\n#line 1005 \"wcsulex.l\"\nECHO;\n\tYY_BREAK\n#line 8786 \"wcsulex.c\"\n\n\tcase YY_END_OF_BUFFER:\n\t\t{\n\t\t/* Amount of text matched not including the EOB char. */\n\t\tint yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;\n\n\t\t/* Undo the effects of YY_DO_BEFORE_ACTION. */\n\t\t*yy_cp = yyg->yy_hold_char;\n\t\tYY_RESTORE_YY_MORE_OFFSET\n\n\t\tif ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )\n\t\t\t{\n\t\t\t/* We're scanning a new file or input source.  It's\n\t\t\t * possible that this happened because the user\n\t\t\t * just pointed yyin at a new source and called\n\t\t\t * yylex().  If so, then we have to assure\n\t\t\t * consistency between YY_CURRENT_BUFFER and our\n\t\t\t * globals.  Here is the right place to do so, because\n\t\t\t * this is the first action (other than possibly a\n\t\t\t * back-up) that will match for the new input source.\n\t\t\t */\n\t\t\tyyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;\n\t\t\t}\n\n\t\t/* Note that here we test for yy_c_buf_p \"<=\" to the position\n\t\t * of the first EOB in the buffer, since yy_c_buf_p will\n\t\t * already have been incremented past the NUL character\n\t\t * (since all states make transitions on EOB to the\n\t\t * end-of-buffer state).  Contrast this with the test\n\t\t * in input().\n\t\t */\n\t\tif ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )\n\t\t\t{ /* This was really a NUL. */\n\t\t\tyy_state_type yy_next_state;\n\n\t\t\tyyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;\n\n\t\t\tyy_current_state = yy_get_previous_state( yyscanner );\n\n\t\t\t/* Okay, we're now positioned to make the NUL\n\t\t\t * transition.  We couldn't have\n\t\t\t * yy_get_previous_state() go ahead and do it\n\t\t\t * for us because it doesn't know how to deal\n\t\t\t * with the possibility of jamming (and we don't\n\t\t\t * want to build jamming into it because then it\n\t\t\t * will run more slowly).\n\t\t\t */\n\n\t\t\tyy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);\n\n\t\t\tyy_bp = yyg->yytext_ptr + YY_MORE_ADJ;\n\n\t\t\tif ( yy_next_state )\n\t\t\t\t{\n\t\t\t\t/* Consume the NUL. */\n\t\t\t\tyy_cp = ++yyg->yy_c_buf_p;\n\t\t\t\tyy_current_state = yy_next_state;\n\t\t\t\tgoto yy_match;\n\t\t\t\t}\n\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tyy_cp = yyg->yy_c_buf_p;\n\t\t\t\tgoto yy_find_action;\n\t\t\t\t}\n\t\t\t}\n\n\t\telse switch ( yy_get_next_buffer( yyscanner ) )\n\t\t\t{\n\t\t\tcase EOB_ACT_END_OF_FILE:\n\t\t\t\t{\n\t\t\t\tyyg->yy_did_buffer_switch_on_eof = 0;\n\n\t\t\t\tif ( yywrap( yyscanner ) )\n\t\t\t\t\t{\n\t\t\t\t\t/* Note: because we've taken care in\n\t\t\t\t\t * yy_get_next_buffer() to have set up\n\t\t\t\t\t * yytext, we can now set up\n\t\t\t\t\t * yy_c_buf_p so that if some total\n\t\t\t\t\t * hoser (like flex itself) wants to\n\t\t\t\t\t * call the scanner after we return the\n\t\t\t\t\t * YY_NULL, it'll still work - another\n\t\t\t\t\t * YY_NULL will get returned.\n\t\t\t\t\t */\n\t\t\t\t\tyyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;\n\n\t\t\t\t\tyy_act = YY_STATE_EOF(YY_START);\n\t\t\t\t\tgoto do_action;\n\t\t\t\t\t}\n\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\tif ( ! yyg->yy_did_buffer_switch_on_eof )\n\t\t\t\t\t\tYY_NEW_FILE;\n\t\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\tcase EOB_ACT_CONTINUE_SCAN:\n\t\t\t\tyyg->yy_c_buf_p =\n\t\t\t\t\tyyg->yytext_ptr + yy_amount_of_matched_text;\n\n\t\t\t\tyy_current_state = yy_get_previous_state( yyscanner );\n\n\t\t\t\tyy_cp = yyg->yy_c_buf_p;\n\t\t\t\tyy_bp = yyg->yytext_ptr + YY_MORE_ADJ;\n\t\t\t\tgoto yy_match;\n\n\t\t\tcase EOB_ACT_LAST_MATCH:\n\t\t\t\tyyg->yy_c_buf_p =\n\t\t\t\t&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];\n\n\t\t\t\tyy_current_state = yy_get_previous_state( yyscanner );\n\n\t\t\t\tyy_cp = yyg->yy_c_buf_p;\n\t\t\t\tyy_bp = yyg->yytext_ptr + YY_MORE_ADJ;\n\t\t\t\tgoto yy_find_action;\n\t\t\t}\n\t\tbreak;\n\t\t}\n\n\tdefault:\n\t\tYY_FATAL_ERROR(\n\t\t\t\"fatal flex scanner internal error--no action found\" );\n\t} /* end of action switch */\n\t\t} /* end of scanning one token */\n\t} /* end of user's declarations */\n} /* end of yylex */\n\n/* yy_get_next_buffer - try to read in a new buffer\n *\n * Returns a code representing an action:\n *\tEOB_ACT_LAST_MATCH -\n *\tEOB_ACT_CONTINUE_SCAN - continue scanning from current position\n *\tEOB_ACT_END_OF_FILE - end of file\n */\nstatic int yy_get_next_buffer (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tchar *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;\n\tchar *source = yyg->yytext_ptr;\n\tint number_to_move, i;\n\tint ret_val;\n\n\tif ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )\n\t\tYY_FATAL_ERROR(\n\t\t\"fatal flex scanner internal error--end of buffer missed\" );\n\n\tif ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )\n\t\t{ /* Don't try to fill the buffer, so this is an EOF. */\n\t\tif ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )\n\t\t\t{\n\t\t\t/* We matched a single character, the EOB, so\n\t\t\t * treat this as a final EOF.\n\t\t\t */\n\t\t\treturn EOB_ACT_END_OF_FILE;\n\t\t\t}\n\n\t\telse\n\t\t\t{\n\t\t\t/* We matched some text prior to the EOB, first\n\t\t\t * process it.\n\t\t\t */\n\t\t\treturn EOB_ACT_LAST_MATCH;\n\t\t\t}\n\t\t}\n\n\t/* Try to read more data. */\n\n\t/* First move last chars to start of buffer. */\n\tnumber_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);\n\n\tfor ( i = 0; i < number_to_move; ++i )\n\t\t*(dest++) = *(source++);\n\n\tif ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )\n\t\t/* don't do the read, it's not guaranteed to return an EOF,\n\t\t * just force an EOF\n\t\t */\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;\n\n\telse\n\t\t{\n\t\t\tint num_to_read =\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;\n\n\t\twhile ( num_to_read <= 0 )\n\t\t\t{ /* Not enough room in the buffer - grow it. */\n\n\t\t\t/* just a shorter name for the current buffer */\n\t\t\tYY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;\n\n\t\t\tint yy_c_buf_p_offset =\n\t\t\t\t(int) (yyg->yy_c_buf_p - b->yy_ch_buf);\n\n\t\t\tif ( b->yy_is_our_buffer )\n\t\t\t\t{\n\t\t\t\tint new_size = b->yy_buf_size * 2;\n\n\t\t\t\tif ( new_size <= 0 )\n\t\t\t\t\tb->yy_buf_size += b->yy_buf_size / 8;\n\t\t\t\telse\n\t\t\t\t\tb->yy_buf_size *= 2;\n\n\t\t\t\tb->yy_ch_buf = (char *)\n\t\t\t\t\t/* Include room in for 2 EOB chars. */\n\t\t\t\t\tyyrealloc( (void *) b->yy_ch_buf,\n\t\t\t\t\t\t\t (yy_size_t) (b->yy_buf_size + 2) , yyscanner );\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t/* Can't grow it, we don't own it. */\n\t\t\t\tb->yy_ch_buf = NULL;\n\n\t\t\tif ( ! b->yy_ch_buf )\n\t\t\t\tYY_FATAL_ERROR(\n\t\t\t\t\"fatal error - scanner input buffer overflow\" );\n\n\t\t\tyyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];\n\n\t\t\tnum_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -\n\t\t\t\t\t\tnumber_to_move - 1;\n\n\t\t\t}\n\n\t\tif ( num_to_read > YY_READ_BUF_SIZE )\n\t\t\tnum_to_read = YY_READ_BUF_SIZE;\n\n\t\t/* Read in more data. */\n\t\tYY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),\n\t\t\tyyg->yy_n_chars, num_to_read );\n\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;\n\t\t}\n\n\tif ( yyg->yy_n_chars == 0 )\n\t\t{\n\t\tif ( number_to_move == YY_MORE_ADJ )\n\t\t\t{\n\t\t\tret_val = EOB_ACT_END_OF_FILE;\n\t\t\tyyrestart( yyin  , yyscanner);\n\t\t\t}\n\n\t\telse\n\t\t\t{\n\t\t\tret_val = EOB_ACT_LAST_MATCH;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buffer_status =\n\t\t\t\tYY_BUFFER_EOF_PENDING;\n\t\t\t}\n\t\t}\n\n\telse\n\t\tret_val = EOB_ACT_CONTINUE_SCAN;\n\n\tif ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {\n\t\t/* Extend the array by 50%, plus the number we really need. */\n\t\tint new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(\n\t\t\t(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );\n\t\tif ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_get_next_buffer()\" );\n\t\t/* \"- 2\" to take care of EOB's */\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);\n\t}\n\n\tyyg->yy_n_chars += number_to_move;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;\n\n\tyyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];\n\n\treturn ret_val;\n}\n\n/* yy_get_previous_state - get the state just before the EOB char was reached */\n\n    static yy_state_type yy_get_previous_state (yyscan_t yyscanner)\n{\n\tyy_state_type yy_current_state;\n\tchar *yy_cp;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tyy_current_state = yyg->yy_start;\n\tyy_current_state += YY_AT_BOL();\n\n\tfor ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )\n\t\t{\n\t\tif ( *yy_cp )\n\t\t\t{\n\t\t\tyy_current_state = yy_nxt[yy_current_state][YY_SC_TO_UI(*yy_cp)];\n\t\t\t}\n\t\telse\n\t\t\tyy_current_state = yy_NUL_trans[yy_current_state];\n\t\tif ( yy_accept[yy_current_state] )\n\t\t\t{\n\t\t\tyyg->yy_last_accepting_state = yy_current_state;\n\t\t\tyyg->yy_last_accepting_cpos = yy_cp;\n\t\t\t}\n\t\t}\n\n\treturn yy_current_state;\n}\n\n/* yy_try_NUL_trans - try to make a transition on the NUL character\n *\n * synopsis\n *\tnext_state = yy_try_NUL_trans( current_state );\n */\n    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)\n{\n\tint yy_is_jam;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */\n\tchar *yy_cp = yyg->yy_c_buf_p;\n\n\tyy_current_state = yy_NUL_trans[yy_current_state];\n\tyy_is_jam = (yy_current_state == 0);\n\n\tif ( ! yy_is_jam )\n\t\t{\n\t\tif ( yy_accept[yy_current_state] )\n\t\t\t{\n\t\t\tyyg->yy_last_accepting_state = yy_current_state;\n\t\t\tyyg->yy_last_accepting_cpos = yy_cp;\n\t\t\t}\n\t\t}\n\n\t(void)yyg;\n\treturn yy_is_jam ? 0 : yy_current_state;\n}\n\n#ifndef YY_NO_UNPUT\n\n    static void yyunput (int c, char * yy_bp , yyscan_t yyscanner)\n{\n\tchar *yy_cp;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n    yy_cp = yyg->yy_c_buf_p;\n\n\t/* undo effects of setting up yytext */\n\t*yy_cp = yyg->yy_hold_char;\n\n\tif ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )\n\t\t{ /* need to shift things up to make room */\n\t\t/* +2 for EOB chars. */\n\t\tint number_to_move = yyg->yy_n_chars + 2;\n\t\tchar *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[\n\t\t\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];\n\t\tchar *source =\n\t\t\t\t&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];\n\n\t\twhile ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )\n\t\t\t*--dest = *--source;\n\n\t\tyy_cp += (int) (dest - source);\n\t\tyy_bp += (int) (dest - source);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars =\n\t\t\tyyg->yy_n_chars = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;\n\n\t\tif ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )\n\t\t\tYY_FATAL_ERROR( \"flex scanner push-back overflow\" );\n\t\t}\n\n\t*--yy_cp = (char) c;\n\n\tyyg->yytext_ptr = yy_bp;\n\tyyg->yy_hold_char = *yy_cp;\n\tyyg->yy_c_buf_p = yy_cp;\n}\n\n#endif\n\n#ifndef YY_NO_INPUT\n#ifdef __cplusplus\n    static int yyinput (yyscan_t yyscanner)\n#else\n    static int input  (yyscan_t yyscanner)\n#endif\n\n{\n\tint c;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\t*yyg->yy_c_buf_p = yyg->yy_hold_char;\n\n\tif ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )\n\t\t{\n\t\t/* yy_c_buf_p now points to the character we want to return.\n\t\t * If this occurs *before* the EOB characters, then it's a\n\t\t * valid NUL; if not, then we've hit the end of the buffer.\n\t\t */\n\t\tif ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )\n\t\t\t/* This was really a NUL. */\n\t\t\t*yyg->yy_c_buf_p = '\\0';\n\n\t\telse\n\t\t\t{ /* need more input */\n\t\t\tint offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);\n\t\t\t++yyg->yy_c_buf_p;\n\n\t\t\tswitch ( yy_get_next_buffer( yyscanner ) )\n\t\t\t\t{\n\t\t\t\tcase EOB_ACT_LAST_MATCH:\n\t\t\t\t\t/* This happens because yy_g_n_b()\n\t\t\t\t\t * sees that we've accumulated a\n\t\t\t\t\t * token and flags that we need to\n\t\t\t\t\t * try matching the token before\n\t\t\t\t\t * proceeding.  But for input(),\n\t\t\t\t\t * there's no matching to consider.\n\t\t\t\t\t * So convert the EOB_ACT_LAST_MATCH\n\t\t\t\t\t * to EOB_ACT_END_OF_FILE.\n\t\t\t\t\t */\n\n\t\t\t\t\t/* Reset buffer status. */\n\t\t\t\t\tyyrestart( yyin , yyscanner);\n\n\t\t\t\t\t/*FALLTHROUGH*/\n\n\t\t\t\tcase EOB_ACT_END_OF_FILE:\n\t\t\t\t\t{\n\t\t\t\t\tif ( yywrap( yyscanner ) )\n\t\t\t\t\t\treturn 0;\n\n\t\t\t\t\tif ( ! yyg->yy_did_buffer_switch_on_eof )\n\t\t\t\t\t\tYY_NEW_FILE;\n#ifdef __cplusplus\n\t\t\t\t\treturn yyinput(yyscanner);\n#else\n\t\t\t\t\treturn input(yyscanner);\n#endif\n\t\t\t\t\t}\n\n\t\t\t\tcase EOB_ACT_CONTINUE_SCAN:\n\t\t\t\t\tyyg->yy_c_buf_p = yyg->yytext_ptr + offset;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tc = *(unsigned char *) yyg->yy_c_buf_p;\t/* cast for 8-bit char's */\n\t*yyg->yy_c_buf_p = '\\0';\t/* preserve yytext */\n\tyyg->yy_hold_char = *++yyg->yy_c_buf_p;\n\n\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\\n');\n\n\treturn c;\n}\n#endif\t/* ifndef YY_NO_INPUT */\n\n/** Immediately switch to a different input stream.\n * @param input_file A readable stream.\n * @param yyscanner The scanner object.\n * @note This function does not reset the start condition to @c INITIAL .\n */\n    void yyrestart  (FILE * input_file , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif ( ! YY_CURRENT_BUFFER ){\n        yyensure_buffer_stack (yyscanner);\n\t\tYY_CURRENT_BUFFER_LVALUE =\n            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);\n\t}\n\n\tyy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);\n\tyy_load_buffer_state( yyscanner );\n}\n\n/** Switch to a different input buffer.\n * @param new_buffer The new input buffer.\n * @param yyscanner The scanner object.\n */\n    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\t/* TODO. We should be able to replace this entire function body\n\t * with\n\t *\t\tyypop_buffer_state();\n\t *\t\tyypush_buffer_state(new_buffer);\n     */\n\tyyensure_buffer_stack (yyscanner);\n\tif ( YY_CURRENT_BUFFER == new_buffer )\n\t\treturn;\n\n\tif ( YY_CURRENT_BUFFER )\n\t\t{\n\t\t/* Flush out information for old buffer. */\n\t\t*yyg->yy_c_buf_p = yyg->yy_hold_char;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;\n\t\t}\n\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\tyy_load_buffer_state( yyscanner );\n\n\t/* We don't actually know whether we did this switch during\n\t * EOF (yywrap()) processing, but the only time this flag\n\t * is looked at is after yywrap() is called, so it's safe\n\t * to go ahead and always set it.\n\t */\n\tyyg->yy_did_buffer_switch_on_eof = 1;\n}\n\nstatic void yy_load_buffer_state  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tyyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\tyyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;\n\tyyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;\n\tyyg->yy_hold_char = *yyg->yy_c_buf_p;\n}\n\n/** Allocate and initialize an input buffer state.\n * @param file A readable stream.\n * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.\n * @param yyscanner The scanner object.\n * @return the allocated buffer state.\n */\n    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)\n{\n\tYY_BUFFER_STATE b;\n    \n\tb = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );\n\n\tb->yy_buf_size = size;\n\n\t/* yy_ch_buf has to be 2 characters longer than the size given because\n\t * we need to put in 2 end-of-buffer characters.\n\t */\n\tb->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );\n\tif ( ! b->yy_ch_buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );\n\n\tb->yy_is_our_buffer = 1;\n\n\tyy_init_buffer( b, file , yyscanner);\n\n\treturn b;\n}\n\n/** Destroy the buffer.\n * @param b a buffer created with yy_create_buffer()\n * @param yyscanner The scanner object.\n */\n    void yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif ( ! b )\n\t\treturn;\n\n\tif ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */\n\t\tYY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;\n\n\tif ( b->yy_is_our_buffer )\n\t\tyyfree( (void *) b->yy_ch_buf , yyscanner );\n\n\tyyfree( (void *) b , yyscanner );\n}\n\n/* Initializes or reinitializes a buffer.\n * This function is sometimes called more than once on the same buffer,\n * such as during a yyrestart() or at EOF.\n */\n    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)\n\n{\n\tint oerrno = errno;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tyy_flush_buffer( b , yyscanner);\n\n\tb->yy_input_file = file;\n\tb->yy_fill_buffer = 1;\n\n    /* If b is the current buffer, then yy_init_buffer was _probably_\n     * called from yyrestart() or through yy_get_next_buffer.\n     * In that case, we don't want to reset the lineno or column.\n     */\n    if (b != YY_CURRENT_BUFFER){\n        b->yy_bs_lineno = 1;\n        b->yy_bs_column = 0;\n    }\n\n        b->yy_is_interactive = 0;\n    \n\terrno = oerrno;\n}\n\n/** Discard all buffered characters. On the next scan, YY_INPUT will be called.\n * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.\n * @param yyscanner The scanner object.\n */\n    void yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tif ( ! b )\n\t\treturn;\n\n\tb->yy_n_chars = 0;\n\n\t/* We always need two end-of-buffer characters.  The first causes\n\t * a transition to the end-of-buffer state.  The second causes\n\t * a jam in that state.\n\t */\n\tb->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;\n\tb->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;\n\n\tb->yy_buf_pos = &b->yy_ch_buf[0];\n\n\tb->yy_at_bol = 1;\n\tb->yy_buffer_status = YY_BUFFER_NEW;\n\n\tif ( b == YY_CURRENT_BUFFER )\n\t\tyy_load_buffer_state( yyscanner );\n}\n\n/** Pushes the new state onto the stack. The new state becomes\n *  the current state. This function will allocate the stack\n *  if necessary.\n *  @param new_buffer The new state.\n *  @param yyscanner The scanner object.\n */\nvoid yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tif (new_buffer == NULL)\n\t\treturn;\n\n\tyyensure_buffer_stack(yyscanner);\n\n\t/* This block is copied from yy_switch_to_buffer. */\n\tif ( YY_CURRENT_BUFFER )\n\t\t{\n\t\t/* Flush out information for old buffer. */\n\t\t*yyg->yy_c_buf_p = yyg->yy_hold_char;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;\n\t\t}\n\n\t/* Only push if top exists. Otherwise, replace top. */\n\tif (YY_CURRENT_BUFFER)\n\t\tyyg->yy_buffer_stack_top++;\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\n\t/* copied from yy_switch_to_buffer. */\n\tyy_load_buffer_state( yyscanner );\n\tyyg->yy_did_buffer_switch_on_eof = 1;\n}\n\n/** Removes and deletes the top of the stack, if present.\n *  The next element becomes the new top.\n *  @param yyscanner The scanner object.\n */\nvoid yypop_buffer_state (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\tif (!YY_CURRENT_BUFFER)\n\t\treturn;\n\n\tyy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);\n\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\tif (yyg->yy_buffer_stack_top > 0)\n\t\t--yyg->yy_buffer_stack_top;\n\n\tif (YY_CURRENT_BUFFER) {\n\t\tyy_load_buffer_state( yyscanner );\n\t\tyyg->yy_did_buffer_switch_on_eof = 1;\n\t}\n}\n\n/* Allocates the stack if it does not exist.\n *  Guarantees space for at least one push.\n */\nstatic void yyensure_buffer_stack (yyscan_t yyscanner)\n{\n\tyy_size_t num_to_alloc;\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n\tif (!yyg->yy_buffer_stack) {\n\n\t\t/* First allocation is just for 2 elements, since we don't know if this\n\t\t * scanner will even need a stack. We use 2 instead of 1 to avoid an\n\t\t * immediate realloc on the next call.\n         */\n      num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */\n\t\tyyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc\n\t\t\t\t\t\t\t\t(num_to_alloc * sizeof(struct yy_buffer_state*)\n\t\t\t\t\t\t\t\t, yyscanner);\n\t\tif ( ! yyg->yy_buffer_stack )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in yyensure_buffer_stack()\" );\n\n\t\tmemset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));\n\n\t\tyyg->yy_buffer_stack_max = num_to_alloc;\n\t\tyyg->yy_buffer_stack_top = 0;\n\t\treturn;\n\t}\n\n\tif (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){\n\n\t\t/* Increase the buffer to prepare for a possible push. */\n\t\tyy_size_t grow_size = 8 /* arbitrary grow size */;\n\n\t\tnum_to_alloc = yyg->yy_buffer_stack_max + grow_size;\n\t\tyyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc\n\t\t\t\t\t\t\t\t(yyg->yy_buffer_stack,\n\t\t\t\t\t\t\t\tnum_to_alloc * sizeof(struct yy_buffer_state*)\n\t\t\t\t\t\t\t\t, yyscanner);\n\t\tif ( ! yyg->yy_buffer_stack )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in yyensure_buffer_stack()\" );\n\n\t\t/* zero only the new slots.*/\n\t\tmemset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));\n\t\tyyg->yy_buffer_stack_max = num_to_alloc;\n\t}\n}\n\n/** Setup the input buffer state to scan directly from a user-specified character buffer.\n * @param base the character buffer\n * @param size the size in bytes of the character buffer\n * @param yyscanner The scanner object.\n * @return the newly allocated buffer state object.\n */\nYY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)\n{\n\tYY_BUFFER_STATE b;\n    \n\tif ( size < 2 ||\n\t     base[size-2] != YY_END_OF_BUFFER_CHAR ||\n\t     base[size-1] != YY_END_OF_BUFFER_CHAR )\n\t\t/* They forgot to leave room for the EOB's. */\n\t\treturn NULL;\n\n\tb = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_scan_buffer()\" );\n\n\tb->yy_buf_size = (int) (size - 2);\t/* \"- 2\" to take care of EOB's */\n\tb->yy_buf_pos = b->yy_ch_buf = base;\n\tb->yy_is_our_buffer = 0;\n\tb->yy_input_file = NULL;\n\tb->yy_n_chars = b->yy_buf_size;\n\tb->yy_is_interactive = 0;\n\tb->yy_at_bol = 1;\n\tb->yy_fill_buffer = 0;\n\tb->yy_buffer_status = YY_BUFFER_NEW;\n\n\tyy_switch_to_buffer( b , yyscanner );\n\n\treturn b;\n}\n\n/** Setup the input buffer state to scan a string. The next call to yylex() will\n * scan from a @e copy of @a str.\n * @param yystr a NUL-terminated string to scan\n * @param yyscanner The scanner object.\n * @return the newly allocated buffer state object.\n * @note If you want to scan bytes that may contain NUL values, then use\n *       yy_scan_bytes() instead.\n */\nYY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)\n{\n    \n\treturn yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);\n}\n\n/** Setup the input buffer state to scan the given bytes. The next call to yylex() will\n * scan from a @e copy of @a bytes.\n * @param yybytes the byte buffer to scan\n * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.\n * @param yyscanner The scanner object.\n * @return the newly allocated buffer state object.\n */\nYY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len , yyscan_t yyscanner)\n{\n\tYY_BUFFER_STATE b;\n\tchar *buf;\n\tyy_size_t n;\n\tint i;\n    \n\t/* Get memory for full buffer, including space for trailing EOB's. */\n\tn = (yy_size_t) (_yybytes_len + 2);\n\tbuf = (char *) yyalloc( n , yyscanner );\n\tif ( ! buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in yy_scan_bytes()\" );\n\n\tfor ( i = 0; i < _yybytes_len; ++i )\n\t\tbuf[i] = yybytes[i];\n\n\tbuf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;\n\n\tb = yy_scan_buffer( buf, n , yyscanner);\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"bad buffer in yy_scan_bytes()\" );\n\n\t/* It's okay to grow etc. this buffer, and we should throw it\n\t * away when we're done.\n\t */\n\tb->yy_is_our_buffer = 1;\n\n\treturn b;\n}\n\n#ifndef YY_EXIT_FAILURE\n#define YY_EXIT_FAILURE 2\n#endif\n\nstatic void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\tfprintf( stderr, \"%s\\n\", msg );\n\texit( YY_EXIT_FAILURE );\n}\n\n/* Redefine yyless() so it works in section 3 code. */\n\n#undef yyless\n#define yyless(n) \\\n\tdo \\\n\t\t{ \\\n\t\t/* Undo effects of setting up yytext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\tyytext[yyleng] = yyg->yy_hold_char; \\\n\t\tyyg->yy_c_buf_p = yytext + yyless_macro_arg; \\\n\t\tyyg->yy_hold_char = *yyg->yy_c_buf_p; \\\n\t\t*yyg->yy_c_buf_p = '\\0'; \\\n\t\tyyleng = yyless_macro_arg; \\\n\t\t} \\\n\twhile ( 0 )\n\n/* Accessor  methods (get/set functions) to struct members. */\n\n/** Get the user-defined data for this scanner.\n * @param yyscanner The scanner object.\n */\nYY_EXTRA_TYPE yyget_extra  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyextra;\n}\n\n/** Get the current line number.\n * @param yyscanner The scanner object.\n */\nint yyget_lineno  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        if (! YY_CURRENT_BUFFER)\n            return 0;\n    \n    return yylineno;\n}\n\n/** Get the current column number.\n * @param yyscanner The scanner object.\n */\nint yyget_column  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        if (! YY_CURRENT_BUFFER)\n            return 0;\n    \n    return yycolumn;\n}\n\n/** Get the input stream.\n * @param yyscanner The scanner object.\n */\nFILE *yyget_in  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyin;\n}\n\n/** Get the output stream.\n * @param yyscanner The scanner object.\n */\nFILE *yyget_out  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyout;\n}\n\n/** Get the length of the current token.\n * @param yyscanner The scanner object.\n */\nint yyget_leng  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yyleng;\n}\n\n/** Get the current token.\n * @param yyscanner The scanner object.\n */\n\nchar *yyget_text  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yytext;\n}\n\n/** Set the user-defined data. This data is never touched by the scanner.\n * @param user_defined The data to be associated with this scanner.\n * @param yyscanner The scanner object.\n */\nvoid yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yyextra = user_defined ;\n}\n\n/** Set the current line number.\n * @param _line_number line number\n * @param yyscanner The scanner object.\n */\nvoid yyset_lineno (int  _line_number , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        /* lineno is only valid if an input buffer exists. */\n        if (! YY_CURRENT_BUFFER )\n           YY_FATAL_ERROR( \"yyset_lineno called with no buffer\" );\n    \n    yylineno = _line_number;\n}\n\n/** Set the current column.\n * @param _column_no column number\n * @param yyscanner The scanner object.\n */\nvoid yyset_column (int  _column_no , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n        /* column is only valid if an input buffer exists. */\n        if (! YY_CURRENT_BUFFER )\n           YY_FATAL_ERROR( \"yyset_column called with no buffer\" );\n    \n    yycolumn = _column_no;\n}\n\n/** Set the input stream. This does not discard the current\n * input buffer.\n * @param _in_str A readable stream.\n * @param yyscanner The scanner object.\n * @see yy_switch_to_buffer\n */\nvoid yyset_in (FILE *  _in_str , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yyin = _in_str ;\n}\n\nvoid yyset_out (FILE *  _out_str , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yyout = _out_str ;\n}\n\nint yyget_debug  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    return yy_flex_debug;\n}\n\nvoid yyset_debug (int  _bdebug , yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    yy_flex_debug = _bdebug ;\n}\n\n/* Accessor methods for yylval and yylloc */\n\n/* User-visible API */\n\n/* yylex_init is special because it creates the scanner itself, so it is\n * the ONLY reentrant function that doesn't take the scanner as the last argument.\n * That's why we explicitly handle the declaration, instead of using our macros.\n */\nint yylex_init(yyscan_t* ptr_yy_globals)\n{\n    if (ptr_yy_globals == NULL){\n        errno = EINVAL;\n        return 1;\n    }\n\n    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );\n\n    if (*ptr_yy_globals == NULL){\n        errno = ENOMEM;\n        return 1;\n    }\n\n    /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */\n    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));\n\n    return yy_init_globals ( *ptr_yy_globals );\n}\n\n/* yylex_init_extra has the same functionality as yylex_init, but follows the\n * convention of taking the scanner as the last argument. Note however, that\n * this is a *pointer* to a scanner, as it will be allocated by this call (and\n * is the reason, too, why this function also must handle its own declaration).\n * The user defined value in the first argument will be available to yyalloc in\n * the yyextra field.\n */\nint yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )\n{\n    struct yyguts_t dummy_yyguts;\n\n    yyset_extra (yy_user_defined, &dummy_yyguts);\n\n    if (ptr_yy_globals == NULL){\n        errno = EINVAL;\n        return 1;\n    }\n\n    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );\n\n    if (*ptr_yy_globals == NULL){\n        errno = ENOMEM;\n        return 1;\n    }\n\n    /* By setting to 0xAA, we expose bugs in\n    yy_init_globals. Leave at 0x00 for releases. */\n    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));\n\n    yyset_extra (yy_user_defined, *ptr_yy_globals);\n\n    return yy_init_globals ( *ptr_yy_globals );\n}\n\nstatic int yy_init_globals (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n    /* Initialization is the same as for the non-reentrant scanner.\n     * This function is called from yylex_destroy(), so don't allocate here.\n     */\n\n    yyg->yy_buffer_stack = NULL;\n    yyg->yy_buffer_stack_top = 0;\n    yyg->yy_buffer_stack_max = 0;\n    yyg->yy_c_buf_p = NULL;\n    yyg->yy_init = 0;\n    yyg->yy_start = 0;\n\n    yyg->yy_start_stack_ptr = 0;\n    yyg->yy_start_stack_depth = 0;\n    yyg->yy_start_stack =  NULL;\n\n/* Defined in main.c */\n#ifdef YY_STDINIT\n    yyin = stdin;\n    yyout = stdout;\n#else\n    yyin = NULL;\n    yyout = NULL;\n#endif\n\n    /* For future reference: Set errno on error, since we are called by\n     * yylex_init()\n     */\n    return 0;\n}\n\n/* yylex_destroy is for both reentrant and non-reentrant scanners. */\nint yylex_destroy  (yyscan_t yyscanner)\n{\n    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\n    /* Pop the buffer stack, destroying each element. */\n\twhile(YY_CURRENT_BUFFER){\n\t\tyy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );\n\t\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\t\tyypop_buffer_state(yyscanner);\n\t}\n\n\t/* Destroy the stack itself. */\n\tyyfree(yyg->yy_buffer_stack , yyscanner);\n\tyyg->yy_buffer_stack = NULL;\n\n    /* Destroy the start condition stack. */\n        yyfree( yyg->yy_start_stack , yyscanner );\n        yyg->yy_start_stack = NULL;\n\n    /* Reset the globals. This is important in a non-reentrant scanner so the next time\n     * yylex() is called, initialization will occur. */\n    yy_init_globals( yyscanner);\n\n    /* Destroy the main struct (reentrant only). */\n    yyfree ( yyscanner , yyscanner );\n    yyscanner = NULL;\n    return 0;\n}\n\n/*\n * Internal utility routines.\n */\n\n#ifndef yytext_ptr\nstatic void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\n\tint i;\n\tfor ( i = 0; i < n; ++i )\n\t\ts1[i] = s2[i];\n}\n#endif\n\n#ifdef YY_NEED_STRLEN\nstatic int yy_flex_strlen (const char * s , yyscan_t yyscanner)\n{\n\tint n;\n\tfor ( n = 0; s[n]; ++n )\n\t\t;\n\n\treturn n;\n}\n#endif\n\nvoid *yyalloc (yy_size_t  size , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\treturn malloc(size);\n}\n\nvoid *yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\n\t/* The cast to (char *) in the following accommodates both\n\t * implementations that use char* generic pointers, and those\n\t * that use void* generic pointers.  It works with the latter\n\t * because both ANSI C and C++ allow castless assignment from\n\t * any pointer type to void*, and deal with argument conversions\n\t * as though doing an assignment.\n\t */\n\treturn realloc(ptr, size);\n}\n\nvoid yyfree (void * ptr , yyscan_t yyscanner)\n{\n\tstruct yyguts_t * yyg = (struct yyguts_t*)yyscanner;\n\t(void)yyg;\n\tfree( (char *) ptr );\t/* see yyrealloc() for (char *) cast */\n}\n\n#define YYTABLES_NAME \"yytables\"\n\n#line 1005 \"wcsulex.l\"\n\n\n/*----------------------------------------------------------------------------\n* External interface to the scanner.\n*---------------------------------------------------------------------------*/\n\nint wcsulexe(\n  const char unitstr[],\n  int *func,\n  double *scale,\n  double units[WCSUNITS_NTYPE],\n  struct wcserr **err)\n\n{\n  // Function prototypes.\n  int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner);\n  int yylex_destroy(yyscan_t yyscanner);\n\n  struct wcsulex_extra extra;\n  yyscan_t yyscanner;\n  yylex_init_extra(&extra, &yyscanner);\n  int status = wcsulexe_scanner(unitstr, func, scale, units, err, yyscanner);\n  yylex_destroy(yyscanner);\n\n  return status;\n}\n\n\n/*----------------------------------------------------------------------------\n* Accumulate a term in a units specification and reset work variables.\n*---------------------------------------------------------------------------*/\n\nvoid add(\n  double *factor,\n  double types[],\n  double *expon,\n  double *scale,\n  double units[])\n\n{\n  *scale *= pow(*factor, *expon);\n\n  for (int i = 0; i < WCSUNITS_NTYPE; i++) {\n    units[i] += *expon * types[i];\n    types[i] = 0.0;\n  }\n\n  *expon  = 1.0;\n  *factor = 1.0;\n\n  return;\n}\n\n"},{"col":4,"comment":"null","endLoc":45,"header":"def draw(self, renderer, *args, **kwargs)","id":16624,"name":"draw","nodeType":"Function","startLoc":44,"text":"def draw(self, renderer, *args, **kwargs):\n        self.axes.draw_wcsaxes(renderer)"},{"id":16625,"name":"cextern/cfitsio","nodeType":"Package"},{"id":16626,"name":"README.txt","nodeType":"TextFile","path":"cextern/cfitsio","text":"Note: astropy only requires the CFITSIO library, and hence in this bundled version,\nwe removed all other files except the required license (License.txt) and changelog\n(docs/changes.txt, which has the version number).\n"},{"id":16627,"name":"install-sh","nodeType":"TextFile","path":"cextern/wcslib/config","text":"#!/bin/sh\n# install - install a program, script, or datafile\n\nscriptversion=2011-11-20.07; # UTC\n\n# This originates from X11R5 (mit/util/scripts/install.sh), which was\n# later released in X11R6 (xc/config/util/install.sh) with the\n# following copyright and license.\n#\n# Copyright (C) 1994 X Consortium\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to\n# deal in the Software without restriction, including without limitation the\n# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n# sell copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\n# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\n# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-\n# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n#\n# Except as contained in this notice, the name of the X Consortium shall not\n# be used in advertising or otherwise to promote the sale, use or other deal-\n# ings in this Software without prior written authorization from the X Consor-\n# tium.\n#\n#\n# FSF changes to this file are in the public domain.\n#\n# Calling this script install-sh is preferred over install.sh, to prevent\n# 'make' implicit rules from creating a file called install from it\n# when there is no Makefile.\n#\n# This script is compatible with the BSD install script, but was written\n# from scratch.\n\nnl='\n'\nIFS=\" \"\"\t$nl\"\n\n# set DOITPROG to echo to test this script\n\n# Don't use :- since 4.3BSD and earlier shells don't like it.\ndoit=${DOITPROG-}\nif test -z \"$doit\"; then\n  doit_exec=exec\nelse\n  doit_exec=$doit\nfi\n\n# Put in absolute file names if you don't have them in your path;\n# or use environment vars.\n\nchgrpprog=${CHGRPPROG-chgrp}\nchmodprog=${CHMODPROG-chmod}\nchownprog=${CHOWNPROG-chown}\ncmpprog=${CMPPROG-cmp}\ncpprog=${CPPROG-cp}\nmkdirprog=${MKDIRPROG-mkdir}\nmvprog=${MVPROG-mv}\nrmprog=${RMPROG-rm}\nstripprog=${STRIPPROG-strip}\n\nposix_glob='?'\ninitialize_posix_glob='\n  test \"$posix_glob\" != \"?\" || {\n    if (set -f) 2>/dev/null; then\n      posix_glob=\n    else\n      posix_glob=:\n    fi\n  }\n'\n\nposix_mkdir=\n\n# Desired mode of installed file.\nmode=0755\n\nchgrpcmd=\nchmodcmd=$chmodprog\nchowncmd=\nmvcmd=$mvprog\nrmcmd=\"$rmprog -f\"\nstripcmd=\n\nsrc=\ndst=\ndir_arg=\ndst_arg=\n\ncopy_on_change=false\nno_target_directory=\n\nusage=\"\\\nUsage: $0 [OPTION]... [-T] SRCFILE DSTFILE\n   or: $0 [OPTION]... SRCFILES... DIRECTORY\n   or: $0 [OPTION]... -t DIRECTORY SRCFILES...\n   or: $0 [OPTION]... -d DIRECTORIES...\n\nIn the 1st form, copy SRCFILE to DSTFILE.\nIn the 2nd and 3rd, copy all SRCFILES to DIRECTORY.\nIn the 4th, create DIRECTORIES.\n\nOptions:\n     --help     display this help and exit.\n     --version  display version info and exit.\n\n  -c            (ignored)\n  -C            install only if different (preserve the last data modification time)\n  -d            create directories instead of installing files.\n  -g GROUP      $chgrpprog installed files to GROUP.\n  -m MODE       $chmodprog installed files to MODE.\n  -o USER       $chownprog installed files to USER.\n  -s            $stripprog installed files.\n  -t DIRECTORY  install into DIRECTORY.\n  -T            report an error if DSTFILE is a directory.\n\nEnvironment variables override the default commands:\n  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG\n  RMPROG STRIPPROG\n\"\n\nwhile test $# -ne 0; do\n  case $1 in\n    -c) ;;\n\n    -C) copy_on_change=true;;\n\n    -d) dir_arg=true;;\n\n    -g) chgrpcmd=\"$chgrpprog $2\"\n\tshift;;\n\n    --help) echo \"$usage\"; exit $?;;\n\n    -m) mode=$2\n\tcase $mode in\n\t  *' '* | *'\t'* | *'\n'*\t  | *'*'* | *'?'* | *'['*)\n\t    echo \"$0: invalid mode: $mode\" >&2\n\t    exit 1;;\n\tesac\n\tshift;;\n\n    -o) chowncmd=\"$chownprog $2\"\n\tshift;;\n\n    -s) stripcmd=$stripprog;;\n\n    -t) dst_arg=$2\n\t# Protect names problematic for 'test' and other utilities.\n\tcase $dst_arg in\n\t  -* | [=\\(\\)!]) dst_arg=./$dst_arg;;\n\tesac\n\tshift;;\n\n    -T) no_target_directory=true;;\n\n    --version) echo \"$0 $scriptversion\"; exit $?;;\n\n    --)\tshift\n\tbreak;;\n\n    -*)\techo \"$0: invalid option: $1\" >&2\n\texit 1;;\n\n    *)  break;;\n  esac\n  shift\ndone\n\nif test $# -ne 0 && test -z \"$dir_arg$dst_arg\"; then\n  # When -d is used, all remaining arguments are directories to create.\n  # When -t is used, the destination is already specified.\n  # Otherwise, the last argument is the destination.  Remove it from $@.\n  for arg\n  do\n    if test -n \"$dst_arg\"; then\n      # $@ is not empty: it contains at least $arg.\n      set fnord \"$@\" \"$dst_arg\"\n      shift # fnord\n    fi\n    shift # arg\n    dst_arg=$arg\n    # Protect names problematic for 'test' and other utilities.\n    case $dst_arg in\n      -* | [=\\(\\)!]) dst_arg=./$dst_arg;;\n    esac\n  done\nfi\n\nif test $# -eq 0; then\n  if test -z \"$dir_arg\"; then\n    echo \"$0: no input file specified.\" >&2\n    exit 1\n  fi\n  # It's OK to call 'install-sh -d' without argument.\n  # This can happen when creating conditional directories.\n  exit 0\nfi\n\nif test -z \"$dir_arg\"; then\n  do_exit='(exit $ret); exit $ret'\n  trap \"ret=129; $do_exit\" 1\n  trap \"ret=130; $do_exit\" 2\n  trap \"ret=141; $do_exit\" 13\n  trap \"ret=143; $do_exit\" 15\n\n  # Set umask so as not to create temps with too-generous modes.\n  # However, 'strip' requires both read and write access to temps.\n  case $mode in\n    # Optimize common cases.\n    *644) cp_umask=133;;\n    *755) cp_umask=22;;\n\n    *[0-7])\n      if test -z \"$stripcmd\"; then\n\tu_plus_rw=\n      else\n\tu_plus_rw='% 200'\n      fi\n      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;\n    *)\n      if test -z \"$stripcmd\"; then\n\tu_plus_rw=\n      else\n\tu_plus_rw=,u+rw\n      fi\n      cp_umask=$mode$u_plus_rw;;\n  esac\nfi\n\nfor src\ndo\n  # Protect names problematic for 'test' and other utilities.\n  case $src in\n    -* | [=\\(\\)!]) src=./$src;;\n  esac\n\n  if test -n \"$dir_arg\"; then\n    dst=$src\n    dstdir=$dst\n    test -d \"$dstdir\"\n    dstdir_status=$?\n  else\n\n    # Waiting for this to be detected by the \"$cpprog $src $dsttmp\" command\n    # might cause directories to be created, which would be especially bad\n    # if $src (and thus $dsttmp) contains '*'.\n    if test ! -f \"$src\" && test ! -d \"$src\"; then\n      echo \"$0: $src does not exist.\" >&2\n      exit 1\n    fi\n\n    if test -z \"$dst_arg\"; then\n      echo \"$0: no destination specified.\" >&2\n      exit 1\n    fi\n    dst=$dst_arg\n\n    # If destination is a directory, append the input filename; won't work\n    # if double slashes aren't ignored.\n    if test -d \"$dst\"; then\n      if test -n \"$no_target_directory\"; then\n\techo \"$0: $dst_arg: Is a directory\" >&2\n\texit 1\n      fi\n      dstdir=$dst\n      dst=$dstdir/`basename \"$src\"`\n      dstdir_status=0\n    else\n      # Prefer dirname, but fall back on a substitute if dirname fails.\n      dstdir=`\n\t(dirname \"$dst\") 2>/dev/null ||\n\texpr X\"$dst\" : 'X\\(.*[^/]\\)//*[^/][^/]*/*$' \\| \\\n\t     X\"$dst\" : 'X\\(//\\)[^/]' \\| \\\n\t     X\"$dst\" : 'X\\(//\\)$' \\| \\\n\t     X\"$dst\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n\techo X\"$dst\" |\n\t    sed '/^X\\(.*[^/]\\)\\/\\/*[^/][^/]*\\/*$/{\n\t\t   s//\\1/\n\t\t   q\n\t\t }\n\t\t /^X\\(\\/\\/\\)[^/].*/{\n\t\t   s//\\1/\n\t\t   q\n\t\t }\n\t\t /^X\\(\\/\\/\\)$/{\n\t\t   s//\\1/\n\t\t   q\n\t\t }\n\t\t /^X\\(\\/\\).*/{\n\t\t   s//\\1/\n\t\t   q\n\t\t }\n\t\t s/.*/./; q'\n      `\n\n      test -d \"$dstdir\"\n      dstdir_status=$?\n    fi\n  fi\n\n  obsolete_mkdir_used=false\n\n  if test $dstdir_status != 0; then\n    case $posix_mkdir in\n      '')\n\t# Create intermediate dirs using mode 755 as modified by the umask.\n\t# This is like FreeBSD 'install' as of 1997-10-28.\n\tumask=`umask`\n\tcase $stripcmd.$umask in\n\t  # Optimize common cases.\n\t  *[2367][2367]) mkdir_umask=$umask;;\n\t  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;\n\n\t  *[0-7])\n\t    mkdir_umask=`expr $umask + 22 \\\n\t      - $umask % 100 % 40 + $umask % 20 \\\n\t      - $umask % 10 % 4 + $umask % 2\n\t    `;;\n\t  *) mkdir_umask=$umask,go-w;;\n\tesac\n\n\t# With -d, create the new directory with the user-specified mode.\n\t# Otherwise, rely on $mkdir_umask.\n\tif test -n \"$dir_arg\"; then\n\t  mkdir_mode=-m$mode\n\telse\n\t  mkdir_mode=\n\tfi\n\n\tposix_mkdir=false\n\tcase $umask in\n\t  *[123567][0-7][0-7])\n\t    # POSIX mkdir -p sets u+wx bits regardless of umask, which\n\t    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.\n\t    ;;\n\t  *)\n\t    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$\n\t    trap 'ret=$?; rmdir \"$tmpdir/d\" \"$tmpdir\" 2>/dev/null; exit $ret' 0\n\n\t    if (umask $mkdir_umask &&\n\t\texec $mkdirprog $mkdir_mode -p -- \"$tmpdir/d\") >/dev/null 2>&1\n\t    then\n\t      if test -z \"$dir_arg\" || {\n\t\t   # Check for POSIX incompatibilities with -m.\n\t\t   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or\n\t\t   # other-writable bit of parent directory when it shouldn't.\n\t\t   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.\n\t\t   ls_ld_tmpdir=`ls -ld \"$tmpdir\"`\n\t\t   case $ls_ld_tmpdir in\n\t\t     d????-?r-*) different_mode=700;;\n\t\t     d????-?--*) different_mode=755;;\n\t\t     *) false;;\n\t\t   esac &&\n\t\t   $mkdirprog -m$different_mode -p -- \"$tmpdir\" && {\n\t\t     ls_ld_tmpdir_1=`ls -ld \"$tmpdir\"`\n\t\t     test \"$ls_ld_tmpdir\" = \"$ls_ld_tmpdir_1\"\n\t\t   }\n\t\t }\n\t      then posix_mkdir=:\n\t      fi\n\t      rmdir \"$tmpdir/d\" \"$tmpdir\"\n\t    else\n\t      # Remove any dirs left behind by ancient mkdir implementations.\n\t      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null\n\t    fi\n\t    trap '' 0;;\n\tesac;;\n    esac\n\n    if\n      $posix_mkdir && (\n\tumask $mkdir_umask &&\n\t$doit_exec $mkdirprog $mkdir_mode -p -- \"$dstdir\"\n      )\n    then :\n    else\n\n      # The umask is ridiculous, or mkdir does not conform to POSIX,\n      # or it failed possibly due to a race condition.  Create the\n      # directory the slow way, step by step, checking for races as we go.\n\n      case $dstdir in\n\t/*) prefix='/';;\n\t[-=\\(\\)!]*) prefix='./';;\n\t*)  prefix='';;\n      esac\n\n      eval \"$initialize_posix_glob\"\n\n      oIFS=$IFS\n      IFS=/\n      $posix_glob set -f\n      set fnord $dstdir\n      shift\n      $posix_glob set +f\n      IFS=$oIFS\n\n      prefixes=\n\n      for d\n      do\n\ttest X\"$d\" = X && continue\n\n\tprefix=$prefix$d\n\tif test -d \"$prefix\"; then\n\t  prefixes=\n\telse\n\t  if $posix_mkdir; then\n\t    (umask=$mkdir_umask &&\n\t     $doit_exec $mkdirprog $mkdir_mode -p -- \"$dstdir\") && break\n\t    # Don't fail if two instances are running concurrently.\n\t    test -d \"$prefix\" || exit 1\n\t  else\n\t    case $prefix in\n\t      *\\'*) qprefix=`echo \"$prefix\" | sed \"s/'/'\\\\\\\\\\\\\\\\''/g\"`;;\n\t      *) qprefix=$prefix;;\n\t    esac\n\t    prefixes=\"$prefixes '$qprefix'\"\n\t  fi\n\tfi\n\tprefix=$prefix/\n      done\n\n      if test -n \"$prefixes\"; then\n\t# Don't fail if two instances are running concurrently.\n\t(umask $mkdir_umask &&\n\t eval \"\\$doit_exec \\$mkdirprog $prefixes\") ||\n\t  test -d \"$dstdir\" || exit 1\n\tobsolete_mkdir_used=true\n      fi\n    fi\n  fi\n\n  if test -n \"$dir_arg\"; then\n    { test -z \"$chowncmd\" || $doit $chowncmd \"$dst\"; } &&\n    { test -z \"$chgrpcmd\" || $doit $chgrpcmd \"$dst\"; } &&\n    { test \"$obsolete_mkdir_used$chowncmd$chgrpcmd\" = false ||\n      test -z \"$chmodcmd\" || $doit $chmodcmd $mode \"$dst\"; } || exit 1\n  else\n\n    # Make a couple of temp file names in the proper directory.\n    dsttmp=$dstdir/_inst.$$_\n    rmtmp=$dstdir/_rm.$$_\n\n    # Trap to clean up those temp files at exit.\n    trap 'ret=$?; rm -f \"$dsttmp\" \"$rmtmp\" && exit $ret' 0\n\n    # Copy the file name to the temp name.\n    (umask $cp_umask && $doit_exec $cpprog \"$src\" \"$dsttmp\") &&\n\n    # and set any options; do chmod last to preserve setuid bits.\n    #\n    # If any of these fail, we abort the whole thing.  If we want to\n    # ignore errors from any of these, just make sure not to ignore\n    # errors from the above \"$doit $cpprog $src $dsttmp\" command.\n    #\n    { test -z \"$chowncmd\" || $doit $chowncmd \"$dsttmp\"; } &&\n    { test -z \"$chgrpcmd\" || $doit $chgrpcmd \"$dsttmp\"; } &&\n    { test -z \"$stripcmd\" || $doit $stripcmd \"$dsttmp\"; } &&\n    { test -z \"$chmodcmd\" || $doit $chmodcmd $mode \"$dsttmp\"; } &&\n\n    # If -C, don't bother to copy if it wouldn't change the file.\n    if $copy_on_change &&\n       old=`LC_ALL=C ls -dlL \"$dst\"\t2>/dev/null` &&\n       new=`LC_ALL=C ls -dlL \"$dsttmp\"\t2>/dev/null` &&\n\n       eval \"$initialize_posix_glob\" &&\n       $posix_glob set -f &&\n       set X $old && old=:$2:$4:$5:$6 &&\n       set X $new && new=:$2:$4:$5:$6 &&\n       $posix_glob set +f &&\n\n       test \"$old\" = \"$new\" &&\n       $cmpprog \"$dst\" \"$dsttmp\" >/dev/null 2>&1\n    then\n      rm -f \"$dsttmp\"\n    else\n      # Rename the file to the real destination.\n      $doit $mvcmd -f \"$dsttmp\" \"$dst\" 2>/dev/null ||\n\n      # The rename failed, perhaps because mv can't rename something else\n      # to itself, or perhaps because mv is so ancient that it does not\n      # support -f.\n      {\n\t# Now remove or move aside any old file at destination location.\n\t# We try this two ways since rm can't unlink itself on some\n\t# systems and the destination file might be busy for other\n\t# reasons.  In this case, the final cleanup might fail but the new\n\t# file should still install successfully.\n\t{\n\t  test ! -f \"$dst\" ||\n\t  $doit $rmcmd -f \"$dst\" 2>/dev/null ||\n\t  { $doit $mvcmd -f \"$dst\" \"$rmtmp\" 2>/dev/null &&\n\t    { $doit $rmcmd -f \"$rmtmp\" 2>/dev/null; :; }\n\t  } ||\n\t  { echo \"$0: cannot unlink or rename $dst\" >&2\n\t    (exit 1); exit 1\n\t  }\n\t} &&\n\n\t# Now rename the file to the real destination.\n\t$doit $mvcmd \"$dsttmp\" \"$dst\"\n      }\n    fi || exit 1\n\n    trap '' 0\n  fi\ndone\n\n# Local variables:\n# eval: (add-hook 'write-file-hooks 'time-stamp)\n# time-stamp-start: \"scriptversion=\"\n# time-stamp-format: \"%:y-%02m-%02d.%02H\"\n# time-stamp-time-zone: \"UTC\"\n# time-stamp-end: \"; # UTC\"\n# End:\n"},{"id":16628,"name":"License.txt","nodeType":"TextFile","path":"cextern/cfitsio","text":"Copyright (Unpublished--all rights reserved under the copyright laws of\nthe United States), U.S. Government as represented by the Administrator\nof the National Aeronautics and Space Administration.  No copyright is\nclaimed in the United States under Title 17, U.S. Code.\n\nPermission to freely use, copy, modify, and distribute this software\nand its documentation without fee is hereby granted, provided that this\ncopyright notice and disclaimer of warranty appears in all copies.\n\nDISCLAIMER:\n\nTHE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND,\nEITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO,\nANY WARRANTY THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY\nIMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR\nPURPOSE, AND FREEDOM FROM INFRINGEMENT, AND ANY WARRANTY THAT THE\nDOCUMENTATION WILL CONFORM TO THE SOFTWARE, OR ANY WARRANTY THAT THE\nSOFTWARE WILL BE ERROR FREE.  IN NO EVENT SHALL NASA BE LIABLE FOR ANY\nDAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL OR\nCONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR IN ANY WAY\nCONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY,\nCONTRACT, TORT , OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY\nPERSONS OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED\nFROM, OR AROSE OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR\nSERVICES PROVIDED HEREUNDER.\n"},{"id":16629,"name":"config.guess","nodeType":"TextFile","path":"cextern/wcslib/config","text":"#! /bin/sh\n# Attempt to guess a canonical system name.\n#   Copyright 1992-2018 Free Software Foundation, Inc.\n\ntimestamp='2018-07-18'\n\n# This file is free software; you can redistribute it and/or modify it\n# under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n# General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, see <https://www.gnu.org/licenses/>.\n#\n# As a special exception to the GNU General Public License, if you\n# distribute this file as part of a program that contains a\n# configuration script generated by Autoconf, you may include it under\n# the same distribution terms that you use for the rest of that\n# program.  This Exception is an additional permission under section 7\n# of the GNU General Public License, version 3 (\"GPLv3\").\n#\n# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.\n#\n# You can get the latest version of this script from:\n# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess\n#\n# Please send patches to <config-patches@gnu.org>.\n\n\nme=`echo \"$0\" | sed -e 's,.*/,,'`\n\nusage=\"\\\nUsage: $0 [OPTION]\n\nOutput the configuration name of the system \\`$me' is run on.\n\nOptions:\n  -h, --help         print this help, then exit\n  -t, --time-stamp   print date of last modification, then exit\n  -v, --version      print version number, then exit\n\nReport bugs and patches to <config-patches@gnu.org>.\"\n\nversion=\"\\\nGNU config.guess ($timestamp)\n\nOriginally written by Per Bothner.\nCopyright 1992-2018 Free Software Foundation, Inc.\n\nThis is free software; see the source for copying conditions.  There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\"\n\nhelp=\"\nTry \\`$me --help' for more information.\"\n\n# Parse command line\nwhile test $# -gt 0 ; do\n  case $1 in\n    --time-stamp | --time* | -t )\n       echo \"$timestamp\" ; exit ;;\n    --version | -v )\n       echo \"$version\" ; exit ;;\n    --help | --h* | -h )\n       echo \"$usage\"; exit ;;\n    -- )     # Stop option processing\n       shift; break ;;\n    - )\t# Use stdin as input.\n       break ;;\n    -* )\n       echo \"$me: invalid option $1$help\" >&2\n       exit 1 ;;\n    * )\n       break ;;\n  esac\ndone\n\nif test $# != 0; then\n  echo \"$me: too many arguments$help\" >&2\n  exit 1\nfi\n\n# CC_FOR_BUILD -- compiler used by this script. Note that the use of a\n# compiler to aid in system detection is discouraged as it requires\n# temporary files to be created and, as you can see below, it is a\n# headache to deal with in a portable fashion.\n\n# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still\n# use `HOST_CC' if defined, but it is deprecated.\n\n# Portable tmp directory creation inspired by the Autoconf team.\n\ntmp=\n# shellcheck disable=SC2172\ntrap 'test -z \"$tmp\" || rm -fr \"$tmp\"' 1 2 13 15\ntrap 'exitcode=$?; test -z \"$tmp\" || rm -fr \"$tmp\"; exit $exitcode' 0\n\nset_cc_for_build() {\n    : \"${TMPDIR=/tmp}\"\n    # shellcheck disable=SC2039\n    { tmp=`(umask 077 && mktemp -d \"$TMPDIR/cgXXXXXX\") 2>/dev/null` && test -n \"$tmp\" && test -d \"$tmp\" ; } ||\n\t{ test -n \"$RANDOM\" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir \"$tmp\" 2>/dev/null) ; } ||\n\t{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir \"$tmp\" 2>/dev/null) && echo \"Warning: creating insecure temp directory\" >&2 ; } ||\n\t{ echo \"$me: cannot create a temporary directory in $TMPDIR\" >&2 ; exit 1 ; }\n    dummy=$tmp/dummy\n    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in\n\t,,)    echo \"int x;\" > \"$dummy.c\"\n\t       for driver in cc gcc c89 c99 ; do\n\t\t   if ($driver -c -o \"$dummy.o\" \"$dummy.c\") >/dev/null 2>&1 ; then\n\t\t       CC_FOR_BUILD=\"$driver\"\n\t\t       break\n\t\t   fi\n\t       done\n\t       if test x\"$CC_FOR_BUILD\" = x ; then\n\t\t   CC_FOR_BUILD=no_compiler_found\n\t       fi\n\t       ;;\n\t,,*)   CC_FOR_BUILD=$CC ;;\n\t,*,*)  CC_FOR_BUILD=$HOST_CC ;;\n    esac\n}\n\n# This is needed to find uname on a Pyramid OSx when run in the BSD universe.\n# (ghazi@noc.rutgers.edu 1994-08-24)\nif (test -f /.attbin/uname) >/dev/null 2>&1 ; then\n\tPATH=$PATH:/.attbin ; export PATH\nfi\n\nUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown\nUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown\nUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown\nUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown\n\ncase \"$UNAME_SYSTEM\" in\nLinux|GNU|GNU/*)\n\t# If the system lacks a compiler, then just pick glibc.\n\t# We could probably try harder.\n\tLIBC=gnu\n\n\tset_cc_for_build\n\tcat <<-EOF > \"$dummy.c\"\n\t#include <features.h>\n\t#if defined(__UCLIBC__)\n\tLIBC=uclibc\n\t#elif defined(__dietlibc__)\n\tLIBC=dietlibc\n\t#else\n\tLIBC=gnu\n\t#endif\n\tEOF\n\teval \"`$CC_FOR_BUILD -E \"$dummy.c\" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`\"\n\n\t# If ldd exists, use it to detect musl libc.\n\tif command -v ldd >/dev/null && \\\n\t\tldd --version 2>&1 | grep -q ^musl\n\tthen\n\t    LIBC=musl\n\tfi\n\t;;\nesac\n\n# Note: order is significant - the case branches are not exclusive.\n\ncase \"$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION\" in\n    *:NetBSD:*:*)\n\t# NetBSD (nbsd) targets should (where applicable) match one or\n\t# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,\n\t# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently\n\t# switched to ELF, *-*-netbsd* would select the old\n\t# object file format.  This provides both forward\n\t# compatibility and a consistent mechanism for selecting the\n\t# object file format.\n\t#\n\t# Note: NetBSD doesn't particularly care about the vendor\n\t# portion of the name.  We always set it to \"unknown\".\n\tsysctl=\"sysctl -n hw.machine_arch\"\n\tUNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \\\n\t    \"/sbin/$sysctl\" 2>/dev/null || \\\n\t    \"/usr/sbin/$sysctl\" 2>/dev/null || \\\n\t    echo unknown)`\n\tcase \"$UNAME_MACHINE_ARCH\" in\n\t    armeb) machine=armeb-unknown ;;\n\t    arm*) machine=arm-unknown ;;\n\t    sh3el) machine=shl-unknown ;;\n\t    sh3eb) machine=sh-unknown ;;\n\t    sh5el) machine=sh5le-unknown ;;\n\t    earmv*)\n\t\tarch=`echo \"$UNAME_MACHINE_ARCH\" | sed -e 's,^e\\(armv[0-9]\\).*$,\\1,'`\n\t\tendian=`echo \"$UNAME_MACHINE_ARCH\" | sed -ne 's,^.*\\(eb\\)$,\\1,p'`\n\t\tmachine=\"${arch}${endian}\"-unknown\n\t\t;;\n\t    *) machine=\"$UNAME_MACHINE_ARCH\"-unknown ;;\n\tesac\n\t# The Operating System including object format, if it has switched\n\t# to ELF recently (or will in the future) and ABI.\n\tcase \"$UNAME_MACHINE_ARCH\" in\n\t    earm*)\n\t\tos=netbsdelf\n\t\t;;\n\t    arm*|i386|m68k|ns32k|sh3*|sparc|vax)\n\t\tset_cc_for_build\n\t\tif echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \\\n\t\t\t| grep -q __ELF__\n\t\tthen\n\t\t    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).\n\t\t    # Return netbsd for either.  FIX?\n\t\t    os=netbsd\n\t\telse\n\t\t    os=netbsdelf\n\t\tfi\n\t\t;;\n\t    *)\n\t\tos=netbsd\n\t\t;;\n\tesac\n\t# Determine ABI tags.\n\tcase \"$UNAME_MACHINE_ARCH\" in\n\t    earm*)\n\t\texpr='s/^earmv[0-9]/-eabi/;s/eb$//'\n\t\tabi=`echo \"$UNAME_MACHINE_ARCH\" | sed -e \"$expr\"`\n\t\t;;\n\tesac\n\t# The OS release\n\t# Debian GNU/NetBSD machines have a different userland, and\n\t# thus, need a distinct triplet. However, they do not need\n\t# kernel version information, so it can be replaced with a\n\t# suitable tag, in the style of linux-gnu.\n\tcase \"$UNAME_VERSION\" in\n\t    Debian*)\n\t\trelease='-gnu'\n\t\t;;\n\t    *)\n\t\trelease=`echo \"$UNAME_RELEASE\" | sed -e 's/[-_].*//' | cut -d. -f1,2`\n\t\t;;\n\tesac\n\t# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:\n\t# contains redundant information, the shorter form:\n\t# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.\n\techo \"$machine-${os}${release}${abi-}\"\n\texit ;;\n    *:Bitrig:*:*)\n\tUNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`\n\techo \"$UNAME_MACHINE_ARCH\"-unknown-bitrig\"$UNAME_RELEASE\"\n\texit ;;\n    *:OpenBSD:*:*)\n\tUNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`\n\techo \"$UNAME_MACHINE_ARCH\"-unknown-openbsd\"$UNAME_RELEASE\"\n\texit ;;\n    *:LibertyBSD:*:*)\n\tUNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\\.//'`\n\techo \"$UNAME_MACHINE_ARCH\"-unknown-libertybsd\"$UNAME_RELEASE\"\n\texit ;;\n    *:MidnightBSD:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-midnightbsd\"$UNAME_RELEASE\"\n\texit ;;\n    *:ekkoBSD:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-ekkobsd\"$UNAME_RELEASE\"\n\texit ;;\n    *:SolidBSD:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-solidbsd\"$UNAME_RELEASE\"\n\texit ;;\n    macppc:MirBSD:*:*)\n\techo powerpc-unknown-mirbsd\"$UNAME_RELEASE\"\n\texit ;;\n    *:MirBSD:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-mirbsd\"$UNAME_RELEASE\"\n\texit ;;\n    *:Sortix:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-sortix\n\texit ;;\n    *:Redox:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-redox\n\texit ;;\n    mips:OSF1:*.*)\n        echo mips-dec-osf1\n        exit ;;\n    alpha:OSF1:*:*)\n\tcase $UNAME_RELEASE in\n\t*4.0)\n\t\tUNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`\n\t\t;;\n\t*5.*)\n\t\tUNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`\n\t\t;;\n\tesac\n\t# According to Compaq, /usr/sbin/psrinfo has been available on\n\t# OSF/1 and Tru64 systems produced since 1995.  I hope that\n\t# covers most systems running today.  This code pipes the CPU\n\t# types through head -n 1, so we only detect the type of CPU 0.\n\tALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \\(.*\\) processor.*$/\\1/p' | head -n 1`\n\tcase \"$ALPHA_CPU_TYPE\" in\n\t    \"EV4 (21064)\")\n\t\tUNAME_MACHINE=alpha ;;\n\t    \"EV4.5 (21064)\")\n\t\tUNAME_MACHINE=alpha ;;\n\t    \"LCA4 (21066/21068)\")\n\t\tUNAME_MACHINE=alpha ;;\n\t    \"EV5 (21164)\")\n\t\tUNAME_MACHINE=alphaev5 ;;\n\t    \"EV5.6 (21164A)\")\n\t\tUNAME_MACHINE=alphaev56 ;;\n\t    \"EV5.6 (21164PC)\")\n\t\tUNAME_MACHINE=alphapca56 ;;\n\t    \"EV5.7 (21164PC)\")\n\t\tUNAME_MACHINE=alphapca57 ;;\n\t    \"EV6 (21264)\")\n\t\tUNAME_MACHINE=alphaev6 ;;\n\t    \"EV6.7 (21264A)\")\n\t\tUNAME_MACHINE=alphaev67 ;;\n\t    \"EV6.8CB (21264C)\")\n\t\tUNAME_MACHINE=alphaev68 ;;\n\t    \"EV6.8AL (21264B)\")\n\t\tUNAME_MACHINE=alphaev68 ;;\n\t    \"EV6.8CX (21264D)\")\n\t\tUNAME_MACHINE=alphaev68 ;;\n\t    \"EV6.9A (21264/EV69A)\")\n\t\tUNAME_MACHINE=alphaev69 ;;\n\t    \"EV7 (21364)\")\n\t\tUNAME_MACHINE=alphaev7 ;;\n\t    \"EV7.9 (21364A)\")\n\t\tUNAME_MACHINE=alphaev79 ;;\n\tesac\n\t# A Pn.n version is a patched version.\n\t# A Vn.n version is a released version.\n\t# A Tn.n version is a released field test version.\n\t# A Xn.n version is an unreleased experimental baselevel.\n\t# 1.2 uses \"1.2\" for uname -r.\n\techo \"$UNAME_MACHINE\"-dec-osf\"`echo \"$UNAME_RELEASE\" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`\"\n\t# Reset EXIT trap before exiting to avoid spurious non-zero exit code.\n\texitcode=$?\n\ttrap '' 0\n\texit $exitcode ;;\n    Amiga*:UNIX_System_V:4.0:*)\n\techo m68k-unknown-sysv4\n\texit ;;\n    *:[Aa]miga[Oo][Ss]:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-amigaos\n\texit ;;\n    *:[Mm]orph[Oo][Ss]:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-morphos\n\texit ;;\n    *:OS/390:*:*)\n\techo i370-ibm-openedition\n\texit ;;\n    *:z/VM:*:*)\n\techo s390-ibm-zvmoe\n\texit ;;\n    *:OS400:*:*)\n\techo powerpc-ibm-os400\n\texit ;;\n    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)\n\techo arm-acorn-riscix\"$UNAME_RELEASE\"\n\texit ;;\n    arm*:riscos:*:*|arm*:RISCOS:*:*)\n\techo arm-unknown-riscos\n\texit ;;\n    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)\n\techo hppa1.1-hitachi-hiuxmpp\n\texit ;;\n    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)\n\t# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.\n\tif test \"`(/bin/universe) 2>/dev/null`\" = att ; then\n\t\techo pyramid-pyramid-sysv3\n\telse\n\t\techo pyramid-pyramid-bsd\n\tfi\n\texit ;;\n    NILE*:*:*:dcosx)\n\techo pyramid-pyramid-svr4\n\texit ;;\n    DRS?6000:unix:4.0:6*)\n\techo sparc-icl-nx6\n\texit ;;\n    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)\n\tcase `/usr/bin/uname -p` in\n\t    sparc) echo sparc-icl-nx7; exit ;;\n\tesac ;;\n    s390x:SunOS:*:*)\n\techo \"$UNAME_MACHINE\"-ibm-solaris2\"`echo \"$UNAME_RELEASE\" | sed -e 's/[^.]*//'`\"\n\texit ;;\n    sun4H:SunOS:5.*:*)\n\techo sparc-hal-solaris2\"`echo \"$UNAME_RELEASE\"|sed -e 's/[^.]*//'`\"\n\texit ;;\n    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)\n\techo sparc-sun-solaris2\"`echo \"$UNAME_RELEASE\" | sed -e 's/[^.]*//'`\"\n\texit ;;\n    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)\n\techo i386-pc-auroraux\"$UNAME_RELEASE\"\n\texit ;;\n    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)\n\tUNAME_REL=\"`echo \"$UNAME_RELEASE\" | sed -e 's/[^.]*//'`\"\n\tcase `isainfo -b` in\n\t    32)\n\t\techo i386-pc-solaris2\"$UNAME_REL\"\n\t\t;;\n\t    64)\n\t\techo x86_64-pc-solaris2\"$UNAME_REL\"\n\t\t;;\n\tesac\n\texit ;;\n    sun4*:SunOS:6*:*)\n\t# According to config.sub, this is the proper way to canonicalize\n\t# SunOS6.  Hard to guess exactly what SunOS6 will be like, but\n\t# it's likely to be more like Solaris than SunOS4.\n\techo sparc-sun-solaris3\"`echo \"$UNAME_RELEASE\"|sed -e 's/[^.]*//'`\"\n\texit ;;\n    sun4*:SunOS:*:*)\n\tcase \"`/usr/bin/arch -k`\" in\n\t    Series*|S4*)\n\t\tUNAME_RELEASE=`uname -v`\n\t\t;;\n\tesac\n\t# Japanese Language versions have a version number like `4.1.3-JL'.\n\techo sparc-sun-sunos\"`echo \"$UNAME_RELEASE\"|sed -e 's/-/_/'`\"\n\texit ;;\n    sun3*:SunOS:*:*)\n\techo m68k-sun-sunos\"$UNAME_RELEASE\"\n\texit ;;\n    sun*:*:4.2BSD:*)\n\tUNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`\n\ttest \"x$UNAME_RELEASE\" = x && UNAME_RELEASE=3\n\tcase \"`/bin/arch`\" in\n\t    sun3)\n\t\techo m68k-sun-sunos\"$UNAME_RELEASE\"\n\t\t;;\n\t    sun4)\n\t\techo sparc-sun-sunos\"$UNAME_RELEASE\"\n\t\t;;\n\tesac\n\texit ;;\n    aushp:SunOS:*:*)\n\techo sparc-auspex-sunos\"$UNAME_RELEASE\"\n\texit ;;\n    # The situation for MiNT is a little confusing.  The machine name\n    # can be virtually everything (everything which is not\n    # \"atarist\" or \"atariste\" at least should have a processor\n    # > m68000).  The system name ranges from \"MiNT\" over \"FreeMiNT\"\n    # to the lowercase version \"mint\" (or \"freemint\").  Finally\n    # the system name \"TOS\" denotes a system which is actually not\n    # MiNT.  But MiNT is downward compatible to TOS, so this should\n    # be no problem.\n    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)\n\techo m68k-atari-mint\"$UNAME_RELEASE\"\n\texit ;;\n    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)\n\techo m68k-atari-mint\"$UNAME_RELEASE\"\n\texit ;;\n    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)\n\techo m68k-atari-mint\"$UNAME_RELEASE\"\n\texit ;;\n    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)\n\techo m68k-milan-mint\"$UNAME_RELEASE\"\n\texit ;;\n    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)\n\techo m68k-hades-mint\"$UNAME_RELEASE\"\n\texit ;;\n    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)\n\techo m68k-unknown-mint\"$UNAME_RELEASE\"\n\texit ;;\n    m68k:machten:*:*)\n\techo m68k-apple-machten\"$UNAME_RELEASE\"\n\texit ;;\n    powerpc:machten:*:*)\n\techo powerpc-apple-machten\"$UNAME_RELEASE\"\n\texit ;;\n    RISC*:Mach:*:*)\n\techo mips-dec-mach_bsd4.3\n\texit ;;\n    RISC*:ULTRIX:*:*)\n\techo mips-dec-ultrix\"$UNAME_RELEASE\"\n\texit ;;\n    VAX*:ULTRIX*:*:*)\n\techo vax-dec-ultrix\"$UNAME_RELEASE\"\n\texit ;;\n    2020:CLIX:*:* | 2430:CLIX:*:*)\n\techo clipper-intergraph-clix\"$UNAME_RELEASE\"\n\texit ;;\n    mips:*:*:UMIPS | mips:*:*:RISCos)\n\tset_cc_for_build\n\tsed 's/^\t//' << EOF > \"$dummy.c\"\n#ifdef __cplusplus\n#include <stdio.h>  /* for printf() prototype */\n\tint main (int argc, char *argv[]) {\n#else\n\tint main (argc, argv) int argc; char *argv[]; {\n#endif\n\t#if defined (host_mips) && defined (MIPSEB)\n\t#if defined (SYSTYPE_SYSV)\n\t  printf (\"mips-mips-riscos%ssysv\\\\n\", argv[1]); exit (0);\n\t#endif\n\t#if defined (SYSTYPE_SVR4)\n\t  printf (\"mips-mips-riscos%ssvr4\\\\n\", argv[1]); exit (0);\n\t#endif\n\t#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)\n\t  printf (\"mips-mips-riscos%sbsd\\\\n\", argv[1]); exit (0);\n\t#endif\n\t#endif\n\t  exit (-1);\n\t}\nEOF\n\t$CC_FOR_BUILD -o \"$dummy\" \"$dummy.c\" &&\n\t  dummyarg=`echo \"$UNAME_RELEASE\" | sed -n 's/\\([0-9]*\\).*/\\1/p'` &&\n\t  SYSTEM_NAME=`\"$dummy\" \"$dummyarg\"` &&\n\t    { echo \"$SYSTEM_NAME\"; exit; }\n\techo mips-mips-riscos\"$UNAME_RELEASE\"\n\texit ;;\n    Motorola:PowerMAX_OS:*:*)\n\techo powerpc-motorola-powermax\n\texit ;;\n    Motorola:*:4.3:PL8-*)\n\techo powerpc-harris-powermax\n\texit ;;\n    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)\n\techo powerpc-harris-powermax\n\texit ;;\n    Night_Hawk:Power_UNIX:*:*)\n\techo powerpc-harris-powerunix\n\texit ;;\n    m88k:CX/UX:7*:*)\n\techo m88k-harris-cxux7\n\texit ;;\n    m88k:*:4*:R4*)\n\techo m88k-motorola-sysv4\n\texit ;;\n    m88k:*:3*:R3*)\n\techo m88k-motorola-sysv3\n\texit ;;\n    AViiON:dgux:*:*)\n\t# DG/UX returns AViiON for all architectures\n\tUNAME_PROCESSOR=`/usr/bin/uname -p`\n\tif [ \"$UNAME_PROCESSOR\" = mc88100 ] || [ \"$UNAME_PROCESSOR\" = mc88110 ]\n\tthen\n\t    if [ \"$TARGET_BINARY_INTERFACE\"x = m88kdguxelfx ] || \\\n\t       [ \"$TARGET_BINARY_INTERFACE\"x = x ]\n\t    then\n\t\techo m88k-dg-dgux\"$UNAME_RELEASE\"\n\t    else\n\t\techo m88k-dg-dguxbcs\"$UNAME_RELEASE\"\n\t    fi\n\telse\n\t    echo i586-dg-dgux\"$UNAME_RELEASE\"\n\tfi\n\texit ;;\n    M88*:DolphinOS:*:*)\t# DolphinOS (SVR3)\n\techo m88k-dolphin-sysv3\n\texit ;;\n    M88*:*:R3*:*)\n\t# Delta 88k system running SVR3\n\techo m88k-motorola-sysv3\n\texit ;;\n    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)\n\techo m88k-tektronix-sysv3\n\texit ;;\n    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)\n\techo m68k-tektronix-bsd\n\texit ;;\n    *:IRIX*:*:*)\n\techo mips-sgi-irix\"`echo \"$UNAME_RELEASE\"|sed -e 's/-/_/g'`\"\n\texit ;;\n    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.\n\techo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id\n\texit ;;               # Note that: echo \"'`uname -s`'\" gives 'AIX '\n    i*86:AIX:*:*)\n\techo i386-ibm-aix\n\texit ;;\n    ia64:AIX:*:*)\n\tif [ -x /usr/bin/oslevel ] ; then\n\t\tIBM_REV=`/usr/bin/oslevel`\n\telse\n\t\tIBM_REV=\"$UNAME_VERSION.$UNAME_RELEASE\"\n\tfi\n\techo \"$UNAME_MACHINE\"-ibm-aix\"$IBM_REV\"\n\texit ;;\n    *:AIX:2:3)\n\tif grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then\n\t\tset_cc_for_build\n\t\tsed 's/^\t\t//' << EOF > \"$dummy.c\"\n\t\t#include <sys/systemcfg.h>\n\n\t\tmain()\n\t\t\t{\n\t\t\tif (!__power_pc())\n\t\t\t\texit(1);\n\t\t\tputs(\"powerpc-ibm-aix3.2.5\");\n\t\t\texit(0);\n\t\t\t}\nEOF\n\t\tif $CC_FOR_BUILD -o \"$dummy\" \"$dummy.c\" && SYSTEM_NAME=`\"$dummy\"`\n\t\tthen\n\t\t\techo \"$SYSTEM_NAME\"\n\t\telse\n\t\t\techo rs6000-ibm-aix3.2.5\n\t\tfi\n\telif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then\n\t\techo rs6000-ibm-aix3.2.4\n\telse\n\t\techo rs6000-ibm-aix3.2\n\tfi\n\texit ;;\n    *:AIX:*:[4567])\n\tIBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`\n\tif /usr/sbin/lsattr -El \"$IBM_CPU_ID\" | grep ' POWER' >/dev/null 2>&1; then\n\t\tIBM_ARCH=rs6000\n\telse\n\t\tIBM_ARCH=powerpc\n\tfi\n\tif [ -x /usr/bin/lslpp ] ; then\n\t\tIBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |\n\t\t\t   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`\n\telse\n\t\tIBM_REV=\"$UNAME_VERSION.$UNAME_RELEASE\"\n\tfi\n\techo \"$IBM_ARCH\"-ibm-aix\"$IBM_REV\"\n\texit ;;\n    *:AIX:*:*)\n\techo rs6000-ibm-aix\n\texit ;;\n    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)\n\techo romp-ibm-bsd4.4\n\texit ;;\n    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and\n\techo romp-ibm-bsd\"$UNAME_RELEASE\"   # 4.3 with uname added to\n\texit ;;                             # report: romp-ibm BSD 4.3\n    *:BOSX:*:*)\n\techo rs6000-bull-bosx\n\texit ;;\n    DPX/2?00:B.O.S.:*:*)\n\techo m68k-bull-sysv3\n\texit ;;\n    9000/[34]??:4.3bsd:1.*:*)\n\techo m68k-hp-bsd\n\texit ;;\n    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)\n\techo m68k-hp-bsd4.4\n\texit ;;\n    9000/[34678]??:HP-UX:*:*)\n\tHPUX_REV=`echo \"$UNAME_RELEASE\"|sed -e 's/[^.]*.[0B]*//'`\n\tcase \"$UNAME_MACHINE\" in\n\t    9000/31?)            HP_ARCH=m68000 ;;\n\t    9000/[34]??)         HP_ARCH=m68k ;;\n\t    9000/[678][0-9][0-9])\n\t\tif [ -x /usr/bin/getconf ]; then\n\t\t    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`\n\t\t    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`\n\t\t    case \"$sc_cpu_version\" in\n\t\t      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0\n\t\t      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1\n\t\t      532)                      # CPU_PA_RISC2_0\n\t\t\tcase \"$sc_kernel_bits\" in\n\t\t\t  32) HP_ARCH=hppa2.0n ;;\n\t\t\t  64) HP_ARCH=hppa2.0w ;;\n\t\t\t  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20\n\t\t\tesac ;;\n\t\t    esac\n\t\tfi\n\t\tif [ \"$HP_ARCH\" = \"\" ]; then\n\t\t    set_cc_for_build\n\t\t    sed 's/^\t\t//' << EOF > \"$dummy.c\"\n\n\t\t#define _HPUX_SOURCE\n\t\t#include <stdlib.h>\n\t\t#include <unistd.h>\n\n\t\tint main ()\n\t\t{\n\t\t#if defined(_SC_KERNEL_BITS)\n\t\t    long bits = sysconf(_SC_KERNEL_BITS);\n\t\t#endif\n\t\t    long cpu  = sysconf (_SC_CPU_VERSION);\n\n\t\t    switch (cpu)\n\t\t\t{\n\t\t\tcase CPU_PA_RISC1_0: puts (\"hppa1.0\"); break;\n\t\t\tcase CPU_PA_RISC1_1: puts (\"hppa1.1\"); break;\n\t\t\tcase CPU_PA_RISC2_0:\n\t\t#if defined(_SC_KERNEL_BITS)\n\t\t\t    switch (bits)\n\t\t\t\t{\n\t\t\t\tcase 64: puts (\"hppa2.0w\"); break;\n\t\t\t\tcase 32: puts (\"hppa2.0n\"); break;\n\t\t\t\tdefault: puts (\"hppa2.0\"); break;\n\t\t\t\t} break;\n\t\t#else  /* !defined(_SC_KERNEL_BITS) */\n\t\t\t    puts (\"hppa2.0\"); break;\n\t\t#endif\n\t\t\tdefault: puts (\"hppa1.0\"); break;\n\t\t\t}\n\t\t    exit (0);\n\t\t}\nEOF\n\t\t    (CCOPTS=\"\" $CC_FOR_BUILD -o \"$dummy\" \"$dummy.c\" 2>/dev/null) && HP_ARCH=`\"$dummy\"`\n\t\t    test -z \"$HP_ARCH\" && HP_ARCH=hppa\n\t\tfi ;;\n\tesac\n\tif [ \"$HP_ARCH\" = hppa2.0w ]\n\tthen\n\t    set_cc_for_build\n\n\t    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating\n\t    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler\n\t    # generating 64-bit code.  GNU and HP use different nomenclature:\n\t    #\n\t    # $ CC_FOR_BUILD=cc ./config.guess\n\t    # => hppa2.0w-hp-hpux11.23\n\t    # $ CC_FOR_BUILD=\"cc +DA2.0w\" ./config.guess\n\t    # => hppa64-hp-hpux11.23\n\n\t    if echo __LP64__ | (CCOPTS=\"\" $CC_FOR_BUILD -E - 2>/dev/null) |\n\t\tgrep -q __LP64__\n\t    then\n\t\tHP_ARCH=hppa2.0w\n\t    else\n\t\tHP_ARCH=hppa64\n\t    fi\n\tfi\n\techo \"$HP_ARCH\"-hp-hpux\"$HPUX_REV\"\n\texit ;;\n    ia64:HP-UX:*:*)\n\tHPUX_REV=`echo \"$UNAME_RELEASE\"|sed -e 's/[^.]*.[0B]*//'`\n\techo ia64-hp-hpux\"$HPUX_REV\"\n\texit ;;\n    3050*:HI-UX:*:*)\n\tset_cc_for_build\n\tsed 's/^\t//' << EOF > \"$dummy.c\"\n\t#include <unistd.h>\n\tint\n\tmain ()\n\t{\n\t  long cpu = sysconf (_SC_CPU_VERSION);\n\t  /* The order matters, because CPU_IS_HP_MC68K erroneously returns\n\t     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct\n\t     results, however.  */\n\t  if (CPU_IS_PA_RISC (cpu))\n\t    {\n\t      switch (cpu)\n\t\t{\n\t\t  case CPU_PA_RISC1_0: puts (\"hppa1.0-hitachi-hiuxwe2\"); break;\n\t\t  case CPU_PA_RISC1_1: puts (\"hppa1.1-hitachi-hiuxwe2\"); break;\n\t\t  case CPU_PA_RISC2_0: puts (\"hppa2.0-hitachi-hiuxwe2\"); break;\n\t\t  default: puts (\"hppa-hitachi-hiuxwe2\"); break;\n\t\t}\n\t    }\n\t  else if (CPU_IS_HP_MC68K (cpu))\n\t    puts (\"m68k-hitachi-hiuxwe2\");\n\t  else puts (\"unknown-hitachi-hiuxwe2\");\n\t  exit (0);\n\t}\nEOF\n\t$CC_FOR_BUILD -o \"$dummy\" \"$dummy.c\" && SYSTEM_NAME=`\"$dummy\"` &&\n\t\t{ echo \"$SYSTEM_NAME\"; exit; }\n\techo unknown-hitachi-hiuxwe2\n\texit ;;\n    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)\n\techo hppa1.1-hp-bsd\n\texit ;;\n    9000/8??:4.3bsd:*:*)\n\techo hppa1.0-hp-bsd\n\texit ;;\n    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)\n\techo hppa1.0-hp-mpeix\n\texit ;;\n    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)\n\techo hppa1.1-hp-osf\n\texit ;;\n    hp8??:OSF1:*:*)\n\techo hppa1.0-hp-osf\n\texit ;;\n    i*86:OSF1:*:*)\n\tif [ -x /usr/sbin/sysversion ] ; then\n\t    echo \"$UNAME_MACHINE\"-unknown-osf1mk\n\telse\n\t    echo \"$UNAME_MACHINE\"-unknown-osf1\n\tfi\n\texit ;;\n    parisc*:Lites*:*:*)\n\techo hppa1.1-hp-lites\n\texit ;;\n    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)\n\techo c1-convex-bsd\n\texit ;;\n    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)\n\tif getsysinfo -f scalar_acc\n\tthen echo c32-convex-bsd\n\telse echo c2-convex-bsd\n\tfi\n\texit ;;\n    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)\n\techo c34-convex-bsd\n\texit ;;\n    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)\n\techo c38-convex-bsd\n\texit ;;\n    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)\n\techo c4-convex-bsd\n\texit ;;\n    CRAY*Y-MP:*:*:*)\n\techo ymp-cray-unicos\"$UNAME_RELEASE\" | sed -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    CRAY*[A-Z]90:*:*:*)\n\techo \"$UNAME_MACHINE\"-cray-unicos\"$UNAME_RELEASE\" \\\n\t| sed -e 's/CRAY.*\\([A-Z]90\\)/\\1/' \\\n\t      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \\\n\t      -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    CRAY*TS:*:*:*)\n\techo t90-cray-unicos\"$UNAME_RELEASE\" | sed -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    CRAY*T3E:*:*:*)\n\techo alphaev5-cray-unicosmk\"$UNAME_RELEASE\" | sed -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    CRAY*SV1:*:*:*)\n\techo sv1-cray-unicos\"$UNAME_RELEASE\" | sed -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    *:UNICOS/mp:*:*)\n\techo craynv-cray-unicosmp\"$UNAME_RELEASE\" | sed -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)\n\tFUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`\n\tFUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\\///'`\n\tFUJITSU_REL=`echo \"$UNAME_RELEASE\" | sed -e 's/ /_/'`\n\techo \"${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}\"\n\texit ;;\n    5000:UNIX_System_V:4.*:*)\n\tFUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\\///'`\n\tFUJITSU_REL=`echo \"$UNAME_RELEASE\" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`\n\techo \"sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}\"\n\texit ;;\n    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\\ Embedded/OS:*:*)\n\techo \"$UNAME_MACHINE\"-pc-bsdi\"$UNAME_RELEASE\"\n\texit ;;\n    sparc*:BSD/OS:*:*)\n\techo sparc-unknown-bsdi\"$UNAME_RELEASE\"\n\texit ;;\n    *:BSD/OS:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-bsdi\"$UNAME_RELEASE\"\n\texit ;;\n    arm*:FreeBSD:*:*)\n\tUNAME_PROCESSOR=`uname -p`\n\tset_cc_for_build\n\tif echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \\\n\t    | grep -q __ARM_PCS_VFP\n\tthen\n\t    echo \"${UNAME_PROCESSOR}\"-unknown-freebsd\"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`\"-gnueabi\n\telse\n\t    echo \"${UNAME_PROCESSOR}\"-unknown-freebsd\"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`\"-gnueabihf\n\tfi\n\texit ;;\n    *:FreeBSD:*:*)\n\tUNAME_PROCESSOR=`/usr/bin/uname -p`\n\tcase \"$UNAME_PROCESSOR\" in\n\t    amd64)\n\t\tUNAME_PROCESSOR=x86_64 ;;\n\t    i386)\n\t\tUNAME_PROCESSOR=i586 ;;\n\tesac\n\techo \"$UNAME_PROCESSOR\"-unknown-freebsd\"`echo \"$UNAME_RELEASE\"|sed -e 's/[-(].*//'`\"\n\texit ;;\n    i*:CYGWIN*:*)\n\techo \"$UNAME_MACHINE\"-pc-cygwin\n\texit ;;\n    *:MINGW64*:*)\n\techo \"$UNAME_MACHINE\"-pc-mingw64\n\texit ;;\n    *:MINGW*:*)\n\techo \"$UNAME_MACHINE\"-pc-mingw32\n\texit ;;\n    *:MSYS*:*)\n\techo \"$UNAME_MACHINE\"-pc-msys\n\texit ;;\n    i*:PW*:*)\n\techo \"$UNAME_MACHINE\"-pc-pw32\n\texit ;;\n    *:Interix*:*)\n\tcase \"$UNAME_MACHINE\" in\n\t    x86)\n\t\techo i586-pc-interix\"$UNAME_RELEASE\"\n\t\texit ;;\n\t    authenticamd | genuineintel | EM64T)\n\t\techo x86_64-unknown-interix\"$UNAME_RELEASE\"\n\t\texit ;;\n\t    IA64)\n\t\techo ia64-unknown-interix\"$UNAME_RELEASE\"\n\t\texit ;;\n\tesac ;;\n    i*:UWIN*:*)\n\techo \"$UNAME_MACHINE\"-pc-uwin\n\texit ;;\n    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)\n\techo x86_64-unknown-cygwin\n\texit ;;\n    prep*:SunOS:5.*:*)\n\techo powerpcle-unknown-solaris2\"`echo \"$UNAME_RELEASE\"|sed -e 's/[^.]*//'`\"\n\texit ;;\n    *:GNU:*:*)\n\t# the GNU system\n\techo \"`echo \"$UNAME_MACHINE\"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo \"$UNAME_RELEASE\"|sed -e 's,/.*$,,'`\"\n\texit ;;\n    *:GNU/*:*:*)\n\t# other systems with GNU libc and userland\n\techo \"$UNAME_MACHINE-unknown-`echo \"$UNAME_SYSTEM\" | sed 's,^[^/]*/,,' | tr \"[:upper:]\" \"[:lower:]\"``echo \"$UNAME_RELEASE\"|sed -e 's/[-(].*//'`-$LIBC\"\n\texit ;;\n    *:Minix:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-minix\n\texit ;;\n    aarch64:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    aarch64_be:Linux:*:*)\n\tUNAME_MACHINE=aarch64_be\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    alpha:Linux:*:*)\n\tcase `sed -n '/^cpu model/s/^.*: \\(.*\\)/\\1/p' < /proc/cpuinfo` in\n\t  EV5)   UNAME_MACHINE=alphaev5 ;;\n\t  EV56)  UNAME_MACHINE=alphaev56 ;;\n\t  PCA56) UNAME_MACHINE=alphapca56 ;;\n\t  PCA57) UNAME_MACHINE=alphapca56 ;;\n\t  EV6)   UNAME_MACHINE=alphaev6 ;;\n\t  EV67)  UNAME_MACHINE=alphaev67 ;;\n\t  EV68*) UNAME_MACHINE=alphaev68 ;;\n\tesac\n\tobjdump --private-headers /bin/sh | grep -q ld.so.1\n\tif test \"$?\" = 0 ; then LIBC=gnulibc1 ; fi\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    arc:Linux:*:* | arceb:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    arm*:Linux:*:*)\n\tset_cc_for_build\n\tif echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \\\n\t    | grep -q __ARM_EABI__\n\tthen\n\t    echo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\telse\n\t    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \\\n\t\t| grep -q __ARM_PCS_VFP\n\t    then\n\t\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"eabi\n\t    else\n\t\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"eabihf\n\t    fi\n\tfi\n\texit ;;\n    avr32*:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    cris:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-axis-linux-\"$LIBC\"\n\texit ;;\n    crisv32:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-axis-linux-\"$LIBC\"\n\texit ;;\n    e2k:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    frv:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    hexagon:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    i*86:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-pc-linux-\"$LIBC\"\n\texit ;;\n    ia64:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    k1om:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    m32r*:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    m68*:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    mips:Linux:*:* | mips64:Linux:*:*)\n\tset_cc_for_build\n\tsed 's/^\t//' << EOF > \"$dummy.c\"\n\t#undef CPU\n\t#undef ${UNAME_MACHINE}\n\t#undef ${UNAME_MACHINE}el\n\t#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)\n\tCPU=${UNAME_MACHINE}el\n\t#else\n\t#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)\n\tCPU=${UNAME_MACHINE}\n\t#else\n\tCPU=\n\t#endif\n\t#endif\nEOF\n\teval \"`$CC_FOR_BUILD -E \"$dummy.c\" 2>/dev/null | grep '^CPU'`\"\n\ttest \"x$CPU\" != x && { echo \"$CPU-unknown-linux-$LIBC\"; exit; }\n\t;;\n    mips64el:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    openrisc*:Linux:*:*)\n\techo or1k-unknown-linux-\"$LIBC\"\n\texit ;;\n    or32:Linux:*:* | or1k*:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    padre:Linux:*:*)\n\techo sparc-unknown-linux-\"$LIBC\"\n\texit ;;\n    parisc64:Linux:*:* | hppa64:Linux:*:*)\n\techo hppa64-unknown-linux-\"$LIBC\"\n\texit ;;\n    parisc:Linux:*:* | hppa:Linux:*:*)\n\t# Look for CPU level\n\tcase `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in\n\t  PA7*) echo hppa1.1-unknown-linux-\"$LIBC\" ;;\n\t  PA8*) echo hppa2.0-unknown-linux-\"$LIBC\" ;;\n\t  *)    echo hppa-unknown-linux-\"$LIBC\" ;;\n\tesac\n\texit ;;\n    ppc64:Linux:*:*)\n\techo powerpc64-unknown-linux-\"$LIBC\"\n\texit ;;\n    ppc:Linux:*:*)\n\techo powerpc-unknown-linux-\"$LIBC\"\n\texit ;;\n    ppc64le:Linux:*:*)\n\techo powerpc64le-unknown-linux-\"$LIBC\"\n\texit ;;\n    ppcle:Linux:*:*)\n\techo powerpcle-unknown-linux-\"$LIBC\"\n\texit ;;\n    riscv32:Linux:*:* | riscv64:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    s390:Linux:*:* | s390x:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-ibm-linux-\"$LIBC\"\n\texit ;;\n    sh64*:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    sh*:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    sparc:Linux:*:* | sparc64:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    tile*:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    vax:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-dec-linux-\"$LIBC\"\n\texit ;;\n    x86_64:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-pc-linux-\"$LIBC\"\n\texit ;;\n    xtensa*:Linux:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-linux-\"$LIBC\"\n\texit ;;\n    i*86:DYNIX/ptx:4*:*)\n\t# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.\n\t# earlier versions are messed up and put the nodename in both\n\t# sysname and nodename.\n\techo i386-sequent-sysv4\n\texit ;;\n    i*86:UNIX_SV:4.2MP:2.*)\n\t# Unixware is an offshoot of SVR4, but it has its own version\n\t# number series starting with 2...\n\t# I am not positive that other SVR4 systems won't match this,\n\t# I just have to hope.  -- rms.\n\t# Use sysv4.2uw... so that sysv4* matches it.\n\techo \"$UNAME_MACHINE\"-pc-sysv4.2uw\"$UNAME_VERSION\"\n\texit ;;\n    i*86:OS/2:*:*)\n\t# If we were able to find `uname', then EMX Unix compatibility\n\t# is probably installed.\n\techo \"$UNAME_MACHINE\"-pc-os2-emx\n\texit ;;\n    i*86:XTS-300:*:STOP)\n\techo \"$UNAME_MACHINE\"-unknown-stop\n\texit ;;\n    i*86:atheos:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-atheos\n\texit ;;\n    i*86:syllable:*:*)\n\techo \"$UNAME_MACHINE\"-pc-syllable\n\texit ;;\n    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)\n\techo i386-unknown-lynxos\"$UNAME_RELEASE\"\n\texit ;;\n    i*86:*DOS:*:*)\n\techo \"$UNAME_MACHINE\"-pc-msdosdjgpp\n\texit ;;\n    i*86:*:4.*:*)\n\tUNAME_REL=`echo \"$UNAME_RELEASE\" | sed 's/\\/MP$//'`\n\tif grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then\n\t\techo \"$UNAME_MACHINE\"-univel-sysv\"$UNAME_REL\"\n\telse\n\t\techo \"$UNAME_MACHINE\"-pc-sysv\"$UNAME_REL\"\n\tfi\n\texit ;;\n    i*86:*:5:[678]*)\n\t# UnixWare 7.x, OpenUNIX and OpenServer 6.\n\tcase `/bin/uname -X | grep \"^Machine\"` in\n\t    *486*)\t     UNAME_MACHINE=i486 ;;\n\t    *Pentium)\t     UNAME_MACHINE=i586 ;;\n\t    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;\n\tesac\n\techo \"$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}\"\n\texit ;;\n    i*86:*:3.2:*)\n\tif test -f /usr/options/cb.name; then\n\t\tUNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`\n\t\techo \"$UNAME_MACHINE\"-pc-isc\"$UNAME_REL\"\n\telif /bin/uname -X 2>/dev/null >/dev/null ; then\n\t\tUNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`\n\t\t(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486\n\t\t(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \\\n\t\t\t&& UNAME_MACHINE=i586\n\t\t(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \\\n\t\t\t&& UNAME_MACHINE=i686\n\t\t(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \\\n\t\t\t&& UNAME_MACHINE=i686\n\t\techo \"$UNAME_MACHINE\"-pc-sco\"$UNAME_REL\"\n\telse\n\t\techo \"$UNAME_MACHINE\"-pc-sysv32\n\tfi\n\texit ;;\n    pc:*:*:*)\n\t# Left here for compatibility:\n\t# uname -m prints for DJGPP always 'pc', but it prints nothing about\n\t# the processor, so we play safe by assuming i586.\n\t# Note: whatever this is, it MUST be the same as what config.sub\n\t# prints for the \"djgpp\" host, or else GDB configure will decide that\n\t# this is a cross-build.\n\techo i586-pc-msdosdjgpp\n\texit ;;\n    Intel:Mach:3*:*)\n\techo i386-pc-mach3\n\texit ;;\n    paragon:*:*:*)\n\techo i860-intel-osf1\n\texit ;;\n    i860:*:4.*:*) # i860-SVR4\n\tif grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then\n\t  echo i860-stardent-sysv\"$UNAME_RELEASE\" # Stardent Vistra i860-SVR4\n\telse # Add other i860-SVR4 vendors below as they are discovered.\n\t  echo i860-unknown-sysv\"$UNAME_RELEASE\"  # Unknown i860-SVR4\n\tfi\n\texit ;;\n    mini*:CTIX:SYS*5:*)\n\t# \"miniframe\"\n\techo m68010-convergent-sysv\n\texit ;;\n    mc68k:UNIX:SYSTEM5:3.51m)\n\techo m68k-convergent-sysv\n\texit ;;\n    M680?0:D-NIX:5.3:*)\n\techo m68k-diab-dnix\n\texit ;;\n    M68*:*:R3V[5678]*:*)\n\ttest -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;\n    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)\n\tOS_REL=''\n\ttest -r /etc/.relid \\\n\t&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \\([0-9][0-9]\\).*/\\1/p' < /etc/.relid`\n\t/bin/uname -p 2>/dev/null | grep 86 >/dev/null \\\n\t  && { echo i486-ncr-sysv4.3\"$OS_REL\"; exit; }\n\t/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \\\n\t  && { echo i586-ncr-sysv4.3\"$OS_REL\"; exit; } ;;\n    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)\n\t/bin/uname -p 2>/dev/null | grep 86 >/dev/null \\\n\t  && { echo i486-ncr-sysv4; exit; } ;;\n    NCR*:*:4.2:* | MPRAS*:*:4.2:*)\n\tOS_REL='.3'\n\ttest -r /etc/.relid \\\n\t    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \\([0-9][0-9]\\).*/\\1/p' < /etc/.relid`\n\t/bin/uname -p 2>/dev/null | grep 86 >/dev/null \\\n\t    && { echo i486-ncr-sysv4.3\"$OS_REL\"; exit; }\n\t/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \\\n\t    && { echo i586-ncr-sysv4.3\"$OS_REL\"; exit; }\n\t/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \\\n\t    && { echo i586-ncr-sysv4.3\"$OS_REL\"; exit; } ;;\n    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)\n\techo m68k-unknown-lynxos\"$UNAME_RELEASE\"\n\texit ;;\n    mc68030:UNIX_System_V:4.*:*)\n\techo m68k-atari-sysv4\n\texit ;;\n    TSUNAMI:LynxOS:2.*:*)\n\techo sparc-unknown-lynxos\"$UNAME_RELEASE\"\n\texit ;;\n    rs6000:LynxOS:2.*:*)\n\techo rs6000-unknown-lynxos\"$UNAME_RELEASE\"\n\texit ;;\n    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)\n\techo powerpc-unknown-lynxos\"$UNAME_RELEASE\"\n\texit ;;\n    SM[BE]S:UNIX_SV:*:*)\n\techo mips-dde-sysv\"$UNAME_RELEASE\"\n\texit ;;\n    RM*:ReliantUNIX-*:*:*)\n\techo mips-sni-sysv4\n\texit ;;\n    RM*:SINIX-*:*:*)\n\techo mips-sni-sysv4\n\texit ;;\n    *:SINIX-*:*:*)\n\tif uname -p 2>/dev/null >/dev/null ; then\n\t\tUNAME_MACHINE=`(uname -p) 2>/dev/null`\n\t\techo \"$UNAME_MACHINE\"-sni-sysv4\n\telse\n\t\techo ns32k-sni-sysv\n\tfi\n\texit ;;\n    PENTIUM:*:4.0*:*)\t# Unisys `ClearPath HMP IX 4000' SVR4/MP effort\n\t\t\t# says <Richard.M.Bartel@ccMail.Census.GOV>\n\techo i586-unisys-sysv4\n\texit ;;\n    *:UNIX_System_V:4*:FTX*)\n\t# From Gerald Hewes <hewes@openmarket.com>.\n\t# How about differentiating between stratus architectures? -djm\n\techo hppa1.1-stratus-sysv4\n\texit ;;\n    *:*:*:FTX*)\n\t# From seanf@swdc.stratus.com.\n\techo i860-stratus-sysv4\n\texit ;;\n    i*86:VOS:*:*)\n\t# From Paul.Green@stratus.com.\n\techo \"$UNAME_MACHINE\"-stratus-vos\n\texit ;;\n    *:VOS:*:*)\n\t# From Paul.Green@stratus.com.\n\techo hppa1.1-stratus-vos\n\texit ;;\n    mc68*:A/UX:*:*)\n\techo m68k-apple-aux\"$UNAME_RELEASE\"\n\texit ;;\n    news*:NEWS-OS:6*:*)\n\techo mips-sony-newsos6\n\texit ;;\n    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)\n\tif [ -d /usr/nec ]; then\n\t\techo mips-nec-sysv\"$UNAME_RELEASE\"\n\telse\n\t\techo mips-unknown-sysv\"$UNAME_RELEASE\"\n\tfi\n\texit ;;\n    BeBox:BeOS:*:*)\t# BeOS running on hardware made by Be, PPC only.\n\techo powerpc-be-beos\n\texit ;;\n    BeMac:BeOS:*:*)\t# BeOS running on Mac or Mac clone, PPC only.\n\techo powerpc-apple-beos\n\texit ;;\n    BePC:BeOS:*:*)\t# BeOS running on Intel PC compatible.\n\techo i586-pc-beos\n\texit ;;\n    BePC:Haiku:*:*)\t# Haiku running on Intel PC compatible.\n\techo i586-pc-haiku\n\texit ;;\n    x86_64:Haiku:*:*)\n\techo x86_64-unknown-haiku\n\texit ;;\n    SX-4:SUPER-UX:*:*)\n\techo sx4-nec-superux\"$UNAME_RELEASE\"\n\texit ;;\n    SX-5:SUPER-UX:*:*)\n\techo sx5-nec-superux\"$UNAME_RELEASE\"\n\texit ;;\n    SX-6:SUPER-UX:*:*)\n\techo sx6-nec-superux\"$UNAME_RELEASE\"\n\texit ;;\n    SX-7:SUPER-UX:*:*)\n\techo sx7-nec-superux\"$UNAME_RELEASE\"\n\texit ;;\n    SX-8:SUPER-UX:*:*)\n\techo sx8-nec-superux\"$UNAME_RELEASE\"\n\texit ;;\n    SX-8R:SUPER-UX:*:*)\n\techo sx8r-nec-superux\"$UNAME_RELEASE\"\n\texit ;;\n    SX-ACE:SUPER-UX:*:*)\n\techo sxace-nec-superux\"$UNAME_RELEASE\"\n\texit ;;\n    Power*:Rhapsody:*:*)\n\techo powerpc-apple-rhapsody\"$UNAME_RELEASE\"\n\texit ;;\n    *:Rhapsody:*:*)\n\techo \"$UNAME_MACHINE\"-apple-rhapsody\"$UNAME_RELEASE\"\n\texit ;;\n    *:Darwin:*:*)\n\tUNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown\n\tset_cc_for_build\n\tif test \"$UNAME_PROCESSOR\" = unknown ; then\n\t    UNAME_PROCESSOR=powerpc\n\tfi\n\tif test \"`echo \"$UNAME_RELEASE\" | sed -e 's/\\..*//'`\" -le 10 ; then\n\t    if [ \"$CC_FOR_BUILD\" != no_compiler_found ]; then\n\t\tif (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \\\n\t\t       (CCOPTS=\"\" $CC_FOR_BUILD -E - 2>/dev/null) | \\\n\t\t       grep IS_64BIT_ARCH >/dev/null\n\t\tthen\n\t\t    case $UNAME_PROCESSOR in\n\t\t\ti386) UNAME_PROCESSOR=x86_64 ;;\n\t\t\tpowerpc) UNAME_PROCESSOR=powerpc64 ;;\n\t\t    esac\n\t\tfi\n\t\t# On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc\n\t\tif (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \\\n\t\t       (CCOPTS=\"\" $CC_FOR_BUILD -E - 2>/dev/null) | \\\n\t\t       grep IS_PPC >/dev/null\n\t\tthen\n\t\t    UNAME_PROCESSOR=powerpc\n\t\tfi\n\t    fi\n\telif test \"$UNAME_PROCESSOR\" = i386 ; then\n\t    # Avoid executing cc on OS X 10.9, as it ships with a stub\n\t    # that puts up a graphical alert prompting to install\n\t    # developer tools.  Any system running Mac OS X 10.7 or\n\t    # later (Darwin 11 and later) is required to have a 64-bit\n\t    # processor. This is not true of the ARM version of Darwin\n\t    # that Apple uses in portable devices.\n\t    UNAME_PROCESSOR=x86_64\n\tfi\n\techo \"$UNAME_PROCESSOR\"-apple-darwin\"$UNAME_RELEASE\"\n\texit ;;\n    *:procnto*:*:* | *:QNX:[0123456789]*:*)\n\tUNAME_PROCESSOR=`uname -p`\n\tif test \"$UNAME_PROCESSOR\" = x86; then\n\t\tUNAME_PROCESSOR=i386\n\t\tUNAME_MACHINE=pc\n\tfi\n\techo \"$UNAME_PROCESSOR\"-\"$UNAME_MACHINE\"-nto-qnx\"$UNAME_RELEASE\"\n\texit ;;\n    *:QNX:*:4*)\n\techo i386-pc-qnx\n\texit ;;\n    NEO-*:NONSTOP_KERNEL:*:*)\n\techo neo-tandem-nsk\"$UNAME_RELEASE\"\n\texit ;;\n    NSE-*:NONSTOP_KERNEL:*:*)\n\techo nse-tandem-nsk\"$UNAME_RELEASE\"\n\texit ;;\n    NSR-*:NONSTOP_KERNEL:*:*)\n\techo nsr-tandem-nsk\"$UNAME_RELEASE\"\n\texit ;;\n    NSV-*:NONSTOP_KERNEL:*:*)\n\techo nsv-tandem-nsk\"$UNAME_RELEASE\"\n\texit ;;\n    NSX-*:NONSTOP_KERNEL:*:*)\n\techo nsx-tandem-nsk\"$UNAME_RELEASE\"\n\texit ;;\n    *:NonStop-UX:*:*)\n\techo mips-compaq-nonstopux\n\texit ;;\n    BS2000:POSIX*:*:*)\n\techo bs2000-siemens-sysv\n\texit ;;\n    DS/*:UNIX_System_V:*:*)\n\techo \"$UNAME_MACHINE\"-\"$UNAME_SYSTEM\"-\"$UNAME_RELEASE\"\n\texit ;;\n    *:Plan9:*:*)\n\t# \"uname -m\" is not consistent, so use $cputype instead. 386\n\t# is converted to i386 for consistency with other x86\n\t# operating systems.\n\t# shellcheck disable=SC2154\n\tif test \"$cputype\" = 386; then\n\t    UNAME_MACHINE=i386\n\telse\n\t    UNAME_MACHINE=\"$cputype\"\n\tfi\n\techo \"$UNAME_MACHINE\"-unknown-plan9\n\texit ;;\n    *:TOPS-10:*:*)\n\techo pdp10-unknown-tops10\n\texit ;;\n    *:TENEX:*:*)\n\techo pdp10-unknown-tenex\n\texit ;;\n    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)\n\techo pdp10-dec-tops20\n\texit ;;\n    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)\n\techo pdp10-xkl-tops20\n\texit ;;\n    *:TOPS-20:*:*)\n\techo pdp10-unknown-tops20\n\texit ;;\n    *:ITS:*:*)\n\techo pdp10-unknown-its\n\texit ;;\n    SEI:*:*:SEIUX)\n\techo mips-sei-seiux\"$UNAME_RELEASE\"\n\texit ;;\n    *:DragonFly:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-dragonfly\"`echo \"$UNAME_RELEASE\"|sed -e 's/[-(].*//'`\"\n\texit ;;\n    *:*VMS:*:*)\n\tUNAME_MACHINE=`(uname -p) 2>/dev/null`\n\tcase \"$UNAME_MACHINE\" in\n\t    A*) echo alpha-dec-vms ; exit ;;\n\t    I*) echo ia64-dec-vms ; exit ;;\n\t    V*) echo vax-dec-vms ; exit ;;\n\tesac ;;\n    *:XENIX:*:SysV)\n\techo i386-pc-xenix\n\texit ;;\n    i*86:skyos:*:*)\n\techo \"$UNAME_MACHINE\"-pc-skyos\"`echo \"$UNAME_RELEASE\" | sed -e 's/ .*$//'`\"\n\texit ;;\n    i*86:rdos:*:*)\n\techo \"$UNAME_MACHINE\"-pc-rdos\n\texit ;;\n    i*86:AROS:*:*)\n\techo \"$UNAME_MACHINE\"-pc-aros\n\texit ;;\n    x86_64:VMkernel:*:*)\n\techo \"$UNAME_MACHINE\"-unknown-esx\n\texit ;;\n    amd64:Isilon\\ OneFS:*:*)\n\techo x86_64-unknown-onefs\n\texit ;;\nesac\n\necho \"$0: unable to guess system type\" >&2\n\ncase \"$UNAME_MACHINE:$UNAME_SYSTEM\" in\n    mips:Linux | mips64:Linux)\n\t# If we got here on MIPS GNU/Linux, output extra information.\n\tcat >&2 <<EOF\n\nNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize\nthe system type. Please install a C compiler and try again.\nEOF\n\t;;\nesac\n\ncat >&2 <<EOF\n\nThis script (version $timestamp), has failed to recognize the\noperating system you are using. If your script is old, overwrite *all*\ncopies of config.guess and config.sub with the latest versions from:\n\n  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess\nand\n  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub\n\nIf $0 has already been updated, send the following data and any\ninformation you think might be pertinent to config-patches@gnu.org to\nprovide the necessary information to handle your system.\n\nconfig.guess timestamp = $timestamp\n\nuname -m = `(uname -m) 2>/dev/null || echo unknown`\nuname -r = `(uname -r) 2>/dev/null || echo unknown`\nuname -s = `(uname -s) 2>/dev/null || echo unknown`\nuname -v = `(uname -v) 2>/dev/null || echo unknown`\n\n/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`\n/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`\n\nhostinfo               = `(hostinfo) 2>/dev/null`\n/bin/universe          = `(/bin/universe) 2>/dev/null`\n/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`\n/bin/arch              = `(/bin/arch) 2>/dev/null`\n/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`\n/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`\n\nUNAME_MACHINE = \"$UNAME_MACHINE\"\nUNAME_RELEASE = \"$UNAME_RELEASE\"\nUNAME_SYSTEM  = \"$UNAME_SYSTEM\"\nUNAME_VERSION = \"$UNAME_VERSION\"\nEOF\n\nexit 1\n\n# Local variables:\n# eval: (add-hook 'before-save-hook 'time-stamp)\n# time-stamp-start: \"timestamp='\"\n# time-stamp-format: \"%:y-%02m-%02d\"\n# time-stamp-end: \"'\"\n# End:\n"},{"className":"WCSAxes","col":0,"comment":"\n    The main axes class that can be used to show world coordinates from a WCS.\n\n    Parameters\n    ----------\n    fig : `~matplotlib.figure.Figure`\n        The figure to add the axes to\n    rect : list\n        The position of the axes in the figure in relative units. Should be\n        given as ``[left, bottom, width, height]``.\n    wcs : :class:`~astropy.wcs.WCS`, optional\n        The WCS for the data. If this is specified, ``transform`` cannot be\n        specified.\n    transform : `~matplotlib.transforms.Transform`, optional\n        The transform for the data. If this is specified, ``wcs`` cannot be\n        specified.\n    coord_meta : dict, optional\n        A dictionary providing additional metadata when ``transform`` is\n        specified. This should include the keys ``type``, ``wrap``, and\n        ``unit``. Each of these should be a list with as many items as the\n        dimension of the WCS. The ``type`` entries should be one of\n        ``longitude``, ``latitude``, or ``scalar``, the ``wrap`` entries should\n        give, for the longitude, the angle at which the coordinate wraps (and\n        `None` otherwise), and the ``unit`` should give the unit of the\n        coordinates as :class:`~astropy.units.Unit` instances. This can\n        optionally also include a ``format_unit`` entry giving the units to use\n        for the tick labels (if not specified, this defaults to ``unit``).\n    transData : `~matplotlib.transforms.Transform`, optional\n        Can be used to override the default data -> pixel mapping.\n    slices : tuple, optional\n        For WCS transformations with more than two dimensions, we need to\n        choose which dimensions are being shown in the 2D image. The slice\n        should contain one ``x`` entry, one ``y`` entry, and the rest of the\n        values should be integers indicating the slice through the data. The\n        order of the items in the slice should be the same as the order of the\n        dimensions in the :class:`~astropy.wcs.WCS`, and the opposite of the\n        order of the dimensions in Numpy. For example, ``(50, 'x', 'y')`` means\n        that the first WCS dimension (last Numpy dimension) will be sliced at\n        an index of 50, the second WCS and Numpy dimension will be shown on the\n        x axis, and the final WCS dimension (first Numpy dimension) will be\n        shown on the y-axis (and therefore the data will be plotted using\n        ``data[:, :, 50].transpose()``)\n    frame_class : type, optional\n        The class for the frame, which should be a subclass of\n        :class:`~astropy.visualization.wcsaxes.frame.BaseFrame`. The default is to use a\n        :class:`~astropy.visualization.wcsaxes.frame.RectangularFrame`\n    ","endLoc":758,"id":16630,"nodeType":"Class","startLoc":48,"text":"class WCSAxes(Axes):\n    \"\"\"\n    The main axes class that can be used to show world coordinates from a WCS.\n\n    Parameters\n    ----------\n    fig : `~matplotlib.figure.Figure`\n        The figure to add the axes to\n    rect : list\n        The position of the axes in the figure in relative units. Should be\n        given as ``[left, bottom, width, height]``.\n    wcs : :class:`~astropy.wcs.WCS`, optional\n        The WCS for the data. If this is specified, ``transform`` cannot be\n        specified.\n    transform : `~matplotlib.transforms.Transform`, optional\n        The transform for the data. If this is specified, ``wcs`` cannot be\n        specified.\n    coord_meta : dict, optional\n        A dictionary providing additional metadata when ``transform`` is\n        specified. This should include the keys ``type``, ``wrap``, and\n        ``unit``. Each of these should be a list with as many items as the\n        dimension of the WCS. The ``type`` entries should be one of\n        ``longitude``, ``latitude``, or ``scalar``, the ``wrap`` entries should\n        give, for the longitude, the angle at which the coordinate wraps (and\n        `None` otherwise), and the ``unit`` should give the unit of the\n        coordinates as :class:`~astropy.units.Unit` instances. This can\n        optionally also include a ``format_unit`` entry giving the units to use\n        for the tick labels (if not specified, this defaults to ``unit``).\n    transData : `~matplotlib.transforms.Transform`, optional\n        Can be used to override the default data -> pixel mapping.\n    slices : tuple, optional\n        For WCS transformations with more than two dimensions, we need to\n        choose which dimensions are being shown in the 2D image. The slice\n        should contain one ``x`` entry, one ``y`` entry, and the rest of the\n        values should be integers indicating the slice through the data. The\n        order of the items in the slice should be the same as the order of the\n        dimensions in the :class:`~astropy.wcs.WCS`, and the opposite of the\n        order of the dimensions in Numpy. For example, ``(50, 'x', 'y')`` means\n        that the first WCS dimension (last Numpy dimension) will be sliced at\n        an index of 50, the second WCS and Numpy dimension will be shown on the\n        x axis, and the final WCS dimension (first Numpy dimension) will be\n        shown on the y-axis (and therefore the data will be plotted using\n        ``data[:, :, 50].transpose()``)\n    frame_class : type, optional\n        The class for the frame, which should be a subclass of\n        :class:`~astropy.visualization.wcsaxes.frame.BaseFrame`. The default is to use a\n        :class:`~astropy.visualization.wcsaxes.frame.RectangularFrame`\n    \"\"\"\n\n    def __init__(self, fig, rect, wcs=None, transform=None, coord_meta=None,\n                 transData=None, slices=None, frame_class=None,\n                 **kwargs):\n        \"\"\"\n        \"\"\"\n\n        super().__init__(fig, rect, **kwargs)\n        self._bboxes = []\n\n        if frame_class is not None:\n            self.frame_class = frame_class\n        elif (wcs is not None and (wcs.pixel_n_dim == 1 or\n                                   (slices is not None and 'y' not in slices))):\n            self.frame_class = RectangularFrame1D\n        else:\n            self.frame_class = RectangularFrame\n\n        if not (transData is None):\n            # User wants to override the transform for the final\n            # data->pixel mapping\n            self.transData = transData\n\n        self.reset_wcs(wcs=wcs, slices=slices, transform=transform, coord_meta=coord_meta)\n        self._hide_parent_artists()\n        self.format_coord = self._display_world_coords\n        self._display_coords_index = 0\n        fig.canvas.mpl_connect('key_press_event', self._set_cursor_prefs)\n        self.patch = self.coords.frame.patch\n        self._wcsaxesartist = _WCSAxesArtist()\n        self.add_artist(self._wcsaxesartist)\n        self._drawn = False\n\n    def _display_world_coords(self, x, y):\n\n        if not self._drawn:\n            return \"\"\n\n        if self._display_coords_index == -1:\n            return f\"{x} {y} (pixel)\"\n\n        pixel = np.array([x, y])\n\n        coords = self._all_coords[self._display_coords_index]\n\n        world = coords._transform.transform(np.array([pixel]))[0]\n\n        coord_strings = []\n        for idx, coord in enumerate(coords):\n            if coord.coord_index is not None:\n                coord_strings.append(coord.format_coord(world[coord.coord_index], format='ascii'))\n\n        coord_string = ' '.join(coord_strings)\n\n        if self._display_coords_index == 0:\n            system = \"world\"\n        else:\n            system = f\"world, overlay {self._display_coords_index}\"\n\n        coord_string = f\"{coord_string} ({system})\"\n\n        return coord_string\n\n    def _set_cursor_prefs(self, event, **kwargs):\n        if event.key == 'w':\n            self._display_coords_index += 1\n            if self._display_coords_index + 1 > len(self._all_coords):\n                self._display_coords_index = -1\n\n    def _hide_parent_artists(self):\n        # Turn off spines and current axes\n        for s in self.spines.values():\n            s.set_visible(False)\n\n        self.xaxis.set_visible(False)\n        if self.frame_class is not RectangularFrame1D:\n            self.yaxis.set_visible(False)\n\n    # We now overload ``imshow`` because we need to make sure that origin is\n    # set to ``lower`` for all images, which means that we need to flip RGB\n    # images.\n    def imshow(self, X, *args, **kwargs):\n        \"\"\"\n        Wrapper to Matplotlib's :meth:`~matplotlib.axes.Axes.imshow`.\n\n        If an RGB image is passed as a PIL object, it will be flipped\n        vertically and ``origin`` will be set to ``lower``, since WCS\n        transformations - like FITS files - assume that the origin is the lower\n        left pixel of the image (whereas RGB images have the origin in the top\n        left).\n\n        All arguments are passed to :meth:`~matplotlib.axes.Axes.imshow`.\n        \"\"\"\n\n        origin = kwargs.pop('origin', 'lower')\n\n        # plt.imshow passes origin as None, which we should default to lower.\n        if origin is None:\n            origin = 'lower'\n        elif origin == 'upper':\n            raise ValueError(\"Cannot use images with origin='upper' in WCSAxes.\")\n\n        # To check whether the image is a PIL image we can check if the data\n        # has a 'getpixel' attribute - this is what Matplotlib's AxesImage does\n\n        try:\n            from PIL.Image import Image, FLIP_TOP_BOTTOM\n        except ImportError:\n            # We don't need to worry since PIL is not installed, so user cannot\n            # have passed RGB image.\n            pass\n        else:\n            if isinstance(X, Image) or hasattr(X, 'getpixel'):\n                X = X.transpose(FLIP_TOP_BOTTOM)\n\n        return super().imshow(X, *args, origin=origin, **kwargs)\n\n    def contour(self, *args, **kwargs):\n        \"\"\"\n        Plot contours.\n\n        This is a custom implementation of :meth:`~matplotlib.axes.Axes.contour`\n        which applies the transform (if specified) to all contours in one go for\n        performance rather than to each contour line individually. All\n        positional and keyword arguments are the same as for\n        :meth:`~matplotlib.axes.Axes.contour`.\n        \"\"\"\n\n        # In Matplotlib, when calling contour() with a transform, each\n        # individual path in the contour map is transformed separately. However,\n        # this is much too slow for us since each call to the transforms results\n        # in an Astropy coordinate transformation, which has a non-negligible\n        # overhead - therefore a better approach is to override contour(), call\n        # the Matplotlib one with no transform, then apply the transform in one\n        # go to all the segments that make up the contour map.\n\n        transform = kwargs.pop('transform', None)\n\n        cset = super().contour(*args, **kwargs)\n\n        if transform is not None:\n            # The transform passed to self.contour will normally include\n            # a transData component at the end, but we can remove that since\n            # we are already working in data space.\n            transform = transform - self.transData\n            transform_contour_set_inplace(cset, transform)\n\n        return cset\n\n    def contourf(self, *args, **kwargs):\n        \"\"\"\n        Plot filled contours.\n\n        This is a custom implementation of :meth:`~matplotlib.axes.Axes.contourf`\n        which applies the transform (if specified) to all contours in one go for\n        performance rather than to each contour line individually. All\n        positional and keyword arguments are the same as for\n        :meth:`~matplotlib.axes.Axes.contourf`.\n        \"\"\"\n\n        # See notes for contour above.\n\n        transform = kwargs.pop('transform', None)\n\n        cset = super().contourf(*args, **kwargs)\n\n        if transform is not None:\n            # The transform passed to self.contour will normally include\n            # a transData component at the end, but we can remove that since\n            # we are already working in data space.\n            transform = transform - self.transData\n            transform_contour_set_inplace(cset, transform)\n\n        return cset\n\n    def plot_coord(self, *args, **kwargs):\n        \"\"\"\n        Plot `~astropy.coordinates.SkyCoord` or\n        `~astropy.coordinates.BaseCoordinateFrame` objects onto the axes.\n\n        The first argument to\n        :meth:`~astropy.visualization.wcsaxes.WCSAxes.plot_coord` should be a\n        coordinate, which will then be converted to the first two parameters to\n        `matplotlib.axes.Axes.plot`. All other arguments are the same as\n        `matplotlib.axes.Axes.plot`. If not specified a ``transform`` keyword\n        argument will be created based on the coordinate.\n\n        Parameters\n        ----------\n        coordinate : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate object to plot on the axes. This is converted to the\n            first two arguments to `matplotlib.axes.Axes.plot`.\n\n        See Also\n        --------\n        matplotlib.axes.Axes.plot :\n            This method is called from this function with all arguments passed to it.\n\n        \"\"\"\n\n        if isinstance(args[0], (SkyCoord, BaseCoordinateFrame)):\n\n            # Extract the frame from the first argument.\n            frame0 = args[0]\n            if isinstance(frame0, SkyCoord):\n                frame0 = frame0.frame\n\n            native_frame = self._transform_pixel2world.frame_out\n            # Transform to the native frame of the plot\n            frame0 = frame0.transform_to(native_frame)\n\n            plot_data = []\n            for coord in self.coords:\n                if coord.coord_type == 'longitude':\n                    plot_data.append(frame0.spherical.lon.to_value(u.deg))\n                elif coord.coord_type == 'latitude':\n                    plot_data.append(frame0.spherical.lat.to_value(u.deg))\n                else:\n                    raise NotImplementedError(\"Coordinates cannot be plotted with this \"\n                                              \"method because the WCS does not represent longitude/latitude.\")\n\n            if 'transform' in kwargs.keys():\n                raise TypeError(\"The 'transform' keyword argument is not allowed,\"\n                                \" as it is automatically determined by the input coordinate frame.\")\n\n            transform = self.get_transform(native_frame)\n            kwargs.update({'transform': transform})\n\n            args = tuple(plot_data) + args[1:]\n\n        return super().plot(*args, **kwargs)\n\n    def reset_wcs(self, wcs=None, slices=None, transform=None, coord_meta=None):\n        \"\"\"\n        Reset the current Axes, to use a new WCS object.\n        \"\"\"\n\n        # Here determine all the coordinate axes that should be shown.\n        if wcs is None and transform is None:\n\n            self.wcs = IDENTITY\n\n        else:\n\n            # We now force call 'set', which ensures the WCS object is\n            # consistent, which will only be important if the WCS has been set\n            # by hand. For example if the user sets a celestial WCS by hand and\n            # forgets to set the units, WCS.wcs.set() will do this.\n            if wcs is not None:\n                # Check if the WCS object is an instance of `astropy.wcs.WCS`\n                # This check is necessary as only `astropy.wcs.WCS` supports\n                # wcs.set() method\n                if isinstance(wcs, WCS):\n                    wcs.wcs.set()\n\n                if isinstance(wcs, BaseHighLevelWCS):\n                    wcs = wcs.low_level_wcs\n\n            self.wcs = wcs\n\n        # If we are making a new WCS, we need to preserve the path object since\n        # it may already be used by objects that have been plotted, and we need\n        # to continue updating it. CoordinatesMap will create a new frame\n        # instance, but we can tell that instance to keep using the old path.\n        if hasattr(self, 'coords'):\n            previous_frame = {'path': self.coords.frame._path,\n                              'color': self.coords.frame.get_color(),\n                              'linewidth': self.coords.frame.get_linewidth()}\n        else:\n            previous_frame = {'path': None}\n\n        if self.wcs is not None:\n\n            transform, coord_meta = transform_coord_meta_from_wcs(self.wcs, self.frame_class, slices=slices)\n\n        self.coords = CoordinatesMap(self,\n                                     transform=transform,\n                                     coord_meta=coord_meta,\n                                     frame_class=self.frame_class,\n                                     previous_frame_path=previous_frame['path'])\n\n        self._transform_pixel2world = transform\n\n        if previous_frame['path'] is not None:\n            self.coords.frame.set_color(previous_frame['color'])\n            self.coords.frame.set_linewidth(previous_frame['linewidth'])\n\n        self._all_coords = [self.coords]\n\n        # Common default settings for Rectangular Frame\n        for ind, pos in enumerate(coord_meta.get('default_axislabel_position', ['b', 'l'])):\n            self.coords[ind].set_axislabel_position(pos)\n\n        for ind, pos in enumerate(coord_meta.get('default_ticklabel_position', ['b', 'l'])):\n            self.coords[ind].set_ticklabel_position(pos)\n\n        for ind, pos in enumerate(coord_meta.get('default_ticks_position', ['bltr', 'bltr'])):\n            self.coords[ind].set_ticks_position(pos)\n\n        if rcParams['axes.grid']:\n            self.grid()\n\n    def draw_wcsaxes(self, renderer):\n        if not self.axison:\n            return\n        # Here need to find out range of all coordinates, and update range for\n        # each coordinate axis. For now, just assume it covers the whole sky.\n\n        self._bboxes = []\n        # This generates a structure like [coords][axis] = [...]\n        ticklabels_bbox = defaultdict(partial(defaultdict, list))\n\n        visible_ticks = []\n\n        for coords in self._all_coords:\n\n            coords.frame.update()\n            for coord in coords:\n                coord._draw_grid(renderer)\n\n        for coords in self._all_coords:\n\n            for coord in coords:\n                coord._draw_ticks(renderer, bboxes=self._bboxes,\n                                  ticklabels_bbox=ticklabels_bbox[coord])\n                visible_ticks.extend(coord.ticklabels.get_visible_axes())\n\n        for coords in self._all_coords:\n\n            for coord in coords:\n                coord._draw_axislabels(renderer, bboxes=self._bboxes,\n                                       ticklabels_bbox=ticklabels_bbox,\n                                       visible_ticks=visible_ticks)\n\n        self.coords.frame.draw(renderer)\n\n    def draw(self, renderer, **kwargs):\n        \"\"\"Draw the axes.\"\"\"\n\n        # Before we do any drawing, we need to remove any existing grid lines\n        # drawn with contours, otherwise if we try and remove the contours\n        # part way through drawing, we end up with the issue mentioned in\n        # https://github.com/astropy/astropy/issues/12446\n        for coords in self._all_coords:\n            for coord in coords:\n                coord._clear_grid_contour()\n\n        # In Axes.draw, the following code can result in the xlim and ylim\n        # values changing, so we need to force call this here to make sure that\n        # the limits are correct before we update the patch.\n        locator = self.get_axes_locator()\n        if locator:\n            pos = locator(self, renderer)\n            self.apply_aspect(pos)\n        else:\n            self.apply_aspect()\n\n        if self._axisbelow is True:\n            self._wcsaxesartist.set_zorder(0.5)\n        elif self._axisbelow is False:\n            self._wcsaxesartist.set_zorder(2.5)\n        else:\n            # 'line': above patches, below lines\n            self._wcsaxesartist.set_zorder(1.5)\n\n        # We need to make sure that that frame path is up to date\n        self.coords.frame._update_patch_path()\n\n        super().draw(renderer, **kwargs)\n\n        self._drawn = True\n\n    # Matplotlib internally sometimes calls set_xlabel(label=...).\n    def set_xlabel(self, xlabel=None, labelpad=1, loc=None, **kwargs):\n        \"\"\"Set x-label.\"\"\"\n        if xlabel is None:\n            xlabel = kwargs.pop('label', None)\n            if xlabel is None:\n                raise TypeError(\"set_xlabel() missing 1 required positional argument: 'xlabel'\")\n        for coord in self.coords:\n            if ('b' in coord.axislabels.get_visible_axes() or\n                'h' in coord.axislabels.get_visible_axes()):\n                coord.set_axislabel(xlabel, minpad=labelpad, **kwargs)\n                break\n\n    def set_ylabel(self, ylabel=None, labelpad=1, loc=None, **kwargs):\n        \"\"\"Set y-label\"\"\"\n        if ylabel is None:\n            ylabel = kwargs.pop('label', None)\n            if ylabel is None:\n                raise TypeError(\"set_ylabel() missing 1 required positional argument: 'ylabel'\")\n\n        if self.frame_class is RectangularFrame1D:\n            return super().set_ylabel(ylabel, labelpad=labelpad, **kwargs)\n\n        for coord in self.coords:\n            if ('l' in coord.axislabels.get_visible_axes() or\n                'c' in coord.axislabels.get_visible_axes()):\n                coord.set_axislabel(ylabel, minpad=labelpad, **kwargs)\n                break\n\n    def get_xlabel(self):\n        for coord in self.coords:\n            if ('b' in coord.axislabels.get_visible_axes() or\n                'h' in coord.axislabels.get_visible_axes()):\n                return coord.get_axislabel()\n\n    def get_ylabel(self):\n        if self.frame_class is RectangularFrame1D:\n            return super().get_ylabel()\n\n        for coord in self.coords:\n            if ('l' in coord.axislabels.get_visible_axes() or\n                'c' in coord.axislabels.get_visible_axes()):\n                return coord.get_axislabel()\n\n    def get_coords_overlay(self, frame, coord_meta=None):\n\n        # Here we can't use get_transform because that deals with\n        # pixel-to-pixel transformations when passing a WCS object.\n        if isinstance(frame, WCS):\n            transform, coord_meta = transform_coord_meta_from_wcs(frame, self.frame_class)\n        else:\n            transform = self._get_transform_no_transdata(frame)\n\n        if coord_meta is None:\n            coord_meta = get_coord_meta(frame)\n\n        coords = CoordinatesMap(self, transform=transform,\n                                coord_meta=coord_meta,\n                                frame_class=self.frame_class)\n\n        self._all_coords.append(coords)\n\n        # Common settings for overlay\n        coords[0].set_axislabel_position('t')\n        coords[1].set_axislabel_position('r')\n        coords[0].set_ticklabel_position('t')\n        coords[1].set_ticklabel_position('r')\n\n        self.overlay_coords = coords\n\n        return coords\n\n    def get_transform(self, frame):\n        \"\"\"\n        Return a transform from the specified frame to display coordinates.\n\n        This does not include the transData transformation\n\n        Parameters\n        ----------\n        frame : :class:`~astropy.wcs.WCS` or :class:`~matplotlib.transforms.Transform` or str\n            The ``frame`` parameter can have several possible types:\n                * :class:`~astropy.wcs.WCS` instance: assumed to be a\n                  transformation from pixel to world coordinates, where the\n                  world coordinates are the same as those in the WCS\n                  transformation used for this ``WCSAxes`` instance. This is\n                  used for example to show contours, since this involves\n                  plotting an array in pixel coordinates that are not the\n                  final data coordinate and have to be transformed to the\n                  common world coordinate system first.\n                * :class:`~matplotlib.transforms.Transform` instance: it is\n                  assumed to be a transform to the world coordinates that are\n                  part of the WCS used to instantiate this ``WCSAxes``\n                  instance.\n                * ``'pixel'`` or ``'world'``: return a transformation that\n                  allows users to plot in pixel/data coordinates (essentially\n                  an identity transform) and ``world`` (the default\n                  world-to-pixel transformation used to instantiate the\n                  ``WCSAxes`` instance).\n                * ``'fk5'`` or ``'galactic'``: return a transformation from\n                  the specified frame to the pixel/data coordinates.\n                * :class:`~astropy.coordinates.BaseCoordinateFrame` instance.\n        \"\"\"\n        return self._get_transform_no_transdata(frame).inverted() + self.transData\n\n    def _get_transform_no_transdata(self, frame):\n        \"\"\"\n        Return a transform from data to the specified frame\n        \"\"\"\n\n        if isinstance(frame, (BaseLowLevelWCS, BaseHighLevelWCS)):\n            if isinstance(frame, BaseHighLevelWCS):\n                frame = frame.low_level_wcs\n\n            transform, coord_meta = transform_coord_meta_from_wcs(frame, self.frame_class)\n            transform_world2pixel = transform.inverted()\n\n            if self._transform_pixel2world.frame_out == transform_world2pixel.frame_in:\n\n                return self._transform_pixel2world + transform_world2pixel\n\n            else:\n\n                return (self._transform_pixel2world +\n                        CoordinateTransform(self._transform_pixel2world.frame_out,\n                                            transform_world2pixel.frame_in) +\n                        transform_world2pixel)\n\n        elif isinstance(frame, str) and frame == 'pixel':\n\n            return Affine2D()\n\n        elif isinstance(frame, Transform):\n\n            return self._transform_pixel2world + frame\n\n        else:\n\n            if isinstance(frame, str) and frame == 'world':\n\n                return self._transform_pixel2world\n\n            else:\n\n                coordinate_transform = CoordinateTransform(self._transform_pixel2world.frame_out, frame)\n\n                if coordinate_transform.same_frames:\n                    return self._transform_pixel2world\n                else:\n                    return self._transform_pixel2world + coordinate_transform\n\n    def get_tightbbox(self, renderer, *args, **kwargs):\n\n        # FIXME: we should determine what to do with the extra arguments here.\n        # Note that the expected signature of this method is different in\n        # Matplotlib 3.x compared to 2.x, but we only support 3.x now.\n\n        if not self.get_visible():\n            return\n\n        bb = [b for b in self._bboxes if b and (b.width != 0 or b.height != 0)]\n        bb.append(super().get_tightbbox(renderer, *args, **kwargs))\n\n        if bb:\n            _bbox = Bbox.union(bb)\n            return _bbox\n        else:\n            return self.get_window_extent(renderer)\n\n    def grid(self, b=None, axis='both', *, which='major', **kwargs):\n        \"\"\"\n        Plot gridlines for both coordinates.\n\n        Standard matplotlib appearance options (color, alpha, etc.) can be\n        passed as keyword arguments. This behaves like `matplotlib.axes.Axes`\n        except that if no arguments are specified, the grid is shown rather\n        than toggled.\n\n        Parameters\n        ----------\n        b : bool\n            Whether to show the gridlines.\n        axis : 'both', 'x', 'y'\n            Which axis to turn the gridlines on/off for.\n        which : str\n            Currently only ``'major'`` is supported.\n        \"\"\"\n\n        if not hasattr(self, 'coords'):\n            return\n\n        if which != 'major':\n            raise NotImplementedError('Plotting the grid for the minor ticks is '\n                                      'not supported.')\n\n        if axis == 'both':\n            self.coords.grid(draw_grid=b, **kwargs)\n        elif axis == 'x':\n            self.coords[0].grid(draw_grid=b, **kwargs)\n        elif axis == 'y':\n            self.coords[1].grid(draw_grid=b, **kwargs)\n        else:\n            raise ValueError('axis should be one of x/y/both')\n\n    def tick_params(self, axis='both', **kwargs):\n        \"\"\"\n        Method to set the tick and tick label parameters in the same way as the\n        :meth:`~matplotlib.axes.Axes.tick_params` method in Matplotlib.\n\n        This is provided for convenience, but the recommended API is to use\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticks`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticklabel`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticks_position`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticklabel_position`,\n        and :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.grid`.\n\n        Parameters\n        ----------\n        axis : int or str, optional\n            Which axis to apply the parameters to. This defaults to 'both'\n            but this can also be set to an `int` or `str` that refers to the\n            axis to apply it to, following the valid values that can index\n            ``ax.coords``. Note that ``'x'`` and ``'y``' are also accepted in\n            the case of rectangular axes.\n        which : {'both', 'major', 'minor'}, optional\n            Which ticks to apply the settings to. By default, setting are\n            applied to both major and minor ticks. Note that if ``'minor'`` is\n            specified, only the length of the ticks can be set currently.\n        direction : {'in', 'out'}, optional\n            Puts ticks inside the axes, or outside the axes.\n        length : float, optional\n            Tick length in points.\n        width : float, optional\n            Tick width in points.\n        color : color, optional\n            Tick color (accepts any valid Matplotlib color)\n        pad : float, optional\n            Distance in points between tick and label.\n        labelsize : float or str, optional\n            Tick label font size in points or as a string (e.g., 'large').\n        labelcolor : color, optional\n            Tick label color (accepts any valid Matplotlib color)\n        colors : color, optional\n            Changes the tick color and the label color to the same value\n             (accepts any valid Matplotlib color).\n        bottom, top, left, right : bool, optional\n            Where to draw the ticks. Note that this can only be given if a\n            specific coordinate is specified via the ``axis`` argument, and it\n            will not work correctly if the frame is not rectangular.\n        labelbottom, labeltop, labelleft, labelright : bool, optional\n            Where to draw the tick labels. Note that this can only be given if a\n            specific coordinate is specified via the ``axis`` argument, and it\n            will not work correctly if the frame is not rectangular.\n        grid_color : color, optional\n            The color of the grid lines (accepts any valid Matplotlib color).\n        grid_alpha : float, optional\n            Transparency of grid lines: 0 (transparent) to 1 (opaque).\n        grid_linewidth : float, optional\n            Width of grid lines in points.\n        grid_linestyle : str, optional\n            The style of the grid lines (accepts any valid Matplotlib line\n            style).\n        \"\"\"\n\n        if not hasattr(self, 'coords'):\n            # Axes haven't been fully initialized yet, so just ignore, as\n            # Axes.__init__ calls this method\n            return\n\n        if axis == 'both':\n\n            for pos in ('bottom', 'left', 'top', 'right'):\n                if pos in kwargs:\n                    raise ValueError(f\"Cannot specify {pos}= when axis='both'\")\n                if 'label' + pos in kwargs:\n                    raise ValueError(f\"Cannot specify label{pos}= when axis='both'\")\n\n            for coord in self.coords:\n                coord.tick_params(**kwargs)\n\n        elif axis in self.coords:\n\n            self.coords[axis].tick_params(**kwargs)\n\n        elif axis in ('x', 'y') and self.frame_class is RectangularFrame:\n\n            spine = 'b' if axis == 'x' else 'l'\n\n            for coord in self.coords:\n                if spine in coord.axislabels.get_visible_axes():\n                    coord.tick_params(**kwargs)"},{"col":4,"comment":"\n        ","endLoc":127,"header":"def __init__(self, fig, rect, wcs=None, transform=None, coord_meta=None,\n                 transData=None, slices=None, frame_class=None,\n                 **kwargs)","id":16631,"name":"__init__","nodeType":"Function","startLoc":97,"text":"def __init__(self, fig, rect, wcs=None, transform=None, coord_meta=None,\n                 transData=None, slices=None, frame_class=None,\n                 **kwargs):\n        \"\"\"\n        \"\"\"\n\n        super().__init__(fig, rect, **kwargs)\n        self._bboxes = []\n\n        if frame_class is not None:\n            self.frame_class = frame_class\n        elif (wcs is not None and (wcs.pixel_n_dim == 1 or\n                                   (slices is not None and 'y' not in slices))):\n            self.frame_class = RectangularFrame1D\n        else:\n            self.frame_class = RectangularFrame\n\n        if not (transData is None):\n            # User wants to override the transform for the final\n            # data->pixel mapping\n            self.transData = transData\n\n        self.reset_wcs(wcs=wcs, slices=slices, transform=transform, coord_meta=coord_meta)\n        self._hide_parent_artists()\n        self.format_coord = self._display_world_coords\n        self._display_coords_index = 0\n        fig.canvas.mpl_connect('key_press_event', self._set_cursor_prefs)\n        self.patch = self.coords.frame.patch\n        self._wcsaxesartist = _WCSAxesArtist()\n        self.add_artist(self._wcsaxesartist)\n        self._drawn = False"},{"id":16632,"name":"cextern/cfitsio/lib","nodeType":"Package"},{"id":16633,"name":"putcolu.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, putcolu.c, contains routines that write data elements to    */\n/*  a FITS image or table.  Writes null values.                            */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffppru( fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,      /* I - group to write(1 = 1st group)          */\n            LONGLONG  firstelem,  /* I - first vector element to write(1 = 1st) */\n            LONGLONG  nelem,      /* I - number of values to write              */\n            int  *status)     /* IO - error status                          */\n/*\n  Write null values to the primary array.\n\n*/\n{\n    long row;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        ffpmsg(\"writing to compressed image is not supported\");\n\n        return(*status = DATA_COMPRESSION_ERR);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpclu(fptr, 2, row, firstelem, nelem, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpprn( fitsfile *fptr,  /* I - FITS file pointer                       */\n            LONGLONG  firstelem,  /* I - first vector element to write(1 = 1st) */\n            LONGLONG  nelem,      /* I - number of values to write              */\n            int  *status)     /* IO - error status                          */\n/*\n  Write null values to the primary array. (Doesn't support groups).\n\n*/\n{\n    long row = 1;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        ffpmsg(\"writing to compressed image is not supported\");\n\n        return(*status = DATA_COMPRESSION_ERR);\n    }\n\n    ffpclu(fptr, 2, row, firstelem, nelem, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpclu( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelempar,     /* I - number of values to write               */\n            int  *status)    /* IO - error status                           */\n/*\n  Set elements of a table column to the appropriate null value for the column\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer to a virtual column in a 1 or more grouped FITS primary\n  array.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n  \n  This routine support COMPLEX and DOUBLE COMPLEX binary table columns, and\n  sets both the real and imaginary components of the element to a NaN.\n*/\n{\n    int tcode, maxelem, hdutype, writemode = 2, leng;\n    short i2null;\n    INT32BIT i4null;\n    long twidth, incre;\n    LONGLONG ii;\n    LONGLONG largeelem, nelem, tnull, i8null;\n    LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, ntodo;\n    double scale, zero;\n    unsigned char i1null, lognul = 0;\n    char tform[20], *cstring = 0;\n    char message[FLEN_ERRMSG];\n    char snull[20];   /*  the FITS null value  */\n    long   jbuff[2] = { -1, -1};  /* all bits set is equivalent to a NaN */\n    size_t buffsize;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    nelem = nelempar;\n    \n    largeelem = firstelem;\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n\n    /* note that writemode = 2 by default (not 1), so that the returned */\n    /* repeat and incre values will be the actual values for this column. */\n\n    /* If writing nulls to a variable length column then dummy data values  */\n    /* must have already been written to the heap. */\n    /* We just have to overwrite the previous values with null values. */\n    /* Set writemode = 0 in this case, to test that values have been written */\n\n    fits_get_coltype(fptr, colnum, &tcode, NULL, NULL, status);\n    if (tcode < 0)\n         writemode = 0;  /* this is a variable length column */\n\n    if (abs(tcode) >= TCOMPLEX)\n    { /* treat complex columns as pairs of numbers */\n      largeelem = (largeelem - 1) * 2 + 1;\n      nelem *= 2;\n    }\n\n    if (ffgcprll( fptr, colnum, firstrow, largeelem, nelem, writemode, &scale,\n       &zero, tform, &twidth, &tcode, &maxelem, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n\n    if (tcode == TSTRING)\n    {\n      if (snull[0] == ASCII_NULL_UNDEFINED)\n      {\n        ffpmsg(\n        \"Null value string for ASCII table column is not defined (FTPCLU).\");\n        return(*status = NO_NULL);\n      }\n\n      /* allocate buffer to hold the null string.  Must write the entire */\n      /* width of the column (twidth bytes) to avoid possible problems */\n      /* with uninitialized FITS blocks, in case the field spans blocks */\n\n      buffsize = maxvalue(20, twidth);\n      cstring = (char *) malloc(buffsize);\n      if (!cstring)\n         return(*status = MEMORY_ALLOCATION);\n\n      memset(cstring, ' ', buffsize);  /* initialize  with blanks */\n\n      leng = strlen(snull);\n      if (hdutype == BINARY_TBL)\n         leng++;        /* copy the terminator too in binary tables */\n\n      strncpy(cstring, snull, leng);  /* copy null string to temp buffer */\n    }\n    else if ( tcode == TBYTE  ||\n              tcode == TSHORT ||\n              tcode == TLONG  ||\n              tcode == TLONGLONG) \n    {\n      if (tnull == NULL_UNDEFINED)\n      {\n        ffpmsg(\n        \"Null value for integer table column is not defined (FTPCLU).\");\n        return(*status = NO_NULL);\n      }\n\n      if (tcode == TBYTE)\n         i1null = (unsigned char) tnull;\n      else if (tcode == TSHORT)\n      {\n         i2null = (short) tnull;\n#if BYTESWAPPED\n         ffswap2(&i2null, 1); /* reverse order of bytes */\n#endif\n      }\n      else if (tcode == TLONG)\n      {\n         i4null = (INT32BIT) tnull;\n#if BYTESWAPPED\n         ffswap4(&i4null, 1); /* reverse order of bytes */\n#endif\n      }\n      else\n      {\n         i8null = tnull;\n#if BYTESWAPPED\n         ffswap8((double *)(&i8null), 1);  /* reverse order of bytes */\n#endif\n      }\n    }\n\n    /*---------------------------------------------------------------------*/\n    /*  Now write the pixels to the FITS column.                           */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to write  */\n    next = 0;                 /* next element in array to be written  */\n    rownum = 0;               /* row number, relative to firstrow     */\n    ntodo = remain;           /* number of elements to write at one time */\n\n    while (ntodo)\n    {\n        /* limit the number of pixels to process at one time to the number that\n           will fit in the buffer space or to the number of pixels that remain\n           in the current vector, which ever is smaller.\n        */\n        ntodo = minvalue(ntodo, (repeat - elemnum));\n        wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre);\n\n        ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */\n\n        switch (tcode) \n        {\n            case (TBYTE):\n \n                for (ii = 0; ii < ntodo; ii++)\n                  ffpbyt(fptr, 1,  &i1null, status);\n                break;\n\n            case (TSHORT):\n\n                for (ii = 0; ii < ntodo; ii++)\n                  ffpbyt(fptr, 2, &i2null, status);\n                break;\n\n            case (TLONG):\n\n                for (ii = 0; ii < ntodo; ii++)\n                  ffpbyt(fptr, 4, &i4null, status);\n                break;\n\n            case (TLONGLONG):\n\n                for (ii = 0; ii < ntodo; ii++)\n                  ffpbyt(fptr, 8, &i8null, status);\n                break;\n\n            case (TFLOAT):\n\n                for (ii = 0; ii < ntodo; ii++)\n                  ffpbyt(fptr, 4, jbuff, status);\n                break;\n\n            case (TDOUBLE):\n\n                for (ii = 0; ii < ntodo; ii++)\n                  ffpbyt(fptr, 8, jbuff, status);\n                break;\n\n            case (TLOGICAL):\n \n                for (ii = 0; ii < ntodo; ii++)\n                  ffpbyt(fptr, 1, &lognul, status);\n                break;\n\n            case (TSTRING):  /* an ASCII table column */\n                /* repeat always = 1, so ntodo is also guaranteed to = 1 */\n                ffpbyt(fptr, twidth, cstring, status);\n                break;\n\n            default:  /*  error trap  */\n                snprintf(message,FLEN_ERRMSG, \n                   \"Cannot write null value to column %d which has format %s\",\n                     colnum,tform);\n                ffpmsg(message);\n                return(*status);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous write operation */\n        {\n           snprintf(message,FLEN_ERRMSG,\n             \"Error writing %.0f thru %.0f of null values (ffpclu).\",\n              (double) (next+1), (double) (next+ntodo));\n           ffpmsg(message);\n\n           if (cstring)\n              free(cstring);\n\n           return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum += ntodo;\n            if (elemnum == repeat)  /* completed a row; start on next row */\n            {\n                elemnum = 0;\n                rownum++;\n            }\n        }\n        ntodo = remain;  /* this is the maximum number to do in next loop */\n\n    }  /*  End of main while Loop  */\n\n    if (cstring)\n       free(cstring);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcluc( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            int  *status)    /* IO - error status                           */\n/*\n  Set elements of a table column to the appropriate null value for the column\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer to a virtual column in a 1 or more grouped FITS primary\n  array.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n  \n  This routine does not do anything special in the case of COMPLEX table columns\n  (unlike the similar ffpclu routine).  This routine is mainly for use by\n  ffpcne which already compensates for the effective doubling of the number of \n  elements in a complex column.\n*/\n{\n    int tcode, maxelem, hdutype, writemode = 2, leng;\n    short i2null;\n    INT32BIT i4null;\n    long twidth, incre;\n    LONGLONG ii;\n    LONGLONG tnull, i8null;\n    LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, ntodo;\n    double scale, zero;\n    unsigned char i1null, lognul = 0;\n    char tform[20], *cstring = 0;\n    char message[FLEN_ERRMSG];\n    char snull[20];   /*  the FITS null value  */\n    long   jbuff[2] = { -1, -1};  /* all bits set is equivalent to a NaN */\n    size_t buffsize;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n\n    /* note that writemode = 2 by default (not 1), so that the returned */\n    /* repeat and incre values will be the actual values for this column. */\n\n    /* If writing nulls to a variable length column then dummy data values  */\n    /* must have already been written to the heap. */\n    /* We just have to overwrite the previous values with null values. */\n    /* Set writemode = 0 in this case, to test that values have been written */\n\n    fits_get_coltype(fptr, colnum, &tcode, NULL, NULL, status);\n    if (tcode < 0)\n         writemode = 0;  /* this is a variable length column */\n    \n    if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, writemode, &scale,\n       &zero, tform, &twidth, &tcode, &maxelem, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n\n    if (tcode == TSTRING)\n    {\n      if (snull[0] == ASCII_NULL_UNDEFINED)\n      {\n        ffpmsg(\n        \"Null value string for ASCII table column is not defined (FTPCLU).\");\n        return(*status = NO_NULL);\n      }\n\n      /* allocate buffer to hold the null string.  Must write the entire */\n      /* width of the column (twidth bytes) to avoid possible problems */\n      /* with uninitialized FITS blocks, in case the field spans blocks */\n\n      buffsize = maxvalue(20, twidth);\n      cstring = (char *) malloc(buffsize);\n      if (!cstring)\n         return(*status = MEMORY_ALLOCATION);\n\n      memset(cstring, ' ', buffsize);  /* initialize  with blanks */\n\n      leng = strlen(snull);\n      if (hdutype == BINARY_TBL)\n         leng++;        /* copy the terminator too in binary tables */\n\n      strncpy(cstring, snull, leng);  /* copy null string to temp buffer */\n\n    }\n    else if ( tcode == TBYTE  ||\n              tcode == TSHORT ||\n              tcode == TLONG  ||\n              tcode == TLONGLONG) \n    {\n      if (tnull == NULL_UNDEFINED)\n      {\n        ffpmsg(\n        \"Null value for integer table column is not defined (FTPCLU).\");\n        return(*status = NO_NULL);\n      }\n\n      if (tcode == TBYTE)\n         i1null = (unsigned char) tnull;\n      else if (tcode == TSHORT)\n      {\n         i2null = (short) tnull;\n#if BYTESWAPPED\n         ffswap2(&i2null, 1); /* reverse order of bytes */\n#endif\n      }\n      else if (tcode == TLONG)\n      {\n         i4null = (INT32BIT) tnull;\n#if BYTESWAPPED\n         ffswap4(&i4null, 1); /* reverse order of bytes */\n#endif\n      }\n      else\n      {\n         i8null = tnull;\n#if BYTESWAPPED\n         ffswap8((double *)(&i8null), 1);  /* reverse order of bytes */\n#endif\n      }\n    }\n\n    /*---------------------------------------------------------------------*/\n    /*  Now write the pixels to the FITS column.                           */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to write  */\n    next = 0;                 /* next element in array to be written  */\n    rownum = 0;               /* row number, relative to firstrow     */\n    ntodo = remain;           /* number of elements to write at one time */\n\n    while (ntodo)\n    {\n        /* limit the number of pixels to process at one time to the number that\n           will fit in the buffer space or to the number of pixels that remain\n           in the current vector, which ever is smaller.\n        */\n        ntodo = minvalue(ntodo, (repeat - elemnum));\n        wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre);\n\n        ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */\n\n        switch (tcode) \n        {\n            case (TBYTE):\n \n                for (ii = 0; ii < ntodo; ii++)\n                  ffpbyt(fptr, 1,  &i1null, status);\n                break;\n\n            case (TSHORT):\n\n                for (ii = 0; ii < ntodo; ii++)\n                  ffpbyt(fptr, 2, &i2null, status);\n                break;\n\n            case (TLONG):\n\n                for (ii = 0; ii < ntodo; ii++)\n                  ffpbyt(fptr, 4, &i4null, status);\n                break;\n\n            case (TLONGLONG):\n\n                for (ii = 0; ii < ntodo; ii++)\n                  ffpbyt(fptr, 8, &i8null, status);\n                break;\n\n            case (TFLOAT):\n\n                for (ii = 0; ii < ntodo; ii++)\n                  ffpbyt(fptr, 4, jbuff, status);\n                break;\n\n            case (TDOUBLE):\n\n                for (ii = 0; ii < ntodo; ii++)\n                  ffpbyt(fptr, 8, jbuff, status);\n                break;\n\n            case (TLOGICAL):\n \n                for (ii = 0; ii < ntodo; ii++)\n                  ffpbyt(fptr, 1, &lognul, status);\n                break;\n\n            case (TSTRING):  /* an ASCII table column */\n                /* repeat always = 1, so ntodo is also guaranteed to = 1 */\n                ffpbyt(fptr, twidth, cstring, status);\n                break;\n\n            default:  /*  error trap  */\n                snprintf(message, FLEN_ERRMSG,\n                   \"Cannot write null value to column %d which has format %s\",\n                     colnum,tform);\n                ffpmsg(message);\n                return(*status);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous write operation */\n        {\n           snprintf(message,FLEN_ERRMSG,\n             \"Error writing %.0f thru %.0f of null values (ffpclu).\",\n              (double) (next+1), (double) (next+ntodo));\n           ffpmsg(message);\n\n           if (cstring)\n              free(cstring);\n\n           return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum += ntodo;\n            if (elemnum == repeat)  /* completed a row; start on next row */\n            {\n                elemnum = 0;\n                rownum++;\n            }\n        }\n        ntodo = remain;  /* this is the maximum number to do in next loop */\n\n    }  /*  End of main while Loop  */\n\n    if (cstring)\n       free(cstring);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffprwu(fitsfile *fptr,\n           LONGLONG firstrow,\n           LONGLONG nrows, \n           int *status)\n\n/* \n * fits_write_nullrows / ffprwu - write TNULLs to all columns in one or more rows\n *\n * fitsfile *fptr - pointer to FITS HDU opened for read/write\n * long int firstrow - first table row to set to null. (firstrow >= 1)\n * long int nrows - total number or rows to set to null. (nrows >= 1)\n * int *status - upon return, *status contains CFITSIO status code\n *\n * RETURNS: CFITSIO status code\n *\n * written by Craig Markwardt, GSFC \n */\n{\n  LONGLONG ntotrows;\n  int ncols, i;\n  int typecode = 0;\n  LONGLONG repeat = 0, width = 0;\n  int nullstatus;\n\n  if (*status > 0) return *status;\n\n  if ((firstrow <= 0) || (nrows <= 0)) return (*status = BAD_ROW_NUM);\n\n  fits_get_num_rowsll(fptr, &ntotrows, status);\n\n  if (firstrow + nrows - 1 > ntotrows) return (*status = BAD_ROW_NUM);\n  \n  fits_get_num_cols(fptr, &ncols, status);\n  if (*status) return *status;\n\n\n  /* Loop through each column and write nulls */\n  for (i=1; i <= ncols; i++) {\n    repeat = 0;  typecode = 0;  width = 0;\n    fits_get_coltypell(fptr, i, &typecode, &repeat, &width, status);\n    if (*status) break;\n\n    /* NOTE: data of TSTRING type must not write the total repeat\n       count, since the repeat count is the *character* count, not the\n       nstring count.  Divide by string width to get number of\n       strings. */\n    \n    if (typecode == TSTRING) repeat /= width;\n\n    /* Write NULLs */\n    nullstatus = 0;\n    fits_write_col_null(fptr, i, firstrow, 1, repeat*nrows, &nullstatus);\n\n    /* ignore error if no null value is defined for the column */\n    if (nullstatus && nullstatus != NO_NULL) return (*status = nullstatus);\n    \n  }\n    \n  return *status;\n}\n\n"},{"id":16634,"name":"getcoluk.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, getcolk.c, contains routines that read data elements from   */\n/*  a FITS image or table, with 'unsigned int' data type.                  */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <math.h>\n#include <stdlib.h>\n#include <limits.h>\n#include <string.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffgpvuk( fitsfile *fptr,   /* I - FITS file pointer                      */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n   unsigned int   nulval,     /* I - value for undefined pixels              */\n   unsigned int   *array,     /* O - array of values that are returned       */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Undefined elements will be set equal to NULVAL, unless NULVAL=0\n  in which case no checking for undefined values will be performed.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    char cdummy;\n    int nullcheck = 1;\n    unsigned int nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n         nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_pixels(fptr, TUINT, firstelem, nelem,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcluk(fptr, 2, row, firstelem, nelem, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgpfuk(fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n   unsigned int   *array,     /* O - array of values that are returned       */\n            char *nularray,   /* O - array of null pixel flags               */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Any undefined pixels in the returned array will be set = 0 and the \n  corresponding nularray value will be set = 1.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    int nullcheck = 2;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_read_compressed_pixels(fptr, TUINT, firstelem, nelem,\n            nullcheck, NULL, array, nularray, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcluk(fptr, 2, row, firstelem, nelem, 1, 2, 0L,\n               array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg2duk(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n  unsigned int  nulval,    /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n  unsigned int  *array,    /* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    /* call the 3D reading routine, with the 3rd dimension = 1 */\n\n    ffg3duk(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, \n           anynul, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg3duk(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n  unsigned int   nulval,    /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  nrows,     /* I - number of rows in each plane of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           LONGLONG  naxis3,    /* I - FITS image NAXIS3 value                 */\n  unsigned int   *array,    /* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 3-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    long tablerow, ii, jj;\n    char cdummy;\n    int nullcheck = 1;\n    long inc[] = {1,1,1};\n    LONGLONG fpixel[] = {1,1,1}, nfits, narray;\n    LONGLONG lpixel[3];\n    unsigned int nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        lpixel[0] = ncols;\n        lpixel[1] = nrows;\n        lpixel[2] = naxis3;\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TUINT, fpixel, lpixel, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n       /* all the image pixels are contiguous, so read all at once */\n       ffgcluk(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n       return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to read */\n    narray = 0;  /* next pixel in output array to be filled */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* reading naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffgcluk(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval,\n          &array[narray], &cdummy, anynul, status) > 0)\n          return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsvuk(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n  unsigned int  nulval,    /* I - value to set undefined pixels             */\n  unsigned int  *array,    /* O - array to be filled and returned           */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9];\n    long nelem, nultyp, ninc, numcol;\n    LONGLONG felem, dsize[10], blcll[9], trcll[9];\n    int hdutype, anyf;\n    char ldummy, msg[FLEN_ERRMSG];\n    int nullcheck = 1;\n    unsigned int nullvalue;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvuk is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TUINT, blcll, trcll, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 1;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        snprintf(msg, FLEN_ERRMSG,\"ffgsvuk: illegal range specified for axis %ld\", ii + 1);\n        ffpmsg(msg);\n        return(*status = BAD_PIX_NUM);\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n    }\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0] - str[0]) / inc[0] + 1;\n      ninc = incr[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1])\n            {\n              felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + \n                             (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] +\n                             (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] +\n                             (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8];\n\n              if ( ffgcluk(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &ldummy, &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsfuk(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n  unsigned int  *array,    /* O - array to be filled and returned           */\n           char *flagval,  /* O - set to 1 if corresponding value is null   */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dsize[10];\n    LONGLONG blcll[9], trcll[9];\n    long felem, nelem, nultyp, ninc, numcol;\n    long nulval = 0;\n    int hdutype, anyf;\n    char msg[FLEN_ERRMSG];\n    int nullcheck = 2;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvj is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        fits_read_compressed_img(fptr, TUINT, blcll, trcll, inc,\n            nullcheck, NULL, array, flagval, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 2;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        snprintf(msg, FLEN_ERRMSG,\"ffgsvj: illegal range specified for axis %ld\", ii + 1);\n        ffpmsg(msg);\n        return(*status = BAD_PIX_NUM);\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n    }\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0] - str[0]) / inc[0] + 1;\n      ninc = incr[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1])\n            {\n              felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + \n                             (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] +\n                             (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] +\n                             (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8];\n\n              if ( ffgcluk(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &flagval[i0], &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffggpuk( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            long  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            long  nelem,      /* I - number of values to read                */\n   unsigned int  *array,     /* O - array of values that are returned       */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of group parameters from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n*/\n{\n    long row;\n    int idummy;\n    char cdummy;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcluk(fptr, 1, row, firstelem, nelem, 1, 1, 0L,\n               array, &cdummy, &idummy, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcvuk(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n  unsigned int   nulval,     /* I - value for null pixels                   */\n  unsigned int  *array,      /* O - array of values that are read           */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Any undefined pixels will be set equal to the value of 'nulval' unless\n  nulval = 0 in which case no checks for undefined pixels will be made.\n*/\n{\n    char cdummy;\n\n    ffgcluk(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval,\n           array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcfuk(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n  unsigned int   *array,     /* O - array of values that are read           */\n           char *nularray,   /* O - array of flags: 1 if null pixel; else 0 */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Nularray will be set = 1 if the corresponding array pixel is undefined, \n  otherwise nularray will = 0.\n*/\n{\n    int dummy = 0;\n\n    ffgcluk(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy,\n           array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcluk( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            long  elemincre,  /* I - pixel increment; e.g., 2 = every other  */\n            int   nultyp,     /* I - null value handling code:               */\n                              /*     1: set undefined pixels = nulval        */\n                              /*     2: set nularray=1 for undefined pixels  */\n   unsigned int   nulval,     /* I - value for null pixels if nultyp = 1     */\n   unsigned int  *array,      /* O - array of values that are read           */\n            char *nularray,   /* O - array of flags = 1 if nultyp = 2        */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer be a virtual column in a 1 or more grouped FITS primary\n  array or image extension.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The output array of values will be converted from the datatype of the column \n  and will be scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    double scale, zero, power = 1., dtemp;\n    int tcode, maxelem2, hdutype, xcode, decimals;\n    long twidth, incre;\n    long ii, xwidth, ntodo;\n    int nulcheck;\n    LONGLONG repeat, startpos, elemnum, readptr, tnull;\n    LONGLONG rowlen, rownum, remain, next, rowincre, maxelem;\n    char tform[20];\n    char message[FLEN_ERRMSG];\n    char snull[20];   /*  the FITS null value if reading from ASCII table  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0 || nelem == 0)  /* inherit input status value if > 0 */\n        return(*status);\n\n    /* call the 'short' or 'long' version of this routine, if possible */\n    if (sizeof(int) == sizeof(short))\n        ffgclui(fptr, colnum, firstrow, firstelem, nelem, elemincre, nultyp,\n          (unsigned short) nulval, (unsigned short *) array, nularray, anynul,\n           status);\n    else if (sizeof(int) == sizeof(long))\n        ffgcluj(fptr, colnum, firstrow, firstelem, nelem, elemincre, nultyp,\n          (unsigned long) nulval, (unsigned long *) array, nularray, anynul,\n          status);\n    else\n    {\n    /*\n      This is a special case: sizeof(int) is not equal to sizeof(short) or\n      sizeof(long).  This occurs on Alpha OSF systems where short = 2 bytes,\n      int = 4 bytes, and long = 8 bytes.\n    */\n\n    buffer = cbuff;\n\n    if (anynul)\n        *anynul = 0;\n\n    if (nultyp == 2)\n        memset(nularray, 0, (size_t) nelem);   /* initialize nullarray */\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if ( ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 0, &scale, &zero,\n         tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre,\n         &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 )\n         return(*status);\n    maxelem = maxelem2;\n\n    incre *= elemincre;   /* multiply incre to just get every nth pixel */\n\n    if (tcode == TSTRING)    /* setup for ASCII tables */\n    {\n      /* get the number of implied decimal places if no explicit decmal point */\n      ffasfm(tform, &xcode, &xwidth, &decimals, status); \n      for(ii = 0; ii < decimals; ii++)\n        power *= 10.;\n    }\n    /*------------------------------------------------------------------*/\n    /*  Decide whether to check for null values in the input FITS file: */\n    /*------------------------------------------------------------------*/\n    nulcheck = nultyp; /* by default check for null values in the FITS file */\n\n    if (nultyp == 1 && nulval == 0)\n       nulcheck = 0;    /* calling routine does not want to check for nulls */\n\n    else if (tcode%10 == 1 &&        /* if reading an integer column, and  */ \n            tnull == NULL_UNDEFINED) /* if a null value is not defined,    */\n            nulcheck = 0;            /* then do not check for null values. */\n\n    else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TBYTE && (tnull > 255 || tnull < 0) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED)\n         nulcheck = 0;\n\n    /*----------------------------------------------------------------------*/\n    /*  If FITS column and output data array have same datatype, then we do */\n    /*  not need to use a temporary buffer to store intermediate datatype.  */\n    /*----------------------------------------------------------------------*/\n    if (tcode == TLONG)  /* Special Case: */\n    {                             /* data are 4-bytes long, so read       */\n                                  /* data directly into output buffer.    */\n\n        if (nelem < (LONGLONG)INT32_MAX/4) {\n            maxelem = nelem;\n        } else {\n            maxelem = INT32_MAX/4;\n        }\n    }\n\n    /*---------------------------------------------------------------------*/\n    /*  Now read the pixels from the FITS column. If the column does not   */\n    /*  have the same datatype as the output array, then we have to read   */\n    /*  the raw values into a temporary buffer (of limited size).  In      */\n    /*  the case of a vector colum read only 1 vector of values at a time  */\n    /*  then skip to the next row if more values need to be read.          */\n    /*  After reading the raw values, then call the fffXXYY routine to (1) */\n    /*  test for undefined values, (2) convert the datatype if necessary,  */\n    /*  and (3) scale the values by the FITS TSCALn and TZEROn linear      */\n    /*  scaling parameters.                                                */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to read */\n    next = 0;                 /* next element in array to be read   */\n    rownum = 0;               /* row number, relative to firstrow   */\n\n    while (remain)\n    {\n        /* limit the number of pixels to read at one time to the number that\n           will fit in the buffer or to the number of pixels that remain in\n           the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);      \n        ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1));\n\n        readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre));\n\n        switch (tcode) \n        {\n            case (TLONG):\n                ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) &array[next],\n                       status);\n                    fffi4uint((INT32BIT *) &array[next], ntodo, scale, zero, \n                           nulcheck, (INT32BIT) tnull, nulval, &nularray[next],\n                           anynul, &array[next], status);\n                break;\n            case (TLONGLONG):\n\n                ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status);\n                fffi8uint( (LONGLONG *) buffer, ntodo, scale, zero, \n                           nulcheck, tnull, nulval, &nularray[next], \n                            anynul, &array[next], status);\n                break;\n            case (TBYTE):\n                ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer,\n                       status);\n                fffi1uint((unsigned char *) buffer, ntodo, scale, zero,nulcheck,\n                     (unsigned char) tnull, nulval, &nularray[next], anynul, \n                     &array[next], status);\n                break;\n            case (TSHORT):\n                ffgi2b(fptr, readptr, ntodo, incre, (short  *) buffer, status);\n                fffi2uint((short  *) buffer, ntodo, scale, zero, nulcheck, \n                      (short) tnull, nulval, &nularray[next], anynul, \n                      &array[next], status);\n                break;\n            case (TFLOAT):\n                ffgr4b(fptr, readptr, ntodo, incre, (float  *) buffer, status);\n                fffr4uint((float  *) buffer, ntodo, scale, zero, nulcheck, \n                       nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TDOUBLE):\n                ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status);\n                fffr8uint((double *) buffer, ntodo, scale, zero, nulcheck, \n                          nulval, &nularray[next], anynul, \n                          &array[next], status);\n                break;\n            case (TSTRING):\n                ffmbyt(fptr, readptr, REPORT_EOF, status);\n       \n                if (incre == twidth)    /* contiguous bytes */\n                     ffgbyt(fptr, ntodo * twidth, buffer, status);\n                else\n                     ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                               status);\n\n                fffstruint((char *) buffer, ntodo, scale, zero, twidth, power,\n                     nulcheck, snull, nulval, &nularray[next], anynul,\n                     &array[next], status);\n                break;\n\n            default:  /*  error trap for invalid column format */\n                snprintf(message, FLEN_ERRMSG,\n                   \"Cannot read numbers from column %d which has format %s\",\n                    colnum, tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous read operation */\n        {\n\t  dtemp = (double) next;\n          if (hdutype > 0)\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgcluk).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from image (ffgcluk).\",\n              dtemp+1., dtemp+ntodo);\n\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum = elemnum + (ntodo * elemincre);\n\n            if (elemnum >= repeat)  /* completed a row; start on later row */\n            {\n                rowincre = elemnum / repeat;\n                rownum += rowincre;\n                elemnum = elemnum - (rowincre * repeat);\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while reading FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    }  /* end of DEC Alpha special case */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi1uint(unsigned char *input,/* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char tnull,  /* I - value of FITS TNULLn keyword if any */\n   unsigned int  nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned int  *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (unsigned int) input[ii];  /* copy input */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUINT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UINT_MAX;\n                }\n                else\n                    output[ii] = (unsigned int) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (unsigned int) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned int) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi2uint(short *input,        /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short tnull,          /* I - value of FITS TNULLn keyword if any */\n   unsigned int  nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned int  *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else\n                    output[ii] = (unsigned int) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUINT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UINT_MAX;\n                }\n                else\n                    output[ii] = (unsigned int) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    if (input[ii] < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else\n                        output[ii] = (unsigned int) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned int) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi4uint(INT32BIT *input,    /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            INT32BIT tnull,       /* I - value of FITS TNULLn keyword if any */\n   unsigned int  nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned int  *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 2147483648.)\n        {       \n           /* Instead of adding 2147483648, it is more efficient */\n           /* to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++)\n               output[ii] =  ( *(unsigned int *) &input[ii] ) ^ 0x80000000;\n        }\n        else if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else\n                    output[ii] = (unsigned int) input[ii]; /* copy to output */\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUINT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UINT_MAX;\n                }\n                else\n                    output[ii] = (unsigned int) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 2147483648.) \n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                   output[ii] =  ( *(unsigned int *) &input[ii] ) ^ 0x80000000;\n            }\n        }\n        else if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else if (input[ii] < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else\n                    output[ii] = (unsigned int) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned int) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi8uint(LONGLONG *input,    /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            LONGLONG tnull,       /* I - value of FITS TNULLn keyword if any */\n   unsigned int  nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned int  *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    ULONGLONG ulltemp;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of adding 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                if (ulltemp > UINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UINT_MAX;\n                }\n                else\n                    output[ii] = (unsigned int) ulltemp;\n            }\n        }\n        else if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (input[ii] > UINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UINT_MAX;\n                }\n                else\n                    output[ii] = (unsigned int) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUINT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UINT_MAX;\n                }\n                else\n                    output[ii] = (unsigned int) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of adding 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                    if (ulltemp > UINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT_MAX;\n                    }\n                    else\n\t\t    {\n                        output[ii] = (unsigned int) ulltemp;\n\t\t    }\n                }\n            }\n        }\n        else if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    if (input[ii] < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (input[ii] > UINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned int) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned int) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr4uint(float *input,        /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n   unsigned int  nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned int  *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DUINT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (input[ii] > DUINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UINT_MAX;\n                }\n                else\n                    output[ii] = (unsigned int) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUINT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UINT_MAX;\n                }\n                else\n                    output[ii] = (unsigned int) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr++;       /* point to MSBs */\n#endif\n\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DUINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (input[ii] > DUINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned int) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  { \n                    if (zero < DUINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (zero > DUINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT_MAX;\n                    }\n                    else\n                      output[ii] = (unsigned int) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned int) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr8uint(double *input,       /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n   unsigned int  nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned int  *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DUINT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (input[ii] > DUINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UINT_MAX;\n                }\n                else\n                    output[ii] = (unsigned int) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUINT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UINT_MAX;\n                }\n                else\n                    output[ii] = (unsigned int) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr += 3;       /* point to MSBs */\n#endif\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DUINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (input[ii] > DUINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned int) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  { \n                    if (zero < DUINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (zero > DUINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT_MAX;\n                    }\n                    else\n                      output[ii] = (unsigned int) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned int) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffstruint(char *input,        /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            long twidth,          /* I - width of each substring of chars    */\n            double implipower,    /* I - power of 10 of implied decimal      */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            char  *snull,         /* I - value of FITS null string, if any   */\n   unsigned int nullval,          /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned int *output,          /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file. Check\n  for null values and do scaling if required. The nullcheck code value\n  determines how any null values in the input array are treated. A null\n  value is an input pixel that is equal to snull.  If nullcheck= 0, then\n  no special checking for nulls is performed.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    int nullen;\n    long ii;\n    double dvalue;\n    char *cstring, message[FLEN_ERRMSG];\n    char *cptr, *tpos;\n    char tempstore, chrzero = '0';\n    double val, power;\n    int exponent, sign, esign, decpt;\n\n    nullen = strlen(snull);\n    cptr = input;  /* pointer to start of input string */\n    for (ii = 0; ii < ntodo; ii++)\n    {\n      cstring = cptr;\n      /* temporarily insert a null terminator at end of the string */\n      tpos = cptr + twidth;\n      tempstore = *tpos;\n      *tpos = 0;\n\n      /* check if null value is defined, and if the    */\n      /* column string is identical to the null string */\n      if (snull[0] != ASCII_NULL_UNDEFINED && \n         !strncmp(snull, cptr, nullen) )\n      {\n        if (nullcheck)  \n        {\n          *anynull = 1;    \n          if (nullcheck == 1)\n            output[ii] = nullval;\n          else\n            nullarray[ii] = 1;\n        }\n        cptr += twidth;\n      }\n      else\n      {\n        /* value is not the null value, so decode it */\n        /* remove any embedded blank characters from the string */\n\n        decpt = 0;\n        sign = 1;\n        val  = 0.;\n        power = 1.;\n        exponent = 0;\n        esign = 1;\n\n        while (*cptr == ' ')               /* skip leading blanks */\n           cptr++;\n\n        if (*cptr == '-' || *cptr == '+')  /* check for leading sign */\n        {\n          if (*cptr == '-')\n             sign = -1;\n\n          cptr++;\n\n          while (*cptr == ' ')         /* skip blanks between sign and value */\n            cptr++;\n        }\n\n        while (*cptr >= '0' && *cptr <= '9')\n        {\n          val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n          cptr++;\n\n          while (*cptr == ' ')         /* skip embedded blanks in the value */\n            cptr++;\n        }\n\n        if (*cptr == '.' || *cptr == ',')       /* check for decimal point */\n        {\n          decpt = 1;       /* set flag to show there was a decimal point */\n          cptr++;\n          while (*cptr == ' ')         /* skip any blanks */\n            cptr++;\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n            power = power * 10.;\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks in the value */\n              cptr++;\n          }\n        }\n\n        if (*cptr == 'E' || *cptr == 'D')  /* check for exponent */\n        {\n          cptr++;\n          while (*cptr == ' ')         /* skip blanks */\n              cptr++;\n  \n          if (*cptr == '-' || *cptr == '+')  /* check for exponent sign */\n          {\n            if (*cptr == '-')\n               esign = -1;\n\n            cptr++;\n\n            while (*cptr == ' ')        /* skip blanks between sign and exp */\n              cptr++;\n          }\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            exponent = exponent * 10 + *cptr - chrzero;  /* accumulate exp */\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks */\n              cptr++;\n          }\n        }\n\n        if (*cptr  != 0)  /* should end up at the null terminator */\n        {\n          snprintf(message, FLEN_ERRMSG,\"Cannot read number from ASCII table\");\n          ffpmsg(message);\n          snprintf(message, FLEN_ERRMSG,\"Column field = %s.\", cstring);\n          ffpmsg(message);\n          /* restore the char that was overwritten by the null */\n          *tpos = tempstore;\n          return(*status = BAD_C2D);\n        }\n\n        if (!decpt)  /* if no explicit decimal, use implied */\n           power = implipower;\n\n        dvalue = (sign * val / power) * pow(10., (double) (esign * exponent));\n\n        dvalue = dvalue * scale + zero;   /* apply the scaling */\n\n        if (dvalue < DUINT_MIN)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = 0;\n        }\n        else if (dvalue > DUINT_MAX)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = UINT_MAX;\n        }\n        else\n            output[ii] = (long) dvalue;\n      }\n      /* restore the char that was overwritten by the null */\n      *tpos = tempstore;\n    }\n    return(*status);\n}\n"},{"id":16635,"name":"grparser.h","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*\t\tT E M P L A T E   P A R S E R   H E A D E R   F I L E\n\t\t=====================================================\n\n\t\tby Jerzy.Borkowski@obs.unige.ch\n\n\t\tIntegral Science Data Center\n\t\tch. d'Ecogia 16\n\t\t1290 Versoix\n\t\tSwitzerland\n\n14-Oct-98: initial release\n16-Oct-98: reference to fitsio.h removed, also removed strings after #endif\n\t\tdirectives to make gcc -Wall not to complain\n20-Oct-98: added declarations NGP_XTENSION_SIMPLE and NGP_XTENSION_FIRST\n24-Oct-98: prototype of ngp_read_line() function updated.\n22-Jan-99: prototype for ngp_set_extver() function added.\n20-Jun-2002 Wm Pence, added support for the HIERARCH keyword convention\n            (changed NGP_MAX_NAME from (20) to FLEN_KEYWORD)\n*/\n\n#ifndef\tGRPARSER_H_INCLUDED\n#define\tGRPARSER_H_INCLUDED\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\t/* error codes  - now defined in fitsio.h */\n\n\t/* common constants definitions */\n\n#define\tNGP_ALLOCCHUNK\t\t(1000)\n#define\tNGP_MAX_INCLUDE\t\t(10)\t\t\t/* include file nesting limit */\n#define\tNGP_MAX_COMMENT\t\t(80)\t\t\t/* max size for comment */\n#define\tNGP_MAX_NAME\t\tFLEN_KEYWORD\t\t/* max size for KEYWORD (FITS limits it to 8 chars) */\n                                                        /* except HIERARCH can have longer effective keyword names */\n#define\tNGP_MAX_STRING\t\t(80)\t\t\t/* max size for various strings */\n#define\tNGP_MAX_ARRAY_DIM\t(999)\t\t\t/* max. number of dimensions in array */\n#define NGP_MAX_FNAME           (1000)                  /* max size of combined path+fname */\n#define\tNGP_MAX_ENVFILES\t(10000)\t\t\t/* max size of CFITSIO_INCLUDE_FILES env. variable */\n\n#define\tNGP_TOKEN_UNKNOWN\t(-1)\t\t\t/* token type unknown */\n#define\tNGP_TOKEN_INCLUDE\t(0)\t\t\t/* \\INCLUDE token */\n#define\tNGP_TOKEN_GROUP\t\t(1)\t\t\t/* \\GROUP token */\n#define\tNGP_TOKEN_END\t\t(2)\t\t\t/* \\END token */\n#define\tNGP_TOKEN_XTENSION\t(3)\t\t\t/* XTENSION token */\n#define\tNGP_TOKEN_SIMPLE\t(4)\t\t\t/* SIMPLE token */\n#define\tNGP_TOKEN_EOF\t\t(5)\t\t\t/* End Of File pseudo token */\n\n#define\tNGP_TTYPE_UNKNOWN\t(0)\t\t\t/* undef (yet) token type - invalid to print/write to disk */\n#define\tNGP_TTYPE_BOOL\t\t(1)\t\t\t/* boolean, it is 'T' or 'F' */\n#define\tNGP_TTYPE_STRING\t(2)\t\t\t/* something withing \"\" or starting with letter */\n#define\tNGP_TTYPE_INT\t\t(3)\t\t\t/* starting with digit and not with '.' */\n#define\tNGP_TTYPE_REAL\t\t(4)\t\t\t/* digits + '.' */\n#define\tNGP_TTYPE_COMPLEX\t(5)\t\t\t/* 2 reals, separated with ',' */\n#define\tNGP_TTYPE_NULL\t\t(6)\t\t\t/* NULL token, format is : NAME = / comment */\n#define\tNGP_TTYPE_RAW\t\t(7)\t\t\t/* HISTORY/COMMENT/8SPACES + comment string without / */\n\n#define\tNGP_FOUND_EQUAL_SIGN\t(1)\t\t\t/* line contains '=' after keyword name */\n\n#define\tNGP_FORMAT_OK\t\t(0)\t\t\t/* line format OK */\n#define\tNGP_FORMAT_ERROR\t(1)\t\t\t/* line format error */\n\n#define\tNGP_NODE_INVALID\t(0)\t\t\t/* default node type - invalid (to catch errors) */\n#define\tNGP_NODE_IMAGE\t\t(1)\t\t\t/* IMAGE type */\n#define\tNGP_NODE_ATABLE\t\t(2)\t\t\t/* ASCII table type */\n#define\tNGP_NODE_BTABLE\t\t(3)\t\t\t/* BINARY table type */\n\n#define\tNGP_NON_SYSTEM_ONLY\t(0)\t\t\t/* save all keywords except NAXIS,BITPIX,etc.. */\n#define\tNGP_REALLY_ALL\t\t(1)\t\t\t/* save really all keywords */\n\n#define\tNGP_XTENSION_SIMPLE\t(1)\t\t\t/* HDU defined with SIMPLE T */\n#define\tNGP_XTENSION_FIRST\t(2)\t\t\t/* this is first extension in template */\n\n#define\tNGP_LINE_REREAD\t\t(1)\t\t\t/* reread line */\n\n#define\tNGP_BITPIX_INVALID\t(-12345)\t\t/* default BITPIX (to catch errors) */\n\n\t/* common macro definitions */\n\n#ifdef\tNGP_PARSER_DEBUG_MALLOC\n\n#define\tngp_alloc(x)\t\tdal_malloc(x)\n#define\tngp_free(x)\t\tdal_free(x)\n#define\tngp_realloc(x,y)\tdal_realloc(x,y)\n\n#else\n\n#define\tngp_alloc(x)\t\tmalloc(x)\n#define\tngp_free(x)\t\tfree(x)\n#define\tngp_realloc(x,y)\trealloc(x,y)\n\n#endif\n\n\t/* type definitions */\n\ntypedef struct NGP_RAW_LINE_STRUCT\n      {\tchar\t*line;\n\tchar\t*name;\n\tchar\t*value;\n\tint\ttype;\n\tchar\t*comment;\n\tint\tformat;\n\tint\tflags;\n      } NGP_RAW_LINE;\n\n\ntypedef union NGP_TOKVAL_UNION\n      {\tchar\t*s;\t\t/* space allocated separately, be careful !!! */\n\tchar\tb;\n\tint\ti;\n\tdouble\td;\n\tstruct NGP_COMPLEX_STRUCT\n\t { double re;\n\t   double im;\n\t } c;\t\t\t/* complex value */\n      } NGP_TOKVAL;\n\n\ntypedef struct NGP_TOKEN_STRUCT\n      { int\t\ttype;\n        char\t\tname[NGP_MAX_NAME];\n        NGP_TOKVAL\tvalue;\n        char\t\tcomment[NGP_MAX_COMMENT];\n      } NGP_TOKEN;\n\n\ntypedef struct NGP_HDU_STRUCT\n      {\tint\t\ttokcnt;\n        NGP_TOKEN\t*tok;\n      } NGP_HDU;\n\n\ntypedef struct NGP_TKDEF_STRUCT\n      {\tchar\t*name;\n\tint\tcode;\n      } NGP_TKDEF;\n\n\ntypedef struct NGP_EXTVER_TAB_STRUCT\n      {\tchar\t*extname;\n\tint\tversion;\n      } NGP_EXTVER_TAB;\n\n\n\t/* globally visible variables declarations */\n\nextern\tNGP_RAW_LINE\tngp_curline;\nextern\tNGP_RAW_LINE\tngp_prevline;\n\nextern\tint\t\tngp_extver_tab_size;\nextern\tNGP_EXTVER_TAB\t*ngp_extver_tab;\n\n\n\t/* globally visible functions declarations */\n\nint\tngp_get_extver(char *extname, int *version);\nint\tngp_set_extver(char *extname, int version);\nint\tngp_delete_extver_tab(void);\nint\tngp_line_from_file(FILE *fp, char **p);\nint\tngp_free_line(void);\nint\tngp_free_prevline(void);\nint\tngp_read_line_buffered(FILE *fp);\nint\tngp_unread_line(void);\nint\tngp_extract_tokens(NGP_RAW_LINE *cl);\nint\tngp_include_file(char *fname);\nint\tngp_read_line(int ignore_blank_lines);\nint\tngp_keyword_is_write(NGP_TOKEN *ngp_tok);\nint     ngp_keyword_all_write(NGP_HDU *ngph, fitsfile *ffp, int mode);\nint\tngp_hdu_init(NGP_HDU *ngph);\nint\tngp_hdu_clear(NGP_HDU *ngph);\nint\tngp_hdu_insert_token(NGP_HDU *ngph, NGP_TOKEN *newtok);\nint\tngp_append_columns(fitsfile *ff, NGP_HDU *ngph, int aftercol);\nint\tngp_read_xtension(fitsfile *ff, int parent_hn, int simple_mode);\nint\tngp_read_group(fitsfile *ff, char *grpname, int parent_hn);\n\n\t\t/* top level API function - now defined in fitsio.h */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"},{"id":16636,"name":"eval_l.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"\n#line 3 \"<stdout>\"\n\n#define  FF_INT_ALIGNED short int\n\n/* A lexical scanner generated by flex */\n\n#define FLEX_SCANNER\n#define FF_FLEX_MAJOR_VERSION 2\n#define FF_FLEX_MINOR_VERSION 5\n#define FF_FLEX_SUBMINOR_VERSION 35\n#if FF_FLEX_SUBMINOR_VERSION > 0\n#define FLEX_BETA\n#endif\n\n/* First, we deal with  platform-specific or compiler-specific issues. */\n\n/* begin standard C headers. */\n#include <stdio.h>\n#include <string.h>\n#include <errno.h>\n#include <stdlib.h>\n\n/* end standard C headers. */\n\n/* flex integer type definitions */\n\n#ifndef FLEXINT_H\n#define FLEXINT_H\n\n/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */\n\n#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\n\n/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,\n * if you want the limit (max/min) macros for int types. \n */\n#ifndef __STDC_LIMIT_MACROS\n#define __STDC_LIMIT_MACROS 1\n#endif\n\n#include <inttypes.h>\ntypedef int8_t flex_int8_t;\ntypedef uint8_t flex_uint8_t;\ntypedef int16_t flex_int16_t;\ntypedef uint16_t flex_uint16_t;\ntypedef int32_t flex_int32_t;\ntypedef uint32_t flex_uint32_t;\ntypedef uint64_t flex_uint64_t;\n#else\ntypedef signed char flex_int8_t;\ntypedef short int flex_int16_t;\ntypedef int flex_int32_t;\ntypedef unsigned char flex_uint8_t; \ntypedef unsigned short int flex_uint16_t;\ntypedef unsigned int flex_uint32_t;\n#endif /* ! C99 */\n\n/* Limits of integral types. */\n#ifndef INT8_MIN\n#define INT8_MIN               (-128)\n#endif\n#ifndef INT16_MIN\n#define INT16_MIN              (-32767-1)\n#endif\n#ifndef INT32_MIN\n#define INT32_MIN              (-2147483647-1)\n#endif\n#ifndef INT8_MAX\n#define INT8_MAX               (127)\n#endif\n#ifndef INT16_MAX\n#define INT16_MAX              (32767)\n#endif\n#ifndef INT32_MAX\n#define INT32_MAX              (2147483647)\n#endif\n#ifndef UINT8_MAX\n#define UINT8_MAX              (255U)\n#endif\n#ifndef UINT16_MAX\n#define UINT16_MAX             (65535U)\n#endif\n#ifndef UINT32_MAX\n#define UINT32_MAX             (4294967295U)\n#endif\n\n#endif /* ! FLEXINT_H */\n\n#ifdef __cplusplus\n\n/* The \"const\" storage-class-modifier is valid. */\n#define FF_USE_CONST\n\n#else\t/* ! __cplusplus */\n\n/* C99 requires __STDC__ to be defined as 1. */\n#if defined (__STDC__)\n\n#define FF_USE_CONST\n\n#endif\t/* defined (__STDC__) */\n#endif\t/* ! __cplusplus */\n\n#ifdef FF_USE_CONST\n#define ffconst const\n#else\n#define ffconst\n#endif\n\n/* Returned upon end-of-file. */\n#define FF_NULL 0\n\n/* Promotes a possibly negative, possibly signed char to an unsigned\n * integer for use as an array index.  If the signed char is negative,\n * we want to instead treat it as an 8-bit unsigned char, hence the\n * double cast.\n */\n#define FF_SC_TO_UI(c) ((unsigned int) (unsigned char) c)\n\n/* Enter a start condition.  This macro really ought to take a parameter,\n * but we do it the disgusting crufty way forced on us by the ()-less\n * definition of BEGIN.\n */\n#define BEGIN (ff_start) = 1 + 2 *\n\n/* Translate the current start state into a value that can be later handed\n * to BEGIN to return to the state.  The FFSTATE alias is for lex\n * compatibility.\n */\n#define FF_START (((ff_start) - 1) / 2)\n#define FFSTATE FF_START\n\n/* Action number for EOF rule of a given start state. */\n#define FF_STATE_EOF(state) (FF_END_OF_BUFFER + state + 1)\n\n/* Special action meaning \"start processing a new file\". */\n#define FF_NEW_FILE ffrestart(ffin  )\n\n#define FF_END_OF_BUFFER_CHAR 0\n\n/* Size of default input buffer. */\n#ifndef FF_BUF_SIZE\n#define FF_BUF_SIZE 16384\n#endif\n\n/* The state buf must be large enough to hold one state per character in the main buffer.\n */\n#define FF_STATE_BUF_SIZE   ((FF_BUF_SIZE + 2) * sizeof(ff_state_type))\n\n#ifndef FF_TYPEDEF_FF_BUFFER_STATE\n#define FF_TYPEDEF_FF_BUFFER_STATE\ntypedef struct ff_buffer_state *FF_BUFFER_STATE;\n#endif\n\n#ifndef FF_TYPEDEF_FF_SIZE_T\n#define FF_TYPEDEF_FF_SIZE_T\ntypedef size_t ff_size_t;\n#endif\n\nextern ff_size_t ffleng;\n\nextern FILE *ffin, *ffout;\n\n#define EOB_ACT_CONTINUE_SCAN 0\n#define EOB_ACT_END_OF_FILE 1\n#define EOB_ACT_LAST_MATCH 2\n\n    #define FF_LESS_LINENO(n)\n    \n/* Return all but the first \"n\" matched characters back to the input stream. */\n#define ffless(n) \\\n\tdo \\\n\t\t{ \\\n\t\t/* Undo effects of setting up fftext. */ \\\n        int ffless_macro_arg = (n); \\\n        FF_LESS_LINENO(ffless_macro_arg);\\\n\t\t*ff_cp = (ff_hold_char); \\\n\t\tFF_RESTORE_FF_MORE_OFFSET \\\n\t\t(ff_c_buf_p) = ff_cp = ff_bp + ffless_macro_arg - FF_MORE_ADJ; \\\n\t\tFF_DO_BEFORE_ACTION; /* set up fftext again */ \\\n\t\t} \\\n\twhile ( 0 )\n\n#define unput(c) ffunput( c, (fftext_ptr)  )\n\n#ifndef FF_STRUCT_FF_BUFFER_STATE\n#define FF_STRUCT_FF_BUFFER_STATE\nstruct ff_buffer_state\n\t{\n\tFILE *ff_input_file;\n\n\tchar *ff_ch_buf;\t\t/* input buffer */\n\tchar *ff_buf_pos;\t\t/* current position in input buffer */\n\n\t/* Size of input buffer in bytes, not including room for EOB\n\t * characters.\n\t */\n\tff_size_t ff_buf_size;\n\n\t/* Number of characters read into ff_ch_buf, not including EOB\n\t * characters.\n\t */\n\tff_size_t ff_n_chars;\n\n\t/* Whether we \"own\" the buffer - i.e., we know we created it,\n\t * and can realloc() it to grow it, and should free() it to\n\t * delete it.\n\t */\n\tint ff_is_our_buffer;\n\n\t/* Whether this is an \"interactive\" input source; if so, and\n\t * if we're using stdio for input, then we want to use getc()\n\t * instead of fread(), to make sure we stop fetching input after\n\t * each newline.\n\t */\n\tint ff_is_interactive;\n\n\t/* Whether we're considered to be at the beginning of a line.\n\t * If so, '^' rules will be active on the next match, otherwise\n\t * not.\n\t */\n\tint ff_at_bol;\n\n    int ff_bs_lineno; /**< The line count. */\n    int ff_bs_column; /**< The column count. */\n    \n\t/* Whether to try to fill the input buffer when we reach the\n\t * end of it.\n\t */\n\tint ff_fill_buffer;\n\n\tint ff_buffer_status;\n\n#define FF_BUFFER_NEW 0\n#define FF_BUFFER_NORMAL 1\n\t/* When an EOF's been seen but there's still some text to process\n\t * then we mark the buffer as FF_EOF_PENDING, to indicate that we\n\t * shouldn't try reading from the input source any more.  We might\n\t * still have a bunch of tokens to match, though, because of\n\t * possible backing-up.\n\t *\n\t * When we actually see the EOF, we change the status to \"new\"\n\t * (via ffrestart()), so that the user can continue scanning by\n\t * just pointing ffin at a new input file.\n\t */\n#define FF_BUFFER_EOF_PENDING 2\n\n\t};\n#endif /* !FF_STRUCT_FF_BUFFER_STATE */\n\n/* Stack of input buffers. */\nstatic size_t ff_buffer_stack_top = 0; /**< index of top of stack. */\nstatic size_t ff_buffer_stack_max = 0; /**< capacity of stack. */\nstatic FF_BUFFER_STATE * ff_buffer_stack = 0; /**< Stack as an array. */\n\n/* We provide macros for accessing buffer states in case in the\n * future we want to put the buffer states in a more general\n * \"scanner state\".\n *\n * Returns the top of the stack, or NULL.\n */\n#define FF_CURRENT_BUFFER ( (ff_buffer_stack) \\\n                          ? (ff_buffer_stack)[(ff_buffer_stack_top)] \\\n                          : NULL)\n\n/* Same as previous macro, but useful when we know that the buffer stack is not\n * NULL or when we need an lvalue. For internal use only.\n */\n#define FF_CURRENT_BUFFER_LVALUE (ff_buffer_stack)[(ff_buffer_stack_top)]\n\n/* ff_hold_char holds the character lost when fftext is formed. */\nstatic char ff_hold_char;\nstatic ff_size_t ff_n_chars;\t\t/* number of characters read into ff_ch_buf */\nff_size_t ffleng;\n\n/* Points to current character in buffer. */\nstatic char *ff_c_buf_p = (char *) 0;\nstatic int ff_init = 0;\t\t/* whether we need to initialize */\nstatic int ff_start = 0;\t/* start state number */\n\n/* Flag which is used to allow ffwrap()'s to do buffer switches\n * instead of setting up a fresh ffin.  A bit of a hack ...\n */\nstatic int ff_did_buffer_switch_on_eof;\n\nvoid ffrestart (FILE *input_file  );\nvoid ff_switch_to_buffer (FF_BUFFER_STATE new_buffer  );\nFF_BUFFER_STATE ff_create_buffer (FILE *file,int size  );\nvoid ff_delete_buffer (FF_BUFFER_STATE b  );\nvoid ff_flush_buffer (FF_BUFFER_STATE b  );\nvoid ffpush_buffer_state (FF_BUFFER_STATE new_buffer  );\nvoid ffpop_buffer_state (void );\n\nstatic void ffensure_buffer_stack (void );\nstatic void ff_load_buffer_state (void );\nstatic void ff_init_buffer (FF_BUFFER_STATE b,FILE *file  );\n\n#define FF_FLUSH_BUFFER ff_flush_buffer(FF_CURRENT_BUFFER )\n\nFF_BUFFER_STATE ff_scan_buffer (char *base,ff_size_t size  );\nFF_BUFFER_STATE ff_scan_string (ffconst char *ff_str  );\nFF_BUFFER_STATE ff_scan_bytes (ffconst char *bytes,ff_size_t len  );\n\nvoid *ffalloc (ff_size_t  );\nvoid *ffrealloc (void *,ff_size_t  );\nvoid yyfffree (void *  );\n\n#define ff_new_buffer ff_create_buffer\n\n#define ff_set_interactive(is_interactive) \\\n\t{ \\\n\tif ( ! FF_CURRENT_BUFFER ){ \\\n        ffensure_buffer_stack (); \\\n\t\tFF_CURRENT_BUFFER_LVALUE =    \\\n            ff_create_buffer(ffin,FF_BUF_SIZE ); \\\n\t} \\\n\tFF_CURRENT_BUFFER_LVALUE->ff_is_interactive = is_interactive; \\\n\t}\n\n#define ff_set_bol(at_bol) \\\n\t{ \\\n\tif ( ! FF_CURRENT_BUFFER ){\\\n        ffensure_buffer_stack (); \\\n\t\tFF_CURRENT_BUFFER_LVALUE =    \\\n            ff_create_buffer(ffin,FF_BUF_SIZE ); \\\n\t} \\\n\tFF_CURRENT_BUFFER_LVALUE->ff_at_bol = at_bol; \\\n\t}\n\n#define FF_AT_BOL() (FF_CURRENT_BUFFER_LVALUE->ff_at_bol)\n\n/* Begin user sect3 */\n\ntypedef unsigned char FF_CHAR;\n\nFILE *ffin = (FILE *) 0, *ffout = (FILE *) 0;\n\ntypedef int ff_state_type;\n\nextern int fflineno;\n\nint fflineno = 1;\n\nextern char *fftext;\n#define fftext_ptr fftext\n\nstatic ff_state_type ff_get_previous_state (void );\nstatic ff_state_type ff_try_NUL_trans (ff_state_type current_state  );\nstatic int ff_get_next_buffer (void );\nstatic void ff_fatal_error (ffconst char msg[]  );\n\n/* Done after the current pattern has been matched and before the\n * corresponding action - sets up fftext.\n */\n#define FF_DO_BEFORE_ACTION \\\n\t(fftext_ptr) = ff_bp; \\\n\tffleng = (ff_size_t) (ff_cp - ff_bp); \\\n\t(ff_hold_char) = *ff_cp; \\\n\t*ff_cp = '\\0'; \\\n\t(ff_c_buf_p) = ff_cp;\n\n#define FF_NUM_RULES 30\n#define FF_END_OF_BUFFER 31\n/* This struct is not used in this scanner,\n   but its presence is necessary. */\nstruct ff_trans_info\n\t{\n\tflex_int32_t ff_verify;\n\tflex_int32_t ff_nxt;\n\t};\nstatic ffconst flex_int16_t ff_accept[174] =\n    {   0,\n        0,    0,   31,   29,    1,   28,   18,   29,   29,   29,\n       29,   29,   29,   29,   10,    8,    8,   24,   29,   23,\n       13,   13,   13,   13,    9,   13,   13,   13,   13,   13,\n       17,   13,   13,   13,   13,   13,   13,   13,   29,    1,\n       22,    0,   12,    0,   11,    0,   13,   20,    0,    0,\n        0,    0,    0,    0,    0,   17,    0,   10,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,   10,    8,    0,    0,    0,    0,   26,   21,\n       25,   13,   13,   13,    2,   13,   13,   13,    4,   13,\n       13,   13,   13,    3,   13,   27,   13,   13,   13,   13,\n\n       13,   13,   13,   13,   13,   19,    0,   11,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,   10,    5,    6,    7,\n       14,   13,   23,   24,   13,   13,   13,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,   18,\n        0,    0,   15,    0,    0,    0,    0,    0,    0,    0,\n       16,    0,    0\n    } ;\n\nstatic ffconst flex_int32_t ff_ec[256] =\n    {   0,\n        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    2,    4,    5,    6,    7,    1,    8,    9,   10,\n       11,   12,   13,    1,   13,   14,    1,   15,   16,   17,\n       17,   17,   17,   17,   17,   18,   18,    1,    1,   19,\n       20,   21,    1,    1,   22,   23,   24,   25,   26,   27,\n       28,   29,   30,   31,   31,   32,   31,   33,   34,   31,\n       35,   36,   31,   37,   38,   31,   31,   39,   31,   31,\n        1,    1,   40,   41,   42,    1,   43,   44,   24,   45,\n\n       46,   47,   48,   29,   49,   31,   31,   50,   31,   51,\n       52,   31,   53,   54,   31,   55,   56,   31,   31,   57,\n       31,   31,    1,   58,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1\n    } ;\n\nstatic ffconst flex_int32_t ff_meta[59] =\n    {   0,\n        1,    1,    2,    1,    1,    1,    3,    1,    1,    1,\n        1,    1,    1,    1,    4,    4,    4,    4,    1,    1,\n        1,    4,    4,    4,    4,    4,    4,    5,    5,    5,\n        5,    5,    5,    5,    5,    5,    5,    5,    5,    1,\n        1,    5,    4,    4,    4,    4,    4,    5,    5,    5,\n        5,    5,    5,    5,    5,    5,    5,    1\n    } ;\n\nstatic ffconst flex_int16_t ff_base[182] =\n    {   0,\n        0,    0,  412,  413,  409,  413,  390,  404,  401,  400,\n      398,  396,   34,  392,   70,  114,   16,  383,   46,  382,\n       29,   84,  359,   28,  358,   52,  157,   64,   91,  128,\n      358,    0,   40,   27,   69,   92,  100,  171,  340,  395,\n      413,  391,  413,  388,  387,  386,  413,  413,  383,  357,\n      358,  356,  336,  337,  335,  413,  139,  190,  352,  349,\n       71,  111,  135,  347,  348,  330,  327,   59,   64,  116,\n      325,  323,  175,    0,   59,  120,  326,    0,  413,  413,\n      413,  153,  184,    0,  202,  209,  210,  219,  351,  220,\n      228,  229,  211,  230,  240,  413,  221,  246,  254,  263,\n\n      264,  265,  266,  239,  275,  413,  346,  342,  310,  313,\n      309,  289,  292,  288,  275,  317,  327,  326,  325,  324,\n      323,  322,  298,  320,  297,  287,  317,  315,  314,  312,\n      311,  310,  249,  289,  243,  294,  298,  134,  246,    0,\n      413,  285,  413,  413,  288,  308,  309,  261,  261,  256,\n      221,  215,  246,  241,  223,  218,  213,  208,  197,  413,\n      166,  160,  413,  128,  122,  150,  154,  105,  101,   96,\n      413,   84,  413,  351,  354,  359,  364,  366,  368,  373,\n       89\n    } ;\n\nstatic ffconst flex_int16_t ff_def[182] =\n    {   0,\n      173,    1,  173,  173,  173,  173,  173,  174,  175,  176,\n      173,  177,  173,  173,  173,  173,   16,  173,  173,  173,\n      178,  178,  178,  178,  178,  178,  178,  178,  178,  178,\n      173,  179,  178,  178,  178,  178,  178,  178,  173,  173,\n      173,  174,  173,  180,  175,  176,  173,  173,  177,  173,\n      173,  173,  173,  173,  173,  173,  173,  173,  173,  173,\n      173,  173,  173,  173,  173,  173,  173,  173,  173,  173,\n      173,  173,  173,   17,  173,  173,  173,  181,  173,  173,\n      173,  178,  178,  179,  178,  178,  178,  178,   27,  178,\n      178,  178,  178,  178,  178,  173,  178,  178,  178,  178,\n\n      178,  178,  178,  178,  178,  173,  180,  180,  173,  173,\n      173,  173,  173,  173,  173,  173,  173,  173,  173,  173,\n      173,  173,  173,  173,  173,  173,  173,  173,  173,  173,\n      173,  173,  173,  173,  173,  173,  173,  173,  173,  181,\n      173,  178,  173,  173,  178,  178,  178,  173,  173,  173,\n      173,  173,  173,  173,  173,  173,  173,  173,  173,  173,\n      173,  173,  173,  173,  173,  173,  173,  173,  173,  173,\n      173,  173,    0,  173,  173,  173,  173,  173,  173,  173,\n      173\n    } ;\n\nstatic ffconst flex_int16_t ff_nxt[472] =\n    {   0,\n        4,    5,    6,    7,    8,    9,   10,   11,   12,   13,\n        4,   14,    4,   15,   16,   17,   17,   17,   18,   19,\n       20,   21,   22,   23,   23,   24,   25,   26,   27,   23,\n       23,   28,   29,   30,   23,   23,   25,   23,   23,    4,\n       31,   32,   33,   22,   23,   34,   25,   35,   23,   36,\n       37,   38,   23,   23,   25,   23,   23,   39,   50,  173,\n       51,   83,   86,   52,   79,   80,   81,  173,   84,   84,\n       84,  136,  173,  137,  137,  137,  137,   87,   53,   98,\n       54,   84,   55,   57,   58,   58,   58,   58,   88,   90,\n       97,   59,  140,   84,  171,   60,  118,   61,   85,   85,\n\n       91,   62,   63,   64,  128,   84,  171,  119,   65,  130,\n       84,  171,   66,  129,   99,   67,   92,   68,  131,   69,\n       70,   71,   85,  100,   93,   84,   72,   73,   74,   74,\n       74,   74,   84,   84,  138,  138,  120,  101,   75,   75,\n       85,   84,   94,   94,   94,  103,  102,  121,  138,  138,\n      172,  104,   57,  115,  115,  115,  115,   76,   75,   75,\n      122,  132,  141,   95,  171,   77,   94,  133,  123,   84,\n       78,   89,   89,   89,   89,  170,  169,  168,   89,   89,\n       89,   89,   89,   89,   94,   94,   94,   94,   57,   58,\n       58,   58,   58,  141,   84,   89,  167,  166,   84,   89,\n\n       89,   89,   89,   89,   58,   58,   58,   58,  142,   94,\n       96,  141,   84,   89,   75,   75,   85,   85,  141,  141,\n      141,  160,   80,   81,  105,   84,   48,   94,  141,  141,\n      141,   96,  143,   79,   75,   75,  160,  141,  141,  141,\n       85,  144,   41,   84,   94,   94,   94,  145,  141,  141,\n       84,   84,   84,  106,   48,  141,  163,  165,   85,   80,\n       84,   84,   84,  141,  164,  146,  163,   81,   94,   84,\n       84,   84,  141,  141,  141,  141,  143,   79,  144,   41,\n       84,   84,  162,  161,  141,  139,   94,   84,  106,  115,\n      115,  115,  115,  147,  141,   84,  159,  141,   48,   75,\n\n       75,  160,  106,  158,   84,   84,   84,   84,  137,  137,\n      137,  137,  137,  137,  137,  137,   84,  141,  141,   75,\n       75,   48,  160,   41,  144,   79,   84,  143,   81,   84,\n       80,  157,  156,  106,  155,   41,  144,   79,  143,   81,\n       80,  154,  153,  152,  151,  150,  149,  148,  108,   84,\n       84,   42,  108,   42,   42,   42,   45,   45,   45,   46,\n      141,   46,   46,   46,   49,  139,   49,   49,   49,   82,\n       82,   84,   84,  107,  135,  107,  107,  107,  134,  127,\n      126,  125,  124,  117,  116,  114,  113,  112,  111,  110,\n      109,   43,   47,  173,  108,   43,   40,  106,   96,   84,\n\n       84,   81,   79,   56,   43,   48,   47,   44,   43,   41,\n       40,  173,    3,  173,  173,  173,  173,  173,  173,  173,\n      173,  173,  173,  173,  173,  173,  173,  173,  173,  173,\n      173,  173,  173,  173,  173,  173,  173,  173,  173,  173,\n      173,  173,  173,  173,  173,  173,  173,  173,  173,  173,\n      173,  173,  173,  173,  173,  173,  173,  173,  173,  173,\n      173,  173,  173,  173,  173,  173,  173,  173,  173,  173,\n      173\n    } ;\n\nstatic ffconst flex_int16_t ff_chk[472] =\n    {   0,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\n        1,    1,    1,    1,    1,    1,    1,    1,   13,   17,\n       13,   21,   24,   13,   19,   19,   19,   17,   34,   24,\n       21,   75,   17,   75,   75,   75,   75,   26,   13,   34,\n       13,   33,   13,   15,   15,   15,   15,   15,   26,   28,\n       33,   15,  181,   26,  172,   15,   61,   15,   22,   22,\n\n       28,   15,   15,   15,   68,   28,  170,   61,   15,   69,\n       35,  169,   15,   68,   35,   15,   29,   15,   69,   15,\n       15,   15,   22,   35,   29,   22,   15,   16,   16,   16,\n       16,   16,   29,   36,   76,   76,   62,   36,   16,   16,\n       22,   37,   30,   30,   30,   37,   36,   62,  138,  138,\n      168,   37,   57,   57,   57,   57,   57,   16,   16,   16,\n       63,   70,   82,   30,  167,   16,   30,   70,   63,   30,\n       16,   27,   27,   27,   27,  166,  165,  164,   27,   27,\n       27,   27,   27,   27,   30,   38,   38,   38,   73,   73,\n       73,   73,   73,   83,   82,   27,  162,  161,   27,   27,\n\n       27,   27,   27,   27,   58,   58,   58,   58,   83,   38,\n      159,   85,   38,   27,   58,   58,   85,   85,   86,   87,\n       93,  158,   86,   87,   38,   83,  157,   38,   88,   90,\n       97,  156,   88,   90,   58,   58,  155,   91,   92,   94,\n       85,   91,   92,   85,   94,   94,   94,   93,  104,   95,\n       86,   87,   93,   95,  154,   98,  153,  152,   85,   98,\n       88,   90,   97,   99,  151,   97,  150,   99,   94,   91,\n       92,   94,  100,  101,  102,  103,  100,  101,  102,  103,\n      104,   95,  149,  148,  105,  139,   94,   98,  105,  115,\n      115,  115,  115,  104,  142,   99,  135,  145,  142,  115,\n\n      115,  145,  134,  133,  100,  101,  102,  103,  136,  136,\n      136,  136,  137,  137,  137,  137,  105,  146,  147,  115,\n      115,  146,  147,  132,  131,  130,  142,  129,  128,  145,\n      127,  126,  125,  124,  123,  122,  121,  120,  119,  118,\n      117,  116,  114,  113,  112,  111,  110,  109,  108,  146,\n      147,  174,  107,  174,  174,  174,  175,  175,  175,  176,\n       89,  176,  176,  176,  177,   77,  177,  177,  177,  178,\n      178,  179,  179,  180,   72,  180,  180,  180,   71,   67,\n       66,   65,   64,   60,   59,   55,   54,   53,   52,   51,\n       50,   49,   46,   45,   44,   42,   40,   39,   31,   25,\n\n       23,   20,   18,   14,   12,   11,   10,    9,    8,    7,\n        5,    3,  173,  173,  173,  173,  173,  173,  173,  173,\n      173,  173,  173,  173,  173,  173,  173,  173,  173,  173,\n      173,  173,  173,  173,  173,  173,  173,  173,  173,  173,\n      173,  173,  173,  173,  173,  173,  173,  173,  173,  173,\n      173,  173,  173,  173,  173,  173,  173,  173,  173,  173,\n      173,  173,  173,  173,  173,  173,  173,  173,  173,  173,\n      173\n    } ;\n\nstatic ff_state_type ff_last_accepting_state;\nstatic char *ff_last_accepting_cpos;\n\nextern int ff_flex_debug;\nint ff_flex_debug = 0;\n\n/* The intent behind this definition is that it'll catch\n * any uses of REJECT which flex missed.\n */\n#define REJECT reject_used_but_not_detected\n#define ffmore() ffmore_used_but_not_detected\n#define FF_MORE_ADJ 0\n#define FF_RESTORE_FF_MORE_OFFSET\nchar *fftext;\n#line 1 \"eval.l\"\n#line 2 \"eval.l\"\n/************************************************************************/\n/*                                                                      */\n/*                       CFITSIO Lexical Parser                         */\n/*                                                                      */\n/* This file is one of 3 files containing code which parses an          */\n/* arithmetic expression and evaluates it in the context of an input    */\n/* FITS file table extension.  The CFITSIO lexical parser is divided    */\n/* into the following 3 parts/files: the CFITSIO \"front-end\",           */\n/* eval_f.c, contains the interface between the user/CFITSIO and the    */\n/* real core of the parser; the FLEX interpreter, eval_l.c, takes the   */\n/* input string and parses it into tokens and identifies the FITS       */\n/* information required to evaluate the expression (ie, keywords and    */\n/* columns); and, the BISON grammar and evaluation routines, eval_y.c,  */\n/* receives the FLEX output and determines and performs the actual      */\n/* operations.  The files eval_l.c and eval_y.c are produced from       */\n/* running flex and bison on the files eval.l and eval.y, respectively. */\n/* (flex and bison are available from any GNU archive: see www.gnu.org) */\n/*                                                                      */\n/* The grammar rules, rather than evaluating the expression in situ,    */\n/* builds a tree, or Nodal, structure mapping out the order of          */\n/* operations and expression dependencies.  This \"compilation\" process  */\n/* allows for much faster processing of multiple rows.  This technique  */\n/* was developed by Uwe Lammers of the XMM Science Analysis System,     */\n/* although the CFITSIO implementation is entirely code original.       */\n/*                                                                      */\n/*                                                                      */\n/* Modification History:                                                */\n/*                                                                      */\n/*   Kent Blackburn      c1992  Original parser code developed for the  */\n/*                              FTOOLS software package, in particular, */\n/*                              the fselect task.                       */\n/*   Kent Blackburn      c1995  BIT column support added                */\n/*   Peter D Wilson   Feb 1998  Vector column support added             */\n/*   Peter D Wilson   May 1998  Ported to CFITSIO library.  User        */\n/*                              interface routines written, in essence  */\n/*                              making fselect, fcalc, and maketime     */\n/*                              capabilities available to all tools     */\n/*                              via single function calls.              */\n/*   Peter D Wilson   Jun 1998  Major rewrite of parser core, so as to  */\n/*                              create a run-time evaluation tree,      */\n/*                              inspired by the work of Uwe Lammers,    */\n/*                              resulting in a speed increase of        */\n/*                              10-100 times.                           */\n/*   Peter D Wilson   Jul 1998  gtifilter(a,b,c,d) function added       */\n/*   Peter D Wilson   Aug 1998  regfilter(a,b,c,d) function added       */\n/*   Peter D Wilson   Jul 1999  Make parser fitsfile-independent,       */\n/*                              allowing a purely vector-based usage    */\n/*                                                                      */\n/************************************************************************/\n\n#include <math.h>\n#include <string.h>\n#include <ctype.h>\n#ifdef sparc\n#include <malloc.h>\n#else\n#include <stdlib.h>\n#endif\n#include \"eval_defs.h\"\n\nParseData gParse;     /* Global structure holding all parser information     */\n\n/*****  Internal functions  *****/\n\n       int ffGetVariable( char *varName, FFSTYPE *varVal );\n\nstatic int find_variable( char *varName );\nstatic int expr_read( char *buf, int nbytes );\n\n/*****  Definitions  *****/\n\n#define FF_NO_UNPUT   /*  Don't include FFUNPUT function  */\n#define FF_NEVER_INTERACTIVE 1\n\n#define MAXCHR 256\n#define MAXBIT 128\n\n#define OCT_0 \"000\"\n#define OCT_1 \"001\"\n#define OCT_2 \"010\"\n#define OCT_3 \"011\"\n#define OCT_4 \"100\"\n#define OCT_5 \"101\"\n#define OCT_6 \"110\"\n#define OCT_7 \"111\"\n#define OCT_X \"xxx\"\n\n#define HEX_0 \"0000\"\n#define HEX_1 \"0001\"\n#define HEX_2 \"0010\"\n#define HEX_3 \"0011\"\n#define HEX_4 \"0100\"\n#define HEX_5 \"0101\"\n#define HEX_6 \"0110\"\n#define HEX_7 \"0111\"\n#define HEX_8 \"1000\"\n#define HEX_9 \"1001\"\n#define HEX_A \"1010\"\n#define HEX_B \"1011\"\n#define HEX_C \"1100\"\n#define HEX_D \"1101\"\n#define HEX_E \"1110\"\n#define HEX_F \"1111\"\n#define HEX_X \"xxxx\"\n\n/* \n   MJT - 13 June 1996\n   read from buffer instead of stdin\n   (as per old ftools.skel)\n*/\n#undef FF_INPUT\n#define FF_INPUT(buf,result,max_size) \\\n        if ( (result = expr_read( (char *) buf, max_size )) < 0 ) \\\n            FF_FATAL_ERROR( \"read() in flex scanner failed\" );\n\n#line 729 \"<stdout>\"\n\n#define INITIAL 0\n\n#ifndef FF_NO_UNISTD_H\n/* Special case for \"unistd.h\", since it is non-ANSI. We include it way\n * down here because we want the user's section 1 to have been scanned first.\n * The user has a chance to override it with an option.\n */\n#include <unistd.h>\n#endif\n\n#ifndef FF_EXTRA_TYPE\n#define FF_EXTRA_TYPE void *\n#endif\n\nstatic int ff_init_globals (void );\n\n/* Accessor methods to globals.\n   These are made visible to non-reentrant scanners for convenience. */\n\nint fflex_destroy (void );\n\nint ffget_debug (void );\n\nvoid ffset_debug (int debug_flag  );\n\nFF_EXTRA_TYPE ffget_extra (void );\n\nvoid ffset_extra (FF_EXTRA_TYPE user_defined  );\n\nFILE *ffget_in (void );\n\nvoid ffset_in  (FILE * in_str  );\n\nFILE *ffget_out (void );\n\nvoid ffset_out  (FILE * out_str  );\n\nff_size_t ffget_leng (void );\n\nchar *ffget_text (void );\n\nint ffget_lineno (void );\n\nvoid ffset_lineno (int line_number  );\n\n/* Macros after this point can all be overridden by user definitions in\n * section 1.\n */\n\n#ifndef FF_SKIP_FFWRAP\n#ifdef __cplusplus\nextern \"C\" int ffwrap (void );\n#else\nextern int ffwrap (void );\n#endif\n#endif\n\n    static void ffunput (int c,char *buf_ptr  );\n    \n#ifndef fftext_ptr\nstatic void ff_flex_strncpy (char *,ffconst char *,int );\n#endif\n\n#ifdef FF_NEED_STRLEN\nstatic int ff_flex_strlen (ffconst char * );\n#endif\n\n#ifndef FF_NO_INPUT\n\n#ifdef __cplusplus\nstatic int ffinput (void );\n#else\nstatic int input (void );\n#endif\n\n#endif\n\n/* Amount of stuff to slurp up with each read. */\n#ifndef FF_READ_BUF_SIZE\n#define FF_READ_BUF_SIZE 8192\n#endif\n\n/* Copy whatever the last rule matched to the standard output. */\n#ifndef ECHO\n/* This used to be an fputs(), but since the string might contain NUL's,\n * we now use fwrite().\n */\n#define ECHO fwrite( fftext, ffleng, 1, ffout )\n#endif\n\n/* Gets input and stuffs it into \"buf\".  number of characters read, or FF_NULL,\n * is returned in \"result\".\n */\n#ifndef FF_INPUT\n#define FF_INPUT(buf,result,max_size) \\\n\tif ( FF_CURRENT_BUFFER_LVALUE->ff_is_interactive ) \\\n\t\t{ \\\n\t\tint c = '*'; \\\n\t\tff_size_t n; \\\n\t\tfor ( n = 0; n < max_size && \\\n\t\t\t     (c = getc( ffin )) != EOF && c != '\\n'; ++n ) \\\n\t\t\tbuf[n] = (char) c; \\\n\t\tif ( c == '\\n' ) \\\n\t\t\tbuf[n++] = (char) c; \\\n\t\tif ( c == EOF && ferror( ffin ) ) \\\n\t\t\tFF_FATAL_ERROR( \"input in flex scanner failed\" ); \\\n\t\tresult = n; \\\n\t\t} \\\n\telse \\\n\t\t{ \\\n\t\terrno=0; \\\n\t\twhile ( (result = fread(buf, 1, max_size, ffin))==0 && ferror(ffin)) \\\n\t\t\t{ \\\n\t\t\tif( errno != EINTR) \\\n\t\t\t\t{ \\\n\t\t\t\tFF_FATAL_ERROR( \"input in flex scanner failed\" ); \\\n\t\t\t\tbreak; \\\n\t\t\t\t} \\\n\t\t\terrno=0; \\\n\t\t\tclearerr(ffin); \\\n\t\t\t} \\\n\t\t}\\\n\\\n\n#endif\n\n/* No semi-colon after return; correct usage is to write \"ffterminate();\" -\n * we don't want an extra ';' after the \"return\" because that will cause\n * some compilers to complain about unreachable statements.\n */\n#ifndef ffterminate\n#define ffterminate() return FF_NULL\n#endif\n\n/* Number of entries by which start-condition stack grows. */\n#ifndef FF_START_STACK_INCR\n#define FF_START_STACK_INCR 25\n#endif\n\n/* Report a fatal error. */\n#ifndef FF_FATAL_ERROR\n#define FF_FATAL_ERROR(msg) ff_fatal_error( msg )\n#endif\n\n/* end tables serialization structures and prototypes */\n\n/* Default declaration of generated scanner - a define so the user can\n * easily add parameters.\n */\n#ifndef FF_DECL\n#define FF_DECL_IS_OURS 1\n\nextern int fflex (void);\n\n#define FF_DECL int fflex (void)\n#endif /* !FF_DECL */\n\n/* Code executed at the beginning of each rule, after fftext and ffleng\n * have been set up.\n */\n#ifndef FF_USER_ACTION\n#define FF_USER_ACTION\n#endif\n\n/* Code executed at the end of each rule. */\n#ifndef FF_BREAK\n#define FF_BREAK break;\n#endif\n\n#define FF_RULE_SETUP \\\n\tFF_USER_ACTION\n\n/** The main scanner function which does all the work.\n */\nFF_DECL\n{\n\tregister ff_state_type ff_current_state;\n\tregister char *ff_cp, *ff_bp;\n\tregister int ff_act;\n    \n#line 146 \"eval.l\"\n\n\n#line 914 \"<stdout>\"\n\n\tif ( !(ff_init) )\n\t\t{\n\t\t(ff_init) = 1;\n\n#ifdef FF_USER_INIT\n\t\tFF_USER_INIT;\n#endif\n\n\t\tif ( ! (ff_start) )\n\t\t\t(ff_start) = 1;\t/* first start state */\n\n\t\tif ( ! ffin )\n\t\t\tffin = stdin;\n\n\t\tif ( ! ffout )\n\t\t\tffout = stdout;\n\n\t\tif ( ! FF_CURRENT_BUFFER ) {\n\t\t\tffensure_buffer_stack ();\n\t\t\tFF_CURRENT_BUFFER_LVALUE =\n\t\t\t\tff_create_buffer(ffin,FF_BUF_SIZE );\n\t\t}\n\n\t\tff_load_buffer_state( );\n\t\t}\n\n\twhile ( 1 )\t\t/* loops until end-of-file is reached */\n\t\t{\n\t\tff_cp = (ff_c_buf_p);\n\n\t\t/* Support of fftext. */\n\t\t*ff_cp = (ff_hold_char);\n\n\t\t/* ff_bp points to the position in ff_ch_buf of the start of\n\t\t * the current run.\n\t\t */\n\t\tff_bp = ff_cp;\n\n\t\tff_current_state = (ff_start);\nff_match:\n\t\tdo\n\t\t\t{\n\t\t\tregister FF_CHAR ff_c = ff_ec[FF_SC_TO_UI(*ff_cp)];\n\t\t\tif ( ff_accept[ff_current_state] )\n\t\t\t\t{\n\t\t\t\t(ff_last_accepting_state) = ff_current_state;\n\t\t\t\t(ff_last_accepting_cpos) = ff_cp;\n\t\t\t\t}\n\t\t\twhile ( ff_chk[ff_base[ff_current_state] + ff_c] != ff_current_state )\n\t\t\t\t{\n\t\t\t\tff_current_state = (int) ff_def[ff_current_state];\n\t\t\t\tif ( ff_current_state >= 174 )\n\t\t\t\t\tff_c = ff_meta[(unsigned int) ff_c];\n\t\t\t\t}\n\t\t\tff_current_state = ff_nxt[ff_base[ff_current_state] + (unsigned int) ff_c];\n\t\t\t++ff_cp;\n\t\t\t}\n\t\twhile ( ff_base[ff_current_state] != 413 );\n\nff_find_action:\n\t\tff_act = ff_accept[ff_current_state];\n\t\tif ( ff_act == 0 )\n\t\t\t{ /* have to back up */\n\t\t\tff_cp = (ff_last_accepting_cpos);\n\t\t\tff_current_state = (ff_last_accepting_state);\n\t\t\tff_act = ff_accept[ff_current_state];\n\t\t\t}\n\n\t\tFF_DO_BEFORE_ACTION;\n\ndo_action:\t/* This label is used only to access EOF actions. */\n\n\t\tswitch ( ff_act )\n\t{ /* beginning of action switch */\n\t\t\tcase 0: /* must back up */\n\t\t\t/* undo the effects of FF_DO_BEFORE_ACTION */\n\t\t\t*ff_cp = (ff_hold_char);\n\t\t\tff_cp = (ff_last_accepting_cpos);\n\t\t\tff_current_state = (ff_last_accepting_state);\n\t\t\tgoto ff_find_action;\n\ncase 1:\nFF_RULE_SETUP\n#line 148 \"eval.l\"\n;\n\tFF_BREAK\ncase 2:\nFF_RULE_SETUP\n#line 149 \"eval.l\"\n{\n                  int len;\n                  len = strlen(fftext);\n\t\t  while (fftext[len] == ' ')\n\t\t\tlen--;\n                  len = len - 1;\n\t\t  strncpy(fflval.str,&fftext[1],len);\n\t\t  fflval.str[len] = '\\0';\n\t\t  return( BITSTR );\n\t\t}\n\tFF_BREAK\ncase 3:\nFF_RULE_SETUP\n#line 159 \"eval.l\"\n{\n                  int len;\n                  char tmpstring[256];\n                  char bitstring[256];\n                  len = strlen(fftext);\n\t\t  if (len >= 256) {\n\t\t    char errMsg[100];\n\t\t    gParse.status = PARSE_SYNTAX_ERR;\n\t\t    strcpy (errMsg,\"Bit string exceeds maximum length: '\");\n\t\t    strncat(errMsg, &(fftext[0]), 20);\n\t\t    strcat (errMsg,\"...'\");\n\t\t    ffpmsg (errMsg);\n\t\t    len = 0;\n\t\t  } else {\n\t\t    while (fftext[len] == ' ')\n\t\t      len--;\n\t\t    len = len - 1;\n\t\t    strncpy(tmpstring,&fftext[1],len);\n\t\t  }\n                  tmpstring[len] = '\\0';\n                  bitstring[0] = '\\0';\n\t\t  len = 0;\n                  while ( tmpstring[len] != '\\0')\n                       {\n\t\t\tswitch ( tmpstring[len] )\n\t\t\t      {\n\t\t\t       case '0':\n\t\t\t\t\tstrcat(bitstring,OCT_0);\n\t\t\t\t\tbreak;\n\t\t\t       case '1':\n\t\t\t\t\tstrcat(bitstring,OCT_1);\n\t\t\t\t\tbreak;\n\t\t\t       case '2':\n\t\t\t\t\tstrcat(bitstring,OCT_2);\n\t\t\t\t\tbreak;\n\t\t\t       case '3':\n\t\t\t\t\tstrcat(bitstring,OCT_3);\n\t\t\t\t\tbreak;\n\t\t\t       case '4':\n\t\t\t\t\tstrcat(bitstring,OCT_4);\n\t\t\t\t\tbreak;\n\t\t\t       case '5':\n\t\t\t\t\tstrcat(bitstring,OCT_5);\n\t\t\t\t\tbreak;\n\t\t\t       case '6':\n\t\t\t\t\tstrcat(bitstring,OCT_6);\n\t\t\t\t\tbreak;\n\t\t\t       case '7':\n\t\t\t\t\tstrcat(bitstring,OCT_7);\n\t\t\t\t\tbreak;\n\t\t\t       case 'x':\n\t\t\t       case 'X':\n\t\t\t\t\tstrcat(bitstring,OCT_X);\n\t\t\t\t\tbreak;\n\t\t\t      }\n\t\t\tlen++;\n                       }\n                  strcpy( fflval.str, bitstring );\n\t\t  return( BITSTR );\n\t\t}\n\tFF_BREAK\ncase 4:\nFF_RULE_SETUP\n#line 219 \"eval.l\"\n{\n                  int len;\n                  char tmpstring[256];\n                  char bitstring[256];\n                  len = strlen(fftext);\n\t\t  if (len >= 256) {\n\t\t    char errMsg[100];\n\t\t    gParse.status = PARSE_SYNTAX_ERR;\n\t\t    strcpy (errMsg,\"Hex string exceeds maximum length: '\");\n\t\t    strncat(errMsg, &(fftext[0]), 20);\n\t\t    strcat (errMsg,\"...'\");\n\t\t    ffpmsg (errMsg);\n\t\t    len = 0;\n\t\t  } else {\n\t\t    while (fftext[len] == ' ')\n\t\t      len--;\n\t\t    len = len - 1;\n\t\t    strncpy(tmpstring,&fftext[1],len);\n\t\t  }\n                  tmpstring[len] = '\\0';\n                  bitstring[0] = '\\0';\n\t\t  len = 0;\n                  while ( tmpstring[len] != '\\0')\n                       {\n\t\t\tswitch ( tmpstring[len] )\n\t\t\t      {\n\t\t\t       case '0':\n\t\t\t\t\tstrcat(bitstring,HEX_0);\n\t\t\t\t\tbreak;\n\t\t\t       case '1':\n\t\t\t\t\tstrcat(bitstring,HEX_1);\n\t\t\t\t\tbreak;\n\t\t\t       case '2':\n\t\t\t\t\tstrcat(bitstring,HEX_2);\n\t\t\t\t\tbreak;\n\t\t\t       case '3':\n\t\t\t\t\tstrcat(bitstring,HEX_3);\n\t\t\t\t\tbreak;\n\t\t\t       case '4':\n\t\t\t\t\tstrcat(bitstring,HEX_4);\n\t\t\t\t\tbreak;\n\t\t\t       case '5':\n\t\t\t\t\tstrcat(bitstring,HEX_5);\n\t\t\t\t\tbreak;\n\t\t\t       case '6':\n\t\t\t\t\tstrcat(bitstring,HEX_6);\n\t\t\t\t\tbreak;\n\t\t\t       case '7':\n\t\t\t\t\tstrcat(bitstring,HEX_7);\n\t\t\t\t\tbreak;\n\t\t\t       case '8':\n\t\t\t\t\tstrcat(bitstring,HEX_8);\n\t\t\t\t\tbreak;\n\t\t\t       case '9':\n\t\t\t\t\tstrcat(bitstring,HEX_9);\n\t\t\t\t\tbreak;\n\t\t\t       case 'a':\n\t\t\t       case 'A':\n\t\t\t\t\tstrcat(bitstring,HEX_A);\n\t\t\t\t\tbreak;\n\t\t\t       case 'b':\n\t\t\t       case 'B':\n\t\t\t\t\tstrcat(bitstring,HEX_B);\n\t\t\t\t\tbreak;\n\t\t\t       case 'c':\n\t\t\t       case 'C':\n\t\t\t\t\tstrcat(bitstring,HEX_C);\n\t\t\t\t\tbreak;\n\t\t\t       case 'd':\n\t\t\t       case 'D':\n\t\t\t\t\tstrcat(bitstring,HEX_D);\n\t\t\t\t\tbreak;\n\t\t\t       case 'e':\n\t\t\t       case 'E':\n\t\t\t\t\tstrcat(bitstring,HEX_E);\n\t\t\t\t\tbreak;\n\t\t\t       case 'f':\n\t\t\t       case 'F':\n\t\t\t\t\tstrcat(bitstring,HEX_F);\n\t\t\t\t\tbreak;\n\t\t\t       case 'x':\n\t\t\t       case 'X':\n\t\t\t\t\tstrcat(bitstring,HEX_X);\n\t\t\t\t\tbreak;\n\t\t\t      }\n\t\t\tlen++;\n                       }\n\n                  strcpy( fflval.str, bitstring );\n\t\t  return( BITSTR );\n\t\t}\n\tFF_BREAK\ncase 5:\nFF_RULE_SETUP\n#line 310 \"eval.l\"\n{\n\t\t  long int constval = 0;\n\t\t  char *p;\n\t\t  for (p = &(fftext[2]); *p; p++) {\n\t\t    constval = (constval << 1) | (*p == '1');\n\t\t  }\n\t\t  fflval.lng = constval;\n\t\t  return( LONG );\n\t\t}\n\tFF_BREAK\ncase 6:\nFF_RULE_SETUP\n#line 319 \"eval.l\"\n{\n\t\t  long int constval = 0;\n\t\t  char *p;\n\t\t  for (p = &(fftext[2]); *p; p++) {\n\t\t    constval = (constval << 3) | (*p - '0');\n\t\t  }\n\t\t  fflval.lng = constval;\n\t\t  return( LONG );\n\t\t}\n\tFF_BREAK\ncase 7:\nFF_RULE_SETUP\n#line 328 \"eval.l\"\n{\n\t\t  long int constval = 0;\n\t\t  char *p;\n\t\t  for (p = &(fftext[2]); *p; p++) {\n                    int v = (isdigit(*p) ? (*p - '0') : (*p - 'a' + 10));\n                    constval = (constval << 4) | v;\n\t\t  }\n\t\t  fflval.lng = constval;\n\t\t  return( LONG );\n\t\t}\n\tFF_BREAK\ncase 8:\nFF_RULE_SETUP\n#line 340 \"eval.l\"\n{\n                  fflval.lng = atol(fftext);\n\t\t  return( LONG );\n\t\t}\n\tFF_BREAK\ncase 9:\nFF_RULE_SETUP\n#line 344 \"eval.l\"\n{\n                  if ((fftext[0] == 't') || (fftext[0] == 'T'))\n\t\t    fflval.log = 1;\n\t\t  else\n\t\t    fflval.log = 0;\n\t\t  return( BOOLEAN );\n\t\t}\n\tFF_BREAK\ncase 10:\nFF_RULE_SETUP\n#line 351 \"eval.l\"\n{\n                  fflval.dbl = atof(fftext);\n\t\t  return( DOUBLE );\n\t\t}\n\tFF_BREAK\ncase 11:\nFF_RULE_SETUP\n#line 355 \"eval.l\"\n{\n                  if(        !fits_strcasecmp(fftext,\"#PI\") ) {\n\t\t     fflval.dbl = (double)(4) * atan((double)(1));\n\t\t     return( DOUBLE );\n\t\t  } else if( !fits_strcasecmp(fftext,\"#E\") ) {\n\t\t     fflval.dbl = exp((double)(1));\n\t\t     return( DOUBLE );\n\t\t  } else if( !fits_strcasecmp(fftext,\"#DEG\") ) {\n\t\t     fflval.dbl = ((double)4)*atan((double)1)/((double)180);\n\t\t     return( DOUBLE );\n\t\t  } else if( !fits_strcasecmp(fftext,\"#ROW\") ) {\n\t\t     return( ROWREF );\n\t\t  } else if( !fits_strcasecmp(fftext,\"#NULL\") ) {\n\t\t     return( NULLREF );\n\t\t  } else if( !fits_strcasecmp(fftext,\"#SNULL\") ) {\n\t\t     return( SNULLREF );\n\t\t  } else {\n                     int len; \n                     if (fftext[1] == '$') {\n                        len = strlen(fftext) - 3;\n                        fflval.str[0]     = '#';\n                        strncpy(fflval.str+1,&fftext[2],len);\n                        fflval.str[len+1] = '\\0';\n                        fftext = fflval.str;\n\t\t     }\n                     return( (*gParse.getData)(fftext, &fflval) );\n                  }\n                }\n\tFF_BREAK\ncase 12:\nFF_RULE_SETUP\n#line 383 \"eval.l\"\n{\n                  int len;\n                  len = strlen(fftext) - 2;\n\t\t  if (len >= MAX_STRLEN) {\n\t\t    char errMsg[100];\n\t\t    gParse.status = PARSE_SYNTAX_ERR;\n\t\t    strcpy (errMsg,\"String exceeds maximum length: '\");\n\t\t    strncat(errMsg, &(fftext[1]), 20);\n\t\t    strcat (errMsg,\"...'\");\n\t\t    ffpmsg (errMsg);\n\t\t    len = 0;\n\t\t  } else {\n\t\t    strncpy(fflval.str,&fftext[1],len);\n\t\t  }\n\t\t  fflval.str[len] = '\\0';\n\t\t  return( STRING );\n\t\t}\n\tFF_BREAK\ncase 13:\nFF_RULE_SETUP\n#line 400 \"eval.l\"\n{\n\t\t int    len,type;\n\n                 if (fftext[0] == '$') {\n\t\t    len = strlen(fftext) - 2;\n\t\t    strncpy(fflval.str,&fftext[1],len);\n\t\t    fflval.str[len] = '\\0';\n\t\t    fftext = fflval.str;\n\t\t } \n\t\t type = ffGetVariable(fftext, &fflval);\n\t\t return( type );\n\t\t}\n\tFF_BREAK\ncase 14:\nFF_RULE_SETUP\n#line 412 \"eval.l\"\n{\n                  char *fname;\n\t\t  int len=0;\n                  fname = &fflval.str[0];\n\t\t  while( (fname[len]=toupper(fftext[len])) ) len++;\n\n                  if(      FSTRCMP(fname,\"BOX(\")==0 \n                        || FSTRCMP(fname,\"CIRCLE(\")==0 \n                        || FSTRCMP(fname,\"ELLIPSE(\")==0 \n                        || FSTRCMP(fname,\"NEAR(\")==0 \n                        || FSTRCMP(fname,\"ISNULL(\")==0 \n                         )\n                     /* Return type is always boolean  */\n\t\t     return( BFUNCTION );\n\n                  else if( FSTRCMP(fname,\"GTIFILTER(\")==0 )\n                     return( GTIFILTER );\n\n                  else if( FSTRCMP(fname,\"GTIOVERLAP(\")==0 )\n                     return( GTIOVERLAP );\n\n                  else if( FSTRCMP(fname,\"REGFILTER(\")==0 )\n                     return( REGFILTER );\n\n                  else if( FSTRCMP(fname,\"STRSTR(\")==0 )\n                     return( IFUNCTION );  /* Returns integer */\n\n                  else \n\t\t     return( FUNCTION  );\n\t\t}\n\tFF_BREAK\ncase 15:\nFF_RULE_SETUP\n#line 442 \"eval.l\"\n{ return( INTCAST ); }\n\tFF_BREAK\ncase 16:\nFF_RULE_SETUP\n#line 443 \"eval.l\"\n{ return( FLTCAST ); }\n\tFF_BREAK\ncase 17:\nFF_RULE_SETUP\n#line 444 \"eval.l\"\n{ return( POWER   ); }\n\tFF_BREAK\ncase 18:\nFF_RULE_SETUP\n#line 445 \"eval.l\"\n{ return( NOT     ); }\n\tFF_BREAK\ncase 19:\nFF_RULE_SETUP\n#line 446 \"eval.l\"\n{ return( OR      ); }\n\tFF_BREAK\ncase 20:\nFF_RULE_SETUP\n#line 447 \"eval.l\"\n{ return( AND     ); }\n\tFF_BREAK\ncase 21:\nFF_RULE_SETUP\n#line 448 \"eval.l\"\n{ return( EQ      ); }\n\tFF_BREAK\ncase 22:\nFF_RULE_SETUP\n#line 449 \"eval.l\"\n{ return( NE      ); }\n\tFF_BREAK\ncase 23:\nFF_RULE_SETUP\n#line 450 \"eval.l\"\n{ return( GT      ); }\n\tFF_BREAK\ncase 24:\nFF_RULE_SETUP\n#line 451 \"eval.l\"\n{ return( LT      ); }\n\tFF_BREAK\ncase 25:\nFF_RULE_SETUP\n#line 452 \"eval.l\"\n{ return( GTE     ); }\n\tFF_BREAK\ncase 26:\nFF_RULE_SETUP\n#line 453 \"eval.l\"\n{ return( LTE     ); }\n\tFF_BREAK\ncase 27:\nFF_RULE_SETUP\n#line 454 \"eval.l\"\n{ return( XOR     ); }\n\tFF_BREAK\ncase 28:\n/* rule 28 can match eol */\nFF_RULE_SETUP\n#line 455 \"eval.l\"\n{ return( '\\n'    ); }\n\tFF_BREAK\ncase 29:\nFF_RULE_SETUP\n#line 456 \"eval.l\"\n{ return( fftext[0] ); }\n\tFF_BREAK\ncase 30:\nFF_RULE_SETUP\n#line 457 \"eval.l\"\nECHO;\n\tFF_BREAK\n#line 1426 \"<stdout>\"\ncase FF_STATE_EOF(INITIAL):\n\tffterminate();\n\n\tcase FF_END_OF_BUFFER:\n\t\t{\n\t\t/* Amount of text matched not including the EOB char. */\n\t\tint ff_amount_of_matched_text = (int) (ff_cp - (fftext_ptr)) - 1;\n\n\t\t/* Undo the effects of FF_DO_BEFORE_ACTION. */\n\t\t*ff_cp = (ff_hold_char);\n\t\tFF_RESTORE_FF_MORE_OFFSET\n\n\t\tif ( FF_CURRENT_BUFFER_LVALUE->ff_buffer_status == FF_BUFFER_NEW )\n\t\t\t{\n\t\t\t/* We're scanning a new file or input source.  It's\n\t\t\t * possible that this happened because the user\n\t\t\t * just pointed ffin at a new source and called\n\t\t\t * fflex().  If so, then we have to assure\n\t\t\t * consistency between FF_CURRENT_BUFFER and our\n\t\t\t * globals.  Here is the right place to do so, because\n\t\t\t * this is the first action (other than possibly a\n\t\t\t * back-up) that will match for the new input source.\n\t\t\t */\n\t\t\t(ff_n_chars) = FF_CURRENT_BUFFER_LVALUE->ff_n_chars;\n\t\t\tFF_CURRENT_BUFFER_LVALUE->ff_input_file = ffin;\n\t\t\tFF_CURRENT_BUFFER_LVALUE->ff_buffer_status = FF_BUFFER_NORMAL;\n\t\t\t}\n\n\t\t/* Note that here we test for ff_c_buf_p \"<=\" to the position\n\t\t * of the first EOB in the buffer, since ff_c_buf_p will\n\t\t * already have been incremented past the NUL character\n\t\t * (since all states make transitions on EOB to the\n\t\t * end-of-buffer state).  Contrast this with the test\n\t\t * in input().\n\t\t */\n\t\tif ( (ff_c_buf_p) <= &FF_CURRENT_BUFFER_LVALUE->ff_ch_buf[(ff_n_chars)] )\n\t\t\t{ /* This was really a NUL. */\n\t\t\tff_state_type ff_next_state;\n\n\t\t\t(ff_c_buf_p) = (fftext_ptr) + ff_amount_of_matched_text;\n\n\t\t\tff_current_state = ff_get_previous_state(  );\n\n\t\t\t/* Okay, we're now positioned to make the NUL\n\t\t\t * transition.  We couldn't have\n\t\t\t * ff_get_previous_state() go ahead and do it\n\t\t\t * for us because it doesn't know how to deal\n\t\t\t * with the possibility of jamming (and we don't\n\t\t\t * want to build jamming into it because then it\n\t\t\t * will run more slowly).\n\t\t\t */\n\n\t\t\tff_next_state = ff_try_NUL_trans( ff_current_state );\n\n\t\t\tff_bp = (fftext_ptr) + FF_MORE_ADJ;\n\n\t\t\tif ( ff_next_state )\n\t\t\t\t{\n\t\t\t\t/* Consume the NUL. */\n\t\t\t\tff_cp = ++(ff_c_buf_p);\n\t\t\t\tff_current_state = ff_next_state;\n\t\t\t\tgoto ff_match;\n\t\t\t\t}\n\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tff_cp = (ff_c_buf_p);\n\t\t\t\tgoto ff_find_action;\n\t\t\t\t}\n\t\t\t}\n\n\t\telse switch ( ff_get_next_buffer(  ) )\n\t\t\t{\n\t\t\tcase EOB_ACT_END_OF_FILE:\n\t\t\t\t{\n\t\t\t\t(ff_did_buffer_switch_on_eof) = 0;\n\n\t\t\t\tif ( ffwrap( ) )\n\t\t\t\t\t{\n\t\t\t\t\t/* Note: because we've taken care in\n\t\t\t\t\t * ff_get_next_buffer() to have set up\n\t\t\t\t\t * fftext, we can now set up\n\t\t\t\t\t * ff_c_buf_p so that if some total\n\t\t\t\t\t * hoser (like flex itself) wants to\n\t\t\t\t\t * call the scanner after we return the\n\t\t\t\t\t * FF_NULL, it'll still work - another\n\t\t\t\t\t * FF_NULL will get returned.\n\t\t\t\t\t */\n\t\t\t\t\t(ff_c_buf_p) = (fftext_ptr) + FF_MORE_ADJ;\n\n\t\t\t\t\tff_act = FF_STATE_EOF(FF_START);\n\t\t\t\t\tgoto do_action;\n\t\t\t\t\t}\n\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\tif ( ! (ff_did_buffer_switch_on_eof) )\n\t\t\t\t\t\tFF_NEW_FILE;\n\t\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\tcase EOB_ACT_CONTINUE_SCAN:\n\t\t\t\t(ff_c_buf_p) =\n\t\t\t\t\t(fftext_ptr) + ff_amount_of_matched_text;\n\n\t\t\t\tff_current_state = ff_get_previous_state(  );\n\n\t\t\t\tff_cp = (ff_c_buf_p);\n\t\t\t\tff_bp = (fftext_ptr) + FF_MORE_ADJ;\n\t\t\t\tgoto ff_match;\n\n\t\t\tcase EOB_ACT_LAST_MATCH:\n\t\t\t\t(ff_c_buf_p) =\n\t\t\t\t&FF_CURRENT_BUFFER_LVALUE->ff_ch_buf[(ff_n_chars)];\n\n\t\t\t\tff_current_state = ff_get_previous_state(  );\n\n\t\t\t\tff_cp = (ff_c_buf_p);\n\t\t\t\tff_bp = (fftext_ptr) + FF_MORE_ADJ;\n\t\t\t\tgoto ff_find_action;\n\t\t\t}\n\t\tbreak;\n\t\t}\n\n\tdefault:\n\t\tFF_FATAL_ERROR(\n\t\t\t\"fatal flex scanner internal error--no action found\" );\n\t} /* end of action switch */\n\t\t} /* end of scanning one token */\n} /* end of fflex */\n\n/* ff_get_next_buffer - try to read in a new buffer\n *\n * Returns a code representing an action:\n *\tEOB_ACT_LAST_MATCH -\n *\tEOB_ACT_CONTINUE_SCAN - continue scanning from current position\n *\tEOB_ACT_END_OF_FILE - end of file\n */\nstatic int ff_get_next_buffer (void)\n{\n    \tregister char *dest = FF_CURRENT_BUFFER_LVALUE->ff_ch_buf;\n\tregister char *source = (fftext_ptr);\n\tregister int number_to_move, i;\n\tint ret_val;\n\n\tif ( (ff_c_buf_p) > &FF_CURRENT_BUFFER_LVALUE->ff_ch_buf[(ff_n_chars) + 1] )\n\t\tFF_FATAL_ERROR(\n\t\t\"fatal flex scanner internal error--end of buffer missed\" );\n\n\tif ( FF_CURRENT_BUFFER_LVALUE->ff_fill_buffer == 0 )\n\t\t{ /* Don't try to fill the buffer, so this is an EOF. */\n\t\tif ( (ff_c_buf_p) - (fftext_ptr) - FF_MORE_ADJ == 1 )\n\t\t\t{\n\t\t\t/* We matched a single character, the EOB, so\n\t\t\t * treat this as a final EOF.\n\t\t\t */\n\t\t\treturn EOB_ACT_END_OF_FILE;\n\t\t\t}\n\n\t\telse\n\t\t\t{\n\t\t\t/* We matched some text prior to the EOB, first\n\t\t\t * process it.\n\t\t\t */\n\t\t\treturn EOB_ACT_LAST_MATCH;\n\t\t\t}\n\t\t}\n\n\t/* Try to read more data. */\n\n\t/* First move last chars to start of buffer. */\n\tnumber_to_move = (int) ((ff_c_buf_p) - (fftext_ptr)) - 1;\n\n\tfor ( i = 0; i < number_to_move; ++i )\n\t\t*(dest++) = *(source++);\n\n\tif ( FF_CURRENT_BUFFER_LVALUE->ff_buffer_status == FF_BUFFER_EOF_PENDING )\n\t\t/* don't do the read, it's not guaranteed to return an EOF,\n\t\t * just force an EOF\n\t\t */\n\t\tFF_CURRENT_BUFFER_LVALUE->ff_n_chars = (ff_n_chars) = 0;\n\n\telse\n\t\t{\n\t\t\tff_size_t num_to_read =\n\t\t\tFF_CURRENT_BUFFER_LVALUE->ff_buf_size - number_to_move - 1;\n\n\t\twhile ( num_to_read <= 0 )\n\t\t\t{ /* Not enough room in the buffer - grow it. */\n\n\t\t\t/* just a shorter name for the current buffer */\n\t\t\tFF_BUFFER_STATE b = FF_CURRENT_BUFFER;\n\n\t\t\tint ff_c_buf_p_offset =\n\t\t\t\t(int) ((ff_c_buf_p) - b->ff_ch_buf);\n\n\t\t\tif ( b->ff_is_our_buffer )\n\t\t\t\t{\n\t\t\t\tff_size_t new_size = b->ff_buf_size * 2;\n\n\t\t\t\tif ( new_size <= 0 )\n\t\t\t\t\tb->ff_buf_size += b->ff_buf_size / 8;\n\t\t\t\telse\n\t\t\t\t\tb->ff_buf_size *= 2;\n\n\t\t\t\tb->ff_ch_buf = (char *)\n\t\t\t\t\t/* Include room in for 2 EOB chars. */\n\t\t\t\t\tffrealloc((void *) b->ff_ch_buf,b->ff_buf_size + 2  );\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t/* Can't grow it, we don't own it. */\n\t\t\t\tb->ff_ch_buf = 0;\n\n\t\t\tif ( ! b->ff_ch_buf )\n\t\t\t\tFF_FATAL_ERROR(\n\t\t\t\t\"fatal error - scanner input buffer overflow\" );\n\n\t\t\t(ff_c_buf_p) = &b->ff_ch_buf[ff_c_buf_p_offset];\n\n\t\t\tnum_to_read = FF_CURRENT_BUFFER_LVALUE->ff_buf_size -\n\t\t\t\t\t\tnumber_to_move - 1;\n\n\t\t\t}\n\n\t\tif ( num_to_read > FF_READ_BUF_SIZE )\n\t\t\tnum_to_read = FF_READ_BUF_SIZE;\n\n\t\t/* Read in more data. */\n\t\tFF_INPUT( (&FF_CURRENT_BUFFER_LVALUE->ff_ch_buf[number_to_move]),\n\t\t\t(ff_n_chars), num_to_read );\n\n\t\tFF_CURRENT_BUFFER_LVALUE->ff_n_chars = (ff_n_chars);\n\t\t}\n\n\tif ( (ff_n_chars) == 0 )\n\t\t{\n\t\tif ( number_to_move == FF_MORE_ADJ )\n\t\t\t{\n\t\t\tret_val = EOB_ACT_END_OF_FILE;\n\t\t\tffrestart(ffin  );\n\t\t\t}\n\n\t\telse\n\t\t\t{\n\t\t\tret_val = EOB_ACT_LAST_MATCH;\n\t\t\tFF_CURRENT_BUFFER_LVALUE->ff_buffer_status =\n\t\t\t\tFF_BUFFER_EOF_PENDING;\n\t\t\t}\n\t\t}\n\n\telse\n\t\tret_val = EOB_ACT_CONTINUE_SCAN;\n\n\tif ((ff_size_t) ((ff_n_chars) + number_to_move) > FF_CURRENT_BUFFER_LVALUE->ff_buf_size) {\n\t\t/* Extend the array by 50%, plus the number we really need. */\n\t\tff_size_t new_size = (ff_n_chars) + number_to_move + ((ff_n_chars) >> 1);\n\t\tFF_CURRENT_BUFFER_LVALUE->ff_ch_buf = (char *) ffrealloc((void *) FF_CURRENT_BUFFER_LVALUE->ff_ch_buf,new_size  );\n\t\tif ( ! FF_CURRENT_BUFFER_LVALUE->ff_ch_buf )\n\t\t\tFF_FATAL_ERROR( \"out of dynamic memory in ff_get_next_buffer()\" );\n\t}\n\n\t(ff_n_chars) += number_to_move;\n\tFF_CURRENT_BUFFER_LVALUE->ff_ch_buf[(ff_n_chars)] = FF_END_OF_BUFFER_CHAR;\n\tFF_CURRENT_BUFFER_LVALUE->ff_ch_buf[(ff_n_chars) + 1] = FF_END_OF_BUFFER_CHAR;\n\n\t(fftext_ptr) = &FF_CURRENT_BUFFER_LVALUE->ff_ch_buf[0];\n\n\treturn ret_val;\n}\n\n/* ff_get_previous_state - get the state just before the EOB char was reached */\n\n    static ff_state_type ff_get_previous_state (void)\n{\n\tregister ff_state_type ff_current_state;\n\tregister char *ff_cp;\n    \n\tff_current_state = (ff_start);\n\n\tfor ( ff_cp = (fftext_ptr) + FF_MORE_ADJ; ff_cp < (ff_c_buf_p); ++ff_cp )\n\t\t{\n\t\tregister FF_CHAR ff_c = (*ff_cp ? ff_ec[FF_SC_TO_UI(*ff_cp)] : 1);\n\t\tif ( ff_accept[ff_current_state] )\n\t\t\t{\n\t\t\t(ff_last_accepting_state) = ff_current_state;\n\t\t\t(ff_last_accepting_cpos) = ff_cp;\n\t\t\t}\n\t\twhile ( ff_chk[ff_base[ff_current_state] + ff_c] != ff_current_state )\n\t\t\t{\n\t\t\tff_current_state = (int) ff_def[ff_current_state];\n\t\t\tif ( ff_current_state >= 174 )\n\t\t\t\tff_c = ff_meta[(unsigned int) ff_c];\n\t\t\t}\n\t\tff_current_state = ff_nxt[ff_base[ff_current_state] + (unsigned int) ff_c];\n\t\t}\n\n\treturn ff_current_state;\n}\n\n/* ff_try_NUL_trans - try to make a transition on the NUL character\n *\n * synopsis\n *\tnext_state = ff_try_NUL_trans( current_state );\n */\n    static ff_state_type ff_try_NUL_trans  (ff_state_type ff_current_state )\n{\n\tregister int ff_is_jam;\n    \tregister char *ff_cp = (ff_c_buf_p);\n\n\tregister FF_CHAR ff_c = 1;\n\tif ( ff_accept[ff_current_state] )\n\t\t{\n\t\t(ff_last_accepting_state) = ff_current_state;\n\t\t(ff_last_accepting_cpos) = ff_cp;\n\t\t}\n\twhile ( ff_chk[ff_base[ff_current_state] + ff_c] != ff_current_state )\n\t\t{\n\t\tff_current_state = (int) ff_def[ff_current_state];\n\t\tif ( ff_current_state >= 174 )\n\t\t\tff_c = ff_meta[(unsigned int) ff_c];\n\t\t}\n\tff_current_state = ff_nxt[ff_base[ff_current_state] + (unsigned int) ff_c];\n\tff_is_jam = (ff_current_state == 173);\n\n\treturn ff_is_jam ? 0 : ff_current_state;\n}\n\n    static void ffunput (int c, register char * ff_bp )\n{\n\tregister char *ff_cp;\n    \n    ff_cp = (ff_c_buf_p);\n\n\t/* undo effects of setting up fftext */\n\t*ff_cp = (ff_hold_char);\n\n\tif ( ff_cp < FF_CURRENT_BUFFER_LVALUE->ff_ch_buf + 2 )\n\t\t{ /* need to shift things up to make room */\n\t\t/* +2 for EOB chars. */\n\t\tregister ff_size_t number_to_move = (ff_n_chars) + 2;\n\t\tregister char *dest = &FF_CURRENT_BUFFER_LVALUE->ff_ch_buf[\n\t\t\t\t\tFF_CURRENT_BUFFER_LVALUE->ff_buf_size + 2];\n\t\tregister char *source =\n\t\t\t\t&FF_CURRENT_BUFFER_LVALUE->ff_ch_buf[number_to_move];\n\n\t\twhile ( source > FF_CURRENT_BUFFER_LVALUE->ff_ch_buf )\n\t\t\t*--dest = *--source;\n\n\t\tff_cp += (int) (dest - source);\n\t\tff_bp += (int) (dest - source);\n\t\tFF_CURRENT_BUFFER_LVALUE->ff_n_chars =\n\t\t\t(ff_n_chars) = FF_CURRENT_BUFFER_LVALUE->ff_buf_size;\n\n\t\tif ( ff_cp < FF_CURRENT_BUFFER_LVALUE->ff_ch_buf + 2 )\n\t\t\tFF_FATAL_ERROR( \"flex scanner push-back overflow\" );\n\t\t}\n\n\t*--ff_cp = (char) c;\n\n\t(fftext_ptr) = ff_bp;\n\t(ff_hold_char) = *ff_cp;\n\t(ff_c_buf_p) = ff_cp;\n}\n\n#ifndef FF_NO_INPUT\n#ifdef __cplusplus\n    static int ffinput (void)\n#else\n    static int input  (void)\n#endif\n\n{\n\tint c;\n    \n\t*(ff_c_buf_p) = (ff_hold_char);\n\n\tif ( *(ff_c_buf_p) == FF_END_OF_BUFFER_CHAR )\n\t\t{\n\t\t/* ff_c_buf_p now points to the character we want to return.\n\t\t * If this occurs *before* the EOB characters, then it's a\n\t\t * valid NUL; if not, then we've hit the end of the buffer.\n\t\t */\n\t\tif ( (ff_c_buf_p) < &FF_CURRENT_BUFFER_LVALUE->ff_ch_buf[(ff_n_chars)] )\n\t\t\t/* This was really a NUL. */\n\t\t\t*(ff_c_buf_p) = '\\0';\n\n\t\telse\n\t\t\t{ /* need more input */\n\t\t\tff_size_t offset = (ff_c_buf_p) - (fftext_ptr);\n\t\t\t++(ff_c_buf_p);\n\n\t\t\tswitch ( ff_get_next_buffer(  ) )\n\t\t\t\t{\n\t\t\t\tcase EOB_ACT_LAST_MATCH:\n\t\t\t\t\t/* This happens because ff_g_n_b()\n\t\t\t\t\t * sees that we've accumulated a\n\t\t\t\t\t * token and flags that we need to\n\t\t\t\t\t * try matching the token before\n\t\t\t\t\t * proceeding.  But for input(),\n\t\t\t\t\t * there's no matching to consider.\n\t\t\t\t\t * So convert the EOB_ACT_LAST_MATCH\n\t\t\t\t\t * to EOB_ACT_END_OF_FILE.\n\t\t\t\t\t */\n\n\t\t\t\t\t/* Reset buffer status. */\n\t\t\t\t\tffrestart(ffin );\n\n\t\t\t\t\t/*FALLTHROUGH*/\n\n\t\t\t\tcase EOB_ACT_END_OF_FILE:\n\t\t\t\t\t{\n\t\t\t\t\tif ( ffwrap( ) )\n\t\t\t\t\t\treturn 0;\n\n\t\t\t\t\tif ( ! (ff_did_buffer_switch_on_eof) )\n\t\t\t\t\t\tFF_NEW_FILE;\n#ifdef __cplusplus\n\t\t\t\t\treturn ffinput();\n#else\n\t\t\t\t\treturn input();\n#endif\n\t\t\t\t\t}\n\n\t\t\t\tcase EOB_ACT_CONTINUE_SCAN:\n\t\t\t\t\t(ff_c_buf_p) = (fftext_ptr) + offset;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tc = *(unsigned char *) (ff_c_buf_p);\t/* cast for 8-bit char's */\n\t*(ff_c_buf_p) = '\\0';\t/* preserve fftext */\n\t(ff_hold_char) = *++(ff_c_buf_p);\n\n\treturn c;\n}\n#endif\t/* ifndef FF_NO_INPUT */\n\n/** Immediately switch to a different input stream.\n * @param input_file A readable stream.\n * \n * @note This function does not reset the start condition to @c INITIAL .\n */\n    void ffrestart  (FILE * input_file )\n{\n    \n\tif ( ! FF_CURRENT_BUFFER ){\n        ffensure_buffer_stack ();\n\t\tFF_CURRENT_BUFFER_LVALUE =\n            ff_create_buffer(ffin,FF_BUF_SIZE );\n\t}\n\n\tff_init_buffer(FF_CURRENT_BUFFER,input_file );\n\tff_load_buffer_state( );\n}\n\n/** Switch to a different input buffer.\n * @param new_buffer The new input buffer.\n * \n */\n    void ff_switch_to_buffer  (FF_BUFFER_STATE  new_buffer )\n{\n    \n\t/* TODO. We should be able to replace this entire function body\n\t * with\n\t *\t\tffpop_buffer_state();\n\t *\t\tffpush_buffer_state(new_buffer);\n     */\n\tffensure_buffer_stack ();\n\tif ( FF_CURRENT_BUFFER == new_buffer )\n\t\treturn;\n\n\tif ( FF_CURRENT_BUFFER )\n\t\t{\n\t\t/* Flush out information for old buffer. */\n\t\t*(ff_c_buf_p) = (ff_hold_char);\n\t\tFF_CURRENT_BUFFER_LVALUE->ff_buf_pos = (ff_c_buf_p);\n\t\tFF_CURRENT_BUFFER_LVALUE->ff_n_chars = (ff_n_chars);\n\t\t}\n\n\tFF_CURRENT_BUFFER_LVALUE = new_buffer;\n\tff_load_buffer_state( );\n\n\t/* We don't actually know whether we did this switch during\n\t * EOF (ffwrap()) processing, but the only time this flag\n\t * is looked at is after ffwrap() is called, so it's safe\n\t * to go ahead and always set it.\n\t */\n\t(ff_did_buffer_switch_on_eof) = 1;\n}\n\nstatic void ff_load_buffer_state  (void)\n{\n    \t(ff_n_chars) = FF_CURRENT_BUFFER_LVALUE->ff_n_chars;\n\t(fftext_ptr) = (ff_c_buf_p) = FF_CURRENT_BUFFER_LVALUE->ff_buf_pos;\n\tffin = FF_CURRENT_BUFFER_LVALUE->ff_input_file;\n\t(ff_hold_char) = *(ff_c_buf_p);\n}\n\n/** Allocate and initialize an input buffer state.\n * @param file A readable stream.\n * @param size The character buffer size in bytes. When in doubt, use @c FF_BUF_SIZE.\n * \n * @return the allocated buffer state.\n */\n    FF_BUFFER_STATE ff_create_buffer  (FILE * file, int  size )\n{\n\tFF_BUFFER_STATE b;\n    \n\tb = (FF_BUFFER_STATE) ffalloc(sizeof( struct ff_buffer_state )  );\n\tif ( ! b )\n\t\tFF_FATAL_ERROR( \"out of dynamic memory in ff_create_buffer()\" );\n\n\tb->ff_buf_size = size;\n\n\t/* ff_ch_buf has to be 2 characters longer than the size given because\n\t * we need to put in 2 end-of-buffer characters.\n\t */\n\tb->ff_ch_buf = (char *) ffalloc(b->ff_buf_size + 2  );\n\tif ( ! b->ff_ch_buf )\n\t\tFF_FATAL_ERROR( \"out of dynamic memory in ff_create_buffer()\" );\n\n\tb->ff_is_our_buffer = 1;\n\n\tff_init_buffer(b,file );\n\n\treturn b;\n}\n\n/** Destroy the buffer.\n * @param b a buffer created with ff_create_buffer()\n * \n */\n    void ff_delete_buffer (FF_BUFFER_STATE  b )\n{\n    \n\tif ( ! b )\n\t\treturn;\n\n\tif ( b == FF_CURRENT_BUFFER ) /* Not sure if we should pop here. */\n\t\tFF_CURRENT_BUFFER_LVALUE = (FF_BUFFER_STATE) 0;\n\n\tif ( b->ff_is_our_buffer )\n\t\tyyfffree((void *) b->ff_ch_buf  );\n\n\tyyfffree((void *) b  );\n}\n\n#ifndef __cplusplus\nextern int isatty (int );\n#endif /* __cplusplus */\n    \n/* Initializes or reinitializes a buffer.\n * This function is sometimes called more than once on the same buffer,\n * such as during a ffrestart() or at EOF.\n */\n    static void ff_init_buffer  (FF_BUFFER_STATE  b, FILE * file )\n\n{\n\tint oerrno = errno;\n    \n\tff_flush_buffer(b );\n\n\tb->ff_input_file = file;\n\tb->ff_fill_buffer = 1;\n\n    /* If b is the current buffer, then ff_init_buffer was _probably_\n     * called from ffrestart() or through ff_get_next_buffer.\n     * In that case, we don't want to reset the lineno or column.\n     */\n    if (b != FF_CURRENT_BUFFER){\n        b->ff_bs_lineno = 1;\n        b->ff_bs_column = 0;\n    }\n\n        b->ff_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;\n    \n\terrno = oerrno;\n}\n\n/** Discard all buffered characters. On the next scan, FF_INPUT will be called.\n * @param b the buffer state to be flushed, usually @c FF_CURRENT_BUFFER.\n * \n */\n    void ff_flush_buffer (FF_BUFFER_STATE  b )\n{\n    \tif ( ! b )\n\t\treturn;\n\n\tb->ff_n_chars = 0;\n\n\t/* We always need two end-of-buffer characters.  The first causes\n\t * a transition to the end-of-buffer state.  The second causes\n\t * a jam in that state.\n\t */\n\tb->ff_ch_buf[0] = FF_END_OF_BUFFER_CHAR;\n\tb->ff_ch_buf[1] = FF_END_OF_BUFFER_CHAR;\n\n\tb->ff_buf_pos = &b->ff_ch_buf[0];\n\n\tb->ff_at_bol = 1;\n\tb->ff_buffer_status = FF_BUFFER_NEW;\n\n\tif ( b == FF_CURRENT_BUFFER )\n\t\tff_load_buffer_state( );\n}\n\n/** Pushes the new state onto the stack. The new state becomes\n *  the current state. This function will allocate the stack\n *  if necessary.\n *  @param new_buffer The new state.\n *  \n */\nvoid ffpush_buffer_state (FF_BUFFER_STATE new_buffer )\n{\n    \tif (new_buffer == NULL)\n\t\treturn;\n\n\tffensure_buffer_stack();\n\n\t/* This block is copied from ff_switch_to_buffer. */\n\tif ( FF_CURRENT_BUFFER )\n\t\t{\n\t\t/* Flush out information for old buffer. */\n\t\t*(ff_c_buf_p) = (ff_hold_char);\n\t\tFF_CURRENT_BUFFER_LVALUE->ff_buf_pos = (ff_c_buf_p);\n\t\tFF_CURRENT_BUFFER_LVALUE->ff_n_chars = (ff_n_chars);\n\t\t}\n\n\t/* Only push if top exists. Otherwise, replace top. */\n\tif (FF_CURRENT_BUFFER)\n\t\t(ff_buffer_stack_top)++;\n\tFF_CURRENT_BUFFER_LVALUE = new_buffer;\n\n\t/* copied from ff_switch_to_buffer. */\n\tff_load_buffer_state( );\n\t(ff_did_buffer_switch_on_eof) = 1;\n}\n\n/** Removes and deletes the top of the stack, if present.\n *  The next element becomes the new top.\n *  \n */\nvoid ffpop_buffer_state (void)\n{\n    \tif (!FF_CURRENT_BUFFER)\n\t\treturn;\n\n\tff_delete_buffer(FF_CURRENT_BUFFER );\n\tFF_CURRENT_BUFFER_LVALUE = NULL;\n\tif ((ff_buffer_stack_top) > 0)\n\t\t--(ff_buffer_stack_top);\n\n\tif (FF_CURRENT_BUFFER) {\n\t\tff_load_buffer_state( );\n\t\t(ff_did_buffer_switch_on_eof) = 1;\n\t}\n}\n\n/* Allocates the stack if it does not exist.\n *  Guarantees space for at least one push.\n */\nstatic void ffensure_buffer_stack (void)\n{\n\tff_size_t num_to_alloc;\n    \n\tif (!(ff_buffer_stack)) {\n\n\t\t/* First allocation is just for 2 elements, since we don't know if this\n\t\t * scanner will even need a stack. We use 2 instead of 1 to avoid an\n\t\t * immediate realloc on the next call.\n         */\n\t\tnum_to_alloc = 1;\n\t\t(ff_buffer_stack) = (struct ff_buffer_state**)ffalloc\n\t\t\t\t\t\t\t\t(num_to_alloc * sizeof(struct ff_buffer_state*)\n\t\t\t\t\t\t\t\t);\n\t\tif ( ! (ff_buffer_stack) )\n\t\t\tFF_FATAL_ERROR( \"out of dynamic memory in ffensure_buffer_stack()\" );\n\t\t\t\t\t\t\t\t  \n\t\tmemset((ff_buffer_stack), 0, num_to_alloc * sizeof(struct ff_buffer_state*));\n\t\t\t\t\n\t\t(ff_buffer_stack_max) = num_to_alloc;\n\t\t(ff_buffer_stack_top) = 0;\n\t\treturn;\n\t}\n\n\tif ((ff_buffer_stack_top) >= ((ff_buffer_stack_max)) - 1){\n\n\t\t/* Increase the buffer to prepare for a possible push. */\n\t\tint grow_size = 8 /* arbitrary grow size */;\n\n\t\tnum_to_alloc = (ff_buffer_stack_max) + grow_size;\n\t\t(ff_buffer_stack) = (struct ff_buffer_state**)ffrealloc\n\t\t\t\t\t\t\t\t((ff_buffer_stack),\n\t\t\t\t\t\t\t\tnum_to_alloc * sizeof(struct ff_buffer_state*)\n\t\t\t\t\t\t\t\t);\n\t\tif ( ! (ff_buffer_stack) )\n\t\t\tFF_FATAL_ERROR( \"out of dynamic memory in ffensure_buffer_stack()\" );\n\n\t\t/* zero only the new slots.*/\n\t\tmemset((ff_buffer_stack) + (ff_buffer_stack_max), 0, grow_size * sizeof(struct ff_buffer_state*));\n\t\t(ff_buffer_stack_max) = num_to_alloc;\n\t}\n}\n\n/** Setup the input buffer state to scan directly from a user-specified character buffer.\n * @param base the character buffer\n * @param size the size in bytes of the character buffer\n * \n * @return the newly allocated buffer state object. \n */\nFF_BUFFER_STATE ff_scan_buffer  (char * base, ff_size_t  size )\n{\n\tFF_BUFFER_STATE b;\n    \n\tif ( size < 2 ||\n\t     base[size-2] != FF_END_OF_BUFFER_CHAR ||\n\t     base[size-1] != FF_END_OF_BUFFER_CHAR )\n\t\t/* They forgot to leave room for the EOB's. */\n\t\treturn 0;\n\n\tb = (FF_BUFFER_STATE) ffalloc(sizeof( struct ff_buffer_state )  );\n\tif ( ! b )\n\t\tFF_FATAL_ERROR( \"out of dynamic memory in ff_scan_buffer()\" );\n\n\tb->ff_buf_size = size - 2;\t/* \"- 2\" to take care of EOB's */\n\tb->ff_buf_pos = b->ff_ch_buf = base;\n\tb->ff_is_our_buffer = 0;\n\tb->ff_input_file = 0;\n\tb->ff_n_chars = b->ff_buf_size;\n\tb->ff_is_interactive = 0;\n\tb->ff_at_bol = 1;\n\tb->ff_fill_buffer = 0;\n\tb->ff_buffer_status = FF_BUFFER_NEW;\n\n\tff_switch_to_buffer(b  );\n\n\treturn b;\n}\n\n/** Setup the input buffer state to scan a string. The next call to fflex() will\n * scan from a @e copy of @a str.\n * @param ffstr a NUL-terminated string to scan\n * \n * @return the newly allocated buffer state object.\n * @note If you want to scan bytes that may contain NUL values, then use\n *       ff_scan_bytes() instead.\n */\nFF_BUFFER_STATE ff_scan_string (ffconst char * ffstr )\n{\n    \n\treturn ff_scan_bytes(ffstr,strlen(ffstr) );\n}\n\n/** Setup the input buffer state to scan the given bytes. The next call to fflex() will\n * scan from a @e copy of @a bytes.\n * @param bytes the byte buffer to scan\n * @param len the number of bytes in the buffer pointed to by @a bytes.\n * \n * @return the newly allocated buffer state object.\n */\nFF_BUFFER_STATE ff_scan_bytes  (ffconst char * ffbytes, ff_size_t  _ffbytes_len )\n{\n\tFF_BUFFER_STATE b;\n\tchar *buf;\n\tff_size_t n, i;\n    \n\t/* Get memory for full buffer, including space for trailing EOB's. */\n\tn = _ffbytes_len + 2;\n\tbuf = (char *) ffalloc(n  );\n\tif ( ! buf )\n\t\tFF_FATAL_ERROR( \"out of dynamic memory in ff_scan_bytes()\" );\n\n\tfor ( i = 0; i < _ffbytes_len; ++i )\n\t\tbuf[i] = ffbytes[i];\n\n\tbuf[_ffbytes_len] = buf[_ffbytes_len+1] = FF_END_OF_BUFFER_CHAR;\n\n\tb = ff_scan_buffer(buf,n );\n\tif ( ! b )\n\t\tFF_FATAL_ERROR( \"bad buffer in ff_scan_bytes()\" );\n\n\t/* It's okay to grow etc. this buffer, and we should throw it\n\t * away when we're done.\n\t */\n\tb->ff_is_our_buffer = 1;\n\n\treturn b;\n}\n\n#ifndef FF_EXIT_FAILURE\n#define FF_EXIT_FAILURE 2\n#endif\n\nstatic void ff_fatal_error (ffconst char* msg )\n{\n    \t(void) fprintf( stderr, \"%s\\n\", msg );\n\texit( FF_EXIT_FAILURE );\n}\n\n/* Redefine ffless() so it works in section 3 code. */\n\n#undef ffless\n#define ffless(n) \\\n\tdo \\\n\t\t{ \\\n\t\t/* Undo effects of setting up fftext. */ \\\n        int ffless_macro_arg = (n); \\\n        FF_LESS_LINENO(ffless_macro_arg);\\\n\t\tfftext[ffleng] = (ff_hold_char); \\\n\t\t(ff_c_buf_p) = fftext + ffless_macro_arg; \\\n\t\t(ff_hold_char) = *(ff_c_buf_p); \\\n\t\t*(ff_c_buf_p) = '\\0'; \\\n\t\tffleng = ffless_macro_arg; \\\n\t\t} \\\n\twhile ( 0 )\n\n/* Accessor  methods (get/set functions) to struct members. */\n\n/** Get the current line number.\n * \n */\nint ffget_lineno  (void)\n{\n        \n    return fflineno;\n}\n\n/** Get the input stream.\n * \n */\nFILE *ffget_in  (void)\n{\n        return ffin;\n}\n\n/** Get the output stream.\n * \n */\nFILE *ffget_out  (void)\n{\n        return ffout;\n}\n\n/** Get the length of the current token.\n * \n */\nff_size_t ffget_leng  (void)\n{\n        return ffleng;\n}\n\n/** Get the current token.\n * \n */\n\nchar *ffget_text  (void)\n{\n        return fftext;\n}\n\n/** Set the current line number.\n * @param line_number\n * \n */\nvoid ffset_lineno (int  line_number )\n{\n    \n    fflineno = line_number;\n}\n\n/** Set the input stream. This does not discard the current\n * input buffer.\n * @param in_str A readable stream.\n * \n * @see ff_switch_to_buffer\n */\nvoid ffset_in (FILE *  in_str )\n{\n        ffin = in_str ;\n}\n\nvoid ffset_out (FILE *  out_str )\n{\n        ffout = out_str ;\n}\n\nint ffget_debug  (void)\n{\n        return ff_flex_debug;\n}\n\nvoid ffset_debug (int  bdebug )\n{\n        ff_flex_debug = bdebug ;\n}\n\nstatic int ff_init_globals (void)\n{\n        /* Initialization is the same as for the non-reentrant scanner.\n     * This function is called from fflex_destroy(), so don't allocate here.\n     */\n\n    (ff_buffer_stack) = 0;\n    (ff_buffer_stack_top) = 0;\n    (ff_buffer_stack_max) = 0;\n    (ff_c_buf_p) = (char *) 0;\n    (ff_init) = 0;\n    (ff_start) = 0;\n\n/* Defined in main.c */\n#ifdef FF_STDINIT\n    ffin = stdin;\n    ffout = stdout;\n#else\n    ffin = (FILE *) 0;\n    ffout = (FILE *) 0;\n#endif\n\n    /* For future reference: Set errno on error, since we are called by\n     * fflex_init()\n     */\n    return 0;\n}\n\n/* fflex_destroy is for both reentrant and non-reentrant scanners. */\nint fflex_destroy  (void)\n{\n    \n    /* Pop the buffer stack, destroying each element. */\n\twhile(FF_CURRENT_BUFFER){\n\t\tff_delete_buffer(FF_CURRENT_BUFFER  );\n\t\tFF_CURRENT_BUFFER_LVALUE = NULL;\n\t\tffpop_buffer_state();\n\t}\n\n\t/* Destroy the stack itself. */\n\tyyfffree((ff_buffer_stack) );\n\t(ff_buffer_stack) = NULL;\n\n    /* Reset the globals. This is important in a non-reentrant scanner so the next time\n     * fflex() is called, initialization will occur. */\n    ff_init_globals( );\n\n    return 0;\n}\n\n/*\n * Internal utility routines.\n */\n\n#ifndef fftext_ptr\nstatic void ff_flex_strncpy (char* s1, ffconst char * s2, int n )\n{\n\tregister int i;\n\tfor ( i = 0; i < n; ++i )\n\t\ts1[i] = s2[i];\n}\n#endif\n\n#ifdef FF_NEED_STRLEN\nstatic int ff_flex_strlen (ffconst char * s )\n{\n\tregister int n;\n\tfor ( n = 0; s[n]; ++n )\n\t\t;\n\n\treturn n;\n}\n#endif\n\nvoid *ffalloc (ff_size_t  size )\n{\n\treturn (void *) malloc( size );\n}\n\nvoid *ffrealloc  (void * ptr, ff_size_t  size )\n{\n\t/* The cast to (char *) in the following accommodates both\n\t * implementations that use char* generic pointers, and those\n\t * that use void* generic pointers.  It works with the latter\n\t * because both ANSI C and C++ allow castless assignment from\n\t * any pointer type to void*, and deal with argument conversions\n\t * as though doing an assignment.\n\t */\n\treturn (void *) realloc( (char *) ptr, size );\n}\n\nvoid yyfffree (void * ptr )\n{\n\tfree( (char *) ptr );\t/* see ffrealloc() for (char *) cast */\n}\n\n#define FFTABLES_NAME \"fftables\"\n\n#line 457 \"eval.l\"\n\n\n\nint ffwrap()\n{\n  /* MJT -- 13 June 1996\n     Supplied for compatibility with\n     pre-2.5.1 versions of flex which\n     do not recognize %option noffwrap \n  */\n  return(1);\n}\n\n/* \n   expr_read is lifted from old ftools.skel. \n   Now we can use any version of flex with\n   no .skel file necessary! MJT - 13 June 1996\n\n   keep a memory of how many bytes have been\n   read previously, so that an unlimited-sized\n   buffer can be supported. PDW - 28 Feb 1998\n*/\n\nstatic int expr_read(char *buf, int nbytes)\n{\n int n;\n \n n = 0;\n if( !gParse.is_eobuf ) {\n     do {\n        buf[n++] = gParse.expr[gParse.index++];\n       } while ((n<nbytes)&&(gParse.expr[gParse.index] != '\\0'));\n     if( gParse.expr[gParse.index] == '\\0' ) gParse.is_eobuf = 1;\n }\n buf[n] = '\\0';\n return(n);\n}\n\nint ffGetVariable( char *varName, FFSTYPE *thelval )\n{\n   int varNum, type;\n   char errMsg[MAXVARNAME+25];\n\n   varNum = find_variable( varName );\n   if( varNum<0 ) {\n      if( gParse.getData ) {\n\t type = (*gParse.getData)( varName, thelval );\n      } else {\n\t type = pERROR;\n\t gParse.status = PARSE_SYNTAX_ERR;\n\t strcpy (errMsg,\"Unable to find data: \");\n\t strncat(errMsg, varName, MAXVARNAME);\n\t ffpmsg (errMsg);\n      }\n   } else {\n      /*  Convert variable type into expression type  */\n      switch( gParse.varData[ varNum ].type ) {\n      case LONG:\n      case DOUBLE:   type =  COLUMN;  break;\n      case BOOLEAN:  type = BCOLUMN;  break;\n      case STRING:   type = SCOLUMN;  break;\n      case BITSTR:   type =  BITCOL;  break;\n      default:\n\t type = pERROR;\n\t gParse.status = PARSE_SYNTAX_ERR;\n\t strcpy (errMsg,\"Bad datatype for data: \");\n\t strncat(errMsg, varName, MAXVARNAME);\n\t ffpmsg (errMsg);\n\t break;\n      }\n      thelval->lng = varNum;\n   }\n   return( type );\n}\n\nstatic int find_variable(char *varName)\n{\n   int i;\n \n   if( gParse.nCols )\n      for( i=0; i<gParse.nCols; i++ ) {\n         if( ! fits_strncasecmp(gParse.varData[i].name,varName,MAXVARNAME) ) {\n            return( i );\n         }\n      }\n   return( -1 );\n}\n\n"},{"id":16637,"name":"putcol.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, putcol.c, contains routines that write data elements to     */\n/*  a FITS image or table. These are the generic routines.                 */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <string.h>\n#include <stdlib.h>\n#include <limits.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffppx(  fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  datatype,   /* I - datatype of the value                   */\n            long  *firstpix, /* I - coord of  first pixel to write(1 based) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            void  *array,    /* I - array of values that are written        */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of pixels to the primary array.  The datatype of the\n  input array is defined by the 2nd argument. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written). \n  \n  This routine is simillar to ffppr, except it supports writing to \n  large images with more than 2**31 pixels.\n*/\n{\n    int naxis, ii;\n    long group = 1;\n    LONGLONG firstelem, dimsize = 1, naxes[9];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* get the size of the image */\n    ffgidm(fptr, &naxis, status);\n    ffgiszll(fptr, 9, naxes, status);\n\n    firstelem = 0;\n    for (ii=0; ii < naxis; ii++)\n    {\n        firstelem += ((firstpix[ii] - 1) * dimsize);\n        dimsize *= naxes[ii];\n    }\n    firstelem++;\n\n    if (datatype == TBYTE)\n    {\n      ffpprb(fptr, group, firstelem, nelem, (unsigned char *) array, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n      ffpprsb(fptr, group, firstelem, nelem, (signed char *) array, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n      ffpprui(fptr, group, firstelem, nelem, (unsigned short *) array,\n              status);\n    }\n    else if (datatype == TSHORT)\n    {\n      ffppri(fptr, group, firstelem, nelem, (short *) array, status);\n    }\n    else if (datatype == TUINT)\n    {\n      ffppruk(fptr, group, firstelem, nelem, (unsigned int *) array, status);\n    }\n    else if (datatype == TINT)\n    {\n      ffpprk(fptr, group, firstelem, nelem, (int *) array, status);\n    }\n    else if (datatype == TULONG)\n    {\n      ffppruj(fptr, group, firstelem, nelem, (unsigned long *) array, status);\n    }\n    else if (datatype == TLONG)\n    {\n      ffpprj(fptr, group, firstelem, nelem, (long *) array, status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n      ffpprujj(fptr, group, firstelem, nelem, (ULONGLONG *) array, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n      ffpprjj(fptr, group, firstelem, nelem, (LONGLONG *) array, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n      ffppre(fptr, group, firstelem, nelem, (float *) array, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n      ffpprd(fptr, group, firstelem, nelem, (double *) array, status);\n    }\n    else\n      *status = BAD_DATATYPE;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffppxll(  fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  datatype,   /* I - datatype of the value                   */\n            LONGLONG  *firstpix, /* I - coord of  first pixel to write(1 based) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            void  *array,    /* I - array of values that are written        */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of pixels to the primary array.  The datatype of the\n  input array is defined by the 2nd argument. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written). \n  \n  This routine is simillar to ffppr, except it supports writing to \n  large images with more than 2**31 pixels.\n*/\n{\n    int naxis, ii;\n    long group = 1;\n    LONGLONG firstelem, dimsize = 1, naxes[9];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* get the size of the image */\n    ffgidm(fptr, &naxis, status);\n    ffgiszll(fptr, 9, naxes, status);\n\n    firstelem = 0;\n    for (ii=0; ii < naxis; ii++)\n    {\n        firstelem += ((firstpix[ii] - 1) * dimsize);\n        dimsize *= naxes[ii];\n    }\n    firstelem++;\n\n    if (datatype == TBYTE)\n    {\n      ffpprb(fptr, group, firstelem, nelem, (unsigned char *) array, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n      ffpprsb(fptr, group, firstelem, nelem, (signed char *) array, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n      ffpprui(fptr, group, firstelem, nelem, (unsigned short *) array,\n              status);\n    }\n    else if (datatype == TSHORT)\n    {\n      ffppri(fptr, group, firstelem, nelem, (short *) array, status);\n    }\n    else if (datatype == TUINT)\n    {\n      ffppruk(fptr, group, firstelem, nelem, (unsigned int *) array, status);\n    }\n    else if (datatype == TINT)\n    {\n      ffpprk(fptr, group, firstelem, nelem, (int *) array, status);\n    }\n    else if (datatype == TULONG)\n    {\n      ffppruj(fptr, group, firstelem, nelem, (unsigned long *) array, status);\n    }\n    else if (datatype == TLONG)\n    {\n      ffpprj(fptr, group, firstelem, nelem, (long *) array, status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n      ffpprujj(fptr, group, firstelem, nelem, (ULONGLONG *) array, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n      ffpprjj(fptr, group, firstelem, nelem, (LONGLONG *) array, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n      ffppre(fptr, group, firstelem, nelem, (float *) array, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n      ffpprd(fptr, group, firstelem, nelem, (double *) array, status);\n    }\n    else\n      *status = BAD_DATATYPE;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffppxn(  fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  datatype,   /* I - datatype of the value                   */\n            long  *firstpix, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            void  *array,    /* I - array of values that are written        */\n            void  *nulval,   /* I - pointer to the null value               */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array.  The datatype of the\n  input array is defined by the 2nd argument. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n\n  This routine supports writing to large images with\n  more than 2**31 pixels.\n*/\n{\n    int naxis, ii;\n    long group = 1;\n    LONGLONG firstelem, dimsize = 1, naxes[9];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (nulval == NULL)  /* null value not defined? */\n    {\n        ffppx(fptr, datatype, firstpix, nelem, array, status);\n        return(*status);\n    }\n\n    /* get the size of the image */\n    ffgidm(fptr, &naxis, status);\n    ffgiszll(fptr, 9, naxes, status);\n\n    firstelem = 0;\n    for (ii=0; ii < naxis; ii++)\n    {\n        firstelem += ((firstpix[ii] - 1) * dimsize);\n        dimsize *= naxes[ii];\n    }\n    firstelem++;\n\n    if (datatype == TBYTE)\n    {\n      ffppnb(fptr, group, firstelem, nelem, (unsigned char *) array, \n             *(unsigned char *) nulval, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n      ffppnsb(fptr, group, firstelem, nelem, (signed char *) array, \n             *(signed char *) nulval, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n      ffppnui(fptr, group, firstelem, nelem, (unsigned short *) array,\n              *(unsigned short *) nulval,status);\n    }\n    else if (datatype == TSHORT)\n    {\n      ffppni(fptr, group, firstelem, nelem, (short *) array,\n             *(short *) nulval, status);\n    }\n    else if (datatype == TUINT)\n    {\n      ffppnuk(fptr, group, firstelem, nelem, (unsigned int *) array,\n             *(unsigned int *) nulval, status);\n    }\n    else if (datatype == TINT)\n    {\n      ffppnk(fptr, group, firstelem, nelem, (int *) array,\n             *(int *) nulval, status);\n    }\n    else if (datatype == TULONG)\n    {\n      ffppnuj(fptr, group, firstelem, nelem, (unsigned long *) array,\n              *(unsigned long *) nulval,status);\n    }\n    else if (datatype == TLONG)\n    {\n      ffppnj(fptr, group, firstelem, nelem, (long *) array,\n             *(long *) nulval, status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n      ffppnujj(fptr, group, firstelem, nelem, (ULONGLONG *) array,\n             *(ULONGLONG *) nulval, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n      ffppnjj(fptr, group, firstelem, nelem, (LONGLONG *) array,\n             *(LONGLONG *) nulval, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n      ffppne(fptr, group, firstelem, nelem, (float *) array,\n             *(float *) nulval, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n      ffppnd(fptr, group, firstelem, nelem, (double *) array,\n             *(double *) nulval, status);\n    }\n    else\n      *status = BAD_DATATYPE;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffppxnll(  fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  datatype,   /* I - datatype of the value                   */\n            LONGLONG  *firstpix, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            void  *array,    /* I - array of values that are written        */\n            void  *nulval,   /* I - pointer to the null value               */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array.  The datatype of the\n  input array is defined by the 2nd argument. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n\n  This routine supports writing to large images with\n  more than 2**31 pixels.\n*/\n{\n    int naxis, ii;\n    long  group = 1;\n    LONGLONG firstelem, dimsize = 1, naxes[9];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (nulval == NULL)  /* null value not defined? */\n    {\n        ffppxll(fptr, datatype, firstpix, nelem, array, status);\n        return(*status);\n    }\n\n    /* get the size of the image */\n    ffgidm(fptr, &naxis, status);\n    ffgiszll(fptr, 9, naxes, status);\n\n    firstelem = 0;\n    for (ii=0; ii < naxis; ii++)\n    {\n        firstelem += ((firstpix[ii] - 1) * dimsize);\n        dimsize *= naxes[ii];\n    }\n    firstelem++;\n\n    if (datatype == TBYTE)\n    {\n      ffppnb(fptr, group, firstelem, nelem, (unsigned char *) array, \n             *(unsigned char *) nulval, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n      ffppnsb(fptr, group, firstelem, nelem, (signed char *) array, \n             *(signed char *) nulval, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n      ffppnui(fptr, group, firstelem, nelem, (unsigned short *) array,\n              *(unsigned short *) nulval,status);\n    }\n    else if (datatype == TSHORT)\n    {\n      ffppni(fptr, group, firstelem, nelem, (short *) array,\n             *(short *) nulval, status);\n    }\n    else if (datatype == TUINT)\n    {\n      ffppnuk(fptr, group, firstelem, nelem, (unsigned int *) array,\n             *(unsigned int *) nulval, status);\n    }\n    else if (datatype == TINT)\n    {\n      ffppnk(fptr, group, firstelem, nelem, (int *) array,\n             *(int *) nulval, status);\n    }\n    else if (datatype == TULONG)\n    {\n      ffppnuj(fptr, group, firstelem, nelem, (unsigned long *) array,\n              *(unsigned long *) nulval,status);\n    }\n    else if (datatype == TLONG)\n    {\n      ffppnj(fptr, group, firstelem, nelem, (long *) array,\n             *(long *) nulval, status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n      ffppnujj(fptr, group, firstelem, nelem, (ULONGLONG *) array,\n             *(ULONGLONG *) nulval, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n      ffppnjj(fptr, group, firstelem, nelem, (LONGLONG *) array,\n             *(LONGLONG *) nulval, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n      ffppne(fptr, group, firstelem, nelem, (float *) array,\n             *(float *) nulval, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n      ffppnd(fptr, group, firstelem, nelem, (double *) array,\n             *(double *) nulval, status);\n    }\n    else\n      *status = BAD_DATATYPE;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffppr(  fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  datatype,   /* I - datatype of the value                   */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            void  *array,    /* I - array of values that are written        */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array.  The datatype of the\n  input array is defined by the 2nd argument. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n\n*/\n{\n    long group = 1;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (datatype == TBYTE)\n    {\n      ffpprb(fptr, group, firstelem, nelem, (unsigned char *) array, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n      ffpprsb(fptr, group, firstelem, nelem, (signed char *) array, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n      ffpprui(fptr, group, firstelem, nelem, (unsigned short *) array,\n              status);\n    }\n    else if (datatype == TSHORT)\n    {\n      ffppri(fptr, group, firstelem, nelem, (short *) array, status);\n    }\n    else if (datatype == TUINT)\n    {\n      ffppruk(fptr, group, firstelem, nelem, (unsigned int *) array, status);\n    }\n    else if (datatype == TINT)\n    {\n      ffpprk(fptr, group, firstelem, nelem, (int *) array, status);\n    }\n    else if (datatype == TULONG)\n    {\n      ffppruj(fptr, group, firstelem, nelem, (unsigned long *) array, status);\n    }\n    else if (datatype == TLONG)\n    {\n      ffpprj(fptr, group, firstelem, nelem, (long *) array, status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n      ffpprujj(fptr, group, firstelem, nelem, (ULONGLONG *) array, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n      ffpprjj(fptr, group, firstelem, nelem, (LONGLONG *) array, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n      ffppre(fptr, group, firstelem, nelem, (float *) array, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n      ffpprd(fptr, group, firstelem, nelem, (double *) array, status);\n    }\n    else\n      *status = BAD_DATATYPE;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffppn(  fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  datatype,   /* I - datatype of the value                   */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            void  *array,    /* I - array of values that are written        */\n            void  *nulval,   /* I - pointer to the null value               */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array.  The datatype of the\n  input array is defined by the 2nd argument. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n\n*/\n{\n    long group = 1;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (nulval == NULL)  /* null value not defined? */\n    {\n        ffppr(fptr, datatype, firstelem, nelem, array, status);\n        return(*status);\n    }\n\n    if (datatype == TBYTE)\n    {\n      ffppnb(fptr, group, firstelem, nelem, (unsigned char *) array, \n             *(unsigned char *) nulval, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n      ffppnsb(fptr, group, firstelem, nelem, (signed char *) array, \n             *(signed char *) nulval, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n      ffppnui(fptr, group, firstelem, nelem, (unsigned short *) array,\n              *(unsigned short *) nulval,status);\n    }\n    else if (datatype == TSHORT)\n    {\n      ffppni(fptr, group, firstelem, nelem, (short *) array,\n             *(short *) nulval, status);\n    }\n    else if (datatype == TUINT)\n    {\n      ffppnuk(fptr, group, firstelem, nelem, (unsigned int *) array,\n             *(unsigned int *) nulval, status);\n    }\n    else if (datatype == TINT)\n    {\n      ffppnk(fptr, group, firstelem, nelem, (int *) array,\n             *(int *) nulval, status);\n    }\n    else if (datatype == TULONG)\n    {\n      ffppnuj(fptr, group, firstelem, nelem, (unsigned long *) array,\n              *(unsigned long *) nulval,status);\n    }\n    else if (datatype == TLONG)\n    {\n      ffppnj(fptr, group, firstelem, nelem, (long *) array,\n             *(long *) nulval, status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n      ffppnujj(fptr, group, firstelem, nelem, (ULONGLONG *) array,\n             *(ULONGLONG *) nulval, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n      ffppnjj(fptr, group, firstelem, nelem, (LONGLONG *) array,\n             *(LONGLONG *) nulval, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n      ffppne(fptr, group, firstelem, nelem, (float *) array,\n             *(float *) nulval, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n      ffppnd(fptr, group, firstelem, nelem, (double *) array,\n             *(double *) nulval, status);\n    }\n    else\n      *status = BAD_DATATYPE;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpss(  fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  datatype,    /* I - datatype of the value                   */\n            long *blc,        /* I - 'bottom left corner' of the subsection  */\n            long *trc ,       /* I - 'top right corner' of the subsection    */\n            void *array,      /* I - array of values that are written        */\n            int  *status)     /* IO - error status                           */\n/*\n  Write a section of values to the primary array. The datatype of the\n  input array is defined by the 2nd argument.  Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n\n  This routine supports writing to large images with\n  more than 2**31 pixels.\n*/\n{\n    int naxis;\n    long naxes[9];\n\n    if (*status > 0)   /* inherit input status value if > 0 */\n        return(*status);\n\n    /* get the size of the image */\n    ffgidm(fptr, &naxis, status);\n    ffgisz(fptr, 9, naxes, status);\n\n    if (datatype == TBYTE)\n    {\n        ffpssb(fptr, 1, naxis, naxes, blc, trc,\n               (unsigned char *) array, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n        ffpsssb(fptr, 1, naxis, naxes, blc, trc,\n               (signed char *) array, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n        ffpssui(fptr, 1, naxis, naxes, blc, trc,\n               (unsigned short *) array, status);\n    }\n    else if (datatype == TSHORT)\n    {\n        ffpssi(fptr, 1, naxis, naxes, blc, trc,\n               (short *) array, status);\n    }\n    else if (datatype == TUINT)\n    {\n        ffpssuk(fptr, 1, naxis, naxes, blc, trc,\n               (unsigned int *) array, status);\n    }\n    else if (datatype == TINT)\n    {\n        ffpssk(fptr, 1, naxis, naxes, blc, trc,\n               (int *) array, status);\n    }\n    else if (datatype == TULONG)\n    {\n        ffpssuj(fptr, 1, naxis, naxes, blc, trc,\n               (unsigned long *) array, status);\n    }\n    else if (datatype == TLONG)\n    {\n        ffpssj(fptr, 1, naxis, naxes, blc, trc,\n               (long *) array, status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n        ffpssujj(fptr, 1, naxis, naxes, blc, trc,\n               (ULONGLONG *) array, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n        ffpssjj(fptr, 1, naxis, naxes, blc, trc,\n               (LONGLONG *) array, status);\n    }    \n    else if (datatype == TFLOAT)\n    {\n        ffpsse(fptr, 1, naxis, naxes, blc, trc,\n               (float *) array, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n        ffpssd(fptr, 1, naxis, naxes, blc, trc,\n               (double *) array, status);\n    }\n    else\n      *status = BAD_DATATYPE;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcl(  fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  datatype,   /* I - datatype of the value                   */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of elements to write             */\n            void  *array,    /* I - array of values that are written        */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to a table column.  The datatype of the\n  input array is defined by the 2nd argument. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS column is not the same as the array being written).\n\n*/\n{\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (datatype == TBIT)\n    {\n      ffpclx(fptr, colnum, firstrow, (long) firstelem, (long) nelem, (char *) array, \n             status);\n    }\n    else if (datatype == TBYTE)\n    {\n      ffpclb(fptr, colnum, firstrow, firstelem, nelem, (unsigned char *) array,\n             status);\n    }\n    else if (datatype == TSBYTE)\n    {\n      ffpclsb(fptr, colnum, firstrow, firstelem, nelem, (signed char *) array,\n             status);\n    }\n    else if (datatype == TUSHORT)\n    {\n      ffpclui(fptr, colnum, firstrow, firstelem, nelem, \n             (unsigned short *) array, status);\n    }\n    else if (datatype == TSHORT)\n    {\n      ffpcli(fptr, colnum, firstrow, firstelem, nelem, (short *) array,\n             status);\n    }\n    else if (datatype == TUINT)\n    {\n      ffpcluk(fptr, colnum, firstrow, firstelem, nelem, (unsigned int *) array,\n               status);\n    }\n    else if (datatype == TINT)\n    {\n      ffpclk(fptr, colnum, firstrow, firstelem, nelem, (int *) array,\n               status);\n    }\n    else if (datatype == TULONG)\n    {\n      ffpcluj(fptr, colnum, firstrow, firstelem, nelem, (unsigned long *) array,\n              status);\n    }\n    else if (datatype == TLONG)\n    {\n      ffpclj(fptr, colnum, firstrow, firstelem, nelem, (long *) array,\n             status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n      ffpclujj(fptr, colnum, firstrow, firstelem, nelem, (ULONGLONG *) array,\n             status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n      ffpcljj(fptr, colnum, firstrow, firstelem, nelem, (LONGLONG *) array,\n             status);\n    }\n    else if (datatype == TFLOAT)\n    {\n      ffpcle(fptr, colnum, firstrow, firstelem, nelem, (float *) array,\n             status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n      ffpcld(fptr, colnum, firstrow, firstelem, nelem, (double *) array,\n             status);\n    }\n    else if (datatype == TCOMPLEX)\n    {\n      ffpcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2,\n             (float *) array, status);\n    }\n    else if (datatype == TDBLCOMPLEX)\n    {\n      ffpcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2,\n             (double *) array, status);\n    }\n    else if (datatype == TLOGICAL)\n    {\n      ffpcll(fptr, colnum, firstrow, firstelem, nelem, (char *) array,\n             status);\n    }\n    else if (datatype == TSTRING)\n    {\n      ffpcls(fptr, colnum, firstrow, firstelem, nelem, (char **) array,\n             status);\n    }\n    else\n      *status = BAD_DATATYPE;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcn(  fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  datatype,   /* I - datatype of the value                   */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of elements to write             */\n            void  *array,    /* I - array of values that are written        */\n            void  *nulval,   /* I - pointer to the null value               */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to a table column.  The datatype of the\n  input array is defined by the 2nd argument. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS column is not the same as the array being written).\n\n*/\n{\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (nulval == NULL)  /* null value not defined? */\n    {\n        ffpcl(fptr, datatype, colnum, firstrow, firstelem, nelem, array,\n              status);\n        return(*status);\n    }\n\n    if (datatype == TBYTE)\n    {\n      ffpcnb(fptr, colnum, firstrow, firstelem, nelem, (unsigned char *) array,\n            *(unsigned char *) nulval, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n      ffpcnsb(fptr, colnum, firstrow, firstelem, nelem, (signed char *) array,\n            *(signed char *) nulval, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n     ffpcnui(fptr, colnum, firstrow, firstelem, nelem, (unsigned short *) array,\n             *(unsigned short *) nulval, status);\n    }\n    else if (datatype == TSHORT)\n    {\n      ffpcni(fptr, colnum, firstrow, firstelem, nelem, (short *) array,\n             *(unsigned short *) nulval, status);\n    }\n    else if (datatype == TUINT)\n    {\n      ffpcnuk(fptr, colnum, firstrow, firstelem, nelem, (unsigned int *) array,\n             *(unsigned int *) nulval, status);\n    }\n    else if (datatype == TINT)\n    {\n      ffpcnk(fptr, colnum, firstrow, firstelem, nelem, (int *) array,\n             *(int *) nulval, status);\n    }\n    else if (datatype == TULONG)\n    {\n      ffpcnuj(fptr, colnum, firstrow, firstelem, nelem, (unsigned long *) array,\n              *(unsigned long *) nulval, status);\n    }\n    else if (datatype == TLONG)\n    {\n      ffpcnj(fptr, colnum, firstrow, firstelem, nelem, (long *) array,\n             *(long *) nulval, status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n      ffpcnujj(fptr, colnum, firstrow, firstelem, nelem, (ULONGLONG *) array,\n             *(ULONGLONG *) nulval, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n      ffpcnjj(fptr, colnum, firstrow, firstelem, nelem, (LONGLONG *) array,\n             *(LONGLONG *) nulval, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n      ffpcne(fptr, colnum, firstrow, firstelem, nelem, (float *) array,\n             *(float *) nulval, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n      ffpcnd(fptr, colnum, firstrow, firstelem, nelem, (double *) array,\n             *(double *) nulval, status);\n    }\n    else if (datatype == TCOMPLEX)\n    {\n      ffpcne(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2,\n             (float *) array, *(float *) nulval, status);\n    }\n    else if (datatype == TDBLCOMPLEX)\n    {\n      ffpcnd(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2,\n             (double *) array, *(double *) nulval, status);\n    }\n    else if (datatype == TLOGICAL)\n    {\n      ffpcnl(fptr, colnum, firstrow, firstelem, nelem, (char *) array,\n             *(char *) nulval, status);\n    }\n    else if (datatype == TSTRING)\n    {\n      ffpcns(fptr, colnum, firstrow, firstelem, nelem, (char **) array,\n             (char *) nulval, status);\n    }\n    else\n      *status = BAD_DATATYPE;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_iter_set_by_name(iteratorCol *col, /* I - iterator col structure */\n           fitsfile *fptr,  /* I - FITS file pointer                      */\n           char *colname,   /* I - column name                            */\n           int datatype,    /* I - column datatype                        */\n           int iotype)      /* I - InputCol, InputOutputCol, or OutputCol */\n/*\n  set all the parameters for an iterator column, by column name\n*/\n{\n    col->fptr = fptr;\n    strncpy(col->colname, colname,69);\n    col->colname[69]=0;\n    col->colnum = 0;  /* set column number undefined since name is given */\n    col->datatype = datatype;\n    col->iotype = iotype;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint fits_iter_set_by_num(iteratorCol *col, /* I - iterator column structure */\n           fitsfile *fptr,  /* I - FITS file pointer                      */\n           int colnum,      /* I - column number                          */\n           int datatype,    /* I - column datatype                        */\n           int iotype)      /* I - InputCol, InputOutputCol, or OutputCol */\n/*\n  set all the parameters for an iterator column, by column number\n*/\n{\n    col->fptr = fptr;\n    col->colnum = colnum; \n    col->datatype = datatype;\n    col->iotype = iotype;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint fits_iter_set_file(iteratorCol *col, /* I - iterator column structure   */\n           fitsfile *fptr)   /* I - FITS file pointer                      */\n/*\n  set iterator column parameter\n*/\n{\n    col->fptr = fptr;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint fits_iter_set_colname(iteratorCol *col, /* I - iterator col structure  */\n           char *colname)    /* I - column name                            */\n/*\n  set iterator column parameter\n*/\n{\n    strncpy(col->colname, colname,69);\n    col->colname[69]=0;\n    col->colnum = 0;  /* set column number undefined since name is given */\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint fits_iter_set_colnum(iteratorCol *col, /* I - iterator column structure */\n           int colnum)       /* I - column number                          */\n/*\n  set iterator column parameter\n*/\n{\n    col->colnum = colnum; \n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint fits_iter_set_datatype(iteratorCol *col, /* I - iterator col structure */\n           int datatype)    /* I - column datatype                        */\n/*\n  set iterator column parameter\n*/\n{\n    col->datatype = datatype;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint fits_iter_set_iotype(iteratorCol *col, /* I - iterator column structure */\n           int iotype)       /* I - InputCol, InputOutputCol, or OutputCol */\n/*\n  set iterator column parameter\n*/\n{\n    col->iotype = iotype;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nfitsfile * fits_iter_get_file(iteratorCol *col) /* I -iterator col structure */\n/*\n  get iterator column parameter\n*/\n{\n     return(col->fptr);\n}\n/*--------------------------------------------------------------------------*/\nchar * fits_iter_get_colname(iteratorCol *col) /* I -iterator col structure */\n/*\n  get iterator column parameter\n*/\n{\n    return(col->colname);\n}\n/*--------------------------------------------------------------------------*/\nint fits_iter_get_colnum(iteratorCol *col) /* I - iterator column structure */\n/*\n  get iterator column parameter\n*/\n{\n    return(col->colnum);\n}\n/*--------------------------------------------------------------------------*/\nint fits_iter_get_datatype(iteratorCol *col) /* I - iterator col structure */\n/*\n  get iterator column parameter\n*/\n{\n    return(col->datatype);\n}\n/*--------------------------------------------------------------------------*/\nint fits_iter_get_iotype(iteratorCol *col) /* I - iterator column structure */\n/*\n  get iterator column parameter\n*/\n{\n     return(col->iotype);\n}\n/*--------------------------------------------------------------------------*/\nvoid * fits_iter_get_array(iteratorCol *col) /* I - iterator col structure */\n/*\n  get iterator column parameter\n*/\n{\n     return(col->array);\n}\n/*--------------------------------------------------------------------------*/\nlong fits_iter_get_tlmin(iteratorCol *col) /* I - iterator column structure */\n/*\n  get iterator column parameter\n*/\n{\n     return(col->tlmin);\n}\n/*--------------------------------------------------------------------------*/\nlong fits_iter_get_tlmax(iteratorCol *col) /* I - iterator column structure */\n/*\n  get iterator column parameter\n*/\n{\n     return(col->tlmax);\n}\n/*--------------------------------------------------------------------------*/\nlong fits_iter_get_repeat(iteratorCol *col) /* I - iterator col structure */\n/*\n  get iterator column parameter\n*/\n{\n     return(col->repeat);\n}\n/*--------------------------------------------------------------------------*/\nchar * fits_iter_get_tunit(iteratorCol *col) /* I - iterator col structure */\n/*\n  get iterator column parameter\n*/\n{\n    return(col->tunit);\n}\n/*--------------------------------------------------------------------------*/\nchar * fits_iter_get_tdisp(iteratorCol *col) /* I -iterator col structure   */\n/*\n  get iterator column parameter\n*/\n{\n    return(col->tdisp);\n}\n/*--------------------------------------------------------------------------*/\nint ffiter(int n_cols,\n           iteratorCol *cols,\n           long offset,\n           long n_per_loop,\n           int (*work_fn)(long total_n,\n                          long offset,\n                          long first_n,\n                          long n_values,\n                          int n_cols,\n                          iteratorCol *cols,\n                          void *userPointer),\n           void *userPointer,\n           int *status)\n/*\n   The iterator function.  This function will pass the specified\n   columns from a FITS table or pixels from a FITS image to the \n   user-supplied function.  Depending on the size of the table\n   or image, only a subset of the rows or pixels may be passed to the\n   function on each call, in which case the function will be called\n   multiple times until all the rows or pixels have been processed.\n*/\n{\n    typedef struct  /* structure to store the column null value */\n    {  \n        int      nullsize;    /* length of the null value, in bytes */\n        union {   /*  default null value for the column */\n            char   *stringnull;\n            unsigned char   charnull;\n            signed char scharnull;\n            int    intnull;\n            short  shortnull;\n            long   longnull;\n            unsigned int   uintnull;\n            unsigned short ushortnull;\n            unsigned long  ulongnull;\n            float  floatnull;\n            double doublenull;\n\t    LONGLONG longlongnull;\n        } null;\n    } colNulls;\n\n    void *dataptr, *defaultnull;\n    colNulls *col;\n    int ii, jj, tstatus, naxis, bitpix;\n    int typecode, hdutype, jtype, type, anynul=0, nfiles, nbytes;\n    long totaln, nleft, frow, felement, n_optimum, i_optimum, ntodo;\n    long rept, rowrept, width, tnull, naxes[9] = {1,1,1,1,1,1,1,1,1}, groups;\n    double zeros = 0.;\n    char message[FLEN_ERRMSG], keyname[FLEN_KEYWORD], nullstr[FLEN_VALUE];\n    char **stringptr, *nullptr, *cptr;\n\n    if (*status > 0)\n        return(*status);\n\n    if (n_cols  < 0 || n_cols > 999 )\n    {\n        ffpmsg(\"Illegal number of columms (ffiter)\");\n        return(*status = BAD_COL_NUM);  /* negative number of columns */\n    }\n\n    /*------------------------------------------------------------*/\n    /* Make sure column numbers and datatypes are in legal range  */\n    /* and column numbers and datatypes are legal.                */ \n    /* Also fill in other parameters in the column structure.     */\n    /*------------------------------------------------------------*/\n\n    ffghdt(cols[0].fptr, &hdutype, status);  /* type of first HDU */\n\n    for (jj = 0; jj < n_cols; jj++)\n    {\n        /* check that output datatype code value is legal */\n        type = cols[jj].datatype;  \n\n        /* Allow variable length arrays for InputCol and InputOutputCol columns,\n\t   but not for OutputCol columns.  Variable length arrays have a\n\t   negative type code value. */\n\n        if ((cols[jj].iotype != OutputCol) && (type<0)) {\n            type*=-1;\n        }\n\n        if (type != 0      && type != TBYTE  &&\n            type != TSBYTE && type != TLOGICAL && type != TSTRING &&\n            type != TSHORT && type != TINT     && type != TLONG && \n            type != TFLOAT && type != TDOUBLE  && type != TCOMPLEX &&\n            type != TULONG && type != TUSHORT  && type != TDBLCOMPLEX &&\n\t    type != TLONGLONG )\n        {\n\t    if (type < 0) {\n\t      snprintf(message,FLEN_ERRMSG,\n              \"Variable length array not allowed for output column number %d (ffiter)\",\n                    jj + 1);\n\t    } else {\n            snprintf(message,FLEN_ERRMSG,\n                   \"Illegal datatype for column number %d: %d  (ffiter)\",\n                    jj + 1, cols[jj].datatype);\n\t    }\n\t    \n            ffpmsg(message);\n            return(*status = BAD_DATATYPE);\n        }\n\n        /* initialize TLMINn, TLMAXn, column name, and display format */\n        cols[jj].tlmin = 0;\n        cols[jj].tlmax = 0;\n        cols[jj].tunit[0] = '\\0';\n        cols[jj].tdisp[0] = '\\0';\n\n        ffghdt(cols[jj].fptr, &jtype, status);  /* get HDU type */\n\n        if (hdutype == IMAGE_HDU) /* operating on FITS images */\n        {\n            if (jtype != IMAGE_HDU)\n            {\n                snprintf(message,FLEN_ERRMSG,\n                \"File %d not positioned to an image extension (ffiter)\",\n                    jj + 1);\n                return(*status = NOT_IMAGE);\n            }\n\n            /* since this is an image, set a dummy column number = 0 */\n            cols[jj].colnum = 0;\n            strcpy(cols[jj].colname, \"IMAGE\");  /* dummy name for images */\n\n            tstatus = 0;\n            ffgkys(cols[jj].fptr, \"BUNIT\", cols[jj].tunit, 0, &tstatus);\n        }\n        else  /* operating on FITS tables */\n        {\n            if (jtype == IMAGE_HDU)\n            {\n                snprintf(message,FLEN_ERRMSG,\n                \"File %d not positioned to a table extension (ffiter)\",\n                    jj + 1);\n                return(*status = NOT_TABLE);\n            }\n\n            if (cols[jj].colnum < 1)\n            {\n                /* find the column number for the named column */\n                if (ffgcno(cols[jj].fptr, CASEINSEN, cols[jj].colname,\n                           &cols[jj].colnum, status) )\n                {\n                    snprintf(message,FLEN_ERRMSG,\n                      \"Column '%s' not found for column number %d  (ffiter)\",\n                       cols[jj].colname, jj + 1);\n                    ffpmsg(message);\n                    return(*status);\n                }\n            }\n\n            /* check that the column number is valid */\n            if (cols[jj].colnum < 1 || \n                cols[jj].colnum > ((cols[jj].fptr)->Fptr)->tfield)\n            {\n                snprintf(message,FLEN_ERRMSG,\n                  \"Column %d has illegal table position number: %d  (ffiter)\",\n                    jj + 1, cols[jj].colnum);\n                ffpmsg(message);\n                return(*status = BAD_COL_NUM);\n            }\n\n            /* look for column description keywords and update structure */\n            tstatus = 0;\n            ffkeyn(\"TLMIN\", cols[jj].colnum, keyname, &tstatus);\n            ffgkyj(cols[jj].fptr, keyname, &cols[jj].tlmin, 0, &tstatus);\n\n            tstatus = 0;\n            ffkeyn(\"TLMAX\", cols[jj].colnum, keyname, &tstatus);\n            ffgkyj(cols[jj].fptr, keyname, &cols[jj].tlmax, 0, &tstatus);\n\n            tstatus = 0;\n            ffkeyn(\"TTYPE\", cols[jj].colnum, keyname, &tstatus);\n            ffgkys(cols[jj].fptr, keyname, cols[jj].colname, 0, &tstatus);\n            if (tstatus)\n                cols[jj].colname[0] = '\\0';\n\n            tstatus = 0;\n            ffkeyn(\"TUNIT\", cols[jj].colnum, keyname, &tstatus);\n            ffgkys(cols[jj].fptr, keyname, cols[jj].tunit, 0, &tstatus);\n\n            tstatus = 0;\n            ffkeyn(\"TDISP\", cols[jj].colnum, keyname, &tstatus);\n            ffgkys(cols[jj].fptr, keyname, cols[jj].tdisp, 0, &tstatus);\n        }\n    }  /* end of loop over all columns */\n\n    /*-----------------------------------------------------------------*/\n    /* use the first file to set the total number of values to process */\n    /*-----------------------------------------------------------------*/\n\n    offset = maxvalue(offset, 0L);  /* make sure offset is legal */\n\n    if (hdutype == IMAGE_HDU)   /* get total number of pixels in the image */\n    {\n      fits_get_img_dim(cols[0].fptr, &naxis, status);\n      fits_get_img_size(cols[0].fptr, 9, naxes, status);\n\n      tstatus = 0;\n      ffgkyj(cols[0].fptr, \"GROUPS\", &groups, NULL, &tstatus);\n      if (!tstatus && groups && (naxis > 1) && (naxes[0] == 0) )\n      {\n         /* this is a random groups file, with NAXIS1 = 0 */\n         /* Use GCOUNT, the number of groups, as the first multiplier  */\n         /* to calculate the total number of pixels in all the groups. */\n         ffgkyj(cols[0].fptr, \"GCOUNT\", &totaln, NULL, status);\n\n      }  else {\n         totaln = naxes[0];\n      }\n\n      for (ii = 1; ii < naxis; ii++)\n          totaln *= naxes[ii];\n\n      frow = 1;\n      felement = 1 + offset;\n    }\n    else   /* get total number or rows in the table */\n    {\n      ffgkyj(cols[0].fptr, \"NAXIS2\", &totaln, 0, status);\n      frow = 1 + offset;\n      felement = 1;\n    }\n\n    /*  adjust total by the input starting offset value */\n    totaln -= offset;\n    totaln = maxvalue(totaln, 0L);   /* don't allow negative number */\n\n    /*------------------------------------------------------------------*/\n    /* Determine number of values to pass to work function on each loop */\n    /*------------------------------------------------------------------*/\n\n    if (n_per_loop == 0)\n    {\n        /* Determine optimum number of values for each iteration.    */\n        /* Look at all the fitsfile pointers to determine the number */\n        /* of unique files.                                          */\n\n        nfiles = 1;\n        ffgrsz(cols[0].fptr, &n_optimum, status);\n\n        for (jj = 1; jj < n_cols; jj++)\n        {\n            for (ii = 0; ii < jj; ii++)\n            {\n                if (cols[ii].fptr == cols[jj].fptr)\n                   break;\n            }\n\n            if (ii == jj)  /* this is a new file */\n            {\n                nfiles++;\n                ffgrsz(cols[jj].fptr, &i_optimum, status);\n                n_optimum = minvalue(n_optimum, i_optimum);\n            }\n        }\n\n        /* divid n_optimum by the number of files that will be processed */\n        n_optimum = n_optimum / nfiles;\n        n_optimum = maxvalue(n_optimum, 1);\n    }\n    else if (n_per_loop < 0)  /* must pass all the values at one time */\n    {\n        n_optimum = totaln;\n    }\n    else /* calling routine specified how many values to pass at a time */\n    {\n        n_optimum = minvalue(n_per_loop, totaln);\n    }\n\n    /*--------------------------------------*/\n    /* allocate work arrays for each column */\n    /* and determine the null pixel value   */\n    /*--------------------------------------*/\n\n    col = calloc(n_cols, sizeof(colNulls) ); /* memory for the null values */\n    if (!col)\n    {\n        ffpmsg(\"ffiter failed to allocate memory for null values\");\n        *status = MEMORY_ALLOCATION;  /* memory allocation failed */\n        return(*status);\n    }\n\n    for (jj = 0; jj < n_cols; jj++)\n    {\n        /* get image or column datatype and vector length */\n        if (hdutype == IMAGE_HDU)   /* get total number of pixels in the image */\n        {\n           fits_get_img_type(cols[jj].fptr, &bitpix, status);\n           switch(bitpix) {\n             case BYTE_IMG:\n                 typecode = TBYTE;\n                 break;\n             case SHORT_IMG:\n                 typecode = TSHORT;\n                 break;\n             case LONG_IMG:\n                 typecode = TLONG;\n                 break;\n             case FLOAT_IMG:\n                 typecode = TFLOAT;\n                 break;\n             case DOUBLE_IMG:\n                 typecode = TDOUBLE;\n                 break;\n             case LONGLONG_IMG:\n                 typecode = TLONGLONG;\n                 break;\n            }\n        }\n        else\n        {\n            if (ffgtcl(cols[jj].fptr, cols[jj].colnum, &typecode, &rept,\n                  &width, status) > 0)\n                goto cleanup;\n\t\t\n\t    if (typecode < 0) {  /* if any variable length arrays, then the */ \n\t        n_optimum = 1;   /* must process the table 1 row at a time */\n\t\t\n              /* Allow variable length arrays for InputCol and InputOutputCol columns,\n\t       but not for OutputCol columns.  Variable length arrays have a\n\t       negative type code value. */\n\n              if (cols[jj].iotype == OutputCol) {\n \t        snprintf(message,FLEN_ERRMSG,\n                \"Variable length array not allowed for output column number %d (ffiter)\",\n                    jj + 1);\n                ffpmsg(message);\n                return(*status = BAD_DATATYPE);\n              }\n\t   }\n        }\n\n        /* special case where sizeof(long) = 8: use TINT instead of TLONG */\n        if (abs(typecode) == TLONG && sizeof(long) == 8 && sizeof(int) == 4) {\n\t\tif(typecode<0) {\n\t\t\ttypecode = -TINT;\n\t\t} else {\n\t\t\ttypecode = TINT;\n\t\t}\n        }\n\n        /* Special case: interprete 'X' column as 'B' */\n        if (abs(typecode) == TBIT)\n        {\n            typecode  = typecode / TBIT * TBYTE;\n            rept = (rept + 7) / 8;\n        }\n\n        if (cols[jj].datatype == 0)    /* output datatype not specified? */\n        {\n            /* special case if sizeof(long) = 8: use TINT instead of TLONG */\n            if (abs(typecode) == TLONG && sizeof(long) == 8 && sizeof(int) == 4)\n                cols[jj].datatype = TINT;\n            else\n                cols[jj].datatype = abs(typecode);\n        }\n\n        /* calc total number of elements to do on each iteration */\n        if (hdutype == IMAGE_HDU || cols[jj].datatype == TSTRING)\n        {\n            ntodo = n_optimum;\n            cols[jj].repeat = 1;\n            /* handle special case of a 0-width string column */\n            if (hdutype == BINARY_TBL && rept == 0)\n               cols[jj].repeat = 0;\n\n            /* get the BLANK keyword value, if it exists */\n            if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG\n                || abs(typecode) == TINT || abs(typecode) == TLONGLONG)\n            {\n                tstatus = 0;\n                ffgkyj(cols[jj].fptr, \"BLANK\", &tnull, 0, &tstatus);\n                if (tstatus)\n                {\n                    tnull = 0L;  /* no null values */\n                }\n            }\n        }\n        else\n        {\n\t    if (typecode < 0) \n\t    {\n              /* get max size of the variable length vector; dont't trust the value\n\t         given by the TFORM keyword  */\n\t      rept = 1;\n\t      for (ii = 0; ii < totaln; ii++) {\n\t\tffgdes(cols[jj].fptr, cols[jj].colnum, frow + ii, &rowrept, NULL, status);\n\t\t\n\t\trept = maxvalue(rept, rowrept);\n\t      }\n            }\n\t    \n            ntodo = n_optimum * rept;   /* vector columns */\n            cols[jj].repeat = rept;\n\n            /* get the TNULL keyword value, if it exists */\n            if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG\n                || abs(typecode) == TINT || abs(typecode) == TLONGLONG)\n            {\n                tstatus = 0;\n                if (hdutype == ASCII_TBL) /* TNULLn value is a string */\n                {\n                    ffkeyn(\"TNULL\", cols[jj].colnum, keyname, &tstatus);\n                    ffgkys(cols[jj].fptr, keyname, nullstr, 0, &tstatus);\n                    if (tstatus)\n                    {\n                        tnull = 0L; /* keyword doesn't exist; no null values */\n                    }\n                    else\n                    {\n                        cptr = nullstr;\n                        while (*cptr == ' ')  /* skip over leading blanks */\n                           cptr++;\n\n                        if (*cptr == '\\0')  /* TNULLn is all blanks? */\n                            tnull = LONG_MIN;\n                        else\n                        {                                                \n                            /* attempt to read TNULLn string as an integer */\n                            ffc2ii(nullstr, &tnull, &tstatus);\n\n                            if (tstatus)\n                                tnull = LONG_MIN;  /* choose smallest value */\n                        }                          /* to represent nulls */\n                    }\n                }\n                else  /* Binary table; TNULLn value is an integer */\n                {\n                    ffkeyn(\"TNULL\", cols[jj].colnum, keyname, &tstatus);\n                    ffgkyj(cols[jj].fptr, keyname, &tnull, 0, &tstatus);\n                    if (tstatus)\n                    {\n                        tnull = 0L; /* keyword doesn't exist; no null values */\n                    }\n                    else if (tnull == 0)\n                    {\n                        /* worst possible case: a value of 0 is used to   */\n                        /* represent nulls in the FITS file.  We have to  */\n                        /* use a non-zero null value here (zero is used to */\n                        /* mean there are no null values in the array) so we */\n                        /* will use the smallest possible integer instead. */\n\n                        tnull = LONG_MIN;  /* choose smallest possible value */\n                    }\n                }\n            }\n        }\n\n        /* Note that the data array starts with 2nd element;  */\n        /* 1st element of the array gives the null data value */\n\n        switch (cols[jj].datatype)\n        {\n         case TBYTE:\n          cols[jj].array = calloc(ntodo + 1, sizeof(char));\n          col[jj].nullsize  = sizeof(char);  /* number of bytes per value */\n\n          if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG\n              || abs(typecode) == TINT || abs(typecode) == TLONGLONG)\n          {\n              tnull = minvalue(tnull, 255);\n              tnull = maxvalue(tnull, 0);\n              col[jj].null.charnull = (unsigned char) tnull;\n          }\n          else\n          {\n              col[jj].null.charnull = (unsigned char) 255; /* use 255 as null */\n          }\n          break;\n\n         case TSBYTE:\n          cols[jj].array = calloc(ntodo + 1, sizeof(char));\n          col[jj].nullsize  = sizeof(char);  /* number of bytes per value */\n\n          if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG\n              || abs(typecode) == TINT || abs(typecode) == TLONGLONG)\n          {\n              tnull = minvalue(tnull, 127);\n              tnull = maxvalue(tnull, -128);\n              col[jj].null.scharnull = (signed char) tnull;\n          }\n          else\n          {\n              col[jj].null.scharnull = (signed char) -128; /* use -128  null */\n          }\n          break;\n\n         case TSHORT:\n          cols[jj].array = calloc(ntodo + 1, sizeof(short));\n          col[jj].nullsize  = sizeof(short);  /* number of bytes per value */\n\n          if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG\n              || abs(typecode) == TINT || abs(typecode) == TLONGLONG)\n          {\n              tnull = minvalue(tnull, SHRT_MAX);\n              tnull = maxvalue(tnull, SHRT_MIN);\n              col[jj].null.shortnull = (short) tnull;\n          }\n          else\n          {\n              col[jj].null.shortnull = SHRT_MIN;  /* use minimum as null */\n          }\n          break;\n\n         case TUSHORT:\n          cols[jj].array = calloc(ntodo + 1, sizeof(unsigned short));\n          col[jj].nullsize  = sizeof(unsigned short);  /* bytes per value */\n\n          if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG\n               || abs(typecode) == TINT || abs(typecode) == TLONGLONG)\n          {\n              tnull = minvalue(tnull, (long) USHRT_MAX);\n              tnull = maxvalue(tnull, 0);  /* don't allow negative value */\n              col[jj].null.ushortnull = (unsigned short) tnull;\n          }\n          else\n          {\n              col[jj].null.ushortnull = USHRT_MAX;   /* use maximum null */\n          }\n          break;\n\n         case TINT:\n          cols[jj].array = calloc(sizeof(int), ntodo + 1);\n          col[jj].nullsize  = sizeof(int);  /* number of bytes per value */\n\n          if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG\n               || abs(typecode) == TINT || abs(typecode) == TLONGLONG)\n          {\n              tnull = minvalue(tnull, INT_MAX);\n              tnull = maxvalue(tnull, INT_MIN);\n              col[jj].null.intnull = (int) tnull;\n          }\n          else\n          {\n              col[jj].null.intnull = INT_MIN;  /* use minimum as null */\n          }\n          break;\n\n         case TUINT:\n          cols[jj].array = calloc(ntodo + 1, sizeof(unsigned int));\n          col[jj].nullsize  = sizeof(unsigned int);  /* bytes per value */\n\n          if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG\n               || abs(typecode) == TINT || abs(typecode) == TLONGLONG)\n          {\n              tnull = minvalue(tnull, INT32_MAX);\n              tnull = maxvalue(tnull, 0);\n              col[jj].null.uintnull = (unsigned int) tnull;\n          }\n          else\n          {\n              col[jj].null.uintnull = UINT_MAX;  /* use maximum as null */\n          }\n          break;\n\n         case TLONG:\n          cols[jj].array = calloc(ntodo + 1, sizeof(long));\n          col[jj].nullsize  = sizeof(long);  /* number of bytes per value */\n\n          if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG\n               || abs(typecode) == TINT || abs(typecode) == TLONGLONG)\n          {\n              col[jj].null.longnull = tnull;\n          }\n          else\n          {\n              col[jj].null.longnull = LONG_MIN;   /* use minimum as null */\n          }\n          break;\n\n         case TULONG:\n          cols[jj].array = calloc(ntodo + 1, sizeof(unsigned long));\n          col[jj].nullsize  = sizeof(unsigned long);  /* bytes per value */\n\n          if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG\n               || abs(typecode) == TINT || abs(typecode) == TLONGLONG)\n          {\n              if (tnull < 0)  /* can't use a negative null value */\n                  col[jj].null.ulongnull = LONG_MAX;\n              else\n                  col[jj].null.ulongnull = (unsigned long) tnull;\n          }\n          else\n          {\n              col[jj].null.ulongnull = LONG_MAX;   /* use maximum as null */\n          }\n          break;\n\n         case TFLOAT:\n          cols[jj].array = calloc(ntodo + 1, sizeof(float));\n          col[jj].nullsize  = sizeof(float);  /* number of bytes per value */\n\n          if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG\n               || abs(typecode) == TINT || abs(typecode) == TLONGLONG)\n          {\n              col[jj].null.floatnull = (float) tnull;\n          }\n          else\n          {\n              col[jj].null.floatnull = FLOATNULLVALUE;  /* special value */\n          }\n          break;\n\n         case TCOMPLEX:\n          cols[jj].array = calloc((ntodo * 2) + 1, sizeof(float));\n          col[jj].nullsize  = sizeof(float);  /* number of bytes per value */\n          col[jj].null.floatnull = FLOATNULLVALUE;  /* special value */\n          break;\n\n         case TDOUBLE:\n          cols[jj].array = calloc(ntodo + 1, sizeof(double));\n          col[jj].nullsize  = sizeof(double);  /* number of bytes per value */\n\n          if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG\n               || abs(typecode) == TINT || abs(typecode) == TLONGLONG)\n          {\n              col[jj].null.doublenull = (double) tnull;\n          }\n          else\n          {\n              col[jj].null.doublenull = DOUBLENULLVALUE;  /* special value */\n          }\n          break;\n\n         case TDBLCOMPLEX:\n          cols[jj].array = calloc((ntodo * 2) + 1, sizeof(double));\n          col[jj].nullsize  = sizeof(double);  /* number of bytes per value */\n          col[jj].null.doublenull = DOUBLENULLVALUE;  /* special value */\n          break;\n\n         case TSTRING:\n          /* allocate array of pointers to all the strings  */\n\t  if( hdutype==ASCII_TBL ) rept = width;\n          stringptr = calloc((ntodo + 1) , sizeof(stringptr));\n          cols[jj].array = stringptr;\n          col[jj].nullsize  = rept + 1;  /* number of bytes per value */\n\n          if (stringptr)\n          {\n            /* allocate string to store the null string value */\n            col[jj].null.stringnull = calloc(rept + 1, sizeof(char) );\n            if (rept > 0)\n               col[jj].null.stringnull[1] = 1; /* to make sure string != 0 */\n\n            /* allocate big block for the array of table column strings */\n            stringptr[0] = calloc((ntodo + 1) * (rept + 1), sizeof(char) );\n\n            if (stringptr[0])\n            {\n              for (ii = 1; ii <= ntodo; ii++)\n              {   /* pointer to each string */\n                stringptr[ii] = stringptr[ii - 1] + (rept + 1);\n              }\n\n              /* get the TNULL keyword value, if it exists */\n              tstatus = 0;\n              ffkeyn(\"TNULL\", cols[jj].colnum, keyname, &tstatus);\n              ffgkys(cols[jj].fptr, keyname, nullstr, 0, &tstatus);\n              if (!tstatus)\n                  strncat(col[jj].null.stringnull, nullstr, rept);\n            }\n            else\n            {\n              ffpmsg(\"ffiter failed to allocate memory arrays\");\n              *status = MEMORY_ALLOCATION;  /* memory allocation failed */\n              goto cleanup;\n            }\n          }\n          break;\n\n         case TLOGICAL:\n\n          cols[jj].array = calloc(ntodo + 1, sizeof(char));\n          col[jj].nullsize  = sizeof(char);  /* number of bytes per value */\n\n          /* use value = 2 to flag null values in logical columns */\n          col[jj].null.charnull = 2;\n          break;\n\n         case TLONGLONG:\n          cols[jj].array = calloc(ntodo + 1, sizeof(LONGLONG));\n          col[jj].nullsize  = sizeof(LONGLONG);  /* number of bytes per value */\n\n          if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG ||\n\t      abs(typecode) == TLONGLONG || abs(typecode) == TINT)\n          {\n              col[jj].null.longlongnull = tnull;\n          }\n          else\n          {\n              col[jj].null.longlongnull = LONGLONG_MIN;   /* use minimum as null */\n          }\n          break;\n\n         default:\n          snprintf(message,FLEN_ERRMSG,\n                  \"Column %d datatype currently not supported: %d:  (ffiter)\",\n                   jj + 1, cols[jj].datatype);\n          ffpmsg(message);\n          *status = BAD_DATATYPE;\n          goto cleanup;\n\n        }   /* end of switch block */\n\n        /* check that all the arrays were allocated successfully */\n        if (!cols[jj].array)\n        {\n            ffpmsg(\"ffiter failed to allocate memory arrays\");\n            *status = MEMORY_ALLOCATION;  /* memory allocation failed */\n            goto cleanup;\n        }\n    }\n\n    /*--------------------------------------------------*/\n    /* main loop while there are values left to process */\n    /*--------------------------------------------------*/\n\n    nleft = totaln;\n\n    while (nleft)\n    {\n      ntodo = minvalue(nleft, n_optimum); /* no. of values for this loop */\n\n      /*  read input columns from FITS file(s)  */\n      for (jj = 0; jj < n_cols; jj++)\n      {\n        if (cols[jj].iotype != OutputCol)\n        {\n          if (cols[jj].datatype == TSTRING)\n          {\n            stringptr = cols[jj].array;\n            dataptr = stringptr + 1;\n            defaultnull = col[jj].null.stringnull; /* ptr to the null value */\n          }\n          else\n          {\n            dataptr = (char *) cols[jj].array + col[jj].nullsize;\n            defaultnull = &col[jj].null.charnull; /* ptr to the null value */\n          }\n\n          if (hdutype == IMAGE_HDU)   \n          {\n              if (ffgpv(cols[jj].fptr, cols[jj].datatype,\n                    felement, cols[jj].repeat * ntodo, defaultnull,\n                    dataptr,  &anynul, status) > 0)\n              {\n                 break;\n              }\n          }\n          else\n          {\n\t      if (ffgtcl(cols[jj].fptr, cols[jj].colnum, &typecode, &rept,&width, status) > 0)\n\t          goto cleanup;\n\t\t  \n\t      if (typecode<0)\n\t      {\n\t        /* get size of the variable length vector */\n\t\tffgdes(cols[jj].fptr, cols[jj].colnum, frow,&cols[jj].repeat, NULL,status);\n\t      }\n\t\t\n              if (ffgcv(cols[jj].fptr, cols[jj].datatype, cols[jj].colnum,\n                    frow, felement, cols[jj].repeat * ntodo, defaultnull,\n                    dataptr,  &anynul, status) > 0)\n              {\n                 break;\n              }\n          }\n\n          /* copy the appropriate null value into first array element */\n\n          if (anynul)   /* are there any nulls in the data? */\n          {   \n            if (cols[jj].datatype == TSTRING)\n            {\n              stringptr = cols[jj].array;\n              memcpy(*stringptr, col[jj].null.stringnull, col[jj].nullsize);\n            }\n            else\n            {\n              memcpy(cols[jj].array, defaultnull, col[jj].nullsize);\n            }\n          }\n          else /* no null values so copy zero into first element */\n          {\n            if (cols[jj].datatype == TSTRING)\n            {\n              stringptr = cols[jj].array;\n              memset(*stringptr, 0, col[jj].nullsize);  \n            }\n            else\n            {\n              memset(cols[jj].array, 0, col[jj].nullsize);  \n            }\n          }\n        }\n      }\n\n      if (*status > 0) \n         break;   /* looks like an error occurred; quit immediately */\n\n      /* call work function */\n\n      if (hdutype == IMAGE_HDU) \n          *status = work_fn(totaln, offset, felement, ntodo, n_cols, cols,\n                    userPointer);\n      else\n          *status = work_fn(totaln, offset, frow, ntodo, n_cols, cols,\n                    userPointer);\n\n      if (*status > 0 || *status < -1 ) \n         break;   /* looks like an error occurred; quit immediately */\n\n      /*  write output columns  before quiting if status = -1 */\n      tstatus = 0;\n      for (jj = 0; jj < n_cols; jj++)\n      {\n        if (cols[jj].iotype != InputCol)\n        {\n          if (cols[jj].datatype == TSTRING)\n          {\n            stringptr = cols[jj].array;\n            dataptr = stringptr + 1;\n            nullptr = *stringptr;\n            nbytes = 2;\n          }\n          else\n          {\n            dataptr = (char *) cols[jj].array + col[jj].nullsize;\n            nullptr = (char *) cols[jj].array;\n            nbytes = col[jj].nullsize;\n          }\n\n          if (memcmp(nullptr, &zeros, nbytes) ) \n          {\n            /* null value flag not zero; must check for and write nulls */\n            if (hdutype == IMAGE_HDU)   \n            {\n                if (ffppn(cols[jj].fptr, cols[jj].datatype, \n                      felement, cols[jj].repeat * ntodo, dataptr,\n                      nullptr, &tstatus) > 0)\n                break;\n            }\n            else\n            {\n\t    \tif (ffgtcl(cols[jj].fptr, cols[jj].colnum, &typecode, &rept,&width, status) > 0)\n\t\t    goto cleanup;\n\t\t    \n\t\tif (typecode<0)  /* variable length array colum */\n\t\t{\n\t\t   ffgdes(cols[jj].fptr, cols[jj].colnum, frow,&cols[jj].repeat, NULL,status);\n\t\t}\n\n                if (ffpcn(cols[jj].fptr, cols[jj].datatype, cols[jj].colnum, frow,\n                      felement, cols[jj].repeat * ntodo, dataptr,\n                      nullptr, &tstatus) > 0)\n                break;\n            }\n          }\n          else\n          { \n            /* no null values; just write the array */\n            if (hdutype == IMAGE_HDU)   \n            {\n                if (ffppr(cols[jj].fptr, cols[jj].datatype,\n                      felement, cols[jj].repeat * ntodo, dataptr,\n                      &tstatus) > 0)\n                break;\n            }\n            else\n            {\n\t    \tif (ffgtcl(cols[jj].fptr, cols[jj].colnum, &typecode, &rept,&width, status) > 0)\n\t\t    goto cleanup;\n\t\t    \n\t\tif (typecode<0)  /* variable length array column */\n\t\t{\n\t\t   ffgdes(cols[jj].fptr, cols[jj].colnum, frow,&cols[jj].repeat, NULL,status);\n\t\t}\n\n                 if (ffpcl(cols[jj].fptr, cols[jj].datatype, cols[jj].colnum, frow,\n                      felement, cols[jj].repeat * ntodo, dataptr,\n                      &tstatus) > 0)\n                break;\n            }\n          }\n        }\n      }\n\n      if (*status == 0)\n         *status = tstatus;   /* propagate any error status from the writes */\n\n      if (*status) \n         break;   /* exit on any error */\n\n      nleft -= ntodo;\n\n      if (hdutype == IMAGE_HDU)\n          felement += ntodo;\n      else\n          frow  += ntodo;\n    }\n\ncleanup:\n\n    /*----------------------------------*/\n    /* free work arrays for the columns */\n    /*----------------------------------*/\n\n    for (jj = 0; jj < n_cols; jj++)\n    {\n        if (cols[jj].datatype == TSTRING)\n        {\n            if (cols[jj].array)\n            {\n                stringptr = cols[jj].array;\n                free(*stringptr);     /* free the block of strings */\n                free(col[jj].null.stringnull); /* free the null string */\n            }\n        }\n        if (cols[jj].array)\n            free(cols[jj].array); /* memory for the array of values from the col */\n    }\n    free(col);   /* the structure containing the null values */\n    return(*status);\n}\n\n"},{"id":16638,"name":"putcolj.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, putcolj.c, contains routines that write data elements to    */\n/*  a FITS image or table, with long datatype.                             */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <limits.h>\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffpprj( fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            long  *array,    /* I - array of values that are written        */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n    long nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_pixels(fptr, TLONG, firstelem, nelem,\n            0, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpclj(fptr, 2, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffppnj( fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            long  *array,    /* I - array of values that are written        */\n            long  nulval,    /* I - undefined pixel value                   */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).  Any array values\n  that are equal to the value of nulval will be replaced with the null\n  pixel value that is appropriate for this column.\n*/\n{\n    long row;\n    long nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        nullvalue = nulval;  /* set local variable */\n        fits_write_compressed_pixels(fptr, TLONG, firstelem, nelem,\n            1, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcnj(fptr, 2, row, firstelem, nelem, array, nulval, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp2dj(fitsfile *fptr,   /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           long  *array,     /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n\n    /* call the 3D writing routine, with the 3rd dimension = 1 */\n\n    ffp3dj(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp3dj(fitsfile *fptr,   /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  nrows,      /* I - number of rows in each plane of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           LONGLONG  naxis3,     /* I - FITS image NAXIS3 value               */\n           long  *array,     /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 3-D cube of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    long tablerow, ii, jj;\n    long fpixel[3]= {1,1,1}, lpixel[3];\n    LONGLONG nfits, narray;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n           \n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n        lpixel[0] = (long) ncols;\n        lpixel[1] = (long) nrows;\n        lpixel[2] = (long) naxis3;\n       \n        fits_write_compressed_img(fptr, TLONG, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n      /* all the image pixels are contiguous, so write all at once */\n      ffpclj(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status);\n      return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to write to */\n    narray = 0;  /* next pixel in input array to be written */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* writing naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffpclj(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0)\n         return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpssj(fitsfile *fptr,   /* I - FITS file pointer                       */\n           long  group,      /* I - group to write(1 = 1st group)           */\n           long  naxis,      /* I - number of data axes in array            */\n           long  *naxes,     /* I - size of each FITS axis                  */\n           long  *fpixel,    /* I - 1st pixel in each axis to write (1=1st) */\n           long  *lpixel,    /* I - last pixel in each axis to write        */\n           long *array,      /* I - array to be written                     */\n           int  *status)     /* IO - error status                           */\n/*\n  Write a subsection of pixels to the primary array or image.\n  A subsection is defined to be any contiguous rectangular\n  array of pixels within the n-dimensional FITS data file.\n  Data conversion and scaling will be performed if necessary \n  (e.g, if the datatype of the FITS array is not the same as\n  the array being written).\n*/\n{\n    long tablerow;\n    LONGLONG fpix[7], dimen[7], astart, pstart;\n    LONGLONG off2, off3, off4, off5, off6, off7;\n    LONGLONG st10, st20, st30, st40, st50, st60, st70;\n    LONGLONG st1, st2, st3, st4, st5, st6, st7;\n    long ii, i1, i2, i3, i4, i5, i6, i7, irange[7];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_img(fptr, TLONG, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    if (naxis < 1 || naxis > 7)\n      return(*status = BAD_DIMEN);\n\n    tablerow=maxvalue(1,group);\n\n     /* calculate the size and number of loops to perform in each dimension */\n    for (ii = 0; ii < 7; ii++)\n    {\n      fpix[ii]=1;\n      irange[ii]=1;\n      dimen[ii]=1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {    \n      fpix[ii]=fpixel[ii];\n      irange[ii]=lpixel[ii]-fpixel[ii]+1;\n      dimen[ii]=naxes[ii];\n    }\n\n    i1=irange[0];\n\n    /* compute the pixel offset between each dimension */\n    off2 =     dimen[0];\n    off3 = off2 * dimen[1];\n    off4 = off3 * dimen[2];\n    off5 = off4 * dimen[3];\n    off6 = off5 * dimen[4];\n    off7 = off6 * dimen[5];\n\n    st10 = fpix[0];\n    st20 = (fpix[1] - 1) * off2;\n    st30 = (fpix[2] - 1) * off3;\n    st40 = (fpix[3] - 1) * off4;\n    st50 = (fpix[4] - 1) * off5;\n    st60 = (fpix[5] - 1) * off6;\n    st70 = (fpix[6] - 1) * off7;\n\n    /* store the initial offset in each dimension */\n    st1 = st10;\n    st2 = st20;\n    st3 = st30;\n    st4 = st40;\n    st5 = st50;\n    st6 = st60;\n    st7 = st70;\n\n    astart = 0;\n\n    for (i7 = 0; i7 < irange[6]; i7++)\n    {\n     for (i6 = 0; i6 < irange[5]; i6++)\n     {\n      for (i5 = 0; i5 < irange[4]; i5++)\n      {\n       for (i4 = 0; i4 < irange[3]; i4++)\n       {\n        for (i3 = 0; i3 < irange[2]; i3++)\n        {\n         pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7;\n\n         for (i2 = 0; i2 < irange[1]; i2++)\n         {\n           if (ffpclj(fptr, 2, tablerow, pstart, i1, &array[astart],\n              status) > 0)\n              return(*status);\n\n           astart += i1;\n           pstart += off2;\n         }\n         st2 = st20;\n         st3 = st3+off3;    \n        }\n        st3 = st30;\n        st4 = st4+off4;\n       }\n       st4 = st40;\n       st5 = st5+off5;\n      }\n      st5 = st50;\n      st6 = st6+off6;\n     }\n     st6 = st60;\n     st7 = st7+off7;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpgpj( fitsfile *fptr,   /* I - FITS file pointer                      */\n            long  group,      /* I - group to write(1 = 1st group)          */\n            long  firstelem,  /* I - first vector element to write(1 = 1st) */\n            long  nelem,      /* I - number of values to write              */\n            long  *array,     /* I - array of values that are written       */\n            int  *status)     /* IO - error status                          */\n/*\n  Write an array of group parameters to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffpclj(fptr, 1L, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpclj( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            long  *array,    /* I - array of values to write                */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer to a virtual column in a 1 or more grouped FITS primary\n  array.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    int tcode, maxelem2, hdutype, writeraw;\n    long twidth, incre;\n    long ntodo;\n    LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull, maxelem;\n    double scale, zero;\n    char tform[20], cform[20];\n    char message[FLEN_ERRMSG];\n\n    char snull[20];   /*  the FITS null value  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem2, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n    maxelem = maxelem2;\n\n    if (tcode == TSTRING)   \n         ffcfmt(tform, cform);     /* derive C format for writing strings */\n\n    /*\n       if there is no scaling and the native machine format is not byteswapped\n       then we can simply write the raw data bytes into the FITS file if the\n       datatype of the FITS column is the same as the input values.  Otherwise\n       we must convert the raw values into the scaled and/or machine dependent\n       format in a temporary buffer that has been allocated for this purpose.\n    */\n    if (scale == 1. && zero == 0. && \n       MACHINE == NATIVE && tcode == TLONG && LONGSIZE == 32)\n    {\n        writeraw = 1;\n        if (nelem < (LONGLONG)INT32_MAX) {\n            maxelem = nelem;\n        } else {\n            maxelem = INT32_MAX/8;\n        }\n    }\n    else\n        writeraw = 0;\n\n    /*---------------------------------------------------------------------*/\n    /*  Now write the pixels to the FITS column.                           */\n    /*  First call the ffXXfYY routine to  (1) convert the datatype        */\n    /*  if necessary, and (2) scale the values by the FITS TSCALn and      */\n    /*  TZEROn linear scaling parameters into a temporary buffer.          */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to write  */\n    next = 0;                 /* next element in array to be written  */\n    rownum = 0;               /* row number, relative to firstrow     */\n\n    while (remain)\n    {\n        /* limit the number of pixels to process a one time to the number that\n           will fit in the buffer space or to the number of pixels that remain\n           in the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);      \n        ntodo = (long) minvalue(ntodo, (repeat - elemnum));\n\n        wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre);\n\n        ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */\n\n        switch (tcode) \n        {\n            case (TLONG):\n              if (writeraw)\n              {\n                /* write raw input bytes without conversion */\n                ffpi4b(fptr, ntodo, incre, (INT32BIT *) &array[next], status);\n              }\n              else\n              {\n                /* convert the raw data before writing to FITS file */\n                ffi4fi4(&array[next], ntodo, scale, zero,\n                        (INT32BIT *) buffer, status);\n                ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status);\n              }\n\n              break;\n\n            case (TLONGLONG):\n\n                ffi4fi8(&array[next], ntodo, scale, zero,\n                        (LONGLONG *) buffer, status);\n                ffpi8b(fptr, ntodo, incre, (long *) buffer, status);\n                break;\n\n            case (TBYTE):\n \n                ffi4fi1(&array[next], ntodo, scale, zero,\n                        (unsigned char *) buffer, status);\n                ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status);\n                break;\n\n            case (TSHORT):\n\n                ffi4fi2(&array[next], ntodo, scale, zero,\n                        (short *) buffer, status);\n                ffpi2b(fptr, ntodo, incre, (short *) buffer, status);\n                break;\n\n            case (TFLOAT):\n\n                ffi4fr4(&array[next], ntodo, scale, zero,\n                        (float *) buffer, status);\n                ffpr4b(fptr, ntodo, incre, (float *) buffer, status);\n                break;\n\n            case (TDOUBLE):\n                ffi4fr8(&array[next], ntodo, scale, zero,\n                       (double *) buffer, status);\n                ffpr8b(fptr, ntodo, incre, (double *) buffer, status);\n                break;\n\n            case (TSTRING):  /* numerical column in an ASCII table */\n\n                if (cform[1] != 's')  /*  \"%s\" format is a string */\n                {\n                  ffi4fstr(&array[next], ntodo, scale, zero, cform,\n                          twidth, (char *) buffer, status);\n\n                  if (incre == twidth)    /* contiguous bytes */\n                     ffpbyt(fptr, ntodo * twidth, buffer, status);\n                  else\n                     ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                            status);\n\n                  break;\n                }\n                /* can't write to string column, so fall thru to default: */\n\n            default:  /*  error trap  */\n                snprintf(message, FLEN_ERRMSG,\n                     \"Cannot write numbers to column %d which has format %s\",\n                      colnum,tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous write operation */\n        {\n          snprintf(message,FLEN_ERRMSG,\n          \"Error writing elements %.0f thru %.0f of input data array (ffpclj).\",\n              (double) (next+1), (double) (next+ntodo));\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum += ntodo;\n            if (elemnum == repeat)  /* completed a row; start on next row */\n            {\n                elemnum = 0;\n                rownum++;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while writing FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcnj( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            long  *array,    /* I - array of values to write                */\n            long   nulvalue, /* I - value used to flag undefined pixels     */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of elements to the specified column of a table.  Any input\n  pixels equal to the value of nulvalue will be replaced by the appropriate\n  null value in the output FITS file. \n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary\n*/\n{\n    tcolumn *colptr;\n    LONGLONG  ngood = 0, nbad = 0, ii;\n    LONGLONG repeat, first, fstelm, fstrow;\n    int tcode, overflow = 0;\n \n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n    }\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n\n    tcode  = colptr->tdatatype;\n\n    if (tcode > 0)\n       repeat = colptr->trepeat;  /* repeat count for this column */\n    else\n       repeat = firstelem -1 + nelem;  /* variable length arrays */\n\n    /* if variable length array, first write the whole input vector, \n       then go back and fill in the nulls */\n    if (tcode < 0) {\n      if (ffpclj(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) {\n        if (*status == NUM_OVERFLOW) \n\t{\n\t  /* ignore overflows, which are possibly the null pixel values */\n\t  /*  overflow = 1;   */\n\t  *status = 0;\n\t} else { \n          return(*status);\n\t}\n      }\n    }\n\n    /* absolute element number in the column */\n    first = (firstrow - 1) * repeat + firstelem;\n\n    for (ii = 0; ii < nelem; ii++)\n    {\n      if (array[ii] != nulvalue)  /* is this a good pixel? */\n      {\n         if (nbad)  /* write previous string of bad pixels */\n         {\n            fstelm = ii - nbad + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\t  \n            if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0)\n                return(*status);\n\n            nbad=0;\n         }\n\n         ngood = ngood + 1;  /* the consecutive number of good pixels */\n      }\n      else\n      {\n         if (ngood)  /* write previous string of good pixels */\n         {\n            fstelm = ii - ngood + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (tcode > 0) {  /* variable length arrays have already been written */\n              if (ffpclj(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood],\n                status) > 0) {\n\t\tif (*status == NUM_OVERFLOW) \n\t\t{\n\t\t  overflow = 1;\n\t\t  *status = 0;\n\t\t} else { \n                  return(*status);\n\t\t}\n\t      }\n\t    }\n            ngood=0;\n         }\n\n         nbad = nbad +1;  /* the consecutive number of bad pixels */\n      }\n    }\n\n    /* finished loop;  now just write the last set of pixels */\n\n    if (ngood)  /* write last string of good pixels */\n    {\n      fstelm = ii - ngood + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      if (tcode > 0) {  /* variable length arrays have already been written */\n        ffpclj(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status);\n      }\n    }\n    else if (nbad) /* write last string of bad pixels */\n    {\n      fstelm = ii - nbad + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      ffpclu(fptr, colnum, fstrow, fstelm, nbad, status);\n    }\n\n    if (*status <= 0) {\n      if (overflow) {\n        *status = NUM_OVERFLOW;\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi4fi1(long *input,           /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            unsigned char *output, /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] < 0)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (input[ii] > UCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DUCHAR_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (dvalue > DUCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) (dvalue + .5);\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi4fi2(long *input,       /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            short *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] < SHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MIN;\n            }\n            else if (input[ii] > SHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n                output[ii] = (short) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DSHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MIN;\n            }\n            else if (dvalue > DSHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (short) (dvalue + .5);\n                else\n                    output[ii] = (short) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi4fi4(long *input,       /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            INT32BIT *output,  /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (INT32BIT) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (INT32BIT) (dvalue + .5);\n                else\n                    output[ii] = (INT32BIT) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi4fi8(long *input,       /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            LONGLONG *output,      /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero ==  9223372036854775808.)\n    {       \n        /* Writing to unsigned long long column. Input values must not be negative */\n        /* Instead of subtracting 9223372036854775808, it is more efficient */\n        /* and more precise to just flip the sign bit with the XOR operator */\n\n        for (ii = 0; ii < ntodo; ii++) {\n           if (input[ii] < 0) {\n              *status = OVERFLOW_ERR;\n              output[ii] = LONGLONG_MIN;\n           } else {\n              output[ii] =  ((LONGLONG) input[ii]) ^ 0x8000000000000000;\n           }\n        }\n    }\n    else if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DLONGLONG_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MIN;\n            }\n            else if (dvalue > DLONGLONG_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (LONGLONG) (dvalue + .5);\n                else\n                    output[ii] = (LONGLONG) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi4fr4(long *input,       /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            float *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (float) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (float) ((input[ii] - zero) / scale);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi4fr8(long *input,       /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            double *output,    /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (double) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (input[ii] - zero) / scale;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi4fstr(long *input,      /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            char *cform,       /* I - format for output string values  */\n            long twidth,       /* I - width of each field, in chars    */\n            char *output,      /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n    char *cptr;\n\n    cptr = output;\n    \n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n           sprintf(output, cform, (double) input[ii]);\n           output += twidth;\n\n           if (*output)  /* if this char != \\0, then overflow occurred */\n              *status = OVERFLOW_ERR;\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n          dvalue = (input[ii] - zero) / scale;\n          sprintf(output, cform, dvalue);\n          output += twidth;\n\n          if (*output)  /* if this char != \\0, then overflow occurred */\n            *status = OVERFLOW_ERR;\n        }\n    }\n\n    /* replace any commas with periods (e.g., in French locale) */\n    while ((cptr = strchr(cptr, ','))) *cptr = '.';\n\n    return(*status);\n}\n\n/* ======================================================================== */\n/*      the following routines support the 'long long' data type            */\n/* ======================================================================== */\n\n/*--------------------------------------------------------------------------*/\nint ffpprjj(fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            LONGLONG  *array, /* I - array of values that are written       */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        ffpmsg(\"writing TLONGLONG to compressed image is not supported\");\n\n        return(*status = DATA_COMPRESSION_ERR);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcljj(fptr, 2, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffppnjj(fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            LONGLONG  *array, /* I - array of values that are written       */\n            LONGLONG  nulval,    /* I - undefined pixel value                   */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).  Any array values\n  that are equal to the value of nulval will be replaced with the null\n  pixel value that is appropriate for this column.\n*/\n{\n    long row;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        ffpmsg(\"writing TLONGLONG to compressed image is not supported\");\n\n        return(*status = DATA_COMPRESSION_ERR);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcnjj(fptr, 2, row, firstelem, nelem, array, nulval, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp2djj(fitsfile *fptr,  /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           LONGLONG  *array, /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n\n    /* call the 3D writing routine, with the 3rd dimension = 1 */\n\n    ffp3djj(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp3djj(fitsfile *fptr,  /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  nrows,      /* I - number of rows in each plane of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           LONGLONG  naxis3,     /* I - FITS image NAXIS3 value               */\n           LONGLONG  *array, /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 3-D cube of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    long tablerow, ii, jj;\n    LONGLONG nfits, narray;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        ffpmsg(\"writing TLONGLONG to compressed image is not supported\");\n\n        return(*status = DATA_COMPRESSION_ERR);\n    }\n\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n      /* all the image pixels are contiguous, so write all at once */\n      ffpcljj(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status);\n      return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to write to */\n    narray = 0;  /* next pixel in input array to be written */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* writing naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffpcljj(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0)\n         return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpssjj(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,      /* I - group to write(1 = 1st group)           */\n           long  naxis,      /* I - number of data axes in array            */\n           long  *naxes,     /* I - size of each FITS axis                  */\n           long  *fpixel,    /* I - 1st pixel in each axis to write (1=1st) */\n           long  *lpixel,    /* I - last pixel in each axis to write        */\n           LONGLONG *array,  /* I - array to be written                     */\n           int  *status)     /* IO - error status                           */\n/*\n  Write a subsection of pixels to the primary array or image.\n  A subsection is defined to be any contiguous rectangular\n  array of pixels within the n-dimensional FITS data file.\n  Data conversion and scaling will be performed if necessary \n  (e.g, if the datatype of the FITS array is not the same as\n  the array being written).\n*/\n{\n    long tablerow;\n    LONGLONG fpix[7], dimen[7], astart, pstart;\n    LONGLONG off2, off3, off4, off5, off6, off7;\n    LONGLONG st10, st20, st30, st40, st50, st60, st70;\n    LONGLONG st1, st2, st3, st4, st5, st6, st7;\n    long ii, i1, i2, i3, i4, i5, i6, i7, irange[7];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        ffpmsg(\"writing TLONGLONG to compressed image is not supported\");\n\n        return(*status = DATA_COMPRESSION_ERR);\n    }\n\n    if (naxis < 1 || naxis > 7)\n      return(*status = BAD_DIMEN);\n\n    tablerow=maxvalue(1,group);\n\n     /* calculate the size and number of loops to perform in each dimension */\n    for (ii = 0; ii < 7; ii++)\n    {\n      fpix[ii]=1;\n      irange[ii]=1;\n      dimen[ii]=1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {    \n      fpix[ii]=fpixel[ii];\n      irange[ii]=lpixel[ii]-fpixel[ii]+1;\n      dimen[ii]=naxes[ii];\n    }\n\n    i1=irange[0];\n\n    /* compute the pixel offset between each dimension */\n    off2 =     dimen[0];\n    off3 = off2 * dimen[1];\n    off4 = off3 * dimen[2];\n    off5 = off4 * dimen[3];\n    off6 = off5 * dimen[4];\n    off7 = off6 * dimen[5];\n\n    st10 = fpix[0];\n    st20 = (fpix[1] - 1) * off2;\n    st30 = (fpix[2] - 1) * off3;\n    st40 = (fpix[3] - 1) * off4;\n    st50 = (fpix[4] - 1) * off5;\n    st60 = (fpix[5] - 1) * off6;\n    st70 = (fpix[6] - 1) * off7;\n\n    /* store the initial offset in each dimension */\n    st1 = st10;\n    st2 = st20;\n    st3 = st30;\n    st4 = st40;\n    st5 = st50;\n    st6 = st60;\n    st7 = st70;\n\n    astart = 0;\n\n    for (i7 = 0; i7 < irange[6]; i7++)\n    {\n     for (i6 = 0; i6 < irange[5]; i6++)\n     {\n      for (i5 = 0; i5 < irange[4]; i5++)\n      {\n       for (i4 = 0; i4 < irange[3]; i4++)\n       {\n        for (i3 = 0; i3 < irange[2]; i3++)\n        {\n         pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7;\n\n         for (i2 = 0; i2 < irange[1]; i2++)\n         {\n           if (ffpcljj(fptr, 2, tablerow, pstart, i1, &array[astart],\n              status) > 0)\n              return(*status);\n\n           astart += i1;\n           pstart += off2;\n         }\n         st2 = st20;\n         st3 = st3+off3;    \n        }\n        st3 = st30;\n        st4 = st4+off4;\n       }\n       st4 = st40;\n       st5 = st5+off5;\n      }\n      st5 = st50;\n      st6 = st6+off6;\n     }\n     st6 = st60;\n     st7 = st7+off7;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpgpjj(fitsfile *fptr,   /* I - FITS file pointer                      */\n            long  group,      /* I - group to write(1 = 1st group)          */\n            long  firstelem,  /* I - first vector element to write(1 = 1st) */\n            long  nelem,      /* I - number of values to write              */\n            LONGLONG  *array, /* I - array of values that are written       */\n            int  *status)     /* IO - error status                          */\n/*\n  Write an array of group parameters to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffpcljj(fptr, 1L, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcljj(fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            LONGLONG  *array, /* I - array of values to write               */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer to a virtual column in a 1 or more grouped FITS primary\n  array.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    int tcode, maxelem2, hdutype, writeraw;\n    long twidth, incre;\n    long  ntodo;\n    LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull, maxelem;\n    double scale, zero;\n    char tform[20], cform[20];\n    char message[FLEN_ERRMSG];\n\n    char snull[20];   /*  the FITS null value  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem2, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n    maxelem = maxelem2;\n\n    if (tcode == TSTRING)   \n         ffcfmt(tform, cform);     /* derive C format for writing strings */\n\n    /*\n       if there is no scaling and the native machine format is not byteswapped\n       then we can simply write the raw data bytes into the FITS file if the\n       datatype of the FITS column is the same as the input values.  Otherwise\n       we must convert the raw values into the scaled and/or machine dependent\n       format in a temporary buffer that has been allocated for this purpose.\n    */\n    if (scale == 1. && zero == 0. && \n       MACHINE == NATIVE && tcode == TLONGLONG)\n    {\n        writeraw = 1;\n        if (nelem < (LONGLONG)INT32_MAX/8) {\n            maxelem = nelem;\n        } else {\n            maxelem = INT32_MAX/8;\n        }\n    }\n    else\n        writeraw = 0;\n\n    /*---------------------------------------------------------------------*/\n    /*  Now write the pixels to the FITS column.                           */\n    /*  First call the ffXXfYY routine to  (1) convert the datatype        */\n    /*  if necessary, and (2) scale the values by the FITS TSCALn and      */\n    /*  TZEROn linear scaling parameters into a temporary buffer.          */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to write  */\n    next = 0;                 /* next element in array to be written  */\n    rownum = 0;               /* row number, relative to firstrow     */\n\n    while (remain)\n    {\n        /* limit the number of pixels to process a one time to the number that\n           will fit in the buffer space or to the number of pixels that remain\n           in the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);      \n        ntodo = (long) minvalue(ntodo, (repeat - elemnum));\n\n        wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre);\n\n        ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */\n\n        switch (tcode) \n        {\n            case (TLONGLONG):\n              if (writeraw)\n              {\n                /* write raw input bytes without conversion */\n                ffpi8b(fptr, ntodo, incre, (long *) &array[next], status);\n              }\n              else\n              {\n                /* convert the raw data before writing to FITS file */\n                ffi8fi8(&array[next], ntodo, scale, zero,\n                        (LONGLONG *) buffer, status);\n                ffpi8b(fptr, ntodo, incre, (long *) buffer, status);\n              }\n\n              break;\n\n            case (TLONG):\n\n                ffi8fi4(&array[next], ntodo, scale, zero,\n                        (INT32BIT *) buffer, status);\n                ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status);\n                break;\n\n            case (TBYTE):\n \n                ffi8fi1(&array[next], ntodo, scale, zero,\n                        (unsigned char *) buffer, status);\n                ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status);\n                break;\n\n            case (TSHORT):\n\n                ffi8fi2(&array[next], ntodo, scale, zero,\n                        (short *) buffer, status);\n                ffpi2b(fptr, ntodo, incre, (short *) buffer, status);\n                break;\n\n            case (TFLOAT):\n\n                ffi8fr4(&array[next], ntodo, scale, zero,\n                        (float *) buffer, status);\n                ffpr4b(fptr, ntodo, incre, (float *) buffer, status);\n                break;\n\n            case (TDOUBLE):\n                ffi8fr8(&array[next], ntodo, scale, zero,\n                       (double *) buffer, status);\n                ffpr8b(fptr, ntodo, incre, (double *) buffer, status);\n                break;\n\n            case (TSTRING):  /* numerical column in an ASCII table */\n\n                if (cform[1] != 's')  /*  \"%s\" format is a string */\n                {\n                  ffi8fstr(&array[next], ntodo, scale, zero, cform,\n                          twidth, (char *) buffer, status);\n\n                  if (incre == twidth)    /* contiguous bytes */\n                     ffpbyt(fptr, ntodo * twidth, buffer, status);\n                  else\n                     ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                            status);\n\n                  break;\n                }\n                /* can't write to string column, so fall thru to default: */\n\n            default:  /*  error trap  */\n                snprintf(message, FLEN_ERRMSG,\n                     \"Cannot write numbers to column %d which has format %s\",\n                      colnum,tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous write operation */\n        {\n          snprintf(message,FLEN_ERRMSG,\n          \"Error writing elements %.0f thru %.0f of input data array (ffpclj).\",\n              (double) (next+1), (double) (next+ntodo));\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum += ntodo;\n            if (elemnum == repeat)  /* completed a row; start on next row */\n            {\n                elemnum = 0;\n                rownum++;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while writing FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcnjj(fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            LONGLONG *array,     /* I - array of values to write                */\n            LONGLONG nulvalue,   /* I - value used to flag undefined pixels   */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of elements to the specified column of a table.  Any input\n  pixels equal to the value of nulvalue will be replaced by the appropriate\n  null value in the output FITS file. \n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary\n*/\n{\n    tcolumn *colptr;\n    LONGLONG  ngood = 0, nbad = 0, ii;\n    LONGLONG repeat, first, fstelm, fstrow;\n    int tcode, overflow = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n    }\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n\n    tcode  = colptr->tdatatype;\n\n    if (tcode > 0)\n       repeat = colptr->trepeat;  /* repeat count for this column */\n    else\n       repeat = firstelem -1 + nelem;  /* variable length arrays */\n\n    /* if variable length array, first write the whole input vector, \n       then go back and fill in the nulls */\n    if (tcode < 0) {\n      if (ffpcljj(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) {\n        if (*status == NUM_OVERFLOW) \n\t{\n\t  /* ignore overflows, which are possibly the null pixel values */\n\t  /*  overflow = 1;   */\n\t  *status = 0;\n\t} else { \n          return(*status);\n\t}\n      }\n    }\n\n    /* absolute element number in the column */\n    first = (firstrow - 1) * repeat + firstelem;\n\n    for (ii = 0; ii < nelem; ii++)\n    {\n      if (array[ii] != nulvalue)  /* is this a good pixel? */\n      {\n         if (nbad)  /* write previous string of bad pixels */\n         {\n            fstelm = ii - nbad + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0)\n                return(*status);\n\n            nbad=0;\n         }\n\n         ngood = ngood +1;  /* the consecutive number of good pixels */\n      }\n      else\n      {\n         if (ngood)  /* write previous string of good pixels */\n         {\n            fstelm = ii - ngood + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (tcode > 0) {  /* variable length arrays have already been written */\n              if (ffpcljj(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood],\n                status) > 0) {\n\t\tif (*status == NUM_OVERFLOW) \n\t\t{\n\t\t  overflow = 1;\n\t\t  *status = 0;\n\t\t} else { \n                  return(*status);\n\t\t}\n\t      }\n\t    }\n            ngood=0;\n         }\n\n         nbad = nbad +1;  /* the consecutive number of bad pixels */\n      }\n    }\n\n    /* finished loop;  now just write the last set of pixels */\n\n    if (ngood)  /* write last string of good pixels */\n    {\n      fstelm = ii - ngood + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      if (tcode > 0) {  /* variable length arrays have already been written */\n        ffpcljj(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status);\n      }\n    }\n    else if (nbad) /* write last string of bad pixels */\n    {\n      fstelm = ii - nbad + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      ffpclu(fptr, colnum, fstrow, fstelm, nbad, status);\n    }\n\n    if (*status <= 0) {\n      if (overflow) {\n        *status = NUM_OVERFLOW;\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi8fi1(LONGLONG *input,       /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            unsigned char *output, /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] < 0)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (input[ii] > UCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DUCHAR_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (dvalue > DUCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) (dvalue + .5);\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi8fi2(LONGLONG *input,   /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            short *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] < SHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MIN;\n            }\n            else if (input[ii] > SHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n                output[ii] = (short) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DSHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MIN;\n            }\n            else if (dvalue > DSHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (short) (dvalue + .5);\n                else\n                    output[ii] = (short) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi8fi4(LONGLONG *input,   /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            INT32BIT *output,  /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] < INT32_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MIN;\n            }\n            else if (input[ii] > INT32_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n                output[ii] = (INT32BIT) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (INT32BIT) (dvalue + .5);\n                else\n                    output[ii] = (INT32BIT) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi8fi8(LONGLONG *input,   /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            LONGLONG *output,  /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero ==  9223372036854775808.)\n    {       \n        /* Writing to unsigned long long column. Input values must not be negative */\n        /* Instead of subtracting 9223372036854775808, it is more efficient */\n        /* and more precise to just flip the sign bit with the XOR operator */\n\n        for (ii = 0; ii < ntodo; ii++) {\n           if (input[ii] < 0) {\n              *status = OVERFLOW_ERR;\n              output[ii] = LONGLONG_MIN;\n           } else {\n              output[ii] =  (input[ii]) ^ 0x8000000000000000;\n           }\n        }\n    }\n    else if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DLONGLONG_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MIN;\n            }\n            else if (dvalue > DLONGLONG_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (LONGLONG) (dvalue + .5);\n                else\n                    output[ii] = (LONGLONG) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi8fr4(LONGLONG *input,   /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            float *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (float) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (float) ((input[ii] - zero) / scale);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi8fr8(LONGLONG *input,       /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            double *output,    /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (double) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (input[ii] - zero) / scale;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi8fstr(LONGLONG *input,  /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            char *cform,       /* I - format for output string values  */\n            long twidth,       /* I - width of each field, in chars    */\n            char *output,      /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n    char *cptr;\n    \n    cptr = output;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n           sprintf(output, cform, (double) input[ii]);\n           output += twidth;\n\n           if (*output)  /* if this char != \\0, then overflow occurred */\n              *status = OVERFLOW_ERR;\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n          dvalue = (input[ii] - zero) / scale;\n          sprintf(output, cform, dvalue);\n          output += twidth;\n\n          if (*output)  /* if this char != \\0, then overflow occurred */\n            *status = OVERFLOW_ERR;\n        }\n    }\n\n    /* replace any commas with periods (e.g., in French locale) */\n    while ((cptr = strchr(cptr, ','))) *cptr = '.';\n    \n    return(*status);\n}\n"},{"id":16639,"name":"fitscore.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, fitscore.c, contains the core set of FITSIO routines.       */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n/*\n\nCopyright (Unpublished--all rights reserved under the copyright laws of\nthe United States), U.S. Government as represented by the Administrator\nof the National Aeronautics and Space Administration.  No copyright is\nclaimed in the United States under Title 17, U.S. Code.\n\nPermission to freely use, copy, modify, and distribute this software\nand its documentation without fee is hereby granted, provided that this\ncopyright notice and disclaimer of warranty appears in all copies.\n\nDISCLAIMER:\n\nTHE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND,\nEITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO,\nANY WARRANTY THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY\nIMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR\nPURPOSE, AND FREEDOM FROM INFRINGEMENT, AND ANY WARRANTY THAT THE\nDOCUMENTATION WILL CONFORM TO THE SOFTWARE, OR ANY WARRANTY THAT THE\nSOFTWARE WILL BE ERROR FREE.  IN NO EVENT SHALL NASA BE LIABLE FOR ANY\nDAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL OR\nCONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR IN ANY WAY\nCONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY,\nCONTRACT, TORT , OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY\nPERSONS OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED\nFROM, OR AROSE OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR\nSERVICES PROVIDED HEREUNDER.\"\n\n*/\n\n\n#include <string.h>\n#include <limits.h>\n#include <stdlib.h>\n#include <math.h>\n#include <ctype.h>\n#include <errno.h>\n/* stddef.h is apparently needed to define size_t with some compilers ?? */\n#include <stddef.h>\n#include <locale.h>\n#include \"fitsio2.h\"\n\n#define errmsgsiz 25\n#define ESMARKER 27  /* Escape character is used as error stack marker */\n\n#define DelAll     1 /* delete all messages on the error stack */\n#define DelMark    2 /* delete newest messages back to and including marker */\n#define DelNewest  3 /* delete the newest message from the stack */\n#define GetMesg    4 /* pop and return oldest message, ignoring marks */\n#define PutMesg    5 /* add a new message to the stack */\n#define PutMark    6 /* add a marker to the stack */\n\n#ifdef _REENTRANT\n/*\n    Fitsio_Lock and Fitsio_Pthread_Status are declared in fitsio2.h. \n*/\npthread_mutex_t Fitsio_Lock;\nint Fitsio_Pthread_Status = 0;\n\n#endif\n\nint STREAM_DRIVER = 0;\nstruct lconv *lcxxx;\n\n/*--------------------------------------------------------------------------*/\nfloat ffvers(float *version)  /* IO - version number */\n/*\n  return the current version number of the FITSIO software\n*/\n{\n      *version = (float) 4.0;\n\n/*       May 2021\n\n   Previous releases:\n      *version = 3.49       Aug 2020\n      *version = 3.48       Apr 2020\n      *version = 3.47       May 2019\n      *version = 3.46       Oct 2018\n      *version = 3.45       May 2018\n      *version = 3.44       Apr 2018\n      *version = 3.43       Mar 2018\n      *version = 3.42       Mar 2017\n      *version = 3.41       Nov 2016\n      *version = 3.40       Oct 2016\n      *version = 3.39       Apr 2016\n      *version = 3.38       Feb 2016\n      *version = 3.37     3 Jun 2014\n      *version = 3.36     6 Dec 2013\n      *version = 3.35    23 May 2013\n      *version = 3.34    20 Mar 2013\n      *version = 3.33    14 Feb 2013\n      *version = 3.32       Oct 2012\n      *version = 3.31    18 Jul 2012\n      *version = 3.30    11 Apr 2012\n      *version = 3.29    22 Sep 2011\n      *version = 3.28    12 May 2011\n      *version = 3.27     3 Mar 2011\n      *version = 3.26    30 Dec 2010\n      *version = 3.25    9 June 2010\n      *version = 3.24    26 Jan 2010\n      *version = 3.23     7 Jan 2010\n      *version = 3.22    28 Oct 2009\n      *version = 3.21    24 Sep 2009\n      *version = 3.20    31 Aug 2009\n      *version = 3.18    12 May 2009 (beta version)\n      *version = 3.14    18 Mar 2009 \n      *version = 3.13     5 Jan 2009 \n      *version = 3.12     8 Oct 2008 \n      *version = 3.11    19 Sep 2008 \n      *version = 3.10    20 Aug 2008 \n      *version = 3.09     3 Jun 2008 \n      *version = 3.08    15 Apr 2007  (internal release)\n      *version = 3.07     5 Nov 2007  (internal release)\n      *version = 3.06    27 Aug 2007  \n      *version = 3.05    12 Jul 2007  (internal release)\n      *version = 3.03    11 Dec 2006\n      *version = 3.02    18 Sep 2006\n      *version = 3.01       May 2006 included in FTOOLS 6.1 release\n      *version = 3.006   20 Feb 2006 \n      *version = 3.005   20 Dec 2005 (beta, in heasoft swift release\n      *version = 3.004   16 Sep 2005 (beta, in heasoft swift release\n      *version = 3.003   28 Jul 2005 (beta, in heasoft swift release\n      *version = 3.002   15 Apr 2005 (beta)\n      *version = 3.001   15 Mar 2005 (beta) released with heasoft 6.0\n      *version = 3.000   1 Mar 2005 (internal release only)\n      *version = 2.51     2 Dec 2004\n      *version = 2.50    28 Jul 2004\n      *version = 2.49    11 Feb 2004\n      *version = 2.48    28 Jan 2004\n      *version = 2.470   18 Aug 2003\n      *version = 2.460   20 May 2003\n      *version = 2.450   30 Apr 2003  (internal release only)\n      *version = 2.440    8 Jan 2003\n      *version = 2.430;   4 Nov 2002\n      *version = 2.420;  19 Jul 2002\n      *version = 2.410;  22 Apr 2002 used in ftools v5.2\n      *version = 2.401;  28 Jan 2002\n      *version = 2.400;  18 Jan 2002\n      *version = 2.301;   7 Dec 2001\n      *version = 2.300;  23 Oct 2001\n      *version = 2.204;  26 Jul 2001\n      *version = 2.203;  19 Jul 2001 used in ftools v5.1\n      *version = 2.202;  22 May 2001\n      *version = 2.201;  15 Mar 2001\n      *version = 2.200;  26 Jan 2001\n      *version = 2.100;  26 Sep 2000\n      *version = 2.037;   6 Jul 2000\n      *version = 2.036;   1 Feb 2000\n      *version = 2.035;   7 Dec 1999 (internal release only)\n      *version = 2.034;  23 Nov 1999\n      *version = 2.033;  17 Sep 1999\n      *version = 2.032;  25 May 1999\n      *version = 2.031;  31 Mar 1999\n      *version = 2.030;  24 Feb 1999\n      *version = 2.029;  11 Feb 1999\n      *version = 2.028;  26 Jan 1999\n      *version = 2.027;  12 Jan 1999\n      *version = 2.026;  23 Dec 1998\n      *version = 2.025;   1 Dec 1998\n      *version = 2.024;   9 Nov 1998\n      *version = 2.023;   1 Nov 1998 first full release of V2.0\n      *version = 1.42;   30 Apr 1998\n      *version = 1.40;    6 Feb 1998\n      *version = 1.33;   16 Dec 1997 (internal release only)\n      *version = 1.32;   21 Nov 1997 (internal release only)\n      *version = 1.31;    4 Nov 1997 (internal release only)\n      *version = 1.30;   11 Sep 1997\n      *version = 1.27;    3 Sep 1997 (internal release only)\n      *version = 1.25;    2 Jul 1997\n      *version = 1.24;    2 May 1997\n      *version = 1.23;   24 Apr 1997\n      *version = 1.22;   18 Apr 1997\n      *version = 1.21;   26 Mar 1997\n      *version = 1.2;    29 Jan 1997\n      *version = 1.11;   04 Dec 1996\n      *version = 1.101;  13 Nov 1996\n      *version = 1.1;     6 Nov 1996\n      *version = 1.04;   17 Sep 1996\n      *version = 1.03;   20 Aug 1996\n      *version = 1.02;   15 Aug 1996\n      *version = 1.01;   12 Aug 1996\n*/\n\n    return(*version);\n}\n/*--------------------------------------------------------------------------*/\nint ffflnm(fitsfile *fptr,    /* I - FITS file pointer  */\n           char *filename,    /* O - name of the file   */\n           int *status)       /* IO - error status      */\n/*\n  return the name of the FITS file\n*/\n{\n    strcpy(filename,(fptr->Fptr)->filename);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffflmd(fitsfile *fptr,    /* I - FITS file pointer  */\n           int *filemode,     /* O - open mode of the file  */\n           int *status)       /* IO - error status      */\n/*\n  return the access mode of the FITS file\n*/\n{\n    *filemode = (fptr->Fptr)->writemode;\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nvoid ffgerr(int status,     /* I - error status value */\n            char *errtext)  /* O - error message (max 30 char long + null) */\n/*\n  Return a short descriptive error message that corresponds to the input\n  error status value.  The message may be up to 30 characters long, plus\n  the terminating null character.\n*/\n{\n  errtext[0] = '\\0';\n\n  if (status >= 0 && status < 300)\n  {\n    switch (status) {\n\n    case 0:\n       strcpy(errtext, \"OK - no error\");\n       break;\n    case 1:\n       strcpy(errtext, \"non-CFITSIO program error\");\n       break;\n    case 101:\n       strcpy(errtext, \"same input and output files\");\n       break;\n    case 103:\n       strcpy(errtext, \"attempt to open too many files\");\n       break;\n    case 104:\n       strcpy(errtext, \"could not open the named file\");\n       break;\n    case 105:\n       strcpy(errtext, \"couldn't create the named file\");\n       break;\n    case 106:\n       strcpy(errtext, \"error writing to FITS file\");\n       break;\n    case 107:\n       strcpy(errtext, \"tried to move past end of file\");\n       break;\n    case 108:\n       strcpy(errtext, \"error reading from FITS file\");\n       break;\n    case 110:\n       strcpy(errtext, \"could not close the file\");\n       break;\n    case 111:\n       strcpy(errtext, \"array dimensions too big\");\n       break;\n    case 112:\n       strcpy(errtext, \"cannot write to readonly file\");\n       break;\n    case 113:\n       strcpy(errtext, \"could not allocate memory\");\n       break;\n    case 114:\n       strcpy(errtext, \"invalid fitsfile pointer\");\n       break;\n    case 115:\n       strcpy(errtext, \"NULL input pointer\");\n       break;\n    case 116:\n       strcpy(errtext, \"error seeking file position\");\n       break;\n    case 117:\n       strcpy(errtext, \"bad value for file download timeout setting\");\n       break;\n    case 121:\n       strcpy(errtext, \"invalid URL prefix\");\n       break;\n    case 122:\n       strcpy(errtext, \"too many I/O drivers\");\n       break;\n    case 123:\n       strcpy(errtext, \"I/O driver init failed\");\n       break;\n    case 124:\n       strcpy(errtext, \"no I/O driver for this URLtype\");\n       break;\n    case 125:\n       strcpy(errtext, \"parse error in input file URL\");\n       break;\n    case 126:\n       strcpy(errtext, \"parse error in range list\");\n       break;\n    case 151:\n       strcpy(errtext, \"bad argument (shared mem drvr)\");\n       break;\n    case 152:\n       strcpy(errtext, \"null ptr arg (shared mem drvr)\");\n       break;\n    case 153:\n       strcpy(errtext, \"no free shared memory handles\");\n       break;\n    case 154:\n       strcpy(errtext, \"share mem drvr not initialized\");\n       break;\n    case 155:\n       strcpy(errtext, \"IPC system error (shared mem)\");\n       break;\n    case 156:\n       strcpy(errtext, \"no memory (shared mem drvr)\");\n       break;\n    case 157:\n       strcpy(errtext, \"share mem resource deadlock\");\n       break;\n    case 158:\n       strcpy(errtext, \"lock file open/create failed\");\n       break;\n    case 159:\n       strcpy(errtext, \"can't resize share mem block\");\n       break;\n    case 201:\n       strcpy(errtext, \"header already has keywords\");\n       break;\n    case 202:\n       strcpy(errtext, \"keyword not found in header\");\n       break;\n    case 203:\n       strcpy(errtext, \"keyword number out of bounds\");\n       break;\n    case 204:\n       strcpy(errtext, \"keyword value is undefined\");\n       break;\n    case 205:\n       strcpy(errtext, \"string missing closing quote\");\n       break;\n    case 206:\n       strcpy(errtext, \"error in indexed keyword name\");\n       break;\n    case 207:\n       strcpy(errtext, \"illegal character in keyword\");\n       break;\n    case 208:\n       strcpy(errtext, \"required keywords out of order\");\n       break;\n    case 209:\n       strcpy(errtext, \"keyword value not positive int\");\n       break;\n    case 210:\n       strcpy(errtext, \"END keyword not found\");\n       break;\n    case 211:\n       strcpy(errtext, \"illegal BITPIX keyword value\");\n       break;\n    case 212:\n       strcpy(errtext, \"illegal NAXIS keyword value\");\n       break;\n    case 213:\n       strcpy(errtext, \"illegal NAXISn keyword value\");\n       break;\n    case 214:\n       strcpy(errtext, \"illegal PCOUNT keyword value\");\n       break;\n    case 215:\n       strcpy(errtext, \"illegal GCOUNT keyword value\");\n       break;\n    case 216:\n       strcpy(errtext, \"illegal TFIELDS keyword value\");\n       break;\n    case 217:\n       strcpy(errtext, \"negative table row size\");\n       break;\n    case 218:\n       strcpy(errtext, \"negative number of rows\");\n       break;\n    case 219:\n       strcpy(errtext, \"named column not found\");\n       break;\n    case 220:\n       strcpy(errtext, \"illegal SIMPLE keyword value\");\n       break;\n    case 221:\n       strcpy(errtext, \"first keyword not SIMPLE\");\n       break;\n    case 222:\n       strcpy(errtext, \"second keyword not BITPIX\");\n       break;\n    case 223:\n       strcpy(errtext, \"third keyword not NAXIS\");\n       break;\n    case 224:\n       strcpy(errtext, \"missing NAXISn keywords\");\n       break;\n    case 225:\n       strcpy(errtext, \"first keyword not XTENSION\");\n       break;\n    case 226:\n       strcpy(errtext, \"CHDU not an ASCII table\");\n       break;\n    case 227:\n       strcpy(errtext, \"CHDU not a binary table\");\n       break;\n    case 228:\n       strcpy(errtext, \"PCOUNT keyword not found\");\n       break;\n    case 229:\n       strcpy(errtext, \"GCOUNT keyword not found\");\n       break;\n    case 230:\n       strcpy(errtext, \"TFIELDS keyword not found\");\n       break;\n    case 231:\n       strcpy(errtext, \"missing TBCOLn keyword\");\n       break;\n    case 232:\n       strcpy(errtext, \"missing TFORMn keyword\");\n       break;\n    case 233:\n       strcpy(errtext, \"CHDU not an IMAGE extension\");\n       break;\n    case 234:\n       strcpy(errtext, \"illegal TBCOLn keyword value\");\n       break;\n    case 235:\n       strcpy(errtext, \"CHDU not a table extension\");\n       break;\n    case 236:\n       strcpy(errtext, \"column exceeds width of table\");\n       break;\n    case 237:\n       strcpy(errtext, \"more than 1 matching col. name\");\n       break;\n    case 241:\n       strcpy(errtext, \"row width not = field widths\");\n       break;\n    case 251:\n       strcpy(errtext, \"unknown FITS extension type\");\n       break;\n    case 252:\n       strcpy(errtext, \"1st key not SIMPLE or XTENSION\");\n       break;\n    case 253:\n       strcpy(errtext, \"END keyword is not blank\");\n       break;\n    case 254:\n       strcpy(errtext, \"Header fill area not blank\");\n       break;\n    case 255:\n       strcpy(errtext, \"Data fill area invalid\");\n       break;\n    case 261:\n       strcpy(errtext, \"illegal TFORM format code\");\n       break;\n    case 262:\n       strcpy(errtext, \"unknown TFORM datatype code\");\n       break;\n    case 263:\n       strcpy(errtext, \"illegal TDIMn keyword value\");\n       break;\n    case 264:\n       strcpy(errtext, \"invalid BINTABLE heap pointer\");\n       break;\n    default:\n       strcpy(errtext, \"unknown error status\");\n       break;\n    }\n  }\n  else if (status < 600)\n  {\n    switch(status) {\n\n    case 301:\n       strcpy(errtext, \"illegal HDU number\");\n       break;\n    case 302:\n       strcpy(errtext, \"column number < 1 or > tfields\");\n       break;\n    case 304:\n       strcpy(errtext, \"negative byte address\");\n       break;\n    case 306:\n       strcpy(errtext, \"negative number of elements\");\n       break;\n    case 307:\n       strcpy(errtext, \"bad first row number\");\n       break;\n    case 308:\n       strcpy(errtext, \"bad first element number\");\n       break;\n    case 309:\n       strcpy(errtext, \"not an ASCII (A) column\");\n       break;\n    case 310:\n       strcpy(errtext, \"not a logical (L) column\");\n       break;\n    case 311:\n       strcpy(errtext, \"bad ASCII table datatype\");\n       break;\n    case 312:\n       strcpy(errtext, \"bad binary table datatype\");\n       break;\n    case 314:\n       strcpy(errtext, \"null value not defined\");\n       break;\n    case 317:\n       strcpy(errtext, \"not a variable length column\");\n       break;\n    case 320:\n       strcpy(errtext, \"illegal number of dimensions\");\n       break;\n    case 321:\n       strcpy(errtext, \"1st pixel no. > last pixel no.\");\n       break;\n    case 322:\n       strcpy(errtext, \"BSCALE or TSCALn = 0.\");\n       break;\n    case 323:\n       strcpy(errtext, \"illegal axis length < 1\");\n       break;\n    case 340:\n       strcpy(errtext, \"not group table\");\n       break;\n    case 341:\n       strcpy(errtext, \"HDU already member of group\");\n       break;\n    case 342:\n       strcpy(errtext, \"group member not found\");\n       break;\n    case 343:\n       strcpy(errtext, \"group not found\");\n       break;\n    case 344:\n       strcpy(errtext, \"bad group id\");\n       break;\n    case 345:\n       strcpy(errtext, \"too many HDUs tracked\");\n       break;\n    case 346:\n       strcpy(errtext, \"HDU alread tracked\");\n       break;\n    case 347:\n       strcpy(errtext, \"bad Grouping option\");\n       break;\n    case 348:\n       strcpy(errtext, \"identical pointers (groups)\");\n       break;\n    case 360:\n       strcpy(errtext, \"malloc failed in parser\");\n       break;\n    case 361:\n       strcpy(errtext, \"file read error in parser\");\n       break;\n    case 362:\n       strcpy(errtext, \"null pointer arg (parser)\");\n       break;\n    case 363:\n       strcpy(errtext, \"empty line (parser)\");\n       break;\n    case 364:\n       strcpy(errtext, \"cannot unread > 1 line\");\n       break;\n    case 365:\n       strcpy(errtext, \"parser too deeply nested\");\n       break;\n    case 366:\n       strcpy(errtext, \"file open failed (parser)\");\n       break;\n    case 367:\n       strcpy(errtext, \"hit EOF (parser)\");\n       break;\n    case 368:\n       strcpy(errtext, \"bad argument (parser)\");\n       break;\n    case 369:\n       strcpy(errtext, \"unexpected token (parser)\");\n       break;\n    case 401:\n       strcpy(errtext, \"bad int to string conversion\");\n       break;\n    case 402:\n       strcpy(errtext, \"bad float to string conversion\");\n       break;\n    case 403:\n       strcpy(errtext, \"keyword value not integer\");\n       break;\n    case 404:\n       strcpy(errtext, \"keyword value not logical\");\n       break;\n    case 405:\n       strcpy(errtext, \"keyword value not floating pt\");\n       break;\n    case 406:\n       strcpy(errtext, \"keyword value not double\");\n       break;\n    case 407:\n       strcpy(errtext, \"bad string to int conversion\");\n       break;\n    case 408:\n       strcpy(errtext, \"bad string to float conversion\");\n       break;\n    case 409:\n       strcpy(errtext, \"bad string to double convert\");\n       break;\n    case 410:\n       strcpy(errtext, \"illegal datatype code value\");\n       break;\n    case 411:\n       strcpy(errtext, \"illegal no. of decimals\");\n       break;\n    case 412:\n       strcpy(errtext, \"datatype conversion overflow\");\n       break;\n    case 413:\n       strcpy(errtext, \"error compressing image\");\n       break;\n    case 414:\n       strcpy(errtext, \"error uncompressing image\");\n       break;\n    case 420:\n       strcpy(errtext, \"bad date or time conversion\");\n       break;\n    case 431:\n       strcpy(errtext, \"syntax error in expression\");\n       break;\n    case 432:\n       strcpy(errtext, \"expression result wrong type\");\n       break;\n    case 433:\n       strcpy(errtext, \"vector result too large\");\n       break;\n    case 434:\n       strcpy(errtext, \"missing output column\");\n       break;\n    case 435:\n       strcpy(errtext, \"bad data in parsed column\");\n       break;\n    case 436:\n       strcpy(errtext, \"output extension of wrong type\");\n       break;\n    case 501:\n       strcpy(errtext, \"WCS angle too large\");\n       break;\n    case 502:\n       strcpy(errtext, \"bad WCS coordinate\");\n       break;\n    case 503:\n       strcpy(errtext, \"error in WCS calculation\");\n       break;\n    case 504:\n       strcpy(errtext, \"bad WCS projection type\");\n       break;\n    case 505:\n       strcpy(errtext, \"WCS keywords not found\");\n       break;\n    default:\n       strcpy(errtext, \"unknown error status\");\n       break;\n    }\n  }\n  else\n  {\n     strcpy(errtext, \"unknown error status\");\n  }\n  return;\n}\n/*--------------------------------------------------------------------------*/\nvoid ffpmsg(const char *err_message)\n/*\n  put message on to error stack\n*/\n{\n    ffxmsg(PutMesg, (char *)err_message);\n    return;\n}\n/*--------------------------------------------------------------------------*/\nvoid ffpmrk(void)\n/*\n  write a marker to the stack.  It is then possible to pop only those\n  messages following the marker off of the stack, leaving the previous\n  messages unaffected.\n\n  The marker is ignored by the ffgmsg routine.\n*/\n{\n    char *dummy = 0;\n\n    ffxmsg(PutMark, dummy);\n    return;\n}\n/*--------------------------------------------------------------------------*/\nint ffgmsg(char *err_message)\n/*\n  get oldest message from error stack, ignoring markers\n*/\n{\n    ffxmsg(GetMesg, err_message);\n    return(*err_message);\n}\n/*--------------------------------------------------------------------------*/\nvoid ffcmsg(void)\n/*\n  erase all messages in the error stack\n*/\n{\n    char *dummy = 0;\n\n    ffxmsg(DelAll, dummy);\n    return;\n}\n/*--------------------------------------------------------------------------*/\nvoid ffcmrk(void)\n/*\n  erase newest messages in the error stack, stopping if a marker is found.\n  The marker is also erased in this case.\n*/\n{\n    char *dummy = 0;\n\n    ffxmsg(DelMark, dummy);\n    return;\n}\n/*--------------------------------------------------------------------------*/\nvoid ffxmsg( int action,\n            char *errmsg)\n/*\n  general routine to get, put, or clear the error message stack.\n  Use a static array rather than allocating memory as needed for\n  the error messages because it is likely to be more efficient\n  and simpler to implement.\n\n  Action Code:\nDelAll     1  delete all messages on the error stack \nDelMark    2  delete messages back to and including the 1st marker \nDelNewest  3  delete the newest message from the stack \nGetMesg    4  pop and return oldest message, ignoring marks \nPutMesg    5  add a new message to the stack \nPutMark    6  add a marker to the stack \n\n*/\n{\n    int ii;\n    char markflag;\n    static char *txtbuff[errmsgsiz], *tmpbuff, *msgptr;\n    static char errbuff[errmsgsiz][81];  /* initialize all = \\0 */\n    static int nummsg = 0;\n\n    FFLOCK;\n    \n    if (action == DelAll)  /* clear the whole message stack */\n    {\n      for (ii = 0; ii < nummsg; ii ++)\n        *txtbuff[ii] = '\\0';\n\n      nummsg = 0;\n    }\n    else if (action == DelMark)  /* clear up to and including first marker */\n    {\n      while (nummsg > 0) {\n        nummsg--;  \n        markflag = *txtbuff[nummsg]; /* store possible marker character */\n        *txtbuff[nummsg] = '\\0';  /* clear the buffer for this msg */\n\n        if (markflag == ESMARKER)\n           break;   /* found a marker, so quit */\n      }\n    }\n    else if (action == DelNewest)  /* remove newest message from stack */ \n    {\n      if (nummsg > 0)\n      {\n        nummsg--;  \n        *txtbuff[nummsg] = '\\0';  /* clear the buffer for this msg */\n      }\n    }\n    else if (action == GetMesg)  /* pop and return oldest message from stack */ \n    {                            /* ignoring markers */\n      while (nummsg > 0)\n      {\n         strcpy(errmsg, txtbuff[0]);   /* copy oldest message to output */\n\n         *txtbuff[0] = '\\0';  /* clear the buffer for this msg */\n           \n         nummsg--;  \n         for (ii = 0; ii < nummsg; ii++)\n             txtbuff[ii] = txtbuff[ii + 1]; /* shift remaining pointers */\n\n         if (errmsg[0] != ESMARKER) {   /* quit if this is not a marker */\n            FFUNLOCK;\n            return;\n         }\n       }\n       errmsg[0] = '\\0';  /*  no messages in the stack */\n    }\n    else if (action == PutMesg)  /* add new message to stack */\n    {\n     msgptr = errmsg;\n     while (strlen(msgptr))\n     {\n      if (nummsg == errmsgsiz)\n      {\n        tmpbuff = txtbuff[0];  /* buffers full; reuse oldest buffer */\n        *txtbuff[0] = '\\0';  /* clear the buffer for this msg */\n\n        nummsg--;\n        for (ii = 0; ii < nummsg; ii++)\n             txtbuff[ii] = txtbuff[ii + 1];   /* shift remaining pointers */\n\n        txtbuff[nummsg] = tmpbuff;  /* set pointer for the new message */\n      }\n      else\n      {\n        for (ii = 0; ii < errmsgsiz; ii++)\n        {\n          if (*errbuff[ii] == '\\0') /* find first empty buffer */\n          {\n            txtbuff[nummsg] = errbuff[ii];\n            break;\n          }\n        }\n      }\n\n      strncat(txtbuff[nummsg], msgptr, 80);\n      nummsg++;\n\n      msgptr += minvalue(80, strlen(msgptr));\n     }\n    }\n    else if (action == PutMark)  /* put a marker on the stack */\n    {\n      if (nummsg == errmsgsiz)\n      {\n        tmpbuff = txtbuff[0];  /* buffers full; reuse oldest buffer */\n        *txtbuff[0] = '\\0';  /* clear the buffer for this msg */\n\n        nummsg--;\n        for (ii = 0; ii < nummsg; ii++)\n             txtbuff[ii] = txtbuff[ii + 1];   /* shift remaining pointers */\n\n        txtbuff[nummsg] = tmpbuff;  /* set pointer for the new message */\n      }\n      else\n      {\n        for (ii = 0; ii < errmsgsiz; ii++)\n        {\n          if (*errbuff[ii] == '\\0') /* find first empty buffer */\n          {\n            txtbuff[nummsg] = errbuff[ii];\n            break;\n          }\n        }\n      }\n\n      *txtbuff[nummsg] = ESMARKER;      /* write the marker */\n      *(txtbuff[nummsg] + 1) = '\\0';\n      nummsg++;\n\n    }\n\n    FFUNLOCK;\n    return;\n}\n/*--------------------------------------------------------------------------*/\nint ffpxsz(int datatype)\n/*\n   return the number of bytes per pixel associated with the datatype\n*/\n{\n    if (datatype == TBYTE)\n       return(sizeof(char));\n    else if (datatype == TUSHORT)\n       return(sizeof(short));\n    else if (datatype == TSHORT)\n       return(sizeof(short));\n    else if (datatype == TULONG)\n       return(sizeof(long));\n    else if (datatype == TLONG)\n       return(sizeof(long));\n    else if (datatype == TINT)\n       return(sizeof(int));\n    else if (datatype == TUINT)\n       return(sizeof(int));\n    else if (datatype == TFLOAT)\n       return(sizeof(float));\n    else if (datatype == TDOUBLE)\n       return(sizeof(double));\n    else if (datatype == TLOGICAL)\n       return(sizeof(char));\n    else\n       return(0);\n}\n/*--------------------------------------------------------------------------*/\nint fftkey(const char *keyword,    /* I -  keyword name */\n           int *status)      /* IO - error status */\n/*\n  Test that the keyword name conforms to the FITS standard.  Must contain\n  only capital letters, digits, minus or underscore chars.  Trailing spaces\n  are allowed.  If the input status value is less than zero, then the test\n  is modified so that upper or lower case letters are allowed, and no \n  error messages are printed if the keyword is not legal.\n*/\n{\n    size_t maxchr, ii;\n    int spaces=0;\n    char msg[FLEN_ERRMSG], testchar;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    maxchr=strlen(keyword);\n    if (maxchr > 8)\n        maxchr = 8;\n\n    for (ii = 0; ii < maxchr; ii++)\n    {\n        if (*status == 0)\n            testchar = keyword[ii];\n        else\n            testchar = toupper(keyword[ii]);\n\n        if ( (testchar >= 'A' && testchar <= 'Z') ||\n             (testchar >= '0' && testchar <= '9') ||\n              testchar == '-' || testchar == '_'   )\n              {\n                if (spaces)\n                {\n                  if (*status == 0)\n                  {\n                     /* don't print error message if status < 0  */\n                    snprintf(msg, FLEN_ERRMSG,\n                       \"Keyword name contains embedded space(s): %.8s\",\n                        keyword);\n                     ffpmsg(msg);\n                  }\n                  return(*status = BAD_KEYCHAR);        \n                }\n              }\n        else if (keyword[ii] == ' ')\n            spaces = 1;\n\n        else     \n        {\n          if (*status == 0)\n          {\n            /* don't print error message if status < 0  */\n            snprintf(msg, FLEN_ERRMSG,\"Character %d in this keyword is illegal: %.8s\",\n                    (int) (ii+1), keyword);\n            ffpmsg(msg);\n\n            /* explicitly flag the 2 most common cases */\n            if (keyword[ii] == 0) \n                ffpmsg(\" (This a NULL (0) character).\");                \n            else if (keyword[ii] == 9)\n                ffpmsg(\" (This an ASCII TAB (9) character).\");   \n          }             \n\n          return(*status = BAD_KEYCHAR);        \n        }                \n    }\n    return(*status);        \n}\n/*--------------------------------------------------------------------------*/\nint fftrec(char *card,       /* I -  keyword card to test */\n           int *status)      /* IO - error status */\n/*\n  Test that the keyword card conforms to the FITS standard.  Must contain\n  only printable ASCII characters;\n*/\n{\n    size_t ii, maxchr;\n    char msg[FLEN_ERRMSG];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    maxchr = strlen(card);\n\n    for (ii = 8; ii < maxchr; ii++)\n    {\n        if (card[ii] < 32 || card[ii] > 126)\n        {\n            snprintf(msg, FLEN_ERRMSG, \n           \"Character %d in this keyword is illegal. Hex Value = %X\",\n              (int) (ii+1), (int) card[ii] );\n\n            if (card[ii] == 0)\n\t        strncat(msg, \" (NULL char.)\",FLEN_ERRMSG-strlen(msg)-1);\n            else if (card[ii] == 9)\n\t        strncat(msg, \" (TAB char.)\",FLEN_ERRMSG-strlen(msg)-1);\n            else if (card[ii] == 10)\n\t        strncat(msg, \" (Line Feed char.)\",FLEN_ERRMSG-strlen(msg)-1);\n            else if (card[ii] == 11)\n\t        strncat(msg, \" (Vertical Tab)\",FLEN_ERRMSG-strlen(msg)-1);\n            else if (card[ii] == 12)\n\t        strncat(msg, \" (Form Feed char.)\",FLEN_ERRMSG-strlen(msg)-1);\n            else if (card[ii] == 13)\n\t        strncat(msg, \" (Carriage Return)\",FLEN_ERRMSG-strlen(msg)-1);\n            else if (card[ii] == 27)\n\t        strncat(msg, \" (Escape char.)\",FLEN_ERRMSG-strlen(msg)-1);\n            else if (card[ii] == 127)\n\t        strncat(msg, \" (Delete char.)\",FLEN_ERRMSG-strlen(msg)-1);\n\n            ffpmsg(msg);\n\n            strncpy(msg, card, 80);\n            msg[80] = '\\0';\n            ffpmsg(msg);\n            return(*status = BAD_KEYCHAR);        \n        }\n    }\n    return(*status);        \n}\n/*--------------------------------------------------------------------------*/\nvoid ffupch(char *string)\n/*\n  convert string to upper case, in place.\n*/\n{\n    size_t len, ii;\n\n    len = strlen(string);\n    for (ii = 0; ii < len; ii++)\n        string[ii] = toupper(string[ii]);\n    return;\n}\n/*--------------------------------------------------------------------------*/\nint ffmkky(const char *keyname,   /* I - keyword name    */\n            char *value,     /* I - keyword value   */\n            const char *comm,      /* I - keyword comment */\n            char *card,      /* O - constructed keyword card */\n            int  *status)    /* IO - status value   */\n/*\n  Make a complete FITS 80-byte keyword card from the input name, value and\n  comment strings. Output card is null terminated without any trailing blanks.\n*/\n{\n    size_t namelen, len, ii;\n    char tmpname[FLEN_KEYWORD], tmpname2[FLEN_KEYWORD],*cptr;\n    char *saveptr;\n    int tstatus = -1, nblank = 0, ntoken = 0, maxlen = 0, specialchar = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    *tmpname = '\\0';\n    *tmpname2 = '\\0';\n    *card = '\\0';\n\n    /* skip leading blanks in the name */\n    while(*(keyname + nblank) == ' ')\n        nblank++;\n\n    strncat(tmpname, keyname + nblank, FLEN_KEYWORD - 1);\n\n    len = strlen(value);        \n    namelen = strlen(tmpname);\n\n    /* delete non-significant trailing blanks in the name */\n    if (namelen) {\n        cptr = tmpname + namelen - 1;\n\n        while(*cptr == ' ') {\n            *cptr = '\\0';\n            cptr--;\n        }\n\n        namelen = cptr - tmpname + 1;\n    }\n    \n    /* check that the name does not contain an '=' (equals sign) */\n    if (strchr(tmpname, '=') ) {\n        ffpmsg(\"Illegal keyword name; contains an equals sign (=)\");\n        ffpmsg(tmpname);\n        return(*status = BAD_KEYCHAR);\n    }\n\n    if (namelen <= 8 && fftkey(tmpname, &tstatus) <= 0 ) { \n    \n        /* a normal 8-char (or less) FITS keyword. */\n        strcat(card, tmpname);   /* copy keyword name to buffer */\n   \n        for (ii = namelen; ii < 8; ii++)\n            card[ii] = ' ';      /* pad keyword name with spaces */\n\n        card[8]  = '=';          /* append '= ' in columns 9-10 */\n        card[9]  = ' ';\n        card[10] = '\\0';        /* terminate the partial string */\n        namelen = 10;\n    } else if ((FSTRNCMP(tmpname, \"HIERARCH \", 9) == 0) || \n               (FSTRNCMP(tmpname, \"hierarch \", 9) == 0) ) {\n\n        /* this is an explicit ESO HIERARCH keyword */\n\n        strcat(card, tmpname);  /* copy keyword name to buffer */\n\n        if (namelen + 3 + len > 80) {\n            /* save 1 char by not putting a space before the equals sign */\n            strcat(card, \"= \");\n            namelen += 2;\n        } else {\n            strcat(card, \" = \");\n            namelen += 3;\n        }\n    } else {\n\n\t/* scan the keyword name to determine the number and max length of the tokens */\n\t/* and test if any of the tokens contain nonstandard characters */\n\t\n      \tstrncat(tmpname2, tmpname, FLEN_KEYWORD - 1);\n        cptr = ffstrtok(tmpname2, \" \",&saveptr);\n\twhile (cptr) {\n\t    if (strlen(cptr) > maxlen) maxlen = strlen(cptr); /* find longest token */\n\n\t    /* name contains special characters? */\n            tstatus = -1;  /* suppress any error message */\n\t    if (fftkey(cptr, &tstatus) > 0) specialchar = 1; \n\t    \n\t    cptr = ffstrtok(NULL, \" \",&saveptr);\n\t    ntoken++;\n\t}\n\n        tstatus = -1;  /* suppress any error message */\n\n/*      if (ntoken > 1) { */\n        if (ntoken > 0) {  /*  temporarily change so that this case should always be true  */\n\t    /* for now at least, treat all cases as an implicit ESO HIERARCH keyword. */\n\t    /* This could  change if FITS is ever expanded to directly support longer keywords. */\n\t    \n            if (namelen + 11 > FLEN_CARD-1)\n            {\n                ffpmsg(\n               \"The following keyword is too long to fit on a card:\");\n                ffpmsg(keyname);\n                return(*status = BAD_KEYCHAR);\n            }\n            strcat(card, \"HIERARCH \");\n            strcat(card, tmpname);\n\t    namelen += 9;\n\n            if (namelen + 3 + len > 80) {\n                /* save 1 char by not putting a space before the equals sign */\n                strcat(card, \"= \");\n                namelen += 2;\n            } else {\n                strcat(card, \" = \");\n                namelen += 3;\n            }\n\n\t} else if ((fftkey(tmpname, &tstatus) <= 0)) {\n          /* should never get here (at least for now) */\n            /* allow keyword names longer than 8 characters */\n\n            strncat(card, tmpname, FLEN_KEYWORD - 1);\n            strcat(card, \"= \");\n            namelen += 2;\n        } else {\n          /* should never get here (at least for now) */\n            ffpmsg(\"Illegal keyword name:\");\n            ffpmsg(tmpname);\n            return(*status = BAD_KEYCHAR);\n        }\n    }\n\n    if (len > 0)  /* now process the value string */\n    {\n        if (value[0] == '\\'')  /* is this a quoted string value? */\n        {\n            if (namelen > 77)\n            {\n                ffpmsg(\n               \"The following keyword + value is too long to fit on a card:\");\n                ffpmsg(keyname);\n                ffpmsg(value);\n                return(*status = BAD_KEYCHAR);\n            }\n\n            strncat(card, value, 80 - namelen); /* append the value string */\n            len = minvalue(80, namelen + len);\n\n            /* restore the closing quote if it got truncated */\n            if (len == 80)\n            {\n                   card[79] = '\\'';\n            }\n\n            if (comm)\n            {\n              if (comm[0] != 0)\n              {\n                if (len < 30)\n                {\n                  for (ii = len; ii < 30; ii++)\n                    card[ii] = ' '; /* fill with spaces to col 30 */\n\n                  card[30] = '\\0';\n                  len = 30;\n                }\n              }\n            }\n        }\n        else\n        {\n            if (namelen + len > 80)\n            {\n                ffpmsg(\n               \"The following keyword + value is too long to fit on a card:\");\n                ffpmsg(keyname);\n                ffpmsg(value);\n                return(*status = BAD_KEYCHAR);\n            }\n            else if (namelen + len < 30)\n            {\n                /* add spaces so field ends at least in col 30 */\n                strncat(card, \"                    \", 30 - (namelen + len));\n            }\n\n            strncat(card, value, 80 - namelen); /* append the value string */\n            len = minvalue(80, namelen + len);\n            len = maxvalue(30, len);\n        }\n\n        if (comm)\n        {\n          if ((len < 77) && ( strlen(comm) > 0) )  /* room for a comment? */\n          {\n            strcat(card, \" / \");   /* append comment separator */\n            strncat(card, comm, 77 - len); /* append comment (what fits) */\n          } \n        }\n    }\n    else\n    {\n      if (namelen == 10)  /* This case applies to normal keywords only */\n      {\n        card[8] = ' '; /* keywords with no value have no '=' */ \n        if (comm)\n        {\n          strncat(card, comm, 80 - namelen); /* append comment (what fits) */\n        }\n      }\n    }\n\n    /* issue a warning if this keyword does not strictly conform to the standard\n\t       HIERARCH convention, which requires,\n\t         1) at least 2 tokens in the name,\n\t\t 2) no tokens longer than 8 characters, and\n\t\t 3) no special characters in any of the tokens */\n\n            if (ntoken == 1 || specialchar == 1) {\n\t       ffpmsg(\"Warning: the following keyword does not conform to the HIERARCH convention\");\n\t     /*  ffpmsg(\" (e.g., name is not hierarchical or contains non-standard characters).\"); */\n\t       ffpmsg(card);\n\t    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmkey(fitsfile *fptr,    /* I - FITS file pointer  */\n           const char *card,  /* I - card string value  */\n           int *status)       /* IO - error status      */\n/*\n  replace the previously read card (i.e. starting 80 bytes before the\n  (fptr->Fptr)->nextkey position) with the contents of the input card.\n*/\n{\n    char tcard[81];\n    size_t len, ii;\n    int keylength = 8;\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    strncpy(tcard,card,80);\n    tcard[80] = '\\0';\n\n    len = strlen(tcard);\n\n    /* silently replace any illegal characters with a space */\n    for (ii=0; ii < len; ii++)  \n        if (tcard[ii] < ' ' || tcard[ii] > 126) tcard[ii] = ' ';\n\n    for (ii=len; ii < 80; ii++)    /* fill card with spaces if necessary */\n        tcard[ii] = ' ';\n\n    keylength = strcspn(tcard, \"=\");\n    if (keylength == 80) keylength = 8;\n\n    for (ii=0; ii < keylength; ii++)       /* make sure keyword name is uppercase */\n        tcard[ii] = toupper(tcard[ii]);\n\n    fftkey(tcard, status);        /* test keyword name contains legal chars */\n\n/*  no need to do this any more, since any illegal characters have been removed\n    fftrec(tcard, status);   */     /* test rest of keyword for legal chars   */\n\n    /* move position of keyword to be over written */\n    ffmbyt(fptr, ((fptr->Fptr)->nextkey) - 80, REPORT_EOF, status); \n    ffpbyt(fptr, 80, tcard, status);   /* write the 80 byte card */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffkeyn(const char *keyroot,   /* I - root string for keyword name */\n           int value,       /* I - index number to be appended to root name */\n           char *keyname,   /* O - output root + index keyword name */\n           int *status)     /* IO - error status  */\n/*\n  Construct a keyword name string by appending the index number to the root.\n  e.g., if root = \"TTYPE\" and value = 12 then keyname = \"TTYPE12\".\n*/\n{\n    char suffix[16];\n    size_t rootlen;\n\n    keyname[0] = '\\0';            /* initialize output name to null */\n    rootlen = strlen(keyroot);\n\n    if (rootlen == 0 || value < 0 )\n       return(*status = 206);\n\n    snprintf(suffix, 16, \"%d\", value); /* construct keyword suffix */\n\n    strcpy(keyname, keyroot);   /* copy root string to name string */\n    while (rootlen > 0 && keyname[rootlen - 1] == ' ') {\n        rootlen--;                 /* remove trailing spaces in root name */\n        keyname[rootlen] = '\\0';\n    }\n    if (strlen(suffix) + strlen(keyname) > 8)\n       return (*status=206);\n       \n    strcat(keyname, suffix);    /* append suffix to the root */\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffnkey(int value,       /* I - index number to be appended to root name */\n           const char *keyroot,   /* I - root string for keyword name */\n           char *keyname,   /* O - output root + index keyword name */\n           int *status)     /* IO - error status  */\n/*\n  Construct a keyword name string by appending the root string to the index\n  number. e.g., if root = \"TTYPE\" and value = 12 then keyname = \"12TTYPE\".\n*/\n{\n    size_t rootlen;\n\n    keyname[0] = '\\0';            /* initialize output name to null */\n    rootlen = strlen(keyroot);\n\n    if (rootlen == 0 || rootlen > 7 || value < 0 )\n       return(*status = 206);\n\n    snprintf(keyname, FLEN_VALUE,\"%d\", value); /* construct keyword prefix */\n\n    if (rootlen +  strlen(keyname) > 8)\n       return(*status = 206);\n\n    strcat(keyname, keyroot);  /* append root to the prefix */\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpsvc(char *card,    /* I - FITS header card (nominally 80 bytes long) */\n           char *value,   /* O - value string parsed from the card */\n           char *comm,    /* O - comment string parsed from the card */\n           int *status)   /* IO - error status   */\n/*\n  ParSe the Value and Comment strings from the input header card string.\n  If the card contains a quoted string value, the returned value string\n  includes the enclosing quote characters.  If comm = NULL, don't return\n  the comment string.\n*/\n{\n    int jj;\n    size_t ii, cardlen, nblank, valpos;\n\n    if (*status > 0)\n        return(*status);\n\n    value[0] = '\\0';\n    if (comm)\n        comm[0] = '\\0';\n\n    cardlen = strlen(card);\n\n    /* support for ESO HIERARCH keywords; find the '=' */\n    if (FSTRNCMP(card, \"HIERARCH \", 9) == 0)\n    {\n      valpos = strcspn(card, \"=\");\n\n      if (valpos == cardlen)   /* no value indicator ??? */\n      {\n        if (comm != NULL)\n        {\n          if (cardlen > 8)\n          {\n            strcpy(comm, &card[8]);\n\n            jj=cardlen - 8;\n            for (jj--; jj >= 0; jj--)  /* replace trailing blanks with nulls */\n            {\n               if (comm[jj] == ' ')\n                  comm[jj] = '\\0';\n               else\n                  break;\n            }\n          }\n        }\n        return(*status);  /* no value indicator */\n      }\n      valpos++;  /* point to the position after the '=' */\n    }\n    else if (cardlen < 9  ||\n        FSTRNCMP(card, \"COMMENT \", 8) == 0 ||  /* keywords with no value */\n        FSTRNCMP(card, \"HISTORY \", 8) == 0 ||\n        FSTRNCMP(card, \"END     \", 8) == 0 ||\n        FSTRNCMP(card, \"CONTINUE\", 8) == 0 ||\n        FSTRNCMP(card, \"        \", 8) == 0 )\n    {\n        /*  no value, so the comment extends from cols 9 - 80  */\n        if (comm != NULL)\n        {\n          if (cardlen > 8)\n          {\n             strcpy(comm, &card[8]);\n\n             jj=cardlen - 8;\n             for (jj--; jj >= 0; jj--)  /* replace trailing blanks with nulls */\n             {\n               if (comm[jj] == ' ')\n                  comm[jj] = '\\0';\n               else\n                  break;\n             }\n          }\n        }\n        return(*status);\n    }\n    else if (FSTRNCMP(&card[8], \"= \", 2) == 0  )\n    {\n        /* normal keyword with '= ' in cols 9-10 */\n        valpos = 10;  /* starting position of the value field */\n    }\n    else\n    {\n      valpos = strcspn(card, \"=\");\n\n      if (valpos == cardlen)   /* no value indicator ??? */\n      {\n        if (comm != NULL)\n        {\n          if (cardlen > 8)\n          {\n            strcpy(comm, &card[8]);\n\n            jj=cardlen - 8;\n            for (jj--; jj >= 0; jj--)  /* replace trailing blanks with nulls */\n            {\n               if (comm[jj] == ' ')\n                  comm[jj] = '\\0';\n               else\n                  break;\n            }\n          }\n        }\n        return(*status);  /* no value indicator */\n      }\n      valpos++;  /* point to the position after the '=' */\n    }\n\n    nblank = strspn(&card[valpos], \" \"); /* find number of leading blanks */\n\n    if (nblank + valpos == cardlen)\n    {\n      /* the absence of a value string is legal, and simply indicates\n         that the keyword value is undefined.  Don't write an error\n         message in this case.\n      */\n        return(*status);\n    }\n\n    ii = valpos + nblank;\n\n    if (card[ii] == '/' )  /* slash indicates start of the comment */\n    {\n         ii++;\n    }\n    else if (card[ii] == '\\'' )  /* is this a quoted string value? */\n    {\n        value[0] = card[ii];\n        for (jj=1, ii++; ii < cardlen; ii++, jj++)\n        {\n            if (card[ii] == '\\'')  /*  is this the closing quote?  */\n            {\n                if (card[ii+1] == '\\'')  /* 2 successive quotes? */ \n                {\n                   value[jj] = card[ii];\n                   ii++;  \n                   jj++;\n                }\n                else\n                {\n                    value[jj] = card[ii];\n                    break;   /* found the closing quote, so exit this loop  */\n                }\n            }\n            value[jj] = card[ii];  /* copy the next character to the output */\n        }\n\n        if (ii == cardlen)\n        {\n            jj = minvalue(jj, 69);  /* don't exceed 70 char string length */\n            value[jj] = '\\'';  /*  close the bad value string  */\n            value[jj+1] = '\\0';  /*  terminate the bad value string  */\n            ffpmsg(\"This keyword string value has no closing quote:\");\n            ffpmsg(card);\n\t    /*  May 2008 - modified to not fail on this minor error  */\n/*            return(*status = NO_QUOTE);  */\n        }\n        else\n        {\n            value[jj+1] = '\\0';  /*  terminate the good value string  */\n            ii++;   /*  point to the character following the value  */\n        }\n    }\n    else if (card[ii] == '(' )  /* is this a complex value? */\n    {\n        nblank = strcspn(&card[ii], \")\" ); /* find closing ) */\n        if (nblank == strlen( &card[ii] ) )\n        {\n            ffpmsg(\"This complex keyword value has no closing ')':\");\n            ffpmsg(card);\n            return(*status = NO_QUOTE);\n        }\n\n        nblank++;\n        strncpy(value, &card[ii], nblank);\n        value[nblank] = '\\0';\n        ii = ii + nblank;        \n    }\n    else   /*  an integer, floating point, or logical FITS value string  */\n    {\n        nblank = strcspn(&card[ii], \" /\");  /* find the end of the token */\n        strncpy(value, &card[ii], nblank);\n        value[nblank] = '\\0';\n        ii = ii + nblank;\n    }\n\n    /*  now find the comment string, if any  */\n    if (comm)\n    {\n      nblank = strspn(&card[ii], \" \");  /*  find next non-space character  */\n      ii = ii + nblank;\n\n      if (ii < 80)\n      {\n        if (card[ii] == '/')   /*  ignore the slash separator  */\n        {\n            ii++;\n            if (card[ii] == ' ')  /*  also ignore the following space  */\n                ii++;\n        }\n        strcat(comm, &card[ii]);  /*  copy the remaining characters  */\n\n        jj=strlen(comm);\n        for (jj--; jj >= 0; jj--)  /* replace trailing blanks with nulls */\n        {\n            if (comm[jj] == ' ')\n                comm[jj] = '\\0';\n            else\n                break;\n        }\n      }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgthd(char *tmplt, /* I - input header template string */\n           char *card,  /* O - returned FITS header record */\n           int *hdtype, /* O - how to interpreter the returned card string */ \n            /*\n              -2 = modify the name of a keyword; the old keyword name\n                   is returned starting at address chars[0]; the new name\n                   is returned starting at address char[40] (to be consistent\n                   with the Fortran version).  Both names are null terminated. \n              -1 = card contains the name of a keyword that is to be deleted\n               0 = append this keyword if it doesn't already exist, or \n                   modify the value if the keyword already exists.\n               1 = append this comment keyword ('HISTORY', \n                   'COMMENT', or blank keyword name) \n               2  =  this is the END keyword; do not write it to the header\n            */\n           int *status)   /* IO - error status   */\n/*\n  'Get Template HeaDer'\n  parse a template header line and create a formated\n  character string which is suitable for appending to a FITS header \n*/\n{\n    char keyname[FLEN_KEYWORD], value[140], comment[140];\n    char *tok, *suffix, *loc, tvalue[140];\n    int len, vlen, more, tstatus, lentok1=0, remainlen=0;\n    double dval;\n\n    if (*status > 0)\n        return(*status);\n\n    card[0]   = '\\0';\n    *hdtype   = 0;\n\n    if (!FSTRNCMP(tmplt, \"        \", 8) )\n    {\n        /* if first 8 chars of template are blank, then this is a comment */\n        strncat(card, tmplt, 80);\n        *hdtype = 1;\n        return(*status);\n    }\n\n    tok = tmplt;   /* point to start of template string */\n \n    keyname[0] = '\\0';\n    value[0]   = '\\0';\n    comment[0] = '\\0';\n\n    len = strspn(tok, \" \");  /* no. of spaces before keyword */\n    tok += len;\n\n    /* test for pecular case where token is a string of dashes */\n    if (strncmp(tok, \"--------------------\", 20) == 0)\n            return(*status = BAD_KEYCHAR);\n\n    if (tok[0] == '-')  /* is there a leading minus sign? */\n    {\n        /* first token is name of keyword to be deleted or renamed */\n        *hdtype = -1;\n        tok++;\n        len = strspn(tok, \" \");  /* no. of spaces before keyword */\n        tok += len;\n        \n        len = strcspn(tok, \" =+\");  /* length of name */\n        if (len >= FLEN_KEYWORD)\n          return(*status = BAD_KEYCHAR);\n\n        lentok1 = len;\n        strncat(card, tok, len);\n\n        /*\n          The HIERARCH convention supports non-standard characters\n          in the keyword name, so don't always convert to upper case or\n          abort if there are illegal characters in the name or if the\n          name is greater than 8 characters long.\n        */\n\n        if (len < 9)  /* this is possibly a normal FITS keyword name */\n        {\n          ffupch(card);\n          tstatus = 0;\n          if (fftkey(card, &tstatus) > 0)\n          {\n             /* name contained non-standard characters, so reset */\n             card[0] = '\\0';\n             strncat(card, tok, len);\n          }\n        }\n\n        tok += len;\n\n\t/* Check optional \"+\" indicator to delete multiple keywords */\n\tif (tok[0] == '+' && len < FLEN_KEYWORD) {\n\t  strcat(card, \"+\");\n\t  return (*status);\n\t}\n\n        /* second token, if present, is the new name for the keyword */\n\n        len = strspn(tok, \" \");  /* no. of spaces before next token */\n        tok += len;\n\n        if (tok[0] == '\\0' || tok[0] == '=')\n            return(*status);  /* no second token */\n\n        *hdtype = -2;\n        len = strcspn(tok, \" \");  /* length of new name */\n        /* this name has to fit on columns 41-80 of card,\n           and first name must now fit in 1-40 */\n        if (lentok1 > 40)\n        {\n           card[0] = '\\0';\n           return (*status = BAD_KEYCHAR);\n        }\n        if (len > 40)\n        {\n           card[0] = '\\0'; \n           return(*status = BAD_KEYCHAR);\n        }\n\n        /* copy the new name to card + 40;  This is awkward, */\n        /* but is consistent with the way the Fortran FITSIO works */\n\tstrcat(card,\"                                        \");\n        strncpy(&card[40], tok, len);\n        card[80] = '\\0'; /* necessary to add terminator in case len = 40 */\n\n        /*\n            The HIERARCH convention supports non-standard characters\n            in the keyword name, so don't always convert to upper case or\n            abort if there are illegal characters in the name or if the\n            name is greater than 8 characters long.\n        */\n\n        if (len < 9)  /* this is possibly a normal FITS keyword name */\n        {\n            ffupch(&card[40]);\n            tstatus = 0;\n            if (fftkey(&card[40], &tstatus) > 0)\n            {\n               /* name contained non-standard characters, so reset */\n               strncpy(&card[40], tok, len);\n            }\n        }\n    }\n    else  /* no negative sign at beginning of template */\n    {\n      /* get the keyword name token */\n\n      len = strcspn(tok, \" =\");  /* length of keyword name */\n      if (len >= FLEN_KEYWORD)\n        return(*status = BAD_KEYCHAR);\n\n      strncat(keyname, tok, len);\n\n      /*\n        The HIERARCH convention supports non-standard characters\n        in the keyword name, so don't always convert to upper case or\n        abort if there are illegal characters in the name or if the\n        name is greater than 8 characters long.\n      */\n\n      if (len < 9)  /* this is possibly a normal FITS keyword name */\n      {\n        ffupch(keyname);\n        tstatus = 0;\n        if (fftkey(keyname, &tstatus) > 0)\n        {\n           /* name contained non-standard characters, so reset */\n           keyname[0] = '\\0';\n           strncat(keyname, tok, len);\n        }\n      }\n\n      if (!FSTRCMP(keyname, \"END\") )\n      {\n         strcpy(card, \"END\");\n         *hdtype = 2;\n         return(*status);\n      }\n\n      tok += len; /* move token pointer to end of the keyword */\n\n      if (!FSTRCMP(keyname, \"COMMENT\") || !FSTRCMP(keyname, \"HISTORY\")\n         || !FSTRCMP(keyname, \"HIERARCH\") )\n      {\n        *hdtype = 1;   /* simply append COMMENT and HISTORY keywords */\n        strcpy(card, keyname);\n        strncat(card, tok, 72);\n        return(*status);\n      }\n\n      /* look for the value token */\n      len = strspn(tok, \" =\");  /* spaces or = between name and value */\n      tok += len;\n\n      if (*tok == '\\'') /* is value enclosed in quotes? */\n      {\n          more = TRUE;\n          remainlen = 139;\n          while (more)\n          {\n            tok++;  /* temporarily move past the quote char */\n            len = strcspn(tok, \"'\");  /* length of quoted string */\n            tok--;\n            if (len+2 > remainlen)\n               return (*status=BAD_KEYCHAR);\n            strncat(value, tok, len + 2);\n            remainlen -= (len+2); \n \n            tok += len + 1;\n            if (tok[0] != '\\'')   /* check there is a closing quote */\n              return(*status = NO_QUOTE);\n\n            tok++;\n            if (tok[0] != '\\'')  /* 2 quote chars = literal quote */\n              more = FALSE;\n          }\n      }\n      else if (*tok == '/' || *tok == '\\0')  /* There is no value */\n      {\n          strcat(value, \" \");\n      }\n      else   /* not a quoted string value */\n      {\n          len = strcspn(tok, \" /\"); /* length of value string */\n          if (len > 139)\n             return (*status=BAD_KEYCHAR);\n          strncat(value, tok, len);\n          if (!( (tok[0] == 'T' || tok[0] == 'F') &&\n                 (tok[1] == ' ' || tok[1] == '/' || tok[1] == '\\0') )) \n          {\n             /* not a logical value */\n\n            dval = strtod(value, &suffix); /* try to read value as number */\n\n            if (*suffix != '\\0' && *suffix != ' ' && *suffix != '/')\n            { \n                /* value not recognized as a number; might be because it */\n                /* contains a 'd' or 'D' exponent character  */ \n                strcpy(tvalue, value);\n                if ((loc = strchr(tvalue, 'D')))\n                {          \n                    *loc = 'E'; /*  replace D's with E's. */ \n                    dval = strtod(tvalue, &suffix); /* read value again */\n                }\n                else if ((loc = strchr(tvalue, 'd')))\n                {\n                    *loc = 'E'; /*  replace d's with E's. */ \n                    dval = strtod(tvalue, &suffix); /* read value again */\n                }\n                else if ((loc = strchr(tvalue, '.')))\n                {\n                    *loc = ','; /*  replace period with a comma */ \n                    dval = strtod(tvalue, &suffix); /* read value again */\n                }\n            }\n   \n            if (*suffix != '\\0' && *suffix != ' ' && *suffix != '/')\n            { \n              /* value is not a number; must enclose it in quotes */\n              if (len > 137)\n                return (*status=BAD_KEYCHAR);              \n              strcpy(value, \"'\");\n              strncat(value, tok, len);\n              strcat(value, \"'\");\n\n              /* the following useless statement stops the compiler warning */\n              /* that dval is not used anywhere */\n              if (dval == 0.)\n                 len += (int) dval; \n            }\n            else  \n            {\n                /* value is a number; convert any 'e' to 'E', or 'd' to 'D' */\n                loc = strchr(value, 'e');\n                if (loc)\n                {          \n                    *loc = 'E';  \n                }\n                else\n                {\n                    loc = strchr(value, 'd');\n                    if (loc)\n                    {          \n                        *loc = 'D';  \n                    }\n                }\n            }\n          }\n          tok += len;\n      }\n\n      len = strspn(tok, \" /\"); /* no. of spaces between value and comment */\n      tok += len;\n\n      vlen = strlen(value);\n      if (vlen > 0 && vlen < 10 && value[0] == '\\'')\n      {\n          /* pad quoted string with blanks so it is at least 8 chars long */\n          value[vlen-1] = '\\0';\n          strncat(value, \"        \", 10 - vlen);\n          strcat(&value[9], \"'\");\n      }\n\n      /* get the comment string */\n      strncat(comment, tok, 70);\n\n      /* construct the complete FITS header card */\n      ffmkky(keyname, value, comment, card, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_translate_keyword(\n      char *inrec,        /* I - input string */\n      char *outrec,       /* O - output converted string, or */\n                          /*     a null string if input does not  */\n                          /*     match any of the patterns */\n      char *patterns[][2],/* I - pointer to input / output string */\n                          /*     templates */\n      int npat,           /* I - number of templates passed */\n      int n_value,        /* I - base 'n' template value of interest */\n      int n_offset,       /* I - offset to be applied to the 'n' */\n                          /*     value in the output string */\n      int n_range,        /* I - controls range of 'n' template */\n                          /*     values of interest (-1,0, or +1) */\n      int *pat_num,       /* O - matched pattern number (0 based) or -1 */\n      int *i,             /* O - value of i, if any, else 0 */\n      int *j,             /* O - value of j, if any, else 0 */\n      int *m,             /* O - value of m, if any, else 0 */\n      int *n,             /* O - value of n, if any, else 0 */\n\n      int *status)        /* IO - error status */\n\n/* \n\nTranslate a keyword name to a new name, based on a set of patterns.\nThe user passes an array of patterns to be matched.  Input pattern\nnumber i is pattern[i][0], and output pattern number i is\npattern[i][1].  Keywords are matched against the input patterns.  If a\nmatch is found then the keyword is re-written according to the output\npattern.\n\nOrder is important.  The first match is accepted.  The fastest match\nwill be made when templates with the same first character are grouped\ntogether.\n\nSeveral characters have special meanings:\n\n     i,j - single digits, preserved in output template\n     n - column number of one or more digits, preserved in output template\n     m - generic number of one or more digits, preserved in output template\n     a - coordinate designator, preserved in output template\n     # - number of one or more digits\n     ? - any character\n     * - only allowed in first character position, to match all\n         keywords; only useful as last pattern in the list\n\ni, j, n, and m are returned by the routine.\n\nFor example, the input pattern \"iCTYPn\" will match \"1CTYP5\" (if n_value\nis 5); the output pattern \"CTYPEi\" will be re-written as \"CTYPE1\".\nNotice that \"i\" is preserved.\n\nThe following output patterns are special\n\nSpecial output pattern characters:\n\n    \"-\" - do not copy a keyword that matches the corresponding input pattern\n\n    \"+\" - copy the input unchanged\n\nThe inrec string could be just the 8-char keyword name, or the entire \n80-char header record.  Characters 9 = 80 in the input string simply get\nappended to the translated keyword name.\n\nIf n_range = 0, then only keywords with 'n' equal to n_value will be \nconsidered as a pattern match.  If n_range = +1, then all values of \n'n' greater than or equal to n_value will be a match, and if -1, \nthen values of 'n' less than or equal to n_value will match.\n\n  This routine was written by Craig Markwardt, GSFC\n*/\n\n{\n    int i1 = 0, j1 = 0, n1 = 0, m1 = 0;\n    int fac;\n    char a = ' ';\n    char oldp;\n    char c, s;\n    int ip, ic, pat, pass = 0, firstfail;\n    char *spat;\n\n    if (*status > 0)\n        return(*status);\n    if ((inrec == 0) || (outrec == 0)) \n      return (*status = NULL_INPUT_PTR);\n\n    *outrec = '\\0';\n/*\n    if (*inrec == '\\0') return 0;\n*/\n\n    if (*inrec == '\\0')    /* expand to full 8 char blank keyword name */\n       strcpy(inrec, \"        \");\n       \n    oldp = '\\0';\n    firstfail = 0;\n\n    /* ===== Pattern match stage */\n    for (pat=0; pat < npat; pat++) {\n      spat = patterns[pat][0];\n      \n      i1 = 0; j1 = 0; m1 = -1; n1 = -1; a = ' ';  /* Initialize the place-holders */\n      pass = 0;\n      \n      /* Pass the wildcard pattern */\n      if (spat[0] == '*') { \n\tpass = 1;\n\tbreak;\n      }\n      \n      /* Optimization: if we have seen this initial pattern character before,\n\t then it must have failed, and we can skip the pattern */\n      if (firstfail && spat[0] == oldp) continue;\n      oldp = spat[0];\n\n      /* \n\t ip = index of pattern character being matched\n\t ic = index of keyname character being matched\n\t firstfail = 1 if we fail on the first characteor (0=not)\n      */\n      \n      for (ip=0, ic=0, firstfail=1;\n\t   (spat[ip]) && (ic < 8);\n\t   ip++, ic++, firstfail=0) {\n\tc = inrec[ic];\n\ts = spat[ip];\n\n\tif (s == 'i') {\n\t  /* Special pattern: 'i' placeholder */\n\t  if (isdigit(c)) { i1 = c - '0'; pass = 1;}\n\t} else if (s == 'j') {\n\t  /* Special pattern: 'j' placeholder */\n\t  if (isdigit(c)) { j1 = c - '0'; pass = 1;}\n\t} else if ((s == 'n')||(s == 'm')||(s == '#')) {\n\t  /* Special patterns: multi-digit number */\n\t  int val = 0;\n\t  pass = 0;\n\t  if (isdigit(c)) {\n\t    pass = 1;  /* NOTE, could fail below */\n\t    \n\t    /* Parse decimal number */\n\t    while (ic<8 && isdigit(c)) { \n\t      val = val*10 + (c - '0');\n\t      ic++; c = inrec[ic];\n\t    }\n\t    ic--; c = inrec[ic];\n\t    \n\t    if (s == 'n') { \n\t      \n\t      /* Is it a column number? */\n\t      if ( val >= 1 && val <= 999 &&                    /* Row range check */\n\t\t   (((n_range == 0) && (val == n_value)) ||     /* Strict equality */\n\t\t    ((n_range == -1) && (val <= n_value)) ||    /* n <= n_value */\n\t\t    ((n_range == +1) && (val >= n_value))) ) {  /* n >= n_value */\n\t\tn1 = val;\n\t      } else {\n\t\tpass = 0;\n\t      }\n\t    } else if (s == 'm') {\n\t      \n\t      /* Generic number */\n\t      m1 = val; \n\t    }\n\t  }\n\t} else if (s == 'a') {\n\t  /* Special pattern: coordinate designator */\n\t  if (isupper(c) || c == ' ') { a = c; pass = 1;} \n\t} else if (s == '?') {\n\t  /* Match any individual character */\n\t  pass = 1;\n\t} else if (c == s) {\n\t  /* Match a specific character */\n\t  pass = 1;\n\t} else {\n\t  /* FAIL */\n\t  pass = 0;\n\t}\n\tif (!pass) break;\n      }\n      \n      /* Must pass to the end of the keyword.  No partial matches allowed */\n      if (pass && (ic >= 8 || inrec[ic] == ' ')) break;\n    }\n\n    /* Transfer the pattern-matched numbers to the output parameters */\n    if (i) { *i = i1; }\n    if (j) { *j = j1; }\n    if (n) { *n = n1; }\n    if (m) { *m = m1; }\n    if (pat_num) { *pat_num = pat; }\n\n    /* ===== Keyword rewriting and output stage */\n    spat = patterns[pat][1];\n\n    /* Return case: explicit deletion, return '-' */\n    if (pass && strcmp(spat,\"--\") == 0) {\n      strcpy(outrec, \"-\");\n      strncat(outrec, inrec, 8);\n      outrec[9] = 0;\n      for(i1=8; i1>1 && outrec[i1] == ' '; i1--) outrec[i1] = 0;\n      return 0;\n    }\n\n    /* Return case: no match, or do-not-transfer pattern */\n    if (pass == 0 || spat[0] == '\\0' || strcmp(spat,\"-\") == 0) return 0;\n    /* A match: we start by copying the input record to the output */\n    strcpy(outrec, inrec);\n\n    /* Return case: return the input record unchanged */\n    if (spat[0] == '+') return 0;\n\n\n    /* Final case: a new output pattern */\n    for (ip=0, ic=0; spat[ip]; ip++, ic++) {\n      s = spat[ip];\n      if (s == 'i') {\n\toutrec[ic] = (i1+'0');\n      } else if (s == 'j') {\n\toutrec[ic] = (j1+'0');\n      } else if (s == 'n') {\n\tif (n1 == -1) { n1 = n_value; }\n\tif (n1 > 0) {\n\t  n1 += n_offset;\n\t  for (fac = 1; (n1/fac) > 0; fac *= 10);\n\t  fac /= 10;\n\t  while(fac > 0) {\n\t    outrec[ic] = ((n1/fac) % 10) + '0';\n\t    fac /= 10;\n\t    ic ++;\n\t  }\n\t  ic--;\n\t}\n      } else if (s == 'm' && m1 >= 0) {\n\tfor (fac = 1; (m1/fac) > 0; fac *= 10);\n\tfac /= 10;\n\twhile(fac > 0) {\n\t  outrec[ic] = ((m1/fac) % 10) + '0';\n\t  fac /= 10;\n\t  ic ++;\n\t}\n\tic --;\n      } else if (s == 'a') {\n\toutrec[ic] = a;\n      } else {\n\toutrec[ic] = s;\n      }\n    }\n\n    /* Pad the keyword name with spaces */\n    for ( ; ic<8; ic++) { outrec[ic] = ' '; }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_translate_keywords(\n\t   fitsfile *infptr,   /* I - pointer to input HDU */\n\t   fitsfile *outfptr,  /* I - pointer to output HDU */\n\t   int firstkey,       /* I - first HDU record number to start with */\n\t   char *patterns[][2],/* I - pointer to input / output keyword templates */\n\t   int npat,           /* I - number of templates passed */\n\t   int n_value,        /* I - base 'n' template value of interest */\n\t   int n_offset,       /* I - offset to be applied to the 'n' */\n \t                       /*     value in the output string */\n\t   int n_range,        /* I - controls range of 'n' template */\n\t                       /*     values of interest (-1,0, or +1) */\n           int *status)        /* IO - error status */\n/*\n     Copy relevant keywords from the table header into the newly\n     created primary array header.  Convert names of keywords where\n     appropriate.  See fits_translate_keyword() for the definitions.\n\n     Translation begins at header record number 'firstkey', and\n     continues to the end of the header.\n\n  This routine was written by Craig Markwardt, GSFC\n*/\n{\n    int nrec, nkeys, nmore;\n    char rec[FLEN_CARD];\n    int i = 0, j = 0, n = 0, m = 0;\n    int pat_num = 0, maxchr, ii;\n    char outrec[FLEN_CARD];\n\n    if (*status > 0)\n        return(*status);\n\n    ffghsp(infptr, &nkeys, &nmore, status);  /* get number of keywords */\n\n    for (nrec = firstkey; (*status == 0) && (nrec <= nkeys); nrec++) {\n      outrec[0] = '\\0';\n\n      ffgrec(infptr, nrec, rec, status);\n\n      /* silently overlook any illegal ASCII characters in the value or */\n      /* comment fields of the record. It is usually not appropriate to */\n      /* abort the process because of this minor transgression of the FITS rules. */\n      /* Set the offending character to a blank */\n\n      maxchr = strlen(rec);\n      for (ii = 8; ii < maxchr; ii++)\n      {\n        if (rec[ii] < 32 || rec[ii] > 126)\n          rec[ii] = ' ';\n      }\n      \n      fits_translate_keyword(rec, outrec, patterns, npat, \n\t\t\t     n_value, n_offset, n_range, \n\t\t\t     &pat_num, &i, &j, &m, &n, status);\n      \n      if (*status == 0) {\n\tif (outrec[0] == '-') { /* prefix -KEYNAME means delete */\n\t  int i1;\n\n\t  /* Preserve only the keyword portion of name */\n\t  outrec[9] = 0;\n\t  for(i1=8; i1>1 && outrec[i1] == ' '; i1--) outrec[i1] = 0;\n\n\t  ffpmrk();\n\t  ffdkey(outfptr, outrec+1, status); /* delete the keyword */\n\t  if (*status == 0) {\n\t    int nkeys1;\n\t    /* get number of keywords again in case of change*/\n\t    ffghsp(infptr, &nkeys1, &nmore, status);  \n\t    if (nkeys1 != nkeys) {\n\t      nrec --;\n\t      nkeys = nkeys1;\n\t    }\n\t  }\n\t  *status = 0;\n\t  ffcmrk();\n\n\t} else if (outrec[0]) {\n\t  ffprec(outfptr, outrec, status); /* copy the keyword */\n\t}\t  \n      }\n      rec[8] = 0; outrec[8] = 0;\n\n    }\t\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_copy_pixlist2image(\n\t   fitsfile *infptr,   /* I - pointer to input HDU */\n\t   fitsfile *outfptr,  /* I - pointer to output HDU */\n\t   int firstkey,       /* I - first HDU record number to start with */\n           int naxis,          /* I - number of axes in the image */\n           int *colnum,       /* I - numbers of the columns to be binned  */\n           int *status)        /* IO - error status */\n/*\n     Copy relevant keywords from the pixel list table header into a newly\n     created primary array header.  Convert names of keywords where\n     appropriate.  See fits_translate_pixkeyword() for the definitions.\n\n     Translation begins at header record number 'firstkey', and\n     continues to the end of the header.\n*/\n{\n    int nrec, nkeys, nmore;\n    char rec[FLEN_CARD], outrec[FLEN_CARD];\n    int pat_num = 0, npat;\n    int iret, jret, nret, mret, lret;\n    char *patterns[][2] = {\n\n\t\t\t   {\"TCTYPn\",  \"CTYPEn\"    },\n\t\t\t   {\"TCTYna\",  \"CTYPEna\"   },\n\t\t\t   {\"TCUNIn\",  \"CUNITn\"    },\n\t\t\t   {\"TCUNna\",  \"CUNITna\"   },\n\t\t\t   {\"TCRVLn\",  \"CRVALn\"    },\n\t\t\t   {\"TCRVna\",  \"CRVALna\"   },\n\t\t\t   {\"TCDLTn\",  \"CDELTn\"    },\n\t\t\t   {\"TCDEna\",  \"CDELTna\"   },\n\t\t\t   {\"TCRPXn\",  \"CRPIXn\"    },\n\t\t\t   {\"TCRPna\",  \"CRPIXna\"   },\n\t\t\t   {\"TCROTn\",  \"CROTAn\"    },\n\t\t\t   {\"TPn_ma\",  \"PCn_ma\"    },\n\t\t\t   {\"TPCn_m\",  \"PCn_ma\"    },\n\t\t\t   {\"TCn_ma\",  \"CDn_ma\"    },\n\t\t\t   {\"TCDn_m\",  \"CDn_ma\"    },\n\t\t\t   {\"TVn_la\",  \"PVn_la\"    },\n\t\t\t   {\"TPVn_l\",  \"PVn_la\"    },\n\t\t\t   {\"TSn_la\",  \"PSn_la\"    },\n\t\t\t   {\"TPSn_l\",  \"PSn_la\"    },\n\t\t\t   {\"TWCSna\",  \"WCSNAMEa\"  },\n\t\t\t   {\"TCNAna\",  \"CNAMEna\"   },\n\t\t\t   {\"TCRDna\",  \"CRDERna\"   },\n\t\t\t   {\"TCSYna\",  \"CSYERna\"   },\n\t\t\t   {\"LONPna\",  \"LONPOLEa\"  },\n\t\t\t   {\"LATPna\",  \"LATPOLEa\"  },\n\t\t\t   {\"EQUIna\",  \"EQUINOXa\"  },\n\t\t\t   {\"MJDOBn\",  \"MJD-OBS\"   },\n\t\t\t   {\"MJDAn\",   \"MJD-AVG\"   },\n\t\t\t   {\"DAVGn\",   \"DATE-AVG\"  },\n\t\t\t   {\"RADEna\",  \"RADESYSa\"  },\n\t\t\t   {\"RFRQna\",  \"RESTFRQa\"  },\n\t\t\t   {\"RWAVna\",  \"RESTWAVa\"  },\n\t\t\t   {\"SPECna\",  \"SPECSYSa\"  },\n\t\t\t   {\"SOBSna\",  \"SSYSOBSa\"  },\n\t\t\t   {\"SSRCna\",  \"SSYSSRCa\"  },\n\n                           /* preserve common keywords */\n\t\t\t   {\"LONPOLEa\",   \"+\"       },\n\t\t\t   {\"LATPOLEa\",   \"+\"       },\n\t\t\t   {\"EQUINOXa\",   \"+\"       },\n\t\t\t   {\"EPOCH\",      \"+\"       },\n\t\t\t   {\"MJD-????\",   \"+\"       },\n\t\t\t   {\"DATE????\",   \"+\"       },\n\t\t\t   {\"TIME????\",   \"+\"       },\n\t\t\t   {\"RADESYSa\",   \"+\"       },\n\t\t\t   {\"RADECSYS\",   \"+\"       },\n\t\t\t   {\"TELESCOP\",   \"+\"       },\n\t\t\t   {\"INSTRUME\",   \"+\"       },\n\t\t\t   {\"OBSERVER\",   \"+\"       },\n\t\t\t   {\"OBJECT\",     \"+\"       },\n\n                           /* Delete general table column keywords */\n\t\t\t   {\"XTENSION\", \"-\"       },\n\t\t\t   {\"BITPIX\",   \"-\"       },\n\t\t\t   {\"NAXIS\",    \"-\"       },\n\t\t\t   {\"NAXISi\",   \"-\"       },\n\t\t\t   {\"PCOUNT\",   \"-\"       },\n\t\t\t   {\"GCOUNT\",   \"-\"       },\n\t\t\t   {\"TFIELDS\",  \"-\"       },\n\n\t\t\t   {\"TDIM#\",   \"-\"       },\n\t\t\t   {\"THEAP\",   \"-\"       },\n\t\t\t   {\"EXTNAME\", \"-\"       }, \n\t\t\t   {\"EXTVER\",  \"-\"       },\n\t\t\t   {\"EXTLEVEL\",\"-\"       },\n\t\t\t   {\"CHECKSUM\",\"-\"       },\n\t\t\t   {\"DATASUM\", \"-\"       },\n\t\t\t   {\"NAXLEN\",  \"-\"       },\n\t\t\t   {\"AXLEN#\",  \"-\"       },\n\t\t\t   {\"CPREF\",  \"-\"       },\n\t\t\t   \n                           /* Delete table keywords related to other columns */\n\t\t\t   {\"T????#a\", \"-\"       }, \n \t\t\t   {\"TC??#a\",  \"-\"       },\n \t\t\t   {\"T??#_#\",  \"-\"       },\n \t\t\t   {\"TWCS#a\",  \"-\"       },\n\n\t\t\t   {\"LONP#a\",  \"-\"       },\n\t\t\t   {\"LATP#a\",  \"-\"       },\n\t\t\t   {\"EQUI#a\",  \"-\"       },\n\t\t\t   {\"MJDOB#\",  \"-\"       },\n\t\t\t   {\"MJDA#\",   \"-\"       },\n\t\t\t   {\"RADE#a\",  \"-\"       },\n\t\t\t   {\"DAVG#\",   \"-\"       },\n\n\t\t\t   {\"iCTYP#\",  \"-\"       },\n\t\t\t   {\"iCTY#a\",  \"-\"       },\n\t\t\t   {\"iCUNI#\",  \"-\"       },\n\t\t\t   {\"iCUN#a\",  \"-\"       },\n\t\t\t   {\"iCRVL#\",  \"-\"       },\n\t\t\t   {\"iCDLT#\",  \"-\"       },\n\t\t\t   {\"iCRPX#\",  \"-\"       },\n\t\t\t   {\"iCTY#a\",  \"-\"       },\n\t\t\t   {\"iCUN#a\",  \"-\"       },\n\t\t\t   {\"iCRV#a\",  \"-\"       },\n\t\t\t   {\"iCDE#a\",  \"-\"       },\n\t\t\t   {\"iCRP#a\",  \"-\"       },\n\t\t\t   {\"ijPC#a\",  \"-\"       },\n\t\t\t   {\"ijCD#a\",  \"-\"       },\n\t\t\t   {\"iV#_#a\",  \"-\"       },\n\t\t\t   {\"iS#_#a\",  \"-\"       },\n\t\t\t   {\"iCRD#a\",  \"-\"       },\n\t\t\t   {\"iCSY#a\",  \"-\"       },\n\t\t\t   {\"iCROT#\",  \"-\"       },\n\t\t\t   {\"WCAX#a\",  \"-\"       },\n\t\t\t   {\"WCSN#a\",  \"-\"       },\n\t\t\t   {\"iCNA#a\",  \"-\"       },\n\n\t\t\t   {\"*\",       \"+\"       }}; /* copy all other keywords */\n\n    if (*status > 0)\n        return(*status);\n\n    npat = sizeof(patterns)/sizeof(patterns[0][0])/2;\n\n    ffghsp(infptr, &nkeys, &nmore, status);  /* get number of keywords */\n\n    for (nrec = firstkey; nrec <= nkeys; nrec++) {\n      outrec[0] = '\\0';\n\n      ffgrec(infptr, nrec, rec, status);\n\n      fits_translate_pixkeyword(rec, outrec, patterns, npat, \n\t\t\t     naxis, colnum, \n\t\t\t     &pat_num, &iret, &jret, &nret, &mret, &lret, status);\n\n      if (outrec[0]) {\n\tffprec(outfptr, outrec, status); /* copy the keyword */\n      } \n\n      rec[8] = 0; outrec[8] = 0;\n    }\t\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_translate_pixkeyword(\n      char *inrec,        /* I - input string */\n      char *outrec,       /* O - output converted string, or */\n                          /*     a null string if input does not  */\n                          /*     match any of the patterns */\n      char *patterns[][2],/* I - pointer to input / output string */\n                          /*     templates */\n      int npat,           /* I - number of templates passed */\n      int naxis,          /* I - number of columns to be binned */\n      int *colnum,       /* I - numbers of the columns to be binned */\n      int *pat_num,       /* O - matched pattern number (0 based) or -1 */\n      int *i,\n      int *j,\n      int *n,\n      int *m,\n      int *l,\n      int *status)        /* IO - error status */\n      \n/* \n\nTranslate a keyword name to a new name, based on a set of patterns.\nThe user passes an array of patterns to be matched.  Input pattern\nnumber i is pattern[i][0], and output pattern number i is\npattern[i][1].  Keywords are matched against the input patterns.  If a\nmatch is found then the keyword is re-written according to the output\npattern.\n\nOrder is important.  The first match is accepted.  The fastest match\nwill be made when templates with the same first character are grouped\ntogether.\n\nSeveral characters have special meanings:\n\n     i,j - single digits, preserved in output template\n     n, m - column number of one or more digits, preserved in output template\n     k - generic number of one or more digits, preserved in output template\n     a - coordinate designator, preserved in output template\n     # - number of one or more digits\n     ? - any character\n     * - only allowed in first character position, to match all\n         keywords; only useful as last pattern in the list\n\ni, j, n, and m are returned by the routine.\n\nFor example, the input pattern \"iCTYPn\" will match \"1CTYP5\" (if n_value\nis 5); the output pattern \"CTYPEi\" will be re-written as \"CTYPE1\".\nNotice that \"i\" is preserved.\n\nThe following output patterns are special\n\nSpecial output pattern characters:\n\n    \"-\" - do not copy a keyword that matches the corresponding input pattern\n\n    \"+\" - copy the input unchanged\n\nThe inrec string could be just the 8-char keyword name, or the entire \n80-char header record.  Characters 9 = 80 in the input string simply get\nappended to the translated keyword name.\n\nIf n_range = 0, then only keywords with 'n' equal to n_value will be \nconsidered as a pattern match.  If n_range = +1, then all values of \n'n' greater than or equal to n_value will be a match, and if -1, \nthen values of 'n' less than or equal to n_value will match.\n\n*/\n\n{\n    int i1 = 0, j1 = 0, val;\n    int fac, nval = 0, mval = 0, lval = 0;\n    char a = ' ';\n    char oldp;\n    char c, s;\n    int ip, ic, pat, pass = 0, firstfail;\n    char *spat;\n\n    if (*status > 0)\n        return(*status);\n\n    if ((inrec == 0) || (outrec == 0)) \n      return (*status = NULL_INPUT_PTR);\n\n    *outrec = '\\0';\n    if (*inrec == '\\0') return 0;\n\n    oldp = '\\0';\n    firstfail = 0;\n\n    /* ===== Pattern match stage */\n    for (pat=0; pat < npat; pat++) {\n\n      spat = patterns[pat][0];\n      \n      i1 = 0; j1 = 0;   a = ' ';  /* Initialize the place-holders */\n      pass = 0;\n      \n      /* Pass the wildcard pattern */\n      if (spat[0] == '*') { \n\tpass = 1;\n\tbreak;\n      }\n      \n      /* Optimization: if we have seen this initial pattern character before,\n\t then it must have failed, and we can skip the pattern */\n      if (firstfail && spat[0] == oldp) continue;\n      oldp = spat[0];\n\n      /* \n\t ip = index of pattern character being matched\n\t ic = index of keyname character being matched\n\t firstfail = 1 if we fail on the first characteor (0=not)\n      */\n      \n      for (ip=0, ic=0, firstfail=1;\n\t   (spat[ip]) && (ic < 8);\n\t   ip++, ic++, firstfail=0) {\n\tc = inrec[ic];\n\ts = spat[ip];\n\n\tif (s == 'i') {\n\t  /* Special pattern: 'i' placeholder */\n\t  if (isdigit(c)) { i1 = c - '0'; pass = 1;}\n\t} else if (s == 'j') {\n\t  /* Special pattern: 'j' placeholder */\n\t  if (isdigit(c)) { j1 = c - '0'; pass = 1;}\n\t} else if ((s == 'n')||(s == 'm')||(s == 'l')||(s == '#')) {\n\t  /* Special patterns: multi-digit number */\n          val = 0;\n\t  pass = 0;\n\t  if (isdigit(c)) {\n\t    pass = 1;  /* NOTE, could fail below */\n\t    \n\t    /* Parse decimal number */\n\t    while (ic<8 && isdigit(c)) { \n\t      val = val*10 + (c - '0');\n\t      ic++; c = inrec[ic];\n\t    }\n\t    ic--; c = inrec[ic];\n\n\t    if (s == 'n' || s == 'm') { \n\t      \n\t      /* Is it a column number? */\n\t      if ( val >= 1 && val <= 999) {\n\t         \n\t\t if (val == colnum[0])\n\t\t     val = 1; \n\t\t else if (val == colnum[1]) \n\t\t     val = 2; \n\t\t else if (val == colnum[2]) \n\t\t     val = 3; \n\t\t else if (val == colnum[3]) \n\t\t     val = 4; \n\t\t else {\n\t\t     pass = 0;\n\t\t     val = 0; \n\t\t }\n\n\t         if (s == 'n')\n\t\t    nval = val;\n\t\t else\n\t\t    mval = val;\n \n              } else {\n\t\t  pass = 0;\n              }\n\t    } else if (s == 'l') {\n\t      /* Generic number */\n\t      lval = val; \n\t    }\n\t  }\n\t} else if (s == 'a') {\n\t  /* Special pattern: coordinate designator */\n\t  if (isupper(c) || c == ' ') { a = c; pass = 1;} \n\t} else if (s == '?') {\n\t  /* Match any individual character */\n\t  pass = 1;\n\t} else if (c == s) {\n\t  /* Match a specific character */\n\t  pass = 1;\n\t} else {\n\t  /* FAIL */\n\t  pass = 0;\n\t}\n\t\n\tif (!pass) break;\n      }\n      \n\n      /* Must pass to the end of the keyword.  No partial matches allowed */\n      if (pass && (ic >= 8 || inrec[ic] == ' ')) break;\n    }\n\n\n    /* Transfer the pattern-matched numbers to the output parameters */\n    if (i) { *i = i1; }\n    if (j) { *j = j1; }\n    if (n) { *n = nval; }\n    if (m) { *m = mval; }\n    if (l) { *l = lval; }\n    if (pat_num) { *pat_num = pat; }\n\n    /* ===== Keyword rewriting and output stage */\n    spat = patterns[pat][1];\n\n    /* Return case: no match, or explicit deletion pattern */\n    if (pass == 0 || spat[0] == '\\0' || spat[0] == '-') return 0;\n\n    /* A match: we start by copying the input record to the output */\n    strcpy(outrec, inrec);\n\n    /* Return case: return the input record unchanged */\n    if (spat[0] == '+') return 0;\n\n    /* Final case: a new output pattern */\n    for (ip=0, ic=0; spat[ip]; ip++, ic++) {\n      s = spat[ip];\n      if (s == 'i') {\n\toutrec[ic] = (i1+'0');\n      } else if (s == 'j') {\n\toutrec[ic] = (j1+'0');\n      } else if (s == 'n' && nval > 0) {\n\t  for (fac = 1; (nval/fac) > 0; fac *= 10);\n\t  fac /= 10;\n\t  while(fac > 0) {\n\t    outrec[ic] = ((nval/fac) % 10) + '0';\n\t    fac /= 10;\n\t    ic ++;\n\t  }\n\t  ic--;\n      } else if (s == 'm' && mval > 0) {\n\t  for (fac = 1; (mval/fac) > 0; fac *= 10);\n\t  fac /= 10;\n\t  while(fac > 0) {\n\t    outrec[ic] = ((mval/fac) % 10) + '0';\n\t    fac /= 10;\n\t    ic ++;\n\t  }\n\t  ic--;\n      } else if (s == 'l' && lval >= 0) {\n\tfor (fac = 1; (lval/fac) > 0; fac *= 10);\n\tfac /= 10;\n\twhile(fac > 0) {\n\t  outrec[ic] = ((lval/fac) % 10) + '0';\n\t  fac /= 10;\n\t  ic ++;\n\t}\n\tic --;\n      } else if (s == 'a') {\n\toutrec[ic] = a;\n      } else {\n\toutrec[ic] = s;\n      }\n    }\n\n    /* Pad the keyword name with spaces */\n    for ( ; ic<8; ic++) { outrec[ic] = ' '; }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffasfm(char *tform,    /* I - format code from the TFORMn keyword */\n           int *dtcode,    /* O - numerical datatype code */\n           long *twidth,   /* O - width of the field, in chars */\n           int *decimals,  /* O - number of decimal places (F, E, D format) */\n           int *status)    /* IO - error status      */\n{\n/*\n  parse the ASCII table TFORM column format to determine the data\n  type, the field width, and number of decimal places (if relevant)\n*/\n    int ii, datacode;\n    long longval, width;\n    float fwidth;\n    char *form, temp[FLEN_VALUE], message[FLEN_ERRMSG];\n\n    if (*status > 0)\n        return(*status);\n\n    if (dtcode)\n        *dtcode = 0;\n\n    if (twidth)\n        *twidth = 0;\n\n    if (decimals)\n        *decimals = 0;\n\n    ii = 0;\n    while (tform[ii] != 0 && tform[ii] == ' ') /* find first non-blank char */\n         ii++;\n\n    if (strlen(&tform[ii]) > FLEN_VALUE-1)\n    {\n       ffpmsg(\"Error: ASCII table TFORM code is too long (ffasfm)\");\n       return(*status = BAD_TFORM);\n    }\n    strcpy(temp, &tform[ii]); /* copy format string */\n    ffupch(temp);     /* make sure it is in upper case */\n    form = temp;      /* point to start of format string */\n\n\n    if (form[0] == 0)\n    {\n        ffpmsg(\"Error: ASCII table TFORM code is blank\");\n        return(*status = BAD_TFORM);\n    }\n\n    /*-----------------------------------------------*/\n    /*       determine default datatype code         */\n    /*-----------------------------------------------*/\n    if (form[0] == 'A')\n        datacode = TSTRING;\n    else if (form[0] == 'I')\n        datacode = TLONG;\n    else if (form[0] == 'F')\n        datacode = TFLOAT;\n    else if (form[0] == 'E')\n        datacode = TFLOAT;\n    else if (form[0] == 'D')\n        datacode = TDOUBLE;\n    else\n    {\n        snprintf(message, FLEN_ERRMSG,\n                \"Illegal ASCII table TFORMn datatype: \\'%s\\'\", tform);\n        ffpmsg(message);\n        return(*status = BAD_TFORM_DTYPE);\n    }\n\n    if (dtcode)\n       *dtcode = datacode;\n\n    form++;  /* point to the start of field width */\n\n    if (datacode == TSTRING || datacode == TLONG)\n    { \n        /*-----------------------------------------------*/\n        /*              A or I data formats:             */\n        /*-----------------------------------------------*/\n\n        if (ffc2ii(form, &width, status) <= 0)  /* read the width field */\n        {\n            if (width <= 0)\n            {\n                width = 0;\n                *status = BAD_TFORM;\n            }\n            else\n            {                \n                /* set to shorter precision if I4 or less */\n                if (width <= 4 && datacode == TLONG)\n                    datacode = TSHORT;\n            }\n        }\n    }\n    else\n    {  \n        /*-----------------------------------------------*/\n        /*              F, E or D data formats:          */\n        /*-----------------------------------------------*/\n\n        if (ffc2rr(form, &fwidth, status) <= 0) /* read ww.dd width field */\n        {\n           if (fwidth <= 0.)\n            *status = BAD_TFORM;\n          else\n          {\n            width = (long) fwidth;  /* convert from float to long */\n\n            if (width > 7 && *temp == 'F')\n                datacode = TDOUBLE;  /* type double if >7 digits */\n\n            if (width < 10)\n                form = form + 1; /* skip 1 digit  */\n            else\n                form = form + 2; /* skip 2 digits */\n\n            if (form[0] == '.') /* should be a decimal point here */\n            {\n                form++;  /*  point to start of decimals field */\n\n                if (ffc2ii(form, &longval, status) <= 0) /* read decimals */\n                {\n                    if (decimals)\n                        *decimals = longval;  /* long to short convertion */\n\n                    if (longval >= width)  /* width < no. of decimals */\n                        *status = BAD_TFORM; \n\n                    if (longval > 6 && *temp == 'E')\n                        datacode = TDOUBLE;  /* type double if >6 digits */\n                }\n            }\n\n          }\n        }\n    }\n    if (*status > 0)\n    {\n        *status = BAD_TFORM;\n        snprintf(message,FLEN_ERRMSG,\"Illegal ASCII table TFORMn code: \\'%s\\'\", tform);\n        ffpmsg(message);\n    }\n\n    if (dtcode)\n       *dtcode = datacode;\n\n    if (twidth)\n       *twidth = width;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffbnfm(char *tform,     /* I - format code from the TFORMn keyword */\n           int *dtcode,   /* O - numerical datatype code */\n           long *trepeat,    /* O - repeat count of the field  */\n           long *twidth,     /* O - width of the field, in chars */\n           int *status)     /* IO - error status      */\n{\n/*\n  parse the binary table TFORM column format to determine the data\n  type, repeat count, and the field width (if it is an ASCII (A) field)\n*/\n    size_t ii, nchar;\n    int datacode, variable, iread;\n    long width, repeat;\n    char *form, temp[FLEN_VALUE], message[FLEN_ERRMSG];\n\n    if (*status > 0)\n        return(*status);\n\n    if (dtcode)\n        *dtcode = 0;\n\n    if (trepeat)\n        *trepeat = 0;\n\n    if (twidth)\n        *twidth = 0;\n\n    nchar = strlen(tform);\n\n    for (ii = 0; ii < nchar; ii++)\n    {\n        if (tform[ii] != ' ')     /* find first non-space char */\n            break;\n    }\n\n    if (ii == nchar)\n    {\n        ffpmsg(\"Error: binary table TFORM code is blank (ffbnfm).\");\n        return(*status = BAD_TFORM);\n    }\n\n    if (nchar-ii > FLEN_VALUE-1)\n    {\n        ffpmsg(\"Error: binary table TFORM code is too long (ffbnfm).\");\n        return (*status = BAD_TFORM);\n    }\n    strcpy(temp, &tform[ii]); /* copy format string */\n    ffupch(temp);     /* make sure it is in upper case */\n    form = temp;      /* point to start of format string */\n\n    /*-----------------------------------------------*/\n    /*       get the repeat count                    */\n    /*-----------------------------------------------*/\n\n    ii = 0;\n    while(isdigit((int) form[ii]))\n        ii++;   /* look for leading digits in the field */\n\n    if (ii == 0)\n        repeat = 1;  /* no explicit repeat count */\n    else\n    {\n        if (sscanf(form,\"%ld\", &repeat) != 1) /* read repeat count */\n        {\n           ffpmsg(\"Error: Bad repeat format in TFORM (ffbnfm).\");\n           return(*status = BAD_TFORM);\n        }  \n    }\n\n    /*-----------------------------------------------*/\n    /*             determine datatype code           */\n    /*-----------------------------------------------*/\n\n    form = form + ii;  /* skip over the repeat field */\n\n    if (form[0] == 'P' || form[0] == 'Q')\n    {\n        variable = 1;  /* this is a variable length column */\n/*        repeat = 1;  */ /* disregard any other repeat value */\n        form++;        /* move to the next data type code char */\n    }\n    else\n        variable = 0;\n\n    if (form[0] == 'U')  /* internal code to signify unsigned short integer */\n    { \n        datacode = TUSHORT;\n        width = 2;\n    }\n    else if (form[0] == 'I')\n    {\n        datacode = TSHORT;\n        width = 2;\n    }\n    else if (form[0] == 'V') /* internal code to signify unsigned integer */\n    {\n        datacode = TULONG;\n        width = 4;\n    }\n    else if (form[0] == 'W') /* internal code to signify unsigned long long integer */\n    {\n        datacode = TULONGLONG;\n        width = 8;\n    }\n    else if (form[0] == 'J')\n    {\n        datacode = TLONG;\n        width = 4;\n    }\n    else if (form[0] == 'K')\n    {\n        datacode = TLONGLONG;\n        width = 8;\n    }\n    else if (form[0] == 'E')\n    {\n        datacode = TFLOAT;\n        width = 4;\n    }\n    else if (form[0] == 'D')\n    {\n        datacode = TDOUBLE;\n        width = 8;\n    }\n    else if (form[0] == 'A')\n    {\n        datacode = TSTRING;\n\n        /*\n          the following code is used to support the non-standard\n          datatype of the form rAw where r = total width of the field\n          and w = width of fixed-length substrings within the field.\n        */\n        iread = 0;\n        if (form[1] != 0)\n        {\n            if (form[1] == '(' )  /* skip parenthesis around */\n                form++;          /* variable length column width */\n\n            iread = sscanf(&form[1],\"%ld\", &width);\n        }\n\n        if (iread != 1 || (!variable && (width > repeat)) )\n            width = repeat;\n  \n    }\n    else if (form[0] == 'L')\n    {\n        datacode = TLOGICAL;\n        width = 1;\n    }\n    else if (form[0] == 'X')\n    {\n        datacode = TBIT;\n        width = 1;\n    }\n    else if (form[0] == 'B')\n    {\n        datacode = TBYTE;\n        width = 1;\n    }\n    else if (form[0] == 'S') /* internal code to signify signed byte */\n    {\n        datacode = TSBYTE;\n        width = 1;\n    }\n    else if (form[0] == 'C')\n    {\n        datacode = TCOMPLEX;\n        width = 8;\n    }\n    else if (form[0] == 'M')\n    {\n        datacode = TDBLCOMPLEX;\n        width = 16;\n    }\n    else\n    {\n        snprintf(message, FLEN_ERRMSG,\n        \"Illegal binary table TFORMn datatype: \\'%s\\' \", tform);\n        ffpmsg(message);\n        return(*status = BAD_TFORM_DTYPE);\n    }\n\n    if (variable)\n        datacode = datacode * (-1); /* flag variable cols w/ neg type code */\n\n    if (dtcode)\n       *dtcode = datacode;\n\n    if (trepeat)\n       *trepeat = repeat;\n\n    if (twidth)\n       *twidth = width;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffbnfmll(char *tform,     /* I - format code from the TFORMn keyword */\n           int *dtcode,   /* O - numerical datatype code */\n           LONGLONG *trepeat,    /* O - repeat count of the field  */\n           long *twidth,     /* O - width of the field, in chars */\n           int *status)     /* IO - error status      */\n{\n/*\n  parse the binary table TFORM column format to determine the data\n  type, repeat count, and the field width (if it is an ASCII (A) field)\n*/\n    size_t ii, nchar;\n    int datacode, variable, iread;\n    long width;\n    LONGLONG repeat;\n    char *form, temp[FLEN_VALUE], message[FLEN_ERRMSG];\n    double drepeat;\n\n    if (*status > 0)\n        return(*status);\n\n    if (dtcode)\n        *dtcode = 0;\n\n    if (trepeat)\n        *trepeat = 0;\n\n    if (twidth)\n        *twidth = 0;\n\n    nchar = strlen(tform);\n\n    for (ii = 0; ii < nchar; ii++)\n    {\n        if (tform[ii] != ' ')     /* find first non-space char */\n            break;\n    }\n\n    if (ii == nchar)\n    {\n        ffpmsg(\"Error: binary table TFORM code is blank (ffbnfmll).\");\n        return(*status = BAD_TFORM);\n    }\n    \n    if (strlen(&tform[ii]) > FLEN_VALUE-1)\n    {\n       ffpmsg(\"Error: binary table TFORM code is too long (ffbnfmll).\");\n       return(*status = BAD_TFORM);\n    }\n    strcpy(temp, &tform[ii]); /* copy format string */\n    ffupch(temp);     /* make sure it is in upper case */\n    form = temp;      /* point to start of format string */\n\n    /*-----------------------------------------------*/\n    /*       get the repeat count                    */\n    /*-----------------------------------------------*/\n\n    ii = 0;\n    while(isdigit((int) form[ii]))\n        ii++;   /* look for leading digits in the field */\n\n    if (ii == 0)\n        repeat = 1;  /* no explicit repeat count */\n    else {\n       /* read repeat count */\n\n        /* print as double, because the string-to-64-bit int conversion */\n        /* character is platform dependent (%lld, %ld, %I64d)           */\n\n        sscanf(form,\"%lf\", &drepeat);\n        repeat = (LONGLONG) (drepeat + 0.1);\n    }\n    /*-----------------------------------------------*/\n    /*             determine datatype code           */\n    /*-----------------------------------------------*/\n\n    form = form + ii;  /* skip over the repeat field */\n\n    if (form[0] == 'P' || form[0] == 'Q')\n    {\n        variable = 1;  /* this is a variable length column */\n/*        repeat = 1;  */  /* disregard any other repeat value */\n        form++;        /* move to the next data type code char */\n    }\n    else\n        variable = 0;\n\n    if (form[0] == 'U')  /* internal code to signify unsigned integer */\n    { \n        datacode = TUSHORT;\n        width = 2;\n    }\n    else if (form[0] == 'I')\n    {\n        datacode = TSHORT;\n        width = 2;\n    }\n    else if (form[0] == 'V') /* internal code to signify unsigned integer */\n    {\n        datacode = TULONG;\n        width = 4;\n    }\n    else if (form[0] == 'W') /* internal code to signify unsigned long long integer */\n    {\n        datacode = TULONGLONG;\n        width = 8;\n    }\n    else if (form[0] == 'J')\n    {\n        datacode = TLONG;\n        width = 4;\n    }\n    else if (form[0] == 'K')\n    {\n        datacode = TLONGLONG;\n        width = 8;\n    }\n    else if (form[0] == 'E')\n    {\n        datacode = TFLOAT;\n        width = 4;\n    }\n    else if (form[0] == 'D')\n    {\n        datacode = TDOUBLE;\n        width = 8;\n    }\n    else if (form[0] == 'A')\n    {\n        datacode = TSTRING;\n\n        /*\n          the following code is used to support the non-standard\n          datatype of the form rAw where r = total width of the field\n          and w = width of fixed-length substrings within the field.\n        */\n        iread = 0;\n        if (form[1] != 0)\n        {\n            if (form[1] == '(' )  /* skip parenthesis around */\n                form++;          /* variable length column width */\n\n            iread = sscanf(&form[1],\"%ld\", &width);\n        }\n\n        if (iread != 1 || (!variable && (width > repeat)) )\n            width = (long) repeat;\n  \n    }\n    else if (form[0] == 'L')\n    {\n        datacode = TLOGICAL;\n        width = 1;\n    }\n    else if (form[0] == 'X')\n    {\n        datacode = TBIT;\n        width = 1;\n    }\n    else if (form[0] == 'B')\n    {\n        datacode = TBYTE;\n        width = 1;\n    }\n    else if (form[0] == 'S') /* internal code to signify signed byte */\n    {\n        datacode = TSBYTE;\n        width = 1;\n    }\n    else if (form[0] == 'C')\n    {\n        datacode = TCOMPLEX;\n        width = 8;\n    }\n    else if (form[0] == 'M')\n    {\n        datacode = TDBLCOMPLEX;\n        width = 16;\n    }\n    else\n    {\n        snprintf(message, FLEN_ERRMSG,\n        \"Illegal binary table TFORMn datatype: \\'%s\\' \", tform);\n        ffpmsg(message);\n        return(*status = BAD_TFORM_DTYPE);\n    }\n\n    if (variable)\n        datacode = datacode * (-1); /* flag variable cols w/ neg type code */\n\n    if (dtcode)\n       *dtcode = datacode;\n\n    if (trepeat)\n       *trepeat = repeat;\n\n    if (twidth)\n       *twidth = width;\n\n    return(*status);\n}\n\n/*--------------------------------------------------------------------------*/\nvoid ffcfmt(char *tform,    /* value of an ASCII table TFORMn keyword */\n            char *cform)    /* equivalent format code in C language syntax */\n/*\n  convert the FITS format string for an ASCII Table extension column into the\n  equivalent C format string that can be used in a printf statement, after\n  the values have been read as a double.\n*/\n{\n    int ii;\n\n    cform[0] = '\\0';\n    ii = 0;\n    while (tform[ii] != 0 && tform[ii] == ' ') /* find first non-blank char */\n         ii++;\n\n    if (tform[ii] == 0)\n        return;    /* input format string was blank */\n\n    cform[0] = '%';  /* start the format string */\n\n    strcpy(&cform[1], &tform[ii + 1]); /* append the width and decimal code */\n\n\n    if (tform[ii] == 'A')\n        strcat(cform, \"s\");\n    else if (tform[ii] == 'I')\n        strcat(cform, \".0f\");  /*  0 precision to suppress decimal point */\n    if (tform[ii] == 'F')\n        strcat(cform, \"f\");\n    if (tform[ii] == 'E')\n        strcat(cform, \"E\");\n    if (tform[ii] == 'D')\n        strcat(cform, \"E\");\n\n    return;\n}\n/*--------------------------------------------------------------------------*/\nvoid ffcdsp(char *tform,    /* value of an ASCII table TFORMn keyword */\n            char *cform)    /* equivalent format code in C language syntax */\n/*\n  convert the FITS TDISPn display format into the equivalent C format\n  suitable for use in a printf statement.\n*/\n{\n    int ii;\n\n    cform[0] = '\\0';\n    ii = 0;\n    while (tform[ii] != 0 && tform[ii] == ' ') /* find first non-blank char */\n         ii++;\n\n    if (tform[ii] == 0)\n    {\n        cform[0] = '\\0';\n        return;    /* input format string was blank */\n    }\n\n    if (strchr(tform+ii, '%'))  /* is there a % character in the string?? */\n    {\n        cform[0] = '\\0';\n        return;    /* illegal TFORM string (possibly even harmful) */\n    }\n\n    cform[0] = '%';  /* start the format string */\n\n    strcpy(&cform[1], &tform[ii + 1]); /* append the width and decimal code */\n\n    if      (tform[ii] == 'A' || tform[ii] == 'a')\n        strcat(cform, \"s\");\n    else if (tform[ii] == 'I' || tform[ii] == 'i')\n        strcat(cform, \"d\");\n    else if (tform[ii] == 'O' || tform[ii] == 'o')\n        strcat(cform, \"o\");\n    else if (tform[ii] == 'Z' || tform[ii] == 'z')\n        strcat(cform, \"X\");\n    else if (tform[ii] == 'F' || tform[ii] == 'f')\n        strcat(cform, \"f\");\n    else if (tform[ii] == 'E' || tform[ii] == 'e')\n        strcat(cform, \"E\");\n    else if (tform[ii] == 'D' || tform[ii] == 'd')\n        strcat(cform, \"E\");\n    else if (tform[ii] == 'G' || tform[ii] == 'g')\n        strcat(cform, \"G\");\n    else\n        cform[0] = '\\0';  /* unrecognized tform code */\n\n    return;\n}\n/*--------------------------------------------------------------------------*/\nint ffgcno( fitsfile *fptr,  /* I - FITS file pionter                       */\n            int  casesen,    /* I - case sensitive string comparison? 0=no  */\n            char *templt,    /* I - input name of column (w/wildcards)      */\n            int  *colnum,    /* O - number of the named column; 1=first col */\n            int  *status)    /* IO - error status                           */\n/*\n  Determine the column number corresponding to an input column name.\n  The first column of the table = column 1;  \n  This supports the * and ? wild cards in the input template.\n*/\n{\n    char colname[FLEN_VALUE];  /*  temporary string to hold column name  */\n\n    ffgcnn(fptr, casesen, templt, colname, colnum, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcnn( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  casesen,    /* I - case sensitive string comparison? 0=no  */\n            char *templt,    /* I - input name of column (w/wildcards)      */\n            char *colname,   /* O - full column name up to 68 + 1 chars long*/\n            int  *colnum,    /* O - number of the named column; 1=first col */\n            int  *status)    /* IO - error status                           */\n/*\n  Return the full column name and column number of the next column whose\n  TTYPEn keyword value matches the input template string.\n  The template may contain the * and ? wildcards.  Status = 237 is\n  returned if the match is not unique.  If so, one may call this routine\n  again with input status=237  to get the next match.  A status value of\n  219 is returned when there are no more matching columns.\n*/\n{\n    char errmsg[FLEN_ERRMSG];\n    int tstatus, ii, founde, foundw, match, exact, unique;\n    long ivalue;\n    tcolumn *colptr;\n\n    if (*status <= 0)\n    {\n        (fptr->Fptr)->startcol = 0;   /* start search with first column */\n        tstatus = 0;\n    }\n    else if (*status == COL_NOT_UNIQUE) /* start search from previous spot */\n    {\n        tstatus = COL_NOT_UNIQUE;\n        *status = 0;\n    }\n    else\n        return(*status);  /* bad input status value */\n\n    colname[0] = 0;    /* initialize null return */\n    *colnum = 0;\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)   /* rescan header to get col struct */\n            return(*status);\n\n    colptr = (fptr->Fptr)->tableptr;   /* pointer to first column */\n    colptr += ((fptr->Fptr)->startcol);      /* offset to starting column */\n\n    founde = FALSE;   /* initialize 'found exact match' flag */\n    foundw = FALSE;   /* initialize 'found wildcard match' flag */\n    unique = FALSE;\n\n    for (ii = (fptr->Fptr)->startcol; ii < (fptr->Fptr)->tfield; ii++, colptr++)\n    {\n        ffcmps(templt, colptr->ttype, casesen, &match, &exact);\n        if (match)\n        {\n            if (founde && exact)\n            {\n                /* warning: this is the second exact match we've found     */\n                /*reset pointer to first match so next search starts there */\n               (fptr->Fptr)->startcol = *colnum;\n               return(*status = COL_NOT_UNIQUE);\n            }\n            else if (founde)   /* a wildcard match */\n            {\n                /* already found exact match so ignore this non-exact match */\n            }\n            else if (exact)\n            {\n                /* this is the first exact match we have found, so save it. */\n                strcpy(colname, colptr->ttype);\n                *colnum = ii + 1;\n                founde = TRUE;\n            }\n            else if (foundw)\n            {\n                /* we have already found a wild card match, so not unique */\n                /* continue searching for other matches                   */\n                unique = FALSE;\n            }\n            else\n            {\n               /* this is the first wild card match we've found. save it */\n               strcpy(colname, colptr->ttype);\n               *colnum = ii + 1;\n               (fptr->Fptr)->startcol = *colnum;\n               foundw = TRUE;\n               unique = TRUE;\n            }\n        }\n    }\n\n    /* OK, we've checked all the names now see if we got any matches */\n    if (founde)\n    {\n        if (tstatus == COL_NOT_UNIQUE)  /* we did find 1 exact match but */\n            *status = COL_NOT_UNIQUE;   /* there was a previous match too */\n    }\n    else if (foundw)\n    {\n        /* found one or more wildcard matches; report error if not unique */\n       if (!unique || tstatus == COL_NOT_UNIQUE)\n           *status = COL_NOT_UNIQUE;\n    }\n    else\n    {\n        /* didn't find a match; check if template is a positive integer */\n        ffc2ii(templt, &ivalue, &tstatus);\n        if (tstatus ==  0 && ivalue <= (fptr->Fptr)->tfield && ivalue > 0)\n        {\n            *colnum = ivalue;\n\n            colptr = (fptr->Fptr)->tableptr;   /* pointer to first column */\n            colptr += (ivalue - 1);    /* offset to correct column */\n            strcpy(colname, colptr->ttype);\n        }\n        else\n        {\n            *status = COL_NOT_FOUND;\n            if (tstatus != COL_NOT_UNIQUE)\n            {\n              snprintf(errmsg, FLEN_ERRMSG, \"ffgcnn could not find column: %.45s\", templt);\n              ffpmsg(errmsg);\n            }\n        }\n    }\n    \n    (fptr->Fptr)->startcol = *colnum;  /* save pointer for next time */\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nvoid ffcmps(char *templt,   /* I - input template (may have wildcards)      */\n            char *colname,  /* I - full column name up to 68 + 1 chars long */\n            int  casesen,   /* I - case sensitive string comparison? 1=yes  */\n            int  *match,    /* O - do template and colname match? 1=yes     */\n            int  *exact)    /* O - do strings exactly match, or wildcards   */\n/*\n  compare the template to the string and test if they match.\n  The strings are limited to 68 characters or less (the max. length\n  of a FITS string keyword value.  This routine reports whether\n  the two strings match and whether the match is exact or\n  involves wildcards.\n\n  This algorithm is very similar to the way unix filename wildcards\n  work except that this first treats a wild card as a literal character\n  when looking for a match.  If there is no literal match, then\n  it interpretes it as a wild card.  So the template 'AB*DE'\n  is considered to be an exact rather than a wild card match to\n  the string 'AB*DE'.  The '#' wild card in the template string will \n  match any consecutive string of decimal digits in the colname.\n  \n*/\n{\n    int ii, found, t1, s1, wildsearch = 0, tsave = 0, ssave = 0;\n    char temp[FLEN_VALUE], col[FLEN_VALUE];\n\n    *match = FALSE;\n    *exact = TRUE;\n\n    strncpy(temp, templt, FLEN_VALUE); /* copy strings to work area */\n    strncpy(col, colname, FLEN_VALUE);\n    temp[FLEN_VALUE - 1] = '\\0';  /* make sure strings are terminated */\n    col[FLEN_VALUE - 1]  = '\\0';\n\n    /* truncate trailing non-significant blanks */\n    for (ii = strlen(temp) - 1; ii >= 0 && temp[ii] == ' '; ii--)\n        temp[ii] = '\\0';\n\n    for (ii = strlen(col) - 1; ii >= 0 && col[ii] == ' '; ii--)\n        col[ii] = '\\0';\n       \n    if (!casesen)\n    {             /* convert both strings to uppercase before comparison */\n        ffupch(temp);\n        ffupch(col);\n    }\n\n    if (!FSTRCMP(temp, col) )\n    {\n        *match = TRUE;     /* strings exactly match */\n        return;\n    }\n\n    *exact = FALSE;    /* strings don't exactly match */\n\n    t1 = 0;   /* start comparison with 1st char of each string */\n    s1 = 0;\n\n    while(1)  /* compare corresponding chars in each string */\n    {\n      if (temp[t1] == '\\0' && col[s1] == '\\0')\n      { \n         /* completely scanned both strings so they match */\n         *match = TRUE;\n         return;\n      }\n      else if (temp[t1] == '\\0')\n      { \n        if (wildsearch)\n        {\n            /* \n               the previous wildcard search may have been going down\n               a blind alley.  Backtrack, and resume the wildcard\n               search with the next character in the string.\n            */\n            t1 = tsave;\n            s1 = ssave + 1;\n        }\n        else\n        {\n            /* reached end of template string so they don't match */\n            return;\n        }\n      }\n      else if (col[s1] == '\\0')\n      { \n         /* reached end of other string; they match if the next */\n         /* character in the template string is a '*' wild card */\n\n        if (temp[t1] == '*' && temp[t1 + 1] == '\\0')\n        {\n           *match = TRUE;\n        }\n\n        return;\n      }\n\n      if (temp[t1] == col[s1] || (temp[t1] == '?') )\n      {\n        s1++;  /* corresponding chars in the 2 strings match */\n        t1++;  /* increment both pointers and loop back again */\n      }\n      else if (temp[t1] == '#' && isdigit((int) col[s1]) )\n      {\n        s1++;  /* corresponding chars in the 2 strings match */\n        t1++;  /* increment both pointers */\n\n        /* find the end of the string of digits */\n        while (isdigit((int) col[s1]) ) \n            s1++;        \n      }\n      else if (temp[t1] == '*')\n      {\n\n        /* save current string locations, in case we need to restart */\n        wildsearch = 1;\n        tsave = t1;\n        ssave = s1;\n\n        /* get next char from template and look for it in the col name */\n        t1++;\n        if (temp[t1] == '\\0' || temp[t1] == ' ')\n        {\n          /* reached end of template so strings match */\n          *match = TRUE;\n          return;\n        }\n\n        found = FALSE;\n        while (col[s1] && !found)\n        {\n          if (temp[t1] == col[s1])\n          {\n            t1++;  /* found matching characters; incre both pointers */\n            s1++;  /* and loop back to compare next chars */\n            found = TRUE;\n          }\n          else\n            s1++;  /* increment the column name pointer and try again */\n        }\n\n        if (!found)\n        {\n          return;  /* hit end of column name and failed to find a match */\n        }\n      }\n      else\n      {\n        if (wildsearch)\n        {\n            /* \n               the previous wildcard search may have been going down\n               a blind alley.  Backtrack, and resume the wildcard\n               search with the next character in the string.\n            */\n            t1 = tsave;\n            s1 = ssave + 1;\n        }\n        else\n        {\n          return;   /* strings don't match */\n        }\n      }\n    }\n}\n/*--------------------------------------------------------------------------*/\nint ffgtcl( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - column number                           */\n            int *typecode,   /* O - datatype code (21 = short, etc)         */\n            long *repeat,    /* O - repeat count of field                   */\n            long *width,     /* O - if ASCII, width of field or unit string */\n            int  *status)    /* IO - error status                           */\n/*\n  Get Type of table column. \n  Returns the datatype code of the column, as well as the vector\n  repeat count and (if it is an ASCII character column) the\n  width of the field or a unit string within the field.  This supports the\n  TFORMn = 'rAw' syntax for specifying arrays of substrings, so\n  if TFORMn = '60A12' then repeat = 60 and width = 12.\n*/\n{\n    LONGLONG trepeat, twidth;\n    \n    ffgtclll(fptr, colnum, typecode, &trepeat, &twidth, status);\n\n    if (*status > 0)\n        return(*status);\n\t\n    if (repeat)\n        *repeat= (long) trepeat;\n      \n    if (width)\n        *width = (long) twidth;\n    \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgtclll( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,       /* I - column number                           */\n            int *typecode,   /* O - datatype code (21 = short, etc)         */\n            LONGLONG *repeat, /* O - repeat count of field                   */\n            LONGLONG *width, /* O - if ASCII, width of field or unit string */\n            int  *status)    /* IO - error status                           */\n/*\n  Get Type of table column. \n  Returns the datatype code of the column, as well as the vector\n  repeat count and (if it is an ASCII character column) the\n  width of the field or a unit string within the field.  This supports the\n  TFORMn = 'rAw' syntax for specifying arrays of substrings, so\n  if TFORMn = '60A12' then repeat = 60 and width = 12.\n*/\n{\n    tcolumn *colptr;\n    int hdutype, decims;\n    long tmpwidth;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    if (colnum < 1 || colnum > (fptr->Fptr)->tfield)\n        return(*status = BAD_COL_NUM);\n\n    colptr = (fptr->Fptr)->tableptr;   /* pointer to first column */\n    colptr += (colnum - 1);    /* offset to correct column */\n\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == ASCII_TBL)\n    {\n       ffasfm(colptr->tform, typecode, &tmpwidth, &decims, status);\n       *width = tmpwidth;\n       \n      if (repeat)\n           *repeat = 1;\n    }\n    else\n    {\n      if (typecode)\n          *typecode = colptr->tdatatype;\n\n      if (width)\n          *width = colptr->twidth;\n\n      if (repeat)\n          *repeat = colptr->trepeat;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffeqty( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - column number                           */\n            int *typecode,   /* O - datatype code (21 = short, etc)         */\n            long *repeat,    /* O - repeat count of field                   */\n            long *width,     /* O - if ASCII, width of field or unit string */\n            int  *status)    /* IO - error status                           */\n/*\n  Get the 'equivalent' table column type. \n\n  This routine is similar to the ffgtcl routine (which returns the physical\n  datatype of the column, as stored in the FITS file) except that if the\n  TSCALn and TZEROn keywords are defined for the column, then it returns\n  the 'equivalent' datatype.  Thus, if the column is defined as '1I'  (short\n  integer) this routine may return the type as 'TUSHORT' or as 'TFLOAT'\n  depending on the TSCALn and TZEROn values.\n  \n  Returns the datatype code of the column, as well as the vector\n  repeat count and (if it is an ASCII character column) the\n  width of the field or a unit string within the field.  This supports the\n  TFORMn = 'rAw' syntax for specifying arrays of substrings, so\n  if TFORMn = '60A12' then repeat = 60 and width = 12.\n*/\n{\n    LONGLONG trepeat, twidth;\n    \n    ffeqtyll(fptr, colnum, typecode, &trepeat, &twidth, status);\n\n    if (repeat)\n        *repeat= (long) trepeat;\n\n    if (width)\n        *width = (long) twidth;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffeqtyll( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - column number                           */\n            int *typecode,   /* O - datatype code (21 = short, etc)         */\n            LONGLONG *repeat,    /* O - repeat count of field                   */\n            LONGLONG *width,     /* O - if ASCII, width of field or unit string */\n            int  *status)    /* IO - error status                           */\n/*\n  Get the 'equivalent' table column type. \n\n  This routine is similar to the ffgtcl routine (which returns the physical\n  datatype of the column, as stored in the FITS file) except that if the\n  TSCALn and TZEROn keywords are defined for the column, then it returns\n  the 'equivalent' datatype.  Thus, if the column is defined as '1I'  (short\n  integer) this routine may return the type as 'TUSHORT' or as 'TFLOAT'\n  depending on the TSCALn and TZEROn values.\n  \n  Returns the datatype code of the column, as well as the vector\n  repeat count and (if it is an ASCII character column) the\n  width of the field or a unit string within the field.  This supports the\n  TFORMn = 'rAw' syntax for specifying arrays of substrings, so\n  if TFORMn = '60A12' then repeat = 60 and width = 12.\n*/\n{\n    tcolumn *colptr;\n    int hdutype, decims, tcode, effcode;\n    double tscale, tzero, min_val, max_val;\n    long lngscale, lngzero = 0, tmpwidth;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    if (colnum < 1 || colnum > (fptr->Fptr)->tfield)\n        return(*status = BAD_COL_NUM);\n\n    colptr = (fptr->Fptr)->tableptr;   /* pointer to first column */\n    colptr += (colnum - 1);    /* offset to correct column */\n\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == ASCII_TBL)\n    {\n      ffasfm(colptr->tform, typecode, &tmpwidth, &decims, status);\n      if (width)\n          *width = tmpwidth;\n\n      if (repeat)\n           *repeat = 1;\n    }\n    else\n    {\n      if (typecode)\n          *typecode = colptr->tdatatype;\n\n      if (width)\n          *width = colptr->twidth;\n\n      if (repeat)\n          *repeat = colptr->trepeat;\n    }\n\n    /* return if caller is not interested in the typecode value */\n    if (!typecode)\n        return(*status);\n\n    /* check if the tscale and tzero keywords are defined, which might\n       change the effective datatype of the column  */\n\n    tscale = colptr->tscale;\n    tzero = colptr->tzero;\n\n    if (tscale == 1.0 && tzero == 0.0)  /* no scaling */\n        return(*status);\n \n    tcode = abs(*typecode);\n\n    switch (tcode)\n    {\n      case TBYTE:   /* binary table 'rB' column */\n        min_val = 0.;\n        max_val = 255.0;\n        break;\n\n      case TSHORT:\n        min_val = -32768.0;\n        max_val =  32767.0;\n        break;\n        \n      case TLONG:\n\n        min_val = -2147483648.0;\n        max_val =  2147483647.0;\n        break;\n        \n      case TLONGLONG:\n        min_val = -9.2233720368547755808E18;\n        max_val =  9.2233720368547755807E18;\n        break;\n\t\n      default:  /* don't have to deal with other data types */\n        return(*status);\n    }\n\n    if (tscale >= 0.) {\n        min_val = tzero + tscale * min_val;\n        max_val = tzero + tscale * max_val;\n    } else {\n        max_val = tzero + tscale * min_val;\n        min_val = tzero + tscale * max_val;\n    }\n    if (tzero < 2147483648.)  /* don't exceed range of 32-bit integer */\n       lngzero = (long) tzero;\n    lngscale   = (long) tscale;\n\n    if ((tzero != 2147483648.) && /* special value that exceeds integer range */\n        (tzero != 9223372036854775808.) &&  /* indicates unsigned long long */\n       (lngzero != tzero || lngscale != tscale)) { /* not integers? */\n       /* floating point scaled values; just decide on required precision */\n       if (tcode == TBYTE || tcode == TSHORT)\n          effcode = TFLOAT;\n       else\n          effcode = TDOUBLE;\n\n    /*\n       In all the remaining cases, TSCALn and TZEROn are integers,\n       and not equal to 1 and 0, respectively.  \n    */\n\n    } else if ((min_val == -128.) && (max_val == 127.)) {\n        effcode = TSBYTE;\n \n    } else if ((min_val >= -32768.0) && (max_val <= 32767.0)) {\n        effcode = TSHORT;\n\n    } else if ((min_val >= 0.0) && (max_val <= 65535.0)) {\n        effcode = TUSHORT;\n\n    } else if ((min_val >= -2147483648.0) && (max_val <= 2147483647.0)) {\n        effcode = TLONG;\n\n    } else if ((min_val >= 0.0) && (max_val < 4294967296.0)) {\n        effcode = TULONG;\n\n    } else if ((min_val >= -9.2233720368547755808E18) && (max_val <= 9.2233720368547755807E18)) {\n        effcode = TLONGLONG;\n\n    } else if ((min_val >= 0.0) && (max_val <= 1.8446744073709551616E19)) {\n        effcode = TULONGLONG;\n\n    } else {  /* exceeds the range of a 64-bit integer */\n        effcode = TDOUBLE;\n    }   \n\n    /* return the effective datatype code (negative if variable length col.) */\n    if (*typecode < 0)  /* variable length array column */\n        *typecode = -effcode;\n    else\n        *typecode = effcode;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgncl( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  *ncols,     /* O - number of columns in the table          */\n            int  *status)    /* IO - error status                           */\n/*\n  Get the number of columns in the table (= TFIELDS keyword)\n*/\n{\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    if ((fptr->Fptr)->hdutype == IMAGE_HDU)\n        return(*status = NOT_TABLE);\n\n    *ncols = (fptr->Fptr)->tfield;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgnrw( fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  *nrows,    /* O - number of rows in the table             */\n            int  *status)    /* IO - error status                           */\n/*\n  Get the number of rows in the table (= NAXIS2 keyword)\n*/\n{\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    if ((fptr->Fptr)->hdutype == IMAGE_HDU)\n        return(*status = NOT_TABLE);\n\n    /* the NAXIS2 keyword may not be up to date, so use the structure value */\n    *nrows = (long) (fptr->Fptr)->numrows;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgnrwll( fitsfile *fptr,  /* I - FITS file pointer                     */\n            LONGLONG  *nrows,  /* O - number of rows in the table           */\n            int  *status)      /* IO - error status                         */\n/*\n  Get the number of rows in the table (= NAXIS2 keyword)\n*/\n{\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    if ((fptr->Fptr)->hdutype == IMAGE_HDU)\n        return(*status = NOT_TABLE);\n\n    /* the NAXIS2 keyword may not be up to date, so use the structure value */\n    *nrows = (fptr->Fptr)->numrows;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgacl( fitsfile *fptr,   /* I - FITS file pointer                      */\n            int  colnum,      /* I - column number                          */\n            char *ttype,      /* O - TTYPEn keyword value                   */\n            long *tbcol,      /* O - TBCOLn keyword value                   */\n            char *tunit,      /* O - TUNITn keyword value                   */\n            char *tform,      /* O - TFORMn keyword value                   */\n            double *tscal,    /* O - TSCALn keyword value                   */\n            double *tzero,    /* O - TZEROn keyword value                   */\n            char *tnull,      /* O - TNULLn keyword value                   */\n            char *tdisp,      /* O - TDISPn keyword value                   */\n            int  *status)     /* IO - error status                          */\n/*\n  get ASCII column keyword values\n*/\n{\n    char name[FLEN_KEYWORD], comm[FLEN_COMMENT];\n    tcolumn *colptr;\n    int tstatus;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    if (colnum < 1 || colnum > (fptr->Fptr)->tfield)\n        return(*status = BAD_COL_NUM);\n\n    /* get what we can from the column structure */\n\n    colptr = (fptr->Fptr)->tableptr;   /* pointer to first column */\n    colptr += (colnum -1);     /* offset to correct column */\n\n    if (ttype)\n        strcpy(ttype, colptr->ttype);\n\n    if (tbcol)\n        *tbcol = (long) ((colptr->tbcol) + 1);  /* first col is 1, not 0 */\n\n    if (tform)\n        strcpy(tform, colptr->tform);\n\n    if (tscal)\n        *tscal = colptr->tscale;\n\n    if (tzero)\n        *tzero = colptr->tzero;\n\n    if (tnull)\n        strcpy(tnull, colptr->strnull);\n\n    /* read keywords to get additional parameters */\n\n    if (tunit)\n    {\n        ffkeyn(\"TUNIT\", colnum, name, status);\n        tstatus = 0;\n        *tunit = '\\0';\n        ffgkys(fptr, name, tunit, comm, &tstatus);\n    }\n\n    if (tdisp)\n    {\n        ffkeyn(\"TDISP\", colnum, name, status);\n        tstatus = 0;\n        *tdisp = '\\0';\n        ffgkys(fptr, name, tdisp, comm, &tstatus);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgbcl( fitsfile *fptr,   /* I - FITS file pointer                      */\n            int  colnum,      /* I - column number                          */\n            char *ttype,      /* O - TTYPEn keyword value                   */\n            char *tunit,      /* O - TUNITn keyword value                   */\n            char *dtype,      /* O - datatype char: I, J, E, D, etc.        */\n            long *repeat,     /* O - vector column repeat count             */\n            double *tscal,    /* O - TSCALn keyword value                   */\n            double *tzero,    /* O - TZEROn keyword value                   */\n            long *tnull,      /* O - TNULLn keyword value integer cols only */\n            char *tdisp,      /* O - TDISPn keyword value                   */\n            int  *status)     /* IO - error status                          */\n/*\n  get BINTABLE column keyword values\n*/\n{\n    LONGLONG trepeat, ttnull;\n    \n    if (*status > 0)\n        return(*status);\n\n    ffgbclll(fptr, colnum, ttype, tunit, dtype, &trepeat, tscal, tzero,\n             &ttnull, tdisp, status);\n\n    if (repeat)\n        *repeat = (long) trepeat;\n\n    if (tnull)\n        *tnull = (long) ttnull;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgbclll( fitsfile *fptr,   /* I - FITS file pointer                      */\n            int  colnum,      /* I - column number                          */\n            char *ttype,      /* O - TTYPEn keyword value                   */\n            char *tunit,      /* O - TUNITn keyword value                   */\n            char *dtype,      /* O - datatype char: I, J, E, D, etc.        */\n            LONGLONG *repeat, /* O - vector column repeat count             */\n            double *tscal,    /* O - TSCALn keyword value                   */\n            double *tzero,    /* O - TZEROn keyword value                   */\n            LONGLONG *tnull,  /* O - TNULLn keyword value integer cols only */\n            char *tdisp,      /* O - TDISPn keyword value                   */\n            int  *status)     /* IO - error status                          */\n/*\n  get BINTABLE column keyword values\n*/\n{\n    char name[FLEN_KEYWORD], comm[FLEN_COMMENT];\n    tcolumn *colptr;\n    int tstatus;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    if (colnum < 1 || colnum > (fptr->Fptr)->tfield)\n        return(*status = BAD_COL_NUM);\n\n    /* get what we can from the column structure */\n\n    colptr = (fptr->Fptr)->tableptr;   /* pointer to first column */\n    colptr += (colnum -1);     /* offset to correct column */\n\n    if (ttype)\n        strcpy(ttype, colptr->ttype);\n\n    if (dtype)\n    {\n        if (colptr->tdatatype < 0)  /* add the \"P\" prefix for */\n            strcpy(dtype, \"P\");     /* variable length columns */\n        else\n            dtype[0] = 0;\n\n        if      (abs(colptr->tdatatype) == TBIT)\n            strcat(dtype, \"X\");\n        else if (abs(colptr->tdatatype) == TBYTE)\n            strcat(dtype, \"B\");\n        else if (abs(colptr->tdatatype) == TLOGICAL)\n            strcat(dtype, \"L\");\n        else if (abs(colptr->tdatatype) == TSTRING)\n            strcat(dtype, \"A\");\n        else if (abs(colptr->tdatatype) == TSHORT)\n            strcat(dtype, \"I\");\n        else if (abs(colptr->tdatatype) == TLONG)\n            strcat(dtype, \"J\");\n        else if (abs(colptr->tdatatype) == TLONGLONG)\n            strcat(dtype, \"K\");\n        else if (abs(colptr->tdatatype) == TFLOAT)\n            strcat(dtype, \"E\");\n        else if (abs(colptr->tdatatype) == TDOUBLE)\n            strcat(dtype, \"D\");\n        else if (abs(colptr->tdatatype) == TCOMPLEX)\n            strcat(dtype, \"C\");\n        else if (abs(colptr->tdatatype) == TDBLCOMPLEX)\n            strcat(dtype, \"M\");\n    }\n\n    if (repeat)\n        *repeat = colptr->trepeat;\n\n    if (tscal)\n        *tscal  = colptr->tscale;\n\n    if (tzero)\n        *tzero  = colptr->tzero;\n\n    if (tnull)\n        *tnull  = colptr->tnull;\n\n    /* read keywords to get additional parameters */\n\n    if (tunit)\n    {\n        ffkeyn(\"TUNIT\", colnum, name, status);\n        tstatus = 0;\n        *tunit = '\\0';\n        ffgkys(fptr, name, tunit, comm, &tstatus);\n    }\n\n    if (tdisp)\n    {\n        ffkeyn(\"TDISP\", colnum, name, status);\n        tstatus = 0;\n        *tdisp = '\\0';\n        ffgkys(fptr, name, tdisp, comm, &tstatus);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffghdn(fitsfile *fptr,   /* I - FITS file pointer                      */\n            int *chdunum)    /* O - number of the CHDU; 1 = primary array  */\n/*\n  Return the number of the Current HDU in the FITS file.  The primary array\n  is HDU number 1.  Note that this is one of the few cfitsio routines that\n  does not return the error status value as the value of the function.\n*/\n{\n    *chdunum = (fptr->HDUposition) + 1;\n    return(*chdunum);\n}\n/*--------------------------------------------------------------------------*/\nint ffghadll(fitsfile *fptr,     /* I - FITS file pointer                     */\n            LONGLONG *headstart, /* O - byte offset to beginning of CHDU      */\n            LONGLONG *datastart, /* O - byte offset to beginning of next HDU  */\n            LONGLONG *dataend,   /* O - byte offset to beginning of next HDU  */\n            int *status)         /* IO - error status     */\n/*\n  Return the address (= byte offset) in the FITS file to the beginning of\n  the current HDU, the beginning of the data unit, and the end of the data unit.\n*/\n{\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        if (ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status) > 0)\n            return(*status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        if (ffrdef(fptr, status) > 0)           /* rescan header */\n            return(*status);\n    }\n\n    if (headstart)\n        *headstart = (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu];       \n\n    if (datastart)\n        *datastart = (fptr->Fptr)->datastart;\n\n    if (dataend)\n        *dataend = (fptr->Fptr)->headstart[((fptr->Fptr)->curhdu) + 1];       \n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffghof(fitsfile *fptr,     /* I - FITS file pointer                     */\n            OFF_T *headstart,  /* O - byte offset to beginning of CHDU      */\n            OFF_T *datastart,  /* O - byte offset to beginning of next HDU  */\n            OFF_T *dataend,    /* O - byte offset to beginning of next HDU  */\n            int *status)       /* IO - error status     */\n/*\n  Return the address (= byte offset) in the FITS file to the beginning of\n  the current HDU, the beginning of the data unit, and the end of the data unit.\n*/\n{\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        if (ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status) > 0)\n            return(*status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        if (ffrdef(fptr, status) > 0)           /* rescan header */\n            return(*status);\n    }\n\n    if (headstart)\n        *headstart = (OFF_T) (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu];       \n\n    if (datastart)\n        *datastart = (OFF_T) (fptr->Fptr)->datastart;\n\n    if (dataend)\n        *dataend   = (OFF_T) (fptr->Fptr)->headstart[((fptr->Fptr)->curhdu) + 1];       \n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffghad(fitsfile *fptr,     /* I - FITS file pointer                     */\n            long *headstart,  /* O - byte offset to beginning of CHDU      */\n            long *datastart,  /* O - byte offset to beginning of next HDU  */\n            long *dataend,    /* O - byte offset to beginning of next HDU  */\n            int *status)       /* IO - error status     */\n/*\n  Return the address (= byte offset) in the FITS file to the beginning of\n  the current HDU, the beginning of the data unit, and the end of the data unit.\n*/\n{\n    LONGLONG shead, sdata, edata;\n\n    if (*status > 0)\n        return(*status);\n\n    ffghadll(fptr, &shead, &sdata, &edata, status);\n\n    if (headstart)\n    {\n        if (shead > LONG_MAX)\n            *status = NUM_OVERFLOW;\n        else\n            *headstart = (long) shead;\n    }\n\n    if (datastart)\n    {\n        if (sdata > LONG_MAX)\n            *status = NUM_OVERFLOW;\n        else\n            *datastart = (long) sdata;\n    }\n\n    if (dataend)\n    {\n        if (edata > LONG_MAX)\n            *status = NUM_OVERFLOW;\n        else\n            *dataend = (long) edata;       \n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffrhdu(fitsfile *fptr,    /* I - FITS file pointer */\n           int *hdutype,      /* O - type of HDU       */\n           int *status)       /* IO - error status     */\n/*\n  read the required keywords of the CHDU and initialize the corresponding\n  structure elements that describe the format of the HDU\n*/\n{\n    int ii, tstatus;\n    char card[FLEN_CARD];\n    char name[FLEN_KEYWORD], value[FLEN_VALUE], comm[FLEN_COMMENT];\n    char xname[FLEN_VALUE], *xtension, urltype[20];\n\n    if (*status > 0)\n        return(*status);\n\n    if (ffgrec(fptr, 1, card, status) > 0 )  /* get the 80-byte card */\n    {\n        ffpmsg(\"Cannot read first keyword in header (ffrhdu).\");\n        return(*status);\n    }\n    strncpy(name,card,8);  /* first 8 characters = the keyword name */\n    name[8] = '\\0';\n\n    for (ii=7; ii >= 0; ii--)  /* replace trailing blanks with nulls */\n    {\n        if (name[ii] == ' ')\n            name[ii] = '\\0';\n        else\n            break;\n    }\n\n    if (ffpsvc(card, value, comm, status) > 0)   /* parse value and comment */\n    {\n        ffpmsg(\"Cannot read value of first  keyword in header (ffrhdu):\");\n        ffpmsg(card);\n        return(*status);\n    }\n\n    if (!strcmp(name, \"SIMPLE\"))        /* this is the primary array */\n    {\n\n       ffpinit(fptr, status);           /* initialize the primary array */\n\n       if (hdutype != NULL)\n           *hdutype = 0;\n    }\n\n    else if (!strcmp(name, \"XTENSION\"))   /* this is an XTENSION keyword */\n    {\n        if (ffc2s(value, xname, status) > 0)  /* get the value string */\n        {\n            ffpmsg(\"Bad value string for XTENSION keyword:\");\n            ffpmsg(value);\n            return(*status);\n        }\n\n        xtension = xname;\n        while (*xtension == ' ')  /* ignore any leading spaces in name */\n           xtension++;\n\n        if (!strcmp(xtension, \"TABLE\"))\n        {\n            ffainit(fptr, status);       /* initialize the ASCII table */\n            if (hdutype != NULL)\n                *hdutype = 1;\n        }\n\n        else if (!strcmp(xtension, \"BINTABLE\") ||\n                 !strcmp(xtension, \"A3DTABLE\") ||\n                 !strcmp(xtension, \"3DTABLE\") )\n        {\n            ffbinit(fptr, status);       /* initialize the binary table */\n            if (hdutype != NULL)\n                *hdutype = 2;\n        }\n\n        else\n        {\n            tstatus = 0;\n            ffpinit(fptr, &tstatus);       /* probably an IMAGE extension */\n\n            if (tstatus == UNKNOWN_EXT && hdutype != NULL)\n                *hdutype = -1;       /* don't recognize this extension type */\n            else\n            {\n                *status = tstatus;\n                if (hdutype != NULL)\n                    *hdutype = 0;\n            }\n        }\n    }\n\n    else     /*  not the start of a new extension */\n    {\n        if (card[0] == 0  ||\n            card[0] == 10)     /* some editors append this character to EOF */\n        {           \n            *status = END_OF_FILE;\n        }\n        else\n        {\n          *status = UNKNOWN_REC;  /* found unknown type of record */\n          ffpmsg\n        (\"Extension doesn't start with SIMPLE or XTENSION keyword. (ffrhdu)\");\n        ffpmsg(card);\n        }\n    }\n\n    /*  compare the starting position of the next HDU (if any) with the size */\n    /*  of the whole file to see if this is the last HDU in the file */\n\n    if ((fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1] < \n        (fptr->Fptr)->logfilesize )\n    {\n        (fptr->Fptr)->lasthdu = 0;  /* no, not the last HDU */\n    }\n    else\n    {\n        (fptr->Fptr)->lasthdu = 1;  /* yes, this is the last HDU */\n\n        /* special code for mem:// type files (FITS file in memory) */\n        /* Allocate enough memory to hold the entire HDU. */\n        /* Without this code, CFITSIO would repeatedly realloc  memory */\n        /* to incrementally increase the size of the file by 2880 bytes */\n        /* at a time, until it reached the final size */\n \n        ffurlt(fptr, urltype, status);\n        if (!strcmp(urltype,\"mem://\") || !strcmp(urltype,\"memkeep://\"))\n        {\n            fftrun(fptr, (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1],\n               status);\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpinit(fitsfile *fptr,      /* I - FITS file pointer */\n           int *status)          /* IO - error status     */\n/*\n  initialize the parameters defining the structure of the primary array\n  or an Image extension \n*/\n{\n    int groups, tstatus, simple, bitpix, naxis, extend, nspace;\n    int ttype = 0, bytlen = 0, ii, ntilebins;\n    long  pcount, gcount;\n    LONGLONG naxes[999], npix, blank;\n    double bscale, bzero;\n    char comm[FLEN_COMMENT];\n    tcolumn *colptr;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    (fptr->Fptr)->hdutype = IMAGE_HDU; /* primary array or IMAGE extension  */\n    (fptr->Fptr)->headend = (fptr->Fptr)->logfilesize;  /* set max size */\n\n    groups = 0;\n    tstatus = *status;\n\n    /* get all the descriptive info about this HDU */\n    ffgphd(fptr, 999, &simple, &bitpix, &naxis, naxes, &pcount, &gcount, \n           &extend, &bscale, &bzero, &blank, &nspace, status);\n\n    if (*status == NOT_IMAGE)\n        *status = tstatus;    /* ignore 'unknown extension type' error */\n    else if (*status > 0)\n        return(*status);\n\n    /*\n       the logical end of the header is 80 bytes before the current position, \n       minus any trailing blank keywords just before the END keyword.\n    */\n    (fptr->Fptr)->headend = (fptr->Fptr)->nextkey - (80 * (nspace + 1));\n\n    /* the data unit begins at the beginning of the next logical block */\n    (fptr->Fptr)->datastart = (((fptr->Fptr)->nextkey - 80) / 2880 + 1)\n                              * 2880;\n\n    if (naxis > 0 && naxes[0] == 0)  /* test for 'random groups' */\n    {\n        tstatus = 0;\n        ffmaky(fptr, 2, status);         /* reset to beginning of header */\n\n        if (ffgkyl(fptr, \"GROUPS\", &groups, comm, &tstatus))\n            groups = 0;          /* GROUPS keyword not found */\n    }\n\n    if (bitpix == BYTE_IMG)   /* test  bitpix and set the datatype code */\n    {\n        ttype=TBYTE;\n        bytlen=1;\n    }\n    else if (bitpix == SHORT_IMG)\n    {\n        ttype=TSHORT;\n        bytlen=2;\n    }\n    else if (bitpix == LONG_IMG)\n    {\n        ttype=TLONG;\n        bytlen=4;\n    }\n    else if (bitpix == LONGLONG_IMG)\n    {\n        ttype=TLONGLONG;\n        bytlen=8;\n    }\n    else if (bitpix == FLOAT_IMG)\n    {\n        ttype=TFLOAT;\n        bytlen=4;\n    }\n    else if (bitpix == DOUBLE_IMG)\n    {\n        ttype=TDOUBLE;\n        bytlen=8;\n    }\n        \n    /*   calculate the size of the primary array  */\n    (fptr->Fptr)->imgdim = naxis;\n    if (naxis == 0)\n    {\n        npix = 0;\n    }\n    else\n    {\n        if (groups)\n        {\n            npix = 1;  /* NAXIS1 = 0 is a special flag for 'random groups' */\n        }\n        else\n        {\n            npix = naxes[0];\n        }\n\n        (fptr->Fptr)->imgnaxis[0] = naxes[0];\n        for (ii=1; ii < naxis; ii++)\n        {\n            npix = npix*naxes[ii];   /* calc number of pixels in the array */\n            (fptr->Fptr)->imgnaxis[ii] = naxes[ii];\n        }\n    }\n\n    /*\n       now we know everything about the array; just fill in the parameters:\n       the next HDU begins in the next logical block after the data\n    */\n\n    (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1] =\n         (fptr->Fptr)->datastart + \n         ( ((LONGLONG) pcount + npix) * bytlen * gcount + 2879) / 2880 * 2880;\n\n    /*\n      initialize the fictitious heap starting address (immediately following\n      the array data) and a zero length heap.  This is used to find the\n      end of the data when checking the fill values in the last block. \n    */\n    (fptr->Fptr)->heapstart = (npix + pcount) * bytlen * gcount;\n    (fptr->Fptr)->heapsize = 0;\n\n    (fptr->Fptr)->compressimg = 0;  /* this is not a compressed image */\n\n    if (naxis == 0)\n    {\n        (fptr->Fptr)->rowlength = 0;    /* rows have zero length */\n        (fptr->Fptr)->tfield = 0;       /* table has no fields   */\n\n        /* free the tile-compressed image cache, if it exists */\n        if ((fptr->Fptr)->tilerow) {\n           ntilebins = \n\t    (((fptr->Fptr)->znaxis[0] - 1) / ((fptr->Fptr)->tilesize[0])) + 1;\n\n           for (ii = 0; ii < ntilebins; ii++) {\n             if ((fptr->Fptr)->tiledata[ii]) {\n\t       free((fptr->Fptr)->tiledata[ii]);\n             }\n\n             if ((fptr->Fptr)->tilenullarray[ii]) {\n\t       free((fptr->Fptr)->tilenullarray[ii]);\n             }\n            }\n\t    \n\t    free((fptr->Fptr)->tileanynull);\n\t    free((fptr->Fptr)->tiletype);\t   \n\t    free((fptr->Fptr)->tiledatasize);\n\t    free((fptr->Fptr)->tilenullarray);\n\t    free((fptr->Fptr)->tiledata);\n\t    free((fptr->Fptr)->tilerow);\n\n\t    (fptr->Fptr)->tileanynull = 0;\n\t    (fptr->Fptr)->tiletype = 0;\t   \n\t    (fptr->Fptr)->tiledatasize = 0;\n\t    (fptr->Fptr)->tilenullarray = 0;\n\t    (fptr->Fptr)->tiledata = 0;\n\t    (fptr->Fptr)->tilerow = 0;\n        }\n\n        if ((fptr->Fptr)->tableptr)\n           free((fptr->Fptr)->tableptr); /* free memory for the old CHDU */\n\n        (fptr->Fptr)->tableptr = 0;     /* set a null table structure pointer */\n        (fptr->Fptr)->numrows = 0;\n        (fptr->Fptr)->origrows = 0;\n    }\n    else\n    {\n      /*\n        The primary array is actually interpreted as a binary table.  There\n        are two columns: the first column contains the group parameters if any.\n        The second column contains the primary array of data as a single vector\n        column element. In the case of 'random grouped' format, each group\n        is stored in a separate row of the table.\n      */\n        /* the number of rows is equal to the number of groups */\n        (fptr->Fptr)->numrows = gcount;\n        (fptr->Fptr)->origrows = gcount;\n\n        (fptr->Fptr)->rowlength = (npix + pcount) * bytlen; /* total size */\n        (fptr->Fptr)->tfield = 2;  /* 2 fields: group params and the image */\n\n        /* free the tile-compressed image cache, if it exists */\n        if ((fptr->Fptr)->tilerow) {\n\n           ntilebins = \n\t    (((fptr->Fptr)->znaxis[0] - 1) / ((fptr->Fptr)->tilesize[0])) + 1;\n\n           for (ii = 0; ii < ntilebins; ii++) {\n             if ((fptr->Fptr)->tiledata[ii]) {\n\t       free((fptr->Fptr)->tiledata[ii]);\n             }\n\n             if ((fptr->Fptr)->tilenullarray[ii]) {\n\t       free((fptr->Fptr)->tilenullarray[ii]);\n             }\n            }\n\t    \n\t    free((fptr->Fptr)->tileanynull);\n\t    free((fptr->Fptr)->tiletype);\t   \n\t    free((fptr->Fptr)->tiledatasize);\n\t    free((fptr->Fptr)->tilenullarray);\n\t    free((fptr->Fptr)->tiledata);\n\t    free((fptr->Fptr)->tilerow);\n\n\t    (fptr->Fptr)->tileanynull = 0;\n\t    (fptr->Fptr)->tiletype = 0;\t   \n\t    (fptr->Fptr)->tiledatasize = 0;\n\t    (fptr->Fptr)->tilenullarray = 0;\n\t    (fptr->Fptr)->tiledata = 0;\n\t    (fptr->Fptr)->tilerow = 0;\n        }\n\n        if ((fptr->Fptr)->tableptr)\n           free((fptr->Fptr)->tableptr); /* free memory for the old CHDU */\n\n        colptr = (tcolumn *) calloc(2, sizeof(tcolumn) ) ;\n\n        if (!colptr)\n        {\n          ffpmsg\n          (\"malloc failed to get memory for FITS array descriptors (ffpinit)\");\n          (fptr->Fptr)->tableptr = 0;  /* set a null table structure pointer */\n          return(*status = ARRAY_TOO_BIG);\n        }\n\n        /* copy the table structure address to the fitsfile structure */\n        (fptr->Fptr)->tableptr = colptr; \n\n        /* the first column represents the group parameters, if any */\n        colptr->tbcol = 0;\n        colptr->tdatatype = ttype;\n        colptr->twidth = bytlen;\n        colptr->trepeat = (LONGLONG) pcount;\n        colptr->tscale = 1.;\n        colptr->tzero = 0.;\n        colptr->tnull = blank;\n\n        colptr++;  /* increment pointer to the second column */\n\n        /* the second column represents the image array */\n        colptr->tbcol = pcount * bytlen; /* col starts after the group parms */\n        colptr->tdatatype = ttype; \n        colptr->twidth = bytlen;\n        colptr->trepeat = npix;\n        colptr->tscale = bscale;\n        colptr->tzero = bzero;\n        colptr->tnull = blank;\n    }\n\n    /* reset next keyword pointer to the start of the header */\n    (fptr->Fptr)->nextkey = (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu ];\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffainit(fitsfile *fptr,      /* I - FITS file pointer */\n            int *status)         /* IO - error status     */\n{\n/*\n  initialize the parameters defining the structure of an ASCII table \n*/\n    int  ii, nspace, ntilebins;\n    long tfield;\n    LONGLONG pcount, rowlen, nrows, tbcoln;\n    tcolumn *colptr = 0;\n    char name[FLEN_KEYWORD], value[FLEN_VALUE], comm[FLEN_COMMENT];\n    char message[FLEN_ERRMSG], errmsg[FLEN_ERRMSG];\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    (fptr->Fptr)->hdutype = ASCII_TBL;  /* set that this is an ASCII table */\n    (fptr->Fptr)->headend = (fptr->Fptr)->logfilesize;  /* set max size */\n\n    /* get table parameters and test that the header is a valid: */\n    if (ffgttb(fptr, &rowlen, &nrows, &pcount, &tfield, status) > 0)  \n       return(*status);\n\n    if (pcount != 0)\n    {\n       ffpmsg(\"PCOUNT keyword not equal to 0 in ASCII table (ffainit).\");\n       snprintf(errmsg, FLEN_ERRMSG,\"  PCOUNT = %ld\", (long) pcount);\n       ffpmsg(errmsg);\n       return(*status = BAD_PCOUNT);\n    }\n\n    (fptr->Fptr)->rowlength = rowlen; /* store length of a row */\n    (fptr->Fptr)->tfield = tfield; /* store number of table fields in row */\n\n     /* free the tile-compressed image cache, if it exists */\n     if ((fptr->Fptr)->tilerow) {\n\n           ntilebins = \n\t    (((fptr->Fptr)->znaxis[0] - 1) / ((fptr->Fptr)->tilesize[0])) + 1;\n\n           for (ii = 0; ii < ntilebins; ii++) {\n             if ((fptr->Fptr)->tiledata[ii]) {\n\t       free((fptr->Fptr)->tiledata[ii]);\n             }\n\n             if ((fptr->Fptr)->tilenullarray[ii]) {\n\t       free((fptr->Fptr)->tilenullarray[ii]);\n             }\n            }\n\t    \n\t    free((fptr->Fptr)->tileanynull);\n\t    free((fptr->Fptr)->tiletype);\t   \n\t    free((fptr->Fptr)->tiledatasize);\n\t    free((fptr->Fptr)->tilenullarray);\n\t    free((fptr->Fptr)->tiledata);\n\t    free((fptr->Fptr)->tilerow);\n\n\t    (fptr->Fptr)->tileanynull = 0;\n\t    (fptr->Fptr)->tiletype = 0;\t   \n\t    (fptr->Fptr)->tiledatasize = 0;\n\t    (fptr->Fptr)->tilenullarray = 0;\n\t    (fptr->Fptr)->tiledata = 0;\n\t    (fptr->Fptr)->tilerow = 0;\n     }\n\n    if ((fptr->Fptr)->tableptr)\n       free((fptr->Fptr)->tableptr); /* free memory for the old CHDU */\n\n    /* mem for column structures ; space is initialized = 0 */\n    if (tfield > 0)\n    {\n      colptr = (tcolumn *) calloc(tfield, sizeof(tcolumn) );\n      if (!colptr)\n      {\n        ffpmsg\n        (\"malloc failed to get memory for FITS table descriptors (ffainit)\");\n        (fptr->Fptr)->tableptr = 0;  /* set a null table structure pointer */\n        return(*status = ARRAY_TOO_BIG);\n      }\n    }\n\n    /* copy the table structure address to the fitsfile structure */\n    (fptr->Fptr)->tableptr = colptr; \n\n    /*  initialize the table field parameters */\n    for (ii = 0; ii < tfield; ii++, colptr++)\n    {\n        colptr->ttype[0] = '\\0';  /* null column name */\n        colptr->tscale = 1.;\n        colptr->tzero  = 0.;\n        colptr->strnull[0] = ASCII_NULL_UNDEFINED;  /* null value undefined */\n        colptr->tbcol = -1;          /* initialize to illegal value */\n        colptr->tdatatype = -9999;   /* initialize to illegal value */\n    }\n\n    /*\n      Initialize the fictitious heap starting address (immediately following\n      the table data) and a zero length heap.  This is used to find the\n      end of the table data when checking the fill values in the last block. \n      There is no special data following an ASCII table.\n    */\n    (fptr->Fptr)->numrows = nrows;\n    (fptr->Fptr)->origrows = nrows;\n    (fptr->Fptr)->heapstart = rowlen * nrows;\n    (fptr->Fptr)->heapsize = 0;\n\n    (fptr->Fptr)->compressimg = 0;  /* this is not a compressed image */\n\n    /* now search for the table column keywords and the END keyword */\n\n    for (nspace = 0, ii = 8; 1; ii++)  /* infinite loop  */\n    {\n        ffgkyn(fptr, ii, name, value, comm, status);\n\n        /* try to ignore minor syntax errors */\n        if (*status == NO_QUOTE)\n        {\n            strcat(value, \"'\");\n            *status = 0;\n        }\n        else if (*status == BAD_KEYCHAR)\n        {\n            *status = 0;\n        }\n\n        if (*status == END_OF_FILE)\n        {\n            ffpmsg(\"END keyword not found in ASCII table header (ffainit).\");\n            return(*status = NO_END);\n        }\n        else if (*status > 0)\n            return(*status);\n\n        else if (name[0] == 'T')   /* keyword starts with 'T' ? */\n            ffgtbp(fptr, name, value, status); /* test if column keyword */\n\n        else if (!FSTRCMP(name, \"END\"))  /* is this the END keyword? */\n            break;\n\n        if (!name[0] && !value[0] && !comm[0])  /* a blank keyword? */\n            nspace++;\n\n        else\n            nspace = 0;\n    }\n\n    /* test that all required keywords were found and have legal values */\n    colptr = (fptr->Fptr)->tableptr;\n    for (ii = 0; ii < tfield; ii++, colptr++)\n    {\n        tbcoln = colptr->tbcol;  /* the starting column number (zero based) */\n\n        if (colptr->tdatatype == -9999)\n        {\n            ffkeyn(\"TFORM\", ii+1, name, status);  /* construct keyword name */\n            snprintf(message,FLEN_ERRMSG,\"Required %s keyword not found (ffainit).\", name);\n            ffpmsg(message);\n            return(*status = NO_TFORM);\n        }\n\n        else if (tbcoln == -1)\n        {\n            ffkeyn(\"TBCOL\", ii+1, name, status); /* construct keyword name */\n            snprintf(message,FLEN_ERRMSG,\"Required %s keyword not found (ffainit).\", name);\n            ffpmsg(message);\n            return(*status = NO_TBCOL);\n        }\n\n        else if ((fptr->Fptr)->rowlength != 0 && \n                (tbcoln < 0 || tbcoln >= (fptr->Fptr)->rowlength ) )\n        {\n            ffkeyn(\"TBCOL\", ii+1, name, status);  /* construct keyword name */\n            snprintf(message,FLEN_ERRMSG,\"Value of %s keyword out of range: %ld (ffainit).\",\n            name, (long) tbcoln);\n            ffpmsg(message);\n            return(*status = BAD_TBCOL);\n        }\n\n        else if ((fptr->Fptr)->rowlength != 0 && \n                 tbcoln + colptr->twidth > (fptr->Fptr)->rowlength )\n        {\n            snprintf(message,FLEN_ERRMSG,\"Column %d is too wide to fit in table (ffainit)\",\n            ii+1);\n            ffpmsg(message);\n            snprintf(message, FLEN_ERRMSG,\" TFORM = %s and NAXIS1 = %ld\",\n                    colptr->tform, (long) (fptr->Fptr)->rowlength);\n            ffpmsg(message);\n            return(*status = COL_TOO_WIDE);\n        }\n    }\n\n    /*\n      now we know everything about the table; just fill in the parameters:\n      the 'END' record is 80 bytes before the current position, minus\n      any trailing blank keywords just before the END keyword.\n    */\n    (fptr->Fptr)->headend = (fptr->Fptr)->nextkey - (80 * (nspace + 1));\n \n    /* the data unit begins at the beginning of the next logical block */\n    (fptr->Fptr)->datastart = (((fptr->Fptr)->nextkey - 80) / 2880 + 1) \n                              * 2880;\n\n    /* the next HDU begins in the next logical block after the data  */\n    (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1] =\n         (fptr->Fptr)->datastart +\n         ( ((LONGLONG)rowlen * nrows + 2879) / 2880 * 2880 );\n\n    /* reset next keyword pointer to the start of the header */\n    (fptr->Fptr)->nextkey = (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu ];\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffbinit(fitsfile *fptr,     /* I - FITS file pointer */\n            int *status)        /* IO - error status     */\n{\n/*\n  initialize the parameters defining the structure of a binary table \n*/\n    int  ii, nspace, ntilebins;\n    long tfield;\n    LONGLONG pcount, rowlen, nrows, totalwidth;\n    tcolumn *colptr = 0;\n    char name[FLEN_KEYWORD], value[FLEN_VALUE], comm[FLEN_COMMENT];\n    char message[FLEN_ERRMSG];\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    (fptr->Fptr)->hdutype = BINARY_TBL;  /* set that this is a binary table */\n    (fptr->Fptr)->headend = (fptr->Fptr)->logfilesize;  /* set max size */\n\n    /* get table parameters and test that the header is valid: */\n    if (ffgttb(fptr, &rowlen, &nrows, &pcount, &tfield, status) > 0)\n       return(*status);\n\n    (fptr->Fptr)->rowlength =  rowlen; /* store length of a row */\n    (fptr->Fptr)->tfield = tfield; /* store number of table fields in row */\n\n     /* free the tile-compressed image cache, if it exists */\n     if ((fptr->Fptr)->tilerow) {\n\n           ntilebins = \n\t    (((fptr->Fptr)->znaxis[0] - 1) / ((fptr->Fptr)->tilesize[0])) + 1;\n\n           for (ii = 0; ii < ntilebins; ii++) {\n             if ((fptr->Fptr)->tiledata[ii]) {\n\t       free((fptr->Fptr)->tiledata[ii]);\n             }\n\n             if ((fptr->Fptr)->tilenullarray[ii]) {\n\t       free((fptr->Fptr)->tilenullarray[ii]);\n             }\n            }\n\t    \n\t    free((fptr->Fptr)->tileanynull);\n\t    free((fptr->Fptr)->tiletype);\t   \n\t    free((fptr->Fptr)->tiledatasize);\n\t    free((fptr->Fptr)->tilenullarray);\n\t    free((fptr->Fptr)->tiledata);\n\t    free((fptr->Fptr)->tilerow);\n\n\t    (fptr->Fptr)->tileanynull = 0;\n\t    (fptr->Fptr)->tiletype = 0;\t   \n\t    (fptr->Fptr)->tiledatasize = 0;\n\t    (fptr->Fptr)->tilenullarray = 0;\n\t    (fptr->Fptr)->tiledata = 0;\n\t    (fptr->Fptr)->tilerow = 0;\n     }\n\n    if ((fptr->Fptr)->tableptr)\n       free((fptr->Fptr)->tableptr); /* free memory for the old CHDU */\n\n    /* mem for column structures ; space is initialized = 0  */\n    if (tfield > 0)\n    {\n      colptr = (tcolumn *) calloc(tfield, sizeof(tcolumn) );\n      if (!colptr)\n      {\n        ffpmsg\n        (\"malloc failed to get memory for FITS table descriptors (ffbinit)\");\n        (fptr->Fptr)->tableptr = 0;  /* set a null table structure pointer */\n        return(*status = ARRAY_TOO_BIG);\n      }\n    }\n\n    /* copy the table structure address to the fitsfile structure */\n    (fptr->Fptr)->tableptr = colptr; \n\n    /* initialize the table field parameters */\n    for (ii = 0; ii < tfield; ii++, colptr++)\n    {\n        colptr->ttype[0] = '\\0';  /* null column name */\n        colptr->tscale = 1.;\n        colptr->tzero  = 0.;\n        colptr->tnull  = NULL_UNDEFINED; /* (integer) null value undefined */\n        colptr->tdatatype = -9999;   /* initialize to illegal value */\n        colptr->trepeat = 1;\n        colptr->strnull[0] = '\\0'; /* for ASCII string columns (TFORM = rA) */\n    }\n\n    /*\n      Initialize the heap starting address (immediately following\n      the table data) and the size of the heap.  This is used to find the\n      end of the table data when checking the fill values in the last block. \n    */\n    (fptr->Fptr)->numrows = nrows;\n    (fptr->Fptr)->origrows = nrows;\n    (fptr->Fptr)->heapstart = rowlen * nrows;\n    (fptr->Fptr)->heapsize = pcount;\n\n    (fptr->Fptr)->compressimg = 0;  /* initialize as not a compressed image */\n\n    /* now search for the table column keywords and the END keyword */\n\n    for (nspace = 0, ii = 8; 1; ii++)  /* infinite loop  */\n    {\n        ffgkyn(fptr, ii, name, value, comm, status);\n\n        /* try to ignore minor syntax errors */\n        if (*status == NO_QUOTE)\n        {\n            strcat(value, \"'\");\n            *status = 0;\n        }\n        else if (*status == BAD_KEYCHAR)\n        {\n            *status = 0;\n        }\n\n        if (*status == END_OF_FILE)\n        {\n            ffpmsg(\"END keyword not found in binary table header (ffbinit).\");\n            return(*status = NO_END);\n        }\n        else if (*status > 0)\n            return(*status);\n\n        else if (name[0] == 'T')   /* keyword starts with 'T' ? */\n            ffgtbp(fptr, name, value, status); /* test if column keyword */\n\n        else if (!FSTRCMP(name, \"ZIMAGE\"))\n        {\n            if (value[0] == 'T')\n                (fptr->Fptr)->compressimg = 1; /* this is a compressed image */\n        }\n        else if (!FSTRCMP(name, \"END\"))  /* is this the END keyword? */\n            break;\n\n\n        if (!name[0] && !value[0] && !comm[0])  /* a blank keyword? */\n            nspace++;\n\n        else\n            nspace = 0; /* reset number of consecutive spaces before END */\n    }\n\n    /* test that all the required keywords were found and have legal values */\n    colptr = (fptr->Fptr)->tableptr;  /* set pointer to first column */\n\n    for (ii = 0; ii < tfield; ii++, colptr++)\n    {\n        if (colptr->tdatatype == -9999)\n        {\n            ffkeyn(\"TFORM\", ii+1, name, status);  /* construct keyword name */\n            snprintf(message,FLEN_ERRMSG,\"Required %s keyword not found (ffbinit).\", name);\n            ffpmsg(message);\n            return(*status = NO_TFORM);\n        }\n    }\n\n    /*\n      now we know everything about the table; just fill in the parameters:\n      the 'END' record is 80 bytes before the current position, minus\n      any trailing blank keywords just before the END keyword.\n    */\n\n    (fptr->Fptr)->headend = (fptr->Fptr)->nextkey - (80 * (nspace + 1));\n \n    /* the data unit begins at the beginning of the next logical block */\n    (fptr->Fptr)->datastart = (((fptr->Fptr)->nextkey - 80) / 2880 + 1) \n                              * 2880;\n\n    /* the next HDU begins in the next logical block after the data  */\n    (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1] = \n         (fptr->Fptr)->datastart +\n\t ( ((fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize + 2879) / 2880 * 2880 );\n\n    /* determine the byte offset to the beginning of each column */\n    ffgtbc(fptr, &totalwidth, status);\n\n    if (totalwidth != rowlen)\n    {\n        snprintf(message,FLEN_ERRMSG,\n        \"NAXIS1 = %ld is not equal to the sum of column widths: %ld\", \n        (long) rowlen, (long) totalwidth);\n        ffpmsg(message);\n        *status = BAD_ROW_WIDTH;\n    }\n\n    /* reset next keyword pointer to the start of the header */\n    (fptr->Fptr)->nextkey = (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu ];\n\n    if ( (fptr->Fptr)->compressimg == 1) /*  Is this a compressed image */\n        imcomp_get_compressed_image_par(fptr, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgabc(int tfields,     /* I - number of columns in the table           */\n           char **tform,    /* I - value of TFORMn keyword for each column  */\n           int space,       /* I - number of spaces to leave between cols   */\n           long *rowlen,    /* O - total width of a table row               */\n           long *tbcol,     /* O - starting byte in row for each column     */\n           int *status)     /* IO - error status                            */\n/*\n  calculate the starting byte offset of each column of an ASCII table\n  and the total length of a row, in bytes.  The input space value determines\n  how many blank spaces to leave between each column (1 is recommended).\n*/\n{\n    int ii, datacode, decims;\n    long width;\n\n    if (*status > 0)\n        return(*status);\n\n    *rowlen=0;\n\n    if (tfields <= 0)\n        return(*status);\n\n    tbcol[0] = 1;\n\n    for (ii = 0; ii < tfields; ii++)\n    {\n        tbcol[ii] = *rowlen + 1;    /* starting byte in row of column */\n\n        ffasfm(tform[ii], &datacode, &width, &decims, status);\n\n        *rowlen += (width + space);  /* total length of row */\n    }\n\n    *rowlen -= space;  /*  don't add space after the last field */\n\n    return (*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgtbc(fitsfile *fptr,    /* I - FITS file pointer          */\n           LONGLONG *totalwidth,  /* O - total width of a table row */\n           int *status)       /* IO - error status              */\n{\n/*\n  calculate the starting byte offset of each column of a binary table.\n  Use the values of the datatype code and repeat counts in the\n  column structure. Return the total length of a row, in bytes.\n*/\n    int tfields, ii;\n    LONGLONG nbytes;\n    tcolumn *colptr;\n    char message[FLEN_ERRMSG], *cptr;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    tfields = (fptr->Fptr)->tfield;\n    colptr = (fptr->Fptr)->tableptr;  /* point to first column structure */\n\n    *totalwidth = 0;\n\n    for (ii = 0; ii < tfields; ii++, colptr++)\n    {\n        colptr->tbcol = *totalwidth;  /* byte offset in row to this column */\n\n        if (colptr->tdatatype == TSTRING)\n        {\n            nbytes =  colptr->trepeat;   /* one byte per char */\n        }\n        else if (colptr->tdatatype == TBIT)\n        {\n            nbytes = ( colptr->trepeat + 7) / 8;\n        }\n        else if (colptr->tdatatype > 0)\n        {\n            nbytes =  colptr->trepeat * (colptr->tdatatype / 10);\n        }\n        else  {\n\t\n\t  cptr = colptr->tform;\n\t  while (isdigit(*cptr)) cptr++;\n\t\n\t  if (*cptr == 'P')  \n\t   /* this is a 'P' variable length descriptor (neg. tdatatype) */\n            nbytes = colptr->trepeat * 8;\n\t  else if (*cptr == 'Q') \n\t   /* this is a 'Q' variable length descriptor (neg. tdatatype) */\n            nbytes = colptr->trepeat * 16;\n\n\t  else {\n\t\tsnprintf(message,FLEN_ERRMSG,\n\t\t\"unknown binary table column type: %s\", colptr->tform);\n\t\tffpmsg(message);\n\t\t*status = BAD_TFORM;\n\t\treturn(*status);\n\t  }\n \t}\n\n       *totalwidth = *totalwidth + nbytes;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgtbp(fitsfile *fptr,     /* I - FITS file pointer   */\n           char *name,         /* I - name of the keyword */\n           char *value,        /* I - value string of the keyword */\n           int *status)        /* IO - error status       */\n{\n/*\n  Get TaBle Parameter.  The input keyword name begins with the letter T.\n  Test if the keyword is one of the table column definition keywords\n  of an ASCII or binary table. If so, decode it and update the value \n  in the structure.\n*/\n    int tstatus, datacode, decimals;\n    long width, repeat, nfield, ivalue;\n    LONGLONG jjvalue;\n    double dvalue;\n    char tvalue[FLEN_VALUE], *loc;\n    char message[FLEN_ERRMSG];\n    tcolumn *colptr;\n\n    if (*status > 0)\n        return(*status);\n\n    tstatus = 0;\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if(!FSTRNCMP(name + 1, \"TYPE\", 4) )\n    {\n        /* get the index number */\n        if( ffc2ii(name + 5, &nfield, &tstatus) > 0) /* read index no. */\n            return(*status);    /* must not be an indexed keyword */\n\n        if (nfield < 1 || nfield > (fptr->Fptr)->tfield ) /* out of range */\n            return(*status);\n\n        colptr = (fptr->Fptr)->tableptr;        /* get pointer to columns */\n        colptr = colptr + nfield - 1;   /* point to the correct column */\n\n        if (ffc2s(value, tvalue, &tstatus) > 0)  /* remove quotes */\n            return(*status);\n\n        strcpy(colptr->ttype, tvalue);  /* copy col name to structure */\n    }\n    else if(!FSTRNCMP(name + 1, \"FORM\", 4) )\n    {\n        /* get the index number */\n        if( ffc2ii(name + 5, &nfield, &tstatus) > 0) /* read index no. */\n            return(*status);    /* must not be an indexed keyword */\n\n        if (nfield < 1 || nfield > (fptr->Fptr)->tfield )  /* out of range */\n            return(*status);\n\n        colptr = (fptr->Fptr)->tableptr;        /* get pointer to columns */\n        colptr = colptr + nfield - 1;   /* point to the correct column */\n\n        if (ffc2s(value, tvalue, &tstatus) > 0)  /* remove quotes */\n            return(*status);\n\n        strncpy(colptr->tform, tvalue, 9);  /* copy TFORM to structure */\n        colptr->tform[9] = '\\0';            /* make sure it is terminated */\n\n        if ((fptr->Fptr)->hdutype == ASCII_TBL)  /* ASCII table */\n        {\n          if (ffasfm(tvalue, &datacode, &width, &decimals, status) > 0)\n              return(*status);  /* bad format code */\n\n          colptr->tdatatype = TSTRING; /* store datatype code */\n          colptr->trepeat = 1;      /* field repeat count == 1 */\n          colptr->twidth = width;   /* the width of the field, in bytes */\n        }\n        else  /* binary table */\n        {\n          if (ffbnfm(tvalue, &datacode, &repeat, &width, status) > 0)\n              return(*status);  /* bad format code */\n\n          colptr->tdatatype = datacode; /* store datatype code */\n          colptr->trepeat = (LONGLONG) repeat;     /* field repeat count  */\n\n          /* Don't overwrite the unit string width if it was previously */\n\t  /* set by a TDIMn keyword and has a legal value */\n          if (datacode == TSTRING) {\n\t    if (colptr->twidth == 0 || colptr->twidth > repeat)\n              colptr->twidth = width;   /*  width of a unit string */\n\n          } else {\n              colptr->twidth = width;   /*  width of a unit value in chars */\n          }\n        }\n    }\n    else if(!FSTRNCMP(name + 1, \"BCOL\", 4) )\n    {\n        /* get the index number */\n        if( ffc2ii(name + 5, &nfield, &tstatus) > 0) /* read index no. */\n            return(*status);    /* must not be an indexed keyword */\n\n        if (nfield < 1 || nfield > (fptr->Fptr)->tfield )  /* out of range */\n            return(*status);\n\n        colptr = (fptr->Fptr)->tableptr;        /* get pointer to columns */\n        colptr = colptr + nfield - 1;   /* point to the correct column */\n\n        if ((fptr->Fptr)->hdutype == BINARY_TBL)\n            return(*status);  /* binary tables don't have TBCOL keywords */\n\n        if (ffc2ii(value, &ivalue, status) > 0)\n        {\n            snprintf(message, FLEN_ERRMSG,\n            \"Error reading value of %s as an integer: %s\", name, value);\n            ffpmsg(message);\n            return(*status);\n        }\n        colptr->tbcol = ivalue - 1; /* convert to zero base */\n    }\n    else if(!FSTRNCMP(name + 1, \"SCAL\", 4) )\n    {\n        /* get the index number */\n        if( ffc2ii(name + 5, &nfield, &tstatus) > 0) /* read index no. */\n            return(*status);    /* must not be an indexed keyword */\n\n        if (nfield < 1 || nfield > (fptr->Fptr)->tfield )  /* out of range */\n            return(*status);\n\n        colptr = (fptr->Fptr)->tableptr;        /* get pointer to columns */\n        colptr = colptr + nfield - 1;   /* point to the correct column */\n\n        if (ffc2dd(value, &dvalue, &tstatus) > 0)\n        {\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading value of %s as a double: %s\", name, value);\n            ffpmsg(message);\n\n            /* ignore this error, so don't return error status */\n            return(*status);\n        }\n        colptr->tscale = dvalue;\n    }\n    else if(!FSTRNCMP(name + 1, \"ZERO\", 4) )\n    {\n        /* get the index number */\n        if( ffc2ii(name + 5, &nfield, &tstatus) > 0) /* read index no. */\n            return(*status);    /* must not be an indexed keyword */\n\n        if (nfield < 1 || nfield > (fptr->Fptr)->tfield )  /* out of range */\n            return(*status);\n\n        colptr = (fptr->Fptr)->tableptr;        /* get pointer to columns */\n        colptr = colptr + nfield - 1;   /* point to the correct column */\n\n        if (ffc2dd(value, &dvalue, &tstatus) > 0)\n        {\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading value of %s as a double: %s\", name, value);\n            ffpmsg(message);\n\n            /* ignore this error, so don't return error status */\n            return(*status);\n        }\n        colptr->tzero = dvalue;\n    }\n    else if(!FSTRNCMP(name + 1, \"NULL\", 4) )\n    {\n        /* get the index number */\n        if( ffc2ii(name + 5, &nfield, &tstatus) > 0) /* read index no. */\n            return(*status);    /* must not be an indexed keyword */\n\n        if (nfield < 1 || nfield > (fptr->Fptr)->tfield )  /* out of range */\n            return(*status);\n\n        colptr = (fptr->Fptr)->tableptr;        /* get pointer to columns */\n        colptr = colptr + nfield - 1;   /* point to the correct column */\n\n        if ((fptr->Fptr)->hdutype == ASCII_TBL)  /* ASCII table */\n        {\n            if (ffc2s(value, tvalue, &tstatus) > 0)  /* remove quotes */\n                return(*status);\n\n            strncpy(colptr->strnull, tvalue, 17);  /* copy TNULL string */\n            colptr->strnull[17] = '\\0';  /* terminate the strnull field */\n\n        }\n        else  /* binary table */\n        {\n            if (ffc2jj(value, &jjvalue, &tstatus) > 0) \n            {\n                snprintf(message,FLEN_ERRMSG,\n                \"Error reading value of %s as an integer: %s\", name, value);\n                ffpmsg(message);\n\n                /* ignore this error, so don't return error status */\n                return(*status);\n            }\n            colptr->tnull = jjvalue; /* null value for integer column */\n        }\n    }\n    else if(!FSTRNCMP(name + 1, \"DIM\", 3) )\n    {\n        if ((fptr->Fptr)->hdutype == ASCII_TBL)  /* ASCII table */\n            return(*status);  /* ASCII tables don't support TDIMn keyword */ \n\n        /* get the index number */\n        if( ffc2ii(name + 4, &nfield, &tstatus) > 0) /* read index no. */\n            return(*status);    /* must not be an indexed keyword */\n\n        if (nfield < 1 || nfield > (fptr->Fptr)->tfield )  /* out of range */\n            return(*status);\n\n        colptr = (fptr->Fptr)->tableptr;     /* get pointer to columns */\n        colptr = colptr + nfield - 1;   /* point to the correct column */\n\n        /* uninitialized columns have tdatatype set = -9999 */\n        if (colptr->tdatatype != -9999 && colptr->tdatatype != TSTRING)\n\t    return(*status);     /* this is not an ASCII string column */\n\t   \n        loc = strchr(value, '(' );  /* find the opening parenthesis */\n        if (!loc)\n            return(*status);   /* not a proper TDIM keyword */\n\n        loc++;\n        width = strtol(loc, &loc, 10);  /* read size of first dimension */\n        if (colptr->trepeat != 1 && colptr->trepeat < width)\n\t    return(*status);  /* string length is greater than column width */\n\n        colptr->twidth = width;   /* set width of a unit string in chars */\n    }\n    else if (!FSTRNCMP(name + 1, \"HEAP\", 4) )\n    {\n        if ((fptr->Fptr)->hdutype == ASCII_TBL)  /* ASCII table */\n            return(*status);  /* ASCII tables don't have a heap */ \n\n        if (ffc2jj(value, &jjvalue, &tstatus) > 0) \n        {\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading value of %s as an integer: %s\", name, value);\n            ffpmsg(message);\n\n            /* ignore this error, so don't return error status */\n            return(*status);\n        }\n        (fptr->Fptr)->heapstart = jjvalue; /* starting byte of the heap */\n        return(*status);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcprll( fitsfile *fptr, /* I - FITS file pointer                      */\n        int colnum,     /* I - column number (1 = 1st column of table)      */\n        LONGLONG firstrow,  /* I - first row (1 = 1st row of table)         */\n        LONGLONG firstelem, /* I - first element within vector (1 = 1st)    */\n        LONGLONG nelem, /* I - number of elements to read or write          */\n        int writemode,  /* I - = 1 if writing data, = 0 if reading data     */\n                        /*     If = 2, then writing data, but don't modify  */\n                        /*     the returned values of repeat and incre.     */\n                        /*     If = -1, then reading data in reverse        */\n                        /*     direction.                                   */\n\t                /*     If writemode has 16 added, then treat        */\n\t                /*        TSTRING column as TBYTE vector            */\n        double *scale,  /* O - FITS scaling factor (TSCALn keyword value)   */\n        double *zero,   /* O - FITS scaling zero pt (TZEROn keyword value)  */\n        char *tform,    /* O - ASCII column format: value of TFORMn keyword */\n        long *twidth,   /* O - width of ASCII column (characters)           */\n        int *tcode,     /* O - abs(column datatype code): I*4=41, R*4=42, etc */\n        int *maxelem,   /* O - max number of elements that fit in buffer    */\n        LONGLONG *startpos,/* O - offset in file to starting row & column      */\n        LONGLONG *elemnum, /* O - starting element number ( 0 = 1st element)   */\n        long *incre,    /* O - byte offset between elements within a row    */\n        LONGLONG *repeat,  /* O - number of elements in a row (vector column)  */\n        LONGLONG *rowlen,  /* O - length of a row, in bytes                    */\n        int  *hdutype,  /* O - HDU type: 0, 1, 2 = primary, table, bintable */\n        LONGLONG *tnull,    /* O - null value for integer columns               */\n        char *snull,    /* O - null value for ASCII table columns           */\n        int *status)    /* IO - error status                                */\n/*\n  Get Column PaRameters, and test starting row and element numbers for \n  validity.  This is a workhorse routine that is call by nearly every\n  other routine that reads or writes to FITS files.\n*/\n{\n    int nulpos, rangecheck = 1, tstatus = 0;\n    LONGLONG datastart, endpos;\n    long nblock;\n    LONGLONG heapoffset, lrepeat, endrow, nrows, tbcol;\n    char message[FLEN_ERRMSG];\n    tcolumn *colptr;\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu) {\n        /* reset position to the correct HDU if necessary */\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) {\n        /* rescan header if data structure is undefined */\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n    } else if (writemode > 0 && writemode != 15) {\n\n\t/* Only terminate the header with the END card if */\n\t/* writing to the stdout stream (don't have random access). */\n\n\t/* Initialize STREAM_DRIVER to be the device number for */\n\t/* writing FITS files directly out to the stdout stream. */\n\t/* This only needs to be done once and is thread safe. */\n\tif (STREAM_DRIVER <= 0 || STREAM_DRIVER > 40) {\n            urltype2driver(\"stream://\", &STREAM_DRIVER);\n        }\n\n        if ((fptr->Fptr)->driver == STREAM_DRIVER) {\n\t    if ((fptr->Fptr)->ENDpos != \n\t       maxvalue((fptr->Fptr)->headend , (fptr->Fptr)->datastart -2880)) {\n\t           ffwend(fptr, status);\n\t    } \n\t}\n    }\n\n    /* Do sanity check of input parameters */\n    if (firstrow < 1)\n    {\n        if ((fptr->Fptr)->hdutype == IMAGE_HDU) /*  Primary Array or IMAGE */\n        {\n          snprintf(message,FLEN_ERRMSG, \"Image group number is less than 1: %.0f\",\n                (double) firstrow);\n          ffpmsg(message);\n          return(*status = BAD_ROW_NUM);\n        }\n        else\n        {\n          snprintf(message, FLEN_ERRMSG,\"Starting row number is less than 1: %.0f\",\n                (double) firstrow);\n          ffpmsg(message);\n          return(*status = BAD_ROW_NUM);\n        }\n    }\n    else if ((fptr->Fptr)->hdutype != ASCII_TBL && firstelem < 1)\n    {\n        snprintf(message, FLEN_ERRMSG,\"Starting element number less than 1: %ld\",\n               (long) firstelem);\n        ffpmsg(message);\n        return(*status = BAD_ELEM_NUM);\n    }\n    else if (nelem < 0)\n    {\n        snprintf(message, FLEN_ERRMSG,\"Tried to read or write less than 0 elements: %.0f\",\n            (double) nelem);\n        ffpmsg(message);\n        return(*status = NEG_BYTES);\n    }\n    else if (colnum < 1 || colnum > (fptr->Fptr)->tfield)\n    {\n        snprintf(message, FLEN_ERRMSG,\"Specified column number is out of range: %d\",\n                colnum);\n        ffpmsg(message);\n        snprintf(message, FLEN_ERRMSG,\"  There are %d columns in this table.\",\n                (fptr->Fptr)->tfield );\n        ffpmsg(message);\n\n        return(*status = BAD_COL_NUM);\n    }\n\n    /*  copy relevant parameters from the structure */\n\n    *hdutype = (fptr->Fptr)->hdutype;    /* image, ASCII table, or BINTABLE  */\n    *rowlen   = (fptr->Fptr)->rowlength; /* width of the table, in bytes     */\n    datastart = (fptr->Fptr)->datastart; /* offset in file to start of table */\n\n    colptr  = (fptr->Fptr)->tableptr;    /* point to first column */\n    colptr += (colnum - 1);      /* offset to correct column structure */\n\n    *scale    = colptr->tscale;  /* value scaling factor;    default = 1.0 */\n    *zero     = colptr->tzero;   /* value scaling zeropoint; default = 0.0 */\n    *tnull    = colptr->tnull;   /* null value for integer columns         */\n    tbcol     = colptr->tbcol;   /* offset to start of column within row   */\n    *twidth   = colptr->twidth;  /* width of a single datum, in bytes      */\n    *incre    = colptr->twidth;  /* increment between datums, in bytes     */\n\n    *tcode    = colptr->tdatatype;\n    *repeat   = colptr->trepeat;\n\n    strcpy(tform, colptr->tform);    /* value of TFORMn keyword            */\n    strcpy(snull, colptr->strnull);  /* null value for ASCII table columns */\n\n    if (*hdutype == ASCII_TBL && snull[0] == '\\0')\n    {\n     /* In ASCII tables, a null value is equivalent to all spaces */\n\n       strcpy(snull, \"                 \");   /* maximum of 17 spaces */\n       nulpos = minvalue(17, *twidth);      /* truncate to width of column */\n       snull[nulpos] = '\\0';\n    }\n\n    /* Special case: use writemode = 15,16,17,18 to interpret TSTRING columns\n       as TBYTE vectors instead (but not for ASCII tables). \n          writemode = 15 equivalent to writemode =-1\n          writemode = 16 equivalent to writemode = 0\n          writemode = 17 equivalent to writemode = 1\n          writemode = 18 equivalent to writemode = 2\n    */\n    if (writemode >= 15 && writemode <= 18) {\n\n      if (abs(*tcode) == TSTRING && *hdutype != ASCII_TBL ) {\n        *incre = 1;          /* each element is 1 byte wide */\n\tif (*tcode < 0) *repeat = *twidth;  /* variable columns appear to put width in *twidth */\n        *twidth = 1;         /* width of each element */\n        *scale = 1.0;        /* no scaling */\n        *zero  = 0.0;\n        *tnull = NULL_UNDEFINED;  /* don't test for nulls */\n        *maxelem = DBUFFSIZE;\n\n\tif (*tcode < 0) {\n\t  *tcode = -TBYTE; /* variable-length */\n\t} else {\n\t  *tcode =  TBYTE;\n\t}\n      }\n\n      /* translate to the equivalent as listed above */\n      writemode -= 16;\n    }\n\n    /* Special case:  interpret writemode = -1 as reading data, but */\n    /* don't do error check for exceeding the range of pixels  */\n    if (writemode == -1)\n    {\n      writemode = 0;\n      rangecheck = 0;\n    }\n\n    /* Special case: interprete 'X' column as 'B' */\n    if (abs(*tcode) == TBIT)\n    {\n        *tcode  = *tcode / TBIT * TBYTE;\n        *repeat = (*repeat + 7) / 8;\n    }\n\n    /* Special case: support the 'rAw' format in BINTABLEs */\n    if (*hdutype == BINARY_TBL && *tcode == TSTRING) {\n       if (*twidth)\n          *repeat = *repeat / *twidth;  /* repeat = # of unit strings in field */\n       else\n          *repeat = 0;\n    }\n    else if (*hdutype == BINARY_TBL && *tcode == -TSTRING) {\n       /* variable length string */\n       *incre = 1;\n       *twidth = (long) nelem;\n    }\n\n    if (*hdutype == ASCII_TBL)\n        *elemnum = 0;   /* ASCII tables don't have vector elements */\n    else\n        *elemnum = firstelem - 1;\n\n    /* interprete complex and double complex as pairs of floats or doubles */\n    if (abs(*tcode) >= TCOMPLEX)\n    {\n        if (*tcode > 0)\n          *tcode = (*tcode + 1) / 2;\n        else\n          *tcode = (*tcode - 1) / 2;\n\n        *repeat  = *repeat * 2;\n        *twidth  = *twidth / 2;\n        *incre   = *incre  / 2;\n    }\n\n    /* calculate no. of pixels that fit in buffer */\n    /* allow for case where floats are 8 bytes long */\n    if (abs(*tcode) == TFLOAT)\n       *maxelem = DBUFFSIZE / sizeof(float);\n    else if (abs(*tcode) == TDOUBLE)\n       *maxelem = DBUFFSIZE / sizeof(double);\n    else if (abs(*tcode) == TSTRING)\n    {\n       if (*twidth)\n          *maxelem = (DBUFFSIZE - 1)/ *twidth; /* leave room for final \\0 */\n       else\n          *maxelem = DBUFFSIZE - 1;\n          \n       if (*maxelem == 0) {\n            snprintf(message,FLEN_ERRMSG,\n        \"ASCII string column is too wide: %ld; max supported width is %d\",\n                   *twidth,  DBUFFSIZE - 1);\n            ffpmsg(message);\n            return(*status = COL_TOO_WIDE);\n        }\n    }\n    else\n       *maxelem = DBUFFSIZE / *twidth; \n\n    /* calc starting byte position to 1st element of col  */\n    /*  (this does not apply to variable length columns)  */\n    *startpos = datastart + ((LONGLONG)(firstrow - 1) * *rowlen) + tbcol;\n\n    if (*hdutype == IMAGE_HDU && writemode) /*  Primary Array or IMAGE */\n    { /*\n        For primary arrays, set the repeat count greater than the total\n        number of pixels to be written.  This prevents an out-of-range\n        error message in cases where the final image array size is not\n        yet known or defined.\n      */\n        if (*repeat < *elemnum + nelem)\n            *repeat = *elemnum + nelem; \n    }\n    else if (*tcode > 0)     /*  Fixed length table column  */\n    {\n        if (*elemnum >= *repeat)\n        {\n            snprintf(message,FLEN_ERRMSG,\n        \"First element to write is too large: %ld; max allowed value is %ld\",\n                   (long) ((*elemnum) + 1), (long) *repeat);\n            ffpmsg(message);\n            return(*status = BAD_ELEM_NUM);\n        }\n\n        /* last row number to be read or written */\n        endrow = ((*elemnum + nelem - 1) / *repeat) + firstrow;\n\n        if (writemode)\n        {\n            /* check if we are writing beyond the current end of table */\n            if ((endrow > (fptr->Fptr)->numrows) && (nelem > 0) )\n            {\n                /* if there are more HDUs following the current one, or */\n                /* if there is a data heap, then we must insert space */\n                /* for the new rows.  */\n                if ( !((fptr->Fptr)->lasthdu) || (fptr->Fptr)->heapsize > 0)\n                {\n                    nrows = endrow - ((fptr->Fptr)->numrows);\n                    if (ffirow(fptr, (fptr->Fptr)->numrows, nrows, status) > 0)\n                    {\n                       snprintf(message,FLEN_ERRMSG,\n                       \"Failed to add space for %.0f new rows in table.\",\n                       (double) nrows);\n                       ffpmsg(message);\n                       return(*status);\n                    }\n                }\n                else\n                {\n                  /* update heap starting address */\n                  (fptr->Fptr)->heapstart += \n                  ((LONGLONG)(endrow - (fptr->Fptr)->numrows) * \n                          (fptr->Fptr)->rowlength );\n\n                  (fptr->Fptr)->numrows = endrow; /* update number of rows */\n                }\n            }\n        }\n        else  /* reading from the file */\n        {\n          if ( endrow > (fptr->Fptr)->numrows && rangecheck)\n          {\n            if (*hdutype == IMAGE_HDU) /*  Primary Array or IMAGE */\n            {\n              if (firstrow > (fptr->Fptr)->numrows)\n              {\n                snprintf(message, FLEN_ERRMSG,\n                  \"Attempted to read from group %ld of the HDU,\", (long) firstrow);\n                ffpmsg(message);\n\n                snprintf(message, FLEN_ERRMSG,\n                  \"however the HDU only contains %ld group(s).\",\n                   (long) ((fptr->Fptr)->numrows) );\n                ffpmsg(message);\n              }\n              else\n              {\n                ffpmsg(\"Attempt to read past end of array:\");\n                snprintf(message, FLEN_ERRMSG,\n                  \"  Image has  %ld elements;\", (long) *repeat);\n                ffpmsg(message);\n\n                snprintf(message, FLEN_ERRMSG, \n                \"  Tried to read %ld elements starting at element %ld.\",\n                (long) nelem, (long) firstelem);\n                ffpmsg(message);\n              }\n            }\n            else\n            {\n              ffpmsg(\"Attempt to read past end of table:\");\n              snprintf(message, FLEN_ERRMSG,\n                \"  Table has %.0f rows with %.0f elements per row;\",\n                    (double) ((fptr->Fptr)->numrows), (double) *repeat);\n              ffpmsg(message);\n\n              snprintf(message, FLEN_ERRMSG,\n              \"  Tried to read %.0f elements starting at row %.0f, element %.0f.\",\n              (double) nelem, (double) firstrow, (double) ((*elemnum) + 1));\n              ffpmsg(message);\n\n            }\n            return(*status = BAD_ROW_NUM);\n          }\n        }\n\n        if (*repeat == 1 && nelem > 1 && writemode != 2)\n        { /*\n            When accessing a scalar column, fool the calling routine into\n            thinking that this is a vector column with very big elements.\n            This allows multiple values (up to the maxelem number of elements\n            that will fit in the buffer) to be read or written with a single\n            routine call, which increases the efficiency.\n\n            If writemode == 2, then the calling program does not want to\n            have this efficiency trick applied.\n          */           \n            if (*rowlen <= LONG_MAX) {\n                *incre = (long) *rowlen;\n                *repeat = nelem;\n            }\n        }\n    }\n    else    /*  Variable length Binary Table column */\n    {\n      *tcode *= (-1);  \n\n      if (writemode)    /* return next empty heap address for writing */\n      {\n\n        *repeat = nelem + *elemnum; /* total no. of elements in the field */\n\n        /* first, check if we are overwriting an existing row, and */\n        /* if so, if the existing space is big enough for the new vector */\n\n        if ( firstrow <= (fptr->Fptr)->numrows )\n        {\n          ffgdesll(fptr, colnum, firstrow, &lrepeat, &heapoffset, &tstatus);\n          if (!tstatus)\n          {\n            if (colptr->tdatatype <= -TCOMPLEX)\n              lrepeat = lrepeat * 2;  /* no. of float or double values */\n            else if (colptr->tdatatype == -TBIT)\n              lrepeat = (lrepeat + 7) / 8;  /* convert from bits to bytes */\n\n            if (lrepeat >= *repeat)  /* enough existing space? */\n            {\n              *startpos = datastart + heapoffset + (fptr->Fptr)->heapstart;\n\n              /*  write the descriptor into the fixed length part of table */\n              if (colptr->tdatatype <= -TCOMPLEX)\n              {\n                /* divide repeat count by 2 to get no. of complex values */\n                ffpdes(fptr, colnum, firstrow, *repeat / 2, \n                      heapoffset, status);\n              }\n              else\n              {\n                ffpdes(fptr, colnum, firstrow, *repeat,\n                      heapoffset, status);\n              }\n              return(*status);\n            }\n          }\n        }\n\n        /* Add more rows to the table, if writing beyond the end. */\n        /* It is necessary to shift the heap down in this case */\n        if ( firstrow > (fptr->Fptr)->numrows)\n        {\n            nrows = firstrow - ((fptr->Fptr)->numrows);\n            if (ffirow(fptr, (fptr->Fptr)->numrows, nrows, status) > 0)\n            {\n                snprintf(message,FLEN_ERRMSG,\n                \"Failed to add space for %.0f new rows in table.\",\n                       (double) nrows);\n                ffpmsg(message);\n                return(*status);\n            }\n        }\n\n        /*  calculate starting position (for writing new data) in the heap */\n        *startpos = datastart + (fptr->Fptr)->heapstart + \n                    (fptr->Fptr)->heapsize;\n\n        /*  write the descriptor into the fixed length part of table */\n        if (colptr->tdatatype <= -TCOMPLEX)\n        {\n          /* divide repeat count by 2 to get no. of complex values */\n          ffpdes(fptr, colnum, firstrow, *repeat / 2, \n                (fptr->Fptr)->heapsize, status);\n        }\n        else\n        {\n          ffpdes(fptr, colnum, firstrow, *repeat, (fptr->Fptr)->heapsize,\n                 status);\n        }\n\n        /* If this is not the last HDU in the file, then check if */\n        /* extending the heap would overwrite the following header. */\n        /* If so, then have to insert more blocks. */\n        if ( !((fptr->Fptr)->lasthdu) )\n        {\n            endpos = datastart + (fptr->Fptr)->heapstart + \n                     (fptr->Fptr)->heapsize + ( *repeat * (*incre));\n\n            if (endpos > (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1])\n            {\n                /* calc the number of blocks that need to be added */\n                nblock = (long) (((endpos - 1 - \n                         (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1] ) \n                         / 2880) + 1);\n\n                if (ffiblk(fptr, nblock, 1, status) > 0) /* insert blocks */\n                {\n                  snprintf(message,FLEN_ERRMSG,\n       \"Failed to extend the size of the variable length heap by %ld blocks.\",\n                   nblock);\n                   ffpmsg(message);\n                   return(*status);\n                }\n            }\n        }\n\n        /* increment the address to the next empty heap position */\n        (fptr->Fptr)->heapsize += ( *repeat * (*incre)); \n      }\n      else    /*  get the read start position in the heap */\n      {\n        if ( firstrow > (fptr->Fptr)->numrows)\n        {\n            ffpmsg(\"Attempt to read past end of table\");\n            snprintf(message,FLEN_ERRMSG, \n                \"  Table has %.0f rows and tried to read row %.0f.\",\n                (double) ((fptr->Fptr)->numrows), (double) firstrow);\n            ffpmsg(message);\n            return(*status = BAD_ROW_NUM);\n        }\n\n        ffgdesll(fptr, colnum, firstrow, &lrepeat, &heapoffset, status);\n        *repeat = lrepeat;\n\n        if (colptr->tdatatype <= -TCOMPLEX)\n            *repeat = *repeat * 2;  /* no. of float or double values */\n        else if (colptr->tdatatype == -TBIT)\n            *repeat = (*repeat + 7) / 8;  /* convert from bits to bytes */\n\n        if (*elemnum >= *repeat)\n        {\n            snprintf(message,FLEN_ERRMSG, \n         \"Starting element to read in variable length column is too large: %ld\",\n                    (long) firstelem);\n            ffpmsg(message);\n            snprintf(message,FLEN_ERRMSG, \n         \"  This row only contains %ld elements\", (long) *repeat);\n            ffpmsg(message);\n            return(*status = BAD_ELEM_NUM);\n        }\n\n        *startpos = datastart + heapoffset + (fptr->Fptr)->heapstart;\n      }\n    }\n    return(*status);\n}\n/*---------------------------------------------------------------------------*/\nint fftheap(fitsfile *fptr, /* I - FITS file pointer                         */\n           LONGLONG *heapsz,   /* O - current size of the heap               */\n           LONGLONG *unused,   /* O - no. of unused bytes in the heap        */\n           LONGLONG *overlap,  /* O - no. of bytes shared by > 1 descriptors */\n           int  *valid,     /* O - are all the heap addresses valid?         */\n           int *status)     /* IO - error status                             */\n/*\n  Tests the contents of the binary table variable length array heap.\n  Returns the number of bytes that are currently not pointed to by any\n  of the descriptors, and also the number of bytes that are pointed to\n  by more than one descriptor.  It returns valid = FALSE if any of the\n  descriptors point to addresses that are out of the bounds of the\n  heap.\n*/\n{\n    int jj, typecode, pixsize;\n    long ii, kk, theapsz, nbytes;\n    LONGLONG repeat, offset, tunused = 0, toverlap = 0;\n    char *buffer, message[FLEN_ERRMSG];\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if ( fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    /* rescan header to make sure everything is up to date */\n    else if ( ffrdef(fptr, status) > 0)               \n        return(*status);\n\n    if (valid) *valid = TRUE;\n    if (heapsz) *heapsz = (fptr->Fptr)->heapsize;\n    if (unused) *unused = 0;\n    if (overlap) *overlap = 0;\n    \n    /* return if this is not a binary table HDU or if the heap is empty */\n    if ( (fptr->Fptr)->hdutype != BINARY_TBL || (fptr->Fptr)->heapsize == 0 )\n        return(*status);\n\n    if ((fptr->Fptr)->heapsize > LONG_MAX) {\n        ffpmsg(\"Heap is too big to test ( > 2**31 bytes). (fftheap)\");\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    theapsz = (long) (fptr->Fptr)->heapsize;\n    buffer = calloc(1, theapsz);     /* allocate temp space */\n    if (!buffer )\n    {\n        snprintf(message,FLEN_ERRMSG,\"Failed to allocate buffer to test the heap\");\n        ffpmsg(message);\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    /* loop over all cols */\n    for (jj = 1; jj <= (fptr->Fptr)->tfield && *status <= 0; jj++)\n    {\n        ffgtcl(fptr, jj, &typecode, NULL, NULL, status);\n        if (typecode > 0)\n           continue;        /* ignore fixed length columns */\n\n        pixsize = -typecode / 10;\n\n        for (ii = 1; ii <= (fptr->Fptr)->numrows; ii++)\n        {\n            ffgdesll(fptr, jj, ii, &repeat, &offset, status);\n            if (typecode == -TBIT)\n                nbytes = (long) (repeat + 7) / 8;\n            else\n                nbytes = (long) repeat * pixsize;\n\n            if (offset < 0 || offset + nbytes > theapsz)\n            {\n                if (valid) *valid = FALSE;  /* address out of bounds */\n                snprintf(message,FLEN_ERRMSG,\n                \"Descriptor in row %ld, column %d has invalid heap address\",\n                ii, jj);\n                ffpmsg(message);\n            }\n            else\n            {\n                for (kk = 0; kk < nbytes; kk++)\n                    buffer[kk + offset]++;   /* increment every used byte */\n            }\n        }\n    }\n\n    for (kk = 0; kk < theapsz; kk++)\n    {\n        if (buffer[kk] == 0)\n            tunused++;\n        else if (buffer[kk] > 1)\n            toverlap++;\n    }\n\n    if (heapsz) *heapsz = theapsz;\n    if (unused) *unused = tunused;\n    if (overlap) *overlap = toverlap;\n\n    free(buffer);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffcmph(fitsfile *fptr,  /* I -FITS file pointer                         */\n           int *status)     /* IO - error status                            */\n/*\n  compress the binary table heap by reordering the contents heap and\n  recovering any unused space\n*/\n{\n    fitsfile *tptr;\n    int jj, typecode, pixsize, valid;\n    long ii, buffsize = 10000, nblock, nbytes;\n    LONGLONG  unused, overlap;\n    LONGLONG repeat, offset;\n    char *buffer, *tbuff, comm[FLEN_COMMENT];\n    char message[FLEN_ERRMSG];\n    LONGLONG pcount;\n    LONGLONG readheapstart, writeheapstart, endpos, t1heapsize, t2heapsize;\n\n    if (*status > 0)\n        return(*status);\n\n    /* get information about the current heap */\n    fftheap(fptr, NULL, &unused, &overlap, &valid, status);\n\n    if (!valid)\n       return(*status = BAD_HEAP_PTR);  /* bad heap pointers */\n\n    /* return if this is not a binary table HDU or if the heap is OK as is */\n    if ( (fptr->Fptr)->hdutype != BINARY_TBL || (fptr->Fptr)->heapsize == 0 ||\n         (unused == 0 && overlap == 0) || *status > 0 )\n        return(*status);\n\n    /* copy the current HDU to a temporary file in memory */\n    if (ffinit( &tptr, \"mem://tempheapfile\", status) )\n    {\n        snprintf(message,FLEN_ERRMSG,\"Failed to create temporary file for the heap\");\n        ffpmsg(message);\n        return(*status);\n    }\n    if ( ffcopy(fptr, tptr, 0, status) )\n    {\n        snprintf(message,FLEN_ERRMSG,\"Failed to create copy of the heap\");\n        ffpmsg(message);\n        ffclos(tptr, status);\n        return(*status);\n    }\n\n    buffer = (char *) malloc(buffsize);  /* allocate initial buffer */\n    if (!buffer)\n    {\n        snprintf(message,FLEN_ERRMSG,\"Failed to allocate buffer to copy the heap\");\n        ffpmsg(message);\n        ffclos(tptr, status);\n        return(*status = MEMORY_ALLOCATION);\n    }\n    \n    readheapstart  = (tptr->Fptr)->datastart + (tptr->Fptr)->heapstart;\n    writeheapstart = (fptr->Fptr)->datastart + (fptr->Fptr)->heapstart;\n\n    t1heapsize = (fptr->Fptr)->heapsize;  /* save original heap size */\n    (fptr->Fptr)->heapsize = 0;  /* reset heap to zero */\n\n    /* loop over all cols */\n    for (jj = 1; jj <= (fptr->Fptr)->tfield && *status <= 0; jj++)\n    {\n        ffgtcl(tptr, jj, &typecode, NULL, NULL, status);\n        if (typecode > 0)\n           continue;        /* ignore fixed length columns */\n\n        pixsize = -typecode / 10;\n\n        /* copy heap data, row by row */\n        for (ii = 1; ii <= (fptr->Fptr)->numrows; ii++)\n        {\n            ffgdesll(tptr, jj, ii, &repeat, &offset, status);\n            if (typecode == -TBIT)\n                nbytes = (long) (repeat + 7) / 8;\n            else\n                nbytes = (long) repeat * pixsize;\n\n            /* increase size of buffer if necessary to read whole array */\n            if (nbytes > buffsize)\n            {\n                tbuff = realloc(buffer, nbytes);\n\n                if (tbuff)\n                {\n                    buffer = tbuff;\n                    buffsize = nbytes;\n                }\n                else\n                    *status = MEMORY_ALLOCATION;\n            }\n\n            /* If this is not the last HDU in the file, then check if */\n            /* extending the heap would overwrite the following header. */\n            /* If so, then have to insert more blocks. */\n            if ( !((fptr->Fptr)->lasthdu) )\n            {\n              endpos = writeheapstart + (fptr->Fptr)->heapsize + nbytes;\n\n              if (endpos > (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1])\n              {\n                /* calc the number of blocks that need to be added */\n                nblock = (long) (((endpos - 1 - \n                         (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1] ) \n                         / 2880) + 1);\n\n                if (ffiblk(fptr, nblock, 1, status) > 0) /* insert blocks */\n                {\n                  snprintf(message,FLEN_ERRMSG,\n       \"Failed to extend the size of the variable length heap by %ld blocks.\",\n                   nblock);\n                   ffpmsg(message);\n                }\n              }\n            }\n\n            /* read arrray of bytes from temporary copy */\n            ffmbyt(tptr, readheapstart + offset, REPORT_EOF, status);\n            ffgbyt(tptr, nbytes, buffer, status);\n\n            /* write arrray of bytes back to original file */\n            ffmbyt(fptr, writeheapstart + (fptr->Fptr)->heapsize, \n                    IGNORE_EOF, status);\n            ffpbyt(fptr, nbytes, buffer, status);\n\n            /* write descriptor */\n            ffpdes(fptr, jj, ii, repeat, \n                   (fptr->Fptr)->heapsize, status);\n\n            (fptr->Fptr)->heapsize += nbytes; /* update heapsize */\n\n            if (*status > 0)\n            {\n               free(buffer);\n               ffclos(tptr, status);\n               return(*status);\n            }\n        }\n    }\n\n    free(buffer);\n    ffclos(tptr, status);\n\n    /* delete any empty blocks at the end of the HDU */\n    nblock = (long) (( (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1] -\n             (writeheapstart + (fptr->Fptr)->heapsize) ) / 2880);\n\n    if (nblock > 0)\n    {\n       t2heapsize = (fptr->Fptr)->heapsize;  /* save new heap size */\n       (fptr->Fptr)->heapsize = t1heapsize;  /* restore  original heap size */\n\n       ffdblk(fptr, nblock, status);\n       (fptr->Fptr)->heapsize = t2heapsize;  /* reset correct heap size */\n    }\n\n    /* update the PCOUNT value (size of heap) */\n    ffmaky(fptr, 2, status);         /* reset to beginning of header */\n\n    ffgkyjj(fptr, \"PCOUNT\", &pcount, comm, status);\n    if ((fptr->Fptr)->heapsize != pcount)\n    {\n        ffmkyj(fptr, \"PCOUNT\", (fptr->Fptr)->heapsize, comm, status);\n    }\n    ffrdef(fptr, status);  /* rescan new HDU structure */\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgdes(fitsfile *fptr, /* I - FITS file pointer                         */\n           int colnum,     /* I - column number (1 = 1st column of table)   */\n           LONGLONG rownum,    /* I - row number (1 = 1st row of table)         */\n           long *length,   /* O - number of elements in the row             */\n           long *heapaddr, /* O - heap pointer to the data                  */\n           int *status)    /* IO - error status                             */\n/*\n  get (read) the variable length vector descriptor from the table.\n*/\n{\n    LONGLONG lengthjj, heapaddrjj;\n    \n    if (ffgdesll(fptr, colnum, rownum, &lengthjj, &heapaddrjj, status) > 0)\n        return(*status);\n\n    /* convert the temporary 8-byte values to 4-byte values */\n    /* check for overflow */\n    if (length) {\n        if (lengthjj > LONG_MAX)\n\t    *status = NUM_OVERFLOW;\n\telse\n            *length = (long) lengthjj;\n    }\n    \n    if (heapaddr) {\n        if (heapaddrjj > LONG_MAX)\n\t    *status = NUM_OVERFLOW;\n\telse\n            *heapaddr = (long) heapaddrjj;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgdesll(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int colnum,         /* I - column number (1 = 1st column of table) */\n           LONGLONG rownum,        /* I - row number (1 = 1st row of table)       */\n           LONGLONG *length,   /* O - number of elements in the row           */\n           LONGLONG *heapaddr, /* O - heap pointer to the data                */\n           int *status)        /* IO - error status                           */\n/*\n  get (read) the variable length vector descriptor from the binary table.\n  This is similar to ffgdes, except it supports the full 8-byte range of the\n  length and offset values in 'Q' columns, as well as 'P' columns.\n*/\n{\n    LONGLONG bytepos;\n    unsigned int descript4[2] = {0,0};\n    LONGLONG descript8[2] = {0,0};\n    tcolumn *colptr;\n\n    if (*status > 0)\n       return(*status);\n       \n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    colptr = (fptr->Fptr)->tableptr;  /* point to first column structure */\n    colptr += (colnum - 1);   /* offset to the correct column */\n\n    if (colptr->tdatatype >= 0) {\n        *status = NOT_VARI_LEN;\n        return(*status);\n    }\n\n    bytepos = (fptr->Fptr)->datastart + \n                  ((fptr->Fptr)->rowlength * (rownum - 1)) +\n                   colptr->tbcol;\n\n    if (colptr->tform[0] == 'P' || colptr->tform[1] == 'P')\n    {\n        /* read 4-byte descriptor */\n        if (ffgi4b(fptr, bytepos, 2, 4, (INT32BIT *) descript4, status) <= 0) \n        {\n           if (length)\n             *length = (LONGLONG) descript4[0];   /* 1st word is the length  */\n           if (heapaddr)\n             *heapaddr = (LONGLONG) descript4[1]; /* 2nd word is the address */\n        }\n\n    }\n    else  /* this is for 'Q' columns */\n    {\n        /* read 8 byte descriptor */\n        if (ffgi8b(fptr, bytepos, 2, 8, (long *) descript8, status) <= 0) \n        {\n           if (length)\n             *length = descript8[0];   /* 1st word is the length  */\n           if (heapaddr)\n             *heapaddr = descript8[1]; /* 2nd word is the address */\n        }\n    }     \n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgdess(fitsfile *fptr, /* I - FITS file pointer                        */\n           int colnum,     /* I - column number (1 = 1st column of table)   */\n           LONGLONG firstrow,  /* I - first row  (1 = 1st row of table)         */\n           LONGLONG nrows,     /* I - number or rows to read                    */\n           long *length,   /* O - number of elements in the row             */\n           long *heapaddr, /* O - heap pointer to the data                  */\n           int *status)    /* IO - error status                             */\n/*\n  get (read) a range of variable length vector descriptors from the table.\n*/\n{\n    LONGLONG rowsize, bytepos;\n    long  ii;\n    INT32BIT descript4[2] = {0,0};\n    LONGLONG descript8[2] = {0,0};\n    tcolumn *colptr;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    colptr = (fptr->Fptr)->tableptr;  /* point to first column structure */\n    colptr += (colnum - 1);   /* offset to the correct column */\n\n    if (colptr->tdatatype >= 0) {\n        *status = NOT_VARI_LEN;\n        return(*status);\n    }\n    \n    rowsize = (fptr->Fptr)->rowlength;\n    bytepos = (fptr->Fptr)->datastart + \n                  (rowsize  * (firstrow - 1)) +\n                  colptr->tbcol;\n\n    if (colptr->tform[0] == 'P' || colptr->tform[1] == 'P')\n    {\n        /* read 4-byte descriptors */\n        for (ii = 0; ii < nrows; ii++)\n        {\n\t    /* read descriptors */\n            if (ffgi4b(fptr, bytepos, 2, 4, descript4, status) <= 0)\n\t    { \n              if (length) {\n                *length =   (long) descript4[0];   /* 1st word is the length  */\n                length++;\n\t      }\n\n              if (heapaddr) {\n                *heapaddr = (long) descript4[1];   /* 2nd word is the address */\n                heapaddr++;\n\t      }\n              bytepos += rowsize;\n\t    }\n\t    else\n\t      return(*status);\n        }\n    }\n    else  /* this is for 'Q' columns */\n    {\n        /* read 8-byte descriptors */\n        for (ii = 0; ii < nrows; ii++)\n        {\n\t    /* read descriptors */\n            if (ffgi8b(fptr, bytepos, 2, 8, (long *) descript8, status) <= 0)\n\t    { \n              if (length) {\n\t        if (descript8[0] > LONG_MAX)*status = NUM_OVERFLOW;\n                *length =   (long) descript8[0];   /* 1st word is the length  */\n                length++;\n\t      }\n              if (heapaddr) {\n\t        if (descript8[1] > LONG_MAX)*status = NUM_OVERFLOW;\n                *heapaddr = (long) descript8[1];   /* 2nd word is the address */\n                heapaddr++;\n\t      }\n              bytepos += rowsize;\n\t    }\n\t    else\n\t      return(*status);\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgdessll(fitsfile *fptr, /* I - FITS file pointer                      */\n           int colnum,     /* I - column number (1 = 1st column of table)   */\n           LONGLONG firstrow,  /* I - first row  (1 = 1st row of table)         */\n           LONGLONG nrows,     /* I - number or rows to read                    */\n           LONGLONG *length,   /* O - number of elements in the row         */\n           LONGLONG *heapaddr, /* O - heap pointer to the data              */\n           int *status)    /* IO - error status                             */\n/*\n  get (read) a range of variable length vector descriptors from the table.\n*/\n{\n    LONGLONG rowsize, bytepos;\n    long  ii;\n    unsigned int descript4[2] = {0,0};\n    LONGLONG descript8[2] = {0,0};\n    tcolumn *colptr;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    colptr = (fptr->Fptr)->tableptr;  /* point to first column structure */\n    colptr += (colnum - 1);           /* offset to the correct column */\n\n    if (colptr->tdatatype >= 0) {\n        *status = NOT_VARI_LEN;\n        return(*status);\n    }\n\n    rowsize = (fptr->Fptr)->rowlength;\n    bytepos = (fptr->Fptr)->datastart + \n                  (rowsize  * (firstrow - 1)) +\n                  colptr->tbcol;\n\n    if (colptr->tform[0] == 'P' || colptr->tform[1] == 'P')\n    {\n        /* read 4-byte descriptors */\n        for (ii = 0; ii < nrows; ii++)\n        {\n\t    /* read descriptors */\n            if (ffgi4b(fptr, bytepos, 2, 4, (INT32BIT *) descript4, status) <= 0)\n\t    { \n              if (length) {\n                *length =   (LONGLONG) descript4[0];   /* 1st word is the length  */\n                length++;\n\t      }\n\n              if (heapaddr) {\n                *heapaddr = (LONGLONG) descript4[1];   /* 2nd word is the address */\n                heapaddr++;\n\t      }\n              bytepos += rowsize;\n\t    }\n\t    else\n\t      return(*status);\n        }\n    }\n    else  /* this is for 'Q' columns */\n    {\n        /* read 8-byte descriptors */\n        for (ii = 0; ii < nrows; ii++)\n        {\n\t    /* read descriptors */\n\t    /* cast to type (long *) even though it is actually (LONGLONG *) */\n            if (ffgi8b(fptr, bytepos, 2, 8, (long *) descript8, status) <= 0)\n\t    { \n              if (length) {\n                *length =   descript8[0];   /* 1st word is the length  */\n                length++;\n\t      }\n\n              if (heapaddr) {\n                *heapaddr = descript8[1];   /* 2nd word is the address */\n                heapaddr++;\n\t      }\n              bytepos += rowsize;\n\t    }\n\t    else\n\t      return(*status);\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpdes(fitsfile *fptr,  /* I - FITS file pointer                         */\n           int colnum,      /* I - column number (1 = 1st column of table)   */\n           LONGLONG rownum,     /* I - row number (1 = 1st row of table)         */\n           LONGLONG length,    /* I - number of elements in the row             */\n           LONGLONG heapaddr,  /* I - heap pointer to the data                  */\n           int *status)     /* IO - error status                             */\n/*\n  put (write) the variable length vector descriptor to the table.\n*/\n{\n    LONGLONG bytepos;\n    unsigned int descript4[2];\n    LONGLONG descript8[2];\n    tcolumn *colptr;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    colptr = (fptr->Fptr)->tableptr;  /* point to first column structure */\n    colptr += (colnum - 1);   /* offset to the correct column */\n\n    if (colptr->tdatatype >= 0)\n        *status = NOT_VARI_LEN;\n\n    bytepos = (fptr->Fptr)->datastart + \n                  ((fptr->Fptr)->rowlength * (rownum - 1)) +\n                  colptr->tbcol;\n\n    ffmbyt(fptr, bytepos, IGNORE_EOF, status); /* move to element */\n\n    if (colptr->tform[0] == 'P' || colptr->tform[1] == 'P')\n    {\n        if (length   > UINT_MAX || length   < 0 ||\n            heapaddr > UINT_MAX || heapaddr < 0) {\n            ffpmsg(\"P variable length column descriptor is out of range\");\n\t    *status = NUM_OVERFLOW;\n            return(*status);\n        }\n           \n        descript4[0] = (unsigned int) length;   /* 1st word is the length  */\n        descript4[1] = (unsigned int) heapaddr; /* 2nd word is the address */\n \n        ffpi4b(fptr, 2, 4, (INT32BIT *) descript4, status); /* write the descriptor */\n    }\n    else /* this is a 'Q' descriptor column */\n    {\n        descript8[0] =  length;   /* 1st word is the length  */\n        descript8[1] =  heapaddr; /* 2nd word is the address */\n \n        ffpi8b(fptr, 2, 8, (long *) descript8, status); /* write the descriptor */\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffchdu(fitsfile *fptr,      /* I - FITS file pointer */\n           int *status)         /* IO - error status     */\n{\n/*\n  close the current HDU.  If we have write access to the file, then:\n    - write the END keyword and pad header with blanks if necessary\n    - check the data fill values, and rewrite them if not correct\n*/\n    char message[FLEN_ERRMSG];\n    int ii, stdriver, ntilebins;\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n        /* no need to do any further updating of the HDU */\n    }\n    else if ((fptr->Fptr)->writemode == 1)\n    {\n        urltype2driver(\"stream://\", &stdriver);\n\n        /* don't rescan header in special case of writing to stdout */\n        if (((fptr->Fptr)->driver != stdriver)) \n             ffrdef(fptr, status); \n\n        if ((fptr->Fptr)->heapsize > 0) {\n          ffuptf(fptr, status);  /* update the variable length TFORM values */\n        }\n\t\n        ffpdfl(fptr, status);  /* insure correct data fill values */\n    }\n\n    if ((fptr->Fptr)->open_count == 1)\n    {\n\n    /* free memory for the CHDU structure only if no other files are using it */\n        if ((fptr->Fptr)->tableptr)\n        {\n            free((fptr->Fptr)->tableptr);\n           (fptr->Fptr)->tableptr = NULL;\n\n          /* free the tile-compressed image cache, if it exists */\n          if ((fptr->Fptr)->tilerow) {\n\n           ntilebins = \n\t    (((fptr->Fptr)->znaxis[0] - 1) / ((fptr->Fptr)->tilesize[0])) + 1;\n\n           for (ii = 0; ii < ntilebins; ii++) {\n             if ((fptr->Fptr)->tiledata[ii]) {\n\t       free((fptr->Fptr)->tiledata[ii]);\n             }\n\n             if ((fptr->Fptr)->tilenullarray[ii]) {\n\t       free((fptr->Fptr)->tilenullarray[ii]);\n             }\n            }\n\t    \n\t    free((fptr->Fptr)->tileanynull);\n\t    free((fptr->Fptr)->tiletype);\t   \n\t    free((fptr->Fptr)->tiledatasize);\n\t    free((fptr->Fptr)->tilenullarray);\n\t    free((fptr->Fptr)->tiledata);\n\t    free((fptr->Fptr)->tilerow);\n\n\t    (fptr->Fptr)->tileanynull = 0;\n\t    (fptr->Fptr)->tiletype = 0;\t   \n\t    (fptr->Fptr)->tiledatasize = 0;\n\t    (fptr->Fptr)->tilenullarray = 0;\n\t    (fptr->Fptr)->tiledata = 0;\n\t    (fptr->Fptr)->tilerow = 0;\n          }\n        }\n    }\n\n    if (*status > 0 && *status != NO_CLOSE_ERROR)\n    {\n        snprintf(message,FLEN_ERRMSG,\n        \"Error while closing HDU number %d (ffchdu).\", (fptr->Fptr)->curhdu);\n        ffpmsg(message);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffuptf(fitsfile *fptr,      /* I - FITS file pointer */\n           int *status)         /* IO - error status     */\n/*\n  Update the value of the TFORM keywords for the variable length array\n  columns to make sure they all have the form 1Px(len) or Px(len) where\n  'len' is the maximum length of the vector in the table (e.g., '1PE(400)')\n*/\n{\n    int ii, lenform=0;\n    long tflds;\n    LONGLONG length, addr, maxlen, naxis2, jj;\n    char comment[FLEN_COMMENT], keyname[FLEN_KEYWORD];\n    char tform[FLEN_VALUE], newform[FLEN_VALUE], lenval[40];\n    char card[FLEN_CARD];\n    char message[FLEN_ERRMSG];\n    char *tmp;\n\n    ffmaky(fptr, 2, status);         /* reset to beginning of header */\n    ffgkyjj(fptr, \"NAXIS2\", &naxis2, comment, status);\n    ffgkyj(fptr, \"TFIELDS\", &tflds, comment, status);\n\n    for (ii = 1; ii <= tflds; ii++)        /* loop over all the columns */\n    {\n      ffkeyn(\"TFORM\", ii, keyname, status);          /* construct name */\n      if (ffgkys(fptr, keyname, tform, comment, status) > 0)\n      {\n        snprintf(message,FLEN_ERRMSG,\n        \"Error while updating variable length vector TFORMn values (ffuptf).\");\n        ffpmsg(message);\n        return(*status);\n      }\n      /* is this a variable array length column ? */\n      if (tform[0] == 'P' || tform[1] == 'P' || tform[0] == 'Q' || tform[1] == 'Q')\n      {\n          /* get the max length */\n          maxlen = 0;\n          for (jj=1; jj <= naxis2; jj++)\n          {\n            ffgdesll(fptr, ii, jj, &length, &addr, status);\n\n\t    if (length > maxlen)\n\t         maxlen = length;\n          }\n\n          /* construct the new keyword value */\n          strcpy(newform, \"'\");\n          tmp = strchr(tform, '(');  /* truncate old length, if present */\n          if (tmp) *tmp = 0;\n          lenform = strlen(tform);\n\n          /* print as double, because the string-to-64-bit */\n          /* conversion is platform dependent (%lld, %ld, %I64d) */\n\n          snprintf(lenval,40, \"(%.0f)\", (double) maxlen);\n          \n          if (lenform+strlen(lenval)+2 > FLEN_VALUE-1)\n          {\n             ffpmsg(\"Error assembling TFORMn string (ffuptf).\");\n             return(*status = BAD_TFORM);\n          }\n          strcat(newform, tform);\n\n          strcat(newform,lenval);\n          while(strlen(newform) < 9)\n             strcat(newform,\" \");   /* append spaces 'till length = 8 */\n          strcat(newform,\"'\" );     /* append closing parenthesis */\n          /* would be simpler to just call ffmkyj here, but this */\n          /* would force linking in all the modkey & putkey routines */\n          ffmkky(keyname, newform, comment, card, status);  /* make new card */\n          ffmkey(fptr, card, status);   /* replace last read keyword */\n      }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffrdef(fitsfile *fptr,      /* I - FITS file pointer */\n           int *status)         /* IO - error status     */\n/*\n  ReDEFine the structure of a data unit.  This routine re-reads\n  the CHDU header keywords to determine the structure and length of the\n  current data unit.  This redefines the start of the next HDU.\n*/\n{\n    int dummy, tstatus = 0;\n    LONGLONG naxis2;\n    LONGLONG pcount;\n    char card[FLEN_CARD], comm[FLEN_COMMENT], valstring[FLEN_VALUE];\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->writemode == 1) /* write access to the file? */\n    {\n        /* don't need to check NAXIS2 and PCOUNT if data hasn't been written */\n        if ((fptr->Fptr)->datastart != DATA_UNDEFINED)\n        {\n          /* update NAXIS2 keyword if more rows were written to the table */\n          /* and if the user has not explicitly reset the NAXIS2 value */\n          if ((fptr->Fptr)->hdutype != IMAGE_HDU)\n          {\n            ffmaky(fptr, 2, status);\n            if (ffgkyjj(fptr, \"NAXIS2\", &naxis2, comm, &tstatus) > 0)\n            {\n                /* Couldn't read NAXIS2 (odd!);  in certain circumstances */\n                /* this may be normal, so ignore the error. */\n                naxis2 = (fptr->Fptr)->numrows;\n            }\n\n            if ((fptr->Fptr)->numrows > naxis2\n              && (fptr->Fptr)->origrows == naxis2)\n              /* if origrows is not equal to naxis2, then the user must */\n              /* have manually modified the NAXIS2 keyword value, and */\n              /* we will assume that the current value is correct. */\n            {\n              /* would be simpler to just call ffmkyj here, but this */\n              /* would force linking in all the modkey & putkey routines */\n\n              /* print as double because the 64-bit int conversion */\n              /* is platform dependent (%lld, %ld, %I64 )          */\n\n              snprintf(valstring,FLEN_VALUE, \"%.0f\", (double) ((fptr->Fptr)->numrows));\n\n              ffmkky(\"NAXIS2\", valstring, comm, card, status);\n              ffmkey(fptr, card, status);\n            }\n          }\n\n          /* if data has been written to variable length columns in a  */\n          /* binary table, then we may need to update the PCOUNT value */\n          if ((fptr->Fptr)->heapsize > 0)\n          {\n            ffmaky(fptr, 2, status);\n            ffgkyjj(fptr, \"PCOUNT\", &pcount, comm, status);\n            if ((fptr->Fptr)->heapsize != pcount)\n            {\n              ffmkyj(fptr, \"PCOUNT\", (fptr->Fptr)->heapsize, comm, status);\n            }\n          }\n        }\n\n        if (ffwend(fptr, status) <= 0)     /* rewrite END keyword and fill */\n        {\n            ffrhdu(fptr, &dummy, status);  /* re-scan the header keywords  */\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffhdef(fitsfile *fptr,      /* I - FITS file pointer                    */\n           int morekeys,        /* I - reserve space for this many keywords */\n           int *status)         /* IO - error status                        */\n/*\n  based on the number of keywords which have already been written,\n  plus the number of keywords to reserve space for, we then can\n  define where the data unit should start (it must start at the\n  beginning of a 2880-byte logical block).\n\n  This routine will only have any effect if the starting location of the\n  data unit following the header is not already defined.  In any case,\n  it is always possible to add more keywords to the header even if the\n  data has already been written.  It is just more efficient to reserve\n  the space in advance.\n*/\n{\n    LONGLONG delta;\n\n    if (*status > 0 || morekeys < 1)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n      ffrdef(fptr, status);\n\n      /* ffrdef defines the offset to datastart and the start of */\n      /* the next HDU based on the number of existing keywords. */\n      /* We need to increment both of these values based on */\n      /* the number of new keywords to be added.  */\n\n      delta = (((fptr->Fptr)->headend + (morekeys * 80)) / 2880 + 1)\n                                * 2880 - (fptr->Fptr)->datastart; \n              \n      (fptr->Fptr)->datastart += delta;\n\n      (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1] += delta;\n\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffwend(fitsfile *fptr,       /* I - FITS file pointer */\n            int *status)         /* IO - error status     */\n/*\n  write the END card and following fill (space chars) in the current header\n*/\n{\n    int ii, tstatus;\n    LONGLONG endpos;\n    long nspace;\n    char blankkey[FLEN_CARD], endkey[FLEN_CARD], keyrec[FLEN_CARD] = \"\";\n\n    if (*status > 0)\n        return(*status);\n\n    endpos = (fptr->Fptr)->headend;\n\n    /* we assume that the HDUposition == curhdu in all cases */\n\n    /*  calc the data starting position if not currently defined */\n    if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        (fptr->Fptr)->datastart = ( endpos / 2880 + 1 ) * 2880;\n\n    /* calculate the number of blank keyword slots in the header */\n    nspace = (long) (( (fptr->Fptr)->datastart - endpos ) / 80);\n\n    /* construct a blank and END keyword (80 spaces )  */\n    strcpy(blankkey, \"                                        \");\n    strcat(blankkey, \"                                        \");\n    strcpy(endkey, \"END                                     \");\n    strcat(endkey, \"                                        \");\n  \n    /* check if header is already correctly terminated with END and fill */\n    tstatus=0;\n    ffmbyt(fptr, endpos, REPORT_EOF, &tstatus); /* move to header end */\n    for (ii=0; ii < nspace; ii++)\n    {\n        ffgbyt(fptr, 80, keyrec, &tstatus);  /* get next keyword */\n        if (tstatus) break;\n        if (strncmp(keyrec, blankkey, 80) && strncmp(keyrec, endkey, 80))\n            break;\n    }\n\n    if (ii == nspace && !tstatus)\n    {\n        /* check if the END keyword exists at the correct position */\n        endpos=maxvalue( endpos, ( (fptr->Fptr)->datastart - 2880 ) );\n        ffmbyt(fptr, endpos, REPORT_EOF, &tstatus);  /* move to END position */\n        ffgbyt(fptr, 80, keyrec, &tstatus); /* read the END keyword */\n        if ( !strncmp(keyrec, endkey, 80) && !tstatus) {\n\n            /* store this position, for later reference */\n            (fptr->Fptr)->ENDpos = endpos;\n\n            return(*status);    /* END card was already correct */\n         }\n    }\n\n    /* header was not correctly terminated, so write the END and blank fill */\n    endpos = (fptr->Fptr)->headend;\n    ffmbyt(fptr, endpos, IGNORE_EOF, status); /* move to header end */\n    for (ii=0; ii < nspace; ii++)\n        ffpbyt(fptr, 80, blankkey, status);  /* write the blank keywords */\n\n    /*\n    The END keyword must either be placed immediately after the last\n    keyword that was written (as indicated by the headend value), or\n    must be in the first 80 bytes of the 2880-byte FITS record immediately \n    preceeding the data unit, whichever is further in the file. The\n    latter will occur if space has been reserved for more header keywords\n    which have not yet been written.\n    */\n\n    endpos=maxvalue( endpos, ( (fptr->Fptr)->datastart - 2880 ) );\n    ffmbyt(fptr, endpos, REPORT_EOF, status);  /* move to END position */\n\n    ffpbyt(fptr, 80, endkey, status); /*  write the END keyword to header */\n    \n    /* store this position, for later reference */\n    (fptr->Fptr)->ENDpos = endpos;\n\n    if (*status > 0)\n        ffpmsg(\"Error while writing END card (ffwend).\");\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpdfl(fitsfile *fptr,      /* I - FITS file pointer */\n           int *status)         /* IO - error status     */\n/*\n  Write the Data Unit Fill values if they are not already correct.\n  The fill values are used to fill out the last 2880 byte block of the HDU.\n  Fill the data unit with zeros or blanks depending on the type of HDU\n  from the end of the data to the end of the current FITS 2880 byte block\n*/\n{\n    char chfill, fill[2880];\n    LONGLONG fillstart;\n    int nfill, tstatus, ii;\n\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        return(*status);      /* fill has already been correctly written */\n\n    if ((fptr->Fptr)->heapstart == 0)\n        return(*status);      /* null data unit, so there is no fill */\n\n    fillstart = (fptr->Fptr)->datastart + (fptr->Fptr)->heapstart +\n                (fptr->Fptr)->heapsize;\n\n    nfill = (long) ((fillstart + 2879) / 2880 * 2880 - fillstart);\n\n    if ((fptr->Fptr)->hdutype == ASCII_TBL)\n        chfill = 32;         /* ASCII tables are filled with spaces */\n    else\n        chfill = 0;          /* all other extensions are filled with zeros */\n\n    tstatus = 0;\n\n    if (!nfill)  /* no fill bytes; just check that entire table exists */\n    {\n        fillstart--;\n        nfill = 1;\n        ffmbyt(fptr, fillstart, REPORT_EOF, &tstatus); /* move to last byte */\n        ffgbyt(fptr, nfill, fill, &tstatus);           /* get the last byte */\n\n        if (tstatus == 0)\n            return(*status);  /* no EOF error, so everything is OK */\n    }\n    else\n    {\n        ffmbyt(fptr, fillstart, REPORT_EOF, &tstatus); /* move to fill area */\n        ffgbyt(fptr, nfill, fill, &tstatus);           /* get the fill bytes */\n\n        if (tstatus == 0)\n        {\n            for (ii = 0; ii < nfill; ii++)\n            {\n                if (fill[ii] != chfill)\n                    break;\n            }\n\n            if (ii == nfill)\n                return(*status);   /* all the fill values were correct */\n        }\n    }\n\n    /* fill values are incorrect or have not been written, so write them */\n\n    memset(fill, chfill, nfill);  /* fill the buffer with the fill value */\n\n    ffmbyt(fptr, fillstart, IGNORE_EOF, status); /* move to fill area */\n    ffpbyt(fptr, nfill, fill, status); /* write the fill bytes */\n\n    if (*status > 0)\n        ffpmsg(\"Error writing Data Unit fill bytes (ffpdfl).\");\n\n    return(*status);\n}\n/**********************************************************************\n   ffchfl : Check Header Fill values\n\n      Check that the header unit is correctly filled with blanks from\n      the END card to the end of the current FITS 2880-byte block\n\n         Function parameters:\n            fptr     Fits file pointer\n            status   output error status\n\n    Translated ftchfl into C by Peter Wilson, Oct. 1997\n**********************************************************************/\nint ffchfl( fitsfile *fptr, int *status)\n{\n   int nblank,i,gotend;\n   LONGLONG endpos;\n   char rec[FLEN_CARD];\n   char *blanks=\"                                                                                \";  /*  80 spaces  */\n\n   if( *status > 0 ) return (*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n   /*   calculate the number of blank keyword slots in the header  */\n\n   endpos=(fptr->Fptr)->headend;\n   nblank=(long) (((fptr->Fptr)->datastart-endpos)/80);\n\n   /*   move the i/o pointer to the end of the header keywords   */\n\n   ffmbyt(fptr,endpos,TRUE,status);\n\n   /*   find the END card (there may be blank keywords perceeding it)   */\n\n   gotend=FALSE;\n   for(i=0;i<nblank;i++) {\n      ffgbyt(fptr,80,rec,status);\n      if( !strncmp(rec, \"END     \", 8) ) {\n         if( gotend ) {\n            /*   There is a duplicate END record   */\n            *status=BAD_HEADER_FILL;\n            ffpmsg(\"Warning: Header fill area contains duplicate END card:\");\n         }\n         gotend=TRUE;\n         if( strncmp( rec+8, blanks+8, 72) ) {\n            /*   END keyword has extra characters   */\n            *status=END_JUNK;\n            ffpmsg(\n            \"Warning: END keyword contains extraneous non-blank characters:\");\n         }\n      } else if( gotend ) {\n         if( strncmp( rec, blanks, 80 ) ) {\n            /*   The fill area contains extraneous characters   */\n            *status=BAD_HEADER_FILL;\n            ffpmsg(\n         \"Warning: Header fill area contains extraneous non-blank characters:\");\n         }\n      }\n\n      if( *status > 0 ) {\n         rec[FLEN_CARD - 1] = '\\0';  /* make sure string is null terminated */\n         ffpmsg(rec);\n         return( *status );\n      }\n   }\n   return( *status );\n}\n\n/**********************************************************************\n   ffcdfl : Check Data Unit Fill values\n\n      Check that the data unit is correctly filled with zeros or\n      blanks from the end of the data to the end of the current\n      FITS 2880 byte block\n\n         Function parameters:\n            fptr     Fits file pointer\n            status   output error status\n\n    Translated ftcdfl into C by Peter Wilson, Oct. 1997\n**********************************************************************/\nint ffcdfl( fitsfile *fptr, int *status)\n{\n   int nfill,i;\n   LONGLONG filpos;\n   char chfill,chbuff[2880];\n\n   if( *status > 0 ) return( *status );\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n   /*   check if the data unit is null   */\n   if( (fptr->Fptr)->heapstart==0 ) return( *status );\n\n   /* calculate starting position of the fill bytes, if any */\n   filpos = (fptr->Fptr)->datastart \n          + (fptr->Fptr)->heapstart \n          + (fptr->Fptr)->heapsize;\n\n   /*   calculate the number of fill bytes   */\n   nfill = (long) ((filpos + 2879) / 2880 * 2880 - filpos);\n   if( nfill == 0 ) return( *status );\n\n   /*   move to the beginning of the fill bytes   */\n   ffmbyt(fptr, filpos, FALSE, status);\n\n   if( ffgbyt(fptr, nfill, chbuff, status) > 0)\n   {\n      ffpmsg(\"Error reading data unit fill bytes (ffcdfl).\");\n      return( *status );\n   }\n\n   if( (fptr->Fptr)->hdutype==ASCII_TBL )\n      chfill = 32;         /* ASCII tables are filled with spaces */\n   else\n      chfill = 0;          /* all other extensions are filled with zeros */\n   \n   /*   check for all zeros or blanks   */\n   \n   for(i=0;i<nfill;i++) {\n      if( chbuff[i] != chfill ) {\n         *status=BAD_DATA_FILL;\n         if( (fptr->Fptr)->hdutype==ASCII_TBL )\n            ffpmsg(\"Warning: remaining bytes following ASCII table data are not filled with blanks.\");\n         else\n            ffpmsg(\"Warning: remaining bytes following data are not filled with zeros.\");\n         return( *status );\n      }\n   }\n   return( *status );\n}\n/*--------------------------------------------------------------------------*/\nint ffcrhd(fitsfile *fptr,      /* I - FITS file pointer */\n           int *status)         /* IO - error status     */\n/*\n  CReate Header Data unit:  Create, initialize, and move the i/o pointer\n  to a new extension appended to the end of the FITS file.\n*/\n{\n    int  tstatus = 0;\n    LONGLONG bytepos, *ptr;\n\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    /* If the current header is empty, we don't have to do anything */\n    if ((fptr->Fptr)->headend == (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] )\n        return(*status);\n\n    while (ffmrhd(fptr, 1, 0, &tstatus) == 0);  /* move to end of file */\n\n    if ((fptr->Fptr)->maxhdu == (fptr->Fptr)->MAXHDU)\n    {\n        /* allocate more space for the headstart array */\n        ptr = (LONGLONG*) realloc( (fptr->Fptr)->headstart,\n                        ((fptr->Fptr)->MAXHDU + 1001) * sizeof(LONGLONG) );\n\n        if (ptr == NULL)\n           return (*status = MEMORY_ALLOCATION);\n        else {\n          (fptr->Fptr)->MAXHDU = (fptr->Fptr)->MAXHDU + 1000;\n          (fptr->Fptr)->headstart = ptr;\n        }\n    }\n\n    if (ffchdu(fptr, status) <= 0)  /* close the current HDU */\n    {\n      bytepos = (fptr->Fptr)->headstart[(fptr->Fptr)->maxhdu + 1]; /* last */\n      ffmbyt(fptr, bytepos, IGNORE_EOF, status);  /* move file ptr to it */\n      (fptr->Fptr)->maxhdu++;       /* increment the known number of HDUs */\n      (fptr->Fptr)->curhdu = (fptr->Fptr)->maxhdu; /* set current HDU loc */\n      fptr->HDUposition    = (fptr->Fptr)->maxhdu; /* set current HDU loc */\n      (fptr->Fptr)->nextkey = bytepos;    /* next keyword = start of header */\n      (fptr->Fptr)->headend = bytepos;          /* end of header */\n      (fptr->Fptr)->datastart = DATA_UNDEFINED; /* start data unit undefined */\n\n       /* any other needed resets */\n       \n       /* reset the dithering offset that may have been calculated for the */\n       /* previous HDU back to the requested default value */\n       (fptr->Fptr)->dither_seed = (fptr->Fptr)->request_dither_seed;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffdblk(fitsfile *fptr,      /* I - FITS file pointer                    */\n           long nblocks,        /* I - number of 2880-byte blocks to delete */\n           int *status)         /* IO - error status                        */\n/*\n  Delete the specified number of 2880-byte blocks from the end\n  of the CHDU by shifting all following extensions up this \n  number of blocks.\n*/\n{\n    char buffer[2880];\n    int tstatus, ii;\n    LONGLONG readpos, writepos;\n\n    if (*status > 0 || nblocks <= 0)\n        return(*status);\n\n    tstatus = 0;\n    /* pointers to the read and write positions */\n\n    readpos = (fptr->Fptr)->datastart + \n                   (fptr->Fptr)->heapstart + \n                   (fptr->Fptr)->heapsize;\n    readpos = ((readpos + 2879) / 2880) * 2880; /* start of block */\n\n/*  the following formula is wrong because the current data unit\n    may have been extended without updating the headstart value\n    of the following HDU.\n    \n    readpos = (fptr->Fptr)->headstart[((fptr->Fptr)->curhdu) + 1];\n*/\n    writepos = readpos - ((LONGLONG)nblocks * 2880);\n\n    while ( !ffmbyt(fptr, readpos, REPORT_EOF, &tstatus) &&\n            !ffgbyt(fptr, 2880L, buffer, &tstatus) )\n    {\n        ffmbyt(fptr, writepos, REPORT_EOF, status);\n        ffpbyt(fptr, 2880L, buffer, status);\n\n        if (*status > 0)\n        {\n           ffpmsg(\"Error deleting FITS blocks (ffdblk)\");\n           return(*status);\n        }\n        readpos  += 2880;  /* increment to next block to transfer */\n        writepos += 2880;\n    }\n\n    /* now fill the last nblock blocks with zeros */\n    memset(buffer, 0, 2880);\n    ffmbyt(fptr, writepos, REPORT_EOF, status);\n\n    for (ii = 0; ii < nblocks; ii++)\n        ffpbyt(fptr, 2880L, buffer, status);\n\n    /* move back before the deleted blocks, since they may be deleted */\n    /*   and we do not want to delete the current active buffer */\n    ffmbyt(fptr, writepos - 1, REPORT_EOF, status);\n\n    /* truncate the file to the new size, if supported on this device */\n    fftrun(fptr, writepos, status);\n\n    /* recalculate the starting location of all subsequent HDUs */\n    for (ii = (fptr->Fptr)->curhdu; ii <= (fptr->Fptr)->maxhdu; ii++)\n         (fptr->Fptr)->headstart[ii + 1] -= ((LONGLONG)nblocks * 2880);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffghdt(fitsfile *fptr,      /* I - FITS file pointer             */\n           int *exttype,        /* O - type of extension, 0, 1, or 2 */\n                                /*  for IMAGE_HDU, ASCII_TBL, or BINARY_TBL */\n           int *status)         /* IO - error status                 */\n/*\n  Return the type of the CHDU. This returns the 'logical' type of the HDU,\n  not necessarily the physical type, so in the case of a compressed image\n  stored in a binary table, this will return the type as an Image, not a\n  binary table.\n*/\n{\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition == 0 && (fptr->Fptr)->headend == 0) { \n         /* empty primary array is alway an IMAGE_HDU */\n         *exttype = IMAGE_HDU;\n    }\n    else {\n \n        /* reset position to the correct HDU if necessary */\n        if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        {\n            ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n        }\n        else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        {\n            /* rescan header if data structure is undefined */\n            if ( ffrdef(fptr, status) > 0)               \n                return(*status);\n        }\n\n        *exttype = (fptr->Fptr)->hdutype; /* return the type of HDU */\n\n        /*  check if this is a compressed image */\n        if ((fptr->Fptr)->compressimg)\n            *exttype = IMAGE_HDU;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_is_reentrant(void)\n/*\n   Was CFITSIO compiled with the -D_REENTRANT flag?  1 = yes, 0 = no.\n   Note that specifying the -D_REENTRANT flag is required, but may not be \n   sufficient, to ensure that CFITSIO can be safely used in a multi-threaded \n   environoment.\n*/\n{\n#ifdef _REENTRANT\n       return(1);\n#else\n       return(0);\n#endif\n}\n/*--------------------------------------------------------------------------*/\nint fits_is_compressed_image(fitsfile *fptr,  /* I - FITS file pointer  */\n                 int *status)                 /* IO - error status      */\n/*\n   Returns TRUE if the CHDU is a compressed image, else returns zero.\n*/\n{\n    if (*status > 0)\n        return(0);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        /* rescan header if data structure is undefined */\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n    }\n\n    /*  check if this is a compressed image */\n    if ((fptr->Fptr)->compressimg)\n         return(1);\n\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint ffgipr(fitsfile *infptr,   /* I - FITS file pointer                     */\n        int maxaxis,           /* I - max number of axes to return          */\n        int *bitpix,           /* O - image data type                       */\n        int *naxis,            /* O - image dimension (NAXIS value)         */\n        long *naxes,           /* O - size of image dimensions              */\n        int *status)           /* IO - error status      */\n\n/*\n    get the datatype and size of the input image\n*/\n{\n\n    if (*status > 0)\n        return(*status);\n\n    /* don't return the parameter if a null pointer was given */\n\n    if (bitpix)\n      fits_get_img_type(infptr, bitpix, status);  /* get BITPIX value */\n\n    if (naxis)\n      fits_get_img_dim(infptr, naxis, status);    /* get NAXIS value */\n\n    if (naxes)\n      fits_get_img_size(infptr, maxaxis, naxes, status); /* get NAXISn values */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgiprll(fitsfile *infptr,   /* I - FITS file pointer                   */\n        int maxaxis,           /* I - max number of axes to return          */\n        int *bitpix,           /* O - image data type                       */\n        int *naxis,            /* O - image dimension (NAXIS value)         */\n        LONGLONG *naxes,       /* O - size of image dimensions              */\n        int *status)           /* IO - error status      */\n\n/*\n    get the datatype and size of the input image\n*/\n{\n\n    if (*status > 0)\n        return(*status);\n\n    /* don't return the parameter if a null pointer was given */\n\n    if (bitpix)\n      fits_get_img_type(infptr, bitpix, status);  /* get BITPIX value */\n\n    if (naxis)\n      fits_get_img_dim(infptr, naxis, status);    /* get NAXIS value */\n\n    if (naxes)\n      fits_get_img_sizell(infptr, maxaxis, naxes, status); /* get NAXISn values */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgidt( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  *imgtype,   /* O - image data type                         */\n            int  *status)    /* IO - error status                           */\n/*\n  Get the datatype of the image (= BITPIX keyword for normal image, or\n  ZBITPIX for a compressed image)\n*/\n{\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    /* reset to beginning of header */\n    ffmaky(fptr, 1, status);  /* simply move to beginning of header */\n\n    if ((fptr->Fptr)->hdutype == IMAGE_HDU)\n    {\n        ffgky(fptr, TINT, \"BITPIX\", imgtype, NULL, status);\n    }\n    else if ((fptr->Fptr)->compressimg)\n    {\n        /* this is a binary table containing a compressed image */\n        ffgky(fptr, TINT, \"ZBITPIX\", imgtype, NULL, status);\n    }\n    else\n    {\n        *status = NOT_IMAGE;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgiet( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  *imgtype,   /* O - image data type                         */\n            int  *status)    /* IO - error status                           */\n/*\n  Get the effective datatype of the image (= BITPIX keyword for normal image,\n  or ZBITPIX for a compressed image)\n*/\n{\n    int tstatus;\n    long lngscale, lngzero = 0;\n    double bscale, bzero, min_val, max_val;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    /* reset to beginning of header */\n    ffmaky(fptr, 2, status);  /* simply move to beginning of header */\n\n    if ((fptr->Fptr)->hdutype == IMAGE_HDU)\n    {\n        ffgky(fptr, TINT, \"BITPIX\", imgtype, NULL, status);\n    }\n    else if ((fptr->Fptr)->compressimg)\n    {\n        /* this is a binary table containing a compressed image */\n        ffgky(fptr, TINT, \"ZBITPIX\", imgtype, NULL, status);\n    }\n    else\n    {\n        *status = NOT_IMAGE;\n        return(*status);\n\n    }\n\n    /* check if the BSCALE and BZERO keywords are defined, which might\n       change the effective datatype of the image  */\n    tstatus = 0;\n    ffgky(fptr, TDOUBLE, \"BSCALE\", &bscale, NULL, &tstatus);\n    if (tstatus)\n           bscale = 1.0;\n\n    tstatus = 0;\n    ffgky(fptr, TDOUBLE, \"BZERO\", &bzero, NULL, &tstatus);\n    if (tstatus)\n           bzero = 0.0;\n\n    if (bscale == 1.0 && bzero == 0.0)  /* no scaling */\n        return(*status);\n\n    switch (*imgtype)\n    {\n      case BYTE_IMG:   /* 8-bit image */\n        min_val = 0.;\n        max_val = 255.0;\n        break;\n\n      case SHORT_IMG:\n        min_val = -32768.0;\n        max_val =  32767.0;\n        break;\n        \n      case LONG_IMG:\n\n        min_val = -2147483648.0;\n        max_val =  2147483647.0;\n        break;\n        \n      default:  /* don't have to deal with other data types */\n        return(*status);\n    }\n\n    if (bscale >= 0.) {\n        min_val = bzero + bscale * min_val;\n        max_val = bzero + bscale * max_val;\n    } else {\n        max_val = bzero + bscale * min_val;\n        min_val = bzero + bscale * max_val;\n    }\n    if (bzero < 2147483648.)  /* don't exceed range of 32-bit integer */\n       lngzero = (long) bzero;\n    lngscale = (long) bscale;\n\n    if ((bzero != 2147483648.) && /* special value that exceeds integer range */\n       (lngzero != bzero || lngscale != bscale)) { /* not integers? */\n       /* floating point scaled values; just decide on required precision */\n       if (*imgtype == BYTE_IMG || *imgtype == SHORT_IMG)\n          *imgtype = FLOAT_IMG;\n       else\n         *imgtype = DOUBLE_IMG;\n\n    /*\n       In all the remaining cases, BSCALE and BZERO are integers,\n       and not equal to 1 and 0, respectively.  \n    */\n\n    } else if ((min_val == -128.) && (max_val == 127.)) {\n       *imgtype = SBYTE_IMG;\n\n    } else if ((min_val >= -32768.0) && (max_val <= 32767.0)) {\n       *imgtype = SHORT_IMG;\n\n    } else if ((min_val >= 0.0) && (max_val <= 65535.0)) {\n       *imgtype = USHORT_IMG;\n\n    } else if ((min_val >= -2147483648.0) && (max_val <= 2147483647.0)) {\n       *imgtype = LONG_IMG;\n\n    } else if ((min_val >= 0.0) && (max_val < 4294967296.0)) {\n       *imgtype = ULONG_IMG;\n\n    } else {  /* exceeds the range of a 32-bit integer */\n       *imgtype = DOUBLE_IMG;\n    }   \n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgidm( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  *naxis  ,   /* O - image dimension (NAXIS value)           */\n            int  *status)    /* IO - error status                           */\n/*\n  Get the dimension of the image (= NAXIS keyword for normal image, or\n  ZNAXIS for a compressed image)\n  These values are cached for faster access.\n*/\n{\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    if ((fptr->Fptr)->hdutype == IMAGE_HDU)\n    {\n        *naxis = (fptr->Fptr)->imgdim;\n    }\n    else if ((fptr->Fptr)->compressimg)\n    {\n        *naxis = (fptr->Fptr)->zndim;\n    }\n    else\n    {\n        *status = NOT_IMAGE;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgisz( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int nlen,        /* I - number of axes to return                */\n            long  *naxes,    /* O - size of image dimensions                */\n            int  *status)    /* IO - error status                           */\n/*\n  Get the size of the image dimensions (= NAXISn keywords for normal image, or\n  ZNAXISn for a compressed image)\n  These values are cached for faster access.\n\n*/\n{\n    int ii, naxis;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    if ((fptr->Fptr)->hdutype == IMAGE_HDU)\n    {\n        naxis = minvalue((fptr->Fptr)->imgdim, nlen);\n        for (ii = 0; ii < naxis; ii++)\n        {\n            naxes[ii] = (long) (fptr->Fptr)->imgnaxis[ii];\n        }\n    }\n    else if ((fptr->Fptr)->compressimg)\n    {\n        naxis = minvalue( (fptr->Fptr)->zndim, nlen);\n        for (ii = 0; ii < naxis; ii++)\n        {\n            naxes[ii] = (long) (fptr->Fptr)->znaxis[ii];\n        }\n    }\n    else\n    {\n        *status = NOT_IMAGE;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgiszll( fitsfile *fptr,  /* I - FITS file pointer                     */\n            int nlen,          /* I - number of axes to return              */\n            LONGLONG  *naxes,  /* O - size of image dimensions              */\n            int  *status)      /* IO - error status                         */\n/*\n  Get the size of the image dimensions (= NAXISn keywords for normal image, or\n  ZNAXISn for a compressed image)\n*/\n{\n    int ii, naxis;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    if ((fptr->Fptr)->hdutype == IMAGE_HDU)\n    {\n        naxis = minvalue((fptr->Fptr)->imgdim, nlen);\n        for (ii = 0; ii < naxis; ii++)\n        {\n            naxes[ii] = (fptr->Fptr)->imgnaxis[ii];\n        }\n    }\n    else if ((fptr->Fptr)->compressimg)\n    {\n        naxis = minvalue( (fptr->Fptr)->zndim, nlen);\n        for (ii = 0; ii < naxis; ii++)\n        {\n            naxes[ii] = (fptr->Fptr)->znaxis[ii];\n        }\n    }\n    else\n    {\n        *status = NOT_IMAGE;\n    }\n\n    return(*status);\n}/*--------------------------------------------------------------------------*/\nint ffmahd(fitsfile *fptr,      /* I - FITS file pointer             */\n           int hdunum,          /* I - number of the HDU to move to  */\n           int *exttype,        /* O - type of extension, 0, 1, or 2 */\n           int *status)         /* IO - error status                 */\n/*\n  Move to Absolute Header Data unit.  Move to the specified HDU\n  and read the header to initialize the table structure.  Note that extnum \n  is one based, so the primary array is extnum = 1.\n*/\n{\n    int moveto, tstatus;\n    char message[FLEN_ERRMSG];\n    LONGLONG *ptr;\n\n    if (*status > 0)\n        return(*status);\n    else if (hdunum < 1 )\n        return(*status = BAD_HDU_NUM);\n    else if (hdunum >= (fptr->Fptr)->MAXHDU )\n    {\n        /* allocate more space for the headstart array */\n        ptr = (LONGLONG*) realloc( (fptr->Fptr)->headstart,\n                        (hdunum + 1001) * sizeof(LONGLONG) ); \n\n        if (ptr == NULL)\n           return (*status = MEMORY_ALLOCATION);\n        else {\n          (fptr->Fptr)->MAXHDU = hdunum + 1000; \n          (fptr->Fptr)->headstart = ptr;\n        }\n    }\n\n    /* set logical HDU position to the actual position, in case they differ */\n    fptr->HDUposition = (fptr->Fptr)->curhdu;\n\n    while( ((fptr->Fptr)->curhdu) + 1 != hdunum) /* at the correct HDU? */\n    {\n        /* move directly to the extension if we know that it exists,\n           otherwise move to the highest known extension.  */\n        \n        moveto = minvalue(hdunum - 1, ((fptr->Fptr)->maxhdu) + 1);\n\n        /* test if HDU exists */\n        if ((fptr->Fptr)->headstart[moveto] < (fptr->Fptr)->logfilesize )\n        {\n            if (ffchdu(fptr, status) <= 0)  /* close out the current HDU */\n            {\n                if (ffgext(fptr, moveto, exttype, status) > 0)\n                {   /* failed to get the requested extension */\n\n                    tstatus = 0;\n                    ffrhdu(fptr, exttype, &tstatus); /* restore the CHDU */\n                }\n            }\n        }\n        else\n            *status = END_OF_FILE;\n\n        if (*status > 0)\n        {\n            if (*status != END_OF_FILE)\n            {\n                /* don't clutter up the message stack in the common case of */\n                /* simply hitting the end of file (often an expected error) */\n\n                snprintf(message,FLEN_ERRMSG,\n                \"Failed to move to HDU number %d (ffmahd).\", hdunum);\n                ffpmsg(message);\n            }\n            return(*status);\n        }\n    }\n\n    /* return the type of HDU; tile compressed images which are stored */\n    /* in a binary table will return exttype = IMAGE_HDU, not BINARY_TBL */\n    if (exttype != NULL)\n        ffghdt(fptr, exttype, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmrhd(fitsfile *fptr,      /* I - FITS file pointer                    */\n           int hdumov,          /* I - rel. no. of HDUs to move by (+ or -) */ \n           int *exttype,        /* O - type of extension, 0, 1, or 2        */\n           int *status)         /* IO - error status                        */\n/*\n  Move a Relative number of Header Data units.  Offset to the specified\n  extension and read the header to initialize the HDU structure. \n*/\n{\n    int extnum;\n\n    if (*status > 0)\n        return(*status);\n\n    extnum = fptr->HDUposition + 1 + hdumov;  /* the absolute HDU number */\n    ffmahd(fptr, extnum, exttype, status);  /* move to the HDU */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmnhd(fitsfile *fptr,      /* I - FITS file pointer                    */\n           int exttype,         /* I - desired extension type               */\n           char *hduname,       /* I - desired EXTNAME value for the HDU    */\n           int hduver,          /* I - desired EXTVERS value for the HDU    */\n           int *status)         /* IO - error status                        */\n/*\n  Move to the next HDU with a given extension type (IMAGE_HDU, ASCII_TBL,\n  BINARY_TBL, or ANY_HDU), extension name (EXTNAME or HDUNAME keyword),\n  and EXTVERS keyword values.  If hduvers = 0, then move to the first HDU\n  with the given type and name regardless of EXTVERS value.  If no matching\n  HDU is found in the file, then the current open HDU will remain unchanged.\n*/\n{\n    char extname[FLEN_VALUE];\n    int ii, hdutype, alttype, extnum, tstatus, match, exact;\n    int slen, putback = 0, chopped = 0;\n    long extver;\n\n    if (*status > 0)\n        return(*status);\n\n    extnum = fptr->HDUposition + 1;  /* save the current HDU number */\n\n    /*\n       This is a kludge to deal with a special case where the\n       user specified a hduname that ended with a # character, which\n       CFITSIO previously interpreted as a flag to mean \"don't copy any\n       other HDUs in the file into the virtual file in memory.  If the\n       remaining hduname does not end with a # character (meaning that\n       the user originally entered a hduname ending in 2 # characters)\n       then there is the possibility that the # character should be\n       treated literally, if the actual EXTNAME also ends with a #.\n       Setting putback = 1 means that we need to test for this case later on.\n    */\n        \n    if ((fptr->Fptr)->only_one) {  /* if true, name orignally ended with a # */\n       slen = strlen(hduname);\n       if (hduname[slen - 1] != '#') /* This will fail if real EXTNAME value */\n           putback = 1;              /*  ends with 2 # characters. */\n    } \n\n    for (ii=1; 1; ii++)    /* loop over all HDUs until EOF */\n    {\n        tstatus = 0;\n        if (ffmahd(fptr, ii, &hdutype, &tstatus))  /* move to next HDU */\n        {\n           ffmahd(fptr, extnum, 0, status); /* restore original file position */\n           return(*status = BAD_HDU_NUM);   /* couldn't find desired HDU */\n        }\n\n        alttype = -1; \n        if (fits_is_compressed_image(fptr, status))\n            alttype = BINARY_TBL;\n        \n        /* Does this HDU have a matching type? */\n        if (exttype == ANY_HDU || hdutype == exttype || hdutype == alttype)\n        {\n          ffmaky(fptr, 2, status); /* reset to the 2nd keyword in the header */\n          if (ffgkys(fptr, \"EXTNAME\", extname, 0, &tstatus) <= 0) /* get keyword */\n          {\n               if (putback) {          /* more of the kludge */\n                   /* test if the EXTNAME value ends with a #;  if so, chop it  */\n\t\t   /* off before comparing the strings */\n\t\t   chopped = 0;\n\t           slen = strlen(extname);\n\t\t   if (extname[slen - 1] == '#') {\n\t\t       extname[slen - 1] = '\\0'; \n                       chopped = 1;\n                   }\n               }\n\n               /* see if the strings are an exact match */\n               ffcmps(hduname, extname, CASEINSEN, &match, &exact);\n          }\n\n          /* if EXTNAME keyword doesn't exist, or it does not match, then try HDUNAME */\n          if (tstatus || !exact)\n\t  {\n               tstatus = 0;\n               if (ffgkys(fptr, \"HDUNAME\", extname, 0, &tstatus) <= 0)\n\t       {\n                   if (putback) {          /* more of the kludge */\n\t\t       chopped = 0;\n\t               slen = strlen(extname);\n\t\t       if (extname[slen - 1] == '#') {\n\t\t           extname[slen - 1] = '\\0';  /* chop off the # */\n                           chopped = 1;\n                       }\n                   }\n\n                   /* see if the strings are an exact match */\n                   ffcmps(hduname, extname, CASEINSEN, &match, &exact);\n               }\n          }\n\n          if (!tstatus && exact)    /* found a matching name */\n          {\n             if (hduver)  /* need to check if version numbers match? */\n             {\n                if (ffgkyj(fptr, \"EXTVER\", &extver, 0, &tstatus) > 0)\n                    extver = 1;  /* assume default EXTVER value */\n\n                if ( (int) extver == hduver)\n                {\n                    if (chopped) {\n                        /* The # was literally part of the name, not a flag */\n\t                (fptr->Fptr)->only_one = 0;  \n                    }\n                    return(*status);    /* found matching name and vers */\n                }\n             }\n             else\n             {\n                 if (chopped) {\n                     /* The # was literally part of the name, not a flag */\n\t            (fptr->Fptr)->only_one = 0;  \n                 }\n                 return(*status);    /* found matching name */\n             }\n          }  /* end of !tstatus && exact */\n\n        }  /* end of matching HDU type */\n    }  /* end of loop over HDUs */\n}\n/*--------------------------------------------------------------------------*/\nint ffthdu(fitsfile *fptr,      /* I - FITS file pointer                    */\n           int *nhdu,            /* O - number of HDUs in the file           */\n           int *status)         /* IO - error status                        */\n/*\n  Return the number of HDUs that currently exist in the file.\n*/\n{\n    int ii, extnum, tstatus;\n\n    if (*status > 0)\n        return(*status);\n\n    extnum = fptr->HDUposition + 1;  /* save the current HDU number */\n    *nhdu = extnum - 1;\n\n    /* if the CHDU is empty or not completely defined, just return */\n    if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        return(*status);\n\n    tstatus = 0;\n\n    /* loop until EOF */\n    for (ii=extnum; ffmahd(fptr, ii, 0, &tstatus) <= 0; ii++)\n    {\n        *nhdu = ii;\n    }\n\n    ffmahd(fptr, extnum, 0, status);       /* restore orig file position */\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgext(fitsfile *fptr,      /* I - FITS file pointer                */\n           int hdunum,          /* I - no. of HDU to move get (0 based) */ \n           int *exttype,        /* O - type of extension, 0, 1, or 2    */\n           int *status)         /* IO - error status                    */\n/*\n  Get Extension.  Move to the specified extension and initialize the\n  HDU structure.\n*/\n{\n    int xcurhdu, xmaxhdu;\n    LONGLONG xheadend;\n\n    if (*status > 0)\n        return(*status);\n\n    if (ffmbyt(fptr, (fptr->Fptr)->headstart[hdunum], REPORT_EOF, status) <= 0)\n    {\n        /* temporarily save current values, in case of error */\n        xcurhdu = (fptr->Fptr)->curhdu;\n        xmaxhdu = (fptr->Fptr)->maxhdu;\n        xheadend = (fptr->Fptr)->headend;\n\n        /* set new parameter values */\n        (fptr->Fptr)->curhdu = hdunum;\n        fptr->HDUposition    = hdunum;\n        (fptr->Fptr)->maxhdu = maxvalue((fptr->Fptr)->maxhdu, hdunum);\n        (fptr->Fptr)->headend = (fptr->Fptr)->logfilesize; /* set max size */\n\n        if (ffrhdu(fptr, exttype, status) > 0)\n        {   /* failed to get the new HDU, so restore previous values */\n            (fptr->Fptr)->curhdu = xcurhdu;\n            fptr->HDUposition    = xcurhdu;\n            (fptr->Fptr)->maxhdu = xmaxhdu;\n            (fptr->Fptr)->headend = xheadend;\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffiblk(fitsfile *fptr,      /* I - FITS file pointer               */\n           long nblock,         /* I - no. of blocks to insert         */ \n           int headdata,        /* I - insert where? 0=header, 1=data  */\n                                /*     -1=beginning of file            */\n           int *status)         /* IO - error status                   */\n/*\n   insert 2880-byte blocks at the end of the current header or data unit\n*/\n{\n    int tstatus, savehdu, typhdu;\n    LONGLONG insertpt, jpoint;\n    long ii, nshift;\n    char charfill;\n    char buff1[2880], buff2[2880];\n    char *inbuff, *outbuff, *tmpbuff;\n    char card[FLEN_CARD];\n\n    if (*status > 0 || nblock <= 0)\n        return(*status);\n        \n    tstatus = *status;\n\n    if (headdata == 0 || (fptr->Fptr)->hdutype == ASCII_TBL)\n        charfill = 32;  /* headers and ASCII tables have space (32) fill */\n    else\n        charfill = 0;   /* images and binary tables have zero fill */\n\n    if (headdata == 0)  \n        insertpt = (fptr->Fptr)->datastart;  /* insert just before data, or */\n    else if (headdata == -1)\n    {\n        insertpt = 0;\n        strcpy(card, \"XTENSION= 'IMAGE   '          / IMAGE extension\");\n    }\n    else                                     /* at end of data, */\n    {\n        insertpt = (fptr->Fptr)->datastart + \n                   (fptr->Fptr)->heapstart + \n                   (fptr->Fptr)->heapsize;\n        insertpt = ((insertpt + 2879) / 2880) * 2880; /* start of block */\n\n       /* the following formula is wrong because the current data unit\n          may have been extended without updating the headstart value\n          of the following HDU.\n       */\n       /* insertpt = (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu + 1]; */\n    }\n\n    inbuff  = buff1;   /* set pointers to input and output buffers */\n    outbuff = buff2;\n\n    memset(outbuff, charfill, 2880); /* initialize buffer with fill */\n\n    if (nblock == 1)  /* insert one block */\n    {\n      if (headdata == -1)\n        ffmrec(fptr, 1, card, status);    /* change SIMPLE -> XTENSION */\n\n      ffmbyt(fptr, insertpt, REPORT_EOF, status);  /* move to 1st point */\n      ffgbyt(fptr, 2880, inbuff, status);  /* read first block of bytes */\n\n      while (*status <= 0)\n      {\n        ffmbyt(fptr, insertpt, REPORT_EOF, status);  /* insert point */\n        ffpbyt(fptr, 2880, outbuff, status);  /* write the output buffer */\n\n        if (*status > 0)\n            return(*status);\n\n        tmpbuff = inbuff;   /* swap input and output pointers */\n        inbuff = outbuff;\n        outbuff = tmpbuff;\n        insertpt += 2880;  /* increment insert point by 1 block */\n\n        ffmbyt(fptr, insertpt, REPORT_EOF, status);  /* move to next block */\n        ffgbyt(fptr, 2880, inbuff, status);  /* read block of bytes */\n      }\n\n      *status = tstatus;  /* reset status value */\n      ffmbyt(fptr, insertpt, IGNORE_EOF, status); /* move back to insert pt */\n      ffpbyt(fptr, 2880, outbuff, status);  /* write the final block */\n    }\n\n    else   /*  inserting more than 1 block */\n\n    {\n        savehdu = (fptr->Fptr)->curhdu;  /* save the current HDU number */\n        tstatus = *status;\n        while(*status <= 0)  /* find the last HDU in file */\n              ffmrhd(fptr, 1, &typhdu, status);\n\n        if (*status == END_OF_FILE)\n        {\n            *status = tstatus;\n        }\n\n        ffmahd(fptr, savehdu + 1, &typhdu, status);  /* move back to CHDU */\n        if (headdata == -1)\n          ffmrec(fptr, 1, card, status); /* NOW change SIMPLE -> XTENSION */\n\n        /* number of 2880-byte blocks that have to be shifted down */\n        nshift = (long) (((fptr->Fptr)->headstart[(fptr->Fptr)->maxhdu + 1] - insertpt)\n                 / 2880);\n        /* position of last block in file to be shifted */\n        jpoint =  (fptr->Fptr)->headstart[(fptr->Fptr)->maxhdu + 1] - 2880;\n\n        /* move all the blocks starting at end of file working backwards */\n        for (ii = 0; ii < nshift; ii++)\n        {\n            /* move to the read start position */\n            if (ffmbyt(fptr, jpoint, REPORT_EOF, status) > 0)\n                return(*status);\n\n            ffgbyt(fptr, 2880, inbuff,status);  /* read one record */\n\n            /* move forward to the write postion */\n            ffmbyt(fptr, jpoint + ((LONGLONG) nblock * 2880), IGNORE_EOF, status);\n\n            ffpbyt(fptr, 2880, inbuff, status);  /* write the record */\n\n            jpoint -= 2880;\n        }\n\n        /* move back to the write start postion (might be EOF) */\n        ffmbyt(fptr, insertpt, IGNORE_EOF, status);\n\n        for (ii = 0; ii < nblock; ii++)   /* insert correct fill value */\n             ffpbyt(fptr, 2880, outbuff, status);\n    }\n\n    if (headdata == 0)         /* update data start address */\n      (fptr->Fptr)->datastart += ((LONGLONG) nblock * 2880);\n\n    /* update following HDU addresses */\n    for (ii = (fptr->Fptr)->curhdu; ii <= (fptr->Fptr)->maxhdu; ii++)\n         (fptr->Fptr)->headstart[ii + 1] += ((LONGLONG) nblock * 2880);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgkcl(char *tcard)\n\n/*\n   Return the type classification of the input header record\n\n   TYP_STRUC_KEY: SIMPLE, BITPIX, NAXIS, NAXISn, EXTEND, BLOCKED,\n                  GROUPS, PCOUNT, GCOUNT, END\n                  XTENSION, TFIELDS, TTYPEn, TBCOLn, TFORMn, THEAP,\n                   and the first 4 COMMENT keywords in the primary array\n                   that define the FITS format.\n\n   TYP_CMPRS_KEY:\n            The keywords used in the compressed image format\n                  ZIMAGE, ZCMPTYPE, ZNAMEn, ZVALn, ZTILEn, \n                  ZBITPIX, ZNAXISn, ZSCALE, ZZERO, ZBLANK,\n                  EXTNAME = 'COMPRESSED_IMAGE'\n\t\t  ZSIMPLE, ZTENSION, ZEXTEND, ZBLOCKED, ZPCOUNT, ZGCOUNT\n\t\t  ZQUANTIZ, ZDITHER0\n\n   TYP_SCAL_KEY:  BSCALE, BZERO, TSCALn, TZEROn\n\n   TYP_NULL_KEY:  BLANK, TNULLn\n\n   TYP_DIM_KEY:   TDIMn\n\n   TYP_RANG_KEY:  TLMINn, TLMAXn, TDMINn, TDMAXn, DATAMIN, DATAMAX\n\n   TYP_UNIT_KEY:  BUNIT, TUNITn\n\n   TYP_DISP_KEY:  TDISPn\n\n   TYP_HDUID_KEY: EXTNAME, EXTVER, EXTLEVEL, HDUNAME, HDUVER, HDULEVEL\n\n   TYP_CKSUM_KEY  CHECKSUM, DATASUM\n\n   TYP_WCS_KEY:\n           Primary array:\n                  WCAXES, CTYPEn, CUNITn, CRVALn, CRPIXn, CROTAn, CDELTn\n                  CDj_is, PVj_ms, LONPOLEs, LATPOLEs\n  \n           Pixel list:\n                  TCTYPn, TCTYns, TCUNIn, TCUNns, TCRVLn, TCRVns, TCRPXn, TCRPks,\n                  TCDn_k, TCn_ks, TPVn_m, TPn_ms, TCDLTn, TCROTn\n\n           Bintable vector:\n                  jCTYPn, jCTYns, jCUNIn, jCUNns, jCRVLn, jCRVns, iCRPXn, iCRPns,\n                  jiCDn, jiCDns, jPVn_m, jPn_ms, jCDLTn, jCROTn\n                \n   TYP_REFSYS_KEY:\n                   EQUINOXs, EPOCH, MJD-OBSs, RADECSYS, RADESYSs\n\n   TYP_COMM_KEY:  COMMENT, HISTORY, (blank keyword)\n\n   TYP_CONT_KEY:  CONTINUE\n\n   TYP_USER_KEY:  all other keywords\n\n*/ \n{\n    char card[20], *card1, *card5;\n\n    card[0] = '\\0';\n    strncat(card, tcard, 8);   /* copy the keyword name */\n    strcat(card, \"        \"); /* append blanks to make at least 8 chars long */\n    ffupch(card);  /* make sure it is in upper case */\n\n    card1 = card + 1;  /* pointer to 2nd character */\n    card5 = card + 5;  /* pointer to 6th character */\n\n    /* the strncmp function is slow, so try to be more efficient */\n    if (*card == 'Z')\n    {\n\tif (FSTRNCMP (card1, \"IMAGE  \", 7) == 0)\n\t    return (TYP_CMPRS_KEY);\n\telse if (FSTRNCMP (card1, \"CMPTYPE\", 7) == 0)\n\t    return (TYP_CMPRS_KEY);\n\telse if (FSTRNCMP (card1, \"NAME\", 4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_CMPRS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"VAL\", 3) == 0)\n        {\n            if (*(card + 4) >= '0' && *(card + 4) <= '9')\n\t        return (TYP_CMPRS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"TILE\", 4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_CMPRS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"BITPIX \", 7) == 0)\n\t    return (TYP_CMPRS_KEY);\n\telse if (FSTRNCMP (card1, \"NAXIS\", 5) == 0)\n        {\n            if ( ( *(card + 6) >= '0' && *(card + 6) <= '9' )\n             || (*(card + 6) == ' ') )\n\t        return (TYP_CMPRS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"SCALE  \", 7) == 0)\n\t    return (TYP_CMPRS_KEY);\n\telse if (FSTRNCMP (card1, \"ZERO   \", 7) == 0)\n\t    return (TYP_CMPRS_KEY);\n\telse if (FSTRNCMP (card1, \"BLANK  \", 7) == 0)\n\t    return (TYP_CMPRS_KEY);\n\telse if (FSTRNCMP (card1, \"SIMPLE \", 7) == 0)\n\t    return (TYP_CMPRS_KEY);\n\telse if (FSTRNCMP (card1, \"TENSION\", 7) == 0)\n\t    return (TYP_CMPRS_KEY);\n\telse if (FSTRNCMP (card1, \"EXTEND \", 7) == 0)\n\t    return (TYP_CMPRS_KEY);\n\telse if (FSTRNCMP (card1, \"BLOCKED\", 7) == 0)\n\t    return (TYP_CMPRS_KEY);\n\telse if (FSTRNCMP (card1, \"PCOUNT \", 7) == 0)\n\t    return (TYP_CMPRS_KEY);\n\telse if (FSTRNCMP (card1, \"GCOUNT \", 7) == 0)\n\t    return (TYP_CMPRS_KEY);\n\telse if (FSTRNCMP (card1, \"QUANTIZ\", 7) == 0)\n\t    return (TYP_CMPRS_KEY);\n\telse if (FSTRNCMP (card1, \"DITHER0\", 7) == 0)\n\t    return (TYP_CMPRS_KEY);\n    }\n    else if (*card == ' ')\n    {\n\treturn (TYP_COMM_KEY);\n    }\n    else if (*card == 'B')\n    {\n\tif (FSTRNCMP (card1, \"ITPIX  \", 7) == 0)\n\t    return (TYP_STRUC_KEY);\n\tif (FSTRNCMP (card1, \"LOCKED \", 7) == 0)\n\t    return (TYP_STRUC_KEY);\n\n\tif (FSTRNCMP (card1, \"LANK   \", 7) == 0)\n\t    return (TYP_NULL_KEY);\n\n\tif (FSTRNCMP (card1, \"SCALE  \", 7) == 0)\n\t    return (TYP_SCAL_KEY);\n\tif (FSTRNCMP (card1, \"ZERO   \", 7) == 0)\n\t    return (TYP_SCAL_KEY);\n\n\tif (FSTRNCMP (card1, \"UNIT   \", 7) == 0)\n\t    return (TYP_UNIT_KEY);\n    }\n    else if (*card == 'C')\n    {\n\tif (FSTRNCMP (card1, \"OMMENT\",6) == 0)\n\t{\n          /* new comment string starting Oct 2001 */\n\t    if (FSTRNCMP (tcard, \"COMMENT   and Astrophysics', volume 376, page 3\",\n              47) == 0)\n\t        return (TYP_STRUC_KEY);\n\n         /* original COMMENT strings from 1993 - 2001 */\n\t    if (FSTRNCMP (tcard, \"COMMENT   FITS (Flexible Image Transport System\",\n              47) == 0)\n\t        return (TYP_STRUC_KEY);\n\t    if (FSTRNCMP (tcard, \"COMMENT   Astrophysics Supplement Series v44/p3\",\n              47) == 0)\n\t        return (TYP_STRUC_KEY);\n\t    if (FSTRNCMP (tcard, \"COMMENT   Contact the NASA Science Office of St\",\n              47) == 0)\n\t        return (TYP_STRUC_KEY);\n\t    if (FSTRNCMP (tcard, \"COMMENT   FITS Definition document #100 and oth\",\n              47) == 0)\n\t        return (TYP_STRUC_KEY);\n\n            if (*(card + 7) == ' ')\n\t        return (TYP_COMM_KEY);\n            else\n                return (TYP_USER_KEY);\n\t}\n\n\tif (FSTRNCMP (card1, \"HECKSUM\", 7) == 0)\n\t    return (TYP_CKSUM_KEY);\n\n\tif (FSTRNCMP (card1, \"ONTINUE\", 7) == 0)\n\t    return (TYP_CONT_KEY);\n\n\tif (FSTRNCMP (card1, \"TYPE\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"UNIT\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"RVAL\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"RPIX\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"ROTA\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"RDER\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"SYER\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"DELT\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (*card1 == 'D')\n        {\n            if (*(card + 2) >= '0' && *(card + 2) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n    }\n    else if (*card == 'D')\n    {\n\tif (FSTRNCMP (card1, \"ATASUM \", 7) == 0)\n\t    return (TYP_CKSUM_KEY);\n\tif (FSTRNCMP (card1, \"ATAMIN \", 7) == 0)\n\t    return (TYP_RANG_KEY);\n\tif (FSTRNCMP (card1, \"ATAMAX \", 7) == 0)\n\t    return (TYP_RANG_KEY);\n\tif (FSTRNCMP (card1, \"ATE-OBS\", 7) == 0)\n\t    return (TYP_REFSYS_KEY);    }\n    else if (*card == 'E')\n    {\n\tif (FSTRNCMP (card1, \"XTEND  \", 7) == 0)\n\t    return (TYP_STRUC_KEY);\n\tif (FSTRNCMP (card1, \"ND     \", 7) == 0)\n\t    return (TYP_STRUC_KEY);\n\tif (FSTRNCMP (card1, \"XTNAME \", 7) == 0)\n\t{\n            /* check for special compressed image value */\n            if (FSTRNCMP(tcard, \"EXTNAME = 'COMPRESSED_IMAGE'\", 28) == 0)\n\t      return (TYP_CMPRS_KEY);\n            else\n\t      return (TYP_HDUID_KEY);\n\t}\n\tif (FSTRNCMP (card1, \"XTVER  \", 7) == 0)\n\t    return (TYP_HDUID_KEY);\n\tif (FSTRNCMP (card1, \"XTLEVEL\", 7) == 0)\n\t    return (TYP_HDUID_KEY);\n\n\tif (FSTRNCMP (card1, \"QUINOX\", 6) == 0)\n\t    return (TYP_REFSYS_KEY);\n\tif (FSTRNCMP (card1, \"QUI\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_REFSYS_KEY);\n        }\n\tif (FSTRNCMP (card1, \"POCH   \", 7) == 0)\n\t    return (TYP_REFSYS_KEY);\n    }\n    else if (*card == 'G')\n    {\n\tif (FSTRNCMP (card1, \"COUNT  \", 7) == 0)\n\t    return (TYP_STRUC_KEY);\n\tif (FSTRNCMP (card1, \"ROUPS  \", 7) == 0)\n\t    return (TYP_STRUC_KEY);\n    }\n    else if (*card == 'H')\n    {\n\tif (FSTRNCMP (card1, \"DUNAME \", 7) == 0)\n\t    return (TYP_HDUID_KEY);\n\tif (FSTRNCMP (card1, \"DUVER  \", 7) == 0)\n\t    return (TYP_HDUID_KEY);\n\tif (FSTRNCMP (card1, \"DULEVEL\", 7) == 0)\n\t    return (TYP_HDUID_KEY);\n\n\tif (FSTRNCMP (card1, \"ISTORY\",6) == 0)\n        {\n            if (*(card + 7) == ' ')\n\t        return (TYP_COMM_KEY);\n            else\n                return (TYP_USER_KEY);\n        }\n    }\n    else if (*card == 'L')\n    {\n\tif (FSTRNCMP (card1, \"ONPOLE\",6) == 0)\n\t    return (TYP_WCS_KEY);\n\tif (FSTRNCMP (card1, \"ATPOLE\",6) == 0)\n\t    return (TYP_WCS_KEY);\n\tif (FSTRNCMP (card1, \"ONP\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"ATP\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n    }\n    else if (*card == 'M')\n    {\n\tif (FSTRNCMP (card1, \"JD-OBS \", 7) == 0)\n\t    return (TYP_REFSYS_KEY);\n\tif (FSTRNCMP (card1, \"JDOB\",4) == 0)\n        {\n            if (*(card+5) >= '0' && *(card+5) <= '9')\n\t        return (TYP_REFSYS_KEY);\n        }\n    }\n    else if (*card == 'N')\n    {\n\tif (FSTRNCMP (card1, \"AXIS\", 4) == 0)\n        {\n            if ((*card5 >= '0' && *card5 <= '9')\n             || (*card5 == ' '))\n\t        return (TYP_STRUC_KEY);\n        }\n    }\n    else if (*card == 'P')\n    {\n\tif (FSTRNCMP (card1, \"COUNT  \", 7) == 0)\n\t    return (TYP_STRUC_KEY);\n\tif (*card1 == 'C')\n        {\n            if (*(card + 2) >= '0' && *(card + 2) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (*card1 == 'V')\n        {\n            if (*(card + 2) >= '0' && *(card + 2) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (*card1 == 'S')\n        {\n            if (*(card + 2) >= '0' && *(card + 2) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n    }\n    else if (*card == 'R')\n    {\n\tif (FSTRNCMP (card1, \"ADECSYS\", 7) == 0)\n\t    return (TYP_REFSYS_KEY);\n\tif (FSTRNCMP (card1, \"ADESYS\", 6) == 0)\n\t    return (TYP_REFSYS_KEY);\n\tif (FSTRNCMP (card1, \"ADE\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_REFSYS_KEY);\n        }\n    }\n    else if (*card == 'S')\n    {\n\tif (FSTRNCMP (card1, \"IMPLE  \", 7) == 0)\n\t    return (TYP_STRUC_KEY);\n    }\n    else if (*card == 'T')\n    {\n\tif (FSTRNCMP (card1, \"TYPE\", 4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_STRUC_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"FORM\", 4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_STRUC_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"BCOL\", 4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_STRUC_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"FIELDS \", 7) == 0)\n\t    return (TYP_STRUC_KEY);\n\telse if (FSTRNCMP (card1, \"HEAP   \", 7) == 0)\n\t    return (TYP_STRUC_KEY);\n\n\telse if (FSTRNCMP (card1, \"NULL\", 4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_NULL_KEY);\n        }\n\n\telse if (FSTRNCMP (card1, \"DIM\", 3) == 0)\n        {\n            if (*(card + 4) >= '0' && *(card + 4) <= '9')\n \t        return (TYP_DIM_KEY);\n        }\n\n\telse if (FSTRNCMP (card1, \"UNIT\", 4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_UNIT_KEY);\n        }\n\n\telse if (FSTRNCMP (card1, \"DISP\", 4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_DISP_KEY);\n        }\n\n\telse if (FSTRNCMP (card1, \"SCAL\", 4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_SCAL_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"ZERO\", 4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_SCAL_KEY);\n        }\n\n\telse if (FSTRNCMP (card1, \"LMIN\", 4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_RANG_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"LMAX\", 4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_RANG_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"DMIN\", 4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_RANG_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"DMAX\", 4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_RANG_KEY);\n        }\n\n\telse if (FSTRNCMP (card1, \"CTYP\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CTY\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CUNI\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CUN\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CRVL\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CRV\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CRPX\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CRP\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CROT\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CDLT\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CDE\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CRD\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CSY\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"WCS\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"C\",1) == 0)\n        {\n            if (*(card + 2) >= '0' && *(card + 2) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"P\",1) == 0)\n        {\n            if (*(card + 2) >= '0' && *(card + 2) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"V\",1) == 0)\n        {\n            if (*(card + 2) >= '0' && *(card + 2) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"S\",1) == 0)\n        {\n            if (*(card + 2) >= '0' && *(card + 2) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n    }\n    else if (*card == 'X')\n    {\n\tif (FSTRNCMP (card1, \"TENSION\", 7) == 0)\n\t    return (TYP_STRUC_KEY);\n    }\n    else if (*card == 'W')\n    {\n\tif (FSTRNCMP (card1, \"CSAXES\", 6) == 0)\n\t    return (TYP_WCS_KEY);\n\tif (FSTRNCMP (card1, \"CSNAME\", 6) == 0)\n\t    return (TYP_WCS_KEY);\n\tif (FSTRNCMP (card1, \"CAX\", 3) == 0)\n\t{\n            if (*(card + 4) >= '0' && *(card + 4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CSN\", 3) == 0)\n\t{\n            if (*(card + 4) >= '0' && *(card + 4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n    }\n    \n    else if (*card >= '0' && *card <= '9')\n    {\n      if (*card1 == 'C')\n      {\n        if (FSTRNCMP (card1, \"CTYP\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CTY\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CUNI\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CUN\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CRVL\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CRV\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CRPX\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CRP\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CROT\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CDLT\",4) == 0)\n        {\n            if (*card5 >= '0' && *card5 <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CDE\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CRD\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n\telse if (FSTRNCMP (card1, \"CSY\",3) == 0)\n        {\n            if (*(card+4) >= '0' && *(card+4) <= '9')\n\t        return (TYP_WCS_KEY);\n        }\n      }\n      else if (FSTRNCMP (card1, \"V\",1) == 0)\n      {\n            if (*(card + 2) >= '0' && *(card + 2) <= '9')\n\t        return (TYP_WCS_KEY);\n      }\n      else if (FSTRNCMP (card1, \"S\",1) == 0)\n      {\n            if (*(card + 2) >= '0' && *(card + 2) <= '9')\n\t        return (TYP_WCS_KEY);\n      }\n      else if (*card1 >= '0' && *card1 <= '9')\n      {   /* 2 digits at beginning of keyword */\n\t\n\t    if ( (*(card + 2) == 'P') && (*(card + 3) == 'C') )\n\t    {\n               if (*(card + 4) >= '0' && *(card + 4) <= '9')\n\t        return (TYP_WCS_KEY);  /*  ijPCn keyword */\n            }\n\t    else if ( (*(card + 2) == 'C') && (*(card + 3) == 'D') )\n\t    {\n               if (*(card + 4) >= '0' && *(card + 4) <= '9')\n\t        return (TYP_WCS_KEY);  /*  ijCDn keyword */\n            }\n      }\n      \n    }\n    \n    return (TYP_USER_KEY);  /* by default all others are user keywords */\n}\n/*--------------------------------------------------------------------------*/\nint ffdtyp(const char *cval,  /* I - formatted string representation of the value */\n           char *dtype, /* O - datatype code: C, L, F, I, or X */\n          int *status)  /* IO - error status */\n/*\n  determine implicit datatype of input string.\n  This assumes that the string conforms to the FITS standard\n  for keyword values, so may not detect all invalid formats.\n*/\n{\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (cval[0] == '\\0')\n        return(*status = VALUE_UNDEFINED);\n    else if (cval[0] == '\\'')\n        *dtype = 'C';          /* character string starts with a quote */\n    else if (cval[0] == 'T' || cval[0] == 'F')\n        *dtype = 'L';          /* logical = T or F character */\n    else if (cval[0] == '(')\n        *dtype = 'X';          /* complex datatype \"(1.2, -3.4)\" */\n    else if (strchr(cval,'.'))\n        *dtype = 'F';          /* float usualy contains a decimal point */\n    else if (strchr(cval,'E') || strchr(cval,'D') )\n        *dtype = 'F';          /* exponential contains a E or D */\n    else\n        *dtype = 'I';          /* if none of the above assume it is integer */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffinttyp(char *cval,  /* I - formatted string representation of the integer */\n           int *dtype, /* O - datatype code: TBYTE, TSHORT, TUSHORT, etc */\n           int *negative, /* O - is cval negative? */\n           int *status)  /* IO - error status */\n/*\n  determine implicit datatype of input integer string.\n  This assumes that the string conforms to the FITS standard\n  for integer keyword value, so may not detect all invalid formats.\n*/\n{\n    int ii, len;\n    char *p;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    *dtype = 0;  /* initialize to NULL */\n    *negative = 0;\n    p = cval;\n\n    if (*p == '+') {\n        p++;   /* ignore leading + sign */\n    } else if (*p == '-') {\n        p++;\n\t*negative = 1;   /* this is a negative number */\n    }\n\n    if (*p == '0') {\n        while (*p == '0') p++;  /* skip leading zeros */\n\n        if (*p == 0) {  /* the value is a string of 1 or more zeros */\n           *dtype  = TSBYTE;\n\t   return(*status);\n        }\n    }\n\n    len = strlen(p);\n    for (ii = 0; ii < len; ii++)  {\n        if (!isdigit(*(p+ii))) {\n\t    *status = BAD_INTKEY;\n\t    return(*status);\n\t}\n    }\n\n    /* check for unambiguous cases, based on length of the string */\n    if (len == 0) {\n        *status = VALUE_UNDEFINED;\n    } else if (len < 3) {\n        *dtype = TSBYTE;\n    } else if (len == 4) {\n\t*dtype = TSHORT;\n    } else if (len > 5 && len < 10) {\n        *dtype = TINT;\n    } else if (len > 10 && len < 19) {\n        *dtype = TLONGLONG;\n    } else if (len > 20) {\n\t*status = BAD_INTKEY;\n    } else {\n    \n      if (!(*negative)) {  /* positive integers */\n\tif (len == 3) {\n\t    if (strcmp(p,\"127\") <= 0 ) {\n\t        *dtype = TSBYTE;\n\t    } else if (strcmp(p,\"255\") <= 0 ) {\n\t        *dtype = TBYTE;\n\t    } else {\n\t        *dtype = TSHORT;\n\t    }\n\t} else if (len == 5) {\n \t    if (strcmp(p,\"32767\") <= 0 ) {\n\t        *dtype = TSHORT;\n \t    } else if (strcmp(p,\"65535\") <= 0 ) {\n\t        *dtype = TUSHORT;\n\t    } else {\n\t        *dtype = TINT;\n\t    }\n\t} else if (len == 10) {\n\t    if (strcmp(p,\"2147483647\") <= 0 ) {\n\t        *dtype = TINT;\n\t    } else if (strcmp(p,\"4294967295\") <= 0 ) {\n\t        *dtype = TUINT;\n\t    } else {\n\t        *dtype = TLONGLONG;\n\t    }\n\t} else if (len == 19) {\n\t    if (strcmp(p,\"9223372036854775807\") <= 0 ) {\n\t        *dtype = TLONGLONG;\n\t    } else {\n\t\t*dtype = TULONGLONG;\n\t    }\n\t} else if (len == 20) {\n\t    if (strcmp(p,\"18446744073709551615\") <= 0 ) {\n\t        *dtype = TULONGLONG;\n\t    } else {\n\t        *status = BAD_INTKEY;\n\t    }\n\t}\n\n      } else {  /* negative integers */\n\tif (len == 3) {\n\t    if (strcmp(p,\"128\") <= 0 ) {\n\t        *dtype = TSBYTE;\n\t    } else {\n\t        *dtype = TSHORT;\n\t    }\n\t} else if (len == 5) {\n \t    if (strcmp(p,\"32768\") <= 0 ) {\n\t        *dtype = TSHORT;\n\t    } else {\n\t        *dtype = TINT;\n\t    }\n\t} else if (len == 10) {\n\t    if (strcmp(p,\"2147483648\") <= 0 ) {\n\t        *dtype = TINT;\n\t    } else {\n\t        *dtype = TLONGLONG;\n\t    }\n\t} else if (len == 19) {\n\t    if (strcmp(p,\"9223372036854775808\") <= 0 ) {\n\t        *dtype = TLONGLONG;\n\t    } else {\n\t\t*status = BAD_INTKEY;\n\t    }\n\t}\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffc2x(const char *cval,   /* I - formatted string representation of the value */\n          char *dtype,        /* O - datatype code: C, L, F, I or X  */\n\n    /* Only one of the following will be defined, depending on datatype */\n          long *ival,    /* O - integer value       */\n          int *lval,     /* O - logical value       */\n          char *sval,    /* O - string value        */\n          double *dval,  /* O - double value        */\n\n          int *status)   /* IO - error status */\n/*\n  high level routine to convert formatted character string to its\n  intrinsic data type\n*/\n{\n    ffdtyp(cval, dtype, status);     /* determine the datatype */\n\n    if (*dtype == 'I')\n        ffc2ii(cval, ival, status);\n    else if (*dtype == 'F')\n        ffc2dd(cval, dval, status);\n    else if (*dtype == 'L')\n        ffc2ll(cval, lval, status);\n    else \n        ffc2s(cval, sval, status);   /* C and X formats */\n        \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffc2xx(const char *cval,   /* I - formatted string representation of the value */\n          char *dtype,         /* O - datatype code: C, L, F, I or X  */\n\n    /* Only one of the following will be defined, depending on datatype */\n          LONGLONG *ival, /* O - integer value       */\n          int *lval,     /* O - logical value       */\n          char *sval,    /* O - string value        */\n          double *dval,  /* O - double value        */\n\n          int *status)   /* IO - error status */\n/*\n  high level routine to convert formatted character string to its\n  intrinsic data type\n*/\n{\n    ffdtyp(cval, dtype, status);     /* determine the datatype */\n\n    if (*dtype == 'I')\n        ffc2jj(cval, ival, status);\n    else if (*dtype == 'F')\n        ffc2dd(cval, dval, status);\n    else if (*dtype == 'L')\n        ffc2ll(cval, lval, status);\n    else \n        ffc2s(cval, sval, status);   /* C and X formats */\n        \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffc2uxx(const char *cval,   /* I - formatted string representation of the value */\n          char *dtype,         /* O - datatype code: C, L, F, I or X  */\n\n    /* Only one of the following will be defined, depending on datatype */\n          ULONGLONG *ival, /* O - integer value       */\n          int *lval,     /* O - logical value       */\n          char *sval,    /* O - string value        */\n          double *dval,  /* O - double value        */\n\n          int *status)   /* IO - error status */\n/*\n  high level routine to convert formatted character string to its\n  intrinsic data type\n*/\n{\n    ffdtyp(cval, dtype, status);     /* determine the datatype */\n\n    if (*dtype == 'I')\n        ffc2ujj(cval, ival, status);\n    else if (*dtype == 'F')\n        ffc2dd(cval, dval, status);\n    else if (*dtype == 'L')\n        ffc2ll(cval, lval, status);\n    else \n        ffc2s(cval, sval, status);   /* C and X formats */\n        \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffc2i(const char *cval,   /* I - string representation of the value */\n          long *ival,         /* O - numerical value of the input string */\n          int *status)        /* IO - error status */\n/*\n  convert formatted string to an integer value, doing implicit\n  datatype conversion if necessary.\n*/\n{\n    char dtype, sval[81], msg[81];\n    int lval;\n    double dval;\n    \n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (cval[0] == '\\0')\n        return(*status = VALUE_UNDEFINED);  /* null value string */\n        \n    /* convert the keyword to its native datatype */\n    ffc2x(cval, &dtype, ival, &lval, sval, &dval, status);\n\n    if (dtype == 'X' )\n    {\n            *status = BAD_INTKEY;\n    }\n    else if (dtype == 'C')\n    {\n            /* try reading the string as a number */\n            if (ffc2dd(sval, &dval, status) <= 0)\n            {\n              if (dval > (double) LONG_MAX || dval < (double) LONG_MIN)\n                *status = NUM_OVERFLOW;\n              else\n                *ival = (long) dval;\n            }\n    }\n    else if (dtype == 'F')\n    {\n            if (dval > (double) LONG_MAX || dval < (double) LONG_MIN)\n                *status = NUM_OVERFLOW;\n            else\n                *ival = (long) dval;\n    }\n    else if (dtype == 'L')\n    {\n            *ival = (long) lval;\n    }\n\n    if (*status > 0)\n    {\n            *ival = 0;\n            strcpy(msg,\"Error in ffc2i evaluating string as an integer: \");\n            strncat(msg,cval,30);\n            ffpmsg(msg);\n            return(*status);\n    }\n\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffc2j(const char *cval,     /* I - string representation of the value */\n          LONGLONG *ival,       /* O - numerical value of the input string */\n          int *status)          /* IO - error status */\n/*\n  convert formatted string to a LONGLONG integer value, doing implicit\n  datatype conversion if necessary.\n*/\n{\n    char dtype, sval[81], msg[81];\n    int lval;\n    double dval;\n    \n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (cval[0] == '\\0')\n        return(*status = VALUE_UNDEFINED);  /* null value string */\n        \n    /* convert the keyword to its native datatype */\n    ffc2xx(cval, &dtype, ival, &lval, sval, &dval, status);\n\n    if (dtype == 'X' )\n    {\n            *status = BAD_INTKEY;\n    }\n    else if (dtype == 'C')\n    {\n            /* try reading the string as a number */\n            if (ffc2dd(sval, &dval, status) <= 0)\n            {\n              if (dval > (double) LONGLONG_MAX || dval < (double) LONGLONG_MIN)\n                *status = NUM_OVERFLOW;\n              else\n                *ival = (LONGLONG) dval;\n            }\n    }\n    else if (dtype == 'F')\n    {\n            if (dval > (double) LONGLONG_MAX || dval < (double) LONGLONG_MIN)\n                *status = NUM_OVERFLOW;\n            else\n                *ival = (LONGLONG) dval;\n    }\n    else if (dtype == 'L')\n    {\n            *ival = (LONGLONG) lval;\n    }\n\n    if (*status > 0)\n    {\n            *ival = 0;\n            strcpy(msg,\"Error in ffc2j evaluating string as a long integer: \");\n            strncat(msg,cval,30);\n            ffpmsg(msg);\n            return(*status);\n    }\n\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffc2uj(const char *cval,     /* I - string representation of the value */\n          ULONGLONG *ival,       /* O - numerical value of the input string */\n          int *status)          /* IO - error status */\n/*\n  convert formatted string to a ULONGLONG integer value, doing implicit\n  datatype conversion if necessary.\n*/\n{\n    char dtype, sval[81], msg[81];\n    int lval;\n    double dval;\n    \n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (cval[0] == '\\0')\n        return(*status = VALUE_UNDEFINED);  /* null value string */\n        \n    /* convert the keyword to its native datatype */\n    ffc2uxx(cval, &dtype, ival, &lval, sval, &dval, status);\n\n    if (dtype == 'X' )\n    {\n            *status = BAD_INTKEY;\n    }\n    else if (dtype == 'C')\n    {\n            /* try reading the string as a number */\n            if (ffc2dd(sval, &dval, status) <= 0)\n            {\n              if (dval > (double)  DULONGLONG_MAX || dval < -0.49)\n                *status = NUM_OVERFLOW;\n              else\n                *ival = (ULONGLONG) dval;\n            }\n    }\n    else if (dtype == 'F')\n    {\n            if (dval > (double) DULONGLONG_MAX || dval < -0.49)\n                *status = NUM_OVERFLOW;\n            else\n                *ival = (ULONGLONG) dval;\n    }\n    else if (dtype == 'L')\n    {\n            *ival = (ULONGLONG) lval;\n    }\n\n    if (*status > 0)\n    {\n            *ival = 0;\n            strcpy(msg,\"Error in ffc2j evaluating string as a long integer: \");\n            strncat(msg,cval,30);\n            ffpmsg(msg);\n            return(*status);\n    }\n\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffc2l(const char *cval,  /* I - string representation of the value */\n         int *lval,          /* O - numerical value of the input string */\n         int *status)        /* IO - error status */\n/*\n  convert formatted string to a logical value, doing implicit\n  datatype conversion if necessary\n*/\n{\n    char dtype, sval[81], msg[81];\n    long ival;\n    double dval;\n    \n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (cval[0] == '\\0')\n        return(*status = VALUE_UNDEFINED);  /* null value string */\n\n    /* convert the keyword to its native datatype */\n    ffc2x(cval, &dtype, &ival, lval, sval, &dval, status);\n\n    if (dtype == 'C' || dtype == 'X' )\n        *status = BAD_LOGICALKEY;\n\n    if (*status > 0)\n    {\n            *lval = 0;\n            strcpy(msg,\"Error in ffc2l evaluating string as a logical: \");\n            strncat(msg,cval,30);\n            ffpmsg(msg);\n            return(*status);\n    }\n\n    if (dtype == 'I')\n    {\n        if (ival)\n            *lval = 1;\n        else\n            *lval = 0;\n    }\n    else if (dtype == 'F')\n    {\n        if (dval)\n            *lval = 1;\n        else\n            *lval = 0;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffc2r(const char *cval,   /* I - string representation of the value */\n          float *fval,        /* O - numerical value of the input string */\n          int *status)        /* IO - error status */\n/*\n  convert formatted string to a real float value, doing implicit\n  datatype conversion if necessary\n*/\n{\n    char dtype, sval[81], msg[81];\n    int lval;\n    \n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (cval[0] == '\\0')\n        return(*status = VALUE_UNDEFINED);  /* null value string */\n\n    ffdtyp(cval, &dtype, status);     /* determine the datatype */\n\n    if (dtype == 'I' || dtype == 'F')\n        ffc2rr(cval, fval, status);\n    else if (dtype == 'L')\n    {\n        ffc2ll(cval, &lval, status);\n        *fval = (float) lval;\n    }\n    else if (dtype == 'C')\n    {\n        /* try reading the string as a number */\n        ffc2s(cval, sval, status); \n        ffc2rr(sval, fval, status);\n    }\n    else \n        *status = BAD_FLOATKEY;\n\n    if (*status > 0)\n    {\n            *fval = 0.;\n            strcpy(msg,\"Error in ffc2r evaluating string as a float: \");\n            strncat(msg,cval,30);\n            ffpmsg(msg);\n            return(*status);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffc2d(const char *cval,   /* I - string representation of the value */\n          double *dval,       /* O - numerical value of the input string */\n          int *status)        /* IO - error status */\n/*\n  convert formatted string to a double value, doing implicit\n  datatype conversion if necessary\n*/\n{\n    char dtype, sval[81], msg[81];\n    int lval;\n    \n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (cval[0] == '\\0')\n        return(*status = VALUE_UNDEFINED);  /* null value string */\n\n    ffdtyp(cval, &dtype, status);     /* determine the datatype */\n\n    if (dtype == 'I' || dtype == 'F')\n        ffc2dd(cval, dval, status);\n    else if (dtype == 'L')\n    {\n        ffc2ll(cval, &lval, status);\n        *dval = (double) lval;\n    }\n    else if (dtype == 'C')\n    {\n        /* try reading the string as a number */\n        ffc2s(cval, sval, status); \n        ffc2dd(sval, dval, status);\n    }\n    else \n        *status = BAD_DOUBLEKEY;\n\n    if (*status > 0)\n    {\n            *dval = 0.;\n            strcpy(msg,\"Error in ffc2d evaluating string as a double: \");\n            strncat(msg,cval,30);\n            ffpmsg(msg);\n            return(*status);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffc2ii(const char *cval,  /* I - string representation of the value */\n          long *ival,         /* O - numerical value of the input string */\n          int *status)        /* IO - error status */\n/*\n  convert null-terminated formatted string to an integer value\n*/\n{\n    char *loc, msg[81];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    errno = 0;\n    *ival = 0;\n    *ival = strtol(cval, &loc, 10);  /* read the string as an integer */\n\n    /* check for read error, or junk following the integer */\n    if (*loc != '\\0' && *loc != ' ' ) \n        *status = BAD_C2I;\n\n    if (errno == ERANGE)\n    {\n        strcpy(msg,\"Range Error in ffc2ii converting string to long int: \");\n        strncat(msg,cval,25);\n        ffpmsg(msg);\n\n        *status = NUM_OVERFLOW;\n        errno = 0;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffc2jj(const char *cval,  /* I - string representation of the value */\n          LONGLONG *ival,     /* O - numerical value of the input string */\n          int *status)        /* IO - error status */\n/*\n  convert null-terminated formatted string to an long long integer value\n*/\n{\n    char *loc, msg[81];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    errno = 0;\n    *ival = 0;\n\n#if defined(_MSC_VER)\n\n    /* Microsoft Visual C++ 6.0 does not have the strtoll function */\n    *ival =  _atoi64(cval);\n    loc = (char *) cval;\n    while (*loc == ' ') loc++;     /* skip spaces */\n    if    (*loc == '-') loc++;     /* skip minus sign */\n    if    (*loc == '+') loc++;     /* skip plus sign */\n    while (isdigit(*loc)) loc++;   /* skip digits */\n\n#elif (USE_LL_SUFFIX == 1)\n    *ival = strtoll(cval, &loc, 10);  /* read the string as an integer */\n#else\n    *ival = strtol(cval, &loc, 10);  /* read the string as an integer */\n#endif\n\n    /* check for read error, or junk following the integer */\n    if (*loc != '\\0' && *loc != ' ' ) \n        *status = BAD_C2I;\n\n    if (errno == ERANGE)\n    {\n        strcpy(msg,\"Range Error in ffc2jj converting string to longlong int: \");\n        strncat(msg,cval,23);\n        ffpmsg(msg);\n\n        *status = NUM_OVERFLOW;\n        errno = 0;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffc2ujj(const char *cval,  /* I - string representation of the value */\n          ULONGLONG *ival,     /* O - numerical value of the input string */\n          int *status)        /* IO - error status */\n/*\n  convert null-terminated formatted string to an unsigned long long integer value\n*/\n{\n    char *loc, msg[81];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    errno = 0;\n    *ival = 0;\n\n#if defined(_MSC_VER)\n\n    /* Microsoft Visual C++ 6.0 does not have the strtoll function */\n/*  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  */\n/* !!!!!  This needs to be modified to use the unsigned long long version of _atoi64 */\n/*  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  */\n\n    *ival =  _atoi64(cval);\n    loc = (char *) cval;\n    while (*loc == ' ') loc++;     /* skip spaces */\n    if    (*loc == '-') loc++;     /* skip minus sign */\n    if    (*loc == '+') loc++;     /* skip plus sign */\n    while (isdigit(*loc)) loc++;   /* skip digits */\n\n#elif (USE_LL_SUFFIX == 1)\n    *ival = strtoull(cval, &loc, 10);  /* read the string as an integer */\n#else\n    *ival = strtoul(cval, &loc, 10);  /* read the string as an integer */\n#endif\n\n    /* check for read error, or junk following the integer */\n    if (*loc != '\\0' && *loc != ' ' ) \n        *status = BAD_C2I;\n\n    if (errno == ERANGE)\n    {\n        strcpy(msg,\"Range Error in ffc2ujj converting string to unsigned longlong int: \");\n        strncat(msg,cval,25);\n        ffpmsg(msg);\n\n        *status = NUM_OVERFLOW;\n        errno = 0;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffc2ll(const char *cval,  /* I - string representation of the value: T or F */\n           int *lval,         /* O - numerical value of the input string: 1 or 0 */\n           int *status)       /* IO - error status */\n/*\n  convert null-terminated formatted string to a logical value\n*/\n{\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (cval[0] == 'T')\n        *lval = 1;\n    else                \n        *lval = 0;        /* any character besides T is considered false */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffc2s(const char *instr,  /* I - null terminated quoted input string */\n          char *outstr,       /* O - null terminated output string without quotes */\n          int *status)        /* IO - error status */\n/*\n    convert an input quoted string to an unquoted string by removing\n    the leading and trailing quote character.  Also, replace any\n    pairs of single quote characters with just a single quote \n    character (FITS used a pair of single quotes to represent\n    a literal quote character within the string).\n*/\n{\n    int jj;\n    size_t len, ii;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (instr[0] != '\\'')\n    {\n        if (instr[0] == '\\0') {\n           outstr[0] = '\\0';\n           return(*status = VALUE_UNDEFINED);  /* null value string */\n        } else {\n          strcpy(outstr, instr);  /* no leading quote, so return input string */\n          return(*status);\n        }\n    }\n\n    len = strlen(instr);\n\n    for (ii=1, jj=0; ii < len; ii++, jj++)\n    {\n        if (instr[ii] == '\\'')  /*  is this the closing quote?  */\n        {\n            if (instr[ii+1] == '\\'')  /* 2 successive quotes? */\n                ii++;  /* copy only one of the quotes */\n            else\n                break;   /*  found the closing quote, so exit this loop  */\n        }\n        outstr[jj] = instr[ii];   /* copy the next character to the output */\n    }\n\n    outstr[jj] = '\\0';             /*  terminate the output string  */\n\n    if (ii == len)\n    {\n        ffpmsg(\"This string value has no closing quote (ffc2s):\");\n        ffpmsg(instr);\n        return(*status = 205);\n    }\n\n    for (jj--; jj >= 0; jj--)  /* replace trailing blanks with nulls */\n    {\n        if (outstr[jj] == ' ')\n            outstr[jj] = 0;\n        else\n            break;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffc2rr(const char *cval,   /* I - string representation of the value */\n           float *fval,        /* O - numerical value of the input string */\n           int *status)        /* IO - error status */\n/*\n  convert null-terminated formatted string to a float value\n*/\n{\n    char *loc, msg[81], tval[73];\n    struct lconv *lcc = 0;\n    static char decimalpt = 0;\n    short *sptr, iret;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (!decimalpt) { /* only do this once for efficiency */\n       lcc = localeconv();   /* set structure containing local decimal point symbol */\n       decimalpt = *(lcc->decimal_point);\n    }\n\n    errno = 0;\n    *fval = 0.;\n\n    if (strchr(cval, 'D') || decimalpt == ',')  {\n        /* strtod expects a comma, not a period, as the decimal point */\n        if (strlen(cval) > 72)\n        {\n           strcpy(msg,\"Error: Invalid string to float in ffc2rr\");\n           ffpmsg(msg);\n           return (*status=BAD_C2F);\n        }\n        strcpy(tval, cval);\n\n        /*  The C language does not support a 'D'; replace with 'E' */\n        if ((loc = strchr(tval, 'D'))) *loc = 'E';\n\n        if (decimalpt == ',')  {\n            /* strtod expects a comma, not a period, as the decimal point */\n            if ((loc = strchr(tval, '.')))  *loc = ',';   \n        }\n\n        *fval = (float) strtod(tval, &loc);  /* read the string as an float */\n    } else {\n        *fval = (float) strtod(cval, &loc);\n    }\n\n    /* check for read error, or junk following the value */\n    if (*loc != '\\0' && *loc != ' ' )\n    {\n        strcpy(msg,\"Error in ffc2rr converting string to float: \");\n        strncat(msg,cval,30);\n        ffpmsg(msg);\n\n        *status = BAD_C2F;   \n    }\n\n    sptr = (short *) fval;\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n    sptr++;       /* point to MSBs */\n#endif\n    iret = fnan(*sptr);  /* if iret == 1, then the float value is a NaN */\n\n    if (errno == ERANGE || (iret == 1) )\n    {\n        strcpy(msg,\"Error in ffc2rr converting string to float: \");\n        strncat(msg,cval,30);\n        ffpmsg(msg);\n\t*fval = 0.;\n\n        *status = NUM_OVERFLOW;\n        errno = 0;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffc2dd(const char *cval,   /* I - string representation of the value */\n           double *dval,       /* O - numerical value of the input string */\n           int *status)        /* IO - error status */\n/*\n  convert null-terminated formatted string to a double value\n*/\n{\n    char *loc, msg[81], tval[73];\n    struct lconv *lcc = 0;\n    static char decimalpt = 0;\n    short *sptr, iret;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (!decimalpt) { /* only do this once for efficiency */\n       lcc = localeconv();   /* set structure containing local decimal point symbol */\n       decimalpt = *(lcc->decimal_point);\n    }\n   \n    errno = 0;\n    *dval = 0.;\n\n    if (strchr(cval, 'D') || decimalpt == ',') {\n        /* need to modify a temporary copy of the string before parsing it */\n        if (strlen(cval) > 72)\n        {\n           strcpy(msg,\"Error: Invalid string to double in ffc2dd\");\n           ffpmsg(msg);\n           return (*status=BAD_C2D);\n        }\n        strcpy(tval, cval);\n        /*  The C language does not support a 'D'; replace with 'E' */\n        if ((loc = strchr(tval, 'D'))) *loc = 'E';\n\n        if (decimalpt == ',')  {\n            /* strtod expects a comma, not a period, as the decimal point */\n            if ((loc = strchr(tval, '.')))  *loc = ',';   \n        }\n    \n        *dval = strtod(tval, &loc);  /* read the string as an double */\n    } else {\n        *dval = strtod(cval, &loc);\n    }\n\n    /* check for read error, or junk following the value */\n    if (*loc != '\\0' && *loc != ' ' )\n    {\n        strcpy(msg,\"Error in ffc2dd converting string to double: \");\n        strncat(msg,cval,30);\n        ffpmsg(msg);\n\n        *status = BAD_C2D;   \n    }\n\n    sptr = (short *) dval;\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n    sptr += 3;       /* point to MSBs */\n#endif\n    iret = dnan(*sptr);  /* if iret == 1, then the double value is a NaN */\n\n    if (errno == ERANGE || (iret == 1) )\n    {\n        strcpy(msg,\"Error in ffc2dd converting string to double: \");\n        strncat(msg,cval,30);\n        ffpmsg(msg);\n\t*dval = 0.;\n\n        *status = NUM_OVERFLOW;\n        errno = 0;\n    }\n\n    return(*status);\n}\n\n/* ================================================================== */\n/* A hack for nonunix machines, which lack strcasecmp and strncasecmp */\n/* ================================================================== */\n\nint fits_strcasecmp(const char *s1, const char *s2)\n{\n   char c1, c2;\n\n   for (;;) {\n      c1 = toupper( *s1 );\n      c2 = toupper( *s2 );\n\n      if (c1 < c2) return(-1);\n      if (c1 > c2) return(1);\n      if (c1 == 0) return(0);\n      s1++;\n      s2++;\n   }\n}\n\nint fits_strncasecmp(const char *s1, const char *s2, size_t n)\n{\n   char c1, c2;\n\n   for (; n-- ;) {\n      c1 = toupper( *s1 );\n      c2 = toupper( *s2 );\n\n      if (c1 < c2) return(-1);\n      if (c1 > c2) return(1);\n      if (c1 == 0) return(0);\n      s1++;\n      s2++;\n   }\n   return(0);\n}\n"},{"id":16640,"name":"group.h","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"#define MAX_HDU_TRACKER 1000\n\ntypedef struct _HDUtracker HDUtracker;\n\nstruct _HDUtracker\n{\n  int nHDU;\n\n  char *filename[MAX_HDU_TRACKER];\n  int  position[MAX_HDU_TRACKER];\n\n  char *newFilename[MAX_HDU_TRACKER];\n  int  newPosition[MAX_HDU_TRACKER];\n};\n\n/* functions used internally in the grouping convention module */\n\nint ffgtdc(int grouptype, int xtensioncol, int extnamecol, int extvercol,\n\t   int positioncol, int locationcol, int uricol, char *ttype[],\n\t   char *tform[], int *ncols, int  *status);\n\nint ffgtgc(fitsfile *gfptr, int *xtensionCol, int *extnameCol, int *extverCol,\n\t   int *positionCol, int *locationCol, int *uriCol, int *grptype,\n\t   int *status);\n\nint ffvcfm(fitsfile *gfptr, int xtensionCol, int extnameCol, int extverCol,\n\t   int positionCol, int locationCol, int uriCol, int *status);\n\nint ffgmul(fitsfile *mfptr, int rmopt, int *status);\n\nint ffgmf(fitsfile *gfptr, char *xtension, char *extname, int extver,\t   \n\t  int position,\tchar *location,\tlong *member, int *status);\n\nint ffgtrmr(fitsfile *gfptr, HDUtracker *HDU, int *status);\n\nint ffgtcpr(fitsfile *infptr, fitsfile *outfptr, int cpopt, HDUtracker *HDU,\n\t    int *status);\n\nint fftsad(fitsfile *mfptr, HDUtracker *HDU, int *newPosition, \n\t   char *newFileName);\n\nint fftsud(fitsfile *mfptr, HDUtracker *HDU, int newPosition, \n\t   char *newFileName);\n\nvoid prepare_keyvalue(char *keyvalue);\n\nint fits_path2url(char *inpath, int maxlength, char *outpath, int  *status);\n\nint fits_url2path(char *inpath, char *outpath, int  *status);\n\nint fits_get_cwd(char *cwd, int *status);\n\nint fits_get_url(fitsfile *fptr, char *realURL, char *startURL, \n\t\t char *realAccess, char *startAccess, int *iostate, \n\t\t int *status);\n\nint fits_clean_url(char *inURL, char *outURL, int *status);\n\nint fits_relurl2url(char *refURL, char *relURL, char *absURL, int *status);\n\nint fits_url2relurl(char *refURL, char *absURL, char *relURL, int *status);\n\nint fits_encode_url(char *inpath, int maxlength, char *outpath, int *status);\n\nint fits_unencode_url(char *inpath, char *outpath, int *status);\n\nint fits_is_url_absolute(char *url);\n\n"},{"id":16641,"name":"drvrmem.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, drvrmem.c, contains driver routines for memory files.        */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <string.h>\n#include <stdlib.h>\n#include <stddef.h>  /* apparently needed to define size_t */\n#include \"fitsio2.h\"\n\n#if HAVE_BZIP2\n#include \"bzlib.h\"\n#endif\n\n/* prototype for .Z file uncompression function in zuncompress.c */\nint zuncompress2mem(char *filename, \n             FILE *diskfile, \n             char **buffptr, \n             size_t *buffsize, \n             void *(*mem_realloc)(void *p, size_t newsize),\n             size_t *filesize,\n             int *status);\n\n#if HAVE_BZIP2\n/* prototype for .bz2 uncompression function (in this file) */\nvoid bzip2uncompress2mem(char *filename, FILE *diskfile, int hdl,\n                         size_t* filesize, int* status);\n#endif\n\n\n#define RECBUFLEN 1000\n\nstatic char stdin_outfile[FLEN_FILENAME];\n\ntypedef struct    /* structure containing mem file structure */ \n{\n    char **memaddrptr;   /* Pointer to memory address pointer; */\n                         /* This may or may not point to memaddr. */\n    char *memaddr;       /* Pointer to starting memory address; may */\n                         /* not always be used, so use *memaddrptr instead */\n    size_t *memsizeptr;  /* Pointer to the size of the memory allocation. */\n                         /* This may or may not point to memsize. */\n    size_t memsize;      /* Size of the memory allocation; this may not */\n                         /* always be used, so use *memsizeptr instead. */\n    size_t deltasize;    /* Suggested increment for reallocating memory */\n    void *(*mem_realloc)(void *p, size_t newsize);  /* realloc function */\n    LONGLONG currentpos;   /* current file position, relative to start */\n    LONGLONG fitsfilesize; /* size of the FITS file (always <= *memsizeptr) */\n    FILE *fileptr;      /* pointer to compressed output disk file */\n} memdriver;\n\nstatic memdriver memTable[NMAXFILES];  /* allocate mem file handle tables */\n\n/*--------------------------------------------------------------------------*/\nint mem_init(void)\n{\n    int ii;\n\n    for (ii = 0; ii < NMAXFILES; ii++) /* initialize all empty slots in table */\n    {\n       memTable[ii].memaddrptr = 0;\n       memTable[ii].memaddr = 0;\n    }\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint mem_setoptions(int options)\n{\n  /* do something with the options argument, to stop compiler warning */\n  options = 0;\n  return(options);\n}\n/*--------------------------------------------------------------------------*/\nint mem_getoptions(int *options)\n{\n  *options = 0;\n  return(0);\n}\n/*--------------------------------------------------------------------------*/\nint mem_getversion(int *version)\n{\n    *version = 10;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint mem_shutdown(void)\n{\n  return(0);\n}\n/*--------------------------------------------------------------------------*/\nint mem_create(char *filename, int *handle)\n/*\n  Create a new empty memory file for subsequent writes.\n  The file name is ignored in this case.\n*/\n{\n    int status;\n\n    /* initially allocate 1 FITS block = 2880 bytes */\n    status = mem_createmem(2880L, handle);\n\n    if (status)\n    {\n        ffpmsg(\"failed to create empty memory file (mem_create)\");\n        return(status);\n    }\n\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint mem_create_comp(char *filename, int *handle)\n/*\n  Create a new empty memory file for subsequent writes.\n  Also create an empty compressed .gz file.  The memory file\n  will be compressed and written to the disk file when the file is closed.\n*/\n{\n    FILE *diskfile;\n    char mode[4];\n    int  status;\n\n    /* first, create disk file for the compressed output */\n\n\n    if ( !strcmp(filename, \"-.gz\") || !strcmp(filename, \"stdout.gz\") ||\n         !strcmp(filename, \"STDOUT.gz\") )\n    {\n       /* special case: create uncompressed FITS file in memory, then\n          compress it an write it out to 'stdout' when it is closed.  */\n\n       diskfile = stdout;\n    }\n    else\n    {\n        /* normal case: create disk file for the compressed output */\n\n        strcpy(mode, \"w+b\");    /* create file with read-write */\n\n        diskfile = fopen(filename, \"r\"); /* does file already exist? */\n\n        if (diskfile)\n        {\n            fclose(diskfile);         /* close file and exit with error */\n            return(FILE_NOT_CREATED); \n        }\n\n#if MACHINE == ALPHAVMS || MACHINE == VAXVMS\n        /* specify VMS record structure: fixed format, 2880 byte records */\n        /* but force stream mode access to enable random I/O access      */\n        diskfile = fopen(filename, mode, \"rfm=fix\", \"mrs=2880\", \"ctx=stm\"); \n#else\n        diskfile = fopen(filename, mode); \n#endif\n\n        if (!(diskfile))           /* couldn't create file */\n        {\n            return(FILE_NOT_CREATED); \n        }\n    }\n\n    /* now create temporary memory file */\n\n    /* initially allocate 1 FITS block = 2880 bytes */\n    status = mem_createmem(2880L, handle);\n\n    if (status)\n    {\n        ffpmsg(\"failed to create empty memory file (mem_create_comp)\");\n        return(status);\n    }\n\n    memTable[*handle].fileptr = diskfile;\n\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint mem_openmem(void **buffptr,   /* I - address of memory pointer          */\n                size_t *buffsize, /* I - size of buffer, in bytes           */\n                size_t deltasize, /* I - increment for future realloc's     */\n                void *(*memrealloc)(void *p, size_t newsize),  /* function  */\n                int *handle)\n/* \n  lowest level routine to open a pre-existing memory file.\n*/\n{\n    int ii;\n\n    *handle = -1;\n    for (ii = 0; ii < NMAXFILES; ii++)  /* find empty slot in handle table */\n    {\n        if (memTable[ii].memaddrptr == 0)\n        {\n            *handle = ii;\n            break;\n        }\n    }\n    if (*handle == -1)\n       return(TOO_MANY_FILES);    /* too many files opened */\n\n    memTable[ii].memaddrptr = (char **) buffptr; /* pointer to start addres */\n    memTable[ii].memsizeptr = buffsize;     /* allocated size of memory */\n    memTable[ii].deltasize = deltasize;     /* suggested realloc increment */\n    memTable[ii].fitsfilesize = *buffsize;  /* size of FITS file (upper limit) */\n    memTable[ii].currentpos = 0;            /* at beginning of the file */\n    memTable[ii].mem_realloc = memrealloc;  /* memory realloc function */\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint mem_createmem(size_t msize, int *handle)\n/* \n  lowest level routine to allocate a memory file.\n*/\n{\n    int ii;\n\n    *handle = -1;\n    for (ii = 0; ii < NMAXFILES; ii++)  /* find empty slot in handle table */\n    {\n        if (memTable[ii].memaddrptr == 0)\n        {\n            *handle = ii;\n            break;\n        }\n    }\n    if (*handle == -1)\n       return(TOO_MANY_FILES);    /* too many files opened */\n\n    /* use the internally allocated memaddr and memsize variables */\n    memTable[ii].memaddrptr = &memTable[ii].memaddr;\n    memTable[ii].memsizeptr = &memTable[ii].memsize;\n\n    /* allocate initial block of memory for the file */\n    if (msize > 0)\n    {\n        memTable[ii].memaddr = (char *) malloc(msize); \n        if ( !(memTable[ii].memaddr) )\n        {\n            ffpmsg(\"malloc of initial memory failed (mem_createmem)\");\n            return(FILE_NOT_OPENED);\n        }\n    }\n\n    /* set initial state of the file */\n    memTable[ii].memsize = msize;\n    memTable[ii].deltasize = 2880;\n    memTable[ii].fitsfilesize = 0;\n    memTable[ii].currentpos = 0;\n    memTable[ii].mem_realloc = realloc;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint mem_truncate(int handle, LONGLONG filesize)\n/*\n  truncate the file to a new size\n*/\n{\n    char *ptr;\n\n    /* call the memory reallocation function, if defined */\n    if ( memTable[handle].mem_realloc )\n    {    /* explicit LONGLONG->size_t cast */\n        ptr = (memTable[handle].mem_realloc)(\n                                *(memTable[handle].memaddrptr),\n                                 (size_t) filesize);\n        if (!ptr)\n        {\n            ffpmsg(\"Failed to reallocate memory (mem_truncate)\");\n            return(MEMORY_ALLOCATION);\n        }\n\n        /* if allocated more memory, initialize it to zero */\n        if ( filesize > *(memTable[handle].memsizeptr) )\n        {\n             memset(ptr + *(memTable[handle].memsizeptr),\n                    0,\n                ((size_t) filesize) - *(memTable[handle].memsizeptr) );\n        }\n\n        *(memTable[handle].memaddrptr) = ptr;\n        *(memTable[handle].memsizeptr) = (size_t) (filesize);\n    }\n\n    memTable[handle].currentpos = filesize;\n    memTable[handle].fitsfilesize = filesize;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint stdin_checkfile(char *urltype, char *infile, char *outfile)\n/*\n   do any special case checking when opening a file on the stdin stream\n*/\n{\n    if (strlen(outfile))\n    {\n        stdin_outfile[0] = '\\0';\n        strncat(stdin_outfile,outfile,FLEN_FILENAME-1); /* an output file is specified */\n\tstrcpy(urltype,\"stdinfile://\");\n    }\n    else\n        *stdin_outfile = '\\0';  /* no output file was specified */\n\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint stdin_open(char *filename, int rwmode, int *handle)\n/*\n  open a FITS file from the stdin file stream by copying it into memory\n  The file name is ignored in this case.\n*/\n{\n    int status;\n    char cbuff;\n\n    if (*stdin_outfile)\n    {\n      /* copy the stdin stream to the specified disk file then open the file */\n\n      /* Create the output file */\n      status =  file_create(stdin_outfile,handle);\n\n      if (status)\n      {\n        ffpmsg(\"Unable to create output file to copy stdin (stdin_open):\");\n        ffpmsg(stdin_outfile);\n        return(status);\n      }\n \n      /* copy the whole stdin stream to the file */\n      status = stdin2file(*handle);\n      file_close(*handle);\n\n      if (status)\n      {\n        ffpmsg(\"failed to copy stdin to file (stdin_open)\");\n        ffpmsg(stdin_outfile);\n        return(status);\n      }\n\n      /* reopen file with proper rwmode attribute */\n      status = file_open(stdin_outfile, rwmode, handle);\n    }\n    else\n    {\n   \n      /* get the first character, then put it back */\n      cbuff = fgetc(stdin);\n      ungetc(cbuff, stdin);\n    \n      /* compressed files begin with 037 or 'P' */\n      if (cbuff == 31 || cbuff == 75)\n      {\n         /* looks like the input stream is compressed */\n         status = mem_compress_stdin_open(filename, rwmode, handle);\n\t \n      }\n      else\n      {\n        /* copy the stdin stream into memory then open file in memory */\n\n        if (rwmode != READONLY)\n        {\n          ffpmsg(\"cannot open stdin with WRITE access\");\n          return(READONLY_FILE);\n        }\n\n        status = mem_createmem(2880L, handle);\n\n        if (status)\n        {\n          ffpmsg(\"failed to create empty memory file (stdin_open)\");\n          return(status);\n        }\n \n        /* copy the whole stdin stream into memory */\n        status = stdin2mem(*handle);\n\n        if (status)\n        {\n          ffpmsg(\"failed to copy stdin into memory (stdin_open)\");\n          free(memTable[*handle].memaddr);\n        }\n      }\n    }\n\n    return(status);\n}\n/*--------------------------------------------------------------------------*/\nint stdin2mem(int hd)  /* handle number */\n/*\n  Copy the stdin stream into memory.  Fill whatever amount of memory\n  has already been allocated, then realloc more memory if necessary.\n*/\n{\n    size_t nread, memsize, delta;\n    LONGLONG filesize;\n    char *memptr;\n    char simple[] = \"SIMPLE\";\n    int c, ii, jj;\n\n    memptr = *memTable[hd].memaddrptr;\n    memsize = *memTable[hd].memsizeptr;\n    delta = memTable[hd].deltasize;\n\n    filesize = 0;\n    ii = 0;\n\n    for(jj = 0; (c = fgetc(stdin)) != EOF && jj < 2000; jj++)\n    {\n       /* Skip over any garbage at the beginning of the stdin stream by */\n       /* reading 1 char at a time, looking for 'S', 'I', 'M', 'P', 'L', 'E' */\n       /* Give up if not found in the first 2000 characters */\n\n       if (c == simple[ii])\n       {\n           ii++;\n           if (ii == 6)   /* found the complete string? */\n           {\n              memcpy(memptr, simple, 6);  /* copy \"SIMPLE\" to buffer */\n              filesize = 6;\n              break;\n           }\n       }\n       else\n          ii = 0;  /* reset search to beginning of the string */\n    }\n\n   if (filesize == 0)\n   {\n       ffpmsg(\"Couldn't find the string 'SIMPLE' in the stdin stream.\");\n       ffpmsg(\"This does not look like a FITS file.\");\n       return(FILE_NOT_OPENED);\n   }\n\n    /* fill up the remainder of the initial memory allocation */\n    nread = fread(memptr + 6, 1, memsize - 6, stdin);\n    nread += 6;  /* add in the 6 characters in 'SIMPLE' */\n\n    if (nread < memsize)    /* reached the end? */\n    {\n       memTable[hd].fitsfilesize = nread;\n       return(0);\n    }\n\n    filesize = nread;\n\n    while (1)\n    {\n        /* allocate memory for another FITS block */\n        memptr = realloc(memptr, memsize + delta);\n\n        if (!memptr)\n        {\n            ffpmsg(\"realloc failed while copying stdin (stdin2mem)\");\n            return(MEMORY_ALLOCATION);\n        }\n        memsize += delta;\n\n        /* read another FITS block */\n        nread = fread(memptr + filesize, 1, delta, stdin);\n\n        filesize += nread;\n\n        if (nread < delta)    /* reached the end? */\n           break;\n    }\n\n     memTable[hd].fitsfilesize = filesize;\n    *memTable[hd].memaddrptr = memptr;\n    *memTable[hd].memsizeptr = memsize;\n\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint stdin2file(int handle)  /* handle number */\n/*\n  Copy the stdin stream to a file.  .\n*/\n{\n    size_t nread;\n    char simple[] = \"SIMPLE\";\n    int c, ii, jj, status;\n    char recbuf[RECBUFLEN];\n\n    ii = 0;\n    for(jj = 0; (c = fgetc(stdin)) != EOF && jj < 2000; jj++)\n    {\n       /* Skip over any garbage at the beginning of the stdin stream by */\n       /* reading 1 char at a time, looking for 'S', 'I', 'M', 'P', 'L', 'E' */\n       /* Give up if not found in the first 2000 characters */\n\n       if (c == simple[ii])\n       {\n           ii++;\n           if (ii == 6)   /* found the complete string? */\n           {\n              memcpy(recbuf, simple, 6);  /* copy \"SIMPLE\" to buffer */\n              break;\n           }\n       }\n       else\n          ii = 0;  /* reset search to beginning of the string */\n    }\n\n   if (ii != 6)\n   {\n       ffpmsg(\"Couldn't find the string 'SIMPLE' in the stdin stream\");\n       return(FILE_NOT_OPENED);\n   }\n\n    /* fill up the remainder of the buffer */\n    nread = fread(recbuf + 6, 1, RECBUFLEN - 6, stdin);\n    nread += 6;  /* add in the 6 characters in 'SIMPLE' */\n\n    status = file_write(handle, recbuf, nread);\n    if (status)\n       return(status);\n\n    /* copy the rest of stdin stream */\n    while(0 != (nread = fread(recbuf,1,RECBUFLEN, stdin)))\n    {\n        status = file_write(handle, recbuf, nread);\n        if (status)\n           return(status);\n    }\n\n    return(status);\n}\n/*--------------------------------------------------------------------------*/\nint stdout_close(int handle)\n/*\n  copy the memory file to stdout, then free the memory\n*/\n{\n    int status = 0;\n\n    /* copy from memory to standard out.  explicit LONGLONG->size_t cast */\n    if(fwrite(memTable[handle].memaddr, 1,\n              ((size_t) memTable[handle].fitsfilesize), stdout) !=\n              (size_t) memTable[handle].fitsfilesize )\n    {\n                ffpmsg(\"failed to copy memory file to stdout (stdout_close)\");\n                status = WRITE_ERROR;\n    }\n\n    free( memTable[handle].memaddr );   /* free the memory */\n    memTable[handle].memaddrptr = 0;\n    memTable[handle].memaddr = 0;\n    return(status);\n}\n/*--------------------------------------------------------------------------*/\nint mem_compress_openrw(char *filename, int rwmode, int *hdl)\n/*\n  This routine opens the compressed diskfile and creates an empty memory\n  buffer with an appropriate size, then calls mem_uncompress2mem. It allows\n  the memory 'file' to be opened with READWRITE access.\n*/\n{\n   return(mem_compress_open(filename, READONLY, hdl));  \n}\n/*--------------------------------------------------------------------------*/\nint mem_compress_open(char *filename, int rwmode, int *hdl)\n/*\n  This routine opens the compressed diskfile and creates an empty memory\n  buffer with an appropriate size, then calls mem_uncompress2mem.\n*/\n{\n    FILE *diskfile;\n    int status, estimated = 1;\n    unsigned char buffer[4];\n    size_t finalsize, filesize;\n    LONGLONG llsize = 0;\n    unsigned int modulosize;\n    char *ptr;\n\n    if (rwmode != READONLY)\n    {\n        ffpmsg(\n  \"cannot open compressed file with WRITE access (mem_compress_open)\");\n        ffpmsg(filename);\n        return(READONLY_FILE);\n    }\n\n    /* open the compressed disk file */\n    status = file_openfile(filename, READONLY, &diskfile);\n    if (status)\n    {\n        ffpmsg(\"failed to open compressed disk file (compress_open)\");\n        ffpmsg(filename);\n        return(status);\n    }\n\n    if (fread(buffer, 1, 2, diskfile) != 2)  /* read 2 bytes */\n    {\n        fclose(diskfile);\n        return(READ_ERROR);\n    }\n\n    if (memcmp(buffer, \"\\037\\213\", 2) == 0)  /* GZIP */\n    {\n        /* the uncompressed file size is give at the end */\n        /* of the file in the ISIZE field  (modulo 2^32) */\n\n        fseek(diskfile, 0, 2);            /* move to end of file */\n        filesize = ftell(diskfile);       /* position = size of file */\n        fseek(diskfile, -4L, 1);          /* move back 4 bytes */\n        fread(buffer, 1, 4L, diskfile);   /* read 4 bytes */\n\n        /* have to worry about integer byte order */\n\tmodulosize  = buffer[0];\n\tmodulosize |= buffer[1] << 8;\n\tmodulosize |= buffer[2] << 16;\n\tmodulosize |= buffer[3] << 24;\n\n/*\n  the field ISIZE in the gzipped file header only stores 4 bytes and contains\n  the uncompressed file size modulo 2^32.  If the uncompressed file size\n  is less than the compressed file size (filesize), then one probably needs to\n  add 2^32 = 4294967296 to the uncompressed file size, assuming that the gzip\n  produces a compressed file that is smaller than the original file.\n\n  But one must allow for the case of very small files, where the\n  gzipped file may actually be larger then the original uncompressed file.\n  Therefore, only perform the modulo 2^32 correction test if the compressed \n  file is greater than 10,000 bytes in size.  (Note: this threhold would\n  fail only if the original file was greater than 2^32 bytes in size AND gzip \n  was able to compress it by more than a factor of 400,000 (!) which seems\n  highly unlikely.)\n  \n  Also, obviously, this 2^32 modulo correction cannot be performed if the\n  finalsize variable is only 32-bits long.  Typically, the 'size_t' integer\n  type must be 8 bytes or larger in size to support data files that are \n  greater than 2 GB (2^31 bytes) in size.  \n*/\n        finalsize = modulosize;\n\n        if (sizeof(size_t) > 4 && filesize > 10000) {\n\t    llsize = (LONGLONG) finalsize;  \n\t    /* use LONGLONG variable to suppress compiler warning */\n            while (llsize <  (LONGLONG) filesize) llsize += 4294967296;\n\n            finalsize = (size_t) llsize;\n        }\n\n        estimated = 0;  /* file size is known, not estimated */\n    }\n    else if (memcmp(buffer, \"\\120\\113\", 2) == 0)   /* PKZIP */\n    {\n        /* the uncompressed file size is give at byte 22 the file */\n\n        fseek(diskfile, 22L, 0);            /* move to byte 22 */\n        fread(buffer, 1, 4L, diskfile);   /* read 4 bytes */\n\n        /* have to worry about integer byte order */\n\tmodulosize  = buffer[0];\n\tmodulosize |= buffer[1] << 8;\n\tmodulosize |= buffer[2] << 16;\n\tmodulosize |= buffer[3] << 24;\n        finalsize = modulosize;\n\n        estimated = 0;  /* file size is known, not estimated */\n    }\n    else if (memcmp(buffer, \"\\037\\036\", 2) == 0)  /* PACK */\n        finalsize = 0;  /* for most methods we can't determine final size */\n    else if (memcmp(buffer, \"\\037\\235\", 2) == 0)  /* LZW */\n        finalsize = 0;  /* for most methods we can't determine final size */\n    else if (memcmp(buffer, \"\\037\\240\", 2) == 0)  /* LZH */\n        finalsize = 0;  /* for most methods we can't determine final size */\n#if HAVE_BZIP2\n    else if (memcmp(buffer, \"BZ\", 2) == 0)        /* BZip2 */\n        finalsize = 0;  /* for most methods we can't determine final size */\n#endif\n    else\n    {\n        /* not a compressed file; this should never happen */\n        fclose(diskfile);\n        return(1);\n    }\n\n    if (finalsize == 0)  /* estimate uncompressed file size */\n    {\n            fseek(diskfile, 0, 2);   /* move to end of the compressed file */\n            finalsize = ftell(diskfile);  /* position = size of file */\n            finalsize = finalsize * 3;   /* assume factor of 3 compression */\n    }\n\n    fseek(diskfile, 0, 0);   /* move back to beginning of file */\n\n    /* create a memory file big enough (hopefully) for the uncompressed file */\n    status = mem_createmem(finalsize, hdl);\n\n    if (status && estimated)\n    {\n        /* memory allocation failed, so try a smaller estimated size */\n        finalsize = finalsize / 3;\n        status = mem_createmem(finalsize, hdl);\n    }\n\n    if (status)\n    {\n        fclose(diskfile);\n        ffpmsg(\"failed to create empty memory file (compress_open)\");\n        return(status);\n    }\n\n    /* uncompress file into memory */\n    status = mem_uncompress2mem(filename, diskfile, *hdl);\n\n    fclose(diskfile);\n\n    if (status)\n    {\n        mem_close_free(*hdl);   /* free up the memory */\n        ffpmsg(\"failed to uncompress file into memory (compress_open)\");\n        return(status);\n    }\n\n    /* if we allocated too much memory initially, then free it */\n    if (*(memTable[*hdl].memsizeptr) > \n       (( (size_t) memTable[*hdl].fitsfilesize) + 256L) ) \n    {\n        ptr = realloc(*(memTable[*hdl].memaddrptr), \n                     ((size_t) memTable[*hdl].fitsfilesize) );\n        if (!ptr)\n        {\n            ffpmsg(\"Failed to reduce size of allocated memory (compress_open)\");\n            return(MEMORY_ALLOCATION);\n        }\n\n        *(memTable[*hdl].memaddrptr) = ptr;\n        *(memTable[*hdl].memsizeptr) = (size_t) (memTable[*hdl].fitsfilesize);\n    }\n\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint mem_compress_stdin_open(char *filename, int rwmode, int *hdl)\n/*\n  This routine reads the compressed input stream and creates an empty memory\n  buffer, then calls mem_uncompress2mem.\n*/\n{\n    int status;\n    char *ptr;\n\n    if (rwmode != READONLY)\n    {\n        ffpmsg(\n  \"cannot open compressed input stream with WRITE access (mem_compress_stdin_open)\");\n        return(READONLY_FILE);\n    }\n \n    /* create a memory file for the uncompressed file */\n    status = mem_createmem(28800, hdl);\n\n    if (status)\n    {\n        ffpmsg(\"failed to create empty memory file (compress_stdin_open)\");\n        return(status);\n    }\n\n    /* uncompress file into memory */\n    status = mem_uncompress2mem(filename, stdin, *hdl);\n\n    if (status)\n    {\n        mem_close_free(*hdl);   /* free up the memory */\n        ffpmsg(\"failed to uncompress stdin into memory (compress_stdin_open)\");\n        return(status);\n    }\n\n    /* if we allocated too much memory initially, then free it */\n    if (*(memTable[*hdl].memsizeptr) > \n       (( (size_t) memTable[*hdl].fitsfilesize) + 256L) ) \n    {\n        ptr = realloc(*(memTable[*hdl].memaddrptr), \n                      ((size_t) memTable[*hdl].fitsfilesize) );\n        if (!ptr)\n        {\n            ffpmsg(\"Failed to reduce size of allocated memory (compress_stdin_open)\");\n            return(MEMORY_ALLOCATION);\n        }\n\n        *(memTable[*hdl].memaddrptr) = ptr;\n        *(memTable[*hdl].memsizeptr) = (size_t) (memTable[*hdl].fitsfilesize);\n    }\n\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint mem_iraf_open(char *filename, int rwmode, int *hdl)\n/*\n  This routine creates an empty memory buffer, then calls iraf2mem to\n  open the IRAF disk file and convert it to a FITS file in memeory.\n*/\n{\n    int status;\n    size_t filesize = 0;\n\n    /* create a memory file with size = 0 for the FITS converted IRAF file */\n    status = mem_createmem(filesize, hdl);\n    if (status)\n    {\n        ffpmsg(\"failed to create empty memory file (mem_iraf_open)\");\n        return(status);\n    }\n\n    /* convert the iraf file into a FITS file in memory */\n    status = iraf2mem(filename, memTable[*hdl].memaddrptr,\n                      memTable[*hdl].memsizeptr, &filesize, &status);\n\n    if (status)\n    {\n        mem_close_free(*hdl);   /* free up the memory */\n        ffpmsg(\"failed to convert IRAF file into memory (mem_iraf_open)\");\n        return(status);\n    }\n\n    memTable[*hdl].currentpos = 0;           /* save starting position */\n    memTable[*hdl].fitsfilesize=filesize;   /* and initial file size  */\n\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint mem_rawfile_open(char *filename, int rwmode, int *hdl)\n/*\n  This routine creates an empty memory buffer, writes a minimal\n  image header, then copies the image data from the raw file into\n  memory.  It will byteswap the pixel values if the raw array\n  is in little endian byte order.\n*/\n{\n    FILE *diskfile;\n    fitsfile *fptr;\n    short *sptr;\n    int status, endian, datatype, bytePerPix, naxis;\n    long dim[5] = {1,1,1,1,1}, ii, nvals, offset = 0;\n    size_t filesize = 0, datasize;\n    char rootfile[FLEN_FILENAME], *cptr = 0, *cptr2 = 0;\n    void *ptr;\n\n    if (rwmode != READONLY)\n    {\n        ffpmsg(\n  \"cannot open raw binary file with WRITE access (mem_rawfile_open)\");\n        ffpmsg(filename);\n        return(READONLY_FILE);\n    }\n\n    cptr = strchr(filename, '[');   /* search for opening bracket [ */\n\n    if (!cptr)\n    {\n        ffpmsg(\"binary file name missing '[' character (mem_rawfile_open)\");\n        ffpmsg(filename);\n        return(URL_PARSE_ERROR);\n    }\n\n    *rootfile = '\\0';\n    strncat(rootfile, filename, cptr - filename);  /* store the rootname */\n\n    cptr++;\n\n    while (*cptr == ' ')\n       cptr++;    /* skip leading blanks */\n\n    /* Get the Data Type of the Image */\n\n    if (*cptr == 'b' || *cptr == 'B')\n    {\n      datatype = BYTE_IMG;\n      bytePerPix = 1;\n    }\n    else if (*cptr == 'i' || *cptr == 'I')\n    {\n      datatype = SHORT_IMG;\n      bytePerPix = 2;\n    }\n    else if (*cptr == 'u' || *cptr == 'U')\n    {\n      datatype = USHORT_IMG;\n      bytePerPix = 2;\n\n    }\n    else if (*cptr == 'j' || *cptr == 'J')\n    {\n      datatype = LONG_IMG;\n      bytePerPix = 4;\n    }  \n    else if (*cptr == 'r' || *cptr == 'R' || *cptr == 'f' || *cptr == 'F')\n    {\n      datatype = FLOAT_IMG;\n      bytePerPix = 4;\n    }    \n    else if (*cptr == 'd' || *cptr == 'D')\n    {\n      datatype = DOUBLE_IMG;\n      bytePerPix = 8;\n    }\n    else\n    {\n        ffpmsg(\"error in raw binary file datatype (mem_rawfile_open)\");\n        ffpmsg(filename);\n        return(URL_PARSE_ERROR);\n    }\n\n    cptr++;\n\n    /* get Endian: Big or Little; default is same as the local machine */\n    \n    if (*cptr == 'b' || *cptr == 'B')\n    {\n        endian = 0;\n        cptr++;\n    }\n    else if (*cptr == 'l' || *cptr == 'L')\n    {\n        endian = 1;\n        cptr++;\n    }\n    else\n        endian = BYTESWAPPED; /* byteswapped machines are little endian */\n\n    /* read each dimension (up to 5) */\n\n    naxis = 1;\n    dim[0] = strtol(cptr, &cptr2, 10);\n    \n    if (cptr2 && *cptr2 == ',')\n    {\n      naxis = 2;\n      dim[1] = strtol(cptr2+1, &cptr, 10);\n\n      if (cptr && *cptr == ',')\n      {\n        naxis = 3;\n        dim[2] = strtol(cptr+1, &cptr2, 10);\n\n        if (cptr2 && *cptr2 == ',')\n        {\n          naxis = 4;\n          dim[3] = strtol(cptr2+1, &cptr, 10);\n\n          if (cptr && *cptr == ',')\n            naxis = 5;\n            dim[4] = strtol(cptr+1, &cptr2, 10);\n        }\n      }\n    }\n\n    cptr = maxvalue(cptr, cptr2);\n\n    if (*cptr == ':')   /* read starting offset value */\n        offset = strtol(cptr+1, 0, 10);\n\n    nvals = dim[0] * dim[1] * dim[2] * dim[3] * dim[4];\n    datasize = nvals * bytePerPix;\n    filesize = nvals * bytePerPix + 2880;\n    filesize = ((filesize - 1) / 2880 + 1) * 2880; \n\n    /* open the raw binary disk file */\n    status = file_openfile(rootfile, READONLY, &diskfile);\n    if (status)\n    {\n        ffpmsg(\"failed to open raw  binary file (mem_rawfile_open)\");\n        ffpmsg(rootfile);\n        return(status);\n    }\n\n    /* create a memory file with corrct size for the FITS converted raw file */\n    status = mem_createmem(filesize, hdl);\n    if (status)\n    {\n        ffpmsg(\"failed to create memory file (mem_rawfile_open)\");\n        fclose(diskfile);\n        return(status);\n    }\n\n    /* open this piece of memory as a new FITS file */\n    ffimem(&fptr, (void **) memTable[*hdl].memaddrptr, &filesize, 0, 0, &status);\n\n    /* write the required header keywords */\n    ffcrim(fptr, datatype, naxis, dim, &status);\n\n    /* close the FITS file, but keep the memory allocated */\n    ffclos(fptr, &status);\n\n    if (status > 0)\n    {\n        ffpmsg(\"failed to write basic image header (mem_rawfile_open)\");\n        fclose(diskfile);\n        mem_close_free(*hdl);   /* free up the memory */\n        return(status);\n    }\n\n    if (offset > 0)\n       fseek(diskfile, offset, 0);   /* offset to start of the data */\n\n    /* read the raw data into memory */\n    ptr = *memTable[*hdl].memaddrptr + 2880;\n\n    if (fread((char *) ptr, 1, datasize, diskfile) != datasize)\n      status = READ_ERROR;\n\n    fclose(diskfile);  /* close the raw binary disk file */\n\n    if (status)\n    {\n        mem_close_free(*hdl);   /* free up the memory */\n        ffpmsg(\"failed to copy raw file data into memory (mem_rawfile_open)\");\n        return(status);\n    }\n\n    if (datatype == USHORT_IMG)  /* have to subtract 32768 from each unsigned */\n    {                            /* value to conform to FITS convention. More */\n                                 /* efficient way to do this is to just flip  */\n                                 /* the most significant bit.                 */\n\n      sptr = (short *) ptr;\n\n      if (endian == BYTESWAPPED)  /* working with native format */\n      {\n        for (ii = 0; ii < nvals; ii++, sptr++)\n        {\n          *sptr =  ( *sptr ) ^ 0x8000;\n        }\n      }\n      else  /* pixels are byteswapped WRT the native format */\n      {\n        for (ii = 0; ii < nvals; ii++, sptr++)\n        {\n          *sptr =  ( *sptr ) ^ 0x80;\n        }\n      }\n    }\n\n    if (endian)  /* swap the bytes if array is in little endian byte order */\n    {\n      if (datatype == SHORT_IMG || datatype == USHORT_IMG)\n      {\n        ffswap2( (short *) ptr, nvals);\n      }\n      else if (datatype == LONG_IMG || datatype == FLOAT_IMG)\n      {\n        ffswap4( (INT32BIT *) ptr, nvals);\n      }\n\n      else if (datatype == DOUBLE_IMG)\n      {\n        ffswap8( (double *) ptr, nvals);\n      }\n    }\n\n    memTable[*hdl].currentpos = 0;           /* save starting position */\n    memTable[*hdl].fitsfilesize=filesize;    /* and initial file size  */\n\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint mem_uncompress2mem(char *filename, FILE *diskfile, int hdl)\n{\n/*\n  lower level routine to uncompress a file into memory.  The file\n  has already been opened and the memory buffer has been allocated.\n*/\n\n  size_t finalsize;\n  int status;\n  /* uncompress file into memory */\n  status = 0;\n\n    if (strstr(filename, \".Z\")) {\n         zuncompress2mem(filename, diskfile,\n\t\t memTable[hdl].memaddrptr,   /* pointer to memory address */\n\t\t memTable[hdl].memsizeptr,   /* pointer to size of memory */\n\t\t realloc,                     /* reallocation function */\n\t\t &finalsize, &status);        /* returned file size nd status*/\n#if HAVE_BZIP2\n    } else if (strstr(filename, \".bz2\")) {\n        bzip2uncompress2mem(filename, diskfile, hdl, &finalsize, &status);\n#endif\n    } else {\n         uncompress2mem(filename, diskfile,\n\t\t memTable[hdl].memaddrptr,   /* pointer to memory address */\n\t\t memTable[hdl].memsizeptr,   /* pointer to size of memory */\n\t\t realloc,                     /* reallocation function */\n\t\t &finalsize, &status);        /* returned file size nd status*/\n    } \n\n  memTable[hdl].currentpos = 0;           /* save starting position */\n  memTable[hdl].fitsfilesize=finalsize;   /* and initial file size  */\n  return status;\n}\n/*--------------------------------------------------------------------------*/\nint mem_size(int handle, LONGLONG *filesize)\n/*\n  return the size of the file; only called when the file is first opened\n*/\n{\n    *filesize = memTable[handle].fitsfilesize;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint mem_close_free(int handle)\n/*\n  close the file and free the memory.\n*/\n{\n    free( *(memTable[handle].memaddrptr) );\n\n    memTable[handle].memaddrptr = 0;\n    memTable[handle].memaddr = 0;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint mem_close_keep(int handle)\n/*\n  close the memory file but do not free the memory.\n*/\n{\n    memTable[handle].memaddrptr = 0;\n    memTable[handle].memaddr = 0;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint mem_close_comp(int handle)\n/*\n  compress the memory file, writing it out to the fileptr (which might\n  be stdout)\n*/\n{\n    int status = 0;\n    size_t compsize;\n\n    /* compress file in  memory to a .gz disk file */\n\n    if(compress2file_from_mem(memTable[handle].memaddr,\n              (size_t) (memTable[handle].fitsfilesize), \n              memTable[handle].fileptr,\n              &compsize, &status ) )\n    {\n            ffpmsg(\"failed to copy memory file to file (mem_close_comp)\");\n            status = WRITE_ERROR;\n    }\n\n    free( memTable[handle].memaddr );   /* free the memory */\n    memTable[handle].memaddrptr = 0;\n    memTable[handle].memaddr = 0;\n\n    /* close the compressed disk file (except if it is 'stdout' */\n    if (memTable[handle].fileptr != stdout)\n        fclose(memTable[handle].fileptr);\n\n    return(status);\n}\n/*--------------------------------------------------------------------------*/\nint mem_seek(int handle, LONGLONG offset)\n/*\n  seek to position relative to start of the file.\n*/\n{\n    if (offset >  memTable[handle].fitsfilesize )\n        return(END_OF_FILE);\n\n    memTable[handle].currentpos = offset;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint mem_read(int hdl, void *buffer, long nbytes)\n/*\n  read bytes from the current position in the file\n*/\n{\n    if (memTable[hdl].currentpos + nbytes > memTable[hdl].fitsfilesize)\n        return(END_OF_FILE);\n\n    memcpy(buffer,\n           *(memTable[hdl].memaddrptr) + memTable[hdl].currentpos,\n           nbytes);\n\n    memTable[hdl].currentpos += nbytes;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint mem_write(int hdl, void *buffer, long nbytes)\n/*\n  write bytes at the current position in the file\n*/\n{\n    size_t newsize;\n    char *ptr;\n\n    if ((size_t) (memTable[hdl].currentpos + nbytes) > \n         *(memTable[hdl].memsizeptr) )\n    {\n               \n        if (!(memTable[hdl].mem_realloc))\n        {\n            ffpmsg(\"realloc function not defined (mem_write)\");\n            return(WRITE_ERROR);\n        }\n\n        /*\n          Attempt to reallocate additional memory:\n          the memory buffer size is incremented by the larger of:\n             1 FITS block (2880 bytes) or\n             the defined 'deltasize' parameter\n         */\n\n        newsize = maxvalue( (size_t)\n            (((memTable[hdl].currentpos + nbytes - 1) / 2880) + 1) * 2880,\n            *(memTable[hdl].memsizeptr) + memTable[hdl].deltasize);\n\n        /* call the realloc function */\n        ptr = (memTable[hdl].mem_realloc)(\n                                    *(memTable[hdl].memaddrptr),\n                                     newsize);\n        if (!ptr)\n        {\n            ffpmsg(\"Failed to reallocate memory (mem_write)\");\n            return(MEMORY_ALLOCATION);\n        }\n\n        *(memTable[hdl].memaddrptr) = ptr;\n        *(memTable[hdl].memsizeptr) = newsize;\n    }\n\n    /* now copy the bytes from the buffer into memory */\n    memcpy( *(memTable[hdl].memaddrptr) + memTable[hdl].currentpos,\n             buffer,\n             nbytes);\n\n    memTable[hdl].currentpos += nbytes;\n    memTable[hdl].fitsfilesize =\n               maxvalue(memTable[hdl].fitsfilesize,\n                        memTable[hdl].currentpos);\n    return(0);\n}\n\n\n#if HAVE_BZIP2\nvoid bzip2uncompress2mem(char *filename, FILE *diskfile, int hdl,\n                        size_t* filesize, int* status) {\n    BZFILE* b;\n    int  bzerror;\n    char buf[8192];\n    size_t total_read = 0;\n    char* errormsg = NULL;\n\n    *filesize = 0;\n    *status = 0;\n    b = BZ2_bzReadOpen(&bzerror, diskfile, 0, 0, NULL, 0);\n    if (bzerror != BZ_OK) {\n        BZ2_bzReadClose(&bzerror, b);\n        if (bzerror == BZ_MEM_ERROR)\n            ffpmsg(\"failed to open a bzip2 file: out of memory\\n\");\n        else if (bzerror == BZ_CONFIG_ERROR)\n            ffpmsg(\"failed to open a bzip2 file: miscompiled bzip2 library\\n\");\n        else if (bzerror == BZ_IO_ERROR)\n            ffpmsg(\"failed to open a bzip2 file: I/O error\");\n        else\n            ffpmsg(\"failed to open a bzip2 file\");\n        *status = READ_ERROR;\n        return;\n    }\n    bzerror = BZ_OK;\n    while (bzerror == BZ_OK) {\n        int nread;\n        nread = BZ2_bzRead(&bzerror, b, buf, sizeof(buf));\n        if (bzerror == BZ_OK || bzerror == BZ_STREAM_END) {\n            *status = mem_write(hdl, buf, nread);\n            if (*status) {\n                BZ2_bzReadClose(&bzerror, b);\n                if (*status == MEMORY_ALLOCATION)\n                    ffpmsg(\"Failed to reallocate memory while uncompressing bzip2 file\");\n                return;\n            }\n            total_read += nread;\n        } else {\n            if (bzerror == BZ_IO_ERROR)\n                errormsg = \"failed to read bzip2 file: I/O error\";\n            else if (bzerror == BZ_UNEXPECTED_EOF)\n                errormsg = \"failed to read bzip2 file: unexpected end-of-file\";\n            else if (bzerror == BZ_DATA_ERROR)\n                errormsg = \"failed to read bzip2 file: data integrity error\";\n            else if (bzerror == BZ_MEM_ERROR)\n                errormsg = \"failed to read bzip2 file: insufficient memory\";\n        }\n    }\n    BZ2_bzReadClose(&bzerror, b);\n    if (bzerror != BZ_OK) {\n        if (errormsg)\n            ffpmsg(errormsg);\n        else\n            ffpmsg(\"failure closing bzip2 file after reading\\n\");\n        *status = READ_ERROR;\n        return;\n    }\n    *filesize = total_read;\n}\n#endif\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":20,"id":16642,"name":"_frame","nodeType":"Attribute","startLoc":20,"text":"self._frame"},{"attributeType":"null","col":8,"comment":"null","endLoc":140,"id":16643,"name":"xy","nodeType":"Attribute","startLoc":140,"text":"self.xy"},{"id":16644,"name":"buffers.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, buffers.c, contains the core set of FITSIO routines         */\n/*  that use or manage the internal set of IO buffers.                     */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffmbyt(fitsfile *fptr,    /* I - FITS file pointer                */\n           LONGLONG bytepos,     /* I - byte position in file to move to */\n           int err_mode,      /* I - 1=ignore error, 0 = return error */\n           int *status)       /* IO - error status                    */\n{\n/*\n  Move to the input byte location in the file.  When writing to a file, a move\n  may sometimes be made to a position beyond the current EOF.  The err_mode\n  parameter determines whether such conditions should be returned as an error\n  or simply ignored.\n*/\n    long record;\n\n    if (*status > 0)\n       return(*status);\n\n    if (bytepos < 0)\n        return(*status = NEG_FILE_POS);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    record = (long) (bytepos / IOBUFLEN);  /* zero-indexed record number */\n\n    /* if this is not the current record, then load it */\n    if ( ((fptr->Fptr)->curbuf < 0) || \n         (record != (fptr->Fptr)->bufrecnum[(fptr->Fptr)->curbuf])) \n        ffldrc(fptr, record, err_mode, status);\n\n    if (*status <= 0)\n        (fptr->Fptr)->bytepos = bytepos;  /* save new file position */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpbyt(fitsfile *fptr,   /* I - FITS file pointer                    */\n           LONGLONG nbytes,      /* I - number of bytes to write             */\n           void *buffer,     /* I - buffer containing the bytes to write */\n           int *status)      /* IO - error status                        */\n/*\n  put (write) the buffer of bytes to the output FITS file, starting at\n  the current file position.  Write large blocks of data directly to disk;\n  write smaller segments to intermediate IO buffers to improve efficiency.\n*/\n{\n    int ii, nbuff;\n    LONGLONG filepos;\n    long recstart, recend;\n    long ntodo, bufpos, nspace, nwrite;\n    char *cptr;\n\n    if (*status > 0)\n       return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if (nbytes > LONG_MAX) {\n        ffpmsg(\"Number of bytes to write is greater than LONG_MAX (ffpbyt).\");\n        *status = WRITE_ERROR;\n\treturn(*status);\n    }\n    \n    ntodo =  (long) nbytes;\n    cptr = (char *)buffer;\n\n    if ((fptr->Fptr)->curbuf < 0)  /* no current data buffer for this file */\n    {                              /* so reload the last one that was used */\n      ffldrc(fptr, (long) (((fptr->Fptr)->bytepos) / IOBUFLEN), REPORT_EOF, status);\n    }\n\n    if (nbytes >= MINDIRECT)\n    {\n      /* write large blocks of data directly to disk instead of via buffers */\n      /* first, fill up the current IO buffer before flushing it to disk */\n\n      nbuff = (fptr->Fptr)->curbuf;      /* current IO buffer number */\n      filepos = (fptr->Fptr)->bytepos;   /* save the write starting position */\n      recstart = (fptr->Fptr)->bufrecnum[nbuff];                 /* starting record */\n      recend = (long) ((filepos + nbytes - 1) / IOBUFLEN);  /* ending record   */\n\n      /* bufpos is the starting position within the IO buffer */\n      bufpos = (long) (filepos - ((LONGLONG)recstart * IOBUFLEN));\n      nspace = IOBUFLEN - bufpos;   /* amount of space left in the buffer */\n\n      if (nspace)\n      { /* fill up the IO buffer */\n        memcpy((fptr->Fptr)->iobuffer + (nbuff * IOBUFLEN) + bufpos, cptr, nspace);\n        ntodo -= nspace;           /* decrement remaining number of bytes */\n        cptr += nspace;            /* increment user buffer pointer */\n        filepos += nspace;         /* increment file position pointer */\n        (fptr->Fptr)->dirty[nbuff] = TRUE;       /* mark record as having been modified */\n      }\n\n      for (ii = 0; ii < NIOBUF; ii++) /* flush any affected buffers to disk */\n      {\n        if ((fptr->Fptr)->bufrecnum[ii] >= recstart\n            && (fptr->Fptr)->bufrecnum[ii] <= recend )\n        {\n          if ((fptr->Fptr)->dirty[ii])        /* flush modified buffer to disk */\n             ffbfwt(fptr->Fptr, ii, status);\n\n          (fptr->Fptr)->bufrecnum[ii] = -1;  /* disassociate buffer from the file */\n        }\n      }\n\n      /* move to the correct write position */\n      if ((fptr->Fptr)->io_pos != filepos)\n         ffseek(fptr->Fptr, filepos);\n\n      nwrite = ((ntodo - 1) / IOBUFLEN) * IOBUFLEN; /* don't write last buff */\n\n      ffwrite(fptr->Fptr, nwrite, cptr, status); /* write the data */\n      ntodo -= nwrite;                /* decrement remaining number of bytes */\n      cptr += nwrite;                  /* increment user buffer pointer */\n      (fptr->Fptr)->io_pos = filepos + nwrite; /* update the file position */\n\n      if ((fptr->Fptr)->io_pos >= (fptr->Fptr)->filesize) /* at the EOF? */\n      {\n        (fptr->Fptr)->filesize = (fptr->Fptr)->io_pos; /* increment file size */\n\n        /* initialize the current buffer with the correct fill value */\n        if ((fptr->Fptr)->hdutype == ASCII_TBL)\n          memset((fptr->Fptr)->iobuffer + (nbuff * IOBUFLEN), 32, IOBUFLEN);  /* blank fill */\n        else\n          memset((fptr->Fptr)->iobuffer + (nbuff * IOBUFLEN),  0, IOBUFLEN);  /* zero fill */\n      }\n      else\n      {\n        /* read next record */\n        ffread(fptr->Fptr, IOBUFLEN, (fptr->Fptr)->iobuffer + (nbuff * IOBUFLEN), status);\n        (fptr->Fptr)->io_pos += IOBUFLEN; \n      }\n\n      /* copy remaining bytes from user buffer into current IO buffer */\n      memcpy((fptr->Fptr)->iobuffer + (nbuff * IOBUFLEN), cptr, ntodo);\n      (fptr->Fptr)->dirty[nbuff] = TRUE;       /* mark record as having been modified */\n      (fptr->Fptr)->bufrecnum[nbuff] = recend; /* record number */\n\n      (fptr->Fptr)->logfilesize = maxvalue((fptr->Fptr)->logfilesize, \n                                       (LONGLONG)(recend + 1) * IOBUFLEN);\n      (fptr->Fptr)->bytepos = filepos + nwrite + ntodo;\n    }\n    else\n    {\n      /* bufpos is the starting position in IO buffer */\n      bufpos = (long) ((fptr->Fptr)->bytepos - ((LONGLONG)(fptr->Fptr)->bufrecnum[(fptr->Fptr)->curbuf] *\n               IOBUFLEN));\n      nspace = IOBUFLEN - bufpos;   /* amount of space left in the buffer */\n\n      while (ntodo)\n      {\n        nwrite = minvalue(ntodo, nspace);\n\n        /* copy bytes from user's buffer to the IO buffer */\n        memcpy((fptr->Fptr)->iobuffer + ((fptr->Fptr)->curbuf * IOBUFLEN) + bufpos, cptr, nwrite);\n        ntodo -= nwrite;            /* decrement remaining number of bytes */\n        cptr += nwrite;\n        (fptr->Fptr)->bytepos += nwrite;  /* increment file position pointer */\n        (fptr->Fptr)->dirty[(fptr->Fptr)->curbuf] = TRUE; /* mark record as modified */\n\n        if (ntodo)                  /* load next record into a buffer */\n        {\n          ffldrc(fptr, (long) ((fptr->Fptr)->bytepos / IOBUFLEN), IGNORE_EOF, status);\n          bufpos = 0;\n          nspace = IOBUFLEN;\n        }\n      }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpbytoff(fitsfile *fptr, /* I - FITS file pointer                   */\n           long gsize,        /* I - size of each group of bytes         */\n           long ngroups,      /* I - number of groups to write           */\n           long offset,       /* I - size of gap between groups          */\n           void *buffer,      /* I - buffer to be written                */\n           int *status)       /* IO - error status                       */\n/*\n  put (write) the buffer of bytes to the output FITS file, with an offset\n  between each group of bytes.  This function combines ffmbyt and ffpbyt\n  for increased efficiency.\n*/\n{\n    int bcurrent;\n    long ii, bufpos, nspace, nwrite, record;\n    char *cptr, *ioptr;\n\n    if (*status > 0)\n       return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if ((fptr->Fptr)->curbuf < 0)  /* no current data buffer for this file */\n    {                              /* so reload the last one that was used */\n      ffldrc(fptr, (long) (((fptr->Fptr)->bytepos) / IOBUFLEN), REPORT_EOF, status);\n    }\n\n    cptr = (char *)buffer;\n    bcurrent = (fptr->Fptr)->curbuf;     /* number of the current IO buffer */\n    record = (fptr->Fptr)->bufrecnum[bcurrent];  /* zero-indexed record number */\n    bufpos = (long) ((fptr->Fptr)->bytepos - ((LONGLONG)record * IOBUFLEN)); /* start pos */\n    nspace = IOBUFLEN - bufpos;  /* amount of space left in buffer */\n    ioptr = (fptr->Fptr)->iobuffer + (bcurrent * IOBUFLEN) + bufpos;  \n\n    for (ii = 1; ii < ngroups; ii++)  /* write all but the last group */\n    {\n      /* copy bytes from user's buffer to the IO buffer */\n      nwrite = minvalue(gsize, nspace);\n      memcpy(ioptr, cptr, nwrite);\n      cptr += nwrite;          /* increment buffer pointer */\n\n      if (nwrite < gsize)        /* entire group did not fit */\n      {\n        (fptr->Fptr)->dirty[bcurrent] = TRUE;  /* mark record as having been modified */\n        record++;\n        ffldrc(fptr, record, IGNORE_EOF, status);  /* load next record */\n        bcurrent = (fptr->Fptr)->curbuf;\n        ioptr   = (fptr->Fptr)->iobuffer + (bcurrent * IOBUFLEN);\n\n        nwrite  = gsize - nwrite;\n        memcpy(ioptr, cptr, nwrite);\n        cptr   += nwrite;            /* increment buffer pointer */\n        ioptr  += (offset + nwrite); /* increment IO buffer pointer */\n        nspace = IOBUFLEN - offset - nwrite;  /* amount of space left */\n      }\n      else\n      {\n        ioptr  += (offset + nwrite);  /* increment IO bufer pointer */\n        nspace -= (offset + nwrite);\n      }\n\n      if (nspace <= 0) /* beyond current record? */\n      {\n        (fptr->Fptr)->dirty[bcurrent] = TRUE;\n        record += ((IOBUFLEN - nspace) / IOBUFLEN); /* new record number */\n        ffldrc(fptr, record, IGNORE_EOF, status);\n        bcurrent = (fptr->Fptr)->curbuf;\n\n        bufpos = (-nspace) % IOBUFLEN; /* starting buffer pos */\n        nspace = IOBUFLEN - bufpos;\n        ioptr = (fptr->Fptr)->iobuffer + (bcurrent * IOBUFLEN) + bufpos;  \n      }\n    }\n      \n    /* now write the last group */\n    nwrite = minvalue(gsize, nspace);\n    memcpy(ioptr, cptr, nwrite);\n    cptr += nwrite;          /* increment buffer pointer */\n\n    if (nwrite < gsize)        /* entire group did not fit */\n    {\n      (fptr->Fptr)->dirty[bcurrent] = TRUE;  /* mark record as having been modified */\n      record++;\n      ffldrc(fptr, record, IGNORE_EOF, status);  /* load next record */\n      bcurrent = (fptr->Fptr)->curbuf;\n      ioptr   = (fptr->Fptr)->iobuffer + (bcurrent * IOBUFLEN);\n\n      nwrite  = gsize - nwrite;\n      memcpy(ioptr, cptr, nwrite);\n    }\n\n    (fptr->Fptr)->dirty[bcurrent] = TRUE;    /* mark record as having been modified */\n    (fptr->Fptr)->bytepos = (fptr->Fptr)->bytepos + (ngroups * gsize)\n                                  + (ngroups - 1) * offset;\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgbyt(fitsfile *fptr,    /* I - FITS file pointer             */\n           LONGLONG nbytes,       /* I - number of bytes to read       */\n           void *buffer,      /* O - buffer to read into           */\n           int *status)       /* IO - error status                 */\n/*\n  get (read) the requested number of bytes from the file, starting at\n  the current file position.  Read large blocks of data directly from disk;\n  read smaller segments via intermediate IO buffers to improve efficiency.\n*/\n{\n    int ii;\n    LONGLONG filepos;\n    long recstart, recend, ntodo, bufpos, nspace, nread;\n    char *cptr;\n\n    if (*status > 0)\n       return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    cptr = (char *)buffer;\n\n    if (nbytes >= MINDIRECT)\n    {\n      /* read large blocks of data directly from disk instead of via buffers */\n      filepos = (fptr->Fptr)->bytepos; /* save the read starting position */\n\n/*  note that in this case, ffmbyt has not been called, and so        */\n/*  bufrecnum[(fptr->Fptr)->curbuf] does not point to the intended */\n/*  output buffer */\n\n      recstart = (long) (filepos / IOBUFLEN);               /* starting record */\n      recend = (long) ((filepos + nbytes - 1) / IOBUFLEN);  /* ending record   */\n\n      for (ii = 0; ii < NIOBUF; ii++) /* flush any affected buffers to disk */\n      {\n        if ((fptr->Fptr)->dirty[ii] && \n            (fptr->Fptr)->bufrecnum[ii] >= recstart && (fptr->Fptr)->bufrecnum[ii] <= recend)\n            {\n              ffbfwt(fptr->Fptr, ii, status);    /* flush modified buffer to disk */\n            }\n      }\n\n       /* move to the correct read position */\n      if ((fptr->Fptr)->io_pos != filepos)\n         ffseek(fptr->Fptr, filepos);\n\n      ffread(fptr->Fptr, (long) nbytes, cptr, status); /* read the data */\n      (fptr->Fptr)->io_pos = filepos + nbytes; /* update the file position */\n    }\n    else\n    {\n      /* read small chucks of data using the IO buffers for efficiency */\n\n      if ((fptr->Fptr)->curbuf < 0)  /* no current data buffer for this file */\n      {                              /* so reload the last one that was used */\n        ffldrc(fptr, (long) (((fptr->Fptr)->bytepos) / IOBUFLEN), REPORT_EOF, status);\n      }\n\n      /* bufpos is the starting position in IO buffer */\n      bufpos = (long) ((fptr->Fptr)->bytepos - ((LONGLONG)(fptr->Fptr)->bufrecnum[(fptr->Fptr)->curbuf] *\n                IOBUFLEN));\n      nspace = IOBUFLEN - bufpos;   /* amount of space left in the buffer */\n\n      ntodo =  (long) nbytes;\n      while (ntodo)\n      {\n        nread  = minvalue(ntodo, nspace);\n\n        /* copy bytes from IO buffer to user's buffer */\n        memcpy(cptr, (fptr->Fptr)->iobuffer + ((fptr->Fptr)->curbuf * IOBUFLEN) + bufpos, nread);\n        ntodo -= nread;            /* decrement remaining number of bytes */\n        cptr  += nread;\n        (fptr->Fptr)->bytepos += nread;    /* increment file position pointer */\n\n        if (ntodo)                  /* load next record into a buffer */\n        {\n          ffldrc(fptr, (long) ((fptr->Fptr)->bytepos / IOBUFLEN), REPORT_EOF, status);\n          bufpos = 0;\n          nspace = IOBUFLEN;\n        }\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgbytoff(fitsfile *fptr, /* I - FITS file pointer                   */\n           long gsize,        /* I - size of each group of bytes         */\n           long ngroups,      /* I - number of groups to read            */\n           long offset,       /* I - size of gap between groups (may be < 0) */\n           void *buffer,      /* I - buffer to be filled                 */\n           int *status)       /* IO - error status                       */\n/*\n  get (read) the requested number of bytes from the file, starting at\n  the current file position.  This function combines ffmbyt and ffgbyt\n  for increased efficiency.\n*/\n{\n    int bcurrent;\n    long ii, bufpos, nspace, nread, record;\n    char *cptr, *ioptr;\n\n    if (*status > 0)\n       return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if ((fptr->Fptr)->curbuf < 0)  /* no current data buffer for this file */\n    {                              /* so reload the last one that was used */\n      ffldrc(fptr, (long) (((fptr->Fptr)->bytepos) / IOBUFLEN), REPORT_EOF, status);\n    }\n\n    cptr = (char *)buffer;\n    bcurrent = (fptr->Fptr)->curbuf;     /* number of the current IO buffer */\n    record = (fptr->Fptr)->bufrecnum[bcurrent];  /* zero-indexed record number */\n    bufpos = (long) ((fptr->Fptr)->bytepos - ((LONGLONG)record * IOBUFLEN)); /* start pos */\n    nspace = IOBUFLEN - bufpos;  /* amount of space left in buffer */\n    ioptr = (fptr->Fptr)->iobuffer + (bcurrent * IOBUFLEN) + bufpos;  \n\n    for (ii = 1; ii < ngroups; ii++)  /* read all but the last group */\n    {\n      /* copy bytes from IO buffer to the user's buffer */\n      nread = minvalue(gsize, nspace);\n      memcpy(cptr, ioptr, nread);\n      cptr += nread;          /* increment buffer pointer */\n\n      if (nread < gsize)        /* entire group did not fit */\n      {\n        record++;\n        ffldrc(fptr, record, REPORT_EOF, status);  /* load next record */\n        bcurrent = (fptr->Fptr)->curbuf;\n        ioptr   = (fptr->Fptr)->iobuffer + (bcurrent * IOBUFLEN);\n\n        nread  = gsize - nread;\n        memcpy(cptr, ioptr, nread);\n        cptr   += nread;            /* increment buffer pointer */\n        ioptr  += (offset + nread); /* increment IO buffer pointer */\n        nspace = IOBUFLEN - offset - nread;  /* amount of space left */\n      }\n      else\n      {\n        ioptr  += (offset + nread);  /* increment IO bufer pointer */\n        nspace -= (offset + nread);\n      }\n\n      if (nspace <= 0 || nspace > IOBUFLEN) /* beyond current record? */\n      {\n        if (nspace <= 0)\n        {\n          record += ((IOBUFLEN - nspace) / IOBUFLEN); /* new record number */\n          bufpos = (-nspace) % IOBUFLEN; /* starting buffer pos */\n        }\n        else\n        {\n          record -= ((nspace - 1 ) / IOBUFLEN); /* new record number */\n          bufpos = IOBUFLEN - (nspace % IOBUFLEN); /* starting buffer pos */\n        }\n\n        ffldrc(fptr, record, REPORT_EOF, status);\n        bcurrent = (fptr->Fptr)->curbuf;\n\n        nspace = IOBUFLEN - bufpos;\n        ioptr = (fptr->Fptr)->iobuffer + (bcurrent * IOBUFLEN) + bufpos;\n      }\n    }\n\n    /* now read the last group */\n    nread = minvalue(gsize, nspace);\n    memcpy(cptr, ioptr, nread);\n    cptr += nread;          /* increment buffer pointer */\n\n    if (nread < gsize)        /* entire group did not fit */\n    {\n      record++;\n      ffldrc(fptr, record, REPORT_EOF, status);  /* load next record */\n      bcurrent = (fptr->Fptr)->curbuf;\n      ioptr   = (fptr->Fptr)->iobuffer + (bcurrent * IOBUFLEN);\n\n      nread  = gsize - nread;\n      memcpy(cptr, ioptr, nread);\n    }\n\n    (fptr->Fptr)->bytepos = (fptr->Fptr)->bytepos + (ngroups * gsize)\n                                  + (ngroups - 1) * offset;\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffldrc(fitsfile *fptr,        /* I - FITS file pointer             */\n           long record,           /* I - record number to be loaded    */\n           int err_mode,          /* I - 1=ignore EOF, 0 = return EOF error */\n           int *status)           /* IO - error status                 */\n{\n/*\n  low-level routine to load a specified record from a file into\n  a physical buffer, if it is not already loaded.  Reset all\n  pointers to make this the new current record for that file.\n  Update ages of all the physical buffers.\n*/\n    int ibuff, nbuff;\n    LONGLONG rstart;\n\n    /* check if record is already loaded in one of the buffers */\n    /* search from youngest to oldest buffer for efficiency */\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    for (ibuff = NIOBUF - 1; ibuff >= 0; ibuff--)\n    {\n      nbuff = (fptr->Fptr)->ageindex[ibuff];\n      if (record == (fptr->Fptr)->bufrecnum[nbuff]) {\n         goto updatebuf;  /* use 'goto' for efficiency */\n      }\n    }\n\n    /* record is not already loaded */\n    rstart = (LONGLONG)record * IOBUFLEN;\n\n    if ( !err_mode && (rstart >= (fptr->Fptr)->logfilesize) )  /* EOF? */\n         return(*status = END_OF_FILE);\n\n    if (ffwhbf(fptr, &nbuff) < 0)  /* which buffer should we reuse? */\n       return(*status = TOO_MANY_FILES); \n\n    if ((fptr->Fptr)->dirty[nbuff])\n       ffbfwt(fptr->Fptr, nbuff, status); /* write dirty buffer to disk */\n\n    if (rstart >= (fptr->Fptr)->filesize)  /* EOF? */\n    {\n      /* initialize an empty buffer with the correct fill value */\n      if ((fptr->Fptr)->hdutype == ASCII_TBL)\n         memset((fptr->Fptr)->iobuffer + (nbuff * IOBUFLEN), 32, IOBUFLEN); /* blank fill */\n      else\n         memset((fptr->Fptr)->iobuffer + (nbuff * IOBUFLEN),  0, IOBUFLEN);  /* zero fill */\n\n      (fptr->Fptr)->logfilesize = maxvalue((fptr->Fptr)->logfilesize, \n              rstart + IOBUFLEN);\n\n      (fptr->Fptr)->dirty[nbuff] = TRUE;  /* mark record as having been modified */\n    }\n    else  /* not EOF, so read record from disk */\n    {\n      if ((fptr->Fptr)->io_pos != rstart)\n           ffseek(fptr->Fptr, rstart);\n\n      ffread(fptr->Fptr, IOBUFLEN, (fptr->Fptr)->iobuffer + (nbuff * IOBUFLEN), status);\n      (fptr->Fptr)->io_pos = rstart + IOBUFLEN;  /* set new IO position */\n    }\n\n    (fptr->Fptr)->bufrecnum[nbuff] = record;   /* record number contained in buffer */\n\nupdatebuf:\n\n    (fptr->Fptr)->curbuf = nbuff; /* this is the current buffer for this file */\n\n    if (ibuff < 0)\n    { \n      /* find the current position of the buffer in the age index */\n      for (ibuff = 0; ibuff < NIOBUF; ibuff++)\n         if ((fptr->Fptr)->ageindex[ibuff] == nbuff)\n            break;  \n    }\n\n    /* increment the age of all the buffers that were younger than it */\n    for (ibuff++; ibuff < NIOBUF; ibuff++)\n      (fptr->Fptr)->ageindex[ibuff - 1] = (fptr->Fptr)->ageindex[ibuff];\n\n    (fptr->Fptr)->ageindex[NIOBUF - 1] = nbuff; /* this is now the youngest buffer */\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffwhbf(fitsfile *fptr,        /* I - FITS file pointer             */\n           int *nbuff)            /* O - which buffer to use           */\n{\n/*\n  decide which buffer to (re)use to hold a new file record\n*/\n        return(*nbuff = (fptr->Fptr)->ageindex[0]);  /* return oldest buffer */\n}\n/*--------------------------------------------------------------------------*/\nint ffflus(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int *status)      /* IO - error status                           */\n/*\n  Flush all the data in the current FITS file to disk. This ensures that if\n  the program subsequently dies, the disk FITS file will be closed correctly.\n*/\n{\n    int hdunum, hdutype;\n\n    if (*status > 0)\n        return(*status);\n\n    ffghdn(fptr, &hdunum);     /* get the current HDU number */\n\n    if (ffchdu(fptr,status) > 0)   /* close out the current HDU */\n        ffpmsg(\"ffflus could not close the current HDU.\");\n\n    ffflsh(fptr, FALSE, status);  /* flush any modified IO buffers to disk */\n\n    if (ffgext(fptr, hdunum - 1, &hdutype, status) > 0) /* reopen HDU */\n        ffpmsg(\"ffflus could not reopen the current HDU.\");\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffflsh(fitsfile *fptr,        /* I - FITS file pointer           */\n           int clearbuf,          /* I - also clear buffer contents? */\n           int *status)           /* IO - error status               */\n{\n/*\n  flush all dirty IO buffers associated with the file to disk\n*/\n    int ii;\n\n/*\n   no need to move to a different HDU\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n*/\n    for (ii = 0; ii < NIOBUF; ii++)\n    {\n\t/* flush modified buffer to disk */\n        if ((fptr->Fptr)->bufrecnum[ii] >= 0 &&(fptr->Fptr)->dirty[ii])\n           ffbfwt(fptr->Fptr, ii, status);\n\n        if (clearbuf)\n          (fptr->Fptr)->bufrecnum[ii] = -1;  /* set contents of buffer as undefined */\n    }\n\n    if (*status != READONLY_FILE)\n      ffflushx(fptr->Fptr);  /* flush system buffers to disk */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffbfeof(fitsfile *fptr,        /* I - FITS file pointer           */\n           int *status)           /* IO - error status               */\n{\n/*\n  clear any buffers beyond the end of file\n*/\n    int ii;\n\n    for (ii = 0; ii < NIOBUF; ii++)\n    {\n        if ( (LONGLONG) (fptr->Fptr)->bufrecnum[ii] * IOBUFLEN >= fptr->Fptr->filesize)\n        {\n            (fptr->Fptr)->bufrecnum[ii] = -1;  /* set contents of buffer as undefined */\n        }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffbfwt(FITSfile *Fptr,        /* I - FITS file pointer           */\n           int nbuff,             /* I - which buffer to write          */\n           int *status)           /* IO - error status                  */\n{\n/*\n  write contents of buffer to file;  If the position of the buffer\n  is beyond the current EOF, then the file may need to be extended\n  with fill values, and/or with the contents of some of the other\n  i/o buffers.\n*/\n    int  ii,ibuff;\n    long jj, irec, minrec, nloop;\n    LONGLONG filepos;\n\n    static char zeros[IOBUFLEN];  /*  initialized to zero by default */\n\n    if (!(Fptr->writemode) )\n    {\n        ffpmsg(\"Error: trying to write to READONLY file.\");\n        if (Fptr->driver == 8) {  /* gzip compressed file */\n\t  ffpmsg(\"Cannot write to a GZIP or COMPRESS compressed file.\");\n\t}\n        Fptr->dirty[nbuff] = FALSE;  /* reset buffer status to prevent later probs */\n        *status = READONLY_FILE;\n        return(*status);\n    }\n\n    filepos = (LONGLONG)Fptr->bufrecnum[nbuff] * IOBUFLEN;\n\n    if (filepos <= Fptr->filesize)\n    {\n      /* record is located within current file, so just write it */\n\n      /* move to the correct write position */\n      if (Fptr->io_pos != filepos)\n         ffseek(Fptr, filepos);\n\n      ffwrite(Fptr, IOBUFLEN, Fptr->iobuffer + (nbuff * IOBUFLEN), status);\n      Fptr->io_pos = filepos + IOBUFLEN;\n\n      if (filepos == Fptr->filesize)   /* appended new record? */\n         Fptr->filesize += IOBUFLEN;   /* increment the file size */\n\n      Fptr->dirty[nbuff] = FALSE;\n    }\n\n    else  /* if record is beyond the EOF, append any other records */ \n          /* and/or insert fill values if necessary */\n    {\n      /* move to EOF */\n      if (Fptr->io_pos != Fptr->filesize)\n         ffseek(Fptr, Fptr->filesize);\n\n      ibuff = NIOBUF;  /* initialize to impossible value */\n      while(ibuff != nbuff) /* repeat until requested buffer is written */\n      {\n        minrec = (long) (Fptr->filesize / IOBUFLEN);\n\n        /* write lowest record beyond the EOF first */\n\n        irec = Fptr->bufrecnum[nbuff]; /* initially point to the requested buffer */\n        ibuff = nbuff;\n\n        for (ii = 0; ii < NIOBUF; ii++)\n        {\n          if (Fptr->bufrecnum[ii] >= minrec &&\n            Fptr->bufrecnum[ii] < irec)\n          {\n            irec = Fptr->bufrecnum[ii];  /* found a lower record */\n            ibuff = ii;\n          }\n        }\n\n        filepos = (LONGLONG)irec * IOBUFLEN;  /* byte offset of record in file */\n\n        /* append 1 or more fill records if necessary */\n        if (filepos > Fptr->filesize)\n        {                    \n          nloop = (long) ((filepos - (Fptr->filesize)) / IOBUFLEN); \n          for (jj = 0; jj < nloop && !(*status); jj++)\n            ffwrite(Fptr, IOBUFLEN, zeros, status);\n\n/*\nffseek(Fptr, filepos);\n*/\n          Fptr->filesize = filepos;   /* increment the file size */\n        } \n\n        /* write the buffer itself */\n        ffwrite(Fptr, IOBUFLEN, Fptr->iobuffer + (ibuff * IOBUFLEN), status);\n        Fptr->dirty[ibuff] = FALSE;\n\n        Fptr->filesize += IOBUFLEN;     /* increment the file size */\n      } /* loop back if more buffers need to be written */\n\n      Fptr->io_pos = Fptr->filesize;  /* currently positioned at EOF */\n    }\n\n    return(*status);       \n}\n/*--------------------------------------------------------------------------*/\nint ffgrsz( fitsfile *fptr, /* I - FITS file pionter                        */\n            long *ndata,    /* O - optimal amount of data to access         */\n            int  *status)   /* IO - error status                            */\n/*\n  Returns an optimal value for the number of rows in a binary table\n  or the number of pixels in an image that should be read or written\n  at one time for maximum efficiency. Accessing more data than this\n  may cause excessive flushing and rereading of buffers to/from disk.\n*/\n{\n    int typecode, bytesperpixel;\n\n    /* There are NIOBUF internal buffers available each IOBUFLEN bytes long. */\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n      if ( ffrdef(fptr, status) > 0)   /* rescan header to get hdu struct */\n           return(*status);\n\n    if ((fptr->Fptr)->hdutype == IMAGE_HDU ) /* calc pixels per buffer size */\n    {\n      /* image pixels are in column 2 of the 'table' */\n      ffgtcl(fptr, 2, &typecode, NULL, NULL, status);\n      bytesperpixel = typecode / 10;\n      *ndata = ((NIOBUF - 1) * IOBUFLEN) / bytesperpixel;\n    }\n    else   /* calc number of rows that fit in buffers */\n    {\n      *ndata = (long) (((NIOBUF - 1) * IOBUFLEN) / maxvalue(1,\n               (fptr->Fptr)->rowlength));\n      *ndata = maxvalue(1, *ndata); \n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgtbb(fitsfile *fptr,        /* I - FITS file pointer                 */\n           LONGLONG firstrow,         /* I - starting row (1 = first row)      */\n           LONGLONG firstchar,        /* I - starting byte in row (1=first)    */\n           LONGLONG nchars,           /* I - number of bytes to read           */\n           unsigned char *values, /* I - array of bytes to read            */\n           int *status)           /* IO - error status                     */\n/*\n  read a consecutive string of bytes from an ascii or binary table.\n  This will span multiple rows of the table if nchars + firstchar is\n  greater than the length of a row.\n*/\n{\n    LONGLONG bytepos, endrow;\n\n    if (*status > 0 || nchars <= 0)\n        return(*status);\n\n    else if (firstrow < 1)\n        return(*status=BAD_ROW_NUM);\n\n    else if (firstchar < 1)\n        return(*status=BAD_ELEM_NUM);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    /* check that we do not exceed number of rows in the table */\n    endrow = ((firstchar + nchars - 2) / (fptr->Fptr)->rowlength) + firstrow;\n    if (endrow > (fptr->Fptr)->numrows)\n    {\n        ffpmsg(\"attempt to read past end of table (ffgtbb)\");\n        return(*status=BAD_ROW_NUM);\n    }\n\n    /* move the i/o pointer to the start of the sequence of characters */\n    bytepos = (fptr->Fptr)->datastart +\n              ((fptr->Fptr)->rowlength * (firstrow - 1)) +\n              firstchar - 1;\n\n    ffmbyt(fptr, bytepos, REPORT_EOF, status);\n    ffgbyt(fptr, nchars, values, status);  /* read the bytes */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgi1b(fitsfile *fptr, /* I - FITS file pointer                         */\n           LONGLONG byteloc,  /* I - position within file to start reading     */\n           long nvals,     /* I - number of pixels to read                  */\n           long incre,     /* I - byte increment between pixels             */\n           unsigned char *values, /* O - returned array of values           */\n           int *status)    /* IO - error status                             */\n/*\n  get (read) the array of values from the FITS file, doing machine dependent\n  format conversion (e.g. byte-swapping) if necessary.\n*/\n{\n    LONGLONG postemp;\n\n    if (incre == 1)      /* read all the values at once (contiguous bytes) */\n    {\n        if (nvals < MINDIRECT)  /* read normally via IO buffers */\n        {\n           ffmbyt(fptr, byteloc, REPORT_EOF, status);\n           ffgbyt(fptr, nvals, values, status);\n        }\n        else            /* read directly from disk, bypassing IO buffers */\n        {\n           postemp = (fptr->Fptr)->bytepos;   /* store current file position */\n           (fptr->Fptr)->bytepos = byteloc;   /* set to the desired position */\n           ffgbyt(fptr, nvals, values, status);\n           (fptr->Fptr)->bytepos = postemp;   /* reset to original position */\n        }\n    }\n    else         /* have to read each value individually (not contiguous ) */\n    {\n        ffmbyt(fptr, byteloc, REPORT_EOF, status);\n        ffgbytoff(fptr, 1, nvals, incre - 1, values, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgi2b(fitsfile *fptr,  /* I - FITS file pointer                        */\n           LONGLONG byteloc,   /* I - position within file to start reading    */\n           long nvals,      /* I - number of pixels to read                 */\n           long incre,      /* I - byte increment between pixels            */\n           short *values,   /* O - returned array of values                 */\n           int *status)     /* IO - error status                            */\n/*\n  get (read) the array of values from the FITS file, doing machine dependent\n  format conversion (e.g. byte-swapping) if necessary.\n*/\n{\n    LONGLONG postemp;\n\n    if (incre == 2)      /* read all the values at once (contiguous bytes) */\n    {\n        if (nvals * 2 < MINDIRECT)  /* read normally via IO buffers */\n        {\n           ffmbyt(fptr, byteloc, REPORT_EOF, status);\n           ffgbyt(fptr, nvals * 2, values, status);\n        }\n        else            /* read directly from disk, bypassing IO buffers */\n        {\n           postemp = (fptr->Fptr)->bytepos;   /* store current file position */\n           (fptr->Fptr)->bytepos = byteloc;   /* set to the desired position */\n           ffgbyt(fptr, nvals * 2, values, status);\n           (fptr->Fptr)->bytepos = postemp;   /* reset to original position */\n        }\n    }\n    else         /* have to read each value individually (not contiguous ) */\n    {\n        ffmbyt(fptr, byteloc, REPORT_EOF, status);\n        ffgbytoff(fptr, 2, nvals, incre - 2, values, status);\n    }\n\n#if BYTESWAPPED\n    ffswap2(values, nvals);    /* reverse order of bytes in each value */\n#endif\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgi4b(fitsfile *fptr,  /* I - FITS file pointer                        */\n           LONGLONG byteloc,   /* I - position within file to start reading    */\n           long nvals,      /* I - number of pixels to read                 */\n           long incre,      /* I - byte increment between pixels            */\n           INT32BIT *values, /* O - returned array of values                */\n           int *status)     /* IO - error status                            */\n/*\n  get (read) the array of values from the FITS file, doing machine dependent\n  format conversion (e.g. byte-swapping) if necessary.\n*/\n{\n    LONGLONG postemp;\n\n    if (incre == 4)      /* read all the values at once (contiguous bytes) */\n    {\n        if (nvals * 4 < MINDIRECT)  /* read normally via IO buffers */\n        {\n           ffmbyt(fptr, byteloc, REPORT_EOF, status);\n           ffgbyt(fptr, nvals * 4, values, status);\n        }\n        else            /* read directly from disk, bypassing IO buffers */\n        {\n           postemp = (fptr->Fptr)->bytepos;   /* store current file position */\n           (fptr->Fptr)->bytepos = byteloc;   /* set to the desired position */\n           ffgbyt(fptr, nvals * 4, values, status);\n           (fptr->Fptr)->bytepos = postemp;   /* reset to original position */\n        }\n    }\n    else         /* have to read each value individually (not contiguous ) */\n    {\n        ffmbyt(fptr, byteloc, REPORT_EOF, status);\n        ffgbytoff(fptr, 4, nvals, incre - 4, values, status);\n    }\n\n#if BYTESWAPPED\n    ffswap4(values, nvals);    /* reverse order of bytes in each value */\n#endif\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgi8b(fitsfile *fptr,  /* I - FITS file pointer                        */\n           LONGLONG byteloc,   /* I - position within file to start reading    */\n           long nvals,      /* I - number of pixels to read                 */\n           long incre,      /* I - byte increment between pixels            */\n           long *values,  /* O - returned array of values                 */\n           int *status)     /* IO - error status                            */\n/*\n  get (read) the array of values from the FITS file, doing machine dependent\n  format conversion (e.g. byte-swapping) if necessary.\n\n  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n  This routine reads 'nvals' 8-byte integers into 'values'.\n  This works both on platforms that have sizeof(long) = 64, and 32,\n  as long as 'values' has been allocated to large enough to hold\n  8 * nvals bytes of data.\n  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n*/\n{\n    LONGLONG  postemp;\n\n    if (incre == 8)      /* read all the values at once (contiguous bytes) */\n    {\n        if (nvals * 8 < MINDIRECT)  /* read normally via IO buffers */\n        {\n           ffmbyt(fptr, byteloc, REPORT_EOF, status);\n           ffgbyt(fptr, nvals * 8, values, status);\n        }\n        else            /* read directly from disk, bypassing IO buffers */\n        {\n           postemp = (fptr->Fptr)->bytepos;   /* store current file position */\n           (fptr->Fptr)->bytepos = byteloc;   /* set to the desired position */\n           ffgbyt(fptr, nvals * 8, values, status);\n           (fptr->Fptr)->bytepos = postemp;   /* reset to original position */\n        }\n    }\n    else         /* have to read each value individually (not contiguous ) */\n    {\n        ffmbyt(fptr, byteloc, REPORT_EOF, status);\n        ffgbytoff(fptr, 8, nvals, incre - 8, values, status);\n    }\n\n#if BYTESWAPPED\n    ffswap8((double *) values, nvals); /* reverse bytes in each value */\n#endif\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgr4b(fitsfile *fptr,  /* I - FITS file pointer                        */\n           LONGLONG byteloc,   /* I - position within file to start reading    */\n           long nvals,      /* I - number of pixels to read                 */\n           long incre,      /* I - byte increment between pixels            */\n           float *values,   /* O - returned array of values                 */\n           int *status)     /* IO - error status                            */\n/*\n  get (read) the array of values from the FITS file, doing machine dependent\n  format conversion (e.g. byte-swapping) if necessary.\n*/\n{\n    LONGLONG postemp;\n\n#if MACHINE == VAXVMS\n    long ii;\n\n#elif (MACHINE == ALPHAVMS) && (FLOATTYPE == GFLOAT)\n    short *sptr;\n    long ii;\n\n#endif\n\n\n    if (incre == 4)      /* read all the values at once (contiguous bytes) */\n    {\n        if (nvals * 4 < MINDIRECT)  /* read normally via IO buffers */\n        {\n           ffmbyt(fptr, byteloc, REPORT_EOF, status);\n           ffgbyt(fptr, nvals * 4, values, status);\n        }\n        else            /* read directly from disk, bypassing IO buffers */\n        {\n           postemp = (fptr->Fptr)->bytepos;   /* store current file position */\n           (fptr->Fptr)->bytepos = byteloc;   /* set to the desired position */\n           ffgbyt(fptr, nvals * 4, values, status);\n           (fptr->Fptr)->bytepos = postemp;   /* reset to original position */\n        }\n    }\n    else         /* have to read each value individually (not contiguous ) */\n    {\n        ffmbyt(fptr, byteloc, REPORT_EOF, status);\n        ffgbytoff(fptr, 4, nvals, incre - 4, values, status);\n    }\n\n\n#if MACHINE == VAXVMS\n\n    ii = nvals;                      /* call VAX macro routine to convert */\n    ieevur(values, values, &ii);     /* from  IEEE float -> F float       */\n\n#elif (MACHINE == ALPHAVMS) && (FLOATTYPE == GFLOAT)\n\n    ffswap2( (short *) values, nvals * 2);  /* swap pairs of bytes */\n\n    /* convert from IEEE float format to VMS GFLOAT float format */\n    sptr = (short *) values;\n    for (ii = 0; ii < nvals; ii++, sptr += 2)\n    {\n        if (!fnan(*sptr) )  /* test for NaN or underflow */\n            values[ii] *= 4.0;\n    }\n\n#elif BYTESWAPPED\n    ffswap4((INT32BIT *)values, nvals);  /* reverse order of bytes in values */\n#endif\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgr8b(fitsfile *fptr,  /* I - FITS file pointer                        */\n           LONGLONG byteloc,   /* I - position within file to start reading    */\n           long nvals,      /* I - number of pixels to read                 */\n           long incre,      /* I - byte increment between pixels            */\n           double *values,  /* O - returned array of values                 */\n           int *status)     /* IO - error status                            */\n/*\n  get (read) the array of values from the FITS file, doing machine dependent\n  format conversion (e.g. byte-swapping) if necessary.\n*/\n{\n    LONGLONG  postemp;\n\n#if MACHINE == VAXVMS\n    long ii;\n\n#elif (MACHINE == ALPHAVMS) && (FLOATTYPE == GFLOAT)\n    short *sptr;\n    long ii;\n\n#endif\n\n    if (incre == 8)      /* read all the values at once (contiguous bytes) */\n    {\n        if (nvals * 8 < MINDIRECT)  /* read normally via IO buffers */\n        {\n           ffmbyt(fptr, byteloc, REPORT_EOF, status);\n           ffgbyt(fptr, nvals * 8, values, status);\n        }\n        else            /* read directly from disk, bypassing IO buffers */\n        {\n           postemp = (fptr->Fptr)->bytepos;   /* store current file position */\n           (fptr->Fptr)->bytepos = byteloc;   /* set to the desired position */\n           ffgbyt(fptr, nvals * 8, values, status);\n           (fptr->Fptr)->bytepos = postemp;   /* reset to original position */\n        }\n    }\n    else         /* have to read each value individually (not contiguous ) */\n    {\n        ffmbyt(fptr, byteloc, REPORT_EOF, status);\n        ffgbytoff(fptr, 8, nvals, incre - 8, values, status);\n    }\n\n#if MACHINE == VAXVMS\n    ii = nvals;                      /* call VAX macro routine to convert */\n    ieevud(values, values, &ii);     /* from  IEEE float -> D float       */\n\n#elif (MACHINE == ALPHAVMS) && (FLOATTYPE == GFLOAT)\n    ffswap2( (short *) values, nvals * 4);  /* swap pairs of bytes */\n\n    /* convert from IEEE float format to VMS GFLOAT float format */\n    sptr = (short *) values;\n    for (ii = 0; ii < nvals; ii++, sptr += 4)\n    {\n        if (!dnan(*sptr) )  /* test for NaN or underflow */\n            values[ii] *= 4.0;\n    }\n\n#elif BYTESWAPPED\n    ffswap8(values, nvals);   /* reverse order of bytes in each value */\n#endif\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffptbb(fitsfile *fptr,        /* I - FITS file pointer                 */\n           LONGLONG firstrow,         /* I - starting row (1 = first row)      */\n           LONGLONG firstchar,        /* I - starting byte in row (1=first)    */\n           LONGLONG nchars,           /* I - number of bytes to write          */\n           unsigned char *values, /* I - array of bytes to write           */\n           int *status)           /* IO - error status                     */\n/*\n  write a consecutive string of bytes to an ascii or binary table.\n  This will span multiple rows of the table if nchars + firstchar is\n  greater than the length of a row.\n*/\n{\n    LONGLONG bytepos, endrow, nrows;\n    char message[FLEN_ERRMSG];\n\n    if (*status > 0 || nchars <= 0)\n        return(*status);\n\n    else if (firstrow < 1)\n        return(*status=BAD_ROW_NUM);\n\n    else if (firstchar < 1)\n        return(*status=BAD_ELEM_NUM);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart < 0) /* rescan header if data undefined */\n        ffrdef(fptr, status);\n\n    endrow = ((firstchar + nchars - 2) / (fptr->Fptr)->rowlength) + firstrow;\n\n    /* check if we are writing beyond the current end of table */\n    if (endrow > (fptr->Fptr)->numrows)\n    {\n        /* if there are more HDUs following the current one, or */\n        /* if there is a data heap, then we must insert space */\n        /* for the new rows.  */\n        if ( !((fptr->Fptr)->lasthdu) || (fptr->Fptr)->heapsize > 0)\n        {\n            nrows = endrow - ((fptr->Fptr)->numrows);\n\n            /* ffirow also updates the heap address and numrows */\n            if (ffirow(fptr, (fptr->Fptr)->numrows, nrows, status) > 0)\n            {\n                 snprintf(message, FLEN_ERRMSG,\n                 \"ffptbb failed to add space for %.0f new rows in table.\",\n                         (double) nrows);\n                 ffpmsg(message);\n                 return(*status);\n            }\n        }\n        else\n        {\n            /* manally update heap starting address */\n            (fptr->Fptr)->heapstart += \n            ((LONGLONG)(endrow - (fptr->Fptr)->numrows) * \n                    (fptr->Fptr)->rowlength );\n\n            (fptr->Fptr)->numrows = endrow; /* update number of rows */\n        }\n    }\n\n    /* move the i/o pointer to the start of the sequence of characters */\n    bytepos = (fptr->Fptr)->datastart +\n              ((fptr->Fptr)->rowlength * (firstrow - 1)) +\n              firstchar - 1;\n\n    ffmbyt(fptr, bytepos, IGNORE_EOF, status);\n    ffpbyt(fptr, nchars, values, status);  /* write the bytes */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpi1b(fitsfile *fptr, /* I - FITS file pointer                         */\n           long nvals,     /* I - number of pixels in the values array      */\n           long incre,     /* I - byte increment between pixels             */\n           unsigned char *values, /* I - array of values to write           */\n           int *status)    /* IO - error status                             */\n/*\n  put (write) the array of values to the FITS file, doing machine dependent\n  format conversion (e.g. byte-swapping) if necessary.\n*/\n{\n    if (incre == 1)      /* write all the values at once (contiguous bytes) */\n\n        ffpbyt(fptr, nvals, values, status);\n\n    else         /* have to write each value individually (not contiguous ) */\n\n        ffpbytoff(fptr, 1, nvals, incre - 1, values, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpi2b(fitsfile *fptr, /* I - FITS file pointer                         */\n           long nvals,     /* I - number of pixels in the values array      */\n           long incre,     /* I - byte increment between pixels             */\n           short *values,  /* I - array of values to write                  */\n           int *status)    /* IO - error status                             */\n/*\n  put (write) the array of values to the FITS file, doing machine dependent\n  format conversion (e.g. byte-swapping) if necessary.\n*/\n{\n#if BYTESWAPPED\n    ffswap2(values, nvals);  /* reverse order of bytes in each value */\n#endif\n\n    if (incre == 2)      /* write all the values at once (contiguous bytes) */\n\n        ffpbyt(fptr, nvals * 2, values, status);\n\n    else         /* have to write each value individually (not contiguous ) */\n\n        ffpbytoff(fptr, 2, nvals, incre - 2, values, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpi4b(fitsfile *fptr, /* I - FITS file pointer                         */\n           long nvals,     /* I - number of pixels in the values array      */\n           long incre,     /* I - byte increment between pixels             */\n           INT32BIT *values, /* I - array of values to write                */\n           int *status)    /* IO - error status                             */\n/*\n  put (write) the array of values to the FITS file, doing machine dependent\n  format conversion (e.g. byte-swapping) if necessary.\n*/\n{\n#if BYTESWAPPED\n    ffswap4(values, nvals);    /* reverse order of bytes in each value */\n#endif\n\n    if (incre == 4)      /* write all the values at once (contiguous bytes) */\n\n        ffpbyt(fptr, nvals * 4, values, status);\n\n    else         /* have to write each value individually (not contiguous ) */\n\n        ffpbytoff(fptr, 4, nvals, incre - 4, values, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpi8b(fitsfile *fptr, /* I - FITS file pointer                         */\n           long nvals,     /* I - number of pixels in the values array      */\n           long incre,     /* I - byte increment between pixels             */\n           long *values,   /* I - array of values to write                */\n           int *status)    /* IO - error status                             */\n/*\n  put (write) the array of values to the FITS file, doing machine dependent\n  format conversion (e.g. byte-swapping) if necessary.\n\n  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n  This routine writes 'nvals' 8-byte integers from 'values'.\n  This works both on platforms that have sizeof(long) = 64, and 32,\n  as long as 'values' has been allocated to large enough to hold\n  8 * nvals bytes of data.\n  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n*/\n{\n#if BYTESWAPPED\n    ffswap8((double *) values, nvals);    /* reverse bytes in each value */\n#endif\n\n    if (incre == 8)      /* write all the values at once (contiguous bytes) */\n\n        ffpbyt(fptr, nvals * 8, values, status);\n\n    else         /* have to write each value individually (not contiguous ) */\n\n        ffpbytoff(fptr, 8, nvals, incre - 8, values, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpr4b(fitsfile *fptr, /* I - FITS file pointer                         */\n           long nvals,     /* I - number of pixels in the values array      */\n           long incre,     /* I - byte increment between pixels             */\n           float *values,  /* I - array of values to write                  */\n           int *status)    /* IO - error status                             */\n/*\n  put (write) the array of values to the FITS file, doing machine dependent\n  format conversion (e.g. byte-swapping) if necessary.\n*/\n{\n#if MACHINE == VAXVMS\n    long ii;\n\n    ii = nvals;                      /* call VAX macro routine to convert */\n    ieevpr(values, values, &ii);     /* from F float -> IEEE float        */\n\n#elif (MACHINE == ALPHAVMS) && (FLOATTYPE == GFLOAT)\n    long ii;\n\n    /* convert from VMS FFLOAT float format to IEEE float format */\n    for (ii = 0; ii < nvals; ii++)\n        values[ii] *= 0.25;\n\n    ffswap2( (short *) values, nvals * 2);  /* swap pairs of bytes */\n\n#elif BYTESWAPPED\n    ffswap4((INT32BIT *) values, nvals); /* reverse order of bytes in values */\n#endif\n\n    if (incre == 4)      /* write all the values at once (contiguous bytes) */\n\n        ffpbyt(fptr, nvals * 4, values, status);\n\n    else         /* have to write each value individually (not contiguous ) */\n\n        ffpbytoff(fptr, 4, nvals, incre - 4, values, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpr8b(fitsfile *fptr, /* I - FITS file pointer                         */\n           long nvals,     /* I - number of pixels in the values array      */\n           long incre,     /* I - byte increment between pixels             */\n           double *values, /* I - array of values to write                  */\n           int *status)    /* IO - error status                             */\n/*\n  put (write) the array of values to the FITS file, doing machine dependent\n  format conversion (e.g. byte-swapping) if necessary.\n*/\n{\n#if MACHINE == VAXVMS\n    long ii;\n\n    ii = nvals;                      /* call VAX macro routine to convert */\n    ieevpd(values, values, &ii);     /* from D float -> IEEE float        */\n\n#elif (MACHINE == ALPHAVMS) && (FLOATTYPE == GFLOAT)\n    long ii;\n\n    /* convert from VMS GFLOAT float format to IEEE float format */\n    for (ii = 0; ii < nvals; ii++)\n        values[ii] *= 0.25;\n\n    ffswap2( (short *) values, nvals * 4);  /* swap pairs of bytes */\n\n#elif BYTESWAPPED\n    ffswap8(values, nvals); /* reverse order of bytes in each value */\n#endif\n\n    if (incre == 8)      /* write all the values at once (contiguous bytes) */\n\n        ffpbyt(fptr, nvals * 8, values, status);\n\n    else         /* have to write each value individually (not contiguous ) */\n\n        ffpbytoff(fptr, 8, nvals, incre - 8, values, status);\n\n    return(*status);\n}\n\n"},{"id":16645,"name":"putcoluj.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, putcoluj.c, contains routines that write data elements to   */\n/*  a FITS image or table, with unsigned long datatype.                             */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <limits.h>\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffppruj( fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n   unsigned long  *array,    /* I - array of values that are written        */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n    unsigned long nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_pixels(fptr, TULONG, firstelem, nelem,\n            0, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcluj(fptr, 2, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffppnuj( fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n   unsigned long  *array,    /* I - array of values that are written        */\n   unsigned long  nulval,    /* I - undefined pixel value                   */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).  Any array values\n  that are equal to the value of nulval will be replaced with the null\n  pixel value that is appropriate for this column.\n*/\n{\n    long row;\n    unsigned long nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        nullvalue = nulval;  /* set local variable */\n        fits_write_compressed_pixels(fptr, TULONG, firstelem, nelem,\n            1, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcnuj(fptr, 2, row, firstelem, nelem, array, nulval, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp2duj(fitsfile *fptr,   /* I - FITS file pointer                    */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n  unsigned long  *array,     /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    /* call the 3D writing routine, with the 3rd dimension = 1 */\n\n    ffp3duj(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp3duj(fitsfile *fptr,   /* I - FITS file pointer                    */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  nrows,      /* I - number of rows in each plane of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           LONGLONG  naxis3,     /* I - FITS image NAXIS3 value               */\n  unsigned long  *array,     /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 3-D cube of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    long tablerow, ii, jj;\n    long fpixel[3]= {1,1,1}, lpixel[3];\n    LONGLONG nfits, narray;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n           \n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n        lpixel[0] = (long) ncols;\n        lpixel[1] = (long) nrows;\n        lpixel[2] = (long) naxis3;\n       \n        fits_write_compressed_img(fptr, TULONG, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n      /* all the image pixels are contiguous, so write all at once */\n      ffpcluj(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status);\n      return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to write to */\n    narray = 0;  /* next pixel in input array to be written */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* writing naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffpcluj(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0)\n         return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpssuj(fitsfile *fptr,   /* I - FITS file pointer                       */\n           long  group,      /* I - group to write(1 = 1st group)           */\n           long  naxis,      /* I - number of data axes in array            */\n           long  *naxes,     /* I - size of each FITS axis                  */\n           long  *fpixel,    /* I - 1st pixel in each axis to write (1=1st) */\n           long  *lpixel,    /* I - last pixel in each axis to write        */\n  unsigned long *array,      /* I - array to be written                     */\n           int  *status)     /* IO - error status                           */\n/*\n  Write a subsection of pixels to the primary array or image.\n  A subsection is defined to be any contiguous rectangular\n  array of pixels within the n-dimensional FITS data file.\n  Data conversion and scaling will be performed if necessary \n  (e.g, if the datatype of the FITS array is not the same as\n  the array being written).\n*/\n{\n    long tablerow;\n    LONGLONG fpix[7], dimen[7], astart, pstart;\n    LONGLONG off2, off3, off4, off5, off6, off7;\n    LONGLONG st10, st20, st30, st40, st50, st60, st70;\n    LONGLONG st1, st2, st3, st4, st5, st6, st7;\n    long ii, i1, i2, i3, i4, i5, i6, i7, irange[7];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_img(fptr, TULONG, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    if (naxis < 1 || naxis > 7)\n      return(*status = BAD_DIMEN);\n\n    tablerow=maxvalue(1,group);\n\n     /* calculate the size and number of loops to perform in each dimension */\n    for (ii = 0; ii < 7; ii++)\n    {\n      fpix[ii]=1;\n      irange[ii]=1;\n      dimen[ii]=1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {    \n      fpix[ii]=fpixel[ii];\n      irange[ii]=lpixel[ii]-fpixel[ii]+1;\n      dimen[ii]=naxes[ii];\n    }\n\n    i1=irange[0];\n\n    /* compute the pixel offset between each dimension */\n    off2 =     dimen[0];\n    off3 = off2 * dimen[1];\n    off4 = off3 * dimen[2];\n    off5 = off4 * dimen[3];\n    off6 = off5 * dimen[4];\n    off7 = off6 * dimen[5];\n\n    st10 = fpix[0];\n    st20 = (fpix[1] - 1) * off2;\n    st30 = (fpix[2] - 1) * off3;\n    st40 = (fpix[3] - 1) * off4;\n    st50 = (fpix[4] - 1) * off5;\n    st60 = (fpix[5] - 1) * off6;\n    st70 = (fpix[6] - 1) * off7;\n\n    /* store the initial offset in each dimension */\n    st1 = st10;\n    st2 = st20;\n    st3 = st30;\n    st4 = st40;\n    st5 = st50;\n    st6 = st60;\n    st7 = st70;\n\n    astart = 0;\n\n    for (i7 = 0; i7 < irange[6]; i7++)\n    {\n     for (i6 = 0; i6 < irange[5]; i6++)\n     {\n      for (i5 = 0; i5 < irange[4]; i5++)\n      {\n       for (i4 = 0; i4 < irange[3]; i4++)\n       {\n        for (i3 = 0; i3 < irange[2]; i3++)\n        {\n         pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7;\n\n         for (i2 = 0; i2 < irange[1]; i2++)\n         {\n           if (ffpcluj(fptr, 2, tablerow, pstart, i1, &array[astart],\n              status) > 0)\n              return(*status);\n\n           astart += i1;\n           pstart += off2;\n         }\n         st2 = st20;\n         st3 = st3+off3;    \n        }\n        st3 = st30;\n        st4 = st4+off4;\n       }\n       st4 = st40;\n       st5 = st5+off5;\n      }\n      st5 = st50;\n      st6 = st6+off6;\n     }\n     st6 = st60;\n     st7 = st7+off7;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpgpuj( fitsfile *fptr,   /* I - FITS file pointer                      */\n            long  group,      /* I - group to write(1 = 1st group)          */\n            long  firstelem,  /* I - first vector element to write(1 = 1st) */\n            long  nelem,      /* I - number of values to write              */\n   unsigned long  *array,     /* I - array of values that are written       */\n            int  *status)     /* IO - error status                          */\n/*\n  Write an array of group parameters to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffpcluj(fptr, 1L, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcluj( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n   unsigned long  *array,    /* I - array of values to write                */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer to a virtual column in a 1 or more grouped FITS primary\n  array.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    int tcode, maxelem, hdutype;\n    long twidth, incre;\n    long ntodo;\n    LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull;\n    double scale, zero;\n    char tform[20], cform[20];\n    char message[FLEN_ERRMSG];\n\n    char snull[20];   /*  the FITS null value  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n\n    if (tcode == TSTRING)   \n         ffcfmt(tform, cform);     /* derive C format for writing strings */\n\n    /*---------------------------------------------------------------------*/\n    /*  Now write the pixels to the FITS column.                           */\n    /*  First call the ffXXfYY routine to  (1) convert the datatype        */\n    /*  if necessary, and (2) scale the values by the FITS TSCALn and      */\n    /*  TZEROn linear scaling parameters into a temporary buffer.          */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to write  */\n    next = 0;                 /* next element in array to be written  */\n    rownum = 0;               /* row number, relative to firstrow     */\n\n    while (remain)\n    {\n        /* limit the number of pixels to process a one time to the number that\n           will fit in the buffer space or to the number of pixels that remain\n           in the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);      \n        ntodo = (long) minvalue(ntodo, (repeat - elemnum));\n\n        wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre);\n\n        ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */\n\n        switch (tcode) \n        {\n            case (TLONG):\n\n                ffu4fi4(&array[next], ntodo, scale, zero,\n                      (INT32BIT *) buffer, status);\n                ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status);\n                break;\n\n            case (TLONGLONG):\n\n                ffu4fi8(&array[next], ntodo, scale, zero,\n                        (LONGLONG *) buffer, status);\n                ffpi8b(fptr, ntodo, incre, (long *) buffer, status);\n                break;\n\n            case (TBYTE):\n \n                ffu4fi1(&array[next], ntodo, scale, zero,\n                        (unsigned char *) buffer, status);\n                ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status);\n                break;\n\n            case (TSHORT):\n\n                ffu4fi2(&array[next], ntodo, scale, zero,\n                        (short *) buffer, status);\n                ffpi2b(fptr, ntodo, incre, (short *) buffer, status);\n                break;\n\n            case (TFLOAT):\n\n                ffu4fr4(&array[next], ntodo, scale, zero,\n                        (float *) buffer, status);\n                ffpr4b(fptr, ntodo, incre, (float *) buffer, status);\n                break;\n\n            case (TDOUBLE):\n                ffu4fr8(&array[next], ntodo, scale, zero,\n                       (double *) buffer, status);\n                ffpr8b(fptr, ntodo, incre, (double *) buffer, status);\n                break;\n\n            case (TSTRING):  /* numerical column in an ASCII table */\n\n                if (cform[1] != 's')  /*  \"%s\" format is a string */\n                {\n                  ffu4fstr(&array[next], ntodo, scale, zero, cform,\n                          twidth, (char *) buffer, status);\n\n                  if (incre == twidth)    /* contiguous bytes */\n                     ffpbyt(fptr, ntodo * twidth, buffer, status);\n                  else\n                     ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                            status);\n\n                  break;\n                }\n                /* can't write to string column, so fall thru to default: */\n\n            default:  /*  error trap  */\n                snprintf(message,FLEN_ERRMSG, \n                     \"Cannot write numbers to column %d which has format %s\",\n                      colnum,tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous write operation */\n        {\n          snprintf(message,FLEN_ERRMSG,\n          \"Error writing elements %.0f thru %.0f of input data array (ffpcluj).\",\n              (double) (next+1), (double) (next+ntodo));\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum += ntodo;\n            if (elemnum == repeat)  /* completed a row; start on next row */\n            {\n                elemnum = 0;\n                rownum++;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while writing FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcnuj( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n   unsigned long  *array,    /* I - array of values to write                */\n   unsigned long   nulvalue, /* I - value used to flag undefined pixels     */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of elements to the specified column of a table.  Any input\n  pixels equal to the value of nulvalue will be replaced by the appropriate\n  null value in the output FITS file. \n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary\n*/\n{\n    tcolumn *colptr;\n    LONGLONG  ngood = 0, nbad = 0, ii;\n    LONGLONG repeat, first, fstelm, fstrow;\n    int tcode, overflow = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n    }\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n\n    tcode  = colptr->tdatatype;\n\n    if (tcode > 0)\n       repeat = colptr->trepeat;  /* repeat count for this column */\n    else\n       repeat = firstelem -1 + nelem;  /* variable length arrays */\n\n    /* if variable length array, first write the whole input vector, \n       then go back and fill in the nulls */\n    if (tcode < 0) {\n      if (ffpcluj(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) {\n        if (*status == NUM_OVERFLOW) \n\t{\n\t  /* ignore overflows, which are possibly the null pixel values */\n\t  /*  overflow = 1;   */\n\t  *status = 0;\n\t} else { \n          return(*status);\n\t}\n      }\n    }\n\n    /* absolute element number in the column */\n    first = (firstrow - 1) * repeat + firstelem;\n\n    for (ii = 0; ii < nelem; ii++)\n    {\n      if (array[ii] != nulvalue)  /* is this a good pixel? */\n      {\n         if (nbad)  /* write previous string of bad pixels */\n         {\n            fstelm = ii - nbad + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0)\n                return(*status);\n\n            nbad=0;\n         }\n\n         ngood = ngood +1;  /* the consecutive number of good pixels */\n      }\n      else\n      {\n         if (ngood)  /* write previous string of good pixels */\n         {\n            fstelm = ii - ngood + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (tcode > 0) {  /* variable length arrays have already been written */\n              if (ffpcluj(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood],\n                status) > 0) {\n\t\tif (*status == NUM_OVERFLOW) \n\t\t{\n\t\t  overflow = 1;\n\t\t  *status = 0;\n\t\t} else { \n                  return(*status);\n\t\t}\n\t      }\n\t    }\n            ngood=0;\n         }\n\n         nbad = nbad +1;  /* the consecutive number of bad pixels */\n      }\n    }\n\n    /* finished loop;  now just write the last set of pixels */\n\n    if (ngood)  /* write last string of good pixels */\n    {\n      fstelm = ii - ngood + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      if (tcode > 0) {  /* variable length arrays have already been written */\n        ffpcluj(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status);\n      }\n    }\n    else if (nbad) /* write last string of bad pixels */\n    {\n      fstelm = ii - nbad + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      ffpclu(fptr, colnum, fstrow, fstelm, nbad, status);\n    }\n\n    if (*status <= 0) {\n      if (overflow) {\n        *status = NUM_OVERFLOW;\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu4fi1(unsigned long *input,  /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            unsigned char *output, /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] > UCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DUCHAR_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (dvalue > DUCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) (dvalue + .5);\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu4fi2(unsigned long *input, /* I - array of values to be converted */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            short *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] > SHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n                output[ii] = (short) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DSHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MIN;\n            }\n            else if (dvalue > DSHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (short) (dvalue + .5);\n                else\n                    output[ii] = (short) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu4fi4(unsigned long *input, /* I - array of values to be converted */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            INT32BIT *output,  /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 2147483648. && sizeof(long) == 4)\n    {       \n        /* Instead of subtracting 2147483648, it is more efficient */\n        /* to just flip the sign bit with the XOR operator */\n\n        for (ii = 0; ii < ntodo; ii++)\n             output[ii] =  ( *(long *) &input[ii] ) ^ 0x80000000;\n    }\n    else if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] > INT32_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n                output[ii] = input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (INT32BIT) (dvalue + .5);\n                else\n                    output[ii] = (INT32BIT) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu4fi8(unsigned long *input,  /* I - array of values to be converted  */\n            long ntodo,             /* I - number of elements in the array  */\n            double scale,           /* I - FITS TSCALn or BSCALE value      */\n            double zero,            /* I - FITS TZEROn or BZERO  value      */\n            LONGLONG *output,       /* O - output array of converted values */\n            int *status)            /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero ==  9223372036854775808.)\n    {       \n        /* Writing to unsigned long long column. */\n        /* Instead of subtracting 9223372036854775808, it is more efficient */\n        /* and more precise to just flip the sign bit with the XOR operator */\n\n        /* no need to check range limits because all unsigned long values */\n\t/* are valid ULONGLONG values. */\n\n        for (ii = 0; ii < ntodo; ii++) {\n             output[ii] =  ((LONGLONG) input[ii]) ^ 0x8000000000000000;\n        }\n    }\n    else if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DLONGLONG_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MIN;\n            }\n            else if (dvalue > DLONGLONG_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (LONGLONG) (dvalue + .5);\n                else\n                    output[ii] = (LONGLONG) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu4fr4(unsigned long *input, /* I - array of values to be converted */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            float *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (float) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (float) ((input[ii] - zero) / scale);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu4fr8(unsigned long *input, /* I - array of values to be converted */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            double *output,    /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (double) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (input[ii] - zero) / scale;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu4fstr(unsigned long *input, /* I - array of values to be converted */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            char *cform,       /* I - format for output string values  */\n            long twidth,       /* I - width of each field, in chars    */\n            char *output,      /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n    char *cptr;\n    \n    cptr = output;\n\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n           sprintf(output, cform, (double) input[ii]);\n           output += twidth;\n\n           if (*output)  /* if this char != \\0, then overflow occurred */\n              *status = OVERFLOW_ERR;\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n          dvalue = (input[ii] - zero) / scale;\n          sprintf(output, cform, dvalue);\n          output += twidth;\n\n          if (*output)  /* if this char != \\0, then overflow occurred */\n            *status = OVERFLOW_ERR;\n        }\n    }\n\n    /* replace any commas with periods (e.g., in French locale) */\n    while ((cptr = strchr(cptr, ','))) *cptr = '.';\n    \n    return(*status);\n}\n\n/* ======================================================================== */\n/*      the following routines support the 'unsigned long long' data type            */\n/* ======================================================================== */\n\n/*--------------------------------------------------------------------------*/\nint ffpprujj( fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            ULONGLONG *array,    /* I - array of values that are written        */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n    unsigned long nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        ffpmsg(\"writing TULONGLONG to compressed image is not supported\");\n\n        return(*status = DATA_COMPRESSION_ERR);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpclujj(fptr, 2, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffppnujj( fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            ULONGLONG *array,    /* I - array of values that are written        */\n            ULONGLONG  nulval,    /* I - undefined pixel value                   */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).  Any array values\n  that are equal to the value of nulval will be replaced with the null\n  pixel value that is appropriate for this column.\n*/\n{\n    long row;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        ffpmsg(\"writing TULONGLONG to compressed image is not supported\");\n\n        return(*status = DATA_COMPRESSION_ERR);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcnujj(fptr, 2, row, firstelem, nelem, array, nulval, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp2dujj(fitsfile *fptr,   /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)           */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           ULONGLONG  *array,     /* I - array to be written                  */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    /* call the 3D writing routine, with the 3rd dimension = 1 */\n\n    ffp3dujj(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp3dujj(fitsfile *fptr,   /* I - FITS file pointer                    */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  nrows,      /* I - number of rows in each plane of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           LONGLONG  naxis3,     /* I - FITS image NAXIS3 value               */\n           ULONGLONG  *array,    /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 3-D cube of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    long tablerow, ii, jj;\n    long fpixel[3]= {1,1,1}, lpixel[3];\n    LONGLONG nfits, narray;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n           \n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        ffpmsg(\"writing TULONGLONG to compressed image is not supported\");\n\n        return(*status = DATA_COMPRESSION_ERR);\n    }\n\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n      /* all the image pixels are contiguous, so write all at once */\n      ffpclujj(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status);\n      return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to write to */\n    narray = 0;  /* next pixel in input array to be written */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* writing naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffpclujj(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0)\n         return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpssujj(fitsfile *fptr,   /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)           */\n           long  naxis,      /* I - number of data axes in array            */\n           long  *naxes,     /* I - size of each FITS axis                  */\n           long  *fpixel,    /* I - 1st pixel in each axis to write (1=1st) */\n           long  *lpixel,    /* I - last pixel in each axis to write        */\n           ULONGLONG *array,      /* I - array to be written                     */\n           int  *status)     /* IO - error status                           */\n/*\n  Write a subsection of pixels to the primary array or image.\n  A subsection is defined to be any contiguous rectangular\n  array of pixels within the n-dimensional FITS data file.\n  Data conversion and scaling will be performed if necessary \n  (e.g, if the datatype of the FITS array is not the same as\n  the array being written).\n*/\n{\n    long tablerow;\n    LONGLONG fpix[7], dimen[7], astart, pstart;\n    LONGLONG off2, off3, off4, off5, off6, off7;\n    LONGLONG st10, st20, st30, st40, st50, st60, st70;\n    LONGLONG st1, st2, st3, st4, st5, st6, st7;\n    long ii, i1, i2, i3, i4, i5, i6, i7, irange[7];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        ffpmsg(\"writing TULONGLONG to compressed image is not supported\");\n\n        return(*status = DATA_COMPRESSION_ERR);\n    }\n\n    if (naxis < 1 || naxis > 7)\n      return(*status = BAD_DIMEN);\n\n    tablerow=maxvalue(1,group);\n\n     /* calculate the size and number of loops to perform in each dimension */\n    for (ii = 0; ii < 7; ii++)\n    {\n      fpix[ii]=1;\n      irange[ii]=1;\n      dimen[ii]=1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {    \n      fpix[ii]=fpixel[ii];\n      irange[ii]=lpixel[ii]-fpixel[ii]+1;\n      dimen[ii]=naxes[ii];\n    }\n\n    i1=irange[0];\n\n    /* compute the pixel offset between each dimension */\n    off2 =     dimen[0];\n    off3 = off2 * dimen[1];\n    off4 = off3 * dimen[2];\n    off5 = off4 * dimen[3];\n    off6 = off5 * dimen[4];\n    off7 = off6 * dimen[5];\n\n    st10 = fpix[0];\n    st20 = (fpix[1] - 1) * off2;\n    st30 = (fpix[2] - 1) * off3;\n    st40 = (fpix[3] - 1) * off4;\n    st50 = (fpix[4] - 1) * off5;\n    st60 = (fpix[5] - 1) * off6;\n    st70 = (fpix[6] - 1) * off7;\n\n    /* store the initial offset in each dimension */\n    st1 = st10;\n    st2 = st20;\n    st3 = st30;\n    st4 = st40;\n    st5 = st50;\n    st6 = st60;\n    st7 = st70;\n\n    astart = 0;\n\n    for (i7 = 0; i7 < irange[6]; i7++)\n    {\n     for (i6 = 0; i6 < irange[5]; i6++)\n     {\n      for (i5 = 0; i5 < irange[4]; i5++)\n      {\n       for (i4 = 0; i4 < irange[3]; i4++)\n       {\n        for (i3 = 0; i3 < irange[2]; i3++)\n        {\n         pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7;\n\n         for (i2 = 0; i2 < irange[1]; i2++)\n         {\n           if (ffpclujj(fptr, 2, tablerow, pstart, i1, &array[astart],\n              status) > 0)\n              return(*status);\n\n           astart += i1;\n           pstart += off2;\n         }\n         st2 = st20;\n         st3 = st3+off3;    \n        }\n        st3 = st30;\n        st4 = st4+off4;\n       }\n       st4 = st40;\n       st5 = st5+off5;\n      }\n      st5 = st50;\n      st6 = st6+off6;\n     }\n     st6 = st60;\n     st7 = st7+off7;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpgpujj( fitsfile *fptr,   /* I - FITS file pointer                    */\n            long  group,      /* I - group to write(1 = 1st group)          */\n            long  firstelem,  /* I - first vector element to write(1 = 1st) */\n            long  nelem,      /* I - number of values to write              */\n            ULONGLONG  *array,     /* I - array of values that are written  */\n            int  *status)     /* IO - error status                          */\n/*\n  Write an array of group parameters to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffpclujj(fptr, 1L, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpclujj( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            ULONGLONG  *array,    /* I - array of values to write                */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer to a virtual column in a 1 or more grouped FITS primary\n  array.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    int tcode, maxelem, hdutype;\n    long twidth, incre;\n    long ntodo;\n    LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull;\n    double scale, zero;\n    char tform[20], cform[20];\n    char message[FLEN_ERRMSG];\n\n    char snull[20];   /*  the FITS null value  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n\n    if (tcode == TSTRING)   \n         ffcfmt(tform, cform);     /* derive C format for writing strings */\n\n    /*---------------------------------------------------------------------*/\n    /*  Now write the pixels to the FITS column.                           */\n    /*  First call the ffXXfYY routine to  (1) convert the datatype        */\n    /*  if necessary, and (2) scale the values by the FITS TSCALn and      */\n    /*  TZEROn linear scaling parameters into a temporary buffer.          */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to write  */\n    next = 0;                 /* next element in array to be written  */\n    rownum = 0;               /* row number, relative to firstrow     */\n\n    while (remain)\n    {\n        /* limit the number of pixels to process a one time to the number that\n           will fit in the buffer space or to the number of pixels that remain\n           in the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);      \n        ntodo = (long) minvalue(ntodo, (repeat - elemnum));\n\n        wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre);\n\n        ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */\n\n        switch (tcode) \n        {\n            case (TLONGLONG):\n\n                ffu8fi8(&array[next], ntodo, scale, zero,\n                        (LONGLONG *) buffer, status);\n                ffpi8b(fptr, ntodo, incre, (long *) buffer, status);\n                break;\n\n            case (TLONG):\n\n                ffu8fi4(&array[next], ntodo, scale, zero,\n                      (INT32BIT *) buffer, status);\n                ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status);\n                break;\n\n            case (TBYTE):\n \n                ffu8fi1(&array[next], ntodo, scale, zero,\n                        (unsigned char *) buffer, status);\n                ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status);\n                break;\n\n            case (TSHORT):\n\n                ffu8fi2(&array[next], ntodo, scale, zero,\n                        (short *) buffer, status);\n                ffpi2b(fptr, ntodo, incre, (short *) buffer, status);\n                break;\n\n            case (TFLOAT):\n\n                ffu8fr4(&array[next], ntodo, scale, zero,\n                        (float *) buffer, status);\n                ffpr4b(fptr, ntodo, incre, (float *) buffer, status);\n                break;\n\n            case (TDOUBLE):\n                ffu8fr8(&array[next], ntodo, scale, zero,\n                       (double *) buffer, status);\n                ffpr8b(fptr, ntodo, incre, (double *) buffer, status);\n                break;\n\n            case (TSTRING):  /* numerical column in an ASCII table */\n\n                if (cform[1] != 's')  /*  \"%s\" format is a string */\n                {\n                  ffu8fstr(&array[next], ntodo, scale, zero, cform,\n                          twidth, (char *) buffer, status);\n\n                  if (incre == twidth)    /* contiguous bytes */\n                     ffpbyt(fptr, ntodo * twidth, buffer, status);\n                  else\n                     ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                            status);\n\n                  break;\n                }\n                /* can't write to string column, so fall thru to default: */\n\n            default:  /*  error trap  */\n                snprintf(message, FLEN_ERRMSG,\n                     \"Cannot write numbers to column %d which has format %s\",\n                      colnum,tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous write operation */\n        {\n          snprintf(message, FLEN_ERRMSG,\n          \"Error writing elements %.0f thru %.0f of input data array (ffpcluj).\",\n              (double) (next+1), (double) (next+ntodo));\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum += ntodo;\n            if (elemnum == repeat)  /* completed a row; start on next row */\n            {\n                elemnum = 0;\n                rownum++;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while writing FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcnujj( fitsfile *fptr,  /* I - FITS file pointer                     */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            ULONGLONG *array,    /* I - array of values to write                */\n            ULONGLONG nulvalue,  /* I - value used to flag undefined pixels     */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of elements to the specified column of a table.  Any input\n  pixels equal to the value of nulvalue will be replaced by the appropriate\n  null value in the output FITS file. \n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary\n*/\n{\n    tcolumn *colptr;\n    LONGLONG  ngood = 0, nbad = 0, ii;\n    LONGLONG repeat, first, fstelm, fstrow;\n    int tcode, overflow = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n    }\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n\n    tcode  = colptr->tdatatype;\n\n    if (tcode > 0)\n       repeat = colptr->trepeat;  /* repeat count for this column */\n    else\n       repeat = firstelem -1 + nelem;  /* variable length arrays */\n\n    /* if variable length array, first write the whole input vector, \n       then go back and fill in the nulls */\n    if (tcode < 0) {\n      if (ffpclujj(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) {\n        if (*status == NUM_OVERFLOW) \n\t{\n\t  /* ignore overflows, which are possibly the null pixel values */\n\t  /*  overflow = 1;   */\n\t  *status = 0;\n\t} else { \n          return(*status);\n\t}\n      }\n    }\n\n    /* absolute element number in the column */\n    first = (firstrow - 1) * repeat + firstelem;\n\n    for (ii = 0; ii < nelem; ii++)\n    {\n      if (array[ii] != nulvalue)  /* is this a good pixel? */\n      {\n         if (nbad)  /* write previous string of bad pixels */\n         {\n            fstelm = ii - nbad + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0)\n                return(*status);\n\n            nbad=0;\n         }\n\n         ngood = ngood +1;  /* the consecutive number of good pixels */\n      }\n      else\n      {\n         if (ngood)  /* write previous string of good pixels */\n         {\n            fstelm = ii - ngood + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (tcode > 0) {  /* variable length arrays have already been written */\n              if (ffpclujj(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood],\n                status) > 0) {\n\t\tif (*status == NUM_OVERFLOW) \n\t\t{\n\t\t  overflow = 1;\n\t\t  *status = 0;\n\t\t} else { \n                  return(*status);\n\t\t}\n\t      }\n\t    }\n            ngood=0;\n         }\n\n         nbad = nbad +1;  /* the consecutive number of bad pixels */\n      }\n    }\n\n    /* finished loop;  now just write the last set of pixels */\n\n    if (ngood)  /* write last string of good pixels */\n    {\n      fstelm = ii - ngood + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      if (tcode > 0) {  /* variable length arrays have already been written */\n        ffpclujj(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status);\n      }\n    }\n    else if (nbad) /* write last string of bad pixels */\n    {\n      fstelm = ii - nbad + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      ffpclu(fptr, colnum, fstrow, fstelm, nbad, status);\n    }\n\n    if (*status <= 0) {\n      if (overflow) {\n        *status = NUM_OVERFLOW;\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu8fi1(ULONGLONG *input,      /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            unsigned char *output, /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] > UCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DUCHAR_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (dvalue > DUCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) (dvalue + .5);\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu8fi2(ULONGLONG *input,  /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            short *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] > SHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n                output[ii] = (short) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DSHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MIN;\n            }\n            else if (dvalue > DSHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (short) (dvalue + .5);\n                else\n                    output[ii] = (short) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu8fi4(ULONGLONG *input,  /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            INT32BIT *output,  /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] > INT32_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n                output[ii] = input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (INT32BIT) (dvalue + .5);\n                else\n                    output[ii] = (INT32BIT) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu8fi8(ULONGLONG *input,       /* I - array of values to be converted  */\n            long ntodo,             /* I - number of elements in the array  */\n            double scale,           /* I - FITS TSCALn or BSCALE value      */\n            double zero,            /* I - FITS TZEROn or BZERO  value      */\n            LONGLONG *output,       /* O - output array of converted values */\n            int *status)            /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero ==  9223372036854775808.)\n    {       \n        /* Writing to unsigned long long column. */\n        /* Instead of subtracting 9223372036854775808, it is more efficient */\n        /* and more precise to just flip the sign bit with the XOR operator */\n\n        /* no need to check range limits because all input values */\n\t/* are valid ULONGLONG values. */\n\n        for (ii = 0; ii < ntodo; ii++) {\n             output[ii] =  ((LONGLONG) input[ii]) ^ 0x8000000000000000;\n        }\n    }\n    else if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++) {\n            if (input[ii] > LONGLONG_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MAX;\n            }\n            else\n            {\n\t        output[ii] = input[ii];\n\t    }\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DLONGLONG_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MIN;\n            }\n            else if (dvalue > DLONGLONG_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (LONGLONG) (dvalue + .5);\n                else\n                    output[ii] = (LONGLONG) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu8fr4(ULONGLONG *input , /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            float *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (float) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (float) ((input[ii] - zero) / scale);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu8fr8(ULONGLONG *input,  /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            double *output,    /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (double) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (input[ii] - zero) / scale;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu8fstr(ULONGLONG *input, /* I - array of values to be converted */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            char *cform,       /* I - format for output string values  */\n            long twidth,       /* I - width of each field, in chars    */\n            char *output,      /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n    char *cptr;\n    \n    cptr = output;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n           sprintf(output, cform, (double) input[ii]);\n           output += twidth;\n\n           if (*output)  /* if this char != \\0, then overflow occurred */\n              *status = OVERFLOW_ERR;\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n          dvalue = (input[ii] - zero) / scale;\n          sprintf(output, cform, dvalue);\n          output += twidth;\n\n          if (*output)  /* if this char != \\0, then overflow occurred */\n            *status = OVERFLOW_ERR;\n        }\n    }\n\n    /* replace any commas with periods (e.g., in French locale) */\n    while ((cptr = strchr(cptr, ','))) *cptr = '.';\n    \n    return(*status);\n}\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":116,"id":16646,"name":"_visible_axes","nodeType":"Attribute","startLoc":116,"text":"self._visible_axes"},{"attributeType":"null","col":8,"comment":"null","endLoc":142,"id":16647,"name":"va","nodeType":"Attribute","startLoc":142,"text":"self.va"},{"id":16648,"name":"putcols.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, putcols.c, contains routines that write data elements to    */\n/*  a FITS image or table, of type character string.                       */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n/*--------------------------------------------------------------------------*/\nint ffpcls( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of strings to write              */\n            char  **array,   /* I - array of pointers to strings            */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of string values to a column in the current FITS HDU.\n*/\n{\n    int tcode, maxelem, hdutype, nchar;\n    long twidth, incre;\n    long ii, jj, ntodo;\n    LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull;\n    double scale, zero;\n    char tform[20], *blanks;\n    char message[FLEN_ERRMSG];\n    char snull[20];   /*  the FITS null value  */\n    tcolumn *colptr;\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    char *buffer, *arrayptr;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n    }\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (colnum < 1 || colnum > (fptr->Fptr)->tfield)\n    {\n        snprintf(message, FLEN_ERRMSG,\"Specified column number is out of range: %d\",\n                colnum);\n        ffpmsg(message);\n        return(*status = BAD_COL_NUM);\n    }\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n    tcode = colptr->tdatatype;\n\n    if (tcode == -TSTRING) /* variable length column in a binary table? */\n    {\n      /* only write a single string; ignore value of firstelem */\n      nchar = maxvalue(1,strlen(array[0])); /* will write at least 1 char */\n                                          /* even if input string is null */\n\n      if (ffgcprll( fptr, colnum, firstrow, 1, nchar, 1, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n\t\n      /* simply move to write position, then write the string */\n      ffmbyt(fptr, startpos, IGNORE_EOF, status); \n      ffpbyt(fptr, nchar, array[0], status);\n\n      if (*status > 0)  /* test for error during previous write operation */\n      {\n         snprintf(message,FLEN_ERRMSG,\n          \"Error writing to variable length string column (ffpcls).\");\n         ffpmsg(message);\n      }\n\n      return(*status);\n    }\n    else if (tcode == TSTRING)\n    {\n      if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n\n      /* if string length is greater than a FITS block (2880 char) then must */\n      /* only write 1 string at a time, to force writein by ffpbyt instead of */\n      /* ffpbytoff (ffpbytoff can't handle this case) */\n      if (twidth > IOBUFLEN) {\n        maxelem = 1;\n        incre = twidth;\n        repeat = 1;\n      }   \n\n      blanks = (char *) malloc(twidth); /* string for blank fill values */\n      if (!blanks)\n      {\n        ffpmsg(\"Could not allocate memory for string (ffpcls)\");\n        return(*status = ARRAY_TOO_BIG);\n      }\n\n      for (ii = 0; ii < twidth; ii++)\n          blanks[ii] = ' ';          /* fill string with blanks */\n\n      remain = nelem;           /* remaining number of values to write  */\n    }\n    else \n      return(*status = NOT_ASCII_COL);\n \n    /*-------------------------------------------------------*/\n    /*  Now write the strings to the FITS column.            */\n    /*-------------------------------------------------------*/\n\n    next = 0;                 /* next element in array to be written  */\n    rownum = 0;               /* row number, relative to firstrow     */\n\n    while (remain)\n    {\n      /* limit the number of pixels to process at one time to the number that\n         will fit in the buffer space or to the number of pixels that remain\n         in the current vector, which ever is smaller.\n      */\n      ntodo = (long) minvalue(remain, maxelem);      \n      ntodo = (long) minvalue(ntodo, (repeat - elemnum));\n\n      wrtptr = startpos + (rownum * rowlen) + (elemnum * incre);\n      ffmbyt(fptr, wrtptr, IGNORE_EOF, status);  /* move to write position */\n\n      buffer = (char *) cbuff;\n\n      /* copy the user's strings into the buffer */\n      for (ii = 0; ii < ntodo; ii++)\n      {\n         arrayptr = array[next];\n\n         for (jj = 0; jj < twidth; jj++)  /*  copy the string, char by char */\n         {\n            if (*arrayptr)\n            {\n              *buffer = *arrayptr;\n              buffer++;\n              arrayptr++;\n            }\n            else\n              break;\n         }\n\n         for (;jj < twidth; jj++)    /* fill field with blanks, if needed */\n         {\n           *buffer = ' ';\n           buffer++;\n         }\n\n         next++;\n      }\n\n      /* write the buffer full of strings to the FITS file */\n      if (incre == twidth)\n         ffpbyt(fptr, ntodo * twidth, cbuff, status);\n      else\n         ffpbytoff(fptr, twidth, ntodo, incre - twidth, cbuff, status);\n\n      if (*status > 0)  /* test for error during previous write operation */\n      {\n         snprintf(message,FLEN_ERRMSG,\n          \"Error writing elements %.0f thru %.0f of input data array (ffpcls).\",\n             (double) (next+1), (double) (next+ntodo));\n         ffpmsg(message);\n\n         if (blanks)\n           free(blanks);\n\n         return(*status);\n      }\n\n      /*--------------------------------------------*/\n      /*  increment the counters for the next loop  */\n      /*--------------------------------------------*/\n      remain -= ntodo;\n      if (remain)\n      {\n          elemnum += ntodo;\n          if (elemnum == repeat)  /* completed a row; start on next row */\n          {\n              elemnum = 0;\n              rownum++;\n          }\n       }\n    }  /*  End of main while Loop  */\n\n    if (blanks)\n      free(blanks);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcns( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            char  **array,   /* I - array of values to write                */\n            char  *nulvalue, /* I - string representing a null value        */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of elements to the specified column of a table.  Any input\n  pixels flagged as null will be replaced by the appropriate\n  null value in the output FITS file. \n*/\n{\n    long repeat, width;\n    LONGLONG ngood = 0, nbad = 0, ii;\n    LONGLONG first, fstelm, fstrow;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n    }\n\n    /* get the vector repeat length of the column */\n    ffgtcl(fptr, colnum, NULL, &repeat, &width, status);\n\n    if ((fptr->Fptr)->hdutype == BINARY_TBL)\n        repeat = repeat / width;    /* convert from chars to unit strings */\n\n    /* absolute element number in the column */\n    first = (firstrow - 1) * repeat + firstelem;\n\n    for (ii = 0; ii < nelem; ii++)\n    {\n      if (strcmp(nulvalue, array[ii]))  /* is this a good pixel? */\n      {\n         if (nbad)  /* write previous string of bad pixels */\n         {\n            fstelm = ii - nbad + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0)\n                return(*status);\n            nbad=0;\n         }\n\n         ngood = ngood +1;  /* the consecutive number of good pixels */\n      }\n      else\n      {\n         if (ngood)  /* write previous string of good pixels */\n         {\n            fstelm = ii - ngood + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (ffpcls(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood],\n                status) > 0)\n                return(*status);\n\n            ngood=0;\n         }\n\n         nbad = nbad +1;  /* the consecutive number of bad pixels */\n      }\n    }\n\n    /* finished loop;  now just write the last set of pixels */\n\n    if (ngood)  /* write last string of good pixels */\n    {\n      fstelm = ii - ngood + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      ffpcls(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status);\n    }\n    else if (nbad) /* write last string of bad pixels */\n    {\n      fstelm = ii - nbad + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      ffpclu(fptr, colnum, fstrow, fstelm, nbad, status);\n    }\n\n    return(*status);\n}\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":44,"id":16649,"name":"disp","nodeType":"Attribute","startLoc":44,"text":"self.disp"},{"attributeType":"null","col":8,"comment":"null","endLoc":25,"id":16650,"name":"_exclude_overlapping","nodeType":"Attribute","startLoc":25,"text":"self._exclude_overlapping"},{"attributeType":"null","col":8,"comment":"null","endLoc":40,"id":16651,"name":"world","nodeType":"Attribute","startLoc":40,"text":"self.world"},{"attributeType":"null","col":8,"comment":"null","endLoc":109,"id":16652,"name":"_pad","nodeType":"Attribute","startLoc":109,"text":"self._pad"},{"attributeType":"null","col":8,"comment":"null","endLoc":42,"id":16653,"name":"angle","nodeType":"Attribute","startLoc":42,"text":"self.angle"},{"attributeType":"null","col":8,"comment":"null","endLoc":141,"id":16654,"name":"ha","nodeType":"Attribute","startLoc":141,"text":"self.ha"},{"id":16655,"name":"imcompress.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"# include <stdio.h>\n# include <stdlib.h>\n# include <string.h>\n# include <math.h>\n# include <ctype.h>\n# include <time.h>\n# include \"fitsio2.h\"\n\n#define NULL_VALUE -2147483647 /* value used to represent undefined pixels */\n#define ZERO_VALUE -2147483646 /* value used to represent zero-valued pixels */\n\n/* nearest integer function */\n# define NINT(x)  ((x >= 0.) ? (int) (x + 0.5) : (int) (x - 0.5))\n\n/* special quantize level value indicates that floating point image pixels */\n/* should not be quantized and instead losslessly compressed (with GZIP) */\n#define NO_QUANTIZE 9999\n\n/* string array for storing the individual column compression stats */\nchar results[999][30];\n\nfloat *fits_rand_value = 0;\n\nint imcomp_write_nocompress_tile(fitsfile *outfptr, long row, int datatype, \n    void *tiledata, long tilelen, int nullcheck, void *nullflagval, int *status);\nint imcomp_convert_tile_tshort(fitsfile *outfptr, void *tiledata, long tilelen,\n    int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale,\n    double zero, double actual_bzero, int *intlength, int *status);\nint imcomp_convert_tile_tushort(fitsfile *outfptr, void *tiledata, long tilelen,\n    int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale,\n    double zero, int *intlength, int *status);\nint imcomp_convert_tile_tint(fitsfile *outfptr, void *tiledata, long tilelen,\n    int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale,\n    double zero, int *intlength, int *status);\nint imcomp_convert_tile_tuint(fitsfile *outfptr, void *tiledata, long tilelen,\n    int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale,\n    double zero, int *intlength, int *status);\nint imcomp_convert_tile_tbyte(fitsfile *outfptr, void *tiledata, long tilelen,\n    int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale,\n    double zero, int *intlength, int *status);\nint imcomp_convert_tile_tsbyte(fitsfile *outfptr, void *tiledata, long tilelen,\n    int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale,\n    double zero, int *intlength, int *status);\nint imcomp_convert_tile_tfloat(fitsfile *outfptr, long row, void *tiledata, long tilelen,\n    long tilenx, long tileny, int nullcheck, void *nullflagval, int nullval, int zbitpix,\n    double scale, double zero, int *intlength, int *flag, double *bscale, double *bzero,int *status);\nint imcomp_convert_tile_tdouble(fitsfile *outfptr, long row, void *tiledata, long tilelen,\n    long tilenx, long tileny, int nullcheck, void *nullflagval, int nullval, int zbitpix, \n    double scale, double zero, int *intlength, int *flag, double *bscale, double *bzero, int *status);\n\nstatic int unquantize_i1r4(long row,\n            unsigned char *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int dither_method,    /* I - which subtractive dither method to use */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char tnull,          /* I - value of FITS TNULLn keyword if any */\n            float nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            float *output,        /* O - array of converted pixels           */\n            int *status);          /* IO - error status                       */\nstatic int unquantize_i2r4(long row,\n            short *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int dither_method,    /* I - which subtractive dither method to use */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short tnull,          /* I - value of FITS TNULLn keyword if any */\n            float nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            float *output,        /* O - array of converted pixels           */\n            int *status);          /* IO - error status                       */\nstatic int unquantize_i4r4(long row,\n            INT32BIT *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int dither_method,    /* I - which subtractive dither method to use */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            INT32BIT tnull,       /* I - value of FITS TNULLn keyword if any */\n            float nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            float *output,        /* O - array of converted pixels           */\n            int *status);          /* IO - error status                       */\nstatic int unquantize_i1r8(long row,\n            unsigned char *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int dither_method,    /* I - which subtractive dither method to use */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char tnull,          /* I - value of FITS TNULLn keyword if any */\n            double nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            double *output,        /* O - array of converted pixels           */\n            int *status);          /* IO - error status                       */\nstatic int unquantize_i2r8(long row,\n            short *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int dither_method,    /* I - which subtractive dither method to use */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short tnull,          /* I - value of FITS TNULLn keyword if any */\n            double nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            double *output,        /* O - array of converted pixels           */\n            int *status);          /* IO - error status                       */\nstatic int unquantize_i4r8(long row,\n            INT32BIT *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int dither_method,    /* I - which subtractive dither method to use */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            INT32BIT tnull,       /* I - value of FITS TNULLn keyword if any */\n            double nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            double *output,        /* O - array of converted pixels           */\n            int *status);          /* IO - error status                       */\nstatic int imcomp_float2nan(float *indata, long tilelen, int *outdata,\n    float nullflagval,  int *status);\nstatic int imcomp_double2nan(double *indata, long tilelen, LONGLONG *outdata,\n    double nullflagval,  int *status);    \nstatic int fits_read_write_compressed_img(fitsfile *fptr,   /* I - FITS file pointer */\n            int  datatype,  /* I - datatype of the array to be returned      */\n            LONGLONG  *infpixel, /* I - 'bottom left corner' of the subsection    */\n            LONGLONG  *inlpixel, /* I - 'top right corner' of the subsection      */\n            long  *ininc,    /* I - increment to be applied in each dimension */\n            int  nullcheck,  /* I - 0 for no null checking                   */\n                              /*     1: set undefined pixels = nullval       */\n            void *nullval,    /* I - value for undefined pixels              */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            fitsfile *outfptr,   /* I - FITS file pointer                    */\n            int  *status);\n\nstatic int fits_shuffle_8bytes(char *heap, LONGLONG length, int *status);\nstatic int fits_shuffle_4bytes(char *heap, LONGLONG length, int *status);\nstatic int fits_shuffle_2bytes(char *heap, LONGLONG length, int *status);\nstatic int fits_unshuffle_8bytes(char *heap, LONGLONG length, int *status);\nstatic int fits_unshuffle_4bytes(char *heap, LONGLONG length, int *status);\nstatic int fits_unshuffle_2bytes(char *heap, LONGLONG length, int *status);\n\nstatic int fits_int_to_longlong_inplace(int *intarray, long length, int *status);\nstatic int fits_short_to_int_inplace(short *intarray, long length, int shift, int *status);\nstatic int fits_ushort_to_int_inplace(unsigned short *intarray, long length, int shift, int *status);\nstatic int fits_sbyte_to_int_inplace(signed char *intarray, long length, int *status);\nstatic int fits_ubyte_to_int_inplace(unsigned char *intarray, long length, int *status);\n\nstatic int fits_calc_tile_rows(long *tlpixel, long *tfpixel, int ndim, long *trowsize, long *ntrows, int *status); \n\n/* only used for diagnoitic purposes */\n/* int fits_get_case(int *c1, int*c2, int*c3); */ \n/*---------------------------------------------------------------------------*/\nint fits_init_randoms(void) {\n\n/* initialize an array of random numbers */\n\n    int ii;\n    double a = 16807.0;\n    double m = 2147483647.0;\n    double temp, seed;\n\n    FFLOCK;\n \n    if (fits_rand_value) {\n       FFUNLOCK;\n       return(0);  /* array is already initialized */\n    }\n\n    /* allocate array for the random number sequence */\n    /* THIS MEMORY IS NEVER FREED */\n    fits_rand_value = calloc(N_RANDOM, sizeof(float));\n\n    if (!fits_rand_value) {\n        FFUNLOCK;\n\treturn(MEMORY_ALLOCATION);\n    }\n\t\t       \n    /*  We need a portable algorithm that anyone can use to generate this\n        exact same sequence of random number.  The C 'rand' function is not\n\tsuitable because it is not available to Fortran or Java programmers.\n\tInstead, use a well known simple algorithm published here: \n\t\"Random number generators: good ones are hard to find\", Communications of the ACM,\n        Volume 31 ,  Issue 10  (October 1988) Pages: 1192 - 1201 \n    */  \n\n    /* initialize the random numbers */\n    seed = 1;\n    for (ii = 0; ii < N_RANDOM; ii++) {\n        temp = a * seed;\n\tseed = temp -m * ((int) (temp / m) );\n\tfits_rand_value[ii] = (float) (seed / m);\n    }\n\n    FFUNLOCK;\n\n    /* \n    IMPORTANT NOTE: the 10000th seed value must have the value 1043618065 if the \n       algorithm has been implemented correctly */\n    \n    if ( (int) seed != 1043618065) {\n        ffpmsg(\"fits_init_randoms generated incorrect random number sequence\");\n\treturn(1);\n    } else {\n        return(0);\n    }\n}\n/*--------------------------------------------------------------------------*/\nvoid bz_internal_error(int errcode)\n{\n    /* external function declared by the bzip2 code in bzlib_private.h */\n    ffpmsg(\"bzip2 returned an internal error\");\n    ffpmsg(\"This should never happen\");\n    return;\n}\n/*--------------------------------------------------------------------------*/\nint fits_set_compression_type(fitsfile *fptr,  /* I - FITS file pointer     */\n       int ctype,    /* image compression type code;                        */\n                     /* allowed values: RICE_1, GZIP_1, GZIP_2, PLIO_1,     */\n                     /*  HCOMPRESS_1, BZIP2_1, and NOCOMPRESS               */\n       int *status)  /* IO - error status                                   */\n{\n/*\n   This routine specifies the image compression algorithm that should be\n   used when writing a FITS image.  The image is divided into tiles, and\n   each tile is compressed and stored in a row of at variable length binary\n   table column.\n*/\n\n    if (ctype != RICE_1 && \n        ctype != GZIP_1 && \n        ctype != GZIP_2 && \n        ctype != PLIO_1 && \n        ctype != HCOMPRESS_1 && \n        ctype != BZIP2_1 && \n        ctype != NOCOMPRESS &&\n\tctype != 0)\n    {\n\tffpmsg(\"unknown compression algorithm (fits_set_compression_type)\");\n\t*status = DATA_COMPRESSION_ERR; \n    } else {\n        (fptr->Fptr)->request_compress_type = ctype;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_set_tile_dim(fitsfile *fptr,  /* I - FITS file pointer             */\n           int ndim,   /* number of dimensions in the compressed image      */\n           long *dims, /* size of image compression tile in each dimension  */\n                      /* default tile size = (NAXIS1, 1, 1, ...)            */\n           int *status)         /* IO - error status                        */\n{\n/*\n   This routine specifies the size (dimension) of the image\n   compression  tiles that should be used when writing a FITS\n   image.  The image is divided into tiles, and each tile is compressed\n   and stored in a row of at variable length binary table column.\n*/\n    int ii;\n\n    if (ndim < 0 || ndim > MAX_COMPRESS_DIM)\n    {\n        *status = BAD_DIMEN;\n\tffpmsg(\"illegal number of tile dimensions (fits_set_tile_dim)\");\n        return(*status);\n    }\n\n    for (ii = 0; ii < ndim; ii++)\n    {\n        (fptr->Fptr)->request_tilesize[ii] = dims[ii];\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_set_quantize_level(fitsfile *fptr,  /* I - FITS file pointer   */\n           float qlevel,        /* floating point quantization level      */\n           int *status)         /* IO - error status                */\n{\n/*\n   This routine specifies the value of the quantization level, q,  that\n   should be used when compressing floating point images.  The image is\n   divided into tiles, and each tile is compressed and stored in a row\n   of at variable length binary table column.\n*/\n    if (qlevel == 0.)\n    {\n        /* this means don't quantize the floating point values. Instead, */\n\t/* the floating point values will be losslessly compressed */\n       (fptr->Fptr)->request_quantize_level = NO_QUANTIZE;\n    } else {\n\n        (fptr->Fptr)->request_quantize_level = qlevel;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_set_quantize_method(fitsfile *fptr,  /* I - FITS file pointer   */\n           int method,          /* quantization method       */\n           int *status)         /* IO - error status                */\n{\n/*\n   This routine specifies what type of dithering (randomization) should\n   be performed when quantizing floating point images to integer prior to\n   compression.   A value of -1 means do no dithering.  A value of 0 means\n   use the default SUBTRACTIVE_DITHER_1 (which is equivalent to dither = 1).\n   A value of 2 means use SUBTRACTIVE_DITHER_2.\n*/\n\n    if (method < -1 || method > 2)\n    {\n\tffpmsg(\"illegal dithering value (fits_set_quantize_method)\");\n\t*status = DATA_COMPRESSION_ERR; \n    } else {\n       \n        if (method == 0) method = 1;\n        (fptr->Fptr)->request_quantize_method = method;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_set_quantize_dither(fitsfile *fptr,  /* I - FITS file pointer   */\n           int dither,        /* dither type      */\n           int *status)         /* IO - error status                */\n{\n/*\n   the name of this routine has changed.  This is kept here only for backwards\n   compatibility for any software that may be calling the old routine.\n*/\n\n    fits_set_quantize_method(fptr, dither, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_set_dither_seed(fitsfile *fptr,  /* I - FITS file pointer   */\n           int seed,        /* random dithering seed value (1 to 10000) */\n           int *status)         /* IO - error status                */\n{\n/*\n   This routine specifies the value of the offset that should be applied when\n   calculating the random dithering when quantizing floating point iamges.\n   A random offset should be applied to each image to avoid quantization \n   effects when taking the difference of 2 images, or co-adding a set of\n   images.  Without this random offset, the corresponding pixel in every image\n   will have exactly the same dithering.\n   \n   offset = 0 means use the default random dithering based on system time\n   offset = negative means randomly chose dithering based on 1st tile checksum\n   offset = [1 - 10000] means use that particular dithering pattern\n\n*/\n    /* if positive, ensure that the value is in the range 1 to 10000 */\n    if (seed > 10000) {\n\tffpmsg(\"illegal dithering seed value (fits_set_dither_seed)\");\n\t*status = DATA_COMPRESSION_ERR;\n    } else {\n       (fptr->Fptr)->request_dither_seed = seed; \n    }\n    \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_set_dither_offset(fitsfile *fptr,  /* I - FITS file pointer   */\n           int offset,        /* random dithering offset value (1 to 10000) */\n           int *status)         /* IO - error status                */\n{\n/*\n    The name of this routine has changed.  This is kept just for\n    backwards compatibility with any software that calls the old name\n*/\n\n    fits_set_dither_seed(fptr, offset, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_set_noise_bits(fitsfile *fptr,  /* I - FITS file pointer   */\n           int noisebits,       /* noise_bits parameter value       */\n                                /* (default = 4)                    */\n           int *status)         /* IO - error status                */\n{\n/*\n   ********************************************************************\n   ********************************************************************\n   THIS ROUTINE IS PROVIDED ONLY FOR BACKWARDS COMPATIBILITY;\n   ALL NEW SOFTWARE SHOULD CALL fits_set_quantize_level INSTEAD\n   ********************************************************************\n   ********************************************************************\n\n   This routine specifies the value of the noice_bits parameter that\n   should be used when compressing floating point images.  The image is\n   divided into tiles, and each tile is compressed and stored in a row\n   of at variable length binary table column.\n\n   Feb 2008:  the \"noisebits\" parameter has been replaced with the more\n   general \"quantize level\" parameter.\n*/\n    float qlevel;\n\n    if (noisebits < 1 || noisebits > 16)\n    {\n        *status = DATA_COMPRESSION_ERR;\n\tffpmsg(\"illegal number of noise bits (fits_set_noise_bits)\");\n        return(*status);\n    }\n\n    qlevel = (float) pow (2., (double)noisebits);\n    fits_set_quantize_level(fptr, qlevel, status);\n    \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_set_hcomp_scale(fitsfile *fptr,  /* I - FITS file pointer   */\n           float scale,       /* hcompress scale parameter value       */\n                                /* (default = 0.)                    */\n           int *status)         /* IO - error status                */\n{\n/*\n   This routine specifies the value of the hcompress scale parameter.\n*/\n    (fptr->Fptr)->request_hcomp_scale = scale;\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_set_hcomp_smooth(fitsfile *fptr,  /* I - FITS file pointer   */\n           int smooth,       /* hcompress smooth parameter value       */\n                                /* if scale > 1 and smooth != 0, then */\n\t\t\t\t/*  the image will be smoothed when it is */\n\t\t\t\t/* decompressed to remove some of the */\n\t\t\t\t/* 'blockiness' in the image produced */\n\t\t\t\t/* by the lossy compression    */\n           int *status)         /* IO - error status                */\n{\n/*\n   This routine specifies the value of the hcompress scale parameter.\n*/\n\n    (fptr->Fptr)->request_hcomp_smooth = smooth;\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_set_lossy_int(fitsfile *fptr,  /* I - FITS file pointer   */\n           int lossy_int,       /* I - True (!= 0) or False (0) */\n           int *status)         /* IO - error status                */\n{\n/*\n   This routine specifies whether images with integer pixel values should\n   quantized and compressed the same way float images are compressed.\n   The default is to not do this, and instead apply a lossless compression\n   algorithm to integer images.\n*/\n\n    (fptr->Fptr)->request_lossy_int_compress = lossy_int;\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_set_huge_hdu(fitsfile *fptr,  /* I - FITS file pointer   */\n           int huge,       /* I - True (!= 0) or False (0) */\n           int *status)         /* IO - error status                */\n{\n/*\n   This routine specifies whether the HDU that is being compressed is so large\n   (i.e., > 4 GB) that the 'Q' type variable length array columns should be used\n   rather than the normal 'P' type.  The allows the heap pointers to be stored\n   as 64-bit quantities, rather than just 32-bits.\n*/\n\n    (fptr->Fptr)->request_huge_hdu = huge;\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_get_compression_type(fitsfile *fptr,  /* I - FITS file pointer     */\n       int *ctype,   /* image compression type code;                        */\n                     /* allowed values:                                     */\n\t\t     /* RICE_1, GZIP_1, GZIP_2, PLIO_1, HCOMPRESS_1, BZIP2_1 */\n       int *status)  /* IO - error status                                   */\n{\n/*\n   This routine returns the image compression algorithm that should be\n   used when writing a FITS image.  The image is divided into tiles, and\n   each tile is compressed and stored in a row of at variable length binary\n   table column.\n*/\n    *ctype = (fptr->Fptr)->request_compress_type;\n\n    if (*ctype != RICE_1 && \n        *ctype != GZIP_1 && \n        *ctype != GZIP_2 && \n        *ctype != PLIO_1 && \n        *ctype != HCOMPRESS_1 && \n        *ctype != BZIP2_1 && \n        *ctype != NOCOMPRESS &&\n\t*ctype != 0   ) \n\n    {\n\tffpmsg(\"unknown compression algorithm (fits_get_compression_type)\");\n\t*status = DATA_COMPRESSION_ERR; \n    }\n \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_get_tile_dim(fitsfile *fptr,  /* I - FITS file pointer             */\n           int ndim,   /* number of dimensions in the compressed image      */\n           long *dims, /* size of image compression tile in each dimension  */\n                       /* default tile size = (NAXIS1, 1, 1, ...)           */\n           int *status)         /* IO - error status                        */\n{\n/*\n   This routine returns the size (dimension) of the image\n   compression  tiles that should be used when writing a FITS\n   image.  The image is divided into tiles, and each tile is compressed\n   and stored in a row of at variable length binary table column.\n*/\n    int ii;\n\n    if (ndim < 0 || ndim > MAX_COMPRESS_DIM)\n    {\n        *status = BAD_DIMEN;\n\tffpmsg(\"illegal number of tile dimensions (fits_get_tile_dim)\");\n        return(*status);\n    }\n\n    for (ii = 0; ii < ndim; ii++)\n    {\n        dims[ii] = (fptr->Fptr)->request_tilesize[ii];\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_unset_compression_param(\n      fitsfile *fptr,\n      int *status) \n{\n    int ii;\n\n    (fptr->Fptr)->compress_type = 0;\n    (fptr->Fptr)->quantize_level = 0;\n    (fptr->Fptr)->quantize_method = 0;\n    (fptr->Fptr)->dither_seed = 0; \n    (fptr->Fptr)->hcomp_scale = 0;\n\n    for (ii = 0; ii < MAX_COMPRESS_DIM; ii++)\n    {\n        (fptr->Fptr)->tilesize[ii] = 0;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_unset_compression_request(\n      fitsfile *fptr,\n      int *status) \n{\n    int ii;\n\n    (fptr->Fptr)->request_compress_type = 0;\n    (fptr->Fptr)->request_quantize_level = 0;\n    (fptr->Fptr)->request_quantize_method = 0;\n    (fptr->Fptr)->request_dither_seed = 0; \n    (fptr->Fptr)->request_hcomp_scale = 0;\n    (fptr->Fptr)->request_lossy_int_compress = 0;\n    (fptr->Fptr)->request_huge_hdu = 0;\n\n    for (ii = 0; ii < MAX_COMPRESS_DIM; ii++)\n    {\n        (fptr->Fptr)->request_tilesize[ii] = 0;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_set_compression_pref(\n      fitsfile *infptr,\n      fitsfile *outfptr,\n      int *status) \n{\n/*\n   Set the preference for various compression options, based\n   on keywords in the input file that\n   provide guidance about how the HDU should be compressed when written\n   to the output file.\n*/\n\n    int ii, naxis, nkeys, comptype;\n    int  ivalue;\n    long tiledim[6]= {1,1,1,1,1,1};\n    char card[FLEN_CARD], value[FLEN_VALUE];\n    double  qvalue;\n    float hscale;\n    LONGLONG datastart, dataend; \n    if (*status > 0)\n        return(*status);\n\n    /* check the size of the HDU that is to be compressed */\n    fits_get_hduaddrll(infptr, NULL, &datastart, &dataend, status);\n    if ( (LONGLONG)(dataend - datastart) > UINT32_MAX) {\n       /* use 64-bit '1Q' variable length columns instead of '1P' columns */\n       /* for large files, in case the heap size becomes larger than 2**32 bytes*/\n       fits_set_huge_hdu(outfptr, 1, status);\n    }\n\n    fits_get_hdrspace(infptr, &nkeys, NULL, status);\n \n   /* look for a image compression directive keywords (begin with 'FZ') */\n    for (ii = 2; ii <= nkeys; ii++) {\n        \n\tfits_read_record(infptr, ii, card, status);\n\n\tif (!strncmp(card, \"FZ\", 2) ){\n\t\n            /* get the keyword value string */\n            fits_parse_value(card, value, NULL, status);\n\t    \n\t    if      (!strncmp(card+2, \"ALGOR\", 5) ) {\n\n\t        /* set the desired compression algorithm */\n                /* allowed values: RICE_1, GZIP_1, GZIP_2, PLIO_1,     */\n                /*  HCOMPRESS_1, BZIP2_1, and NOCOMPRESS               */\n\n                if        (!fits_strncasecmp(value, \"'RICE_1\", 7) ) {\n\t\t    comptype = RICE_1;\n                } else if (!fits_strncasecmp(value, \"'GZIP_1\", 7) ) {\n\t\t    comptype = GZIP_1;\n                } else if (!fits_strncasecmp(value, \"'GZIP_2\", 7) ) {\n\t\t    comptype = GZIP_2;\n                } else if (!fits_strncasecmp(value, \"'PLIO_1\", 7) ) {\n\t\t    comptype = PLIO_1;\n                } else if (!fits_strncasecmp(value, \"'HCOMPRESS_1\", 12) ) {\n\t\t    comptype = HCOMPRESS_1;\n                } else if (!fits_strncasecmp(value, \"'NONE\", 5) ) {\n\t\t    comptype = NOCOMPRESS;\n\t\t} else {\n\t\t\tffpmsg(\"Unknown FZALGOR keyword compression algorithm:\");\n\t\t\tffpmsg(value);\n\t\t\treturn(*status = DATA_COMPRESSION_ERR);\n\t\t}  \n\n\t        fits_set_compression_type (outfptr, comptype, status);\n\n\t    } else if (!strncmp(card+2, \"TILE  \", 6) ) {\n\n                if (!fits_strncasecmp(value, \"'row\", 4) ) {\n                   tiledim[0] = -1;\n\t\t} else if (!fits_strncasecmp(value, \"'whole\", 6) ) {\n                   tiledim[0] = -1;\n                   tiledim[1] = -1;\n                   tiledim[2] = -1;\n                } else {\n\t\t   ffdtdm(infptr, value, 0,6, &naxis, tiledim, status);\n                }\n\n\t        /* set the desired tile size */\n\t\tfits_set_tile_dim (outfptr, 6, tiledim, status);\n\n\t    } else if (!strncmp(card+2, \"QVALUE\", 6) ) {\n\n\t        /* set the desired Q quantization value */\n\t\tqvalue = atof(value);\n\t\tfits_set_quantize_level (outfptr, (float) qvalue, status);\n\n\t    } else if (!strncmp(card+2, \"QMETHD\", 6) ) {\n\n                    if (!fits_strncasecmp(value, \"'no_dither\", 10) ) {\n                        ivalue = -1; /* just quantize, with no dithering */\n\t\t    } else if (!fits_strncasecmp(value, \"'subtractive_dither_1\", 21) ) {\n                        ivalue = SUBTRACTIVE_DITHER_1; /* use subtractive dithering */\n\t\t    } else if (!fits_strncasecmp(value, \"'subtractive_dither_2\", 21) ) {\n                        ivalue = SUBTRACTIVE_DITHER_2; /* dither, except preserve zero-valued pixels */\n\t\t    } else {\n\t\t        ffpmsg(\"Unknown value for FZQUANT keyword: (set_compression_pref)\");\n\t\t\tffpmsg(value);\n                        return(*status = DATA_COMPRESSION_ERR);\n\t\t    }\n\n\t\t    fits_set_quantize_method(outfptr, ivalue, status);\n\t\t    \n\t    } else if (!strncmp(card+2, \"DTHRSD\", 6) ) {\n\n                if (!fits_strncasecmp(value, \"'checksum\", 9) ) {\n                    ivalue = -1; /* use checksum of first tile */\n\t\t} else if (!fits_strncasecmp(value, \"'clock\", 6) ) {\n                    ivalue = 0; /* set dithering seed based on system clock */\n\t\t} else {  /* read integer value */\n\t\t    if (*value == '\\'')\n                        ivalue = (int) atol(value+1); /* allow for leading quote character */\n                    else \n                        ivalue = (int) atol(value); \n\n                    if (ivalue < 1 || ivalue > 10000) {\n\t\t        ffpmsg(\"Invalid value for FZDTHRSD keyword: (set_compression_pref)\");\n\t\t\tffpmsg(value);\n                        return(*status = DATA_COMPRESSION_ERR);\n                    }\n\t\t}\n\n\t        /* set the desired dithering */\n\t\tfits_set_dither_seed(outfptr, ivalue, status);\n\n\t    } else if (!strncmp(card+2, \"I2F\", 3) ) {\n\n\t        /* set whether to convert integers to float then use lossy compression */\n                if (!fits_strcasecmp(value, \"t\") ) {\n\t\t    fits_set_lossy_int (outfptr, 1, status);\n\t\t} else if (!fits_strcasecmp(value, \"f\") ) {\n\t\t    fits_set_lossy_int (outfptr, 0, status);\n\t\t} else {\n\t\t        ffpmsg(\"Unknown value for FZI2F keyword: (set_compression_pref)\");\n\t\t\tffpmsg(value);\n                        return(*status = DATA_COMPRESSION_ERR);\n                }\n\n\t    } else if (!strncmp(card+2, \"HSCALE \", 6) ) {\n\n\t        /* set the desired Hcompress scale value */\n\t\thscale = (float) atof(value);\n\t\tfits_set_hcomp_scale (outfptr, hscale, status);\n            }\n\t}    \n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_get_noise_bits(fitsfile *fptr,  /* I - FITS file pointer   */\n           int *noisebits,       /* noise_bits parameter value       */\n                                /* (default = 4)                    */\n           int *status)         /* IO - error status                */\n{\n/*\n   ********************************************************************\n   ********************************************************************\n   THIS ROUTINE IS PROVIDED ONLY FOR BACKWARDS COMPATIBILITY;\n   ALL NEW SOFTWARE SHOULD CALL fits_set_quantize_level INSTEAD\n   ********************************************************************\n   ********************************************************************\n\n\n   This routine returns the value of the noice_bits parameter that\n   should be used when compressing floating point images.  The image is\n   divided into tiles, and each tile is compressed and stored in a row\n   of at variable length binary table column.\n\n   Feb 2008: code changed to use the more general \"quantize level\" parameter\n   rather than the \"noise bits\" parameter.  If quantize level is greater than\n   zero, then the previous noisebits parameter is approximately given by\n   \n   noise bits = natural logarithm (quantize level) / natural log (2)\n   \n   This result is rounded to the nearest integer.\n*/\n    double qlevel;\n\n    qlevel = (fptr->Fptr)->request_quantize_level;\n\n    if (qlevel > 0. && qlevel < 65537. )\n         *noisebits =  (int) ((log(qlevel) / log(2.0)) + 0.5);\n    else \n        *noisebits = 0;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_get_quantize_level(fitsfile *fptr,  /* I - FITS file pointer   */\n           float *qlevel,       /* quantize level parameter value       */\n           int *status)         /* IO - error status                */\n{\n/*\n   This routine returns the value of the noice_bits parameter that\n   should be used when compressing floating point images.  The image is\n   divided into tiles, and each tile is compressed and stored in a row\n   of at variable length binary table column.\n*/\n\n    if ((fptr->Fptr)->request_quantize_level == NO_QUANTIZE) {\n      *qlevel = 0;\n    } else {\n      *qlevel = (fptr->Fptr)->request_quantize_level;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_get_dither_seed(fitsfile *fptr,  /* I - FITS file pointer   */\n           int *offset,       /* dithering offset parameter value       */\n           int *status)         /* IO - error status                */\n{\n/*\n   This routine returns the value of the dithering offset parameter that\n   is used when compressing floating point images.  The image is\n   divided into tiles, and each tile is compressed and stored in a row\n   of at variable length binary table column.\n*/\n\n    *offset = (fptr->Fptr)->request_dither_seed;\n    return(*status);\n}/*--------------------------------------------------------------------------*/\nint fits_get_hcomp_scale(fitsfile *fptr,  /* I - FITS file pointer   */\n           float *scale,          /* Hcompress scale parameter value       */\n           int *status)         /* IO - error status                */\n\n{\n/*\n   This routine returns the value of the noice_bits parameter that\n   should be used when compressing floating point images.  The image is\n   divided into tiles, and each tile is compressed and stored in a row\n   of at variable length binary table column.\n*/\n\n    *scale = (fptr->Fptr)->request_hcomp_scale;\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_get_hcomp_smooth(fitsfile *fptr,  /* I - FITS file pointer   */\n           int *smooth,          /* Hcompress smooth parameter value       */\n           int *status)         /* IO - error status                */\n\n{\n    *smooth = (fptr->Fptr)->request_hcomp_smooth;\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_img_compress(fitsfile *infptr, /* pointer to image to be compressed */\n                 fitsfile *outfptr, /* empty HDU for output compressed image */\n                 int *status)       /* IO - error status               */\n\n/*\n   This routine initializes the output table, copies all the keywords,\n   and  loops through the input image, compressing the data and\n   writing the compressed tiles to the output table.\n   \n   This is a high level routine that is called by the fpack and funpack\n   FITS compression utilities.\n*/\n{\n    int bitpix, naxis;\n    long naxes[MAX_COMPRESS_DIM];\n/*    int c1, c2, c3; */\n\n    if (*status > 0)\n        return(*status);\n\n\n    /* get datatype and size of input image */\n    if (fits_get_img_param(infptr, MAX_COMPRESS_DIM, &bitpix, \n                       &naxis, naxes, status) > 0)\n        return(*status);\n\n    if (naxis < 1 || naxis > MAX_COMPRESS_DIM)\n    {\n        ffpmsg(\"Image cannot be compressed: NAXIS out of range\");\n        return(*status = BAD_NAXIS);\n    }\n\n    /* create a new empty HDU in the output file now, before setting the */\n    /* compression preferences.  This HDU will become a binary table that */\n    /* contains the compressed image.  If necessary, create a dummy primary */\n    /* array, which much precede the binary table extension. */\n    \n    ffcrhd(outfptr, status);  /* this does nothing if the output file is empty */\n\n    if ((outfptr->Fptr)->curhdu == 0)  /* have to create dummy primary array */\n    {\n       ffcrim(outfptr, 16, 0, NULL, status);\n       ffcrhd(outfptr, status);\n    } else {\n        /* unset any compress parameter preferences that may have been\n           set when closing the previous HDU in the output file */\n        fits_unset_compression_param(outfptr, status);\n    }\n    \n    /* set any compress parameter preferences as given in the input file */\n    fits_set_compression_pref(infptr, outfptr, status);\n\n    /* special case: the quantization level is not given by a keyword in  */\n    /* the HDU header, so we have to explicitly copy the requested value */\n    /* to the actual value */\n/* do this in imcomp_get_compressed_image_par, instead\n    if ( (outfptr->Fptr)->request_quantize_level != 0.)\n        (outfptr->Fptr)->quantize_level = (outfptr->Fptr)->request_quantize_level;\n*/\n    /* if requested, treat integer images same as a float image. */\n    /* Then the pixels will be quantized (lossy algorithm) to achieve */\n    /* higher amounts of compression than with lossless algorithms */\n\n    if ( (outfptr->Fptr)->request_lossy_int_compress != 0  && bitpix > 0) \n\tbitpix = FLOAT_IMG;  /* compress integer images as if float */\n\n    /* initialize output table */\n    if (imcomp_init_table(outfptr, bitpix, naxis, naxes, 0, status) > 0)\n        return (*status);    \n\n    /* Copy the image header keywords to the table header. */\n    if (imcomp_copy_img2comp(infptr, outfptr, status) > 0)\n\t    return (*status);\n\n    /* turn off any intensity scaling (defined by BSCALE and BZERO */\n    /* keywords) so that unscaled values will be read by CFITSIO */\n    /* (except if quantizing an int image, same as a float image) */\n    if ( (outfptr->Fptr)->request_lossy_int_compress == 0 && bitpix > 0) \n        ffpscl(infptr, 1.0, 0.0, status);\n\n    /* force a rescan of the output file keywords, so that */\n    /* the compression parameters will be copied to the internal */\n    /* fitsfile structure used by CFITSIO */\n    ffrdef(outfptr, status);\n\n    /* turn off any intensity scaling (defined by BSCALE and BZERO */\n    /* keywords) so that unscaled values will be written by CFITSIO */\n    /* (except if quantizing an int image, same as a float image) */\n    if ( (outfptr->Fptr)->request_lossy_int_compress == 0 && bitpix > 0) \n        ffpscl(outfptr, 1.0, 0.0, status);\n\n    /* Read each image tile, compress, and write to a table row. */\n    imcomp_compress_image (infptr, outfptr, status);\n\n    /* force another rescan of the output file keywords, to */\n    /* update PCOUNT and TFORMn = '1PB(iii)' keyword values. */\n    ffrdef(outfptr, status);\n\n    /* unset any previously set compress parameter preferences */\n    fits_unset_compression_request(outfptr, status);\n\n/*\n    fits_get_case(&c1, &c2, &c3);\n    printf(\"c1, c2, c3 = %d, %d, %d\\n\", c1, c2, c3); \n*/\n\n    return (*status);\n}\n/*--------------------------------------------------------------------------*/\nint imcomp_init_table(fitsfile *outfptr,\n        int inbitpix,\n        int naxis,\n        long *naxes,\n\tint writebitpix,    /* write the ZBITPIX, ZNAXIS, and ZNAXES keyword? */\n        int *status)\n/* \n  create a BINTABLE extension for the output compressed image.\n*/\n{\n    char keyname[FLEN_KEYWORD], zcmptype[12];\n    int ii,  remain,  ndiv, addToDim, ncols, bitpix;\n    long nrows;\n    char *ttype[] = {\"COMPRESSED_DATA\", \"ZSCALE\", \"ZZERO\"};\n    char *tform[3];\n    char tf0[4], tf1[4], tf2[4];\n    char *tunit[] = {\"\\0\",            \"\\0\",            \"\\0\"  };\n    char comm[FLEN_COMMENT];\n    long actual_tilesize[MAX_COMPRESS_DIM]; /* Actual size to use for tiles */\n    int is_primary=0; /* Is this attempting to write to the primary? */\n    int nQualifyDims=0; /* For Hcompress, number of image dimensions with required pixels. */\n    int noHigherDims=1; /* Set to true if all tile dims other than x are size 1. */\n    int firstDim=-1, secondDim=-1; /* Indices of first and second tiles dimensions\n                                with width > 1 */\n    \n    if (*status > 0)\n        return(*status);\n\n    /* check for special case of losslessly compressing floating point */\n    /* images.  Only compression algorithm that supports this is GZIP */\n    if ( (inbitpix < 0) && ((outfptr->Fptr)->request_quantize_level == NO_QUANTIZE) ) {\n       if (((outfptr->Fptr)->request_compress_type != GZIP_1) &&\n           ((outfptr->Fptr)->request_compress_type != GZIP_2)) {\n         ffpmsg(\"Lossless compression of floating point images must use GZIP (imcomp_init_table)\");\n         return(*status = DATA_COMPRESSION_ERR);\n       }\n    }\n \n     /* set default compression parameter values, if undefined */\n    \n    if ( (outfptr->Fptr)->request_compress_type == 0) {\n\t/* use RICE_1 by default */\n\t(outfptr->Fptr)->request_compress_type = RICE_1;\n    }\n\n    if (inbitpix < 0 && (outfptr->Fptr)->request_quantize_level != NO_QUANTIZE) {  \n\t/* set defaults for quantizing floating point images */\n\tif ( (outfptr->Fptr)->request_quantize_method == 0) {\n\t      /* set default dithering method */\n              (outfptr->Fptr)->request_quantize_method = SUBTRACTIVE_DITHER_1;\n\t}\n\n\tif ( (outfptr->Fptr)->request_quantize_level == 0) {\n\t    if ((outfptr->Fptr)->request_quantize_method == NO_DITHER) {\n\t        /* must use finer quantization if no dithering is done */\n\t        (outfptr->Fptr)->request_quantize_level = 16; \n\t    } else {\n\t        (outfptr->Fptr)->request_quantize_level = 4; \n\t    }\n        }\n    }\n\n    /* special case: the quantization level is not given by a keyword in  */\n    /* the HDU header, so we have to explicitly copy the requested value */\n    /* to the actual value */\n/* do this in imcomp_get_compressed_image_par, instead\n    if ( (outfptr->Fptr)->request_quantize_level != 0.)\n        (outfptr->Fptr)->quantize_level = (outfptr->Fptr)->request_quantize_level;\n*/\n    /* test for the 2 special cases that represent unsigned integers */\n    if (inbitpix == USHORT_IMG)\n        bitpix = SHORT_IMG;\n    else if (inbitpix == ULONG_IMG)\n        bitpix = LONG_IMG;\n    else if (inbitpix == SBYTE_IMG)\n        bitpix = BYTE_IMG;\n    else \n        bitpix = inbitpix;\n\n    /* reset default tile dimensions too if required */\n    memcpy(actual_tilesize, outfptr->Fptr->request_tilesize, MAX_COMPRESS_DIM * sizeof(long));\n\n    if ((outfptr->Fptr)->request_compress_type == HCOMPRESS_1) {\n         \n         /* Tiles must ultimately have 2 (and only 2) dimensions, each with\n             at least 4 pixels. First catch the case where the image\n             itself won't allow this. */\n         if (naxis < 2 ) {\n            ffpmsg(\"Hcompress cannot be used with 1-dimensional images (imcomp_init_table)\");\n            return(*status = DATA_COMPRESSION_ERR);\n\t }\n         for (ii=0; ii<naxis; ii++)\n         {\n            if (naxes[ii] >= 4)\n               ++nQualifyDims;\n         }\n         if (nQualifyDims < 2)\n         {\n            ffpmsg(\"Hcompress minimum image dimension is 4 pixels (imcomp_init_table)\");\n            return(*status = DATA_COMPRESSION_ERR);            \n         }\n\n         /* Handle 2 special cases for backwards compatibility.\n            1) If both X and Y tile dims are set to full size, ignore\n               any other requested dimensions and just set their sizes to 1. \n            2) If X is full size and all the rest are size 1, attempt to\n               find a reasonable size for Y. All other 1-D tile specifications\n               will be rejected. */\n         for (ii=1; ii<naxis; ++ii)\n            if (actual_tilesize[ii] != 0 && actual_tilesize[ii] != 1)\n            {\n               noHigherDims = 0;\n               break;\n            }\n\n         if ((actual_tilesize[0] <= 0) &&\n             (actual_tilesize[1] == -1) ){\n\t     \n\t    /* compress the whole image as a single tile */\n             actual_tilesize[0] = naxes[0];\n             actual_tilesize[1] = naxes[1];\n\n              for (ii = 2; ii < naxis; ii++) {\n\t             /* set all higher tile dimensions = 1 */\n                     actual_tilesize[ii] = 1;\n\t      }\n\n         } else if ((actual_tilesize[0] <= 0) && noHigherDims) {\n\t     \n             /*\n              The Hcompress algorithm is inherently 2D in nature, so the row by row\n\t      tiling that is used for other compression algorithms is not appropriate.\n\t      If the image has less than 30 rows, then the entire image will be compressed\n\t      as a single tile.  Otherwise the tiles will consist of 16 rows of the image. \n\t      This keeps the tiles to a reasonable size, and it also includes enough rows\n\t      to allow good compression efficiency.  If the last tile of the image \n\t      happens to contain less than 4 rows, then find another tile size with\n\t      between 14 and 30 rows (preferably even), so that the last tile has \n\t      at least 4 rows\n\t     */ \n\t      \n             /* 1st tile dimension is the row length of the image */\n             actual_tilesize[0] = naxes[0];\n\n              if (naxes[1] <= 30) {  /* use whole image if it is small */\n                   actual_tilesize[1] = naxes[1];\n\t      } else {\n                /* look for another good tile dimension */\n\t          if        (naxes[1] % 16 == 0 || naxes[1] % 16 > 3) {\n                      actual_tilesize[1] = 16;\n\t\t  } else if (naxes[1] % 24 == 0 || naxes[1] % 24 > 3) {\n                      actual_tilesize[1] = 24;\n\t\t  } else if (naxes[1] % 20 == 0 || naxes[1] % 20 > 3) {\n                      actual_tilesize[1] = 20;\n\t\t  } else if (naxes[1] % 30 == 0 || naxes[1] % 30 > 3) {\n                      actual_tilesize[1] = 30;\n\t\t  } else if (naxes[1] % 28 == 0 || naxes[1] % 28 > 3) {\n                      actual_tilesize[1] = 28;\n\t\t  } else if (naxes[1] % 26 == 0 || naxes[1] % 26 > 3) {\n                      actual_tilesize[1] = 26;\n\t\t  } else if (naxes[1] % 22 == 0 || naxes[1] % 22 > 3) {\n                      actual_tilesize[1] = 22;\n\t\t  } else if (naxes[1] % 18 == 0 || naxes[1] % 18 > 3) {\n                      actual_tilesize[1] = 18;\n\t\t  } else if (naxes[1] % 14 == 0 || naxes[1] % 14 > 3) {\n                      actual_tilesize[1] = 14;\n\t\t  } else  {\n                      actual_tilesize[1] = 17;\n\t\t  }\n\t      }\n        } else {\n           if (actual_tilesize[0] <= 0)\n              actual_tilesize[0] = naxes[0];\n           for (ii=1; ii<naxis; ++ii)\n           {\n              if (actual_tilesize[ii] < 0)\n                 actual_tilesize[ii] = naxes[ii];\n              else if (actual_tilesize[ii] == 0)\n                 actual_tilesize[ii] = 1;\n           }\n        }\n        \n        for (ii=0; ii<naxis; ++ii)\n        {\n           if (actual_tilesize[ii] > 1)\n           {\n              if (firstDim < 0)\n                 firstDim = ii;\n              else if (secondDim < 0)\n                 secondDim = ii;\n              else\n              {\n                 ffpmsg(\"Hcompress tiles can only have 2 dimensions (imcomp_init_table)\");\n                 return(*status = DATA_COMPRESSION_ERR);\n              }\n           }\n        }\n        if (firstDim < 0 || secondDim < 0)\n        {\n            ffpmsg(\"Hcompress tiles must have 2 dimensions (imcomp_init_table)\");\n            return(*status = DATA_COMPRESSION_ERR);\n        }\n        \n        if (actual_tilesize[firstDim] < 4 || actual_tilesize[secondDim] < 4)\n        {\n           ffpmsg(\"Hcompress minimum tile dimension is 4 pixels (imcomp_init_table)\");\n           return (*status = DATA_COMPRESSION_ERR);\n        }\n\t\n        /* check if requested tile size causes the last tile to to have less than 4 pixels */\n        remain = naxes[firstDim] % (actual_tilesize[firstDim]);  /* 1st dimension */\n        if (remain > 0 && remain < 4) {\n            ndiv = naxes[firstDim]/actual_tilesize[firstDim]; /* integer truncation is intentional */\n            addToDim = ceil((double)remain/ndiv);\n            (actual_tilesize[firstDim]) += addToDim; /* increase tile size */\n\t   \n            remain = naxes[firstDim] % (actual_tilesize[firstDim]);\n            if (remain > 0 && remain < 4) {\n                ffpmsg(\"Last tile along 1st dimension has less than 4 pixels (imcomp_init_table)\");\n                return(*status = DATA_COMPRESSION_ERR);\t\n            }        \n        }\n\n        remain = naxes[secondDim] % (actual_tilesize[secondDim]);  /* 2nd dimension */\n        if (remain > 0 && remain < 4) {\n            ndiv = naxes[secondDim]/actual_tilesize[secondDim]; /* integer truncation is intentional */\n            addToDim = ceil((double)remain/ndiv);\n            (actual_tilesize[secondDim]) += addToDim; /* increase tile size */\n\t   \n            remain = naxes[secondDim] % (actual_tilesize[secondDim]);\n            if (remain > 0 && remain < 4) {\n                ffpmsg(\"Last tile along 2nd dimension has less than 4 pixels (imcomp_init_table)\");\n                return(*status = DATA_COMPRESSION_ERR);\t\n            }        \n        }\n\n    } /* end, if HCOMPRESS_1 */\n    \n    for (ii = 0; ii < naxis; ii++) {\n\tif (ii == 0) { /* first axis is different */\n\t    if (actual_tilesize[ii] <= 0) {\n                actual_tilesize[ii] = naxes[ii]; \n\t    }\n\t} else {\n\t    if (actual_tilesize[ii] < 0) {\n                actual_tilesize[ii] = naxes[ii];  /* negative value maean use whole length */\n\t    } else if (actual_tilesize[ii] == 0) {\n                actual_tilesize[ii] = 1;  /* zero value means use default value = 1 */\n\t    }\n\t}\n    }\n\n    /* ---- set up array of TFORM strings -------------------------------*/\n    if ( (outfptr->Fptr)->request_huge_hdu != 0) {\n        strcpy(tf0, \"1QB\");\n    } else {\n        strcpy(tf0, \"1PB\");\n    }\n    strcpy(tf1, \"1D\");\n    strcpy(tf2, \"1D\");\n\n    tform[0] = tf0;\n    tform[1] = tf1;\n    tform[2] = tf2;\n\n    /* calculate number of rows in output table */\n    nrows = 1;\n    for (ii = 0; ii < naxis; ii++)\n    {\n        nrows = nrows * ((naxes[ii] - 1)/ (actual_tilesize[ii]) + 1);\n    }\n\n    /* determine the default  number of columns in the output table */\n    if (bitpix < 0 && (outfptr->Fptr)->request_quantize_level != NO_QUANTIZE)  \n        ncols = 3;  /* quantized and scaled floating point image */\n    else\n        ncols = 1; /* default table has just one 'COMPRESSED_DATA' column */\n\n    if ((outfptr->Fptr)->request_compress_type == RICE_1)\n    {\n        strcpy(zcmptype, \"RICE_1\");\n    }\n    else if ((outfptr->Fptr)->request_compress_type == GZIP_1)\n    {\n        strcpy(zcmptype, \"GZIP_1\");\n    }\n    else if ((outfptr->Fptr)->request_compress_type == GZIP_2)\n    {\n        strcpy(zcmptype, \"GZIP_2\");\n    }\n    else if ((outfptr->Fptr)->request_compress_type == BZIP2_1)\n    {\n        strcpy(zcmptype, \"BZIP2_1\");\n    }\n    else if ((outfptr->Fptr)->request_compress_type == PLIO_1)\n    {\n        strcpy(zcmptype, \"PLIO_1\");\n       /* the PLIO compression algorithm outputs short integers, not bytes */\n        if ( (outfptr->Fptr)->request_huge_hdu != 0) {\n            strcpy(tform[0], \"1QI\");\n        } else {\n            strcpy(tform[0], \"1PI\");\n        }\n    }\n    else if ((outfptr->Fptr)->request_compress_type == HCOMPRESS_1)\n    {\n        strcpy(zcmptype, \"HCOMPRESS_1\");\n    }\n    else if ((outfptr->Fptr)->request_compress_type == NOCOMPRESS)\n    {\n        strcpy(zcmptype, \"NOCOMPRESS\");\n    }    \n    else\n    {\n        ffpmsg(\"unknown compression type (imcomp_init_table)\");\n        return(*status = DATA_COMPRESSION_ERR);\n    }\n\n    /* If attempting to write compressed image to primary, the\n       call to ffcrtb will increment Fptr->curhdu to 1.  Therefore\n       we need to test now for setting is_primary */\n    is_primary = (outfptr->Fptr->curhdu == 0);\n    /* create the bintable extension to contain the compressed image */\n    ffcrtb(outfptr, BINARY_TBL, nrows, ncols, ttype, \n                tform, tunit, 0, status);\n\n    /* Add standard header keywords. */\n    ffpkyl (outfptr, \"ZIMAGE\", 1, \n           \"extension contains compressed image\", status);  \n\n    if (writebitpix) {\n        /*  write the keywords defining the datatype and dimensions of */\n\t/*  the uncompressed image.  If not, these keywords will be */\n        /*  copied later from the input uncompressed image  */\n\t\n        if (is_primary)   \n            ffpkyl (outfptr, \"ZSIMPLE\", 1,\n\t\t\t\"file does conform to FITS standard\", status);\n        ffpkyj (outfptr, \"ZBITPIX\", bitpix,\n\t\t\t\"data type of original image\", status);\n        ffpkyj (outfptr, \"ZNAXIS\", naxis,\n\t\t\t\"dimension of original image\", status);\n\n        for (ii = 0;  ii < naxis;  ii++)\n        {\n            snprintf (keyname, FLEN_KEYWORD,\"ZNAXIS%d\", ii+1);\n            ffpkyj (outfptr, keyname, naxes[ii],\n\t\t\t\"length of original image axis\", status);\n        }\n    }\n                      \n    for (ii = 0;  ii < naxis;  ii++)\n    {\n        snprintf (keyname, FLEN_KEYWORD,\"ZTILE%d\", ii+1);\n        ffpkyj (outfptr, keyname, actual_tilesize[ii],\n\t\t\t\"size of tiles to be compressed\", status);\n    }\n\n    if (bitpix < 0) {\n       \n\tif ((outfptr->Fptr)->request_quantize_level == NO_QUANTIZE) {\n\t    ffpkys(outfptr, \"ZQUANTIZ\", \"NONE\", \n\t      \"Lossless compression without quantization\", status);\n\t} else {\n\t    \n\t    /* Unless dithering has been specifically turned off by setting */\n\t    /* request_quantize_method = -1, use dithering by default */\n\t    /* when quantizing floating point images. */\n\t\n\t    if ( (outfptr->Fptr)->request_quantize_method == 0) \n              (outfptr->Fptr)->request_quantize_method = SUBTRACTIVE_DITHER_1;\n       \n\t    if ((outfptr->Fptr)->request_quantize_method == SUBTRACTIVE_DITHER_1) {\n\t      ffpkys(outfptr, \"ZQUANTIZ\", \"SUBTRACTIVE_DITHER_1\", \n\t        \"Pixel Quantization Algorithm\", status);\n\n\t      /* also write the associated ZDITHER0 keyword with a default value */\n\t      /* which may get updated later. */\n              ffpky(outfptr, TINT, \"ZDITHER0\", &((outfptr->Fptr)->request_dither_seed), \n\t       \"dithering offset when quantizing floats\", status);\n \n            } else if ((outfptr->Fptr)->request_quantize_method == SUBTRACTIVE_DITHER_2) {\n\t      ffpkys(outfptr, \"ZQUANTIZ\", \"SUBTRACTIVE_DITHER_2\", \n\t        \"Pixel Quantization Algorithm\", status);\n\n\t      /* also write the associated ZDITHER0 keyword with a default value */\n\t      /* which may get updated later. */\n              ffpky(outfptr, TINT, \"ZDITHER0\", &((outfptr->Fptr)->request_dither_seed), \n\t       \"dithering offset when quantizing floats\", status);\n\n\t      if (!strcmp(zcmptype, \"RICE_1\"))  {\n\t        /* when using this new dithering method, change the compression type */\n\t\t/* to an alias, so that old versions of funpack will not be able to */\n\t\t/* created a corrupted uncompressed image. */\n\t\t/* ******* can remove this cludge after about June 2015, after most old versions of fpack are gone */\n        \tstrcpy(zcmptype, \"RICE_ONE\");\n\t      }\n\n            } else if ((outfptr->Fptr)->request_quantize_method == NO_DITHER) {\n\t      ffpkys(outfptr, \"ZQUANTIZ\", \"NO_DITHER\", \n\t        \"No dithering during quantization\", status);\n\t    }\n\n\t}\n    }\n\n    ffpkys (outfptr, \"ZCMPTYPE\", zcmptype,\n\t          \"compression algorithm\", status);\n\n    /* write any algorithm-specific keywords */\n    if ((outfptr->Fptr)->request_compress_type == RICE_1)\n    {\n        ffpkys (outfptr, \"ZNAME1\", \"BLOCKSIZE\",\n            \"compression block size\", status);\n\n        /* for now at least, the block size is always 32 */\n        ffpkyj (outfptr, \"ZVAL1\", 32,\n\t\t\t\"pixels per block\", status);\n\n        ffpkys (outfptr, \"ZNAME2\", \"BYTEPIX\",\n            \"bytes per pixel (1, 2, 4, or 8)\", status);\n\n        if (bitpix == BYTE_IMG)\n            ffpkyj (outfptr, \"ZVAL2\", 1,\n\t\t\t\"bytes per pixel (1, 2, 4, or 8)\", status);\n        else if (bitpix == SHORT_IMG)\n            ffpkyj (outfptr, \"ZVAL2\", 2,\n\t\t\t\"bytes per pixel (1, 2, 4, or 8)\", status);\n        else \n            ffpkyj (outfptr, \"ZVAL2\", 4,\n\t\t\t\"bytes per pixel (1, 2, 4, or 8)\", status);\n\n    }\n    else if ((outfptr->Fptr)->request_compress_type == HCOMPRESS_1)\n    {\n        ffpkys (outfptr, \"ZNAME1\", \"SCALE\",\n            \"HCOMPRESS scale factor\", status);\n        ffpkye (outfptr, \"ZVAL1\", (outfptr->Fptr)->request_hcomp_scale,\n\t\t7, \"HCOMPRESS scale factor\", status);\n\n        ffpkys (outfptr, \"ZNAME2\", \"SMOOTH\",\n            \"HCOMPRESS smooth option\", status);\n        ffpkyj (outfptr, \"ZVAL2\", (long) (outfptr->Fptr)->request_hcomp_smooth,\n\t\t\t\"HCOMPRESS smooth option\", status);\n    }\n\n    /* Write the BSCALE and BZERO keywords, if an unsigned integer image */\n    if (inbitpix == USHORT_IMG)\n    {\n        strcpy(comm, \"offset data range to that of unsigned short\");\n        ffpkyg(outfptr, \"BZERO\", 32768., 0, comm, status);\n        strcpy(comm, \"default scaling factor\");\n        ffpkyg(outfptr, \"BSCALE\", 1.0, 0, comm, status);\n    }\n    else if (inbitpix == SBYTE_IMG)\n    {\n        strcpy(comm, \"offset data range to that of signed byte\");\n        ffpkyg(outfptr, \"BZERO\", -128., 0, comm, status);\n        strcpy(comm, \"default scaling factor\");\n        ffpkyg(outfptr, \"BSCALE\", 1.0, 0, comm, status);\n    }\n    else if (inbitpix == ULONG_IMG)\n    {\n        strcpy(comm, \"offset data range to that of unsigned long\");\n        ffpkyg(outfptr, \"BZERO\", 2147483648., 0, comm, status);\n        strcpy(comm, \"default scaling factor\");\n        ffpkyg(outfptr, \"BSCALE\", 1.0, 0, comm, status);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint imcomp_calc_max_elem (int comptype, int nx, int zbitpix, int blocksize)\n\n/* This function returns the maximum number of bytes in a compressed\n   image line.\n\n    nx = maximum number of pixels in a tile\n    blocksize is only relevant for RICE compression\n*/\n{    \n    if (comptype == RICE_1)\n    {\n        if (zbitpix == 16)\n            return (sizeof(short) * nx + nx / blocksize + 2 + 4);\n\telse\n            return (sizeof(float) * nx + nx / blocksize + 2 + 4);\n    }\n    else if ((comptype == GZIP_1) || (comptype == GZIP_2))\n    {\n        /* gzip usually compressed by at least a factor of 2 for I*4 images */\n        /* and somewhat less for I*2 images */\n        /* If this size turns out to be too small, then the gzip */\n        /* compression routine will allocate more space as required */\n        /* to be on the safe size, allocate buffer same size as input */\n\t\n        if (zbitpix == 16)\n            return(nx * 2);\n\telse if (zbitpix == 8)\n            return(nx);\n\telse\n            return(nx * 4);\n    }\n    else if (comptype == BZIP2_1)\n    {\n        /* To guarantee that the compressed data will fit, allocate an output\n\t   buffer of size 1% larger than the uncompressed data, plus 600 bytes */\n\n            return((int) (nx * 1.01 * zbitpix / 8. + 601.));\n    }\n     else if (comptype == HCOMPRESS_1)\n    {\n        /* Imperical evidence suggests in the worst case, \n\t   the compressed stream could be up to 10% larger than the original\n\t   image.  Add 26 byte overhead, only significant for very small tiles\n\t   \n         Possible improvement: may need to allow a larger size for 32-bit images */\n\n        if (zbitpix == 16 || zbitpix == 8)\n\t\n            return( (int) (nx * 2.2 + 26));   /* will be compressing 16-bit int array */\n        else\n            return( (int) (nx * 4.4 + 26));   /* will be compressing 32-bit int array */\n    }\n    else\n        return(nx * sizeof(int));\n}\n/*--------------------------------------------------------------------------*/\nint imcomp_compress_image (fitsfile *infptr, fitsfile *outfptr, int *status)\n\n/* This routine does the following:\n        - reads an image one tile at a time\n        - if it is a float or double image, then it tries to quantize the pixels\n          into scaled integers.\n        - it then compressess the integer pixels, or if the it was not\n\t  possible to quantize the floating point pixels, then it losslessly\n\t  compresses them with gzip\n\t- writes the compressed byte stream to the output FITS file\n*/\n{\n    double *tiledata;\n    int anynul, gotnulls = 0, datatype;\n    long ii, row;\n    int naxis;\n    double dummy = 0., dblnull = DOUBLENULLVALUE;\n    float fltnull = FLOATNULLVALUE;\n    long maxtilelen, tilelen, incre[] = {1, 1, 1, 1, 1, 1};\n    long naxes[MAX_COMPRESS_DIM], fpixel[MAX_COMPRESS_DIM];\n    long lpixel[MAX_COMPRESS_DIM], tile[MAX_COMPRESS_DIM];\n    long tilesize[MAX_COMPRESS_DIM];\n    long i0, i1, i2, i3, i4, i5, trowsize, ntrows;\n    char card[FLEN_CARD];\n\n    if (*status > 0)\n        return(*status);\n\n    maxtilelen = (outfptr->Fptr)->maxtilelen;\n\n    /* \n     Allocate buffer to hold 1 tile of data; size depends on which compression \n     algorithm is used:\n\n      Rice and GZIP will compress byte, short, or int arrays without conversion.\n      PLIO requires 4-byte int values, so byte and short arrays must be converted to int.\n      HCompress internally converts byte or short values to ints, and\n         converts int values to 8-byte longlong integers.\n    */\n    \n    if ((outfptr->Fptr)->zbitpix == FLOAT_IMG)\n    {\n        datatype = TFLOAT;\n\n        if ( (outfptr->Fptr)->compress_type == HCOMPRESS_1) {\n\t    /* need twice as much scratch space (8 bytes per pixel) */\n            tiledata = (double*) malloc (maxtilelen * 2 *sizeof (float));\t\n\t} else {\n            tiledata = (double*) malloc (maxtilelen * sizeof (float));\n\t}\n    }\n    else if ((outfptr->Fptr)->zbitpix == DOUBLE_IMG)\n    {\n        datatype = TDOUBLE;\n        tiledata = (double*) malloc (maxtilelen * sizeof (double));\n    }\n    else if ((outfptr->Fptr)->zbitpix == SHORT_IMG)\n    {\n        datatype = TSHORT;\n        if ( (outfptr->Fptr)->compress_type == RICE_1  ||\n\t     (outfptr->Fptr)->compress_type == GZIP_1  ||\n\t     (outfptr->Fptr)->compress_type == GZIP_2  ||\n\t     (outfptr->Fptr)->compress_type == BZIP2_1 ||\n             (outfptr->Fptr)->compress_type == NOCOMPRESS) {\n\t    /* only need  buffer of I*2 pixels for gzip, bzip2, and Rice */\n\n            tiledata = (double*) malloc (maxtilelen * sizeof (short));\t\n\t} else {\n \t    /*  need  buffer of I*4 pixels for Hcompress and PLIO */\n            tiledata = (double*) malloc (maxtilelen * sizeof (int));\n        }\n    }\n    else if ((outfptr->Fptr)->zbitpix == BYTE_IMG)\n    {\n\n        datatype = TBYTE;\n        if ( (outfptr->Fptr)->compress_type == RICE_1  ||\n\t     (outfptr->Fptr)->compress_type == BZIP2_1 ||\n\t     (outfptr->Fptr)->compress_type == GZIP_1  ||\n\t     (outfptr->Fptr)->compress_type == GZIP_2) {\n\t    /* only need  buffer of I*1 pixels for gzip, bzip2, and Rice */\n\n            tiledata = (double*) malloc (maxtilelen);\t\n\t} else {\n \t    /*  need  buffer of I*4 pixels for Hcompress and PLIO */\n            tiledata = (double*) malloc (maxtilelen * sizeof (int));\n        }\n    }\n    else if ((outfptr->Fptr)->zbitpix == LONG_IMG)\n    {\n        datatype = TINT;\n        if ( (outfptr->Fptr)->compress_type == HCOMPRESS_1) {\n\t    /* need twice as much scratch space (8 bytes per pixel) */\n\n            tiledata = (double*) malloc (maxtilelen * 2 * sizeof (int));\t\n\t} else {\n \t    /* only need  buffer of I*4 pixels for gzip, bzip2,  Rice, and PLIO */\n\n            tiledata = (double*) malloc (maxtilelen * sizeof (int));\n        }\n    }\n    else\n    {\n\tffpmsg(\"Bad image datatype. (imcomp_compress_image)\");\n\treturn (*status = MEMORY_ALLOCATION);\n    }\n    \n    if (tiledata == NULL)\n    {\n\tffpmsg(\"Out of memory. (imcomp_compress_image)\");\n\treturn (*status = MEMORY_ALLOCATION);\n    }\n\n    /*  calculate size of tile in each dimension */\n    naxis = (outfptr->Fptr)->zndim;\n    for (ii = 0; ii < MAX_COMPRESS_DIM; ii++)\n    {\n        if (ii < naxis)\n        {\n             naxes[ii] = (outfptr->Fptr)->znaxis[ii];\n             tilesize[ii] = (outfptr->Fptr)->tilesize[ii];\n        }\n        else\n        {\n            naxes[ii] = 1;\n            tilesize[ii] = 1;\n        }\n    }\n    row = 1;\n\n    /* set up big loop over up to 6 dimensions */\n    for (i5 = 1; i5 <= naxes[5]; i5 += tilesize[5])\n    {\n     fpixel[5] = i5;\n     lpixel[5] = minvalue(i5 + tilesize[5] - 1, naxes[5]);\n     tile[5] = lpixel[5] - fpixel[5] + 1;\n     for (i4 = 1; i4 <= naxes[4]; i4 += tilesize[4])\n     {\n      fpixel[4] = i4;\n      lpixel[4] = minvalue(i4 + tilesize[4] - 1, naxes[4]);\n      tile[4] = lpixel[4] - fpixel[4] + 1;\n      for (i3 = 1; i3 <= naxes[3]; i3 += tilesize[3])\n      {\n       fpixel[3] = i3;\n       lpixel[3] = minvalue(i3 + tilesize[3] - 1, naxes[3]);\n       tile[3] = lpixel[3] - fpixel[3] + 1;\n       for (i2 = 1; i2 <= naxes[2]; i2 += tilesize[2])\n       {\n        fpixel[2] = i2;\n        lpixel[2] = minvalue(i2 + tilesize[2] - 1, naxes[2]);\n        tile[2] = lpixel[2] - fpixel[2] + 1;\n        for (i1 = 1; i1 <= naxes[1]; i1 += tilesize[1])\n        {\n         fpixel[1] = i1;\n         lpixel[1] = minvalue(i1 + tilesize[1] - 1, naxes[1]);\n         tile[1] = lpixel[1] - fpixel[1] + 1;\n         for (i0 = 1; i0 <= naxes[0]; i0 += tilesize[0])\n         {\n          fpixel[0] = i0;\n          lpixel[0] = minvalue(i0 + tilesize[0] - 1, naxes[0]);\n          tile[0] = lpixel[0] - fpixel[0] + 1;\n\n          /* number of pixels in this tile */\n          tilelen = tile[0];\n          for (ii = 1; ii < naxis; ii++)\n          {\n             tilelen *= tile[ii];\n          }\n\n          /* read next tile of data from image */\n\t  anynul = 0;\n          if (datatype == TFLOAT)\n          {\n              ffgsve(infptr, 1, naxis, naxes, fpixel, lpixel, incre, \n                  FLOATNULLVALUE, (float *) tiledata,  &anynul, status);\n          }\n          else if (datatype == TDOUBLE)\n          {\n              ffgsvd(infptr, 1, naxis, naxes, fpixel, lpixel, incre, \n                  DOUBLENULLVALUE, tiledata, &anynul, status);\n          }\n          else if (datatype == TINT)\n          {\n              ffgsvk(infptr, 1, naxis, naxes, fpixel, lpixel, incre, \n                  0, (int *) tiledata,  &anynul, status);\n          }\n          else if (datatype == TSHORT)\n          {\n              ffgsvi(infptr, 1, naxis, naxes, fpixel, lpixel, incre, \n                  0, (short *) tiledata,  &anynul, status);\n          }\n          else if (datatype == TBYTE)\n          {\n              ffgsvb(infptr, 1, naxis, naxes, fpixel, lpixel, incre, \n                  0, (unsigned char *) tiledata,  &anynul, status);\n          }\n          else \n          {\n              ffpmsg(\"Error bad datatype of image tile to compress\");\n              free(tiledata);\n              return (*status);\n          }\n\n          /* now compress the tile, and write to row of binary table */\n          /*   NOTE: we don't have to worry about the presence of null values in the\n\t       array if it is an integer array:  the null value is simply encoded\n\t       in the compressed array just like any other pixel value.  \n\t       \n\t       If it is a floating point array, then we need to check for null\n\t       only if the anynul parameter returned a true value when reading the tile\n\t  */\n          \n          /* Collapse sizes of higher dimension tiles into 2 dimensional\n             equivalents needed by the quantizing algorithms for\n             floating point types */\n          fits_calc_tile_rows(lpixel, fpixel, naxis, &trowsize,\n                            &ntrows, status);\n\n          if (anynul && datatype == TFLOAT) {\n              imcomp_compress_tile(outfptr, row, datatype, tiledata, tilelen,\n                               trowsize, ntrows, 1, &fltnull, status);\n          } else if (anynul && datatype == TDOUBLE) {\n              imcomp_compress_tile(outfptr, row, datatype, tiledata, tilelen,\n                               trowsize, ntrows, 1, &dblnull, status);\n          } else {\n              imcomp_compress_tile(outfptr, row, datatype, tiledata, tilelen,\n                               trowsize, ntrows, 0, &dummy, status);\n          }\n\n          /* set flag if we found any null values */\n          if (anynul)\n              gotnulls = 1;\n\n          /* check for any error in the previous operations */\n          if (*status > 0)\n          {\n              ffpmsg(\"Error writing compressed image to table\");\n              free(tiledata);\n              return (*status);\n          }\n\n\t  row++;\n         }\n        }\n       }\n      }\n     }\n    }\n\n    free (tiledata);  /* finished with this buffer */\n\n    /* insert ZBLANK keyword if necessary; only for TFLOAT or TDOUBLE images */\n    if (gotnulls)\n    {\n          ffgcrd(outfptr, \"ZCMPTYPE\", card, status);\n          ffikyj(outfptr, \"ZBLANK\", COMPRESS_NULL_VALUE, \n             \"null value in the compressed integer array\", status);\n    }\n\n    return (*status);\n}\n/*--------------------------------------------------------------------------*/\nint imcomp_compress_tile (fitsfile *outfptr,\n    long row,  /* tile number = row in the binary table that holds the compressed data */\n    int datatype, \n    void *tiledata, \n    long tilelen,\n    long tilenx,\n    long tileny,\n    int nullcheck,\n    void *nullflagval,\n    int *status)\n\n/*\n   This is the main compression routine.\n\n   This routine does the following to the input tile of pixels:\n        - if it is a float or double image, then it quantizes the pixels\n        - compresses the integer pixel values\n        - writes the compressed byte stream to the FITS file.\n\n   If the tile cannot be quantized than the raw float or double values\n   are losslessly compressed with gzip and then written to the output table.\n   \n   This input array may be modified by this routine.  If the array is of type TINT\n   or TFLOAT, and the compression type is HCOMPRESS, then it must have been \n   allocated to be twice as large (8 bytes per pixel) to provide scratch space.\n\n  Note that this routine does not fully support the implicit datatype conversion that\n  is supported when writing to normal FITS images.  The datatype of the input array\n  must have the same datatype (either signed or unsigned) as the output (compressed)\n  FITS image in some cases.\n*/\n{\n    int *idata;\t\t/* quantized integer data */\n    int cn_zblank, zbitpix, nullval;\n    int flag = 1;  /* true by default; only = 0 if float data couldn't be quantized */\n    int intlength;      /* size of integers to be compressed */\n    double scale, zero, actual_bzero;\n    long ii;\n    size_t clen;\t\t/* size of cbuf */\n    short *cbuf;\t/* compressed data */\n    int  nelem = 0;\t\t/* number of bytes */\n    int tilecol;\n    size_t gzip_nelem = 0;\n    unsigned int bzlen;\n    int ihcompscale;\n    float hcompscale;\n    double noise2, noise3, noise5;\n    double bscale[1] = {1.}, bzero[1] = {0.};\t/* scaling parameters */\n    long  hcomp_len;\n    LONGLONG *lldata;\n\n    if (*status > 0)\n        return(*status);\n\n    /* check for special case of losslessly compressing floating point */\n    /* images.  Only compression algorithm that supports this is GZIP */\n    if ( (outfptr->Fptr)->quantize_level == NO_QUANTIZE) {\n       if (((outfptr->Fptr)->compress_type != GZIP_1) &&\n           ((outfptr->Fptr)->compress_type != GZIP_2)) {\n           switch (datatype) {\n            case TFLOAT:\n            case TDOUBLE:\n            case TCOMPLEX:\n            case TDBLCOMPLEX:\n              ffpmsg(\"Lossless compression of floating point images must use GZIP (imcomp_compress_tile)\");\n              return(*status = DATA_COMPRESSION_ERR);\n            default:\n              break;\n          }\n       }\n    }\n\n    /* free the previously saved tile if the input tile is for the same row */\n    if ((outfptr->Fptr)->tilerow) {  /* has the tile cache been allocated? */\n\n      /* calculate the column bin of the compressed tile */\n      tilecol = (row - 1) % ((long)(((outfptr->Fptr)->znaxis[0] - 1) / ((outfptr->Fptr)->tilesize[0])) + 1);\n      \n      if ((outfptr->Fptr)->tilerow[tilecol] == row) {\n        if (((outfptr->Fptr)->tiledata)[tilecol]) {\n            free(((outfptr->Fptr)->tiledata)[tilecol]);\n        }\n\t  \n        if (((outfptr->Fptr)->tilenullarray)[tilecol]) {\n            free(((outfptr->Fptr)->tilenullarray)[tilecol]);\n        }\n\n        ((outfptr->Fptr)->tiledata)[tilecol] = 0;\n        ((outfptr->Fptr)->tilenullarray)[tilecol] = 0;\n        (outfptr->Fptr)->tilerow[tilecol] = 0;\n        (outfptr->Fptr)->tiledatasize[tilecol] = 0;\n        (outfptr->Fptr)->tiletype[tilecol] = 0;\n        (outfptr->Fptr)->tileanynull[tilecol] = 0;\n      }\n    }\n\n    if ( (outfptr->Fptr)->compress_type == NOCOMPRESS) {\n         /* Special case when using NOCOMPRESS for diagnostic purposes in fpack */\n         if (imcomp_write_nocompress_tile(outfptr, row, datatype, tiledata, tilelen, \n\t     nullcheck, nullflagval, status) > 0) {\n             return(*status);\n         }\n         return(*status);\n    }\n\n    /* =========================================================================== */\n    /* initialize various parameters */\n    idata = (int *) tiledata;   /* may overwrite the input tiledata in place */\n\n    /* zbitpix is the BITPIX keyword value in the uncompressed FITS image */\n    zbitpix = (outfptr->Fptr)->zbitpix;\n\n    /* if the tile/image has an integer datatype, see if a null value has */\n    /* been defined (with the BLANK keyword in a normal FITS image).  */\n    /* If so, and if the input tile array also contains null pixels, */\n    /* (represented by pixels that have a value = nullflagval) then  */\n    /* any pixels whose value = nullflagval, must be set to the value = nullval */\n    /* before the pixel array is compressed.  These null pixel values must */\n    /* not be inverse scaled by the BSCALE/BZERO values, if present. */\n\n    cn_zblank = (outfptr->Fptr)->cn_zblank;\n    nullval = (outfptr->Fptr)->zblank;\n\n    if (zbitpix > 0 && cn_zblank != -1)  /* If the integer image has no defined null */\n        nullcheck = 0;    /* value, then don't bother checking input array for nulls. */\n\n    /* if the BSCALE and BZERO keywords exist, then the input values must */\n    /* be inverse scaled by this factor, before the values are compressed. */\n    /* (The program may have turned off scaling, which over rides the keywords) */\n    \n    scale = (outfptr->Fptr)->cn_bscale;\n    zero  = (outfptr->Fptr)->cn_bzero;\n    actual_bzero = (outfptr->Fptr)->cn_actual_bzero;\n\n    /* =========================================================================== */\n    /* prepare the tile of pixel values for compression */\n    if (datatype == TSHORT) {\n       imcomp_convert_tile_tshort(outfptr, tiledata, tilelen, nullcheck, nullflagval,\n           nullval, zbitpix, scale, zero, actual_bzero, &intlength, status);\n    } else if (datatype == TUSHORT) {\n       imcomp_convert_tile_tushort(outfptr, tiledata, tilelen, nullcheck, nullflagval,\n           nullval, zbitpix, scale, zero, &intlength, status);\n    } else if (datatype == TBYTE) {\n       imcomp_convert_tile_tbyte(outfptr, tiledata, tilelen, nullcheck, nullflagval,\n           nullval, zbitpix, scale, zero,  &intlength, status);\n    } else if (datatype == TSBYTE) {\n       imcomp_convert_tile_tsbyte(outfptr, tiledata, tilelen, nullcheck, nullflagval,\n           nullval, zbitpix, scale, zero,  &intlength, status);\n    } else if (datatype == TINT) {\n       imcomp_convert_tile_tint(outfptr, tiledata, tilelen, nullcheck, nullflagval,\n           nullval, zbitpix, scale, zero, &intlength, status);\n    } else if (datatype == TUINT) {\n       imcomp_convert_tile_tuint(outfptr, tiledata, tilelen, nullcheck, nullflagval,\n           nullval, zbitpix, scale, zero, &intlength, status);\n    } else if (datatype == TLONG && sizeof(long) == 8) {\n           ffpmsg(\"Integer*8 Long datatype is not supported when writing to compressed images\");\n           return(*status = BAD_DATATYPE);\n    } else if (datatype == TULONG && sizeof(long) == 8) {\n           ffpmsg(\"Unsigned integer*8 datatype is not supported when writing to compressed images\");\n           return(*status = BAD_DATATYPE);\n    } else if (datatype == TFLOAT) {\n        imcomp_convert_tile_tfloat(outfptr, row, tiledata, tilelen, tilenx, tileny, nullcheck,\n        nullflagval, nullval, zbitpix, scale, zero, &intlength, &flag, bscale, bzero, status);\n    } else if (datatype == TDOUBLE) {\n       imcomp_convert_tile_tdouble(outfptr, row, tiledata, tilelen, tilenx, tileny, nullcheck,\n       nullflagval, nullval, zbitpix, scale, zero, &intlength, &flag, bscale, bzero, status);\n    } else {\n          ffpmsg(\"unsupported image datatype (imcomp_compress_tile)\");\n          return(*status = BAD_DATATYPE);\n    }\n\n    if (*status > 0)\n      return(*status);      /* return if error occurs */\n\n    /* =========================================================================== */\n    if (flag)   /* now compress the integer data array */\n    {\n        /* allocate buffer for the compressed tile bytes */\n        clen = (outfptr->Fptr)->maxelem;\n        cbuf = (short *) calloc (clen, sizeof (unsigned char));\n\n        if (cbuf == NULL) {\n            ffpmsg(\"Memory allocation failure. (imcomp_compress_tile)\");\n\t    return (*status = MEMORY_ALLOCATION);\n        }\n\n        /* =========================================================================== */\n        if ( (outfptr->Fptr)->compress_type == RICE_1)\n        {\n            if (intlength == 2) {\n  \t        nelem = fits_rcomp_short ((short *)idata, tilelen, (unsigned char *) cbuf,\n                       clen, (outfptr->Fptr)->rice_blocksize);\n            } else if (intlength == 1) {\n  \t        nelem = fits_rcomp_byte ((signed char *)idata, tilelen, (unsigned char *) cbuf,\n                       clen, (outfptr->Fptr)->rice_blocksize);\n            } else {\n  \t        nelem = fits_rcomp (idata, tilelen, (unsigned char *) cbuf,\n                       clen, (outfptr->Fptr)->rice_blocksize);\n            }\n\n\t    if (nelem < 0)  /* data compression error condition */\n            {\n\t        free (cbuf);\n                ffpmsg(\"error Rice compressing image tile (imcomp_compress_tile)\");\n                return (*status = DATA_COMPRESSION_ERR);\n            }\n\n\t    /* Write the compressed byte stream. */\n            ffpclb(outfptr, (outfptr->Fptr)->cn_compressed, row, 1,\n                     nelem, (unsigned char *) cbuf, status);\n        }\n\n        /* =========================================================================== */\n        else if ( (outfptr->Fptr)->compress_type == PLIO_1)\n        {\n              for (ii = 0; ii < tilelen; ii++)  {\n                if (idata[ii] < 0 || idata[ii] > 16777215)\n                {\n                   /* plio algorithn only supports positive 24 bit ints */\n                   ffpmsg(\"data out of range for PLIO compression (0 - 2**24)\");\n                   return(*status = DATA_COMPRESSION_ERR);\n                }\n              }\n\n  \t      nelem = pl_p2li (idata, 1, cbuf, tilelen);\n\n\t      if (nelem < 0)  /* data compression error condition */\n              {\n\t        free (cbuf);\n                ffpmsg(\"error PLIO compressing image tile (imcomp_compress_tile)\");\n                return (*status = DATA_COMPRESSION_ERR);\n              }\n\n\t      /* Write the compressed byte stream. */\n              ffpcli(outfptr, (outfptr->Fptr)->cn_compressed, row, 1,\n                     nelem, cbuf, status);\n        }\n\n        /* =========================================================================== */\n        else if ( ((outfptr->Fptr)->compress_type == GZIP_1) ||\n                  ((outfptr->Fptr)->compress_type == GZIP_2) )   {\n\n\t    if ((outfptr->Fptr)->quantize_level == NO_QUANTIZE && datatype == TFLOAT) {\n\t      /* Special case of losslessly compressing floating point pixels with GZIP */\n\t      /* In this case we compress the input tile array directly */\n\n#if BYTESWAPPED\n               ffswap4((int*) tiledata, tilelen); \n#endif\n               if ( (outfptr->Fptr)->compress_type == GZIP_2 )\n\t\t    fits_shuffle_4bytes((char *) tiledata, tilelen, status);\n\n                compress2mem_from_mem((char *) tiledata, tilelen * sizeof(float),\n                    (char **) &cbuf,  &clen, realloc, &gzip_nelem, status);\n\n\t    } else if ((outfptr->Fptr)->quantize_level == NO_QUANTIZE && datatype == TDOUBLE) {\n\t      /* Special case of losslessly compressing double pixels with GZIP */\n\t      /* In this case we compress the input tile array directly */\n\n#if BYTESWAPPED\n               ffswap8((double *) tiledata, tilelen); \n#endif\n               if ( (outfptr->Fptr)->compress_type == GZIP_2 )\n\t\t    fits_shuffle_8bytes((char *) tiledata, tilelen, status);\n\n                compress2mem_from_mem((char *) tiledata, tilelen * sizeof(double),\n                    (char **) &cbuf,  &clen, realloc, &gzip_nelem, status);\n\n\t    } else {\n\n\t        /* compress the integer idata array */\n\n#if BYTESWAPPED\n\t       if (intlength == 2)\n                 ffswap2((short *) idata, tilelen); \n\t       else if (intlength == 4)\n                 ffswap4(idata, tilelen); \n#endif\n\n               if (intlength == 2) {\n\n                  if ( (outfptr->Fptr)->compress_type == GZIP_2 )\n\t\t    fits_shuffle_2bytes((char *) tiledata, tilelen, status);\n\n                  compress2mem_from_mem((char *) idata, tilelen * sizeof(short),\n                   (char **) &cbuf,  &clen, realloc, &gzip_nelem, status);\n\n               } else if (intlength == 1) {\n\n                  compress2mem_from_mem((char *) idata, tilelen * sizeof(unsigned char),\n                   (char **) &cbuf,  &clen, realloc, &gzip_nelem, status);\n\n               } else {\n\n                  if ( (outfptr->Fptr)->compress_type == GZIP_2 )\n\t\t    fits_shuffle_4bytes((char *) tiledata, tilelen, status);\n\n                  compress2mem_from_mem((char *) idata, tilelen * sizeof(int),\n                   (char **) &cbuf,  &clen, realloc, &gzip_nelem, status);\n               }\n            }\n\n\t    /* Write the compressed byte stream. */\n            ffpclb(outfptr, (outfptr->Fptr)->cn_compressed, row, 1,\n                     gzip_nelem, (unsigned char *) cbuf, status);\n\n        /* =========================================================================== */\n        } else if ( (outfptr->Fptr)->compress_type == BZIP2_1) {\n\n#if BYTESWAPPED\n\t   if (intlength == 2)\n               ffswap2((short *) idata, tilelen); \n\t   else if (intlength == 4)\n               ffswap4(idata, tilelen); \n#endif\n\n           bzlen = (unsigned int) clen;\n\t   \n           /* call bzip2 with blocksize = 900K, verbosity = 0, and default workfactor */\n\n/*  bzip2 is not supported in the public release.  This is only for test purposes.\n           if (BZ2_bzBuffToBuffCompress( (char *) cbuf, &bzlen,\n\t         (char *) idata, (unsigned int) (tilelen * intlength), 9, 0, 0) ) \n*/\n\t   {\n                   ffpmsg(\"bzip2 compression error\");\n                   return(*status = DATA_COMPRESSION_ERR);\n           }\n\n\t    /* Write the compressed byte stream. */\n            ffpclb(outfptr, (outfptr->Fptr)->cn_compressed, row, 1,\n                     bzlen, (unsigned char *) cbuf, status);\n\n        /* =========================================================================== */\n        }  else if ( (outfptr->Fptr)->compress_type == HCOMPRESS_1)     {\n\t    /*\n\t      if hcompscale is positive, then we have to multiply\n\t      the value by the RMS background noise to get the \n\t      absolute scale value.  If negative, then it gives the\n\t      absolute scale value directly.\n\t    */\n            hcompscale = (outfptr->Fptr)->hcomp_scale;\n\n\t    if (hcompscale > 0.) {\n\t       fits_img_stats_int(idata, tilenx, tileny, nullcheck,\n\t                nullval, 0,0,0,0,0,0,&noise2,&noise3,&noise5,status);\n\n\t\t/* use the minimum of the 3 noise estimates */\n\t\tif (noise2 != 0. && noise2 < noise3) noise3 = noise2;\n\t\tif (noise5 != 0. && noise5 < noise3) noise3 = noise5;\n\t\t\n\t\thcompscale = (float) (hcompscale * noise3);\n\n\t    } else if (hcompscale < 0.) {\n\n\t\thcompscale = hcompscale * -1.0F;\n\t    }\n\n\t    ihcompscale = (int) (hcompscale + 0.5);\n\n            hcomp_len = clen;  /* allocated size of the buffer */\n\t    \n            if (zbitpix == BYTE_IMG || zbitpix == SHORT_IMG) {\n                fits_hcompress(idata, tilenx, tileny, \n\t\t  ihcompscale, (char *) cbuf, &hcomp_len, status);\n\n            } else {\n                 /* have to convert idata to an I*8 array, in place */\n                 /* idata must have been allocated large enough to do this */\n\n                fits_int_to_longlong_inplace(idata, tilelen, status);\n                lldata = (LONGLONG *) idata;\t\t\n\n                fits_hcompress64(lldata, tilenx, tileny, \n\t\t  ihcompscale, (char *) cbuf, &hcomp_len, status);\n            }\n\n\t    /* Write the compressed byte stream. */\n            ffpclb(outfptr, (outfptr->Fptr)->cn_compressed, row, 1,\n                     hcomp_len, (unsigned char *) cbuf, status);\n        }\n\n        /* =========================================================================== */\n        if ((outfptr->Fptr)->cn_zscale > 0)\n        {\n              /* write the linear scaling parameters for this tile */\n\t      ffpcld (outfptr, (outfptr->Fptr)->cn_zscale, row, 1, 1,\n                      bscale, status);\n\t      ffpcld (outfptr, (outfptr->Fptr)->cn_zzero,  row, 1, 1,\n                      bzero,  status);\n        }\n\n        free(cbuf);  /* finished with this buffer */\n\n    /* =========================================================================== */\n    } else {    /* if flag == 0., floating point data couldn't be quantized */\n\n\t /* losslessly compress the data with gzip. */\n\n         /* if gzip2 compressed data column doesn't exist, create it */\n         if ((outfptr->Fptr)->cn_gzip_data < 1) {\n              if ( (outfptr->Fptr)->request_huge_hdu != 0) {\n                 fits_insert_col(outfptr, 999, \"GZIP_COMPRESSED_DATA\", \"1QB\", status);\n              } else {\n                 fits_insert_col(outfptr, 999, \"GZIP_COMPRESSED_DATA\", \"1PB\", status);\n              }\n\n                 if (*status <= 0)  /* save the number of this column */\n                       ffgcno(outfptr, CASEINSEN, \"GZIP_COMPRESSED_DATA\",\n                                &(outfptr->Fptr)->cn_gzip_data, status);\n         }\n\n         if (datatype == TFLOAT)  {\n               /* allocate buffer for the compressed tile bytes */\n\t       /* make it 10% larger than the original uncompressed data */\n               clen = (size_t) (tilelen * sizeof(float) * 1.1);\n               cbuf = (short *) calloc (clen, sizeof (unsigned char));\n\n               if (cbuf == NULL)\n               {\n                   ffpmsg(\"Memory allocation error. (imcomp_compress_tile)\");\n\t           return (*status = MEMORY_ALLOCATION);\n               }\n\n\t       /* convert null values to NaNs in place, if necessary */\n\t       if (nullcheck == 1) {\n\t           imcomp_float2nan((float *) tiledata, tilelen, (int *) tiledata,\n\t               *(float *) (nullflagval), status);\n\t       }\n\n#if BYTESWAPPED\n               ffswap4((int*) tiledata, tilelen); \n#endif\n               compress2mem_from_mem((char *) tiledata, tilelen * sizeof(float),\n                    (char **) &cbuf,  &clen, realloc, &gzip_nelem, status);\n\n         } else {  /* datatype == TDOUBLE */\n\n               /* allocate buffer for the compressed tile bytes */\n\t       /* make it 10% larger than the original uncompressed data */\n               clen = (size_t) (tilelen * sizeof(double) * 1.1);\n               cbuf = (short *) calloc (clen, sizeof (unsigned char));\n\n               if (cbuf == NULL)\n               {\n                   ffpmsg(\"Memory allocation error. (imcomp_compress_tile)\");\n\t           return (*status = MEMORY_ALLOCATION);\n               }\n\n\t       /* convert null values to NaNs in place, if necessary */\n\t       if (nullcheck == 1) {\n\t           imcomp_double2nan((double *) tiledata, tilelen, (LONGLONG *) tiledata,\n\t               *(double *) (nullflagval), status);\n\t       }\n\n#if BYTESWAPPED\n               ffswap8((double*) tiledata, tilelen); \n#endif\n               compress2mem_from_mem((char *) tiledata, tilelen * sizeof(double),\n                    (char **) &cbuf,  &clen, realloc, &gzip_nelem, status);\n        }\n\n\t/* Write the compressed byte stream. */\n        ffpclb(outfptr, (outfptr->Fptr)->cn_gzip_data, row, 1,\n             gzip_nelem, (unsigned char *) cbuf, status);\n\n        free(cbuf);  /* finished with this buffer */\n    }\n\n    return(*status);\n}\n\n/*--------------------------------------------------------------------------*/\nint imcomp_write_nocompress_tile(fitsfile *outfptr,\n    long row,\n    int datatype, \n    void *tiledata, \n    long tilelen,\n    int nullcheck,\n    void *nullflagval,\n    int *status)\n{\n    char coltype[4];\n\n    /* Write the uncompressed image tile pixels to the tile-compressed image file. */\n    /* This is a special case when using NOCOMPRESS for diagnostic purposes in fpack. */ \n    /* Currently, this only supports a limited number of data types and */\n    /* does not fully support null-valued pixels in the image. */\n\n    if ((outfptr->Fptr)->cn_uncompressed < 1) {\n        /* uncompressed data column doesn't exist, so append new column to table */\n        if (datatype == TSHORT) {\n\t    strcpy(coltype, \"1PI\");\n\t} else if (datatype == TINT) {\n\t    strcpy(coltype, \"1PJ\");\n\t} else if (datatype == TFLOAT) {\n\t    strcpy(coltype, \"1QE\");\n        } else {\n\t    ffpmsg(\"NOCOMPRESSION option only supported for int*2, int*4, and float*4 images\");\n            return(*status = DATA_COMPRESSION_ERR);\n        }\n\n        fits_insert_col(outfptr, 999, \"UNCOMPRESSED_DATA\", coltype, status); /* create column */\n    }\n\n    fits_get_colnum(outfptr, CASEINSEN, \"UNCOMPRESSED_DATA\",\n                    &(outfptr->Fptr)->cn_uncompressed, status);  /* save col. num. */\n    \n    fits_write_col(outfptr, datatype, (outfptr->Fptr)->cn_uncompressed, row, 1,\n                      tilelen, tiledata, status);  /* write the tile data */\n    return (*status);\n}\n /*--------------------------------------------------------------------------*/\nint imcomp_convert_tile_tshort(\n    fitsfile *outfptr,\n    void *tiledata, \n    long tilelen,\n    int nullcheck,\n    void *nullflagval,\n    int nullval,\n    int zbitpix,\n    double scale,\n    double zero,\n    double actual_bzero,\n    int *intlength,\n    int *status)\n{\n    /*  Prepare the input tile array of pixels for compression. */\n    /*  Convert input integer*2 tile array in place to 4 or 8-byte ints for compression, */\n    /*  If needed, convert 4 or 8-byte ints and do null value substitution. */\n    /*  Note that the calling routine must have allocated the input array big enough */\n    /* to be able to do this.  */\n\n    short *sbuff;\n    int flagval, *idata;\n    long ii;\n    \n       /* We only support writing this integer*2 tile data to a FITS image with \n          BITPIX = 16 and with BZERO = 0 and BSCALE = 1.  */\n\t  \n       if (zbitpix != SHORT_IMG || scale != 1.0 || zero != 0.0) {\n           ffpmsg(\"Datatype conversion/scaling is not supported when writing to compressed images\");\n           return(*status = DATA_COMPRESSION_ERR);\n       } \n\n       sbuff = (short *) tiledata;\n       idata = (int *) tiledata;\n       \n       if ( (outfptr->Fptr)->compress_type == RICE_1 || (outfptr->Fptr)->compress_type == GZIP_1\n         || (outfptr->Fptr)->compress_type == GZIP_2 || (outfptr->Fptr)->compress_type == BZIP2_1 ) \n       {\n           /* don't have to convert to int if using gzip, bzip2 or Rice compression */\n           *intlength = 2;\n             \n           if (nullcheck == 1) {\n               /* reset pixels equal to flagval to the FITS null value, prior to compression */\n               flagval = *(short *) (nullflagval);\n               if (flagval != nullval) {\n                  for (ii = tilelen - 1; ii >= 0; ii--) {\n\t            if (sbuff[ii] == (short) flagval)\n\t\t       sbuff[ii] = (short) nullval;\n                  }\n               }\n           }\n       } else if ((outfptr->Fptr)->compress_type == HCOMPRESS_1) {\n           /* have to convert to int if using HCOMPRESS */\n           *intlength = 4;\n\n           if (nullcheck == 1) {\n               /* reset pixels equal to flagval to the FITS null value, prior to compression */\n               flagval = *(short *) (nullflagval);\n               for (ii = tilelen - 1; ii >= 0; ii--) {\n\t            if (sbuff[ii] == (short) flagval)\n\t\t       idata[ii] = nullval;\n                    else \n                       idata[ii] = (int) sbuff[ii];\n               }\n           } else {  /* just do the data type conversion to int */\n                 /* have to convert sbuff to an I*4 array, in place */\n                 /* sbuff must have been allocated large enough to do this */\n                 fits_short_to_int_inplace(sbuff, tilelen, 0, status);\n           }\n       } else {\n           /* have to convert to int if using PLIO */\n           *intlength = 4;\n           if (zero == 0. && actual_bzero == 32768.) {\n             /* Here we are compressing unsigned 16-bit integers that have */\n\t     /* been offset by -32768 using the standard FITS convention. */\n\t     /* Since PLIO cannot deal with negative values, we must apply */\n\t     /* the shift of 32786 to the values to make them all positive. */\n\t     /* The inverse negative shift will be applied in */\n\t     /* imcomp_decompress_tile when reading the compressed tile. */\n             if (nullcheck == 1) {\n               /* reset pixels equal to flagval to the FITS null value, prior to compression */\n               flagval = *(short *) (nullflagval);\n               for (ii = tilelen - 1; ii >= 0; ii--) {\n\t            if (sbuff[ii] == (short) flagval)\n\t\t       idata[ii] = nullval;\n                    else\n                       idata[ii] = (int) sbuff[ii] + 32768;\n               }\n             } else {  \n                 /* have to convert sbuff to an I*4 array, in place */\n                 /* sbuff must have been allocated large enough to do this */\n                 fits_short_to_int_inplace(sbuff, tilelen, 32768, status);\n             }\n           } else {\n\t     /* This is not an unsigned 16-bit integer array, so process normally */\n             if (nullcheck == 1) {\n               /* reset pixels equal to flagval to the FITS null value, prior to compression */\n               flagval = *(short *) (nullflagval);\n               for (ii = tilelen - 1; ii >= 0; ii--) {\n\t            if (sbuff[ii] == (short) flagval)\n\t\t       idata[ii] = nullval;\n                    else\n                       idata[ii] = (int) sbuff[ii];\n               }\n             } else {  /* just do the data type conversion to int */\n                 /* have to convert sbuff to an I*4 array, in place */\n                 /* sbuff must have been allocated large enough to do this */\n                 fits_short_to_int_inplace(sbuff, tilelen, 0, status);\n             }\n           }\n        }\n        return(*status);\n}\n /*--------------------------------------------------------------------------*/\nint imcomp_convert_tile_tushort(\n    fitsfile *outfptr,\n    void *tiledata, \n    long tilelen,\n    int nullcheck,\n    void *nullflagval,\n    int nullval,\n    int zbitpix,\n    double scale,\n    double zero,\n    int *intlength,\n    int *status)\n{\n    /*  Prepare the input  tile array of pixels for compression. */\n    /*  Convert input unsigned integer*2 tile array in place to 4 or 8-byte ints for compression, */\n    /*  If needed, convert 4 or 8-byte ints and do null value substitution. */\n    /*  Note that the calling routine must have allocated the input array big enough */\n    /* to be able to do this.  */\n\n    unsigned short *usbuff;\n    short *sbuff;\n    int flagval, *idata;\n    long ii;\n    \n       /* datatype of input array is unsigned short.  We only support writing this datatype\n          to a FITS image with BITPIX = 16 and with BZERO = 0 and BSCALE = 32768.  */\n\n       if (zbitpix != SHORT_IMG || scale != 1.0 || zero != 32768.) {\n           ffpmsg(\"Implicit datatype conversion is not supported when writing to compressed images\");\n           return(*status = DATA_COMPRESSION_ERR);\n       } \n\n       usbuff = (unsigned short *) tiledata;\n       sbuff = (short *) tiledata;\n       idata = (int *) tiledata;\n\n       if ((outfptr->Fptr)->compress_type == RICE_1 || (outfptr->Fptr)->compress_type == GZIP_1\n        || (outfptr->Fptr)->compress_type == GZIP_2 || (outfptr->Fptr)->compress_type == BZIP2_1) \n       {\n           /* don't have to convert to int if using gzip, bzip2, or Rice compression */\n           *intlength = 2;\n\n          /* offset the unsigned value by -32768 to a signed short value. */\n\t  /* It is more efficient to do this by just flipping the most significant of the 16 bits */\n\n           if (nullcheck == 1) {\n               /* reset pixels equal to flagval to the FITS null value, prior to compression  */\n               flagval = *(unsigned short *) (nullflagval);\n               for (ii = tilelen - 1; ii >= 0; ii--) {\n\t            if (usbuff[ii] == (unsigned short) flagval)\n\t\t       sbuff[ii] = (short) nullval;\n                    else\n\t\t       usbuff[ii] =  (usbuff[ii]) ^ 0x8000;\n               }\n           } else {\n               /* just offset the pixel values by 32768 (by flipping the MSB */\n               for (ii = tilelen - 1; ii >= 0; ii--)\n\t\t       usbuff[ii] =  (usbuff[ii]) ^ 0x8000;\n           }\n       } else {\n           /* have to convert to int if using HCOMPRESS or PLIO */\n           *intlength = 4;\n\n           if (nullcheck == 1) {\n               /* offset the pixel values by 32768, and */\n               /* reset pixels equal to flagval to nullval */\n               flagval = *(unsigned short *) (nullflagval);\n               for (ii = tilelen - 1; ii >= 0; ii--) {\n\t            if (usbuff[ii] == (unsigned short) flagval)\n\t\t       idata[ii] = nullval;\n                    else\n\t\t       idata[ii] = ((int) usbuff[ii]) - 32768;\n               }\n           } else {  /* just do the data type conversion to int */\n               /* for HCOMPRESS we need to simply subtract 32768 */\n               /* for PLIO, have to convert usbuff to an I*4 array, in place */\n               /* usbuff must have been allocated large enough to do this */\n\n               if ((outfptr->Fptr)->compress_type == HCOMPRESS_1) {\n                    fits_ushort_to_int_inplace(usbuff, tilelen, -32768, status);\n               } else {\n                    fits_ushort_to_int_inplace(usbuff, tilelen, 0, status);\n               }\n           }\n        }\n\n        return(*status);\n}\n /*--------------------------------------------------------------------------*/\nint imcomp_convert_tile_tint(\n    fitsfile *outfptr,\n    void *tiledata, \n    long tilelen,\n    int nullcheck,\n    void *nullflagval,\n    int nullval,\n    int zbitpix,\n    double scale,\n    double zero,\n    int *intlength,\n    int *status)\n{\n    /*  Prepare the input tile array of pixels for compression. */\n    /*  Convert input integer tile array in place to 4 or 8-byte ints for compression, */\n    /*  If needed, do null value substitution. */\n   \n    int flagval, *idata;\n    long ii;\n    \n \n        /* datatype of input array is int.  We only support writing this datatype\n           to a FITS image with BITPIX = 32 and with BZERO = 0 and BSCALE = 1.  */\n\n       if (zbitpix != LONG_IMG || scale != 1.0 || zero != 0.) {\n           ffpmsg(\"Implicit datatype conversion is not supported when writing to compressed images\");\n           return(*status = DATA_COMPRESSION_ERR);\n       } \n\n       idata = (int *) tiledata;\n       *intlength = 4;\n\n       if (nullcheck == 1) {\n               /* no datatype conversion is required for any of the compression algorithms,\n\t         except possibly for HCOMPRESS (to I*8), which is handled later.\n\t\t Just reset pixels equal to flagval to the FITS null value */\n               flagval = *(int *) (nullflagval);\n               if (flagval != nullval) {\n                  for (ii = tilelen - 1; ii >= 0; ii--) {\n\t            if (idata[ii] == flagval)\n\t\t       idata[ii] = nullval;\n                  }\n               }\n       }\n\n       return(*status);\n}\n /*--------------------------------------------------------------------------*/\nint imcomp_convert_tile_tuint(\n    fitsfile *outfptr,\n    void *tiledata, \n    long tilelen,\n    int nullcheck,\n    void *nullflagval,\n    int nullval,\n    int zbitpix,\n    double scale,\n    double zero,\n    int *intlength,\n    int *status)\n{\n    /*  Prepare the input tile array of pixels for compression. */\n    /*  Convert input unsigned integer tile array in place to 4 or 8-byte ints for compression, */\n    /*  If needed, do null value substitution. */\n\n\n    int *idata;\n    unsigned int *uintbuff, uintflagval;\n    long ii;\n \n       /* datatype of input array is unsigned int.  We only support writing this datatype\n          to a FITS image with BITPIX = 32 and with BZERO = 0 and BSCALE = 2147483648.  */\n\n       if (zbitpix != LONG_IMG || scale != 1.0 || zero != 2147483648.) {\n           ffpmsg(\"Implicit datatype conversion is not supported when writing to compressed images\");\n           return(*status = DATA_COMPRESSION_ERR);\n       } \n\n       *intlength = 4;\n       idata = (int *) tiledata;\n       uintbuff = (unsigned int *) tiledata;\n\n       /* offset the unsigned value by -2147483648 to a signed int value. */\n       /* It is more efficient to do this by just flipping the most significant of the 32 bits */\n\n       if (nullcheck == 1) {\n               /* reset pixels equal to flagval to nullval and */\n               /* offset the other pixel values (by flipping the MSB) */\n               uintflagval = *(unsigned int *) (nullflagval);\n               for (ii = tilelen - 1; ii >= 0; ii--) {\n\t            if (uintbuff[ii] == uintflagval)\n\t\t       idata[ii] = nullval;\n                    else\n\t\t       uintbuff[ii] = (uintbuff[ii]) ^ 0x80000000;\n               }\n       } else {\n               /* just offset the pixel values (by flipping the MSB) */\n               for (ii = tilelen - 1; ii >= 0; ii--)\n\t\t       uintbuff[ii] = (uintbuff[ii]) ^ 0x80000000;\n       }\n\n       return(*status);\n}\n /*--------------------------------------------------------------------------*/\nint imcomp_convert_tile_tbyte(\n    fitsfile *outfptr,\n    void *tiledata, \n    long tilelen,\n    int nullcheck,\n    void *nullflagval,\n    int nullval,\n    int zbitpix,\n    double scale,\n    double zero,\n    int *intlength,\n    int *status)\n{\n    /*  Prepare the input tile array of pixels for compression. */\n    /*  Convert input unsigned integer*1 tile array in place to 4 or 8-byte ints for compression, */\n    /*  If needed, convert 4 or 8-byte ints and do null value substitution. */\n    /*  Note that the calling routine must have allocated the input array big enough */\n    /* to be able to do this.  */\n\n    int flagval, *idata;\n    long ii;\n    unsigned char *usbbuff;\n        \n       /* datatype of input array is unsigned byte.  We only support writing this datatype\n          to a FITS image with BITPIX = 8 and with BZERO = 0 and BSCALE = 1.  */\n\n       if (zbitpix != BYTE_IMG || scale != 1.0 || zero != 0.) {\n           ffpmsg(\"Implicit datatype conversion is not supported when writing to compressed images\");\n           return(*status = DATA_COMPRESSION_ERR);\n       } \n\n       idata = (int *) tiledata;\n       usbbuff = (unsigned char *) tiledata;\n\n       if ( (outfptr->Fptr)->compress_type == RICE_1 || (outfptr->Fptr)->compress_type == GZIP_1\n         || (outfptr->Fptr)->compress_type == GZIP_2 || (outfptr->Fptr)->compress_type == BZIP2_1 ) \n       {\n           /* don't have to convert to int if using gzip, bzip2, or Rice compression */\n           *intlength = 1;\n             \n           if (nullcheck == 1) {\n               /* reset pixels equal to flagval to the FITS null value, prior to compression */\n               flagval = *(unsigned char *) (nullflagval);\n               if (flagval != nullval) {\n                  for (ii = tilelen - 1; ii >= 0; ii--) {\n\t            if (usbbuff[ii] == (unsigned char) flagval)\n\t\t       usbbuff[ii] = (unsigned char) nullval;\n                    }\n               }\n           }\n       } else {\n           /* have to convert to int if using HCOMPRESS or PLIO */\n           *intlength = 4;\n\n           if (nullcheck == 1) {\n               /* reset pixels equal to flagval to the FITS null value, prior to compression */\n               flagval = *(unsigned char *) (nullflagval);\n               for (ii = tilelen - 1; ii >= 0; ii--) {\n\t            if (usbbuff[ii] == (unsigned char) flagval)\n\t\t       idata[ii] = nullval;\n                    else\n                       idata[ii] = (int) usbbuff[ii];\n               }\n           } else {  /* just do the data type conversion to int */\n                 /* have to convert usbbuff to an I*4 array, in place */\n                 /* usbbuff must have been allocated large enough to do this */\n                 fits_ubyte_to_int_inplace(usbbuff, tilelen, status);\n           }\n       }\n\n       return(*status);\n}\n /*--------------------------------------------------------------------------*/\nint imcomp_convert_tile_tsbyte(\n    fitsfile *outfptr,\n    void *tiledata, \n    long tilelen,\n    int nullcheck,\n    void *nullflagval,\n    int nullval,\n    int zbitpix,\n    double scale,\n    double zero,\n    int *intlength,\n    int *status)\n{\n    /*  Prepare the input tile array of pixels for compression. */\n    /*  Convert input integer*1 tile array in place to 4 or 8-byte ints for compression, */\n    /*  If needed, convert 4 or 8-byte ints and do null value substitution. */\n    /*  Note that the calling routine must have allocated the input array big enough */\n    /* to be able to do this.  */\n\n    int flagval, *idata;\n    long ii;\n    signed char *sbbuff;\n\n       /* datatype of input array is signed byte.  We only support writing this datatype\n          to a FITS image with BITPIX = 8 and with BZERO = 0 and BSCALE = -128.  */\n\n       if (zbitpix != BYTE_IMG|| scale != 1.0 || zero != -128.) {\n           ffpmsg(\"Implicit datatype conversion is not supported when writing to compressed images\");\n           return(*status = DATA_COMPRESSION_ERR);\n       }\n\n       idata = (int *) tiledata;\n       sbbuff = (signed char *) tiledata;\n\n       if ( (outfptr->Fptr)->compress_type == RICE_1 || (outfptr->Fptr)->compress_type == GZIP_1\n         || (outfptr->Fptr)->compress_type == GZIP_2 || (outfptr->Fptr)->compress_type == BZIP2_1 ) \n       {\n           /* don't have to convert to int if using gzip, bzip2 or Rice compression */\n           *intlength = 1;\n             \n           if (nullcheck == 1) {\n               /* reset pixels equal to flagval to the FITS null value, prior to compression */\n               /* offset the other pixel values (by flipping the MSB) */\n\n               flagval = *(signed char *) (nullflagval);\n               for (ii = tilelen - 1; ii >= 0; ii--) {\n\t            if (sbbuff[ii] == (signed char) flagval)\n\t\t       sbbuff[ii] = (signed char) nullval;\n                    else\n\t\t       sbbuff[ii] = (sbbuff[ii]) ^ 0x80;               }\n           } else {  /* just offset the pixel values (by flipping the MSB) */\n               for (ii = tilelen - 1; ii >= 0; ii--) \n\t\t       sbbuff[ii] = (sbbuff[ii]) ^ 0x80;\n           }\n\n       } else {\n           /* have to convert to int if using HCOMPRESS or PLIO */\n           *intlength = 4;\n\n           if (nullcheck == 1) {\n               /* reset pixels equal to flagval to the FITS null value, prior to compression */\n               flagval = *(signed char *) (nullflagval);\n               for (ii = tilelen - 1; ii >= 0; ii--) {\n\t            if (sbbuff[ii] == (signed char) flagval)\n\t\t       idata[ii] = nullval;\n                    else\n                       idata[ii] = ((int) sbbuff[ii]) + 128;\n               }\n           } else {  /* just do the data type conversion to int */\n                 /* have to convert sbbuff to an I*4 array, in place */\n                 /* sbbuff must have been allocated large enough to do this */\n                 fits_sbyte_to_int_inplace(sbbuff, tilelen, status);\n           }\n       }\n \n       return(*status);\n}\n /*--------------------------------------------------------------------------*/\nint imcomp_convert_tile_tfloat(\n    fitsfile *outfptr,\n    long row,\n    void *tiledata, \n    long tilelen,\n    long tilenx,\n    long tileny,\n    int nullcheck,\n    void *nullflagval,\n    int nullval,\n    int zbitpix,\n    double scale,\n    double zero,\n    int *intlength,\n    int *flag,\n    double *bscale,\n    double *bzero,\n    int *status)\n{\n    /*  Prepare the input tile array of pixels for compression. */\n    /*  Convert input float tile array in place to 4 or 8-byte ints for compression, */\n    /*  If needed, convert 4 or 8-byte ints and do null value substitution. */\n    /*  Note that the calling routine must have allocated the input array big enough */\n    /* to be able to do this.  */\n\n    int *idata;\n    long irow, ii;\n    float floatnull;\n    unsigned char *usbbuff;\n    unsigned long dithersum;\n    int iminval = 0, imaxval = 0;  /* min and max quantized integers */\n\n        /* datatype of input array is double.  We only support writing this datatype\n           to a FITS image with BITPIX = -64 or -32, except we also support the special case where\n\t   BITPIX = 32 and BZERO = 0 and BSCALE = 1.  */\n\n       if ((zbitpix != LONG_IMG && zbitpix != DOUBLE_IMG && zbitpix != FLOAT_IMG) || scale != 1.0 || zero != 0.) {\n           ffpmsg(\"Implicit datatype conversion is not supported when writing to compressed images\");\n           return(*status = DATA_COMPRESSION_ERR);\n       } \n\n           *intlength = 4;\n           idata = (int *) tiledata;\n\n          /* if the tile-compressed table contains zscale and zzero columns */\n          /* then scale and quantize the input floating point data.    */\n\n          if ((outfptr->Fptr)->cn_zscale > 0) {\n\t    /* quantize the float values into integers */\n\n            if (nullcheck == 1)\n\t      floatnull = *(float *) (nullflagval);\n\t    else\n\t      floatnull = FLOATNULLVALUE;  /* NaNs are represented by this, by default */\n\n            if ((outfptr->Fptr)->quantize_method == SUBTRACTIVE_DITHER_1  ||\n\t        (outfptr->Fptr)->quantize_method == SUBTRACTIVE_DITHER_2) {\n\t      \n\t          /* see if the dithering offset value needs to be initialized */                  \n\t          if ((outfptr->Fptr)->request_dither_seed == 0 && (outfptr->Fptr)->dither_seed == 0) {\n\n\t\t     /* This means randomly choose the dithering offset based on the system time. */\n\t\t     /* The offset will have a value between 1 and 10000, inclusive. */\n\t\t     /* The time function returns an integer value that is incremented each second. */\n\t\t     /* The clock function returns the elapsed CPU time, in integer CLOCKS_PER_SEC units. */\n\t\t     /* The CPU time returned by clock is typically (on linux PC) only good to 0.01 sec */\n\t\t     /* Summing the 2 quantities may help avoid cases where 2 executions of the program */\n\t\t     /* (perhaps in a multithreaded environoment) end up with exactly the same dither seed */\n\t\t     /* value.  The sum is incremented by the current HDU number in the file to provide */\n\t\t     /* further randomization.  This randomization is desireable if multiple compressed */\n\t\t     /* images will be summed (or differenced). In such cases, the benefits of dithering */\n\t\t     /* may be lost if all the images use exactly the same sequence of random numbers when */\n\t\t     /* calculating the dithering offsets. */\t     \n\t\t     \n\t\t     (outfptr->Fptr)->dither_seed = \n\t\t       (( (int)time(NULL) + ( (int) clock() / (int) (CLOCKS_PER_SEC / 100)) + (outfptr->Fptr)->curhdu) % 10000) + 1;\n\t\t     \n                     /* update the header keyword with this new value */\n\t\t     fits_update_key(outfptr, TINT, \"ZDITHER0\", &((outfptr->Fptr)->dither_seed), \n\t                        NULL, status);\n\n\t          } else if ((outfptr->Fptr)->request_dither_seed < 0 && (outfptr->Fptr)->dither_seed < 0) {\n\n\t\t     /* this means randomly choose the dithering offset based on some hash function */\n\t\t     /* of the first input tile of data to be quantized and compressed.  This ensures that */\n                     /* the same offset value is used for a given image every time it is compressed. */\n\n\t\t     usbbuff = (unsigned char *) tiledata;\n\t\t     dithersum = 0;\n\t\t     for (ii = 0; ii < 4 * tilelen; ii++) {\n\t\t         dithersum += usbbuff[ii];  /* doesn't matter if there is an integer overflow */\n\t             }\n\t\t     (outfptr->Fptr)->dither_seed = ((int) (dithersum % 10000)) + 1;\n\t\t\n                     /* update the header keyword with this new value */\n\t\t     fits_update_key(outfptr, TINT, \"ZDITHER0\", &((outfptr->Fptr)->dither_seed), \n\t                        NULL, status);\n\t\t  }\n\n                  /* subtract 1 to convert from 1-based to 0-based element number */\n\t          irow = row + (outfptr->Fptr)->dither_seed - 1; /* dither the quantized values */\n\n\t      } else if ((outfptr->Fptr)->quantize_method == -1) {\n\t          irow = 0;  /* do not dither the quantized values */\n              } else {\n                  ffpmsg(\"Unknown dithering method.\");\n                  ffpmsg(\"May need to install a newer version of CFITSIO.\");\n                  return(*status = DATA_COMPRESSION_ERR);\n              }\n\n              *flag = fits_quantize_float (irow, (float *) tiledata, tilenx, tileny,\n                   nullcheck, floatnull, (outfptr->Fptr)->quantize_level, \n\t\t   (outfptr->Fptr)->quantize_method, idata, bscale, bzero, &iminval, &imaxval);\n\n              if (*flag > 1)\n\t\t   return(*status = *flag);\n          }\n          else if ((outfptr->Fptr)->quantize_level != NO_QUANTIZE)\n\t  {\n\t    /* if floating point pixels are not being losslessly compressed, then */\n\t    /* input float data is implicitly converted (truncated) to integers */\n            if ((scale != 1. || zero != 0.))  /* must scale the values */\n\t       imcomp_nullscalefloats((float *) tiledata, tilelen, idata, scale, zero,\n\t           nullcheck, *(float *) (nullflagval), nullval, status);\n             else\n\t       imcomp_nullfloats((float *) tiledata, tilelen, idata,\n\t           nullcheck, *(float *) (nullflagval), nullval,  status);\n          }\n          else if ((outfptr->Fptr)->quantize_level == NO_QUANTIZE)\n\t  {\n\t      /* just convert null values to NaNs in place, if necessary, then do lossless gzip compression */\n\t\tif (nullcheck == 1) {\n\t            imcomp_float2nan((float *) tiledata, tilelen, (int *) tiledata,\n\t                *(float *) (nullflagval), status);\n\t\t}\n          }\n\n          return(*status);\n}\n /*--------------------------------------------------------------------------*/\nint imcomp_convert_tile_tdouble(\n    fitsfile *outfptr,\n    long row,\n    void *tiledata, \n    long tilelen,\n    long tilenx,\n    long tileny,\n    int nullcheck,\n    void *nullflagval,\n    int nullval,\n    int zbitpix,\n    double scale,\n    double zero,\n    int *intlength,\n    int *flag,\n    double *bscale,\n    double *bzero,\n    int *status)\n{\n    /*  Prepare the input tile array of pixels for compression. */\n    /*  Convert input double tile array in place to 4-byte ints for compression, */\n    /*  If needed, convert 4 or 8-byte ints and do null value substitution. */\n    /*  Note that the calling routine must have allocated the input array big enough */\n    /* to be able to do this.  */\n\n    int *idata;\n    long irow, ii;\n    double doublenull;\n    unsigned char *usbbuff;\n    unsigned long dithersum;\n    int iminval = 0, imaxval = 0;  /* min and max quantized integers */\n\n        /* datatype of input array is double.  We only support writing this datatype\n           to a FITS image with BITPIX = -64 or -32, except we also support the special case where\n\t   BITPIX = 32 and BZERO = 0 and BSCALE = 1.  */\n\n       if ((zbitpix != LONG_IMG && zbitpix != DOUBLE_IMG && zbitpix != FLOAT_IMG) || scale != 1.0 || zero != 0.) {\n           ffpmsg(\"Implicit datatype conversion is not supported when writing to compressed images\");\n           return(*status = DATA_COMPRESSION_ERR);\n       } \n\n           *intlength = 4;\n           idata = (int *) tiledata;\n\n          /* if the tile-compressed table contains zscale and zzero columns */\n          /* then scale and quantize the input floating point data.    */\n          /* Otherwise, just truncate the floats to integers.          */\n\n          if ((outfptr->Fptr)->cn_zscale > 0)\n          {\n            if (nullcheck == 1)\n\t      doublenull = *(double *) (nullflagval);\n\t    else\n\t      doublenull = DOUBLENULLVALUE;\n\n            /* quantize the double values into integers */\n              if ((outfptr->Fptr)->quantize_method == SUBTRACTIVE_DITHER_1 ||\n\t          (outfptr->Fptr)->quantize_method == SUBTRACTIVE_DITHER_2) {\n\n\t          /* see if the dithering offset value needs to be initialized (see above) */                  \n\t          if ((outfptr->Fptr)->request_dither_seed == 0 && (outfptr->Fptr)->dither_seed == 0) {\n\n\t\t     (outfptr->Fptr)->dither_seed = \n\t\t       (( (int)time(NULL) + ( (int) clock() / (int) (CLOCKS_PER_SEC / 100)) + (outfptr->Fptr)->curhdu) % 10000) + 1;\n\t\t     \n                     /* update the header keyword with this new value */\n\t\t     fits_update_key(outfptr, TINT, \"ZDITHER0\", &((outfptr->Fptr)->dither_seed), \n\t                        NULL, status);\n\n\t          } else if ((outfptr->Fptr)->request_dither_seed < 0 && (outfptr->Fptr)->dither_seed < 0) {\n\n\t\t     usbbuff = (unsigned char *) tiledata;\n\t\t     dithersum = 0;\n\t\t     for (ii = 0; ii < 8 * tilelen; ii++) {\n\t\t         dithersum += usbbuff[ii];\n\t             }\n\t\t     (outfptr->Fptr)->dither_seed = ((int) (dithersum % 10000)) + 1;\n\t\t\n                     /* update the header keyword with this new value */\n\t\t     fits_update_key(outfptr, TINT, \"ZDITHER0\", &((outfptr->Fptr)->dither_seed), \n\t                        NULL, status);\n\t\t  }\n\n\t          irow = row + (outfptr->Fptr)->dither_seed - 1; /* dither the quantized values */\n\n\t      } else if ((outfptr->Fptr)->quantize_method == -1) {\n\t          irow = 0;  /* do not dither the quantized values */\n              } else {\n                  ffpmsg(\"Unknown subtractive dithering method.\");\n                  ffpmsg(\"May need to install a newer version of CFITSIO.\");\n                  return(*status = DATA_COMPRESSION_ERR);\n              }\n\n            *flag = fits_quantize_double (irow, (double *) tiledata, tilenx, tileny,\n               nullcheck, doublenull, (outfptr->Fptr)->quantize_level, \n\t       (outfptr->Fptr)->quantize_method, idata,\n               bscale, bzero, &iminval, &imaxval);\n\n            if (*flag > 1)\n\t\treturn(*status = *flag);\n          }\n          else if ((outfptr->Fptr)->quantize_level != NO_QUANTIZE)\n\t  {\n\t    /* if floating point pixels are not being losslessly compressed, then */\n\t    /* input float data is implicitly converted (truncated) to integers */\n             if ((scale != 1. || zero != 0.))  /* must scale the values */\n\t       imcomp_nullscaledoubles((double *) tiledata, tilelen, idata, scale, zero,\n\t           nullcheck, *(double *) (nullflagval), nullval, status);\n             else\n\t       imcomp_nulldoubles((double *) tiledata, tilelen, idata,\n\t           nullcheck, *(double *) (nullflagval), nullval,  status);\n          }\n          else if ((outfptr->Fptr)->quantize_level == NO_QUANTIZE)\n\t  {\n\t      /* just convert null values to NaNs in place, if necessary, then do lossless gzip compression */\n\t\tif (nullcheck == 1) {\n\t            imcomp_double2nan((double *) tiledata, tilelen, (LONGLONG *) tiledata,\n\t                *(double *) (nullflagval), status);\n\t\t}\n          }\n \n          return(*status);\n}\n/*---------------------------------------------------------------------------*/\nint imcomp_nullscale(\n     int *idata, \n     long tilelen,\n     int nullflagval,\n     int nullval,\n     double scale,\n     double zero,\n     int *status)\n/*\n   do null value substitution AND scaling of the integer array.\n   If array value = nullflagval, then set the value to nullval.\n   Otherwise, inverse scale the integer value.\n*/\n{\n    long ii;\n    double dvalue;\n    \n    for (ii=0; ii < tilelen; ii++)\n    {\n        if (idata[ii] == nullflagval)\n\t    idata[ii] = nullval;\n\telse \n\t{\n            dvalue = (idata[ii] - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    idata[ii] = (int) (dvalue + .5);\n                else\n                    idata[ii] = (int) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*---------------------------------------------------------------------------*/\nint imcomp_nullvalues(\n     int *idata, \n     long tilelen,\n     int nullflagval,\n     int nullval,\n     int *status)\n/*\n   do null value substitution.\n   If array value = nullflagval, then set the value to nullval.\n*/\n{\n    long ii;\n    \n    for (ii=0; ii < tilelen; ii++)\n    {\n        if (idata[ii] == nullflagval)\n\t    idata[ii] = nullval;\n    }\n    return(*status);\n}\n/*---------------------------------------------------------------------------*/\nint imcomp_scalevalues(\n     int *idata, \n     long tilelen,\n     double scale,\n     double zero,\n     int *status)\n/*\n   do inverse scaling the integer values.\n*/\n{\n    long ii;\n    double dvalue;\n    \n    for (ii=0; ii < tilelen; ii++)\n    {\n            dvalue = (idata[ii] - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    idata[ii] = (int) (dvalue + .5);\n                else\n                    idata[ii] = (int) (dvalue - .5);\n            }\n    }\n    return(*status);\n}\n/*---------------------------------------------------------------------------*/\nint imcomp_nullscalei2(\n     short *idata, \n     long tilelen,\n     short nullflagval,\n     short nullval,\n     double scale,\n     double zero,\n     int *status)\n/*\n   do null value substitution AND scaling of the integer array.\n   If array value = nullflagval, then set the value to nullval.\n   Otherwise, inverse scale the integer value.\n*/\n{\n    long ii;\n    double dvalue;\n    \n    for (ii=0; ii < tilelen; ii++)\n    {\n        if (idata[ii] == nullflagval)\n\t    idata[ii] = nullval;\n\telse \n\t{\n            dvalue = (idata[ii] - zero) / scale;\n\n            if (dvalue < DSHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = SHRT_MIN;\n            }\n            else if (dvalue > DSHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = SHRT_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    idata[ii] = (int) (dvalue + .5);\n                else\n                    idata[ii] = (int) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*---------------------------------------------------------------------------*/\nint imcomp_nullvaluesi2(\n     short *idata, \n     long tilelen,\n     short nullflagval,\n     short nullval,\n     int *status)\n/*\n   do null value substitution.\n   If array value = nullflagval, then set the value to nullval.\n*/\n{\n    long ii;\n    \n    for (ii=0; ii < tilelen; ii++)\n    {\n        if (idata[ii] == nullflagval)\n\t    idata[ii] = nullval;\n    }\n    return(*status);\n}\n/*---------------------------------------------------------------------------*/\nint imcomp_scalevaluesi2(\n     short *idata, \n     long tilelen,\n     double scale,\n     double zero,\n     int *status)\n/*\n   do inverse scaling the integer values.\n*/\n{\n    long ii;\n    double dvalue;\n    \n    for (ii=0; ii < tilelen; ii++)\n    {\n            dvalue = (idata[ii] - zero) / scale;\n\n            if (dvalue < DSHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = SHRT_MIN;\n            }\n            else if (dvalue > DSHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = SHRT_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    idata[ii] = (int) (dvalue + .5);\n                else\n                    idata[ii] = (int) (dvalue - .5);\n            }\n    }\n    return(*status);\n}\n/*---------------------------------------------------------------------------*/\nint imcomp_nullfloats(\n     float *fdata,\n     long tilelen,\n     int *idata, \n     int nullcheck,\n     float nullflagval,\n     int nullval,\n     int *status)\n/*\n   do null value substitution  of the float array.\n   If array value = nullflagval, then set the output value to FLOATNULLVALUE.\n*/\n{\n    long ii;\n    double dvalue;\n    \n    if (nullcheck == 1) /* must check for null values */\n    {\n      for (ii=0; ii < tilelen; ii++)\n      {\n        if (fdata[ii] == nullflagval)\n\t    idata[ii] = nullval;\n\telse \n\t{\n            dvalue = fdata[ii];\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    idata[ii] = (int) (dvalue + .5);\n                else\n                    idata[ii] = (int) (dvalue - .5);\n            }\n        }\n      }\n    }\n    else  /* don't have to worry about null values */\n    {\n      for (ii=0; ii < tilelen; ii++)\n      {\n            dvalue = fdata[ii];\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    idata[ii] = (int) (dvalue + .5);\n                else\n                    idata[ii] = (int) (dvalue - .5);\n            }\n      }\n    }\n    return(*status);\n}\n/*---------------------------------------------------------------------------*/\nint imcomp_nullscalefloats(\n     float *fdata,\n     long tilelen,\n     int *idata, \n     double scale,\n     double zero,\n     int nullcheck,\n     float nullflagval,\n     int nullval,\n     int *status)\n/*\n   do null value substitution  of the float array.\n   If array value = nullflagval, then set the output value to FLOATNULLVALUE.\n   Otherwise, inverse scale the integer value.\n*/\n{\n    long ii;\n    double dvalue;\n    \n    if (nullcheck == 1) /* must check for null values */\n    {\n      for (ii=0; ii < tilelen; ii++)\n      {\n        if (fdata[ii] == nullflagval)\n\t    idata[ii] = nullval;\n\telse \n\t{\n            dvalue = (fdata[ii] - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0.)\n                    idata[ii] = (int) (dvalue + .5);\n                else\n                    idata[ii] = (int) (dvalue - .5);\n            }\n        }\n      }\n    }\n    else  /* don't have to worry about null values */\n    {\n      for (ii=0; ii < tilelen; ii++)\n      {\n            dvalue = (fdata[ii] - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0.)\n                    idata[ii] = (int) (dvalue + .5);\n                else\n                    idata[ii] = (int) (dvalue - .5);\n            }\n      }\n    }\n    return(*status);\n}\n/*---------------------------------------------------------------------------*/\nint imcomp_nulldoubles(\n     double *fdata,\n     long tilelen,\n     int *idata, \n     int nullcheck,\n     double nullflagval,\n     int nullval,\n     int *status)\n/*\n   do null value substitution  of the float array.\n   If array value = nullflagval, then set the output value to FLOATNULLVALUE.\n   Otherwise, inverse scale the integer value.\n*/\n{\n    long ii;\n    double dvalue;\n    \n    if (nullcheck == 1) /* must check for null values */\n    {\n      for (ii=0; ii < tilelen; ii++)\n      {\n        if (fdata[ii] == nullflagval)\n\t    idata[ii] = nullval;\n\telse \n\t{\n            dvalue = fdata[ii];\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0.)\n                    idata[ii] = (int) (dvalue + .5);\n                else\n                    idata[ii] = (int) (dvalue - .5);\n            }\n        }\n      }\n    }\n    else  /* don't have to worry about null values */\n    {\n      for (ii=0; ii < tilelen; ii++)\n      {\n            dvalue = fdata[ii];\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0.)\n                    idata[ii] = (int) (dvalue + .5);\n                else\n                    idata[ii] = (int) (dvalue - .5);\n            }\n      }\n    }\n    return(*status);\n}\n/*---------------------------------------------------------------------------*/\nint imcomp_nullscaledoubles(\n     double *fdata,\n     long tilelen,\n     int *idata, \n     double scale,\n     double zero,\n     int nullcheck,\n     double nullflagval,\n     int nullval,\n     int *status)\n/*\n   do null value substitution  of the float array.\n   If array value = nullflagval, then set the output value to FLOATNULLVALUE.\n   Otherwise, inverse scale the integer value.\n*/\n{\n    long ii;\n    double dvalue;\n    \n    if (nullcheck == 1) /* must check for null values */\n    {\n      for (ii=0; ii < tilelen; ii++)\n      {\n        if (fdata[ii] == nullflagval)\n\t    idata[ii] = nullval;\n\telse \n\t{\n            dvalue = (fdata[ii] - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0.)\n                    idata[ii] = (int) (dvalue + .5);\n                else\n                    idata[ii] = (int) (dvalue - .5);\n            }\n        }\n      }\n    }\n    else  /* don't have to worry about null values */\n    {\n      for (ii=0; ii < tilelen; ii++)\n      {\n            dvalue = (fdata[ii] - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                idata[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0.)\n                    idata[ii] = (int) (dvalue + .5);\n                else\n                    idata[ii] = (int) (dvalue - .5);\n            }\n      }\n    }\n    return(*status);\n}\n/*---------------------------------------------------------------------------*/\nint fits_write_compressed_img(fitsfile *fptr,   /* I - FITS file pointer     */\n            int  datatype,   /* I - datatype of the array to be written      */\n            long  *infpixel, /* I - 'bottom left corner' of the subsection   */\n            long  *inlpixel, /* I - 'top right corner' of the subsection     */\n            int  nullcheck,  /* I - 0 for no null checking                   */\n                             /*     1: pixels that are = nullval will be     */\n                             /*     written with the FITS null pixel value   */\n                             /*     (floating point arrays only)             */\n            void *array,     /* I - array of values to be written            */\n            void *nullval,   /* I - undefined pixel value                    */\n            int  *status)    /* IO - error status                            */\n/*\n   Write a section of a compressed image.\n*/\n{\n    int  tiledim[MAX_COMPRESS_DIM];\n    long naxis[MAX_COMPRESS_DIM];\n    long tilesize[MAX_COMPRESS_DIM], thistilesize[MAX_COMPRESS_DIM];\n    long ftile[MAX_COMPRESS_DIM], ltile[MAX_COMPRESS_DIM];\n    long tfpixel[MAX_COMPRESS_DIM], tlpixel[MAX_COMPRESS_DIM];\n    long rowdim[MAX_COMPRESS_DIM], offset[MAX_COMPRESS_DIM],ntemp;\n    long fpixel[MAX_COMPRESS_DIM], lpixel[MAX_COMPRESS_DIM];\n    long i5, i4, i3, i2, i1, i0, irow, trowsize, ntrows;\n    int ii, ndim, pixlen, tilenul;\n    int  tstatus, buffpixsiz;\n    void *buffer;\n    char *bnullarray = 0, card[FLEN_CARD];\n\n    if (*status > 0) \n        return(*status);\n\n    if (!fits_is_compressed_image(fptr, status) )\n    {\n        ffpmsg(\"CHDU is not a compressed image (fits_write_compressed_img)\");\n        return(*status = DATA_COMPRESSION_ERR);\n    }\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    /* rescan header if data structure is undefined */\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n\n    /* ===================================================================== */\n\n\n    if (datatype == TSHORT || datatype == TUSHORT)\n    {\n       pixlen = sizeof(short);\n    }\n    else if (datatype == TINT || datatype == TUINT)\n    {\n       pixlen = sizeof(int);\n    }\n    else if (datatype == TBYTE || datatype == TSBYTE)\n    {\n       pixlen = 1;\n    }\n    else if (datatype == TLONG || datatype == TULONG)\n    {\n       pixlen = sizeof(long);\n    }\n    else if (datatype == TFLOAT)\n    {\n       pixlen = sizeof(float);\n    }\n    else if (datatype == TDOUBLE)\n    {\n       pixlen = sizeof(double);\n    }\n    else\n    {\n        ffpmsg(\"unsupported datatype for compressing image\");\n        return(*status = BAD_DATATYPE);\n    }\n\n    /* ===================================================================== */\n\n    /* allocate scratch space for processing one tile of the image */\n    buffpixsiz = pixlen;  /* this is the minimum pixel size */\n    \n    if ( (fptr->Fptr)->compress_type == HCOMPRESS_1) { /* need 4 or 8 bytes per pixel */\n        if ((fptr->Fptr)->zbitpix == BYTE_IMG ||\n\t    (fptr->Fptr)->zbitpix == SHORT_IMG )\n                buffpixsiz = maxvalue(buffpixsiz, 4);\n        else\n\t        buffpixsiz = 8;\n    }\n    else if ( (fptr->Fptr)->compress_type == PLIO_1) { /* need 4 bytes per pixel */\n                buffpixsiz = maxvalue(buffpixsiz, 4);\n    }\n    else if ( (fptr->Fptr)->compress_type == RICE_1  ||\n              (fptr->Fptr)->compress_type == GZIP_1 ||\n              (fptr->Fptr)->compress_type == GZIP_2 ||\n              (fptr->Fptr)->compress_type == BZIP2_1) {  /* need 1, 2, or 4 bytes per pixel */\n        if ((fptr->Fptr)->zbitpix == BYTE_IMG)\n            buffpixsiz = maxvalue(buffpixsiz, 1);\n        else if ((fptr->Fptr)->zbitpix == SHORT_IMG)\n            buffpixsiz = maxvalue(buffpixsiz, 2);\n        else \n            buffpixsiz = maxvalue(buffpixsiz, 4);\n    }\n    else\n    {\n        ffpmsg(\"unsupported image compression algorithm\");\n        return(*status = BAD_DATATYPE);\n    }\n    \n    /* cast to double to force alignment on 8-byte addresses */\n    buffer = (double *) calloc ((fptr->Fptr)->maxtilelen, buffpixsiz);\n\n    if (buffer == NULL)\n    {\n\t    ffpmsg(\"Out of memory (fits_write_compress_img)\");\n\t    return (*status = MEMORY_ALLOCATION);\n    }\n\n    /* ===================================================================== */\n\n    /* initialize all the arrays */\n    for (ii = 0; ii < MAX_COMPRESS_DIM; ii++)\n    {\n        naxis[ii] = 1;\n        tiledim[ii] = 1;\n        tilesize[ii] = 1;\n        ftile[ii] = 1;\n        ltile[ii] = 1;\n        rowdim[ii] = 1;\n    }\n\n    ndim = (fptr->Fptr)->zndim;\n    ntemp = 1;\n    for (ii = 0; ii < ndim; ii++)\n    {\n        fpixel[ii] = infpixel[ii];\n        lpixel[ii] = inlpixel[ii];\n\n        /* calc number of tiles in each dimension, and tile containing */\n        /* the first and last pixel we want to read in each dimension  */\n        naxis[ii] = (fptr->Fptr)->znaxis[ii];\n        if (fpixel[ii] < 1)\n        {\n            free(buffer);\n            return(*status = BAD_PIX_NUM);\n        }\n\n        tilesize[ii] = (fptr->Fptr)->tilesize[ii];\n        tiledim[ii] = (naxis[ii] - 1) / tilesize[ii] + 1;\n        ftile[ii]   = (fpixel[ii] - 1)   / tilesize[ii] + 1;\n        ltile[ii]   = minvalue((lpixel[ii] - 1) / tilesize[ii] + 1, \n                                tiledim[ii]);\n        rowdim[ii]  = ntemp;  /* total tiles in each dimension */\n        ntemp *= tiledim[ii];\n    }\n\n    /* support up to 6 dimensions for now */\n    /* tfpixel and tlpixel are the first and last image pixels */\n    /* along each dimension of the compression tile */\n    for (i5 = ftile[5]; i5 <= ltile[5]; i5++)\n    {\n     tfpixel[5] = (i5 - 1) * tilesize[5] + 1;\n     tlpixel[5] = minvalue(tfpixel[5] + tilesize[5] - 1, \n                            naxis[5]);\n     thistilesize[5] = tlpixel[5] - tfpixel[5] + 1;\n     offset[5] = (i5 - 1) * rowdim[5];\n     for (i4 = ftile[4]; i4 <= ltile[4]; i4++)\n     {\n      tfpixel[4] = (i4 - 1) * tilesize[4] + 1;\n      tlpixel[4] = minvalue(tfpixel[4] + tilesize[4] - 1, \n                            naxis[4]);\n      thistilesize[4] = thistilesize[5] * (tlpixel[4] - tfpixel[4] + 1);\n      offset[4] = (i4 - 1) * rowdim[4] + offset[5];\n      for (i3 = ftile[3]; i3 <= ltile[3]; i3++)\n      {\n        tfpixel[3] = (i3 - 1) * tilesize[3] + 1;\n        tlpixel[3] = minvalue(tfpixel[3] + tilesize[3] - 1, \n                              naxis[3]);\n        thistilesize[3] = thistilesize[4] * (tlpixel[3] - tfpixel[3] + 1);\n        offset[3] = (i3 - 1) * rowdim[3] + offset[4];\n        for (i2 = ftile[2]; i2 <= ltile[2]; i2++)\n        {\n          tfpixel[2] = (i2 - 1) * tilesize[2] + 1;\n          tlpixel[2] = minvalue(tfpixel[2] + tilesize[2] - 1, \n                                naxis[2]);\n          thistilesize[2] = thistilesize[3] * (tlpixel[2] - tfpixel[2] + 1);\n          offset[2] = (i2 - 1) * rowdim[2] + offset[3];\n          for (i1 = ftile[1]; i1 <= ltile[1]; i1++)\n          {\n            tfpixel[1] = (i1 - 1) * tilesize[1] + 1;\n            tlpixel[1] = minvalue(tfpixel[1] + tilesize[1] - 1, \n                                  naxis[1]);\n            thistilesize[1] = thistilesize[2] * (tlpixel[1] - tfpixel[1] + 1);\n            offset[1] = (i1 - 1) * rowdim[1] + offset[2];\n            for (i0 = ftile[0]; i0 <= ltile[0]; i0++)\n            {\n              tfpixel[0] = (i0 - 1) * tilesize[0] + 1;\n              tlpixel[0] = minvalue(tfpixel[0] + tilesize[0] - 1, \n                                    naxis[0]);\n              thistilesize[0] = thistilesize[1] * (tlpixel[0] - tfpixel[0] + 1);\n              /* calculate row of table containing this tile */\n              irow = i0 + offset[1];\n\n              /* read and uncompress this row (tile) of the table */\n              /* also do type conversion and undefined pixel substitution */\n              /* at this point */\n              imcomp_decompress_tile(fptr, irow, thistilesize[0],\n                    datatype, nullcheck, nullval, buffer, bnullarray, &tilenul,\n                     status);\n\n              if (*status == NO_COMPRESSED_TILE)\n              {\n                   /* tile doesn't exist, so initialize to zero */\n                   memset(buffer, 0, pixlen * thistilesize[0]);\n                   *status = 0;\n              }\n\n              /* copy the intersecting pixels to this tile from the input */\n              imcomp_merge_overlap(buffer, pixlen, ndim, tfpixel, tlpixel, \n                     bnullarray, array, fpixel, lpixel, nullcheck, status);\n                     \n             /* Collapse sizes of higher dimension tiles into 2 dimensional\n                equivalents needed by the quantizing algorithms for\n                floating point types */\n              fits_calc_tile_rows(tlpixel, tfpixel, ndim, &trowsize,\n                              &ntrows, status);\n\n              /* compress the tile again, and write it back to the FITS file */\n              imcomp_compress_tile (fptr, irow, datatype, buffer, \n                                    thistilesize[0],\n\t\t\t\t    trowsize,\n\t\t\t\t    ntrows,\n\t\t\t\t    nullcheck, nullval, \n\t\t\t\t    status);\n            }\n          }\n        }\n      }\n     }\n    }\n    free(buffer);\n    \n\n    if ((fptr->Fptr)->zbitpix < 0 && nullcheck != 0) { \n/*\n     This is a floating point FITS image with possible null values.\n     It is too messy to test if any null values are actually written, so \n     just assume so.  We need to make sure that the\n     ZBLANK keyword is present in the compressed image header.  If it is not\n     there then we need to insert the keyword. \n*/   \n        tstatus = 0;\n        ffgcrd(fptr, \"ZBLANK\", card, &tstatus);\n\n\tif (tstatus) {   /* have to insert the ZBLANK keyword */\n           ffgcrd(fptr, \"ZCMPTYPE\", card, status);\n           ffikyj(fptr, \"ZBLANK\", COMPRESS_NULL_VALUE, \n                \"null value in the compressed integer array\", status);\n\t\n           /* set this value into the internal structure; it is used if */\n\t   /* the program reads back the values from the array */\n\t \n          (fptr->Fptr)->zblank = COMPRESS_NULL_VALUE;\n          (fptr->Fptr)->cn_zblank = -1;  /* flag for a constant ZBLANK */\n        }  \n    }  \n    \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_write_compressed_pixels(fitsfile *fptr, /* I - FITS file pointer   */\n            int  datatype,  /* I - datatype of the array to be written      */\n            LONGLONG   fpixel,  /* I - 'first pixel to write          */\n            LONGLONG   npixel,  /* I - number of pixels to write      */\n            int  nullcheck,  /* I - 0 for no null checking                   */\n                             /*     1: pixels that are = nullval will be     */\n                             /*     written with the FITS null pixel value   */\n                             /*     (floating point arrays only)             */\n            void *array,      /* I - array of values to write                */\n            void *nullval,    /* I - value used to represent undefined pixels*/\n            int  *status)     /* IO - error status                           */\n/*\n   Write a consecutive set of pixels to a compressed image.  This routine\n   interpretes the n-dimensional image as a long one-dimensional array. \n   This is actually a rather inconvenient way to write compressed images in\n   general, and could be rather inefficient if the requested pixels to be\n   written are located in many different image compression tiles.    \n\n   The general strategy used here is to write the requested pixels in blocks\n   that correspond to rectangular image sections.  \n*/\n{\n    int naxis, ii, bytesperpixel;\n    long naxes[MAX_COMPRESS_DIM], nread;\n    LONGLONG tfirst, tlast, last0, last1, dimsize[MAX_COMPRESS_DIM];\n    long nplane, firstcoord[MAX_COMPRESS_DIM], lastcoord[MAX_COMPRESS_DIM];\n    char *arrayptr;\n\n    if (*status > 0)\n        return(*status);\n\n    arrayptr = (char *) array;\n\n    /* get size of array pixels, in bytes */\n    bytesperpixel = ffpxsz(datatype);\n\n    for (ii = 0; ii < MAX_COMPRESS_DIM; ii++)\n    {\n        naxes[ii] = 1;\n        firstcoord[ii] = 0;\n        lastcoord[ii] = 0;\n    }\n\n    /*  determine the dimensions of the image to be written */\n    ffgidm(fptr, &naxis, status);\n    ffgisz(fptr, MAX_COMPRESS_DIM, naxes, status);\n\n    /* calc the cumulative number of pixels in each successive dimension */\n    dimsize[0] = 1;\n    for (ii = 1; ii < MAX_COMPRESS_DIM; ii++)\n         dimsize[ii] = dimsize[ii - 1] * naxes[ii - 1];\n\n    /*  determine the coordinate of the first and last pixel in the image */\n    /*  Use zero based indexes here */\n    tfirst = fpixel - 1;\n    tlast = tfirst + npixel - 1;\n    for (ii = naxis - 1; ii >= 0; ii--)\n    {\n        firstcoord[ii] = (long) (tfirst / dimsize[ii]);\n        lastcoord[ii]  = (long) (tlast / dimsize[ii]);\n        tfirst = tfirst - firstcoord[ii] * dimsize[ii];\n        tlast = tlast - lastcoord[ii] * dimsize[ii];\n    }\n\n    /* to simplify things, treat 1-D, 2-D, and 3-D images as separate cases */\n\n    if (naxis == 1)\n    {\n        /* Simple: just write the requested range of pixels */\n\n        firstcoord[0] = firstcoord[0] + 1;\n        lastcoord[0] = lastcoord[0] + 1;\n        fits_write_compressed_img(fptr, datatype, firstcoord, lastcoord,\n            nullcheck, array, nullval, status);\n        return(*status);\n    }\n    else if (naxis == 2)\n    {\n        nplane = 0;  /* write 1st (and only) plane of the image */\n        fits_write_compressed_img_plane(fptr, datatype, bytesperpixel,\n          nplane, firstcoord, lastcoord, naxes, nullcheck,\n          array, nullval, &nread, status);\n    }\n    else if (naxis == 3)\n    {\n        /* test for special case: writing an integral number of planes */\n        if (firstcoord[0] == 0 && firstcoord[1] == 0 &&\n            lastcoord[0] == naxes[0] - 1 && lastcoord[1] == naxes[1] - 1)\n        {\n            for (ii = 0; ii < MAX_COMPRESS_DIM; ii++)\n            {\n                /* convert from zero base to 1 base */\n                (firstcoord[ii])++;\n                (lastcoord[ii])++;\n            }\n\n            /* we can write the contiguous block of pixels in one go */\n            fits_write_compressed_img(fptr, datatype, firstcoord, lastcoord,\n                nullcheck, array, nullval, status);\n            return(*status);\n        }\n\n        /* save last coordinate in temporary variables */\n        last0 = lastcoord[0];\n        last1 = lastcoord[1];\n\n        if (firstcoord[2] < lastcoord[2])\n        {\n            /* we will write up to the last pixel in all but the last plane */\n            lastcoord[0] = naxes[0] - 1;\n            lastcoord[1] = naxes[1] - 1;\n        }\n\n        /* write one plane of the cube at a time, for simplicity */\n        for (nplane = firstcoord[2]; nplane <= lastcoord[2]; nplane++)\n        {\n            if (nplane == lastcoord[2])\n            {\n                lastcoord[0] = (long) last0;\n                lastcoord[1] = (long) last1;\n            }\n\n            fits_write_compressed_img_plane(fptr, datatype, bytesperpixel,\n              nplane, firstcoord, lastcoord, naxes, nullcheck,\n              arrayptr, nullval, &nread, status);\n\n            /* for all subsequent planes, we start with the first pixel */\n            firstcoord[0] = 0;\n            firstcoord[1] = 0;\n\n            /* increment pointers to next elements to be written */\n            arrayptr = arrayptr + nread * bytesperpixel;\n        }\n    }\n    else\n    {\n        ffpmsg(\"only 1D, 2D, or 3D images are currently supported\");\n        return(*status = DATA_COMPRESSION_ERR);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_write_compressed_img_plane(fitsfile *fptr, /* I - FITS file    */\n            int  datatype,  /* I - datatype of the array to be written    */\n            int  bytesperpixel, /* I - number of bytes per pixel in array */\n            long   nplane,  /* I - which plane of the cube to write      */\n            long *firstcoord, /* I coordinate of first pixel to write */\n            long *lastcoord,  /* I coordinate of last pixel to write */\n            long *naxes,     /* I size of each image dimension */\n            int  nullcheck,  /* I - 0 for no null checking                   */\n                             /*     1: pixels that are = nullval will be     */\n                             /*     written with the FITS null pixel value   */\n                             /*     (floating point arrays only)             */\n            void *array,      /* I - array of values that are written        */\n            void *nullval,    /* I - value for undefined pixels              */\n            long *nread,      /* O - total number of pixels written          */\n            int  *status)     /* IO - error status                           */\n\n   /*\n           in general we have to write the first partial row of the image,\n           followed by the middle complete rows, followed by the last\n           partial row of the image.  If the first or last rows are complete,\n           then write them at the same time as all the middle rows.\n    */\n{\n    /* bottom left coord. and top right coord. */\n    long blc[MAX_COMPRESS_DIM], trc[MAX_COMPRESS_DIM]; \n    char *arrayptr;\n\n    *nread = 0;\n\n    arrayptr = (char *) array;\n\n    blc[2] = nplane + 1;\n    trc[2] = nplane + 1;\n\n    if (firstcoord[0] != 0)\n    { \n            /* have to read a partial first row */\n            blc[0] = firstcoord[0] + 1;\n            blc[1] = firstcoord[1] + 1;\n            trc[1] = blc[1];  \n            if (lastcoord[1] == firstcoord[1])\n               trc[0] = lastcoord[0] + 1; /* 1st and last pixels in same row */\n            else\n               trc[0] = naxes[0];  /* read entire rest of the row */\n\n            fits_write_compressed_img(fptr, datatype, blc, trc,\n                nullcheck, arrayptr, nullval, status);\n\n            *nread = *nread + trc[0] - blc[0] + 1;\n\n            if (lastcoord[1] == firstcoord[1])\n            {\n               return(*status);  /* finished */\n            }\n\n            /* set starting coord to beginning of next line */\n            firstcoord[0] = 0;\n            firstcoord[1] += 1;\n            arrayptr = arrayptr + (trc[0] - blc[0] + 1) * bytesperpixel;\n    }\n\n    /* write contiguous complete rows of the image, if any */\n    blc[0] = 1;\n    blc[1] = firstcoord[1] + 1;\n    trc[0] = naxes[0];\n\n    if (lastcoord[0] + 1 == naxes[0])\n    {\n            /* can write the last complete row, too */\n            trc[1] = lastcoord[1] + 1;\n    }\n    else\n    {\n            /* last row is incomplete; have to read it separately */\n            trc[1] = lastcoord[1];\n    }\n\n    if (trc[1] >= blc[1])  /* must have at least one whole line to read */\n    {\n        fits_write_compressed_img(fptr, datatype, blc, trc,\n                nullcheck, arrayptr, nullval, status);\n\n        *nread = *nread + (trc[1] - blc[1] + 1) * naxes[0];\n\n        if (lastcoord[1] + 1 == trc[1])\n               return(*status);  /* finished */\n\n        /* increment pointers for the last partial row */\n        arrayptr = arrayptr + (trc[1] - blc[1] + 1) * naxes[0] * bytesperpixel;\n\n     }\n\n    if (trc[1] == lastcoord[1] + 1)\n        return(*status);           /* all done */\n\n    /* set starting and ending coord to last line */\n\n    trc[0] = lastcoord[0] + 1;\n    trc[1] = lastcoord[1] + 1;\n    blc[1] = trc[1];\n\n    fits_write_compressed_img(fptr, datatype, blc, trc,\n                nullcheck, arrayptr, nullval, status);\n\n    *nread = *nread + trc[0] - blc[0] + 1;\n\n    return(*status);\n}\n\n/* ######################################################################## */\n/* ###                 Image Decompression Routines                     ### */\n/* ######################################################################## */\n\n/*--------------------------------------------------------------------------*/\nint fits_img_decompress (fitsfile *infptr, /* image (bintable) to uncompress */\n              fitsfile *outfptr,   /* empty HDU for output uncompressed image */\n              int *status)         /* IO - error status               */\n\n/* \n  This routine decompresses the whole image and writes it to the output file.\n*/\n\n{\n    int ii, datatype = 0;\n    int nullcheck, anynul;\n    LONGLONG fpixel[MAX_COMPRESS_DIM], lpixel[MAX_COMPRESS_DIM];\n    long inc[MAX_COMPRESS_DIM];\n    long imgsize;\n    float *nulladdr, fnulval;\n    double dnulval;\n\n    if (fits_img_decompress_header(infptr, outfptr, status) > 0)\n    {\n    \treturn (*status);\n    }\n\n    /* force a rescan of the output header keywords, then reset the scaling */\n    /* in case the BSCALE and BZERO keywords are present, so that the       */\n    /* decompressed values won't be scaled when written to the output image */\n    ffrdef(outfptr, status);\n    ffpscl(outfptr, 1.0, 0.0, status);\n    ffpscl(infptr, 1.0, 0.0, status);\n\n    /* initialize; no null checking is needed for integer images */\n    nullcheck = 0;\n    nulladdr =  &fnulval;\n\n    /* determine datatype for image */\n    if ((infptr->Fptr)->zbitpix == BYTE_IMG)\n    {\n        datatype = TBYTE;\n    }\n    else if ((infptr->Fptr)->zbitpix == SHORT_IMG)\n    {\n        datatype = TSHORT;\n    }\n    else if ((infptr->Fptr)->zbitpix == LONG_IMG)\n    {\n        datatype = TINT;\n    }\n    else if ((infptr->Fptr)->zbitpix == FLOAT_IMG)\n    {\n        /* In the case of float images we must check for NaNs  */\n        nullcheck = 1;\n        fnulval = FLOATNULLVALUE;\n        nulladdr =  &fnulval;\n        datatype = TFLOAT;\n    }\n    else if ((infptr->Fptr)->zbitpix == DOUBLE_IMG)\n    {\n        /* In the case of double images we must check for NaNs  */\n        nullcheck = 1;\n        dnulval = DOUBLENULLVALUE;\n        nulladdr = (float *) &dnulval;\n        datatype = TDOUBLE;\n    }\n\n    /* calculate size of the image (in pixels) */\n    imgsize = 1;\n    for (ii = 0; ii < (infptr->Fptr)->zndim; ii++)\n    {\n        imgsize *= (infptr->Fptr)->znaxis[ii];\n        fpixel[ii] = 1;              /* Set first and last pixel to */\n        lpixel[ii] = (infptr->Fptr)->znaxis[ii]; /* include the entire image. */\n        inc[ii] = 1;\n    }\n\n    /* uncompress the input image and write to output image, one tile at a time */\n\n    fits_read_write_compressed_img(infptr, datatype, fpixel, lpixel, inc,  \n            nullcheck, nulladdr, &anynul, outfptr, status);\n\n    return (*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_decompress_img (fitsfile *infptr, /* image (bintable) to uncompress */\n              fitsfile *outfptr,   /* empty HDU for output uncompressed image */\n              int *status)         /* IO - error status               */\n\n/* \n  THIS IS AN OBSOLETE ROUTINE.  USE fits_img_decompress instead!!!\n  \n  This routine decompresses the whole image and writes it to the output file.\n*/\n\n{\n    double *data;\n    int ii, datatype = 0, byte_per_pix = 0;\n    int nullcheck, anynul;\n    LONGLONG fpixel[MAX_COMPRESS_DIM], lpixel[MAX_COMPRESS_DIM];\n    long inc[MAX_COMPRESS_DIM];\n    long imgsize, memsize;\n    float *nulladdr, fnulval;\n    double dnulval;\n\n    if (*status > 0)\n        return(*status);\n\n    if (!fits_is_compressed_image(infptr, status) )\n    {\n        ffpmsg(\"CHDU is not a compressed image (fits_decompress_img)\");\n        return(*status = DATA_DECOMPRESSION_ERR);\n    }\n\n    /* create an empty output image with the correct dimensions */\n    if (ffcrim(outfptr, (infptr->Fptr)->zbitpix, (infptr->Fptr)->zndim, \n       (infptr->Fptr)->znaxis, status) > 0)\n    {\n        ffpmsg(\"error creating output decompressed image HDU\");\n    \treturn (*status);\n    }\n    /* Copy the table header to the image header. */\n    if (imcomp_copy_imheader(infptr, outfptr, status) > 0)\n    {\n        ffpmsg(\"error copying header of compressed image\");\n    \treturn (*status);\n    }\n\n    /* force a rescan of the output header keywords, then reset the scaling */\n    /* in case the BSCALE and BZERO keywords are present, so that the       */\n    /* decompressed values won't be scaled when written to the output image */\n    ffrdef(outfptr, status);\n    ffpscl(outfptr, 1.0, 0.0, status);\n    ffpscl(infptr, 1.0, 0.0, status);\n\n    /* initialize; no null checking is needed for integer images */\n    nullcheck = 0;\n    nulladdr =  &fnulval;\n\n    /* determine datatype for image */\n    if ((infptr->Fptr)->zbitpix == BYTE_IMG)\n    {\n        datatype = TBYTE;\n        byte_per_pix = 1;\n    }\n    else if ((infptr->Fptr)->zbitpix == SHORT_IMG)\n    {\n        datatype = TSHORT;\n        byte_per_pix = sizeof(short);\n    }\n    else if ((infptr->Fptr)->zbitpix == LONG_IMG)\n    {\n        datatype = TINT;\n        byte_per_pix = sizeof(int);\n    }\n    else if ((infptr->Fptr)->zbitpix == FLOAT_IMG)\n    {\n        /* In the case of float images we must check for NaNs  */\n        nullcheck = 1;\n        fnulval = FLOATNULLVALUE;\n        nulladdr =  &fnulval;\n        datatype = TFLOAT;\n        byte_per_pix = sizeof(float);\n    }\n    else if ((infptr->Fptr)->zbitpix == DOUBLE_IMG)\n    {\n        /* In the case of double images we must check for NaNs  */\n        nullcheck = 1;\n        dnulval = DOUBLENULLVALUE;\n        nulladdr = (float *) &dnulval;\n        datatype = TDOUBLE;\n        byte_per_pix = sizeof(double);\n    }\n\n    /* calculate size of the image (in pixels) */\n    imgsize = 1;\n    for (ii = 0; ii < (infptr->Fptr)->zndim; ii++)\n    {\n        imgsize *= (infptr->Fptr)->znaxis[ii];\n        fpixel[ii] = 1;              /* Set first and last pixel to */\n        lpixel[ii] = (infptr->Fptr)->znaxis[ii]; /* include the entire image. */\n        inc[ii] = 1;\n    }\n    /* Calc equivalent number of double pixels same size as whole the image. */\n    /* We use double datatype to force the memory to be aligned properly */\n    memsize = ((imgsize * byte_per_pix) - 1) / sizeof(double) + 1;\n\n    /* allocate memory for the image */\n    data = (double*) calloc (memsize, sizeof(double));\n    if (!data)\n    { \n        ffpmsg(\"Couldn't allocate memory for the uncompressed image\");\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    /* uncompress the entire image into memory */\n    /* This routine should be enhanced sometime to only need enough */\n    /* memory to uncompress one tile at a time.  */\n    fits_read_compressed_img(infptr, datatype, fpixel, lpixel, inc,  \n            nullcheck, nulladdr, data, NULL, &anynul, status);\n\n    /* write the image to the output file */\n    if (anynul)\n        fits_write_imgnull(outfptr, datatype, 1, imgsize, data, nulladdr, \n                          status);\n    else\n        fits_write_img(outfptr, datatype, 1, imgsize, data, status);\n\n    free(data);\n    return (*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_img_decompress_header(fitsfile *infptr, /* image (bintable) to uncompress */\n              fitsfile *outfptr,   /* empty HDU for output uncompressed image */\n              int *status)         /* IO - error status               */\n\n/* \n  This routine reads the header of the input tile compressed image and \n  converts it to that of a standard uncompress FITS image.\n*/\n\n{\n    int writeprime = 0;\n    int hdupos, inhdupos, numkeys;\n    int nullprime = 0, copyprime = 0, norec = 0, tstatus;\n    char card[FLEN_CARD];\n    int ii, naxis, bitpix;\n    long naxes[MAX_COMPRESS_DIM];\n\n    if (*status > 0)\n        return(*status);\n    else if (*status == -1) {\n        *status = 0;\n\twriteprime = 1;\n    }\n\n    if (!fits_is_compressed_image(infptr, status) )\n    {\n        ffpmsg(\"CHDU is not a compressed image (fits_img_decompress)\");\n        return(*status = DATA_DECOMPRESSION_ERR);\n    }\n\n    /* get information about the state of the output file; does it already */\n    /* contain any keywords and HDUs?  */\n    fits_get_hdu_num(infptr, &inhdupos);  /* Get the current output HDU position */\n    fits_get_hdu_num(outfptr, &hdupos);  /* Get the current output HDU position */\n    fits_get_hdrspace(outfptr, &numkeys, 0, status);\n\n    /* Was the input compressed HDU originally the primary array image? */\n    tstatus = 0;\n    if (!fits_read_card(infptr, \"ZSIMPLE\", card, &tstatus)) { \n      /* yes, input HDU was a primary array (not an IMAGE extension) */\n      /* Now determine if we can uncompress it into the primary array of */\n      /* the output file.  This is only possible if the output file */\n      /* currently only contains a null primary array, with no addition */\n      /* header keywords and with no following extension in the FITS file. */\n      \n      if (hdupos == 1) {  /* are we positioned at the primary array? */\n            if (numkeys == 0) { /* primary HDU is completely empty */\n\t        nullprime = 1;\n            } else {\n                fits_get_img_param(outfptr, MAX_COMPRESS_DIM, &bitpix, &naxis, naxes, status);\n\t\n\t        if (naxis == 0) { /* is this a null image? */\n                   nullprime = 1;\n\n\t\t   if (inhdupos == 2)  /* must be at the first extension */\n\t\t      copyprime = 1;\n\t\t}\n           }\n      }\n    } \n\n    if (nullprime) {  \n       /* We will delete the existing keywords in the null primary array\n          and uncompress the input image into the primary array of the output.\n\t  Some of these keywords may be added back to the uncompressed image\n\t  header later.\n       */\n\n       for (ii = numkeys; ii > 0; ii--)\n          fits_delete_record(outfptr, ii, status);\n\n    } else  {\n\n       /* if the ZTENSION keyword doesn't exist, then we have to \n          write the required keywords manually */\n       tstatus = 0;\n       if (fits_read_card(infptr, \"ZTENSION\", card, &tstatus)) {\n\n          /* create an empty output image with the correct dimensions */\n          if (ffcrim(outfptr, (infptr->Fptr)->zbitpix, (infptr->Fptr)->zndim, \n             (infptr->Fptr)->znaxis, status) > 0)\n          {\n             ffpmsg(\"error creating output decompressed image HDU\");\n    \t     return (*status);\n          }\n\n\t  norec = 1;  /* the required keywords have already been written */\n\n       } else {  /* the input compressed image does have ZTENSION keyword */\n       \n          if (writeprime) {  /* convert the image extension to a primary array */\n\t      /* have to write the required keywords manually */\n\n              /* create an empty output image with the correct dimensions */\n              if (ffcrim(outfptr, (infptr->Fptr)->zbitpix, (infptr->Fptr)->zndim, \n                 (infptr->Fptr)->znaxis, status) > 0)\n              {\n                 ffpmsg(\"error creating output decompressed image HDU\");\n    \t         return (*status);\n              }\n\n\t      norec = 1;  /* the required keywords have already been written */\n\n          } else {  /* write the input compressed image to an image extension */\n\n              if (numkeys == 0) {  /* the output file is currently completely empty */\n\t  \n\t         /* In this case, the input is a compressed IMAGE extension. */\n\t         /* Since the uncompressed output file is currently completely empty, */\n\t         /* we need to write a null primary array before uncompressing the */\n                 /* image extension */\n\t     \n                 ffcrim(outfptr, 8, 0, naxes, status); /* naxes is not used */\n\t     \n\t         /* now create the empty extension to uncompress into */\n                 if (fits_create_hdu(outfptr, status) > 0)\n                 {\n                      ffpmsg(\"error creating output decompressed image HDU\");\n    \t              return (*status);\n                 }\n\t  \n\t      } else {\n                  /* just create a new empty extension, then copy all the required */\n\t          /* keywords into it.  */\n                 fits_create_hdu(outfptr, status);\n\t      }\n           }\n       }\n\n    }\n\n    if (*status > 0)  {\n        ffpmsg(\"error creating output decompressed image HDU\");\n    \treturn (*status);\n    }\n\n    /* Copy the table header to the image header. */\n\n    if (imcomp_copy_comp2img(infptr, outfptr, norec, status) > 0)\n    {\n        ffpmsg(\"error copying header keywords from compressed image\");\n    }\n\n    if (copyprime) {  \n\t/* append any unexpected keywords from the primary array.\n\t   This includes any keywords except SIMPLE, BITPIX, NAXIS,\n\t   EXTEND, COMMENT, HISTORY, CHECKSUM, and DATASUM.\n\t*/\n\n        fits_movabs_hdu(infptr, 1, NULL, status);  /* move to primary array */\n\t\n        /* do this so that any new keywords get written before any blank\n\t   keywords that may have been appended by imcomp_copy_comp2img  */\n        fits_set_hdustruc(outfptr, status);\n\n        if (imcomp_copy_prime2img(infptr, outfptr, status) > 0)\n        {\n            ffpmsg(\"error copying primary keywords from compressed file\");\n        }\n\n        fits_movabs_hdu(infptr, 2, NULL, status); /* move back to where we were */\n    }\n\n    return (*status);\n}\n/*---------------------------------------------------------------------------*/\nint fits_read_compressed_img(fitsfile *fptr,   /* I - FITS file pointer      */\n            int  datatype,  /* I - datatype of the array to be returned      */\n            LONGLONG  *infpixel, /* I - 'bottom left corner' of the subsection    */\n            LONGLONG  *inlpixel, /* I - 'top right corner' of the subsection      */\n            long  *ininc,    /* I - increment to be applied in each dimension */\n            int  nullcheck,  /* I - 0 for no null checking                   */\n                              /*     1: set undefined pixels = nullval       */\n                              /*     2: set nullarray=1 for undefined pixels */\n            void *nullval,    /* I - value for undefined pixels              */\n            void *array,      /* O - array of values that are returned       */\n            char *nullarray,  /* O - array of flags = 1 if nullcheck = 2     */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n   Read a section of a compressed image;  Note: lpixel may be larger than the \n   size of the uncompressed image.  Only the pixels within the image will be\n   returned.\n*/\n{\n    long naxis[MAX_COMPRESS_DIM], tiledim[MAX_COMPRESS_DIM];\n    long tilesize[MAX_COMPRESS_DIM], thistilesize[MAX_COMPRESS_DIM];\n    long ftile[MAX_COMPRESS_DIM], ltile[MAX_COMPRESS_DIM];\n    long tfpixel[MAX_COMPRESS_DIM], tlpixel[MAX_COMPRESS_DIM];\n    long rowdim[MAX_COMPRESS_DIM], offset[MAX_COMPRESS_DIM],ntemp;\n    long fpixel[MAX_COMPRESS_DIM], lpixel[MAX_COMPRESS_DIM];\n    long inc[MAX_COMPRESS_DIM];\n    long i5, i4, i3, i2, i1, i0, irow;\n    int ii, ndim, pixlen, tilenul=0;\n    void *buffer;\n    char *bnullarray = 0;\n    double testnullval = 0.;\n\n    if (*status > 0) \n        return(*status);\n\n    if (!fits_is_compressed_image(fptr, status) )\n    {\n        ffpmsg(\"CHDU is not a compressed image (fits_read_compressed_img)\");\n        return(*status = DATA_DECOMPRESSION_ERR);\n    }\n\n    /* get temporary space for uncompressing one image tile */\n    if (datatype == TSHORT)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (short)); \n       pixlen = sizeof(short);\n       if (nullval)\n           testnullval = *(short *) nullval;\n    }\n    else if (datatype == TINT)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (int));\n       pixlen = sizeof(int);\n       if (nullval)\n           testnullval = *(int *) nullval;\n    }\n    else if (datatype == TLONG)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (long));\n       pixlen = sizeof(long);\n       if (nullval)\n           testnullval = *(long *) nullval;\n    }\n    else if (datatype == TFLOAT)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (float));\n       pixlen = sizeof(float);\n       if (nullval)\n           testnullval = *(float *) nullval;\n    }\n    else if (datatype == TDOUBLE)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (double));\n       pixlen = sizeof(double);\n       if (nullval)\n           testnullval = *(double *) nullval;\n    }\n    else if (datatype == TUSHORT)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (unsigned short));\n       pixlen = sizeof(short);\n       if (nullval)\n           testnullval = *(unsigned short *) nullval;\n    }\n    else if (datatype == TUINT)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (unsigned int));\n       pixlen = sizeof(int);\n       if (nullval)\n           testnullval = *(unsigned int *) nullval;\n    }\n    else if (datatype == TULONG)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (unsigned long));\n       pixlen = sizeof(long);\n       if (nullval)\n           testnullval = *(unsigned long *) nullval;\n    }\n    else if (datatype == TBYTE || datatype == TSBYTE)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (char));\n       pixlen = 1;\n       if (nullval)\n           testnullval = *(unsigned char *) nullval;\n    }\n    else\n    {\n        ffpmsg(\"unsupported datatype for uncompressing image\");\n        return(*status = BAD_DATATYPE);\n    }\n\n    /* If nullcheck ==1 and nullval == 0, then this means that the */\n    /* calling routine does not want to check for null pixels in the array */\n    if (nullcheck == 1 && testnullval == 0.)\n        nullcheck = 0;\n\n    if (buffer == NULL)\n    {\n\t    ffpmsg(\"Out of memory (fits_read_compress_img)\");\n\t    return (*status = MEMORY_ALLOCATION);\n    }\n\t\n    /* allocate memory for a null flag array, if needed */\n    if (nullcheck == 2)\n    {\n        bnullarray = calloc ((fptr->Fptr)->maxtilelen, sizeof (char));\n\n        if (bnullarray == NULL)\n        {\n\t    ffpmsg(\"Out of memory (fits_read_compress_img)\");\n            free(buffer);\n\t    return (*status = MEMORY_ALLOCATION);\n        }\n    }\n\n    /* initialize all the arrays */\n    for (ii = 0; ii < MAX_COMPRESS_DIM; ii++)\n    {\n        naxis[ii] = 1;\n        tiledim[ii] = 1;\n        tilesize[ii] = 1;\n        ftile[ii] = 1;\n        ltile[ii] = 1;\n        rowdim[ii] = 1;\n    }\n\n    ndim = (fptr->Fptr)->zndim;\n    ntemp = 1;\n    for (ii = 0; ii < ndim; ii++)\n    {\n        /* support for mirror-reversed image sections */\n        if (infpixel[ii] <= inlpixel[ii])\n        {\n           fpixel[ii] = (long) infpixel[ii];\n           lpixel[ii] = (long) inlpixel[ii];\n           inc[ii]    = ininc[ii];\n        }\n        else\n        {\n           fpixel[ii] = (long) inlpixel[ii];\n           lpixel[ii] = (long) infpixel[ii];\n           inc[ii]    = -ininc[ii];\n        }\n\n        /* calc number of tiles in each dimension, and tile containing */\n        /* the first and last pixel we want to read in each dimension  */\n        naxis[ii] = (fptr->Fptr)->znaxis[ii];\n        if (fpixel[ii] < 1)\n        {\n            if (nullcheck == 2)\n            {\n                free(bnullarray);\n            }\n            free(buffer);\n            return(*status = BAD_PIX_NUM);\n        }\n\n        tilesize[ii] = (fptr->Fptr)->tilesize[ii];\n        tiledim[ii] = (naxis[ii] - 1) / tilesize[ii] + 1;\n        ftile[ii]   = (fpixel[ii] - 1)   / tilesize[ii] + 1;\n        ltile[ii]   = minvalue((lpixel[ii] - 1) / tilesize[ii] + 1, \n                                tiledim[ii]);\n        rowdim[ii]  = ntemp;  /* total tiles in each dimension */\n        ntemp *= tiledim[ii];\n    }\n\n    if (anynul)\n       *anynul = 0;  /* initialize */\n\n    /* support up to 6 dimensions for now */\n    /* tfpixel and tlpixel are the first and last image pixels */\n    /* along each dimension of the compression tile */\n    for (i5 = ftile[5]; i5 <= ltile[5]; i5++)\n    {\n     tfpixel[5] = (i5 - 1) * tilesize[5] + 1;\n     tlpixel[5] = minvalue(tfpixel[5] + tilesize[5] - 1, \n                            naxis[5]);\n     thistilesize[5] = tlpixel[5] - tfpixel[5] + 1;\n     offset[5] = (i5 - 1) * rowdim[5];\n     for (i4 = ftile[4]; i4 <= ltile[4]; i4++)\n     {\n      tfpixel[4] = (i4 - 1) * tilesize[4] + 1;\n      tlpixel[4] = minvalue(tfpixel[4] + tilesize[4] - 1, \n                            naxis[4]);\n      thistilesize[4] = thistilesize[5] * (tlpixel[4] - tfpixel[4] + 1);\n      offset[4] = (i4 - 1) * rowdim[4] + offset[5];\n      for (i3 = ftile[3]; i3 <= ltile[3]; i3++)\n      {\n        tfpixel[3] = (i3 - 1) * tilesize[3] + 1;\n        tlpixel[3] = minvalue(tfpixel[3] + tilesize[3] - 1, \n                              naxis[3]);\n        thistilesize[3] = thistilesize[4] * (tlpixel[3] - tfpixel[3] + 1);\n        offset[3] = (i3 - 1) * rowdim[3] + offset[4];\n        for (i2 = ftile[2]; i2 <= ltile[2]; i2++)\n        {\n          tfpixel[2] = (i2 - 1) * tilesize[2] + 1;\n          tlpixel[2] = minvalue(tfpixel[2] + tilesize[2] - 1, \n                                naxis[2]);\n          thistilesize[2] = thistilesize[3] * (tlpixel[2] - tfpixel[2] + 1);\n          offset[2] = (i2 - 1) * rowdim[2] + offset[3];\n          for (i1 = ftile[1]; i1 <= ltile[1]; i1++)\n          {\n            tfpixel[1] = (i1 - 1) * tilesize[1] + 1;\n            tlpixel[1] = minvalue(tfpixel[1] + tilesize[1] - 1, \n                                  naxis[1]);\n            thistilesize[1] = thistilesize[2] * (tlpixel[1] - tfpixel[1] + 1);\n            offset[1] = (i1 - 1) * rowdim[1] + offset[2];\n            for (i0 = ftile[0]; i0 <= ltile[0]; i0++)\n            {\n             tfpixel[0] = (i0 - 1) * tilesize[0] + 1;\n             tlpixel[0] = minvalue(tfpixel[0] + tilesize[0] - 1, \n                                    naxis[0]);\n              thistilesize[0] = thistilesize[1] * (tlpixel[0] - tfpixel[0] + 1);\n              /* calculate row of table containing this tile */\n              irow = i0 + offset[1];\n\n/*\nprintf(\"row %d, %d %d, %d %d, %d %d; %d\\n\",\n              irow, tfpixel[0],tlpixel[0],tfpixel[1],tlpixel[1],tfpixel[2],tlpixel[2],\n\t      thistilesize[0]);\n*/   \n              /* test if there are any intersecting pixels in this tile and the output image */\n              if (imcomp_test_overlap(ndim, tfpixel, tlpixel, \n                      fpixel, lpixel, inc, status)) {\n                  /* read and uncompress this row (tile) of the table */\n                  /* also do type conversion and undefined pixel substitution */\n                  /* at this point */\n\n                  imcomp_decompress_tile(fptr, irow, thistilesize[0],\n                    datatype, nullcheck, nullval, buffer, bnullarray, &tilenul,\n                     status);\n\n                  if (tilenul && anynul)\n                      *anynul = 1;  /* there are null pixels */\n/*\nprintf(\" pixlen=%d, ndim=%d, %d %d %d, %d %d %d, %d %d %d\\n\",\n     pixlen, ndim, fpixel[0],lpixel[0],inc[0],fpixel[1],lpixel[1],inc[1],\n     fpixel[2],lpixel[2],inc[2]);\n*/\n                  /* copy the intersecting pixels from this tile to the output */\n                  imcomp_copy_overlap(buffer, pixlen, ndim, tfpixel, tlpixel, \n                     bnullarray, array, fpixel, lpixel, inc, nullcheck, \n                     nullarray, status);\n               }\n            }\n          }\n        }\n      }\n     }\n    }\n    if (nullcheck == 2)\n    {\n        free(bnullarray);\n    }\n    free(buffer);\n\n    return(*status);\n}\n/*---------------------------------------------------------------------------*/\nint fits_read_write_compressed_img(fitsfile *fptr,   /* I - FITS file pointer      */\n            int  datatype,  /* I - datatype of the array to be returned      */\n            LONGLONG  *infpixel, /* I - 'bottom left corner' of the subsection    */\n            LONGLONG  *inlpixel, /* I - 'top right corner' of the subsection      */\n            long  *ininc,    /* I - increment to be applied in each dimension */\n            int  nullcheck,  /* I - 0 for no null checking                   */\n                              /*     1: set undefined pixels = nullval       */\n            void *nullval,    /* I - value for undefined pixels              */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            fitsfile *outfptr,   /* I - FITS file pointer                    */\n            int  *status)     /* IO - error status                           */\n/*\n   This is similar to fits_read_compressed_img, except that it writes\n   the pixels to the output image, on a tile by tile basis instead of returning\n   the array.\n*/\n{\n    long naxis[MAX_COMPRESS_DIM], tiledim[MAX_COMPRESS_DIM];\n    long tilesize[MAX_COMPRESS_DIM], thistilesize[MAX_COMPRESS_DIM];\n    long ftile[MAX_COMPRESS_DIM], ltile[MAX_COMPRESS_DIM];\n    long tfpixel[MAX_COMPRESS_DIM], tlpixel[MAX_COMPRESS_DIM];\n    long rowdim[MAX_COMPRESS_DIM], offset[MAX_COMPRESS_DIM],ntemp;\n    long fpixel[MAX_COMPRESS_DIM], lpixel[MAX_COMPRESS_DIM];\n    long inc[MAX_COMPRESS_DIM];\n    long i5, i4, i3, i2, i1, i0, irow;\n    int ii, ndim, tilenul;\n    void *buffer;\n    char *bnullarray = 0, *cnull;\n    LONGLONG firstelem;\n\n    if (*status > 0) \n        return(*status);\n\n    if (!fits_is_compressed_image(fptr, status) )\n    {\n        ffpmsg(\"CHDU is not a compressed image (fits_read_compressed_img)\");\n        return(*status = DATA_DECOMPRESSION_ERR);\n    }\n\n    cnull = (char *) nullval;  /* used to test if the nullval = 0 */\n    \n    /* get temporary space for uncompressing one image tile */\n    /* If nullval == 0, then this means that the */\n    /* calling routine does not want to check for null pixels in the array */\n    if (datatype == TSHORT)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (short)); \n       if (cnull) {\n         if (cnull[0] == 0 && cnull[1] == 0 ) {\n           nullcheck = 0;\n\t }\n       }\n    }\n    else if (datatype == TINT)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (int));\n       if (cnull) {\n         if (cnull[0] == 0 && cnull[1] == 0 && cnull[2] == 0 && cnull[3] == 0 ) {\n           nullcheck = 0;\n\t }\n       }\n    }\n    else if (datatype == TLONG)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (long));\n       if (cnull) {\n         if (cnull[0] == 0 && cnull[1] == 0 && cnull[2] == 0 && cnull[3] == 0 ) {\n           nullcheck = 0;\n\t }\n       }\n    }\n    else if (datatype == TFLOAT)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (float));\n       if (cnull) {\n         if (cnull[0] == 0 && cnull[1] == 0 && cnull[2] == 0 && cnull[3] == 0  ) {\n           nullcheck = 0;\n\t }\n       }\n    }\n    else if (datatype == TDOUBLE)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (double));\n       if (cnull) {\n         if (cnull[0] == 0 && cnull[1] == 0 && cnull[2] == 0 && cnull[3] == 0 &&\n\t     cnull[4] == 0 && cnull[5] == 0 && cnull[6] == 0 && cnull[7] == 0 ) {\n           nullcheck = 0;\n\t }\n       }\n    }\n    else if (datatype == TUSHORT)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (unsigned short));\n       if (cnull) {\n         if (cnull[0] == 0 && cnull[1] == 0 ){\n           nullcheck = 0;\n\t }\n       }\n    }\n    else if (datatype == TUINT)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (unsigned int));\n       if (cnull) {\n         if (cnull[0] == 0 && cnull[1] == 0 && cnull[2] == 0 && cnull[3] == 0 ){\n           nullcheck = 0;\n\t }\n       }\n    }\n    else if (datatype == TULONG)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (unsigned long));\n       if (cnull) {\n         if (cnull[0] == 0 && cnull[1] == 0 && cnull[2] == 0 && cnull[3] == 0 ){\n           nullcheck = 0;\n\t }\n       }\n    }\n    else if (datatype == TBYTE || datatype == TSBYTE)\n    {\n       buffer =  malloc ((fptr->Fptr)->maxtilelen * sizeof (char));\n       if (cnull) {\n         if (cnull[0] == 0){\n           nullcheck = 0;\n\t }\n       }\n    }\n    else\n    {\n        ffpmsg(\"unsupported datatype for uncompressing image\");\n        return(*status = BAD_DATATYPE);\n    }\n\n    if (buffer == NULL)\n    {\n\t    ffpmsg(\"Out of memory (fits_read_compress_img)\");\n\t    return (*status = MEMORY_ALLOCATION);\n    }\n\n    /* initialize all the arrays */\n    for (ii = 0; ii < MAX_COMPRESS_DIM; ii++)\n    {\n        naxis[ii] = 1;\n        tiledim[ii] = 1;\n        tilesize[ii] = 1;\n        ftile[ii] = 1;\n        ltile[ii] = 1;\n        rowdim[ii] = 1;\n    }\n\n    ndim = (fptr->Fptr)->zndim;\n    ntemp = 1;\n    for (ii = 0; ii < ndim; ii++)\n    {\n        /* support for mirror-reversed image sections */\n        if (infpixel[ii] <= inlpixel[ii])\n        {\n           fpixel[ii] = (long) infpixel[ii];\n           lpixel[ii] = (long) inlpixel[ii];\n           inc[ii]    = ininc[ii];\n        }\n        else\n        {\n           fpixel[ii] = (long) inlpixel[ii];\n           lpixel[ii] = (long) infpixel[ii];\n           inc[ii]    = -ininc[ii];\n        }\n\n        /* calc number of tiles in each dimension, and tile containing */\n        /* the first and last pixel we want to read in each dimension  */\n        naxis[ii] = (fptr->Fptr)->znaxis[ii];\n        if (fpixel[ii] < 1)\n        {\n            free(buffer);\n            return(*status = BAD_PIX_NUM);\n        }\n\n        tilesize[ii] = (fptr->Fptr)->tilesize[ii];\n        tiledim[ii] = (naxis[ii] - 1) / tilesize[ii] + 1;\n        ftile[ii]   = (fpixel[ii] - 1)   / tilesize[ii] + 1;\n        ltile[ii]   = minvalue((lpixel[ii] - 1) / tilesize[ii] + 1, \n                                tiledim[ii]);\n        rowdim[ii]  = ntemp;  /* total tiles in each dimension */\n        ntemp *= tiledim[ii];\n    }\n\n    if (anynul)\n       *anynul = 0;  /* initialize */\n\n    firstelem = 1;\n\n    /* support up to 6 dimensions for now */\n    /* tfpixel and tlpixel are the first and last image pixels */\n    /* along each dimension of the compression tile */\n    for (i5 = ftile[5]; i5 <= ltile[5]; i5++)\n    {\n     tfpixel[5] = (i5 - 1) * tilesize[5] + 1;\n     tlpixel[5] = minvalue(tfpixel[5] + tilesize[5] - 1, \n                            naxis[5]);\n     thistilesize[5] = tlpixel[5] - tfpixel[5] + 1;\n     offset[5] = (i5 - 1) * rowdim[5];\n     for (i4 = ftile[4]; i4 <= ltile[4]; i4++)\n     {\n      tfpixel[4] = (i4 - 1) * tilesize[4] + 1;\n      tlpixel[4] = minvalue(tfpixel[4] + tilesize[4] - 1, \n                            naxis[4]);\n      thistilesize[4] = thistilesize[5] * (tlpixel[4] - tfpixel[4] + 1);\n      offset[4] = (i4 - 1) * rowdim[4] + offset[5];\n      for (i3 = ftile[3]; i3 <= ltile[3]; i3++)\n      {\n        tfpixel[3] = (i3 - 1) * tilesize[3] + 1;\n        tlpixel[3] = minvalue(tfpixel[3] + tilesize[3] - 1, \n                              naxis[3]);\n        thistilesize[3] = thistilesize[4] * (tlpixel[3] - tfpixel[3] + 1);\n        offset[3] = (i3 - 1) * rowdim[3] + offset[4];\n        for (i2 = ftile[2]; i2 <= ltile[2]; i2++)\n        {\n          tfpixel[2] = (i2 - 1) * tilesize[2] + 1;\n          tlpixel[2] = minvalue(tfpixel[2] + tilesize[2] - 1, \n                                naxis[2]);\n          thistilesize[2] = thistilesize[3] * (tlpixel[2] - tfpixel[2] + 1);\n          offset[2] = (i2 - 1) * rowdim[2] + offset[3];\n          for (i1 = ftile[1]; i1 <= ltile[1]; i1++)\n          {\n            tfpixel[1] = (i1 - 1) * tilesize[1] + 1;\n            tlpixel[1] = minvalue(tfpixel[1] + tilesize[1] - 1, \n                                  naxis[1]);\n            thistilesize[1] = thistilesize[2] * (tlpixel[1] - tfpixel[1] + 1);\n            offset[1] = (i1 - 1) * rowdim[1] + offset[2];\n            for (i0 = ftile[0]; i0 <= ltile[0]; i0++)\n            {\n              tfpixel[0] = (i0 - 1) * tilesize[0] + 1;\n              tlpixel[0] = minvalue(tfpixel[0] + tilesize[0] - 1, \n                                    naxis[0]);\n              thistilesize[0] = thistilesize[1] * (tlpixel[0] - tfpixel[0] + 1);\n              /* calculate row of table containing this tile */\n              irow = i0 + offset[1];\n \n              /* read and uncompress this row (tile) of the table */\n              /* also do type conversion and undefined pixel substitution */\n              /* at this point */\n\n              imcomp_decompress_tile(fptr, irow, thistilesize[0],\n                    datatype, nullcheck, nullval, buffer, bnullarray, &tilenul,\n                     status);\n\n               /* write the image to the output file */\n\n              if (tilenul && anynul) {     \n                   /* this assumes that the tiled pixels are in the same order\n\t\t      as in the uncompressed FITS image.  This is not necessarily\n\t\t      the case, but it almost alway is in practice.  \n\t\t      Note that null checking is not performed for integer images,\n\t\t      so this could only be a problem for tile compressed floating\n\t\t      point images that use an unconventional tiling pattern.\n\t\t   */\n                   fits_write_imgnull(outfptr, datatype, firstelem, thistilesize[0],\n\t\t      buffer, nullval, status);\n              } else {\n                  fits_write_subset(outfptr, datatype, tfpixel, tlpixel, \n\t\t      buffer, status);\n              }\n\n              firstelem += thistilesize[0];\n\n            }\n          }\n        }\n      }\n     }\n    }\n\n    free(buffer);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_read_compressed_pixels(fitsfile *fptr, /* I - FITS file pointer    */\n            int  datatype,  /* I - datatype of the array to be returned     */\n            LONGLONG   fpixel, /* I - 'first pixel to read          */\n            LONGLONG   npixel,  /* I - number of pixels to read      */\n            int  nullcheck,  /* I - 0 for no null checking                   */\n                              /*     1: set undefined pixels = nullval       */\n                              /*     2: set nullarray=1 for undefined pixels */\n            void *nullval,    /* I - value for undefined pixels              */\n            void *array,      /* O - array of values that are returned       */\n            char *nullarray,  /* O - array of flags = 1 if nullcheck = 2     */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n   Read a consecutive set of pixels from a compressed image.  This routine\n   interpretes the n-dimensional image as a long one-dimensional array. \n   This is actually a rather inconvenient way to read compressed images in\n   general, and could be rather inefficient if the requested pixels to be\n   read are located in many different image compression tiles.    \n\n   The general strategy used here is to read the requested pixels in blocks\n   that correspond to rectangular image sections.  \n*/\n{\n    int naxis, ii, bytesperpixel, planenul;\n    long naxes[MAX_COMPRESS_DIM], nread;\n    long nplane, inc[MAX_COMPRESS_DIM];\n    LONGLONG tfirst, tlast, last0, last1, dimsize[MAX_COMPRESS_DIM];\n    LONGLONG firstcoord[MAX_COMPRESS_DIM], lastcoord[MAX_COMPRESS_DIM];\n    char *arrayptr, *nullarrayptr;\n\n    if (*status > 0)\n        return(*status);\n\n    arrayptr = (char *) array;\n    nullarrayptr = nullarray;\n\n    /* get size of array pixels, in bytes */\n    bytesperpixel = ffpxsz(datatype);\n\n    for (ii = 0; ii < MAX_COMPRESS_DIM; ii++)\n    {\n        naxes[ii] = 1;\n        firstcoord[ii] = 0;\n        lastcoord[ii] = 0;\n        inc[ii] = 1;\n    }\n\n    /*  determine the dimensions of the image to be read */\n    ffgidm(fptr, &naxis, status);\n    ffgisz(fptr, MAX_COMPRESS_DIM, naxes, status);\n\n    /* calc the cumulative number of pixels in each successive dimension */\n    dimsize[0] = 1;\n    for (ii = 1; ii < MAX_COMPRESS_DIM; ii++)\n         dimsize[ii] = dimsize[ii - 1] * naxes[ii - 1];\n\n    /*  determine the coordinate of the first and last pixel in the image */\n    /*  Use zero based indexes here */\n    tfirst = fpixel - 1;\n    tlast = tfirst + npixel - 1;\n    for (ii = naxis - 1; ii >= 0; ii--)\n    {\n        firstcoord[ii] = tfirst / dimsize[ii];\n        lastcoord[ii] =  tlast / dimsize[ii];\n        tfirst = tfirst - firstcoord[ii] * dimsize[ii];\n        tlast = tlast - lastcoord[ii] * dimsize[ii];\n    }\n\n    /* to simplify things, treat 1-D, 2-D, and 3-D images as separate cases */\n\n    if (naxis == 1)\n    {\n        /* Simple: just read the requested range of pixels */\n\n        firstcoord[0] = firstcoord[0] + 1;\n        lastcoord[0] = lastcoord[0] + 1;\n        fits_read_compressed_img(fptr, datatype, firstcoord, lastcoord, inc,\n            nullcheck, nullval, array, nullarray, anynul, status);\n        return(*status);\n    }\n    else if (naxis == 2)\n    {\n        nplane = 0;  /* read 1st (and only) plane of the image */\n\n        fits_read_compressed_img_plane(fptr, datatype, bytesperpixel,\n          nplane, firstcoord, lastcoord, inc, naxes, nullcheck, nullval,\n          array, nullarray, anynul, &nread, status);\n    }\n    else if (naxis == 3)\n    {\n        /* test for special case: reading an integral number of planes */\n        if (firstcoord[0] == 0 && firstcoord[1] == 0 &&\n            lastcoord[0] == naxes[0] - 1 && lastcoord[1] == naxes[1] - 1)\n        {\n            for (ii = 0; ii < MAX_COMPRESS_DIM; ii++)\n            {\n                /* convert from zero base to 1 base */\n                (firstcoord[ii])++;\n                (lastcoord[ii])++;\n            }\n\n            /* we can read the contiguous block of pixels in one go */\n            fits_read_compressed_img(fptr, datatype, firstcoord, lastcoord, inc,\n                nullcheck, nullval, array, nullarray, anynul, status);\n\n            return(*status);\n        }\n\n        if (anynul)\n            *anynul = 0;  /* initialize */\n\n        /* save last coordinate in temporary variables */\n        last0 = lastcoord[0];\n        last1 = lastcoord[1];\n\n        if (firstcoord[2] < lastcoord[2])\n        {\n            /* we will read up to the last pixel in all but the last plane */\n            lastcoord[0] = naxes[0] - 1;\n            lastcoord[1] = naxes[1] - 1;\n        }\n\n        /* read one plane of the cube at a time, for simplicity */\n        for (nplane = (long) firstcoord[2]; nplane <= lastcoord[2]; nplane++)\n        {\n            if (nplane == lastcoord[2])\n            {\n                lastcoord[0] = last0;\n                lastcoord[1] = last1;\n            }\n\n            fits_read_compressed_img_plane(fptr, datatype, bytesperpixel,\n              nplane, firstcoord, lastcoord, inc, naxes, nullcheck, nullval,\n              arrayptr, nullarrayptr, &planenul, &nread, status);\n\n            if (planenul && anynul)\n               *anynul = 1;  /* there are null pixels */\n\n            /* for all subsequent planes, we start with the first pixel */\n            firstcoord[0] = 0;\n            firstcoord[1] = 0;\n\n            /* increment pointers to next elements to be read */\n            arrayptr = arrayptr + nread * bytesperpixel;\n            if (nullarrayptr && (nullcheck == 2) )\n                nullarrayptr = nullarrayptr + nread;\n        }\n    }\n    else\n    {\n        ffpmsg(\"only 1D, 2D, or 3D images are currently supported\");\n        return(*status = DATA_DECOMPRESSION_ERR);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_read_compressed_img_plane(fitsfile *fptr, /* I - FITS file   */\n            int  datatype,  /* I - datatype of the array to be returned      */\n            int  bytesperpixel, /* I - number of bytes per pixel in array */\n            long   nplane,  /* I - which plane of the cube to read      */\n            LONGLONG *firstcoord,  /* coordinate of first pixel to read */\n            LONGLONG *lastcoord,   /* coordinate of last pixel to read */\n            long *inc,         /* increment of pixels to read */\n            long *naxes,      /* size of each image dimension */\n            int  nullcheck,  /* I - 0 for no null checking                   */\n                              /*     1: set undefined pixels = nullval       */\n                              /*     2: set nullarray=1 for undefined pixels */\n            void *nullval,    /* I - value for undefined pixels              */\n            void *array,      /* O - array of values that are returned       */\n            char *nullarray,  /* O - array of flags = 1 if nullcheck = 2     */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            long *nread,      /* O - total number of pixels read and returned*/\n            int  *status)     /* IO - error status                           */\n\n   /*\n           in general we have to read the first partial row of the image,\n           followed by the middle complete rows, followed by the last\n           partial row of the image.  If the first or last rows are complete,\n           then read them at the same time as all the middle rows.\n    */\n{\n     /* bottom left coord. and top right coord. */\n    LONGLONG blc[MAX_COMPRESS_DIM], trc[MAX_COMPRESS_DIM]; \n    char *arrayptr, *nullarrayptr;\n    int tnull;\n\n    if (anynul)\n        *anynul = 0;\n\n    *nread = 0;\n\n    arrayptr = (char *) array;\n    nullarrayptr = nullarray;\n\n    blc[2] = nplane + 1;\n    trc[2] = nplane + 1;\n\n    if (firstcoord[0] != 0)\n    { \n            /* have to read a partial first row */\n            blc[0] = firstcoord[0] + 1;\n            blc[1] = firstcoord[1] + 1;\n            trc[1] = blc[1];  \n            if (lastcoord[1] == firstcoord[1])\n               trc[0] = lastcoord[0] + 1; /* 1st and last pixels in same row */\n            else\n               trc[0] = naxes[0];  /* read entire rest of the row */\n\n            fits_read_compressed_img(fptr, datatype, blc, trc, inc,\n                nullcheck, nullval, arrayptr, nullarrayptr, &tnull, status);\n\n            *nread = *nread + (long) (trc[0] - blc[0] + 1);\n\n            if (tnull && anynul)\n               *anynul = 1;  /* there are null pixels */\n\n            if (lastcoord[1] == firstcoord[1])\n            {\n               return(*status);  /* finished */\n            }\n\n            /* set starting coord to beginning of next line */\n            firstcoord[0] = 0;\n            firstcoord[1] += 1;\n            arrayptr = arrayptr + (trc[0] - blc[0] + 1) * bytesperpixel;\n            if (nullarrayptr && (nullcheck == 2) )\n                nullarrayptr = nullarrayptr + (trc[0] - blc[0] + 1);\n\n    }\n\n    /* read contiguous complete rows of the image, if any */\n    blc[0] = 1;\n    blc[1] = firstcoord[1] + 1;\n    trc[0] = naxes[0];\n\n    if (lastcoord[0] + 1 == naxes[0])\n    {\n            /* can read the last complete row, too */\n            trc[1] = lastcoord[1] + 1;\n    }\n    else\n    {\n            /* last row is incomplete; have to read it separately */\n            trc[1] = lastcoord[1];\n    }\n\n    if (trc[1] >= blc[1])  /* must have at least one whole line to read */\n    {\n        fits_read_compressed_img(fptr, datatype, blc, trc, inc,\n                nullcheck, nullval, arrayptr, nullarrayptr, &tnull, status);\n\n        *nread = *nread + (long) ((trc[1] - blc[1] + 1) * naxes[0]);\n\n        if (tnull && anynul)\n           *anynul = 1;\n\n        if (lastcoord[1] + 1 == trc[1])\n               return(*status);  /* finished */\n\n        /* increment pointers for the last partial row */\n        arrayptr = arrayptr + (trc[1] - blc[1] + 1) * naxes[0] * bytesperpixel;\n        if (nullarrayptr && (nullcheck == 2) )\n                nullarrayptr = nullarrayptr + (trc[1] - blc[1] + 1) * naxes[0];\n     }\n\n    if (trc[1] == lastcoord[1] + 1)\n        return(*status);           /* all done */\n\n    /* set starting and ending coord to last line */\n\n    trc[0] = lastcoord[0] + 1;\n    trc[1] = lastcoord[1] + 1;\n    blc[1] = trc[1];\n\n    fits_read_compressed_img(fptr, datatype, blc, trc, inc,\n                nullcheck, nullval, arrayptr, nullarrayptr, &tnull, status);\n\n    if (tnull && anynul)\n       *anynul = 1;\n\n    *nread = *nread + (long) (trc[0] - blc[0] + 1);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint imcomp_get_compressed_image_par(fitsfile *infptr, int *status)\n \n/* \n    This routine reads keywords from a BINTABLE extension containing a\n    compressed image.\n*/\n{\n    char keyword[FLEN_KEYWORD];\n    char value[FLEN_VALUE];\n    int ii, tstatus, tstatus2, doffset, oldFormat=0, colNum=0;\n    long expect_nrows, maxtilelen;\n\n    if (*status > 0)\n        return(*status);\n\n    /* Copy relevant header keyword values to structure */\n    if (ffgky (infptr, TSTRING, \"ZCMPTYPE\", value, NULL, status) > 0)\n    {\n        ffpmsg(\"required ZCMPTYPE compression keyword not found in\");\n        ffpmsg(\" imcomp_get_compressed_image_par\");\n        return(*status);\n    }\n\n    (infptr->Fptr)->zcmptype[0] = '\\0';\n    strncat((infptr->Fptr)->zcmptype, value, 11);\n\n    if (!FSTRCMP(value, \"RICE_1\") || !FSTRCMP(value, \"RICE_ONE\") )\n        (infptr->Fptr)->compress_type = RICE_1;\n    else if (!FSTRCMP(value, \"HCOMPRESS_1\") )\n        (infptr->Fptr)->compress_type = HCOMPRESS_1;\n    else if (!FSTRCMP(value, \"GZIP_1\") )\n        (infptr->Fptr)->compress_type = GZIP_1;\n    else if (!FSTRCMP(value, \"GZIP_2\") )\n        (infptr->Fptr)->compress_type = GZIP_2;\n    else if (!FSTRCMP(value, \"BZIP2_1\") )\n        (infptr->Fptr)->compress_type = BZIP2_1;\n    else if (!FSTRCMP(value, \"PLIO_1\") )\n        (infptr->Fptr)->compress_type = PLIO_1;\n    else if (!FSTRCMP(value, \"NOCOMPRESS\") )\n        (infptr->Fptr)->compress_type = NOCOMPRESS;\n    else\n    {\n        ffpmsg(\"Unknown image compression type:\");\n        ffpmsg(value);\n\treturn (*status = DATA_DECOMPRESSION_ERR);\n    }\n    \n    if (ffgky (infptr, TINT,  \"ZBITPIX\",  &(infptr->Fptr)->zbitpix,  \n               NULL, status) > 0)\n    {\n        ffpmsg(\"required ZBITPIX compression keyword not found\");\n        return(*status);\n    }\n\n    /* If ZZERO and ZSCALE columns don't exist for floating-point types,\n     assume there is NO quantization.  Treat exactly as if it had ZQUANTIZ='NONE'.\n     This is true regardless of whether or not file has a ZQUANTIZ keyword. */\n    tstatus=0;\n    tstatus2=0;\n    if ((infptr->Fptr->zbitpix < 0) &&\n       (fits_get_colnum(infptr,CASEINSEN,\"ZZERO\",&colNum,&tstatus)\n\t      == COL_NOT_FOUND) &&\n       (fits_get_colnum(infptr,CASEINSEN,\"ZSCALE\",&colNum,&tstatus2)\n\t      == COL_NOT_FOUND)) {\n\t  (infptr->Fptr)->quantize_level = NO_QUANTIZE;\n    }\n    else {\n       /* get the floating point to integer quantization type, if present. */\n       /* FITS files produced before 2009 will not have this keyword */\n       tstatus = 0;\n       if (ffgky(infptr, TSTRING, \"ZQUANTIZ\", value, NULL, &tstatus) > 0)\n       {\n           (infptr->Fptr)->quantize_method = 0;\n           (infptr->Fptr)->quantize_level = 0;\n       } else {\n\n           if (!FSTRCMP(value, \"NONE\") ) {\n               (infptr->Fptr)->quantize_level = NO_QUANTIZE;\n\t  } else if (!FSTRCMP(value, \"SUBTRACTIVE_DITHER_1\") )\n               (infptr->Fptr)->quantize_method = SUBTRACTIVE_DITHER_1;\n           else if (!FSTRCMP(value, \"SUBTRACTIVE_DITHER_2\") )\n               (infptr->Fptr)->quantize_method = SUBTRACTIVE_DITHER_2;\n           else if (!FSTRCMP(value, \"NO_DITHER\") )\n               (infptr->Fptr)->quantize_method = NO_DITHER;\n           else\n               (infptr->Fptr)->quantize_method = 0;\n       }\n    }\n\n    /* get the floating point quantization dithering offset, if present. */\n    /* FITS files produced before October 2009 will not have this keyword */\n    tstatus = 0;\n    if (ffgky(infptr, TINT, \"ZDITHER0\", &doffset, NULL, &tstatus) > 0)\n    {\n\t/* by default start with 1st element of random sequence */\n        (infptr->Fptr)->dither_seed = 1;  \n    } else {\n        (infptr->Fptr)->dither_seed = doffset;\n    }\n\n    if (ffgky (infptr,TINT, \"ZNAXIS\", &(infptr->Fptr)->zndim, NULL, status) > 0)\n    {\n        ffpmsg(\"required ZNAXIS compression keyword not found\");\n        return(*status);\n    }\n\n    if ((infptr->Fptr)->zndim < 1)\n    {\n        ffpmsg(\"Compressed image has no data (ZNAXIS < 1)\");\n\treturn (*status = BAD_NAXIS);\n    }\n\n    if ((infptr->Fptr)->zndim > MAX_COMPRESS_DIM)\n    {\n        ffpmsg(\"Compressed image has too many dimensions\");\n        return(*status = BAD_NAXIS);\n    }\n\n    expect_nrows = 1;\n    maxtilelen = 1;\n    for (ii = 0;  ii < (infptr->Fptr)->zndim;  ii++)\n    {\n        /* get image size */\n        snprintf (keyword, FLEN_KEYWORD,\"ZNAXIS%d\", ii+1);\n\tffgky (infptr, TLONG,keyword, &(infptr->Fptr)->znaxis[ii],NULL,status);\n\n        if (*status > 0)\n        {\n            ffpmsg(\"required ZNAXISn compression keyword not found\");\n            return(*status);\n        }\n\n        /* get compression tile size */\n\tsnprintf (keyword, FLEN_KEYWORD,\"ZTILE%d\", ii+1);\n\n        /* set default tile size in case keywords are not present */\n        if (ii == 0)\n            (infptr->Fptr)->tilesize[0] = (infptr->Fptr)->znaxis[0];\n        else\n            (infptr->Fptr)->tilesize[ii] = 1;\n\n        tstatus = 0;\n\tffgky (infptr, TLONG, keyword, &(infptr->Fptr)->tilesize[ii], NULL, \n               &tstatus);\n\n        expect_nrows *= (((infptr->Fptr)->znaxis[ii] - 1) / \n                  (infptr->Fptr)->tilesize[ii]+ 1);\n        maxtilelen *= (infptr->Fptr)->tilesize[ii];\n    }\n\n    /* check number of rows */\n    if (expect_nrows != (infptr->Fptr)->numrows)\n    {\n        ffpmsg(\n        \"number of table rows != the number of tiles in compressed image\");\n        return (*status = DATA_DECOMPRESSION_ERR);\n    }\n\n    /* read any algorithm specific parameters */\n    if ((infptr->Fptr)->compress_type == RICE_1 )\n    {\n        if (ffgky(infptr, TINT,\"ZVAL1\", &(infptr->Fptr)->rice_blocksize,\n                  NULL, status) > 0)\n        {\n            ffpmsg(\"required ZVAL1 compression keyword not found\");\n            return(*status);\n        }\n\n        tstatus = 0;\n        /* First check for very old files, where ZVAL2 wasn't yet designated\n           for bytepix */\n        if (!ffgky(infptr, TSTRING, \"ZNAME2\", value, NULL, &tstatus)\n                && !FSTRCMP(value, \"NOISEBIT\"))\n        {\n            oldFormat = 1;\n        }\n                \n        tstatus = 0;\n        if (oldFormat || ffgky(infptr, TINT,\"ZVAL2\", &(infptr->Fptr)->rice_bytepix,\n                  NULL, &tstatus) > 0)\n        {\n            (infptr->Fptr)->rice_bytepix = 4;  /* default value */\n        }\n\n        if ((infptr->Fptr)->rice_blocksize < 16 &&\n\t    (infptr->Fptr)->rice_bytepix > 8) {\n\t     /* values are reversed */\n\t     tstatus = (infptr->Fptr)->rice_bytepix;\n\t     (infptr->Fptr)->rice_bytepix = (infptr->Fptr)->rice_blocksize;\n\t     (infptr->Fptr)->rice_blocksize = tstatus;\n        }\n    } else if ((infptr->Fptr)->compress_type == HCOMPRESS_1 ) {\n\n        if (ffgky(infptr, TFLOAT,\"ZVAL1\", &(infptr->Fptr)->hcomp_scale,\n                  NULL, status) > 0)\n        {\n            ffpmsg(\"required ZVAL1 compression keyword not found\");\n            return(*status);\n        }\n\n        tstatus = 0;\n        ffgky(infptr, TINT,\"ZVAL2\", &(infptr->Fptr)->hcomp_smooth,\n                  NULL, &tstatus);\n    }    \n\n    /* store number of pixels in each compression tile, */\n    /* and max size of the compressed tile buffer */\n    (infptr->Fptr)->maxtilelen = maxtilelen;\n\n    (infptr->Fptr)->maxelem = \n           imcomp_calc_max_elem ((infptr->Fptr)->compress_type, maxtilelen, \n               (infptr->Fptr)->zbitpix, (infptr->Fptr)->rice_blocksize);\n\n    /* Get Column numbers. */\n    if (ffgcno(infptr, CASEINSEN, \"COMPRESSED_DATA\",\n         &(infptr->Fptr)->cn_compressed, status) > 0)\n    {\n        ffpmsg(\"couldn't find COMPRESSED_DATA column (fits_get_compressed_img_par)\");\n        return(*status = DATA_DECOMPRESSION_ERR);\n    }\n\n    ffpmrk(); /* put mark on message stack; erase any messages after this */\n\n    tstatus = 0;\n    ffgcno(infptr,CASEINSEN, \"UNCOMPRESSED_DATA\",\n          &(infptr->Fptr)->cn_uncompressed, &tstatus);\n\n    tstatus = 0;\n    ffgcno(infptr,CASEINSEN, \"GZIP_COMPRESSED_DATA\",\n          &(infptr->Fptr)->cn_gzip_data, &tstatus);\n\n    tstatus = 0;\n    if (ffgcno(infptr, CASEINSEN, \"ZSCALE\", &(infptr->Fptr)->cn_zscale,\n              &tstatus) > 0)\n    {\n        /* CMPSCALE column doesn't exist; see if there is a keyword */\n        tstatus = 0;\n        if (ffgky(infptr, TDOUBLE, \"ZSCALE\", &(infptr->Fptr)->zscale, NULL, \n                 &tstatus) <= 0)\n            (infptr->Fptr)->cn_zscale = -1;  /* flag for a constant ZSCALE */\n    }\n\n    tstatus = 0;\n    if (ffgcno(infptr, CASEINSEN, \"ZZERO\", &(infptr->Fptr)->cn_zzero,\n               &tstatus) > 0)\n    {\n        /* CMPZERO column doesn't exist; see if there is a keyword */\n        tstatus = 0;\n        if (ffgky(infptr, TDOUBLE, \"ZZERO\", &(infptr->Fptr)->zzero, NULL, \n                  &tstatus) <= 0)\n            (infptr->Fptr)->cn_zzero = -1;  /* flag for a constant ZZERO */\n    }\n\n    tstatus = 0;\n    if (ffgcno(infptr, CASEINSEN, \"ZBLANK\", &(infptr->Fptr)->cn_zblank,\n               &tstatus) > 0)\n    {\n        /* ZBLANK column doesn't exist; see if there is a keyword */\n        tstatus = 0;\n        if (ffgky(infptr, TINT, \"ZBLANK\", &(infptr->Fptr)->zblank, NULL,\n                  &tstatus) <= 0)  {\n            (infptr->Fptr)->cn_zblank = -1;  /* flag for a constant ZBLANK */\n\n        } else {\n           /* ZBLANK keyword doesn't exist; see if there is a BLANK keyword */\n           tstatus = 0;\n           if (ffgky(infptr, TINT, \"BLANK\", &(infptr->Fptr)->zblank, NULL,\n                  &tstatus) <= 0)  \n              (infptr->Fptr)->cn_zblank = -1;  /* flag for a constant ZBLANK */\n        }\n    }\n\n    /* read the conventional BSCALE and BZERO scaling keywords, if present */\n    tstatus = 0;\n    if (ffgky (infptr, TDOUBLE, \"BSCALE\", &(infptr->Fptr)->cn_bscale, \n        NULL, &tstatus) > 0)\n    {\n        (infptr->Fptr)->cn_bscale = 1.0;\n    }\n\n    tstatus = 0;\n    if (ffgky (infptr, TDOUBLE, \"BZERO\", &(infptr->Fptr)->cn_bzero, \n        NULL, &tstatus) > 0)\n    {\n        (infptr->Fptr)->cn_bzero = 0.0;\n        (infptr->Fptr)->cn_actual_bzero = 0.0;\n    } else {\n        (infptr->Fptr)->cn_actual_bzero = (infptr->Fptr)->cn_bzero;\n    }\n\n    /* special case: the quantization level is not given by a keyword in  */\n    /* the HDU header, so we have to explicitly copy the requested value */\n    /* to the actual value */\n    if ( (infptr->Fptr)->request_quantize_level != 0.)\n        (infptr->Fptr)->quantize_level = (infptr->Fptr)->request_quantize_level;\n\n    ffcmrk();  /* clear any spurious error messages, back to the mark */\n    return (*status);\n}\n/*--------------------------------------------------------------------------*/\nint imcomp_copy_imheader(fitsfile *infptr, fitsfile *outfptr, int *status)\n/*\n    This routine reads the header keywords from the input image and\n    copies them to the output image;  the manditory structural keywords\n    and the checksum keywords are not copied. If the DATE keyword is copied,\n    then it is updated with the current date and time.\n*/\n{\n    int nkeys, ii, keyclass;\n    char card[FLEN_CARD];\t/* a header record */\n\n    if (*status > 0)\n        return(*status);\n\n    ffghsp(infptr, &nkeys, NULL, status); /* get number of keywords in image */\n\n    for (ii = 5; ii <= nkeys; ii++)  /* skip the first 4 keywords */\n    {\n        ffgrec(infptr, ii, card, status);\n\n\tkeyclass = ffgkcl(card);  /* Get the type/class of keyword */\n\n        /* don't copy structural keywords or checksum keywords */\n        if ((keyclass <= TYP_CMPRS_KEY) || (keyclass == TYP_CKSUM_KEY))\n\t    continue;\n\n        if (FSTRNCMP(card, \"DATE \", 5) == 0) /* write current date */\n        {\n            ffpdat(outfptr, status);\n        }\n        else if (FSTRNCMP(card, \"EXTNAME \", 8) == 0) \n        {\n            /* don't copy default EXTNAME keyword from a compressed image */\n            if (FSTRNCMP(card, \"EXTNAME = 'COMPRESSED_IMAGE'\", 28))\n            {\n                /* if EXTNAME keyword already exists, overwrite it */\n                /* otherwise append a new EXTNAME keyword */\n                ffucrd(outfptr, \"EXTNAME\", card, status);\n            }\n        }\n        else\n        {\n            /* just copy the keyword to the output header */\n\t    ffprec (outfptr, card, status);\n        }\n\n        if (*status > 0)\n           return (*status);\n    }\n    return (*status);\n}\n/*--------------------------------------------------------------------------*/\nint imcomp_copy_img2comp(fitsfile *infptr, fitsfile *outfptr, int *status)\n/*\n    This routine copies the header keywords from the uncompressed input image \n    and to the compressed image (in a binary table) \n*/\n{\n    char card[FLEN_CARD], card2[FLEN_CARD];\t/* a header record */\n    int nkeys, nmore, ii, jj, tstatus, bitpix;\n\n    /* tile compressed image keyword translation table  */\n    /*                        INPUT      OUTPUT  */\n    /*                       01234567   01234567 */\n    char *patterns[][2] = {{\"SIMPLE\",  \"ZSIMPLE\" },  \n\t\t\t   {\"XTENSION\", \"ZTENSION\" },\n\t\t\t   {\"BITPIX\",  \"ZBITPIX\" },\n\t\t\t   {\"NAXIS\",   \"ZNAXIS\"  },\n\t\t\t   {\"NAXISm\",  \"ZNAXISm\" },\n\t\t\t   {\"EXTEND\",  \"ZEXTEND\" },\n\t\t\t   {\"BLOCKED\", \"ZBLOCKED\"},\n\t\t\t   {\"PCOUNT\",  \"ZPCOUNT\" },  \n\t\t\t   {\"GCOUNT\",  \"ZGCOUNT\" },\n\n\t\t\t   {\"CHECKSUM\",\"ZHECKSUM\"},  /* save original checksums */\n\t\t\t   {\"DATASUM\", \"ZDATASUM\"},\n\t\t\t   \n\t\t\t   {\"*\",       \"+\"       }}; /* copy all other keywords */\n    int npat;\n\n    if (*status > 0)\n        return(*status);\n\n    /* write a default EXTNAME keyword if it doesn't exist in input file*/\n    fits_read_card(infptr, \"EXTNAME\", card, status);\n    \n    if (*status) {\n       *status = 0;\n       strcpy(card, \"EXTNAME = 'COMPRESSED_IMAGE'\");\n       fits_write_record(outfptr, card, status);\n    }\n\n    /* copy all the keywords from the input file to the output */\n    npat = sizeof(patterns)/sizeof(patterns[0][0])/2;\n    fits_translate_keywords(infptr, outfptr, 1, patterns, npat,\n\t\t\t    0, 0, 0, status);\n\n\n    if ( (outfptr->Fptr)->request_lossy_int_compress != 0) { \n\n\t/* request was made to compress integer images as if they had float pixels. */\n\t/* If input image has positive bitpix value, then reset the output ZBITPIX */\n\t/* value to -32. */\n\n\tfits_read_key(infptr, TINT, \"BITPIX\", &bitpix, NULL, status);\n\n\tif (*status <= 0 && bitpix > 0) {\n\t    fits_modify_key_lng(outfptr, \"ZBITPIX\", -32, NULL, status);\n\n\t    /* also delete the BSCALE, BZERO, and BLANK keywords */\n\t    tstatus = 0;\n\t    fits_delete_key(outfptr, \"BSCALE\", &tstatus);\n\t    tstatus = 0;\n\t    fits_delete_key(outfptr, \"BZERO\", &tstatus);\n\t    tstatus = 0;\n\t    fits_delete_key(outfptr, \"BLANK\", &tstatus);\n\t}\n    }\n\n   /*\n     For compatibility with software that uses an older version of CFITSIO,\n     we must make certain that the new ZQUANTIZ keyword, if it exists, must\n     occur after the other peudo-required keywords (e.g., ZSIMPLE, ZBITPIX,\n     etc.).  Do this by trying to delete the keyword.  If that succeeds (and\n     thus the keyword did exist) then rewrite the keyword at the end of header.\n     In principle this should not be necessary once all software has upgraded\n     to a newer version of CFITSIO (version number greater than 3.181, newer\n     than August 2009).\n     \n     Do the same for the new ZDITHER0 keyword.\n   */\n\n   tstatus = 0;\n   if (fits_read_card(outfptr, \"ZQUANTIZ\", card, &tstatus) == 0)\n   {\n        fits_delete_key(outfptr, \"ZQUANTIZ\", status);\n\n        /* rewrite the deleted keyword at the end of the header */\n        fits_write_record(outfptr, card, status);\n\n\t/* write some associated HISTORY keywords */\n        fits_parse_value(card, card2, NULL, status);\n\tif (fits_strncasecmp(card2, \"'NONE\", 5) ) {\n\t    /* the value is not 'NONE' */\t\n\t    fits_write_history(outfptr, \n\t        \"Image was compressed by CFITSIO using scaled integer quantization:\", status);\n\t    snprintf(card2, FLEN_CARD,\"  q = %f / quantized level scaling parameter\", \n\t        (outfptr->Fptr)->request_quantize_level);\n\t    fits_write_history(outfptr, card2, status); \n\t    fits_write_history(outfptr, card+10, status); \n\t}\n   }\n\n   tstatus = 0;\n   if (fits_read_card(outfptr, \"ZDITHER0\", card, &tstatus) == 0)\n   {\n        fits_delete_key(outfptr, \"ZDITHER0\", status);\n\n        /* rewrite the deleted keyword at the end of the header */\n        fits_write_record(outfptr, card, status);\n   }\n\n\n    ffghsp(infptr, &nkeys, &nmore, status); /* get number of keywords in image */\n\n    nmore = nmore / 36;  /* how many completely empty header blocks are there? */\n     \n     /* preserve the same number of spare header blocks in the output header */\n     \n    for (jj = 0; jj < nmore; jj++)\n       for (ii = 0; ii < 36; ii++)\n          fits_write_record(outfptr, \"    \", status);\n\n    return (*status);\n}\n/*--------------------------------------------------------------------------*/\nint imcomp_copy_comp2img(fitsfile *infptr, fitsfile *outfptr, \n                          int norec, int *status)\n/*\n    This routine copies the header keywords from the compressed input image \n    and to the uncompressed image (in a binary table) \n*/\n{\n    char card[FLEN_CARD];\t/* a header record */\n    char *patterns[40][2];\n    char negative[] = \"-\";\n    int ii,jj, npat, nreq, nsp, tstatus = 0;\n    int nkeys, nmore;\n    \n    /* tile compressed image keyword translation table  */\n    /*                        INPUT      OUTPUT  */\n    /*                       01234567   01234567 */\n\n    /*  only translate these if required keywords not already written */\n    char *reqkeys[][2] = {  \n\t\t\t   {\"ZSIMPLE\",   \"SIMPLE\" },  \n\t\t\t   {\"ZTENSION\", \"XTENSION\"},\n\t\t\t   {\"ZBITPIX\",   \"BITPIX\" },\n\t\t\t   {\"ZNAXIS\",    \"NAXIS\"  },\n\t\t\t   {\"ZNAXISm\",   \"NAXISm\" },\n\t\t\t   {\"ZEXTEND\",   \"EXTEND\" },\n\t\t\t   {\"ZBLOCKED\",  \"BLOCKED\"},\n\t\t\t   {\"ZPCOUNT\",   \"PCOUNT\" },  \n\t\t\t   {\"ZGCOUNT\",   \"GCOUNT\" },\n\t\t\t   {\"ZHECKSUM\",  \"CHECKSUM\"},  /* restore original checksums */\n\t\t\t   {\"ZDATASUM\",  \"DATASUM\"}}; \n\n    /* other special keywords */\n    char *spkeys[][2] = {\n\t\t\t   {\"XTENSION\", \"-\"      },\n\t\t\t   {\"BITPIX\",  \"-\"       },\n\t\t\t   {\"NAXIS\",   \"-\"       },\n\t\t\t   {\"NAXISm\",  \"-\"       },\n\t\t\t   {\"PCOUNT\",  \"-\"       },\n\t\t\t   {\"GCOUNT\",  \"-\"       },\n\t\t\t   {\"TFIELDS\", \"-\"       },\n\t\t\t   {\"TTYPEm\",  \"-\"       },\n\t\t\t   {\"TFORMm\",  \"-\"       },\n\t\t\t   {\"THEAP\",   \"-\"       },\n\t\t\t   {\"ZIMAGE\",  \"-\"       },\n\t\t\t   {\"ZQUANTIZ\", \"-\"      },\n\t\t\t   {\"ZDITHER0\", \"-\"      },\n\t\t\t   {\"ZTILEm\",  \"-\"       },\n\t\t\t   {\"ZCMPTYPE\", \"-\"      },\n\t\t\t   {\"ZBLANK\",  \"-\"       },\n\t\t\t   {\"ZNAMEm\",  \"-\"       },\n\t\t\t   {\"ZVALm\",   \"-\"       },\n\n\t\t\t   {\"CHECKSUM\",\"-\"       },  /* delete checksums */\n\t\t\t   {\"DATASUM\", \"-\"       },\n\t\t\t   {\"EXTNAME\", \"+\"       },  /* we may change this, below */\n\t\t\t   {\"*\",       \"+\"      }};  \n\n\n    if (*status > 0)\n        return(*status);\n\t\n    nreq = sizeof(reqkeys)/sizeof(reqkeys[0][0])/2;\n    nsp = sizeof(spkeys)/sizeof(spkeys[0][0])/2;\n\n    /* construct translation patterns */\n\n    for (ii = 0; ii < nreq; ii++) {\n        patterns[ii][0] = reqkeys[ii][0];\n\t\n        if (norec) \n            patterns[ii][1] = negative;\n        else\n            patterns[ii][1] = reqkeys[ii][1];\n    }\n    \n    for (ii = 0; ii < nsp; ii++) {\n        patterns[ii+nreq][0] = spkeys[ii][0];\n        patterns[ii+nreq][1] = spkeys[ii][1];\n    }\n\n    npat = nreq + nsp;\n    \n    /* see if the EXTNAME keyword should be copied or not */\n    fits_read_card(infptr, \"EXTNAME\", card, &tstatus);\n\n    if (tstatus == 0) {\n      if (!strncmp(card, \"EXTNAME = 'COMPRESSED_IMAGE'\", 28)) \n        patterns[npat-2][1] = negative;\n    }\n    \n    /* translate and copy the keywords from the input file to the output */\n    fits_translate_keywords(infptr, outfptr, 1, patterns, npat,\n\t\t\t    0, 0, 0, status);\n\n    ffghsp(infptr, &nkeys, &nmore, status); /* get number of keywords in image */\n\n    nmore = nmore / 36;  /* how many completely empty header blocks are there? */\n     \n    /* preserve the same number of spare header blocks in the output header */\n     \n    for (jj = 0; jj < nmore; jj++)\n       for (ii = 0; ii < 36; ii++)\n          fits_write_record(outfptr, \"    \", status);\n\n\n    return (*status);\n}\n/*--------------------------------------------------------------------------*/\nint imcomp_copy_prime2img(fitsfile *infptr, fitsfile *outfptr, int *status)\n/*\n    This routine copies any unexpected keywords from the primary array\n    of the compressed input image into the header of the uncompressed image\n    (which is the primary array of the output file). \n*/\n{\n    int  nsp;\n\n    /* keywords that will not be copied */\n    char *spkeys[][2] = {\n\t\t\t   {\"SIMPLE\", \"-\"      },\n\t\t\t   {\"BITPIX\",  \"-\"       },\n\t\t\t   {\"NAXIS\",   \"-\"       },\n\t\t\t   {\"NAXISm\",  \"-\"       },\n\t\t\t   {\"PCOUNT\",  \"-\"       },\n\t\t\t   {\"EXTEND\",  \"-\"       },\n\t\t\t   {\"GCOUNT\",  \"-\"       },\n\t\t\t   {\"CHECKSUM\",\"-\"       }, \n\t\t\t   {\"DATASUM\", \"-\"       },\n\t\t\t   {\"EXTNAME\", \"-\"       },\n\t\t\t   {\"HISTORY\", \"-\"       },\n\t\t\t   {\"COMMENT\", \"-\"       },\n\t\t\t   {\"*\",       \"+\"      }};  \n\n    if (*status > 0)\n        return(*status);\n\t\n    nsp = sizeof(spkeys)/sizeof(spkeys[0][0])/2;\n\n    /* translate and copy the keywords from the input file to the output */\n    fits_translate_keywords(infptr, outfptr, 1, spkeys, nsp,\n\t\t\t    0, 0, 0, status);\n\n    return (*status);\n}\n/*--------------------------------------------------------------------------*/\nint imcomp_decompress_tile (fitsfile *infptr,\n          int nrow,            /* I - row of table to read and uncompress */\n          int tilelen,         /* I - number of pixels in the tile        */\n          int datatype,        /* I - datatype to be returned in 'buffer' */\n          int nullcheck,       /* I - 0 for no null checking */\n          void *nulval,        /* I - value to be used for undefined pixels */\n          void *buffer,        /* O - buffer for returned decompressed values */\n          char *bnullarray,    /* O - buffer for returned null flags */\n          int *anynul,         /* O - any null values returned?  */\n          int *status)\n\n/* This routine decompresses one tile of the image */\n{\n    int *idata = 0;\n    int tiledatatype, pixlen = 0;          /* uncompressed integer data */\n    size_t idatalen, tilebytesize;\n    int ii, tnull;        /* value in the data which represents nulls */\n    unsigned char *cbuf; /* compressed data */\n    unsigned char charnull = 0;\n    short snull = 0;\n    int blocksize, ntilebins, tilecol = 0;\n    float fnulval=0;\n    float *tempfloat = 0;\n    double *tempdouble = 0;\n    double dnulval=0;\n    double bscale, bzero, actual_bzero, dummy = 0;    /* scaling parameters */\n    long tilesize;      /* number of bytes */\n    int smooth, nx, ny, scale;  /* hcompress parameters */\n    LONGLONG nelemll = 0, offset = 0;\n\n    if (*status > 0)\n       return(*status);\n\n\n    /* **************************************************************** */\n    /* allocate pointers to array of cached uncompressed tiles, if not already done */\n    if ((infptr->Fptr)->tilerow == 0)  {\n\n      /* calculate number of column bins of compressed tile */\n      ntilebins =  (((infptr->Fptr)->znaxis[0] - 1) / ((infptr->Fptr)->tilesize[0])) + 1;\n\n     if ((infptr->Fptr)->znaxis[0]   != (infptr->Fptr)->tilesize[0] ||\n        (infptr->Fptr)->tilesize[1] != 1 ) {   /* don't cache the tile if only single row of the image */\n\n        (infptr->Fptr)->tilerow = (int *) calloc (ntilebins, sizeof(int));\n        (infptr->Fptr)->tiledata = (void**) calloc (ntilebins, sizeof(void*));\n        (infptr->Fptr)->tilenullarray = (void **) calloc (ntilebins, sizeof(char*));\n        (infptr->Fptr)->tiledatasize = (long *) calloc (ntilebins, sizeof(long));\n        (infptr->Fptr)->tiletype = (int *) calloc (ntilebins, sizeof(int));\n        (infptr->Fptr)->tileanynull = (int *) calloc (ntilebins, sizeof(int));\n      }\n    }\n \n    /* **************************************************************** */\n    /* check if this tile was cached; if so, just copy it out */\n    if ((infptr->Fptr)->tilerow)  {\n      /* calculate the column bin of the compressed tile */\n      tilecol = (nrow - 1) % ((long)(((infptr->Fptr)->znaxis[0] - 1) / ((infptr->Fptr)->tilesize[0])) + 1);\n\n      if (nrow == (infptr->Fptr)->tilerow[tilecol] && datatype == (infptr->Fptr)->tiletype[tilecol] ) {\n\n         memcpy(buffer, ((infptr->Fptr)->tiledata)[tilecol], (infptr->Fptr)->tiledatasize[tilecol]);\n\t \n\t if (nullcheck == 2)\n             memcpy(bnullarray, (infptr->Fptr)->tilenullarray[tilecol], tilelen);\n\n         *anynul = (infptr->Fptr)->tileanynull[tilecol];\n\n         return(*status);\n       }\n    }\n\n    /* **************************************************************** */\n    /* get length of the compressed byte stream */\n    ffgdesll (infptr, (infptr->Fptr)->cn_compressed, nrow, &nelemll, &offset, \n            status);\n\n    /* EOF error here indicates that this tile has not yet been written */\n    if (*status == END_OF_FILE)\n           return(*status = NO_COMPRESSED_TILE);\n      \n    /* **************************************************************** */\n    if (nelemll == 0)  /* special case: tile was not compressed normally */\n    {\n        if ((infptr->Fptr)->cn_uncompressed >= 1 ) {\n\n\t    /* This option of writing the uncompressed floating point data */\n\t    /* to the tile compressed file was used until about May 2011. */\n\t    /* This was replaced by the more efficient option of gzipping the */\n\t    /* floating point data before writing it to the tile-compressed file */\n\t    \n            /* no compressed data, so simply read the uncompressed data */\n            /* directly from the UNCOMPRESSED_DATA column */   \n            ffgdesll (infptr, (infptr->Fptr)->cn_uncompressed, nrow, &nelemll,\n               &offset, status);\n\n            if (nelemll == 0 && offset == 0)  /* this should never happen */\n\t        return (*status = NO_COMPRESSED_TILE);\n\n            if (nullcheck <= 1) { /* set any null values in the array = nulval */\n                fits_read_col(infptr, datatype, (infptr->Fptr)->cn_uncompressed,\n                  nrow, 1, (long) nelemll, nulval, buffer, anynul, status);\n            } else  { /* set the bnullarray = 1 for any null values in the array */\n                fits_read_colnull(infptr, datatype, (infptr->Fptr)->cn_uncompressed,\n                  nrow, 1, (long) nelemll, buffer, bnullarray, anynul, status);\n            }\n        } else if ((infptr->Fptr)->cn_gzip_data >= 1) {\n\n            /* This is the newer option, that was introduced in May 2011 */\n            /* floating point data was not quantized,  so read the losslessly */\n\t    /* compressed data from the GZIP_COMPRESSED_DATA column */   \n\n            ffgdesll (infptr, (infptr->Fptr)->cn_gzip_data, nrow, &nelemll,\n               &offset, status);\n\n            if (nelemll == 0 && offset == 0) /* this should never happen */\n\t        return (*status = NO_COMPRESSED_TILE);\n\n\t    /* allocate memory for the compressed tile of data */\n            cbuf = (unsigned char *) malloc ((long) nelemll);  \n            if (cbuf == NULL) {\n\t        ffpmsg(\"error allocating memory for gzipped tile (imcomp_decompress_tile)\");\n\t        return (*status = MEMORY_ALLOCATION);\n            }\n\n            /* read array of compressed bytes */\n            if (fits_read_col(infptr, TBYTE, (infptr->Fptr)->cn_gzip_data, nrow,\n                 1, (long) nelemll, &charnull, cbuf, NULL, status) > 0) {\n                ffpmsg(\"error reading compressed byte stream from binary table\");\n\t        free (cbuf);\n                return (*status);\n            }\n\n            /* size of the returned (uncompressed) data buffer, in bytes */\n            if ((infptr->Fptr)->zbitpix == FLOAT_IMG) {\n\t         idatalen = tilelen * sizeof(float);\n            } else if ((infptr->Fptr)->zbitpix == DOUBLE_IMG) {\n\t         idatalen = tilelen * sizeof(double);\n            } else {\n                /* this should never happen! */\n                ffpmsg(\"incompatible data type in gzipped floating-point tile-compressed image\");\n                free (cbuf);\n                return (*status = DATA_DECOMPRESSION_ERR);\n            }\n            \n            /* Do not allow image float/doubles into int arrays */\n            if (datatype != TFLOAT && datatype != TDOUBLE)\n            {\n               ffpmsg(\"attempting to read compressed float or double image into incompatible data type\");\n               free(cbuf);\n               return (*status = DATA_DECOMPRESSION_ERR);\n            }\n\n            if (datatype == TFLOAT && (infptr->Fptr)->zbitpix == DOUBLE_IMG)\n            {\n               tempdouble = (double*)malloc(idatalen);\n               if (tempdouble == NULL) {\n\t           ffpmsg(\"Memory allocation failure for tempdouble. (imcomp_decompress_tile)\");\n                   free (cbuf);\n\t           return (*status = MEMORY_ALLOCATION);\n               }\n\n               /* uncompress the data into temp buffer */\n               if (uncompress2mem_from_mem ((char *)cbuf, (long) nelemll,\n                    (char **) &tempdouble, &idatalen, NULL, &tilebytesize, status)) {\n                   ffpmsg(\"failed to gunzip the image tile\");\n                   free (tempdouble);\n                   free (cbuf);\n                   return (*status);\n               }\n            }\n            else if (datatype == TDOUBLE && (infptr->Fptr)->zbitpix == FLOAT_IMG) {  \n                /*  have to allocat a temporary buffer for the uncompressed data in the */\n                /*  case where a gzipped \"float\" tile is returned as a \"double\" array   */\n                tempfloat = (float*) malloc (idatalen); \n\n                if (tempfloat == NULL) {\n\t            ffpmsg(\"Memory allocation failure for tempfloat. (imcomp_decompress_tile)\");\n                    free (cbuf);\n\t            return (*status = MEMORY_ALLOCATION);\n                }\n\n                /* uncompress the data into temp buffer */\n                if (uncompress2mem_from_mem ((char *)cbuf, (long) nelemll,\n                     (char **) &tempfloat, &idatalen, NULL, &tilebytesize, status)) {\n                    ffpmsg(\"failed to gunzip the image tile\");\n                    free (tempfloat);\n                    free (cbuf);\n                    return (*status);\n                }\n            } else {\n\n                /* uncompress the data directly into the output buffer in all other cases */\n                if (uncompress2mem_from_mem ((char *)cbuf, (long) nelemll,\n                  (char **) &buffer, &idatalen, NULL, &tilebytesize, status)) {\n                    ffpmsg(\"failed to gunzip the image tile\");\n                    free (cbuf);\n                    return (*status);\n                }\n            }\n\n            free(cbuf);\n\n            /* do byte swapping and null value substitution for the tile of pixels */\n            if (tilebytesize == 4 * tilelen) {  /* float pixels */\n\n#if BYTESWAPPED\n                if (tempfloat)\n                    ffswap4((int *) tempfloat, tilelen);\n                else\n                    ffswap4((int *) buffer, tilelen);\n#endif\n               if (datatype == TFLOAT) {\n                  if (nulval) {\n\t\t    fnulval = *(float *) nulval;\n  \t\t  }\n\n                  fffr4r4((float *) buffer, (long) tilelen, 1., 0., nullcheck,   \n                        fnulval, bnullarray, anynul,\n                        (float *) buffer, status);\n                } else if (datatype == TDOUBLE) {\n                  if (nulval) {\n\t\t    dnulval = *(double *) nulval;\n\t\t  }\n\n                  /* note that the R*4 data are in the tempfloat array in this case */\n                  fffr4r8((float *) tempfloat, (long) tilelen, 1., 0., nullcheck,   \n                   dnulval, bnullarray, anynul,\n                    (double *) buffer, status);            \n                  free(tempfloat);\n\n                } else {\n                  ffpmsg(\"implicit data type conversion is not supported for gzipped image tiles\");\n                  return (*status = DATA_DECOMPRESSION_ERR);\n                }\n            } else if (tilebytesize == 8 * tilelen) { /* double pixels */\n\n#if BYTESWAPPED\n                if (tempdouble)\n                   ffswap8((double *) tempdouble, tilelen);\n                else\n                   ffswap8((double *) buffer, tilelen);\n#endif\n                if (datatype == TFLOAT) {\n                  if (nulval) {\n\t\t    fnulval = *(float *) nulval;\n  \t\t  }\n\n                  fffr8r4((double *) tempdouble, (long) tilelen, 1., 0., nullcheck,   \n                        fnulval, bnullarray, anynul,\n                        (float *) buffer, status);\n                  free(tempdouble);\n                  tempdouble=0;\n                } else if (datatype == TDOUBLE) {\n                  if (nulval) {\n\t\t    dnulval = *(double *) nulval;\n\t\t  }\n\n                  fffr8r8((double *) buffer, (long) tilelen, 1., 0., nullcheck,   \n                   dnulval, bnullarray, anynul,\n                    (double *) buffer, status);            \n                } else {\n                  ffpmsg(\"implicit data type conversion is not supported in tile-compressed images\");\n                  return (*status = DATA_DECOMPRESSION_ERR);\n                }\n\t    } else {\n                ffpmsg(\"error: uncompressed tile has wrong size\");\n                return (*status = DATA_DECOMPRESSION_ERR);\n            }\n\n          /* end of special case of losslessly gzipping a floating-point image tile */\n        } else {  /* this should never happen */\n\t   *status = NO_COMPRESSED_TILE;\n        }\n\n        return(*status);\n    }\n\n    /* **************************************************************** */\n    /* deal with the normal case of a compressed tile of pixels */\n    if (nullcheck == 2)  {\n        for (ii = 0; ii < tilelen; ii++)  /* initialize the null flage array */\n            bnullarray[ii] = 0;\n    }\n\n    if (anynul)\n       *anynul = 0;\n\n    /* get linear scaling and offset values, if they exist */\n    actual_bzero = (infptr->Fptr)->cn_actual_bzero;\n    if ((infptr->Fptr)->cn_zscale == 0) {\n         /* set default scaling, if scaling is not defined */\n         bscale = 1.;\n         bzero = 0.;\n    } else if ((infptr->Fptr)->cn_zscale == -1) {\n        bscale = (infptr->Fptr)->zscale;\n        bzero  = (infptr->Fptr)->zzero;\n    } else {\n        /* read the linear scale and offset values for this row */\n\tffgcvd (infptr, (infptr->Fptr)->cn_zscale, nrow, 1, 1, 0.,\n\t\t\t\t&bscale, NULL, status);\n\tffgcvd (infptr, (infptr->Fptr)->cn_zzero, nrow, 1, 1, 0.,\n\t\t\t\t&bzero, NULL, status);\n        if (*status > 0)\n        {\n          ffpmsg(\"error reading scaling factor and offset for compressed tile\");\n          return (*status);\n        }\n\n        /* test if floating-point FITS image also has non-default BSCALE and  */\n\t/* BZERO keywords.  If so, we have to combine the 2 linear scaling factors. */\n\t\n\tif ( ((infptr->Fptr)->zbitpix == FLOAT_IMG || \n\t      (infptr->Fptr)->zbitpix == DOUBLE_IMG )\n\t    &&  \n\t      ((infptr->Fptr)->cn_bscale != 1.0 ||\n\t       (infptr->Fptr)->cn_bzero  != 0.0 )    ) \n\t    {\n\t       bscale = bscale * (infptr->Fptr)->cn_bscale;\n\t       bzero  = bzero  * (infptr->Fptr)->cn_bscale + (infptr->Fptr)->cn_bzero;\n\t    }\n    }\n\n    if (bscale == 1.0 && bzero == 0.0 ) {\n      /* if no other scaling has been specified, try using the values\n         given by the BSCALE and BZERO keywords, if any */\n\n        bscale = (infptr->Fptr)->cn_bscale;\n        bzero  = (infptr->Fptr)->cn_bzero;\n    }\n\n    /* ************************************************************* */\n    /* get the value used to represent nulls in the int array */\n    if ((infptr->Fptr)->cn_zblank == 0) {\n        nullcheck = 0;  /* no null value; don't check for nulls */\n    } else if ((infptr->Fptr)->cn_zblank == -1) {\n        tnull = (infptr->Fptr)->zblank;  /* use the the ZBLANK keyword */\n    } else {\n        /* read the null value for this row */\n\tffgcvk (infptr, (infptr->Fptr)->cn_zblank, nrow, 1, 1, 0,\n\t\t\t\t&tnull, NULL, status);\n        if (*status > 0) {\n            ffpmsg(\"error reading null value for compressed tile\");\n            return (*status);\n        }\n    }\n\n    /* ************************************************************* */\n    /* allocate memory for the uncompressed array of tile integers */\n    /* The size depends on the datatype and the compression type. */\n    \n    if ((infptr->Fptr)->compress_type == HCOMPRESS_1 &&\n          ((infptr->Fptr)->zbitpix != BYTE_IMG &&\n\t   (infptr->Fptr)->zbitpix != SHORT_IMG) ) {\n\n           idatalen = tilelen * sizeof(LONGLONG);  /* 8 bytes per pixel */\n\n    } else if ( (infptr->Fptr)->compress_type == RICE_1 &&\n               (infptr->Fptr)->zbitpix == BYTE_IMG && \n\t       (infptr->Fptr)->rice_bytepix == 1) {\n\n           idatalen = tilelen * sizeof(char); /* 1 byte per pixel */\n    } else if ( ( (infptr->Fptr)->compress_type == GZIP_1  ||\n                  (infptr->Fptr)->compress_type == GZIP_2  ||\n                  (infptr->Fptr)->compress_type == BZIP2_1 ) &&\n               (infptr->Fptr)->zbitpix == BYTE_IMG ) {\n\n           idatalen = tilelen * sizeof(char); /* 1 byte per pixel */\n    } else if ( (infptr->Fptr)->compress_type == RICE_1 &&\n               (infptr->Fptr)->zbitpix == SHORT_IMG && \n\t       (infptr->Fptr)->rice_bytepix == 2) {\n\n           idatalen = tilelen * sizeof(short); /* 2 bytes per pixel */\n    } else if ( ( (infptr->Fptr)->compress_type == GZIP_1  ||\n                  (infptr->Fptr)->compress_type == GZIP_2  ||\n                  (infptr->Fptr)->compress_type == BZIP2_1 )  &&\n               (infptr->Fptr)->zbitpix == SHORT_IMG ) {\n\n           idatalen = tilelen * sizeof(short); /* 2 bytes per pixel */\n    } else if ( ( (infptr->Fptr)->compress_type == GZIP_1  ||\n                  (infptr->Fptr)->compress_type == GZIP_2  ||\n                  (infptr->Fptr)->compress_type == BZIP2_1 ) &&\n               (infptr->Fptr)->zbitpix == DOUBLE_IMG ) {\n\n           idatalen = tilelen * sizeof(double); /* 8 bytes per pixel  */\n    } else {\n           idatalen = tilelen * sizeof(int);  /* all other cases have int pixels */\n    }\n\n    idata = (int*) malloc (idatalen); \n    if (idata == NULL) {\n\t    ffpmsg(\"Memory allocation failure for idata. (imcomp_decompress_tile)\");\n\t    return (*status = MEMORY_ALLOCATION);\n    }\n\n    /* ************************************************************* */\n    /* allocate memory for the compressed bytes */\n\n    if ((infptr->Fptr)->compress_type == PLIO_1) {\n        cbuf = (unsigned char *) malloc ((long) nelemll * sizeof (short));\n    } else {\n        cbuf = (unsigned char *) malloc ((long) nelemll);\n    }\n    if (cbuf == NULL) {\n\tffpmsg(\"Out of memory for cbuf. (imcomp_decompress_tile)\");\n        free(idata);\n\treturn (*status = MEMORY_ALLOCATION);\n    }\n    \n    /* ************************************************************* */\n    /* read the compressed bytes from the FITS file */\n\n    if ((infptr->Fptr)->compress_type == PLIO_1) {\n        fits_read_col(infptr, TSHORT, (infptr->Fptr)->cn_compressed, nrow,\n             1, (long) nelemll, &snull, (short *) cbuf, NULL, status);\n    } else {\n       fits_read_col(infptr, TBYTE, (infptr->Fptr)->cn_compressed, nrow,\n             1, (long) nelemll, &charnull, cbuf, NULL, status);\n    }\n\n    if (*status > 0) {\n        ffpmsg(\"error reading compressed byte stream from binary table\");\n\tfree (cbuf);\n        free(idata);\n        return (*status);\n    }\n\n    /* ************************************************************* */\n    /*  call the algorithm-specific code to uncompress the tile */\n\n    if ((infptr->Fptr)->compress_type == RICE_1) {\n\n        blocksize = (infptr->Fptr)->rice_blocksize;\n\n        if ((infptr->Fptr)->rice_bytepix == 1 ) {\n            *status = fits_rdecomp_byte (cbuf, (long) nelemll, (unsigned char *)idata,\n                        tilelen, blocksize);\n            tiledatatype = TBYTE;\n        } else if ((infptr->Fptr)->rice_bytepix == 2 ) {\n            *status = fits_rdecomp_short (cbuf, (long) nelemll, (unsigned short *)idata,\n                        tilelen, blocksize);\n            tiledatatype = TSHORT;\n        } else {\n            *status = fits_rdecomp (cbuf, (long) nelemll, (unsigned int *)idata,\n                         tilelen, blocksize);\n            tiledatatype = TINT;\n        }\n\n    /* ************************************************************* */\n    } else if ((infptr->Fptr)->compress_type == HCOMPRESS_1)  {\n\n        smooth = (infptr->Fptr)->hcomp_smooth;\n\n        if ( ((infptr->Fptr)->zbitpix == BYTE_IMG || (infptr->Fptr)->zbitpix == SHORT_IMG)) {\n            *status = fits_hdecompress(cbuf, smooth, idata, &nx, &ny,\n\t        &scale, status);\n        } else {  /* zbitpix = LONG_IMG (32) */\n            /* idata must have been allocated twice as large for this to work */\n            *status = fits_hdecompress64(cbuf, smooth, (LONGLONG *) idata, &nx, &ny,\n\t        &scale, status);\n        }       \n\n        tiledatatype = TINT;\n\n    /* ************************************************************* */\n    } else if ((infptr->Fptr)->compress_type == PLIO_1) {\n\n        pl_l2pi ((short *) cbuf, 1, idata, tilelen);  /* uncompress the data */\n        tiledatatype = TINT;\n\n    /* ************************************************************* */\n    } else if ( ((infptr->Fptr)->compress_type == GZIP_1) ||\n                ((infptr->Fptr)->compress_type == GZIP_2) ) {\n\n        uncompress2mem_from_mem ((char *)cbuf, (long) nelemll,\n             (char **) &idata, &idatalen, realloc, &tilebytesize, status);\n\n        /* determine the data type of the uncompressed array, and */\n\t/*  do byte unshuffling and unswapping if needed */\n\tif (tilebytesize == (size_t) (tilelen * 2)) {\n\t    /* this is a short I*2 array */\n            tiledatatype = TSHORT;\n\n            if ( (infptr->Fptr)->compress_type == GZIP_2 )\n\t\t    fits_unshuffle_2bytes((char *) idata, tilelen, status);\n\n#if BYTESWAPPED\n            ffswap2((short *) idata, tilelen);\n#endif\n\n\t} else if (tilebytesize == (size_t) (tilelen * 4)) {\n\t    /* this is a int I*4 array (or maybe R*4) */\n            tiledatatype = TINT;\n\n            if ( (infptr->Fptr)->compress_type == GZIP_2 )\n\t\t    fits_unshuffle_4bytes((char *) idata, tilelen, status);\n\n#if BYTESWAPPED\n            ffswap4(idata, tilelen);\n#endif\n\n\t} else if (tilebytesize == (size_t) (tilelen * 8)) {\n\t    /* this is a R*8 double array */\n            tiledatatype = TDOUBLE;\n\n            if ( (infptr->Fptr)->compress_type == GZIP_2 )\n\t\t    fits_unshuffle_8bytes((char *) idata, tilelen, status);\n#if BYTESWAPPED\n            ffswap8((double *) idata, tilelen);\n#endif\n\n        } else if (tilebytesize == (size_t) tilelen) {\n\t    \n\t    /* this is an unsigned char I*1 array */\n            tiledatatype = TBYTE;\n\n        } else {\n            ffpmsg(\"error: uncompressed tile has wrong size\");\n            free(idata);\n            return (*status = DATA_DECOMPRESSION_ERR);\n        }\n\n    /* ************************************************************* */\n    } else if ((infptr->Fptr)->compress_type == BZIP2_1) {\n\n/*  BZIP2 is not supported in the public release; this is only for test purposes \n\n        if (BZ2_bzBuffToBuffDecompress ((char *) idata, &idatalen, \n\t\t(char *)cbuf, (unsigned int) nelemll, 0, 0) )\n*/\n        {\n            ffpmsg(\"bzip2 decompression error\");\n            free(idata);\n            free (cbuf);\n            return (*status = DATA_DECOMPRESSION_ERR);\n        }\n\n        if ((infptr->Fptr)->zbitpix == BYTE_IMG) {\n\t     tiledatatype = TBYTE;\n        } else if ((infptr->Fptr)->zbitpix == SHORT_IMG) {\n  \t     tiledatatype = TSHORT;\n#if BYTESWAPPED\n            ffswap2((short *) idata, tilelen);\n#endif\n\t} else {\n  \t     tiledatatype = TINT;\n#if BYTESWAPPED\n            ffswap4(idata, tilelen);\n#endif\n\t}\n\n    /* ************************************************************* */\n    } else {\n        ffpmsg(\"unknown compression algorithm\");\n        free(idata);\n        return (*status = DATA_DECOMPRESSION_ERR);\n    }\n\n    free(cbuf);\n    if (*status)  {  /* error uncompressing the tile */\n            free(idata);\n            return (*status);\n    }\n\n    /* ************************************************************* */\n    /* copy the uncompressed tile data to the output buffer, doing */\n    /* null checking, datatype conversion and linear scaling, if necessary */\n\n    if (nulval == 0)\n         nulval = &dummy;  /* set address to dummy value */\n\n    if (datatype == TSHORT)\n    {\n        pixlen = sizeof(short);\n\n\tif ((infptr->Fptr)->quantize_level == NO_QUANTIZE) {\n\t /* the floating point pixels were losselessly compressed with GZIP */\n\t /* Just have to copy the values to the output array */\n\t \n          if (tiledatatype == TINT) {\n              fffr4i2((float *) idata, tilelen, bscale, bzero, nullcheck,   \n                *(short *) nulval, bnullarray, anynul,\n                (short *) buffer, status);\n          } else {\n              fffr8i2((double *) idata, tilelen, bscale, bzero, nullcheck,   \n                *(short *) nulval, bnullarray, anynul,\n                (short *) buffer, status);\n          }\n        } else if (tiledatatype == TINT) {\n          if ((infptr->Fptr)->compress_type == PLIO_1 && actual_bzero == 32768.) {\n\t    /* special case where unsigned 16-bit integers have been */\n\t    /* offset by +32768 when using PLIO */\n            fffi4i2(idata, tilelen, bscale, bzero - 32768., nullcheck, tnull,\n             *(short *) nulval, bnullarray, anynul,\n            (short *) buffer, status);\n          } else {\n            fffi4i2(idata, tilelen, bscale, bzero, nullcheck, tnull,\n             *(short *) nulval, bnullarray, anynul,\n            (short *) buffer, status);\n\n            /*\n\t       Hcompress is a special case:  ignore any numerical overflow\n\t       errors that may have occurred during the integer*4 to integer*2\n\t       convertion.  Overflows can happen when a lossy Hcompress algorithm\n\t       is invoked (with a non-zero scale factor).  The fffi4i2 routine\n\t       clips the returned values to be within the legal I*2 range, so\n\t       all we need to is to reset the error status to zero.\n\t    */\n\t       \n             if ((infptr->Fptr)->compress_type == HCOMPRESS_1) {\n                if ((*status == NUM_OVERFLOW) || (*status == OVERFLOW_ERR))\n                        *status = 0;\n             }\n          }\n        } else if (tiledatatype == TSHORT) {\n          fffi2i2((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull,\n           *(short *) nulval, bnullarray, anynul,\n          (short *) buffer, status);\n        } else if (tiledatatype == TBYTE) {\n          fffi1i2((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull,\n           *(short *) nulval, bnullarray, anynul,\n          (short *) buffer, status);\n        }\n    }\n    else if (datatype == TINT)\n    {\n        pixlen = sizeof(int);\n\n\tif ((infptr->Fptr)->quantize_level == NO_QUANTIZE) {\n\t /* the floating point pixels were losselessly compressed with GZIP */\n\t /* Just have to copy the values to the output array */\n\t \n          if (tiledatatype == TINT) {\n              fffr4int((float *) idata, tilelen, bscale, bzero, nullcheck,   \n                *(int *) nulval, bnullarray, anynul,\n                (int *) buffer, status);\n          } else {\n              fffr8int((double *) idata, tilelen, bscale, bzero, nullcheck,   \n                *(int *) nulval, bnullarray, anynul,\n                (int *) buffer, status);\n          }\n        } else if (tiledatatype == TINT)\n          if ((infptr->Fptr)->compress_type == PLIO_1 && actual_bzero == 32768.) {\n\t    /* special case where unsigned 16-bit integers have been */\n\t    /* offset by +32768 when using PLIO */\n            fffi4int(idata, (long) tilelen, bscale, bzero - 32768., nullcheck, tnull,\n             *(int *) nulval, bnullarray, anynul,\n            (int *) buffer, status);\n          } else {\n            fffi4int(idata, (long) tilelen, bscale, bzero, nullcheck, tnull,\n             *(int *) nulval, bnullarray, anynul,\n            (int *) buffer, status);\n          } \n        else if (tiledatatype == TSHORT)\n          fffi2int((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull,\n           *(int *) nulval, bnullarray, anynul,\n           (int *) buffer, status);\n        else if (tiledatatype == TBYTE)\n          fffi1int((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull,\n           *(int *) nulval, bnullarray, anynul,\n           (int *) buffer, status);\n    }\n    else if (datatype == TLONG)\n    {\n        pixlen = sizeof(long);\n\n\tif ((infptr->Fptr)->quantize_level == NO_QUANTIZE) {\n\t /* the floating point pixels were losselessly compressed with GZIP */\n\t /* Just have to copy the values to the output array */\n\t \n          if (tiledatatype == TINT) {\n              fffr4i4((float *) idata, tilelen, bscale, bzero, nullcheck,   \n                *(long *) nulval, bnullarray, anynul,\n                (long *) buffer, status);\n          } else {\n              fffr8i4((double *) idata, tilelen, bscale, bzero, nullcheck,   \n                *(long *) nulval, bnullarray, anynul,\n                (long *) buffer, status);\n          }\n        } else if (tiledatatype == TINT)\n          if ((infptr->Fptr)->compress_type == PLIO_1 && actual_bzero == 32768.) {\n\t    /* special case where unsigned 16-bit integers have been */\n\t    /* offset by +32768 when using PLIO */\n            fffi4i4(idata, tilelen, bscale, bzero - 32768., nullcheck, tnull,\n             *(long *) nulval, bnullarray, anynul,\n             (long *) buffer, status);\n          } else {\n            fffi4i4(idata, tilelen, bscale, bzero, nullcheck, tnull,\n             *(long *) nulval, bnullarray, anynul,\n              (long *) buffer, status);\n          }\n        else if (tiledatatype == TSHORT)\n          fffi2i4((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull,\n           *(long *) nulval, bnullarray, anynul,\n            (long *) buffer, status);\n        else if (tiledatatype == TBYTE)\n          fffi1i4((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull,\n           *(long *) nulval, bnullarray, anynul,\n            (long *) buffer, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n        pixlen = sizeof(float);\n        if (nulval) {\n\t      fnulval = *(float *) nulval;\n\t}\n \n\tif ((infptr->Fptr)->quantize_level == NO_QUANTIZE) {\n\t /* the floating point pixels were losselessly compressed with GZIP */\n\t /* Just have to copy the values to the output array */\n\t \n          if (tiledatatype == TINT) {\n              fffr4r4((float *) idata, tilelen, bscale, bzero, nullcheck,   \n                fnulval, bnullarray, anynul,\n                (float *) buffer, status);\n          } else {\n              fffr8r4((double *) idata, tilelen, bscale, bzero, nullcheck,   \n                fnulval, bnullarray, anynul,\n                (float *) buffer, status);\n          }\n\t\n        } else if ((infptr->Fptr)->quantize_method == SUBTRACTIVE_DITHER_1 ||\n\t           (infptr->Fptr)->quantize_method == SUBTRACTIVE_DITHER_2) {\n\n         /* use the new dithering algorithm (introduced in July 2009) */\n\n         if (tiledatatype == TINT)\n          unquantize_i4r4(nrow + (infptr->Fptr)->dither_seed - 1, idata, \n\t   tilelen, bscale, bzero, (infptr->Fptr)->quantize_method, nullcheck, tnull,\n           fnulval, bnullarray, anynul,\n            (float *) buffer, status);\n         else if (tiledatatype == TSHORT)\n          unquantize_i2r4(nrow + (infptr->Fptr)->dither_seed - 1, (short *)idata, \n\t   tilelen, bscale, bzero, (infptr->Fptr)->quantize_method, nullcheck, (short) tnull,\n           fnulval, bnullarray, anynul,\n            (float *) buffer, status);\n         else if (tiledatatype == TBYTE)\n          unquantize_i1r4(nrow + (infptr->Fptr)->dither_seed - 1, (unsigned char *)idata, \n\t   tilelen, bscale, bzero, (infptr->Fptr)->quantize_method, nullcheck, (unsigned char) tnull,\n           fnulval, bnullarray, anynul,\n            (float *) buffer, status);\n\n        } else {  /* use the old \"round to nearest level\" quantization algorithm */\n\n         if (tiledatatype == TINT)\n          if ((infptr->Fptr)->compress_type == PLIO_1 && actual_bzero == 32768.) {\n\t    /* special case where unsigned 16-bit integers have been */\n\t    /* offset by +32768 when using PLIO */\n            fffi4r4(idata, tilelen, bscale, bzero - 32768., nullcheck, tnull,\n             fnulval, bnullarray, anynul,\n             (float *) buffer, status);\n          } else {\n            fffi4r4(idata, tilelen, bscale, bzero, nullcheck, tnull,  \n             fnulval, bnullarray, anynul,\n              (float *) buffer, status);\n          }\n         else if (tiledatatype == TSHORT)\n          fffi2r4((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull,  \n           fnulval, bnullarray, anynul,\n            (float *) buffer, status);\n         else if (tiledatatype == TBYTE)\n          fffi1r4((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull,\n           fnulval, bnullarray, anynul,\n            (float *) buffer, status);\n\t}\n    }\n    else if (datatype == TDOUBLE)\n    {\n        pixlen = sizeof(double);\n        if (nulval) {\n\t     dnulval = *(double *) nulval;\n\t}\n\n\tif ((infptr->Fptr)->quantize_level == NO_QUANTIZE) {\n\t /* the floating point pixels were losselessly compressed with GZIP */\n\t /* Just have to copy the values to the output array */\n\n          if (tiledatatype == TINT) {\n              fffr4r8((float *) idata, tilelen, bscale, bzero, nullcheck,   \n                dnulval, bnullarray, anynul,\n                (double *) buffer, status);\n          } else {\n              fffr8r8((double *) idata, tilelen, bscale, bzero, nullcheck,   \n                dnulval, bnullarray, anynul,\n                (double *) buffer, status);\n          }\n\t\n\t} else if ((infptr->Fptr)->quantize_method == SUBTRACTIVE_DITHER_1 ||\n\t           (infptr->Fptr)->quantize_method == SUBTRACTIVE_DITHER_2) {\n\n         /* use the new dithering algorithm (introduced in July 2009) */\n         if (tiledatatype == TINT)\n          unquantize_i4r8(nrow + (infptr->Fptr)->dither_seed - 1, idata,\n\t   tilelen, bscale, bzero, (infptr->Fptr)->quantize_method, nullcheck, tnull,\n           dnulval, bnullarray, anynul,\n            (double *) buffer, status);\n         else if (tiledatatype == TSHORT)\n          unquantize_i2r8(nrow + (infptr->Fptr)->dither_seed - 1, (short *)idata,\n\t   tilelen, bscale, bzero, (infptr->Fptr)->quantize_method, nullcheck, (short) tnull,\n           dnulval, bnullarray, anynul,\n            (double *) buffer, status);\n         else if (tiledatatype == TBYTE)\n          unquantize_i1r8(nrow + (infptr->Fptr)->dither_seed - 1, (unsigned char *)idata,\n\t   tilelen, bscale, bzero, (infptr->Fptr)->quantize_method, nullcheck, (unsigned char) tnull,\n           dnulval, bnullarray, anynul,\n            (double *) buffer, status);\n\n        } else {  /* use the old \"round to nearest level\" quantization algorithm */\n\n         if (tiledatatype == TINT) {\n          if ((infptr->Fptr)->compress_type == PLIO_1 && actual_bzero == 32768.) {\n\t    /* special case where unsigned 16-bit integers have been */\n\t    /* offset by +32768 when using PLIO */\n            fffi4r8(idata, tilelen, bscale, bzero - 32768., nullcheck, tnull,\n             dnulval, bnullarray, anynul,\n             (double *) buffer, status);\n          } else {\n            fffi4r8(idata, tilelen, bscale, bzero, nullcheck, tnull,\n             dnulval, bnullarray, anynul,\n              (double *) buffer, status);\n          }\n         } else if (tiledatatype == TSHORT) {\n          fffi2r8((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull,\n           dnulval, bnullarray, anynul,\n            (double *) buffer, status);\n         } else if (tiledatatype == TBYTE)\n          fffi1r8((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull,\n           dnulval, bnullarray, anynul,\n            (double *) buffer, status);\n\t}\n    }\n    else if (datatype == TBYTE)\n    {\n        pixlen = sizeof(char);\n        if (tiledatatype == TINT)\n          fffi4i1(idata, tilelen, bscale, bzero, nullcheck, tnull,\n           *(unsigned char *) nulval, bnullarray, anynul,\n            (unsigned char *) buffer, status);\n        else if (tiledatatype == TSHORT)\n          fffi2i1((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull,\n           *(unsigned char *) nulval, bnullarray, anynul,\n            (unsigned char *) buffer, status);\n        else if (tiledatatype == TBYTE)\n          fffi1i1((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull,\n           *(unsigned char *) nulval, bnullarray, anynul,\n            (unsigned char *) buffer, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n        pixlen = sizeof(char);\n        if (tiledatatype == TINT)\n          fffi4s1(idata, tilelen, bscale, bzero, nullcheck, tnull,\n           *(signed char *) nulval, bnullarray, anynul,\n            (signed char *) buffer, status);\n        else if (tiledatatype == TSHORT)\n          fffi2s1((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull,\n           *(signed char *) nulval, bnullarray, anynul,\n            (signed char *) buffer, status);\n        else if (tiledatatype == TBYTE)\n          fffi1s1((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull,\n           *(signed char *) nulval, bnullarray, anynul,\n            (signed char *) buffer, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n        pixlen = sizeof(short);\n\n\tif ((infptr->Fptr)->quantize_level == NO_QUANTIZE) {\n\t /* the floating point pixels were losselessly compressed with GZIP */\n\t /* Just have to copy the values to the output array */\n\t \n          if (tiledatatype == TINT) {\n              fffr4u2((float *) idata, tilelen, bscale, bzero, nullcheck,   \n                *(unsigned short *) nulval, bnullarray, anynul,\n                (unsigned short *) buffer, status);\n          } else {\n              fffr8u2((double *) idata, tilelen, bscale, bzero, nullcheck,   \n                *(unsigned short *) nulval, bnullarray, anynul,\n                (unsigned short *) buffer, status);\n          }\n        } else if (tiledatatype == TINT)\n          if ((infptr->Fptr)->compress_type == PLIO_1 && actual_bzero == 32768.) {\n\t    /* special case where unsigned 16-bit integers have been */\n\t    /* offset by +32768 when using PLIO */\n            fffi4u2(idata, tilelen, bscale, bzero - 32768., nullcheck, tnull,\n             *(unsigned short *) nulval, bnullarray, anynul,\n            (unsigned short *) buffer, status);\n          } else {\n            fffi4u2(idata, tilelen, bscale, bzero, nullcheck, tnull,\n             *(unsigned short *) nulval, bnullarray, anynul,\n              (unsigned short *) buffer, status);\n          }\n        else if (tiledatatype == TSHORT)\n          fffi2u2((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull,\n           *(unsigned short *) nulval, bnullarray, anynul,\n            (unsigned short *) buffer, status);\n        else if (tiledatatype == TBYTE)\n          fffi1u2((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull,\n           *(unsigned short *) nulval, bnullarray, anynul,\n            (unsigned short *) buffer, status);\n    }\n    else if (datatype == TUINT)\n    {\n        pixlen = sizeof(int);\n\n\tif ((infptr->Fptr)->quantize_level == NO_QUANTIZE) {\n\t /* the floating point pixels were losselessly compressed with GZIP */\n\t /* Just have to copy the values to the output array */\n\t \n          if (tiledatatype == TINT) {\n              fffr4uint((float *) idata, tilelen, bscale, bzero, nullcheck,   \n                *(unsigned int *) nulval, bnullarray, anynul,\n                (unsigned int *) buffer, status);\n          } else {\n              fffr8uint((double *) idata, tilelen, bscale, bzero, nullcheck,   \n                *(unsigned int *) nulval, bnullarray, anynul,\n                (unsigned int *) buffer, status);\n          }\n        } else\n         if (tiledatatype == TINT)\n          if ((infptr->Fptr)->compress_type == PLIO_1 && actual_bzero == 32768.) {\n\t    /* special case where unsigned 16-bit integers have been */\n\t    /* offset by +32768 when using PLIO */\n            fffi4uint(idata, tilelen, bscale, bzero - 32768., nullcheck, tnull,\n             *(unsigned int *) nulval, bnullarray, anynul,\n              (unsigned int *) buffer, status);\n          } else {\n            fffi4uint(idata, tilelen, bscale, bzero, nullcheck, tnull,\n             *(unsigned int *) nulval, bnullarray, anynul,\n              (unsigned int *) buffer, status);\n          }\n        else if (tiledatatype == TSHORT)\n          fffi2uint((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull,\n           *(unsigned int *) nulval, bnullarray, anynul,\n            (unsigned int *) buffer, status);\n        else if (tiledatatype == TBYTE)\n          fffi1uint((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull,\n           *(unsigned int *) nulval, bnullarray, anynul,\n            (unsigned int *) buffer, status);\n    }\n    else if (datatype == TULONG)\n    {\n        pixlen = sizeof(long);\n\n\tif ((infptr->Fptr)->quantize_level == NO_QUANTIZE) {\n\t /* the floating point pixels were losselessly compressed with GZIP */\n\t /* Just have to copy the values to the output array */\n\t \n          if (tiledatatype == TINT) {\n              fffr4u4((float *) idata, tilelen, bscale, bzero, nullcheck,   \n                *(unsigned long *) nulval, bnullarray, anynul,\n                (unsigned long *) buffer, status);\n          } else {\n              fffr8u4((double *) idata, tilelen, bscale, bzero, nullcheck,   \n                *(unsigned long *) nulval, bnullarray, anynul,\n                (unsigned long *) buffer, status);\n          }\n        } else if (tiledatatype == TINT)\n          if ((infptr->Fptr)->compress_type == PLIO_1 && actual_bzero == 32768.) {\n\t    /* special case where unsigned 16-bit integers have been */\n\t    /* offset by +32768 when using PLIO */\n            fffi4u4(idata, tilelen, bscale, bzero - 32768., nullcheck, tnull,\n             *(unsigned long *) nulval, bnullarray, anynul,\n              (unsigned long *) buffer, status);\n          } else {\n            fffi4u4(idata, tilelen, bscale, bzero, nullcheck, tnull,\n             *(unsigned long *) nulval, bnullarray, anynul, \n              (unsigned long *) buffer, status);\n          }\n        else if (tiledatatype == TSHORT)\n          fffi2u4((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull,\n           *(unsigned long *) nulval, bnullarray, anynul, \n            (unsigned long *) buffer, status);\n        else if (tiledatatype == TBYTE)\n          fffi1u4((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull,\n           *(unsigned long *) nulval, bnullarray, anynul, \n            (unsigned long *) buffer, status);\n    }\n    else\n         *status = BAD_DATATYPE;\n\n    free(idata);  /* don't need the uncompressed tile any more */\n\n    /* **************************************************************** */\n    /* cache the tile, in case the application wants it again  */\n\n    /*   Don't cache the tile if tile is a single row of the image; \n         it is less likely that the cache will be used in this cases,\n\t so it is not worth the time and the memory overheads.\n    */\n    \n    if ((infptr->Fptr)->tilerow)  {  /* make sure cache has been allocated */\n     if ((infptr->Fptr)->znaxis[0]   != (infptr->Fptr)->tilesize[0] ||\n        (infptr->Fptr)->tilesize[1] != 1 )\n     {\n      tilesize = pixlen * tilelen;\n\n      /* check that tile size/type has not changed */\n      if (tilesize != (infptr->Fptr)->tiledatasize[tilecol] ||\n        datatype != (infptr->Fptr)->tiletype[tilecol] )  {\n\n        if (((infptr->Fptr)->tiledata)[tilecol]) {\n            free(((infptr->Fptr)->tiledata)[tilecol]);\t    \n        }\n\t\n        if (((infptr->Fptr)->tilenullarray)[tilecol]) {\n            free(((infptr->Fptr)->tilenullarray)[tilecol]);\n        }\n\t\n        ((infptr->Fptr)->tilenullarray)[tilecol] = 0;\n        ((infptr->Fptr)->tilerow)[tilecol] = 0;\n        ((infptr->Fptr)->tiledatasize)[tilecol] = 0;\n        ((infptr->Fptr)->tiletype)[tilecol] = 0;\n\n        /* allocate new array(s) */\n\t((infptr->Fptr)->tiledata)[tilecol] = malloc(tilesize);\n\n\tif (((infptr->Fptr)->tiledata)[tilecol] == 0)\n\t   return (*status);\n\n        if (nullcheck == 2) {  /* also need array of null pixel flags */\n\t    (infptr->Fptr)->tilenullarray[tilecol] = malloc(tilelen);\n\t    if ((infptr->Fptr)->tilenullarray[tilecol] == 0)\n\t        return (*status);\n        }\n\n        (infptr->Fptr)->tiledatasize[tilecol] = tilesize;\n        (infptr->Fptr)->tiletype[tilecol] = datatype;\n      }\n\n      /* copy the tile array(s) into cache buffer */\n      memcpy((infptr->Fptr)->tiledata[tilecol], buffer, tilesize);\n\n      if (nullcheck == 2) {\n\t    if ((infptr->Fptr)->tilenullarray == 0)  {\n       \t      (infptr->Fptr)->tilenullarray[tilecol] = malloc(tilelen);\n            }\n            memcpy((infptr->Fptr)->tilenullarray[tilecol], bnullarray, tilelen);\n      }\n\n      (infptr->Fptr)->tilerow[tilecol] = nrow;\n      (infptr->Fptr)->tileanynull[tilecol] = *anynul;\n     }\n    }\n    return (*status);\n}\n/*--------------------------------------------------------------------------*/\nint imcomp_test_overlap (\n    int ndim,           /* I - number of dimension in the tile and image */\n    long *tfpixel,      /* I - first pixel number in each dim. of the tile */\n    long *tlpixel,      /* I - last pixel number in each dim. of the tile */\n    long *fpixel,       /* I - first pixel number in each dim. of the image */\n    long *lpixel,       /* I - last pixel number in each dim. of the image */\n    long *ininc,        /* I - increment to be applied in each image dimen. */\n    int *status)\n\n/* \n  test if there are any intersecting pixels between this tile and the section\n  of the image defined by fixel, lpixel, ininc. \n*/\n{\n    long imgdim[MAX_COMPRESS_DIM]; /* product of preceding dimensions in the */\n                                   /* output image, allowing for inc factor */\n    long tiledim[MAX_COMPRESS_DIM]; /* product of preceding dimensions in the */\n                                 /* tile, array;  inc factor is not relevant */\n    long imgfpix[MAX_COMPRESS_DIM]; /* 1st img pix overlapping tile: 0 base, */\n                                    /*  allowing for inc factor */\n    long imglpix[MAX_COMPRESS_DIM]; /* last img pix overlapping tile 0 base, */\n                                    /*  allowing for inc factor */\n    long tilefpix[MAX_COMPRESS_DIM]; /* 1st tile pix overlapping img 0 base, */\n                                    /*  allowing for inc factor */\n    long inc[MAX_COMPRESS_DIM]; /* local copy of input ininc */\n    int ii;\n    long tf, tl;\n\n    if (*status > 0)\n        return(*status);\n\n\n    /* ------------------------------------------------------------ */\n    /* calc amount of overlap in each dimension; if there is zero   */\n    /* overlap in any dimension then just return  */\n    /* ------------------------------------------------------------ */\n    \n    for (ii = 0; ii < ndim; ii++)\n    {\n        if (tlpixel[ii] < fpixel[ii] || tfpixel[ii] > lpixel[ii])\n            return(0);  /* there are no overlapping pixels */\n\n        inc[ii] = ininc[ii];\n\n        /* calc dimensions of the output image section */\n        imgdim[ii] = (lpixel[ii] - fpixel[ii]) / labs(inc[ii]) + 1;\n        if (imgdim[ii] < 1) {\n            *status = NEG_AXIS;\n            return(0);\n        }\n\n        /* calc dimensions of the tile */\n        tiledim[ii] = tlpixel[ii] - tfpixel[ii] + 1;\n        if (tiledim[ii] < 1) {\n            *status = NEG_AXIS;\n            return(0);\n        }\n\n        if (ii > 0)\n           tiledim[ii] *= tiledim[ii - 1];  /* product of dimensions */\n\n        /* first and last pixels in image that overlap with the tile, 0 base */\n        tf = tfpixel[ii] - 1;\n        tl = tlpixel[ii] - 1;\n\n        /* skip this plane if it falls in the cracks of the subsampled image */\n        while ((tf-(fpixel[ii] - 1)) % labs(inc[ii]))\n        {\n           tf++;\n           if (tf > tl)\n             return(0);  /* no overlapping pixels */\n        }\n\n        while ((tl-(fpixel[ii] - 1)) % labs(inc[ii]))\n        {\n           tl--;\n           if (tf > tl)\n             return(0);  /* no overlapping pixels */\n        }\n        imgfpix[ii] = maxvalue((tf - fpixel[ii] +1) / labs(inc[ii]) , 0);\n        imglpix[ii] = minvalue((tl - fpixel[ii] +1) / labs(inc[ii]) ,\n                               imgdim[ii] - 1);\n\n        /* first pixel in the tile that overlaps with the image (0 base) */\n        tilefpix[ii] = maxvalue(fpixel[ii] - tfpixel[ii], 0);\n\n        while ((tfpixel[ii] + tilefpix[ii] - fpixel[ii]) % labs(inc[ii]))\n        {\n           (tilefpix[ii])++;\n           if (tilefpix[ii] >= tiledim[ii])\n              return(0);  /* no overlapping pixels */\n        }\n\n        if (ii > 0)\n           imgdim[ii] *= imgdim[ii - 1];  /* product of dimensions */\n    }\n\n    return(1);  /* there appears to be  intersecting pixels */\n}\n/*--------------------------------------------------------------------------*/\nint imcomp_copy_overlap (\n    char *tile,         /* I - multi dimensional array of tile pixels */\n    int pixlen,         /* I - number of bytes in each tile or image pixel */\n    int ndim,           /* I - number of dimension in the tile and image */\n    long *tfpixel,      /* I - first pixel number in each dim. of the tile */\n    long *tlpixel,      /* I - last pixel number in each dim. of the tile */\n    char *bnullarray,   /* I - array of null flags; used if nullcheck = 2 */\n    char *image,        /* O - multi dimensional output image */\n    long *fpixel,       /* I - first pixel number in each dim. of the image */\n    long *lpixel,       /* I - last pixel number in each dim. of the image */\n    long *ininc,        /* I - increment to be applied in each image dimen. */\n    int nullcheck,      /* I - 0, 1: do nothing; 2: set nullarray for nulls */\n    char *nullarray, \n    int *status)\n\n/* \n  copy the intersecting pixels from a decompressed tile to the output image. \n  Both the tile and the image must have the same number of dimensions. \n*/\n{\n    long imgdim[MAX_COMPRESS_DIM]; /* product of preceding dimensions in the */\n                                   /* output image, allowing for inc factor */\n    long tiledim[MAX_COMPRESS_DIM]; /* product of preceding dimensions in the */\n                                 /* tile, array;  inc factor is not relevant */\n    long imgfpix[MAX_COMPRESS_DIM]; /* 1st img pix overlapping tile: 0 base, */\n                                    /*  allowing for inc factor */\n    long imglpix[MAX_COMPRESS_DIM]; /* last img pix overlapping tile 0 base, */\n                                    /*  allowing for inc factor */\n    long tilefpix[MAX_COMPRESS_DIM]; /* 1st tile pix overlapping img 0 base, */\n                                    /*  allowing for inc factor */\n    long inc[MAX_COMPRESS_DIM]; /* local copy of input ininc */\n    long i1, i2, i3, i4;   /* offset along each axis of the image */\n    long it1, it2, it3, it4;\n    long im1, im2, im3, im4;  /* offset to image pixel, allowing for inc */\n    long ipos, tf, tl;\n    long t2, t3, t4;   /* offset along each axis of the tile */\n    long tilepix, imgpix, tilepixbyte, imgpixbyte;\n    int ii, overlap_bytes, overlap_flags;\n\n    if (*status > 0)\n        return(*status);\n\n    for (ii = 0; ii < MAX_COMPRESS_DIM; ii++)\n    {\n        /* set default values for higher dimensions */\n        inc[ii] = 1;\n        imgdim[ii] = 1;\n        tiledim[ii] = 1;\n        imgfpix[ii] = 0;\n        imglpix[ii] = 0;\n        tilefpix[ii] = 0;\n    }\n\n    /* ------------------------------------------------------------ */\n    /* calc amount of overlap in each dimension; if there is zero   */\n    /* overlap in any dimension then just return  */\n    /* ------------------------------------------------------------ */\n    \n    for (ii = 0; ii < ndim; ii++)\n    {\n        if (tlpixel[ii] < fpixel[ii] || tfpixel[ii] > lpixel[ii])\n            return(*status);  /* there are no overlapping pixels */\n\n        inc[ii] = ininc[ii];\n\n        /* calc dimensions of the output image section */\n        imgdim[ii] = (lpixel[ii] - fpixel[ii]) / labs(inc[ii]) + 1;\n        if (imgdim[ii] < 1)\n            return(*status = NEG_AXIS);\n\n        /* calc dimensions of the tile */\n        tiledim[ii] = tlpixel[ii] - tfpixel[ii] + 1;\n        if (tiledim[ii] < 1)\n            return(*status = NEG_AXIS);\n\n        if (ii > 0)\n           tiledim[ii] *= tiledim[ii - 1];  /* product of dimensions */\n\n        /* first and last pixels in image that overlap with the tile, 0 base */\n        tf = tfpixel[ii] - 1;\n        tl = tlpixel[ii] - 1;\n\n        /* skip this plane if it falls in the cracks of the subsampled image */\n        while ((tf-(fpixel[ii] - 1)) % labs(inc[ii]))\n        {\n           tf++;\n           if (tf > tl)\n             return(*status);  /* no overlapping pixels */\n        }\n\n        while ((tl-(fpixel[ii] - 1)) % labs(inc[ii]))\n        {\n           tl--;\n           if (tf > tl)\n             return(*status);  /* no overlapping pixels */\n        }\n        imgfpix[ii] = maxvalue((tf - fpixel[ii] +1) / labs(inc[ii]) , 0);\n        imglpix[ii] = minvalue((tl - fpixel[ii] +1) / labs(inc[ii]) ,\n                               imgdim[ii] - 1);\n\n        /* first pixel in the tile that overlaps with the image (0 base) */\n        tilefpix[ii] = maxvalue(fpixel[ii] - tfpixel[ii], 0);\n\n        while ((tfpixel[ii] + tilefpix[ii] - fpixel[ii]) % labs(inc[ii]))\n        {\n           (tilefpix[ii])++;\n           if (tilefpix[ii] >= tiledim[ii])\n              return(*status);  /* no overlapping pixels */\n        }\n/*\nprintf(\"ii tfpixel, tlpixel %d %d %d \\n\",ii, tfpixel[ii], tlpixel[ii]);\nprintf(\"ii, tf, tl, imgfpix,imglpix, tilefpix %d %d %d %d %d %d\\n\",ii,\n tf,tl,imgfpix[ii], imglpix[ii],tilefpix[ii]);\n*/\n        if (ii > 0)\n           imgdim[ii] *= imgdim[ii - 1];  /* product of dimensions */\n    }\n\n    /* ---------------------------------------------------------------- */\n    /* calc number of pixels in each row (first dimension) that overlap */\n    /* multiply by pixlen to get number of bytes to copy in each loop   */\n    /* ---------------------------------------------------------------- */\n\n    if (inc[0] != 1)\n       overlap_flags = 1;  /* can only copy 1 pixel at a time */\n    else\n       overlap_flags = imglpix[0] - imgfpix[0] + 1;  /* can copy whole row */\n\n    overlap_bytes = overlap_flags * pixlen;\n\n    /* support up to 5 dimensions for now */\n    for (i4 = 0, it4=0; i4 <= imglpix[4] - imgfpix[4]; i4++, it4++)\n    {\n     /* increment plane if it falls in the cracks of the subsampled image */\n     while (ndim > 4 &&  (tfpixel[4] + tilefpix[4] - fpixel[4] + it4)\n                          % labs(inc[4]) != 0)\n        it4++;\n\n       /* offset to start of hypercube */\n       if (inc[4] > 0)\n          im4 = (i4 + imgfpix[4]) * imgdim[3];\n       else\n          im4 = imgdim[4] - (i4 + 1 + imgfpix[4]) * imgdim[3];\n\n      t4 = (tilefpix[4] + it4) * tiledim[3];\n      for (i3 = 0, it3=0; i3 <= imglpix[3] - imgfpix[3]; i3++, it3++)\n      {\n       /* increment plane if it falls in the cracks of the subsampled image */\n       while (ndim > 3 &&  (tfpixel[3] + tilefpix[3] - fpixel[3] + it3)\n                            % labs(inc[3]) != 0)\n          it3++;\n\n       /* offset to start of cube */\n       if (inc[3] > 0)\n          im3 = (i3 + imgfpix[3]) * imgdim[2] + im4;\n       else\n          im3 = imgdim[3] - (i3 + 1 + imgfpix[3]) * imgdim[2] + im4;\n\n       t3 = (tilefpix[3] + it3) * tiledim[2] + t4;\n\n       /* loop through planes of the image */\n       for (i2 = 0, it2=0; i2 <= imglpix[2] - imgfpix[2]; i2++, it2++)\n       {\n          /* incre plane if it falls in the cracks of the subsampled image */\n          while (ndim > 2 &&  (tfpixel[2] + tilefpix[2] - fpixel[2] + it2)\n                               % labs(inc[2]) != 0)\n             it2++;\n\n          /* offset to start of plane */\n          if (inc[2] > 0)\n             im2 = (i2 + imgfpix[2]) * imgdim[1] + im3;\n          else\n             im2 = imgdim[2] - (i2 + 1 + imgfpix[2]) * imgdim[1] + im3;\n\n          t2 = (tilefpix[2] + it2) * tiledim[1] + t3;\n\n          /* loop through rows of the image */\n          for (i1 = 0, it1=0; i1 <= imglpix[1] - imgfpix[1]; i1++, it1++)\n          {\n             /* incre row if it falls in the cracks of the subsampled image */\n             while (ndim > 1 &&  (tfpixel[1] + tilefpix[1] - fpixel[1] + it1)\n                                  % labs(inc[1]) != 0)\n                it1++;\n\n             /* calc position of first pixel in tile to be copied */\n             tilepix = tilefpix[0] + (tilefpix[1] + it1) * tiledim[0] + t2;\n\n             /* offset to start of row */\n             if (inc[1] > 0)\n                im1 = (i1 + imgfpix[1]) * imgdim[0] + im2;\n             else\n                im1 = imgdim[1] - (i1 + 1 + imgfpix[1]) * imgdim[0] + im2;\n/*\nprintf(\"inc = %d %d %d %d\\n\",inc[0],inc[1],inc[2],inc[3]);\nprintf(\"im1,im2,im3,im4 = %d %d %d %d\\n\",im1,im2,im3,im4);\n*/\n             /* offset to byte within the row */\n             if (inc[0] > 0)\n                imgpix = imgfpix[0] + im1;\n             else\n                imgpix = imgdim[0] - 1 - imgfpix[0] + im1;\n/*\nprintf(\"tilefpix0,1, imgfpix1, it1, inc1, t2= %d %d %d %d %d %d\\n\",\n       tilefpix[0],tilefpix[1],imgfpix[1],it1,inc[1], t2);\nprintf(\"i1, it1, tilepix, imgpix %d %d %d %d \\n\", i1, it1, tilepix, imgpix);\n*/\n             /* loop over pixels along one row of the image */\n             for (ipos = imgfpix[0]; ipos <= imglpix[0]; ipos += overlap_flags)\n             {\n               if (nullcheck == 2)\n               {\n                   /* copy overlapping null flags from tile to image */\n                   memcpy(nullarray + imgpix, bnullarray + tilepix,\n                          overlap_flags);\n               }\n\n               /* convert from image pixel to byte offset */\n               tilepixbyte = tilepix * pixlen;\n               imgpixbyte  = imgpix  * pixlen;\n/*\nprintf(\"  tilepix, tilepixbyte, imgpix, imgpixbyte= %d %d %d %d\\n\",\n          tilepix, tilepixbyte, imgpix, imgpixbyte);\n*/\n               /* copy overlapping row of pixels from tile to image */\n               memcpy(image + imgpixbyte, tile + tilepixbyte, overlap_bytes);\n\n               tilepix += (overlap_flags * labs(inc[0]));\n               if (inc[0] > 0)\n                 imgpix += overlap_flags;\n               else\n                 imgpix -= overlap_flags;\n            }\n          }\n        }\n      }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint imcomp_merge_overlap (\n    char *tile,         /* O - multi dimensional array of tile pixels */\n    int pixlen,         /* I - number of bytes in each tile or image pixel */\n    int ndim,           /* I - number of dimension in the tile and image */\n    long *tfpixel,      /* I - first pixel number in each dim. of the tile */\n    long *tlpixel,      /* I - last pixel number in each dim. of the tile */\n    char *bnullarray,   /* I - array of null flags; used if nullcheck = 2 */\n    char *image,        /* I - multi dimensional output image */\n    long *fpixel,       /* I - first pixel number in each dim. of the image */\n    long *lpixel,       /* I - last pixel number in each dim. of the image */\n    int nullcheck,      /* I - 0, 1: do nothing; 2: set nullarray for nulls */\n    int *status)\n\n/* \n  Similar to imcomp_copy_overlap, except it copies the overlapping pixels from\n  the 'image' to the 'tile'.\n*/\n{\n    long imgdim[MAX_COMPRESS_DIM]; /* product of preceding dimensions in the */\n                                   /* output image, allowing for inc factor */\n    long tiledim[MAX_COMPRESS_DIM]; /* product of preceding dimensions in the */\n                                 /* tile, array;  inc factor is not relevant */\n    long imgfpix[MAX_COMPRESS_DIM]; /* 1st img pix overlapping tile: 0 base, */\n                                    /*  allowing for inc factor */\n    long imglpix[MAX_COMPRESS_DIM]; /* last img pix overlapping tile 0 base, */\n                                    /*  allowing for inc factor */\n    long tilefpix[MAX_COMPRESS_DIM]; /* 1st tile pix overlapping img 0 base, */\n                                    /*  allowing for inc factor */\n    long inc[MAX_COMPRESS_DIM]; /* local copy of input ininc */\n    long i1, i2, i3, i4;   /* offset along each axis of the image */\n    long it1, it2, it3, it4;\n    long im1, im2, im3, im4;  /* offset to image pixel, allowing for inc */\n    long ipos, tf, tl;\n    long t2, t3, t4;   /* offset along each axis of the tile */\n    long tilepix, imgpix, tilepixbyte, imgpixbyte;\n    int ii, overlap_bytes, overlap_flags;\n\n    if (*status > 0)\n        return(*status);\n\n    for (ii = 0; ii < MAX_COMPRESS_DIM; ii++)\n    {\n        /* set default values for higher dimensions */\n        inc[ii] = 1;\n        imgdim[ii] = 1;\n        tiledim[ii] = 1;\n        imgfpix[ii] = 0;\n        imglpix[ii] = 0;\n        tilefpix[ii] = 0;\n    }\n\n    /* ------------------------------------------------------------ */\n    /* calc amount of overlap in each dimension; if there is zero   */\n    /* overlap in any dimension then just return  */\n    /* ------------------------------------------------------------ */\n    \n    for (ii = 0; ii < ndim; ii++)\n    {\n        if (tlpixel[ii] < fpixel[ii] || tfpixel[ii] > lpixel[ii])\n            return(*status);  /* there are no overlapping pixels */\n\n        /* calc dimensions of the output image section */\n        imgdim[ii] = (lpixel[ii] - fpixel[ii]) / labs(inc[ii]) + 1;\n        if (imgdim[ii] < 1)\n            return(*status = NEG_AXIS);\n\n        /* calc dimensions of the tile */\n        tiledim[ii] = tlpixel[ii] - tfpixel[ii] + 1;\n        if (tiledim[ii] < 1)\n            return(*status = NEG_AXIS);\n\n        if (ii > 0)\n           tiledim[ii] *= tiledim[ii - 1];  /* product of dimensions */\n\n        /* first and last pixels in image that overlap with the tile, 0 base */\n        tf = tfpixel[ii] - 1;\n        tl = tlpixel[ii] - 1;\n\n        /* skip this plane if it falls in the cracks of the subsampled image */\n        while ((tf-(fpixel[ii] - 1)) % labs(inc[ii]))\n        {\n           tf++;\n           if (tf > tl)\n             return(*status);  /* no overlapping pixels */\n        }\n\n        while ((tl-(fpixel[ii] - 1)) % labs(inc[ii]))\n        {\n           tl--;\n           if (tf > tl)\n             return(*status);  /* no overlapping pixels */\n        }\n        imgfpix[ii] = maxvalue((tf - fpixel[ii] +1) / labs(inc[ii]) , 0);\n        imglpix[ii] = minvalue((tl - fpixel[ii] +1) / labs(inc[ii]) ,\n                               imgdim[ii] - 1);\n\n        /* first pixel in the tile that overlaps with the image (0 base) */\n        tilefpix[ii] = maxvalue(fpixel[ii] - tfpixel[ii], 0);\n\n        while ((tfpixel[ii] + tilefpix[ii] - fpixel[ii]) % labs(inc[ii]))\n        {\n           (tilefpix[ii])++;\n           if (tilefpix[ii] >= tiledim[ii])\n              return(*status);  /* no overlapping pixels */\n        }\n/*\nprintf(\"ii tfpixel, tlpixel %d %d %d \\n\",ii, tfpixel[ii], tlpixel[ii]);\nprintf(\"ii, tf, tl, imgfpix,imglpix, tilefpix %d %d %d %d %d %d\\n\",ii,\n tf,tl,imgfpix[ii], imglpix[ii],tilefpix[ii]);\n*/\n        if (ii > 0)\n           imgdim[ii] *= imgdim[ii - 1];  /* product of dimensions */\n    }\n\n    /* ---------------------------------------------------------------- */\n    /* calc number of pixels in each row (first dimension) that overlap */\n    /* multiply by pixlen to get number of bytes to copy in each loop   */\n    /* ---------------------------------------------------------------- */\n\n    if (inc[0] != 1)\n       overlap_flags = 1;  /* can only copy 1 pixel at a time */\n    else\n       overlap_flags = imglpix[0] - imgfpix[0] + 1;  /* can copy whole row */\n\n    overlap_bytes = overlap_flags * pixlen;\n\n    /* support up to 5 dimensions for now */\n    for (i4 = 0, it4=0; i4 <= imglpix[4] - imgfpix[4]; i4++, it4++)\n    {\n     /* increment plane if it falls in the cracks of the subsampled image */\n     while (ndim > 4 &&  (tfpixel[4] + tilefpix[4] - fpixel[4] + it4)\n                          % labs(inc[4]) != 0)\n        it4++;\n\n       /* offset to start of hypercube */\n       if (inc[4] > 0)\n          im4 = (i4 + imgfpix[4]) * imgdim[3];\n       else\n          im4 = imgdim[4] - (i4 + 1 + imgfpix[4]) * imgdim[3];\n\n      t4 = (tilefpix[4] + it4) * tiledim[3];\n      for (i3 = 0, it3=0; i3 <= imglpix[3] - imgfpix[3]; i3++, it3++)\n      {\n       /* increment plane if it falls in the cracks of the subsampled image */\n       while (ndim > 3 &&  (tfpixel[3] + tilefpix[3] - fpixel[3] + it3)\n                            % labs(inc[3]) != 0)\n          it3++;\n\n       /* offset to start of cube */\n       if (inc[3] > 0)\n          im3 = (i3 + imgfpix[3]) * imgdim[2] + im4;\n       else\n          im3 = imgdim[3] - (i3 + 1 + imgfpix[3]) * imgdim[2] + im4;\n\n       t3 = (tilefpix[3] + it3) * tiledim[2] + t4;\n\n       /* loop through planes of the image */\n       for (i2 = 0, it2=0; i2 <= imglpix[2] - imgfpix[2]; i2++, it2++)\n       {\n          /* incre plane if it falls in the cracks of the subsampled image */\n          while (ndim > 2 &&  (tfpixel[2] + tilefpix[2] - fpixel[2] + it2)\n                               % labs(inc[2]) != 0)\n             it2++;\n\n          /* offset to start of plane */\n          if (inc[2] > 0)\n             im2 = (i2 + imgfpix[2]) * imgdim[1] + im3;\n          else\n             im2 = imgdim[2] - (i2 + 1 + imgfpix[2]) * imgdim[1] + im3;\n\n          t2 = (tilefpix[2] + it2) * tiledim[1] + t3;\n\n          /* loop through rows of the image */\n          for (i1 = 0, it1=0; i1 <= imglpix[1] - imgfpix[1]; i1++, it1++)\n          {\n             /* incre row if it falls in the cracks of the subsampled image */\n             while (ndim > 1 &&  (tfpixel[1] + tilefpix[1] - fpixel[1] + it1)\n                                  % labs(inc[1]) != 0)\n                it1++;\n\n             /* calc position of first pixel in tile to be copied */\n             tilepix = tilefpix[0] + (tilefpix[1] + it1) * tiledim[0] + t2;\n\n             /* offset to start of row */\n             if (inc[1] > 0)\n                im1 = (i1 + imgfpix[1]) * imgdim[0] + im2;\n             else\n                im1 = imgdim[1] - (i1 + 1 + imgfpix[1]) * imgdim[0] + im2;\n/*\nprintf(\"inc = %d %d %d %d\\n\",inc[0],inc[1],inc[2],inc[3]);\nprintf(\"im1,im2,im3,im4 = %d %d %d %d\\n\",im1,im2,im3,im4);\n*/\n             /* offset to byte within the row */\n             if (inc[0] > 0)\n                imgpix = imgfpix[0] + im1;\n             else\n                imgpix = imgdim[0] - 1 - imgfpix[0] + im1;\n/*\nprintf(\"tilefpix0,1, imgfpix1, it1, inc1, t2= %d %d %d %d %d %d\\n\",\n       tilefpix[0],tilefpix[1],imgfpix[1],it1,inc[1], t2);\nprintf(\"i1, it1, tilepix, imgpix %d %d %d %d \\n\", i1, it1, tilepix, imgpix);\n*/\n             /* loop over pixels along one row of the image */\n             for (ipos = imgfpix[0]; ipos <= imglpix[0]; ipos += overlap_flags)\n             {\n               /* convert from image pixel to byte offset */\n               tilepixbyte = tilepix * pixlen;\n               imgpixbyte  = imgpix  * pixlen;\n/*\nprintf(\"  tilepix, tilepixbyte, imgpix, imgpixbyte= %d %d %d %d\\n\",\n          tilepix, tilepixbyte, imgpix, imgpixbyte);\n*/\n               /* copy overlapping row of pixels from image to tile */\n               memcpy(tile + tilepixbyte, image + imgpixbyte,  overlap_bytes);\n\n               tilepix += (overlap_flags * labs(inc[0]));\n               if (inc[0] > 0)\n                 imgpix += overlap_flags;\n               else\n                 imgpix -= overlap_flags;\n            }\n          }\n        }\n      }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int unquantize_i1r4(long row, /* tile number = row number in table  */\n            unsigned char *input, /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int dither_method,    /* I - dithering method to use             */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char tnull,  /* I - value of FITS TNULLn keyword if any */\n            float nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            float *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n    Unquantize byte values into the scaled floating point values\n*/\n{\n    long ii;\n    int nextrand, iseed;\n\n    if (!fits_rand_value) \n       if (fits_init_randoms()) return(MEMORY_ALLOCATION);\n\n    /* initialize the index to the next random number in the list */\n    iseed = (int) ((row - 1) % N_RANDOM);\n    nextrand = (int) (fits_rand_value[iseed] * 500);\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n             for (ii = 0; ii < ntodo; ii++)\n            {\n/*\n\t\tif (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE)\n\t\t    output[ii] = 0.0;\n\t\telse\n*/\n                    output[ii] = (float) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero);\n\n\t        nextrand++;\n\t        if (nextrand == N_RANDOM) {\n\t            iseed++;\n\t\t    if (iseed == N_RANDOM) iseed = 0;\n\t\t    nextrand = (int) (fits_rand_value[iseed] * 500);\n\t        }\n            }\n    }\n    else        /* must check for null values */\n    {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n/*\n\t\t    if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE)\n\t\t        output[ii] = 0.0;\n\t\t    else\n*/\n                        output[ii] = (float) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero);\n                } \n\n\t        nextrand++;\n\t        if (nextrand == N_RANDOM) {\n\t            iseed++;\n\t\t    if (iseed == N_RANDOM) iseed = 0;\n\t            nextrand = (int) (fits_rand_value[iseed] * 500);\n                }\n            }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int unquantize_i2r4(long row, /* seed for random values  */\n            short *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int dither_method,    /* I - dithering method to use             */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short tnull,          /* I - value of FITS TNULLn keyword if any */\n            float nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            float *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n    Unquantize short integer values into the scaled floating point values\n*/\n{\n    long ii;\n    int nextrand, iseed;\n\n    if (!fits_rand_value) \n       if (fits_init_randoms()) return(MEMORY_ALLOCATION);\n\n    /* initialize the index to the next random number in the list */\n    iseed = (int) ((row - 1) % N_RANDOM);\n    nextrand = (int) (fits_rand_value[iseed] * 500);\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n           for (ii = 0; ii < ntodo; ii++)\n            {\n/*\n\t\tif (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE)\n\t\t    output[ii] = 0.0;\n\t\telse\n*/\n                    output[ii] = (float) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero);\n\n\t        nextrand++;\n\t        if (nextrand == N_RANDOM) {\n\t            iseed++;\n\t\t    if (iseed == N_RANDOM) iseed = 0;\n\t\t    nextrand = (int) (fits_rand_value[iseed] * 500);\n\t        }\n            }\n    }\n    else        /* must check for null values */\n    {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n/*\n                    if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE)\n\t\t        output[ii] = 0.0;\n\t\t    else\n*/\n                        output[ii] = (float) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero);\n                }\n\n\t        nextrand++;\n\t        if (nextrand == N_RANDOM) {\n\t            iseed++;\n\t\t    if (iseed == N_RANDOM) iseed = 0;\n\t\t    nextrand = (int) (fits_rand_value[iseed] * 500);\n\t        }\n             }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int unquantize_i4r4(long row, /* tile number = row number in table    */\n            INT32BIT *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int dither_method,    /* I - dithering method to use             */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            INT32BIT tnull,       /* I - value of FITS TNULLn keyword if any */\n            float nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            float *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n    Unquantize int integer values into the scaled floating point values\n*/\n{\n    long ii;\n    int nextrand, iseed;\n\n    if (fits_rand_value == 0) \n       if (fits_init_randoms()) return(MEMORY_ALLOCATION);\n\n    /* initialize the index to the next random number in the list */\n    iseed = (int) ((row - 1) % N_RANDOM);\n    nextrand = (int) (fits_rand_value[iseed] * 500);\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE)\n\t\t    output[ii] = 0.0;\n\t\telse\n                    output[ii] = (float) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero);\n\n\t        nextrand++;\n\t        if (nextrand == N_RANDOM) {\n\t            iseed++;\n\t\t    if (iseed == N_RANDOM) iseed = 0;\n\t\t    nextrand = (int) (fits_rand_value[iseed] * 500);\n\t        }\n            }\n    }\n    else        /* must check for null values */\n    {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE)\n\t\t        output[ii] = 0.0;\n\t\t    else\n                        output[ii] = (float) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero);\n                }\n\n\t        nextrand++;\n\t        if (nextrand == N_RANDOM) {\n\t            iseed++;\n\t\t    if (iseed == N_RANDOM) iseed = 0;\n\t\t    nextrand = (int) (fits_rand_value[iseed] * 500);\n\t        }\n            }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int unquantize_i1r8(long row, /* tile number = row number in table  */\n            unsigned char *input, /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int dither_method,    /* I - dithering method to use             */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char tnull,  /* I - value of FITS TNULLn keyword if any */\n            double nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            double *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n    Unquantize byte values into the scaled floating point values\n*/\n{\n    long ii;\n    int nextrand, iseed;\n\n    if (!fits_rand_value) \n       if (fits_init_randoms()) return(MEMORY_ALLOCATION);\n\n    /* initialize the index to the next random number in the list */\n    iseed = (int) ((row - 1) % N_RANDOM);\n    nextrand = (int) (fits_rand_value[iseed] * 500);\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n/*\n                if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE)\n\t\t    output[ii] = 0.0;\n\t\telse\n*/\n                    output[ii] = (double) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero);\n\n\t        nextrand++;\n\t        if (nextrand == N_RANDOM) {\n\t            iseed++;\n\t\t    if (iseed == N_RANDOM) iseed = 0;\n\t\t    nextrand = (int) (fits_rand_value[iseed] * 500);\n\t        }\n            }\n    }\n    else        /* must check for null values */\n    {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n/*\n                    if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE)\n\t\t        output[ii] = 0.0;\n\t\t    else\n*/\n                        output[ii] = (double) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero);\n                }\n\n\t        nextrand++;\n\t        if (nextrand == N_RANDOM) {\n\t            iseed++;\n\t\t    if (iseed == N_RANDOM) iseed = 0;\n\t\t    nextrand = (int) (fits_rand_value[iseed] * 500);\n\t        }\n            }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int unquantize_i2r8(long row, /* tile number = row number in table  */\n            short *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int dither_method,    /* I - dithering method to use             */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short tnull,          /* I - value of FITS TNULLn keyword if any */\n            double nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            double *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n    Unquantize short integer values into the scaled floating point values\n*/\n{\n    long ii;\n    int nextrand, iseed;\n\n    if (!fits_rand_value) \n       if (fits_init_randoms()) return(MEMORY_ALLOCATION);\n\n    /* initialize the index to the next random number in the list */\n    iseed = (int) ((row - 1) % N_RANDOM);\n    nextrand = (int) (fits_rand_value[iseed] * 500);\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n           for (ii = 0; ii < ntodo; ii++)\n            {\n/*\n                if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE)\n\t\t    output[ii] = 0.0;\n\t\telse\n*/\n                    output[ii] = (double) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero);\n\n\t        nextrand++;\n\t        if (nextrand == N_RANDOM) {\n\t            iseed++;\n\t\t    if (iseed == N_RANDOM) iseed = 0;\n\t\t    nextrand = (int) (fits_rand_value[iseed] * 500);\n\t        }\n            }\n    }\n    else        /* must check for null values */\n    {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n/*                    if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE)\n\t\t        output[ii] = 0.0;\n\t\t    else\n*/\n                        output[ii] = (double) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero);\n                }\n\n\t        nextrand++;\n\t        if (nextrand == N_RANDOM) {\n\t            iseed++;\n\t\t    if (iseed == N_RANDOM) iseed = 0;\n\t\t    nextrand = (int) (fits_rand_value[iseed] * 500);\n\t        }\n            }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int unquantize_i4r8(long row, /* tile number = row number in table    */\n            INT32BIT *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int dither_method,    /* I - dithering method to use             */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            INT32BIT tnull,       /* I - value of FITS TNULLn keyword if any */\n            double nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            double *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n    Unquantize int integer values into the scaled floating point values\n*/\n{\n    long ii;\n    int nextrand, iseed;\n\n    if (fits_rand_value == 0) \n       if (fits_init_randoms()) return(MEMORY_ALLOCATION);\n\n    /* initialize the index to the next random number in the list */\n    iseed = (int) ((row - 1) % N_RANDOM);\n    nextrand = (int) (fits_rand_value[iseed] * 500);\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE)\n\t\t    output[ii] = 0.0;\n\t\telse\n                    output[ii] = (double) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero);\n\n\t        nextrand++;\n\t        if (nextrand == N_RANDOM) {\n\t            iseed++;\n\t\t    if (iseed == N_RANDOM) iseed = 0;\n\t\t    nextrand = (int) (fits_rand_value[iseed] * 500);\n\t        }\n            }\n    }\n    else        /* must check for null values */\n    {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE)\n\t\t        output[ii] = 0.0;\n\t\t    else\n                        output[ii] = (double) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero);\n                }\n\n\t        nextrand++;\n\t        if (nextrand == N_RANDOM) {\n\t            iseed++;\n\t\t    if (iseed == N_RANDOM) iseed = 0;\n\t\t    nextrand = (int) (fits_rand_value[iseed] * 500);\n\t        }\n            }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int imcomp_float2nan(float *indata, \n    long tilelen,\n    int *outdata,\n    float nullflagval, \n    int *status)\n/*\n  convert pixels that are equal to nullflag to NaNs.\n  Note that indata and outdata point to the same location.\n*/\n{\n    int ii;\n    \n    for (ii = 0; ii < tilelen; ii++) {\n\n      if (indata[ii] == nullflagval)\n        outdata[ii] = -1;  /* integer -1 has the same bit pattern as a real*4 NaN */\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int imcomp_double2nan(double *indata, \n    long tilelen,\n    LONGLONG *outdata,\n    double nullflagval, \n    int *status)\n/*\n  convert pixels that are equal to nullflag to NaNs.\n  Note that indata and outdata point to the same location.\n*/\n{\n    int ii;\n    \n    for (ii = 0; ii < tilelen; ii++) {\n\n      if (indata[ii] == nullflagval)\n        outdata[ii] = -1;  /* integer -1 has the same bit pattern as a real*8 NaN */\n    }\n\n    return(*status);\n}\n\n/* ======================================================================= */\n/*    TABLE COMPRESSION ROUTINES                                           */\n/* =-====================================================================== */\n\n/*--------------------------------------------------------------------------*/\nint fits_compress_table(fitsfile *infptr, fitsfile *outfptr, int *status)\n\n/*\n  Compress the input FITS Binary Table.\n  \n  First divide the table into equal sized chunks (analogous to image tiles) where all\n  the contain the same number of rows (except perhaps for the last chunk\n  which may contain fewer rows).   The chunks should not be too large to copy into memory\n  (currently, about 100 MB max seems a reasonable size).\n  \n  Then, on a chunk by piece basis, do the following:\n  \n  1. Transpose the table from its original row-major order, into column-major order.\n  All the bytes for each column are then continuous.  In addition, the bytes within\n  each table element may be shuffled so that the most significant\n  byte of every element occurs first in the array, followed by the next most\n  significant byte, and so on to the least significant byte.  Byte shuffling often\n  improves the gzip compression of floating-point arrays.\n   \n  2. Compress the contiguous array of bytes in each column using the specified\n  compression method.  If no method is specifed, then a default method for that\n  data type is chosen. \n  \n  3. Store the compressed stream of bytes into a column that has the same name\n  as in the input table, but which has a variable-length array data type (1QB).\n  The output table will contain one row for each piece of the original table.\n  \n  4. If the input table contain variable-length arrays, then each VLA\n  is compressed individually, and written to the heap in the output table.\n  Note that the output table will contain 2 sets of pointers for each VLA column.  \n  The first set contains the pointers to the uncompressed VLAs from the input table\n  and the second is the set of pointers to the compressed VLAs in the output table.\n  The latter set of pointers is used to reconstruct table when it is uncompressed,\n  so that the heap has exactly the same structure as in the original file.  The 2\n  sets of pointers are concatinated together, compressed with gzip, and written to\n  the output table.  When reading the compressed table, the only VLA that is directly\n  visible is this compressed array of descriptors.  One has to uncompress this array\n  to be able to to read all the descriptors to the individual VLAs in the column.  \n*/\n{ \n    long maxchunksize = 10000000; /* default value for the size of each chunk of the table */\n\n    char *cm_buffer;  /* memory buffer for the transposed, Column-Major, chunk of the table */ \n    LONGLONG cm_colstart[1000];  /* starting offset of each column in the cm_buffer */\n    LONGLONG rm_repeat[1000];    /* repeat count of each column in the input row-major table */\n    LONGLONG rm_colwidth[999];   /* width in bytes of each column in the input row-major table */\n    LONGLONG cm_repeat[999];  /* total number of elements in each column of the transposed column-major table */\n\n    int coltype[999];         /* data type code for each column */\n    int compalgor[999], default_algor = 0;       /* compression algorithm to be applied to each column */\n    float cratio[999];        /* compression ratio for each column (for diagnostic purposes) */\n\n    float compressed_size, uncompressed_size, tot_compressed_size, tot_uncompressed_size;\n    LONGLONG nrows, firstrow;\n    LONGLONG headstart, datastart, dataend, startbyte, jj, kk, naxis1;\n    LONGLONG vlalen, vlamemlen, vlastart, bytepos;\n    long repeat, width, nchunks, rowspertile, lastrows;\n    int ii, ll, ncols, hdutype, ltrue = 1, print_report = 0, tstatus;\n    char *cptr, keyname[9], tform[40], *cdescript;\n    char comm[FLEN_COMMENT], keyvalue[FLEN_VALUE], *cvlamem, tempstring[FLEN_VALUE], card[FLEN_CARD];\n\n    LONGLONG *descriptors, *outdescript, *vlamem;\n    int *pdescriptors;\n    size_t dlen, datasize, compmemlen;\n\n    /* ================================================================================== */\n    /* perform initial sanity checks */\n    /* ================================================================================== */\n    \n    /* special input flag value that means print out diagnostics */\n    if (*status == -999) {\n       print_report = 1;\n       *status = 0;\n    }\n\n    if (*status > 0)\n        return(*status);\n    \n    fits_get_hdu_type(infptr, &hdutype, status);\n    if (hdutype != BINARY_TBL) {\n        *status = NOT_BTABLE;\n        return(*status);\n    }\n\n    if (infptr == outfptr) {\n        ffpmsg(\"Cannot compress table 'in place' (fits_compress_table)\");\n        ffpmsg(\" outfptr cannot be the same as infptr.\");\n        *status = DATA_COMPRESSION_ERR;\n        return(*status);\n    }\n\n    /* get dimensions of the table */\n    fits_get_num_rowsll(infptr, &nrows, status);\n    fits_get_num_cols(infptr, &ncols, status);\n    fits_read_key(infptr, TLONGLONG, \"NAXIS1\", &naxis1, NULL, status);\n    /* get offset to the start of the data and total size of the table (including the heap) */\n    fits_get_hduaddrll(infptr, &headstart, &datastart, &dataend, status);\n\n    if (*status > 0)\n        return(*status);\n\n    tstatus = 0;\n    if (!fits_read_key(infptr, TSTRING, \"FZALGOR\", tempstring, NULL, &tstatus)) {\n\n\t    if (!fits_strcasecmp(tempstring, \"NONE\")) {\n\t            default_algor = NOCOMPRESS;\n\t    } else if (!fits_strcasecmp(tempstring, \"GZIP\") || !fits_strcasecmp(tempstring, \"GZIP_1\")) {\n\t            default_algor = GZIP_1;\n\t    } else if (!fits_strcasecmp(tempstring, \"GZIP_2\")) {\n\t            default_algor = GZIP_2;\n \t    } else if (!fits_strcasecmp(tempstring, \"RICE_1\")) {\n\t            default_algor = RICE_1;\n \t    } else {\n \t        ffpmsg(\"FZALGOR specifies unsupported table compression algorithm:\");\n\t\tffpmsg(tempstring);\n\t        *status = DATA_COMPRESSION_ERR;\n\t        return(*status);\n\t    }\n    }\n\n     /* just copy the HDU verbatim if the table has 0 columns or rows or if the table */\n    /* is less than 5760 bytes (2 blocks) in size, or compression directive keyword = \"NONE\" */\n    if (nrows < 1  || ncols < 1 || (dataend - datastart) < 5760  || default_algor == NOCOMPRESS) {\n\tfits_copy_hdu (infptr, outfptr, 0, status);\n\treturn(*status);\n    }\n   \n    /* Check if the chunk size has been specified with the FZTILELN keyword. */\n    /* If not, calculate a default number of rows per chunck, */\n\n    tstatus = 0;\n    if (fits_read_key(infptr, TLONG, \"FZTILELN\", &rowspertile, NULL, &tstatus)) {\n\trowspertile = (long) (maxchunksize / naxis1);\n    }\n\n    if (rowspertile < 1) rowspertile = 1;  \n    if (rowspertile > nrows) rowspertile = (long) nrows;\n    \n    nchunks = (long) ((nrows - 1) / rowspertile + 1);  /* total number of chunks */\n    lastrows = (long) (nrows - ((nchunks - 1) * rowspertile)); /* number of rows in last chunk */\n\n    /* allocate space for the transposed, column-major chunk of the table */\n    cm_buffer = calloc((size_t) naxis1, (size_t) rowspertile);\n    if (!cm_buffer) {\n        ffpmsg(\"Could not allocate cm_buffer for transposed table\");\n        *status = MEMORY_ALLOCATION;\n        return(*status);\n    }\n\n    /* ================================================================================== */\n    /*  Construct the header of the output compressed table  */\n    /* ================================================================================== */\n    fits_copy_header(infptr, outfptr, status);  /* start with verbatim copy of the input header */\n\n    fits_write_key(outfptr, TLOGICAL, \"ZTABLE\", &ltrue, \"this is a compressed table\", status);\n    fits_write_key(outfptr, TLONG, \"ZTILELEN\", &rowspertile, \"number of rows in each tile\", status);\n\n    fits_read_card(outfptr, \"NAXIS1\", card, status); /* copy NAXIS1 to ZNAXIS1 */\n    strncpy(card, \"ZNAXIS1\", 7);\n    fits_write_record(outfptr, card, status);\n    \n    fits_read_card(outfptr, \"NAXIS2\", card, status); /* copy NAXIS2 to ZNAXIS2 */\n    strncpy(card, \"ZNAXIS2\", 7);\n    fits_write_record(outfptr, card, status);\n\n    fits_read_card(outfptr, \"PCOUNT\", card, status); /* copy PCOUNT to ZPCOUNT */\n    strncpy(card, \"ZPCOUNT\", 7);\n    fits_write_record(outfptr, card, status);\n\n    fits_modify_key_lng(outfptr, \"NAXIS2\", nchunks, \"&\", status);  /* 1 row per chunk */\n    fits_modify_key_lng(outfptr, \"NAXIS1\", ncols * 16, \"&\", status); /* 16 bytes for each 1QB column */\n    fits_modify_key_lng(outfptr, \"PCOUNT\", 0L, \"&\", status); /* reset PCOUNT to 0 */\n    \n    /* rename the Checksum keywords, if they exist */\n    tstatus = 0;\n    fits_modify_name(outfptr, \"CHECKSUM\", \"ZHECKSUM\", &tstatus);\n    tstatus = 0;\n    fits_modify_name(outfptr, \"DATASUM\", \"ZDATASUM\", &tstatus);\n\n    /* ================================================================================== */\n    /*  Now loop over each column of the input table: write the column-specific keywords */\n    /*  and determine which compression algorithm to use.     */\n    /*  Also calculate various offsets to the start of the column data in both the */\n    /*  original row-major table and in the transposed column-major form of the table.  */\n    /* ================================================================================== */\n\n    cm_colstart[0] = 0;\n    for (ii = 0; ii < ncols; ii++) {  \n\n \t/* get the structural parameters of the original uncompressed column */\n\tfits_make_keyn(\"TFORM\", ii+1, keyname, status);\n\tfits_read_key(outfptr, TSTRING, keyname, tform, comm, status);\n        fits_binary_tform(tform, coltype+ii, &repeat, &width, status); /* get the repeat count and the width */\n\n\t/* preserve the original TFORM value and comment string in a ZFORMn keyword */\n\tfits_read_card(outfptr, keyname, card, status); \n\tcard[0] = 'Z';\n\tfits_write_record(outfptr, card, status);\n \n        /* All columns in the compressed table will have a variable-length array type. */\n\tfits_modify_key_str(outfptr, keyname, \"1QB\", \"&\", status);  /* Use 'Q' pointers (64-bit) */ \n\n\t/* deal with special cases: bit, string, and variable length array columns */\n\tif (coltype[ii] == TBIT) {\n\t    repeat = (repeat + 7) / 8;  /* convert from bits to equivalent number of bytes */\n\t} else if (coltype[ii] == TSTRING) {\n\t    width = 1;  /* ignore the optional 'w' in 'rAw' format */\n\t} else if (coltype[ii] < 0) {  /* pointer to variable length array */\n\t    if (strchr(tform,'Q') ) {\n\t        width = 16;  /* 'Q' descriptor has 64-bit pointers */\n\t    } else {\n\t        width = 8;  /* 'P' descriptor has 32-bit pointers */\n \t    }\n\t    repeat = 1;\n\t}\n\n\trm_repeat[ii] = repeat;   \n\trm_colwidth[ii] = repeat * width; /* column width (in bytes)in the input table */\n\t\n\t/* starting offset of each field in the OUTPUT transposed column-major table */\n\tcm_colstart[ii + 1] = cm_colstart[ii] + rm_colwidth[ii] * rowspertile;\n\t/* total number of elements in each column of the transposed column-major table */\n\tcm_repeat[ii] = rm_repeat[ii] * rowspertile;\n\n\tcompalgor[ii] = default_algor;  /* initialize the column compression algorithm to the default */\n\t\n\t/*  check if a compression method has been specified for this column */\n\tfits_make_keyn(\"FZALG\", ii+1, keyname, status);\n\ttstatus = 0;\n\tif (!fits_read_key(outfptr, TSTRING, keyname, tempstring, NULL, &tstatus)) {\n\n\t    if (!fits_strcasecmp(tempstring, \"GZIP\") || !fits_strcasecmp(tempstring, \"GZIP_1\")) {\n\t            compalgor[ii] = GZIP_1;\n\t    } else if (!fits_strcasecmp(tempstring, \"GZIP_2\")) {\n\t            compalgor[ii] = GZIP_2;\n\t    } else if (!fits_strcasecmp(tempstring, \"RICE_1\")) {\n\t            compalgor[ii] = RICE_1;\n\t    } else {\n\t        ffpmsg(\"Unsupported table compression algorithm specification.\");\n\t\tffpmsg(keyname);\n\t\tffpmsg(tempstring);\n\t        *status = DATA_COMPRESSION_ERR;\n\t\tfree(cm_buffer);\n\t        return(*status);\n\t    }\n\t}\n\n\t/* do sanity check of the requested algorithm and override if necessary */\n\tif ( abs(coltype[ii]) == TLOGICAL || abs(coltype[ii]) == TBIT || abs(coltype[ii]) == TSTRING) {\n\t        if (compalgor[ii] != GZIP_1) {\n\t\t\tcompalgor[ii] = GZIP_1;\n\t\t}\n\t} else if ( abs(coltype[ii]) == TCOMPLEX || abs(coltype[ii]) == TDBLCOMPLEX ||\n\t                abs(coltype[ii]) == TFLOAT   || abs(coltype[ii]) == TDOUBLE ||\n\t\t\tabs(coltype[ii]) == TLONGLONG ) {\n\t        if (compalgor[ii] != GZIP_1 && compalgor[ii] != GZIP_2) {\n\t\t\tcompalgor[ii] = GZIP_2;  /* gzip_2 usually works better gzip_1 */\n\t\t}\n\t} else if ( abs(coltype[ii]) == TSHORT ) {\n\t        if (compalgor[ii] != GZIP_1 && compalgor[ii] != GZIP_2 && compalgor[ii] != RICE_1) {\n\t\t\tcompalgor[ii] = GZIP_2;  /* gzip_2 usually works better rice_1 */\n\t\t }\n\t} else if (  abs(coltype[ii]) == TLONG\t) {\n\t        if (compalgor[ii] != GZIP_1 && compalgor[ii] != GZIP_2 && compalgor[ii] != RICE_1) {\n\t\t\tcompalgor[ii] = RICE_1;\n\t\t}\n\t} else if ( abs(coltype[ii]) == TBYTE ) {\n\t        if (compalgor[ii] != GZIP_1 && compalgor[ii] != RICE_1 ) {\n\t\t\tcompalgor[ii] = GZIP_1;\n\t\t}\n\t}\n    }  /* end of loop over columns */\n\n    /* ================================================================================== */\n    /*    now process each chunk of the table, in turn          */\n    /* ================================================================================== */\n\n    tot_uncompressed_size = 0.;\n    tot_compressed_size = 0;\n    firstrow = 1;\n    for (ll = 0; ll < nchunks; ll++) {\n\n        if (ll == nchunks - 1) {  /* the last chunk may have fewer rows */\n\t    rowspertile = lastrows; \n            for (ii = 0; ii < ncols; ii++) { \n\t\tcm_colstart[ii + 1] = cm_colstart[ii] + (rm_colwidth[ii] * rowspertile);\n\t\tcm_repeat[ii] = rm_repeat[ii] * rowspertile;\n\t    }\n\t}\n\n        /* move to the start of the chunk in the input table */\n        ffmbyt(infptr, datastart, 0, status);\n\n        /* ================================================================================*/\n        /*  First, transpose this chunck from row-major order to column-major order  */\n\t/*  At the same time, shuffle the bytes in each datum, if doing GZIP_2 compression */\n        /* ================================================================================*/\n\n        for (jj = 0; jj < rowspertile; jj++)   {    /* loop over rows */\n          for (ii = 0; ii < ncols; ii++) {  /* loop over columns */\n      \n           if (rm_repeat[ii] > 0) {  /*  skip virtual columns that have 0 elements */\n\n\t    kk = 0;\t\n\n\t     /* if the  GZIP_2 compression algorithm is used, shuffle the bytes */\n\t    if (coltype[ii] == TSHORT && compalgor[ii] == GZIP_2) {\n\t      while(kk < rm_colwidth[ii]) {\n\t        cptr = cm_buffer + (cm_colstart[ii] + (jj * rm_repeat[ii]) + kk/2);  \n\t        ffgbyt(infptr, 1, cptr, status);  /* get 1st byte */\n\t        cptr += cm_repeat[ii];  \n\t        ffgbyt(infptr, 1, cptr, status);  /* get 2nd byte */\n\t        kk += 2;\n\t      }\n\t    } else if ((coltype[ii] == TFLOAT || coltype[ii] == TLONG) && compalgor[ii] == GZIP_2) {\n\t      while(kk < rm_colwidth[ii]) {\n\t        cptr = cm_buffer + (cm_colstart[ii] + (jj * rm_repeat[ii]) + kk/4);  \n\t        ffgbyt(infptr, 1, cptr, status);  /* get 1st byte */\n\t        cptr += cm_repeat[ii];  \n\t        ffgbyt(infptr, 1, cptr, status);  /* get 2nd byte */\n\t        cptr += cm_repeat[ii];  \n\t        ffgbyt(infptr, 1, cptr, status);  /* get 3rd byte */\n\t        cptr += cm_repeat[ii];  \n\t        ffgbyt(infptr, 1, cptr, status);  /* get 4th byte */\n\t        kk += 4;\n\t      }\n\t    } else if ( (coltype[ii] == TDOUBLE || coltype[ii] == TLONGLONG) && compalgor[ii] == GZIP_2) {\n\t      while(kk < rm_colwidth[ii]) {\n\t        cptr = cm_buffer + (cm_colstart[ii] + (jj * rm_repeat[ii]) + kk/8);  \n\t        ffgbyt(infptr, 1, cptr, status);  /* get 1st byte */\n\t        cptr += cm_repeat[ii];  \n\t        ffgbyt(infptr, 1, cptr, status);  /* get 2nd byte */\n\t        cptr += cm_repeat[ii];  \n\t        ffgbyt(infptr, 1, cptr, status);  /* get 3rd byte */\n\t        cptr += cm_repeat[ii];  \n\t        ffgbyt(infptr, 1, cptr, status);  /* get 4th byte */\n\t        cptr += cm_repeat[ii];  \n\t        ffgbyt(infptr, 1, cptr, status);  /* get 5th byte */\n\t        cptr += cm_repeat[ii];  \n\t        ffgbyt(infptr, 1, cptr, status);  /* get 6th byte */\n\t        cptr += cm_repeat[ii];  \n\t        ffgbyt(infptr, 1, cptr, status);  /* get 7th byte */\n\t        cptr += cm_repeat[ii];  \n\t        ffgbyt(infptr, 1, cptr, status);  /* get 8th byte */\n\t        kk += 8;\n\t      }\n\t    } else  { /* all other cases: don't shuffle the bytes; simply transpose the column */\n\t        cptr = cm_buffer + (cm_colstart[ii] + (jj * rm_colwidth[ii]));   /* addr to copy to */\n\t        startbyte = (infptr->Fptr)->bytepos;  /* save the starting byte location */\n\t        ffgbyt(infptr, rm_colwidth[ii], cptr, status);  /* copy all the bytes */\n\n\t        if (rm_colwidth[ii] >= MINDIRECT) { /* have to explicitly move to next byte */\n\t  \t    ffmbyt(infptr, startbyte + rm_colwidth[ii], 0, status);\n\t        }\n\t    }  /* end of test of coltypee */\n\n           }  /* end of not virtual column */\n          }  /* end of loop over columns */\n        }  /* end of loop over rows */\n\n        /* ================================================================================*/\n        /*  now compress each column in the transposed chunk of the table    */\n        /* ================================================================================*/\n\n        fits_set_hdustruc(outfptr, status);  /* initialize structures in the output table */\n    \n        for (ii = 0; ii < ncols; ii++) {  /* loop over columns */\n\t  /* initialize the diagnostic compression results string */\n\t  snprintf(results[ii],30,\"%3d %3d %3d \", ii+1, coltype[ii], compalgor[ii]);  \n          cratio[ii] = 0;\n\t  \n          if (rm_repeat[ii] > 0) {  /* skip virtual columns with zero width */\n\n\t    if (coltype[ii] < 0)  {  /* this is a variable length array (VLA) column */\n\n\t\t/*=========================================================================*/\t    \n\t        /* variable-length array columns are a complicated special case  */\n\t\t/*=========================================================================*/\n\n\t\t/* allocate memory to hold all the VLA descriptors from the input table, plus */\n\t\t/* room to hold the descriptors to the compressed VLAs in the output table */\n\t\t/* In total, there will be 2 descriptors for each row in this chunk */\n\n\t\tuncompressed_size = 0.;\n\t\tcompressed_size = 0;\n\t\t\n\t\tdatasize = (size_t) (cm_colstart[ii + 1] - cm_colstart[ii]); /* size of input descriptors */\n\n\t\tcdescript =  calloc(datasize + (rowspertile * 16), 1); /* room for both descriptors */\n\t\tif (!cdescript) {\n                    ffpmsg(\"Could not allocate buffer for descriptors\");\n                    *status = MEMORY_ALLOCATION;\n\t\t    free(cm_buffer);\n\t            return(*status);\n\t\t}\n\n\t\t/* copy the input descriptors to this array */\n\t\tmemcpy(cdescript, &cm_buffer[cm_colstart[ii]], datasize);\n#if BYTESWAPPED\n\t\t/* byte-swap the integer values into the native machine representation */\n\t\tif (rm_colwidth[ii] == 16) {\n\t\t    ffswap8((double *) cdescript,  rowspertile * 2);\n\t\t} else {\n\t\t    ffswap4((int *) cdescript,  rowspertile * 2);\n\t\t}\n#endif\n\t\tdescriptors = (LONGLONG *) cdescript;  /* use this for Q type descriptors */\n\t\tpdescriptors = (int *) cdescript;     /* use this instead for or P type descriptors */\n\t\t/* pointer to the 2nd set of descriptors */\n\t\toutdescript = (LONGLONG *) (cdescript + datasize);  /* this is a LONGLONG pointer */\n\t\t\n\t\tfor (jj = 0; jj < rowspertile; jj++)   {    /* loop to compress each VLA in turn */\n\n\t\t  if (rm_colwidth[ii] == 16) { /* if Q pointers */\n\t\t\tvlalen = descriptors[jj * 2];\n\t\t\tvlastart = descriptors[(jj * 2) + 1];\n\t\t  } else {  /* if P pointers */\n\t\t\tvlalen = (LONGLONG) pdescriptors[jj * 2];\n\t\t\tvlastart = (LONGLONG) pdescriptors[(jj * 2) + 1];\n\t\t  }\n\n\t\t  if (vlalen > 0) {  /* skip zero-length VLAs */\n\n\t\t    vlamemlen = vlalen * (int) (-coltype[ii] / 10);\n\t\t    vlamem = (LONGLONG *) malloc((size_t) vlamemlen); /* memory for the input uncompressed VLA */\n\t\t    if (!vlamem) {\n\t\t\tffpmsg(\"Could not allocate buffer for VLA\");\n\t\t\t*status = MEMORY_ALLOCATION;\n\t\t\tfree(cdescript); free(cm_buffer);\n\t\t\treturn(*status);\n\t\t    }\n\n\t\t    compmemlen = (size_t) (vlalen * ((LONGLONG) (-coltype[ii] / 10)) * 1.5);\n\t\t    if (compmemlen < 100) compmemlen = 100;\n\t\t    cvlamem = malloc(compmemlen);  /* memory for the output compressed VLA */\n\t\t    if (!cvlamem) {\n\t\t\tffpmsg(\"Could not allocate buffer for compressed data\");\n\t\t\t*status = MEMORY_ALLOCATION;\n\t\t\tfree(vlamem); free(cdescript); free(cm_buffer);\n\t\t\treturn(*status);\n\t\t    }\n\n\t\t    /* read the raw bytes directly from the heap, without any byte-swapping or null value detection */\n\t\t    bytepos = (infptr->Fptr)->datastart + (infptr->Fptr)->heapstart + vlastart;\n\t\t    ffmbyt(infptr, bytepos, REPORT_EOF, status);\n\t\t    ffgbyt(infptr, vlamemlen, vlamem, status);  /* read the bytes */\n\t\t    uncompressed_size += vlamemlen;  /* total size of the uncompressed VLAs */\n\t\t    tot_uncompressed_size += vlamemlen;  /* total size of the uncompressed file */\n\n\t\t    /* compress the VLA with the appropriate algorithm */\n\t    \t    if (compalgor[ii] == RICE_1) {\n\n\t\t        if (-coltype[ii] == TSHORT) {\n#if BYTESWAPPED\n\t\t\t  ffswap2((short *) (vlamem),  (long) vlalen); \n#endif\n\t\t\t  dlen = fits_rcomp_short ((short *)(vlamem), (int) vlalen, (unsigned char *) cvlamem,\n\t\t\t   (int) compmemlen, 32);\n\t\t        } else if (-coltype[ii] == TLONG) {\n#if BYTESWAPPED\n\t\t\t  ffswap4((int *) (vlamem),  (long) vlalen); \n#endif\n\t\t\t  dlen = fits_rcomp ((int *)(vlamem), (int) vlalen, (unsigned char *) cvlamem,\n                           (int) compmemlen, 32);\n\t\t        } else if (-coltype[ii] == TBYTE) {\n\t\t\t  dlen = fits_rcomp_byte ((signed char *)(vlamem), (int) vlalen, (unsigned char *) cvlamem,\n                           (int) compmemlen, 32);\n\t\t        } else {\n\t\t\t  /* this should not happen */\n\t\t\t  ffpmsg(\" Error: cannot compress this column type with the RICE algorithm\");\n\t\t\t  free(vlamem); free(cdescript); free(cm_buffer); free(cvlamem);\n\t\t\t  *status = DATA_COMPRESSION_ERR;\n\t\t\t  return(*status);\n\t\t        }  \n\t\t    } else if (compalgor[ii] == GZIP_1 || compalgor[ii] == GZIP_2){  \n\t\t       if (compalgor[ii] == GZIP_2 ) {  /* shuffle the bytes before gzipping them */\n\t\t\t   if ( (int) (-coltype[ii] / 10) == 2) {\n\t\t\t       fits_shuffle_2bytes((char *) vlamem, vlalen, status);\n\t\t\t   } else if ( (int) (-coltype[ii] / 10) == 4) {\n\t\t\t       fits_shuffle_4bytes((char *) vlamem, vlalen, status);\n\t\t\t   } else if ( (int) (-coltype[ii] / 10) == 8) {\n\t\t\t       fits_shuffle_8bytes((char *) vlamem, vlalen, status);\n\t\t\t   }\n\t\t        }\n\t\t        /*: gzip compress the array of bytes */\n\t\t        compress2mem_from_mem( (char *) vlamem, (size_t) vlamemlen,\n\t    \t\t    &cvlamem,  &compmemlen, realloc, &dlen, status);        \n\t\t    } else {\n\t\t\t  /* this should not happen */\n\t\t\t  ffpmsg(\" Error: unknown compression algorithm\");\n\t\t\t  free(vlamem); free(cdescript); free(cm_buffer); free(cvlamem);\n\t\t\t  *status = DATA_COMPRESSION_ERR;\n\t\t\t  return(*status);\n\t\t    }  \n\n\t\t    /* write the compressed array to the output table, but... */\n\t\t    /* We use a trick of always writing the array to the same row of the output table */\n\t\t    /* and then copy the descriptor into the array of descriptors that we allocated. */\n\t\t     \n\t\t    /* First, reset the descriptor */\n\t\t    fits_write_descript(outfptr, ii+1, ll+1, 0, 0, status);\n\n\t\t    /* write the compressed VLA if it is smaller than the original, else write */\n\t\t    /* the uncompressed array */\n\t\t    fits_set_tscale(outfptr, ii + 1, 1.0, 0.0, status);  /* turn off any data scaling, first */\n\t\t    if (dlen < vlamemlen) {\n\t\t        fits_write_col(outfptr, TBYTE, ii + 1, ll+1, 1, dlen, cvlamem, status);\n\t\t        compressed_size += dlen;  /* total size of the compressed VLAs */\n\t\t        tot_compressed_size += dlen;  /* total size of the compressed file */\n\t\t    } else {\n\t\t\tif ( -coltype[ii] != TBYTE && compalgor[ii] != GZIP_1) {\n\t\t\t    /* it is probably faster to reread the raw bytes, rather than unshuffle or unswap them */\n\t\t\t    bytepos = (infptr->Fptr)->datastart + (infptr->Fptr)->heapstart + vlastart;\n\t\t\t    ffmbyt(infptr, bytepos, REPORT_EOF, status);\n\t\t\t    ffgbyt(infptr, vlamemlen, vlamem, status);  /* read the bytes */\n\t\t\t}\n\t\t        fits_write_col(outfptr, TBYTE, ii + 1, ll+1, 1, vlamemlen, vlamem, status);\n\t\t        compressed_size += vlamemlen;  /* total size of the compressed VLAs */\n\t\t        tot_compressed_size += vlamemlen;  /* total size of the compressed file */\n\t\t    }\n\n\t\t    /* read back the descriptor and save it in the array of descriptors */\n\t\t    fits_read_descriptll(outfptr, ii + 1, ll + 1, outdescript+(jj*2), outdescript+(jj*2)+1, status);\n\t\t    free(cvlamem);  free(vlamem);\n\n\t\t  } /* end of vlalen > 0 */\n\t\t}  /* end of loop over rows */\n\n\t\tif (compressed_size != 0)\n\t\t    cratio[ii] = uncompressed_size / compressed_size;\n\n\t\tsnprintf(tempstring,FLEN_VALUE,\" r=%6.2f\",cratio[ii]);\n\t\tstrncat(results[ii],tempstring, 29-strlen(results[ii]));\n\n\t\t/* now we just have to compress the array of descriptors (both input and output) */\n\t\t/* and write them to the output table. */\n\n\t\t/* allocate memory for the compressed descriptors */\n\t\tcvlamem = malloc(datasize + (rowspertile * 16) );\n\t\tif (!cvlamem) {\n\t\t    ffpmsg(\"Could not allocate buffer for compressed data\");\n\t\t    *status = MEMORY_ALLOCATION;\n\t\t    free(cdescript); free(cm_buffer);\n\t\t    return(*status);\n\t\t}\n\n#if BYTESWAPPED\n\t\t/* byte swap the input and output descriptors */\n\t\tif (rm_colwidth[ii] == 16) {\n\t\t    ffswap8((double *) cdescript,  rowspertile * 2);\n\t\t} else {\n\t\t    ffswap4((int *) cdescript,  rowspertile * 2);\n\t\t}\n\t\tffswap8((double *) outdescript,  rowspertile * 2);\n#endif\n\t\t/* compress the array contain both sets of descriptors */\n\t\tcompress2mem_from_mem((char *) cdescript, datasize + (rowspertile * 16),\n\t    \t\t&cvlamem,  &datasize, realloc, &dlen, status);        \n\n\t\tfree(cdescript);\n\n\t\t/* write the compressed descriptors to the output column */\n\t\tfits_set_tscale(outfptr, ii + 1, 1.0, 0.0, status);  /* turn off any data scaling, first */\n\t\tfits_write_descript(outfptr, ii+1, ll+1, 0, 0, status); /* First, reset the descriptor */\n\t\tfits_write_col(outfptr, TBYTE, ii + 1, ll+1, 1, dlen, cvlamem, status);\n\t\tfree(cvlamem); \n\n\t\tif (ll == 0) {  /* only write the ZCTYPn keyword once, while processing the first column */\n\t\t\tfits_make_keyn(\"ZCTYP\", ii+1, keyname, status);\n\n\t\t\tif (compalgor[ii] == RICE_1) {\n\t\t\t     strcpy(keyvalue, \"RICE_1\");\n\t\t\t} else if (compalgor[ii] == GZIP_2) {\n\t\t\t     strcpy(keyvalue, \"GZIP_2\");\n\t\t\t} else {\n\t\t\t     strcpy(keyvalue, \"GZIP_1\");\n\t\t\t}\n\n\t\t\tfits_write_key(outfptr, TSTRING, keyname, keyvalue,\n\t\t\t\"compression algorithm for column\", status);\n\t\t}\n\n\t        continue;  /* jump to end of loop, to go to next column */\n\t    }  /* end of VLA case */\n\n\t    /* ================================================================================*/\n\t    /* deal with all the normal fixed-length columns here */\n\t    /* ================================================================================*/\n\n\t    /* allocate memory for the compressed data */\n\t    datasize = (size_t) (cm_colstart[ii + 1] - cm_colstart[ii]);\n\t    cvlamem = malloc(datasize*2);\n\t    tot_uncompressed_size += datasize;\n\t    \n\t    if (!cvlamem) {\n                ffpmsg(\"Could not allocate buffer for compressed data\");\n                *status = MEMORY_ALLOCATION;\n\t\tfree(cm_buffer);\n\t        return(*status);\n\t    }\n\n\t    if (compalgor[ii] == RICE_1) {\n\t        if (coltype[ii] == TSHORT) {\n#if BYTESWAPPED\n                    ffswap2((short *) (cm_buffer + cm_colstart[ii]),  datasize / 2); \n#endif\n  \t            dlen = fits_rcomp_short ((short *)(cm_buffer + cm_colstart[ii]), datasize / 2, (unsigned char *) cvlamem,\n                       datasize * 2, 32);\n\n\t        } else if (coltype[ii] == TLONG) {\n#if BYTESWAPPED\n                    ffswap4((int *) (cm_buffer + cm_colstart[ii]),  datasize / 4); \n#endif\n   \t            dlen = fits_rcomp ((int *)(cm_buffer + cm_colstart[ii]), datasize / 4, (unsigned char *) cvlamem,\n                       datasize * 2, 32);\n\n\t        } else if (coltype[ii] == TBYTE) {\n\n  \t            dlen = fits_rcomp_byte ((signed char *)(cm_buffer + cm_colstart[ii]), datasize, (unsigned char *) cvlamem,\n                       datasize * 2, 32);\n\t        } else {  /* this should not happen */\n                    ffpmsg(\" Error: cannot compress this column type with the RICE algorthm\");\n\t\t    free(cvlamem);  free(cm_buffer);\n\t            *status = DATA_COMPRESSION_ERR;\n\t            return(*status);\n\t        }\n\t    } else {\n\t    \t/* all other cases: gzip compress the column (bytes may have been shuffled previously) */\n\t\tcompress2mem_from_mem(cm_buffer + cm_colstart[ii], datasize,\n\t    \t\t&cvlamem,  &datasize, realloc, &dlen, status);        \n\t    }\n\n\t    if (ll == 0) {  /* only write the ZCTYPn keyword once, while processing the first column */\n\t\tfits_make_keyn(\"ZCTYP\", ii+1, keyname, status);\n\n\t\tif (compalgor[ii] == RICE_1) {\n\t\t     strcpy(keyvalue, \"RICE_1\");\n\t\t} else if (compalgor[ii] == GZIP_2) {\n\t\t     strcpy(keyvalue, \"GZIP_2\");\n\t\t} else {\n\t\t     strcpy(keyvalue, \"GZIP_1\");\n\t\t}\n\n\t\tfits_write_key(outfptr, TSTRING, keyname, keyvalue,\n\t\t\"compression algorithm for column\", status);\n\t    }\n\n\t    /* write the compressed data to the output column */\n\t    fits_set_tscale(outfptr, ii + 1, 1.0, 0.0, status);  /* turn off any data scaling, first */\n\t    fits_write_col(outfptr, TBYTE, ii + 1, ll+1, 1, dlen, cvlamem, status);\n\t    tot_compressed_size += dlen;\n\n\t    free(cvlamem);   /* don't need the compressed data any more */\n\n            /* create diagnostic messages */\n\t    if (dlen != 0)\n\t       cratio[ii] = (float) datasize / (float) dlen;  /* compression ratio of the column */\n\n\t    snprintf(tempstring,FLEN_VALUE,\" r=%6.2f\",cratio[ii]);\n\t    strncat(results[ii],tempstring,29-strlen(results[ii]));\n \n          }  /* end of not a virtual column */\n        }  /* end of loop over columns */\n\n        datastart += (rowspertile * naxis1);   /* increment to start of next chunk */\n        firstrow += rowspertile;  /* increment first row in next chunk */\n\n       if (print_report) {\n\t  printf(\"\\nChunk = %d\\n\",ll+1);\n\t  for (ii = 0; ii < ncols; ii++) {  \n\t\tprintf(\"%s\\n\", results[ii]);\n\t  }\n\t}\n\t\n    }  /* end of loop over chunks of the table */\n\n    /* =================================================================================*/\n    /*  all done; just clean up and return  */\n    /* ================================================================================*/\n\n    free(cm_buffer);\n    fits_set_hdustruc(outfptr, status);  /* reset internal structures */\n       \t\n    if (print_report) {\n\n       if (tot_compressed_size != 0)\n           printf(\"\\nTotal data size (MB) %.3f -> %.3f, ratio = %.3f\\n\", tot_uncompressed_size/1000000., \n\t     tot_compressed_size/1000000., tot_uncompressed_size/tot_compressed_size);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_uncompress_table(fitsfile *infptr, fitsfile *outfptr, int *status)\n\n/*\n  Uncompress the table that was compressed with fits_compress_table\n*/\n{ \n    char colcode[999];  /* column data type code character */\n    char coltype[999];  /* column data type numeric code value */\n    char *cm_buffer;   /* memory buffer for the transposed, Column-Major, chunk of the table */ \n    char *rm_buffer;   /* memory buffer for the original, Row-Major, chunk of the table */ \n    LONGLONG nrows, rmajor_colwidth[999], rmajor_colstart[1000], cmajor_colstart[1000];\n    LONGLONG cmajor_repeat[999], rmajor_repeat[999], cmajor_bytespan[999], kk;\n    LONGLONG headstart, datastart = 0, dataend, rowsremain, *descript, *qdescript = 0;\n    LONGLONG rowstart, cvlalen, cvlastart, vlalen, vlastart;\n    long repeat, width, vla_repeat, vla_address, rowspertile, ntile;\n    int  ncols, hdutype, inttype, anynull, tstatus, zctype[999], addspace = 0, *pdescript = 0;\n    char *cptr, keyname[9], tform[40];\n    long  pcount, zheapptr, naxis1, naxis2, ii, jj;\n    char *ptr, comm[FLEN_COMMENT], zvalue[FLEN_VALUE], *uncompressed_vla = 0, *compressed_vla;\n    char card[FLEN_CARD];\n    size_t dlen, fullsize, cm_size, bytepos, vlamemlen;\n\n    /* ================================================================================== */\n    /* perform initial sanity checks */\n    /* ================================================================================== */\n    if (*status > 0)\n        return(*status);\n     \n    fits_get_hdu_type(infptr, &hdutype, status);\n    if (hdutype != BINARY_TBL) {\n        ffpmsg(\"This is not a binary table, so cannot uncompress it!\");\n        *status = NOT_BTABLE;\n        return(*status);\n    }\n\n    if (fits_read_key(infptr, TLOGICAL, \"ZTABLE\", &tstatus, NULL, status)) {\n\t/* just copy the HDU if the table is not compressed */\n\tif (infptr != outfptr) { \n\t\tfits_copy_hdu (infptr, outfptr, 0, status);\n\t}\n\treturn(*status);\n    }\n \n    fits_get_num_rowsll(infptr, &nrows, status);\n    fits_get_num_cols(infptr, &ncols, status);\n\n    if ((ncols < 1)) {\n\t/* just copy the HDU if the table does not have  more than 0 columns */\n\tif (infptr != outfptr) { \n\t\tfits_copy_hdu (infptr, outfptr, 0, status);\n\t}\n\treturn(*status);\n    }\n\n    fits_read_key(infptr, TLONG, \"ZTILELEN\", &rowspertile, comm, status);\n    if (*status > 0) {\n        ffpmsg(\"Could not find the required ZTILELEN keyword\");\n        *status = DATA_DECOMPRESSION_ERR;\n        return(*status);\n    }\n\n    /**** get size of the uncompressed table */\n    fits_read_key(infptr, TLONG, \"ZNAXIS1\", &naxis1, comm, status);\n    if (*status > 0) {\n        ffpmsg(\"Could not find the required ZNAXIS1 keyword\");\n        *status = DATA_DECOMPRESSION_ERR;\n        return(*status);\n    }\n\n    fits_read_key(infptr, TLONG, \"ZNAXIS2\", &naxis2, comm, status);\n    if (*status > 0) {\n        ffpmsg(\"Could not find the required ZNAXIS2 keyword\");\n        *status = DATA_DECOMPRESSION_ERR;\n        return(*status);\n    }\n\n    /* silently ignore illegal ZTILELEN value if too large */\n    if (rowspertile > naxis2) rowspertile = naxis2;\n\n    fits_read_key(infptr, TLONG, \"ZPCOUNT\", &pcount, comm, status);\n    if (*status > 0) {\n        ffpmsg(\"Could not find the required ZPCOUNT keyword\");\n        *status = DATA_DECOMPRESSION_ERR;\n        return(*status);\n    }\n\n    tstatus = 0;\n    fits_read_key(infptr, TLONG, \"ZHEAPPTR\", &zheapptr, comm, &tstatus);\n    if (tstatus > 0) {\n        zheapptr = 0;  /* uncompressed table has no heap */\n    }\n\n    /* ================================================================================== */\n    /* copy of the input header, then recreate the uncompressed table keywords */\n    /* ================================================================================== */\n    fits_copy_header(infptr, outfptr, status);\n\n    /* reset the NAXIS1, NAXIS2. and PCOUNT keywords to the original */\n    fits_read_card(outfptr, \"ZNAXIS1\", card, status);\n    strncpy(card, \"NAXIS1 \", 7);\n    fits_update_card(outfptr, \"NAXIS1\", card, status);\n    \n    fits_read_card(outfptr, \"ZNAXIS2\", card, status);\n    strncpy(card, \"NAXIS2 \", 7);\n    fits_update_card(outfptr, \"NAXIS2\", card, status);\n    \n    fits_read_card(outfptr, \"ZPCOUNT\", card, status);\n    strncpy(card, \"PCOUNT \", 7);\n    fits_update_card(outfptr, \"PCOUNT\", card, status);\n\n    fits_delete_key(outfptr, \"ZTABLE\", status);\n    fits_delete_key(outfptr, \"ZTILELEN\", status);\n    fits_delete_key(outfptr, \"ZNAXIS1\", status);\n    fits_delete_key(outfptr, \"ZNAXIS2\", status);\n    fits_delete_key(outfptr, \"ZPCOUNT\", status);\n    tstatus = 0;\n    fits_delete_key(outfptr, \"CHECKSUM\", &tstatus); \n    tstatus = 0;\n    fits_delete_key(outfptr, \"DATASUM\", &tstatus); \n    /* restore the Checksum keywords, if they exist */\n    tstatus = 0;\n    fits_modify_name(outfptr, \"ZHECKSUM\", \"CHECKSUM\", &tstatus);\n    tstatus = 0;\n    fits_modify_name(outfptr, \"ZDATASUM\", \"DATASUM\", &tstatus);\n\n    /* ================================================================================== */\n    /* determine compression paramters for each column and write column-specific keywords */\n    /* ================================================================================== */\n    for (ii = 0; ii < ncols; ii++) {\n\n\t/* get the original column type, repeat count, and unit width */\n\tfits_make_keyn(\"ZFORM\", ii+1, keyname, status);\n\tfits_read_key(infptr, TSTRING, keyname, tform, comm, status);\n\n\t/* restore the original TFORM value and comment */\n\tfits_read_card(outfptr, keyname, card, status);\n\tcard[0] = 'T';\n\tkeyname[0] = 'T';\n\tfits_update_card(outfptr, keyname, card, status);\n\n\t/* now delete the ZFORM keyword */\n        keyname[0] = 'Z';\n\tfits_delete_key(outfptr, keyname, status);\n\n\tcptr = tform;\n\twhile(isdigit(*cptr)) cptr++;\n\tcolcode[ii] = *cptr; /* save the column type code */\n\n        fits_binary_tform(tform, &inttype, &repeat, &width, status);\n        coltype[ii] = inttype;\n\n\t/* deal with special cases */\n\tif (abs(coltype[ii]) == TBIT) { \n\t        repeat = (repeat + 7) / 8 ;   /* convert from bits to bytes */\n\t} else if (abs(coltype[ii]) == TSTRING) {\n\t        width = 1;\n\t} else if (coltype[ii] < 0) {  /* pointer to variable length array */\n\t        if (colcode[ii] == 'P')\n\t           width = 8;  /* this is a 'P' column */\n\t        else\n\t           width = 16;  /* this is a 'Q' not a 'P' column */\n\n                addspace += 16; /* need space for a second set of Q pointers for this column */\n\t}\n\n\trmajor_repeat[ii] = repeat;\n\n\t/* width (in bytes) of each field in the row-major table */\n\trmajor_colwidth[ii] = rmajor_repeat[ii] * width;\n\n\t/* construct the ZCTYPn keyword name then read the keyword */\n\tfits_make_keyn(\"ZCTYP\", ii+1, keyname, status);\n\ttstatus = 0;\n        fits_read_key(infptr, TSTRING, keyname, zvalue, NULL, &tstatus);\n\tif (tstatus) {\n           zctype[ii] = GZIP_2;\n\t} else {\n\t   if (!strcmp(zvalue, \"GZIP_2\")) {\n               zctype[ii] = GZIP_2;\n\t   } else if (!strcmp(zvalue, \"GZIP_1\")) {\n               zctype[ii] = GZIP_1;\n\t   } else if (!strcmp(zvalue, \"RICE_1\")) {\n               zctype[ii] = RICE_1;\n\t   } else {\n\t       ffpmsg(\"Unrecognized ZCTYPn keyword compression code:\");\n\t       ffpmsg(zvalue);\n\t       *status = DATA_DECOMPRESSION_ERR;\n\t       return(*status);\n\t   }\n\t   \n\t   /* delete this keyword from the uncompressed header */\n\t   fits_delete_key(outfptr, keyname, status);\n\t}\n    }\n\n    /* rescan header keywords to reset internal table structure parameters */\n    fits_set_hdustruc(outfptr, status);\n\n    /* ================================================================================== */\n    /* allocate memory for the transposed and untransposed tile of the table */\n    /* ================================================================================== */\n\n    fullsize = naxis1 * rowspertile;\n    cm_size = fullsize + (addspace * rowspertile);\n\n    cm_buffer = malloc(cm_size);\n    if (!cm_buffer) {\n        ffpmsg(\"Could not allocate buffer for transformed column-major table\");\n        *status = MEMORY_ALLOCATION;\n        return(*status);\n    }\n\n    rm_buffer = malloc(fullsize);\n    if (!rm_buffer) {\n        ffpmsg(\"Could not allocate buffer for untransformed row-major table\");\n        *status = MEMORY_ALLOCATION;\n        free(cm_buffer);\n        return(*status);\n    }\n\n    /* ================================================================================== */\n    /* Main loop over all the tiles */\n    /* ================================================================================== */\n\n    rowsremain = naxis2;\n    rowstart = 1;\n    ntile = 0;\n\n    while(rowsremain) {\n\n        /* ================================================================================== */\n        /* loop over each column: read and uncompress the bytes */\n        /* ================================================================================== */\n        ntile++;\n        rmajor_colstart[0] = 0;\n        cmajor_colstart[0] = 0;\n        for (ii = 0; ii < ncols; ii++) {\n\n\t    cmajor_repeat[ii] = rmajor_repeat[ii] * rowspertile;\n\n\t    /* starting offset of each field in the column-major table */\n            if (coltype[ii] > 0) {  /* normal fixed length column */\n\t          cmajor_colstart[ii + 1] = cmajor_colstart[ii] + rmajor_colwidth[ii] * rowspertile;\n\t    } else { /* VLA column: reserve space for the 2nd set of Q pointers */\n\t          cmajor_colstart[ii + 1] = cmajor_colstart[ii] + (rmajor_colwidth[ii] + 16) * rowspertile;\n\t    }\n\t    /* length of each sequence of bytes, after sorting them in signicant order */\n\t    cmajor_bytespan[ii] = (rmajor_repeat[ii] * rowspertile);\n\n\t    /* starting offset of each field in the  row-major table */\n\t    rmajor_colstart[ii + 1] = rmajor_colstart[ii] + rmajor_colwidth[ii];\n\n            if (rmajor_repeat[ii] > 0) { /* ignore columns with 0 elements */\n\t\n\t        /* read compressed bytes from input table */\n\t        fits_read_descript(infptr, ii + 1, ntile, &vla_repeat, &vla_address, status);\n\t\n\t        /* allocate memory and read in the compressed bytes */\n\t        ptr = malloc(vla_repeat);\n\t        if (!ptr) {\n                   ffpmsg(\"Could not allocate buffer for uncompressed bytes\");\n                   *status = MEMORY_ALLOCATION;\n                   free(rm_buffer);  free(cm_buffer);\n                   return(*status);\n\t        }\n\n\t        fits_set_tscale(infptr, ii + 1, 1.0, 0.0, status);  /* turn off any data scaling, first */\n\t        fits_read_col_byt(infptr, ii + 1, ntile, 1, vla_repeat, 0, (unsigned char *) ptr, &anynull, status);\n                cptr = cm_buffer + cmajor_colstart[ii];\n\t\n\t\t/* size in bytes of the uncompressed column of bytes */\n\t        fullsize = (size_t) (cmajor_colstart[ii+1] - cmajor_colstart[ii]);\n\n\t        switch (colcode[ii]) {\n\n\t        case 'I':\n\n\t          if (zctype[ii] == RICE_1) {\n   \t             dlen = fits_rdecomp_short((unsigned char *)ptr, vla_repeat, (unsigned short *)cptr, \n\t\t       fullsize / 2, 32);\n#if BYTESWAPPED\n                     ffswap2((short *) cptr, fullsize / 2); \n#endif\n\t          } else { /* gunzip the data into the correct location */\n\t             uncompress2mem_from_mem(ptr, vla_repeat, &cptr, &fullsize, realloc, &dlen, status);        \n\t          }\n\t          break;\n\n\t        case 'J':\n\n\t          if (zctype[ii] == RICE_1) {\n   \t              dlen = fits_rdecomp ((unsigned char *) ptr, vla_repeat, (unsigned int *)cptr, \n\t\t        fullsize / 4, 32);\n#if BYTESWAPPED\n                      ffswap4((int *) cptr,  fullsize / 4); \n#endif\n\t          } else { /* gunzip the data into the correct location */\n\t             uncompress2mem_from_mem(ptr, vla_repeat, &cptr, &fullsize, realloc, &dlen, status);        \n\t          }\n\t          break;\n\n\t        case 'B':\n\n\t          if (zctype[ii] == RICE_1) {\n   \t              dlen = fits_rdecomp_byte ((unsigned char *) ptr, vla_repeat, (unsigned char *)cptr, \n\t\t        fullsize, 32);\n\t          } else { /* gunzip the data into the correct location */\n\t             uncompress2mem_from_mem(ptr, vla_repeat, &cptr, &fullsize, realloc, &dlen, status);        \n\t          }\n\t          break;\n\n\t        default: \n\t\t  /* all variable length array columns are included in this case */\n\t          /* gunzip the data into the correct location in the full table buffer */\n\t          uncompress2mem_from_mem(ptr, vla_repeat,\n\t              &cptr,  &fullsize, realloc, &dlen, status);              \n\n\t        } /* end of switch block */\n\n\t        free(ptr);\n\t  }  /* end of rmajor_repeat > 0 */\n      }  /* end of loop over columns */\n      \n      /* now transpose the rows and columns (from cm_buffer to rm_buffer) */\n      /* move each byte, in turn, from the cm_buffer to the appropriate place in the rm_buffer */\n      for (ii = 0; ii < ncols; ii++) {  /* loop over columns */\n\t ptr = (char *) (cm_buffer + cmajor_colstart[ii]);  /* initialize ptr to start of the column in the cm_buffer */\n         if (rmajor_repeat[ii] > 0) {  /* skip columns with zero elements */\n             if (coltype[ii] > 0) {  /* normal fixed length array columns */\n                 if (zctype[ii] == GZIP_2) {  /*  need to unshuffle the bytes */\n\n\t             /* recombine the byte planes for the 2-byte, 4-byte, and 8-byte numeric columns */\n\t             switch (colcode[ii]) {\n\t\n\t\t     case 'I':\n\t\t         /* get the 1st byte of each I*2 value */\n\t                 for (jj = 0; jj < rowspertile; jj++) {  /* loop over number of rows in the output table */\n\t\t             cptr = rm_buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]));  \n\t\t             for (kk = 0; kk < rmajor_repeat[ii]; kk++) {\n\t\t                 *cptr = *ptr;  /* copy 1 byte */\n\t\t                 ptr++;\n\t\t                 cptr += 2;  \n\t\t\t     }\n\t\t\t }\n\t\t         /* get the 2nd byte of each I*2 value */\n\t                 for (jj = 0; jj < rowspertile; jj++) {  /* loop over number of rows in the output table */\n\t\t            cptr = rm_buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 1);  \n\t\t            for (kk = 0; kk < rmajor_repeat[ii]; kk++) {\n\t\t                *cptr = *ptr;  /* copy 1 byte */\n\t\t                ptr++;\n\t\t                cptr += 2;  \n\t\t            }\n\t\t         }\n\t\t         break;\n\n\t\t   case 'J':\n\t\t   case 'E':\n\t\t       /* get the 1st byte of each 4-byte value */\n\t               for (jj = 0; jj < rowspertile; jj++) {  /* loop over number of rows in the output table */\n\t\t         cptr = rm_buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]));  \n\t\t         for (kk = 0; kk < rmajor_repeat[ii]; kk++) {\n\t\t           *cptr = *ptr;  /* copy 1 byte */\n\t\t           ptr++;\n\t\t           cptr += 4;  \n\t\t         }\n\t\t       }\n\t\t       /* get the 2nd byte  */\n\t               for (jj = 0; jj < rowspertile; jj++) {  /* loop over number of rows in the output table */\n\t\t         cptr = rm_buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 1);  \n\t\t          for (kk = 0; kk < rmajor_repeat[ii]; kk++) {\n\t\t            *cptr = *ptr;  /* copy 1 byte */\n\t\t            ptr++;\n\t\t            cptr += 4;  \n\t\t          }\n\t\t       }\n\t\t       /* get the 3rd byte  */\n\t               for (jj = 0; jj < rowspertile; jj++) {  /* loop over number of rows in the output table */\n\t\t         cptr = rm_buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 2);  \n\t\t         for (kk = 0; kk < rmajor_repeat[ii]; kk++) {\n\t\t           *cptr = *ptr;  /* copy 1 byte */\n\t\t           ptr++;\n\t\t           cptr += 4;  \n\t\t         }\n\t\t       }\n\t\t       /* get the 4th byte  */\n\t               for (jj = 0; jj < rowspertile; jj++) {  /* loop over number of rows in the output table */\n\t\t         cptr = rm_buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 3);  \n\t\t         for (kk = 0; kk < rmajor_repeat[ii]; kk++) {\n\t\t           *cptr = *ptr;  /* copy 1 byte */\n\t\t           ptr++;\n\t\t           cptr += 4;  \n\t\t         }\n\t\t       }\n\t\t       break;\n\n\t\t case 'D':\n\t\t case 'K':\n\t\t       /* get the 1st byte of each 8-byte value */\n \t              for (jj = 0; jj < rowspertile; jj++) {  /* loop over number of rows in the output table */\n\t\t         cptr = rm_buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]));  \n\t\t         for (kk = 0; kk < rmajor_repeat[ii]; kk++) {\n\t\t           *cptr = *ptr;  /* copy 1 byte */\n\t\t           ptr++;\n\t\t           cptr += 8;  \n\t\t         }\n\t\t       }\n\t\t       /* get the 2nd byte  */\n\t               for (jj = 0; jj < rowspertile; jj++) {  /* loop over number of rows in the output table */\n\t\t         cptr = rm_buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 1);  \n\t\t         for (kk = 0; kk < rmajor_repeat[ii]; kk++) {\n\t\t           *cptr = *ptr;  /* copy 1 byte */\n\t\t           ptr++;\n\t\t           cptr += 8;  \n\t\t         }\n\t\t       }\n\t\t       /* get the 3rd byte  */\n\t               for (jj = 0; jj < rowspertile; jj++) {  /* loop over number of rows in the output table */\n\t\t         cptr = rm_buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 2);  \n\t\t         for (kk = 0; kk < rmajor_repeat[ii]; kk++) {\n\t\t           *cptr = *ptr;  /* copy 1 byte */\n\t\t           ptr++;\n\t\t           cptr += 8;  \n\t\t         }\n\t\t       }\n\t\t       /* get the 4th byte  */\n\t  \t       for (jj = 0; jj < rowspertile; jj++) {  /* loop over number of rows in the output table */\n\t\t         cptr = rm_buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 3);  \n\t\t         for (kk = 0; kk < rmajor_repeat[ii]; kk++) {\n\t\t           *cptr = *ptr;  /* copy 1 byte */\n\t\t           ptr++;\n\t\t           cptr += 8;  \n\t\t         }\n\t\t       }\n\t\t       /* get the 5th byte */\n\t               for (jj = 0; jj < rowspertile; jj++) {  /* loop over number of rows in the output table */\n\t\t         cptr = rm_buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 4);  \n\t\t         for (kk = 0; kk < rmajor_repeat[ii]; kk++) {\n\t\t           *cptr = *ptr;  /* copy 1 byte */\n\t\t           ptr++;\n\t\t           cptr += 8;  \n\t\t         }\n\t\t       }\n\t\t       /* get the 6th byte  */\n\t               for (jj = 0; jj < rowspertile; jj++) {  /* loop over number of rows in the output table */\n\t\t         cptr = rm_buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 5);  \n\t\t         for (kk = 0; kk < rmajor_repeat[ii]; kk++) {\n\t\t           *cptr = *ptr;  /* copy 1 byte */\n\t\t           ptr++;\n\t\t           cptr += 8;  \n\t\t         }\n\t\t       }\n\t\t       /* get the 7th byte  */\n\t               for (jj = 0; jj < rowspertile; jj++) {  /* loop over number of rows in the output table */\n\t\t         cptr = rm_buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 6);  \n\t\t         for (kk = 0; kk < rmajor_repeat[ii]; kk++) {\n\t\t           *cptr = *ptr;  /* copy 1 byte */\n\t\t           ptr++;\n\t\t           cptr += 8;  \n\t\t         }\n\t\t       }\n\t\t       /* get the 8th byte  */\n\t               for (jj = 0; jj < rowspertile; jj++) {  /* loop over number of rows in the output table */\n\t\t         cptr = rm_buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 7);  \n\t\t         for (kk = 0; kk < rmajor_repeat[ii]; kk++) {\n\t\t           *cptr = *ptr;  /* copy 1 byte */\n\t\t           ptr++;\n\t\t           cptr += 8;  \n\t\t         }\n\t\t       }\n\t\t       break;\n\n\t\tdefault: /*  should never get here */\n\t            ffpmsg(\"Error: unexpected attempt to use GZIP_2 to compress a column unsuitable data type\");\n\t\t    *status = DATA_DECOMPRESSION_ERR;\n                    free(rm_buffer);  free(cm_buffer);\n\t            return(*status);\n\n\t        }  /* end of switch  for shuffling the bytes*/\n\n            } else {  /* not GZIP_2, don't have to shuffle bytes, so just transpose the rows and columns */\n\n\t         for (jj = 0; jj < rowspertile; jj++) {  /* loop over number of rows in the output table */\n\t\t     cptr = rm_buffer + (rmajor_colstart[ii] + jj * rmajor_colstart[ncols]);   /* addr to copy to */\n\t\t     memcpy(cptr, ptr, (size_t) rmajor_colwidth[ii]);\n\t \n\t\t     ptr += (rmajor_colwidth[ii]);\n\t\t }\n\t    }\n        } else {  /* transpose the variable length array pointers */\n\n              for (jj = 0; jj < rowspertile; jj++) {  /* loop over number of rows in the output uncompressed table */\n\t        cptr = rm_buffer + (rmajor_colstart[ii] + jj * rmajor_colstart[ncols]);   /* addr to copy to */\n\t        memcpy(cptr, ptr, (size_t) rmajor_colwidth[ii]);\n\t \n\t        ptr += (rmajor_colwidth[ii]);\n\t      }\n\n\t      if (rmajor_colwidth[ii] == 8 ) {  /* these are P-type descriptors */\n\t           pdescript = (int *) (cm_buffer + cmajor_colstart[ii]);\n#if BYTESWAPPED\n\t           ffswap4((int *) pdescript,  rowspertile * 2);  /* byte-swap the descriptor */\n#endif\n\t      } else if (rmajor_colwidth[ii] == 16 ) {  /* these are Q-type descriptors */\n\t           qdescript = (LONGLONG *) (cm_buffer + cmajor_colstart[ii]);\n#if BYTESWAPPED\n\t           ffswap8((double *) qdescript,  rowspertile * 2); /* byte-swap the descriptor */\n#endif\n\t      } else { /* this should never happen */\n\t            ffpmsg(\"Error: Descriptor column is neither 8 nor 16 bytes wide\");\n                    free(rm_buffer);  free(cm_buffer);\n\t\t    *status = DATA_DECOMPRESSION_ERR;\n\t            return(*status);\n\t      }\t\n\t      \t\n\t      /* First, set pointer to the Q descriptors, and byte-swap them, if needed */\n\t      descript = (LONGLONG*) (cm_buffer + cmajor_colstart[ii] + (rmajor_colwidth[ii] * rowspertile));\n#if BYTESWAPPED\n\t      /* byte-swap the descriptor */\n\t      ffswap8((double *) descript,  rowspertile * 2);\n#endif\n\n\t      /* now uncompress all the individual VLAs, and */\n\t      /* write them to their original location in the uncompressed file */\n\n\t      for (jj = 0; jj < rowspertile; jj++)   {    /* loop over rows */\n                    /* get the size and location of the compressed VLA in the compressed table */\n\t\t    cvlalen = descript[jj * 2];\n\t\t    cvlastart = descript[(jj * 2) + 1]; \n\t\t    if (cvlalen > 0 ) {\n\n\t\t\t/* get the size and location to write the uncompressed VLA in the uncompressed table */\n\t\t\tif (rmajor_colwidth[ii] == 8 ) { \n\t\t\t    vlalen = pdescript[jj * 2];\n\t\t\t    vlastart = pdescript[(jj * 2) + 1];\n\t\t\t} else  {\n\t\t\t    vlalen = qdescript[jj * 2];\n\t\t\t    vlastart = qdescript[(jj * 2) + 1];\n\t\t\t}\t\t\t\n\t\t\tvlamemlen = (size_t) (vlalen * (-coltype[ii] / 10));  /* size of the uncompressed VLA, in bytes */\n\n\t\t\t/* allocate memory for the compressed vla */\n\t\t\tcompressed_vla = malloc( (size_t) cvlalen);\n\t\t\tif (!compressed_vla) {\n\t\t\t    ffpmsg(\"Could not allocate buffer for compressed VLA\");\n\t\t\t    free(rm_buffer);  free(cm_buffer);\n\t\t\t    *status = MEMORY_ALLOCATION;\n\t\t\t    return(*status);\n\t\t\t}\n\n\t\t\t/* read the compressed VLA from the heap in the input compressed table */\n\t\t\tbytepos = (size_t) ((infptr->Fptr)->datastart + (infptr->Fptr)->heapstart + cvlastart);\n\t\t\tffmbyt(infptr, bytepos, REPORT_EOF, status);\n\t\t\tffgbyt(infptr, cvlalen, compressed_vla, status);  /* read the bytes */\n\t\t\t/* if the VLA couldn't be compressed, just copy it directly to the output uncompressed table */\n\t\t\tif (cvlalen   == vlamemlen ) {\n\t\t\t    bytepos = (size_t) ((outfptr->Fptr)->datastart + (outfptr->Fptr)->heapstart + vlastart);\n\t\t\t    ffmbyt(outfptr, bytepos, IGNORE_EOF, status);\n\t\t\t    ffpbyt(outfptr, cvlalen, compressed_vla, status);  /* write the bytes */\n\t\t\t} else {  /* uncompress the VLA  */\n\t\t  \n\t\t\t    /* allocate memory for the uncompressed VLA */\n\t\t\t    uncompressed_vla =  malloc(vlamemlen);\n\t\t\t    if (!uncompressed_vla) {\n\t\t\t\tffpmsg(\"Could not allocate buffer for uncompressed VLA\");\n\t\t\t\t*status = MEMORY_ALLOCATION;\n\t\t\t        free(compressed_vla); free(rm_buffer);  free(cm_buffer);\n\t\t\t\treturn(*status);\n\t\t\t    }\n\t\t\t    /* uncompress the VLA with the appropriate algorithm */\n\t\t\t    if (zctype[ii] == RICE_1) {\n\n\t\t\t\tif (-coltype[ii] == TSHORT) {\n\t\t\t\t    dlen = fits_rdecomp_short((unsigned char *) compressed_vla, (int) cvlalen, (unsigned short *)uncompressed_vla, \n\t\t\t\t\t(int) vlalen, 32);\n#if BYTESWAPPED\n\t\t\t\t   ffswap2((short *) uncompressed_vla, (long) vlalen); \n#endif\n\t\t\t\t} else if (-coltype[ii] == TLONG) {\n\t\t\t\t    dlen = fits_rdecomp((unsigned char *) compressed_vla, (int) cvlalen, (unsigned int *)uncompressed_vla, \n\t\t\t\t\t(int) vlalen, 32);\n#if BYTESWAPPED\n\t\t\t\t   ffswap4((int *) uncompressed_vla, (long) vlalen); \n#endif\n \t\t\t\t} else if (-coltype[ii] == TBYTE) {\n\t\t\t\t    dlen = fits_rdecomp_byte((unsigned char *) compressed_vla, (int) cvlalen, (unsigned char *) uncompressed_vla, \n\t\t\t\t\t(int) vlalen, 32);\n\t\t\t\t} else {\n\t\t\t\t    /* this should not happen */\n\t\t\t\t    ffpmsg(\" Error: cannot uncompress this column type with the RICE algorithm\");\n\n\t\t\t\t    *status = DATA_DECOMPRESSION_ERR;\n\t\t\t            free(uncompressed_vla); free(compressed_vla); free(rm_buffer);  free(cm_buffer);\n\t\t\t\t    return(*status);\n\t\t\t\t}  \n\n\t\t\t    } else if (zctype[ii] == GZIP_1 || zctype[ii] == GZIP_2){  \n\n\t\t\t       /*: gzip uncompress the array of bytes */\n\t\t\t       uncompress2mem_from_mem( compressed_vla, (size_t) cvlalen, &uncompressed_vla, &vlamemlen, realloc, &vlamemlen, status);\n\n\t\t\t       if (zctype[ii] == GZIP_2 ) {\n\t\t\t\t  /* unshuffle the bytes after ungzipping them */\n\t\t\t\t  if ( (int) (-coltype[ii] / 10) == 2) {\n\t\t\t\t    fits_unshuffle_2bytes((char *) uncompressed_vla, vlalen, status);\n\t\t\t\t  } else if ( (int) (-coltype[ii] / 10) == 4) {\n\t\t\t\t    fits_unshuffle_4bytes((char *) uncompressed_vla, vlalen, status);\n\t\t\t\t  } else if ( (int) (-coltype[ii] / 10) == 8) {\n\t\t\t\t    fits_unshuffle_8bytes((char *) uncompressed_vla, vlalen, status);\n\t\t\t\t  }\n\t\t\t       }\n\n\t\t\t    } else {\n\t\t\t\t/* this should not happen */\n\t\t\t\tffpmsg(\" Error: unknown compression algorithm\");\n\t\t\t        free(uncompressed_vla); free(compressed_vla); free(rm_buffer);  free(cm_buffer);\n\t\t\t\t*status = DATA_COMPRESSION_ERR;\n\t\t\t\treturn(*status);\n\t\t\t    }  \t\t     \n\n\t\t\t    bytepos = (size_t) ((outfptr->Fptr)->datastart + (outfptr->Fptr)->heapstart + vlastart);\n\t\t\t    ffmbyt(outfptr, bytepos, IGNORE_EOF, status);\n\t\t\t    ffpbyt(outfptr, vlamemlen, uncompressed_vla, status);  /* write the bytes */\n\t\t\t    \n\t\t\t     free(uncompressed_vla);\n\t\t\t}  /* end of uncompress VLA */\n\n\t\t        free(compressed_vla);\n\n\t\t  } /* end of vlalen > 0 */\n\t\t} /* end of loop over rowspertile */\n\n              } /* end of variable length array section*/\n           }  /* end of if column repeat > 0 */\n        }  /* end of ncols loop */\n\n        /* copy the buffer of data to the output data unit */\n\n        if (datastart == 0) fits_get_hduaddrll(outfptr, &headstart, &datastart, &dataend, status);        \n\n        ffmbyt(outfptr, datastart, 1, status);\n        ffpbyt(outfptr, naxis1 * rowspertile, rm_buffer, status);\n\n\t/* increment pointers for next tile */\n\trowstart += rowspertile;\n        rowsremain -= rowspertile;\n\tdatastart += (naxis1 * rowspertile);\n\tif (rowspertile > rowsremain) rowspertile = (long) rowsremain;\n\n    }  /* end of while rows still remain */\n\n    free(rm_buffer);\n    free(cm_buffer);\n\t\n    /* reset internal table structure parameters */\n    fits_set_hdustruc(outfptr, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int fits_shuffle_2bytes(char *heap, LONGLONG length, int *status)\n\n/* shuffle the bytes in an array of 2-byte integers in the heap */\n\n{\n    LONGLONG ii;\n    char *ptr, *cptr, *heapptr;\n    \n    ptr = malloc((size_t) (length * 2));\n    heapptr = heap;\n    cptr = ptr;\n    \n    for (ii = 0; ii < length; ii++) {\n       *cptr = *heapptr;\n       heapptr++;\n       *(cptr + length) = *heapptr;\n       heapptr++;\n       cptr++;\n    }\n         \n    memcpy(heap, ptr, (size_t) (length * 2));\n    free(ptr);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int fits_shuffle_4bytes(char *heap, LONGLONG length, int *status)\n\n/* shuffle the bytes in an array of 4-byte integers or floats  */\n\n{\n    LONGLONG ii;\n    char *ptr, *cptr, *heapptr;\n    \n    ptr = malloc((size_t) (length * 4));\n    if (!ptr) {\n      ffpmsg(\"malloc failed\\n\");\n      return(*status);\n    }\n\n    heapptr = heap;\n    cptr = ptr;\n \n    for (ii = 0; ii < length; ii++) {\n       *cptr = *heapptr;\n       heapptr++;\n       *(cptr + length) = *heapptr;\n       heapptr++;\n       *(cptr + (length * 2)) = *heapptr;\n       heapptr++;\n       *(cptr + (length * 3)) = *heapptr;\n       heapptr++;\n       cptr++;\n    }\n        \n    memcpy(heap, ptr, (size_t) (length * 4));\n    free(ptr);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int fits_shuffle_8bytes(char *heap, LONGLONG length, int *status)\n\n/* shuffle the bytes in an array of 8-byte integers or doubles in the heap */\n\n{\n    LONGLONG ii;\n    char *ptr, *cptr, *heapptr;\n    \n    ptr = calloc(1, (size_t) (length * 8));\n    heapptr = heap;\n    \n/* for some bizarre reason this loop fails to compile under OpenSolaris using\n   the proprietary SunStudioExpress C compiler;  use the following equivalent\n   loop instead.\n   \n    cptr = ptr;\n\n    for (ii = 0; ii < length; ii++) {\n       *cptr = *heapptr;\n       heapptr++;\n       *(cptr + length) = *heapptr;\n       heapptr++;\n       *(cptr + (length * 2)) = *heapptr;\n       heapptr++;\n       *(cptr + (length * 3)) = *heapptr;\n       heapptr++;\n       *(cptr + (length * 4)) = *heapptr;\n       heapptr++;\n       *(cptr + (length * 5)) = *heapptr;\n       heapptr++;\n       *(cptr + (length * 6)) = *heapptr;\n       heapptr++;\n       *(cptr + (length * 7)) = *heapptr;\n       heapptr++;\n       cptr++;\n     }\n*/\n     for (ii = 0; ii < length; ii++) {\n        cptr = ptr + ii;\n\n        *cptr = *heapptr;\n\n        heapptr++;\n        cptr += length;\n        *cptr = *heapptr;\n\n        heapptr++;\n        cptr += length;\n        *cptr = *heapptr;\n\n        heapptr++;\n        cptr += length;\n        *cptr = *heapptr;\n\n        heapptr++;\n        cptr += length;\n        *cptr = *heapptr;\n\n        heapptr++;\n        cptr += length;\n        *cptr = *heapptr;\n\n        heapptr++;\n        cptr += length;\n        *cptr = *heapptr;\n\n        heapptr++;\n        cptr += length;\n        *cptr = *heapptr;\n\n        heapptr++;\n     }\n        \n    memcpy(heap, ptr, (size_t) (length * 8));\n    free(ptr);\n \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int fits_unshuffle_2bytes(char *heap, LONGLONG length, int *status)\n\n/* unshuffle the bytes in an array of 2-byte integers */\n\n{\n    LONGLONG ii;\n    char *ptr, *cptr, *heapptr;\n    \n    ptr = malloc((size_t) (length * 2));\n    heapptr = heap + (2 * length) - 1;\n    cptr = ptr + (2 * length) - 1;\n    \n    for (ii = 0; ii < length; ii++) {\n       *cptr = *heapptr;\n       cptr--;\n       *cptr = *(heapptr - length);\n       cptr--;\n       heapptr--;\n    }\n         \n    memcpy(heap, ptr, (size_t) (length * 2));\n    free(ptr);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int fits_unshuffle_4bytes(char *heap, LONGLONG length, int *status)\n\n/* unshuffle the bytes in an array of 4-byte integers or floats */\n\n{\n    LONGLONG ii;\n    char *ptr, *cptr, *heapptr;\n    \n    ptr = malloc((size_t) (length * 4));\n    heapptr = heap + (4 * length) -1;\n    cptr = ptr + (4 * length) -1;\n \n    for (ii = 0; ii < length; ii++) {\n       *cptr = *heapptr;\n       cptr--;\n       *cptr = *(heapptr - length);\n       cptr--;\n       *cptr = *(heapptr - (2 * length));\n       cptr--;\n       *cptr = *(heapptr - (3 * length));\n       cptr--;\n       heapptr--;\n    }\n        \n    memcpy(heap, ptr, (size_t) (length * 4));\n    free(ptr);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int fits_unshuffle_8bytes(char *heap, LONGLONG length, int *status)\n\n/* unshuffle the bytes in an array of 8-byte integers or doubles */\n\n{\n    LONGLONG ii;\n    char *ptr, *cptr, *heapptr;\n    \n    ptr = malloc((size_t) (length * 8));\n    heapptr = heap + (8 * length) - 1;\n    cptr = ptr + (8 * length)  -1;\n    \n    for (ii = 0; ii < length; ii++) {\n       *cptr = *heapptr;\n       cptr--;\n       *cptr = *(heapptr - length);\n       cptr--;\n       *cptr = *(heapptr - (2 * length));\n       cptr--;\n       *cptr = *(heapptr - (3 * length));\n       cptr--;\n       *cptr = *(heapptr - (4 * length));\n       cptr--;\n       *cptr = *(heapptr - (5 * length));\n       cptr--;\n       *cptr = *(heapptr - (6 * length));\n       cptr--;\n       *cptr = *(heapptr - (7 * length));\n       cptr--;\n       heapptr--;\n    }\n       \n    memcpy(heap, ptr, (size_t) (length * 8));\n    free(ptr);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int fits_int_to_longlong_inplace(int *intarray, long length, int *status)\n\n/* convert the input array of 32-bit integers into an array of 64-bit integers,\nin place. This will overwrite the input array with the new longer array starting\nat the same memory location.  \n\nNote that aliasing the same memory location with pointers of different datatypes is\nnot allowed in strict ANSI C99, however it is  used here for efficency. In principle,\none could simply copy the input array in reverse order to the output array,\nbut this only works if the compiler performs the operation in strict order.  Certain\ncompiler optimization techniques may vioate this assumption.  Therefore, we first\ncopy a section of the input array to a temporary intermediate array, before copying\nthe longer datatype values back to the original array.\n*/\n\n{\n    LONGLONG *longlongarray, *aliasarray;\n    long ii, ntodo, firstelem, nmax = 10000;\n    \n    if (*status > 0) \n        return(*status);\n\n    ntodo = nmax;\n    if (length < nmax) ntodo = length;\n    \n    firstelem = length - ntodo;  /* first element to be converted */\n    \n    longlongarray = (LONGLONG *) malloc(ntodo * sizeof(LONGLONG));\n    \n    if (longlongarray == NULL)\n    {\n\tffpmsg(\"Out of memory. (fits_int_to_longlong_inplace)\");\n\treturn (*status = MEMORY_ALLOCATION);\n    }\n\n    aliasarray = (LONGLONG *) intarray; /* alias pointer to the input array */\n\n    while (ntodo > 0) {\n    \n\t/* do datatype conversion into temp array */\n        for (ii = 0; ii < ntodo; ii++) { \n\t    longlongarray[ii] = intarray[ii + firstelem];\n        }\n\n        /* copy temp array back to alias */\n        memcpy(&(aliasarray[firstelem]), longlongarray, ntodo * 8);\n\t\n        if (firstelem == 0) {  /* we are all done */\n\t    ntodo = 0;   \n\t} else {  /* recalculate ntodo and firstelem for next loop */\n\t    if (firstelem > nmax) {\n\t        firstelem -= nmax;\n\t    } else {\n\t        ntodo = firstelem;\n\t        firstelem = 0;\n\t    }\n\t}\n    }\n\n    free(longlongarray);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int fits_short_to_int_inplace(short *shortarray, long length, int shift, int *status)\n\n/* convert the input array of 16-bit integers into an array of 32-bit integers,\nin place. This will overwrite the input array with the new longer array starting\nat the same memory location.  \n\nNote that aliasing the same memory location with pointers of different datatypes is\nnot allowed in strict ANSI C99, however it is  used here for efficency. In principle,\none could simply copy the input array in reverse order to the output array,\nbut this only works if the compiler performs the operation in strict order.  Certain\ncompiler optimization techniques may vioate this assumption.  Therefore, we first\ncopy a section of the input array to a temporary intermediate array, before copying\nthe longer datatype values back to the original array.\n*/\n\n{\n    int *intarray, *aliasarray;\n    long ii, ntodo, firstelem, nmax = 10000;\n    \n    if (*status > 0) \n        return(*status);\n\n    ntodo = nmax;\n    if (length < nmax) ntodo = length;\n    \n    firstelem = length - ntodo;  /* first element to be converted */\n    \n    intarray = (int *) malloc(ntodo * sizeof(int));\n    \n    if (intarray == NULL)\n    {\n\tffpmsg(\"Out of memory. (fits_short_to_int_inplace)\");\n\treturn (*status = MEMORY_ALLOCATION);\n    }\n\n    aliasarray = (int *) shortarray; /* alias pointer to the input array */\n\n    while (ntodo > 0) {\n    \n\t/* do datatype conversion into temp array */\n        for (ii = 0; ii < ntodo; ii++) { \n\t    intarray[ii] = (int)(shortarray[ii + firstelem]) + shift;\n        }\n\n        /* copy temp array back to alias */\n        memcpy(&(aliasarray[firstelem]), intarray, ntodo * 4);\n\t\n        if (firstelem == 0) {  /* we are all done */\n\t    ntodo = 0;   \n\t} else {  /* recalculate ntodo and firstelem for next loop */\n\t    if (firstelem > nmax) {\n\t        firstelem -= nmax;\n\t    } else {\n\t        ntodo = firstelem;\n\t        firstelem = 0;\n\t    }\n\t}\n    }\n\n    free(intarray);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int fits_ushort_to_int_inplace(unsigned short *ushortarray, long length, \n                                      int shift, int *status)\n\n/* convert the input array of 16-bit unsigned integers into an array of 32-bit integers,\nin place. This will overwrite the input array with the new longer array starting\nat the same memory location.  \n\nNote that aliasing the same memory location with pointers of different datatypes is\nnot allowed in strict ANSI C99, however it is  used here for efficency. In principle,\none could simply copy the input array in reverse order to the output array,\nbut this only works if the compiler performs the operation in strict order.  Certain\ncompiler optimization techniques may vioate this assumption.  Therefore, we first\ncopy a section of the input array to a temporary intermediate array, before copying\nthe longer datatype values back to the original array.\n*/\n\n{\n    int *intarray, *aliasarray;\n    long ii, ntodo, firstelem, nmax = 10000;\n    \n    if (*status > 0) \n        return(*status);\n\n    ntodo = nmax;\n    if (length < nmax) ntodo = length;\n    \n    firstelem = length - ntodo;  /* first element to be converted */\n    \n    intarray = (int *) malloc(ntodo * sizeof(int));\n    \n    if (intarray == NULL)\n    {\n\tffpmsg(\"Out of memory. (fits_ushort_to_int_inplace)\");\n\treturn (*status = MEMORY_ALLOCATION);\n    }\n\n    aliasarray = (int *) ushortarray; /* alias pointer to the input array */\n\n    while (ntodo > 0) {\n    \n\t/* do datatype conversion into temp array */\n        for (ii = 0; ii < ntodo; ii++) { \n\t    intarray[ii] = (int)(ushortarray[ii + firstelem]) + shift;\n        }\n\n        /* copy temp array back to alias */\n        memcpy(&(aliasarray[firstelem]), intarray, ntodo * 4);\n\t\n        if (firstelem == 0) {  /* we are all done */\n\t    ntodo = 0;   \n\t} else {  /* recalculate ntodo and firstelem for next loop */\n\t    if (firstelem > nmax) {\n\t        firstelem -= nmax;\n\t    } else {\n\t        ntodo = firstelem;\n\t        firstelem = 0;\n\t    }\n\t}\n    }\n\n    free(intarray);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int fits_ubyte_to_int_inplace(unsigned char *ubytearray, long length, \n                                      int *status)\n\n/* convert the input array of 8-bit unsigned integers into an array of 32-bit integers,\nin place. This will overwrite the input array with the new longer array starting\nat the same memory location.  \n\nNote that aliasing the same memory location with pointers of different datatypes is\nnot allowed in strict ANSI C99, however it is  used here for efficency. In principle,\none could simply copy the input array in reverse order to the output array,\nbut this only works if the compiler performs the operation in strict order.  Certain\ncompiler optimization techniques may vioate this assumption.  Therefore, we first\ncopy a section of the input array to a temporary intermediate array, before copying\nthe longer datatype values back to the original array.\n*/\n\n{\n    int *intarray, *aliasarray;\n    long ii, ntodo, firstelem, nmax = 10000;\n    \n    if (*status > 0) \n        return(*status);\n\n    ntodo = nmax;\n    if (length < nmax) ntodo = length;\n    \n    firstelem = length - ntodo;  /* first element to be converted */\n    \n    intarray = (int *) malloc(ntodo * sizeof(int));\n    \n    if (intarray == NULL)\n    {\n\tffpmsg(\"Out of memory. (fits_ubyte_to_int_inplace)\");\n\treturn (*status = MEMORY_ALLOCATION);\n    }\n\n    aliasarray = (int *) ubytearray; /* alias pointer to the input array */\n\n    while (ntodo > 0) {\n    \n\t/* do datatype conversion into temp array */\n        for (ii = 0; ii < ntodo; ii++) { \n\t    intarray[ii] = ubytearray[ii + firstelem];\n        }\n\n        /* copy temp array back to alias */\n        memcpy(&(aliasarray[firstelem]), intarray, ntodo * 4);\n\t\n        if (firstelem == 0) {  /* we are all done */\n\t    ntodo = 0;   \n\t} else {  /* recalculate ntodo and firstelem for next loop */\n\t    if (firstelem > nmax) {\n\t        firstelem -= nmax;\n\t    } else {\n\t        ntodo = firstelem;\n\t        firstelem = 0;\n\t    }\n\t}\n    }\n\n    free(intarray);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int fits_sbyte_to_int_inplace(signed char *sbytearray, long length, \n                                      int *status)\n\n/* convert the input array of 8-bit signed integers into an array of 32-bit integers,\nin place. This will overwrite the input array with the new longer array starting\nat the same memory location.  \n\nNote that aliasing the same memory location with pointers of different datatypes is\nnot allowed in strict ANSI C99, however it is  used here for efficency. In principle,\none could simply copy the input array in reverse order to the output array,\nbut this only works if the compiler performs the operation in strict order.  Certain\ncompiler optimization techniques may vioate this assumption.  Therefore, we first\ncopy a section of the input array to a temporary intermediate array, before copying\nthe longer datatype values back to the original array.\n*/\n\n/*\n!!!!!!!!!!!!!!!!!\nNOTE THAT THIS IS A SPECIALIZED ROUTINE THAT ADDS AN OFFSET OF 128 TO THE ARRAY VALUES\n!!!!!!!!!!!!!!!!!\n*/\n\n{\n    int *intarray, *aliasarray;\n    long ii, ntodo, firstelem, nmax = 10000;\n    \n    if (*status > 0) \n        return(*status);\n\n    ntodo = nmax;\n    if (length < nmax) ntodo = length;\n    \n    firstelem = length - ntodo;  /* first element to be converted */\n    \n    intarray = (int *) malloc(ntodo * sizeof(int));\n    \n    if (intarray == NULL)\n    {\n\tffpmsg(\"Out of memory. (fits_sbyte_to_int_inplace)\");\n\treturn (*status = MEMORY_ALLOCATION);\n    }\n\n    aliasarray = (int *) sbytearray; /* alias pointer to the input array */\n\n    while (ntodo > 0) {\n    \n\t/* do datatype conversion into temp array */\n        for (ii = 0; ii < ntodo; ii++) { \n\t    intarray[ii] = sbytearray[ii + firstelem] + 128;  /* !! Note the offset !! */\n        }\n\n        /* copy temp array back to alias */\n        memcpy(&(aliasarray[firstelem]), intarray, ntodo * 4);\n\t\n        if (firstelem == 0) {  /* we are all done */\n\t    ntodo = 0;   \n\t} else {  /* recalculate ntodo and firstelem for next loop */\n\t    if (firstelem > nmax) {\n\t        firstelem -= nmax;\n\t    } else {\n\t        ntodo = firstelem;\n\t        firstelem = 0;\n\t    }\n\t}\n    }\n\n    free(intarray);\n    return(*status);\n}\n\nint fits_calc_tile_rows(long *tlpixel, long *tfpixel, int ndim, long *trowsize, long *ntrows, int *status)\n{\n\n   /*  The quantizing algorithms treat all N-dimensional tiles as if they\n       were 2 dimensions (trowsize * ntrows).  This sets trowsize to the\n       first dimensional size encountered that's > 1 (typically the X dimension).\n       ntrows will then be the product of the remaining dimensional sizes.\n       \n       Examples:  Tile = (5,4,1,3):  trowsize=5, ntrows=12\n                  Tile = (1,1,5):  trowsize=5, ntrows=1\n   */\n\n   int ii;\n   long np;\n   \n   if (*status)\n      return (*status);\n    \n   *trowsize = 0; \n   *ntrows = 1;  \n   for (ii=0; ii<ndim; ++ii)\n   {\n      np = tlpixel[ii] - tfpixel[ii] + 1;\n      if (np > 1)\n      {\n         if (!(*trowsize))\n            *trowsize = np;\n         else\n            *ntrows *= np;\n      }\n   }\n   if (!(*trowsize))\n   {\n      /* Should only get here for the unusual case of all tile dimensions \n         having size = 1  */\n      *trowsize = 1;\n   }  \n      \n   return (*status);\n}\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":43,"id":16656,"name":"text","nodeType":"Attribute","startLoc":43,"text":"self.text"},{"attributeType":"null","col":8,"comment":"null","endLoc":29,"id":16657,"name":"_stale","nodeType":"Attribute","startLoc":29,"text":"self._stale"},{"id":16658,"name":"getcold.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, getcold.c, contains routines that read data elements from   */\n/*  a FITS image or table, with double datatype.                           */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <math.h>\n#include <stdlib.h>\n#include <limits.h>\n#include <string.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffgpvd( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            double nulval,    /* I - value for undefined pixels              */\n            double *array,    /* O - array of values that are returned       */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Undefined elements will be set equal to NULVAL, unless NULVAL=0\n  in which case no checking for undefined values will be performed.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    char cdummy;\n    int nullcheck = 1;\n    double nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n         nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_pixels(fptr, TDOUBLE, firstelem, nelem,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcld(fptr, 2, row, firstelem, nelem, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgpfd( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            double *array,    /* O - array of values that are returned       */\n            char *nularray,   /* O - array of null pixel flags               */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Any undefined pixels in the returned array will be set = 0 and the \n  corresponding nularray value will be set = 1.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    int nullcheck = 2;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_read_compressed_pixels(fptr, TDOUBLE, firstelem, nelem,\n            nullcheck, NULL, array, nularray, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcld(fptr, 2, row, firstelem, nelem, 1, 2, 0.,\n               array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg2dd(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           double nulval,   /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           double *array,   /* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    /* call the 3D reading routine, with the 3rd dimension = 1 */\n\n    ffg3dd(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, \n           anynul, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg3dd(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           double nulval,   /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  nrows,     /* I - number of rows in each plane of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           LONGLONG  naxis3,    /* I - FITS image NAXIS3 value                 */\n           double *array,   /* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 3-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    LONGLONG nfits, narray;\n    long tablerow, ii, jj;\n    char cdummy;\n    int nullcheck = 1;\n    long inc[] = {1,1,1};\n    LONGLONG fpixel[] = {1,1,1};\n    LONGLONG lpixel[3];\n    double nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        lpixel[0] =  (long) ncols;\n        lpixel[1] = (long) nrows;\n        lpixel[2] = (long) naxis3;\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TDOUBLE, fpixel, lpixel, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n       /* all the image pixels are contiguous, so read all at once */\n       ffgcld(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n       return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to read */\n    narray = 0;  /* next pixel in output array to be filled */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* reading naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffgcld(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval,\n          &array[narray], &cdummy, anynul, status) > 0)\n          return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsvd(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           double nulval,  /* I - value to set undefined pixels             */\n           double *array,  /* O - array to be filled and returned           */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dir[9];\n    long nelem, nultyp, ninc, numcol;\n    LONGLONG felem, dsize[10], blcll[9], trcll[9];\n    int hdutype, anyf;\n    char ldummy, msg[FLEN_ERRMSG];\n    int nullcheck = 1;\n    double nullvalue;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvd is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TDOUBLE, blcll, trcll, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 1;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n        dir[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        if (hdutype == IMAGE_HDU)\n        {\n           dir[ii] = -1;\n        }\n        else\n        {\n          snprintf(msg, FLEN_ERRMSG,\"ffgsvd: illegal range specified for axis %ld\", ii + 1);\n          ffpmsg(msg);\n          return(*status = BAD_PIX_NUM);\n        }\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n      dsize[ii] = dsize[ii] * dir[ii];\n    }\n    dsize[naxis] = dsize[naxis] * dir[naxis];\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0]*dir[0] - str[0]*dir[0]) / inc[0] + 1;\n      ninc = incr[0] * dir[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]*dir[8]; i8 <= stp[8]*dir[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]*dir[7]; i7 <= stp[7]*dir[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]*dir[6]; i6 <= stp[6]*dir[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]*dir[5]; i5 <= stp[5]*dir[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]*dir[4]; i4 <= stp[4]*dir[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]*dir[3]; i3 <= stp[3]*dir[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]*dir[2]; i2 <= stp[2]*dir[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]*dir[1]; i1 <= stp[1]*dir[1]; i1 += incr[1])\n            {\n\n              felem=str[0] + (i1 - dir[1]) * dsize[1] + (i2 - dir[2]) * dsize[2] + \n                             (i3 - dir[3]) * dsize[3] + (i4 - dir[4]) * dsize[4] +\n                             (i5 - dir[5]) * dsize[5] + (i6 - dir[6]) * dsize[6] +\n                             (i7 - dir[7]) * dsize[7] + (i8 - dir[8]) * dsize[8];\n\n              if ( ffgcld(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &ldummy, &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsfd(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           double *array,  /* O - array to be filled and returned           */\n           char *flagval,  /* O - set to 1 if corresponding value is null   */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dsize[10];\n    LONGLONG blcll[9], trcll[9];\n    long felem, nelem, nultyp, ninc, numcol;\n    int hdutype, anyf;\n    double nulval = 0;\n    char msg[FLEN_ERRMSG];\n    int nullcheck = 2;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg,FLEN_ERRMSG, \"NAXIS = %d in call to ffgsvd is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        fits_read_compressed_img(fptr, TDOUBLE, blcll, trcll, inc,\n            nullcheck, NULL, array, flagval, anynul, status);\n        return(*status);\n    }\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 2;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        snprintf(msg, FLEN_ERRMSG,\"ffgsvd: illegal range specified for axis %ld\", ii + 1);\n        ffpmsg(msg);\n        return(*status = BAD_PIX_NUM);\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n    }\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0] - str[0]) / inc[0] + 1;\n      ninc = incr[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1])\n            {\n              felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + \n                             (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] +\n                             (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] +\n                             (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8];\n\n              if ( ffgcld(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &flagval[i0], &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffggpd( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            long  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            long  nelem,      /* I - number of values to read                */\n            double *array,    /* O - array of values that are returned       */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of group parameters from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n*/\n{\n    long row;\n    int idummy;\n    char cdummy;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcld(fptr, 1, row, firstelem, nelem, 1, 1, 0.,\n               array, &cdummy, &idummy, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcvd(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           double nulval,    /* I - value for null pixels                   */\n           double *array,    /* O - array of values that are read           */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Any undefined pixels will be set equal to the value of 'nulval' unless\n  nulval = 0 in which case no checks for undefined pixels will be made.\n*/\n{\n    char cdummy;\n\n    ffgcld(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval,\n           array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcvm(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           double nulval,    /* I - value for null pixels                   */\n           double *array,    /* O - array of values that are read           */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Any undefined pixels will be set equal to the value of 'nulval' unless\n  nulval = 0 in which case no checks for undefined pixels will be made.\n\n  TSCAL and ZERO should not be used with complex values. \n*/\n{\n    char cdummy;\n\n    /* a complex double value is interpreted as a pair of double values,   */\n    /* thus need to multiply the first element and number of elements by 2 */\n\n    ffgcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2,\n        1, 1, nulval, array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcfd(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           double *array,    /* O - array of values that are read           */\n           char *nularray,   /* O - array of flags: 1 if null pixel; else 0 */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Nularray will be set = 1 if the corresponding array pixel is undefined, \n  otherwise nularray will = 0.\n*/\n{\n    double dummy = 0;\n\n    ffgcld(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy,\n           array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcfm(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           double *array,    /* O - array of values that are read           */\n           char *nularray,   /* O - array of flags: 1 if null pixel; else 0 */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Nularray will be set = 1 if the corresponding array pixel is undefined, \n  otherwise nularray will = 0.\n\n  TSCAL and ZERO should not be used with complex values. \n*/\n{\n    LONGLONG ii, jj;\n    float dummy = 0;\n    char *carray;\n\n    /* a complex double value is interpreted as a pair of double values,   */\n    /* thus need to multiply the first element and number of elements by 2 */\n\n    /* allocate temporary array */\n    carray = (char *) calloc( (size_t) (nelem * 2), 1); \n\n    ffgcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2,\n     1, 2, dummy, array, carray, anynul, status);\n\n    for (ii = 0, jj = 0; jj < nelem; ii += 2, jj++)\n    {\n       if (carray[ii] || carray[ii + 1])\n          nularray[jj] = 1;\n       else\n          nularray[jj] = 0;\n    }\n\n    free(carray);    \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcld( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            long  elemincre,  /* I - pixel increment; e.g., 2 = every other  */\n            int   nultyp,     /* I - null value handling code:               */\n                              /*     1: set undefined pixels = nulval        */\n                              /*     2: set nularray=1 for undefined pixels  */\n            double nulval,    /* I - value for null pixels if nultyp = 1     */\n            double *array,    /* O - array of values that are read           */\n            char *nularray,   /* O - array of flags = 1 if nultyp = 2        */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer be a virtual column in a 1 or more grouped FITS primary\n  array or image extension.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The output array of values will be converted from the datatype of the column\n  and will be scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    double scale, zero, power = 1, dtemp;\n    int tcode, hdutype, xcode, decimals, maxelem2;\n    long twidth, incre;\n    long ii, xwidth, ntodo;\n    int convert, nulcheck, readcheck = 0;\n    LONGLONG repeat, startpos, elemnum, readptr, tnull;\n    LONGLONG rowlen, rownum, remain, next, rowincre, maxelem;\n    char tform[20];\n    char message[FLEN_ERRMSG];\n    char snull[20];   /*  the FITS null value if reading from ASCII table  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0 || nelem == 0)  /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    if (anynul)\n        *anynul = 0;\n\n    if (nultyp == 2)\n        memset(nularray, 0, (size_t) nelem);   /* initialize nullarray */\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (elemincre < 0)\n        readcheck = -1;  /* don't do range checking in this case */\n\n    if ( ffgcprll( fptr, colnum, firstrow, firstelem, nelem, readcheck, &scale, &zero,\n         tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre,\n         &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 )\n         return(*status);\n    maxelem = maxelem2;\n\n    incre *= elemincre;   /* multiply incre to just get every nth pixel */\n\n    if (tcode == TSTRING)    /* setup for ASCII tables */\n    {\n      /* get the number of implied decimal places if no explicit decmal point */\n      ffasfm(tform, &xcode, &xwidth, &decimals, status); \n      for(ii = 0; ii < decimals; ii++)\n        power *= 10.;\n    }\n\n    /*------------------------------------------------------------------*/\n    /*  Decide whether to check for null values in the input FITS file: */\n    /*------------------------------------------------------------------*/\n    nulcheck = nultyp; /* by default check for null values in the FITS file */\n\n    if (nultyp == 1 && nulval == 0)\n       nulcheck = 0;    /* calling routine does not want to check for nulls */\n\n    else if (tcode%10 == 1 &&        /* if reading an integer column, and  */ \n            tnull == NULL_UNDEFINED) /* if a null value is not defined,    */\n            nulcheck = 0;            /* then do not check for null values. */\n\n    else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TBYTE && (tnull > 255 || tnull < 0) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED)\n         nulcheck = 0;\n\n    /*----------------------------------------------------------------------*/\n    /*  If FITS column and output data array have same datatype, then we do */\n    /*  not need to use a temporary buffer to store intermediate datatype.  */\n    /*----------------------------------------------------------------------*/\n    convert = 1;\n    if (tcode == TDOUBLE) /* Special Case:                        */\n    {                              /* no type convertion required, so read */\n                                  /* data directly into output buffer.    */\n\n        if (nelem < (LONGLONG)INT32_MAX/8) {\n            maxelem = nelem;\n        } else {\n            maxelem = INT32_MAX/8;\n        }\n\n        if (nulcheck == 0 && scale == 1. && zero == 0.)\n            convert = 0;  /* no need to scale data or find nulls */\n    }\n\n    /*---------------------------------------------------------------------*/\n    /*  Now read the pixels from the FITS column. If the column does not   */\n    /*  have the same datatype as the output array, then we have to read   */\n    /*  the raw values into a temporary buffer (of limited size).  In      */\n    /*  the case of a vector colum read only 1 vector of values at a time  */\n    /*  then skip to the next row if more values need to be read.          */\n    /*  After reading the raw values, then call the fffXXYY routine to (1) */\n    /*  test for undefined values, (2) convert the datatype if necessary,  */\n    /*  and (3) scale the values by the FITS TSCALn and TZEROn linear      */\n    /*  scaling parameters.                                                */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to read */\n    next = 0;                 /* next element in array to be read   */\n    rownum = 0;               /* row number, relative to firstrow   */\n\n    while (remain)\n    {\n        /* limit the number of pixels to read at one time to the number that\n           will fit in the buffer or to the number of pixels that remain in\n           the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);\n        if (elemincre >= 0)\n        {\n          ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1));\n        }\n        else\n        {\n          ntodo = (long) minvalue(ntodo, (elemnum/(-elemincre) +1));\n        }\n\n        readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre));\n\n        switch (tcode) \n        {\n            case (TDOUBLE):\n                ffgr8b(fptr, readptr, ntodo, incre, &array[next], status);\n                if (convert)\n                    fffr8r8(&array[next], ntodo, scale, zero, nulcheck, \n                           nulval, &nularray[next], anynul, \n                           &array[next], status);\n                break;\n            case (TBYTE):\n                ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer,\n                       status);\n                fffi1r8((unsigned char *) buffer, ntodo, scale, zero, nulcheck, \n                   (unsigned char) tnull, nulval, &nularray[next], anynul, \n                   &array[next], status);\n                break;\n            case (TSHORT):\n                ffgi2b(fptr, readptr, ntodo, incre, (short  *) buffer, status);\n                fffi2r8((short  *) buffer, ntodo, scale, zero, nulcheck, \n                    (short) tnull, nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TLONG):\n                ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) buffer,\n                       status);\n                fffi4r8((INT32BIT *) buffer, ntodo, scale, zero, nulcheck, \n                       (INT32BIT) tnull, nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TLONGLONG):\n                ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status);\n                fffi8r8( (LONGLONG *) buffer, ntodo, scale, zero, \n                           nulcheck, tnull, nulval, &nularray[next], \n                            anynul, &array[next], status);\n                break;\n            case (TFLOAT):\n                ffgr4b(fptr, readptr, ntodo, incre, (float  *) buffer, status);\n                fffr4r8((float  *) buffer, ntodo, scale, zero, nulcheck, \n                          nulval, &nularray[next], anynul, \n                          &array[next], status);\n                break;\n            case (TSTRING):\n                ffmbyt(fptr, readptr, REPORT_EOF, status);\n       \n                if (incre == twidth)    /* contiguous bytes */\n                     ffgbyt(fptr, ntodo * twidth, buffer, status);\n                else\n                     ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                               status);\n\n                fffstrr8((char *) buffer, ntodo, scale, zero, twidth, power,\n                     nulcheck, snull, nulval, &nularray[next], anynul,\n                     &array[next], status);\n                break;\n\n\n            default:  /*  error trap for invalid column format */\n                snprintf(message, FLEN_ERRMSG,\n                   \"Cannot read numbers from column %d which has format %s\",\n                    colnum, tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous read operation */\n        {\n\t  dtemp = (double) next;\n          if (hdutype > 0)\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgcld).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from image (ffgcld).\",\n              dtemp+1., dtemp+ntodo);\n\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum = elemnum + (ntodo * elemincre);\n\n            if (elemnum >= repeat)  /* completed a row; start on later row */\n            {\n                rowincre = (long) (elemnum / repeat);\n                rownum += rowincre;\n                elemnum = elemnum - (rowincre * repeat);\n            }\n            else if (elemnum < 0)  /* completed a row; start on a previous row */\n            {\n                rowincre = (long) ((-elemnum - 1) / repeat + 1);\n                rownum -= rowincre;\n                elemnum = (rowincre * repeat) + elemnum;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while reading FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi1r8(unsigned char *input, /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char tnull,  /* I - value of FITS TNULLn keyword if any */\n            double nullval,       /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            double *output,       /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (double) input[ii]; /* copy input to output */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                output[ii] = input[ii] * scale + zero;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (double) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    output[ii] = input[ii] * scale + zero;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi2r8(short *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short tnull,          /* I - value of FITS TNULLn keyword if any */\n            double nullval,       /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            double *output,       /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (double) input[ii]; /* copy input to output */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                output[ii] = input[ii] * scale + zero;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (double) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    output[ii] = input[ii] * scale + zero;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi4r8(INT32BIT *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            INT32BIT tnull,       /* I - value of FITS TNULLn keyword if any */\n            double nullval,       /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            double *output,       /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (double) input[ii]; /* copy input to output */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                output[ii] = input[ii] * scale + zero;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (double) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    output[ii] = input[ii] * scale + zero;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi8r8(LONGLONG *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            LONGLONG tnull,       /* I - value of FITS TNULLn keyword if any */\n            double nullval,       /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            double *output,       /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    ULONGLONG ulltemp;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of adding 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n                output[ii] = (double) ulltemp;\n            }\n        }\n        else if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n\t    {\n                output[ii] = (double) input[ii]; /* copy input to output */\n            }  \n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                output[ii] = input[ii] * scale + zero;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of subtracting 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n\t\t{\n                    ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n                    output[ii] = (double) ulltemp;\n                }\n            }\n        }\n        else if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (double) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    output[ii] = input[ii] * scale + zero;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr4r8(float *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            double nullval,       /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            double *output,       /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (double) input[ii]; /* copy input to output */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                output[ii] = input[ii] * scale + zero;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr++;       /* point to MSBs */\n#endif\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                output[ii] = (double) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = zero;\n              }\n              else\n                  output[ii] = input[ii] * scale + zero;\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr8r8(double *input,        /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            double nullval,       /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            double *output,       /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            memmove(output, input, ntodo * sizeof(double) );\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                output[ii] = input[ii] * scale + zero;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr += 3;       /* point to MSBs */\n#endif\n\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                    {\n                        nullarray[ii] = 1;\n                       /* explicitly set value in case output contains a NaN */\n                        output[ii] = DOUBLENULLVALUE;\n                    }\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                  output[ii] = input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                    {\n                        nullarray[ii] = 1;\n                       /* explicitly set value in case output contains a NaN */\n                        output[ii] = DOUBLENULLVALUE;\n                    }\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = zero;\n              }\n              else\n                  output[ii] = input[ii] * scale + zero;\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffstrr8(char *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            long twidth,          /* I - width of each substring of chars    */\n            double implipower,    /* I - power of 10 of implied decimal      */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            char  *snull,         /* I - value of FITS null string, if any   */\n            double nullval,       /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            double *output,       /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file. Check\n  for null values and do scaling if required. The nullcheck code value\n  determines how any null values in the input array are treated. A null\n  value is an input pixel that is equal to snull.  If nullcheck= 0, then\n  no special checking for nulls is performed.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    int nullen;\n    long ii;\n    double dvalue;\n    char *cstring, message[FLEN_ERRMSG];\n    char *cptr, *tpos;\n    char tempstore, chrzero = '0';\n    double val, power;\n    int exponent, sign, esign, decpt;\n\n    nullen = strlen(snull);\n    cptr = input;  /* pointer to start of input string */\n    for (ii = 0; ii < ntodo; ii++)\n    {\n      cstring = cptr;\n      /* temporarily insert a null terminator at end of the string */\n      tpos = cptr + twidth;\n      tempstore = *tpos;\n      *tpos = 0;\n\n      /* check if null value is defined, and if the    */\n      /* column string is identical to the null string */\n      if (snull[0] != ASCII_NULL_UNDEFINED && \n         !strncmp(snull, cptr, nullen) )\n      {\n        if (nullcheck)  \n        {\n          *anynull = 1;    \n          if (nullcheck == 1)\n            output[ii] = nullval;\n          else\n            nullarray[ii] = 1;\n        }\n        cptr += twidth;\n      }\n      else\n      {\n        /* value is not the null value, so decode it */\n        /* remove any embedded blank characters from the string */\n\n        decpt = 0;\n        sign = 1;\n        val  = 0.;\n        power = 1.;\n        exponent = 0;\n        esign = 1;\n\n        while (*cptr == ' ')               /* skip leading blanks */\n           cptr++;\n\n        if (*cptr == '-' || *cptr == '+')  /* check for leading sign */\n        {\n          if (*cptr == '-')\n             sign = -1;\n\n          cptr++;\n\n          while (*cptr == ' ')         /* skip blanks between sign and value */\n            cptr++;\n        }\n\n        while (*cptr >= '0' && *cptr <= '9')\n        {\n          val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n          cptr++;\n\n          while (*cptr == ' ')         /* skip embedded blanks in the value */\n            cptr++;\n        }\n\n        if (*cptr == '.' || *cptr == ',')              /* check for decimal point */\n        {\n          decpt = 1;       /* set flag to show there was a decimal point */\n          cptr++;\n          while (*cptr == ' ')         /* skip any blanks */\n            cptr++;\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n            power = power * 10.;\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks in the value */\n              cptr++;\n          }\n        }\n\n        if (*cptr == 'E' || *cptr == 'D')  /* check for exponent */\n        {\n          cptr++;\n          while (*cptr == ' ')         /* skip blanks */\n              cptr++;\n  \n          if (*cptr == '-' || *cptr == '+')  /* check for exponent sign */\n          {\n            if (*cptr == '-')\n               esign = -1;\n\n            cptr++;\n\n            while (*cptr == ' ')        /* skip blanks between sign and exp */\n              cptr++;\n          }\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            exponent = exponent * 10 + *cptr - chrzero;  /* accumulate exp */\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks */\n              cptr++;\n          }\n        }\n\n        if (*cptr  != 0)  /* should end up at the null terminator */\n        {\n          snprintf(message, FLEN_ERRMSG,\"Cannot read number from ASCII table\");\n          ffpmsg(message);\n          snprintf(message,FLEN_ERRMSG, \"Column field = %s.\", cstring);\n          ffpmsg(message);\n          /* restore the char that was overwritten by the null */\n          *tpos = tempstore;\n          return(*status = BAD_C2D);\n        }\n\n        if (!decpt)  /* if no explicit decimal, use implied */\n           power = implipower;\n\n        dvalue = (sign * val / power) * pow(10., (double) (esign * exponent));\n\n        output[ii] = (dvalue * scale + zero);   /* apply the scaling */\n      }\n      /* restore the char that was overwritten by the null */\n      *tpos = tempstore;\n    }\n    return(*status);\n}\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":41,"id":16659,"name":"pixel","nodeType":"Attribute","startLoc":41,"text":"self.pixel"},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":16660,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"id":16661,"name":"putcole.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, putcole.c, contains routines that write data elements to    */\n/*  a FITS image or table, with float datatype.                            */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <limits.h>\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffppre( fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG nelem,     /* I - number of values to write               */\n            float *array,    /* I - array of values that are written        */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n\n  This routine cannot be called directly by users to write to large\n  arrays with > 2**31 pixels (although CFITSIO can do so by passing\n  the firstelem thru a LONGLONG sized global variable)\n*/\n{\n    long row;\n    float nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_pixels(fptr, TFLOAT, firstelem, nelem,\n            0, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcle(fptr, 2, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffppne( fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG nelem,     /* I - number of values to write               */\n            float *array,    /* I - array of values that are written        */\n            float nulval,    /* I - undefined pixel value                   */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).  Any array values\n  that are equal to the value of nulval will be replaced with the null\n  pixel value that is appropriate for this column.\n\n  This routine cannot be called directly by users to write to large\n  arrays with > 2**31 pixels (although CFITSIO can do so by passing\n  the firstelem thru a LONGLONG sized global variable)\n*/\n{\n    long row;\n    float nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        nullvalue = nulval;  /* set local variable */\n        fits_write_compressed_pixels(fptr, TFLOAT, firstelem, nelem,\n            1, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcne(fptr, 2, row, firstelem, nelem, array, nulval, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp2de(fitsfile *fptr,   /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           float *array,     /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n\n  This routine does not support writing to large images with\n  more than 2**31 pixels.\n*/\n{\n    /* call the 3D writing routine, with the 3rd dimension = 1 */\n\n    ffp3de(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp3de(fitsfile *fptr,   /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  nrows,      /* I - number of rows in each plane of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           LONGLONG  naxis3,     /* I - FITS image NAXIS3 value               */\n           float *array,     /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 3-D cube of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n\n  This routine does not support writing to large images with\n  more than 2**31 pixels.\n*/\n{\n    long tablerow, ii, jj;\n    long fpixel[3]= {1,1,1}, lpixel[3];\n    LONGLONG nfits, narray;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n           \n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n        lpixel[0] = (long) ncols;\n        lpixel[1] = (long) nrows;\n        lpixel[2] = (long) naxis3;\n       \n        fits_write_compressed_img(fptr, TFLOAT, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n      /* all the image pixels are contiguous, so write all at once */\n      ffpcle(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status);\n      return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to write to */\n    narray = 0;  /* next pixel in input array to be written */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* writing naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffpcle(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0)\n         return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpsse(fitsfile *fptr,   /* I - FITS file pointer                       */\n           long  group,      /* I - group to write(1 = 1st group)           */\n           long  naxis,      /* I - number of data axes in array            */\n           long  *naxes,     /* I - size of each FITS axis                  */\n           long  *fpixel,    /* I - 1st pixel in each axis to write (1=1st) */\n           long  *lpixel,    /* I - last pixel in each axis to write        */\n           float *array,     /* I - array to be written                     */\n           int  *status)     /* IO - error status                           */\n/*\n  Write a subsection of pixels to the primary array or image.\n  A subsection is defined to be any contiguous rectangular\n  array of pixels within the n-dimensional FITS data file.\n  Data conversion and scaling will be performed if necessary \n  (e.g, if the datatype of the FITS array is not the same as\n  the array being written).\n*/\n{\n    long tablerow;\n    LONGLONG fpix[7], dimen[7], astart, pstart;\n    LONGLONG off2, off3, off4, off5, off6, off7;\n    LONGLONG st10, st20, st30, st40, st50, st60, st70;\n    LONGLONG st1, st2, st3, st4, st5, st6, st7;\n    long ii, i1, i2, i3, i4, i5, i6, i7, irange[7];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_img(fptr, TFLOAT, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    if (naxis < 1 || naxis > 7)\n      return(*status = BAD_DIMEN);\n\n    tablerow=maxvalue(1,group);\n\n     /* calculate the size and number of loops to perform in each dimension */\n    for (ii = 0; ii < 7; ii++)\n    {\n      fpix[ii]=1;\n      irange[ii]=1;\n      dimen[ii]=1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {    \n      fpix[ii]=fpixel[ii];\n      irange[ii]=lpixel[ii]-fpixel[ii]+1;\n      dimen[ii]=naxes[ii];\n    }\n\n    i1=irange[0];\n\n    /* compute the pixel offset between each dimension */\n    off2 =     dimen[0];\n    off3 = off2 * dimen[1];\n    off4 = off3 * dimen[2];\n    off5 = off4 * dimen[3];\n    off6 = off5 * dimen[4];\n    off7 = off6 * dimen[5];\n\n    st10 = fpix[0];\n    st20 = (fpix[1] - 1) * off2;\n    st30 = (fpix[2] - 1) * off3;\n    st40 = (fpix[3] - 1) * off4;\n    st50 = (fpix[4] - 1) * off5;\n    st60 = (fpix[5] - 1) * off6;\n    st70 = (fpix[6] - 1) * off7;\n\n    /* store the initial offset in each dimension */\n    st1 = st10;\n    st2 = st20;\n    st3 = st30;\n    st4 = st40;\n    st5 = st50;\n    st6 = st60;\n    st7 = st70;\n\n    astart = 0;\n\n    for (i7 = 0; i7 < irange[6]; i7++)\n    {\n     for (i6 = 0; i6 < irange[5]; i6++)\n     {\n      for (i5 = 0; i5 < irange[4]; i5++)\n      {\n       for (i4 = 0; i4 < irange[3]; i4++)\n       {\n        for (i3 = 0; i3 < irange[2]; i3++)\n        {\n         pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7;\n\n         for (i2 = 0; i2 < irange[1]; i2++)\n         {\n           if (ffpcle(fptr, 2, tablerow, pstart, i1, &array[astart],\n              status) > 0)\n              return(*status);\n\n           astart += i1;\n           pstart += off2;\n         }\n         st2 = st20;\n         st3 = st3+off3;    \n        }\n        st3 = st30;\n        st4 = st4+off4;\n       }\n       st4 = st40;\n       st5 = st5+off5;\n      }\n      st5 = st50;\n      st6 = st6+off6;\n     }\n     st6 = st60;\n     st7 = st7+off7;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpgpe( fitsfile *fptr,   /* I - FITS file pointer                      */\n            long  group,      /* I - group to write(1 = 1st group)          */\n            long  firstelem,  /* I - first vector element to write(1 = 1st) */\n            long  nelem,      /* I - number of values to write              */\n            float *array,     /* I - array of values that are written       */\n            int  *status)     /* IO - error status                          */\n/*\n  Write an array of group parameters to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffpcle(fptr, 1L, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcle( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            float *array,    /* I - array of values to write                */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer to a virtual column in a 1 or more grouped FITS primary\n  array.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    int tcode, maxelem2, hdutype, writeraw;\n    long twidth, incre;\n    long ntodo;\n    LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull, maxelem;\n    double scale, zero;\n    char tform[20], cform[20];\n    char message[FLEN_ERRMSG];\n\n    char snull[20];   /*  the FITS null value  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem2, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n    maxelem = maxelem2;\n\n    if (tcode == TSTRING)   \n         ffcfmt(tform, cform);     /* derive C format for writing strings */\n\n    /*\n       if there is no scaling and the native machine format is not byteswapped\n       then we can simply write the raw data bytes into the FITS file if the\n       datatype of the FITS column is the same as the input values.  Otherwise,\n       we must convert the raw values into the scaled and/or machine dependent\n       format in a temporary buffer that has been allocated for this purpose.\n    */\n    if (scale == 1. && zero == 0. && \n       MACHINE == NATIVE && tcode == TFLOAT)\n    {\n        writeraw = 1;\n        if (nelem < (LONGLONG)INT32_MAX) {\n            maxelem = nelem;\n        } else {\n            maxelem = INT32_MAX/4;\n        }\n     }\n    else\n        writeraw = 0;\n\n    /*---------------------------------------------------------------------*/\n    /*  Now write the pixels to the FITS column.                           */\n    /*  First call the ffXXfYY routine to  (1) convert the datatype        */\n    /*  if necessary, and (2) scale the values by the FITS TSCALn and      */\n    /*  TZEROn linear scaling parameters into a temporary buffer.          */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to write  */\n    next = 0;                 /* next element in array to be written  */\n    rownum = 0;               /* row number, relative to firstrow     */\n\n    while (remain)\n    {\n        /* limit the number of pixels to process a one time to the number that\n           will fit in the buffer space or to the number of pixels that remain\n           in the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);      \n        ntodo = (long) minvalue(ntodo, (repeat - elemnum));\n\n        wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre);\n\n        ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */\n\n        switch (tcode) \n        {\n            case (TFLOAT):\n              if (writeraw)\n              {\n                /* write raw input bytes without conversion */\n                ffpr4b(fptr, ntodo, incre, &array[next], status);\n              }\n              else\n              {\n                /* convert the raw data before writing to FITS file */\n                ffr4fr4(&array[next], ntodo, scale, zero,\n                        (float *) buffer, status);\n                ffpr4b(fptr, ntodo, incre, (float *) buffer, status);\n              }\n\n              break;\n\n            case (TLONGLONG):\n\n                ffr4fi8(&array[next], ntodo, scale, zero,\n                        (LONGLONG *) buffer, status);\n                ffpi8b(fptr, ntodo, incre, (long *) buffer, status);\n                break;\n\n            case (TBYTE):\n \n                ffr4fi1(&array[next], ntodo, scale, zero, \n                        (unsigned char *) buffer, status);\n                ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status);\n                break;\n\n            case (TSHORT):\n\n                ffr4fi2(&array[next], ntodo, scale, zero,\n                        (short *) buffer, status);\n                ffpi2b(fptr, ntodo, incre, (short *) buffer, status);\n                break;\n\n            case (TLONG):\n\n                ffr4fi4(&array[next], ntodo, scale, zero,\n                        (INT32BIT *) buffer, status);\n                ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status);\n                break;\n\n            case (TDOUBLE):\n                ffr4fr8(&array[next], ntodo, scale, zero,\n                       (double *) buffer, status);\n                ffpr8b(fptr, ntodo, incre, (double *) buffer, status);\n                break;\n\n            case (TSTRING):  /* numerical column in an ASCII table */\n\n                if (cform[1] != 's')  /*  \"%s\" format is a string */\n                {\n                  ffr4fstr(&array[next], ntodo, scale, zero, cform,\n                          twidth, (char *) buffer, status);\n\n                  if (incre == twidth)    /* contiguous bytes */\n                     ffpbyt(fptr, ntodo * twidth, buffer, status);\n                  else\n                     ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                            status);\n\n                  break;\n                }\n                /* can't write to string column, so fall thru to default: */\n\n            default:  /*  error trap  */\n                snprintf(message, FLEN_ERRMSG, \n                       \"Cannot write numbers to column %d which has format %s\",\n                        colnum,tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous write operation */\n        {\n          snprintf(message,FLEN_ERRMSG,\n          \"Error writing elements %.0f thru %.0f of input data array (ffpcle).\",\n             (double) (next+1), (double) (next+ntodo));\n         ffpmsg(message);\n         return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum += ntodo;\n            if (elemnum == repeat)  /* completed a row; start on next row */\n            {\n                elemnum = 0;\n                rownum++;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while writing FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpclc( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            float *array,    /* I - array of values to write                */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of complex values to a column in the current FITS HDU.\n  Each complex number if interpreted as a pair of float values.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer to a virtual column in a 1 or more grouped FITS primary\n  array.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The input array of values will be converted to the datatype of the column\n  if necessary, but normally complex values should only be written to a binary\n  table with TFORMn = 'rC' where r is an optional repeat count. The TSCALn and\n  TZERO keywords should not be used with complex numbers because mathmatically\n  the scaling should only be applied to the real (first) component of the\n  complex value.\n*/\n{\n    /* simply multiply the number of elements by 2, and call ffpcle */\n\n    ffpcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1,\n            nelem * 2, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcne( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            float *array,    /* I - array of values to write                */\n            float  nulvalue, /* I - value used to flag undefined pixels     */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of elements to the specified column of a table.  Any input\n  pixels equal to the value of nulvalue will be replaced by the appropriate\n  null value in the output FITS file. \n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary\n*/\n{\n    tcolumn *colptr;\n    LONGLONG  ngood = 0, nbad = 0, ii;\n    LONGLONG repeat, first, fstelm, fstrow;\n    int tcode, overflow = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n    }\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n\n    tcode  = colptr->tdatatype;\n\n    if (tcode > 0)\n       repeat = colptr->trepeat;  /* repeat count for this column */\n    else\n       repeat = firstelem -1 + nelem;  /* variable length arrays */\n\n    if (abs(tcode) >= TCOMPLEX)\n    { /* treat complex columns as pairs of numbers */\n        repeat *= 2;\n    }\n    \n    /* if variable length array, first write the whole input vector, \n       then go back and fill in the nulls */\n    if (tcode < 0) {\n      if (ffpcle(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) {\n        if (*status == NUM_OVERFLOW) \n\t{\n\t  /* ignore overflows, which are possibly the null pixel values */\n\t  /*  overflow = 1;   */\n\t  *status = 0;\n\t} else { \n          return(*status);\n\t}\n      }\n    }\n\n    /* absolute element number in the column */\n    first = (firstrow - 1) * repeat + firstelem;\n\n    for (ii = 0; ii < nelem; ii++)\n    {\n      if (array[ii] != nulvalue)  /* is this a good pixel? */\n      {\n         if (nbad)  /* write previous string of bad pixels */\n         {\n            fstelm = ii - nbad + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            /* call ffpcluc, not ffpclu, in case we are writing to a\n\t       complex ('C') binary table column */\n            if (ffpcluc(fptr, colnum, fstrow, fstelm, nbad, status) > 0)\n                return(*status);\n\n            nbad=0;\n         }\n\n         ngood = ngood +1;  /* the consecutive number of good pixels */\n      }\n      else\n      {\n         if (ngood)  /* write previous string of good pixels */\n         {\n            fstelm = ii - ngood + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (tcode > 0) {  /* variable length arrays have already been written */\n              if (ffpcle(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood],\n                status) > 0) {\n\t\tif (*status == NUM_OVERFLOW) \n\t\t{\n\t\t  overflow = 1;\n\t\t  *status = 0;\n\t\t} else { \n                  return(*status);\n\t\t}\n              }\n\t    }\n            ngood=0;\n         }\n\n         nbad = nbad +1;  /* the consecutive number of bad pixels */\n      }\n    }\n\n    /* finished loop;  now just write the last set of pixels */\n\n    if (ngood)  /* write last string of good pixels */\n    {\n      fstelm = ii - ngood + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      if (tcode > 0) {  /* variable length arrays have already been written */\n        ffpcle(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status);\n      }\n    }\n    else if (nbad) /* write last string of bad pixels */\n    {\n      fstelm = ii - nbad + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n      ffpcluc(fptr, colnum, fstrow, fstelm, nbad, status);\n    }\n    \n    if (*status <= 0) {\n      if (overflow) {\n        *status = NUM_OVERFLOW;\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffr4fi1(float *input,          /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            unsigned char *output, /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] < DUCHAR_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (input[ii] > DUCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DUCHAR_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (dvalue > DUCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) (dvalue + .5);\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffr4fi2(float *input,      /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            short *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {           \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] < DSHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MIN;\n            }\n            else if (input[ii] > DSHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n                output[ii] = (short) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DSHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MIN;\n            }\n            else if (dvalue > DSHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (short) (dvalue + .5);\n                else\n                    output[ii] = (short) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffr4fi4(float *input,      /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            INT32BIT *output,  /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MIN;\n            }\n            else if (input[ii] > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n                output[ii] = (INT32BIT) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (INT32BIT) (dvalue + .5);\n                else\n                    output[ii] = (INT32BIT) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffr4fi8(float *input,      /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            LONGLONG *output,  /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero ==  9223372036854775808.)\n    {       \n        /* Writing to unsigned long long column. Input values must not be negative */\n        /* Instead of subtracting 9223372036854775808, it is more efficient */\n        /* and more precise to just flip the sign bit with the XOR operator */\n\n        for (ii = 0; ii < ntodo; ii++) {\n            if (input[ii] < -0.49) {\n              *status = OVERFLOW_ERR;\n              output[ii] = LONGLONG_MIN;\n            }\n\t    else if (input[ii] > 2.* DLONGLONG_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MAX;\n            } else {\n              output[ii] =  ((LONGLONG) input[ii]) ^ 0x8000000000000000;\n            }\n        }\n    }\n    else if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] < DLONGLONG_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MIN;\n            }\n            else if (input[ii] > DLONGLONG_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MAX;\n            }\n            else\n                output[ii] = (long) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DLONGLONG_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MIN;\n            }\n            else if (dvalue > DLONGLONG_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (LONGLONG) (dvalue + .5);\n                else\n                    output[ii] = (LONGLONG) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffr4fr4(float *input,      /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            float *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n      memcpy(output, input, ntodo * sizeof(float) ); /* copy input to output */\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (float) ((input[ii] - zero) / scale);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffr4fr8(float *input,      /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            double *output,    /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (double) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (input[ii] - zero) / scale;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffr4fstr(float *input,     /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            char *cform,       /* I - format for output string values  */\n            long twidth,       /* I - width of each field, in chars    */\n            char *output,      /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n    char *cptr;\n    \n    cptr = output;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n           sprintf(output, cform, (double) input[ii]);\n           output += twidth;\n\n           if (*output)  /* if this char != \\0, then overflow occurred */\n              *status = OVERFLOW_ERR;\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n          dvalue = (input[ii] - zero) / scale;\n          sprintf(output, cform, dvalue);\n          output += twidth;\n\n          if (*output)  /* if this char != \\0, then overflow occurred */\n            *status = OVERFLOW_ERR;\n        }\n    }\n\n    /* replace any commas with periods (e.g., in French locale) */\n    while ((cptr = strchr(cptr, ','))) *cptr = '.';\n    \n    return(*status);\n}\n"},{"id":16662,"name":"region.h","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/***************************************************************/\n/*                   REGION STUFF                              */\n/***************************************************************/\n\n#include \"fitsio.h\"\n#define myPI  3.1415926535897932385\n#define RadToDeg 180.0/myPI\n\ntypedef struct {\n   int    exists;\n   double xrefval, yrefval;\n   double xrefpix, yrefpix;\n   double xinc,    yinc;\n   double rot;\n   char   type[6];\n} WCSdata;\n\ntypedef enum {\n   point_rgn,\n   line_rgn,\n   circle_rgn,\n   annulus_rgn,\n   ellipse_rgn,\n   elliptannulus_rgn,\n   box_rgn,\n   boxannulus_rgn,\n   rectangle_rgn,\n   diamond_rgn,\n   sector_rgn,\n   poly_rgn,\n   panda_rgn,\n   epanda_rgn,\n   bpanda_rgn\n} shapeType;\n\ntypedef enum { pixel_fmt, degree_fmt, hhmmss_fmt } coordFmt;\n   \ntypedef struct {\n   char      sign;        /*  Include or exclude?        */\n   shapeType shape;       /*  Shape of this region       */\n   int       comp;        /*  Component number for this region */\n\n   double xmin,xmax;       /*  bounding box    */\n   double ymin,ymax;\n\n   union {                /*  Parameters - In pixels     */\n\n      /****   Generic Shape Data   ****/\n\n      struct {\n\t double p[11];       /*  Region parameters       */\n\t double sinT, cosT;  /*  For rotated shapes      */\n\t double a, b;        /*  Extra scratch area      */\n      } gen;\n\n      /****      Polygon Data      ****/\n\n      struct {\n         int    nPts;        /*  Number of Polygon pts   */\n         double *Pts;        /*  Polygon points          */\n      } poly;\n\n   } param;\n\n} RgnShape;\n\ntypedef struct {\n   int       nShapes;\n   RgnShape  *Shapes;\n   WCSdata   wcs;\n} SAORegion;\n\n/*  SAO region file routines */\nint  fits_read_rgnfile( const char *filename, WCSdata *wcs, SAORegion **Rgn, int *status );\nint  fits_in_region( double X, double Y, SAORegion *Rgn );\nvoid fits_free_region( SAORegion *Rgn );\nvoid fits_set_region_components ( SAORegion *Rgn );\nvoid fits_setup_shape ( RgnShape *shape);\nint fits_read_fits_region ( fitsfile *fptr, WCSdata * wcs, SAORegion **Rgn, int *status);\nint fits_read_ascii_region ( const char *filename, WCSdata * wcs, SAORegion **Rgn, int *status);\n\n\n"},{"id":16663,"name":"getcolui.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, getcolui.c, contains routines that read data elements from   */\n/*  a FITS image or table, with unsigned short datatype.                    */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <math.h>\n#include <stdlib.h>\n#include <limits.h>\n#include <string.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffgpvui( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n   unsigned short nulval,     /* I - value for undefined pixels              */\n   unsigned short *array,     /* O - array of values that are returned       */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Undefined elements will be set equal to NULVAL, unless NULVAL=0\n  in which case no checking for undefined values will be performed.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    char cdummy;\n    int nullcheck = 1;\n    unsigned short nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n         nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_pixels(fptr, TUSHORT, firstelem, nelem,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclui(fptr, 2, row, firstelem, nelem, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgpfui( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n   unsigned short *array,     /* O - array of values that are returned       */\n            char *nularray,   /* O - array of null pixel flags               */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Any undefined pixels in the returned array will be set = 0 and the \n  corresponding nularray value will be set = 1.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    int nullcheck = 2;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_read_compressed_pixels(fptr, TUSHORT, firstelem, nelem,\n            nullcheck, NULL, array, nularray, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclui(fptr, 2, row, firstelem, nelem, 1, 2, 0,\n               array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg2dui(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n  unsigned short nulval,    /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n  unsigned short *array,    /* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    /* call the 3D reading routine, with the 3rd dimension = 1 */\n\n    ffg3dui(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, \n           anynul, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg3dui(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n  unsigned short nulval,    /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  nrows,     /* I - number of rows in each plane of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           LONGLONG  naxis3,    /* I - FITS image NAXIS3 value                 */\n  unsigned short *array,    /* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 3-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    long tablerow, ii, jj;\n    char cdummy;\n    int nullcheck = 1;\n    long inc[] = {1,1,1};\n    LONGLONG fpixel[] = {1,1,1}, nfits, narray;\n    LONGLONG lpixel[3];\n    unsigned short nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        lpixel[0] = ncols;\n        lpixel[1] = nrows;\n        lpixel[2] = naxis3;\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TUSHORT, fpixel, lpixel, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n       /* all the image pixels are contiguous, so read all at once */\n       ffgclui(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n       return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to read */\n    narray = 0;  /* next pixel in output array to be filled */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* reading naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffgclui(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval,\n          &array[narray], &cdummy, anynul, status) > 0)\n          return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsvui(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n  unsigned short nulval,   /* I - value to set undefined pixels             */\n  unsigned short *array,   /* O - array to be filled and returned           */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9];\n    long nelem, nultyp, ninc, numcol;\n    LONGLONG felem, dsize[10], blcll[9], trcll[9];\n    int hdutype, anyf;\n    char ldummy, msg[FLEN_ERRMSG];\n    int nullcheck = 1;\n    unsigned short nullvalue;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvui is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TUSHORT, blcll, trcll, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 1;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        snprintf(msg, FLEN_ERRMSG,\"ffgsvui: illegal range specified for axis %ld\", ii + 1);\n        ffpmsg(msg);\n        return(*status = BAD_PIX_NUM);\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n    }\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0] - str[0]) / inc[0] + 1;\n      ninc = incr[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1])\n            {\n              felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + \n                             (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] +\n                             (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] +\n                             (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8];\n              if ( ffgclui(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &ldummy, &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsfui(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n  unsigned short *array,   /* O - array to be filled and returned           */\n           char *flagval,  /* O - set to 1 if corresponding value is null   */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dsize[10];\n    LONGLONG blcll[9], trcll[9];\n    long felem, nelem, nultyp, ninc, numcol;\n    int hdutype, anyf;\n    unsigned short nulval = 0;\n    char msg[FLEN_ERRMSG];\n    int nullcheck = 2;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvi is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        fits_read_compressed_img(fptr, TUSHORT, blcll, trcll, inc,\n            nullcheck, NULL, array, flagval, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 2;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        snprintf(msg, FLEN_ERRMSG,\"ffgsvi: illegal range specified for axis %ld\", ii + 1);\n        ffpmsg(msg);\n        return(*status = BAD_PIX_NUM);\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n    }\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0] - str[0]) / inc[0] + 1;\n      ninc = incr[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1])\n            {\n              felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + \n                             (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] +\n                             (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] +\n                             (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8];\n\n              if ( ffgclui(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &flagval[i0], &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffggpui( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            long  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            long  nelem,      /* I - number of values to read                */\n   unsigned short *array,     /* O - array of values that are returned       */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of group parameters from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n*/\n{\n    long row;\n    int idummy;\n    char cdummy;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclui(fptr, 1, row, firstelem, nelem, 1, 1, 0,\n               array, &cdummy, &idummy, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcvui(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n  unsigned short nulval,     /* I - value for null pixels                   */\n  unsigned short *array,     /* O - array of values that are read           */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Any undefined pixels will be set equal to the value of 'nulval' unless\n  nulval = 0 in which case no checks for undefined pixels will be made.\n*/\n{\n    char cdummy;\n\n    ffgclui(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval,\n           array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcfui(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n  unsigned short *array,     /* O - array of values that are read           */\n           char *nularray,   /* O - array of flags: 1 if null pixel; else 0 */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Nularray will be set = 1 if the corresponding array pixel is undefined, \n  otherwise nularray will = 0.\n*/\n{\n    unsigned short dummy = 0;\n\n    ffgclui(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy,\n           array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgclui( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            long  elemincre,  /* I - pixel increment; e.g., 2 = every other  */\n            int   nultyp,     /* I - null value handling code:               */\n                              /*     1: set undefined pixels = nulval        */\n                              /*     2: set nularray=1 for undefined pixels  */\n   unsigned short nulval,     /* I - value for null pixels if nultyp = 1     */\n   unsigned short *array,     /* O - array of values that are read           */\n            char *nularray,   /* O - array of flags = 1 if nultyp = 2        */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer be a virtual column in a 1 or more grouped FITS primary\n  array or image extension.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The output array of values will be converted from the datatype of the column \n  and will be scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    double scale, zero, power = 1., dtemp;\n    int tcode, maxelem2, hdutype, xcode, decimals;\n    long twidth, incre;\n    long ii, xwidth, ntodo;\n    int nulcheck;\n    LONGLONG repeat, startpos, elemnum, readptr, tnull;\n    LONGLONG rowlen, rownum, remain, next, rowincre, maxelem;\n    char tform[20];\n    char message[FLEN_ERRMSG];\n    char snull[20];   /*  the FITS null value if reading from ASCII table  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0 || nelem == 0)  /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    if (anynul)\n        *anynul = 0;\n\n    if (nultyp == 2)\n        memset(nularray, 0, (size_t) nelem);   /* initialize nullarray */\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if ( ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 0, &scale, &zero,\n         tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre,\n         &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 )\n         return(*status);\n    maxelem = maxelem2;\n\n    incre *= elemincre;   /* multiply incre to just get every nth pixel */\n\n    if (tcode == TSTRING)    /* setup for ASCII tables */\n    {\n      /* get the number of implied decimal places if no explicit decmal point */\n      ffasfm(tform, &xcode, &xwidth, &decimals, status); \n      for(ii = 0; ii < decimals; ii++)\n        power *= 10.;\n    }\n    /*------------------------------------------------------------------*/\n    /*  Decide whether to check for null values in the input FITS file: */\n    /*------------------------------------------------------------------*/\n    nulcheck = nultyp; /* by default check for null values in the FITS file */\n\n    if (nultyp == 1 && nulval == 0)\n       nulcheck = 0;    /* calling routine does not want to check for nulls */\n\n    else if (tcode%10 == 1 &&        /* if reading an integer column, and  */ \n            tnull == NULL_UNDEFINED) /* if a null value is not defined,    */\n            nulcheck = 0;            /* then do not check for null values. */\n\n    else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TBYTE && (tnull > 255 || tnull < 0) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED)\n         nulcheck = 0;\n\n    /*----------------------------------------------------------------------*/\n    /*  If FITS column and output data array have same datatype, then we do */\n    /*  not need to use a temporary buffer to store intermediate datatype.  */\n    /*----------------------------------------------------------------------*/\n    if (tcode == TSHORT) /* Special Case:                        */\n    {                             /* no type convertion required, so read */\n                                  /* data directly into output buffer.    */\n\n        if (nelem < (LONGLONG)INT32_MAX/2) {\n            maxelem = nelem;\n        } else {\n            maxelem = INT32_MAX/2;\n        }\n    }\n\n    /*---------------------------------------------------------------------*/\n    /*  Now read the pixels from the FITS column. If the column does not   */\n    /*  have the same datatype as the output array, then we have to read   */\n    /*  the raw values into a temporary buffer (of limited size).  In      */\n    /*  the case of a vector colum read only 1 vector of values at a time  */\n    /*  then skip to the next row if more values need to be read.          */\n    /*  After reading the raw values, then call the fffXXYY routine to (1) */\n    /*  test for undefined values, (2) convert the datatype if necessary,  */\n    /*  and (3) scale the values by the FITS TSCALn and TZEROn linear      */\n    /*  scaling parameters.                                                */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to read */\n    next = 0;                 /* next element in array to be read   */\n    rownum = 0;               /* row number, relative to firstrow   */\n\n    while (remain)\n    {\n        /* limit the number of pixels to read at one time to the number that\n           will fit in the buffer or to the number of pixels that remain in\n           the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);      \n        ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1));\n\n        readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre));\n\n        switch (tcode) \n        {\n            case (TSHORT):\n                ffgi2b(fptr, readptr, ntodo, incre,\n                       (short *) &array[next], status);\n                fffi2u2((short *) &array[next], ntodo, scale,\n                       zero, nulcheck, (short) tnull, nulval, &nularray[next],\n                       anynul, &array[next], status);\n                break;\n            case (TLONGLONG):\n\n                ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status);\n                fffi8u2( (LONGLONG *) buffer, ntodo, scale, zero, \n                           nulcheck, tnull, nulval, &nularray[next], \n                            anynul, &array[next], status);\n                break;\n            case (TBYTE):\n                ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer,\n                      status);\n                fffi1u2((unsigned char *) buffer, ntodo, scale, zero, nulcheck, \n                    (unsigned char) tnull, nulval, &nularray[next], anynul, \n                    &array[next], status);\n                break;\n            case (TLONG):\n                ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) buffer,\n                       status);\n                fffi4u2((INT32BIT *) buffer, ntodo, scale, zero, nulcheck, \n                       (INT32BIT) tnull, nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TFLOAT):\n                ffgr4b(fptr, readptr, ntodo, incre, (float  *) buffer, status);\n                fffr4u2((float  *) buffer, ntodo, scale, zero, nulcheck, \n                       nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TDOUBLE):\n                ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status);\n                fffr8u2((double *) buffer, ntodo, scale, zero, nulcheck, \n                          nulval, &nularray[next], anynul, \n                          &array[next], status);\n                break;\n            case (TSTRING):\n                ffmbyt(fptr, readptr, REPORT_EOF, status);\n       \n                if (incre == twidth)    /* contiguous bytes */\n                     ffgbyt(fptr, ntodo * twidth, buffer, status);\n                else\n                     ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                               status);\n\n                fffstru2((char *) buffer, ntodo, scale, zero, twidth, power,\n                     nulcheck, snull, nulval, &nularray[next], anynul,\n                     &array[next], status);\n                break;\n\n            default:  /*  error trap for invalid column format */\n                snprintf(message, FLEN_ERRMSG, \n                   \"Cannot read numbers from column %d which has format %s\",\n                    colnum, tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous read operation */\n        {\n\t  dtemp = (double) next;\n          if (hdutype > 0)\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgclui).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from image (ffgclui).\",\n              dtemp+1., dtemp+ntodo);\n\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum = elemnum + (ntodo * elemincre);\n\n            if (elemnum >= repeat)  /* completed a row; start on later row */\n            {\n                rowincre = elemnum / repeat;\n                rownum += rowincre;\n                elemnum = elemnum - (rowincre * repeat);\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while reading FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi1u2(unsigned char *input, /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char tnull,  /* I - value of FITS TNULLn keyword if any */\n   unsigned short nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned short *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (unsigned short) input[ii]; /* copy input */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUSHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUSHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = USHRT_MAX;\n                }\n                else\n                    output[ii] = (unsigned short) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (unsigned short) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = USHRT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned short) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi2u2(short *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short tnull,          /* I - value of FITS TNULLn keyword if any */\n   unsigned short nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned short *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 32768.) \n        {       \n           /* Instead of adding 32768, it is more efficient */\n           /* to just flip the sign bit with the XOR operator */\n\n           for (ii = 0; ii < ntodo; ii++)\n              output[ii] =  ( *(unsigned short *) &input[ii] ) ^ 0x8000;\n        }\n        else if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else\n                    output[ii] = (unsigned short) input[ii]; /* copy input */\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUSHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUSHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = USHRT_MAX;\n                }\n                else\n                    output[ii] = (unsigned short) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 32768.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] =  ( *(unsigned short *) &input[ii] ) ^ 0x8000;\n            }\n        }\n        else if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else if (input[ii] < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else\n                    output[ii] = (unsigned short) input[ii]; /* copy input */\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = USHRT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned short) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi4u2(INT32BIT *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            INT32BIT tnull,       /* I - value of FITS TNULLn keyword if any */\n   unsigned short nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned short *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (input[ii] > USHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = USHRT_MAX;\n                }\n                else\n                    output[ii] = (unsigned short) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUSHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUSHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = USHRT_MAX;\n                }\n                else\n                    output[ii] = (unsigned short) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    if (input[ii] < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (input[ii] > USHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = USHRT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned short) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = USHRT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned short) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi8u2(LONGLONG *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            LONGLONG tnull,       /* I - value of FITS TNULLn keyword if any */\n   unsigned short nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned short *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    ULONGLONG ulltemp;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of adding 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                if (ulltemp > USHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = USHRT_MAX;\n                }\n                else\n                    output[ii] = (unsigned short) ulltemp;\n\n            }\n        }\n        else if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (input[ii] > USHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = USHRT_MAX;\n                }\n                else\n                    output[ii] = (unsigned short) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUSHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUSHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = USHRT_MAX;\n                }\n                else\n                    output[ii] = (unsigned short) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of adding 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                    if (ulltemp > USHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = USHRT_MAX;\n                    }\n                    else\n\t\t    {\n                        output[ii] = (unsigned short) ulltemp;\n\t\t    }\n                }\n            }\n        }\n        else if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    if (input[ii] < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (input[ii] > USHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = USHRT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned short) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = USHRT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned short) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr4u2(float *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n   unsigned short nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned short *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DUSHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (input[ii] > DUSHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = USHRT_MAX;\n                }\n                else\n                    output[ii] = (unsigned short) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUSHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUSHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = USHRT_MAX;\n                }\n                else\n                    output[ii] = (unsigned short) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr++;       /* point to MSBs */\n#endif\n\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )   /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DUSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (input[ii] > DUSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = USHRT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned short) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  { \n                    if (zero < DUSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (zero > DUSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = USHRT_MAX;\n                    }\n                    else\n                      output[ii] = (unsigned short) zero;\n                  }\n              }\n              else\n              {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = USHRT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned short) dvalue;\n              }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr8u2(double *input,        /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n   unsigned short nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned short *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DUSHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (input[ii] > DUSHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = USHRT_MAX;\n                }\n                else\n                    output[ii] = (unsigned short) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUSHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUSHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = USHRT_MAX;\n                }\n                else\n                    output[ii] = (unsigned short) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr += 3;       /* point to MSBs */\n#endif\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DUSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (input[ii] > DUSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = USHRT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned short) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  { \n                    if (zero < DUSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (zero > DUSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = USHRT_MAX;\n                    }\n                    else\n                      output[ii] = (unsigned short) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = USHRT_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned short) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffstru2(char *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            long twidth,          /* I - width of each substring of chars    */\n            double implipower,    /* I - power of 10 of implied decimal      */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            char  *snull,         /* I - value of FITS null string, if any   */\n   unsigned short nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned short *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file. Check\n  for null values and do scaling if required. The nullcheck code value\n  determines how any null values in the input array are treated. A null\n  value is an input pixel that is equal to snull.  If nullcheck= 0, then\n  no special checking for nulls is performed.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    int nullen;\n    long ii;\n    double dvalue;\n    char *cstring, message[FLEN_ERRMSG];\n    char *cptr, *tpos;\n    char tempstore, chrzero = '0';\n    double val, power;\n    int exponent, sign, esign, decpt;\n\n    nullen = strlen(snull);\n    cptr = input;  /* pointer to start of input string */\n    for (ii = 0; ii < ntodo; ii++)\n    {\n      cstring = cptr;\n      /* temporarily insert a null terminator at end of the string */\n      tpos = cptr + twidth;\n      tempstore = *tpos;\n      *tpos = 0;\n\n      /* check if null value is defined, and if the    */\n      /* column string is identical to the null string */\n      if (snull[0] != ASCII_NULL_UNDEFINED && \n         !strncmp(snull, cptr, nullen) )\n      {\n        if (nullcheck)  \n        {\n          *anynull = 1;    \n          if (nullcheck == 1)\n            output[ii] = nullval;\n          else\n            nullarray[ii] = 1;\n        }\n        cptr += twidth;\n      }\n      else\n      {\n        /* value is not the null value, so decode it */\n        /* remove any embedded blank characters from the string */\n\n        decpt = 0;\n        sign = 1;\n        val  = 0.;\n        power = 1.;\n        exponent = 0;\n        esign = 1;\n\n        while (*cptr == ' ')               /* skip leading blanks */\n           cptr++;\n\n        if (*cptr == '-' || *cptr == '+')  /* check for leading sign */\n        {\n          if (*cptr == '-')\n             sign = -1;\n\n          cptr++;\n\n          while (*cptr == ' ')         /* skip blanks between sign and value */\n            cptr++;\n        }\n\n        while (*cptr >= '0' && *cptr <= '9')\n        {\n          val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n          cptr++;\n\n          while (*cptr == ' ')         /* skip embedded blanks in the value */\n            cptr++;\n        }\n\n        if (*cptr == '.' || *cptr == ',')       /* check for decimal point */\n        {\n          decpt = 1;       /* set flag to show there was a decimal point */\n          cptr++;\n          while (*cptr == ' ')         /* skip any blanks */\n            cptr++;\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n            power = power * 10.;\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks in the value */\n              cptr++;\n          }\n        }\n\n        if (*cptr == 'E' || *cptr == 'D')  /* check for exponent */\n        {\n          cptr++;\n          while (*cptr == ' ')         /* skip blanks */\n              cptr++;\n  \n          if (*cptr == '-' || *cptr == '+')  /* check for exponent sign */\n          {\n            if (*cptr == '-')\n               esign = -1;\n\n            cptr++;\n\n            while (*cptr == ' ')        /* skip blanks between sign and exp */\n              cptr++;\n          }\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            exponent = exponent * 10 + *cptr - chrzero;  /* accumulate exp */\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks */\n              cptr++;\n          }\n        }\n\n        if (*cptr  != 0)  /* should end up at the null terminator */\n        {\n          snprintf(message,FLEN_ERRMSG, \"Cannot read number from ASCII table\");\n          ffpmsg(message);\n          snprintf(message, FLEN_ERRMSG,\"Column field = %s.\", cstring);\n          ffpmsg(message);\n          /* restore the char that was overwritten by the null */\n          *tpos = tempstore;\n          return(*status = BAD_C2D);\n        }\n\n        if (!decpt)  /* if no explicit decimal, use implied */\n           power = implipower;\n\n        dvalue = (sign * val / power) * pow(10., (double) (esign * exponent));\n\n        dvalue = dvalue * scale + zero;   /* apply the scaling */\n\n        if (dvalue < DUSHRT_MIN)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = 0;\n        }\n        else if (dvalue > DUSHRT_MAX)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = USHRT_MAX;\n        }\n        else\n            output[ii] = (unsigned short) dvalue;\n      }\n      /* restore the char that was overwritten by the null */\n      *tpos = tempstore;\n    }\n    return(*status);\n}\n"},{"id":16664,"name":"zuncompress.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/* gzcompress.h -- definitions for the .Z decompression routine used in CFITSIO */\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\n#define get_char() get_byte()\n\n/* gzip.h -- common declarations for all gzip modules  */\n\n#define OF(args)  args\ntypedef void *voidp;\n\n#define memzero(s, n)     memset ((voidp)(s), 0, (n))\n\ntypedef unsigned char  uch;\ntypedef unsigned short ush;\ntypedef unsigned long  ulg;\n\n/* private version of MIN function */\n#define MINZIP(a,b) ((a) <= (b) ? (a) : (b))\n\n/* Return codes from gzip */\n#define OK      0\n#define ERROR   1\n#define COMPRESSED  1\n#define DEFLATED    8\n#define INBUFSIZ  0x8000    /* input buffer size */\n#define INBUF_EXTRA  64     /* required by unlzw() */\n#define OUTBUFSIZ  16384    /* output buffer size */\n#define OUTBUF_EXTRA 2048   /* required by unlzw() */\n#define DIST_BUFSIZE 0x8000 /* buffer for distances, see trees.c */\n#define WSIZE 0x8000        /* window size--must be a power of two, and */\n#define DECLARE(type, array, size)  type array[size]\n#define tab_suffix window\n#define tab_prefix prev    /* hash link (see deflate.c) */\n#define head (prev+WSIZE)  /* hash head (see deflate.c) */\n#define\tLZW_MAGIC      \"\\037\\235\" /* Magic header for lzw files, 1F 9D */\n#define get_byte()  (inptr < insize ? inbuf[inptr++] : fill_inbuf(0))\n\n/* Diagnostic functions */\n#  define Assert(cond,msg)\n#  define Trace(x)\n#  define Tracev(x)\n#  define Tracevv(x)\n#  define Tracec(c,x)\n#  define Tracecv(c,x)\n\n/* lzw.h -- define the lzw functions. */\n\n#ifndef BITS\n#  define BITS 16\n#endif\n#define INIT_BITS 9              /* Initial number of bits per code */\n#define BIT_MASK    0x1f /* Mask for 'number of compression bits' */\n#define BLOCK_MODE  0x80\n#define LZW_RESERVED 0x60 /* reserved bits */\n#define\tCLEAR  256       /* flush the dictionary */\n#define FIRST  (CLEAR+1) /* first free entry */\n\n/* prototypes */\n\n#define local static\nvoid ffpmsg(const char *err_message);\n\nlocal int  fill_inbuf    OF((int eof_ok));\nlocal void write_buf     OF((voidp buf, unsigned cnt));\nlocal void error         OF((char *m));\nlocal int unlzw  OF((FILE *in, FILE *out));\n\ntypedef int file_t;     /* Do not use stdio */\n\nint (*work) OF((FILE *infile, FILE *outfile)) = unlzw; /* function to call */\n\nlocal void error         OF((char *m));\n\n\t\t/* global buffers */\n\nstatic DECLARE(uch, inbuf,  INBUFSIZ +INBUF_EXTRA);\nstatic DECLARE(uch, outbuf, OUTBUFSIZ+OUTBUF_EXTRA);\nstatic DECLARE(ush, d_buf,  DIST_BUFSIZE);\nstatic DECLARE(uch, window, 2L*WSIZE);\n\n#ifndef MAXSEG_64K\n    static DECLARE(ush, tab_prefix, 1L<<BITS);\n#else\n    static DECLARE(ush, tab_prefix0, 1L<<(BITS-1));\n    static DECLARE(ush, tab_prefix1, 1L<<(BITS-1));\n#endif\n\n\t\t/* local variables */\n\n/* 11/25/98: added 'static' to local variable definitions, to avoid */\n/* conflict with external source files */\n\nstatic int maxbits = BITS;   /* max bits per code for LZW */\nstatic int method = DEFLATED;/* compression method */\nstatic int exit_code = OK;   /* program exit code */\nstatic int last_member;      /* set for .zip and .Z files */\nstatic long bytes_in;             /* number of input bytes */\nstatic long bytes_out;            /* number of output bytes */\nstatic char ifname[128];          /* input file name */\nstatic FILE *ifd;               /* input file descriptor */\nstatic FILE *ofd;               /* output file descriptor */\nstatic void **memptr;          /* memory location for uncompressed file */\nstatic size_t *memsize;        /* size (bytes) of memory allocated for file */\nvoid *(*realloc_fn)(void *p, size_t newsize);  /* reallocation function */\nstatic unsigned insize;     /* valid bytes in inbuf */\nstatic unsigned inptr;      /* index of next byte to be processed in inbuf */\n\n/* prototype for the following functions */\nint zuncompress2mem(char *filename, \n             FILE *diskfile, \n             char **buffptr, \n             size_t *buffsize, \n             void *(*mem_realloc)(void *p, size_t newsize),\n             size_t *filesize,\n             int *status);\n\n/*--------------------------------------------------------------------------*/\nint zuncompress2mem(char *filename,  /* name of input file                 */\n             FILE *indiskfile,     /* I - file pointer                        */\n             char **buffptr,   /* IO - memory pointer                     */\n             size_t *buffsize,   /* IO - size of buffer, in bytes           */\n             void *(*mem_realloc)(void *p, size_t newsize), /* function     */\n             size_t *filesize,   /* O - size of file, in bytes              */\n             int *status)        /* IO - error status                       */\n\n/*\n  Uncompress the file into memory.  Fill whatever amount of memory has\n  already been allocated, then realloc more memory, using the supplied\n  input function, if necessary.\n*/\n{\n    char magic[2]; /* magic header */\n\n    if (*status > 0)\n        return(*status);\n\n    /*  save input parameters into global variables */\n    ifname[0] = '\\0';\n    strncat(ifname, filename, 127);\n    ifd = indiskfile;\n    memptr = (void **) buffptr;\n    memsize = buffsize;\n    realloc_fn = mem_realloc;\n\n    /* clear input and output buffers */\n\n    insize = inptr = 0;\n    bytes_in = bytes_out = 0L;\n\n    magic[0] = (char)get_byte();\n    magic[1] = (char)get_byte();\n\n    if (memcmp(magic, LZW_MAGIC, 2) != 0) {\n      error(\"ERROR: input .Z file is in unrecognized compression format.\\n\");\n      return(-1);\n    }\n\n    work = unlzw;\n    method = COMPRESSED;\n    last_member = 1;\n\n    /* do the uncompression */\n    if ((*work)(ifd, ofd) != OK) {\n        method = -1; /* force cleanup */\n        *status = 414;    /* report some sort of decompression error */\n    }\n\n    if (filesize)  *filesize = bytes_out;\n\n    return(*status);\n}\n/*=========================================================================*/\n/*=========================================================================*/\n/* this marks the begining of the original file 'unlzw.c'                  */\n/*=========================================================================*/\n/*=========================================================================*/\n\n/* unlzw.c -- decompress files in LZW format.\n * The code in this file is directly derived from the public domain 'compress'\n * written by Spencer Thomas, Joe Orost, James Woods, Jim McKie, Steve Davies,\n * Ken Turkowski, Dave Mack and Peter Jannesen.\n */\n\ntypedef\tunsigned char\tchar_type;\ntypedef          long   code_int;\ntypedef unsigned long \tcount_int;\ntypedef unsigned short\tcount_short;\ntypedef unsigned long \tcmp_code_int;\n\n#define MAXCODE(n)\t(1L << (n))\n    \n#ifndef\tREGISTERS\n#\tdefine\tREGISTERS\t2\n#endif\n#define\tREG1\t\n#define\tREG2\t\n#define\tREG3\t\n#define\tREG4\t\n#define\tREG5\t\n#define\tREG6\t\n#define\tREG7\t\n#define\tREG8\t\n#define\tREG9\t\n#define\tREG10\n#define\tREG11\t\n#define\tREG12\t\n#define\tREG13\n#define\tREG14\n#define\tREG15\n#define\tREG16\n#if REGISTERS >= 1\n#\tundef\tREG1\n#\tdefine\tREG1\tregister\n#endif\n#if REGISTERS >= 2\n#\tundef\tREG2\n#\tdefine\tREG2\tregister\n#endif\n#if REGISTERS >= 3\n#\tundef\tREG3\n#\tdefine\tREG3\tregister\n#endif\n#if REGISTERS >= 4\n#\tundef\tREG4\n#\tdefine\tREG4\tregister\n#endif\n#if REGISTERS >= 5\n#\tundef\tREG5\n#\tdefine\tREG5\tregister\n#endif\n#if REGISTERS >= 6\n#\tundef\tREG6\n#\tdefine\tREG6\tregister\n#endif\n#if REGISTERS >= 7\n#\tundef\tREG7\n#\tdefine\tREG7\tregister\n#endif\n#if REGISTERS >= 8\n#\tundef\tREG8\n#\tdefine\tREG8\tregister\n#endif\n#if REGISTERS >= 9\n#\tundef\tREG9\n#\tdefine\tREG9\tregister\n#endif\n#if REGISTERS >= 10\n#\tundef\tREG10\n#\tdefine\tREG10\tregister\n#endif\n#if REGISTERS >= 11\n#\tundef\tREG11\n#\tdefine\tREG11\tregister\n#endif\n#if REGISTERS >= 12\n#\tundef\tREG12\n#\tdefine\tREG12\tregister\n#endif\n#if REGISTERS >= 13\n#\tundef\tREG13\n#\tdefine\tREG13\tregister\n#endif\n#if REGISTERS >= 14\n#\tundef\tREG14\n#\tdefine\tREG14\tregister\n#endif\n#if REGISTERS >= 15\n#\tundef\tREG15\n#\tdefine\tREG15\tregister\n#endif\n#if REGISTERS >= 16\n#\tundef\tREG16\n#\tdefine\tREG16\tregister\n#endif\n    \n#ifndef\tBYTEORDER\n#\tdefine\tBYTEORDER\t0000\n#endif\n\t\n#ifndef\tNOALLIGN\n#\tdefine\tNOALLIGN\t0\n#endif\n\n\nunion\tbytes {\n    long  word;\n    struct {\n#if BYTEORDER == 4321\n\tchar_type\tb1;\n\tchar_type\tb2;\n\tchar_type\tb3;\n\tchar_type\tb4;\n#else\n#if BYTEORDER == 1234\n\tchar_type\tb4;\n\tchar_type\tb3;\n\tchar_type\tb2;\n\tchar_type\tb1;\n#else\n#\tundef\tBYTEORDER\n\tint  dummy;\n#endif\n#endif\n    } bytes;\n};\n\n#if BYTEORDER == 4321 && NOALLIGN == 1\n#  define input(b,o,c,n,m){ \\\n     (c) = (*(long *)(&(b)[(o)>>3])>>((o)&0x7))&(m); \\\n     (o) += (n); \\\n   }\n#else\n#  define input(b,o,c,n,m){ \\\n     REG1 char_type *p = &(b)[(o)>>3]; \\\n     (c) = ((((long)(p[0]))|((long)(p[1])<<8)| \\\n     ((long)(p[2])<<16))>>((o)&0x7))&(m); \\\n     (o) += (n); \\\n   }\n#endif\n\n#ifndef MAXSEG_64K\n   /* DECLARE(ush, tab_prefix, (1<<BITS)); -- prefix code */\n#  define tab_prefixof(i) tab_prefix[i]\n#  define clear_tab_prefixof()\tmemzero(tab_prefix, 256);\n#else\n   /* DECLARE(ush, tab_prefix0, (1<<(BITS-1)); -- prefix for even codes */\n   /* DECLARE(ush, tab_prefix1, (1<<(BITS-1)); -- prefix for odd  codes */\n   ush *tab_prefix[2];\n#  define tab_prefixof(i) tab_prefix[(i)&1][(i)>>1]\n#  define clear_tab_prefixof()\t\\\n      memzero(tab_prefix0, 128), \\\n      memzero(tab_prefix1, 128);\n#endif\n#define de_stack        ((char_type *)(&d_buf[DIST_BUFSIZE-1]))\n#define tab_suffixof(i) tab_suffix[i]\n\nint block_mode = BLOCK_MODE; /* block compress mode -C compatible with 2.0 */\n\n/* ============================================================================\n * Decompress in to out.  This routine adapts to the codes in the\n * file building the \"string\" table on-the-fly; requiring no table to\n * be stored in the compressed file.\n * IN assertions: the buffer inbuf contains already the beginning of\n *   the compressed data, from offsets iptr to insize-1 included.\n *   The magic header has already been checked and skipped.\n *   bytes_in and bytes_out have been initialized.\n */\nlocal int unlzw(FILE *in, FILE *out) \n    /* input and output file descriptors */\n{\n    REG2   char_type  *stackp;\n    REG3   code_int   code;\n    REG4   int        finchar;\n    REG5   code_int   oldcode;\n    REG6   code_int   incode;\n    REG7   long       inbits;\n    REG8   long       posbits;\n    REG9   int        outpos;\n/*  REG10  int        insize; (global) */\n    REG11  unsigned   bitmask;\n    REG12  code_int   free_ent;\n    REG13  code_int   maxcode;\n    REG14  code_int   maxmaxcode;\n    REG15  int        n_bits;\n    REG16  int        rsize;\n    \n    ofd = out;\n\n#ifdef MAXSEG_64K\n    tab_prefix[0] = tab_prefix0;\n    tab_prefix[1] = tab_prefix1;\n#endif\n    maxbits = get_byte();\n    block_mode = maxbits & BLOCK_MODE;\n    if ((maxbits & LZW_RESERVED) != 0) {\n\terror( \"warning, unknown flags in unlzw decompression\");\n    }\n    maxbits &= BIT_MASK;\n    maxmaxcode = MAXCODE(maxbits);\n    \n    if (maxbits > BITS) {\n\terror(\"compressed with too many bits; cannot handle file\");\n\texit_code = ERROR;\n\treturn ERROR;\n    }\n    rsize = insize;\n    maxcode = MAXCODE(n_bits = INIT_BITS)-1;\n    bitmask = (1<<n_bits)-1;\n    oldcode = -1;\n    finchar = 0;\n    outpos = 0;\n    posbits = inptr<<3;\n\n    free_ent = ((block_mode) ? FIRST : 256);\n    \n    clear_tab_prefixof(); /* Initialize the first 256 entries in the table. */\n    \n    for (code = 255 ; code >= 0 ; --code) {\n\ttab_suffixof(code) = (char_type)code;\n    }\n    do {\n\tREG1 int i;\n\tint  e;\n\tint  o;\n\t\n    resetbuf:\n\te = insize-(o = (posbits>>3));\n\t\n\tfor (i = 0 ; i < e ; ++i) {\n\t    inbuf[i] = inbuf[i+o];\n\t}\n\tinsize = e;\n\tposbits = 0;\n\t\n\tif (insize < INBUF_EXTRA) {\n/*  modified to use fread instead of read - WDP 10/22/97  */\n/*\t    if ((rsize = read(in, (char*)inbuf+insize, INBUFSIZ)) == EOF) { */\n\n\t    if ((rsize = fread((char*)inbuf+insize, 1, INBUFSIZ, in)) == EOF) {\n\t\terror(\"unexpected end of file\");\n\t        exit_code = ERROR;\n                return ERROR;\n\t    }\n\t    insize += rsize;\n\t    bytes_in += (ulg)rsize;\n\t}\n\tinbits = ((rsize != 0) ? ((long)insize - insize%n_bits)<<3 : \n\t\t  ((long)insize<<3)-(n_bits-1));\n\t\n\twhile (inbits > posbits) {\n\t    if (free_ent > maxcode) {\n\t\tposbits = ((posbits-1) +\n\t\t\t   ((n_bits<<3)-(posbits-1+(n_bits<<3))%(n_bits<<3)));\n\t\t++n_bits;\n\t\tif (n_bits == maxbits) {\n\t\t    maxcode = maxmaxcode;\n\t\t} else {\n\t\t    maxcode = MAXCODE(n_bits)-1;\n\t\t}\n\t\tbitmask = (1<<n_bits)-1;\n\t\tgoto resetbuf;\n\t    }\n\t    input(inbuf,posbits,code,n_bits,bitmask);\n\t    Tracev((stderr, \"%d \", code));\n\n\t    if (oldcode == -1) {\n\t\tif (code >= 256) {\n                    error(\"corrupt input.\");\n\t            exit_code = ERROR;\n                    return ERROR;\n                }\n\n\t\toutbuf[outpos++] = (char_type)(finchar = (int)(oldcode=code));\n\t\tcontinue;\n\t    }\n\t    if (code == CLEAR && block_mode) {\n\t\tclear_tab_prefixof();\n\t\tfree_ent = FIRST - 1;\n\t\tposbits = ((posbits-1) +\n\t\t\t   ((n_bits<<3)-(posbits-1+(n_bits<<3))%(n_bits<<3)));\n\t\tmaxcode = MAXCODE(n_bits = INIT_BITS)-1;\n\t\tbitmask = (1<<n_bits)-1;\n\t\tgoto resetbuf;\n\t    }\n\t    incode = code;\n\t    stackp = de_stack;\n\t    \n\t    if (code >= free_ent) { /* Special case for KwKwK string. */\n\t\tif (code > free_ent) {\n\t\t    if (outpos > 0) {\n\t\t\twrite_buf((char*)outbuf, outpos);\n\t\t\tbytes_out += (ulg)outpos;\n\t\t    }\n\t\t    error(\"corrupt input.\");\n\t            exit_code = ERROR;\n                    return ERROR;\n\n\t\t}\n\t\t*--stackp = (char_type)finchar;\n\t\tcode = oldcode;\n\t    }\n\n\t    while ((cmp_code_int)code >= (cmp_code_int)256) {\n\t\t/* Generate output characters in reverse order */\n\t\t*--stackp = tab_suffixof(code);\n\t\tcode = tab_prefixof(code);\n\t    }\n\t    *--stackp =\t(char_type)(finchar = tab_suffixof(code));\n\t    \n\t    /* And put them out in forward order */\n\t    {\n\t/*\tREG1 int\ti;   already defined above (WDP) */\n\t    \n\t\tif (outpos+(i = (de_stack-stackp)) >= OUTBUFSIZ) {\n\t\t    do {\n\t\t\tif (i > OUTBUFSIZ-outpos) i = OUTBUFSIZ-outpos;\n\n\t\t\tif (i > 0) {\n\t\t\t    memcpy(outbuf+outpos, stackp, i);\n\t\t\t    outpos += i;\n\t\t\t}\n\t\t\tif (outpos >= OUTBUFSIZ) {\n\t\t\t    write_buf((char*)outbuf, outpos);\n\t\t\t    bytes_out += (ulg)outpos;\n\t\t\t    outpos = 0;\n\t\t\t}\n\t\t\tstackp+= i;\n\t\t    } while ((i = (de_stack-stackp)) > 0);\n\t\t} else {\n\t\t    memcpy(outbuf+outpos, stackp, i);\n\t\t    outpos += i;\n\t\t}\n\t    }\n\n\t    if ((code = free_ent) < maxmaxcode) { /* Generate the new entry. */\n\n\t\ttab_prefixof(code) = (unsigned short)oldcode;\n\t\ttab_suffixof(code) = (char_type)finchar;\n\t\tfree_ent = code+1;\n\t    } \n\t    oldcode = incode;\t/* Remember previous code.\t*/\n\t}\n    } while (rsize != 0);\n    \n    if (outpos > 0) {\n\twrite_buf((char*)outbuf, outpos);\n\tbytes_out += (ulg)outpos;\n    }\n    return OK;\n}\n/* ========================================================================*/\n/* this marks the start of the code from 'util.c'  */\n\nlocal int fill_inbuf(int eof_ok)\n         /* set if EOF acceptable as a result */\n{\n    int len;\n\n      /* Read as much as possible from file */\n      insize = 0;\n      do {\n        len = fread((char*)inbuf+insize, 1, INBUFSIZ-insize, ifd);\n        if (len == 0 || len == EOF) break;\n\tinsize += len;\n      } while (insize < INBUFSIZ);\n\n    if (insize == 0) {\n\tif (eof_ok) return EOF;\n\terror(\"unexpected end of file\");\n        exit_code = ERROR;\n        return ERROR;\n    }\n\n    bytes_in += (ulg)insize;\n    inptr = 1;\n    return inbuf[0];\n}\n/* =========================================================================== */\nlocal void write_buf(voidp buf, unsigned cnt)\n/*              copy buffer into memory; allocate more memory if required*/\n{\n    if (!realloc_fn)\n    {\n      /* append buffer to file */\n      /* added 'unsigned' to get rid of compiler warning (WDP 1/1/99) */\n      if ((unsigned long) fwrite(buf, 1, cnt, ofd) != cnt)\n      {\n          error\n          (\"failed to write buffer to uncompressed output file (write_buf)\");\n          exit_code = ERROR;\n          return;\n      }\n    }\n    else\n    {\n      /* get more memory if current buffer is too small */\n      if (bytes_out + cnt > *memsize)\n      {\n        *memptr = realloc_fn(*memptr, bytes_out + cnt);\n        *memsize = bytes_out + cnt;  /* new memory buffer size */\n\n        if (!(*memptr))\n        {\n            error(\"malloc failed while uncompressing (write_buf)\");\n            exit_code = ERROR;\n            return;\n        }  \n      }\n      /* copy  into memory buffer */\n      memcpy((char *) *memptr + bytes_out, (char *) buf, cnt);\n    }\n}\n/* ======================================================================== */\nlocal void error(char *m)\n/*                Error handler */\n{\n    ffpmsg(ifname);\n    ffpmsg(m);\n}\n"},{"id":16665,"name":"longnam.h","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"#ifndef _LONGNAME_H\n#define _LONGNAME_H\n\n#define fits_parse_input_url ffiurl\n#define fits_parse_input_filename ffifile\n#define fits_parse_rootname ffrtnm\n#define fits_file_exists    ffexist\n#define fits_parse_output_url ffourl\n#define fits_parse_extspec  ffexts\n#define fits_parse_extnum   ffextn\n#define fits_parse_binspec  ffbins\n#define fits_parse_binrange ffbinr\n#define fits_parse_range    ffrwrg\n#define fits_parse_rangell    ffrwrgll\n#define fits_open_memfile   ffomem\n\n/* \n   use the following special macro to test that the fitsio.h include file\n   that was used to build the CFITSIO library is compatible with the version\n   as included when compiling the application program\n*/\n#define fits_open_file(A, B, C, D)  ffopentest( CFITSIO_SONAME, A, B, C, D)\n\n#define fits_open_data      ffdopn\n#define fits_open_extlist   ffeopn\n#define fits_open_table     fftopn\n#define fits_open_image     ffiopn\n#define fits_open_diskfile  ffdkopn\n#define fits_reopen_file    ffreopen\n#define fits_create_file    ffinit\n#define fits_create_diskfile ffdkinit\n#define fits_create_memfile ffimem\n#define fits_create_template fftplt\n#define fits_flush_file     ffflus\n#define fits_flush_buffer   ffflsh\n#define fits_close_file     ffclos\n#define fits_delete_file    ffdelt\n#define fits_file_name      ffflnm\n#define fits_file_mode      ffflmd\n#define fits_url_type       ffurlt\n\n#define fits_get_version    ffvers\n#define fits_uppercase      ffupch\n#define fits_get_errstatus  ffgerr\n#define fits_write_errmsg   ffpmsg\n#define fits_write_errmark  ffpmrk\n#define fits_read_errmsg    ffgmsg\n#define fits_clear_errmsg   ffcmsg\n#define fits_clear_errmark  ffcmrk\n#define fits_report_error   ffrprt\n#define fits_compare_str    ffcmps\n#define fits_test_keyword   fftkey\n#define fits_test_record    fftrec\n#define fits_null_check     ffnchk\n#define fits_make_keyn      ffkeyn\n#define fits_make_nkey      ffnkey\n#define fits_make_key       ffmkky\n#define fits_get_keyclass   ffgkcl\n#define fits_get_keytype    ffdtyp\n#define fits_get_inttype    ffinttyp\n#define fits_parse_value    ffpsvc\n#define fits_get_keyname    ffgknm\n#define fits_parse_template ffgthd\n#define fits_ascii_tform    ffasfm\n#define fits_binary_tform   ffbnfm\n#define fits_binary_tformll   ffbnfmll\n#define fits_get_tbcol      ffgabc\n#define fits_get_rowsize    ffgrsz\n#define fits_get_col_display_width    ffgcdw\n\n#define fits_write_record       ffprec\n#define fits_write_key          ffpky\n#define fits_write_key_unit     ffpunt\n#define fits_write_comment      ffpcom\n#define fits_write_history      ffphis \n#define fits_write_date         ffpdat\n#define fits_get_system_time    ffgstm\n#define fits_get_system_date    ffgsdt\n#define fits_date2str           ffdt2s\n#define fits_time2str           fftm2s\n#define fits_str2date           ffs2dt\n#define fits_str2time           ffs2tm\n#define fits_write_key_longstr  ffpkls\n#define fits_write_key_longwarn ffplsw\n#define fits_write_key_null     ffpkyu\n#define fits_write_key_str      ffpkys\n#define fits_write_key_log      ffpkyl\n#define fits_write_key_lng      ffpkyj\n#define fits_write_key_ulng     ffpkyuj\n#define fits_write_key_fixflt   ffpkyf\n#define fits_write_key_flt      ffpkye\n#define fits_write_key_fixdbl   ffpkyg\n#define fits_write_key_dbl      ffpkyd\n#define fits_write_key_fixcmp   ffpkfc\n#define fits_write_key_cmp      ffpkyc\n#define fits_write_key_fixdblcmp ffpkfm\n#define fits_write_key_dblcmp   ffpkym\n#define fits_write_key_triple   ffpkyt\n#define fits_write_tdim         ffptdm\n#define fits_write_tdimll       ffptdmll\n#define fits_write_keys_str     ffpkns\n#define fits_write_keys_log     ffpknl\n#define fits_write_keys_lng     ffpknj\n#define fits_write_keys_fixflt  ffpknf\n#define fits_write_keys_flt     ffpkne\n#define fits_write_keys_fixdbl  ffpkng\n#define fits_write_keys_dbl     ffpknd\n#define fits_copy_key           ffcpky\n#define fits_write_imghdr       ffphps\n#define fits_write_imghdrll     ffphpsll\n#define fits_write_grphdr       ffphpr\n#define fits_write_grphdrll     ffphprll\n#define fits_write_atblhdr      ffphtb\n#define fits_write_btblhdr      ffphbn\n#define fits_write_exthdr       ffphext\n#define fits_write_key_template ffpktp\n\n#define fits_get_hdrspace      ffghsp\n#define fits_get_hdrpos        ffghps\n#define fits_movabs_key        ffmaky\n#define fits_movrel_key        ffmrky\n#define fits_find_nextkey      ffgnxk\n\n#define fits_read_record       ffgrec\n#define fits_read_card         ffgcrd\n#define fits_read_str          ffgstr\n#define fits_read_key_unit     ffgunt\n#define fits_read_keyn         ffgkyn\n#define fits_read_key          ffgky\n#define fits_read_keyword      ffgkey\n#define fits_read_key_str      ffgkys\n#define fits_read_key_log      ffgkyl\n#define fits_read_key_lng      ffgkyj\n#define fits_read_key_lnglng   ffgkyjj\n#define fits_read_key_ulnglng  ffgkyujj\n#define fits_read_key_flt      ffgkye\n#define fits_read_key_dbl      ffgkyd\n#define fits_read_key_cmp      ffgkyc\n#define fits_read_key_dblcmp   ffgkym\n#define fits_read_key_triple   ffgkyt\n#define fits_get_key_strlen    ffgksl\n#define fits_read_key_longstr  ffgkls\n#define fits_read_string_key   ffgsky\n#define fits_free_memory       fffree\n#define fits_read_tdim         ffgtdm\n#define fits_read_tdimll       ffgtdmll\n#define fits_decode_tdim       ffdtdm\n#define fits_decode_tdimll     ffdtdmll\n#define fits_read_keys_str     ffgkns\n#define fits_read_keys_log     ffgknl\n#define fits_read_keys_lng     ffgknj\n#define fits_read_keys_lnglng  ffgknjj\n#define fits_read_keys_flt     ffgkne\n#define fits_read_keys_dbl     ffgknd\n#define fits_read_imghdr       ffghpr\n#define fits_read_imghdrll     ffghprll\n#define fits_read_atblhdr      ffghtb\n#define fits_read_btblhdr      ffghbn\n#define fits_read_atblhdrll    ffghtbll\n#define fits_read_btblhdrll    ffghbnll\n#define fits_hdr2str           ffhdr2str\n#define fits_convert_hdr2str   ffcnvthdr2str\n\n#define fits_update_card       ffucrd\n#define fits_update_key        ffuky\n#define fits_update_key_null   ffukyu\n#define fits_update_key_str    ffukys\n#define fits_update_key_longstr    ffukls\n#define fits_update_key_log    ffukyl\n#define fits_update_key_lng    ffukyj\n#define fits_update_key_fixflt ffukyf\n#define fits_update_key_flt    ffukye\n#define fits_update_key_fixdbl ffukyg\n#define fits_update_key_dbl    ffukyd\n#define fits_update_key_fixcmp ffukfc\n#define fits_update_key_cmp    ffukyc\n#define fits_update_key_fixdblcmp ffukfm\n#define fits_update_key_dblcmp ffukym\n\n#define fits_modify_record     ffmrec\n#define fits_modify_card       ffmcrd\n#define fits_modify_name       ffmnam\n#define fits_modify_comment    ffmcom\n#define fits_modify_key_null   ffmkyu\n#define fits_modify_key_str    ffmkys\n#define fits_modify_key_longstr    ffmkls\n#define fits_modify_key_log    ffmkyl\n#define fits_modify_key_lng    ffmkyj\n#define fits_modify_key_fixflt ffmkyf\n#define fits_modify_key_flt    ffmkye\n#define fits_modify_key_fixdbl ffmkyg\n#define fits_modify_key_dbl    ffmkyd\n#define fits_modify_key_fixcmp ffmkfc\n#define fits_modify_key_cmp    ffmkyc\n#define fits_modify_key_fixdblcmp ffmkfm\n#define fits_modify_key_dblcmp ffmkym\n\n#define fits_insert_record     ffirec\n#define fits_insert_card       ffikey\n#define fits_insert_key_null   ffikyu\n#define fits_insert_key_str    ffikys\n#define fits_insert_key_longstr    ffikls\n#define fits_insert_key_log    ffikyl\n#define fits_insert_key_lng    ffikyj\n#define fits_insert_key_fixflt ffikyf\n#define fits_insert_key_flt    ffikye\n#define fits_insert_key_fixdbl ffikyg\n#define fits_insert_key_dbl    ffikyd\n#define fits_insert_key_fixcmp ffikfc\n#define fits_insert_key_cmp    ffikyc\n#define fits_insert_key_fixdblcmp ffikfm\n#define fits_insert_key_dblcmp ffikym\n\n#define fits_delete_key     ffdkey\n#define fits_delete_str     ffdstr\n#define fits_delete_record  ffdrec\n#define fits_get_hdu_num    ffghdn\n#define fits_get_hdu_type   ffghdt\n#define fits_get_hduaddr    ffghad\n#define fits_get_hduaddrll    ffghadll\n#define fits_get_hduoff     ffghof\n\n#define fits_get_img_param  ffgipr\n#define fits_get_img_paramll  ffgiprll\n\n#define fits_get_img_type   ffgidt\n#define fits_get_img_equivtype   ffgiet\n#define fits_get_img_dim    ffgidm\n#define fits_get_img_size   ffgisz\n#define fits_get_img_sizell   ffgiszll\n\n#define fits_movabs_hdu     ffmahd\n#define fits_movrel_hdu     ffmrhd\n#define fits_movnam_hdu     ffmnhd\n#define fits_get_num_hdus   ffthdu\n#define fits_create_img     ffcrim\n#define fits_create_imgll   ffcrimll\n#define fits_create_tbl     ffcrtb\n#define fits_create_hdu     ffcrhd\n#define fits_insert_img     ffiimg\n#define fits_insert_imgll   ffiimgll\n#define fits_insert_atbl    ffitab\n#define fits_insert_btbl    ffibin\n#define fits_resize_img     ffrsim\n#define fits_resize_imgll   ffrsimll\n\n#define fits_delete_hdu     ffdhdu\n#define fits_copy_hdu       ffcopy\n#define fits_copy_file      ffcpfl\n#define fits_copy_header    ffcphd\n#define fits_copy_hdutab    ffcpht\n#define fits_copy_data      ffcpdt\n#define fits_write_hdu      ffwrhdu\n\n#define fits_set_hdustruc   ffrdef\n#define fits_set_hdrsize    ffhdef\n#define fits_write_theap    ffpthp\n\n#define fits_encode_chksum  ffesum\n#define fits_decode_chksum  ffdsum\n#define fits_write_chksum   ffpcks\n#define fits_update_chksum  ffupck\n#define fits_verify_chksum  ffvcks\n#define fits_get_chksum     ffgcks\n\n#define fits_set_bscale     ffpscl\n#define fits_set_tscale     fftscl\n#define fits_set_imgnull    ffpnul\n#define fits_set_btblnull   fftnul\n#define fits_set_atblnull   ffsnul\n\n#define fits_get_colnum     ffgcno\n#define fits_get_colname    ffgcnn\n#define fits_get_coltype    ffgtcl\n#define fits_get_coltypell  ffgtclll\n#define fits_get_eqcoltype  ffeqty\n#define fits_get_eqcoltypell ffeqtyll\n#define fits_get_num_rows   ffgnrw\n#define fits_get_num_rowsll   ffgnrwll\n#define fits_get_num_cols   ffgncl\n#define fits_get_acolparms  ffgacl\n#define fits_get_bcolparms  ffgbcl\n#define fits_get_bcolparmsll  ffgbclll\n\n#define fits_iterate_data   ffiter\n\n#define fits_read_grppar_byt  ffggpb\n#define fits_read_grppar_sbyt  ffggpsb\n#define fits_read_grppar_usht  ffggpui\n#define fits_read_grppar_ulng  ffggpuj\n#define fits_read_grppar_ulnglng  ffggpujj\n#define fits_read_grppar_sht  ffggpi\n#define fits_read_grppar_lng  ffggpj\n#define fits_read_grppar_lnglng  ffggpjj\n#define fits_read_grppar_int  ffggpk\n#define fits_read_grppar_uint  ffggpuk\n#define fits_read_grppar_flt  ffggpe\n#define fits_read_grppar_dbl  ffggpd\n\n#define fits_read_pix         ffgpxv\n#define fits_read_pixll       ffgpxvll\n#define fits_read_pixnull     ffgpxf\n#define fits_read_pixnullll   ffgpxfll\n#define fits_read_img         ffgpv\n#define fits_read_imgnull     ffgpf\n#define fits_read_img_byt     ffgpvb\n#define fits_read_img_sbyt     ffgpvsb\n#define fits_read_img_usht     ffgpvui\n#define fits_read_img_ulng     ffgpvuj\n#define fits_read_img_sht     ffgpvi\n#define fits_read_img_lng     ffgpvj\n#define fits_read_img_ulnglng     ffgpvujj\n#define fits_read_img_lnglng     ffgpvjj\n#define fits_read_img_uint     ffgpvuk\n#define fits_read_img_int     ffgpvk\n#define fits_read_img_flt     ffgpve\n#define fits_read_img_dbl     ffgpvd\n\n#define fits_read_imgnull_byt ffgpfb\n#define fits_read_imgnull_sbyt ffgpfsb\n#define fits_read_imgnull_usht ffgpfui\n#define fits_read_imgnull_ulng ffgpfuj\n#define fits_read_imgnull_sht ffgpfi\n#define fits_read_imgnull_lng ffgpfj\n#define fits_read_imgnull_ulnglng ffgpfujj\n#define fits_read_imgnull_lnglng ffgpfjj\n#define fits_read_imgnull_uint ffgpfuk\n#define fits_read_imgnull_int ffgpfk\n#define fits_read_imgnull_flt ffgpfe\n#define fits_read_imgnull_dbl ffgpfd\n\n#define fits_read_2d_byt      ffg2db\n#define fits_read_2d_sbyt     ffg2dsb\n#define fits_read_2d_usht      ffg2dui\n#define fits_read_2d_ulng      ffg2duj\n#define fits_read_2d_sht      ffg2di\n#define fits_read_2d_lng      ffg2dj\n#define fits_read_2d_ulnglng      ffg2dujj\n#define fits_read_2d_lnglng      ffg2djj\n#define fits_read_2d_uint      ffg2duk\n#define fits_read_2d_int      ffg2dk\n#define fits_read_2d_flt      ffg2de\n#define fits_read_2d_dbl      ffg2dd\n\n#define fits_read_3d_byt      ffg3db\n#define fits_read_3d_sbyt      ffg3dsb\n#define fits_read_3d_usht      ffg3dui\n#define fits_read_3d_ulng      ffg3duj\n#define fits_read_3d_sht      ffg3di\n#define fits_read_3d_lng      ffg3dj\n#define fits_read_3d_ulnglng      ffg3dujj\n#define fits_read_3d_lnglng      ffg3djj\n#define fits_read_3d_uint      ffg3duk\n#define fits_read_3d_int      ffg3dk\n#define fits_read_3d_flt      ffg3de\n#define fits_read_3d_dbl      ffg3dd\n\n#define fits_read_subset      ffgsv\n#define fits_read_subset_byt  ffgsvb\n#define fits_read_subset_sbyt  ffgsvsb\n#define fits_read_subset_usht  ffgsvui\n#define fits_read_subset_ulng  ffgsvuj\n#define fits_read_subset_sht  ffgsvi\n#define fits_read_subset_lng  ffgsvj\n#define fits_read_subset_ulnglng  ffgsvujj\n#define fits_read_subset_lnglng  ffgsvjj\n#define fits_read_subset_uint  ffgsvuk\n#define fits_read_subset_int  ffgsvk\n#define fits_read_subset_flt  ffgsve\n#define fits_read_subset_dbl  ffgsvd\n\n#define fits_read_subsetnull_byt ffgsfb\n#define fits_read_subsetnull_sbyt ffgsfsb\n#define fits_read_subsetnull_usht ffgsfui\n#define fits_read_subsetnull_ulng ffgsfuj\n#define fits_read_subsetnull_sht ffgsfi\n#define fits_read_subsetnull_lng ffgsfj\n#define fits_read_subsetnull_ulnglng ffgsfujj\n#define fits_read_subsetnull_lnglng ffgsfjj\n#define fits_read_subsetnull_uint ffgsfuk\n#define fits_read_subsetnull_int ffgsfk\n#define fits_read_subsetnull_flt ffgsfe\n#define fits_read_subsetnull_dbl ffgsfd\n\n#define ffcpimg fits_copy_image_section\n#define fits_compress_img fits_comp_img\n#define fits_decompress_img fits_decomp_img\n\n#define fits_read_col        ffgcv\n#define fits_read_colnull    ffgcf\n#define fits_read_col_str    ffgcvs\n#define fits_read_col_log    ffgcvl\n#define fits_read_col_byt    ffgcvb\n#define fits_read_col_sbyt    ffgcvsb\n#define fits_read_col_usht    ffgcvui\n#define fits_read_col_ulng    ffgcvuj\n#define fits_read_col_sht    ffgcvi\n#define fits_read_col_lng    ffgcvj\n#define fits_read_col_ulnglng    ffgcvujj\n#define fits_read_col_lnglng    ffgcvjj\n#define fits_read_col_uint    ffgcvuk\n#define fits_read_col_int    ffgcvk\n#define fits_read_col_flt    ffgcve\n#define fits_read_col_dbl    ffgcvd\n#define fits_read_col_cmp    ffgcvc\n#define fits_read_col_dblcmp ffgcvm\n#define fits_read_col_bit    ffgcx\n#define fits_read_col_bit_usht ffgcxui\n#define fits_read_col_bit_uint ffgcxuk\n\n#define fits_read_colnull_str    ffgcfs\n#define fits_read_colnull_log    ffgcfl\n#define fits_read_colnull_byt    ffgcfb\n#define fits_read_colnull_sbyt    ffgcfsb\n#define fits_read_colnull_usht    ffgcfui\n#define fits_read_colnull_ulng    ffgcfuj\n#define fits_read_colnull_sht    ffgcfi\n#define fits_read_colnull_lng    ffgcfj\n#define fits_read_colnull_ulnglng    ffgcfujj\n#define fits_read_colnull_lnglng    ffgcfjj\n#define fits_read_colnull_uint    ffgcfuk\n#define fits_read_colnull_int    ffgcfk\n#define fits_read_colnull_flt    ffgcfe\n#define fits_read_colnull_dbl    ffgcfd\n#define fits_read_colnull_cmp    ffgcfc\n#define fits_read_colnull_dblcmp ffgcfm\n\n#define fits_read_descript ffgdes\n#define fits_read_descriptll ffgdesll\n#define fits_read_descripts ffgdess\n#define fits_read_descriptsll ffgdessll\n#define fits_read_tblbytes    ffgtbb\n\n#define fits_write_grppar_byt ffpgpb\n#define fits_write_grppar_sbyt ffpgpsb\n#define fits_write_grppar_usht ffpgpui\n#define fits_write_grppar_ulng ffpgpuj\n#define fits_write_grppar_sht ffpgpi\n#define fits_write_grppar_lng ffpgpj\n#define fits_write_grppar_ulnglng ffpgpujj\n#define fits_write_grppar_lnglng ffpgpjj\n#define fits_write_grppar_uint ffpgpuk\n#define fits_write_grppar_int ffpgpk\n#define fits_write_grppar_flt ffpgpe\n#define fits_write_grppar_dbl ffpgpd\n\n#define fits_write_pix        ffppx\n#define fits_write_pixll      ffppxll\n#define fits_write_pixnull    ffppxn\n#define fits_write_pixnullll  ffppxnll\n#define fits_write_img        ffppr\n#define fits_write_img_byt    ffpprb\n#define fits_write_img_sbyt    ffpprsb\n#define fits_write_img_usht    ffpprui\n#define fits_write_img_ulng    ffppruj\n#define fits_write_img_sht    ffppri\n#define fits_write_img_lng    ffpprj\n#define fits_write_img_ulnglng    ffpprujj\n#define fits_write_img_lnglng    ffpprjj\n#define fits_write_img_uint    ffppruk\n#define fits_write_img_int    ffpprk\n#define fits_write_img_flt    ffppre\n#define fits_write_img_dbl    ffpprd\n\n#define fits_write_imgnull     ffppn\n#define fits_write_imgnull_byt ffppnb\n#define fits_write_imgnull_sbyt ffppnsb\n#define fits_write_imgnull_usht ffppnui\n#define fits_write_imgnull_ulng ffppnuj\n#define fits_write_imgnull_sht ffppni\n#define fits_write_imgnull_lng ffppnj\n#define fits_write_imgnull_ulnglng ffppnujj\n#define fits_write_imgnull_lnglng ffppnjj\n#define fits_write_imgnull_uint ffppnuk\n#define fits_write_imgnull_int ffppnk\n#define fits_write_imgnull_flt ffppne\n#define fits_write_imgnull_dbl ffppnd\n\n#define fits_write_img_null ffppru\n#define fits_write_null_img ffpprn\n\n#define fits_write_2d_byt   ffp2db\n#define fits_write_2d_sbyt   ffp2dsb\n#define fits_write_2d_usht   ffp2dui\n#define fits_write_2d_ulng   ffp2duj\n#define fits_write_2d_sht   ffp2di\n#define fits_write_2d_lng   ffp2dj\n#define fits_write_2d_ulnglng   ffp2dujj\n#define fits_write_2d_lnglng   ffp2djj\n#define fits_write_2d_uint   ffp2duk\n#define fits_write_2d_int   ffp2dk\n#define fits_write_2d_flt   ffp2de\n#define fits_write_2d_dbl   ffp2dd\n\n#define fits_write_3d_byt   ffp3db\n#define fits_write_3d_sbyt   ffp3dsb\n#define fits_write_3d_usht   ffp3dui\n#define fits_write_3d_ulng   ffp3duj\n#define fits_write_3d_sht   ffp3di\n#define fits_write_3d_lng   ffp3dj\n#define fits_write_3d_ulnglng   ffp3dujj\n#define fits_write_3d_lnglng   ffp3djj\n#define fits_write_3d_uint   ffp3duk\n#define fits_write_3d_int   ffp3dk\n#define fits_write_3d_flt   ffp3de\n#define fits_write_3d_dbl   ffp3dd\n\n#define fits_write_subset  ffpss\n#define fits_write_subset_byt  ffpssb\n#define fits_write_subset_sbyt  ffpsssb\n#define fits_write_subset_usht  ffpssui\n#define fits_write_subset_ulng  ffpssuj\n#define fits_write_subset_sht  ffpssi\n#define fits_write_subset_lng  ffpssj\n#define fits_write_subset_ulnglng  ffpssujj\n#define fits_write_subset_lnglng  ffpssjj\n#define fits_write_subset_uint  ffpssuk\n#define fits_write_subset_int  ffpssk\n#define fits_write_subset_flt  ffpsse\n#define fits_write_subset_dbl  ffpssd\n\n#define fits_write_col         ffpcl\n#define fits_write_col_str     ffpcls\n#define fits_write_col_log     ffpcll\n#define fits_write_col_byt     ffpclb\n#define fits_write_col_sbyt     ffpclsb\n#define fits_write_col_usht     ffpclui\n#define fits_write_col_ulng     ffpcluj\n#define fits_write_col_sht     ffpcli\n#define fits_write_col_lng     ffpclj\n#define fits_write_col_ulnglng     ffpclujj\n#define fits_write_col_lnglng     ffpcljj\n#define fits_write_col_uint     ffpcluk\n#define fits_write_col_int     ffpclk\n#define fits_write_col_flt     ffpcle\n#define fits_write_col_dbl     ffpcld\n#define fits_write_col_cmp     ffpclc\n#define fits_write_col_dblcmp  ffpclm\n#define fits_write_col_null    ffpclu\n#define fits_write_col_bit     ffpclx\n#define fits_write_nulrows     ffprwu\n#define fits_write_nullrows    ffprwu\n\n#define fits_write_colnull ffpcn\n#define fits_write_colnull_str ffpcns\n#define fits_write_colnull_log ffpcnl\n#define fits_write_colnull_byt ffpcnb\n#define fits_write_colnull_sbyt ffpcnsb\n#define fits_write_colnull_usht ffpcnui\n#define fits_write_colnull_ulng ffpcnuj\n#define fits_write_colnull_sht ffpcni\n#define fits_write_colnull_lng ffpcnj\n#define fits_write_colnull_ulnglng ffpcnujj\n#define fits_write_colnull_lnglng ffpcnjj\n#define fits_write_colnull_uint ffpcnuk\n#define fits_write_colnull_int ffpcnk\n#define fits_write_colnull_flt ffpcne\n#define fits_write_colnull_dbl ffpcnd\n\n#define fits_write_ext ffpextn\n#define fits_read_ext  ffgextn\n\n#define fits_write_descript  ffpdes\n#define fits_compress_heap   ffcmph\n#define fits_test_heap   fftheap\n\n#define fits_write_tblbytes  ffptbb\n#define fits_insert_rows  ffirow\n#define fits_delete_rows  ffdrow\n#define fits_delete_rowrange ffdrrg\n#define fits_delete_rowlist ffdrws\n#define fits_delete_rowlistll ffdrwsll\n#define fits_insert_col   fficol\n#define fits_insert_cols  fficls\n#define fits_delete_col   ffdcol\n#define fits_copy_col     ffcpcl\n#define fits_copy_cols    ffccls\n#define fits_copy_rows    ffcprw\n#define fits_modify_vector_len  ffmvec\n\n#define fits_read_img_coord ffgics\n#define fits_read_img_coord_version ffgicsa\n#define fits_read_tbl_coord ffgtcs\n#define fits_pix_to_world ffwldp\n#define fits_world_to_pix ffxypx\n\n#define fits_get_image_wcs_keys ffgiwcs\n#define fits_get_table_wcs_keys ffgtwcs\n\n#define fits_find_rows          fffrow\n#define fits_find_first_row     ffffrw\n#define fits_find_rows_cmp      fffrwc\n#define fits_select_rows        ffsrow\n#define fits_calc_rows          ffcrow\n#define fits_calculator         ffcalc\n#define fits_calculator_rng     ffcalc_rng\n#define fits_test_expr          fftexp\n\n#define fits_create_group       ffgtcr \n#define fits_insert_group       ffgtis \n#define fits_change_group       ffgtch \n#define fits_remove_group       ffgtrm \n#define fits_copy_group         ffgtcp \n#define fits_merge_groups       ffgtmg \n#define fits_compact_group      ffgtcm \n#define fits_verify_group       ffgtvf \n#define fits_open_group         ffgtop \n#define fits_add_group_member   ffgtam \n#define fits_get_num_members    ffgtnm \n\n#define fits_get_num_groups     ffgmng \n#define fits_open_member        ffgmop \n#define fits_copy_member        ffgmcp \n#define fits_transfer_member    ffgmtf \n#define fits_remove_member      ffgmrm\n\n#define fits_init_https         ffihtps\n#define fits_cleanup_https      ffchtps\n#define fits_verbose_https      ffvhtps\n\n#define fits_show_download_progress  ffshdwn\n#define fits_get_timeout        ffgtmo\n#define fits_set_timeout        ffstmo\n\n#endif\n"},{"id":16666,"name":"fitsio.h","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n/*\n\nCopyright (Unpublished--all rights reserved under the copyright laws of\nthe United States), U.S. Government as represented by the Administrator\nof the National Aeronautics and Space Administration.  No copyright is\nclaimed in the United States under Title 17, U.S. Code.\n\nPermission to freely use, copy, modify, and distribute this software\nand its documentation without fee is hereby granted, provided that this\ncopyright notice and disclaimer of warranty appears in all copies.\n\nDISCLAIMER:\n\nTHE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND,\nEITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO,\nANY WARRANTY THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY\nIMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR\nPURPOSE, AND FREEDOM FROM INFRINGEMENT, AND ANY WARRANTY THAT THE\nDOCUMENTATION WILL CONFORM TO THE SOFTWARE, OR ANY WARRANTY THAT THE\nSOFTWARE WILL BE ERROR FREE.  IN NO EVENT SHALL NASA BE LIABLE FOR ANY\nDAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL OR\nCONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR IN ANY WAY\nCONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY,\nCONTRACT, TORT , OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY\nPERSONS OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED\nFROM, OR AROSE OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR\nSERVICES PROVIDED HEREUNDER.\"\n\n*/\n\n#ifndef _FITSIO_H\n#define _FITSIO_H\n\n#define CFITSIO_VERSION 4.0.0\n#define CFITSIO_MICRO 0\n#define CFITSIO_MINOR 0\n#define CFITSIO_MAJOR 4\n#define CFITSIO_SONAME 9\n\n/* the SONAME is incremented in a new release if the binary shared */\n/* library (on linux and Mac systems) is not backward compatible */\n/* with the previous release of CFITSIO */\n\n\n/* CFITS_API is defined below for use on Windows systems.  */\n/* It is used to identify the public functions which should be exported. */\n/* This has no effect on non-windows platforms where \"WIN32\" is not defined */\n\n#if defined (WIN32)\n  #if defined(cfitsio_EXPORTS)\n    #define CFITS_API __declspec(dllexport)\n  #else\n    #define CFITS_API  /* __declspec(dllimport) */\n  #endif /* CFITS_API */\n#else /* defined (WIN32) */\n #define CFITS_API\n#endif\n\n#include <stdio.h>\n\n/* the following was provided by Michael Greason (GSFC) to fix a */\n/*  C/Fortran compatibility problem on an SGI Altix system running */\n/*  SGI ProPack 4 [this is a Novell SuSE Enterprise 9 derivative]  */\n/*  and using the Intel C++ and Fortran compilers (version 9.1)  */\n#if defined(__INTEL_COMPILER) && defined(__itanium__)\n#  define mipsFortran 1\n#  define _MIPS_SZLONG 64\n#endif\n\n#if defined(linux) || defined(__APPLE__) || defined(__sgi)\n#  include <sys/types.h>  /* apparently needed on debian linux systems */\n#endif                    /* to define off_t                           */\n\n#include <stdlib.h>  /* apparently needed to define size_t with gcc 2.8.1 */\n#include <limits.h>  /* needed for LLONG_MAX and INT64_MAX definitions */\n\n/* Define the datatype for variables which store file offset values. */\n/* The newer 'off_t' datatype should be used for this purpose, but some */\n/* older compilers do not recognize this type, in which case we use 'long' */\n/* instead.  Note that _OFF_T is defined (or not) in stdio.h depending */\n/* on whether _LARGEFILE_SOURCE is defined in sys/feature_tests.h  */\n/* (at least on Solaris platforms using cc)  */\n\n/*  Debian systems require: \"(defined(linux) && defined(__off_t_defined))\" */\n/*  the mingw-w64 compiler requires: \"(defined(__MINGW32__) && defined(_OFF_T_DEFINED))\" */\n#if defined(_OFF_T) \\\n    || (defined(linux) && defined(__off_t_defined)) \\\n    || (defined(__MINGW32__) && defined(_OFF_T_DEFINED)) \\\n    || defined(_MIPS_SZLONG) || defined(__APPLE__) || defined(_AIX)\n#    define OFF_T off_t\n#elif defined(__BORLANDC__) || (defined(_MSC_VER) && (_MSC_VER>= 1400))\n#    define OFF_T long long\n#else\n#    define OFF_T long\n#endif\n\n/* this block determines if the the string function name is \n    strtol or strtoll, and whether to use %ld or %lld in printf statements */\n\n/* \n   The following 2 cases for that Athon64 were removed on 4 Jan 2006;  \n   they appear to be incorrect now that LONGLONG is always typedef'ed \n   to 'long long'\n    ||  defined(__ia64__)   \\\n    ||  defined(__x86_64__) \\\n*/\n#if (defined(__alpha) && ( defined(__unix__) || defined(__NetBSD__) )) \\\n    ||  defined(__sparcv9) || (defined(__sparc__) && defined(__arch64__))  \\\n    ||  defined(__powerpc64__) || defined(__64BIT__) \\\n    ||  (defined(_MIPS_SZLONG) &&  _MIPS_SZLONG == 64) \\\n    ||  defined( _MSC_VER)|| defined(__BORLANDC__)\n    \n#   define USE_LL_SUFFIX 0\n#else\n#   define USE_LL_SUFFIX 1\n#endif\n\n/* \n   Determine what 8-byte integer data type is available.\n  'long long' is now supported by most compilers, but\n  older MS Visual C++ compilers before V7.0 use '__int64' instead.\n*/\n\n#ifndef LONGLONG_TYPE   /* this may have been previously defined */\n#if defined(_MSC_VER)   /* Microsoft Visual C++ */\n\n#if (_MSC_VER < 1300)   /* versions earlier than V7.0 do not have 'long long' */\n    typedef __int64 LONGLONG;\n    typedef unsigned __int64 ULONGLONG;\n\n#else                   /* newer versions do support 'long long' */\n    typedef long long LONGLONG; \n    typedef unsigned long long ULONGLONG; \n\n#endif\n\n#elif defined( __BORLANDC__)  /* for the Borland 5.5 compiler, in particular */\n    typedef __int64 LONGLONG;\n    typedef unsigned __int64 ULONGLONG;\n#else\n    typedef long long LONGLONG; \n    typedef unsigned long long ULONGLONG; \n#endif\n\n#define LONGLONG_TYPE\n#endif  \n\n#ifndef LONGLONG_MAX\n\n#ifdef LLONG_MAX\n/* Linux and Solaris definition */\n#define LONGLONG_MAX LLONG_MAX\n#define LONGLONG_MIN LLONG_MIN\n\n#elif defined(LONG_LONG_MAX)\n#define LONGLONG_MAX LONG_LONG_MAX\n#define LONGLONG_MIN LONG_LONG_MIN\n\n#elif defined(__LONG_LONG_MAX__)\n/* Mac OS X & CYGWIN defintion */\n#define LONGLONG_MAX __LONG_LONG_MAX__\n#define LONGLONG_MIN (-LONGLONG_MAX -1LL)\n\n#elif defined(INT64_MAX)\n/* windows definition */\n#define LONGLONG_MAX INT64_MAX\n#define LONGLONG_MIN INT64_MIN\n\n#elif defined(_I64_MAX)\n/* windows definition */\n#define LONGLONG_MAX _I64_MAX\n#define LONGLONG_MIN _I64_MIN\n\n#elif (defined(__alpha) && ( defined(__unix__) || defined(__NetBSD__) )) \\\n    ||  defined(__sparcv9)  \\\n    ||  defined(__ia64__)   \\\n    ||  defined(__x86_64__) \\\n    ||  defined(_SX)        \\\n    ||  defined(__powerpc64__) || defined(__64BIT__) \\\n    ||  (defined(_MIPS_SZLONG) &&  _MIPS_SZLONG == 64)\n/* sizeof(long) = 64 */\n#define LONGLONG_MAX  9223372036854775807L /* max 64-bit integer */\n#define LONGLONG_MIN (-LONGLONG_MAX -1L)   /* min 64-bit integer */\n\n#else\n/*  define a default value, even if it is never used */\n#define LONGLONG_MAX  9223372036854775807LL /* max 64-bit integer */\n#define LONGLONG_MIN (-LONGLONG_MAX -1LL)   /* min 64-bit integer */\n\n#endif\n#endif  /* end of ndef LONGLONG_MAX section */\n\n\n/* ================================================================= */\n\n\n/*  The following exclusion if __CINT__ is defined is needed for ROOT */\n#ifndef __CINT__\n#include \"longnam.h\"\n#endif\n \n#define NIOBUF  40  /* number of IO buffers to create (default = 40) */\n          /* !! Significantly increasing NIOBUF may degrade performance !! */\n\n#define IOBUFLEN 2880    /* size in bytes of each IO buffer (DONT CHANGE!) */\n\n/* global variables */\n \n#define FLEN_FILENAME 1025 /* max length of a filename  */\n#define FLEN_KEYWORD   75  /* max length of a keyword (HIERARCH convention) */\n#define FLEN_CARD      81  /* length of a FITS header card */\n#define FLEN_VALUE     71  /* max length of a keyword value string */\n#define FLEN_COMMENT   73  /* max length of a keyword comment string */\n#define FLEN_ERRMSG    81  /* max length of a FITSIO error message */\n#define FLEN_STATUS    31  /* max length of a FITSIO status text string */\n \n#define TBIT          1  /* codes for FITS table data types */\n#define TBYTE        11\n#define TSBYTE       12\n#define TLOGICAL     14\n#define TSTRING      16\n#define TUSHORT      20\n#define TSHORT       21\n#define TUINT        30\n#define TINT         31\n#define TULONG       40\n#define TLONG        41\n#define TINT32BIT    41  /* used when returning datatype of a column */\n#define TFLOAT       42\n#define TULONGLONG   80\n#define TLONGLONG    81\n#define TDOUBLE      82\n#define TCOMPLEX     83\n#define TDBLCOMPLEX 163\n\n#define TYP_STRUC_KEY 10\n#define TYP_CMPRS_KEY 20\n#define TYP_SCAL_KEY  30\n#define TYP_NULL_KEY  40\n#define TYP_DIM_KEY   50\n#define TYP_RANG_KEY  60\n#define TYP_UNIT_KEY  70\n#define TYP_DISP_KEY  80\n#define TYP_HDUID_KEY 90\n#define TYP_CKSUM_KEY 100\n#define TYP_WCS_KEY   110\n#define TYP_REFSYS_KEY 120\n#define TYP_COMM_KEY  130\n#define TYP_CONT_KEY  140\n#define TYP_USER_KEY  150\n\n\n#define INT32BIT int  /* 32-bit integer datatype.  Currently this       */\n                      /* datatype is an 'int' on all useful platforms   */\n                      /* however, it is possible that that are cases    */\n                      /* where 'int' is a 2-byte integer, in which case */\n                      /* INT32BIT would need to be defined as 'long'.   */\n\n#define BYTE_IMG      8  /* BITPIX code values for FITS image types */\n#define SHORT_IMG    16\n#define LONG_IMG     32\n#define LONGLONG_IMG 64\n#define FLOAT_IMG   -32\n#define DOUBLE_IMG  -64\n                         /* The following 2 codes are not true FITS         */\n                         /* datatypes; these codes are only used internally */\n                         /* within cfitsio to make it easier for users      */\n                         /* to deal with unsigned integers.                 */\n#define SBYTE_IMG     10\n#define USHORT_IMG    20\n#define ULONG_IMG     40\n#define ULONGLONG_IMG 80\n\n#define IMAGE_HDU  0  /* Primary Array or IMAGE HDU */\n#define ASCII_TBL  1  /* ASCII table HDU  */\n#define BINARY_TBL 2  /* Binary table HDU */\n#define ANY_HDU   -1  /* matches any HDU type */\n\n#define READONLY  0    /* options when opening a file */\n#define READWRITE 1\n\n/* adopt a hopefully obscure number to use as a null value flag */\n/* could be problems if the FITS files contain data with these values */\n#define FLOATNULLVALUE -9.11912E-36F\n#define DOUBLENULLVALUE -9.1191291391491E-36\n \n/* compression algorithm codes */\n#define NO_DITHER -1\n#define SUBTRACTIVE_DITHER_1 1\n#define SUBTRACTIVE_DITHER_2 2\n#define MAX_COMPRESS_DIM     6\n#define RICE_1      11\n#define GZIP_1      21\n#define GZIP_2      22\n#define PLIO_1      31\n#define HCOMPRESS_1 41\n#define BZIP2_1     51  /* not publicly supported; only for test purposes */\n#define NOCOMPRESS  -1\n\n#ifndef TRUE\n#define TRUE 1\n#endif\n\n#ifndef FALSE\n#define FALSE 0\n#endif\n\n#define CASESEN   1   /* do case-sensitive string match */\n#define CASEINSEN 0   /* do case-insensitive string match */\n \n#define GT_ID_ALL_URI  0   /* hierarchical grouping parameters */\n#define GT_ID_REF      1\n#define GT_ID_POS      2\n#define GT_ID_ALL      3\n#define GT_ID_REF_URI 11\n#define GT_ID_POS_URI 12\n\n#define OPT_RM_GPT      0\n#define OPT_RM_ENTRY    1\n#define OPT_RM_MBR      2\n#define OPT_RM_ALL      3\n\n#define OPT_GCP_GPT     0\n#define OPT_GCP_MBR     1\n#define OPT_GCP_ALL     2\n\n#define OPT_MCP_ADD     0\n#define OPT_MCP_NADD    1\n#define OPT_MCP_REPL    2\n#define OPT_MCP_MOV     3\n\n#define OPT_MRG_COPY    0\n#define OPT_MRG_MOV     1\n\n#define OPT_CMT_MBR      1\n#define OPT_CMT_MBR_DEL 11\n\ntypedef struct        /* structure used to store table column information */\n{\n    char ttype[70];   /* column name = FITS TTYPEn keyword; */\n    LONGLONG tbcol;       /* offset in row to first byte of each column */\n    int  tdatatype;   /* datatype code of each column */\n    LONGLONG trepeat;    /* repeat count of column; number of elements */\n    double tscale;    /* FITS TSCALn linear scaling factor */\n    double tzero;     /* FITS TZEROn linear scaling zero point */\n    LONGLONG tnull;   /* FITS null value for int image or binary table cols */\n    char strnull[20]; /* FITS null value string for ASCII table columns */\n    char tform[10];   /* FITS tform keyword value  */\n    long  twidth;     /* width of each ASCII table column */\n}tcolumn;\n\n#define VALIDSTRUC 555  /* magic value used to identify if structure is valid */\n\ntypedef struct      /* structure used to store basic FITS file information */\n{\n    int filehandle;   /* handle returned by the file open function */\n    int driver;       /* defines which set of I/O drivers should be used */\n    int open_count;   /* number of opened 'fitsfiles' using this structure */\n    char *filename;   /* file name */\n    int validcode;    /* magic value used to verify that structure is valid */\n    int only_one;     /* flag meaning only copy the specified extension */\n    int noextsyntax;  /* flag for file opened with request to ignore extended syntax*/\n    LONGLONG filesize; /* current size of the physical disk file in bytes */\n    LONGLONG logfilesize; /* logical size of file, including unflushed buffers */\n    int lasthdu;      /* is this the last HDU in the file? 0 = no, else yes */\n    LONGLONG bytepos; /* current logical I/O pointer position in file */\n    LONGLONG io_pos;  /* current I/O pointer position in the physical file */\n    int curbuf;       /* number of I/O buffer currently in use */ \n    int curhdu;       /* current HDU number; 0 = primary array */\n    int hdutype;      /* 0 = primary array, 1 = ASCII table, 2 = binary table */\n    int writemode;    /* 0 = readonly, 1 = readwrite */\n    int maxhdu;       /* highest numbered HDU known to exist in the file */\n    int MAXHDU;       /* dynamically allocated dimension of headstart array */\n    LONGLONG *headstart; /* byte offset in file to start of each HDU */\n    LONGLONG headend;   /* byte offest in file to end of the current HDU header */\n    LONGLONG ENDpos;    /* byte offest to where the END keyword was last written */\n    LONGLONG nextkey;   /* byte offset in file to beginning of next keyword */\n    LONGLONG datastart; /* byte offset in file to start of the current data unit */\n    int imgdim;         /* dimension of image; cached for fast access */\n    LONGLONG imgnaxis[99]; /* length of each axis; cached for fast access */\n    int tfield;          /* number of fields in the table (primary array has 2 */\n    int startcol;        /* used by ffgcnn to record starting column number */\n    LONGLONG origrows;   /* original number of rows (value of NAXIS2 keyword)  */\n    LONGLONG numrows;    /* number of rows in the table (dynamically updated) */\n    LONGLONG rowlength;  /* length of a table row or image size (bytes) */\n    tcolumn *tableptr;   /* pointer to the table structure */\n    LONGLONG heapstart;  /* heap start byte relative to start of data unit */\n    LONGLONG heapsize;   /* size of the heap, in bytes */\n\n         /* the following elements are related to compressed images */\n\n    /* these record the 'requested' options to be used when the image is compressed */\n    int request_compress_type;  /* requested image compression algorithm */\n    long request_tilesize[MAX_COMPRESS_DIM]; /* requested tiling size */\n    float request_quantize_level;  /* requested quantize level */\n    int request_quantize_method ;  /* requested  quantizing method */\n    int request_dither_seed;     /* starting offset into the array of random dithering */\n    int request_lossy_int_compress; /* lossy compress integer image as if float image? */\n    int request_huge_hdu;          /* use '1Q' rather then '1P' variable length arrays */\n    float request_hcomp_scale;     /* requested HCOMPRESS scale factor */\n    int request_hcomp_smooth;      /* requested HCOMPRESS smooth parameter */\n\n    /* these record the actual options that were used when the image was compressed */\n    int compress_type;      /* type of compression algorithm */\n    long tilesize[MAX_COMPRESS_DIM]; /* size of compression tiles */\n    float quantize_level;   /* floating point quantization level */\n    int quantize_method;   /* floating point pixel quantization algorithm */\n    int dither_seed;      /* starting offset into the array of random dithering */\n\n    /* other compression parameters */\n    int compressimg; /* 1 if HDU contains a compressed image, else 0 */\n    char zcmptype[12];      /* compression type string */\n    int zbitpix;            /* FITS data type of image (BITPIX) */\n    int zndim;              /* dimension of image */\n    long znaxis[MAX_COMPRESS_DIM];  /* length of each axis */\n    long maxtilelen;        /* max number of pixels in each image tile */\n    long maxelem;\t    /* maximum byte length of tile compressed arrays */\n\n    int cn_compressed;\t    /* column number for COMPRESSED_DATA column */\n    int cn_uncompressed;    /* column number for UNCOMPRESSED_DATA column */\n    int cn_gzip_data;       /* column number for GZIP2 lossless compressed data */\n    int cn_zscale;\t    /* column number for ZSCALE column */\n    int cn_zzero;\t    /* column number for ZZERO column */\n    int cn_zblank;          /* column number for the ZBLANK column */\n\n    double zscale;          /* scaling value, if same for all tiles */\n    double zzero;           /* zero pt, if same for all tiles */\n    double cn_bscale;       /* value of the BSCALE keyword in header */\n    double cn_bzero;        /* value of the BZERO keyword (may be reset) */\n    double cn_actual_bzero; /* actual value of the BZERO keyword  */\n    int zblank;             /* value for null pixels, if not a column */\n\n    int rice_blocksize;     /* first compression parameter: Rice pixels/block */\n    int rice_bytepix;       /* 2nd compression parameter:   Rice bytes/pixel */\n    float hcomp_scale;      /* 1st hcompress compression parameter */\n    int hcomp_smooth;       /* 2nd hcompress compression parameter */\n\n    int  *tilerow;          /* row number of the array of uncompressed tiledata */\n    long *tiledatasize;     /* length of the array of tile data in bytes */\n    int *tiletype;          /* datatype of the array of tile (TINT, TSHORT, etc) */\n    void **tiledata;        /* array of uncompressed tile of data, for row *tilerow */\n    void **tilenullarray;   /* array of optional array of null value flags */\n    int *tileanynull;       /* anynulls in the array of tile? */\n\n    char *iobuffer;         /* pointer to FITS file I/O buffers */\n    long bufrecnum[NIOBUF]; /* file record number of each of the buffers */\n    int dirty[NIOBUF];     /* has the corresponding buffer been modified? */\n    int ageindex[NIOBUF];  /* relative age of each buffer */  \n} FITSfile;\n\ntypedef struct         /* structure used to store basic HDU information */\n{\n    int HDUposition;  /* HDU position in file; 0 = first HDU */\n    FITSfile *Fptr;   /* pointer to FITS file structure */\n}fitsfile;\n\ntypedef struct  /* structure for the iterator function column information */\n{  \n     /* elements required as input to fits_iterate_data: */\n\n    fitsfile *fptr;     /* pointer to the HDU containing the column */\n    int      colnum;    /* column number in the table (use name if < 1) */\n    char     colname[70]; /* name (= TTYPEn value) of the column (optional) */\n    int      datatype;  /* output datatype (converted if necessary  */\n    int      iotype;    /* = InputCol, InputOutputCol, or OutputCol */\n\n    /* output elements that may be useful for the work function: */\n\n    void     *array;    /* pointer to the array (and the null value) */\n    long     repeat;    /* binary table vector repeat value */\n    long     tlmin;     /* legal minimum data value */\n    long     tlmax;     /* legal maximum data value */\n    char     tunit[70]; /* physical unit string */\n    char     tdisp[70]; /* suggested display format */\n\n} iteratorCol;\n\n#define InputCol         0  /* flag for input only iterator column       */\n#define InputOutputCol   1  /* flag for input and output iterator column */\n#define OutputCol        2  /* flag for output only iterator column      */\n\n/*=============================================================================\n*\n*       The following wtbarr typedef is used in the fits_read_wcstab() routine,\n*       which is intended for use with the WCSLIB library written by Mark\n*       Calabretta, http://www.atnf.csiro.au/~mcalabre/index.html\n*\n*       In order to maintain WCSLIB and CFITSIO as independent libraries it\n*       was not permissible for any CFITSIO library code to include WCSLIB\n*       header files, or vice versa.  However, the CFITSIO function\n*       fits_read_wcstab() accepts an array of structs defined by wcs.h within\n*       WCSLIB.  The problem then was to define this struct within fitsio.h\n*       without including wcs.h, especially noting that wcs.h will often (but\n*       not always) be included together with fitsio.h in an applications\n*       program that uses fits_read_wcstab().\n*\n*       Of the various possibilities, the solution adopted was for WCSLIB to\n*       define \"struct wtbarr\" while fitsio.h defines \"typedef wtbarr\", a\n*       untagged struct with identical members.  This allows both wcs.h and\n*       fitsio.h to define a wtbarr data type without conflict by virtue of\n*       the fact that structure tags and typedef names share different\n*       namespaces in C. Therefore, declarations within WCSLIB look like\n*\n*          struct wtbarr *w;\n*\n*       while within CFITSIO they are simply\n*\n*          wtbarr *w;\n*\n*       but as suggested by the commonality of the names, these are really the\n*       same aggregate data type.  However, in passing a (struct wtbarr *) to\n*       fits_read_wcstab() a cast to (wtbarr *) is formally required.\n*===========================================================================*/\n\n#ifndef WCSLIB_GETWCSTAB\n#define WCSLIB_GETWCSTAB\n\ntypedef struct {\n   int  i;                      /* Image axis number.                       */\n   int  m;                      /* Array axis number for index vectors.     */\n   int  kind;                   /* Array type, 'c' (coord) or 'i' (index).  */\n   char extnam[72];             /* EXTNAME of binary table extension.       */\n   int  extver;                 /* EXTVER  of binary table extension.       */\n   int  extlev;                 /* EXTLEV  of binary table extension.       */\n   char ttype[72];              /* TTYPEn of column containing the array.   */\n   long row;                    /* Table row number.                        */\n   int  ndim;                   /* Expected array dimensionality.           */\n   int  *dimlen;                /* Where to write the array axis lengths.   */\n   double **arrayp;             /* Where to write the address of the array  */\n                                /* allocated to store the array.            */\n} wtbarr;\n\n/*  The following exclusion if __CINT__ is defined is needed for ROOT */\n#ifndef __CINT__\n/*  the following 3 lines are needed to support C++ compilers */\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n#endif\n\nint CFITS_API fits_read_wcstab(fitsfile *fptr, int nwtb, wtbarr *wtb, int *status);\n\n/*  The following exclusion if __CINT__ is defined is needed for ROOT */\n#ifndef __CINT__\n#ifdef __cplusplus\n}\n#endif\n#endif\n\n#endif /* WCSLIB_GETWCSTAB */\n\n/* error status codes */\n\n#define CREATE_DISK_FILE -106 /* create disk file, without extended filename syntax */\n#define OPEN_DISK_FILE   -105 /* open disk file, without extended filename syntax */\n#define SKIP_TABLE       -104 /* move to 1st image when opening file */\n#define SKIP_IMAGE       -103 /* move to 1st table when opening file */\n#define SKIP_NULL_PRIMARY -102 /* skip null primary array when opening file */\n#define USE_MEM_BUFF     -101  /* use memory buffer when opening file */\n#define OVERFLOW_ERR      -11  /* overflow during datatype conversion */\n#define PREPEND_PRIMARY    -9  /* used in ffiimg to insert new primary array */\n#define SAME_FILE         101  /* input and output files are the same */\n#define TOO_MANY_FILES    103  /* tried to open too many FITS files */\n#define FILE_NOT_OPENED   104  /* could not open the named file */\n#define FILE_NOT_CREATED  105  /* could not create the named file */\n#define WRITE_ERROR       106  /* error writing to FITS file */\n#define END_OF_FILE       107  /* tried to move past end of file */\n#define READ_ERROR        108  /* error reading from FITS file */\n#define FILE_NOT_CLOSED   110  /* could not close the file */\n#define ARRAY_TOO_BIG     111  /* array dimensions exceed internal limit */\n#define READONLY_FILE     112  /* Cannot write to readonly file */\n#define MEMORY_ALLOCATION 113  /* Could not allocate memory */\n#define BAD_FILEPTR       114  /* invalid fitsfile pointer */\n#define NULL_INPUT_PTR    115  /* NULL input pointer to routine */\n#define SEEK_ERROR        116  /* error seeking position in file */\n#define BAD_NETTIMEOUT    117  /* bad value for file download timeout setting */\n\n#define BAD_URL_PREFIX    121  /* invalid URL prefix on file name */\n#define TOO_MANY_DRIVERS  122  /* tried to register too many IO drivers */\n#define DRIVER_INIT_FAILED 123  /* driver initialization failed */\n#define NO_MATCHING_DRIVER 124  /* matching driver is not registered */\n#define URL_PARSE_ERROR    125  /* failed to parse input file URL */\n#define RANGE_PARSE_ERROR  126  /* failed to parse input file URL */\n\n#define\tSHARED_ERRBASE\t(150)\n#define\tSHARED_BADARG\t(SHARED_ERRBASE + 1)\n#define\tSHARED_NULPTR\t(SHARED_ERRBASE + 2)\n#define\tSHARED_TABFULL\t(SHARED_ERRBASE + 3)\n#define\tSHARED_NOTINIT\t(SHARED_ERRBASE + 4)\n#define\tSHARED_IPCERR\t(SHARED_ERRBASE + 5)\n#define\tSHARED_NOMEM\t(SHARED_ERRBASE + 6)\n#define\tSHARED_AGAIN\t(SHARED_ERRBASE + 7)\n#define\tSHARED_NOFILE\t(SHARED_ERRBASE + 8)\n#define\tSHARED_NORESIZE\t(SHARED_ERRBASE + 9)\n\n#define HEADER_NOT_EMPTY  201  /* header already contains keywords */\n#define KEY_NO_EXIST      202  /* keyword not found in header */\n#define KEY_OUT_BOUNDS    203  /* keyword record number is out of bounds */\n#define VALUE_UNDEFINED   204  /* keyword value field is blank */\n#define NO_QUOTE          205  /* string is missing the closing quote */\n#define BAD_INDEX_KEY     206  /* illegal indexed keyword name */\n#define BAD_KEYCHAR       207  /* illegal character in keyword name or card */\n#define BAD_ORDER         208  /* required keywords out of order */\n#define NOT_POS_INT       209  /* keyword value is not a positive integer */\n#define NO_END            210  /* couldn't find END keyword */\n#define BAD_BITPIX        211  /* illegal BITPIX keyword value*/\n#define BAD_NAXIS         212  /* illegal NAXIS keyword value */\n#define BAD_NAXES         213  /* illegal NAXISn keyword value */\n#define BAD_PCOUNT        214  /* illegal PCOUNT keyword value */\n#define BAD_GCOUNT        215  /* illegal GCOUNT keyword value */\n#define BAD_TFIELDS       216  /* illegal TFIELDS keyword value */\n#define NEG_WIDTH         217  /* negative table row size */\n#define NEG_ROWS          218  /* negative number of rows in table */\n#define COL_NOT_FOUND     219  /* column with this name not found in table */\n#define BAD_SIMPLE        220  /* illegal value of SIMPLE keyword  */\n#define NO_SIMPLE         221  /* Primary array doesn't start with SIMPLE */\n#define NO_BITPIX         222  /* Second keyword not BITPIX */\n#define NO_NAXIS          223  /* Third keyword not NAXIS */\n#define NO_NAXES          224  /* Couldn't find all the NAXISn keywords */\n#define NO_XTENSION       225  /* HDU doesn't start with XTENSION keyword */\n#define NOT_ATABLE        226  /* the CHDU is not an ASCII table extension */\n#define NOT_BTABLE        227  /* the CHDU is not a binary table extension */\n#define NO_PCOUNT         228  /* couldn't find PCOUNT keyword */\n#define NO_GCOUNT         229  /* couldn't find GCOUNT keyword */\n#define NO_TFIELDS        230  /* couldn't find TFIELDS keyword */\n#define NO_TBCOL          231  /* couldn't find TBCOLn keyword */\n#define NO_TFORM          232  /* couldn't find TFORMn keyword */\n#define NOT_IMAGE         233  /* the CHDU is not an IMAGE extension */\n#define BAD_TBCOL         234  /* TBCOLn keyword value < 0 or > rowlength */\n#define NOT_TABLE         235  /* the CHDU is not a table */\n#define COL_TOO_WIDE      236  /* column is too wide to fit in table */\n#define COL_NOT_UNIQUE    237  /* more than 1 column name matches template */\n#define BAD_ROW_WIDTH     241  /* sum of column widths not = NAXIS1 */\n#define UNKNOWN_EXT       251  /* unrecognizable FITS extension type */\n#define UNKNOWN_REC       252  /* unrecognizable FITS record */\n#define END_JUNK          253  /* END keyword is not blank */\n#define BAD_HEADER_FILL   254  /* Header fill area not blank */\n#define BAD_DATA_FILL     255  /* Data fill area not blank or zero */\n#define BAD_TFORM         261  /* illegal TFORM format code */\n#define BAD_TFORM_DTYPE   262  /* unrecognizable TFORM datatype code */\n#define BAD_TDIM          263  /* illegal TDIMn keyword value */\n#define BAD_HEAP_PTR      264  /* invalid BINTABLE heap address */\n \n#define BAD_HDU_NUM       301  /* HDU number < 1 or > MAXHDU */\n#define BAD_COL_NUM       302  /* column number < 1 or > tfields */\n#define NEG_FILE_POS      304  /* tried to move before beginning of file  */\n#define NEG_BYTES         306  /* tried to read or write negative bytes */\n#define BAD_ROW_NUM       307  /* illegal starting row number in table */\n#define BAD_ELEM_NUM      308  /* illegal starting element number in vector */\n#define NOT_ASCII_COL     309  /* this is not an ASCII string column */\n#define NOT_LOGICAL_COL   310  /* this is not a logical datatype column */\n#define BAD_ATABLE_FORMAT 311  /* ASCII table column has wrong format */\n#define BAD_BTABLE_FORMAT 312  /* Binary table column has wrong format */\n#define NO_NULL           314  /* null value has not been defined */\n#define NOT_VARI_LEN      317  /* this is not a variable length column */\n#define BAD_DIMEN         320  /* illegal number of dimensions in array */\n#define BAD_PIX_NUM       321  /* first pixel number greater than last pixel */\n#define ZERO_SCALE        322  /* illegal BSCALE or TSCALn keyword = 0 */\n#define NEG_AXIS          323  /* illegal axis length < 1 */\n \n#define NOT_GROUP_TABLE         340\n#define HDU_ALREADY_MEMBER      341\n#define MEMBER_NOT_FOUND        342\n#define GROUP_NOT_FOUND         343\n#define BAD_GROUP_ID            344\n#define TOO_MANY_HDUS_TRACKED   345\n#define HDU_ALREADY_TRACKED     346\n#define BAD_OPTION              347\n#define IDENTICAL_POINTERS      348\n#define BAD_GROUP_ATTACH        349\n#define BAD_GROUP_DETACH        350\n\n#define BAD_I2C           401  /* bad int to formatted string conversion */\n#define BAD_F2C           402  /* bad float to formatted string conversion */\n#define BAD_INTKEY        403  /* can't interprete keyword value as integer */\n#define BAD_LOGICALKEY    404  /* can't interprete keyword value as logical */\n#define BAD_FLOATKEY      405  /* can't interprete keyword value as float */\n#define BAD_DOUBLEKEY     406  /* can't interprete keyword value as double */\n#define BAD_C2I           407  /* bad formatted string to int conversion */\n#define BAD_C2F           408  /* bad formatted string to float conversion */\n#define BAD_C2D           409  /* bad formatted string to double conversion */\n#define BAD_DATATYPE      410  /* bad keyword datatype code */\n#define BAD_DECIM         411  /* bad number of decimal places specified */\n#define NUM_OVERFLOW      412  /* overflow during datatype conversion */\n\n# define DATA_COMPRESSION_ERR 413  /* error in imcompress routines */\n# define DATA_DECOMPRESSION_ERR 414 /* error in imcompress routines */\n# define NO_COMPRESSED_TILE  415 /* compressed tile doesn't exist */\n\n#define BAD_DATE          420  /* error in date or time conversion */\n\n#define PARSE_SYNTAX_ERR  431  /* syntax error in parser expression */\n#define PARSE_BAD_TYPE    432  /* expression did not evaluate to desired type */\n#define PARSE_LRG_VECTOR  433  /* vector result too large to return in array */\n#define PARSE_NO_OUTPUT   434  /* data parser failed not sent an out column */\n#define PARSE_BAD_COL     435  /* bad data encounter while parsing column */\n#define PARSE_BAD_OUTPUT  436  /* Output file not of proper type          */\n\n#define ANGLE_TOO_BIG     501  /* celestial angle too large for projection */\n#define BAD_WCS_VAL       502  /* bad celestial coordinate or pixel value */\n#define WCS_ERROR         503  /* error in celestial coordinate calculation */\n#define BAD_WCS_PROJ      504  /* unsupported type of celestial projection */\n#define NO_WCS_KEY        505  /* celestial coordinate keywords not found */\n#define APPROX_WCS_KEY    506  /* approximate WCS keywords were calculated */\n\n#define NO_CLOSE_ERROR    999  /* special value used internally to switch off */\n                               /* the error message from ffclos and ffchdu */\n\n/*------- following error codes are used in the grparser.c file -----------*/\n#define\tNGP_ERRBASE\t\t(360)\t\t\t/* base chosen so not to interfere with CFITSIO */\n#define\tNGP_OK\t\t\t(0)\n#define\tNGP_NO_MEMORY\t\t(NGP_ERRBASE + 0)\t/* malloc failed */\n#define\tNGP_READ_ERR\t\t(NGP_ERRBASE + 1)\t/* read error from file */\n#define\tNGP_NUL_PTR\t\t(NGP_ERRBASE + 2)\t/* null pointer passed as argument */\n#define\tNGP_EMPTY_CURLINE\t(NGP_ERRBASE + 3)\t/* line read seems to be empty */\n#define\tNGP_UNREAD_QUEUE_FULL\t(NGP_ERRBASE + 4)\t/* cannot unread more then 1 line (or single line twice) */\n#define\tNGP_INC_NESTING\t\t(NGP_ERRBASE + 5)\t/* too deep include file nesting (inf. loop ?) */\n#define\tNGP_ERR_FOPEN\t\t(NGP_ERRBASE + 6)\t/* fopen() failed, cannot open file */\n#define\tNGP_EOF\t\t\t(NGP_ERRBASE + 7)\t/* end of file encountered */\n#define\tNGP_BAD_ARG\t\t(NGP_ERRBASE + 8)\t/* bad arguments passed */\n#define\tNGP_TOKEN_NOT_EXPECT\t(NGP_ERRBASE + 9)\t/* token not expected here */\n\n/*  The following exclusion if __CINT__ is defined is needed for ROOT */\n#ifndef __CINT__\n/*  the following 3 lines are needed to support C++ compilers */\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n#endif\n\nint CFITS2Unit( fitsfile *fptr );\nCFITS_API fitsfile* CUnit2FITS(int unit);\n\n/*----------------  FITS file URL parsing routines -------------*/\nint CFITS_API fits_get_token (char **ptr, char *delimiter, char *token, int *isanumber);\nint CFITS_API fits_get_token2(char **ptr, char *delimiter, char **token, int *isanumber, int *status);\nchar  CFITS_API *fits_split_names(char *list);\nint CFITS_API ffiurl(  char *url,  char *urltype, char *infile,\n                    char *outfile, char *extspec, char *rowfilter,\n                    char *binspec, char *colspec, int *status);\nint CFITS_API ffifile (char *url,  char *urltype, char *infile,\n                    char *outfile, char *extspec, char *rowfilter,\n                    char *binspec, char *colspec, char *pixfilter, int *status);\nint CFITS_API ffifile2 (char *url,  char *urltype, char *infile,\n                    char *outfile, char *extspec, char *rowfilter,\n                    char *binspec, char *colspec, char *pixfilter, char *compspec, int *status);\nint CFITS_API ffrtnm(char *url, char *rootname, int *status);\nint CFITS_API ffexist(const char *infile, int *exists, int *status);\nint CFITS_API ffexts(char *extspec, int *extnum,  char *extname, int *extvers,\n          int *hdutype, char *colname, char *rowexpress, int *status);\nint CFITS_API ffextn(char *url, int *extension_num, int *status);\nint CFITS_API ffurlt(fitsfile *fptr, char *urlType, int *status);\nint CFITS_API ffbins(char *binspec, int *imagetype, int *haxis, \n                      char colname[4][FLEN_VALUE], double *minin,\n                      double *maxin, double *binsizein,\n                      char minname[4][FLEN_VALUE], char maxname[4][FLEN_VALUE],\n                      char binname[4][FLEN_VALUE], double *weight, char *wtname,\n                      int *recip, int *status);\nint CFITS_API ffbinr(char **binspec, char *colname, double *minin, \n                        double *maxin, double *binsizein, char *minname,\n                        char *maxname, char *binname, int *status);\nint CFITS_API fits_copy_cell2image(fitsfile *fptr, fitsfile *newptr, char *colname,\n                      long rownum, int *status);\nint CFITS_API fits_copy_image2cell(fitsfile *fptr, fitsfile *newptr, char *colname,\n                      long rownum, int copykeyflag, int *status);\nint CFITS_API fits_copy_pixlist2image(fitsfile *infptr, fitsfile *outfptr, int firstkey,       /* I - first HDU record number to start with */\n           int naxis, int *colnum, int *status);\nint CFITS_API ffimport_file( char *filename, char **contents, int *status );\nint CFITS_API ffrwrg( char *rowlist, LONGLONG maxrows, int maxranges, int *numranges,\n      long *minrow, long *maxrow, int *status);\nint CFITS_API ffrwrgll( char *rowlist, LONGLONG maxrows, int maxranges, int *numranges,\n      LONGLONG *minrow, LONGLONG *maxrow, int *status);\n/*----------------  FITS file I/O routines -------------*/\nint CFITS_API fits_init_cfitsio(void);\nint CFITS_API ffomem(fitsfile **fptr, const char *name, int mode, void **buffptr,\n           size_t *buffsize, size_t deltasize,\n           void *(*mem_realloc)(void *p, size_t newsize),\n           int *status);\nint CFITS_API ffopen(fitsfile **fptr, const char *filename, int iomode, int *status);\nint CFITS_API ffopentest(int soname, fitsfile **fptr, const char *filename, int iomode, int *status);\n\nint CFITS_API ffdopn(fitsfile **fptr, const char *filename, int iomode, int *status);\nint CFITS_API ffeopn(fitsfile **fptr, const char *filename, int iomode, \n     char *extlist, int *hdutype, int *status);\nint CFITS_API fftopn(fitsfile **fptr, const char *filename, int iomode, int *status);\nint CFITS_API ffiopn(fitsfile **fptr, const char *filename, int iomode, int *status);\nint CFITS_API ffdkopn(fitsfile **fptr, const char *filename, int iomode, int *status);\nint CFITS_API ffreopen(fitsfile *openfptr, fitsfile **newfptr, int *status); \nint CFITS_API ffinit(  fitsfile **fptr, const char *filename, int *status);\nint CFITS_API ffdkinit(fitsfile **fptr, const char *filename, int *status);\nint CFITS_API ffimem(fitsfile **fptr,  void **buffptr,\n           size_t *buffsize, size_t deltasize,\n           void *(*mem_realloc)(void *p, size_t newsize),\n           int *status);\nint CFITS_API fftplt(fitsfile **fptr, const char *filename, const char *tempname,\n           int *status);\nint CFITS_API ffflus(fitsfile *fptr, int *status);\nint CFITS_API ffflsh(fitsfile *fptr, int clearbuf, int *status);\nint CFITS_API ffclos(fitsfile *fptr, int *status);\nint CFITS_API ffdelt(fitsfile *fptr, int *status);\nint CFITS_API ffflnm(fitsfile *fptr, char *filename, int *status);\nint CFITS_API ffflmd(fitsfile *fptr, int *filemode, int *status);\nint CFITS_API fits_delete_iraf_file(const char *filename, int *status);\n\n/*---------------- utility routines -------------*/\n\nfloat CFITS_API ffvers(float *version);\nvoid CFITS_API ffupch(char *string);\nvoid CFITS_API ffgerr(int status, char *errtext);\nvoid CFITS_API ffpmsg(const char *err_message);\nvoid CFITS_API ffpmrk(void);\nint  CFITS_API ffgmsg(char *err_message);\nvoid CFITS_API ffcmsg(void);\nvoid CFITS_API ffcmrk(void);\nvoid CFITS_API ffrprt(FILE *stream, int status);\nvoid CFITS_API ffcmps(char *templt, char *colname, int  casesen, int *match,\n           int *exact);\nint CFITS_API fftkey(const char *keyword, int *status);\nint CFITS_API fftrec(char *card, int *status);\nint CFITS_API ffnchk(fitsfile *fptr, int *status);\nint CFITS_API ffkeyn(const char *keyroot, int value, char *keyname, int *status);\nint CFITS_API ffnkey(int value, const char *keyroot, char *keyname, int *status);\nint CFITS_API ffgkcl(char *card);\nint CFITS_API ffdtyp(const char *cval, char *dtype, int *status);\nint CFITS_API ffinttyp(char *cval, int *datatype, int *negative, int *status);\nint CFITS_API ffpsvc(char *card, char *value, char *comm, int *status);\nint CFITS_API ffgknm(char *card, char *name, int *length, int *status);\nint CFITS_API ffgthd(char *tmplt, char *card, int *hdtype, int *status);\nint CFITS_API ffmkky(const char *keyname, char *keyval, const char *comm, char *card, int *status);\nint CFITS_API fits_translate_keyword(char *inrec, char *outrec, char *patterns[][2],\n          int npat, int n_value, int n_offset, int n_range, int *pat_num,\n          int *i, int *j,  int *m, int *n, int *status);\nint CFITS_API fits_translate_keywords(fitsfile *infptr, fitsfile *outfptr,\n          int firstkey, char *patterns[][2],\n          int npat, int n_value, int n_offset, int n_range, int *status);    \nint CFITS_API ffasfm(char *tform, int *datacode, long *width, int *decim, int *status);\nint CFITS_API ffbnfm(char *tform, int *datacode, long *repeat, long *width, int *status);\nint CFITS_API ffbnfmll(char *tform, int *datacode, LONGLONG *repeat, long *width, int *status);\nint CFITS_API ffgabc(int tfields, char **tform, int space, long *rowlen, long *tbcol,\n           int *status);\nint CFITS_API fits_get_section_range(char **ptr,long *secmin,long *secmax,long *incre,\n              int *status);\n/* ffmbyt should not normally be used in application programs, but it is\n   defined here as a publicly available routine because there are a few\n   rare cases where it is needed\n*/ \nint CFITS_API ffmbyt(fitsfile *fptr, LONGLONG bytpos, int ignore_err, int *status);\n/*----------------- write single keywords --------------*/\nint CFITS_API ffpky(fitsfile *fptr, int datatype, const char *keyname, void *value,\n          const char *comm, int *status);\nint CFITS_API ffprec(fitsfile *fptr, const char *card, int *status);\nint CFITS_API ffpcom(fitsfile *fptr, const char *comm, int *status);\nint CFITS_API ffpunt(fitsfile *fptr, const char *keyname, const char *unit, int *status);\nint CFITS_API ffphis(fitsfile *fptr, const char *history, int *status);\nint CFITS_API ffpdat(fitsfile *fptr, int *status);\nint CFITS_API ffverifydate(int year, int month, int day, int *status);\nint CFITS_API ffgstm(char *timestr, int *timeref, int *status);\nint CFITS_API ffgsdt(int *day, int *month, int *year, int *status);\nint CFITS_API ffdt2s(int year, int month, int day, char *datestr, int *status);\nint CFITS_API fftm2s(int year, int month, int day, int hour, int minute, double second,\n          int decimals, char *datestr, int *status);\nint CFITS_API ffs2dt(char *datestr, int *year, int *month, int *day, int *status);\nint CFITS_API ffs2tm(char *datestr, int *year, int *month, int *day, int *hour,\n          int *minute, double *second, int *status);\nint CFITS_API ffpkyu(fitsfile *fptr, const char *keyname, const char *comm, int *status);\nint CFITS_API ffpkys(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status);\nint CFITS_API ffpkls(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status);\nint CFITS_API ffplsw(fitsfile *fptr, int *status);\nint CFITS_API ffpkyl(fitsfile *fptr, const char *keyname, int  value, const char *comm, int *status);\nint CFITS_API ffpkyj(fitsfile *fptr, const char *keyname, LONGLONG value, const char *comm, int *status);\nint CFITS_API ffpkyuj(fitsfile *fptr, const char *keyname, ULONGLONG value, const char *comm, int *status);\nint CFITS_API ffpkyf(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffpkye(fitsfile *fptr, const char *keyname, float  value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffpkyg(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffpkyd(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffpkyc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffpkym(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffpkfc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffpkfm(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffpkyt(fitsfile *fptr, const char *keyname, long intval, double frac, const char *comm,\n          int *status);\nint CFITS_API ffptdm( fitsfile *fptr, int colnum, int naxis, long naxes[], int *status);\nint CFITS_API ffptdmll( fitsfile *fptr, int colnum, int naxis, LONGLONG naxes[], int *status);\n\n/*----------------- write array of keywords --------------*/\nint CFITS_API ffpkns(fitsfile *fptr, const char *keyroot, int nstart, int nkey, char *value[],\n           char *comm[], int *status);\nint CFITS_API ffpknl(fitsfile *fptr, const char *keyroot, int nstart, int nkey, int *value,\n           char *comm[], int *status);\nint CFITS_API ffpknj(fitsfile *fptr, const char *keyroot, int nstart, int nkey, long *value,\n           char *comm[], int *status);\nint CFITS_API ffpknjj(fitsfile *fptr, const char *keyroot, int nstart, int nkey, LONGLONG *value,\n           char *comm[], int *status);\nint CFITS_API ffpknf(fitsfile *fptr, const char *keyroot, int nstart, int nkey, float *value,\n           int decim, char *comm[], int *status);\nint CFITS_API ffpkne(fitsfile *fptr, const char *keyroot, int nstart, int nkey, float *value,\n           int decim, char *comm[], int *status);\nint CFITS_API ffpkng(fitsfile *fptr, const char *keyroot, int nstart, int nkey, double *value,\n           int decim, char *comm[], int *status);\nint CFITS_API ffpknd(fitsfile *fptr, const char *keyroot, int nstart, int nkey, double *value,\n           int decim, char *comm[], int *status);\nint CFITS_API ffcpky(fitsfile *infptr,fitsfile *outfptr,int incol,int outcol,\n           char *rootname, int *status); \n\n/*----------------- write required header keywords --------------*/\nint CFITS_API ffphps( fitsfile *fptr, int bitpix, int naxis, long naxes[], int *status);\nint CFITS_API ffphpsll( fitsfile *fptr, int bitpix, int naxis, LONGLONG naxes[], int *status);\nint CFITS_API ffphpr( fitsfile *fptr, int simple, int bitpix, int naxis, long naxes[],\n            LONGLONG pcount, LONGLONG gcount, int extend, int *status);\nint CFITS_API ffphprll( fitsfile *fptr, int simple, int bitpix, int naxis, LONGLONG naxes[],\n            LONGLONG pcount, LONGLONG gcount, int extend, int *status);\nint CFITS_API ffphtb(fitsfile *fptr, LONGLONG naxis1, LONGLONG naxis2, int tfields, char **ttype,\n          long *tbcol, char **tform, char **tunit, const char *extname, int *status);\nint CFITS_API ffphbn(fitsfile *fptr, LONGLONG naxis2, int tfields, char **ttype,\n          char **tform, char **tunit, const char *extname, LONGLONG pcount, int *status);\nint CFITS_API ffphext( fitsfile *fptr, const char *xtension, int bitpix, int naxis, long naxes[],\n            LONGLONG pcount, LONGLONG gcount, int *status);\n/*----------------- write template keywords --------------*/\nint CFITS_API ffpktp(fitsfile *fptr, const char *filename, int *status);\n\n/*------------------ get header information --------------*/\nint CFITS_API ffghsp(fitsfile *fptr, int *nexist, int *nmore, int *status);\nint CFITS_API ffghps(fitsfile *fptr, int *nexist, int *position, int *status);\n \n/*------------------ move position in header -------------*/\nint CFITS_API ffmaky(fitsfile *fptr, int nrec, int *status);\nint CFITS_API ffmrky(fitsfile *fptr, int nrec, int *status);\n \n/*------------------ read single keywords -----------------*/\nint CFITS_API ffgnxk(fitsfile *fptr, char **inclist, int ninc, char **exclist,\n           int nexc, char *card, int  *status);\nint CFITS_API ffgrec(fitsfile *fptr, int nrec,      char *card, int *status);\nint CFITS_API ffgcrd(fitsfile *fptr, const char *keyname, char *card, int *status);\nint CFITS_API ffgstr(fitsfile *fptr, const char *string, char *card, int *status);\nint CFITS_API ffgunt(fitsfile *fptr, const char *keyname, char *unit, int  *status);\nint CFITS_API ffgkyn(fitsfile *fptr, int nkey, char *keyname, char *keyval, char *comm,\n           int *status);\nint CFITS_API ffgkey(fitsfile *fptr, const char *keyname, char *keyval, char *comm,\n           int *status);\n \nint CFITS_API ffgky( fitsfile *fptr, int datatype, const char *keyname, void *value,\n           char *comm, int *status);\nint CFITS_API ffgkys(fitsfile *fptr, const char *keyname, char *value, char *comm, int *status);\nint CFITS_API ffgksl(fitsfile *fptr, const char *keyname, int *length, int *status);\nint CFITS_API ffgkls(fitsfile *fptr, const char *keyname, char **value, char *comm, int *status);\nint CFITS_API ffgsky(fitsfile *fptr, const char *keyname, int firstchar, int maxchar,\n               char *value, int *valuelen, char *comm, int *status);\nint CFITS_API fffree(void *value,  int  *status); \nint CFITS_API fffkls(char *value, int *status);\nint CFITS_API ffgkyl(fitsfile *fptr, const char *keyname, int *value, char *comm, int *status);\nint CFITS_API ffgkyj(fitsfile *fptr, const char *keyname, long *value, char *comm, int *status);\nint CFITS_API ffgkyjj(fitsfile *fptr, const char *keyname, LONGLONG *value, char *comm, int *status);\nint CFITS_API ffgkyujj(fitsfile *fptr, const char *keyname, ULONGLONG *value, char *comm, int *status);\nint CFITS_API ffgkye(fitsfile *fptr, const char *keyname, float *value, char *comm,int *status);\nint CFITS_API ffgkyd(fitsfile *fptr, const char *keyname, double *value,char *comm,int *status);\nint CFITS_API ffgkyc(fitsfile *fptr, const char *keyname, float *value, char *comm,int *status);\nint CFITS_API ffgkym(fitsfile *fptr, const char *keyname, double *value,char *comm,int *status);\nint CFITS_API ffgkyt(fitsfile *fptr, const char *keyname, long *ivalue, double *dvalue,\n           char *comm, int *status);\nint CFITS_API ffgtdm(fitsfile *fptr, int colnum, int maxdim, int *naxis, long naxes[],\n           int *status);\nint CFITS_API ffgtdmll(fitsfile *fptr, int colnum, int maxdim, int *naxis, LONGLONG naxes[],\n           int *status);\nint CFITS_API ffdtdm(fitsfile *fptr, char *tdimstr, int colnum, int maxdim,\n           int *naxis, long naxes[], int *status);\nint CFITS_API ffdtdmll(fitsfile *fptr, char *tdimstr, int colnum, int maxdim,\n           int *naxis, LONGLONG naxes[], int *status);\n\n/*------------------ read array of keywords -----------------*/\nint CFITS_API ffgkns(fitsfile *fptr, const char *keyname, int nstart, int nmax, char *value[],\n           int *nfound,  int *status);\nint CFITS_API ffgknl(fitsfile *fptr, const char *keyname, int nstart, int nmax, int *value,\n           int *nfound, int *status);\nint CFITS_API ffgknj(fitsfile *fptr, const char *keyname, int nstart, int nmax, long *value,\n           int *nfound, int *status);\nint CFITS_API ffgknjj(fitsfile *fptr, const char *keyname, int nstart, int nmax, LONGLONG *value,\n           int *nfound, int *status);\nint CFITS_API ffgkne(fitsfile *fptr, const char *keyname, int nstart, int nmax, float *value,\n           int *nfound, int *status);\nint CFITS_API ffgknd(fitsfile *fptr, const char *keyname, int nstart, int nmax, double *value,\n           int *nfound, int *status);\nint CFITS_API ffh2st(fitsfile *fptr, char **header, int  *status);\nint CFITS_API ffhdr2str( fitsfile *fptr,  int exclude_comm, char **exclist,\n   int nexc, char **header, int *nkeys, int  *status);\nint CFITS_API ffcnvthdr2str( fitsfile *fptr,  int exclude_comm, char **exclist,\n   int nexc, char **header, int *nkeys, int  *status);\n\n/*----------------- read required header keywords --------------*/\nint CFITS_API ffghpr(fitsfile *fptr, int maxdim, int *simple, int *bitpix, int *naxis,\n          long naxes[], long *pcount, long *gcount, int *extend, int *status);\n \nint CFITS_API ffghprll(fitsfile *fptr, int maxdim, int *simple, int *bitpix, int *naxis,\n          LONGLONG naxes[], long *pcount, long *gcount, int *extend, int *status);\n\nint CFITS_API ffghtb(fitsfile *fptr,int maxfield, long *naxis1, long *naxis2,\n           int *tfields, char **ttype, long *tbcol, char **tform, char **tunit,\n           char *extname,  int *status);\n\nint CFITS_API ffghtbll(fitsfile *fptr,int maxfield, LONGLONG *naxis1, LONGLONG *naxis2,\n           int *tfields, char **ttype, LONGLONG *tbcol, char **tform, char **tunit,\n           char *extname,  int *status);\n \n \nint CFITS_API ffghbn(fitsfile *fptr, int maxfield, long *naxis2, int *tfields,\n           char **ttype, char **tform, char **tunit, char *extname,\n           long *pcount, int *status);\n\nint CFITS_API ffghbnll(fitsfile *fptr, int maxfield, LONGLONG *naxis2, int *tfields,\n           char **ttype, char **tform, char **tunit, char *extname,\n           LONGLONG *pcount, int *status);\n\n/*--------------------- update keywords ---------------*/\nint CFITS_API ffuky(fitsfile *fptr, int datatype, const char *keyname, void *value,\n          const char *comm, int *status);\nint CFITS_API ffucrd(fitsfile *fptr, const char *keyname, const char *card, int *status);\nint CFITS_API ffukyu(fitsfile *fptr, const char *keyname, const char *comm, int *status);\nint CFITS_API ffukys(fitsfile *fptr, const char *keyname, const char *value, const char *comm, int *status);\nint CFITS_API ffukls(fitsfile *fptr, const char *keyname, const char *value, const char *comm, int *status);\nint CFITS_API ffukyl(fitsfile *fptr, const char *keyname, int value, const char *comm, int *status);\nint CFITS_API ffukyj(fitsfile *fptr, const char *keyname, LONGLONG value, const char *comm, int *status);\nint CFITS_API ffukyf(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffukye(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffukyg(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffukyd(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffukyc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffukym(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffukfc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffukfm(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm,\n          int *status);\n\n/*--------------------- modify keywords ---------------*/\nint CFITS_API ffmrec(fitsfile *fptr, int nkey, const char *card, int *status);\nint CFITS_API ffmcrd(fitsfile *fptr, const char *keyname, const char *card, int *status);\nint CFITS_API ffmnam(fitsfile *fptr, const char *oldname, const char *newname, int *status);\nint CFITS_API ffmcom(fitsfile *fptr, const char *keyname, const char *comm, int *status);\nint CFITS_API ffmkyu(fitsfile *fptr, const char *keyname, const char *comm, int *status);\nint CFITS_API ffmkys(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status);\nint CFITS_API ffmkls(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status);\nint CFITS_API ffmkyl(fitsfile *fptr, const char *keyname, int value, const char *comm, int *status);\nint CFITS_API ffmkyj(fitsfile *fptr, const char *keyname, LONGLONG value, const char *comm, int *status);\nint CFITS_API ffmkyf(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffmkye(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffmkyg(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffmkyd(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffmkyc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffmkym(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffmkfc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffmkfm(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm,\n          int *status);\n \n/*--------------------- insert keywords ---------------*/\nint CFITS_API ffirec(fitsfile *fptr, int nkey, const char *card, int *status);\nint CFITS_API ffikey(fitsfile *fptr, const char *card, int *status);\nint CFITS_API ffikyu(fitsfile *fptr, const char *keyname, const char *comm, int *status);\nint CFITS_API ffikys(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status);\nint CFITS_API ffikls(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status);\nint CFITS_API ffikyl(fitsfile *fptr, const char *keyname, int value, const char *comm, int *status);\nint CFITS_API ffikyj(fitsfile *fptr, const char *keyname, LONGLONG value, const char *comm, int *status);\nint CFITS_API ffikyf(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffikye(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffikyg(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffikyd(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffikyc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffikym(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffikfc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm,\n          int *status);\nint CFITS_API ffikfm(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm,\n          int *status);\n\n/*--------------------- delete keywords ---------------*/\nint CFITS_API ffdkey(fitsfile *fptr, const char *keyname, int *status);\nint CFITS_API ffdstr(fitsfile *fptr, const char *string, int *status);\nint CFITS_API ffdrec(fitsfile *fptr, int keypos, int *status);\n \n/*--------------------- get HDU information -------------*/\nint CFITS_API ffghdn(fitsfile *fptr, int *chdunum);\nint CFITS_API ffghdt(fitsfile *fptr, int *exttype, int *status);\nint CFITS_API ffghad(fitsfile *fptr, long *headstart, long *datastart, long *dataend,\n           int *status);\nint CFITS_API ffghadll(fitsfile *fptr, LONGLONG *headstart, LONGLONG *datastart,\n           LONGLONG *dataend, int *status);\nint CFITS_API ffghof(fitsfile *fptr, OFF_T *headstart, OFF_T *datastart, OFF_T *dataend,\n           int *status);\nint CFITS_API ffgipr(fitsfile *fptr, int maxaxis, int *imgtype, int *naxis,\n           long *naxes, int *status);\nint CFITS_API ffgiprll(fitsfile *fptr, int maxaxis, int *imgtype, int *naxis,\n           LONGLONG *naxes, int *status);\nint CFITS_API ffgidt(fitsfile *fptr, int *imgtype, int *status);\nint CFITS_API ffgiet(fitsfile *fptr, int *imgtype, int *status);\nint CFITS_API ffgidm(fitsfile *fptr, int *naxis,  int *status);\nint CFITS_API ffgisz(fitsfile *fptr, int nlen, long *naxes, int *status);\nint CFITS_API ffgiszll(fitsfile *fptr, int nlen, LONGLONG *naxes, int *status);\n\n/*--------------------- HDU operations -------------*/\nint CFITS_API ffmahd(fitsfile *fptr, int hdunum, int *exttype, int *status);\nint CFITS_API ffmrhd(fitsfile *fptr, int hdumov, int *exttype, int *status);\nint CFITS_API ffmnhd(fitsfile *fptr, int exttype, char *hduname, int hduvers,\n           int *status);\nint CFITS_API ffthdu(fitsfile *fptr, int *nhdu, int *status);\nint CFITS_API ffcrhd(fitsfile *fptr, int *status);\nint CFITS_API ffcrim(fitsfile *fptr, int bitpix, int naxis, long *naxes, int *status);\nint CFITS_API ffcrimll(fitsfile *fptr, int bitpix, int naxis, LONGLONG *naxes, int *status);\nint CFITS_API ffcrtb(fitsfile *fptr, int tbltype, LONGLONG naxis2, int tfields, char **ttype,\n           char **tform, char **tunit, const char *extname, int *status);\nint CFITS_API ffiimg(fitsfile *fptr, int bitpix, int naxis, long *naxes, int *status);\nint CFITS_API ffiimgll(fitsfile *fptr, int bitpix, int naxis, LONGLONG *naxes, int *status);\nint CFITS_API ffitab(fitsfile *fptr, LONGLONG naxis1, LONGLONG naxis2, int tfields, char **ttype,\n           long *tbcol, char **tform, char **tunit, const char *extname, int *status);\nint CFITS_API ffibin(fitsfile *fptr, LONGLONG naxis2, int tfields, char **ttype, char **tform,\n           char **tunit, const char *extname, LONGLONG pcount, int *status);\nint CFITS_API ffrsim(fitsfile *fptr, int bitpix, int naxis, long *naxes, int *status);\nint CFITS_API ffrsimll(fitsfile *fptr, int bitpix, int naxis, LONGLONG *naxes, int *status);\nint CFITS_API ffdhdu(fitsfile *fptr, int *hdutype, int *status);\nint CFITS_API ffcopy(fitsfile *infptr, fitsfile *outfptr, int morekeys, int *status);\nint CFITS_API ffcpfl(fitsfile *infptr, fitsfile *outfptr, int prev, int cur, int follow,\n            int *status);\nint CFITS_API ffcphd(fitsfile *infptr, fitsfile *outfptr, int *status);\nint CFITS_API ffcpdt(fitsfile *infptr, fitsfile *outfptr, int *status);\nint CFITS_API ffchfl(fitsfile *fptr, int *status);\nint CFITS_API ffcdfl(fitsfile *fptr, int *status);\nint CFITS_API ffwrhdu(fitsfile *fptr, FILE *outstream, int *status);\n\nint CFITS_API ffrdef(fitsfile *fptr, int *status);\nint CFITS_API ffrhdu(fitsfile *fptr, int *hdutype, int *status);\nint CFITS_API ffhdef(fitsfile *fptr, int morekeys, int *status);\nint CFITS_API ffpthp(fitsfile *fptr, long theap, int *status);\n \nint CFITS_API ffcsum(fitsfile *fptr, long nrec, unsigned long *sum, int *status);\nvoid CFITS_API ffesum(unsigned long sum, int complm, char *ascii);\nunsigned long CFITS_API ffdsum(char *ascii, int complm, unsigned long *sum);\nint CFITS_API ffpcks(fitsfile *fptr, int *status);\nint CFITS_API ffupck(fitsfile *fptr, int *status);\nint CFITS_API ffvcks(fitsfile *fptr, int *datastatus, int *hdustatus, int *status);\nint CFITS_API ffgcks(fitsfile *fptr, unsigned long *datasum, unsigned long *hdusum,\n    int *status);\n \n/*--------------------- define scaling or null values -------------*/\nint CFITS_API ffpscl(fitsfile *fptr, double scale, double zeroval, int *status);\nint CFITS_API ffpnul(fitsfile *fptr, LONGLONG nulvalue, int *status);\nint CFITS_API fftscl(fitsfile *fptr, int colnum, double scale, double zeroval, int *status);\nint CFITS_API fftnul(fitsfile *fptr, int colnum, LONGLONG nulvalue, int *status);\nint CFITS_API ffsnul(fitsfile *fptr, int colnum, char *nulstring, int *status);\n \n/*--------------------- get column information -------------*/\nint CFITS_API ffgcno(fitsfile *fptr, int casesen, char *templt, int  *colnum,\n           int *status);\nint CFITS_API ffgcnn(fitsfile *fptr, int casesen, char *templt, char *colname,\n           int *colnum, int *status);\n \nint CFITS_API ffgtcl(fitsfile *fptr, int colnum, int *typecode, long *repeat,\n           long *width, int *status);\nint CFITS_API ffgtclll(fitsfile *fptr, int colnum, int *typecode, LONGLONG *repeat,\n           LONGLONG *width, int *status);\nint CFITS_API ffeqty(fitsfile *fptr, int colnum, int *typecode, long *repeat,\n           long *width, int *status);\nint CFITS_API ffeqtyll(fitsfile *fptr, int colnum, int *typecode, LONGLONG *repeat,\n           LONGLONG *width, int *status);\nint CFITS_API ffgncl(fitsfile *fptr, int  *ncols, int *status);\nint CFITS_API ffgnrw(fitsfile *fptr, long *nrows, int *status);\nint CFITS_API ffgnrwll(fitsfile *fptr, LONGLONG *nrows, int *status);\nint CFITS_API ffgacl(fitsfile *fptr, int colnum, char *ttype, long *tbcol,\n           char *tunit, char *tform, double *tscal, double *tzero,\n           char *tnull, char *tdisp, int *status);\nint CFITS_API ffgbcl(fitsfile *fptr, int colnum, char *ttype, char *tunit,\n           char *dtype, long *repeat, double *tscal, double *tzero,\n           long *tnull, char *tdisp, int  *status);\nint CFITS_API ffgbclll(fitsfile *fptr, int colnum, char *ttype, char *tunit,\n           char *dtype, LONGLONG *repeat, double *tscal, double *tzero,\n           LONGLONG *tnull, char *tdisp, int  *status);\nint CFITS_API ffgrsz(fitsfile *fptr, long *nrows, int *status);\nint CFITS_API ffgcdw(fitsfile *fptr, int colnum, int *width, int *status);\n\n/*--------------------- read primary array or image elements -------------*/\nint CFITS_API ffgpxv(fitsfile *fptr, int  datatype, long *firstpix, LONGLONG nelem,\n          void *nulval, void *array, int *anynul, int *status);\nint CFITS_API ffgpxvll(fitsfile *fptr, int  datatype, LONGLONG *firstpix, LONGLONG nelem,\n          void *nulval, void *array, int *anynul, int *status);\nint CFITS_API ffgpxf(fitsfile *fptr, int  datatype, long *firstpix, LONGLONG nelem,\n           void *array, char *nullarray, int *anynul, int *status);\nint CFITS_API ffgpxfll(fitsfile *fptr, int  datatype, LONGLONG *firstpix, LONGLONG nelem,\n           void *array, char *nullarray, int *anynul, int *status);\nint CFITS_API ffgsv(fitsfile *fptr, int datatype, long *blc, long *trc, long *inc,\n          void *nulval, void *array, int *anynul, int  *status);\n\nint CFITS_API ffgpv(fitsfile *fptr, int  datatype, LONGLONG firstelem, LONGLONG nelem,\n          void *nulval, void *array, int *anynul, int  *status);\nint CFITS_API ffgpf(fitsfile *fptr, int  datatype, LONGLONG firstelem, LONGLONG nelem,\n          void *array, char *nullarray, int  *anynul, int  *status);\nint CFITS_API ffgpvb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned\n           char nulval, unsigned char *array, int *anynul, int *status);\nint CFITS_API ffgpvsb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, signed\n           char nulval, signed char *array, int *anynul, int *status);\nint CFITS_API ffgpvui(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           unsigned short nulval, unsigned short *array, int *anynul, \n           int *status);\nint CFITS_API ffgpvi(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           short nulval, short *array, int *anynul, int *status);\nint CFITS_API ffgpvuj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           unsigned long nulval, unsigned long *array, int *anynul, \n           int *status);\nint CFITS_API ffgpvj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           long nulval, long *array, int *anynul, int *status);\nint CFITS_API ffgpvujj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           ULONGLONG nulval, ULONGLONG *array, int *anynul, int *status);\nint CFITS_API ffgpvjj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           LONGLONG nulval, LONGLONG *array, int *anynul, int *status);\nint CFITS_API ffgpvuk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           unsigned int nulval, unsigned int *array, int *anynul, int *status);\nint CFITS_API ffgpvk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           int nulval, int *array, int *anynul, int *status);\nint CFITS_API ffgpve(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           float nulval, float *array, int *anynul, int *status);\nint CFITS_API ffgpvd(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           double nulval, double *array, int *anynul, int *status);\n \nint CFITS_API ffgpfb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           unsigned char *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgpfsb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           signed char *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgpfui(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           unsigned short *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgpfi(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           short *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgpfuj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           unsigned long *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgpfj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           long *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgpfujj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           ULONGLONG *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgpfjj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           LONGLONG *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgpfuk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           unsigned int *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgpfk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           int *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgpfe(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           float *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgpfd(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           double *array, char *nularray, int *anynul, int *status);\n \nint CFITS_API ffg2db(fitsfile *fptr, long group, unsigned char nulval, LONGLONG ncols,\n           LONGLONG naxis1, LONGLONG naxis2, unsigned char *array,\n           int *anynul, int *status);\nint CFITS_API ffg2dsb(fitsfile *fptr, long group, signed char nulval, LONGLONG ncols,\n           LONGLONG naxis1, LONGLONG naxis2, signed char *array,\n           int *anynul, int *status);\nint CFITS_API ffg2dui(fitsfile *fptr, long group, unsigned short nulval, LONGLONG ncols,\n           LONGLONG naxis1, LONGLONG naxis2, unsigned short *array,\n           int *anynul, int *status);\nint CFITS_API ffg2di(fitsfile *fptr, long group, short nulval, LONGLONG ncols,\n           LONGLONG naxis1, LONGLONG naxis2, short *array,\n           int *anynul, int *status);\nint CFITS_API ffg2duj(fitsfile *fptr, long group, unsigned long nulval, LONGLONG ncols,\n           LONGLONG naxis1, LONGLONG naxis2, unsigned long *array,\n           int *anynul, int *status);\nint CFITS_API ffg2dj(fitsfile *fptr, long group, long nulval, LONGLONG ncols,\n           LONGLONG naxis1, LONGLONG naxis2, long *array,\n           int *anynul, int *status);\nint CFITS_API ffg2dujj(fitsfile *fptr, long group, ULONGLONG nulval, LONGLONG ncols,\n           LONGLONG naxis1, LONGLONG naxis2, ULONGLONG *array,\n           int *anynul, int *status);\nint CFITS_API ffg2djj(fitsfile *fptr, long group, LONGLONG nulval, LONGLONG ncols,\n           LONGLONG naxis1, LONGLONG naxis2, LONGLONG *array,\n           int *anynul, int *status);\nint CFITS_API ffg2duk(fitsfile *fptr, long group, unsigned int nulval, LONGLONG ncols,\n           LONGLONG naxis1, LONGLONG naxis2, unsigned int *array,\n           int *anynul, int *status);\nint CFITS_API ffg2dk(fitsfile *fptr, long group, int nulval, LONGLONG ncols,\n           LONGLONG naxis1, LONGLONG naxis2, int *array,\n           int *anynul, int *status);\nint CFITS_API ffg2de(fitsfile *fptr, long group, float nulval, LONGLONG ncols,\n           LONGLONG naxis1, LONGLONG naxis2, float *array,\n           int *anynul, int *status);\nint CFITS_API ffg2dd(fitsfile *fptr, long group, double nulval, LONGLONG ncols,\n           LONGLONG naxis1, LONGLONG naxis2, double *array,\n           int *anynul, int *status);\n \nint CFITS_API ffg3db(fitsfile *fptr, long group, unsigned char nulval, LONGLONG ncols,\n           LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,\n           unsigned char *array, int *anynul, int *status);\nint CFITS_API ffg3dsb(fitsfile *fptr, long group, signed char nulval, LONGLONG ncols,\n           LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,\n           signed char *array, int *anynul, int *status);\nint CFITS_API ffg3dui(fitsfile *fptr, long group, unsigned short nulval, LONGLONG ncols,\n           LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,\n           unsigned short *array, int *anynul, int *status);\nint CFITS_API ffg3di(fitsfile *fptr, long group, short nulval, LONGLONG ncols,\n           LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,\n           short *array, int *anynul, int *status);\nint CFITS_API ffg3duj(fitsfile *fptr, long group, unsigned long nulval, LONGLONG ncols,\n           LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,\n           unsigned long *array, int *anynul, int *status);\nint CFITS_API ffg3dj(fitsfile *fptr, long group, long nulval, LONGLONG ncols,\n           LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,\n           long *array, int *anynul, int *status);\nint CFITS_API ffg3dujj(fitsfile *fptr, long group, ULONGLONG nulval, LONGLONG ncols,\n           LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,\n           ULONGLONG *array, int *anynul, int *status);\nint CFITS_API ffg3djj(fitsfile *fptr, long group, LONGLONG nulval, LONGLONG ncols,\n           LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,\n           LONGLONG *array, int *anynul, int *status);\nint CFITS_API ffg3duk(fitsfile *fptr, long group, unsigned int nulval, LONGLONG ncols,\n           LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,\n           unsigned int *array, int *anynul, int *status);\nint CFITS_API ffg3dk(fitsfile *fptr, long group, int nulval, LONGLONG ncols,\n           LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,\n           int *array, int *anynul, int *status);\nint CFITS_API ffg3de(fitsfile *fptr, long group, float nulval, LONGLONG ncols,\n           LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,\n           float *array, int *anynul, int *status);\nint CFITS_API ffg3dd(fitsfile *fptr, long group, double nulval, LONGLONG ncols,\n           LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,\n           double *array, int *anynul, int *status);\n \nint CFITS_API ffgsvb(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, unsigned char nulval, unsigned char *array,\n  int *anynul, int *status);\nint CFITS_API ffgsvsb(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, signed char nulval, signed char *array,\n  int *anynul, int *status);\nint CFITS_API ffgsvui(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, unsigned short nulval, unsigned short *array, \n  int *anynul, int *status);\nint CFITS_API ffgsvi(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, short nulval, short *array, int *anynul, int *status);\nint CFITS_API ffgsvuj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, unsigned long nulval, unsigned long *array, \n  int *anynul, int *status);\nint CFITS_API ffgsvj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, long nulval, long *array, int *anynul, int *status);\nint CFITS_API ffgsvujj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, ULONGLONG nulval, ULONGLONG *array, int *anynul,\n  int *status);\nint CFITS_API ffgsvjj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, LONGLONG nulval, LONGLONG *array, int *anynul,\n  int *status);\nint CFITS_API ffgsvuk(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, unsigned int nulval, unsigned int *array,\n  int *anynul, int *status);\nint CFITS_API ffgsvk(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, int nulval, int *array, int *anynul, int *status);\nint CFITS_API ffgsve(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, float nulval, float *array, int *anynul, int *status);\nint CFITS_API ffgsvd(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, double nulval, double *array, int *anynul,\n  int *status);\n \nint CFITS_API ffgsfb(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, unsigned char *array, char *flagval,\n  int *anynul, int *status);\nint CFITS_API ffgsfsb(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, signed char *array, char *flagval,\n  int *anynul, int *status);\nint CFITS_API ffgsfui(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, unsigned short *array, char *flagval, int *anynul, \n  int *status);\nint CFITS_API ffgsfi(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, short *array, char *flagval, int *anynul, int *status);\nint CFITS_API ffgsfuj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long  *trc, long *inc, unsigned long *array, char *flagval, int *anynul,\n  int *status);\nint CFITS_API ffgsfj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long  *trc, long *inc, long *array, char *flagval, int *anynul, int *status);\nint CFITS_API ffgsfujj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long  *trc, long *inc, ULONGLONG *array, char *flagval, int *anynul,\n  int *status);\nint CFITS_API ffgsfjj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long  *trc, long *inc, LONGLONG *array, char *flagval, int *anynul,\n  int *status);\nint CFITS_API ffgsfuk(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long  *trc, long *inc, unsigned int *array, char *flagval, int *anynul,\n  int *status);\nint CFITS_API ffgsfk(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long  *trc, long *inc, int *array, char *flagval, int *anynul, int *status);\nint CFITS_API ffgsfe(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, float *array, char *flagval, int *anynul, int *status);\nint CFITS_API ffgsfd(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,\n  long *trc, long *inc, double *array, char *flagval, int *anynul,\n  int *status);\n \nint CFITS_API ffggpb(fitsfile *fptr, long group, long firstelem, long nelem,\n           unsigned char *array, int *status);\nint CFITS_API ffggpsb(fitsfile *fptr, long group, long firstelem, long nelem,\n           signed char *array, int *status);\nint CFITS_API ffggpui(fitsfile *fptr, long group, long firstelem, long nelem,\n           unsigned short *array, int *status);\nint CFITS_API ffggpi(fitsfile *fptr, long group, long firstelem, long nelem,\n           short *array, int *status);\nint CFITS_API ffggpuj(fitsfile *fptr, long group, long firstelem, long nelem,\n           unsigned long *array, int *status);\nint CFITS_API ffggpj(fitsfile *fptr, long group, long firstelem, long nelem,\n           long *array, int *status);\nint CFITS_API ffggpujj(fitsfile *fptr, long group, long firstelem, long nelem,\n           ULONGLONG *array, int *status);\nint CFITS_API ffggpjj(fitsfile *fptr, long group, long firstelem, long nelem,\n           LONGLONG *array, int *status);\nint CFITS_API ffggpuk(fitsfile *fptr, long group, long firstelem, long nelem,\n           unsigned int *array, int *status);\nint CFITS_API ffggpk(fitsfile *fptr, long group, long firstelem, long nelem,\n           int *array, int *status);\nint CFITS_API ffggpe(fitsfile *fptr, long group, long firstelem, long nelem,\n           float *array, int *status);\nint CFITS_API ffggpd(fitsfile *fptr, long group, long firstelem, long nelem,\n           double *array, int *status);\n \n/*--------------------- read column elements -------------*/\nint CFITS_API ffgcv( fitsfile *fptr, int datatype, int colnum, LONGLONG firstrow,\n           LONGLONG firstelem, LONGLONG nelem, void *nulval, void *array, int *anynul,\n           int  *status);\nint CFITS_API ffgcf( fitsfile *fptr, int datatype, int colnum, LONGLONG firstrow,\n           LONGLONG firstelem, LONGLONG nelem, void *array, char *nullarray,\n           int *anynul, int *status);\nint CFITS_API ffgcvs(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, char *nulval, char **array, int *anynul, int *status);\nint CFITS_API ffgcl (fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, char *array, int  *status);\nint CFITS_API ffgcvl (fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, char nulval, char *array, int *anynul, int  *status);\nint CFITS_API ffgcvb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, unsigned char nulval, unsigned char *array,\n           int *anynul, int *status);\nint CFITS_API ffgcvsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, signed char nulval, signed char *array,\n           int *anynul, int *status);\nint CFITS_API ffgcvui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, unsigned short nulval, unsigned short *array, \n           int *anynul, int *status);\nint CFITS_API ffgcvi(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, short nulval, short *array, int *anynul, int *status);\nint CFITS_API ffgcvuj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, unsigned long nulval, unsigned long *array, int *anynul,\n           int *status);\nint CFITS_API ffgcvj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, long nulval, long *array, int *anynul, int *status);\nint CFITS_API ffgcvujj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, ULONGLONG nulval, ULONGLONG *array, int *anynul,\n           int *status);\nint CFITS_API ffgcvjj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, LONGLONG nulval, LONGLONG *array, int *anynul,\n           int *status);\nint CFITS_API ffgcvuk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, unsigned int nulval, unsigned int *array, int *anynul,\n           int *status);\nint CFITS_API ffgcvk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, int nulval, int *array, int *anynul, int *status);\nint CFITS_API ffgcve(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, float nulval, float *array, int *anynul, int *status);\nint CFITS_API ffgcvd(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n         LONGLONG nelem, double nulval, double *array, int *anynul, int *status);\nint CFITS_API ffgcvc(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, float nulval, float *array, int *anynul, int *status);\nint CFITS_API ffgcvm(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n         LONGLONG nelem, double nulval, double *array, int *anynul, int *status);\n\nint CFITS_API ffgcx(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstbit,\n            LONGLONG nbits, char *larray, int *status);\nint CFITS_API ffgcxui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows,\n            long firstbit, int nbits, unsigned short *array, int *status);\nint CFITS_API ffgcxuk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows,\n            long firstbit, int nbits, unsigned int *array, int *status);\n\nint CFITS_API ffgcfs(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, \n      LONGLONG nelem, char **array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgcfl(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n      LONGLONG nelem, char *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgcfb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, \n      LONGLONG nelem, unsigned char *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgcfsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n      LONGLONG nelem, signed char *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgcfui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n      LONGLONG nelem, unsigned short *array, char *nularray, int *anynul, \n      int *status);\nint CFITS_API ffgcfi(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n      LONGLONG nelem, short *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgcfuj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n      LONGLONG nelem, unsigned long *array, char *nularray, int *anynul,\n      int *status);\nint CFITS_API ffgcfj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n      LONGLONG nelem, long *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgcfujj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n      LONGLONG nelem, ULONGLONG *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgcfjj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n      LONGLONG nelem, LONGLONG *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgcfuk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n      LONGLONG nelem, unsigned int *array, char *nularray, int *anynul,\n      int *status);\nint CFITS_API ffgcfk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n      LONGLONG nelem, int *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgcfe(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n      LONGLONG nelem, float *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgcfd(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n      LONGLONG nelem, double *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgcfc(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n      LONGLONG nelem, float *array, char *nularray, int *anynul, int *status);\nint CFITS_API ffgcfm(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n      LONGLONG nelem, double *array, char *nularray, int *anynul, int *status);\n \nint CFITS_API ffgdes(fitsfile *fptr, int colnum, LONGLONG rownum, long *length,\n           long *heapaddr, int *status);\nint CFITS_API ffgdesll(fitsfile *fptr, int colnum, LONGLONG rownum, LONGLONG *length,\n           LONGLONG *heapaddr, int *status);\nint CFITS_API ffgdess(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows, long *length,\n           long *heapaddr, int *status);\nint CFITS_API ffgdessll(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows, LONGLONG *length,\n           LONGLONG *heapaddr, int *status);\nint CFITS_API ffpdes(fitsfile *fptr, int colnum, LONGLONG rownum, LONGLONG length,\n           LONGLONG heapaddr, int *status);\nint CFITS_API fftheap(fitsfile *fptr, LONGLONG *heapsize, LONGLONG *unused, LONGLONG *overlap,\n            int *valid, int *status);\nint CFITS_API ffcmph(fitsfile *fptr, int *status);\n\nint CFITS_API ffgtbb(fitsfile *fptr, LONGLONG firstrow, LONGLONG firstchar, LONGLONG nchars,\n           unsigned char *values, int *status);\n\nint CFITS_API ffgextn(fitsfile *fptr, LONGLONG offset, LONGLONG nelem, void *array, int *status);\nint CFITS_API ffpextn(fitsfile *fptr, LONGLONG offset, LONGLONG nelem, void *array, int *status);\n\n/*------------ write primary array or image elements -------------*/\nint CFITS_API ffppx(fitsfile *fptr, int datatype, long *firstpix, LONGLONG nelem,\n          void *array, int *status);\nint CFITS_API ffppxll(fitsfile *fptr, int datatype, LONGLONG *firstpix, LONGLONG nelem,\n          void *array, int *status);\nint CFITS_API ffppxn(fitsfile *fptr, int datatype, long *firstpix, LONGLONG nelem,\n          void *array, void *nulval, int *status);\nint CFITS_API ffppxnll(fitsfile *fptr, int datatype, LONGLONG *firstpix, LONGLONG nelem,\n          void *array, void *nulval, int *status);\nint CFITS_API ffppr(fitsfile *fptr, int datatype, LONGLONG  firstelem,\n           LONGLONG nelem, void *array, int *status);\nint CFITS_API ffpprb(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, unsigned char *array, int *status);\nint CFITS_API ffpprsb(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, signed char *array, int *status);\nint CFITS_API ffpprui(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, unsigned short *array, int *status);\nint CFITS_API ffppri(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, short *array, int *status);\nint CFITS_API ffppruj(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, unsigned long *array, int *status);\nint CFITS_API ffpprj(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, long *array, int *status);\nint CFITS_API ffppruk(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, unsigned int *array, int *status);\nint CFITS_API ffpprk(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, int *array, int *status);\nint CFITS_API ffppre(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, float *array, int *status);\nint CFITS_API ffpprd(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, double *array, int *status);\nint CFITS_API ffpprjj(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, LONGLONG *array, int *status);\nint CFITS_API ffpprujj(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, ULONGLONG *array, int *status);\n\nint CFITS_API ffppru(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           int *status);\nint CFITS_API ffpprn(fitsfile *fptr, LONGLONG firstelem, LONGLONG nelem, int *status);\n \nint CFITS_API ffppn(fitsfile *fptr, int datatype, LONGLONG  firstelem, LONGLONG nelem,\n          void  *array, void *nulval, int  *status);\nint CFITS_API ffppnb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           unsigned char *array, unsigned char nulval, int *status);\nint CFITS_API ffppnsb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           signed char *array, signed char nulval, int *status);\nint CFITS_API ffppnui(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, unsigned short *array, unsigned short nulval,\n           int *status);\nint CFITS_API ffppni(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, short *array, short nulval, int *status);\nint CFITS_API ffppnj(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, long *array, long nulval, int *status);\nint CFITS_API ffppnuj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           unsigned long *array, unsigned long nulval, int *status);\nint CFITS_API ffppnuk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,\n           unsigned int *array, unsigned int nulval, int *status);\nint CFITS_API ffppnk(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, int *array, int nulval, int *status);\nint CFITS_API ffppne(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, float *array, float nulval, int *status);\nint CFITS_API ffppnd(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, double *array, double nulval, int *status);\nint CFITS_API ffppnjj(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, LONGLONG *array, LONGLONG nulval, int *status);\nint CFITS_API ffppnujj(fitsfile *fptr, long group, LONGLONG firstelem,\n           LONGLONG nelem, ULONGLONG *array, ULONGLONG nulval, int *status);\n\nint CFITS_API ffp2db(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,\n           LONGLONG naxis2, unsigned char *array, int *status);\nint CFITS_API ffp2dsb(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,\n           LONGLONG naxis2, signed char *array, int *status);\nint CFITS_API ffp2dui(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,\n           LONGLONG naxis2, unsigned short *array, int *status);\nint CFITS_API ffp2di(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,\n           LONGLONG naxis2, short *array, int *status);\nint CFITS_API ffp2duj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,\n           LONGLONG naxis2, unsigned long *array, int *status);\nint CFITS_API ffp2dj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,\n           LONGLONG naxis2, long *array, int *status);\nint CFITS_API ffp2duk(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,\n           LONGLONG naxis2, unsigned int *array, int *status);\nint CFITS_API ffp2dk(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,\n           LONGLONG naxis2, int *array, int *status);\nint CFITS_API ffp2de(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,\n           LONGLONG naxis2, float *array, int *status);\nint CFITS_API ffp2dd(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,\n           LONGLONG naxis2, double *array, int *status);\nint CFITS_API ffp2djj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,\n           LONGLONG naxis2, LONGLONG *array, int *status);\nint CFITS_API ffp2dujj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,\n           LONGLONG naxis2, ULONGLONG *array, int *status);\n\nint CFITS_API ffp3db(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,\n           LONGLONG naxis2, LONGLONG naxis3, unsigned char *array, int *status);\nint CFITS_API ffp3dsb(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,\n           LONGLONG naxis2, LONGLONG naxis3, signed char *array, int *status);\nint CFITS_API ffp3dui(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,\n           LONGLONG naxis2, LONGLONG naxis3, unsigned short *array, int *status);\nint CFITS_API ffp3di(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,\n           LONGLONG naxis2, LONGLONG naxis3, short *array, int *status);\nint CFITS_API ffp3duj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,\n           LONGLONG naxis2, LONGLONG naxis3, unsigned long *array, int *status);\nint CFITS_API ffp3dj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,\n           LONGLONG naxis2, LONGLONG naxis3, long *array, int *status);\nint CFITS_API ffp3duk(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,\n           LONGLONG naxis2, LONGLONG naxis3, unsigned int *array, int *status);\nint CFITS_API ffp3dk(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,\n           LONGLONG naxis2, LONGLONG naxis3, int *array, int *status);\nint CFITS_API ffp3de(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,\n           LONGLONG naxis2, LONGLONG naxis3, float *array, int *status);\nint CFITS_API ffp3dd(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,\n           LONGLONG naxis2, LONGLONG naxis3, double *array, int *status);\nint CFITS_API ffp3djj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,\n           LONGLONG naxis2, LONGLONG naxis3, LONGLONG *array, int *status);\nint CFITS_API ffp3dujj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,\n           LONGLONG naxis2, LONGLONG naxis3, ULONGLONG *array, int *status);\n\nint CFITS_API ffpss(fitsfile *fptr, int datatype,\n           long *fpixel, long *lpixel, void *array, int *status);\nint CFITS_API ffpssb(fitsfile *fptr, long group, long naxis, long *naxes,\n           long *fpixel, long *lpixel, unsigned char *array, int *status);\nint CFITS_API ffpsssb(fitsfile *fptr, long group, long naxis, long *naxes,\n           long *fpixel, long *lpixel, signed char *array, int *status);\nint CFITS_API ffpssui(fitsfile *fptr, long group, long naxis, long *naxes,\n           long *fpixel, long *lpixel, unsigned short *array, int *status);\nint CFITS_API ffpssi(fitsfile *fptr, long group, long naxis, long *naxes,\n           long *fpixel, long *lpixel, short *array, int *status);\nint CFITS_API ffpssuj(fitsfile *fptr, long group, long naxis, long *naxes,\n           long *fpixel, long *lpixel, unsigned long *array, int *status);\nint CFITS_API ffpssj(fitsfile *fptr, long group, long naxis, long *naxes,\n           long *fpixel, long *lpixel, long *array, int *status);\nint CFITS_API ffpssuk(fitsfile *fptr, long group, long naxis, long *naxes,\n           long *fpixel, long *lpixel, unsigned int *array, int *status);\nint CFITS_API ffpssk(fitsfile *fptr, long group, long naxis, long *naxes,\n           long *fpixel, long *lpixel, int *array, int *status);\nint CFITS_API ffpsse(fitsfile *fptr, long group, long naxis, long *naxes,\n           long *fpixel, long *lpixel, float *array, int *status);\nint CFITS_API ffpssd(fitsfile *fptr, long group, long naxis, long *naxes,\n           long *fpixel, long *lpixel, double *array, int *status);\nint CFITS_API ffpssjj(fitsfile *fptr, long group, long naxis, long *naxes,\n           long *fpixel, long *lpixel, LONGLONG *array, int *status);\nint CFITS_API ffpssujj(fitsfile *fptr, long group, long naxis, long *naxes,\n           long *fpixel, long *lpixel, ULONGLONG *array, int *status);\n\nint CFITS_API ffpgpb(fitsfile *fptr, long group, long firstelem,\n           long nelem, unsigned char *array, int *status);\nint CFITS_API ffpgpsb(fitsfile *fptr, long group, long firstelem,\n           long nelem, signed char *array, int *status);\nint CFITS_API ffpgpui(fitsfile *fptr, long group, long firstelem,\n           long nelem, unsigned short *array, int *status);\nint CFITS_API ffpgpi(fitsfile *fptr, long group, long firstelem,\n           long nelem, short *array, int *status);\nint CFITS_API ffpgpuj(fitsfile *fptr, long group, long firstelem,\n           long nelem, unsigned long *array, int *status);\nint CFITS_API ffpgpj(fitsfile *fptr, long group, long firstelem,\n           long nelem, long *array, int *status);\nint CFITS_API ffpgpuk(fitsfile *fptr, long group, long firstelem,\n           long nelem, unsigned int *array, int *status);\nint CFITS_API ffpgpk(fitsfile *fptr, long group, long firstelem,\n           long nelem, int *array, int *status);\nint CFITS_API ffpgpe(fitsfile *fptr, long group, long firstelem,\n           long nelem, float *array, int *status);\nint CFITS_API ffpgpd(fitsfile *fptr, long group, long firstelem,\n           long nelem, double *array, int *status);\nint CFITS_API ffpgpjj(fitsfile *fptr, long group, long firstelem,\n           long nelem, LONGLONG *array, int *status);\nint CFITS_API ffpgpujj(fitsfile *fptr, long group, long firstelem,\n           long nelem, ULONGLONG *array, int *status);\n\n/*--------------------- iterator functions -------------*/\nint CFITS_API fits_iter_set_by_name(iteratorCol *col, fitsfile *fptr, char *colname,\n          int datatype,  int iotype);\nint CFITS_API fits_iter_set_by_num(iteratorCol *col, fitsfile *fptr, int colnum,\n          int datatype,  int iotype);\nint CFITS_API fits_iter_set_file(iteratorCol *col, fitsfile *fptr);\nint CFITS_API fits_iter_set_colname(iteratorCol *col, char *colname);\nint CFITS_API fits_iter_set_colnum(iteratorCol *col, int colnum);\nint CFITS_API fits_iter_set_datatype(iteratorCol *col, int datatype);\nint CFITS_API fits_iter_set_iotype(iteratorCol *col, int iotype);\n\nCFITS_API fitsfile * fits_iter_get_file(iteratorCol *col);\nchar CFITS_API * fits_iter_get_colname(iteratorCol *col);\nint CFITS_API fits_iter_get_colnum(iteratorCol *col);\nint CFITS_API fits_iter_get_datatype(iteratorCol *col);\nint CFITS_API fits_iter_get_iotype(iteratorCol *col);\nvoid CFITS_API *fits_iter_get_array(iteratorCol *col);\nlong CFITS_API fits_iter_get_tlmin(iteratorCol *col);\nlong CFITS_API fits_iter_get_tlmax(iteratorCol *col);\nlong CFITS_API fits_iter_get_repeat(iteratorCol *col);\nchar CFITS_API *fits_iter_get_tunit(iteratorCol *col);\nchar CFITS_API *fits_iter_get_tdisp(iteratorCol *col);\n\nint CFITS_API ffiter(int ncols,  iteratorCol *data, long offset, long nPerLoop,\n           int (*workFn)( long totaln, long offset, long firstn,\n             long nvalues, int narrays, iteratorCol *data, void *userPointer),\n           void *userPointer, int *status);\n\n/*--------------------- write column elements -------------*/\nint CFITS_API ffpcl(fitsfile *fptr, int datatype, int colnum, LONGLONG firstrow,\n          LONGLONG firstelem, LONGLONG nelem, void *array, int *status);\nint CFITS_API ffpcls(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, char **array, int *status);\nint CFITS_API ffpcll(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, char *array, int *status);\nint CFITS_API ffpclb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, unsigned char *array, int *status);\nint CFITS_API ffpclsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, signed char *array, int *status);\nint CFITS_API ffpclui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, unsigned short *array, int *status);\nint CFITS_API ffpcli(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, short *array, int *status);\nint CFITS_API ffpcluj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, unsigned long *array, int *status);\nint CFITS_API ffpclj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, long *array, int *status);\nint CFITS_API ffpcluk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, unsigned int *array, int *status);\nint CFITS_API ffpclk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, int *array, int *status);\nint CFITS_API ffpcle(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, float *array, int *status);\nint CFITS_API ffpcld(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, double *array, int *status);\nint CFITS_API ffpclc(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, float *array, int *status);\nint CFITS_API ffpclm(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, double *array, int *status);\nint CFITS_API ffpclu(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, int *status);\nint CFITS_API ffprwu(fitsfile *fptr, LONGLONG firstrow, LONGLONG nrows, int *status);\nint CFITS_API ffpcljj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, LONGLONG *array, int *status);\nint CFITS_API ffpclujj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, ULONGLONG *array, int *status);\nint CFITS_API ffpclx(fitsfile *fptr, int colnum, LONGLONG frow, long fbit, long nbit,\n            char *larray, int *status);\n\nint CFITS_API ffpcn(fitsfile *fptr, int datatype, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n          LONGLONG nelem, void *array, void *nulval, int *status);\nint CFITS_API ffpcns( fitsfile *fptr, int  colnum, LONGLONG  firstrow, LONGLONG  firstelem,\n            LONGLONG  nelem, char **array, char  *nulvalue, int  *status);\nint CFITS_API ffpcnl( fitsfile *fptr, int  colnum, LONGLONG  firstrow, LONGLONG  firstelem,\n            LONGLONG  nelem, char *array, char  nulvalue,  int  *status);\nint CFITS_API ffpcnb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, unsigned char *array, unsigned char nulvalue,\n           int *status);\nint CFITS_API ffpcnsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, signed char *array, signed char nulvalue,\n           int *status);\nint CFITS_API ffpcnui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, unsigned short *array, unsigned short nulvalue,\n           int *status);\nint CFITS_API ffpcni(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, short *array, short nulvalue, int *status);\nint CFITS_API ffpcnuj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, unsigned long *array, unsigned long nulvalue,\n           int *status);\nint CFITS_API ffpcnj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, long *array, long nulvalue, int *status);\nint CFITS_API ffpcnuk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, unsigned int *array, unsigned int nulvalue,\n           int *status);\nint CFITS_API ffpcnk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, int *array, int nulvalue, int *status);\nint CFITS_API ffpcne(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, float *array, float nulvalue, int *status);\nint CFITS_API ffpcnd(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, double *array, double nulvalue, int *status);\nint CFITS_API ffpcnjj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, LONGLONG *array, LONGLONG nulvalue, int *status);\nint CFITS_API ffpcnujj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, ULONGLONG *array, ULONGLONG nulvalue, int *status);\nint CFITS_API ffptbb(fitsfile *fptr, LONGLONG firstrow, LONGLONG firstchar, LONGLONG nchars,\n           unsigned char *values, int *status);\n \nint CFITS_API ffirow(fitsfile *fptr, LONGLONG firstrow, LONGLONG nrows, int *status);\nint CFITS_API ffdrow(fitsfile *fptr, LONGLONG firstrow, LONGLONG nrows, int *status);\nint CFITS_API ffdrrg(fitsfile *fptr, char *ranges, int *status);\nint CFITS_API ffdrws(fitsfile *fptr, long *rownum,  long nrows, int *status);\nint CFITS_API ffdrwsll(fitsfile *fptr, LONGLONG *rownum,  LONGLONG nrows, int *status);\nint CFITS_API fficol(fitsfile *fptr, int numcol, char *ttype, char *tform, int *status);\nint CFITS_API fficls(fitsfile *fptr, int firstcol, int ncols, char **ttype,\n           char **tform, int *status);\nint CFITS_API ffmvec(fitsfile *fptr, int colnum, LONGLONG newveclen, int *status);\nint CFITS_API ffdcol(fitsfile *fptr, int numcol, int *status);\nint CFITS_API ffcpcl(fitsfile *infptr, fitsfile *outfptr, int incol, int outcol, \n           int create_col, int *status);\nint CFITS_API ffccls(fitsfile *infptr, fitsfile *outfptr, int incol, int outcol, \n\t   int ncols, int create_col, int *status);\nint CFITS_API ffcprw(fitsfile *infptr, fitsfile *outfptr, LONGLONG firstrow, \n           LONGLONG nrows, int *status);\nint CFITS_API ffcpht(fitsfile *infptr, fitsfile *outfptr, LONGLONG firstrow, \n           LONGLONG nrows, int *status);\n\n/*--------------------- WCS Utilities ------------------*/\nint CFITS_API ffgics(fitsfile *fptr, double *xrval, double *yrval, double *xrpix,\n           double *yrpix, double *xinc, double *yinc, double *rot,\n           char *type, int *status);\nint CFITS_API ffgicsa(fitsfile *fptr, char version, double *xrval, double *yrval, double *xrpix,\n           double *yrpix, double *xinc, double *yinc, double *rot,\n           char *type, int *status);\nint CFITS_API ffgtcs(fitsfile *fptr, int xcol, int ycol, double *xrval,\n           double *yrval, double *xrpix, double *yrpix, double *xinc,\n           double *yinc, double *rot, char *type, int *status);\nint CFITS_API ffwldp(double xpix, double ypix, double xref, double yref,\n           double xrefpix, double yrefpix, double xinc, double yinc,\n           double rot, char *type, double *xpos, double *ypos, int *status);\nint CFITS_API ffxypx(double xpos, double ypos, double xref, double yref, \n           double xrefpix, double yrefpix, double xinc, double yinc,\n           double rot, char *type, double *xpix, double *ypix, int *status);\n\n/*   WCS support routines (provide interface to Doug Mink's WCS library */\nint CFITS_API ffgiwcs(fitsfile *fptr,  char **header, int *status); \nint CFITS_API ffgtwcs(fitsfile *fptr, int xcol, int ycol, char **header, int *status);\n\n/*--------------------- lexical parsing routines ------------------*/\nint CFITS_API fftexp( fitsfile *fptr, char *expr, int maxdim,\n\t    int *datatype, long *nelem, int *naxis,\n\t    long *naxes, int *status );\n\nint CFITS_API fffrow( fitsfile *infptr, char *expr,\n\t    long firstrow, long nrows,\n            long *n_good_rows, char *row_status, int *status);\n\nint CFITS_API ffffrw( fitsfile *fptr, char *expr, long *rownum, int *status);\n\nint CFITS_API fffrwc( fitsfile *fptr, char *expr, char *timeCol,    \n            char *parCol, char *valCol, long ntimes,      \n            double *times, char *time_status, int  *status );\n\nint CFITS_API ffsrow( fitsfile *infptr, fitsfile *outfptr, char *expr, \n            int *status);\n\nint CFITS_API ffcrow( fitsfile *fptr, int datatype, char *expr,\n\t    long firstrow, long nelements, void *nulval,\n\t    void *array, int *anynul, int *status );\n\nint CFITS_API ffcalc_rng( fitsfile *infptr, char *expr, fitsfile *outfptr,\n               char *parName, char *parInfo, int nRngs,\n                 long *start, long *end, int *status );\n\nint CFITS_API ffcalc( fitsfile *infptr, char *expr, fitsfile *outfptr,\n            char *parName, char *parInfo, int *status );\n\n  /* ffhist is not really intended as a user-callable routine */\n  /* but it may be useful for some specialized applications   */\n  /* ffhist2 is a newer version which is strongly recommended instead of ffhist */\n\nint CFITS_API ffhist(fitsfile **fptr, char *outfile, int imagetype, int naxis,\n           char colname[4][FLEN_VALUE],\n           double *minin, double *maxin, double *binsizein,\n           char minname[4][FLEN_VALUE], char maxname[4][FLEN_VALUE],\n           char binname[4][FLEN_VALUE], \n           double weightin, char wtcol[FLEN_VALUE],\n           int recip, char *rowselect, int *status);\nint CFITS_API ffhist2(fitsfile **fptr, char *outfile, int imagetype, int naxis,\n           char colname[4][FLEN_VALUE],\n           double *minin, double *maxin, double *binsizein,\n           char minname[4][FLEN_VALUE], char maxname[4][FLEN_VALUE],\n           char binname[4][FLEN_VALUE], \n           double weightin, char wtcol[FLEN_VALUE],\n           int recip, char *rowselect, int *status);\nCFITS_API fitsfile *ffhist3(fitsfile *fptr, \n           char *outfile, int imagetype,  int naxis,     \n           char colname[4][FLEN_VALUE],  \n           double *minin,     \n           double *maxin,     \n           double *binsizein, \n           char minname[4][FLEN_VALUE], \n           char maxname[4][FLEN_VALUE], \n           char binname[4][FLEN_VALUE], \n           double weightin,        \n           char wtcol[FLEN_VALUE], \n           int recip,              \n           char *selectrow,        \n           int *status);\nint CFITS_API fits_select_image_section(fitsfile **fptr, char *outfile,\n           char *imagesection, int *status);\nint CFITS_API fits_copy_image_section(fitsfile *infptr, fitsfile *outfile,\n           char *imagesection, int *status);\n\nint CFITS_API fits_calc_binning(fitsfile *fptr, int naxis, char colname[4][FLEN_VALUE], \n    double *minin, double *maxin,  double *binsizein,\n    char minname[4][FLEN_VALUE],  char maxname[4][FLEN_VALUE], \n    char binname[4][FLEN_VALUE],  int *colnum,  long *haxes,  \n    float *amin, float *amax, float *binsize,  int *status);\nint CFITS_API fits_calc_binningd(fitsfile *fptr, int naxis, char colname[4][FLEN_VALUE], \n    double *minin, double *maxin,  double *binsizein,\n    char minname[4][FLEN_VALUE],  char maxname[4][FLEN_VALUE], \n    char binname[4][FLEN_VALUE],  int *colnum,  long *haxes,  \n    double *amin, double *amax, double *binsize,  int *status);\n\nint CFITS_API fits_write_keys_histo(fitsfile *fptr,  fitsfile *histptr, \n      int naxis, int *colnum, int *status);  \nint CFITS_API fits_rebin_wcs( fitsfile *fptr, int naxis, float *amin,  float *binsize, \n      int *status);      \nint CFITS_API fits_rebin_wcsd( fitsfile *fptr, int naxis, double *amin,  double *binsize, \n      int *status);      \nint CFITS_API fits_make_hist(fitsfile *fptr, fitsfile *histptr, int bitpix,int naxis,\n     long *naxes,  int *colnum,  float *amin,  float *amax, float *binsize,\n     float weight, int wtcolnum, int recip, char *selectrow, int *status);\nint CFITS_API fits_make_histd(fitsfile *fptr, fitsfile *histptr, int bitpix,int naxis,\n     long *naxes,  int *colnum,  double *amin,  double *amax, double *binsize,\n     double weight, int wtcolnum, int recip, char *selectrow, int *status);\n\ntypedef struct\n{\n\t/* input(s) */\n\tint count;\n\tchar ** path;\n\tchar ** tag;\n\tfitsfile ** ifptr;\n\n\tchar * expression;\n\n\t/* output control */\n\tint bitpix;\n\tlong blank;\n\tfitsfile * ofptr;\n\tchar keyword[FLEN_KEYWORD];\n\tchar comment[FLEN_COMMENT];\n} PixelFilter;\n\n\nint CFITS_API fits_pixel_filter (PixelFilter * filter, int * status);\n\n\n/*--------------------- grouping routines ------------------*/\n\nint CFITS_API ffgtcr(fitsfile *fptr, char *grpname, int grouptype, int *status);\nint CFITS_API ffgtis(fitsfile *fptr, char *grpname, int grouptype, int *status);\nint CFITS_API ffgtch(fitsfile *gfptr, int grouptype, int *status);\nint CFITS_API ffgtrm(fitsfile *gfptr, int rmopt, int *status);\nint CFITS_API ffgtcp(fitsfile *infptr, fitsfile *outfptr, int cpopt, int *status);\nint CFITS_API ffgtmg(fitsfile *infptr, fitsfile *outfptr, int mgopt, int *status);\nint CFITS_API ffgtcm(fitsfile *gfptr, int cmopt, int *status);\nint CFITS_API ffgtvf(fitsfile *gfptr, long *firstfailed, int *status);\nint CFITS_API ffgtop(fitsfile *mfptr,int group,fitsfile **gfptr,int *status);\nint CFITS_API ffgtam(fitsfile *gfptr, fitsfile *mfptr, int hdupos, int *status);\nint CFITS_API ffgtnm(fitsfile *gfptr, long *nmembers, int *status);\nint CFITS_API ffgmng(fitsfile *mfptr, long *nmembers, int *status);\nint CFITS_API ffgmop(fitsfile *gfptr, long member, fitsfile **mfptr, int *status);\nint CFITS_API ffgmcp(fitsfile *gfptr, fitsfile *mfptr, long member, int cpopt, \n\t   int *status);\nint CFITS_API ffgmtf(fitsfile *infptr, fitsfile *outfptr,\tlong member, int tfopt,\t       \n\t   int *status);\nint CFITS_API ffgmrm(fitsfile *fptr, long member, int rmopt, int *status);\n\n/*--------------------- group template parser routines ------------------*/\n\nint CFITS_API fits_execute_template(fitsfile *ff, char *ngp_template, int *status);\n\nint CFITS_API fits_img_stats_short(short *array,long nx, long ny, int nullcheck,   \n    short nullvalue,long *ngoodpix, short *minvalue, short *maxvalue, double *mean,  \n    double *sigma, double *noise1, double *noise2, double *noise3, double *noise5, int *status);\nint CFITS_API fits_img_stats_int(int *array,long nx, long ny, int nullcheck,   \n    int nullvalue,long *ngoodpix, int *minvalue, int *maxvalue, double *mean,  \n    double *sigma, double *noise1, double *noise2, double *noise3, double *noise5, int *status);\nint CFITS_API fits_img_stats_float(float *array, long nx, long ny, int nullcheck,   \n    float nullvalue,long *ngoodpix, float *minvalue, float *maxvalue, double *mean,  \n    double *sigma, double *noise1, double *noise2, double *noise3, double *noise5, int *status);\n\n/*--------------------- image compression routines ------------------*/\n\nint CFITS_API fits_set_compression_type(fitsfile *fptr, int ctype, int *status);\nint CFITS_API fits_set_tile_dim(fitsfile *fptr, int ndim, long *dims, int *status);\nint CFITS_API fits_set_noise_bits(fitsfile *fptr, int noisebits, int *status);\nint CFITS_API fits_set_quantize_level(fitsfile *fptr, float qlevel, int *status);\nint CFITS_API fits_set_hcomp_scale(fitsfile *fptr, float scale, int *status);\nint CFITS_API fits_set_hcomp_smooth(fitsfile *fptr, int smooth, int *status);\nint CFITS_API fits_set_quantize_method(fitsfile *fptr, int method, int *status);\nint CFITS_API fits_set_quantize_dither(fitsfile *fptr, int dither, int *status);\nint CFITS_API fits_set_dither_seed(fitsfile *fptr, int seed, int *status);\nint CFITS_API fits_set_dither_offset(fitsfile *fptr, int offset, int *status);\nint CFITS_API fits_set_lossy_int(fitsfile *fptr, int lossy_int, int *status);\nint CFITS_API fits_set_huge_hdu(fitsfile *fptr, int huge, int *status);\nint CFITS_API fits_set_compression_pref(fitsfile *infptr, fitsfile *outfptr, int *status);\n\nint CFITS_API fits_get_compression_type(fitsfile *fptr, int *ctype, int *status);\nint CFITS_API fits_get_tile_dim(fitsfile *fptr, int ndim, long *dims, int *status);\nint CFITS_API fits_get_quantize_level(fitsfile *fptr, float *qlevel, int *status);\nint CFITS_API fits_get_noise_bits(fitsfile *fptr, int *noisebits, int *status);\nint CFITS_API fits_get_hcomp_scale(fitsfile *fptr, float *scale, int *status);\nint CFITS_API fits_get_hcomp_smooth(fitsfile *fptr, int *smooth, int *status);\nint CFITS_API fits_get_dither_seed(fitsfile *fptr, int *seed, int *status);\n\nint CFITS_API fits_img_compress(fitsfile *infptr, fitsfile *outfptr, int *status);\nint CFITS_API fits_compress_img(fitsfile *infptr, fitsfile *outfptr, int compress_type,\n         long *tilesize, int parm1, int parm2, int *status);\nint CFITS_API fits_is_compressed_image(fitsfile *fptr, int *status);\nint CFITS_API fits_is_reentrant(void);\nint CFITS_API fits_decompress_img (fitsfile *infptr, fitsfile *outfptr, int *status);\nint CFITS_API fits_img_decompress_header(fitsfile *infptr, fitsfile *outfptr, int *status);\nint CFITS_API fits_img_decompress (fitsfile *infptr, fitsfile *outfptr, int *status);\n\n/* H-compress routines */\nint CFITS_API fits_hcompress(int *a, int nx, int ny, int scale, char *output, \n    long *nbytes, int *status);\nint CFITS_API fits_hcompress64(LONGLONG *a, int nx, int ny, int scale, char *output, \n    long *nbytes, int *status);\nint CFITS_API fits_hdecompress(unsigned char *input, int smooth, int *a, int *nx, \n       int *ny, int *scale, int *status);\nint CFITS_API fits_hdecompress64(unsigned char *input, int smooth, LONGLONG *a, int *nx, \n       int *ny, int *scale, int *status);\n\nint CFITS_API fits_compress_table  (fitsfile *infptr, fitsfile *outfptr, int *status);\nint CFITS_API fits_uncompress_table(fitsfile *infptr, fitsfile *outfptr, int *status);\n\n/* curl library wrapper routines (for https access) */\nint CFITS_API fits_init_https(void);\nint CFITS_API fits_cleanup_https(void);\nvoid CFITS_API fits_verbose_https(int flag);\n\nvoid CFITS_API ffshdwn(int flag);\nint CFITS_API ffgtmo(void);\nint CFITS_API ffstmo(int sec, int *status);\n\n/*  The following exclusion if __CINT__ is defined is needed for ROOT */\n#ifndef __CINT__\n#ifdef __cplusplus\n}\n#endif\n#endif\n\n#endif\n\n"},{"id":16667,"name":"quantize.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*\n  The following code is based on algorithms written by Richard White at STScI and made\n  available for use in CFITSIO in July 1999 and updated in January 2008. \n*/\n\n# include <stdio.h>\n# include <stdlib.h>\n# include <math.h>\n# include <limits.h>\n# include <float.h>\n\n#include \"fitsio2.h\"\n\n/* nearest integer function */\n# define NINT(x)  ((x >= 0.) ? (int) (x + 0.5) : (int) (x - 0.5))\n\n#define NULL_VALUE -2147483647 /* value used to represent undefined pixels */\n#define ZERO_VALUE -2147483646 /* value used to represent zero-valued pixels */\n#define N_RESERVED_VALUES 10   /* number of reserved values, starting with */\n                               /* and including NULL_VALUE.  These values */\n                               /* may not be used to represent the quantized */\n                               /* and scaled floating point pixel values */\n\t\t\t       /* If lossy Hcompression is used, and the */\n\t\t\t       /* array contains null values, then it is also */\n\t\t\t       /* possible for the compressed values to slightly */\n\t\t\t       /* exceed the range of the actual (lossless) values */\n\t\t\t       /* so we must reserve a little more space */\n\t\t\t       \n/* more than this many standard deviations from the mean is an outlier */\n# define SIGMA_CLIP     5.\n# define NITER          3\t/* number of sigma-clipping iterations */\n\nstatic int FnMeanSigma_short(short *array, long npix, int nullcheck, \n  short nullvalue, long *ngoodpix, double *mean, double *sigma, int *status);       \nstatic int FnMeanSigma_int(int *array, long npix, int nullcheck,\n  int nullvalue, long *ngoodpix, double *mean, double *sigma, int *status);       \nstatic int FnMeanSigma_float(float *array, long npix, int nullcheck,\n  float nullvalue, long *ngoodpix, double *mean, double *sigma, int *status);       \nstatic int FnMeanSigma_double(double *array, long npix, int nullcheck,\n  double nullvalue, long *ngoodpix, double *mean, double *sigma, int *status);       \n\nstatic int FnNoise5_short(short *array, long nx, long ny, int nullcheck, \n   short nullvalue, long *ngood, short *minval, short *maxval, \n   double *n2, double *n3, double *n5, int *status);   \nstatic int FnNoise5_int(int *array, long nx, long ny, int nullcheck, \n   int nullvalue, long *ngood, int *minval, int *maxval, \n   double *n2, double *n3, double *n5, int *status);   \nstatic int FnNoise5_float(float *array, long nx, long ny, int nullcheck, \n   float nullvalue, long *ngood, float *minval, float *maxval, \n   double *n2, double *n3, double *n5, int *status);   \nstatic int FnNoise5_double(double *array, long nx, long ny, int nullcheck, \n   double nullvalue, long *ngood, double *minval, double *maxval, \n   double *n2, double *n3, double *n5, int *status);   \n\nstatic int FnNoise3_short(short *array, long nx, long ny, int nullcheck, \n   short nullvalue, long *ngood, short *minval, short *maxval, double *noise, int *status);       \nstatic int FnNoise3_int(int *array, long nx, long ny, int nullcheck, \n   int nullvalue, long *ngood, int *minval, int *maxval, double *noise, int *status);          \nstatic int FnNoise3_float(float *array, long nx, long ny, int nullcheck, \n   float nullvalue, long *ngood, float *minval, float *maxval, double *noise, int *status);        \nstatic int FnNoise3_double(double *array, long nx, long ny, int nullcheck, \n   double nullvalue, long *ngood, double *minval, double *maxval, double *noise, int *status);        \n\nstatic int FnNoise1_short(short *array, long nx, long ny, \n   int nullcheck, short nullvalue, double *noise, int *status);       \nstatic int FnNoise1_int(int *array, long nx, long ny, \n   int nullcheck, int nullvalue, double *noise, int *status);       \nstatic int FnNoise1_float(float *array, long nx, long ny, \n   int nullcheck, float nullvalue, double *noise, int *status);       \nstatic int FnNoise1_double(double *array, long nx, long ny, \n   int nullcheck, double nullvalue, double *noise, int *status);       \n\nstatic int FnCompare_short (const void *, const void *);\nstatic int FnCompare_int (const void *, const void *);\nstatic int FnCompare_float (const void *, const void *);\nstatic int FnCompare_double (const void *, const void *);\nstatic float quick_select_float(float arr[], int n);\nstatic short quick_select_short(short arr[], int n);\nstatic int quick_select_int(int arr[], int n);\nstatic LONGLONG quick_select_longlong(LONGLONG arr[], int n);\nstatic double quick_select_double(double arr[], int n);\n\n/*---------------------------------------------------------------------------*/\nint fits_quantize_float (long row, float fdata[], long nxpix, long nypix, int nullcheck, \n\tfloat in_null_value, float qlevel, int dither_method, int idata[], double *bscale,\n\tdouble *bzero, int *iminval, int *imaxval) {\n\n/* arguments:\nlong row            i: if positive, used to calculate random dithering seed value\n                       (this is only used when dithering the quantized values)\nfloat fdata[]       i: array of image pixels to be compressed\nlong nxpix          i: number of pixels in each row of fdata\nlong nypix          i: number of rows in fdata\nnullcheck           i: check for nullvalues in fdata?\nfloat in_null_value i: value used to represent undefined pixels in fdata\nfloat qlevel        i: quantization level\nint dither_method   i; which dithering method to use\nint idata[]         o: values of fdata after applying bzero and bscale\ndouble bscale       o: scale factor\ndouble bzero        o: zero offset\nint iminval         o: minimum quantized value that is returned\nint imaxval         o: maximum quantized value that is returned\n\nThe function value will be one if the input fdata were copied to idata;\nin this case the parameters bscale and bzero can be used to convert back to\nnearly the original floating point values:  fdata ~= idata * bscale + bzero.\nIf the function value is zero, the data were not copied to idata.\n*/\n\n\tint status, iseed = 0;\n\tlong i, nx, ngood = 0;\n\tdouble stdev, noise2, noise3, noise5;\t/* MAD 2nd, 3rd, and 5th order noise values */\n\tfloat minval = 0., maxval = 0.;  /* min & max of fdata */\n\tdouble delta;\t\t/* bscale, 1 in idata = delta in fdata */\n\tdouble zeropt;\t        /* bzero */\n\tdouble temp;\n        int nextrand = 0;\n\textern float *fits_rand_value; /* this is defined in imcompress.c */\n\tLONGLONG iqfactor;\n\n\tnx = nxpix * nypix;\n\tif (nx <= 1) {\n\t    *bscale = 1.;\n\t    *bzero  = 0.;\n\t    return (0);\n\t}\n\n        if (qlevel >= 0.) {\n\n\t    /* estimate background noise using MAD pixel differences */\n\t    FnNoise5_float(fdata, nxpix, nypix, nullcheck, in_null_value, &ngood,\n\t        &minval, &maxval, &noise2, &noise3, &noise5, &status);      \n\n\t    if (nullcheck && ngood == 0) {   /* special case of an image filled with Nulls */\n\t        /* set parameters to dummy values, which are not used */\n\t\tminval = 0.;\n\t\tmaxval = 1.;\n\t\tstdev = 1;\n\t    } else {\n\n\t        /* use the minimum of noise2, noise3, and noise5 as the best noise value */\n\t        stdev = noise3;\n\t        if (noise2 != 0. && noise2 < stdev) stdev = noise2;\n\t        if (noise5 != 0. && noise5 < stdev) stdev = noise5;\n            }\n\n\t    if (qlevel == 0.)\n\t        delta = stdev / 4.;  /* default quantization */\n\t    else\n\t        delta = stdev / qlevel;\n\n\t    if (delta == 0.) \n\t        return (0);\t\t\t/* don't quantize */\n\n\t} else {\n\t    /* negative value represents the absolute quantization level */\n\t    delta = -qlevel;\n\n\t    /* only nned to calculate the min and max values */\n\t    FnNoise3_float(fdata, nxpix, nypix, nullcheck, in_null_value, &ngood,\n\t        &minval, &maxval, 0, &status);      \n \t}\n\n        /* check that the range of quantized levels is not > range of int */\n\tif ((maxval - minval) / delta > 2. * 2147483647. - N_RESERVED_VALUES )\n\t    return (0);\t\t\t/* don't quantize */\n\n        if (row > 0) { /* we need to dither the quantized values */\n            if (!fits_rand_value) \n\t        if (fits_init_randoms()) return(MEMORY_ALLOCATION);\n\n\t    /* initialize the index to the next random number in the list */\n            iseed = (int) ((row - 1) % N_RANDOM);\n\t    nextrand = (int) (fits_rand_value[iseed] * 500.);\n\t}\n\n        if (ngood == nx) {   /* don't have to check for nulls */\n            /* return all positive values, if possible since some */\n            /* compression algorithms either only work for positive integers, */\n            /* or are more efficient.  */\n\n            if (dither_method == SUBTRACTIVE_DITHER_2)\n\t    {\n                /* shift the range to be close to the value used to represent zeros */\n                zeropt = minval - delta * (NULL_VALUE + N_RESERVED_VALUES);\n            }\n\t    else if ((maxval - minval) / delta < 2147483647. - N_RESERVED_VALUES )\n            {\n                zeropt = minval;\n\t\t/* fudge the zero point so it is an integer multiple of delta */\n\t\t/* This helps to ensure the same scaling will be performed if the */\n\t\t/* file undergoes multiple fpack/funpack cycles */\n\t\tiqfactor = (LONGLONG) (zeropt/delta  + 0.5);\n\t\tzeropt = iqfactor * delta;               \n            }\n            else\n            {\n                /* center the quantized levels around zero */\n                zeropt = (minval + maxval) / 2.;\n            }\n\n            if (row > 0) {  /* dither the values when quantizing */\n              for (i = 0;  i < nx;  i++) {\n\t    \n\t\tif (dither_method == SUBTRACTIVE_DITHER_2 && fdata[i] == 0.0) {\n\t\t   idata[i] = ZERO_VALUE;\n\t\t} else {\n\t\t   idata[i] =  NINT((((double) fdata[i] - zeropt) / delta) + fits_rand_value[nextrand] - 0.5);\n\t\t}\n\n                nextrand++;\n\t\tif (nextrand == N_RANDOM) {\n\t\t    iseed++;\n\t\t    if (iseed == N_RANDOM) iseed = 0;\n\t            nextrand = (int) (fits_rand_value[iseed] * 500);\n                }\n              }\n            } else {  /* do not dither the values */\n\n       \t        for (i = 0;  i < nx;  i++) {\n\t            idata[i] = NINT ((fdata[i] - zeropt) / delta);\n                }\n            } \n        }\n        else {\n            /* data contains null values; shift the range to be */\n            /* close to the value used to represent null values */\n            zeropt = minval - delta * (NULL_VALUE + N_RESERVED_VALUES);\n\n            if (row > 0) {  /* dither the values */\n\t      for (i = 0;  i < nx;  i++) {\n                if (fdata[i] != in_null_value) {\n\t\t    if (dither_method == SUBTRACTIVE_DITHER_2 && fdata[i] == 0.0) {\n\t\t       idata[i] = ZERO_VALUE;\n\t\t    } else {\n\t\t       idata[i] =  NINT((((double) fdata[i] - zeropt) / delta) + fits_rand_value[nextrand] - 0.5);\n\t\t    }\n                } else {\n                    idata[i] = NULL_VALUE;\n                }\n\n                /* increment the random number index, regardless */\n                nextrand++;\n\t\tif (nextrand == N_RANDOM) {\n\t\t    iseed++;\n\t\t    if (iseed == N_RANDOM) iseed = 0;\n\t            nextrand = (int) (fits_rand_value[iseed] * 500);\n                }\n              }\n            } else {  /* do not dither the values */\n\t       for (i = 0;  i < nx;  i++) {\n \n                 if (fdata[i] != in_null_value) {\n\t\t    idata[i] =  NINT((fdata[i] - zeropt) / delta);\n                 } else { \n                    idata[i] = NULL_VALUE;\n                 }\n               }\n            }\n\t}\n\n        /* calc min and max values */\n        temp = (minval - zeropt) / delta;\n        *iminval =  NINT (temp);\n        temp = (maxval - zeropt) / delta;\n        *imaxval =  NINT (temp);\n\n\t*bscale = delta;\n\t*bzero = zeropt;\n\treturn (1);\t\t\t/* yes, data have been quantized */\n}\n/*---------------------------------------------------------------------------*/\nint fits_quantize_double (long row, double fdata[], long nxpix, long nypix, int nullcheck, \n\tdouble in_null_value, float qlevel, int dither_method, int idata[], double *bscale,\n\tdouble *bzero, int *iminval, int *imaxval) {\n\n/* arguments:\nlong row            i: tile number = row number in the binary table\n                       (this is only used when dithering the quantized values)\ndouble fdata[]      i: array of image pixels to be compressed\nlong nxpix          i: number of pixels in each row of fdata\nlong nypix          i: number of rows in fdata\nnullcheck           i: check for nullvalues in fdata?\ndouble in_null_value i: value used to represent undefined pixels in fdata\nfloat qlevel        i: quantization level\nint dither_method   i; which dithering method to use\nint idata[]         o: values of fdata after applying bzero and bscale\ndouble bscale       o: scale factor\ndouble bzero        o: zero offset\nint iminval         o: minimum quantized value that is returned\nint imaxval         o: maximum quantized value that is returned\n\nThe function value will be one if the input fdata were copied to idata;\nin this case the parameters bscale and bzero can be used to convert back to\nnearly the original floating point values:  fdata ~= idata * bscale + bzero.\nIf the function value is zero, the data were not copied to idata.\n*/\n\n\tint status, iseed = 0;\n\tlong i, nx, ngood = 0;\n\tdouble stdev, noise2 = 0., noise3 = 0., noise5 = 0.;\t/* MAD 2nd, 3rd, and 5th order noise values */\n\tdouble minval = 0., maxval = 0.;  /* min & max of fdata */\n\tdouble delta;\t\t/* bscale, 1 in idata = delta in fdata */\n\tdouble zeropt;\t        /* bzero */\n\tdouble temp;\n        int nextrand = 0;\n\textern float *fits_rand_value;\n\tLONGLONG iqfactor;\n\n\tnx = nxpix * nypix;\n\tif (nx <= 1) {\n\t    *bscale = 1.;\n\t    *bzero  = 0.;\n\t    return (0);\n\t}\n\n        if (qlevel >= 0.) {\n\n\t    /* estimate background noise using MAD pixel differences */\n\t    FnNoise5_double(fdata, nxpix, nypix, nullcheck, in_null_value, &ngood,\n\t        &minval, &maxval, &noise2, &noise3, &noise5, &status);      \n\n\t    if (nullcheck && ngood == 0) {   /* special case of an image filled with Nulls */\n\t        /* set parameters to dummy values, which are not used */\n\t\tminval = 0.;\n\t\tmaxval = 1.;\n\t\tstdev = 1;\n\t    } else {\n\n\t        /* use the minimum of noise2, noise3, and noise5 as the best noise value */\n\t        stdev = noise3;\n\t        if (noise2 != 0. && noise2 < stdev) stdev = noise2;\n\t        if (noise5 != 0. && noise5 < stdev) stdev = noise5;\n            }\n\n\t    if (qlevel == 0.)\n\t        delta = stdev / 4.;  /* default quantization */\n\t    else\n\t        delta = stdev / qlevel;\n\n\t    if (delta == 0.) \n\t        return (0);\t\t\t/* don't quantize */\n\n\t} else {\n\t    /* negative value represents the absolute quantization level */\n\t    delta = -qlevel;\n\n\t    /* only nned to calculate the min and max values */\n\t    FnNoise3_double(fdata, nxpix, nypix, nullcheck, in_null_value, &ngood,\n\t        &minval, &maxval, 0, &status);      \n \t}\n\n        /* check that the range of quantized levels is not > range of int */\n\tif ((maxval - minval) / delta > 2. * 2147483647. - N_RESERVED_VALUES )\n\t    return (0);\t\t\t/* don't quantize */\n\n        if (row > 0) { /* we need to dither the quantized values */\n            if (!fits_rand_value) \n\t       if (fits_init_randoms()) return(MEMORY_ALLOCATION);\n\n\t    /* initialize the index to the next random number in the list */\n            iseed = (int) ((row - 1) % N_RANDOM);\n\t    nextrand = (int) (fits_rand_value[iseed] * 500);\n\t}\n\n        if (ngood == nx) {   /* don't have to check for nulls */\n            /* return all positive values, if possible since some */\n            /* compression algorithms either only work for positive integers, */\n            /* or are more efficient.  */\n\n            if (dither_method == SUBTRACTIVE_DITHER_2)\n\t    {\n                /* shift the range to be close to the value used to represent zeros */\n                zeropt = minval - delta * (NULL_VALUE + N_RESERVED_VALUES);\n            }\n\t    else if ((maxval - minval) / delta < 2147483647. - N_RESERVED_VALUES )\n            {\n                zeropt = minval;\n\t\t/* fudge the zero point so it is an integer multiple of delta */\n\t\t/* This helps to ensure the same scaling will be performed if the */\n\t\t/* file undergoes multiple fpack/funpack cycles */\n\t\tiqfactor = (LONGLONG) (zeropt/delta  + 0.5);\n\t\tzeropt = iqfactor * delta;               \n            }\n            else\n            {\n                /* center the quantized levels around zero */\n                zeropt = (minval + maxval) / 2.;\n            }\n\n            if (row > 0) {  /* dither the values when quantizing */\n       \t      for (i = 0;  i < nx;  i++) {\n\n\t\tif (dither_method == SUBTRACTIVE_DITHER_2 && fdata[i] == 0.0) {\n\t\t   idata[i] = ZERO_VALUE;\n\t\t} else {\n\t\t   idata[i] =  NINT((((double) fdata[i] - zeropt) / delta) + fits_rand_value[nextrand] - 0.5);\n\t\t}\n\n                nextrand++;\n\t\tif (nextrand == N_RANDOM) {\n                    iseed++;\n\t\t    if (iseed == N_RANDOM) iseed = 0;\n\t            nextrand = (int) (fits_rand_value[iseed] * 500);\n                }\n              }\n            } else {  /* do not dither the values */\n\n       \t        for (i = 0;  i < nx;  i++) {\n\t            idata[i] = NINT ((fdata[i] - zeropt) / delta);\n                }\n            } \n        }\n        else {\n            /* data contains null values; shift the range to be */\n            /* close to the value used to represent null values */\n            zeropt = minval - delta * (NULL_VALUE + N_RESERVED_VALUES);\n\n            if (row > 0) {  /* dither the values */\n\t      for (i = 0;  i < nx;  i++) {\n                if (fdata[i] != in_null_value) {\n\t\t    if (dither_method == SUBTRACTIVE_DITHER_2 && fdata[i] == 0.0) {\n\t\t       idata[i] = ZERO_VALUE;\n\t\t    } else {\n\t\t       idata[i] =  NINT((((double) fdata[i] - zeropt) / delta) + fits_rand_value[nextrand] - 0.5);\n\t\t    }\n                } else {\n                    idata[i] = NULL_VALUE;\n                }\n\n                /* increment the random number index, regardless */\n                nextrand++;\n\t\tif (nextrand == N_RANDOM) {\n\t\t    iseed++;\n\t\t    if (iseed == N_RANDOM) iseed = 0;\n\t            nextrand = (int) (fits_rand_value[iseed] * 500);\n                }\n              }\n            } else {  /* do not dither the values */\n\t       for (i = 0;  i < nx;  i++) {\n                 if (fdata[i] != in_null_value)\n\t\t    idata[i] =  NINT((fdata[i] - zeropt) / delta);\n                 else \n                    idata[i] = NULL_VALUE;\n               }\n            }\n\t}\n\n        /* calc min and max values */\n        temp = (minval - zeropt) / delta;\n        *iminval =  NINT (temp);\n        temp = (maxval - zeropt) / delta;\n        *imaxval =  NINT (temp);\n\n\t*bscale = delta;\n\t*bzero = zeropt;\n\n\treturn (1);\t\t\t/* yes, data have been quantized */\n}\n/*--------------------------------------------------------------------------*/\nint fits_img_stats_short(short *array, /*  2 dimensional array of image pixels */\n        long nx,            /* number of pixels in each row of the image */\n\tlong ny,            /* number of rows in the image */\n\t                    /* (if this is a 3D image, then ny should be the */\n\t\t\t    /* product of the no. of rows times the no. of planes) */\n\tint nullcheck,      /* check for null values, if true */\n\tshort nullvalue,    /* value of null pixels, if nullcheck is true */\n\n   /* returned parameters (if the pointer is not null)  */\n\tlong *ngoodpix,     /* number of non-null pixels in the image */\n\tshort *minvalue,    /* returned minimum non-null value in the array */\n\tshort *maxvalue,    /* returned maximum non-null value in the array */\n\tdouble *mean,       /* returned mean value of all non-null pixels */\n\tdouble *sigma,      /* returned R.M.S. value of all non-null pixels */\n\tdouble *noise1,     /* 1st order estimate of noise in image background level */\n\tdouble *noise2,     /* 2nd order estimate of noise in image background level */\n\tdouble *noise3,     /* 3rd order estimate of noise in image background level */\n\tdouble *noise5,     /* 5th order estimate of noise in image background level */\n\tint *status)        /* error status */\n\n/*\n    Compute statistics of the input short integer image.\n*/\n{\n\tlong ngood;\n\tshort minval = 0, maxval = 0;\n\tdouble xmean = 0., xsigma = 0., xnoise = 0., xnoise2 = 0., xnoise3 = 0., xnoise5 = 0.;\n\n\t/* need to calculate mean and/or sigma and/or limits? */\n\tif (mean || sigma ) {\n\t\tFnMeanSigma_short(array, nx * ny, nullcheck, nullvalue, \n\t\t\t&ngood, &xmean, &xsigma, status);\n\n\t    if (ngoodpix) *ngoodpix = ngood;\n\t    if (mean)     *mean = xmean;\n\t    if (sigma)    *sigma = xsigma;\n\t}\n\n\tif (noise1) {\n\t\tFnNoise1_short(array, nx, ny, nullcheck, nullvalue, \n\t\t  &xnoise, status);\n\n\t\t*noise1  = xnoise;\n\t}\n\n\tif (minvalue || maxvalue || noise3) {\n\t\tFnNoise5_short(array, nx, ny, nullcheck, nullvalue, \n\t\t\t&ngood, &minval, &maxval, &xnoise2, &xnoise3, &xnoise5, status);\n\n\t\tif (ngoodpix) *ngoodpix = ngood;\n\t\tif (minvalue) *minvalue= minval;\n\t\tif (maxvalue) *maxvalue = maxval;\n\t\tif (noise2) *noise2  = xnoise2;\n\t\tif (noise3) *noise3  = xnoise3;\n\t\tif (noise5) *noise5  = xnoise5;\n\t}\n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_img_stats_int(int *array, /*  2 dimensional array of image pixels */\n        long nx,            /* number of pixels in each row of the image */\n\tlong ny,            /* number of rows in the image */\n\t                    /* (if this is a 3D image, then ny should be the */\n\t\t\t    /* product of the no. of rows times the no. of planes) */\n\tint nullcheck,      /* check for null values, if true */\n\tint nullvalue,    /* value of null pixels, if nullcheck is true */\n\n   /* returned parameters (if the pointer is not null)  */\n\tlong *ngoodpix,     /* number of non-null pixels in the image */\n\tint *minvalue,    /* returned minimum non-null value in the array */\n\tint *maxvalue,    /* returned maximum non-null value in the array */\n\tdouble *mean,       /* returned mean value of all non-null pixels */\n\tdouble *sigma,      /* returned R.M.S. value of all non-null pixels */\n\tdouble *noise1,     /* 1st order estimate of noise in image background level */\n\tdouble *noise2,     /* 2nd order estimate of noise in image background level */\n\tdouble *noise3,     /* 3rd order estimate of noise in image background level */\n\tdouble *noise5,     /* 5th order estimate of noise in image background level */\n\tint *status)        /* error status */\n\n/*\n    Compute statistics of the input integer image.\n*/\n{\n\tlong ngood;\n\tint minval = 0, maxval = 0;\n\tdouble xmean = 0., xsigma = 0., xnoise = 0., xnoise2 = 0., xnoise3 = 0., xnoise5 = 0.;\n\n\t/* need to calculate mean and/or sigma and/or limits? */\n\tif (mean || sigma ) {\n\t\tFnMeanSigma_int(array, nx * ny, nullcheck, nullvalue, \n\t\t\t&ngood, &xmean, &xsigma, status);\n\n\t    if (ngoodpix) *ngoodpix = ngood;\n\t    if (mean)     *mean = xmean;\n\t    if (sigma)    *sigma = xsigma;\n\t}\n\n\tif (noise1) {\n\t\tFnNoise1_int(array, nx, ny, nullcheck, nullvalue, \n\t\t  &xnoise, status);\n\n\t\t*noise1  = xnoise;\n\t}\n\n\tif (minvalue || maxvalue || noise3) {\n\t\tFnNoise5_int(array, nx, ny, nullcheck, nullvalue, \n\t\t\t&ngood, &minval, &maxval, &xnoise2, &xnoise3, &xnoise5, status);\n\n\t\tif (ngoodpix) *ngoodpix = ngood;\n\t\tif (minvalue) *minvalue= minval;\n\t\tif (maxvalue) *maxvalue = maxval;\n\t\tif (noise2) *noise2  = xnoise2;\n\t\tif (noise3) *noise3  = xnoise3;\n\t\tif (noise5) *noise5  = xnoise5;\n\t}\n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_img_stats_float(float *array, /*  2 dimensional array of image pixels */\n        long nx,            /* number of pixels in each row of the image */\n\tlong ny,            /* number of rows in the image */\n\t                    /* (if this is a 3D image, then ny should be the */\n\t\t\t    /* product of the no. of rows times the no. of planes) */\n\tint nullcheck,      /* check for null values, if true */\n\tfloat nullvalue,    /* value of null pixels, if nullcheck is true */\n\n   /* returned parameters (if the pointer is not null)  */\n\tlong *ngoodpix,     /* number of non-null pixels in the image */\n\tfloat *minvalue,    /* returned minimum non-null value in the array */\n\tfloat *maxvalue,    /* returned maximum non-null value in the array */\n\tdouble *mean,       /* returned mean value of all non-null pixels */\n\tdouble *sigma,      /* returned R.M.S. value of all non-null pixels */\n\tdouble *noise1,     /* 1st order estimate of noise in image background level */\n\tdouble *noise2,     /* 2nd order estimate of noise in image background level */\n\tdouble *noise3,     /* 3rd order estimate of noise in image background level */\n\tdouble *noise5,     /* 5th order estimate of noise in image background level */\n\tint *status)        /* error status */\n\n/*\n    Compute statistics of the input float image.\n*/\n{\n\tlong ngood;\n\tfloat minval, maxval;\n\tdouble xmean = 0., xsigma = 0., xnoise = 0., xnoise2 = 0., xnoise3 = 0., xnoise5 = 0.;\n\n\t/* need to calculate mean and/or sigma and/or limits? */\n\tif (mean || sigma ) {\n\t\tFnMeanSigma_float(array, nx * ny, nullcheck, nullvalue, \n\t\t\t&ngood, &xmean, &xsigma, status);\n\n\t    if (ngoodpix) *ngoodpix = ngood;\n\t    if (mean)     *mean = xmean;\n\t    if (sigma)    *sigma = xsigma;\n\t}\n\n\tif (noise1) {\n\t\tFnNoise1_float(array, nx, ny, nullcheck, nullvalue, \n\t\t  &xnoise, status);\n\n\t\t*noise1  = xnoise;\n\t}\n\n\tif (minvalue || maxvalue || noise3) {\n\t\tFnNoise5_float(array, nx, ny, nullcheck, nullvalue, \n\t\t\t&ngood, &minval, &maxval, &xnoise2, &xnoise3, &xnoise5, status);\n\n\t\tif (ngoodpix) *ngoodpix = ngood;\n\t\tif (minvalue) *minvalue= minval;\n\t\tif (maxvalue) *maxvalue = maxval;\n\t\tif (noise2) *noise2  = xnoise2;\n\t\tif (noise3) *noise3  = xnoise3;\n\t\tif (noise5) *noise5  = xnoise5;\n\t}\n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnMeanSigma_short\n       (short *array,       /*  2 dimensional array of image pixels */\n        long npix,          /* number of pixels in the image */\n\tint nullcheck,      /* check for null values, if true */\n\tshort nullvalue,    /* value of null pixels, if nullcheck is true */\n\n   /* returned parameters */\n   \n\tlong *ngoodpix,     /* number of non-null pixels in the image */\n\tdouble *mean,       /* returned mean value of all non-null pixels */\n\tdouble *sigma,      /* returned R.M.S. value of all non-null pixels */\n\tint *status)        /* error status */\n\n/*\nCompute mean and RMS sigma of the non-null pixels in the input array.\n*/\n{\n\tlong ii, ngood = 0;\n\tshort *value;\n\tdouble sum = 0., sum2 = 0., xtemp;\n\n\tvalue = array;\n\t    \n\tif (nullcheck) {\n\t        for (ii = 0; ii < npix; ii++, value++) {\n\t\t    if (*value != nullvalue) {\n\t\t        ngood++;\n\t\t        xtemp = (double) *value;\n\t\t        sum += xtemp;\n\t\t        sum2 += (xtemp * xtemp);\n\t\t    }\n\t\t}\n\t} else {\n\t        ngood = npix;\n\t        for (ii = 0; ii < npix; ii++, value++) {\n\t\t        xtemp = (double) *value;\n\t\t        sum += xtemp;\n\t\t        sum2 += (xtemp * xtemp);\n\t\t}\n\t}\n\n\tif (ngood > 1) {\n\t\tif (ngoodpix) *ngoodpix = ngood;\n\t\txtemp = sum / ngood;\n\t\tif (mean)     *mean = xtemp;\n\t\tif (sigma)    *sigma = sqrt((sum2 / ngood) - (xtemp * xtemp));\n\t} else if (ngood == 1){\n\t\tif (ngoodpix) *ngoodpix = 1;\n\t\tif (mean)     *mean = sum;\n\t\tif (sigma)    *sigma = 0.0;\n\t} else {\n\t\tif (ngoodpix) *ngoodpix = 0;\n\t        if (mean)     *mean = 0.;\n\t\tif (sigma)    *sigma = 0.;\n\t}\t    \n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnMeanSigma_int\n       (int *array,       /*  2 dimensional array of image pixels */\n        long npix,          /* number of pixels in the image */\n\tint nullcheck,      /* check for null values, if true */\n\tint nullvalue,    /* value of null pixels, if nullcheck is true */\n\n   /* returned parameters */\n   \n\tlong *ngoodpix,     /* number of non-null pixels in the image */\n\tdouble *mean,       /* returned mean value of all non-null pixels */\n\tdouble *sigma,      /* returned R.M.S. value of all non-null pixels */\n\tint *status)        /* error status */\n\n/*\nCompute mean and RMS sigma of the non-null pixels in the input array.\n*/\n{\n\tlong ii, ngood = 0;\n\tint *value;\n\tdouble sum = 0., sum2 = 0., xtemp;\n\n\tvalue = array;\n\t    \n\tif (nullcheck) {\n\t        for (ii = 0; ii < npix; ii++, value++) {\n\t\t    if (*value != nullvalue) {\n\t\t        ngood++;\n\t\t        xtemp = (double) *value;\n\t\t        sum += xtemp;\n\t\t        sum2 += (xtemp * xtemp);\n\t\t    }\n\t\t}\n\t} else {\n\t        ngood = npix;\n\t        for (ii = 0; ii < npix; ii++, value++) {\n\t\t        xtemp = (double) *value;\n\t\t        sum += xtemp;\n\t\t        sum2 += (xtemp * xtemp);\n\t\t}\n\t}\n\n\tif (ngood > 1) {\n\t\tif (ngoodpix) *ngoodpix = ngood;\n\t\txtemp = sum / ngood;\n\t\tif (mean)     *mean = xtemp;\n\t\tif (sigma)    *sigma = sqrt((sum2 / ngood) - (xtemp * xtemp));\n\t} else if (ngood == 1){\n\t\tif (ngoodpix) *ngoodpix = 1;\n\t\tif (mean)     *mean = sum;\n\t\tif (sigma)    *sigma = 0.0;\n\t} else {\n\t\tif (ngoodpix) *ngoodpix = 0;\n\t        if (mean)     *mean = 0.;\n\t\tif (sigma)    *sigma = 0.;\n\t}\t    \n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnMeanSigma_float\n       (float *array,       /*  2 dimensional array of image pixels */\n        long npix,          /* number of pixels in the image */\n\tint nullcheck,      /* check for null values, if true */\n\tfloat nullvalue,    /* value of null pixels, if nullcheck is true */\n\n   /* returned parameters */\n   \n\tlong *ngoodpix,     /* number of non-null pixels in the image */\n\tdouble *mean,       /* returned mean value of all non-null pixels */\n\tdouble *sigma,      /* returned R.M.S. value of all non-null pixels */\n\tint *status)        /* error status */\n\n/*\nCompute mean and RMS sigma of the non-null pixels in the input array.\n*/\n{\n\tlong ii, ngood = 0;\n\tfloat *value;\n\tdouble sum = 0., sum2 = 0., xtemp;\n\n\tvalue = array;\n\t    \n\tif (nullcheck) {\n\t        for (ii = 0; ii < npix; ii++, value++) {\n\t\t    if (*value != nullvalue) {\n\t\t        ngood++;\n\t\t        xtemp = (double) *value;\n\t\t        sum += xtemp;\n\t\t        sum2 += (xtemp * xtemp);\n\t\t    }\n\t\t}\n\t} else {\n\t        ngood = npix;\n\t        for (ii = 0; ii < npix; ii++, value++) {\n\t\t        xtemp = (double) *value;\n\t\t        sum += xtemp;\n\t\t        sum2 += (xtemp * xtemp);\n\t\t}\n\t}\n\n\tif (ngood > 1) {\n\t\tif (ngoodpix) *ngoodpix = ngood;\n\t\txtemp = sum / ngood;\n\t\tif (mean)     *mean = xtemp;\n\t\tif (sigma)    *sigma = sqrt((sum2 / ngood) - (xtemp * xtemp));\n\t} else if (ngood == 1){\n\t\tif (ngoodpix) *ngoodpix = 1;\n\t\tif (mean)     *mean = sum;\n\t\tif (sigma)    *sigma = 0.0;\n\t} else {\n\t\tif (ngoodpix) *ngoodpix = 0;\n\t        if (mean)     *mean = 0.;\n\t\tif (sigma)    *sigma = 0.;\n\t}\t    \n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnMeanSigma_double\n       (double *array,       /*  2 dimensional array of image pixels */\n        long npix,          /* number of pixels in the image */\n\tint nullcheck,      /* check for null values, if true */\n\tdouble nullvalue,    /* value of null pixels, if nullcheck is true */\n\n   /* returned parameters */\n   \n\tlong *ngoodpix,     /* number of non-null pixels in the image */\n\tdouble *mean,       /* returned mean value of all non-null pixels */\n\tdouble *sigma,      /* returned R.M.S. value of all non-null pixels */\n\tint *status)        /* error status */\n\n/*\nCompute mean and RMS sigma of the non-null pixels in the input array.\n*/\n{\n\tlong ii, ngood = 0;\n\tdouble *value;\n\tdouble sum = 0., sum2 = 0., xtemp;\n\n\tvalue = array;\n\t    \n\tif (nullcheck) {\n\t        for (ii = 0; ii < npix; ii++, value++) {\n\t\t    if (*value != nullvalue) {\n\t\t        ngood++;\n\t\t        xtemp = *value;\n\t\t        sum += xtemp;\n\t\t        sum2 += (xtemp * xtemp);\n\t\t    }\n\t\t}\n\t} else {\n\t        ngood = npix;\n\t        for (ii = 0; ii < npix; ii++, value++) {\n\t\t        xtemp = *value;\n\t\t        sum += xtemp;\n\t\t        sum2 += (xtemp * xtemp);\n\t\t}\n\t}\n\n\tif (ngood > 1) {\n\t\tif (ngoodpix) *ngoodpix = ngood;\n\t\txtemp = sum / ngood;\n\t\tif (mean)     *mean = xtemp;\n\t\tif (sigma)    *sigma = sqrt((sum2 / ngood) - (xtemp * xtemp));\n\t} else if (ngood == 1){\n\t\tif (ngoodpix) *ngoodpix = 1;\n\t\tif (mean)     *mean = sum;\n\t\tif (sigma)    *sigma = 0.0;\n\t} else {\n\t\tif (ngoodpix) *ngoodpix = 0;\n\t        if (mean)     *mean = 0.;\n\t\tif (sigma)    *sigma = 0.;\n\t}\t    \n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnNoise5_short\n       (short *array,       /*  2 dimensional array of image pixels */\n        long nx,            /* number of pixels in each row of the image */\n        long ny,            /* number of rows in the image */\n\tint nullcheck,      /* check for null values, if true */\n\tshort nullvalue,    /* value of null pixels, if nullcheck is true */\n   /* returned parameters */   \n\tlong *ngood,        /* number of good, non-null pixels? */\n\tshort *minval,    /* minimum non-null value */\n\tshort *maxval,    /* maximum non-null value */\n\tdouble *noise2,      /* returned 2nd order MAD of all non-null pixels */\n\tdouble *noise3,      /* returned 3rd order MAD of all non-null pixels */\n\tdouble *noise5,      /* returned 5th order MAD of all non-null pixels */\n\tint *status)        /* error status */\n\n/*\nEstimate the median and background noise in the input image using 2nd, 3rd and 5th\norder Median Absolute Differences.\n\nThe noise in the background of the image is calculated using the MAD algorithms \ndeveloped for deriving the signal to noise ratio in spectra\n(see issue #42 of the ST-ECF newsletter, http://www.stecf.org/documents/newsletter/)\n\n3rd order:  noise = 1.482602 / sqrt(6) * median (abs(2*flux(i) - flux(i-2) - flux(i+2)))\n\nThe returned estimates are the median of the values that are computed for each \nrow of the image.\n*/\n{\n\tlong ii, jj, nrows = 0, nrows2 = 0, nvals, nvals2, ngoodpix = 0;\n\tint *differences2, *differences3, *differences5;\n\tshort *rowpix, v1, v2, v3, v4, v5, v6, v7, v8, v9;\n\tshort xminval = SHRT_MAX, xmaxval = SHRT_MIN;\n\tint do_range = 0;\n\tdouble *diffs2, *diffs3, *diffs5; \n\tdouble xnoise2 = 0, xnoise3 = 0, xnoise5 = 0;\n\t\n\tif (nx < 9) {\n\t\t/* treat entire array as an image with a single row */\n\t\tnx = nx * ny;\n\t\tny = 1;\n\t}\n\n\t/* rows must have at least 9 pixels */\n\tif (nx < 9) {\n\n\t\tfor (ii = 0; ii < nx; ii++) {\n\t\t    if (nullcheck && array[ii] == nullvalue)\n\t\t        continue;\n\t\t    else {\n\t\t\tif (array[ii] < xminval) xminval = array[ii];\n\t\t\tif (array[ii] > xmaxval) xmaxval = array[ii];\n\t\t\tngoodpix++;\n\t\t    }\n\t\t}\n\t\tif (minval) *minval = xminval;\n\t\tif (maxval) *maxval = xmaxval;\n\t\tif (ngood) *ngood = ngoodpix;\n\t\tif (noise2) *noise2 = 0.;\n\t\tif (noise3) *noise3 = 0.;\n\t\tif (noise5) *noise5 = 0.;\n\t\treturn(*status);\n\t}\n\n\t/* do we need to compute the min and max value? */\n\tif (minval || maxval) do_range = 1;\n\t\n        /* allocate arrays used to compute the median and noise estimates */\n\tdifferences2 = calloc(nx, sizeof(int));\n\tif (!differences2) {\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\tdifferences3 = calloc(nx, sizeof(int));\n\tif (!differences3) {\n\t\tfree(differences2);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\tdifferences5 = calloc(nx, sizeof(int));\n\tif (!differences5) {\n\t\tfree(differences2);\n\t\tfree(differences3);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs2 = calloc(ny, sizeof(double));\n\tif (!diffs2) {\n\t\tfree(differences2);\n\t\tfree(differences3);\n\t\tfree(differences5);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs3 = calloc(ny, sizeof(double));\n\tif (!diffs3) {\n\t\tfree(differences2);\n\t\tfree(differences3);\n\t\tfree(differences5);\n\t\tfree(diffs2);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs5 = calloc(ny, sizeof(double));\n\tif (!diffs5) {\n\t\tfree(differences2);\n\t\tfree(differences3);\n\t\tfree(differences5);\n\t\tfree(diffs2);\n\t\tfree(diffs3);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\t/* loop over each row of the image */\n\tfor (jj=0; jj < ny; jj++) {\n\n                rowpix = array + (jj * nx); /* point to first pixel in the row */\n\n\t\t/***** find the first valid pixel in row */\n\t\tii = 0;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv1 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v1 < xminval) xminval = v1;\n\t\t\tif (v1 > xmaxval) xmaxval = v1;\n\t\t}\n\n\t\t/***** find the 2nd valid pixel in row (which we will skip over) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv2 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\t\t\n\t\tif (do_range) {\n\t\t\tif (v2 < xminval) xminval = v2;\n\t\t\tif (v2 > xmaxval) xmaxval = v2;\n\t\t}\n\n\t\t/***** find the 3rd valid pixel in row */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv3 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v3 < xminval) xminval = v3;\n\t\t\tif (v3 > xmaxval) xmaxval = v3;\n\t\t}\n\t\t\t\t\n\t\t/* find the 4nd valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv4 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v4 < xminval) xminval = v4;\n\t\t\tif (v4 > xmaxval) xmaxval = v4;\n\t\t}\n\t\t\t\n\t\t/* find the 5th valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv5 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v5 < xminval) xminval = v5;\n\t\t\tif (v5 > xmaxval) xmaxval = v5;\n\t\t}\n\t\t\t\t\n\t\t/* find the 6th valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv6 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v6 < xminval) xminval = v6;\n\t\t\tif (v6 > xmaxval) xmaxval = v6;\n\t\t}\n\t\t\t\t\n\t\t/* find the 7th valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv7 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v7 < xminval) xminval = v7;\n\t\t\tif (v7 > xmaxval) xmaxval = v7;\n\t\t}\n\t\t\t\t\n\t\t/* find the 8th valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv8 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v8 < xminval) xminval = v8;\n\t\t\tif (v8 > xmaxval) xmaxval = v8;\n\t\t}\n\t\t/* now populate the differences arrays */\n\t\t/* for the remaining pixels in the row */\n\t\tnvals = 0;\n\t\tnvals2 = 0;\n\t\tfor (ii++; ii < nx; ii++) {\n\n\t\t    /* find the next valid pixel in row */\n                    if (nullcheck)\n\t\t        while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\t\t     \n\t\t    if (ii == nx) break;  /* hit end of row */\n\t\t    v9 = rowpix[ii];  /* store the good pixel value */\n\n\t\t    if (do_range) {\n\t\t\tif (v9 < xminval) xminval = v9;\n\t\t\tif (v9 > xmaxval) xmaxval = v9;\n\t\t    }\n\n\t\t    /* construct array of absolute differences */\n\n\t\t    if (!(v5 == v6 && v6 == v7) ) {\n\t\t        differences2[nvals2] =  abs((int) v5 - (int) v7);\n\t\t\tnvals2++;\n\t\t    }\n\n\t\t    if (!(v3 == v4 && v4 == v5 && v5 == v6 && v6 == v7) ) {\n\t\t        differences3[nvals] =  abs((2 * (int) v5) - (int) v3 - (int) v7);\n\t\t        differences5[nvals] =  abs((6 * (int) v5) - (4 * (int) v3) - (4 * (int) v7) + (int) v1 + (int) v9);\n\t\t        nvals++;  \n\t\t    } else {\n\t\t        /* ignore constant background regions */\n\t\t\tngoodpix++;\n\t\t    }\n\n\t\t    /* shift over 1 pixel */\n\t\t    v1 = v2;\n\t\t    v2 = v3;\n\t\t    v3 = v4;\n\t\t    v4 = v5;\n\t\t    v5 = v6;\n\t\t    v6 = v7;\n\t\t    v7 = v8;\n\t\t    v8 = v9;\n\t        }  /* end of loop over pixels in the row */\n\n\t\t/* compute the median diffs */\n\t\t/* Note that there are 8 more pixel values than there are diffs values. */\n\t\tngoodpix += nvals;\n\n\t\tif (nvals == 0) {\n\t\t    continue;  /* cannot compute medians on this row */\n\t\t} else if (nvals == 1) {\n\t\t    if (nvals2 == 1) {\n\t\t        diffs2[nrows2] = differences2[0];\n\t\t\tnrows2++;\n\t\t    }\n\t\t        \n\t\t    diffs3[nrows] = differences3[0];\n\t\t    diffs5[nrows] = differences5[0];\n\t\t} else {\n                    /* quick_select returns the median MUCH faster than using qsort */\n\t\t    if (nvals2 > 1) {\n                        diffs2[nrows2] = quick_select_int(differences2, nvals);\n\t\t\tnrows2++;\n\t\t    }\n\n                    diffs3[nrows] = quick_select_int(differences3, nvals);\n                    diffs5[nrows] = quick_select_int(differences5, nvals);\n\t\t}\n\n\t\tnrows++;\n\t}  /* end of loop over rows */\n\n\t    /* compute median of the values for each row */\n\tif (nrows == 0) { \n\t       xnoise3 = 0;\n\t       xnoise5 = 0;\n\t} else if (nrows == 1) {\n\t       xnoise3 = diffs3[0];\n\t       xnoise5 = diffs5[0];\n\t} else {\t    \n\t       qsort(diffs3, nrows, sizeof(double), FnCompare_double);\n\t       qsort(diffs5, nrows, sizeof(double), FnCompare_double);\n\t       xnoise3 =  (diffs3[(nrows - 1)/2] + diffs3[nrows/2]) / 2.;\n\t       xnoise5 =  (diffs5[(nrows - 1)/2] + diffs5[nrows/2]) / 2.;\n\t}\n\n\tif (nrows2 == 0) { \n\t       xnoise2 = 0;\n\t} else if (nrows2 == 1) {\n\t       xnoise2 = diffs2[0];\n\t} else {\t    \n\t       qsort(diffs2, nrows2, sizeof(double), FnCompare_double);\n\t       xnoise2 =  (diffs2[(nrows2 - 1)/2] + diffs2[nrows2/2]) / 2.;\n\t}\n\n\tif (ngood)  *ngood  = ngoodpix;\n\tif (minval) *minval = xminval;\n\tif (maxval) *maxval = xmaxval;\n\tif (noise2)  *noise2  = 1.0483579 * xnoise2;\n\tif (noise3)  *noise3  = 0.6052697 * xnoise3;\n\tif (noise5)  *noise5  = 0.1772048 * xnoise5;\n\n\tfree(diffs5);\n\tfree(diffs3);\n\tfree(diffs2);\n\tfree(differences5);\n\tfree(differences3);\n\tfree(differences2);\n\n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnNoise5_int\n       (int *array,       /*  2 dimensional array of image pixels */\n        long nx,            /* number of pixels in each row of the image */\n        long ny,            /* number of rows in the image */\n\tint nullcheck,      /* check for null values, if true */\n\tint nullvalue,    /* value of null pixels, if nullcheck is true */\n   /* returned parameters */   \n\tlong *ngood,        /* number of good, non-null pixels? */\n\tint *minval,    /* minimum non-null value */\n\tint *maxval,    /* maximum non-null value */\n\tdouble *noise2,      /* returned 2nd order MAD of all non-null pixels */\n\tdouble *noise3,      /* returned 3rd order MAD of all non-null pixels */\n\tdouble *noise5,      /* returned 5th order MAD of all non-null pixels */\n\tint *status)        /* error status */\n\n/*\nEstimate the median and background noise in the input image using 2nd, 3rd and 5th\norder Median Absolute Differences.\n\nThe noise in the background of the image is calculated using the MAD algorithms \ndeveloped for deriving the signal to noise ratio in spectra\n(see issue #42 of the ST-ECF newsletter, http://www.stecf.org/documents/newsletter/)\n\n3rd order:  noise = 1.482602 / sqrt(6) * median (abs(2*flux(i) - flux(i-2) - flux(i+2)))\n\nThe returned estimates are the median of the values that are computed for each \nrow of the image.\n*/\n{\n\tlong ii, jj, nrows = 0, nrows2 = 0, nvals, nvals2, ngoodpix = 0;\n\tLONGLONG *differences2, *differences3, *differences5, tdiff;\n\tint *rowpix, v1, v2, v3, v4, v5, v6, v7, v8, v9;\n\tint xminval = INT_MAX, xmaxval = INT_MIN;\n\tint do_range = 0;\n\tdouble *diffs2, *diffs3, *diffs5; \n\tdouble xnoise2 = 0, xnoise3 = 0, xnoise5 = 0;\n\t\n\tif (nx < 9) {\n\t\t/* treat entire array as an image with a single row */\n\t\tnx = nx * ny;\n\t\tny = 1;\n\t}\n\n\t/* rows must have at least 9 pixels */\n\tif (nx < 9) {\n\n\t\tfor (ii = 0; ii < nx; ii++) {\n\t\t    if (nullcheck && array[ii] == nullvalue)\n\t\t        continue;\n\t\t    else {\n\t\t\tif (array[ii] < xminval) xminval = array[ii];\n\t\t\tif (array[ii] > xmaxval) xmaxval = array[ii];\n\t\t\tngoodpix++;\n\t\t    }\n\t\t}\n\t\tif (minval) *minval = xminval;\n\t\tif (maxval) *maxval = xmaxval;\n\t\tif (ngood) *ngood = ngoodpix;\n\t\tif (noise2) *noise2 = 0.;\n\t\tif (noise3) *noise3 = 0.;\n\t\tif (noise5) *noise5 = 0.;\n\t\treturn(*status);\n\t}\n\n\t/* do we need to compute the min and max value? */\n\tif (minval || maxval) do_range = 1;\n\t\n        /* allocate arrays used to compute the median and noise estimates */\n\tdifferences2 = calloc(nx, sizeof(LONGLONG));\n\tif (!differences2) {\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\tdifferences3 = calloc(nx, sizeof(LONGLONG));\n\tif (!differences3) {\n\t\tfree(differences2);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\tdifferences5 = calloc(nx, sizeof(LONGLONG));\n\tif (!differences5) {\n\t\tfree(differences2);\n\t\tfree(differences3);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs2 = calloc(ny, sizeof(double));\n\tif (!diffs2) {\n\t\tfree(differences2);\n\t\tfree(differences3);\n\t\tfree(differences5);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs3 = calloc(ny, sizeof(double));\n\tif (!diffs3) {\n\t\tfree(differences2);\n\t\tfree(differences3);\n\t\tfree(differences5);\n\t\tfree(diffs2);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs5 = calloc(ny, sizeof(double));\n\tif (!diffs5) {\n\t\tfree(differences2);\n\t\tfree(differences3);\n\t\tfree(differences5);\n\t\tfree(diffs2);\n\t\tfree(diffs3);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\t/* loop over each row of the image */\n\tfor (jj=0; jj < ny; jj++) {\n\n                rowpix = array + (jj * nx); /* point to first pixel in the row */\n\n\t\t/***** find the first valid pixel in row */\n\t\tii = 0;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv1 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v1 < xminval) xminval = v1;\n\t\t\tif (v1 > xmaxval) xmaxval = v1;\n\t\t}\n\n\t\t/***** find the 2nd valid pixel in row (which we will skip over) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv2 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\t\t\n\t\tif (do_range) {\n\t\t\tif (v2 < xminval) xminval = v2;\n\t\t\tif (v2 > xmaxval) xmaxval = v2;\n\t\t}\n\n\t\t/***** find the 3rd valid pixel in row */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv3 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v3 < xminval) xminval = v3;\n\t\t\tif (v3 > xmaxval) xmaxval = v3;\n\t\t}\n\t\t\t\t\n\t\t/* find the 4nd valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv4 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v4 < xminval) xminval = v4;\n\t\t\tif (v4 > xmaxval) xmaxval = v4;\n\t\t}\n\t\t\t\n\t\t/* find the 5th valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv5 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v5 < xminval) xminval = v5;\n\t\t\tif (v5 > xmaxval) xmaxval = v5;\n\t\t}\n\t\t\t\t\n\t\t/* find the 6th valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv6 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v6 < xminval) xminval = v6;\n\t\t\tif (v6 > xmaxval) xmaxval = v6;\n\t\t}\n\t\t\t\t\n\t\t/* find the 7th valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv7 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v7 < xminval) xminval = v7;\n\t\t\tif (v7 > xmaxval) xmaxval = v7;\n\t\t}\n\t\t\t\t\n\t\t/* find the 8th valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv8 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v8 < xminval) xminval = v8;\n\t\t\tif (v8 > xmaxval) xmaxval = v8;\n\t\t}\n\t\t/* now populate the differences arrays */\n\t\t/* for the remaining pixels in the row */\n\t\tnvals = 0;\n\t\tnvals2 = 0;\n\t\tfor (ii++; ii < nx; ii++) {\n\n\t\t    /* find the next valid pixel in row */\n                    if (nullcheck)\n\t\t        while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\t\t     \n\t\t    if (ii == nx) break;  /* hit end of row */\n\t\t    v9 = rowpix[ii];  /* store the good pixel value */\n\n\t\t    if (do_range) {\n\t\t\tif (v9 < xminval) xminval = v9;\n\t\t\tif (v9 > xmaxval) xmaxval = v9;\n\t\t    }\n\n\t\t    /* construct array of absolute differences */\n\n\t\t    if (!(v5 == v6 && v6 == v7) ) {\n\t\t        tdiff =  (LONGLONG) v5 - (LONGLONG) v7;\n\t\t\tif (tdiff < 0)\n\t\t            differences2[nvals2] =  -1 * tdiff;\n\t\t\telse\n\t\t            differences2[nvals2] =  tdiff;\n\n\t\t\tnvals2++;\n\t\t    }\n\n\t\t    if (!(v3 == v4 && v4 == v5 && v5 == v6 && v6 == v7) ) {\n\t\t        tdiff =  (2 * (LONGLONG) v5) - (LONGLONG) v3 - (LONGLONG) v7;\n\t\t\tif (tdiff < 0)\n\t\t            differences3[nvals] =  -1 * tdiff;\n\t\t\telse\n\t\t            differences3[nvals] =  tdiff;\n\n\t\t        tdiff =  (6 * (LONGLONG) v5) - (4 * (LONGLONG) v3) - (4 * (LONGLONG) v7) + (LONGLONG) v1 + (LONGLONG) v9;\n\t\t\tif (tdiff < 0)\n\t\t            differences5[nvals] =  -1 * tdiff;\n\t\t\telse\n\t\t            differences5[nvals] =  tdiff;\n\n\t\t        nvals++;  \n\t\t    } else {\n\t\t        /* ignore constant background regions */\n\t\t\tngoodpix++;\n\t\t    }\n\n\t\t    /* shift over 1 pixel */\n\t\t    v1 = v2;\n\t\t    v2 = v3;\n\t\t    v3 = v4;\n\t\t    v4 = v5;\n\t\t    v5 = v6;\n\t\t    v6 = v7;\n\t\t    v7 = v8;\n\t\t    v8 = v9;\n\t        }  /* end of loop over pixels in the row */\n\n\t\t/* compute the median diffs */\n\t\t/* Note that there are 8 more pixel values than there are diffs values. */\n\t\tngoodpix += nvals;\n\n\t\tif (nvals == 0) {\n\t\t    continue;  /* cannot compute medians on this row */\n\t\t} else if (nvals == 1) {\n\t\t    if (nvals2 == 1) {\n\t\t        diffs2[nrows2] = (double) differences2[0];\n\t\t\tnrows2++;\n\t\t    }\n\t\t        \n\t\t    diffs3[nrows] = (double) differences3[0];\n\t\t    diffs5[nrows] = (double) differences5[0];\n\t\t} else {\n                    /* quick_select returns the median MUCH faster than using qsort */\n\t\t    if (nvals2 > 1) {\n                        diffs2[nrows2] = (double) quick_select_longlong(differences2, nvals);\n\t\t\tnrows2++;\n\t\t    }\n\n                    diffs3[nrows] = (double) quick_select_longlong(differences3, nvals);\n                    diffs5[nrows] = (double) quick_select_longlong(differences5, nvals);\n\t\t}\n\n\t\tnrows++;\n\t}  /* end of loop over rows */\n\n\t    /* compute median of the values for each row */\n\tif (nrows == 0) { \n\t       xnoise3 = 0;\n\t       xnoise5 = 0;\n\t} else if (nrows == 1) {\n\t       xnoise3 = diffs3[0];\n\t       xnoise5 = diffs5[0];\n\t} else {\t    \n\t       qsort(diffs3, nrows, sizeof(double), FnCompare_double);\n\t       qsort(diffs5, nrows, sizeof(double), FnCompare_double);\n\t       xnoise3 =  (diffs3[(nrows - 1)/2] + diffs3[nrows/2]) / 2.;\n\t       xnoise5 =  (diffs5[(nrows - 1)/2] + diffs5[nrows/2]) / 2.;\n\t}\n\n\tif (nrows2 == 0) { \n\t       xnoise2 = 0;\n\t} else if (nrows2 == 1) {\n\t       xnoise2 = diffs2[0];\n\t} else {\t    \n\t       qsort(diffs2, nrows2, sizeof(double), FnCompare_double);\n\t       xnoise2 =  (diffs2[(nrows2 - 1)/2] + diffs2[nrows2/2]) / 2.;\n\t}\n\n\tif (ngood)  *ngood  = ngoodpix;\n\tif (minval) *minval = xminval;\n\tif (maxval) *maxval = xmaxval;\n\tif (noise2)  *noise2  = 1.0483579 * xnoise2;\n\tif (noise3)  *noise3  = 0.6052697 * xnoise3;\n\tif (noise5)  *noise5  = 0.1772048 * xnoise5;\n\n\tfree(diffs5);\n\tfree(diffs3);\n\tfree(diffs2);\n\tfree(differences5);\n\tfree(differences3);\n\tfree(differences2);\n\n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnNoise5_float\n       (float *array,       /*  2 dimensional array of image pixels */\n        long nx,            /* number of pixels in each row of the image */\n        long ny,            /* number of rows in the image */\n\tint nullcheck,      /* check for null values, if true */\n\tfloat nullvalue,    /* value of null pixels, if nullcheck is true */\n   /* returned parameters */   \n\tlong *ngood,        /* number of good, non-null pixels? */\n\tfloat *minval,    /* minimum non-null value */\n\tfloat *maxval,    /* maximum non-null value */\n\tdouble *noise2,      /* returned 2nd order MAD of all non-null pixels */\n\tdouble *noise3,      /* returned 3rd order MAD of all non-null pixels */\n\tdouble *noise5,      /* returned 5th order MAD of all non-null pixels */\n\tint *status)        /* error status */\n\n/*\nEstimate the median and background noise in the input image using 2nd, 3rd and 5th\norder Median Absolute Differences.\n\nThe noise in the background of the image is calculated using the MAD algorithms \ndeveloped for deriving the signal to noise ratio in spectra\n(see issue #42 of the ST-ECF newsletter, http://www.stecf.org/documents/newsletter/)\n\n3rd order:  noise = 1.482602 / sqrt(6) * median (abs(2*flux(i) - flux(i-2) - flux(i+2)))\n\nThe returned estimates are the median of the values that are computed for each \nrow of the image.\n*/\n{\n\tlong ii, jj, nrows = 0, nrows2 = 0, nvals, nvals2, ngoodpix = 0;\n\tfloat *differences2, *differences3, *differences5;\n\tfloat *rowpix, v1, v2, v3, v4, v5, v6, v7, v8, v9;\n\tfloat xminval = FLT_MAX, xmaxval = -FLT_MAX;\n\tint do_range = 0;\n\tdouble *diffs2, *diffs3, *diffs5; \n\tdouble xnoise2 = 0, xnoise3 = 0, xnoise5 = 0;\n\t\n\tif (nx < 9) {\n\t\t/* treat entire array as an image with a single row */\n\t\tnx = nx * ny;\n\t\tny = 1;\n\t}\n\n\t/* rows must have at least 9 pixels */\n\tif (nx < 9) {\n\n\t\tfor (ii = 0; ii < nx; ii++) {\n\t\t    if (nullcheck && array[ii] == nullvalue)\n\t\t        continue;\n\t\t    else {\n\t\t\tif (array[ii] < xminval) xminval = array[ii];\n\t\t\tif (array[ii] > xmaxval) xmaxval = array[ii];\n\t\t\tngoodpix++;\n\t\t    }\n\t\t}\n\t\tif (minval) *minval = xminval;\n\t\tif (maxval) *maxval = xmaxval;\n\t\tif (ngood) *ngood = ngoodpix;\n\t\tif (noise2) *noise2 = 0.;\n\t\tif (noise3) *noise3 = 0.;\n\t\tif (noise5) *noise5 = 0.;\n\t\treturn(*status);\n\t}\n\n\t/* do we need to compute the min and max value? */\n\tif (minval || maxval) do_range = 1;\n\t\n        /* allocate arrays used to compute the median and noise estimates */\n\tdifferences2 = calloc(nx, sizeof(float));\n\tif (!differences2) {\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\tdifferences3 = calloc(nx, sizeof(float));\n\tif (!differences3) {\n\t\tfree(differences2);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\tdifferences5 = calloc(nx, sizeof(float));\n\tif (!differences5) {\n\t\tfree(differences2);\n\t\tfree(differences3);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs2 = calloc(ny, sizeof(double));\n\tif (!diffs2) {\n\t\tfree(differences2);\n\t\tfree(differences3);\n\t\tfree(differences5);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs3 = calloc(ny, sizeof(double));\n\tif (!diffs3) {\n\t\tfree(differences2);\n\t\tfree(differences3);\n\t\tfree(differences5);\n\t\tfree(diffs2);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs5 = calloc(ny, sizeof(double));\n\tif (!diffs5) {\n\t\tfree(differences2);\n\t\tfree(differences3);\n\t\tfree(differences5);\n\t\tfree(diffs2);\n\t\tfree(diffs3);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\t/* loop over each row of the image */\n\tfor (jj=0; jj < ny; jj++) {\n\n                rowpix = array + (jj * nx); /* point to first pixel in the row */\n\n\t\t/***** find the first valid pixel in row */\n\t\tii = 0;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv1 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v1 < xminval) xminval = v1;\n\t\t\tif (v1 > xmaxval) xmaxval = v1;\n\t\t}\n\n\t\t/***** find the 2nd valid pixel in row (which we will skip over) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv2 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\t\t\n\t\tif (do_range) {\n\t\t\tif (v2 < xminval) xminval = v2;\n\t\t\tif (v2 > xmaxval) xmaxval = v2;\n\t\t}\n\n\t\t/***** find the 3rd valid pixel in row */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv3 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v3 < xminval) xminval = v3;\n\t\t\tif (v3 > xmaxval) xmaxval = v3;\n\t\t}\n\t\t\t\t\n\t\t/* find the 4nd valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv4 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v4 < xminval) xminval = v4;\n\t\t\tif (v4 > xmaxval) xmaxval = v4;\n\t\t}\n\t\t\t\n\t\t/* find the 5th valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv5 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v5 < xminval) xminval = v5;\n\t\t\tif (v5 > xmaxval) xmaxval = v5;\n\t\t}\n\t\t\t\t\n\t\t/* find the 6th valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv6 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v6 < xminval) xminval = v6;\n\t\t\tif (v6 > xmaxval) xmaxval = v6;\n\t\t}\n\t\t\t\t\n\t\t/* find the 7th valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv7 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v7 < xminval) xminval = v7;\n\t\t\tif (v7 > xmaxval) xmaxval = v7;\n\t\t}\n\t\t\t\t\n\t\t/* find the 8th valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv8 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v8 < xminval) xminval = v8;\n\t\t\tif (v8 > xmaxval) xmaxval = v8;\n\t\t}\n\t\t/* now populate the differences arrays */\n\t\t/* for the remaining pixels in the row */\n\t\tnvals = 0;\n\t\tnvals2 = 0;\n\t\tfor (ii++; ii < nx; ii++) {\n\n\t\t    /* find the next valid pixel in row */\n                    if (nullcheck)\n\t\t        while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\t\t     \n\t\t    if (ii == nx) break;  /* hit end of row */\n\t\t    v9 = rowpix[ii];  /* store the good pixel value */\n\n\t\t    if (do_range) {\n\t\t\tif (v9 < xminval) xminval = v9;\n\t\t\tif (v9 > xmaxval) xmaxval = v9;\n\t\t    }\n\n\t\t    /* construct array of absolute differences */\n\n\t\t    if (!(v5 == v6 && v6 == v7) ) {\n\t\t        differences2[nvals2] = (float) fabs(v5 - v7);\n\t\t\tnvals2++;\n\t\t    }\n\n\t\t    if (!(v3 == v4 && v4 == v5 && v5 == v6 && v6 == v7) ) {\n\t\t        differences3[nvals] = (float) fabs((2 * v5) - v3 - v7);\n\t\t        differences5[nvals] = (float) fabs((6 * v5) - (4 * v3) - (4 * v7) + v1 + v9);\n\t\t        nvals++;  \n\t\t    } else {\n\t\t        /* ignore constant background regions */\n\t\t\tngoodpix++;\n\t\t    }\n\n\t\t    /* shift over 1 pixel */\n\t\t    v1 = v2;\n\t\t    v2 = v3;\n\t\t    v3 = v4;\n\t\t    v4 = v5;\n\t\t    v5 = v6;\n\t\t    v6 = v7;\n\t\t    v7 = v8;\n\t\t    v8 = v9;\n\t        }  /* end of loop over pixels in the row */\n\n\t\t/* compute the median diffs */\n\t\t/* Note that there are 8 more pixel values than there are diffs values. */\n\t\tngoodpix += nvals;\n\n\t\tif (nvals == 0) {\n\t\t    continue;  /* cannot compute medians on this row */\n\t\t} else if (nvals == 1) {\n\t\t    if (nvals2 == 1) {\n\t\t        diffs2[nrows2] = differences2[0];\n\t\t\tnrows2++;\n\t\t    }\n\t\t        \n\t\t    diffs3[nrows] = differences3[0];\n\t\t    diffs5[nrows] = differences5[0];\n\t\t} else {\n                    /* quick_select returns the median MUCH faster than using qsort */\n\t\t    if (nvals2 > 1) {\n                        diffs2[nrows2] = quick_select_float(differences2, nvals);\n\t\t\tnrows2++;\n\t\t    }\n\n                    diffs3[nrows] = quick_select_float(differences3, nvals);\n                    diffs5[nrows] = quick_select_float(differences5, nvals);\n\t\t}\n\n\t\tnrows++;\n\t}  /* end of loop over rows */\n\n\t    /* compute median of the values for each row */\n\tif (nrows == 0) { \n\t       xnoise3 = 0;\n\t       xnoise5 = 0;\n\t} else if (nrows == 1) {\n\t       xnoise3 = diffs3[0];\n\t       xnoise5 = diffs5[0];\n\t} else {\t    \n\t       qsort(diffs3, nrows, sizeof(double), FnCompare_double);\n\t       qsort(diffs5, nrows, sizeof(double), FnCompare_double);\n\t       xnoise3 =  (diffs3[(nrows - 1)/2] + diffs3[nrows/2]) / 2.;\n\t       xnoise5 =  (diffs5[(nrows - 1)/2] + diffs5[nrows/2]) / 2.;\n\t}\n\n\tif (nrows2 == 0) { \n\t       xnoise2 = 0;\n\t} else if (nrows2 == 1) {\n\t       xnoise2 = diffs2[0];\n\t} else {\t    \n\t       qsort(diffs2, nrows2, sizeof(double), FnCompare_double);\n\t       xnoise2 =  (diffs2[(nrows2 - 1)/2] + diffs2[nrows2/2]) / 2.;\n\t}\n\n\tif (ngood)  *ngood  = ngoodpix;\n\tif (minval) *minval = xminval;\n\tif (maxval) *maxval = xmaxval;\n\tif (noise2)  *noise2  = 1.0483579 * xnoise2;\n\tif (noise3)  *noise3  = 0.6052697 * xnoise3;\n\tif (noise5)  *noise5  = 0.1772048 * xnoise5;\n\n\tfree(diffs5);\n\tfree(diffs3);\n\tfree(diffs2);\n\tfree(differences5);\n\tfree(differences3);\n\tfree(differences2);\n\n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnNoise5_double\n       (double *array,       /*  2 dimensional array of image pixels */\n        long nx,            /* number of pixels in each row of the image */\n        long ny,            /* number of rows in the image */\n\tint nullcheck,      /* check for null values, if true */\n\tdouble nullvalue,    /* value of null pixels, if nullcheck is true */\n   /* returned parameters */   \n\tlong *ngood,        /* number of good, non-null pixels? */\n\tdouble *minval,    /* minimum non-null value */\n\tdouble *maxval,    /* maximum non-null value */\n\tdouble *noise2,      /* returned 2nd order MAD of all non-null pixels */\n\tdouble *noise3,      /* returned 3rd order MAD of all non-null pixels */\n\tdouble *noise5,      /* returned 5th order MAD of all non-null pixels */\n\tint *status)        /* error status */\n\n/*\nEstimate the median and background noise in the input image using 2nd, 3rd and 5th\norder Median Absolute Differences.\n\nThe noise in the background of the image is calculated using the MAD algorithms \ndeveloped for deriving the signal to noise ratio in spectra\n(see issue #42 of the ST-ECF newsletter, http://www.stecf.org/documents/newsletter/)\n\n3rd order:  noise = 1.482602 / sqrt(6) * median (abs(2*flux(i) - flux(i-2) - flux(i+2)))\n\nThe returned estimates are the median of the values that are computed for each \nrow of the image.\n*/\n{\n\tlong ii, jj, nrows = 0, nrows2 = 0, nvals, nvals2, ngoodpix = 0;\n\tdouble *differences2, *differences3, *differences5;\n\tdouble *rowpix, v1, v2, v3, v4, v5, v6, v7, v8, v9;\n\tdouble xminval = DBL_MAX, xmaxval = -DBL_MAX;\n\tint do_range = 0;\n\tdouble *diffs2, *diffs3, *diffs5; \n\tdouble xnoise2 = 0, xnoise3 = 0, xnoise5 = 0;\n\t\n\tif (nx < 9) {\n\t\t/* treat entire array as an image with a single row */\n\t\tnx = nx * ny;\n\t\tny = 1;\n\t}\n\n\t/* rows must have at least 9 pixels */\n\tif (nx < 9) {\n\n\t\tfor (ii = 0; ii < nx; ii++) {\n\t\t    if (nullcheck && array[ii] == nullvalue)\n\t\t        continue;\n\t\t    else {\n\t\t\tif (array[ii] < xminval) xminval = array[ii];\n\t\t\tif (array[ii] > xmaxval) xmaxval = array[ii];\n\t\t\tngoodpix++;\n\t\t    }\n\t\t}\n\t\tif (minval) *minval = xminval;\n\t\tif (maxval) *maxval = xmaxval;\n\t\tif (ngood) *ngood = ngoodpix;\n\t\tif (noise2) *noise2 = 0.;\n\t\tif (noise3) *noise3 = 0.;\n\t\tif (noise5) *noise5 = 0.;\n\t\treturn(*status);\n\t}\n\n\t/* do we need to compute the min and max value? */\n\tif (minval || maxval) do_range = 1;\n\t\n        /* allocate arrays used to compute the median and noise estimates */\n\tdifferences2 = calloc(nx, sizeof(double));\n\tif (!differences2) {\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\tdifferences3 = calloc(nx, sizeof(double));\n\tif (!differences3) {\n\t\tfree(differences2);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\tdifferences5 = calloc(nx, sizeof(double));\n\tif (!differences5) {\n\t\tfree(differences2);\n\t\tfree(differences3);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs2 = calloc(ny, sizeof(double));\n\tif (!diffs2) {\n\t\tfree(differences2);\n\t\tfree(differences3);\n\t\tfree(differences5);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs3 = calloc(ny, sizeof(double));\n\tif (!diffs3) {\n\t\tfree(differences2);\n\t\tfree(differences3);\n\t\tfree(differences5);\n\t\tfree(diffs2);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs5 = calloc(ny, sizeof(double));\n\tif (!diffs5) {\n\t\tfree(differences2);\n\t\tfree(differences3);\n\t\tfree(differences5);\n\t\tfree(diffs2);\n\t\tfree(diffs3);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\t/* loop over each row of the image */\n\tfor (jj=0; jj < ny; jj++) {\n\n                rowpix = array + (jj * nx); /* point to first pixel in the row */\n\n\t\t/***** find the first valid pixel in row */\n\t\tii = 0;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv1 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v1 < xminval) xminval = v1;\n\t\t\tif (v1 > xmaxval) xmaxval = v1;\n\t\t}\n\n\t\t/***** find the 2nd valid pixel in row (which we will skip over) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv2 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\t\t\n\t\tif (do_range) {\n\t\t\tif (v2 < xminval) xminval = v2;\n\t\t\tif (v2 > xmaxval) xmaxval = v2;\n\t\t}\n\n\t\t/***** find the 3rd valid pixel in row */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv3 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v3 < xminval) xminval = v3;\n\t\t\tif (v3 > xmaxval) xmaxval = v3;\n\t\t}\n\t\t\t\t\n\t\t/* find the 4nd valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv4 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v4 < xminval) xminval = v4;\n\t\t\tif (v4 > xmaxval) xmaxval = v4;\n\t\t}\n\t\t\t\n\t\t/* find the 5th valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv5 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v5 < xminval) xminval = v5;\n\t\t\tif (v5 > xmaxval) xmaxval = v5;\n\t\t}\n\t\t\t\t\n\t\t/* find the 6th valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv6 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v6 < xminval) xminval = v6;\n\t\t\tif (v6 > xmaxval) xmaxval = v6;\n\t\t}\n\t\t\t\t\n\t\t/* find the 7th valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv7 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v7 < xminval) xminval = v7;\n\t\t\tif (v7 > xmaxval) xmaxval = v7;\n\t\t}\n\t\t\t\t\n\t\t/* find the 8th valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv8 = rowpix[ii];  /* store the good pixel value */\n\t\tngoodpix++;\n\n\t\tif (do_range) {\n\t\t\tif (v8 < xminval) xminval = v8;\n\t\t\tif (v8 > xmaxval) xmaxval = v8;\n\t\t}\n\t\t/* now populate the differences arrays */\n\t\t/* for the remaining pixels in the row */\n\t\tnvals = 0;\n\t\tnvals2 = 0;\n\t\tfor (ii++; ii < nx; ii++) {\n\n\t\t    /* find the next valid pixel in row */\n                    if (nullcheck)\n\t\t        while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\t\t     \n\t\t    if (ii == nx) break;  /* hit end of row */\n\t\t    v9 = rowpix[ii];  /* store the good pixel value */\n\n\t\t    if (do_range) {\n\t\t\tif (v9 < xminval) xminval = v9;\n\t\t\tif (v9 > xmaxval) xmaxval = v9;\n\t\t    }\n\n\t\t    /* construct array of absolute differences */\n\n\t\t    if (!(v5 == v6 && v6 == v7) ) {\n\t\t        differences2[nvals2] =  fabs(v5 - v7);\n\t\t\tnvals2++;\n\t\t    }\n\n\t\t    if (!(v3 == v4 && v4 == v5 && v5 == v6 && v6 == v7) ) {\n\t\t        differences3[nvals] =  fabs((2 * v5) - v3 - v7);\n\t\t        differences5[nvals] =  fabs((6 * v5) - (4 * v3) - (4 * v7) + v1 + v9);\n\t\t        nvals++;  \n\t\t    } else {\n\t\t        /* ignore constant background regions */\n\t\t\tngoodpix++;\n\t\t    }\n\n\t\t    /* shift over 1 pixel */\n\t\t    v1 = v2;\n\t\t    v2 = v3;\n\t\t    v3 = v4;\n\t\t    v4 = v5;\n\t\t    v5 = v6;\n\t\t    v6 = v7;\n\t\t    v7 = v8;\n\t\t    v8 = v9;\n\t        }  /* end of loop over pixels in the row */\n\n\t\t/* compute the median diffs */\n\t\t/* Note that there are 8 more pixel values than there are diffs values. */\n\t\tngoodpix += nvals;\n\n\t\tif (nvals == 0) {\n\t\t    continue;  /* cannot compute medians on this row */\n\t\t} else if (nvals == 1) {\n\t\t    if (nvals2 == 1) {\n\t\t        diffs2[nrows2] = differences2[0];\n\t\t\tnrows2++;\n\t\t    }\n\t\t        \n\t\t    diffs3[nrows] = differences3[0];\n\t\t    diffs5[nrows] = differences5[0];\n\t\t} else {\n                    /* quick_select returns the median MUCH faster than using qsort */\n\t\t    if (nvals2 > 1) {\n                        diffs2[nrows2] = quick_select_double(differences2, nvals);\n\t\t\tnrows2++;\n\t\t    }\n\n                    diffs3[nrows] = quick_select_double(differences3, nvals);\n                    diffs5[nrows] = quick_select_double(differences5, nvals);\n\t\t}\n\n\t\tnrows++;\n\t}  /* end of loop over rows */\n\n\t    /* compute median of the values for each row */\n\tif (nrows == 0) { \n\t       xnoise3 = 0;\n\t       xnoise5 = 0;\n\t} else if (nrows == 1) {\n\t       xnoise3 = diffs3[0];\n\t       xnoise5 = diffs5[0];\n\t} else {\t    \n\t       qsort(diffs3, nrows, sizeof(double), FnCompare_double);\n\t       qsort(diffs5, nrows, sizeof(double), FnCompare_double);\n\t       xnoise3 =  (diffs3[(nrows - 1)/2] + diffs3[nrows/2]) / 2.;\n\t       xnoise5 =  (diffs5[(nrows - 1)/2] + diffs5[nrows/2]) / 2.;\n\t}\n\n\tif (nrows2 == 0) { \n\t       xnoise2 = 0;\n\t} else if (nrows2 == 1) {\n\t       xnoise2 = diffs2[0];\n\t} else {\t    \n\t       qsort(diffs2, nrows2, sizeof(double), FnCompare_double);\n\t       xnoise2 =  (diffs2[(nrows2 - 1)/2] + diffs2[nrows2/2]) / 2.;\n\t}\n\n\tif (ngood)  *ngood  = ngoodpix;\n\tif (minval) *minval = xminval;\n\tif (maxval) *maxval = xmaxval;\n\tif (noise2)  *noise2  = 1.0483579 * xnoise2;\n\tif (noise3)  *noise3  = 0.6052697 * xnoise3;\n\tif (noise5)  *noise5  = 0.1772048 * xnoise5;\n\n\tfree(diffs5);\n\tfree(diffs3);\n\tfree(diffs2);\n\tfree(differences5);\n\tfree(differences3);\n\tfree(differences2);\n\n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnNoise3_short\n       (short *array,       /*  2 dimensional array of image pixels */\n        long nx,            /* number of pixels in each row of the image */\n        long ny,            /* number of rows in the image */\n\tint nullcheck,      /* check for null values, if true */\n\tshort nullvalue,    /* value of null pixels, if nullcheck is true */\n   /* returned parameters */   \n\tlong *ngood,        /* number of good, non-null pixels? */\n\tshort *minval,    /* minimum non-null value */\n\tshort *maxval,    /* maximum non-null value */\n\tdouble *noise,      /* returned R.M.S. value of all non-null pixels */\n\tint *status)        /* error status */\n\n/*\nEstimate the median and background noise in the input image using 3rd order differences.\n\nThe noise in the background of the image is calculated using the 3rd order algorithm \ndeveloped for deriving the signal to noise ratio in spectra\n(see issue #42 of the ST-ECF newsletter, http://www.stecf.org/documents/newsletter/)\n\n  noise = 1.482602 / sqrt(6) * median (abs(2*flux(i) - flux(i-2) - flux(i+2)))\n\nThe returned estimates are the median of the values that are computed for each \nrow of the image.\n*/\n{\n\tlong ii, jj, nrows = 0, nvals, ngoodpix = 0;\n\tshort *differences, *rowpix, v1, v2, v3, v4, v5;\n\tshort xminval = SHRT_MAX, xmaxval = SHRT_MIN, do_range = 0;\n\tdouble *diffs, xnoise = 0, sigma;\n\n\tif (nx < 5) {\n\t\t/* treat entire array as an image with a single row */\n\t\tnx = nx * ny;\n\t\tny = 1;\n\t}\n\n\t/* rows must have at least 5 pixels */\n\tif (nx < 5) {\n\n\t\tfor (ii = 0; ii < nx; ii++) {\n\t\t    if (nullcheck && array[ii] == nullvalue)\n\t\t        continue;\n\t\t    else {\n\t\t\tif (array[ii] < xminval) xminval = array[ii];\n\t\t\tif (array[ii] > xmaxval) xmaxval = array[ii];\n\t\t\tngoodpix++;\n\t\t    }\n\t\t}\n\t\tif (minval) *minval = xminval;\n\t\tif (maxval) *maxval = xmaxval;\n\t\tif (ngood) *ngood = ngoodpix;\n\t\tif (noise) *noise = 0.;\n\t\treturn(*status);\n\t}\n\n\t/* do we need to compute the min and max value? */\n\tif (minval || maxval) do_range = 1;\n\t\n        /* allocate arrays used to compute the median and noise estimates */\n\tdifferences = calloc(nx, sizeof(short));\n\tif (!differences) {\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs = calloc(ny, sizeof(double));\n\tif (!diffs) {\n\t\tfree(differences);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\t/* loop over each row of the image */\n\tfor (jj=0; jj < ny; jj++) {\n\n                rowpix = array + (jj * nx); /* point to first pixel in the row */\n\n\t\t/***** find the first valid pixel in row */\n\t\tii = 0;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv1 = rowpix[ii];  /* store the good pixel value */\n\n\t\tif (do_range) {\n\t\t\tif (v1 < xminval) xminval = v1;\n\t\t\tif (v1 > xmaxval) xmaxval = v1;\n\t\t}\n\n\t\t/***** find the 2nd valid pixel in row (which we will skip over) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv2 = rowpix[ii];  /* store the good pixel value */\n\t\t\n\t\tif (do_range) {\n\t\t\tif (v2 < xminval) xminval = v2;\n\t\t\tif (v2 > xmaxval) xmaxval = v2;\n\t\t}\n\n\t\t/***** find the 3rd valid pixel in row */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv3 = rowpix[ii];  /* store the good pixel value */\n\n\t\tif (do_range) {\n\t\t\tif (v3 < xminval) xminval = v3;\n\t\t\tif (v3 > xmaxval) xmaxval = v3;\n\t\t}\n\t\t\t\t\n\t\t/* find the 4nd valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv4 = rowpix[ii];  /* store the good pixel value */\n\n\t\tif (do_range) {\n\t\t\tif (v4 < xminval) xminval = v4;\n\t\t\tif (v4 > xmaxval) xmaxval = v4;\n\t\t}\n\t\t\n\t\t/* now populate the differences arrays */\n\t\t/* for the remaining pixels in the row */\n\t\tnvals = 0;\n\t\tfor (ii++; ii < nx; ii++) {\n\n\t\t    /* find the next valid pixel in row */\n                    if (nullcheck)\n\t\t        while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\t\t     \n\t\t    if (ii == nx) break;  /* hit end of row */\n\t\t    v5 = rowpix[ii];  /* store the good pixel value */\n\n\t\t    if (do_range) {\n\t\t\tif (v5 < xminval) xminval = v5;\n\t\t\tif (v5 > xmaxval) xmaxval = v5;\n\t\t    }\n\n\t\t    /* construct array of 3rd order absolute differences */\n\t\t    if (!(v1 == v2 && v2 == v3 && v3 == v4 && v4 == v5)) {\n\t\t        differences[nvals] = abs((2 * v3) - v1 - v5);\n\t\t        nvals++;  \n\t\t    } else {\n\t\t        /* ignore constant background regions */\n\t\t\tngoodpix++;\n\t\t    }\n\n\n\t\t    /* shift over 1 pixel */\n\t\t    v1 = v2;\n\t\t    v2 = v3;\n\t\t    v3 = v4;\n\t\t    v4 = v5;\n\t        }  /* end of loop over pixels in the row */\n\n\t\t/* compute the 3rd order diffs */\n\t\t/* Note that there are 4 more pixel values than there are diffs values. */\n\t\tngoodpix += (nvals + 4);\n\n\t\tif (nvals == 0) {\n\t\t    continue;  /* cannot compute medians on this row */\n\t\t} else if (nvals == 1) {\n\t\t    diffs[nrows] = differences[0];\n\t\t} else {\n                    /* quick_select returns the median MUCH faster than using qsort */\n                    diffs[nrows] = quick_select_short(differences, nvals);\n\t\t}\n\n\t\tnrows++;\n\t}  /* end of loop over rows */\n\n\t    /* compute median of the values for each row */\n\tif (nrows == 0) { \n\t       xnoise = 0;\n\t} else if (nrows == 1) {\n\t       xnoise = diffs[0];\n\t} else {\t    \n\n\n\t       qsort(diffs, nrows, sizeof(double), FnCompare_double);\n\t       xnoise =  (diffs[(nrows - 1)/2] + diffs[nrows/2]) / 2.;\n\n              FnMeanSigma_double(diffs, nrows, 0, 0.0, 0, &xnoise, &sigma, status); \n\n\t      /* do a 4.5 sigma rejection of outliers */\n\t      jj = 0;\n\t      sigma = 4.5 * sigma;\n\t      for (ii = 0; ii < nrows; ii++) {\n\t\tif ( fabs(diffs[ii] - xnoise) <= sigma)\t {\n\t\t   if (jj != ii)\n\t\t       diffs[jj] = diffs[ii];\n\t\t   jj++;\n\t        } \n\t      }\n\t      if (ii != jj)\n                FnMeanSigma_double(diffs, jj, 0, 0.0, 0, &xnoise, &sigma, status); \n\t}\n\n\tif (ngood)  *ngood  = ngoodpix;\n\tif (minval) *minval = xminval;\n\tif (maxval) *maxval = xmaxval;\n\tif (noise)  *noise  = 0.6052697 * xnoise;\n\n\tfree(diffs);\n\tfree(differences);\n\n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnNoise3_int\n       (int *array,       /*  2 dimensional array of image pixels */\n        long nx,            /* number of pixels in each row of the image */\n        long ny,            /* number of rows in the image */\n\tint nullcheck,      /* check for null values, if true */\n\tint nullvalue,    /* value of null pixels, if nullcheck is true */\n   /* returned parameters */   \n\tlong *ngood,        /* number of good, non-null pixels? */\n\tint *minval,    /* minimum non-null value */\n\tint *maxval,    /* maximum non-null value */\n\tdouble *noise,      /* returned R.M.S. value of all non-null pixels */\n\tint *status)        /* error status */\n\n/*\nEstimate the background noise in the input image using 3rd order differences.\n\nThe noise in the background of the image is calculated using the 3rd order algorithm \ndeveloped for deriving the signal to noise ratio in spectra\n(see issue #42 of the ST-ECF newsletter, http://www.stecf.org/documents/newsletter/)\n\n  noise = 1.482602 / sqrt(6) * median (abs(2*flux(i) - flux(i-2) - flux(i+2)))\n\nThe returned estimates are the median of the values that are computed for each \nrow of the image.\n*/\n{\n\tlong ii, jj, nrows = 0, nvals, ngoodpix = 0;\n\tint *differences, *rowpix, v1, v2, v3, v4, v5;\n\tint xminval = INT_MAX, xmaxval = INT_MIN, do_range = 0;\n\tdouble *diffs, xnoise = 0, sigma;\n\t\n\tif (nx < 5) {\n\t\t/* treat entire array as an image with a single row */\n\t\tnx = nx * ny;\n\t\tny = 1;\n\t}\n\n\t/* rows must have at least 5 pixels */\n\tif (nx < 5) {\n\n\t\tfor (ii = 0; ii < nx; ii++) {\n\t\t    if (nullcheck && array[ii] == nullvalue)\n\t\t        continue;\n\t\t    else {\n\t\t\tif (array[ii] < xminval) xminval = array[ii];\n\t\t\tif (array[ii] > xmaxval) xmaxval = array[ii];\n\t\t\tngoodpix++;\n\t\t    }\n\t\t}\n\t\tif (minval) *minval = xminval;\n\t\tif (maxval) *maxval = xmaxval;\n\t\tif (ngood) *ngood = ngoodpix;\n\t\tif (noise) *noise = 0.;\n\t\treturn(*status);\n\t}\n\n\t/* do we need to compute the min and max value? */\n\tif (minval || maxval) do_range = 1;\n\t\n        /* allocate arrays used to compute the median and noise estimates */\n\tdifferences = calloc(nx, sizeof(int));\n\tif (!differences) {\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs = calloc(ny, sizeof(double));\n\tif (!diffs) {\n\t\tfree(differences);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\t/* loop over each row of the image */\n\tfor (jj=0; jj < ny; jj++) {\n\n                rowpix = array + (jj * nx); /* point to first pixel in the row */\n\n\t\t/***** find the first valid pixel in row */\n\t\tii = 0;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv1 = rowpix[ii];  /* store the good pixel value */\n\n\t\tif (do_range) {\n\t\t\tif (v1 < xminval) xminval = v1;\n\t\t\tif (v1 > xmaxval) xmaxval = v1;\n\t\t}\n\n\t\t/***** find the 2nd valid pixel in row (which we will skip over) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv2 = rowpix[ii];  /* store the good pixel value */\n\t\t\n\t\tif (do_range) {\n\t\t\tif (v2 < xminval) xminval = v2;\n\t\t\tif (v2 > xmaxval) xmaxval = v2;\n\t\t}\n\n\t\t/***** find the 3rd valid pixel in row */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv3 = rowpix[ii];  /* store the good pixel value */\n\n\t\tif (do_range) {\n\t\t\tif (v3 < xminval) xminval = v3;\n\t\t\tif (v3 > xmaxval) xmaxval = v3;\n\t\t}\n\t\t\t\t\n\t\t/* find the 4nd valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv4 = rowpix[ii];  /* store the good pixel value */\n\n\t\tif (do_range) {\n\t\t\tif (v4 < xminval) xminval = v4;\n\t\t\tif (v4 > xmaxval) xmaxval = v4;\n\t\t}\n\t\t\n\t\t/* now populate the differences arrays */\n\t\t/* for the remaining pixels in the row */\n\t\tnvals = 0;\n\t\tfor (ii++; ii < nx; ii++) {\n\n\t\t    /* find the next valid pixel in row */\n                    if (nullcheck)\n\t\t        while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\t\t     \n\t\t    if (ii == nx) break;  /* hit end of row */\n\t\t    v5 = rowpix[ii];  /* store the good pixel value */\n\n\t\t    if (do_range) {\n\t\t\tif (v5 < xminval) xminval = v5;\n\t\t\tif (v5 > xmaxval) xmaxval = v5;\n\t\t    }\n\n\t\t    /* construct array of 3rd order absolute differences */\n\t\t    if (!(v1 == v2 && v2 == v3 && v3 == v4 && v4 == v5)) {\n\t\t        differences[nvals] = abs((2 * v3) - v1 - v5);\n\t\t        nvals++;  \n\t\t    } else {\n\t\t        /* ignore constant background regions */\n\t\t\tngoodpix++;\n\t\t    }\n\n\t\t    /* shift over 1 pixel */\n\t\t    v1 = v2;\n\t\t    v2 = v3;\n\t\t    v3 = v4;\n\t\t    v4 = v5;\n\t        }  /* end of loop over pixels in the row */\n\n\t\t/* compute the 3rd order diffs */\n\t\t/* Note that there are 4 more pixel values than there are diffs values. */\n\t\tngoodpix += (nvals + 4);\n\n\t\tif (nvals == 0) {\n\t\t    continue;  /* cannot compute medians on this row */\n\t\t} else if (nvals == 1) {\n\t\t    diffs[nrows] = differences[0];\n\t\t} else {\n                    /* quick_select returns the median MUCH faster than using qsort */\n                    diffs[nrows] = quick_select_int(differences, nvals);\n\t\t}\n\n\t\tnrows++;\n\t}  /* end of loop over rows */\n\n\t    /* compute median of the values for each row */\n\tif (nrows == 0) { \n\t       xnoise = 0;\n\t} else if (nrows == 1) {\n\t       xnoise = diffs[0];\n\t} else {\t    \n\n\t       qsort(diffs, nrows, sizeof(double), FnCompare_double);\n\t       xnoise =  (diffs[(nrows - 1)/2] + diffs[nrows/2]) / 2.;\n\n              FnMeanSigma_double(diffs, nrows, 0, 0.0, 0, &xnoise, &sigma, status); \n\n\t      /* do a 4.5 sigma rejection of outliers */\n\t      jj = 0;\n\t      sigma = 4.5 * sigma;\n\t      for (ii = 0; ii < nrows; ii++) {\n\t\tif ( fabs(diffs[ii] - xnoise) <= sigma)\t {\n\t\t   if (jj != ii)\n\t\t       diffs[jj] = diffs[ii];\n\t\t   jj++;\n\t        }\n\t      }\n\t      if (ii != jj)\n                FnMeanSigma_double(diffs, jj, 0, 0.0, 0, &xnoise, &sigma, status); \n\t}\n\n\tif (ngood)  *ngood  = ngoodpix;\n\tif (minval) *minval = xminval;\n\tif (maxval) *maxval = xmaxval;\n\tif (noise)  *noise  = 0.6052697 * xnoise;\n\n\tfree(diffs);\n\tfree(differences);\n\n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnNoise3_float\n       (float *array,       /*  2 dimensional array of image pixels */\n        long nx,            /* number of pixels in each row of the image */\n        long ny,            /* number of rows in the image */\n\tint nullcheck,      /* check for null values, if true */\n\tfloat nullvalue,    /* value of null pixels, if nullcheck is true */\n   /* returned parameters */   \n\tlong *ngood,        /* number of good, non-null pixels? */\n\tfloat *minval,    /* minimum non-null value */\n\tfloat *maxval,    /* maximum non-null value */\n\tdouble *noise,      /* returned R.M.S. value of all non-null pixels */\n\tint *status)        /* error status */\n\n/*\nEstimate the median and background noise in the input image using 3rd order differences.\n\nThe noise in the background of the image is calculated using the 3rd order algorithm \ndeveloped for deriving the signal to noise ratio in spectra\n(see issue #42 of the ST-ECF newsletter, http://www.stecf.org/documents/newsletter/)\n\n  noise = 1.482602 / sqrt(6) * median (abs(2*flux(i) - flux(i-2) - flux(i+2)))\n\nThe returned estimates are the median of the values that are computed for each \nrow of the image.\n*/\n{\n\tlong ii, jj, nrows = 0, nvals, ngoodpix = 0;\n\tfloat *differences, *rowpix, v1, v2, v3, v4, v5;\n\tfloat xminval = FLT_MAX, xmaxval = -FLT_MAX;\n\tint do_range = 0;\n\tdouble *diffs, xnoise = 0;\n\n\tif (nx < 5) {\n\t\t/* treat entire array as an image with a single row */\n\t\tnx = nx * ny;\n\t\tny = 1;\n\t}\n\n\t/* rows must have at least 5 pixels to calc noise, so just calc min, max, ngood */\n\tif (nx < 5) {\n\n\t\tfor (ii = 0; ii < nx; ii++) {\n\t\t    if (nullcheck && array[ii] == nullvalue)\n\t\t        continue;\n\t\t    else {\n\t\t\tif (array[ii] < xminval) xminval = array[ii];\n\t\t\tif (array[ii] > xmaxval) xmaxval = array[ii];\n\t\t\tngoodpix++;\n\t\t    }\n\t\t}\n\t\tif (minval) *minval = xminval;\n\t\tif (maxval) *maxval = xmaxval;\n\t\tif (ngood) *ngood = ngoodpix;\n\t\tif (noise) *noise = 0.;\n\t\treturn(*status);\n\t}\n\n\t/* do we need to compute the min and max value? */\n\tif (minval || maxval) do_range = 1;\n\t\n        /* allocate arrays used to compute the median and noise estimates */\n\tif (noise) {\n\t    differences = calloc(nx, sizeof(float));\n\t    if (!differences) {\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t    }\n\n\t    diffs = calloc(ny, sizeof(double));\n\t    if (!diffs) {\n\t\tfree(differences);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t    }\n\t}\n\n\t/* loop over each row of the image */\n\tfor (jj=0; jj < ny; jj++) {\n\n                rowpix = array + (jj * nx); /* point to first pixel in the row */\n\n\t\t/***** find the first valid pixel in row */\n\t\tii = 0;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv1 = rowpix[ii];  /* store the good pixel value */\n\n\t\tif (do_range) {\n\t\t\tif (v1 < xminval) xminval = v1;\n\t\t\tif (v1 > xmaxval) xmaxval = v1;\n\t\t}\n\n\t\t/***** find the 2nd valid pixel in row (which we will skip over) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv2 = rowpix[ii];  /* store the good pixel value */\n\t\t\n\t\tif (do_range) {\n\t\t\tif (v2 < xminval) xminval = v2;\n\t\t\tif (v2 > xmaxval) xmaxval = v2;\n\t\t}\n\n\t\t/***** find the 3rd valid pixel in row */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv3 = rowpix[ii];  /* store the good pixel value */\n\n\t\tif (do_range) {\n\t\t\tif (v3 < xminval) xminval = v3;\n\t\t\tif (v3 > xmaxval) xmaxval = v3;\n\t\t}\n\t\t\t\t\n\t\t/* find the 4nd valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv4 = rowpix[ii];  /* store the good pixel value */\n\n\t\tif (do_range) {\n\t\t\tif (v4 < xminval) xminval = v4;\n\t\t\tif (v4 > xmaxval) xmaxval = v4;\n\t\t}\n\t\t\n\t\t/* now populate the differences arrays */\n\t\t/* for the remaining pixels in the row */\n\t\tnvals = 0;\n\t\tfor (ii++; ii < nx; ii++) {\n\n\t\t    /* find the next valid pixel in row */\n                    if (nullcheck)\n\t\t        while (ii < nx && rowpix[ii] == nullvalue) {\n\t\t\t  ii++;\n\t\t        }\n\t\t\t\n\t\t    if (ii == nx) break;  /* hit end of row */\n\t\t    v5 = rowpix[ii];  /* store the good pixel value */\n\n\t\t    if (do_range) {\n\t\t\tif (v5 < xminval) xminval = v5;\n\t\t\tif (v5 > xmaxval) xmaxval = v5;\n\t\t    }\n\n\t\t    /* construct array of 3rd order absolute differences */\n\t\t    if (noise) {\n\t\t        if (!(v1 == v2 && v2 == v3 && v3 == v4 && v4 == v5)) {\n\n\t\t            differences[nvals] = (float) fabs((2. * v3) - v1 - v5);\n\t\t            nvals++;  \n\t\t       } else {\n\t\t            /* ignore constant background regions */\n\t\t\t    ngoodpix++;\n\t\t       }\n\t\t    } else {\n\t\t       /* just increment the number of non-null pixels */\n\t\t       ngoodpix++;\n\t\t    }\n\n\t\t    /* shift over 1 pixel */\n\t\t    v1 = v2;\n\t\t    v2 = v3;\n\t\t    v3 = v4;\n\t\t    v4 = v5;\n\t        }  /* end of loop over pixels in the row */\n\n\t\t/* compute the 3rd order diffs */\n\t\t/* Note that there are 4 more pixel values than there are diffs values. */\n\t\tngoodpix += (nvals + 4);\n\n\t\tif (noise) {\n\t\t    if (nvals == 0) {\n\t\t        continue;  /* cannot compute medians on this row */\n\t\t    } else if (nvals == 1) {\n\t\t        diffs[nrows] = differences[0];\n\t\t    } else {\n                        /* quick_select returns the median MUCH faster than using qsort */\n                        diffs[nrows] = quick_select_float(differences, nvals);\n\t\t    }\n\t\t}\n\t\tnrows++;\n\t}  /* end of loop over rows */\n\n\t    /* compute median of the values for each row */\n\tif (noise) {\n\t    if (nrows == 0) { \n\t       xnoise = 0;\n\t    } else if (nrows == 1) {\n\t       xnoise = diffs[0];\n\t    } else {\t    \n\t       qsort(diffs, nrows, sizeof(double), FnCompare_double);\n\t       xnoise =  (diffs[(nrows - 1)/2] + diffs[nrows/2]) / 2.;\n\t    }\n\t}\n\n\tif (ngood)  *ngood  = ngoodpix;\n\tif (minval) *minval = xminval;\n\tif (maxval) *maxval = xmaxval;\n\tif (noise) {\n\t\t*noise  = 0.6052697 * xnoise;\n\t\tfree(diffs);\n\t\tfree(differences);\n\t}\n\n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnNoise3_double\n       (double *array,       /*  2 dimensional array of image pixels */\n        long nx,            /* number of pixels in each row of the image */\n        long ny,            /* number of rows in the image */\n\tint nullcheck,      /* check for null values, if true */\n\tdouble nullvalue,    /* value of null pixels, if nullcheck is true */\n   /* returned parameters */   \n\tlong *ngood,        /* number of good, non-null pixels? */\n\tdouble *minval,    /* minimum non-null value */\n\tdouble *maxval,    /* maximum non-null value */\n\tdouble *noise,      /* returned R.M.S. value of all non-null pixels */\n\tint *status)        /* error status */\n\n/*\nEstimate the median and background noise in the input image using 3rd order differences.\n\nThe noise in the background of the image is calculated using the 3rd order algorithm \ndeveloped for deriving the signal to noise ratio in spectra\n(see issue #42 of the ST-ECF newsletter, http://www.stecf.org/documents/newsletter/)\n\n  noise = 1.482602 / sqrt(6) * median (abs(2*flux(i) - flux(i-2) - flux(i+2)))\n\nThe returned estimates are the median of the values that are computed for each \nrow of the image.\n*/\n{\n\tlong ii, jj, nrows = 0, nvals, ngoodpix = 0;\n\tdouble *differences, *rowpix, v1, v2, v3, v4, v5;\n\tdouble xminval = DBL_MAX, xmaxval = -DBL_MAX;\n\tint do_range = 0;\n\tdouble *diffs, xnoise = 0;\n\t\n\tif (nx < 5) {\n\t\t/* treat entire array as an image with a single row */\n\t\tnx = nx * ny;\n\t\tny = 1;\n\t}\n\n\t/* rows must have at least 5 pixels */\n\tif (nx < 5) {\n\n\t\tfor (ii = 0; ii < nx; ii++) {\n\t\t    if (nullcheck && array[ii] == nullvalue)\n\t\t        continue;\n\t\t    else {\n\t\t\tif (array[ii] < xminval) xminval = array[ii];\n\t\t\tif (array[ii] > xmaxval) xmaxval = array[ii];\n\t\t\tngoodpix++;\n\t\t    }\n\t\t}\n\t\tif (minval) *minval = xminval;\n\t\tif (maxval) *maxval = xmaxval;\n\t\tif (ngood) *ngood = ngoodpix;\n\t\tif (noise) *noise = 0.;\n\t\treturn(*status);\n\t}\n\n\t/* do we need to compute the min and max value? */\n\tif (minval || maxval) do_range = 1;\n\t\n        /* allocate arrays used to compute the median and noise estimates */\n\tif (noise) {\n\t    differences = calloc(nx, sizeof(double));\n\t    if (!differences) {\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t    }\n\n\t    diffs = calloc(ny, sizeof(double));\n\t    if (!diffs) {\n\t\tfree(differences);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t    }\n\t}\n\n\t/* loop over each row of the image */\n\tfor (jj=0; jj < ny; jj++) {\n\n                rowpix = array + (jj * nx); /* point to first pixel in the row */\n\n\t\t/***** find the first valid pixel in row */\n\t\tii = 0;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv1 = rowpix[ii];  /* store the good pixel value */\n\n\t\tif (do_range) {\n\t\t\tif (v1 < xminval) xminval = v1;\n\t\t\tif (v1 > xmaxval) xmaxval = v1;\n\t\t}\n\n\t\t/***** find the 2nd valid pixel in row (which we will skip over) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv2 = rowpix[ii];  /* store the good pixel value */\n\t\t\n\t\tif (do_range) {\n\t\t\tif (v2 < xminval) xminval = v2;\n\t\t\tif (v2 > xmaxval) xmaxval = v2;\n\t\t}\n\n\t\t/***** find the 3rd valid pixel in row */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv3 = rowpix[ii];  /* store the good pixel value */\n\n\t\tif (do_range) {\n\t\t\tif (v3 < xminval) xminval = v3;\n\t\t\tif (v3 > xmaxval) xmaxval = v3;\n\t\t}\n\t\t\t\t\n\t\t/* find the 4nd valid pixel in row (to be skipped) */\n\t\tii++;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv4 = rowpix[ii];  /* store the good pixel value */\n\n\t\tif (do_range) {\n\t\t\tif (v4 < xminval) xminval = v4;\n\t\t\tif (v4 > xmaxval) xmaxval = v4;\n\t\t}\n\t\t\n\t\t/* now populate the differences arrays */\n\t\t/* for the remaining pixels in the row */\n\t\tnvals = 0;\n\t\tfor (ii++; ii < nx; ii++) {\n\n\t\t    /* find the next valid pixel in row */\n                    if (nullcheck)\n\t\t        while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\t\t     \n\t\t    if (ii == nx) break;  /* hit end of row */\n\t\t    v5 = rowpix[ii];  /* store the good pixel value */\n\n\t\t    if (do_range) {\n\t\t\tif (v5 < xminval) xminval = v5;\n\t\t\tif (v5 > xmaxval) xmaxval = v5;\n\t\t    }\n\n\t\t    /* construct array of 3rd order absolute differences */\n\t\t    if (noise) {\n\t\t        if (!(v1 == v2 && v2 == v3 && v3 == v4 && v4 == v5)) {\n\n\t\t            differences[nvals] = fabs((2. * v3) - v1 - v5);\n\t\t            nvals++;  \n\t\t        } else {\n\t\t            /* ignore constant background regions */\n\t\t\t    ngoodpix++;\n\t\t        }\n\t\t    } else {\n\t\t       /* just increment the number of non-null pixels */\n\t\t       ngoodpix++;\n\t\t    }\n\n\t\t    /* shift over 1 pixel */\n\t\t    v1 = v2;\n\t\t    v2 = v3;\n\t\t    v3 = v4;\n\t\t    v4 = v5;\n\t        }  /* end of loop over pixels in the row */\n\n\t\t/* compute the 3rd order diffs */\n\t\t/* Note that there are 4 more pixel values than there are diffs values. */\n\t\tngoodpix += (nvals + 4);\n\n\t\tif (noise) {\n\t\t    if (nvals == 0) {\n\t\t        continue;  /* cannot compute medians on this row */\n\t\t    } else if (nvals == 1) {\n\t\t        diffs[nrows] = differences[0];\n\t\t    } else {\n                        /* quick_select returns the median MUCH faster than using qsort */\n                        diffs[nrows] = quick_select_double(differences, nvals);\n\t\t    }\n\t\t}\n\t\tnrows++;\n\t}  /* end of loop over rows */\n\n\t    /* compute median of the values for each row */\n\tif (noise) {\n\t    if (nrows == 0) { \n\t       xnoise = 0;\n\t    } else if (nrows == 1) {\n\t       xnoise = diffs[0];\n\t    } else {\t    \n\t       qsort(diffs, nrows, sizeof(double), FnCompare_double);\n\t       xnoise =  (diffs[(nrows - 1)/2] + diffs[nrows/2]) / 2.;\n\t    }\n\t}\n\n\tif (ngood)  *ngood  = ngoodpix;\n\tif (minval) *minval = xminval;\n\tif (maxval) *maxval = xmaxval;\n\tif (noise) {\n\t\t*noise  = 0.6052697 * xnoise;\n\t\tfree(diffs);\n\t\tfree(differences);\n\t}\n\n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnNoise1_short\n       (short *array,       /*  2 dimensional array of image pixels */\n        long nx,            /* number of pixels in each row of the image */\n        long ny,            /* number of rows in the image */\n\tint nullcheck,      /* check for null values, if true */\n\tshort nullvalue,    /* value of null pixels, if nullcheck is true */\n   /* returned parameters */   \n\tdouble *noise,      /* returned R.M.S. value of all non-null pixels */\n\tint *status)        /* error status */\n/*\nEstimate the background noise in the input image using sigma of 1st order differences.\n\n  noise = 1.0 / sqrt(2) * rms of (flux[i] - flux[i-1])\n\nThe returned estimate is the median of the values that are computed for each \nrow of the image.\n*/\n{\n\tint iter;\n\tlong ii, jj, kk, nrows = 0, nvals;\n\tshort *differences, *rowpix, v1;\n\tdouble  *diffs, xnoise, mean, stdev;\n\n\t/* rows must have at least 3 pixels to estimate noise */\n\tif (nx < 3) {\n\t\t*noise = 0;\n\t\treturn(*status);\n\t}\n\t\n        /* allocate arrays used to compute the median and noise estimates */\n\tdifferences = calloc(nx, sizeof(short));\n\tif (!differences) {\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs = calloc(ny, sizeof(double));\n\tif (!diffs) {\n\t\tfree(differences);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\t/* loop over each row of the image */\n\tfor (jj=0; jj < ny; jj++) {\n\n                rowpix = array + (jj * nx); /* point to first pixel in the row */\n\n\t\t/***** find the first valid pixel in row */\n\t\tii = 0;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv1 = rowpix[ii];  /* store the good pixel value */\n\n\t\t/* now continue populating the differences arrays */\n\t\t/* for the remaining pixels in the row */\n\t\tnvals = 0;\n\t\tfor (ii++; ii < nx; ii++) {\n\n\t\t    /* find the next valid pixel in row */\n                    if (nullcheck)\n\t\t        while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\t\t     \n\t\t    if (ii == nx) break;  /* hit end of row */\n\t\t\n\t\t    /* construct array of 1st order differences */\n\t\t    differences[nvals] = v1 - rowpix[ii];\n\n\t\t    nvals++;  \n\t\t    /* shift over 1 pixel */\n\t\t    v1 = rowpix[ii];\n\t        }  /* end of loop over pixels in the row */\n\n\t\tif (nvals < 2)\n\t\t   continue;\n\t\telse {\n\n\t\t    FnMeanSigma_short(differences, nvals, 0, 0, 0, &mean, &stdev, status);\n\n\t\t    if (stdev > 0.) {\n\t\t        for (iter = 0;  iter < NITER;  iter++) {\n\t\t            kk = 0;\n\t\t            for (ii = 0;  ii < nvals;  ii++) {\n\t\t                if (fabs (differences[ii] - mean) < SIGMA_CLIP * stdev) {\n\t\t\t            if (kk < ii)\n\t\t\t                differences[kk] = differences[ii];\n\t\t\t            kk++;\n\t\t                }\n\t\t            }\n\t\t            if (kk == nvals) break;\n\n\t\t            nvals = kk;\n\t\t            FnMeanSigma_short(differences, nvals, 0, 0, 0, &mean, &stdev, status);\n\t              }\n\t\t   }\n\n\t\t   diffs[nrows] = stdev;\n\t\t   nrows++;\n\t\t}\n\t}  /* end of loop over rows */\n\n\t/* compute median of the values for each row */\n\tif (nrows == 0) { \n\t       xnoise = 0;\n\t} else if (nrows == 1) {\n\t       xnoise = diffs[0];\n\t} else {\n\t       qsort(diffs, nrows, sizeof(double), FnCompare_double);\n\t       xnoise =  (diffs[(nrows - 1)/2] + diffs[nrows/2]) / 2.;\n\t}\n\n\t*noise = .70710678 * xnoise;\n\n\tfree(diffs);\n\tfree(differences);\n\n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnNoise1_int\n       (int *array,       /*  2 dimensional array of image pixels */\n        long nx,            /* number of pixels in each row of the image */\n        long ny,            /* number of rows in the image */\n\tint nullcheck,      /* check for null values, if true */\n\tint nullvalue,    /* value of null pixels, if nullcheck is true */\n   /* returned parameters */   \n\tdouble *noise,      /* returned R.M.S. value of all non-null pixels */\n\tint *status)        /* error status */\n/*\nEstimate the background noise in the input image using sigma of 1st order differences.\n\n  noise = 1.0 / sqrt(2) * rms of (flux[i] - flux[i-1])\n\nThe returned estimate is the median of the values that are computed for each \nrow of the image.\n*/\n{\n\tint iter;\n\tlong ii, jj, kk, nrows = 0, nvals;\n\tint *differences, *rowpix, v1;\n\tdouble  *diffs, xnoise, mean, stdev;\n\n\t/* rows must have at least 3 pixels to estimate noise */\n\tif (nx < 3) {\n\t\t*noise = 0;\n\t\treturn(*status);\n\t}\n\t\n        /* allocate arrays used to compute the median and noise estimates */\n\tdifferences = calloc(nx, sizeof(int));\n\tif (!differences) {\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs = calloc(ny, sizeof(double));\n\tif (!diffs) {\n\t\tfree(differences);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\t/* loop over each row of the image */\n\tfor (jj=0; jj < ny; jj++) {\n\n                rowpix = array + (jj * nx); /* point to first pixel in the row */\n\n\t\t/***** find the first valid pixel in row */\n\t\tii = 0;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv1 = rowpix[ii];  /* store the good pixel value */\n\n\t\t/* now continue populating the differences arrays */\n\t\t/* for the remaining pixels in the row */\n\t\tnvals = 0;\n\t\tfor (ii++; ii < nx; ii++) {\n\n\t\t    /* find the next valid pixel in row */\n                    if (nullcheck)\n\t\t        while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\t\t     \n\t\t    if (ii == nx) break;  /* hit end of row */\n\t\t\n\t\t    /* construct array of 1st order differences */\n\t\t    differences[nvals] = v1 - rowpix[ii];\n\n\t\t    nvals++;  \n\t\t    /* shift over 1 pixel */\n\t\t    v1 = rowpix[ii];\n\t        }  /* end of loop over pixels in the row */\n\n\t\tif (nvals < 2)\n\t\t   continue;\n\t\telse {\n\n\t\t    FnMeanSigma_int(differences, nvals, 0, 0, 0, &mean, &stdev, status);\n\n\t\t    if (stdev > 0.) {\n\t\t        for (iter = 0;  iter < NITER;  iter++) {\n\t\t            kk = 0;\n\t\t            for (ii = 0;  ii < nvals;  ii++) {\n\t\t                if (fabs (differences[ii] - mean) < SIGMA_CLIP * stdev) {\n\t\t\t            if (kk < ii)\n\t\t\t                differences[kk] = differences[ii];\n\t\t\t            kk++;\n\t\t                }\n\t\t            }\n\t\t            if (kk == nvals) break;\n\n\t\t            nvals = kk;\n\t\t            FnMeanSigma_int(differences, nvals, 0, 0, 0, &mean, &stdev, status);\n\t              }\n\t\t   }\n\n\t\t   diffs[nrows] = stdev;\n\t\t   nrows++;\n\t\t}\n\t}  /* end of loop over rows */\n\n\t/* compute median of the values for each row */\n\tif (nrows == 0) { \n\t       xnoise = 0;\n\t} else if (nrows == 1) {\n\t       xnoise = diffs[0];\n\t} else {\n\t       qsort(diffs, nrows, sizeof(double), FnCompare_double);\n\t       xnoise =  (diffs[(nrows - 1)/2] + diffs[nrows/2]) / 2.;\n\t}\n\n\t*noise = .70710678 * xnoise;\n\n\tfree(diffs);\n\tfree(differences);\n\n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnNoise1_float\n       (float *array,       /*  2 dimensional array of image pixels */\n        long nx,            /* number of pixels in each row of the image */\n        long ny,            /* number of rows in the image */\n\tint nullcheck,      /* check for null values, if true */\n\tfloat nullvalue,    /* value of null pixels, if nullcheck is true */\n   /* returned parameters */   \n\tdouble *noise,      /* returned R.M.S. value of all non-null pixels */\n\tint *status)        /* error status */\n/*\nEstimate the background noise in the input image using sigma of 1st order differences.\n\n  noise = 1.0 / sqrt(2) * rms of (flux[i] - flux[i-1])\n\nThe returned estimate is the median of the values that are computed for each \nrow of the image.\n*/\n{\n\tint iter;\n\tlong ii, jj, kk, nrows = 0, nvals;\n\tfloat *differences, *rowpix, v1;\n\tdouble  *diffs, xnoise, mean, stdev;\n\n\t/* rows must have at least 3 pixels to estimate noise */\n\tif (nx < 3) {\n\t\t*noise = 0;\n\t\treturn(*status);\n\t}\n\t\n        /* allocate arrays used to compute the median and noise estimates */\n\tdifferences = calloc(nx, sizeof(float));\n\tif (!differences) {\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs = calloc(ny, sizeof(double));\n\tif (!diffs) {\n\t\tfree(differences);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\t/* loop over each row of the image */\n\tfor (jj=0; jj < ny; jj++) {\n\n                rowpix = array + (jj * nx); /* point to first pixel in the row */\n\n\t\t/***** find the first valid pixel in row */\n\t\tii = 0;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv1 = rowpix[ii];  /* store the good pixel value */\n\n\t\t/* now continue populating the differences arrays */\n\t\t/* for the remaining pixels in the row */\n\t\tnvals = 0;\n\t\tfor (ii++; ii < nx; ii++) {\n\n\t\t    /* find the next valid pixel in row */\n                    if (nullcheck)\n\t\t        while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\t\t     \n\t\t    if (ii == nx) break;  /* hit end of row */\n\t\t\n\t\t    /* construct array of 1st order differences */\n\t\t    differences[nvals] = v1 - rowpix[ii];\n\n\t\t    nvals++;  \n\t\t    /* shift over 1 pixel */\n\t\t    v1 = rowpix[ii];\n\t        }  /* end of loop over pixels in the row */\n\n\t\tif (nvals < 2)\n\t\t   continue;\n\t\telse {\n\n\t\t    FnMeanSigma_float(differences, nvals, 0, 0, 0, &mean, &stdev, status);\n\n\t\t    if (stdev > 0.) {\n\t\t        for (iter = 0;  iter < NITER;  iter++) {\n\t\t            kk = 0;\n\t\t            for (ii = 0;  ii < nvals;  ii++) {\n\t\t                if (fabs (differences[ii] - mean) < SIGMA_CLIP * stdev) {\n\t\t\t            if (kk < ii)\n\t\t\t                differences[kk] = differences[ii];\n\t\t\t            kk++;\n\t\t                }\n\t\t            }\n\t\t            if (kk == nvals) break;\n\n\t\t            nvals = kk;\n\t\t            FnMeanSigma_float(differences, nvals, 0, 0, 0, &mean, &stdev, status);\n\t              }\n\t\t   }\n\n\t\t   diffs[nrows] = stdev;\n\t\t   nrows++;\n\t\t}\n\t}  /* end of loop over rows */\n\n\t/* compute median of the values for each row */\n\tif (nrows == 0) { \n\t       xnoise = 0;\n\t} else if (nrows == 1) {\n\t       xnoise = diffs[0];\n\t} else {\n\t       qsort(diffs, nrows, sizeof(double), FnCompare_double);\n\t       xnoise =  (diffs[(nrows - 1)/2] + diffs[nrows/2]) / 2.;\n\t}\n\n\t*noise = .70710678 * xnoise;\n\n\tfree(diffs);\n\tfree(differences);\n\n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnNoise1_double\n       (double *array,       /*  2 dimensional array of image pixels */\n        long nx,            /* number of pixels in each row of the image */\n        long ny,            /* number of rows in the image */\n\tint nullcheck,      /* check for null values, if true */\n\tdouble nullvalue,    /* value of null pixels, if nullcheck is true */\n   /* returned parameters */   \n\tdouble *noise,      /* returned R.M.S. value of all non-null pixels */\n\tint *status)        /* error status */\n/*\nEstimate the background noise in the input image using sigma of 1st order differences.\n\n  noise = 1.0 / sqrt(2) * rms of (flux[i] - flux[i-1])\n\nThe returned estimate is the median of the values that are computed for each \nrow of the image.\n*/\n{\n\tint iter;\n\tlong ii, jj, kk, nrows = 0, nvals;\n\tdouble *differences, *rowpix, v1;\n\tdouble  *diffs, xnoise, mean, stdev;\n\n\t/* rows must have at least 3 pixels to estimate noise */\n\tif (nx < 3) {\n\t\t*noise = 0;\n\t\treturn(*status);\n\t}\n\t\n        /* allocate arrays used to compute the median and noise estimates */\n\tdifferences = calloc(nx, sizeof(double));\n\tif (!differences) {\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\tdiffs = calloc(ny, sizeof(double));\n\tif (!diffs) {\n\t\tfree(differences);\n        \t*status = MEMORY_ALLOCATION;\n\t\treturn(*status);\n\t}\n\n\t/* loop over each row of the image */\n\tfor (jj=0; jj < ny; jj++) {\n\n                rowpix = array + (jj * nx); /* point to first pixel in the row */\n\n\t\t/***** find the first valid pixel in row */\n\t\tii = 0;\n\t\tif (nullcheck)\n\t\t    while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\n\t\tif (ii == nx) continue;  /* hit end of row */\n\t\tv1 = rowpix[ii];  /* store the good pixel value */\n\n\t\t/* now continue populating the differences arrays */\n\t\t/* for the remaining pixels in the row */\n\t\tnvals = 0;\n\t\tfor (ii++; ii < nx; ii++) {\n\n\t\t    /* find the next valid pixel in row */\n                    if (nullcheck)\n\t\t        while (ii < nx && rowpix[ii] == nullvalue) ii++;\n\t\t     \n\t\t    if (ii == nx) break;  /* hit end of row */\n\t\t\n\t\t    /* construct array of 1st order differences */\n\t\t    differences[nvals] = v1 - rowpix[ii];\n\n\t\t    nvals++;  \n\t\t    /* shift over 1 pixel */\n\t\t    v1 = rowpix[ii];\n\t        }  /* end of loop over pixels in the row */\n\n\t\tif (nvals < 2)\n\t\t   continue;\n\t\telse {\n\n\t\t    FnMeanSigma_double(differences, nvals, 0, 0, 0, &mean, &stdev, status);\n\n\t\t    if (stdev > 0.) {\n\t\t        for (iter = 0;  iter < NITER;  iter++) {\n\t\t            kk = 0;\n\t\t            for (ii = 0;  ii < nvals;  ii++) {\n\t\t                if (fabs (differences[ii] - mean) < SIGMA_CLIP * stdev) {\n\t\t\t            if (kk < ii)\n\t\t\t                differences[kk] = differences[ii];\n\t\t\t            kk++;\n\t\t                }\n\t\t            }\n\t\t            if (kk == nvals) break;\n\n\t\t            nvals = kk;\n\t\t            FnMeanSigma_double(differences, nvals, 0, 0, 0, &mean, &stdev, status);\n\t              }\n\t\t   }\n\n\t\t   diffs[nrows] = stdev;\n\t\t   nrows++;\n\t\t}\n\t}  /* end of loop over rows */\n\n\t/* compute median of the values for each row */\n\tif (nrows == 0) { \n\t       xnoise = 0;\n\t} else if (nrows == 1) {\n\t       xnoise = diffs[0];\n\t} else {\n\t       qsort(diffs, nrows, sizeof(double), FnCompare_double);\n\t       xnoise =  (diffs[(nrows - 1)/2] + diffs[nrows/2]) / 2.;\n\t}\n\n\t*noise = .70710678 * xnoise;\n\n\tfree(diffs);\n\tfree(differences);\n\n\treturn(*status);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnCompare_short(const void *v1, const void *v2)\n{\n   const short *i1 = v1;\n   const short *i2 = v2;\n   \n   if (*i1 < *i2)\n     return(-1);\n   else if (*i1 > *i2)\n     return(1);\n   else\n     return(0);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnCompare_int(const void *v1, const void *v2)\n{\n   const int *i1 = v1;\n   const int *i2 = v2;\n   \n   if (*i1 < *i2)\n     return(-1);\n   else if (*i1 > *i2)\n     return(1);\n   else\n     return(0);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnCompare_float(const void *v1, const void *v2)\n{\n   const float *i1 = v1;\n   const float *i2 = v2;\n   \n   if (*i1 < *i2)\n     return(-1);\n   else if (*i1 > *i2)\n     return(1);\n   else\n     return(0);\n}\n/*--------------------------------------------------------------------------*/\nstatic int FnCompare_double(const void *v1, const void *v2)\n{\n   const double *i1 = v1;\n   const double *i2 = v2;\n   \n   if (*i1 < *i2)\n     return(-1);\n   else if (*i1 > *i2)\n     return(1);\n   else\n     return(0);\n}\n/*--------------------------------------------------------------------------*/\n\n/*\n *  These Quickselect routines are based on the algorithm described in\n *  \"Numerical recipes in C\", Second Edition,\n *  Cambridge University Press, 1992, Section 8.5, ISBN 0-521-43108-5\n *  This code by Nicolas Devillard - 1998. Public domain.\n */\n\n/*--------------------------------------------------------------------------*/\n\n#define ELEM_SWAP(a,b) { register float t=(a);(a)=(b);(b)=t; }\n\nstatic float quick_select_float(float arr[], int n) \n{\n    int low, high ;\n    int median;\n    int middle, ll, hh;\n\n    low = 0 ; high = n-1 ; median = (low + high) / 2;\n    for (;;) {\n        if (high <= low) /* One element only */\n            return arr[median] ;\n\n        if (high == low + 1) {  /* Two elements only */\n            if (arr[low] > arr[high])\n                ELEM_SWAP(arr[low], arr[high]) ;\n            return arr[median] ;\n        }\n\n    /* Find median of low, middle and high items; swap into position low */\n    middle = (low + high) / 2;\n    if (arr[middle] > arr[high])    ELEM_SWAP(arr[middle], arr[high]) ;\n    if (arr[low] > arr[high])       ELEM_SWAP(arr[low], arr[high]) ;\n    if (arr[middle] > arr[low])     ELEM_SWAP(arr[middle], arr[low]) ;\n\n    /* Swap low item (now in position middle) into position (low+1) */\n    ELEM_SWAP(arr[middle], arr[low+1]) ;\n\n    /* Nibble from each end towards middle, swapping items when stuck */\n    ll = low + 1;\n    hh = high;\n    for (;;) {\n        do ll++; while (arr[low] > arr[ll]) ;\n        do hh--; while (arr[hh]  > arr[low]) ;\n\n        if (hh < ll)\n        break;\n\n        ELEM_SWAP(arr[ll], arr[hh]) ;\n    }\n\n    /* Swap middle item (in position low) back into correct position */\n    ELEM_SWAP(arr[low], arr[hh]) ;\n\n    /* Re-set active partition */\n    if (hh <= median)\n        low = ll;\n        if (hh >= median)\n        high = hh - 1;\n    }\n}\n\n#undef ELEM_SWAP\n\n/*--------------------------------------------------------------------------*/\n\n#define ELEM_SWAP(a,b) { register short t=(a);(a)=(b);(b)=t; }\n\nstatic short quick_select_short(short arr[], int n) \n{\n    int low, high ;\n    int median;\n    int middle, ll, hh;\n\n    low = 0 ; high = n-1 ; median = (low + high) / 2;\n    for (;;) {\n        if (high <= low) /* One element only */\n            return arr[median] ;\n\n        if (high == low + 1) {  /* Two elements only */\n            if (arr[low] > arr[high])\n                ELEM_SWAP(arr[low], arr[high]) ;\n            return arr[median] ;\n        }\n\n    /* Find median of low, middle and high items; swap into position low */\n    middle = (low + high) / 2;\n    if (arr[middle] > arr[high])    ELEM_SWAP(arr[middle], arr[high]) ;\n    if (arr[low] > arr[high])       ELEM_SWAP(arr[low], arr[high]) ;\n    if (arr[middle] > arr[low])     ELEM_SWAP(arr[middle], arr[low]) ;\n\n    /* Swap low item (now in position middle) into position (low+1) */\n    ELEM_SWAP(arr[middle], arr[low+1]) ;\n\n    /* Nibble from each end towards middle, swapping items when stuck */\n    ll = low + 1;\n    hh = high;\n    for (;;) {\n        do ll++; while (arr[low] > arr[ll]) ;\n        do hh--; while (arr[hh]  > arr[low]) ;\n\n        if (hh < ll)\n        break;\n\n        ELEM_SWAP(arr[ll], arr[hh]) ;\n    }\n\n    /* Swap middle item (in position low) back into correct position */\n    ELEM_SWAP(arr[low], arr[hh]) ;\n\n    /* Re-set active partition */\n    if (hh <= median)\n        low = ll;\n        if (hh >= median)\n        high = hh - 1;\n    }\n}\n\n#undef ELEM_SWAP\n\n/*--------------------------------------------------------------------------*/\n\n#define ELEM_SWAP(a,b) { register int t=(a);(a)=(b);(b)=t; }\n\nstatic int quick_select_int(int arr[], int n) \n{\n    int low, high ;\n    int median;\n    int middle, ll, hh;\n\n    low = 0 ; high = n-1 ; median = (low + high) / 2;\n    for (;;) {\n        if (high <= low) /* One element only */\n            return arr[median] ;\n\n        if (high == low + 1) {  /* Two elements only */\n            if (arr[low] > arr[high])\n                ELEM_SWAP(arr[low], arr[high]) ;\n            return arr[median] ;\n        }\n\n    /* Find median of low, middle and high items; swap into position low */\n    middle = (low + high) / 2;\n    if (arr[middle] > arr[high])    ELEM_SWAP(arr[middle], arr[high]) ;\n    if (arr[low] > arr[high])       ELEM_SWAP(arr[low], arr[high]) ;\n    if (arr[middle] > arr[low])     ELEM_SWAP(arr[middle], arr[low]) ;\n\n    /* Swap low item (now in position middle) into position (low+1) */\n    ELEM_SWAP(arr[middle], arr[low+1]) ;\n\n    /* Nibble from each end towards middle, swapping items when stuck */\n    ll = low + 1;\n    hh = high;\n    for (;;) {\n        do ll++; while (arr[low] > arr[ll]) ;\n        do hh--; while (arr[hh]  > arr[low]) ;\n\n        if (hh < ll)\n        break;\n\n        ELEM_SWAP(arr[ll], arr[hh]) ;\n    }\n\n    /* Swap middle item (in position low) back into correct position */\n    ELEM_SWAP(arr[low], arr[hh]) ;\n\n    /* Re-set active partition */\n    if (hh <= median)\n        low = ll;\n        if (hh >= median)\n        high = hh - 1;\n    }\n}\n\n#undef ELEM_SWAP\n\n/*--------------------------------------------------------------------------*/\n\n#define ELEM_SWAP(a,b) { register LONGLONG  t=(a);(a)=(b);(b)=t; }\n\nstatic LONGLONG quick_select_longlong(LONGLONG arr[], int n) \n{\n    int low, high ;\n    int median;\n    int middle, ll, hh;\n\n    low = 0 ; high = n-1 ; median = (low + high) / 2;\n    for (;;) {\n        if (high <= low) /* One element only */\n            return arr[median] ;\n\n        if (high == low + 1) {  /* Two elements only */\n            if (arr[low] > arr[high])\n                ELEM_SWAP(arr[low], arr[high]) ;\n            return arr[median] ;\n        }\n\n    /* Find median of low, middle and high items; swap into position low */\n    middle = (low + high) / 2;\n    if (arr[middle] > arr[high])    ELEM_SWAP(arr[middle], arr[high]) ;\n    if (arr[low] > arr[high])       ELEM_SWAP(arr[low], arr[high]) ;\n    if (arr[middle] > arr[low])     ELEM_SWAP(arr[middle], arr[low]) ;\n\n    /* Swap low item (now in position middle) into position (low+1) */\n    ELEM_SWAP(arr[middle], arr[low+1]) ;\n\n    /* Nibble from each end towards middle, swapping items when stuck */\n    ll = low + 1;\n    hh = high;\n    for (;;) {\n        do ll++; while (arr[low] > arr[ll]) ;\n        do hh--; while (arr[hh]  > arr[low]) ;\n\n        if (hh < ll)\n        break;\n\n        ELEM_SWAP(arr[ll], arr[hh]) ;\n    }\n\n    /* Swap middle item (in position low) back into correct position */\n    ELEM_SWAP(arr[low], arr[hh]) ;\n\n    /* Re-set active partition */\n    if (hh <= median)\n        low = ll;\n        if (hh >= median)\n        high = hh - 1;\n    }\n}\n\n#undef ELEM_SWAP\n\n/*--------------------------------------------------------------------------*/\n\n#define ELEM_SWAP(a,b) { register double t=(a);(a)=(b);(b)=t; }\n\nstatic double quick_select_double(double arr[], int n) \n{\n    int low, high ;\n    int median;\n    int middle, ll, hh;\n\n    low = 0 ; high = n-1 ; median = (low + high) / 2;\n    for (;;) {\n        if (high <= low) /* One element only */\n            return arr[median] ;\n\n        if (high == low + 1) {  /* Two elements only */\n            if (arr[low] > arr[high])\n                ELEM_SWAP(arr[low], arr[high]) ;\n            return arr[median] ;\n        }\n\n    /* Find median of low, middle and high items; swap into position low */\n    middle = (low + high) / 2;\n    if (arr[middle] > arr[high])    ELEM_SWAP(arr[middle], arr[high]) ;\n    if (arr[low] > arr[high])       ELEM_SWAP(arr[low], arr[high]) ;\n    if (arr[middle] > arr[low])     ELEM_SWAP(arr[middle], arr[low]) ;\n\n    /* Swap low item (now in position middle) into position (low+1) */\n    ELEM_SWAP(arr[middle], arr[low+1]) ;\n\n    /* Nibble from each end towards middle, swapping items when stuck */\n    ll = low + 1;\n    hh = high;\n    for (;;) {\n        do ll++; while (arr[low] > arr[ll]) ;\n        do hh--; while (arr[hh]  > arr[low]) ;\n\n        if (hh < ll)\n        break;\n\n        ELEM_SWAP(arr[ll], arr[hh]) ;\n    }\n\n    /* Swap middle item (in position low) back into correct position */\n    ELEM_SWAP(arr[low], arr[hh]) ;\n\n    /* Re-set active partition */\n    if (hh <= median)\n        low = ll;\n        if (hh >= median)\n        high = hh - 1;\n    }\n}\n\n#undef ELEM_SWAP\n\n\n"},{"col":4,"comment":"\n        Reset the current Axes, to use a new WCS object.\n        ","endLoc":396,"header":"def reset_wcs(self, wcs=None, slices=None, transform=None, coord_meta=None)","id":16668,"name":"reset_wcs","nodeType":"Function","startLoc":328,"text":"def reset_wcs(self, wcs=None, slices=None, transform=None, coord_meta=None):\n        \"\"\"\n        Reset the current Axes, to use a new WCS object.\n        \"\"\"\n\n        # Here determine all the coordinate axes that should be shown.\n        if wcs is None and transform is None:\n\n            self.wcs = IDENTITY\n\n        else:\n\n            # We now force call 'set', which ensures the WCS object is\n            # consistent, which will only be important if the WCS has been set\n            # by hand. For example if the user sets a celestial WCS by hand and\n            # forgets to set the units, WCS.wcs.set() will do this.\n            if wcs is not None:\n                # Check if the WCS object is an instance of `astropy.wcs.WCS`\n                # This check is necessary as only `astropy.wcs.WCS` supports\n                # wcs.set() method\n                if isinstance(wcs, WCS):\n                    wcs.wcs.set()\n\n                if isinstance(wcs, BaseHighLevelWCS):\n                    wcs = wcs.low_level_wcs\n\n            self.wcs = wcs\n\n        # If we are making a new WCS, we need to preserve the path object since\n        # it may already be used by objects that have been plotted, and we need\n        # to continue updating it. CoordinatesMap will create a new frame\n        # instance, but we can tell that instance to keep using the old path.\n        if hasattr(self, 'coords'):\n            previous_frame = {'path': self.coords.frame._path,\n                              'color': self.coords.frame.get_color(),\n                              'linewidth': self.coords.frame.get_linewidth()}\n        else:\n            previous_frame = {'path': None}\n\n        if self.wcs is not None:\n\n            transform, coord_meta = transform_coord_meta_from_wcs(self.wcs, self.frame_class, slices=slices)\n\n        self.coords = CoordinatesMap(self,\n                                     transform=transform,\n                                     coord_meta=coord_meta,\n                                     frame_class=self.frame_class,\n                                     previous_frame_path=previous_frame['path'])\n\n        self._transform_pixel2world = transform\n\n        if previous_frame['path'] is not None:\n            self.coords.frame.set_color(previous_frame['color'])\n            self.coords.frame.set_linewidth(previous_frame['linewidth'])\n\n        self._all_coords = [self.coords]\n\n        # Common default settings for Rectangular Frame\n        for ind, pos in enumerate(coord_meta.get('default_axislabel_position', ['b', 'l'])):\n            self.coords[ind].set_axislabel_position(pos)\n\n        for ind, pos in enumerate(coord_meta.get('default_ticklabel_position', ['b', 'l'])):\n            self.coords[ind].set_ticklabel_position(pos)\n\n        for ind, pos in enumerate(coord_meta.get('default_ticks_position', ['bltr', 'bltr'])):\n            self.coords[ind].set_ticks_position(pos)\n\n        if rcParams['axes.grid']:\n            self.grid()"},{"id":16669,"name":"scalnull.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, scalnull.c, contains the FITSIO routines used to define     */\n/*  the starting heap address, the value scaling and the null values.      */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <string.h>\n#include \"fitsio2.h\"\n/*--------------------------------------------------------------------------*/\nint ffpthp(fitsfile *fptr,      /* I - FITS file pointer */\n           long theap,          /* I - starting addrss for the heap */\n           int *status)         /* IO - error status     */\n/*\n  Define the starting address for the heap for a binary table.\n  The default address is NAXIS1 * NAXIS2.  It is in units of\n  bytes relative to the beginning of the regular binary table data.\n  This routine also writes the appropriate THEAP keyword to the\n  FITS header.\n*/\n{\n    if (*status > 0 || theap < 1)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    (fptr->Fptr)->heapstart = theap;\n\n    ffukyj(fptr, \"THEAP\", theap, \"byte offset to heap area\", status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpscl(fitsfile *fptr,      /* I - FITS file pointer               */\n           double scale,        /* I - scaling factor: value of BSCALE */\n           double zero,         /* I - zero point: value of BZERO      */\n           int *status)         /* IO - error status                   */\n/*\n  Define the linear scaling factor for the primary array or image extension\n  pixel values. This routine overrides the scaling values given by the\n  BSCALE and BZERO keywords if present.  Note that this routine does not\n  write or modify the BSCALE and BZERO keywords, but instead only modifies\n  the values temporarily in the internal buffer.  Thus, a subsequent call to\n  the ffrdef routine will reset the scaling back to the BSCALE and BZERO\n  keyword values (or 1. and 0. respectively if the keywords are not present).\n*/\n{\n    tcolumn *colptr;\n    int hdutype;\n\n    if (*status > 0)\n        return(*status);\n\n    if (scale == 0)\n        return(*status = ZERO_SCALE);  /* zero scale value is illegal */\n\n    if (ffghdt(fptr, &hdutype, status) > 0)  /* get HDU type */\n        return(*status);\n\n    if (hdutype != IMAGE_HDU)\n        return(*status = NOT_IMAGE);         /* not proper HDU type */\n\n    if (fits_is_compressed_image(fptr, status)) /* compressed images */\n    {\n        (fptr->Fptr)->cn_bscale = scale;\n        (fptr->Fptr)->cn_bzero  = zero;\n        return(*status);\n    }\n\n    /* set pointer to the first 'column' (contains group parameters if any) */\n    colptr = (fptr->Fptr)->tableptr; \n\n    colptr++;   /* increment to the 2nd 'column' pointer  (the image itself) */\n\n    colptr->tscale = scale;\n    colptr->tzero = zero;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpnul(fitsfile *fptr,      /* I - FITS file pointer                */\n           LONGLONG nulvalue,   /* I - null pixel value: value of BLANK */\n           int *status)         /* IO - error status                    */\n/*\n  Define the value used to represent undefined pixels in the primary array or\n  image extension. This only applies to integer image pixel (i.e. BITPIX > 0).\n  This routine overrides the null pixel value given by the BLANK keyword\n  if present.  Note that this routine does not write or modify the BLANK\n  keyword, but instead only modifies the value temporarily in the internal\n  buffer. Thus, a subsequent call to the ffrdef routine will reset the null\n  value back to the BLANK  keyword value (or not defined if the keyword is not\n  present).\n*/\n{\n    tcolumn *colptr;\n    int hdutype;\n\n    if (*status > 0)\n        return(*status);\n\n    if (ffghdt(fptr, &hdutype, status) > 0)  /* get HDU type */\n        return(*status);\n\n    if (hdutype != IMAGE_HDU)\n        return(*status = NOT_IMAGE);         /* not proper HDU type */\n\n    if (fits_is_compressed_image(fptr, status)) /* ignore compressed images */\n        return(*status);\n\n    /* set pointer to the first 'column' (contains group parameters if any) */\n    colptr = (fptr->Fptr)->tableptr; \n\n    colptr++;   /* increment to the 2nd 'column' pointer  (the image itself) */\n\n    colptr->tnull = nulvalue;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fftscl(fitsfile *fptr,      /* I - FITS file pointer */\n           int colnum,          /* I - column number to apply scaling to */\n           double scale,        /* I - scaling factor: value of TSCALn   */\n           double zero,         /* I - zero point: value of TZEROn       */\n           int *status)         /* IO - error status     */\n/*\n  Define the linear scaling factor for the TABLE or BINTABLE extension\n  column values. This routine overrides the scaling values given by the\n  TSCALn and TZEROn keywords if present.  Note that this routine does not\n  write or modify the TSCALn and TZEROn keywords, but instead only modifies\n  the values temporarily in the internal buffer.  Thus, a subsequent call to\n  the ffrdef routine will reset the scaling back to the TSCALn and TZEROn\n  keyword values (or 1. and 0. respectively if the keywords are not present).\n*/\n{\n    tcolumn *colptr;\n    int hdutype;\n\n    if (*status > 0)\n        return(*status);\n\n    if (scale == 0)\n        return(*status = ZERO_SCALE);  /* zero scale value is illegal */\n\n    if (ffghdt(fptr, &hdutype, status) > 0)  /* get HDU type */\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n        return(*status = NOT_TABLE);         /* not proper HDU type */\n\n    colptr = (fptr->Fptr)->tableptr;   /* set pointer to the first column */\n    colptr += (colnum - 1);     /* increment to the correct column */\n\n    colptr->tscale = scale;\n    colptr->tzero = zero;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fftnul(fitsfile *fptr,      /* I - FITS file pointer                  */\n           int colnum,          /* I - column number to apply nulvalue to */\n           LONGLONG nulvalue,   /* I - null pixel value: value of TNULLn  */\n           int *status)         /* IO - error status                      */\n/*\n  Define the value used to represent undefined pixels in the BINTABLE column.\n  This only applies to integer datatype columns (TFORM = B, I, or J).\n  This routine overrides the null pixel value given by the TNULLn keyword\n  if present.  Note that this routine does not write or modify the TNULLn\n  keyword, but instead only modifies the value temporarily in the internal\n  buffer. Thus, a subsequent call to the ffrdef routine will reset the null\n  value back to the TNULLn  keyword value (or not defined if the keyword is not\n  present).\n*/\n{\n    tcolumn *colptr;\n    int hdutype;\n\n    if (*status > 0)\n        return(*status);\n\n    if (ffghdt(fptr, &hdutype, status) > 0)  /* get HDU type */\n        return(*status);\n\n    if (hdutype != BINARY_TBL)\n        return(*status = NOT_BTABLE);        /* not proper HDU type */\n \n    colptr = (fptr->Fptr)->tableptr;   /* set pointer to the first column */\n    colptr += (colnum - 1);    /* increment to the correct column */\n\n    colptr->tnull = nulvalue;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffsnul(fitsfile *fptr,      /* I - FITS file pointer                  */\n           int colnum,          /* I - column number to apply nulvalue to */\n           char *nulstring,     /* I - null pixel value: value of TNULLn  */\n           int *status)         /* IO - error status                      */\n/*\n  Define the string used to represent undefined pixels in the ASCII TABLE\n  column. This routine overrides the null  value given by the TNULLn keyword\n  if present.  Note that this routine does not write or modify the TNULLn\n  keyword, but instead only modifies the value temporarily in the internal\n  buffer. Thus, a subsequent call to the ffrdef routine will reset the null\n  value back to the TNULLn keyword value (or not defined if the keyword is not\n  present).\n*/\n{\n    tcolumn *colptr;\n    int hdutype;\n\n    if (*status > 0)\n        return(*status);\n\n    if (ffghdt(fptr, &hdutype, status) > 0)  /* get HDU type */\n        return(*status);\n\n    if (hdutype != ASCII_TBL)\n        return(*status = NOT_ATABLE);        /* not proper HDU type */\n \n    colptr = (fptr->Fptr)->tableptr;   /* set pointer to the first column */\n    colptr += (colnum - 1);    /* increment to the correct column */\n\n    colptr->strnull[0] = '\\0';\n    strncat(colptr->strnull, nulstring, 19);  /* limit string to 19 chars */\n\n    return(*status);\n}\n"},{"id":16670,"name":"iraffits.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*------------------------------------------------------------------------*/\n/*                                                                        */\n/*  These routines have been modified by William Pence for use by CFITSIO */\n/*        The original files were provided by Doug Mink                   */\n/*------------------------------------------------------------------------*/\n\n/* File imhfile.c\n * August 6, 1998\n * By Doug Mink, based on Mike VanHilst's readiraf.c\n\n * Module:      imhfile.c (IRAF .imh image file reading and writing)\n * Purpose:     Read and write IRAF image files (and translate headers)\n * Subroutine:  irafrhead (filename, lfhead, fitsheader, lihead)\n *              Read IRAF image header\n * Subroutine:  irafrimage (fitsheader)\n *              Read IRAF image pixels (call after irafrhead)\n * Subroutine:\tsame_path (pixname, hdrname)\n *\t\tPut filename and header path together\n * Subroutine:\tiraf2fits (hdrname, irafheader, nbiraf, nbfits)\n *\t\tConvert IRAF image header to FITS image header\n * Subroutine:  irafgeti4 (irafheader, offset)\n *\t\tGet 4-byte integer from arbitrary part of IRAF header\n * Subroutine:  irafgetc2 (irafheader, offset)\n *\t\tGet character string from arbitrary part of IRAF v.1 header\n * Subroutine:  irafgetc (irafheader, offset)\n *\t\tGet character string from arbitrary part of IRAF header\n * Subroutine:  iraf2str (irafstring, nchar)\n * \t\tConvert 2-byte/char IRAF string to 1-byte/char string\n * Subroutine:\tirafswap (bitpix,string,nbytes)\n *\t\tSwap bytes in string in place, with FITS bits/pixel code\n * Subroutine:\tirafswap2 (string,nbytes)\n *\t\tSwap bytes in string in place\n * Subroutine\tirafswap4 (string,nbytes)\n *\t\tReverse bytes of Integer*4 or Real*4 vector in place\n * Subroutine\tirafswap8 (string,nbytes)\n *\t\tReverse bytes of Real*8 vector in place\n\n\n * Copyright:   2000 Smithsonian Astrophysical Observatory\n *              You may do anything you like with this file except remove\n *              this copyright.  The Smithsonian Astrophysical Observatory\n *              makes no representations about the suitability of this\n *              software for any purpose.  It is provided \"as is\" without\n *              express or implied warranty.\n */\n\n#include \"fitsio2.h\"\n#include <stdio.h>\t\t/* define stderr, FD, and NULL */\n#include <stdlib.h>\n#include <stddef.h>  /* stddef.h is apparently needed to define size_t */\n#include <string.h>\n\n#define FILE_NOT_OPENED 104\n\n/* Parameters from iraf/lib/imhdr.h for IRAF version 1 images */\n#define SZ_IMPIXFILE\t 79\t\t/* name of pixel storage file */\n#define SZ_IMHDRFILE\t 79   \t\t/* length of header storage file */\n#define SZ_IMTITLE\t 79\t\t/* image title string */\n#define LEN_IMHDR\t2052\t\t/* length of std header */\n\n/* Parameters from iraf/lib/imhdr.h for IRAF version 2 images */\n#define\tSZ_IM2PIXFILE\t255\t\t/* name of pixel storage file */\n#define\tSZ_IM2HDRFILE\t255\t\t/* name of header storage file */\n#define\tSZ_IM2TITLE\t383\t\t/* image title string */\n#define LEN_IM2HDR\t2046\t\t/* length of std header */\n\n/* Offsets into header in bytes for parameters in IRAF version 1 images */\n#define IM_HDRLEN\t 12\t\t/* Length of header in 4-byte ints */\n#define IM_PIXTYPE       16             /* Datatype of the pixels */\n#define IM_NDIM          20             /* Number of dimensions */\n#define IM_LEN           24             /* Length (as stored) */\n#define IM_PHYSLEN       52             /* Physical length (as stored) */\n#define IM_PIXOFF        88             /* Offset of the pixels */\n#define IM_CTIME        108             /* Time of image creation */\n#define IM_MTIME        112             /* Time of last modification */\n#define IM_LIMTIME      116             /* Time of min,max computation */\n#define IM_MAX          120             /* Maximum pixel value */\n#define IM_MIN          124             /* Maximum pixel value */\n#define IM_PIXFILE      412             /* Name of pixel storage file */\n#define IM_HDRFILE      572             /* Name of header storage file */\n#define IM_TITLE        732             /* Image name string */\n\n/* Offsets into header in bytes for parameters in IRAF version 2 images */\n#define IM2_HDRLEN\t  6\t\t/* Length of header in 4-byte ints */\n#define IM2_PIXTYPE      10             /* Datatype of the pixels */\n#define IM2_SWAPPED      14             /* Pixels are byte swapped */\n#define IM2_NDIM         18             /* Number of dimensions */\n#define IM2_LEN          22             /* Length (as stored) */\n#define IM2_PHYSLEN      50             /* Physical length (as stored) */\n#define IM2_PIXOFF       86             /* Offset of the pixels */\n#define IM2_CTIME       106             /* Time of image creation */\n#define IM2_MTIME       110             /* Time of last modification */\n#define IM2_LIMTIME     114             /* Time of min,max computation */\n#define IM2_MAX         118             /* Maximum pixel value */\n#define IM2_MIN         122             /* Maximum pixel value */\n#define IM2_PIXFILE     126             /* Name of pixel storage file */\n#define IM2_HDRFILE     382             /* Name of header storage file */\n#define IM2_TITLE       638             /* Image name string */\n\n/* Codes from iraf/unix/hlib/iraf.h */\n#define\tTY_CHAR\t\t2\n#define\tTY_SHORT\t3\n#define\tTY_INT\t\t4\n#define\tTY_LONG\t\t5\n#define\tTY_REAL\t\t6\n#define\tTY_DOUBLE\t7\n#define\tTY_COMPLEX\t8\n#define TY_POINTER      9\n#define TY_STRUCT       10\n#define TY_USHORT       11\n#define TY_UBYTE        12\n\n#define LEN_PIXHDR\t1024\n#define MAXINT  2147483647 /* Biggest number that can fit in long */\n\nstatic int isirafswapped(char *irafheader, int offset);\nstatic int irafgeti4(char *irafheader, int offset);\nstatic char *irafgetc2(char *irafheader, int offset, int nc);\nstatic char *irafgetc(char *irafheader,\tint offset, int\tnc);\nstatic char *iraf2str(char *irafstring, int nchar);\nstatic char *irafrdhead(const char *filename, int *lihead);\nstatic int irafrdimage (char **buffptr, size_t *buffsize,\n    size_t *filesize, int *status);\nstatic int iraftofits (char *hdrname, char *irafheader, int nbiraf,\n    char **buffptr, size_t *nbfits, size_t *fitssize, int *status);\nstatic char *same_path(char *pixname, const char *hdrname);\n\nstatic int swaphead=0;\t/* =1 to swap data bytes of IRAF header values */\nstatic int swapdata=0;  /* =1 to swap bytes in IRAF data pixels */\n\nstatic void irafswap(int bitpix, char *string, int nbytes);\nstatic void irafswap2(char *string, int nbytes);\nstatic void irafswap4(char *string, int nbytes);\nstatic void irafswap8(char *string, int nbytes);\nstatic int pix_version (char *irafheader);\nstatic int irafncmp (char *irafheader, char *teststring, int nc);\nstatic int machswap(void);\nstatic int head_version (char *irafheader);\nstatic int hgeti4(char* hstring, char* keyword, int* val);\nstatic int hgets(char* hstring, char* keyword, int lstr, char* string);\nstatic char* hgetc(char* hstring, char* keyword);\nstatic char* ksearch(char* hstring, char* keyword);\nstatic char *blsearch (char* hstring, char* keyword);\t\nstatic char *strsrch (char* s1,\tchar* s2);\nstatic char *strnsrch (\tchar* s1,char* s2,int ls1);\nstatic void hputi4(char* hstring,char* keyword,\tint ival);\nstatic void hputs(char* hstring,char* keyword,char* cval);\nstatic void hputcom(char* hstring,char* keyword,char* comment);\nstatic void hputl(char* hstring,char* keyword,int lval);\nstatic void hputc(char* hstring,char* keyword,char* cval);\nstatic int getirafpixname (const char *hdrname, char *irafheader, char *pixfilename, int *status);\nint iraf2mem(char *filename, char **buffptr, size_t *buffsize, \n      size_t *filesize, int *status);\n\nvoid ffpmsg(const char *err_message);\n\n/* CFITS_API is defined below for use on Windows systems.  */\n/* It is used to identify the public functions which should be exported. */\n/* This has no effect on non-windows platforms where \"WIN32\" is not defined */\n\n/* this is only needed to export the \"fits_delete_iraf_file\" symbol, which */\n/* is called in fpackutil.c (and perhaps in other applications programs) */\n\n#if defined (WIN32)\n  #if defined(cfitsio_EXPORTS)\n    #define CFITS_API __declspec(dllexport)\n  #else\n    #define CFITS_API //__declspec(dllimport)\n  #endif /* CFITS_API */\n#else /* defined (WIN32) */\n #define CFITS_API\n#endif\n\nint CFITS_API fits_delete_iraf_file(const char *filename, int *status);\n\n\n/*--------------------------------------------------------------------------*/\nint fits_delete_iraf_file(const char *filename,  /* name of input file      */\n             int *status)                        /* IO - error status       */\n\n/*\n   Delete the iraf .imh header file and the associated .pix data file\n*/\n{\n    char *irafheader;\n    int lenirafhead;\n\n    char pixfilename[SZ_IM2PIXFILE+1];\n\n    /* read IRAF header into dynamically created char array (free it later!) */\n    irafheader = irafrdhead(filename, &lenirafhead);\n\n    if (!irafheader)\n    {\n\treturn(*status = FILE_NOT_OPENED);\n    }\n\n    getirafpixname (filename, irafheader, pixfilename, status);\n\n    /* don't need the IRAF header any more */\n    free(irafheader);\n\n    if (*status > 0)\n       return(*status);\n\n    remove(filename);\n    remove(pixfilename);\n    \n    return(*status);\n}\n\n/*--------------------------------------------------------------------------*/\nint iraf2mem(char *filename,     /* name of input file                 */\n             char **buffptr,     /* O - memory pointer (initially NULL)    */\n             size_t *buffsize,   /* O - size of mem buffer, in bytes        */\n             size_t *filesize,   /* O - size of FITS file, in bytes         */\n             int *status)        /* IO - error status                       */\n\n/*\n   Driver routine that reads an IRAF image into memory, also converting\n   it into FITS format.\n*/\n{\n    char *irafheader;\n    int lenirafhead;\n\n    *buffptr = NULL;\n    *buffsize = 0;\n    *filesize = 0;\n\n    /* read IRAF header into dynamically created char array (free it later!) */\n    irafheader = irafrdhead(filename, &lenirafhead);\n\n    if (!irafheader)\n    {\n\treturn(*status = FILE_NOT_OPENED);\n    }\n\n    /* convert IRAF header to FITS header in memory */\n    iraftofits(filename, irafheader, lenirafhead, buffptr, buffsize, filesize,\n               status);\n\n    /* don't need the IRAF header any more */\n    free(irafheader);\n\n    if (*status > 0)\n       return(*status);\n\n    *filesize = (((*filesize - 1) / 2880 ) + 1 ) * 2880; /* multiple of 2880 */\n\n    /* append the image data onto the FITS header */\n    irafrdimage(buffptr, buffsize, filesize, status);\n\n    return(*status);\n}\n\n/*--------------------------------------------------------------------------*/\n/* Subroutine:\tirafrdhead  (was irafrhead in D. Mink's original code)\n * Purpose:\tOpen and read the iraf .imh file.\n * Returns:\tNULL if failure, else pointer to IRAF .imh image header\n * Notes:\tThe imhdr format is defined in iraf/lib/imhdr.h, some of\n *\t\twhich defines or mimicked, above.\n */\n\nstatic char *irafrdhead (\n    const char *filename,  /* Name of IRAF header file */\n    int *lihead)           /* Length of IRAF image header in bytes (returned) */\n{\n    FILE *fd;\n    int nbr;\n    char *irafheader;\n    char errmsg[FLEN_ERRMSG];\n    long nbhead;\n    int nihead;\n\n    *lihead = 0;\n\n    /* open the image header file */\n    fd = fopen (filename, \"rb\");\n    if (fd == NULL) {\n        ffpmsg(\"unable to open IRAF header file:\");\n        ffpmsg(filename);\n\treturn (NULL);\n\t}\n\n    /* Find size of image header file */\n    if (fseek(fd, 0, 2) != 0)  /* move to end of the file */\n    {\n        ffpmsg(\"IRAFRHEAD: cannot seek in file:\");\n        ffpmsg(filename);\n        return(NULL);\n    }\n\n    nbhead = ftell(fd);     /* position = size of file */\n    if (nbhead < 0)\n    {\n        ffpmsg(\"IRAFRHEAD: cannot get pos. in file:\");\n        ffpmsg(filename);\n        return(NULL);\n    }\n\n    if (fseek(fd, 0, 0) != 0) /* move back to beginning */\n    {\n        ffpmsg(\"IRAFRHEAD: cannot seek to beginning of file:\");\n        ffpmsg(filename);\n        return(NULL);\n    }\n\n    /* allocate initial sized buffer */\n    nihead = nbhead + 5000;\n    irafheader = (char *) calloc (1, nihead);\n    if (irafheader == NULL) {\n\tsnprintf(errmsg, FLEN_ERRMSG,\"IRAFRHEAD Cannot allocate %d-byte header\",\n\t\t      nihead);\n        ffpmsg(errmsg);\n        ffpmsg(filename);\n\treturn (NULL);\n\t}\n    *lihead = nihead;\n\n    /* Read IRAF header */\n    nbr = fread (irafheader, 1, nbhead, fd);\n    fclose (fd);\n\n    /* Reject if header less than minimum length */\n    if (nbr < LEN_PIXHDR) {\n\tsnprintf(errmsg, FLEN_ERRMSG,\"IRAFRHEAD header file: %d / %d bytes read.\",\n\t\t      nbr,LEN_PIXHDR);\n        ffpmsg(errmsg);\n        ffpmsg(filename);\n\tfree (irafheader);\n\treturn (NULL);\n\t}\n\n    return (irafheader);\n}\n/*--------------------------------------------------------------------------*/\nstatic int irafrdimage (\n    char **buffptr,\t/* FITS image header (filled) */\n    size_t *buffsize,      /* allocated size of the buffer */\n    size_t *filesize,      /* actual size of the FITS file */\n    int *status)\n{\n    FILE *fd;\n    char *bang;\n    int nax = 1, naxis1 = 1, naxis2 = 1, naxis3 = 1, naxis4 = 1, npaxis1 = 1, npaxis2;\n    int bitpix, bytepix, i;\n    char *fitsheader, *image;\n    int nbr, nbimage, nbaxis, nbl, nbdiff;\n    char *pixheader;\n    char *linebuff;\n    int imhver, lpixhead = 0;\n    char pixname[SZ_IM2PIXFILE+1];\n    char errmsg[FLEN_ERRMSG];\n    size_t newfilesize;\n \n    fitsheader = *buffptr;           /* pointer to start of header */\n\n    /* Convert pixel file name to character string */\n    hgets (fitsheader, \"PIXFILE\", SZ_IM2PIXFILE, pixname);\n    hgeti4 (fitsheader, \"PIXOFF\", &lpixhead);\n\n    /* Open pixel file, ignoring machine name if present */\n    if ((bang = strchr (pixname, '!')) != NULL )\n\tfd = fopen (bang + 1, \"rb\");\n    else\n\tfd = fopen (pixname, \"rb\");\n\n    /* Print error message and exit if pixel file is not found */\n    if (!fd) {\n        ffpmsg(\"IRAFRIMAGE: Cannot open IRAF pixel file:\");\n        ffpmsg(pixname);\n\treturn (*status = FILE_NOT_OPENED);\n\t}\n\n    /* Read pixel header */\n    pixheader = (char *) calloc (lpixhead, 1);\n    if (pixheader == NULL) {\n            ffpmsg(\"IRAFRIMAGE: Cannot alloc memory for pixel header\");\n            ffpmsg(pixname);\n            fclose (fd);\n\t    return (*status = FILE_NOT_OPENED);\n\t}\n    nbr = fread (pixheader, 1, lpixhead, fd);\n\n    /* Check size of pixel header */\n    if (nbr < lpixhead) {\n\tsnprintf(errmsg, FLEN_ERRMSG,\"IRAF pixel file: %d / %d bytes read.\",\n\t\t      nbr,LEN_PIXHDR);\n        ffpmsg(errmsg);\n\tfree (pixheader);\n\tfclose (fd);\n\treturn (*status = FILE_NOT_OPENED);\n\t}\n\n    /* check pixel header magic word */\n    imhver = pix_version (pixheader);\n    if (imhver < 1) {\n        ffpmsg(\"File not valid IRAF pixel file:\");\n        ffpmsg(pixname);\n\tfree (pixheader);\n\tfclose (fd);\n\treturn (*status = FILE_NOT_OPENED);\n\t}\n    free (pixheader);\n\n    /* Find number of bytes to read */\n    hgeti4 (fitsheader,\"NAXIS\",&nax);\n    hgeti4 (fitsheader,\"NAXIS1\",&naxis1);\n    hgeti4 (fitsheader,\"NPAXIS1\",&npaxis1);\n    if (nax > 1) {\n        hgeti4 (fitsheader,\"NAXIS2\",&naxis2);\n        hgeti4 (fitsheader,\"NPAXIS2\",&npaxis2);\n\t}\n    if (nax > 2)\n        hgeti4 (fitsheader,\"NAXIS3\",&naxis3);\n    if (nax > 3)\n        hgeti4 (fitsheader,\"NAXIS4\",&naxis4);\n\n    hgeti4 (fitsheader,\"BITPIX\",&bitpix);\n    if (bitpix < 0)\n\tbytepix = -bitpix / 8;\n    else\n\tbytepix = bitpix / 8;\n\n    nbimage = naxis1 * naxis2 * naxis3 * naxis4 * bytepix;\n    \n    newfilesize = *filesize + nbimage;  /* header + data */\n    newfilesize = (((newfilesize - 1) / 2880 ) + 1 ) * 2880;\n\n    if (newfilesize > *buffsize)   /* need to allocate more memory? */\n    {\n      fitsheader =  (char *) realloc (*buffptr, newfilesize);\n      if (fitsheader == NULL) {\n\tsnprintf(errmsg, FLEN_ERRMSG,\"IRAFRIMAGE Cannot allocate %d-byte image buffer\",\n\t\t(int) (*filesize));\n        ffpmsg(errmsg);\n        ffpmsg(pixname);\n\tfclose (fd);\n\treturn (*status = FILE_NOT_OPENED);\n\t}\n    }\n\n    *buffptr = fitsheader;\n    *buffsize = newfilesize;\n\n    image = fitsheader + *filesize;\n    *filesize = newfilesize;\n\n    /* Read IRAF image all at once if physical and image dimensions are the same */\n    if (npaxis1 == naxis1)\n\tnbr = fread (image, 1, nbimage, fd);\n\n    /* Read IRAF image one line at a time if physical and image dimensions differ */\n    else {\n\tnbdiff = (npaxis1 - naxis1) * bytepix;\n\tnbaxis = naxis1 * bytepix;\n\tlinebuff = image;\n\tnbr = 0;\n\tif (naxis2 == 1 && naxis3 > 1)\n\t    naxis2 = naxis3;\n\tfor (i = 0; i < naxis2; i++) {\n\t    nbl = fread (linebuff, 1, nbaxis, fd);\n\t    nbr = nbr + nbl;\n\t    fseek (fd, nbdiff, 1);\n\t    linebuff = linebuff + nbaxis;\n\t    }\n\t}\n    fclose (fd);\n\n    /* Check size of image */\n    if (nbr < nbimage) {\n\tsnprintf(errmsg, FLEN_ERRMSG,\"IRAF pixel file: %d / %d bytes read.\",\n\t\t      nbr,nbimage);\n        ffpmsg(errmsg);\n        ffpmsg(pixname);\n\treturn (*status = FILE_NOT_OPENED);\n\t}\n\n    /* Byte-reverse image, if necessary */\n    if (swapdata)\n\tirafswap (bitpix, image, nbimage);\n\n    return (*status);\n}\n/*--------------------------------------------------------------------------*/\n/* Return IRAF image format version number from magic word in IRAF header*/\n\nstatic int head_version (\n    char *irafheader)\t/* IRAF image header from file */\n\n{\n\n    /* Check header file magic word */\n    if (irafncmp (irafheader, \"imhdr\", 5) != 0 ) {\n\tif (strncmp (irafheader, \"imhv2\", 5) != 0)\n\t    return (0);\n\telse\n\t    return (2);\n\t}\n    else\n\treturn (1);\n}\n\n/*--------------------------------------------------------------------------*/\n/* Return IRAF image format version number from magic word in IRAF pixel file */\n\nstatic int pix_version (\n    char *irafheader)   /* IRAF image header from file */\n{\n\n    /* Check pixel file header magic word */\n    if (irafncmp (irafheader, \"impix\", 5) != 0) {\n\tif (strncmp (irafheader, \"impv2\", 5) != 0)\n\t    return (0);\n\telse\n\t    return (2);\n\t}\n    else\n\treturn (1);\n}\n\n/*--------------------------------------------------------------------------*/\n/* Verify that file is valid IRAF imhdr or impix by checking first 5 chars\n * Returns:\t0 on success, 1 on failure */\n\nstatic int irafncmp (\n\nchar\t*irafheader,\t/* IRAF image header from file */\nchar\t*teststring,\t/* C character string to compare */\nint\tnc)\t\t/* Number of characters to compate */\n\n{\n    char *line;\n\n    if ((line = iraf2str (irafheader, nc)) == NULL)\n\treturn (1);\n    if (strncmp (line, teststring, nc) == 0) {\n\tfree (line);\n\treturn (0);\n\t}\n    else {\n\tfree (line);\n\treturn (1);\n\t}\n}\n/*--------------------------------------------------------------------------*/\n\n/* Convert IRAF image header to FITS image header, returning FITS header */\n\nstatic int iraftofits (\n    char    *hdrname,  /* IRAF header file name (may be path) */\n    char    *irafheader,  /* IRAF image header */\n    int\t    nbiraf,\t  /* Number of bytes in IRAF header */\n    char    **buffptr,    /* pointer to the FITS header  */\n    size_t  *nbfits,      /* allocated size of the FITS header buffer */\n    size_t  *fitssize,  /* Number of bytes in FITS header (returned) */\n                        /*  = number of bytes to the end of the END keyword */\n    int     *status)\n{\n    char *objname;\t/* object name from FITS file */\n    int lstr, i, j, k, ib, nax, nbits;\n    char *pixname, *newpixname, *bang, *chead;\n    char *fitsheader;\n    int nblock, nlines;\n    char *fhead, *fhead1, *fp, endline[81];\n    char irafchar;\n    char fitsline[81];\n    int pixtype;\n    int imhver, n, imu, pixoff, impixoff;\n/*    int immax, immin, imtime;  */\n    int imndim, imlen, imphyslen, impixtype;\n    char errmsg[FLEN_ERRMSG];\n\n    /* Set up last line of FITS header */\n    (void)strncpy (endline,\"END\", 3);\n    for (i = 3; i < 80; i++)\n\tendline[i] = ' ';\n    endline[80] = 0;\n\n    /* Check header magic word */\n    imhver = head_version (irafheader);\n    if (imhver < 1) {\n\tffpmsg(\"File not valid IRAF image header\");\n        ffpmsg(hdrname);\n\treturn(*status = FILE_NOT_OPENED);\n\t}\n    if (imhver == 2) {\n\tnlines = 24 + ((nbiraf - LEN_IM2HDR) / 81);\n\timndim = IM2_NDIM;\n\timlen = IM2_LEN;\n\timphyslen = IM2_PHYSLEN;\n\timpixtype = IM2_PIXTYPE;\n\timpixoff = IM2_PIXOFF;\n/*\timtime = IM2_MTIME; */\n/*\timmax = IM2_MAX;  */\n/*\timmin = IM2_MIN; */\n\t}\n    else {\n\tnlines = 24 + ((nbiraf - LEN_IMHDR) / 162);\n\timndim = IM_NDIM;\n\timlen = IM_LEN;\n\timphyslen = IM_PHYSLEN;\n\timpixtype = IM_PIXTYPE;\n\timpixoff = IM_PIXOFF;\n/*\timtime = IM_MTIME; */\n/*\timmax = IM_MAX; */\n/*\timmin = IM_MIN; */\n\t}\n\n    /*  Initialize FITS header */\n    nblock = (nlines * 80) / 2880;\n    *nbfits = (nblock + 5) * 2880 + 4;\n    fitsheader = (char *) calloc (*nbfits, 1);\n    if (fitsheader == NULL) {\n\tsnprintf(errmsg, FLEN_ERRMSG,\"IRAF2FITS Cannot allocate %d-byte FITS header\",\n\t\t(int) (*nbfits));\n        ffpmsg(hdrname);\n\treturn (*status = FILE_NOT_OPENED);\n\t}\n\n    fhead = fitsheader;\n    *buffptr = fitsheader;\n    (void)strncpy (fitsheader, endline, 80);\n    hputl (fitsheader, \"SIMPLE\", 1);\n    fhead = fhead + 80;\n\n    /*  check if the IRAF file is in big endian (sun) format (= 0) or not. */\n    /*  This is done by checking the 4 byte integer in the header that     */\n    /*  represents the iraf pixel type.  This 4-byte word is guaranteed to */\n    /*  have the least sig byte != 0 and the most sig byte = 0,  so if the */\n    /*  first byte of the word != 0, then the file in little endian format */\n    /*  like on an Alpha machine.                                          */\n\n    swaphead = isirafswapped(irafheader, impixtype);\n    if (imhver == 1)\n        swapdata = swaphead; /* vers 1 data has same swapness as header */\n    else\n        swapdata = irafgeti4 (irafheader, IM2_SWAPPED); \n\n    /*  Set pixel size in FITS header */\n    pixtype = irafgeti4 (irafheader, impixtype);\n    switch (pixtype) {\n\tcase TY_CHAR:\n\t    nbits = 8;\n\t    break;\n\tcase TY_UBYTE:\n\t    nbits = 8;\n\t    break;\n\tcase TY_SHORT:\n\t    nbits = 16;\n\t    break;\n\tcase TY_USHORT:\n\t    nbits = -16;\n\t    break;\n\tcase TY_INT:\n\tcase TY_LONG:\n\t    nbits = 32;\n\t    break;\n\tcase TY_REAL:\n\t    nbits = -32;\n\t    break;\n\tcase TY_DOUBLE:\n\t    nbits = -64;\n\t    break;\n\tdefault:\n\t    snprintf(errmsg,FLEN_ERRMSG,\"Unsupported IRAF data type: %d\", pixtype);\n            ffpmsg(errmsg);\n            ffpmsg(hdrname);\n\t    return (*status = FILE_NOT_OPENED);\n\t}\n    hputi4 (fitsheader,\"BITPIX\",nbits);\n    hputcom (fitsheader,\"BITPIX\", \"IRAF .imh pixel type\");\n    fhead = fhead + 80;\n\n    /*  Set image dimensions in FITS header */\n    nax = irafgeti4 (irafheader, imndim);\n    hputi4 (fitsheader,\"NAXIS\",nax);\n    hputcom (fitsheader,\"NAXIS\", \"IRAF .imh naxis\");\n    fhead = fhead + 80;\n\n    n = irafgeti4 (irafheader, imlen);\n    hputi4 (fitsheader, \"NAXIS1\", n);\n    hputcom (fitsheader,\"NAXIS1\", \"IRAF .imh image naxis[1]\");\n    fhead = fhead + 80;\n\n    if (nax > 1) {\n\tn = irafgeti4 (irafheader, imlen+4);\n\thputi4 (fitsheader, \"NAXIS2\", n);\n\thputcom (fitsheader,\"NAXIS2\", \"IRAF .imh image naxis[2]\");\n        fhead = fhead + 80;\n\t}\n    if (nax > 2) {\n\tn = irafgeti4 (irafheader, imlen+8);\n\thputi4 (fitsheader, \"NAXIS3\", n);\n\thputcom (fitsheader,\"NAXIS3\", \"IRAF .imh image naxis[3]\");\n\tfhead = fhead + 80;\n\t}\n    if (nax > 3) {\n\tn = irafgeti4 (irafheader, imlen+12);\n\thputi4 (fitsheader, \"NAXIS4\", n);\n\thputcom (fitsheader,\"NAXIS4\", \"IRAF .imh image naxis[4]\");\n\tfhead = fhead + 80;\n\t}\n\n    /* Set object name in FITS header */\n    if (imhver == 2)\n\tobjname = irafgetc (irafheader, IM2_TITLE, SZ_IM2TITLE);\n    else\n\tobjname = irafgetc2 (irafheader, IM_TITLE, SZ_IMTITLE);\n    if ((lstr = strlen (objname)) < 8) {\n\tfor (i = lstr; i < 8; i++)\n\t    objname[i] = ' ';\n\tobjname[8] = 0;\n\t}\n    hputs (fitsheader,\"OBJECT\",objname);\n    hputcom (fitsheader,\"OBJECT\", \"IRAF .imh title\");\n    free (objname);\n    fhead = fhead + 80;\n\n    /* Save physical axis lengths so image file can be read */\n    n = irafgeti4 (irafheader, imphyslen);\n    hputi4 (fitsheader, \"NPAXIS1\", n);\n    hputcom (fitsheader,\"NPAXIS1\", \"IRAF .imh physical naxis[1]\");\n    fhead = fhead + 80;\n    if (nax > 1) {\n\tn = irafgeti4 (irafheader, imphyslen+4);\n\thputi4 (fitsheader, \"NPAXIS2\", n);\n\thputcom (fitsheader,\"NPAXIS2\", \"IRAF .imh physical naxis[2]\");\n\tfhead = fhead + 80;\n\t}\n    if (nax > 2) {\n\tn = irafgeti4 (irafheader, imphyslen+8);\n\thputi4 (fitsheader, \"NPAXIS3\", n);\n\thputcom (fitsheader,\"NPAXIS3\", \"IRAF .imh physical naxis[3]\");\n\tfhead = fhead + 80;\n\t}\n    if (nax > 3) {\n\tn = irafgeti4 (irafheader, imphyslen+12);\n\thputi4 (fitsheader, \"NPAXIS4\", n);\n\thputcom (fitsheader,\"NPAXIS4\", \"IRAF .imh physical naxis[4]\");\n\tfhead = fhead + 80;\n\t}\n\n    /* Save image header filename in header */\n    hputs (fitsheader,\"IMHFILE\",hdrname);\n    hputcom (fitsheader,\"IMHFILE\", \"IRAF header file name\");\n    fhead = fhead + 80;\n\n    /* Save image pixel file pathname in header */\n    if (imhver == 2)\n\tpixname = irafgetc (irafheader, IM2_PIXFILE, SZ_IM2PIXFILE);\n    else\n\tpixname = irafgetc2 (irafheader, IM_PIXFILE, SZ_IMPIXFILE);\n    if (strncmp(pixname, \"HDR\", 3) == 0 ) {\n\tnewpixname = same_path (pixname, hdrname);\n        if (newpixname) {\n          free (pixname);\n          pixname = newpixname;\n\t  }\n\t}\n    if (strchr (pixname, '/') == NULL && strchr (pixname, '$') == NULL) {\n\tnewpixname = same_path (pixname, hdrname);\n        if (newpixname) {\n          free (pixname);\n          pixname = newpixname;\n\t  }\n\t}\n\t\n    if ((bang = strchr (pixname, '!')) != NULL )\n\thputs (fitsheader,\"PIXFILE\",bang+1);\n    else\n\thputs (fitsheader,\"PIXFILE\",pixname);\n    free (pixname);\n    hputcom (fitsheader,\"PIXFILE\", \"IRAF .pix pixel file\");\n    fhead = fhead + 80;\n\n    /* Save image offset from star of pixel file */\n    pixoff = irafgeti4 (irafheader, impixoff);\n    pixoff = (pixoff - 1) * 2;\n    hputi4 (fitsheader, \"PIXOFF\", pixoff);\n    hputcom (fitsheader,\"PIXOFF\", \"IRAF .pix pixel offset (Do not change!)\");\n    fhead = fhead + 80;\n\n    /* Save IRAF file format version in header */\n    hputi4 (fitsheader,\"IMHVER\",imhver);\n    hputcom (fitsheader,\"IMHVER\", \"IRAF .imh format version (1 or 2)\");\n    fhead = fhead + 80;\n\n    /* Save flag as to whether to swap IRAF data for this file and machine */\n    if (swapdata)\n\thputl (fitsheader, \"PIXSWAP\", 1);\n    else\n\thputl (fitsheader, \"PIXSWAP\", 0);\n    hputcom (fitsheader,\"PIXSWAP\", \"IRAF pixels, FITS byte orders differ if T\");\n    fhead = fhead + 80;\n\n    /* Add user portion of IRAF header to FITS header */\n    fitsline[80] = 0;\n    if (imhver == 2) {\n\timu = LEN_IM2HDR;\n\tchead = irafheader;\n\tj = 0;\n\tfor (k = 0; k < 80; k++)\n\t    fitsline[k] = ' ';\n\tfor (i = imu; i < nbiraf; i++) {\n\t    irafchar = chead[i];\n\t    if (irafchar == 0)\n\t\tbreak;\n\t    else if (irafchar == 10) {\n\t\t(void)strncpy (fhead, fitsline, 80);\n\t\t/* fprintf (stderr,\"%80s\\n\",fitsline); */\n\t\tif (strncmp (fitsline, \"OBJECT \", 7) != 0) {\n\t\t    fhead = fhead + 80;\n\t\t    }\n\t\tfor (k = 0; k < 80; k++)\n\t\t    fitsline[k] = ' ';\n\t\tj = 0;\n\t\t}\n\t    else {\n\t\tif (j > 80) {\n\t\t    if (strncmp (fitsline, \"OBJECT \", 7) != 0) {\n\t\t\t(void)strncpy (fhead, fitsline, 80);\n\t\t\t/* fprintf (stderr,\"%80s\\n\",fitsline); */\n\t\t\tj = 9;\n\t\t\tfhead = fhead + 80;\n\t\t\t}\n\t\t    for (k = 0; k < 80; k++)\n\t\t\tfitsline[k] = ' ';\n\t\t    }\n\t\tif (irafchar > 32 && irafchar < 127)\n\t\t    fitsline[j] = irafchar;\n\t\tj++;\n\t\t}\n\t    }\n\t}\n    else {\n\timu = LEN_IMHDR;\n\tchead = irafheader;\n\tif (swaphead == 1)\n\t    ib = 0;\n\telse\n\t    ib = 1;\n\tfor (k = 0; k < 80; k++)\n\t    fitsline[k] = ' ';\n\tj = 0;\n\tfor (i = imu; i < nbiraf; i=i+2) {\n\t    irafchar = chead[i+ib];\n\t    if (irafchar == 0)\n\t\tbreak;\n\t    else if (irafchar == 10) {\n\t\tif (strncmp (fitsline, \"OBJECT \", 7) != 0) {\n\t\t    (void)strncpy (fhead, fitsline, 80);\n\t\t    fhead = fhead + 80;\n\t\t    }\n\t\t/* fprintf (stderr,\"%80s\\n\",fitsline); */\n\t\tj = 0;\n\t\tfor (k = 0; k < 80; k++)\n\t\t    fitsline[k] = ' ';\n\t\t}\n\t    else {\n\t\tif (j > 80) {\n\t\t    if (strncmp (fitsline, \"OBJECT \", 7) != 0) {\n\t\t\t(void)strncpy (fhead, fitsline, 80);\n\t\t\tj = 9;\n\t\t\tfhead = fhead + 80;\n\t\t\t}\n\t\t    /* fprintf (stderr,\"%80s\\n\",fitsline); */\n\t\t    for (k = 0; k < 80; k++)\n\t\t\tfitsline[k] = ' ';\n\t\t    }\n\t\tif (irafchar > 32 && irafchar < 127)\n\t\t    fitsline[j] = irafchar;\n\t\tj++;\n\t\t}\n\t    }\n\t}\n\n    /* Add END to last line */\n    (void)strncpy (fhead, endline, 80);\n\n    /* Find end of last 2880-byte block of header */\n    fhead = ksearch (fitsheader, \"END\") + 80;\n    nblock = *nbfits / 2880;\n    fhead1 = fitsheader + (nblock * 2880);\n    *fitssize = fhead - fitsheader;  /* no. of bytes to end of END keyword */\n\n    /* Pad rest of header with spaces */\n    strncpy (endline,\"   \",3);\n    for (fp = fhead; fp < fhead1; fp = fp + 80) {\n\t(void)strncpy (fp, endline,80);\n\t}\n\n    return (*status);\n}\n/*--------------------------------------------------------------------------*/\n\n/* get the IRAF pixel file name */\n\nstatic int getirafpixname (\n    const char *hdrname,  /* IRAF header file name (may be path) */\n    char    *irafheader,  /* IRAF image header */\n    char    *pixfilename,     /* IRAF pixel file name */\n    int     *status)\n{\n    int imhver;\n    char *pixname, *newpixname, *bang;\n\n    /* Check header magic word */\n    imhver = head_version (irafheader);\n    if (imhver < 1) {\n\tffpmsg(\"File not valid IRAF image header\");\n        ffpmsg(hdrname);\n\treturn(*status = FILE_NOT_OPENED);\n\t}\n\n    /* get image pixel file pathname in header */\n    if (imhver == 2)\n\tpixname = irafgetc (irafheader, IM2_PIXFILE, SZ_IM2PIXFILE);\n    else\n\tpixname = irafgetc2 (irafheader, IM_PIXFILE, SZ_IMPIXFILE);\n\n    if (strncmp(pixname, \"HDR\", 3) == 0 ) {\n\tnewpixname = same_path (pixname, hdrname);\n        if (newpixname) {\n          free (pixname);\n          pixname = newpixname;\n\t  }\n\t}\n\n    if (strchr (pixname, '/') == NULL && strchr (pixname, '$') == NULL) {\n\tnewpixname = same_path (pixname, hdrname);\n        if (newpixname) {\n          free (pixname);\n          pixname = newpixname;\n\t  }\n\t}\n\t\n    if ((bang = strchr (pixname, '!')) != NULL )\n\tstrcpy(pixfilename,bang+1);\n    else\n\tstrcpy(pixfilename,pixname);\n\n    free (pixname);\n\n    return (*status);\n}\n\n/*--------------------------------------------------------------------------*/\n/* Put filename and header path together */\n\nstatic char *same_path (\n\nchar\t*pixname,\t/* IRAF pixel file pathname */\nconst char\t*hdrname)\t/* IRAF image header file pathname */\n\n{\n    int len;\n    char *newpixname;\n\n/*  WDP - 10/16/2007 - increased allocation to avoid possible overflow */\n/*    newpixname = (char *) calloc (SZ_IM2PIXFILE, sizeof (char)); */\n\n    newpixname = (char *) calloc (2*SZ_IM2PIXFILE+1, sizeof (char));\n    if (newpixname == NULL) {\n            ffpmsg(\"iraffits same_path: Cannot alloc memory for newpixname\");\n\t    return (NULL);\n\t}\n\n    /* Pixel file is in same directory as header */\n    if (strncmp(pixname, \"HDR$\", 4) == 0 ) {\n\t(void)strncpy (newpixname, hdrname, SZ_IM2PIXFILE);\n\n\t/* find the end of the pathname */\n\tlen = strlen (newpixname);\n#ifndef VMS\n\twhile( (len > 0) && (newpixname[len-1] != '/') )\n#else\n\twhile( (len > 0) && (newpixname[len-1] != ']') && (newpixname[len-1] != ':') )\n#endif\n\t    len--;\n\n\t/* add name */\n\tnewpixname[len] = '\\0';\n\t(void)strncat (newpixname, &pixname[4], SZ_IM2PIXFILE);\n\t}\n\n    /* Bare pixel file with no path is assumed to be same as HDR$filename */\n    else if (strchr (pixname, '/') == NULL && strchr (pixname, '$') == NULL) {\n\t(void)strncpy (newpixname, hdrname, SZ_IM2PIXFILE);\n\n\t/* find the end of the pathname */\n\tlen = strlen (newpixname);\n#ifndef VMS\n\twhile( (len > 0) && (newpixname[len-1] != '/') )\n#else\n\twhile( (len > 0) && (newpixname[len-1] != ']') && (newpixname[len-1] != ':') )\n#endif\n\t    len--;\n\n\t/* add name */\n\tnewpixname[len] = '\\0';\n\t(void)strncat (newpixname, pixname, SZ_IM2PIXFILE);\n\t}\n\n    /* Pixel file has same name as header file, but with .pix extension */\n    else if (strncmp (pixname, \"HDR\", 3) == 0) {\n\n\t/* load entire header name string into name buffer */\n\t(void)strncpy (newpixname, hdrname, SZ_IM2PIXFILE);\n\tlen = strlen (newpixname);\n\tnewpixname[len-3] = 'p';\n\tnewpixname[len-2] = 'i';\n\tnewpixname[len-1] = 'x';\n\t}\n\n    return (newpixname);\n}\n\n/*--------------------------------------------------------------------------*/\nstatic int isirafswapped (\n\nchar\t*irafheader,\t/* IRAF image header */\nint\toffset)\t\t/* Number of bytes to skip before number */\n\n    /*  check if the IRAF file is in big endian (sun) format (= 0) or not */\n    /*  This is done by checking the 4 byte integer in the header that */\n    /*  represents the iraf pixel type.  This 4-byte word is guaranteed to */\n    /*  have the least sig byte != 0 and the most sig byte = 0,  so if the */\n    /*  first byte of the word != 0, then the file in little endian format */\n    /*  like on an Alpha machine.                                          */\n\n{\n    int  swapped;\n\n    if (irafheader[offset] != 0)\n\tswapped = 1;\n    else\n\tswapped = 0;\n\n    return (swapped);\n}\n/*--------------------------------------------------------------------------*/\nstatic int irafgeti4 (\n\nchar\t*irafheader,\t/* IRAF image header */\nint\toffset)\t\t/* Number of bytes to skip before number */\n\n{\n    char *ctemp, *cheader;\n    int  temp;\n\n    cheader = irafheader;\n    ctemp = (char *) &temp;\n\n    if (machswap() != swaphead) {\n\tctemp[3] = cheader[offset];\n\tctemp[2] = cheader[offset+1];\n\tctemp[1] = cheader[offset+2];\n\tctemp[0] = cheader[offset+3];\n\t}\n    else {\n\tctemp[0] = cheader[offset];\n\tctemp[1] = cheader[offset+1];\n\tctemp[2] = cheader[offset+2];\n\tctemp[3] = cheader[offset+3];\n\t}\n    return (temp);\n}\n\n/*--------------------------------------------------------------------------*/\n/* IRAFGETC2 -- Get character string from arbitrary part of v.1 IRAF header */\n\nstatic char *irafgetc2 (\n\nchar\t*irafheader,\t/* IRAF image header */\nint\toffset,\t\t/* Number of bytes to skip before string */\nint\tnc)\t\t/* Maximum number of characters in string */\n\n{\n    char *irafstring, *string;\n\n    irafstring = irafgetc (irafheader, offset, 2*(nc+1));\n    string = iraf2str (irafstring, nc);\n    free (irafstring);\n\n    return (string);\n}\n\n/*--------------------------------------------------------------------------*/\n/* IRAFGETC -- Get character string from arbitrary part of IRAF header */\n\nstatic char *irafgetc (\n\nchar\t*irafheader,\t/* IRAF image header */\nint\toffset,\t\t/* Number of bytes to skip before string */\nint\tnc)\t\t/* Maximum number of characters in string */\n\n{\n    char *ctemp, *cheader;\n    int i;\n\n    cheader = irafheader;\n    ctemp = (char *) calloc (nc+1, 1);\n    if (ctemp == NULL) {\n\tffpmsg(\"IRAFGETC Cannot allocate memory for string variable\");\n\treturn (NULL);\n\t}\n    for (i = 0; i < nc; i++) {\n\tctemp[i] = cheader[offset+i];\n\tif (ctemp[i] > 0 && ctemp[i] < 32)\n\t    ctemp[i] = ' ';\n\t}\n\n    return (ctemp);\n}\n\n/*--------------------------------------------------------------------------*/\n/* Convert IRAF 2-byte/char string to 1-byte/char string */\n\nstatic char *iraf2str (\n\nchar\t*irafstring,\t/* IRAF 2-byte/character string */\nint\tnchar)\t\t/* Number of characters in string */\n{\n    char *string;\n    int i, j;\n\n    string = (char *) calloc (nchar+1, 1);\n    if (string == NULL) {\n\tffpmsg(\"IRAF2STR Cannot allocate memory for string variable\");\n\treturn (NULL);\n\t}\n\n    /* the chars are in bytes 1, 3, 5, ... if bigendian format (SUN) */\n    /* else in bytes 0, 2, 4, ... if little endian format (Alpha)    */\n\n    if (irafstring[0] != 0)\n\tj = 0;\n    else\n\tj = 1;\n\n    /* Convert appropriate byte of input to output character */\n    for (i = 0; i < nchar; i++) {\n\tstring[i] = irafstring[j];\n\tj = j + 2;\n\t}\n\n    return (string);\n}\n\n/*--------------------------------------------------------------------------*/\n/* IRAFSWAP -- Reverse bytes of any type of vector in place */\n\nstatic void irafswap (\n\nint\tbitpix,\t\t/* Number of bits per pixel */\n\t\t\t/*  16 = short, -16 = unsigned short, 32 = int */\n\t\t\t/* -32 = float, -64 = double */\nchar\t*string,\t/* Address of starting point of bytes to swap */\nint\tnbytes)\t\t/* Number of bytes to swap */\n\n{\n    switch (bitpix) {\n\n\tcase 16:\n\t    if (nbytes < 2) return;\n\t    irafswap2 (string,nbytes);\n\t    break;\n\n\tcase 32:\n\t    if (nbytes < 4) return;\n\t    irafswap4 (string,nbytes);\n\t    break;\n\n\tcase -16:\n\t    if (nbytes < 2) return;\n\t    irafswap2 (string,nbytes);\n\t    break;\n\n\tcase -32:\n\t    if (nbytes < 4) return;\n\t    irafswap4 (string,nbytes);\n\t    break;\n\n\tcase -64:\n\t    if (nbytes < 8) return;\n\t    irafswap8 (string,nbytes);\n\t    break;\n\n\t}\n    return;\n}\n\n/*--------------------------------------------------------------------------*/\n/* IRAFSWAP2 -- Swap bytes in string in place */\n\nstatic void irafswap2 (\n\nchar *string,\t/* Address of starting point of bytes to swap */\nint nbytes)\t/* Number of bytes to swap */\n\n{\n    char *sbyte, temp, *slast;\n\n    slast = string + nbytes;\n    sbyte = string;\n    while (sbyte < slast) {\n\ttemp = sbyte[0];\n\tsbyte[0] = sbyte[1];\n\tsbyte[1] = temp;\n\tsbyte= sbyte + 2;\n\t}\n    return;\n}\n\n/*--------------------------------------------------------------------------*/\n/* IRAFSWAP4 -- Reverse bytes of Integer*4 or Real*4 vector in place */\n\nstatic void irafswap4 (\n\nchar *string,\t/* Address of Integer*4 or Real*4 vector */\nint nbytes)\t/* Number of bytes to reverse */\n\n{\n    char *sbyte, *slast;\n    char temp0, temp1, temp2, temp3;\n\n    slast = string + nbytes;\n    sbyte = string;\n    while (sbyte < slast) {\n\ttemp3 = sbyte[0];\n\ttemp2 = sbyte[1];\n\ttemp1 = sbyte[2];\n\ttemp0 = sbyte[3];\n\tsbyte[0] = temp0;\n\tsbyte[1] = temp1;\n\tsbyte[2] = temp2;\n\tsbyte[3] = temp3;\n\tsbyte = sbyte + 4;\n\t}\n\n    return;\n}\n\n/*--------------------------------------------------------------------------*/\n/* IRAFSWAP8 -- Reverse bytes of Real*8 vector in place */\n\nstatic void irafswap8 (\n\nchar *string,\t/* Address of Real*8 vector */\nint nbytes)\t/* Number of bytes to reverse */\n\n{\n    char *sbyte, *slast;\n    char temp[8];\n\n    slast = string + nbytes;\n    sbyte = string;\n    while (sbyte < slast) {\n\ttemp[7] = sbyte[0];\n\ttemp[6] = sbyte[1];\n\ttemp[5] = sbyte[2];\n\ttemp[4] = sbyte[3];\n\ttemp[3] = sbyte[4];\n\ttemp[2] = sbyte[5];\n\ttemp[1] = sbyte[6];\n\ttemp[0] = sbyte[7];\n\tsbyte[0] = temp[0];\n\tsbyte[1] = temp[1];\n\tsbyte[2] = temp[2];\n\tsbyte[3] = temp[3];\n\tsbyte[4] = temp[4];\n\tsbyte[5] = temp[5];\n\tsbyte[6] = temp[6];\n\tsbyte[7] = temp[7];\n\tsbyte = sbyte + 8;\n\t}\n    return;\n}\n\n/*--------------------------------------------------------------------------*/\nstatic int\nmachswap (void)\n\n{\n    char *ctest;\n    int itest;\n\n    itest = 1;\n    ctest = (char *)&itest;\n    if (*ctest)\n\treturn (1);\n    else\n\treturn (0);\n}\n\n/*--------------------------------------------------------------------------*/\n/*             the following routines were originally in hget.c             */\n/*--------------------------------------------------------------------------*/\n\n\nstatic int lhead0 = 0;\n\n/*--------------------------------------------------------------------------*/\n\n/* Extract long value for variable from FITS header string */\n\nstatic int\nhgeti4 (hstring,keyword,ival)\n\nchar *hstring;\t/* character string containing FITS header information\n\t\t   in the format <keyword>= <value> {/ <comment>} */\nchar *keyword;\t/* character string containing the name of the keyword\n\t\t   the value of which is returned.  hget searches for a\n\t\t   line beginning with this string.  if \"[n]\" is present,\n\t\t   the n'th token in the value is returned.\n\t\t   (the first 8 characters must be unique) */\nint *ival;\n{\nchar *value;\ndouble dval;\nint minint;\nchar val[30]; \n\n/* Get value and comment from header string */\n\tvalue = hgetc (hstring,keyword);\n\n/* Translate value from ASCII to binary */\n\tif (value != NULL) {\n\t    minint = -MAXINT - 1;\n            if (strlen(value) > 29)\n               return(0);\n\t    strcpy (val, value);\n\t    dval = atof (val);\n\t    if (dval+0.001 > MAXINT)\n\t\t*ival = MAXINT;\n\t    else if (dval >= 0)\n\t\t*ival = (int) (dval + 0.001);\n\t    else if (dval-0.001 < minint)\n\t\t*ival = minint;\n\t    else\n\t\t*ival = (int) (dval - 0.001);\n\t    return (1);\n\t    }\n\telse {\n\t    return (0);\n\t    }\n}\n\n/*-------------------------------------------------------------------*/\n/* Extract string value for variable from FITS header string */\n\nstatic int\nhgets (hstring, keyword, lstr, str)\n\nchar *hstring;\t/* character string containing FITS header information\n\t\t   in the format <keyword>= <value> {/ <comment>} */\nchar *keyword;\t/* character string containing the name of the keyword\n\t\t   the value of which is returned.  hget searches for a\n\t\t   line beginning with this string.  if \"[n]\" is present,\n\t\t   the n'th token in the value is returned.\n\t\t   (the first 8 characters must be unique) */\nint lstr;\t/* Size of str in characters */\nchar *str;\t/* String (returned) */\n{\n\tchar *value;\n\tint lval;\n\n/* Get value and comment from header string */\n\tvalue = hgetc (hstring,keyword);\n\n\tif (value != NULL) {\n\t    lval = strlen (value);\n\t    if (lval < lstr)\n\t\tstrcpy (str, value);\n\t    else if (lstr > 1) {\n\t\tstrncpy (str, value, lstr-1);\n                str[lstr-1]=0;\n            }\n\t    else {\n\t\tstr[0] = value[0];\n            }\n\t    return (1);\n\t    }\n\telse\n\t    return (0);\n}\n\n/*-------------------------------------------------------------------*/\n/* Extract character value for variable from FITS header string */\n\nstatic char *\nhgetc (hstring,keyword0)\n\nchar *hstring;\t/* character string containing FITS header information\n\t\t   in the format <keyword>= <value> {/ <comment>} */\nchar *keyword0;\t/* character string containing the name of the keyword\n\t\t   the value of which is returned.  hget searches for a\n\t\t   line beginning with this string.  if \"[n]\" is present,\n\t\t   the n'th token in the value is returned.\n\t\t   (the first 8 characters must be unique) */\n{\n\tstatic char cval[80];\n\tchar *value;\n\tchar cwhite[2];\n\tchar squot[2], dquot[2], lbracket[2], rbracket[2], slash[2], comma[2];\n\tchar keyword[81]; /* large for ESO hierarchical keywords */\n\tchar line[100];\n\tchar *vpos, *cpar = NULL;\n\tchar *q1, *q2 = NULL, *v1, *v2, *c1, *brack1, *brack2;\n        char *saveptr;\n\tint ipar, i;\n\n\tsquot[0] = 39;\n\tsquot[1] = 0;\n\tdquot[0] = 34;\n\tdquot[1] = 0;\n\tlbracket[0] = 91;\n\tlbracket[1] = 0;\n\tcomma[0] = 44;\n\tcomma[1] = 0;\n\trbracket[0] = 93;\n\trbracket[1] = 0;\n\tslash[0] = 47;\n\tslash[1] = 0;\n\n/* Find length of variable name */\n\tstrncpy (keyword,keyword0, sizeof(keyword)-1);\n        keyword[80]=0;\n\tbrack1 = strsrch (keyword,lbracket);\n\tif (brack1 == NULL)\n\t    brack1 = strsrch (keyword,comma);\n\tif (brack1 != NULL) {\n\t    *brack1 = '\\0';\n\t    brack1++;\n\t    }\n\n/* Search header string for variable name */\n\tvpos = ksearch (hstring,keyword);\n\n/* Exit if not found */\n\tif (vpos == NULL) {\n\t    return (NULL);\n\t    }\n\n/* Initialize line to nulls */\n\t for (i = 0; i < 100; i++)\n\t    line[i] = 0;\n\n/* In standard FITS, data lasts until 80th character */\n\n/* Extract entry for this variable from the header */\n\tstrncpy (line,vpos,80);\n\n/* check for quoted value */\n\tq1 = strsrch (line,squot);\n\tc1 = strsrch (line,slash);\n\tif (q1 != NULL) {\n\t    if (c1 != NULL && q1 < c1)\n\t\tq2 = strsrch (q1+1,squot);\n\t    else if (c1 == NULL)\n\t\tq2 = strsrch (q1+1,squot);\n\t    else\n\t\tq1 = NULL;\n\t    }\n\telse {\n\t    q1 = strsrch (line,dquot);\n\t    if (q1 != NULL) {\n\t\tif (c1 != NULL && q1 < c1)\n\t\t    q2 = strsrch (q1+1,dquot);\n\t\telse if (c1 == NULL)\n\t\t    q2 = strsrch (q1+1,dquot);\n\t\telse\n\t\t    q1 = NULL;\n\t\t}\n\t    else {\n\t\tq1 = NULL;\n\t\tq2 = line + 10;\n\t\t}\n\t    }\n\n/* Extract value and remove excess spaces */\n\tif (q1 != NULL) {\n\t    v1 = q1 + 1;\n\t    v2 = q2;\n\t    c1 = strsrch (q2,\"/\");\n\t    }\n\telse {\n\t    v1 = strsrch (line,\"=\") + 1;\n\t    c1 = strsrch (line,\"/\");\n\t    if (c1 != NULL)\n\t\tv2 = c1;\n\t    else\n\t\tv2 = line + 79;\n\t    }\n\n/* Ignore leading spaces */\n\twhile (*v1 == ' ' && v1 < v2) {\n\t    v1++;\n\t    }\n\n/* Drop trailing spaces */\n\t*v2 = '\\0';\n\tv2--;\n\twhile (*v2 == ' ' && v2 > v1) {\n\t    *v2 = '\\0';\n\t    v2--;\n\t    }\n\n\tif (!strcmp (v1, \"-0\"))\n\t    v1++;\n\tstrcpy (cval,v1);\n\tvalue = cval;\n\n/* If keyword has brackets, extract appropriate token from value */\n\tif (brack1 != NULL) {\n\t    brack2 = strsrch (brack1,rbracket);\n\t    if (brack2 != NULL)\n\t\t*brack2 = '\\0';\n\t    ipar = atoi (brack1);\n\t    if (ipar > 0) {\n\t\tcwhite[0] = ' ';\n\t\tcwhite[1] = '\\0';\n\t\tfor (i = 1; i <= ipar; i++) {\n\t\t    cpar = ffstrtok (v1,cwhite,&saveptr);\n\t\t    v1 = NULL;\n\t\t    }\n\t\tif (cpar != NULL) {\n\t\t    strcpy (cval,cpar);\n\t\t    }\n\t\telse\n\t\t    value = NULL;\n\t\t}\n\t    }\n\n\treturn (value);\n}\n\n\n/*-------------------------------------------------------------------*/\n/* Find beginning of fillable blank line before FITS header keyword line */\n\nstatic char *\nblsearch (hstring,keyword)\n\n/* Find entry for keyword keyword in FITS header string hstring.\n   (the keyword may have a maximum of eight letters)\n   NULL is returned if the keyword is not found */\n\nchar *hstring;\t/* character string containing fits-style header\n\t\tinformation in the format <keyword>= <value> {/ <comment>}\n\t\tthe default is that each entry is 80 characters long;\n\t\thowever, lines may be of arbitrary length terminated by\n\t\tnulls, carriage returns or linefeeds, if packed is true.  */\nchar *keyword;\t/* character string containing the name of the variable\n\t\tto be returned.  ksearch searches for a line beginning\n\t\twith this string.  The string may be a character\n\t\tliteral or a character variable terminated by a null\n\t\tor '$'.  it is truncated to 8 characters. */\n{\n    char *loc, *headnext, *headlast, *pval, *lc, *line;\n    char *bval;\n    int icol, nextchar, lkey, nleft, lhstr;\n\n    pval = 0;\n\n    /* Search header string for variable name */\n    if (lhead0)\n\tlhstr = lhead0;\n    else {\n\tlhstr = 0;\n\twhile (lhstr < 57600 && hstring[lhstr] != 0)\n\t    lhstr++;\n\t}\n    headlast = hstring + lhstr;\n    headnext = hstring;\n    pval = NULL;\n    while (headnext < headlast) {\n\tnleft = headlast - headnext;\n\tloc = strnsrch (headnext, keyword, nleft);\n\n\t/* Exit if keyword is not found */\n\tif (loc == NULL) {\n\t    break;\n\t    }\n\n\ticol = (loc - hstring) % 80;\n\tlkey = strlen (keyword);\n\tnextchar = (int) *(loc + lkey);\n\n\t/* If this is not in the first 8 characters of a line, keep searching */\n\tif (icol > 7)\n\t    headnext = loc + 1;\n\n\t/* If parameter name in header is longer, keep searching */\n\telse if (nextchar != 61 && nextchar > 32 && nextchar < 127)\n\t    headnext = loc + 1;\n\n\t/* If preceeding characters in line are not blanks, keep searching */\n\telse {\n\t    line = loc - icol;\n\t    for (lc = line; lc < loc; lc++) {\n\t\tif (*lc != ' ')\n\t\t    headnext = loc + 1;\n\t\t}\n\n\t/* Return pointer to start of line if match */\n\t    if (loc >= headnext) {\n\t\tpval = line;\n\t\tbreak;\n\t\t}\n\t    }\n\t}\n\n    /* Return NULL if keyword is found at start of FITS header string */\n    if (pval == NULL)\n\treturn (pval);\n\n    /* Return NULL if  found the first keyword in the header */\n    if (pval == hstring)\n        return (NULL);\n\n    /* Find last nonblank line before requested keyword */\n    bval = pval - 80;\n    while (!strncmp (bval,\"        \",8))\n\tbval = bval - 80;\n    bval = bval + 80;\n\n    /* Return pointer to calling program if blank lines found */\n    if (bval < pval)\n\treturn (bval);\n    else\n\treturn (NULL);\n}\n\n\n/*-------------------------------------------------------------------*/\n/* Find FITS header line containing specified keyword */\n\nstatic char *ksearch (hstring,keyword)\n\n/* Find entry for keyword keyword in FITS header string hstring.\n   (the keyword may have a maximum of eight letters)\n   NULL is returned if the keyword is not found */\n\nchar *hstring;\t/* character string containing fits-style header\n\t\tinformation in the format <keyword>= <value> {/ <comment>}\n\t\tthe default is that each entry is 80 characters long;\n\t\thowever, lines may be of arbitrary length terminated by\n\t\tnulls, carriage returns or linefeeds, if packed is true.  */\nchar *keyword;\t/* character string containing the name of the variable\n\t\tto be returned.  ksearch searches for a line beginning\n\t\twith this string.  The string may be a character\n\t\tliteral or a character variable terminated by a null\n\t\tor '$'.  it is truncated to 8 characters. */\n{\n    char *loc, *headnext, *headlast, *pval, *lc, *line;\n    int icol, nextchar, lkey, nleft, lhstr;\n\n    pval = 0;\n\n/* Search header string for variable name */\n    if (lhead0)\n\tlhstr = lhead0;\n    else {\n\tlhstr = 0;\n\twhile (lhstr < 57600 && hstring[lhstr] != 0)\n\t    lhstr++;\n\t}\n    headlast = hstring + lhstr;\n    headnext = hstring;\n    pval = NULL;\n    while (headnext < headlast) {\n\tnleft = headlast - headnext;\n\tloc = strnsrch (headnext, keyword, nleft);\n\n\t/* Exit if keyword is not found */\n\tif (loc == NULL) {\n\t    break;\n\t    }\n\n\ticol = (loc - hstring) % 80;\n\tlkey = strlen (keyword);\n\tnextchar = (int) *(loc + lkey);\n\n\t/* If this is not in the first 8 characters of a line, keep searching */\n\tif (icol > 7)\n\t    headnext = loc + 1;\n\n\t/* If parameter name in header is longer, keep searching */\n\telse if (nextchar != 61 && nextchar > 32 && nextchar < 127)\n\t    headnext = loc + 1;\n\n\t/* If preceeding characters in line are not blanks, keep searching */\n\telse {\n\t    line = loc - icol;\n\t    for (lc = line; lc < loc; lc++) {\n\t\tif (*lc != ' ')\n\t\t    headnext = loc + 1;\n\t\t}\n\n\t/* Return pointer to start of line if match */\n\t    if (loc >= headnext) {\n\t\tpval = line;\n\t\tbreak;\n\t\t}\n\t    }\n\t}\n\n/* Return pointer to calling program */\n\treturn (pval);\n\n}\n\n/*-------------------------------------------------------------------*/\n/* Find string s2 within null-terminated string s1 */\n\nstatic char *\nstrsrch (s1, s2)\n\nchar *s1;\t/* String to search */\nchar *s2;\t/* String to look for */\n\n{\n    int ls1;\n    ls1 = strlen (s1);\n    return (strnsrch (s1, s2, ls1));\n}\n\n/*-------------------------------------------------------------------*/\n/* Find string s2 within string s1 */\n\nstatic char *\nstrnsrch (s1, s2, ls1)\n\nchar\t*s1;\t/* String to search */\nchar\t*s2;\t/* String to look for */\nint\tls1;\t/* Length of string being searched */\n\n{\n    char *s,*s1e;\n    char cfirst,clast;\n    int i,ls2;\n\n    /* Return null string if either pointer is NULL */\n    if (s1 == NULL || s2 == NULL)\n\treturn (NULL);\n\n    /* A zero-length pattern is found in any string */\n    ls2 = strlen (s2);\n    if (ls2 ==0)\n\treturn (s1);\n\n    /* Only a zero-length string can be found in a zero-length string */\n    if (ls1 ==0)\n\treturn (NULL);\n\n    cfirst = s2[0];\n    clast = s2[ls2-1];\n    s1e = s1 + ls1 - ls2 + 1;\n    s = s1;\n    while (s < s1e) { \n\n\t/* Search for first character in pattern string */\n\tif (*s == cfirst) {\n\n\t    /* If single character search, return */\n\t    if (ls2 == 1)\n\t\treturn (s);\n\n\t    /* Search for last character in pattern string if first found */\n\t    if (s[ls2-1] == clast) {\n\n\t\t/* If two-character search, return */\n\t\tif (ls2 == 2)\n\t\t    return (s);\n\n\t\t/* If 3 or more characters, check for rest of search string */\n\t\ti = 1;\n\t\twhile (i < ls2 && s[i] == s2[i])\n\t\t    i++;\n\n\t\t/* If entire string matches, return */\n\t\tif (i >= ls2)\n\t\t    return (s);\n\t\t}\n\t    }\n\ts++;\n\t}\n    return (NULL);\n}\n\n/*-------------------------------------------------------------------*/\n/*             the following routines were originally in hget.c      */\n/*-------------------------------------------------------------------*/\n/*  HPUTI4 - Set int keyword = ival in FITS header string */\n\nstatic void\nhputi4 (hstring,keyword,ival)\n\n  char *hstring;\t/* character string containing FITS-style header\n\t\t\t   information in the format\n\t\t\t   <keyword>= <value> {/ <comment>}\n\t\t\t   each entry is padded with spaces to 80 characters */\n\n  char *keyword;\t\t/* character string containing the name of the variable\n\t\t\t   to be returned.  hput searches for a line beginning\n\t\t\t   with this string, and if there isn't one, creates one.\n\t\t   \t   The first 8 characters of keyword must be unique. */\n  int ival;\t\t/* int number */\n{\n    char value[30];\n\n    /* Translate value from binary to ASCII */\n    snprintf (value,30,\"%d\",ival);\n\n    /* Put value into header string */\n    hputc (hstring,keyword,value);\n\n    /* Return to calling program */\n    return;\n}\n\n/*-------------------------------------------------------------------*/\n\n/*  HPUTL - Set keyword = F if lval=0, else T, in FITS header string */\n\nstatic void\nhputl (hstring, keyword,lval)\n\nchar *hstring;\t\t/* FITS header */\nchar *keyword;\t\t/* Keyword name */\nint lval;\t\t/* logical variable (0=false, else true) */\n{\n    char value[8];\n\n    /* Translate value from binary to ASCII */\n    if (lval)\n\tstrcpy (value, \"T\");\n    else\n\tstrcpy (value, \"F\");\n\n    /* Put value into header string */\n    hputc (hstring,keyword,value);\n\n    /* Return to calling program */\n    return;\n}\n\n/*-------------------------------------------------------------------*/\n\n/*  HPUTS - Set character string keyword = 'cval' in FITS header string */\n\nstatic void\nhputs (hstring,keyword,cval)\n\nchar *hstring;\t/* FITS header */\nchar *keyword;\t/* Keyword name */\nchar *cval;\t/* character string containing the value for variable\n\t\t   keyword.  trailing and leading blanks are removed.  */\n{\n    char squot = 39;\n    char value[70];\n    int lcval;\n\n    /*  find length of variable string */\n\n    lcval = strlen (cval);\n    if (lcval > 67)\n\tlcval = 67;\n\n    /* Put quotes around string */\n    value[0] = squot;\n    strncpy (&value[1],cval,lcval);\n    value[lcval+1] = squot;\n    value[lcval+2] = 0;\n\n    /* Put value into header string */\n    hputc (hstring,keyword,value);\n\n    /* Return to calling program */\n    return;\n}\n\n/*---------------------------------------------------------------------*/\n/*  HPUTC - Set character string keyword = value in FITS header string */\n\nstatic void\nhputc (hstring,keyword,value)\n\nchar *hstring;\nchar *keyword;\nchar *value;\t/* character string containing the value for variable\n\t\t   keyword.  trailing and leading blanks are removed.  */\n{\n    char squot = 39;\n    char line[100];\n    char newcom[50];\n    char blank[80];\n    char *v, *vp, *v1, *v2, *q1, *q2, *c1, *ve;\n    int lkeyword, lcom, lval, lc, i;\n\n    for (i = 0; i < 80; i++)\n\tblank[i] = ' ';\n\n    /*  find length of keyword and value */\n    lkeyword = strlen (keyword);\n    lval = strlen (value);\n\n    /*  If COMMENT or HISTORY, always add it just before the END */\n    if (lkeyword == 7 && (strncmp (keyword,\"COMMENT\",7) == 0 ||\n\tstrncmp (keyword,\"HISTORY\",7) == 0)) {\n\n\t/* Find end of header */\n\tv1 = ksearch (hstring,\"END\");\n\tv2 = v1 + 80;\n\n\t/* Move END down one line */\n\tstrncpy (v2, v1, 80);\n\n\t/* Insert keyword */\n\tstrncpy (v1,keyword,7);\n\n\t/* Pad with spaces */\n\tfor (vp = v1+lkeyword; vp < v2; vp++)\n\t    *vp = ' ';\n\n\t/* Insert comment */\n\tstrncpy (v1+9,value,lval);\n\treturn;\n\t}\n\n    /* Otherwise search for keyword */\n    else\n\tv1 = ksearch (hstring,keyword);\n\n    /*  If parameter is not found, find a place to put it */\n    if (v1 == NULL) {\n\t\n\t/* First look for blank lines before END */\n        v1 = blsearch (hstring, \"END\");\n    \n\t/*  Otherwise, create a space for it at the end of the header */\n\tif (v1 == NULL) {\n\t    ve = ksearch (hstring,\"END\");\n\t    v1 = ve;\n\t    v2 = v1 + 80;\n\t    strncpy (v2, ve, 80);\n\t    }\n\telse\n\t    v2 = v1 + 80;\n\tlcom = 0;\n\tnewcom[0] = 0;\n\t}\n\n    /*  Otherwise, extract the entry for this keyword from the header */\n    else {\n\tstrncpy (line, v1, 80);\n\tline[80] = 0;\n\tv2 = v1 + 80;\n\n\t/*  check for quoted value */\n\tq1 = strchr (line, squot);\n\tif (q1 != NULL)\n\t    q2 = strchr (q1+1,squot);\n\telse\n\t    q2 = line;\n\n\t/*  extract comment and remove trailing spaces */\n\n\tc1 = strchr (q2,'/');\n\tif (c1 != NULL) {\n\t    lcom = 80 - (c1 - line);\n\t    strncpy (newcom, c1+1, lcom);\n\t    vp = newcom + lcom - 1;\n\t    while (vp-- > newcom && *vp == ' ')\n\t\t*vp = 0;\n\t    lcom = strlen (newcom);\n\t    }\n\telse {\n\t    newcom[0] = 0;\n\t    lcom = 0;\n\t    }\n\t}\n\n    /* Fill new entry with spaces */\n    for (vp = v1; vp < v2; vp++)\n\t*vp = ' ';\n\n    /*  Copy keyword to new entry */\n    strncpy (v1, keyword, lkeyword);\n\n    /*  Add parameter value in the appropriate place */\n    vp = v1 + 8;\n    *vp = '=';\n    vp = v1 + 9;\n    *vp = ' ';\n    vp = vp + 1;\n    if (*value == squot) {\n\tstrncpy (vp, value, lval);\n\tif (lval+12 > 31)\n\t    lc = lval + 12;\n\telse\n\t    lc = 30;\n\t}\n    else {\n\tvp = v1 + 30 - lval;\n\tstrncpy (vp, value, lval);\n\tlc = 30;\n\t}\n\n    /* Add comment in the appropriate place */\n\tif (lcom > 0) {\n\t    if (lc+2+lcom > 80)\n\t\tlcom = 78 - lc;\n\t    vp = v1 + lc + 2;     /* Jul 16 1997: was vp = v1 + lc * 2 */\n\t    *vp = '/';\n\t    vp = vp + 1;\n\t    strncpy (vp, newcom, lcom);\n\t    for (v = vp + lcom; v < v2; v++)\n\t\t*v = ' ';\n\t    }\n\n\treturn;\n}\n\n/*-------------------------------------------------------------------*/\n/*  HPUTCOM - Set comment for keyword or on line in FITS header string */\n\nstatic void\nhputcom (hstring,keyword,comment)\n\n  char *hstring;\n  char *keyword;\n  char *comment;\n{\n\tchar squot;\n\tchar line[100];\n\tint lkeyword, lcom;\n\tchar *vp, *v1, *v2, *c0 = NULL, *c1, *q1, *q2;\n\n\tsquot = 39;\n\n/*  Find length of variable name */\n\tlkeyword = strlen (keyword);\n\n/*  If COMMENT or HISTORY, always add it just before the END */\n\tif (lkeyword == 7 && (strncmp (keyword,\"COMMENT\",7) == 0 ||\n\t    strncmp (keyword,\"HISTORY\",7) == 0)) {\n\n\t/* Find end of header */\n\t    v1 = ksearch (hstring,\"END\");\n\t    v2 = v1 + 80;\n\t    strncpy (v2, v1, 80);\n\n\t/*  blank out new line and insert keyword */\n\t    for (vp = v1; vp < v2; vp++)\n\t\t*vp = ' ';\n\t    strncpy (v1, keyword, lkeyword);\n\t    }\n\n/* search header string for variable name */\n\telse {\n\t    v1 = ksearch (hstring,keyword);\n\t    v2 = v1 + 80;\n\n\t/* if parameter is not found, return without doing anything */\n\t    if (v1 == NULL) {\n\t\treturn;\n\t\t}\n\n\t/* otherwise, extract entry for this variable from the header */\n\t    strncpy (line, v1, 80);\n\n\t/* check for quoted value */\n\t    q1 = strchr (line,squot);\n\t    if (q1 != NULL)\n\t\tq2 = strchr (q1+1,squot);\n\t    else\n\t\tq2 = NULL;\n\n\t    if (q2 == NULL || q2-line < 31)\n\t\tc0 = v1 + 31;\n\t    else\n\t\tc0 = v1 + (q2-line) + 2; /* allan: 1997-09-30, was c0=q2+2 */\n\n\t    strncpy (c0, \"/ \",2);\n\t    }\n\n/* create new entry */\n\tlcom = strlen (comment);\n\n\tif (lcom > 0) {\n\t    c1 = c0 + 2;\n\t    if (c1+lcom > v2)\n\t\tlcom = v2 - c1;\n\t    strncpy (c1, comment, lcom);\n\t    }\n\n}\n"},{"id":16671,"name":"editcol.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, editcol.c, contains the set of FITSIO routines that    */\n/*  insert or delete rows or columns in a table or resize an image    */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <string.h>\n#include <ctype.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n/*--------------------------------------------------------------------------*/\nint ffrsim(fitsfile *fptr,      /* I - FITS file pointer           */\n           int bitpix,          /* I - bits per pixel              */\n           int naxis,           /* I - number of axes in the array */\n           long *naxes,         /* I - size of each axis           */\n           int *status)         /* IO - error status               */\n/*\n   resize an existing primary array or IMAGE extension.\n*/\n{\n    LONGLONG tnaxes[99];\n    int ii;\n    \n    if (*status > 0)\n        return(*status);\n\n    for (ii = 0; (ii < naxis) && (ii < 99); ii++)\n        tnaxes[ii] = naxes[ii];\n\n    ffrsimll(fptr, bitpix, naxis, tnaxes, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffrsimll(fitsfile *fptr,    /* I - FITS file pointer           */\n           int bitpix,          /* I - bits per pixel              */\n           int naxis,           /* I - number of axes in the array */\n           LONGLONG *naxes,     /* I - size of each axis           */\n           int *status)         /* IO - error status               */\n/*\n   resize an existing primary array or IMAGE extension.\n*/\n{\n    int ii, simple, obitpix, onaxis, extend, nmodify;\n    long  nblocks, longval;\n    long pcount, gcount, longbitpix;\n    LONGLONG onaxes[99], newsize, oldsize;\n    char comment[FLEN_COMMENT], keyname[FLEN_KEYWORD], message[FLEN_ERRMSG];\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n         /* rescan header if data structure is undefined */\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n    /* get current image size parameters */\n    if (ffghprll(fptr, 99, &simple, &obitpix, &onaxis, onaxes, &pcount,\n               &gcount, &extend, status) > 0)\n        return(*status);\n\n    longbitpix = bitpix;\n\n    /* test for the 2 special cases that represent unsigned integers */\n    if (longbitpix == USHORT_IMG)\n        longbitpix = SHORT_IMG;\n    else if (longbitpix == ULONG_IMG)\n        longbitpix = LONG_IMG;\n\n    /* test that the new values are legal */\n\n    if (longbitpix != BYTE_IMG && longbitpix != SHORT_IMG && \n        longbitpix != LONG_IMG && longbitpix != LONGLONG_IMG &&\n        longbitpix != FLOAT_IMG && longbitpix != DOUBLE_IMG)\n    {\n        snprintf(message, FLEN_ERRMSG,\n        \"Illegal value for BITPIX keyword: %d\", bitpix);\n        ffpmsg(message);\n        return(*status = BAD_BITPIX);\n    }\n\n    if (naxis < 0 || naxis > 999)\n    {\n        snprintf(message, FLEN_ERRMSG,\n        \"Illegal value for NAXIS keyword: %d\", naxis);\n        ffpmsg(message);\n        return(*status = BAD_NAXIS);\n    }\n\n    if (naxis == 0)\n        newsize = 0;\n    else\n        newsize = 1;\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n        if (naxes[ii] < 0)\n        {\n            snprintf(message, FLEN_ERRMSG,\n            \"Illegal value for NAXIS%d keyword: %.0f\", ii + 1,  (double) (naxes[ii]));\n            ffpmsg(message);\n            return(*status = BAD_NAXES);\n        }\n\n        newsize *= naxes[ii];  /* compute new image size, in pixels */\n    }\n\n    /* compute size of old image, in bytes */\n\n    if (onaxis == 0)\n        oldsize = 0;\n    else\n    {\n        oldsize = 1;\n        for (ii = 0; ii < onaxis; ii++)\n            oldsize *= onaxes[ii];  \n        oldsize = (oldsize + pcount) * gcount * (abs(obitpix) / 8);\n    }\n\n    oldsize = (oldsize + 2879) / 2880; /* old size, in blocks */\n\n    newsize = (newsize + pcount) * gcount * (abs(longbitpix) / 8);\n    newsize = (newsize + 2879) / 2880; /* new size, in blocks */\n\n    if (newsize > oldsize)   /* have to insert new blocks for image */\n    {\n        nblocks = (long) (newsize - oldsize);\n        if (ffiblk(fptr, nblocks, 1, status) > 0)  \n            return(*status);\n    }\n    else if (oldsize > newsize)  /* have to delete blocks from image */\n    {\n        nblocks = (long) (oldsize - newsize);\n        if (ffdblk(fptr, nblocks, status) > 0)  \n            return(*status);\n    }\n\n    /* now update the header keywords */\n\n    strcpy(comment,\"&\");  /* special value to leave comments unchanged */\n\n    if (longbitpix != obitpix)\n    {                         /* update BITPIX value */\n        ffmkyj(fptr, \"BITPIX\", longbitpix, comment, status);\n    }\n\n    if (naxis != onaxis)\n    {                        /* update NAXIS value */\n        longval = naxis;\n        ffmkyj(fptr, \"NAXIS\", longval, comment, status);\n    }\n\n    /* modify the existing NAXISn keywords */\n    nmodify = minvalue(naxis, onaxis); \n    for (ii = 0; ii < nmodify; ii++)\n    {\n        ffkeyn(\"NAXIS\", ii+1, keyname, status);\n        ffmkyj(fptr, keyname, naxes[ii], comment, status);\n    }\n\n    if (naxis > onaxis)  /* insert additional NAXISn keywords */\n    {\n        strcpy(comment,\"length of data axis\");  \n        for (ii = onaxis; ii < naxis; ii++)\n        {\n            ffkeyn(\"NAXIS\", ii+1, keyname, status);\n            ffikyj(fptr, keyname, naxes[ii], comment, status);\n        }\n    }\n    else if (onaxis > naxis) /* delete old NAXISn keywords */\n    {\n        for (ii = naxis; ii < onaxis; ii++)\n        {\n            ffkeyn(\"NAXIS\", ii+1, keyname, status);\n            ffdkey(fptr, keyname, status);\n        }\n    }\n\n    /* Update the BSCALE and BZERO keywords, if an unsigned integer image */\n    if (bitpix == USHORT_IMG)\n    {\n        strcpy(comment, \"offset data range to that of unsigned short\");\n        ffukyg(fptr, \"BZERO\", 32768., 0, comment, status);\n        strcpy(comment, \"default scaling factor\");\n        ffukyg(fptr, \"BSCALE\", 1.0, 0, comment, status);\n    }\n    else if (bitpix == ULONG_IMG)\n    {\n        strcpy(comment, \"offset data range to that of unsigned long\");\n        ffukyg(fptr, \"BZERO\", 2147483648., 0, comment, status);\n        strcpy(comment, \"default scaling factor\");\n        ffukyg(fptr, \"BSCALE\", 1.0, 0, comment, status);\n    }\n\n    /* re-read the header, to make sure structures are updated */\n    ffrdef(fptr, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffirow(fitsfile *fptr,  /* I - FITS file pointer                        */\n           LONGLONG firstrow,   /* I - insert space AFTER this row              */\n                            /*     0 = insert space at beginning of table   */\n           LONGLONG nrows,      /* I - number of rows to insert                 */\n           int *status)     /* IO - error status                            */\n/*\n insert NROWS blank rows immediated after row firstrow (1 = first row).\n Set firstrow = 0 to insert space at the beginning of the table.\n*/\n{\n    int tstatus;\n    LONGLONG naxis1, naxis2;\n    LONGLONG datasize, firstbyte, nshift, nbytes;\n    LONGLONG freespace;\n    long nblock;\n\n    if (*status > 0)\n        return(*status);\n\n        /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n         /* rescan header if data structure is undefined */\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n    if ((fptr->Fptr)->hdutype == IMAGE_HDU)\n    {\n        ffpmsg(\"Can only add rows to TABLE or BINTABLE extension (ffirow)\");\n        return(*status = NOT_TABLE);\n    }\n\n    if (nrows < 0 )\n        return(*status = NEG_BYTES);\n    else if (nrows == 0)\n        return(*status);   /* no op, so just return */\n\n    /* get the current size of the table */\n    /* use internal structure since NAXIS2 keyword may not be up to date */\n    naxis1 = (fptr->Fptr)->rowlength;\n    naxis2 = (fptr->Fptr)->numrows;\n\n    if (firstrow > naxis2)\n    {\n        ffpmsg(\n   \"Insert position greater than the number of rows in the table (ffirow)\");\n        return(*status = BAD_ROW_NUM);\n    }\n    else if (firstrow < 0)\n    {\n        ffpmsg(\"Insert position is less than 0 (ffirow)\");\n        return(*status = BAD_ROW_NUM);\n    }\n\n    /* current data size */\n    datasize = (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize;\n    freespace = ( ( (datasize + 2879) / 2880) * 2880) - datasize;\n    nshift = naxis1 * nrows;          /* no. of bytes to add to table */\n\n    if ( (freespace - nshift) < 0)   /* not enough existing space? */\n    {\n        nblock = (long) ((nshift - freespace + 2879) / 2880);   /* number of blocks */\n        ffiblk(fptr, nblock, 1, status);               /* insert the blocks */\n    }\n\n    firstbyte = naxis1 * firstrow;    /* relative insert position */\n    nbytes = datasize - firstbyte;           /* no. of bytes to shift down */\n    firstbyte += ((fptr->Fptr)->datastart);  /* absolute insert position */\n\n    ffshft(fptr, firstbyte, nbytes, nshift, status); /* shift rows and heap */\n\n    /* update the heap starting address */\n    (fptr->Fptr)->heapstart += nshift;\n\n    /* update the THEAP keyword if it exists */\n    tstatus = 0;\n    ffmkyj(fptr, \"THEAP\", (fptr->Fptr)->heapstart, \"&\", &tstatus);\n\n    /* update the NAXIS2 keyword */\n    ffmkyj(fptr, \"NAXIS2\", naxis2 + nrows, \"&\", status);\n    ((fptr->Fptr)->numrows) += nrows;\n    ((fptr->Fptr)->origrows) += nrows;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffdrow(fitsfile *fptr,  /* I - FITS file pointer                        */\n           LONGLONG firstrow,   /* I - first row to delete (1 = first)          */\n           LONGLONG nrows,      /* I - number of rows to delete                 */\n           int *status)     /* IO - error status                            */\n/*\n delete NROWS rows from table starting with firstrow (1 = first row of table).\n*/\n{\n    int tstatus;\n    LONGLONG naxis1, naxis2;\n    LONGLONG datasize, firstbyte, nbytes, nshift;\n    LONGLONG freespace;\n    long nblock;\n    char comm[FLEN_COMMENT];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n        /* rescan header if data structure is undefined */\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n    if ((fptr->Fptr)->hdutype == IMAGE_HDU)\n    {\n        ffpmsg(\"Can only delete rows in TABLE or BINTABLE extension (ffdrow)\");\n        return(*status = NOT_TABLE);\n    }\n\n    if (nrows < 0 )\n        return(*status = NEG_BYTES);\n    else if (nrows == 0)\n        return(*status);   /* no op, so just return */\n\n    ffgkyjj(fptr, \"NAXIS1\", &naxis1, comm, status); /* get the current   */\n\n   /* ffgkyj(fptr, \"NAXIS2\", &naxis2, comm, status);*/ /* size of the table */\n\n    /* the NAXIS2 keyword may not be up to date, so use the structure value */\n    naxis2 = (fptr->Fptr)->numrows;\n\n    if (firstrow > naxis2)\n    {\n        ffpmsg(\n   \"Delete position greater than the number of rows in the table (ffdrow)\");\n        return(*status = BAD_ROW_NUM);\n    }\n    else if (firstrow < 1)\n    {\n        ffpmsg(\"Delete position is less than 1 (ffdrow)\");\n        return(*status = BAD_ROW_NUM);\n    }\n    else if (firstrow + nrows - 1 > naxis2)\n    {\n        ffpmsg(\"No. of rows to delete exceeds size of table (ffdrow)\");\n        return(*status = BAD_ROW_NUM);\n    }\n\n    nshift = naxis1 * nrows;   /* no. of bytes to delete from table */\n    /* cur size of data */\n    datasize = (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize;\n\n    firstbyte = naxis1 * (firstrow + nrows - 1); /* relative del pos */\n    nbytes = datasize - firstbyte;    /* no. of bytes to shift up */\n    firstbyte += ((fptr->Fptr)->datastart);   /* absolute delete position */\n\n    ffshft(fptr, firstbyte, nbytes,  nshift * (-1), status); /* shift data */\n\n    freespace = ( ( (datasize + 2879) / 2880) * 2880) - datasize;\n    nblock = (long) ((nshift + freespace) / 2880);   /* number of blocks */\n\n    /* delete integral number blocks */\n    if (nblock > 0) \n        ffdblk(fptr, nblock, status);\n\n    /* update the heap starting address */\n    (fptr->Fptr)->heapstart -= nshift;\n\n    /* update the THEAP keyword if it exists */\n    tstatus = 0;\n    ffmkyj(fptr, \"THEAP\", (long)(fptr->Fptr)->heapstart, \"&\", &tstatus);\n\n    /* update the NAXIS2 keyword */\n    ffmkyj(fptr, \"NAXIS2\", naxis2 - nrows, \"&\", status);\n    ((fptr->Fptr)->numrows) -= nrows;\n    ((fptr->Fptr)->origrows) -= nrows;\n\n    /* Update the heap data, if any.  This will remove any orphaned data */\n    /* that was only pointed to by the rows that have been deleted */\n    ffcmph(fptr, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffdrrg(fitsfile *fptr,  /* I - FITS file pointer to table               */\n           char *ranges,    /* I - ranges of rows to delete (1 = first)     */\n           int *status)     /* IO - error status                            */\n/*\n delete the ranges of rows from the table (1 = first row of table).\n\nThe 'ranges' parameter typically looks like:\n    '10-20, 30 - 40, 55' or '50-'\nand gives a list of rows or row ranges separated by commas.\n*/\n{\n    char *cptr;\n    int nranges, nranges2, ii;\n    long *minrow, *maxrow, nrows, *rowarray, jj, kk;\n    LONGLONG naxis2;\n    \n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n        /* rescan header if data structure is undefined */\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n    if ((fptr->Fptr)->hdutype == IMAGE_HDU)\n    {\n        ffpmsg(\"Can only delete rows in TABLE or BINTABLE extension (ffdrrg)\");\n        return(*status = NOT_TABLE);\n    }\n\n    /* the NAXIS2 keyword may not be up to date, so use the structure value */\n    naxis2 = (fptr->Fptr)->numrows;\n\n    /* find how many ranges were specified ( = no. of commas in string + 1) */\n    cptr = ranges;\n    for (nranges = 1; (cptr = strchr(cptr, ',')); nranges++)\n        cptr++;\n \n    minrow = calloc(nranges, sizeof(long));\n    maxrow = calloc(nranges, sizeof(long));\n\n    if (!minrow || !maxrow) {\n        *status = MEMORY_ALLOCATION;\n        ffpmsg(\"failed to allocate memory for row ranges (ffdrrg)\");\n        if (maxrow) free(maxrow);\n        if (minrow) free(minrow);\n        return(*status);\n    }\n\n    /* parse range list into array of range min and max values */\n    ffrwrg(ranges, naxis2, nranges, &nranges2, minrow, maxrow, status);\n    if (*status > 0 || nranges2 == 0) {\n        free(maxrow);\n        free(minrow);\n        return(*status);\n    }\n\n    /* determine total number or rows to delete */\n    nrows = 0;\n    for (ii = 0; ii < nranges2; ii++) {\n       nrows = nrows + maxrow[ii] - minrow[ii] + 1;\n    }\n\n    rowarray = calloc(nrows, sizeof(long));\n    if (!rowarray) {\n        *status = MEMORY_ALLOCATION;\n        ffpmsg(\"failed to allocate memory for row array (ffdrrg)\");\n        return(*status);\n    }\n\n    for (kk = 0, ii = 0; ii < nranges2; ii++) {\n       for (jj = minrow[ii]; jj <= maxrow[ii]; jj++) {\n           rowarray[kk] = jj;\n           kk++;\n       }\n    }\n\n    /* delete the rows */\n    ffdrws(fptr, rowarray, nrows, status);\n    \n    free(rowarray);\n    free(maxrow);\n    free(minrow);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffdrws(fitsfile *fptr,  /* I - FITS file pointer                        */\n           long *rownum,    /* I - list of rows to delete (1 = first)       */\n           long nrows,      /* I - number of rows to delete                 */\n           int *status)     /* IO - error status                            */\n/*\n delete the list of rows from the table (1 = first row of table).\n*/\n{\n    LONGLONG naxis1, naxis2, insertpos, nextrowpos;\n    long ii, nextrow;\n    char comm[FLEN_COMMENT];\n    unsigned char *buffer;\n\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    /* rescan header if data structure is undefined */\n    if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n    if ((fptr->Fptr)->hdutype == IMAGE_HDU)\n    {\n        ffpmsg(\"Can only delete rows in TABLE or BINTABLE extension (ffdrws)\");\n        return(*status = NOT_TABLE);\n    }\n\n    if (nrows < 0 )\n        return(*status = NEG_BYTES);\n    else if (nrows == 0)\n        return(*status);   /* no op, so just return */\n\n    ffgkyjj(fptr, \"NAXIS1\", &naxis1, comm, status); /* row width   */\n    ffgkyjj(fptr, \"NAXIS2\", &naxis2, comm, status); /* number of rows */\n\n    /* check that input row list is in ascending order */\n    for (ii = 1; ii < nrows; ii++)\n    {\n        if (rownum[ii - 1] >= rownum[ii])\n        {\n            ffpmsg(\"row numbers are not in increasing order (ffdrws)\");\n            return(*status = BAD_ROW_NUM);\n        }\n    }\n\n    if (rownum[0] < 1)\n    {\n        ffpmsg(\"first row to delete is less than 1 (ffdrws)\");\n        return(*status = BAD_ROW_NUM);\n    }\n    else if (rownum[nrows - 1] > naxis2)\n    {\n        ffpmsg(\"last row to delete exceeds size of table (ffdrws)\");\n        return(*status = BAD_ROW_NUM);\n    }\n\n    buffer = (unsigned char *) malloc( (size_t) naxis1);  /* buffer for one row */\n\n    if (!buffer)\n    {\n        ffpmsg(\"malloc failed (ffdrws)\");\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    /* byte location to start of first row to delete, and the next row */\n    insertpos = (fptr->Fptr)->datastart + ((rownum[0] - 1) * naxis1);\n    nextrowpos = insertpos + naxis1;\n    nextrow = rownum[0] + 1;\n\n    /* work through the list of rows to delete */\n    for (ii = 1; ii < nrows; nextrow++, nextrowpos += naxis1)\n    {\n        if (nextrow < rownum[ii])  \n        {   /* keep this row, so copy it to the new position */\n\n            ffmbyt(fptr, nextrowpos, REPORT_EOF, status);\n            ffgbyt(fptr, naxis1, buffer, status);  /* read the bytes */\n\n            ffmbyt(fptr, insertpos, IGNORE_EOF, status);\n            ffpbyt(fptr, naxis1, buffer, status);  /* write the bytes */\n\n            if (*status > 0)\n            {\n                ffpmsg(\"error while copying good rows in table (ffdrws)\");\n                free(buffer);\n                return(*status);\n            }\n            insertpos += naxis1;\n        }\n        else\n        {   /* skip over this row since it is in the list */\n            ii++;\n        }\n    }\n\n    /* finished with all the rows to delete; copy remaining rows */\n    while(nextrow <= naxis2)\n    {\n        ffmbyt(fptr, nextrowpos, REPORT_EOF, status);\n        ffgbyt(fptr, naxis1, buffer, status);  /* read the bytes */\n\n        ffmbyt(fptr, insertpos, IGNORE_EOF, status);\n        ffpbyt(fptr, naxis1, buffer, status);  /* write the bytes */\n\n        if (*status > 0)\n        {\n            ffpmsg(\"failed to copy remaining rows in table (ffdrws)\");\n            free(buffer);\n            return(*status);\n        }\n        insertpos  += naxis1;\n        nextrowpos += naxis1;\n        nextrow++; \n    }\n    free(buffer);\n    \n    /* now delete the empty rows at the end of the table */\n    ffdrow(fptr, naxis2 - nrows + 1, nrows, status);\n\n    /* Update the heap data, if any.  This will remove any orphaned data */\n    /* that was only pointed to by the rows that have been deleted */\n    ffcmph(fptr, status);\n    \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffdrwsll(fitsfile *fptr, /* I - FITS file pointer                        */\n           LONGLONG *rownum, /* I - list of rows to delete (1 = first)       */\n           LONGLONG nrows,  /* I - number of rows to delete                 */\n           int *status)     /* IO - error status                            */\n/*\n delete the list of rows from the table (1 = first row of table).\n*/\n{\n    LONGLONG insertpos, nextrowpos;\n    LONGLONG naxis1, naxis2, ii, nextrow;\n    char comm[FLEN_COMMENT];\n    unsigned char *buffer;\n\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    /* rescan header if data structure is undefined */\n    if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n    if ((fptr->Fptr)->hdutype == IMAGE_HDU)\n    {\n        ffpmsg(\"Can only delete rows in TABLE or BINTABLE extension (ffdrws)\");\n        return(*status = NOT_TABLE);\n    }\n\n    if (nrows < 0 )\n        return(*status = NEG_BYTES);\n    else if (nrows == 0)\n        return(*status);   /* no op, so just return */\n\n    ffgkyjj(fptr, \"NAXIS1\", &naxis1, comm, status); /* row width   */\n    ffgkyjj(fptr, \"NAXIS2\", &naxis2, comm, status); /* number of rows */\n\n    /* check that input row list is in ascending order */\n    for (ii = 1; ii < nrows; ii++)\n    {\n        if (rownum[ii - 1] >= rownum[ii])\n        {\n            ffpmsg(\"row numbers are not in increasing order (ffdrws)\");\n            return(*status = BAD_ROW_NUM);\n        }\n    }\n\n    if (rownum[0] < 1)\n    {\n        ffpmsg(\"first row to delete is less than 1 (ffdrws)\");\n        return(*status = BAD_ROW_NUM);\n    }\n    else if (rownum[nrows - 1] > naxis2)\n    {\n        ffpmsg(\"last row to delete exceeds size of table (ffdrws)\");\n        return(*status = BAD_ROW_NUM);\n    }\n\n    buffer = (unsigned char *) malloc( (size_t) naxis1);  /* buffer for one row */\n\n    if (!buffer)\n    {\n        ffpmsg(\"malloc failed (ffdrwsll)\");\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    /* byte location to start of first row to delete, and the next row */\n    insertpos = (fptr->Fptr)->datastart + ((rownum[0] - 1) * naxis1);\n    nextrowpos = insertpos + naxis1;\n    nextrow = rownum[0] + 1;\n\n    /* work through the list of rows to delete */\n    for (ii = 1; ii < nrows; nextrow++, nextrowpos += naxis1)\n    {\n        if (nextrow < rownum[ii])  \n        {   /* keep this row, so copy it to the new position */\n\n            ffmbyt(fptr, nextrowpos, REPORT_EOF, status);\n            ffgbyt(fptr, naxis1, buffer, status);  /* read the bytes */\n\n            ffmbyt(fptr, insertpos, IGNORE_EOF, status);\n            ffpbyt(fptr, naxis1, buffer, status);  /* write the bytes */\n\n            if (*status > 0)\n            {\n                ffpmsg(\"error while copying good rows in table (ffdrws)\");\n                free(buffer);\n                return(*status);\n            }\n            insertpos += naxis1;\n        }\n        else\n        {   /* skip over this row since it is in the list */\n            ii++;\n        }\n    }\n\n    /* finished with all the rows to delete; copy remaining rows */\n    while(nextrow <= naxis2)\n    {\n        ffmbyt(fptr, nextrowpos, REPORT_EOF, status);\n        ffgbyt(fptr, naxis1, buffer, status);  /* read the bytes */\n\n        ffmbyt(fptr, insertpos, IGNORE_EOF, status);\n        ffpbyt(fptr, naxis1, buffer, status);  /* write the bytes */\n\n        if (*status > 0)\n        {\n            ffpmsg(\"failed to copy remaining rows in table (ffdrws)\");\n            free(buffer);\n            return(*status);\n        }\n        insertpos  += naxis1;\n        nextrowpos += naxis1;\n        nextrow++; \n    }\n    free(buffer);\n    \n    /* now delete the empty rows at the end of the table */\n    ffdrow(fptr, naxis2 - nrows + 1, nrows, status);\n\n    /* Update the heap data, if any.  This will remove any orphaned data */\n    /* that was only pointed to by the rows that have been deleted */\n    ffcmph(fptr, status);\n    \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffrwrg(\n      char *rowlist,      /* I - list of rows and row ranges */\n      LONGLONG maxrows,       /* I - number of rows in the table */\n      int maxranges,     /* I - max number of ranges to be returned */\n      int *numranges,    /* O - number ranges returned */\n      long *minrow,       /* O - first row in each range */\n      long *maxrow,       /* O - last row in each range */\n      int *status)        /* IO - status value */\n{\n/*\n   parse the input list of row ranges, returning the number of ranges,\n   and the min and max row value in each range. \n\n   The only characters allowed in the input rowlist are \n       decimal digits, minus sign, and comma (and non-significant spaces) \n\n   Example:  \n\n     list = \"10-20, 30-35,50\"\n\n   would return numranges = 3, minrow[] = {10, 30, 50}, maxrow[] = {20, 35, 50}\n\n   error is returned if min value of range is > max value of range or if the\n   ranges are not monotonically increasing.\n*/\n    char *next;\n    long minval, maxval;\n\n    if (*status > 0)\n        return(*status);\n\n    if (maxrows <= 0 ) {\n        *status = RANGE_PARSE_ERROR;\n        ffpmsg(\"Input maximum range value is <= 0 (fits_parse_ranges)\");\n        return(*status);\n    }\n\n    next = rowlist;\n    *numranges = 0;\n\n    while (*next == ' ')next++;   /* skip spaces */\n   \n    while (*next != '\\0') {\n\n      /* find min value of next range; *next must be '-' or a digit */\n      if (*next == '-') {\n          minval = 1;    /* implied minrow value = 1 */\n      } else if ( isdigit((int) *next) ) {\n          minval = strtol(next, &next, 10);\n      } else {\n          *status = RANGE_PARSE_ERROR;\n          ffpmsg(\"Syntax error in this row range list:\");\n          ffpmsg(rowlist);\n          return(*status);\n      }\n\n      while (*next == ' ')next++;   /* skip spaces */\n\n      /* find max value of next range; *next must be '-', or ',' */\n      if (*next == '-') {\n          next++;\n          while (*next == ' ')next++;   /* skip spaces */\n\n          if ( isdigit((int) *next) ) {\n              maxval = strtol(next, &next, 10);\n          } else if (*next == ',' || *next == '\\0') {\n              maxval = (long) maxrows;  /* implied max value */\n          } else {\n              *status = RANGE_PARSE_ERROR;\n              ffpmsg(\"Syntax error in this row range list:\");\n              ffpmsg(rowlist);\n              return(*status);\n          }\n      } else if (*next == ',' || *next == '\\0') {\n          maxval = minval;  /* only a single integer in this range */\n      } else {\n          *status = RANGE_PARSE_ERROR;\n          ffpmsg(\"Syntax error in this row range list:\");\n          ffpmsg(rowlist);\n          return(*status);\n      }\n\n      if (*numranges + 1 > maxranges) {\n          *status = RANGE_PARSE_ERROR;\n          ffpmsg(\"Overflowed maximum number of ranges (fits_parse_ranges)\");\n          return(*status);\n      }\n\n      if (minval < 1 ) {\n          *status = RANGE_PARSE_ERROR;\n          ffpmsg(\"Syntax error in this row range list: row number < 1\");\n          ffpmsg(rowlist);\n          return(*status);\n      }\n\n      if (maxval < minval) {\n          *status = RANGE_PARSE_ERROR;\n          ffpmsg(\"Syntax error in this row range list: min > max\");\n          ffpmsg(rowlist);\n          return(*status);\n      }\n\n      if (*numranges > 0) {\n          if (minval <= maxrow[(*numranges) - 1]) {\n             *status = RANGE_PARSE_ERROR;\n             ffpmsg(\"Syntax error in this row range list.  Range minimum is\");\n             ffpmsg(\"  less than or equal to previous range maximum\");\n             ffpmsg(rowlist);\n             return(*status);\n         }\n      }\n\n      if (minval <= maxrows) {   /* ignore range if greater than maxrows */\n          if (maxval > maxrows)\n              maxval = (long) maxrows;\n\n           minrow[*numranges] = minval;\n           maxrow[*numranges] = maxval;\n\n           (*numranges)++;\n      }\n\n      while (*next == ' ')next++;   /* skip spaces */\n      if (*next == ',') {\n           next++;\n           while (*next == ' ')next++;   /* skip more spaces */\n      }\n    }\n\n    if (*numranges == 0) {  /* a null string was entered */\n         minrow[0] = 1;\n         maxrow[0] = (long) maxrows;\n         *numranges = 1;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffrwrgll(\n      char *rowlist,      /* I - list of rows and row ranges */\n      LONGLONG maxrows,       /* I - number of rows in the list */\n      int maxranges,     /* I - max number of ranges to be returned */\n      int *numranges,    /* O - number ranges returned */\n      LONGLONG *minrow,       /* O - first row in each range */\n      LONGLONG *maxrow,       /* O - last row in each range */\n      int *status)        /* IO - status value */\n{\n/*\n   parse the input list of row ranges, returning the number of ranges,\n   and the min and max row value in each range. \n\n   The only characters allowed in the input rowlist are \n       decimal digits, minus sign, and comma (and non-significant spaces) \n\n   Example:  \n\n     list = \"10-20, 30-35,50\"\n\n   would return numranges = 3, minrow[] = {10, 30, 50}, maxrow[] = {20, 35, 50}\n\n   error is returned if min value of range is > max value of range or if the\n   ranges are not monotonically increasing.\n*/\n    char *next;\n    LONGLONG minval, maxval;\n    double dvalue;\n\n    if (*status > 0)\n        return(*status);\n\n    if (maxrows <= 0 ) {\n        *status = RANGE_PARSE_ERROR;\n        ffpmsg(\"Input maximum range value is <= 0 (fits_parse_ranges)\");\n        return(*status);\n    }\n\n    next = rowlist;\n    *numranges = 0;\n\n    while (*next == ' ')next++;   /* skip spaces */\n   \n    while (*next != '\\0') {\n\n      /* find min value of next range; *next must be '-' or a digit */\n      if (*next == '-') {\n          minval = 1;    /* implied minrow value = 1 */\n      } else if ( isdigit((int) *next) ) {\n\n        /* read as a double, because the string to LONGLONG function */\n        /* is platform dependent (strtoll, strtol, _atoI64)          */\n\n          dvalue = strtod(next, &next);\n          minval = (LONGLONG) (dvalue + 0.1);\n\n      } else {\n          *status = RANGE_PARSE_ERROR;\n          ffpmsg(\"Syntax error in this row range list:\");\n          ffpmsg(rowlist);\n          return(*status);\n      }\n\n      while (*next == ' ')next++;   /* skip spaces */\n\n      /* find max value of next range; *next must be '-', or ',' */\n      if (*next == '-') {\n          next++;\n          while (*next == ' ')next++;   /* skip spaces */\n\n          if ( isdigit((int) *next) ) {\n\n            /* read as a double, because the string to LONGLONG function */\n            /* is platform dependent (strtoll, strtol, _atoI64)          */\n\n              dvalue = strtod(next, &next);\n              maxval = (LONGLONG) (dvalue + 0.1);\n\n          } else if (*next == ',' || *next == '\\0') {\n              maxval = maxrows;  /* implied max value */\n          } else {\n              *status = RANGE_PARSE_ERROR;\n              ffpmsg(\"Syntax error in this row range list:\");\n              ffpmsg(rowlist);\n              return(*status);\n          }\n      } else if (*next == ',' || *next == '\\0') {\n          maxval = minval;  /* only a single integer in this range */\n      } else {\n          *status = RANGE_PARSE_ERROR;\n          ffpmsg(\"Syntax error in this row range list:\");\n          ffpmsg(rowlist);\n          return(*status);\n      }\n\n      if (*numranges + 1 > maxranges) {\n          *status = RANGE_PARSE_ERROR;\n          ffpmsg(\"Overflowed maximum number of ranges (fits_parse_ranges)\");\n          return(*status);\n      }\n\n      if (minval < 1 ) {\n          *status = RANGE_PARSE_ERROR;\n          ffpmsg(\"Syntax error in this row range list: row number < 1\");\n          ffpmsg(rowlist);\n          return(*status);\n      }\n\n      if (maxval < minval) {\n          *status = RANGE_PARSE_ERROR;\n          ffpmsg(\"Syntax error in this row range list: min > max\");\n          ffpmsg(rowlist);\n          return(*status);\n      }\n\n      if (*numranges > 0) {\n          if (minval <= maxrow[(*numranges) - 1]) {\n             *status = RANGE_PARSE_ERROR;\n             ffpmsg(\"Syntax error in this row range list.  Range minimum is\");\n             ffpmsg(\"  less than or equal to previous range maximum\");\n             ffpmsg(rowlist);\n             return(*status);\n         }\n      }\n\n      if (minval <= maxrows) {   /* ignore range if greater than maxrows */\n          if (maxval > maxrows)\n              maxval = maxrows;\n\n           minrow[*numranges] = minval;\n           maxrow[*numranges] = maxval;\n\n           (*numranges)++;\n      }\n\n      while (*next == ' ')next++;   /* skip spaces */\n      if (*next == ',') {\n           next++;\n           while (*next == ' ')next++;   /* skip more spaces */\n      }\n    }\n\n    if (*numranges == 0) {  /* a null string was entered */\n         minrow[0] = 1;\n         maxrow[0] = maxrows;\n         *numranges = 1;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fficol(fitsfile *fptr,  /* I - FITS file pointer                        */\n           int numcol,      /* I - position for new col. (1 = 1st)          */\n           char *ttype,     /* I - name of column (TTYPE keyword)           */\n           char *tform,     /* I - format of column (TFORM keyword)         */\n           int *status)     /* IO - error status                            */\n/*\n Insert a new column into an existing table at position numcol.  If\n numcol is greater than the number of existing columns in the table\n then the new column will be appended as the last column in the table.\n*/\n{\n    char *name, *format;\n\n    name = ttype;\n    format = tform;\n\n    fficls(fptr, numcol, 1, &name, &format, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fficls(fitsfile *fptr,  /* I - FITS file pointer                        */\n           int fstcol,      /* I - position for first new col. (1 = 1st)    */\n           int ncols,       /* I - number of columns to insert              */\n           char **ttype,    /* I - array of column names(TTYPE keywords)    */\n           char **tform,    /* I - array of formats of column (TFORM)       */\n           int *status)     /* IO - error status                            */\n/*\n Insert 1 or more new columns into an existing table at position numcol.  If\n fstcol is greater than the number of existing columns in the table\n then the new column will be appended as the last column in the table.\n*/\n{\n    int colnum, datacode, decims, tfields, tstatus, ii;\n    LONGLONG datasize, firstbyte, nbytes, nadd, naxis1, naxis2, freespace;\n    LONGLONG tbcol, firstcol, delbyte;\n    long nblock, width, repeat;\n    char tfm[FLEN_VALUE], keyname[FLEN_KEYWORD], comm[FLEN_COMMENT], *cptr;\n    tcolumn *colptr;\n\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n        /* rescan header if data structure is undefined */\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n    if ((fptr->Fptr)->hdutype == IMAGE_HDU)\n    {\n       ffpmsg(\"Can only add columns to TABLE or BINTABLE extension (fficls)\");\n       return(*status = NOT_TABLE);\n    }\n\n    /*  is the column number valid?  */\n    tfields = (fptr->Fptr)->tfield;\n    if (fstcol < 1 )\n        return(*status = BAD_COL_NUM);\n    else if (fstcol > tfields)\n        colnum = tfields + 1;   /* append as last column */\n    else\n        colnum = fstcol;\n\n    /* parse the tform value and calc number of bytes to add to each row */\n    delbyte = 0;\n    for (ii = 0; ii < ncols; ii++)\n    {\n        if (strlen(tform[ii]) > FLEN_VALUE-1)\n        {\n           ffpmsg(\"Column format string too long (fficls)\");\n           return (*status=BAD_TFORM);\n        }\n        strcpy(tfm, tform[ii]);\n        ffupch(tfm);         /* make sure format is in upper case */\n\n        if ((fptr->Fptr)->hdutype == ASCII_TBL)\n        {\n            ffasfm(tfm, &datacode, &width, &decims, status);\n            delbyte += width + 1;  /*  add one space between the columns */\n        }\n        else\n        {\n            ffbnfm(tfm, &datacode, &repeat, &width, status);\n\n            if (datacode < 0)  {       /* variable length array column */\n\t        if (strchr(tfm, 'Q'))\n\t\t  delbyte += 16;\n\t\telse\n                  delbyte += 8;\n            } else if (datacode == 1)          /* bit column; round up  */\n                delbyte += (repeat + 7) / 8; /* to multiple of 8 bits */\n            else if (datacode == 16)  /* ASCII string column */\n                delbyte += repeat;\n            else                      /* numerical data type */\n                delbyte += (datacode / 10) * repeat;\n        }\n    }\n\n    if (*status > 0) \n        return(*status);\n\n    /* get the current size of the table */\n    /* use internal structure since NAXIS2 keyword may not be up to date */\n    naxis1 = (fptr->Fptr)->rowlength;\n    naxis2 = (fptr->Fptr)->numrows;\n\n    /* current size of data */\n    datasize = (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize;\n    freespace = ( ( (datasize + 2879) / 2880) * 2880) - datasize;\n    nadd = delbyte * naxis2;   /* no. of bytes to add to table */\n\n    if ( (freespace - nadd) < 0)   /* not enough existing space? */\n    {\n        nblock = (long) ((nadd - freespace + 2879) / 2880);     /* number of blocks  */\n        if (ffiblk(fptr, nblock, 1, status) > 0)       /* insert the blocks */\n            return(*status);\n    }\n\n    /* shift heap down (if it exists) */\n    if ((fptr->Fptr)->heapsize > 0)\n    {\n        nbytes = (fptr->Fptr)->heapsize;    /* no. of bytes to shift down */\n\n        /* absolute heap pos */\n        firstbyte = (fptr->Fptr)->datastart + (fptr->Fptr)->heapstart;\n\n        if (ffshft(fptr, firstbyte, nbytes, nadd, status) > 0) /* move heap */\n            return(*status);\n    }\n\n    /* update the heap starting address */\n    (fptr->Fptr)->heapstart += nadd;\n\n    /* update the THEAP keyword if it exists */\n    tstatus = 0;\n    ffmkyj(fptr, \"THEAP\", (fptr->Fptr)->heapstart, \"&\", &tstatus);\n\n    /* calculate byte position in the row where to insert the new column */\n    if (colnum > tfields)\n        firstcol = naxis1;\n    else\n    {\n        colptr = (fptr->Fptr)->tableptr;\n        colptr += (colnum - 1);\n        firstcol = colptr->tbcol;\n    }\n\n    /* insert delbyte bytes in every row, at byte position firstcol */\n    ffcins(fptr, naxis1, naxis2, delbyte, firstcol, status);\n\n    if ((fptr->Fptr)->hdutype == ASCII_TBL)\n    {\n        /* adjust the TBCOL values of the existing columns */\n        for(ii = 0; ii < tfields; ii++)\n        {\n            ffkeyn(\"TBCOL\", ii + 1, keyname, status);\n            ffgkyjj(fptr, keyname, &tbcol, comm, status);\n            if (tbcol > firstcol)\n            {\n                tbcol += delbyte;\n                ffmkyj(fptr, keyname, tbcol, \"&\", status);\n            }\n        }\n    }\n\n    /* update the mandatory keywords */\n    ffmkyj(fptr, \"TFIELDS\", tfields + ncols, \"&\", status);\n    ffmkyj(fptr, \"NAXIS1\", naxis1 + delbyte, \"&\", status);\n\n    /* increment the index value on any existing column keywords */\n    if(colnum <= tfields)\n        ffkshf(fptr, colnum, tfields, ncols, status);\n\n    /* add the required keywords for the new columns */\n    for (ii = 0; ii < ncols; ii++, colnum++)\n    {\n        strcpy(comm, \"label for field\");\n        ffkeyn(\"TTYPE\", colnum, keyname, status);\n        ffpkys(fptr, keyname, ttype[ii], comm, status);\n\n        strcpy(comm, \"format of field\");\n        strcpy(tfm, tform[ii]);\n        ffupch(tfm);         /* make sure format is in upper case */\n        ffkeyn(\"TFORM\", colnum, keyname, status);\n\n        if (abs(datacode) == TSBYTE) \n        {\n           /* Replace the 'S' with an 'B' in the TFORMn code */\n           cptr = tfm;\n           while (*cptr != 'S') \n              cptr++;\n\n           *cptr = 'B';\n           ffpkys(fptr, keyname, tfm, comm, status);\n\n           /* write the TZEROn and TSCALn keywords */\n           ffkeyn(\"TZERO\", colnum, keyname, status);\n           strcpy(comm, \"offset for signed bytes\");\n\n           ffpkyg(fptr, keyname, -128., 0, comm, status);\n\n           ffkeyn(\"TSCAL\", colnum, keyname, status);\n           strcpy(comm, \"data are not scaled\");\n           ffpkyg(fptr, keyname, 1., 0, comm, status);\n        }\n        else if (abs(datacode) == TUSHORT) \n        {\n           /* Replace the 'U' with an 'I' in the TFORMn code */\n           cptr = tfm;\n           while (*cptr != 'U') \n              cptr++;\n\n           *cptr = 'I';\n           ffpkys(fptr, keyname, tfm, comm, status);\n\n           /* write the TZEROn and TSCALn keywords */\n           ffkeyn(\"TZERO\", colnum, keyname, status);\n           strcpy(comm, \"offset for unsigned integers\");\n\n           ffpkyg(fptr, keyname, 32768., 0, comm, status);\n\n           ffkeyn(\"TSCAL\", colnum, keyname, status);\n           strcpy(comm, \"data are not scaled\");\n           ffpkyg(fptr, keyname, 1., 0, comm, status);\n        }\n        else if (abs(datacode) == TULONG) \n        {\n           /* Replace the 'V' with an 'J' in the TFORMn code */\n           cptr = tfm;\n           while (*cptr != 'V') \n              cptr++;\n\n           *cptr = 'J';\n           ffpkys(fptr, keyname, tfm, comm, status);\n\n           /* write the TZEROn and TSCALn keywords */\n           ffkeyn(\"TZERO\", colnum, keyname, status);\n           strcpy(comm, \"offset for unsigned integers\");\n\n           ffpkyg(fptr, keyname, 2147483648., 0, comm, status);\n\n           ffkeyn(\"TSCAL\", colnum, keyname, status);\n           strcpy(comm, \"data are not scaled\");\n           ffpkyg(fptr, keyname, 1., 0, comm, status);\n        }\n        else\n        {\n           ffpkys(fptr, keyname, tfm, comm, status);\n        }\n\n        if ((fptr->Fptr)->hdutype == ASCII_TBL)   /* write the TBCOL keyword */\n        {\n            if (colnum == tfields + 1)\n                tbcol = firstcol + 2;  /* allow space between preceding col */\n            else\n                tbcol = firstcol + 1;\n\n            strcpy(comm, \"beginning column of field\");\n            ffkeyn(\"TBCOL\", colnum, keyname, status);\n            ffpkyj(fptr, keyname, tbcol, comm, status);\n\n            /* increment the column starting position for the next column */\n            ffasfm(tfm, &datacode, &width, &decims, status);\n            firstcol += width + 1;  /*  add one space between the columns */\n        }\n    }\n    ffrdef(fptr, status); /* initialize the new table structure */\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmvec(fitsfile *fptr,  /* I - FITS file pointer                        */\n           int colnum,      /* I - position of col to be modified           */\n           LONGLONG newveclen,  /* I - new vector length of column (TFORM)       */\n           int *status)     /* IO - error status                            */\n/*\n  Modify the vector length of a column in a binary table, larger or smaller.\n  E.g., change a column from TFORMn = '1E' to '20E'.\n*/\n{\n    int datacode, tfields, tstatus;\n    LONGLONG datasize, size, firstbyte, nbytes, nadd, ndelete;\n    LONGLONG naxis1, naxis2, firstcol, freespace;\n    LONGLONG width, delbyte, repeat;\n    long nblock;\n    char tfm[FLEN_VALUE], keyname[FLEN_KEYWORD], tcode[2];\n    tcolumn *colptr;\n\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n        /* rescan header if data structure is undefined */\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n    if ((fptr->Fptr)->hdutype != BINARY_TBL)\n    {\n       ffpmsg(\n  \"Can only change vector length of a column in BINTABLE extension (ffmvec)\");\n       return(*status = NOT_TABLE);\n    }\n\n    /*  is the column number valid?  */\n    tfields = (fptr->Fptr)->tfield;\n    if (colnum < 1 || colnum > tfields)\n        return(*status = BAD_COL_NUM);\n\n    /* look up the current vector length and element width */\n\n    colptr = (fptr->Fptr)->tableptr;\n    colptr += (colnum - 1);\n\n    datacode = colptr->tdatatype; /* datatype of the column */\n    repeat =  colptr->trepeat;  /* field repeat count  */\n    width =  colptr->twidth;   /*  width of a single element in chars */\n\n    if (datacode < 0)\n    {\n        ffpmsg(\n        \"Can't modify vector length of variable length column (ffmvec)\");\n        return(*status = BAD_TFORM);\n    }\n\n    if (repeat == newveclen)\n        return(*status);  /* column already has the desired vector length */\n\n    if (datacode == TSTRING)\n        width = 1;      /* width was equal to width of unit string */\n\n    naxis1 =  (fptr->Fptr)->rowlength;   /* current width of the table */\n    naxis2 = (fptr->Fptr)->numrows;\n\n    delbyte = (newveclen - repeat) * width;    /* no. of bytes to insert */\n    if (datacode == TBIT)  /* BIT column is a special case */\n       delbyte = ((newveclen + 7) / 8) - ((repeat + 7) / 8);\n\n    if (delbyte > 0)  /* insert space for more elements */\n    {\n      /* current size of data */\n      datasize = (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize;\n      freespace = ( ( (datasize + 2879) / 2880) * 2880) - datasize;\n\n      nadd = (LONGLONG)delbyte * naxis2;   /* no. of bytes to add to table */\n\n      if ( (freespace - nadd) < 0)   /* not enough existing space? */\n      {\n        nblock = (long) ((nadd - freespace + 2879) / 2880);    /* number of blocks  */\n        if (ffiblk(fptr, nblock, 1, status) > 0)      /* insert the blocks */\n          return(*status);\n      }\n\n      /* shift heap down (if it exists) */\n      if ((fptr->Fptr)->heapsize > 0)\n      {\n        nbytes = (fptr->Fptr)->heapsize;    /* no. of bytes to shift down */\n\n        /* absolute heap pos */\n        firstbyte = (fptr->Fptr)->datastart + (fptr->Fptr)->heapstart;\n\n        if (ffshft(fptr, firstbyte, nbytes, nadd, status) > 0) /* move heap */\n            return(*status);\n      }\n\n      /* update the heap starting address */\n      (fptr->Fptr)->heapstart += nadd;\n\n      /* update the THEAP keyword if it exists */\n      tstatus = 0;\n      ffmkyj(fptr, \"THEAP\", (fptr->Fptr)->heapstart, \"&\", &tstatus);\n\n      /* Must reset colptr before using it again.  (fptr->Fptr)->tableptr\n         may have been reallocated down in ffbinit via the call to ffiblk above.*/\n      colptr = (fptr->Fptr)->tableptr;\n      colptr += (colnum - 1);\n\n      firstcol = colptr->tbcol + (repeat * width);  /* insert position */\n\n      /* insert delbyte bytes in every row, at byte position firstcol */\n      ffcins(fptr, naxis1, naxis2, delbyte, firstcol, status);\n    }\n    else if (delbyte < 0)\n    {\n      /* current size of table */\n      size = (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize;\n      freespace = ((size + 2879) / 2880) * 2880 - size - ((LONGLONG)delbyte * naxis2);\n      nblock = (long) (freespace / 2880);   /* number of empty blocks to delete */\n      firstcol = colptr->tbcol + (newveclen * width);  /* delete position */\n\n      /* delete elements from the vector */\n      ffcdel(fptr, naxis1, naxis2, -delbyte, firstcol, status);\n \n      /* abs heap pos */\n      firstbyte = (fptr->Fptr)->datastart + (fptr->Fptr)->heapstart;\n      ndelete = (LONGLONG)delbyte * naxis2; /* size of shift (negative) */\n\n      /* shift heap up (if it exists) */\n      if ((fptr->Fptr)->heapsize > 0)\n      {\n        nbytes = (fptr->Fptr)->heapsize;    /* no. of bytes to shift up */\n        if (ffshft(fptr, firstbyte, nbytes, ndelete, status) > 0)\n          return(*status);\n      }\n\n      /* delete the empty  blocks at the end of the HDU */\n      if (nblock > 0)\n        ffdblk(fptr, nblock, status);\n\n      /* update the heap starting address */\n      (fptr->Fptr)->heapstart += ndelete;  /* ndelete is negative */\n\n      /* update the THEAP keyword if it exists */\n      tstatus = 0;\n      ffmkyj(fptr, \"THEAP\", (fptr->Fptr)->heapstart, \"&\", &tstatus);\n    }\n\n    /* construct the new TFORM keyword for the column */\n    if (datacode == TBIT)\n      strcpy(tcode,\"X\");\n    else if (datacode == TBYTE)\n      strcpy(tcode,\"B\");\n    else if (datacode == TLOGICAL)\n      strcpy(tcode,\"L\");\n    else if (datacode == TSTRING)\n      strcpy(tcode,\"A\");\n    else if (datacode == TSHORT)\n      strcpy(tcode,\"I\");\n    else if (datacode == TLONG)\n      strcpy(tcode,\"J\");\n    else if (datacode == TLONGLONG)\n      strcpy(tcode,\"K\");\n    else if (datacode == TFLOAT)\n      strcpy(tcode,\"E\");\n    else if (datacode == TDOUBLE)\n      strcpy(tcode,\"D\");\n    else if (datacode == TCOMPLEX)\n      strcpy(tcode,\"C\");\n    else if (datacode == TDBLCOMPLEX)\n      strcpy(tcode,\"M\");\n\n    /* write as a double value because the LONGLONG conversion */\n    /* character in snprintf is platform dependent ( %lld, %ld, %I64d ) */\n\n    snprintf(tfm,FLEN_VALUE,\"%.0f%s\",(double) newveclen, tcode); \n\n    ffkeyn(\"TFORM\", colnum, keyname, status);  /* Keyword name */\n    ffmkys(fptr, keyname, tfm, \"&\", status);   /* modify TFORM keyword */\n\n    ffmkyj(fptr, \"NAXIS1\", naxis1 + delbyte, \"&\", status); /* modify NAXIS1 */\n\n    ffrdef(fptr, status); /* reinitialize the new table structure */\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffcpcl(fitsfile *infptr,    /* I - FITS file pointer to input file  */\n           fitsfile *outfptr,   /* I - FITS file pointer to output file */\n           int incol,           /* I - number of input column   */\n           int outcol,          /* I - number for output column  */\n           int create_col,      /* I - create new col if TRUE, else overwrite */\n           int *status)         /* IO - error status     */\n/*\n  copy a column from infptr and insert it in the outfptr table.\n*/\n{\n    int tstatus, colnum, typecode, otypecode, etypecode, anynull;\n    int inHduType, outHduType;\n    long tfields, repeat, orepeat, width, owidth, nrows, outrows;\n    long inloop, outloop, maxloop, ndone, ntodo, npixels;\n    long firstrow, firstelem, ii;\n    char keyname[FLEN_KEYWORD], ttype[FLEN_VALUE], tform[FLEN_VALUE];\n    char ttype_comm[FLEN_COMMENT],tform_comm[FLEN_COMMENT];\n    char *lvalues = 0, nullflag, **strarray = 0;\n    char nulstr[] = {'\\5', '\\0'};  /* unique null string value */\n    double dnull = 0.l, *dvalues = 0;\n    float fnull = 0., *fvalues = 0;\n    long long int *jjvalues = 0;\n    unsigned long long int *ujjvalues = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    if (infptr->HDUposition != (infptr->Fptr)->curhdu)\n    {\n        ffmahd(infptr, (infptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((infptr->Fptr)->datastart == DATA_UNDEFINED)\n        ffrdef(infptr, status);                /* rescan header */\n    inHduType = (infptr->Fptr)->hdutype;\n    \n    if (outfptr->HDUposition != (outfptr->Fptr)->curhdu)\n    {\n        ffmahd(outfptr, (outfptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((outfptr->Fptr)->datastart == DATA_UNDEFINED)\n        ffrdef(outfptr, status);               /* rescan header */\n    outHduType = (outfptr->Fptr)->hdutype;\n    \n    if (*status > 0)\n        return(*status);\n\n    if (inHduType == IMAGE_HDU || outHduType == IMAGE_HDU)\n    {\n       ffpmsg\n       (\"Can not copy columns to or from IMAGE HDUs (ffcpcl)\");\n       return(*status = NOT_TABLE);\n    }\n\n    if ( inHduType == BINARY_TBL &&  outHduType == ASCII_TBL)\n    {\n       ffpmsg\n       (\"Copying from Binary table to ASCII table is not supported (ffcpcl)\");\n       return(*status = NOT_BTABLE);\n    }\n\n    /* get the datatype and vector repeat length of the column */\n    ffgtcl(infptr, incol, &typecode, &repeat, &width, status);\n    /* ... and equivalent type code */\n    ffeqty(infptr, incol, &etypecode, 0,      0,      status);\n\n    if (typecode < 0)\n    {\n        ffpmsg(\"Variable-length columns are not supported (ffcpcl)\");\n        return(*status = BAD_TFORM);\n    }\n\n    if (create_col)    /* insert new column in output table? */\n    {\n        tstatus = 0;\n        ffkeyn(\"TTYPE\", incol, keyname, &tstatus);\n        ffgkys(infptr, keyname, ttype, ttype_comm, &tstatus);\n        ffkeyn(\"TFORM\", incol, keyname, &tstatus);\n    \n        if (ffgkys(infptr, keyname, tform, tform_comm, &tstatus) )\n        {\n          ffpmsg\n          (\"Could not find TTYPE and TFORM keywords in input table (ffcpcl)\");\n          return(*status = NO_TFORM);\n        }\n\n        if (inHduType == ASCII_TBL && outHduType == BINARY_TBL)\n        {\n            /* convert from ASCII table to BINARY table format string */\n            if (typecode == TSTRING)\n                ffnkey(width, \"A\", tform, status);\n\n            else if (typecode == TLONG)\n                strcpy(tform, \"1J\");\n\n            else if (typecode == TSHORT)\n                strcpy(tform, \"1I\");\n\n            else if (typecode == TFLOAT)\n                strcpy(tform,\"1E\");\n\n            else if (typecode == TDOUBLE)\n                strcpy(tform,\"1D\");\n        }\n\n        if (ffgkyj(outfptr, \"TFIELDS\", &tfields, 0, &tstatus))\n        {\n           ffpmsg\n           (\"Could not read TFIELDS keyword in output table (ffcpcl)\");\n           return(*status = NO_TFIELDS);\n        }\n\n        colnum = minvalue((int) tfields + 1, outcol); /* output col. number */\n\n        /* create the empty column */\n        if (fficol(outfptr, colnum, ttype, tform, status) > 0)\n        {\n           ffpmsg\n           (\"Could not append new column to output file (ffcpcl)\");\n           return(*status);\n        }\n\n        if ((infptr->Fptr == outfptr->Fptr)\n           && (infptr->HDUposition == outfptr->HDUposition)\n           && (colnum <= incol))  {\n\t       incol++;  /* the input column has been shifted over */\n        }\n\n        /* copy the comment strings from the input file for TTYPE and TFORM */\n        tstatus = 0;\n        ffkeyn(\"TTYPE\", colnum, keyname, &tstatus);\n        ffmcom(outfptr, keyname, ttype_comm, &tstatus);\n        ffkeyn(\"TFORM\", colnum, keyname, &tstatus);\n        ffmcom(outfptr, keyname, tform_comm, &tstatus);\n\n        /* copy other column-related keywords if they exist */\n\n        ffcpky(infptr, outfptr, incol, colnum, \"TUNIT\", status);\n        ffcpky(infptr, outfptr, incol, colnum, \"TSCAL\", status);\n        ffcpky(infptr, outfptr, incol, colnum, \"TZERO\", status);\n        ffcpky(infptr, outfptr, incol, colnum, \"TDISP\", status);\n        ffcpky(infptr, outfptr, incol, colnum, \"TLMIN\", status);\n        ffcpky(infptr, outfptr, incol, colnum, \"TLMAX\", status);\n        ffcpky(infptr, outfptr, incol, colnum, \"TDIM\", status);\n\n        /*  WCS keywords */\n        ffcpky(infptr, outfptr, incol, colnum, \"TCTYP\", status);\n        ffcpky(infptr, outfptr, incol, colnum, \"TCUNI\", status);\n        ffcpky(infptr, outfptr, incol, colnum, \"TCRVL\", status);\n        ffcpky(infptr, outfptr, incol, colnum, \"TCRPX\", status);\n        ffcpky(infptr, outfptr, incol, colnum, \"TCDLT\", status);\n        ffcpky(infptr, outfptr, incol, colnum, \"TCROT\", status);\n\n        if (inHduType == ASCII_TBL && outHduType == BINARY_TBL)\n        {\n            /* binary tables only have TNULLn keyword for integer columns */\n            if (typecode == TLONG || typecode == TSHORT)\n            {\n                /* check if null string is defined; replace with integer */\n                ffkeyn(\"TNULL\", incol, keyname, &tstatus);\n                if (ffgkys(infptr, keyname, ttype, 0, &tstatus) <= 0)\n                {\n                   ffkeyn(\"TNULL\", colnum, keyname, &tstatus);\n                   if (typecode == TLONG)\n                      ffpkyj(outfptr, keyname, -9999999L, \"Null value\", status);\n                   else\n                      ffpkyj(outfptr, keyname, -32768L, \"Null value\", status);\n                }\n            }\n        }\n        else\n        {\n            ffcpky(infptr, outfptr, incol, colnum, \"TNULL\", status);\n        }\n\n        /* rescan header to recognize the new keywords */\n        if (ffrdef(outfptr, status) )\n            return(*status);\n    }\n    else\n    {\n        colnum = outcol;\n        /* get the datatype and vector repeat length of the output column */\n        ffgtcl(outfptr, outcol, &otypecode, &orepeat, &owidth, status);\n\n        if (orepeat != repeat) {\n            ffpmsg(\"Input and output vector columns must have same length (ffcpcl)\");\n            return(*status = BAD_TFORM);\n        }\n    }\n\n    ffgkyj(infptr,  \"NAXIS2\", &nrows,   0, status);  /* no. of input rows */\n    ffgkyj(outfptr, \"NAXIS2\", &outrows, 0, status);  /* no. of output rows */\n    nrows = minvalue(nrows, outrows);\n\n    if (typecode == TBIT)\n        repeat = (repeat + 7) / 8;  /* convert from bits to bytes */\n    else if (typecode == TSTRING && inHduType == BINARY_TBL)\n        repeat = repeat / width;  /* convert from chars to unit strings */\n\n    /* get optimum number of rows to copy at one time */\n    ffgrsz(infptr,  &inloop,  status);\n    ffgrsz(outfptr, &outloop, status);\n\n    /* adjust optimum number, since 2 tables are open at once */\n    maxloop = minvalue(inloop, outloop); /* smallest of the 2 tables */\n    maxloop = maxvalue(1, maxloop / 2);  /* at least 1 row */\n    maxloop = minvalue(maxloop, nrows);  /* max = nrows to be copied */\n    maxloop *= repeat;                   /* mult by no of elements in a row */\n\n    /* allocate memory for arrays */\n    if (typecode == TLOGICAL)\n    {\n       lvalues   = (char *) calloc(maxloop, sizeof(char) );\n       if (!lvalues)\n       {\n         ffpmsg\n         (\"malloc failed to get memory for logicals (ffcpcl)\");\n         return(*status = ARRAY_TOO_BIG);\n       }\n    }\n    else if (typecode == TSTRING)\n    {\n       /* allocate array of pointers */\n       strarray = (char **) calloc(maxloop, sizeof(strarray));\n\n       /* allocate space for each string */\n       for (ii = 0; ii < maxloop; ii++)\n          strarray[ii] = (char *) calloc(width+1, sizeof(char));\n    }\n    else if (typecode == TCOMPLEX)\n    {\n       fvalues = (float *) calloc(maxloop * 2, sizeof(float) );\n       if (!fvalues)\n       {\n         ffpmsg\n         (\"malloc failed to get memory for complex (ffcpcl)\");\n         return(*status = ARRAY_TOO_BIG);\n       }\n       fnull = 0.;\n    }\n    else if (typecode == TDBLCOMPLEX)\n    {\n       dvalues = (double *) calloc(maxloop * 2, sizeof(double) );\n       if (!dvalues)\n       {\n         ffpmsg\n         (\"malloc failed to get memory for dbl complex (ffcpcl)\");\n         return(*status = ARRAY_TOO_BIG);\n       }\n       dnull = 0.;\n    }\n    /* These are unsigned long-long ints that are not rescaled to floating point numbers */\n    else if (typecode == TLONGLONG && etypecode == TULONGLONG) {\n\n       ujjvalues = (unsigned long long int *) calloc(maxloop, sizeof(unsigned long long int) );\n       if (!ujjvalues)\n       {\n         ffpmsg\n         (\"malloc failed to get memory for unsigned long long int (ffcpcl)\");\n         return(*status = ARRAY_TOO_BIG);\n       }\n    }\n    /* These are long-long ints that are not rescaled to floating point numbers */\n    else if (typecode == TLONGLONG && etypecode != TDOUBLE) {\n\n       jjvalues = (long long int *) calloc(maxloop, sizeof(long long int) );\n       if (!jjvalues)\n       {\n         ffpmsg\n         (\"malloc failed to get memory for long long int (ffcpcl)\");\n         return(*status = ARRAY_TOO_BIG);\n       }\n    }\n    else    /* other numerical datatype; read them all as doubles */\n    {\n       dvalues = (double *) calloc(maxloop, sizeof(double) );\n       if (!dvalues)\n       {\n         ffpmsg\n         (\"malloc failed to get memory for doubles (ffcpcl)\");\n         return(*status = ARRAY_TOO_BIG);\n       }\n         dnull = -9.99991999E31;  /* use an unlikely value for nulls */\n    }\n\n    npixels = nrows * repeat;          /* total no. of pixels to copy */\n    ntodo = minvalue(npixels, maxloop);   /* no. to copy per iteration */\n    ndone = 0;             /* total no. of pixels that have been copied */\n\n    while (ntodo)      /* iterate through the table */\n    {\n        firstrow = ndone / repeat + 1;\n        firstelem = ndone - ((firstrow - 1) * repeat) + 1;\n\n        /* read from input table */\n        if (typecode == TLOGICAL)\n            ffgcl(infptr, incol, firstrow, firstelem, ntodo, \n                       lvalues, status);\n        else if (typecode == TSTRING)\n            ffgcvs(infptr, incol, firstrow, firstelem, ntodo,\n                       nulstr, strarray, &anynull, status);\n\n        else if (typecode == TCOMPLEX)  \n            ffgcvc(infptr, incol, firstrow, firstelem, ntodo, fnull, \n                   fvalues, &anynull, status);\n\n        else if (typecode == TDBLCOMPLEX)\n            ffgcvm(infptr, incol, firstrow, firstelem, ntodo, dnull, \n                   dvalues, &anynull, status);\n\n\t/* Neither TULONGLONG nor TLONGLONG does null checking.  Whatever\n\t   null value is in input table is transferred to output table\n\t   without checking.  Since the TNULL value was copied, this\n\t   should preserve null values */\n\telse if (typecode == TLONGLONG && etypecode == TULONGLONG)\n\t  ffgcvujj(infptr, incol, firstrow, firstelem, ntodo, /*nulval*/ 0,\n                   ujjvalues, &anynull, status);\n\n\telse if (typecode == TLONGLONG && etypecode != TDOUBLE) \n\t  ffgcvjj(infptr, incol, firstrow, firstelem, ntodo, /*nulval*/ 0, \n                   jjvalues, &anynull, status);\n\n        else       /* all numerical types */\n            ffgcvd(infptr, incol, firstrow, firstelem, ntodo, dnull, \n                   dvalues, &anynull, status);\n\n        if (*status > 0)\n        {\n            ffpmsg(\"Error reading input copy of column (ffcpcl)\");\n            break;\n        }\n\n        /* write to output table */\n        if (typecode == TLOGICAL)\n        {\n            nullflag = 2;\n\n            ffpcnl(outfptr, colnum, firstrow, firstelem, ntodo, \n                       lvalues, nullflag, status);\n\n        }\n\n        else if (typecode == TSTRING)\n        {\n            if (anynull)\n                ffpcns(outfptr, colnum, firstrow, firstelem, ntodo,\n                       strarray, nulstr, status);\n            else\n                ffpcls(outfptr, colnum, firstrow, firstelem, ntodo,\n                       strarray, status);\n        }\n\n        else if (typecode == TCOMPLEX)  \n        {                      /* doesn't support writing nulls */\n            ffpclc(outfptr, colnum, firstrow, firstelem, ntodo, \n                       fvalues, status);\n        }\n\n        else if (typecode == TDBLCOMPLEX)  \n        {                      /* doesn't support writing nulls */\n            ffpclm(outfptr, colnum, firstrow, firstelem, ntodo, \n                       dvalues, status);\n        }\n\n\telse if (typecode == TLONGLONG && etypecode == TULONGLONG)\n\t{   /* No null checking because we did none to read */\n            ffpclujj(outfptr, colnum, firstrow, firstelem, ntodo, \n\t\t     ujjvalues, status);\n\t}\n\telse if (typecode == TLONGLONG && etypecode != TDOUBLE) \n\t{   /* No null checking because we did none to read */\n\t    ffpcljj(outfptr, colnum, firstrow, firstelem, ntodo, \n\t\t    jjvalues, status);\n\t}\n        else  /* all other numerical types */\n        {\n            if (anynull)\n                ffpcnd(outfptr, colnum, firstrow, firstelem, ntodo, \n                       dvalues, dnull, status);\n            else\n                ffpcld(outfptr, colnum, firstrow, firstelem, ntodo, \n                       dvalues, status);\n        }\n\n        if (*status > 0)\n        {\n            ffpmsg(\"Error writing output copy of column (ffcpcl)\");\n            break;\n        }\n\n        npixels -= ntodo;\n        ndone += ntodo;\n        ntodo = minvalue(npixels, maxloop);\n    }\n\n    /* free the previously allocated memory */\n    if (typecode == TLOGICAL)\n    {\n        free(lvalues);\n    }\n    else if (typecode == TSTRING)\n    {\n         for (ii = 0; ii < maxloop; ii++)\n             free(strarray[ii]);\n\n         free(strarray);\n    }\n    if (ujjvalues) free(ujjvalues);\n    if (jjvalues)  free(jjvalues);\n    if (dvalues)   free(dvalues);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffccls(fitsfile *infptr,    /* I - FITS file pointer to input file  */\n           fitsfile *outfptr,   /* I - FITS file pointer to output file */\n           int incol,           /* I - number of first input column   */\n           int outcol,          /* I - number for first output column  */\n\t   int ncols,           /* I - number of columns to copy from input to output */\n           int create_col,      /* I - create new col if TRUE, else overwrite */\n           int *status)         /* IO - error status     */\n/*\n  copy multiple columns from infptr and insert them in the outfptr\n  table.  Optimized for multiple-column case since it only expands the\n  output file once using fits_insert_cols() instead of calling\n  fits_insert_col() multiple times.\n*/\n{\n    int tstatus, colnum, typecode, otypecode, anynull;\n    int inHduType, outHduType;\n    long tfields, repeat, orepeat, width, owidth, nrows, outrows;\n    long inloop, outloop, maxloop, ndone, ntodo, npixels;\n    long firstrow, firstelem, ii;\n    char keyname[FLEN_KEYWORD], ttype[FLEN_VALUE], tform[FLEN_VALUE];\n    char ttype_comm[FLEN_COMMENT],tform_comm[FLEN_COMMENT];\n    char *lvalues = 0, nullflag, **strarray = 0;\n    char nulstr[] = {'\\5', '\\0'};  /* unique null string value */\n    double dnull = 0.l, *dvalues = 0;\n    float fnull = 0., *fvalues = 0;\n    int typecodes[1000];\n    char *ttypes[1000], *tforms[1000], keyarr[1001][FLEN_CARD];\n    int ikey = 0;\n    int icol, incol1, outcol1;\n\n    if (*status > 0)\n        return(*status);\n\n    /* Do not allow more than internal array limit to be copied */\n    if (ncols > 1000) return (*status = ARRAY_TOO_BIG);\n\n    if (infptr->HDUposition != (infptr->Fptr)->curhdu)\n    {\n        ffmahd(infptr, (infptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((infptr->Fptr)->datastart == DATA_UNDEFINED)\n        ffrdef(infptr, status);                /* rescan header */\n    inHduType = (infptr->Fptr)->hdutype;\n    \n    if (outfptr->HDUposition != (outfptr->Fptr)->curhdu)\n    {\n        ffmahd(outfptr, (outfptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((outfptr->Fptr)->datastart == DATA_UNDEFINED)\n        ffrdef(outfptr, status);               /* rescan header */\n    outHduType = (outfptr->Fptr)->hdutype;\n    \n    if (*status > 0)\n        return(*status);\n\n    if (inHduType == IMAGE_HDU || outHduType == IMAGE_HDU)\n    {\n       ffpmsg\n       (\"Can not copy columns to or from IMAGE HDUs (ffccls)\");\n       return(*status = NOT_TABLE);\n    }\n\n    if ( (inHduType == BINARY_TBL &&  outHduType == ASCII_TBL) ||\n\t (inHduType == ASCII_TBL  &&  outHduType == BINARY_TBL) )\n    {\n       ffpmsg\n       (\"Copying between Binary and ASCII tables is not supported (ffccls)\");\n       return(*status = NOT_BTABLE);\n    }\n\n    /* Do not allow copying multiple columns in the same HDU because the\n       permutations of possible overlapping copies is mind-bending */\n    if ((infptr->Fptr == outfptr->Fptr)\n\t&& (infptr->HDUposition == outfptr->HDUposition))\n    {\n       ffpmsg\n       (\"Copying multiple columns in same HDU is not supported (ffccls)\");\n       return(*status = NOT_BTABLE);\n    }\n\n    /* Retrieve the number of columns in output file */\n    tstatus=0;\n    if (ffgkyj(outfptr, \"TFIELDS\", &tfields, 0, &tstatus))\n    {\n      ffpmsg\n\t(\"Could not read TFIELDS keyword in output table (ffccls)\");\n      return(*status = NO_TFIELDS);\n    }\n\n    colnum = minvalue((int) tfields + 1, outcol); /* output col. number */\n\n    /* Collect data about input column (type, repeat, etc) */\n    for (incol1 = incol, outcol1 = colnum, icol = 0; \n\t icol < ncols; \n\t icol++, incol1++, outcol1++)\n    {\n      ffgtcl(infptr, incol1, &typecode, &repeat, &width, status);\n\n      if (typecode < 0)\n\t{\n\t  ffpmsg(\"Variable-length columns are not supported (ffccls)\");\n\t  return(*status = BAD_TFORM);\n\t}\n\n      typecodes[icol] = typecode;\n\n      tstatus = 0;\n      ffkeyn(\"TTYPE\", incol1, keyname, &tstatus);\n      ffgkys(infptr, keyname, ttype, ttype_comm, &tstatus);\n\n      ffkeyn(\"TFORM\", incol1, keyname, &tstatus);\n    \n      if (ffgkys(infptr, keyname, tform, tform_comm, &tstatus) )\n        {\n          ffpmsg\n\t    (\"Could not find TTYPE and TFORM keywords in input table (ffccls)\");\n          return(*status = NO_TFORM);\n        }\n\n      /* If creating columns, we need to save these values */\n      if ( create_col ) {\n\ttforms[icol] = keyarr[ikey++];\n\tttypes[icol] = keyarr[ikey++];\n\n\tstrcpy(tforms[icol], tform);\n\tstrcpy(ttypes[icol], ttype);\n      } else {\n\t/* If not creating columns, then check the datatype and vector\n\t   repeat length of the output column */\n        ffgtcl(outfptr, outcol1, &otypecode, &orepeat, &owidth, status);\n\n        if (orepeat != repeat) {\n            ffpmsg(\"Input and output vector columns must have same length (ffccls)\");\n            return(*status = BAD_TFORM);\n        }\n      }\n    }\n\n    /* Insert columns into output file and copy all meta-data\n       keywords, if requested */\n    if (create_col)\n    {\n        /* create the empty columns */\n        if (fficls(outfptr, colnum, ncols, ttypes, tforms, status) > 0)\n        {\n           ffpmsg\n           (\"Could not append new columns to output file (ffccls)\");\n           return(*status);\n        }\n\n\t/* Copy meta-data strings from input column to output */\n\tfor (incol1 = incol, outcol1 = colnum, icol = 0; \n\t     icol < ncols; \n\t     icol++, incol1++, outcol1++)\n\t{\n\t  /* copy the comment strings from the input file for TTYPE and TFORM */\n\t  ffkeyn(\"TTYPE\", incol1, keyname, status);\n\t  ffgkys(infptr, keyname, ttype, ttype_comm, status);\n\t  ffkeyn(\"TTYPE\", outcol1, keyname, status);\n\t  ffmcom(outfptr, keyname, ttype_comm, status);\n\t  \n\t  ffkeyn(\"TFORM\", incol1, keyname, status);\n\t  ffgkys(infptr, keyname, tform, tform_comm, status);\n\t  ffkeyn(\"TFORM\", outcol1, keyname, status);\n\t  ffmcom(outfptr, keyname, tform_comm, status);\n\t  \n\t  /* copy other column-related keywords if they exist */\n\t  \n\t  ffcpky(infptr, outfptr, incol1, outcol1, \"TUNIT\", status);\n\t  ffcpky(infptr, outfptr, incol1, outcol1, \"TSCAL\", status);\n\t  ffcpky(infptr, outfptr, incol1, outcol1, \"TZERO\", status);\n\t  ffcpky(infptr, outfptr, incol1, outcol1, \"TDISP\", status);\n\t  ffcpky(infptr, outfptr, incol1, outcol1, \"TLMIN\", status);\n\t  ffcpky(infptr, outfptr, incol1, outcol1, \"TLMAX\", status);\n\t  ffcpky(infptr, outfptr, incol1, outcol1, \"TDIM\", status);\n\n\t  /*  WCS keywords */\n\t  ffcpky(infptr, outfptr, incol1, outcol1, \"TCTYP\", status);\n\t  ffcpky(infptr, outfptr, incol1, outcol1, \"TCUNI\", status);\n\t  ffcpky(infptr, outfptr, incol1, outcol1, \"TCRVL\", status);\n\t  ffcpky(infptr, outfptr, incol1, outcol1, \"TCRPX\", status);\n\t  ffcpky(infptr, outfptr, incol1, outcol1, \"TCDLT\", status);\n\t  ffcpky(infptr, outfptr, incol1, outcol1, \"TCROT\", status);\n\t  \n\t  ffcpky(infptr, outfptr, incol1, outcol1, \"TNULL\", status);\n\n\t}\n\n\t/* rescan header to recognize the new keywords */\n\tif (ffrdef(outfptr, status) )\n\t  return(*status);\n    }\n\t\n    /* Copy columns using standard ffcpcl(); do this in a loop because\n       the I/O-intensive column expanding is done */\n    for (incol1 = incol, outcol1 = colnum, icol = 0; \n\t icol < ncols; \n\t icol++, incol1++, outcol1++)\n    {\n      ffcpcl(infptr, outfptr, incol1, outcol1, 0, status);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffcprw(fitsfile *infptr,    /* I - FITS file pointer to input file  */\n           fitsfile *outfptr,   /* I - FITS file pointer to output file */\n           LONGLONG firstrow,   /* I - number of first row to copy (1 based)  */\n           LONGLONG nrows,      /* I - number of rows to copy  */\n           int *status)         /* IO - error status     */\n/*\n  copy consecutive set of rows from infptr and append it in the outfptr table.\n*/\n{\n    LONGLONG innaxis1, innaxis2, outnaxis1, outnaxis2, ii, jj, icol;\n    LONGLONG iVarCol, inPos, outPos, nVarBytes, nVarAllocBytes = 0;\n    unsigned char *buffer, *varColBuff=0;\n    int nInVarCols=0, nOutVarCols=0, varColDiff=0;\n    int *inVarCols=0, *outVarCols=0;\n    long nNewBlocks;\n    LONGLONG hrepeat=0, hoffset=0;\n    tcolumn *colptr=0;\n    \n    if (*status > 0)\n        return(*status);\n\n    if (infptr->HDUposition != (infptr->Fptr)->curhdu)\n    {\n        ffmahd(infptr, (infptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((infptr->Fptr)->datastart == DATA_UNDEFINED)\n        ffrdef(infptr, status);                /* rescan header */\n\n    if (outfptr->HDUposition != (outfptr->Fptr)->curhdu)\n    {\n        ffmahd(outfptr, (outfptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((outfptr->Fptr)->datastart == DATA_UNDEFINED)\n        ffrdef(outfptr, status);               /* rescan header */\n\n    if (*status > 0)\n        return(*status);\n\n    if ((infptr->Fptr)->hdutype == IMAGE_HDU || (outfptr->Fptr)->hdutype == IMAGE_HDU)\n    {\n       ffpmsg\n       (\"Can not copy rows to or from IMAGE HDUs (ffcprw)\");\n       return(*status = NOT_TABLE);\n    }\n\n    if ( ((infptr->Fptr)->hdutype == BINARY_TBL &&  (outfptr->Fptr)->hdutype == ASCII_TBL) ||\n         ((infptr->Fptr)->hdutype == ASCII_TBL &&  (outfptr->Fptr)->hdutype == BINARY_TBL) )\n    {\n       ffpmsg\n       (\"Copying rows between Binary and ASCII tables is not supported (ffcprw)\");\n       return(*status = NOT_BTABLE);\n    }\n\n    ffgkyjj(infptr,  \"NAXIS1\", &innaxis1,  0, status);  /* width of input rows */\n    ffgkyjj(infptr,  \"NAXIS2\", &innaxis2,  0, status);  /* no. of input rows */\n    ffgkyjj(outfptr, \"NAXIS1\", &outnaxis1, 0, status);  /* width of output rows */\n    ffgkyjj(outfptr, \"NAXIS2\", &outnaxis2, 0, status);  /* no. of output rows */\n\n    if (*status > 0)\n        return(*status);\n\n    if (outnaxis1 != innaxis1) {\n       ffpmsg\n       (\"Input and output tables do not have same width (ffcprw)\");\n       return(*status = BAD_ROW_WIDTH);\n    }    \n\n    if (firstrow + nrows - 1 > innaxis2) {\n       ffpmsg\n       (\"Not enough rows in input table to copy (ffcprw)\");\n       return(*status = BAD_ROW_NUM);\n    }\n    \n    if ((infptr->Fptr)->tfield != (outfptr->Fptr)->tfield)\n    {\n       ffpmsg\n       (\"Input and output tables do not have same number of columns (ffcprw)\");\n       return(*status = BAD_COL_NUM);\n    }\n    \n    /* allocate buffer to hold 1 row of data */\n    buffer = malloc( (size_t) innaxis1);\n    if (!buffer) {\n       ffpmsg\n       (\"Unable to allocate memory (ffcprw)\");\n       return(*status = MEMORY_ALLOCATION);\n    }\n \n    inVarCols = malloc(infptr->Fptr->tfield*sizeof(int));\n    outVarCols = malloc(outfptr->Fptr->tfield*sizeof(int));\n    fffvcl(infptr, &nInVarCols, inVarCols, status);\n    fffvcl(outfptr, &nOutVarCols, outVarCols, status);\n    if (nInVarCols != nOutVarCols)\n       varColDiff=1;\n    else\n    {\n       for (ii=0; ii<nInVarCols; ++ii)\n       {\n          if (inVarCols[ii] != outVarCols[ii])\n          {\n             varColDiff=1;\n             break;\n          }\n       }\n    }\n    \n    if (varColDiff)\n    {\n       ffpmsg(\"Input and output tables have different variable columns (ffcprw)\");\n       *status = BAD_COL_NUM;\n       goto CLEANUP_RETURN;\n    }\n    \n    jj = outnaxis2 + 1;\n    if (nInVarCols)\n    {\n       ffirow(outfptr, outnaxis2, nrows, status);\n       for (ii = firstrow; ii < firstrow + nrows; ii++)\n       {\n          fits_read_tblbytes (infptr, ii, 1, innaxis1, buffer, status);\n          fits_write_tblbytes(outfptr, jj, 1, innaxis1, buffer, status);\n          /* Now make corrections for variable length columns */\n          iVarCol=0;\n          colptr = (infptr->Fptr)->tableptr;\n          for (icol=0; icol<(infptr->Fptr)->tfield; ++icol)\n          {\n             if (iVarCol < nInVarCols && inVarCols[iVarCol] == icol+1)\n             {\n                /* Copy from a variable length column */\n                \n                ffgdesll(infptr, icol+1, ii, &hrepeat, &hoffset, status);\n                /* If this is a bit column, hrepeat will be number of\n                   bits, not bytes. If it is a string column, hrepeat\n\t\t   is the number of bytes, twidth is the max col width \n\t\t   and can be ignored.*/\n                if (colptr->tdatatype == -TBIT)\n\t\t{\n\t\t   nVarBytes = (hrepeat+7)/8;\n\t\t}\n\t\telse if (colptr->tdatatype == -TSTRING)\n\t\t{\n\t\t   nVarBytes = hrepeat;\n\t\t}\n\t\telse\n\t\t{\n\t\t   nVarBytes = hrepeat*colptr->twidth*sizeof(char);\n\t\t}\n                inPos = (infptr->Fptr)->datastart + (infptr->Fptr)->heapstart\n\t\t\t\t+ hoffset;\n\t\toutPos = (outfptr->Fptr)->datastart + (outfptr->Fptr)->heapstart\n\t\t\t\t+ (outfptr->Fptr)->heapsize;\n                ffmbyt(infptr, inPos, REPORT_EOF, status);\n\t\t/* If this is not the last HDU in the file, then check if */\n\t\t/* extending the heap would overwrite the following header. */\n\t\t/* If so, then have to insert more blocks. */\n                if ( !((outfptr->Fptr)->lasthdu) )\n                {\n\t\t   if (outPos+nVarBytes > \n\t\t      (outfptr->Fptr)->headstart[(outfptr->Fptr)->curhdu+1])\n\t\t   {\n\t\t      nNewBlocks = (long)(((outPos+nVarBytes - 1 -\n                        (outfptr->Fptr)->headstart[(outfptr->Fptr)->\n                        curhdu+1]) / 2880) + 1);\n                      if (ffiblk(outfptr, nNewBlocks, 1, status) > 0)\n                      {\n                         ffpmsg(\"Failed to extend the size of the variable length heap (ffcprw)\");\n\t\t\t goto CLEANUP_RETURN;\n                      }\n\n\t\t   }\n                }\n                if (nVarBytes)\n\t\t{\n\t\t   if (nVarBytes > nVarAllocBytes)\n\t\t   {\n\t\t     /* Grow the copy buffer to accomodate the new maximum size. \n\t\t\tNote it is safe to call realloc() with null input pointer, \n\t\t\twhich is equivalent to malloc(). */\n\t\t     unsigned char *varColBuff1 = (unsigned char *) realloc(varColBuff, nVarBytes);\n\t\t     if (! varColBuff1)\n\t\t     {\n\t\t       *status = MEMORY_ALLOCATION;\n\t\t       ffpmsg(\"failed to allocate memory for variable column copy (ffcprw)\");\n\t\t       goto CLEANUP_RETURN;\n\t\t     }\n\t\t     /* Record the new state */\n\t\t     varColBuff = varColBuff1;\n\t\t     nVarAllocBytes = nVarBytes;\n\t\t   }\n\t\t   /* Copy date from input to output */\n                   ffgbyt(infptr, nVarBytes, varColBuff, status);\n\t\t   ffmbyt(outfptr, outPos, IGNORE_EOF, status);\n                   ffpbyt(outfptr, nVarBytes, varColBuff, status);\n\t\t}\n\t\tffpdes(outfptr, icol+1, jj, hrepeat, (outfptr->Fptr)->heapsize, status);\n                (outfptr->Fptr)->heapsize += nVarBytes;\n                ++iVarCol;\n             }\n             ++colptr;\n          }\n          ++jj;\n       }\n    }\n    else\n    {    \n       /* copy the rows, 1 at a time */\n       for (ii = firstrow; ii < firstrow + nrows; ii++) {\n           fits_read_tblbytes (infptr,  ii, 1, innaxis1, buffer, status);\n           fits_write_tblbytes(outfptr, jj, 1, innaxis1, buffer, status);\n           jj++;\n       }\n    }\n    outnaxis2 += nrows;\n    fits_update_key(outfptr, TLONGLONG, \"NAXIS2\", &outnaxis2, 0, status);\n\n CLEANUP_RETURN:\n    free(buffer);\n    free(inVarCols);\n    free(outVarCols);\n    if (varColBuff) free(varColBuff);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffcpky(fitsfile *infptr,    /* I - FITS file pointer to input file  */\n           fitsfile *outfptr,   /* I - FITS file pointer to output file */\n           int incol,           /* I - input index number   */\n           int outcol,          /* I - output index number  */\n           char *rootname,      /* I - root name of the keyword to be copied */\n           int *status)         /* IO - error status     */\n/*\n  copy an indexed keyword from infptr to outfptr.\n*/\n{\n    int tstatus = 0;\n    char keyname[FLEN_KEYWORD];\n    char value[FLEN_VALUE], comment[FLEN_COMMENT], card[FLEN_CARD];\n\n    ffkeyn(rootname, incol, keyname, &tstatus);\n    if (ffgkey(infptr, keyname, value, comment, &tstatus) <= 0)\n    {\n        ffkeyn(rootname, outcol, keyname, &tstatus);\n        ffmkky(keyname, value, comment, card, status);\n        ffprec(outfptr, card, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffdcol(fitsfile *fptr,  /* I - FITS file pointer                        */\n           int colnum,      /* I - column to delete (1 = 1st)               */\n           int *status)     /* IO - error status                            */\n/*\n  Delete a column from a table.\n*/\n{\n    int ii, tstatus;\n    LONGLONG firstbyte, size, ndelete, nbytes, naxis1, naxis2, firstcol, delbyte, freespace;\n    LONGLONG tbcol;\n    long nblock, nspace;\n    char keyname[FLEN_KEYWORD], comm[FLEN_COMMENT];\n    tcolumn *colptr, *nextcol;\n\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    /* rescan header if data structure is undefined */\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n    if ((fptr->Fptr)->hdutype == IMAGE_HDU)\n    {\n       ffpmsg\n       (\"Can only delete column from TABLE or BINTABLE extension (ffdcol)\");\n       return(*status = NOT_TABLE);\n    }\n\n    if (colnum < 1 || colnum > (fptr->Fptr)->tfield )\n        return(*status = BAD_COL_NUM);\n\n    colptr = (fptr->Fptr)->tableptr;\n    colptr += (colnum - 1);\n    firstcol = colptr->tbcol;  /* starting byte position of the column */\n\n    /* use column width to determine how many bytes to delete in each row */\n    if ((fptr->Fptr)->hdutype == ASCII_TBL)\n    {\n      delbyte = colptr->twidth;  /* width of ASCII column */\n\n      if (colnum < (fptr->Fptr)->tfield) /* check for space between next column */\n      {\n        nextcol = colptr + 1;\n        nspace = (long) ((nextcol->tbcol) - (colptr->tbcol) - delbyte);\n        if (nspace > 0)\n            delbyte++;\n      }\n      else if (colnum > 1)   /* check for space between last 2 columns */\n      {\n        nextcol = colptr - 1;\n        nspace = (long) ((colptr->tbcol) - (nextcol->tbcol) - (nextcol->twidth));\n        if (nspace > 0)\n        {\n           delbyte++;\n           firstcol--;  /* delete the leading space */\n        }\n      }\n    }\n    else   /* a binary table */\n    {\n      if (colnum < (fptr->Fptr)->tfield)\n      {\n         nextcol = colptr + 1;\n         delbyte = (nextcol->tbcol) - (colptr->tbcol);\n      }\n      else\n      {\n         delbyte = ((fptr->Fptr)->rowlength) - (colptr->tbcol);\n      }\n    }\n\n    naxis1 = (fptr->Fptr)->rowlength;   /* current width of the table */\n    naxis2 = (fptr->Fptr)->numrows;\n\n    /* current size of table */\n    size = (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize;\n    freespace = ((LONGLONG)delbyte * naxis2) + ((size + 2879) / 2880) * 2880 - size;\n    nblock = (long) (freespace / 2880);   /* number of empty blocks to delete */\n\n    ffcdel(fptr, naxis1, naxis2, delbyte, firstcol, status); /* delete col */\n\n    /* absolute heap position */\n    firstbyte = (fptr->Fptr)->datastart + (fptr->Fptr)->heapstart;\n    ndelete = (LONGLONG)delbyte * naxis2; /* size of shift */\n\n    /* shift heap up (if it exists) */\n    if ((fptr->Fptr)->heapsize > 0)\n    {\n      nbytes = (fptr->Fptr)->heapsize;    /* no. of bytes to shift up */\n\n      if (ffshft(fptr, firstbyte, nbytes, -ndelete, status) > 0) /* mv heap */\n          return(*status);\n    }\n\n    /* delete the empty  blocks at the end of the HDU */\n    if (nblock > 0)\n        ffdblk(fptr, nblock, status);\n\n    /* update the heap starting address */\n    (fptr->Fptr)->heapstart -= ndelete;\n\n    /* update the THEAP keyword if it exists */\n    tstatus = 0;\n    ffmkyj(fptr, \"THEAP\", (long)(fptr->Fptr)->heapstart, \"&\", &tstatus);\n\n    if ((fptr->Fptr)->hdutype == ASCII_TBL)\n    {\n      /* adjust the TBCOL values of the remaining columns */\n      for (ii = 1; ii <= (fptr->Fptr)->tfield; ii++)\n      {\n        ffkeyn(\"TBCOL\", ii, keyname, status);\n        ffgkyjj(fptr, keyname, &tbcol, comm, status);\n        if (tbcol > firstcol)\n        {\n          tbcol = tbcol - delbyte;\n          ffmkyj(fptr, keyname, tbcol, \"&\", status);\n        }\n      }\n    }\n\n    /* update the mandatory keywords */\n    ffmkyj(fptr, \"TFIELDS\", ((fptr->Fptr)->tfield) - 1, \"&\", status);        \n    ffmkyj(fptr,  \"NAXIS1\",   naxis1 - delbyte, \"&\", status);\n    /*\n      delete the index keywords starting with 'T' associated with the \n      deleted column and subtract 1 from index of all higher keywords\n    */\n    ffkshf(fptr, colnum, (fptr->Fptr)->tfield, -1, status);\n\n    ffrdef(fptr, status);  /* initialize the new table structure */\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffcins(fitsfile *fptr,  /* I - FITS file pointer                        */\n           LONGLONG naxis1,     /* I - width of the table, in bytes             */\n           LONGLONG naxis2,     /* I - number of rows in the table              */\n           LONGLONG ninsert,    /* I - number of bytes to insert in each row    */\n           LONGLONG bytepos,    /* I - rel. position in row to insert bytes     */\n           int *status)     /* IO - error status                            */\n/*\n Insert 'ninsert' bytes into each row of the table at position 'bytepos'.\n*/\n{\n    unsigned char buffer[10000], cfill;\n    LONGLONG newlen, fbyte, nbytes, irow, nseg, ii;\n\n    if (*status > 0)\n        return(*status);\n\n    if (naxis2 == 0)\n        return(*status);  /* just return if there are 0 rows in the table */\n\n    /* select appropriate fill value */\n    if ((fptr->Fptr)->hdutype == ASCII_TBL)\n        cfill = 32;                     /* ASCII tables use blank fill */\n    else\n        cfill = 0;    /* primary array and binary tables use zero fill */\n\n    newlen = naxis1 + ninsert;\n\n    if (newlen <= 10000)\n    {\n       /*******************************************************************\n       CASE #1: optimal case where whole new row fits in the work buffer\n       *******************************************************************/\n\n        for (ii = 0; ii < ninsert; ii++)\n            buffer[ii] = cfill;      /* initialize buffer with fill value */\n\n        /* first move the trailing bytes (if any) in the last row */\n        fbyte = bytepos + 1;\n        nbytes = naxis1 - bytepos;\n        /* If the last row hasn't yet been accessed in full, it's possible\n           that logfilesize hasn't been updated to account for it (by way\n           of an ffldrc call).  This could cause ffgtbb to return with an\n           EOF error.  To prevent this, we must increase logfilesize here. \n        */\n        if ((fptr->Fptr)->logfilesize < (fptr->Fptr)->datastart + \n                 (fptr->Fptr)->heapstart)\n        {\n            (fptr->Fptr)->logfilesize = (((fptr->Fptr)->datastart +\n                 (fptr->Fptr)->heapstart + 2879)/2880)*2880;\n        }\n        \n        ffgtbb(fptr, naxis2, fbyte, nbytes, &buffer[ninsert], status);\n        (fptr->Fptr)->rowlength = newlen; /*  new row length */\n\n        /* write the row (with leading fill bytes) in the new place */\n        nbytes += ninsert;\n        ffptbb(fptr, naxis2, fbyte, nbytes, buffer, status);\n        (fptr->Fptr)->rowlength = naxis1;  /* reset to orig. value */\n\n        /*  now move the rest of the rows */\n        for (irow = naxis2 - 1; irow > 0; irow--)\n        {\n            /* read the row to be shifted (work backwards thru the table) */\n            ffgtbb(fptr, irow, fbyte, naxis1, &buffer[ninsert], status);\n            (fptr->Fptr)->rowlength = newlen; /* new row length */\n\n            /* write the row (with the leading fill bytes) in the new place */\n            ffptbb(fptr, irow, fbyte, newlen, buffer, status);\n            (fptr->Fptr)->rowlength = naxis1; /* reset to orig value */\n        }\n    }\n    else\n    {\n        /*****************************************************************\n        CASE #2:  whole row doesn't fit in work buffer; move row in pieces\n        ******************************************************************\n        first copy the data, then go back and write fill into the new column\n        start by copying the trailing bytes (if any) in the last row.     */\n\n        nbytes = naxis1 - bytepos;\n        nseg = (nbytes + 9999) / 10000;\n        fbyte = (nseg - 1) * 10000 + bytepos + 1;\n        nbytes = naxis1 - fbyte + 1;\n\n        for (ii = 0; ii < nseg; ii++)\n        {\n            ffgtbb(fptr, naxis2, fbyte, nbytes, buffer, status);\n            (fptr->Fptr)->rowlength =   newlen;  /* new row length */\n\n            ffptbb(fptr, naxis2, fbyte + ninsert, nbytes, buffer, status);\n            (fptr->Fptr)->rowlength =   naxis1; /* reset to orig value */\n\n            fbyte -= 10000;\n            nbytes = 10000;\n        }\n\n        /* now move the rest of the rows */\n        nseg = (naxis1 + 9999) / 10000;\n        for (irow = naxis2 - 1; irow > 0; irow--)\n        {\n          fbyte = (nseg - 1) * 10000 + bytepos + 1;\n          nbytes = naxis1 - (nseg - 1) * 10000;\n          for (ii = 0; ii < nseg; ii++)\n          { \n            /* read the row to be shifted (work backwards thru the table) */\n            ffgtbb(fptr, irow, fbyte, nbytes, buffer, status);\n            (fptr->Fptr)->rowlength =   newlen;  /* new row length */\n\n            /* write the row in the new place */\n            ffptbb(fptr, irow, fbyte + ninsert, nbytes, buffer, status);\n            (fptr->Fptr)->rowlength =   naxis1; /* reset to orig value */\n\n            fbyte -= 10000;\n            nbytes = 10000;\n          }\n        }\n\n        /* now write the fill values into the new column */\n        nbytes = minvalue(ninsert, 10000);\n        memset(buffer, cfill, (size_t) nbytes); /* initialize with fill value */\n\n        nseg = (ninsert + 9999) / 10000;\n        (fptr->Fptr)->rowlength =  newlen;  /* new row length */\n\n        for (irow = 1; irow <= naxis2; irow++)\n        {\n          fbyte = bytepos + 1;\n          nbytes = ninsert - ((nseg - 1) * 10000);\n          for (ii = 0; ii < nseg; ii++)\n          {\n            ffptbb(fptr, irow, fbyte, nbytes, buffer, status);\n            fbyte += nbytes;\n            nbytes = 10000;\n          }\n        }\n        (fptr->Fptr)->rowlength = naxis1;  /* reset to orig value */\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffcdel(fitsfile *fptr,  /* I - FITS file pointer                        */\n           LONGLONG naxis1,     /* I - width of the table, in bytes             */\n           LONGLONG naxis2,     /* I - number of rows in the table              */\n           LONGLONG ndelete,    /* I - number of bytes to delete in each row    */\n           LONGLONG bytepos,    /* I - rel. position in row to delete bytes     */\n           int *status)     /* IO - error status                            */\n/*\n delete 'ndelete' bytes from each row of the table at position 'bytepos'.  */\n{\n    unsigned char buffer[10000];\n    LONGLONG i1, i2, ii, irow, nseg;\n    LONGLONG newlen, remain, nbytes;\n\n    if (*status > 0)\n        return(*status);\n\n    if (naxis2 == 0)\n        return(*status);  /* just return if there are 0 rows in the table */\n\n    newlen = naxis1 - ndelete;\n\n    if (newlen <= 10000)\n    {\n      /*******************************************************************\n      CASE #1: optimal case where whole new row fits in the work buffer\n      *******************************************************************/\n      i1 = bytepos + 1;\n      i2 = i1 + ndelete;\n      for (irow = 1; irow < naxis2; irow++)\n      {\n        ffgtbb(fptr, irow, i2, newlen, buffer, status); /* read row */\n        (fptr->Fptr)->rowlength = newlen;  /* new row length */\n\n        ffptbb(fptr, irow, i1, newlen, buffer, status); /* write row */\n        (fptr->Fptr)->rowlength = naxis1;  /* reset to orig value */\n      }\n\n      /* now do the last row */\n      remain = naxis1 - (bytepos + ndelete);\n\n      if (remain > 0)\n      {\n        ffgtbb(fptr, naxis2, i2, remain, buffer, status); /* read row */\n        (fptr->Fptr)->rowlength = newlen;  /* new row length */\n\n        ffptbb(fptr, naxis2, i1, remain, buffer, status); /* write row */\n        (fptr->Fptr)->rowlength = naxis1;  /* reset to orig value */\n      }\n    }\n    else\n    {\n        /*****************************************************************\n        CASE #2:  whole row doesn't fit in work buffer; move row in pieces\n        ******************************************************************/\n\n        nseg = (newlen + 9999) / 10000;\n        for (irow = 1; irow < naxis2; irow++)\n        {\n          i1 = bytepos + 1;\n          i2 = i1 + ndelete;\n\n          nbytes = newlen - (nseg - 1) * 10000;\n          for (ii = 0; ii < nseg; ii++)\n          { \n            ffgtbb(fptr, irow, i2, nbytes, buffer, status); /* read bytes */\n            (fptr->Fptr)->rowlength = newlen;  /* new row length */\n\n            ffptbb(fptr, irow, i1, nbytes, buffer, status); /* rewrite bytes */\n            (fptr->Fptr)->rowlength = naxis1; /* reset to orig value */\n\n            i1 += nbytes;\n            i2 += nbytes;\n            nbytes = 10000;\n          }\n        }\n\n        /* now do the last row */\n        remain = naxis1 - (bytepos + ndelete);\n\n        if (remain > 0)\n        {\n          nseg = (remain + 9999) / 10000;\n          i1 = bytepos + 1;\n          i2 = i1 + ndelete;\n          nbytes = remain - (nseg - 1) * 10000;\n          for (ii = 0; ii < nseg; ii++)\n          { \n            ffgtbb(fptr, naxis2, i2, nbytes, buffer, status);\n            (fptr->Fptr)->rowlength = newlen;  /* new row length */\n\n            ffptbb(fptr, naxis2, i1, nbytes, buffer, status); /* write row */\n            (fptr->Fptr)->rowlength = naxis1;  /* reset to orig value */\n\n            i1 += nbytes;\n            i2 += nbytes;\n            nbytes = 10000;\n          }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffkshf(fitsfile *fptr,  /* I - FITS file pointer                        */\n           int colmin,      /* I - starting col. to be incremented; 1 = 1st */\n           int colmax,      /* I - last column to be incremented            */\n           int incre,       /* I - shift index number by this amount        */\n           int *status)     /* IO - error status                            */\n/*\n  shift the index value on any existing column keywords\n  This routine will modify the name of any keyword that begins with 'T'\n  and has an index number in the range COLMIN - COLMAX, inclusive.\n\n  if incre is positive, then the index values will be incremented.\n  if incre is negative, then the kewords with index = COLMIN\n  will be deleted and the index of higher numbered keywords will\n  be decremented.\n*/\n{\n    int nkeys, nmore, nrec, tstatus, i1;\n    long ivalue;\n    char rec[FLEN_CARD], q[FLEN_KEYWORD], newkey[FLEN_KEYWORD];\n\n    ffghsp(fptr, &nkeys, &nmore, status);  /* get number of keywords */\n\n    /* go thru header starting with the 9th keyword looking for 'TxxxxNNN' */\n\n    for (nrec = 9; nrec <= nkeys; nrec++)\n    {     \n        ffgrec(fptr, nrec, rec, status);\n\n        if (rec[0] == 'T')\n        {\n            i1 = 0;\n            strncpy(q, &rec[1], 4);\n            if (!strncmp(q, \"BCOL\", 4) || !strncmp(q, \"FORM\", 4) ||\n                !strncmp(q, \"TYPE\", 4) || !strncmp(q, \"SCAL\", 4) ||\n                !strncmp(q, \"UNIT\", 4) || !strncmp(q, \"NULL\", 4) ||\n                !strncmp(q, \"ZERO\", 4) || !strncmp(q, \"DISP\", 4) ||\n                !strncmp(q, \"LMIN\", 4) || !strncmp(q, \"LMAX\", 4) ||\n                !strncmp(q, \"DMIN\", 4) || !strncmp(q, \"DMAX\", 4) ||\n                !strncmp(q, \"CTYP\", 4) || !strncmp(q, \"CRPX\", 4) ||\n                !strncmp(q, \"CRVL\", 4) || !strncmp(q, \"CDLT\", 4) ||\n                !strncmp(q, \"CROT\", 4) || !strncmp(q, \"CUNI\", 4) )\n              i1 = 5;\n            else if (!strncmp(rec, \"TDIM\", 4) )\n              i1 = 4;\n\n            if (i1)\n            {\n              /* try reading the index number suffix */\n              q[0] = '\\0';\n              strncat(q, &rec[i1], 8 - i1);\n\n              tstatus = 0;\n              ffc2ii(q, &ivalue, &tstatus);\n\n              if (tstatus == 0 && ivalue >= colmin && ivalue <= colmax)\n              {\n                if (incre <= 0 && ivalue == colmin)       \n                {\n                  ffdrec(fptr, nrec, status); /* delete keyword */\n                  nkeys = nkeys - 1;\n                  nrec = nrec - 1;\n                }\n                else\n                {\n                  ivalue = ivalue + incre;\n                  q[0] = '\\0';\n                  strncat(q, rec, i1);\n     \n                  ffkeyn(q, ivalue, newkey, status);\n\t\t  /* NOTE: because of null termination, it is not \n\t\t     equivalent to use strcpy() for the same calls */\n                  strncpy(rec, \"        \", 8);    /* erase old keyword name */\n                  i1 = strlen(newkey);\n                  strncpy(rec, newkey, i1);   /* overwrite new keyword name */\n                  ffmrec(fptr, nrec, rec, status);  /* modify the record */\n                }\n              }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffvcl(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int *nvarcols,    /* O - Number of variable length columns found */\n           int *colnums,     /* O - 1-based variable column positions       */\n           int *status)      /* IO - error status                           */\n{\n/*\n   Internal function to identify which columns in a binary table are variable length.\n   The colnums array will be filled with nvarcols elements - the 1-based numbers\n   of all variable length columns in the table.  This ASSUMES calling function\n   has passed in a colnums array large enough to hold these.\n*/\n   int tfields=0,icol;\n   tcolumn *colptr=0;\n   \n   *nvarcols = 0;\n   if (*status > 0)\n       return(*status);\n       \n   if ((fptr->Fptr)->hdutype != BINARY_TBL)\n   {\n      ffpmsg(\"Var-length column search can only be performed on Binary tables (fffvcl)\");\n      return(*status = NOT_BTABLE);\n   }\n   \n   if ((fptr->Fptr)->tableptr)\n   {\n      colptr = (fptr->Fptr)->tableptr;\n      tfields = (fptr->Fptr)->tfield;\n      for (icol=0; icol<tfields; ++icol, ++colptr)\n      {\n         /* Condition for variable length column: negative tdatatype */\n         if (colptr->tdatatype < 0)\n         {\n            colnums[*nvarcols] = icol + 1;\n            *nvarcols += 1;            \n         }\n      }      \n   }   \n   return(*status);\n}\n\n/*--------------------------------------------------------------------------*/\nint ffshft(fitsfile *fptr,  /* I - FITS file pointer                        */\n           LONGLONG firstbyte, /* I - position of first byte in block to shift */\n           LONGLONG nbytes,    /* I - size of block of bytes to shift          */\n           LONGLONG nshift,    /* I - size of shift in bytes (+ or -)          */\n           int *status)     /* IO - error status                            */\n/*\n    Shift block of bytes by nshift bytes (positive or negative).\n    A positive nshift value moves the block down further in the file, while a\n    negative value shifts the block towards the beginning of the file.\n*/\n{\n#define shftbuffsize 100000\n    long ntomov;\n    LONGLONG ptr, ntodo;\n    char buffer[shftbuffsize];\n\n    if (*status > 0)\n        return(*status);\n\n    ntodo = nbytes;   /* total number of bytes to shift */\n\n    if (nshift > 0)\n            /* start at the end of the block and work backwards */\n            ptr = firstbyte + nbytes;\n    else\n            /* start at the beginning of the block working forwards */\n            ptr = firstbyte;\n\n    while (ntodo)\n    {\n        /* number of bytes to move at one time */\n        ntomov = (long) (minvalue(ntodo, shftbuffsize));\n\n        if (nshift > 0)     /* if moving block down ... */\n            ptr -= ntomov;\n\n        /* move to position and read the bytes to be moved */\n\n        ffmbyt(fptr, ptr, REPORT_EOF, status);\n        ffgbyt(fptr, ntomov, buffer, status);\n\n        /* move by shift amount and write the bytes */\n        ffmbyt(fptr, ptr + nshift, IGNORE_EOF, status);\n        if (ffpbyt(fptr, ntomov, buffer, status) > 0)\n        {\n           ffpmsg(\"Error while shifting block (ffshft)\");\n           return(*status);\n        }\n\n        ntodo -= ntomov;\n        if (nshift < 0)     /* if moving block up ... */\n            ptr += ntomov;\n    }\n\n    /* now overwrite the old data with fill */\n    if ((fptr->Fptr)->hdutype == ASCII_TBL)\n       memset(buffer, 32, shftbuffsize); /* fill ASCII tables with spaces */\n    else\n       memset(buffer,  0, shftbuffsize); /* fill other HDUs with zeros */\n\n\n    if (nshift < 0)\n    {\n        ntodo = -nshift;\n        /* point to the end of the shifted block */\n        ptr = firstbyte + nbytes + nshift;\n    }\n    else\n    {\n        ntodo = nshift;\n        /* point to original beginning of the block */\n        ptr = firstbyte;\n    }\n\n    ffmbyt(fptr, ptr, REPORT_EOF, status);\n\n    while (ntodo)\n    {\n        ntomov = (long) (minvalue(ntodo, shftbuffsize));\n        ffpbyt(fptr, ntomov, buffer, status);\n        ntodo -= ntomov;\n    }\n    return(*status);\n}\n"},{"id":16672,"name":"drvrsmem.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*              S H A R E D   M E M O R Y   D R I V E R\n                =======================================\n\n                  by Jerzy.Borkowski@obs.unige.ch\n\n09-Mar-98 : initial version 1.0 released\n23-Mar-98 : shared_malloc now accepts new handle as an argument\n23-Mar-98 : shmem://0, shmem://1, etc changed to shmem://h0, etc due to bug\n            in url parser.\n10-Apr-98 : code cleanup\n13-May-99 : delayed initialization added, global table deleted on exit when\n            no shmem segments remain, and last process terminates\n*/\n\n#ifdef HAVE_SHMEM_SERVICES\n#include \"fitsio2.h\"                         /* drvrsmem.h is included by it */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <errno.h>\n#include <sys/types.h>\n#include <sys/stat.h>\n#include <fcntl.h>\n\n#if defined(unix) || defined(__unix__)  || defined(__unix) || defined(HAVE_UNISTD_H)\n#include <unistd.h> \n#endif\n\n\nstatic int shared_kbase = 0;                    /* base for shared memory handles */\nstatic int shared_maxseg = 0;                   /* max number of shared memory blocks */\nstatic int shared_range = 0;                    /* max number of tried entries */\nstatic int shared_fd = SHARED_INVALID;          /* handle of global access lock file */\nstatic int shared_gt_h = SHARED_INVALID;        /* handle of global table segment */\nstatic SHARED_LTAB *shared_lt = NULL;           /* local table pointer */\nstatic SHARED_GTAB *shared_gt = NULL;           /* global table pointer */\nstatic int shared_create_mode = 0666;           /* permission flags for created objects */\nstatic int shared_debug = 1;                    /* simple debugging tool, set to 0 to disable messages */\nstatic int shared_init_called = 0;              /* flag whether shared_init() has been called, used for delayed init */\n\n                /* static support routines prototypes */\n\nstatic  int shared_clear_entry(int idx);        /* unconditionally clear entry */\nstatic  int shared_destroy_entry(int idx);      /* unconditionally destroy sema & shseg and clear entry */\nstatic  int shared_mux(int idx, int mode);      /* obtain exclusive access to specified segment */\nstatic  int shared_demux(int idx, int mode);    /* free exclusive access to specified segment */\n\nstatic  int shared_process_count(int sem);      /* valid only for time of invocation */\nstatic  int shared_delta_process(int sem, int delta); /* change number of processes hanging on segment */\nstatic  int shared_attach_process(int sem);\nstatic  int shared_detach_process(int sem);\nstatic  int shared_get_free_entry(int newhandle);       /* get free entry in shared_key, or -1, entry is set rw locked */\nstatic  int shared_get_hash(long size, int idx);/* return hash value for malloc */\nstatic  long shared_adjust_size(long size);     /* size must be >= 0 !!! */\nstatic  int shared_check_locked_index(int idx); /* verify that given idx is valid */ \nstatic  int shared_map(int idx);                /* map all tables for given idx, check for validity */\nstatic  int shared_validate(int idx, int mode); /* use intrnally inside crit.sect !!! */\n\n                /* support routines - initialization */\n\n\nstatic  int shared_clear_entry(int idx)         /* unconditionally clear entry */\n { if ((idx < 0) || (idx >= shared_maxseg)) return(SHARED_BADARG);\n   shared_gt[idx].key = SHARED_INVALID;         /* clear entries in global table */\n   shared_gt[idx].handle = SHARED_INVALID;\n   shared_gt[idx].sem = SHARED_INVALID;\n   shared_gt[idx].semkey = SHARED_INVALID;\n   shared_gt[idx].nprocdebug = 0;\n   shared_gt[idx].size = 0;\n   shared_gt[idx].attr = 0;\n\n   return(SHARED_OK);\n }\n\nstatic  int shared_destroy_entry(int idx)       /* unconditionally destroy sema & shseg and clear entry */\n { int r, r2;\n   union semun filler;\n\n   if ((idx < 0) || (idx >= shared_maxseg)) return(SHARED_BADARG);\n   r2 = r = SHARED_OK;\n   filler.val = 0;                              /* this is to make cc happy (warning otherwise) */\n   if (SHARED_INVALID != shared_gt[idx].sem)  r = semctl(shared_gt[idx].sem, 0, IPC_RMID, filler); /* destroy semaphore */\n   if (SHARED_INVALID != shared_gt[idx].handle) r2 = shmctl(shared_gt[idx].handle, IPC_RMID, 0); /* destroy shared memory segment */\n   if (SHARED_OK == r) r = r2;                  /* accumulate error code in r, free r2 */\n   r2 = shared_clear_entry(idx);\n   return((SHARED_OK == r) ? r2 : r);\n }\n\nvoid    shared_cleanup(void)                    /* this must (should) be called during exit/abort */\n { int          i, j, r, oktodelete, filelocked, segmentspresent;\n   flock_t      flk;\n   struct shmid_ds  ds;\n\n   if (shared_debug) printf(\"shared_cleanup:\");\n   if (NULL != shared_lt)\n     { if (shared_debug) printf(\" deleting segments:\");\n       for (i=0; i<shared_maxseg; i++)\n        { if (0 == shared_lt[i].tcnt) continue; /* we're not using this segment, skip this ... */\n          if (-1 != shared_lt[i].lkcnt) continue;  /* seg not R/W locked by us, skip this ... */\n\n          r = shared_destroy_entry(i);          /* destroy unconditionally sema & segment */\n          if (shared_debug) \n            { if (SHARED_OK == r) printf(\" [%d]\", i);\n              else printf(\" [error on %d !!!!]\", i);\n\n            }\n        }\n       free((void *)shared_lt);                 /* free local table */\n       shared_lt = NULL;\n     }\n   if (NULL != shared_gt)                       /* detach global index table */\n     { oktodelete = 0;\n       filelocked = 0;\n       if (shared_debug) printf(\" detaching globalsharedtable\");\n       if (SHARED_INVALID != shared_fd)\n\n       flk.l_type = F_WRLCK;                    /* lock whole lock file */\n       flk.l_whence = 0;\n       flk.l_start = 0;\n       flk.l_len = shared_maxseg;\n       if (-1 != fcntl(shared_fd, F_SETLK, &flk))\n         { filelocked = 1;                      /* success, scan global table, to see if there are any segs */\n           segmentspresent = 0;                 /* assume, there are no segs in the system */\n           for (j=0; j<shared_maxseg; j++)\n            { if (SHARED_INVALID != shared_gt[j].key)\n                { segmentspresent = 1;          /* yes, there is at least one */\n                  break;\n                }\n            }\n           if (0 == segmentspresent)            /* if there are no segs ... */\n             if (0 == shmctl(shared_gt_h, IPC_STAT, &ds)) /* get number of processes attached to table */\n               { if (ds.shm_nattch <= 1) oktodelete = 1; /* if only one (we), then it is safe (but see text 4 lines later) to unlink */\n               }\n         }\n       shmdt((char *)shared_gt);                /* detach global table */\n       if (oktodelete)                          /* delete global table from system, if no shm seg present */\n         { shmctl(shared_gt_h, IPC_RMID, 0);    /* there is a race condition here - time window between shmdt and shmctl */\n           shared_gt_h = SHARED_INVALID;\n         }\n       shared_gt = NULL;\n       if (filelocked)                          /* if we locked, we need to unlock */\n         { flk.l_type = F_UNLCK;\n           flk.l_whence = 0;\n           flk.l_start = 0;\n           flk.l_len = shared_maxseg;\n           fcntl(shared_fd, F_SETLK, &flk);\n         }\n     }\n   shared_gt_h = SHARED_INVALID;\n\n   if (SHARED_INVALID != shared_fd)             /* close lock file */\n     { if (shared_debug) printf(\" closing lockfile\");\n       close(shared_fd);\n       shared_fd = SHARED_INVALID;\n     }\n\n   \n   shared_kbase = 0;\n   shared_maxseg = 0;\n   shared_range = 0;\n   shared_init_called = 0;\n\n   if (shared_debug) printf(\" <<done>>\\n\");\n   return;\n }\n\n\nint     shared_init(int debug_msgs)             /* initialize shared memory stuff, you have to call this routine once */\n { int i;\n   char buf[1000], *p;\n   mode_t oldumask;\n\n   shared_init_called = 1;                      /* tell everybody no need to call us for the 2nd time */\n   shared_debug = debug_msgs;                   /* set required debug mode */\n   \n   if (shared_debug) printf(\"shared_init:\");\n\n   shared_kbase = 0;                            /* adapt to current env. settings */\n   if (NULL != (p = getenv(SHARED_ENV_KEYBASE))) shared_kbase = atoi(p);\n   if (0 == shared_kbase) shared_kbase = SHARED_KEYBASE;\n   if (shared_debug) printf(\" keybase=%d\", shared_kbase);\n\n   shared_maxseg = 0;\n   if (NULL != (p = getenv(SHARED_ENV_MAXSEG))) shared_maxseg = atoi(p);\n   if (0 == shared_maxseg) shared_maxseg = SHARED_MAXSEG;\n   if (shared_debug) printf(\" maxseg=%d\", shared_maxseg);\n   \n   shared_range = 3 * shared_maxseg;\n\n   if (SHARED_INVALID == shared_fd)             /* create rw locking file (this file is never deleted) */\n     { if (shared_debug) printf(\" lockfileinit=\");\n       snprintf(buf, 1000,\"%s.%d.%d\", SHARED_FDNAME, shared_kbase, shared_maxseg);\n       oldumask = umask(0);\n\n       shared_fd = open(buf, O_TRUNC | O_EXCL | O_CREAT | O_RDWR, shared_create_mode);\n       umask(oldumask);\n       if (SHARED_INVALID == shared_fd)         /* or just open rw locking file, in case it already exists */\n         { shared_fd = open(buf, O_TRUNC | O_RDWR, shared_create_mode);\n           if (SHARED_INVALID == shared_fd) return(SHARED_NOFILE);\n           if (shared_debug) printf(\"slave\");\n\n         }\n       else\n         { if (shared_debug) printf(\"master\");\n         }\n     }\n\n   if (SHARED_INVALID == shared_gt_h)           /* global table not attached, try to create it in shared memory */\n     { if (shared_debug) printf(\" globalsharedtableinit=\");\n       shared_gt_h = shmget(shared_kbase, shared_maxseg * sizeof(SHARED_GTAB), IPC_CREAT | IPC_EXCL | shared_create_mode); /* try open as a master */\n       if (SHARED_INVALID == shared_gt_h)       /* if failed, try to open as a slave */\n         { shared_gt_h = shmget(shared_kbase, shared_maxseg * sizeof(SHARED_GTAB), shared_create_mode);\n           if (SHARED_INVALID == shared_gt_h) return(SHARED_IPCERR); /* means deleted ID residing in system, shared mem unusable ... */\n           shared_gt = (SHARED_GTAB *)shmat(shared_gt_h, 0, 0); /* attach segment */\n           if (((SHARED_GTAB *)SHARED_INVALID) == shared_gt) return(SHARED_IPCERR);\n           if (shared_debug) printf(\"slave\");\n         }\n       else\n         { shared_gt = (SHARED_GTAB *)shmat(shared_gt_h, 0, 0); /* attach segment */\n           if (((SHARED_GTAB *)SHARED_INVALID) == shared_gt) return(SHARED_IPCERR);\n           for (i=0; i<shared_maxseg; i++) shared_clear_entry(i);       /* since we are master, init data */\n           if (shared_debug) printf(\"master\");\n         }\n     }\n\n   if (NULL == shared_lt)                       /* initialize local table */\n     { if (shared_debug) printf(\" localtableinit=\");\n       if (NULL == (shared_lt = (SHARED_LTAB *)malloc(shared_maxseg * sizeof(SHARED_LTAB)))) return(SHARED_NOMEM);\n       for (i=0; i<shared_maxseg; i++)\n        { shared_lt[i].p = NULL;                /* not mapped */\n          shared_lt[i].tcnt = 0;                /* unused (or zero threads using this seg) */\n          shared_lt[i].lkcnt = 0;               /* segment is unlocked */\n          shared_lt[i].seekpos = 0L;            /* r/w pointer at the beginning of file */\n        }\n       if (shared_debug) printf(\"ok\");\n     }\n\n   atexit(shared_cleanup);                      /* we want shared_cleanup to be called at exit or abort */\n\n   if (shared_debug) printf(\" <<done>>\\n\");\n   return(SHARED_OK);\n }\n\n\nint     shared_recover(int id)                  /* try to recover dormant segments after applic crash */\n { int i, r, r2;\n\n   if (NULL == shared_gt) return(SHARED_NOTINIT);       /* not initialized */\n   if (NULL == shared_lt) return(SHARED_NOTINIT);       /* not initialized */\n   r = SHARED_OK;\n   for (i=0; i<shared_maxseg; i++)\n    { if (-1 != id) if (i != id) continue;\n      if (shared_lt[i].tcnt) continue;          /* somebody (we) is using it */\n      if (SHARED_INVALID == shared_gt[i].key) continue; /* unused slot */\n      if (shared_mux(i, SHARED_NOWAIT | SHARED_RDWRITE)) continue; /* acquire exclusive access to segment, but do not wait */\n      r2 = shared_process_count(shared_gt[i].sem);\n      if ((shared_gt[i].nprocdebug > r2) || (0 == r2))\n        { if (shared_debug) printf(\"Bogus handle=%d nproc=%d sema=%d:\", i, shared_gt[i].nprocdebug, r2);\n          r = shared_destroy_entry(i);\n          if (shared_debug)\n            { printf(\"%s\", r ? \"error couldn't clear handle\" : \"handle cleared\");\n            }\n        }\n      shared_demux(i, SHARED_RDWRITE);\n    }\n   return(r);                                           /* table full */\n }\n\n                /* API routines - mutexes and locking */\n\nstatic  int shared_mux(int idx, int mode)       /* obtain exclusive access to specified segment */\n { flock_t flk;\n\n   int r;\n\n   if (0 == shared_init_called)                 /* delayed initialization */\n     { if (SHARED_OK != (r = shared_init(0))) return(r);\n\n     }\n   if (SHARED_INVALID == shared_fd) return(SHARED_NOTINIT);\n   if ((idx < 0) || (idx >= shared_maxseg)) return(SHARED_BADARG);\n   flk.l_type = ((mode & SHARED_RDWRITE) ? F_WRLCK : F_RDLCK);\n   flk.l_whence = 0;\n   flk.l_start = idx;\n   flk.l_len = 1;\n   if (shared_debug) printf(\" [mux (%d): \", idx);\n   if (-1 == fcntl(shared_fd, ((mode & SHARED_NOWAIT) ? F_SETLK : F_SETLKW), &flk))\n     { switch (errno)\n        { case EAGAIN: ;\n\n          case EACCES: if (shared_debug) printf(\"again]\");\n                       return(SHARED_AGAIN);\n          default:     if (shared_debug) printf(\"err]\");\n                       return(SHARED_IPCERR);\n        }\n     }\n   if (shared_debug) printf(\"ok]\");\n   return(SHARED_OK);\n }\n\n\n\nstatic  int shared_demux(int idx, int mode)     /* free exclusive access to specified segment */\n { flock_t flk;\n\n   if (SHARED_INVALID == shared_fd) return(SHARED_NOTINIT);\n   if ((idx < 0) || (idx >= shared_maxseg)) return(SHARED_BADARG);\n   flk.l_type = F_UNLCK;\n   flk.l_whence = 0;\n   flk.l_start = idx;\n   flk.l_len = 1;\n   if (shared_debug) printf(\" [demux (%d): \", idx);\n   if (-1 == fcntl(shared_fd, F_SETLKW, &flk))\n     { switch (errno)\n        { case EAGAIN: ;\n          case EACCES: if (shared_debug) printf(\"again]\");\n                       return(SHARED_AGAIN);\n          default:     if (shared_debug) printf(\"err]\");\n                       return(SHARED_IPCERR);\n        }\n\n     }\n   if (shared_debug) printf(\"mode=%d ok]\", mode);\n   return(SHARED_OK);\n }\n\n\n\nstatic int shared_process_count(int sem)                /* valid only for time of invocation */\n { union semun su;\n\n   su.val = 0;                                          /* to force compiler not to give warning messages */\n   return(semctl(sem, 0, GETVAL, su));                  /* su is unused here */\n }\n\n\nstatic int shared_delta_process(int sem, int delta)     /* change number of processes hanging on segment */\n { struct sembuf sb;\n \n   if (SHARED_INVALID == sem) return(SHARED_BADARG);    /* semaphore not attached */\n   sb.sem_num = 0;\n   sb.sem_op = delta;\n   sb.sem_flg = SEM_UNDO;\n   return((-1 == semop(sem, &sb, 1)) ? SHARED_IPCERR : SHARED_OK);\n }\n\n\nstatic int shared_attach_process(int sem)\n { if (shared_debug) printf(\" [attach process]\");\n   return(shared_delta_process(sem, 1));\n }\n\n\nstatic int shared_detach_process(int sem)\n { if (shared_debug) printf(\" [detach process]\");\n   return(shared_delta_process(sem, -1));\n }\n\n                /* API routines - hashing and searching */\n\n\nstatic int shared_get_free_entry(int newhandle)         /* get newhandle, or -1, entry is set rw locked */\n {\n   if (NULL == shared_gt) return(-1);                   /* not initialized */\n   if (NULL == shared_lt) return(-1);                   /* not initialized */\n   if (newhandle < 0) return(-1);\n   if (newhandle >= shared_maxseg) return(-1);\n   if (shared_lt[newhandle].tcnt) return(-1);                   /* somebody (we) is using it */\n   if (shared_mux(newhandle, SHARED_NOWAIT | SHARED_RDWRITE)) return(-1); /* used by others */\n   if (SHARED_INVALID == shared_gt[newhandle].key) return(newhandle); /* we have found free slot, lock it and return index */\n   shared_demux(newhandle, SHARED_RDWRITE);\n   if (shared_debug) printf(\"[free_entry - ERROR - entry unusable]\");\n   return(-1);                                          /* table full */\n }\n\n\nstatic int shared_get_hash(long size, int idx)  /* return hash value for malloc */\n { static int counter = 0;\n   int hash;\n\n   hash = (counter + size * idx) % shared_range;\n   counter = (counter + 1) % shared_range;\n   return(hash);\n }\n\n\nstatic  long shared_adjust_size(long size)              /* size must be >= 0 !!! */\n { return(((size + sizeof(BLKHEAD) + SHARED_GRANUL - 1) / SHARED_GRANUL) * SHARED_GRANUL); }\n\n\n                /* API routines - core : malloc/realloc/free/attach/detach/lock/unlock */\n\nint     shared_malloc(long size, int mode, int newhandle)               /* return idx or SHARED_INVALID */\n { int h, i, r, idx, key;\n   union semun filler;\n   BLKHEAD *bp;\n   \n   if (0 == shared_init_called)                 /* delayed initialization */\n     { if (SHARED_OK != (r = shared_init(0))) return(r);\n     }\n   if (shared_debug) printf(\"malloc (size = %ld, mode = %d):\", size, mode);\n   if (size < 0) return(SHARED_INVALID);\n   if (-1 == (idx = shared_get_free_entry(newhandle)))  return(SHARED_INVALID);\n   if (shared_debug) printf(\" idx=%d\", idx);\n   for (i = 0; ; i++)\n    { if (i >= shared_range)                            /* table full, signal error & exit */\n        { shared_demux(idx, SHARED_RDWRITE);\n          return(SHARED_INVALID);\n        }\n      key = shared_kbase + ((i + shared_get_hash(size, idx)) % shared_range);\n      if (shared_debug) printf(\" key=%d\", key);\n      h = shmget(key, shared_adjust_size(size), IPC_CREAT | IPC_EXCL | shared_create_mode);\n      if (shared_debug) printf(\" handle=%d\", h);\n      if (SHARED_INVALID == h) continue;                /* segment already accupied */\n      bp = (BLKHEAD *)shmat(h, 0, 0);                   /* try attach */\n      if (shared_debug) printf(\" p=%p\", bp);\n      if (((BLKHEAD *)SHARED_INVALID) == bp)            /* cannot attach, delete segment, try with another key */\n        { shmctl(h, IPC_RMID, 0);\n          continue;\n        }                                               /* now create semaphor counting number of processes attached */\n      if (SHARED_INVALID == (shared_gt[idx].sem = semget(key, 1, IPC_CREAT | IPC_EXCL | shared_create_mode)))\n        { shmdt((void *)bp);                            /* cannot create segment, delete everything */\n          shmctl(h, IPC_RMID, 0);\n          continue;                                     /* try with another key */\n        }\n      if (shared_debug) printf(\" sem=%d\", shared_gt[idx].sem);\n      if (shared_attach_process(shared_gt[idx].sem))    /* try attach process */\n        { semctl(shared_gt[idx].sem, 0, IPC_RMID, filler);      /* destroy semaphore */\n          shmdt((char *)bp);                            /* detach shared mem segment */\n          shmctl(h, IPC_RMID, 0);                       /* destroy shared mem segment */\n          continue;                                     /* try with another key */\n        }\n      bp->s.tflag = BLOCK_SHARED;                       /* fill in data in segment's header (this is really not necessary) */\n      bp->s.ID[0] = SHARED_ID_0;\n      bp->s.ID[1] = SHARED_ID_1;\n      bp->s.handle = idx;                               /* used in yorick */\n      if (mode & SHARED_RESIZE)\n        { if (shmdt((char *)bp)) r = SHARED_IPCERR;     /* if segment is resizable, then detach segment */\n          shared_lt[idx].p = NULL;\n        }\n      else  { shared_lt[idx].p = bp; }\n      shared_lt[idx].tcnt = 1;                          /* one thread using segment */\n      shared_lt[idx].lkcnt = 0;                         /* no locks at the moment */\n      shared_lt[idx].seekpos = 0L;                      /* r/w pointer positioned at beg of block */\n      shared_gt[idx].handle = h;                        /* fill in data in global table */\n      shared_gt[idx].size = size;\n      shared_gt[idx].attr = mode;\n      shared_gt[idx].semkey = key;\n      shared_gt[idx].key = key;\n      shared_gt[idx].nprocdebug = 0;\n\n      break;\n    }\n   shared_demux(idx, SHARED_RDWRITE);                   /* hope this will not fail */\n   return(idx);\n }\n\n\nint     shared_attach(int idx)\n { int r, r2;\n\n   if (SHARED_OK != (r = shared_mux(idx, SHARED_RDWRITE | SHARED_WAIT))) return(r);\n   if (SHARED_OK != (r = shared_map(idx)))\n     { shared_demux(idx, SHARED_RDWRITE);\n       return(r);\n     }\n   if (shared_attach_process(shared_gt[idx].sem))       /* try attach process */\n     { shmdt((char *)(shared_lt[idx].p));               /* cannot attach process, detach everything */\n       shared_lt[idx].p = NULL;\n       shared_demux(idx, SHARED_RDWRITE);\n       return(SHARED_BADARG);\n     }\n   shared_lt[idx].tcnt++;                               /* one more thread is using segment */\n   if (shared_gt[idx].attr & SHARED_RESIZE)             /* if resizeable, detach and return special pointer */\n     { if (shmdt((char *)(shared_lt[idx].p))) r = SHARED_IPCERR;  /* if segment is resizable, then detach segment */\n       shared_lt[idx].p = NULL;\n     }\n   shared_lt[idx].seekpos = 0L;                         /* r/w pointer positioned at beg of block */\n   r2 = shared_demux(idx, SHARED_RDWRITE);\n   return(r ? r : r2);\n }\n\n\n\nstatic int      shared_check_locked_index(int idx)      /* verify that given idx is valid */ \n { int r;\n\n   if (0 == shared_init_called)                         /* delayed initialization */\n     { if (SHARED_OK != (r = shared_init(0))) return(r);\n\n     }\n   if ((idx < 0) || (idx >= shared_maxseg)) return(SHARED_BADARG);\n   if (NULL == shared_lt[idx].p) return(SHARED_BADARG); /* NULL pointer, not attached ?? */\n   if (0 == shared_lt[idx].lkcnt) return(SHARED_BADARG); /* not locked ?? */\n   if ((SHARED_ID_0 != (shared_lt[idx].p)->s.ID[0]) || (SHARED_ID_1 != (shared_lt[idx].p)->s.ID[1]) || \n       (BLOCK_SHARED != (shared_lt[idx].p)->s.tflag))   /* invalid data in segment */\n     return(SHARED_BADARG);\n   return(SHARED_OK);\n }\n\n\n\nstatic int      shared_map(int idx)                     /* map all tables for given idx, check for validity */\n { int h;                                               /* have to obtain excl. access before calling shared_map */\n   BLKHEAD *bp;\n\n   if ((idx < 0) || (idx >= shared_maxseg)) return(SHARED_BADARG);\n   if (SHARED_INVALID == shared_gt[idx].key)  return(SHARED_BADARG);\n   if (SHARED_INVALID == (h = shmget(shared_gt[idx].key, 1, shared_create_mode)))  return(SHARED_BADARG);\n   if (((BLKHEAD *)SHARED_INVALID) == (bp = (BLKHEAD *)shmat(h, 0, 0)))  return(SHARED_BADARG);\n   if ((SHARED_ID_0 != bp->s.ID[0]) || (SHARED_ID_1 != bp->s.ID[1]) || (BLOCK_SHARED != bp->s.tflag) || (h != shared_gt[idx].handle))\n     { shmdt((char *)bp);                               /* invalid segment, detach everything */\n       return(SHARED_BADARG);\n\n     }\n   if (shared_gt[idx].sem != semget(shared_gt[idx].semkey, 1, shared_create_mode)) /* check if sema is still there */\n     { shmdt((char *)bp);                               /* cannot attach semaphore, detach everything */\n       return(SHARED_BADARG);\n     }\n   shared_lt[idx].p = bp;                               /* store pointer to shmem data */\n   return(SHARED_OK);\n }\n\n\nstatic  int     shared_validate(int idx, int mode)      /* use intrnally inside crit.sect !!! */\n { int r;\n\n   if (SHARED_OK != (r = shared_mux(idx, mode)))  return(r);            /* idx checked by shared_mux */\n   if (NULL == shared_lt[idx].p)\n     if (SHARED_OK != (r = shared_map(idx)))\n       { shared_demux(idx, mode); \n         return(r);\n       }\n   if ((SHARED_ID_0 != (shared_lt[idx].p)->s.ID[0]) || (SHARED_ID_1 != (shared_lt[idx].p)->s.ID[1]) || (BLOCK_SHARED != (shared_lt[idx].p)->s.tflag))\n     { shared_demux(idx, mode);\n       return(r);\n     }\n   return(SHARED_OK);\n }\n\n\nSHARED_P shared_realloc(int idx, long newsize)  /* realloc shared memory segment */\n { int h, key, i, r;\n   BLKHEAD *bp;\n   long transfersize;\n\n   r = SHARED_OK;\n   if (newsize < 0) return(NULL);\n   if (shared_check_locked_index(idx)) return(NULL);\n   if (0 == (shared_gt[idx].attr & SHARED_RESIZE)) return(NULL);\n   if (-1 != shared_lt[idx].lkcnt) return(NULL); /* check for RW lock */\n   if (shared_adjust_size(shared_gt[idx].size) == shared_adjust_size(newsize))\n     { shared_gt[idx].size = newsize;\n\n       return((SHARED_P)((shared_lt[idx].p) + 1));\n     }\n   for (i = 0; ; i++)\n    { if (i >= shared_range)  return(NULL);     /* table full, signal error & exit */\n      key = shared_kbase + ((i + shared_get_hash(newsize, idx)) % shared_range);\n      h = shmget(key, shared_adjust_size(newsize), IPC_CREAT | IPC_EXCL | shared_create_mode);\n      if (SHARED_INVALID == h) continue;        /* segment already accupied */\n      bp = (BLKHEAD *)shmat(h, 0, 0);           /* try attach */\n      if (((BLKHEAD *)SHARED_INVALID) == bp)    /* cannot attach, delete segment, try with another key */\n        { shmctl(h, IPC_RMID, 0);\n          continue;\n        }\n      *bp = *(shared_lt[idx].p);                /* copy header, then data */\n      transfersize = ((newsize < shared_gt[idx].size) ? newsize : shared_gt[idx].size);\n      if (transfersize > 0)\n        memcpy((void *)(bp + 1), (void *)((shared_lt[idx].p) + 1), transfersize);\n      if (shmdt((char *)(shared_lt[idx].p))) r = SHARED_IPCERR; /* try to detach old segment */\n      if (shmctl(shared_gt[idx].handle, IPC_RMID, 0)) if (SHARED_OK == r) r = SHARED_IPCERR;  /* destroy old shared memory segment */\n      shared_gt[idx].size = newsize;            /* signal new size */\n      shared_gt[idx].handle = h;                /* signal new handle */\n      shared_gt[idx].key = key;                 /* signal new key */\n      shared_lt[idx].p = bp;\n      break;\n    }\n   return((SHARED_P)(bp + 1));\n }\n\n\nint     shared_free(int idx)                    /* detach segment, if last process & !PERSIST, destroy segment */\n { int cnt, r, r2;\n\n   if (SHARED_OK != (r = shared_validate(idx, SHARED_RDWRITE | SHARED_WAIT))) return(r);\n   if (SHARED_OK != (r = shared_detach_process(shared_gt[idx].sem)))    /* update number of processes using segment */\n     { shared_demux(idx, SHARED_RDWRITE);\n       return(r);\n     }\n   shared_lt[idx].tcnt--;                       /* update number of threads using segment */\n   if (shared_lt[idx].tcnt > 0)  return(shared_demux(idx, SHARED_RDWRITE));  /* if more threads are using segment we are done */\n   if (shmdt((char *)(shared_lt[idx].p)))       /* if, we are the last thread, try to detach segment */\n     { shared_demux(idx, SHARED_RDWRITE);\n       return(SHARED_IPCERR);\n     }\n   shared_lt[idx].p = NULL;                     /* clear entry in local table */\n   shared_lt[idx].seekpos = 0L;                 /* r/w pointer positioned at beg of block */\n   if (-1 == (cnt = shared_process_count(shared_gt[idx].sem))) /* get number of processes hanging on segment */\n     { shared_demux(idx, SHARED_RDWRITE);\n       return(SHARED_IPCERR);\n     }\n   if ((0 == cnt) && (0 == (shared_gt[idx].attr & SHARED_PERSIST)))  r = shared_destroy_entry(idx); /* no procs on seg, destroy it */\n   r2 = shared_demux(idx, SHARED_RDWRITE);\n   return(r ? r : r2);\n }\n\n\nSHARED_P shared_lock(int idx, int mode)         /* lock given segment for exclusive access */\n { int r;\n\n   if (shared_mux(idx, mode))  return(NULL);    /* idx checked by shared_mux */\n   if (0 != shared_lt[idx].lkcnt)               /* are we already locked ?? */\n     if (SHARED_OK != (r = shared_map(idx)))\n       { shared_demux(idx, mode); \n         return(NULL);\n       }\n   if (NULL == shared_lt[idx].p)                /* stupid pointer ?? */\n     if (SHARED_OK != (r = shared_map(idx)))\n       { shared_demux(idx, mode); \n         return(NULL);\n       }\n   if ((SHARED_ID_0 != (shared_lt[idx].p)->s.ID[0]) || (SHARED_ID_1 != (shared_lt[idx].p)->s.ID[1]) || (BLOCK_SHARED != (shared_lt[idx].p)->s.tflag))\n     { shared_demux(idx, mode);\n       return(NULL);\n     }\n   if (mode & SHARED_RDWRITE)\n     { shared_lt[idx].lkcnt = -1;\n\n       shared_gt[idx].nprocdebug++;\n     }\n\n   else shared_lt[idx].lkcnt++;\n   shared_lt[idx].seekpos = 0L;                 /* r/w pointer positioned at beg of block */\n   return((SHARED_P)((shared_lt[idx].p) + 1));\n }\n\n\nint     shared_unlock(int idx)                  /* unlock given segment, assumes seg is locked !! */\n { int r, r2, mode;\n\n   if (SHARED_OK != (r = shared_check_locked_index(idx))) return(r);\n   if (shared_lt[idx].lkcnt > 0)\n     { shared_lt[idx].lkcnt--;                  /* unlock read lock */\n       mode = SHARED_RDONLY;\n     }\n   else\n     { shared_lt[idx].lkcnt = 0;                /* unlock write lock */\n       shared_gt[idx].nprocdebug--;\n       mode = SHARED_RDWRITE;\n     }\n   if (0 == shared_lt[idx].lkcnt) if (shared_gt[idx].attr & SHARED_RESIZE)\n     { if (shmdt((char *)(shared_lt[idx].p))) r = SHARED_IPCERR; /* segment is resizable, then detach segment */\n       shared_lt[idx].p = NULL;                 /* signal detachment in local table */\n     }\n   r2 = shared_demux(idx, mode);                /* unlock segment, rest is only parameter checking */\n   return(r ? r : r2);\n }\n\n                /* API routines - support and info routines */\n\n\nint     shared_attr(int idx)                    /* get the attributes of the shared memory segment */\n { int r;\n\n   if (shared_check_locked_index(idx)) return(SHARED_INVALID);\n   r = shared_gt[idx].attr;\n   return(r);\n }\n\n\nint     shared_set_attr(int idx, int newattr)   /* get the attributes of the shared memory segment */\n { int r;\n\n   if (shared_check_locked_index(idx)) return(SHARED_INVALID);\n   if (-1 != shared_lt[idx].lkcnt) return(SHARED_INVALID); /* ADDED - check for RW lock */\n   r = shared_gt[idx].attr;\n   shared_gt[idx].attr = newattr;\n   return(r);\n\n }\n\n\nint     shared_set_debug(int mode)              /* set/reset debug mode */\n { int r = shared_debug;\n\n   shared_debug = mode;\n   return(r);\n }\n\n\nint     shared_set_createmode(int mode)          /* set/reset debug mode */\n { int r = shared_create_mode;\n\n   shared_create_mode = mode;\n   return(r);\n }\n\n\n\n\nint     shared_list(int id)\n { int i, r;\n\n   if (NULL == shared_gt) return(SHARED_NOTINIT);       /* not initialized */\n   if (NULL == shared_lt) return(SHARED_NOTINIT);       /* not initialized */\n   if (shared_debug) printf(\"shared_list:\");\n   r = SHARED_OK;\n   printf(\" Idx    Key   Nproc   Size   Flags\\n\");\n   printf(\"==============================================\\n\");\n   for (i=0; i<shared_maxseg; i++)\n    { if (-1 != id) if (i != id) continue;\n      if (SHARED_INVALID == shared_gt[i].key) continue; /* unused slot */\n      switch (shared_mux(i, SHARED_NOWAIT | SHARED_RDONLY)) /* acquire exclusive access to segment, but do not wait */\n\n       { case SHARED_AGAIN:\n                printf(\"!%3d %08lx %4d  %8d\", i, (unsigned long int)shared_gt[i].key,\n                                shared_gt[i].nprocdebug, shared_gt[i].size);\n                if (SHARED_RESIZE & shared_gt[i].attr) printf(\" RESIZABLE\");\n                if (SHARED_PERSIST & shared_gt[i].attr) printf(\" PERSIST\");\n                printf(\"\\n\");\n                break;\n         case SHARED_OK:\n                printf(\" %3d %08lx %4d  %8d\", i, (unsigned long int)shared_gt[i].key,\n\n                                shared_gt[i].nprocdebug, shared_gt[i].size);\n                if (SHARED_RESIZE & shared_gt[i].attr) printf(\" RESIZABLE\");\n                if (SHARED_PERSIST & shared_gt[i].attr) printf(\" PERSIST\");\n                printf(\"\\n\");\n                shared_demux(i, SHARED_RDONLY);\n                break;\n         default:\n                continue;\n       }\n    }\n   if (shared_debug) printf(\" done\\n\");\n   return(r);                                           /* table full */\n }\n\nint     shared_getaddr(int id, char **address)\n { int i;\n   char segname[10];\n\n   if (NULL == shared_gt) return(SHARED_NOTINIT);       /* not initialized */\n   if (NULL == shared_lt) return(SHARED_NOTINIT);       /* not initialized */\n \n   strcpy(segname,\"h\");\n   snprintf(segname+1,9,\"%d\", id);\n \n   if (smem_open(segname,0,&i)) return(SHARED_BADARG);\n \n   *address = ((char *)(((DAL_SHM_SEGHEAD *)(shared_lt[i].p + 1)) + 1));\n /*  smem_close(i); */\n   return(SHARED_OK);\n }\n\n\nint     shared_uncond_delete(int id)\n { int i, r;\n\n   if (NULL == shared_gt) return(SHARED_NOTINIT);       /* not initialized */\n   if (NULL == shared_lt) return(SHARED_NOTINIT);       /* not initialized */\n   if (shared_debug) printf(\"shared_uncond_delete:\");\n   r = SHARED_OK;\n   for (i=0; i<shared_maxseg; i++)\n    { if (-1 != id) if (i != id) continue;\n      if (shared_attach(i))\n        { if (-1 != id) printf(\"no such handle\\n\");\n          continue;\n        }\n      printf(\"handle %d:\", i);\n      if (NULL == shared_lock(i, SHARED_RDWRITE | SHARED_NOWAIT)) \n        { printf(\" cannot lock in RW mode, not deleted\\n\");\n          continue;\n        }\n      if (shared_set_attr(i, SHARED_RESIZE) >= SHARED_ERRBASE)\n        { printf(\" cannot clear PERSIST attribute\");\n        }\n      if (shared_free(i))\n        { printf(\" delete failed\\n\");\n        }\n      else\n        { printf(\" deleted\\n\");\n        }\n    }\n   if (shared_debug) printf(\" done\\n\");\n   return(r);                                           /* table full */\n }\n\n\n/************************* CFITSIO DRIVER FUNCTIONS ***************************/\n\nint     smem_init(void)\n { return(0);\n }\n\nint     smem_shutdown(void)\n\n { if (shared_init_called) shared_cleanup();\n   return(0);\n }\n\nint     smem_setoptions(int option)\n { option = 0;\n   return(0);\n }\n\n\nint     smem_getoptions(int *options)\n { if (NULL == options) return(SHARED_NULPTR);\n   *options = 0;\n   return(0);\n }\n\nint     smem_getversion(int *version)\n { if (NULL == version) return(SHARED_NULPTR);\n   *version = 10;\n   return(0);\n }\n\n\nint     smem_open(char *filename, int rwmode, int *driverhandle)\n { int h, nitems, r;\n   DAL_SHM_SEGHEAD *sp;\n\n\n   if (NULL == filename) return(SHARED_NULPTR);\n   if (NULL == driverhandle) return(SHARED_NULPTR);\n   nitems = sscanf(filename, \"h%d\", &h);\n   if (1 != nitems) return(SHARED_BADARG);\n\n   if (SHARED_OK != (r = shared_attach(h))) return(r);\n\n   if (NULL == (sp = (DAL_SHM_SEGHEAD *)shared_lock(h,\n                ((READWRITE == rwmode) ? SHARED_RDWRITE : SHARED_RDONLY))))\n     {  shared_free(h);\n        return(SHARED_BADARG);\n     }\n\n   if ((h != sp->h) || (DAL_SHM_SEGHEAD_ID != sp->ID))\n     { shared_unlock(h);\n       shared_free(h);\n\n       return(SHARED_BADARG);\n     }\n\n   *driverhandle = h;\n   return(0);\n }\n\n\nint     smem_create(char *filename, int *driverhandle)\n { DAL_SHM_SEGHEAD *sp;\n   int h, sz, nitems;\n\n   if (NULL == filename) return(SHARED_NULPTR);         /* currently ignored */\n   if (NULL == driverhandle) return(SHARED_NULPTR);\n   nitems = sscanf(filename, \"h%d\", &h);\n   if (1 != nitems) return(SHARED_BADARG);\n\n   if (SHARED_INVALID == (h = shared_malloc(sz = 2880 + sizeof(DAL_SHM_SEGHEAD), \n                        SHARED_RESIZE | SHARED_PERSIST, h)))\n     return(SHARED_NOMEM);\n\n   if (NULL == (sp = (DAL_SHM_SEGHEAD *)shared_lock(h, SHARED_RDWRITE)))\n     { shared_free(h);\n       return(SHARED_BADARG);\n     }\n\n   sp->ID = DAL_SHM_SEGHEAD_ID;\n   sp->h = h;\n   sp->size = sz;\n   sp->nodeidx = -1;\n\n   *driverhandle = h;\n   \n   return(0);\n }\n\n\nint     smem_close(int driverhandle)\n { int r;\n\n   if (SHARED_OK != (r = shared_unlock(driverhandle))) return(r);\n   return(shared_free(driverhandle));\n }\n\nint     smem_remove(char *filename)\n { int nitems, h, r;\n\n   if (NULL == filename) return(SHARED_NULPTR);\n   nitems = sscanf(filename, \"h%d\", &h);\n   if (1 != nitems) return(SHARED_BADARG);\n\n   if (0 == shared_check_locked_index(h))       /* are we locked ? */\n\n     { if (-1 != shared_lt[h].lkcnt)            /* are we locked RO ? */\n         { if (SHARED_OK != (r = shared_unlock(h))) return(r);  /* yes, so relock in RW */\n           if (NULL == shared_lock(h, SHARED_RDWRITE)) return(SHARED_BADARG);\n         }\n\n     }\n   else                                         /* not locked */\n     { if (SHARED_OK != (r = smem_open(filename, READWRITE, &h)))\n         return(r);                             /* so open in RW mode */\n     }\n\n   shared_set_attr(h, SHARED_RESIZE);           /* delete PERSIST attribute */\n   return(smem_close(h));                       /* detach segment (this will delete it) */\n }\n\nint     smem_size(int driverhandle, LONGLONG *size)\n {\n   if (NULL == size) return(SHARED_NULPTR);\n   if (shared_check_locked_index(driverhandle)) return(SHARED_INVALID);\n   *size = (LONGLONG) (shared_gt[driverhandle].size - sizeof(DAL_SHM_SEGHEAD));\n   return(0);\n }\n\nint     smem_flush(int driverhandle)\n {\n   if (shared_check_locked_index(driverhandle)) return(SHARED_INVALID);\n   return(0);\n }\n\nint     smem_seek(int driverhandle, LONGLONG offset)\n {\n   if (offset < 0) return(SHARED_BADARG);\n   if (shared_check_locked_index(driverhandle)) return(SHARED_INVALID);\n   shared_lt[driverhandle].seekpos = offset;\n   return(0);\n }\n\nint     smem_read(int driverhandle, void *buffer, long nbytes)\n {\n   if (NULL == buffer) return(SHARED_NULPTR);\n   if (shared_check_locked_index(driverhandle)) return(SHARED_INVALID);\n   if (nbytes < 0) return(SHARED_BADARG);\n   if ((shared_lt[driverhandle].seekpos + nbytes) > shared_gt[driverhandle].size)\n     return(SHARED_BADARG);             /* read beyond EOF */\n\n   memcpy(buffer,\n          ((char *)(((DAL_SHM_SEGHEAD *)(shared_lt[driverhandle].p + 1)) + 1)) +\n                shared_lt[driverhandle].seekpos,\n          nbytes);\n\n   shared_lt[driverhandle].seekpos += nbytes;\n   return(0);\n }\n\nint     smem_write(int driverhandle, void *buffer, long nbytes)\n {\n   if (NULL == buffer) return(SHARED_NULPTR);\n   if (shared_check_locked_index(driverhandle)) return(SHARED_INVALID);\n   if (-1 != shared_lt[driverhandle].lkcnt) return(SHARED_INVALID); /* are we locked RW ? */\n\n   if (nbytes < 0) return(SHARED_BADARG);\n   if ((unsigned long)(shared_lt[driverhandle].seekpos + nbytes) > (unsigned long)(shared_gt[driverhandle].size - sizeof(DAL_SHM_SEGHEAD)))\n     {                  /* need to realloc shmem */\n       if (NULL == shared_realloc(driverhandle, shared_lt[driverhandle].seekpos + nbytes + sizeof(DAL_SHM_SEGHEAD)))\n         return(SHARED_NOMEM);\n     }\n\n   memcpy(((char *)(((DAL_SHM_SEGHEAD *)(shared_lt[driverhandle].p + 1)) + 1)) +\n                shared_lt[driverhandle].seekpos,\n          buffer,\n          nbytes);\n\n   shared_lt[driverhandle].seekpos += nbytes;\n   return(0);\n }\n#endif\n"},{"id":16673,"name":"getcols.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, getcols.c, contains routines that read data elements from   */\n/*  a FITS image or table, with a character string datatype.               */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <stdlib.h>\n#include <string.h>\n/* stddef.h is apparently needed to define size_t */\n#include <stddef.h>\n#include <ctype.h>\n#include \"fitsio2.h\"\n/*--------------------------------------------------------------------------*/\nint ffgcvs( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of strings to read               */\n            char *nulval,     /* I - string for null pixels                  */\n            char **array,     /* O - array of values that are read           */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of string values from a column in the current FITS HDU.\n  Any undefined pixels will be set equal to the value of 'nulval' unless\n  nulval = null in which case no checks for undefined pixels will be made.\n*/\n{\n    char cdummy[2];\n\n    ffgcls(fptr, colnum, firstrow, firstelem, nelem, 1, nulval,\n           array, cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcfs( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col) */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)        */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st) */\n            LONGLONG  nelem,      /* I - number of strings to read              */\n            char **array,     /* O - array of values that are read           */\n            char *nularray,   /* O - array of flags = 1 if nultyp = 2        */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of string values from a column in the current FITS HDU.\n  Nularray will be set = 1 if the corresponding array pixel is undefined, \n  otherwise nularray will = 0.\n*/\n{\n    char dummy[2];\n\n    ffgcls(fptr, colnum, firstrow, firstelem, nelem, 2, dummy,\n           array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcls( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col) */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)        */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st) */\n            LONGLONG  nelem,      /* I - number of strings to read              */\n            int   nultyp,     /* I - null value handling code:               */\n                              /*     1: set undefined pixels = nulval        */\n                              /*     2: set nularray=1 for undefined pixels  */\n            char  *nulval,    /* I - value for null pixels if nultyp = 1     */\n            char **array,     /* O - array of values that are read           */\n            char *nularray,   /* O - array of flags = 1 if nultyp = 2        */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of string values from a column in the current FITS HDU.\n  Returns a formated string value, regardless of the datatype of the column\n*/\n{\n    int tcode, hdutype, tstatus, scaled, intcol, dwidth, nulwidth, ll, dlen;\n    int equivtype;\n    long ii, jj;\n    tcolumn *colptr;\n    char message[FLEN_ERRMSG], *carray, keyname[FLEN_KEYWORD];\n    char cform[20], dispfmt[20], tmpstr[400], *flgarray, tmpnull[80];\n    unsigned char byteval;\n    float *earray;\n    double *darray, tscale = 1.0;\n    LONGLONG *llarray;\n    ULONGLONG *ullarray;\n\n    if (*status > 0 || nelem == 0)  /* inherit input status value if > 0 */\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    /* rescan header if data structure is undefined */\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n    if (colnum < 1 || colnum > (fptr->Fptr)->tfield)\n    {\n        snprintf(message, FLEN_ERRMSG,\"Specified column number is out of range: %d\",\n                colnum);\n        ffpmsg(message);\n        return(*status = BAD_COL_NUM);\n    }\n\n    /* get equivalent dataype of column (only needed for TLONGLONG columns) */\n    ffeqtyll(fptr, colnum, &equivtype, NULL, NULL, status);\n    if (equivtype < 0) equivtype = abs(equivtype);\n    \n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n    tcode = abs(colptr->tdatatype);\n\n    intcol = 0;\n    if (tcode == TSTRING)\n    {\n      /* simply call the string column reading routine */\n      ffgcls2(fptr, colnum, firstrow, firstelem, nelem, nultyp, nulval,\n           array, nularray, anynul, status);\n    }\n    else if (tcode == TLOGICAL)\n    {\n      /* allocate memory for the array of logical values */\n      carray = (char *) malloc((size_t) nelem);\n\n      /*  call the logical column reading routine */\n      ffgcll(fptr, colnum, firstrow, firstelem, nelem, nultyp, *nulval,\n           carray, nularray, anynul, status); \n\n      if (*status <= 0)\n      {\n         /* convert logical values to \"T\", \"F\", or \"N\" (Null) */\n         for (ii = 0; ii < nelem; ii++)\n         {\n           if (carray[ii] == 1)\n              strcpy(array[ii], \"T\");\n           else if (carray[ii] == 0)\n              strcpy(array[ii], \"F\");\n           else  /* undefined values = 2 */\n              strcpy(array[ii],\"N\");\n         }\n      }\n\n      free(carray);  /* free the memory */\n    }\n    else if (tcode == TCOMPLEX)\n    {\n      /* allocate memory for the array of double values */\n      earray = (float *) calloc((size_t) (nelem * 2), sizeof(float) );\n      \n      ffgcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2,\n        1, 1, FLOATNULLVALUE, earray, nularray, anynul, status);\n\n      if (*status <= 0)\n      {\n\n         /* determine the format for the output strings */\n\n         ffgcdw(fptr, colnum, &dwidth, status);\n         dwidth = (dwidth - 3) / 2;\n \n         /* use the TDISPn keyword if it exists */\n         ffkeyn(\"TDISP\", colnum, keyname, status);\n         tstatus = 0;\n         cform[0] = '\\0';\n\n         if (ffgkys(fptr, keyname, dispfmt, NULL, &tstatus) == 0)\n         {\n             /* convert the Fortran style format to a C style format */\n             ffcdsp(dispfmt, cform);\n\n\t     /* Special case: TDISPn='Aw' disallowed for numeric types */\n\t     if (dispfmt[0] == 'A') {\n\t       cform[0] = 0;\n\n\t       /* Special case: if the output is intended to be represented\n\t\t  as an integer, but we read it as a double, we need to\n\t\t  set intcol = 1 so it is printed as an integer */\n\t     } else if ((dispfmt[0] == 'I') || (dispfmt[0] == 'i') ||\n\t\t\t(dispfmt[0] == 'O') || (dispfmt[0] == 'o') ||\n\t\t\t(dispfmt[0] == 'Z') || (dispfmt[0] == 'z')) {\n\t       intcol = 1;\n\t     }\n         }\n\n         if (!cform[0])\n             strcpy(cform, \"%14.6E\");\n\n         /* write the formated string for each value:  \"(real,imag)\" */\n         jj = 0;\n         for (ii = 0; ii < nelem; ii++)\n         {\n           strcpy(array[ii], \"(\");\n\n           /* test for null value */\n           if (earray[jj] == FLOATNULLVALUE)\n           {\n             strcpy(tmpstr, \"NULL\");\n             if (nultyp == 2)\n                nularray[ii] = 1;\n           }\n           else if (intcol)\n\t   {\n\t       snprintf(tmpstr, 400,cform, (int) earray[jj]);\n\t   } \n\t   else \n\t   {\n\t       snprintf(tmpstr, 400,cform, earray[jj]);\n\t   }\n\n           strncat(array[ii], tmpstr, dwidth);\n           strcat(array[ii], \",\");\n           jj++;\n\n           /* test for null value */\n           if (earray[jj] == FLOATNULLVALUE)\n           {\n             strcpy(tmpstr, \"NULL\");\n             if (nultyp == 2)\n                nularray[ii] = 1;\n           }\n           else if (intcol)\n\t   {\n\t       snprintf(tmpstr, 400,cform, (int) earray[jj]);\n\t   } \n\t   else \n\t   {\n\t       snprintf(tmpstr, 400,cform, earray[jj]);\n\t   }\n\n           strncat(array[ii], tmpstr, dwidth);\n           strcat(array[ii], \")\");\n           jj++;\n         }\n      }\n\n      free(earray);  /* free the memory */\n    }\n    else if (tcode == TDBLCOMPLEX)\n    {\n      /* allocate memory for the array of double values */\n      darray = (double *) calloc((size_t) (nelem * 2), sizeof(double) );\n      \n      ffgcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2,\n        1, 1, DOUBLENULLVALUE, darray, nularray, anynul, status);\n\n      if (*status <= 0)\n      {\n         /* determine the format for the output strings */\n\n         ffgcdw(fptr, colnum, &dwidth, status);\n         dwidth = (dwidth - 3) / 2;\n\n         /* use the TDISPn keyword if it exists */\n         ffkeyn(\"TDISP\", colnum, keyname, status);\n         tstatus = 0;\n         cform[0] = '\\0';\n \n         if (ffgkys(fptr, keyname, dispfmt, NULL, &tstatus) == 0)\n         {\n             /* convert the Fortran style format to a C style format */\n             ffcdsp(dispfmt, cform);\n\n\t     /* Special case: TDISPn='Aw' disallowed for numeric types */\n\t     if (dispfmt[0] == 'A') {\n\t       cform[0] = 0;\n\n\t       /* Special case: if the output is intended to be represented\n\t\t  as an integer, but we read it as a double, we need to\n\t\t  set intcol = 1 so it is printed as an integer */\n\t     } else if ((dispfmt[0] == 'I') || (dispfmt[0] == 'i') ||\n\t\t\t(dispfmt[0] == 'O') || (dispfmt[0] == 'o') ||\n\t\t\t(dispfmt[0] == 'Z') || (dispfmt[0] == 'z')) {\n\t       intcol = 1;\n\t     }\n         }\n\n         if (!cform[0])\n            strcpy(cform, \"%23.15E\");\n\n         /* write the formated string for each value:  \"(real,imag)\" */\n         jj = 0;\n         for (ii = 0; ii < nelem; ii++)\n         {\n           strcpy(array[ii], \"(\");\n\n           /* test for null value */\n           if (darray[jj] == DOUBLENULLVALUE)\n           {\n             strcpy(tmpstr, \"NULL\");\n             if (nultyp == 2)\n                nularray[ii] = 1;\n           }\n           else if (intcol)\n\t   {\n\t       snprintf(tmpstr, 400,cform, (int) darray[jj]);\n\t   } \n\t   else \n\t   {\n\t       snprintf(tmpstr, 400,cform, darray[jj]);\n\t   }\n\n           strncat(array[ii], tmpstr, dwidth);\n           strcat(array[ii], \",\");\n           jj++;\n\n           /* test for null value */\n           if (darray[jj] == DOUBLENULLVALUE)\n           {\n             strcpy(tmpstr, \"NULL\");\n             if (nultyp == 2)\n                nularray[ii] = 1;\n           }\n           else if (intcol)\n\t   {\n\t       snprintf(tmpstr, 400,cform, (int) darray[jj]);\n\t   } \n\t   else \n\t   {\n\t       snprintf(tmpstr, 400,cform, darray[jj]);\n\t   }\n\n           strncat(array[ii], tmpstr, dwidth);\n           strcat(array[ii], \")\");\n           jj++;\n         }\n      }\n\n      free(darray);  /* free the memory */\n    }\n    else if (tcode == TLONGLONG && equivtype == TLONGLONG)\n    {\n      /* allocate memory for the array of LONGLONG values */\n      llarray = (LONGLONG *) calloc((size_t) nelem, sizeof(LONGLONG) );\n      flgarray = (char *) calloc((size_t) nelem, sizeof(char) );\n      dwidth = 20;  /* max width of displayed long long integer value */\n\n      if (ffgcfjj(fptr, colnum, firstrow, firstelem, nelem,\n            llarray, flgarray, anynul, status) > 0)\n      {\n         free(flgarray);\n         free(llarray);\n         return(*status);\n      }\n\n      /* write the formated string for each value */\n      if (nulval) {\n          strncpy(tmpnull, nulval,79);\n          tmpnull[79]='\\0'; /* In case len(nulval) >= 79 */\n          nulwidth = strlen(tmpnull);\n      } else {\n          strcpy(tmpnull, \" \");\n          nulwidth = 1;\n      }\n\n      for (ii = 0; ii < nelem; ii++)\n      {\n           if ( flgarray[ii] )\n           {\n              *array[ii] = '\\0';\n              if (dwidth < nulwidth)\n                  strncat(array[ii], tmpnull, dwidth);\n              else\n                  sprintf(array[ii],\"%*s\",dwidth,tmpnull);\n\t\t  \n              if (nultyp == 2)\n\t          nularray[ii] = 1;\n           }\n           else\n           {\t   \n\n#if defined(_MSC_VER)\n    /* Microsoft Visual C++ 6.0 uses '%I64d' syntax  for 8-byte integers */\n        snprintf(tmpstr, 400,\"%20I64d\", llarray[ii]);\n#elif (USE_LL_SUFFIX == 1)\n        snprintf(tmpstr, 400,\"%20lld\", llarray[ii]);\n#else\n        snprintf(tmpstr, 400,\"%20ld\", llarray[ii]);\n#endif\n              *array[ii] = '\\0';\n              strncat(array[ii], tmpstr, 20);\n           }\n      }\n\n      free(flgarray);\n      free(llarray);  /* free the memory */\n\n    }\n    else if (tcode == TLONGLONG && equivtype == TULONGLONG)\n    {\n      /* allocate memory for the array of ULONGLONG values */\n      ullarray = (ULONGLONG *) calloc((size_t) nelem, sizeof(ULONGLONG) );\n      flgarray = (char *) calloc((size_t) nelem, sizeof(char) );\n      dwidth = 20;  /* max width of displayed unsigned long long integer value */\n\n      if (ffgcfujj(fptr, colnum, firstrow, firstelem, nelem,\n            ullarray, flgarray, anynul, status) > 0)\n      {\n         free(flgarray);\n         free(ullarray);\n         return(*status);\n      }\n\n      /* write the formated string for each value */\n      if (nulval) {\n          strncpy(tmpnull, nulval, 79);\n          tmpnull[79]='\\0'; /* In case len(nulval) >= 79 */\n          nulwidth = strlen(tmpnull);\n      } else {\n          strcpy(tmpnull, \" \");\n          nulwidth = 1;\n      }\n\n      for (ii = 0; ii < nelem; ii++)\n      {\n           if ( flgarray[ii] )\n           {\n              *array[ii] = '\\0';\n              if (dwidth < nulwidth)\n                  strncat(array[ii], tmpnull, dwidth);\n              else\n                  sprintf(array[ii],\"%*s\",dwidth,tmpnull);\n\t\t  \n              if (nultyp == 2)\n\t          nularray[ii] = 1;\n           }\n           else\n           {\t   \n\n#if defined(_MSC_VER)\n    /* Microsoft Visual C++ 6.0 uses '%I64d' syntax  for 8-byte integers */\n        snprintf(tmpstr, 400, \"%20I64u\", ullarray[ii]); \n#elif (USE_LL_SUFFIX == 1)\n        snprintf(tmpstr, 400, \"%20llu\", ullarray[ii]);\n#else\n        snprintf(tmpstr, 400, \"%20lu\", ullarray[ii]);\n#endif\n              *array[ii] = '\\0';\n              strncat(array[ii], tmpstr, 20);\n           }\n      }\n\n      free(flgarray);\n      free(ullarray);  /* free the memory */\n\n    }\n    else\n    {\n      /* allocate memory for the array of double values */\n      darray = (double *) calloc((size_t) nelem, sizeof(double) );\n      \n      /* read all other numeric type columns as doubles */\n      if (ffgcld(fptr, colnum, firstrow, firstelem, nelem, 1, nultyp, \n           DOUBLENULLVALUE, darray, nularray, anynul, status) > 0)\n      {\n         free(darray);\n         return(*status);\n      }\n\n      /* determine the format for the output strings */\n\n      ffgcdw(fptr, colnum, &dwidth, status);\n\n      /* check if  column is scaled */\n      ffkeyn(\"TSCAL\", colnum, keyname, status);\n      tstatus = 0;\n      scaled = 0;\n      if (ffgkyd(fptr, keyname, &tscale, NULL, &tstatus) == 0)\n      {\n            if (tscale != 1.0)\n                scaled = 1;    /* yes, this is a scaled column */\n      }\n\n      intcol = 0;\n      if (tcode <= TLONG && !scaled)\n             intcol = 1;   /* this is an unscaled integer column */\n\n      /* use the TDISPn keyword if it exists */\n      ffkeyn(\"TDISP\", colnum, keyname, status);\n      tstatus = 0;\n      cform[0] = '\\0';\n\n      if (ffgkys(fptr, keyname, dispfmt, NULL, &tstatus) == 0)\n      {\n           /* convert the Fortran style TDISPn to a C style format */\n           ffcdsp(dispfmt, cform);\n\n\t   /* Special case: TDISPn='Aw' disallowed for numeric types */\n\t   if (dispfmt[0] == 'A') {\n\t     cform[0] = 0;\n\n\t   /* Special case: if the output is intended to be represented\n\t      as an integer, but we read it as a double, we need to\n\t      set intcol = 1 so it is printed as an integer */\n\t   } else if ((dispfmt[0] == 'I') || (dispfmt[0] == 'i') ||\n\t\t      (dispfmt[0] == 'O') || (dispfmt[0] == 'o') ||\n\t\t      (dispfmt[0] == 'Z') || (dispfmt[0] == 'z')) {\n\t     intcol = 1;\n\t   }\n      }\n\n      if (!cform[0])\n      {\n            /* no TDISPn keyword; use TFORMn instead */\n\n            ffkeyn(\"TFORM\", colnum, keyname, status);\n            ffgkys(fptr, keyname, dispfmt, NULL, status);\n\n            if (scaled && tcode <= TSHORT)\n            {\n                  /* scaled short integer column == float */\n                  strcpy(cform, \"%#14.6G\");\n            }\n            else if (scaled && tcode == TLONG)\n            {\n                  /* scaled long integer column == double */\n                  strcpy(cform, \"%#23.15G\");\n            }\n            else if (scaled && tcode == TLONGLONG)\n            {\n                  /* scaled long long integer column == double */\n                  strcpy(cform, \"%#23.15G\");\n            }\n            else\n            {\n               ffghdt(fptr, &hdutype, status);\n               if (hdutype == ASCII_TBL)\n               {\n                  /* convert the Fortran style TFORMn to a C style format */\n                  ffcdsp(dispfmt, cform);\n               }\n               else\n               {\n                 /* this is a binary table, need to convert the format */\n                  if (tcode == TBIT) {            /* 'X' */\n                     strcpy(cform, \"%4d\");\n                  } else if (tcode == TBYTE) {    /* 'B' */\n                     strcpy(cform, \"%4d\");\n                  } else if (tcode == TSHORT) {   /* 'I' */\n                     strcpy(cform, \"%6d\");\n                  } else if (tcode == TLONG) {    /* 'J' */\n                     strcpy(cform, \"%11.0f\");\n                     intcol = 0;  /* needed to support unsigned int */\n                  } else if (tcode == TFLOAT) {   /* 'E' */\n                     strcpy(cform, \"%#14.6G\");\n                  } else if (tcode == TDOUBLE) {  /* 'D' */\n                     strcpy(cform, \"%#23.15G\");\n                  }\n               }\n            }\n      } \n\n      if (nulval) {\n          strncpy(tmpnull, nulval,79);\n          tmpnull[79]='\\0';\n          nulwidth = strlen(tmpnull);\n      } else {\n          strcpy(tmpnull, \" \");\n          nulwidth = 1;\n      }\n\n      /* write the formated string for each value */\n      for (ii = 0; ii < nelem; ii++)\n      {\n           if (tcode == TBIT)\n           {\n               byteval = (char) darray[ii];\n\n               for (ll=0; ll < 8; ll++)\n               {\n                   if ( ((unsigned char) (byteval << ll)) >> 7 )\n                       *(array[ii] + ll) = '1';\n                   else\n                       *(array[ii] + ll) = '0';\n               }\n               *(array[ii] + 8) = '\\0';\n           }\n           /* test for null value */\n           else if ( (nultyp == 1 && darray[ii] == DOUBLENULLVALUE) ||\n                (nultyp == 2 && nularray[ii]) )\n           {\n              *array[ii] = '\\0';\n              if (dwidth < nulwidth)\n                  strncat(array[ii], tmpnull, dwidth);\n              else\n                  sprintf(array[ii],\"%*s\",dwidth,tmpnull);\n           }\n           else\n           {\t   \n              if (intcol) {\n                snprintf(tmpstr, 400,cform, (int) darray[ii]);\n              } else {\n                snprintf(tmpstr, 400,cform, darray[ii]);\n              }\n\t      \n              /* fill field with '*' if number is too wide */\n              dlen = strlen(tmpstr);\n\t      if (dlen > dwidth) {\n\t         memset(tmpstr, '*', dwidth);\n              }\n\n              *array[ii] = '\\0';\n              strncat(array[ii], tmpstr, dwidth);\n           }\n      }\n\n      free(darray);  /* free the memory */\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcdw( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column (1 = 1st col)      */\n            int  *width,      /* O - display width                       */\n            int  *status)     /* IO - error status                           */\n/*\n  Get Column Display Width.\n*/\n{\n    tcolumn *colptr;\n    char *cptr;\n    char message[FLEN_ERRMSG], keyname[FLEN_KEYWORD], dispfmt[20];\n    int tcode, hdutype, tstatus, scaled;\n    double tscale;\n\n    if (*status > 0)  /* inherit input status value if > 0 */\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if (colnum < 1 || colnum > (fptr->Fptr)->tfield)\n    {\n        snprintf(message, FLEN_ERRMSG,\"Specified column number is out of range: %d\",\n                colnum);\n        ffpmsg(message);\n        return(*status = BAD_COL_NUM);\n    }\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n    tcode = abs(colptr->tdatatype);\n\n    /* use the TDISPn keyword if it exists */\n    ffkeyn(\"TDISP\", colnum, keyname, status);\n\n    *width = 0;\n    tstatus = 0;\n    if (ffgkys(fptr, keyname, dispfmt, NULL, &tstatus) == 0)\n    {\n          /* parse TDISPn get the display width */\n          cptr = dispfmt;\n          while(*cptr == ' ') /* skip leading blanks */\n              cptr++;\n\n          if (*cptr == 'A' || *cptr == 'a' ||\n              *cptr == 'I' || *cptr == 'i' ||\n              *cptr == 'O' || *cptr == 'o' ||\n              *cptr == 'Z' || *cptr == 'z' ||\n              *cptr == 'F' || *cptr == 'f' ||\n              *cptr == 'E' || *cptr == 'e' ||\n              *cptr == 'D' || *cptr == 'd' ||\n              *cptr == 'G' || *cptr == 'g')\n          {\n\n            while(!isdigit((int) *cptr) && *cptr != '\\0') /* find 1st digit */\n              cptr++;\n\n            *width = atoi(cptr);\n            if (tcode >= TCOMPLEX)\n              *width = (2 * (*width)) + 3;\n          }\n    }\n\n    if (*width == 0)\n    {\n        /* no valid TDISPn keyword; use TFORMn instead */\n\n        ffkeyn(\"TFORM\", colnum, keyname, status);\n        ffgkys(fptr, keyname, dispfmt, NULL, status);\n\n        /* check if  column is scaled */\n        ffkeyn(\"TSCAL\", colnum, keyname, status);\n        tstatus = 0;\n        scaled = 0;\n\n        if (ffgkyd(fptr, keyname, &tscale, NULL, &tstatus) == 0)\n        {\n            if (tscale != 1.0)\n                scaled = 1;    /* yes, this is a scaled column */\n        }\n\n        if (scaled && tcode <= TSHORT)\n        {\n            /* scaled short integer col == float; default format is 14.6G */\n            *width = 14;\n        }\n        else if (scaled && tcode == TLONG)\n        {\n            /* scaled long integer col == double; default format is 23.15G */\n            *width = 23;\n        }\n        else if (scaled && tcode == TLONGLONG)\n        {\n            /* scaled long long integer col == double; default format is 23.15G */\n            *width = 23;\n        }\n\n        else\n        {\n           ffghdt(fptr, &hdutype, status);  /* get type of table */\n           if (hdutype == ASCII_TBL)\n           {\n              /* parse TFORMn get the display width */\n              cptr = dispfmt;\n              while(!isdigit((int) *cptr) && *cptr != '\\0') /* find 1st digit */\n                 cptr++;\n\n              *width = atoi(cptr);\n           }\n           else\n           {\n                 /* this is a binary table */\n                  if (tcode == TBIT)           /* 'X' */\n                     *width = 8;\n                  else if (tcode == TBYTE)     /* 'B' */\n                     *width = 4;\n                  else if (tcode == TSHORT)    /* 'I' */\n                     *width = 6;\n                  else if (tcode == TLONG)     /* 'J' */\n                     *width = 11;\n                  else if (tcode == TLONGLONG) /* 'K' */\n                     *width = 20;\n                  else if (tcode == TFLOAT)    /* 'E' */\n                     *width = 14;\n                  else if (tcode == TDOUBLE)   /* 'D' */\n                     *width = 23;\n                  else if (tcode == TCOMPLEX)  /* 'C' */\n                     *width = 31;\n                  else if (tcode == TDBLCOMPLEX)  /* 'M' */\n                     *width = 49;\n                  else if (tcode == TLOGICAL)  /* 'L' */\n                     *width = 1;\n                  else if (tcode == TSTRING)   /* 'A' */\n                  {\n\t\t    int typecode;\n\t\t    long int repeat = 0, rwidth = 0;\n\t\t    int gstatus = 0;\n\n\t\t    /* Deal with possible vector string with repeat / width  by parsing\n\t\t       the TFORM=rAw keyword */\n\t\t    if (ffgtcl(fptr, colnum, &typecode, &repeat, &rwidth, &gstatus) == 0 &&\n\t\t\trwidth >= 1 && rwidth < repeat) {\n\t\t      *width = rwidth;\n\n\t\t    } else {\n\t\t      \n\t\t      /* Hmmm, we couldn't parse the TFORM keyword by standard, so just do\n\t\t\t simple parsing */\n\t\t      cptr = dispfmt;\n\t\t      while(!isdigit((int) *cptr) && *cptr != '\\0') \n\t\t\tcptr++;\n\t\t      \n\t\t      *width = atoi(cptr);\n\t\t    }\n\n                    if (*width < 1)\n                         *width = 1;  /* default is at least 1 column */\n                  }\n            }\n        }\n    } \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcls2 ( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col) */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)        */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st) */\n            LONGLONG  nelem,      /* I - number of strings to read              */\n            int   nultyp,     /* I - null value handling code:               */\n                              /*     1: set undefined pixels = nulval        */\n                              /*     2: set nularray=1 for undefined pixels  */\n            char  *nulval,    /* I - value for null pixels if nultyp = 1     */\n            char **array,     /* O - array of values that are read           */\n            char *nularray,   /* O - array of flags = 1 if nultyp = 2        */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of string values from a column in the current FITS HDU.\n*/\n{\n    double dtemp;\n    long nullen; \n    int tcode, maxelem, hdutype, nulcheck;\n    long twidth, incre;\n    long ii, jj, ntodo;\n    LONGLONG repeat, startpos, elemnum, readptr, tnull, rowlen, rownum, remain, next;\n    double scale, zero;\n    char tform[20];\n    char message[FLEN_ERRMSG];\n    char snull[20];   /*  the FITS null value  */\n    tcolumn *colptr;\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    char *buffer, *arrayptr;\n\n    if (*status > 0 || nelem == 0)  /* inherit input status value if > 0 */\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if (anynul)\n        *anynul = 0;\n\n    if (nultyp == 2)\n        memset(nularray, 0, (size_t) nelem);   /* initialize nullarray */\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (colnum < 1 || colnum > (fptr->Fptr)->tfield)\n    {\n        snprintf(message, FLEN_ERRMSG,\"Specified column number is out of range: %d\",\n                colnum);\n        ffpmsg(message);\n        return(*status = BAD_COL_NUM);\n    }\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n    tcode = colptr->tdatatype;\n\n    if (tcode == -TSTRING) /* variable length column in a binary table? */\n    {\n      /* only read a single string; ignore value of firstelem */\n\n      if (ffgcprll( fptr, colnum, firstrow, 1, 1, 0, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n\n      remain = 1;\n      twidth = (long) repeat;  \n    }\n    else if (tcode == TSTRING)\n    {\n      if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 0, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n\n      /* if string length is greater than a FITS block (2880 char) then must */\n      /* only read 1 string at a time, to force reading by ffgbyt instead of */\n      /* ffgbytoff (ffgbytoff can't handle this case) */\n      if (twidth > IOBUFLEN) {\n        maxelem = 1;\n        incre = twidth;\n        repeat = 1;\n      }   \n\n      remain = nelem;\n    }\n    else\n        return(*status = NOT_ASCII_COL);\n\n    nullen = strlen(snull);   /* length of the undefined pixel string */\n    if (nullen == 0)\n        nullen = 1;\n \n    /*------------------------------------------------------------------*/\n    /*  Decide whether to check for null values in the input FITS file: */\n    /*------------------------------------------------------------------*/\n    nulcheck = nultyp; /* by default check for null values in the FITS file */\n\n    if (nultyp == 1 && nulval == 0)\n       nulcheck = 0;    /* calling routine does not want to check for nulls */\n\n    else if (nultyp == 1 && nulval && nulval[0] == 0)\n       nulcheck = 0;    /* calling routine does not want to check for nulls */\n\n    else if (snull[0] == ASCII_NULL_UNDEFINED)\n       nulcheck = 0;   /* null value string in ASCII table not defined */\n\n    else if (nullen > twidth)\n       nulcheck = 0;   /* null value string is longer than width of column  */\n                       /* thus impossible for any column elements to = null */\n\n    /*---------------------------------------------------------------------*/\n    /*  Now read the strings one at a time from the FITS column.           */\n    /*---------------------------------------------------------------------*/\n    next = 0;                 /* next element in array to be read  */\n    rownum = 0;               /* row number, relative to firstrow     */\n\n    while (remain)\n    {\n      /* limit the number of pixels to process at one time to the number that\n         will fit in the buffer space or to the number of pixels that remain\n         in the current vector, which ever is smaller.\n      */\n      ntodo = (long) minvalue(remain, maxelem);      \n      ntodo = (long) minvalue(ntodo, (repeat - elemnum));\n\n      readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre);\n      ffmbyt(fptr, readptr, REPORT_EOF, status);  /* move to read position */\n\n      /* read the array of strings from the FITS file into the buffer */\n\n      if (incre == twidth)\n         ffgbyt(fptr, ntodo * twidth, cbuff, status);\n      else\n         ffgbytoff(fptr, twidth, ntodo, incre - twidth, cbuff, status);\n\n      /* copy from the buffer into the user's array of strings */\n      /* work backwards from last char of last string to 1st char of 1st */\n\n      buffer = ((char *) cbuff) + (ntodo * twidth) - 1;\n\n      for (ii = (long) (next + ntodo - 1); ii >= next; ii--)\n      {\n         arrayptr = array[ii] + twidth - 1;\n\n         for (jj = twidth - 1; jj > 0; jj--)  /* ignore trailing blanks */\n         {\n            if (*buffer == ' ')\n            {\n              buffer--;\n              arrayptr--;\n            }\n            else\n              break;\n         }\n         *(arrayptr + 1) = 0;  /* write the string terminator */\n         \n         for (; jj >= 0; jj--)    /* copy the string itself */\n         {\n           *arrayptr = *buffer;\n           buffer--;\n           arrayptr--;\n         }\n\n         /* check if null value is defined, and if the   */\n         /* column string is identical to the null string */\n         if (nulcheck && !strncmp(snull, array[ii], nullen) )\n         {\n           *anynul = 1;   /* this is a null value */\n           if (nultyp == 1) {\n\t   \n\t     if (nulval)\n                strcpy(array[ii], nulval);\n\t     else\n\t        strcpy(array[ii], \" \");\n\t     \n           } else\n             nularray[ii] = 1;\n         }\n      }\n    \n      if (*status > 0)  /* test for error during previous read operation */\n      {\n         dtemp = (double) next;\n         snprintf(message,FLEN_ERRMSG,\n          \"Error reading elements %.0f thru %.0f of data array (ffpcls).\",\n             dtemp+1., dtemp+ntodo);\n\n         ffpmsg(message);\n         return(*status);\n      }\n\n      /*--------------------------------------------*/\n      /*  increment the counters for the next loop  */\n      /*--------------------------------------------*/\n      next += ntodo;\n      remain -= ntodo;\n      if (remain)\n      {\n          elemnum += ntodo;\n          if (elemnum == repeat)  /* completed a row; start on next row */\n          {\n              elemnum = 0;\n              rownum++;\n          }\n      }\n    }  /*  End of main while Loop  */\n\n    return(*status);\n}\n\n"},{"id":16674,"name":"getcolj.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, getcolj.c, contains routines that read data elements from   */\n/*  a FITS image or table, with long data type.                            */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <math.h>\n#include <stdlib.h>\n#include <limits.h>\n#include <string.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffgpvj( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            long  nulval,     /* I - value for undefined pixels              */\n            long  *array,     /* O - array of values that are returned       */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Undefined elements will be set equal to NULVAL, unless NULVAL=0\n  in which case no checking for undefined values will be performed.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    char cdummy;\n    int nullcheck = 1;\n    long nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n         nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_pixels(fptr, TLONG, firstelem, nelem,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclj(fptr, 2, row, firstelem, nelem, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgpfj( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            long  *array,     /* O - array of values that are returned       */\n            char *nularray,   /* O - array of null pixel flags               */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Any undefined pixels in the returned array will be set = 0 and the \n  corresponding nularray value will be set = 1.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    int nullcheck = 2;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_read_compressed_pixels(fptr, TLONG, firstelem, nelem,\n            nullcheck, NULL, array, nularray, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclj(fptr, 2, row, firstelem, nelem, 1, 2, 0L,\n               array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg2dj(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           long  nulval,    /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           long  *array,    /* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    /* call the 3D reading routine, with the 3rd dimension = 1 */\n\n    ffg3dj(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, \n           anynul, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg3dj(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           long  nulval,    /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  nrows,     /* I - number of rows in each plane of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           LONGLONG  naxis3,    /* I - FITS image NAXIS3 value                 */\n           long  *array,    /* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 3-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    long tablerow, ii, jj;\n    char cdummy;\n    int nullcheck = 1;\n    long inc[] = {1,1,1};\n    LONGLONG fpixel[] = {1,1,1}, nfits, narray;\n    LONGLONG lpixel[3], nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        lpixel[0] = ncols;\n        lpixel[1] = nrows;\n        lpixel[2] = naxis3;\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TLONG, fpixel, lpixel, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n       /* all the image pixels are contiguous, so read all at once */\n       ffgclj(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n       return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to read */\n    narray = 0;  /* next pixel in output array to be filled */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* reading naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffgclj(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval,\n          &array[narray], &cdummy, anynul, status) > 0)\n          return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsvj(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           long nulval,    /* I - value to set undefined pixels             */\n           long *array,    /* O - array to be filled and returned           */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dir[9];\n    long nelem, nultyp, ninc, numcol;\n    LONGLONG felem, dsize[10], blcll[9], trcll[9];\n    int hdutype, anyf;\n    char ldummy, msg[FLEN_ERRMSG];\n    int nullcheck = 1;\n    long nullvalue;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvj is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TLONG, blcll, trcll, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 1;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n        dir[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        if (hdutype == IMAGE_HDU)\n        {\n           dir[ii] = -1;\n        }\n        else\n        {\n          snprintf(msg, FLEN_ERRMSG,\"ffgsvj: illegal range specified for axis %ld\", ii + 1);\n          ffpmsg(msg);\n          return(*status = BAD_PIX_NUM);\n        }\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n      dsize[ii] = dsize[ii] * dir[ii];\n    }\n    dsize[naxis] = dsize[naxis] * dir[naxis];\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0]*dir[0] - str[0]*dir[0]) / inc[0] + 1;\n      ninc = incr[0] * dir[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]*dir[8]; i8 <= stp[8]*dir[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]*dir[7]; i7 <= stp[7]*dir[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]*dir[6]; i6 <= stp[6]*dir[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]*dir[5]; i5 <= stp[5]*dir[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]*dir[4]; i4 <= stp[4]*dir[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]*dir[3]; i3 <= stp[3]*dir[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]*dir[2]; i2 <= stp[2]*dir[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]*dir[1]; i1 <= stp[1]*dir[1]; i1 += incr[1])\n            {\n\n              felem=str[0] + (i1 - dir[1]) * dsize[1] + (i2 - dir[2]) * dsize[2] + \n                             (i3 - dir[3]) * dsize[3] + (i4 - dir[4]) * dsize[4] +\n                             (i5 - dir[5]) * dsize[5] + (i6 - dir[6]) * dsize[6] +\n                             (i7 - dir[7]) * dsize[7] + (i8 - dir[8]) * dsize[8];\n\n              if ( ffgclj(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &ldummy, &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsfj(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           long *array,    /* O - array to be filled and returned           */\n           char *flagval,  /* O - set to 1 if corresponding value is null   */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dsize[10];\n    LONGLONG blcll[9], trcll[9];\n    long felem, nelem, nultyp, ninc, numcol;\n    long nulval = 0;\n    int hdutype, anyf;\n    char msg[FLEN_ERRMSG];\n    int nullcheck = 2;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvj is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        fits_read_compressed_img(fptr, TLONG, blcll, trcll, inc,\n            nullcheck, NULL, array, flagval, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 2;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        snprintf(msg, FLEN_ERRMSG,\"ffgsvj: illegal range specified for axis %ld\", ii + 1);\n        ffpmsg(msg);\n        return(*status = BAD_PIX_NUM);\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n    }\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0] - str[0]) / inc[0] + 1;\n      ninc = incr[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1])\n            {\n              felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + \n                             (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] +\n                             (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] +\n                             (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8];\n\n              if ( ffgclj(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &flagval[i0], &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffggpj( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            long  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            long  nelem,      /* I - number of values to read                */\n            long  *array,     /* O - array of values that are returned       */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of group parameters from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n*/\n{\n    long row;\n    int idummy;\n    char cdummy;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclj(fptr, 1, row, firstelem, nelem, 1, 1, 0L,\n               array, &cdummy, &idummy, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcvj(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           long  nulval,     /* I - value for null pixels                   */\n           long *array,      /* O - array of values that are read           */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Any undefined pixels will be set equal to the value of 'nulval' unless\n  nulval = 0 in which case no checks for undefined pixels will be made.\n*/\n{\n    char cdummy;\n\n    ffgclj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval,\n           array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcfj(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           long  *array,     /* O - array of values that are read           */\n           char *nularray,   /* O - array of flags: 1 if null pixel; else 0 */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Nularray will be set = 1 if the corresponding array pixel is undefined, \n  otherwise nularray will = 0.\n*/\n{\n    long dummy = 0;\n\n    ffgclj(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy,\n           array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgclj( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            long  elemincre,  /* I - pixel increment; e.g., 2 = every other  */\n            int   nultyp,     /* I - null value handling code:               */\n                              /*     1: set undefined pixels = nulval        */\n                              /*     2: set nularray=1 for undefined pixels  */\n            long  nulval,     /* I - value for null pixels if nultyp = 1     */\n            long  *array,     /* O - array of values that are read           */\n            char *nularray,   /* O - array of flags = 1 if nultyp = 2        */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer be a virtual column in a 1 or more grouped FITS primary\n  array or image extension.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The output array of values will be converted from the datatype of the column \n  and will be scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    double scale, zero, power = 1., dtemp;\n    int tcode, maxelem2, hdutype, xcode, decimals;\n    long twidth, incre;\n    long ii, xwidth, ntodo;\n    int convert, nulcheck, readcheck = 0;\n    LONGLONG repeat, startpos, elemnum, readptr, tnull;\n    LONGLONG rowlen, rownum, remain, next, rowincre, maxelem;\n    char tform[20];\n    char message[FLEN_ERRMSG];\n    char snull[20];   /*  the FITS null value if reading from ASCII table  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0 || nelem == 0)  /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    if (anynul)\n        *anynul = 0;\n\n    if (nultyp == 2)\n        memset(nularray, 0, (size_t) nelem);   /* initialize nullarray */\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (elemincre < 0)\n        readcheck = -1;  /* don't do range checking in this case */\n\n    if (ffgcprll(fptr, colnum, firstrow, firstelem, nelem, readcheck, &scale, &zero,\n         tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre,\n         &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 )\n         return(*status);\n    maxelem = maxelem2;\n\n    incre *= elemincre;   /* multiply incre to just get every nth pixel */\n\n    if (tcode == TSTRING)    /* setup for ASCII tables */\n    {\n      /* get the number of implied decimal places if no explicit decmal point */\n      ffasfm(tform, &xcode, &xwidth, &decimals, status); \n      for(ii = 0; ii < decimals; ii++)\n        power *= 10.;\n    }\n    /*------------------------------------------------------------------*/\n    /*  Decide whether to check for null values in the input FITS file: */\n    /*------------------------------------------------------------------*/\n    nulcheck = nultyp; /* by default check for null values in the FITS file */\n\n    if (nultyp == 1 && nulval == 0)\n       nulcheck = 0;    /* calling routine does not want to check for nulls */\n\n    else if (tcode%10 == 1 &&        /* if reading an integer column, and  */ \n            tnull == NULL_UNDEFINED) /* if a null value is not defined,    */\n            nulcheck = 0;            /* then do not check for null values. */\n\n    else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TBYTE && (tnull > 255 || tnull < 0) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED)\n         nulcheck = 0;\n\n    /*----------------------------------------------------------------------*/\n    /*  If FITS column and output data array have same datatype, then we do */\n    /*  not need to use a temporary buffer to store intermediate datatype.  */\n    /*----------------------------------------------------------------------*/\n    convert = 1;\n    if ((tcode == TLONG) && (LONGSIZE == 32))  /* Special Case:                        */\n    {                             /* no type convertion required, so read */\n                                  /* data directly into output buffer.    */\n\n        if (nelem < (LONGLONG)INT32_MAX/4) {\n            maxelem = nelem;\n        } else {\n            maxelem = INT32_MAX/4;   \n        }\n\n        if (nulcheck == 0 && scale == 1. && zero == 0. )\n            convert = 0;  /* no need to scale data or find nulls */\n    }\n\n    /*---------------------------------------------------------------------*/\n    /*  Now read the pixels from the FITS column. If the column does not   */\n    /*  have the same datatype as the output array, then we have to read   */\n    /*  the raw values into a temporary buffer (of limited size).  In      */\n    /*  the case of a vector colum read only 1 vector of values at a time  */\n    /*  then skip to the next row if more values need to be read.          */\n    /*  After reading the raw values, then call the fffXXYY routine to (1) */\n    /*  test for undefined values, (2) convert the datatype if necessary,  */\n    /*  and (3) scale the values by the FITS TSCALn and TZEROn linear      */\n    /*  scaling parameters.                                                */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to read */\n    next = 0;                 /* next element in array to be read   */\n    rownum = 0;               /* row number, relative to firstrow   */\n\n    while (remain)\n    {\n        /* limit the number of pixels to read at one time to the number that\n           will fit in the buffer or to the number of pixels that remain in\n           the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);\n        if (elemincre >= 0)\n        {\n          ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1));\n        }\n        else\n        {\n          ntodo = (long) minvalue(ntodo, (elemnum/(-elemincre) +1));\n        }\n\n        readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre));\n\n        switch (tcode) \n        {\n            case (TLONG):\n\t      if (LONGSIZE == 32) {\n                ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) &array[next],\n                       status);\n                if (convert)\n                    fffi4i4((INT32BIT *) &array[next], ntodo, scale, zero, \n                           nulcheck, (INT32BIT) tnull, nulval, &nularray[next], \n                            anynul, &array[next], status);\n\t      } else { /* case where sizeof(long) = 8 */\n                ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) buffer,\n                       status);\n                if (convert)\n                    fffi4i4((INT32BIT *) buffer, ntodo, scale, zero, \n                           nulcheck, (INT32BIT) tnull, nulval, &nularray[next], \n                            anynul, &array[next], status);\n\t      }\n\n                break;\n            case (TLONGLONG):\n                ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status);\n                fffi8i4((LONGLONG *) buffer, ntodo, scale, zero, \n                           nulcheck, tnull, nulval, &nularray[next], \n                            anynul, &array[next], status);\n                break;\n            case (TBYTE):\n                ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer,\n                       status);\n                fffi1i4((unsigned char *) buffer, ntodo, scale, zero, nulcheck, \n                     (unsigned char) tnull, nulval, &nularray[next], anynul, \n                     &array[next], status);\n                break;\n            case (TSHORT):\n                ffgi2b(fptr, readptr, ntodo, incre, (short  *) buffer, status);\n                fffi2i4((short  *) buffer, ntodo, scale, zero, nulcheck, \n                      (short) tnull, nulval, &nularray[next], anynul, \n                      &array[next], status);\n                break;\n            case (TFLOAT):\n                ffgr4b(fptr, readptr, ntodo, incre, (float  *) buffer, status);\n                fffr4i4((float  *) buffer, ntodo, scale, zero, nulcheck, \n                       nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TDOUBLE):\n                ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status);\n                fffr8i4((double *) buffer, ntodo, scale, zero, nulcheck, \n                          nulval, &nularray[next], anynul, \n                          &array[next], status);\n                break;\n            case (TSTRING):\n                ffmbyt(fptr, readptr, REPORT_EOF, status);\n       \n                if (incre == twidth)    /* contiguous bytes */\n                     ffgbyt(fptr, ntodo * twidth, buffer, status);\n                else\n                     ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                               status);\n\n                fffstri4((char *) buffer, ntodo, scale, zero, twidth, power,\n                     nulcheck, snull, nulval, &nularray[next], anynul,\n                     &array[next], status);\n                break;\n\n            default:  /*  error trap for invalid column format */\n                snprintf(message, FLEN_ERRMSG,\n                   \"Cannot read numbers from column %d which has format %s\",\n                    colnum, tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous read operation */\n        {\n\t  dtemp = (double) next;\n          if (hdutype > 0)\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgclj).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from image (ffgclj).\",\n              dtemp+1., dtemp+ntodo);\n\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum = elemnum + (ntodo * elemincre);\n\n            if (elemnum >= repeat)  /* completed a row; start on later row */\n            {\n                rowincre = elemnum / repeat;\n                rownum += rowincre;\n                elemnum = elemnum - (rowincre * repeat);\n            }\n            else if (elemnum < 0)  /* completed a row; start on a previous row */\n            {\n                rowincre = (-elemnum - 1) / repeat + 1;\n                rownum -= rowincre;\n                elemnum = (rowincre * repeat) + elemnum;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while reading FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi1i4(unsigned char *input, /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char tnull,  /* I - value of FITS TNULLn keyword if any */\n            long nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            long *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (long) input[ii];  /* copy input to output */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DLONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MIN;\n                }\n                else if (dvalue > DLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MAX;\n                }\n                else\n                    output[ii] = (long) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (long) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MIN;\n                    }\n                    else if (dvalue > DLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MAX;\n                    }\n                    else\n                        output[ii] = (long) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi2i4(short *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short tnull,          /* I - value of FITS TNULLn keyword if any */\n            long nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            long *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (long) input[ii];   /* copy input to output */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DLONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MIN;\n                }\n                else if (dvalue > DLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MAX;\n                }\n                else\n                    output[ii] = (long) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (long) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MIN;\n                    }\n                    else if (dvalue > DLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MAX;\n                    }\n                    else\n                        output[ii] = (long) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi4i4(INT32BIT *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            INT32BIT tnull,       /* I - value of FITS TNULLn keyword if any */\n            long nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            long *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++) { \n                 output[ii] = (long) input[ii];   /* copy input to output */\n\t    }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DLONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MIN;\n                }\n                else if (dvalue > DLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MAX;\n                }\n                else\n                    output[ii] = (long) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MIN;\n                    }\n                    else if (dvalue > DLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MAX;\n                    }\n                    else\n                        output[ii] = (long) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi8i4(LONGLONG *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            LONGLONG tnull,       /* I - value of FITS TNULLn keyword if any */\n            long nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            long *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    ULONGLONG ulltemp;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of adding 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                if (ulltemp > LONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MAX;\n                }\n                else\n\t\t{\n                    output[ii] = (long) ulltemp;\n\t\t}\n            }\n        }\n        else if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < LONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MIN;\n                }\n                else if (input[ii] > LONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MAX;\n                }\n                else\n                    output[ii] = (long) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DLONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MIN;\n                }\n                else if (dvalue > DLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MAX;\n                }\n                else\n                    output[ii] = (long) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of subtracting 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n\t\t{\n                    ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                    if (ulltemp > LONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MAX;\n                    }\n                    else\n\t\t    {\n                        output[ii] = (long) ulltemp;\n\t\t    }\n                }\n            }\n        }\n        else if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    if (input[ii] < LONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MIN;\n                    }\n                    else if (input[ii] > LONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MAX;\n                    }\n                    else\n                        output[ii] = (long) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MIN;\n                    }\n                    else if (dvalue > DLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MAX;\n                    }\n                    else\n                        output[ii] = (long) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr4i4(float *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            long nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            long *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DLONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MIN;\n                }\n                else if (input[ii] > DLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MAX;\n                }\n                else\n                    output[ii] = (long) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DLONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MIN;\n                }\n                else if (dvalue > DLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MAX;\n                }\n                else\n                    output[ii] = (long) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr++;       /* point to MSBs */\n#endif\n\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MIN;\n                    }\n                    else if (input[ii] > DLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MAX;\n                    }\n                    else\n                        output[ii] = (long) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  {\n                    if (zero < DLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MIN;\n                    }\n                    else if (zero > DLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MAX;\n                    }\n                    else\n                        output[ii] = (long) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MIN;\n                    }\n                    else if (dvalue > DLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MAX;\n                    }\n                    else\n                        output[ii] = (long) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr8i4(double *input,        /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            long nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            long *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DLONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MIN;\n                }\n                else if (input[ii] > DLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MAX;\n                }\n                else\n                    output[ii] = (long) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DLONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MIN;\n                }\n                else if (dvalue > DLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONG_MAX;\n                }\n                else\n                    output[ii] = (long) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr += 3;       /* point to MSBs */\n#endif\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MIN;\n                    }\n                    else if (input[ii] > DLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MAX;\n                    }\n                    else\n                        output[ii] = (long) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  {\n                    if (zero < DLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MIN;\n                    }\n                    else if (zero > DLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MAX;\n                    }\n                    else\n                        output[ii] = (long) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MIN;\n                    }\n                    else if (dvalue > DLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONG_MAX;\n                    }\n                    else\n                        output[ii] = (long) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffstri4(char *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            long twidth,          /* I - width of each substring of chars    */\n            double implipower,    /* I - power of 10 of implied decimal      */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            char  *snull,         /* I - value of FITS null string, if any   */\n            long nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            long *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file. Check\n  for null values and do scaling if required. The nullcheck code value\n  determines how any null values in the input array are treated. A null\n  value is an input pixel that is equal to snull.  If nullcheck= 0, then\n  no special checking for nulls is performed.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    int nullen;\n    long ii;\n    double dvalue;\n    char *cstring, message[FLEN_ERRMSG];\n    char *cptr, *tpos;\n    char tempstore, chrzero = '0';\n    double val, power;\n    int exponent, sign, esign, decpt;\n\n    nullen = strlen(snull);\n    cptr = input;  /* pointer to start of input string */\n    for (ii = 0; ii < ntodo; ii++)\n    {\n      cstring = cptr;\n      /* temporarily insert a null terminator at end of the string */\n      tpos = cptr + twidth;\n      tempstore = *tpos;\n      *tpos = 0;\n\n      /* check if null value is defined, and if the    */\n      /* column string is identical to the null string */\n      if (snull[0] != ASCII_NULL_UNDEFINED && \n         !strncmp(snull, cptr, nullen) )\n      {\n        if (nullcheck)  \n        {\n          *anynull = 1;    \n          if (nullcheck == 1)\n            output[ii] = nullval;\n          else\n            nullarray[ii] = 1;\n        }\n        cptr += twidth;\n      }\n      else\n      {\n        /* value is not the null value, so decode it */\n        /* remove any embedded blank characters from the string */\n\n        decpt = 0;\n        sign = 1;\n        val  = 0.;\n        power = 1.;\n        exponent = 0;\n        esign = 1;\n\n        while (*cptr == ' ')               /* skip leading blanks */\n           cptr++;\n\n        if (*cptr == '-' || *cptr == '+')  /* check for leading sign */\n        {\n          if (*cptr == '-')\n             sign = -1;\n\n          cptr++;\n\n          while (*cptr == ' ')         /* skip blanks between sign and value */\n            cptr++;\n        }\n\n        while (*cptr >= '0' && *cptr <= '9')\n        {\n          val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n          cptr++;\n\n          while (*cptr == ' ')         /* skip embedded blanks in the value */\n            cptr++;\n        }\n\n        if (*cptr == '.' || *cptr == ',')    /* check for decimal point */\n        {\n          decpt = 1;       /* set flag to show there was a decimal point */\n          cptr++;\n          while (*cptr == ' ')         /* skip any blanks */\n            cptr++;\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n            power = power * 10.;\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks in the value */\n              cptr++;\n          }\n        }\n\n        if (*cptr == 'E' || *cptr == 'D')  /* check for exponent */\n        {\n          cptr++;\n          while (*cptr == ' ')         /* skip blanks */\n              cptr++;\n  \n          if (*cptr == '-' || *cptr == '+')  /* check for exponent sign */\n          {\n            if (*cptr == '-')\n               esign = -1;\n\n            cptr++;\n\n            while (*cptr == ' ')        /* skip blanks between sign and exp */\n              cptr++;\n          }\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            exponent = exponent * 10 + *cptr - chrzero;  /* accumulate exp */\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks */\n              cptr++;\n          }\n        }\n\n        if (*cptr  != 0)  /* should end up at the null terminator */\n        {\n          snprintf(message, FLEN_ERRMSG,\"Cannot read number from ASCII table\");\n          ffpmsg(message);\n          snprintf(message, FLEN_ERRMSG,\"Column field = %s.\", cstring);\n          ffpmsg(message);\n          /* restore the char that was overwritten by the null */\n          *tpos = tempstore;\n          return(*status = BAD_C2D);\n        }\n\n        if (!decpt)  /* if no explicit decimal, use implied */\n           power = implipower;\n\n        dvalue = (sign * val / power) * pow(10., (double) (esign * exponent));\n\n        dvalue = dvalue * scale + zero;   /* apply the scaling */\n\n        if (dvalue < DLONG_MIN)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = LONG_MIN;\n        }\n        else if (dvalue > DLONG_MAX)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = LONG_MAX;\n        }\n        else\n            output[ii] = (long) dvalue;\n      }\n      /* restore the char that was overwritten by the null */\n      *tpos = tempstore;\n    }\n    return(*status);\n}\n\n/* ======================================================================== */\n/*      the following routines support the 'long long' data type            */\n/* ======================================================================== */\n\n/*--------------------------------------------------------------------------*/\nint ffgpvjj(fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            LONGLONG  nulval, /* I - value for undefined pixels              */\n            LONGLONG  *array, /* O - array of values that are returned       */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Undefined elements will be set equal to NULVAL, unless NULVAL=0\n  in which case no checking for undefined values will be performed.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    char cdummy;\n    int nullcheck = 1;\n    LONGLONG nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n         nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_pixels(fptr, TLONGLONG, firstelem, nelem,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcljj(fptr, 2, row, firstelem, nelem, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgpfjj(fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            LONGLONG  *array, /* O - array of values that are returned       */\n            char *nularray,   /* O - array of null pixel flags               */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Any undefined pixels in the returned array will be set = 0 and the \n  corresponding nularray value will be set = 1.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    int nullcheck = 2;\n    LONGLONG dummy = 0;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_read_compressed_pixels(fptr, TLONGLONG, firstelem, nelem,\n            nullcheck, NULL, array, nularray, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcljj(fptr, 2, row, firstelem, nelem, 1, 2, dummy,\n               array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg2djj(fitsfile *fptr, /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           LONGLONG nulval ,/* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           LONGLONG  *array,/* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    /* call the 3D reading routine, with the 3rd dimension = 1 */\n\n    ffg3djj(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, \n           anynul, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg3djj(fitsfile *fptr, /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           LONGLONG nulval, /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  nrows,     /* I - number of rows in each plane of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           LONGLONG  naxis3,    /* I - FITS image NAXIS3 value                 */\n           LONGLONG  *array,/* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 3-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    long tablerow, ii, jj;\n    char cdummy;\n    int nullcheck = 1;\n    long inc[] = {1,1,1};\n    LONGLONG fpixel[] = {1,1,1}, nfits, narray;\n    LONGLONG lpixel[3];\n    LONGLONG nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        lpixel[0] = ncols;\n        lpixel[1] = nrows;\n        lpixel[2] = naxis3;\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TLONGLONG, fpixel, lpixel, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n       /* all the image pixels are contiguous, so read all at once */\n       ffgcljj(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n       return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to read */\n    narray = 0;  /* next pixel in output array to be filled */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* reading naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffgcljj(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval,\n          &array[narray], &cdummy, anynul, status) > 0)\n          return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsvjj(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           LONGLONG nulval,/* I - value to set undefined pixels             */\n           LONGLONG *array,/* O - array to be filled and returned           */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dir[9];\n    long nelem, nultyp, ninc, numcol;\n    LONGLONG felem, dsize[10], blcll[9], trcll[9];\n    int hdutype, anyf;\n    char ldummy, msg[FLEN_ERRMSG];\n    int nullcheck = 1;\n    LONGLONG nullvalue;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvj is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TLONGLONG, blcll, trcll, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 1;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n        dir[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        if (hdutype == IMAGE_HDU)\n        {\n           dir[ii] = -1;\n        }\n        else\n        {\n          snprintf(msg, FLEN_ERRMSG,\"ffgsvj: illegal range specified for axis %ld\", ii + 1);\n          ffpmsg(msg);\n          return(*status = BAD_PIX_NUM);\n        }\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n      dsize[ii] = dsize[ii] * dir[ii];\n    }\n    dsize[naxis] = dsize[naxis] * dir[naxis];\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0]*dir[0] - str[0]*dir[0]) / inc[0] + 1;\n      ninc = incr[0] * dir[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]*dir[8]; i8 <= stp[8]*dir[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]*dir[7]; i7 <= stp[7]*dir[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]*dir[6]; i6 <= stp[6]*dir[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]*dir[5]; i5 <= stp[5]*dir[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]*dir[4]; i4 <= stp[4]*dir[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]*dir[3]; i3 <= stp[3]*dir[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]*dir[2]; i2 <= stp[2]*dir[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]*dir[1]; i1 <= stp[1]*dir[1]; i1 += incr[1])\n            {\n\n              felem=str[0] + (i1 - dir[1]) * dsize[1] + (i2 - dir[2]) * dsize[2] + \n                             (i3 - dir[3]) * dsize[3] + (i4 - dir[4]) * dsize[4] +\n                             (i5 - dir[5]) * dsize[5] + (i6 - dir[6]) * dsize[6] +\n                             (i7 - dir[7]) * dsize[7] + (i8 - dir[8]) * dsize[8];\n\n              if ( ffgcljj(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &ldummy, &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsfjj(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           LONGLONG *array,/* O - array to be filled and returned           */\n           char *flagval,  /* O - set to 1 if corresponding value is null   */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dsize[10];\n    LONGLONG blcll[9], trcll[9];\n    long felem, nelem, nultyp, ninc, numcol;\n    LONGLONG nulval = 0;\n    int hdutype, anyf;\n    char msg[FLEN_ERRMSG];\n    int nullcheck = 2;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvj is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n         fits_read_compressed_img(fptr, TLONGLONG, blcll, trcll, inc,\n            nullcheck, NULL, array, flagval, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 2;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        snprintf(msg, FLEN_ERRMSG,\"ffgsvj: illegal range specified for axis %ld\", ii + 1);\n        ffpmsg(msg);\n        return(*status = BAD_PIX_NUM);\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n    }\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0] - str[0]) / inc[0] + 1;\n      ninc = incr[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1])\n            {\n              felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + \n                             (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] +\n                             (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] +\n                             (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8];\n\n              if ( ffgcljj(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &flagval[i0], &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffggpjj(fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            long  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            long  nelem,      /* I - number of values to read                */\n            LONGLONG  *array, /* O - array of values that are returned       */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of group parameters from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n*/\n{\n    long row;\n    int idummy;\n    char cdummy;\n    LONGLONG dummy = 0;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcljj(fptr, 1, row, firstelem, nelem, 1, 1, dummy,\n               array, &cdummy, &idummy, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcvjj(fitsfile *fptr,  /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           LONGLONG  nulval, /* I - value for null pixels                   */\n           LONGLONG *array,  /* O - array of values that are read           */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Any undefined pixels will be set equal to the value of 'nulval' unless\n  nulval = 0 in which case no checks for undefined pixels will be made.\n*/\n{\n    char cdummy;\n\n    ffgcljj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval,\n           array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcfjj(fitsfile *fptr,  /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           LONGLONG  *array, /* O - array of values that are read           */\n           char *nularray,   /* O - array of flags: 1 if null pixel; else 0 */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Nularray will be set = 1 if the corresponding array pixel is undefined, \n  otherwise nularray will = 0.\n*/\n{\n    LONGLONG dummy = 0;\n\n    ffgcljj(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy,\n           array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcljj( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            long  elemincre,  /* I - pixel increment; e.g., 2 = every other  */\n            int   nultyp,     /* I - null value handling code:               */\n                              /*     1: set undefined pixels = nulval        */\n                              /*     2: set nularray=1 for undefined pixels  */\n            LONGLONG  nulval, /* I - value for null pixels if nultyp = 1     */\n            LONGLONG  *array, /* O - array of values that are read           */\n            char *nularray,   /* O - array of flags = 1 if nultyp = 2        */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer be a virtual column in a 1 or more grouped FITS primary\n  array or image extension.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The output array of values will be converted from the datatype of the column \n  and will be scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    double scale, zero, power = 1., dtemp;\n    int tcode, maxelem2, hdutype, xcode, decimals;\n    long twidth, incre;\n    long ii, xwidth, ntodo;\n    int convert, nulcheck, readcheck = 0;\n    LONGLONG repeat, startpos, elemnum, readptr, tnull;\n    LONGLONG rowlen, rownum, remain, next, rowincre, maxelem;\n    char tform[20];\n    char message[FLEN_ERRMSG];\n    char snull[20];   /*  the FITS null value if reading from ASCII table  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0 || nelem == 0)  /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    if (anynul)\n        *anynul = 0;\n\n    if (nultyp == 2)\n        memset(nularray, 0, (size_t) nelem);   /* initialize nullarray */\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (elemincre < 0)\n        readcheck = -1;  /* don't do range checking in this case */\n\n    if (ffgcprll(fptr, colnum, firstrow, firstelem, nelem, readcheck, &scale, &zero,\n         tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre,\n         &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 )\n         return(*status);\n    maxelem = maxelem2;\n\n    incre *= elemincre;   /* multiply incre to just get every nth pixel */\n\n    if (tcode == TSTRING)    /* setup for ASCII tables */\n    {\n      /* get the number of implied decimal places if no explicit decmal point */\n      ffasfm(tform, &xcode, &xwidth, &decimals, status); \n      for(ii = 0; ii < decimals; ii++)\n        power *= 10.;\n    }\n    /*------------------------------------------------------------------*/\n    /*  Decide whether to check for null values in the input FITS file: */\n    /*------------------------------------------------------------------*/\n    nulcheck = nultyp; /* by default check for null values in the FITS file */\n\n    if (nultyp == 1 && nulval == 0)\n       nulcheck = 0;    /* calling routine does not want to check for nulls */\n\n    else if (tcode%10 == 1 &&        /* if reading an integer column, and  */ \n            tnull == NULL_UNDEFINED) /* if a null value is not defined,    */\n            nulcheck = 0;            /* then do not check for null values. */\n\n    else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TBYTE && (tnull > 255 || tnull < 0) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED)\n         nulcheck = 0;\n\n    /*----------------------------------------------------------------------*/\n    /*  If FITS column and output data array have same datatype, then we do */\n    /*  not need to use a temporary buffer to store intermediate datatype.  */\n    /*----------------------------------------------------------------------*/\n    convert = 1;\n    if (tcode == TLONGLONG)  /* Special Case:                        */\n    {                             /* no type convertion required, so read */\n                                  /* data directly into output buffer.    */\n\n        if (nelem < (LONGLONG)INT32_MAX/8) {\n            maxelem = nelem;\n        } else {\n            maxelem = INT32_MAX/8;\n        }\n\n        if (nulcheck == 0 && scale == 1. && zero == 0.)\n            convert = 0;  /* no need to scale data or find nulls */\n    }\n\n    /*---------------------------------------------------------------------*/\n    /*  Now read the pixels from the FITS column. If the column does not   */\n    /*  have the same datatype as the output array, then we have to read   */\n    /*  the raw values into a temporary buffer (of limited size).  In      */\n    /*  the case of a vector colum read only 1 vector of values at a time  */\n    /*  then skip to the next row if more values need to be read.          */\n    /*  After reading the raw values, then call the fffXXYY routine to (1) */\n    /*  test for undefined values, (2) convert the datatype if necessary,  */\n    /*  and (3) scale the values by the FITS TSCALn and TZEROn linear      */\n    /*  scaling parameters.                                                */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to read */\n    next = 0;                 /* next element in array to be read   */\n    rownum = 0;               /* row number, relative to firstrow   */\n\n    while (remain)\n    {\n        /* limit the number of pixels to read at one time to the number that\n           will fit in the buffer or to the number of pixels that remain in\n           the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);\n        if (elemincre >= 0)\n        {\n          ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1));\n        }\n        else\n        {\n          ntodo = (long) minvalue(ntodo, (elemnum/(-elemincre) +1));\n        }\n\n        readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre));\n\n        switch (tcode) \n        {\n            case (TLONGLONG):\n                ffgi8b(fptr, readptr, ntodo, incre, (long *) &array[next],\n                       status);\n                if (convert)\n                    fffi8i8((LONGLONG *) &array[next], ntodo, scale, zero, \n                           nulcheck, tnull, nulval, &nularray[next], \n                           anynul, &array[next], status);\n                break;\n            case (TLONG):\n                ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) buffer,\n                       status);\n                fffi4i8((INT32BIT *) buffer, ntodo, scale, zero, \n                        nulcheck, (INT32BIT) tnull, nulval, &nularray[next], \n                        anynul, &array[next], status);\n                break;\n            case (TBYTE):\n                ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer,\n                       status);\n                fffi1i8((unsigned char *) buffer, ntodo, scale, zero, nulcheck, \n                     (unsigned char) tnull, nulval, &nularray[next], anynul, \n                     &array[next], status);\n                break;\n            case (TSHORT):\n                ffgi2b(fptr, readptr, ntodo, incre, (short  *) buffer, status);\n                fffi2i8((short  *) buffer, ntodo, scale, zero, nulcheck, \n                      (short) tnull, nulval, &nularray[next], anynul, \n                      &array[next], status);\n                break;\n            case (TFLOAT):\n                ffgr4b(fptr, readptr, ntodo, incre, (float  *) buffer, status);\n                fffr4i8((float  *) buffer, ntodo, scale, zero, nulcheck, \n                       nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TDOUBLE):\n                ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status);\n                fffr8i8((double *) buffer, ntodo, scale, zero, nulcheck, \n                          nulval, &nularray[next], anynul, \n                          &array[next], status);\n                break;\n            case (TSTRING):\n                ffmbyt(fptr, readptr, REPORT_EOF, status);\n       \n                if (incre == twidth)    /* contiguous bytes */\n                     ffgbyt(fptr, ntodo * twidth, buffer, status);\n                else\n                     ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                               status);\n\n                fffstri8((char *) buffer, ntodo, scale, zero, twidth, power,\n                     nulcheck, snull, nulval, &nularray[next], anynul,\n                     &array[next], status);\n                break;\n\n            default:  /*  error trap for invalid column format */\n                snprintf(message,FLEN_ERRMSG, \n                   \"Cannot read numbers from column %d which has format %s\",\n                    colnum, tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous read operation */\n        {\n\t  dtemp = (double) next;\n          if (hdutype > 0)\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgclj).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from image (ffgclj).\",\n              dtemp+1., dtemp+ntodo);\n\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum = elemnum + (ntodo * elemincre);\n\n            if (elemnum >= repeat)  /* completed a row; start on later row */\n            {\n                rowincre = elemnum / repeat;\n                rownum += rowincre;\n                elemnum = elemnum - (rowincre * repeat);\n            }\n            else if (elemnum < 0)  /* completed a row; start on a previous row */\n            {\n                rowincre = (-elemnum - 1) / repeat + 1;\n                rownum -= rowincre;\n                elemnum = (rowincre * repeat) + elemnum;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while reading FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi1i8(unsigned char *input, /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char tnull,  /* I - value of FITS TNULLn keyword if any */\n            LONGLONG nullval,     /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            LONGLONG *output,     /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (LONGLONG) input[ii];  /* copy input to output */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DLONGLONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MIN;\n                }\n                else if (dvalue > DLONGLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MAX;\n                }\n                else\n                    output[ii] = (LONGLONG) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (LONGLONG) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DLONGLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MIN;\n                    }\n                    else if (dvalue > DLONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MAX;\n                    }\n                    else\n                        output[ii] = (LONGLONG) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi2i8(short *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short tnull,          /* I - value of FITS TNULLn keyword if any */\n            LONGLONG nullval,     /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            LONGLONG *output,     /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (LONGLONG) input[ii];   /* copy input to output */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DLONGLONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MIN;\n                }\n                else if (dvalue > DLONGLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MAX;\n                }\n                else\n                    output[ii] = (LONGLONG) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (LONGLONG) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DLONGLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MIN;\n                    }\n                    else if (dvalue > DLONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MAX;\n                    }\n                    else\n                        output[ii] = (LONGLONG) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi4i8(INT32BIT *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            INT32BIT tnull,       /* I - value of FITS TNULLn keyword if any */\n            LONGLONG nullval,     /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            LONGLONG *output,     /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (LONGLONG) input[ii];   /* copy input to output */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DLONGLONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MIN;\n                }\n                else if (dvalue > DLONGLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MAX;\n                }\n                else\n                    output[ii] = (LONGLONG) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (LONGLONG) input[ii];\n\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DLONGLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MIN;\n                    }\n                    else if (dvalue > DLONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MAX;\n                    }\n                    else\n                        output[ii] = (LONGLONG) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi8i8(LONGLONG *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            LONGLONG tnull,       /* I - value of FITS TNULLn keyword if any */\n            LONGLONG nullval,     /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            LONGLONG *output,     /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    ULONGLONG ulltemp;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of adding 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                if (ulltemp > LONGLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MAX;\n                }\n                else\n\t\t{\n                    output[ii] = (LONGLONG) ulltemp;\n\t\t}\n            }\n        }\n        else if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                output[ii] =  input[ii];   /* copy input to output */\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DLONGLONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MIN;\n                }\n                else if (dvalue > DLONGLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MAX;\n                }\n                else\n                    output[ii] = (LONGLONG) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of subtracting 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) { \n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n\t\t{\n                    ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                    if (ulltemp > LONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MAX;\n                    }\n                    else\n\t\t    {\n                        output[ii] = (LONGLONG) ulltemp;\n\t\t    }\n                }\n            }\n        }\n        else if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = input[ii];\n\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DLONGLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MIN;\n                    }\n                    else if (dvalue > DLONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MAX;\n                    }\n                    else\n                        output[ii] = (LONGLONG) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr4i8(float *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            LONGLONG nullval,     /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            LONGLONG *output,     /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DLONGLONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MIN;\n                }\n                else if (input[ii] > DLONGLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MAX;\n                }\n                else\n                    output[ii] = (LONGLONG) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DLONGLONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MIN;\n                }\n                else if (dvalue > DLONGLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MAX;\n                }\n                else\n                    output[ii] = (LONGLONG) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr++;       /* point to MSBs */\n#endif\n\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DLONGLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MIN;\n                    }\n                    else if (input[ii] > DLONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MAX;\n                    }\n                    else\n                        output[ii] = (LONGLONG) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  {\n                    if (zero < DLONGLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MIN;\n                    }\n                    else if (zero > DLONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MAX;\n                    }\n                    else\n                        output[ii] = (LONGLONG) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DLONGLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MIN;\n                    }\n                    else if (dvalue > DLONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MAX;\n                    }\n                    else\n                        output[ii] = (LONGLONG) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr8i8(double *input,        /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            LONGLONG nullval,     /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            LONGLONG *output,     /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DLONGLONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MIN;\n                }\n                else if (input[ii] > DLONGLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MAX;\n                }\n                else\n                    output[ii] = (LONGLONG) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DLONGLONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MIN;\n                }\n                else if (dvalue > DLONGLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MAX;\n                }\n                else\n                    output[ii] = (LONGLONG) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr += 3;       /* point to MSBs */\n#endif\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DLONGLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MIN;\n                    }\n                    else if (input[ii] > DLONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MAX;\n                    }\n                    else\n                        output[ii] = (LONGLONG) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  {\n                    if (zero < DLONGLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MIN;\n                    }\n                    else if (zero > DLONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MAX;\n                    }\n                    else\n                        output[ii] = (LONGLONG) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DLONGLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MIN;\n                    }\n                    else if (dvalue > DLONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MAX;\n                    }\n                    else\n                        output[ii] = (LONGLONG) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffstri8(char *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            long twidth,          /* I - width of each substring of chars    */\n            double implipower,    /* I - power of 10 of implied decimal      */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            char  *snull,         /* I - value of FITS null string, if any   */\n            LONGLONG nullval,     /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            LONGLONG *output,     /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file. Check\n  for null values and do scaling if required. The nullcheck code value\n  determines how any null values in the input array are treated. A null\n  value is an input pixel that is equal to snull.  If nullcheck= 0, then\n  no special checking for nulls is performed.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    int nullen;\n    long ii;\n    double dvalue;\n    char *cstring, message[FLEN_ERRMSG];\n    char *cptr, *tpos;\n    char tempstore, chrzero = '0';\n    double val, power;\n    int exponent, sign, esign, decpt;\n\n    nullen = strlen(snull);\n    cptr = input;  /* pointer to start of input string */\n    for (ii = 0; ii < ntodo; ii++)\n    {\n      cstring = cptr;\n      /* temporarily insert a null terminator at end of the string */\n      tpos = cptr + twidth;\n      tempstore = *tpos;\n      *tpos = 0;\n\n      /* check if null value is defined, and if the    */\n      /* column string is identical to the null string */\n      if (snull[0] != ASCII_NULL_UNDEFINED && \n         !strncmp(snull, cptr, nullen) )\n      {\n        if (nullcheck)  \n        {\n          *anynull = 1;    \n          if (nullcheck == 1)\n            output[ii] = nullval;\n          else\n            nullarray[ii] = 1;\n        }\n        cptr += twidth;\n      }\n      else\n      {\n        /* value is not the null value, so decode it */\n        /* remove any embedded blank characters from the string */\n\n        decpt = 0;\n        sign = 1;\n        val  = 0.;\n        power = 1.;\n        exponent = 0;\n        esign = 1;\n\n        while (*cptr == ' ')               /* skip leading blanks */\n           cptr++;\n\n        if (*cptr == '-' || *cptr == '+')  /* check for leading sign */\n        {\n          if (*cptr == '-')\n             sign = -1;\n\n          cptr++;\n\n          while (*cptr == ' ')         /* skip blanks between sign and value */\n            cptr++;\n        }\n\n        while (*cptr >= '0' && *cptr <= '9')\n        {\n          val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n          cptr++;\n\n          while (*cptr == ' ')         /* skip embedded blanks in the value */\n            cptr++;\n        }\n\n        if (*cptr == '.' || *cptr == ',')    /* check for decimal point */\n        {\n          decpt = 1;       /* set flag to show there was a decimal point */\n          cptr++;\n          while (*cptr == ' ')         /* skip any blanks */\n            cptr++;\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n            power = power * 10.;\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks in the value */\n              cptr++;\n          }\n        }\n\n        if (*cptr == 'E' || *cptr == 'D')  /* check for exponent */\n        {\n          cptr++;\n          while (*cptr == ' ')         /* skip blanks */\n              cptr++;\n  \n          if (*cptr == '-' || *cptr == '+')  /* check for exponent sign */\n          {\n            if (*cptr == '-')\n               esign = -1;\n\n            cptr++;\n\n            while (*cptr == ' ')        /* skip blanks between sign and exp */\n              cptr++;\n          }\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            exponent = exponent * 10 + *cptr - chrzero;  /* accumulate exp */\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks */\n              cptr++;\n          }\n        }\n\n        if (*cptr  != 0)  /* should end up at the null terminator */\n        {\n          snprintf(message, FLEN_ERRMSG, \"Cannot read number from ASCII table\");\n          ffpmsg(message);\n          snprintf(message, FLEN_ERRMSG,\"Column field = %s.\", cstring);\n          ffpmsg(message);\n          /* restore the char that was overwritten by the null */\n          *tpos = tempstore;\n          return(*status = BAD_C2D);\n        }\n\n        if (!decpt)  /* if no explicit decimal, use implied */\n           power = implipower;\n\n        dvalue = (sign * val / power) * pow(10., (double) (esign * exponent));\n\n        dvalue = dvalue * scale + zero;   /* apply the scaling */\n\n        if (dvalue < DLONGLONG_MIN)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = LONGLONG_MIN;\n        }\n        else if (dvalue > DLONGLONG_MAX)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = LONGLONG_MAX;\n        }\n        else\n            output[ii] = (LONGLONG) dvalue;\n      }\n      /* restore the char that was overwritten by the null */\n      *tpos = tempstore;\n    }\n    return(*status);\n}\n"},{"id":16675,"name":"histo.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*   Globally defined histogram parameters */\n#include <string.h>\n#include <ctype.h>\n#include <math.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n\ntypedef struct {  /*  Structure holding all the histogramming information   */\n   union {        /*  the iterator work functions (ffwritehist, ffcalchist) */\n      char   *b;  /*  need to do their job... passed via *userPointer.      */\n      short  *i;\n      int    *j;\n      float  *r;\n      double *d;\n   } hist;\n\n   fitsfile *tblptr;\n\n   int   haxis, hcolnum[4], himagetype;\n   long  haxis1, haxis2, haxis3, haxis4;\n   double amin1, amin2, amin3, amin4;\n   double maxbin1, maxbin2, maxbin3, maxbin4;\n   double binsize1, binsize2, binsize3, binsize4;\n   int   wtrecip, wtcolnum;\n   double weight;\n   char  *rowselector;\n\n} histType;\n\n/*--------------------------------------------------------------------------*/\nint ffbins(char *binspec,   /* I - binning specification */\n                   int *imagetype,      /* O - image type, TINT or TSHORT */\n                   int *histaxis,       /* O - no. of axes in the histogram */\n                   char colname[4][FLEN_VALUE],  /* column name for axis */\n                   double *minin,        /* minimum value for each axis */\n                   double *maxin,        /* maximum value for each axis */\n                   double *binsizein,    /* size of bins on each axis */\n                   char minname[4][FLEN_VALUE],  /* keyword name for min */\n                   char maxname[4][FLEN_VALUE],  /* keyword name for max */\n                   char binname[4][FLEN_VALUE],  /* keyword name for binsize */\n                   double *wt,          /* weighting factor          */\n                   char *wtname,        /* keyword or column name for weight */\n                   int *recip,          /* the reciprocal of the weight? */\n                   int *status)\n{\n/*\n   Parse the input binning specification string, returning the binning\n   parameters.  Supports up to 4 dimensions.  The binspec string has\n   one of these forms:\n\n   bin binsize                  - 2D histogram with binsize on each axis\n   bin xcol                     - 1D histogram on column xcol\n   bin (xcol, ycol) = binsize   - 2D histogram with binsize on each axis\n   bin x=min:max:size, y=min:max:size, z..., t... \n   bin x=:max, y=::size\n   bin x=size, y=min::size\n\n   most other reasonable combinations are supported.        \n*/\n    int ii, slen, defaulttype;\n    char *ptr, tmpname[FLEN_VALUE], *file_expr = NULL;\n    double  dummy;\n\n    if (*status > 0)\n         return(*status);\n\n    /* set the default values */\n    *histaxis = 2;\n    *imagetype = TINT;\n    defaulttype = 1;\n    *wt = 1.;\n    *recip = 0;\n    *wtname = '\\0';\n\n    /* set default values */\n    for (ii = 0; ii < 4; ii++)\n    {\n        *colname[ii] = '\\0';\n        *minname[ii] = '\\0';\n        *maxname[ii] = '\\0';\n        *binname[ii] = '\\0';\n        minin[ii] = DOUBLENULLVALUE;  /* undefined values */\n        maxin[ii] = DOUBLENULLVALUE;\n        binsizein[ii] = DOUBLENULLVALUE;\n    }\n\n    ptr = binspec + 3;  /* skip over 'bin' */\n\n    if (*ptr == 'i' )  /* bini */\n    {\n        *imagetype = TSHORT;\n        defaulttype = 0;\n        ptr++;\n    }\n    else if (*ptr == 'j' )  /* binj; same as default */\n    {\n        defaulttype = 0;\n        ptr ++;\n    }\n    else if (*ptr == 'r' )  /* binr */\n    {\n        *imagetype = TFLOAT;\n        defaulttype = 0;\n        ptr ++;\n    }\n    else if (*ptr == 'd' )  /* bind */\n    {\n        *imagetype = TDOUBLE;\n        defaulttype = 0;\n        ptr ++;\n    }\n    else if (*ptr == 'b' )  /* binb */\n    {\n        *imagetype = TBYTE;\n        defaulttype = 0;\n        ptr ++;\n    }\n\n    if (*ptr == '\\0')  /* use all defaults for other parameters */\n        return(*status);\n    else if (*ptr != ' ')  /* must be at least one blank */\n    {\n        ffpmsg(\"binning specification syntax error:\");\n        ffpmsg(binspec);\n        return(*status = URL_PARSE_ERROR);\n    }\n\n    while (*ptr == ' ')  /* skip over blanks */\n           ptr++;\n\n    if (*ptr == '\\0')   /* no other parameters; use defaults */\n        return(*status);\n\n    /* Check if need to import expression from a file */\n\n    if( *ptr=='@' ) {\n       if( ffimport_file( ptr+1, &file_expr, status ) ) return(*status);\n       ptr = file_expr;\n       while (*ptr == ' ')\n               ptr++;       /* skip leading white space... again */\n    }\n\n    if (*ptr == '(' )\n    {\n        /* this must be the opening parenthesis around a list of column */\n        /* names, optionally followed by a '=' and the binning spec. */\n\n        for (ii = 0; ii < 4; ii++)\n        {\n            ptr++;               /* skip over the '(', ',', or ' ') */\n            while (*ptr == ' ')  /* skip over blanks */\n                ptr++;\n\n            slen = strcspn(ptr, \" ,)\");\n            strncat(colname[ii], ptr, slen); /* copy 1st column name */\n\n            ptr += slen;\n            while (*ptr == ' ')  /* skip over blanks */\n                ptr++;\n\n            if (*ptr == ')' )   /* end of the list of names */\n            {\n                *histaxis = ii + 1;\n                break;\n            }\n        }\n\n        if (ii == 4)   /* too many names in the list , or missing ')'  */\n        {\n            ffpmsg(\n \"binning specification has too many column names or is missing closing ')':\");\n            ffpmsg(binspec);\n\t    if( file_expr ) free( file_expr );\n            return(*status = URL_PARSE_ERROR);\n        }\n\n        ptr++;  /* skip over the closing parenthesis */\n        while (*ptr == ' ')  /* skip over blanks */\n            ptr++;\n\n        if (*ptr == '\\0') {\n\t    if( file_expr ) free( file_expr );\n            return(*status);  /* parsed the entire string */\n\t}\n\n        else if (*ptr != '=')  /* must be an equals sign now*/\n        {\n            ffpmsg(\"illegal binning specification in URL:\");\n            ffpmsg(\" an equals sign '=' must follow the column names\");\n            ffpmsg(binspec);\n\t    if( file_expr ) free( file_expr );\n            return(*status = URL_PARSE_ERROR);\n        }\n\n        ptr++;  /* skip over the equals sign */\n        while (*ptr == ' ')  /* skip over blanks */\n            ptr++;\n\n        /* get the single range specification for all the columns */\n        ffbinr(&ptr, tmpname, minin,\n                                     maxin, binsizein, minname[0],\n                                     maxname[0], binname[0], status);\n        if (*status > 0)\n        {\n            ffpmsg(\"illegal binning specification in URL:\");\n            ffpmsg(binspec);\n\t    if( file_expr ) free( file_expr );\n            return(*status);\n        }\n\n        for (ii = 1; ii < *histaxis; ii++)\n        {\n            minin[ii] = minin[0];\n            maxin[ii] = maxin[0];\n            binsizein[ii] = binsizein[0];\n            strcpy(minname[ii], minname[0]);\n            strcpy(maxname[ii], maxname[0]);\n            strcpy(binname[ii], binname[0]);\n        }\n\n        while (*ptr == ' ')  /* skip over blanks */\n            ptr++;\n\n        if (*ptr == ';')\n            goto getweight;   /* a weighting factor is specified */\n\n        if (*ptr != '\\0')  /* must have reached end of string */\n        {\n            ffpmsg(\"illegal syntax after binning range specification in URL:\");\n            ffpmsg(binspec);\n\t    if( file_expr ) free( file_expr );\n            return(*status = URL_PARSE_ERROR);\n        }\n\n        return(*status);\n    }             /* end of case with list of column names in ( )  */\n\n    /* if we've reached this point, then the binning specification */\n    /* must be of the form: XCOL = min:max:binsize, YCOL = ...     */\n    /* where the column name followed by '=' are optional.         */\n    /* If the column name is not specified, then use the default name */\n\n    for (ii = 0; ii < 4; ii++) /* allow up to 4 histogram dimensions */\n    {\n        ffbinr(&ptr, colname[ii], &minin[ii],\n                                     &maxin[ii], &binsizein[ii], minname[ii],\n                                     maxname[ii], binname[ii], status);\n\n        if (*status > 0)\n        {\n            ffpmsg(\"illegal syntax in binning range specification in URL:\");\n            ffpmsg(binspec);\n\t    if( file_expr ) free( file_expr );\n            return(*status);\n        }\n\n        if (*ptr == '\\0' || *ptr == ';')\n            break;        /* reached the end of the string */\n\n        if (*ptr == ' ')\n        {\n            while (*ptr == ' ')  /* skip over blanks */\n                ptr++;\n\n            if (*ptr == '\\0' || *ptr == ';')\n                break;        /* reached the end of the string */\n\n            if (*ptr == ',')\n                ptr++;  /* comma separates the next column specification */\n        }\n        else if (*ptr == ',')\n        {          \n            ptr++;  /* comma separates the next column specification */\n        }\n        else\n        {\n            ffpmsg(\"illegal characters following binning specification in URL:\");\n            ffpmsg(binspec);\n\t    if( file_expr ) free( file_expr );\n            return(*status = URL_PARSE_ERROR);\n        }\n    }\n\n    if (ii == 4)\n    {\n        /* there are yet more characters in the string */\n        ffpmsg(\"illegal binning specification in URL:\");\n        ffpmsg(\"apparently greater than 4 histogram dimensions\");\n        ffpmsg(binspec);\n        return(*status = URL_PARSE_ERROR);\n    }\n    else\n        *histaxis = ii + 1;\n\n    /* special case: if a single number was entered it should be      */\n    /* interpreted as the binning factor for the default X and Y axes */\n\n    if (*histaxis == 1 && *colname[0] == '\\0' && \n         minin[0] == DOUBLENULLVALUE && maxin[0] == DOUBLENULLVALUE)\n    {\n        *histaxis = 2;\n        binsizein[1] = binsizein[0];\n    }\n\ngetweight:\n    if (*ptr == ';')  /* looks like a weighting factor is given */\n    {\n        ptr++;\n       \n        while (*ptr == ' ')  /* skip over blanks */\n            ptr++;\n\n        recip = 0;\n        if (*ptr == '/')\n        {\n            *recip = 1;  /* the reciprocal of the weight is entered */\n            ptr++;\n\n            while (*ptr == ' ')  /* skip over blanks */\n                ptr++;\n        }\n\n        /* parse the weight as though it were a binrange. */\n        /* either a column name or a numerical value will be returned */\n\n        ffbinr(&ptr, wtname, &dummy, &dummy, wt, tmpname,\n                                     tmpname, tmpname, status);\n\n        if (*status > 0)\n        {\n            ffpmsg(\"illegal binning weight specification in URL:\");\n            ffpmsg(binspec);\n\t    if( file_expr ) free( file_expr );\n            return(*status);\n        }\n\n        /* creat a float datatype histogram by default, if weight */\n        /* factor is not = 1.0  */\n\n        if ( (defaulttype && *wt != 1.0) || (defaulttype && *wtname) )\n            *imagetype = TFLOAT;\n    }\n\n    while (*ptr == ' ')  /* skip over blanks */\n         ptr++;\n\n    if (*ptr != '\\0')  /* should have reached the end of string */\n    {\n        ffpmsg(\"illegal syntax after binning weight specification in URL:\");\n        ffpmsg(binspec);\n        *status = URL_PARSE_ERROR;\n    }\n\n    if( file_expr ) free( file_expr );\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffbinr(char **ptr, \n                   char *colname, \n                   double *minin,\n                   double *maxin, \n                   double *binsizein,\n                   char *minname,\n                   char *maxname,\n                   char *binname,\n                   int *status)\n/*\n   Parse the input binning range specification string, returning \n   the column name, histogram min and max values, and bin size.\n*/\n{\n    int slen, isanumber=0;\n    char *token=0;\n\n    if (*status > 0)\n        return(*status);\n\n    slen = fits_get_token2(ptr, \" ,=:;\", &token, &isanumber, status); /* get 1st token */\n\n    if ((*status) || (slen == 0 && (**ptr == '\\0' || **ptr == ',' || **ptr == ';')) )\n        return(*status);   /* a null range string */\n        \n    if (!isanumber && **ptr != ':')\n    {\n        /* this looks like the column name */\n        \n        /* Check for case where col name string is empty but '='\n           is still there (indicating a following specification string).\n           Musn't enter this block as token would not have been allocated. */\n        if (token)\n        {\n           if (strlen(token) > FLEN_VALUE-1)\n           {\n              ffpmsg(\"column name too long (ffbinr)\");\n              free(token);\n              return(*status=PARSE_SYNTAX_ERR);\n           }\n           if (token[0] == '#' && isdigit((int) token[1]) )\n           {\n               /* omit the leading '#' in the column number */\n               strcpy(colname, token+1);\n           }\n           else\n               strcpy(colname, token);\n           free(token);\n           token=0;\n        }\n        while (**ptr == ' ')  /* skip over blanks */\n             (*ptr)++;\n\n        if (**ptr != '=')\n            return(*status);  /* reached the end */\n            \n        (*ptr)++;   /* skip over the = sign */\n\n        while (**ptr == ' ')  /* skip over blanks */\n             (*ptr)++;\n\n        /* get specification info */\n        slen = fits_get_token2(ptr, \" ,:;\", &token, &isanumber, status);\n        if (*status)\n           return(*status);\n    }\n\n    if (**ptr != ':')\n    {\n        /* This is the first token, and since it is not followed by \n         a ':' this must be the binsize token. Or it could be empty. */\n        if (token)\n        {\n           if (!isanumber)\n           {\n               if (strlen(token) > FLEN_VALUE-1)\n               {\n                  ffpmsg(\"binname too long (ffbinr)\");\n                  free(token);\n                  return(*status=PARSE_SYNTAX_ERR);\n               }\n               strcpy(binname, token);\n           }\n           else\n               *binsizein =  strtod(token, NULL);\n\n           free(token);\n        }\n           \n        return(*status);  /* reached the end */\n    }\n    else\n    {\n        /* the token contains the min value */\n        if (slen)\n        {\n            if (!isanumber)\n            {\n                if (strlen(token) > FLEN_VALUE-1)\n                {\n                   ffpmsg(\"minname too long (ffbinr)\");\n                   free(token);\n                   return(*status=PARSE_SYNTAX_ERR);\n                }\n                strcpy(minname, token);\n            }\n            else\n                *minin = strtod(token, NULL);\n            free(token);\n            token=0;\n        }\n    }\n\n    (*ptr)++;  /* skip the colon between the min and max values */\n    slen = fits_get_token2(ptr, \" ,:;\", &token, &isanumber, status); /* get token */\n    if (*status)\n       return(*status);\n\n    /* the token contains the max value */\n    if (slen)\n    {\n        if (!isanumber)\n        {\n            if (strlen(token) > FLEN_VALUE-1)\n            {\n               ffpmsg(\"maxname too long (ffbinr)\");\n               free(token);\n               return(*status=PARSE_SYNTAX_ERR);\n            }\n            strcpy(maxname, token);\n        }\n        else\n            *maxin = strtod(token, NULL);\n        free(token);\n        token=0;\n    }\n\n    if (**ptr != ':')\n    {\n        free(token);\n        return(*status);  /* reached the end; no binsize token */\n    }\n\n    (*ptr)++;  /* skip the colon between the max and binsize values */\n    slen = fits_get_token2(ptr, \" ,:;\", &token, &isanumber, status); /* get token */\n    if (*status)\n       return(*status);\n\n    /* the token contains the binsize value */\n    if (slen)\n    {\n        if (!isanumber)\n        {\n            if (strlen(token) > FLEN_VALUE-1)\n            {\n               ffpmsg(\"binname too long (ffbinr)\");\n               free(token);\n               return(*status=PARSE_SYNTAX_ERR);\n            }\n            strcpy(binname, token);\n        }\n        else\n            *binsizein = strtod(token, NULL);\n        free(token);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffhist2(fitsfile **fptr,  /* IO - pointer to table with X and Y cols;    */\n                             /*     on output, points to histogram image    */\n           char *outfile,    /* I - name for the output histogram file      */\n           int imagetype,    /* I - datatype for image: TINT, TSHORT, etc   */\n           int naxis,        /* I - number of axes in the histogram image   */\n           char colname[4][FLEN_VALUE],   /* I - column names               */\n           double *minin,     /* I - minimum histogram value, for each axis */\n           double *maxin,     /* I - maximum histogram value, for each axis */\n           double *binsizein, /* I - bin size along each axis               */\n           char minname[4][FLEN_VALUE], /* I - optional keywords for min    */\n           char maxname[4][FLEN_VALUE], /* I - optional keywords for max    */\n           char binname[4][FLEN_VALUE], /* I - optional keywords for binsize */\n           double weightin,        /* I - binning weighting factor          */\n           char wtcol[FLEN_VALUE], /* I - optional keyword or col for weight*/\n           int recip,              /* I - use reciprocal of the weight?     */\n           char *selectrow,        /* I - optional array (length = no. of   */\n                             /* rows in the table).  If the element is true */\n                             /* then the corresponding row of the table will*/\n                             /* be included in the histogram, otherwise the */\n                             /* row will be skipped.  Ingnored if *selectrow*/\n                             /* is equal to NULL.                           */\n           int *status)\n{\n    fitsfile *histptr;\n    int   bitpix, colnum[4], wtcolnum;\n    long haxes[4];\n    double amin[4], amax[4], binsize[4],  weight;\n\n    if (*status > 0)\n        return(*status);\n\n    if (naxis > 4)\n    {\n        ffpmsg(\"histogram has more than 4 dimensions\");\n        return(*status = BAD_DIMEN);\n    }\n\n    /* reset position to the correct HDU if necessary */\n    if ((*fptr)->HDUposition != ((*fptr)->Fptr)->curhdu)\n        ffmahd(*fptr, ((*fptr)->HDUposition) + 1, NULL, status);\n\n    if (imagetype == TBYTE)\n        bitpix = BYTE_IMG;\n    else if (imagetype == TSHORT)\n        bitpix = SHORT_IMG;\n    else if (imagetype == TINT)\n        bitpix = LONG_IMG;\n    else if (imagetype == TFLOAT)\n        bitpix = FLOAT_IMG;\n    else if (imagetype == TDOUBLE)\n        bitpix = DOUBLE_IMG;\n    else\n        return(*status = BAD_DATATYPE);\n\n    \n    /*    Calculate the binning parameters:    */\n    /*   columm numbers, axes length, min values,  max values, and binsizes.  */\n\n    if (fits_calc_binningd(\n      *fptr, naxis, colname, minin, maxin, binsizein, minname, maxname, binname,\n      colnum,  haxes, amin, amax, binsize, status) > 0)\n    {\n        ffpmsg(\"failed to determine binning parameters\");\n        return(*status);\n    }\n \n    /* get the histogramming weighting factor, if any */\n    if (*wtcol)\n    {\n        /* first, look for a keyword with the weight value */\n        if (ffgky(*fptr, TDOUBLE, wtcol, &weight, NULL, status) )\n        {\n            /* not a keyword, so look for column with this name */\n            *status = 0;\n\n            /* get the column number in the table */\n            if (ffgcno(*fptr, CASEINSEN, wtcol, &wtcolnum, status) > 0)\n            {\n               ffpmsg(\n               \"keyword or column for histogram weights doesn't exist: \");\n               ffpmsg(wtcol);\n               return(*status);\n            }\n\n            weight = DOUBLENULLVALUE;\n        }\n    }\n    else\n        weight = (double) weightin;\n\n    if (weight <= 0. && weight != DOUBLENULLVALUE)\n    {\n        ffpmsg(\"Illegal histogramming weighting factor <= 0.\");\n        return(*status = URL_PARSE_ERROR);\n    }\n\n    if (recip && weight != DOUBLENULLVALUE)\n       /* take reciprocal of weight */\n       weight = (double) (1.0 / weight);\n\n    /* size of histogram is now known, so create temp output file */\n    if (fits_create_file(&histptr, outfile, status) > 0)\n    {\n        ffpmsg(\"failed to create temp output file for histogram\");\n        return(*status);\n    }\n\n    /* create output FITS image HDU */\n    if (ffcrim(histptr, bitpix, naxis, haxes, status) > 0)\n    {\n        ffpmsg(\"failed to create output histogram FITS image\");\n        return(*status);\n    }\n\n    /* copy header keywords, converting pixel list WCS keywords to image WCS form */\n    if (fits_copy_pixlist2image(*fptr, histptr, 9, naxis, colnum, status) > 0)\n    {\n        ffpmsg(\"failed to copy pixel list keywords to new histogram header\");\n        return(*status);\n    }\n\n    /* if the table columns have no WCS keywords, then write default keywords */\n    fits_write_keys_histo(*fptr, histptr, naxis, colnum, status);\n    \n    /* update the WCS keywords for the ref. pixel location, and pixel size */\n    fits_rebin_wcsd(histptr, naxis, amin, binsize,  status);      \n    \n    /* now compute the output image by binning the column values */\n    if (fits_make_histd(*fptr, histptr, bitpix, naxis, haxes, colnum, amin, amax,\n        binsize, weight, wtcolnum, recip, selectrow, status) > 0)\n    {\n        ffpmsg(\"failed to calculate new histogram values\");\n        return(*status);\n    }\n              \n    /* finally, close the original file and return ptr to the new image */\n    ffclos(*fptr, status);\n    *fptr = histptr;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\n\n/* ffhist3: same as ffhist2, but does not close the original file */\n/*  and/or replace the original file pointer */\nfitsfile *ffhist3(fitsfile *fptr, /* I - ptr to table with X and Y cols*/\n           char *outfile,    /* I - name for the output histogram file      */\n           int imagetype,    /* I - datatype for image: TINT, TSHORT, etc   */\n           int naxis,        /* I - number of axes in the histogram image   */\n           char colname[4][FLEN_VALUE],   /* I - column names               */\n           double *minin,     /* I - minimum histogram value, for each axis */\n           double *maxin,     /* I - maximum histogram value, for each axis */\n           double *binsizein, /* I - bin size along each axis               */\n           char minname[4][FLEN_VALUE], /* I - optional keywords for min    */\n           char maxname[4][FLEN_VALUE], /* I - optional keywords for max    */\n           char binname[4][FLEN_VALUE], /* I - optional keywords for binsize */\n           double weightin,        /* I - binning weighting factor          */\n           char wtcol[FLEN_VALUE], /* I - optional keyword or col for weight*/\n           int recip,              /* I - use reciprocal of the weight?     */\n           char *selectrow,        /* I - optional array (length = no. of   */\n                             /* rows in the table).  If the element is true */\n                             /* then the corresponding row of the table will*/\n                             /* be included in the histogram, otherwise the */\n                             /* row will be skipped.  Ingnored if *selectrow*/\n                             /* is equal to NULL.                           */\n           int *status)\n{\n    fitsfile *histptr;\n    int   bitpix, colnum[4], wtcolnum;\n    long haxes[4];\n    double amin[4], amax[4], binsize[4],  weight;\n\n    if (*status > 0)\n        return(NULL);\n\n    if (naxis > 4)\n    {\n        ffpmsg(\"histogram has more than 4 dimensions\");\n\t*status = BAD_DIMEN;\n        return(NULL);\n    }\n\n    /* reset position to the correct HDU if necessary */\n    if ((fptr)->HDUposition != ((fptr)->Fptr)->curhdu)\n        ffmahd(fptr, ((fptr)->HDUposition) + 1, NULL, status);\n\n    if (imagetype == TBYTE)\n        bitpix = BYTE_IMG;\n    else if (imagetype == TSHORT)\n        bitpix = SHORT_IMG;\n    else if (imagetype == TINT)\n        bitpix = LONG_IMG;\n    else if (imagetype == TFLOAT)\n        bitpix = FLOAT_IMG;\n    else if (imagetype == TDOUBLE)\n        bitpix = DOUBLE_IMG;\n    else{\n        *status = BAD_DATATYPE;\n        return(NULL);\n    }\n    \n    /*    Calculate the binning parameters:    */\n    /*   columm numbers, axes length, min values,  max values, and binsizes.  */\n\n    if (fits_calc_binningd(\n      fptr, naxis, colname, minin, maxin, binsizein, minname, maxname, binname,\n      colnum, haxes, amin, amax, binsize, status) > 0)\n    {\n       ffpmsg(\"failed to determine binning parameters\");\n        return(NULL);\n    }\n \n    /* get the histogramming weighting factor, if any */\n    if (*wtcol)\n    {\n        /* first, look for a keyword with the weight value */\n        if (fits_read_key(fptr, TDOUBLE, wtcol, &weight, NULL, status) )\n        {\n            /* not a keyword, so look for column with this name */\n            *status = 0;\n\n            /* get the column number in the table */\n            if (ffgcno(fptr, CASEINSEN, wtcol, &wtcolnum, status) > 0)\n            {\n               ffpmsg(\n               \"keyword or column for histogram weights doesn't exist: \");\n               ffpmsg(wtcol);\n               return(NULL);\n            }\n\n            weight = DOUBLENULLVALUE;\n        }\n    }\n    else\n        weight = (double) weightin;\n\n    if (weight <= 0. && weight != DOUBLENULLVALUE)\n    {\n        ffpmsg(\"Illegal histogramming weighting factor <= 0.\");\n\t*status = URL_PARSE_ERROR;\n        return(NULL);\n    }\n\n    if (recip && weight != DOUBLENULLVALUE)\n       /* take reciprocal of weight */\n       weight = (double) (1.0 / weight);\n\n    /* size of histogram is now known, so create temp output file */\n    if (fits_create_file(&histptr, outfile, status) > 0)\n    {\n        ffpmsg(\"failed to create temp output file for histogram\");\n        return(NULL);\n    }\n\n    /* create output FITS image HDU */\n    if (ffcrim(histptr, bitpix, naxis, haxes, status) > 0)\n    {\n        ffpmsg(\"failed to create output histogram FITS image\");\n        return(NULL);\n    }\n\n    /* copy header keywords, converting pixel list WCS keywords to image WCS */\n    if (fits_copy_pixlist2image(fptr, histptr, 9, naxis, colnum, status) > 0)\n    {\n        ffpmsg(\"failed to copy pixel list keywords to new histogram header\");\n        return(NULL);\n    }\n\n    /* if the table columns have no WCS keywords, then write default keywords */\n    fits_write_keys_histo(fptr, histptr, naxis, colnum, status);\n    \n    /* update the WCS keywords for the ref. pixel location, and pixel size */\n    fits_rebin_wcsd(histptr, naxis, amin, binsize,  status);      \n    \n    /* now compute the output image by binning the column values */\n    if (fits_make_histd(fptr, histptr, bitpix, naxis, haxes, colnum, amin, amax,\n        binsize, weight, wtcolnum, recip, selectrow, status) > 0)\n    {\n        ffpmsg(\"failed to calculate new histogram values\");\n        return(NULL);\n    }\n              \n    return(histptr);\n}\n/*--------------------------------------------------------------------------*/\nint ffhist(fitsfile **fptr,  /* IO - pointer to table with X and Y cols;    */\n                             /*     on output, points to histogram image    */\n           char *outfile,    /* I - name for the output histogram file      */\n           int imagetype,    /* I - datatype for image: TINT, TSHORT, etc   */\n           int naxis,        /* I - number of axes in the histogram image   */\n           char colname[4][FLEN_VALUE],   /* I - column names               */\n           double *minin,     /* I - minimum histogram value, for each axis */\n           double *maxin,     /* I - maximum histogram value, for each axis */\n           double *binsizein, /* I - bin size along each axis               */\n           char minname[4][FLEN_VALUE], /* I - optional keywords for min    */\n           char maxname[4][FLEN_VALUE], /* I - optional keywords for max    */\n           char binname[4][FLEN_VALUE], /* I - optional keywords for binsize */\n           double weightin,        /* I - binning weighting factor          */\n           char wtcol[FLEN_VALUE], /* I - optional keyword or col for weight*/\n           int recip,              /* I - use reciprocal of the weight?     */\n           char *selectrow,        /* I - optional array (length = no. of   */\n                             /* rows in the table).  If the element is true */\n                             /* then the corresponding row of the table will*/\n                             /* be included in the histogram, otherwise the */\n                             /* row will be skipped.  Ingnored if *selectrow*/\n                             /* is equal to NULL.                           */\n           int *status)\n{\n    int ii, datatype, repeat, imin, imax, ibin, bitpix, tstatus, use_datamax = 0;\n    long haxes[4];\n    fitsfile *histptr;\n    char errmsg[FLEN_ERRMSG], keyname[FLEN_KEYWORD], card[FLEN_CARD];\n    tcolumn *colptr;\n    iteratorCol imagepars[1];\n    int n_cols = 1, nkeys;\n    long  offset = 0;\n    long n_per_loop = -1;  /* force whole array to be passed at one time */\n    histType histData;    /* Structure holding histogram info for iterator */\n    \n    double amin[4], amax[4], binsize[4], maxbin[4];\n    double datamin = DOUBLENULLVALUE, datamax = DOUBLENULLVALUE;\n    char svalue[FLEN_VALUE];\n    double dvalue;\n    char cpref[4][FLEN_VALUE];\n    char *cptr;\n\n    if (*status > 0)\n        return(*status);\n\n    if (naxis > 4)\n    {\n        ffpmsg(\"histogram has more than 4 dimensions\");\n        return(*status = BAD_DIMEN);\n    }\n\n    /* reset position to the correct HDU if necessary */\n    if ((*fptr)->HDUposition != ((*fptr)->Fptr)->curhdu)\n        ffmahd(*fptr, ((*fptr)->HDUposition) + 1, NULL, status);\n\n    histData.tblptr     = *fptr;\n    histData.himagetype = imagetype;\n    histData.haxis      = naxis;\n    histData.rowselector = selectrow;\n\n    if (imagetype == TBYTE)\n        bitpix = BYTE_IMG;\n    else if (imagetype == TSHORT)\n        bitpix = SHORT_IMG;\n    else if (imagetype == TINT)\n        bitpix = LONG_IMG;\n    else if (imagetype == TFLOAT)\n        bitpix = FLOAT_IMG;\n    else if (imagetype == TDOUBLE)\n        bitpix = DOUBLE_IMG;\n    else\n        return(*status = BAD_DATATYPE);\n\n    /* The CPREF keyword, if it exists, gives the preferred columns. */\n    /* Otherwise, assume \"X\", \"Y\", \"Z\", and \"T\"  */\n\n    tstatus = 0;\n    ffgky(*fptr, TSTRING, \"CPREF\", cpref[0], NULL, &tstatus);\n\n    if (!tstatus)\n    {\n        /* Preferred column names are given;  separate them */\n        cptr = cpref[0];\n\n        /* the first preferred axis... */\n        while (*cptr != ',' && *cptr != '\\0')\n           cptr++;\n\n        if (*cptr != '\\0')\n        {\n           *cptr = '\\0';\n           cptr++;\n           while (*cptr == ' ')\n               cptr++;\n\n           strcpy(cpref[1], cptr);\n           cptr = cpref[1];\n\n          /* the second preferred axis... */\n          while (*cptr != ',' && *cptr != '\\0')\n             cptr++;\n\n          if (*cptr != '\\0')\n          {\n             *cptr = '\\0';\n             cptr++;\n             while (*cptr == ' ')\n                 cptr++;\n\n             strcpy(cpref[2], cptr);\n             cptr = cpref[2];\n\n            /* the third preferred axis... */\n            while (*cptr != ',' && *cptr != '\\0')\n               cptr++;\n\n            if (*cptr != '\\0')\n            {\n               *cptr = '\\0';\n               cptr++;\n               while (*cptr == ' ')\n                   cptr++;\n\n               strcpy(cpref[3], cptr);\n\n            }\n          }\n        }\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n\n      /* get the min, max, and binsize values from keywords, if specified */\n\n      if (*minname[ii])\n      {\n         if (ffgky(*fptr, TDOUBLE, minname[ii], &minin[ii], NULL, status) )\n         {\n             ffpmsg(\"error reading histogramming minimum keyword\");\n             ffpmsg(minname[ii]);\n             return(*status);\n         }\n      }\n\n      if (*maxname[ii])\n      {\n         if (ffgky(*fptr, TDOUBLE, maxname[ii], &maxin[ii], NULL, status) )\n         {\n             ffpmsg(\"error reading histogramming maximum keyword\");\n             ffpmsg(maxname[ii]);\n             return(*status);\n         }\n      }\n\n      if (*binname[ii])\n      {\n         if (ffgky(*fptr, TDOUBLE, binname[ii], &binsizein[ii], NULL, status) )\n         {\n             ffpmsg(\"error reading histogramming binsize keyword\");\n             ffpmsg(binname[ii]);\n             return(*status);\n         }\n      }\n\n      if (binsizein[ii] == 0.)\n      {\n        ffpmsg(\"error: histogram binsize = 0\");\n        return(*status = ZERO_SCALE);\n      }\n\n      if (*colname[ii] == '\\0')\n      {\n         strcpy(colname[ii], cpref[ii]); /* try using the preferred column */\n         if (*colname[ii] == '\\0')\n         {\n           if (ii == 0)\n              strcpy(colname[ii], \"X\");\n           else if (ii == 1)\n              strcpy(colname[ii], \"Y\");\n           else if (ii == 2)\n              strcpy(colname[ii], \"Z\");\n           else if (ii == 3)\n              strcpy(colname[ii], \"T\");\n         }\n      }\n\n      /* get the column number in the table */\n      if (ffgcno(*fptr, CASEINSEN, colname[ii], histData.hcolnum+ii, status)\n              > 0)\n      {\n        strcpy(errmsg, \"column for histogram axis doesn't exist: \");\n        strncat(errmsg, colname[ii], FLEN_ERRMSG-strlen(errmsg)-1);\n        ffpmsg(errmsg);\n        return(*status);\n      }\n\n      colptr = ((*fptr)->Fptr)->tableptr;\n      colptr += (histData.hcolnum[ii] - 1);\n\n      repeat = (int) colptr->trepeat;  /* vector repeat factor of the column */\n      if (repeat > 1)\n      {\n        strcpy(errmsg, \"Can't bin a vector column: \");\n        strncat(errmsg, colname[ii],FLEN_ERRMSG-strlen(errmsg)-1);\n        ffpmsg(errmsg);\n        return(*status = BAD_DATATYPE);\n      }\n\n      /* get the datatype of the column */\n      fits_get_eqcoltype(*fptr, histData.hcolnum[ii], &datatype,\n         NULL, NULL, status);\n\n      if (datatype < 0 || datatype == TSTRING)\n      {\n        strcpy(errmsg, \"Inappropriate datatype; can't bin this column: \");\n        strncat(errmsg, colname[ii],FLEN_ERRMSG-strlen(errmsg)-1);\n        ffpmsg(errmsg);\n        return(*status = BAD_DATATYPE);\n      }\n\n      /* use TLMINn and TLMAXn keyword values if min and max were not given */\n      /* else use actual data min and max if TLMINn and TLMAXn don't exist */\n \n      if (minin[ii] == DOUBLENULLVALUE)\n      {\n        ffkeyn(\"TLMIN\", histData.hcolnum[ii], keyname, status);\n        if (ffgky(*fptr, TDOUBLE, keyname, amin+ii, NULL, status) > 0)\n        {\n            /* use actual data minimum value for the histogram minimum */\n            *status = 0;\n            if (fits_get_col_minmax(*fptr, histData.hcolnum[ii], amin+ii, &datamax, status) > 0)\n            {\n                strcpy(errmsg, \"Error calculating datamin and datamax for column: \");\n                strncat(errmsg, colname[ii],FLEN_ERRMSG-strlen(errmsg)-1);\n                ffpmsg(errmsg);\n                return(*status);\n            }\n         }\n      }\n      else\n      {\n        amin[ii] = (double) minin[ii];\n      }\n\n      if (maxin[ii] == DOUBLENULLVALUE)\n      {\n        ffkeyn(\"TLMAX\", histData.hcolnum[ii], keyname, status);\n        if (ffgky(*fptr, TDOUBLE, keyname, &amax[ii], NULL, status) > 0)\n        {\n          *status = 0;\n          if(datamax != DOUBLENULLVALUE)  /* already computed max value */\n          {\n             amax[ii] = datamax;\n          }\n          else\n          {\n             /* use actual data maximum value for the histogram maximum */\n             if (fits_get_col_minmax(*fptr, histData.hcolnum[ii], &datamin, &amax[ii], status) > 0)\n             {\n                 strcpy(errmsg, \"Error calculating datamin and datamax for column: \");\n                 strncat(errmsg, colname[ii],FLEN_ERRMSG-strlen(errmsg)-1);\n                 ffpmsg(errmsg);\n                 return(*status);\n             }\n          }\n        }\n        use_datamax = 1;  /* flag that the max was determined by the data values */\n                          /* and not specifically set by the calling program */\n      }\n      else\n      {\n        amax[ii] = (double) maxin[ii];\n      }\n\n      /* use TDBINn keyword or else 1 if bin size is not given */\n      if (binsizein[ii] == DOUBLENULLVALUE)\n      {\n         tstatus = 0;\n         ffkeyn(\"TDBIN\", histData.hcolnum[ii], keyname, &tstatus);\n\n         if (ffgky(*fptr, TDOUBLE, keyname, binsizein + ii, NULL, &tstatus) > 0)\n         {\n\t    /* make at least 10 bins */\n            binsizein[ii] = (amax[ii] - amin[ii]) / 10. ;\n            if (binsizein[ii] > 1.)\n                binsizein[ii] = 1.;  /* use default bin size */\n         }\n      }\n\n      if ( (amin[ii] > amax[ii] && binsizein[ii] > 0. ) ||\n           (amin[ii] < amax[ii] && binsizein[ii] < 0. ) )\n          binsize[ii] = (double) -binsizein[ii];  /* reverse the sign of binsize */\n      else\n          binsize[ii] =  (double) binsizein[ii];  /* binsize has the correct sign */\n\n      ibin = (int) binsize[ii];\n      imin = (int) amin[ii];\n      imax = (int) amax[ii];\n\n      /* Determine the range and number of bins in the histogram. This  */\n      /* depends on whether the input columns are integer or floats, so */\n      /* treat each case separately.                                    */\n\n      if (datatype <= TLONG && (double) imin == amin[ii] &&\n \t                       (double) imax == amax[ii] &&\n                               (double) ibin == binsize[ii] )\n      {\n        /* This is an integer column and integer limits were entered. */\n        /* Shift the lower and upper histogramming limits by 0.5, so that */\n        /* the values fall in the center of the bin, not on the edge. */\n\n        haxes[ii] = (imax - imin) / ibin + 1;  /* last bin may only */\n                                               /* be partially full */\n        maxbin[ii] = (double) (haxes[ii] + 1.);  /* add 1. instead of .5 to avoid roundoff */\n\n        if (amin[ii] < amax[ii])\n        {\n          amin[ii] = (double) (amin[ii] - 0.5);\n          amax[ii] = (double) (amax[ii] + 0.5);\n        }\n        else\n        {\n          amin[ii] = (double) (amin[ii] + 0.5);\n          amax[ii] = (double) (amax[ii] - 0.5);\n        }\n      }\n      else if (use_datamax)  \n      {\n        /* Either the column datatype and/or the limits are floating point, */\n        /* and the histogram limits are being defined by the min and max */\n        /* values of the array.  Add 1 to the number of histogram bins to */\n        /* make sure that pixels that are equal to the maximum or are */\n        /* in the last partial bin are included.  */\n\n        maxbin[ii] = (amax[ii] - amin[ii]) / binsize[ii]; \n        haxes[ii] = (long) (maxbin[ii] + 1);\n      }\n      else  \n      {\n        /*  float datatype column and/or limits, and the maximum value to */\n        /*  include in the histogram is specified by the calling program. */\n        /*  The lower limit is inclusive, but upper limit is exclusive    */\n        maxbin[ii] = (amax[ii] - amin[ii]) / binsize[ii];\n        haxes[ii] = (long) maxbin[ii];\n\n        if (amin[ii] < amax[ii])\n        {\n          if (amin[ii] + (haxes[ii] * binsize[ii]) < amax[ii])\n            haxes[ii]++;   /* need to include another partial bin */\n        }\n        else\n        {\n          if (amin[ii] + (haxes[ii] * binsize[ii]) > amax[ii])\n            haxes[ii]++;   /* need to include another partial bin */\n        }\n      }\n    }\n\n       /* get the histogramming weighting factor */\n    if (*wtcol)\n    {\n        /* first, look for a keyword with the weight value */\n        if (ffgky(*fptr, TDOUBLE, wtcol, &histData.weight, NULL, status) )\n        {\n            /* not a keyword, so look for column with this name */\n            *status = 0;\n\n            /* get the column number in the table */\n            if (ffgcno(*fptr, CASEINSEN, wtcol, &histData.wtcolnum, status) > 0)\n            {\n               ffpmsg(\n               \"keyword or column for histogram weights doesn't exist: \");\n               ffpmsg(wtcol);\n               return(*status);\n            }\n\n            histData.weight = DOUBLENULLVALUE;\n        }\n    }\n    else\n        histData.weight = (double) weightin;\n\n    if (histData.weight <= 0. && histData.weight != DOUBLENULLVALUE)\n    {\n        ffpmsg(\"Illegal histogramming weighting factor <= 0.\");\n        return(*status = URL_PARSE_ERROR);\n    }\n\n    if (recip && histData.weight != DOUBLENULLVALUE)\n       /* take reciprocal of weight */\n       histData.weight = (double) (1.0 / histData.weight);\n\n    histData.wtrecip = recip;\n        \n    /* size of histogram is now known, so create temp output file */\n    if (ffinit(&histptr, outfile, status) > 0)\n    {\n        ffpmsg(\"failed to create temp output file for histogram\");\n        return(*status);\n    }\n\n    if (ffcrim(histptr, bitpix, histData.haxis, haxes, status) > 0)\n    {\n        ffpmsg(\"failed to create primary array histogram in temp file\");\n        ffclos(histptr, status);\n        return(*status);\n    }\n\n    /* copy all non-structural keywords from the table to the image */\n    fits_get_hdrspace(*fptr, &nkeys, NULL, status);\n    for (ii = 1; ii <= nkeys; ii++)\n    {\n       fits_read_record(*fptr, ii, card, status);\n       if (fits_get_keyclass(card) >= 120)\n           fits_write_record(histptr, card, status);\n    }           \n\n    /* Set global variables with histogram parameter values.    */\n    /* Use separate scalar variables rather than arrays because */\n    /* it is more efficient when computing the histogram.       */\n\n    histData.amin1 = amin[0];\n    histData.maxbin1 = maxbin[0];\n    histData.binsize1 = binsize[0];\n    histData.haxis1 = haxes[0];\n\n    if (histData.haxis > 1)\n    {\n      histData.amin2 = amin[1];\n      histData.maxbin2 = maxbin[1];\n      histData.binsize2 = binsize[1];\n      histData.haxis2 = haxes[1];\n\n      if (histData.haxis > 2)\n      {\n        histData.amin3 = amin[2];\n        histData.maxbin3 = maxbin[2];\n        histData.binsize3 = binsize[2];\n        histData.haxis3 = haxes[2];\n\n        if (histData.haxis > 3)\n        {\n          histData.amin4 = amin[3];\n          histData.maxbin4 = maxbin[3];\n          histData.binsize4 = binsize[3];\n          histData.haxis4 = haxes[3];\n        }\n      }\n    }\n\n    /* define parameters of image for the iterator function */\n    fits_iter_set_file(imagepars, histptr);        /* pointer to image */\n    fits_iter_set_datatype(imagepars, imagetype);  /* image datatype   */\n    fits_iter_set_iotype(imagepars, OutputCol);    /* image is output  */\n\n    /* call the iterator function to write out the histogram image */\n    if (fits_iterate_data(n_cols, imagepars, offset, n_per_loop,\n                          ffwritehisto, (void*)&histData, status) )\n         return(*status);\n\n    /* write the World Coordinate System (WCS) keywords */\n    /* create default values if WCS keywords are not present in the table */\n    for (ii = 0; ii < histData.haxis; ii++)\n    {\n     /*  CTYPEn  */\n       tstatus = 0;\n       ffkeyn(\"TCTYP\", histData.hcolnum[ii], keyname, &tstatus);\n       ffgky(*fptr, TSTRING, keyname, svalue, NULL, &tstatus);\n       if (tstatus)\n       {               /* just use column name as the type */\n          tstatus = 0;\n          ffkeyn(\"TTYPE\", histData.hcolnum[ii], keyname, &tstatus);\n          ffgky(*fptr, TSTRING, keyname, svalue, NULL, &tstatus);\n       }\n\n       if (!tstatus)\n       {\n        ffkeyn(\"CTYPE\", ii + 1, keyname, &tstatus);\n        ffpky(histptr, TSTRING, keyname, svalue, \"Coordinate Type\", &tstatus);\n       }\n       else\n          tstatus = 0;\n\n     /*  CUNITn  */\n       ffkeyn(\"TCUNI\", histData.hcolnum[ii], keyname, &tstatus);\n       ffgky(*fptr, TSTRING, keyname, svalue, NULL, &tstatus);\n       if (tstatus)\n       {         /* use the column units */\n          tstatus = 0;\n          ffkeyn(\"TUNIT\", histData.hcolnum[ii], keyname, &tstatus);\n          ffgky(*fptr, TSTRING, keyname, svalue, NULL, &tstatus);\n       }\n\n       if (!tstatus)\n       {\n        ffkeyn(\"CUNIT\", ii + 1, keyname, &tstatus);\n        ffpky(histptr, TSTRING, keyname, svalue, \"Coordinate Units\", &tstatus);\n       }\n       else\n         tstatus = 0;\n\n     /*  CRPIXn  - Reference Pixel  */\n       ffkeyn(\"TCRPX\", histData.hcolnum[ii], keyname, &tstatus);\n       ffgky(*fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus);\n       if (tstatus)\n       {\n         dvalue = 1.0; /* choose first pixel in new image as ref. pix. */\n         tstatus = 0;\n       }\n       else\n       {\n           /* calculate locate of the ref. pix. in the new image */\n           dvalue = (dvalue - amin[ii]) / binsize[ii] + .5;\n       }\n\n       ffkeyn(\"CRPIX\", ii + 1, keyname, &tstatus);\n       ffpky(histptr, TDOUBLE, keyname, &dvalue, \"Reference Pixel\", &tstatus);\n\n     /*  CRVALn - Value at the location of the reference pixel */\n       ffkeyn(\"TCRVL\", histData.hcolnum[ii], keyname, &tstatus);\n       ffgky(*fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus);\n       if (tstatus)\n       {\n         /* calculate value at ref. pix. location (at center of 1st pixel) */\n         dvalue = amin[ii] + binsize[ii]/2.;\n         tstatus = 0;\n       }\n\n       ffkeyn(\"CRVAL\", ii + 1, keyname, &tstatus);\n       ffpky(histptr, TDOUBLE, keyname, &dvalue, \"Reference Value\", &tstatus);\n\n     /*  CDELTn - unit size of pixels  */\n       ffkeyn(\"TCDLT\", histData.hcolnum[ii], keyname, &tstatus);\n       ffgky(*fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus);\n       if (tstatus)\n       {\n         dvalue = 1.0;  /* use default pixel size */\n         tstatus = 0;\n       }\n\n       dvalue = dvalue * binsize[ii];\n       ffkeyn(\"CDELT\", ii + 1, keyname, &tstatus);\n       ffpky(histptr, TDOUBLE, keyname, &dvalue, \"Pixel size\", &tstatus);\n\n     /*  CROTAn - Rotation angle (degrees CCW)  */\n     /*  There should only be a CROTA2 keyword, and only for 2+ D images */\n       if (ii == 1)\n       {\n         ffkeyn(\"TCROT\", histData.hcolnum[ii], keyname, &tstatus);\n         ffgky(*fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus);\n         if (!tstatus && dvalue != 0.)  /* only write keyword if angle != 0 */\n         {\n           ffkeyn(\"CROTA\", ii + 1, keyname, &tstatus);\n           ffpky(histptr, TDOUBLE, keyname, &dvalue,\n                 \"Rotation angle\", &tstatus);\n         }\n         else\n         {\n            /* didn't find CROTA for the 2nd axis, so look for one */\n            /* on the first axis */\n           tstatus = 0;\n           ffkeyn(\"TCROT\", histData.hcolnum[0], keyname, &tstatus);\n           ffgky(*fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus);\n           if (!tstatus && dvalue != 0.)  /* only write keyword if angle != 0 */\n           {\n             dvalue *= -1.;   /* negate the value, because mirror image */\n             ffkeyn(\"CROTA\", ii + 1, keyname, &tstatus);\n             ffpky(histptr, TDOUBLE, keyname, &dvalue,\n                   \"Rotation angle\", &tstatus);\n           }\n         }\n       }\n    }\n\n    /* convert any TPn_k keywords to PCi_j; the value remains unchanged */\n    /* also convert any TCn_k to CDi_j; the value is modified by n binning size */\n    /* This is a bit of a kludge, and only works for 2D WCS */\n\n    if (histData.haxis == 2) {\n\n      /* PC1_1 */\n      tstatus = 0;\n      ffkeyn(\"TP\", histData.hcolnum[0], card, &tstatus);\n      strcat(card,\"_\");\n      ffkeyn(card, histData.hcolnum[0], keyname, &tstatus);\n      ffgky(*fptr, TDOUBLE, keyname, &dvalue, card, &tstatus);\n      if (!tstatus) \n         ffpky(histptr, TDOUBLE, \"PC1_1\", &dvalue, card, &tstatus);\n\n      tstatus = 0;\n      keyname[1] = 'C';\n      ffgky(*fptr, TDOUBLE, keyname, &dvalue, card, &tstatus);\n      if (!tstatus) {\n         dvalue *=  binsize[0];\n         ffpky(histptr, TDOUBLE, \"CD1_1\", &dvalue, card, &tstatus);\n      }\n\n      /* PC1_2 */\n      tstatus = 0;\n      ffkeyn(\"TP\", histData.hcolnum[0], card, &tstatus);\n      strcat(card,\"_\");\n      ffkeyn(card, histData.hcolnum[1], keyname, &tstatus);\n      ffgky(*fptr, TDOUBLE, keyname, &dvalue, card, &tstatus);\n      if (!tstatus) \n         ffpky(histptr, TDOUBLE, \"PC1_2\", &dvalue, card, &tstatus);\n \n      tstatus = 0;\n      keyname[1] = 'C';\n      ffgky(*fptr, TDOUBLE, keyname, &dvalue, card, &tstatus);\n      if (!tstatus) {\n        dvalue *=  binsize[0];\n        ffpky(histptr, TDOUBLE, \"CD1_2\", &dvalue, card, &tstatus);\n      }\n       \n      /* PC2_1 */\n      tstatus = 0;\n      ffkeyn(\"TP\", histData.hcolnum[1], card, &tstatus);\n      strcat(card,\"_\");\n      ffkeyn(card, histData.hcolnum[0], keyname, &tstatus);\n      ffgky(*fptr, TDOUBLE, keyname, &dvalue, card, &tstatus);\n      if (!tstatus) \n         ffpky(histptr, TDOUBLE, \"PC2_1\", &dvalue, card, &tstatus);\n \n      tstatus = 0;\n      keyname[1] = 'C';\n      ffgky(*fptr, TDOUBLE, keyname, &dvalue, card, &tstatus);\n      if (!tstatus) {\n         dvalue *=  binsize[1];\n         ffpky(histptr, TDOUBLE, \"CD2_1\", &dvalue, card, &tstatus);\n      }\n       \n       /* PC2_2 */\n      tstatus = 0;\n      ffkeyn(\"TP\", histData.hcolnum[1], card, &tstatus);\n      strcat(card,\"_\");\n      ffkeyn(card, histData.hcolnum[1], keyname, &tstatus);\n      ffgky(*fptr, TDOUBLE, keyname, &dvalue, card, &tstatus);\n      if (!tstatus) \n         ffpky(histptr, TDOUBLE, \"PC2_2\", &dvalue, card, &tstatus);\n        \n      tstatus = 0;\n      keyname[1] = 'C';\n      ffgky(*fptr, TDOUBLE, keyname, &dvalue, card, &tstatus);\n      if (!tstatus) {\n         dvalue *=  binsize[1];\n         ffpky(histptr, TDOUBLE, \"CD2_2\", &dvalue, card, &tstatus);\n      }\n    }   \n       \n    /* finally, close the original file and return ptr to the new image */\n    ffclos(*fptr, status);\n    *fptr = histptr;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\n/* Single-precision version */\nint fits_calc_binning(\n      fitsfile *fptr,  /* IO - pointer to table to be binned      ;       */\n      int naxis,       /* I - number of axes/columns in the binned image  */\n      char colname[4][FLEN_VALUE],   /* I - optional column names         */\n      double *minin,     /* I - optional lower bound value for each axis  */\n      double *maxin,     /* I - optional upper bound value, for each axis */\n      double *binsizein, /* I - optional bin size along each axis         */\n      char minname[4][FLEN_VALUE], /* I - optional keywords for min       */\n      char maxname[4][FLEN_VALUE], /* I - optional keywords for max       */\n      char binname[4][FLEN_VALUE], /* I - optional keywords for binsize   */\n\n    /* The returned parameters for each axis of the n-dimensional histogram are */\n\n      int *colnum,     /* O - column numbers, to be binned */\n      long *haxes,     /* O - number of bins in each histogram axis */\n      float *amin,     /* O - lower bound of the histogram axes */\n      float *amax,     /* O - upper bound of the histogram axes */\n      float *binsize,  /* O - width of histogram bins/pixels on each axis */\n      int *status)\n{\n  double amind[4], amaxd[4], binsized[4];\n\n  fits_calc_binningd(fptr, naxis, colname, minin, maxin, binsizein, minname, maxname, binname,\n\t\t     colnum, haxes, amind, amaxd, binsized, status);\n\n  /* Copy double precision values into single precision */\n  if (*status == 0) {\n    int i, naxis1 = 4;\n    if (naxis < naxis1) naxis1 = naxis;\n    for (i=0; i<naxis1; i++) {\n      amin[i] = (float) amind[i];\n      amax[i] = (float) amaxd[i];\n      binsize[i] = (float) binsized[i];\n    }\n  }\n\n  return (*status);\n}\n\n/* Double precision version */  \nint fits_calc_binningd(\n      fitsfile *fptr,  /* IO - pointer to table to be binned      ;       */\n      int naxis,       /* I - number of axes/columns in the binned image  */\n      char colname[4][FLEN_VALUE],   /* I - optional column names         */\n      double *minin,     /* I - optional lower bound value for each axis  */\n      double *maxin,     /* I - optional upper bound value, for each axis */\n      double *binsizein, /* I - optional bin size along each axis         */\n      char minname[4][FLEN_VALUE], /* I - optional keywords for min       */\n      char maxname[4][FLEN_VALUE], /* I - optional keywords for max       */\n      char binname[4][FLEN_VALUE], /* I - optional keywords for binsize   */\n\n    /* The returned parameters for each axis of the n-dimensional histogram are */\n\n      int *colnum,     /* O - column numbers, to be binned */\n      long *haxes,     /* O - number of bins in each histogram axis */\n      double *amin,     /* O - lower bound of the histogram axes */\n      double *amax,     /* O - upper bound of the histogram axes */\n      double *binsize,  /* O - width of histogram bins/pixels on each axis */\n      int *status)\n/*_\n    Calculate the actual binning parameters, based on various user input\n    options.\n*/\n{\n    tcolumn *colptr;\n    char *cptr, cpref[4][FLEN_VALUE];\n    char errmsg[FLEN_ERRMSG], keyname[FLEN_KEYWORD];\n    int tstatus, ii;\n    int datatype, repeat, imin, imax, ibin,  use_datamax = 0;\n    double datamin, datamax;\n\n    /* check inputs */\n    \n    if (*status > 0)\n        return(*status);\n\n    if (naxis > 4)\n    {\n        ffpmsg(\"histograms with more than 4 dimensions are not supported\");\n        return(*status = BAD_DIMEN);\n    }\n\n    /* reset position to the correct HDU if necessary */\n    if ((fptr)->HDUposition != ((fptr)->Fptr)->curhdu)\n        ffmahd(fptr, ((fptr)->HDUposition) + 1, NULL, status);\n    \n    /* ============================================================= */\n    /* The CPREF keyword, if it exists, gives the preferred columns. */\n    /* Otherwise, assume \"X\", \"Y\", \"Z\", and \"T\"  */\n\n    *cpref[0] = '\\0';\n    *cpref[1] = '\\0';\n    *cpref[2] = '\\0';\n    *cpref[3] = '\\0';\n\n    tstatus = 0;\n    ffgky(fptr, TSTRING, \"CPREF\", cpref[0], NULL, &tstatus);\n\n    if (!tstatus)\n    {\n        /* Preferred column names are given;  separate them */\n        cptr = cpref[0];\n\n        /* the first preferred axis... */\n        while (*cptr != ',' && *cptr != '\\0')\n           cptr++;\n\n        if (*cptr != '\\0')\n        {\n           *cptr = '\\0';\n           cptr++;\n           while (*cptr == ' ')\n               cptr++;\n\n           strcpy(cpref[1], cptr);\n           cptr = cpref[1];\n\n          /* the second preferred axis... */\n          while (*cptr != ',' && *cptr != '\\0')\n             cptr++;\n\n          if (*cptr != '\\0')\n          {\n             *cptr = '\\0';\n             cptr++;\n             while (*cptr == ' ')\n                 cptr++;\n\n             strcpy(cpref[2], cptr);\n             cptr = cpref[2];\n\n            /* the third preferred axis... */\n            while (*cptr != ',' && *cptr != '\\0')\n               cptr++;\n\n            if (*cptr != '\\0')\n            {\n               *cptr = '\\0';\n               cptr++;\n               while (*cptr == ' ')\n                   cptr++;\n\n               strcpy(cpref[3], cptr);\n\n            }\n          }\n        }\n    }\n\n    /* ============================================================= */\n    /* Main Loop for calculating parameters for each column          */\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n\n      /* =========================================================== */\n      /* Determine column Number, based on, in order of priority,\n         1  input column name, or\n\t 2  name given by CPREF keyword, or\n\t 3  assume X, Y, Z and T for the name\n      */\n\t  \n      if (*colname[ii] == '\\0')\n      {\n         strcpy(colname[ii], cpref[ii]); /* try using the preferred column */\n         if (*colname[ii] == '\\0')\n         {\n           if (ii == 0)\n              strcpy(colname[ii], \"X\");\n           else if (ii == 1)\n              strcpy(colname[ii], \"Y\");\n           else if (ii == 2)\n              strcpy(colname[ii], \"Z\");\n           else if (ii == 3)\n              strcpy(colname[ii], \"T\");\n         }\n      }\n\n      /* get the column number in the table */\n      if (ffgcno(fptr, CASEINSEN, colname[ii], colnum+ii, status)\n              > 0)\n      {\n          strcpy(errmsg, \"column for histogram axis doesn't exist: \");\n          strncat(errmsg, colname[ii],FLEN_ERRMSG-strlen(errmsg)-1);\n          ffpmsg(errmsg);\n          return(*status);\n      }\n\n      /* ================================================================ */\n      /* check tha column is not a vector or a string                     */\n\n      colptr = ((fptr)->Fptr)->tableptr;\n      colptr += (colnum[ii] - 1);\n\n      repeat = (int) colptr->trepeat;  /* vector repeat factor of the column */\n      if (repeat > 1)\n      {\n        strcpy(errmsg, \"Can't bin a vector column: \");\n        strncat(errmsg, colname[ii],FLEN_ERRMSG-strlen(errmsg)-1);\n        ffpmsg(errmsg);\n        return(*status = BAD_DATATYPE);\n      }\n\n      /* get the datatype of the column */\n      fits_get_eqcoltype(fptr, colnum[ii], &datatype,\n         NULL, NULL, status);\n\n      if (datatype < 0 || datatype == TSTRING)\n      {\n        strcpy(errmsg, \"Inappropriate datatype; can't bin this column: \");\n        strncat(errmsg, colname[ii],FLEN_ERRMSG-strlen(errmsg)-1);\n        ffpmsg(errmsg);\n        return(*status = BAD_DATATYPE);\n      }\n\n      /* ================================================================ */\n      /* get the minimum value */\n\n      datamin = DOUBLENULLVALUE;\n      datamax = DOUBLENULLVALUE;\n      \n      if (*minname[ii])\n      {\n         if (ffgky(fptr, TDOUBLE, minname[ii], &minin[ii], NULL, status) )\n         {\n             ffpmsg(\"error reading histogramming minimum keyword\");\n             ffpmsg(minname[ii]);\n             return(*status);\n         }\n      }\n\n      if (minin[ii] != DOUBLENULLVALUE)\n      {\n        amin[ii] = (double) minin[ii];\n      }\n      else\n      {\n        ffkeyn(\"TLMIN\", colnum[ii], keyname, status);\n        if (ffgky(fptr, TDOUBLE, keyname, amin+ii, NULL, status) > 0)\n        {\n            /* use actual data minimum value for the histogram minimum */\n            *status = 0;\n            if (fits_get_col_minmax(fptr, colnum[ii], amin+ii, &datamax, status) > 0)\n            {\n                strcpy(errmsg, \"Error calculating datamin and datamax for column: \");\n                strncat(errmsg, colname[ii],FLEN_ERRMSG-strlen(errmsg)-1);\n                ffpmsg(errmsg);\n                return(*status);\n            }\n         }\n      }\n\n      /* ================================================================ */\n      /* get the maximum value */\n\n      if (*maxname[ii])\n      {\n         if (ffgky(fptr, TDOUBLE, maxname[ii], &maxin[ii], NULL, status) )\n         {\n             ffpmsg(\"error reading histogramming maximum keyword\");\n             ffpmsg(maxname[ii]);\n             return(*status);\n         }\n      }\n\n      if (maxin[ii] != DOUBLENULLVALUE)\n      {\n        amax[ii] = (double) maxin[ii];\n      }\n      else\n      {\n        ffkeyn(\"TLMAX\", colnum[ii], keyname, status);\n        if (ffgky(fptr, TDOUBLE, keyname, &amax[ii], NULL, status) > 0)\n        {\n          *status = 0;\n          if(datamax != DOUBLENULLVALUE)  /* already computed max value */\n          {\n             amax[ii] = datamax;\n          }\n          else\n          {\n             /* use actual data maximum value for the histogram maximum */\n             if (fits_get_col_minmax(fptr, colnum[ii], &datamin, &amax[ii], status) > 0)\n             {\n                 strcpy(errmsg, \"Error calculating datamin and datamax for column: \");\n                 strncat(errmsg, colname[ii],FLEN_ERRMSG-strlen(errmsg)-1);\n                 ffpmsg(errmsg);\n                 return(*status);\n             }\n          }\n        }\n        use_datamax = 1;  /* flag that the max was determined by the data values */\n                          /* and not specifically set by the calling program */\n      }\n\n\n      /* ================================================================ */\n      /* determine binning size and range                                 */\n\n      if (*binname[ii])\n      {\n         if (ffgky(fptr, TDOUBLE, binname[ii], &binsizein[ii], NULL, status) )\n         {\n             ffpmsg(\"error reading histogramming binsize keyword\");\n             ffpmsg(binname[ii]);\n             return(*status);\n         }\n      }\n\n      if (binsizein[ii] == 0.)\n      {\n        ffpmsg(\"error: histogram binsize = 0\");\n        return(*status = ZERO_SCALE);\n      }\n\n      /* use TDBINn keyword or else 1 if bin size is not given */\n      if (binsizein[ii] != DOUBLENULLVALUE)\n      { \n         binsize[ii] = (double) binsizein[ii];\n      }\n      else\n      {\n         tstatus = 0;\n         ffkeyn(\"TDBIN\", colnum[ii], keyname, &tstatus);\n\n         if (ffgky(fptr, TDOUBLE, keyname, binsizein + ii, NULL, &tstatus) > 0)\n         {\n\t    /* make at least 10 bins */\n            binsize[ii] = (amax[ii] - amin[ii]) / 10.F ;\n            if (binsize[ii] > 1.)\n                binsize[ii] = 1.;  /* use default bin size */\n         }\n      }\n\n      /* ================================================================ */\n      /* if the min is greater than the max, make the binsize negative */\n      if ( (amin[ii] > amax[ii] && binsize[ii] > 0. ) ||\n           (amin[ii] < amax[ii] && binsize[ii] < 0. ) )\n          binsize[ii] =  -binsize[ii];  /* reverse the sign of binsize */\n\n\n      ibin = (int) binsize[ii];\n      imin = (int) amin[ii];\n      imax = (int) amax[ii];\n\n      /* Determine the range and number of bins in the histogram. This  */\n      /* depends on whether the input columns are integer or floats, so */\n      /* treat each case separately.                                    */\n\n      if (datatype <= TLONG && (double) imin == amin[ii] &&\n                               (double) imax == amax[ii] &&\n                               (double) ibin == binsize[ii] )\n      {\n        /* This is an integer column and integer limits were entered. */\n        /* Shift the lower and upper histogramming limits by 0.5, so that */\n        /* the values fall in the center of the bin, not on the edge. */\n\n        haxes[ii] = (imax - imin) / ibin + 1;  /* last bin may only */\n                                               /* be partially full */\n        if (amin[ii] < amax[ii])\n        {\n          amin[ii] = (double) (amin[ii] - 0.5);\n          amax[ii] = (double) (amax[ii] + 0.5);\n        }\n        else\n        {\n          amin[ii] = (double) (amin[ii] + 0.5);\n          amax[ii] = (double) (amax[ii] - 0.5);\n        }\n      }\n      else if (use_datamax)  \n      {\n        /* Either the column datatype and/or the limits are floating point, */\n        /* and the histogram limits are being defined by the min and max */\n        /* values of the array.  Add 1 to the number of histogram bins to */\n        /* make sure that pixels that are equal to the maximum or are */\n        /* in the last partial bin are included.  */\n\n        haxes[ii] = (long) (((amax[ii] - amin[ii]) / binsize[ii]) + 1.); \n      }\n      else  \n      {\n        /*  float datatype column and/or limits, and the maximum value to */\n        /*  include in the histogram is specified by the calling program. */\n        /*  The lower limit is inclusive, but upper limit is exclusive    */\n        haxes[ii] = (long) ((amax[ii] - amin[ii]) / binsize[ii]);\n\n        if (amin[ii] < amax[ii])\n        {\n          if (amin[ii] + (haxes[ii] * binsize[ii]) < amax[ii])\n            haxes[ii]++;   /* need to include another partial bin */\n        }\n        else\n        {\n          if (amin[ii] + (haxes[ii] * binsize[ii]) > amax[ii])\n            haxes[ii]++;   /* need to include another partial bin */\n        }\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_write_keys_histo(\n      fitsfile *fptr,   /* I - pointer to table to be binned              */\n      fitsfile *histptr,  /* I - pointer to output histogram image HDU      */\n      int naxis,        /* I - number of axes in the histogram image      */\n      int *colnum,      /* I - column numbers (array length = naxis)      */\n      int *status)     \n{      \n   /*  Write default WCS keywords in the output histogram image header */\n   /*  if the keywords do not already exist.   */\n\n    int ii, tstatus;\n    char keyname[FLEN_KEYWORD], svalue[FLEN_VALUE];\n    double dvalue;\n    \n    if (*status > 0)\n        return(*status);\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n     /*  CTYPEn  */\n       tstatus = 0;\n       ffkeyn(\"CTYPE\", ii+1, keyname, &tstatus);\n       ffgky(histptr, TSTRING, keyname, svalue, NULL, &tstatus);\n       \n       if (!tstatus) continue;  /* keyword already exists, so skip to next axis */\n       \n       /* use column name as the axis name */\n       tstatus = 0;\n       ffkeyn(\"TTYPE\", colnum[ii], keyname, &tstatus);\n       ffgky(fptr, TSTRING, keyname, svalue, NULL, &tstatus);\n\n       if (!tstatus)\n       {\n         ffkeyn(\"CTYPE\", ii + 1, keyname, &tstatus);\n         ffpky(histptr, TSTRING, keyname, svalue, \"Coordinate Type\", &tstatus);\n       }\n\n       /*  CUNITn,  use the column units */\n       tstatus = 0;\n       ffkeyn(\"TUNIT\", colnum[ii], keyname, &tstatus);\n       ffgky(fptr, TSTRING, keyname, svalue, NULL, &tstatus);\n\n       if (!tstatus)\n       {\n         ffkeyn(\"CUNIT\", ii + 1, keyname, &tstatus);\n         ffpky(histptr, TSTRING, keyname, svalue, \"Coordinate Units\", &tstatus);\n       }\n\n       /*  CRPIXn  - Reference Pixel choose first pixel in new image as ref. pix. */\n       dvalue = 1.0;\n       tstatus = 0;\n       ffkeyn(\"CRPIX\", ii + 1, keyname, &tstatus);\n       ffpky(histptr, TDOUBLE, keyname, &dvalue, \"Reference Pixel\", &tstatus);\n\n       /*  CRVALn - Value at the location of the reference pixel */\n       dvalue = 1.0;\n       tstatus = 0;\n       ffkeyn(\"CRVAL\", ii + 1, keyname, &tstatus);\n       ffpky(histptr, TDOUBLE, keyname, &dvalue, \"Reference Value\", &tstatus);\n\n       /*  CDELTn - unit size of pixels  */\n       dvalue = 1.0;  \n       tstatus = 0;\n       dvalue = 1.;\n       ffkeyn(\"CDELT\", ii + 1, keyname, &tstatus);\n       ffpky(histptr, TDOUBLE, keyname, &dvalue, \"Pixel size\", &tstatus);\n\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_rebin_wcs(\n      fitsfile *fptr,   /* I - pointer to table to be binned           */\n      int naxis,        /* I - number of axes in the histogram image   */\n      float *amin,     /* I - first pixel include in each axis        */\n      float *binsize,  /* I - binning factor for each axis            */\n      int *status)      \n{\n  double amind[4], binsized[4];\n\n  /* Copy single precision values into double precision */\n  if (*status == 0) {\n    int i, naxis1 = 4;\n    if (naxis < naxis1) naxis1 = naxis;\n    for (i=0; i<naxis1; i++) {\n      amind[i] = (double) amin[i];\n      binsized[i] = (double) binsize[i];\n    }\n\n    fits_rebin_wcsd(fptr, naxis, amind, binsized, status);\n  }\n\n\n  return (*status);\n}\n\n/* Double precision version */\nint fits_rebin_wcsd(\n      fitsfile *fptr,   /* I - pointer to table to be binned           */\n      int naxis,        /* I - number of axes in the histogram image   */\n      double *amin,     /* I - first pixel include in each axis        */\n      double *binsize,  /* I - binning factor for each axis            */\n      int *status)      \n{      \n   /*  Update the  WCS keywords that define the location of the reference */\n   /*  pixel, and the pixel size, along each axis.   */\n\n    int ii, jj, tstatus, reset ;\n    char keyname[FLEN_KEYWORD], svalue[FLEN_VALUE];\n    double dvalue;\n    \n    if (*status > 0)\n        return(*status);\n  \n    for (ii = 0; ii < naxis; ii++)\n    {\n       reset = 0;  /* flag to reset the reference pixel */\n       tstatus = 0;\n       ffkeyn(\"CRVAL\", ii + 1, keyname, &tstatus);\n       /* get previous (pre-binning) value */\n       ffgky(fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus); \n       if (!tstatus && dvalue == 1.0)\n           reset = 1;\n\n       tstatus = 0;\n       /*  CRPIXn - update location of the ref. pix. in the binned image */\n       ffkeyn(\"CRPIX\", ii + 1, keyname, &tstatus);\n\n       /* get previous (pre-binning) value */\n       ffgky(fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus); \n\n       if (!tstatus)\n       {\n           if (dvalue != 1.0)\n\t      reset = 0;\n\n           /* updated value to give pixel location after binning */\n           dvalue = (dvalue - amin[ii]) / ((double) binsize[ii]) + .5;  \n\n           fits_modify_key_dbl(fptr, keyname, dvalue, -14, NULL, &tstatus);\n       } else {\n          reset = 0;\n       }\n\n       /*  CDELTn - update unit size of pixels  */\n       tstatus = 0;\n       ffkeyn(\"CDELT\", ii + 1, keyname, &tstatus);\n\n       /* get previous (pre-binning) value */\n       ffgky(fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus); \n\n       if (!tstatus)\n       {\n           if (dvalue != 1.0)\n\t      reset = 0;\n\n           /* updated to give post-binning value */\n           dvalue = dvalue * binsize[ii];  \n\n           fits_modify_key_dbl(fptr, keyname, dvalue, -14, NULL, &tstatus);\n       }\n       else\n       {   /* no CDELTn keyword, so look for a CDij keywords */\n          reset = 0;\n\n          for (jj = 0; jj < naxis; jj++)\n\t  {\n             tstatus = 0;\n             ffkeyn(\"CD\", jj + 1, svalue, &tstatus);\n\t     strcat(svalue,\"_\");\n\t     ffkeyn(svalue, ii + 1, keyname, &tstatus);\n\n             /* get previous (pre-binning) value */\n             ffgky(fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus); \n\n             if (!tstatus)\n             {\n                /* updated to give post-binning value */\n               dvalue = dvalue * binsize[ii];  \n\n               fits_modify_key_dbl(fptr, keyname, dvalue, -14, NULL, &tstatus);\n             }\n\t  }\n       }\n\n       if (reset) {\n          /* the original CRPIX, CRVAL, and CDELT keywords were all = 1.0 */\n\t  /* In this special case, reset the reference pixel to be the */\n\t  /* first pixel in the array (instead of possibly far off the array) */\n \n           dvalue = 1.0;\n           ffkeyn(\"CRPIX\", ii + 1, keyname, &tstatus);\n           fits_modify_key_dbl(fptr, keyname, dvalue, -14, NULL, &tstatus);\n\n           ffkeyn(\"CRVAL\", ii + 1, keyname, &tstatus);\n\t   dvalue = amin[ii] + (binsize[ii] / 2.0);\t  \n           fits_modify_key_dbl(fptr, keyname, dvalue, -14, NULL, &tstatus);\n\t}\n\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\n/* Single-precision version */\nint fits_make_hist(fitsfile *fptr, /* IO - pointer to table with X and Y cols; */\n    fitsfile *histptr, /* I - pointer to output FITS image      */\n    int bitpix,       /* I - datatype for image: 16, 32, -32, etc    */\n    int naxis,        /* I - number of axes in the histogram image   */\n    long *naxes,      /* I - size of axes in the histogram image   */\n    int *colnum,    /* I - column numbers (array length = naxis)   */\n    float *amin,     /* I - minimum histogram value, for each axis */\n    float *amax,     /* I - maximum histogram value, for each axis */\n    float *binsize, /* I - bin size along each axis               */\n    float weight,        /* I - binning weighting factor          */\n    int wtcolnum, /* I - optional keyword or col for weight*/\n    int recip,              /* I - use reciprocal of the weight?     */\n    char *selectrow,        /* I - optional array (length = no. of   */\n                             /* rows in the table).  If the element is true */\n                             /* then the corresponding row of the table will*/\n                             /* be included in the histogram, otherwise the */\n                             /* row will be skipped.  Ingnored if *selectrow*/\n                             /* is equal to NULL.                           */\n    int *status)\n{\t\t  \n  double amind[4], amaxd[4], binsized[4], weightd;\n\n  /* Copy single precision values into double precision */\n  if (*status == 0) {\n    int i, naxis1 = 4;\n    if (naxis < naxis1) naxis1 = naxis;\n    for (i=0; i<naxis1; i++) {\n      amind[i] = (double) amin[i];\n      amaxd[i] = (double) amax[i];\n      binsized[i] = (double) binsize[i];\n    }\n\n    weightd = (double) weight;\n\n    fits_make_histd(fptr, histptr, bitpix, naxis, naxes, colnum,\n\t\t    amind, amaxd, binsized, weight, wtcolnum, recip,\n\t\t    selectrow, status);\n  }\n\n  return (*status);\n}\n\n/* Double-precision version */\nint fits_make_histd(fitsfile *fptr, /* IO - pointer to table with X and Y cols; */\n    fitsfile *histptr, /* I - pointer to output FITS image      */\n    int bitpix,       /* I - datatype for image: 16, 32, -32, etc    */\n    int naxis,        /* I - number of axes in the histogram image   */\n    long *naxes,      /* I - size of axes in the histogram image   */\n    int *colnum,    /* I - column numbers (array length = naxis)   */\n    double *amin,     /* I - minimum histogram value, for each axis */\n    double *amax,     /* I - maximum histogram value, for each axis */\n    double *binsize, /* I - bin size along each axis               */\n    double weight,        /* I - binning weighting factor          */\n    int wtcolnum, /* I - optional keyword or col for weight*/\n    int recip,              /* I - use reciprocal of the weight?     */\n    char *selectrow,        /* I - optional array (length = no. of   */\n                             /* rows in the table).  If the element is true */\n                             /* then the corresponding row of the table will*/\n                             /* be included in the histogram, otherwise the */\n                             /* row will be skipped.  Ingnored if *selectrow*/\n                             /* is equal to NULL.                           */\n    int *status)\n{\t\t  \n    int ii, imagetype, datatype;\n    int n_cols = 1;\n    long imin, imax, ibin;\n    long  offset = 0;\n    long n_per_loop = -1;  /* force whole array to be passed at one time */\n    double taxes[4], tmin[4], tmax[4], tbin[4], maxbin[4];\n    histType histData;    /* Structure holding histogram info for iterator */\n    iteratorCol imagepars[1];\n\n    /* check inputs */\n    \n    if (*status > 0)\n        return(*status);\n\n    if (naxis > 4)\n    {\n        ffpmsg(\"histogram has more than 4 dimensions\");\n        return(*status = BAD_DIMEN);\n    }\n\n    if   (bitpix == BYTE_IMG)\n         imagetype = TBYTE;\n    else if (bitpix == SHORT_IMG)\n         imagetype = TSHORT;\n    else if (bitpix == LONG_IMG)\n         imagetype = TINT;    \n    else if (bitpix == FLOAT_IMG)\n         imagetype = TFLOAT;    \n    else if (bitpix == DOUBLE_IMG)\n         imagetype = TDOUBLE;    \n    else\n        return(*status = BAD_DATATYPE);\n\n    /* reset position to the correct HDU if necessary */\n    if ((fptr)->HDUposition != ((fptr)->Fptr)->curhdu)\n        ffmahd(fptr, ((fptr)->HDUposition) + 1, NULL, status);\n\n    histData.weight     = weight;\n    histData.wtcolnum   = wtcolnum;\n    histData.wtrecip    = recip;\n    histData.tblptr     = fptr;\n    histData.himagetype = imagetype;\n    histData.haxis      = naxis;\n    histData.rowselector = selectrow;\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      taxes[ii] = (double) naxes[ii];\n      tmin[ii] = amin[ii];\n      tmax[ii] = amax[ii];\n      if ( (amin[ii] > amax[ii] && binsize[ii] > 0. ) ||\n           (amin[ii] < amax[ii] && binsize[ii] < 0. ) )\n          tbin[ii] =  -binsize[ii];  /* reverse the sign of binsize */\n      else\n          tbin[ii] =   binsize[ii];  /* binsize has the correct sign */\n          \n      imin = (long) tmin[ii];\n      imax = (long) tmax[ii];\n      ibin = (long) tbin[ii];\n    \n      /* get the datatype of the column */\n      fits_get_eqcoltype(fptr, colnum[ii], &datatype, NULL, NULL, status);\n\n      if (datatype <= TLONG && (double) imin == tmin[ii] &&\n                               (double) imax == tmax[ii] &&\n                               (double) ibin == tbin[ii] )\n      {\n        /* This is an integer column and integer limits were entered. */\n        /* Shift the lower and upper histogramming limits by 0.5, so that */\n        /* the values fall in the center of the bin, not on the edge. */\n\n        maxbin[ii] = (taxes[ii] + 1.F);  /* add 1. instead of .5 to avoid roundoff */\n\n        if (tmin[ii] < tmax[ii])\n        {\n          tmin[ii] = tmin[ii] - 0.5F;\n          tmax[ii] = tmax[ii] + 0.5F;\n        }\n        else\n        {\n          tmin[ii] = tmin[ii] + 0.5F;\n          tmax[ii] = tmax[ii] - 0.5F;\n        }\n      } else {  /* not an integer column with integer limits */\n          maxbin[ii] = (tmax[ii] - tmin[ii]) / tbin[ii]; \n      }\n    }\n\n    /* Set global variables with histogram parameter values.    */\n    /* Use separate scalar variables rather than arrays because */\n    /* it is more efficient when computing the histogram.       */\n\n    histData.hcolnum[0]  = colnum[0];\n    histData.amin1 = tmin[0];\n    histData.maxbin1 = maxbin[0];\n    histData.binsize1 = tbin[0];\n    histData.haxis1 = (long) taxes[0];\n\n    if (histData.haxis > 1)\n    {\n      histData.hcolnum[1]  = colnum[1];\n      histData.amin2 = tmin[1];\n      histData.maxbin2 = maxbin[1];\n      histData.binsize2 = tbin[1];\n      histData.haxis2 = (long) taxes[1];\n\n      if (histData.haxis > 2)\n      {\n        histData.hcolnum[2]  = colnum[2];\n        histData.amin3 = tmin[2];\n        histData.maxbin3 = maxbin[2];\n        histData.binsize3 = tbin[2];\n        histData.haxis3 = (long) taxes[2];\n\n        if (histData.haxis > 3)\n        {\n          histData.hcolnum[3]  = colnum[3];\n          histData.amin4 = tmin[3];\n          histData.maxbin4 = maxbin[3];\n          histData.binsize4 = tbin[3];\n          histData.haxis4 = (long) taxes[3];\n        }\n      }\n    }\n\n    /* define parameters of image for the iterator function */\n    fits_iter_set_file(imagepars, histptr);        /* pointer to image */\n    fits_iter_set_datatype(imagepars, imagetype);  /* image datatype   */\n    fits_iter_set_iotype(imagepars, OutputCol);    /* image is output  */\n\n    /* call the iterator function to write out the histogram image */\n    fits_iterate_data(n_cols, imagepars, offset, n_per_loop,\n                          ffwritehisto, (void*)&histData, status);\n       \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_get_col_minmax(fitsfile *fptr, int colnum, double *datamin, \n\t\t\tdouble *datamax, int *status)\n/* \n   Simple utility routine to compute the min and max value in a column\n*/\n{\n    int anynul;\n    long nrows, ntodo, firstrow, ii;\n    double array[1000], nulval;\n\n    ffgky(fptr, TLONG, \"NAXIS2\", &nrows, NULL, status); /* no. of rows */\n\n    firstrow = 1;\n    nulval = DOUBLENULLVALUE;\n    *datamin =  9.0E36;\n    *datamax = -9.0E36;\n\n    while(nrows)\n    {\n        ntodo = minvalue(nrows, 100);\n        ffgcv(fptr, TDOUBLE, colnum, firstrow, 1, ntodo, &nulval, array,\n              &anynul, status);\n\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (array[ii] != nulval)\n            {\n                *datamin = minvalue(*datamin, array[ii]);\n                *datamax = maxvalue(*datamax, array[ii]);\n            }\n        }\n\n        nrows -= ntodo;\n        firstrow += ntodo;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffwritehisto(long totaln, long pixoffset, long firstn, long nvalues,\n             int narrays, iteratorCol *imagepars, void *userPointer)\n/*\n   Interator work function that writes out the histogram.\n   The histogram values are calculated by another work function, ffcalchisto.\n   This work function only gets called once, and totaln = nvalues.\n*/\n{\n    iteratorCol colpars[5];\n    int ii, status = 0, ncols;\n    long rows_per_loop = 0, offset = 0;\n    histType *histData;\n\n    histData = (histType *)userPointer;\n\n    /* store pointer to the histogram array, and initialize to zero */\n\n    switch( histData->himagetype ) {\n    case TBYTE:\n       histData->hist.b = (char *  ) fits_iter_get_array(imagepars);\n       break;\n    case TSHORT:\n       histData->hist.i = (short * ) fits_iter_get_array(imagepars);\n       break;\n    case TINT:\n       histData->hist.j = (int *   ) fits_iter_get_array(imagepars);\n       break;\n    case TFLOAT:\n       histData->hist.r = (float * ) fits_iter_get_array(imagepars);\n       break;\n    case TDOUBLE:\n       histData->hist.d = (double *) fits_iter_get_array(imagepars);\n       break;\n    }\n\n    /* set the column parameters for the iterator function */\n    for (ii = 0; ii < histData->haxis; ii++)\n    {\n      fits_iter_set_by_num(&colpars[ii], histData->tblptr,\n\t\t\t   histData->hcolnum[ii], TDOUBLE, InputCol);\n    }\n    ncols = histData->haxis;\n\n    if (histData->weight == DOUBLENULLVALUE)\n    {\n      fits_iter_set_by_num(&colpars[histData->haxis], histData->tblptr,\n\t\t\t   histData->wtcolnum, TDOUBLE, InputCol);\n      ncols = histData->haxis + 1;\n    }\n\n    /* call iterator function to calc the histogram pixel values */\n\n    /* must lock this call in multithreaded environoments because */\n    /* the ffcalchist work routine uses static vaiables that would */\n    /* get clobbered if multiple threads were running at the same time */\n    FFLOCK;\n    fits_iterate_data(ncols, colpars, offset, rows_per_loop,\n                          ffcalchist, (void*)histData, &status);\n    FFUNLOCK;\n\n    return(status);\n}\n/*--------------------------------------------------------------------------*/\nint ffcalchist(long totalrows, long offset, long firstrow, long nrows,\n             int ncols, iteratorCol *colpars, void *userPointer)\n/*\n   Interator work function that calculates values for the 2D histogram.\n*/\n{\n    long ii, ipix, iaxisbin;\n    double pix, axisbin;\n    static double *col1, *col2, *col3, *col4; /* static to preserve values */\n    static double *wtcol;\n    static long incr2, incr3, incr4;\n    static histType histData;\n    static char *rowselect;\n\n    /*  Initialization procedures: execute on the first call  */\n    if (firstrow == 1)\n    {\n\n      /*  Copy input histogram data to static local variable so we */\n      /*  don't have to constantly dereference it.                 */\n\n      histData = *(histType*)userPointer;\n      rowselect = histData.rowselector;\n\n      /* assign the input array pointers to local pointers */\n      col1 = (double *) fits_iter_get_array(&colpars[0]);\n      if (histData.haxis > 1)\n      {\n        col2 = (double *) fits_iter_get_array(&colpars[1]);\n        incr2 = histData.haxis1;\n\n        if (histData.haxis > 2)\n        {\n          col3 = (double *) fits_iter_get_array(&colpars[2]);\n          incr3 = incr2 * histData.haxis2;\n\n          if (histData.haxis > 3)\n          {\n            col4 = (double *) fits_iter_get_array(&colpars[3]);\n            incr4 = incr3 * histData.haxis3;\n          }\n        }\n      }\n\n      if (ncols > histData.haxis)  /* then weights are give in a column */\n      {\n        wtcol = (double *) fits_iter_get_array(&colpars[histData.haxis]);\n      }\n    }   /* end of Initialization procedures */\n\n    /*  Main loop: increment the histogram at position of each event */\n    for (ii = 1; ii <= nrows; ii++) \n    {\n        if (rowselect)     /* if a row selector array is supplied... */\n        {\n           if (*rowselect)\n           {\n               rowselect++;   /* this row is included in the histogram */\n           }\n           else\n           {\n               rowselect++;   /* this row is excluded from the histogram */\n               continue;\n           }\n        }\n\n        if (col1[ii] == DOUBLENULLVALUE)  /* test for null value */\n            continue;\n\n        pix = (col1[ii] - histData.amin1) / histData.binsize1;\n        ipix = (long) (pix + 1.); /* add 1 because the 1st pixel is the null value */\n\n\t/* test if bin is within range */\n        if (ipix < 1 || ipix > histData.haxis1 || pix > histData.maxbin1)\n            continue;\n\n        if (histData.haxis > 1)\n        {\n          if (col2[ii] == DOUBLENULLVALUE)\n              continue;\n\n          axisbin = (col2[ii] - histData.amin2) / histData.binsize2;\n          iaxisbin = (long) axisbin;\n\n          if (axisbin < 0. || iaxisbin >= histData.haxis2 || axisbin > histData.maxbin2)\n              continue;\n\n          ipix += (iaxisbin * incr2);\n\n          if (histData.haxis > 2)\n          {\n            if (col3[ii] == DOUBLENULLVALUE)\n                continue;\n\n            axisbin = (col3[ii] - histData.amin3) / histData.binsize3;\n            iaxisbin = (long) axisbin;\n            if (axisbin < 0. || iaxisbin >= histData.haxis3 || axisbin > histData.maxbin3)\n                continue;\n\n            ipix += (iaxisbin * incr3);\n \n            if (histData.haxis > 3)\n            {\n              if (col4[ii] == DOUBLENULLVALUE)\n                  continue;\n\n              axisbin = (col4[ii] - histData.amin4) / histData.binsize4;\n              iaxisbin = (long) axisbin;\n              if (axisbin < 0. || iaxisbin >= histData.haxis4 || axisbin > histData.maxbin4)\n                  continue;\n\n              ipix += (iaxisbin * incr4);\n\n            }  /* end of haxis > 3 case */\n          }    /* end of haxis > 2 case */\n        }      /* end of haxis > 1 case */\n\n        /* increment the histogram pixel */\n        if (histData.weight != DOUBLENULLVALUE) /* constant weight factor */\n        {\n            if (histData.himagetype == TINT)\n              histData.hist.j[ipix] += (int) histData.weight;\n            else if (histData.himagetype == TSHORT)\n              histData.hist.i[ipix] += (short) histData.weight;\n            else if (histData.himagetype == TFLOAT)\n              histData.hist.r[ipix] += histData.weight;\n            else if (histData.himagetype == TDOUBLE)\n              histData.hist.d[ipix] += histData.weight;\n            else if (histData.himagetype == TBYTE)\n              histData.hist.b[ipix] += (char) histData.weight;\n        }\n        else if (histData.wtrecip) /* use reciprocal of the weight */\n        {\n            if (histData.himagetype == TINT)\n              histData.hist.j[ipix] += (int) (1./wtcol[ii]);\n            else if (histData.himagetype == TSHORT)\n              histData.hist.i[ipix] += (short) (1./wtcol[ii]);\n            else if (histData.himagetype == TFLOAT)\n              histData.hist.r[ipix] += (float) (1./wtcol[ii]);\n            else if (histData.himagetype == TDOUBLE)\n              histData.hist.d[ipix] += 1./wtcol[ii];\n            else if (histData.himagetype == TBYTE)\n              histData.hist.b[ipix] += (char) (1./wtcol[ii]);\n        }\n        else   /* no weights */\n        {\n            if (histData.himagetype == TINT)\n              histData.hist.j[ipix] += (int) wtcol[ii];\n            else if (histData.himagetype == TSHORT)\n              histData.hist.i[ipix] += (short) wtcol[ii];\n            else if (histData.himagetype == TFLOAT)\n              histData.hist.r[ipix] += wtcol[ii];\n            else if (histData.himagetype == TDOUBLE)\n              histData.hist.d[ipix] += wtcol[ii];\n            else if (histData.himagetype == TBYTE)\n              histData.hist.b[ipix] += (char) wtcol[ii];\n        }\n\n    }  /* end of main loop over all rows */\n\n    return(0);\n}\n\n"},{"id":16676,"name":"eval_tab.h","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/* A Bison parser, made by GNU Bison 3.7.4.  */\n\n/* Bison interface for Yacc-like parsers in C\n\n   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,\n   Inc.\n\n   This program is free software: you can redistribute it and/or modify\n   it under the terms of the GNU General Public License as published by\n   the Free Software Foundation, either version 3 of the License, or\n   (at your option) any later version.\n\n   This program is distributed in the hope that it will be useful,\n   but WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n   GNU General Public License for more details.\n\n   You should have received a copy of the GNU General Public License\n   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */\n\n/* As a special exception, you may create a larger work that contains\n   part or all of the Bison parser skeleton and distribute that work\n   under terms of your choice, so long as that work isn't itself a\n   parser generator using the skeleton or a modified version thereof\n   as a parser skeleton.  Alternatively, if you modify or redistribute\n   the parser skeleton itself, you may (at your option) remove this\n   special exception, which will cause the skeleton and the resulting\n   Bison output files to be licensed under the GNU General Public\n   License without this special exception.\n\n   This special exception was added by the Free Software Foundation in\n   version 2.2 of Bison.  */\n\n/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,\n   especially those whose name start with FF_ or ff_.  They are\n   private implementation details that can be changed or removed.  */\n\n#ifndef FF_FF_Y_TAB_H_INCLUDED\n# define FF_FF_Y_TAB_H_INCLUDED\n/* Debug traces.  */\n#ifndef FFDEBUG\n# define FFDEBUG 0\n#endif\n#if FFDEBUG\nextern int ffdebug;\n#endif\n\n/* Token kinds.  */\n#ifndef FFTOKENTYPE\n# define FFTOKENTYPE\n  enum fftokentype\n  {\n    FFEMPTY = -2,\n    FFEOF = 0,                     /* \"end of file\"  */\n    FFerror = 256,                 /* error  */\n    FFUNDEF = 257,                 /* \"invalid token\"  */\n    BOOLEAN = 258,                 /* BOOLEAN  */\n    LONG = 259,                    /* LONG  */\n    DOUBLE = 260,                  /* DOUBLE  */\n    STRING = 261,                  /* STRING  */\n    BITSTR = 262,                  /* BITSTR  */\n    FUNCTION = 263,                /* FUNCTION  */\n    BFUNCTION = 264,               /* BFUNCTION  */\n    IFUNCTION = 265,               /* IFUNCTION  */\n    GTIFILTER = 266,               /* GTIFILTER  */\n    GTIOVERLAP = 267,              /* GTIOVERLAP  */\n    REGFILTER = 268,               /* REGFILTER  */\n    COLUMN = 269,                  /* COLUMN  */\n    BCOLUMN = 270,                 /* BCOLUMN  */\n    SCOLUMN = 271,                 /* SCOLUMN  */\n    BITCOL = 272,                  /* BITCOL  */\n    ROWREF = 273,                  /* ROWREF  */\n    NULLREF = 274,                 /* NULLREF  */\n    SNULLREF = 275,                /* SNULLREF  */\n    OR = 276,                      /* OR  */\n    AND = 277,                     /* AND  */\n    EQ = 278,                      /* EQ  */\n    NE = 279,                      /* NE  */\n    GT = 280,                      /* GT  */\n    LT = 281,                      /* LT  */\n    LTE = 282,                     /* LTE  */\n    GTE = 283,                     /* GTE  */\n    XOR = 284,                     /* XOR  */\n    POWER = 285,                   /* POWER  */\n    NOT = 286,                     /* NOT  */\n    INTCAST = 287,                 /* INTCAST  */\n    FLTCAST = 288,                 /* FLTCAST  */\n    UMINUS = 289,                  /* UMINUS  */\n    ACCUM = 290,                   /* ACCUM  */\n    DIFF = 291                     /* DIFF  */\n  };\n  typedef enum fftokentype fftoken_kind_t;\n#endif\n/* Token kinds.  */\n#define FFEMPTY -2\n#define FFEOF 0\n#define FFerror 256\n#define FFUNDEF 257\n#define BOOLEAN 258\n#define LONG 259\n#define DOUBLE 260\n#define STRING 261\n#define BITSTR 262\n#define FUNCTION 263\n#define BFUNCTION 264\n#define IFUNCTION 265\n#define GTIFILTER 266\n#define GTIOVERLAP 267\n#define REGFILTER 268\n#define COLUMN 269\n#define BCOLUMN 270\n#define SCOLUMN 271\n#define BITCOL 272\n#define ROWREF 273\n#define NULLREF 274\n#define SNULLREF 275\n#define OR 276\n#define AND 277\n#define EQ 278\n#define NE 279\n#define GT 280\n#define LT 281\n#define LTE 282\n#define GTE 283\n#define XOR 284\n#define POWER 285\n#define NOT 286\n#define INTCAST 287\n#define FLTCAST 288\n#define UMINUS 289\n#define ACCUM 290\n#define DIFF 291\n\n/* Value type.  */\n#if ! defined FFSTYPE && ! defined FFSTYPE_IS_DECLARED\nunion FFSTYPE\n{\n#line 199 \"eval.y\"\n\n    int    Node;        /* Index of Node */\n    double dbl;         /* real value    */\n    long   lng;         /* integer value */\n    char   log;         /* logical value */\n    char   str[MAX_STRLEN];    /* string value  */\n\n#line 147 \"y.tab.h\"\n\n};\ntypedef union FFSTYPE FFSTYPE;\n# define FFSTYPE_IS_TRIVIAL 1\n# define FFSTYPE_IS_DECLARED 1\n#endif\n\n\nextern FFSTYPE fflval;\n\nint ffparse (void);\n\n#endif /* !FF_FF_Y_TAB_H_INCLUDED  */\n"},{"id":16677,"name":"fits_hcompress.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  #########################################################################\nThese routines to apply the H-compress compression algorithm to a 2-D Fits\nimage were written by R. White at the STScI and were obtained from the STScI at\nhttp://www.stsci.edu/software/hcompress.html\n\nThis source file is a concatination of the following sources files in the\noriginal distribution \n htrans.c \n digitize.c \n encode.c \n qwrite.c \n doencode.c \n bit_output.c \n qtree_encode.c\n\nThe following modifications have been made to the original code:\n\n  - commented out redundant \"include\" statements\n  - added the noutchar global variable \n  - changed all the 'extern' declarations to 'static', since all the routines are in\n    the same source file\n  - changed the first parameter in encode (and in lower level routines from a file stream\n    to a char array\n  - modifid the encode routine to return the size of the compressed array of bytes\n  - changed calls to printf and perror to call the CFITSIO ffpmsg routine\n  - modified the mywrite routine, and lower level byte writing routines,  to copy \n    the output bytes to a char array, instead of writing them to a file stream\n  - replace \"exit\" statements with \"return\" statements\n  - changed the function declarations to the more modern ANSI C style\n\n ############################################################################  */\n \n#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n\nstatic long noutchar;\nstatic long noutmax;\n\nstatic int htrans(int a[],int nx,int ny);\nstatic void digitize(int a[], int nx, int ny, int scale);\nstatic int encode(char *outfile, long *nlen, int a[], int nx, int ny, int scale);\nstatic void shuffle(int a[], int n, int n2, int tmp[]);\n\nstatic int htrans64(LONGLONG a[],int nx,int ny);\nstatic void digitize64(LONGLONG a[], int nx, int ny, int scale);\nstatic int encode64(char *outfile, long *nlen, LONGLONG a[], int nx, int ny, int scale);\nstatic void shuffle64(LONGLONG a[], int n, int n2, LONGLONG tmp[]);\n\nstatic  void writeint(char *outfile, int a);\nstatic  void writelonglong(char *outfile, LONGLONG a);\nstatic  int doencode(char *outfile, int a[], int nx, int ny, unsigned char nbitplanes[3]);\nstatic  int doencode64(char *outfile, LONGLONG a[], int nx, int ny, unsigned char nbitplanes[3]);\nstatic int  qwrite(char *file, char buffer[], int n);\n\nstatic int qtree_encode(char *outfile, int a[], int n, int nqx, int nqy, int nbitplanes);\nstatic int qtree_encode64(char *outfile, LONGLONG a[], int n, int nqx, int nqy, int nbitplanes);\nstatic void start_outputing_bits(void);\nstatic void done_outputing_bits(char *outfile);\nstatic void output_nbits(char *outfile, int bits, int n);\n\nstatic void qtree_onebit(int a[], int n, int nx, int ny, unsigned char b[], int bit);\nstatic void qtree_onebit64(LONGLONG a[], int n, int nx, int ny, unsigned char b[], int bit);\nstatic void qtree_reduce(unsigned char a[], int n, int nx, int ny, unsigned char b[]);\nstatic int  bufcopy(unsigned char a[], int n, unsigned char buffer[], int *b, int bmax);\nstatic void write_bdirect(char *outfile, int a[], int n,int nqx, int nqy, unsigned char scratch[], int bit);\nstatic void write_bdirect64(char *outfile, LONGLONG a[], int n,int nqx, int nqy, unsigned char scratch[], int bit);\n\n/* #define output_nybble(outfile,c)\toutput_nbits(outfile,c,4) */\nstatic void output_nybble(char *outfile, int bits);\nstatic void output_nnybble(char *outfile, int n, unsigned char array[]);\n\n#define output_huffman(outfile,c)\toutput_nbits(outfile,code[c],ncode[c])\n\n/* ---------------------------------------------------------------------- */\nint fits_hcompress(int *a, int ny, int nx, int scale, char *output, \n                  long *nbytes, int *status)\n{\n  /* \n     compress the input image using the H-compress algorithm\n  \n   a  - input image array\n   nx - size of X axis of image\n   ny - size of Y axis of image\n   scale - quantization scale factor. Larger values results in more (lossy) compression\n           scale = 0 does lossless compression\n   output - pre-allocated array to hold the output compressed stream of bytes\n   nbyts  - input value = size of the output buffer;\n            returned value = size of the compressed byte stream, in bytes\n\n NOTE: the nx and ny dimensions as defined within this code are reversed from\n the usual FITS notation.  ny is the fastest varying dimension, which is\n usually considered the X axis in the FITS image display\n\n  */\n\n  int stat;\n  \n  if (*status > 0) return(*status);\n\n  /* H-transform */\n  stat = htrans(a, nx, ny);\n  if (stat) {\n     *status = stat;\n     return(*status);\n  }\n\n  /* digitize */\n  digitize(a, nx, ny, scale);\n\n  /* encode and write to output array */\n\n  FFLOCK;\n  noutmax = *nbytes;  /* input value is the allocated size of the array */\n  *nbytes = 0;  /* reset */\n\n  stat = encode(output, nbytes, a, nx, ny, scale);\n  FFUNLOCK;\n  \n  *status = stat;\n  return(*status);\n}\n/* ---------------------------------------------------------------------- */\nint fits_hcompress64(LONGLONG *a, int ny, int nx, int scale, char *output, \n                  long *nbytes, int *status)\n{\n  /* \n     compress the input image using the H-compress algorithm\n  \n   a  - input image array\n   nx - size of X axis of image\n   ny - size of Y axis of image\n   scale - quantization scale factor. Larger values results in more (lossy) compression\n           scale = 0 does lossless compression\n   output - pre-allocated array to hold the output compressed stream of bytes\n   nbyts  - size of the compressed byte stream, in bytes\n\n NOTE: the nx and ny dimensions as defined within this code are reversed from\n the usual FITS notation.  ny is the fastest varying dimension, which is\n usually considered the X axis in the FITS image display\n\n  */\n\n  int stat;\n  \n  if (*status > 0) return(*status);\n\n  /* H-transform */\n  stat = htrans64(a, nx, ny);\n  if (stat) {\n     *status = stat;\n     return(*status);\n  }\n\n  /* digitize */\n  digitize64(a, nx, ny, scale);\n\n  /* encode and write to output array */\n\n  FFLOCK;\n  noutmax = *nbytes;  /* input value is the allocated size of the array */\n  *nbytes = 0;  /* reset */\n\n  stat = encode64(output, nbytes, a, nx, ny, scale);\n  FFUNLOCK;\n\n  *status = stat;\n  return(*status);\n}\n\n \n/* Copyright (c) 1993 Association of Universities for Research \n * in Astronomy. All rights reserved. Produced under National   \n * Aeronautics and Space Administration Contract No. NAS5-26555.\n */\n/* htrans.c   H-transform of NX x NY integer image\n *\n * Programmer: R. White\t\tDate: 11 May 1992\n */\n\n/* ######################################################################### */\nstatic int htrans(int a[],int nx,int ny)\n{\nint nmax, log2n, h0, hx, hy, hc, nxtop, nytop, i, j, k;\nint oddx, oddy;\nint shift, mask, mask2, prnd, prnd2, nrnd2;\nint s10, s00;\nint *tmp;\n\n\t/*\n\t * log2n is log2 of max(nx,ny) rounded up to next power of 2\n\t */\n\tnmax = (nx>ny) ? nx : ny;\n\tlog2n = (int) (log((float) nmax)/log(2.0)+0.5);\n\tif ( nmax > (1<<log2n) ) {\n\t\tlog2n += 1;\n\t}\n\t/*\n\t * get temporary storage for shuffling elements\n\t */\n\ttmp = (int *) malloc(((nmax+1)/2)*sizeof(int));\n\tif(tmp == (int *) NULL) {\n\t        ffpmsg(\"htrans: insufficient memory\");\n\t\treturn(DATA_COMPRESSION_ERR);\n\t}\n\t/*\n\t * set up rounding and shifting masks\n\t */\n\tshift = 0;\n\tmask  = -2;\n\tmask2 = mask << 1;\n\tprnd  = 1;\n\tprnd2 = prnd << 1;\n\tnrnd2 = prnd2 - 1;\n\t/*\n\t * do log2n reductions\n\t *\n\t * We're indexing a as a 2-D array with dimensions (nx,ny).\n\t */\n\tnxtop = nx;\n\tnytop = ny;\n\n\tfor (k = 0; k<log2n; k++) {\n\t\toddx = nxtop % 2;\n\t\toddy = nytop % 2;\n\t\tfor (i = 0; i<nxtop-oddx; i += 2) {\n\t\t\ts00 = i*ny;\t\t\t\t/* s00 is index of a[i,j]\t*/\n\t\t\ts10 = s00+ny;\t\t\t/* s10 is index of a[i+1,j]\t*/\n\t\t\tfor (j = 0; j<nytop-oddy; j += 2) {\n\t\t\t\t/*\n\t\t\t\t * Divide h0,hx,hy,hc by 2 (1 the first time through).\n\t\t\t\t */\n\t\t\t\th0 = (a[s10+1] + a[s10] + a[s00+1] + a[s00]) >> shift;\n\t\t\t\thx = (a[s10+1] + a[s10] - a[s00+1] - a[s00]) >> shift;\n\t\t\t\thy = (a[s10+1] - a[s10] + a[s00+1] - a[s00]) >> shift;\n\t\t\t\thc = (a[s10+1] - a[s10] - a[s00+1] + a[s00]) >> shift;\n\n\t\t\t\t/*\n\t\t\t\t * Throw away the 2 bottom bits of h0, bottom bit of hx,hy.\n\t\t\t\t * To get rounding to be same for positive and negative\n\t\t\t\t * numbers, nrnd2 = prnd2 - 1.\n\t\t\t\t */\n\t\t\t\ta[s10+1] = hc;\n\t\t\t\ta[s10  ] = ( (hx>=0) ? (hx+prnd)  :  hx        ) & mask ;\n\t\t\t\ta[s00+1] = ( (hy>=0) ? (hy+prnd)  :  hy        ) & mask ;\n\t\t\t\ta[s00  ] = ( (h0>=0) ? (h0+prnd2) : (h0+nrnd2) ) & mask2;\n\t\t\t\ts00 += 2;\n\t\t\t\ts10 += 2;\n\t\t\t}\n\t\t\tif (oddy) {\n\t\t\t\t/*\n\t\t\t\t * do last element in row if row length is odd\n\t\t\t\t * s00+1, s10+1 are off edge\n\t\t\t\t */\n\t\t\t\th0 = (a[s10] + a[s00]) << (1-shift);\n\t\t\t\thx = (a[s10] - a[s00]) << (1-shift);\n\t\t\t\ta[s10  ] = ( (hx>=0) ? (hx+prnd)  :  hx        ) & mask ;\n\t\t\t\ta[s00  ] = ( (h0>=0) ? (h0+prnd2) : (h0+nrnd2) ) & mask2;\n\t\t\t\ts00 += 1;\n\t\t\t\ts10 += 1;\n\t\t\t}\n\t\t}\n\t\tif (oddx) {\n\t\t\t/*\n\t\t\t * do last row if column length is odd\n\t\t\t * s10, s10+1 are off edge\n\t\t\t */\n\t\t\ts00 = i*ny;\n\t\t\tfor (j = 0; j<nytop-oddy; j += 2) {\n\t\t\t\th0 = (a[s00+1] + a[s00]) << (1-shift);\n\t\t\t\thy = (a[s00+1] - a[s00]) << (1-shift);\n\t\t\t\ta[s00+1] = ( (hy>=0) ? (hy+prnd)  :  hy        ) & mask ;\n\t\t\t\ta[s00  ] = ( (h0>=0) ? (h0+prnd2) : (h0+nrnd2) ) & mask2;\n\t\t\t\ts00 += 2;\n\t\t\t}\n\t\t\tif (oddy) {\n\t\t\t\t/*\n\t\t\t\t * do corner element if both row and column lengths are odd\n\t\t\t\t * s00+1, s10, s10+1 are off edge\n\t\t\t\t */\n\t\t\t\th0 = a[s00] << (2-shift);\n\t\t\t\ta[s00  ] = ( (h0>=0) ? (h0+prnd2) : (h0+nrnd2) ) & mask2;\n\t\t\t}\n\t\t}\n\t\t/*\n\t\t * now shuffle in each dimension to group coefficients by order\n\t\t */\n\t\tfor (i = 0; i<nxtop; i++) {\n\t\t\tshuffle(&a[ny*i],nytop,1,tmp);\n\t\t}\n\t\tfor (j = 0; j<nytop; j++) {\n\t\t\tshuffle(&a[j],nxtop,ny,tmp);\n\t\t}\n\t\t/*\n\t\t * image size reduced by 2 (round up if odd)\n\t\t */\n\t\tnxtop = (nxtop+1)>>1;\n\t\tnytop = (nytop+1)>>1;\n\t\t/*\n\t\t * divisor doubles after first reduction\n\t\t */\n\t\tshift = 1;\n\t\t/*\n\t\t * masks, rounding values double after each iteration\n\t\t */\n\t\tmask  = mask2;\n\t\tprnd  = prnd2;\n\t\tmask2 = mask2 << 1;\n\t\tprnd2 = prnd2 << 1;\n\t\tnrnd2 = prnd2 - 1;\n\t}\n\tfree(tmp);\n\treturn(0);\n}\n/* ######################################################################### */\n\nstatic int htrans64(LONGLONG a[],int nx,int ny)\n{\nint nmax, log2n, nxtop, nytop, i, j, k;\nint oddx, oddy;\nint shift;\nint s10, s00;\nLONGLONG h0, hx, hy, hc, prnd, prnd2, nrnd2, mask, mask2;\nLONGLONG *tmp;\n\n\t/*\n\t * log2n is log2 of max(nx,ny) rounded up to next power of 2\n\t */\n\tnmax = (nx>ny) ? nx : ny;\n\tlog2n = (int) (log((float) nmax)/log(2.0)+0.5);\n\tif ( nmax > (1<<log2n) ) {\n\t\tlog2n += 1;\n\t}\n\t/*\n\t * get temporary storage for shuffling elements\n\t */\n\ttmp = (LONGLONG *) malloc(((nmax+1)/2)*sizeof(LONGLONG));\n\tif(tmp == (LONGLONG *) NULL) {\n\t        ffpmsg(\"htrans64: insufficient memory\");\n\t\treturn(DATA_COMPRESSION_ERR);\n\t}\n\t/*\n\t * set up rounding and shifting masks\n\t */\n\tshift = 0;\n\tmask  = (LONGLONG) -2;\n\tmask2 = mask << 1;\n\tprnd  = (LONGLONG) 1;\n\tprnd2 = prnd << 1;\n\tnrnd2 = prnd2 - 1;\n\t/*\n\t * do log2n reductions\n\t *\n\t * We're indexing a as a 2-D array with dimensions (nx,ny).\n\t */\n\tnxtop = nx;\n\tnytop = ny;\n\n\tfor (k = 0; k<log2n; k++) {\n\t\toddx = nxtop % 2;\n\t\toddy = nytop % 2;\n\t\tfor (i = 0; i<nxtop-oddx; i += 2) {\n\t\t\ts00 = i*ny;\t\t\t\t/* s00 is index of a[i,j]\t*/\n\t\t\ts10 = s00+ny;\t\t\t/* s10 is index of a[i+1,j]\t*/\n\t\t\tfor (j = 0; j<nytop-oddy; j += 2) {\n\t\t\t\t/*\n\t\t\t\t * Divide h0,hx,hy,hc by 2 (1 the first time through).\n\t\t\t\t */\n\t\t\t\th0 = (a[s10+1] + a[s10] + a[s00+1] + a[s00]) >> shift;\n\t\t\t\thx = (a[s10+1] + a[s10] - a[s00+1] - a[s00]) >> shift;\n\t\t\t\thy = (a[s10+1] - a[s10] + a[s00+1] - a[s00]) >> shift;\n\t\t\t\thc = (a[s10+1] - a[s10] - a[s00+1] + a[s00]) >> shift;\n\n\t\t\t\t/*\n\t\t\t\t * Throw away the 2 bottom bits of h0, bottom bit of hx,hy.\n\t\t\t\t * To get rounding to be same for positive and negative\n\t\t\t\t * numbers, nrnd2 = prnd2 - 1.\n\t\t\t\t */\n\t\t\t\ta[s10+1] = hc;\n\t\t\t\ta[s10  ] = ( (hx>=0) ? (hx+prnd)  :  hx        ) & mask ;\n\t\t\t\ta[s00+1] = ( (hy>=0) ? (hy+prnd)  :  hy        ) & mask ;\n\t\t\t\ta[s00  ] = ( (h0>=0) ? (h0+prnd2) : (h0+nrnd2) ) & mask2;\n\t\t\t\ts00 += 2;\n\t\t\t\ts10 += 2;\n\t\t\t}\n\t\t\tif (oddy) {\n\t\t\t\t/*\n\t\t\t\t * do last element in row if row length is odd\n\t\t\t\t * s00+1, s10+1 are off edge\n\t\t\t\t */\n\t\t\t\th0 = (a[s10] + a[s00]) << (1-shift);\n\t\t\t\thx = (a[s10] - a[s00]) << (1-shift);\n\t\t\t\ta[s10  ] = ( (hx>=0) ? (hx+prnd)  :  hx        ) & mask ;\n\t\t\t\ta[s00  ] = ( (h0>=0) ? (h0+prnd2) : (h0+nrnd2) ) & mask2;\n\t\t\t\ts00 += 1;\n\t\t\t\ts10 += 1;\n\t\t\t}\n\t\t}\n\t\tif (oddx) {\n\t\t\t/*\n\t\t\t * do last row if column length is odd\n\t\t\t * s10, s10+1 are off edge\n\t\t\t */\n\t\t\ts00 = i*ny;\n\t\t\tfor (j = 0; j<nytop-oddy; j += 2) {\n\t\t\t\th0 = (a[s00+1] + a[s00]) << (1-shift);\n\t\t\t\thy = (a[s00+1] - a[s00]) << (1-shift);\n\t\t\t\ta[s00+1] = ( (hy>=0) ? (hy+prnd)  :  hy        ) & mask ;\n\t\t\t\ta[s00  ] = ( (h0>=0) ? (h0+prnd2) : (h0+nrnd2) ) & mask2;\n\t\t\t\ts00 += 2;\n\t\t\t}\n\t\t\tif (oddy) {\n\t\t\t\t/*\n\t\t\t\t * do corner element if both row and column lengths are odd\n\t\t\t\t * s00+1, s10, s10+1 are off edge\n\t\t\t\t */\n\t\t\t\th0 = a[s00] << (2-shift);\n\t\t\t\ta[s00  ] = ( (h0>=0) ? (h0+prnd2) : (h0+nrnd2) ) & mask2;\n\t\t\t}\n\t\t}\n\t\t/*\n\t\t * now shuffle in each dimension to group coefficients by order\n\t\t */\n\t\tfor (i = 0; i<nxtop; i++) {\n\t\t\tshuffle64(&a[ny*i],nytop,1,tmp);\n\t\t}\n\t\tfor (j = 0; j<nytop; j++) {\n\t\t\tshuffle64(&a[j],nxtop,ny,tmp);\n\t\t}\n\t\t/*\n\t\t * image size reduced by 2 (round up if odd)\n\t\t */\n\t\tnxtop = (nxtop+1)>>1;\n\t\tnytop = (nytop+1)>>1;\n\t\t/*\n\t\t * divisor doubles after first reduction\n\t\t */\n\t\tshift = 1;\n\t\t/*\n\t\t * masks, rounding values double after each iteration\n\t\t */\n\t\tmask  = mask2;\n\t\tprnd  = prnd2;\n\t\tmask2 = mask2 << 1;\n\t\tprnd2 = prnd2 << 1;\n\t\tnrnd2 = prnd2 - 1;\n\t}\n\tfree(tmp);\n\treturn(0);\n}\n\n/* ######################################################################### */\nstatic void\nshuffle(int a[], int n, int n2, int tmp[])\n{\n\n/* \nint a[];\t array to shuffle\t\t\t\t\t\nint n;\t\t number of elements to shuffle\t\nint n2;\t\t second dimension\t\t\t\t\t\nint tmp[];\t scratch storage\t\t\t\t\t\n*/\n\nint i;\nint *p1, *p2, *pt;\n\n\t/*\n\t * copy odd elements to tmp\n\t */\n\tpt = tmp;\n\tp1 = &a[n2];\n\tfor (i=1; i < n; i += 2) {\n\t\t*pt = *p1;\n\t\tpt += 1;\n\t\tp1 += (n2+n2);\n\t}\n\t/*\n\t * compress even elements into first half of A\n\t */\n\tp1 = &a[n2];\n\tp2 = &a[n2+n2];\n\tfor (i=2; i<n; i += 2) {\n\t\t*p1 = *p2;\n\t\tp1 += n2;\n\t\tp2 += (n2+n2);\n\t}\n\t/*\n\t * put odd elements into 2nd half\n\t */\n\tpt = tmp;\n\tfor (i = 1; i<n; i += 2) {\n\t\t*p1 = *pt;\n\t\tp1 += n2;\n\t\tpt += 1;\n\t}\n}\n/* ######################################################################### */\nstatic void\nshuffle64(LONGLONG a[], int n, int n2, LONGLONG tmp[])\n{\n\n/* \nLONGLONG a[];\t array to shuffle\t\t\t\t\t\nint n;\t\t number of elements to shuffle\t\nint n2;\t\t second dimension\t\t\t\t\t\nLONGLONG tmp[];\t scratch storage\t\t\t\t\t\n*/\n\nint i;\nLONGLONG *p1, *p2, *pt;\n\n\t/*\n\t * copy odd elements to tmp\n\t */\n\tpt = tmp;\n\tp1 = &a[n2];\n\tfor (i=1; i < n; i += 2) {\n\t\t*pt = *p1;\n\t\tpt += 1;\n\t\tp1 += (n2+n2);\n\t}\n\t/*\n\t * compress even elements into first half of A\n\t */\n\tp1 = &a[n2];\n\tp2 = &a[n2+n2];\n\tfor (i=2; i<n; i += 2) {\n\t\t*p1 = *p2;\n\t\tp1 += n2;\n\t\tp2 += (n2+n2);\n\t}\n\t/*\n\t * put odd elements into 2nd half\n\t */\n\tpt = tmp;\n\tfor (i = 1; i<n; i += 2) {\n\t\t*p1 = *pt;\n\t\tp1 += n2;\n\t\tpt += 1;\n\t}\n}\n/* ######################################################################### */\n/* ######################################################################### */\n/* Copyright (c) 1993 Association of Universities for Research \n * in Astronomy. All rights reserved. Produced under National   \n * Aeronautics and Space Administration Contract No. NAS5-26555.\n */\n/* digitize.c\tdigitize H-transform\n *\n * Programmer: R. White\t\tDate: 11 March 1991\n */\n\n/* ######################################################################### */\nstatic void  \ndigitize(int a[], int nx, int ny, int scale)\n{\nint d, *p;\n\n\t/*\n\t * round to multiple of scale\n\t */\n\tif (scale <= 1) return;\n\td=(scale+1)/2-1;\n\tfor (p=a; p <= &a[nx*ny-1]; p++) *p = ((*p>0) ? (*p+d) : (*p-d))/scale;\n}\n\n/* ######################################################################### */\nstatic void  \ndigitize64(LONGLONG a[], int nx, int ny, int scale)\n{\nLONGLONG d, *p, scale64;\n\n\t/*\n\t * round to multiple of scale\n\t */\n\tif (scale <= 1) return;\n\td=(scale+1)/2-1;\n\tscale64 = scale;  /* use a 64-bit int for efficiency in the big loop */\n\n\tfor (p=a; p <= &a[nx*ny-1]; p++) *p = ((*p>0) ? (*p+d) : (*p-d))/scale64;\n}\n/* ######################################################################### */\n/* ######################################################################### */\n/* Copyright (c) 1993 Association of Universities for Research \n * in Astronomy. All rights reserved. Produced under National   \n * Aeronautics and Space Administration Contract No. NAS5-26555.\n */\n/* encode.c\t\tencode H-transform and write to outfile\n *\n * Programmer: R. White\t\tDate: 2 February 1994\n */\n\nstatic char code_magic[2] = { (char)0xDD, (char)0x99 };\n\n\n/* ######################################################################### */\nstatic int encode(char *outfile, long *nlength, int a[], int nx, int ny, int scale)\n{\n\n/* FILE *outfile;  - change outfile to a char array */  \n/*\n  long * nlength    returned length (in bytes) of the encoded array)\n  int a[];\t\t\t\t\t\t\t\t input H-transform array (nx,ny)\n  int nx,ny;\t\t\t\t\t\t\t\t size of H-transform array\t\n  int scale;\t\t\t\t\t\t\t\t scale factor for digitization\n*/\nint nel, nx2, ny2, i, j, k, q, vmax[3], nsign, bits_to_go;\nunsigned char nbitplanes[3];\nunsigned char *signbits;\nint stat;\n\n        noutchar = 0;  /* initialize the number of compressed bytes that have been written */\n\tnel = nx*ny;\n\t/*\n\t * write magic value\n\t */\n\tqwrite(outfile, code_magic, sizeof(code_magic));\n\twriteint(outfile, nx);\t\t\t/* size of image */\n\twriteint(outfile, ny);\n\twriteint(outfile, scale);\t\t/* scale factor for digitization */\n\t/*\n\t * write first value of A (sum of all pixels -- the only value\n\t * which does not compress well)\n\t */\n\twritelonglong(outfile, (LONGLONG) a[0]);\n\n\ta[0] = 0;\n\t/*\n\t * allocate array for sign bits and save values, 8 per byte\n              (initialize to all zeros)\n\t */\n\tsignbits = (unsigned char *) calloc(1, (nel+7)/8);\n\tif (signbits == (unsigned char *) NULL) {\n\t\tffpmsg(\"encode: insufficient memory\");\n\t\treturn(DATA_COMPRESSION_ERR);\n\t}\n\tnsign = 0;\n\tbits_to_go = 8;\n/*\tsignbits[0] = 0; */\n\tfor (i=0; i<nel; i++) {\n\t\tif (a[i] > 0) {\n\t\t\t/*\n\t\t\t * positive element, put zero at end of buffer\n\t\t\t */\n\t\t\tsignbits[nsign] <<= 1;\n\t\t\tbits_to_go -= 1;\n\t\t} else if (a[i] < 0) {\n\t\t\t/*\n\t\t\t * negative element, shift in a one\n\t\t\t */\n\t\t\tsignbits[nsign] <<= 1;\n\t\t\tsignbits[nsign] |= 1;\n\t\t\tbits_to_go -= 1;\n\t\t\t/*\n\t\t\t * replace a by absolute value\n\t\t\t */\n\t\t\ta[i] = -a[i];\n\t\t}\n\t\tif (bits_to_go == 0) {\n\t\t\t/*\n\t\t\t * filled up this byte, go to the next one\n\t\t\t */\n\t\t\tbits_to_go = 8;\n\t\t\tnsign += 1;\n/*\t\t\tsignbits[nsign] = 0; */\n\t\t}\n\t}\n\tif (bits_to_go != 8) {\n\t\t/*\n\t\t * some bits in last element\n\t\t * move bits in last byte to bottom and increment nsign\n\t\t */\n\t\tsignbits[nsign] <<= bits_to_go;\n\t\tnsign += 1;\n\t}\n\t/*\n\t * calculate number of bit planes for 3 quadrants\n\t *\n\t * quadrant 0=bottom left, 1=bottom right or top left, 2=top right, \n\t */\n\tfor (q=0; q<3; q++) {\n\t\tvmax[q] = 0;\n\t}\n\t/*\n\t * get maximum absolute value in each quadrant\n\t */\n\tnx2 = (nx+1)/2;\n\tny2 = (ny+1)/2;\n\tj=0;\t/* column counter\t*/\n\tk=0;\t/* row counter\t\t*/\n\tfor (i=0; i<nel; i++) {\n\t\tq = (j>=ny2) + (k>=nx2);\n\t\tif (vmax[q] < a[i]) vmax[q] = a[i];\n\t\tif (++j >= ny) {\n\t\t\tj = 0;\n\t\t\tk += 1;\n\t\t}\n\t}\n\t/*\n\t * now calculate number of bits for each quadrant\n\t */\n\n        /* this is a more efficient way to do this, */\n \n \n        for (q = 0; q < 3; q++) {\n            for (nbitplanes[q] = 0; vmax[q]>0; vmax[q] = vmax[q]>>1, nbitplanes[q]++) ; \n        }\n\n\n/*\n\tfor (q = 0; q < 3; q++) {\n\t\tnbitplanes[q] = (int) (log((float) (vmax[q]+1))/log(2.0)+0.5);\n\t\tif ( (vmax[q]+1) > (1<<nbitplanes[q]) ) {\n\t\t\tnbitplanes[q] += 1;\n\t\t}\n\t}\n*/\n\n\t/*\n\t * write nbitplanes\n\t */\n\tif (0 == qwrite(outfile, (char *) nbitplanes, sizeof(nbitplanes))) {\n\t        *nlength = noutchar;\n\t\tffpmsg(\"encode: output buffer too small\");\n\t\treturn(DATA_COMPRESSION_ERR);\n        }\n\t \n\t/*\n\t * write coded array\n\t */\n\tstat = doencode(outfile, a, nx, ny, nbitplanes);\n\t/*\n\t * write sign bits\n\t */\n\n\tif (nsign > 0) {\n\n\t   if ( 0 == qwrite(outfile, (char *) signbits, nsign)) {\n\t        free(signbits);\n\t        *nlength = noutchar;\n\t\tffpmsg(\"encode: output buffer too small\");\n\t\treturn(DATA_COMPRESSION_ERR);\n          }\n\t} \n\t\n\tfree(signbits);\n\t*nlength = noutchar;\n\n        if (noutchar >= noutmax) {\n\t\tffpmsg(\"encode: output buffer too small\");\n\t\treturn(DATA_COMPRESSION_ERR);\n        }  \n\t\n\treturn(stat); \n}\n/* ######################################################################### */\nstatic int encode64(char *outfile, long *nlength, LONGLONG a[], int nx, int ny, int scale)\n{\n\n/* FILE *outfile;  - change outfile to a char array */  \n/*\n  long * nlength    returned length (in bytes) of the encoded array)\n  LONGLONG a[];\t\t\t\t\t\t\t\t input H-transform array (nx,ny)\n  int nx,ny;\t\t\t\t\t\t\t\t size of H-transform array\t\n  int scale;\t\t\t\t\t\t\t\t scale factor for digitization\n*/\nint nel, nx2, ny2, i, j, k, q, nsign, bits_to_go;\nLONGLONG vmax[3];\nunsigned char nbitplanes[3];\nunsigned char *signbits;\nint stat;\n\n        noutchar = 0;  /* initialize the number of compressed bytes that have been written */\n\tnel = nx*ny;\n\t/*\n\t * write magic value\n\t */\n\tqwrite(outfile, code_magic, sizeof(code_magic));\n\twriteint(outfile, nx);\t\t\t\t/* size of image\t*/\n\twriteint(outfile, ny);\n\twriteint(outfile, scale);\t\t\t/* scale factor for digitization */\n\t/*\n\t * write first value of A (sum of all pixels -- the only value\n\t * which does not compress well)\n\t */\n\twritelonglong(outfile, a[0]);\n\n\ta[0] = 0;\n\t/*\n\t * allocate array for sign bits and save values, 8 per byte\n\t */\n\tsignbits = (unsigned char *) calloc(1, (nel+7)/8);\n\tif (signbits == (unsigned char *) NULL) {\n\t\tffpmsg(\"encode64: insufficient memory\");\n\t\treturn(DATA_COMPRESSION_ERR);\n\t}\n\tnsign = 0;\n\tbits_to_go = 8;\n/*\tsignbits[0] = 0; */\n\tfor (i=0; i<nel; i++) {\n\t\tif (a[i] > 0) {\n\t\t\t/*\n\t\t\t * positive element, put zero at end of buffer\n\t\t\t */\n\t\t\tsignbits[nsign] <<= 1;\n\t\t\tbits_to_go -= 1;\n\t\t} else if (a[i] < 0) {\n\t\t\t/*\n\t\t\t * negative element, shift in a one\n\t\t\t */\n\t\t\tsignbits[nsign] <<= 1;\n\t\t\tsignbits[nsign] |= 1;\n\t\t\tbits_to_go -= 1;\n\t\t\t/*\n\t\t\t * replace a by absolute value\n\t\t\t */\n\t\t\ta[i] = -a[i];\n\t\t}\n\t\tif (bits_to_go == 0) {\n\t\t\t/*\n\t\t\t * filled up this byte, go to the next one\n\t\t\t */\n\t\t\tbits_to_go = 8;\n\t\t\tnsign += 1;\n/*\t\t\tsignbits[nsign] = 0; */\n\t\t}\n\t}\n\tif (bits_to_go != 8) {\n\t\t/*\n\t\t * some bits in last element\n\t\t * move bits in last byte to bottom and increment nsign\n\t\t */\n\t\tsignbits[nsign] <<= bits_to_go;\n\t\tnsign += 1;\n\t}\n\t/*\n\t * calculate number of bit planes for 3 quadrants\n\t *\n\t * quadrant 0=bottom left, 1=bottom right or top left, 2=top right, \n\t */\n\tfor (q=0; q<3; q++) {\n\t\tvmax[q] = 0;\n\t}\n\t/*\n\t * get maximum absolute value in each quadrant\n\t */\n\tnx2 = (nx+1)/2;\n\tny2 = (ny+1)/2;\n\tj=0;\t/* column counter\t*/\n\tk=0;\t/* row counter\t\t*/\n\tfor (i=0; i<nel; i++) {\n\t\tq = (j>=ny2) + (k>=nx2);\n\t\tif (vmax[q] < a[i]) vmax[q] = a[i];\n\t\tif (++j >= ny) {\n\t\t\tj = 0;\n\t\t\tk += 1;\n\t\t}\n\t}\n\t/*\n\t * now calculate number of bits for each quadrant\n\t */\n\t \n        /* this is a more efficient way to do this, */\n \n \n        for (q = 0; q < 3; q++) {\n            for (nbitplanes[q] = 0; vmax[q]>0; vmax[q] = vmax[q]>>1, nbitplanes[q]++) ; \n        }\n\n\n/*\n\tfor (q = 0; q < 3; q++) {\n\t\tnbitplanes[q] = log((float) (vmax[q]+1))/log(2.0)+0.5;\n\t\tif ( (vmax[q]+1) > (((LONGLONG) 1)<<nbitplanes[q]) ) {\n\t\t\tnbitplanes[q] += 1;\n\t\t}\n\t}\n*/\n\n\t/*\n\t * write nbitplanes\n\t */\n\n\tif (0 == qwrite(outfile, (char *) nbitplanes, sizeof(nbitplanes))) {\n\t        *nlength = noutchar;\n\t\tffpmsg(\"encode: output buffer too small\");\n\t\treturn(DATA_COMPRESSION_ERR);\n        }\n\t \n\t/*\n\t * write coded array\n\t */\n\tstat = doencode64(outfile, a, nx, ny, nbitplanes);\n\t/*\n\t * write sign bits\n\t */\n\n\tif (nsign > 0) {\n\n\t   if ( 0 == qwrite(outfile, (char *) signbits, nsign)) {\n\t        free(signbits);\n\t        *nlength = noutchar;\n\t\tffpmsg(\"encode: output buffer too small\");\n\t\treturn(DATA_COMPRESSION_ERR);\n          }\n\t} \n\n\tfree(signbits);\n\t*nlength = noutchar;\n\n        if (noutchar >= noutmax) {\n\t\tffpmsg(\"encode64: output buffer too small\");\n\t\treturn(DATA_COMPRESSION_ERR);\n        }\n\t\t\n\treturn(stat); \n}\n/* ######################################################################### */\n/* ######################################################################### */\n/* Copyright (c) 1993 Association of Universities for Research \n * in Astronomy. All rights reserved. Produced under National   \n * Aeronautics and Space Administration Contract No. NAS5-26555.\n */\n/* qwrite.c\tWrite binary data\n *\n * Programmer: R. White\t\tDate: 11 March 1991\n */\n\n/* ######################################################################### */\nstatic void\nwriteint(char *outfile, int a)\n{\nint i;\nunsigned char b[4];\n\n\t/* Write integer A one byte at a time to outfile.\n\t *\n\t * This is portable from Vax to Sun since it eliminates the\n\t * need for byte-swapping.\n\t */\n\tfor (i=3; i>=0; i--) {\n\t\tb[i] = a & 0x000000ff;\n\t\ta >>= 8;\n\t}\n\tfor (i=0; i<4; i++) qwrite(outfile, (char *) &b[i],1);\n}\n\n/* ######################################################################### */\nstatic void\nwritelonglong(char *outfile, LONGLONG a)\n{\nint i;\nunsigned char b[8];\n\n\t/* Write integer A one byte at a time to outfile.\n\t *\n\t * This is portable from Vax to Sun since it eliminates the\n\t * need for byte-swapping.\n\t */\n\tfor (i=7; i>=0; i--) {\n\t\tb[i] = (unsigned char) (a & 0x000000ff);\n\t\ta >>= 8;\n\t}\n\tfor (i=0; i<8; i++) qwrite(outfile, (char *) &b[i],1);\n}\n/* ######################################################################### */\nstatic int\nqwrite(char *file, char buffer[], int n){\n    /*\n     * write n bytes from buffer into file\n     * returns number of bytes read (=n) if successful, <=0 if not\n     */\n\n     if (noutchar + n > noutmax) return(0);  /* buffer overflow */\n     \n     memcpy(&file[noutchar], buffer, n);\n     noutchar += n;\n\n     return(n);\n}\n/* ######################################################################### */\n/* ######################################################################### */\n/* Copyright (c) 1993 Association of Universities for Research \n * in Astronomy. All rights reserved. Produced under National   \n * Aeronautics and Space Administration Contract No. NAS5-26555.\n */\n/* doencode.c\tEncode 2-D array and write stream of characters on outfile\n *\n * This version assumes that A is positive.\n *\n * Programmer: R. White\t\tDate: 7 May 1991\n */\n\n/* ######################################################################### */\nstatic int\ndoencode(char *outfile, int a[], int nx, int ny, unsigned char nbitplanes[3])\n{\n/* char *outfile;\t\t\t\t\t\t output data stream\nint a[];\t\t\t\t\t\t\t Array of values to encode\t\t\t\nint nx,ny;\t\t\t\t\t\t\t Array dimensions [nx][ny]\t\t\t\nunsigned char nbitplanes[3];\t\t Number of bit planes in quadrants\t\n*/\n\nint nx2, ny2, stat;\n\n\tnx2 = (nx+1)/2;\n\tny2 = (ny+1)/2;\n\t/*\n\t * Initialize bit output\n\t */\n\tstart_outputing_bits();\n\t/*\n\t * write out the bit planes for each quadrant\n\t */\n\tstat = qtree_encode(outfile, &a[0],          ny, nx2,  ny2,  nbitplanes[0]);\n\n        if (!stat)\n\t\tstat = qtree_encode(outfile, &a[ny2],        ny, nx2,  ny/2, nbitplanes[1]);\n\n        if (!stat)\n\t\tstat = qtree_encode(outfile, &a[ny*nx2],     ny, nx/2, ny2,  nbitplanes[1]);\n\n        if (!stat)\n\t\tstat = qtree_encode(outfile, &a[ny*nx2+ny2], ny, nx/2, ny/2, nbitplanes[2]);\n\t/*\n\t * Add zero as an EOF symbol\n\t */\n\toutput_nybble(outfile, 0);\n\tdone_outputing_bits(outfile);\n\t\n\treturn(stat);\n}\n/* ######################################################################### */\nstatic int\ndoencode64(char *outfile, LONGLONG a[], int nx, int ny, unsigned char nbitplanes[3])\n{\n/* char *outfile;\t\t\t\t\t\t output data stream\nLONGLONG a[];\t\t\t\t\t\t\t Array of values to encode\t\t\t\nint nx,ny;\t\t\t\t\t\t\t Array dimensions [nx][ny]\t\t\t\nunsigned char nbitplanes[3];\t\t Number of bit planes in quadrants\t\n*/\n\nint nx2, ny2, stat;\n\n\tnx2 = (nx+1)/2;\n\tny2 = (ny+1)/2;\n\t/*\n\t * Initialize bit output\n\t */\n\tstart_outputing_bits();\n\t/*\n\t * write out the bit planes for each quadrant\n\t */\n\tstat = qtree_encode64(outfile, &a[0],          ny, nx2,  ny2,  nbitplanes[0]);\n\n        if (!stat)\n\t\tstat = qtree_encode64(outfile, &a[ny2],        ny, nx2,  ny/2, nbitplanes[1]);\n\n        if (!stat)\n\t\tstat = qtree_encode64(outfile, &a[ny*nx2],     ny, nx/2, ny2,  nbitplanes[1]);\n\n        if (!stat)\n\t\tstat = qtree_encode64(outfile, &a[ny*nx2+ny2], ny, nx/2, ny/2, nbitplanes[2]);\n\t/*\n\t * Add zero as an EOF symbol\n\t */\n\toutput_nybble(outfile, 0);\n\tdone_outputing_bits(outfile);\n\t\n\treturn(stat);\n}\n/* ######################################################################### */\n/* ######################################################################### */\n/* Copyright (c) 1993 Association of Universities for Research \n * in Astronomy. All rights reserved. Produced under National   \n * Aeronautics and Space Administration Contract No. NAS5-26555.\n */\n/* BIT OUTPUT ROUTINES */\n\n\nstatic LONGLONG bitcount;\n\n/* THE BIT BUFFER */\n\nstatic int buffer2;\t\t\t/* Bits buffered for output\t*/\nstatic int bits_to_go2;\t\t\t/* Number of bits free in buffer */\n\n\n/* ######################################################################### */\n/* INITIALIZE FOR BIT OUTPUT */\n\nstatic void\nstart_outputing_bits(void)\n{\n\tbuffer2 = 0;\t\t\t/* Buffer is empty to start\t*/\n\tbits_to_go2 = 8;\t\t/* with\t\t\t\t*/\n\tbitcount = 0;\n}\n\n/* ######################################################################### */\n/* OUTPUT N BITS (N must be <= 8) */\n\nstatic void\noutput_nbits(char *outfile, int bits, int n)\n{\n    /* AND mask for the right-most n bits */\n    static int mask[9] = {0, 1, 3, 7, 15, 31, 63, 127, 255};\n\t/*\n\t * insert bits at end of buffer\n\t */\n\tbuffer2 <<= n;\n/*\tbuffer2 |= ( bits & ((1<<n)-1) ); */\n\tbuffer2 |= ( bits & (*(mask+n)) );\n\tbits_to_go2 -= n;\n\tif (bits_to_go2 <= 0) {\n\t\t/*\n\t\t * buffer2 full, put out top 8 bits\n\t\t */\n\n\t        outfile[noutchar] = ((buffer2>>(-bits_to_go2)) & 0xff);\n\n\t\tif (noutchar < noutmax) noutchar++;\n\t\t\n\t\tbits_to_go2 += 8;\n\t}\n\tbitcount += n;\n}\n/* ######################################################################### */\n/*  OUTPUT a 4 bit nybble */\nstatic void\noutput_nybble(char *outfile, int bits)\n{\n\t/*\n\t * insert 4 bits at end of buffer\n\t */\n\tbuffer2 = (buffer2<<4) | ( bits & 15 );\n\tbits_to_go2 -= 4;\n\tif (bits_to_go2 <= 0) {\n\t\t/*\n\t\t * buffer2 full, put out top 8 bits\n\t\t */\n\n\t        outfile[noutchar] = ((buffer2>>(-bits_to_go2)) & 0xff);\n\n\t\tif (noutchar < noutmax) noutchar++;\n\t\t\n\t\tbits_to_go2 += 8;\n\t}\n\tbitcount += 4;\n}\n/*  ############################################################################  */\n/* OUTPUT array of 4 BITS  */\n\nstatic void output_nnybble(char *outfile, int n, unsigned char array[])\n{\n\t/* pack the 4 lower bits in each element of the array into the outfile array */\n\nint ii, jj, kk = 0, shift;\n\n\tif (n == 1) {\n\t\toutput_nybble(outfile, (int) array[0]);\n\t\treturn;\n\t}\n/* forcing byte alignment doesn;t help, and even makes it go slightly slower\nif (bits_to_go2 != 8)\n   output_nbits(outfile, kk, bits_to_go2);\n*/\n\tif (bits_to_go2 <= 4)\n\t{\n\t\t/* just room for 1 nybble; write it out separately */\n\t\toutput_nybble(outfile, array[0]);\n\t\tkk++;  /* index to next array element */\n\n\t\tif (n == 2)  /* only 1 more nybble to write out */\n\t\t{\n\t\t\toutput_nybble(outfile, (int) array[1]);\n\t\t\treturn;\n\t\t}\n\t}\n\n\n        /* bits_to_go2 is now in the range 5 - 8 */\n\tshift = 8 - bits_to_go2;  \n\n\t/* now write out pairs of nybbles; this does not affect value of bits_to_go2 */\n\tjj = (n - kk) / 2;\n\t\n\tif (bits_to_go2 == 8) {\n\t    /* special case if nybbles are aligned on byte boundary */\n\t    /* this actually seems to make very little differnece in speed */\n\t    buffer2 = 0;\n\t    for (ii = 0; ii < jj; ii++)\n\t    {\n\t\toutfile[noutchar] = ((array[kk] & 15)<<4) | (array[kk+1] & 15);\n\t\tkk += 2;\n\t\tnoutchar++;\n\t    }\n\t} else {\n\t    for (ii = 0; ii < jj; ii++)\n\t    {\n\t\tbuffer2 = (buffer2<<8) | ((array[kk] & 15)<<4) | (array[kk+1] & 15);\n\t\tkk += 2;\n\n\t\t/*\n\t\t buffer2 full, put out top 8 bits\n\t\t */\n\n\t        outfile[noutchar] = ((buffer2>>shift) & 0xff);\n\t\tnoutchar++;\n\t    }\n\t}\n\n\tbitcount += (8 * (ii - 1));\n\n\t/* write out last odd nybble, if present */\n\tif (kk != n) output_nybble(outfile, (int) array[n - 1]); \n\n\treturn; \n}\n\n\n/* ######################################################################### */\n/* FLUSH OUT THE LAST BITS */\n\nstatic void\ndone_outputing_bits(char *outfile)\n{\n\tif(bits_to_go2 < 8) {\n/*\t\tputc(buffer2<<bits_to_go2,outfile); */\n\n\t        outfile[noutchar] = (buffer2<<bits_to_go2);\n\t\tif (noutchar < noutmax) noutchar++;\n\n\t\t/* count the garbage bits too */\n\t\tbitcount += bits_to_go2;\n\t}\n}\n/* ######################################################################### */\n/* ######################################################################### */\n/* Copyright (c) 1993 Association of Universities for Research \n * in Astronomy. All rights reserved. Produced under National   \n * Aeronautics and Space Administration Contract No. NAS5-26555.\n */\n/* qtree_encode.c\tEncode values in quadrant of 2-D array using binary\n *\t\t\t\t\tquadtree coding for each bit plane.  Assumes array is\n *\t\t\t\t\tpositive.\n *\n * Programmer: R. White\t\tDate: 15 May 1991\n */\n\n/*\n * Huffman code values and number of bits in each code\n */\nstatic int code[16] =\n\t{\n\t0x3e, 0x00, 0x01, 0x08, 0x02, 0x09, 0x1a, 0x1b,\n\t0x03, 0x1c, 0x0a, 0x1d, 0x0b, 0x1e, 0x3f, 0x0c\n\t};\nstatic int ncode[16] =\n\t{\n\t6,    3,    3,    4,    3,    4,    5,    5,\n\t3,    5,    4,    5,    4,    5,    6,    4\n\t};\n\n/*\n * variables for bit output to buffer when Huffman coding\n */\nstatic int bitbuffer, bits_to_go3;\n\n/*\n * macros to write out 4-bit nybble, Huffman code for this value\n */\n\n\n/* ######################################################################### */\nstatic int\nqtree_encode(char *outfile, int a[], int n, int nqx, int nqy, int nbitplanes)\n{\n\n/*\nint a[];\nint n;\t\t\t\t\t\t\t\t physical dimension of row in a\t\t\nint nqx;\t\t\t\t\t\t\t length of row\t\t\t\nint nqy;\t\t\t\t\t\t\t length of column (<=n)\t\t\t\t\nint nbitplanes;\t\t\t\t\t\t number of bit planes to output\t\n*/\n\t\nint log2n, i, k, bit, b, bmax, nqmax, nqx2, nqy2, nx, ny;\nunsigned char *scratch, *buffer;\n\n\t/*\n\t * log2n is log2 of max(nqx,nqy) rounded up to next power of 2\n\t */\n\tnqmax = (nqx>nqy) ? nqx : nqy;\n\tlog2n = (int) (log((float) nqmax)/log(2.0)+0.5);\n\tif (nqmax > (1<<log2n)) {\n\t\tlog2n += 1;\n\t}\n\t/*\n\t * initialize buffer point, max buffer size\n\t */\n\tnqx2 = (nqx+1)/2;\n\tnqy2 = (nqy+1)/2;\n\tbmax = (nqx2*nqy2+1)/2;\n\t/*\n\t * We're indexing A as a 2-D array with dimensions (nqx,nqy).\n\t * Scratch is 2-D with dimensions (nqx/2,nqy/2) rounded up.\n\t * Buffer is used to store string of codes for output.\n\t */\n\tscratch = (unsigned char *) malloc(2*bmax);\n\tbuffer = (unsigned char *) malloc(bmax);\n\tif ((scratch == (unsigned char *) NULL) ||\n\t\t(buffer  == (unsigned char *) NULL)) {\t\t\n\t\tffpmsg(\"qtree_encode: insufficient memory\");\n\t\treturn(DATA_COMPRESSION_ERR);\n\t}\n\t/*\n\t * now encode each bit plane, starting with the top\n\t */\n\tfor (bit=nbitplanes-1; bit >= 0; bit--) {\n\t\t/*\n\t\t * initial bit buffer\n\t\t */\n\t\tb = 0;\n\t\tbitbuffer = 0;\n\t\tbits_to_go3 = 0;\n\t\t/*\n\t\t * on first pass copy A to scratch array\n\t\t */\n\t\tqtree_onebit(a,n,nqx,nqy,scratch,bit);\n\t\tnx = (nqx+1)>>1;\n\t\tny = (nqy+1)>>1;\n\t\t/*\n\t\t * copy non-zero values to output buffer, which will be written\n\t\t * in reverse order\n\t\t */\n\t\tif (bufcopy(scratch,nx*ny,buffer,&b,bmax)) {\n\t\t\t/*\n\t\t\t * quadtree is expanding data,\n\t\t\t * change warning code and just fill buffer with bit-map\n\t\t\t */\n\t\t\twrite_bdirect(outfile,a,n,nqx,nqy,scratch,bit);\n\t\t\tgoto bitplane_done;\n\t\t}\n\t\t/*\n\t\t * do log2n reductions\n\t\t */\n\t\tfor (k = 1; k<log2n; k++) {\n\t\t\tqtree_reduce(scratch,ny,nx,ny,scratch);\n\t\t\tnx = (nx+1)>>1;\n\t\t\tny = (ny+1)>>1;\n\t\t\tif (bufcopy(scratch,nx*ny,buffer,&b,bmax)) {\n\t\t\t\twrite_bdirect(outfile,a,n,nqx,nqy,scratch,bit);\n\t\t\t\tgoto bitplane_done;\n\t\t\t}\n\t\t}\n\t\t/*\n\t\t * OK, we've got the code in buffer\n\t\t * Write quadtree warning code, then write buffer in reverse order\n\t\t */\n\t\toutput_nybble(outfile,0xF);\n\t\tif (b==0) {\n\t\t\tif (bits_to_go3>0) {\n\t\t\t\t/*\n\t\t\t\t * put out the last few bits\n\t\t\t\t */\n\t\t\t\toutput_nbits(outfile, bitbuffer & ((1<<bits_to_go3)-1),\n\t\t\t\t\tbits_to_go3);\n\t\t\t} else {\n\t\t\t\t/*\n\t\t\t\t * have to write a zero nybble if there are no 1's in array\n\t\t\t\t */\n\t\t\t\toutput_huffman(outfile,0);\n\t\t\t}\n\t\t} else {\n\t\t\tif (bits_to_go3>0) {\n\t\t\t\t/*\n\t\t\t\t * put out the last few bits\n\t\t\t\t */\n\t\t\t\toutput_nbits(outfile, bitbuffer & ((1<<bits_to_go3)-1),\n\t\t\t\t\tbits_to_go3);\n\t\t\t}\n\t\t\tfor (i=b-1; i>=0; i--) {\n\t\t\t\toutput_nbits(outfile,buffer[i],8);\n\t\t\t}\n\t\t}\n\t\tbitplane_done: ;\n\t}\n\tfree(buffer);\n\tfree(scratch);\n\treturn(0);\n}\n/* ######################################################################### */\nstatic int\nqtree_encode64(char *outfile, LONGLONG a[], int n, int nqx, int nqy, int nbitplanes)\n{\n\n/*\nLONGLONG a[];\nint n;\t\t\t\t\t\t\t\t physical dimension of row in a\t\t\nint nqx;\t\t\t\t\t\t\t length of row\t\t\t\nint nqy;\t\t\t\t\t\t\t length of column (<=n)\t\t\t\t\nint nbitplanes;\t\t\t\t\t\t number of bit planes to output\t\n*/\n\t\nint log2n, i, k, bit, b, nqmax, nqx2, nqy2, nx, ny;\nint bmax;  /* this potentially needs to be made a 64-bit int to support large arrays */\nunsigned char *scratch, *buffer;\n\n\t/*\n\t * log2n is log2 of max(nqx,nqy) rounded up to next power of 2\n\t */\n\tnqmax = (nqx>nqy) ? nqx : nqy;\n\tlog2n = (int) (log((float) nqmax)/log(2.0)+0.5);\n\tif (nqmax > (1<<log2n)) {\n\t\tlog2n += 1;\n\t}\n\t/*\n\t * initialize buffer point, max buffer size\n\t */\n\tnqx2 = (nqx+1)/2;\n\tnqy2 = (nqy+1)/2;\n\tbmax = (( nqx2)* ( nqy2)+1)/2;\n\t/*\n\t * We're indexing A as a 2-D array with dimensions (nqx,nqy).\n\t * Scratch is 2-D with dimensions (nqx/2,nqy/2) rounded up.\n\t * Buffer is used to store string of codes for output.\n\t */\n\tscratch = (unsigned char *) malloc(2*bmax);\n\tbuffer = (unsigned char *) malloc(bmax);\n\tif ((scratch == (unsigned char *) NULL) ||\n\t\t(buffer  == (unsigned char *) NULL)) {\n\t\tffpmsg(\"qtree_encode64: insufficient memory\");\n\t\treturn(DATA_COMPRESSION_ERR);\n\t}\n\t/*\n\t * now encode each bit plane, starting with the top\n\t */\n\tfor (bit=nbitplanes-1; bit >= 0; bit--) {\n\t\t/*\n\t\t * initial bit buffer\n\t\t */\n\t\tb = 0;\n\t\tbitbuffer = 0;\n\t\tbits_to_go3 = 0;\n\t\t/*\n\t\t * on first pass copy A to scratch array\n\t\t */\n\t\tqtree_onebit64(a,n,nqx,nqy,scratch,bit);\n\t\tnx = (nqx+1)>>1;\n\t\tny = (nqy+1)>>1;\n\t\t/*\n\t\t * copy non-zero values to output buffer, which will be written\n\t\t * in reverse order\n\t\t */\n\t\tif (bufcopy(scratch,nx*ny,buffer,&b,bmax)) {\n\t\t\t/*\n\t\t\t * quadtree is expanding data,\n\t\t\t * change warning code and just fill buffer with bit-map\n\t\t\t */\n\t\t\twrite_bdirect64(outfile,a,n,nqx,nqy,scratch,bit);\n\t\t\tgoto bitplane_done;\n\t\t}\n\t\t/*\n\t\t * do log2n reductions\n\t\t */\n\t\tfor (k = 1; k<log2n; k++) {\n\t\t\tqtree_reduce(scratch,ny,nx,ny,scratch);\n\t\t\tnx = (nx+1)>>1;\n\t\t\tny = (ny+1)>>1;\n\t\t\tif (bufcopy(scratch,nx*ny,buffer,&b,bmax)) {\n\t\t\t\twrite_bdirect64(outfile,a,n,nqx,nqy,scratch,bit);\n\t\t\t\tgoto bitplane_done;\n\t\t\t}\n\t\t}\n\t\t/*\n\t\t * OK, we've got the code in buffer\n\t\t * Write quadtree warning code, then write buffer in reverse order\n\t\t */\n\t\toutput_nybble(outfile,0xF);\n\t\tif (b==0) {\n\t\t\tif (bits_to_go3>0) {\n\t\t\t\t/*\n\t\t\t\t * put out the last few bits\n\t\t\t\t */\n\t\t\t\toutput_nbits(outfile, bitbuffer & ((1<<bits_to_go3)-1),\n\t\t\t\t\tbits_to_go3);\n\t\t\t} else {\n\t\t\t\t/*\n\t\t\t\t * have to write a zero nybble if there are no 1's in array\n\t\t\t\t */\n\t\t\t\toutput_huffman(outfile,0);\n\t\t\t}\n\t\t} else {\n\t\t\tif (bits_to_go3>0) {\n\t\t\t\t/*\n\t\t\t\t * put out the last few bits\n\t\t\t\t */\n\t\t\t\toutput_nbits(outfile, bitbuffer & ((1<<bits_to_go3)-1),\n\t\t\t\t\tbits_to_go3);\n\t\t\t}\n\t\t\tfor (i=b-1; i>=0; i--) {\n\t\t\t\toutput_nbits(outfile,buffer[i],8);\n\t\t\t}\n\t\t}\n\t\tbitplane_done: ;\n\t}\n\tfree(buffer);\n\tfree(scratch);\n\treturn(0);\n}\n\n/* ######################################################################### */\n/*\n * copy non-zero codes from array to buffer\n */\nstatic int\nbufcopy(unsigned char a[], int n, unsigned char buffer[], int *b, int bmax)\n{\nint i;\n\n\tfor (i = 0; i < n; i++) {\n\t\tif (a[i] != 0) {\n\t\t\t/*\n\t\t\t * add Huffman code for a[i] to buffer\n\t\t\t */\n\t\t\tbitbuffer |= code[a[i]] << bits_to_go3;\n\t\t\tbits_to_go3 += ncode[a[i]];\n\t\t\tif (bits_to_go3 >= 8) {\n\t\t\t\tbuffer[*b] = bitbuffer & 0xFF;\n\t\t\t\t*b += 1;\n\t\t\t\t/*\n\t\t\t\t * return warning code if we fill buffer\n\t\t\t\t */\n\t\t\t\tif (*b >= bmax) return(1);\n\t\t\t\tbitbuffer >>= 8;\n\t\t\t\tbits_to_go3 -= 8;\n\t\t\t}\n\t\t}\n\t}\n\treturn(0);\n}\n\n/* ######################################################################### */\n/*\n * Do first quadtree reduction step on bit BIT of array A.\n * Results put into B.\n * \n */\nstatic void\nqtree_onebit(int a[], int n, int nx, int ny, unsigned char b[], int bit)\n{\nint i, j, k;\nint b0, b1, b2, b3;\nint s10, s00;\n\n\t/*\n\t * use selected bit to get amount to shift\n\t */\n\tb0 = 1<<bit;\n\tb1 = b0<<1;\n\tb2 = b0<<2;\n\tb3 = b0<<3;\n\tk = 0;\t\t\t\t\t\t\t/* k is index of b[i/2,j/2]\t*/\n\tfor (i = 0; i<nx-1; i += 2) {\n\t\ts00 = n*i;\t\t\t\t\t/* s00 is index of a[i,j]\t*/\n/* tried using s00+n directly in the statements, but this had no effect on performance */\n\t\ts10 = s00+n;\t\t\t\t/* s10 is index of a[i+1,j]\t*/\n\t\tfor (j = 0; j<ny-1; j += 2) {\n\n/*\n this was not any faster..\n \n         b[k] = (a[s00]  & b0) ? \n\t            (a[s00+1] & b0) ?\n\t                (a[s10] & b0)   ?\n\t\t            (a[s10+1] & b0) ? 15 : 14\n                         :  (a[s10+1] & b0) ? 13 : 12\n\t\t      : (a[s10] & b0)   ?\n\t\t            (a[s10+1] & b0) ? 11 : 10\n                         :  (a[s10+1] & b0) ?  9 :  8\n\t          : (a[s00+1] & b0) ?\n\t                (a[s10] & b0)   ?\n\t\t            (a[s10+1] & b0) ? 7 : 6\n                         :  (a[s10+1] & b0) ? 5 : 4\n\n\t\t      : (a[s10] & b0)   ?\n\t\t            (a[s10+1] & b0) ? 3 : 2\n                         :  (a[s10+1] & b0) ? 1 : 0;\n*/\n\n/*\nthis alternative way of calculating b[k] was slowwer than the original code\n\t\t    if ( a[s00]     & b0)\n\t\t\tif ( a[s00+1]     & b0)\n\t\t\t    if ( a[s10]     & b0)\n\t\t\t\tif ( a[s10+1]     & b0)\n\t\t\t\t\tb[k] = 15;\n\t\t\t\telse\n\t\t\t\t\tb[k] = 14;\n\t\t\t    else\n\t\t\t\tif ( a[s10+1]     & b0)\n\t\t\t\t\tb[k] = 13;\n\t\t\t\telse\n\t\t\t\t\tb[k] = 12;\n\t\t\telse\n\t\t\t    if ( a[s10]     & b0)\n\t\t\t\tif ( a[s10+1]     & b0)\n\t\t\t\t\tb[k] = 11;\n\t\t\t\telse\n\t\t\t\t\tb[k] = 10;\n\t\t\t    else\n\t\t\t\tif ( a[s10+1]     & b0)\n\t\t\t\t\tb[k] = 9;\n\t\t\t\telse\n\t\t\t\t\tb[k] = 8;\n\t\t    else\n\t\t\tif ( a[s00+1]     & b0)\n\t\t\t    if ( a[s10]     & b0)\n\t\t\t\tif ( a[s10+1]     & b0)\n\t\t\t\t\tb[k] = 7;\n\t\t\t\telse\n\t\t\t\t\tb[k] = 6;\n\t\t\t    else\n\t\t\t\tif ( a[s10+1]     & b0)\n\t\t\t\t\tb[k] = 5;\n\t\t\t\telse\n\t\t\t\t\tb[k] = 4;\n\t\t\telse\n\t\t\t    if ( a[s10]     & b0)\n\t\t\t\tif ( a[s10+1]     & b0)\n\t\t\t\t\tb[k] = 3;\n\t\t\t\telse\n\t\t\t\t\tb[k] = 2;\n\t\t\t    else\n\t\t\t\tif ( a[s10+1]     & b0)\n\t\t\t\t\tb[k] = 1;\n\t\t\t\telse\n\t\t\t\t\tb[k] = 0;\n*/\n\t\t\t\n\n\n\t\t\tb[k] = ( ( a[s10+1]     & b0)\n\t\t\t\t   | ((a[s10  ]<<1) & b1)\n\t\t\t\t   | ((a[s00+1]<<2) & b2)\n\t\t\t\t   | ((a[s00  ]<<3) & b3) ) >> bit;\n\n\t\t\tk += 1;\n\t\t\ts00 += 2;\n\t\t\ts10 += 2;\n\t\t}\n\t\tif (j < ny) {\n\t\t\t/*\n\t\t\t * row size is odd, do last element in row\n\t\t\t * s00+1,s10+1 are off edge\n\t\t\t */\n\t\t\tb[k] = ( ((a[s10  ]<<1) & b1)\n\t\t\t\t   | ((a[s00  ]<<3) & b3) ) >> bit;\n\t\t\tk += 1;\n\t\t}\n\t}\n\tif (i < nx) {\n\t\t/*\n\t\t * column size is odd, do last row\n\t\t * s10,s10+1 are off edge\n\t\t */\n\t\ts00 = n*i;\n\t\tfor (j = 0; j<ny-1; j += 2) {\n\t\t\tb[k] = ( ((a[s00+1]<<2) & b2)\n\t\t\t\t   | ((a[s00  ]<<3) & b3) ) >> bit;\n\t\t\tk += 1;\n\t\t\ts00 += 2;\n\t\t}\n\t\tif (j < ny) {\n\t\t\t/*\n\t\t\t * both row and column size are odd, do corner element\n\t\t\t * s00+1, s10, s10+1 are off edge\n\t\t\t */\n\t\t\tb[k] = ( ((a[s00  ]<<3) & b3) ) >> bit;\n\t\t\tk += 1;\n\t\t}\n\t}\n}\n/* ######################################################################### */\n/*\n * Do first quadtree reduction step on bit BIT of array A.\n * Results put into B.\n * \n */\nstatic void\nqtree_onebit64(LONGLONG a[], int n, int nx, int ny, unsigned char b[], int bit)\n{\nint i, j, k;\nLONGLONG b0, b1, b2, b3;\nint s10, s00;\n\n\t/*\n\t * use selected bit to get amount to shift\n\t */\n\tb0 = ((LONGLONG) 1)<<bit;\n\tb1 = b0<<1;\n\tb2 = b0<<2;\n\tb3 = b0<<3;\n\tk = 0;\t\t\t\t\t\t\t/* k is index of b[i/2,j/2]\t*/\n\tfor (i = 0; i<nx-1; i += 2) {\n\t\ts00 = n*i;\t\t\t\t\t/* s00 is index of a[i,j]\t*/\n\t\ts10 = s00+n;\t\t\t\t/* s10 is index of a[i+1,j]\t*/\n\t\tfor (j = 0; j<ny-1; j += 2) {\n\t\t\tb[k] = (unsigned char) (( ( a[s10+1]     & b0)\n\t\t\t\t   | ((a[s10  ]<<1) & b1)\n\t\t\t\t   | ((a[s00+1]<<2) & b2)\n\t\t\t\t   | ((a[s00  ]<<3) & b3) ) >> bit);\n\t\t\tk += 1;\n\t\t\ts00 += 2;\n\t\t\ts10 += 2;\n\t\t}\n\t\tif (j < ny) {\n\t\t\t/*\n\t\t\t * row size is odd, do last element in row\n\t\t\t * s00+1,s10+1 are off edge\n\t\t\t */\n\t\t\tb[k] = (unsigned char) (( ((a[s10  ]<<1) & b1)\n\t\t\t\t   | ((a[s00  ]<<3) & b3) ) >> bit);\n\t\t\tk += 1;\n\t\t}\n\t}\n\tif (i < nx) {\n\t\t/*\n\t\t * column size is odd, do last row\n\t\t * s10,s10+1 are off edge\n\t\t */\n\t\ts00 = n*i;\n\t\tfor (j = 0; j<ny-1; j += 2) {\n\t\t\tb[k] = (unsigned char) (( ((a[s00+1]<<2) & b2)\n\t\t\t\t   | ((a[s00  ]<<3) & b3) ) >> bit);\n\t\t\tk += 1;\n\t\t\ts00 += 2;\n\t\t}\n\t\tif (j < ny) {\n\t\t\t/*\n\t\t\t * both row and column size are odd, do corner element\n\t\t\t * s00+1, s10, s10+1 are off edge\n\t\t\t */\n\t\t\tb[k] = (unsigned char) (( ((a[s00  ]<<3) & b3) ) >> bit);\n\t\t\tk += 1;\n\t\t}\n\t}\n}\n\n/* ######################################################################### */\n/*\n * do one quadtree reduction step on array a\n * results put into b (which may be the same as a)\n */\nstatic void\nqtree_reduce(unsigned char a[], int n, int nx, int ny, unsigned char b[])\n{\nint i, j, k;\nint s10, s00;\n\n\tk = 0;\t\t\t\t\t\t\t/* k is index of b[i/2,j/2]\t*/\n\tfor (i = 0; i<nx-1; i += 2) {\n\t\ts00 = n*i;\t\t\t\t\t/* s00 is index of a[i,j]\t*/\n\t\ts10 = s00+n;\t\t\t\t/* s10 is index of a[i+1,j]\t*/\n\t\tfor (j = 0; j<ny-1; j += 2) {\n\t\t\tb[k] =\t(a[s10+1] != 0)\n\t\t\t\t| ( (a[s10  ] != 0) << 1)\n\t\t\t\t| ( (a[s00+1] != 0) << 2)\n\t\t\t\t| ( (a[s00  ] != 0) << 3);\n\t\t\tk += 1;\n\t\t\ts00 += 2;\n\t\t\ts10 += 2;\n\t\t}\n\t\tif (j < ny) {\n\t\t\t/*\n\t\t\t * row size is odd, do last element in row\n\t\t\t * s00+1,s10+1 are off edge\n\t\t\t */\n\t\t\tb[k] =  ( (a[s10  ] != 0) << 1)\n\t\t\t\t  | ( (a[s00  ] != 0) << 3);\n\t\t\tk += 1;\n\t\t}\n\t}\n\tif (i < nx) {\n\t\t/*\n\t\t * column size is odd, do last row\n\t\t * s10,s10+1 are off edge\n\t\t */\n\t\ts00 = n*i;\n\t\tfor (j = 0; j<ny-1; j += 2) {\n\t\t\tb[k] =  ( (a[s00+1] != 0) << 2)\n\t\t\t\t  | ( (a[s00  ] != 0) << 3);\n\t\t\tk += 1;\n\t\t\ts00 += 2;\n\t\t}\n\t\tif (j < ny) {\n\t\t\t/*\n\t\t\t * both row and column size are odd, do corner element\n\t\t\t * s00+1, s10, s10+1 are off edge\n\t\t\t */\n\t\t\tb[k] = ( (a[s00  ] != 0) << 3);\n\t\t\tk += 1;\n\t\t}\n\t}\n}\n\n/* ######################################################################### */\nstatic void\nwrite_bdirect(char *outfile, int a[], int n,int nqx, int nqy, unsigned char scratch[], int bit)\n{\n\n\t/*\n\t * Write the direct bitmap warning code\n\t */\n\toutput_nybble(outfile,0x0);\n\t/*\n\t * Copy A to scratch array (again!), packing 4 bits/nybble\n\t */\n\tqtree_onebit(a,n,nqx,nqy,scratch,bit);\n\t/*\n\t * write to outfile\n\t */\n/*\nint i;\n\tfor (i = 0; i < ((nqx+1)/2) * ((nqy+1)/2); i++) {\n\t\toutput_nybble(outfile,scratch[i]);\n\t}\n*/\n\toutput_nnybble(outfile, ((nqx+1)/2) * ((nqy+1)/2), scratch);\n\n}\n/* ######################################################################### */\nstatic void\nwrite_bdirect64(char *outfile, LONGLONG a[], int n,int nqx, int nqy, unsigned char scratch[], int bit)\n{\n\n\t/*\n\t * Write the direct bitmap warning code\n\t */\n\toutput_nybble(outfile,0x0);\n\t/*\n\t * Copy A to scratch array (again!), packing 4 bits/nybble\n\t */\n\tqtree_onebit64(a,n,nqx,nqy,scratch,bit);\n\t/*\n\t * write to outfile\n\t */\n/*\nint i;\n\tfor (i = 0; i < ((nqx+1)/2) * ((nqy+1)/2); i++) {\n\t\toutput_nybble(outfile,scratch[i]);\n\t}\n*/\n\toutput_nnybble(outfile, ((nqx+1)/2) * ((nqy+1)/2), scratch);\n}\n"},{"id":16678,"name":"grparser.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*\t\tT E M P L A T E   P A R S E R\n\t\t=============================\n\n\t\tby Jerzy.Borkowski@obs.unige.ch\n\n\t\tIntegral Science Data Center\n\t\tch. d'Ecogia 16\n\t\t1290 Versoix\n\t\tSwitzerland\n\n14-Oct-98: initial release\n16-Oct-98: code cleanup, #include <string.h> included, now gcc -Wall prints no\n\t\twarnings during compilation. Bugfix: now one can specify additional\n\t\tcolumns in group HDU. Autoindexing also works in this situation\n\t\t(colunms are number from 7 however).\n17-Oct-98: bugfix: complex keywords were incorrectly written (was TCOMPLEX should\n\t\tbe TDBLCOMPLEX).\n20-Oct-98: bugfix: parser was writing EXTNAME twice, when first HDU in template is\n\t\tdefined with XTENSION IMAGE then parser creates now dummy PHDU,\n\t\tSIMPLE T is now allowed only at most once and in first HDU only.\n\t\tWARNING: one should not define EXTNAME keyword for GROUP HDUs, as\n\t\tthey have them already defined by parser (EXTNAME = GROUPING).\n\t\tParser accepts EXTNAME oin GROUP HDU definition, but in this\n\t\tcase multiple EXTNAME keywords will present in HDU header.\n23-Oct-98: bugfix: unnecessary space was written to FITS file for blank\n\t\tkeywords.\n24-Oct-98: syntax change: empty lines and lines with only whitespaces are \n\t\twritten to FITS files as blank keywords (if inside group/hdu\n\t\tdefinition). Previously lines had to have at least 8 spaces.\n\t\tPlease note, that due to pecularities of CFITSIO if the\n\t\tlast keyword(s) defined for given HDU are blank keywords\n\t\tconsisting of only 80 spaces, then (some of) those keywords\n\t\tmay be silently deleted by CFITSIO.\n13-Nov-98: bugfix: parser was writing GRPNAME twice. Parser still creates\n                GRPNAME keywords for GROUP HDU's which do not specify them.\n                However, values (of form DEFAULT_GROUP_XXX) are assigned\n                not necessarily in order HDUs appear in template file, but\n                rather in order parser completes their creation in FITS\n                file. Also, when including files, if fopen fails, parser\n                tries to open file with a name = directory_of_top_level\n                file + name of file to be included, as long as name\n                of file to be included does not specify absolute pathname.\n16-Nov-98: bugfix to bugfix from 13-Nov-98\n19-Nov-98: EXTVER keyword is now automatically assigned value by parser.\n17-Dev-98: 2 new things added: 1st: CFITSIO_INCLUDE_FILES environment\n\t\tvariable can contain a colon separated list of directories\n\t\tto look for when looking for template include files (and master\n\t\ttemplate also). 2nd: it is now possible to append template\n\t\tto nonempty FITS. file. fitsfile *ff no longer needs to point\n\t\tto an empty FITS file with 0 HDUs in it. All data written by\n\t\tparser will simple be appended at the end of file.\n22-Jan-99: changes to parser: when in append mode parser initially scans all\n\t\texisting HDUs to built a list of already used EXTNAME/EXTVERs\n22-Jan-99: Bruce O'Neel, bugfix : TLONG should always reference long type\n\t\tvariable on OSF/Alpha and on 64-bit archs in general\n20-Jun-2002 Wm Pence, added support for the HIERARCH keyword convention in\n                which keyword names can effectively be longer than 8 characters.\n                Example:\n                HIERARCH  LongKeywordName = 'value' / comment\n30-Jan-2003 Wm Pence, bugfix: ngp_read_xtension was testing for \"ASCIITABLE\" \n                instead of \"TABLE\" as the XTENSION value of an ASCII table,\n                and it did not allow for optional trailing spaces in the\n                \"IMAGE\" or \"TABLE\" string. \n16-Dec-2003 James Peachey: ngp_keyword_all_write was modified to apply\n                comments from the template file to the output file in\n                the case of reserved keywords (e.g. tform#, ttype# etcetera).\n*/\n\n\n#include <stdio.h>\n#include <stdlib.h>\n\n#ifdef sparc\n#include <malloc.h>\n#include <memory.h>\n#endif\n\n#include <string.h>\n#include \"fitsio2.h\"\n#include \"grparser.h\"\n\nNGP_RAW_LINE\tngp_curline = { NULL, NULL, NULL, NGP_TTYPE_UNKNOWN, NULL, NGP_FORMAT_OK, 0 };\nNGP_RAW_LINE\tngp_prevline = { NULL, NULL, NULL, NGP_TTYPE_UNKNOWN, NULL, NGP_FORMAT_OK, 0 };\n\nint\t\tngp_inclevel = 0;\t\t/* number of included files, 1 - means mean file */\nint\t\tngp_grplevel = 0;\t\t/* group nesting level, 0 - means no grouping */\n\nFILE\t\t*ngp_fp[NGP_MAX_INCLUDE];\t/* stack of included file handles */\nint\t\tngp_keyidx = NGP_TOKEN_UNKNOWN;\t/* index of token in current line */\nNGP_TOKEN\tngp_linkey;\t\t\t/* keyword after line analyze */\n\nchar            ngp_master_dir[NGP_MAX_FNAME];  /* directory of top level include file */\n\nNGP_TKDEF\tngp_tkdef[] = \t\t\t/* tokens recognized by parser */\n      { {\t\"\\\\INCLUDE\",\tNGP_TOKEN_INCLUDE },\n\t{\t\"\\\\GROUP\",\tNGP_TOKEN_GROUP },\n\t{\t\"\\\\END\",\tNGP_TOKEN_END },\n\t{\t\"XTENSION\",\tNGP_TOKEN_XTENSION },\n\t{\t\"SIMPLE\",\tNGP_TOKEN_SIMPLE },\n\t{\tNULL,\t\tNGP_TOKEN_UNKNOWN }\n      };\n\nint\tmaster_grp_idx = 1;\t\t\t/* current unnamed group in object */\n\nint\t\tngp_extver_tab_size = 0;\nNGP_EXTVER_TAB\t*ngp_extver_tab = NULL;\n\n\nint\tngp_get_extver(char *extname, int *version)\n { NGP_EXTVER_TAB *p;\n   char \t*p2;\n   int\t\ti;\n\n   if ((NULL == extname) || (NULL == version)) return(NGP_BAD_ARG);\n   if ((NULL == ngp_extver_tab) && (ngp_extver_tab_size > 0)) return(NGP_BAD_ARG);\n   if ((NULL != ngp_extver_tab) && (ngp_extver_tab_size <= 0)) return(NGP_BAD_ARG);\n\n   for (i=0; i<ngp_extver_tab_size; i++)\n    { if (0 == strcmp(extname, ngp_extver_tab[i].extname))\n        { *version = (++ngp_extver_tab[i].version);\n          return(NGP_OK);\n        }\n    }\n\n   if (NULL == ngp_extver_tab)\n     { p = (NGP_EXTVER_TAB *)ngp_alloc(sizeof(NGP_EXTVER_TAB)); }\n   else\n     { p = (NGP_EXTVER_TAB *)ngp_realloc(ngp_extver_tab, (ngp_extver_tab_size + 1) * sizeof(NGP_EXTVER_TAB)); }\n\n   if (NULL == p) return(NGP_NO_MEMORY);\n\n   p2 = ngp_alloc(strlen(extname) + 1);\n   if (NULL == p2)\n     { ngp_free(p);\n       return(NGP_NO_MEMORY);\n     }\n\n   strcpy(p2, extname);\n   ngp_extver_tab = p;\n   ngp_extver_tab[ngp_extver_tab_size].extname = p2;\n   *version = ngp_extver_tab[ngp_extver_tab_size].version = 1;\n\n   ngp_extver_tab_size++;\n\n   return(NGP_OK);\n }\n\nint\tngp_set_extver(char *extname, int version)\n { NGP_EXTVER_TAB *p;\n   char \t*p2;\n   int\t\ti;\n\n   if (NULL == extname) return(NGP_BAD_ARG);\n   if ((NULL == ngp_extver_tab) && (ngp_extver_tab_size > 0)) return(NGP_BAD_ARG);\n   if ((NULL != ngp_extver_tab) && (ngp_extver_tab_size <= 0)) return(NGP_BAD_ARG);\n\n   for (i=0; i<ngp_extver_tab_size; i++)\n    { if (0 == strcmp(extname, ngp_extver_tab[i].extname))\n        { if (version > ngp_extver_tab[i].version)  ngp_extver_tab[i].version = version;\n          return(NGP_OK);\n        }\n    }\n\n   if (NULL == ngp_extver_tab)\n     { p = (NGP_EXTVER_TAB *)ngp_alloc(sizeof(NGP_EXTVER_TAB)); }\n   else\n     { p = (NGP_EXTVER_TAB *)ngp_realloc(ngp_extver_tab, (ngp_extver_tab_size + 1) * sizeof(NGP_EXTVER_TAB)); }\n\n   if (NULL == p) return(NGP_NO_MEMORY);\n\n   p2 = ngp_alloc(strlen(extname) + 1);\n   if (NULL == p2)\n     { ngp_free(p);\n       return(NGP_NO_MEMORY);\n     }\n\n   strcpy(p2, extname);\n   ngp_extver_tab = p;\n   ngp_extver_tab[ngp_extver_tab_size].extname = p2;\n   ngp_extver_tab[ngp_extver_tab_size].version = version;\n\n   ngp_extver_tab_size++;\n\n   return(NGP_OK);\n }\n\n\nint\tngp_delete_extver_tab(void)\n { int i;\n\n   if ((NULL == ngp_extver_tab) && (ngp_extver_tab_size > 0)) return(NGP_BAD_ARG);\n   if ((NULL != ngp_extver_tab) && (ngp_extver_tab_size <= 0)) return(NGP_BAD_ARG);\n   if ((NULL == ngp_extver_tab) && (0 == ngp_extver_tab_size)) return(NGP_OK);\n\n   for (i=0; i<ngp_extver_tab_size; i++)\n    { if (NULL != ngp_extver_tab[i].extname)\n        { ngp_free(ngp_extver_tab[i].extname);\n          ngp_extver_tab[i].extname = NULL;\n        }\n      ngp_extver_tab[i].version = 0;\n    }\n   ngp_free(ngp_extver_tab);\n   ngp_extver_tab = NULL;\n   ngp_extver_tab_size = 0;\n   return(NGP_OK);\n }\n\n\t/* read one line from file */\n\nint\tngp_line_from_file(FILE *fp, char **p)\n { int\tc, r, llen, allocsize, alen;\n   char\t*p2;\n\n   if (NULL == fp) return(NGP_NUL_PTR);\t\t/* check for stupid args */\n   if (NULL == p) return(NGP_NUL_PTR);\t\t/* more foolproof checks */\n   \n   r = NGP_OK;\t\t\t\t\t/* initialize stuff, reset err code */\n   llen = 0;\t\t\t\t\t/* 0 characters read so far */\n   *p = (char *)ngp_alloc(1);\t\t\t/* preallocate 1 byte */\n   allocsize = 1;\t\t\t\t/* signal that we have allocated 1 byte */\n   if (NULL == *p) return(NGP_NO_MEMORY);\t/* if this failed, system is in dire straits */\n\n   for (;;)\n    { c = getc(fp);\t\t\t\t/* get next character */\n      if ('\\r' == c) continue;\t\t\t/* carriage return character ?  Just ignore it */\n      if (EOF == c)\t\t\t\t/* EOF signalled ? */\n        { \n          if (ferror(fp)) r = NGP_READ_ERR;\t/* was it real error or simply EOF ? */\n\t  if (0 == llen) return(NGP_EOF);\t/* signal EOF only if 0 characters read so far */\n          break;\n        }\n      if ('\\n' == c) break;\t\t\t/* end of line character ? */\n      \n      llen++;\t\t\t\t\t/* we have new character, make room for it */\n      alen = ((llen + NGP_ALLOCCHUNK) / NGP_ALLOCCHUNK) * NGP_ALLOCCHUNK;\n      if (alen > allocsize)\n        { p2 = (char *)ngp_realloc(*p, alen);\t/* realloc buffer, if there is need */\n          if (NULL == p2)\n            { r = NGP_NO_MEMORY;\n              break;\n            }\n\t  *p = p2;\n          allocsize = alen;\n        }\n      (*p)[llen - 1] = c;\t\t\t/* copy character to buffer */\n    }\n\n   llen++;\t\t\t\t\t/* place for terminating \\0 */\n   if (llen != allocsize)\n     { p2 = (char *)ngp_realloc(*p, llen);\n       if (NULL == p2) r = NGP_NO_MEMORY;\n       else\n         { *p = p2;\n           (*p)[llen - 1] = 0;\t\t\t/* copy \\0 to buffer */\n         }         \n     }\n   else\n     { (*p)[llen - 1] = 0;\t\t\t/* necessary when line read was empty */\n     }\n\n   if ((NGP_EOF != r) && (NGP_OK != r))\t\t/* in case of errors free resources */\n     { ngp_free(*p);\n       *p = NULL;\n     }\n   \n   return(r);\t\t\t\t\t/* return  status code */\n }\n\n\t/* free current line structure */\n\nint\tngp_free_line(void)\n {\n   if (NULL != ngp_curline.line)\n     { ngp_free(ngp_curline.line);\n       ngp_curline.line = NULL;\n       ngp_curline.name = NULL;\n       ngp_curline.value = NULL;\n       ngp_curline.comment = NULL;\n       ngp_curline.type = NGP_TTYPE_UNKNOWN;\n       ngp_curline.format = NGP_FORMAT_OK;\n       ngp_curline.flags = 0;\n     }\n   return(NGP_OK);\n }\n\n\t/* free cached line structure */\n\nint\tngp_free_prevline(void)\n {\n   if (NULL != ngp_prevline.line)\n     { ngp_free(ngp_prevline.line);\n       ngp_prevline.line = NULL;\n       ngp_prevline.name = NULL;\n       ngp_prevline.value = NULL;\n       ngp_prevline.comment = NULL;\n       ngp_prevline.type = NGP_TTYPE_UNKNOWN;\n       ngp_prevline.format = NGP_FORMAT_OK;\n       ngp_prevline.flags = 0;\n     }\n   return(NGP_OK);\n }\n\n\t/* read one line */\n\nint\tngp_read_line_buffered(FILE *fp)\n {\n   ngp_free_line();\t\t\t\t/* first free current line (if any) */\n   \n   if (NULL != ngp_prevline.line)\t\t/* if cached, return cached line */\n     { ngp_curline = ngp_prevline;\n       ngp_prevline.line = NULL;\n       ngp_prevline.name = NULL;\n       ngp_prevline.value = NULL;\n       ngp_prevline.comment = NULL;\n       ngp_prevline.type = NGP_TTYPE_UNKNOWN;\n       ngp_prevline.format = NGP_FORMAT_OK;\n       ngp_prevline.flags = 0;\n       ngp_curline.flags = NGP_LINE_REREAD;\n       return(NGP_OK);\n     }\n\n   ngp_curline.flags = 0;   \t\t\t/* if not cached really read line from file */\n   return(ngp_line_from_file(fp, &(ngp_curline.line)));\n }\n\n\t/* unread line */\n\nint\tngp_unread_line(void)\n {\n   if (NULL == ngp_curline.line)\t\t/* nothing to unread */\n     return(NGP_EMPTY_CURLINE);\n\n   if (NULL != ngp_prevline.line)\t\t/* we cannot unread line twice */\n     return(NGP_UNREAD_QUEUE_FULL);\n\n   ngp_prevline = ngp_curline;\n   ngp_curline.line = NULL;\n   return(NGP_OK);\n }\n\n\t/* a first guess line decomposition */\n\nint\tngp_extract_tokens(NGP_RAW_LINE *cl)\n { char *p, *s;\n   int\tcl_flags, i;\n\n   p = cl->line;\t\t\t\t/* start from beginning of line */\n   if (NULL == p) return(NGP_NUL_PTR);\n\n   cl->name = cl->value = cl->comment = NULL;\n   cl->type = NGP_TTYPE_UNKNOWN;\n   cl->format = NGP_FORMAT_OK;\n\n   cl_flags = 0;\n\n   for (i=0;; i++)\t\t\t\t/* if 8 spaces at beginning then line is comment */\n    { if ((0 == *p) || ('\\n' == *p))\n        {\t\t\t\t\t/* if line has only blanks -> write blank keyword */\n          cl->line[0] = 0;\t\t\t/* create empty name (0 length string) */\n          cl->comment = cl->name = cl->line;\n\t  cl->type = NGP_TTYPE_RAW;\t\t/* signal write unformatted to FITS file */\n          return(NGP_OK);\n        }\n      if ((' ' != *p) && ('\\t' != *p)) break;\n      if (i >= 7)\n        { \n          cl->comment = p + 1;\n          for (s = cl->comment;; s++)\t\t/* filter out any EOS characters in comment */\n           { if ('\\n' == *s) *s = 0;\n\t     if (0 == *s) break;\n           }\n          cl->line[0] = 0;\t\t\t/* create empty name (0 length string) */\n          cl->name = cl->line;\n\t  cl->type = NGP_TTYPE_RAW;\n          return(NGP_OK);\n        }\n      p++;\n    }\n\n   cl->name = p;\n\n   for (;;)\t\t\t\t\t/* we need to find 1st whitespace */\n    { if ((0 == *p) || ('\\n' == *p))\n        { *p = 0;\n          break;\n        }\n\n      /*\n        from Richard Mathar, 2002-05-03, add 10 lines:\n        if upper/lowercase HIERARCH followed also by an equal sign...\n      */\n      if( fits_strncasecmp(\"HIERARCH\",p,strlen(\"HIERARCH\")) == 0 )\n      {\n           char * const eqsi=strchr(p,'=') ;\n           if( eqsi )\n           {\n              cl_flags |= NGP_FOUND_EQUAL_SIGN ;\n              p=eqsi ;\n              break ;\n           }\n      }\n\n      if ((' ' == *p) || ('\\t' == *p)) break;\n      if ('=' == *p)\n        { cl_flags |= NGP_FOUND_EQUAL_SIGN;\n          break;\n        }\n\n      p++;\n    }\n\n   if (*p) *(p++) = 0;\t\t\t\t/* found end of keyname so terminate string with zero */\n\n   if ((!fits_strcasecmp(\"HISTORY\", cl->name))\n    || (!fits_strcasecmp(\"COMMENT\", cl->name))\n    || (!fits_strcasecmp(\"CONTINUE\", cl->name)))\n     { cl->comment = p;\n       for (s = cl->comment;; s++)\t\t/* filter out any EOS characters in comment */\n        { if ('\\n' == *s) *s = 0;\n\t  if (0 == *s) break;\n        }\n       cl->type = NGP_TTYPE_RAW;\n       return(NGP_OK);\n     }\n\n   if (!fits_strcasecmp(\"\\\\INCLUDE\", cl->name))\n     {\n       for (;; p++)  if ((' ' != *p) && ('\\t' != *p)) break; /* skip whitespace */\n\n       cl->value = p;\n       for (s = cl->value;; s++)\t\t/* filter out any EOS characters */\n        { if ('\\n' == *s) *s = 0;\n\t  if (0 == *s) break;\n        }\n       cl->type = NGP_TTYPE_UNKNOWN;\n       return(NGP_OK);\n     }\n       \n   for (;; p++)\n    { if ((0 == *p) || ('\\n' == *p))  return(NGP_OK);\t/* test if at end of string */\n      if ((' ' == *p) || ('\\t' == *p)) continue; /* skip whitespace */\n      if (cl_flags & NGP_FOUND_EQUAL_SIGN) break;\n      if ('=' != *p) break;\t\t\t/* ignore initial equal sign */\n      cl_flags |= NGP_FOUND_EQUAL_SIGN;\n    }\n      \n   if ('/' == *p)\t\t\t\t/* no value specified, comment only */\n     { p++;\n       if ((' ' == *p) || ('\\t' == *p)) p++;\n       cl->comment = p;\n       for (s = cl->comment;; s++)\t\t/* filter out any EOS characters in comment */\n        { if ('\\n' == *s) *s = 0;\n\t  if (0 == *s) break;\n        }\n       return(NGP_OK);\n     }\n\n   if ('\\'' == *p)\t\t\t\t/* we have found string within quotes */\n     { cl->value = s = ++p;\t\t\t/* set pointer to beginning of that string */\n       cl->type = NGP_TTYPE_STRING;\t\t/* signal that it is of string type */\n\n       for (;;)\t\t\t\t\t/* analyze it */\n        { if ((0 == *p) || ('\\n' == *p))\t/* end of line -> end of string */\n            { *s = 0; return(NGP_OK); }\n\n          if ('\\'' == *p)\t\t\t/* we have found doublequote */\n            { if ((0 == p[1]) || ('\\n' == p[1]))/* doublequote is the last character in line */\n                { *s = 0; return(NGP_OK); }\n              if (('\\t' == p[1]) || (' ' == p[1])) /* duoblequote was string terminator */\n                { *s = 0; p++; break; }\n              if ('\\'' == p[1]) p++;\t\t/* doublequote is inside string, convert \"\" -> \" */ \n            }\n\n          *(s++) = *(p++);\t\t\t/* compact string in place, necess. by \"\" -> \" conversion */\n        }\n     }\n   else\t\t\t\t\t\t/* regular token */\n     { \n       cl->value = p;\t\t\t\t/* set pointer to token */\n       cl->type = NGP_TTYPE_UNKNOWN;\t\t/* we dont know type at the moment */\n       for (;; p++)\t\t\t\t/* we need to find 1st whitespace */\n        { if ((0 == *p) || ('\\n' == *p))\n            { *p = 0; return(NGP_OK); }\n          if ((' ' == *p) || ('\\t' == *p)) break;\n        }\n       if (*p)  *(p++) = 0;\t\t\t/* found so terminate string with zero */\n     }\n       \n   for (;; p++)\n    { if ((0 == *p) || ('\\n' == *p))  return(NGP_OK);\t/* test if at end of string */\n      if ((' ' != *p) && ('\\t' != *p)) break;\t/* skip whitespace */\n    }\n      \n   if ('/' == *p)\t\t\t\t/* no value specified, comment only */\n     { p++;\n       if ((' ' == *p) || ('\\t' == *p)) p++;\n       cl->comment = p;\n       for (s = cl->comment;; s++)\t\t/* filter out any EOS characters in comment */\n        { if ('\\n' == *s) *s = 0;\n\t  if (0 == *s) break;\n        }\n       return(NGP_OK);\n     }\n\n   cl->format = NGP_FORMAT_ERROR;\n   return(NGP_OK);\t\t\t\t/* too many tokens ... */\n }\n\n/*      try to open include file. If open fails and fname\n        does not specify absolute pathname, try to open fname\n        in any directory specified in CFITSIO_INCLUDE_FILES\n        environment variable. Finally try to open fname\n        relative to ngp_master_dir, which is directory of top\n        level include file\n*/\n\nint\tngp_include_file(char *fname)\t\t/* try to open include file */\n { char *p, *p2, *cp, *envar, envfiles[NGP_MAX_ENVFILES];\n   char *saveptr;\n\n   if (NULL == fname) return(NGP_NUL_PTR);\n\n   if (ngp_inclevel >= NGP_MAX_INCLUDE)\t\t/* too many include files */\n     return(NGP_INC_NESTING);\n\n   if (NULL == (ngp_fp[ngp_inclevel] = fopen(fname, \"r\")))\n     {                                          /* if simple open failed .. */\n       envar = getenv(\"CFITSIO_INCLUDE_FILES\");\t/* scan env. variable, and retry to open */\n\n       if (NULL != envar)\t\t\t/* is env. variable defined ? */\n         { strncpy(envfiles, envar, NGP_MAX_ENVFILES - 1);\n           envfiles[NGP_MAX_ENVFILES - 1] = 0;\t/* copy search path to local variable, env. is fragile */\n\n           for (p2 = ffstrtok(envfiles, \":\",&saveptr); NULL != p2; p2 = ffstrtok(NULL, \":\",&saveptr))\n            {\n\t      cp = (char *)ngp_alloc(strlen(fname) + strlen(p2) + 2);\n\t      if (NULL == cp) return(NGP_NO_MEMORY);\n\n\t      strcpy(cp, p2);\n#ifdef  MSDOS\n              strcat(cp, \"\\\\\");\t\t\t/* abs. pathname for MSDOS */\n               \n#else\n              strcat(cp, \"/\");\t\t\t/* and for unix */\n#endif\n\t      strcat(cp, fname);\n\t  \n\t      ngp_fp[ngp_inclevel] = fopen(cp, \"r\");\n\t      ngp_free(cp);\n\n\t      if (NULL != ngp_fp[ngp_inclevel]) break;\n\t    }\n        }\n                                      \n       if (NULL == ngp_fp[ngp_inclevel])\t/* finally try to open relative to top level */\n         {\n#ifdef  MSDOS\n           if ('\\\\' == fname[0]) return(NGP_ERR_FOPEN); /* abs. pathname for MSDOS, does not support C:\\\\PATH */\n#else\n           if ('/' == fname[0]) return(NGP_ERR_FOPEN); /* and for unix */\n#endif\n           if (0 == ngp_master_dir[0]) return(NGP_ERR_FOPEN);\n\n\t   p = ngp_alloc(strlen(fname) + strlen(ngp_master_dir) + 1);\n           if (NULL == p) return(NGP_NO_MEMORY);\n\n           strcpy(p, ngp_master_dir);\t\t/* construct composite pathname */\n           strcat(p, fname);\t\t\t/* comp = master + fname */\n\n           ngp_fp[ngp_inclevel] = fopen(p, \"r\");/* try to open composite */\n           ngp_free(p);\t\t\t\t/* we don't need buffer anymore */\n\n           if (NULL == ngp_fp[ngp_inclevel])\n             return(NGP_ERR_FOPEN);\t\t/* fail if error */\n         }\n     }\n\n   ngp_inclevel++;\n   return(NGP_OK);\n }\n\n\n/* read line in the intelligent way. All \\INCLUDE directives are handled,\n   empty and comment line skipped. If this function returns NGP_OK, than\n   decomposed line (name, type, value in proper type and comment) are\n   stored in ngp_linkey structure. ignore_blank_lines parameter is zero\n   when parser is inside GROUP or HDU definition. Nonzero otherwise.\n*/\n\nint\tngp_read_line(int ignore_blank_lines)\n { int r, nc, savec;\n   unsigned k;\n\n   if (ngp_inclevel <= 0)\t\t/* do some sanity checking first */\n     { ngp_keyidx = NGP_TOKEN_EOF;\t/* no parents, so report error */\n       return(NGP_OK);\t\n     }\n   if (ngp_inclevel > NGP_MAX_INCLUDE)  return(NGP_INC_NESTING);\n   if (NULL == ngp_fp[ngp_inclevel - 1]) return(NGP_NUL_PTR);\n\n   for (;;)\n    { switch (r = ngp_read_line_buffered(ngp_fp[ngp_inclevel - 1]))\n       { case NGP_EOF:\n\t\tngp_inclevel--;\t\t\t/* end of file, revert to parent */\n\t\tif (ngp_fp[ngp_inclevel])\t/* we can close old file */\n\t\t  fclose(ngp_fp[ngp_inclevel]);\n\n\t\tngp_fp[ngp_inclevel] = NULL;\n\t\tif (ngp_inclevel <= 0)\n\t\t  { ngp_keyidx = NGP_TOKEN_EOF;\t/* no parents, so report error */\n\t\t    return(NGP_OK);\t\n\t\t  }\n\t\tcontinue;\n\n\t case NGP_OK:\n\t\tif (ngp_curline.flags & NGP_LINE_REREAD) return(r);\n\t\tbreak;\n\t default:\n\t\treturn(r);\n       }\n      \n      switch (ngp_curline.line[0])\n       { case 0: if (0 == ignore_blank_lines) break; /* ignore empty lines if told so */\n         case '#': continue;\t\t\t/* ignore comment lines */\n       }\n      \n      r = ngp_extract_tokens(&ngp_curline);\t/* analyse line, extract tokens and comment */\n      if (NGP_OK != r) return(r);\n\n      if (NULL == ngp_curline.name)  continue;\t/* skip lines consisting only of whitespaces */\n\n      for (k = 0; k < strlen(ngp_curline.name); k++)\n       { if ((ngp_curline.name[k] >= 'a') && (ngp_curline.name[k] <= 'z')) \n           ngp_curline.name[k] += 'A' - 'a';\t/* force keyword to be upper case */\n         if (k == 7) break;  /* only first 8 chars are required to be upper case */\n       }\n\n      for (k=0;; k++)\t\t\t\t/* find index of keyword in keyword table */\n       { if (NGP_TOKEN_UNKNOWN == ngp_tkdef[k].code) break;\n         if (0 == strcmp(ngp_curline.name, ngp_tkdef[k].name)) break;\n       }\n\n      ngp_keyidx = ngp_tkdef[k].code;\t\t/* save this index, grammar parser will need this */\n\n      if (NGP_TOKEN_INCLUDE == ngp_keyidx)\t/* if this is \\INCLUDE keyword, try to include file */\n        { if (NGP_OK != (r = ngp_include_file(ngp_curline.value))) return(r);\n\t  continue;\t\t\t\t/* and read next line */\n        }\n\n      ngp_linkey.type = NGP_TTYPE_UNKNOWN;\t/* now, get the keyword type, it's a long story ... */\n\n      if (NULL != ngp_curline.value)\t\t/* if no value given signal it */\n        { if (NGP_TTYPE_STRING == ngp_curline.type)  /* string type test */\n            { ngp_linkey.type = NGP_TTYPE_STRING;\n              ngp_linkey.value.s = ngp_curline.value;\n            }\n          if (NGP_TTYPE_UNKNOWN == ngp_linkey.type) /* bool type test */\n            { if ((!fits_strcasecmp(\"T\", ngp_curline.value)) || (!fits_strcasecmp(\"F\", ngp_curline.value)))\n                { ngp_linkey.type = NGP_TTYPE_BOOL;\n                  ngp_linkey.value.b = (fits_strcasecmp(\"T\", ngp_curline.value) ? 0 : 1);\n                }\n            }\n          if (NGP_TTYPE_UNKNOWN == ngp_linkey.type) /* complex type test */\n            { if (2 == sscanf(ngp_curline.value, \"(%lg,%lg)%n\", &(ngp_linkey.value.c.re), &(ngp_linkey.value.c.im), &nc))\n                { if ((' ' == ngp_curline.value[nc]) || ('\\t' == ngp_curline.value[nc])\n                   || ('\\n' == ngp_curline.value[nc]) || (0 == ngp_curline.value[nc]))\n                    { ngp_linkey.type = NGP_TTYPE_COMPLEX;\n                    }\n                }\n            }\n          if (NGP_TTYPE_UNKNOWN == ngp_linkey.type) /* real type test */\n            { if (strchr(ngp_curline.value, '.') && (1 == sscanf(ngp_curline.value, \"%lg%n\", &(ngp_linkey.value.d), &nc)))\n                {\n\t\t if ('D' == ngp_curline.value[nc]) {\n\t\t   /* test if template used a 'D' rather than an 'E' as the exponent character (added by WDP in 12/2010) */\n                   savec = nc;\n\t\t   ngp_curline.value[nc] = 'E';\n\t\t   sscanf(ngp_curline.value, \"%lg%n\", &(ngp_linkey.value.d), &nc);\n\t\t   if ((' ' == ngp_curline.value[nc]) || ('\\t' == ngp_curline.value[nc])\n                    || ('\\n' == ngp_curline.value[nc]) || (0 == ngp_curline.value[nc]))  {\n                       ngp_linkey.type = NGP_TTYPE_REAL;\n                     } else {  /* no, this is not a real value */\n\t\t       ngp_curline.value[savec] = 'D';  /* restore the original D character */\n \t\t     }\n\t\t } else {\n\t\t  if ((' ' == ngp_curline.value[nc]) || ('\\t' == ngp_curline.value[nc])\n                   || ('\\n' == ngp_curline.value[nc]) || (0 == ngp_curline.value[nc]))\n                    { ngp_linkey.type = NGP_TTYPE_REAL;\n                    }\n                 } \n                }\n            }\n          if (NGP_TTYPE_UNKNOWN == ngp_linkey.type) /* integer type test */\n            { if (1 == sscanf(ngp_curline.value, \"%d%n\", &(ngp_linkey.value.i), &nc))\n                { if ((' ' == ngp_curline.value[nc]) || ('\\t' == ngp_curline.value[nc])\n                   || ('\\n' == ngp_curline.value[nc]) || (0 == ngp_curline.value[nc]))\n                    { ngp_linkey.type = NGP_TTYPE_INT;\n                    }\n                }\n            }\n          if (NGP_TTYPE_UNKNOWN == ngp_linkey.type) /* force string type */\n            { ngp_linkey.type = NGP_TTYPE_STRING;\n              ngp_linkey.value.s = ngp_curline.value;\n            }\n        }\n      else\n        { if (NGP_TTYPE_RAW == ngp_curline.type) ngp_linkey.type = NGP_TTYPE_RAW;\n\t  else ngp_linkey.type = NGP_TTYPE_NULL;\n\t}\n\n      if (NULL != ngp_curline.comment)\n        { strncpy(ngp_linkey.comment, ngp_curline.comment, NGP_MAX_COMMENT); /* store comment */\n\t  ngp_linkey.comment[NGP_MAX_COMMENT - 1] = 0;\n\t}\n      else\n        { ngp_linkey.comment[0] = 0;\n        }\n\n      strncpy(ngp_linkey.name, ngp_curline.name, NGP_MAX_NAME); /* and keyword's name */\n      ngp_linkey.name[NGP_MAX_NAME - 1] = 0;\n\n      if (strlen(ngp_linkey.name) > FLEN_KEYWORD)  /* WDP: 20-Jun-2002:  mod to support HIERARCH */\n        { \n           return(NGP_BAD_ARG);\t\t/* cfitsio does not allow names > 8 chars */\n        }\n      \n      return(NGP_OK);\t\t\t/* we have valid non empty line, so return success */\n    }\n }\n\n\t/* check whether keyword can be written as is */\n\nint\tngp_keyword_is_write(NGP_TOKEN *ngp_tok)\n { int i, j, l, spc;\n                        /* indexed variables not to write */\n\n   static char *nm[] = { \"NAXIS\", \"TFORM\", \"TTYPE\", NULL } ;\n\n                        /* non indexed variables not allowed to write */\n  \n   static char *nmni[] = { \"SIMPLE\", \"XTENSION\", \"BITPIX\", \"NAXIS\", \"PCOUNT\",\n                           \"GCOUNT\", \"TFIELDS\", \"THEAP\", \"EXTEND\", \"EXTVER\",\n                           NULL } ;\n\n   if (NULL == ngp_tok) return(NGP_NUL_PTR);\n\n   for (j = 0; ; j++)           /* first check non indexed */\n    { if (NULL == nmni[j]) break;\n      if (0 == strcmp(nmni[j], ngp_tok->name)) return(NGP_BAD_ARG);\n    } \n\n   for (j = 0; ; j++)           /* now check indexed */\n    { if (NULL == nm[j]) return(NGP_OK);\n      l = strlen(nm[j]);\n      if ((l < 1) || (l > 5)) continue;\n      if (0 == strncmp(nm[j], ngp_tok->name, l)) break;\n    } \n\n   if ((ngp_tok->name[l] < '1') || (ngp_tok->name[l] > '9')) return(NGP_OK);\n   spc = 0;\n   for (i = l + 1; i < 8; i++)\n    { if (spc) { if (' ' != ngp_tok->name[i]) return(NGP_OK); }\n      else\n       { if ((ngp_tok->name[i] >= '0') && (ngp_tok->name[i] <= '9')) continue;\n         if (' ' == ngp_tok->name[i]) { spc = 1; continue; }\n         if (0 == ngp_tok->name[i]) break;\n         return(NGP_OK);\n       }\n    }\n   return(NGP_BAD_ARG);\n }\n\n\t/* write (almost) all keywords from given HDU to disk */\n\nint     ngp_keyword_all_write(NGP_HDU *ngph, fitsfile *ffp, int mode)\n { int\t\ti, r, ib;\n   char\t\tbuf[200];\n   long\t\tl;\n\n\n   if (NULL == ngph) return(NGP_NUL_PTR);\n   if (NULL == ffp) return(NGP_NUL_PTR);\n   r = NGP_OK;\n   \n   for (i=0; i<ngph->tokcnt; i++)\n    { r = ngp_keyword_is_write(&(ngph->tok[i]));\n      if ((NGP_REALLY_ALL & mode) || (NGP_OK == r))\n        { switch (ngph->tok[i].type)\n           { case NGP_TTYPE_BOOL:\n\t\t\tib = ngph->tok[i].value.b;\n\t\t\tfits_write_key(ffp, TLOGICAL, ngph->tok[i].name, &ib, ngph->tok[i].comment, &r);\n\t\t\tbreak;\n             case NGP_TTYPE_STRING:\n\t\t\tfits_write_key_longstr(ffp, ngph->tok[i].name, ngph->tok[i].value.s, ngph->tok[i].comment, &r);\n\t\t\tbreak;\n             case NGP_TTYPE_INT:\n\t\t\tl = ngph->tok[i].value.i;\t/* bugfix - 22-Jan-99, BO - nonalignment of OSF/Alpha */\n\t\t\tfits_write_key(ffp, TLONG, ngph->tok[i].name, &l, ngph->tok[i].comment, &r);\n\t\t\tbreak;\n             case NGP_TTYPE_REAL:\n\t\t\tfits_write_key(ffp, TDOUBLE, ngph->tok[i].name, &(ngph->tok[i].value.d), ngph->tok[i].comment, &r);\n\t\t\tbreak;\n             case NGP_TTYPE_COMPLEX:\n\t\t\tfits_write_key(ffp, TDBLCOMPLEX, ngph->tok[i].name, &(ngph->tok[i].value.c), ngph->tok[i].comment, &r);\n\t\t\tbreak;\n             case NGP_TTYPE_NULL:\n\t\t\tfits_write_key_null(ffp, ngph->tok[i].name, ngph->tok[i].comment, &r);\n\t\t\tbreak;\n             case NGP_TTYPE_RAW:\n\t\t\tif (0 == strcmp(\"HISTORY\", ngph->tok[i].name))\n\t\t\t  { fits_write_history(ffp, ngph->tok[i].comment, &r);\n\t\t\t    break;\n\t\t\t  }\n\t\t\tif (0 == strcmp(\"COMMENT\", ngph->tok[i].name))\n\t\t\t  { fits_write_comment(ffp, ngph->tok[i].comment, &r);\n\t\t\t    break;\n\t\t\t  }\n\t\t\tsnprintf(buf,200, \"%-8.8s%s\", ngph->tok[i].name, ngph->tok[i].comment);\n\t\t\tfits_write_record(ffp, buf, &r);\n                        break;\n           }\n        }\n      else if (NGP_BAD_ARG == r) /* enhancement 10 dec 2003, James Peachey: template comments replace defaults */\n        { r = NGP_OK;\t\t\t\t\t\t/* update comments of special keywords like TFORM */\n          if (ngph->tok[i].comment && *ngph->tok[i].comment)\t/* do not update with a blank comment */\n            { fits_modify_comment(ffp, ngph->tok[i].name, ngph->tok[i].comment, &r);\n            }\n        }\n      else /* other problem, typically a blank token */\n        { r = NGP_OK;\t\t\t\t\t\t/* skip this token, but continue */\n        }\n      if (r) return(r);\n    }\n     \n   fits_set_hdustruc(ffp, &r);\t\t\t\t/* resync cfitsio */\n   return(r);\n }\n\n\t/* init HDU structure */\n\nint\tngp_hdu_init(NGP_HDU *ngph)\n { if (NULL == ngph) return(NGP_NUL_PTR);\n   ngph->tok = NULL;\n   ngph->tokcnt = 0;\n   return(NGP_OK);\n }\n\n\t/* clear HDU structure */\n\nint\tngp_hdu_clear(NGP_HDU *ngph)\n { int i;\n\n   if (NULL == ngph) return(NGP_NUL_PTR);\n\n   for (i=0; i<ngph->tokcnt; i++)\n    { if (NGP_TTYPE_STRING == ngph->tok[i].type)\n        if (NULL != ngph->tok[i].value.s)\n          { ngp_free(ngph->tok[i].value.s);\n            ngph->tok[i].value.s = NULL;\n          }\n    }\n\n   if (NULL != ngph->tok) ngp_free(ngph->tok);\n\n   ngph->tok = NULL;\n   ngph->tokcnt = 0;\n\n   return(NGP_OK);\n }\n\n\t/* insert new token to HDU structure */\n\nint\tngp_hdu_insert_token(NGP_HDU *ngph, NGP_TOKEN *newtok)\n { NGP_TOKEN *tkp;\n   \n   if (NULL == ngph) return(NGP_NUL_PTR);\n   if (NULL == newtok) return(NGP_NUL_PTR);\n\n   if (0 == ngph->tokcnt)\n     tkp = (NGP_TOKEN *)ngp_alloc((ngph->tokcnt + 1) * sizeof(NGP_TOKEN));\n   else\n     tkp = (NGP_TOKEN *)ngp_realloc(ngph->tok, (ngph->tokcnt + 1) * sizeof(NGP_TOKEN));\n\n   if (NULL == tkp) return(NGP_NO_MEMORY);\n       \n   ngph->tok = tkp;\n   ngph->tok[ngph->tokcnt] = *newtok;\n\n   if (NGP_TTYPE_STRING == newtok->type)\n     { if (NULL != newtok->value.s)\n         { ngph->tok[ngph->tokcnt].value.s = (char *)ngp_alloc(1 + strlen(newtok->value.s));\n           if (NULL == ngph->tok[ngph->tokcnt].value.s) return(NGP_NO_MEMORY);\n           strcpy(ngph->tok[ngph->tokcnt].value.s, newtok->value.s);\n         }\n     }\n\n   ngph->tokcnt++;\n   return(NGP_OK);\n }\n\n\nint\tngp_append_columns(fitsfile *ff, NGP_HDU *ngph, int aftercol)\n { int\t\tr, i, j, exitflg, ngph_i;\n   char \t*my_tform, *my_ttype;\n   char\t\tngph_ctmp;\n\n\n   if (NULL == ff) return(NGP_NUL_PTR);\n   if (NULL == ngph) return(NGP_NUL_PTR);\n   if (0 == ngph->tokcnt) return(NGP_OK);\t/* nothing to do ! */\n\n   r = NGP_OK;\n   exitflg = 0;\n\n   for (j=aftercol; j<NGP_MAX_ARRAY_DIM; j++)\t/* 0 for table, 6 for group */\n    { \n      my_tform = NULL;\n      my_ttype = \"\";\n    \n      for (i=0; ; i++)\n       { if (1 == sscanf(ngph->tok[i].name, \"TFORM%d%c\", &ngph_i, &ngph_ctmp))\n           { if ((NGP_TTYPE_STRING == ngph->tok[i].type) && (ngph_i == (j + 1)))\n   \t    { my_tform = ngph->tok[i].value.s;\n   \t    }\n                }\n         else if (1 == sscanf(ngph->tok[i].name, \"TTYPE%d%c\", &ngph_i, &ngph_ctmp))\n           { if ((NGP_TTYPE_STRING == ngph->tok[i].type) && (ngph_i == (j + 1)))\n               { my_ttype = ngph->tok[i].value.s;\n               }\n           }\n         \n         if ((NULL != my_tform) && (my_ttype[0])) break;\n         \n         if (i < (ngph->tokcnt - 1)) continue;\n         exitflg = 1;\n         break;\n       }\n      if ((NGP_OK == r) && (NULL != my_tform))\n        fits_insert_col(ff, j + 1, my_ttype, my_tform, &r);\n\n      if ((NGP_OK != r) || exitflg) break;\n    }\n   return(r);\n }\n\n\t/* read complete HDU */\n\nint\tngp_read_xtension(fitsfile *ff, int parent_hn, int simple_mode)\n { int\t\tr, exflg, l, my_hn, tmp0, incrementor_index, i, j;\n   int\t\tngph_dim, ngph_bitpix, ngph_node_type, my_version;\n   char\t\tincrementor_name[NGP_MAX_STRING], ngph_ctmp;\n   char \t*ngph_extname = 0;\n   long\t\tngph_size[NGP_MAX_ARRAY_DIM];\n   NGP_HDU\tngph;\n   long\t\tlv;\n\n   incrementor_name[0] = 0;\t\t\t/* signal no keyword+'#' found yet */\n   incrementor_index = 0;\n\n   if (NGP_OK != (r = ngp_hdu_init(&ngph))) return(r);\n\n   if (NGP_OK != (r = ngp_read_line(0))) return(r);\t/* EOF always means error here */\n   switch (NGP_XTENSION_SIMPLE & simple_mode)\n     {\n       case 0:  if (NGP_TOKEN_XTENSION != ngp_keyidx) return(NGP_TOKEN_NOT_EXPECT);\n\t\tbreak;\n       default:\tif (NGP_TOKEN_SIMPLE != ngp_keyidx) return(NGP_TOKEN_NOT_EXPECT);\n\t\tbreak;\n     }\n       \t\n   if (NGP_OK != (r = ngp_hdu_insert_token(&ngph, &ngp_linkey))) return(r);\n\n   for (;;)\n    { if (NGP_OK != (r = ngp_read_line(0))) return(r);\t/* EOF always means error here */\n      exflg = 0;\n      switch (ngp_keyidx)\n       { \n\t case NGP_TOKEN_SIMPLE:\n\t \t\tr = NGP_TOKEN_NOT_EXPECT;\n\t\t\tbreak;\n\t \t\t                        \n\t case NGP_TOKEN_END:\n         case NGP_TOKEN_XTENSION:\n         case NGP_TOKEN_GROUP:\n         \t\tr = ngp_unread_line();\t/* WARNING - not break here .... */\n         case NGP_TOKEN_EOF:\n\t\t\texflg = 1;\n \t\t\tbreak;\n\n         default:\tl = strlen(ngp_linkey.name);\n\t\t\tif ((l >= 2) && (l <= 6))\n\t\t\t  { if ('#' == ngp_linkey.name[l - 1])\n\t\t\t      { if (0 == incrementor_name[0])\n\t\t\t          { memcpy(incrementor_name, ngp_linkey.name, l - 1);\n\t\t\t            incrementor_name[l - 1] = 0;\n\t\t\t          }\n\t\t\t        if (((l - 1) == (int)strlen(incrementor_name)) && (0 == memcmp(incrementor_name, ngp_linkey.name, l - 1)))\n\t\t\t          { incrementor_index++;\n\t\t\t          }\n\t\t\t        snprintf(ngp_linkey.name + l - 1, NGP_MAX_NAME-l+1,\"%d\", incrementor_index);\n\t\t\t      }\n\t\t\t  }\n\t\t\tr = ngp_hdu_insert_token(&ngph, &ngp_linkey);\n \t\t\tbreak;\n       }\n      if ((NGP_OK != r) || exflg) break;\n    }\n\n   if (NGP_OK == r)\n     { \t\t\t\t/* we should scan keywords, and calculate HDU's */\n\t\t\t\t/* structure ourselves .... */\n\n       ngph_node_type = NGP_NODE_INVALID;\t/* init variables */\n       ngph_bitpix = 0;\n       ngph_extname = NULL;\n       for (i=0; i<NGP_MAX_ARRAY_DIM; i++) ngph_size[i] = 0;\n       ngph_dim = 0;\n\n       for (i=0; i<ngph.tokcnt; i++)\n        { if (!strcmp(\"XTENSION\", ngph.tok[i].name))\n            { if (NGP_TTYPE_STRING == ngph.tok[i].type)\n                { if (!fits_strncasecmp(\"BINTABLE\", ngph.tok[i].value.s,8)) ngph_node_type = NGP_NODE_BTABLE;\n                  if (!fits_strncasecmp(\"TABLE\", ngph.tok[i].value.s,5)) ngph_node_type = NGP_NODE_ATABLE;\n                  if (!fits_strncasecmp(\"IMAGE\", ngph.tok[i].value.s,5)) ngph_node_type = NGP_NODE_IMAGE;\n                }\n            }\n          else if (!strcmp(\"SIMPLE\", ngph.tok[i].name))\n            { if (NGP_TTYPE_BOOL == ngph.tok[i].type)\n                { if (ngph.tok[i].value.b) ngph_node_type = NGP_NODE_IMAGE;\n                }\n            }\n          else if (!strcmp(\"BITPIX\", ngph.tok[i].name))\n            { if (NGP_TTYPE_INT == ngph.tok[i].type)  ngph_bitpix = ngph.tok[i].value.i;\n            }\n          else if (!strcmp(\"NAXIS\", ngph.tok[i].name))\n            { if (NGP_TTYPE_INT == ngph.tok[i].type)  ngph_dim = ngph.tok[i].value.i;\n            }\n          else if (!strcmp(\"EXTNAME\", ngph.tok[i].name))\t/* assign EXTNAME, I hope struct does not move */\n            { if (NGP_TTYPE_STRING == ngph.tok[i].type)  ngph_extname = ngph.tok[i].value.s;\n            }\n          else if (1 == sscanf(ngph.tok[i].name, \"NAXIS%d%c\", &j, &ngph_ctmp))\n            { if (NGP_TTYPE_INT == ngph.tok[i].type)\n\t\tif ((j>=1) && (j <= NGP_MAX_ARRAY_DIM))\n\t\t  { ngph_size[j - 1] = ngph.tok[i].value.i;\n\t\t  }\n            }\n        }\n\n       switch (ngph_node_type)\n        { case NGP_NODE_IMAGE:\n\t\t\tif (NGP_XTENSION_FIRST == ((NGP_XTENSION_FIRST | NGP_XTENSION_SIMPLE) & simple_mode))\n\t\t\t  { \t\t/* if caller signals that this is 1st HDU in file */\n\t\t\t\t\t/* and it is IMAGE defined with XTENSION, then we */\n\t\t\t\t\t/* need create dummy Primary HDU */\t\t\t  \n\t\t\t    fits_create_img(ff, 16, 0, NULL, &r);\n\t\t\t  }\n\t\t\t\t\t/* create image */\n\t\t\tfits_create_img(ff, ngph_bitpix, ngph_dim, ngph_size, &r);\n\n\t\t\t\t\t/* update keywords */\n\t\t\tif (NGP_OK == r)  r = ngp_keyword_all_write(&ngph, ff, NGP_NON_SYSTEM_ONLY);\n\t\t\tbreak;\n\n          case NGP_NODE_ATABLE:\n          case NGP_NODE_BTABLE:\n\t\t\t\t\t/* create table, 0 rows and 0 columns for the moment */\n\t\t\tfits_create_tbl(ff, ((NGP_NODE_ATABLE == ngph_node_type)\n\t\t\t\t\t     ? ASCII_TBL : BINARY_TBL),\n\t\t\t\t\t0, 0, NULL, NULL, NULL, NULL, &r);\n\t\t\tif (NGP_OK != r) break;\n\n\t\t\t\t\t/* add columns ... */\n\t\t\tr = ngp_append_columns(ff, &ngph, 0);\n\t\t\tif (NGP_OK != r) break;\n\n\t\t\t\t\t/* add remaining keywords */\n\t\t\tr = ngp_keyword_all_write(&ngph, ff, NGP_NON_SYSTEM_ONLY);\n\t\t\tif (NGP_OK != r) break;\n\n\t\t\t\t\t/* if requested add rows */\n\t\t\tif (ngph_size[1] > 0) fits_insert_rows(ff, 0, ngph_size[1], &r);\n\t\t\tbreak;\n\n\t  default:\tr = NGP_BAD_ARG;\n\t  \t\tbreak;\n\t}\n\n     }\n\n   if ((NGP_OK == r) && (NULL != ngph_extname))\n     { r = ngp_get_extver(ngph_extname, &my_version);\t/* write correct ext version number */\n       lv = my_version;\t\t/* bugfix - 22-Jan-99, BO - nonalignment of OSF/Alpha */\n       fits_write_key(ff, TLONG, \"EXTVER\", &lv, \"auto assigned by template parser\", &r); \n     }\n\n   if (NGP_OK == r)\n     { if (parent_hn > 0)\n         { fits_get_hdu_num(ff, &my_hn);\n           fits_movabs_hdu(ff, parent_hn, &tmp0, &r);\t/* link us to parent */\n           fits_add_group_member(ff, NULL, my_hn, &r);\n           fits_movabs_hdu(ff, my_hn, &tmp0, &r);\n           if (NGP_OK != r) return(r);\n         }\n     }\n\n   if (NGP_OK != r)\t\t\t\t\t/* in case of error - delete hdu */\n     { tmp0 = 0;\n       fits_delete_hdu(ff, NULL, &tmp0);\n     }\n\n   ngp_hdu_clear(&ngph);\n   return(r);\n }\n\n\t/* read complete GROUP */\n\nint\tngp_read_group(fitsfile *ff, char *grpname, int parent_hn)\n { int\t\tr, exitflg, l, my_hn, tmp0, incrementor_index;\n   char\t\tgrnm[NGP_MAX_STRING];\t\t\t/* keyword holding group name */\n   char\t\tincrementor_name[NGP_MAX_STRING];\n   NGP_HDU\tngph;\n\n   incrementor_name[0] = 0;\t\t\t/* signal no keyword+'#' found yet */\n   incrementor_index = 6;\t\t\t/* first 6 cols are used by group */\n\n   ngp_grplevel++;\n   if (NGP_OK != (r = ngp_hdu_init(&ngph))) return(r);\n\n   r = NGP_OK;\n   if (NGP_OK != (r = fits_create_group(ff, grpname, GT_ID_ALL_URI, &r))) return(r);\n   fits_get_hdu_num(ff, &my_hn);\n   if (parent_hn > 0)\n     { fits_movabs_hdu(ff, parent_hn, &tmp0, &r);\t/* link us to parent */\n       fits_add_group_member(ff, NULL, my_hn, &r);\n       fits_movabs_hdu(ff, my_hn, &tmp0, &r);\n       if (NGP_OK != r) return(r);\n     }\n\n   for (exitflg = 0; 0 == exitflg;)\n    { if (NGP_OK != (r = ngp_read_line(0))) break;\t/* EOF always means error here */\n      switch (ngp_keyidx)\n       {\n\t case NGP_TOKEN_SIMPLE:\n\t case NGP_TOKEN_EOF:\n\t\t\tr = NGP_TOKEN_NOT_EXPECT;\n\t\t\tbreak;\n\n         case NGP_TOKEN_END:\n         \t\tngp_grplevel--;\n\t\t\texitflg = 1;\n\t\t\tbreak;\n\n         case NGP_TOKEN_GROUP:\n\t\t\tif (NGP_TTYPE_STRING == ngp_linkey.type)\n\t\t\t  { strncpy(grnm, ngp_linkey.value.s, NGP_MAX_STRING);\n\t\t\t  }\n\t\t\telse\n\t\t\t  { snprintf(grnm, NGP_MAX_STRING,\"DEFAULT_GROUP_%d\", master_grp_idx++);\n\t\t\t  }\n\t\t\tgrnm[NGP_MAX_STRING - 1] = 0;\n\t\t\tr = ngp_read_group(ff, grnm, my_hn);\n\t\t\tbreak;\t\t\t/* we can have many subsequent GROUP defs */\n\n         case NGP_TOKEN_XTENSION:\n         \t\tr = ngp_unread_line();\n         \t\tif (NGP_OK != r) break;\n         \t\tr = ngp_read_xtension(ff, my_hn, 0);\n\t\t\tbreak;\t\t\t/* we can have many subsequent HDU defs */\n\n         default:\tl = strlen(ngp_linkey.name);\n\t\t\tif ((l >= 2) && (l <= 6))\n\t\t\t  { if ('#' == ngp_linkey.name[l - 1])\n\t\t\t      { if (0 == incrementor_name[0])\n\t\t\t          { memcpy(incrementor_name, ngp_linkey.name, l - 1);\n\t\t\t            incrementor_name[l - 1] = 0;\n\t\t\t          }\n\t\t\t        if (((l - 1) == (int)strlen(incrementor_name)) && (0 == memcmp(incrementor_name, ngp_linkey.name, l - 1)))\n\t\t\t          { incrementor_index++;\n\t\t\t          }\n\t\t\t        snprintf(ngp_linkey.name + l - 1, NGP_MAX_NAME-l+1,\"%d\", incrementor_index);\n\t\t\t      }\n\t\t\t  }\n         \t\tr = ngp_hdu_insert_token(&ngph, &ngp_linkey); \n\t\t\tbreak;\t\t\t/* here we can add keyword */\n       }\n      if (NGP_OK != r) break;\n    }\n\n   fits_movabs_hdu(ff, my_hn, &tmp0, &r);\t/* back to our HDU */\n\n   if (NGP_OK == r)\t\t\t\t/* create additional columns, if requested */\n     r = ngp_append_columns(ff, &ngph, 6);\n\n   if (NGP_OK == r)\t\t\t\t/* and write keywords */\n     r = ngp_keyword_all_write(&ngph, ff, NGP_NON_SYSTEM_ONLY);\n\n   if (NGP_OK != r)\t\t\t/* delete group in case of error */\n     { tmp0 = 0;\n       fits_remove_group(ff, OPT_RM_GPT, &tmp0);\n     }\n\n   ngp_hdu_clear(&ngph);\t\t/* we are done with this HDU, so delete it */\n   return(r);\n }\n\n\t\t/* top level API functions */\n\n/* read whole template. ff should point to the opened empty fits file. */\n\nint\tfits_execute_template(fitsfile *ff, char *ngp_template, int *status)\n { int\t\tr, exit_flg, first_extension, i, my_hn, tmp0, keys_exist, more_keys, used_ver;\n   char\t\tgrnm[NGP_MAX_STRING], used_name[NGP_MAX_STRING];\n   long\t\tluv;\n\n   if (NULL == status) return(NGP_NUL_PTR);\n   if (NGP_OK != *status) return(*status);\n\n   /* This function uses many global variables (local to this file) and\n      therefore is not thread-safe. */\n   FFLOCK;\n   \n   if ((NULL == ff) || (NULL == ngp_template))\n     { *status = NGP_NUL_PTR;\n       FFUNLOCK;\n       return(*status);\n     }\n\n   ngp_inclevel = 0;\t\t\t\t/* initialize things, not all should be zero */\n   ngp_grplevel = 0;\n   master_grp_idx = 1;\n   exit_flg = 0;\n   ngp_master_dir[0] = 0;\t\t\t/* this should be before 1st call to ngp_include_file */\n   first_extension = 1;\t\t\t\t/* we need to create PHDU */\n\n   if (NGP_OK != (r = ngp_delete_extver_tab()))\n     { *status = r;\n       FFUNLOCK;\n       return(r);\n     }\n\n   fits_get_hdu_num(ff, &my_hn);\t\t/* our HDU position */\n   if (my_hn <= 1)\t\t\t\t/* check whether we really need to create PHDU */\n     { fits_movabs_hdu(ff, 1, &tmp0, status);\n       fits_get_hdrspace(ff, &keys_exist, &more_keys, status);\n       fits_movabs_hdu(ff, my_hn, &tmp0, status);\n       if (NGP_OK != *status) /* error here means file is corrupted */\n       {\n          FFUNLOCK;\n          return(*status);\t\n       }\n       if (keys_exist > 0) first_extension = 0;\t/* if keywords exist assume PHDU already exist */\n     }\n   else\n     { first_extension = 0;\t\t\t/* PHDU (followed by 1+ extensions) exist */\n\n       for (i = 2; i<= my_hn; i++)\n        { *status = NGP_OK;\n          fits_movabs_hdu(ff, 1, &tmp0, status);\n          if (NGP_OK != *status) break;\n\n          fits_read_key(ff, TSTRING, \"EXTNAME\", used_name, NULL, status);\n          if (NGP_OK != *status)  continue;\n\n          fits_read_key(ff, TLONG, \"EXTVER\", &luv, NULL, status);\n          used_ver = luv;\t\t\t/* bugfix - 22-Jan-99, BO - nonalignment of OSF/Alpha */\n          if (VALUE_UNDEFINED == *status)\n            { used_ver = 1;\n              *status = NGP_OK;\n            }\n\n          if (NGP_OK == *status) *status = ngp_set_extver(used_name, used_ver);\n        }\n\n       fits_movabs_hdu(ff, my_hn, &tmp0, status);\n     }\n     \n   if (NGP_OK != *status) {\n      FFUNLOCK;\n      return(*status);\n   }                                                                       \n   if (NGP_OK != (*status = ngp_include_file(ngp_template))) {\n      FFUNLOCK;\n      return(*status);\n   }\n   \n   for (i = strlen(ngp_template) - 1; i >= 0; i--) /* strlen is > 0, otherwise fopen failed */\n    { \n#ifdef MSDOS\n      if ('\\\\' == ngp_template[i]) break;\n#else\n      if ('/' == ngp_template[i]) break;\n#endif\n    } \n      \n   i++;\n   if (i > (NGP_MAX_FNAME - 1)) i = NGP_MAX_FNAME - 1;\n\n   if (i > 0)\n     { memcpy(ngp_master_dir, ngp_template, i);\n       ngp_master_dir[i] = 0;\n     }\n\n\n   for (;;)\n    { if (NGP_OK != (r = ngp_read_line(1))) break;\t/* EOF always means error here */\n      switch (ngp_keyidx)\n       {\n         case NGP_TOKEN_SIMPLE:\n\t\t\tif (0 == first_extension)\t/* simple only allowed in first HDU */\n\t\t\t  { r = NGP_TOKEN_NOT_EXPECT;\n\t\t\t    break;\n\t\t\t  }\n\t\t\tif (NGP_OK != (r = ngp_unread_line())) break;\n\t\t\tr = ngp_read_xtension(ff, 0, NGP_XTENSION_SIMPLE | NGP_XTENSION_FIRST);\n\t\t\tfirst_extension = 0;\n\t\t\tbreak;\n\n         case NGP_TOKEN_XTENSION:\n\t\t\tif (NGP_OK != (r = ngp_unread_line())) break;\n\t\t\tr = ngp_read_xtension(ff, 0, (first_extension ? NGP_XTENSION_FIRST : 0));\n\t\t\tfirst_extension = 0;\n\t\t\tbreak;\n\n         case NGP_TOKEN_GROUP:\n\t\t\tif (NGP_TTYPE_STRING == ngp_linkey.type)\n\t\t\t  { strncpy(grnm, ngp_linkey.value.s, NGP_MAX_STRING); }\n\t\t\telse\n\t\t\t  { snprintf(grnm,NGP_MAX_STRING, \"DEFAULT_GROUP_%d\", master_grp_idx++); }\n\t\t\tgrnm[NGP_MAX_STRING - 1] = 0;\n\t\t\tr = ngp_read_group(ff, grnm, 0);\n\t\t\tfirst_extension = 0;\n\t\t\tbreak;\n\n\t case NGP_TOKEN_EOF:\n\t\t\texit_flg = 1;\n\t\t\tbreak;\n\n         default:\tr = NGP_TOKEN_NOT_EXPECT;\n\t\t\tbreak;\n       }\n      if (exit_flg || (NGP_OK != r)) break;\n    }\n\n/* all top level HDUs up to faulty one are left intact in case of i/o error. It is up\n   to the caller to call fits_close_file or fits_delete_file when this function returns\n   error. */\n\n   ngp_free_line();\t\t/* deallocate last line (if any) */\n   ngp_free_prevline();\t\t/* deallocate cached line (if any) */\n   ngp_delete_extver_tab();\t/* delete extver table (if present), error ignored */\n   \n   *status = r;\n   FFUNLOCK;\n   return(r);\n }\n"},{"id":16679,"name":"putcoluk.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, putcolk.c, contains routines that write data elements to    */\n/*  a FITS image or table, with 'unsigned int' datatype.                   */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <limits.h>\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffppruk(fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n   unsigned int   *array,    /* I - array of values that are written        */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n    unsigned int nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_pixels(fptr, TUINT, firstelem, nelem,\n            0, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcluk(fptr, 2, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffppnuk(fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n   unsigned int   *array,    /* I - array of values that are written        */\n   unsigned int   nulval,    /* I - undefined pixel value                   */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).  Any array values\n  that are equal to the value of nulval will be replaced with the null\n  pixel value that is appropriate for this column.\n*/\n{\n    long row;\n    unsigned int nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        nullvalue = nulval;  /* set local variable */\n        fits_write_compressed_pixels(fptr, TUINT, firstelem, nelem,\n            1, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcnuk(fptr, 2, row, firstelem, nelem, array, nulval, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp2duk(fitsfile *fptr,  /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n  unsigned int   *array,     /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    /* call the 3D writing routine, with the 3rd dimension = 1 */\n\n    ffp3duk(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp3duk(fitsfile *fptr,  /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  nrows,      /* I - number of rows in each plane of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           LONGLONG  naxis3,     /* I - FITS image NAXIS3 value               */\n  unsigned int   *array,     /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 3-D cube of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    long tablerow, ii, jj;\n    long fpixel[3]= {1,1,1}, lpixel[3];\n    LONGLONG nfits, narray;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n           \n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n        lpixel[0] = (long) ncols;\n        lpixel[1] = (long) nrows;\n        lpixel[2] = (long) naxis3;\n       \n        fits_write_compressed_img(fptr, TUINT, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n      /* all the image pixels are contiguous, so write all at once */\n      ffpcluk(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status);\n      return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to write to */\n    narray = 0;  /* next pixel in input array to be written */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* writing naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffpcluk(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0)\n         return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpssuk(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,      /* I - group to write(1 = 1st group)           */\n           long  naxis,      /* I - number of data axes in array            */\n           long  *naxes,     /* I - size of each FITS axis                  */\n           long  *fpixel,    /* I - 1st pixel in each axis to write (1=1st) */\n           long  *lpixel,    /* I - last pixel in each axis to write        */\n  unsigned int  *array,      /* I - array to be written                     */\n           int  *status)     /* IO - error status                           */\n/*\n  Write a subsection of pixels to the primary array or image.\n  A subsection is defined to be any contiguous rectangular\n  array of pixels within the n-dimensional FITS data file.\n  Data conversion and scaling will be performed if necessary \n  (e.g, if the datatype of the FITS array is not the same as\n  the array being written).\n*/\n{\n    long tablerow;\n    LONGLONG fpix[7], dimen[7], astart, pstart;\n    LONGLONG off2, off3, off4, off5, off6, off7;\n    LONGLONG st10, st20, st30, st40, st50, st60, st70;\n    LONGLONG st1, st2, st3, st4, st5, st6, st7;\n    long ii, i1, i2, i3, i4, i5, i6, i7, irange[7];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_img(fptr, TUINT, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    if (naxis < 1 || naxis > 7)\n      return(*status = BAD_DIMEN);\n\n    tablerow=maxvalue(1,group);\n\n     /* calculate the size and number of loops to perform in each dimension */\n    for (ii = 0; ii < 7; ii++)\n    {\n      fpix[ii]=1;\n      irange[ii]=1;\n      dimen[ii]=1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {    \n      fpix[ii]=fpixel[ii];\n      irange[ii]=lpixel[ii]-fpixel[ii]+1;\n      dimen[ii]=naxes[ii];\n    }\n\n    i1=irange[0];\n\n    /* compute the pixel offset between each dimension */\n    off2 =     dimen[0];\n    off3 = off2 * dimen[1];\n    off4 = off3 * dimen[2];\n    off5 = off4 * dimen[3];\n    off6 = off5 * dimen[4];\n    off7 = off6 * dimen[5];\n\n    st10 = fpix[0];\n    st20 = (fpix[1] - 1) * off2;\n    st30 = (fpix[2] - 1) * off3;\n    st40 = (fpix[3] - 1) * off4;\n    st50 = (fpix[4] - 1) * off5;\n    st60 = (fpix[5] - 1) * off6;\n    st70 = (fpix[6] - 1) * off7;\n\n    /* store the initial offset in each dimension */\n    st1 = st10;\n    st2 = st20;\n    st3 = st30;\n    st4 = st40;\n    st5 = st50;\n    st6 = st60;\n    st7 = st70;\n\n    astart = 0;\n\n    for (i7 = 0; i7 < irange[6]; i7++)\n    {\n     for (i6 = 0; i6 < irange[5]; i6++)\n     {\n      for (i5 = 0; i5 < irange[4]; i5++)\n      {\n       for (i4 = 0; i4 < irange[3]; i4++)\n       {\n        for (i3 = 0; i3 < irange[2]; i3++)\n        {\n         pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7;\n\n         for (i2 = 0; i2 < irange[1]; i2++)\n         {\n           if (ffpcluk(fptr, 2, tablerow, pstart, i1, &array[astart],\n              status) > 0)\n              return(*status);\n\n           astart += i1;\n           pstart += off2;\n         }\n         st2 = st20;\n         st3 = st3+off3;    \n        }\n        st3 = st30;\n        st4 = st4+off4;\n       }\n       st4 = st40;\n       st5 = st5+off5;\n      }\n      st5 = st50;\n      st6 = st6+off6;\n     }\n     st6 = st60;\n     st7 = st7+off7;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpgpuk(fitsfile *fptr,   /* I - FITS file pointer                      */\n            long  group,      /* I - group to write(1 = 1st group)          */\n            long  firstelem,  /* I - first vector element to write(1 = 1st) */\n            long  nelem,      /* I - number of values to write              */\n   unsigned int   *array,     /* I - array of values that are written       */\n            int  *status)     /* IO - error status                          */\n/*\n  Write an array of group parameters to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffpcluk(fptr, 1L, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcluk(fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n   unsigned int   *array,    /* I - array of values to write                */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer to a virtual column in a 1 or more grouped FITS primary\n  array.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    int tcode, maxelem, hdutype;\n    long twidth, incre;\n    long ntodo;\n    LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull;\n    double scale, zero;\n    char tform[20], cform[20];\n    char message[FLEN_ERRMSG];\n\n    char snull[20];   /*  the FITS null value  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* call the 'short' or 'long' version of this routine, if possible */\n    if (sizeof(int) == sizeof(short))\n        ffpclui(fptr, colnum, firstrow, firstelem, nelem, \n              (unsigned short *) array, status);\n    else if (sizeof(int) == sizeof(long))\n        ffpcluj(fptr, colnum, firstrow, firstelem, nelem, \n              (unsigned long *) array, status);\n    else\n    {\n    /*\n      This is a special case: sizeof(int) is not equal to sizeof(short) or\n      sizeof(long).  This occurs on Alpha OSF systems where short = 2 bytes,\n      int = 4 bytes, and long = 8 bytes.\n    */\n\n    buffer = cbuff;\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n\n    if (tcode == TSTRING)   \n         ffcfmt(tform, cform);     /* derive C format for writing strings */\n\n    /*---------------------------------------------------------------------*/\n    /*  Now write the pixels to the FITS column.                           */\n    /*  First call the ffXXfYY routine to  (1) convert the datatype        */\n    /*  if necessary, and (2) scale the values by the FITS TSCALn and      */\n    /*  TZEROn linear scaling parameters into a temporary buffer.          */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to write  */\n    next = 0;                 /* next element in array to be written  */\n    rownum = 0;               /* row number, relative to firstrow     */\n\n    while (remain)\n    {\n        /* limit the number of pixels to process a one time to the number that\n           will fit in the buffer space or to the number of pixels that remain\n           in the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);      \n        ntodo = (long) minvalue(ntodo, (repeat - elemnum));\n\n        wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre);\n\n        ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */\n\n        switch (tcode) \n        {\n            case (TLONG):\n                /* convert the raw data before writing to FITS file */\n                ffuintfi4(&array[next], ntodo, scale, zero,\n                        (INT32BIT *) buffer, status);\n                ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status);\n                break;\n\n            case (TLONGLONG):\n\n                ffuintfi8(&array[next], ntodo, scale, zero,\n                        (LONGLONG *) buffer, status);\n                ffpi8b(fptr, ntodo, incre, (long *) buffer, status);\n                break;\n\n            case (TBYTE):\n \n                ffuintfi1(&array[next], ntodo, scale, zero,\n                        (unsigned char *) buffer, status);\n                ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status);\n                break;\n\n            case (TSHORT):\n\n                ffuintfi2(&array[next], ntodo, scale, zero,\n                        (short *) buffer, status);\n                ffpi2b(fptr, ntodo, incre, (short *) buffer, status);\n                break;\n\n            case (TFLOAT):\n\n                ffuintfr4(&array[next], ntodo, scale, zero,\n                        (float *) buffer, status);\n                ffpr4b(fptr, ntodo, incre, (float *) buffer, status);\n                break;\n\n            case (TDOUBLE):\n                ffuintfr8(&array[next], ntodo, scale, zero,\n                       (double *) buffer, status);\n                ffpr8b(fptr, ntodo, incre, (double *) buffer, status);\n                break;\n\n            case (TSTRING):  /* numerical column in an ASCII table */\n\n                if (cform[1] != 's')  /*  \"%s\" format is a string */\n                {\n                  ffuintfstr(&array[next], ntodo, scale, zero, cform,\n                          twidth, (char *) buffer, status);\n\n                  if (incre == twidth)    /* contiguous bytes */\n                     ffpbyt(fptr, ntodo * twidth, buffer, status);\n                  else\n                     ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                            status);\n\n                  break;\n                }\n                /* can't write to string column, so fall thru to default: */\n\n            default:  /*  error trap  */\n                snprintf(message,FLEN_ERRMSG, \n                     \"Cannot write numbers to column %d which has format %s\",\n                      colnum,tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous write operation */\n        {\n          snprintf(message,FLEN_ERRMSG,\n          \"Error writing elements %.0f thru %.0f of input data array (ffpcluk).\",\n              (double) (next+1), (double) (next+ntodo));\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum += ntodo;\n            if (elemnum == repeat)  /* completed a row; start on next row */\n            {\n                elemnum = 0;\n                rownum++;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while writing FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    }   /* end of Dec ALPHA special case */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcnuk(fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n   unsigned int   *array,    /* I - array of values to write                */\n   unsigned int    nulvalue, /* I - value used to flag undefined pixels     */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of elements to the specified column of a table.  Any input\n  pixels equal to the value of nulvalue will be replaced by the appropriate\n  null value in the output FITS file. \n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary\n*/\n{\n    tcolumn *colptr;\n    LONGLONG  ngood = 0, nbad = 0, ii;\n    LONGLONG repeat, first, fstelm, fstrow;\n    int tcode, overflow = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n    }\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n\n    tcode  = colptr->tdatatype;\n\n    if (tcode > 0)\n       repeat = colptr->trepeat;  /* repeat count for this column */\n    else\n       repeat = firstelem -1 + nelem;  /* variable length arrays */\n\n    /* if variable length array, first write the whole input vector, \n       then go back and fill in the nulls */\n    if (tcode < 0) {\n      if (ffpcluk(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) {\n        if (*status == NUM_OVERFLOW) \n\t{\n\t  /* ignore overflows, which are possibly the null pixel values */\n\t  /*  overflow = 1;   */\n\t  *status = 0;\n\t} else { \n          return(*status);\n\t}\n      }\n    }\n\n    /* absolute element number in the column */\n    first = (firstrow - 1) * repeat + firstelem;\n\n    for (ii = 0; ii < nelem; ii++)\n    {\n      if (array[ii] != nulvalue)  /* is this a good pixel? */\n      {\n         if (nbad)  /* write previous string of bad pixels */\n         {\n            fstelm = ii - nbad + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0)\n                return(*status);\n\n            nbad=0;\n         }\n\n         ngood = ngood +1;  /* the consecutive number of good pixels */\n      }\n      else\n      {\n         if (ngood)  /* write previous string of good pixels */\n         {\n            fstelm = ii - ngood + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (tcode > 0) {  /* variable length arrays have already been written */\n              if (ffpcluk(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood],\n                status) > 0) {\n\t\tif (*status == NUM_OVERFLOW) \n\t\t{\n\t\t  overflow = 1;\n\t\t  *status = 0;\n\t\t} else { \n                  return(*status);\n\t\t}\n\t      }\n\t    }\n            ngood=0;\n         }\n\n         nbad = nbad +1;  /* the consecutive number of bad pixels */\n      }\n    }\n\n    /* finished loop;  now just write the last set of pixels */\n\n    if (ngood)  /* write last string of good pixels */\n    {\n      fstelm = ii - ngood + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      if (tcode > 0) {  /* variable length arrays have already been written */\n        ffpcluk(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status);\n      }\n    }\n    else if (nbad) /* write last string of bad pixels */\n    {\n      fstelm = ii - nbad + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      ffpclu(fptr, colnum, fstrow, fstelm, nbad, status);\n    }\n\n    if (*status <= 0) {\n      if (overflow) {\n        *status = NUM_OVERFLOW;\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffuintfi1(unsigned int *input, /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            unsigned char *output, /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] > UCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DUCHAR_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (dvalue > DUCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) (dvalue + .5);\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffuintfi2(unsigned int *input,  /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            short *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] > SHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n                output[ii] = input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DSHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MIN;\n            }\n            else if (dvalue > DSHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (short) (dvalue + .5);\n                else\n                    output[ii] = (short) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffuintfi4(unsigned int *input,  /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            INT32BIT *output,  /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 2147483648.)\n    {       \n        /* Instead of subtracting 2147483648, it is more efficient */\n        /* to just flip the sign bit with the XOR operator */\n\n        for (ii = 0; ii < ntodo; ii++)\n             output[ii] =  ( *(int *) &input[ii] ) ^ 0x80000000;\n    }\n    else if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] > INT32_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n                output[ii] = input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (INT32BIT) (dvalue + .5);\n                else\n                    output[ii] = (INT32BIT) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffuintfi8(unsigned int *input,  /* I - array of values to be converted  */\n            long ntodo,             /* I - number of elements in the array  */\n            double scale,           /* I - FITS TSCALn or BSCALE value      */\n            double zero,            /* I - FITS TZEROn or BZERO  value      */\n            LONGLONG *output,       /* O - output array of converted values */\n            int *status)            /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero ==  9223372036854775808.)\n    {       \n        /* Writing to unsigned long long column. */\n        /* Instead of subtracting 9223372036854775808, it is more efficient */\n        /* and more precise to just flip the sign bit with the XOR operator */\n\n        /* no need to check range limits because all unsigned int values */\n\t/* are valid ULONGLONG values. */\n\n        for (ii = 0; ii < ntodo; ii++) {\n             output[ii] =  ((LONGLONG) input[ii]) ^ 0x8000000000000000;\n        }\n    }\n    else if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++) {\n                output[ii] = input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DLONGLONG_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MIN;\n            }\n            else if (dvalue > DLONGLONG_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (LONGLONG) (dvalue + .5);\n                else\n                    output[ii] = (LONGLONG) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffuintfr4(unsigned int *input,  /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            float *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (float) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (float) ((input[ii] - zero) / scale);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffuintfr8(unsigned int *input,  /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            double *output,    /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (double) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (input[ii] - zero) / scale;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffuintfstr(unsigned int *input, /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            char *cform,       /* I - format for output string values  */\n            long twidth,       /* I - width of each field, in chars    */\n            char *output,      /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n    char *cptr;\n    \n    cptr = output;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n           sprintf(output, cform, (double) input[ii]);\n           output += twidth;\n\n           if (*output)  /* if this char != \\0, then overflow occurred */\n              *status = OVERFLOW_ERR;\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n          dvalue = (input[ii] - zero) / scale;\n          sprintf(output, cform, dvalue);\n          output += twidth;\n\n          if (*output)  /* if this char != \\0, then overflow occurred */\n            *status = OVERFLOW_ERR;\n        }\n    }\n\n    /* replace any commas with periods (e.g., in French locale) */\n    while ((cptr = strchr(cptr, ','))) *cptr = '.';\n    \n    return(*status);\n}\n"},{"id":16680,"name":"putcoli.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, putcoli.c, contains routines that write data elements to    */\n/*  a FITS image or table, with short datatype.                            */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <limits.h>\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffppri( fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write (1 = 1st group)          */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            short *array,    /* I - array of values that are written        */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n    short nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n\n        fits_write_compressed_pixels(fptr, TSHORT, firstelem, nelem,\n            0, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcli(fptr, 2, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffppni( fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            short *array,    /* I - array of values that are written        */\n            short nulval,    /* I - undefined pixel value                   */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).  Any array values\n  that are equal to the value of nulval will be replaced with the null\n  pixel value that is appropriate for this column.\n*/\n{\n    long row;\n    short nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        nullvalue = nulval;  /* set local variable */\n        fits_write_compressed_pixels(fptr, TSHORT, firstelem, nelem,\n            1, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcni(fptr, 2, row, firstelem, nelem, array, nulval, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp2di(fitsfile *fptr,   /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           short *array,     /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    /* call the 3D writing routine, with the 3rd dimension = 1 */\n\n    ffp3di(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp3di(fitsfile *fptr,   /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  nrows,      /* I - number of rows in each plane of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           LONGLONG  naxis3,     /* I - FITS image NAXIS3 value               */\n           short *array,     /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 3-D cube of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    long tablerow, ii, jj;\n    long fpixel[3]= {1,1,1}, lpixel[3];\n    LONGLONG nfits, narray;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n           \n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n        lpixel[0] = (long) ncols;\n        lpixel[1] = (long) nrows;\n        lpixel[2] = (long) naxis3;\n       \n        fits_write_compressed_img(fptr, TSHORT, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n      /* all the image pixels are contiguous, so write all at once */\n      ffpcli(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status);\n      return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to write to */\n    narray = 0;  /* next pixel in input array to be written */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* writing naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffpcli(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0)\n         return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpssi(fitsfile *fptr,   /* I - FITS file pointer                       */\n           long  group,      /* I - group to write(1 = 1st group)           */\n           long  naxis,      /* I - number of data axes in array            */\n           long  *naxes,     /* I - size of each FITS axis                  */\n           long  *fpixel,    /* I - 1st pixel in each axis to write (1=1st) */\n           long  *lpixel,    /* I - last pixel in each axis to write        */\n           short *array,     /* I - array to be written                     */\n           int  *status)     /* IO - error status                           */\n/*\n  Write a subsection of pixels to the primary array or image.\n  A subsection is defined to be any contiguous rectangular\n  array of pixels within the n-dimensional FITS data file.\n  Data conversion and scaling will be performed if necessary \n  (e.g, if the datatype of the FITS array is not the same as\n  the array being written).\n*/\n{\n    long tablerow;\n    LONGLONG fpix[7], dimen[7], astart, pstart;\n    LONGLONG off2, off3, off4, off5, off6, off7;\n    LONGLONG st10, st20, st30, st40, st50, st60, st70;\n    LONGLONG st1, st2, st3, st4, st5, st6, st7;\n    long ii, i1, i2, i3, i4, i5, i6, i7, irange[7];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_img(fptr, TSHORT, fpixel, lpixel,\n            0,  array, NULL, status);\n\n        return(*status);\n    }\n\n    if (naxis < 1 || naxis > 7)\n      return(*status = BAD_DIMEN);\n\n    tablerow=maxvalue(1,group);\n\n     /* calculate the size and number of loops to perform in each dimension */\n    for (ii = 0; ii < 7; ii++)\n    {\n      fpix[ii]=1;\n      irange[ii]=1;\n      dimen[ii]=1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {    \n      fpix[ii]=fpixel[ii];\n      irange[ii]=lpixel[ii]-fpixel[ii]+1;\n      dimen[ii]=naxes[ii];\n    }\n\n    i1=irange[0];\n\n    /* compute the pixel offset between each dimension */\n    off2 =     dimen[0];\n    off3 = off2 * dimen[1];\n    off4 = off3 * dimen[2];\n    off5 = off4 * dimen[3];\n    off6 = off5 * dimen[4];\n    off7 = off6 * dimen[5];\n\n    st10 = fpix[0];\n    st20 = (fpix[1] - 1) * off2;\n    st30 = (fpix[2] - 1) * off3;\n    st40 = (fpix[3] - 1) * off4;\n    st50 = (fpix[4] - 1) * off5;\n    st60 = (fpix[5] - 1) * off6;\n    st70 = (fpix[6] - 1) * off7;\n\n    /* store the initial offset in each dimension */\n    st1 = st10;\n    st2 = st20;\n    st3 = st30;\n    st4 = st40;\n    st5 = st50;\n    st6 = st60;\n    st7 = st70;\n\n    astart = 0;\n\n    for (i7 = 0; i7 < irange[6]; i7++)\n    {\n     for (i6 = 0; i6 < irange[5]; i6++)\n     {\n      for (i5 = 0; i5 < irange[4]; i5++)\n      {\n       for (i4 = 0; i4 < irange[3]; i4++)\n       {\n        for (i3 = 0; i3 < irange[2]; i3++)\n        {\n         pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7;\n\n         for (i2 = 0; i2 < irange[1]; i2++)\n         {\n           if (ffpcli(fptr, 2, tablerow, pstart, i1, &array[astart],\n              status) > 0)\n              return(*status);\n\n           astart += i1;\n           pstart += off2;\n         }\n         st2 = st20;\n         st3 = st3+off3;    \n        }\n        st3 = st30;\n        st4 = st4+off4;\n       }\n       st4 = st40;\n       st5 = st5+off5;\n      }\n      st5 = st50;\n      st6 = st6+off6;\n     }\n     st6 = st60;\n     st7 = st7+off7;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpgpi( fitsfile *fptr,   /* I - FITS file pointer                      */\n            long  group,      /* I - group to write(1 = 1st group)          */\n            long  firstelem,  /* I - first vector element to write(1 = 1st) */\n            long  nelem,      /* I - number of values to write              */\n            short *array,     /* I - array of values that are written       */\n            int  *status)     /* IO - error status                          */\n/*\n  Write an array of group parameters to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffpcli(fptr, 1L, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcli( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            short *array,    /* I - array of values to write                */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer to a virtual column in a 1 or more grouped FITS primary\n  array.  FITSIO treats a primary array as a binary table with\n  2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    int tcode, maxelem2, hdutype, writeraw;\n    long twidth, incre;\n    long ntodo;\n    LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull, maxelem;\n    double scale, zero;\n    char tform[20], cform[20];\n    char message[FLEN_ERRMSG];\n\n    char snull[20];   /*  the FITS null value  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem2, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n    maxelem = maxelem2;\n\n    if (tcode == TSTRING)   \n         ffcfmt(tform, cform);     /* derive C format for writing strings */\n\n    /*\n      if there is no scaling and the native machine format is not byteswapped,\n      then we can simply write the raw data bytes into the FITS file if the\n      datatype of the FITS column is the same as the input values.  Otherwise,\n      we must convert the raw values into the scaled and/or machine dependent\n      format in a temporary buffer that has been allocated for this purpose.\n    */\n    if (scale == 1. && zero == 0. &&\n       MACHINE == NATIVE && tcode == TSHORT)\n    {\n        writeraw = 1;\n        if (nelem < (LONGLONG)INT32_MAX) {\n            maxelem = nelem;\n        } else {\n            maxelem = INT32_MAX/2;\n        }\n    }\n    else\n        writeraw = 0;\n\n    /*---------------------------------------------------------------------*/\n    /*  Now write the pixels to the FITS column.                           */\n    /*  First call the ffXXfYY routine to  (1) convert the datatype        */\n    /*  if necessary, and (2) scale the values by the FITS TSCALn and      */\n    /*  TZEROn linear scaling parameters into a temporary buffer.          */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to write  */\n    next = 0;                 /* next element in array to be written  */\n    rownum = 0;               /* row number, relative to firstrow     */\n\n    while (remain)\n    {\n        /* limit the number of pixels to process a one time to the number that\n           will fit in the buffer space or to the number of pixels that remain\n           in the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);      \n        ntodo = (long) minvalue(ntodo, (repeat - elemnum));\n\n        wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre);\n\n        ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */\n\n        switch (tcode) \n        {\n            case (TSHORT):\n              if (writeraw)\n              {\n                /* write raw input bytes without conversion */\n                ffpi2b(fptr, ntodo, incre, &array[next], status);\n              }\n              else\n              {\n                /* convert the raw data before writing to FITS file */\n                ffi2fi2(&array[next], ntodo, scale, zero,\n                        (short *) buffer, status);\n                ffpi2b(fptr, ntodo, incre, (short *) buffer, status);\n              }\n\n              break;\n\n            case (TLONGLONG):\n\n                ffi2fi8(&array[next], ntodo, scale, zero,\n                        (LONGLONG *) buffer, status);\n                ffpi8b(fptr, ntodo, incre, (long *) buffer, status);\n                break;\n\n             case (TBYTE):\n\n                ffi2fi1(&array[next], ntodo, scale, zero,\n                        (unsigned char *) buffer, status);\n                ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status);\n                break;\n\n            case (TLONG):\n\n                ffi2fi4(&array[next], ntodo, scale, zero,\n                        (INT32BIT *) buffer, status);\n                ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status);\n                break;\n\n            case (TFLOAT):\n\n                ffi2fr4(&array[next], ntodo, scale, zero,\n                        (float *) buffer, status);\n                ffpr4b(fptr, ntodo, incre, (float *) buffer, status);\n                break;\n\n            case (TDOUBLE):\n                ffi2fr8(&array[next], ntodo, scale, zero,\n                        (double *) buffer, status);\n                ffpr8b(fptr, ntodo, incre, (double *) buffer, status);\n                break;\n\n            case (TSTRING):  /* numerical column in an ASCII table */\n\n                if (cform[1] != 's')  /*  \"%s\" format is a string */\n                {\n                  ffi2fstr(&array[next], ntodo, scale, zero, cform,\n                          twidth, (char *) buffer, status);\n\n\n                  if (incre == twidth)    /* contiguous bytes */\n                     ffpbyt(fptr, ntodo * twidth, buffer, status);\n                  else\n                     ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                            status);\n\n                  break;\n                }\n                /* can't write to string column, so fall thru to default: */\n\n            default:  /*  error trap  */\n                snprintf(message,FLEN_ERRMSG, \n                    \"Cannot write numbers to column %d which has format %s\",\n                      colnum,tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous write operation */\n        {\n         snprintf(message,FLEN_ERRMSG,\n          \"Error writing elements %.0f thru %.0f of input data array (ffpcli).\",\n             (double) (next+1), (double) (next+ntodo));\n         ffpmsg(message);\n         return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum += ntodo;\n            if (elemnum == repeat)  /* completed a row; start on next row */\n            {\n                elemnum = 0;\n                rownum++;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n       ffpmsg(\n       \"Numerical overflow during type conversion while writing FITS data.\");\n       *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcni( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            short *array,    /* I - array of values to write                */\n            short  nulvalue, /* I - value used to flag undefined pixels     */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of elements to the specified column of a table.  Any input\n  pixels equal to the value of nulvalue will be replaced by the appropriate\n  null value in the output FITS file. \n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary\n*/\n{\n    tcolumn *colptr;\n    LONGLONG  ngood = 0, nbad = 0, ii;\n    LONGLONG repeat, first, fstelm, fstrow;\n    int tcode, overflow = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n    }\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n\n    tcode  = colptr->tdatatype;\n\n    if (tcode > 0)\n       repeat = colptr->trepeat;  /* repeat count for this column */\n    else\n       repeat = firstelem -1 + nelem;  /* variable length arrays */\n\n    /* if variable length array, first write the whole input vector, \n       then go back and fill in the nulls */\n    if (tcode < 0) {\n      if (ffpcli(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) {\n        if (*status == NUM_OVERFLOW) \n\t{\n\t  /* ignore overflows, which are possibly the null pixel values */\n\t  /*  overflow = 1;   */\n\t  *status = 0;\n\t} else { \n          return(*status);\n\t}\n      }\n    }\n\n    /* absolute element number in the column */\n    first = (firstrow - 1) * repeat + firstelem;\n\n    for (ii = 0; ii < nelem; ii++)\n    {\n      if (array[ii] != nulvalue)  /* is this a good pixel? */\n      {\n         if (nbad)  /* write previous string of bad pixels */\n         {\n            fstelm = ii - nbad + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0)\n                return(*status);\n\n            nbad=0;\n         }\n\n         ngood = ngood +1;  /* the consecutive number of good pixels */\n      }\n      else\n      {\n         if (ngood)  /* write previous string of good pixels */\n         {\n            fstelm = ii - ngood + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (tcode > 0) {  /* variable length arrays have already been written */\n              if (ffpcli(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood],\n                status) > 0) {\n\t\tif (*status == NUM_OVERFLOW) \n\t\t{\n\t\t  overflow = 1;\n\t\t  *status = 0;\n\t\t} else { \n                  return(*status);\n\t\t}\n\t      }\n\t    }\n            ngood=0;\n         }\n\n         nbad = nbad +1;  /* the consecutive number of bad pixels */\n      }\n    }\n\n    /* finished loop;  now just write the last set of pixels */\n\n    if (ngood)  /* write last string of good pixels */\n    {\n      fstelm = ii - ngood + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      if (tcode > 0) {  /* variable length arrays have already been written */\n        ffpcli(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status);\n      }\n    }\n    else if (nbad) /* write last string of bad pixels */\n    {\n      fstelm = ii - nbad + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      ffpclu(fptr, colnum, fstrow, fstelm, nbad, status);\n    }\n\n    if (*status <= 0) {\n      if (overflow) {\n        *status = NUM_OVERFLOW;\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi2fi1(short *input,          /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            unsigned char *output, /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] < 0)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (input[ii] > UCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DUCHAR_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (dvalue > DUCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) (dvalue + .5);\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi2fi2(short *input,       /* I - array of values to be converted  */\n            long ntodo,         /* I - number of elements in the array  */\n            double scale,       /* I - FITS TSCALn or BSCALE value      */\n            double zero,        /* I - FITS TZEROn or BZERO  value      */\n            short *output,      /* O - output array of converted values */\n            int *status)        /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        memcpy(output, input, ntodo * sizeof(short) );\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DSHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MIN;\n            }\n            else if (dvalue > DSHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (short) (dvalue + .5);\n                else\n                    output[ii] = (short) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi2fi4(short *input,      /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            INT32BIT *output,  /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (INT32BIT) input[ii];   /* just copy input to output */\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (INT32BIT) (dvalue + .5);\n                else\n                    output[ii] = (INT32BIT) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi2fi8(short *input,      /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            LONGLONG *output,  /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero ==  9223372036854775808.)\n    {       \n        /* Writing to unsigned long long column. Input values must not be negative */\n        /* Instead of subtracting 9223372036854775808, it is more efficient */\n        /* and more precise to just flip the sign bit with the XOR operator */\n\n        for (ii = 0; ii < ntodo; ii++) {\n           if (input[ii] < 0) {\n              *status = OVERFLOW_ERR;\n              output[ii] = LONGLONG_MIN;\n           } else {\n              output[ii] =  ((LONGLONG) input[ii]) ^ 0x8000000000000000;\n           }\n        }\n    }\n    else if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DLONGLONG_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MIN;\n            }\n            else if (dvalue > DLONGLONG_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (LONGLONG) (dvalue + .5);\n                else\n                    output[ii] = (LONGLONG) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi2fr4(short *input,      /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            float *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (float) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (float) ((input[ii] - zero) / scale);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi2fr8(short *input,      /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            double *output,    /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (double) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (input[ii] - zero) / scale;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi2fstr(short *input,     /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            char *cform,       /* I - format for output string values  */\n            long twidth,       /* I - width of each field, in chars    */\n            char *output,      /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n    char *cptr;\n    \n    cptr = output;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n           sprintf(output, cform, (double) input[ii]);\n           output += twidth;\n\n           if (*output)  /* if this char != \\0, then overflow occurred */\n              *status = OVERFLOW_ERR;\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n          dvalue = (input[ii] - zero) / scale;\n          sprintf(output, cform, dvalue);\n          output += twidth;\n\n          if (*output)  /* if this char != \\0, then overflow occurred */\n            *status = OVERFLOW_ERR;\n        }\n    }\n\n    /* replace any commas with periods (e.g., in French locale) */\n    while ((cptr = strchr(cptr, ','))) *cptr = '.';\n\n    return(*status);\n}\n"},{"id":16681,"name":"eval_f.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/************************************************************************/\n/*                                                                      */\n/*                       CFITSIO Lexical Parser                         */\n/*                                                                      */\n/* This file is one of 3 files containing code which parses an          */\n/* arithmetic expression and evaluates it in the context of an input    */\n/* FITS file table extension.  The CFITSIO lexical parser is divided    */\n/* into the following 3 parts/files: the CFITSIO \"front-end\",           */\n/* eval_f.c, contains the interface between the user/CFITSIO and the    */\n/* real core of the parser; the FLEX interpreter, eval_l.c, takes the   */\n/* input string and parses it into tokens and identifies the FITS       */\n/* information required to evaluate the expression (ie, keywords and    */\n/* columns); and, the BISON grammar and evaluation routines, eval_y.c,  */\n/* receives the FLEX output and determines and performs the actual      */\n/* operations.  The files eval_l.c and eval_y.c are produced from       */\n/* running flex and bison on the files eval.l and eval.y, respectively. */\n/* (flex and bison are available from any GNU archive: see www.gnu.org) */\n/*                                                                      */\n/* The grammar rules, rather than evaluating the expression in situ,    */\n/* builds a tree, or Nodal, structure mapping out the order of          */\n/* operations and expression dependencies.  This \"compilation\" process  */\n/* allows for much faster processing of multiple rows.  This technique  */\n/* was developed by Uwe Lammers of the XMM Science Analysis System,     */\n/* although the CFITSIO implementation is entirely code original.       */\n/*                                                                      */\n/*                                                                      */\n/* Modification History:                                                */\n/*                                                                      */\n/*   Kent Blackburn      c1992  Original parser code developed for the  */\n/*                              FTOOLS software package, in particular, */\n/*                              the fselect task.                       */\n/*   Kent Blackburn      c1995  BIT column support added                */\n/*   Peter D Wilson   Feb 1998  Vector column support added             */\n/*   Peter D Wilson   May 1998  Ported to CFITSIO library.  User        */\n/*                              interface routines written, in essence  */\n/*                              making fselect, fcalc, and maketime     */\n/*                              capabilities available to all tools     */\n/*                              via single function calls.              */\n/*   Peter D Wilson   Jun 1998  Major rewrite of parser core, so as to  */\n/*                              create a run-time evaluation tree,      */\n/*                              inspired by the work of Uwe Lammers,    */\n/*                              resulting in a speed increase of        */\n/*                              10-100 times.                           */\n/*   Peter D Wilson   Jul 1998  gtifilter(a,b,c,d) function added       */\n/*   Peter D Wilson   Aug 1998  regfilter(a,b,c,d) function added       */\n/*   Peter D Wilson   Jul 1999  Make parser fitsfile-independent,       */\n/*                              allowing a purely vector-based usage    */\n/*   Peter D Wilson   Aug 1999  Add row-offset capability               */\n/*   Peter D Wilson   Sep 1999  Add row-range capability to ffcalc_rng  */\n/*                                                                      */\n/************************************************************************/\n\n#include <limits.h>\n#include <ctype.h>\n#include \"eval_defs.h\"\n#include \"region.h\"\n\ntypedef struct {\n     int  datatype;   /* Data type to cast parse results into for user       */\n     void *dataPtr;   /* Pointer to array of results, NULL if to use iterCol */\n     void *nullPtr;   /* Pointer to nulval, use zero if NULL                 */\n     long maxRows;    /* Max No. of rows to process, -1=all, 0=1 iteration   */\n     int  anyNull;    /* Flag indicating at least 1 undef value encountered  */\n} parseInfo;\n\n/*  Internal routines needed to allow the evaluator to operate on FITS data  */\n\nstatic void Setup_DataArrays( int nCols, iteratorCol *cols,\n                              long fRow, long nRows );\nstatic int  find_column( char *colName, void *itslval );\nstatic int  find_keywd ( char *key,     void *itslval );\nstatic int  allocateCol( int nCol, int *status );\nstatic int  load_column( int varNum, long fRow, long nRows,\n                         void *data, char *undef );\n\nstatic int DEBUG_PIXFILTER;\n\n#define FREE(x) { if (x) free(x); else printf(\"invalid free(\" #x \") at %s:%d\\n\", __FILE__, __LINE__); }\n\n/*---------------------------------------------------------------------------*/\nint fffrow( fitsfile *fptr,         /* I - Input FITS file                   */\n            char     *expr,         /* I - Boolean expression                */\n            long     firstrow,      /* I - First row of table to eval        */\n            long     nrows,         /* I - Number of rows to evaluate        */\n            long     *n_good_rows,  /* O - Number of rows eval to True       */\n            char     *row_status,   /* O - Array of boolean results          */\n            int      *status )      /* O - Error status                      */\n/*                                                                           */\n/* Evaluate a boolean expression using the indicated rows, returning an      */\n/* array of flags indicating which rows evaluated to TRUE/FALSE              */\n/*---------------------------------------------------------------------------*/\n{\n   parseInfo Info;\n   int naxis, constant;\n   long nelem, naxes[MAXDIMS], elem;\n   char result;\n\n   if( *status ) return( *status );\n\n   FFLOCK;\n   if( ffiprs( fptr, 0, expr, MAXDIMS, &Info.datatype, &nelem, &naxis,\n               naxes, status ) ) {\n      ffcprs();\n      FFUNLOCK;\n      return( *status );\n   }\n   if( nelem<0 ) {\n      constant = 1;\n      nelem = -nelem;\n   } else\n      constant = 0;\n\n   if( Info.datatype!=TLOGICAL || nelem!=1 ) {\n      ffcprs();\n      ffpmsg(\"Expression does not evaluate to a logical scalar.\");\n      FFUNLOCK;\n      return( *status = PARSE_BAD_TYPE );\n   }\n\n   if( constant ) { /* No need to call parser... have result from ffiprs */\n      result = gParse.Nodes[gParse.resultNode].value.data.log;\n      *n_good_rows = nrows;\n      for( elem=0; elem<nrows; elem++ )\n         row_status[elem] = result;\n   } else {\n      firstrow     = (firstrow>1 ? firstrow : 1);\n      Info.dataPtr = row_status;\n      Info.nullPtr = NULL;\n      Info.maxRows = nrows;\n\n      if( ffiter( gParse.nCols, gParse.colData, firstrow-1, 0,\n                  parse_data, (void*)&Info, status ) == -1 )\n         *status = 0;  /* -1 indicates exitted without error before end... OK */\n\n      if( *status ) {\n\n         /***********************/\n         /* Error... Do nothing */\n         /***********************/\n\n      } else {\n\n         /***********************************/\n         /* Count number of good rows found */\n         /***********************************/\n\n         *n_good_rows = 0L;\n         for( elem=0; elem<Info.maxRows; elem++ ) {\n            if( row_status[elem]==1 ) ++*n_good_rows;\n         }\n      }\n   }\n\n   ffcprs();\n   FFUNLOCK;\n   return(*status);\n}\n\n/*--------------------------------------------------------------------------*/\nint ffsrow( fitsfile *infptr,   /* I - Input FITS file                      */\n            fitsfile *outfptr,  /* I - Output FITS file                     */\n            char     *expr,     /* I - Boolean expression                   */\n            int      *status )  /* O - Error status                         */\n/*                                                                          */\n/* Evaluate an expression on all rows of a table.  If the input and output  */\n/* files are not the same, copy the TRUE rows to the output file.  If the   */\n/* files are the same, delete the FALSE rows (preserve the TRUE rows).      */\n/* Can copy rows between extensions of the same file, *BUT* if output       */\n/* extension is before the input extension, the second extension *MUST* be  */\n/* opened using ffreopen, so that CFITSIO can handle changing file lengths. */\n/*--------------------------------------------------------------------------*/\n{\n   parseInfo Info;\n   int naxis, constant;\n   long nelem, rdlen, naxes[MAXDIMS], maxrows, nbuff, nGood, inloc, outloc;\n   LONGLONG ntodo, inbyteloc, outbyteloc, hsize;\n   long freespace;\n   unsigned char *buffer, result;\n   struct {\n      LONGLONG rowLength, numRows, heapSize;\n      LONGLONG dataStart, heapStart;\n   } inExt, outExt;\n\n   if( *status ) return( *status );\n\n   FFLOCK;\n   if( ffiprs( infptr, 0, expr, MAXDIMS, &Info.datatype, &nelem, &naxis,\n               naxes, status ) ) {\n      ffcprs();\n      FFUNLOCK;\n      return( *status );\n   }\n\n   if( nelem<0 ) {\n      constant = 1;\n      nelem = -nelem;\n   } else\n      constant = 0;\n\n   /**********************************************************************/\n   /* Make sure expression evaluates to the right type... logical scalar */\n   /**********************************************************************/\n\n   if( Info.datatype!=TLOGICAL || nelem!=1 ) {\n      ffcprs();\n      ffpmsg(\"Expression does not evaluate to a logical scalar.\");\n      FFUNLOCK;\n      return( *status = PARSE_BAD_TYPE );\n   }\n\n   /***********************************************************/\n   /*  Extract various table information from each extension  */\n   /***********************************************************/\n\n   if( infptr->HDUposition != (infptr->Fptr)->curhdu )\n      ffmahd( infptr, (infptr->HDUposition) + 1, NULL, status );\n   if( *status ) {\n      ffcprs();\n      FFUNLOCK;\n      return( *status );\n   }\n   inExt.rowLength = (long) (infptr->Fptr)->rowlength;\n   inExt.numRows   = (infptr->Fptr)->numrows;\n   inExt.heapSize  = (infptr->Fptr)->heapsize;\n   if( inExt.numRows == 0 ) { /* Nothing to copy */\n      ffcprs();\n      FFUNLOCK;\n      return( *status );\n   }\n\n   if( outfptr->HDUposition != (outfptr->Fptr)->curhdu )\n      ffmahd( outfptr, (outfptr->HDUposition) + 1, NULL, status );\n   if( (outfptr->Fptr)->datastart < 0 )\n      ffrdef( outfptr, status );\n   if( *status ) {\n      ffcprs();\n      FFUNLOCK;\n      return( *status );\n   }\n   outExt.rowLength = (long) (outfptr->Fptr)->rowlength;\n   outExt.numRows   = (outfptr->Fptr)->numrows;\n   if( !outExt.numRows )\n      (outfptr->Fptr)->heapsize = 0L;\n   outExt.heapSize  = (outfptr->Fptr)->heapsize;\n\n   if( inExt.rowLength != outExt.rowLength ) {\n      ffpmsg(\"Output table has different row length from input\");\n      ffcprs();\n      FFUNLOCK;\n      return( *status = PARSE_BAD_OUTPUT );\n   }\n\n   /***********************************/\n   /*  Fill out Info data for parser  */\n   /***********************************/\n\n   Info.dataPtr = (char *)malloc( (size_t) ((inExt.numRows + 1) * sizeof(char)) );\n   Info.nullPtr = NULL;\n   Info.maxRows = (long) inExt.numRows;\n   if( !Info.dataPtr ) {\n      ffpmsg(\"Unable to allocate memory for row selection\");\n      ffcprs();\n      FFUNLOCK;\n      return( *status = MEMORY_ALLOCATION );\n   }\n   \n   /* make sure array is zero terminated */\n   ((char*)Info.dataPtr)[inExt.numRows] = 0;\n\n   if( constant ) { /*  Set all rows to the same value from constant result  */\n\n      result = gParse.Nodes[gParse.resultNode].value.data.log;\n      for( ntodo = 0; ntodo<inExt.numRows; ntodo++ )\n         ((char*)Info.dataPtr)[ntodo] = result;\n      nGood = (long) (result ? inExt.numRows : 0);\n\n   } else {\n\n      ffiter( gParse.nCols, gParse.colData, 0L, 0L,\n              parse_data, (void*)&Info, status );\n\n      nGood = 0;\n      for( ntodo = 0; ntodo<inExt.numRows; ntodo++ )\n         if( ((char*)Info.dataPtr)[ntodo] ) nGood++;\n   }\n\n   if( *status ) {\n      /* Error... Do nothing */\n   } else {\n      rdlen  = (long) inExt.rowLength;\n      buffer = (unsigned char *)malloc(maxvalue(500000,rdlen) * sizeof(char) );\n      if( buffer==NULL ) {\n         ffcprs();\n         FFUNLOCK;\n         return( *status=MEMORY_ALLOCATION );\n      }\n      maxrows = maxvalue( (500000L/rdlen), 1);\n      nbuff = 0;\n      inloc = 1;\n      if( infptr==outfptr ) { /* Skip initial good rows if input==output file */\n         while( ((char*)Info.dataPtr)[inloc-1] ) inloc++;\n         outloc = inloc;\n      } else {\n         outloc = (long) (outExt.numRows + 1);\n         if (outloc > 1) \n            ffirow( outfptr, outExt.numRows, nGood, status );\n      }\n\n      do {\n         if( ((char*)Info.dataPtr)[inloc-1] ) {\n            ffgtbb( infptr, inloc, 1L, rdlen, buffer+rdlen*nbuff, status );\n            nbuff++;\n            if( nbuff==maxrows ) {\n               ffptbb( outfptr, outloc, 1L, rdlen*nbuff, buffer,  status );\n               outloc += nbuff;\n               nbuff = 0;\n            }\n         }\n         inloc++;\n      } while( !*status && inloc<=inExt.numRows );\n\n      if( nbuff ) {\n         ffptbb( outfptr, outloc, 1L, rdlen*nbuff, buffer,  status );\n         outloc += nbuff;\n      }\n\n      if( infptr==outfptr ) {\n\n         if( outloc<=inExt.numRows )\n            ffdrow( infptr, outloc, inExt.numRows-outloc+1, status );\n\n      } else if( inExt.heapSize && nGood ) {\n\n         /* Copy heap, if it exists and at least one row copied */\n\n         /********************************************************/\n         /*  Get location information from the output extension  */\n         /********************************************************/\n\n         if( outfptr->HDUposition != (outfptr->Fptr)->curhdu )\n            ffmahd( outfptr, (outfptr->HDUposition) + 1, NULL, status );\n         outExt.dataStart = (outfptr->Fptr)->datastart;\n         outExt.heapStart = (outfptr->Fptr)->heapstart;\n\n         /*************************************************/\n         /*  Insert more space into outfptr if necessary  */\n         /*************************************************/\n\n         hsize     = outExt.heapStart + outExt.heapSize;\n         freespace = (long) (( ( (hsize + 2879) / 2880) * 2880) - hsize);\n         ntodo     = inExt.heapSize;\n\n         if ( (freespace - ntodo) < 0) {       /* not enough existing space? */\n            ntodo = (ntodo - freespace + 2879) / 2880;  /* number of blocks  */\n            ffiblk(outfptr, (long) ntodo, 1, status);   /* insert the blocks */\n         }\n         ffukyj( outfptr, \"PCOUNT\", inExt.heapSize+outExt.heapSize,\n                 NULL, status );\n\n         /*******************************************************/\n         /*  Get location information from the input extension  */\n         /*******************************************************/\n\n         if( infptr->HDUposition != (infptr->Fptr)->curhdu )\n            ffmahd( infptr, (infptr->HDUposition) + 1, NULL, status );\n         inExt.dataStart = (infptr->Fptr)->datastart;\n         inExt.heapStart = (infptr->Fptr)->heapstart;\n\n         /**********************************/\n         /*  Finally copy heap to outfptr  */\n         /**********************************/\n\n         ntodo  =  inExt.heapSize;\n         inbyteloc  =  inExt.heapStart +  inExt.dataStart;\n         outbyteloc = outExt.heapStart + outExt.dataStart + outExt.heapSize;\n\n         while ( ntodo && !*status ) {\n            rdlen = (long) minvalue(ntodo,500000);\n            ffmbyt( infptr,  inbyteloc,  REPORT_EOF, status );\n            ffgbyt( infptr,  rdlen,  buffer,     status );\n            ffmbyt( outfptr, outbyteloc, IGNORE_EOF, status );\n            ffpbyt( outfptr, rdlen,  buffer,     status );\n            inbyteloc  += rdlen;\n            outbyteloc += rdlen;\n            ntodo  -= rdlen;\n         }\n\n         /***********************************************************/\n         /*  But must update DES if data is being appended to a     */\n         /*  pre-existing heap space.  Edit each new entry in file  */\n         /***********************************************************/\n\n         if( outExt.heapSize ) {\n            LONGLONG repeat, offset, j;\n            int i;\n            for( i=1; i<=(outfptr->Fptr)->tfield; i++ ) {\n               if( (outfptr->Fptr)->tableptr[i-1].tdatatype<0 ) {\n                  for( j=outExt.numRows+1; j<=outExt.numRows+nGood; j++ ) {\n                     ffgdesll( outfptr, i, j, &repeat, &offset, status );\n                     offset += outExt.heapSize;\n                     ffpdes( outfptr, i, j, repeat, offset, status );\n                  }\n               }\n            }\n         }\n\n      } /*  End of HEAP copy  */\n\n      FREE(buffer);\n   }\n\n   FREE(Info.dataPtr);\n   ffcprs();\n\n   ffcmph(outfptr, status);  /* compress heap, deleting any orphaned data */\n   FFUNLOCK;\n   return(*status);\n}\n\n/*---------------------------------------------------------------------------*/\nint ffcrow( fitsfile *fptr,      /* I - Input FITS file                      */\n            int      datatype,   /* I - Datatype to return results as        */\n            char     *expr,      /* I - Arithmetic expression                */\n            long     firstrow,   /* I - First row to evaluate                */\n            long     nelements,  /* I - Number of elements to return         */\n            void     *nulval,    /* I - Ptr to value to use as UNDEF         */\n            void     *array,     /* O - Array of results                     */\n            int      *anynul,    /* O - Were any UNDEFs encountered?         */\n            int      *status )   /* O - Error status                         */\n/*                                                                           */\n/* Calculate an expression for the indicated rows of a table, returning      */\n/* the results, cast as datatype (TSHORT, TDOUBLE, etc), in array.  If       */\n/* nulval==NULL, UNDEFs will be zeroed out.  For vector results, the number  */\n/* of elements returned may be less than nelements if nelements is not an    */\n/* even multiple of the result dimension.  Call fftexp to obtain the         */\n/* dimensions of the results.                                                */\n/*---------------------------------------------------------------------------*/\n{\n   parseInfo Info;\n   int naxis;\n   long nelem1, naxes[MAXDIMS];\n\n   if( *status ) return( *status );\n\n   FFLOCK;\n   if( ffiprs( fptr, 0, expr, MAXDIMS, &Info.datatype, &nelem1, &naxis,\n               naxes, status ) ) {\n      ffcprs();\n      FFUNLOCK;\n      return( *status );\n   }\n   if( nelem1<0 ) nelem1 = - nelem1;\n\n   if( nelements<nelem1 ) {\n      ffcprs();\n      ffpmsg(\"Array not large enough to hold at least one row of data.\");\n      FFUNLOCK;\n      return( *status = PARSE_LRG_VECTOR );\n   }\n\n   firstrow = (firstrow>1 ? firstrow : 1);\n\n   if( datatype ) Info.datatype = datatype;\n\n   Info.dataPtr = array;\n   Info.nullPtr = nulval;\n   Info.maxRows = nelements / nelem1;\n   \n   if( ffiter( gParse.nCols, gParse.colData, firstrow-1, 0,\n               parse_data, (void*)&Info, status ) == -1 )\n      *status=0;  /* -1 indicates exitted without error before end... OK */\n\n   *anynul = Info.anyNull;\n   ffcprs();\n   FFUNLOCK;\n   return( *status );\n}\n\n/*--------------------------------------------------------------------------*/\nint ffcalc( fitsfile *infptr,   /* I - Input FITS file                      */\n            char     *expr,     /* I - Arithmetic expression                */\n            fitsfile *outfptr,  /* I - Output fits file                     */\n            char     *parName,  /* I - Name of output parameter             */\n            char     *parInfo,  /* I - Extra information on parameter       */\n            int      *status )  /* O - Error status                         */\n/*                                                                          */\n/* Evaluate an expression for all rows of a table.  Call ffcalc_rng with    */\n/* a row range of 1-MAX.                                                    */\n{\n   long start=1, end=LONG_MAX;\n\n   return ffcalc_rng( infptr, expr, outfptr, parName, parInfo,\n                      1, &start, &end, status );\n}\n\n/*--------------------------------------------------------------------------*/\nint ffcalc_rng( fitsfile *infptr,   /* I - Input FITS file                  */\n                char     *expr,     /* I - Arithmetic expression            */\n                fitsfile *outfptr,  /* I - Output fits file                 */\n                char     *parName,  /* I - Name of output parameter         */\n                char     *parInfo,  /* I - Extra information on parameter   */\n                int      nRngs,     /* I - Row range info                   */\n                long     *start,    /* I - Row range info                   */\n                long     *end,      /* I - Row range info                   */\n                int      *status )  /* O - Error status                     */\n/*                                                                          */\n/* Evaluate an expression using the data in the input FITS file and place   */\n/* the results into either a column or keyword in the output fits file,     */\n/* depending on the value of parName (keywords normally prefixed with '#')  */\n/* and whether the expression evaluates to a constant or a table column.    */\n/* The logic is as follows:                                                 */\n/*    (1) If a column exists with name, parName, put results there.         */\n/*    (2) If parName starts with '#', as in #NAXIS, put result there,       */\n/*        with parInfo used as the comment. If expression does not evaluate */\n/*        to a constant, flag an error.                                     */\n/*    (3) If a keyword exists with name, parName, and expression is a       */\n/*        constant, put result there, using parInfo as the new comment.     */\n/*    (4) Else, create a new column with name parName and TFORM parInfo.    */\n/*        If parInfo is NULL, use a default data type for the column.       */\n/*--------------------------------------------------------------------------*/\n{\n   parseInfo Info;\n   int naxis, constant, typecode, newNullKwd=0;\n   long nelem, naxes[MAXDIMS], repeat, width;\n   int col_cnt, colNo;\n   Node *result;\n   char card[81], tform[16], nullKwd[9], tdimKwd[9];\n\n   if( *status ) return( *status );\n\n   FFLOCK;\n   if( ffiprs( infptr, 0, expr, MAXDIMS, &Info.datatype, &nelem, &naxis,\n               naxes, status ) ) {\n\n      ffcprs();\n      FFUNLOCK;\n      return( *status );\n   }\n   if( nelem<0 ) {\n      constant = 1;\n      nelem = -nelem;\n   } else\n      constant = 0;\n\n   /*  Case (1): If column exists put it there  */\n\n   colNo = 0;\n   if( ffgcno( outfptr, CASEINSEN, parName, &colNo, status )==COL_NOT_FOUND ) {\n\n      /*  Output column doesn't exist.  Test for keyword. */\n\n      /* Case (2): Does parName indicate result should be put into keyword */\n\n      *status = 0;\n      if( parName[0]=='#' ) {\n         if( ! constant ) {\n            ffcprs();\n            ffpmsg( \"Cannot put tabular result into keyword (ffcalc)\" );\n            FFUNLOCK;\n            return( *status = PARSE_BAD_TYPE );\n         }\n         parName++;  /* Advance past '#' */\n\t if ( (fits_strcasecmp(parName,\"HISTORY\") == 0 || fits_strcasecmp(parName,\"COMMENT\") == 0) &&\n\t      Info.datatype != TSTRING ) {\n            ffcprs();\n            ffpmsg( \"HISTORY and COMMENT values must be strings (ffcalc)\" );\n\t    FFUNLOCK;\n\t    return( *status = PARSE_BAD_TYPE );\n\t }\n\n      } else if( constant ) {\n\n         /* Case (3): Does a keyword named parName already exist */\n\n         if( ffgcrd( outfptr, parName, card, status )==KEY_NO_EXIST ) {\n            colNo = -1;\n         } else if( *status ) {\n            ffcprs();\n            FFUNLOCK;\n            return( *status );\n         }\n\n      } else\n         colNo = -1;\n\n      if( colNo<0 ) {\n\n         /* Case (4): Create new column */\n\n         *status = 0;\n         ffgncl( outfptr, &colNo, status );\n         colNo++;\n         if( parInfo==NULL || *parInfo=='\\0' ) {\n            /*  Figure out best default column type  */\n            if( gParse.hdutype==BINARY_TBL ) {\n               snprintf(tform,15,\"%ld\",nelem);\n               switch( Info.datatype ) {\n               case TLOGICAL:  strcat(tform,\"L\");  break;\n               case TLONG:     strcat(tform,\"J\");  break;\n               case TDOUBLE:   strcat(tform,\"D\");  break;\n               case TSTRING:   strcat(tform,\"A\");  break;\n               case TBIT:      strcat(tform,\"X\");  break;\n               case TLONGLONG: strcat(tform,\"K\");  break;\n               }\n            } else {\n               switch( Info.datatype ) {\n               case TLOGICAL:\n                  ffcprs();\n                  ffpmsg(\"Cannot create LOGICAL column in ASCII table\");\n                  FFUNLOCK;\n                  return( *status = NOT_BTABLE );\n               case TLONG:     strcpy(tform,\"I11\");     break;\n               case TDOUBLE:   strcpy(tform,\"D23.15\");  break;\n               case TSTRING:   \n               case TBIT:      snprintf(tform,16,\"A%ld\",nelem);  break;\n               }\n            }\n            parInfo = tform;\n         } else if( !(isdigit((int) *parInfo)) && gParse.hdutype==BINARY_TBL ) {\n            if( Info.datatype==TBIT && *parInfo=='B' )\n               nelem = (nelem+7)/8;\n            snprintf(tform,16,\"%ld%s\",nelem,parInfo);\n            parInfo = tform;\n         }\n         fficol( outfptr, colNo, parName, parInfo, status );\n         if( naxis>1 )\n            ffptdm( outfptr, colNo, naxis, naxes, status );\n\n         /*  Setup TNULLn keyword in case NULLs are encountered  */\n\n         ffkeyn(\"TNULL\", colNo, nullKwd, status);\n         if( ffgcrd( outfptr, nullKwd, card, status )==KEY_NO_EXIST ) {\n            *status = 0;\n            if( gParse.hdutype==BINARY_TBL ) {\n\t       LONGLONG nullVal=0;\n               fits_binary_tform( parInfo, &typecode, &repeat, &width, status );\n               if( typecode==TBYTE )\n                  nullVal = UCHAR_MAX;\n               else if( typecode==TSHORT )\n                  nullVal = SHRT_MIN;\n               else if( typecode==TINT )\n                  nullVal = INT_MIN;\n               else if( typecode==TLONG ) {\n                  if (sizeof(long) == 8 && sizeof(int) == 4)\n                     nullVal = INT_MIN;\n                  else\n                     nullVal = LONG_MIN;\n               }\n               else if( typecode==TLONGLONG )\n                  nullVal = LONGLONG_MIN;\n\t\t  \n               if( nullVal ) {\n                  ffpkyj( outfptr, nullKwd, nullVal, \"Null value\", status );\n                  fits_set_btblnull( outfptr, colNo, nullVal, status );\n                  newNullKwd = 1;\n               }\n            } else if( gParse.hdutype==ASCII_TBL ) {\n               ffpkys( outfptr, nullKwd, \"NULL\", \"Null value string\", status );\n               fits_set_atblnull( outfptr, colNo, \"NULL\", status );\n               newNullKwd = 1;\n            }\n         }\n\n      }\n\n   } else if( *status ) {\n      ffcprs();\n      FFUNLOCK;\n      return( *status );\n   } else {\n\n      /********************************************************/\n      /*  Check if a TDIM keyword should be written/updated.  */\n      /********************************************************/\n\n      ffkeyn(\"TDIM\", colNo, tdimKwd, status);\n      ffgcrd( outfptr, tdimKwd, card, status );\n      if( *status==0 ) {\n         /*  TDIM exists, so update it with result's dimension  */\n         ffptdm( outfptr, colNo, naxis, naxes, status );\n      } else if( *status==KEY_NO_EXIST ) {\n         /*  TDIM does not exist, so clear error stack and     */\n         /*  write a TDIM only if result is multi-dimensional  */\n         *status = 0;\n         ffcmsg();\n         if( naxis>1 )\n            ffptdm( outfptr, colNo, naxis, naxes, status );\n      }\n      if( *status ) {\n         /*  Either some other error happened in ffgcrd   */\n         /*  or one happened in ffptdm                    */\n         ffcprs();\n         FFUNLOCK;\n         return( *status );\n      }\n\n   }\n\n   if( colNo>0 ) {\n\n      /*  Output column exists (now)... put results into it  */\n\n      int anyNull = 0;\n      int nPerLp, i;\n      long totaln;\n\n      ffgkyj(infptr, \"NAXIS2\", &totaln, 0, status);\n\n      /*************************************/\n      /* Create new iterator Output Column */\n      /*************************************/\n\n      col_cnt = gParse.nCols;\n      if( allocateCol( col_cnt, status ) ) {\n         ffcprs();\n         FFUNLOCK;\n         return( *status );\n      }\n\n      fits_iter_set_by_num( gParse.colData+col_cnt, outfptr,\n                            colNo, 0, OutputCol );\n      gParse.nCols++;\n\n      for( i=0; i<nRngs; i++ ) {\n         Info.dataPtr = NULL;\n         Info.maxRows = end[i]-start[i]+1;\n\n          /*\n            If there is only 1 range, and it includes all the rows,\n            and there are 10 or more rows, then set nPerLp = 0 so\n            that the iterator function will dynamically choose the\n            most efficient number of rows to process in each loop.\n            Otherwise, set nPerLp to the number of rows in this range.\n         */\n\n         if( (Info.maxRows >= 10) && (nRngs == 1) &&\n             (start[0] == 1) && (end[0] == totaln))\n              nPerLp = 0;\n         else\n              nPerLp = Info.maxRows;\n\n         if( ffiter( gParse.nCols, gParse.colData, start[i]-1,\n                     nPerLp, parse_data, (void*)&Info, status ) == -1 )\n            *status = 0;\n         else if( *status ) {\n            ffcprs();\n            FFUNLOCK;\n            return( *status );\n         }\n         if( Info.anyNull ) anyNull = 1;\n      }\n\n      if( newNullKwd && !anyNull ) {\n         ffdkey( outfptr, nullKwd, status );\n      }\n\n   } else {\n\n      /* Put constant result into keyword */\n\n      result  = gParse.Nodes + gParse.resultNode;\n      switch( Info.datatype ) {\n      case TDOUBLE:\n         ffukyd( outfptr, parName, result->value.data.dbl, 15,\n                 parInfo, status );\n         break;\n      case TLONG:\n         ffukyj( outfptr, parName, result->value.data.lng, parInfo, status );\n         break;\n      case TLOGICAL:\n         ffukyl( outfptr, parName, result->value.data.log, parInfo, status );\n         break;\n      case TBIT:\n      case TSTRING:\n\t if (fits_strcasecmp(parName,\"HISTORY\") == 0) {\n\t   ffphis( outfptr, result->value.data.str, status);\n\t } else if (fits_strcasecmp(parName,\"COMMENT\") == 0) {\n\t   ffpcom( outfptr, result->value.data.str, status);\n\t } else {\n\t   ffukys( outfptr, parName, result->value.data.str, parInfo, status );\n\t }\n         break;\n      }\n   }\n\n   ffcprs();\n   FFUNLOCK;\n   return( *status );\n}\n\n/*--------------------------------------------------------------------------*/\nint fftexp( fitsfile *fptr,      /* I - Input FITS file                     */\n            char     *expr,      /* I - Arithmetic expression               */\n            int      maxdim,     /* I - Max Dimension of naxes              */\n            int      *datatype,  /* O - Data type of result                 */\n            long     *nelem,     /* O - Vector length of result             */\n            int      *naxis,     /* O - # of dimensions of result           */\n            long     *naxes,     /* O - Size of each dimension              */\n            int      *status )   /* O - Error status                        */\n/*                                                                          */\n/* Evaluate the given expression and return information on the result.      */\n/*--------------------------------------------------------------------------*/\n{\n   FFLOCK;\n   ffiprs( fptr, 0, expr, maxdim, datatype, nelem, naxis, naxes, status );\n   ffcprs();\n   FFUNLOCK;\n   return( *status );\n}\n\n/*--------------------------------------------------------------------------*/\nint ffiprs( fitsfile *fptr,      /* I - Input FITS file                     */\n            int      compressed, /* I - Is FITS file hkunexpanded?          */\n            char     *expr,      /* I - Arithmetic expression               */\n            int      maxdim,     /* I - Max Dimension of naxes              */\n            int      *datatype,  /* O - Data type of result                 */\n            long     *nelem,     /* O - Vector length of result             */\n            int      *naxis,     /* O - # of dimensions of result           */\n            long     *naxes,     /* O - Size of each dimension              */\n            int      *status )   /* O - Error status                        */\n/*                                                                          */\n/* Initialize the parser and determine what type of result the expression   */\n/* produces.                                                                */\n/*--------------------------------------------------------------------------*/\n{\n   Node *result;\n   int  i,lexpr, tstatus = 0;\n   int xaxis, bitpix;\n   long xaxes[9];\n   static iteratorCol dmyCol;\n\n   if( *status ) return( *status );\n\n   /* make sure all internal structures for this HDU are current */\n   if ( ffrdef(fptr, status) ) return(*status);\n\n   /*  Initialize the Parser structure  */\n\n   gParse.def_fptr   = fptr;\n   gParse.compressed = compressed;\n   gParse.nCols      = 0;\n   gParse.colData    = NULL;\n   gParse.varData    = NULL;\n   gParse.getData    = find_column;\n   gParse.loadData   = load_column;\n   gParse.Nodes      = NULL;\n   gParse.nNodesAlloc= 0;\n   gParse.nNodes     = 0;\n   gParse.hdutype    = 0;\n   gParse.status     = 0;\n\n   fits_get_hdu_type(fptr, &gParse.hdutype, status );\n\n   if (gParse.hdutype == IMAGE_HDU) {\n\n      fits_get_img_param(fptr, 9, &bitpix, &xaxis, xaxes, status);\n      if (*status) {\n         ffpmsg(\"ffiprs: unable to get image dimensions\");\n         return( *status );\n      }\n      gParse.totalRows = xaxis > 0 ? 1 : 0;\n      for (i = 0; i < xaxis; ++i)\n         gParse.totalRows *= xaxes[i];\n      if (DEBUG_PIXFILTER)\n         printf(\"naxis=%d, gParse.totalRows=%ld\\n\", xaxis, gParse.totalRows);\n   }\n   else if( ffgkyj(fptr, \"NAXIS2\", &gParse.totalRows, 0, &tstatus) )\n   {\n      /* this might be a 1D or null image with no NAXIS2 keyword */\n      gParse.totalRows = 0;\n   } \n   \n\n   /*  Copy expression into parser... read from file if necessary  */\n\n\n   if( expr[0]=='@' ) {\n      if( ffimport_file( expr+1, &gParse.expr, status ) ) return( *status );\n      lexpr = strlen(gParse.expr);\n   } else {\n      lexpr = strlen(expr);\n      gParse.expr = (char*)malloc( (2+lexpr)*sizeof(char));\n      strcpy(gParse.expr,expr);\n   }\n   strcat(gParse.expr + lexpr,\"\\n\");\n   gParse.index    = 0;\n   gParse.is_eobuf = 0;\n\n   /*  Parse the expression, building the Nodes and determing  */\n   /*  which columns are needed and what data type is returned  */\n\n   ffrestart(NULL);\n   if( ffparse() ) {\n      return( *status = PARSE_SYNTAX_ERR );\n   }\n   /*  Check results  */\n\n   *status = gParse.status;\n   if( *status ) return(*status);\n\n   if( !gParse.nNodes ) {\n      ffpmsg(\"Blank expression\");\n      return( *status = PARSE_SYNTAX_ERR );\n   }\n   if( !gParse.nCols ) {\n      dmyCol.fptr = fptr;         /* This allows iterator to know value of */\n      gParse.colData = &dmyCol;   /* fptr when no columns are referenced   */\n   }\n\n   result = gParse.Nodes + gParse.resultNode;\n\n   *naxis = result->value.naxis;\n   *nelem = result->value.nelem;\n   for( i=0; i<*naxis && i<maxdim; i++ )\n      naxes[i] = result->value.naxes[i];\n\n   switch( result->type ) {\n   case BOOLEAN:\n      *datatype = TLOGICAL;\n      break;\n   case LONG:\n      *datatype = TLONG;\n      break;\n   case DOUBLE:\n      *datatype = TDOUBLE;\n      break;\n   case BITSTR:\n      *datatype = TBIT;\n      break;\n   case STRING:\n      *datatype = TSTRING;\n      break;\n   default:\n      *datatype = 0;\n      ffpmsg(\"Bad return data type\");\n      *status = gParse.status = PARSE_BAD_TYPE;\n      break;\n   }\n   gParse.datatype = *datatype;\n   FREE(gParse.expr);\n\n   if( result->operation==CONST_OP ) *nelem = - *nelem;\n   return(*status);\n}\n\n/*--------------------------------------------------------------------------*/\nvoid ffcprs( void )  /*  No parameters                                      */\n/*                                                                          */\n/* Clear the parser, making it ready to accept a new expression.            */\n/*--------------------------------------------------------------------------*/\n{\n   int col, node, i;\n\n   if( gParse.nCols > 0 ) {\n      FREE( gParse.colData  );\n      for( col=0; col<gParse.nCols; col++ ) {\n         if( gParse.varData[col].undef == NULL ) continue;\n         if( gParse.varData[col].type  == BITSTR )\n           FREE( ((char**)gParse.varData[col].data)[0] );\n         free( gParse.varData[col].undef );\n      }\n      FREE( gParse.varData );\n      gParse.nCols = 0;\n   }\n\n   if( gParse.nNodes > 0 ) {\n      node = gParse.nNodes;\n      while( node-- ) {\n         if( gParse.Nodes[node].operation==gtifilt_fct ) {\n            i = gParse.Nodes[node].SubNodes[0];\n            if (gParse.Nodes[ i ].value.data.ptr)\n\t        FREE( gParse.Nodes[ i ].value.data.ptr );\n         }\n         else if( gParse.Nodes[node].operation==regfilt_fct ) {\n            i = gParse.Nodes[node].SubNodes[0];\n            fits_free_region( (SAORegion *)gParse.Nodes[ i ].value.data.ptr );\n         }\n      }\n      gParse.nNodes = 0;\n   }\n   if( gParse.Nodes ) free( gParse.Nodes );\n   gParse.Nodes = NULL;\n\n   gParse.hdutype = ANY_HDU;\n   gParse.pixFilter = 0;\n}\n\n/*---------------------------------------------------------------------------*/\nint parse_data( long    totalrows,     /* I - Total rows to be processed     */\n                long    offset,        /* I - Number of rows skipped at start*/\n                long    firstrow,      /* I - First row of this iteration    */\n                long    nrows,         /* I - Number of rows in this iter    */\n                int      nCols,        /* I - Number of columns in use       */\n                iteratorCol *colData,  /* IO- Column information/data        */\n                void    *userPtr )     /* I - Data handling instructions     */\n/*                                                                           */\n/* Iterator work function which calls the parser and copies the results      */\n/* into either an OutputCol or a data pointer supplied in the userPtr        */\n/* structure.                                                                */\n/*---------------------------------------------------------------------------*/\n{\n    int status, constant=0, anyNullThisTime=0;\n    long jj, kk, idx, remain, ntodo;\n    Node *result;\n    iteratorCol * outcol;\n\n    /* declare variables static to preserve their values between calls */\n    static void *Data, *Null;\n    static int  datasize;\n    static long lastRow, repeat, resDataSize;\n    static LONGLONG jnull;\n    static parseInfo *userInfo;\n    static long zeros[4] = {0,0,0,0};\n\n    if (DEBUG_PIXFILTER)\n       printf(\"parse_data(total=%ld, offset=%ld, first=%ld, rows=%ld, cols=%d)\\n\",\n                totalrows, offset, firstrow, nrows, nCols);\n    /*--------------------------------------------------------*/\n    /*  Initialization procedures: execute on the first call  */\n    /*--------------------------------------------------------*/\n    outcol = colData + (nCols - 1);\n    if (firstrow == offset+1)\n    {\n       userInfo = (parseInfo*)userPtr;\n       userInfo->anyNull = 0;\n\n       if( userInfo->maxRows>0 )\n          userInfo->maxRows = minvalue(totalrows,userInfo->maxRows);\n       else if( userInfo->maxRows<0 )\n          userInfo->maxRows = totalrows;\n       else\n          userInfo->maxRows = nrows;\n\n       lastRow = firstrow + userInfo->maxRows - 1;\n\n       if( userInfo->dataPtr==NULL ) {\n\n          if( outcol->iotype == InputCol ) {\n             ffpmsg(\"Output column for parser results not found!\");\n             return( PARSE_NO_OUTPUT );\n          }\n          /* Data gets set later */\n          Null = outcol->array;\n          userInfo->datatype = outcol->datatype;\n\n          /* Check for a TNULL/BLANK keyword for output column/image */\n\n          status = 0;\n          jnull = 0;\n          if (gParse.hdutype == IMAGE_HDU) {\n             if (gParse.pixFilter->blank)\n                jnull = (LONGLONG) gParse.pixFilter->blank;\n          }\n          else {\n             ffgknjj( outcol->fptr, \"TNULL\", outcol->colnum,\n                        1, &jnull, (int*)&jj, &status );\n\n             if( status==BAD_INTKEY ) {\n                /*  Probably ASCII table with text TNULL keyword  */\n                switch( userInfo->datatype ) {\n                   case TSHORT:  jnull = (LONGLONG) SHRT_MIN;      break;\n                   case TINT:    jnull = (LONGLONG) INT_MIN;       break;\n                   case TLONG:   jnull = (LONGLONG) LONG_MIN;      break;\n                }\n             }\n          }\n          repeat = outcol->repeat;\n/*\n          if (DEBUG_PIXFILTER)\n            printf(\"parse_data: using null value %ld\\n\", jnull);\n*/\n       } else {\n\n          Data = userInfo->dataPtr;\n          Null = (userInfo->nullPtr ? userInfo->nullPtr : zeros);\n          repeat = gParse.Nodes[gParse.resultNode].value.nelem;\n\n       }\n\n       /* Determine the size of each element of the returned result */\n\n       switch( userInfo->datatype ) {\n       case TBIT:       /*  Fall through to TBYTE  */\n       case TLOGICAL:   /*  Fall through to TBYTE  */\n       case TBYTE:     datasize = sizeof(char);     break;\n       case TSHORT:    datasize = sizeof(short);    break;\n       case TINT:      datasize = sizeof(int);      break;\n       case TLONG:     datasize = sizeof(long);     break;\n       case TLONGLONG: datasize = sizeof(LONGLONG); break;\n       case TFLOAT:    datasize = sizeof(float);    break;\n       case TDOUBLE:   datasize = sizeof(double);   break;\n       case TSTRING:   datasize = sizeof(char*);    break;\n       }\n\n       /* Determine the size of each element of the calculated result */\n       /*   (only matters for numeric/logical data)                   */\n\n       switch( gParse.Nodes[gParse.resultNode].type ) {\n       case BOOLEAN:   resDataSize = sizeof(char);    break;\n       case LONG:      resDataSize = sizeof(long);    break;\n       case DOUBLE:    resDataSize = sizeof(double);  break;\n       }\n    }\n\n    /*-------------------------------------------*/\n    /*  Main loop: process all the rows of data  */\n    /*-------------------------------------------*/\n\n    /*  If writing to output column, set first element to appropriate  */\n    /*  null value.  If no NULLs encounter, zero out before returning. */\n/*\n          if (DEBUG_PIXFILTER)\n            printf(\"parse_data: using null value %ld\\n\", jnull);\n*/\n\n    if( userInfo->dataPtr == NULL ) {\n       /* First, reset Data pointer to start of output array */\n       Data = (char*) outcol->array + datasize;\n\n       switch( userInfo->datatype ) {\n       case TLOGICAL: *(char  *)Null = 'U';             break;\n       case TBYTE:    *(char  *)Null = (char )jnull;    break;\n       case TSHORT:   *(short *)Null = (short)jnull;    break;\n       case TINT:     *(int   *)Null = (int  )jnull;    break;\n       case TLONG:    *(long  *)Null = (long )jnull;    break;\n       case TLONGLONG: *(LONGLONG  *)Null = (LONGLONG )jnull;    break;\n       case TFLOAT:   *(float *)Null = FLOATNULLVALUE;  break;\n       case TDOUBLE:  *(double*)Null = DOUBLENULLVALUE; break;\n       case TSTRING: (*(char **)Null)[0] = '\\1';\n                     (*(char **)Null)[1] = '\\0';        break;\n       }\n    }\n\n    /* Alter nrows in case calling routine didn't want to do all rows */\n\n    nrows = minvalue(nrows,lastRow-firstrow+1);\n\n    Setup_DataArrays( nCols, colData, firstrow, nrows );\n\n    /* Parser allocates arrays for each column and calculation it performs. */\n    /* Limit number of rows processed during each pass to reduce memory     */\n    /* requirements... In most cases, iterator will limit rows to less      */\n    /* than 2500 rows per iteration, so this is really only relevant for    */\n    /* hk-compressed files which must be decompressed in memory and sent    */\n    /* whole to parse_data in a single iteration.                           */\n\n    remain = nrows;\n    while( remain ) {\n       ntodo = minvalue(remain,2500);\n       Evaluate_Parser ( firstrow, ntodo );\n       if( gParse.status ) break;\n\n       firstrow += ntodo;\n       remain   -= ntodo;\n\n       /*  Copy results into data array  */\n\n       result = gParse.Nodes + gParse.resultNode;\n       if( result->operation==CONST_OP ) constant = 1;\n\n       switch( result->type ) {\n\n       case BOOLEAN:\n       case LONG:\n       case DOUBLE:\n          if( constant ) {\n             char undef=0;\n             for( kk=0; kk<ntodo; kk++ )\n                for( jj=0; jj<repeat; jj++ )\n                   ffcvtn( gParse.datatype,\n                           &(result->value.data),\n                           &undef, result->value.nelem /* 1 */,\n                           userInfo->datatype, Null,\n                           (char*)Data + (kk*repeat+jj)*datasize,\n                           &anyNullThisTime, &gParse.status );\n          } else {\n             if ( repeat == result->value.nelem ) {\n                ffcvtn( gParse.datatype,\n                        result->value.data.ptr,\n                        result->value.undef,\n                        result->value.nelem*ntodo,\n                        userInfo->datatype, Null, Data,\n                        &anyNullThisTime, &gParse.status );\n             } else if( result->value.nelem == 1 ) {\n                for( kk=0; kk<ntodo; kk++ )\n                   for( jj=0; jj<repeat; jj++ ) {\n                      ffcvtn( gParse.datatype,\n                              (char*)result->value.data.ptr + kk*resDataSize,\n                              (char*)result->value.undef + kk,\n                              1, userInfo->datatype, Null,\n                              (char*)Data + (kk*repeat+jj)*datasize,\n                              &anyNullThisTime, &gParse.status );\n                   }\n             } else {\n                int nCopy;\n                nCopy = minvalue( repeat, result->value.nelem );\n                for( kk=0; kk<ntodo; kk++ ) {\n                   ffcvtn( gParse.datatype,\n                           (char*)result->value.data.ptr\n                                  + kk*result->value.nelem*resDataSize,\n                           (char*)result->value.undef\n                                  + kk*result->value.nelem,\n                           nCopy, userInfo->datatype, Null,\n                           (char*)Data + (kk*repeat)*datasize,\n                           &anyNullThisTime, &gParse.status );\n                   if( nCopy < repeat ) {\n                      memset( (char*)Data + (kk*repeat+nCopy)*datasize,\n                              0, (repeat-nCopy)*datasize);\n                   }\n                }\n\n             }\n             if( result->operation>0 ) {\n                FREE( result->value.data.ptr );\n             }\n          }\n          if( gParse.status==OVERFLOW_ERR ) {\n             gParse.status = NUM_OVERFLOW;\n             ffpmsg(\"Numerical overflow while converting expression to necessary datatype\");\n          }\n          break;\n\n       case BITSTR:\n          switch( userInfo->datatype ) {\n          case TBYTE:\n             idx = -1;\n             for( kk=0; kk<ntodo; kk++ ) {\n                for( jj=0; jj<result->value.nelem; jj++ ) {\n                   if( jj%8 == 0 )\n                      ((char*)Data)[++idx] = 0;\n                   if( constant ) {\n                      if( result->value.data.str[jj]=='1' )\n                         ((char*)Data)[idx] |= 128>>(jj%8);\n                   } else {\n                      if( result->value.data.strptr[kk][jj]=='1' )\n                         ((char*)Data)[idx] |= 128>>(jj%8);\n                   }\n                }\n             }\n             break;\n          case TBIT:\n          case TLOGICAL:\n             if( constant ) {\n                for( kk=0; kk<ntodo; kk++ )\n                   for( jj=0; jj<result->value.nelem; jj++ ) {\n                      ((char*)Data)[ jj+kk*result->value.nelem ] =\n                         ( result->value.data.str[jj]=='1' );\n                   }\n             } else {\n                for( kk=0; kk<ntodo; kk++ )\n                   for( jj=0; jj<result->value.nelem; jj++ ) {\n                      ((char*)Data)[ jj+kk*result->value.nelem ] =\n                         ( result->value.data.strptr[kk][jj]=='1' );\n                   }\n             }\n             break; \n          case TSTRING:\n             if( constant ) {\n                for( jj=0; jj<ntodo; jj++ ) {\n                   strcpy( ((char**)Data)[jj], result->value.data.str );\n                }\n             } else {\n                for( jj=0; jj<ntodo; jj++ ) {\n                   strcpy( ((char**)Data)[jj], result->value.data.strptr[jj] );\n                }\n             }\n             break;\n          default:\n             ffpmsg(\"Cannot convert bit expression to desired type.\");\n             gParse.status = PARSE_BAD_TYPE;\n             break;\n          }\n          if( result->operation>0 ) {\n             FREE( result->value.data.strptr[0] );\n             FREE( result->value.data.strptr );\n          }\n          break;\n\n       case STRING:\n          if( userInfo->datatype==TSTRING ) {\n             if( constant ) {\n                for( jj=0; jj<ntodo; jj++ )\n                   strcpy( ((char**)Data)[jj], result->value.data.str );\n             } else {\n                for( jj=0; jj<ntodo; jj++ )\n                   if( result->value.undef[jj] ) {\n                      anyNullThisTime = 1;\n                      strcpy( ((char**)Data)[jj],\n                              *(char **)Null );\n                   } else {\n                      strcpy( ((char**)Data)[jj],\n                              result->value.data.strptr[jj] );\n                   }\n             }\n          } else {\n             ffpmsg(\"Cannot convert string expression to desired type.\");\n             gParse.status = PARSE_BAD_TYPE;\n          }\n          if( result->operation>0 ) {\n             FREE( result->value.data.strptr[0] );\n             FREE( result->value.data.strptr );\n          }\n          break;\n       }\n\n       if( gParse.status ) break;\n\n       /*  Increment Data to point to where the next block should go  */\n\n       if( result->type==BITSTR && userInfo->datatype==TBYTE )\n          Data = (char*)Data\n                    + datasize * ( (result->value.nelem+7)/8 ) * ntodo;\n       else if( result->type==STRING )\n          Data = (char*)Data + datasize * ntodo;\n       else\n          Data = (char*)Data + datasize * ntodo * repeat;\n    }\n\n    /* If no NULLs encountered during this pass, set Null value to */\n    /* zero to make the writing of the output column data faster   */\n\n    if( anyNullThisTime )\n       userInfo->anyNull = 1;\n    else if( userInfo->dataPtr == NULL ) {\n       if( userInfo->datatype == TSTRING )\n          memcpy( *(char **)Null, zeros, 2 );\n       else \n          memcpy( Null, zeros, datasize );\n    }\n\n    /*-------------------------------------------------------*/\n    /*  Clean up procedures:  after processing all the rows  */\n    /*-------------------------------------------------------*/\n\n    /*  if the calling routine specified that only a limited number    */\n    /*  of rows in the table should be processed, return a value of -1 */\n    /*  once all the rows have been done, if no other error occurred.  */\n\n    if (gParse.hdutype != IMAGE_HDU && firstrow - 1 == lastRow) {\n           if (!gParse.status && userInfo->maxRows<totalrows) {\n                  return (-1);\n           }\n    }\n\n    return(gParse.status);  /* return successful status */\n}\n\nstatic void Setup_DataArrays( int nCols, iteratorCol *cols,\n                              long fRow, long nRows )\n    /***********************************************************************/\n    /*  Setup the varData array in gParse to contain the fits column data. */\n    /*  Then, allocate and initialize the necessary UNDEF arrays for each  */\n    /*  column used by the parser.                                         */\n    /***********************************************************************/\n{\n   int     i;\n   long    nelem, len, row, idx;\n   char  **bitStrs;\n   char  **sptr;\n   char   *barray;\n   long   *iarray;\n   double *rarray;\n   char msg[80];\n\n   gParse.firstDataRow = fRow;\n   gParse.nDataRows    = nRows;\n\n   /*  Resize and fill in UNDEF arrays for each column  */\n\n   for( i=0; i<nCols; i++ ) {\n\n      iteratorCol *icol = cols + i;\n      DataInfo *varData = gParse.varData + i;\n\n      if( icol->iotype == OutputCol ) continue;\n\n      nelem  = varData->nelem;\n      len    = nelem * nRows;\n\n      switch ( varData->type ) {\n\n      case BITSTR:\n      /* No need for UNDEF array, but must make string DATA array */\n         len = (nelem+1)*nRows;   /* Count '\\0' */\n         bitStrs = (char**)varData->data;\n         if( bitStrs ) FREE( bitStrs[0] );\n         free( bitStrs );\n         bitStrs = (char**)malloc( nRows*sizeof(char*) );\n         if( bitStrs==NULL ) {\n            varData->data = varData->undef = NULL;\n            gParse.status = MEMORY_ALLOCATION;\n            break;\n         }\n         bitStrs[0] = (char*)malloc( len*sizeof(char) );\n         if( bitStrs[0]==NULL ) {\n            free( bitStrs );\n            varData->data = varData->undef = NULL;\n            gParse.status = MEMORY_ALLOCATION;\n            break;\n         }\n\n         for( row=0; row<nRows; row++ ) {\n            bitStrs[row] = bitStrs[0] + row*(nelem+1);\n            idx = (row)*( (nelem+7)/8 ) + 1;\n            for(len=0; len<nelem; len++) {\n               if( ((char*)icol->array)[idx] & (1<<(7-len%8)) )\n                  bitStrs[row][len] = '1';\n               else\n                  bitStrs[row][len] = '0';\n               if( len%8==7 ) idx++;\n            }\n            bitStrs[row][len] = '\\0';\n         }\n         varData->undef = (char*)bitStrs;\n         varData->data  = (char*)bitStrs;\n         break;\n\n      case STRING:\n         sptr = (char**)icol->array;\n         if (varData->undef)\n            free( varData->undef );\n         varData->undef = (char*)malloc( nRows*sizeof(char) );\n         if( varData->undef==NULL ) {\n            gParse.status = MEMORY_ALLOCATION;\n            break;\n         }\n         row = nRows;\n         while( row-- )\n            varData->undef[row] =\n               ( **sptr != '\\0' && FSTRCMP( sptr[0], sptr[row+1] )==0 );\n         varData->data  = sptr + 1;\n         break;\n\n      case BOOLEAN:\n         barray = (char*)icol->array;\n         if (varData->undef)\n            free( varData->undef );\n         varData->undef = (char*)malloc( len*sizeof(char) );\n         if( varData->undef==NULL ) {\n            gParse.status = MEMORY_ALLOCATION;\n            break;\n         }\n         while( len-- ) {\n            varData->undef[len] = \n               ( barray[0]!=0 && barray[0]==barray[len+1] );\n         }\n         varData->data  = barray + 1;\n         break;\n\n      case LONG:\n         iarray = (long*)icol->array;\n         if (varData->undef)\n            free( varData->undef );\n         varData->undef = (char*)malloc( len*sizeof(char) );\n         if( varData->undef==NULL ) {\n            gParse.status = MEMORY_ALLOCATION;\n            break;\n         }\n         while( len-- ) {\n            varData->undef[len] = \n               ( iarray[0]!=0L && iarray[0]==iarray[len+1] );\n         }\n         varData->data  = iarray + 1;\n         break;\n\n      case DOUBLE:\n         rarray = (double*)icol->array;\n         if (varData->undef)\n            free( varData->undef );\n         varData->undef = (char*)malloc( len*sizeof(char) );\n         if( varData->undef==NULL ) {\n            gParse.status = MEMORY_ALLOCATION;\n            break;\n         }\n         while( len-- ) {\n            varData->undef[len] = \n               ( rarray[0]!=0.0 && rarray[0]==rarray[len+1]);\n         }\n         varData->data  = rarray + 1;\n         break;\n\n      default:\n         snprintf(msg, 80, \"SetupDataArrays, unhandled type %d\\n\",\n                varData->type);\n         ffpmsg(msg);\n      }\n\n      if( gParse.status ) {  /*  Deallocate NULL arrays of previous columns */\n         while( i-- ) {\n            varData = gParse.varData + i;\n            if( varData->type==BITSTR )\n               FREE( ((char**)varData->data)[0] );\n            FREE( varData->undef );\n            varData->undef = NULL;\n         }\n         return;\n      }\n   }\n}\n\n/*--------------------------------------------------------------------------*/\nint ffcvtn( int   inputType,  /* I - Data type of input array               */\n            void  *input,     /* I - Input array of type inputType          */\n            char  *undef,     /* I - Array of flags indicating UNDEF elems  */\n            long  ntodo,      /* I - Number of elements to process          */\n            int   outputType, /* I - Data type of output array              */\n            void  *nulval,    /* I - Ptr to value to use for UNDEF elements */\n            void  *output,    /* O - Output array of type outputType        */\n            int   *anynull,   /* O - Any nulls flagged?                     */\n            int   *status )   /* O - Error status                           */\n/*                                                                          */\n/* Convert an array of any input data type to an array of any output        */\n/* data type, using an array of UNDEF flags to assign nulvals to            */\n/*--------------------------------------------------------------------------*/\n{\n   long i;\n\n   switch( outputType ) {\n\n   case TLOGICAL:\n      switch( inputType ) {\n      case TLOGICAL:\n      case TBYTE:\n         for( i=0; i<ntodo; i++ )\n            if( ((unsigned char*)input)[i] )\n                ((unsigned char*)output)[i] = 1;\n            else\n                ((unsigned char*)output)[i] = 0;\n         break;\n      case TSHORT:\n         for( i=0; i<ntodo; i++ )\n            if( ((short*)input)[i] )\n                ((unsigned char*)output)[i] = 1;\n            else\n                ((unsigned char*)output)[i] = 0;\n         break;\n      case TLONG:\n         for( i=0; i<ntodo; i++ )\n            if( ((long*)input)[i] )\n                ((unsigned char*)output)[i] = 1;\n            else\n                ((unsigned char*)output)[i] = 0;\n         break;\n      case TFLOAT:\n         for( i=0; i<ntodo; i++ )\n            if( ((float*)input)[i] )\n                ((unsigned char*)output)[i] = 1;\n            else\n                ((unsigned char*)output)[i] = 0;\n         break;\n      case TDOUBLE:\n         for( i=0; i<ntodo; i++ )\n            if( ((double*)input)[i] )\n                ((unsigned char*)output)[i] = 1;\n            else\n                ((unsigned char*)output)[i] = 0;\n         break;\n      default:\n         *status = BAD_DATATYPE;\n         break;\n      }\n      for(i=0;i<ntodo;i++) {\n         if( undef[i] ) {\n            ((unsigned char*)output)[i] = *(unsigned char*)nulval;\n            *anynull = 1;\n         }\n      }\n      break;\n\n   case TBYTE:\n      switch( inputType ) {\n      case TLOGICAL:\n      case TBYTE:\n         for( i=0; i<ntodo; i++ )\n            ((unsigned char*)output)[i] = ((unsigned char*)input)[i];\n         break;\n      case TSHORT:\n         fffi2i1((short*)input,ntodo,1.,0.,0,0,0,NULL,NULL,(unsigned char*)output,status);\n         break;\n      case TLONG:\n         for (i = 0; i < ntodo; i++) {\n            if( undef[i] ) {\n               ((unsigned char*)output)[i] = *(unsigned char*)nulval;\n               *anynull = 1;\n            } else {\n               if( ((long*)input)[i] < 0 ) {\n                  *status = OVERFLOW_ERR;\n                  ((unsigned char*)output)[i] = 0;\n               } else if( ((long*)input)[i] > UCHAR_MAX ) {\n                  *status = OVERFLOW_ERR;\n                  ((unsigned char*)output)[i] = UCHAR_MAX;\n               } else\n                  ((unsigned char*)output)[i] = \n                     (unsigned char) ((long*)input)[i];\n            }\n         }\n         return( *status );\n      case TFLOAT:\n         fffr4i1((float*)input,ntodo,1.,0.,0,0,NULL,NULL,\n                 (unsigned char*)output,status);\n         break;\n      case TDOUBLE:\n         fffr8i1((double*)input,ntodo,1.,0.,0,0,NULL,NULL,\n                 (unsigned char*)output,status);\n         break;\n      default:\n         *status = BAD_DATATYPE;\n         break;\n      }\n      for(i=0;i<ntodo;i++) {\n         if( undef[i] ) {\n            ((unsigned char*)output)[i] = *(unsigned char*)nulval;\n            *anynull = 1;\n         }\n      }\n      break;\n\n   case TSHORT:\n      switch( inputType ) {\n      case TLOGICAL:\n      case TBYTE:\n         for( i=0; i<ntodo; i++ )\n            ((short*)output)[i] = ((unsigned char*)input)[i];\n         break;\n      case TSHORT:\n         for( i=0; i<ntodo; i++ )\n            ((short*)output)[i] = ((short*)input)[i];\n         break;\n      case TLONG:\n         for (i = 0; i < ntodo; i++) {\n            if( undef[i] ) {\n               ((short*)output)[i] = *(short*)nulval;\n               *anynull = 1;\n            } else {\n               if( ((long*)input)[i] < SHRT_MIN ) {\n                  *status = OVERFLOW_ERR;\n                  ((short*)output)[i] = SHRT_MIN;\n               } else if ( ((long*)input)[i] > SHRT_MAX ) {\n                  *status = OVERFLOW_ERR;\n                  ((short*)output)[i] = SHRT_MAX;\n               } else\n                  ((short*)output)[i] = (short) ((long*)input)[i];\n            }\n         }\n         return( *status );\n      case TFLOAT:\n         fffr4i2((float*)input,ntodo,1.,0.,0,0,NULL,NULL,\n                 (short*)output,status);\n         break;\n      case TDOUBLE:\n         fffr8i2((double*)input,ntodo,1.,0.,0,0,NULL,NULL,\n                 (short*)output,status);\n         break;\n      default:\n         *status = BAD_DATATYPE;\n         break;\n      }\n      for(i=0;i<ntodo;i++) {\n         if( undef[i] ) {\n            ((short*)output)[i] = *(short*)nulval;\n            *anynull = 1;\n         }\n      }\n      break;\n\n   case TINT:\n      switch( inputType ) {\n      case TLOGICAL:\n      case TBYTE:\n         for( i=0; i<ntodo; i++ )\n            ((int*)output)[i] = ((unsigned char*)input)[i];\n         break;\n      case TSHORT:\n         for( i=0; i<ntodo; i++ )\n            ((int*)output)[i] = ((short*)input)[i];\n         break;\n      case TLONG:\n         for( i=0; i<ntodo; i++ )\n            ((int*)output)[i] = ((long*)input)[i];\n         break;\n      case TFLOAT:\n         fffr4int((float*)input,ntodo,1.,0.,0,0,NULL,NULL,\n                  (int*)output,status);\n         break;\n      case TDOUBLE:\n         fffr8int((double*)input,ntodo,1.,0.,0,0,NULL,NULL,\n                  (int*)output,status);\n         break;\n      default:\n         *status = BAD_DATATYPE;\n         break;\n      }\n      for(i=0;i<ntodo;i++) {\n         if( undef[i] ) {\n            ((int*)output)[i] = *(int*)nulval;\n            *anynull = 1;\n         }\n      }\n      break;\n\n   case TLONG:\n      switch( inputType ) {\n      case TLOGICAL:\n      case TBYTE:\n         for( i=0; i<ntodo; i++ )\n            ((long*)output)[i] = ((unsigned char*)input)[i];\n         break;\n      case TSHORT:\n         for( i=0; i<ntodo; i++ )\n            ((long*)output)[i] = ((short*)input)[i];\n         break;\n      case TLONG:\n         for( i=0; i<ntodo; i++ )\n            ((long*)output)[i] = ((long*)input)[i];\n         break;\n      case TFLOAT:\n         fffr4i4((float*)input,ntodo,1.,0.,0,0,NULL,NULL,\n                 (long*)output,status);\n         break;\n      case TDOUBLE:\n         fffr8i4((double*)input,ntodo,1.,0.,0,0,NULL,NULL,\n                 (long*)output,status);\n         break;\n      default:\n         *status = BAD_DATATYPE;\n         break;\n      }\n      for(i=0;i<ntodo;i++) {\n         if( undef[i] ) {\n            ((long*)output)[i] = *(long*)nulval;\n            *anynull = 1;\n         }\n      }\n      break;\n\n   case TLONGLONG:\n      switch( inputType ) {\n      case TLOGICAL:\n      case TBYTE:\n         for( i=0; i<ntodo; i++ )\n            ((LONGLONG*)output)[i] = ((unsigned char*)input)[i];\n         break;\n      case TSHORT:\n         for( i=0; i<ntodo; i++ )\n            ((LONGLONG*)output)[i] = ((short*)input)[i];\n         break;\n      case TLONG:\n         for( i=0; i<ntodo; i++ )\n            ((LONGLONG*)output)[i] = ((long*)input)[i];\n         break;\n      case TFLOAT:\n         fffr4i8((float*)input,ntodo,1.,0.,0,0,NULL,NULL,\n                 (LONGLONG*)output,status);\n         break;\n      case TDOUBLE:\n         fffr8i8((double*)input,ntodo,1.,0.,0,0,NULL,NULL,\n                 (LONGLONG*)output,status);\n\n         break;\n      default:\n         *status = BAD_DATATYPE;\n         break;\n      }\n      for(i=0;i<ntodo;i++) {\n         if( undef[i] ) {\n            ((LONGLONG*)output)[i] = *(LONGLONG*)nulval;\n            *anynull = 1;\n         }\n      }\n      break;\n\n   case TFLOAT:\n      switch( inputType ) {\n      case TLOGICAL:\n      case TBYTE:\n         for( i=0; i<ntodo; i++ )\n            ((float*)output)[i] = ((unsigned char*)input)[i];\n         break;\n      case TSHORT:\n         for( i=0; i<ntodo; i++ )\n            ((float*)output)[i] = ((short*)input)[i];\n         break;\n      case TLONG:\n         for( i=0; i<ntodo; i++ )\n            ((float*)output)[i] = (float) ((long*)input)[i];\n         break;\n      case TFLOAT:\n         for( i=0; i<ntodo; i++ )\n            ((float*)output)[i] = ((float*)input)[i];\n         break;\n      case TDOUBLE:\n         fffr8r4((double*)input,ntodo,1.,0.,0,0,NULL,NULL,\n                 (float*)output,status);\n         break;\n      default:\n         *status = BAD_DATATYPE;\n         break;\n      }\n      for(i=0;i<ntodo;i++) {\n         if( undef[i] ) {\n            ((float*)output)[i] = *(float*)nulval;\n            *anynull = 1;\n         }\n      }\n      break;\n\n   case TDOUBLE:\n      switch( inputType ) {\n      case TLOGICAL:\n      case TBYTE:\n         for( i=0; i<ntodo; i++ )\n            ((double*)output)[i] = ((unsigned char*)input)[i];\n         break;\n      case TSHORT:\n         for( i=0; i<ntodo; i++ )\n            ((double*)output)[i] = ((short*)input)[i];\n         break;\n      case TLONG:\n         for( i=0; i<ntodo; i++ )\n            ((double*)output)[i] = ((long*)input)[i];\n         break;\n      case TFLOAT:\n         for( i=0; i<ntodo; i++ )\n            ((double*)output)[i] = ((float*)input)[i];\n         break;\n      case TDOUBLE:\n         for( i=0; i<ntodo; i++ )\n            ((double*)output)[i] = ((double*)input)[i];\n         break;\n      default:\n         *status = BAD_DATATYPE;\n         break;\n      }\n      for(i=0;i<ntodo;i++) {\n         if( undef[i] ) {\n            ((double*)output)[i] = *(double*)nulval;\n            *anynull = 1;\n         }\n      }\n      break;\n\n   default:\n      *status = BAD_DATATYPE;\n      break;\n   }\n\n   return ( *status );\n}\n\n/*---------------------------------------------------------------------------*/\nint fffrwc( fitsfile *fptr,        /* I - Input FITS file                    */\n            char     *expr,        /* I - Boolean expression                 */\n            char     *timeCol,     /* I - Name of time column                */\n            char     *parCol,      /* I - Name of parameter column           */\n            char     *valCol,      /* I - Name of value column               */\n            long     ntimes,       /* I - Number of distinct times in file   */\n            double   *times,       /* O - Array of times in file             */\n            char     *time_status, /* O - Array of boolean results           */\n            int      *status )     /* O - Error status                       */\n/*                                                                           */\n/* Evaluate a boolean expression for each time in a compressed file,         */\n/* returning an array of flags indicating which times evaluated to TRUE/FALSE*/\n/*---------------------------------------------------------------------------*/\n{\n   parseInfo Info;\n   long alen, width;\n   int parNo, typecode;\n   int naxis, constant, nCol=0;\n   long nelem, naxes[MAXDIMS], elem;\n   char result;\n\n   if( *status ) return( *status );\n\n   fits_get_colnum( fptr, CASEINSEN, timeCol, &gParse.timeCol, status );\n   fits_get_colnum( fptr, CASEINSEN, parCol,  &gParse.parCol , status );\n   fits_get_colnum( fptr, CASEINSEN, valCol,  &gParse.valCol, status );\n   if( *status ) return( *status );\n   \n   if( ffiprs( fptr, 1, expr, MAXDIMS, &Info.datatype, &nelem,\n               &naxis, naxes, status ) ) {\n      ffcprs();\n      return( *status );\n   }\n   if( nelem<0 ) {\n      constant = 1;\n      nelem = -nelem;\n      nCol = gParse.nCols;\n      gParse.nCols = 0;    /*  Ignore all column references  */\n   } else\n      constant = 0;\n\n   if( Info.datatype!=TLOGICAL || nelem!=1 ) {\n      ffcprs();\n      ffpmsg(\"Expression does not evaluate to a logical scalar.\");\n      return( *status = PARSE_BAD_TYPE );\n   }\n\n   /*******************************************/\n   /* Allocate data arrays for each parameter */\n   /*******************************************/\n   \n   parNo = gParse.nCols;\n   while( parNo-- ) {\n      switch( gParse.colData[parNo].datatype ) {\n      case TLONG:\n         if( (gParse.colData[parNo].array =\n              (long *)malloc( (ntimes+1)*sizeof(long) )) )\n            ((long*)gParse.colData[parNo].array)[0] = 1234554321;\n         else\n            *status = MEMORY_ALLOCATION;\n         break;\n      case TDOUBLE:\n         if( (gParse.colData[parNo].array =\n              (double *)malloc( (ntimes+1)*sizeof(double) )) )\n            ((double*)gParse.colData[parNo].array)[0] = DOUBLENULLVALUE;\n         else\n            *status = MEMORY_ALLOCATION;\n         break;\n      case TSTRING:\n         if( !fits_get_coltype( fptr, gParse.valCol, &typecode,\n                                &alen, &width, status ) ) {\n            alen++;\n            if( (gParse.colData[parNo].array =\n                 (char **)malloc( (ntimes+1)*sizeof(char*) )) ) {\n               if( (((char **)gParse.colData[parNo].array)[0] =\n                    (char *)malloc( (ntimes+1)*sizeof(char)*alen )) ) {\n                  for( elem=1; elem<=ntimes; elem++ )\n                     ((char **)gParse.colData[parNo].array)[elem] =\n                        ((char **)gParse.colData[parNo].array)[elem-1]+alen;\n                  ((char **)gParse.colData[parNo].array)[0][0] = '\\0';\n               } else {\n                  free( gParse.colData[parNo].array );\n                  *status = MEMORY_ALLOCATION;\n               }\n            } else {\n               *status = MEMORY_ALLOCATION;\n            }\n         }\n         break;\n      }\n      if( *status ) {\n         while( parNo-- ) {\n            if( gParse.colData[parNo].datatype==TSTRING )\n               FREE( ((char **)gParse.colData[parNo].array)[0] );\n            FREE( gParse.colData[parNo].array );\n         }\n         return( *status );\n      }\n   }\n   \n   /**********************************************************************/\n   /* Read data from columns needed for the expression and then parse it */\n   /**********************************************************************/\n   \n   if( !uncompress_hkdata( fptr, ntimes, times, status ) ) {\n      if( constant ) {\n         result = gParse.Nodes[gParse.resultNode].value.data.log;\n         elem = ntimes;\n         while( elem-- ) time_status[elem] = result;\n      } else {\n         Info.dataPtr  = time_status;\n         Info.nullPtr  = NULL;\n         Info.maxRows  = ntimes;\n         *status       = parse_data( ntimes, 0, 1, ntimes, gParse.nCols,\n                                     gParse.colData, (void*)&Info );\n      }\n   }\n   \n   /************/\n   /* Clean up */\n   /************/\n   \n   parNo = gParse.nCols;\n   while ( parNo-- ) {\n      if( gParse.colData[parNo].datatype==TSTRING )\n         FREE( ((char **)gParse.colData[parNo].array)[0] );\n      FREE( gParse.colData[parNo].array );\n   }\n   \n   if( constant ) gParse.nCols = nCol;\n\n   ffcprs();\n   return(*status);\n}\n\n/*---------------------------------------------------------------------------*/\nint uncompress_hkdata( fitsfile *fptr,\n                       long     ntimes,\n                       double   *times,\n                       int      *status )\n/*                                                                           */\n/* description                                                               */\n/*---------------------------------------------------------------------------*/\n{\n   char parName[256], *sPtr[1], found[1000];\n   int parNo, anynul;\n   long naxis2, row, currelem;\n   double currtime, newtime;\n\n   sPtr[0] = parName;\n   currelem = 0;\n   currtime = -1e38;\n\n   parNo=gParse.nCols;\n   while( parNo-- ) found[parNo] = 0;\n\n   if( ffgkyj( fptr, \"NAXIS2\", &naxis2, NULL, status ) ) return( *status );\n\n   for( row=1; row<=naxis2; row++ ) {\n      if( ffgcvd( fptr, gParse.timeCol, row, 1L, 1L, 0.0,\n                  &newtime, &anynul, status ) ) return( *status );\n      if( newtime != currtime ) {\n         /*  New time encountered... propogate parameters to next row  */\n         if( currelem==ntimes ) {\n            ffpmsg(\"Found more unique time stamps than caller indicated\");\n            return( *status = PARSE_BAD_COL );\n         }\n         times[currelem++] = currtime = newtime;\n         parNo = gParse.nCols;\n         while( parNo-- ) {\n            switch( gParse.colData[parNo].datatype ) {\n            case TLONG:\n               ((long*)gParse.colData[parNo].array)[currelem] =\n                  ((long*)gParse.colData[parNo].array)[currelem-1];\n               break;\n            case TDOUBLE:\n               ((double*)gParse.colData[parNo].array)[currelem] =\n                  ((double*)gParse.colData[parNo].array)[currelem-1];\n               break;\n            case TSTRING:\n               strcpy( ((char **)gParse.colData[parNo].array)[currelem],\n                       ((char **)gParse.colData[parNo].array)[currelem-1] );\n               break;\n            }\n         }\n      }\n\n      if( ffgcvs( fptr, gParse.parCol, row, 1L, 1L, \"\",\n                  sPtr, &anynul, status ) ) return( *status );\n      parNo = gParse.nCols;\n      while( parNo-- )\n         if( !fits_strcasecmp( parName, gParse.varData[parNo].name ) ) break;\n\n      if( parNo>=0 ) {\n         found[parNo] = 1; /* Flag this parameter as found */\n         switch( gParse.colData[parNo].datatype ) {\n         case TLONG:\n            ffgcvj( fptr, gParse.valCol, row, 1L, 1L,\n                    ((long*)gParse.colData[parNo].array)[0],\n                    ((long*)gParse.colData[parNo].array)+currelem,\n                    &anynul, status );\n            break;\n         case TDOUBLE:\n            ffgcvd( fptr, gParse.valCol, row, 1L, 1L,\n                    ((double*)gParse.colData[parNo].array)[0],\n                    ((double*)gParse.colData[parNo].array)+currelem,\n                    &anynul, status );\n            break;\n         case TSTRING:\n            ffgcvs( fptr, gParse.valCol, row, 1L, 1L,\n                    ((char**)gParse.colData[parNo].array)[0],\n                    ((char**)gParse.colData[parNo].array)+currelem,\n                    &anynul, status );\n            break;\n         }\n         if( *status ) return( *status );\n      }\n   }\n\n   if( currelem<ntimes ) {\n      ffpmsg(\"Found fewer unique time stamps than caller indicated\");\n      return( *status = PARSE_BAD_COL );\n   }\n\n   /*  Check for any parameters which were not located in the table  */\n   parNo = gParse.nCols;\n   while( parNo-- )\n      if( !found[parNo] ) {\n         snprintf( parName, 256, \"Parameter not found: %-30s\", \n                  gParse.varData[parNo].name );\n         ffpmsg( parName );\n         *status = PARSE_SYNTAX_ERR;\n      }\n   return( *status );\n}\n\n/*---------------------------------------------------------------------------*/\nint ffffrw( fitsfile *fptr,         /* I - Input FITS file                   */\n            char     *expr,         /* I - Boolean expression                */\n            long     *rownum,       /* O - First row of table to eval to T   */\n            int      *status )      /* O - Error status                      */\n/*                                                                           */\n/* Evaluate a boolean expression, returning the row number of the first      */\n/* row which evaluates to TRUE                                               */\n/*---------------------------------------------------------------------------*/\n{\n   int naxis, constant, dtype;\n   long nelem, naxes[MAXDIMS];\n   char result;\n\n   if( *status ) return( *status );\n\n   FFLOCK;\n   if( ffiprs( fptr, 0, expr, MAXDIMS, &dtype, &nelem, &naxis,\n               naxes, status ) ) {\n      ffcprs();\n      FFUNLOCK;\n      return( *status );\n   }\n   if( nelem<0 ) {\n      constant = 1;\n      nelem = -nelem;\n   } else\n      constant = 0;\n\n   if( dtype!=TLOGICAL || nelem!=1 ) {\n      ffcprs();\n      ffpmsg(\"Expression does not evaluate to a logical scalar.\");\n      FFUNLOCK;\n      return( *status = PARSE_BAD_TYPE );\n   }\n\n   *rownum = 0;\n   if( constant ) { /* No need to call parser... have result from ffiprs */\n      result = gParse.Nodes[gParse.resultNode].value.data.log;\n      if( result ) {\n         /*  Make sure there is at least 1 row in table  */\n         ffgnrw( fptr, &nelem, status );\n         if( nelem )\n            *rownum = 1;\n      }\n   } else {\n      if( ffiter( gParse.nCols, gParse.colData, 0, 0,\n                  ffffrw_work, (void*)rownum, status ) == -1 )\n         *status = 0;  /* -1 indicates exitted without error before end... OK */\n   }\n\n   ffcprs();\n   FFUNLOCK;\n   return(*status);\n}\n\n/*---------------------------------------------------------------------------*/\nint ffffrw_work(long        totalrows, /* I - Total rows to be processed     */\n                long        offset,    /* I - Number of rows skipped at start*/\n                long        firstrow,  /* I - First row of this iteration    */\n                long        nrows,     /* I - Number of rows in this iter    */\n                int         nCols,     /* I - Number of columns in use       */\n                iteratorCol *colData,  /* IO- Column information/data        */\n                void        *userPtr ) /* I - Data handling instructions     */\n/*                                                                           */\n/* Iterator work function which calls the parser and searches for the        */\n/* first row which evaluates to TRUE.                                        */\n/*---------------------------------------------------------------------------*/\n{\n    long idx;\n    Node *result;\n\n    Evaluate_Parser( firstrow, nrows );\n\n    if( !gParse.status ) {\n\n       result = gParse.Nodes + gParse.resultNode;\n       if( result->operation==CONST_OP ) {\n\n          if( result->value.data.log ) {\n             *(long*)userPtr = firstrow;\n             return( -1 );\n          }\n\n       } else {\n\n          for( idx=0; idx<nrows; idx++ )\n             if( result->value.data.logptr[idx] && !result->value.undef[idx] ) {\n                *(long*)userPtr = firstrow + idx;\n                return( -1 );\n             }\n       }\n    }\n\n    return( gParse.status );\n}\n\n\nstatic int set_image_col_types (fitsfile * fptr, const char * name, int bitpix,\n                DataInfo * varInfo, iteratorCol *colIter) {\n\n   int istatus;\n   double tscale, tzero;\n   char temp[80];\n\n   switch (bitpix) {\n      case BYTE_IMG:\n      case SHORT_IMG:\n      case LONG_IMG:\n         istatus = 0;\n         if (fits_read_key(fptr, TDOUBLE, \"BZERO\", &tzero, NULL, &istatus))\n            tzero = 0.0;\n\n         istatus = 0;\n         if (fits_read_key(fptr, TDOUBLE, \"BSCALE\", &tscale, NULL, &istatus))\n            tscale = 1.0;\n\n         if (tscale == 1.0 && (tzero == 0.0 || tzero == 32768.0 )) {\n            varInfo->type     = LONG;\n            colIter->datatype = TLONG;\n         }\n         else {\n            varInfo->type     = DOUBLE;\n            colIter->datatype = TDOUBLE;\n            if (DEBUG_PIXFILTER)\n                printf(\"use DOUBLE for %s with BSCALE=%g/BZERO=%g\\n\",\n                        name, tscale, tzero);\n         }\n         break;\n\n      case LONGLONG_IMG:\n      case FLOAT_IMG:\n      case DOUBLE_IMG:\n         varInfo->type     = DOUBLE;\n         colIter->datatype = TDOUBLE;\n         break;\n      default:\n         snprintf(temp, 80,\"set_image_col_types: unrecognized image bitpix [%d]\\n\",\n                bitpix);\n         ffpmsg(temp);\n         return gParse.status = PARSE_BAD_TYPE;\n   }\n   return 0;\n}\n\n\n/*************************************************************************\n\n        Functions used by the evaluator to access FITS data\n            (find_column, find_keywd, allocateCol, load_column)\n\n *************************************************************************/\n\nstatic int find_column( char *colName, void *itslval )\n{\n   FFSTYPE *thelval = (FFSTYPE*)itslval;\n   int col_cnt, status;\n   int colnum, typecode, type;\n   long repeat, width;\n   fitsfile *fptr;\n   char temp[80];\n   double tzero,tscale;\n   int istatus;\n   DataInfo *varInfo;\n   iteratorCol *colIter;\n\nif (DEBUG_PIXFILTER)\n   printf(\"find_column(%s)\\n\", colName);\n\n   if( *colName == '#' )\n      return( find_keywd( colName + 1, itslval ) );\n\n   fptr = gParse.def_fptr;\n\n   status = 0;\n   col_cnt = gParse.nCols;\n\nif (gParse.hdutype == IMAGE_HDU) {\n   int i;\n   if (!gParse.pixFilter) {\n      gParse.status = COL_NOT_FOUND;\n      ffpmsg(\"find_column: IMAGE_HDU but no PixelFilter\");\n      return pERROR;\n   }\n\n   colnum = -1;\n   for (i = 0; i < gParse.pixFilter->count; ++i) {\n      if (!fits_strcasecmp(colName, gParse.pixFilter->tag[i]))\n         colnum = i;\n   }\n   if (colnum < 0) {\n      snprintf(temp, 80, \"find_column: PixelFilter tag %s not found\", colName);\n      ffpmsg(temp);\n      gParse.status = COL_NOT_FOUND;\n      return pERROR;\n   }\n\n   if( allocateCol( col_cnt, &gParse.status ) ) return pERROR;\n\n   varInfo = gParse.varData + col_cnt;\n   colIter = gParse.colData + col_cnt;\n\n   fptr = gParse.pixFilter->ifptr[colnum];\n   fits_get_img_param(fptr,\n                MAXDIMS,\n                &typecode, /* actually bitpix */\n                &varInfo->naxis,\n                &varInfo->naxes[0],\n                &status);\n   varInfo->nelem = 1;\n   type = COLUMN;\n   if (set_image_col_types(fptr, colName, typecode, varInfo, colIter))\n      return pERROR;\n   colIter->fptr = fptr;\n   colIter->iotype = InputCol;\n}\nelse { /* HDU holds a table */\n   if( gParse.compressed )\n      colnum = gParse.valCol;\n   else\n      if( fits_get_colnum( fptr, CASEINSEN, colName, &colnum, &status ) ) {\n         if( status == COL_NOT_FOUND ) {\n            type = find_keywd( colName, itslval );\n            if( type != pERROR ) ffcmsg();\n            return( type );\n         }\n         gParse.status = status;\n         return pERROR;\n      }\n   \n   if( fits_get_coltype( fptr, colnum, &typecode,\n                         &repeat, &width, &status ) ) {\n      gParse.status = status;\n      return pERROR;\n   }\n\n   if( allocateCol( col_cnt, &gParse.status ) ) return pERROR;\n\n   varInfo = gParse.varData + col_cnt;\n   colIter = gParse.colData + col_cnt;\n\n   fits_iter_set_by_num( colIter, fptr, colnum, 0, InputCol );\n}\n\n   /*  Make sure we don't overflow variable name array  */\n   strncpy(varInfo->name,colName,MAXVARNAME);\n   varInfo->name[MAXVARNAME] = '\\0';\n\nif (gParse.hdutype != IMAGE_HDU) {\n   switch( typecode ) {\n   case TBIT:\n      varInfo->type     = BITSTR;\n      colIter->datatype = TBYTE;\n      type = BITCOL;\n      break;\n   case TBYTE:\n   case TSHORT:\n   case TLONG:\n      /* The datatype of column with TZERO and TSCALE keywords might be \n         float or double. \n      */\n      snprintf(temp,80,\"TZERO%d\",colnum);\n      istatus = 0;\n      if(fits_read_key(fptr,TDOUBLE,temp,&tzero,NULL,&istatus)) {\n          tzero = 0.0;\n      } \n      snprintf(temp,80,\"TSCAL%d\",colnum);\n      istatus = 0;\n      if(fits_read_key(fptr,TDOUBLE,temp,&tscale,NULL,&istatus)) {\n          tscale = 1.0;\n      } \n      if (tscale == 1.0 && (tzero == 0.0 || tzero == 32768.0 )) {\n          varInfo->type     = LONG;\n          colIter->datatype = TLONG;\n/*    Reading an unsigned long column as a long can cause overflow errors.\n      Treat the column as a double instead.\n      } else if (tscale == 1.0 &&  tzero == 2147483648.0 ) {\n          varInfo->type     = LONG;\n          colIter->datatype = TULONG;\n */\n\n      }\n      else {\n          varInfo->type     = DOUBLE;\n          colIter->datatype = TDOUBLE;\n      }\n      type = COLUMN;\n      break;\n/* \n  For now, treat 8-byte integer columns as type double.\n  This can lose precision, so the better long term solution\n  will be to add support for TLONGLONG as a separate datatype.\n*/\n   case TLONGLONG:\n   case TFLOAT:\n   case TDOUBLE:\n      varInfo->type     = DOUBLE;\n      colIter->datatype = TDOUBLE;\n      type = COLUMN;\n      break;\n   case TLOGICAL:\n      varInfo->type     = BOOLEAN;\n      colIter->datatype = TLOGICAL;\n      type = BCOLUMN;\n      break;\n   case TSTRING:\n      varInfo->type     = STRING;\n      colIter->datatype = TSTRING;\n      type = SCOLUMN;\n      if ( width >= MAX_STRLEN ) {\n\tsnprintf(temp, 80, \"column %d is wider than maximum %d characters\",\n\t\tcolnum, MAX_STRLEN-1);\n        ffpmsg(temp);\n\tgParse.status = PARSE_LRG_VECTOR;\n\treturn pERROR;\n      }\n      if( gParse.hdutype == ASCII_TBL ) repeat = width;\n      break;\n   default:\n      if (typecode < 0) {\n        snprintf(temp, 80,\"variable-length array columns are not supported. typecode = %d\", typecode);\n        ffpmsg(temp);\n      }\n      gParse.status = PARSE_BAD_TYPE;\n      return pERROR;\n   }\n   varInfo->nelem = repeat;\n   if( repeat>1 && typecode!=TSTRING ) {\n      if( fits_read_tdim( fptr, colnum, MAXDIMS,\n                          &varInfo->naxis,\n                          &varInfo->naxes[0], &status )\n          ) {\n         gParse.status = status;\n         return pERROR;\n      }\n   } else {\n      varInfo->naxis = 1;\n      varInfo->naxes[0] = 1;\n   }\n}\n   gParse.nCols++;\n   thelval->lng = col_cnt;\n\n   return( type );\n}\n\nstatic int find_keywd(char *keyname, void *itslval )\n{\n   FFSTYPE *thelval = (FFSTYPE*)itslval;\n   int status, type;\n   char keyvalue[FLEN_VALUE], dtype;\n   fitsfile *fptr;\n   double rval;\n   int bval;\n   long ival;\n\n   status = 0;\n   fptr = gParse.def_fptr;\n   if( fits_read_keyword( fptr, keyname, keyvalue, NULL, &status ) ) {\n      if( status == KEY_NO_EXIST ) {\n         /*  Do this since ffgkey doesn't put an error message on stack  */\n         snprintf(keyvalue,FLEN_VALUE, \"ffgkey could not find keyword: %s\",keyname);\n         ffpmsg(keyvalue);\n      }\n      gParse.status = status;\n      return( pERROR );\n   }\n      \n   if( fits_get_keytype( keyvalue, &dtype, &status ) ) {\n      gParse.status = status;\n      return( pERROR );\n   }\n      \n   switch( dtype ) {\n   case 'C':\n      fits_read_key_str( fptr, keyname, keyvalue, NULL, &status );\n      type = STRING;\n      strcpy( thelval->str , keyvalue );\n      break;\n   case 'L':\n      fits_read_key_log( fptr, keyname, &bval, NULL, &status );\n      type = BOOLEAN;\n      thelval->log = bval;\n      break;\n   case 'I':\n      fits_read_key_lng( fptr, keyname, &ival, NULL, &status );\n      type = LONG;\n      thelval->lng = ival;\n      break;\n   case 'F':\n      fits_read_key_dbl( fptr, keyname, &rval, NULL, &status );\n      type = DOUBLE;\n      thelval->dbl = rval;\n      break;\n   default:\n      type = pERROR;\n      break;\n   }\n\n   if( status ) {\n      gParse.status=status;\n      return pERROR;\n   }\n\n   return( type );\n}\n\nstatic int allocateCol( int nCol, int *status )\n{\n   if( (nCol%25)==0 ) {\n      if( nCol ) {\n         gParse.colData  = (iteratorCol*) realloc( gParse.colData,\n                                              (nCol+25)*sizeof(iteratorCol) );\n         gParse.varData  = (DataInfo   *) realloc( gParse.varData,\n                                              (nCol+25)*sizeof(DataInfo)    );\n      } else {\n         gParse.colData  = (iteratorCol*) malloc( 25*sizeof(iteratorCol) );\n         gParse.varData  = (DataInfo   *) malloc( 25*sizeof(DataInfo)    );\n      }\n      if(    gParse.colData  == NULL\n          || gParse.varData  == NULL    ) {\n         if( gParse.colData  ) free(gParse.colData);\n         if( gParse.varData  ) free(gParse.varData);\n         gParse.colData = NULL;\n         gParse.varData = NULL;\n         return( *status = MEMORY_ALLOCATION );\n      }\n   }\n   gParse.varData[nCol].data  = NULL;\n   gParse.varData[nCol].undef = NULL;\n   return 0;\n}\n\nstatic int load_column( int varNum, long fRow, long nRows,\n                        void *data, char *undef )\n{\n   iteratorCol *var = gParse.colData+varNum;\n   long nelem,nbytes,row,len,idx;\n   char **bitStrs, msg[80];\n   unsigned char *bytes;\n   int status = 0, anynul;\n\n  if (gParse.hdutype == IMAGE_HDU) {\n    /* This test would need to be on a per varNum basis to support\n     * cross HDU operations */\n    fits_read_imgnull(var->fptr, var->datatype, fRow, nRows,\n                data, undef, &anynul, &status);\n    if (DEBUG_PIXFILTER)\n        printf(\"load_column: IMAGE_HDU fRow=%ld, nRows=%ld => %d\\n\",\n                        fRow, nRows, status);\n  } else { \n\n   nelem = nRows * var->repeat;\n\n   switch( var->datatype ) {\n   case TBYTE:\n      nbytes = ((var->repeat+7)/8) * nRows;\n      bytes = (unsigned char *)malloc( nbytes * sizeof(char) );\n\n      ffgcvb(var->fptr, var->colnum, fRow, 1L, nbytes,\n             0, bytes, &anynul, &status);\n\n      nelem = var->repeat;\n      bitStrs = (char **)data;\n      for( row=0; row<nRows; row++ ) {\n         idx = (row)*( (nelem+7)/8 ) + 1;\n         for(len=0; len<nelem; len++) {\n            if( bytes[idx] & (1<<(7-len%8)) )\n               bitStrs[row][len] = '1';\n            else\n               bitStrs[row][len] = '0';\n            if( len%8==7 ) idx++;\n         }\n         bitStrs[row][len] = '\\0';\n      }\n\n      FREE( (char *)bytes );\n      break;\n   case TSTRING:\n      ffgcfs(var->fptr, var->colnum, fRow, 1L, nRows,\n             (char **)data, undef, &anynul, &status);\n      break;\n   case TLOGICAL:\n      ffgcfl(var->fptr, var->colnum, fRow, 1L, nelem,\n             (char *)data, undef, &anynul, &status);\n      break;\n   case TLONG:\n      ffgcfj(var->fptr, var->colnum, fRow, 1L, nelem,\n             (long *)data, undef, &anynul, &status);\n      break;\n   case TDOUBLE:\n      ffgcfd(var->fptr, var->colnum, fRow, 1L, nelem,\n             (double *)data, undef, &anynul, &status);\n      break;\n   default:\n      snprintf(msg,80,\"load_column: unexpected datatype %d\", var->datatype);\n      ffpmsg(msg);\n   }\n  }\n   if( status ) {\n      gParse.status = status;\n      return pERROR;\n   }\n\n   return 0;\n}\n\n\n/*--------------------------------------------------------------------------*/\nint fits_pixel_filter (PixelFilter * filter, int * status)\n/* Evaluate an expression using the data in the input FITS file(s)          */\n/*--------------------------------------------------------------------------*/\n{\n   parseInfo Info = { 0 };\n   int naxis, bitpix;\n   long nelem, naxes[MAXDIMS];\n   int col_cnt;\n   Node *result;\n   int datatype;\n   fitsfile * infptr;\n   fitsfile * outfptr;\n   char * DEFAULT_TAGS[] = { \"X\" };\n   char msg[256];\n   int writeBlankKwd = 0;   /* write BLANK if any output nulls? */\n\n   DEBUG_PIXFILTER = getenv(\"DEBUG_PIXFILTER\") ? 1 : 0;\n\n   if (*status)\n      return (*status);\n\n   FFLOCK;\n   if (!filter->tag || !filter->tag[0] || !filter->tag[0][0]) {\n      filter->tag = DEFAULT_TAGS;\n      if (DEBUG_PIXFILTER)\n         printf(\"using default tag '%s'\\n\", filter->tag[0]);\n   }\n\n   infptr = filter->ifptr[0];\n   outfptr = filter->ofptr;\n   gParse.pixFilter = filter;\n\n   if (ffiprs(infptr, 0, filter->expression, MAXDIMS,\n            &Info.datatype, &nelem, &naxis, naxes, status)) {\n      goto CLEANUP;\n   }\n\n   if (nelem < 0) {\n      nelem = -nelem;\n   }\n\n   {\n      /* validate result type */\n      const char * type = 0;\n      switch (Info.datatype) {\n         case TLOGICAL:  type = \"LOGICAL\"; break;\n         case TLONG:     type = \"LONG\"; break;\n         case TDOUBLE:   type = \"DOUBLE\"; break;\n         case TSTRING:   type = \"STRING\";\n                         *status = pERROR;\n                         ffpmsg(\"pixel_filter: cannot have string image\");\n         case TBIT:      type = \"BIT\";\n                         if (DEBUG_PIXFILTER)\n                            printf(\"hmm, image from bits?\\n\");\n                         break;\n         default:       type = \"UNKNOWN?!\";\n                        *status = pERROR;\n                        ffpmsg(\"pixel_filter: unexpected result datatype\");\n      }\n      if (DEBUG_PIXFILTER)\n         printf(\"result type is %s [%d]\\n\", type, Info.datatype);\n      if (*status)\n         goto CLEANUP;\n   }\n\n   if (fits_get_img_param(infptr, MAXDIMS,\n            &bitpix, &naxis, &naxes[0], status)) {\n      ffpmsg(\"pixel_filter: unable to read input image parameters\");\n      goto CLEANUP;\n   }\n\n   if (DEBUG_PIXFILTER)\n      printf(\"input bitpix %d\\n\", bitpix);\n\n   if (Info.datatype == TDOUBLE) {\n       /*  for floating point expressions, set the default output image to\n           bitpix = -32 (float) unless the default is already a double */\n       if (bitpix != DOUBLE_IMG)\n           bitpix = FLOAT_IMG;\n   }\n\n   /* override output image bitpix if specified by caller */\n   if (filter->bitpix)\n      bitpix = filter->bitpix;\n   if (DEBUG_PIXFILTER)\n      printf(\"output bitpix %d\\n\", bitpix);\n\n   if (fits_create_img(outfptr, bitpix, naxis, naxes, status)) {\n      ffpmsg(\"pixel_filter: unable to create output image\");\n      goto CLEANUP;\n   }\n\n   /* transfer keycards */\n   {\n      int i, ncards, more;\n      if (fits_get_hdrspace(infptr, &ncards, &more, status)) {\n         ffpmsg(\"pixel_filter: unable to determine number of keycards\");\n         goto CLEANUP;\n      }\n\n      for (i = 1; i <= ncards; ++i) {\n\n         int keyclass;\n         char card[FLEN_CARD];\n\n         if (fits_read_record(infptr, i, card, status)) {\n            snprintf(msg, 256,\"pixel_filter: unable to read keycard %d\", i);\n            ffpmsg(msg);\n            goto CLEANUP;\n         }\n\n         keyclass = fits_get_keyclass(card);\n         if (keyclass == TYP_STRUC_KEY) {\n            /* output structure defined by fits_create_img */\n         }\n         else if (keyclass == TYP_COMM_KEY && i < 12) {\n            /* assume this is one of the FITS standard comments */\n         }\n         else if (keyclass == TYP_NULL_KEY && bitpix < 0) {\n            /* do not transfer BLANK to real output image */\n         }\n         else if (keyclass == TYP_SCAL_KEY && bitpix < 0) {\n            /* do not transfer BZERO, BSCALE to real output image */\n         }\n         else if (fits_write_record(outfptr, card, status)) {\n            snprintf(msg,256, \"pixel_filter: unable to write keycard '%s' [%d]\\n\",\n                        card, *status);\n            ffpmsg(msg);\n            goto CLEANUP;\n         }\n      }\n   }\n\n   switch (bitpix) {\n      case BYTE_IMG: datatype = TLONG; Info.datatype = TBYTE; break;\n      case SHORT_IMG: datatype = TLONG; Info.datatype = TSHORT; break;\n      case LONG_IMG: datatype = TLONG; Info.datatype = TLONG; break;\n      case FLOAT_IMG: datatype = TDOUBLE; Info.datatype = TFLOAT; break;\n      case DOUBLE_IMG: datatype = TDOUBLE; Info.datatype = TDOUBLE; break;\n\n      default:\n           snprintf(msg, 256,\"pixel_filter: unexpected output bitpix %d\\n\", bitpix);\n           ffpmsg(msg);\n           *status = pERROR;\n           goto CLEANUP;\n   }\n\n   if (bitpix > 0) { /* arrange for NULLs in output */\n      long nullVal = filter->blank;\n      if (!filter->blank) {\n         int tstatus = 0;\n         if (fits_read_key_lng(infptr, \"BLANK\", &nullVal, 0, &tstatus)) {\n\n            writeBlankKwd = 1;\n\n            if (bitpix == BYTE_IMG)\n                nullVal = UCHAR_MAX;\n            else if (bitpix == SHORT_IMG)\n                nullVal = SHRT_MIN;\n            else if (bitpix == LONG_IMG) {\n               if (sizeof(long) == 8 && sizeof(int) == 4)\n                  nullVal = INT_MIN;\n               else\n                  nullVal = LONG_MIN;\n            }\n            else\n                printf(\"unhandled positive output BITPIX %d\\n\", bitpix);\n         }\n\n         filter->blank = nullVal;\n      }\n\n      fits_set_imgnull(outfptr, filter->blank, status);\n      if (DEBUG_PIXFILTER)\n         printf(\"using blank %ld\\n\", nullVal);\n\n   }\n\n   if (!filter->keyword[0]) {\n      iteratorCol * colIter;\n      DataInfo * varInfo;\n\n      /*************************************/\n      /* Create new iterator Output Column */\n      /*************************************/\n      col_cnt = gParse.nCols;\n      if (allocateCol(col_cnt, status))\n         goto CLEANUP;\n      gParse.nCols++;\n\n      colIter = &gParse.colData[col_cnt];\n      colIter->fptr = filter->ofptr;\n      colIter->iotype = OutputCol;\n      varInfo = &gParse.varData[col_cnt];\n      set_image_col_types(colIter->fptr, \"CREATED\", bitpix, varInfo, colIter);\n\n      Info.maxRows = -1;\n\n      if (ffiter(gParse.nCols, gParse.colData, 0,\n                     0, parse_data, &Info, status) == -1)\n            *status = 0;\n      else if (*status)\n         goto CLEANUP;\n\n      if (Info.anyNull) {\n         if (writeBlankKwd) {\n            fits_update_key_lng(outfptr, \"BLANK\", filter->blank, \"NULL pixel value\", status);\n            if (*status)\n                ffpmsg(\"pixel_filter: unable to write BLANK keyword\");\n            if (DEBUG_PIXFILTER) {\n                printf(\"output has NULLs\\n\");\n                printf(\"wrote blank [%d]\\n\", *status);\n            }\n         }\n      }\n      else if (bitpix > 0) /* never used a null */\n         if (fits_set_imgnull(outfptr, -1234554321, status))\n            ffpmsg(\"pixel_filter: unable to reset imgnull\");\n   }\n   else {\n\n      /* Put constant result into keyword */\n      char * parName = filter->keyword;\n      char * parInfo = filter->comment;\n\n      result  = gParse.Nodes + gParse.resultNode;\n      switch (Info.datatype) {\n      case TDOUBLE:\n         ffukyd(outfptr, parName, result->value.data.dbl, 15, parInfo, status);\n         break;\n      case TLONG:\n         ffukyj(outfptr, parName, result->value.data.lng, parInfo, status);\n         break;\n      case TLOGICAL:\n         ffukyl(outfptr, parName, result->value.data.log, parInfo, status);\n         break;\n      case TBIT:\n      case TSTRING:\n         ffukys(outfptr, parName, result->value.data.str, parInfo, status);\n         break;\n      default:\n         snprintf(msg, 256,\"pixel_filter: unexpected constant result type [%d]\\n\",\n                Info.datatype);\n         ffpmsg(msg);\n      }\n   }\n\nCLEANUP:\n   ffcprs();\n   FFUNLOCK;\n   return (*status);\n}\n"},{"id":16682,"name":"checksum.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, checksum.c, contains the checksum-related routines in the   */\n/*  FITSIO library.                                                        */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n/*------------------------------------------------------------------------*/\nint ffcsum(fitsfile *fptr,      /* I - FITS file pointer                  */\n           long nrec,           /* I - number of 2880-byte blocks to sum  */\n           unsigned long *sum,  /* IO - accumulated checksum              */\n           int *status)         /* IO - error status                      */\n/*\n    Calculate a 32-bit 1's complement checksum of the FITS 2880-byte blocks.\n    This routine is based on the C algorithm developed by Rob\n    Seaman at NOAO that was presented at the 1994 ADASS conference,  \n    published in the Astronomical Society of the Pacific Conference Series.\n    This uses a 32-bit 1's complement checksum in which the overflow bits\n    are permuted back into the sum and therefore all bit positions are\n    sampled evenly. \n*/\n{\n    long ii, jj;\n    unsigned short sbuf[1440];\n    unsigned long hi, lo, hicarry, locarry;\n\n    if (*status > 0)\n        return(*status);\n  /*\n    Sum the specified number of FITS 2880-byte records.  This assumes that\n    the FITSIO file pointer points to the start of the records to be summed.\n    Read each FITS block as 1440 short values (do byte swapping if needed).\n  */\n    for (jj = 0; jj < nrec; jj++)\n    {\n      ffgbyt(fptr, 2880, sbuf, status);\n\n#if BYTESWAPPED\n\n      ffswap2( (short *)sbuf, 1440); /* reverse order of bytes in each value */\n\n#endif\n\n      hi = (*sum >> 16);\n      lo = *sum & 0xFFFF;\n\n      for (ii = 0; ii < 1440; ii += 2)\n      {\n        hi += sbuf[ii];\n        lo += sbuf[ii+1];\n      }\n\n      hicarry = hi >> 16;    /* fold carry bits in */\n      locarry = lo >> 16;\n\n      while (hicarry | locarry)\n      {\n        hi = (hi & 0xFFFF) + locarry;\n        lo = (lo & 0xFFFF) + hicarry;\n        hicarry = hi >> 16;\n        locarry = lo >> 16;\n      }\n\n      *sum = (hi << 16) + lo;\n    }\n    return(*status);\n}\n/*-------------------------------------------------------------------------*/\nvoid ffesum(unsigned long sum,  /* I - accumulated checksum                */\n           int complm,          /* I - = 1 to encode complement of the sum */\n           char *ascii)         /* O - 16-char ASCII encoded checksum      */\n/*\n    encode the 32 bit checksum by converting every \n    2 bits of each byte into an ASCII character (32 bit word encoded \n    as 16 character string).   Only ASCII letters and digits are used\n    to encode the values (no ASCII punctuation characters).\n\n    If complm=TRUE, then the complement of the sum will be encoded.\n\n    This routine is based on the C algorithm developed by Rob\n    Seaman at NOAO that was presented at the 1994 ADASS conference,\n    published in the Astronomical Society of the Pacific Conference Series.\n*/\n{\n    unsigned int exclude[13] = { 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40,\n                                       0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60 };\n    unsigned long mask[4] = { 0xff000000, 0xff0000, 0xff00, 0xff  };\n\n    int offset = 0x30;     /* ASCII 0 (zero) */\n\n    unsigned long value;\n    int byte, quotient, remainder, ch[4], check, ii, jj, kk;\n    char asc[32];\n\n    if (complm)\n        value = 0xFFFFFFFF - sum;   /* complement each bit of the value */\n    else\n        value = sum;\n\n    for (ii = 0; ii < 4; ii++)\n    {\n        byte = (value & mask[ii]) >> (24 - (8 * ii));\n        quotient = byte / 4 + offset;\n        remainder = byte % 4;\n        for (jj = 0; jj < 4; jj++)\n            ch[jj] = quotient;\n\n        ch[0] += remainder;\n\n        for (check = 1; check;)   /* avoid ASCII  punctuation */\n            for (check = 0, kk = 0; kk < 13; kk++)\n                for (jj = 0; jj < 4; jj += 2)\n                    if ((unsigned char) ch[jj] == exclude[kk] ||\n                        (unsigned char) ch[jj+1] == exclude[kk])\n                    {\n                        ch[jj]++;\n                        ch[jj+1]--;\n                        check++;\n                    }\n\n        for (jj = 0; jj < 4; jj++)        /* assign the bytes */\n            asc[4*jj+ii] = ch[jj];\n    }\n\n    for (ii = 0; ii < 16; ii++)       /* shift the bytes 1 to the right */\n        ascii[ii] = asc[(ii+15)%16];\n\n    ascii[16] = '\\0';\n}\n/*-------------------------------------------------------------------------*/\nunsigned long ffdsum(char *ascii,  /* I - 16-char ASCII encoded checksum   */\n                     int complm,   /* I - =1 to decode complement of the   */\n                     unsigned long *sum)  /* O - 32-bit checksum           */\n/*\n    decode the 16-char ASCII encoded checksum into an unsigned 32-bit long.\n    If complm=TRUE, then the complement of the sum will be decoded.\n\n    This routine is based on the C algorithm developed by Rob\n    Seaman at NOAO that was presented at the 1994 ADASS conference,\n    published in the Astronomical Society of the Pacific Conference Series.\n*/\n{\n    char cbuf[16];\n    unsigned long hi = 0, lo = 0, hicarry, locarry;\n    int ii;\n\n    /* remove the permuted FITS byte alignment and the ASCII 0 offset */\n    for (ii = 0; ii < 16; ii++)\n    {\n        cbuf[ii] = ascii[(ii+1)%16];\n        cbuf[ii] -= 0x30;\n    }\n\n    for (ii = 0; ii < 16; ii += 4)\n    {\n        hi += (cbuf[ii]   << 8) + cbuf[ii+1];\n        lo += (cbuf[ii+2] << 8) + cbuf[ii+3];\n    }\n\n    hicarry = hi >> 16;\n    locarry = lo >> 16;\n    while (hicarry || locarry)\n    {\n        hi = (hi & 0xFFFF) + locarry;\n        lo = (lo & 0xFFFF) + hicarry;\n        hicarry = hi >> 16;\n        locarry = lo >> 16;\n    }\n\n    *sum = (hi << 16) + lo;\n    if (complm)\n        *sum = 0xFFFFFFFF - *sum;   /* complement each bit of the value */\n\n    return(*sum);\n}\n/*------------------------------------------------------------------------*/\nint ffpcks(fitsfile *fptr,      /* I - FITS file pointer                  */\n           int *status)         /* IO - error status                      */\n/*\n   Create or update the checksum keywords in the CHDU.  These keywords\n   provide a checksum verification of the FITS HDU based on the ASCII\n   coded 1's complement checksum algorithm developed by Rob Seaman at NOAO.\n*/\n{\n    char datestr[20], checksum[FLEN_VALUE], datasum[FLEN_VALUE];\n    char  comm[FLEN_COMMENT], chkcomm[FLEN_COMMENT], datacomm[FLEN_COMMENT];\n    int tstatus;\n    long nrec;\n    LONGLONG headstart, datastart, dataend;\n    unsigned long dsum, olddsum, sum;\n    double tdouble;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* generate current date string and construct the keyword comments */\n    ffgstm(datestr, NULL, status);\n    strcpy(chkcomm, \"HDU checksum updated \");\n    strcat(chkcomm, datestr);\n    strcpy(datacomm, \"data unit checksum updated \");\n    strcat(datacomm, datestr);\n\n    /* write the CHECKSUM keyword if it does not exist */\n    tstatus = *status;\n    if (ffgkys(fptr, \"CHECKSUM\", checksum, comm, status) == KEY_NO_EXIST)\n    {\n        *status = tstatus;\n        strcpy(checksum, \"0000000000000000\");\n        ffpkys(fptr, \"CHECKSUM\", checksum, chkcomm, status);\n    }\n\n    /* write the DATASUM keyword if it does not exist */\n    tstatus = *status;\n    if (ffgkys(fptr, \"DATASUM\", datasum, comm, status) == KEY_NO_EXIST)\n    {\n        *status = tstatus;\n        olddsum = 0;\n        ffpkys(fptr, \"DATASUM\", \"         0\", datacomm, status);\n\n        /* set the CHECKSUM keyword as undefined, if it isn't already */\n        if (strcmp(checksum, \"0000000000000000\") )\n        {\n            strcpy(checksum, \"0000000000000000\");\n            ffmkys(fptr, \"CHECKSUM\", checksum, chkcomm, status);\n        }\n    }\n    else\n    {\n        /* decode the datasum into an unsigned long variable */\n\n        /* olddsum = strtoul(datasum, 0, 10); doesn't work on SUN OS */\n\n        tdouble = atof(datasum);\n        olddsum = (unsigned long) tdouble;\n    }\n\n    /* close header: rewrite END keyword and following blank fill */\n    /* and re-read the required keywords to determine the structure */\n    if (ffrdef(fptr, status) > 0)\n        return(*status);\n\n    if ((fptr->Fptr)->heapsize > 0)\n         ffuptf(fptr, status);  /* update the variable length TFORM values */\n\n    /* write the correct data fill values, if they are not already correct */\n    if (ffpdfl(fptr, status) > 0)\n        return(*status);\n\n    /* calc size of data unit, in FITS 2880-byte blocks */\n    if (ffghadll(fptr, &headstart, &datastart, &dataend, status) > 0)\n        return(*status);\n\n    nrec = (long) ((dataend - datastart) / 2880);\n    dsum = 0;\n\n    if (nrec > 0)\n    {\n        /* accumulate the 32-bit 1's complement checksum */\n        ffmbyt(fptr, datastart, REPORT_EOF, status);\n        if (ffcsum(fptr, nrec, &dsum, status) > 0)\n            return(*status);\n    }\n\n    if (dsum != olddsum)\n    {\n        /* update the DATASUM keyword with the correct value */ \n        snprintf(datasum, FLEN_VALUE, \"%lu\", dsum);\n        ffmkys(fptr, \"DATASUM\", datasum, datacomm, status);\n\n        /* set the CHECKSUM keyword as undefined, if it isn't already */\n        if (strcmp(checksum, \"0000000000000000\") )\n        {\n            strcpy(checksum, \"0000000000000000\");\n            ffmkys(fptr, \"CHECKSUM\", checksum, chkcomm, status);\n        }\n    }        \n\n    if (strcmp(checksum, \"0000000000000000\") )\n    {\n        /* check if CHECKSUM is still OK; move to the start of the header */\n        ffmbyt(fptr, headstart, REPORT_EOF, status);\n\n        /* accumulate the header checksum into the previous data checksum */\n        nrec = (long) ((datastart - headstart) / 2880);\n        sum = dsum;\n        if (ffcsum(fptr, nrec, &sum, status) > 0)\n            return(*status);\n\n        if (sum == 0 || sum == 0xFFFFFFFF)\n           return(*status);            /* CHECKSUM is correct */\n\n        /* Zero the CHECKSUM and recompute the new value */\n        ffmkys(fptr, \"CHECKSUM\", \"0000000000000000\", chkcomm, status);\n    }\n\n    /* move to the start of the header */\n    ffmbyt(fptr, headstart, REPORT_EOF, status);\n\n    /* accumulate the header checksum into the previous data checksum */\n    nrec = (long) ((datastart - headstart) / 2880);\n    sum = dsum;\n    if (ffcsum(fptr, nrec, &sum, status) > 0)\n           return(*status);\n\n    /* encode the COMPLEMENT of the checksum into a 16-character string */\n    ffesum(sum, TRUE, checksum);\n\n    /* update the CHECKSUM keyword value with the new string */\n    ffmkys(fptr, \"CHECKSUM\", checksum, \"&\", status);\n\n    return(*status);\n}\n/*------------------------------------------------------------------------*/\nint ffupck(fitsfile *fptr,      /* I - FITS file pointer                  */\n           int *status)         /* IO - error status                      */\n/*\n   Update the CHECKSUM keyword value.  This assumes that the DATASUM\n   keyword exists and has the correct value.\n*/\n{\n    char datestr[20], chkcomm[FLEN_COMMENT], comm[FLEN_COMMENT];\n    char checksum[FLEN_VALUE], datasum[FLEN_VALUE];\n    int tstatus;\n    long nrec;\n    LONGLONG headstart, datastart, dataend;\n    unsigned long sum, dsum;\n    double tdouble;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* generate current date string and construct the keyword comments */\n    ffgstm(datestr, NULL, status);\n    strcpy(chkcomm, \"HDU checksum updated \");\n    strcat(chkcomm, datestr);\n\n    /* get the DATASUM keyword and convert it to a unsigned long */\n    if (ffgkys(fptr, \"DATASUM\", datasum, comm, status) == KEY_NO_EXIST)\n    {\n        ffpmsg(\"DATASUM keyword not found (ffupck\");\n        return(*status);\n    }\n\n    tdouble = atof(datasum); /* read as a double as a workaround */\n    dsum = (unsigned long) tdouble;\n\n    /* get size of the HDU */\n    if (ffghadll(fptr, &headstart, &datastart, &dataend, status) > 0)\n        return(*status);\n\n    /* get the checksum keyword, if it exists */\n    tstatus = *status;\n    if (ffgkys(fptr, \"CHECKSUM\", checksum, comm, status) == KEY_NO_EXIST)\n    {\n        *status = tstatus;\n        strcpy(checksum, \"0000000000000000\");\n        ffpkys(fptr, \"CHECKSUM\", checksum, chkcomm, status);\n    }\n    else\n    {\n        /* check if CHECKSUM is still OK */\n        /* rewrite END keyword and following blank fill */\n        if (ffwend(fptr, status) > 0)\n            return(*status);\n\n        /* move to the start of the header */\n        ffmbyt(fptr, headstart, REPORT_EOF, status);\n\n        /* accumulate the header checksum into the previous data checksum */\n        nrec = (long) ((datastart - headstart) / 2880);\n        sum = dsum;\n        if (ffcsum(fptr, nrec, &sum, status) > 0)\n           return(*status);\n\n        if (sum == 0 || sum == 0xFFFFFFFF)\n           return(*status);    /* CHECKSUM is already correct */\n\n        /* Zero the CHECKSUM and recompute the new value */\n        ffmkys(fptr, \"CHECKSUM\", \"0000000000000000\", chkcomm, status);\n    }\n\n    /* move to the start of the header */\n    ffmbyt(fptr, headstart, REPORT_EOF, status);\n\n    /* accumulate the header checksum into the previous data checksum */\n    nrec = (long) ((datastart - headstart) / 2880);\n    sum = dsum;\n    if (ffcsum(fptr, nrec, &sum, status) > 0)\n           return(*status);\n\n    /* encode the COMPLEMENT of the checksum into a 16-character string */\n    ffesum(sum, TRUE, checksum);\n\n    /* update the CHECKSUM keyword value with the new string */\n    ffmkys(fptr, \"CHECKSUM\", checksum, \"&\", status);\n\n    return(*status);\n}\n/*------------------------------------------------------------------------*/\nint ffvcks(fitsfile *fptr,      /* I - FITS file pointer                  */\n           int *datastatus,     /* O - data checksum status               */\n           int *hdustatus,      /* O - hdu checksum status                */\n                                /*     1  verification is correct         */\n                                /*     0  checksum keyword is not present */\n                                /*    -1 verification not correct         */\n           int *status)         /* IO - error status                      */\n/*\n    Verify the HDU by comparing the value of the computed checksums against\n    the values of the DATASUM and CHECKSUM keywords if they are present.\n*/\n{\n    int tstatus;\n    double tdouble;\n    unsigned long datasum, hdusum, olddatasum;\n    char chksum[FLEN_VALUE], comm[FLEN_COMMENT];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    *datastatus = -1;\n    *hdustatus  = -1;\n\n    tstatus = *status;\n    if (ffgkys(fptr, \"CHECKSUM\", chksum, comm, status) == KEY_NO_EXIST)\n    {\n        *hdustatus = 0;             /* CHECKSUM keyword does not exist */\n        *status = tstatus;\n    }\n    if (chksum[0] == '\\0')\n        *hdustatus = 0;    /* all blank checksum means it is undefined */\n\n    if (ffgkys(fptr, \"DATASUM\", chksum, comm, status) == KEY_NO_EXIST)\n    {\n        *datastatus = 0;            /* DATASUM keyword does not exist */\n        *status = tstatus;\n    }\n    if (chksum[0] == '\\0')\n        *datastatus = 0;    /* all blank checksum means it is undefined */\n\n    if ( *status > 0 || (!(*hdustatus) && !(*datastatus)) )\n        return(*status);            /* return if neither keywords exist */\n\n    /* convert string to unsigned long */\n\n    /* olddatasum = strtoul(chksum, 0, 10);  doesn't work w/ gcc on SUN OS */\n    /* sscanf(chksum, \"%u\", &olddatasum);   doesn't work w/ cc on VAX/VMS */\n\n    tdouble = atof(chksum); /* read as a double as a workaround */\n    olddatasum = (unsigned long) tdouble;\n\n    /*  calculate the data checksum and the HDU checksum */\n    if (ffgcks(fptr, &datasum, &hdusum, status) > 0)\n        return(*status);\n\n    if (*datastatus)\n        if (datasum == olddatasum)\n            *datastatus = 1;\n\n    if (*hdustatus)\n        if (hdusum == 0 || hdusum == 0xFFFFFFFF)\n            *hdustatus = 1;\n\n    return(*status);\n}\n/*------------------------------------------------------------------------*/\nint ffgcks(fitsfile *fptr,           /* I - FITS file pointer             */\n           unsigned long *datasum,   /* O - data checksum                 */\n           unsigned long *hdusum,    /* O - hdu checksum                  */\n           int *status)              /* IO - error status                 */\n\n    /* calculate the checksums of the data unit and the total HDU */\n{\n    long nrec;\n    LONGLONG headstart, datastart, dataend;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* get size of the HDU */\n    if (ffghadll(fptr, &headstart, &datastart, &dataend, status) > 0)\n        return(*status);\n\n    nrec = (long) ((dataend - datastart) / 2880);\n\n    *datasum = 0;\n\n    if (nrec > 0)\n    {\n        /* accumulate the 32-bit 1's complement checksum */\n        ffmbyt(fptr, datastart, REPORT_EOF, status);\n        if (ffcsum(fptr, nrec, datasum, status) > 0)\n            return(*status);\n    }\n\n    /* move to the start of the header and calc. size of header */\n    ffmbyt(fptr, headstart, REPORT_EOF, status);\n    nrec = (long) ((datastart - headstart) / 2880);\n\n    /* accumulate the header checksum into the previous data checksum */\n    *hdusum = *datasum;\n    ffcsum(fptr, nrec, hdusum, status);\n\n    return(*status);\n}\n\n"},{"id":16683,"name":"wcsutil.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"#include <math.h>\n#include \"fitsio2.h\"\n#define D2R 0.01745329252\n#define TWOPI 6.28318530717959\n\n/*--------------------------------------------------------------------------*/\nint ffwldp(double xpix, double ypix, double xref, double yref,\n      double xrefpix, double yrefpix, double xinc, double yinc, double rot,\n      char *type, double *xpos, double *ypos, int *status)\n\n/* This routine is based on the classic AIPS WCS routine. \n\n   It converts from pixel location to RA,Dec for 9 projective geometries:\n   \"-CAR\", \"-SIN\", \"-TAN\", \"-ARC\", \"-NCP\", \"-GLS\", \"-MER\", \"-AIT\" and \"-STG\".\n*/\n\n/*-----------------------------------------------------------------------*/\n/* routine to determine accurate position for pixel coordinates          */\n/* returns 0 if successful otherwise:                                    */\n/* 501 = angle too large for projection;                                 */\n/* does: -CAR, -SIN, -TAN, -ARC, -NCP, -GLS, -MER, -AIT  -STG projections*/\n/* Input:                                                                */\n/*   f   xpix    x pixel number  (RA or long without rotation)           */\n/*   f   ypiy    y pixel number  (dec or lat without rotation)           */\n/*   d   xref    x reference coordinate value (deg)                      */\n/*   d   yref    y reference coordinate value (deg)                      */\n/*   f   xrefpix x reference pixel                                       */\n/*   f   yrefpix y reference pixel                                       */\n/*   f   xinc    x coordinate increment (deg)                            */\n/*   f   yinc    y coordinate increment (deg)                            */\n/*   f   rot     rotation (deg)  (from N through E)                      */\n/*   c  *type    projection type code e.g. \"-SIN\";                       */\n/* Output:                                                               */\n/*   d   *xpos   x (RA) coordinate (deg)                                 */\n/*   d   *ypos   y (dec) coordinate (deg)                                */\n/*-----------------------------------------------------------------------*/\n {double cosr, sinr, dx, dy, dz, temp, x, y, z;\n  double sins, coss, dect, rat, dt, l, m, mg, da, dd, cos0, sin0;\n  double dec0, ra0;\n  double geo1, geo2, geo3;\n  double deps = 1.0e-5;\n  char *cptr;\n  \n  if (*status > 0)\n     return(*status);\n\n/*   Offset from ref pixel  */\n  dx = (xpix-xrefpix) * xinc;\n  dy = (ypix-yrefpix) * yinc;\n\n/*   Take out rotation  */\n  cosr = cos(rot * D2R);\n  sinr = sin(rot * D2R);\n  if (rot != 0.0) {\n     temp = dx * cosr - dy * sinr;\n     dy = dy * cosr + dx * sinr;\n     dx = temp;\n  }\n\n/* convert to radians  */\n  ra0 = xref * D2R;\n  dec0 = yref * D2R;\n\n  l = dx * D2R;\n  m = dy * D2R;\n  sins = l*l + m*m;\n  cos0 = cos(dec0);\n  sin0 = sin(dec0);\n\n  if (*type != '-') {  /* unrecognized projection code */\n     return(*status = 504);\n  }\n\n    cptr = type + 1;\n\n    if (*cptr == 'C') { /* linear -CAR */\n      if (*(cptr + 1) != 'A' ||  *(cptr + 2) != 'R') {\n         return(*status = 504);\n      }\n      rat =  ra0 + l;\n      dect = dec0 + m;\n\n    } else if (*cptr == 'T') {  /* -TAN */\n      if (*(cptr + 1) != 'A' ||  *(cptr + 2) != 'N') {\n         return(*status = 504);\n      }\n      x = cos0*cos(ra0) - l*sin(ra0) - m*cos(ra0)*sin0;\n      y = cos0*sin(ra0) + l*cos(ra0) - m*sin(ra0)*sin0;\n      z = sin0                       + m*         cos0;\n      rat  = atan2( y, x );\n      dect = atan ( z / sqrt(x*x+y*y) );\n\n    } else if (*cptr == 'S') {\n\n      if (*(cptr + 1) == 'I' &&  *(cptr + 2) == 'N') { /* -SIN */\n          if (sins>1.0)\n\t    return(*status = 501);\n          coss = sqrt (1.0 - sins);\n          dt = sin0 * coss + cos0 * m;\n          if ((dt>1.0) || (dt<-1.0))\n\t    return(*status = 501);\n          dect = asin (dt);\n          rat = cos0 * coss - sin0 * m;\n          if ((rat==0.0) && (l==0.0))\n\t    return(*status = 501);\n          rat = atan2 (l, rat) + ra0;\n\n       } else if (*(cptr + 1) == 'T' &&  *(cptr + 2) == 'G') {  /* -STG Sterographic*/\n          dz = (4.0 - sins) / (4.0 + sins);\n          if (fabs(dz)>1.0)\n\t    return(*status = 501);\n          dect = dz * sin0 + m * cos0 * (1.0+dz) / 2.0;\n          if (fabs(dect)>1.0)\n\t    return(*status = 501);\n          dect = asin (dect);\n          rat = cos(dect);\n          if (fabs(rat)<deps)\n\t    return(*status = 501);\n          rat = l * (1.0+dz) / (2.0 * rat);\n          if (fabs(rat)>1.0)\n\t    return(*status = 501);\n          rat = asin (rat);\n          mg = 1.0 + sin(dect) * sin0 + cos(dect) * cos0 * cos(rat);\n          if (fabs(mg)<deps)\n\t    return(*status = 501);\n          mg = 2.0 * (sin(dect) * cos0 - cos(dect) * sin0 * cos(rat)) / mg;\n          if (fabs(mg-m)>deps)\n\t    rat = TWOPI /2.0 - rat;\n          rat = ra0 + rat;\n        } else  {\n          return(*status = 504);\n        }\n \n    } else if (*cptr == 'A') {\n\n      if (*(cptr + 1) == 'R' &&  *(cptr + 2) == 'C') { /* ARC */\n          if (sins>=TWOPI*TWOPI/4.0)\n\t    return(*status = 501);\n          sins = sqrt(sins);\n          coss = cos (sins);\n          if (sins!=0.0)\n\t    sins = sin (sins) / sins;\n          else\n\t    sins = 1.0;\n          dt = m * cos0 * sins + sin0 * coss;\n          if ((dt>1.0) || (dt<-1.0))\n\t    return(*status = 501);\n          dect = asin (dt);\n          da = coss - dt * sin0;\n          dt = l * sins * cos0;\n          if ((da==0.0) && (dt==0.0))\n\t    return(*status = 501);\n          rat = ra0 + atan2 (dt, da);\n\n      } else if (*(cptr + 1) == 'I' &&  *(cptr + 2) == 'T') {  /* -AIT Aitoff */\n          dt = yinc*cosr + xinc*sinr;\n          if (dt==0.0)\n\t    dt = 1.0;\n          dt = dt * D2R;\n          dy = yref * D2R;\n          dx = sin(dy+dt)/sqrt((1.0+cos(dy+dt))/2.0) -\n\t      sin(dy)/sqrt((1.0+cos(dy))/2.0);\n          if (dx==0.0)\n\t    dx = 1.0;\n          geo2 = dt / dx;\n          dt = xinc*cosr - yinc* sinr;\n          if (dt==0.0)\n\t    dt = 1.0;\n          dt = dt * D2R;\n          dx = 2.0 * cos(dy) * sin(dt/2.0);\n          if (dx==0.0) dx = 1.0;\n          geo1 = dt * sqrt((1.0+cos(dy)*cos(dt/2.0))/2.0) / dx;\n          geo3 = geo2 * sin(dy) / sqrt((1.0+cos(dy))/2.0);\n          rat = ra0;\n          dect = dec0;\n          if ((l != 0.0) || (m != 0.0)) {\n            dz = 4.0 - l*l/(4.0*geo1*geo1) - ((m+geo3)/geo2)*((m+geo3)/geo2) ;\n            if ((dz>4.0) || (dz<2.0)) return(*status = 501);\n            dz = 0.5 * sqrt (dz);\n            dd = (m+geo3) * dz / geo2;\n            if (fabs(dd)>1.0) return(*status = 501);\n            dd = asin (dd);\n            if (fabs(cos(dd))<deps) return(*status = 501);\n            da = l * dz / (2.0 * geo1 * cos(dd));\n            if (fabs(da)>1.0) return(*status = 501);\n            da = asin (da);\n            rat = ra0 + 2.0 * da;\n            dect = dd;\n          }\n        } else  {\n          return(*status = 504);\n        }\n \n    } else if (*cptr == 'N') { /* -NCP North celestial pole*/\n      if (*(cptr + 1) != 'C' ||  *(cptr + 2) != 'P') {\n         return(*status = 504);\n      }\n      dect = cos0 - m * sin0;\n      if (dect==0.0)\n        return(*status = 501);\n      rat = ra0 + atan2 (l, dect);\n      dt = cos (rat-ra0);\n      if (dt==0.0)\n        return(*status = 501);\n      dect = dect / dt;\n      if ((dect>1.0) || (dect<-1.0))\n        return(*status = 501);\n      dect = acos (dect);\n      if (dec0<0.0) dect = -dect;\n\n    } else if (*cptr == 'G') {   /* -GLS global sinusoid */\n      if (*(cptr + 1) != 'L' ||  *(cptr + 2) != 'S') {\n         return(*status = 504);\n      }\n      dect = dec0 + m;\n      if (fabs(dect)>TWOPI/4.0)\n        return(*status = 501);\n      coss = cos (dect);\n      if (fabs(l)>TWOPI*coss/2.0)\n        return(*status = 501);\n      rat = ra0;\n      if (coss>deps) rat = rat + l / coss;\n\n    } else if (*cptr == 'M') {  /* -MER mercator*/\n      if (*(cptr + 1) != 'E' ||  *(cptr + 2) != 'R') {\n         return(*status = 504);\n      }\n      dt = yinc * cosr + xinc * sinr;\n      if (dt==0.0) dt = 1.0;\n      dy = (yref/2.0 + 45.0) * D2R;\n      dx = dy + dt / 2.0 * D2R;\n      dy = log (tan (dy));\n      dx = log (tan (dx));\n      geo2 = dt * D2R / (dx - dy);\n      geo3 = geo2 * dy;\n      geo1 = cos (yref*D2R);\n      if (geo1<=0.0) geo1 = 1.0;\n      rat = l / geo1 + ra0;\n      if (fabs(rat - ra0) > TWOPI)\n        return(*status = 501);\n      dt = 0.0;\n      if (geo2!=0.0) dt = (m + geo3) / geo2;\n      dt = exp (dt);\n      dect = 2.0 * atan (dt) - TWOPI / 4.0;\n\n    } else  {\n      return(*status = 504);\n    }\n\n  /*  correct for RA rollover  */\n  if (rat-ra0>TWOPI/2.0) rat = rat - TWOPI;\n  if (rat-ra0<-TWOPI/2.0) rat = rat + TWOPI;\n  if (rat < 0.0) rat += TWOPI;\n\n  /*  convert to degrees  */\n  *xpos  = rat  / D2R;\n  *ypos  = dect  / D2R;\n  return(*status);\n} \n/*--------------------------------------------------------------------------*/\nint ffxypx(double xpos, double ypos, double xref, double yref, \n      double xrefpix, double yrefpix, double xinc, double yinc, double rot,\n      char *type, double *xpix, double *ypix, int *status)\n\n/* This routine is based on the classic AIPS WCS routine. \n\n   It converts from RA,Dec to pixel location to for 9 projective geometries:\n   \"-CAR\", \"-SIN\", \"-TAN\", \"-ARC\", \"-NCP\", \"-GLS\", \"-MER\", \"-AIT\" and \"-STG\".\n*/\n/*-----------------------------------------------------------------------*/\n/* routine to determine accurate pixel coordinates for an RA and Dec     */\n/* returns 0 if successful otherwise:                                    */\n/* 501 = angle too large for projection;                                 */\n/* 502 = bad values                                                      */\n/* does: -SIN, -TAN, -ARC, -NCP, -GLS, -MER, -AIT projections            */\n/* anything else is linear                                               */\n/* Input:                                                                */\n/*   d   xpos    x (RA) coordinate (deg)                                 */\n/*   d   ypos    y (dec) coordinate (deg)                                */\n/*   d   xref    x reference coordinate value (deg)                      */\n/*   d   yref    y reference coordinate value (deg)                      */\n/*   f   xrefpix x reference pixel                                       */\n/*   f   yrefpix y reference pixel                                       */\n/*   f   xinc    x coordinate increment (deg)                            */\n/*   f   yinc    y coordinate increment (deg)                            */\n/*   f   rot     rotation (deg)  (from N through E)                      */\n/*   c  *type    projection type code e.g. \"-SIN\";                       */\n/* Output:                                                               */\n/*   f  *xpix    x pixel number  (RA or long without rotation)           */\n/*   f  *ypiy    y pixel number  (dec or lat without rotation)           */\n/*-----------------------------------------------------------------------*/\n {\n  double dx, dy, dz, r, ra0, dec0, ra, dec, coss, sins, dt, da, dd, sint;\n  double l, m, geo1, geo2, geo3, sinr, cosr, cos0, sin0;\n  double deps=1.0e-5;\n  char *cptr;\n\n  if (*type != '-') {  /* unrecognized projection code */\n     return(*status = 504);\n  }\n\n  cptr = type + 1;\n\n  dt = (xpos - xref);\n  if (dt >  180) xpos -= 360;\n  if (dt < -180) xpos += 360;\n  /* NOTE: changing input argument xpos is OK (call-by-value in C!) */\n\n  /* default values - linear */\n  dx = xpos - xref;\n  dy = ypos - yref;\n\n  /*  Correct for rotation */\n  r = rot * D2R;\n  cosr = cos (r);\n  sinr = sin (r);\n  dz = dx*cosr + dy*sinr;\n  dy = dy*cosr - dx*sinr;\n  dx = dz;\n\n  /*     check axis increments - bail out if either 0 */\n  if ((xinc==0.0) || (yinc==0.0)) {*xpix=0.0; *ypix=0.0;\n    return(*status = 502);}\n\n  /*     convert to pixels  */\n  *xpix = dx / xinc + xrefpix;\n  *ypix = dy / yinc + yrefpix;\n\n  if (*cptr == 'C') { /* linear -CAR */\n      if (*(cptr + 1) != 'A' ||  *(cptr + 2) != 'R') {\n         return(*status = 504);\n      }\n\n      return(*status);  /* done if linear */\n  }\n\n  /* Non linear position */\n  ra0 = xref * D2R;\n  dec0 = yref * D2R;\n  ra = xpos * D2R;\n  dec = ypos * D2R;\n\n  /* compute direction cosine */\n  coss = cos (dec);\n  sins = sin (dec);\n  cos0 = cos (dec0);\n  sin0 = sin (dec0);\n  l = sin(ra-ra0) * coss;\n  sint = sins * sin0 + coss * cos0 * cos(ra-ra0);\n\n    /* process by case  */\n    if (*cptr == 'T') {  /* -TAN tan */\n         if (*(cptr + 1) != 'A' ||  *(cptr + 2) != 'N') {\n           return(*status = 504);\n         }\n\n         if (sint<=0.0)\n\t   return(*status = 501);\n         if( cos0<0.001 ) {\n            /* Do a first order expansion around pole */\n            m = (coss * cos(ra-ra0)) / (sins * sin0);\n            m = (-m + cos0 * (1.0 + m*m)) / sin0;\n         } else {\n            m = ( sins/sint - sin0 ) / cos0;\n         }\n\t if( fabs(sin(ra0)) < 0.3 ) {\n\t    l  = coss*sin(ra)/sint - cos0*sin(ra0) + m*sin(ra0)*sin0;\n\t    l /= cos(ra0);\n\t } else {\n\t    l  = coss*cos(ra)/sint - cos0*cos(ra0) + m*cos(ra0)*sin0;\n\t    l /= -sin(ra0);\n\t }\n\n    } else if (*cptr == 'S') {\n\n      if (*(cptr + 1) == 'I' &&  *(cptr + 2) == 'N') { /* -SIN */\n         if (sint<0.0)\n\t   return(*status = 501);\n         m = sins * cos(dec0) - coss * sin(dec0) * cos(ra-ra0);\n\n      } else if (*(cptr + 1) == 'T' &&  *(cptr + 2) == 'G') {  /* -STG Sterographic*/\n         da = ra - ra0;\n         if (fabs(dec)>TWOPI/4.0)\n\t   return(*status = 501);\n         dd = 1.0 + sins * sin(dec0) + coss * cos(dec0) * cos(da);\n         if (fabs(dd)<deps)\n\t   return(*status = 501);\n         dd = 2.0 / dd;\n         l = l * dd;\n         m = dd * (sins * cos(dec0) - coss * sin(dec0) * cos(da));\n\n        } else  {\n          return(*status = 504);\n        }\n \n    } else if (*cptr == 'A') {\n\n      if (*(cptr + 1) == 'R' &&  *(cptr + 2) == 'C') { /* ARC */\n         m = sins * sin(dec0) + coss * cos(dec0) * cos(ra-ra0);\n         if (m<-1.0) m = -1.0;\n         if (m>1.0) m = 1.0;\n         m = acos (m);\n         if (m!=0) \n            m = m / sin(m);\n         else\n            m = 1.0;\n         l = l * m;\n         m = (sins * cos(dec0) - coss * sin(dec0) * cos(ra-ra0)) * m;\n\n      } else if (*(cptr + 1) == 'I' &&  *(cptr + 2) == 'T') {  /* -AIT Aitoff */\n         da = (ra - ra0) / 2.0;\n         if (fabs(da)>TWOPI/4.0)\n\t     return(*status = 501);\n         dt = yinc*cosr + xinc*sinr;\n         if (dt==0.0) dt = 1.0;\n         dt = dt * D2R;\n         dy = yref * D2R;\n         dx = sin(dy+dt)/sqrt((1.0+cos(dy+dt))/2.0) -\n             sin(dy)/sqrt((1.0+cos(dy))/2.0);\n         if (dx==0.0) dx = 1.0;\n         geo2 = dt / dx;\n         dt = xinc*cosr - yinc* sinr;\n         if (dt==0.0) dt = 1.0;\n         dt = dt * D2R;\n         dx = 2.0 * cos(dy) * sin(dt/2.0);\n         if (dx==0.0) dx = 1.0;\n         geo1 = dt * sqrt((1.0+cos(dy)*cos(dt/2.0))/2.0) / dx;\n         geo3 = geo2 * sin(dy) / sqrt((1.0+cos(dy))/2.0);\n         dt = sqrt ((1.0 + cos(dec) * cos(da))/2.0);\n         if (fabs(dt)<deps)\n\t     return(*status = 503);\n         l = 2.0 * geo1 * cos(dec) * sin(da) / dt;\n         m = geo2 * sin(dec) / dt - geo3;\n\n        } else  {\n          return(*status = 504);\n        }\n \n    } else if (*cptr == 'N') { /* -NCP North celestial pole*/\n         if (*(cptr + 1) != 'C' ||  *(cptr + 2) != 'P') {\n             return(*status = 504);\n         }\n\n         if (dec0==0.0) \n\t     return(*status = 501);  /* can't stand the equator */\n         else\n\t   m = (cos(dec0) - coss * cos(ra-ra0)) / sin(dec0);\n\n    } else if (*cptr == 'G') {   /* -GLS global sinusoid */\n         if (*(cptr + 1) != 'L' ||  *(cptr + 2) != 'S') {\n             return(*status = 504);\n         }\n\n         dt = ra - ra0;\n         if (fabs(dec)>TWOPI/4.0)\n\t   return(*status = 501);\n         if (fabs(dec0)>TWOPI/4.0)\n\t   return(*status = 501);\n         m = dec - dec0;\n         l = dt * coss;\n\n    } else if (*cptr == 'M') {  /* -MER mercator*/\n         if (*(cptr + 1) != 'E' ||  *(cptr + 2) != 'R') {\n             return(*status = 504);\n         }\n\n         dt = yinc * cosr + xinc * sinr;\n         if (dt==0.0) dt = 1.0;\n         dy = (yref/2.0 + 45.0) * D2R;\n         dx = dy + dt / 2.0 * D2R;\n         dy = log (tan (dy));\n         dx = log (tan (dx));\n         geo2 = dt * D2R / (dx - dy);\n         geo3 = geo2 * dy;\n         geo1 = cos (yref*D2R);\n         if (geo1<=0.0) geo1 = 1.0;\n         dt = ra - ra0;\n         l = geo1 * dt;\n         dt = dec / 2.0 + TWOPI / 8.0;\n         dt = tan (dt);\n         if (dt<deps)\n\t   return(*status = 502);\n         m = geo2 * log (dt) - geo3;\n\n    } else  {\n      return(*status = 504);\n    }\n\n    /*   convert to degrees  */\n    dx = l / D2R;\n    dy = m / D2R;\n\n    /*  Correct for rotation */\n    dz = dx*cosr + dy*sinr;\n    dy = dy*cosr - dx*sinr;\n    dx = dz;\n\n    /*     convert to pixels  */\n    *xpix = dx / xinc + xrefpix;\n    *ypix = dy / yinc + yrefpix;\n    return(*status);\n}\n"},{"id":16684,"name":"getcolsb.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, getcolsb.c, contains routines that read data elements from   */\n/*  a FITS image or table, with signed char (signed byte) data type.        */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <math.h>\n#include <stdlib.h>\n#include <limits.h>\n#include <string.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffgpvsb(fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            signed char nulval, /* I - value for undefined pixels            */\n            signed char *array, /* O - array of values that are returned     */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Undefined elements will be set equal to NULVAL, unless NULVAL=0\n  in which case no checking for undefined values will be performed.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    char cdummy;\n    int nullcheck = 1;\n    signed char nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n         nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_pixels(fptr, TSBYTE, firstelem, nelem,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclsb(fptr, 2, row, firstelem, nelem, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgpfsb(fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            signed char *array, /* O - array of values that are returned     */\n            char *nularray,   /* O - array of null pixel flags               */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Any undefined pixels in the returned array will be set = 0 and the \n  corresponding nularray value will be set = 1.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    int nullcheck = 2;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_read_compressed_pixels(fptr, TSBYTE, firstelem, nelem,\n            nullcheck, NULL, array, nularray, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclsb(fptr, 2, row, firstelem, nelem, 1, 2, 0,\n               array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg2dsb(fitsfile *fptr, /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           signed char nulval,   /* set undefined pixels equal to this     */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           signed char *array,   /* O - array to be filled and returned    */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    /* call the 3D reading routine, with the 3rd dimension = 1 */\n\n    ffg3dsb(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, \n           anynul, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg3dsb(fitsfile *fptr, /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           signed char nulval,   /* set undefined pixels equal to this     */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  nrows,     /* I - number of rows in each plane of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           LONGLONG  naxis3,    /* I - FITS image NAXIS3 value                 */\n           signed char *array,   /* O - array to be filled and returned    */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 3-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    long tablerow, ii, jj;\n    LONGLONG  nfits, narray;\n    char cdummy;\n    int  nullcheck = 1;\n    long inc[] = {1,1,1};\n    LONGLONG fpixel[] = {1,1,1};\n    LONGLONG lpixel[3];\n    signed char nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        lpixel[0] = ncols;\n        lpixel[1] = nrows;\n        lpixel[2] = naxis3;\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TSBYTE, fpixel, lpixel, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n       /* all the image pixels are contiguous, so read all at once */\n       ffgclsb(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n       return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to read */\n    narray = 0;  /* next pixel in output array to be filled */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* reading naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffgclsb(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval,\n          &array[narray], &cdummy, anynul, status) > 0)\n          return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsvsb(fitsfile *fptr, /* I - FITS file pointer                        */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           signed char nulval, /* I - value to set undefined pixels         */\n           signed char *array, /* O - array to be filled and returned       */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii, i0, i1, i2, i3, i4, i5, i6, i7, i8, row, rstr, rstp, rinc;\n    long str[9], stp[9], incr[9], dir[9];\n    long nelem, nultyp, ninc, numcol;\n    LONGLONG felem, dsize[10], blcll[9], trcll[9];\n    int hdutype, anyf;\n    char ldummy, msg[FLEN_ERRMSG];\n    int  nullcheck = 1;\n    signed char nullvalue;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvsb is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TSBYTE, blcll, trcll, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 1;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n        dir[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        if (hdutype == IMAGE_HDU)\n        {\n           dir[ii] = -1;\n        }\n        else\n        {\n          snprintf(msg, FLEN_ERRMSG,\"ffgsvsb: illegal range specified for axis %ld\", ii + 1);\n          ffpmsg(msg);\n          return(*status = BAD_PIX_NUM);\n        }\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n      dsize[ii] = dsize[ii] * dir[ii];\n    }\n    dsize[naxis] = dsize[naxis] * dir[naxis];\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0]*dir[0] - str[0]*dir[0]) / inc[0] + 1;\n      ninc = incr[0] * dir[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]*dir[8]; i8 <= stp[8]*dir[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]*dir[7]; i7 <= stp[7]*dir[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]*dir[6]; i6 <= stp[6]*dir[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]*dir[5]; i5 <= stp[5]*dir[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]*dir[4]; i4 <= stp[4]*dir[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]*dir[3]; i3 <= stp[3]*dir[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]*dir[2]; i2 <= stp[2]*dir[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]*dir[1]; i1 <= stp[1]*dir[1]; i1 += incr[1])\n            {\n\n              felem=str[0] + (i1 - dir[1]) * dsize[1] + (i2 - dir[2]) * dsize[2] + \n                             (i3 - dir[3]) * dsize[3] + (i4 - dir[4]) * dsize[4] +\n                             (i5 - dir[5]) * dsize[5] + (i6 - dir[6]) * dsize[6] +\n                             (i7 - dir[7]) * dsize[7] + (i8 - dir[8]) * dsize[8];\n\n              if ( ffgclsb(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &ldummy, &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsfsb(fitsfile *fptr, /* I - FITS file pointer                        */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           signed char *array,   /* O - array to be filled and returned     */\n           char *flagval,  /* O - set to 1 if corresponding value is null   */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dsize[10];\n    LONGLONG blcll[9], trcll[9];\n    long felem, nelem, nultyp, ninc, numcol;\n    int hdutype, anyf;\n    signed char nulval = 0;\n    char msg[FLEN_ERRMSG];\n    int  nullcheck = 2;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvsb is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        fits_read_compressed_img(fptr, TSBYTE, blcll, trcll, inc,\n            nullcheck, NULL, array, flagval, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 2;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        snprintf(msg, FLEN_ERRMSG,\"ffgsvsb: illegal range specified for axis %ld\", ii + 1);\n        ffpmsg(msg);\n        return(*status = BAD_PIX_NUM);\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n    }\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0] - str[0]) / inc[0] + 1;\n      ninc = incr[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1])\n            {\n              felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + \n                             (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] +\n                             (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] +\n                             (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8];\n\n              if ( ffgclsb(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &flagval[i0], &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffggpsb( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            long  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            long  nelem,      /* I - number of values to read                */\n            signed char *array,   /* O - array of values that are returned   */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of group parameters from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n*/\n{\n    long row;\n    int idummy;\n    char cdummy;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclsb(fptr, 1, row, firstelem, nelem, 1, 1, 0,\n               array, &cdummy, &idummy, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcvsb(fitsfile *fptr,  /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           signed char nulval,   /* I - value for null pixels               */\n           signed char *array,   /* O - array of values that are read       */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Any undefined pixels will be set equal to the value of 'nulval' unless\n  nulval = 0 in which case no checks for undefined pixels will be made.\n*/\n{\n    char cdummy;\n\n    ffgclsb(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval,\n           array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcfsb(fitsfile *fptr,  /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           signed char *array,   /* O - array of values that are read       */\n           char *nularray,   /* O - array of flags: 1 if null pixel; else 0 */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Nularray will be set = 1 if the corresponding array pixel is undefined, \n  otherwise nularray will = 0.\n*/\n{\n    signed char dummy = 0;\n\n    ffgclsb(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy,\n           array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgclsb(fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            long  elemincre,  /* I - pixel increment; e.g., 2 = every other  */\n            int   nultyp,     /* I - null value handling code:               */\n                              /*     1: set undefined pixels = nulval        */\n                              /*     2: set nularray=1 for undefined pixels  */\n            signed char nulval,   /* I - value for null pixels if nultyp = 1 */\n            signed char *array,   /* O - array of values that are read       */\n            char *nularray,   /* O - array of flags = 1 if nultyp = 2        */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer be a virtual column in a 1 or more grouped FITS primary\n  array or image extension.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The output array of values will be converted from the datatype of the column \n  and will be scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    double scale, zero, power = 1., dtemp;\n    int tcode, maxelem, hdutype, xcode, decimals;\n    long twidth, incre;\n    long ii, xwidth, ntodo;\n    int nulcheck, readcheck = 0;\n    LONGLONG repeat, startpos, elemnum, readptr, tnull;\n    LONGLONG rowlen, rownum, remain, next, rowincre;\n    char tform[20];\n    char message[FLEN_ERRMSG];\n    char snull[20];   /*  the FITS null value if reading from ASCII table  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    union u_tag {\n       char charval;\n       signed char scharval;\n    } u;\n\n    if (*status > 0 || nelem == 0)  /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    if (anynul)\n        *anynul = 0;\n\n    if (nultyp == 2)      \n       memset(nularray, 0, (size_t) nelem);   /* initialize nullarray */\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (elemincre < 0)\n        readcheck = -1;  /* don't do range checking in this case */\n\n    ffgcprll( fptr, colnum, firstrow, firstelem, nelem, readcheck, &scale, &zero,\n         tform, &twidth, &tcode, &maxelem, &startpos, &elemnum, &incre,\n         &repeat, &rowlen, &hdutype, &tnull, snull, status);\n\n    /* special case: read column of T/F logicals */\n    if (tcode == TLOGICAL && elemincre == 1)\n    {\n        u.scharval = nulval;\n        ffgcll(fptr, colnum, firstrow, firstelem, nelem, nultyp,\n               u.charval, (char *) array, nularray, anynul, status);\n\n        return(*status);\n    }\n\n    if (strchr(tform,'A') != NULL) \n    {\n        if (*status == BAD_ELEM_NUM)\n        {\n            /* ignore this error message */\n            *status = 0;\n            ffcmsg();   /* clear error stack */\n        }\n\n        /*  interpret a 'A' ASCII column as a 'B' byte column ('8A' == '8B') */\n        /*  This is an undocumented 'feature' in CFITSIO */\n\n        /*  we have to reset some of the values returned by ffgcpr */\n        \n        tcode = TBYTE;\n        incre = 1;         /* each element is 1 byte wide */\n        repeat = twidth;   /* total no. of chars in the col */\n        twidth = 1;        /* width of each element */\n        scale = 1.0;       /* no scaling */\n        zero  = 0.0;\n        tnull = NULL_UNDEFINED;  /* don't test for nulls */\n        maxelem = DBUFFSIZE;\n    }\n\n    if (*status > 0)\n        return(*status);\n        \n    incre *= elemincre;   /* multiply incre to just get every nth pixel */\n\n    if (tcode == TSTRING && hdutype == ASCII_TBL) /* setup for ASCII tables */\n    {\n      /* get the number of implied decimal places if no explicit decmal point */\n      ffasfm(tform, &xcode, &xwidth, &decimals, status); \n      for(ii = 0; ii < decimals; ii++)\n        power *= 10.;\n    }\n    /*------------------------------------------------------------------*/\n    /*  Decide whether to check for null values in the input FITS file: */\n    /*------------------------------------------------------------------*/\n    nulcheck = nultyp; /* by default, check for null values in the FITS file */\n\n    if (nultyp == 1 && nulval == 0)\n       nulcheck = 0;    /* calling routine does not want to check for nulls */\n\n    else if (tcode%10 == 1 &&        /* if reading an integer column, and  */ \n            tnull == NULL_UNDEFINED) /* if a null value is not defined,    */\n            nulcheck = 0;            /* then do not check for null values. */\n\n    else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TBYTE && (tnull > 255 || tnull < 0) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED)\n         nulcheck = 0;\n\n    /*---------------------------------------------------------------------*/\n    /*  Now read the pixels from the FITS column. If the column does not   */\n    /*  have the same datatype as the output array, then we have to read   */\n    /*  the raw values into a temporary buffer (of limited size).  In      */\n    /*  the case of a vector colum read only 1 vector of values at a time  */\n    /*  then skip to the next row if more values need to be read.          */\n    /*  After reading the raw values, then call the fffXXYY routine to (1) */\n    /*  test for undefined values, (2) convert the datatype if necessary,  */\n    /*  and (3) scale the values by the FITS TSCALn and TZEROn linear      */\n    /*  scaling parameters.                                                */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to read */\n    next = 0;                 /* next element in array to be read   */\n    rownum = 0;               /* row number, relative to firstrow   */\n\n    while (remain)\n    {\n        /* limit the number of pixels to read at one time to the number that\n           will fit in the buffer or to the number of pixels that remain in\n           the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);\n        if (elemincre >= 0)\n        {\n          ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1));\n        }\n        else\n        {\n          ntodo = (long) minvalue(ntodo, (elemnum/(-elemincre) +1));\n        }\n\n        readptr = startpos + (rownum * rowlen) + (elemnum * (incre / elemincre));\n\n        switch (tcode) \n        {\n            case (TBYTE):\n                ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) &array[next], status);\n                fffi1s1((unsigned char *)&array[next], ntodo, scale, zero,\n                        nulcheck, (unsigned char) tnull, nulval, &nularray[next], \n                        anynul, &array[next], status);\n                break;\n            case (TSHORT):\n                ffgi2b(fptr, readptr, ntodo, incre, (short *) buffer, status);\n                fffi2s1((short  *) buffer, ntodo, scale, zero, nulcheck, \n                       (short) tnull, nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TLONG):\n                ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) buffer,\n                       status);\n                fffi4s1((INT32BIT *) buffer, ntodo, scale, zero, nulcheck, \n                       (INT32BIT) tnull, nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TLONGLONG):\n                ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status);\n                fffi8s1( (LONGLONG *) buffer, ntodo, scale, zero, \n                           nulcheck, tnull, nulval, &nularray[next], \n                            anynul, &array[next], status);\n                break;\n            case (TFLOAT):\n                ffgr4b(fptr, readptr, ntodo, incre, (float  *) buffer, status);\n                fffr4s1((float  *) buffer, ntodo, scale, zero, nulcheck, \n                       nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TDOUBLE):\n                ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status);\n                fffr8s1((double *) buffer, ntodo, scale, zero, nulcheck, \n                          nulval, &nularray[next], anynul, \n                          &array[next], status);\n                break;\n            case (TSTRING):\n                ffmbyt(fptr, readptr, REPORT_EOF, status);\n       \n                if (incre == twidth)    /* contiguous bytes */\n                     ffgbyt(fptr, ntodo * twidth, buffer, status);\n                else\n                     ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                               status);\n\n                /* interpret the string as an ASCII formated number */\n                fffstrs1((char *) buffer, ntodo, scale, zero, twidth, power,\n                      nulcheck, snull, nulval, &nularray[next], anynul,\n                      &array[next], status);\n                break;\n\n            default:  /*  error trap for invalid column format */\n                snprintf(message, FLEN_ERRMSG,\n                   \"Cannot read bytes from column %d which has format %s\",\n                    colnum, tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous read operation */\n        {\n\t  dtemp = (double) next;\n          if (hdutype > 0)\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgclsb).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from image (ffgclsb).\",\n              dtemp+1., dtemp+ntodo);\n\n         ffpmsg(message);\n         return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum = elemnum + (ntodo * elemincre);\n\n            if (elemnum >= repeat)  /* completed a row; start on later row */\n            {\n                rowincre = elemnum / repeat;\n                rownum += rowincre;\n                elemnum = elemnum - (rowincre * repeat);\n            }\n            else if (elemnum < 0)  /* completed a row; start on a previous row */\n            {\n                rowincre = (-elemnum - 1) / repeat + 1;\n                rownum -= rowincre;\n                elemnum = (rowincre * repeat) + elemnum;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while reading FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi1s1(unsigned char *input, /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char tnull,  /* I - value of FITS TNULLn keyword if any */\n            signed char nullval,  /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            signed char *output,  /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == -128.)\n        {\n            /* Instead of subtracting 128, it is more efficient */\n            /* to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++)\n                 output[ii] =  ( *(signed char *) &input[ii] ) ^ 0x80;\n        }\n        else if (scale == 1. && zero == 0.)      /* no scaling */\n        { \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] > 127)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 127;\n                }\n                else\n                    output[ii] = (signed char) input[ii]; /* copy input */\n            }\n        }\n        else             /* must scale the data */\n        {                \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DSCHAR_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = -128;\n                }\n                else if (dvalue > DSCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 127;\n                }\n                else\n                    output[ii] = (signed char) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == -128.)\n        {\n            /* Instead of subtracting 128, it is more efficient */\n            /* to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] =  ( *(signed char *) &input[ii] ) ^ 0x80;\n            }\n        }\n        else if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (signed char) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DSCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = -128;\n                    }\n                    else if (dvalue > DSCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 127;\n                    }\n                    else\n                        output[ii] = (signed char) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi2s1(short *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short tnull,          /* I - value of FITS TNULLn keyword if any */\n            signed char nullval,  /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            signed char *output,  /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < -128)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = -128;\n                }\n                else if (input[ii] > 127)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 127;\n                }\n                else\n                    output[ii] = (signed char) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DSCHAR_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = -128;\n                }\n                else if (dvalue > DSCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 127;\n                }\n                else\n                    output[ii] = (signed char) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n\n                else\n                {\n                    if (input[ii] < -128)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = -128;\n                    }\n                    else if (input[ii] > 127)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 127;\n                    }\n                    else\n                        output[ii] = (signed char) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DSCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = -128;\n                    }\n                    else if (dvalue > DSCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 127;\n                    }\n                    else\n                        output[ii] = (signed char) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi4s1(INT32BIT *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            INT32BIT tnull,       /* I - value of FITS TNULLn keyword if any */\n            signed char nullval,  /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            signed char *output,  /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < -128)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = -128;\n                }\n                else if (input[ii] > 127)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 127;\n                }\n                else\n                    output[ii] = (signed char) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DSCHAR_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = -128;\n                }\n                else if (dvalue > DSCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 127;\n                }\n                else\n                    output[ii] = (signed char) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    if (input[ii] < -128)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = -128;\n                    }\n                    else if (input[ii] > 127)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 127;\n                    }\n                    else\n                        output[ii] = (signed char) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DSCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = -128;\n                    }\n                    else if (dvalue > DSCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 127;\n                    }\n                    else\n                        output[ii] = (signed char) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi8s1(LONGLONG *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            LONGLONG tnull,       /* I - value of FITS TNULLn keyword if any */\n            signed char nullval,  /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            signed char *output,  /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    ULONGLONG ulltemp;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of adding 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                if (ulltemp > 127)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 127;\n                }\n                else\n\t\t{\n                    output[ii] = (short) ulltemp;\n\t\t}\n            }\n        }\n        else if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < -128)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = -128;\n                }\n                else if (input[ii] > 127)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 127;\n                }\n                else\n                    output[ii] = (signed char) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DSCHAR_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = -128;\n                }\n                else if (dvalue > DSCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 127;\n                }\n                else\n                    output[ii] = (signed char) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of subtracting 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n\t\t{\n                    ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                    if (ulltemp > 127)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 127;\n                    }\n                    else\n\t\t    {\n                        output[ii] = (short) ulltemp;\n\t\t    }\n                }\n            }\n        }\n        else if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    if (input[ii] < -128)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = -128;\n                    }\n                    else if (input[ii] > 127)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 127;\n                    }\n                    else\n                        output[ii] = (signed char) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DSCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = -128;\n                    }\n                    else if (dvalue > DSCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 127;\n                    }\n                    else\n                        output[ii] = (signed char) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr4s1(float *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            signed char nullval,  /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            signed char *output,  /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DSCHAR_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = -128;\n                }\n                else if (input[ii] > DSCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 127;\n                }\n                else\n                    output[ii] = (signed char) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DSCHAR_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = -128;\n                }\n                else if (dvalue > DSCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 127;\n                }\n                else\n                    output[ii] = (signed char) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr++;       /* point to MSBs */\n#endif\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              /* use redundant boolean logic in following statement */\n              /* to suppress irritating Borland compiler warning message */\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DSCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = -128;\n                    }\n                    else if (input[ii] > DSCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 127;\n                    }\n                    else\n                        output[ii] = (signed char) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  {\n                    if (zero < DSCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = -128;\n                    }\n                    else if (zero > DSCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 127;\n                    }\n                    else\n                        output[ii] = (signed char) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DSCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = -128;\n                    }\n                    else if (dvalue > DSCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 127;\n                    }\n                    else\n                        output[ii] = (signed char) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr8s1(double *input,        /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            signed char nullval,  /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            signed char *output,  /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DSCHAR_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = -128;\n                }\n                else if (input[ii] > DSCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 127;\n                }\n                else\n                    output[ii] = (signed char) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DSCHAR_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = -128;\n                }\n                else if (dvalue > DSCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 127;\n                }\n                else\n                    output[ii] = (signed char) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr += 3;       /* point to MSBs */\n#endif\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DSCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = -128;\n                    }\n                    else if (input[ii] > DSCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 127;\n                    }\n                    else\n                        output[ii] = (signed char) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  {\n                    if (zero < DSCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = -128;\n                    }\n                    else if (zero > DSCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 127;\n                    }\n                    else\n                        output[ii] = (signed char) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DSCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = -128;\n                    }\n                    else if (dvalue > DSCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 127;\n                    }\n                    else\n                        output[ii] = (signed char) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffstrs1(char *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            long twidth,          /* I - width of each substring of chars    */\n            double implipower,    /* I - power of 10 of implied decimal      */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            char  *snull,         /* I - value of FITS null string, if any   */\n            signed char nullval,  /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            signed char *output,  /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file. Check\n  for null values and do scaling if required. The nullcheck code value\n  determines how any null values in the input array are treated. A null\n  value is an input pixel that is equal to snull.  If nullcheck= 0, then\n  no special checking for nulls is performed.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    int  nullen;\n    long ii;\n    double dvalue;\n    char *cstring, message[FLEN_ERRMSG];\n    char *cptr, *tpos;\n    char tempstore, chrzero = '0';\n    double val, power;\n    int exponent, sign, esign, decpt;\n\n    nullen = strlen(snull);\n    cptr = input;  /* pointer to start of input string */\n    for (ii = 0; ii < ntodo; ii++)\n    {\n      cstring = cptr;\n      /* temporarily insert a null terminator at end of the string */\n      tpos = cptr + twidth;\n      tempstore = *tpos;\n      *tpos = 0;\n\n      /* check if null value is defined, and if the    */\n      /* column string is identical to the null string */\n      if (snull[0] != ASCII_NULL_UNDEFINED && \n         !strncmp(snull, cptr, nullen) )\n      {\n        if (nullcheck)  \n        {\n          *anynull = 1;    \n          if (nullcheck == 1)\n            output[ii] = nullval;\n          else\n            nullarray[ii] = 1;\n        }\n        cptr += twidth;\n      }\n      else\n      {\n        /* value is not the null value, so decode it */\n        /* remove any embedded blank characters from the string */\n\n        decpt = 0;\n        sign = 1;\n        val  = 0.;\n        power = 1.;\n        exponent = 0;\n        esign = 1;\n\n        while (*cptr == ' ')               /* skip leading blanks */\n           cptr++;\n\n        if (*cptr == '-' || *cptr == '+')  /* check for leading sign */\n        {\n          if (*cptr == '-')\n             sign = -1;\n\n          cptr++;\n\n          while (*cptr == ' ')         /* skip blanks between sign and value */\n            cptr++;\n        }\n\n        while (*cptr >= '0' && *cptr <= '9')\n        {\n          val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n          cptr++;\n\n          while (*cptr == ' ')         /* skip embedded blanks in the value */\n            cptr++;\n        }\n\n        if (*cptr == '.' || *cptr == ',')       /* check for decimal point */\n        {\n          decpt = 1;\n          cptr++;\n          while (*cptr == ' ')         /* skip any blanks */\n            cptr++;\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n            power = power * 10.;\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks in the value */\n              cptr++;\n          }\n        }\n\n        if (*cptr == 'E' || *cptr == 'D')  /* check for exponent */\n        {\n          cptr++;\n          while (*cptr == ' ')         /* skip blanks */\n              cptr++;\n  \n          if (*cptr == '-' || *cptr == '+')  /* check for exponent sign */\n          {\n            if (*cptr == '-')\n               esign = -1;\n\n            cptr++;\n\n            while (*cptr == ' ')        /* skip blanks between sign and exp */\n              cptr++;\n          }\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            exponent = exponent * 10 + *cptr - chrzero;  /* accumulate exp */\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks */\n              cptr++;\n          }\n        }\n\n        if (*cptr  != 0)  /* should end up at the null terminator */\n        {\n          snprintf(message, FLEN_ERRMSG,\"Cannot read number from ASCII table\");\n          ffpmsg(message);\n          snprintf(message, FLEN_ERRMSG,\"Column field = %s.\", cstring);\n          ffpmsg(message);\n          /* restore the char that was overwritten by the null */\n          *tpos = tempstore;\n          return(*status = BAD_C2D);\n        }\n\n        if (!decpt)  /* if no explicit decimal, use implied */\n           power = implipower;\n\n        dvalue = (sign * val / power) * pow(10., (double) (esign * exponent));\n\n        dvalue = dvalue * scale + zero;   /* apply the scaling */\n\n        if (dvalue < DSCHAR_MIN)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = -128;\n        }\n        else if (dvalue > DSCHAR_MAX)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = 127;\n        }\n        else\n            output[ii] = (signed char) dvalue;\n      }\n      /* restore the char that was overwritten by the null */\n      *tpos = tempstore;\n    }\n    return(*status);\n}\n"},{"col":4,"comment":"null","endLoc":833,"header":"def _compute_ticks(self, tick_world_coordinates, spine, axis, w1, w2,\n                       tick_angle, ticks='major')","id":16685,"name":"_compute_ticks","nodeType":"Function","startLoc":751,"text":"def _compute_ticks(self, tick_world_coordinates, spine, axis, w1, w2,\n                       tick_angle, ticks='major'):\n\n        if self.coord_type == 'longitude':\n            tick_world_coordinates_values = tick_world_coordinates.to_value(u.deg)\n            tick_world_coordinates_values = np.hstack([tick_world_coordinates_values,\n                                                       tick_world_coordinates_values + 360])\n            tick_world_coordinates_values *= u.deg.to(self.coord_unit)\n        else:\n            tick_world_coordinates_values = tick_world_coordinates.to_value(self.coord_unit)\n\n        for t in tick_world_coordinates_values:\n\n            # Find steps where a tick is present. We have to check\n            # separately for the case where the tick falls exactly on the\n            # frame points, otherwise we'll get two matches, one for w1 and\n            # one for w2.\n            with np.errstate(invalid='ignore'):\n                intersections = np.hstack([np.nonzero((t - w1) == 0)[0],\n                                           np.nonzero(((t - w1) * (t - w2)) < 0)[0]])\n\n            # But we also need to check for intersection with the last w2\n            if t - w2[-1] == 0:\n                intersections = np.append(intersections, len(w2) - 1)\n\n            # Loop over ticks, and find exact pixel coordinates by linear\n            # interpolation\n            for imin in intersections:\n\n                imax = imin + 1\n\n                if np.allclose(w1[imin], w2[imin], rtol=1.e-13, atol=1.e-13):\n                    continue  # tick is exactly aligned with frame\n                else:\n                    frac = (t - w1[imin]) / (w2[imin] - w1[imin])\n                    x_data_i = spine.data[imin, 0] + frac * (spine.data[imax, 0] - spine.data[imin, 0])\n                    y_data_i = spine.data[imin, 1] + frac * (spine.data[imax, 1] - spine.data[imin, 1])\n                    x_pix_i = spine.pixel[imin, 0] + frac * (spine.pixel[imax, 0] - spine.pixel[imin, 0])\n                    y_pix_i = spine.pixel[imin, 1] + frac * (spine.pixel[imax, 1] - spine.pixel[imin, 1])\n                    delta_angle = tick_angle[imax] - tick_angle[imin]\n                    if delta_angle > 180.:\n                        delta_angle -= 360.\n                    elif delta_angle < -180.:\n                        delta_angle += 360.\n                    angle_i = tick_angle[imin] + frac * delta_angle\n\n                if self.coord_type == 'longitude':\n\n                    if self._coord_scale_to_deg is not None:\n                        t *= self._coord_scale_to_deg\n\n                    world = wrap_angle_at(t, self.coord_wrap)\n\n                    if self._coord_scale_to_deg is not None:\n                        world /= self._coord_scale_to_deg\n\n                else:\n                    world = t\n\n                if ticks == 'major':\n\n                    self.ticks.add(axis=axis,\n                                   pixel=(x_data_i, y_data_i),\n                                   world=world,\n                                   angle=angle_i,\n                                   axis_displacement=imin + frac)\n\n                    # store information to pass to ticklabels.add\n                    # it's faster to format many ticklabels at once outside\n                    # of the loop\n                    self.lblinfo.append(dict(axis=axis,\n                                             pixel=(x_pix_i, y_pix_i),\n                                             world=world,\n                                             angle=spine.normal_angle[imin],\n                                             axis_displacement=imin + frac))\n                    self.lbl_world.append(world)\n\n                else:\n                    self.ticks.add_minor(minor_axis=axis,\n                                         minor_pixel=(x_data_i, y_data_i),\n                                         minor_world=world,\n                                         minor_angle=angle_i,\n                                         minor_axis_displacement=imin + frac)"},{"id":16686,"name":"putcolui.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, putcolui.c, contains routines that write data elements to    */\n/*  a FITS image or table, with unsigned short datatype.                            */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <limits.h>\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffpprui(fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write (1 = 1st group)          */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n   unsigned short *array,    /* I - array of values that are written        */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n    unsigned short nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_pixels(fptr, TUSHORT, firstelem, nelem,\n            0, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpclui(fptr, 2, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffppnui(fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n   unsigned short *array,    /* I - array of values that are written        */\n   unsigned short nulval,    /* I - undefined pixel value                   */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).  Any array values\n  that are equal to the value of nulval will be replaced with the null\n  pixel value that is appropriate for this column.\n*/\n{\n    long row;\n    unsigned short nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        nullvalue = nulval;  /* set local variable */\n        fits_write_compressed_pixels(fptr, TUSHORT, firstelem, nelem,\n            1, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcnui(fptr, 2, row, firstelem, nelem, array, nulval, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp2dui(fitsfile *fptr,   /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n  unsigned short *array,     /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    /* call the 3D writing routine, with the 3rd dimension = 1 */\n\n    ffp3dui(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp3dui(fitsfile *fptr,   /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  nrows,      /* I - number of rows in each plane of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           LONGLONG  naxis3,     /* I - FITS image NAXIS3 value               */\n  unsigned short *array,     /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 3-D cube of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    long tablerow, ii, jj;\n    long fpixel[3]= {1,1,1}, lpixel[3];\n    LONGLONG nfits, narray;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n           \n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n        lpixel[0] = (long) ncols;\n        lpixel[1] = (long) nrows;\n        lpixel[2] = (long) naxis3;\n       \n        fits_write_compressed_img(fptr, TUSHORT, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n      /* all the image pixels are contiguous, so write all at once */\n      ffpclui(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status);\n      return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to write to */\n    narray = 0;  /* next pixel in input array to be written */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* writing naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffpclui(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0)\n         return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpssui(fitsfile *fptr,   /* I - FITS file pointer                       */\n           long  group,      /* I - group to write(1 = 1st group)           */\n           long  naxis,      /* I - number of data axes in array            */\n           long  *naxes,     /* I - size of each FITS axis                  */\n           long  *fpixel,    /* I - 1st pixel in each axis to write (1=1st) */\n           long  *lpixel,    /* I - last pixel in each axis to write        */\n  unsigned short *array,     /* I - array to be written                     */\n           int  *status)     /* IO - error status                           */\n/*\n  Write a subsection of pixels to the primary array or image.\n  A subsection is defined to be any contiguous rectangular\n  array of pixels within the n-dimensional FITS data file.\n  Data conversion and scaling will be performed if necessary \n  (e.g, if the datatype of the FITS array is not the same as\n  the array being written).\n*/\n{\n    long tablerow;\n    LONGLONG fpix[7], dimen[7], astart, pstart;\n    LONGLONG off2, off3, off4, off5, off6, off7;\n    LONGLONG st10, st20, st30, st40, st50, st60, st70;\n    LONGLONG st1, st2, st3, st4, st5, st6, st7;\n    long ii, i1, i2, i3, i4, i5, i6, i7, irange[7];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_img(fptr, TUSHORT, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    if (naxis < 1 || naxis > 7)\n      return(*status = BAD_DIMEN);\n\n    tablerow=maxvalue(1,group);\n\n     /* calculate the size and number of loops to perform in each dimension */\n    for (ii = 0; ii < 7; ii++)\n    {\n      fpix[ii]=1;\n      irange[ii]=1;\n      dimen[ii]=1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {    \n      fpix[ii]=fpixel[ii];\n      irange[ii]=lpixel[ii]-fpixel[ii]+1;\n      dimen[ii]=naxes[ii];\n    }\n\n    i1=irange[0];\n\n    /* compute the pixel offset between each dimension */\n    off2 =     dimen[0];\n    off3 = off2 * dimen[1];\n    off4 = off3 * dimen[2];\n    off5 = off4 * dimen[3];\n    off6 = off5 * dimen[4];\n    off7 = off6 * dimen[5];\n\n    st10 = fpix[0];\n    st20 = (fpix[1] - 1) * off2;\n    st30 = (fpix[2] - 1) * off3;\n    st40 = (fpix[3] - 1) * off4;\n    st50 = (fpix[4] - 1) * off5;\n    st60 = (fpix[5] - 1) * off6;\n    st70 = (fpix[6] - 1) * off7;\n\n    /* store the initial offset in each dimension */\n    st1 = st10;\n    st2 = st20;\n    st3 = st30;\n    st4 = st40;\n    st5 = st50;\n    st6 = st60;\n    st7 = st70;\n\n    astart = 0;\n\n    for (i7 = 0; i7 < irange[6]; i7++)\n    {\n     for (i6 = 0; i6 < irange[5]; i6++)\n     {\n      for (i5 = 0; i5 < irange[4]; i5++)\n      {\n       for (i4 = 0; i4 < irange[3]; i4++)\n       {\n        for (i3 = 0; i3 < irange[2]; i3++)\n        {\n         pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7;\n\n         for (i2 = 0; i2 < irange[1]; i2++)\n         {\n           if (ffpclui(fptr, 2, tablerow, pstart, i1, &array[astart],\n              status) > 0)\n              return(*status);\n\n           astart += i1;\n           pstart += off2;\n         }\n         st2 = st20;\n         st3 = st3+off3;    \n        }\n        st3 = st30;\n        st4 = st4+off4;\n       }\n       st4 = st40;\n       st5 = st5+off5;\n      }\n      st5 = st50;\n      st6 = st6+off6;\n     }\n     st6 = st60;\n     st7 = st7+off7;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpgpui( fitsfile *fptr,   /* I - FITS file pointer                      */\n            long  group,      /* I - group to write(1 = 1st group)          */\n            long  firstelem,  /* I - first vector element to write(1 = 1st) */\n            long  nelem,      /* I - number of values to write              */\n   unsigned short *array,     /* I - array of values that are written       */\n            int  *status)     /* IO - error status                          */\n/*\n  Write an array of group parameters to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffpclui(fptr, 1L, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpclui( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n   unsigned short *array,    /* I - array of values to write                */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer to a virtual column in a 1 or more grouped FITS primary\n  array.  FITSIO treats a primary array as a binary table with\n  2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    int tcode, maxelem, hdutype;\n    long twidth, incre;\n    long ntodo;\n    LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull;\n    double scale, zero;\n    char tform[20], cform[20];\n    char message[FLEN_ERRMSG];\n\n    char snull[20];   /*  the FITS null value  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n\n    if (tcode == TSTRING)   \n         ffcfmt(tform, cform);     /* derive C format for writing strings */\n\n    /*---------------------------------------------------------------------*/\n    /*  Now write the pixels to the FITS column.                           */\n    /*  First call the ffXXfYY routine to  (1) convert the datatype        */\n    /*  if necessary, and (2) scale the values by the FITS TSCALn and      */\n    /*  TZEROn linear scaling parameters into a temporary buffer.          */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to write  */\n    next = 0;                 /* next element in array to be written  */\n    rownum = 0;               /* row number, relative to firstrow     */\n\n    while (remain)\n    {\n        /* limit the number of pixels to process a one time to the number that\n           will fit in the buffer space or to the number of pixels that remain\n           in the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);      \n        ntodo = (long) minvalue(ntodo, (repeat - elemnum));\n\n        wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre);\n\n        ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */\n\n        switch (tcode) \n        {\n            case (TSHORT):\n\n              ffu2fi2(&array[next], ntodo, scale, zero,\n                      (short *) buffer, status);\n              ffpi2b(fptr, ntodo, incre, (short *) buffer, status);\n              break;\n\n            case (TLONGLONG):\n\n                ffu2fi8(&array[next], ntodo, scale, zero,\n                        (LONGLONG *) buffer, status);\n                ffpi8b(fptr, ntodo, incre, (long *) buffer, status);\n                break;\n\n            case (TBYTE):\n \n                ffu2fi1(&array[next], ntodo, scale, zero,\n                        (unsigned char *) buffer, status);\n                ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status);\n                break;\n\n            case (TLONG):\n\n                ffu2fi4(&array[next], ntodo, scale, zero,\n                        (INT32BIT *) buffer, status);\n                ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status);\n                break;\n\n            case (TFLOAT):\n\n                ffu2fr4(&array[next], ntodo, scale, zero,\n                        (float *) buffer, status);\n                ffpr4b(fptr, ntodo, incre, (float *) buffer, status);\n                break;\n\n            case (TDOUBLE):\n                ffu2fr8(&array[next], ntodo, scale, zero,\n                        (double *) buffer, status);\n                ffpr8b(fptr, ntodo, incre, (double *) buffer, status);\n                break;\n\n            case (TSTRING):  /* numerical column in an ASCII table */\n\n                if (cform[1] != 's')  /*  \"%s\" format is a string */\n                {\n                  ffu2fstr(&array[next], ntodo, scale, zero, cform,\n                          twidth, (char *) buffer, status);\n\n\n                  if (incre == twidth)    /* contiguous bytes */\n                     ffpbyt(fptr, ntodo * twidth, buffer, status);\n                  else\n                     ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                            status);\n\n                  break;\n                }\n                /* can't write to string column, so fall thru to default: */\n\n            default:  /*  error trap  */\n                snprintf(message,FLEN_ERRMSG, \n                    \"Cannot write numbers to column %d which has format %s\",\n                      colnum,tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous write operation */\n        {\n         snprintf(message,FLEN_ERRMSG,\n          \"Error writing elements %.0f thru %.0f of input data array (ffpclui).\",\n             (double) (next+1), (double) (next+ntodo));\n         ffpmsg(message);\n         return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum += ntodo;\n            if (elemnum == repeat)  /* completed a row; start on next row */\n            {\n                elemnum = 0;\n                rownum++;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n       ffpmsg(\n       \"Numerical overflow during type conversion while writing FITS data.\");\n       *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcnui(fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n   unsigned short *array,    /* I - array of values to write                */\n   unsigned short  nulvalue, /* I - value used to flag undefined pixels     */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of elements to the specified column of a table.  Any input\n  pixels equal to the value of nulvalue will be replaced by the appropriate\n  null value in the output FITS file. \n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary\n*/\n{\n    tcolumn *colptr;\n    LONGLONG  ngood = 0, nbad = 0, ii;\n    LONGLONG repeat, first, fstelm, fstrow;\n    int tcode, overflow = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n    }\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n\n    tcode  = colptr->tdatatype;\n\n    if (tcode > 0)\n       repeat = colptr->trepeat;  /* repeat count for this column */\n    else\n       repeat = firstelem -1 + nelem;  /* variable length arrays */\n\n    /* if variable length array, first write the whole input vector, \n       then go back and fill in the nulls */\n    if (tcode < 0) {\n      if (ffpclui(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) {\n        if (*status == NUM_OVERFLOW) \n\t{\n\t  /* ignore overflows, which are possibly the null pixel values */\n\t  /*  overflow = 1;   */\n\t  *status = 0;\n\t} else { \n          return(*status);\n\t}\n      }\n    }\n\n    /* absolute element number in the column */\n    first = (firstrow - 1) * repeat + firstelem;\n\n    for (ii = 0; ii < nelem; ii++)\n    {\n      if (array[ii] != nulvalue)  /* is this a good pixel? */\n      {\n         if (nbad)  /* write previous string of bad pixels */\n         {\n            fstelm = ii - nbad + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0)\n                return(*status);\n\n            nbad=0;\n         }\n\n         ngood = ngood +1;  /* the consecutive number of good pixels */\n      }\n      else\n      {\n         if (ngood)  /* write previous string of good pixels */\n         {\n            fstelm = ii - ngood + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (tcode > 0) {  /* variable length arrays have already been written */\n              if (ffpclui(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood],\n                status) > 0) {\n\t\tif (*status == NUM_OVERFLOW) \n\t\t{\n\t\t  overflow = 1;\n\t\t  *status = 0;\n\t\t} else { \n                  return(*status);\n\t\t}\n\t      }\n\t    }\n            ngood=0;\n         }\n\n         nbad = nbad +1;  /* the consecutive number of bad pixels */\n      }\n    }\n\n    /* finished loop;  now just write the last set of pixels */\n\n    if (ngood)  /* write last string of good pixels */\n    {\n      fstelm = ii - ngood + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      if (tcode > 0) {  /* variable length arrays have already been written */\n        ffpclui(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status);\n      }\n    }\n    else if (nbad) /* write last string of bad pixels */\n    {\n      fstelm = ii - nbad + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      ffpclu(fptr, colnum, fstrow, fstelm, nbad, status);\n    }\n\n    if (*status <= 0) {\n      if (overflow) {\n        *status = NUM_OVERFLOW;\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu2fi1(unsigned short *input, /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            unsigned char *output, /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] > UCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = ((double) input[ii] - zero) / scale;\n\n            if (dvalue < DUCHAR_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (dvalue > DUCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) (dvalue + .5);\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu2fi2(unsigned short *input, /* I - array of values to be converted */\n            long ntodo,         /* I - number of elements in the array  */\n            double scale,       /* I - FITS TSCALn or BSCALE value      */\n            double zero,        /* I - FITS TZEROn or BZERO  value      */\n            short *output,      /* O - output array of converted values */\n            int *status)        /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 32768.)\n    {\n        /* Instead of subtracting 32768, it is more efficient */\n        /* to just flip the sign bit with the XOR operator */\n\n        for (ii = 0; ii < ntodo; ii++)\n             output[ii] =  ( *(short *) &input[ii] ) ^ 0x8000;\n    }\n    else if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] > SHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n                output[ii] = input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = ((double) input[ii] - zero) / scale;\n\n            if (dvalue < DSHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MIN;\n            }\n            else if (dvalue > DSHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (short) (dvalue + .5);\n                else\n                    output[ii] = (short) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu2fi4(unsigned short *input, /* I - array of values to be converted */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            INT32BIT *output,      /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (INT32BIT) input[ii];   /* copy input to output */\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = ((double) input[ii] - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (INT32BIT) (dvalue + .5);\n                else\n                    output[ii] = (INT32BIT) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu2fi8(unsigned short *input,  /* I - array of values to be converted  */\n            long ntodo,             /* I - number of elements in the array  */\n            double scale,           /* I - FITS TSCALn or BSCALE value      */\n            double zero,            /* I - FITS TZEROn or BZERO  value      */\n            LONGLONG *output,       /* O - output array of converted values */\n            int *status)            /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero ==  9223372036854775808.)\n    {       \n        /* Writing to unsigned long long column. */\n        /* Instead of subtracting 9223372036854775808, it is more efficient */\n        /* and more precise to just flip the sign bit with the XOR operator */\n\n        /* no need to check range limits because all unsigned short values */\n\t/* are valid ULONGLONG values. */\n\n        for (ii = 0; ii < ntodo; ii++) {\n             output[ii] =  ((LONGLONG) input[ii]) ^ 0x8000000000000000;\n        }\n    }\n    else if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DLONGLONG_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MIN;\n            }\n            else if (dvalue > DLONGLONG_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (LONGLONG) (dvalue + .5);\n                else\n                    output[ii] = (LONGLONG) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu2fr4(unsigned short *input, /* I - array of values to be converted */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            float *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (float) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (float) (((double) input[ii] - zero) / scale);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu2fr8(unsigned short *input, /* I - array of values to be converted */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            double *output,    /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (double) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = ((double) input[ii] - zero) / scale;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu2fstr(unsigned short *input, /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            char *cform,       /* I - format for output string values  */\n            long twidth,       /* I - width of each field, in chars    */\n            char *output,      /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n    char *cptr;\n    \n    cptr = output;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n           sprintf(output, cform, (double) input[ii]);\n           output += twidth;\n\n           if (*output)  /* if this char != \\0, then overflow occurred */\n              *status = OVERFLOW_ERR;\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n          dvalue = ((double) input[ii] - zero) / scale;\n          sprintf(output, cform, dvalue);\n          output += twidth;\n\n          if (*output)  /* if this char != \\0, then overflow occurred */\n            *status = OVERFLOW_ERR;\n        }\n    }\n\n    /* replace any commas with periods (e.g., in French locale) */\n    while ((cptr = strchr(cptr, ','))) *cptr = '.';\n    \n    return(*status);\n}\n"},{"id":16687,"name":"drvrnet.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, drvrhttp.c contains driver routines for http, ftp and root \n    files. */\n\n/* This file was written by Bruce O'Neel at the ISDC, Switzerland          */\n/*  The FITSIO software is maintained by William Pence at the High Energy  */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n\n/* Notes on the drivers:\n\n   The ftp driver uses passive mode exclusivly.  If your remote system can't \n   deal with passive mode then it'll fail.  Since Netscape Navigator uses \n   passive mode as well there shouldn't be too many ftp servers which have\n   problems.\n\n\n   The http driver works properly with 301 and 302 redirects.  For many more \n   gory details see http://www.w3c.org/Protocols/rfc2068/rfc2068.  The only\n   catch to the 301/302 redirects is that they have to redirect to another \n   http:// url.  If not, things would have to change a lot in cfitsio and this\n   was thought to be too difficult.\n   \n   Redirects look like\n\n\n   <HTML><HEAD>\n   <TITLE>301 Moved Permanently</TITLE>\n   </HEAD><BODY>\n   <H1>Moved Permanently</H1>\n   The document has moved <A HREF=\"http://heasarc.gsfc.nasa.gov/FTP/software/ftools/release/other/image.fits.gz\">here</A>.<P>\n   </BODY></HTML>\n\n   This redirect was from apache 1.2.5 but most of the other servers produce \n   something very similiar.  The parser for the redirects finds the first \n   anchor <A> tag in the body and goes there.  If that wasn't what was intended\n   by the remote system then hopefully the error stack, which includes notes \n   about the redirect will help the user fix the problem.\n\n  ****************************************************************\n   Note added in 2017:  \n   The redirect format shown above is actually preceded by 2 lines that look like\n  \n   HTTP/1.1 302 Found\n   LOCATION: http://heasarc.gsfc.nasa.gov/FTP/software/ftools/release/other/image.fits.gz\n\n   The CFITSIO parser now looks for the \"Location:\" string, not the html tag.\n  ****************************************************************\n\n\n   Root protocal doesn't have any real docs, so, the emperical docs are as \n   follows.  \n\n   First, you must use a slightly modified rootd server.  The modifications \n   include implimentation of the stat command which returns the size of the \n   remote file.  Without that it's impossible for cfitsio to work properly\n   since fitsfiles don't include any information about the size of the files \n   in the headers.  The rootd server closes the connections on any errors, \n   including reading beyond the end of the file or seeking beyond the end \n   of the file.  The rootd:// driver doesn't reopen a closed connection, if\n   the connection is closed you're pretty much done.\n\n   The messages are of the form\n\n   <len><opcode><optional information>\n\n   All binary information is transfered in network format, so use htonl and \n   ntohl to convert back and forth.\n\n   <len> :== 4 byte length, in network format, the len doesn't include the\n         length of <len>\n   <opcode> :== one of the message opcodes below, 4 bytes, network format\n   <optional info> :== depends on opcode\n\n   The response is of the same form with the same opcode sent.  Success is\n   indicated by <optional info> being 0.\n\n   Root is a NFSish protocol where each read/write includes the byte\n   offset to read or write to.  As a result, seeks will always succeed\n   in the driver even if they would cause a fatal error when you try\n   to read because you're beyond the end of the file.\n\n   There is file locking on the host such that you need to possibly\n   create /usr/tmp/rootdtab on the host system.  There is one file per\n   socket connection, though the rootd daemon can support multiple\n   files open at once.\n\n   The messages are sent in the following order:\n\n   ROOTD_USER - user name, <optional info> is the user name, trailing\n   null is sent though it's not required it seems.  A ROOTD_AUTH\n   message is returned with any sort of error meaning that the user\n   name is wrong.\n\n   ROOTD_PASS - password, ones complemented, stored in <optional info>. Once\n   again the trailing null is sent.  Once again a ROOTD_AUTH message is \n   returned\n\n   ROOTD_OPEN - <optional info> includes filename and one of\n     {create|update|read} as the file mode.  ~ seems to be dealt with\n     as the username's login directory.  A ROOTD_OPEN message is\n     returned.\n\n   Once the file is opened any of the following can be sent:\n\n   ROOTD_STAT - file status and size\n   returns a message where <optional info> is the file length in bytes\n\n   ROOTD_FLUSH - flushes the file, not sure this has any real effect\n   on the daemon since the daemon uses open/read/write/close rather\n   than the buffered fopen/fread/fwrite/fclose.\n\n   ROOTD_GET - on send <optional info> includes a text message of\n   offset and length to get.  Return is a status message first with a\n   status value, then, the raw bytes for the length that you\n   requested.  It's an error to seek or read past the end of the file,\n   and, the rootd daemon exits and won't respond anymore.  Ie, don't\n   do this.\n\n   ROOTD_PUT - on send <optional info> includes a text message of\n   offset and length to put.  Then send the raw bytes you want to\n   write.  Then recieve a status message\n\n\n   When you are finished then you send the message:\n\n   ROOTD_CLOSE - closes the file\n\n   Once the file is closed then the socket is closed.\n\n\nRevision 1.56  2000/01/04 11:58:31  oneel\nUpdates so that compressed network files are dealt with regardless of\ntheir file names and/or mime types.\n\nRevision 1.55  2000/01/04 10:52:40  oneel\ncfitsio 2.034\n\nRevision 1.51  1999/08/10 12:13:40  oneel\nMake the http code a bit less picky about the types of files it\nuncompresses.  Now it also uncompresses files which end in .Z or .gz.\n\nRevision 1.50  1999/08/04 12:38:46  oneel\nDon's 2.0.32 patch with dal 1.3\n\nRevision 1.39  1998/12/02 15:31:33  oneel\nUpdates to drvrnet.c so that less compiler warnings would be\ngenerated.  Fixes the signal handling.\n\nRevision 1.38  1998/11/23 10:03:24  oneel\nAdded in a useragent string, as suggested by:\nTim Kimball   Data Systems Division   kimball@stsci.edu   410-338-4417\nSpace Telescope Science Institute     http://www.stsci.edu/~kimball/\n3700 San Martin Drive                 http://archive.stsci.edu/\nBaltimore MD 21218 USA                http://faxafloi.stsci.edu:4547/\n\n   \n */\n\n#ifdef HAVE_NET_SERVICES\n#include <string.h>\n\n#include <sys/types.h>\n#include <netinet/in.h>\n#include <netinet/tcp.h>\n#include <sys/socket.h>\n#include <arpa/inet.h>\n#include <netdb.h>\n#include <errno.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n\n#ifdef CFITSIO_HAVE_CURL\n#include <curl/curl.h>\n#endif\n\n#if defined(unix) || defined(__unix__)  || defined(__unix) || defined(HAVE_UNISTD_H)\n#include <unistd.h>  \n#endif\n\n#include <signal.h>\n#include <setjmp.h>\n#include \"fitsio2.h\"\n\nstatic jmp_buf env; /* holds the jump buffer for setjmp/longjmp pairs */\nstatic void signal_handler(int sig);\n\n/* Network routine error codes */\n#define NET_OK 0\n#define NOT_INET_ADDRESS -1000\n#define UNKNOWN_INET_HOST -1001\n#define CONNECTION_ERROR -1002\n\n/* Network routine constants */\n#define NET_DEFAULT 0\n#define NET_OOB 1\n#define NET_PEEK 2\n\n/* local defines and variables */\n#define MAXLEN 1200\n#define SHORTLEN 100\nstatic char netoutfile[MAXLEN];\n\n\n#define ROOTD_USER  2000       /*user id follows */\n#define ROOTD_PASS  2001       /*passwd follows */\n#define ROOTD_AUTH  2002       /*authorization status (to client) */\n#define ROOTD_FSTAT 2003       /*filename follows */\n#define ROOTD_OPEN  2004       /*filename follows + mode */\n#define ROOTD_PUT   2005       /*offset, number of bytes and buffer */\n#define ROOTD_GET   2006       /*offset, number of bytes */\n#define ROOTD_FLUSH 2007       /*flush file */\n#define ROOTD_CLOSE 2008       /*close file */\n#define ROOTD_STAT  2009       /*return rootd statistics */\n#define ROOTD_ACK   2010       /*acknowledgement (all OK) */\n#define ROOTD_ERR   2011       /*error code and message follow */\n\ntypedef struct    /* structure containing disk file structure */ \n{\n  int sock;\n  LONGLONG currentpos;\n} rootdriver;\n\ntypedef struct  /* simple mem struct for receiving files from curl */\n{\n   char *memory;\n   size_t size;\n} curlmembuf;\n\nstatic rootdriver handleTable[NMAXFILES];  /* allocate diskfile handle tables */\n\n/* static prototypes */\n\nstatic int NET_TcpConnect(char *hostname, int port);\nstatic int NET_SendRaw(int sock, const void *buf, int length, int opt);\nstatic int NET_RecvRaw(int sock, void *buffer, int length);\nstatic int NET_ParseUrl(const char *url, char *proto, char *host, int *port, \n\t\t char *fn);\nstatic int CreateSocketAddress(struct sockaddr_in *sockaddrPtr,\n\t\t\t       char *host,int port);\nstatic int ftp_status(FILE *ftp, char *statusstr);\nstatic int http_open_network(char *url, FILE **httpfile, char *contentencoding,\n\t\t\t  int *contentlength);\nstatic int https_open_network(char *filename, curlmembuf* buffer);\nstatic int ftp_open_network(char *url, FILE **ftpfile, FILE **command, \n\t\t\t    int *sock);\nstatic int ftps_open_network(char *filename, curlmembuf* buffer);\nstatic int ftp_file_exist(char *url);\nstatic int root_send_buffer(int sock, int op, char *buffer, int buflen);\nstatic int root_recv_buffer(int sock, int *op, char *buffer,int buflen);\nstatic int root_openfile(char *filename, char *rwmode, int *sock);\nstatic int encode64(unsigned s_len, char *src, unsigned d_len, char *dst);\nstatic int ssl_get_with_curl(char *url, curlmembuf* buffer, \n                char* username, char* password);\nstatic size_t curlToMemCallback(void *buffer, size_t size, size_t nmemb, void *userp);\nstatic int curlProgressCallback(void *clientp, double dltotal, double dlnow,\n                           double ultotal, double ulnow);\n\n/***************************/\n/* Static variables */\n\nstatic int closehttpfile;\nstatic int closememfile;\nstatic int closefdiskfile;\nstatic int closediskfile;\nstatic int closefile;\nstatic int closeoutfile;\nstatic int closecommandfile;\nstatic int closeftpfile;\nstatic FILE *diskfile;\nstatic FILE *outfile;\n\nstatic int curl_verbose=0;\nstatic int show_fits_download_progress=0;\nstatic unsigned int net_timeout = 360; /* in seconds */\n\n/*--------------------------------------------------------------------------*/\n/* This creates a memory file handle with a copy of the URL in filename. The \n   file is uncompressed if necessary */\n\nint http_open(char *filename, int rwmode, int *handle)\n{\n\n  FILE *httpfile;\n  char contentencoding[SHORTLEN];\n  char errorstr[MAXLEN];\n  char recbuf[MAXLEN];\n  long len;\n  int contentlength;\n  int status;\n  char firstchar;\n\n  closehttpfile = 0;\n  closememfile = 0;\n\n  /* don't do r/w files */\n  if (rwmode != 0) {\n    ffpmsg(\"Can't open http:// type file with READWRITE access\");\n    ffpmsg(\"  Specify an outfile for r/w access (http_open)\");\n    goto error;\n  }\n\n  /* do the signal handler bits */\n  if (setjmp(env) != 0) {\n    /* feels like the second time */\n    /* this means something bad happened */\n    ffpmsg(\"Timeout (http_open)\");\n    snprintf(errorstr, MAXLEN, \"Download timeout exceeded: %d seconds\",net_timeout);\n    ffpmsg(errorstr);\n    ffpmsg(\"   (multiplied x10 for files requiring uncompression)\");\n    ffpmsg(\"   Timeout may be adjusted with fits_set_timeout\");\n    goto error;\n  }\n\n  (void) signal(SIGALRM, signal_handler);\n  \n  /* Open the network connection */\n\n  if (http_open_network(filename,&httpfile,contentencoding,\n\t\t\t       &contentlength)) {\n      alarm(0);\n      ffpmsg(\"Unable to open http file (http_open):\");\n      ffpmsg(filename);\n      goto error;\n  } \n\n  closehttpfile++;\n\n  /* Create the memory file */\n  if ((status =  mem_create(filename,handle))) {\n    ffpmsg(\"Unable to create memory file (http_open)\");\n    goto error;\n  }\n\n  closememfile++;\n\n  /* Now, what do we do with the file */\n  /* Check to see what the first character is */\n  firstchar = fgetc(httpfile);\n  ungetc(firstchar,httpfile);\n  if (!strcmp(contentencoding,\"x-gzip\") || \n      !strcmp(contentencoding,\"x-compress\") ||\n      strstr(filename,\".gz\") || \n      strstr(filename,\".Z\") ||\n      ('\\037' == firstchar)) {\n    /* do the compress dance, which is the same as the gzip dance */\n    /* Using the cfitsio routine */\n\n    status = 0;\n    /* Ok, this is a tough case, let's be arbritary and say 10*net_timeout,\n       Given the choices for nettimeout above they'll probaby ^C before, but\n       it's always worth a shot*/\n    \n    alarm(net_timeout*10);\n    status = mem_uncompress2mem(filename, httpfile, *handle);\n    alarm(0);\n    if (status) {\n      ffpmsg(\"Error writing compressed memory file (http_open)\");\n      ffpmsg(filename);\n      goto error;\n    }\n    \n  } else {\n    /* It's not compressed, bad choice, but we'll copy it anyway */\n    if (contentlength % 2880) {\n      snprintf(errorstr,MAXLEN,\"Content-Length not a multiple of 2880 (http_open) %d\",\n\t      contentlength);\n      ffpmsg(errorstr);\n    }\n\n    /* write a memory file */\n    alarm(net_timeout);\n    while(0 != (len = fread(recbuf,1,MAXLEN,httpfile))) {\n      alarm(0); /* cancel alarm */\n      status = mem_write(*handle,recbuf,len);\n      if (status) {\n        ffpmsg(\"Error copying http file into memory (http_open)\");\n        ffpmsg(filename);\n\tgoto error;\n      }\n      alarm(net_timeout); /* rearm the alarm */\n    }\n  }\n  \n  fclose(httpfile);\n\n  signal(SIGALRM, SIG_DFL);\n  alarm(0);\n  return mem_seek(*handle,0);\n\n error:\n  alarm(0); /* clear it */\n  if (closehttpfile) {\n    fclose(httpfile);\n  }\n  if (closememfile) {\n    mem_close_free(*handle);\n  }\n  \n  signal(SIGALRM, SIG_DFL);\n  return (FILE_NOT_OPENED);\n}\n\n/*--------------------------------------------------------------------------*/\n/* This creates a memory file handle with a copy of the URL in filename.  The\n   file must be compressed and is copied (still compressed) to disk first. \n   The compressed disk file is then uncompressed into memory (READONLY).\n*/\n\nint http_compress_open(char *url, int rwmode, int *handle)\n{\n  FILE *httpfile;\n  char contentencoding[SHORTLEN];\n  char errorstr[MAXLEN];\n  char recbuf[MAXLEN];\n  long len;\n  int contentlength;\n  int ii, flen, status;\n  char firstchar;\n\n  closehttpfile = 0;\n  closediskfile = 0;\n  closefdiskfile = 0;\n  closememfile = 0;\n\n  flen = strlen(netoutfile);\n  if (!flen)  {\n     /* cfileio made a mistake, should set the netoufile first otherwise \n        we don't know where to write the output file */\n     ffpmsg\n\t(\"Output file not set, shouldn't have happened (http_compress_open)\");\n      goto error;\n  }\n\n  if (rwmode != 0) {\n    ffpmsg(\"Can't open compressed http:// type file with READWRITE access\");\n    ffpmsg(\"  Specify an UNCOMPRESSED outfile (http_compress_open)\");\n    goto error;\n  }\n  /* do the signal handler bits */\n  if (setjmp(env) != 0) {\n    /* feels like the second time */\n    /* this means something bad happened */\n    ffpmsg(\"Timeout (http_open)\");\n    snprintf(errorstr, MAXLEN, \"Download timeout exceeded: %d seconds\",net_timeout);\n    ffpmsg(errorstr);\n    ffpmsg(\"   Timeout may be adjusted with fits_set_timeout\");\n    goto error;\n  }\n\n  signal(SIGALRM, signal_handler);\n  \n  /* Open the http connectin */\n  alarm(net_timeout);\n  if ((status = http_open_network(url,&httpfile,contentencoding,\n\t\t\t       &contentlength))) {\n    alarm(0);\n    ffpmsg(\"Unable to open http file (http_compress_open)\");\n    ffpmsg(url);\n    goto error;\n  }\n\n  closehttpfile++;\n\n  /* Better be compressed */\n\n  firstchar = fgetc(httpfile);\n  ungetc(firstchar,httpfile);\n  if (!strcmp(contentencoding,\"x-gzip\") || \n      !strcmp(contentencoding,\"x-compress\") ||\n      ('\\037' == firstchar)) {\n\n    if (*netoutfile == '!')\n    {\n       /* user wants to clobber file, if it already exists */\n       for (ii = 0; ii < flen; ii++)\n           netoutfile[ii] = netoutfile[ii + 1];  /* remove '!' */\n\n       status = file_remove(netoutfile);\n    }\n\n    /* Create the new file */\n    if ((status =  file_create(netoutfile,handle))) {\n      ffpmsg(\"Unable to create output disk file (http_compress_open):\");\n      ffpmsg(netoutfile);\n      goto error;\n    }\n    \n    closediskfile++;\n\n    /* write a file */\n    alarm(net_timeout);\n    while(0 != (len = fread(recbuf,1,MAXLEN,httpfile))) {\n      alarm(0);\n      status = file_write(*handle,recbuf,len);\n      if (status) {\n\tffpmsg(\"Error writing disk file (http_compres_open)\");\n        ffpmsg(netoutfile);\n\tgoto error;\n      }\n      alarm(net_timeout);\n    }\n    file_close(*handle);\n    fclose(httpfile);\n    closehttpfile--;\n    closediskfile--;\n\n    /* File is on disk, let's uncompress it into memory */\n\n    if (NULL == (diskfile = fopen(netoutfile,\"r\"))) {\n      ffpmsg(\"Unable to reopen disk file (http_compress_open)\");\n      ffpmsg(netoutfile);\n      goto error;\n    }\n    closefdiskfile++;\n\n    /* Create the memory handle to hold it */\n    if ((status =  mem_create(url,handle))) {\n      ffpmsg(\"Unable to create memory file (http_compress_open)\");\n      goto error;\n    }\n    closememfile++;\n\n    /* Uncompress it */\n    status = 0;\n    status = mem_uncompress2mem(url,diskfile,*handle);\n    fclose(diskfile);\n    closefdiskfile--;\n    if (status) {\n      ffpmsg(\"Error uncompressing disk file to memory (http_compress_open)\");\n      ffpmsg(netoutfile);\n      goto error;\n    }\n      \n  } else {\n    /* Opps, this should not have happened */\n    ffpmsg(\"Can only have compressed files here (http_compress_open)\");\n    goto error;\n  }    \n    \n  signal(SIGALRM, SIG_DFL);\n  alarm(0);\n  return mem_seek(*handle,0);\n\n error:\n  alarm(0); /* clear it */\n  if (closehttpfile) {\n    fclose(httpfile);\n  }\n  if (closefdiskfile) {\n    fclose(diskfile);\n  }\n  if (closememfile) {\n    mem_close_free(*handle);\n  }\n  if (closediskfile) {\n    file_close(*handle);\n  } \n  \n  signal(SIGALRM, SIG_DFL);\n  return (FILE_NOT_OPENED);\n}\n\n/*--------------------------------------------------------------------------*/\n/* This creates a file handle with a copy of the URL in filename.  The http\n   file is copied to disk first.  If it's compressed then it is\n   uncompressed when copying to the disk */\n\nint http_file_open(char *url, int rwmode, int *handle)\n{\n  FILE *httpfile;\n  char contentencoding[SHORTLEN];\n  char errorstr[MAXLEN];\n  char recbuf[MAXLEN];\n  long len;\n  int contentlength;\n  int ii, flen, status;\n  char firstchar;\n\n  /* Check if output file is actually a memory file */\n  if (!strncmp(netoutfile, \"mem:\", 4) )\n  {\n     /* allow the memory file to be opened with write access */\n     return( http_open(url, READONLY, handle) );\n  }     \n\n  closehttpfile = 0;\n  closefile = 0;\n  closeoutfile = 0;\n\n  flen = strlen(netoutfile);\n  if (!flen) {\n      /* cfileio made a mistake, we need to know where to write the file */\n      ffpmsg(\"Output file not set, shouldn't have happened (http_file_open)\");\n      return (FILE_NOT_OPENED);\n  }\n\n  /* do the signal handler bits */\n  if (setjmp(env) != 0) {\n    /* feels like the second time */\n    /* this means something bad happened */\n    ffpmsg(\"Timeout (http_open)\");\n    snprintf(errorstr, MAXLEN, \"Download timeout exceeded: %d seconds\",net_timeout);\n    ffpmsg(errorstr);\n    ffpmsg(\"   (multiplied x10 for files requiring uncompression)\");\n    ffpmsg(\"   Timeout may be adjusted with fits_set_timeout\");\n    goto error;\n  }\n\n  signal(SIGALRM, signal_handler);\n  \n  /* Open the network connection */\n  alarm(net_timeout);\n  if ((status = http_open_network(url,&httpfile,contentencoding,\n\t\t\t       &contentlength))) {\n    alarm(0);\n    ffpmsg(\"Unable to open http file (http_file_open)\");\n    ffpmsg(url);\n    goto error;\n  }\n\n  closehttpfile++;\n\n  if (*netoutfile == '!')\n  {\n     /* user wants to clobber disk file, if it already exists */\n     for (ii = 0; ii < flen; ii++)\n         netoutfile[ii] = netoutfile[ii + 1];  /* remove '!' */\n\n     status = file_remove(netoutfile);\n  }\n\n  firstchar = fgetc(httpfile);\n  ungetc(firstchar,httpfile);\n  if (!strcmp(contentencoding,\"x-gzip\") || \n      !strcmp(contentencoding,\"x-compress\") ||\n      ('\\037' == firstchar)) {\n\n    /* to make this more cfitsioish we use the file driver calls to create\n       the disk file */\n\n    /* Create the output file */\n    if ((status =  file_create(netoutfile,handle))) {\n      ffpmsg(\"Unable to create output file (http_file_open)\");\n      ffpmsg(netoutfile);\n      goto error;\n    }\n\n    file_close(*handle);\n    if (NULL == (outfile = fopen(netoutfile,\"w\"))) {\n      ffpmsg(\"Unable to reopen the output file (http_file_open)\");\n      ffpmsg(netoutfile);\n      goto error;\n    }\n    closeoutfile++;\n    status = 0;\n\n    /* Ok, this is a tough case, let's be arbritary and say 10*net_timeout,\n       Given the choices for nettimeout above they'll probaby ^C before, but\n       it's always worth a shot*/\n\n    alarm(net_timeout*10);\n    status = uncompress2file(url,httpfile,outfile,&status);\n    alarm(0);\n    if (status) {\n      ffpmsg(\"Error uncompressing http file to disk file (http_file_open)\");\n      ffpmsg(url);\n      ffpmsg(netoutfile);\n      goto error;\n    }\n    fclose(outfile);\n    closeoutfile--;\n  } else {\n    \n    /* Create the output file */\n    if ((status =  file_create(netoutfile,handle))) {\n      ffpmsg(\"Unable to create output file (http_file_open)\");\n      ffpmsg(netoutfile);\n      goto error;\n    }\n    \n    /* Give a warning message.  This could just be bad padding at the end\n       so don't treat it like an error. */\n    closefile++;\n    \n    if (contentlength % 2880) {\n      snprintf(errorstr, MAXLEN,\n\t      \"Content-Length not a multiple of 2880 (http_file_open) %d\",\n\t      contentlength);\n      ffpmsg(errorstr);\n    }\n    \n    /* write a file */\n    alarm(net_timeout);\n    while(0 != (len = fread(recbuf,1,MAXLEN,httpfile))) {\n      alarm(0);\n      status = file_write(*handle,recbuf,len);\n      if (status) {\n\tffpmsg(\"Error copying http file to disk file (http_file_open)\");\n        ffpmsg(url);\n        ffpmsg(netoutfile);\n\tgoto error;\n      }\n    }\n    file_close(*handle);\n    closefile--;\n  }\n  \n  fclose(httpfile);\n  closehttpfile--;\n\n  signal(SIGALRM, SIG_DFL);\n  alarm(0);\n\n  return file_open(netoutfile,rwmode,handle); \n\n error:\n  alarm(0); /* clear it */\n  if (closehttpfile) {\n    fclose(httpfile);\n  }\n  if (closeoutfile) {\n    fclose(outfile);\n  }\n  if (closefile) {\n    file_close(*handle);\n  } \n  \n  signal(SIGALRM, SIG_DFL);\n  return (FILE_NOT_OPENED);\n}\n\n/*--------------------------------------------------------------------------*/\n/* This is the guts of the code to get a file via http.  \n   url is the input url\n   httpfile is set to be the file connected to the socket which you can\n     read the file from\n   contentencoding is the mime type of the file, returned if the http server\n     returns it\n   contentlength is the length of the file, returned if the http server returns\n     it\n*/\nstatic int http_open_network(char *url, FILE **httpfile, char *contentencoding,\n\t\t\t  int *contentlength)\n{\n\n  int status;\n  int sock;\n  int tmpint;\n  char recbuf[MAXLEN];\n  char tmpstr[MAXLEN];\n  char tmpstr1[SHORTLEN];\n  char tmpstr2[MAXLEN];\n  char errorstr[MAXLEN];\n  char proto[SHORTLEN];\n  char host[SHORTLEN];\n  char userpass[MAXLEN];\n  char fn[MAXLEN];\n  char turl[MAXLEN];\n  char *scratchstr;\n  char *scratchstr2;\n  char *saveptr;\n  int port;\n  float version;\n\n  char pproto[SHORTLEN];\n  char phost[SHORTLEN]; /* address of the proxy server */\n  int  pport;  /* port number of the proxy server */\n  char pfn[MAXLEN];\n  char *proxy; /* URL of the proxy server */\n\n  /* Parse the URL apart again */\n  strcpy(turl,\"http://\");\n  strncat(turl,url,MAXLEN - 8);\n  if (NET_ParseUrl(turl,proto,host,&port,fn)) {\n    snprintf(errorstr,MAXLEN,\"URL Parse Error (http_open) %s\",url);\n    ffpmsg(errorstr);\n    return (FILE_NOT_OPENED);\n  }\n\n  /* Do we have a user:password combo ? */\n    strcpy(userpass, url);\n  if ((scratchstr = strchr(userpass, '@')) != NULL) {\n    *scratchstr = '\\0';\n  } else {\n    strcpy(userpass, \"\");\n  }\n\n  /* Ph. Prugniel 2003/04/03\n     Are we using a proxy?\n     \n     We use a proxy if the environment variable \"http_proxy\" is set to an\n     address, eg. http://wwwcache.nottingham.ac.uk:3128\n     (\"http_proxy\" is also used by wget)\n  */\n  proxy = getenv(\"http_proxy\");\n\n  /* Connect to the remote host */\n  if (proxy) {\n    if (NET_ParseUrl(proxy,pproto,phost,&pport,pfn)) {\n      snprintf(errorstr,MAXLEN,\"URL Parse Error (http_open) %s\",proxy);\n      ffpmsg(errorstr);\n      return (FILE_NOT_OPENED);\n    }\n    sock = NET_TcpConnect(phost,pport);\n  }  else {\n    sock = NET_TcpConnect(host,port); \n  }\n\n  if (sock < 0) {\n    if (proxy) {\n      ffpmsg(\"Couldn't connect to host via proxy server (http_open_network)\");\n      ffpmsg(proxy);\n    }\n    return (FILE_NOT_OPENED);\n  }\n\n  /* Make the socket a stdio file */\n  if (NULL == (*httpfile = fdopen(sock,\"r\"))) {\n    ffpmsg (\"fdopen failed to convert socket to file (http_open_network)\");\n    close(sock);\n    return (FILE_NOT_OPENED);\n  }\n\n  /* Send the GET request to the remote server */\n  /* Ph. Prugniel 2003/04/03 \n     One must add the Host: command because of HTTP 1.1 servers (ie. virtual\n     hosts) */\n\n  if (proxy) {\n    snprintf(tmpstr,MAXLEN,\"GET http://%s:%-d%s HTTP/1.0\\r\\n\",host,port,fn);\n  } else {\n    snprintf(tmpstr,MAXLEN,\"GET %s HTTP/1.0\\r\\n\",fn);\n  }\n\n  if (strcmp(userpass, \"\")) {\n    encode64(strlen(userpass), userpass, MAXLEN, tmpstr2);\n    snprintf(tmpstr1, SHORTLEN,\"Authorization: Basic %s\\r\\n\", tmpstr2);\n\n    if (strlen(tmpstr) + strlen(tmpstr1) > MAXLEN - 1)\n    {\n        fclose(*httpfile);\n        *httpfile=0;\n        return (FILE_NOT_OPENED);\n    }\n    strcat(tmpstr,tmpstr1);\n  }\n\n/*  snprintf(tmpstr1,SHORTLEN,\"User-Agent: HEASARC/CFITSIO/%-8.3f\\r\\n\",ffvers(&version)); */\n\n/*  snprintf(tmpstr1,SHORTLEN,\"User-Agent: CFITSIO/HEASARC/%-8.3f\\r\\n\",ffvers(&version)); */\n  snprintf(tmpstr1,SHORTLEN,\"User-Agent: FITSIO/HEASARC/%-8.3f\\r\\n\",ffvers(&version)); \n \n  if (strlen(tmpstr) + strlen(tmpstr1) > MAXLEN - 1)\n  {\n        fclose(*httpfile);\n        *httpfile=0;\n        return (FILE_NOT_OPENED);\n  }\n\n  strcat(tmpstr,tmpstr1);\n\n  /* HTTP 1.1 servers require the following 'Host: ' string */\n  snprintf(tmpstr1,SHORTLEN,\"Host: %s:%-d\\r\\n\\r\\n\",host,port);\n\n  if (strlen(tmpstr) + strlen(tmpstr1) > MAXLEN - 1)\n  {\n        fclose(*httpfile);\n        *httpfile=0;\n        return (FILE_NOT_OPENED);\n  }\n\n  strcat(tmpstr,tmpstr1);\n\n  status = NET_SendRaw(sock,tmpstr,strlen(tmpstr),NET_DEFAULT);\n\n  /* read the header */\n  if (!(fgets(recbuf,MAXLEN,*httpfile))) {\n    snprintf (errorstr,MAXLEN,\"http header short (http_open_network) %s\",recbuf);\n    ffpmsg(errorstr);\n    fclose(*httpfile);\n    *httpfile=0;\n    return (FILE_NOT_OPENED);\n  }\n\n  *contentlength = 0;\n  contentencoding[0] = '\\0';\n\n  /* Our choices are 200, ok, 302, temporary redirect, or 301 perm redirect */\n  sscanf(recbuf,\"%s %d\",tmpstr,&status);\n  if (status != 200){\n    if (status == 301 || status == 302) {\n      /* got a redirect */\n\n/*\n      if (status == 302) {\n\tffpmsg(\"Note: Web server replied with a temporary redirect from\");\n      } else {\n\tffpmsg(\"Note: Web server replied with a redirect from\");\n      }\n      ffpmsg(turl);\n*/\n      /* now, let's not write the most sophisticated parser here */\n\n      while (fgets(recbuf,MAXLEN,*httpfile)) {\n\n\tscratchstr = strstr(recbuf,\"Location: \");\n\tif (scratchstr != NULL) {\n\n\t  /* Ok, we found the Location line which gives the redirected URL */\n          /* skip the \"Location: \"  charactrers */\n\t  scratchstr += 10; \n             \n\t  /* strip off any end-of-line characters */\n          tmpint = strlen(scratchstr);\n\t  if (scratchstr[tmpint-1] == '\\r') scratchstr[tmpint-1] = '\\0';\n          tmpint = strlen(scratchstr);\n          if (scratchstr[tmpint-1] == '\\n') scratchstr[tmpint-1] = '\\0';\n          tmpint = strlen(scratchstr);\n\t  if (scratchstr[tmpint-1] == '\\r') scratchstr[tmpint-1] = '\\0';\n\n/*\n\t  ffpmsg(\"to:\");\n\t  ffpmsg(scratchstr);\n\t  ffpmsg(\" \");\n*/\n\t  scratchstr2 = strstr(scratchstr,\"http://\");\n          if (scratchstr2 != NULL) {\n\t     /* Ok, we found the HTTP redirection is to another HTTP URL. */\n\t     /* We can handle this case directly, here */\n\t     /* skip the \"http://\" characters */\n\t     scratchstr2 += 7;\n\t     strcpy(turl, scratchstr2);\n\t     fclose (*httpfile);\n             *httpfile=0;\n\n             /* note the recursive call to itself */\n\t     return \n\t        http_open_network(turl,httpfile,contentencoding,contentlength);\n          }\n\n          /* It was not a HTTP to HTTP redirection, so see if it HTTP to FTP */\n\t  scratchstr2 = strstr(scratchstr,\"ftp://\");\n          if (scratchstr2 != NULL) {\n\t     /* Ok, we found the HTTP redirection is to a FTP URL. */\n\t     /* skip the \"ftp://\" characters */\n\t     scratchstr2 += 6;\n\n             /* return the new URL string, and set contentencoding to \"ftp\" as\n\t        a flag to the http_checkfile routine\n\t     */\n             if (strlen(scratchstr2) > FLEN_FILENAME-1) \n             {\n                ffpmsg(\"Error: redirected url string too long (http_open_network)\");\n                fclose(*httpfile);\n                *httpfile=0;\n                return URL_PARSE_ERROR;\n             }\n\t     strcpy(url, scratchstr2);\n             strcpy(contentencoding,\"ftp://\");\n\t     fclose (*httpfile);\n             *httpfile=0; \n\t     return 0;\n          }\n          \n          /* Now check for HTTP to HTTPS redirection. */\n\t  scratchstr2 = strstr(scratchstr,\"https://\");\n          if (scratchstr2 != NULL) {\n             /* skip the \"https://\" characters */\n             scratchstr2 += 8;\n             \n             /* return the new URL string, and set contentencoding to \"https\" as\n\t        a flag to the http_checkfile routine\n\t     */\n             if (strlen(scratchstr2) > FLEN_FILENAME-1) \n             {\n                ffpmsg(\"Error: redirected url string too long (http_open_network)\");\n                fclose(*httpfile);\n                return URL_PARSE_ERROR;\n             }\n             strcpy(url, scratchstr2);\n             strcpy(contentencoding,\"https://\");\n             fclose(*httpfile);\n             *httpfile=0;\n             return 0;\n          }\n          \n\t}\n      }\n\n      /* if we get here then we couldnt' decide the redirect */\n      ffpmsg(\"but we were unable to find the redirected url in the servers response\");\n    }\n\n    /* error.  could not open the http file */\n    fclose(*httpfile);\n    *httpfile=0;\n    return (FILE_NOT_OPENED);\n  }\n\n  /* from here the first word holds the keyword we want */\n  /* so, read the rest of the header */\n  while (fgets(recbuf,MAXLEN,*httpfile)) {\n    /* Blank line ends the header */\n    if (*recbuf == '\\r') break;\n    if (strlen(recbuf) > 3) {\n      recbuf[strlen(recbuf)-1] = '\\0';\n      recbuf[strlen(recbuf)-1] = '\\0';\n    }\n    sscanf(recbuf,\"%s %d\",tmpstr,&tmpint);\n    /* Did we get a content-length header ? */\n    if (!strcmp(tmpstr,\"Content-Length:\")) {\n      *contentlength = tmpint;\n    }\n    /* Did we get the content-encoding header ? */\n    if (!strcmp(tmpstr,\"Content-Encoding:\")) {\n      if (NULL != (scratchstr = strstr(recbuf,\":\"))) {\n\t/* Found the : */\n\tscratchstr++; /* skip the : */\n\tscratchstr++; /* skip the extra space */\n        if (strlen(scratchstr) > SHORTLEN-1) \n        {\n           ffpmsg(\"Error: content-encoding string too long (http_open_network)\");\n           fclose(*httpfile);\n           *httpfile=0;\n           return URL_PARSE_ERROR;\n        }\n\tstrcpy(contentencoding,scratchstr);\n      }\n    }\n  }\n  \n  /* we're done, so return */\n  return 0;\n}\n\n/*--------------------------------------------------------------------------*/\n/* This creates a memory file handle with a copy of the URL in filename. The \n   curl library called from https_open_network will perform file uncompression\n   if necessary. */\nint https_open(char *filename, int rwmode, int *handle)\n{\n  curlmembuf inmem;\n  char errStr[MAXLEN];\n  int status=0;\n    \n  /* don't do r/w files */\n  if (rwmode != 0) {\n    ffpmsg(\"Can't open https:// type file with READWRITE access\");\n    ffpmsg(\"  Specify an outfile for r/w access (https_open)\");\n    return (FILE_NOT_OPENED);\n  }\n\n  inmem.memory=0;\n  inmem.size=0;\n  if (setjmp(env) != 0)\n  {\n    alarm(0);\n    signal(SIGALRM, SIG_DFL);\n    ffpmsg(\"Timeout (https_open)\");\n    snprintf(errStr, MAXLEN, \"Download timeout exceeded: %d seconds\",net_timeout);\n    ffpmsg(errStr);\n    ffpmsg(\"   Timeout may be adjusted with fits_set_timeout\");\n    free(inmem.memory);\n    return (FILE_NOT_OPENED);\n  }\n\n  signal(SIGALRM, signal_handler);\n  alarm(net_timeout);\n\n  if (https_open_network(filename, &inmem))\n  {\n     alarm(0);\n     signal(SIGALRM, SIG_DFL);\n     ffpmsg(\"Unable to read https file into memory (https_open)\");\n     free(inmem.memory);\n     return (FILE_NOT_OPENED);  \n  }\n  alarm(0);\n  signal(SIGALRM, SIG_DFL);\n  /* We now have the file transfered from the https server into the\n     inmem.memory buffer.  Now transfer that into a FITS memory file. */\n  if ((status = mem_create(filename, handle)))\n  {\n     ffpmsg(\"Unable to create memory file (https_open)\");\n     free(inmem.memory);\n     return (FILE_NOT_OPENED);\n  }\n  \n  if (inmem.size % 2880)\n  {\n     snprintf(errStr,MAXLEN,\"Content-Length not a multiple of 2880 (https_open) %u\",\n         inmem.size);\n     ffpmsg(errStr);\n  }\n  status = mem_write(*handle, inmem.memory, inmem.size);\n  if (status)\n  {\n     ffpmsg(\"Error copying https file into memory (https_open)\");\n     ffpmsg(filename);\n     free(inmem.memory);\n     mem_close_free(*handle);\n     return (FILE_NOT_OPENED);\n  }\n  free(inmem.memory);\n  return mem_seek(*handle, 0);\n   \n}\n\n/*--------------------------------------------------------------------------*/\nint https_file_open(char *filename, int rwmode, int *handle)\n{\n  int ii, flen;\n  char errStr[MAXLEN];\n  curlmembuf inmem;\n  \n  /* Check if output file is actually a memory file */\n  if (!strncmp(netoutfile, \"mem:\", 4) )\n  {\n     /* allow the memory file to be opened with write access */\n     return( https_open(filename, READONLY, handle) );\n  }     \n\n  flen = strlen(netoutfile);\n  if (!flen)\n  {\n      /* cfileio made a mistake, we need to know where to write the file */\n      ffpmsg(\"Output file not set, shouldn't have happened (https_file_open)\");\n      return (FILE_NOT_OPENED);\n  }\n  \n  inmem.memory=0;\n  inmem.size=0;\n  if (setjmp(env) != 0)\n  {\n     alarm(0);\n     signal(SIGALRM, SIG_DFL);\n     ffpmsg(\"Timeout (https_file_open)\");\n     snprintf(errStr, MAXLEN, \"Download timeout exceeded: %d seconds\",net_timeout);\n     ffpmsg(errStr);\n     ffpmsg(\"   Timeout may be adjusted with fits_set_timeout\");\n     free(inmem.memory);\n     return (FILE_NOT_OPENED);\n  }\n  signal(SIGALRM, signal_handler);\n  alarm(net_timeout);\n  if (https_open_network(filename, &inmem))\n  {\n     alarm(0);\n     signal(SIGALRM, SIG_DFL);\n     ffpmsg(\"Unable to read https file into memory (https_file_open)\");\n     free(inmem.memory);\n     return (FILE_NOT_OPENED);  \n  }\n  alarm(0);\n  signal(SIGALRM, SIG_DFL);\n  \n  if (*netoutfile == '!')\n  {\n     /* user wants to clobber disk file, if it already exists */\n     for (ii = 0; ii < flen; ii++)\n         netoutfile[ii] = netoutfile[ii + 1];  /* remove '!' */\n\n     file_remove(netoutfile);\n  }\n\n  /* Create the output file */\n  if (file_create(netoutfile,handle)) \n  {\n    ffpmsg(\"Unable to create output file (https_file_open)\");\n    ffpmsg(netoutfile);\n    free(inmem.memory);\n    return (FILE_NOT_OPENED);\n  }\n    \n  if (inmem.size % 2880)\n  {\n    snprintf(errStr, MAXLEN,\n\t    \"Content-Length not a multiple of 2880 (https_file_open) %d\",\n\t    inmem.size);\n    ffpmsg(errStr);\n  }\n   \n  if (file_write(*handle, inmem.memory, inmem.size))\n  {\n     ffpmsg(\"Error copying https file to disk file (https_file_open)\");\n     ffpmsg(filename);\n     ffpmsg(netoutfile);\n     free(inmem.memory);\n     file_close(*handle);\n     return (FILE_NOT_OPENED);\n  }\n  free(inmem.memory); \n  file_close(*handle);\n     \n  return file_open(netoutfile, rwmode, handle);\n}\n\n/*--------------------------------------------------------------------------*/\n/* Callback function curl library uses during https connection to transfer\n   server file into memory */\nsize_t curlToMemCallback(void *buffer, size_t size, size_t nmemb, void *userp)\n{\n   curlmembuf* inmem = (curlmembuf* )userp;\n   size_t transferSize = size*nmemb;\n   if (!inmem->size)\n   {\n      /* First time through - initialize with malloc */\n      inmem->memory = (char *)malloc(transferSize); \n   }\n   else\n      inmem->memory = realloc(inmem->memory, inmem->size+transferSize);\n   if (inmem->memory == NULL)\n   {\n      ffpmsg(\"realloc error - not enough memory (curlToMemCallback)\\n\");\n      return 0;\n   }\n   memcpy(&(inmem->memory[inmem->size]), buffer, transferSize);\n   inmem->size += transferSize;\n   \n   return transferSize;\n}\n\n/*--------------------------------------------------------------------------*/\n/* Callback function for displaying status bar during download */\nint curlProgressCallback(void *clientp, double dltotal, double dlnow,\n      double ultotal, double ulnow)\n{\n   int i, fullBar = 50, nToDisplay = 0;\n   int percent = 0;\n   double fracCompleted = 0.0;\n   char *urlname=0;\n   static int isComplete = 0;\n   static int isFirst = 1;\n   \n   /* isFirst is true the very first time this is entered. Afterwards it\n      should get reset to true when isComplete is first detected to have \n      toggled from true to false. */\n   if (dltotal == 0.0)\n   {\n      if (isComplete)\n         isFirst = 1;\n      isComplete = 0;\n      return 0;\n   }\n\n   fracCompleted = dlnow/dltotal;\n   percent = (int)ceil(fracCompleted*100.0 - 0.5);\n   if (isComplete && percent < 100)\n      isFirst = 1;\n   if (!isComplete || percent < 100)\n   {\n      if (isFirst)\n      {\n         urlname = (char *)clientp;\n         if (urlname)\n         {\n            fprintf(stderr,\"Downloading \");\n            fprintf(stderr,\"%s\",urlname);\n            fprintf(stderr,\"...\\n\");\n         }\n         isFirst = 0;\n      }\n      isComplete = (percent >= 100) ? 1 : 0;\n      nToDisplay = (int)ceil(fracCompleted*fullBar - 0.5);\n      /* Can dlnow ever be > dltotal?  Just in case... */\n      if (nToDisplay > fullBar)\n         nToDisplay = fullBar;\n      fprintf(stderr,\"%3d%% [\",percent);\n      for (i=0; i<nToDisplay; ++i)\n         fprintf(stderr,\"=\");\n      /* print remaining spaces */\n      for (i=nToDisplay; i<fullBar; ++i)\n         fprintf(stderr,\" \");\n      fprintf(stderr,\"]\\r\");\n      if (isComplete)\n         fprintf(stderr,\"\\n\");\n      fflush(stderr);\n   }\n   return 0;\n}\n\n/*--------------------------------------------------------------------------*/\nint https_open_network(char *filename, curlmembuf* buffer)\n{\n  int status=0;\n  char *urlname=0;\n  \n  /* urlname may have .gz or .Z appended to it */\n  urlname = (char *)malloc(strlen(filename)+12);\n  strcpy(urlname,\"https://\");\n  strcat(urlname,filename);\n  status = ssl_get_with_curl(urlname, buffer, 0, 0);\n  free(urlname);\n  return(status);\n}\n\nvoid https_set_verbose(int flag)\n{\n   if (!flag)\n      curl_verbose = 0;\n   else\n      curl_verbose = 1;\n}\n\nvoid fits_dwnld_prog_bar(int flag)\n{\n   if (!flag)\n      show_fits_download_progress = 0;\n   else\n      show_fits_download_progress = 1;\n}\n\nint fits_net_timeout(int sec)\n{\n   /* If sec is 0 or negative, treat this as a 'get' call. */\n   if (sec > 0)\n      net_timeout = (unsigned int)sec;\n   return (int)net_timeout;\n}\n\n/*--------------------------------------------------------------------------*/\nint ftps_open(char *filename, int rwmode, int *handle)\n{\n  curlmembuf inmem;\n  char errStr[MAXLEN];\n  char localFilename[MAXLEN]; /* may have .gz or .Z appended in ftps_open_network.*/\n  unsigned char firstByte=0,secondByte=0;\n  int status=0;\n  FILE *compressedFile=0;\n  \n  strcpy(localFilename,filename);\n    \n  /* don't do r/w files */\n  if (rwmode != 0) {\n    ffpmsg(\"Can't open ftps:// type file with READWRITE access\");\n    ffpmsg(\"  Specify an outfile for r/w access (ftps_open)\");\n    return (FILE_NOT_OPENED);\n  }\n\n  inmem.memory=0;\n  inmem.size=0;\n  if (setjmp(env) != 0)\n  {\n    alarm(0);\n    signal(SIGALRM, SIG_DFL);\n    ffpmsg(\"Timeout (ftps_open)\");\n    snprintf(errStr, MAXLEN, \"Download timeout exceeded: %d seconds\",net_timeout);\n    ffpmsg(errStr);\n    ffpmsg(\"   Timeout may be adjusted with fits_set_timeout\");\n    free(inmem.memory);\n    return (FILE_NOT_OPENED);\n  }\n\n  signal(SIGALRM, signal_handler);\n  alarm(net_timeout);\n\n  if (ftps_open_network(localFilename, &inmem))\n  {\n     alarm(0);\n     signal(SIGALRM, SIG_DFL);\n     ffpmsg(\"Unable to read ftps file into memory (ftps_open)\");\n     free(inmem.memory);\n     return (FILE_NOT_OPENED);  \n  }\n  \n  alarm(0);\n  signal(SIGALRM, SIG_DFL);\n\n  if (strcmp(localFilename, filename))\n  {\n     /* ftps_open_network has already checked that this is safe to\n        copy into string of size FLEN_FILENAME */\n     strcpy(filename, localFilename);\n  }\n  \n  /* We now have the file transfered from the ftps server into the\n     inmem.memory buffer.  Now transfer that into a FITS memory file. */\n  if ((status = mem_create(filename, handle)))\n  {\n     ffpmsg(\"Unable to create memory file (ftps_open)\");\n     free(inmem.memory);\n     return (FILE_NOT_OPENED);\n  }\n  if (inmem.size > 1)\n  {\n     firstByte = (unsigned char)inmem.memory[0];\n     secondByte = (unsigned char)inmem.memory[1];\n  }\n  if (firstByte == 0x1f && secondByte == 0x8b || \n        strstr(localFilename,\".Z\"))\n  {\n#ifdef HAVE_FMEMOPEN\n     compressedFile = fmemopen(inmem.memory, inmem.size, \"r\");\n#endif\n     if (!compressedFile)\n     {\n        ffpmsg(\"Error creating file in memory (ftps_open)\");\n        free(inmem.memory);\n        return(FILE_NOT_OPENED);\n     }\n     if(mem_uncompress2mem(localFilename,compressedFile,*handle))\n     {\n        ffpmsg(\"Error writing compressed memory file (ftps_open)\");\n        ffpmsg(filename);\n        fclose(compressedFile);\n        free(inmem.memory);\n        return(FILE_NOT_OPENED);\n     }\n     fclose(compressedFile);\n  }\n  else\n  {\n     if (inmem.size % 2880)\n     {\n        snprintf(errStr,MAXLEN,\"Content-Length not a multiple of 2880 (ftps_open) %u\",\n            inmem.size);\n        ffpmsg(errStr);\n     }\n     status = mem_write(*handle, inmem.memory, inmem.size);\n     if (status)\n     {\n        ffpmsg(\"Error copying https file into memory (ftps_open)\");\n        ffpmsg(filename);\n        free(inmem.memory);\n        mem_close_free(*handle);\n        return (FILE_NOT_OPENED);\n     }\n  }\n  free(inmem.memory);\n  return mem_seek(*handle, 0);\n}\n\n/*--------------------------------------------------------------------------*/\nint ftps_file_open(char *filename, int rwmode, int *handle)\n{\n  int ii, flen, status=0;\n  char errStr[MAXLEN];\n  char localFilename[MAXLEN]; /* may have .gz or .Z appended */\n  unsigned char firstByte=0,secondByte=0;\n  curlmembuf inmem;\n  FILE *compressedInFile=0;\n  \n  strcpy(localFilename, filename);\n  \n  /* Check if output file is actually a memory file */\n  if (!strncmp(netoutfile, \"mem:\", 4) )\n  {\n     /* allow the memory file to be opened with write access */\n     return( ftps_open(filename, READONLY, handle) );\n  }     \n\n  flen = strlen(netoutfile);\n  if (!flen)\n  {\n      /* cfileio made a mistake, we need to know where to write the file */\n      ffpmsg(\"Output file not set, shouldn't have happened (ftps_file_open)\");\n      return (FILE_NOT_OPENED);\n  }\n  \n  inmem.memory=0;\n  inmem.size=0;\n  if (setjmp(env) != 0)\n  {\n     alarm(0);\n     signal(SIGALRM, SIG_DFL);\n     ffpmsg(\"Timeout (ftps_file_open)\");\n     snprintf(errStr, MAXLEN, \"Download timeout exceeded: %d seconds\",net_timeout);\n     ffpmsg(errStr);\n     ffpmsg(\"   Timeout may be adjusted with fits_set_timeout\");\n     free(inmem.memory);\n     return (FILE_NOT_OPENED);\n  }\n  signal(SIGALRM, signal_handler);\n  alarm(net_timeout);\n  if (ftps_open_network(localFilename, &inmem))\n  {\n     alarm(0);\n     signal(SIGALRM, SIG_DFL);\n     ffpmsg(\"Unable to read ftps file into memory (ftps_file_open)\");\n     free(inmem.memory);\n     return (FILE_NOT_OPENED);  \n  }\n  alarm(0);\n  signal(SIGALRM, SIG_DFL);\n  \n  if (strstr(localFilename, \".Z\"))\n  {\n     ffpmsg(\".Z decompression not supported for file output (ftps_file_open)\");\n     free(inmem.memory);\n     return (FILE_NOT_OPENED);\n  }\n  \n  if (strcmp(localFilename, filename))\n  {\n     /* ftps_open_network has already checked that this is safe to\n        copy into string of size FLEN_FILENAME */\n     strcpy(filename, localFilename);\n  }\n  \n  if (*netoutfile == '!')\n  {\n     /* user wants to clobber disk file, if it already exists */\n     for (ii = 0; ii < flen; ii++)\n         netoutfile[ii] = netoutfile[ii + 1];  /* remove '!' */\n\n     file_remove(netoutfile);\n  }\n\n  /* Create the output file */\n  if (file_create(netoutfile,handle)) \n  {\n    ffpmsg(\"Unable to create output file (ftps_file_open)\");\n    ffpmsg(netoutfile);\n    free(inmem.memory);\n    return (FILE_NOT_OPENED);\n  }\n  \n  if (inmem.size > 1)\n  {  \n     firstByte = (unsigned char)inmem.memory[0];\n     secondByte = (unsigned char)inmem.memory[1];\n  }\n  if (firstByte == 0x1f && secondByte == 0x8b)\n  {\n     /* Doing a file create/close/reopen to mimic the procedure in\n        ftp_file_open.  The earlier call to file_create ensures that \n        checking is performed for the Hera case. */\n     file_close(*handle);\n     /* Reopen with direct call to fopen to set the outfile pointer */\n     outfile = fopen(netoutfile,\"w\");\n     if (!outfile)\n     {\n        ffpmsg(\"Unable to reopen the output file (ftps_file_open)\");\n        ffpmsg(netoutfile);\n        free(inmem.memory);\n        return(FILE_NOT_OPENED);\n     }\n     \n#ifdef HAVE_FMEMOPEN\n     compressedInFile = fmemopen(inmem.memory, inmem.size, \"r\");\n#endif\n     if (!compressedInFile)\n     {\n        ffpmsg(\"Error creating compressed file in memory (ftps_file_open)\");\n        free(inmem.memory);\n        fclose(outfile);\n        return(FILE_NOT_OPENED);\n     }\n     if (uncompress2file(filename, compressedInFile, outfile, &status))\n     {\n        ffpmsg(\"Unable to uncompress the output file (ftps_file_open)\");\n        ffpmsg(filename);\n        ffpmsg(netoutfile);\n        fclose(outfile);\n        fclose(compressedInFile);\n        free(inmem.memory);\n        return(FILE_NOT_OPENED);\n     }\n     fclose(outfile);\n     fclose(compressedInFile);\n  }\n  else\n  {\n     if (inmem.size % 2880)\n     {\n       snprintf(errStr, MAXLEN,\n\t       \"Content-Length not a multiple of 2880 (ftps_file_open) %d\",\n\t       inmem.size);\n       ffpmsg(errStr);\n     }\n\n     if (file_write(*handle, inmem.memory, inmem.size))\n     {\n        ffpmsg(\"Error copying ftps file to disk file (ftps_file_open)\");\n        ffpmsg(filename);\n        ffpmsg(netoutfile);\n        free(inmem.memory);\n        file_close(*handle);\n        return (FILE_NOT_OPENED);\n     }\n     file_close(*handle);\n  }\n  free(inmem.memory); \n  \n  return file_open(netoutfile, rwmode, handle);\n  \n}\n\n/*--------------------------------------------------------------------------*/\nint ftps_compress_open(char *filename, int rwmode, int *handle)\n{\n   int ii, flen, status=0;\n  char errStr[MAXLEN];\n  char localFilename[MAXLEN]; /* may have .gz or .Z appended */\n  unsigned char firstByte=0,secondByte=0;\n  curlmembuf inmem;\n  FILE *compressedInFile=0;\n  \n  /* don't do r/w files */\n  if (rwmode != 0) {\n    ffpmsg(\"Compressed files must be r/o\");\n    return (FILE_NOT_OPENED);\n  }\n  \n  strcpy(localFilename, filename);\n  \n  flen = strlen(netoutfile);\n  if (!flen)\n  {\n      /* cfileio made a mistake, we need to know where to write the file */\n      ffpmsg(\"Output file not set, shouldn't have happened (ftps_compress_open)\");\n      return (FILE_NOT_OPENED);\n  }\n  \n  inmem.memory=0;\n  inmem.size=0;\n  if (setjmp(env) != 0)\n  {\n     alarm(0);\n     signal(SIGALRM, SIG_DFL);\n     ffpmsg(\"Timeout (ftps_compress_open)\");\n     snprintf(errStr, MAXLEN, \"Download timeout exceeded: %d seconds\",net_timeout);\n     ffpmsg(errStr);\n     ffpmsg(\"   Timeout may be adjusted with fits_set_timeout\");\n     free(inmem.memory);\n     return (FILE_NOT_OPENED);\n  }\n  signal(SIGALRM, signal_handler);\n  alarm(net_timeout);\n  if (ftps_open_network(localFilename, &inmem))\n  {\n     alarm(0);\n     signal(SIGALRM, SIG_DFL);\n     ffpmsg(\"Unable to read ftps file into memory (ftps_compress_open)\");\n     free(inmem.memory);\n     return (FILE_NOT_OPENED);  \n  }\n  alarm(0);\n  signal(SIGALRM, SIG_DFL);\n  \n  if (strcmp(localFilename, filename))\n  {\n     /* ftps_open_network has already checked that this is safe to\n        copy into string of size FLEN_FILENAME */\n     strcpy(filename, localFilename);\n  }\n  if (inmem.size > 1)\n  {  \n     firstByte = (unsigned char)inmem.memory[0];\n     secondByte = (unsigned char)inmem.memory[1];\n  }\n  if ((firstByte == 0x1f && secondByte == 0x8b) || \n        strstr(localFilename,\".gz\") || strstr(localFilename,\".Z\"))\n  {\n     if (*netoutfile == '!')\n     {\n        /* user wants to clobber disk file, if it already exists */\n        for (ii = 0; ii < flen; ii++)\n            netoutfile[ii] = netoutfile[ii + 1];  /* remove '!' */\n\n        file_remove(netoutfile);\n     }\n     /* Create the output file */\n     if (file_create(netoutfile,handle)) \n     {\n       ffpmsg(\"Unable to create output file (ftps_compress_open)\");\n       ffpmsg(netoutfile);\n       free(inmem.memory);\n       return (FILE_NOT_OPENED);\n     }\n     if (file_write(*handle, inmem.memory, inmem.size))\n     {\n        ffpmsg(\"Error copying ftps file to disk file (ftps_file_open)\");\n        ffpmsg(filename);\n        ffpmsg(netoutfile);\n        free(inmem.memory);\n        file_close(*handle);\n        return (FILE_NOT_OPENED);\n     }\n     file_close(*handle);\n\n    /* File is on disk, let's uncompress it into memory */\n    if (NULL == (diskfile = fopen(netoutfile,\"r\"))) {\n      ffpmsg(\"Unable to reopen disk file (ftps_compress_open)\");\n      ffpmsg(netoutfile);\n      free(inmem.memory);\n      return (FILE_NOT_OPENED);\n    }\n\n    if ((status =  mem_create(localFilename,handle))) {\n      ffpmsg(\"Unable to create memory file (ftps_compress_open)\");\n      ffpmsg(localFilename);\n      free(inmem.memory);\n      fclose(diskfile);\n      diskfile=0;\n      return (FILE_NOT_OPENED);\n    }\n\n    status = mem_uncompress2mem(localFilename,diskfile,*handle);\n    fclose(diskfile);\n    diskfile=0;\n\n    if (status) {\n      ffpmsg(\"Error writing compressed memory file (ftps_compress_open)\");\n      free(inmem.memory);\n      mem_close_free(*handle);\n      return (FILE_NOT_OPENED);\n     }\n      \n  }\n  else\n  {\n     ffpmsg(\"Cannot write uncompressed infile to compressed outfile (ftps_compress_open)\");\n     free(inmem.memory);\n     return (FILE_NOT_OPENED);\n  }\n      \n  free(inmem.memory); \n  \n  return mem_seek(*handle,0);\n  \n}\n\n/*--------------------------------------------------------------------------*/\nint ftps_open_network(char *filename, curlmembuf* buffer)\n{\n  char agentStr[SHORTLEN];\n  char url[MAXLEN];\n  char tmphost[SHORTLEN]; /* work array for separating user/pass/host names */\n  char *username=0;\n  char *password=0;\n  char *hostname=0;\n  char *dirpath=0;\n  char *strptr=0;\n  float version=0.0;\n  int iDirpath=0, len=0, origLen=0;\n  int status=0; \n  \n  strcpy(url,\"ftp://\");\n\n  /* The filename may already contain a username and password, as indicated \n     by a '@' within the host part of the name (which we'll define as the substring\n     before the first '/').  If not, we'll set a default username:password  */\n  len = strlen(filename);\n  for (iDirpath=0; iDirpath<len; ++iDirpath)\n  {\n     if (filename[iDirpath] == '/')\n        break;\n  }\n  if (iDirpath > SHORTLEN-1)\n  {\n     ffpmsg(\"Host name is too long in URL (ftps_open_network)\");\n     return (FILE_NOT_OPENED);\n  }\n  strncpy(tmphost, filename, iDirpath);\n  dirpath = &filename[iDirpath];\n  tmphost[iDirpath]='\\0';\n  \n  /* There could be more than one '@' since they can also exist in the\n     username or password.  Find the right-most '@' and assume that it\n     delimits the host name. */\n  hostname = strrchr(tmphost, '@');\n  if (hostname)\n  {\n     *hostname = '\\0';\n     ++hostname;\n     /* Assume first occurrence of ':' is indicative of password delimiter. */\n     password = strchr(tmphost, ':');\n     if (password)\n     {\n        *password = '\\0';\n        ++password;\n     }\n     username = tmphost;\n  }\n  else\n     hostname = tmphost;\n  \n  if (!username || strlen(username)==0)\n     username = \"anonymous\";\n  if (!password || strlen(password)==0)\n  {\n     snprintf(agentStr,SHORTLEN,\"User-Agent: FITSIO/HEASARC/%-8.3f\",ffvers(&version));\n     password = agentStr;\n  }\n  \n  /* url may eventually have .gz or .Z appended to it */\n  if (strlen(url) + strlen(hostname) + strlen(dirpath) > MAXLEN-4)\n  {\n     ffpmsg(\"Full URL name is too long (ftps_open_network)\");\n     return (FILE_NOT_OPENED);\n  }\n  strcat(url, hostname);\n  strcat(url, dirpath);\n  \n/*  printf(\"url = %s\\n\",url);\n  printf(\"username = %s\\n\",username);\n  printf(\"password = %s\\n\",password);\n  printf(\"hostname = %s\\n\",hostname);\n*/\n\n  origLen = strlen(url);\n  status = ssl_get_with_curl(url, buffer, username, password);\n  /* If original url has .gz or .Z appended, do the same to the original filename.\n     Note that url also differs from original filename at this point, since\n     filename may have included username@password (which url would not). */\n  len = strlen(url);\n  if ((len-origLen) == 2 || (len-origLen) == 3)\n  {\n     if (strlen(filename) > FLEN_FILENAME - 4)\n     {\n        ffpmsg(\"Filename is too long to append compression ext (ftps_open_network)\");\n        /* buffer memory must be freed by calling routine */\n        return (FILE_NOT_OPENED);\n     }\n     strptr = url + origLen;\n     strcat(filename, strptr);\n  }\n  return status;\n  \n }\n\n/*--------------------------------------------------------------------------*/\n/* Function to perform common curl interfacing for https or ftps transfers */\n\nint ssl_get_with_curl(char *url, curlmembuf* buffer, char* username,\n                        char* password)\n{\n  /* These settings will force libcurl to perform host and peer authentication.\n     If it fails, this routine will try again without authentication (unless\n     user forbids this via CFITSIO_VERIFY_HTTPS environment variable).\n  */\n  long verifyPeer = 1;\n  long verifyHost = 2;\n  char errStr[MAXLEN];\n  char agentStr[MAXLEN];\n  float version=0.0;\n  char *tmpUrl=0;\n  char *verify=0;\n  int isFtp = (strstr(url,\"ftp://\") != NULL);\n  int experimentWithCompression = (!strstr(url,\".gz\") && !strstr(url,\".Z\")\n                && !strstr(url,\"?\"));\n  int notFound=1;\n  #ifdef CFITSIO_HAVE_CURL\n  CURL *curl=0;\n  CURLcode res;\n  char curlErrBuf[CURL_ERROR_SIZE];\n  \n  if (strstr(url,\".Z\") && !isFtp)\n  {\n     ffpmsg(\"x-compress .Z format not currently supported with curl https transfers\");\n     return(FILE_NOT_OPENED);\n  }\n\n  /* Will ASSUME curl_global_init has been called by this point.\n     It is not thread-safe to call it here. */\n  curl = curl_easy_init();\n   \n  res = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, verifyPeer);\n  if (res != CURLE_OK)\n  {\n     ffpmsg(\"ERROR: CFITSIO was built with a libcurl library that \");\n     ffpmsg(\"does not have SSL support, and therefore can't perform https or ftps transfers.\");\n     return (FILE_NOT_OPENED);    \n  }\n  curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, verifyHost);\n  \n  curl_easy_setopt(curl, CURLOPT_VERBOSE, (long)curl_verbose);\n  curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlToMemCallback);\n  snprintf(agentStr,MAXLEN,\"User-Agent: FITSIO/HEASARC/%-8.3f\",ffvers(&version)); \n  curl_easy_setopt(curl, CURLOPT_USERAGENT,agentStr);\n  \n  buffer->memory = 0; /* malloc/realloc will grow this in the callback function */\n  buffer->size = 0;\n  curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)buffer);\n  curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curlErrBuf);\n  curlErrBuf[0]=0;\n  /* This is needed for easy_perform to return an error whenever http server\n      returns an error >= 400, ie. if it can't find the requested file. */\n  curl_easy_setopt(curl, CURLOPT_FAILONERROR,  1L);\n  /* This turns on automatic decompression for all recognized types. */\n  curl_easy_setopt(curl, CURLOPT_ENCODING, \"\");\n  \n  /* tmpUrl should be large enough to accomodate original url + \".gz\" */\n  tmpUrl = (char *)malloc(strlen(url)+4);\n  strcpy(tmpUrl, url);\n  if (show_fits_download_progress)\n  {\n     curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, curlProgressCallback);\n     curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, tmpUrl);\n     curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);\n  }\n  else\n     curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);\n  \n  /* USESSL only necessary for ftps, though it may not hurt anything\n     if it were also set for https. */\n  if (isFtp)\n  {\n     curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);\n     if (username)\n        curl_easy_setopt(curl, CURLOPT_USERNAME, username);\n     if (password)\n        curl_easy_setopt(curl, CURLOPT_PASSWORD, password);\n  }\n  \n  /* Unless url already contains a .gz, .Z or '?' (probably from a cgi script),\n     first try with .gz appended. */\n  \n  if (experimentWithCompression)\n     strcat(tmpUrl, \".gz\");\n\n  /* First attempt: verification on */\n  curl_easy_setopt(curl, CURLOPT_URL, tmpUrl);\n  res = curl_easy_perform(curl);\n  if (res != CURLE_OK && res != CURLE_HTTP_RETURNED_ERROR && \n                res != CURLE_REMOTE_FILE_NOT_FOUND)\n  {\n     /*   CURLE_HTTP_RETURNED_ERROR is what gets returned if HTTP server\n        returns an error code >= 400. CURLE_REMOTE_FILE_NOT_FOUND may\n        be returned by an ftp server. If these are not causing this error, \n        assume it is a verification issue. \n          Try again with verification removed, unless user disallowed it\n        via environment variable. */\n     verify = getenv(\"CFITSIO_VERIFY_HTTPS\");\n     if (verify)\n     {\n        if (verify[0] == 'T' || verify[0] == 't')\n        {\n           snprintf(errStr,MAXLEN,\"libcurl error: %d\",res);\n           ffpmsg(errStr);\n           if (strlen(curlErrBuf))\n              ffpmsg(curlErrBuf);     \n           curl_easy_cleanup(curl);  \n           free(tmpUrl);\n           return (FILE_NOT_OPENED);\n        }\n     }\n     verifyPeer = 0;\n     verifyHost = 0;\n     curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, verifyPeer);\n     curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, verifyHost);\n     /* Second attempt: no verification, .gz appended */\n     res = curl_easy_perform(curl);\n     if (res != CURLE_OK)\n     {\n        if (isFtp && experimentWithCompression)\n        {\n           strcpy(tmpUrl, url);\n           strcat(tmpUrl, \".Z\");\n           curl_easy_setopt(curl, CURLOPT_URL, tmpUrl);\n           /* For ftps, make another attempt with .Z */\n           res = curl_easy_perform(curl);\n           if (res == CURLE_OK)\n           {\n              /* Success, but should still warn */\n              fprintf(stderr, \"Warning: Unable to perform SSL verification on https transfer from: %s\\n\",\n                   tmpUrl);\n              notFound=0;          \n           }\n        }\n          \n        /* If we've been appending .gz or .Z, try a final time without. */\n        if (experimentWithCompression && notFound)\n        {\n           strcpy(tmpUrl, url);\n           curl_easy_setopt(curl, CURLOPT_URL, tmpUrl);\n           /* attempt with no verification, no .gz or .Z appended */ \n           res = curl_easy_perform(curl);\n           if (res != CURLE_OK)\n           {\n              snprintf(errStr,MAXLEN,\"libcurl error: %d\",res);\n              ffpmsg(errStr);\n              if (strlen(curlErrBuf))\n                 ffpmsg(curlErrBuf);     \n              curl_easy_cleanup(curl);  \n              free(tmpUrl);\n              return (FILE_NOT_OPENED);\n           }\n           else\n              /* Success, but should still warn */\n              fprintf(stderr, \"Warning: Unable to perform SSL verification on https transfer from: %s\\n\",\n                   tmpUrl);           \n        }\n        else if (notFound)\n        {\n           snprintf(errStr,MAXLEN,\"libcurl error: %d\",res);\n           ffpmsg(errStr);\n           if (strlen(curlErrBuf))\n              ffpmsg(curlErrBuf);     \n           curl_easy_cleanup(curl);  \n           free(tmpUrl);\n           return (FILE_NOT_OPENED);\n        }        \n     }\n     else\n        /* Success, but still issue warning */\n        fprintf(stderr, \"Warning: Unable to perform SSL verification on https transfer from: %s\\n\",\n             tmpUrl);\n\n  }\n  else if (res == CURLE_HTTP_RETURNED_ERROR || res == CURLE_REMOTE_FILE_NOT_FOUND)\n  {\n     /* .gz extension failed and verification isn't the problem.  \n         No need to relax peer/host checking */\n     /* Unless url already contained a .gz, .Z or '?' (probably from a cgi script),\n        try again with original url unappended (but first try .Z if this is ftps). */\n     if (experimentWithCompression)\n     {\n        if (isFtp)\n        {\n           strcpy(tmpUrl, url);\n           strcat(tmpUrl, \".Z\");\n           curl_easy_setopt(curl, CURLOPT_URL, tmpUrl); \n           res = curl_easy_perform(curl);\n           if (res == CURLE_OK)\n              notFound = 0;\n        }\n        if (notFound)\n        {\n           strcpy(tmpUrl, url);\n           curl_easy_setopt(curl, CURLOPT_URL, tmpUrl); \n           res = curl_easy_perform(curl);\n           if (res != CURLE_OK)\n           {\n              snprintf(errStr,MAXLEN,\"libcurl error: %d\",res);\n              ffpmsg(errStr);\n              if (strlen(curlErrBuf))\n                 ffpmsg(curlErrBuf);     \n              curl_easy_cleanup(curl);  \n              free(tmpUrl);\n              return (FILE_NOT_OPENED);\n           }\n        }\n     }\n     else\n     {\n        snprintf(errStr,MAXLEN,\"libcurl error: %d\",res);\n        ffpmsg(errStr);\n        if (strlen(curlErrBuf))\n           ffpmsg(curlErrBuf);     \n        curl_easy_cleanup(curl);  \n        free(tmpUrl);\n        return (FILE_NOT_OPENED);\n     }\n  }\n  \n  /* If we made it here, assume tmpUrl was successful. Calling routines\n     must make sure url can hold up to 3 extra chars */\n  strcpy(url, tmpUrl);\n  \n  free(tmpUrl);\n  curl_easy_cleanup(curl);\n  \n  #else\n   ffpmsg(\"ERROR: This CFITSIO build was not compiled with the libcurl library package \");\n   ffpmsg(\"and therefore it cannot perform HTTPS or FTPS connections.\"); \n   return (FILE_NOT_OPENED);  \n  \n  #endif\n  return 0;\n}\n\n/*--------------------------------------------------------------------------*/\n/* This creates a memory file handle with a copy of the URL in filename. The \n   file is uncompressed if necessary */\n\nint ftp_open(char *filename, int rwmode, int *handle)\n{\n  FILE *ftpfile;\n  FILE *command;\n  int sock;\n  char errorstr[MAXLEN];\n  char recbuf[MAXLEN];\n  long len;\n  int status;\n  char firstchar;\n\n  closememfile = 0;\n  closecommandfile = 0;\n  closeftpfile = 0;\n\n  /* don't do r/w files */\n  if (rwmode != 0) {\n    ffpmsg(\"Can't open ftp:// type file with READWRITE access\");\n    ffpmsg(\"Specify an outfile for r/w access (ftp_open)\");\n    return (FILE_NOT_OPENED);\n  }\n\n  /* do the signal handler bits */\n  if (setjmp(env) != 0) {\n    /* feels like the second time */\n    /* this means something bad happened */\n    ffpmsg(\"Timeout (ftp_open)\");\n    snprintf(errorstr, MAXLEN, \"Download timeout exceeded: %d seconds\",net_timeout);\n    ffpmsg(errorstr);\n    ffpmsg(\"   (multiplied x10 for files requiring uncompression)\");\n    ffpmsg(\"   Timeout may be adjusted with fits_set_timeout\");\n    goto error;\n  }\n\n  signal(SIGALRM, signal_handler);\n  \n  /* Open the ftp connetion.  ftpfile is connected to the file port, \n     command is connected to port 21.  sock is the socket on port 21 */\n\n  if (strlen(filename) > MAXLEN - 4) {\n      ffpmsg(\"filename too long (ftp_open)\");\n      ffpmsg(filename);\n      goto error;\n  } \n\n  alarm(net_timeout);\n  if (ftp_open_network(filename,&ftpfile,&command,&sock)) {\n\n      alarm(0);\n      ffpmsg(\"Unable to open following ftp file (ftp_open):\");\n      ffpmsg(filename);\n      goto error;\n  } \n\n  closeftpfile++;\n  closecommandfile++;\n\n  /* create the memory file */\n  if ((status = mem_create(filename,handle))) {\n    ffpmsg (\"Could not create memory file to passive port (ftp_open)\");\n    ffpmsg(filename);\n    goto error;\n  }\n  closememfile++;\n  /* This isn't quite right, it'll fail if the file has .gzabc at the end\n     for instance */\n\n  /* Decide if the file is compressed */\n  firstchar = fgetc(ftpfile);\n  ungetc(firstchar,ftpfile);\n\n  if (strstr(filename,\".gz\") || \n      strstr(filename,\".Z\") ||\n      ('\\037' == firstchar)) {\n    \n    status = 0;\n    /* A bit arbritary really, the user will probably hit ^C */\n    alarm(net_timeout*10);\n    status = mem_uncompress2mem(filename, ftpfile, *handle);\n    alarm(0);\n    if (status) {\n      ffpmsg(\"Error writing compressed memory file (ftp_open)\");\n      ffpmsg(filename);\n      goto error;\n    }\n  } else {\n    /* write a memory file */\n    alarm(net_timeout);\n    while(0 != (len = fread(recbuf,1,MAXLEN,ftpfile))) {\n      alarm(0);\n      status = mem_write(*handle,recbuf,len);\n      if (status) {\n\tffpmsg(\"Error writing memory file (http_open)\");\n        ffpmsg(filename);\n\tgoto error;\n      }\n      alarm(net_timeout);\n    }\n  }\n\n  /* close and clean up */\n  fclose(ftpfile);\n  closeftpfile--;\n\n  fclose(command);\n  NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n  closecommandfile--;\n\n  signal(SIGALRM, SIG_DFL);\n  alarm(0);\n\n  return mem_seek(*handle,0);\n\n error:\n  alarm(0); /* clear it */\n  if (closecommandfile) {\n    fclose(command);\n    NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n  }\n  if (closeftpfile) {\n    fclose(ftpfile);\n  }\n  if (closememfile) {\n    mem_close_free(*handle);\n  }\n  \n  signal(SIGALRM, SIG_DFL);\n  return (FILE_NOT_OPENED);\n}\n/*--------------------------------------------------------------------------*/\n/* This creates a file handle with a copy of the URL in filename. The \n   file must be  uncompressed and is copied to disk first */\n\nint ftp_file_open(char *url, int rwmode, int *handle)\n{\n  FILE *ftpfile;\n  FILE *command;\n  char errorstr[MAXLEN];\n  char recbuf[MAXLEN];\n  long len;\n  int sock;\n  int ii, flen, status;\n  char firstchar;\n\n  /* Check if output file is actually a memory file */\n  if (!strncmp(netoutfile, \"mem:\", 4) )\n  {\n     /* allow the memory file to be opened with write access */\n     return( ftp_open(url, READONLY, handle) );\n  }     \n\n  closeftpfile = 0;\n  closecommandfile = 0;\n  closefile = 0;\n  closeoutfile = 0;\n  \n  /* cfileio made a mistake, need to know where to write the output file */\n  flen = strlen(netoutfile);\n  if (!flen) \n    {\n      ffpmsg(\"Output file not set, shouldn't have happened (ftp_file_open)\");\n      return (FILE_NOT_OPENED);\n    }\n\n  /* do the signal handler bits */\n  if (setjmp(env) != 0) {\n    /* feels like the second time */\n    /* this means something bad happened */\n    ffpmsg(\"Timeout (ftp_file_open)\");\n    snprintf(errorstr, MAXLEN, \"Download timeout exceeded: %d seconds\",net_timeout);\n    ffpmsg(errorstr);\n    ffpmsg(\"   (multiplied x10 for files requiring uncompression)\");\n    ffpmsg(\"   Timeout may be adjusted with fits_set_timeout\");\n    goto error;\n  }\n\n  signal(SIGALRM, signal_handler);\n  \n  /* open the network connection to url. ftpfile holds the connection to\n     the input file, command holds the connection to port 21, and sock is \n     the socket connected to port 21 */\n\n  alarm(net_timeout);\n  if ((status = ftp_open_network(url,&ftpfile,&command,&sock))) {\n    alarm(0);\n    ffpmsg(\"Unable to open http file (ftp_file_open)\");\n    ffpmsg(url);\n    goto error;\n  }\n  closeftpfile++;\n  closecommandfile++;\n\n  if (*netoutfile == '!')\n  {\n     /* user wants to clobber file, if it already exists */\n     for (ii = 0; ii < flen; ii++)\n         netoutfile[ii] = netoutfile[ii + 1];  /* remove '!' */\n\n     status = file_remove(netoutfile);\n  }\n\n  /* Now, what do we do with the file */\n  firstchar = fgetc(ftpfile);\n  ungetc(firstchar,ftpfile);\n\n  if (strstr(url,\".gz\") || \n      strstr(url,\".Z\") ||\n      ('\\037' == firstchar)) {\n\n    /* to make this more cfitsioish we use the file driver calls to create\n       the file */\n    /* Create the output file */\n    if ((status =  file_create(netoutfile,handle))) {\n      ffpmsg(\"Unable to create output file (ftp_file_open)\");\n      ffpmsg(netoutfile);\n      goto error;\n    }\n\n    file_close(*handle);\n    if (NULL == (outfile = fopen(netoutfile,\"w\"))) {\n      ffpmsg(\"Unable to reopen the output file (ftp_file_open)\");\n      ffpmsg(netoutfile);\n      goto error;\n    }\n    closeoutfile++;\n    status = 0;\n\n    /* Ok, this is a tough case, let's be arbritary and say 10*net_timeout,\n       Given the choices for nettimeout above they'll probaby ^C before, but\n       it's always worth a shot*/\n\n    alarm(net_timeout*10);\n    status = uncompress2file(url,ftpfile,outfile,&status);\n    alarm(0);\n    if (status) {\n      ffpmsg(\"Unable to uncompress the output file (ftp_file_open)\");\n      ffpmsg(url);\n      ffpmsg(netoutfile);\n      goto error;\n    }\n    fclose(outfile);\n    closeoutfile--;\n\n  } else {\n    \n    /* Create the output file */\n    if ((status =  file_create(netoutfile,handle))) {\n      ffpmsg(\"Unable to create output file (ftp_file_open)\");\n      ffpmsg(netoutfile);\n      goto error;\n    }\n    closefile++;\n    \n    /* write a file */\n    alarm(net_timeout);\n    while(0 != (len = fread(recbuf,1,MAXLEN,ftpfile))) {\n      alarm(0);\n      status = file_write(*handle,recbuf,len);\n      if (status) {\n\tffpmsg(\"Error writing file (ftp_file_open)\");\n        ffpmsg(url);\n        ffpmsg(netoutfile);\n\tgoto error;\n      }\n      alarm(net_timeout);\n    }\n    file_close(*handle);\n  }\n  fclose(ftpfile);\n  closeftpfile--;\n  \n  fclose(command);\n  NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n  closecommandfile--;\n\n  signal(SIGALRM, SIG_DFL);\n  alarm(0);\n\n  return file_open(netoutfile,rwmode,handle);\n\n error:\n  alarm(0); /* clear it */\n  if (closeftpfile) {\n    fclose(ftpfile);\n  }\n  if (closecommandfile) {\n    fclose(command);\n    NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n  }\n  if (closeoutfile) {\n    fclose(outfile);\n  }\n  if (closefile) {\n    file_close(*handle);\n  } \n  \n  signal(SIGALRM, SIG_DFL);\n  return (FILE_NOT_OPENED);\n}\n\n/*--------------------------------------------------------------------------*/\n/* This creates a memory  handle with a copy of the URL in filename. The \n   file must be compressed and is copied to disk first */\n\nint ftp_compress_open(char *url, int rwmode, int *handle)\n{\n  FILE *ftpfile;\n  FILE *command;\n  char errorstr[MAXLEN];\n  char recbuf[MAXLEN];\n  long len;\n  int ii, flen, status;\n  int sock;\n  char firstchar;\n\n  closeftpfile = 0;\n  closecommandfile = 0;\n  closememfile = 0;\n  closefdiskfile = 0;\n  closediskfile = 0;\n\n  /* don't do r/w files */\n  if (rwmode != 0) {\n    ffpmsg(\"Compressed files must be r/o\");\n    return (FILE_NOT_OPENED);\n  }\n  \n  /* Need to know where to write the output file */\n  flen = strlen(netoutfile);\n  if (!flen) \n    {\n      ffpmsg(\n\t\"Output file not set, shouldn't have happened (ftp_compress_open)\");\n      return (FILE_NOT_OPENED);\n    }\n  \n  /* do the signal handler bits */\n  if (setjmp(env) != 0) {\n    /* feels like the second time */\n    /* this means something bad happened */\n    ffpmsg(\"Timeout (ftp_compress_open)\");\n    snprintf(errorstr, MAXLEN, \"Download timeout exceeded: %d seconds\",net_timeout);\n    ffpmsg(errorstr);\n    ffpmsg(\"   Timeout may be adjusted with fits_set_timeout\");\n    goto error;\n  }\n  \n  signal(SIGALRM, signal_handler);\n  \n  /* Open the network connection to url, ftpfile is connected to the file \n     port, command is connected to port 21.  sock is for writing to port 21 */\n  alarm(net_timeout);\n\n  if ((status = ftp_open_network(url,&ftpfile,&command,&sock))) {\n    alarm(0);\n    ffpmsg(\"Unable to open ftp file (ftp_compress_open)\");\n    ffpmsg(url);\n    goto error;\n  }\n  closeftpfile++;\n  closecommandfile++;\n\n  /* Now, what do we do with the file */\n  firstchar = fgetc(ftpfile);\n  ungetc(firstchar,ftpfile);\n\n  if (strstr(url,\".gz\") || \n      strstr(url,\".Z\") ||\n      ('\\037' == firstchar)) {\n  \n    if (*netoutfile == '!')\n    {\n       /* user wants to clobber file, if it already exists */\n       for (ii = 0; ii < flen; ii++)\n          netoutfile[ii] = netoutfile[ii + 1];  /* remove '!' */\n\n       status = file_remove(netoutfile);\n    }\n\n    /* Create the output file */\n    if ((status =  file_create(netoutfile,handle))) {\n      ffpmsg(\"Unable to create output file (ftp_compress_open)\");\n      ffpmsg(netoutfile);\n      goto error;\n    }\n    closediskfile++;\n    \n    /* write a file */\n    alarm(net_timeout);\n    while(0 != (len = fread(recbuf,1,MAXLEN,ftpfile))) {\n      alarm(0);\n      status = file_write(*handle,recbuf,len);\n      if (status) {\n\tffpmsg(\"Error writing file (ftp_compres_open)\");\n        ffpmsg(url);\n        ffpmsg(netoutfile);\n\tgoto error;\n      }\n      alarm(net_timeout);\n    }\n\n    file_close(*handle);\n    closediskfile--;\n    fclose(ftpfile);\n    closeftpfile--;\n    /* Close down the ftp connection */\n    fclose(command);\n    NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n    closecommandfile--;\n\n    /* File is on disk, let's uncompress it into memory */\n\n    if (NULL == (diskfile = fopen(netoutfile,\"r\"))) {\n      ffpmsg(\"Unable to reopen disk file (ftp_compress_open)\");\n      ffpmsg(netoutfile);\n      return (FILE_NOT_OPENED);\n    }\n    closefdiskfile++;\n  \n    if ((status =  mem_create(url,handle))) {\n      ffpmsg(\"Unable to create memory file (ftp_compress_open)\");\n      ffpmsg(url);\n      goto error;\n    }\n    closememfile++;\n\n    status = 0;\n    status = mem_uncompress2mem(url,diskfile,*handle);\n    fclose(diskfile);\n    closefdiskfile--;\n\n    if (status) {\n      ffpmsg(\"Error writing compressed memory file (ftp_compress_open)\");\n      goto error;\n    }\n      \n  } else {\n    /* Opps, this should not have happened */\n    ffpmsg(\"Can only compressed files here (ftp_compress_open)\");\n    goto error;\n  }    \n    \n\n  signal(SIGALRM, SIG_DFL);\n  alarm(0);\n  return mem_seek(*handle,0);\n\n error:\n  alarm(0); /* clear it */\n  if (closeftpfile) {\n    fclose(ftpfile);\n  }\n  if (closecommandfile) {\n    fclose(command);\n    NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n  }\n  if (closefdiskfile) {\n    fclose(diskfile);\n  }\n  if (closememfile) {\n    mem_close_free(*handle);\n  }\n  if (closediskfile) {\n    file_close(*handle);\n  } \n  \n  signal(SIGALRM, SIG_DFL);\n  return (FILE_NOT_OPENED);\n}\n\n/*--------------------------------------------------------------------------*/\n/* Open a ftp connection to filename (really a URL), return ftpfile set to \n   the file connection, and command set to the control connection, with sock\n   also set to the control connection */\n\nstatic int ftp_open_network(char *filename, FILE **ftpfile, FILE **command, int *sock)\n{\n  int status;\n  int sock1;\n  int tmpint;\n  char recbuf[MAXLEN];\n  char errorstr[MAXLEN];\n  char tmpstr[MAXLEN];\n  char proto[SHORTLEN];\n  char host[SHORTLEN];\n  char agentStr[SHORTLEN];\n  char *newhost;\n  char *username;\n  char *password;\n  char fn[MAXLEN];\n  char *newfn;\n  char *passive;\n  char *tstr;\n  char *saveptr;\n  char ip[SHORTLEN];\n  char turl[MAXLEN];\n  int port;\n  int ii,tryingtologin = 1;\n  float version=0.0;\n\n  /* parse the URL */\n  if (strlen(filename) > MAXLEN - 7) {\n    ffpmsg(\"ftp filename is too long (ftp_open_network)\");\n    return (FILE_NOT_OPENED);\n  }\n\n  strcpy(turl,\"ftp://\");\n  strcat(turl,filename);\n  if (NET_ParseUrl(turl,proto,host,&port,fn)) {\n    snprintf(errorstr,MAXLEN,\"URL Parse Error (ftp_open) %s\",filename);\n    ffpmsg(errorstr);\n    return (FILE_NOT_OPENED);\n  }\n  \n  port = 21;\n  /* We might have a user name.  If not, set defaults for username and password */\n  username = \"anonymous\";\n  snprintf(agentStr,SHORTLEN,\"User-Agent: FITSIO/HEASARC/%-8.3f\",ffvers(&version));\n  password = agentStr;\n  /* is there an @ sign */\n  if (NULL != (newhost = strrchr(host,'@'))) {\n    *newhost = '\\0'; /* make it a null, */\n    newhost++; /* Now newhost points to the host name and host points to the \n\t\t  user name, password combo */\n    username = host;\n    /* is there a : for a password */\n    if (NULL != strchr(username,':')) {\n      password = strchr(username,':');\n      *password = '\\0';\n      password++;\n    }\n  } else {\n    newhost = host;\n  }\n\n  for (ii = 0; ii < 10; ii++) {  /* make up to 10 attempts to log in */\n  \n    /* Connect to the host on the required port */\n    *sock = NET_TcpConnect(newhost,port);\n    /* convert it to a stdio file */\n    if (NULL == (*command = fdopen(*sock,\"r\"))) {\n      ffpmsg (\"fdopen failed to convert socket to stdio file (ftp_open_netowrk)\");\n      return (FILE_NOT_OPENED);\n    }\n\n    /* Wait for the 220 response */\n    if (ftp_status(*command,\"220 \")) {\n      fclose(*command);\n      NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n\n/*      ffpmsg(\"sleeping for 5 in ftp_open_network, then try again\"); */\n\n      sleep (5);  /* take a nap and hope ftp server sorts itself out in the meantime */\n\n    } else {\n      tryingtologin = 0;\n      break;\n    }\n  }\n\n  if (tryingtologin) { /* the 10 attempts were not successful */\n     ffpmsg (\"error connecting to remote server, no 220 seen (ftp_open_network)\");\n     return (FILE_NOT_OPENED);\n  }\n\n  /* Send the user name and wait for the right response */\n  snprintf(tmpstr,MAXLEN,\"USER %s\\r\\n\",username);\n\n  status = NET_SendRaw(*sock,tmpstr,strlen(tmpstr),NET_DEFAULT);\n\n  if (ftp_status(*command,\"331 \")) {\n    ffpmsg (\"USER error no 331 seen (ftp_open_network)\");\n    fclose(*command);\n    NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n    return (FILE_NOT_OPENED);\n  }\n  \n  /* Send the password and wait for the right response */\n  snprintf(tmpstr,MAXLEN,\"PASS %s\\r\\n\",password);\n  status = NET_SendRaw(*sock,tmpstr,strlen(tmpstr),NET_DEFAULT);\n  \n  if (ftp_status(*command,\"230 \")) {\n    ffpmsg (\"PASS error, no 230 seen (ftp_open_network)\");\n    fclose(*command);\n    NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n    return (FILE_NOT_OPENED);\n  }\n\n  /* now do the cwd command */\n  newfn = strrchr(fn,'/');\n  if (newfn == NULL) {\n    strcpy(tmpstr,\"CWD /\\r\\n\");\n    newfn = fn;\n  } else {\n    *newfn = '\\0';\n    newfn++;\n    if (strlen(fn) == 0) {\n      strcpy(tmpstr,\"CWD /\\r\\n\");\n    } else {\n      /* remove the leading slash */\n      if (fn[0] == '/') {\n\tsnprintf(tmpstr,MAXLEN,\"CWD %s\\r\\n\",&fn[1]);\n      } else {\n\tsnprintf(tmpstr,MAXLEN,\"CWD %s\\r\\n\",fn);\n      } \n    }\n  }\n  \n  status = NET_SendRaw(*sock,tmpstr,strlen(tmpstr),NET_DEFAULT);\n  \n  if (ftp_status(*command,\"250 \")) {\n    ffpmsg (\"CWD error, no 250 seen (ftp_open_network)\");\n    fclose(*command);\n    NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n    return (FILE_NOT_OPENED);\n  }\n  \n  if (!strlen(newfn)) {\n    ffpmsg(\"Null file name (ftp_open)\");\n    fclose(*command);\n    NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n    return (FILE_NOT_OPENED);\n  }\n\n  /* Always use binary mode */\n  snprintf(tmpstr,MAXLEN,\"TYPE I\\r\\n\");\n  status = NET_SendRaw(*sock,tmpstr,strlen(tmpstr),NET_DEFAULT);\n  \n  if (ftp_status(*command,\"200 \")) {\n    ffpmsg (\"TYPE I error, 200 not seen (ftp_open_network)\");\n    fclose(*command);\n    NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n    return (FILE_NOT_OPENED);\n  }\n \n  status = NET_SendRaw(*sock,\"PASV\\r\\n\",6,NET_DEFAULT);\n\n  if (!(fgets(recbuf,MAXLEN,*command))) {\n    ffpmsg (\"PASV error (ftp_open)\");\n    fclose(*command);\n    NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n    return (FILE_NOT_OPENED);\n  }\n  \n  /*  Passive mode response looks like\n      227 Entering Passive Mode (129,194,67,8,210,80) */\n  if (recbuf[0] == '2' && recbuf[1] == '2' && recbuf[2] == '7') {\n    /* got a good passive mode response, find the opening ( */\n    \n    if (!(passive = strchr(recbuf,'('))) {\n      ffpmsg (\"PASV error (ftp_open_network)\");\n      fclose(*command);\n      NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return (FILE_NOT_OPENED);\n    }\n    \n    *passive = '\\0';\n    passive++;\n    ip[0] = '\\0';\n      \n    /* Messy parsing of response from PASV *command */\n    \n    if (!(tstr = ffstrtok(passive,\",)\",&saveptr))) {\n      ffpmsg (\"PASV error (ftp_open_network)\");\n      fclose(*command);\n      NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return (FILE_NOT_OPENED);\n    }\n    strcpy(ip,tstr);\n    strcat(ip,\".\");\n    \n    if (!(tstr = ffstrtok(NULL,\",)\",&saveptr))) {\n      ffpmsg (\"PASV error (ftp_open_network)\");\n      fclose(*command);\n      NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return (FILE_NOT_OPENED);\n    }\n    strcat(ip,tstr);\n    strcat(ip,\".\");\n    \n    if (!(tstr = ffstrtok(NULL,\",)\",&saveptr))) {\n      ffpmsg (\"PASV error (ftp_open_network)\");\n      fclose(*command);\n      NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return (FILE_NOT_OPENED);\n    }\n    strcat(ip,tstr);\n    strcat(ip,\".\");\n    \n    if (!(tstr = ffstrtok(NULL,\",)\",&saveptr))) {\n      ffpmsg (\"PASV error (ftp_open_network)\");\n      fclose(*command);\n      NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return (FILE_NOT_OPENED);\n    }\n    strcat(ip,tstr);\n    \n    /* Done the ip number, now do the port # */\n    if (!(tstr = ffstrtok(NULL,\",)\",&saveptr))) {\n      ffpmsg (\"PASV error (ftp_open_network)\");\n      fclose(*command);\n      NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return (FILE_NOT_OPENED);\n    }\n    sscanf(tstr,\"%d\",&port);\n    port *= 256;\n    \n    if (!(tstr = ffstrtok(NULL,\",)\",&saveptr))) {\n      ffpmsg (\"PASV error (ftp_open_network)\");\n      fclose(*command);\n      NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return (FILE_NOT_OPENED);\n    }\n    sscanf(tstr,\"%d\",&tmpint);\n    port += tmpint;\n\n    if (!strlen(newfn)) {\n      ffpmsg(\"Null file name (ftp_open_network)\");\n      fclose(*command);\n      NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return (FILE_NOT_OPENED);\n    }\n    \n    /* Connect to the data port */\n    sock1 = NET_TcpConnect(ip,port);\n    if (NULL == (*ftpfile = fdopen(sock1,\"r\"))) {\n      ffpmsg (\"Could not connect to passive port (ftp_open_network)\");\n      fclose(*command);\n      NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return (FILE_NOT_OPENED);\n    }\n\n    /* Send the retrieve command */\n    snprintf(tmpstr,MAXLEN,\"RETR %s\\r\\n\",newfn);\n    status = NET_SendRaw(*sock,tmpstr,strlen(tmpstr),NET_DEFAULT);\n\n    if (ftp_status(*command,\"150 \")) {\n      fclose(*ftpfile);\n      NET_SendRaw(sock1,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      fclose(*command);\n      NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return (FILE_NOT_OPENED);\n    }\n    return 0;    /* successfully opened the ftp file */\n  }\n  \n  /* no passive mode */\n\n  fclose(*command);\n  NET_SendRaw(*sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n  return (FILE_NOT_OPENED);\n}\n/*--------------------------------------------------------------------------*/\n/* Open a ftp connection to see if the file exists (return 1) or not (return 0) */\n\nint ftp_file_exist(char *filename)\n{\n  FILE *ftpfile;\n  FILE *command;\n  int sock;\n  int status;\n  int sock1;\n  int tmpint;\n  char recbuf[MAXLEN];\n  char errorstr[MAXLEN];\n  char tmpstr[MAXLEN];\n  char proto[SHORTLEN];\n  char host[SHORTLEN];\n  char *newhost;\n  char *username;\n  char *password;\n  char fn[MAXLEN];\n  char *newfn;\n  char *passive;\n  char *tstr;\n  char *saveptr;\n  char ip[SHORTLEN];\n  char turl[MAXLEN];\n  int port;\n  int ii, tryingtologin = 1;\n\n  /* parse the URL */\n  if (strlen(filename) > MAXLEN - 7) {\n    ffpmsg(\"ftp filename is too long (ftp_file_exist)\");\n    return 0;\n  }\n\n  strcpy(turl,\"ftp://\");\n  strcat(turl,filename);\n  if (NET_ParseUrl(turl,proto,host,&port,fn)) {\n    snprintf(errorstr,MAXLEN,\"URL Parse Error (ftp_file_exist) %s\",filename);\n    ffpmsg(errorstr);\n    return 0;\n  }\n\n  port = 21;\n  /* we might have a user name */\n  username = \"anonymous\";\n  password = \"user@host.com\";\n  /* is there an @ sign */\n  if (NULL != (newhost = strrchr(host,'@'))) {\n    *newhost = '\\0'; /* make it a null, */\n    newhost++; /* Now newhost points to the host name and host points to the \n\t\t  user name, password combo */\n    username = host;\n    /* is there a : for a password */\n    if (NULL != strchr(username,':')) {\n      password = strchr(username,':');\n      *password = '\\0';\n      password++;\n    }\n  } else {\n    newhost = host;\n  }\n\n  for (ii = 0; ii < 10; ii++) {  /* make up to 10 attempts to log in */\n  \n  /* Connect to the host on the required port */\n  sock = NET_TcpConnect(newhost,port);\n  /* convert it to a stdio file */\n  if (NULL == (command = fdopen(sock,\"r\"))) {\n    ffpmsg (\"Failed to convert socket to stdio file (ftp_file_exist)\");\n    return 0;\n  }\n\n  /* Wait for the 220 response */\n  if (ftp_status(command,\"220\")) {\n    ffpmsg (\"error connecting to remote server, no 220 seen (ftp_file_exist)\");\n    fclose(command);\n    NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n\n/*    ffpmsg(\"sleeping for 5 in ftp_file_exist, then try again\"); */\n\n    sleep (5);  /* take a nap and hope ftp server sorts itself out in the meantime */\n\n  } else {\n    tryingtologin = 0;\n    break;\n  }\n  \n  }  \n\n  if (tryingtologin) { /* the 10 attempts were not successful */\n     ffpmsg (\"error connecting to remote server, no 220 seen (ftp_open_network)\");\n     return (0);\n  }\n \n  /* Send the user name and wait for the right response */\n  snprintf(tmpstr,MAXLEN,\"USER %s\\r\\n\",username);\n\n  status = NET_SendRaw(sock,tmpstr,strlen(tmpstr),NET_DEFAULT);\n  \n  /* If command is refused due to the connection requiring SSL (ie. an\n     fpts connection), this is where it will first be detected by way\n     of a 550 error code. */\n     \n  status = ftp_status(command,\"331 \");\n  if (status == 550)\n  {\n    ffpmsg (\"Server is requesting SSL, will switch to ftps (ftp_file_exist)\");\n    fclose(command);\n    NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n    return -1;\n  }\n  else if (status) {\n    ffpmsg (\"USER error no 331 seen (ftp_file_exist)\");\n    fclose(command);\n    NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n    return 0;\n  }\n  \n  /* Send the password and wait for the right response */\n  snprintf(tmpstr,MAXLEN,\"PASS %s\\r\\n\",password);\n  status = NET_SendRaw(sock,tmpstr,strlen(tmpstr),NET_DEFAULT);\n  \n  if (ftp_status(command,\"230 \")) {\n    ffpmsg (\"PASS error, no 230 seen (ftp_file_exist)\");\n    fclose(command);\n    NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n    return 0;\n  }\n\n  /* now do the cwd command */\n  newfn = strrchr(fn,'/');\n  if (newfn == NULL) {\n    strcpy(tmpstr,\"CWD /\\r\\n\");\n    newfn = fn;\n  } else {\n    *newfn = '\\0';\n    newfn++;\n    if (strlen(fn) == 0) {\n      strcpy(tmpstr,\"CWD /\\r\\n\");\n    } else {\n      /* remove the leading slash */\n      if (fn[0] == '/') {\n\tsnprintf(tmpstr,MAXLEN,\"CWD %s\\r\\n\",&fn[1]);\n      } else {\n\tsnprintf(tmpstr,MAXLEN,\"CWD %s\\r\\n\",fn);\n      } \n    }\n  }\n\n  status = NET_SendRaw(sock,tmpstr,strlen(tmpstr),NET_DEFAULT);\n  \n  if (ftp_status(command,\"250 \")) {\n    ffpmsg (\"CWD error, no 250 seen (ftp_file_exist)\");\n    fclose(command);\n    NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n    return 0;\n  }\n  \n  if (!strlen(newfn)) {\n    ffpmsg(\"Null file name (ftp_file_exist)\");\n    fclose(command);\n    NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n    return 0;\n  }\n\n  /* Always use binary mode */\n  snprintf(tmpstr,MAXLEN,\"TYPE I\\r\\n\");\n  status = NET_SendRaw(sock,tmpstr,strlen(tmpstr),NET_DEFAULT);\n  \n  if (ftp_status(command,\"200 \")) {\n    ffpmsg (\"TYPE I error, 200 not seen (ftp_file_exist)\");\n    fclose(command);\n    NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n    return 0;\n  }\n\n  status = NET_SendRaw(sock,\"PASV\\r\\n\",6,NET_DEFAULT);\n\n  if (!(fgets(recbuf,MAXLEN,command))) {\n    ffpmsg (\"PASV error (ftp_file_exist)\");\n    fclose(command);\n    NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n    return 0;\n  }\n  \n  /*  Passive mode response looks like\n      227 Entering Passive Mode (129,194,67,8,210,80) */\n  if (recbuf[0] == '2' && recbuf[1] == '2' && recbuf[2] == '7') {\n    /* got a good passive mode response, find the opening ( */\n    \n    if (!(passive = strchr(recbuf,'('))) {\n      ffpmsg (\"PASV error (ftp_file_exist)\");\n      fclose(command);\n      NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return 0;\n    }\n    \n    *passive = '\\0';\n    passive++;\n    ip[0] = '\\0';\n      \n    /* Messy parsing of response from PASV command */\n    \n    if (!(tstr = ffstrtok(passive,\",)\",&saveptr))) {\n      ffpmsg (\"PASV error (ftp_file_exist)\");\n      fclose(command);\n      NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return 0;\n    }\n    strcpy(ip,tstr);\n    strcat(ip,\".\");\n    \n    if (!(tstr = ffstrtok(NULL,\",)\",&saveptr))) {\n      ffpmsg (\"PASV error (ftp_file_exist)\");\n      fclose(command);\n      NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return 0;\n    }\n    strcat(ip,tstr);\n    strcat(ip,\".\");\n    \n    if (!(tstr = ffstrtok(NULL,\",)\",&saveptr))) {\n      ffpmsg (\"PASV error (ftp_file_exist)\");\n      fclose(command);\n      NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return 0;\n    }\n    strcat(ip,tstr);\n    strcat(ip,\".\");\n    \n    if (!(tstr = ffstrtok(NULL,\",)\",&saveptr))) {\n      ffpmsg (\"PASV error (ftp_file_exist)\");\n      fclose(command);\n      NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return 0;\n    }\n    strcat(ip,tstr);\n    \n    /* Done the ip number, now do the port # */\n    if (!(tstr = ffstrtok(NULL,\",)\",&saveptr))) {\n      ffpmsg (\"PASV error (ftp_file_exist)\");\n      fclose(command);\n      NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return 0;\n    }\n    sscanf(tstr,\"%d\",&port);\n    port *= 256;\n    \n    if (!(tstr = ffstrtok(NULL,\",)\",&saveptr))) {\n      ffpmsg (\"PASV error (ftp_file_exist)\");\n      fclose(command);\n      NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return 0;\n    }\n    sscanf(tstr,\"%d\",&tmpint);\n    port += tmpint;\n\n    if (!strlen(newfn)) {\n      ffpmsg(\"Null file name (ftp_file_exist)\");\n      fclose(command);\n      NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return 0;\n    }\n\n    /* Connect to the data port */\n    sock1 = NET_TcpConnect(ip,port);\n    if (NULL == (ftpfile = fdopen(sock1,\"r\"))) {\n      ffpmsg (\"Could not connect to passive port (ftp_file_exist)\");\n      fclose(command);\n      NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return 0;\n    }\n\n    /* Send the retrieve command */\n    snprintf(tmpstr,MAXLEN,\"RETR %s\\r\\n\",newfn);\n    status = NET_SendRaw(sock,tmpstr,strlen(tmpstr),NET_DEFAULT);\n\n    if (ftp_status(command,\"150 \")) {\n      fclose(ftpfile); \n      NET_SendRaw(sock1,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      fclose(command);\n      NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n      return 0;\n    }\n    \n    /* if we got here then the file probably exists */\n\n    fclose(ftpfile); \n    NET_SendRaw(sock1,\"QUIT\\r\\n\",6,NET_DEFAULT);\n    fclose(command); \n    NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n    return 1;\n  }\n  \n  /* no passive mode */\n\n  fclose(command);\n  NET_SendRaw(sock,\"QUIT\\r\\n\",6,NET_DEFAULT);\n  return 0;\n}\n\n/*--------------------------------------------------------------------------*/\n/* return a socket which results from connection to hostname on port port */\nint NET_TcpConnect(char *hostname, int port)\n{\n  /* Connect to hostname on port */\n \n   struct sockaddr_in sockaddr;\n   int sock;\n   int stat;\n   int val = 1;\n \n   CreateSocketAddress(&sockaddr,hostname,port);\n   /* Create socket */\n   if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {\n     ffpmsg(\"ERROR: NET_TcpConnect can't create socket\");\n     return CONNECTION_ERROR;\n   }\n \n   if ((stat = connect(sock, (struct sockaddr*) &sockaddr, \n\t\t       sizeof(sockaddr))) \n       < 0) {\n     close(sock);\n/*\n     perror(\"NET_Tcpconnect - Connection error\");\n     ffpmsg(\"Can't connect to host, connection error\");\n*/\n     return CONNECTION_ERROR;\n   }\n   setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val));\n   setsockopt(sock, SOL_SOCKET,  SO_KEEPALIVE, (char *)&val, sizeof(val));\n\n   val = 65536;\n   setsockopt(sock, SOL_SOCKET,  SO_SNDBUF,    (char *)&val, sizeof(val));\n   setsockopt(sock, SOL_SOCKET,  SO_RCVBUF,    (char *)&val, sizeof(val));\n   return sock;\n}\n\n/*--------------------------------------------------------------------------*/\n/* Write len bytes from buffer to socket sock */\nstatic int NET_SendRaw(int sock, const void *buffer, int length, int opt)\n{\n\n  char * buf = (char *) buffer;\n \n   int flag;\n   int n, nsent = 0;\n \n   switch (opt) {\n   case NET_DEFAULT:\n     flag = 0;\n     break;\n   case NET_OOB:\n     flag = MSG_OOB;\n     break;\n   case NET_PEEK:            \n   default:\n     flag = 0;\n     break;\n   }\n \n   if (sock < 0) return -1;\n   \n   for (n = 0; n < length; n += nsent) {\n     if ((nsent = send(sock, buf+n, length-n, flag)) <= 0) {\n       return nsent;\n     }\n   }\n\n   return n;\n}\n\n/*--------------------------------------------------------------------------*/\n\nstatic int NET_RecvRaw(int sock, void *buffer, int length)\n{\n  /* Receive exactly length bytes into buffer. Returns number of bytes */\n  /* received. Returns -1 in case of error. */\n\n\n   int nrecv, n;\n   char *buf = (char *)buffer;\n\n   if (sock < 0) return -1;\n   for (n = 0; n < length; n += nrecv) {\n      while ((nrecv = recv(sock, buf+n, length-n, 0)) == -1 && errno == EINTR)\n\terrno = 0;     /* probably a SIGCLD that was caught */\n      if (nrecv < 0)\n         return nrecv;\n      else if (nrecv == 0)\n\tbreak;        /*/ EOF */\n   }\n\n   return n;\n}\n \n/*--------------------------------------------------------------------------*/\n/* Yet Another URL Parser \n   url - input url\n   proto - input protocol\n   host - output host\n   port - output port\n   fn - output filename\n*/\n\nstatic int NET_ParseUrl(const char *url, char *proto, char *host, int *port, \n\t\t char *fn)\n{\n  /* parses urls into their bits */\n  /* returns 1 if error, else 0 */\n\n  char *urlcopy, *urlcopyorig;\n  char *ptrstr;\n  char *thost;\n  int isftp = 0;\n\n  /* figure out if there is a http: or  ftp: */\n\n  urlcopyorig = urlcopy = (char *) malloc(strlen(url)+1);\n  strcpy(urlcopy,url);\n\n  /* set some defaults */\n  *port = 80;\n  strcpy(proto,\"http:\");\n  strcpy(host,\"localhost\");\n  strcpy(fn,\"/\");\n  \n  ptrstr = strstr(urlcopy,\"http:\");\n  if (ptrstr == NULL) {\n    /* Nope, not http: */\n    ptrstr = strstr(urlcopy,\"root:\");\n    if (ptrstr == NULL) {\n      /* Nope, not root either */\n      ptrstr = strstr(urlcopy,\"ftp:\");\n      if (ptrstr != NULL) {\n\tif (ptrstr == urlcopy) {\n\t  strcpy(proto,\"ftp:\");\n\t  *port = 21;\n\t  isftp++;\n\t  urlcopy += 4; /* move past ftp: */\n\t} else {\n\t  /* not at the beginning, bad url */\n\t  free(urlcopyorig);\n\t  return 1;\n\t}\n      }\n    } else {\n      if (ptrstr == urlcopy) {\n\turlcopy += 5; /* move past root: */\n      } else {\n\t/* not at the beginning, bad url */\n\tfree(urlcopyorig);\n\treturn 1;\n      }\n    }\n  } else {\n    if (ptrstr == urlcopy) {\n      urlcopy += 5; /* move past http: */\n    } else {\n      free(urlcopyorig);\n      return 1;\n    }\n  }\n\n  /* got the protocol */\n  /* get the hostname */\n  if (urlcopy[0] == '/' && urlcopy[1] == '/') {\n    /* we have a hostname */\n    urlcopy += 2; /* move past the // */\n  }\n  /* do this only if http */\n  if (!strcmp(proto,\"http:\")) {\n\n    /* Move past any user:password */\n    if ((thost = strchr(urlcopy, '@')) != NULL)\n      urlcopy = thost+1;\n\n    if (strlen(urlcopy) > SHORTLEN-1)\n    {\n       free(urlcopyorig);\n       return 1;\n    }\n    strcpy(host,urlcopy);\n    thost = host;\n    while (*urlcopy != '/' && *urlcopy != ':' && *urlcopy) {\n      thost++;\n      urlcopy++;\n    }\n    /* we should either be at the end of the string, have a /, or have a : */\n    *thost = '\\0';\n    if (*urlcopy == ':') {\n      /* follows a port number */\n      urlcopy++;\n      sscanf(urlcopy,\"%d\",port);\n      while (*urlcopy != '/' && *urlcopy) urlcopy++; /* step to the */\n    }\n  } else {\n    /* do this for ftp */\n    if (strlen(urlcopy) > SHORTLEN-1)\n    {\n       free(urlcopyorig);\n       return 1;\n    }\n    strcpy(host,urlcopy);\n    thost = host;\n    while (*urlcopy != '/' && *urlcopy) {\n      thost++;\n      urlcopy++; \n    }\n    *thost = '\\0';\n    /* Now, we should either be at the end of the string, or have a / */\n    \n  }\n  /* Now the rest is a fn */\n\n  if (*urlcopy) {\n    if (strlen(urlcopy) > MAXLEN-1)\n    {\n       free(urlcopyorig);\n       return 1;\n    }\n    strcpy(fn,urlcopy);\n  }\n  free(urlcopyorig);\n  return 0;\n}\n\n/*--------------------------------------------------------------------------*/\nint http_checkfile (char *urltype, char *infile, char *outfile1)\n{\n\n/* Small helper functions to set the netoutfile static string */\n/* Called by cfileio after parsing the output file off of the input file url */\n\n  char newinfile[MAXLEN];\n  FILE *httpfile=0;\n  char contentencoding[MAXLEN];\n  int contentlength;\n  int foundfile = 0;\n  int status=0;\n\n  /* set defaults  */\n  strcpy(urltype,\"http://\");\n\n  if (strlen(outfile1)) {\n    /* don't copy the \"file://\" prefix, if present.  */\n    if (!strncmp(outfile1, \"file://\", 7) ) {\n      strcpy(netoutfile,outfile1+7);\n    } else {\n      strcpy(netoutfile,outfile1);\n    }\n  }\n\n  if (strstr(infile, \"?\")) {\n      /* Special case where infile name contains a \"?\". */\n      /* This is probably a CGI string; no point in testing if it exists */\n      /*  so just set urltype and netoutfile if necessary, then return */\n      \n      if (strlen(outfile1)) {   /* was an outfile specified? */\n          strcpy(urltype,\"httpfile://\");  \n\n          /* don't copy the \"file://\" prefix, if present.  */\n          if (!strncmp(outfile1, \"file://\", 7) ) {\n             strcpy(netoutfile,outfile1+7);\n          } else {\n             strcpy(netoutfile,outfile1);\n          }\n      }\n      return 0;  /* case where infile name contains \"?\" */\n  }\n\n  /*\n     If the specified infile file name does not contain a .gz or .Z suffix,\n     then first test if a .gz compressed version of the file exists, and if not\n     then test if a .Z version of the file exists. (because it will be much\n     faster to read the compressed file).  If the compressed files do not exist,\n     then finally just open the infile name exactly as specified.\n  */\n\n  if (!strstr(infile,\".gz\") && (!strstr(infile,\".Z\"))) {\n    /* The infile string does not contain the name of a compressed file.  */\n    /* Fisrt, look for a .gz compressed version of the file. */\n    \n    if (strlen(infile) + 3 > MAXLEN-1)\n    {\n       return URL_PARSE_ERROR;\n    }  \n    strcpy(newinfile,infile);\n    strcat(newinfile,\".gz\");\n\n    status = http_open_network(newinfile,&httpfile,contentencoding,\n\t\t\t   &contentlength);\n    if (!status) {\n      if (!strcmp(contentencoding, \"ftp://\")) {\n          /* this is a signal from http_open_network that indicates that */\n          /* the http server returned a 301 or 302 redirect to a FTP URL. */\n          /* Check that the file exists, because redirect many not be reliable */\n\t   \n          if (ftp_file_exist(newinfile)>0) { \n              /* The ftp .gz compressed file is there, all is good!  */\n              strcpy(urltype, \"ftp://\");\n              if (strlen(newinfile) > FLEN_FILENAME-1)\n              {\n                 return URL_PARSE_ERROR;\n              }\n              strcpy(infile,newinfile);\n\n              if (strlen(outfile1)) {\n                /* there is an output file;  might need to modify the urltype */\n\n                if (!strncmp(outfile1, \"mem:\", 4) )  {\n                     /* copy the file to memory, with READ and WRITE access \n                     In this case, it makes no difference whether the ftp file\n                     and or the output file are compressed or not.   */\n\n                     strcpy(urltype, \"ftpmem://\");  /* use special driver */\n                } else {\n        \t    /* input file is compressed */\n\t\t    if (strstr(outfile1,\".gz\") || (strstr(outfile1,\".Z\"))) {\n\t\t      strcpy(urltype,\"ftpcompress://\");\n\t\t    } else {\n\t\t      strcpy(urltype,\"ftpfile://\");\n\t\t    }\n                } \n              }\n\n              return 0;   /* found the .gz compressed ftp file */\n\t    }\n            /* fall through to here if ftp redirect does not exist */\n      } else if (!strcmp(contentencoding, \"https://\")) {\n          /* the http server returned a 301 or 302 redirect to an HTTPS URL. */\n          https_checkfile(urltype, infile, outfile1);\n          /* For https we're not testing for compressed extensions at \n             this stage.  It will all be done in https_open_network.  Therefore\n             leave infile alone and do immediate return. */\n          return 0;\n      } else {\n          /* found the http .gz compressed file */\n          if (httpfile)\n             fclose(httpfile);\n          foundfile = 1;\n          if (strlen(newinfile) > FLEN_FILENAME-1)\n          {\n             return URL_PARSE_ERROR;\n          }\n          strcpy(infile,newinfile);\n      }\n    }\n    else if (status != FILE_NOT_OPENED)\n    {\n       /* Some other error occured aside from not finding file, such as\n          a url parsing error.  Don't continue trying with other extensions. */\n       return status;   \n    }\n\n   if (!foundfile) {\n    /* did not find .gz compressed version of the file, so look for .Z file. */\n    \n    if (strlen(infile+2) > MAXLEN-1)\n    {\n       return URL_PARSE_ERROR;\n    }  \n    strcpy(newinfile,infile);\n    strcat(newinfile,\".Z\");\n    if (!http_open_network(newinfile,&httpfile,contentencoding,\n\t\t\t   &contentlength)) {\n\n      if (!strcmp(contentencoding, \"ftp://\")) {\n          /* this is a signal from http_open_network that indicates that */\n          /* the http server returned a 301 or 302 redirect to a FTP URL. */\n          /* Check that the file exists, because redirect many not be reliable */\n\t   \n          if (ftp_file_exist(newinfile)>0) { \n              /* The ftp .Z compressed file is there, all is good!  */\n              strcpy(urltype, \"ftp://\");\n              if (strlen(newinfile) > FLEN_FILENAME-1)\n              {\n                 return URL_PARSE_ERROR;\n              }\n              strcpy(infile,newinfile);\n\n              if (strlen(outfile1)) {\n                /* there is an output file;  might need to modify the urltype */\n\n                if (!strncmp(outfile1, \"mem:\", 4) )  {\n                     /* copy the file to memory, with READ and WRITE access \n                     In this case, it makes no difference whether the ftp file\n                     and or the output file are compressed or not.   */\n\n                     strcpy(urltype, \"ftpmem://\");  /* use special driver */\n                } else {\n        \t    /* input file is compressed */\n\t\t    if (strstr(outfile1,\".gz\") || (strstr(outfile1,\".Z\"))) {\n\t\t      strcpy(urltype,\"ftpcompress://\");\n\t\t    } else {\n\t\t      strcpy(urltype,\"ftpfile://\");\n\t\t    }\n                } \n            }\n            return 0;   /* found the .Z compressed ftp file */\n          }\n          /* fall through to here if ftp redirect does not exist */\n        }  else {\n           /* found the http .Z compressed file */\n           if (httpfile)\n              fclose(httpfile);\n           foundfile = 1;\n           if (strlen(newinfile) > FLEN_FILENAME-1)\n           {\n              return URL_PARSE_ERROR;\n           }\n           strcpy(infile,newinfile);\n        }\n      }\n    }\n  }  /* end of case where infile does not contain .gz or .Z */\n\n  if (!foundfile) {\n    /* look for the base file.name */\n      \n    strcpy(newinfile,infile);\n    if (!http_open_network(newinfile,&httpfile,contentencoding,\n\t\t\t   &contentlength)) {\n\n      if (!strcmp(contentencoding, \"ftp://\")) {\n          /* this is a signal from http_open_network that indicates that */\n          /* the http server returned a 301 or 302 redirect to a FTP URL. */\n          /* Check that the file exists, because redirect many not be reliable */\n\t   \n          if (ftp_file_exist(newinfile)>0) { \n              /* The ftp file is there, all is good!  */\n              strcpy(urltype, \"ftp://\");\n              if (strlen(newinfile) > FLEN_FILENAME-1)\n              {\n                 return URL_PARSE_ERROR;\n              }\n              strcpy(infile,newinfile);\n\n              if (strlen(outfile1)) {\n                /* there is an output file;  might need to modify the urltype */\n\n                if (!strncmp(outfile1, \"mem:\", 4) )  {\n                     /* copy the file to memory, with READ and WRITE access \n                     In this case, it makes no difference whether the ftp file\n                     and or the output file are compressed or not.   */\n\n                     strcpy(urltype, \"ftpmem://\");  /* use special driver */\n                     return 0;\n                } else {\n\n        \t  /* input file is not compressed */\n\t\t   strcpy(urltype,\"ftpfile://\");\n                } \n              } \n              return 0;   /* found the ftp file */\n            }\n            /* fall through to here if ftp redirect does not exist */\n      } else if (!strcmp(contentencoding, \"https://\")) {\n          /* the http server returned a 301 or 302 redirect to an HTTPS URL. */\n          https_checkfile(urltype, infile, outfile1);\n          /* For https we're not testing for compressed extensions at \n             this stage.  It will all be done in https_open_network.  Therefore\n             leave infile alone and do immediate return. */\n          return 0;\n      }  else {\n          /* found the base named file */\n          if (httpfile)\n             fclose(httpfile);\n          foundfile = 1;\n          if (strlen(newinfile) > FLEN_FILENAME-1)\n          {\n             return URL_PARSE_ERROR;\n          }\n          strcpy(infile,newinfile);\n      }\n\n    }\n  }\n\n  if (!foundfile) {\n     return (FILE_NOT_OPENED);\n  }\n\n  if (strlen(outfile1)) {\n    /* there is an output file */\n\n    if (!strncmp(outfile1, \"mem:\", 4) )  {\n       /* copy the file to memory, with READ and WRITE access \n          In this case, it makes no difference whether the http file\n          and or the output file are compressed or not.   */\n\n       strcpy(urltype, \"httpmem://\");  /* use special driver */\n       return 0;\n    }\n\n    if (strstr(infile, \"?\")) {\n      /* file name contains a '?' so probably a cgi string;  */\n      strcpy(urltype,\"httpfile://\");\n      return 0;\n    }\n\n    if (strstr(infile,\".gz\") || (strstr(infile,\".Z\"))) {\n\t/* It's compressed */\n\tif (strstr(outfile1,\".gz\") || (strstr(outfile1,\".Z\"))) {\n\t  strcpy(urltype,\"httpcompress://\");\n\t} else {\n\t  strcpy(urltype,\"httpfile://\");\n\t}\n    } else {\n\tstrcpy(urltype,\"httpfile://\");\n    }\n  } \n  return 0;\n}\n\n/*--------------------------------------------------------------------------*/\nint https_checkfile (char *urltype, char *infile, char *outfile1)\n{\n  /* set default  */\n  strcpy(urltype,\"https://\");\n  \n  if (strlen(outfile1))\n  {\n    /* don't copy the \"file://\" prefix, if present.  */\n    if (!strncmp(outfile1, \"file://\", 7) ) {\n      strcpy(netoutfile,outfile1+7);\n    } else {\n      strcpy(netoutfile,outfile1);\n    }\n    \n    if (!strncmp(outfile1, \"mem:\", 4))\n       strcpy(urltype,\"httpsmem://\");\n    else       \n       strcpy(urltype,\"httpsfile://\");\n  }\n\n   return 0;\n}\n\n/*--------------------------------------------------------------------------*/\nint ftps_checkfile (char *urltype, char *infile, char *outfile1)\n{\n   strcpy(urltype,\"ftps://\");\n   if (strlen(outfile1))\n   {\n     /* don't copy the \"file://\" prefix, if present.  */\n     if (!strncmp(outfile1, \"file://\", 7) ) {\n       strcpy(netoutfile,outfile1+7);\n     } else {\n       strcpy(netoutfile,outfile1);\n     }\n\n     if (!strncmp(outfile1, \"mem:\", 4))\n        strcpy(urltype,\"ftpsmem://\");\n     else\n     {\n        if (strstr(outfile1,\".gz\") || strstr(outfile1,\".Z\"))\n        {\n           /* Note that for Curl dependent handlers, we can't check\n           at this point if infile will have a .gz or .Z appended. \n           If it does not, the ftpscompress 'open' handler will fail.*/\n           strcpy(urltype,\"ftpscompress://\");\n        }\n        else\n           strcpy(urltype,\"ftpsfile://\");\n     }\n   }\n   return 0;\n}\n\n/*--------------------------------------------------------------------------*/\nint ftp_checkfile (char *urltype, char *infile, char *outfile1)\n{\n  char newinfile[MAXLEN];\n  FILE *ftpfile;\n  FILE *command;\n  int sock;\n  int foundfile = 0;\n  int status=0;\n\n /* Small helper functions to set the netoutfile static string */\n\n  /* default to ftp://  if no outfile specified */\n  strcpy(urltype,\"ftp://\"); \n\n if (!strstr(infile,\".gz\") && (!strstr(infile,\".Z\"))) {\n    /* The infile string does not contain the name of a compressed file.  */\n    /* Fisrt, look for a .gz compressed version of the file. */\n      \n    if (strlen(infile)+3 > MAXLEN-1)\n    {\n       return URL_PARSE_ERROR;\n    }\n    strcpy(newinfile,infile);\n    strcat(newinfile,\".gz\");\n \n    /* look for .gz version of the file */\n    status = ftp_file_exist(newinfile);\n    if (status > 0) {\n      foundfile = 1;\n      if (strlen(newinfile) > FLEN_FILENAME-1)\n         return URL_PARSE_ERROR;\n      strcpy(infile,newinfile);\n    }\n    else if (status < 0)\n    {\n       /* Server is demanding an SSL connection. \n          Change urltype and exit. */\n       ftps_checkfile(urltype, infile, outfile1);\n       return 0;\n    }\n\n    if (!foundfile) {\n      if (strlen(infile)+2 > MAXLEN-1)\n      {\n         return URL_PARSE_ERROR;\n      }\n      strcpy(newinfile,infile);\n      strcat(newinfile,\".Z\");\n \n    /* look for .Z version of the file */\n      if (ftp_file_exist(newinfile)) {\n        foundfile = 1;\n        if (strlen(newinfile) > FLEN_FILENAME-1)\n           return URL_PARSE_ERROR;\n        strcpy(infile,newinfile);\n      }\n    }\n  }\n\n  if (!foundfile) {\n      strcpy(newinfile,infile);\n \n      /* look for the base file */\n      status = ftp_file_exist(newinfile);\n      if (status > 0) {\n        foundfile = 1;\n        if (strlen(newinfile) > FLEN_FILENAME-1)\n           return URL_PARSE_ERROR;\n        strcpy(infile,newinfile);\n      }\n      else if (status < 0)\n      {\n         /* Server is demanding an SSL connection. \n            Change urltype and exit. */\n         ftps_checkfile(urltype, infile, outfile1);\n         return 0;\n      }\n  }\n\n  if (!foundfile) {\n     return (FILE_NOT_OPENED);\n  }\n\n  if (strlen(outfile1)) {\n    /* there is an output file;  might need to modify the urltype */\n\n    /* don't copy the \"file://\" prefix, if present.  */\n    if (!strncmp(outfile1, \"file://\", 7) )\n       strcpy(netoutfile,outfile1+7);\n    else\n       strcpy(netoutfile,outfile1);\n\n    if (!strncmp(outfile1, \"mem:\", 4) )  {\n       /* copy the file to memory, with READ and WRITE access \n          In this case, it makes no difference whether the ftp file\n          and or the output file are compressed or not.   */\n\n       strcpy(urltype, \"ftpmem://\");  /* use special driver */\n       return 0;\n    }\n \n    if (strstr(infile,\".gz\") || (strstr(infile,\".Z\"))) {\n\t/* input file is compressed */\n\tif (strstr(outfile1,\".gz\") || (strstr(outfile1,\".Z\"))) {\n\t  strcpy(urltype,\"ftpcompress://\");\n\t} else {\n\t  strcpy(urltype,\"ftpfile://\");\n\t}\n    } else {\n\tstrcpy(urltype,\"ftpfile://\");\n    } \n  } \n  return 0;\n}\n/*--------------------------------------------------------------------------*/\n/* A small helper function to wait for a particular status on the ftp \n   connectino */\nstatic int ftp_status(FILE *ftp, char *statusstr)\n{\n  /* read through until we find a string beginning with statusstr */\n  /* This needs a timeout */\n  \n  /* Modified 2/19 to return the numerical value of the returned status when\n     it differs from the requested status. */\n\n  char recbuf[MAXLEN], errorstr[SHORTLEN];\n  int len, ftpcode=0;\n\n  len = strlen(statusstr);\n  while (1) {\n\n    if (!(fgets(recbuf,MAXLEN,ftp))) {\n      snprintf(errorstr,SHORTLEN,\"ERROR: ftp_status wants %s but fgets returned 0\",statusstr);\n      ffpmsg(errorstr);\n      return 1; /* error reading */\n    }\n\n    recbuf[len] = '\\0'; /* make it short */\n    if (!strcmp(recbuf,statusstr)) {\n      return 0; /* we're ok */\n    }\n    if (recbuf[0] > '3') {\n      /* oh well, some sort of error. */\n      snprintf(errorstr,SHORTLEN,\"ERROR ftp_status wants %s but got %s\", statusstr, recbuf);\n      ffpmsg(errorstr);\n      /* Return the numerical code, if string can be converted to int.\n         But must not return 0 from here. */\n      ftpcode = atoi(recbuf);\n      return ftpcode ? ftpcode : 1; \n    }\n    snprintf(errorstr,SHORTLEN,\"ERROR ftp_status wants %s but got unexpected %s\", statusstr, recbuf);\n    ffpmsg(errorstr);\n  }\n}\n\n/*\n *----------------------------------------------------------------------\n *\n * CreateSocketAddress --\n *\n *\tThis function initializes a sockaddr structure for a host and port.\n *\n * Results:\n *\t1 if the host was valid, 0 if the host could not be converted to\n *\tan IP address.\n *\n * Side effects:\n *\tFills in the *sockaddrPtr structure.\n *\n *----------------------------------------------------------------------\n */\n\nstatic int\nCreateSocketAddress(\n    struct sockaddr_in *sockaddrPtr,\t/* Socket address */\n    char *host,\t\t\t\t/* Host.  NULL implies INADDR_ANY */\n    int port)\t\t\t\t/* Port number */\n{\n    struct hostent *hostent;\t\t/* Host database entry */\n    struct in_addr addr;\t\t/* For 64/32 bit madness */\n    char localhost[MAXLEN];\n\n    strcpy(localhost,host);\n\n    memset((void *) sockaddrPtr, '\\0', sizeof(struct sockaddr_in));\n    sockaddrPtr->sin_family = AF_INET;\n    sockaddrPtr->sin_port = htons((unsigned short) (port & 0xFFFF));\n    if (host == NULL) {\n\taddr.s_addr = INADDR_ANY;\n    } else {\n        addr.s_addr = inet_addr(localhost);\n        if (addr.s_addr == 0xFFFFFFFF) {\n            hostent = gethostbyname(localhost);\n            if (hostent != NULL) {\n                memcpy((void *) &addr,\n                        (void *) hostent->h_addr_list[0],\n                        (size_t) hostent->h_length);\n            } else {\n#ifdef\tEHOSTUNREACH\n                errno = EHOSTUNREACH;\n#else\n#ifdef ENXIO\n                errno = ENXIO;\n#endif\n#endif\n                return 0;\t/* error */\n            }\n        }\n    }\n        \n    /*\n     * NOTE: On 64 bit machines the assignment below is rumored to not\n     * do the right thing. Please report errors related to this if you\n     * observe incorrect behavior on 64 bit machines such as DEC Alphas.\n     * Should we modify this code to do an explicit memcpy?\n     */\n\n    sockaddrPtr->sin_addr.s_addr = addr.s_addr;\n    return 1;\t/* Success. */\n}\n\n/* Signal handler for timeouts */\n\nstatic void signal_handler(int sig) {\n\n  switch (sig) {\n  case SIGALRM:    /* process for alarm */\n    longjmp(env,sig);\n    \n  default: {\n      /* Hmm, shouldn't have happend */\n      exit(sig);\n    }\n  }\n}\n\n/**************************************************************/\n\n/* Root driver */\n\n/*--------------------------------------------------------------------------*/\nint root_init(void)\n{\n    int ii;\n\n    for (ii = 0; ii < NMAXFILES; ii++) /* initialize all empty slots in table */\n    {\n       handleTable[ii].sock = 0;\n       handleTable[ii].currentpos = 0;\n    }\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint root_setoptions(int options)\n{\n  /* do something with the options argument, to stop compiler warning */\n  options = 0;\n  return(options);\n}\n/*--------------------------------------------------------------------------*/\nint root_getoptions(int *options)\n{\n  *options = 0;\n  return(0);\n}\n/*--------------------------------------------------------------------------*/\nint root_getversion(int *version)\n{\n    *version = 10;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint root_shutdown(void)\n{\n  return(0);\n}\n/*--------------------------------------------------------------------------*/\nint root_open(char *url, int rwmode, int *handle)\n{\n    int ii, status;\n    int sock;\n\n    *handle = -1;\n    for (ii = 0; ii < NMAXFILES; ii++)  /* find empty slot in table */\n    {\n        if (handleTable[ii].sock == 0)\n        {\n            *handle = ii;\n            break;\n        }\n    }\n\n    if (*handle == -1)\n       return(TOO_MANY_FILES);    /* too many files opened */\n\n    /*open the file */\n    if (rwmode) {\n      status = root_openfile(url, \"update\", &sock);\n    } else {\n      status = root_openfile(url, \"read\", &sock);\n    }\n    if (status)\n      return(status);\n    \n    handleTable[ii].sock = sock;\n    handleTable[ii].currentpos = 0;\n    \n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint root_create(char *filename, int *handle)\n{\n    int ii, status;\n    int sock;\n\n    *handle = -1;\n    for (ii = 0; ii < NMAXFILES; ii++)  /* find empty slot in table */\n    {\n        if (handleTable[ii].sock == 0)\n        {\n            *handle = ii;\n            break;\n        }\n    }\n\n    if (*handle == -1)\n       return(TOO_MANY_FILES);    /* too many files opened */\n\n    /*open the file */\n    status = root_openfile(filename, \"create\", &sock);\n\n    if (status) {\n      ffpmsg(\"Unable to create file\");\n      return(status);\n    }\n    \n    handleTable[ii].sock = sock;\n    handleTable[ii].currentpos = 0;\n    \n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint root_size(int handle, LONGLONG *filesize)\n/*\n  return the size of the file in bytes\n*/\n{\n\n  int sock;\n  int offset;\n  int status;\n  int op;\n\n  sock = handleTable[handle].sock;\n\n  status = root_send_buffer(sock,ROOTD_STAT,NULL,0);\n  status = root_recv_buffer(sock,&op,(char *)&offset, 4);\n  *filesize = (LONGLONG) ntohl(offset);\n  \n  return(0);\n}\n/*--------------------------------------------------------------------------*/\nint root_close(int handle)\n/*\n  close the file\n*/\n{\n\n  int status;\n  int sock;\n\n  sock = handleTable[handle].sock;\n  status = root_send_buffer(sock,ROOTD_CLOSE,NULL,0);\n  close(sock);\n  handleTable[handle].sock = 0;\n  return(0);\n}\n/*--------------------------------------------------------------------------*/\nint root_flush(int handle)\n/*\n  flush the file\n*/\n{\n  int status;\n  int sock;\n\n  sock = handleTable[handle].sock;\n  status = root_send_buffer(sock,ROOTD_FLUSH,NULL,0);\n  return(0);\n}\n/*--------------------------------------------------------------------------*/\nint root_seek(int handle, LONGLONG offset)\n/*\n  seek to position relative to start of the file\n*/\n{\n  handleTable[handle].currentpos = offset;\n  return(0);\n}\n/*--------------------------------------------------------------------------*/\nint root_read(int hdl, void *buffer, long nbytes)\n/*\n  read bytes from the current position in the file\n*/\n{\n  char msg[SHORTLEN];\n  int op;\n  int status;\n  int astat;\n\n  /* we presume here that the file position will never be > 2**31 = 2.1GB */\n  snprintf(msg,SHORTLEN,\"%ld %ld \",(long) handleTable[hdl].currentpos,nbytes);\n  status = root_send_buffer(handleTable[hdl].sock,ROOTD_GET,msg,strlen(msg));\n  if ((unsigned) status != strlen(msg)) {\n    return (READ_ERROR);\n  }\n  astat = 0;\n  status = root_recv_buffer(handleTable[hdl].sock,&op,(char *) &astat,4);\n  if (astat != 0) {\n    return (READ_ERROR);\n  }\n\n  status = NET_RecvRaw(handleTable[hdl].sock,buffer,nbytes);\n  if (status != nbytes) {\n    return (READ_ERROR);\n  }\n  handleTable[hdl].currentpos += nbytes;\n\n  return(0);\n}\n/*--------------------------------------------------------------------------*/\nint root_write(int hdl, void *buffer, long nbytes)\n/*\n  write bytes at the current position in the file\n*/\n{\n\n  char msg[SHORTLEN];\n  int len;\n  int sock;\n  int status;\n  int astat;\n  int op;\n\n  sock = handleTable[hdl].sock;\n  /* we presume here that the file position will never be > 2**31 = 2.1GB */\n  snprintf(msg,SHORTLEN,\"%ld %ld \",(long) handleTable[hdl].currentpos,nbytes);\n\n  len = strlen(msg);\n  status = root_send_buffer(sock,ROOTD_PUT,msg,len+1);\n  if (status != len+1) {\n    return (WRITE_ERROR);\n  }\n  status = NET_SendRaw(sock,buffer,nbytes,NET_DEFAULT);\n  if (status != nbytes) {\n    return (WRITE_ERROR);\n  }\n  astat = 0;\n  status = root_recv_buffer(handleTable[hdl].sock,&op,(char *) &astat,4);\n\n  if (astat != 0) {\n    return (WRITE_ERROR);\n  }\n  handleTable[hdl].currentpos += nbytes;\n  return(0);\n}\n\n/*--------------------------------------------------------------------------*/\nint root_openfile(char *url, char *rwmode, int *sock)\n     /*\n       lowest level routine to physically open a root file\n     */\n{\n  \n  int status;\n  char recbuf[MAXLEN];\n  char errorstr[MAXLEN];\n  char proto[SHORTLEN];\n  char host[SHORTLEN];\n  char fn[MAXLEN];\n  char turl[MAXLEN];\n  int port;\n  int op;\n  int ii;\n  int authstat;\n  \n  \n  /* Parse the URL apart again */\n  if (strlen(url)+7 > MAXLEN-1)\n  {\n     ffpmsg(\"Error: url too long\");\n     return(FILE_NOT_OPENED);\n  }\n  strcpy(turl,\"root://\");\n  strcat(turl,url);\n  if (NET_ParseUrl(turl,proto,host,&port,fn)) {\n    snprintf(errorstr,MAXLEN,\"URL Parse Error (root_open) %s\",url);\n    ffpmsg(errorstr);\n    return (FILE_NOT_OPENED);\n  }\n  \n  /* Connect to the remote host */\n  *sock = NET_TcpConnect(host,port);\n  if (*sock < 0) {\n    ffpmsg(\"Couldn't connect to host (root_openfile)\");\n    return (FILE_NOT_OPENED);\n  }\n  \n  /* get the username */\n  if (NULL != getenv(\"ROOTUSERNAME\")) {\n    if (strlen(getenv(\"ROOTUSERNAME\")) > MAXLEN-1)\n    {\n       ffpmsg(\"root user name too long (root_openfile)\");\n       return (FILE_NOT_OPENED);\n    }\n    strcpy(recbuf,getenv(\"ROOTUSERNAME\"));\n  } else {\n    printf(\"Username: \");\n    fgets(recbuf,MAXLEN,stdin);\n    recbuf[strlen(recbuf)-1] = '\\0';\n  }\n  \n  status = root_send_buffer(*sock, ROOTD_USER, recbuf,strlen(recbuf));\n  if (status < 0) {\n    ffpmsg(\"error talking to remote system on username \");\n    return (FILE_NOT_OPENED);\n  }\n  \n  status = root_recv_buffer(*sock,&op,(char *)&authstat,4);\n  if (!status) {\n    ffpmsg(\"error talking to remote system on username\");\n    return (FILE_NOT_OPENED);\n  }\n  \n  if (op != ROOTD_AUTH) {\n    ffpmsg(\"ERROR on ROOTD_USER\");\n    ffpmsg(recbuf);\n    return (FILE_NOT_OPENED);\n  }\n  \n\n  /* now the password */\n  if (NULL != getenv(\"ROOTPASSWORD\")) {\n    if (strlen(getenv(\"ROOTPASSWORD\")) > MAXLEN-1)\n    {\n       ffpmsg(\"root password too long (root_openfile)\");\n       return (FILE_NOT_OPENED);\n    }\n    strcpy(recbuf,getenv(\"ROOTPASSWORD\"));\n  } else {\n    printf(\"Password: \");\n    fgets(recbuf,MAXLEN,stdin);\n    recbuf[strlen(recbuf)-1] = '\\0';\n  }\n  /* ones complement the password */\n  for (ii=0;(unsigned) ii<strlen(recbuf);ii++) {\n    recbuf[ii] = ~recbuf[ii];\n  }\n  \n  status = root_send_buffer(*sock, ROOTD_PASS, recbuf, strlen(recbuf));\n  if (status < 0) {\n    ffpmsg(\"error talking to remote system sending password\");\n    return (FILE_NOT_OPENED);\n  }\n  \n  status = root_recv_buffer(*sock,&op,(char *)&authstat,4);\n  if (status < 0) {\n    ffpmsg(\"error talking to remote system acking password\");\n    return (FILE_NOT_OPENED);\n  }\n  \n  if (op != ROOTD_AUTH) {\n    ffpmsg(\"ERROR on ROOTD_PASS\");\n    ffpmsg(recbuf);\n    return (FILE_NOT_OPENED);\n  }\n  \n  /* now the file open request */\n  if (strlen(fn)+strlen(rwmode)+1 > MAXLEN-1)\n  {\n     ffpmsg(\"root file name too long (root_openfile)\");\n     return (FILE_NOT_OPENED);\n  }\n  strcpy(recbuf,fn);\n  strcat(recbuf,\" \");\n  strcat(recbuf,rwmode);\n\n  status = root_send_buffer(*sock, ROOTD_OPEN, recbuf, strlen(recbuf));\n  if (status < 0) {\n    ffpmsg(\"error talking to remote system on open \");\n    return (FILE_NOT_OPENED);\n  }\n\n  status = root_recv_buffer(*sock,&op,(char *)&authstat,4);\n  if (status < 0) {\n    ffpmsg(\"error talking to remote system on open\");\n    return (FILE_NOT_OPENED);\n  }\n  \n  if ((op != ROOTD_OPEN) && (authstat != 0)) {\n    ffpmsg(\"ERROR on ROOTD_OPEN\");\n    ffpmsg(recbuf);\n    return (FILE_NOT_OPENED);\n  }\n\n  return 0;\n\n}\n\nstatic int root_send_buffer(int sock, int op, char *buffer, int buflen)\n{\n  /* send a buffer, the form is\n     <len>\n     <op>\n     <buffer>\n\n     <len> includes the 4 bytes for the op, the length bytes (4) are implicit\n\n\n     if buffer is null don't send it, not everything needs something sent */\n\n  int len;\n  int status;\n\n  int hdr[2];\n\n  len = 4;\n\n  if (buffer != NULL) {\n    len += buflen;\n  }\n  \n  hdr[0] = htonl(len);\n  hdr[1] = htonl(op);\n\n  status = NET_SendRaw(sock,hdr,sizeof(hdr),NET_DEFAULT);\n  if (status < 0) {\n    return status;\n  }\n  if (buffer != NULL) {\n    status = NET_SendRaw(sock,buffer,buflen,NET_DEFAULT);\n  }\n  return status;\n}\n  \nstatic int root_recv_buffer(int sock, int *op, char *buffer, int buflen)\n{\n  /* recv a buffer, the form is\n     <len>\n     <op>\n     <buffer>\n  */\n\n  int recv1 = 0;\n  int len;\n  int status;\n  char recbuf[MAXLEN];\n\n  status = NET_RecvRaw(sock,&len,4);\n\n  if (status < 0) {\n    return status;\n  }\n  recv1 += status;\n\n  len = ntohl(len);\n\n  /* ok, have the length, recive the operation */\n  len -= 4;\n  status = NET_RecvRaw(sock,op,4);\n  if (status < 0) {\n    return status;\n  }\n\n  recv1 += status;\n\n  *op = ntohl(*op);\n  \n  if (len > MAXLEN) {\n    len = MAXLEN;\n  }\n\n  if (len > 0) { /* Get the rest of the message */\n    status = NET_RecvRaw(sock,recbuf,len);\n    if (len > buflen) {\n      len = buflen;\n    }\n    memcpy(buffer,recbuf,len);\n    if (status < 0) {\n      return status;\n    }\n  } \n\n  recv1 += status;\n  return recv1;\n\n}\n\n/*****************************************************************************/\n/*\n  Encode a string into MIME Base64 format string\n*/\n\n\nstatic int encode64(unsigned s_len, char *src, unsigned d_len, char *dst) {\n\n  static char base64[] = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n\"abcdefghijklmnopqrstuvwxyz\"\n\"0123456789\"\n\"+/\";\n\n  unsigned triad;\n\n\n  for (triad = 0; triad < s_len; triad += 3) {\n    unsigned long int sr;\n    unsigned byte;\n\n    for (byte = 0; (byte<3) && (triad+byte<s_len); ++byte) {\n      sr <<= 8;\n      sr |= (*(src+triad+byte) & 0xff);\n    }\n\n    /* shift left to next 6 bit alignment*/\n    sr <<= (6-((8*byte)%6))%6;\n\n    if (d_len < 4)\n      return 1;\n\n    *(dst+0) = *(dst+1) = *(dst+2) = *(dst+3) = '=';\n    switch(byte) {\n    case 3:\n      *(dst+3) = base64[sr&0x3f];\n      sr >>= 6;\n    case 2:\n      *(dst+2) = base64[sr&0x3f];\n      sr >>= 6;\n    case 1:\n      *(dst+1) = base64[sr&0x3f];\n      sr >>= 6;\n      *(dst+0) = base64[sr&0x3f];\n    }\n    dst += 4;\n    d_len -= 4;\n  }\n\n  *dst = '\\0';\n  return 0;\n}\n\n#endif\n"},{"id":16688,"name":"eval_defs.h","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n#if defined(__sgi) || defined(__hpux)\n#include <alloca.h>\n#endif\n#ifdef sparc\n#include <malloc.h>\n#endif\n#include \"fitsio2.h\"\n\n#define MAXDIMS       5\n#define MAXSUBS      10\n#define MAXVARNAME   80\n#define CONST_OP  -1000\n#define pERROR       -1\n#define MAX_STRLEN  256\n#define MAX_STRLEN_S \"255\"\n\n#ifndef FFBISON\n#include \"eval_tab.h\"\n#endif\n\n\ntypedef struct {\n                  char   name[MAXVARNAME+1];\n                  int    type;\n                  long   nelem;\n                  int    naxis;\n                  long   naxes[MAXDIMS];\n                  char   *undef;\n                  void   *data;\n                                } DataInfo;\n\ntypedef struct {\n                  long   nelem;\n                  int    naxis;\n                  long   naxes[MAXDIMS];\n                  char   *undef;\n                  union {\n                         double dbl;\n                         long   lng;\n                         char   log;\n                         char   str[MAX_STRLEN];\n                         double *dblptr;\n                         long   *lngptr;\n                         char   *logptr;\n                         char   **strptr;\n                         void   *ptr;\n\t\t  } data;\n                                } lval;\n\ntypedef struct Node {\n                  int    operation;\n                  void   (*DoOp)(struct Node *this);\n                  int    nSubNodes;\n                  int    SubNodes[MAXSUBS];\n                  int    type;\n                  lval   value;\n                                } Node;\n\ntypedef struct {\n                  fitsfile    *def_fptr;\n                  int         (*getData)( char *dataName, void *dataValue );\n                  int         (*loadData)( int varNum, long fRow, long nRows,\n\t\t\t\t\t   void *data, char *undef );\n\n                  int         compressed;\n                  int         timeCol;\n                  int         parCol;\n                  int         valCol;\n\n                  char        *expr;\n                  int         index;\n                  int         is_eobuf;\n\n                  Node        *Nodes;\n                  int         nNodes;\n                  int         nNodesAlloc;\n                  int         resultNode;\n                  \n                  long        firstRow;\n                  long        nRows;\n\n                  int         nCols;\n                  iteratorCol *colData;\n                  DataInfo    *varData;\n                  PixelFilter *pixFilter;\n\n                  long        firstDataRow;\n                  long        nDataRows;\n                  long        totalRows;\n\n                  int         datatype;\n                  int         hdutype;\n\n                  int         status;\n                                } ParseData;\n\ntypedef enum {\n                  rnd_fct = 1001,\n                  sum_fct,\n                  nelem_fct,\n                  sin_fct,\n                  cos_fct,\n                  tan_fct,\n                  asin_fct,\n                  acos_fct,\n                  atan_fct,\n                  sinh_fct,\n                  cosh_fct,\n                  tanh_fct,\n                  exp_fct,\n                  log_fct,\n                  log10_fct,\n                  sqrt_fct,\n                  abs_fct,\n                  atan2_fct,\n                  ceil_fct,\n                  floor_fct,\n                  round_fct,\n\t\t  min1_fct,\n\t\t  min2_fct,\n\t\t  max1_fct,\n\t\t  max2_fct,\n                  near_fct,\n                  circle_fct,\n                  box_fct,\n                  elps_fct,\n                  isnull_fct,\n                  defnull_fct,\n                  gtifilt_fct,\n                  regfilt_fct,\n                  ifthenelse_fct,\n                  row_fct,\n                  null_fct,\n\t\t  median_fct,\n\t\t  average_fct,\n\t\t  stddev_fct,\n\t\t  nonnull_fct,\n\t\t  angsep_fct,\n\t\t  gasrnd_fct,\n\t\t  poirnd_fct,\n\t\t  strmid_fct,\n\t\t  strpos_fct,\n\t\t  setnull_fct,\n\t\t  gtiover_fct\n                                } funcOp;\n\nextern ParseData gParse;\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n   int  ffparse(void);\n   int  fflex(void);\n   void ffrestart(FILE*);\n\n   void Evaluate_Parser( long firstRow, long nRows );\n\n#ifdef __cplusplus\n    }\n#endif\n"},{"id":16689,"name":"putcolk.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, putcolk.c, contains routines that write data elements to    */\n/*  a FITS image or table, with 'int' datatype.                            */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <limits.h>\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffpprk( fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            int   *array,    /* I - array of values that are written        */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n    int nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_pixels(fptr, TINT, firstelem, nelem,\n            0, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpclk(fptr, 2, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffppnk( fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            int   *array,    /* I - array of values that are written        */\n            int   nulval,    /* I - undefined pixel value                   */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).  Any array values\n  that are equal to the value of nulval will be replaced with the null\n  pixel value that is appropriate for this column.\n*/\n{\n    long row;\n    int nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        nullvalue = nulval;  /* set local variable */\n        fits_write_compressed_pixels(fptr, TINT, firstelem, nelem,\n            1, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcnk(fptr, 2, row, firstelem, nelem, array, nulval, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp2dk(fitsfile *fptr,   /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           int   *array,     /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    /* call the 3D writing routine, with the 3rd dimension = 1 */\n\n    ffp3dk(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp3dk(fitsfile *fptr,   /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  nrows,      /* I - number of rows in each plane of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           LONGLONG  naxis3,     /* I - FITS image NAXIS3 value               */\n           int   *array,     /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 3-D cube of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    long tablerow, ii, jj;\n    long fpixel[3]= {1,1,1}, lpixel[3];\n    LONGLONG nfits, narray;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n           \n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n        lpixel[0] = (long) ncols;\n        lpixel[1] = (long) nrows;\n        lpixel[2] = (long) naxis3;\n       \n        fits_write_compressed_img(fptr, TINT, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n      /* all the image pixels are contiguous, so write all at once */\n      ffpclk(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status);\n      return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to write to */\n    narray = 0;  /* next pixel in input array to be written */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* writing naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffpclk(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0)\n         return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpssk(fitsfile *fptr,   /* I - FITS file pointer                       */\n           long  group,      /* I - group to write(1 = 1st group)           */\n           long  naxis,      /* I - number of data axes in array            */\n           long  *naxes,     /* I - size of each FITS axis                  */\n           long  *fpixel,    /* I - 1st pixel in each axis to write (1=1st) */\n           long  *lpixel,    /* I - last pixel in each axis to write        */\n           int *array,      /* I - array to be written                     */\n           int  *status)     /* IO - error status                           */\n/*\n  Write a subsection of pixels to the primary array or image.\n  A subsection is defined to be any contiguous rectangular\n  array of pixels within the n-dimensional FITS data file.\n  Data conversion and scaling will be performed if necessary \n  (e.g, if the datatype of the FITS array is not the same as\n  the array being written).\n*/\n{\n    long tablerow;\n    LONGLONG fpix[7], dimen[7], astart, pstart;\n    LONGLONG off2, off3, off4, off5, off6, off7;\n    LONGLONG st10, st20, st30, st40, st50, st60, st70;\n    LONGLONG st1, st2, st3, st4, st5, st6, st7;\n    long ii, i1, i2, i3, i4, i5, i6, i7, irange[7];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_img(fptr, TINT, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    if (naxis < 1 || naxis > 7)\n      return(*status = BAD_DIMEN);\n\n    tablerow=maxvalue(1,group);\n\n     /* calculate the size and number of loops to perform in each dimension */\n    for (ii = 0; ii < 7; ii++)\n    {\n      fpix[ii]=1;\n      irange[ii]=1;\n      dimen[ii]=1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {    \n      fpix[ii]=fpixel[ii];\n      irange[ii]=lpixel[ii]-fpixel[ii]+1;\n      dimen[ii]=naxes[ii];\n    }\n\n    i1=irange[0];\n\n    /* compute the pixel offset between each dimension */\n    off2 =     dimen[0];\n    off3 = off2 * dimen[1];\n    off4 = off3 * dimen[2];\n    off5 = off4 * dimen[3];\n    off6 = off5 * dimen[4];\n    off7 = off6 * dimen[5];\n\n    st10 = fpix[0];\n    st20 = (fpix[1] - 1) * off2;\n    st30 = (fpix[2] - 1) * off3;\n    st40 = (fpix[3] - 1) * off4;\n    st50 = (fpix[4] - 1) * off5;\n    st60 = (fpix[5] - 1) * off6;\n    st70 = (fpix[6] - 1) * off7;\n\n    /* store the initial offset in each dimension */\n    st1 = st10;\n    st2 = st20;\n    st3 = st30;\n    st4 = st40;\n    st5 = st50;\n    st6 = st60;\n    st7 = st70;\n\n    astart = 0;\n\n    for (i7 = 0; i7 < irange[6]; i7++)\n    {\n     for (i6 = 0; i6 < irange[5]; i6++)\n     {\n      for (i5 = 0; i5 < irange[4]; i5++)\n      {\n       for (i4 = 0; i4 < irange[3]; i4++)\n       {\n        for (i3 = 0; i3 < irange[2]; i3++)\n        {\n         pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7;\n\n         for (i2 = 0; i2 < irange[1]; i2++)\n         {\n           if (ffpclk(fptr, 2, tablerow, pstart, i1, &array[astart],\n              status) > 0)\n              return(*status);\n\n           astart += i1;\n           pstart += off2;\n         }\n         st2 = st20;\n         st3 = st3+off3;    \n        }\n        st3 = st30;\n        st4 = st4+off4;\n       }\n       st4 = st40;\n       st5 = st5+off5;\n      }\n      st5 = st50;\n      st6 = st6+off6;\n     }\n     st6 = st60;\n     st7 = st7+off7;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpgpk( fitsfile *fptr,   /* I - FITS file pointer                      */\n            long  group,      /* I - group to write(1 = 1st group)          */\n            long  firstelem,  /* I - first vector element to write(1 = 1st) */\n            long  nelem,      /* I - number of values to write              */\n            int   *array,     /* I - array of values that are written       */\n            int  *status)     /* IO - error status                          */\n/*\n  Write an array of group parameters to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffpclk(fptr, 1L, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpclk( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            int   *array,    /* I - array of values to write                */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer to a virtual column in a 1 or more grouped FITS primary\n  array.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    int tcode, maxelem2, hdutype, writeraw;\n    long twidth, incre;\n    long ntodo;\n    LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull, maxelem;\n    double scale, zero;\n    char tform[20], cform[20];\n    char message[FLEN_ERRMSG];\n\n    char snull[20];   /*  the FITS null value  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* call the 'short' or 'long' version of this routine, if possible */\n    if (sizeof(int) == sizeof(short))\n        ffpcli(fptr, colnum, firstrow, firstelem, nelem, \n              (short *) array, status);\n    else if (sizeof(int) == sizeof(long))\n        ffpclj(fptr, colnum, firstrow, firstelem, nelem, \n              (long *) array, status);\n    else\n    {\n    /*\n      This is a special case: sizeof(int) is not equal to sizeof(short) or\n      sizeof(long).  This occurs on Alpha OSF systems where short = 2 bytes,\n      int = 4 bytes, and long = 8 bytes.\n    */\n\n    buffer = cbuff;\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem2, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n    maxelem = maxelem2;\n\n    if (tcode == TSTRING)   \n         ffcfmt(tform, cform);     /* derive C format for writing strings */\n\n    /*\n       if there is no scaling and the native machine format is not byteswapped\n       then we can simply write the raw data bytes into the FITS file if the\n       datatype of the FITS column is the same as the input values.  Otherwise\n       we must convert the raw values into the scaled and/or machine dependent\n       format in a temporary buffer that has been allocated for this purpose.\n    */\n    if (scale == 1. && zero == 0. && \n       MACHINE == NATIVE && tcode == TLONG)\n    {\n        writeraw = 1;\n        if (nelem < (LONGLONG)INT32_MAX) {\n            maxelem = nelem;\n        } else {\n            maxelem = INT32_MAX/4;\n        }\n    }\n    else\n        writeraw = 0;\n\n    /*---------------------------------------------------------------------*/\n    /*  Now write the pixels to the FITS column.                           */\n    /*  First call the ffXXfYY routine to  (1) convert the datatype        */\n    /*  if necessary, and (2) scale the values by the FITS TSCALn and      */\n    /*  TZEROn linear scaling parameters into a temporary buffer.          */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to write  */\n    next = 0;                 /* next element in array to be written  */\n    rownum = 0;               /* row number, relative to firstrow     */\n\n    while (remain)\n    {\n        /* limit the number of pixels to process a one time to the number that\n           will fit in the buffer space or to the number of pixels that remain\n           in the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);      \n        ntodo = (long) minvalue(ntodo, (repeat - elemnum));\n\n        wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre);\n\n        ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */\n\n        switch (tcode) \n        {\n            case (TLONG):\n              if (writeraw)\n              {\n                /* write raw input bytes without conversion */\n                ffpi4b(fptr, ntodo, incre, (INT32BIT *) &array[next], status);\n              }\n              else\n              {\n                /* convert the raw data before writing to FITS file */\n                ffintfi4(&array[next], ntodo, scale, zero,\n                        (INT32BIT *) buffer, status);\n                ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status);\n              }\n\n                break;\n\n            case (TLONGLONG):\n\n                ffintfi8(&array[next], ntodo, scale, zero,\n                        (LONGLONG *) buffer, status);\n                ffpi8b(fptr, ntodo, incre, (long *) buffer, status);\n                break;\n\n            case (TBYTE):\n \n                ffintfi1(&array[next], ntodo, scale, zero,\n                        (unsigned char *) buffer, status);\n                ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status);\n                break;\n\n            case (TSHORT):\n\n                ffintfi2(&array[next], ntodo, scale, zero,\n                        (short *) buffer, status);\n                ffpi2b(fptr, ntodo, incre, (short *) buffer, status);\n                break;\n\n            case (TFLOAT):\n\n                ffintfr4(&array[next], ntodo, scale, zero,\n                        (float *) buffer, status);\n                ffpr4b(fptr, ntodo, incre, (float *) buffer, status);\n                break;\n\n            case (TDOUBLE):\n                ffintfr8(&array[next], ntodo, scale, zero,\n                       (double *) buffer, status);\n                ffpr8b(fptr, ntodo, incre, (double *) buffer, status);\n                break;\n\n            case (TSTRING):  /* numerical column in an ASCII table */\n\n                if (cform[1] != 's')  /*  \"%s\" format is a string */\n                {\n                  ffintfstr(&array[next], ntodo, scale, zero, cform,\n                          twidth, (char *) buffer, status);\n\n                  if (incre == twidth)    /* contiguous bytes */\n                     ffpbyt(fptr, ntodo * twidth, buffer, status);\n                  else\n                     ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                            status);\n\n                  break;\n                }\n                /* can't write to string column, so fall thru to default: */\n\n            default:  /*  error trap  */\n                snprintf(message, FLEN_ERRMSG,\n                     \"Cannot write numbers to column %d which has format %s\",\n                      colnum,tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous write operation */\n        {\n          snprintf(message,FLEN_ERRMSG,\n          \"Error writing elements %.0f thru %.0f of input data array (ffpclk).\",\n              (double) (next+1), (double) (next+ntodo));\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum += ntodo;\n            if (elemnum == repeat)  /* completed a row; start on next row */\n            {\n                elemnum = 0;\n                rownum++;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while writing FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    }   /* end of Dec ALPHA special case */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcnk( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            int   *array,    /* I - array of values to write                */\n            int    nulvalue, /* I - value used to flag undefined pixels     */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of elements to the specified column of a table.  Any input\n  pixels equal to the value of nulvalue will be replaced by the appropriate\n  null value in the output FITS file. \n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary\n*/\n{\n    tcolumn *colptr;\n    LONGLONG  ngood = 0, nbad = 0, ii;\n    LONGLONG repeat, first, fstelm, fstrow;\n    int tcode, overflow = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n    }\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n\n    tcode  = colptr->tdatatype;\n\n    if (tcode > 0)\n       repeat = colptr->trepeat;  /* repeat count for this column */\n    else\n       repeat = firstelem -1 + nelem;  /* variable length arrays */\n\n    /* if variable length array, first write the whole input vector, \n       then go back and fill in the nulls */\n    if (tcode < 0) {\n      if (ffpclk(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) {\n        if (*status == NUM_OVERFLOW) \n\t{\n\t  /* ignore overflows, which are possibly the null pixel values */\n\t  /*  overflow = 1;   */\n\t  *status = 0;\n\t} else { \n          return(*status);\n\t}\n      }\n    }\n\n    /* absolute element number in the column */\n    first = (firstrow - 1) * repeat + firstelem;\n\n    for (ii = 0; ii < nelem; ii++)\n    {\n      if (array[ii] != nulvalue)  /* is this a good pixel? */\n      {\n         if (nbad)  /* write previous string of bad pixels */\n         {\n            fstelm = ii - nbad + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0)\n                return(*status);\n\n            nbad=0;\n         }\n\n         ngood = ngood +1;  /* the consecutive number of good pixels */\n      }\n      else\n      {\n         if (ngood)  /* write previous string of good pixels */\n         {\n            fstelm = ii - ngood + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (tcode > 0) {  /* variable length arrays have already been written */\n              if (ffpclk(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood],\n                status) > 0)  {\n\t\tif (*status == NUM_OVERFLOW) \n\t\t{\n\t\t  overflow = 1;\n\t\t  *status = 0;\n\t\t} else { \n                  return(*status);\n\t\t}\n\t      }\n\t    }\n            ngood=0;\n         }\n\n         nbad = nbad +1;  /* the consecutive number of bad pixels */\n      }\n    }\n\n    /* finished loop;  now just write the last set of pixels */\n\n    if (ngood)  /* write last string of good pixels */\n    {\n      fstelm = ii - ngood + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      if (tcode > 0) {  /* variable length arrays have already been written */\n        ffpclk(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status);\n      }\n    }\n    else if (nbad) /* write last string of bad pixels */\n    {\n      fstelm = ii - nbad + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      ffpclu(fptr, colnum, fstrow, fstelm, nbad, status);\n    }\n\n    if (*status <= 0) {\n      if (overflow) {\n        *status = NUM_OVERFLOW;\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffintfi1(int *input,           /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            unsigned char *output, /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] < 0)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (input[ii] > UCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DUCHAR_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (dvalue > DUCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) (dvalue + .5);\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffintfi2(int *input,       /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            short *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] < SHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MIN;\n            }\n            else if (input[ii] > SHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n                output[ii] = input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DSHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MIN;\n            }\n            else if (dvalue > DSHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (short) (dvalue + .5);\n                else\n                    output[ii] = (short) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffintfi4(int *input,       /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            INT32BIT *output,      /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)  \n    {       \n        memcpy(output, input, ntodo * sizeof(int) );\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (INT32BIT) (dvalue + .5);\n                else\n                    output[ii] = (INT32BIT) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffintfi8(int *input,  /* I - array of values to be converted  */\n            long ntodo,             /* I - number of elements in the array  */\n            double scale,           /* I - FITS TSCALn or BSCALE value      */\n            double zero,            /* I - FITS TZEROn or BZERO  value      */\n            LONGLONG *output,       /* O - output array of converted values */\n            int *status)            /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero ==  9223372036854775808.)\n    {       \n        /* Writing to unsigned long long column. Input values must not be negative */\n        /* Instead of subtracting 9223372036854775808, it is more efficient */\n        /* and more precise to just flip the sign bit with the XOR operator */\n\n        for (ii = 0; ii < ntodo; ii++) {\n           if (input[ii] < 0) {\n              *status = OVERFLOW_ERR;\n              output[ii] = LONGLONG_MIN;\n           } else {\n              output[ii] =  ((LONGLONG) input[ii]) ^ 0x8000000000000000;\n           }\n        }\n    }\n    else if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++) {\n                output[ii] = input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DLONGLONG_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MIN;\n            }\n            else if (dvalue > DLONGLONG_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (LONGLONG) (dvalue + .5);\n                else\n                    output[ii] = (LONGLONG) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffintfr4(int *input,       /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            float *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (float) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (float) ((input[ii] - zero) / scale);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffintfr8(int *input,       /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            double *output,    /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (double) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (input[ii] - zero) / scale;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffintfstr(int *input,      /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            char *cform,       /* I - format for output string values  */\n            long twidth,       /* I - width of each field, in chars    */\n            char *output,      /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n    char *cptr;\n    \n    cptr = output;\n\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n           sprintf(output, cform, (double) input[ii]);\n           output += twidth;\n\n           if (*output)  /* if this char != \\0, then overflow occurred */\n              *status = OVERFLOW_ERR;\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n          dvalue = (input[ii] - zero) / scale;\n          sprintf(output, cform, dvalue);\n          output += twidth;\n\n          if (*output)  /* if this char != \\0, then overflow occurred */\n            *status = OVERFLOW_ERR;\n        }\n    }\n\n    /* replace any commas with periods (e.g., in French locale) */\n    while ((cptr = strchr(cptr, ','))) *cptr = '.';\n    \n    return(*status);\n}\n"},{"id":16690,"name":"drvrsmem.h","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*\t\tS H A R E D   M E M O R Y   D R I V E R\n\t\t=======================================\n\n\t\t  by Jerzy.Borkowski@obs.unige.ch\n\n09-Mar-98 : initial version 1.0 released\n23-Mar-98 : shared_malloc now accepts new handle as an argument\n*/\n\n\n#include <sys/ipc.h>\t\t/* this is necessary for Solaris/Linux */\n#include <sys/shm.h>\n#include <sys/sem.h>\n\n#ifdef _AIX\n#include <fcntl.h>\n#else\n#include <sys/fcntl.h>\n#endif\n\n\t\t/* configuration parameters */\n\n#define\tSHARED_MAXSEG\t(16)\t\t/* maximum number of shared memory blocks */\n\n#define\tSHARED_KEYBASE\t(14011963)\t/* base for shared memory keys, may be overriden by getenv */\n#define\tSHARED_FDNAME\t(\"/tmp/.shmem-lockfile\") /* template for lock file name */\n\n#define\tSHARED_ENV_KEYBASE (\"SHMEM_LIB_KEYBASE\") /* name of environment variable */\n#define\tSHARED_ENV_MAXSEG (\"SHMEM_LIB_MAXSEG\")\t/* name of environment variable */\n\n\t\t/* useful constants */\n\n#define\tSHARED_RDONLY\t(0)\t\t/* flag for shared_(un)lock, lock for read */\n#define\tSHARED_RDWRITE\t(1)\t\t/* flag for shared_(un)lock, lock for write */\n#define\tSHARED_WAIT\t(0)\t\t/* flag for shared_lock, block if cannot lock immediate */\n#define\tSHARED_NOWAIT\t(2)\t\t/* flag for shared_lock, fail if cannot lock immediate */\n#define\tSHARED_NOLOCK\t(0x100)\t\t/* flag for shared_validate function */\n\n#define\tSHARED_RESIZE\t(4)\t\t/* flag for shared_malloc, object is resizeable */\n#define\tSHARED_PERSIST\t(8)\t\t/* flag for shared_malloc, object is not deleted after last proc detaches */\n\n#define\tSHARED_INVALID\t(-1)\t\t/* invalid handle for semaphore/shared memory */\n\n#define\tSHARED_EMPTY\t(0)\t\t/* entries for shared_used table */\n#define\tSHARED_USED\t(1)\n\n#define\tSHARED_GRANUL\t(16384)\t\t/* granularity of shared_malloc allocation = phys page size, system dependent */\n\n\n\n\t\t/* checkpoints in shared memory segments - might be omitted */\n\n#define\tSHARED_ID_0\t('J')\t\t/* first byte of identifier in BLKHEAD */\n#define\tSHARED_ID_1\t('B')\t\t/* second byte of identifier in BLKHEAD */\n\n#define\tBLOCK_REG\t(0)\t\t/* value for tflag member of BLKHEAD */\n#define\tBLOCK_SHARED\t(1)\t\t/* value for tflag member of BLKHEAD */\n\n\t\t/* generic error codes */\n\n#define\tSHARED_OK\t(0)\n\n#define\tSHARED_ERR_MIN_IDX\tSHARED_BADARG\n#define\tSHARED_ERR_MAX_IDX\tSHARED_NORESIZE\n\n\n#define\tDAL_SHM_FREE\t(0)\n#define\tDAL_SHM_USED\t(1)\n\n#define\tDAL_SHM_ID0\t('D')\n#define\tDAL_SHM_ID1\t('S')\n#define\tDAL_SHM_ID2\t('M')\n\n#define\tDAL_SHM_SEGHEAD_ID\t(0x19630114)\n\n\n\n\t\t/* data types */\n\n/* BLKHEAD object is placed at the beginning of every memory segment (both\n  shared and regular) to allow automatic recognition of segments type */\n\ntypedef union\n      { struct BLKHEADstruct\n\t      {\tchar\tID[2];\t\t/* ID = 'JB', just as a checkpoint */\n\t\tchar\ttflag;\t\t/* is it shared memory or regular one ? */\n\t\tint\thandle;\t\t/* this is not necessary, used only for non-resizeable objects via ptr */\n\t      } s;\n\tdouble\td;\t\t\t/* for proper alignment on every machine */\n      } BLKHEAD;\n\ntypedef void *SHARED_P;\t\t\t/* generic type of shared memory pointer */\n\ntypedef\tstruct SHARED_GTABstruct\t/* data type used in global table */\n      {\tint\tsem;\t\t\t/* access semaphore (1 field): process count */\n\tint\tsemkey;\t\t\t/* key value used to generate semaphore handle */\n\tint\tkey;\t\t\t/* key value used to generate shared memory handle (realloc changes it) */\n\tint\thandle;\t\t\t/* handle of shared memory segment */\n\tint\tsize;\t\t\t/* size of shared memory segment */\n\tint\tnprocdebug;\t\t/* attached proc counter, helps remove zombie segments */\n\tchar\tattr;\t\t\t/* attributes of shared memory object */\n      } SHARED_GTAB;\n\ntypedef\tstruct SHARED_LTABstruct\t/* data type used in local table */\n      {\tBLKHEAD\t*p;\t\t\t/* pointer to segment (may be null) */\n\tint\ttcnt;\t\t\t/* number of threads in this process attached to segment */\n\tint\tlkcnt;\t\t\t/* >=0 <- number of read locks, -1 - write lock */\n\tlong\tseekpos;\t\t/* current pointer position, read/write/seek operations change it */\n      } SHARED_LTAB;\n\n\n\t/* system dependent definitions */\n\n#ifndef HAVE_FLOCK_T\ntypedef struct flock flock_t;\n#define HAVE_FLOCK_T\n#endif\n\n#ifndef HAVE_UNION_SEMUN\nunion semun\n      {\tint val;\n\tstruct semid_ds *buf;\n\tunsigned short *array;\n      };\n#define HAVE_UNION_SEMUN\n#endif\n\n\ntypedef struct DAL_SHM_SEGHEAD_STRUCT\tDAL_SHM_SEGHEAD;\n\nstruct DAL_SHM_SEGHEAD_STRUCT\n      {\tint\tID;\t\t\t/* ID for debugging */\n\tint\th;\t\t\t/* handle of sh. mem */\n\tint\tsize;\t\t\t/* size of data area */\n\tint\tnodeidx;\t\t/* offset of root object (node struct typically) */\n      };\n\n\t\t/* API routines */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nvoid\tshared_cleanup(void);\t\t\t/* must be called at exit/abort */\nint\tshared_init(int debug_msgs);\t\t/* must be called before any other shared memory routine */\nint\tshared_recover(int id);\t\t\t/* try to recover dormant segment(s) after applic crash */\nint\tshared_malloc(long size, int mode, int newhandle);\t/* allocate n-bytes of shared memory */\nint\tshared_attach(int idx);\t\t\t/* attach to segment given index to table */\nint\tshared_free(int idx);\t\t\t/* release shared memory */\nSHARED_P shared_lock(int idx, int mode);\t/* lock segment for reading */\nSHARED_P shared_realloc(int idx, long newsize);\t/* reallocate n-bytes of shared memory (ON LOCKED SEGMENT ONLY) */\nint\tshared_size(int idx);\t\t\t/* get size of attached shared memory segment (ON LOCKED SEGMENT ONLY) */\nint\tshared_attr(int idx);\t\t\t/* get attributes of attached shared memory segment (ON LOCKED SEGMENT ONLY) */\nint\tshared_set_attr(int idx, int newattr);\t/* set attributes of attached shared memory segment (ON LOCKED SEGMENT ONLY) */\nint\tshared_unlock(int idx);\t\t\t/* unlock segment (ON LOCKED SEGMENT ONLY) */\nint\tshared_set_debug(int debug_msgs);\t/* set/reset debug mode */\nint\tshared_set_createmode(int mode);\t/* set/reset debug mode */\nint\tshared_list(int id);\t\t\t/* list segment(s) */\nint\tshared_uncond_delete(int id);\t\t/* uncondintionally delete (NOWAIT operation) segment(s) */\nint\tshared_getaddr(int id, char **address);\t/* get starting address of FITS file in segment */\n\nint\tsmem_init(void);\nint\tsmem_shutdown(void);\nint\tsmem_setoptions(int options);\nint\tsmem_getoptions(int *options);\nint\tsmem_getversion(int *version);\nint\tsmem_open(char *filename, int rwmode, int *driverhandle);\nint\tsmem_create(char *filename, int *driverhandle);\nint\tsmem_close(int driverhandle);\nint\tsmem_remove(char *filename);\nint\tsmem_size(int driverhandle, LONGLONG *size);\nint\tsmem_flush(int driverhandle);\nint\tsmem_seek(int driverhandle, LONGLONG offset);\nint\tsmem_read(int driverhandle, void *buffer, long nbytes);\nint\tsmem_write(int driverhandle, void *buffer, long nbytes);\n\n#ifdef __cplusplus\n}\n#endif\n"},{"id":16691,"name":"group.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, group.c, contains the grouping convention suport routines.  */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n/*                                                                         */\n/*  The group.c module of CFITSIO was written by Donald G. Jennings of     */\n/*  the INTEGRAL Science Data Centre (ISDC) under NASA contract task       */\n/*  66002J6. The above copyright laws apply. Copyright guidelines of The   */\n/*  University of Geneva might also apply.                                 */\n\n/*  The following routines are designed to create, read, and manipulate    */\n/*  FITS Grouping Tables as defined in the FITS Grouping Convention paper  */\n/*  by Jennings, Pence, Folk and Schlesinger. The development of the       */\n/*  grouping structure was partially funded under the NASA AISRP Program.  */ \n    \n#include \"fitsio2.h\"\n#include \"group.h\"\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\n#if defined(WIN32) || defined(__WIN32__)\n#include <direct.h>   /* defines the getcwd function on Windows PCs */\n#endif\n\n#if defined(unix) || defined(__unix__)  || defined(__unix) || defined(HAVE_UNISTD_H)\n#include <unistd.h>  /* needed for getcwd prototype on unix machines */\n#endif\n\n#define HEX_ESCAPE '%'\n\n/*---------------------------------------------------------------------------\n Change record:\n\nD. Jennings, 18/06/98, version 1.0 of group module delivered to B. Pence for\n                       integration into CFITSIO 2.005\n\nD. Jennings, 17/11/98, fixed bug in ffgtcpr(). Now use fits_find_nextkey()\n                       correctly and insert auxiliary keyword records \n\t\t       directly before the TTYPE1 keyword in the copied\n\t\t       group table.\n\nD. Jennings, 22/01/99, ffgmop() now looks for relative file paths when \n                       the MEMBER_LOCATION information is given in a \n\t\t       grouping table.\n\nD. Jennings, 01/02/99, ffgtop() now looks for relatve file paths when \n                       the GRPLCn keyword value is supplied in the member\n\t\t       HDU header.\n\nD. Jennings, 01/02/99, ffgtam() now trys to construct relative file paths\n                       from the member's file to the group table's file\n\t\t       (and visa versa) when both the member's file and\n\t\t       group table file are of access type FILE://.\n\nD. Jennings, 05/05/99, removed the ffgtcn() function; made obsolete by\n                       fits_get_url().\n\nD. Jennings, 05/05/99, updated entire module to handle partial URLs and\n                       absolute URLs more robustly. Host dependent directory\n\t\t       paths are now converted to true URLs before being\n\t\t       read from/written to grouping tables.\n\nD. Jennings, 05/05/99, added the following new functions (note, none of these\n                       are directly callable by the application)\n\n\t\t       int fits_path2url()\n\t\t       int fits_url2path()\n\t\t       int fits_get_cwd()\n\t\t       int fits_get_url()\n\t\t       int fits_clean_url()\n\t\t       int fits_relurl2url()\n\t\t       int fits_encode_url()\n\t\t       int fits_unencode_url()\n\t\t       int fits_is_url_absolute()\n\n-----------------------------------------------------------------------------*/\n\n/*---------------------------------------------------------------------------*/\nint ffgtcr(fitsfile *fptr,      /* FITS file pointer                         */\n\t   char    *grpname,    /* name of the grouping table                */\n\t   int      grouptype,  /* code specifying the type of\n\t\t\t\t   grouping table information:\n\t\t\t\t   GT_ID_ALL_URI  0 ==> defualt (all columns)\n\t\t\t\t   GT_ID_REF      1 ==> ID by reference\n\t\t\t\t   GT_ID_POS      2 ==> ID by position\n\t\t\t\t   GT_ID_ALL      3 ==> ID by ref. and position\n\t\t\t\t   GT_ID_REF_URI 11 ==> (1) + URI info \n\t\t\t\t   GT_ID_POS_URI 12 ==> (2) + URI info       */\n\t   int      *status    )/* return status code                        */\n\n/* \n   create a grouping table at the end of the current FITS file. This\n   function makes the last HDU in the file the CHDU, then calls the\n   fits_insert_group() function to actually create the new grouping table.\n*/\n\n{\n  int hdutype;\n  int hdunum;\n\n\n  if(*status != 0) return(*status);\n\n\n  *status = fits_get_num_hdus(fptr,&hdunum,status);\n\n  /* If hdunum is 0 then we are at the beginning of the file and\n     we actually haven't closed the first header yet, so don't do\n     anything more */\n\n  if (0 != hdunum) {\n\n      *status = fits_movabs_hdu(fptr,hdunum,&hdutype,status);\n  }\n\n  /* Now, the whole point of the above two fits_ calls was to get to\n     the end of file.  Let's ignore errors at this point and keep\n     going since any error is likely to mean that we are already at the \n     EOF, or the file is fatally corrupted.  If we are at the EOF then\n     the next fits_ call will be ok.  If it's corrupted then the\n     next call will fail, but that's not big deal at this point.\n  */\n\n  if (0 != *status ) *status = 0;\n\n  *status = fits_insert_group(fptr,grpname,grouptype,status);\n\n  return(*status);\n}\n\n/*---------------------------------------------------------------------------*/\nint ffgtis(fitsfile *fptr,      /* FITS file pointer                         */\n\t   char    *grpname,    /* name of the grouping table                */\n\t   int      grouptype,  /* code specifying the type of\n\t\t\t\t   grouping table information:\n\t\t\t\t   GT_ID_ALL_URI  0 ==> defualt (all columns)\n\t\t\t\t   GT_ID_REF      1 ==> ID by reference\n\t\t\t\t   GT_ID_POS      2 ==> ID by position\n\t\t\t\t   GT_ID_ALL      3 ==> ID by ref. and position\n\t\t\t\t   GT_ID_REF_URI 11 ==> (1) + URI info \n\t\t\t\t   GT_ID_POS_URI 12 ==> (2) + URI info       */\n\t   int      *status)     /* return status code                       */\n\t   \n/* \n   insert a grouping table just after the current HDU of the current FITS file.\n   This is the same as fits_create_group() only it allows the user to select\n   the place within the FITS file to add the grouping table.\n*/\n\n{\n\n  int tfields  = 0;\n  int hdunum   = 0;\n  int hdutype  = 0;\n  int extver;\n  int i;\n  \n  long pcount  = 0;\n\n  char *ttype[6];\n  char *tform[6];\n\n  char ttypeBuff[102];  \n  char tformBuff[54];  \n\n  char  extname[] = \"GROUPING\";\n  char  keyword[FLEN_KEYWORD];\n  char  keyvalue[FLEN_VALUE];\n  char  comment[FLEN_COMMENT];\n    \n  do\n    {\n\n      /* set up the ttype and tform character buffers */\n\n      for(i = 0; i < 6; ++i)\n\t{\n\t  ttype[i] = ttypeBuff+(i*17);\n\t  tform[i] = tformBuff+(i*9);\n\t}\n\n      /* define the columns required according to the grouptype parameter */\n\n      *status = ffgtdc(grouptype,0,0,0,0,0,0,ttype,tform,&tfields,status);\n\n      /* create the grouping table using the columns defined above */\n\n      *status = fits_insert_btbl(fptr,0,tfields,ttype,tform,NULL,\n\t\t\t\t NULL,pcount,status);\n\n      if(*status != 0) continue;\n\n      /*\n\t retrieve the hdu position of the new grouping table for\n\t future use\n      */\n\n      fits_get_hdu_num(fptr,&hdunum);\n\n      /*\n\t add the EXTNAME and EXTVER keywords to the HDU just after the \n\t TFIELDS keyword; for now the EXTVER value is set to 0, it will be \n\t set to the correct value later on\n      */\n\n      fits_read_keyword(fptr,\"TFIELDS\",keyvalue,comment,status);\n\n      fits_insert_key_str(fptr,\"EXTNAME\",extname,\n\t\t\t  \"HDU contains a Grouping Table\",status);\n      fits_insert_key_lng(fptr,\"EXTVER\",0,\"Grouping Table vers. (this file)\",\n\t\t\t  status);\n\n      /* \n\t if the grpname parameter value was defined (Non NULL and non zero\n\t length) then add the GRPNAME keyword and value\n      */\n\n      if(grpname != NULL && strlen(grpname) > 0)\n\tfits_insert_key_str(fptr,\"GRPNAME\",grpname,\"Grouping Table name\",\n\t\t\t    status);\n\n      /* \n\t add the TNULL keywords and values for each integer column defined;\n\t integer null values are zero (0) for the MEMBER_POSITION and \n\t MEMBER_VERSION columns.\n      */\n\n      for(i = 0; i < tfields && *status == 0; ++i)\n\t{\t  \n\t  if(fits_strcasecmp(ttype[i],\"MEMBER_POSITION\") == 0 ||\n\t     fits_strcasecmp(ttype[i],\"MEMBER_VERSION\")  == 0)\n\t    {\n\t      snprintf(keyword,FLEN_KEYWORD,\"TFORM%d\",i+1);\n\t      *status = fits_read_key_str(fptr,keyword,keyvalue,comment,\n\t\t\t\t\t  status);\n\t \n\t      snprintf(keyword,FLEN_KEYWORD,\"TNULL%d\",i+1);\n\n\t      *status = fits_insert_key_lng(fptr,keyword,0,\"Column Null Value\",\n\t\t\t\t\t    status);\n\t    }\n\t}\n\n      /*\n\t determine the correct EXTVER value for the new grouping table\n\t by finding the highest numbered grouping table EXTVER value\n\t the currently exists\n      */\n\n      for(extver = 1;\n\t  (fits_movnam_hdu(fptr,ANY_HDU,\"GROUPING\",extver,status)) == 0; \n\t  ++extver);\n\n      if(*status == BAD_HDU_NUM) *status = 0;\n\n      /*\n\t move back to the new grouping table HDU and update the EXTVER\n\t keyword value\n      */\n\n      fits_movabs_hdu(fptr,hdunum,&hdutype,status);\n\n      fits_modify_key_lng(fptr,\"EXTVER\",extver,\"&\",status);\n\n    }while(0);\n\n\n  return(*status);\n}\n\n/*---------------------------------------------------------------------------*/\nint ffgtch(fitsfile *gfptr,     /* FITS pointer to group                     */\n\t   int       grouptype, /* code specifying the type of\n\t\t\t\t   grouping table information:\n\t\t\t\t   GT_ID_ALL_URI  0 ==> defualt (all columns)\n\t\t\t\t   GT_ID_REF      1 ==> ID by reference\n\t\t\t\t   GT_ID_POS      2 ==> ID by position\n\t\t\t\t   GT_ID_ALL      3 ==> ID by ref. and position\n\t\t\t\t   GT_ID_REF_URI 11 ==> (1) + URI info \n\t\t\t\t   GT_ID_POS_URI 12 ==> (2) + URI info       */\n\t   int      *status)     /* return status code                       */\n\n\n/* \n   Change the grouping table structure of the grouping table pointed to by\n   gfptr. The grouptype code specifies the new structure of the table. This\n   operation only adds or removes grouping table columns, it does not add\n   or delete group members (i.e., table rows). If the grouping table already\n   has the desired structure then no operations are performed and function   \n   simply returns with a (0) success status code. If the requested structure\n   change creates new grouping table columns, then the column values for all\n   existing members will be filled with the appropriate null values.\n*/\n\n{\n  int xtensionCol, extnameCol, extverCol, positionCol, locationCol, uriCol;\n  int ncols    = 0;\n  int colnum   = 0;\n  int nrows    = 0;\n  int grptype  = 0;\n  int i,j;\n\n  long intNull  = 0;\n  long tfields  = 0;\n  \n  char *tform[6];\n  char *ttype[6];\n\n  unsigned char  charNull[1] = {'\\0'};\n\n  char ttypeBuff[102];  \n  char tformBuff[54];  \n\n  char  keyword[FLEN_KEYWORD];\n  char  keyvalue[FLEN_VALUE];\n  char  comment[FLEN_COMMENT];\n\n\n  if(*status != 0) return(*status);\n\n  do\n    {\n      /* set up the ttype and tform character buffers */\n\n      for(i = 0; i < 6; ++i)\n\t{\n\t  ttype[i] = ttypeBuff+(i*17);\n\t  tform[i] = tformBuff+(i*9);\n\t}\n\n      /* retrieve positions of all Grouping table reserved columns */\n\n      *status = ffgtgc(gfptr,&xtensionCol,&extnameCol,&extverCol,&positionCol,\n\t\t       &locationCol,&uriCol,&grptype,status);\n\n      if(*status != 0) continue;\n\n      /* determine the total number of grouping table columns */\n\n      *status = fits_read_key_lng(gfptr,\"TFIELDS\",&tfields,comment,status);\n\n      /* define grouping table columns to be added to the configuration */\n\n      *status = ffgtdc(grouptype,xtensionCol,extnameCol,extverCol,positionCol,\n\t\t       locationCol,uriCol,ttype,tform,&ncols,status);\n\n      /*\n\tdelete any grouping tables columns that exist but do not belong to\n\tnew desired configuration; note that we delete before creating new\n\tcolumns for (file size) efficiency reasons\n      */\n\n      switch(grouptype)\n\t{\n\n\tcase GT_ID_ALL_URI:\n\n\t  /* no columns to be deleted in this case */\n\n\t  break;\n\n\tcase GT_ID_REF:\n\n\t  if(positionCol != 0) \n\t    {\n\t      *status = fits_delete_col(gfptr,positionCol,status);\n\t      --tfields;\n\t      if(uriCol      > positionCol)  --uriCol;\n\t      if(locationCol > positionCol) --locationCol;\n\t    }\n\t  if(uriCol      != 0)\n\t    { \n\t    *status = fits_delete_col(gfptr,uriCol,status);\n\t      --tfields;\n\t      if(locationCol > uriCol) --locationCol;\n\t    }\n\t  if(locationCol != 0) \n\t    *status = fits_delete_col(gfptr,locationCol,status);\n\n\t  break;\n\n\tcase  GT_ID_POS:\n\n\t  if(xtensionCol != 0) \n\t    {\n\t      *status = fits_delete_col(gfptr,xtensionCol,status);\n\t      --tfields;\n\t      if(extnameCol  > xtensionCol)  --extnameCol;\n\t      if(extverCol   > xtensionCol)  --extverCol;\n\t      if(uriCol      > xtensionCol)  --uriCol;\n\t      if(locationCol > xtensionCol)  --locationCol;\n\t    }\n\t  if(extnameCol  != 0) \n\t    {\n\t      *status = fits_delete_col(gfptr,extnameCol,status);\n\t      --tfields;\n\t      if(extverCol   > extnameCol)  --extverCol;\n\t      if(uriCol      > extnameCol)  --uriCol;\n\t      if(locationCol > extnameCol)  --locationCol;\n\t    }\n\t  if(extverCol   != 0)\n\t    { \n\t      *status = fits_delete_col(gfptr,extverCol,status);\n\t      --tfields;\n\t      if(uriCol      > extverCol)  --uriCol;\n\t      if(locationCol > extverCol)  --locationCol;\n\t    }\n\t  if(uriCol      != 0)\n\t    { \n\t      *status = fits_delete_col(gfptr,uriCol,status);\n\t      --tfields;\n\t      if(locationCol > uriCol)  --locationCol;\n\t    }\n\t  if(locationCol != 0)\n\t    { \n\t      *status = fits_delete_col(gfptr,locationCol,status);\n\t      --tfields;\n\t    }\n\t  \n\t  break;\n\n\tcase  GT_ID_ALL:\n\n\t  if(uriCol      != 0) \n\t    {\n\t      *status = fits_delete_col(gfptr,uriCol,status);\n\t      --tfields;\n\t      if(locationCol > uriCol)  --locationCol;\n\t    }\n\t  if(locationCol != 0)\n\t    { \n\t      *status = fits_delete_col(gfptr,locationCol,status);\n\t      --tfields;\n\t    }\n\n\t  break;\n\n\tcase GT_ID_REF_URI:\n\n\t  if(positionCol != 0)\n\t    { \n\t      *status = fits_delete_col(gfptr,positionCol,status);\n\t      --tfields;\n\t    }\n\n\t  break;\n\n\tcase  GT_ID_POS_URI:\n\n\t  if(xtensionCol != 0) \n\t    {\n\t      *status = fits_delete_col(gfptr,xtensionCol,status);\n\t      --tfields;\n\t      if(extnameCol > xtensionCol)  --extnameCol;\n\t      if(extverCol  > xtensionCol)  --extverCol;\n\t    }\n\t  if(extnameCol  != 0)\n\t    { \n\t      *status = fits_delete_col(gfptr,extnameCol,status);\n\t      --tfields;\n\t      if(extverCol > extnameCol)  --extverCol;\n\t    }\n\t  if(extverCol   != 0)\n\t    { \n\t      *status = fits_delete_col(gfptr,extverCol,status);\n\t      --tfields;\n\t    }\n\n\t  break;\n\n\tdefault:\n\n\t  *status = BAD_OPTION;\n\t  ffpmsg(\"Invalid value for grouptype parameter specified (ffgtch)\");\n\t  break;\n\n\t}\n\n      /*\n\tadd all the new grouping table columns that were not there\n\tpreviously but are called for by the grouptype parameter\n      */\n\n      for(i = 0; i < ncols && *status == 0; ++i)\n\t*status = fits_insert_col(gfptr,tfields+i+1,ttype[i],tform[i],status);\n\n      /* \n\t add the TNULL keywords and values for each new integer column defined;\n\t integer null values are zero (0) for the MEMBER_POSITION and \n\t MEMBER_VERSION columns. Insert a null (\"/0\") into each new string\n\t column defined: MEMBER_XTENSION, MEMBER_NAME, MEMBER_URI_TYPE and\n\t MEMBER_LOCATION. Note that by convention a null string is the\n\t TNULL value for character fields so no TNULL is required.\n      */\n\n      for(i = 0; i < ncols && *status == 0; ++i)\n\t{\t  \n\t  if(fits_strcasecmp(ttype[i],\"MEMBER_POSITION\") == 0 ||\n\t     fits_strcasecmp(ttype[i],\"MEMBER_VERSION\")  == 0)\n\t    {\n\t      /* col contains int data; set TNULL and insert 0 for each col */\n\n\t      *status = fits_get_colnum(gfptr,CASESEN,ttype[i],&colnum,\n\t\t\t\t\tstatus);\n\t      \n\t      snprintf(keyword,FLEN_KEYWORD,\"TFORM%d\",colnum);\n\n\t      *status = fits_read_key_str(gfptr,keyword,keyvalue,comment,\n\t\t\t\t\t  status);\n\t \n\t      snprintf(keyword,FLEN_KEYWORD,\"TNULL%d\",colnum);\n\n\t      *status = fits_insert_key_lng(gfptr,keyword,0,\n\t\t\t\t\t    \"Column Null Value\",status);\n\n\t      for(j = 1; j <= nrows && *status == 0; ++j)\n\t\t*status = fits_write_col_lng(gfptr,colnum,j,1,1,&intNull,\n\t\t\t\t\t     status);\n\t    }\n\t  else if(fits_strcasecmp(ttype[i],\"MEMBER_XTENSION\") == 0 ||\n\t\t  fits_strcasecmp(ttype[i],\"MEMBER_NAME\")     == 0 ||\n\t\t  fits_strcasecmp(ttype[i],\"MEMBER_URI_TYPE\") == 0 ||\n\t\t  fits_strcasecmp(ttype[i],\"MEMBER_LOCATION\") == 0)\n\t    {\n\n\t      /* new col contains character data; insert NULLs into each col */\n\n\t      *status = fits_get_colnum(gfptr,CASESEN,ttype[i],&colnum,\n\t\t\t\t\tstatus);\n\n\t      for(j = 1; j <= nrows && *status == 0; ++j)\n\t    /* WILL THIS WORK FOR VAR LENTH CHAR COLS??????*/\n\t\t*status = fits_write_col_byt(gfptr,colnum,j,1,1,charNull,\n\t\t\t\t\t     status);\n\t    }\n\t}\n\n    }while(0);\n\n  return(*status);\n}\n\n/*---------------------------------------------------------------------------*/\nint ffgtrm(fitsfile *gfptr,  /* FITS file pointer to group                   */\n\t   int       rmopt,  /* code specifying if member\n\t\t\t\telements are to be deleted:\n\t\t\t\tOPT_RM_GPT ==> remove only group table\n\t\t\t\tOPT_RM_ALL ==> recursively remove members\n\t\t\t\tand their members (if groups)                */\n\t   int      *status) /* return status code                           */\n\t    \n/*\n  remove a grouping table, and optionally all its members. Any groups \n  containing the grouping table are updated, and all members (if not \n  deleted) have their GRPIDn and GRPLCn keywords updated accordingly. \n  If the (deleted) members are members of another grouping table then those\n  tables are also updated. The CHDU of the FITS file pointed to by gfptr must \n  be positioned to the grouping table to be deleted.\n*/\n\n{\n  int hdutype;\n\n  long i;\n  long nmembers = 0;\n\n  HDUtracker HDU;\n  \n\n  if(*status != 0) return(*status);\n\n  /*\n     remove the grouping table depending upon the rmopt parameter\n  */\n\n  switch(rmopt)\n    {\n\n    case OPT_RM_GPT:\n\n      /*\n\t for this option, the grouping table is deleted, but the member\n\t HDUs remain; in this case we only have to remove each member from\n\t the grouping table by calling fits_remove_member() with the\n\t OPT_RM_ENTRY option\n      */\n\n      /* get the number of members contained by this table */\n\n      *status = fits_get_num_members(gfptr,&nmembers,status);\n\n      /* loop over all grouping table members and remove them */\n\n      for(i = nmembers; i > 0 && *status == 0; --i)\n\t*status = fits_remove_member(gfptr,i,OPT_RM_ENTRY,status);\n      \n\tbreak;\n\n    case OPT_RM_ALL:\n\n      /*\n\tfor this option the entire Group is deleted -- this includes all\n\tmembers and their members (if grouping tables themselves). Call \n\tthe recursive form of this function to perform the removal.\n      */\n\n      /* add the current grouping table to the HDUtracker struct */\n\n      HDU.nHDU = 0;\n\n      *status = fftsad(gfptr,&HDU,NULL,NULL);\n\n      /* call the recursive group remove function */\n\n      *status = ffgtrmr(gfptr,&HDU,status);\n\n      /* free the memory allocated to the HDUtracker struct */\n\n      for(i = 0; i < HDU.nHDU; ++i)\n\t{\n\t  free(HDU.filename[i]);\n\t  free(HDU.newFilename[i]);\n\t}\n\n      break;\n\n    default:\n      \n      *status = BAD_OPTION;\n      ffpmsg(\"Invalid value for the rmopt parameter specified (ffgtrm)\");\n      break;\n\n     }\n\n  /*\n     if all went well then unlink and delete the grouping table HDU\n  */\n\n  *status = ffgmul(gfptr,0,status);\n\n  *status = fits_delete_hdu(gfptr,&hdutype,status);\n      \n  return(*status);\n}\n\n/*---------------------------------------------------------------------------*/\nint ffgtcp(fitsfile *infptr,  /* input FITS file pointer                     */\n\t   fitsfile *outfptr, /* output FITS file pointer                    */\n\t   int        cpopt,  /* code specifying copy options:\n\t\t\t\tOPT_GCP_GPT (0) ==> copy only grouping table\n\t\t\t\tOPT_GCP_ALL (2) ==> recusrively copy members \n\t\t\t\t                    and their members (if \n\t\t\t\t\t\t    groups)                  */\n\t   int      *status)  /* return status code                          */\n\n/*\n  copy a grouping table, and optionally all its members, to a new FITS file.\n  If the cpopt is set to OPT_GCP_GPT (copy grouping table only) then the \n  existing members have their GRPIDn and GRPLCn keywords updated to reflect \n  the existance of the new group, since they now belong to another group. If \n  cpopt is set to OPT_GCP_ALL (copy grouping table and members recursively) \n  then the original members are not updated; the new grouping table is \n  modified to include only the copied member HDUs and not the original members.\n\n  Note that the recursive version of this function, ffgtcpr(), is called\n  to perform the group table copy. In the case of cpopt == OPT_GCP_GPT\n  ffgtcpr() does not actually use recursion.\n*/\n\n{\n  int i;\n\n  HDUtracker HDU;\n\n\n  if(*status != 0) return(*status);\n\n  /* make sure infptr and outfptr are not the same pointer */\n\n  if(infptr == outfptr) *status = IDENTICAL_POINTERS;\n  else\n    {\n\n      /* initialize the HDUtracker struct */\n      \n      HDU.nHDU = 0;\n      \n      *status = fftsad(infptr,&HDU,NULL,NULL);\n      \n      /* \n\t call the recursive form of this function to copy the grouping table. \n\t If the cpopt is OPT_GCP_GPT then there is actually no recursion\n\t performed\n      */\n\n      *status = ffgtcpr(infptr,outfptr,cpopt,&HDU,status);\n  \n      /* free memory allocated for the HDUtracker struct */\n\n      for(i = 0; i < HDU.nHDU; ++i) \n\t{\n\t  free(HDU.filename[i]);\n\t  free(HDU.newFilename[i]);\n\t}\n    }\n\n  return(*status);\n}\n\n/*---------------------------------------------------------------------------*/\nint ffgtmg(fitsfile *infptr,  /* FITS file ptr to source grouping table      */\n\t   fitsfile *outfptr, /* FITS file ptr to target grouping table      */\n\t   int       mgopt,   /* code specifying merge options:\n\t\t\t\t OPT_MRG_COPY (0) ==> copy members to target\n\t\t\t\t                      group, leaving source \n\t\t\t\t\t\t      group in place\n\t\t\t\t OPT_MRG_MOV  (1) ==> move members to target\n\t\t\t\t                      group, source group is\n\t\t\t\t\t\t      deleted after merge    */\n\t   int      *status)   /* return status code                         */\n     \n\n/*\n  merge two grouping tables by combining their members into a single table. \n  The source grouping table must be the CHDU of the fitsfile pointed to by \n  infptr, and the target grouping table must be the CHDU of the fitsfile to by \n  outfptr. All members of the source grouping table shall be copied to the\n  target grouping table. If the mgopt parameter is OPT_MRG_COPY then the source\n  grouping table continues to exist after the merge. If the mgopt parameter\n  is OPT_MRG_MOV then the source grouping table is deleted after the merge, \n  and all member HDUs are updated accordingly.\n*/\n{\n  long i ;\n  long nmembers = 0;\n\n  fitsfile *tmpfptr = NULL;\n\n\n  if(*status != 0) return(*status);\n\n  do\n    {\n\n      *status = fits_get_num_members(infptr,&nmembers,status);\n\n      for(i = 1; i <= nmembers && *status == 0; ++i)\n\t{\n\t  *status = fits_open_member(infptr,i,&tmpfptr,status);\n\t  *status = fits_add_group_member(outfptr,tmpfptr,0,status);\n\n\t  if(*status == HDU_ALREADY_MEMBER) *status = 0;\n\n\t  if(tmpfptr != NULL)\n\t    {\n\t      fits_close_file(tmpfptr,status);\n\t      tmpfptr = NULL;\n\t    }\n\t}\n\n      if(*status != 0) continue;\n\n      if(mgopt == OPT_MRG_MOV) \n\t*status = fits_remove_group(infptr,OPT_RM_GPT,status);\n\n    }while(0);\n\n  if(tmpfptr != NULL)\n    {\n      fits_close_file(tmpfptr,status);\n    }\n\n  return(*status);\n}\n\n/*---------------------------------------------------------------------------*/\nint ffgtcm(fitsfile *gfptr,  /* FITS file pointer to grouping table          */\n\t   int       cmopt,  /* code specifying compact options\n\t\t\t\tOPT_CMT_MBR      (1) ==> compact only direct \n\t\t\t                                 members (if groups)\n\t\t\t\tOPT_CMT_MBR_DEL (11) ==> (1) + delete all \n\t\t\t\t                         compacted groups    */\n\t   int      *status) /* return status code                           */\n    \n/*\n  \"Compact\" a group pointed to by the FITS file pointer gfptr. This \n  is achieved by flattening the tree structure of a group and its \n  (grouping table) members. All members HDUs of a grouping table which is \n  itself a member of the grouping table gfptr are added to gfptr. Optionally,\n  the grouping tables which are \"compacted\" are deleted. If the grouping \n  table contains no members that are themselves grouping tables then this \n  function performs a NOOP.\n*/\n\n{\n  long i;\n  long nmembers = 0;\n\n  char keyvalue[FLEN_VALUE];\n  char comment[FLEN_COMMENT];\n\n  fitsfile *mfptr = NULL;\n\n\n  if(*status != 0) return(*status);\n\n  do\n    {\n      if(cmopt != OPT_CMT_MBR && cmopt != OPT_CMT_MBR_DEL)\n\t{\n\t  *status = BAD_OPTION;\n\t  ffpmsg(\"Invalid value for cmopt parameter specified (ffgtcm)\");\n\t  continue;\n\t}\n\n      /* reteive the number of grouping table members */\n\n      *status = fits_get_num_members(gfptr,&nmembers,status);\n\n      /*\n\tloop over all the grouping table members; if the member is a \n\tgrouping table then merge its members with the parent grouping \n\ttable \n      */\n\n      for(i = 1; i <= nmembers && *status == 0; ++i)\n\t{\n\t  *status = fits_open_member(gfptr,i,&mfptr,status);\n\n\t  if(*status != 0) continue;\n\n\t  *status = fits_read_key_str(mfptr,\"EXTNAME\",keyvalue,comment,status);\n\n\t  /* if no EXTNAME keyword then cannot be a grouping table */\n\n\t  if(*status == KEY_NO_EXIST) \n\t    {\n\t      *status = 0;\n\t      continue;\n\t    }\n\t  prepare_keyvalue(keyvalue);\n\n\t  if(*status != 0) continue;\n\n\t  /* if EXTNAME == \"GROUPING\" then process member as grouping table */\n\n\t  if(fits_strcasecmp(keyvalue,\"GROUPING\") == 0)\n\t    {\n\t      /* merge the member (grouping table) into the grouping table */\n\n\t      *status = fits_merge_groups(mfptr,gfptr,OPT_MRG_COPY,status);\n\n\t      *status = fits_close_file(mfptr,status);\n\t      mfptr = NULL;\n\n\t      /* \n\t\t remove the member from the grouping table now that all of\n\t\t its members have been transferred; if cmopt is set to\n\t\t OPT_CMT_MBR_DEL then remove and delete the member\n\t      */\n\n\t      if(cmopt == OPT_CMT_MBR)\n\t\t*status = fits_remove_member(gfptr,i,OPT_RM_ENTRY,status);\n\t      else\n\t\t*status = fits_remove_member(gfptr,i,OPT_RM_MBR,status);\n\t    }\n\t  else\n\t    {\n\t      /* not a grouping table; just close the opened member */\n\n\t      *status = fits_close_file(mfptr,status);\n\t      mfptr = NULL;\n\t    }\n\t}\n\n    }while(0);\n\n  return(*status);\n}\n\n/*--------------------------------------------------------------------------*/\nint ffgtvf(fitsfile *gfptr,       /* FITS file pointer to group             */\n\t   long     *firstfailed, /* Member ID (if positive) of first failed\n\t\t\t\t     member HDU verify check or GRPID index\n\t\t\t\t     (if negitive) of first failed group\n\t\t\t\t     link verify check.                     */\n\t   int      *status)      /* return status code                     */\n\n/*\n check the integrity of a grouping table to make sure that all group members \n are accessible and all the links to other grouping tables are valid. The\n firstfailed parameter returns the member ID of the first member HDU to fail\n verification if positive or the first group link to fail if negative; \n otherwise firstfailed contains a return value of 0.\n*/\n\n{\n  long i;\n  long nmembers = 0;\n  long ngroups  = 0;\n\n  char errstr[FLEN_VALUE];\n\n  fitsfile *fptr = NULL;\n\n\n  if(*status != 0) return(*status);\n\n  *firstfailed = 0;\n\n  do\n    {\n      /*\n\tattempt to open all the members of the grouping table. We stop\n\tat the first member which cannot be opened (which implies that it\n\tcannot be located)\n      */\n\n      *status = fits_get_num_members(gfptr,&nmembers,status);\n\n      for(i = 1; i <= nmembers && *status == 0; ++i)\n\t{\n\t  *status = fits_open_member(gfptr,i,&fptr,status);\n\t  fits_close_file(fptr,status);\n\t}\n\n      /*\n\tif the status is non-zero from the above loop then record the\n\tmember index that caused the error\n      */\n\n      if(*status != 0)\n\t{\n\t  *firstfailed = i;\n\t  snprintf(errstr,FLEN_VALUE,\"Group table verify failed for member %ld (ffgtvf)\",\n\t\t  i);\n\t  ffpmsg(errstr);\n\t  continue;\n\t}\n\n      /*\n\tattempt to open all the groups linked to this grouping table. We stop\n\tat the first group which cannot be opened (which implies that it\n\tcannot be located)\n      */\n\n      *status = fits_get_num_groups(gfptr,&ngroups,status);\n\n      for(i = 1; i <= ngroups && *status == 0; ++i)\n\t{\n\t  *status = fits_open_group(gfptr,i,&fptr,status);\n\t  fits_close_file(fptr,status);\n\t}\n\n      /*\n\tif the status from the above loop is non-zero, then record the\n\tGRPIDn index of the group that caused the failure\n      */\n\n      if(*status != 0)\n\t{\n\t  *firstfailed = -1*i;\n\t  snprintf(errstr,FLEN_VALUE,\n\t\t  \"Group table verify failed for GRPID index %ld (ffgtvf)\",i);\n\t  ffpmsg(errstr);\n\t  continue;\n\t}\n\n    }while(0);\n\n  return(*status);\n}\n\n/*---------------------------------------------------------------------------*/\nint ffgtop(fitsfile *mfptr,  /* FITS file pointer to the member HDU          */\n\t   int       grpid,  /* group ID (GRPIDn index) within member HDU    */\n\t   fitsfile **gfptr, /* FITS file pointer to grouping table HDU      */\n\t   int      *status) /* return status code                           */\n\n/*\n  open the grouping table that contains the member HDU. The member HDU must\n  be the CHDU of the FITS file pointed to by mfptr, and the grouping table\n  is identified by the Nth index number of the GRPIDn keywords specified in \n  the member HDU's header. The fitsfile gfptr pointer is positioned with the\n  appropriate FITS file with the grouping table as the CHDU. If the group\n  grouping table resides in a file other than the member then an attempt\n  is first made to open the file readwrite, and failing that readonly.\n \n  Note that it is possible for the GRPIDn/GRPLCn keywords in a member \n  header to be non-continuous, e.g., GRPID1, GRPID2, GRPID5, GRPID6. In \n  such cases, the grpid index value specified in the function call shall\n  identify the (grpid)th GRPID value. In the above example, if grpid == 3,\n  then the group specified by GRPID5 would be opened.\n*/\n{\n  int i;\n  int found;\n\n  long ngroups   = 0;\n  long grpExtver = 0;\n\n  char keyword[FLEN_KEYWORD];\n  char keyvalue[FLEN_FILENAME];\n  char *tkeyvalue;\n  char location[FLEN_FILENAME];\n  char location1[FLEN_FILENAME];\n  char location2[FLEN_FILENAME];\n  char comment[FLEN_COMMENT];\n\n  char *url[2];\n\n\n  if(*status != 0) return(*status);\n\n  do\n    {\n      /* set the grouping table pointer to NULL for error checking later */\n\n      *gfptr = NULL;\n\n      /*\n\tmake sure that the group ID requested is valid ==> cannot be\n\tlarger than the number of GRPIDn keywords in the member HDU header\n      */\n\n      *status = fits_get_num_groups(mfptr,&ngroups,status);\n\n      if(grpid > ngroups)\n\t{\n\t  *status = BAD_GROUP_ID;\n\t  snprintf(comment,FLEN_COMMENT,\n\t\t  \"GRPID index %d larger total GRPID keywords %ld (ffgtop)\",\n\t\t  grpid,ngroups);\n\t  ffpmsg(comment);\n\t  continue;\n\t}\n\n      /*\n\tfind the (grpid)th group that the member HDU belongs to and read\n\tthe value of the GRPID(grpid) keyword; fits_get_num_groups()\n\tautomatically re-enumerates the GRPIDn/GRPLCn keywords to fill in\n\tany gaps\n      */\n\n      snprintf(keyword,FLEN_KEYWORD,\"GRPID%d\",grpid);\n\n      *status = fits_read_key_lng(mfptr,keyword,&grpExtver,comment,status);\n\n      if(*status != 0) continue;\n\n      /*\n\tif the value of the GRPIDn keyword is positive then the member is\n\tin the same FITS file as the grouping table and we only have to\n\treopen the current FITS file. Else the member and grouping table\n\tHDUs reside in different files and another FITS file must be opened\n\tas specified by the corresponding GRPLCn keyword\n\t\n\tThe DO WHILE loop only executes once and is used to control the\n\tfile opening logic.\n      */\n\n      do\n\t{\n\t  if(grpExtver > 0) \n\t    {\n\t      /*\n\t\tthe member resides in the same file as the grouping\n\t\t table, so just reopen the grouping table file\n\t      */\n\n\t      *status = fits_reopen_file(mfptr,gfptr,status);\n\t      continue;\n\t    }\n\n\t  else if(grpExtver == 0)\n\t    {\n\t      /* a GRPIDn value of zero (0) is undefined */\n\n\t      *status = BAD_GROUP_ID;\n\t      snprintf(comment,FLEN_COMMENT,\"Invalid value of %ld for GRPID%d (ffgtop)\",\n\t\t      grpExtver,grpid);\n\t      ffpmsg(comment);\n\t      continue;\n\t    }\n\n\t  /* \n\t     The GRPLCn keyword value is negative, which implies that\n\t     the grouping table must reside in another FITS file;\n\t     search for the corresponding GRPLCn keyword \n\t  */\n\t  \n\t  /* set the grpExtver value positive */\n  \n\t  grpExtver = -1*grpExtver;\n\n\t  /* read the GRPLCn keyword value */\n\n\t  snprintf(keyword,FLEN_KEYWORD,\"GRPLC%d\",grpid);\n\t  /* SPR 1738 */\n\t  *status = fits_read_key_longstr(mfptr,keyword,&tkeyvalue,comment,\n\t\t\t\t      status);\n\t  if (0 == *status) {\n\t    strcpy(keyvalue,tkeyvalue);\n\t    free(tkeyvalue);\n\t  }\n\t  \n\n\t  /* if the GRPLCn keyword was not found then there is a problem */\n\n\t  if(*status == KEY_NO_EXIST)\n\t    {\n\t      *status = BAD_GROUP_ID;\n\n\t      snprintf(comment,FLEN_COMMENT,\"Cannot find GRPLC%d keyword (ffgtop)\",\n\t\t      grpid);\n\t      ffpmsg(comment);\n\n\t      continue;\n\t    }\n\n\t  prepare_keyvalue(keyvalue);\n\n\t  /*\n\t    if the GRPLCn keyword value specifies an absolute URL then\n\t    try to open the file; we cannot attempt any relative URL\n\t    or host-dependent file path reconstruction\n\t  */\n\n\t  if(fits_is_url_absolute(keyvalue))\n\t    {\n\t      ffpmsg(\"Try to open group table file as absolute URL (ffgtop)\");\n\n\t      *status = fits_open_file(gfptr,keyvalue,READWRITE,status);\n\n\t      /* if the open was successful then continue */\n\n\t      if(*status == 0) continue;\n\n\t      /* if READWRITE failed then try opening it READONLY */\n\n\t      ffpmsg(\"OK, try open group table file as READONLY (ffgtop)\");\n\t      \n\t      *status = 0;\n\t      *status = fits_open_file(gfptr,keyvalue,READONLY,status);\n\n\t      /* continue regardless of the outcome */\n\n\t      continue;\n\t    }\n\n\t  /*\n\t    see if the URL gives a file path that is absolute on the\n\t    host machine \n\t  */\n\n\t  *status = fits_url2path(keyvalue,location1,status);\n\n\t  *status = fits_open_file(gfptr,location1,READWRITE,status);\n\n\t  /* if the file opened then continue */\n\n\t  if(*status == 0) continue;\n\n\t  /* if READWRITE failed then try opening it READONLY */\n\n\t  ffpmsg(\"OK, try open group table file as READONLY (ffgtop)\");\n\t  \n\t  *status = 0;\n\t  *status = fits_open_file(gfptr,location1,READONLY,status);\n\n\t  /* if the file opened then continue */\n\n\t  if(*status == 0) continue;\n\n\t  /*\n\t    the grouping table location given by GRPLCn must specify a \n\t    relative URL. We assume that this URL is relative to the \n\t    member HDU's FITS file. Try to construct a full URL location \n\t    for the grouping table's FITS file and then open it\n\t  */\n\n\t  *status = 0;\n\t\t  \n\t  /* retrieve the URL information for the member HDU's file */\n\t\t  \n\t  url[0] = location1; url[1] = location2;\n\t\t  \n\t  *status = fits_get_url(mfptr,url[0],url[1],NULL,NULL,NULL,status);\n\n\t  /*\n\t    It is possible that the member HDU file has an initial\n\t    URL it was opened with and a real URL that the file actually\n\t    exists at (e.g., an HTTP accessed file copied to a local\n\t    file). For each possible URL try to construct a\n\t  */\n\t\t  \n\t  for(i = 0, found = 0, *gfptr = NULL; i < 2 && !found; ++i)\n\t    {\n\t      \n\t      /* the url string could be empty */\n\t      \n\t      if(*url[i] == 0) continue;\n\t      \n\t      /* \n\t\t create a full URL from the partial and the member\n\t\t HDU file URL\n\t      */\n\t      \n\t      *status = fits_relurl2url(url[i],keyvalue,location,status);\n\t      \n\t      /* if an error occured then contniue */\n\t      \n\t      if(*status != 0) \n\t\t{\n\t\t  *status = 0;\n\t\t  continue;\n\t\t}\n\t      \n\t      /*\n\t\tif the location does not specify an access method\n\t\tthen turn it into a host dependent path\n\t      */\n\n\t      if(! fits_is_url_absolute(location))\n\t\t{\n\t\t  *status = fits_url2path(location,url[i],status);\n\t\t  strcpy(location,url[i]);\n\t\t}\n\t      \n\t      /* try to open the grouping table file READWRITE */\n\t      \n\t      *status = fits_open_file(gfptr,location,READWRITE,status);\n\t      \n\t      if(*status != 0)\n\t\t{    \n\t\t  /* try to open the grouping table file READONLY */\n\t\t  \n\t\t  ffpmsg(\"opening file as READWRITE failed (ffgtop)\");\n\t\t  ffpmsg(\"OK, try to open file as READONLY (ffgtop)\");\n\t\t  *status = 0;\n\t\t  *status = fits_open_file(gfptr,location,READONLY,status);\n\t\t}\n\t      \n\t      /* either set the found flag or reset the status flag */\n\t      \n\t      if(*status == 0) \n\t\tfound = 1;\n\t      else\n\t\t*status = 0;\n\t    }\n\n\t}while(0); /* end of file opening loop */\n\n      /* if an error occured with the file opening then exit */\n\n      if(*status != 0) continue;\n  \n      if(*gfptr == NULL)\n\t{\n\t  ffpmsg(\"Cannot open or find grouping table FITS file (ffgtop)\");\n\t  *status = GROUP_NOT_FOUND;\n\t  continue;\n\t}\n\n      /* search for the grouping table in its FITS file */\n\n      *status = fits_movnam_hdu(*gfptr,ANY_HDU,\"GROUPING\",(int)grpExtver,\n\t\t\t\tstatus);\n\n      if(*status != 0) *status = GROUP_NOT_FOUND;\n\n    }while(0);\n\n  if(*status != 0 && *gfptr != NULL) \n    {\n      fits_close_file(*gfptr,status);\n      *gfptr = NULL;\n    }\n\n  return(*status);\n}\n/*---------------------------------------------------------------------------*/\nint ffgtam(fitsfile *gfptr,   /* FITS file pointer to grouping table HDU     */\n\t   fitsfile *mfptr,   /* FITS file pointer to member HDU             */\n\t   int       hdupos,  /* member HDU position IF in the same file as\n\t\t\t         the grouping table AND mfptr == NULL        */\n\t   int      *status)  /* return status code                          */\n \n/*\n  add a member HDU to an existing grouping table. The fitsfile pointer gfptr\n  must be positioned with the grouping table as the CHDU. The member HDU\n  may either be identifed with the fitsfile *mfptr (which must be positioned\n  to the member HDU) or the hdupos parameter (the HDU number of the member \n  HDU) if both reside in the same FITS file. The hdupos value is only used\n  if the mfptr parameter has a value of NULL (0). The new member HDU shall \n  have the appropriate GRPIDn and GRPLCn keywords created in its header.\n\n  Note that if the member HDU to be added to the grouping table is already\n  a member of the group then it will not be added a sceond time.\n*/\n\n{\n  int xtensionCol,extnameCol,extverCol,positionCol,locationCol,uriCol;\n  int memberPosition = 0;\n  int grptype        = 0;\n  int hdutype        = 0;\n  int useLocation    = 0;\n  int nkeys          = 6;\n  int found;\n  int i;\n\n  int memberIOstate;\n  int groupIOstate;\n  int iomode;\n\n  long memberExtver = 0;\n  long groupExtver  = 0;\n  long memberID     = 0;\n  long nmembers     = 0;\n  long ngroups      = 0;\n  long grpid        = 0;\n\n  char memberAccess1[FLEN_VALUE];\n  char memberAccess2[FLEN_VALUE];\n  char memberFileName[FLEN_FILENAME];\n  char memberLocation[FLEN_FILENAME];\n  char grplc[FLEN_FILENAME];\n  char *tgrplc;\n  char memberHDUtype[FLEN_VALUE];\n  char memberExtname[FLEN_VALUE];\n  char memberURI[] = \"URL\";\n\n  char groupAccess1[FLEN_VALUE];\n  char groupAccess2[FLEN_VALUE];\n  char groupFileName[FLEN_FILENAME];\n  char groupLocation[FLEN_FILENAME];\n  char tmprootname[FLEN_FILENAME], grootname[FLEN_FILENAME];\n  char cwd[FLEN_FILENAME];\n\n  char *keys[] = {\"GRPNAME\",\"EXTVER\",\"EXTNAME\",\"TFIELDS\",\"GCOUNT\",\"EXTEND\"};\n  char *tmpPtr[1];\n\n  char keyword[FLEN_KEYWORD];\n  char card[FLEN_CARD];\n\n  unsigned char charNull[]  = {'\\0'};\n\n  fitsfile *tmpfptr = NULL;\n\n  int parentStatus = 0;\n\n  if(*status != 0) return(*status);\n\n  do\n    {\n      /*\n\tmake sure the grouping table can be modified before proceeding\n      */\n\n      fits_file_mode(gfptr,&iomode,status);\n\n      if(iomode != READWRITE)\n\t{\n\t  ffpmsg(\"cannot modify grouping table (ffgtam)\");\n\t  *status = BAD_GROUP_ATTACH;\n\t  continue;\n\t}\n\n      /*\n\t if the calling function supplied the HDU position of the member\n\t HDU instead of fitsfile pointer then get a fitsfile pointer\n      */\n\n      if(mfptr == NULL)\n\t{\n\t  *status = fits_reopen_file(gfptr,&tmpfptr,status);\n\t  *status = fits_movabs_hdu(tmpfptr,hdupos,&hdutype,status);\n\n\t  if(*status != 0) continue;\n\t}\n      else\n\ttmpfptr = mfptr;\n\n      /*\n\t determine all the information about the member HDU that will\n\t be needed later; note that we establish the default values for\n\t all information values that are not explicitly found\n      */\n\n      *status = fits_read_key_str(tmpfptr,\"XTENSION\",memberHDUtype,card,\n\t\t\t\t  status);\n\n      if(*status == KEY_NO_EXIST) \n\t{\n\t  strcpy(memberHDUtype,\"PRIMARY\");\n\t  *status = 0;\n\t}\n      prepare_keyvalue(memberHDUtype);\n\n      *status = fits_read_key_lng(tmpfptr,\"EXTVER\",&memberExtver,card,status);\n\n      if(*status == KEY_NO_EXIST) \n\t{\n\t  memberExtver = 1;\n\t  *status      = 0;\n\t}\n\n      *status = fits_read_key_str(tmpfptr,\"EXTNAME\",memberExtname,card,\n\t\t\t\t  status);\n\n      if(*status == KEY_NO_EXIST) \n\t{\n\t  memberExtname[0] = 0;\n\t  *status          = 0;\n\t}\n      prepare_keyvalue(memberExtname);\n\n      fits_get_hdu_num(tmpfptr,&memberPosition);\n\n      /*\n\tDetermine if the member HDU's FITS file location needs to be\n\ttaken into account when building its grouping table reference\n\n\tIf the member location needs to be used (==> grouping table and member\n\tHDU reside in different files) then create an appropriate URL for\n\tthe member HDU's file and grouping table's file. Note that the logic\n\tfor this is rather complicated\n      */\n\n      /* SPR 3463, don't do this \n\t if(tmpfptr->Fptr == gfptr->Fptr)\n\t {  */\n\t  /*\n\t    member HDU and grouping table reside in the same file, no need\n\t    to use the location information */\n\t  \n      /* printf (\"same file\\n\");\n\t   \n\t   useLocation     = 0;\n\t   memberIOstate   = 1;\n\t   *memberFileName = 0;\n\t}\n      else\n      { */ \n\t  /*\n\t     the member HDU and grouping table FITS file location information \n\t     must be used.\n\n\t     First determine the correct driver and file name for the group\n\t     table and member HDU files. If either are disk files then\n\t     construct an absolute file path for them. Finally, if both are\n\t     disk files construct relative file paths from the group(member)\n\t     file to the member(group) file.\n\n\t  */\n\n\t  /* set the USELOCATION flag to true */\n\n\t  useLocation = 1;\n\n\t  /* \n\t     get the location, access type and iostate (RO, RW) of the\n\t     member HDU file\n\t  */\n\n\t  *status = fits_get_url(tmpfptr,memberFileName,memberLocation,\n\t\t\t\t memberAccess1,memberAccess2,&memberIOstate,\n\t\t\t\t status);\n\n\t  /*\n\t     if the memberFileName string is empty then use the values of\n\t     the memberLocation string. This corresponds to a file where\n\t     the \"real\" file is a temporary memory file, and we must assume\n\t     the the application really wants the original file to be the\n\t     group member\n\t   */\n\n\t  if(strlen(memberFileName) == 0)\n\t    {\n\t      strcpy(memberFileName,memberLocation);\n\t      strcpy(memberAccess1,memberAccess2);\n\t    }\n\n\t  /* \n\t     get the location, access type and iostate (RO, RW) of the\n\t     grouping table file\n\t  */\n\n\t  *status = fits_get_url(gfptr,groupFileName,groupLocation,\n\t\t\t\t groupAccess1,groupAccess2,&groupIOstate,\n\t\t\t\t status);\n\t  \n\t  if(*status != 0) continue;\n\n\t  /*\n\t    the grouping table file must be writable to continue\n\t  */\n\n\t  if(groupIOstate == 0)\n\t    {\n\t      ffpmsg(\"cannot modify grouping table (ffgtam)\");\n\t      *status = BAD_GROUP_ATTACH;\n\t      continue;\n\t    }\n\n\t  /*\n\t    determine how to construct the resulting URLs for the member and\n\t    group files\n\t  */\n\n\t  if(fits_strcasecmp(groupAccess1,\"file://\")  &&\n\t                                   fits_strcasecmp(memberAccess1,\"file://\"))\n\t    {\n              *cwd = 0;\n\t      /* \n\t\t nothing to do in this case; both the member and group files\n\t\t must be of an access type that already gives valid URLs;\n\t\t i.e., URLs that we can pass directly to the file drivers\n\t      */\n\t    }\n\t  else\n\t    {\n\t      /*\n\t\t retrieve the Current Working Directory as a Unix-like\n\t\t URL standard string\n\t      */\n\n\t      *status = fits_get_cwd(cwd,status);\n\n\t      /*\n\t\t create full file path for the member HDU FITS file URL\n\t\t if it is of access type file://\n\t      */\n\t      \n\t      if(fits_strcasecmp(memberAccess1,\"file://\") == 0)\n\t\t{\n\t\t  if(*memberFileName == '/')\n\t\t    {\n\t\t      strcpy(memberLocation,memberFileName);\n\t\t    }\n\t\t  else\n\t\t    {\n\t\t      strcpy(memberLocation,cwd);\n                      if (strlen(memberLocation)+strlen(memberFileName)+1 > \n                                FLEN_FILENAME-1)\n                      {\n                         ffpmsg(\"member path and filename is too long (ffgtam)\");\n                         *status = URL_PARSE_ERROR;\n                         continue;\n                      }\n\t\t      strcat(memberLocation,\"/\");\n\t\t      strcat(memberLocation,memberFileName);\n\t\t    }\n\t\t  \n\t\t  *status = fits_clean_url(memberLocation,memberFileName,\n\t\t\t\t\t   status);\n\t\t}\n\n\t      /*\n\t\t create full file path for the grouping table HDU FITS file URL\n\t\t if it is of access type file://\n\t      */\n\n\t      if(fits_strcasecmp(groupAccess1,\"file://\") == 0)\n\t\t{\n\t\t  if(*groupFileName == '/')\n\t\t    {\n\t\t      strcpy(groupLocation,groupFileName);\n\t\t    }\n\t\t  else\n\t\t    {\n\t\t      strcpy(groupLocation,cwd);\n                      if (strlen(groupLocation)+strlen(groupFileName)+1 > \n                                FLEN_FILENAME-1)\n                      {\n                         ffpmsg(\"group path and filename is too long (ffgtam)\");\n                         *status = URL_PARSE_ERROR;\n                         continue;\n                      }\n                      \n\t\t      strcat(groupLocation,\"/\");\n\t\t      strcat(groupLocation,groupFileName);\n\t\t    }\n\t\t  \n\t\t  *status = fits_clean_url(groupLocation,groupFileName,status);\n\t\t}\n\n\t      /*\n\t\tif both the member and group files are disk files then \n\t\tcreate a relative path (relative URL) strings with \n\t\trespect to the grouping table's file and the grouping table's \n\t\tfile with respect to the member HDU's file\n\t      */\n\t      \n\t      if(fits_strcasecmp(groupAccess1,\"file://\") == 0 &&\n\t\t                      fits_strcasecmp(memberAccess1,\"file://\") == 0)\n\t\t{\n\t\t  fits_url2relurl(memberFileName,groupFileName,\n\t\t\t\t                  groupLocation,status);\n\t\t  fits_url2relurl(groupFileName,memberFileName,\n\t\t\t\t                  memberLocation,status);\n\n\t\t  /*\n\t\t     copy the resulting partial URL strings to the\n\t\t     memberFileName and groupFileName variables for latter\n\t\t     use in the function\n\t\t   */\n\t\t    \n\t\t  strcpy(memberFileName,memberLocation);\n\t\t  strcpy(groupFileName,groupLocation);\t\t  \n\t\t}\n\t    }\n\t  /* beo done */\n\t  /* }  */\n      \n\n      /* retrieve the grouping table's EXTVER value */\n\n      *status = fits_read_key_lng(gfptr,\"EXTVER\",&groupExtver,card,status);\n\n      /* \n\t if useLocation is true then make the group EXTVER value negative\n\t for the subsequent GRPIDn/GRPLCn matching\n      */\n      /* SPR 3463 change test;  WDP added test for same filename */\n      /* Now, if either the Fptr values are the same, or the root filenames\n         are the same, then assume these refer to the same file.\n      */\n      fits_parse_rootname(tmpfptr->Fptr->filename, tmprootname, status);\n      fits_parse_rootname(gfptr->Fptr->filename, grootname, status);\n\n      if((tmpfptr->Fptr != gfptr->Fptr) && \n          strncmp(tmprootname, grootname, FLEN_FILENAME))\n\t   groupExtver = -1*groupExtver;\n\n      /* retrieve the number of group members */\n\n      *status = fits_get_num_members(gfptr,&nmembers,status);\n\t      \n    do {\n\n      /*\n\t make sure the member HDU is not already an entry in the\n\t grouping table before adding it\n      */\n\n      *status = ffgmf(gfptr,memberHDUtype,memberExtname,memberExtver,\n\t\t      memberPosition,memberFileName,&memberID,status);\n\n      if(*status == MEMBER_NOT_FOUND) *status = 0;\n      else if(*status == 0)\n\t{  \n\t  parentStatus = HDU_ALREADY_MEMBER;\n    ffpmsg(\"Specified HDU is already a member of the Grouping table (ffgtam)\");\n\t  continue;\n\t}\n      else continue;\n\n      /*\n\t if the member HDU is not already recorded in the grouping table\n\t then add it \n      */\n\n      /* add a new row to the grouping table */\n\n      *status = fits_insert_rows(gfptr,nmembers,1,status);\n      ++nmembers;\n\n      /* retrieve the grouping table column IDs and structure type */\n\n      *status = ffgtgc(gfptr,&xtensionCol,&extnameCol,&extverCol,&positionCol,\n\t\t       &locationCol,&uriCol,&grptype,status);\n\n      /* fill in the member HDU data in the new grouping table row */\n\n      *tmpPtr = memberHDUtype; \n\n      if(xtensionCol != 0)\n\tfits_write_col_str(gfptr,xtensionCol,nmembers,1,1,tmpPtr,status);\n\n      *tmpPtr = memberExtname; \n\n      if(extnameCol  != 0)\n\t{\n\t  if(strlen(memberExtname) != 0)\n\t    fits_write_col_str(gfptr,extnameCol,nmembers,1,1,tmpPtr,status);\n\t  else\n\t    /* WILL THIS WORK FOR VAR LENTH CHAR COLS??????*/\n\t    fits_write_col_byt(gfptr,extnameCol,nmembers,1,1,charNull,status);\n\t}\n\n      if(extverCol   != 0)\n\tfits_write_col_lng(gfptr,extverCol,nmembers,1,1,&memberExtver,\n\t\t\t   status);\n\n      if(positionCol != 0)\n\tfits_write_col_int(gfptr,positionCol,nmembers,1,1,\n\t\t\t   &memberPosition,status);\n\n      *tmpPtr = memberFileName; \n\n      if(locationCol != 0)\n\t{\n\t  /* Change the test for SPR 3463 */\n\t  /* Now, if either the Fptr values are the same, or the root filenames\n\t     are the same, then assume these refer to the same file.\n\t  */\n\t  fits_parse_rootname(tmpfptr->Fptr->filename, tmprootname, status);\n\t  fits_parse_rootname(gfptr->Fptr->filename, grootname, status);\n\n\t  if((tmpfptr->Fptr != gfptr->Fptr) && \n\t          strncmp(tmprootname, grootname, FLEN_FILENAME))\n\t    fits_write_col_str(gfptr,locationCol,nmembers,1,1,tmpPtr,status);\n\t  else\n\t    /* WILL THIS WORK FOR VAR LENTH CHAR COLS??????*/\n\t    fits_write_col_byt(gfptr,locationCol,nmembers,1,1,charNull,status);\n\t}\n\n      *tmpPtr = memberURI;\n\n      if(uriCol      != 0)\n\t{\n\n\t  /* Change the test for SPR 3463 */\n\t  /* Now, if either the Fptr values are the same, or the root filenames\n\t     are the same, then assume these refer to the same file.\n\t  */\n\t  fits_parse_rootname(tmpfptr->Fptr->filename, tmprootname, status);\n\t  fits_parse_rootname(gfptr->Fptr->filename, grootname, status);\n\n\t  if((tmpfptr->Fptr != gfptr->Fptr) && \n\t          strncmp(tmprootname, grootname, FLEN_FILENAME))\n\t    fits_write_col_str(gfptr,uriCol,nmembers,1,1,tmpPtr,status);\n\t  else\n\t    /* WILL THIS WORK FOR VAR LENTH CHAR COLS??????*/\n\t    fits_write_col_byt(gfptr,uriCol,nmembers,1,1,charNull,status);\n\t}\n    } while(0);\n\n      if(0 != *status) continue;\n      /*\n\t add GRPIDn/GRPLCn keywords to the member HDU header to link\n\t it to the grouing table if the they do not already exist and\n\t the member file is RW\n      */\n\n      fits_file_mode(tmpfptr,&iomode,status);\n \n     if(memberIOstate == 0 || iomode != READWRITE) \n\t{\n\t  ffpmsg(\"cannot add GRPID/LC keywords to member HDU: (ffgtam)\");\n\t  ffpmsg(memberFileName);\n\t  continue;\n\t}\n\n      *status = fits_get_num_groups(tmpfptr,&ngroups,status);\n\n      /* \n\t look for the GRPID/LC keywords in the member HDU; if the keywords\n\t for the back-link to the grouping table already exist then no\n\t need to add them again\n       */\n\n      for(i = 1, found = 0; i <= ngroups && !found && *status == 0; ++i)\n\t{\n\t  snprintf(keyword,FLEN_KEYWORD,\"GRPID%d\",(int)ngroups);\n\t  *status = fits_read_key_lng(tmpfptr,keyword,&grpid,card,status);\n\n\t  if(grpid == groupExtver)\n\t    {\n\t      if(grpid < 0)\n\t\t{\n\n\t\t  /* have to make sure the GRPLCn keyword matches too */\n\n\t\t  snprintf(keyword,FLEN_KEYWORD,\"GRPLC%d\",(int)ngroups);\n\t\t  /* SPR 1738 */\n\t\t  *status = fits_read_key_longstr(mfptr,keyword,&tgrplc,card,\n\t\t\t\t\t\t  status);\n\t\t  if (0 == *status) {\n\t\t    strcpy(grplc,tgrplc);\n\t\t    free(tgrplc);\n\t\t  }\n\t\t  \n\t\t  /*\n\t\t     always compare files using absolute paths\n                     the presence of a non-empty cwd indicates\n                     that the file names may require conversion\n                     to absolute paths\n                  */\n\n                  if(0 < strlen(cwd)) {\n                    /* temp buffer for use in assembling abs. path(s) */\n                    char tmp[FLEN_FILENAME];\n\n                    /* make grplc absolute if necessary */\n                    if(!fits_is_url_absolute(grplc)) {\n\t\t      fits_path2url(grplc,FLEN_FILENAME,groupLocation,status);\n\n\t\t      if(groupLocation[0] != '/')\n\t\t\t{\n\t\t\t  strcpy(tmp, cwd);\n                          if (strlen(tmp)+strlen(groupLocation)+1 > \n                                    FLEN_FILENAME-1)\n                          {\n                             ffpmsg(\"path and group location is too long (ffgtam)\");\n                             *status = URL_PARSE_ERROR;\n                             continue;\n                          }\n\t\t\t  strcat(tmp,\"/\");\n\t\t\t  strcat(tmp,groupLocation);\n\t\t\t  fits_clean_url(tmp,grplc,status);\n\t\t\t}\n                    }\n\n                    /* make groupFileName absolute if necessary */\n                    if(!fits_is_url_absolute(groupFileName)) {\n\t\t      fits_path2url(groupFileName,FLEN_FILENAME,groupLocation,status);\n\n\t\t      if(groupLocation[0] != '/')\n\t\t\t{\n\t\t\t  strcpy(tmp, cwd);\n                          if (strlen(tmp)+strlen(groupLocation)+1 > \n                                    FLEN_FILENAME-1)\n                          {\n                             ffpmsg(\"path and group location is too long (ffgtam)\");\n                             *status = URL_PARSE_ERROR;\n                             continue;\n                          }\n\t\t\t  strcat(tmp,\"/\");\n\t\t\t  strcat(tmp,groupLocation);\n                          /*\n                             note: use groupLocation (which is not used\n                             below this block), to store the absolute\n                             file name instead of using groupFileName.\n                             The latter may be needed unaltered if the\n                             GRPLC is written below\n                          */\n\n\t\t\t  fits_clean_url(tmp,groupLocation,status);\n\t\t\t}\n                    }\n                  }\n\t\t  /*\n\t\t    see if the grplc value and the group file name match\n\t\t  */\n\n\t\t  if(strcmp(grplc,groupLocation) == 0) found = 1;\n\t\t}\n\t      else\n\t\t{\n\t\t  /* the match is found with GRPIDn alone */\n\t\t  found = 1;\n\t\t}\n\t    }\n\t}\n\n      /*\n\t if FOUND is true then no need to continue\n      */\n\n      if(found)\n\t{\n\t  ffpmsg(\"HDU already has GRPID/LC keywords for group table (ffgtam)\");\n\t  continue;\n\t}\n\n      /*\n\t add the GRPID/LC keywords to the member header for this grouping\n\t table\n\t \n\t If NGROUPS == 0 then we must position the header pointer to the\n\t record where we want to insert the GRPID/LC keywords (the pointer\n\t is already correctly positioned if the above search loop activiated)\n      */\n\n      if(ngroups == 0)\n\t{\n\t  /* \n\t     no GRPIDn/GRPLCn keywords currently exist in header so try\n\t     to position the header pointer to a desirable position\n\t  */\n\t  \n\t  for(i = 0, *status = KEY_NO_EXIST; \n\t                       i < nkeys && *status == KEY_NO_EXIST; ++i)\n\t    {\n\t      *status = 0;\n\t      *status = fits_read_card(tmpfptr,keys[i],card,status);\n\t    }\n\t      \n\t  /* all else fails: move write pointer to end of header */\n\t      \n\t  if(*status == KEY_NO_EXIST)\n\t    {\n\t      *status = 0;\n\t      fits_get_hdrspace(tmpfptr,&nkeys,&i,status);\n\t      ffgrec(tmpfptr,nkeys,card,status);\n\t    }\n\t  \n\t  /* any other error status then abort */\n\t  \n\t  if(*status != 0) continue;\n\t}\n      \n      /* \n\t now that the header pointer is positioned for the GRPID/LC \n\t keyword insertion increment the number of group links counter for \n\t the member HDU \n      */\n\n      ++ngroups;\n\n      /*\n\t if the member HDU and grouping table reside in the same FITS file\n\t then there is no need to add a GRPLCn keyword\n      */\n      /* SPR 3463 change test */\n      /* Now, if either the Fptr values are the same, or the root filenames\n\t are the same, then assume these refer to the same file.\n      */\n      fits_parse_rootname(tmpfptr->Fptr->filename, tmprootname, status);\n      fits_parse_rootname(gfptr->Fptr->filename, grootname, status);\n\n      if((tmpfptr->Fptr == gfptr->Fptr) || \n\t          strncmp(tmprootname, grootname, FLEN_FILENAME) == 0)\n\t{\n\t  /* add the GRPIDn keyword only */\n\n\t  snprintf(keyword,FLEN_KEYWORD,\"GRPID%d\",(int)ngroups);\n\t  fits_insert_key_lng(tmpfptr,keyword,groupExtver,\n\t\t\t      \"EXTVER of Group containing this HDU\",status);\n\t}\n      else \n\t{\n\t  /* add the GRPIDn and GRPLCn keywords */\n\n\t  snprintf(keyword,FLEN_KEYWORD,\"GRPID%d\",(int)ngroups);\n\t  fits_insert_key_lng(tmpfptr,keyword,groupExtver,\n\t\t\t      \"EXTVER of Group containing this HDU\",status);\n\n\t  snprintf(keyword,FLEN_KEYWORD,\"GRPLC%d\",(int)ngroups);\n\t  /* SPR 1738 */\n\t  fits_insert_key_longstr(tmpfptr,keyword,groupFileName,\n\t\t\t      \"URL of file containing Group\",status);\n\t  fits_write_key_longwarn(tmpfptr,status);\n\n\t}\n\n    }while(0);\n\n  /* close the tmpfptr pointer if it was opened in this function */\n\n  if(mfptr == NULL)\n    {\n      *status = fits_close_file(tmpfptr,status);\n    }\n\n  *status = 0 == *status ? parentStatus : *status;\n\n  return(*status);\n}\n\n/*---------------------------------------------------------------------------*/\nint ffgtnm(fitsfile *gfptr,    /* FITS file pointer to grouping table        */\n\t   long     *nmembers, /* member count  of the groping table         */\n\t   int      *status)   /* return status code                         */\n\n/*\n  return the number of member HDUs in a grouping table. The fitsfile pointer\n  gfptr must be positioned with the grouping table as the CHDU. The number\n  of grouping table member HDUs is just the NAXIS2 value of the grouping\n  table.\n*/\n\n{\n  char keyvalue[FLEN_VALUE];\n  char comment[FLEN_COMMENT];\n  \n\n  if(*status != 0) return(*status);\n\n  *status = fits_read_keyword(gfptr,\"EXTNAME\",keyvalue,comment,status);\n  \n  if(*status == KEY_NO_EXIST)\n    *status = NOT_GROUP_TABLE;\n  else\n    {\n      prepare_keyvalue(keyvalue);\n\n      if(fits_strcasecmp(keyvalue,\"GROUPING\") != 0)\n\t{\n\t  *status = NOT_GROUP_TABLE;\n\t  ffpmsg(\"Specified HDU is not a Grouping table (ffgtnm)\");\n\t}\n\n      *status = fits_read_key_lng(gfptr,\"NAXIS2\",nmembers,comment,status);\n    }\n\n  return(*status);\n}\n\n/*--------------------------------------------------------------------------*/\nint ffgmng(fitsfile *mfptr,   /* FITS file pointer to member HDU            */\n\t   long     *ngroups, /* total number of groups linked to HDU       */\n\t   int      *status)  /* return status code                         */\n\n/*\n  return the number of groups to which a HDU belongs, as defined by the number\n  of GRPIDn/GRPLCn keyword records that appear in the HDU header. The \n  fitsfile pointer mfptr must be positioned with the member HDU as the CHDU. \n  Each time this function is called, the indicies of the GRPIDn/GRPLCn\n  keywords are checked to make sure they are continuous (ie no gaps) and\n  are re-enumerated to eliminate gaps if gaps are found to be present.\n*/\n\n{\n  int offset;\n  int index;\n  int newIndex;\n  int i;\n  \n  long grpid;\n\n  char *inclist[] = {\"GRPID#\"};\n  char keyword[FLEN_KEYWORD];\n  char newKeyword[FLEN_KEYWORD];\n  char card[FLEN_CARD];\n  char comment[FLEN_COMMENT];\n  char *tkeyvalue;\n\n  if(*status != 0) return(*status);\n\n  *ngroups = 0;\n\n  /* reset the member HDU keyword counter to the beginning */\n\n  *status = ffgrec(mfptr,0,card,status);\n  \n  /*\n    search for the number of GRPIDn keywords in the member HDU header\n    and count them with the ngroups variable\n  */\n  \n  while(*status == 0)\n    {\n      /* read the next GRPIDn keyword in the series */\n\n      *status = fits_find_nextkey(mfptr,inclist,1,NULL,0,card,status);\n      \n      if(*status != 0) continue;\n      \n      ++(*ngroups);\n    }\n\n  if(*status == KEY_NO_EXIST) *status = 0;\n      \n  /*\n     read each GRPIDn/GRPLCn keyword and adjust their index values so that\n     there are no gaps in the index count\n  */\n\n  for(index = 1, offset = 0, i = 1; i <= *ngroups && *status == 0; ++index)\n    {\t  \n      snprintf(keyword,FLEN_KEYWORD,\"GRPID%d\",index);\n\n      /* try to read the next GRPIDn keyword in the series */\n\n      *status = fits_read_key_lng(mfptr,keyword,&grpid,card,status);\n\n      /* if not found then increment the offset counter and continue */\n\n      if(*status == KEY_NO_EXIST) \n\t{\n\t  *status = 0;\n\t  ++offset;\n\t}\n      else\n\t{\n\t  /* \n\t     increment the number_keys_found counter and see if the index\n\t     of the keyword needs to be updated\n\t  */\n\n\t  ++i;\n\n\t  if(offset > 0)\n\t    {\n\t      /* compute the new index for the GRPIDn/GRPLCn keywords */\n\t      newIndex = index - offset;\n\n\t      /* update the GRPIDn keyword index */\n\n\t      snprintf(newKeyword,FLEN_KEYWORD,\"GRPID%d\",newIndex);\n\t      fits_modify_name(mfptr,keyword,newKeyword,status);\n\n\t      /* If present, update the GRPLCn keyword index */\n\n\t      snprintf(keyword,FLEN_KEYWORD,\"GRPLC%d\",index);\n\t      snprintf(newKeyword,FLEN_KEYWORD,\"GRPLC%d\",newIndex);\n\t      /* SPR 1738 */\n\t      *status = fits_read_key_longstr(mfptr,keyword,&tkeyvalue,comment,\n\t\t\t\t\t      status);\n\t      if (0 == *status) {\n\t\tfits_delete_key(mfptr,keyword,status);\n\t\tfits_insert_key_longstr(mfptr,newKeyword,tkeyvalue,comment,status);\n\t\tfits_write_key_longwarn(mfptr,status);\n\t\tfree(tkeyvalue);\n\t      }\n\t      \n\n\t      if(*status == KEY_NO_EXIST) *status = 0;\n\t    }\n\t}\n    }\n\n  return(*status);\n}\n\n/*---------------------------------------------------------------------------*/\nint ffgmop(fitsfile *gfptr,  /* FITS file pointer to grouping table          */\n\t   long      member, /* member ID (row num) within grouping table    */\n\t   fitsfile **mfptr, /* FITS file pointer to member HDU              */\n\t   int      *status) /* return status code                           */\n\n/*\n  open a grouping table member, returning a pointer to the member's FITS file\n  with the CHDU set to the member HDU. The grouping table must be the CHDU of\n  the FITS file pointed to by gfptr. The member to open is identified by its\n  row number within the grouping table (first row/member == 1).\n\n  If the member resides in a FITS file different from the grouping\n  table the member file is first opened readwrite and if this fails then\n  it is opened readonly. For access type of FILE:// the member file is\n  searched for assuming (1) an absolute path is given, (2) a path relative\n  to the CWD is given, and (3) a path relative to the grouping table file\n  but not relative to the CWD is given. If all of these fail then the\n  error FILE_NOT_FOUND is returned.\n*/\n\n{\n  int xtensionCol,extnameCol,extverCol,positionCol,locationCol,uriCol;\n  int grptype,hdutype;\n  int dummy;\n\n  long hdupos = 0;\n  long extver = 0;\n\n  char  xtension[FLEN_VALUE];\n  char  extname[FLEN_VALUE];\n  char  uri[FLEN_VALUE];\n  char  grpLocation1[FLEN_FILENAME];\n  char  grpLocation2[FLEN_FILENAME];\n  char  mbrLocation1[FLEN_FILENAME];\n  char  mbrLocation2[FLEN_FILENAME];\n  char  mbrLocation3[FLEN_FILENAME];\n  char  cwd[FLEN_FILENAME];\n  char  card[FLEN_CARD];\n  char  nstr[] = {'\\0'};\n  char *tmpPtr[1];\n\n\n  if(*status != 0) return(*status);\n\n  do\n    {\n      /*\n\tretrieve the Grouping Convention reserved column positions within\n\tthe grouping table\n      */\n\n      *status = ffgtgc(gfptr,&xtensionCol,&extnameCol,&extverCol,&positionCol,\n\t\t       &locationCol,&uriCol,&grptype,status);\n\n      if(*status != 0) continue;\n      \n      /* verify the column formats */\n      \n      *status = ffvcfm(gfptr,xtensionCol,extnameCol,extverCol,positionCol,\n\t\t       locationCol,uriCol,status);\n\n      if(*status != 0) continue;\n      \n      /*\n\t extract the member information from grouping table\n      */\n\n      tmpPtr[0] = xtension;\n\n      if(xtensionCol != 0)\n\t{\n\n\t  *status = fits_read_col_str(gfptr,xtensionCol,member,1,1,nstr,\n\t\t\t\t      tmpPtr,&dummy,status);\n\n\t  /* convert the xtension string to a hdutype code */\n\n\t  if(fits_strcasecmp(xtension,\"PRIMARY\")       == 0) hdutype = IMAGE_HDU; \n\t  else if(fits_strcasecmp(xtension,\"IMAGE\")    == 0) hdutype = IMAGE_HDU; \n\t  else if(fits_strcasecmp(xtension,\"TABLE\")    == 0) hdutype = ASCII_TBL; \n\t  else if(fits_strcasecmp(xtension,\"BINTABLE\") == 0) hdutype = BINARY_TBL; \n\t  else hdutype = ANY_HDU; \n\t}\n\n      tmpPtr[0] = extname;\n\n      if(extnameCol  != 0)\n\t  *status = fits_read_col_str(gfptr,extnameCol,member,1,1,nstr,\n\t\t\t\t      tmpPtr,&dummy,status);\n\n      if(extverCol   != 0)\n\t  *status = fits_read_col_lng(gfptr,extverCol,member,1,1,0,\n\t\t\t\t      (long*)&extver,&dummy,status);\n\n      if(positionCol != 0)\n\t  *status = fits_read_col_lng(gfptr,positionCol,member,1,1,0,\n\t\t\t\t      (long*)&hdupos,&dummy,status);\n\n      tmpPtr[0] = mbrLocation1;\n\n      if(locationCol != 0)\n\t*status = fits_read_col_str(gfptr,locationCol,member,1,1,nstr,\n\t\t\t\t    tmpPtr,&dummy,status);\n      tmpPtr[0] = uri;\n\n      if(uriCol != 0)\n\t*status = fits_read_col_str(gfptr,uriCol,member,1,1,nstr,\n\t\t\t\t    tmpPtr,&dummy,status);\n\n      if(*status != 0) continue;\n\n      /* \n\t decide what FITS file the member HDU resides in and open the file\n\t using the fitsfile* pointer mfptr; note that this logic is rather\n\t complicated and is based primiarly upon if a URL specifier is given\n\t for the member file in the grouping table\n      */\n\n      switch(grptype)\n\t{\n\n\tcase GT_ID_POS:\n\tcase GT_ID_REF:\n\tcase GT_ID_ALL:\n\n\t  /*\n\t     no location information is given so we must assume that the\n\t     member HDU resides in the same FITS file as the grouping table;\n\t     if the grouping table was incorrectly constructed then this\n\t     assumption will be false, but there is nothing to be done about\n\t     it at this point\n\t  */\n\n\t  *status = fits_reopen_file(gfptr,mfptr,status);\n\t  \n\t  break;\n\n\tcase GT_ID_REF_URI:\n\tcase GT_ID_POS_URI:\n\tcase GT_ID_ALL_URI:\n\n\t  /*\n\t    The member location column exists. Determine if the member \n\t    resides in the same file as the grouping table or in a\n\t    separate file; open the member file in either case\n\t  */\n\n\t  if(strlen(mbrLocation1) == 0)\n\t    {\n\t      /*\n\t\t since no location information was given we must assume\n\t\t that the member is in the same FITS file as the grouping\n\t\t table\n\t      */\n\n\t      *status = fits_reopen_file(gfptr,mfptr,status);\n\t    }\n\t  else\n\t    {\n\t      /*\n\t\tmake sure the location specifiation is \"URL\"; we cannot\n\t\tdecode any other URI types at this time\n\t      */\n\n\t      if(fits_strcasecmp(uri,\"URL\") != 0)\n\t\t{\n\t\t  *status = FILE_NOT_OPENED;\n\t\t  snprintf(card,FLEN_CARD,\n\t\t  \"Cannot open member HDU file with URI type %s (ffgmop)\",\n\t\t\t  uri);\n\t\t  ffpmsg(card);\n\n\t\t  continue;\n\t\t}\n\n\t      /*\n\t\tThe location string for the member is not NULL, so it \n\t\tdoes not necessially reside in the same FITS file as the\n\t\tgrouping table. \n\n\t\tThree cases are attempted for opening the member's file\n\t\tin the following order:\n\n\t\t1. The URL given for the member's file is absolute (i.e.,\n\t\taccess method supplied); try to open the member\n\n\t\t2. The URL given for the member's file is not absolute but\n\t\tis an absolute file path; try to open the member as a file\n\t\tafter the file path is converted to a host-dependent form\n\n\t\t3. The URL given for the member's file is not absolute\n\t        and is given as a relative path to the location of the \n\t\tgrouping table's file. Create an absolute URL using the \n\t\tgrouping table's file URL and try to open the member.\n\t\t\n\t\tIf all three cases fail then an error is returned. In each\n\t\tcase the file is first opened in read/write mode and failing\n\t\tthat readonly mode.\n\t\t\n\t\tThe following DO loop is only used as a mechanism to break\n\t\t(continue) when the proper file opening method is found\n\t       */\n\n\t      do\n\t\t{\n\t\t  /*\n\t\t     CASE 1:\n\n\t\t     See if the member URL is absolute (i.e., includes a\n\t\t     access directive) and if so open the file\n\t\t   */\n\n\t\t  if(fits_is_url_absolute(mbrLocation1))\n\t\t    {\n\t\t      /*\n\t\t\t the URL must specify an access method, which \n\t\t\t implies that its an absolute reference\n\t\t\t \n\t\t\t regardless of the access method, pass the whole\n\t\t\t URL to the open function for processing\n\t\t       */\n\t\t      \n\t\t      ffpmsg(\"member URL is absolute, try open R/W (ffgmop)\");\n\n\t\t      *status = fits_open_file(mfptr,mbrLocation1,READWRITE,\n\t\t\t\t\t       status);\n\n\t\t      if(*status == 0) continue;\n\n\t\t      *status = 0;\n\n\t\t      /* \n\t\t\t now try to open file using full URL specs in \n\t\t\t readonly mode \n\t\t      */ \n\n\t\t      ffpmsg(\"OK, now try to open read-only (ffgmop)\");\n\n\t\t      *status = fits_open_file(mfptr,mbrLocation1,READONLY,\n\t\t\t\t\t       status);\n\n\t\t      /* break from DO loop regardless of status */\n\n\t\t      continue;\n\t\t    }\n\n\t\t  /*\n\t\t     CASE 2:\n\n\t\t     If we got this far then the member URL location \n\t\t     has no access type ==> FILE:// Try to open the member \n\t\t     file using the URL as is, i.e., assume that it is given \n\t\t     as absolute, if it starts with a '/' character\n\t\t   */\n\n\t\t  ffpmsg(\"Member URL is of type FILE (ffgmop)\");\n\n\t\t  if(*mbrLocation1 == '/')\n\t\t    {\n\t\t      ffpmsg(\"Member URL specifies abs file path (ffgmop)\");\n\n\t\t      /* \n\t\t\t convert the URL path to a host dependent path\n\t\t      */\n\n\t\t      *status = fits_url2path(mbrLocation1,mbrLocation2,\n\t\t\t\t\t      status);\n\n\t\t      ffpmsg(\"Try to open member URL in R/W mode (ffgmop)\");\n\n\t\t      *status = fits_open_file(mfptr,mbrLocation2,READWRITE,\n\t\t\t\t\t       status);\n\n\t\t      if(*status == 0) continue;\n\n\t\t      *status = 0;\n\n\t\t      /* \n\t\t\t now try to open file using the URL as an absolute \n\t\t\t path in readonly mode \n\t\t      */\n \n\t\t      ffpmsg(\"OK, now try to open read-only (ffgmop)\");\n\n\t\t      *status = fits_open_file(mfptr,mbrLocation2,READONLY,\n\t\t\t\t\t       status);\n\n\t\t      /* break from the Do loop regardless of the status */\n\n\t\t      continue;\n\t\t    }\n\t\t  \n\t\t  /* \n\t\t     CASE 3:\n\n\t\t     If we got this far then the URL does not specify an\n\t\t     absoulte file path or URL with access method. Since \n\t\t     the path to the group table's file is (obviously) valid \n\t\t     for the CWD, create a full location string for the\n\t\t     member HDU using the grouping table URL as a basis\n\n\t\t     The only problem is that the grouping table file might\n\t\t     have two URLs, the original one used to open it and\n\t\t     the one that points to the real file being accessed\n\t\t     (i.e., a file accessed via HTTP but transferred to a\n\t\t     local disk file). Have to attempt to build a URL to\n\t\t     the member HDU file using both of these URLs if\n\t\t     defined.\n\t\t  */\n\n\t\t  ffpmsg(\"Try to open member file as relative URL (ffgmop)\");\n\n\t\t  /* get the URL information for the grouping table file */\n\n\t\t  *status = fits_get_url(gfptr,grpLocation1,grpLocation2,\n\t\t\t\t\t NULL,NULL,NULL,status);\n\n\t\t  /* \n\t\t     if the \"real\" grouping table file URL is defined then\n\t\t     build a full url for the member HDU file using it\n\t\t     and try to open the member HDU file\n\t\t  */\n\n\t\t  if(*grpLocation1)\n\t\t    {\n\t\t      /* make sure the group location is absolute */\n\n\t\t      if(! fits_is_url_absolute(grpLocation1) &&\n\t\t\t                              *grpLocation1 != '/')\n\t\t\t{\n\t\t\t  fits_get_cwd(cwd,status);\n\t\t\t  strcat(cwd,\"/\");\n                          if (strlen(cwd)+strlen(grpLocation1)+1 > \n                                    FLEN_FILENAME-1)\n                          {\n                             ffpmsg(\"cwd and group location1 is too long (ffgmop)\");\n                             *status = URL_PARSE_ERROR;\n                             continue;\n                          }\n\t\t\t  strcat(cwd,grpLocation1);\n\t\t\t  strcpy(grpLocation1,cwd);\n\t\t\t}\n\n\t\t      /* create a full URL for the member HDU file */\n\n\t\t      *status = fits_relurl2url(grpLocation1,mbrLocation1,\n\t\t\t\t\t\tmbrLocation2,status);\n\n\t\t      if(*status != 0) continue;\n\n\t\t      /*\n\t\t\tif the URL does not have an access method given then\n\t\t\ttranslate it into a host dependent file path\n\t\t      */\n\n\t\t      if(! fits_is_url_absolute(mbrLocation2))\n\t\t\t{\n\t\t\t  *status = fits_url2path(mbrLocation2,mbrLocation3,\n\t\t\t\t\t\t  status);\n\t\t\t  strcpy(mbrLocation2,mbrLocation3);\n\t\t\t}\n\n\t\t      /* try to open the member file READWRITE */\n\n\t\t      *status = fits_open_file(mfptr,mbrLocation2,READWRITE,\n\t\t\t\t\t       status);\n\n\t\t      if(*status == 0) continue;\n\n\t\t      *status = 0;\n\t\t  \n\t\t      /* now try to open in readonly mode */ \n\n\t\t      ffpmsg(\"now try to open file as READONLY (ffgmop)\");\n\n\t\t      *status = fits_open_file(mfptr,mbrLocation2,READONLY,\n\t\t\t\t\t       status);\n\n\t\t      if(*status == 0) continue;\n\n\t\t      *status = 0;\n\t\t    }\n\n\t\t  /* \n\t\t     if we got this far then either the \"real\" grouping table\n\t\t     file URL was not defined or all attempts to open the\n\t\t     resulting member HDU file URL failed.\n\n\t\t     if the \"original\" grouping table file URL is defined then\n\t\t     build a full url for the member HDU file using it\n\t\t     and try to open the member HDU file\n\t\t  */\n\n\t\t  if(*grpLocation2)\n\t\t    {\n\t\t      /* make sure the group location is absolute */\n\n\t\t      if(! fits_is_url_absolute(grpLocation2) &&\n\t\t\t                              *grpLocation2 != '/')\n\t\t\t{\n\t\t\t  fits_get_cwd(cwd,status);\n                          if (strlen(cwd)+strlen(grpLocation2)+1 > \n                                    FLEN_FILENAME-1)\n                          {\n                             ffpmsg(\"cwd and group location2 is too long (ffgmop)\");\n                             *status = URL_PARSE_ERROR;\n                             continue;\n                          }\n\t\t\t  strcat(cwd,\"/\");\n\t\t\t  strcat(cwd,grpLocation2);\n\t\t\t  strcpy(grpLocation2,cwd);\n\t\t\t}\n\n\t\t      /* create an absolute URL for the member HDU file */\n\n\t\t      *status = fits_relurl2url(grpLocation2,mbrLocation1,\n\t\t\t\t\t\tmbrLocation2,status);\n\t\t      if(*status != 0) continue;\n\n\t\t      /*\n\t\t\tif the URL does not have an access method given then\n\t\t\ttranslate it into a host dependent file path\n\t\t      */\n\n\t\t      if(! fits_is_url_absolute(mbrLocation2))\n\t\t\t{\n\t\t\t  *status = fits_url2path(mbrLocation2,mbrLocation3,\n\t\t\t\t\t\t  status);\n\t\t\t  strcpy(mbrLocation2,mbrLocation3);\n\t\t\t}\n\n\t\t      /* try to open the member file READWRITE */\n\n\t\t      *status = fits_open_file(mfptr,mbrLocation2,READWRITE,\n\t\t\t\t\t       status);\n\n\t\t      if(*status == 0) continue;\n\n\t\t      *status = 0;\n\t\t  \n\t\t      /* now try to open in readonly mode */ \n\n\t\t      ffpmsg(\"now try to open file as READONLY (ffgmop)\");\n\n\t\t      *status = fits_open_file(mfptr,mbrLocation2,READONLY,\n\t\t\t\t\t       status);\n\n\t\t      if(*status == 0) continue;\n\n\t\t      *status = 0;\n\t\t    }\n\n\t\t  /*\n\t\t     if we got this far then the member HDU file could not\n\t\t     be opened using any method. Log the error.\n\t\t  */\n\n\t\t  ffpmsg(\"Cannot open member HDU FITS file (ffgmop)\");\n\t\t  *status = MEMBER_NOT_FOUND;\n\t\t  \n\t\t}while(0);\n\t    }\n\n\t  break;\n\n\tdefault:\n\n\t  /* no default action */\n\t  \n\t  break;\n\t}\n\t  \n      if(*status != 0) continue;\n\n      /*\n\t attempt to locate the member HDU within its FITS file as determined\n\t and opened above\n      */\n\n      switch(grptype)\n\t{\n\n\tcase GT_ID_POS:\n\tcase GT_ID_POS_URI:\n\n\t  /*\n\t    try to find the member hdu in the the FITS file pointed to\n\t    by mfptr based upon its HDU posistion value. Note that is \n\t    impossible to verify if the HDU is actually the correct HDU due \n\t    to a lack of information.\n\t  */\n\t  \n\t  *status = fits_movabs_hdu(*mfptr,(int)hdupos,&hdutype,status);\n\n\t  break;\n\n\tcase GT_ID_REF:\n\tcase GT_ID_REF_URI:\n\n\t  /*\n\t     try to find the member hdu in the FITS file pointed to\n\t     by mfptr based upon its XTENSION, EXTNAME and EXTVER keyword \n\t     values\n\t  */\n\n\t  *status = fits_movnam_hdu(*mfptr,hdutype,extname,extver,status);\n\n\t  if(*status == BAD_HDU_NUM) \n\t    {\n\t      *status = MEMBER_NOT_FOUND;\n\t      ffpmsg(\"Cannot find specified member HDU (ffgmop)\");\n\t    }\n\n\t  /*\n\t     if the above function returned without error then the\n\t     mfptr is pointed to the member HDU\n\t  */\n\n\t  break;\n\n\tcase GT_ID_ALL:\n\tcase GT_ID_ALL_URI:\n\n\t  /*\n\t     if the member entry has reference information then use it\n             (ID by reference is safer than ID by position) else use\n\t     the position information\n\t  */\n\n\t  if(strlen(xtension) > 0 && strlen(extname) > 0 && extver > 0)\n\t    {\n\t      /* valid reference info exists so use it */\n\t      \n\t      /* try to find the member hdu in the grouping table's file */\n\n\t      *status = fits_movnam_hdu(*mfptr,hdutype,extname,extver,status);\n\n\t      if(*status == BAD_HDU_NUM) \n\t\t{\n\t\t  *status = MEMBER_NOT_FOUND;\n\t\t  ffpmsg(\"Cannot find specified member HDU (ffgmop)\");\n\t\t}\n\t    }\n\t  else\n\t      {\n\t\t  *status = fits_movabs_hdu(*mfptr,(int)hdupos,&hdutype,\n\t\t\t\t\t    status);\n\t\t  if(*status == END_OF_FILE) *status = MEMBER_NOT_FOUND;\n\t      }\n\n\t  /*\n\t     if the above function returned without error then the\n\t     mfptr is pointed to the member HDU\n\t  */\n\n\t  break;\n\n\tdefault:\n\n\t  /* no default action */\n\n\t  break;\n\t}\n      \n    }while(0);\n\n  if(*status != 0 && *mfptr != NULL) \n    {\n      fits_close_file(*mfptr,status);\n    }\n\n  return(*status);\n}\n\n/*---------------------------------------------------------------------------*/\nint ffgmcp(fitsfile *gfptr,  /* FITS file pointer to group                   */\n\t   fitsfile *mfptr,  /* FITS file pointer to new member\n\t\t\t\tFITS file                                    */\n\t   long      member, /* member ID (row num) within grouping table    */\n\t   int       cpopt,  /* code specifying copy options:\n\t\t\t\tOPT_MCP_ADD  (0) ==> add copied member to the\n \t\t\t\t                     grouping table\n\t\t\t\tOPT_MCP_NADD (1) ==> do not add member copy to\n\t\t\t\t                     the grouping table\n\t\t\t\tOPT_MCP_REPL (2) ==> replace current member\n\t\t\t\t                     entry with member copy  */\n\t   int      *status) /* return status code                           */\n\t   \n/*\n  copy a member HDU of a grouping table to a new FITS file. The grouping table\n  must be the CHDU of the FITS file pointed to by gfptr. The copy of the\n  group member shall be appended to the end of the FITS file pointed to by\n  mfptr. If the cpopt parameter is set to OPT_MCP_ADD then the copy of the \n  member is added to the grouping table as a new member, if OPT_MCP_NADD \n  then the copied member is not added to the grouping table, and if \n  OPT_MCP_REPL then the copied member is used to replace the original member.\n  The copied member HDU also has its EXTVER value updated so that its\n  combination of XTENSION, EXTNAME and EXVTER is unique within its new\n  FITS file.\n*/\n\n{\n  int numkeys = 0;\n  int keypos  = 0;\n  int hdunum  = 0;\n  int hdutype = 0;\n  int i;\n  \n  char *incList[] = {\"GRPID#\",\"GRPLC#\"};\n  char  extname[FLEN_VALUE];\n  char  card[FLEN_CARD];\n  char  comment[FLEN_COMMENT];\n  char  keyname[FLEN_CARD];\n  char  value[FLEN_CARD];\n\n  fitsfile *tmpfptr = NULL;\n\n\n  if(*status != 0) return(*status);\n\n  do\n    {\n      /* open the member HDU to be copied */\n\n      *status = fits_open_member(gfptr,member,&tmpfptr,status);\n\n      if(*status != 0) continue;\n\n      /*\n\tif the member is a grouping table then copy it with a call to\n\tfits_copy_group() using the \"copy only the grouping table\" option\n\n\tif it is not a grouping table then copy the hdu with fits_copy_hdu()\n\tremove all GRPIDn and GRPLCn keywords, and update the EXTVER keyword\n\tvalue\n      */\n\n      /* get the member HDU's EXTNAME value */\n\n      *status = fits_read_key_str(tmpfptr,\"EXTNAME\",extname,comment,status);\n\n      /* if no EXTNAME value was found then set the extname to a null string */\n\n      if(*status == KEY_NO_EXIST) \n\t{\n\t  extname[0] = 0;\n\t  *status    = 0;\n\t}\n      else if(*status != 0) continue;\n\n      prepare_keyvalue(extname);\n\n      /* if a grouping table then copy with fits_copy_group() */\n\n      if(fits_strcasecmp(extname,\"GROUPING\") == 0)\n\t*status = fits_copy_group(tmpfptr,mfptr,OPT_GCP_GPT,status);\n      else\n\t{\n\t  /* copy the non-grouping table HDU the conventional way */\n\n\t  *status = fits_copy_hdu(tmpfptr,mfptr,0,status);\n\n\t  ffgrec(mfptr,0,card,status);\n\n\t  /* delete all the GRPIDn and GRPLCn keywords in the copied HDU */\n\n\t  while(*status == 0)\n\t    {\n\t      *status = fits_find_nextkey(mfptr,incList,2,NULL,0,card,status);\n\t      *status = fits_get_hdrpos(mfptr,&numkeys,&keypos,status);  \n\t      /* SPR 1738 */\n\t      *status = fits_read_keyn(mfptr,keypos-1,keyname,value,\n\t\t\t\t       comment,status);\n\t      *status = fits_read_record(mfptr,keypos-1,card,status);\n\t      *status = fits_delete_key(mfptr,keyname,status);\n\t    }\n\n\t  if(*status == KEY_NO_EXIST) *status = 0;\n\t  if(*status != 0) continue;\n\t}\n\n      /* \n\t if the member HDU does not have an EXTNAME keyword then add one\n\t with a default value\n      */\n\n      if(strlen(extname) == 0)\n\t{\n\t  if(fits_get_hdu_num(tmpfptr,&hdunum) == 1)\n\t    {\n\t      strcpy(extname,\"PRIMARY\");\n\t      *status = fits_write_key_str(mfptr,\"EXTNAME\",extname,\n\t\t\t\t\t   \"HDU was Formerly a Primary Array\",\n\t\t\t\t\t   status);\n\t    }\n\t  else\n\t    {\n\t      strcpy(extname,\"DEFAULT\");\n\t      *status = fits_write_key_str(mfptr,\"EXTNAME\",extname,\n\t\t\t\t\t   \"default EXTNAME set by CFITSIO\",\n\t\t\t\t\t   status);\n\t    }\n\t}\n\n      /* \n\t update the member HDU's EXTVER value (add it if not present)\n      */\n\n      fits_get_hdu_num(mfptr,&hdunum);\n      fits_get_hdu_type(mfptr,&hdutype,status);\n\n      /* set the EXTVER value to 0 for now */\n\n      *status = fits_modify_key_lng(mfptr,\"EXTVER\",0,NULL,status);\n\n      /* if the EXTVER keyword was not found then add it */\n\n      if(*status == KEY_NO_EXIST)\n\t{\n\t  *status = 0;\n\t  *status = fits_read_key_str(mfptr,\"EXTNAME\",extname,comment,\n\t\t\t\t      status);\n\t  *status = fits_insert_key_lng(mfptr,\"EXTVER\",0,\n\t\t\t\t\t\"Extension version ID\",status);\n\t}\n\n      if(*status != 0) continue;\n\n      /* find the first available EXTVER value for the copied HDU */\n \n      for(i = 1; fits_movnam_hdu(mfptr,hdutype,extname,i,status) == 0; ++i);\n\n      *status = 0;\n\n      fits_movabs_hdu(mfptr,hdunum,&hdutype,status);\n\n      /* reset the copied member HDUs EXTVER value */\n\n      *status = fits_modify_key_lng(mfptr,\"EXTVER\",(long)i,NULL,status);    \n\n      /*\n\tperform member copy operations that are dependent upon the cpopt\n\tparameter value\n      */\n\n      switch(cpopt)\n\t{\n\tcase OPT_MCP_ADD:\n\n\t  /*\n\t    add the copied member to the grouping table, leaving the\n\t    entry for the original member in place\n\t  */\n\n\t  *status = fits_add_group_member(gfptr,mfptr,0,status);\n\n\t  break;\n\n\tcase OPT_MCP_NADD:\n\n\t  /*\n\t    nothing to do for this copy option\n\t  */\n\n\t  break;\n\n\tcase OPT_MCP_REPL:\n\n\t  /*\n\t    remove the original member from the grouping table and add the\n\t    copied member in its place\n\t  */\n\n\t  *status = fits_remove_member(gfptr,member,OPT_RM_ENTRY,status);\n\t  *status = fits_add_group_member(gfptr,mfptr,0,status);\n\n\t  break;\n\n\tdefault:\n\n\t  *status = BAD_OPTION;\n\t  ffpmsg(\"Invalid value specified for the cmopt parameter (ffgmcp)\");\n\n\t  break;\n\t}\n\n    }while(0);\n      \n  if(tmpfptr != NULL) \n    {\n      fits_close_file(tmpfptr,status);\n    }\n\n  return(*status);\n}\t\t     \n\n/*---------------------------------------------------------------------------*/\nint ffgmtf(fitsfile *infptr,   /* FITS file pointer to source grouping table */\n\t   fitsfile *outfptr,  /* FITS file pointer to target grouping table */\n\t   long      member,   /* member ID within source grouping table     */\n\t   int       tfopt,    /* code specifying transfer opts:\n\t\t\t\t  OPT_MCP_ADD (0) ==> copy member to dest.\n\t\t\t\t  OPT_MCP_MOV (3) ==> move member to dest.   */\n\t   int      *status)   /* return status code                         */\n\n/*\n  transfer a group member from one grouping table to another. The source\n  grouping table must be the CHDU of the fitsfile pointed to by infptr, and \n  the destination grouping table must be the CHDU of the fitsfile to by \n  outfptr. If the tfopt parameter is OPT_MCP_ADD then the member is made a \n  member of the target group and remains a member of the source group. If\n  the tfopt parameter is OPT_MCP_MOV then the member is deleted from the \n  source group after the transfer to the destination group. The member to be\n  transfered is identified by its row number within the source grouping table.\n*/\n\n{\n  fitsfile *mfptr = NULL;\n\n\n  if(*status != 0) return(*status);\n\n  if(tfopt != OPT_MCP_MOV && tfopt != OPT_MCP_ADD)\n    {\n      *status = BAD_OPTION;\n      ffpmsg(\"Invalid value specified for the tfopt parameter (ffgmtf)\");\n    }\n  else\n    {\n      /* open the member of infptr to be transfered */\n\n      *status = fits_open_member(infptr,member,&mfptr,status);\n      \n      /* add the member to the outfptr grouping table */\n      \n      *status = fits_add_group_member(outfptr,mfptr,0,status);\n      \n      /* close the member HDU */\n      \n      *status = fits_close_file(mfptr,status);\n      \n      /* \n\t if the tfopt is \"move member\" then remove it from the infptr \n\t grouping table\n      */\n\n      if(tfopt == OPT_MCP_MOV)\n\t*status = fits_remove_member(infptr,member,OPT_RM_ENTRY,status);\n    }\n  \n  return(*status);\n}\n\n/*---------------------------------------------------------------------------*/\nint ffgmrm(fitsfile *gfptr,  /* FITS file pointer to group table             */\n\t   long      member, /* member ID (row num) in the group             */\n\t   int       rmopt,  /* code specifying the delete option:\n\t\t\t\tOPT_RM_ENTRY ==> delete the member entry\n\t\t\t\tOPT_RM_MBR   ==> delete entry and member HDU */\n\t   int      *status)  /* return status code                          */\n\n/*\n  remove a member HDU from a grouping table. The fitsfile pointer gfptr must\n  be positioned with the grouping table as the CHDU, and the member to \n  delete is identified by its row number in the table (first member == 1).\n  The rmopt parameter determines if the member entry is deleted from the\n  grouping table (in which case GRPIDn and GRPLCn keywords in the member \n  HDU's header shall be updated accordingly) or if the member HDU shall \n  itself be removed from its FITS file.\n*/\n\n{\n  int found;\n  int hdutype   = 0;\n  int index;\n  int iomode    = 0;\n\n  long i;\n  long ngroups      = 0;\n  long nmembers     = 0;\n  long groupExtver  = 0;\n  long grpid        = 0;\n\n  char grpLocation1[FLEN_FILENAME];\n  char grpLocation2[FLEN_FILENAME];\n  char grpLocation3[FLEN_FILENAME];\n  char cwd[FLEN_FILENAME];\n  char keyword[FLEN_KEYWORD];\n  /* SPR 1738 This can now be longer */\n  char grplc[FLEN_FILENAME];\n  char *tgrplc;\n  char keyvalue[FLEN_VALUE];\n  char card[FLEN_CARD];\n  char *editLocation;\n  char mrootname[FLEN_FILENAME], grootname[FLEN_FILENAME];\n\n  fitsfile *mfptr  = NULL;\n\n\n  if(*status != 0) return(*status);\n\n  do\n    {\n      /*\n\tmake sure the grouping table can be modified before proceeding\n      */\n\n      fits_file_mode(gfptr,&iomode,status);\n\n      if(iomode != READWRITE)\n\t{\n\t  ffpmsg(\"cannot modify grouping table (ffgtam)\");\n\t  *status = BAD_GROUP_DETACH;\n\t  continue;\n\t}\n\n      /* open the group member to be deleted and get its IOstatus*/\n\n      *status = fits_open_member(gfptr,member,&mfptr,status);\n      *status = fits_file_mode(mfptr,&iomode,status);\n\n      /*\n\t if the member HDU is to be deleted then call fits_unlink_member()\n\t to remove it from all groups to which it belongs (including\n\t this one) and then delete it. Note that if the member is a\n\t grouping table then we have to recursively call fits_remove_member()\n\t for each member of the member before we delete the member itself.\n      */\n\n      if(rmopt == OPT_RM_MBR)\n\t{\n\t    /* cannot delete a PHDU */\n\t    if(fits_get_hdu_num(mfptr,&hdutype) == 1)\n\t\t{\n\t\t    *status = BAD_HDU_NUM;\n\t\t    continue;\n\t\t}\n\n\t  /* determine if the member HDU is itself a grouping table */\n\n\t  *status = fits_read_key_str(mfptr,\"EXTNAME\",keyvalue,card,status);\n\n\t  /* if no EXTNAME is found then the HDU cannot be a grouping table */ \n\n\t  if(*status == KEY_NO_EXIST) \n\t    {\n\t      keyvalue[0] = 0;\n\t      *status = 0;\n\t    }\n\t  prepare_keyvalue(keyvalue);\n\n\t  /* Any other error is a reason to abort */\n\n\t  if(*status != 0) continue;\n\n\t  /* if the EXTNAME == GROUPING then the member is a grouping table */\n\t  \n\t  if(fits_strcasecmp(keyvalue,\"GROUPING\") == 0)\n\t    {\n\t      /* remove each of the grouping table members */\n\t      \n\t      *status = fits_get_num_members(mfptr,&nmembers,status);\n\t      \n\t      for(i = nmembers; i > 0 && *status == 0; --i)\n\t\t*status = fits_remove_member(mfptr,i,OPT_RM_ENTRY,status);\n\t      \n\t      if(*status != 0) continue;\n\t    }\n\n\t  /* unlink the member HDU from all groups that contain it */\n\n\t  *status = ffgmul(mfptr,0,status);\n\n\t  if(*status != 0) continue;\n \n\t  /* reset the grouping table HDU struct */\n\n\t  fits_set_hdustruc(gfptr,status);\n\n\t  /* delete the member HDU */\n\n\t  if(iomode != READONLY)\n\t    *status = fits_delete_hdu(mfptr,&hdutype,status);\n\t}\n      else if(rmopt == OPT_RM_ENTRY)\n\t{\n\t  /* \n\t     The member HDU is only to be removed as an entry from this\n\t     grouping table. Actions are (1) find the GRPIDn/GRPLCn \n\t     keywords that link the member to the grouping table, (2)\n\t     remove the GRPIDn/GRPLCn keyword from the member HDU header\n\t     and (3) remove the member entry from the grouping table\n\t  */\n\n\t  /*\n\t    there is no need to seach for and remove the GRPIDn/GRPLCn\n\t    keywords from the member HDU if it has not been opened\n\t    in READWRITE mode\n\t  */\n\n\t  if(iomode == READWRITE)\n\t    {\t  \t      \n\t      /* \n\t\t determine the group EXTVER value of the grouping table; if\n\t\t the member HDU and grouping table HDU do not reside in the \n\t\t same file then set the groupExtver value to its negative \n\t      */\n\t      \n\t      *status = fits_read_key_lng(gfptr,\"EXTVER\",&groupExtver,card,\n\t\t\t\t\t  status);\n\t      /* Now, if either the Fptr values are the same, or the root filenames\n\t         are the same, then assume these refer to the same file.\n\t      */\n\t      fits_parse_rootname(mfptr->Fptr->filename, mrootname, status);\n\t      fits_parse_rootname(gfptr->Fptr->filename, grootname, status);\n\n\t      if((mfptr->Fptr != gfptr->Fptr) && \n\t          strncmp(mrootname, grootname, FLEN_FILENAME))\n                       groupExtver = -1*groupExtver;\n\t      \n\t      /*\n\t\tretrieve the URLs for the grouping table; note that it is \n\t\tpossible that the grouping table file has two URLs, the \n\t\tone used to open it and the \"real\" one pointing to the \n\t\tactual file being accessed\n\t      */\n\t      \n\t      *status = fits_get_url(gfptr,grpLocation1,grpLocation2,NULL,\n\t\t\t\t     NULL,NULL,status);\n\t      \n\t      if(*status != 0) continue;\n\t      \n\t      /*\n\t\tif either of the group location strings specify a relative\n\t\tfile path then convert them into absolute file paths\n\t      */\n\n\t      *status = fits_get_cwd(cwd,status);\n\t      \n\t      if(*grpLocation1 != 0 && *grpLocation1 != '/' &&\n\t\t !fits_is_url_absolute(grpLocation1))\n\t\t{\n\t\t  strcpy(grpLocation3,cwd);\n                  if (strlen(grpLocation3)+strlen(grpLocation1)+1 > \n                            FLEN_FILENAME-1)\n                  {\n                     ffpmsg(\"group locations are too long (ffgmrm)\");\n                     *status = URL_PARSE_ERROR;\n                     continue;\n                  }\n\t\t  strcat(grpLocation3,\"/\");\n\t\t  strcat(grpLocation3,grpLocation1);\n\t\t  fits_clean_url(grpLocation3,grpLocation1,status);\n\t\t}\n\t      \n\t      if(*grpLocation2 != 0 && *grpLocation2 != '/' &&\n\t\t !fits_is_url_absolute(grpLocation2))\n\t\t{\n\t\t  strcpy(grpLocation3,cwd);\n                  if (strlen(grpLocation3)+strlen(grpLocation2)+1 > \n                            FLEN_FILENAME-1)\n                  {\n                     ffpmsg(\"group locations are too long (ffgmrm)\");\n                     *status = URL_PARSE_ERROR;\n                     continue;\n                  }\n\t\t  strcat(grpLocation3,\"/\");\n\t\t  strcat(grpLocation3,grpLocation2);\n\t\t  fits_clean_url(grpLocation3,grpLocation2,status);\n\t\t}\n\t      \n\t      /*\n\t\tdetermine the number of groups to which the member HDU \n\t\tbelongs\n\t      */\n\t      \n\t      *status = fits_get_num_groups(mfptr,&ngroups,status);\n\t      \n\t      /* reset the HDU keyword position counter to the beginning */\n\t      \n\t      *status = ffgrec(mfptr,0,card,status);\n\t      \n\t      /*\n\t\tloop over all the GRPIDn keywords in the member HDU header \n\t\tand find the appropriate GRPIDn and GRPLCn keywords that \n\t\tidentify it as belonging to the group\n\t      */\n\t      \n\t      for(index = 1, found = 0; index <= ngroups && *status == 0 && \n\t\t    !found; ++index)\n\t\t{\t  \n\t\t  /* read the next GRPIDn keyword in the series */\n\t\t  \n\t\t  snprintf(keyword,FLEN_KEYWORD,\"GRPID%d\",index);\n\t\t  \n\t\t  *status = fits_read_key_lng(mfptr,keyword,&grpid,card,\n\t\t\t\t\t      status);\n\t\t  if(*status != 0) continue;\n\t\t  \n\t\t  /* \n\t\t     grpid value == group EXTVER value then we could have a \n\t\t     match\n\t\t  */\n\t\t  \n\t\t  if(grpid == groupExtver && grpid > 0)\n\t\t    {\n\t\t      /*\n\t\t\tif GRPID is positive then its a match because \n\t\t\tboth the member HDU and grouping table HDU reside\n\t\t\tin the same FITS file\n\t\t      */\n\t\t      \n\t\t      found = index;\n\t\t    }\n\t\t  else if(grpid == groupExtver && grpid < 0)\n\t\t    {\n\t\t      /* \n\t\t\t have to look at the GRPLCn value to determine a \n\t\t\t match because the member HDU and grouping table \n\t\t\t HDU reside in different FITS files\n\t\t      */\n\t\t      \n\t\t      snprintf(keyword,FLEN_KEYWORD,\"GRPLC%d\",index);\n\t\t      \n\t\t      /* SPR 1738 */\n\t\t      *status = fits_read_key_longstr(mfptr,keyword,&tgrplc,\n\t\t\t\t\t\t      card, status);\n\t\t      if (0 == *status) {\n\t\t\tstrcpy(grplc,tgrplc);\n\t\t\tfree(tgrplc);\n\t\t      }\n\t\t      \t\t      \n\t\t      if(*status == KEY_NO_EXIST)\n\t\t\t{\n\t\t\t  /* \n\t\t\t     no GRPLCn keyword value found ==> grouping\n\t\t\t     convention not followed; nothing we can do \n\t\t\t     about it, so just continue\n\t\t\t  */\n\t\t\t  \n\t\t\t  snprintf(card,FLEN_CARD,\"No GRPLC%d found for GRPID%d\",\n\t\t\t\t  index,index);\n\t\t\t  ffpmsg(card);\n\t\t\t  *status = 0;\n\t\t\t  continue;\n\t\t\t}\n\t\t      else if (*status != 0) continue;\n\t\t      \n\t\t      /* construct the URL for the GRPLCn value */\n\t\t      \n\t\t      prepare_keyvalue(grplc);\n\t\t      \n\t\t      /*\n\t\t\tif the grplc value specifies a relative path then\n\t\t\tturn it into a absolute file path for comparison\n\t\t\tpurposes\n\t\t      */\n\t\t      \n\t\t      if(*grplc != 0 && !fits_is_url_absolute(grplc) &&\n\t\t\t *grplc != '/')\n\t\t\t{\n\t\t\t    /* No, wrong, \n\t\t\t       strcpy(grpLocation3,cwd);\n\t\t\t       should be */\n\t\t\t    *status = fits_file_name(mfptr,grpLocation3,status);\n\t\t\t    /* Remove everything after the last / */\n\t\t\t    if (NULL != (editLocation = strrchr(grpLocation3,'/'))) {\n\t\t\t\t*editLocation = '\\0';\n\t\t\t    }\n\t\t\t\t\n                          if (strlen(grpLocation3)+strlen(grplc)+1 > \n                                    FLEN_FILENAME-1)\n                          {\n                             ffpmsg(\"group locations are too long (ffgmrm)\");\n                             *status = URL_PARSE_ERROR;\n                             continue;\n                          }\n\t\t\t  strcat(grpLocation3,\"/\");\n\t\t\t  strcat(grpLocation3,grplc);\n\t\t\t  *status = fits_clean_url(grpLocation3,grplc,\n\t\t\t\t\t\t   status);\n\t\t\t}\n\t\t      \n\t\t      /*\n\t\t\tif the absolute value of GRPIDn is equal to the\n\t\t\tEXTVER value of the grouping table and (one of the \n\t\t\tpossible two) grouping table file URL matches the\n\t\t\tGRPLCn keyword value then we hava a match\n\t\t      */\n\t\t      \n\t\t      if(strcmp(grplc,grpLocation1) == 0  || \n\t\t\t strcmp(grplc,grpLocation2) == 0) \n\t\t\tfound = index; \n\t\t    }\n\t\t}\n\n\t      /*\n\t\tif found == 0 (false) after the above search then we assume \n\t\tthat it is due to an inpromper updating of the GRPIDn and \n\t\tGRPLCn keywords in the member header ==> nothing to delete \n\t\tin the header. Else delete the GRPLCn and GRPIDn keywords \n\t\tthat identify the member HDU with the group HDU and \n\t\tre-enumerate the remaining GRPIDn and GRPLCn keywords\n\t      */\n\n\t      if(found != 0)\n\t\t{\n\t\t  snprintf(keyword,FLEN_KEYWORD,\"GRPID%d\",found);\n\t\t  *status = fits_delete_key(mfptr,keyword,status);\n\t\t  \n\t\t  snprintf(keyword,FLEN_KEYWORD,\"GRPLC%d\",found);\n\t\t  *status = fits_delete_key(mfptr,keyword,status);\n\t\t  \n\t\t  *status = 0;\n\t\t  \n\t\t  /* call fits_get_num_groups() to re-enumerate the GRPIDn */\n\t\t  \n\t\t  *status = fits_get_num_groups(mfptr,&ngroups,status);\n\t\t} \n\t    }\n\n\t  /*\n\t     finally, remove the member entry from the current grouping table\n\t     pointed to by gfptr\n\t  */\n\n\t  *status = fits_delete_rows(gfptr,member,1,status);\n\t}\n      else\n\t{\n\t  *status = BAD_OPTION;\n\t  ffpmsg(\"Invalid value specified for the rmopt parameter (ffgmrm)\");\n\t}\n\n    }while(0);\n\n  if(mfptr != NULL) \n    {\n      fits_close_file(mfptr,status);\n    }\n\n  return(*status);\n}\n\n/*---------------------------------------------------------------------------\n                 Grouping Table support functions\n  ---------------------------------------------------------------------------*/\nint ffgtgc(fitsfile *gfptr,  /* pointer to the grouping table                */\n\t   int *xtensionCol, /* column ID of the MEMBER_XTENSION column      */\n\t   int *extnameCol,  /* column ID of the MEMBER_NAME column          */\n\t   int *extverCol,   /* column ID of the MEMBER_VERSION column       */\n\t   int *positionCol, /* column ID of the MEMBER_POSITION column      */\n\t   int *locationCol, /* column ID of the MEMBER_LOCATION column      */\n\t   int *uriCol,      /* column ID of the MEMBER_URI_TYPE column      */\n\t   int *grptype,     /* group structure type code specifying the\n\t\t\t\tgrouping table columns that are defined:\n\t\t\t\tGT_ID_ALL_URI  (0) ==> all columns defined   \n\t\t\t\tGT_ID_REF      (1) ==> reference cols only   \n\t\t\t\tGT_ID_POS      (2) ==> position col only     \n\t\t\t\tGT_ID_ALL      (3) ==> ref & pos cols        \n\t\t\t\tGT_ID_REF_URI (11) ==> ref & loc cols        \n\t\t\t\tGT_ID_POS_URI (12) ==> pos & loc cols        */\n\t   int *status)      /* return status code                           */\n/*\n   examine the grouping table pointed to by gfptr and determine the column\n   index ID of each possible grouping column. If a column is not found then\n   an index of 0 is returned. the grptype parameter returns the structure\n   of the grouping table ==> what columns are defined.\n*/\n\n{\n\n  char keyvalue[FLEN_VALUE];\n  char comment[FLEN_COMMENT];\n\n\n  if(*status != 0) return(*status);\n\n  do\n    {\n      /*\n\tif the HDU does not have an extname of \"GROUPING\" then it is not\n\ta grouping table\n      */\n\n      *status = fits_read_key_str(gfptr,\"EXTNAME\",keyvalue,comment,status);\n  \n      if(*status == KEY_NO_EXIST) \n\t{\n\t  *status = NOT_GROUP_TABLE;\n\t  ffpmsg(\"Specified HDU is not a Grouping Table (ffgtgc)\");\n\t}\n      if(*status != 0) continue;\n\n      prepare_keyvalue(keyvalue);\n\n      if(fits_strcasecmp(keyvalue,\"GROUPING\") != 0)\n\t{\n\t  *status = NOT_GROUP_TABLE;\n\t  continue;\n\t}\n\n      /*\n        search for the MEMBER_XTENSION, MEMBER_NAME, MEMBER_VERSION,\n\tMEMBER_POSITION, MEMBER_LOCATION and MEMBER_URI_TYPE columns\n\tand determine their column index ID\n      */\n\n      *status = fits_get_colnum(gfptr,CASESEN,\"MEMBER_XTENSION\",xtensionCol,\n\t\t\t\tstatus);\n\n      if(*status == COL_NOT_FOUND)\n\t{\n\t  *status      = 0;\n \t  *xtensionCol = 0;\n\t}\n\n      if(*status != 0) continue;\n\n      *status = fits_get_colnum(gfptr,CASESEN,\"MEMBER_NAME\",extnameCol,status);\n\n      if(*status == COL_NOT_FOUND)\n\t{\n\t  *status     = 0;\n\t  *extnameCol = 0;\n\t}\n\n      if(*status != 0) continue;\n\n      *status = fits_get_colnum(gfptr,CASESEN,\"MEMBER_VERSION\",extverCol,\n\t\t\t\tstatus);\n\n      if(*status == COL_NOT_FOUND)\n\t{\n\t  *status    = 0;\n\t  *extverCol = 0;\n\t}\n\n      if(*status != 0) continue;\n\n      *status = fits_get_colnum(gfptr,CASESEN,\"MEMBER_POSITION\",positionCol,\n\t\t\t\tstatus);\n\n      if(*status == COL_NOT_FOUND)\n\t{\n\t  *status      = 0;\n\t  *positionCol = 0;\n\t}\n\n      if(*status != 0) continue;\n\n      *status = fits_get_colnum(gfptr,CASESEN,\"MEMBER_LOCATION\",locationCol,\n\t\t\t\tstatus);\n\n      if(*status == COL_NOT_FOUND)\n\t{\n\t  *status      = 0;\n\t  *locationCol = 0;\n\t}\n\n      if(*status != 0) continue;\n\n      *status = fits_get_colnum(gfptr,CASESEN,\"MEMBER_URI_TYPE\",uriCol,\n\t\t\t\tstatus);\n\n      if(*status == COL_NOT_FOUND)\n\t{\n\t  *status = 0;\n\t  *uriCol = 0;\n\t}\n\n      if(*status != 0) continue;\n\n      /*\n\t determine the type of grouping table structure used by this\n\t grouping table and record it in the grptype parameter\n      */\n\n      if(*xtensionCol && *extnameCol && *extverCol && *positionCol &&\n\t *locationCol && *uriCol) \n\t*grptype = GT_ID_ALL_URI;\n      \n      else if(*xtensionCol && *extnameCol && *extverCol &&\n\t      *locationCol && *uriCol) \n\t*grptype = GT_ID_REF_URI;\n\n      else if(*xtensionCol && *extnameCol && *extverCol && *positionCol)\n\t*grptype = GT_ID_ALL;\n      \n      else if(*xtensionCol && *extnameCol && *extverCol)\n\t*grptype = GT_ID_REF;\n      \n      else if(*positionCol && *locationCol && *uriCol) \n\t*grptype = GT_ID_POS_URI;\n      \n      else if(*positionCol)\n\t*grptype = GT_ID_POS;\n      \n      else\n\t*status = NOT_GROUP_TABLE;\n      \n    }while(0);\n\n  /*\n    if the table contained more than one column with a reserved name then\n    this cannot be considered a vailid grouping table\n  */\n\n  if(*status == COL_NOT_UNIQUE) \n    {\n      *status = NOT_GROUP_TABLE;\n      ffpmsg(\"Specified HDU has multipule Group table cols defined (ffgtgc)\");\n    }\n\n  return(*status);\n}\n\n/*****************************************************************************/\nint ffvcfm(fitsfile *gfptr, int xtensionCol, int extnameCol, int extverCol,\n\t   int positionCol, int locationCol, int uriCol, int *status)\n{\n/*\n   Perform validation on column formats to ensure this matches the grouping\n   format the get functions expect.  Particularly want to check widths of\n   string columns.\n*/\n\n   int typecode=0;\n   long repeat=0, width=0;\n   \n   if (*status != 0) return (*status);\n   \n   do {\n       if (xtensionCol)\n       {\n          fits_get_coltype(gfptr, xtensionCol, &typecode, &repeat, &width, status);\n          if (*status || typecode != TSTRING || repeat != width || repeat > 8)\n          {\n             if (*status==0) *status=NOT_GROUP_TABLE;\n             ffpmsg(\"Wrong format for Grouping xtension col. (ffvcfm)\");\n             continue;\n          }          \n       }\n       if (extnameCol)\n       {\n          fits_get_coltype(gfptr, extnameCol, &typecode, &repeat, &width, status);\n          if (*status || typecode != TSTRING || repeat != width || repeat > 32)\n          {\n             if (*status==0) *status=NOT_GROUP_TABLE;\n             ffpmsg(\"Wrong format for Grouping name col. (ffvcfm)\");\n             continue;\n          }          \n       }\n       if (extverCol)\n       {\n          fits_get_coltype(gfptr, extverCol, &typecode, &repeat, &width, status);\n          if (*status || typecode != TINT32BIT ||  repeat > 1)\n          {\n             if (*status==0) *status=NOT_GROUP_TABLE;\n             ffpmsg(\"Wrong format for Grouping version col. (ffvcfm)\");\n             continue;\n          }          \n       }\n       if (positionCol)\n       {\n          fits_get_coltype(gfptr, positionCol, &typecode, &repeat, &width, status);\n          if (*status || typecode != TINT32BIT ||  repeat > 1)\n          {\n             if (*status==0) *status=NOT_GROUP_TABLE;\n             ffpmsg(\"Wrong format for Grouping position col. (ffvcfm)\");\n             continue;\n          }          \n       }\n       if (locationCol)\n       {\n          fits_get_coltype(gfptr, locationCol, &typecode, &repeat, &width, status);\n          if (*status || typecode != TSTRING || repeat != width || repeat > 256)\n          {\n             if (*status==0) *status=NOT_GROUP_TABLE;\n             ffpmsg(\"Wrong format for Grouping location col. (ffvcfm)\");\n             continue;\n          }          \n       }\n       if (uriCol)\n       {\n          fits_get_coltype(gfptr, uriCol, &typecode, &repeat, &width, status);\n          if (*status || typecode != TSTRING || repeat != width || repeat > 3)\n          {\n             if (*status==0) *status=NOT_GROUP_TABLE;\n             ffpmsg(\"Wrong format for Grouping URI col. (ffvcfm)\");\n             continue;\n          }          \n       }\n   } while (0);\n   return (*status);\n}\n\n\n/*****************************************************************************/\nint ffgtdc(int   grouptype,     /* code specifying the type of\n\t\t\t\t   grouping table information:\n\t\t\t\t   GT_ID_ALL_URI  0 ==> defualt (all columns)\n\t\t\t\t   GT_ID_REF      1 ==> ID by reference\n\t\t\t\t   GT_ID_POS      2 ==> ID by position\n\t\t\t\t   GT_ID_ALL      3 ==> ID by ref. and position\n\t\t\t\t   GT_ID_REF_URI 11 ==> (1) + URI info \n\t\t\t\t   GT_ID_POS_URI 12 ==> (2) + URI info       */\n\t   int   xtensioncol, /* does MEMBER_XTENSION already exist?         */\n\t   int   extnamecol,  /* does MEMBER_NAME aleady exist?              */\n\t   int   extvercol,   /* does MEMBER_VERSION already exist?          */\n\t   int   positioncol, /* does MEMBER_POSITION already exist?         */\n\t   int   locationcol, /* does MEMBER_LOCATION already exist?         */\n\t   int   uricol,      /* does MEMBER_URI_TYPE aleardy exist?         */\n\t   char *ttype[],     /* array of grouping table column TTYPE names\n\t\t\t\t to define (if *col var false)               */\n\t   char *tform[],     /* array of grouping table column TFORM values\n\t\t\t\t to define (if*col variable false)           */\n\t   int  *ncols,       /* number of TTYPE and TFORM values returned   */\n\t   int  *status)      /* return status code                          */\n\n/*\n  create the TTYPE and TFORM values for the grouping table according to the\n  value of the grouptype parameter and the values of the *col flags. The\n  resulting TTYPE and TFORM are returned in ttype[] and tform[] respectively.\n  The number of TTYPE and TFORMs returned is given by ncols. Both the TTYPE[]\n  and TTFORM[] arrays must contain enough pre-allocated strings to hold\n  the returned information.\n*/\n\n{\n\n  int i = 0;\n\n  char  xtension[]  = \"MEMBER_XTENSION\";\n  char  xtenTform[] = \"8A\";\n  \n  char  name[]      = \"MEMBER_NAME\";\n  char  nameTform[] = \"32A\";\n\n  char  version[]   = \"MEMBER_VERSION\";\n  char  verTform[]  = \"1J\";\n  \n  char  position[]  = \"MEMBER_POSITION\";\n  char  posTform[]  = \"1J\";\n\n  char  URI[]       = \"MEMBER_URI_TYPE\";\n  char  URITform[]  = \"3A\";\n\n  char  location[]  = \"MEMBER_LOCATION\";\n  /* SPR 01720, move from 160A to 256A */\n  char  locTform[]  = \"256A\";\n\n\n  if(*status != 0) return(*status);\n\n  switch(grouptype)\n    {\n      \n    case GT_ID_ALL_URI:\n\n      if(xtensioncol == 0)\n\t{\n\t  strcpy(ttype[i],xtension);\n\t  strcpy(tform[i],xtenTform);\n\t  ++i;\n\t}\n      if(extnamecol == 0)\n\t{\n\t  strcpy(ttype[i],name);\n\t  strcpy(tform[i],nameTform);\n\t  ++i;\n\t}\n      if(extvercol == 0)\n\t{\n\t  strcpy(ttype[i],version);\n\t  strcpy(tform[i],verTform);\n\t  ++i;\n\t}\n      if(positioncol == 0)\n\t{\n\t  strcpy(ttype[i],position);\n\t  strcpy(tform[i],posTform);\n\t  ++i;\n\t}\n      if(locationcol == 0)\n\t{\n\t  strcpy(ttype[i],location);\n\t  strcpy(tform[i],locTform);\n\t  ++i;\n\t}\n      if(uricol == 0)\n\t{\n\t  strcpy(ttype[i],URI);\n\t  strcpy(tform[i],URITform);\n\t  ++i;\n\t}\n      break;\n      \n    case GT_ID_REF:\n      \n      if(xtensioncol == 0)\n\t{\n\t  strcpy(ttype[i],xtension);\n\t  strcpy(tform[i],xtenTform);\n\t  ++i;\n\t}\n      if(extnamecol == 0)\n\t{\n\t  strcpy(ttype[i],name);\n\t  strcpy(tform[i],nameTform);\n\t  ++i;\n\t}\n      if(extvercol == 0)\n\t{\n\t  strcpy(ttype[i],version);\n\t  strcpy(tform[i],verTform);\n\t  ++i;\n\t}\n      break;\n      \n    case GT_ID_POS:\n      \n      if(positioncol == 0)\n\t{\n\t  strcpy(ttype[i],position);\n\t  strcpy(tform[i],posTform);\n\t  ++i;\n\t}\t  \n      break;\n      \n    case GT_ID_ALL:\n      \n      if(xtensioncol == 0)\n\t{\n\t  strcpy(ttype[i],xtension);\n\t  strcpy(tform[i],xtenTform);\n\t  ++i;\n\t}\n      if(extnamecol == 0)\n\t{\n\t  strcpy(ttype[i],name);\n\t  strcpy(tform[i],nameTform);\n\t  ++i;\n\t}\n      if(extvercol == 0)\n\t{\n\t  strcpy(ttype[i],version);\n\t  strcpy(tform[i],verTform);\n\t  ++i;\n\t}\n      if(positioncol == 0)\n\t{\n\t  strcpy(ttype[i],position);\n\t  strcpy(tform[i], posTform);\n\t  ++i;\n\t}\t  \n      \n      break;\n      \n    case GT_ID_REF_URI:\n      \n      if(xtensioncol == 0)\n\t{\n\t  strcpy(ttype[i],xtension);\n\t  strcpy(tform[i],xtenTform);\n\t  ++i;\n\t}\n      if(extnamecol == 0)\n\t{\n\t  strcpy(ttype[i],name);\n\t  strcpy(tform[i],nameTform);\n\t  ++i;\n\t}\n      if(extvercol == 0)\n\t{\n\t  strcpy(ttype[i],version);\n\t  strcpy(tform[i],verTform);\n\t  ++i;\n\t}\n      if(locationcol == 0)\n\t{\n\t  strcpy(ttype[i],location);\n\t  strcpy(tform[i],locTform);\n\t  ++i;\n\t}\n      if(uricol == 0)\n\t{\n\t  strcpy(ttype[i],URI);\n\t  strcpy(tform[i],URITform);\n\t  ++i;\n\t}\n      break;\n      \n    case GT_ID_POS_URI:\n      \n      if(positioncol == 0)\n\t{\n\t  strcpy(ttype[i],position);\n\t  strcpy(tform[i],posTform);\n\t  ++i;\n\t}\n      if(locationcol == 0)\n\t{\n\t  strcpy(ttype[i],location);\n\t  strcpy(tform[i],locTform);\n\t  ++i;\n\t}\n      if(uricol == 0)\n\t{\n\t  strcpy(ttype[i],URI);\n\t  strcpy(tform[i],URITform);\n\t  ++i;\n\t}\n      break;\n      \n    default:\n      \n      *status = BAD_OPTION;\n      ffpmsg(\"Invalid value specified for the grouptype parameter (ffgtdc)\");\n\n      break;\n\n    }\n\n  *ncols = i;\n  \n  return(*status);\n}\n\n/*****************************************************************************/\nint ffgmul(fitsfile *mfptr,   /* pointer to the grouping table member HDU    */\n           int       rmopt,   /* 0 ==> leave GRPIDn/GRPLCn keywords,\n\t\t\t\t 1 ==> remove GRPIDn/GRPLCn keywords         */\n\t   int      *status) /* return status code                          */\n\n/*\n   examine all the GRPIDn and GRPLCn keywords in the member HDUs header\n   and remove the member from the grouping tables referenced; This\n   effectively \"unlinks\" the member from all of its groups. The rmopt \n   specifies if the GRPIDn/GRPLCn keywords are to be removed from the\n   member HDUs header after the unlinking.\n*/\n\n{\n  int memberPosition = 0;\n  int iomode;\n\n  long index;\n  long ngroups      = 0;\n  long memberExtver = 0;\n  long memberID     = 0;\n\n  char mbrLocation1[FLEN_FILENAME];\n  char mbrLocation2[FLEN_FILENAME];\n  char memberHDUtype[FLEN_VALUE];\n  char memberExtname[FLEN_VALUE];\n  char keyword[FLEN_KEYWORD];\n  char card[FLEN_CARD];\n\n  fitsfile *gfptr = NULL;\n\n\n  if(*status != 0) return(*status);\n\n  do\n    {\n      /* \n\t determine location parameters of the member HDU; note that\n\t default values are supplied if the expected keywords are not\n\t found\n      */\n\n      *status = fits_read_key_str(mfptr,\"XTENSION\",memberHDUtype,card,status);\n\n      if(*status == KEY_NO_EXIST) \n\t{\n\t  strcpy(memberHDUtype,\"PRIMARY\");\n\t  *status = 0;\n\t}\n      prepare_keyvalue(memberHDUtype);\n\n      *status = fits_read_key_lng(mfptr,\"EXTVER\",&memberExtver,card,status);\n\n      if(*status == KEY_NO_EXIST) \n\t{\n\t  memberExtver = 1;\n\t  *status      = 0;\n\t}\n\n      *status = fits_read_key_str(mfptr,\"EXTNAME\",memberExtname,card,status);\n\n      if(*status == KEY_NO_EXIST) \n\t{\n\t  memberExtname[0] = 0;\n\t  *status          = 0;\n\t}\n      prepare_keyvalue(memberExtname);\n\n      fits_get_hdu_num(mfptr,&memberPosition);\n\n      *status = fits_get_url(mfptr,mbrLocation1,mbrLocation2,NULL,NULL,\n\t\t\t     NULL,status);\n\n      if(*status != 0) continue;\n\n      /*\n\t open each grouping table linked to this HDU and remove the member \n\t from the grouping tables\n      */\n\n      *status = fits_get_num_groups(mfptr,&ngroups,status);\n\n      /* loop over each group linked to the member HDU */\n\n      for(index = 1; index <= ngroups && *status == 0; ++index)\n\t{\n\t  /* open the (index)th group linked to the member HDU */ \n\n\t  *status = fits_open_group(mfptr,index,&gfptr,status);\n\n\t  /* if the group could not be opened then just skip it */\n\n\t  if(*status != 0)\n\t    {\n\t      *status = 0;\n\t      snprintf(card,FLEN_CARD,\"Cannot open the %dth group table (ffgmul)\",\n\t\t      (int)index);\n\t      ffpmsg(card);\n\t      continue;\n\t    }\n\n\t  /*\n\t    make sure the grouping table can be modified before proceeding\n\t  */\n\t  \n\t  fits_file_mode(gfptr,&iomode,status);\n\n\t  if(iomode != READWRITE)\n\t    {\n\t      snprintf(card,FLEN_CARD,\"The %dth group cannot be modified (ffgtam)\",\n\t\t      (int)index);\n\t      ffpmsg(card);\n\t      continue;\n\t    }\n\n\t  /* \n\t     try to find the member's row within the grouping table; first \n\t     try using the member HDU file's \"real\" URL string then try\n\t     using its originally opened URL string if either string exist\n\t   */\n\t     \n\t  memberID = 0;\n \n\t  if(strlen(mbrLocation1) != 0)\n\t    {\n\t      *status = ffgmf(gfptr,memberHDUtype,memberExtname,memberExtver,\n\t\t\t      memberPosition,mbrLocation1,&memberID,status);\n\t    }\n\n\t  if(*status == MEMBER_NOT_FOUND && strlen(mbrLocation2) != 0)\n\t    {\n\t      *status = 0;\n\t      *status = ffgmf(gfptr,memberHDUtype,memberExtname,memberExtver,\n\t\t\t      memberPosition,mbrLocation2,&memberID,status);\n\t    }\n\n\t  /* if the member was found then delete it from the grouping table */\n\n\t  if(*status == 0)\n\t    *status = fits_delete_rows(gfptr,memberID,1,status);\n\n\t  /*\n\t     continue the loop over all member groups even if an error\n\t     was generated\n\t  */\n\n\t  if(*status == MEMBER_NOT_FOUND)\n\t    {\n\t      ffpmsg(\"cannot locate member's entry in group table (ffgmul)\");\n\t    }\n\t  *status = 0;\n\n\t  /*\n\t     close the file pointed to by gfptr if it is non NULL to\n\t     prepare for the next loop iterration\n\t  */\n\n\t  if(gfptr != NULL)\n\t    {\n\t      fits_close_file(gfptr,status);\n\t      gfptr = NULL;\n\t    }\n\t}\n\n      if(*status != 0) continue;\n\n      /*\n\t if rmopt is non-zero then find and delete the GRPIDn/GRPLCn \n\t keywords from the member HDU header\n      */\n\n      if(rmopt != 0)\n\t{\n\t  fits_file_mode(mfptr,&iomode,status);\n\n\t  if(iomode == READONLY)\n\t    {\n\t      ffpmsg(\"Cannot modify member HDU, opened READONLY (ffgmul)\");\n\t      continue;\n\t    }\n\n\t  /* delete all the GRPIDn/GRPLCn keywords */\n\n\t  for(index = 1; index <= ngroups && *status == 0; ++index)\n\t    {\n\t      snprintf(keyword,FLEN_KEYWORD,\"GRPID%d\",(int)index);\n\t      fits_delete_key(mfptr,keyword,status);\n\t      \n\t      snprintf(keyword,FLEN_KEYWORD,\"GRPLC%d\",(int)index);\n\t      fits_delete_key(mfptr,keyword,status);\n\n\t      if(*status == KEY_NO_EXIST) *status = 0;\n\t    }\n\t}\n    }while(0);\n\n  /* make sure the gfptr has been closed */\n\n  if(gfptr != NULL)\n    { \n      fits_close_file(gfptr,status);\n    }\n\nreturn(*status);\n}\n\n/*--------------------------------------------------------------------------*/\nint ffgmf(fitsfile *gfptr, /* pointer to grouping table HDU to search       */\n\t   char *xtension,  /* XTENSION value for member HDU                */\n\t   char *extname,   /* EXTNAME value for member HDU                 */\n\t   int   extver,    /* EXTVER value for member HDU                  */\n\t   int   position,  /* HDU position value for member HDU            */\n\t   char *location,  /* FITS file location value for member HDU      */\n\t   long *member,    /* member HDU ID within group table (if found)  */\n\t   int  *status)    /* return status code                           */\n\n/*\n   try to find the entry for the member HDU defined by the xtension, extname,\n   extver, position, and location parameters within the grouping table\n   pointed to by gfptr. If the member HDU is found then its ID (row number)\n   within the grouping table is returned in the member variable; if not\n   found then member is returned with a value of 0 and the status return\n   code will be set to MEMBER_NOT_FOUND.\n\n   Note that the member HDU postion information is used to obtain a member\n   match only if the grouping table type is GT_ID_POS_URI or GT_ID_POS. This\n   is because the position information can become invalid much more\n   easily then the reference information for a group member.\n*/\n\n{\n  int xtensionCol,extnameCol,extverCol,positionCol,locationCol,uriCol;\n  int mposition = 0;\n  int grptype;\n  int dummy;\n  int i;\n\n  long nmembers = 0;\n  long mextver  = 0;\n \n  char  charBuff1[FLEN_FILENAME];\n  char  charBuff2[FLEN_FILENAME];\n  char  tmpLocation[FLEN_FILENAME];\n  char  mbrLocation1[FLEN_FILENAME];\n  char  mbrLocation2[FLEN_FILENAME];\n  char  mbrLocation3[FLEN_FILENAME];\n  char  grpLocation1[FLEN_FILENAME];\n  char  grpLocation2[FLEN_FILENAME];\n  char  cwd[FLEN_FILENAME];\n\n  char  nstr[] = {'\\0'};\n  char *tmpPtr[2];\n\n  if(*status != 0) return(*status);\n\n  *member = 0;\n\n  tmpPtr[0] = charBuff1;\n  tmpPtr[1] = charBuff2;\n\n\n  if(*status != 0) return(*status);\n\n  /*\n    if the passed LOCATION value is not an absolute URL then turn it\n    into an absolute path\n  */\n\n  if(location == NULL)\n    {\n      *tmpLocation = 0;\n    }\n\n  else if(*location == 0)\n    {\n      *tmpLocation = 0;\n    }\n\n  else if(!fits_is_url_absolute(location))\n    {\n      fits_path2url(location,FLEN_FILENAME,tmpLocation,status);\n\n      if(*tmpLocation != '/')\n\t{\n\t  fits_get_cwd(cwd,status);\n          if (strlen(cwd)+strlen(tmpLocation)+1 > \n                    FLEN_FILENAME-1)\n          {\n             ffpmsg(\"cwd and location are too long (ffgmf)\");\n             return (*status = URL_PARSE_ERROR);\n          }\n\t  strcat(cwd,\"/\");\n\t  strcat(cwd,tmpLocation);\n\t  fits_clean_url(cwd,tmpLocation,status);\n\t}\n    }\n\n  else\n    strcpy(tmpLocation,location);\n\n  /*\n     retrieve the Grouping Convention reserved column positions within\n     the grouping table\n  */\n\n  *status = ffgtgc(gfptr,&xtensionCol,&extnameCol,&extverCol,&positionCol,\n\t\t   &locationCol,&uriCol,&grptype,status);\n\n  /* retrieve the number of group members */\n\n  *status = fits_get_num_members(gfptr,&nmembers,status);\n\t      \n  /* \n     loop over all grouping table rows until the member HDU is found \n  */\n\n  for(i = 1; i <= nmembers && *member == 0 && *status == 0; ++i)\n    {\n      if(xtensionCol != 0)\n\t{\n\t  fits_read_col_str(gfptr,xtensionCol,i,1,1,nstr,tmpPtr,&dummy,status);\n\t  if(fits_strcasecmp(tmpPtr[0],xtension) != 0) continue;\n\t}\n\t  \n      if(extnameCol  != 0)\n\t{\n\t  fits_read_col_str(gfptr,extnameCol,i,1,1,nstr,tmpPtr,&dummy,status);\n\t  if(fits_strcasecmp(tmpPtr[0],extname) != 0) continue;\n\t}\n\t  \n      if(extverCol   != 0)\n\t{\n\t  fits_read_col_lng(gfptr,extverCol,i,1,1,0,\n\t\t\t    (long*)&mextver,&dummy,status);\n\t  if(extver != mextver) continue;\n\t}\n      \n      /* note we only use postionCol if we have to */\n\n      if(positionCol != 0 && \n\t            (grptype == GT_ID_POS || grptype == GT_ID_POS_URI))\n\t{\n\t  fits_read_col_int(gfptr,positionCol,i,1,1,0,\n\t\t\t    &mposition,&dummy,status);\n\t  if(position != mposition) continue;\n\t}\n      \n      /*\n\tif no location string was passed to the function then assume that\n\tthe calling application does not wish to use it as a comparision\n\tcritera ==> if we got this far then we have a match\n      */\n\n      if(location == NULL)\n\t{\n\t  ffpmsg(\"NULL Location string given ==> ignore location (ffgmf)\");\n\t  *member = i;\n\t  continue;\n\t}\n\n      /*\n\tif the grouping table MEMBER_LOCATION column exists then read the\n\tlocation URL for the member, else set the location string to\n\ta zero-length string for subsequent comparisions\n      */\n\n      if(locationCol != 0)\n\t{\n\t  fits_read_col_str(gfptr,locationCol,i,1,1,nstr,tmpPtr,&dummy,status);\n\t  strcpy(mbrLocation1,tmpPtr[0]);\n\t  *mbrLocation2 = 0;\n\t}\n      else\n\t*mbrLocation1 = 0;\n\n      /* \n\t if the member location string from the grouping table is zero \n\t length (either implicitly or explicitly) then assume that the \n\t member HDU is in the same file as the grouping table HDU; retrieve\n\t the possible URL values of the grouping table HDU file \n       */\n\n      if(*mbrLocation1 == 0)\n\t{\n\t  /* retrieve the possible URLs of the grouping table file */\n\t  *status = fits_get_url(gfptr,mbrLocation1,mbrLocation2,NULL,NULL,\n\t\t\t\t NULL,status);\n\n\t  /* if non-NULL, make sure the first URL is absolute or a full path */\n\t  if(*mbrLocation1 != 0 && !fits_is_url_absolute(mbrLocation1) &&\n\t     *mbrLocation1 != '/')\n\t    {\n\t      fits_get_cwd(cwd,status);\n              if (strlen(cwd)+strlen(mbrLocation1)+1 > \n                        FLEN_FILENAME-1)\n              {\n                 ffpmsg(\"cwd and member locations are too long (ffgmf)\");\n                 *status = URL_PARSE_ERROR;\n                 continue;\n              }\n\t      strcat(cwd,\"/\");\n\t      strcat(cwd,mbrLocation1);\n\t      fits_clean_url(cwd,mbrLocation1,status);\n\t    }\n\n\t  /* if non-NULL, make sure the first URL is absolute or a full path */\n\t  if(*mbrLocation2 != 0 && !fits_is_url_absolute(mbrLocation2) &&\n\t     *mbrLocation2 != '/')\n\t    {\n\t      fits_get_cwd(cwd,status);\n              if (strlen(cwd)+strlen(mbrLocation2)+1 > \n                        FLEN_FILENAME-1)\n              {\n                 ffpmsg(\"cwd and member locations are too long (ffgmf)\");\n                 *status = URL_PARSE_ERROR;\n                 continue;\n              }\n\t      strcat(cwd,\"/\");\n\t      strcat(cwd,mbrLocation2);\n\t      fits_clean_url(cwd,mbrLocation2,status);\n\t    }\n\t}\n\n      /*\n\tif the member location was specified, then make sure that it is\n\teither an absolute URL or specifies a full path\n      */\n\n      else if(!fits_is_url_absolute(mbrLocation1) && *mbrLocation1 != '/')\n\t{\n\t  strcpy(mbrLocation2,mbrLocation1);\n\n\t  /* get the possible URLs for the grouping table file */\n\t  *status = fits_get_url(gfptr,grpLocation1,grpLocation2,NULL,NULL,\n\t\t\t\t NULL,status);\n\t  \n\t  if(*grpLocation1 != 0)\n\t    {\n\t      /* make sure the first grouping table URL is absolute */\n\t      if(!fits_is_url_absolute(grpLocation1) && *grpLocation1 != '/')\n\t\t{\n\t\t  fits_get_cwd(cwd,status);\n                  if (strlen(cwd)+strlen(grpLocation1)+1 > \n                            FLEN_FILENAME-1)\n                  {\n                     ffpmsg(\"cwd and group locations are too long (ffgmf)\");\n                     *status = URL_PARSE_ERROR;\n                     continue;\n                  }\n\t\t  strcat(cwd,\"/\");\n\t\t  strcat(cwd,grpLocation1);\n\t\t  fits_clean_url(cwd,grpLocation1,status);\n\t\t}\n\t      \n\t      /* create an absoute URL for the member */\n\n\t      fits_relurl2url(grpLocation1,mbrLocation1,mbrLocation3,status);\n\t      \n\t      /* \n\t\t if URL construction succeeded then copy it to the\n\t\t first location string; else set the location string to \n\t\t empty\n\t      */\n\n\t      if(*status == 0)\n\t\t{\n\t\t  strcpy(mbrLocation1,mbrLocation3);\n\t\t}\n\n\t      else if(*status == URL_PARSE_ERROR)\n\t\t{\n\t\t  *status       = 0;\n\t\t  *mbrLocation1 = 0;\n\t\t}\n\t    }\n\t  else\n\t    *mbrLocation1 = 0;\n\n\t  if(*grpLocation2 != 0)\n\t    {\n\t      /* make sure the second grouping table URL is absolute */\n\t      if(!fits_is_url_absolute(grpLocation2) && *grpLocation2 != '/')\n\t\t{\n\t\t  fits_get_cwd(cwd,status);\n                  if (strlen(cwd)+strlen(grpLocation2)+1 > \n                            FLEN_FILENAME-1)\n                  {\n                     ffpmsg(\"cwd and group locations are too long (ffgmf)\");\n                     *status = URL_PARSE_ERROR;\n                     continue;\n                  }\n\t\t  strcat(cwd,\"/\");\n\t\t  strcat(cwd,grpLocation2);\n\t\t  fits_clean_url(cwd,grpLocation2,status);\n\t\t}\n\t      \n\t      /* create an absolute URL for the member */\n\n\t      fits_relurl2url(grpLocation2,mbrLocation2,mbrLocation3,status);\n\t      \n\t      /* \n\t\t if URL construction succeeded then copy it to the\n\t\t second location string; else set the location string to \n\t\t empty\n\t      */\n\n\t      if(*status == 0)\n\t\t{\n\t\t  strcpy(mbrLocation2,mbrLocation3);\n\t\t}\n\n\t      else if(*status == URL_PARSE_ERROR)\n\t\t{\n\t\t  *status       = 0;\n\t\t  *mbrLocation2 = 0;\n\t\t}\n\t    }\n\t  else\n\t    *mbrLocation2 = 0;\n\t}\n\n      /*\n\tcompare the passed member HDU file location string with the\n\t(possibly two) member location strings to see if there is a match\n       */\n\n      if(strcmp(mbrLocation1,tmpLocation) != 0 && \n\t strcmp(mbrLocation2,tmpLocation) != 0   ) continue;\n  \n      /* if we made it this far then a match to the member HDU was found */\n      \n      *member = i;\n    }\n\n  /* if a match was not found then set the return status code */\n\n  if(*member == 0 && *status == 0) \n    {\n      *status = MEMBER_NOT_FOUND;\n      ffpmsg(\"Cannot find specified member HDU (ffgmf)\");\n    }\n\n  return(*status);\n}\n\n/*--------------------------------------------------------------------------\n                        Recursive Group Functions\n  --------------------------------------------------------------------------*/\nint ffgtrmr(fitsfile   *gfptr,  /* FITS file pointer to group               */\n\t    HDUtracker *HDU,    /* list of processed HDUs                   */\n\t    int        *status) /* return status code                       */\n\t    \n/*\n  recursively remove a grouping table and all its members. Each member of\n  the grouping table pointed to by gfptr it processed. If the member is itself\n  a grouping table then ffgtrmr() is recursively called to process all\n  of its members. The HDUtracker struct *HDU is used to make sure a member\n  is not processed twice, thus avoiding an infinite loop (e.g., a grouping\n  table contains itself as a member).\n*/\n\n{\n  int i;\n  int hdutype;\n\n  long nmembers = 0;\n\n  char keyvalue[FLEN_VALUE];\n  char comment[FLEN_COMMENT];\n  \n  fitsfile *mfptr = NULL;\n\n\n  if(*status != 0) return(*status);\n\n  /* get the number of members contained by this grouping table */\n\n  *status = fits_get_num_members(gfptr,&nmembers,status);\n\n  /* loop over all group members and delete them */\n\n  for(i = nmembers; i > 0 && *status == 0; --i)\n    {\n      /* open the member HDU */\n\n      *status = fits_open_member(gfptr,i,&mfptr,status);\n\n      /* if the member cannot be opened then just skip it and continue */\n\n      if(*status == MEMBER_NOT_FOUND) \n\t{\n\t  *status = 0;\n\t  continue;\n\t}\n\n      /* Any other error is a reason to abort */\n      \n      if(*status != 0) continue;\n\n      /* add the member HDU to the HDUtracker struct */\n\n      *status = fftsad(mfptr,HDU,NULL,NULL);\n\n      /* status == HDU_ALREADY_TRACKED ==> HDU has already been processed */\n\n      if(*status == HDU_ALREADY_TRACKED) \n\t{\n\t  *status = 0;\n\t  fits_close_file(mfptr,status);\n\t  continue;\n\t}\n      else if(*status != 0) continue;\n\n      /* determine if the member HDU is itself a grouping table */\n\n      *status = fits_read_key_str(mfptr,\"EXTNAME\",keyvalue,comment,status);\n\n      /* if no EXTNAME is found then the HDU cannot be a grouping table */ \n\n      if(*status == KEY_NO_EXIST) \n\t{\n\t  *status     = 0;\n\t  keyvalue[0] = 0;\n\t}\n      prepare_keyvalue(keyvalue);\n\n      /* Any other error is a reason to abort */\n      \n      if(*status != 0) continue;\n\n      /* \n\t if the EXTNAME == GROUPING then the member is a grouping table \n\t and we must call ffgtrmr() to process its members\n      */\n\n      if(fits_strcasecmp(keyvalue,\"GROUPING\") == 0)\n\t  *status = ffgtrmr(mfptr,HDU,status);  \n\n      /* \n\t unlink all the grouping tables that contain this HDU as a member \n\t and then delete the HDU (if not a PHDU)\n      */\n\n      if(fits_get_hdu_num(mfptr,&hdutype) == 1)\n\t      *status = ffgmul(mfptr,1,status);\n      else\n\t  {\n\t      *status = ffgmul(mfptr,0,status);\n\t      *status = fits_delete_hdu(mfptr,&hdutype,status);\n\t  }\n\n      /* close the fitsfile pointer */\n\n      fits_close_file(mfptr,status);\n    }\n\n  return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgtcpr(fitsfile   *infptr,  /* input FITS file pointer                 */\n\t    fitsfile   *outfptr, /* output FITS file pointer                */\n\t    int         cpopt,   /* code specifying copy options:\n\t\t\t\t    OPT_GCP_GPT (0) ==> cp only grouping table\n\t\t\t\t    OPT_GCP_ALL (2) ==> recusrively copy \n\t\t\t\t    members and their members (if groups)   */\n\t    HDUtracker *HDU,     /* list of already copied HDUs             */\n\t    int        *status)  /* return status code                      */\n\n/*\n  copy a Group to a new FITS file. If the cpopt parameter is set to \n  OPT_GCP_GPT (copy grouping table only) then the existing members have their \n  GRPIDn and GRPLCn keywords updated to reflect the existance of the new group,\n  since they now belong to another group. If cpopt is set to OPT_GCP_ALL \n  (copy grouping table and members recursively) then the original members are \n  not updated; the new grouping table is modified to include only the copied \n  member HDUs and not the original members.\n\n  Note that this function is recursive. When copt is OPT_GCP_ALL it will call\n  itself whenever a member HDU of the current grouping table is itself a\n  grouping table (i.e., EXTNAME = 'GROUPING').\n*/\n\n{\n\n  int i;\n  int nexclude     = 8;\n  int hdutype      = 0;\n  int groupHDUnum  = 0;\n  int numkeys      = 0;\n  int keypos       = 0;\n  int startSearch  = 0;\n  int newPosition  = 0;\n\n  long nmembers    = 0;\n  long tfields     = 0;\n  long newTfields  = 0;\n\n  char keyword[FLEN_KEYWORD];\n  char keyvalue[FLEN_VALUE];\n  char card[FLEN_CARD];\n  char comment[FLEN_CARD];\n  char *tkeyvalue;\n\n  char *includeList[] = {\"*\"};\n  char *excludeList[] = {\"EXTNAME\",\"EXTVER\",\"GRPNAME\",\"GRPID#\",\"GRPLC#\",\n\t\t\t \"THEAP\",\"TDIM#\",\"T????#\"};\n\n  fitsfile *mfptr = NULL;\n\n\n  if(*status != 0) return(*status);\n\n  do\n    {\n      /*\n\tcreate a new grouping table in the FITS file pointed to by outptr\n      */\n\n      *status = fits_get_num_members(infptr,&nmembers,status);\n\n      *status = fits_read_key_str(infptr,\"GRPNAME\",keyvalue,card,status);\n\n      if(*status == KEY_NO_EXIST)\n\t{\n\t  keyvalue[0] = 0;\n\t  *status     = 0;\n\t}\n      prepare_keyvalue(keyvalue);\n\n      *status = fits_create_group(outfptr,keyvalue,GT_ID_ALL_URI,status);\n     \n      /* save the new grouping table's HDU position for future use */\n\n      fits_get_hdu_num(outfptr,&groupHDUnum);\n\n      /* update the HDUtracker struct with the grouping table's new position */\n      \n      *status = fftsud(infptr,HDU,groupHDUnum,NULL);\n\n      /*\n\tNow populate the copied grouping table depending upon the \n\tcopy option parameter value\n      */\n\n      switch(cpopt)\n\t{\n\n\t  /*\n\t    for the \"copy grouping table only\" option we only have to\n\t    add the members of the original grouping table to the new\n\t    grouping table\n\t  */\n\n\tcase OPT_GCP_GPT:\n\n\t  for(i = 1; i <= nmembers && *status == 0; ++i)\n\t    {\n\t      *status = fits_open_member(infptr,i,&mfptr,status);\n\t      *status = fits_add_group_member(outfptr,mfptr,0,status);\n\n\t      fits_close_file(mfptr,status);\n\t      mfptr = NULL;\n\t    }\n\n\t  break;\n\n\tcase OPT_GCP_ALL:\n      \n\t  /*\n\t    for the \"copy the entire group\" option\n \t  */\n\n\t  /* loop over all the grouping table members */\n\n\t  for(i = 1; i <= nmembers && *status == 0; ++i)\n\t    {\n\t      /* open the ith member */\n\n\t      *status = fits_open_member(infptr,i,&mfptr,status);\n\n\t      if(*status != 0) continue;\n\n\t      /* add it to the HDUtracker struct */\n\n\t      *status = fftsad(mfptr,HDU,&newPosition,NULL);\n\n\t      /* if already copied then just add the member to the group */\n\n\t      if(*status == HDU_ALREADY_TRACKED)\n\t\t{\n\t\t  *status = 0;\n\t\t  *status = fits_add_group_member(outfptr,NULL,newPosition,\n\t\t\t\t\t\t  status);\n\t\t  fits_close_file(mfptr,status);\n                  mfptr = NULL;\n\t\t  continue;\n\t\t}\n\t      else if(*status != 0) continue;\n\n\t      /* see if the member is a grouping table */\n\n\t      *status = fits_read_key_str(mfptr,\"EXTNAME\",keyvalue,card,\n\t\t\t\t\t  status);\n\n\t      if(*status == KEY_NO_EXIST)\n\t\t{\n\t\t  keyvalue[0] = 0;\n\t\t  *status     = 0;\n\t\t}\n\t      prepare_keyvalue(keyvalue);\n\n\t      /*\n\t\tif the member is a grouping table then copy it and all of\n\t\tits members using ffgtcpr(), else copy it using\n\t\tfits_copy_member(); the outptr will point to the newly\n\t\tcopied member upon return from both functions\n\t      */\n\n\t      if(fits_strcasecmp(keyvalue,\"GROUPING\") == 0)\n\t\t*status = ffgtcpr(mfptr,outfptr,OPT_GCP_ALL,HDU,status);\n\t      else\n\t\t*status = fits_copy_member(infptr,outfptr,i,OPT_MCP_NADD,\n\t\t\t\t\t   status);\n\n\t      /* retrieve the position of the newly copied member */\n\n\t      fits_get_hdu_num(outfptr,&newPosition);\n\n\t      /* update the HDUtracker struct with member's new position */\n\t      \n\t      if(fits_strcasecmp(keyvalue,\"GROUPING\") != 0)\n\t\t*status = fftsud(mfptr,HDU,newPosition,NULL);\n\n\t      /* move the outfptr back to the copied grouping table HDU */\n\n\t      *status = fits_movabs_hdu(outfptr,groupHDUnum,&hdutype,status);\n\n\t      /* add the copied member HDU to the copied grouping table */\n\n\t      *status = fits_add_group_member(outfptr,NULL,newPosition,status);\n\n\t      /* close the mfptr pointer */\n\n\t      fits_close_file(mfptr,status);\n\t      mfptr = NULL;\n\t    }\n\n\t  break;\n\n\tdefault:\n\t  \n\t  *status = BAD_OPTION;\n\t  ffpmsg(\"Invalid value specified for cmopt parameter (ffgtcpr)\");\n\t  break;\n\t}\n\n      if(*status != 0) continue; \n\n      /* \n\t reposition the outfptr to the grouping table so that the grouping\n\t table is the CHDU upon return to the calling function\n      */\n\n      fits_movabs_hdu(outfptr,groupHDUnum,&hdutype,status);\n\n      /*\n\t copy all auxiliary keyword records from the original grouping table\n\t to the new grouping table; they are copied in their original order\n\t and inserted just before the TTYPE1 keyword record\n      */\n\n      *status = fits_read_card(outfptr,\"TTYPE1\",card,status);\n      *status = fits_get_hdrpos(outfptr,&numkeys,&keypos,status);\n      --keypos;\n\n      startSearch = 8;\n\n      while(*status == 0)\n\t{\n\t  ffgrec(infptr,startSearch,card,status);\n\n\t  *status = fits_find_nextkey(infptr,includeList,1,excludeList,\n\t\t\t\t      nexclude,card,status);\n\n\t  *status = fits_get_hdrpos(infptr,&numkeys,&startSearch,status);\n\n\t  --startSearch;\n\t  /* SPR 1738 */\n\t  if (strncmp(card,\"GRPLC\",5)) {\n\t    /* Not going to be a long string so we're ok */\n\t    *status = fits_insert_record(outfptr,keypos,card,status);\n\t  } else {\n\t    /* We could have a long string */\n\t    *status = fits_read_record(infptr,startSearch,card,status);\n\t    card[9] = '\\0';\n\t    *status = fits_read_key_longstr(infptr,card,&tkeyvalue,comment,\n\t\t\t\t\t    status);\n\t    if (0 == *status) {\n\t      fits_insert_key_longstr(outfptr,card,tkeyvalue,comment,status);\n\t      fits_write_key_longwarn(outfptr,status);\n\t      free(tkeyvalue);\n\t    }\n\t  }\n\t  \n\t  ++keypos;\n\t}\n      \n\t  \n      if(*status == KEY_NO_EXIST) \n\t*status = 0;\n      else if(*status != 0) continue;\n\n      /*\n\t search all the columns of the original grouping table and copy\n\t those to the new grouping table that were not part of the grouping\n\t convention. Note that is legal to have additional columns in a\n\t grouping table. Also note that the order of the columns may\n\t not be the same in the original and copied grouping table.\n      */\n\n      /* retrieve the number of columns in the original and new group tables */\n\n      *status = fits_read_key_lng(infptr,\"TFIELDS\",&tfields,card,status);\n      *status = fits_read_key_lng(outfptr,\"TFIELDS\",&newTfields,card,status);\n\n      for(i = 1; i <= tfields; ++i)\n\t{\n\t  snprintf(keyword,FLEN_KEYWORD,\"TTYPE%d\",i);\n\t  *status = fits_read_key_str(infptr,keyword,keyvalue,card,status);\n\t  \n\t  if(*status == KEY_NO_EXIST)\n\t    {\n\t      *status = 0;\n              keyvalue[0] = 0;\n\t    }\n\t  prepare_keyvalue(keyvalue);\n\n\t  if(fits_strcasecmp(keyvalue,\"MEMBER_XTENSION\") != 0 &&\n\t     fits_strcasecmp(keyvalue,\"MEMBER_NAME\")     != 0 &&\n\t     fits_strcasecmp(keyvalue,\"MEMBER_VERSION\")  != 0 &&\n\t     fits_strcasecmp(keyvalue,\"MEMBER_POSITION\") != 0 &&\n\t     fits_strcasecmp(keyvalue,\"MEMBER_LOCATION\") != 0 &&\n\t     fits_strcasecmp(keyvalue,\"MEMBER_URI_TYPE\") != 0   )\n\t    {\n \n\t      /* SPR 3956, add at the end of the table */\n\t      *status = fits_copy_col(infptr,outfptr,i,newTfields+1,1,status);\n\t      ++newTfields;\n\t    }\n\t}\n\n    }while(0);\n\n  if(mfptr != NULL) \n    {\n      fits_close_file(mfptr,status);\n    }\n\n  return(*status);\n}\n\n/*--------------------------------------------------------------------------\n                HDUtracker struct manipulation functions\n  --------------------------------------------------------------------------*/\nint fftsad(fitsfile   *mfptr,       /* pointer to an member HDU             */\n\t   HDUtracker *HDU,         /* pointer to an HDU tracker struct     */\n\t   int        *newPosition, /* new HDU position of the member HDU   */\n\t   char       *newFileName) /* file containing member HDU           */\n\n/*\n  add an HDU to the HDUtracker struct pointed to by HDU. The HDU is only \n  added if it does not already reside in the HDUtracker. If it already\n  resides in the HDUtracker then the new HDU postion and file name are\n  returned in  newPosition and newFileName (if != NULL)\n*/\n\n{\n  int i;\n  int hdunum;\n  int status = 0;\n\n  char filename1[FLEN_FILENAME];\n  char filename2[FLEN_FILENAME];\n\n  do\n    {\n      /* retrieve the HDU's position within the FITS file */\n\n      fits_get_hdu_num(mfptr,&hdunum);\n      \n      /* retrieve the HDU's file name */\n      \n      status = fits_file_name(mfptr,filename1,&status);\n      \n      /* parse the file name and construct the \"standard\" URL for it */\n      \n      status = ffrtnm(filename1,filename2,&status);\n      \n      /* \n\t examine all the existing HDUs in the HDUtracker an see if this HDU\n\t has already been registered\n      */\n\n      for(i = 0; \n       i < HDU->nHDU &&  !(HDU->position[i] == hdunum \n\t\t\t   && strcmp(HDU->filename[i],filename2) == 0);\n\t  ++i);\n\n      if(i != HDU->nHDU) \n\t{\n\t  status = HDU_ALREADY_TRACKED;\n\t  if(newPosition != NULL) *newPosition = HDU->newPosition[i];\n\t  if(newFileName != NULL) strcpy(newFileName,HDU->newFilename[i]);\n\t  continue;\n\t}\n\n      if(HDU->nHDU == MAX_HDU_TRACKER) \n\t{\n\t  status = TOO_MANY_HDUS_TRACKED;\n\t  continue;\n\t}\n\n      HDU->filename[i] = (char*) malloc(FLEN_FILENAME * sizeof(char));\n\n      if(HDU->filename[i] == NULL)\n\t{\n\t  status = MEMORY_ALLOCATION;\n\t  continue;\n\t}\n\n      HDU->newFilename[i] = (char*) malloc(FLEN_FILENAME * sizeof(char));\n\n      if(HDU->newFilename[i] == NULL)\n\t{\n\t  status = MEMORY_ALLOCATION;\n\t  free(HDU->filename[i]);\n\t  continue;\n\t}\n\n      HDU->position[i]    = hdunum;\n      HDU->newPosition[i] = hdunum;\n\n      strcpy(HDU->filename[i],filename2);\n      strcpy(HDU->newFilename[i],filename2);\n \n       ++(HDU->nHDU);\n\n    }while(0);\n\n  return(status);\n}\n/*--------------------------------------------------------------------------*/\nint fftsud(fitsfile   *mfptr,       /* pointer to an member HDU             */\n\t   HDUtracker *HDU,         /* pointer to an HDU tracker struct     */\n\t   int         newPosition, /* new HDU position of the member HDU   */\n\t   char       *newFileName) /* file containing member HDU           */\n\n/*\n  update the HDU information in the HDUtracker struct pointed to by HDU. The \n  HDU to update is pointed to by mfptr. If non-zero, the value of newPosition\n  is used to update the HDU->newPosition[] value for the mfptr, and if\n  non-NULL the newFileName value is used to update the HDU->newFilename[]\n  value for mfptr.\n*/\n\n{\n  int i;\n  int hdunum;\n  int status = 0;\n\n  char filename1[FLEN_FILENAME];\n  char filename2[FLEN_FILENAME];\n\n\n  /* retrieve the HDU's position within the FITS file */\n  \n  fits_get_hdu_num(mfptr,&hdunum);\n  \n  /* retrieve the HDU's file name */\n  \n  status = fits_file_name(mfptr,filename1,&status);\n  \n  /* parse the file name and construct the \"standard\" URL for it */\n      \n  status = ffrtnm(filename1,filename2,&status);\n\n  /* \n     examine all the existing HDUs in the HDUtracker an see if this HDU\n     has already been registered\n  */\n\n  for(i = 0; i < HDU->nHDU && \n      !(HDU->position[i] == hdunum && strcmp(HDU->filename[i],filename2) == 0);\n      ++i);\n\n  /* if previously registered then change newPosition and newFileName */\n\n  if(i != HDU->nHDU) \n    {\n      if(newPosition  != 0) HDU->newPosition[i] = newPosition;\n      if(newFileName  != NULL) \n\t{\n\t  strcpy(HDU->newFilename[i],newFileName);\n\t}\n    }\n  else\n    status = MEMBER_NOT_FOUND;\n \n  return(status);\n}\n\n/*---------------------------------------------------------------------------*/\n\nvoid prepare_keyvalue(char *keyvalue) /* string containing keyword value     */\n\n/*\n  strip off all single quote characters \"'\" and blank spaces from a keyword\n  value retrieved via fits_read_key*() routines\n\n  this is necessary so that a standard comparision of keyword values may\n  be made\n*/\n\n{\n\n  int i;\n  int length;\n\n  /*\n    strip off any leading or trailing single quotes (`) and (') from\n    the keyword value\n  */\n\n  length = strlen(keyvalue) - 1;\n\n  if(keyvalue[0] == '\\'' && keyvalue[length] == '\\'')\n    {\n      for(i = 0; i < length - 1; ++i) keyvalue[i] = keyvalue[i+1];\n      keyvalue[length-1] = 0;\n    }\n  \n  /*\n    strip off any trailing blanks from the keyword value; note that if the\n    keyvalue consists of nothing but blanks then no blanks are stripped\n  */\n\n  length = strlen(keyvalue) - 1;\n\n  for(i = 0; i < length && keyvalue[i] == ' '; ++i);\n\n  if(i != length)\n    {\n      for(i = length; i >= 0 && keyvalue[i] == ' '; --i) keyvalue[i] = '\\0';\n    }\n}\n\n/*---------------------------------------------------------------------------\n        Host dependent directory path to/from URL functions\n  --------------------------------------------------------------------------*/\nint fits_path2url(char *inpath,  /* input file path string                  */\n                  int maxlength, /* I max number of chars that can be written\n                             to output, including terminating NULL */\n\t\t  char *outpath, /* output file path string                 */\n\t\t  int  *status)\n  /*\n     convert a file path into its Unix-style equivelent for URL \n     purposes. Note that this process is platform dependent. This\n     function supports Unix, MSDOS/WIN32, VMS and Macintosh platforms. \n     The plaform dependant code is conditionally compiled depending upon\n     the setting of the appropriate C preprocessor macros.\n   */\n{\n  char buff[FLEN_FILENAME];\n\n#if defined(WINNT) || defined(__WINNT__)\n\n  /*\n    Microsoft Windows NT case. We assume input file paths of the form:\n\n    //disk/path/filename\n\n     All path segments may be null, so that a single file name is the\n     simplist case.\n\n     The leading \"//\" becomes a single \"/\" if present. If no \"//\" is present,\n     then make sure the resulting URL path is relative, i.e., does not\n     begin with a \"/\". In other words, the only way that an absolute URL\n     file path may be generated is if the drive specification is given.\n  */\n\n  if(*status > 0) return(*status);\n\n  if(inpath[0] == '/')\n    {\n      strcpy(buff,inpath+1);\n    }\n  else\n    {\n      strcpy(buff,inpath);\n    }\n\n#elif defined(MSDOS) || defined(__WIN32__) || defined(WIN32)\n\n  /*\n     MSDOS or Microsoft windows/NT case. The assumed form of the\n     input path is:\n\n     disk:\\path\\filename\n\n     All path segments may be null, so that a single file name is the\n     simplist case.\n\n     All back-slashes '\\' become slashes '/'; if the path starts with a\n     string of the form \"X:\" then it is replaced with \"/X/\"\n  */\n\n  int i,j,k;\n  int size;\n  if(*status > 0) return(*status);\n\n  for(i = 0, j = 0, size = strlen(inpath), buff[0] = 0; \n                                           i < size; j = strlen(buff))\n    {\n      switch(inpath[i])\n\t{\n\n\tcase ':':\n\n\t  /*\n\t     must be a disk desiginator; add a slash '/' at the start of\n\t     outpath to designate that the path is absolute, then change\n\t     the colon ':' to a slash '/'\n\t   */\n\n\t  for(k = j; k >= 0; --k) buff[k+1] = buff[k];\n\t  buff[0] = '/';\n\t  strcat(buff,\"/\");\n\t  ++i;\n\t  \n\t  break;\n\n\tcase '\\\\':\n\n\t  /* just replace the '\\' with a '/' IF its not the first character */\n\n\t  if(i != 0 && buff[(j == 0 ? 0 : j-1)] != '/')\n\t    {\n\t      buff[j] = '/';\n\t      buff[j+1] = 0;\n\t    }\n\n\t  ++i;\n\n\t  break;\n\n\tdefault:\n\n\t  /* copy the character from inpath to buff as is */\n\n\t  buff[j]   = inpath[i];\n\t  buff[j+1] = 0;\n\t  ++i;\n\n\t  break;\n\t}\n    }\n\n#elif defined(VMS) || defined(vms) || defined(__vms)\n\n  /*\n     VMS case. Assumed format of the input path is:\n\n     node::disk:[path]filename.ext;version\n\n     Any part of the file path may be missing, so that in the simplist\n     case a single file name/extension is given.\n\n     all brackets \"[\", \"]\" and dots \".\" become \"/\"; dashes \"-\" become \"..\", \n     all single colons \":\" become \":/\", all double colons \"::\" become\n     \"FILE://\"\n   */\n\n  int i,j,k;\n  int done;\n  int size;\n\n  if(*status > 0) return(*status);\n     \n  /* see if inpath contains a directory specification */\n\n  if(strchr(inpath,']') == NULL) \n    done = 1;\n  else\n    done = 0;\n\n  for(i = 0, j = 0, size = strlen(inpath), buff[0] = 0; \n                           i < size && j < FLEN_FILENAME - 8; j = strlen(buff))\n    {\n      switch(inpath[i])\n\t{\n\n\tcase ':':\n\n\t  /*\n\t     must be a logical/symbol separator or (in the case of a double\n\t     colon \"::\") machine node separator\n\t   */\n\n\t  if(inpath[i+1] == ':')\n\t    {\n\t      /* insert a \"FILE://\" at the start of buff ==> machine given */\n\n\t      for(k = j; k >= 0; --k) buff[k+7] = buff[k];\n\t      strncpy(buff,\"FILE://\",7);\n\t      i += 2;\n\t    }\n\t  else if(strstr(buff,\"FILE://\") == NULL)\n\t    {\n\t      /* insert a \"/\" at the start of buff ==> absolute path */\n\n\t      for(k = j; k >= 0; --k) buff[k+1] = buff[k];\n\t      buff[0] = '/';\n\t      ++i;\n\t    }\n\t  else\n\t    ++i;\n\n\t  /* a colon always ==> path separator */\n\n\t  strcat(buff,\"/\");\n\n\t  break;\n  \n\tcase ']':\n\n\t  /* end of directory spec, file name spec begins after this */\n\n\t  done = 1;\n\n\t  buff[j]   = '/';\n\t  buff[j+1] = 0;\n\t  ++i;\n\n\t  break;\n\n\tcase '[':\n\n\t  /* \n\t     begin directory specification; add a '/' only if the last char \n\t     is not '/' \n\t  */\n\n\t  if(i != 0 && buff[(j == 0 ? 0 : j-1)] != '/')\n\t    {\n\t      buff[j]   = '/';\n\t      buff[j+1] = 0;\n\t    }\n\n\t  ++i;\n\n\t  break;\n\n\tcase '.':\n\n\t  /* \n\t     directory segment separator or file name/extension separator;\n\t     we decide which by looking at the value of done\n\t  */\n\n\t  if(!done)\n\t    {\n\t    /* must be a directory segment separator */\n\t      if(inpath[i-1] == '[')\n\t\t{\n\t\t  strcat(buff,\"./\");\n\t\t  ++j;\n\t\t}\n\t      else\n\t\tbuff[j] = '/';\n\t    }\n\t  else\n\t    /* must be a filename/extension separator */\n\t    buff[j] = '.';\n\n\t  buff[j+1] = 0;\n\n\t  ++i;\n\n\t  break;\n\n\tcase '-':\n\n\t  /* \n\t     a dash is the same as \"..\" in Unix speak, but lets make sure\n\t     that its not part of the file name first!\n\t   */\n\n\t  if(!done)\n\t    /* must be part of the directory path specification */\n\t    strcat(buff,\"..\");\n\t  else\n\t    {\n\t      /* the dash is part of the filename, so just copy it as is */\n\t      buff[j] = '-';\n\t      buff[j+1] = 0;\n\t    }\n\n\t  ++i;\n\n\t  break;\n\n\tdefault:\n\n\t  /* nothing special, just copy the character as is */\n\n\t  buff[j]   = inpath[i];\n\t  buff[j+1] = 0;\n\n\t  ++i;\n\n\t  break;\n\n\t}\n    }\n\n  if(j > FLEN_FILENAME - 8)\n    {\n      *status = URL_PARSE_ERROR;\n      ffpmsg(\"resulting path to URL conversion too big (fits_path2url)\");\n    }\n\n#elif defined(macintosh)\n\n  /*\n     MacOS case. The assumed form of the input path is:\n\n     disk:path:filename\n\n     It is assumed that all paths are absolute with disk and path specified,\n     unless no colons \":\" are supplied with the string ==> a single file name\n     only. All colons \":\" become slashes \"/\", and if one or more colon is \n     encountered then the path is specified as absolute.\n  */\n\n  int i,j,k;\n  int firstColon;\n  int size;\n\n  if(*status > 0) return(*status);\n\n  for(i = 0, j = 0, firstColon = 1, size = strlen(inpath), buff[0] = 0; \n                                                   i < size; j = strlen(buff))\n    {\n      switch(inpath[i])\n\t{\n\n\tcase ':':\n\n\t  /*\n\t     colons imply path separators. If its the first colon encountered\n\t     then assume that its the disk designator and add a slash to the\n\t     beginning of the buff string\n\t   */\n\t  \n\t  if(firstColon)\n\t    {\n\t      firstColon = 0;\n\n\t      for(k = j; k >= 0; --k) buff[k+1] = buff[k];\n\t      buff[0] = '/';\n\t    }\n\n\t  /* all colons become slashes */\n\n\t  strcat(buff,\"/\");\n\n\t  ++i;\n\t  \n\t  break;\n\n\tdefault:\n\n\t  /* copy the character from inpath to buff as is */\n\n\t  buff[j]   = inpath[i];\n\t  buff[j+1] = 0;\n\n\t  ++i;\n\n\t  break;\n\t}\n    }\n\n#else \n\n  /*\n     Default Unix case.\n\n     Nothing special to do here except to remove the double or more // and \n     replace them with single /\n   */\n\n  int ii = 0;\n  int jj = 0;\n\n  if(*status > 0) return(*status);\n\n  while (inpath[ii]) {\n      if (inpath[ii] == '/' && inpath[ii+1] == '/') {\n\t  /* do nothing */\n      } else {\n\t  buff[jj] = inpath[ii];\n\t  jj++;\n      }\n      ii++;\n  }\n  buff[jj] = '\\0';\n  /* printf(\"buff is %s\\ninpath is %s\\n\",buff,inpath); */\n  /* strcpy(buff,inpath); */\n\n#endif\n\n  /*\n    encode all \"unsafe\" and \"reserved\" URL characters\n  */\n\n  *status = fits_encode_url(buff,maxlength,outpath,status);\n\n  return(*status);\n}\n\n/*---------------------------------------------------------------------------*/\nint fits_url2path(char *inpath,  /* input file path string  */\n\t\t  char *outpath, /* output file path string */\n\t\t  int  *status)\n  /*\n     convert a Unix-style URL into a platform dependent directory path. \n     Note that this process is platform dependent. This\n     function supports Unix, MSDOS/WIN32, VMS and Macintosh platforms. Each\n     platform dependent code segment is conditionally compiled depending \n     upon the setting of the appropriate C preprocesser macros.\n   */\n{\n  char buff[FLEN_FILENAME];\n  int absolute;\n\n#if defined(MSDOS) || defined(__WIN32__) || defined(WIN32)\n  char *tmpStr, *saveptr;\n#elif defined(VMS) || defined(vms) || defined(__vms)\n  int i;\n  char *tmpStr, *saveptr;\n#elif defined(macintosh)\n  char *tmpStr, *saveptr;\n#endif\n\n  if(*status != 0) return(*status);\n\n  /*\n    make a copy of the inpath so that we can manipulate it\n  */\n\n  strcpy(buff,inpath);\n\n  /*\n    convert any encoded characters to their unencoded values\n  */\n\n  *status = fits_unencode_url(inpath,buff,status);\n\n  /*\n    see if the URL is given as absolute w.r.t. the \"local\" file system\n  */\n\n  if(buff[0] == '/') \n    absolute = 1;\n  else\n    absolute = 0;\n\n#if defined(WINNT) || defined(__WINNT__)\n\n  /*\n    Microsoft Windows NT case. We create output paths of the form\n\n    //disk/path/filename\n\n     All path segments but the last may be null, so that a single file name \n     is the simplist case.     \n  */\n\n  if(absolute)\n    {\n      strcpy(outpath,\"/\");\n      strcat(outpath,buff);\n    }\n  else\n    {\n      strcpy(outpath,buff);\n    }\n\n#elif defined(MSDOS) || defined(__WIN32__) || defined(WIN32)\n\n  /*\n     MSDOS or Microsoft windows/NT case. The output path will be of the\n     form\n\n     disk:\\path\\filename\n\n     All path segments but the last may be null, so that a single file name \n     is the simplist case.\n  */\n\n  /*\n    separate the URL into tokens at each slash '/' and process until\n    all tokens have been examined\n  */\n\n  for(tmpStr = ffstrtok(buff,\"/\",&saveptr), outpath[0] = 0;\n                                 tmpStr != NULL; tmpStr = ffstrtok(NULL,\"/\",&saveptr))\n    {\n      strcat(outpath,tmpStr);\n\n      /* \n\t if the absolute flag is set then process the token as a disk \n\t specification; else just process it as a directory path or filename\n      */\n\n      if(absolute)\n\t{\n\t  strcat(outpath,\":\\\\\");\n\t  absolute = 0;\n\t}\n      else\n\tstrcat(outpath,\"\\\\\");\n    }\n\n  /* remove the last \"\\\" from the outpath, it does not belong there */\n\n  outpath[strlen(outpath)-1] = 0;\n\n#elif defined(VMS) || defined(vms) || defined(__vms)\n\n  /*\n     VMS case. The output path will be of the form:\n\n     node::disk:[path]filename.ext;version\n\n     Any part of the file path may be missing execpt filename.ext, so that in \n     the simplist case a single file name/extension is given.\n\n     if the path is specified as relative starting with \"./\" then the first\n     part of the VMS path is \"[.\". If the path is relative and does not start\n     with \"./\" (e.g., \"a/b/c\") then the VMS path is constructed as\n     \"[a.b.c]\"\n   */\n     \n  /*\n    separate the URL into tokens at each slash '/' and process until\n    all tokens have been examined\n  */\n\n  for(tmpStr = ffstrtok(buff,\"/\",&saveptr), outpath[0] = 0; \n                                 tmpStr != NULL; tmpStr = ffstrtok(NULL,\"/\",&saveptr))\n    {\n\n      if(fits_strcasecmp(tmpStr,\"FILE:\") == 0)\n\t{\n\t  /* the next token should contain the DECnet machine name */\n\n\t  tmpStr = ffstrtok(NULL,\"/\",&saveptr);\n\t  if(tmpStr == NULL) continue;\n\n\t  strcat(outpath,tmpStr);\n\t  strcat(outpath,\"::\");\n\n\t  /* set the absolute flag to true for the next token */\n\t  absolute = 1;\n\t}\n\n      else if(strcmp(tmpStr,\"..\") == 0)\n\t{\n\t  /* replace all Unix-like \"..\" with VMS \"-\" */\n\n\t  if(strlen(outpath) == 0) strcat(outpath,\"[\");\n\t  strcat(outpath,\"-.\");\n\t}\n\n      else if(strcmp(tmpStr,\".\") == 0 && strlen(outpath) == 0)\n\t{\n\t  /*\n\t    must indicate a relative path specifier\n\t  */\n\n\t  strcat(outpath,\"[.\");\n\t}\n  \n      else if(strchr(tmpStr,'.') != NULL)\n\t{\n\t  /* \n\t     must be up to the file name; turn the last \".\" path separator\n\t     into a \"]\" and then add the file name to the outpath\n\t  */\n\t  \n\t  i = strlen(outpath);\n\t  if(i > 0 && outpath[i-1] == '.') outpath[i-1] = ']';\n\n\t  strcat(outpath,tmpStr);\n\t}\n\n      else\n\t{\n\t  /*\n\t    process the token as a a directory path segement\n\t  */\n\n\t  if(absolute)\n\t    {\n\t      /* treat the token as a disk specifier */\n\t      absolute = 0;\n\t      strcat(outpath,tmpStr);\n\t      strcat(outpath,\":[\");\n\t    }\n\t  else if(strlen(outpath) == 0)\n\t    {\n\t      /* treat the token as the first directory path specifier */\n\t      strcat(outpath,\"[\");\n\t      strcat(outpath,tmpStr);\n\t      strcat(outpath,\".\");\n\t    }\n\t  else\n\t    {\n\t      /* treat the token as an imtermediate path specifier */\n\t      strcat(outpath,tmpStr);\n\t      strcat(outpath,\".\");\n\t    }\n\t}\n    }\n\n#elif defined(macintosh)\n\n  /*\n     MacOS case. The output path will be of the form\n\n     disk:path:filename\n\n     All path segments but the last may be null, so that a single file name \n     is the simplist case.\n  */\n\n  /*\n    separate the URL into tokens at each slash '/' and process until\n    all tokens have been examined\n  */\n\n  for(tmpStr = ffstrtok(buff,\"/\",&saveptr), outpath[0] = 0;\n                                 tmpStr != NULL; tmpStr = ffstrtok(NULL,\"/\",&saveptr))\n    {\n      strcat(outpath,tmpStr);\n      strcat(outpath,\":\");\n    }\n\n  /* remove the last \":\" from the outpath, it does not belong there */\n\n  outpath[strlen(outpath)-1] = 0;\n\n#else\n\n  /*\n     Default Unix case.\n\n     Nothing special to do here\n   */\n\n  strcpy(outpath,buff);\n\n#endif\n\n  return(*status);\n}\n\n/****************************************************************************/\nint fits_get_cwd(char *cwd,  /* IO current working directory string */\n\t\t int  *status)\n  /*\n     retrieve the string containing the current working directory absolute\n     path in Unix-like URL standard notation. It is assumed that the CWD\n     string has a size of at least FLEN_FILENAME.\n\n     Note that this process is platform dependent. This\n     function supports Unix, MSDOS/WIN32, VMS and Macintosh platforms. Each\n     platform dependent code segment is conditionally compiled depending \n     upon the setting of the appropriate C preprocesser macros.\n   */\n{\n\n  char buff[FLEN_FILENAME];\n\n\n  if(*status != 0) return(*status);\n\n#if defined(macintosh)\n\n  /*\n     MacOS case. Currently unknown !!!!\n  */\n\n  *buff = 0;\n\n#else\n  /*\n    Good old getcwd() seems to work with all other platforms\n  */\n\n  if (!getcwd(buff,FLEN_FILENAME))\n  {\n     cwd[0]=0;\n     ffpmsg(\"Path and file name too long (fits_get_cwd)\");\n     return (*status=URL_PARSE_ERROR);\n  }\n\n#endif\n\n  /*\n    convert the cwd string to a URL standard path string\n  */\n\n  fits_path2url(buff,FLEN_FILENAME,cwd,status);\n\n  return(*status);\n}\n\n/*---------------------------------------------------------------------------*/\nint  fits_get_url(fitsfile *fptr,       /* I ptr to FITS file to evaluate    */\n\t\t  char     *realURL,    /* O URL of real FITS file           */\n\t\t  char     *startURL,   /* O URL of starting FITS file       */\n\t\t  char     *realAccess, /* O true access method of FITS file */\n\t\t  char     *startAccess,/* O \"official\" access of FITS file  */\n\t\t  int      *iostate,    /* O can this file be modified?      */\n\t\t  int      *status)\n/*\n  For grouping convention purposes, determine the URL of the FITS file\n  associated with the fitsfile pointer fptr. The true access type (file://,\n  mem://, shmem://, root://), starting \"official\" access type, and iostate \n  (0 ==> readonly, 1 ==> readwrite) are also returned.\n\n  It is assumed that the url string has enough room to hold the resulting\n  URL, and the the accessType string has enough room to hold the access type.\n*/\n{\n  int i;\n  int tmpIOstate = 0;\n\n  char infile[FLEN_FILENAME];\n  char outfile[FLEN_FILENAME];\n  char tmpStr1[FLEN_FILENAME];\n  char tmpStr2[FLEN_FILENAME];\n  char tmpStr3[FLEN_FILENAME];\n  char tmpStr4[FLEN_FILENAME];\n  char *tmpPtr;\n\n\n  if(*status != 0) return(*status);\n\n  do\n    {\n      /* \n\t retrieve the member HDU's file name as opened by ffopen() \n\t and parse it into its constitutent pieces; get the currently\n\t active driver token too\n       */\n\t  \n      *tmpStr1 = *tmpStr2 = *tmpStr3 = *tmpStr4 = 0;\n\n      *status = fits_file_name(fptr,tmpStr1,status);\n\n      *status = ffiurl(tmpStr1,NULL,infile,outfile,NULL,tmpStr2,tmpStr3,\n\t\t       tmpStr4,status);\n\n      if((*tmpStr2) || (*tmpStr3) || (*tmpStr4)) tmpIOstate = -1;\n \n      *status = ffurlt(fptr,tmpStr3,status);\n\n      strcpy(tmpStr4,tmpStr3);\n\n      *status = ffrtnm(tmpStr1,tmpStr2,status);\n      strcpy(tmpStr1,tmpStr2);\n\n      /*\n\tfor grouping convention purposes (only) determine the URL of the\n\tactual FITS file being used for the given fptr, its true access \n\ttype (file://, mem://, shmem://, root://) and its iostate (0 ==>\n\tread only, 1 ==> readwrite)\n      */\n\n      /*\n\tThe first set of access types are \"simple\" in that they do not\n\tuse any redirection to temporary memory or outfiles\n       */\n\n      /* standard disk file driver is in use */\n      \n      if(fits_strcasecmp(tmpStr3,\"file://\")              == 0)         \n\t{\n\t  tmpIOstate = 1;\n\t  \n\t  if(strlen(outfile)) strcpy(tmpStr1,outfile);\n\t  else *tmpStr2 = 0;\n\n\t  /*\n\t    make sure no FILE:// specifier is given in the tmpStr1\n\t    or tmpStr2 strings; the convention calls for local files\n\t    to have no access specification\n\t  */\n\n\t  if((tmpPtr = strstr(tmpStr1,\"://\")) != NULL)\n\t    {\n\t      strcpy(infile,tmpPtr+3);\n\t      strcpy(tmpStr1,infile);\n\t    }\n\n\t  if((tmpPtr = strstr(tmpStr2,\"://\")) != NULL)\n\t    {\n\t      strcpy(infile,tmpPtr+3);\n\t      strcpy(tmpStr2,infile);\n\t    }\n\t}\n\n      /* file stored in conventional memory */\n\t  \n      else if(fits_strcasecmp(tmpStr3,\"mem://\")          == 0)          \n\t{\n\t  if(tmpIOstate < 0)\n\t    {\n\t      /* file is a temp mem file only */\n\t      ffpmsg(\"cannot make URL from temp MEM:// file (fits_get_url)\");\n\t      *status = URL_PARSE_ERROR;\n\t    }\n\t  else\n\t    {\n\t      /* file is a \"perminate\" mem file for this process */\n\t      tmpIOstate = 1;\n\t      *tmpStr2 = 0;\n\t    }\n\t}\n\n      /* file stored in conventional memory */\n \n     else if(fits_strcasecmp(tmpStr3,\"memkeep://\")      == 0)      \n\t{\n\t  strcpy(tmpStr3,\"mem://\");\n\t  *tmpStr4 = 0;\n\t  *tmpStr2 = 0;\n\t  tmpIOstate = 1;\n\t}\n\n      /* file residing in shared memory */\n\n      else if(fits_strcasecmp(tmpStr3,\"shmem://\")        == 0)        \n\t{\n\t  *tmpStr4   = 0;\n\t  *tmpStr2   = 0;\n\t  tmpIOstate = 1;\n\t}\n      \n      /* file accessed via the ROOT network protocol */\n\n      else if(fits_strcasecmp(tmpStr3,\"root://\")         == 0)         \n\t{\n\t  *tmpStr4   = 0;\n\t  *tmpStr2   = 0;\n\t  tmpIOstate = 1;\n\t}\n  \n      /*\n\tthe next set of access types redirect the contents of the original\n\tfile to an special outfile because the original could not be\n\tdirectly modified (i.e., resides on the network, was compressed).\n\tIn these cases the URL string takes on the value of the OUTFILE,\n\tthe access type becomes file://, and the iostate is set to 1 (can\n\tread/write to the file).\n      */\n\n      /* compressed file uncompressed and written to disk */\n\n      else if(fits_strcasecmp(tmpStr3,\"compressfile://\") == 0) \n\t{\n\t  strcpy(tmpStr1,outfile);\n\t  strcpy(tmpStr2,infile);\n\t  strcpy(tmpStr3,\"file://\");\n\t  strcpy(tmpStr4,\"file://\");\n\t  tmpIOstate = 1;\n\t}\n\n      /* HTTP accessed file written locally to disk */\n\n      else if(fits_strcasecmp(tmpStr3,\"httpfile://\")     == 0)     \n\t{\n\t  strcpy(tmpStr1,outfile);\n\t  strcpy(tmpStr3,\"file://\");\n\t  strcpy(tmpStr4,\"http://\");\n\t  tmpIOstate = 1;\n\t}\n      \n      /* FTP accessd file written locally to disk */\n\n      else if(fits_strcasecmp(tmpStr3,\"ftpfile://\")      == 0)      \n\t{\n\t  strcpy(tmpStr1,outfile);\n\t  strcpy(tmpStr3,\"file://\");\n\t  strcpy(tmpStr4,\"ftp://\");\n\t  tmpIOstate = 1;\n\t}\n      \n      /* file from STDIN written to disk */\n\n      else if(fits_strcasecmp(tmpStr3,\"stdinfile://\")    == 0)    \n\t{\n\t  strcpy(tmpStr1,outfile);\n\t  strcpy(tmpStr3,\"file://\");\n\t  strcpy(tmpStr4,\"stdin://\");\n\t  tmpIOstate = 1;\n\t}\n\n      /* \n\t the following access types use memory resident files as temporary\n\t storage; they cannot be modified or be made group members for \n\t grouping conventions purposes, but their original files can be.\n\t Thus, their tmpStr3s are reset to mem://, their iostate\n\t values are set to 0 (for no-modification), and their URL string\n\t values remain set to their original values\n       */\n\n      /* compressed disk file uncompressed into memory */\n\n      else if(fits_strcasecmp(tmpStr3,\"compress://\")     == 0)     \n\t{\n\t  *tmpStr1 = 0;\n\t  strcpy(tmpStr2,infile);\n\t  strcpy(tmpStr3,\"mem://\");\n\t  strcpy(tmpStr4,\"file://\");\n\t  tmpIOstate = 0;\n\t}\n      \n      /* HTTP accessed file transferred into memory */\n\n      else if(fits_strcasecmp(tmpStr3,\"http://\")         == 0)         \n\t{\n\t  *tmpStr1 = 0;\n\t  strcpy(tmpStr3,\"mem://\");\n\t  strcpy(tmpStr4,\"http://\");\n\t  tmpIOstate = 0;\n\t}\n      \n      /* HTTP accessed compressed file transferred into memory */\n\n      else if(fits_strcasecmp(tmpStr3,\"httpcompress://\") == 0) \n\t{\n\t  *tmpStr1 = 0;\n\t  strcpy(tmpStr3,\"mem://\");\n\t  strcpy(tmpStr4,\"http://\");\n\t  tmpIOstate = 0;\n\t}\n      \n      /* FTP accessed file transferred into memory */\n      \n      else if(fits_strcasecmp(tmpStr3,\"ftp://\")          == 0)          \n\t{\n\t  *tmpStr1 = 0;\n\t  strcpy(tmpStr3,\"mem://\");\n\t  strcpy(tmpStr4,\"ftp://\");\n\t  tmpIOstate = 0;\n\t}\n      \n      /* FTP accessed compressed file transferred into memory */\n\n      else if(fits_strcasecmp(tmpStr3,\"ftpcompress://\")  == 0)  \n\t{\n\t  *tmpStr1 = 0;\n\t  strcpy(tmpStr3,\"mem://\");\n\t  strcpy(tmpStr4,\"ftp://\");\n\t  tmpIOstate = 0;\n\t}\t\n      \n      /*\n\tThe last set of access types cannot be used to make a meaningful URL \n\tstrings from; thus an error is generated\n       */\n\n      else if(fits_strcasecmp(tmpStr3,\"stdin://\")        == 0)        \n\t{\n\t  *status = URL_PARSE_ERROR;\n\t  ffpmsg(\"cannot make valid URL from stdin:// (fits_get_url)\");\n\t  *tmpStr1 = *tmpStr2 = 0;\n\t}\n\n      else if(fits_strcasecmp(tmpStr3,\"stdout://\")       == 0)       \n\t{\n\t  *status = URL_PARSE_ERROR;\n\t  ffpmsg(\"cannot make valid URL from stdout:// (fits_get_url)\");\n\t  *tmpStr1 = *tmpStr2 = 0;\n\t}\n\n      else if(fits_strcasecmp(tmpStr3,\"irafmem://\")      == 0)      \n\t{\n\t  *status = URL_PARSE_ERROR;\n\t  ffpmsg(\"cannot make valid URL from irafmem:// (fits_get_url)\");\n\t  *tmpStr1 = *tmpStr2 = 0;\n\t}\n\n      if(*status != 0) continue;\n\n      /*\n\t assign values to the calling parameters if they are non-NULL\n      */\n\n      if(realURL != NULL)\n\t{\n\t  if(strlen(tmpStr1) == 0)\n\t    *realURL = 0;\n\t  else\n\t    {\n\t      if((tmpPtr = strstr(tmpStr1,\"://\")) != NULL)\n\t\t{\n\t\t  tmpPtr += 3;\n\t\t  i = (long)tmpPtr - (long)tmpStr1;\n\t\t  strncpy(realURL,tmpStr1,i);\n\t\t}\n\t      else\n\t\t{\n\t\t  tmpPtr = tmpStr1;\n\t\t  i = 0;\n\t\t}\n\n\t      *status = fits_path2url(tmpPtr,FLEN_FILENAME-i,realURL+i,status);\n\t    }\n\t}\n\n      if(startURL != NULL)\n\t{\n\t  if(strlen(tmpStr2) == 0)\n\t    *startURL = 0;\n\t  else\n\t    {\n\t      if((tmpPtr = strstr(tmpStr2,\"://\")) != NULL)\n\t\t{\n\t\t  tmpPtr += 3;\n\t\t  i = (long)tmpPtr - (long)tmpStr2;\n\t\t  strncpy(startURL,tmpStr2,i);\n\t\t}\n\t      else\n\t\t{\n\t\t  tmpPtr = tmpStr2;\n\t\t  i = 0;\n\t\t}\n\n\t      *status = fits_path2url(tmpPtr,FLEN_FILENAME-i,startURL+i,status);\n\t    }\n\t}\n\n      if(realAccess  != NULL)  strcpy(realAccess,tmpStr3);\n      if(startAccess != NULL)  strcpy(startAccess,tmpStr4);\n      if(iostate     != NULL) *iostate = tmpIOstate;\n\n    }while(0);\n\n  return(*status);\n}\n\n/*--------------------------------------------------------------------------\n                           URL parse support functions\n  --------------------------------------------------------------------------*/\n\n/* simple push/pop/shift/unshift string stack for use by fits_clean_url */\ntypedef char* grp_stack_data; /* type of data held by grp_stack */\n\ntypedef struct grp_stack_item_struct {\n  grp_stack_data data; /* value of this stack item */\n  struct grp_stack_item_struct* next; /* next stack item */\n  struct grp_stack_item_struct* prev; /* previous stack item */\n} grp_stack_item;\n\ntypedef struct grp_stack_struct {\n  size_t stack_size; /* number of items on stack */\n  grp_stack_item* top; /* top item */\n} grp_stack;\n\nstatic char* grp_stack_default = NULL; /* initial value for new instances\n                                          of grp_stack_data */\n\n/* the following functions implement the group string stack grp_stack */\nstatic void delete_grp_stack(grp_stack** mystack);\nstatic grp_stack_item* grp_stack_append(\n  grp_stack_item* last, grp_stack_data data\n);\nstatic grp_stack_data grp_stack_remove(grp_stack_item* last);\nstatic grp_stack* new_grp_stack(void);\nstatic grp_stack_data pop_grp_stack(grp_stack* mystack);\nstatic void push_grp_stack(grp_stack* mystack, grp_stack_data data);\nstatic grp_stack_data shift_grp_stack(grp_stack* mystack);\n/* static void unshift_grp_stack(grp_stack* mystack, grp_stack_data data); */\n\nint fits_clean_url(char *inURL,  /* I input URL string                      */\n\t\t   char *outURL, /* O output URL string                     */\n\t\t   int  *status)\n/*\n  clean the URL by eliminating any \"..\" or \".\" specifiers in the inURL\n  string, and write the output to the outURL string.\n\n  Note that this function must have a valid Unix-style URL as input; platform\n  dependent path strings are not allowed.\n */\n{\n  grp_stack* mystack; /* stack to hold pieces of URL */\n  char* tmp;\n  char *saveptr;\n\n  if(*status) return *status;\n\n  mystack = new_grp_stack();\n  *outURL = 0;\n\n  do {\n    /* handle URL scheme and domain if they exist */\n    tmp = strstr(inURL, \"://\");\n    if(tmp) {\n      /* there is a URL scheme, so look for the end of the domain too */\n      tmp = strchr(tmp + 3, '/');\n      if(tmp) {\n        /* tmp is now the end of the domain, so\n         * copy URL scheme and domain as is, and terminate by hand */\n        size_t string_size = (size_t) (tmp - inURL);\n        strncpy(outURL, inURL, string_size);\n        outURL[string_size] = 0;\n\n        /* now advance the input pointer to just after the domain and go on */\n        inURL = tmp;\n      } else {\n        /* '/' was not found, which means there are no path-like\n         * portions, so copy whole inURL to outURL and we're done */\n        strcpy(outURL, inURL);\n        continue; /* while(0) */\n      }\n    }\n\n    /* explicitly copy a leading / (absolute path) */\n    if('/' == *inURL) strcat(outURL, \"/\");\n\n    /* now clean the remainder of the inURL. push URL segments onto\n     * stack, dealing with .. and . as we go */\n    tmp = ffstrtok(inURL, \"/\",&saveptr); /* finds first / */\n    while(tmp) {\n      if(!strcmp(tmp, \"..\")) {\n        /* discard previous URL segment, if there was one. if not,\n         * add the .. to the stack if this is *not* an absolute path\n         * (for absolute paths, leading .. has no effect, so skip it) */\n        if(0 < mystack->stack_size) pop_grp_stack(mystack);\n        else if('/' != *inURL) push_grp_stack(mystack, tmp);\n      } else {\n        /* always just skip ., but otherwise add segment to stack */\n        if(strcmp(tmp, \".\")) push_grp_stack(mystack, tmp);\n      }\n      tmp = ffstrtok(NULL, \"/\",&saveptr); /* get the next segment */\n    }\n\n    /* stack now has pieces of cleaned URL, so just catenate them\n     * onto output string until stack is empty */\n    while(0 < mystack->stack_size) {\n      tmp = shift_grp_stack(mystack);\n      if (strlen(outURL) + strlen(tmp) + 1 > FLEN_FILENAME-1)\n      {\n         outURL[0]=0;\n         ffpmsg(\"outURL is too long (fits_clean_url)\");\n         *status = URL_PARSE_ERROR;\n         delete_grp_stack(&mystack);\n         return *status;         \n      }\n      strcat(outURL, tmp);\n      strcat(outURL, \"/\");\n    }\n    outURL[strlen(outURL) - 1] = 0; /* blank out trailing / */\n  } while(0);\n  delete_grp_stack(&mystack);\n  return *status;\n}\n\n/* free all stack contents using pop_grp_stack before freeing the\n * grp_stack itself */\nstatic void delete_grp_stack(grp_stack** mystack) {\n  if(!mystack || !*mystack) return;\n  while((*mystack)->stack_size) pop_grp_stack(*mystack);\n  free(*mystack);\n  *mystack = NULL;\n}\n\n/* append an item to the stack, handling the special case of the first\n * item appended */\nstatic grp_stack_item* grp_stack_append(\n  grp_stack_item* last, grp_stack_data data\n) {\n  /* first create a new stack item, and copy data to it */\n  grp_stack_item* new_item = (grp_stack_item*) malloc(sizeof(grp_stack_item));\n  new_item->data = data;\n  if(last) {\n    /* attach this item between the \"last\" item and its \"next\" item */\n    new_item->next = last->next;\n    new_item->prev = last;\n    last->next->prev = new_item;\n    last->next = new_item;\n  } else {\n    /* stack is empty, so \"next\" and \"previous\" both point back to it */\n    new_item->next = new_item;\n    new_item->prev = new_item;\n  }\n  return new_item;\n}\n\n/* remove an item from the stack, handling the special case of the last\n * item removed */\nstatic grp_stack_data grp_stack_remove(grp_stack_item* last) {\n  grp_stack_data retval = last->data;\n  last->prev->next = last->next;\n  last->next->prev = last->prev;\n  free(last);\n  return retval;\n}\n\n/* create new stack dynamically, and give it valid initial values */\nstatic grp_stack* new_grp_stack(void) {\n  grp_stack* retval = (grp_stack*) malloc(sizeof(grp_stack));\n  if(retval) {\n    retval->stack_size = 0;\n    retval->top = NULL;\n  }\n  return retval;\n}\n\n/* return the value at the top of the stack and remove it, updating\n * stack_size. top->prev becomes the new \"top\" */\nstatic grp_stack_data pop_grp_stack(grp_stack* mystack) {\n  grp_stack_data retval = grp_stack_default;\n  if(mystack && mystack->top) {\n    grp_stack_item* newtop = mystack->top->prev;\n    retval = grp_stack_remove(mystack->top);\n    mystack->top = newtop;\n    if(0 == --mystack->stack_size) mystack->top = NULL;\n  }\n  return retval;\n}\n\n/* add to the stack after the top element. the added element becomes\n * the new \"top\" */\nstatic void push_grp_stack(grp_stack* mystack, grp_stack_data data) {\n  if(!mystack) return;\n  mystack->top = grp_stack_append(mystack->top, data);\n  ++mystack->stack_size;\n  return;\n}\n\n/* return the value at the bottom of the stack and remove it, updating\n * stack_size. \"top\" pointer is unaffected */\nstatic grp_stack_data shift_grp_stack(grp_stack* mystack) {\n  grp_stack_data retval = grp_stack_default;\n  if(mystack && mystack->top) {\n    retval = grp_stack_remove(mystack->top->next); /* top->next == bottom */\n    if(0 == --mystack->stack_size) mystack->top = NULL;\n  }\n  return retval;\n}\n\n/* add to the stack after the top element. \"top\" is unaffected, except\n * in the special case of an initially empty stack */\n/* static void unshift_grp_stack(grp_stack* mystack, grp_stack_data data) {\n   if(!mystack) return;\n   if(mystack->top) grp_stack_append(mystack->top, data);\n   else mystack->top = grp_stack_append(NULL, data);\n   ++mystack->stack_size;\n   return;\n   } */\n\n/*--------------------------------------------------------------------------*/\nint fits_url2relurl(char     *refURL, /* I reference URL string             */\n\t\t    char     *absURL, /* I absoulute URL string to process  */\n\t\t    char     *relURL, /* O resulting relative URL string    */\n\t\t    int      *status)\n/*\n  create a relative URL to the file referenced by absURL with respect to the\n  reference URL refURL. The relative URL is returned in relURL.\n\n  Both refURL and absURL must be absolute URL strings; i.e. either begin\n  with an access method specification \"XXX://\" or with a '/' character\n  signifiying that they are absolute file paths.\n\n  Note that it is possible to make a relative URL from two input URLs\n  (absURL and refURL) that are not compatable. This function does not\n  check to see if the resulting relative URL makes any sence. For instance,\n  it is impossible to make a relative URL from the following two inputs:\n\n  absURL = ftp://a.b.c.com/x/y/z/foo.fits\n  refURL = /a/b/c/ttt.fits\n\n  The resulting relURL will be:\n\n  ../../../ftp://a.b.c.com/x/y/z/foo.fits \n\n  Which is syntically correct but meaningless. The problem is that a file\n  with an access method of ftp:// cannot be expressed a a relative URL to\n  a local disk file.\n*/\n\n{\n  int i,j;\n  int refcount,abscount;\n  int refsize,abssize;\n  int done;\n\n\n  if(*status != 0) return(*status);\n\n  /* initialize the relative URL string */\n  relURL[0] = 0;\n\n  do\n    {\n      /*\n\trefURL and absURL must be absolute to process\n      */\n\n      if(!(fits_is_url_absolute(refURL) || *refURL == '/') ||\n\t !(fits_is_url_absolute(absURL) || *absURL == '/'))\n\t{\n\t  *status = URL_PARSE_ERROR;\n\t  ffpmsg(\"Cannot make rel. URL from non abs. URLs (fits_url2relurl)\");\n\t  continue;\n\t}\n\n      /* determine the size of the refURL and absURL strings */\n\n      refsize = strlen(refURL);\n      abssize = strlen(absURL);\n\n      /* process the two URL strings and build the relative URL between them */\n\t\t\n\n      for(done = 0, refcount = 0, abscount = 0; \n\t  !done && refcount < refsize && abscount < abssize; \n\t  ++refcount, ++abscount)\n\t{\n\t  for(; abscount < abssize && absURL[abscount] == '/'; ++abscount);\n\t  for(; refcount < refsize && refURL[refcount] == '/'; ++refcount);\n\n\t  /* find the next path segment in absURL */ \n\t  for(i = abscount; absURL[i] != '/' && i < abssize; ++i);\n\t  \n\t  /* find the next path segment in refURL */\n\t  for(j = refcount; refURL[j] != '/' && j < refsize; ++j);\n\t  \n\t  /* do the two path segments match? */\n\t  if(i == j && \n\t     strncmp(absURL+abscount, refURL+refcount,i-refcount) == 0)\n\t    {\n\t      /* they match, so ignore them and continue */\n\t      abscount = i; refcount = j;\n\t      continue;\n\t    }\n\t  \n\t  /* We found a difference in the paths in refURL and absURL.\n\t     For every path segment remaining in the refURL string, append\n\t     a \"../\" path segment to the relataive URL relURL.\n\t  */\n\n\t  for(j = refcount; j < refsize; ++j)\n\t    if(refURL[j] == '/') \n            {\n               if (strlen(relURL)+3 > FLEN_FILENAME-1)\n               {\n\t          *status = URL_PARSE_ERROR;\n\t          ffpmsg(\"relURL too long (fits_url2relurl)\");\n\t          return (*status);\n               }\n               strcat(relURL,\"../\");\n            }\n\t  \n\t  /* copy all remaining characters of absURL to the output relURL */\n\n          if (strlen(relURL) + strlen(absURL+abscount) > FLEN_FILENAME-1)\n          {\n\t     *status = URL_PARSE_ERROR;\n\t     ffpmsg(\"relURL too long (fits_url2relurl)\");\n\t     return (*status);\n          }\n\t  strcat(relURL,absURL+abscount);\n\t  \n\t  /* we are done building the relative URL */\n\t  done = 1;\n\t}\n\n    }while(0);\n\n  return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_relurl2url(char     *refURL, /* I reference URL string             */\n\t\t    char     *relURL, /* I relative URL string to process   */\n\t\t    char     *absURL, /* O absolute URL string              */\n\t\t    int      *status)\n/*\n  create an absolute URL from a relative url and a reference URL. The \n  reference URL is given by the FITS file pointed to by fptr.\n\n  The construction of the absolute URL from the partial and reference URl\n  is performed using the rules set forth in:\n \n  http://www.w3.org/Addressing/URL/URL_TOC.html\n  and\n  http://www.w3.org/Addressing/URL/4_3_Partial.html\n\n  Note that the relative URL string relURL must conform to the Unix-like\n  URL syntax; host dependent partial URL strings are not allowed.\n*/\n{\n  int i;\n\n  char tmpStr[FLEN_FILENAME];\n\n  char *tmpStr1, *tmpStr2;\n\n\n  if(*status != 0) return(*status);\n  \n  do\n    {\n\n      /*\n\tmake a copy of the reference URL string refURL for parsing purposes\n      */\n\n      if (strlen(refURL) > FLEN_FILENAME-1)\n      {\n         absURL[0]=0;\n         ffpmsg(\"ref URL is too long (fits_relurl2url)\");\n         *status = URL_PARSE_ERROR;\n         continue;\n      }\n      strcpy(tmpStr,refURL);\n\n      /*\n\tif the reference file has an access method of mem:// or shmem://\n\tthen we cannot use it as the basis of an absolute URL construction\n\tfor a partial URL\n      */\n\t  \n      if(fits_strncasecmp(tmpStr,\"MEM:\",4)   == 0 ||\n                \t                fits_strncasecmp(tmpStr,\"SHMEM:\",6) == 0)\n\t{\n\t  ffpmsg(\"ref URL has access mem:// or shmem:// (fits_relurl2url)\");\n\t  ffpmsg(\"   cannot construct full URL from a partial URL and \");\n\t  ffpmsg(\"   MEM/SHMEM base URL\");\n\t  *status = URL_PARSE_ERROR;\n\t  continue;\n\t}\n\n      if(relURL[0] != '/')\n\t{\n\t  /*\n\t    just append the relative URL string to the reference URL\n\t    string (minus the reference URL file name) to form the \n\t    absolute URL string\n\t  */\n\t      \n\t  tmpStr1 = strrchr(tmpStr,'/');\n\t  \n\t  if(tmpStr1 != NULL) tmpStr1[1] = 0;\n\t  else                tmpStr[0]  = 0;\n\t  \n          if (strlen(tmpStr)+strlen(relURL) > FLEN_FILENAME-1)\n          {\n              absURL[0]=0;\n              ffpmsg(\"rel + ref URL is too long (fits_relurl2url)\");\n              *status = URL_PARSE_ERROR;\n              continue;\n          }\n\t  strcat(tmpStr,relURL);\n\t}\n      else\n\t{\n\t  /*\n\t    have to parse the refURL string for the first occurnace of the \n\t    same number of '/' characters as contained in the beginning of\n\t    location that is not followed by a greater number of consective \n\t    '/' charaters (yes, that is a confusing statement); this is the \n\t    location in the refURL string where the relURL string is to\n\t    be appended to form the new absolute URL string\n\t   */\n\t  \n\t  /*\n\t    first, build up a slash pattern string that has one more\n\t    slash in it than the starting slash pattern of the\n\t    relURL string\n\t  */\n\t  \n\t  strcpy(absURL,\"/\");\n\t  \n\t  for(i = 0; relURL[i] == '/'; ++i) \n          {\n             if (strlen(absURL) + 1 > FLEN_FILENAME-1)\n             {\n                 absURL[0]=0;\n                 ffpmsg(\"abs URL is too long (fits_relurl2url)\");\n                 *status = URL_PARSE_ERROR;\n                 return (*status);\n             }\n             strcat(absURL,\"/\");\n          }\n\t  \n\t  /*\n\t    loop over the refURL string until the slash pattern stored\n\t    in absURL is no longer found\n\t  */\n\n\t  for(tmpStr1 = tmpStr, i = strlen(absURL); \n\t      (tmpStr2 = strstr(tmpStr1,absURL)) != NULL;\n\t      tmpStr1 = tmpStr2 + i);\n\t  \n\t  /* reduce the slash pattern string by one slash */\n\t  \n\t  absURL[i-1] = 0;\n\t  \n\t  /* \n\t     search for the slash pattern in the remaining portion\n\t     of the refURL string\n\t  */\n\n\t  tmpStr2 = strstr(tmpStr1,absURL);\n\t  \n\t  /* if no slash pattern match was found */\n\t  \n\t  if(tmpStr2 == NULL)\n\t    {\n\t      /* just strip off the file name from the refURL  */\n\t      \n\t      tmpStr2 = strrchr(tmpStr1,'/');\n\t      \n\t      if(tmpStr2 != NULL) tmpStr2[0] = 0;\n\t      else                tmpStr[0]  = 0;\n\t    }\n\t  else\n\t    {\n\t      /* set a string terminator at the slash pattern match */\n\t      \n\t      *tmpStr2 = 0;\n\t    }\n\t  \n\t  /* \n\t    conatenate the relURL string to the refURL string to form\n\t    the absURL\n\t   */\n\n          if (strlen(tmpStr)+strlen(relURL) > FLEN_FILENAME-1)\n          {\n              absURL[0]=0;\n              ffpmsg(\"rel + ref URL is too long (fits_relurl2url)\");\n              *status = URL_PARSE_ERROR;\n              continue;\n          }\n\t  strcat(tmpStr,relURL);\n\t}\n\n      /*\n\tnormalize the absURL by removing any \"..\" or \".\" specifiers\n\tin the string\n      */\n\n      *status = fits_clean_url(tmpStr,absURL,status);\n\n    }while(0);\n\n  return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_encode_url(char *inpath,  /* I URL  to be encoded                  */\n                    int maxlength, /* I max number of chars that may be copied\n                               to outpath, including terminating NULL. */ \n\t\t    char *outpath, /* O output encoded URL                  */\n\t\t    int *status)\n     /*\n       encode all URL \"unsafe\" and \"reserved\" characters using the \"%XX\"\n       convention, where XX stand for the two hexidecimal digits of the\n       encode character's ASCII code.\n\n       Note that the outpath length, as specified by the maxlength argument,\n       should be at least as large as inpath and preferably larger (to hold\n       any characters that need encoding).  If more than maxlength chars are \n       required for outpath, including the terminating NULL, outpath will\n       be set to size 0 and an error status will be returned.\n       \n       This function was adopted from code in the libwww.a library available\n       via the W3 consortium <URL: http://www.w3.org>\n     */\n{\n  unsigned char a;\n  \n  char *p;\n  char *q;\n  char *hex = \"0123456789ABCDEF\";\n  int iout=0;\n  \nunsigned const char isAcceptable[96] =\n{/* 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xA 0xB 0xC 0xD 0xE 0xF */\n  \n    0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xF,0xE,0x0,0xF,0xF,0xC, \n                                           /* 2x  !\"#$%&'()*+,-./   */\n    0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0x8,0x0,0x0,0x0,0x0,0x0,\n                                           /* 3x 0123456789:;<=>?   */\n    0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF, \n                                           /* 4x @ABCDEFGHIJKLMNO   */\n    0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0x0,0x0,0x0,0x0,0xF,\n                                           /* 5X PQRSTUVWXYZ[\\]^_   */\n    0x0,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,\n                                           /* 6x `abcdefghijklmno   */\n    0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0x0,0x0,0x0,0x0,0x0  \n                                           /* 7X pqrstuvwxyz{\\}~DEL */\n};\n\n  if(*status != 0) return(*status);\n  \n  /* loop over all characters in inpath until '\\0' is encountered */\n\n  for(q = outpath, p = inpath; *p && (iout < maxlength-1) ; p++)\n    {\n      a = (unsigned char)*p;\n\n      /* if the charcter requires encoding then process it */\n\n      if(!( a>=32 && a<128 && (isAcceptable[a-32])))\n\t{\n           if (iout+2 < maxlength-1)\n           {\n\t     /* add a '%' character to the outpath */\n\t     *q++ = HEX_ESCAPE;\n\t     /* add the most significant ASCII code hex value */\n\t     *q++ = hex[a >> 4];\n\t     /* add the least significant ASCII code hex value */\n\t     *q++ = hex[a & 15];\n             iout += 3;\n           }\n           else\n           {\n              ffpmsg(\"URL input is too long to encode (fits_encode_url)\");\n              *status = URL_PARSE_ERROR;\n              outpath[0] = 0;\n              return (*status);\n           }\n\t}\n      /* else just copy the character as is */\n      else \n      {\n         *q++ = *p;\n         iout++;\n      }\n    }\n\n  /* null terminate the outpath string */\n\n  if (*p && (iout == maxlength-1))\n  {\n     ffpmsg(\"URL input is too long to encode (fits_encode_url)\");\n     *status = URL_PARSE_ERROR;\n     outpath[0] = 0;\n     return (*status);\n  }\n  *q++ = 0; \n  \n  return(*status);\n}\n\n/*---------------------------------------------------------------------------*/\nint fits_unencode_url(char *inpath,  /* I input URL with encoding            */\n\t\t      char *outpath, /* O unencoded URL                      */\n\t\t      int  *status)\n     /*\n       unencode all URL \"unsafe\" and \"reserved\" characters to their actual\n       ASCII representation. All tokens of the form \"%XX\" where XX is the\n       hexidecimal code for an ASCII character, are searched for and\n       translated into the actuall ASCII character (so three chars become\n       1 char).\n\n       It is assumed that OUTPATH has enough room to hold the unencoded\n       URL.\n\n       This function was adopted from code in the libwww.a library available\n       via the W3 consortium <URL: http://www.w3.org>\n     */\n\n{\n    char *p;\n    char *q;\n    char  c;\n\n    if(*status != 0) return(*status);\n\n    p = inpath;\n    q = outpath;\n\n    /* \n       loop over all characters in the inpath looking for the '%' escape\n       character; if found the process the escape sequence\n    */\n\n    while(*p != 0) \n      {\n\t/* \n\t   if the character is '%' then unencode the sequence, else\n\t   just copy the character from inpath to outpath\n        */\n\n        if (*p == HEX_ESCAPE)\n\t  {\n            if((c = *(++p)) != 0)\n\t      { \n\t\t*q = (\n\t\t      (c >= '0' && c <= '9') ?\n\t\t      (c - '0') : ((c >= 'A' && c <= 'F') ?\n\t\t\t\t   (c - 'A' + 10) : (c - 'a' + 10))\n\t\t      )*16;\n\n\t\tif((c = *(++p)) != 0)\n\t\t  {\n\t\t    *q = *q + (\n\t\t\t       (c >= '0' && c <= '9') ? \n\t\t               (c - '0') : ((c >= 'A' && c <= 'F') ? \n\t\t\t\t\t    (c - 'A' + 10) : (c - 'a' + 10))\n\t\t\t       );\n\t\t    p++, q++;\n\t\t  }\n\t      }\n\t  } \n\telse\n\t  *q++ = *p++; \n      }\n \n    /* terminate the outpath */\n    *q = 0;\n\n    return(*status);   \n}\n/*---------------------------------------------------------------------------*/\n\nint fits_is_url_absolute(char *url)\n/*\n  Return a True (1) or False (0) value indicating whether or not the passed\n  URL string contains an access method specifier or not. Note that this is\n  a boolean function and it neither reads nor returns the standard error\n  status parameter\n*/\n{\n  char *tmpStr1, *tmpStr2;\n\n  char reserved[] = {':',';','/','?','@','&','=','+','$',','};\n\n  /*\n    The rule for determing if an URL is relative or absolute is that it (1)\n    must have a colon \":\" and (2) that the colon must appear before any other\n    reserved URL character in the URL string. We first see if a colon exists,\n    get its position in the string, and then check to see if any of the other\n    reserved characters exists and if their position in the string is greater\n    than that of the colons. \n   */\n\n  if( (tmpStr1 = strchr(url,reserved[0])) != NULL                       &&\n     ((tmpStr2 = strchr(url,reserved[1])) == NULL || tmpStr2 > tmpStr1) &&\n     ((tmpStr2 = strchr(url,reserved[2])) == NULL || tmpStr2 > tmpStr1) &&\n     ((tmpStr2 = strchr(url,reserved[3])) == NULL || tmpStr2 > tmpStr1) &&\n     ((tmpStr2 = strchr(url,reserved[4])) == NULL || tmpStr2 > tmpStr1) &&\n     ((tmpStr2 = strchr(url,reserved[5])) == NULL || tmpStr2 > tmpStr1) &&\n     ((tmpStr2 = strchr(url,reserved[6])) == NULL || tmpStr2 > tmpStr1) &&\n     ((tmpStr2 = strchr(url,reserved[7])) == NULL || tmpStr2 > tmpStr1) &&\n     ((tmpStr2 = strchr(url,reserved[8])) == NULL || tmpStr2 > tmpStr1) &&\n     ((tmpStr2 = strchr(url,reserved[9])) == NULL || tmpStr2 > tmpStr1)   )\n    {\n      return(1);\n    }\n  else\n    {\n      return(0);\n    }\n}\n"},{"id":16692,"name":"getcoll.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, getcoll.c, contains routines that read data elements from   */\n/*  a FITS image or table, with logical datatype.                          */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <stdlib.h>\n#include <string.h>\n#include \"fitsio2.h\"\n/*--------------------------------------------------------------------------*/\nint ffgcvl( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            char  nulval,     /* I - value for null pixels                   */\n            char *array,      /* O - array of values                         */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of logical values from a column in the current FITS HDU.\n  Any undefined pixels will be set equal to the value of 'nulval' unless\n  nulval = 0 in which case no checks for undefined pixels will be made.\n*/\n{\n    char cdummy;\n\n    ffgcll( fptr, colnum, firstrow, firstelem, nelem, 1, nulval, array,\n            &cdummy, anynul, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcl(  fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            char *array,      /* O - array of values                         */\n            int  *status)     /* IO - error status                           */\n/*\n  !!!! THIS ROUTINE IS DEPRECATED AND SHOULD NOT BE USED !!!!!!\n                  !!!! USE ffgcvl INSTEAD  !!!!!!\n  Read an array of logical values from a column in the current FITS HDU.\n  No checking for null values will be performed.\n*/\n{\n    char nulval = 0;\n    int anynul;\n\n    ffgcvl( fptr, colnum, firstrow, firstelem, nelem, nulval, array,\n            &anynul, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcfl( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            char *array,      /* O - array of values                         */\n            char *nularray,   /* O - array of flags = 1 if nultyp = 2        */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of logical values from a column in the current FITS HDU.\n*/\n{\n    char nulval = 0;\n\n    ffgcll( fptr, colnum, firstrow, firstelem, nelem, 2, nulval, array,\n            nularray, anynul, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcll( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG  firstelem, /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            int   nultyp,     /* I - null value handling code:               */\n                              /*     1: set undefined pixels = nulval        */\n                              /*     2: set nularray=1 for undefined pixels  */\n            char nulval,      /* I - value for null pixels if nultyp = 1     */\n            char *array,      /* O - array of values                         */\n            char *nularray,   /* O - array of flags = 1 if nultyp = 2        */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of logical values from a column in the current FITS HDU.\n*/\n{\n    double dtemp;\n    int tcode, maxelem, hdutype, ii, nulcheck;\n    long twidth, incre;\n    long ntodo;\n    LONGLONG repeat, startpos, elemnum, readptr, tnull, rowlen, rownum, remain, next;\n    double scale, zero;\n    char tform[20];\n    char message[FLEN_ERRMSG];\n    char snull[20];   /*  the FITS null value  */\n    unsigned char buffer[DBUFFSIZE], *buffptr;\n\n    if (*status > 0 || nelem == 0)  /* inherit input status value if > 0 */\n        return(*status);\n\n    if (anynul)\n       *anynul = 0;\n\n    if (nultyp == 2)      \n       memset(nularray, 0, (size_t) nelem);   /* initialize nullarray */\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 0, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n\n    if (tcode != TLOGICAL)   \n        return(*status = NOT_LOGICAL_COL);\n \n    /*------------------------------------------------------------------*/\n    /*  Decide whether to check for null values in the input FITS file: */\n    /*------------------------------------------------------------------*/\n    nulcheck = nultyp; /* by default, check for null values in the FITS file */\n\n    if (nultyp == 1 && nulval == 0)\n       nulcheck = 0;    /* calling routine does not want to check for nulls */\n\n    /*---------------------------------------------------------------------*/\n    /*  Now read the logical values from the FITS column.                  */\n    /*---------------------------------------------------------------------*/\n\n    remain = nelem;           /* remaining number of values to read */\n    next = 0;                 /* next element in array to be read   */\n    rownum = 0;               /* row number, relative to firstrow   */\n    ntodo = (long) remain;           /* max number of elements to read at one time */\n\n    while (ntodo)\n    {\n      /*\n         limit the number of pixels to read at one time to the number that\n         remain in the current vector.    \n      */\n      ntodo = (long) minvalue(ntodo, maxelem);      \n      ntodo = (long) minvalue(ntodo, (repeat - elemnum));\n\n      readptr = startpos + (rowlen * rownum) + (elemnum * incre);\n\n      ffgi1b(fptr, readptr, ntodo, incre, buffer, status);\n\n      /* convert from T or F to 1 or 0 */\n      buffptr = buffer;\n      for (ii = 0; ii < ntodo; ii++, next++, buffptr++)\n      {\n        if (*buffptr == 'T')\n          array[next] = 1;\n        else if (*buffptr =='F') \n          array[next] = 0;\n        else if (*buffptr == 0)\n        {\n          array[next] = nulval;  /* set null values to input nulval */\n          if (anynul)\n              *anynul = 1;\n\n          if (nulcheck == 2)\n          {\n            nularray[next] = 1;  /* set null flags */\n          }\n        }\n        else  /* some other illegal character; return the char value */\n        {\n          if (*buffptr == 1) {\n            /* this is an unfortunate case where the illegal value is the same\n               as what we set True values to, so set the value to the character '1'\n               instead, which has ASCII value 49.  */\n            array[next] = 49;\n          } else {\n            array[next] = (char) *buffptr;\n          }\n        }\n      }\n\n      if (*status > 0)  /* test for error during previous read operation */\n      {\n\tdtemp = (double) next;\n        snprintf(message,FLEN_ERRMSG,\n          \"Error reading elements %.0f thruough %.0f of logical array (ffgcl).\",\n           dtemp+1., dtemp + ntodo);\n        ffpmsg(message);\n        return(*status);\n      }\n\n      /*--------------------------------------------*/\n      /*  increment the counters for the next loop  */\n      /*--------------------------------------------*/\n      remain -= ntodo;\n      if (remain)\n      {\n        elemnum += ntodo;\n\n        if (elemnum == repeat)  /* completed a row; start on later row */\n          {\n            elemnum = 0;\n            rownum++;\n          }\n      }\n      ntodo = (long) remain;  /* this is the maximum number to do in next loop */\n\n    }  /*  End of main while Loop  */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcx(  fitsfile *fptr,  /* I - FITS file pointer                       */\n            int   colnum,    /* I - number of column to write (1 = 1st col) */\n            LONGLONG  frow,      /* I - first row to write (1 = 1st row)        */\n            LONGLONG  fbit,      /* I - first bit to write (1 = 1st)            */\n            LONGLONG  nbit,      /* I - number of bits to write                 */\n            char *larray,    /* O - array of logicals corresponding to bits */\n            int  *status)    /* IO - error status                           */\n/*\n  read an array of logical values from a specified bit or byte\n  column of the binary table.    larray is set = TRUE, if the corresponding\n  bit = 1, otherwise it is set to FALSE.\n  The binary table column being read from must have datatype 'B' or 'X'. \n*/\n{\n    LONGLONG bstart;\n    long offset, ndone, ii, repeat, bitloc, fbyte;\n    LONGLONG  rstart, estart;\n    int tcode, descrp;\n    unsigned char cbuff;\n    static unsigned char onbit[8] = {128,  64,  32,  16,   8,   4,   2,   1};\n    tcolumn *colptr;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /*  check input parameters */\n    if (nbit < 1)\n        return(*status);\n    else if (frow < 1)\n        return(*status = BAD_ROW_NUM);\n    else if (fbit < 1)\n        return(*status = BAD_ELEM_NUM);\n\n    /* position to the correct HDU */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    /* rescan header if data structure is undefined */\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n    fbyte = (long) ((fbit + 7) / 8);\n    bitloc = (long) (fbit - 1 - ((fbit - 1) / 8 * 8));\n    ndone = 0;\n    rstart = frow - 1;\n    estart = fbyte - 1;\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n\n    tcode = colptr->tdatatype;\n\n    if (abs(tcode) > TBYTE)\n        return(*status = NOT_LOGICAL_COL); /* not correct datatype column */\n\n    if (tcode > 0)\n    {\n        descrp = FALSE;  /* not a variable length descriptor column */\n        /* N.B: REPEAT is the number of bytes, not number of bits */\n        repeat = (long) colptr->trepeat;\n\n        if (tcode == TBIT)\n            repeat = (repeat + 7) / 8;  /* convert from bits to bytes */\n\n        if (fbyte > repeat)\n            return(*status = BAD_ELEM_NUM);\n\n        /* calc the i/o pointer location to start of sequence of pixels */\n        bstart = (fptr->Fptr)->datastart + ((fptr->Fptr)->rowlength * rstart) +\n               colptr->tbcol + estart;\n    }\n    else\n    {\n        descrp = TRUE;  /* a variable length descriptor column */\n        /* only bit arrays (tform = 'X') are supported for variable */\n        /* length arrays.  REPEAT is the number of BITS in the array. */\n\n        ffgdes(fptr, colnum, frow, &repeat, &offset, status);\n\n        if (tcode == -TBIT)\n            repeat = (repeat + 7) / 8;\n\n        if ((fbit + nbit + 6) / 8 > repeat)\n            return(*status = BAD_ELEM_NUM);\n\n        /* calc the i/o pointer location to start of sequence of pixels */\n        bstart = (fptr->Fptr)->datastart + offset + (fptr->Fptr)->heapstart + estart;\n    }\n\n    /* move the i/o pointer to the start of the pixel sequence */\n    if (ffmbyt(fptr, bstart, REPORT_EOF, status) > 0)\n        return(*status);\n\n    /* read the next byte */\n    while (1)\n    {\n      if (ffgbyt(fptr, 1, &cbuff, status) > 0)\n        return(*status);\n\n      for (ii = bitloc; (ii < 8) && (ndone < nbit); ii++, ndone++)\n      {\n        if(cbuff & onbit[ii])       /* test if bit is set */\n          larray[ndone] = TRUE;\n        else\n          larray[ndone] = FALSE;\n      }\n\n      if (ndone == nbit)   /* finished all the bits */\n        return(*status);\n\n      /* not done, so get the next byte */\n      if (!descrp)\n      {\n        estart++;\n        if (estart == repeat) \n        {\n          /* move the i/o pointer to the next row of pixels */\n          estart = 0;\n          rstart = rstart + 1;\n          bstart = (fptr->Fptr)->datastart + ((fptr->Fptr)->rowlength * rstart) +\n               colptr->tbcol;\n\n          ffmbyt(fptr, bstart, REPORT_EOF, status);\n        }\n      }\n      bitloc = 0;\n    }\n}\n/*--------------------------------------------------------------------------*/\nint ffgcxui(fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG  nrows,      /* I - no. of rows to read                     */\n            long  input_first_bit, /* I - first bit to read (1 = 1st)        */\n            int   input_nbits,     /* I - number of bits to read (<= 32)     */\n            unsigned short *array, /* O - array of integer values            */\n            int  *status)     /* IO - error status                           */\n/*\n  Read a consecutive string of bits from an 'X' or 'B' column and\n  interprete them as an unsigned integer.  The number of bits must be\n  less than or equal to 16 or the total number of bits in the column, \n  which ever is less.\n*/\n{\n    int ii, firstbit, nbits, bytenum, startbit, numbits, endbit;\n    int firstbyte, lastbyte, nbytes, rshift, lshift;\n    unsigned short colbyte[5];\n    tcolumn *colptr;\n    char message[FLEN_ERRMSG];\n\n    if (*status > 0 || nrows == 0)\n        return(*status);\n\n    /*  check input parameters */\n    if (firstrow < 1)\n    {\n          snprintf(message,FLEN_ERRMSG, \"Starting row number is less than 1: %ld (ffgcxui)\",\n                (long) firstrow);\n          ffpmsg(message);\n          return(*status = BAD_ROW_NUM);\n    }\n    else if (input_first_bit < 1)\n    {\n          snprintf(message,FLEN_ERRMSG, \"Starting bit number is less than 1: %ld (ffgcxui)\",\n                input_first_bit);\n          ffpmsg(message);\n          return(*status = BAD_ELEM_NUM);\n    }\n    else if (input_nbits > 16)\n    {\n          snprintf(message, FLEN_ERRMSG,\"Number of bits to read is > 16: %d (ffgcxui)\",\n                input_nbits);\n          ffpmsg(message);\n          return(*status = BAD_ELEM_NUM);\n    }\n\n    /* position to the correct HDU */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    /* rescan header if data structure is undefined */\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n    if ((fptr->Fptr)->hdutype != BINARY_TBL)\n    {\n        ffpmsg(\"This is not a binary table extension (ffgcxui)\");\n        return(*status = NOT_BTABLE);\n    }\n\n    if (colnum > (fptr->Fptr)->tfield)\n    {\n      snprintf(message, FLEN_ERRMSG,\"Specified column number is out of range: %d (ffgcxui)\",\n                colnum);\n        ffpmsg(message);\n        snprintf(message, FLEN_ERRMSG,\"  There are %d columns in this table.\",\n                (fptr->Fptr)->tfield );\n        ffpmsg(message);\n\n        return(*status = BAD_COL_NUM);\n    }       \n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n\n    if (abs(colptr->tdatatype) > TBYTE)\n    {\n        ffpmsg(\"Can only read bits from X or B type columns. (ffgcxui)\");\n        return(*status = NOT_LOGICAL_COL); /* not correct datatype column */\n    }\n\n    firstbyte = (input_first_bit - 1              ) / 8 + 1;\n    lastbyte  = (input_first_bit + input_nbits - 2) / 8 + 1;\n    nbytes = lastbyte - firstbyte + 1;\n\n    if (colptr->tdatatype == TBIT && \n        input_first_bit + input_nbits - 1 > (long) colptr->trepeat)\n    {\n        ffpmsg(\"Too many bits. Tried to read past width of column (ffgcxui)\");\n        return(*status = BAD_ELEM_NUM);\n    }\n    else if (colptr->tdatatype == TBYTE && lastbyte > (long) colptr->trepeat)\n    {\n        ffpmsg(\"Too many bits. Tried to read past width of column (ffgcxui)\");\n        return(*status = BAD_ELEM_NUM);\n    }\n\n    for (ii = 0; ii < nrows; ii++)\n    {\n        /* read the relevant bytes from the row */\n        if (ffgcvui(fptr, colnum, firstrow+ii, firstbyte, nbytes, 0, \n               colbyte, NULL, status) > 0)\n        {\n             ffpmsg(\"Error reading bytes from column (ffgcxui)\");\n             return(*status);\n        }\n\n        firstbit = (input_first_bit - 1) % 8; /* modulus operator */\n        nbits = input_nbits;\n\n        array[ii] = 0;\n\n        /* select and shift the bits from each byte into the output word */\n        while(nbits)\n        {\n            bytenum = firstbit / 8;\n\n            startbit = firstbit % 8;  \n            numbits = minvalue(nbits, 8 - startbit);\n            endbit = startbit + numbits - 1;\n\n            rshift = 7 - endbit;\n            lshift = nbits - numbits;\n\n            array[ii] = ((colbyte[bytenum] >> rshift) << lshift) | array[ii];\n\n            nbits -= numbits;\n            firstbit += numbits;\n        }\n    }\n\n    return(*status);\n}\n\n/*--------------------------------------------------------------------------*/\nint ffgcxuk(fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG  nrows,      /* I - no. of rows to read                     */\n            long  input_first_bit, /* I - first bit to read (1 = 1st)        */\n            int   input_nbits,     /* I - number of bits to read (<= 32)     */\n            unsigned int *array,   /* O - array of integer values            */\n            int  *status)     /* IO - error status                           */\n/*\n  Read a consecutive string of bits from an 'X' or 'B' column and\n  interprete them as an unsigned integer.  The number of bits must be\n  less than or equal to 32 or the total number of bits in the column, \n  which ever is less.\n*/\n{\n    int ii, firstbit, nbits, bytenum, startbit, numbits, endbit;\n    int firstbyte, lastbyte, nbytes, rshift, lshift;\n    unsigned int colbyte[5];\n    tcolumn *colptr;\n    char message[FLEN_ERRMSG];\n\n    if (*status > 0 || nrows == 0)\n        return(*status);\n\n    /*  check input parameters */\n    if (firstrow < 1)\n    {\n          snprintf(message, FLEN_ERRMSG,\"Starting row number is less than 1: %ld (ffgcxuk)\",\n                (long) firstrow);\n          ffpmsg(message);\n          return(*status = BAD_ROW_NUM);\n    }\n    else if (input_first_bit < 1)\n    {\n          snprintf(message, FLEN_ERRMSG,\"Starting bit number is less than 1: %ld (ffgcxuk)\",\n                input_first_bit);\n          ffpmsg(message);\n          return(*status = BAD_ELEM_NUM);\n    }\n    else if (input_nbits > 32)\n    {\n          snprintf(message, FLEN_ERRMSG,\"Number of bits to read is > 32: %d (ffgcxuk)\",\n                input_nbits);\n          ffpmsg(message);\n          return(*status = BAD_ELEM_NUM);\n    }\n\n    /* position to the correct HDU */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    /* rescan header if data structure is undefined */\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n    if ((fptr->Fptr)->hdutype != BINARY_TBL)\n    {\n        ffpmsg(\"This is not a binary table extension (ffgcxuk)\");\n        return(*status = NOT_BTABLE);\n    }\n\n    if (colnum > (fptr->Fptr)->tfield)\n    {\n      snprintf(message, FLEN_ERRMSG,\"Specified column number is out of range: %d (ffgcxuk)\",\n                colnum);\n        ffpmsg(message);\n        snprintf(message, FLEN_ERRMSG,\"  There are %d columns in this table.\",\n                (fptr->Fptr)->tfield );\n        ffpmsg(message);\n\n        return(*status = BAD_COL_NUM);\n    }       \n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n\n    if (abs(colptr->tdatatype) > TBYTE)\n    {\n        ffpmsg(\"Can only read bits from X or B type columns. (ffgcxuk)\");\n        return(*status = NOT_LOGICAL_COL); /* not correct datatype column */\n    }\n\n    firstbyte = (input_first_bit - 1              ) / 8 + 1;\n    lastbyte  = (input_first_bit + input_nbits - 2) / 8 + 1;\n    nbytes = lastbyte - firstbyte + 1;\n\n    if (colptr->tdatatype == TBIT && \n        input_first_bit + input_nbits - 1 > (long) colptr->trepeat)\n    {\n        ffpmsg(\"Too many bits. Tried to read past width of column (ffgcxuk)\");\n        return(*status = BAD_ELEM_NUM);\n    }\n    else if (colptr->tdatatype == TBYTE && lastbyte > (long) colptr->trepeat)\n    {\n        ffpmsg(\"Too many bits. Tried to read past width of column (ffgcxuk)\");\n        return(*status = BAD_ELEM_NUM);\n    }\n\n    for (ii = 0; ii < nrows; ii++)\n    {\n        /* read the relevant bytes from the row */\n        if (ffgcvuk(fptr, colnum, firstrow+ii, firstbyte, nbytes, 0, \n               colbyte, NULL, status) > 0)\n        {\n             ffpmsg(\"Error reading bytes from column (ffgcxuk)\");\n             return(*status);\n        }\n\n        firstbit = (input_first_bit - 1) % 8; /* modulus operator */\n        nbits = input_nbits;\n\n        array[ii] = 0;\n\n        /* select and shift the bits from each byte into the output word */\n        while(nbits)\n        {\n            bytenum = firstbit / 8;\n\n            startbit = firstbit % 8;  \n            numbits = minvalue(nbits, 8 - startbit);\n            endbit = startbit + numbits - 1;\n\n            rshift = 7 - endbit;\n            lshift = nbits - numbits;\n\n            array[ii] = ((colbyte[bytenum] >> rshift) << lshift) | array[ii];\n\n            nbits -= numbits;\n            firstbit += numbits;\n        }\n    }\n\n    return(*status);\n}\n"},{"id":16693,"name":"putcolb.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, putcolb.c, contains routines that write data elements to    */\n/*  a FITS image or table with char (byte) datatype.                       */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <limits.h>\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffpprb( fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            unsigned char *array, /* I - array of values that are written   */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n    unsigned char nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_pixels(fptr, TBYTE, firstelem, nelem,\n            0, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpclb(fptr, 2, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffppnb( fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            unsigned char *array, /* I - array of values that are written   */\n            unsigned char nulval, /* I - undefined pixel value              */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).  Any array values\n  that are equal to the value of nulval will be replaced with the null\n  pixel value that is appropriate for this column.\n*/\n{\n    long row;\n    unsigned char nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n\n        nullvalue = nulval;  /* set local variable */\n        fits_write_compressed_pixels(fptr, TBYTE, firstelem, nelem,\n            1, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcnb(fptr, 2, row, firstelem, nelem, array, nulval, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp2db(fitsfile *fptr,   /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           unsigned char *array, /* I - array to be written               */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    /* call the 3D writing routine, with the 3rd dimension = 1 */\n\n    ffp3db(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp3db(fitsfile *fptr,   /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  nrows,      /* I - number of rows in each plane of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           LONGLONG  naxis3,     /* I - FITS image NAXIS3 value               */\n           unsigned char *array, /* I - array to be written               */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 3-D cube of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    long tablerow, ii, jj;\n    LONGLONG nfits, narray;\n    long fpixel[3]= {1,1,1}, lpixel[3];\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n           \n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n        lpixel[0] = (long) ncols;\n        lpixel[1] = (long) nrows;\n        lpixel[2] = (long) naxis3;\n       \n        fits_write_compressed_img(fptr, TBYTE, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n      /* all the image pixels are contiguous, so write all at once */\n      ffpclb(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status);\n      return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to write to */\n    narray = 0;  /* next pixel in input array to be written */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* writing naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffpclb(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0)\n         return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpssb(fitsfile *fptr,   /* I - FITS file pointer                       */\n           long  group,      /* I - group to write(1 = 1st group)           */\n           long  naxis,      /* I - number of data axes in array            */\n           long  *naxes,     /* I - size of each FITS axis                  */\n           long  *fpixel,    /* I - 1st pixel in each axis to write (1=1st) */\n           long  *lpixel,    /* I - last pixel in each axis to write        */\n           unsigned char *array, /* I - array to be written                 */\n           int  *status)     /* IO - error status                           */\n/*\n  Write a subsection of pixels to the primary array or image.\n  A subsection is defined to be any contiguous rectangular\n  array of pixels within the n-dimensional FITS data file.\n  Data conversion and scaling will be performed if necessary \n  (e.g, if the datatype of the FITS array is not the same as\n  the array being written).\n*/\n{\n    long tablerow;\n    LONGLONG fpix[7], dimen[7], astart, pstart;\n    LONGLONG off2, off3, off4, off5, off6, off7;\n    LONGLONG st10, st20, st30, st40, st50, st60, st70;\n    LONGLONG st1, st2, st3, st4, st5, st6, st7;\n    long ii, i1, i2, i3, i4, i5, i6, i7, irange[7];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_img(fptr, TBYTE, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    if (naxis < 1 || naxis > 7)\n      return(*status = BAD_DIMEN);\n\n    tablerow=maxvalue(1,group);\n\n     /* calculate the size and number of loops to perform in each dimension */\n    for (ii = 0; ii < 7; ii++)\n    {\n      fpix[ii]=1;\n      irange[ii]=1;\n      dimen[ii]=1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {    \n      fpix[ii]=fpixel[ii];\n      irange[ii]=lpixel[ii]-fpixel[ii]+1;\n      dimen[ii]=naxes[ii];\n    }\n\n    i1=irange[0];\n\n    /* compute the pixel offset between each dimension */\n    off2 =     dimen[0];\n    off3 = off2 * dimen[1];\n    off4 = off3 * dimen[2];\n    off5 = off4 * dimen[3];\n    off6 = off5 * dimen[4];\n    off7 = off6 * dimen[5];\n\n    st10 = fpix[0];\n    st20 = (fpix[1] - 1) * off2;\n    st30 = (fpix[2] - 1) * off3;\n    st40 = (fpix[3] - 1) * off4;\n    st50 = (fpix[4] - 1) * off5;\n    st60 = (fpix[5] - 1) * off6;\n    st70 = (fpix[6] - 1) * off7;\n\n    /* store the initial offset in each dimension */\n    st1 = st10;\n    st2 = st20;\n    st3 = st30;\n    st4 = st40;\n    st5 = st50;\n    st6 = st60;\n    st7 = st70;\n\n    astart = 0;\n\n    for (i7 = 0; i7 < irange[6]; i7++)\n    {\n     for (i6 = 0; i6 < irange[5]; i6++)\n     {\n      for (i5 = 0; i5 < irange[4]; i5++)\n      {\n       for (i4 = 0; i4 < irange[3]; i4++)\n       {\n        for (i3 = 0; i3 < irange[2]; i3++)\n        {\n         pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7;\n\n         for (i2 = 0; i2 < irange[1]; i2++)\n         {\n           if (ffpclb(fptr, 2, tablerow, pstart, i1, &array[astart],\n              status) > 0)\n              return(*status);\n\n           astart += i1;\n           pstart += off2;\n         }\n         st2 = st20;\n         st3 = st3+off3;    \n        }\n        st3 = st30;\n        st4 = st4+off4;\n       }\n       st4 = st40;\n       st5 = st5+off5;\n      }\n      st5 = st50;\n      st6 = st6+off6;\n     }\n     st6 = st60;\n     st7 = st7+off7;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpgpb( fitsfile *fptr,   /* I - FITS file pointer                      */\n            long  group,      /* I - group to write(1 = 1st group)          */\n            long  firstelem,  /* I - first vector element to write(1 = 1st) */\n            long  nelem,      /* I - number of values to write              */\n            unsigned char *array, /* I - array of values that are written   */\n            int  *status)     /* IO - error status                          */\n/*\n  Write an array of group parameters to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffpclb(fptr, 1L, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpclb( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            unsigned char *array, /* I - array of values to write           */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer to a virtual column in a 1 or more grouped FITS primary\n  array.  FITSIO treats a primary array as a binary table with\n  2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    int writemode;\n    int tcode, maxelem2, hdutype, writeraw;\n    long twidth, incre;\n    long  ntodo;\n    LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull, maxelem;\n    double scale, zero;\n    char tform[20], cform[20];\n    char message[FLEN_ERRMSG];\n\n    char snull[20];   /*  the FITS null value  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n\n    /* IMPORTANT NOTE: that the special case of using this subroutine\n       to write bytes to a character column are handled internally\n       by the call to ffgcprll() below.  It will adjust the effective\n       *tcode, repeats, etc, to appear as a TBYTE column. */\n\n    writemode = 17; /* Equivalent to writemode = 1 but allow TSTRING -> TBYTE */\n\n    if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, writemode, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem2, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n    maxelem = maxelem2;\n\n    if (tcode == TSTRING)   \n         ffcfmt(tform, cform);     /* derive C format for writing strings */\n\n    /*\n      if there is no scaling \n      then we can simply write the raw data bytes into the FITS file if the\n      datatype of the FITS column is the same as the input values.  Otherwise,\n      we must convert the raw values into the scaled and/or machine dependent\n      format in a temporary buffer that has been allocated for this purpose.\n    */\n    if (scale == 1. && zero == 0. && tcode == TBYTE)\n    {\n        writeraw = 1;\n        if (nelem < (LONGLONG)INT32_MAX) {\n            maxelem = nelem;\n        } else {\n            maxelem = INT32_MAX;\n        }\n     }\n    else\n        writeraw = 0;\n\n    /*---------------------------------------------------------------------*/\n    /*  Now write the pixels to the FITS column.                           */\n    /*  First call the ffXXfYY routine to  (1) convert the datatype        */\n    /*  if necessary, and (2) scale the values by the FITS TSCALn and      */\n    /*  TZEROn linear scaling parameters into a temporary buffer.          */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to write  */\n    next = 0;                 /* next element in array to be written  */\n    rownum = 0;               /* row number, relative to firstrow     */\n\n    while (remain)\n    {\n        /* limit the number of pixels to process a one time to the number that\n           will fit in the buffer space or to the number of pixels that remain\n           in the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);      \n        ntodo = (long) minvalue(ntodo, (repeat - elemnum));\n\n        wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre);\n        ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */\n\n        switch (tcode) \n        {\n            case (TBYTE):\n              if (writeraw)\n              {\n                /* write raw input bytes without conversion */\n                ffpi1b(fptr, ntodo, incre, &array[next], status);\n              }\n              else\n              {\n                /* convert the raw data before writing to FITS file */\n                ffi1fi1(&array[next], ntodo, scale, zero,\n                        (unsigned char *) buffer, status);\n                ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status);\n              }\n\n              break;\n\n            case (TLONGLONG):\n\n                ffi1fi8(&array[next], ntodo, scale, zero,\n                        (LONGLONG *) buffer, status);\n                ffpi8b(fptr, ntodo, incre, (long *) buffer, status);\n                break;\n\n            case (TSHORT):\n \n                ffi1fi2(&array[next], ntodo, scale, zero,\n                        (short *) buffer, status);\n                ffpi2b(fptr, ntodo, incre, (short *) buffer, status);\n                break;\n\n            case (TLONG):\n\n                ffi1fi4(&array[next], ntodo, scale, zero,\n                        (INT32BIT *) buffer, status);\n                ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status);\n                break;\n\n            case (TFLOAT):\n\n                ffi1fr4(&array[next], ntodo, scale, zero,\n                        (float *)  buffer, status);\n                ffpr4b(fptr, ntodo, incre, (float *) buffer, status);\n                break;\n\n            case (TDOUBLE):\n                ffi1fr8(&array[next], ntodo, scale, zero,\n                        (double *) buffer, status);\n                ffpr8b(fptr, ntodo, incre, (double *) buffer, status);\n                break;\n\n            case (TSTRING):  /* numerical column in an ASCII table */\n\n\t        if (strchr(tform,'A')) \n                {\n                    /* write raw input bytes without conversion        */\n                    /* This case is a hack to let users write a stream */\n                    /* of bytes directly to the 'A' format column      */\n\n\t\t  if (incre == twidth) {\n                        ffpbyt(fptr, ntodo, &array[next], status);\n\t\t  } else {\n                        ffpbytoff(fptr, twidth, ntodo/twidth, incre - twidth, \n                                &array[next], status);\n\t\t  }\n\t\t  break;\n                }\n                else if (cform[1] != 's')  /*  \"%s\" format is a string */\n                {\n                  ffi1fstr(&array[next], ntodo, scale, zero, cform,\n                          twidth, (char *) buffer, status);\n\n                  if (incre == twidth)    /* contiguous bytes */\n                     ffpbyt(fptr, ntodo * twidth, buffer, status);\n                  else\n                     ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                            status);\n                  break;\n                }\n                /* can't write to string column, so fall thru to default: */\n\n            default:  /*  error trap  */\n                snprintf(message, FLEN_ERRMSG,\n                       \"Cannot write numbers to column %d which has format %s\",\n                        colnum,tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous write operation */\n        {\n          snprintf(message,FLEN_ERRMSG,\n          \"Error writing elements %.0f thru %.0f of input data array (ffpclb).\",\n              (double) (next+1), (double) (next+ntodo));\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum += ntodo;\n            if (elemnum == repeat)  /* completed a row; start on next row */\n            {\n                elemnum = 0;\n                rownum++;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n      ffpmsg(\n      \"Numerical overflow during type conversion while writing FITS data.\");\n      *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcnb( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            unsigned char *array,   /* I - array of values to write         */\n            unsigned char nulvalue, /* I - flag for undefined pixels        */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of elements to the specified column of a table.  Any input\n  pixels equal to the value of nulvalue will be replaced by the appropriate\n  null value in the output FITS file. \n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary\n*/\n{\n    tcolumn *colptr;\n    LONGLONG  ngood = 0, nbad = 0, ii;\n    LONGLONG repeat, first, fstelm, fstrow;\n    int tcode, overflow = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n    }\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n\n    tcode  = colptr->tdatatype;\n\n    if (tcode > 0)\n       repeat = colptr->trepeat;  /* repeat count for this column */\n    else\n       repeat = firstelem -1 + nelem;  /* variable length arrays */\n\n    /* if variable length array, first write the whole input vector, \n       then go back and fill in the nulls */\n    if (tcode < 0) {\n      if (ffpclb(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) {\n        if (*status == NUM_OVERFLOW) \n\t{\n\t  /* ignore overflows, which are possibly the null pixel values */\n\t  /*  overflow = 1;   */\n\t  *status = 0;\n\t} else { \n          return(*status);\n\t}\n      }\n    }\n\n    /* absolute element number in the column */\n    first = (firstrow - 1) * repeat + firstelem;\n\n    for (ii = 0; ii < nelem; ii++)\n    {\n      if (array[ii] != nulvalue)  /* is this a good pixel? */\n      {\n         if (nbad)  /* write previous string of bad pixels */\n         {\n            fstelm = ii - nbad + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0)\n                return(*status);\n\n            nbad=0;\n         }\n\n         ngood = ngood + 1;  /* the consecutive number of good pixels */\n      }\n      else\n      {\n         if (ngood)  /* write previous string of good pixels */\n         {\n            fstelm = ii - ngood + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (tcode > 0) {  /* variable length arrays have already been written */\n              if (ffpclb(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood],\n                status) > 0) {\n\t\tif (*status == NUM_OVERFLOW) \n\t\t{\n\t\t  overflow = 1;\n\t\t  *status = 0;\n\t\t} else { \n                  return(*status);\n\t\t}\n\t      }\n\t    }\n            ngood=0;\n         }\n\n         nbad = nbad + 1;  /* the consecutive number of bad pixels */\n      }\n    }\n    \n    /* finished loop;  now just write the last set of pixels */\n\n    if (ngood)  /* write last string of good pixels */\n    {\n      fstelm = ii - ngood + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      if (tcode > 0) {  /* variable length arrays have already been written */\n        ffpclb(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status);\n      }\n    }\n    else if (nbad) /* write last string of bad pixels */\n    {\n      fstelm = ii - nbad + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      ffpclu(fptr, colnum, fstrow, fstelm, nbad, status);\n    }\n\n    if (*status <= 0) {\n      if (overflow) {\n        *status = NUM_OVERFLOW;\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpextn( fitsfile *fptr,        /* I - FITS file pointer                        */\n            LONGLONG  offset,      /* I - byte offset from start of extension data */\n            LONGLONG  nelem,       /* I - number of elements to write              */\n            void *buffer,          /* I - stream of bytes to write                 */\n            int  *status)          /* IO - error status                            */\n/*\n  Write a stream of bytes to the current FITS HDU.  This primative routine is mainly\n  for writing non-standard \"conforming\" extensions and should not be used\n  for standard IMAGE, TABLE or BINTABLE extensions.\n*/\n{\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    /* rescan header if data structure is undefined */\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n    /* move to write position */\n    ffmbyt(fptr, (fptr->Fptr)->datastart+ offset, IGNORE_EOF, status);\n    \n    /* write the buffer */\n    ffpbyt(fptr, nelem, buffer, status); \n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi1fi1(unsigned char *input,  /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            unsigned char *output, /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        memcpy(output, input, ntodo); /* just copy input to output */\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = ( ((double) input[ii]) - zero) / scale;\n\n            if (dvalue < DUCHAR_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (dvalue > DUCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) (dvalue + .5);\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi1fi2(unsigned char *input,  /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            short *output,         /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = input[ii];   /* just copy input to output */\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (((double) input[ii]) - zero) / scale;\n\n            if (dvalue < DSHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MIN;\n            }\n            else if (dvalue > DSHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (short) (dvalue + .5);\n                else\n                    output[ii] = (short) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi1fi4(unsigned char *input,  /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            INT32BIT *output,      /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (INT32BIT) input[ii];   /* copy input to output */\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (((double) input[ii]) - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (INT32BIT) (dvalue + .5);\n                else\n                    output[ii] = (INT32BIT) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi1fi8(unsigned char *input, /* I - array of values to be converted  */\n            long ntodo,           /* I - number of elements in the array  */\n            double scale,         /* I - FITS TSCALn or BSCALE value      */\n            double zero,          /* I - FITS TZEROn or BZERO  value      */\n            LONGLONG *output,     /* O - output array of converted values */\n            int *status)          /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero ==  9223372036854775808.)\n    {       \n        /* Writing to unsigned long long column. */\n        /* Instead of subtracting 9223372036854775808, it is more efficient */\n        /* and more precise to just flip the sign bit with the XOR operator */\n\n        /* no need to check range limits because all unsigned char values */\n\t/* are valid ULONGLONG values. */\n\n        for (ii = 0; ii < ntodo; ii++) {\n             output[ii] =  ((LONGLONG) input[ii]) ^ 0x8000000000000000;\n        }\n    }\n    else if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DLONGLONG_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MIN;\n            }\n            else if (dvalue > DLONGLONG_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (LONGLONG) (dvalue + .5);\n                else\n                    output[ii] = (LONGLONG) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi1fr4(unsigned char *input,  /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            float *output,         /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (float) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (float) (( ( (double) input[ii] ) - zero) / scale);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi1fr8(unsigned char *input,  /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            double *output,        /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (double) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = ( ( (double) input[ii] ) - zero) / scale;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi1fstr(unsigned char *input, /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            char *cform,       /* I - format for output string values  */\n            long twidth,       /* I - width of each field, in chars    */\n            char *output,      /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n    char *cptr;\n\n    cptr = output;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n           sprintf(output, cform, (double) input[ii]);\n           output += twidth;\n\n           if (*output)  /* if this char != \\0, then overflow occurred */\n              *status = OVERFLOW_ERR;\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n          dvalue = ((double) input[ii] - zero) / scale;\n          sprintf(output, cform, dvalue);\n          output += twidth;\n\n          if (*output)  /* if this char != \\0, then overflow occurred */\n            *status = OVERFLOW_ERR;\n        }\n    }\n\n    /* replace any commas with periods (e.g., in French locale) */\n    while ((cptr = strchr(cptr, ','))) *cptr = '.';\n    \n    return(*status);\n}\n"},{"id":16694,"name":"edithdu.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, edithdu.c, contains the FITSIO routines related to       */\n/*  copying, inserting, or deleting HDUs in a FITS file                 */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n/*--------------------------------------------------------------------------*/\nint ffcopy(fitsfile *infptr,    /* I - FITS file pointer to input file  */\n           fitsfile *outfptr,   /* I - FITS file pointer to output file */\n           int morekeys,        /* I - reserve space in output header   */\n           int *status)         /* IO - error status     */\n/*\n  copy the CHDU from infptr to the CHDU of outfptr.\n  This will also allocate space in the output header for MOREKY keywords\n*/\n{\n    int nspace;\n    \n    if (*status > 0)\n        return(*status);\n\n    if (infptr == outfptr)\n        return(*status = SAME_FILE);\n\n    if (ffcphd(infptr, outfptr, status) > 0)  /* copy the header keywords */\n       return(*status);\n\n    if (morekeys > 0) {\n      ffhdef(outfptr, morekeys, status); /* reserve space for more keywords */\n\n    } else {\n        if (ffghsp(infptr, NULL, &nspace, status) > 0) /* get existing space */\n            return(*status);\n\n        if (nspace > 0) {\n            ffhdef(outfptr, nspace, status); /* preserve same amount of space */\n            if (nspace >= 35) {  \n\n\t        /* There is at least 1 full empty FITS block in the header. */\n\t        /* Physically write the END keyword at the beginning of the */\n\t        /* last block to preserve this extra space now rather than */\n\t\t/* later.  This is needed by the stream: driver which cannot */\n\t\t/* seek back to the header to write the END keyword later. */\n\n\t        ffwend(outfptr, status);\n            }\n        }\n    }\n\n    ffcpdt(infptr, outfptr, status);  /* now copy the data unit */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffcpfl(fitsfile *infptr,    /* I - FITS file pointer to input file  */\n           fitsfile *outfptr,   /* I - FITS file pointer to output file */\n           int previous,        /* I - copy any previous HDUs?   */\n           int current,         /* I - copy the current HDU?     */\n           int following,       /* I - copy any following HDUs?   */\n           int *status)         /* IO - error status     */\n/*\n  copy all or part of the input file to the output file.\n*/\n{\n    int hdunum, ii;\n\n    if (*status > 0)\n        return(*status);\n\n    if (infptr == outfptr)\n        return(*status = SAME_FILE);\n\n    ffghdn(infptr, &hdunum);\n\n    if (previous) {   /* copy any previous HDUs */\n        for (ii=1; ii < hdunum; ii++) {\n            ffmahd(infptr, ii, NULL, status);\n            ffcopy(infptr, outfptr, 0, status);\n        }\n    }\n\n    if (current && (*status <= 0) ) {  /* copy current HDU */\n        ffmahd(infptr, hdunum, NULL, status);\n        ffcopy(infptr, outfptr, 0, status);\n    }\n\n    if (following && (*status <= 0) ) { /* copy any remaining HDUs */\n        ii = hdunum + 1;\n        while (1)\n        { \n            if (ffmahd(infptr, ii, NULL, status) ) {\n                 /* reset expected end of file status */\n                 if (*status == END_OF_FILE)\n                    *status = 0;\n                 break;\n            }\n\n            if (ffcopy(infptr, outfptr, 0, status))\n                 break;  /* quit on unexpected error */\n\n            ii++;\n        }\n    }\n\n    ffmahd(infptr, hdunum, NULL, status);  /* restore initial position */\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffcphd(fitsfile *infptr,    /* I - FITS file pointer to input file  */\n           fitsfile *outfptr,   /* I - FITS file pointer to output file */\n           int *status)         /* IO - error status     */\n/*\n  copy the header keywords from infptr to outfptr.\n*/\n{\n    int nkeys, ii, inPrim = 0, outPrim = 0;\n    long naxis, naxes[1];\n    char *card, comm[FLEN_COMMENT];\n    char *tmpbuff;\n\n    if (*status > 0)\n        return(*status);\n\n    if (infptr == outfptr)\n        return(*status = SAME_FILE);\n\n    /* set the input pointer to the correct HDU */\n    if (infptr->HDUposition != (infptr->Fptr)->curhdu)\n        ffmahd(infptr, (infptr->HDUposition) + 1, NULL, status);\n\n    if (ffghsp(infptr, &nkeys, NULL, status) > 0) /* get no. of keywords */\n        return(*status);\n\n    /* create a memory buffer to hold the header records */\n    tmpbuff = (char*) malloc(nkeys*FLEN_CARD*sizeof(char));\n    if (!tmpbuff)\n        return(*status = MEMORY_ALLOCATION);\n\n    /* read all of the header records in the input HDU */\n    for (ii = 0; ii < nkeys; ii++)\n      ffgrec(infptr, ii+1, tmpbuff + (ii * FLEN_CARD), status);\n\n    if (infptr->HDUposition == 0)  /* set flag if this is the Primary HDU */\n       inPrim = 1;\n\n    /* if input is an image hdu, get the number of axes */\n    naxis = -1;   /* negative if HDU is a table */\n    if ((infptr->Fptr)->hdutype == IMAGE_HDU)\n        ffgkyj(infptr, \"NAXIS\", &naxis, NULL, status);\n\n    /* set the output pointer to the correct HDU */\n    if (outfptr->HDUposition != (outfptr->Fptr)->curhdu)\n        ffmahd(outfptr, (outfptr->HDUposition) + 1, NULL, status);\n\n    /* check if output header is empty; if not create new empty HDU */\n    if ((outfptr->Fptr)->headend !=\n        (outfptr->Fptr)->headstart[(outfptr->Fptr)->curhdu] )\n           ffcrhd(outfptr, status);   \n\n    if (outfptr->HDUposition == 0)\n    {\n        if (naxis < 0)\n        {\n            /* the input HDU is a table, so we have to create */\n            /* a dummy Primary array before copying it to the output */\n            ffcrim(outfptr, 8, 0, naxes, status);\n            ffcrhd(outfptr, status); /* create new empty HDU */\n        }\n        else\n        {\n            /* set flag that this is the Primary HDU */\n            outPrim = 1;\n        }\n    }\n\n    if (*status > 0)  /* check for errors before proceeding */\n    {\n        free(tmpbuff);\n        return(*status);\n    }\n    if ( inPrim == 1 && outPrim == 0 )\n    {\n        /* copying from primary array to image extension */\n        strcpy(comm, \"IMAGE extension\");\n        ffpkys(outfptr, \"XTENSION\", \"IMAGE\", comm, status);\n\n        /* copy BITPIX through NAXISn keywords */\n        for (ii = 1; ii < 3 + naxis; ii++)\n        {\n            card = tmpbuff + (ii * FLEN_CARD);\n            ffprec(outfptr, card, status);\n        }\n\n        strcpy(comm, \"number of random group parameters\");\n        ffpkyj(outfptr, \"PCOUNT\", 0, comm, status);\n  \n        strcpy(comm, \"number of random groups\");\n        ffpkyj(outfptr, \"GCOUNT\", 1, comm, status);\n\n\n        /* copy remaining keywords, excluding EXTEND, and reference COMMENT keywords */\n        for (ii = 3 + naxis ; ii < nkeys; ii++)\n        {\n            card = tmpbuff+(ii * FLEN_CARD);\n            if (FSTRNCMP(card, \"EXTEND  \", 8) &&\n                FSTRNCMP(card, \"COMMENT   FITS (Flexible Image Transport System) format is\", 58) && \n                FSTRNCMP(card, \"COMMENT   and Astrophysics', volume 376, page 3\", 47) )\n            {\n                 ffprec(outfptr, card, status);\n            }\n        }\n    }\n    else if ( inPrim == 0 && outPrim == 1 )\n    {\n        /* copying between image extension and primary array */\n        strcpy(comm, \"file does conform to FITS standard\");\n        ffpkyl(outfptr, \"SIMPLE\", TRUE, comm, status);\n\n        /* copy BITPIX through NAXISn keywords */\n        for (ii = 1; ii < 3 + naxis; ii++)\n        {\n            card = tmpbuff + (ii * FLEN_CARD);\n            ffprec(outfptr, card, status);\n        }\n\n        /* add the EXTEND keyword */\n        strcpy(comm, \"FITS dataset may contain extensions\");\n        ffpkyl(outfptr, \"EXTEND\", TRUE, comm, status);\n\n      /* write standard block of self-documentating comments */\n      ffprec(outfptr,\n      \"COMMENT   FITS (Flexible Image Transport System) format is defined in 'Astronomy\",\n      status);\n      ffprec(outfptr,\n      \"COMMENT   and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H\",\n      status);\n\n        /* copy remaining keywords, excluding pcount, gcount */\n        for (ii = 3 + naxis; ii < nkeys; ii++)\n        {\n            card = tmpbuff+(ii * FLEN_CARD);\n            if (FSTRNCMP(card, \"PCOUNT  \", 8) && FSTRNCMP(card, \"GCOUNT  \", 8))\n            {\n                 ffprec(outfptr, card, status);\n            }\n        }\n    }\n    else\n    {\n        /* input and output HDUs are same type; simply copy all keywords */\n        for (ii = 0; ii < nkeys; ii++)\n        {\n            card = tmpbuff+(ii * FLEN_CARD);\n            ffprec(outfptr, card, status);\n        }\n    }\n\n    free(tmpbuff);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffcpht(fitsfile *infptr,    /* I - FITS file pointer to input file  */\n\t   fitsfile *outfptr,   /* I - FITS file pointer to output file */\n           LONGLONG firstrow,   /* I - number of first row to copy (1 based)  */\n\t   LONGLONG nrows,      /* I - number of rows to copy  */\n\t   int *status)         /* IO - error status     */\n\n/* \n   Copy the table structure from an existing table HDU, but only\n   copy a limited row range.  All header keywords from the input\n   table are copied directly, but NAXSI2 and PCOUNT are set to their\n   correct values. \n*/\n{\n  if (*status > 0)\n    return(*status);\n\n  /* Copy the header only */\n  ffcphd(infptr, outfptr, status);\n  /* Note that we now have a copied header that describes the table,\n     and that is the current header, but the original number of table\n     rows and heap area sizes are still there. */\n\n  /* Zero out the size-related keywords */\n  if (! *status ) {\n    ffukyj(outfptr,\"NAXIS2\",0,0,status); /* NAXIS2 = 0 */\n    ffukyj(outfptr,\"PCOUNT\",0,0,status); /* PCOUNT = 0 */\n    /* Update the internal structure variables within CFITSIO now\n       that we have a valid table header */\n    ffrdef(outfptr,status);\n  }\n\n  /* OK now that we have a pristine HDU, copy the requested rows */\n  if (! *status && nrows > 0) {\n    ffcprw(infptr, outfptr, firstrow, nrows, status);\n  }\n \n  return (*status);\n}\n\n\n/*--------------------------------------------------------------------------*/\nint ffcpdt(fitsfile *infptr,    /* I - FITS file pointer to input file  */\n           fitsfile *outfptr,   /* I - FITS file pointer to output file */\n           int *status)         /* IO - error status     */\n{\n/*\n  copy the data unit from the CHDU of infptr to the CHDU of outfptr. \n  This will overwrite any data already in the outfptr CHDU.\n*/\n    long nb, ii;\n    LONGLONG indatastart, indataend, outdatastart;\n    char buffer[2880];\n\n    if (*status > 0)\n        return(*status);\n\n    if (infptr == outfptr)\n        return(*status = SAME_FILE);\n\n    ffghadll(infptr,  NULL, &indatastart, &indataend, status);\n    ffghadll(outfptr, NULL, &outdatastart, NULL, status);\n\n    /* Calculate the number of blocks to be copied  */\n    nb = (long) ((indataend - indatastart) / 2880);\n\n    if (nb > 0)\n    {\n      if (infptr->Fptr == outfptr->Fptr)\n      {\n        /* copying between 2 HDUs in the SAME file */\n        for (ii = 0; ii < nb; ii++)\n        {\n            ffmbyt(infptr,  indatastart,  REPORT_EOF, status);\n            ffgbyt(infptr,  2880L, buffer, status); /* read input block */\n\n            ffmbyt(outfptr, outdatastart, IGNORE_EOF, status);\n            ffpbyt(outfptr, 2880L, buffer, status); /* write output block */\n\n            indatastart  += 2880; /* move address */\n            outdatastart += 2880; /* move address */\n        }\n      }\n      else\n      {\n        /* copying between HDUs in separate files */\n        /* move to the initial copy position in each of the files */\n        ffmbyt(infptr,  indatastart,  REPORT_EOF, status);\n        ffmbyt(outfptr, outdatastart, IGNORE_EOF, status);\n\n        for (ii = 0; ii < nb; ii++)\n        {\n            ffgbyt(infptr,  2880L, buffer, status); /* read input block */\n            ffpbyt(outfptr, 2880L, buffer, status); /* write output block */\n        }\n      }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffwrhdu(fitsfile *infptr,    /* I - FITS file pointer to input file  */\n            FILE *outstream,     /* I - stream to write HDU to */\n            int *status)         /* IO - error status     */\n{\n/*\n  write the data unit from the CHDU of infptr to the output file stream\n*/\n    long nb, ii;\n    LONGLONG hdustart, hduend;\n    char buffer[2880];\n\n    if (*status > 0)\n        return(*status);\n\n    ffghadll(infptr, &hdustart,  NULL, &hduend, status);\n\n    nb = (long) ((hduend - hdustart) / 2880);  /* number of blocks to copy */\n\n    if (nb > 0)\n    {\n\n        /* move to the start of the HDU */\n        ffmbyt(infptr,  hdustart,  REPORT_EOF, status);\n\n        for (ii = 0; ii < nb; ii++)\n        {\n            ffgbyt(infptr,  2880L, buffer, status); /* read input block */\n            fwrite(buffer, 1, 2880, outstream ); /* write to output stream */\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffiimg(fitsfile *fptr,      /* I - FITS file pointer           */\n           int bitpix,          /* I - bits per pixel              */\n           int naxis,           /* I - number of axes in the array */\n           long *naxes,         /* I - size of each axis           */\n           int *status)         /* IO - error status               */\n/*\n  insert an IMAGE extension following the current HDU \n*/\n{\n    LONGLONG tnaxes[99];\n    int ii;\n    \n    if (*status > 0)\n        return(*status);\n\n    if (naxis > 99) {\n        ffpmsg(\"NAXIS value is too large (>99)  (ffiimg)\");\n\treturn(*status = 212);\n    }\n\n    for (ii = 0; (ii < naxis); ii++)\n       tnaxes[ii] = naxes[ii];\n       \n    ffiimgll(fptr, bitpix, naxis, tnaxes, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffiimgll(fitsfile *fptr,    /* I - FITS file pointer           */\n           int bitpix,          /* I - bits per pixel              */\n           int naxis,           /* I - number of axes in the array */\n           LONGLONG *naxes,     /* I - size of each axis           */\n           int *status)         /* IO - error status               */\n/*\n  insert an IMAGE extension following the current HDU \n*/\n{\n    int bytlen, nexthdu, maxhdu, ii, onaxis;\n    long nblocks;\n    LONGLONG npixels, newstart, datasize;\n    char errmsg[FLEN_ERRMSG], card[FLEN_CARD], naxiskey[FLEN_KEYWORD];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    maxhdu = (fptr->Fptr)->maxhdu;\n\n    if (*status != PREPEND_PRIMARY)\n    {\n      /* if the current header is completely empty ...  */\n      if (( (fptr->Fptr)->headend == (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu])\n        /* or, if we are at the end of the file, ... */\n      ||  ( (((fptr->Fptr)->curhdu) == maxhdu ) &&\n       ((fptr->Fptr)->headstart[maxhdu + 1] >= (fptr->Fptr)->logfilesize ) ) )\n      {\n        /* then simply append new image extension */\n        ffcrimll(fptr, bitpix, naxis, naxes, status);\n        return(*status);\n      }\n    }\n\n    if (bitpix == 8)\n        bytlen = 1;\n    else if (bitpix == 16)\n        bytlen = 2;\n    else if (bitpix == 32 || bitpix == -32)\n        bytlen = 4;\n    else if (bitpix == 64 || bitpix == -64)\n        bytlen = 8;\n    else\n    {\n        snprintf(errmsg, FLEN_ERRMSG,\n        \"Illegal value for BITPIX keyword: %d\", bitpix);\n        ffpmsg(errmsg);\n        return(*status = BAD_BITPIX);  /* illegal bitpix value */\n    }\n    if (naxis < 0 || naxis > 999)\n    {\n        snprintf(errmsg, FLEN_ERRMSG,\n        \"Illegal value for NAXIS keyword: %d\", naxis);\n        ffpmsg(errmsg);\n        return(*status = BAD_NAXIS);\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n        if (naxes[ii] < 0)\n        {\n            snprintf(errmsg, FLEN_ERRMSG,\n            \"Illegal value for NAXIS%d keyword: %ld\", ii + 1,  (long) naxes[ii]);\n            ffpmsg(errmsg);\n            return(*status = BAD_NAXES);\n        }\n    }\n\n    /* calculate number of pixels in the image */\n    if (naxis == 0)\n        npixels = 0;\n    else \n        npixels = naxes[0];\n\n    for (ii = 1; ii < naxis; ii++)\n        npixels = npixels * naxes[ii];\n\n    datasize = npixels * bytlen;          /* size of image in bytes */\n    nblocks = (long) (((datasize + 2879) / 2880) + 1);  /* +1 for the header */\n\n    if ((fptr->Fptr)->writemode == READWRITE) /* must have write access */\n    {   /* close the CHDU */\n        ffrdef(fptr, status);  /* scan header to redefine structure */\n        ffpdfl(fptr, status);  /* insure correct data file values */\n    }\n    else\n        return(*status = READONLY_FILE);\n\n    if (*status == PREPEND_PRIMARY)\n    {\n        /* inserting a new primary array; the current primary */\n        /* array must be transformed into an image extension. */\n\n        *status = 0;   \n        ffmahd(fptr, 1, NULL, status);  /* move to the primary array */\n\n        ffgidm(fptr, &onaxis, status);\n        if (onaxis > 0)\n            ffkeyn(\"NAXIS\",onaxis, naxiskey, status);\n        else\n            strcpy(naxiskey, \"NAXIS\");\n\n        ffgcrd(fptr, naxiskey, card, status);  /* read last NAXIS keyword */\n        \n        ffikyj(fptr, \"PCOUNT\", 0, \"required keyword\", status); /* add PCOUNT and */\n        ffikyj(fptr, \"GCOUNT\", 1, \"required keyword\", status); /* GCOUNT keywords */\n\n        if (*status > 0)\n            return(*status);\n\n        if (ffdkey(fptr, \"EXTEND\", status) ) /* delete the EXTEND keyword */\n            *status = 0;\n\n        /* redefine internal structure for this HDU */\n        ffrdef(fptr, status);\n\n\n        /* insert space for the primary array */\n        if (ffiblk(fptr, nblocks, -1, status) > 0)  /* insert the blocks */\n            return(*status);\n\n        nexthdu = 0;  /* number of the new hdu */\n        newstart = 0; /* starting addr of HDU */\n    }\n    else\n    {\n        nexthdu = ((fptr->Fptr)->curhdu) + 1; /* number of the next (new) hdu */\n        newstart = (fptr->Fptr)->headstart[nexthdu]; /* save starting addr of HDU */\n\n        (fptr->Fptr)->hdutype = IMAGE_HDU;  /* so that correct fill value is used */\n        /* ffiblk also increments headstart for all following HDUs */\n        if (ffiblk(fptr, nblocks, 1, status) > 0)  /* insert the blocks */\n            return(*status);\n    }\n\n    ((fptr->Fptr)->maxhdu)++;      /* increment known number of HDUs in the file */\n    for (ii = (fptr->Fptr)->maxhdu; ii > (fptr->Fptr)->curhdu; ii--)\n        (fptr->Fptr)->headstart[ii + 1] = (fptr->Fptr)->headstart[ii]; /* incre start addr */\n\n    if (nexthdu == 0)\n       (fptr->Fptr)->headstart[1] = nblocks * 2880; /* start of the old Primary array */\n\n    (fptr->Fptr)->headstart[nexthdu] = newstart; /* set starting addr of HDU */\n\n    /* set default parameters for this new empty HDU */\n    (fptr->Fptr)->curhdu = nexthdu;   /* we are now located at the next HDU */\n    fptr->HDUposition = nexthdu;      /* we are now located at the next HDU */\n    (fptr->Fptr)->nextkey = (fptr->Fptr)->headstart[nexthdu];  \n    (fptr->Fptr)->headend = (fptr->Fptr)->headstart[nexthdu];\n    (fptr->Fptr)->datastart = ((fptr->Fptr)->headstart[nexthdu]) + 2880;\n    (fptr->Fptr)->hdutype = IMAGE_HDU;  /* might need to be reset... */\n\n    /* write the required header keywords */\n    ffphprll(fptr, TRUE, bitpix, naxis, naxes, 0, 1, TRUE, status);\n\n    /* redefine internal structure for this HDU */\n    ffrdef(fptr, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffitab(fitsfile *fptr,  /* I - FITS file pointer                        */\n           LONGLONG naxis1,     /* I - width of row in the table                */\n           LONGLONG naxis2,     /* I - number of rows in the table              */\n           int tfields,     /* I - number of columns in the table           */\n           char **ttype,    /* I - name of each column                      */\n           long *tbcol,     /* I - byte offset in row to each column        */\n           char **tform,    /* I - value of TFORMn keyword for each column  */\n           char **tunit,    /* I - value of TUNITn keyword for each column  */\n           const char *extnmx,   /* I - value of EXTNAME keyword, if any         */\n           int *status)     /* IO - error status                            */\n/*\n  insert an ASCII table extension following the current HDU \n*/\n{\n    int nexthdu, maxhdu, ii, nunit, nhead, ncols, gotmem = 0;\n    long nblocks, rowlen;\n    LONGLONG datasize, newstart;\n    char errmsg[FLEN_ERRMSG], extnm[FLEN_VALUE];\n\n    if (*status > 0)\n        return(*status);\n\n    extnm[0] = '\\0';\n    if (extnmx)\n      strncat(extnm, extnmx, FLEN_VALUE-1);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    maxhdu = (fptr->Fptr)->maxhdu;\n    /* if the current header is completely empty ...  */\n    if (( (fptr->Fptr)->headend == (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] )\n        /* or, if we are at the end of the file, ... */\n    ||  ( (((fptr->Fptr)->curhdu) == maxhdu ) &&\n       ((fptr->Fptr)->headstart[maxhdu + 1] >= (fptr->Fptr)->logfilesize ) ) )\n    {\n        /* then simply append new image extension */\n        ffcrtb(fptr, ASCII_TBL, naxis2, tfields, ttype, tform, tunit,\n               extnm, status);\n        return(*status);\n    }\n\n    if (naxis1 < 0)\n        return(*status = NEG_WIDTH);\n    else if (naxis2 < 0)\n        return(*status = NEG_ROWS);\n    else if (tfields < 0 || tfields > 999)\n    {\n        snprintf(errmsg, FLEN_ERRMSG,\n        \"Illegal value for TFIELDS keyword: %d\", tfields);\n        ffpmsg(errmsg);\n        return(*status = BAD_TFIELDS);\n    }\n\n    /* count number of optional TUNIT keywords to be written */\n    nunit = 0;\n    for (ii = 0; ii < tfields; ii++)\n    {\n        if (tunit && *tunit && *tunit[ii])\n            nunit++;\n    }\n\n    if (*extnm)\n         nunit++;     /* add one for the EXTNAME keyword */\n\n    rowlen = (long) naxis1;\n\n    if (!tbcol || !tbcol[0] || (!naxis1 && tfields)) /* spacing not defined? */\n    {\n      /* allocate mem for tbcol; malloc may have problems allocating small */\n      /* arrays, so allocate at least 20 bytes */\n\n      ncols = maxvalue(5, tfields);\n      tbcol = (long *) calloc(ncols, sizeof(long));\n\n      if (tbcol)\n      {\n        gotmem = 1;\n\n        /* calculate width of a row and starting position of each column. */\n        /* Each column will be separated by 1 blank space */\n        ffgabc(tfields, tform, 1, &rowlen, tbcol, status);\n      }\n    }\n\n    nhead = (9 + (3 * tfields) + nunit + 35) / 36;  /* no. of header blocks */\n    datasize = (LONGLONG)rowlen * naxis2;          /* size of table in bytes */\n    nblocks = (long) (((datasize + 2879) / 2880) + nhead);  /* size of HDU */\n\n    if ((fptr->Fptr)->writemode == READWRITE) /* must have write access */\n    {   /* close the CHDU */\n        ffrdef(fptr, status);  /* scan header to redefine structure */\n        ffpdfl(fptr, status);  /* insure correct data file values */\n    }\n    else\n        return(*status = READONLY_FILE);\n\n    nexthdu = ((fptr->Fptr)->curhdu) + 1; /* number of the next (new) hdu */\n    newstart = (fptr->Fptr)->headstart[nexthdu]; /* save starting addr of HDU */\n\n    (fptr->Fptr)->hdutype = ASCII_TBL;  /* so that correct fill value is used */\n    /* ffiblk also increments headstart for all following HDUs */\n    if (ffiblk(fptr, nblocks, 1, status) > 0)  /* insert the blocks */\n    {\n        if (gotmem)\n            free(tbcol); \n        return(*status);\n    }\n\n    ((fptr->Fptr)->maxhdu)++;      /* increment known number of HDUs in the file */\n    for (ii = (fptr->Fptr)->maxhdu; ii > (fptr->Fptr)->curhdu; ii--)\n        (fptr->Fptr)->headstart[ii + 1] = (fptr->Fptr)->headstart[ii]; /* incre start addr */\n\n    (fptr->Fptr)->headstart[nexthdu] = newstart; /* set starting addr of HDU */\n\n    /* set default parameters for this new empty HDU */\n    (fptr->Fptr)->curhdu = nexthdu;   /* we are now located at the next HDU */\n    fptr->HDUposition = nexthdu;      /* we are now located at the next HDU */\n    (fptr->Fptr)->nextkey = (fptr->Fptr)->headstart[nexthdu];  \n    (fptr->Fptr)->headend = (fptr->Fptr)->headstart[nexthdu];\n    (fptr->Fptr)->datastart = ((fptr->Fptr)->headstart[nexthdu]) + (nhead * 2880);\n    (fptr->Fptr)->hdutype = ASCII_TBL;  /* might need to be reset... */\n\n    /* write the required header keywords */\n\n    ffphtb(fptr, rowlen, naxis2, tfields, ttype, tbcol, tform, tunit,\n           extnm, status);\n\n    if (gotmem)\n        free(tbcol); \n\n    /* redefine internal structure for this HDU */\n\n    ffrdef(fptr, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffibin(fitsfile *fptr,  /* I - FITS file pointer                        */\n           LONGLONG naxis2,     /* I - number of rows in the table              */\n           int tfields,     /* I - number of columns in the table           */\n           char **ttype,    /* I - name of each column                      */\n           char **tform,    /* I - value of TFORMn keyword for each column  */\n           char **tunit,    /* I - value of TUNITn keyword for each column  */\n           const char *extnmx,     /* I - value of EXTNAME keyword, if any         */\n           LONGLONG pcount, /* I - size of special data area (heap)         */\n           int *status)     /* IO - error status                            */\n/*\n  insert a Binary table extension following the current HDU \n*/\n{\n    int nexthdu, maxhdu, ii, nunit, nhead, datacode;\n    LONGLONG naxis1;\n    long nblocks, repeat, width;\n    LONGLONG datasize, newstart;\n    char errmsg[FLEN_ERRMSG], extnm[FLEN_VALUE];\n\n    if (*status > 0)\n        return(*status);\n\n    extnm[0] = '\\0';\n    if (extnmx)\n      strncat(extnm, extnmx, FLEN_VALUE-1);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    maxhdu = (fptr->Fptr)->maxhdu;\n    /* if the current header is completely empty ...  */\n    if (( (fptr->Fptr)->headend == (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] )\n        /* or, if we are at the end of the file, ... */\n    ||  ( (((fptr->Fptr)->curhdu) == maxhdu ) &&\n       ((fptr->Fptr)->headstart[maxhdu + 1] >= (fptr->Fptr)->logfilesize ) ) )\n    {\n        /* then simply append new image extension */\n        ffcrtb(fptr, BINARY_TBL, naxis2, tfields, ttype, tform, tunit,\n               extnm, status);\n        return(*status);\n    }\n\n    if (naxis2 < 0)\n        return(*status = NEG_ROWS);\n    else if (tfields < 0 || tfields > 999)\n    {\n        snprintf(errmsg, FLEN_ERRMSG,\n        \"Illegal value for TFIELDS keyword: %d\", tfields);\n        ffpmsg(errmsg);\n        return(*status = BAD_TFIELDS);\n    }\n\n    /* count number of optional TUNIT keywords to be written */\n    nunit = 0;\n    for (ii = 0; ii < tfields; ii++)\n    {\n        if (tunit && *tunit && *tunit[ii])\n            nunit++;\n    }\n\n    if (*extnm)\n         nunit++;     /* add one for the EXTNAME keyword */\n\n    nhead = (9 + (2 * tfields) + nunit + 35) / 36;  /* no. of header blocks */\n\n    /* calculate total width of the table */\n    naxis1 = 0;\n    for (ii = 0; ii < tfields; ii++)\n    {\n        ffbnfm(tform[ii], &datacode, &repeat, &width, status);\n\n        if (datacode == TBIT)\n            naxis1 = naxis1 + ((repeat + 7) / 8);\n        else if (datacode == TSTRING)\n            naxis1 += repeat;\n        else\n            naxis1 = naxis1 + (repeat * width);\n    }\n\n    datasize = ((LONGLONG)naxis1 * naxis2) + pcount;         /* size of table in bytes */\n    nblocks = (long) ((datasize + 2879) / 2880) + nhead;  /* size of HDU */\n\n    if ((fptr->Fptr)->writemode == READWRITE) /* must have write access */\n    {   /* close the CHDU */\n        ffrdef(fptr, status);  /* scan header to redefine structure */\n        ffpdfl(fptr, status);  /* insure correct data file values */\n    }\n    else\n        return(*status = READONLY_FILE);\n\n    nexthdu = ((fptr->Fptr)->curhdu) + 1; /* number of the next (new) hdu */\n    newstart = (fptr->Fptr)->headstart[nexthdu]; /* save starting addr of HDU */\n\n    (fptr->Fptr)->hdutype = BINARY_TBL;  /* so that correct fill value is used */\n\n    /* ffiblk also increments headstart for all following HDUs */\n    if (ffiblk(fptr, nblocks, 1, status) > 0)  /* insert the blocks */\n        return(*status);\n\n    ((fptr->Fptr)->maxhdu)++;      /* increment known number of HDUs in the file */\n    for (ii = (fptr->Fptr)->maxhdu; ii > (fptr->Fptr)->curhdu; ii--)\n        (fptr->Fptr)->headstart[ii + 1] = (fptr->Fptr)->headstart[ii]; /* incre start addr */\n\n    (fptr->Fptr)->headstart[nexthdu] = newstart; /* set starting addr of HDU */\n\n    /* set default parameters for this new empty HDU */\n    (fptr->Fptr)->curhdu = nexthdu;   /* we are now located at the next HDU */\n    fptr->HDUposition = nexthdu;      /* we are now located at the next HDU */\n    (fptr->Fptr)->nextkey = (fptr->Fptr)->headstart[nexthdu];  \n    (fptr->Fptr)->headend = (fptr->Fptr)->headstart[nexthdu];\n    (fptr->Fptr)->datastart = ((fptr->Fptr)->headstart[nexthdu]) + (nhead * 2880);\n    (fptr->Fptr)->hdutype = BINARY_TBL;  /* might need to be reset... */\n\n    /* write the required header keywords. This will write PCOUNT = 0 */\n    /* so that the variable length data will be written at the right place */\n    ffphbn(fptr, naxis2, tfields, ttype, tform, tunit, extnm, pcount,\n           status);\n\n    /* redefine internal structure for this HDU (with PCOUNT = 0) */\n    ffrdef(fptr, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffdhdu(fitsfile *fptr,      /* I - FITS file pointer                   */\n           int *hdutype,        /* O - type of the new CHDU after deletion */\n           int *status)         /* IO - error status                       */\n/*\n  Delete the CHDU.  If the CHDU is the primary array, then replace the HDU\n  with an empty primary array with no data.   Return the\n  type of the new CHDU after the old CHDU is deleted.\n*/\n{\n    int tmptype = 0;\n    long nblocks, ii, naxes[1];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if ((fptr->Fptr)->curhdu == 0) /* replace primary array with null image */\n    {\n        /* ignore any existing keywords */\n        (fptr->Fptr)->headend = 0;\n        (fptr->Fptr)->nextkey = 0;\n\n        /* write default primary array header */\n        ffphpr(fptr,1,8,0,naxes,0,1,1,status);\n\n        /* calc number of blocks to delete (leave just 1 block) */\n        nblocks = (long) (( (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu + 1] - \n                2880 ) / 2880);\n\n        /* ffdblk also updates the starting address of all following HDUs */\n        if (nblocks > 0)\n        {\n            if (ffdblk(fptr, nblocks, status) > 0) /* delete the HDU */\n                return(*status);\n        }\n\n        /* this might not be necessary, but is doesn't hurt */\n        (fptr->Fptr)->datastart = DATA_UNDEFINED;\n\n        ffrdef(fptr, status);  /* reinitialize the primary array */\n    }\n    else\n    {\n\n        /* calc number of blocks to delete */\n        nblocks = (long) (( (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu + 1] - \n                (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] ) / 2880);\n\n        /* ffdblk also updates the starting address of all following HDUs */\n        if (ffdblk(fptr, nblocks, status) > 0) /* delete the HDU */\n            return(*status);\n\n        /* delete the CHDU from the list of HDUs */\n        for (ii = (fptr->Fptr)->curhdu + 1; ii <= (fptr->Fptr)->maxhdu; ii++)\n            (fptr->Fptr)->headstart[ii] = (fptr->Fptr)->headstart[ii + 1];\n\n        (fptr->Fptr)->headstart[(fptr->Fptr)->maxhdu + 1] = 0;\n        ((fptr->Fptr)->maxhdu)--; /* decrement the known number of HDUs */\n\n        if (ffrhdu(fptr, &tmptype, status) > 0)  /* initialize next HDU */\n        {\n            /* failed (end of file?), so move back one HDU */\n            *status = 0;\n            ffcmsg();       /* clear extraneous error messages */\n            ffgext(fptr, ((fptr->Fptr)->curhdu) - 1, &tmptype, status);\n        }\n    }\n\n    if (hdutype)\n       *hdutype = tmptype;\n\n    return(*status);\n}\n\n"},{"id":16695,"name":"modkey.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, modkey.c, contains routines that modify, insert, or update  */\n/*  keywords in a FITS header.                                             */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <string.h>\n/* stddef.h is apparently needed to define size_t */\n#include <ctype.h>\n#include <stddef.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n/*--------------------------------------------------------------------------*/\nint ffuky( fitsfile *fptr,     /* I - FITS file pointer        */\n           int  datatype,      /* I - datatype of the value    */\n           const char *keyname,/* I - name of keyword to write */\n           void *value,        /* I - keyword value            */\n           const char *comm,   /* I - keyword comment          */\n           int  *status)       /* IO - error status            */\n/*\n  Update the keyword, value and comment in the FITS header.\n  The datatype is specified by the 2nd argument.\n*/\n{\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (datatype == TSTRING)\n    {\n        ffukys(fptr, keyname, (char *) value, comm, status);\n    }\n    else if (datatype == TBYTE)\n    {\n        ffukyj(fptr, keyname, (LONGLONG) *(unsigned char *) value, comm, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n        ffukyj(fptr, keyname, (LONGLONG) *(signed char *) value, comm, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n        ffukyj(fptr, keyname, (LONGLONG) *(unsigned short *) value, comm, status);\n    }\n    else if (datatype == TSHORT)\n    {\n        ffukyj(fptr, keyname, (LONGLONG) *(short *) value, comm, status);\n    }\n    else if (datatype == TINT)\n    {\n        ffukyj(fptr, keyname, (LONGLONG) *(int *) value, comm, status);\n    }\n    else if (datatype == TUINT)\n    {\n        ffukyg(fptr, keyname, (double) *(unsigned int *) value, 0,\n               comm, status);\n    }\n    else if (datatype == TLOGICAL)\n    {\n        ffukyl(fptr, keyname, *(int *) value, comm, status);\n    }\n    else if (datatype == TULONG)\n    {\n        ffukyg(fptr, keyname, (double) *(unsigned long *) value, 0,\n               comm, status);\n    }\n    else if (datatype == TLONG)\n    {\n        ffukyj(fptr, keyname, (LONGLONG) *(long *) value, comm, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n        ffukyj(fptr, keyname, *(LONGLONG *) value, comm, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n        ffukye(fptr, keyname, *(float *) value, -7, comm, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n        ffukyd(fptr, keyname, *(double *) value, -15, comm, status);\n    }\n    else if (datatype == TCOMPLEX)\n    {\n        ffukyc(fptr, keyname, (float *) value, -7, comm, status);\n    }\n    else if (datatype == TDBLCOMPLEX)\n    {\n        ffukym(fptr, keyname, (double *) value, -15, comm, status);\n    }\n    else\n        *status = BAD_DATATYPE;\n\n    return(*status);\n} \n/*--------------------------------------------------------------------------*/\nint ffukyu(fitsfile *fptr,      /* I - FITS file pointer  */\n           const char *keyname, /* I - keyword name       */\n           const char *comm,    /* I - keyword comment    */\n           int *status)         /* IO - error status      */\n{\n    int tstatus;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    tstatus = *status;\n\n    if (ffmkyu(fptr, keyname, comm, status) == KEY_NO_EXIST)\n    {\n        *status = tstatus;\n        ffpkyu(fptr, keyname, comm, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffukys(fitsfile *fptr,       /* I - FITS file pointer  */\n           const char *keyname,  /* I - keyword name       */\n           const char *value,    /* I - keyword value      */\n           const char *comm,     /* I - keyword comment    */\n           int *status)          /* IO - error status      */ \n{\n    int tstatus;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    tstatus = *status;\n\n    if (ffmkys(fptr, keyname, value, comm, status) == KEY_NO_EXIST)\n    {\n        *status = tstatus;\n        ffpkys(fptr, keyname, value, comm, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffukls(fitsfile *fptr,      /* I - FITS file pointer  */\n           const char *keyname, /* I - keyword name       */\n           const char *value,   /* I - keyword value      */\n           const char *comm,    /* I - keyword comment    */\n           int *status)         /* IO - error status      */ \n{\n    /* update a long string keyword */\n\n    int tstatus;\n    char junk[FLEN_ERRMSG];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    tstatus = *status;\n\n    if (ffmkls(fptr, keyname, value, comm, status) == KEY_NO_EXIST)\n    {\n        /* since the ffmkls call failed, it wrote a bogus error message */\n        fits_read_errmsg(junk);  /* clear the error message */\n\t\n        *status = tstatus;\n        ffpkls(fptr, keyname, value, comm, status);\n    }\n    return(*status);\n}/*--------------------------------------------------------------------------*/\nint ffukyl(fitsfile *fptr,     /* I - FITS file pointer  */\n           const char *keyname,/* I - keyword name       */\n           int value,          /* I - keyword value      */\n           const char *comm,   /* I - keyword comment    */\n           int *status)        /* IO - error status      */\n{\n    int tstatus;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    tstatus = *status;\n\n    if (ffmkyl(fptr, keyname, value, comm, status) == KEY_NO_EXIST)\n    {\n        *status = tstatus;\n        ffpkyl(fptr, keyname, value, comm, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffukyj(fitsfile *fptr,     /* I - FITS file pointer  */\n           const char *keyname,/* I - keyword name       */\n           LONGLONG value,     /* I - keyword value      */\n           const char *comm,   /* I - keyword comment    */\n           int *status)        /* IO - error status      */\n{\n    int tstatus;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    tstatus = *status;\n\n    if (ffmkyj(fptr, keyname, value, comm, status) == KEY_NO_EXIST)\n    {\n        *status = tstatus;\n        ffpkyj(fptr, keyname, value, comm, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffukyf(fitsfile *fptr,     /* I - FITS file pointer  */\n           const char *keyname,/* I - keyword name       */\n           float value,        /* I - keyword value      */\n           int decim,          /* I - no of decimals     */         \n           const char *comm,   /* I - keyword comment    */\n           int *status)        /* IO - error status      */\n{\n    int tstatus;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    tstatus = *status;\n\n    if (ffmkyf(fptr, keyname, value, decim, comm, status) == KEY_NO_EXIST)\n    {\n        *status = tstatus;\n        ffpkyf(fptr, keyname, value, decim, comm, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffukye(fitsfile *fptr,     /* I - FITS file pointer  */\n           const char *keyname,/* I - keyword name       */\n           float value,        /* I - keyword value      */\n           int decim,          /* I - no of decimals     */\n           const char *comm,   /* I - keyword comment    */\n           int *status)        /* IO - error status      */\n{\n    int tstatus;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    tstatus = *status;\n\n    if (ffmkye(fptr, keyname, value, decim, comm, status) == KEY_NO_EXIST)\n    {\n        *status = tstatus;\n        ffpkye(fptr, keyname, value, decim, comm, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffukyg(fitsfile *fptr,     /* I - FITS file pointer  */\n           const char *keyname,/* I - keyword name       */\n           double value,       /* I - keyword value      */\n           int decim,          /* I - no of decimals     */\n           const char *comm,   /* I - keyword comment    */\n           int *status)        /* IO - error status      */\n{\n    int tstatus;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    tstatus = *status;\n\n    if (ffmkyg(fptr, keyname, value, decim, comm, status) == KEY_NO_EXIST)\n    {\n        *status = tstatus;\n        ffpkyg(fptr, keyname, value, decim, comm, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffukyd(fitsfile *fptr,     /* I - FITS file pointer  */\n           const char *keyname,/* I - keyword name       */\n           double value,       /* I - keyword value      */\n           int decim,          /* I - no of decimals     */\n           const char *comm,   /* I - keyword comment    */\n           int *status)        /* IO - error status      */\n{\n    int tstatus;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    tstatus = *status;\n\n    if (ffmkyd(fptr, keyname, value, decim, comm, status) == KEY_NO_EXIST)\n    {\n        *status = tstatus;\n        ffpkyd(fptr, keyname, value, decim, comm, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffukfc(fitsfile *fptr,     /* I - FITS file pointer  */\n           const char *keyname,/* I - keyword name       */\n           float *value,       /* I - keyword value      */\n           int decim,          /* I - no of decimals     */         \n           const char *comm,   /* I - keyword comment    */\n           int *status)        /* IO - error status      */\n{\n    int tstatus;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    tstatus = *status;\n\n    if (ffmkfc(fptr, keyname, value, decim, comm, status) == KEY_NO_EXIST)\n    {\n        *status = tstatus;\n        ffpkfc(fptr, keyname, value, decim, comm, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffukyc(fitsfile *fptr,     /* I - FITS file pointer  */\n           const char *keyname,/* I - keyword name       */\n           float *value,       /* I - keyword value      */\n           int decim,          /* I - no of decimals     */\n           const char *comm,   /* I - keyword comment    */\n           int *status)        /* IO - error status      */\n{\n    int tstatus;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    tstatus = *status;\n\n    if (ffmkyc(fptr, keyname, value, decim, comm, status) == KEY_NO_EXIST)\n    {\n        *status = tstatus;\n        ffpkyc(fptr, keyname, value, decim, comm, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffukfm(fitsfile *fptr,     /* I - FITS file pointer  */\n           const char *keyname,/* I - keyword name       */\n           double *value,      /* I - keyword value      */\n           int decim,          /* I - no of decimals     */\n           const char *comm,   /* I - keyword comment    */\n           int *status)        /* IO - error status      */\n{\n    int tstatus;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    tstatus = *status;\n\n    if (ffmkfm(fptr, keyname, value, decim, comm, status) == KEY_NO_EXIST)\n    {\n        *status = tstatus;\n        ffpkfm(fptr, keyname, value, decim, comm, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffukym(fitsfile *fptr,     /* I - FITS file pointer  */\n           const char *keyname,/* I - keyword name       */\n           double *value,      /* I - keyword value      */\n           int decim,          /* I - no of decimals     */\n           const char *comm,   /* I - keyword comment    */\n           int *status)        /* IO - error status      */\n{\n    int tstatus;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    tstatus = *status;\n\n    if (ffmkym(fptr, keyname, value, decim, comm, status) == KEY_NO_EXIST)\n    {\n        *status = tstatus;\n        ffpkym(fptr, keyname, value, decim, comm, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffucrd(fitsfile *fptr,     /* I - FITS file pointer  */\n           const char *keyname,/* I - keyword name       */\n           const char *card,   /* I - card string value  */\n           int *status)        /* IO - error status      */\n{\n    int tstatus;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    tstatus = *status;\n\n    if (ffmcrd(fptr, keyname, card, status) == KEY_NO_EXIST)\n    {\n        *status = tstatus;\n        ffprec(fptr, card, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmrec(fitsfile *fptr,    /* I - FITS file pointer               */\n           int nkey,          /* I - number of the keyword to modify */\n           const char *card,  /* I - card string value               */\n           int *status)       /* IO - error status                   */\n{\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffmaky(fptr, nkey+1, status);\n    ffmkey(fptr, card, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmcrd(fitsfile *fptr,      /* I - FITS file pointer  */\n           const char *keyname, /* I - keyword name       */\n           const char *card,    /* I - card string value  */\n           int *status)         /* IO - error status      */\n{\n    char tcard[FLEN_CARD], valstring[FLEN_CARD], comm[FLEN_CARD], value[FLEN_CARD];\n    char nextcomm[FLEN_COMMENT];\n    int keypos, len;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgcrd(fptr, keyname, tcard, status) > 0)\n        return(*status);\n\n    ffmkey(fptr, card, status);\n\n    /* calc position of keyword in header */\n    keypos = (int) ((((fptr->Fptr)->nextkey) - ((fptr->Fptr)->headstart[(fptr->Fptr)->curhdu])) / 80) + 1;\n\n    ffpsvc(tcard, valstring, comm, status);\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* check for string value which may be continued over multiple keywords */\n    ffpmrk(); /* put mark on message stack; erase any messages after this */\n    ffc2s(valstring, value, status);   /* remove quotes and trailing spaces */\n\n    if (*status == VALUE_UNDEFINED) {\n       ffcmrk();  /* clear any spurious error messages, back to the mark */\n       *status = 0;\n    } else {\n \n      len = strlen(value);\n\n      while (len && value[len - 1] == '&')  /* ampersand used as continuation char */\n      {\n        ffgcnt(fptr, value, nextcomm, status);\n        if (*value)\n        {\n            ffdrec(fptr, keypos, status);  /* delete the keyword */\n            len = strlen(value);\n        }\n        else   /* a null valstring indicates no continuation */\n            len = 0;\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmnam(fitsfile *fptr,     /* I - FITS file pointer     */\n           const char *oldname,/* I - existing keyword name */\n           const char *newname,/* I - new name for keyword  */\n           int *status)        /* IO - error status         */\n{\n    char comm[FLEN_COMMENT];\n    char value[FLEN_VALUE];\n    char card[FLEN_CARD];\n \n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgkey(fptr, oldname, value, comm, status) > 0)\n        return(*status);\n\n    ffmkky(newname, value, comm, card, status);  /* construct the card */\n    ffmkey(fptr, card, status);  /* rewrite with new name */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmcom(fitsfile *fptr,     /* I - FITS file pointer  */\n           const char *keyname,/* I - keyword name       */\n           const char *comm,   /* I - keyword comment    */\n           int *status)        /* IO - error status      */\n{\n    char oldcomm[FLEN_COMMENT];\n    char value[FLEN_VALUE];\n    char card[FLEN_CARD];\n \n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgkey(fptr, keyname, value, oldcomm, status) > 0)\n        return(*status);\n\n    ffmkky(keyname, value, comm, card, status);  /* construct the card */\n    ffmkey(fptr, card, status);  /* rewrite with new comment */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpunt(fitsfile *fptr,     /* I - FITS file pointer   */\n           const char *keyname,/* I - keyword name        */\n           const char *unit,   /* I - keyword unit string */\n           int *status)        /* IO - error status       */\n/*\n    Write (put) the units string into the comment field of the existing keyword.\n    This routine uses a  FITS convention  in which the units are enclosed in \n    square brackets following the '/' comment field delimiter, e.g.:\n\n    KEYWORD =                   12 / [kpc] comment string goes here\n*/\n{\n    char oldcomm[FLEN_COMMENT];\n    char newcomm[FLEN_COMMENT];\n    char value[FLEN_VALUE];\n    char card[FLEN_CARD];\n    char *loc;\n    size_t len;\n \n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgkey(fptr, keyname, value, oldcomm, status) > 0)\n        return(*status);\n\n    /* copy the units string to the new comment string if not null */\n    if (*unit)\n    {\n        strcpy(newcomm, \"[\");\n        strncat(newcomm, unit, 45);  /* max allowed length is about 45 chars */\n        strcat(newcomm, \"] \");\n        len = strlen(newcomm);  \n        len = FLEN_COMMENT - len - 1;  /* amount of space left in the field */\n    }\n    else\n    {\n        newcomm[0] = '\\0';\n        len = FLEN_COMMENT - 1;\n    }\n\n    if (oldcomm[0] == '[')  /* check for existing units field */\n    {\n        loc = strchr(oldcomm, ']');  /* look for the closing bracket */\n        if (loc)\n        {\n            loc++;\n            while (*loc == ' ')   /* skip any blank spaces */\n               loc++;\n\n            strncat(newcomm, loc, len);  /* concat remainder of comment */\n        }\n        else\n        {\n            strncat(newcomm, oldcomm, len);  /* append old comment onto new */\n        }\n    }\n    else\n    {\n        strncat(newcomm, oldcomm, len);\n    }\n\n    ffmkky(keyname, value, newcomm, card, status);  /* construct the card */\n    ffmkey(fptr, card, status);  /* rewrite with new units string */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmkyu(fitsfile *fptr,     /* I - FITS file pointer  */\n           const char *keyname,/* I - keyword name       */\n           const char *comm,   /* I - keyword comment    */\n           int *status)        /* IO - error status      */\n{\n    char valstring[FLEN_VALUE];\n    char oldcomm[FLEN_COMMENT];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0)\n        return(*status);                               /* get old comment */\n\n    strcpy(valstring,\" \");  /* create a dummy value string */\n\n    if (!comm || comm[0] == '&')  /* preserve the current comment string */\n        ffmkky(keyname, valstring, oldcomm, card, status);\n    else\n        ffmkky(keyname, valstring, comm, card, status);\n\n    ffmkey(fptr, card, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmkys(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           const char *value,       /* I - keyword value      */\n           const char *comm,        /* I - keyword comment    */\n           int *status)             /* IO - error status      */\n{\n  /* NOTE: This routine does not support long continued strings */\n  /*  It will correctly overwrite an existing long continued string, */\n  /*  but it will not write a new long string.  */\n\n    char oldval[FLEN_VALUE], valstring[FLEN_VALUE];\n    char oldcomm[FLEN_COMMENT];\n    char card[FLEN_CARD], nextcomm[FLEN_COMMENT];\n    int len, keypos;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgkey(fptr, keyname, oldval, oldcomm, status) > 0)\n        return(*status);                               /* get old comment */\n\n    ffs2c(value, valstring, status);   /* convert value to a string */\n\n    if (!comm || comm[0] == '&')  /* preserve the current comment string */\n        ffmkky(keyname, valstring, oldcomm, card, status);\n    else\n        ffmkky(keyname, valstring, comm, card, status);\n\n    ffmkey(fptr, card, status); /* overwrite the previous keyword */\n\n    keypos = (int) (((((fptr->Fptr)->nextkey) - ((fptr->Fptr)->headstart[(fptr->Fptr)->curhdu])) / 80) + 1);\n\n    if (*status > 0)           \n        return(*status);\n\n    /* check if old string value was continued over multiple keywords */\n    ffpmrk(); /* put mark on message stack; erase any messages after this */\n    ffc2s(oldval, valstring, status); /* remove quotes and trailing spaces */\n\n    if (*status == VALUE_UNDEFINED) {\n       ffcmrk();  /* clear any spurious error messages, back to the mark */\n       *status = 0;\n    } else {\n        \n      len = strlen(valstring);\n\n      while (len && valstring[len - 1] == '&')  /* ampersand is continuation char */\n      {\n        ffgcnt(fptr, valstring, nextcomm, status);\n        if (*valstring)\n        {\n            ffdrec(fptr, keypos, status);  /* delete the continuation */\n            len = strlen(valstring);\n        }\n        else   /* a null valstring indicates no continuation */\n            len = 0;\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmkls( fitsfile *fptr,           /* I - FITS file pointer        */\n            const char *keyname,      /* I - name of keyword to write */\n            const char *value,        /* I - keyword value            */\n            const char *incomm,       /* I - keyword comment          */\n            int  *status)             /* IO - error status            */\n/*\n  Modify the value and optionally the comment of a long string keyword.\n  This routine supports the\n  HEASARC long string convention and can modify arbitrarily long string\n  keyword values.  The value is continued over multiple keywords that\n  have the name COMTINUE without an equal sign in column 9 of the card.\n  This routine also supports simple string keywords which are less than\n  69 characters in length.\n\n  This routine is not very efficient, so it should be used sparingly.\n*/\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD], tmpkeyname[FLEN_CARD];\n    char comm[FLEN_COMMENT];\n    char tstring[FLEN_VALUE], *cptr;\n    char *longval;\n    int next, remain, vlen, nquote, nchar, namelen, contin, tstatus = -1;\n    int nkeys, keypos;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (!incomm || incomm[0] == '&')  /* preserve the old comment string */\n    {\n        ffghps(fptr, &nkeys, &keypos, status); /* save current position */\n\n        if (ffgkls(fptr, keyname, &longval, comm, status) > 0)\n            return(*status);            /* keyword doesn't exist */\n\n        free(longval);  /* don't need the old value */\n\n        /* move back to previous position to ensure that we delete */\n        /* the right keyword in case there are more than one keyword */\n        /* with this same name. */\n        ffgrec(fptr, keypos - 1, card, status); \n    } else {\n        /* copy the input comment string */\n        strncpy(comm, incomm, FLEN_COMMENT-1);\n        comm[FLEN_COMMENT-1] = '\\0';\n    }\n\n    /* delete the old keyword */\n    if (ffdkey(fptr, keyname, status) > 0)\n        return(*status);            /* keyword doesn't exist */\n\n    ffghps(fptr, &nkeys, &keypos, status); /* save current position */\n\n    /* now construct the new keyword, and insert into header */\n    remain = strlen(value);    /* number of characters to write out */\n    next = 0;                  /* pointer to next character to write */\n    \n    /* count the number of single quote characters in the string */\n    nquote = 0;\n    cptr = strchr(value, '\\'');   /* search for quote character */\n\n    while (cptr)  /* search for quote character */\n    {\n        nquote++;            /*  increment no. of quote characters  */\n        cptr++;              /*  increment pointer to next character */\n        cptr = strchr(cptr, '\\'');  /* search for another quote char */\n    }\n\n    strncpy(tmpkeyname, keyname, 80);\n    tmpkeyname[80] = '\\0';\n    \n    cptr = tmpkeyname;\n    while(*cptr == ' ')   /* skip over leading spaces in name */\n        cptr++;\n\n    /* determine the number of characters that will fit on the line */\n    /* Note: each quote character is expanded to 2 quotes */\n\n    namelen = strlen(cptr);\n    if (namelen <= 8 && (fftkey(cptr, &tstatus) <= 0) )\n    {\n        /* This a normal 8-character FITS keyword */\n        nchar = 68 - nquote; /*  max of 68 chars fit in a FITS string value */\n    }\n    else\n    {\n\tnchar = 80 - nquote - namelen - 5;\n    }\n\n    contin = 0;\n    while (remain > 0)\n    {\n        if (nchar > FLEN_VALUE-1)\n        {\n           ffpmsg(\"longstr keyword value is too long (ffmkls)\");\n           return (*status=BAD_KEYCHAR);\n        }\n        strncpy(tstring, &value[next], nchar); /* copy string to temp buff */\n        tstring[nchar] = '\\0';\n        ffs2c(tstring, valstring, status);  /* put quotes around the string */\n\n        if (remain > nchar)   /* if string is continued, put & as last char */\n        {\n            vlen = strlen(valstring);\n            nchar -= 1;        /* outputting one less character now */\n\n            if (valstring[vlen-2] != '\\'')\n                valstring[vlen-2] = '&';  /*  over write last char with &  */\n            else\n            { /* last char was a pair of single quotes, so over write both */\n                valstring[vlen-3] = '&';\n                valstring[vlen-1] = '\\0';\n            }\n        }\n\n        if (contin)           /* This is a CONTINUEd keyword */\n        {\n           ffmkky(\"CONTINUE\", valstring, comm, card, status); /* make keyword */\n           strncpy(&card[8], \"   \",  2);  /* overwrite the '=' */\n        }\n        else\n        {\n           ffmkky(keyname, valstring, comm, card, status);  /* make keyword */\n        }\n\n        ffirec(fptr, keypos, card, status);  /* insert the keyword */\n       \n        keypos++;        /* next insert position */\n        contin = 1;\n        remain -= nchar;\n        next  += nchar;\n        nchar = 68 - nquote;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmkyl(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           int value,               /* I - keyword value      */\n           const char *comm,        /* I - keyword comment    */\n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE];\n    char oldcomm[FLEN_COMMENT];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0)\n        return(*status);                               /* get old comment */\n\n    ffl2c(value, valstring, status);   /* convert value to a string */\n\n    if (!comm || comm[0] == '&')  /* preserve the current comment string */\n        ffmkky(keyname, valstring, oldcomm, card, status);\n    else\n        ffmkky(keyname, valstring, comm, card, status);\n\n    ffmkey(fptr, card, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmkyj(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           LONGLONG value,          /* I - keyword value      */\n           const char *comm,        /* I - keyword comment    */\n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE];\n    char oldcomm[FLEN_COMMENT];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0)\n        return(*status);                               /* get old comment */\n\n    ffi2c(value, valstring, status);   /* convert value to a string */\n\n    if (!comm || comm[0] == '&')  /* preserve the current comment string */\n        ffmkky(keyname, valstring, oldcomm, card, status);\n    else\n        ffmkky(keyname, valstring, comm, card, status);\n\n    ffmkey(fptr, card, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmkyf(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           float value,             /* I - keyword value      */\n           int decim,               /* I - no of decimals     */\n           const char *comm,        /* I - keyword comment    */\n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE];\n    char oldcomm[FLEN_COMMENT];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0)\n        return(*status);                               /* get old comment */\n\n    ffr2f(value, decim, valstring, status);   /* convert value to a string */\n\n    if (!comm || comm[0] == '&')  /* preserve the current comment string */\n        ffmkky(keyname, valstring, oldcomm, card, status);\n    else\n        ffmkky(keyname, valstring, comm, card, status);\n\n    ffmkey(fptr, card, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmkye(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           float value,             /* I - keyword value      */\n           int decim,               /* I - no of decimals     */\n           const char *comm,        /* I - keyword comment    */\n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE];\n    char oldcomm[FLEN_COMMENT];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0)\n        return(*status);                               /* get old comment */\n\n    ffr2e(value, decim, valstring, status);   /* convert value to a string */\n\n    if (!comm || comm[0] == '&')  /* preserve the current comment string */\n        ffmkky(keyname, valstring, oldcomm, card, status);\n    else\n        ffmkky(keyname, valstring, comm, card, status);\n\n    ffmkey(fptr, card, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmkyg(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           double value,            /* I - keyword value      */\n           int decim,               /* I - no of decimals     */\n           const char *comm,        /* I - keyword comment    */\n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE];\n    char oldcomm[FLEN_COMMENT];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0)\n        return(*status);                               /* get old comment */\n\n    ffd2f(value, decim, valstring, status);   /* convert value to a string */\n\n    if (!comm || comm[0] == '&')  /* preserve the current comment string */\n        ffmkky(keyname, valstring, oldcomm, card, status);\n    else\n        ffmkky(keyname, valstring, comm, card, status);\n\n    ffmkey(fptr, card, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmkyd(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           double value,            /* I - keyword value      */\n           int decim,               /* I - no of decimals     */\n           const char *comm,        /* I - keyword comment    */\n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE];\n    char oldcomm[FLEN_COMMENT];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0)\n        return(*status);                               /* get old comment */\n\n    ffd2e(value, decim, valstring, status);   /* convert value to a string */\n\n    if (!comm || comm[0] == '&')  /* preserve the current comment string */\n        ffmkky(keyname, valstring, oldcomm, card, status);\n    else\n        ffmkky(keyname, valstring, comm, card, status);\n\n    ffmkey(fptr, card, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmkfc(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           float *value,            /* I - keyword value      */\n           int decim,               /* I - no of decimals     */\n           const char *comm,        /* I - keyword comment    */\n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE];\n    char oldcomm[FLEN_COMMENT];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0)\n        return(*status);                               /* get old comment */\n\n    strcpy(valstring, \"(\" );\n    ffr2f(value[0], decim, tmpstring, status); /* convert to string */\n    if (strlen(tmpstring)+3 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"complex key value too long (ffmkfc)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffr2f(value[1], decim, tmpstring, status); /* convert to string */\n    if (strlen(valstring) + strlen(tmpstring)+1 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"complex key value too long (ffmkfc)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \")\");\n\n    if (!comm || comm[0] == '&')  /* preserve the current comment string */\n        ffmkky(keyname, valstring, oldcomm, card, status);\n    else\n        ffmkky(keyname, valstring, comm, card, status);\n\n    ffmkey(fptr, card, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmkyc(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           float *value,            /* I - keyword value      */\n           int decim,               /* I - no of decimals     */\n           const char *comm,        /* I - keyword comment    */\n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE];\n    char oldcomm[FLEN_COMMENT];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0)\n        return(*status);                               /* get old comment */\n\n    strcpy(valstring, \"(\" );\n    ffr2e(value[0], decim, tmpstring, status); /* convert to string */\n    if (strlen(tmpstring)+3 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"complex key value too long (ffmkyc)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffr2e(value[1], decim, tmpstring, status); /* convert to string */\n    if (strlen(valstring) + strlen(tmpstring)+1 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"complex key value too long (ffmkyc)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \")\");\n\n    if (!comm || comm[0] == '&')  /* preserve the current comment string */\n        ffmkky(keyname, valstring, oldcomm, card, status);\n    else\n        ffmkky(keyname, valstring, comm, card, status);\n\n    ffmkey(fptr, card, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmkfm(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           double *value,           /* I - keyword value      */\n           int decim,               /* I - no of decimals     */\n           const char *comm,        /* I - keyword comment    */\n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE];\n    char oldcomm[FLEN_COMMENT];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0)\n        return(*status);                               /* get old comment */\n\n    strcpy(valstring, \"(\" );\n    ffd2f(value[0], decim, tmpstring, status); /* convert to string */\n    if (strlen(tmpstring)+3 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"complex key value too long (ffmkfm)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffd2f(value[1], decim, tmpstring, status); /* convert to string */\n    if (strlen(valstring) + strlen(tmpstring)+1 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"complex key value too long (ffmkfm)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \")\");\n\n    if (!comm || comm[0] == '&')  /* preserve the current comment string */\n        ffmkky(keyname, valstring, oldcomm, card, status);\n    else\n        ffmkky(keyname, valstring, comm, card, status);\n\n    ffmkey(fptr, card, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmkym(fitsfile *fptr,    /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           double *value,     /* I - keyword value      */\n           int decim,         /* I - no of decimals     */\n           const char *comm,        /* I - keyword comment    */\n           int *status)       /* IO - error status      */\n{\n    char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE];\n    char oldcomm[FLEN_COMMENT];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0)\n        return(*status);                               /* get old comment */\n\n    strcpy(valstring, \"(\" );\n    ffd2e(value[0], decim, tmpstring, status); /* convert to string */\n    if (strlen(tmpstring)+3 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"complex key value too long (ffmkym)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffd2e(value[1], decim, tmpstring, status); /* convert to string */\n    if (strlen(valstring) + strlen(tmpstring)+1 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"complex key value too long (ffmkym)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \")\");\n\n    if (!comm || comm[0] == '&')  /* preserve the current comment string */\n        ffmkky(keyname, valstring, oldcomm, card, status);\n    else\n        ffmkky(keyname, valstring, comm, card, status);\n\n    ffmkey(fptr, card, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffikyu(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           const char *comm,        /* I - keyword comment    */\n           int *status)             /* IO - error status      */\n/*\n  Insert a null-valued keyword and comment into the FITS header.  \n*/\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    strcpy(valstring,\" \");  /* create a dummy value string */\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffikey(fptr, card, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffikys(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           const char *value,       /* I - keyword value      */\n           const char *comm,        /* I - keyword comment    */\n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffs2c(value, valstring, status);   /* put quotes around the string */\n\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffikey(fptr, card, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffikls( fitsfile *fptr,           /* I - FITS file pointer        */\n            const char *keyname,      /* I - name of keyword to write */\n            const char *value,        /* I - keyword value            */\n            const char *comm,         /* I - keyword comment          */\n            int  *status)             /* IO - error status            */\n/*\n  Insert a long string keyword.  This routine supports the\n  HEASARC long string convention and can insert arbitrarily long string\n  keyword values.  The value is continued over multiple keywords that\n  have the name COMTINUE without an equal sign in column 9 of the card.\n  This routine also supports simple string keywords which are less than\n  69 characters in length.\n*/\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD], tmpkeyname[FLEN_CARD];\n    char tstring[FLEN_VALUE], *cptr;\n    int next, remain, vlen, nquote, nchar, namelen, contin, tstatus = -1;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /*  construct the new keyword, and insert into header */\n    remain = strlen(value);    /* number of characters to write out */\n    next = 0;                  /* pointer to next character to write */\n    \n    /* count the number of single quote characters in the string */\n    nquote = 0;\n    cptr = strchr(value, '\\'');   /* search for quote character */\n\n    while (cptr)  /* search for quote character */\n    {\n        nquote++;            /*  increment no. of quote characters  */\n        cptr++;              /*  increment pointer to next character */\n        cptr = strchr(cptr, '\\'');  /* search for another quote char */\n    }\n\n\n    strncpy(tmpkeyname, keyname, 80);\n    tmpkeyname[80] = '\\0';\n    \n    cptr = tmpkeyname;\n    while(*cptr == ' ')   /* skip over leading spaces in name */\n        cptr++;\n\n    /* determine the number of characters that will fit on the line */\n    /* Note: each quote character is expanded to 2 quotes */\n\n    namelen = strlen(cptr);\n    if (namelen <= 8 && (fftkey(cptr, &tstatus) <= 0) )\n    {\n        /* This a normal 8-character FITS keyword */\n        nchar = 68 - nquote; /*  max of 68 chars fit in a FITS string value */\n    }\n    else\n    {\n\tnchar = 80 - nquote - namelen - 5;\n    }\n\n    contin = 0;\n    while (remain > 0)\n    {\n        if (nchar > FLEN_VALUE-1)\n        {\n           ffpmsg(\"longstr keyword value is too long (ffikls)\");\n           return (*status=BAD_KEYCHAR);\n        }\n        strncpy(tstring, &value[next], nchar); /* copy string to temp buff */\n        tstring[nchar] = '\\0';\n        ffs2c(tstring, valstring, status);  /* put quotes around the string */\n\n        if (remain > nchar)   /* if string is continued, put & as last char */\n        {\n            vlen = strlen(valstring);\n            nchar -= 1;        /* outputting one less character now */\n\n            if (valstring[vlen-2] != '\\'')\n                valstring[vlen-2] = '&';  /*  over write last char with &  */\n            else\n            { /* last char was a pair of single quotes, so over write both */\n                valstring[vlen-3] = '&';\n                valstring[vlen-1] = '\\0';\n            }\n        }\n\n        if (contin)           /* This is a CONTINUEd keyword */\n        {\n           ffmkky(\"CONTINUE\", valstring, comm, card, status); /* make keyword */\n           strncpy(&card[8], \"   \",  2);  /* overwrite the '=' */\n        }\n        else\n        {\n           ffmkky(keyname, valstring, comm, card, status);  /* make keyword */\n        }\n\n        ffikey(fptr, card, status);  /* insert the keyword */\n       \n        contin = 1;\n        remain -= nchar;\n        next  += nchar;\n        nchar = 68 - nquote;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffikyl(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           int value,               /* I - keyword value      */\n           const char *comm,        /* I - keyword comment    */\n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffl2c(value, valstring, status);   /* convert logical to 'T' or 'F' */\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffikey(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffikyj(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           LONGLONG value,          /* I - keyword value      */\n           const char *comm,        /* I - keyword comment    */\n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffi2c(value, valstring, status);   /* convert to formatted string */\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffikey(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffikyf(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           float value,             /* I - keyword value      */\n           int decim,               /* I - no of decimals     */\n           const char *comm,        /* I - keyword comment    */ \n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffr2f(value, decim, valstring, status);   /* convert to formatted string */\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffikey(fptr, card, status);  /* write the keyword*/\n\n    return(*status); \n}\n/*--------------------------------------------------------------------------*/\nint ffikye(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           float value,             /* I - keyword value      */\n           int decim,               /* I - no of decimals     */\n           const char *comm,        /* I - keyword comment    */ \n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffr2e(value, decim, valstring, status);   /* convert to formatted string */\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffikey(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffikyg(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           double value,            /* I - keyword value      */\n           int decim,               /* I - no of decimals     */\n           const char *comm,        /* I - keyword comment    */ \n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffd2f(value, decim, valstring, status);   /* convert to formatted string */\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffikey(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffikyd(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           double value,            /* I - keyword value      */\n           int decim,               /* I - no of decimals     */\n           const char *comm,        /* I - keyword comment    */ \n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffd2e(value, decim, valstring, status);   /* convert to formatted string */\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffikey(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffikfc(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           float *value,            /* I - keyword value      */\n           int decim,               /* I - no of decimals     */\n           const char *comm,        /* I - keyword comment    */ \n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    strcpy(valstring, \"(\" );\n    ffr2f(value[0], decim, tmpstring, status); /* convert to string */\n    if (strlen(tmpstring)+3 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"complex key value too long (ffikfc)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffr2f(value[1], decim, tmpstring, status); /* convert to string */\n    if (strlen(valstring) + strlen(tmpstring)+1 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"complex key value too long (ffikfc)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \")\");\n\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffikey(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffikyc(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           float *value,            /* I - keyword value      */\n           int decim,               /* I - no of decimals     */\n           const char *comm,        /* I - keyword comment    */ \n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    strcpy(valstring, \"(\" );\n    ffr2e(value[0], decim, tmpstring, status); /* convert to string */\n    if (strlen(tmpstring)+3 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"complex key value too long (ffikyc)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffr2e(value[1], decim, tmpstring, status); /* convert to string */\n    if (strlen(valstring) + strlen(tmpstring)+1 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"complex key value too long (ffikyc)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \")\");\n\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffikey(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffikfm(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           double *value,           /* I - keyword value      */\n           int decim,               /* I - no of decimals     */\n           const char *comm,        /* I - keyword comment    */ \n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n\n    strcpy(valstring, \"(\" );\n    ffd2f(value[0], decim, tmpstring, status); /* convert to string */\n    if (strlen(tmpstring)+3 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"complex key value too long (ffikfm)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffd2f(value[1], decim, tmpstring, status); /* convert to string */\n    if (strlen(valstring) + strlen(tmpstring)+1 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"complex key value too long (ffikfm)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \")\");\n\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffikey(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffikym(fitsfile *fptr,          /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           double *value,           /* I - keyword value      */\n           int decim,               /* I - no of decimals     */\n           const char *comm,        /* I - keyword comment    */ \n           int *status)             /* IO - error status      */\n{\n    char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    strcpy(valstring, \"(\" );\n    ffd2e(value[0], decim, tmpstring, status); /* convert to string */\n    if (strlen(tmpstring)+3 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"complex key value too long (ffikym)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffd2e(value[1], decim, tmpstring, status); /* convert to string */\n    if (strlen(valstring) + strlen(tmpstring)+1 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"complex key value too long (ffikym)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \")\");\n\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffikey(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffirec(fitsfile *fptr,    /* I - FITS file pointer              */\n           int nkey,          /* I - position to insert new keyword */\n           const char *card,  /* I - card string value              */\n           int *status)       /* IO - error status                  */\n{\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffmaky(fptr, nkey, status);  /* move to insert position */\n    ffikey(fptr, card, status);  /* insert the keyword card */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffikey(fitsfile *fptr,    /* I - FITS file pointer  */\n           const char *card,  /* I - card string value  */\n           int *status)       /* IO - error status      */\n/*\n  insert a keyword at the position of (fptr->Fptr)->nextkey\n*/\n{\n    int ii, len, nshift, keylength;\n    long nblocks;\n    LONGLONG bytepos;\n    char *inbuff, *outbuff, *tmpbuff, buff1[FLEN_CARD], buff2[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if ( ((fptr->Fptr)->datastart - (fptr->Fptr)->headend) == 80) /* only room for END card */\n    {\n        nblocks = 1;\n        if (ffiblk(fptr, nblocks, 0, status) > 0) /* add new 2880-byte block*/\n            return(*status);  \n    }\n\n    /* no. keywords to shift */\n    nshift= (int) (( (fptr->Fptr)->headend - (fptr->Fptr)->nextkey ) / 80); \n\n    strncpy(buff2, card, 80);     /* copy card to output buffer */\n    buff2[80] = '\\0';\n\n    len = strlen(buff2);\n\n    /* silently replace any illegal characters with a space */\n    for (ii=0; ii < len; ii++)   \n        if (buff2[ii] < ' ' || buff2[ii] > 126) buff2[ii] = ' ';\n\n    for (ii=len; ii < 80; ii++)   /* fill buffer with spaces if necessary */\n        buff2[ii] = ' ';\n\n    keylength = strcspn(buff2, \"=\");\n    if (keylength == 80) keylength = 8;\n    \n    /* test for the common commentary keywords which by definition have 8-char names */\n    if ( !fits_strncasecmp( \"COMMENT \", buff2, 8) || !fits_strncasecmp( \"HISTORY \", buff2, 8) ||\n         !fits_strncasecmp( \"        \", buff2, 8) || !fits_strncasecmp( \"CONTINUE\", buff2, 8) )\n\t keylength = 8;\n\n    for (ii=0; ii < keylength; ii++)       /* make sure keyword name is uppercase */\n        buff2[ii] = toupper(buff2[ii]);\n\n    fftkey(buff2, status);        /* test keyword name contains legal chars */\n\n/*  no need to do this any more, since any illegal characters have been removed\n    fftrec(buff2, status);  */      /* test rest of keyword for legal chars   */\n\n    inbuff = buff1;\n    outbuff = buff2;\n\n    bytepos = (fptr->Fptr)->nextkey;           /* pointer to next keyword in header */\n    ffmbyt(fptr, bytepos, REPORT_EOF, status);\n\n    for (ii = 0; ii < nshift; ii++) /* shift each keyword down one position */\n    {\n        ffgbyt(fptr, 80, inbuff, status);   /* read the current keyword */\n\n        ffmbyt(fptr, bytepos, REPORT_EOF, status); /* move back */\n        ffpbyt(fptr, 80, outbuff, status);  /* overwrite with other buffer */\n\n        tmpbuff = inbuff;   /* swap input and output buffers */\n        inbuff = outbuff;\n        outbuff = tmpbuff;\n\n        bytepos += 80;\n    }\n\n    ffpbyt(fptr, 80, outbuff, status);  /* write the final keyword */\n\n    (fptr->Fptr)->headend += 80; /* increment the position of the END keyword */\n    (fptr->Fptr)->nextkey += 80; /* increment the pointer to next keyword */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffdkey(fitsfile *fptr,    /* I - FITS file pointer  */\n           const char *keyname,     /* I - keyword name       */\n           int *status)       /* IO - error status      */\n/*\n  delete a specified header keyword\n*/\n{\n    int keypos, len;\n    char valstring[FLEN_VALUE], comm[FLEN_COMMENT], value[FLEN_VALUE];\n    char message[FLEN_ERRMSG], nextcomm[FLEN_COMMENT];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgkey(fptr, keyname, valstring, comm, status) > 0) /* read keyword */\n    {\n        snprintf(message, FLEN_ERRMSG,\"Could not find the %s keyword to delete (ffdkey)\",\n                keyname);\n        ffpmsg(message);\n        return(*status);\n    }\n\n    /* calc position of keyword in header */\n    keypos = (int) ((((fptr->Fptr)->nextkey) - ((fptr->Fptr)->headstart[(fptr->Fptr)->curhdu])) / 80);\n\n    ffdrec(fptr, keypos, status);  /* delete the keyword */\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* check for string value which may be continued over multiple keywords */\n    ffpmrk(); /* put mark on message stack; erase any messages after this */\n    ffc2s(valstring, value, status);   /* remove quotes and trailing spaces */\n\n    if (*status == VALUE_UNDEFINED) {\n       ffcmrk();  /* clear any spurious error messages, back to the mark */\n       *status = 0;\n    } else {\n \n      len = strlen(value);\n\n      while (len && value[len - 1] == '&')  /* ampersand used as continuation char */\n      {\n        ffgcnt(fptr, value, nextcomm, status);\n        if (*value)\n        {\n            ffdrec(fptr, keypos, status);  /* delete the keyword */\n            len = strlen(value);\n        }\n        else   /* a null valstring indicates no continuation */\n            len = 0;\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffdstr(fitsfile *fptr,    /* I - FITS file pointer  */\n           const char *string,     /* I - keyword name       */\n           int *status)       /* IO - error status      */\n/*\n  delete a specified header keyword containing the input string\n*/\n{\n    int keypos, len;\n    char valstring[FLEN_VALUE], comm[FLEN_COMMENT], value[FLEN_VALUE];\n    char card[FLEN_CARD], message[FLEN_ERRMSG], nextcomm[FLEN_COMMENT];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (ffgstr(fptr, string, card, status) > 0) /* read keyword */\n    {\n        snprintf(message, FLEN_ERRMSG,\"Could not find the %s keyword to delete (ffdkey)\",\n                string);\n        ffpmsg(message);\n        return(*status);\n    }\n\n    /* calc position of keyword in header */\n    keypos = (int) ((((fptr->Fptr)->nextkey) - ((fptr->Fptr)->headstart[(fptr->Fptr)->curhdu])) / 80);\n\n    ffdrec(fptr, keypos, status);  /* delete the keyword */\n\n    /* check for string value which may be continued over multiple keywords */\n    ffpsvc(card, valstring, comm, status);\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* check for string value which may be continued over multiple keywords */\n    ffpmrk(); /* put mark on message stack; erase any messages after this */\n    ffc2s(valstring, value, status);   /* remove quotes and trailing spaces */\n\n    if (*status == VALUE_UNDEFINED) {\n       ffcmrk();  /* clear any spurious error messages, back to the mark */\n       *status = 0;\n    } else {\n \n      len = strlen(value);\n\n      while (len && value[len - 1] == '&')  /* ampersand used as continuation char */\n      {\n        ffgcnt(fptr, value, nextcomm, status);\n        if (*value)\n        {\n            ffdrec(fptr, keypos, status);  /* delete the keyword */\n            len = strlen(value);\n        }\n        else   /* a null valstring indicates no continuation */\n            len = 0;\n      }\n    }\n\n    return(*status);\n}/*--------------------------------------------------------------------------*/\nint ffdrec(fitsfile *fptr,   /* I - FITS file pointer  */\n           int keypos,       /* I - position in header of keyword to delete */\n           int *status)      /* IO - error status      */\n/*\n  Delete a header keyword at position keypos. The 1st keyword is at keypos=1.\n*/\n{\n    int ii, nshift;\n    LONGLONG bytepos;\n    char *inbuff, *outbuff, *tmpbuff, buff1[81], buff2[81];\n    char message[FLEN_ERRMSG];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if (keypos < 1 ||\n        keypos > (fptr->Fptr)->headend - (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] / 80 )\n        return(*status = KEY_OUT_BOUNDS);\n\n    (fptr->Fptr)->nextkey = (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] + (keypos - 1) * 80;\n\n    nshift=(int) (( (fptr->Fptr)->headend - (fptr->Fptr)->nextkey ) / 80); /* no. keywords to shift */\n\n    if (nshift <= 0)\n    {\n        snprintf(message, FLEN_ERRMSG,\"Cannot delete keyword number %d.  It does not exist.\",\n                keypos);\n        ffpmsg(message);\n        return(*status = KEY_OUT_BOUNDS);\n    }\n\n    bytepos = (fptr->Fptr)->headend - 80;  /* last keyword in header */  \n\n    /* construct a blank keyword */\n    strcpy(buff2, \"                                        \");\n    strcat(buff2, \"                                        \");\n    inbuff  = buff1;\n    outbuff = buff2;\n    for (ii = 0; ii < nshift; ii++) /* shift each keyword up one position */\n    {\n\n        ffmbyt(fptr, bytepos, REPORT_EOF, status);\n        ffgbyt(fptr, 80, inbuff, status);   /* read the current keyword */\n\n        ffmbyt(fptr, bytepos, REPORT_EOF, status);\n        ffpbyt(fptr, 80, outbuff, status);  /* overwrite with next keyword */\n\n        tmpbuff = inbuff;   /* swap input and output buffers */\n        inbuff = outbuff;\n        outbuff = tmpbuff;\n\n        bytepos -= 80;\n    }\n\n    (fptr->Fptr)->headend -= 80; /* decrement the position of the END keyword */\n    return(*status);\n}\n\n"},{"id":16696,"name":"getkey.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, getkey.c, contains routines that read keywords from         */\n/*  a FITS header.                                                         */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <string.h>\n#include <limits.h>\n#include <stdlib.h>\n#include <ctype.h>\n/* stddef.h is apparently needed to define size_t */\n#include <stddef.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffghsp(fitsfile *fptr,  /* I - FITS file pointer                     */\n           int *nexist,     /* O - number of existing keywords in header */\n           int *nmore,      /* O - how many more keywords will fit       */\n           int *status)     /* IO - error status                         */\n/*\n  returns the number of existing keywords (not counting the END keyword)\n  and the number of more keyword that will fit in the current header \n  without having to insert more FITS blocks.\n*/\n{\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if (nexist)\n        *nexist = (int) (( ((fptr->Fptr)->headend) - \n                ((fptr->Fptr)->headstart[(fptr->Fptr)->curhdu]) ) / 80);\n\n    if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n      if (nmore)\n        *nmore = -1;   /* data not written yet, so room for any keywords */\n    }\n    else\n    {\n      /* calculate space available between the data and the END card */\n      if (nmore)\n        *nmore = (int) (((fptr->Fptr)->datastart - (fptr->Fptr)->headend) / 80 - 1);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffghps(fitsfile *fptr, /* I - FITS file pointer                     */\n          int *nexist,     /* O - number of existing keywords in header */\n          int *position,   /* O - position of next keyword to be read   */\n          int *status)     /* IO - error status                         */\n/*\n  return the number of existing keywords and the position of the next\n  keyword that will be read.\n*/\n{\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if (nexist)\n      *nexist = (int) (( ((fptr->Fptr)->headend) - ((fptr->Fptr)->headstart[(fptr->Fptr)->curhdu]) ) / 80);\n\n    if (position)\n      *position = (int) (( ((fptr->Fptr)->nextkey) - ((fptr->Fptr)->headstart[(fptr->Fptr)->curhdu]) ) / 80 + 1);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffnchk(fitsfile *fptr,  /* I - FITS file pointer                     */\n           int *status)     /* IO - error status                         */\n/*\n  function returns the position of the first null character (ASCII 0), if\n  any, in the current header.  Null characters are illegal, but the other\n  CFITSIO routines that read the header will not detect this error, because\n  the null gets interpreted as a normal end of string character.\n*/\n{\n    long ii, nblock;\n    LONGLONG bytepos;\n    int length, nullpos;\n    char block[2881];\n    \n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        return(0);  /* Don't check a file that is just being created.  */\n                    /* It cannot contain nulls since CFITSIO wrote it. */\n    }\n    else\n    {\n        /* calculate number of blocks in the header */\n        nblock = (long) (( (fptr->Fptr)->datastart - \n                   (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] ) / 2880);\n    }\n\n    bytepos = (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu];\n    ffmbyt(fptr, bytepos, REPORT_EOF, status);  /* move to read pos. */\n\n    block[2880] = '\\0';\n    for (ii = 0; ii < nblock; ii++)\n    {\n        if (ffgbyt(fptr, 2880, block, status) > 0)\n            return(0);   /* read error of some sort */\n\n        length = strlen(block);\n        if (length != 2880)\n        {\n            nullpos = (ii * 2880) + length + 1;\n            return(nullpos);\n        }\n    }\n\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint ffmaky(fitsfile *fptr,    /* I - FITS file pointer                    */\n          int nrec,           /* I - one-based keyword number to move to  */\n          int *status)        /* IO - error status                        */\n{\n/*\n  move pointer to the specified absolute keyword position.  E.g. this keyword \n  will then be read by the next call to ffgnky.\n*/\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    (fptr->Fptr)->nextkey = (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] + ( (nrec - 1) * 80);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffmrky(fitsfile *fptr,    /* I - FITS file pointer                   */\n          int nmove,          /* I - relative number of keywords to move */\n          int *status)        /* IO - error status                       */\n{\n/*\n  move pointer to the specified keyword position relative to the current\n  position.  E.g. this keyword  will then be read by the next call to ffgnky.\n*/\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    (fptr->Fptr)->nextkey += (nmove * 80);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgnky(fitsfile *fptr,  /* I - FITS file pointer     */\n           char *card,      /* O - card string           */\n           int *status)     /* IO - error status         */\n/*\n  read the next keyword from the header - used internally by cfitsio\n*/\n{\n    int jj, nrec;\n    LONGLONG bytepos, endhead;\n    char message[FLEN_ERRMSG];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    card[0] = '\\0';  /* make sure card is terminated, even affer read error */\n\n/*\n  Check that nextkey points to a legal keyword position.  Note that headend\n  is the current end of the header, i.e., the position where a new keyword\n  would be appended, however, if there are more than 1 FITS block worth of\n  blank keywords at the end of the header (36 keywords per 2880 byte block)\n  then the actual physical END card must be located at a starting position\n  which is just 2880 bytes prior to the start of the data unit.\n*/\n\n    bytepos = (fptr->Fptr)->nextkey;\n    endhead = maxvalue( ((fptr->Fptr)->headend), ((fptr->Fptr)->datastart - 2880) );\n\n    /* nextkey must be < endhead and > than  headstart */\n    if (bytepos > endhead ||  \n        bytepos < (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] ) \n    {\n        nrec= (int) ((bytepos - (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu]) / 80 + 1);\n        snprintf(message, FLEN_ERRMSG,\"Cannot get keyword number %d.  It does not exist.\",\n                nrec);\n        ffpmsg(message);\n        return(*status = KEY_OUT_BOUNDS);\n    }\n      \n    ffmbyt(fptr, bytepos, REPORT_EOF, status);  /* move to read pos. */\n\n    card[80] = '\\0';  /* make sure card is terminate, even if ffgbyt fails */\n\n    if (ffgbyt(fptr, 80, card, status) <= 0) \n    {\n        (fptr->Fptr)->nextkey += 80;   /* increment pointer to next keyword */\n\n        /* strip off trailing blanks with terminated string */\n        jj = 79;\n        while (jj >= 0 && card[jj] == ' ')\n               jj--;\n\n        card[jj + 1] = '\\0';\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgnxk( fitsfile *fptr,     /* I - FITS file pointer              */\n            char **inclist,     /* I - list of included keyword names */\n            int ninc,           /* I - number of names in inclist     */\n            char **exclist,     /* I - list of excluded keyword names */\n            int nexc,           /* I - number of names in exclist     */\n            char *card,         /* O - first matching keyword         */\n            int  *status)       /* IO - error status                  */\n/*\n    Return the next keyword that matches one of the names in inclist\n    but does not match any of the names in exclist.  The search\n    goes from the current position to the end of the header, only.\n    Wild card characters may be used in the name lists ('*', '?' and '#').\n*/\n{\n    int casesn, match, exact, namelen;\n    long ii, jj;\n    char keybuf[FLEN_CARD], keyname[FLEN_KEYWORD];\n\n    card[0] = '\\0';\n    if (*status > 0)\n        return(*status);\n\n    casesn = FALSE;\n\n    /* get next card, and return with an error if hit end of header */\n    while( ffgcrd(fptr, \"*\", keybuf, status) <= 0)\n    {\n        ffgknm(keybuf, keyname, &namelen, status); /* get the keyword name */\n        \n        /* does keyword match any names in the include list? */\n        for (ii = 0; ii < ninc; ii++)\n        {\n            ffcmps(inclist[ii], keyname, casesn, &match, &exact);\n            if (match)\n            {\n                /* does keyword match any names in the exclusion list? */\n                jj = -1;\n                while ( ++jj < nexc )\n                {\n                    ffcmps(exclist[jj], keyname, casesn, &match, &exact);\n                    if (match)\n                        break;\n                }\n\n                if (jj >= nexc)\n                {\n                    /* not in exclusion list, so return this keyword */\n                    strcat(card, keybuf);\n                    return(*status);\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgky( fitsfile *fptr,     /* I - FITS file pointer        */\n           int  datatype,      /* I - datatype of the value    */\n           const char *keyname,      /* I - name of keyword to read  */\n           void *value,        /* O - keyword value            */\n           char *comm,         /* O - keyword comment          */\n           int  *status)       /* IO - error status            */\n/*\n  Read (get) the keyword value and comment from the FITS header.\n  Reads a keyword value with the datatype specified by the 2nd argument.\n*/\n{\n    LONGLONG longval;\n    ULONGLONG ulongval;\n    double doubleval;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (datatype == TSTRING)\n    {\n        ffgkys(fptr, keyname, (char *) value, comm, status);\n    }\n    else if (datatype == TBYTE)\n    {\n        if (ffgkyjj(fptr, keyname, &longval, comm, status) <= 0)\n        {\n            if (longval > UCHAR_MAX || longval < 0)\n                *status = NUM_OVERFLOW;\n            else\n                *(unsigned char *) value = (unsigned char) longval;\n        }\n    }\n    else if (datatype == TSBYTE)\n    {\n        if (ffgkyjj(fptr, keyname, &longval, comm, status) <= 0)\n        {\n            if (longval > 127 || longval < -128)\n                *status = NUM_OVERFLOW;\n            else\n                *(signed char *) value = (signed char) longval;\n        }\n    }\n    else if (datatype == TUSHORT)\n    {\n        if (ffgkyjj(fptr, keyname, &longval, comm, status) <= 0)\n        {\n            if (longval > (long) USHRT_MAX || longval < 0)\n                *status = NUM_OVERFLOW;\n            else\n                *(unsigned short *) value = (unsigned short) longval;\n        }\n    }\n    else if (datatype == TSHORT)\n    {\n        if (ffgkyjj(fptr, keyname, &longval, comm, status) <= 0)\n        {\n            if (longval > SHRT_MAX || longval < SHRT_MIN)\n                *status = NUM_OVERFLOW;\n            else\n                *(short *) value = (short) longval;\n        }\n    }\n    else if (datatype == TUINT)\n    {\n        if (ffgkyjj(fptr, keyname, &longval, comm, status) <= 0)\n        {\n            if (longval > (long) UINT_MAX || longval < 0)\n                *status = NUM_OVERFLOW;\n            else\n                *(unsigned int *) value = longval;\n        }\n    }\n    else if (datatype == TINT)\n    {\n        if (ffgkyjj(fptr, keyname, &longval, comm, status) <= 0)\n        {\n            if (longval > INT_MAX || longval < INT_MIN)\n                *status = NUM_OVERFLOW;\n            else\n                *(int *) value = longval;\n        }\n    }\n    else if (datatype == TLOGICAL)\n    {\n        ffgkyl(fptr, keyname, (int *) value, comm, status);\n    }\n    else if (datatype == TULONG)\n    {\n        if (ffgkyujj(fptr, keyname, &ulongval, comm, status) <= 0)\n        {\n            if (ulongval > ULONG_MAX)\n                *status = NUM_OVERFLOW;\n            else\n                 *(unsigned long *) value = ulongval;\n        }\n    }\n    else if (datatype == TLONG)\n    {\n        if (ffgkyjj(fptr, keyname, &longval, comm, status) <= 0)\n        {\n            if (longval > LONG_MAX || longval < LONG_MIN)\n                *status = NUM_OVERFLOW;\n            else\n                *(int *) value = longval;\n        }\n        ffgkyj(fptr, keyname, (long *) value, comm, status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n        ffgkyujj(fptr, keyname, (ULONGLONG *) value, comm, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n        ffgkyjj(fptr, keyname, (LONGLONG *) value, comm, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n        ffgkye(fptr, keyname, (float *) value, comm, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n        ffgkyd(fptr, keyname, (double *) value, comm, status);\n    }\n    else if (datatype == TCOMPLEX)\n    {\n        ffgkyc(fptr, keyname, (float *) value, comm, status);\n    }\n    else if (datatype == TDBLCOMPLEX)\n    {\n        ffgkym(fptr, keyname, (double *) value, comm, status);\n    }\n    else\n        *status = BAD_DATATYPE;\n\n    return(*status);\n} \n/*--------------------------------------------------------------------------*/\nint ffgkey( fitsfile *fptr,     /* I - FITS file pointer        */\n            const char *keyname,      /* I - name of keyword to read  */\n            char *keyval,       /* O - keyword value            */\n            char *comm,         /* O - keyword comment          */\n            int  *status)       /* IO - error status            */\n/*\n  Read (get) the named keyword, returning the keyword value and comment.\n  The value is just the literal string of characters in the value field\n  of the keyword.  In the case of a string valued keyword, the returned\n  value includes the leading and closing quote characters.  The value may be\n  up to 70 characters long, and the comment may be up to 72 characters long.\n  If the keyword has no value (no equal sign in column 9) then a null value\n  is returned.\n*/\n{\n    char card[FLEN_CARD];\n\n    keyval[0] = '\\0';\n    if (comm)\n       comm[0] = '\\0';\n\n    if (*status > 0)\n        return(*status);\n\n    if (ffgcrd(fptr, keyname, card, status) > 0)    /* get the 80-byte card */\n        return(*status);\n\n    ffpsvc(card, keyval, comm, status);      /* parse the value and comment */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgrec( fitsfile *fptr,     /* I - FITS file pointer          */\n            int nrec,           /* I - number of keyword to read  */\n            char *card,         /* O - keyword card               */\n            int  *status)       /* IO - error status              */\n/*\n  Read (get) the nrec-th keyword, returning the entire keyword card up to\n  80 characters long.  The first keyword in the header has nrec = 1, not 0.\n  The returned card value is null terminated with any trailing blank \n  characters removed.  If nrec = 0, then this routine simply moves the\n  current header pointer to the top of the header.\n*/\n{\n    if (*status > 0)\n        return(*status);\n\n    if (nrec == 0)\n    {\n        ffmaky(fptr, 1, status);  /* simply move to beginning of header */\n        if (card)\n            card[0] = '\\0';           /* and return null card */\n    }\n    else if (nrec > 0)\n    {\n        ffmaky(fptr, nrec, status);\n        ffgnky(fptr, card, status);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcrd( fitsfile *fptr,     /* I - FITS file pointer        */\n            const char *name,         /* I - name of keyword to read  */\n            char *card,         /* O - keyword card             */\n            int  *status)       /* IO - error status            */\n/*\n  Read (get) the named keyword, returning the entire keyword card up to\n  80 characters long.  \n  The returned card value is null terminated with any trailing blank \n  characters removed.\n\n  If the input name contains wild cards ('?' matches any single char\n  and '*' matches any sequence of chars, # matches any string of decimal\n  digits) then the search ends once the end of header is reached and does \n  not automatically resume from the top of the header.\n*/\n{\n    int nkeys, nextkey, ntodo, namelen, namelen_limit, namelenminus1, cardlen;\n    int ii = 0, jj, kk, wild, match, exact, hier = 0;\n    char keyname[FLEN_KEYWORD], cardname[FLEN_KEYWORD];\n    char *ptr1, *ptr2, *gotstar;\n\n    if (*status > 0)\n        return(*status);\n\n    *keyname = '\\0';\n    \n    while (name[ii] == ' ')  /* skip leading blanks in name */\n        ii++;\n\n    strncat(keyname, &name[ii], FLEN_KEYWORD - 1);\n\n    namelen = strlen(keyname);\n\n    while (namelen > 0 && keyname[namelen - 1] == ' ')\n         namelen--;            /* ignore trailing blanks in name */\n\n    keyname[namelen] = '\\0';  /* terminate the name */\n\n    for (ii=0; ii < namelen; ii++)       \n        keyname[ii] = toupper(keyname[ii]);    /*  make upper case  */\n\n    if (FSTRNCMP(\"HIERARCH\", keyname, 8) == 0)\n    {\n        if (namelen == 8)\n        {\n            /* special case: just looking for any HIERARCH keyword */\n            hier = 1;\n        }\n        else\n        {\n            /* ignore the leading HIERARCH and look for the 'real' name */\n            /* starting with first non-blank character following HIERARCH */\n            ptr1 = keyname;\n            ptr2 = &keyname[8];\n\n            while(*ptr2 == ' ')\n                ptr2++;\n\n            namelen = 0;\n            while(*ptr2)\n            {\n                *ptr1 = *ptr2;\n                 ptr1++;\n                 ptr2++;\n                 namelen++;\n            }\n            *ptr1 = '\\0';\n        }\n    }\n\n    /* does input name contain wild card chars?  ('?',  '*', or '#') */\n    /* wild cards are currently not supported with HIERARCH keywords */\n\n    namelen_limit = namelen;\n    gotstar = 0;\n    if (namelen < 9 && \n       (strchr(keyname,'?') || (gotstar = strchr(keyname,'*')) || \n        strchr(keyname,'#')) )\n    {\n        wild = 1;\n\n        /* if we found a '*' wild card in the name, there might be */\n        /* more than one.  Support up to 2 '*' in the template. */\n        /* Thus we need to compare keywords whose names have at least */\n        /* namelen - 2 characters.                                   */\n        if (gotstar)\n           namelen_limit -= 2;           \n    }\n    else\n        wild = 0;\n\n    ffghps(fptr, &nkeys, &nextkey, status); /* get no. keywords and position */\n\n    namelenminus1 = maxvalue(namelen - 1, 1);\n    ntodo = nkeys - nextkey + 1;  /* first, read from next keyword to end */\n    for (jj=0; jj < 2; jj++)\n    {\n      for (kk = 0; kk < ntodo; kk++)\n      {\n        ffgnky(fptr, card, status);     /* get next keyword */\n\n        if (hier)\n        {\n           if (FSTRNCMP(\"HIERARCH\", card, 8) == 0)\n                return(*status);  /* found a HIERARCH keyword */\n        }\n        else\n        {\n          ffgknm(card, cardname, &cardlen, status); /* get the keyword name */\n\n          if (cardlen >= namelen_limit)  /* can't match if card < name */\n          { \n            /* if there are no wild cards, lengths must be the same */\n            if (!( !wild && cardlen != namelen) )\n            {\n              for (ii=0; ii < cardlen; ii++)\n              {    \n                /* make sure keyword is in uppercase */\n                if (cardname[ii] > 96)\n                {\n                  /* This assumes the ASCII character set in which */\n                  /* upper case characters start at ASCII(97)  */\n                  /* Timing tests showed that this is 20% faster */\n                  /* than calling the isupper function.          */\n\n                  cardname[ii] = toupper(cardname[ii]);  /* make upper case */\n                }\n              }\n\n              if (wild)\n              {\n                ffcmps(keyname, cardname, 1, &match, &exact);\n                if (match)\n                    return(*status); /* found a matching keyword */\n              }\n              else if (keyname[namelenminus1] == cardname[namelenminus1])\n              {\n                /* test the last character of the keyword name first, on */\n                /* the theory that it is less likely to match then the first */\n                /* character since many keywords begin with 'T', for example */\n\n                if (FSTRNCMP(keyname, cardname, namelenminus1) == 0)\n                {\n                  return(*status);   /* found the matching keyword */\n                }\n              }\n\t      else if (namelen == 0 && cardlen == 0)\n\t      {\n\t         /* matched a blank keyword */\n\t\t return(*status);\n\t      }\n            }\n          }\n        }\n      }\n\n      if (wild || jj == 1)\n            break;  /* stop at end of header if template contains wildcards */\n\n      ffmaky(fptr, 1, status);  /* reset pointer to beginning of header */\n      ntodo = nextkey - 1;      /* number of keyword to read */ \n    }\n\n    return(*status = KEY_NO_EXIST);  /* couldn't find the keyword */\n}\n/*--------------------------------------------------------------------------*/\nint ffgstr( fitsfile *fptr,     /* I - FITS file pointer        */\n            const char *string, /* I - string to match  */\n            char *card,         /* O - keyword card             */\n            int  *status)       /* IO - error status            */\n/*\n  Read (get) the next keyword record that contains the input character string,\n  returning the entire keyword card up to 80 characters long.\n  The returned card value is null terminated with any trailing blank \n  characters removed.\n*/\n{\n    int nkeys, nextkey, ntodo, stringlen;\n    int jj, kk;\n\n    if (*status > 0)\n        return(*status);\n\n    stringlen = strlen(string);\n    if (stringlen > 80) {\n        return(*status = KEY_NO_EXIST);  /* matching string is too long to exist */\n    }\n\n    ffghps(fptr, &nkeys, &nextkey, status); /* get no. keywords and position */\n    ntodo = nkeys - nextkey + 1;  /* first, read from next keyword to end */\n\n    for (jj=0; jj < 2; jj++)\n    {\n      for (kk = 0; kk < ntodo; kk++)\n      {\n        ffgnky(fptr, card, status);     /* get next keyword */\n        if (strstr(card, string) != 0) {\n            return(*status);   /* found the matching string */\n        }\n      }\n\n      ffmaky(fptr, 1, status);  /* reset pointer to beginning of header */\n      ntodo = nextkey - 1;      /* number of keyword to read */ \n    }\n\n    return(*status = KEY_NO_EXIST);  /* couldn't find the keyword */\n}\n/*--------------------------------------------------------------------------*/\nint ffgknm( char *card,         /* I - keyword card                   */\n            char *name,         /* O - name of the keyword            */\n            int *length,        /* O - length of the keyword name     */\n            int  *status)       /* IO - error status                  */\n\n/*\n  Return the name of the keyword, and the name length.  This supports the\n  ESO HIERARCH convention where keyword names may be > 8 characters long.\n*/\n{\n    char *ptr1, *ptr2;\n    int ii, namelength;\n\n    namelength = FLEN_KEYWORD - 1;\n    *name = '\\0';\n    *length = 0;\n\n    /* support for ESO HIERARCH keywords; find the '=' */\n    if (FSTRNCMP(card, \"HIERARCH \", 9) == 0)\n    {\n        ptr2 = strchr(card, '=');\n\n        if (!ptr2)   /* no value indicator ??? */\n        {\n            /* this probably indicates an error, so just return FITS name */\n            strcat(name, \"HIERARCH\");\n            *length = 8;\n            return(*status);\n        }\n\n        /* find the start and end of the HIERARCH name */\n        ptr1 = &card[9];\n        while (*ptr1 == ' ')   /* skip spaces */\n            ptr1++;\n\n        strncat(name, ptr1, ptr2 - ptr1);\n        ii = ptr2 - ptr1;\n\n        while (ii > 0 && name[ii - 1] == ' ')  /* remove trailing spaces */\n            ii--;\n\n        name[ii] = '\\0';\n        *length = ii;\n    }\n    else\n    {\n        for (ii = 0; ii < namelength; ii++)\n        {\n           /* look for string terminator, or a blank */\n           if (*(card+ii) != ' ' && *(card+ii) != '=' && *(card+ii) !='\\0')\n           {\n               *(name+ii) = *(card+ii);\n           }\n           else\n           {\n               name[ii] = '\\0';\n               *length = ii;\n               return(*status);\n           }\n        }\n\n        /* if we got here, keyword is namelength characters long */\n        name[namelength] = '\\0';\n        *length = namelength;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgunt( fitsfile *fptr,     /* I - FITS file pointer         */\n            const char *keyname,      /* I - name of keyword to read   */\n            char *unit,         /* O - keyword units             */\n            int  *status)       /* IO - error status             */\n/*\n    Read (get) the units string from the comment field of the existing\n    keyword. This routine uses a local FITS convention (not defined in the\n    official FITS standard) in which the units are enclosed in \n    square brackets following the '/' comment field delimiter, e.g.:\n\n    KEYWORD =                   12 / [kpc] comment string goes here\n*/\n{\n    char valstring[FLEN_VALUE];\n    char comm[FLEN_COMMENT];\n    char *loc;\n\n    if (*status > 0)\n        return(*status);\n\n    ffgkey(fptr, keyname, valstring, comm, status);  /* read the keyword */\n\n    if (comm[0] == '[')\n    {\n        loc = strchr(comm, ']');   /*  find the closing bracket */\n        if (loc)\n            *loc = '\\0';           /*  terminate the string */\n\n        strcpy(unit, &comm[1]);    /*  copy the string */\n     }\n     else\n        unit[0] = '\\0';\n \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgkys( fitsfile *fptr,     /* I - FITS file pointer         */\n            const char *keyname,      /* I - name of keyword to read   */\n            char *value,        /* O - keyword value             */\n            char *comm,         /* O - keyword comment           */\n            int  *status)       /* IO - error status             */\n/*\n  Get KeYword with a String value:\n  Read (get) a simple string valued keyword.  The returned value may be up to \n  68 chars long ( + 1 null terminator char).  The routine does not support the\n  HEASARC convention for continuing long string values over multiple keywords.\n  The ffgkls routine may be used to read long continued strings. The returned\n  comment string may be up to 69 characters long (including null terminator).\n*/\n{\n    char valstring[FLEN_VALUE];\n\n    if (*status > 0)\n        return(*status);\n\n    ffgkey(fptr, keyname, valstring, comm, status);  /* read the keyword */\n    value[0] = '\\0';\n    ffc2s(valstring, value, status);   /* remove quotes from string */\n \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgksl( fitsfile *fptr,     /* I - FITS file pointer             */\n           const char *keyname, /* I - name of keyword to read       */\n           int *length,         /* O - length of the string value    */\n           int  *status)        /* IO - error status                 */\n/*\n  Get the length of the keyword value string.\n  This routine explicitly supports the CONTINUE convention for long string values.\n*/\n{\n    char valstring[FLEN_VALUE], value[FLEN_VALUE];\n    int position, contin, len;\n    \n    if (*status > 0)\n        return(*status);\n\n    ffgkey(fptr, keyname, valstring, NULL, status);  /* read the keyword */\n\n    if (*status > 0)\n        return(*status);\n\n    ffghps(fptr, NULL,  &position, status); /* save the current header position */\n    \n    if (!valstring[0])  { /* null value string? */\n        *length = 0;\n    } else {\n      ffc2s(valstring, value, status);  /* in case string contains \"/\" char  */\n      *length = strlen(value);\n\n      /* If last character is a & then value may be continued on next keyword */\n      contin = 1;\n      while (contin)  \n      {\n        len = strlen(value);\n\n        if (len && *(value+len-1) == '&')  /*  is last char an anpersand?  */\n        {\n            ffgcnt(fptr, value, NULL, status);\n            if (*value)    /* a null valstring indicates no continuation */\n            {\n               *length += strlen(value) - 1;\n            }\n            else\n\t    {\n                contin = 0;\n            }\n        }\n        else\n\t{\n            contin = 0;\n\t}\n      }\n    }\n\n    ffmaky(fptr, position - 1, status); /* reset header pointer to the keyword */\n                                        /* since in many cases the program will read */\n\t\t\t\t\t/* the string value after getting the length */\n    \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgkls( fitsfile *fptr,     /* I - FITS file pointer             */\n           const char *keyname, /* I - name of keyword to read       */\n           char **value,        /* O - pointer to keyword value      */\n           char *comm,          /* O - keyword comment (may be NULL) */\n           int  *status)        /* IO - error status                 */\n/*\n  This is the original routine for reading long string keywords that use\n  the CONTINUE keyword convention.  In 2016 a new routine called\n  ffgsky / fits_read_string_key was added, which may provide a more \n  convenient user interface  for most applications.\n\n  Get Keyword with possible Long String value:\n  Read (get) the named keyword, returning the value and comment.\n  The returned value string may be arbitrarily long (by using the HEASARC\n  convention for continuing long string values over multiple keywords) so\n  this routine allocates the required memory for the returned string value.\n  It is up to the calling routine to free the memory once it is finished\n  with the value string.  The returned comment string may be up to 69\n  characters long.\n*/\n{\n    char valstring[FLEN_VALUE], nextcomm[FLEN_COMMENT];\n    int contin, commspace = 0;\n    size_t len;\n\n    if (*status > 0)\n        return(*status);\n\n    *value = NULL;  /* initialize a null pointer in case of error */\n\n    ffgkey(fptr, keyname, valstring, comm, status);  /* read the keyword */\n\n    if (*status > 0)\n        return(*status);\n\n    if (comm)\n    {\n        /* remaining space in comment string */\n        commspace = FLEN_COMMENT - strlen(comm) - 2;\n    }\n    \n    if (!valstring[0])   /* null value string? */\n    {\n      *value = (char *) malloc(1);  /* allocate and return a null string */\n      **value = '\\0';\n    }\n    else\n    {\n      /* allocate space,  plus 1 for null */\n      *value = (char *) malloc(strlen(valstring) + 1);\n\n      ffc2s(valstring, *value, status);   /* convert string to value */\n      len = strlen(*value);\n\n      /* If last character is a & then value may be continued on next keyword */\n      contin = 1;\n      while (contin)  \n      {\n        if (len && *(*value+len-1) == '&')  /*  is last char an ampersand?  */\n        {\n            ffgcnt(fptr, valstring, nextcomm, status);\n            if (*valstring)    /* a null valstring indicates no continuation */\n            {\n               *(*value+len-1) = '\\0';         /* erase the trailing & char */\n               len += strlen(valstring) - 1;\n               *value = (char *) realloc(*value, len + 1); /* increase size */\n               strcat(*value, valstring);     /* append the continued chars */\n            }\n            else\n\t    {\n                contin = 0;\n                /* Without this, for case of a last CONTINUE statement ending\n                   with a '&', nextcomm would retain the same string from \n                   from the previous loop iteration and the comment\n                   would get concantenated twice. */\n                nextcomm[0] = 0;\n            }\n\n            /* concantenate comment strings (if any) */\n\t    if ((commspace > 0) && (*nextcomm != 0)) \n\t    {\n                strcat(comm, \" \");\n\t\tstrncat(comm, nextcomm, commspace);\n                commspace = FLEN_COMMENT - strlen(comm) - 2;\n            }\n        }\n        else\n\t{\n            contin = 0;\n\t}\n      }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsky( fitsfile *fptr,     /* I - FITS file pointer             */\n           const char *keyname, /* I - name of keyword to read       */\n           int firstchar,       /* I - first character of string to return */\n           int maxchar,         /* I - maximum length of string to return */\n\t                        /*    (string will be null terminated)  */      \n           char *value,         /* O - pointer to keyword value      */\n           int *valuelen,       /* O - total length of the keyword value string */\n                                /*     The returned 'value' string may only */\n\t\t\t\t/*     contain a piece of the total string, depending */\n\t\t\t\t/*     on the value of firstchar and maxchar */\n           char *comm,          /* O - keyword comment (may be NULL) */\n           int  *status)        /* IO - error status                 */\n/*\n  Read and return the value of the specified string-valued keyword.\n  \n  This new routine was added in 2016 to provide a more convenient user\n  interface than the older ffgkls routine.\n\n  Read a string keyword, returning up to 'naxchars' characters of the value\n  starting with the 'firstchar' character.\n  The input 'value' string must be allocated at least 1 char bigger to\n  allow for the terminating null character.\n  \n  This routine may be used to read continued string keywords that use \n  the CONTINUE keyword convention, as well as normal string keywords\n  that are contained within a single header record.\n  \n  This routine differs from the ffkls routine in that it does not\n  internally allocate memory for the returned value string, and consequently\n  the calling routine does not need to call fffree to free the memory.\n*/\n{\n    char valstring[FLEN_VALUE], nextcomm[FLEN_COMMENT];\n    char *tempstring;\n    int contin, commspace = 0;\n    size_t len;\n\n    if (*status > 0)\n        return(*status);\n\n    tempstring = NULL;  /* initialize in case of error */\n    *value = '\\0';\n    if (valuelen) *valuelen = 0;\n    \n    ffgkey(fptr, keyname, valstring, comm, status);  /* read the keyword */\n\n    if (*status > 0)\n        return(*status);\n\n    if (comm)\n    {\n        /* remaining space in comment string */\n        commspace = FLEN_COMMENT - strlen(comm) - 2;\n    }\n    \n    if (!valstring[0])   /* null value string? */\n    {\n      tempstring = (char *) malloc(1);  /* allocate and return a null string */\n      *tempstring = '\\0';\n    }\n    else\n    {\n      /* allocate space,  plus 1 for null */\n      tempstring = (char *) malloc(strlen(valstring) + 1);\n\n      ffc2s(valstring, tempstring, status);   /* convert string to value */\n      len = strlen(tempstring);\n\n      /* If last character is a & then value may be continued on next keyword */\n      contin = 1;\n      while (contin && *status <= 0)  \n      {\n        if (len && *(tempstring+len-1) == '&')  /*  is last char an anpersand?  */\n        {\n            ffgcnt(fptr, valstring, nextcomm, status);\n            if (*valstring)    /* a null valstring indicates no continuation */\n            {\n               *(tempstring+len-1) = '\\0';         /* erase the trailing & char */\n               len += strlen(valstring) - 1;\n               tempstring = (char *) realloc(tempstring, len + 1); /* increase size */\n               strcat(tempstring, valstring);     /* append the continued chars */\n            }\n            else\n\t    {\n                contin = 0;\n                /* Without this, for case of a last CONTINUE statement ending\n                   with a '&', nextcomm would retain the same string from \n                   from the previous loop iteration and the comment\n                   would get concantenated twice. */\n                nextcomm[0] = 0;\n            }\n\n            /* concantenate comment strings (if any) */\n\t    if ((commspace > 0) && (*nextcomm != 0)) \n\t    {\n                strcat(comm, \" \");\n\t\tstrncat(comm, nextcomm, commspace);\n                commspace = FLEN_COMMENT - strlen(comm) - 2;\n            }\n        }\n        else\n\t{\n            contin = 0;\n\t}\n      }\n    }\n    \n    if (tempstring) \n    {\n        len = strlen(tempstring);\n\tif (firstchar <= len)\n            strncat(value, tempstring + (firstchar - 1), maxchar);\n        free(tempstring);\n\tif (valuelen) *valuelen = len;  /* total length of the keyword value */\n    }\n    \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffree( void *value,       /* I - pointer to keyword value  */\n            int  *status)      /* IO - error status             */\n/*\n  Free the memory that was previously allocated by CFITSIO, \n  such as by ffgkls or fits_hdr2str\n*/\n{\n    if (*status > 0)\n        return(*status);\n\n    if (value)\n        free(value);\n\n    return(*status);\n}\n /*--------------------------------------------------------------------------*/\nint ffgcnt( fitsfile *fptr,     /* I - FITS file pointer         */\n            char *value,        /* O - continued string value    */\n            char *comm,         /* O - continued comment string  */\n            int  *status)       /* IO - error status             */\n/*\n  Attempt to read the next keyword, returning the string value\n  if it is a continuation of the previous string keyword value.\n  This uses the HEASARC convention for continuing long string values\n  over multiple keywords.  Each continued string is terminated with a\n  backslash character, and the continuation follows on the next keyword\n  which must have the name CONTINUE without an equal sign in column 9\n  of the card.  If the next card is not a continuation, then the returned\n  value string will be null.\n*/\n{\n    int tstatus;\n    char card[FLEN_CARD], strval[FLEN_VALUE];\n\n    if (*status > 0)\n        return(*status);\n\n    tstatus = 0;\n    value[0] = '\\0';\n\n    if (ffgnky(fptr, card, &tstatus) > 0)  /*  read next keyword  */\n        return(*status);                   /*  hit end of header  */\n\n    if (strncmp(card, \"CONTINUE  \", 10) == 0)  /* a continuation card? */\n    {\n        strncpy(card, \"D2345678=  \", 10); /* overwrite a dummy keyword name */\n        ffpsvc(card, strval, comm, &tstatus);  /*  get the string value & comment */\n        ffc2s(strval, value, &tstatus);    /* remove the surrounding quotes */\n\n        if (tstatus)       /*  return null if error status was returned  */\n           value[0] = '\\0';\n    }\n    else\n        ffmrky(fptr, -1, status);  /* reset the keyword pointer */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgkyl( fitsfile *fptr,     /* I - FITS file pointer         */\n            const char *keyname,      /* I - name of keyword to read   */\n            int  *value,        /* O - keyword value             */\n            char *comm,         /* O - keyword comment           */\n            int  *status)       /* IO - error status             */\n/*\n  Read (get) the named keyword, returning the value and comment.\n  The returned value = 1 if the keyword is true, else = 0 if false.\n  The comment may be up to 69 characters long.\n*/\n{\n    char valstring[FLEN_VALUE];\n\n    if (*status > 0)\n        return(*status);\n\n    ffgkey(fptr, keyname, valstring, comm, status);  /* read the keyword */\n    ffc2l(valstring, value, status);   /* convert string to value */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgkyj( fitsfile *fptr,     /* I - FITS file pointer         */\n            const char *keyname,      /* I - name of keyword to read   */\n            long *value,        /* O - keyword value             */\n            char *comm,         /* O - keyword comment           */\n            int  *status)       /* IO - error status             */\n/*\n  Read (get) the named keyword, returning the value and comment.\n  The value will be implicitly converted to a (long) integer if it not\n  already of this datatype.  The comment may be up to 69 characters long.\n*/\n{\n    char valstring[FLEN_VALUE];\n\n    if (*status > 0)\n        return(*status);\n\n    ffgkey(fptr, keyname, valstring, comm, status);  /* read the keyword */\n    ffc2i(valstring, value, status);   /* convert string to value */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgkyjj( fitsfile *fptr,     /* I - FITS file pointer         */\n            const char *keyname,      /* I - name of keyword to read   */\n            LONGLONG *value,    /* O - keyword value             */\n            char *comm,         /* O - keyword comment           */\n            int  *status)       /* IO - error status             */\n/*\n  Read (get) the named keyword, returning the value and comment.\n  The value will be implicitly converted to a (LONGLONG) integer if it not\n  already of this datatype.  The comment may be up to 69 characters long.\n*/\n{\n    char valstring[FLEN_VALUE];\n\n    if (*status > 0)\n        return(*status);\n\n    ffgkey(fptr, keyname, valstring, comm, status);  /* read the keyword */\n    ffc2j(valstring, value, status);   /* convert string to value */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgkyujj( fitsfile *fptr,     /* I - FITS file pointer         */\n            const char *keyname,      /* I - name of keyword to read   */\n            ULONGLONG *value,    /* O - keyword value             */\n            char *comm,         /* O - keyword comment           */\n            int  *status)       /* IO - error status             */\n/*\n  Read (get) the named keyword, returning the value and comment.\n  The value will be implicitly converted to a (ULONGLONG) integer if it not\n  already of this datatype.  The comment may be up to 69 characters long.\n*/\n{\n    char valstring[FLEN_VALUE];\n\n    if (*status > 0)\n        return(*status);\n\n    ffgkey(fptr, keyname, valstring, comm, status);  /* read the keyword */\n    ffc2uj(valstring, value, status);   /* convert string to value */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgkye( fitsfile *fptr,     /* I - FITS file pointer         */\n            const char  *keyname,     /* I - name of keyword to read   */\n            float *value,       /* O - keyword value             */\n            char  *comm,        /* O - keyword comment           */\n            int   *status)      /* IO - error status             */\n/*\n  Read (get) the named keyword, returning the value and comment.\n  The value will be implicitly converted to a float if it not\n  already of this datatype.  The comment may be up to 69 characters long.\n*/\n{\n    char valstring[FLEN_VALUE];\n\n    if (*status > 0)\n        return(*status);\n\n    ffgkey(fptr, keyname, valstring, comm, status);  /* read the keyword */\n    ffc2r(valstring, value, status);   /* convert string to value */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgkyd( fitsfile *fptr,      /* I - FITS file pointer         */\n            const char   *keyname,     /* I - name of keyword to read   */\n            double *value,       /* O - keyword value             */\n            char   *comm,        /* O - keyword comment           */\n            int    *status)      /* IO - error status             */\n/*\n  Read (get) the named keyword, returning the value and comment.\n  The value will be implicitly converted to a double if it not\n  already of this datatype.  The comment may be up to 69 characters long.\n*/\n{\n    char valstring[FLEN_VALUE];\n\n    if (*status > 0)\n        return(*status);\n\n    ffgkey(fptr, keyname, valstring, comm, status);  /* read the keyword */\n    ffc2d(valstring, value, status);   /* convert string to value */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgkyc( fitsfile *fptr,     /* I - FITS file pointer         */\n            const char  *keyname,     /* I - name of keyword to read   */\n            float *value,       /* O - keyword value (real,imag) */\n            char  *comm,        /* O - keyword comment           */\n            int   *status)      /* IO - error status             */\n/*\n  Read (get) the named keyword, returning the value and comment.\n  The keyword must have a complex value. No implicit data conversion\n  will be performed.\n*/\n{\n    char valstring[FLEN_VALUE], message[FLEN_ERRMSG];\n    int len;\n\n    if (*status > 0)\n        return(*status);\n\n    ffgkey(fptr, keyname, valstring, comm, status);  /* read the keyword */\n\n    if (valstring[0] != '(' )   /* test that this is a complex keyword */\n    {\n      snprintf(message, FLEN_ERRMSG, \"keyword %s does not have a complex value (ffgkyc):\",\n              keyname);\n      ffpmsg(message);\n      ffpmsg(valstring);\n      return(*status = BAD_C2F);\n    }\n\n    valstring[0] = ' ';            /* delete the opening parenthesis */\n    len = strcspn(valstring, \")\" );  \n    valstring[len] = '\\0';         /* delete the closing parenthesis */\n\n    len = strcspn(valstring, \",\");\n    valstring[len] = '\\0';\n\n    ffc2r(valstring, &value[0], status);       /* convert the real part */\n    ffc2r(&valstring[len + 1], &value[1], status); /* convert imag. part */\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgkym( fitsfile *fptr,     /* I - FITS file pointer         */\n            const char  *keyname,     /* I - name of keyword to read   */\n            double *value,      /* O - keyword value (real,imag) */\n            char  *comm,        /* O - keyword comment           */\n            int   *status)      /* IO - error status             */\n/*\n  Read (get) the named keyword, returning the value and comment.\n  The keyword must have a complex value. No implicit data conversion\n  will be performed.\n*/\n{\n    char valstring[FLEN_VALUE], message[FLEN_ERRMSG];\n    int len;\n\n    if (*status > 0)\n        return(*status);\n\n    ffgkey(fptr, keyname, valstring, comm, status);  /* read the keyword */\n\n    if (valstring[0] != '(' )   /* test that this is a complex keyword */\n    {\n      snprintf(message, FLEN_ERRMSG, \"keyword %s does not have a complex value (ffgkym):\",\n              keyname);\n      ffpmsg(message);\n      ffpmsg(valstring);\n      return(*status = BAD_C2D);\n    }\n\n    valstring[0] = ' ';            /* delete the opening parenthesis */\n    len = strcspn(valstring, \")\" );  \n    valstring[len] = '\\0';         /* delete the closing parenthesis */\n\n    len = strcspn(valstring, \",\");\n    valstring[len] = '\\0';\n\n    ffc2d(valstring, &value[0], status);        /* convert the real part */\n    ffc2d(&valstring[len + 1], &value[1], status);  /* convert the imag. part */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgkyt( fitsfile *fptr,      /* I - FITS file pointer                 */\n            const char   *keyname,     /* I - name of keyword to read           */\n            long   *ivalue,      /* O - integer part of keyword value     */\n            double *fraction,    /* O - fractional part of keyword value  */\n            char   *comm,        /* O - keyword comment                   */\n            int    *status)      /* IO - error status                     */\n/*\n  Read (get) the named keyword, returning the value and comment.\n  The integer and fractional parts of the value are returned in separate\n  variables, to allow more numerical precision to be passed.  This\n  effectively passes a 'triple' precision value, with a 4-byte integer\n  and an 8-byte fraction.  The comment may be up to 69 characters long.\n*/\n{\n    char valstring[FLEN_VALUE];\n    char *loc;\n\n    if (*status > 0)\n        return(*status);\n\n    ffgkey(fptr, keyname, valstring, comm, status);  /* read the keyword */\n\n    /*  read the entire value string as a double, to get the integer part */\n    ffc2d(valstring, fraction, status);\n\n    *ivalue = (long) *fraction;\n\n    *fraction = *fraction - *ivalue;\n\n    /* see if we need to read the fractional part again with more precision */\n    /* look for decimal point, without an exponential E or D character */\n\n    loc = strchr(valstring, '.');\n    if (loc)\n    {\n        if (!strchr(valstring, 'E') && !strchr(valstring, 'D'))\n            ffc2d(loc, fraction, status);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgkyn( fitsfile *fptr,      /* I - FITS file pointer             */\n            int    nkey,         /* I - number of the keyword to read */\n            char   *keyname,     /* O - name of the keyword           */\n            char   *value,       /* O - keyword value                 */\n            char   *comm,        /* O - keyword comment               */\n            int    *status)      /* IO - error status                 */\n/*\n  Read (get) the nkey-th keyword returning the keyword name, value and comment.\n  The value is just the literal string of characters in the value field\n  of the keyword.  In the case of a string valued keyword, the returned\n  value includes the leading and closing quote characters.  The value may be\n  up to 70 characters long, and the comment may be up to 72 characters long.\n  If the keyword has no value (no equal sign in column 9) then a null value\n  is returned.  If comm = NULL, then do not return the comment string.\n*/\n{\n    char card[FLEN_CARD], sbuff[FLEN_CARD];\n    int namelen;\n\n    keyname[0] = '\\0';\n    value[0] = '\\0';\n    if (comm)\n        comm[0] = '\\0';\n\n    if (*status > 0)\n        return(*status);\n\n    if (ffgrec(fptr, nkey, card, status) > 0 )  /* get the 80-byte card */\n        return(*status);\n\n    ffgknm(card, keyname, &namelen, status); /* get the keyword name */\n\n    if (ffpsvc(card, value, comm, status) > 0)   /* parse value and comment */\n        return(*status);\n\n    if (fftrec(keyname, status) > 0)  /* test keyword name; catches no END */\n    {\n     snprintf(sbuff, FLEN_CARD, \"Name of keyword no. %d contains illegal character(s): %s\",\n              nkey, keyname);\n     ffpmsg(sbuff);\n\n     if (nkey % 36 == 0)  /* test if at beginning of 36-card FITS record */\n            ffpmsg(\"  (This may indicate a missing END keyword).\");\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgkns( fitsfile *fptr,     /* I - FITS file pointer                    */\n            const char *keyname,      /* I - root name of keywords to read        */\n            int  nstart,        /* I - starting index number                */\n            int  nmax,          /* I - maximum number of keywords to return */\n            char *value[],      /* O - array of pointers to keyword values  */\n            int  *nfound,       /* O - number of values that were returned  */\n            int  *status)       /* IO - error status                        */\n/*\n  Read (get) an indexed array of keywords with index numbers between\n  NSTART and (NSTART + NMAX -1) inclusive.  \n  This routine does NOT support the HEASARC long string convention.\n*/\n{\n    int nend, lenroot, ii, nkeys, mkeys, tstatus, undefinedval;\n    long ival;\n    char keyroot[FLEN_KEYWORD], keyindex[8], card[FLEN_CARD];\n    char svalue[FLEN_VALUE], comm[FLEN_COMMENT], *equalssign;\n\n    if (*status > 0)\n        return(*status);\n\n    *nfound = 0;\n    nend = nstart + nmax - 1;\n\n    keyroot[0] = '\\0';\n    strncat(keyroot, keyname, FLEN_KEYWORD - 1);\n     \n    lenroot = strlen(keyroot);\n    \n    if (lenroot == 0)     /*  root must be at least 1 char long  */\n        return(*status);\n\n    for (ii=0; ii < lenroot; ii++)           /*  make sure upper case  */\n        keyroot[ii] = toupper(keyroot[ii]);\n\n    ffghps(fptr, &nkeys, &mkeys, status);  /*  get the number of keywords  */\n\n    undefinedval = FALSE;\n    for (ii=3; ii <= nkeys; ii++)  \n    {\n       if (ffgrec(fptr, ii, card, status) > 0)     /*  get next keyword  */\n           return(*status);\n\n       if (strncmp(keyroot, card, lenroot) == 0)  /* see if keyword matches */\n       {\n          keyindex[0] = '\\0';\n          equalssign = strchr(card, '=');\n\t  if (equalssign == 0) continue;  /* keyword has no value */\n\n          if (equalssign - card - lenroot > 7)\n          {\n             return (*status=BAD_KEYCHAR);\n          }\n          strncat(keyindex, &card[lenroot], equalssign - card  - lenroot);  /*  copy suffix  */\n          tstatus = 0;\n          if (ffc2ii(keyindex, &ival, &tstatus) <= 0)     /*  test suffix  */\n          {\n             if (ival <= nend && ival >= nstart)\n             {\n                ffpsvc(card, svalue, comm, status);  /*  parse the value */\n                ffc2s(svalue, value[ival-nstart], status); /* convert */\n                if (ival - nstart + 1 > *nfound)\n                      *nfound = ival - nstart + 1;  /*  max found */ \n\n                if (*status == VALUE_UNDEFINED)\n                {\n                   undefinedval = TRUE;\n                   *status = 0;  /* reset status to read remaining values */\n                }\n             }\n          }\n       }\n    }\n    if (undefinedval && (*status <= 0) )\n        *status = VALUE_UNDEFINED;  /* report at least 1 value undefined */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgknl( fitsfile *fptr,     /* I - FITS file pointer                    */\n            const char *keyname,      /* I - root name of keywords to read        */\n            int  nstart,        /* I - starting index number                */\n            int  nmax,          /* I - maximum number of keywords to return */\n            int  *value,        /* O - array of keyword values              */\n            int  *nfound,       /* O - number of values that were returned  */\n            int  *status)       /* IO - error status                        */\n/*\n  Read (get) an indexed array of keywords with index numbers between\n  NSTART and (NSTART + NMAX -1) inclusive.  \n  The returned value = 1 if the keyword is true, else = 0 if false.\n*/\n{\n    int nend, lenroot, ii, nkeys, mkeys, tstatus, undefinedval;\n    long ival;\n    char keyroot[FLEN_KEYWORD], keyindex[8], card[FLEN_CARD];\n    char svalue[FLEN_VALUE], comm[FLEN_COMMENT], *equalssign;\n\n    if (*status > 0)\n        return(*status);\n\n    *nfound = 0;\n    nend = nstart + nmax - 1;\n\n    keyroot[0] = '\\0';\n    strncat(keyroot, keyname, FLEN_KEYWORD - 1);\n\n    lenroot = strlen(keyroot);\n    \n    if (lenroot == 0)     /*  root must be at least 1 char long  */\n        return(*status);\n \n    for (ii=0; ii < lenroot; ii++)           /*  make sure upper case  */\n        keyroot[ii] = toupper(keyroot[ii]);\n\n    ffghps(fptr, &nkeys, &mkeys, status);  /*  get the number of keywords  */\n\n    ffmaky(fptr, 3, status);  /* move to 3rd keyword (skip 1st 2 keywords) */\n\n    undefinedval = FALSE;\n    for (ii=3; ii <= nkeys; ii++)  \n    {\n       if (ffgnky(fptr, card, status) > 0)     /*  get next keyword  */\n           return(*status);\n\n       if (strncmp(keyroot, card, lenroot) == 0)  /* see if keyword matches */\n       {\n          keyindex[0] = '\\0';\n          equalssign = strchr(card, '=');\n\t  if (equalssign == 0) continue;  /* keyword has no value */\n\n          if (equalssign - card - lenroot > 7)\n          {\n             return (*status=BAD_KEYCHAR);\n          }\n          strncat(keyindex, &card[lenroot], equalssign - card  - lenroot);  /*  copy suffix  */\n\n          tstatus = 0;\n          if (ffc2ii(keyindex, &ival, &tstatus) <= 0)    /*  test suffix  */\n          {\n             if (ival <= nend && ival >= nstart)\n             {\n                ffpsvc(card, svalue, comm, status);   /*  parse the value */\n                ffc2l(svalue, &value[ival-nstart], status); /* convert*/\n                if (ival - nstart + 1 > *nfound)\n                      *nfound = ival - nstart + 1;  /*  max found */ \n\n                if (*status == VALUE_UNDEFINED)\n                {\n                    undefinedval = TRUE;\n                   *status = 0;  /* reset status to read remaining values */\n                }\n             }\n          }\n       }\n    }\n    if (undefinedval && (*status <= 0) )\n        *status = VALUE_UNDEFINED;  /* report at least 1 value undefined */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgknj( fitsfile *fptr,     /* I - FITS file pointer                    */\n            const char *keyname,      /* I - root name of keywords to read        */\n            int  nstart,        /* I - starting index number                */\n            int  nmax,          /* I - maximum number of keywords to return */\n            long *value,        /* O - array of keyword values              */\n            int  *nfound,       /* O - number of values that were returned  */\n            int  *status)       /* IO - error status                        */\n/*\n  Read (get) an indexed array of keywords with index numbers between\n  NSTART and (NSTART + NMAX -1) inclusive.  \n*/\n{\n    int nend, lenroot, ii, nkeys, mkeys, tstatus, undefinedval;\n    long ival;\n    char keyroot[FLEN_KEYWORD], keyindex[8], card[FLEN_CARD];\n    char svalue[FLEN_VALUE], comm[FLEN_COMMENT], *equalssign;\n\n    if (*status > 0)\n        return(*status);\n\n    *nfound = 0;\n    nend = nstart + nmax - 1;\n\n    keyroot[0] = '\\0';\n    strncat(keyroot, keyname, FLEN_KEYWORD - 1);\n\n    lenroot = strlen(keyroot);\n    \n    if (lenroot == 0)     /*  root must be at least 1 char long  */\n        return(*status);\n \n    for (ii=0; ii < lenroot; ii++)           /*  make sure upper case  */\n        keyroot[ii] = toupper(keyroot[ii]);\n\n    ffghps(fptr, &nkeys, &mkeys, status);  /*  get the number of keywords  */\n\n    ffmaky(fptr, 3, status);  /* move to 3rd keyword (skip 1st 2 keywords) */\n\n    undefinedval = FALSE;\n    for (ii=3; ii <= nkeys; ii++)  \n    {\n       if (ffgnky(fptr, card, status) > 0)     /*  get next keyword  */\n           return(*status);\n\n       if (strncmp(keyroot, card, lenroot) == 0)  /* see if keyword matches */\n       {\n          keyindex[0] = '\\0';\n          equalssign = strchr(card, '=');\n\t  if (equalssign == 0) continue;  /* keyword has no value */\n\n          if (equalssign - card - lenroot > 7)\n          {\n             return (*status=BAD_KEYCHAR);\n          }\n          strncat(keyindex, &card[lenroot], equalssign - card  - lenroot);  /*  copy suffix  */\n\n          tstatus = 0;\n          if (ffc2ii(keyindex, &ival, &tstatus) <= 0)     /*  test suffix  */\n          {\n             if (ival <= nend && ival >= nstart)\n             {\n                ffpsvc(card, svalue, comm, status);   /*  parse the value */\n                ffc2i(svalue, &value[ival-nstart], status);  /* convert */\n                if (ival - nstart + 1 > *nfound)\n                      *nfound = ival - nstart + 1;  /*  max found */ \n\n                if (*status == VALUE_UNDEFINED)\n                {\n                    undefinedval = TRUE;\n                   *status = 0;  /* reset status to read remaining values */\n                }\n             }\n          }\n       }\n    }\n    if (undefinedval && (*status <= 0) )\n        *status = VALUE_UNDEFINED;  /* report at least 1 value undefined */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgknjj( fitsfile *fptr,    /* I - FITS file pointer                    */\n            const char *keyname,      /* I - root name of keywords to read        */\n            int  nstart,        /* I - starting index number                */\n            int  nmax,          /* I - maximum number of keywords to return */\n            LONGLONG *value,    /* O - array of keyword values              */\n            int  *nfound,       /* O - number of values that were returned  */\n            int  *status)       /* IO - error status                        */\n/*\n  Read (get) an indexed array of keywords with index numbers between\n  NSTART and (NSTART + NMAX -1) inclusive.  \n*/\n{\n    int nend, lenroot, ii, nkeys, mkeys, tstatus, undefinedval;\n    long ival;\n    char keyroot[FLEN_KEYWORD], keyindex[8], card[FLEN_CARD];\n    char svalue[FLEN_VALUE], comm[FLEN_COMMENT], *equalssign;\n\n    if (*status > 0)\n        return(*status);\n\n    *nfound = 0;\n    nend = nstart + nmax - 1;\n\n    keyroot[0] = '\\0';\n    strncat(keyroot, keyname, FLEN_KEYWORD - 1);\n\n    lenroot = strlen(keyroot);\n    \n    if (lenroot == 0)     /*  root must be at least 1 char long  */\n        return(*status);\n\n    for (ii=0; ii < lenroot; ii++)           /*  make sure upper case  */\n        keyroot[ii] = toupper(keyroot[ii]);\n\n    ffghps(fptr, &nkeys, &mkeys, status);  /*  get the number of keywords  */\n\n    ffmaky(fptr, 3, status);  /* move to 3rd keyword (skip 1st 2 keywords) */\n\n    undefinedval = FALSE;\n    for (ii=3; ii <= nkeys; ii++)  \n    {\n       if (ffgnky(fptr, card, status) > 0)     /*  get next keyword  */\n           return(*status);\n\n       if (strncmp(keyroot, card, lenroot) == 0)  /* see if keyword matches */\n       {\n          keyindex[0] = '\\0';\n          equalssign = strchr(card, '=');\n\t  if (equalssign == 0) continue;  /* keyword has no value */\n\n          if (equalssign - card - lenroot > 7)\n          {\n             return (*status=BAD_KEYCHAR);\n          }\n          strncat(keyindex, &card[lenroot], equalssign - card  - lenroot);  /*  copy suffix  */\n\n          tstatus = 0;\n          if (ffc2ii(keyindex, &ival, &tstatus) <= 0)     /*  test suffix  */\n          {\n             if (ival <= nend && ival >= nstart)\n             {\n                ffpsvc(card, svalue, comm, status);   /*  parse the value */\n                ffc2j(svalue, &value[ival-nstart], status);  /* convert */\n                if (ival - nstart + 1 > *nfound)\n                      *nfound = ival - nstart + 1;  /*  max found */ \n\n                if (*status == VALUE_UNDEFINED)\n                {\n                    undefinedval = TRUE;\n                   *status = 0;  /* reset status to read remaining values */\n                }\n             }\n          }\n       }\n    }\n    if (undefinedval && (*status <= 0) )\n        *status = VALUE_UNDEFINED;  /* report at least 1 value undefined */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgkne( fitsfile *fptr,     /* I - FITS file pointer                    */\n            const char *keyname,      /* I - root name of keywords to read        */\n            int  nstart,        /* I - starting index number                */\n            int  nmax,          /* I - maximum number of keywords to return */\n            float *value,       /* O - array of keyword values              */\n            int  *nfound,       /* O - number of values that were returned  */\n            int  *status)       /* IO - error status                        */\n/*\n  Read (get) an indexed array of keywords with index numbers between\n  NSTART and (NSTART + NMAX -1) inclusive.  \n*/\n{\n    int nend, lenroot, ii, nkeys, mkeys, tstatus, undefinedval;\n    long ival;\n    char keyroot[FLEN_KEYWORD], keyindex[8], card[FLEN_CARD];\n    char svalue[FLEN_VALUE], comm[FLEN_COMMENT], *equalssign;\n\n    if (*status > 0)\n        return(*status);\n\n    *nfound = 0;\n    nend = nstart + nmax - 1;\n\n    keyroot[0] = '\\0';\n    strncat(keyroot, keyname, FLEN_KEYWORD - 1);\n\n    lenroot = strlen(keyroot);\n    \n    if (lenroot == 0)     /*  root must be at least 1 char long  */\n        return(*status);\n\n    for (ii=0; ii < lenroot; ii++)           /*  make sure upper case  */\n        keyroot[ii] = toupper(keyroot[ii]);\n\n    ffghps(fptr, &nkeys, &mkeys, status);  /*  get the number of keywords  */\n\n    ffmaky(fptr, 3, status);  /* move to 3rd keyword (skip 1st 2 keywords) */\n\n    undefinedval = FALSE;\n    for (ii=3; ii <= nkeys; ii++)  \n    {\n       if (ffgnky(fptr, card, status) > 0)     /*  get next keyword  */\n           return(*status);\n\n       if (strncmp(keyroot, card, lenroot) == 0)  /* see if keyword matches */\n       {\n          keyindex[0] = '\\0';\n          equalssign = strchr(card, '=');\n\t  if (equalssign == 0) continue;  /* keyword has no value */\n\n          if (equalssign - card - lenroot > 7)\n          {\n             return (*status=BAD_KEYCHAR);\n          }\n          strncat(keyindex, &card[lenroot], equalssign - card  - lenroot);  /*  copy suffix  */\n\n          tstatus = 0;\n          if (ffc2ii(keyindex, &ival, &tstatus) <= 0)     /*  test suffix  */\n          {\n             if (ival <= nend && ival >= nstart)\n             {\n                ffpsvc(card, svalue, comm, status);   /*  parse the value */\n                ffc2r(svalue, &value[ival-nstart], status); /* convert */\n                if (ival - nstart + 1 > *nfound)\n                      *nfound = ival - nstart + 1;  /*  max found */ \n\n                if (*status == VALUE_UNDEFINED)\n                {\n                    undefinedval = TRUE;\n                   *status = 0;  /* reset status to read remaining values */\n                }\n             }\n          }\n       }\n    }\n    if (undefinedval && (*status <= 0) )\n        *status = VALUE_UNDEFINED;  /* report at least 1 value undefined */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgknd( fitsfile *fptr,     /* I - FITS file pointer                    */\n            const char *keyname,      /* I - root name of keywords to read        */\n            int  nstart,        /* I - starting index number                */\n            int  nmax,          /* I - maximum number of keywords to return */\n            double *value,      /* O - array of keyword values              */\n            int  *nfound,       /* O - number of values that were returned  */\n            int  *status)       /* IO - error status                        */\n/*\n  Read (get) an indexed array of keywords with index numbers between\n  NSTART and (NSTART + NMAX -1) inclusive.  \n*/\n{\n    int nend, lenroot, ii, nkeys, mkeys, tstatus, undefinedval;\n    long ival;\n    char keyroot[FLEN_KEYWORD], keyindex[8], card[FLEN_CARD];\n    char svalue[FLEN_VALUE], comm[FLEN_COMMENT], *equalssign;\n\n    if (*status > 0)\n        return(*status);\n\n    *nfound = 0;\n    nend = nstart + nmax - 1;\n\n    keyroot[0] = '\\0';\n    strncat(keyroot, keyname, FLEN_KEYWORD - 1);\n\n    lenroot = strlen(keyroot);\n\n    if (lenroot == 0)     /*  root must be at least 1 char long  */\n        return(*status);\n\n    for (ii=0; ii < lenroot; ii++)           /*  make sure upper case  */\n        keyroot[ii] = toupper(keyroot[ii]);\n\n    ffghps(fptr, &nkeys, &mkeys, status);  /*  get the number of keywords  */\n\n    ffmaky(fptr, 3, status);  /* move to 3rd keyword (skip 1st 2 keywords) */\n\n    undefinedval = FALSE;\n    for (ii=3; ii <= nkeys; ii++)  \n    {\n       if (ffgnky(fptr, card, status) > 0)     /*  get next keyword  */\n           return(*status);\n       if (strncmp(keyroot, card, lenroot) == 0)   /* see if keyword matches */\n       {\n          keyindex[0] = '\\0';\n          equalssign = strchr(card, '=');\n\t  if (equalssign == 0) continue;  /* keyword has no value */\n\n          if (equalssign - card - lenroot > 7)\n          {\n             return (*status=BAD_KEYCHAR);\n          }\n          strncat(keyindex, &card[lenroot], equalssign - card  - lenroot);  /*  copy suffix  */\n          tstatus = 0;\n          if (ffc2ii(keyindex, &ival, &tstatus) <= 0)      /*  test suffix */\n          {\n             if (ival <= nend && ival >= nstart) /* is index within range? */\n             {\n                ffpsvc(card, svalue, comm, status);   /*  parse the value */\n                ffc2d(svalue, &value[ival-nstart], status); /* convert */\n                if (ival - nstart + 1 > *nfound)\n                      *nfound = ival - nstart + 1;  /*  max found */ \n\n                if (*status == VALUE_UNDEFINED)\n                {\n                    undefinedval = TRUE;\n                   *status = 0;  /* reset status to read remaining values */\n                }\n             }\n          }\n       }\n    }\n    if (undefinedval && (*status <= 0) )\n        *status = VALUE_UNDEFINED;  /* report at least 1 value undefined */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgtdm(fitsfile *fptr,  /* I - FITS file pointer                        */\n           int colnum,      /* I - number of the column to read             */\n           int maxdim,      /* I - maximum no. of dimensions to read;       */\n           int *naxis,      /* O - number of axes in the data array         */\n           long naxes[],    /* O - length of each data axis                 */\n           int *status)     /* IO - error status                            */\n/*\n  read and parse the TDIMnnn keyword to get the dimensionality of a column\n*/\n{\n    int tstatus = 0;\n    char keyname[FLEN_KEYWORD], tdimstr[FLEN_VALUE];\n\n    if (*status > 0)\n        return(*status);\n\n    ffkeyn(\"TDIM\", colnum, keyname, status);      /* construct keyword name */\n\n    ffgkys(fptr, keyname, tdimstr, NULL, &tstatus); /* try reading keyword */\n\n    ffdtdm(fptr, tdimstr, colnum, maxdim,naxis, naxes, status); /* decode it */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgtdmll(fitsfile *fptr,  /* I - FITS file pointer                      */\n           int colnum,      /* I - number of the column to read             */\n           int maxdim,      /* I - maximum no. of dimensions to read;       */\n           int *naxis,      /* O - number of axes in the data array         */\n           LONGLONG naxes[], /* O - length of each data axis                 */\n           int *status)     /* IO - error status                            */\n/*\n  read and parse the TDIMnnn keyword to get the dimensionality of a column\n*/\n{\n    int tstatus = 0;\n    char keyname[FLEN_KEYWORD], tdimstr[FLEN_VALUE];\n\n    if (*status > 0)\n        return(*status);\n\n    ffkeyn(\"TDIM\", colnum, keyname, status);      /* construct keyword name */\n\n    ffgkys(fptr, keyname, tdimstr, NULL, &tstatus); /* try reading keyword */\n\n    ffdtdmll(fptr, tdimstr, colnum, maxdim,naxis, naxes, status); /* decode it */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffdtdm(fitsfile *fptr,  /* I - FITS file pointer                        */\n           char *tdimstr,   /* I - TDIMn keyword value string. e.g. (10,10) */\n           int colnum,      /* I - number of the column             */\n           int maxdim,      /* I - maximum no. of dimensions to read;       */\n           int *naxis,      /* O - number of axes in the data array         */\n           long naxes[],    /* O - length of each data axis                 */\n           int *status)     /* IO - error status                            */\n/*\n  decode the TDIMnnn keyword to get the dimensionality of a column.\n  Check that the value is legal and consistent with the TFORM value.\n  If colnum = 0, then the validity checking is disabled.\n*/\n{\n    long dimsize, totalpix = 1;\n    char *loc, *lastloc, message[FLEN_ERRMSG];\n    tcolumn *colptr = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    if (colnum != 0) {\n        if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n            ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n        if (colnum < 1 || colnum > (fptr->Fptr)->tfield)\n            return(*status = BAD_COL_NUM);\n\n        colptr = (fptr->Fptr)->tableptr;   /* set pointer to the first column */\n        colptr += (colnum - 1);    /* increment to the correct column */\n\n        if (!tdimstr[0])   /* TDIMn keyword doesn't exist? */\n        {\n            *naxis = 1;                   /* default = 1 dimensional */\n            if (maxdim > 0)\n                naxes[0] = (long) colptr->trepeat; /* default length = repeat */\n\n            return(*status);\n        }\n    }\n\n    *naxis = 0;\n\n    loc = strchr(tdimstr, '(' );  /* find the opening quote */\n    if (!loc)\n    {\n            snprintf(message, FLEN_ERRMSG, \"Illegal dimensions format: %s\", tdimstr);\n            return(*status = BAD_TDIM);\n    }\n\n    while (loc)\n    {\n            loc++;\n            dimsize = strtol(loc, &loc, 10);  /* read size of next dimension */\n            if (*naxis < maxdim)\n                naxes[*naxis] = dimsize;\n\n            if (dimsize < 0)\n            {\n                ffpmsg(\"one or more dimension are less than 0 (ffdtdm)\");\n                ffpmsg(tdimstr);\n                return(*status = BAD_TDIM);\n            }\n\n            totalpix *= dimsize;\n            (*naxis)++;\n            lastloc = loc;\n            loc = strchr(loc, ',');  /* look for comma before next dimension */\n    }\n\n    loc = strchr(lastloc, ')' );  /* check for the closing quote */\n    if (!loc)\n    {\n            snprintf(message, FLEN_ERRMSG, \"Illegal dimensions format: %s\", tdimstr);\n            return(*status = BAD_TDIM);\n    }\n\n    if (colnum != 0) {\n        if ((colptr->tdatatype > 0) && ((long) colptr->trepeat != totalpix))\n        {\n          snprintf(message, FLEN_ERRMSG,\n          \"column vector length, %ld, does not equal TDIMn array size, %ld\",\n          (long) colptr->trepeat, totalpix);\n          ffpmsg(message);\n          ffpmsg(tdimstr);\n          return(*status = BAD_TDIM);\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffdtdmll(fitsfile *fptr,  /* I - FITS file pointer                        */\n           char *tdimstr,   /* I - TDIMn keyword value string. e.g. (10,10) */\n           int colnum,      /* I - number of the column             */\n           int maxdim,      /* I - maximum no. of dimensions to read;       */\n           int *naxis,      /* O - number of axes in the data array         */\n           LONGLONG naxes[],    /* O - length of each data axis                 */\n           int *status)     /* IO - error status                            */\n/*\n  decode the TDIMnnn keyword to get the dimensionality of a column.\n  Check that the value is legal and consistent with the TFORM value.\n*/\n{\n    LONGLONG dimsize;\n    LONGLONG totalpix = 1;\n    char *loc, *lastloc, message[FLEN_ERRMSG];\n    tcolumn *colptr;\n    double doublesize;\n\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if (colnum < 1 || colnum > (fptr->Fptr)->tfield)\n        return(*status = BAD_COL_NUM);\n\n    colptr = (fptr->Fptr)->tableptr;   /* set pointer to the first column */\n    colptr += (colnum - 1);    /* increment to the correct column */\n\n    if (!tdimstr[0])   /* TDIMn keyword doesn't exist? */\n    {\n        *naxis = 1;                   /* default = 1 dimensional */\n        if (maxdim > 0)\n            naxes[0] = colptr->trepeat; /* default length = repeat */\n    }\n    else\n    {\n        *naxis = 0;\n\n        loc = strchr(tdimstr, '(' );  /* find the opening quote */\n        if (!loc)\n        {\n            snprintf(message, FLEN_ERRMSG, \"Illegal TDIM keyword value: %s\", tdimstr);\n            return(*status = BAD_TDIM);\n        }\n\n        while (loc)\n        {\n            loc++;\n\n    /* Read value as a double because the string to 64-bit int function is  */\n    /* platform dependent (strtoll, strtol, _atoI64).  This still gives     */\n    /* about 48 bits of precision, which is plenty for this purpose.        */\n\n            doublesize = strtod(loc, &loc);\n            dimsize = (LONGLONG) (doublesize + 0.1);\n\n            if (*naxis < maxdim)\n                naxes[*naxis] = dimsize;\n\n            if (dimsize < 0)\n            {\n                ffpmsg(\"one or more TDIM values are less than 0 (ffdtdm)\");\n                ffpmsg(tdimstr);\n                return(*status = BAD_TDIM);\n            }\n\n            totalpix *= dimsize;\n            (*naxis)++;\n            lastloc = loc;\n            loc = strchr(loc, ',');  /* look for comma before next dimension */\n        }\n\n        loc = strchr(lastloc, ')' );  /* check for the closing quote */\n        if (!loc)\n        {\n            snprintf(message, FLEN_ERRMSG, \"Illegal TDIM keyword value: %s\", tdimstr);\n            return(*status = BAD_TDIM);\n        }\n\n        if ((colptr->tdatatype > 0) && (colptr->trepeat != totalpix))\n        {\n          snprintf(message, FLEN_ERRMSG,\n          \"column vector length, %.0f, does not equal TDIMn array size, %.0f\",\n          (double) (colptr->trepeat), (double) totalpix);\n          ffpmsg(message);\n          ffpmsg(tdimstr);\n          return(*status = BAD_TDIM);\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffghpr(fitsfile *fptr,  /* I - FITS file pointer                        */\n           int maxdim,      /* I - maximum no. of dimensions to read;       */\n           int *simple,     /* O - does file conform to FITS standard? 1/0  */\n           int *bitpix,     /* O - number of bits per data value pixel      */\n           int *naxis,      /* O - number of axes in the data array         */\n           long naxes[],    /* O - length of each data axis                 */\n           long *pcount,    /* O - number of group parameters (usually 0)   */\n           long *gcount,    /* O - number of random groups (usually 1 or 0) */\n           int *extend,     /* O - may FITS file haave extensions?          */\n           int *status)     /* IO - error status                            */\n/*\n  Get keywords from the Header of the PRimary array:\n  Check that the keywords conform to the FITS standard and return the\n  parameters which determine the size and structure of the primary array\n  or IMAGE extension.\n*/\n{\n    int idummy, ii;\n    LONGLONG lldummy;\n    double ddummy;\n    LONGLONG tnaxes[99];\n\n    ffgphd(fptr, maxdim, simple, bitpix, naxis, tnaxes, pcount, gcount, extend,\n          &ddummy, &ddummy, &lldummy, &idummy, status);\n\t  \n    if (naxis && naxes) {\n         for (ii = 0; (ii < *naxis) && (ii < maxdim); ii++)\n\t     naxes[ii] = (long) tnaxes[ii];\n    } else if (naxes) {\n         for (ii = 0; ii < maxdim; ii++)\n\t     naxes[ii] = (long) tnaxes[ii];\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffghprll(fitsfile *fptr,  /* I - FITS file pointer                        */\n           int maxdim,      /* I - maximum no. of dimensions to read;       */\n           int *simple,     /* O - does file conform to FITS standard? 1/0  */\n           int *bitpix,     /* O - number of bits per data value pixel      */\n           int *naxis,      /* O - number of axes in the data array         */\n           LONGLONG naxes[],    /* O - length of each data axis                 */\n           long *pcount,    /* O - number of group parameters (usually 0)   */\n           long *gcount,    /* O - number of random groups (usually 1 or 0) */\n           int *extend,     /* O - may FITS file haave extensions?          */\n           int *status)     /* IO - error status                            */\n/*\n  Get keywords from the Header of the PRimary array:\n  Check that the keywords conform to the FITS standard and return the\n  parameters which determine the size and structure of the primary array\n  or IMAGE extension.\n*/\n{\n    int idummy;\n    LONGLONG lldummy;\n    double ddummy;\n\n    ffgphd(fptr, maxdim, simple, bitpix, naxis, naxes, pcount, gcount, extend,\n          &ddummy, &ddummy, &lldummy, &idummy, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffghtb(fitsfile *fptr,  /* I - FITS file pointer                        */\n           int maxfield,    /* I - maximum no. of columns to read;          */\n           long *naxis1,    /* O - length of table row in bytes             */\n           long *naxis2,    /* O - number of rows in the table              */\n           int *tfields,    /* O - number of columns in the table           */\n           char **ttype,    /* O - name of each column                      */\n           long *tbcol,     /* O - byte offset in row to each column        */\n           char **tform,    /* O - value of TFORMn keyword for each column  */\n           char **tunit,    /* O - value of TUNITn keyword for each column  */\n           char *extnm,   /* O - value of EXTNAME keyword, if any         */\n           int *status)     /* IO - error status                            */\n/*\n  Get keywords from the Header of the ASCII TaBle:\n  Check that the keywords conform to the FITS standard and return the\n  parameters which describe the table.\n*/\n{\n    int ii, maxf, nfound, tstatus;\n    long fields;\n    char name[FLEN_KEYWORD], value[FLEN_VALUE], comm[FLEN_COMMENT];\n    char xtension[FLEN_VALUE], message[FLEN_ERRMSG];\n    LONGLONG llnaxis1, llnaxis2, pcount;\n\n    if (*status > 0)\n        return(*status);\n\n    /* read the first keyword of the extension */\n    ffgkyn(fptr, 1, name, value, comm, status);\n\n    if (!strcmp(name, \"XTENSION\"))\n    {\n            if (ffc2s(value, xtension, status) > 0)  /* get the value string */\n            {\n                ffpmsg(\"Bad value string for XTENSION keyword:\");\n                ffpmsg(value);\n                return(*status);\n            }\n\n            /* allow the quoted string value to begin in any column and */\n            /* allow any number of trailing blanks before the closing quote */\n            if ( (value[0] != '\\'')   ||  /* first char must be a quote */\n                 ( strcmp(xtension, \"TABLE\") ) )\n            {\n                snprintf(message, FLEN_ERRMSG,\n                \"This is not a TABLE extension: %s\", value);\n                ffpmsg(message);\n                return(*status = NOT_ATABLE);\n            }\n    }\n\n    else  /* error: 1st keyword of extension != XTENSION */\n    {\n        snprintf(message, FLEN_ERRMSG,\n        \"First keyword of the extension is not XTENSION: %s\", name);\n        ffpmsg(message);\n        return(*status = NO_XTENSION);\n    }\n\n    if (ffgttb(fptr, &llnaxis1, &llnaxis2, &pcount, &fields, status) > 0)\n        return(*status);\n\n    if (naxis1)\n       *naxis1 = (long) llnaxis1;\n\n    if (naxis2)\n       *naxis2 = (long) llnaxis2;\n\n    if (pcount != 0)\n    {\n       snprintf(message, FLEN_ERRMSG, \"PCOUNT = %.0f is illegal in ASCII table; must = 0\",\n               (double) pcount);\n       ffpmsg(message);\n       return(*status = BAD_PCOUNT);\n    }\n\n    if (tfields)\n       *tfields = fields;\n\n    if (maxfield < 0)\n        maxf = fields;\n    else\n        maxf = minvalue(maxfield, fields);\n\n    if (maxf > 0)\n    {\n        for (ii = 0; ii < maxf; ii++)\n        {   /* initialize optional keyword values */\n            if (ttype)\n                *ttype[ii] = '\\0';   \n\n            if (tunit)\n                *tunit[ii] = '\\0';\n        }\n\n   \n        if (ttype)\n            ffgkns(fptr, \"TTYPE\", 1, maxf, ttype, &nfound, status);\n\n        if (tunit)\n            ffgkns(fptr, \"TUNIT\", 1, maxf, tunit, &nfound, status);\n\n        if (*status > 0)\n            return(*status);\n\n        if (tbcol)\n        {\n            ffgknj(fptr, \"TBCOL\", 1, maxf, tbcol, &nfound, status);\n\n            if (*status > 0 || nfound != maxf)\n            {\n                ffpmsg(\n        \"Required TBCOL keyword(s) not found in ASCII table header (ffghtb).\");\n                return(*status = NO_TBCOL);\n            }\n        }\n\n        if (tform)\n        {\n            ffgkns(fptr, \"TFORM\", 1, maxf, tform, &nfound, status);\n\n            if (*status > 0 || nfound != maxf)\n            {\n                ffpmsg(\n        \"Required TFORM keyword(s) not found in ASCII table header (ffghtb).\");\n                return(*status = NO_TFORM);\n            }\n        }\n    }\n\n    if (extnm)\n    {\n        extnm[0] = '\\0';\n\n        tstatus = *status;\n        ffgkys(fptr, \"EXTNAME\", extnm, comm, status);\n\n        if (*status == KEY_NO_EXIST)\n            *status = tstatus;  /* keyword not required, so ignore error */\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffghtbll(fitsfile *fptr, /* I - FITS file pointer                        */\n           int maxfield,    /* I - maximum no. of columns to read;          */\n           LONGLONG *naxis1, /* O - length of table row in bytes             */\n           LONGLONG *naxis2, /* O - number of rows in the table              */\n           int *tfields,    /* O - number of columns in the table           */\n           char **ttype,    /* O - name of each column                      */\n           LONGLONG *tbcol, /* O - byte offset in row to each column        */\n           char **tform,    /* O - value of TFORMn keyword for each column  */\n           char **tunit,    /* O - value of TUNITn keyword for each column  */\n           char *extnm,     /* O - value of EXTNAME keyword, if any         */\n           int *status)     /* IO - error status                            */\n/*\n  Get keywords from the Header of the ASCII TaBle:\n  Check that the keywords conform to the FITS standard and return the\n  parameters which describe the table.\n*/\n{\n    int ii, maxf, nfound, tstatus;\n    long fields;\n    char name[FLEN_KEYWORD], value[FLEN_VALUE], comm[FLEN_COMMENT];\n    char xtension[FLEN_VALUE], message[FLEN_ERRMSG];\n    LONGLONG llnaxis1, llnaxis2, pcount;\n\n    if (*status > 0)\n        return(*status);\n\n    /* read the first keyword of the extension */\n    ffgkyn(fptr, 1, name, value, comm, status);\n\n    if (!strcmp(name, \"XTENSION\"))\n    {\n            if (ffc2s(value, xtension, status) > 0)  /* get the value string */\n            {\n                ffpmsg(\"Bad value string for XTENSION keyword:\");\n                ffpmsg(value);\n                return(*status);\n            }\n\n            /* allow the quoted string value to begin in any column and */\n            /* allow any number of trailing blanks before the closing quote */\n            if ( (value[0] != '\\'')   ||  /* first char must be a quote */\n                 ( strcmp(xtension, \"TABLE\") ) )\n            {\n                snprintf(message, FLEN_ERRMSG,\n                \"This is not a TABLE extension: %s\", value);\n                ffpmsg(message);\n                return(*status = NOT_ATABLE);\n            }\n    }\n\n    else  /* error: 1st keyword of extension != XTENSION */\n    {\n        snprintf(message, FLEN_ERRMSG,\n        \"First keyword of the extension is not XTENSION: %s\", name);\n        ffpmsg(message);\n        return(*status = NO_XTENSION);\n    }\n\n    if (ffgttb(fptr, &llnaxis1, &llnaxis2, &pcount, &fields, status) > 0)\n        return(*status);\n\n    if (naxis1)\n       *naxis1 = llnaxis1;\n\n    if (naxis2)\n       *naxis2 = llnaxis2;\n\n    if (pcount != 0)\n    {\n       snprintf(message, FLEN_ERRMSG, \"PCOUNT = %.0f is illegal in ASCII table; must = 0\",\n             (double) pcount);\n       ffpmsg(message);\n       return(*status = BAD_PCOUNT);\n    }\n\n    if (tfields)\n       *tfields = fields;\n\n    if (maxfield < 0)\n        maxf = fields;\n    else\n        maxf = minvalue(maxfield, fields);\n\n    if (maxf > 0)\n    {\n        for (ii = 0; ii < maxf; ii++)\n        {   /* initialize optional keyword values */\n            if (ttype)\n                *ttype[ii] = '\\0';   \n\n            if (tunit)\n                *tunit[ii] = '\\0';\n        }\n\n   \n        if (ttype)\n            ffgkns(fptr, \"TTYPE\", 1, maxf, ttype, &nfound, status);\n\n        if (tunit)\n            ffgkns(fptr, \"TUNIT\", 1, maxf, tunit, &nfound, status);\n\n        if (*status > 0)\n            return(*status);\n\n        if (tbcol)\n        {\n            ffgknjj(fptr, \"TBCOL\", 1, maxf, tbcol, &nfound, status);\n\n            if (*status > 0 || nfound != maxf)\n            {\n                ffpmsg(\n        \"Required TBCOL keyword(s) not found in ASCII table header (ffghtbll).\");\n                return(*status = NO_TBCOL);\n            }\n        }\n\n        if (tform)\n        {\n            ffgkns(fptr, \"TFORM\", 1, maxf, tform, &nfound, status);\n\n            if (*status > 0 || nfound != maxf)\n            {\n                ffpmsg(\n        \"Required TFORM keyword(s) not found in ASCII table header (ffghtbll).\");\n                return(*status = NO_TFORM);\n            }\n        }\n    }\n\n    if (extnm)\n    {\n        extnm[0] = '\\0';\n\n        tstatus = *status;\n        ffgkys(fptr, \"EXTNAME\", extnm, comm, status);\n\n        if (*status == KEY_NO_EXIST)\n            *status = tstatus;  /* keyword not required, so ignore error */\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffghbn(fitsfile *fptr,  /* I - FITS file pointer                        */\n           int maxfield,    /* I - maximum no. of columns to read;          */\n           long *naxis2,    /* O - number of rows in the table              */\n           int *tfields,    /* O - number of columns in the table           */\n           char **ttype,    /* O - name of each column                      */\n           char **tform,    /* O - TFORMn value for each column             */\n           char **tunit,    /* O - TUNITn value for each column             */\n           char *extnm,     /* O - value of EXTNAME keyword, if any         */\n           long *pcount,    /* O - value of PCOUNT keyword                  */\n           int *status)     /* IO - error status                            */\n/*\n  Get keywords from the Header of the BiNary table:\n  Check that the keywords conform to the FITS standard and return the\n  parameters which describe the table.\n*/\n{\n    int ii, maxf, nfound, tstatus;\n    long  fields;\n    char name[FLEN_KEYWORD], value[FLEN_VALUE], comm[FLEN_COMMENT];\n    char xtension[FLEN_VALUE], message[FLEN_ERRMSG];\n    LONGLONG naxis1ll, naxis2ll, pcountll;\n\n    if (*status > 0)\n        return(*status);\n\n    /* read the first keyword of the extension */\n    ffgkyn(fptr, 1, name, value, comm, status);\n\n    if (!strcmp(name, \"XTENSION\"))\n    {\n            if (ffc2s(value, xtension, status) > 0)  /* get the value string */\n            {\n                ffpmsg(\"Bad value string for XTENSION keyword:\");\n                ffpmsg(value);\n                return(*status);\n            }\n\n            /* allow the quoted string value to begin in any column and */\n            /* allow any number of trailing blanks before the closing quote */\n            if ( (value[0] != '\\'')   ||  /* first char must be a quote */\n                 ( strcmp(xtension, \"BINTABLE\") &&\n                   strcmp(xtension, \"A3DTABLE\") &&\n                   strcmp(xtension, \"3DTABLE\")\n                 ) )\n            {\n                snprintf(message, FLEN_ERRMSG,\n                \"This is not a BINTABLE extension: %s\", value);\n                ffpmsg(message);\n                return(*status = NOT_BTABLE);\n            }\n    }\n\n    else  /* error: 1st keyword of extension != XTENSION */\n    {\n        snprintf(message, FLEN_ERRMSG,\n        \"First keyword of the extension is not XTENSION: %s\", name);\n        ffpmsg(message);\n        return(*status = NO_XTENSION);\n    }\n\n    if (ffgttb(fptr, &naxis1ll, &naxis2ll, &pcountll, &fields, status) > 0)\n        return(*status);\n\n    if (naxis2)\n       *naxis2 = (long) naxis2ll;\n\n    if (pcount)\n       *pcount = (long) pcountll;\n\n    if (tfields)\n        *tfields = fields;\n\n    if (maxfield < 0)\n        maxf = fields;\n    else\n        maxf = minvalue(maxfield, fields);\n\n    if (maxf > 0)\n    {\n        for (ii = 0; ii < maxf; ii++)\n        {   /* initialize optional keyword values */\n            if (ttype)\n                *ttype[ii] = '\\0';   \n\n            if (tunit)\n                *tunit[ii] = '\\0';\n        }\n\n        if (ttype)\n            ffgkns(fptr, \"TTYPE\", 1, maxf, ttype, &nfound, status);\n\n        if (tunit)\n            ffgkns(fptr, \"TUNIT\", 1, maxf, tunit, &nfound, status);\n\n        if (*status > 0)\n            return(*status);\n\n        if (tform)\n        {\n            ffgkns(fptr, \"TFORM\", 1, maxf, tform, &nfound, status);\n\n            if (*status > 0 || nfound != maxf)\n            {\n                ffpmsg(\n        \"Required TFORM keyword(s) not found in binary table header (ffghbn).\");\n                return(*status = NO_TFORM);\n            }\n        }\n    }\n\n    if (extnm)\n    {\n        extnm[0] = '\\0';\n\n        tstatus = *status;\n        ffgkys(fptr, \"EXTNAME\", extnm, comm, status);\n\n        if (*status == KEY_NO_EXIST)\n          *status = tstatus;  /* keyword not required, so ignore error */\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffghbnll(fitsfile *fptr,  /* I - FITS file pointer                        */\n           int maxfield,    /* I - maximum no. of columns to read;          */\n           LONGLONG *naxis2,    /* O - number of rows in the table              */\n           int *tfields,    /* O - number of columns in the table           */\n           char **ttype,    /* O - name of each column                      */\n           char **tform,    /* O - TFORMn value for each column             */\n           char **tunit,    /* O - TUNITn value for each column             */\n           char *extnm,     /* O - value of EXTNAME keyword, if any         */\n           LONGLONG *pcount,    /* O - value of PCOUNT keyword                  */\n           int *status)     /* IO - error status                            */\n/*\n  Get keywords from the Header of the BiNary table:\n  Check that the keywords conform to the FITS standard and return the\n  parameters which describe the table.\n*/\n{\n    int ii, maxf, nfound, tstatus;\n    long  fields;\n    char name[FLEN_KEYWORD], value[FLEN_VALUE], comm[FLEN_COMMENT];\n    char xtension[FLEN_VALUE], message[FLEN_ERRMSG];\n    LONGLONG naxis1ll, naxis2ll, pcountll;\n\n    if (*status > 0)\n        return(*status);\n\n    /* read the first keyword of the extension */\n    ffgkyn(fptr, 1, name, value, comm, status);\n\n    if (!strcmp(name, \"XTENSION\"))\n    {\n            if (ffc2s(value, xtension, status) > 0)  /* get the value string */\n            {\n                ffpmsg(\"Bad value string for XTENSION keyword:\");\n                ffpmsg(value);\n                return(*status);\n            }\n\n            /* allow the quoted string value to begin in any column and */\n            /* allow any number of trailing blanks before the closing quote */\n            if ( (value[0] != '\\'')   ||  /* first char must be a quote */\n                 ( strcmp(xtension, \"BINTABLE\") &&\n                   strcmp(xtension, \"A3DTABLE\") &&\n                   strcmp(xtension, \"3DTABLE\")\n                 ) )\n            {\n                snprintf(message, FLEN_ERRMSG,\n                \"This is not a BINTABLE extension: %s\", value);\n                ffpmsg(message);\n                return(*status = NOT_BTABLE);\n            }\n    }\n\n    else  /* error: 1st keyword of extension != XTENSION */\n    {\n        snprintf(message, FLEN_ERRMSG,\n        \"First keyword of the extension is not XTENSION: %s\", name);\n        ffpmsg(message);\n        return(*status = NO_XTENSION);\n    }\n\n    if (ffgttb(fptr, &naxis1ll, &naxis2ll, &pcountll, &fields, status) > 0)\n        return(*status);\n\n    if (naxis2)\n       *naxis2 = naxis2ll;\n\n    if (pcount)\n       *pcount = pcountll;\n\n    if (tfields)\n        *tfields = fields;\n\n    if (maxfield < 0)\n        maxf = fields;\n    else\n        maxf = minvalue(maxfield, fields);\n\n    if (maxf > 0)\n    {\n        for (ii = 0; ii < maxf; ii++)\n        {   /* initialize optional keyword values */\n            if (ttype)\n                *ttype[ii] = '\\0';   \n\n            if (tunit)\n                *tunit[ii] = '\\0';\n        }\n\n        if (ttype)\n            ffgkns(fptr, \"TTYPE\", 1, maxf, ttype, &nfound, status);\n\n        if (tunit)\n            ffgkns(fptr, \"TUNIT\", 1, maxf, tunit, &nfound, status);\n\n        if (*status > 0)\n            return(*status);\n\n        if (tform)\n        {\n            ffgkns(fptr, \"TFORM\", 1, maxf, tform, &nfound, status);\n\n            if (*status > 0 || nfound != maxf)\n            {\n                ffpmsg(\n        \"Required TFORM keyword(s) not found in binary table header (ffghbn).\");\n                return(*status = NO_TFORM);\n            }\n        }\n    }\n\n    if (extnm)\n    {\n        extnm[0] = '\\0';\n\n        tstatus = *status;\n        ffgkys(fptr, \"EXTNAME\", extnm, comm, status);\n\n        if (*status == KEY_NO_EXIST)\n          *status = tstatus;  /* keyword not required, so ignore error */\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgphd(fitsfile *fptr,  /* I - FITS file pointer                        */\n           int maxdim,      /* I - maximum no. of dimensions to read;       */\n           int *simple,     /* O - does file conform to FITS standard? 1/0  */\n           int *bitpix,     /* O - number of bits per data value pixel      */\n           int *naxis,      /* O - number of axes in the data array         */\n           LONGLONG naxes[],    /* O - length of each data axis                 */\n           long *pcount,    /* O - number of group parameters (usually 0)   */\n           long *gcount,    /* O - number of random groups (usually 1 or 0) */\n           int *extend,     /* O - may FITS file haave extensions?          */\n           double *bscale,  /* O - array pixel linear scaling factor        */\n           double *bzero,   /* O - array pixel linear scaling zero point    */\n           LONGLONG *blank, /* O - value used to represent undefined pixels */\n           int *nspace,     /* O - number of blank keywords prior to END    */\n           int *status)     /* IO - error status                            */\n{\n/*\n  Get the Primary HeaDer parameters.  Check that the keywords conform to\n  the FITS standard and return the parameters which determine the size and\n  structure of the primary array or IMAGE extension.\n*/\n    int unknown, found_end, tstatus, ii, nextkey, namelen;\n    long longbitpix, longnaxis;\n    LONGLONG axislen;\n    char message[FLEN_ERRMSG], keyword[FLEN_KEYWORD];\n    char card[FLEN_CARD];\n    char name[FLEN_KEYWORD], value[FLEN_VALUE], comm[FLEN_COMMENT];\n    char xtension[FLEN_VALUE];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if (simple)\n       *simple = 1;\n\n    unknown = 0;\n\n    /*--------------------------------------------------------------------*/\n    /*  Get 1st keyword of HDU and test whether it is SIMPLE or XTENSION  */\n    /*--------------------------------------------------------------------*/\n    ffgkyn(fptr, 1, name, value, comm, status);\n\n    if ((fptr->Fptr)->curhdu == 0) /* Is this the beginning of the FITS file? */\n    {\n        if (!strcmp(name, \"SIMPLE\"))\n        {\n            if (value[0] == 'F')\n            {\n                if (simple)\n                    *simple=0;          /* not a simple FITS file */\n            }\n            else if (value[0] != 'T')\n                return(*status = BAD_SIMPLE);\n        }\n\n        else\n        {\n            snprintf(message, FLEN_ERRMSG,\n                   \"First keyword of the file is not SIMPLE: %s\", name);\n            ffpmsg(message);\n            return(*status = NO_SIMPLE);\n        }\n    }\n\n    else    /* not beginning of the file, so presumably an IMAGE extension */\n    {       /* or it could be a compressed image in a binary table */\n\n        if (!strcmp(name, \"XTENSION\"))\n        {\n            if (ffc2s(value, xtension, status) > 0)  /* get the value string */\n            {\n                ffpmsg(\"Bad value string for XTENSION keyword:\");\n                ffpmsg(value);\n                return(*status);\n            }\n\n            /* allow the quoted string value to begin in any column and */\n            /* allow any number of trailing blanks before the closing quote */\n            if ( (value[0] != '\\'')   ||  /* first char must be a quote */\n                  ( strcmp(xtension, \"IMAGE\")  &&\n                    strcmp(xtension, \"IUEIMAGE\") ) )\n            {\n                unknown = 1;  /* unknown type of extension; press on anyway */\n                snprintf(message, FLEN_ERRMSG,\n                   \"This is not an IMAGE extension: %s\", value);\n                ffpmsg(message);\n            }\n        }\n\n        else  /* error: 1st keyword of extension != XTENSION */\n        {\n            snprintf(message, FLEN_ERRMSG,\n            \"First keyword of the extension is not XTENSION: %s\", name);\n            ffpmsg(message);\n            return(*status = NO_XTENSION);\n        }\n    }\n\n    if (unknown && (fptr->Fptr)->compressimg)\n    {\n        /* this is a compressed image, so read ZBITPIX, ZNAXIS keywords */\n        unknown = 0;  /* reset flag */\n        ffxmsg(3, message); /* clear previous spurious error message */\n\n        if (bitpix)\n        {\n            ffgidt(fptr, bitpix, status); /* get bitpix value */\n\n            if (*status > 0)\n            {\n                ffpmsg(\"Error reading BITPIX value of compressed image\");\n                return(*status);\n            }\n        }\n\n        if (naxis)\n        {\n            ffgidm(fptr, naxis, status); /* get NAXIS value */\n\n            if (*status > 0)\n            {\n                ffpmsg(\"Error reading NAXIS value of compressed image\");\n                return(*status);\n            }\n        }\n\n        if (naxes)\n        {\n            ffgiszll(fptr, maxdim, naxes, status);  /* get NAXISn value */\n\n            if (*status > 0)\n            {\n                ffpmsg(\"Error reading NAXISn values of compressed image\");\n                return(*status);\n            }\n        }\n\n        nextkey = 9; /* skip required table keywords in the following search */\n    }\n    else\n    {\n\n        /*----------------------------------------------------------------*/\n        /*  Get 2nd keyword;  test whether it is BITPIX with legal value  */\n        /*----------------------------------------------------------------*/\n        ffgkyn(fptr, 2, name, value, comm, status);  /* BITPIX = 2nd keyword */\n\n        if (strcmp(name, \"BITPIX\"))\n        {\n            snprintf(message, FLEN_ERRMSG,\n            \"Second keyword of the extension is not BITPIX: %s\", name);\n            ffpmsg(message);\n            return(*status = NO_BITPIX);\n        }\n\n        if (ffc2ii(value,  &longbitpix, status) > 0)\n        {\n            snprintf(message, FLEN_ERRMSG,\n            \"Value of BITPIX keyword is not an integer: %s\", value);\n            ffpmsg(message);\n            return(*status = BAD_BITPIX);\n        }\n        else if (longbitpix != BYTE_IMG && longbitpix != SHORT_IMG &&\n             longbitpix != LONG_IMG && longbitpix != LONGLONG_IMG &&\n             longbitpix != FLOAT_IMG && longbitpix != DOUBLE_IMG)\n        {\n            snprintf(message, FLEN_ERRMSG,\n            \"Illegal value for BITPIX keyword: %s\", value);\n            ffpmsg(message);\n            return(*status = BAD_BITPIX);\n        }\n        if (bitpix)\n            *bitpix = longbitpix;  /* do explicit type conversion */\n\n        /*---------------------------------------------------------------*/\n        /*  Get 3rd keyword;  test whether it is NAXIS with legal value  */\n        /*---------------------------------------------------------------*/\n        ffgtkn(fptr, 3, \"NAXIS\",  &longnaxis, status);\n\n        if (*status == BAD_ORDER)\n            return(*status = NO_NAXIS);\n        else if (*status == NOT_POS_INT || longnaxis > 999)\n        {\n            snprintf(message,FLEN_ERRMSG,\"NAXIS = %ld is illegal\", longnaxis);\n            ffpmsg(message);\n            return(*status = BAD_NAXIS);\n        }\n        else\n            if (naxis)\n                 *naxis = longnaxis;  /* do explicit type conversion */\n\n        /*---------------------------------------------------------*/\n        /*  Get the next NAXISn keywords and test for legal values */\n        /*---------------------------------------------------------*/\n        for (ii=0, nextkey=4; ii < longnaxis; ii++, nextkey++)\n        {\n            ffkeyn(\"NAXIS\", ii+1, keyword, status);\n            ffgtknjj(fptr, 4+ii, keyword, &axislen, status);\n\n            if (*status == BAD_ORDER)\n                return(*status = NO_NAXES);\n            else if (*status == NOT_POS_INT)\n                return(*status = BAD_NAXES);\n            else if (ii < maxdim)\n                if (naxes)\n                    naxes[ii] = axislen;\n        }\n    }\n\n    /*---------------------------------------------------------*/\n    /*  now look for other keywords of interest:               */\n    /*  BSCALE, BZERO, BLANK, PCOUNT, GCOUNT, EXTEND, and END  */\n    /*---------------------------------------------------------*/\n\n    /*  initialize default values in case keyword is not present */\n    if (bscale)\n        *bscale = 1.0;\n    if (bzero)\n        *bzero  = 0.0;\n    if (pcount)\n        *pcount = 0;\n    if (gcount)\n        *gcount = 1;\n    if (extend)\n        *extend = 0;\n    if (blank)\n      *blank = NULL_UNDEFINED; /* no default null value for BITPIX=8,16,32 */\n\n    *nspace = 0;\n    found_end = 0;\n    tstatus = *status;\n\n    for (; !found_end; nextkey++)  \n    {\n      /* get next keyword */\n      /* don't use ffgkyn here because it trys to parse the card to read */\n      /* the value string, thus failing to read the file just because of */\n      /* minor syntax errors in optional keywords.                       */\n\n      if (ffgrec(fptr, nextkey, card, status) > 0 )  /* get the 80-byte card */\n      {\n        if (*status == KEY_OUT_BOUNDS)\n        {\n          found_end = 1;  /* simply hit the end of the header */\n          *status = tstatus;  /* reset error status */\n        }\n        else          \n        {\n          ffpmsg(\"Failed to find the END keyword in header (ffgphd).\");\n        }\n      }\n      else /* got the next keyword without error */\n      {\n        ffgknm(card, name, &namelen, status); /* get the keyword name */\n\n        if (fftrec(name, status) > 0)  /* test keyword name; catches no END */\n        {\n          snprintf(message, FLEN_ERRMSG,\n              \"Name of keyword no. %d contains illegal character(s): %s\",\n              nextkey, name);\n          ffpmsg(message);\n\n          if (nextkey % 36 == 0) /* test if at beginning of 36-card record */\n            ffpmsg(\"  (This may indicate a missing END keyword).\");\n        }\n\n        if (!strcmp(name, \"BSCALE\") && bscale)\n        {\n            *nspace = 0;  /* reset count of blank keywords */\n            ffpsvc(card, value, comm, status); /* parse value and comment */\n\n            if (ffc2dd(value, bscale, status) > 0) /* convert to double */\n            {\n                /* reset error status and continue, but still issue warning */\n                *status = tstatus;\n                *bscale = 1.0;\n\n                snprintf(message, FLEN_ERRMSG,\n                \"Error reading BSCALE keyword value as a double: %s\", value);\n                ffpmsg(message);\n            }\n        }\n\n        else if (!strcmp(name, \"BZERO\") && bzero)\n        {\n            *nspace = 0;  /* reset count of blank keywords */\n            ffpsvc(card, value, comm, status); /* parse value and comment */\n\n            if (ffc2dd(value, bzero, status) > 0) /* convert to double */\n            {\n                /* reset error status and continue, but still issue warning */\n                *status = tstatus;\n                *bzero = 0.0;\n\n                snprintf(message, FLEN_ERRMSG,\n                \"Error reading BZERO keyword value as a double: %s\", value);\n                ffpmsg(message);\n            }\n        }\n\n        else if (!strcmp(name, \"BLANK\") && blank)\n        {\n            *nspace = 0;  /* reset count of blank keywords */\n            ffpsvc(card, value, comm, status); /* parse value and comment */\n\n            if (ffc2jj(value, blank, status) > 0) /* convert to LONGLONG */\n            {\n                /* reset error status and continue, but still issue warning */\n                *status = tstatus;\n                *blank = NULL_UNDEFINED;\n\n                snprintf(message, FLEN_ERRMSG,\n                \"Error reading BLANK keyword value as an integer: %s\", value);\n                ffpmsg(message);\n            }\n        }\n\n        else if (!strcmp(name, \"PCOUNT\") && pcount)\n        {\n            *nspace = 0;  /* reset count of blank keywords */\n            ffpsvc(card, value, comm, status); /* parse value and comment */\n\n            if (ffc2ii(value, pcount, status) > 0) /* convert to long */\n            {\n                snprintf(message, FLEN_ERRMSG,\n                \"Error reading PCOUNT keyword value as an integer: %s\", value);\n                ffpmsg(message);\n            }\n        }\n\n        else if (!strcmp(name, \"GCOUNT\") && gcount)\n        {\n            *nspace = 0;  /* reset count of blank keywords */\n            ffpsvc(card, value, comm, status); /* parse value and comment */\n\n            if (ffc2ii(value, gcount, status) > 0) /* convert to long */\n            {\n                snprintf(message, FLEN_ERRMSG,\n                \"Error reading GCOUNT keyword value as an integer: %s\", value);\n                ffpmsg(message);\n            }\n        }\n\n        else if (!strcmp(name, \"EXTEND\") && extend)\n        {\n            *nspace = 0;  /* reset count of blank keywords */\n            ffpsvc(card, value, comm, status); /* parse value and comment */\n\n            if (ffc2ll(value, extend, status) > 0) /* convert to logical */\n            {\n                /* reset error status and continue, but still issue warning */\n                *status = tstatus;\n                *extend = 0;\n\n                snprintf(message, FLEN_ERRMSG,\n                \"Error reading EXTEND keyword value as a logical: %s\", value);\n                ffpmsg(message);\n            }\n        }\n\n        else if (!strcmp(name, \"END\"))\n            found_end = 1;\n\n        else if (!card[0] )\n            *nspace = *nspace + 1;  /* this is a blank card in the header */\n\n        else\n            *nspace = 0;  /* reset count of blank keywords immediately\n                            before the END keyword to zero   */\n      }\n\n      if (*status > 0)  /* exit on error after writing error message */\n      {\n        if ((fptr->Fptr)->curhdu == 0)\n            ffpmsg(\n            \"Failed to read the required primary array header keywords.\");\n        else\n            ffpmsg(\n            \"Failed to read the required image extension header keywords.\");\n\n        return(*status);\n      }\n    }\n\n    if (unknown)\n       *status = NOT_IMAGE;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgttb(fitsfile *fptr,      /* I - FITS file pointer*/\n           LONGLONG *rowlen,        /* O - length of a table row, in bytes */\n           LONGLONG *nrows,         /* O - number of rows in the table */\n           LONGLONG *pcount,    /* O - value of PCOUNT keyword */\n           long *tfields,       /* O - number of fields in the table */\n           int *status)         /* IO - error status    */\n{\n/*\n  Get and Test TaBle;\n  Test that this is a legal ASCII or binary table and get some keyword values.\n  We assume that the calling routine has already tested the 1st keyword\n  of the extension to ensure that this is really a table extension.\n*/\n    if (*status > 0)\n        return(*status);\n\n    if (fftkyn(fptr, 2, \"BITPIX\", \"8\", status) == BAD_ORDER) /* 2nd keyword */\n        return(*status = NO_BITPIX);  /* keyword not BITPIX */\n    else if (*status == NOT_POS_INT)\n        return(*status = BAD_BITPIX); /* value != 8 */\n\n    if (fftkyn(fptr, 3, \"NAXIS\", \"2\", status) == BAD_ORDER) /* 3rd keyword */\n        return(*status = NO_NAXIS);  /* keyword not NAXIS */\n    else if (*status == NOT_POS_INT)\n        return(*status = BAD_NAXIS); /* value != 2 */\n\n    if (ffgtknjj(fptr, 4, \"NAXIS1\", rowlen, status) == BAD_ORDER) /* 4th key */\n        return(*status = NO_NAXES);  /* keyword not NAXIS1 */\n    else if (*status == NOT_POS_INT)\n        return(*status == BAD_NAXES); /* bad NAXIS1 value */\n\n    if (ffgtknjj(fptr, 5, \"NAXIS2\", nrows, status) == BAD_ORDER) /* 5th key */\n        return(*status = NO_NAXES);  /* keyword not NAXIS2 */\n    else if (*status == NOT_POS_INT)\n        return(*status == BAD_NAXES); /* bad NAXIS2 value */\n\n    if (ffgtknjj(fptr, 6, \"PCOUNT\", pcount, status) == BAD_ORDER) /* 6th key */\n        return(*status = NO_PCOUNT);  /* keyword not PCOUNT */\n    else if (*status == NOT_POS_INT)\n        return(*status = BAD_PCOUNT); /* bad PCOUNT value */\n\n    if (fftkyn(fptr, 7, \"GCOUNT\", \"1\", status) == BAD_ORDER) /* 7th keyword */\n        return(*status = NO_GCOUNT);  /* keyword not GCOUNT */\n    else if (*status == NOT_POS_INT)\n        return(*status = BAD_GCOUNT); /* value != 1 */\n\n    if (ffgtkn(fptr, 8, \"TFIELDS\", tfields, status) == BAD_ORDER) /* 8th key*/\n        return(*status = NO_TFIELDS);  /* keyword not TFIELDS */\n    else if (*status == NOT_POS_INT || *tfields > 999)\n        return(*status == BAD_TFIELDS); /* bad TFIELDS value */\n\n\n    if (*status > 0)\n       ffpmsg(\n       \"Error reading required keywords in the table header (FTGTTB).\");\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgtkn(fitsfile *fptr,  /* I - FITS file pointer              */\n           int numkey,      /* I - number of the keyword to read  */\n           char *name,      /* I - expected name of the keyword   */\n           long *value,     /* O - integer value of the keyword   */\n           int *status)     /* IO - error status                  */\n{\n/*\n  test that keyword number NUMKEY has the expected name and get the\n  integer value of the keyword.  Return an error if the keyword\n  name does not match the input name, or if the value of the\n  keyword is not a positive integer.\n*/\n    char keyname[FLEN_KEYWORD], valuestring[FLEN_VALUE];\n    char comm[FLEN_COMMENT], message[FLEN_ERRMSG];\n   \n    if (*status > 0)\n        return(*status);\n    \n    keyname[0] = '\\0';\n    valuestring[0] = '\\0';\n\n    if (ffgkyn(fptr, numkey, keyname, valuestring, comm, status) <= 0)\n    {\n        if (strcmp(keyname, name) )\n            *status = BAD_ORDER;  /* incorrect keyword name */\n\n        else\n        {\n            ffc2ii(valuestring, value, status);  /* convert to integer */\n\n            if (*status > 0 || *value < 0 )\n               *status = NOT_POS_INT;\n        }\n\n        if (*status > 0)\n        {\n            snprintf(message, FLEN_ERRMSG,\n              \"ffgtkn found unexpected keyword or value for keyword no. %d.\",\n              numkey);\n            ffpmsg(message);\n\n            snprintf(message, FLEN_ERRMSG,\n              \" Expected positive integer keyword %s, but instead\", name);\n            ffpmsg(message);\n\n            snprintf(message, FLEN_ERRMSG,\n              \" found keyword %s with value %s\", keyname, valuestring);\n            ffpmsg(message);\n        }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgtknjj(fitsfile *fptr,  /* I - FITS file pointer              */\n           int numkey,      /* I - number of the keyword to read  */\n           char *name,      /* I - expected name of the keyword   */\n           LONGLONG *value, /* O - integer value of the keyword   */\n           int *status)     /* IO - error status                  */\n{\n/*\n  test that keyword number NUMKEY has the expected name and get the\n  integer value of the keyword.  Return an error if the keyword\n  name does not match the input name, or if the value of the\n  keyword is not a positive integer.\n*/\n    char keyname[FLEN_KEYWORD], valuestring[FLEN_VALUE];\n    char comm[FLEN_COMMENT], message[FLEN_ERRMSG];\n   \n    if (*status > 0)\n        return(*status);\n    \n    keyname[0] = '\\0';\n    valuestring[0] = '\\0';\n\n    if (ffgkyn(fptr, numkey, keyname, valuestring, comm, status) <= 0)\n    {\n        if (strcmp(keyname, name) )\n            *status = BAD_ORDER;  /* incorrect keyword name */\n\n        else\n        {\n            ffc2jj(valuestring, value, status);  /* convert to integer */\n\n            if (*status > 0 || *value < 0 )\n               *status = NOT_POS_INT;\n        }\n\n        if (*status > 0)\n        {\n            snprintf(message, FLEN_ERRMSG,\n              \"ffgtknjj found unexpected keyword or value for keyword no. %d.\",\n              numkey);\n            ffpmsg(message);\n\n            snprintf(message, FLEN_ERRMSG,\n              \" Expected positive integer keyword %s, but instead\", name);\n            ffpmsg(message);\n\n            snprintf(message, FLEN_ERRMSG,\n              \" found keyword %s with value %s\", keyname, valuestring);\n            ffpmsg(message);\n        }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fftkyn(fitsfile *fptr,  /* I - FITS file pointer              */\n           int numkey,      /* I - number of the keyword to read  */\n           char *name,      /* I - expected name of the keyword   */\n           char *value,     /* I - expected value of the keyword  */\n           int *status)     /* IO - error status                  */\n{\n/*\n  test that keyword number NUMKEY has the expected name and the\n  expected value string.\n*/\n    char keyname[FLEN_KEYWORD], valuestring[FLEN_VALUE];\n    char comm[FLEN_COMMENT], message[FLEN_ERRMSG];\n   \n    if (*status > 0)\n        return(*status);\n    \n    keyname[0] = '\\0';\n    valuestring[0] = '\\0';\n\n    if (ffgkyn(fptr, numkey, keyname, valuestring, comm, status) <= 0)\n    {\n        if (strcmp(keyname, name) )\n            *status = BAD_ORDER;  /* incorrect keyword name */\n\n        if (strcmp(value, valuestring) )\n            *status = NOT_POS_INT;  /* incorrect keyword value */\n    }\n\n    if (*status > 0)\n    {\n        snprintf(message, FLEN_ERRMSG,\n          \"fftkyn found unexpected keyword or value for keyword no. %d.\",\n          numkey);\n        ffpmsg(message);\n\n        snprintf(message, FLEN_ERRMSG,\n          \" Expected keyword %s with value %s, but\", name, value);\n        ffpmsg(message);\n\n        snprintf(message, FLEN_ERRMSG,\n          \" found keyword %s with value %s\", keyname, valuestring);\n        ffpmsg(message);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffh2st(fitsfile *fptr,   /* I - FITS file pointer           */\n           char **header,    /* O - returned header string      */\n           int  *status)     /* IO - error status               */\n\n/*\n  read header keywords into a long string of chars.  This routine allocates\n  memory for the string, so the calling routine must eventually free the\n  memory when it is not needed any more.\n*/\n{\n    int nkeys;\n    long nrec;\n    LONGLONG headstart;\n\n    if (*status > 0)\n        return(*status);\n\n    /* get number of keywords in the header (doesn't include END) */\n    if (ffghsp(fptr, &nkeys, NULL, status) > 0)\n        return(*status);\n\n    nrec = (nkeys / 36 + 1);\n\n    /* allocate memory for all the keywords (multiple of 2880 bytes) */\n    *header = (char *) calloc ( nrec * 2880 + 1, 1);\n    if (!(*header))\n    {\n         *status = MEMORY_ALLOCATION;\n         ffpmsg(\"failed to allocate memory to hold all the header keywords\");\n         return(*status);\n    }\n\n    ffghadll(fptr, &headstart, NULL, NULL, status); /* get header address */\n    ffmbyt(fptr, headstart, REPORT_EOF, status);   /* move to header */\n    ffgbyt(fptr, nrec * 2880, *header, status);     /* copy header */\n    *(*header + (nrec * 2880)) = '\\0';\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffhdr2str( fitsfile *fptr,  /* I - FITS file pointer                    */\n            int exclude_comm,   /* I - if TRUE, exclude commentary keywords */\n            char **exclist,     /* I - list of excluded keyword names       */\n            int nexc,           /* I - number of names in exclist           */\n            char **header,      /* O - returned header string               */\n            int *nkeys,         /* O - returned number of 80-char keywords  */\n            int  *status)       /* IO - error status                        */\n/*\n  read header keywords into a long string of chars.  This routine allocates\n  memory for the string, so the calling routine must eventually free the\n  memory when it is not needed any more.  If exclude_comm is TRUE, then all \n  the COMMENT, HISTORY, and <blank> keywords will be excluded from the output\n  string of keywords.  Any other list of keywords to be excluded may be\n  specified with the exclist parameter.\n*/\n{\n    int casesn, match, exact, totkeys;\n    long ii, jj;\n    char keybuf[162], keyname[FLEN_KEYWORD], *headptr;\n\n    *nkeys = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    /* get number of keywords in the header (doesn't include END) */\n    if (ffghsp(fptr, &totkeys, NULL, status) > 0)\n        return(*status);\n\n    /* allocate memory for all the keywords */\n    /* (will reallocate it later to minimize the memory size) */\n    \n    *header = (char *) calloc ( (totkeys + 1) * 80 + 1, 1);\n    if (!(*header))\n    {\n         *status = MEMORY_ALLOCATION;\n         ffpmsg(\"failed to allocate memory to hold all the header keywords\");\n         return(*status);\n    }\n\n    headptr = *header;\n    casesn = FALSE;\n\n    /* read every keyword */\n    for (ii = 1; ii <= totkeys; ii++) \n    {\n        ffgrec(fptr, ii, keybuf, status);\n        /* pad record with blanks so that it is at least 80 chars long */\n        strcat(keybuf,\n    \"                                                                                \");\n\n        keyname[0] = '\\0';\n        strncat(keyname, keybuf, 8); /* copy the keyword name */\n        \n        if (exclude_comm)\n        {\n            if (!FSTRCMP(\"COMMENT \", keyname) ||\n                !FSTRCMP(\"HISTORY \", keyname) ||\n                !FSTRCMP(\"        \", keyname) )\n              continue;  /* skip this commentary keyword */\n        }\n\n        /* does keyword match any names in the exclusion list? */\n        for (jj = 0; jj < nexc; jj++ )\n        {\n            ffcmps(exclist[jj], keyname, casesn, &match, &exact);\n                 if (match)\n                     break;\n        }\n\n        if (jj == nexc)\n        {\n            /* not in exclusion list, add this keyword to the string */\n            strcpy(headptr, keybuf);\n            headptr += 80;\n            (*nkeys)++;\n        }\n    }\n\n    /* add the END keyword */\n    strcpy(headptr,\n    \"END                                                                             \");\n    headptr += 80;\n    (*nkeys)++;\n\n    *headptr = '\\0';   /* terminate the header string */\n    /* minimize the allocated memory */\n    *header = (char *) realloc(*header, (*nkeys *80) + 1);  \n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffcnvthdr2str( fitsfile *fptr,  /* I - FITS file pointer                    */\n            int exclude_comm,   /* I - if TRUE, exclude commentary keywords */\n            char **exclist,     /* I - list of excluded keyword names       */\n            int nexc,           /* I - number of names in exclist           */\n            char **header,      /* O - returned header string               */\n            int *nkeys,         /* O - returned number of 80-char keywords  */\n            int  *status)       /* IO - error status                        */\n/*\n  Same as ffhdr2str, except that if the input HDU is a tile compressed image\n  (stored in a binary table) then it will first convert that header back\n  to that of a normal uncompressed FITS image before concatenating the header\n  keyword records.\n*/\n{\n    fitsfile *tempfptr;\n    \n    if (*status > 0)\n        return(*status);\n\n    if (fits_is_compressed_image(fptr, status) )\n    {\n        /* this is a tile compressed image, so need to make an uncompressed */\n\t/* copy of the image header in memory before concatenating the keywords */\n        if (fits_create_file(&tempfptr, \"mem://\", status) > 0) {\n\t    return(*status);\n\t}\n\n\tif (fits_img_decompress_header(fptr, tempfptr, status) > 0) {\n\t    fits_delete_file(tempfptr, status);\n\t    return(*status);\n\t}\n\n\tffhdr2str(tempfptr, exclude_comm, exclist, nexc, header, nkeys, status);\n\tfits_close_file(tempfptr, status);\n\n    } else {\n        ffhdr2str(fptr, exclude_comm, exclist, nexc, header, nkeys, status);\n    }\n\n    return(*status);\n}\n"},{"id":16697,"name":"putcold.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, putcold.c, contains routines that write data elements to    */\n/*  a FITS image or table, with double datatype.                           */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <limits.h>\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffpprd( fitsfile *fptr,  /* I - FITS file pointer                       */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            double *array,   /* I - array of values that are written        */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n    double nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_pixels(fptr, TDOUBLE, firstelem, nelem,\n            0, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcld(fptr, 2, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffppnd( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to write               */\n            double *array,    /* I - array of values that are written        */\n            double nulval,    /* I - undefined pixel value                   */\n            int  *status)     /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).  Any array values\n  that are equal to the value of nulval will be replaced with the null\n  pixel value that is appropriate for this column.\n*/\n{\n    long row;\n    double nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        nullvalue = nulval;  /* set local variable */\n        fits_write_compressed_pixels(fptr, TDOUBLE, firstelem, nelem,\n            1, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcnd(fptr, 2, row, firstelem, nelem, array, nulval, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp2dd(fitsfile *fptr,   /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           double *array,    /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    /* call the 3D writing routine, with the 3rd dimension = 1 */\n\n    ffp3dd(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp3dd(fitsfile *fptr,   /* I - FITS file pointer                     */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  nrows,      /* I - number of rows in each plane of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           LONGLONG  naxis3,     /* I - FITS image NAXIS3 value               */\n           double *array,    /* I - array to be written                   */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 3-D cube of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    long tablerow, ii, jj;\n    long fpixel[3]= {1,1,1}, lpixel[3];\n    LONGLONG nfits, narray;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n        lpixel[0] = (long) ncols;\n        lpixel[1] = (long) nrows;\n        lpixel[2] = (long) naxis3;\n\n        fits_write_compressed_img(fptr, TDOUBLE, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n      /* all the image pixels are contiguous, so write all at once */\n      ffpcld(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status);\n      return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to write to */\n    narray = 0;  /* next pixel in input array to be written */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* writing naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffpcld(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0)\n         return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpssd(fitsfile *fptr,   /* I - FITS file pointer                       */\n           long  group,      /* I - group to write(1 = 1st group)           */\n           long  naxis,      /* I - number of data axes in array            */\n           long  *naxes,     /* I - size of each FITS axis                  */\n           long  *fpixel,    /* I - 1st pixel in each axis to write (1=1st) */\n           long  *lpixel,    /* I - last pixel in each axis to write        */\n           double *array,    /* I - array to be written                     */\n           int  *status)     /* IO - error status                           */\n/*\n  Write a subsection of pixels to the primary array or image.\n  A subsection is defined to be any contiguous rectangular\n  array of pixels within the n-dimensional FITS data file.\n  Data conversion and scaling will be performed if necessary \n  (e.g, if the datatype of the FITS array is not the same as\n  the array being written).\n*/\n{\n    long tablerow;\n    LONGLONG fpix[7], dimen[7], astart, pstart;\n    LONGLONG off2, off3, off4, off5, off6, off7;\n    LONGLONG st10, st20, st30, st40, st50, st60, st70;\n    LONGLONG st1, st2, st3, st4, st5, st6, st7;\n    long ii, i1, i2, i3, i4, i5, i6, i7, irange[7];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_img(fptr, TDOUBLE, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    if (naxis < 1 || naxis > 7)\n      return(*status = BAD_DIMEN);\n\n    tablerow=maxvalue(1,group);\n\n     /* calculate the size and number of loops to perform in each dimension */\n    for (ii = 0; ii < 7; ii++)\n    {\n      fpix[ii]=1;\n      irange[ii]=1;\n      dimen[ii]=1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {    \n      fpix[ii]=fpixel[ii];\n      irange[ii]=lpixel[ii]-fpixel[ii]+1;\n      dimen[ii]=naxes[ii];\n    }\n\n    i1=irange[0];\n\n    /* compute the pixel offset between each dimension */\n    off2 =     dimen[0];\n    off3 = off2 * dimen[1];\n    off4 = off3 * dimen[2];\n    off5 = off4 * dimen[3];\n    off6 = off5 * dimen[4];\n    off7 = off6 * dimen[5];\n\n    st10 = fpix[0];\n    st20 = (fpix[1] - 1) * off2;\n    st30 = (fpix[2] - 1) * off3;\n    st40 = (fpix[3] - 1) * off4;\n    st50 = (fpix[4] - 1) * off5;\n    st60 = (fpix[5] - 1) * off6;\n    st70 = (fpix[6] - 1) * off7;\n\n    /* store the initial offset in each dimension */\n    st1 = st10;\n    st2 = st20;\n    st3 = st30;\n    st4 = st40;\n    st5 = st50;\n    st6 = st60;\n    st7 = st70;\n\n    astart = 0;\n\n    for (i7 = 0; i7 < irange[6]; i7++)\n    {\n     for (i6 = 0; i6 < irange[5]; i6++)\n     {\n      for (i5 = 0; i5 < irange[4]; i5++)\n      {\n       for (i4 = 0; i4 < irange[3]; i4++)\n       {\n        for (i3 = 0; i3 < irange[2]; i3++)\n        {\n         pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7;\n\n         for (i2 = 0; i2 < irange[1]; i2++)\n         {\n           if (ffpcld(fptr, 2, tablerow, pstart, i1, &array[astart],\n              status) > 0)\n              return(*status);\n\n           astart += i1;\n           pstart += off2;\n         }\n         st2 = st20;\n         st3 = st3+off3;    \n        }\n        st3 = st30;\n        st4 = st4+off4;\n       }\n       st4 = st40;\n       st5 = st5+off5;\n      }\n      st5 = st50;\n      st6 = st6+off6;\n     }\n     st6 = st60;\n     st7 = st7+off7;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpgpd( fitsfile *fptr,   /* I - FITS file pointer                      */\n            long  group,      /* I - group to write(1 = 1st group)          */\n            long  firstelem,  /* I - first vector element to write(1 = 1st) */\n            long  nelem,      /* I - number of values to write              */\n            double *array,    /* I - array of values that are written       */\n            int  *status)     /* IO - error status                          */\n/*\n  Write an array of group parameters to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffpcld(fptr, 1L, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcld( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            double *array,   /* I - array of values to write                */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer to a virtual column in a 1 or more grouped FITS primary\n  array.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    int tcode, maxelem2, hdutype, writeraw;\n    long twidth, incre;\n    long ntodo;\n    LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull, maxelem;\n    double scale, zero;\n    char tform[20], cform[20];\n    char message[FLEN_ERRMSG];\n\n    char snull[20];   /*  the FITS null value  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem2, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n    maxelem = maxelem2;\n\n    if (tcode == TSTRING)   \n         ffcfmt(tform, cform);     /* derive C format for writing strings */\n\n    /*\n      if there is no scaling and the native machine format is not byteswapped,\n      then we can simply write the raw data bytes into the FITS file if the\n      datatype of the FITS column is the same as the input values.  Otherwise,\n      we must convert the raw values into the scaled and/or machine dependent\n      format in a temporary buffer that has been allocated for this purpose.\n    */\n    if (scale == 1. && zero == 0. && \n       MACHINE == NATIVE && tcode == TDOUBLE)\n    {\n        writeraw = 1;\n        if (nelem < (LONGLONG)INT32_MAX) {\n            maxelem = nelem;\n        } else {\n            maxelem = INT32_MAX/8;\n        }\n     }\n    else\n        writeraw = 0;\n\n    /*---------------------------------------------------------------------*/\n    /*  Now write the pixels to the FITS column.                           */\n    /*  First call the ffXXfYY routine to  (1) convert the datatype        */\n    /*  if necessary, and (2) scale the values by the FITS TSCALn and      */\n    /*  TZEROn linear scaling parameters into a temporary buffer.          */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to write  */\n    next = 0;                 /* next element in array to be written  */\n    rownum = 0;               /* row number, relative to firstrow     */\n\n    while (remain)\n    {\n        /* limit the number of pixels to process a one time to the number that\n           will fit in the buffer space or to the number of pixels that remain\n           in the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);      \n        ntodo = (long) minvalue(ntodo, (repeat - elemnum));\n\n        wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre);\n\n        ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */\n\n        switch (tcode) \n        {\n            case (TDOUBLE):\n              if (writeraw)\n              {\n                /* write raw input bytes without conversion */\n                ffpr8b(fptr, ntodo, incre, &array[next], status);\n              }\n              else\n              {\n                /* convert the raw data before writing to FITS file */\n                ffr8fr8(&array[next], ntodo, scale, zero,\n                        (double *) buffer, status);\n                ffpr8b(fptr, ntodo, incre, (double *) buffer, status);\n              }\n\n              break;\n\n            case (TLONGLONG):\n\n                ffr8fi8(&array[next], ntodo, scale, zero,\n                        (LONGLONG *) buffer, status);\n                ffpi8b(fptr, ntodo, incre, (long *) buffer, status);\n                break;\n\n            case (TBYTE):\n \n                ffr8fi1(&array[next], ntodo, scale, zero, \n                        (unsigned char *) buffer, status);\n                ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status);\n                break;\n\n            case (TSHORT):\n\n                ffr8fi2(&array[next], ntodo, scale, zero, \n                       (short *) buffer, status);\n                ffpi2b(fptr, ntodo, incre, (short *) buffer, status);\n                break;\n\n            case (TLONG):\n\n                ffr8fi4(&array[next], ntodo, scale, zero,\n                        (INT32BIT *) buffer, status);\n                ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status);\n                break;\n\n            case (TFLOAT):\n                ffr8fr4(&array[next], ntodo, scale, zero,\n                        (float *) buffer, status);\n                ffpr4b(fptr, ntodo, incre, (float *) buffer, status);\n                break;\n\n            case (TSTRING):  /* numerical column in an ASCII table */\n\n                if (cform[1] != 's')  /*  \"%s\" format is a string */\n                {\n                  ffr8fstr(&array[next], ntodo, scale, zero, cform,\n                          twidth, (char *) buffer, status);\n\n                  if (incre == twidth)    /* contiguous bytes */\n                     ffpbyt(fptr, ntodo * twidth, buffer, status);\n                  else\n                     ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                            status);\n\n                  break;\n                }\n                /* can't write to string column, so fall thru to default: */\n\n            default:  /*  error trap  */\n                snprintf(message, FLEN_ERRMSG,\n                      \"Cannot write numbers to column %d which has format %s\",\n                       colnum,tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous write operation */\n        {\n          snprintf(message,FLEN_ERRMSG,\n          \"Error writing elements %.0f thru %.0f of input data array (ffpcld).\",\n              (double) (next+1), (double) (next+ntodo));\n         ffpmsg(message);\n         return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum += ntodo;\n            if (elemnum == repeat)  /* completed a row; start on next row */\n            {\n                elemnum = 0;\n                rownum++;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while writing FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpclm( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,   /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem,  /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,      /* I - number of values to write               */\n            double *array,    /* I - array of values to write                */\n            int  *status)     /* IO - error status                           */\n/*\n  Write an array of double complex values to a column in the current FITS HDU.\n  Each complex number if interpreted as a pair of float values.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer to a virtual column in a 1 or more grouped FITS primary\n  array.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The input array of values will be converted to the datatype of the column\n  if necessary, but normally complex values should only be written to a binary\n  table with TFORMn = 'rM' where r is an optional repeat count. The TSCALn and\n  TZERO keywords should not be used with complex numbers because mathmatically\n  the scaling should only be applied to the real (first) component of the\n  complex value.\n*/\n{\n    /* simply multiply the number of elements by 2, and call ffpcld */\n\n    ffpcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, \n            nelem * 2, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcnd( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            double *array,   /* I - array of values to write                */\n            double nulvalue, /* I - value used to flag undefined pixels     */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of elements to the specified column of a table.  Any input\n  pixels equal to the value of nulvalue will be replaced by the appropriate\n  null value in the output FITS file. \n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary\n*/\n{\n    tcolumn *colptr;\n    LONGLONG  ngood = 0, nbad = 0, ii;\n    LONGLONG repeat, first, fstelm, fstrow;\n    int tcode, overflow = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n    }\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n\n    tcode  = colptr->tdatatype;\n\n    if (tcode > 0)\n       repeat = colptr->trepeat;  /* repeat count for this column */\n    else\n       repeat = firstelem -1 + nelem;  /* variable length arrays */\n\n    if (abs(tcode) >= TCOMPLEX)\n    { /* treat complex columns as pairs of numbers */\n        repeat *= 2;\n    }\n\n    /* if variable length array, first write the whole input vector, \n       then go back and fill in the nulls */\n    if (tcode < 0) {\n      if (ffpcld(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) {\n\tif (*status == NUM_OVERFLOW) \n\t{\n\t  /* ignore overflows, which are possibly the null pixel values */\n\t  /*  overflow = 1;   */\n\t  *status = 0;\n\t} else { \n          return(*status);\n\t}\n      }\n    }\n\n    /* absolute element number in the column */\n    first = (firstrow - 1) * repeat + firstelem;\n\n    for (ii = 0; ii < nelem; ii++)\n    {\n      if (array[ii] != nulvalue)  /* is this a good pixel? */\n      {\n         if (nbad)  /* write previous string of bad pixels */\n         {\n            fstelm = ii - nbad + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            /* call ffpcluc, not ffpclu, in case we are writing to a\n\t       complex ('C') binary table column */\n            if (ffpcluc(fptr, colnum, fstrow, fstelm, nbad, status) > 0)\n                return(*status);\n\n            nbad=0;\n         }\n\n         ngood = ngood +1;  /* the consecutive number of good pixels */\n      }\n      else\n      {\n         if (ngood)  /* write previous string of good pixels */\n         {\n            fstelm = ii - ngood + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (tcode > 0) {  /* variable length arrays have already been written */\n              if (ffpcld(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood],\n                status) > 0) {\n\t\tif (*status == NUM_OVERFLOW) \n\t\t{\n\t\t  overflow = 1;\n\t\t  *status = 0;\n\t\t} else {\n                  return(*status);\n\t\t}\n\t      }\n            }\n            ngood=0;\n         }\n\n         nbad = nbad +1;  /* the consecutive number of bad pixels */\n      }\n    }\n\n    /* finished loop;  now just write the last set of pixels */\n\n    if (ngood)  /* write last string of good pixels */\n    {\n      fstelm = ii - ngood + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      if (tcode > 0) {  /* variable length arrays have already been written */\n        ffpcld(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status);\n      }\n    }\n    else if (nbad) /* write last string of bad pixels */\n    {\n      fstelm = ii - nbad + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n      ffpcluc(fptr, colnum, fstrow, fstelm, nbad, status);\n    }\n\n    if (*status <= 0) {\n      if (overflow) {\n        *status = NUM_OVERFLOW;\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffr8fi1(double *input,         /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            unsigned char *output, /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] < DUCHAR_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (input[ii] > DUCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DUCHAR_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (dvalue > DUCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) (dvalue + .5);\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffr8fi2(double *input,     /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            short *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] < DSHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MIN;\n            }\n            else if (input[ii] > DSHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n                output[ii] = (short) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DSHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MIN;\n            }\n            else if (dvalue > DSHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (short) (dvalue + .5);\n                else\n                    output[ii] = (short) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffr8fi4(double *input,     /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            INT32BIT *output,  /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MIN;\n            }\n            else if (input[ii] > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n                output[ii] = (INT32BIT) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (INT32BIT) (dvalue + .5);\n                else\n                    output[ii] = (INT32BIT) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffr8fi8(double *input,     /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            LONGLONG *output,      /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero ==  9223372036854775808.)\n    {       \n        /* Writing to unsigned long long column. Input values must not be negative */\n        /* Instead of subtracting 9223372036854775808, it is more efficient */\n        /* and more precise to just flip the sign bit with the XOR operator */\n\n        for (ii = 0; ii < ntodo; ii++) {\n            if (input[ii] < -0.49) {\n              *status = OVERFLOW_ERR;\n              output[ii] = LONGLONG_MIN;\n            }\n\t    else if (input[ii] > 2.* DLONGLONG_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MAX;\n            } else {\n              output[ii] =  ((LONGLONG) input[ii]) ^ 0x8000000000000000;\n            }\n        }\n    }\n    else if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] < DLONGLONG_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MIN;\n            }\n            else if (input[ii] > DLONGLONG_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MAX;\n            }\n            else\n                output[ii] = (LONGLONG) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DLONGLONG_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MIN;\n            }\n            else if (dvalue > DLONGLONG_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (LONGLONG) (dvalue + .5);\n                else\n                    output[ii] = (LONGLONG) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffr8fr4(double *input,     /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            float *output,     /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (float) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (float) ((input[ii] - zero) / scale);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffr8fr8(double *input,     /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            double *output,    /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n      memcpy(output, input, ntodo * sizeof(double) ); /* copy input to output */\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (input[ii] - zero) / scale;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffr8fstr(double *input,     /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            char *cform,       /* I - format for output string values  */\n            long twidth,       /* I - width of each field, in chars    */\n            char *output,      /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n    char *cptr;\n    \n    cptr = output;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n           sprintf(output, cform, input[ii]);\n           output += twidth;\n\n           if (*output)  /* if this char != \\0, then overflow occurred */\n              *status = OVERFLOW_ERR;\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n          dvalue = (input[ii] - zero) / scale;\n          sprintf(output, cform, dvalue);\n          output += twidth;\n\n          if (*output)  /* if this char != \\0, then overflow occurred */\n            *status = OVERFLOW_ERR;\n        }\n    }\n\n    /* replace any commas with periods (e.g., in French locale) */\n    while ((cptr = strchr(cptr, ','))) *cptr = '.';\n    \n    return(*status);\n}\n"},{"id":16698,"name":"getcole.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, getcole.c, contains routines that read data elements from   */\n/*  a FITS image or table, with float datatype                             */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <math.h>\n#include <stdlib.h>\n#include <limits.h>\n#include <string.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffgpve( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            float nulval,     /* I - value for undefined pixels              */\n            float *array,     /* O - array of values that are returned       */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Undefined elements will be set equal to NULVAL, unless NULVAL=0\n  in which case no checking for undefined values will be performed.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    char cdummy;\n    int nullcheck = 1;\n    float nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n         nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_pixels(fptr, TFLOAT, firstelem, nelem,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcle(fptr, 2, row, firstelem, nelem, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgpfe( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            float *array,     /* O - array of values that are returned       */\n            char *nularray,   /* O - array of null pixel flags               */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Any undefined pixels in the returned array will be set = 0 and the \n  corresponding nularray value will be set = 1.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    int nullcheck = 2;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_read_compressed_pixels(fptr, TFLOAT, firstelem, nelem,\n            nullcheck, NULL, array, nularray, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcle(fptr, 2, row, firstelem, nelem, 1, 2, 0.F,\n               array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg2de(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           float nulval,    /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           float *array,    /* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    /* call the 3D reading routine, with the 3rd dimension = 1 */\n\n    ffg3de(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, \n           anynul, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg3de(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           float nulval,    /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  nrows,     /* I - number of rows in each plane of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           LONGLONG  naxis3,    /* I - FITS image NAXIS3 value                 */\n           float *array,    /* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 3-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    long tablerow;\n    LONGLONG narray, nfits, ii, jj;\n    char cdummy;\n    int nullcheck = 1;\n    long inc[] = {1,1,1};\n    LONGLONG fpixel[] = {1,1,1};\n    LONGLONG lpixel[3];\n    float nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        lpixel[0] = ncols;\n        lpixel[1] = nrows;\n        lpixel[2] = naxis3;\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TFLOAT, fpixel, lpixel, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n       /* all the image pixels are contiguous, so read all at once */\n       ffgcle(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n       return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to read */\n    narray = 0;  /* next pixel in output array to be filled */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* reading naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffgcle(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval,\n          &array[narray], &cdummy, anynul, status) > 0)\n          return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsve(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           float nulval,   /* I - value to set undefined pixels             */\n           float *array,   /* O - array to be filled and returned           */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dir[9];\n    long nelem, nultyp, ninc, numcol;\n    LONGLONG felem, dsize[10], blcll[9], trcll[9];\n    int hdutype, anyf;\n    char ldummy, msg[FLEN_ERRMSG];\n    int nullcheck = 1;\n    float nullvalue;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsve is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TFLOAT, blcll, trcll, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 1;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n        dir[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        if (hdutype == IMAGE_HDU)\n        {\n           dir[ii] = -1;\n        }\n        else\n        {\n          snprintf(msg, FLEN_ERRMSG,\"ffgsve: illegal range specified for axis %ld\", ii + 1);\n          ffpmsg(msg);\n          return(*status = BAD_PIX_NUM);\n        }\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n      dsize[ii] = dsize[ii] * dir[ii];\n    }\n    dsize[naxis] = dsize[naxis] * dir[naxis];\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0]*dir[0] - str[0]*dir[0]) / inc[0] + 1;\n      ninc = incr[0] * dir[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]*dir[8]; i8 <= stp[8]*dir[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]*dir[7]; i7 <= stp[7]*dir[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]*dir[6]; i6 <= stp[6]*dir[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]*dir[5]; i5 <= stp[5]*dir[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]*dir[4]; i4 <= stp[4]*dir[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]*dir[3]; i3 <= stp[3]*dir[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]*dir[2]; i2 <= stp[2]*dir[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]*dir[1]; i1 <= stp[1]*dir[1]; i1 += incr[1])\n            {\n\n              felem=str[0] + (i1 - dir[1]) * dsize[1] + (i2 - dir[2]) * dsize[2] + \n                             (i3 - dir[3]) * dsize[3] + (i4 - dir[4]) * dsize[4] +\n                             (i5 - dir[5]) * dsize[5] + (i6 - dir[6]) * dsize[6] +\n                             (i7 - dir[7]) * dsize[7] + (i8 - dir[8]) * dsize[8];\n\n              if ( ffgcle(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &ldummy, &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsfe(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           float *array,   /* O - array to be filled and returned           */\n           char *flagval,  /* O - set to 1 if corresponding value is null   */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dsize[10];\n    LONGLONG blcll[9], trcll[9];\n    long felem, nelem, nultyp, ninc, numcol;\n    int hdutype, anyf;\n    float nulval = 0;\n    char msg[FLEN_ERRMSG];\n    int nullcheck = 2;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsve is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        fits_read_compressed_img(fptr, TFLOAT, blcll, trcll, inc,\n            nullcheck, NULL, array, flagval, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 2;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        snprintf(msg, FLEN_ERRMSG,\"ffgsve: illegal range specified for axis %ld\", ii + 1);\n        ffpmsg(msg);\n        return(*status = BAD_PIX_NUM);\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n    }\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0] - str[0]) / inc[0] + 1;\n      ninc = incr[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1])\n            {\n              felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + \n                             (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] +\n                             (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] +\n                             (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8];\n\n              if ( ffgcle(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &flagval[i0], &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffggpe( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            long  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            long  nelem,      /* I - number of values to read                */\n            float *array,     /* O - array of values that are returned       */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of group parameters from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n*/\n{\n    long row;\n    int idummy;\n    char cdummy;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcle(fptr, 1, row, firstelem, nelem, 1, 1, 0.F,\n               array, &cdummy, &idummy, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcve(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           float nulval,     /* I - value for null pixels                   */\n           float *array,     /* O - array of values that are read           */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Any undefined pixels will be set equal to the value of 'nulval' unless\n  nulval = 0 in which case no checks for undefined pixels will be made.\n*/\n{\n    char cdummy;\n\n    ffgcle(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval,\n           array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcvc(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           float nulval,     /* I - value for null pixels                   */\n           float *array,     /* O - array of values that are read           */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Any undefined pixels will be set equal to the value of 'nulval' unless\n  nulval = 0 in which case no checks for undefined pixels will be made.\n\n  TSCAL and ZERO should not be used with complex values. \n*/\n{\n    char cdummy;\n\n    /* a complex value is interpreted as a pair of float values, thus */\n    /* need to multiply the first element and number of elements by 2 */\n\n    ffgcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem *2,\n           1, 1, nulval, array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcfe(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           float *array,     /* O - array of values that are read           */\n           char *nularray,   /* O - array of flags: 1 if null pixel; else 0 */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Nularray will be set = 1 if the corresponding array pixel is undefined, \n  otherwise nularray will = 0.\n*/\n{\n    float dummy = 0;\n\n    ffgcle(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy,\n           array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcfc(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           float *array,     /* O - array of values that are read           */\n           char *nularray,   /* O - array of flags: 1 if null pixel; else 0 */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Nularray will be set = 1 if the corresponding array pixel is undefined, \n  otherwise nularray will = 0.\n\n  TSCAL and ZERO should not be used with complex values. \n*/\n{\n    LONGLONG ii, jj;\n    float dummy = 0;\n    char *carray;\n\n    /* a complex value is interpreted as a pair of float values, thus */\n    /* need to multiply the first element and number of elements by 2 */\n    \n    /* allocate temporary array */\n    carray = (char *) calloc( (size_t) (nelem * 2), 1); \n\n    ffgcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2,\n           1, 2, dummy, array, carray, anynul, status);\n\n    for (ii = 0, jj = 0; jj < nelem; ii += 2, jj++)\n    {\n       if (carray[ii] || carray[ii + 1])\n          nularray[jj] = 1;\n       else\n          nularray[jj] = 0;\n    }\n\n    free(carray);    \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcle( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            long  elemincre,  /* I - pixel increment; e.g., 2 = every other  */\n            int   nultyp,     /* I - null value handling code:               */\n                              /*     1: set undefined pixels = nulval        */\n                              /*     2: set nularray=1 for undefined pixels  */\n            float nulval,     /* I - value for null pixels if nultyp = 1     */\n            float *array,     /* O - array of values that are read           */\n            char *nularray,   /* O - array of flags = 1 if nultyp = 2        */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer be a virtual column in a 1 or more grouped FITS primary\n  array or image extension.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The output array of values will be converted from the datatype of the column \n  and will be scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    double scale, zero, power = 1., dtemp;\n    int tcode, maxelem2, hdutype, xcode, decimals;\n    long twidth, incre;\n    long ii, xwidth, ntodo;\n    int convert, nulcheck, readcheck = 0;\n    LONGLONG repeat, startpos, elemnum, readptr, tnull;\n    LONGLONG rowlen, rownum, remain, next, rowincre, maxelem;\n    char tform[20];\n    char message[FLEN_ERRMSG];\n    char snull[20];   /*  the FITS null value if reading from ASCII table  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0 || nelem == 0)  /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    if (anynul)\n       *anynul = 0;\n\n    if (nultyp == 2)\n        memset(nularray, 0, (size_t) nelem);   /* initialize nullarray */\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (elemincre < 0)\n        readcheck = -1;  /* don't do range checking in this case */\n\n    if ( ffgcprll( fptr, colnum, firstrow, firstelem, nelem, readcheck, &scale, &zero,\n         tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre,\n         &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 )\n         return(*status);\n    maxelem = maxelem2;\n\n    incre *= elemincre;   /* multiply incre to just get every nth pixel */\n\n    if (tcode == TSTRING)    /* setup for ASCII tables */\n    {\n      /* get the number of implied decimal places if no explicit decmal point */\n      ffasfm(tform, &xcode, &xwidth, &decimals, status); \n      for(ii = 0; ii < decimals; ii++)\n        power *= 10.;\n    }\n\n    /*------------------------------------------------------------------*/\n    /*  Decide whether to check for null values in the input FITS file: */\n    /*------------------------------------------------------------------*/\n    nulcheck = nultyp; /* by default check for null values in the FITS file */\n\n    if (nultyp == 1 && nulval == 0)\n       nulcheck = 0;    /* calling routine does not want to check for nulls */\n\n    else if (tcode%10 == 1 &&        /* if reading an integer column, and  */ \n            tnull == NULL_UNDEFINED) /* if a null value is not defined,    */\n            nulcheck = 0;            /* then do not check for null values. */\n\n    else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TBYTE && (tnull > 255 || tnull < 0) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED)\n         nulcheck = 0;\n\n    /*----------------------------------------------------------------------*/\n    /*  If FITS column and output data array have same datatype, then we do */\n    /*  not need to use a temporary buffer to store intermediate datatype.  */\n    /*----------------------------------------------------------------------*/\n    convert = 1;\n    if (tcode == TFLOAT) /* Special Case:                        */\n    {                             /* no type convertion required, so read */\n                                  /* data directly into output buffer.    */\n\n        if (nelem < (LONGLONG)INT32_MAX/4) {\n            maxelem = nelem;\n        } else {\n            maxelem = INT32_MAX/4;\n        }\n\n        if (nulcheck == 0 && scale == 1. && zero == 0.)\n            convert = 0;  /* no need to scale data or find nulls */\n    }\n\n    /*---------------------------------------------------------------------*/\n    /*  Now read the pixels from the FITS column. If the column does not   */\n    /*  have the same datatype as the output array, then we have to read   */\n    /*  the raw values into a temporary buffer (of limited size).  In      */\n    /*  the case of a vector colum read only 1 vector of values at a time  */\n    /*  then skip to the next row if more values need to be read.          */\n    /*  After reading the raw values, then call the fffXXYY routine to (1) */\n    /*  test for undefined values, (2) convert the datatype if necessary,  */\n    /*  and (3) scale the values by the FITS TSCALn and TZEROn linear      */\n    /*  scaling parameters.                                                */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to read */\n    next = 0;                 /* next element in array to be read   */\n    rownum = 0;               /* row number, relative to firstrow   */\n\n    while (remain)\n    {\n        /* limit the number of pixels to read at one time to the number that\n           will fit in the buffer or to the number of pixels that remain in\n           the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);\n        if (elemincre >= 0)\n        {\n          ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1));\n        }\n        else\n        {\n          ntodo = (long) minvalue(ntodo, (elemnum/(-elemincre) +1));\n        }\n\n        readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre));\n\n        switch (tcode) \n        {\n            case (TFLOAT):\n                ffgr4b(fptr, readptr, ntodo, incre, &array[next], status);\n                if (convert)\n                    fffr4r4(&array[next], ntodo, scale, zero, nulcheck, \n                           nulval, &nularray[next], anynul, \n                           &array[next], status);\n                break;\n            case (TBYTE):\n                ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer,\n                       status);\n                fffi1r4((unsigned char *) buffer, ntodo, scale, zero, nulcheck, \n                    (unsigned char) tnull, nulval, &nularray[next], anynul, \n                     &array[next], status);\n                break;\n            case (TSHORT):\n                ffgi2b(fptr, readptr, ntodo, incre, (short  *) buffer, status);\n                fffi2r4((short  *) buffer, ntodo, scale, zero, nulcheck, \n                       (short) tnull, nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TLONG):\n                ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) buffer,\n                       status);\n                fffi4r4((INT32BIT *) buffer, ntodo, scale, zero, nulcheck, \n                       (INT32BIT) tnull, nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n\n            case (TLONGLONG):\n                ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status);\n                fffi8r4( (LONGLONG *) buffer, ntodo, scale, zero, \n                           nulcheck, tnull, nulval, &nularray[next], \n                            anynul, &array[next], status);\n                break;\n            case (TDOUBLE):\n                ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status);\n                fffr8r4((double *) buffer, ntodo, scale, zero, nulcheck, \n                          nulval, &nularray[next], anynul, \n                          &array[next], status);\n                break;\n            case (TSTRING):\n                ffmbyt(fptr, readptr, REPORT_EOF, status);\n       \n                if (incre == twidth)    /* contiguous bytes */\n                     ffgbyt(fptr, ntodo * twidth, buffer, status);\n                else\n                     ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                               status);\n\n                fffstrr4((char *) buffer, ntodo, scale, zero, twidth, power,\n                     nulcheck, snull, nulval, &nularray[next], anynul,\n                     &array[next], status);\n                break;\n\n\n            default:  /*  error trap for invalid column format */\n                snprintf(message, FLEN_ERRMSG,\n                   \"Cannot read numbers from column %d which has format %s\",\n                    colnum, tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous read operation */\n        {\n\t  dtemp = (double) next;\n          if (hdutype > 0)\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgcle).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from image (ffgcle).\",\n              dtemp+1., dtemp+ntodo);\n\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum = elemnum + (ntodo * elemincre);\n\n            if (elemnum >= repeat)  /* completed a row; start on later row */\n            {\n                rowincre = elemnum / repeat;\n                rownum += rowincre;\n                elemnum = elemnum - (rowincre * repeat);\n            }\n            else if (elemnum < 0)  /* completed a row; start on a previous row */\n            {\n                rowincre = (-elemnum - 1) / repeat + 1;\n                rownum -= rowincre;\n                elemnum = (rowincre * repeat) + elemnum;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while reading FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi1r4(unsigned char *input, /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char tnull,  /* I - value of FITS TNULLn keyword if any */\n            float nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            float *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (float) input[ii];  /* copy input to output */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                output[ii] = (float) (( (double) input[ii] ) * scale + zero);\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (float) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    output[ii] = (float) (( (double) input[ii] ) * scale + zero);\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi2r4(short *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short tnull,          /* I - value of FITS TNULLn keyword if any */\n            float nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            float *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (float) input[ii];  /* copy input to output */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                output[ii] = (float) (input[ii] * scale + zero);\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (float) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    output[ii] = (float) (input[ii] * scale + zero);\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi4r4(INT32BIT *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            INT32BIT tnull,       /* I - value of FITS TNULLn keyword if any */\n            float nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            float *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (float) input[ii];  /* copy input to output */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                output[ii] = (float) (input[ii] * scale + zero);\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (float) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    output[ii] = (float) (input[ii] * scale + zero);\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi8r4(LONGLONG *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            LONGLONG tnull,       /* I - value of FITS TNULLn keyword if any */\n            float nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            float *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    ULONGLONG ulltemp;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of adding 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n                output[ii] = (float) ulltemp;\n            }\n        }\n        else if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                output[ii] = (float) input[ii];  /* copy input to output */\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                output[ii] = (float) (input[ii] * scale + zero);\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of subtracting 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n\t\t{\n                    ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n                    output[ii] = (float) ulltemp;\n                }\n            }\n        }\n        else if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (float) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    output[ii] = (float) (input[ii] * scale + zero);\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr4r4(float *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            float nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            float *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            memmove(output, input, ntodo * sizeof(float) );\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                output[ii] = (float) (input[ii] * scale + zero);\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr++;       /* point to MSBs */\n#endif\n\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                    {\n                        nullarray[ii] = 1;\n                       /* explicitly set value in case output contains a NaN */\n                        output[ii] = FLOATNULLVALUE;\n                    }\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                output[ii] = input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                    {\n                        nullarray[ii] = 1;\n                       /* explicitly set value in case output contains a NaN */\n                        output[ii] = FLOATNULLVALUE;\n                    }\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = (float) zero;\n              }\n              else\n                  output[ii] = (float) (input[ii] * scale + zero);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr8r4(double *input,        /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            float nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            float *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (float) input[ii]; /* copy input to output */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                output[ii] = (float) (input[ii] * scale + zero);\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr += 3;       /* point to MSBs */\n#endif\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                  output[ii] = (float) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = (float) zero;\n              }\n              else\n                  output[ii] = (float) (input[ii] * scale + zero);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffstrr4(char *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            long twidth,          /* I - width of each substring of chars    */\n            double implipower,    /* I - power of 10 of implied decimal      */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            char  *snull,         /* I - value of FITS null string, if any   */\n            float nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            float *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file. Check\n  for null values and do scaling if required. The nullcheck code value\n  determines how any null values in the input array are treated. A null\n  value is an input pixel that is equal to snull.  If nullcheck= 0, then\n  no special checking for nulls is performed.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    int nullen;\n    long ii;\n    double dvalue;\n    char *cstring, message[FLEN_ERRMSG];\n    char *cptr, *tpos;\n    char tempstore, chrzero = '0';\n    double val, power;\n    int exponent, sign, esign, decpt;\n\n    nullen = strlen(snull);\n    cptr = input;  /* pointer to start of input string */\n    for (ii = 0; ii < ntodo; ii++)\n    {\n      cstring = cptr;\n      /* temporarily insert a null terminator at end of the string */\n      tpos = cptr + twidth;\n      tempstore = *tpos;\n      *tpos = 0;\n\n      /* check if null value is defined, and if the    */\n      /* column string is identical to the null string */\n      if (snull[0] != ASCII_NULL_UNDEFINED && \n         !strncmp(snull, cptr, nullen) )\n      {\n        if (nullcheck)  \n        {\n          *anynull = 1;    \n          if (nullcheck == 1)\n            output[ii] = nullval;\n          else\n            nullarray[ii] = 1;\n        }\n        cptr += twidth;\n      }\n      else\n      {\n        /* value is not the null value, so decode it */\n        /* remove any embedded blank characters from the string */\n\n        decpt = 0;\n        sign = 1;\n        val  = 0.;\n        power = 1.;\n        exponent = 0;\n        esign = 1;\n\n        while (*cptr == ' ')               /* skip leading blanks */\n           cptr++;\n\n        if (*cptr == '-' || *cptr == '+')  /* check for leading sign */\n        {\n          if (*cptr == '-')\n             sign = -1;\n\n          cptr++;\n\n          while (*cptr == ' ')         /* skip blanks between sign and value */\n            cptr++;\n        }\n\n        while (*cptr >= '0' && *cptr <= '9')\n        {\n          val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n          cptr++;\n\n          while (*cptr == ' ')         /* skip embedded blanks in the value */\n            cptr++;\n        }\n\n        if (*cptr == '.' || *cptr == ',')       /* check for decimal point */\n        {\n          decpt = 1;       /* set flag to show there was a decimal point */\n          cptr++;\n          while (*cptr == ' ')         /* skip any blanks */\n            cptr++;\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n            power = power * 10.;\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks in the value */\n              cptr++;\n          }\n        }\n\n        if (*cptr == 'E' || *cptr == 'D')  /* check for exponent */\n        {\n          cptr++;\n          while (*cptr == ' ')         /* skip blanks */\n              cptr++;\n  \n          if (*cptr == '-' || *cptr == '+')  /* check for exponent sign */\n          {\n            if (*cptr == '-')\n               esign = -1;\n\n            cptr++;\n\n            while (*cptr == ' ')        /* skip blanks between sign and exp */\n              cptr++;\n          }\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            exponent = exponent * 10 + *cptr - chrzero;  /* accumulate exp */\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks */\n              cptr++;\n          }\n        }\n\n        if (*cptr  != 0)  /* should end up at the null terminator */\n        {\n          snprintf(message, FLEN_ERRMSG,\"Cannot read number from ASCII table\");\n          ffpmsg(message);\n          snprintf(message, FLEN_ERRMSG, \"Column field = %s.\", cstring);\n          ffpmsg(message);\n          /* restore the char that was overwritten by the null */\n          *tpos = tempstore;\n          return(*status = BAD_C2D);\n        }\n\n        if (!decpt)  /* if no explicit decimal, use implied */\n           power = implipower;\n\n        dvalue = (sign * val / power) * pow(10., (double) (esign * exponent));\n\n        output[ii] = (float) (dvalue * scale + zero);   /* apply the scaling */\n\n      }\n      /* restore the char that was overwritten by the null */\n      *tpos = tempstore;\n    }\n    return(*status);\n}\n"},{"id":16699,"name":"zcompress.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"#include <stdio.h>\n#include <errno.h>\n#include <stdlib.h>\n#include <string.h>\n#include <limits.h>\n#include \"zlib.h\"  \n\n#define GZBUFSIZE 115200    /* 40 FITS blocks */\n#define BUFFINCR   28800    /* 10 FITS blocks */\n\n/* prototype for the following functions */\nint uncompress2mem(char *filename, \n             FILE *diskfile, \n             char **buffptr, \n             size_t *buffsize, \n             void *(*mem_realloc)(void *p, size_t newsize),\n             size_t *filesize,\n             int *status);\n\nint uncompress2mem_from_mem(                                                \n             char *inmemptr,     \n             size_t inmemsize, \n             char **buffptr,  \n             size_t *buffsize,  \n             void *(*mem_realloc)(void *p, size_t newsize), \n             size_t *filesize,  \n             int *status);\n\nint uncompress2file(char *filename, \n             FILE *indiskfile, \n             FILE *outdiskfile, \n             int *status);\n\n\nint compress2mem_from_mem(                                                \n             char *inmemptr,     \n             size_t inmemsize, \n             char **buffptr,  \n             size_t *buffsize,  \n             void *(*mem_realloc)(void *p, size_t newsize), \n             size_t *filesize,  \n             int *status);\n\nint compress2file_from_mem(                                                \n             char *inmemptr,     \n             size_t inmemsize, \n             FILE *outdiskfile, \n             size_t *filesize,   /* O - size of file, in bytes              */\n             int *status);\n\n\n/*--------------------------------------------------------------------------*/\nint uncompress2mem(char *filename,  /* name of input file                 */\n             FILE *diskfile,     /* I - file pointer                        */\n             char **buffptr,   /* IO - memory pointer                     */\n             size_t *buffsize,   /* IO - size of buffer, in bytes           */\n             void *(*mem_realloc)(void *p, size_t newsize), /* function     */\n             size_t *filesize,   /* O - size of file, in bytes              */\n             int *status)        /* IO - error status                       */\n\n/*\n  Uncompress the disk file into memory.  Fill whatever amount of memory has\n  already been allocated, then realloc more memory, using the supplied\n  input function, if necessary.\n*/\n{\n    int err, len;\n    char *filebuff;\n    z_stream d_stream;   /* decompression stream */\n    /* Input args buffptr and buffsize may refer to a block of memory\n        larger than the 2^32 4 byte limit.  If so, must be broken\n        up into \"pages\" when assigned to d_stream.  \n        (d_stream.avail_out is a uInt type, which might be smaller\n        than buffsize's size_t type.)\n    */\n    const uLong nPages = (uLong)(*buffsize)/(uLong)UINT_MAX;\n    uLong iPage=0;\n    uInt outbuffsize = (nPages > 0) ? UINT_MAX : (uInt)(*buffsize);\n    \n\n    if (*status > 0) \n        return(*status); \n\n    /* Allocate memory to hold compressed bytes read from the file. */\n    filebuff = (char*)malloc(GZBUFSIZE);\n    if (!filebuff) return(*status = 113); /* memory error */\n\n    d_stream.zalloc = (alloc_func)0;\n    d_stream.zfree = (free_func)0;\n    d_stream.opaque = (voidpf)0;\n    d_stream.next_out = (unsigned char*) *buffptr;\n    d_stream.avail_out = outbuffsize;\n\n    /* Initialize the decompression.  The argument (15+16) tells the\n       decompressor that we are to use the gzip algorithm */\n\n    err = inflateInit2(&d_stream, (15+16));\n    if (err != Z_OK) return(*status = 414);\n\n    /* loop through the file, reading a buffer and uncompressing it */\n    for (;;)\n    {\n        len = fread(filebuff, 1, GZBUFSIZE, diskfile);\n\tif (ferror(diskfile)) {\n              inflateEnd(&d_stream);\n              free(filebuff);\n              return(*status = 414);\n\t}\n\n        if (len == 0) break;  /* no more data */\n\n        d_stream.next_in = (unsigned char*)filebuff;\n        d_stream.avail_in = len;\n\n        for (;;) {\n            /* uncompress as much of the input as will fit in the output */\n            err = inflate(&d_stream, Z_NO_FLUSH);\n\n            if (err == Z_STREAM_END ) { /* We reached the end of the input */\n\t        break; \n            } else if (err == Z_OK ) { \n\n                if (!d_stream.avail_in) break; /* need more input */\n\t\t\n                /* need more space in output buffer */\n                /* First check if more memory is available above the\n                    4Gb limit in the originally input buffptr array */\n                if (iPage < nPages)\n                {\n                   ++iPage;\n                   d_stream.next_out = (unsigned char*)(*buffptr + iPage*(uLong)UINT_MAX);\n                   if (iPage < nPages)\n                      d_stream.avail_out = UINT_MAX;\n                   else\n                      d_stream.avail_out = (uInt)((uLong)(*buffsize) % (uLong)UINT_MAX);\n                }\n                else if (mem_realloc) {   \n                    *buffptr = mem_realloc(*buffptr,*buffsize + BUFFINCR);\n                    if (*buffptr == NULL){\n                        inflateEnd(&d_stream);\n                        free(filebuff);\n                        return(*status = 414);  /* memory allocation failed */\n                    }\n\n                    d_stream.avail_out = BUFFINCR;\n                    d_stream.next_out = (unsigned char*) (*buffptr + *buffsize);\n                    *buffsize = *buffsize + BUFFINCR;\n                } else  { /* error: no realloc function available */\n                    inflateEnd(&d_stream);\n                    free(filebuff);\n                    return(*status = 414);\n                }\n            } else {  /* some other error */\n                inflateEnd(&d_stream);\n                free(filebuff);\n                return(*status = 414);\n            }\n        }\n\t\n\tif (feof(diskfile))  break;\n/*     \n        These settings for next_out and avail_out appear to be redundant,\n        as the inflate() function should already be re-setting these.\n        For case where *buffsize < 4Gb this did not matter, but for\n        > 4Gb it would produce the wrong value in the avail_out assignment.\n        (C. Gordon Jul 2016)\n        d_stream.next_out = (unsigned char*) (*buffptr + d_stream.total_out);\n        d_stream.avail_out = *buffsize - d_stream.total_out;\n*/    }\n\n    /* Set the output file size to be the total output data */\n    *filesize = d_stream.total_out;\n    \n    free(filebuff); /* free temporary output data buffer */\n    \n    err = inflateEnd(&d_stream); /* End the decompression */\n    if (err != Z_OK) return(*status = 414);\n  \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint uncompress2mem_from_mem(                                                \n             char *inmemptr,     /* I - memory pointer to compressed bytes */\n             size_t inmemsize,   /* I - size of input compressed file      */\n             char **buffptr,   /* IO - memory pointer                      */\n             size_t *buffsize,   /* IO - size of buffer, in bytes           */\n             void *(*mem_realloc)(void *p, size_t newsize), /* function     */\n             size_t *filesize,   /* O - size of file, in bytes              */\n             int *status)        /* IO - error status                       */\n\n/*\n  Uncompress the file in memory into memory.  Fill whatever amount of memory has\n  already been allocated, then realloc more memory, using the supplied\n  input function, if necessary.\n*/\n{\n    int err; \n    z_stream d_stream;   /* decompression stream */\n\n    if (*status > 0) \n        return(*status); \n\n    d_stream.zalloc = (alloc_func)0;\n    d_stream.zfree = (free_func)0;\n    d_stream.opaque = (voidpf)0;\n\n    /* Initialize the decompression.  The argument (15+16) tells the\n       decompressor that we are to use the gzip algorithm */\n    err = inflateInit2(&d_stream, (15+16));\n    if (err != Z_OK) return(*status = 414);\n\n    d_stream.next_in = (unsigned char*)inmemptr;\n    d_stream.avail_in = inmemsize;\n\n    d_stream.next_out = (unsigned char*) *buffptr;\n    d_stream.avail_out = *buffsize;\n\n    for (;;) {\n        /* uncompress as much of the input as will fit in the output */\n        err = inflate(&d_stream, Z_NO_FLUSH);\n\n        if (err == Z_STREAM_END) { /* We reached the end of the input */\n\t    break; \n        } else if (err == Z_OK ) { /* need more space in output buffer */\n\n            if (mem_realloc) {   \n                *buffptr = mem_realloc(*buffptr,*buffsize + BUFFINCR);\n                if (*buffptr == NULL){\n                    inflateEnd(&d_stream);\n                    return(*status = 414);  /* memory allocation failed */\n                }\n\n                d_stream.avail_out = BUFFINCR;\n                d_stream.next_out = (unsigned char*) (*buffptr + *buffsize);\n                *buffsize = *buffsize + BUFFINCR;\n\n            } else  { /* error: no realloc function available */\n                inflateEnd(&d_stream);\n                return(*status = 414);\n            }\n        } else {  /* some other error */\n            inflateEnd(&d_stream);\n            return(*status = 414);\n        }\n    }\n\n    /* Set the output file size to be the total output data */\n    if (filesize) *filesize = d_stream.total_out;\n\n    /* End the decompression */\n    err = inflateEnd(&d_stream);\n\n    if (err != Z_OK) return(*status = 414);\n    \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint uncompress2file(char *filename,  /* name of input file                  */\n             FILE *indiskfile,     /* I - input file pointer                */\n             FILE *outdiskfile,    /* I - output file pointer               */\n             int *status)        /* IO - error status                       */\n/*\n  Uncompress the file into another file. \n*/\n{\n    int err, len;\n    unsigned long bytes_out = 0;\n    char *infilebuff, *outfilebuff;\n    z_stream d_stream;   /* decompression stream */\n\n    if (*status > 0) \n        return(*status); \n\n    /* Allocate buffers to hold compressed and uncompressed */\n    infilebuff = (char*)malloc(GZBUFSIZE);\n    if (!infilebuff) return(*status = 113); /* memory error */\n\n    outfilebuff = (char*)malloc(GZBUFSIZE);\n    if (!outfilebuff) return(*status = 113); /* memory error */\n\n    d_stream.zalloc = (alloc_func)0;\n    d_stream.zfree = (free_func)0;\n    d_stream.opaque = (voidpf)0;\n\n    d_stream.next_out = (unsigned char*) outfilebuff;\n    d_stream.avail_out = GZBUFSIZE;\n\n    /* Initialize the decompression.  The argument (15+16) tells the\n       decompressor that we are to use the gzip algorithm */\n\n    err = inflateInit2(&d_stream, (15+16));\n    if (err != Z_OK) return(*status = 414);\n\n    /* loop through the file, reading a buffer and uncompressing it */\n    for (;;)\n    {\n        len = fread(infilebuff, 1, GZBUFSIZE, indiskfile);\n\tif (ferror(indiskfile)) {\n              inflateEnd(&d_stream);\n              free(infilebuff);\n              free(outfilebuff);\n              return(*status = 414);\n\t}\n\n        if (len == 0) break;  /* no more data */\n\n        d_stream.next_in = (unsigned char*)infilebuff;\n        d_stream.avail_in = len;\n\n        for (;;) {\n            /* uncompress as much of the input as will fit in the output */\n            err = inflate(&d_stream, Z_NO_FLUSH);\n\n            if (err == Z_STREAM_END ) { /* We reached the end of the input */\n\t        break; \n            } else if (err == Z_OK ) { \n\n                if (!d_stream.avail_in) break; /* need more input */\n\t\t\n                /* flush out the full output buffer */\n                if ((int)fwrite(outfilebuff, 1, GZBUFSIZE, outdiskfile) != GZBUFSIZE) {\n                    inflateEnd(&d_stream);\n                    free(infilebuff);\n                    free(outfilebuff);\n                    return(*status = 414);\n                }\n                bytes_out += GZBUFSIZE;\n                d_stream.next_out = (unsigned char*) outfilebuff;\n                d_stream.avail_out = GZBUFSIZE;\n\n            } else {  /* some other error */\n                inflateEnd(&d_stream);\n                free(infilebuff);\n                free(outfilebuff);\n                return(*status = 414);\n            }\n        }\n\t\n\tif (feof(indiskfile))  break;\n    }\n\n    /* write out any remaining bytes in the buffer */\n    if (d_stream.total_out > bytes_out) {\n        if ((int)fwrite(outfilebuff, 1, (d_stream.total_out - bytes_out), outdiskfile) \n\t    != (d_stream.total_out - bytes_out)) {\n            inflateEnd(&d_stream);\n            free(infilebuff);\n            free(outfilebuff);\n            return(*status = 414);\n        }\n    }\n\n    free(infilebuff); /* free temporary output data buffer */\n    free(outfilebuff); /* free temporary output data buffer */\n\n    err = inflateEnd(&d_stream); /* End the decompression */\n    if (err != Z_OK) return(*status = 414);\n  \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint compress2mem_from_mem(                                                \n             char *inmemptr,     /* I - memory pointer to uncompressed bytes */\n             size_t inmemsize,   /* I - size of input uncompressed file      */\n             char **buffptr,   /* IO - memory pointer for compressed file    */\n             size_t *buffsize,   /* IO - size of buffer, in bytes           */\n             void *(*mem_realloc)(void *p, size_t newsize), /* function     */\n             size_t *filesize,   /* O - size of file, in bytes              */\n             int *status)        /* IO - error status                       */\n\n/*\n  Compress the file into memory.  Fill whatever amount of memory has\n  already been allocated, then realloc more memory, using the supplied\n  input function, if necessary.\n*/\n{\n    int err;\n    z_stream c_stream;  /* compression stream */\n\n    if (*status > 0)\n        return(*status);\n\n    c_stream.zalloc = (alloc_func)0;\n    c_stream.zfree = (free_func)0;\n    c_stream.opaque = (voidpf)0;\n\n    /* Initialize the compression.  The argument (15+16) tells the \n       compressor that we are to use the gzip algorythm.\n       Also use Z_BEST_SPEED for maximum speed with very minor loss\n       in compression factor. */\n    err = deflateInit2(&c_stream, Z_BEST_SPEED, Z_DEFLATED,\n                       (15+16), 8, Z_DEFAULT_STRATEGY);\n\n    if (err != Z_OK) return(*status = 413);\n\n    c_stream.next_in = (unsigned char*)inmemptr;\n    c_stream.avail_in = inmemsize;\n\n    c_stream.next_out = (unsigned char*) *buffptr;\n    c_stream.avail_out = *buffsize;\n\n    for (;;) {\n        /* compress as much of the input as will fit in the output */\n        err = deflate(&c_stream, Z_FINISH);\n\n        if (err == Z_STREAM_END) {  /* We reached the end of the input */\n\t   break;\n        } else if (err == Z_OK ) { /* need more space in output buffer */\n\n            if (mem_realloc) {   \n                *buffptr = mem_realloc(*buffptr,*buffsize + BUFFINCR);\n                if (*buffptr == NULL){\n                    deflateEnd(&c_stream);\n                    return(*status = 413);  /* memory allocation failed */\n                }\n\n                c_stream.avail_out = BUFFINCR;\n                c_stream.next_out = (unsigned char*) (*buffptr + *buffsize);\n                *buffsize = *buffsize + BUFFINCR;\n\n            } else  { /* error: no realloc function available */\n                deflateEnd(&c_stream);\n                return(*status = 413);\n            }\n        } else {  /* some other error */\n            deflateEnd(&c_stream);\n            return(*status = 413);\n        }\n    }\n\n    /* Set the output file size to be the total output data */\n    if (filesize) *filesize = c_stream.total_out;\n\n    /* End the compression */\n    err = deflateEnd(&c_stream);\n\n    if (err != Z_OK) return(*status = 413);\n     \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint compress2file_from_mem(                                                \n             char *inmemptr,     /* I - memory pointer to uncompressed bytes */\n             size_t inmemsize,   /* I - size of input uncompressed file      */\n             FILE *outdiskfile, \n             size_t *filesize,   /* O - size of file, in bytes              */\n             int *status)\n\n/*\n  Compress the memory file into disk file. \n*/\n{\n    int err;\n    unsigned long bytes_out = 0;\n    char  *outfilebuff;\n    z_stream c_stream;  /* compression stream */\n\n    if (*status > 0)\n        return(*status);\n\n    /* Allocate buffer to hold compressed bytes */\n    outfilebuff = (char*)malloc(GZBUFSIZE);\n    if (!outfilebuff) return(*status = 113); /* memory error */\n\n    c_stream.zalloc = (alloc_func)0;\n    c_stream.zfree = (free_func)0;\n    c_stream.opaque = (voidpf)0;\n\n    /* Initialize the compression.  The argument (15+16) tells the \n       compressor that we are to use the gzip algorythm.\n       Also use Z_BEST_SPEED for maximum speed with very minor loss\n       in compression factor. */\n    err = deflateInit2(&c_stream, Z_BEST_SPEED, Z_DEFLATED,\n                       (15+16), 8, Z_DEFAULT_STRATEGY);\n\n    if (err != Z_OK) return(*status = 413);\n\n    c_stream.next_in = (unsigned char*)inmemptr;\n    c_stream.avail_in = inmemsize;\n\n    c_stream.next_out = (unsigned char*) outfilebuff;\n    c_stream.avail_out = GZBUFSIZE;\n\n    for (;;) {\n        /* compress as much of the input as will fit in the output */\n        err = deflate(&c_stream, Z_FINISH);\n\n        if (err == Z_STREAM_END) {  /* We reached the end of the input */\n\t   break;\n        } else if (err == Z_OK ) { /* need more space in output buffer */\n\n            /* flush out the full output buffer */\n            if ((int)fwrite(outfilebuff, 1, GZBUFSIZE, outdiskfile) != GZBUFSIZE) {\n                deflateEnd(&c_stream);\n                free(outfilebuff);\n                return(*status = 413);\n            }\n            bytes_out += GZBUFSIZE;\n            c_stream.next_out = (unsigned char*) outfilebuff;\n            c_stream.avail_out = GZBUFSIZE;\n\n\n        } else {  /* some other error */\n            deflateEnd(&c_stream);\n            free(outfilebuff);\n            return(*status = 413);\n        }\n    }\n\n    /* write out any remaining bytes in the buffer */\n    if (c_stream.total_out > bytes_out) {\n        if ((int)fwrite(outfilebuff, 1, (c_stream.total_out - bytes_out), outdiskfile) \n\t    != (c_stream.total_out - bytes_out)) {\n            deflateEnd(&c_stream);\n            free(outfilebuff);\n            return(*status = 413);\n        }\n    }\n\n    free(outfilebuff); /* free temporary output data buffer */\n\n    /* Set the output file size to be the total output data */\n    if (filesize) *filesize = c_stream.total_out;\n\n    /* End the compression */\n    err = deflateEnd(&c_stream);\n\n    if (err != Z_OK) return(*status = 413);\n     \n    return(*status);\n}\n"},{"id":16700,"name":"fits_hdecompress.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  #########################################################################\nThese routines to apply the H-compress decompression algorithm to a 2-D Fits\nimage were written by R. White at the STScI and were obtained from the STScI at\nhttp://www.stsci.edu/software/hcompress.html\n\nThis source file is a concatination of the following sources files in the\noriginal distribution \n  hinv.c \n  hsmooth.c \n  undigitize.c \n  decode.c \n  dodecode.c \n  qtree_decode.c \n  qread.c \n  bit_input.c\n\n\nThe following modifications have been made to the original code:\n\n  - commented out redundant \"include\" statements\n  - added the nextchar global variable \n  - changed all the 'extern' declarations to 'static', since all the routines are in\n    the same source file\n  - changed the first parameter in decode (and in lower level routines from a file stream\n    to a char array\n  - modified the myread routine, and lower level byte reading routines,  to copy \n    the input bytes to a char array, instead of reading them from a file stream\n  - changed the function declarations to the more modern ANSI C style\n  - changed calls to printf and perror to call the CFITSIO ffpmsg routine\n  - replace \"exit\" statements with \"return\" statements\n\n ############################################################################  */\n \n#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n#include \"fitsio2.h\"\n\n/* WDP added test to see if min and max are already defined */\n#ifndef min\n#define min(a,b)        (((a)<(b))?(a):(b))\n#endif\n#ifndef max\n#define max(a,b)        (((a)>(b))?(a):(b))\n#endif\n\nstatic long nextchar;\n\nstatic int decode(unsigned char *infile, int *a, int *nx, int *ny, int *scale);\nstatic int decode64(unsigned char *infile, LONGLONG *a, int *nx, int *ny, int *scale);\nstatic int hinv(int a[], int nx, int ny, int smooth ,int scale);\nstatic int hinv64(LONGLONG a[], int nx, int ny, int smooth ,int scale);\nstatic void undigitize(int a[], int nx, int ny, int scale);\nstatic void undigitize64(LONGLONG a[], int nx, int ny, int scale);\nstatic void unshuffle(int a[], int n, int n2, int tmp[]);\nstatic void unshuffle64(LONGLONG a[], int n, int n2, LONGLONG tmp[]);\nstatic void hsmooth(int a[], int nxtop, int nytop, int ny, int scale);\nstatic void hsmooth64(LONGLONG a[], int nxtop, int nytop, int ny, int scale);\nstatic void qread(unsigned char *infile,char *a, int n);\nstatic int  readint(unsigned char *infile);\nstatic LONGLONG readlonglong(unsigned char *infile);\nstatic int dodecode(unsigned char *infile, int a[], int nx, int ny, unsigned char nbitplanes[3]);\nstatic int dodecode64(unsigned char *infile, LONGLONG a[], int nx, int ny, unsigned char nbitplanes[3]);\nstatic int qtree_decode(unsigned char *infile, int a[], int n, int nqx, int nqy, int nbitplanes);\nstatic int qtree_decode64(unsigned char *infile, LONGLONG a[], int n, int nqx, int nqy, int nbitplanes);\nstatic void start_inputing_bits(void);\nstatic int input_bit(unsigned char *infile);\nstatic int input_nbits(unsigned char *infile, int n);\n/*  make input_nybble a separate routine, for added effiency */\n/* #define input_nybble(infile)\tinput_nbits(infile,4) */\nstatic int input_nybble(unsigned char *infile);\nstatic int input_nnybble(unsigned char *infile, int n, unsigned char *array);\n\nstatic void qtree_expand(unsigned char *infile, unsigned char a[], int nx, int ny, unsigned char b[]);\nstatic void qtree_bitins(unsigned char a[], int nx, int ny, int b[], int n, int bit);\nstatic void qtree_bitins64(unsigned char a[], int nx, int ny, LONGLONG b[], int n, int bit);\nstatic void qtree_copy(unsigned char a[], int nx, int ny, unsigned char b[], int n);\nstatic void read_bdirect(unsigned char *infile, int a[], int n, int nqx, int nqy, unsigned char scratch[], int bit);\nstatic void read_bdirect64(unsigned char *infile, LONGLONG a[], int n, int nqx, int nqy, unsigned char scratch[], int bit);\nstatic int  input_huffman(unsigned char *infile);\n\n/* ---------------------------------------------------------------------- */\nint fits_hdecompress(unsigned char *input, int smooth, int *a, int *ny, int *nx, \n                     int *scale, int *status)\n{\n  /* \n     decompress the input byte stream using the H-compress algorithm\n  \n   input  - input array of compressed bytes\n   a - pre-allocated array to hold the output uncompressed image\n   nx - returned X axis size\n   ny - returned Y axis size\n\n NOTE: the nx and ny dimensions as defined within this code are reversed from\n the usual FITS notation.  ny is the fastest varying dimension, which is\n usually considered the X axis in the FITS image display\n\n  */\nint stat;\n\n  if (*status > 0) return(*status);\n\n\t/* decode the input array */\n\n        FFLOCK;  /* decode uses the nextchar global variable */\n\tstat = decode(input, a, nx, ny, scale);\n        FFUNLOCK;\n\n        *status = stat;\n\tif (stat) return(*status);\n\t\n\t/*\n\t * Un-Digitize\n\t */\n\tundigitize(a, *nx, *ny, *scale);\n\n\t/*\n\t * Inverse H-transform\n\t */\n\tstat = hinv(a, *nx, *ny, smooth, *scale);\n        *status = stat;\n\t\n  return(*status);\n}\n/* ---------------------------------------------------------------------- */\nint fits_hdecompress64(unsigned char *input, int smooth, LONGLONG *a, int *ny, int *nx, \n                     int *scale, int *status)\n{\n  /* \n     decompress the input byte stream using the H-compress algorithm\n  \n   input  - input array of compressed bytes\n   a - pre-allocated array to hold the output uncompressed image\n   nx - returned X axis size\n   ny - returned Y axis size\n\n NOTE: the nx and ny dimensions as defined within this code are reversed from\n the usual FITS notation.  ny is the fastest varying dimension, which is\n usually considered the X axis in the FITS image display\n\n  */\n  int stat, *iarray, ii, nval;\n\n  if (*status > 0) return(*status);\n\n\t/* decode the input array */\n\n        FFLOCK;  /* decode uses the nextchar global variable */\n\tstat = decode64(input, a, nx, ny, scale);\n        FFUNLOCK;\n\n        *status = stat;\n\tif (stat) return(*status);\n\t\n\t/*\n\t * Un-Digitize\n\t */\n\tundigitize64(a, *nx, *ny, *scale);\n\n\t/*\n\t * Inverse H-transform\n\t */\n\tstat = hinv64(a, *nx, *ny, smooth, *scale);\n\n        *status = stat;\n\t\n         /* pack the I*8 values back into an I*4 array */\n        iarray = (int *) a;\n\tnval = (*nx) * (*ny);\n\n\tfor (ii = 0; ii < nval; ii++)\n\t   iarray[ii] = (int) a[ii];\t\n\n  return(*status);\n}\n\n/*  ############################################################################  */\n/*  ############################################################################  */\n\n/* Copyright (c) 1993 Association of Universities for Research \n * in Astronomy. All rights reserved. Produced under National   \n * Aeronautics and Space Administration Contract No. NAS5-26555.\n */\n/* hinv.c   Inverse H-transform of NX x NY integer image\n *\n * Programmer: R. White\t\tDate: 23 July 1993\n */\n\n/*  ############################################################################  */\nstatic int \nhinv(int a[], int nx, int ny, int smooth ,int scale)\n/*\nint smooth;    0 for no smoothing, else smooth during inversion \nint scale;     used if smoothing is specified \n*/\n{\nint nmax, log2n, i, j, k;\nint nxtop,nytop,nxf,nyf,c;\nint oddx,oddy;\nint shift, bit0, bit1, bit2, mask0, mask1, mask2,\n\tprnd0, prnd1, prnd2, nrnd0, nrnd1, nrnd2, lowbit0, lowbit1;\nint h0, hx, hy, hc;\nint s10, s00;\nint *tmp;\n\n\t/*\n\t * log2n is log2 of max(nx,ny) rounded up to next power of 2\n\t */\n\tnmax = (nx>ny) ? nx : ny;\n\tlog2n = (int) (log((float) nmax)/log(2.0)+0.5);\n\tif ( nmax > (1<<log2n) ) {\n\t\tlog2n += 1;\n\t}\n\t/*\n\t * get temporary storage for shuffling elements\n\t */  \n\ttmp = (int *) malloc(((nmax+1)/2)*sizeof(int));\n\tif (tmp == (int *) NULL) {\n\t\tffpmsg(\"hinv: insufficient memory\");\n\t\treturn(DATA_DECOMPRESSION_ERR);\n\t}\n\t/*\n\t * set up masks, rounding parameters\n\t */\n\tshift  = 1;\n\tbit0   = 1 << (log2n - 1);\n\tbit1   = bit0 << 1;\n\tbit2   = bit0 << 2;\n\tmask0  = -bit0;\n\tmask1  = mask0 << 1;\n\tmask2  = mask0 << 2;\n\tprnd0  = bit0 >> 1;\n\tprnd1  = bit1 >> 1;\n\tprnd2  = bit2 >> 1;\n\tnrnd0  = prnd0 - 1;\n\tnrnd1  = prnd1 - 1;\n\tnrnd2  = prnd2 - 1;\n\t/*\n\t * round h0 to multiple of bit2\n\t */\n\ta[0] = (a[0] + ((a[0] >= 0) ? prnd2 : nrnd2)) & mask2;\n\t/*\n\t * do log2n expansions\n\t *\n\t * We're indexing a as a 2-D array with dimensions (nx,ny).\n\t */\n\tnxtop = 1;\n\tnytop = 1;\n\tnxf = nx;\n\tnyf = ny;\n\tc = 1<<log2n;\n\tfor (k = log2n-1; k>=0; k--) {\n\t\t/*\n\t\t * this somewhat cryptic code generates the sequence\n\t\t * ntop[k-1] = (ntop[k]+1)/2, where ntop[log2n] = n\n\t\t */\n\t\tc = c>>1;\n\t\tnxtop = nxtop<<1;\n\t\tnytop = nytop<<1;\n\t\tif (nxf <= c) { nxtop -= 1; } else { nxf -= c; }\n\t\tif (nyf <= c) { nytop -= 1; } else { nyf -= c; }\n\t\t/*\n\t\t * double shift and fix nrnd0 (because prnd0=0) on last pass\n\t\t */\n\t\tif (k == 0) {\n\t\t\tnrnd0 = 0;\n\t\t\tshift = 2;\n\t\t}\n\t\t/*\n\t\t * unshuffle in each dimension to interleave coefficients\n\t\t */\n\t\tfor (i = 0; i<nxtop; i++) {\n\t\t\tunshuffle(&a[ny*i],nytop,1,tmp);\n\t\t}\n\t\tfor (j = 0; j<nytop; j++) {\n\t\t\tunshuffle(&a[j],nxtop,ny,tmp);\n\t\t}\n\t\t/*\n\t\t * smooth by interpolating coefficients if SMOOTH != 0\n\t\t */\n\t\tif (smooth) hsmooth(a,nxtop,nytop,ny,scale);\n\t\toddx = nxtop % 2;\n\t\toddy = nytop % 2;\n\t\tfor (i = 0; i<nxtop-oddx; i += 2) {\n\t\t\ts00 = ny*i;\t\t\t\t/* s00 is index of a[i,j]\t*/\n\t\t\ts10 = s00+ny;\t\t\t/* s10 is index of a[i+1,j]\t*/\n\t\t\tfor (j = 0; j<nytop-oddy; j += 2) {\n\t\t\t\th0 = a[s00  ];\n\t\t\t\thx = a[s10  ];\n\t\t\t\thy = a[s00+1];\n\t\t\t\thc = a[s10+1];\n\t\t\t\t/*\n\t\t\t\t * round hx and hy to multiple of bit1, hc to multiple of bit0\n\t\t\t\t * h0 is already a multiple of bit2\n\t\t\t\t */\n\t\t\t\thx = (hx + ((hx >= 0) ? prnd1 : nrnd1)) & mask1;\n\t\t\t\thy = (hy + ((hy >= 0) ? prnd1 : nrnd1)) & mask1;\n\t\t\t\thc = (hc + ((hc >= 0) ? prnd0 : nrnd0)) & mask0;\n\t\t\t\t/*\n\t\t\t\t * propagate bit0 of hc to hx,hy\n\t\t\t\t */\n\t\t\t\tlowbit0 = hc & bit0;\n\t\t\t\thx = (hx >= 0) ? (hx - lowbit0) : (hx + lowbit0);\n\t\t\t\thy = (hy >= 0) ? (hy - lowbit0) : (hy + lowbit0);\n\t\t\t\t/*\n\t\t\t\t * Propagate bits 0 and 1 of hc,hx,hy to h0.\n\t\t\t\t * This could be simplified if we assume h0>0, but then\n\t\t\t\t * the inversion would not be lossless for images with\n\t\t\t\t * negative pixels.\n\t\t\t\t */\n\t\t\t\tlowbit1 = (hc ^ hx ^ hy) & bit1;\n\t\t\t\th0 = (h0 >= 0)\n\t\t\t\t\t? (h0 + lowbit0 - lowbit1)\n\t\t\t\t\t: (h0 + ((lowbit0 == 0) ? lowbit1 : (lowbit0-lowbit1)));\n\t\t\t\t/*\n\t\t\t\t * Divide sums by 2 (4 last time)\n\t\t\t\t */\n\t\t\t\ta[s10+1] = (h0 + hx + hy + hc) >> shift;\n\t\t\t\ta[s10  ] = (h0 + hx - hy - hc) >> shift;\n\t\t\t\ta[s00+1] = (h0 - hx + hy - hc) >> shift;\n\t\t\t\ta[s00  ] = (h0 - hx - hy + hc) >> shift;\n\t\t\t\ts00 += 2;\n\t\t\t\ts10 += 2;\n\t\t\t}\n\t\t\tif (oddy) {\n\t\t\t\t/*\n\t\t\t\t * do last element in row if row length is odd\n\t\t\t\t * s00+1, s10+1 are off edge\n\t\t\t\t */\n\t\t\t\th0 = a[s00  ];\n\t\t\t\thx = a[s10  ];\n\t\t\t\thx = ((hx >= 0) ? (hx+prnd1) : (hx+nrnd1)) & mask1;\n\t\t\t\tlowbit1 = hx & bit1;\n\t\t\t\th0 = (h0 >= 0) ? (h0 - lowbit1) : (h0 + lowbit1);\n\t\t\t\ta[s10  ] = (h0 + hx) >> shift;\n\t\t\t\ta[s00  ] = (h0 - hx) >> shift;\n\t\t\t}\n\t\t}\n\t\tif (oddx) {\n\t\t\t/*\n\t\t\t * do last row if column length is odd\n\t\t\t * s10, s10+1 are off edge\n\t\t\t */\n\t\t\ts00 = ny*i;\n\t\t\tfor (j = 0; j<nytop-oddy; j += 2) {\n\t\t\t\th0 = a[s00  ];\n\t\t\t\thy = a[s00+1];\n\t\t\t\thy = ((hy >= 0) ? (hy+prnd1) : (hy+nrnd1)) & mask1;\n\t\t\t\tlowbit1 = hy & bit1;\n\t\t\t\th0 = (h0 >= 0) ? (h0 - lowbit1) : (h0 + lowbit1);\n\t\t\t\ta[s00+1] = (h0 + hy) >> shift;\n\t\t\t\ta[s00  ] = (h0 - hy) >> shift;\n\t\t\t\ts00 += 2;\n\t\t\t}\n\t\t\tif (oddy) {\n\t\t\t\t/*\n\t\t\t\t * do corner element if both row and column lengths are odd\n\t\t\t\t * s00+1, s10, s10+1 are off edge\n\t\t\t\t */\n\t\t\t\th0 = a[s00  ];\n\t\t\t\ta[s00  ] = h0 >> shift;\n\t\t\t}\n\t\t}\n\t\t/*\n\t\t * divide all the masks and rounding values by 2\n\t\t */\n\t\tbit2 = bit1;\n\t\tbit1 = bit0;\n\t\tbit0 = bit0 >> 1;\n\t\tmask1 = mask0;\n\t\tmask0 = mask0 >> 1;\n\t\tprnd1 = prnd0;\n\t\tprnd0 = prnd0 >> 1;\n\t\tnrnd1 = nrnd0;\n\t\tnrnd0 = prnd0 - 1;\n\t}\n\tfree(tmp);\n\treturn(0);\n}\n/*  ############################################################################  */\nstatic int \nhinv64(LONGLONG a[], int nx, int ny, int smooth ,int scale)\n/*\nint smooth;    0 for no smoothing, else smooth during inversion \nint scale;     used if smoothing is specified \n*/\n{\nint nmax, log2n, i, j, k;\nint nxtop,nytop,nxf,nyf,c;\nint oddx,oddy;\nint shift;\nLONGLONG mask0, mask1, mask2, prnd0, prnd1, prnd2, bit0, bit1, bit2;\nLONGLONG  nrnd0, nrnd1, nrnd2, lowbit0, lowbit1;\nLONGLONG h0, hx, hy, hc;\nint s10, s00;\nLONGLONG *tmp;\n\n\t/*\n\t * log2n is log2 of max(nx,ny) rounded up to next power of 2\n\t */\n\tnmax = (nx>ny) ? nx : ny;\n\tlog2n = (int) (log((float) nmax)/log(2.0)+0.5);\n\tif ( nmax > (1<<log2n) ) {\n\t\tlog2n += 1;\n\t}\n\t/*\n\t * get temporary storage for shuffling elements\n\t */  \n\ttmp = (LONGLONG *) malloc(((nmax+1)/2)*sizeof(LONGLONG));\n\tif (tmp == (LONGLONG *) NULL) {\n\t\tffpmsg(\"hinv64: insufficient memory\");\n\t\treturn(DATA_DECOMPRESSION_ERR);\n\t}\n\t/*\n\t * set up masks, rounding parameters\n\t */\n\tshift  = 1;\n\tbit0   = ((LONGLONG) 1) << (log2n - 1);\n\tbit1   = bit0 << 1;\n\tbit2   = bit0 << 2;\n\tmask0  = -bit0;\n\tmask1  = mask0 << 1;\n\tmask2  = mask0 << 2;\n\tprnd0  = bit0 >> 1;\n\tprnd1  = bit1 >> 1;\n\tprnd2  = bit2 >> 1;\n\tnrnd0  = prnd0 - 1;\n\tnrnd1  = prnd1 - 1;\n\tnrnd2  = prnd2 - 1;\n\t/*\n\t * round h0 to multiple of bit2\n\t */\n\ta[0] = (a[0] + ((a[0] >= 0) ? prnd2 : nrnd2)) & mask2;\n\t/*\n\t * do log2n expansions\n\t *\n\t * We're indexing a as a 2-D array with dimensions (nx,ny).\n\t */\n\tnxtop = 1;\n\tnytop = 1;\n\tnxf = nx;\n\tnyf = ny;\n\tc = 1<<log2n;\n\tfor (k = log2n-1; k>=0; k--) {\n\t\t/*\n\t\t * this somewhat cryptic code generates the sequence\n\t\t * ntop[k-1] = (ntop[k]+1)/2, where ntop[log2n] = n\n\t\t */\n\t\tc = c>>1;\n\t\tnxtop = nxtop<<1;\n\t\tnytop = nytop<<1;\n\t\tif (nxf <= c) { nxtop -= 1; } else { nxf -= c; }\n\t\tif (nyf <= c) { nytop -= 1; } else { nyf -= c; }\n\t\t/*\n\t\t * double shift and fix nrnd0 (because prnd0=0) on last pass\n\t\t */\n\t\tif (k == 0) {\n\t\t\tnrnd0 = 0;\n\t\t\tshift = 2;\n\t\t}\n\t\t/*\n\t\t * unshuffle in each dimension to interleave coefficients\n\t\t */\n\t\tfor (i = 0; i<nxtop; i++) {\n\t\t\tunshuffle64(&a[ny*i],nytop,1,tmp);\n\t\t}\n\t\tfor (j = 0; j<nytop; j++) {\n\t\t\tunshuffle64(&a[j],nxtop,ny,tmp);\n\t\t}\n\t\t/*\n\t\t * smooth by interpolating coefficients if SMOOTH != 0\n\t\t */\n\t\tif (smooth) hsmooth64(a,nxtop,nytop,ny,scale);\n\t\toddx = nxtop % 2;\n\t\toddy = nytop % 2;\n\t\tfor (i = 0; i<nxtop-oddx; i += 2) {\n\t\t\ts00 = ny*i;\t\t\t\t/* s00 is index of a[i,j]\t*/\n\t\t\ts10 = s00+ny;\t\t\t/* s10 is index of a[i+1,j]\t*/\n\t\t\tfor (j = 0; j<nytop-oddy; j += 2) {\n\t\t\t\th0 = a[s00  ];\n\t\t\t\thx = a[s10  ];\n\t\t\t\thy = a[s00+1];\n\t\t\t\thc = a[s10+1];\n\t\t\t\t/*\n\t\t\t\t * round hx and hy to multiple of bit1, hc to multiple of bit0\n\t\t\t\t * h0 is already a multiple of bit2\n\t\t\t\t */\n\t\t\t\thx = (hx + ((hx >= 0) ? prnd1 : nrnd1)) & mask1;\n\t\t\t\thy = (hy + ((hy >= 0) ? prnd1 : nrnd1)) & mask1;\n\t\t\t\thc = (hc + ((hc >= 0) ? prnd0 : nrnd0)) & mask0;\n\t\t\t\t/*\n\t\t\t\t * propagate bit0 of hc to hx,hy\n\t\t\t\t */\n\t\t\t\tlowbit0 = hc & bit0;\n\t\t\t\thx = (hx >= 0) ? (hx - lowbit0) : (hx + lowbit0);\n\t\t\t\thy = (hy >= 0) ? (hy - lowbit0) : (hy + lowbit0);\n\t\t\t\t/*\n\t\t\t\t * Propagate bits 0 and 1 of hc,hx,hy to h0.\n\t\t\t\t * This could be simplified if we assume h0>0, but then\n\t\t\t\t * the inversion would not be lossless for images with\n\t\t\t\t * negative pixels.\n\t\t\t\t */\n\t\t\t\tlowbit1 = (hc ^ hx ^ hy) & bit1;\n\t\t\t\th0 = (h0 >= 0)\n\t\t\t\t\t? (h0 + lowbit0 - lowbit1)\n\t\t\t\t\t: (h0 + ((lowbit0 == 0) ? lowbit1 : (lowbit0-lowbit1)));\n\t\t\t\t/*\n\t\t\t\t * Divide sums by 2 (4 last time)\n\t\t\t\t */\n\t\t\t\ta[s10+1] = (h0 + hx + hy + hc) >> shift;\n\t\t\t\ta[s10  ] = (h0 + hx - hy - hc) >> shift;\n\t\t\t\ta[s00+1] = (h0 - hx + hy - hc) >> shift;\n\t\t\t\ta[s00  ] = (h0 - hx - hy + hc) >> shift;\n\t\t\t\ts00 += 2;\n\t\t\t\ts10 += 2;\n\t\t\t}\n\t\t\tif (oddy) {\n\t\t\t\t/*\n\t\t\t\t * do last element in row if row length is odd\n\t\t\t\t * s00+1, s10+1 are off edge\n\t\t\t\t */\n\t\t\t\th0 = a[s00  ];\n\t\t\t\thx = a[s10  ];\n\t\t\t\thx = ((hx >= 0) ? (hx+prnd1) : (hx+nrnd1)) & mask1;\n\t\t\t\tlowbit1 = hx & bit1;\n\t\t\t\th0 = (h0 >= 0) ? (h0 - lowbit1) : (h0 + lowbit1);\n\t\t\t\ta[s10  ] = (h0 + hx) >> shift;\n\t\t\t\ta[s00  ] = (h0 - hx) >> shift;\n\t\t\t}\n\t\t}\n\t\tif (oddx) {\n\t\t\t/*\n\t\t\t * do last row if column length is odd\n\t\t\t * s10, s10+1 are off edge\n\t\t\t */\n\t\t\ts00 = ny*i;\n\t\t\tfor (j = 0; j<nytop-oddy; j += 2) {\n\t\t\t\th0 = a[s00  ];\n\t\t\t\thy = a[s00+1];\n\t\t\t\thy = ((hy >= 0) ? (hy+prnd1) : (hy+nrnd1)) & mask1;\n\t\t\t\tlowbit1 = hy & bit1;\n\t\t\t\th0 = (h0 >= 0) ? (h0 - lowbit1) : (h0 + lowbit1);\n\t\t\t\ta[s00+1] = (h0 + hy) >> shift;\n\t\t\t\ta[s00  ] = (h0 - hy) >> shift;\n\t\t\t\ts00 += 2;\n\t\t\t}\n\t\t\tif (oddy) {\n\t\t\t\t/*\n\t\t\t\t * do corner element if both row and column lengths are odd\n\t\t\t\t * s00+1, s10, s10+1 are off edge\n\t\t\t\t */\n\t\t\t\th0 = a[s00  ];\n\t\t\t\ta[s00  ] = h0 >> shift;\n\t\t\t}\n\t\t}\n\t\t/*\n\t\t * divide all the masks and rounding values by 2\n\t\t */\n\t\tbit2 = bit1;\n\t\tbit1 = bit0;\n\t\tbit0 = bit0 >> 1;\n\t\tmask1 = mask0;\n\t\tmask0 = mask0 >> 1;\n\t\tprnd1 = prnd0;\n\t\tprnd0 = prnd0 >> 1;\n\t\tnrnd1 = nrnd0;\n\t\tnrnd0 = prnd0 - 1;\n\t}\n\tfree(tmp);\n\treturn(0);\n}\n\n/*  ############################################################################  */\nstatic void\nunshuffle(int a[], int n, int n2, int tmp[])\n/*\nint a[];\t array to shuffle\t\t\t\t\t\nint n;\t\t number of elements to shuffle\t\nint n2;\t\t second dimension\t\t\t\t\t\nint tmp[];\t scratch storage\t\t\t\t\t\n*/\n{\nint i;\nint nhalf;\nint *p1, *p2, *pt;\n \n\t/*\n\t * copy 2nd half of array to tmp\n\t */\n\tnhalf = (n+1)>>1;\n\tpt = tmp;\n\tp1 = &a[n2*nhalf];\t\t\t\t/* pointer to a[i]\t\t\t*/\n\tfor (i=nhalf; i<n; i++) {\n\t\t*pt = *p1;\n\t\tp1 += n2;\n\t\tpt += 1;\n\t}\n\t/*\n\t * distribute 1st half of array to even elements\n\t */\n\tp2 = &a[ n2*(nhalf-1) ];\t\t/* pointer to a[i]\t\t\t*/\n\tp1 = &a[(n2*(nhalf-1))<<1];\t\t/* pointer to a[2*i]\t\t*/\n\tfor (i=nhalf-1; i >= 0; i--) {\n\t\t*p1 = *p2;\n\t\tp2 -= n2;\n\t\tp1 -= (n2+n2);\n\t}\n\t/*\n\t * now distribute 2nd half of array (in tmp) to odd elements\n\t */\n\tpt = tmp;\n\tp1 = &a[n2];\t\t\t\t\t/* pointer to a[i]\t\t\t*/\n\tfor (i=1; i<n; i += 2) {\n\t\t*p1 = *pt;\n\t\tp1 += (n2+n2);\n\t\tpt += 1;\n\t}\n}\n/*  ############################################################################  */\nstatic void\nunshuffle64(LONGLONG a[], int n, int n2, LONGLONG tmp[])\n/*\nLONGLONG a[];\t array to shuffle\t\t\t\t\t\nint n;\t\t number of elements to shuffle\t\nint n2;\t\t second dimension\t\t\t\t\t\nLONGLONG tmp[];\t scratch storage\t\t\t\t\t\n*/\n{\nint i;\nint nhalf;\nLONGLONG *p1, *p2, *pt;\n \n\t/*\n\t * copy 2nd half of array to tmp\n\t */\n\tnhalf = (n+1)>>1;\n\tpt = tmp;\n\tp1 = &a[n2*nhalf];\t\t\t\t/* pointer to a[i]\t\t\t*/\n\tfor (i=nhalf; i<n; i++) {\n\t\t*pt = *p1;\n\t\tp1 += n2;\n\t\tpt += 1;\n\t}\n\t/*\n\t * distribute 1st half of array to even elements\n\t */\n\tp2 = &a[ n2*(nhalf-1) ];\t\t/* pointer to a[i]\t\t\t*/\n\tp1 = &a[(n2*(nhalf-1))<<1];\t\t/* pointer to a[2*i]\t\t*/\n\tfor (i=nhalf-1; i >= 0; i--) {\n\t\t*p1 = *p2;\n\t\tp2 -= n2;\n\t\tp1 -= (n2+n2);\n\t}\n\t/*\n\t * now distribute 2nd half of array (in tmp) to odd elements\n\t */\n\tpt = tmp;\n\tp1 = &a[n2];\t\t\t\t\t/* pointer to a[i]\t\t\t*/\n\tfor (i=1; i<n; i += 2) {\n\t\t*p1 = *pt;\n\t\tp1 += (n2+n2);\n\t\tpt += 1;\n\t}\n}\n\n/*  ############################################################################  */\n/*  ############################################################################  */\n\n/* Copyright (c) 1993 Association of Universities for Research \n * in Astronomy. All rights reserved. Produced under National   \n * Aeronautics and Space Administration Contract No. NAS5-26555.\n */\n/* hsmooth.c\tSmooth H-transform image by adjusting coefficients toward\n *\t\t\t\tinterpolated values\n *\n * Programmer: R. White\t\tDate: 13 April 1992\n */\n\n/*  ############################################################################  */\nstatic void \nhsmooth(int a[], int nxtop, int nytop, int ny, int scale)\n/*\nint a[];\t\t\t array of H-transform coefficients\t\t\nint nxtop,nytop;\t size of coefficient block to use\t\t\t\nint ny;\t\t\t\t actual 1st dimension of array\t\t\t\nint scale;\t\t\t truncation scale factor that was used\t\n*/\n{\nint i, j;\nint ny2, s10, s00, diff, dmax, dmin, s, smax;\nint hm, h0, hp, hmm, hpm, hmp, hpp, hx2, hy2;\nint m1,m2;\n\n\t/*\n\t * Maximum change in coefficients is determined by scale factor.\n\t * Since we rounded during division (see digitize.c), the biggest\n\t * permitted change is scale/2.\n\t */\n\tsmax = (scale >> 1);\n\tif (smax <= 0) return;\n\tny2 = ny << 1;\n\t/*\n\t * We're indexing a as a 2-D array with dimensions (nxtop,ny) of which\n\t * only (nxtop,nytop) are used.  The coefficients on the edge of the\n\t * array are not adjusted (which is why the loops below start at 2\n\t * instead of 0 and end at nxtop-2 instead of nxtop.)\n\t */\n\t/*\n\t * Adjust x difference hx\n\t */\n\tfor (i = 2; i<nxtop-2; i += 2) {\n\t\ts00 = ny*i;\t\t\t\t/* s00 is index of a[i,j]\t*/\n\t\ts10 = s00+ny;\t\t\t/* s10 is index of a[i+1,j]\t*/\n\t\tfor (j = 0; j<nytop; j += 2) {\n\t\t\t/*\n\t\t\t * hp is h0 (mean value) in next x zone, hm is h0 in previous x zone\n\t\t\t */\n\t\t\thm = a[s00-ny2];\n\t\t\th0 = a[s00];\n\t\t\thp = a[s00+ny2];\n\t\t\t/*\n\t\t\t * diff = 8 * hx slope that would match h0 in neighboring zones\n\t\t\t */\n\t\t\tdiff = hp-hm;\n\t\t\t/*\n\t\t\t * monotonicity constraints on diff\n\t\t\t */\n\t\t\tdmax = max( min( (hp-h0), (h0-hm) ), 0 ) << 2;\n\t\t\tdmin = min( max( (hp-h0), (h0-hm) ), 0 ) << 2;\n\t\t\t/*\n\t\t\t * if monotonicity would set slope = 0 then don't change hx.\n\t\t\t * note dmax>=0, dmin<=0.\n\t\t\t */\n\t\t\tif (dmin < dmax) {\n\t\t\t\tdiff = max( min(diff, dmax), dmin);\n\t\t\t\t/*\n\t\t\t\t * Compute change in slope limited to range +/- smax.\n\t\t\t\t * Careful with rounding negative numbers when using\n\t\t\t\t * shift for divide by 8.\n\t\t\t\t */\n\t\t\t\ts = diff-(a[s10]<<3);\n\t\t\t\ts = (s>=0) ? (s>>3) : ((s+7)>>3) ;\n\t\t\t\ts = max( min(s, smax), -smax);\n\t\t\t\ta[s10] = a[s10]+s;\n\t\t\t}\n\t\t\ts00 += 2;\n\t\t\ts10 += 2;\n\t\t}\n\t}\n\t/*\n\t * Adjust y difference hy\n\t */\n\tfor (i = 0; i<nxtop; i += 2) {\n\t\ts00 = ny*i+2;\n\t\ts10 = s00+ny;\n\t\tfor (j = 2; j<nytop-2; j += 2) {\n\t\t\thm = a[s00-2];\n\t\t\th0 = a[s00];\n\t\t\thp = a[s00+2];\n\t\t\tdiff = hp-hm;\n\t\t\tdmax = max( min( (hp-h0), (h0-hm) ), 0 ) << 2;\n\t\t\tdmin = min( max( (hp-h0), (h0-hm) ), 0 ) << 2;\n\t\t\tif (dmin < dmax) {\n\t\t\t\tdiff = max( min(diff, dmax), dmin);\n\t\t\t\ts = diff-(a[s00+1]<<3);\n\t\t\t\ts = (s>=0) ? (s>>3) : ((s+7)>>3) ;\n\t\t\t\ts = max( min(s, smax), -smax);\n\t\t\t\ta[s00+1] = a[s00+1]+s;\n\t\t\t}\n\t\t\ts00 += 2;\n\t\t\ts10 += 2;\n\t\t}\n\t}\n\t/*\n\t * Adjust curvature difference hc\n\t */\n\tfor (i = 2; i<nxtop-2; i += 2) {\n\t\ts00 = ny*i+2;\n\t\ts10 = s00+ny;\n\t\tfor (j = 2; j<nytop-2; j += 2) {\n\t\t\t/*\n\t\t\t * ------------------    y\n\t\t\t * | hmp |    | hpp |    |\n\t\t\t * ------------------    |\n\t\t\t * |     | h0 |     |    |\n\t\t\t * ------------------    -------x\n\t\t\t * | hmm |    | hpm |\n\t\t\t * ------------------\n\t\t\t */\n\t\t\thmm = a[s00-ny2-2];\n\t\t\thpm = a[s00+ny2-2];\n\t\t\thmp = a[s00-ny2+2];\n\t\t\thpp = a[s00+ny2+2];\n\t\t\th0  = a[s00];\n\t\t\t/*\n\t\t\t * diff = 64 * hc value that would match h0 in neighboring zones\n\t\t\t */\n\t\t\tdiff = hpp + hmm - hmp - hpm;\n\t\t\t/*\n\t\t\t * 2 times x,y slopes in this zone\n\t\t\t */\n\t\t\thx2 = a[s10  ]<<1;\n\t\t\thy2 = a[s00+1]<<1;\n\t\t\t/*\n\t\t\t * monotonicity constraints on diff\n\t\t\t */\n\t\t\tm1 = min(max(hpp-h0,0)-hx2-hy2, max(h0-hpm,0)+hx2-hy2);\n\t\t\tm2 = min(max(h0-hmp,0)-hx2+hy2, max(hmm-h0,0)+hx2+hy2);\n\t\t\tdmax = min(m1,m2) << 4;\n\t\t\tm1 = max(min(hpp-h0,0)-hx2-hy2, min(h0-hpm,0)+hx2-hy2);\n\t\t\tm2 = max(min(h0-hmp,0)-hx2+hy2, min(hmm-h0,0)+hx2+hy2);\n\t\t\tdmin = max(m1,m2) << 4;\n\t\t\t/*\n\t\t\t * if monotonicity would set slope = 0 then don't change hc.\n\t\t\t * note dmax>=0, dmin<=0.\n\t\t\t */\n\t\t\tif (dmin < dmax) {\n\t\t\t\tdiff = max( min(diff, dmax), dmin);\n\t\t\t\t/*\n\t\t\t\t * Compute change in slope limited to range +/- smax.\n\t\t\t\t * Careful with rounding negative numbers when using\n\t\t\t\t * shift for divide by 64.\n\t\t\t\t */\n\t\t\t\ts = diff-(a[s10+1]<<6);\n\t\t\t\ts = (s>=0) ? (s>>6) : ((s+63)>>6) ;\n\t\t\t\ts = max( min(s, smax), -smax);\n\t\t\t\ta[s10+1] = a[s10+1]+s;\n\t\t\t}\n\t\t\ts00 += 2;\n\t\t\ts10 += 2;\n\t\t}\n\t}\n}\n/*  ############################################################################  */\nstatic void \nhsmooth64(LONGLONG a[], int nxtop, int nytop, int ny, int scale)\n/*\nLONGLONG a[];\t\t\t array of H-transform coefficients\t\t\nint nxtop,nytop;\t size of coefficient block to use\t\t\t\nint ny;\t\t\t\t actual 1st dimension of array\t\t\t\nint scale;\t\t\t truncation scale factor that was used\t\n*/\n{\nint i, j;\nint ny2, s10, s00;\nLONGLONG hm, h0, hp, hmm, hpm, hmp, hpp, hx2, hy2, diff, dmax, dmin, s, smax, m1, m2;\n\n\t/*\n\t * Maximum change in coefficients is determined by scale factor.\n\t * Since we rounded during division (see digitize.c), the biggest\n\t * permitted change is scale/2.\n\t */\n\tsmax = (scale >> 1);\n\tif (smax <= 0) return;\n\tny2 = ny << 1;\n\t/*\n\t * We're indexing a as a 2-D array with dimensions (nxtop,ny) of which\n\t * only (nxtop,nytop) are used.  The coefficients on the edge of the\n\t * array are not adjusted (which is why the loops below start at 2\n\t * instead of 0 and end at nxtop-2 instead of nxtop.)\n\t */\n\t/*\n\t * Adjust x difference hx\n\t */\n\tfor (i = 2; i<nxtop-2; i += 2) {\n\t\ts00 = ny*i;\t\t\t\t/* s00 is index of a[i,j]\t*/\n\t\ts10 = s00+ny;\t\t\t/* s10 is index of a[i+1,j]\t*/\n\t\tfor (j = 0; j<nytop; j += 2) {\n\t\t\t/*\n\t\t\t * hp is h0 (mean value) in next x zone, hm is h0 in previous x zone\n\t\t\t */\n\t\t\thm = a[s00-ny2];\n\t\t\th0 = a[s00];\n\t\t\thp = a[s00+ny2];\n\t\t\t/*\n\t\t\t * diff = 8 * hx slope that would match h0 in neighboring zones\n\t\t\t */\n\t\t\tdiff = hp-hm;\n\t\t\t/*\n\t\t\t * monotonicity constraints on diff\n\t\t\t */\n\t\t\tdmax = max( min( (hp-h0), (h0-hm) ), 0 ) << 2;\n\t\t\tdmin = min( max( (hp-h0), (h0-hm) ), 0 ) << 2;\n\t\t\t/*\n\t\t\t * if monotonicity would set slope = 0 then don't change hx.\n\t\t\t * note dmax>=0, dmin<=0.\n\t\t\t */\n\t\t\tif (dmin < dmax) {\n\t\t\t\tdiff = max( min(diff, dmax), dmin);\n\t\t\t\t/*\n\t\t\t\t * Compute change in slope limited to range +/- smax.\n\t\t\t\t * Careful with rounding negative numbers when using\n\t\t\t\t * shift for divide by 8.\n\t\t\t\t */\n\t\t\t\ts = diff-(a[s10]<<3);\n\t\t\t\ts = (s>=0) ? (s>>3) : ((s+7)>>3) ;\n\t\t\t\ts = max( min(s, smax), -smax);\n\t\t\t\ta[s10] = a[s10]+s;\n\t\t\t}\n\t\t\ts00 += 2;\n\t\t\ts10 += 2;\n\t\t}\n\t}\n\t/*\n\t * Adjust y difference hy\n\t */\n\tfor (i = 0; i<nxtop; i += 2) {\n\t\ts00 = ny*i+2;\n\t\ts10 = s00+ny;\n\t\tfor (j = 2; j<nytop-2; j += 2) {\n\t\t\thm = a[s00-2];\n\t\t\th0 = a[s00];\n\t\t\thp = a[s00+2];\n\t\t\tdiff = hp-hm;\n\t\t\tdmax = max( min( (hp-h0), (h0-hm) ), 0 ) << 2;\n\t\t\tdmin = min( max( (hp-h0), (h0-hm) ), 0 ) << 2;\n\t\t\tif (dmin < dmax) {\n\t\t\t\tdiff = max( min(diff, dmax), dmin);\n\t\t\t\ts = diff-(a[s00+1]<<3);\n\t\t\t\ts = (s>=0) ? (s>>3) : ((s+7)>>3) ;\n\t\t\t\ts = max( min(s, smax), -smax);\n\t\t\t\ta[s00+1] = a[s00+1]+s;\n\t\t\t}\n\t\t\ts00 += 2;\n\t\t\ts10 += 2;\n\t\t}\n\t}\n\t/*\n\t * Adjust curvature difference hc\n\t */\n\tfor (i = 2; i<nxtop-2; i += 2) {\n\t\ts00 = ny*i+2;\n\t\ts10 = s00+ny;\n\t\tfor (j = 2; j<nytop-2; j += 2) {\n\t\t\t/*\n\t\t\t * ------------------    y\n\t\t\t * | hmp |    | hpp |    |\n\t\t\t * ------------------    |\n\t\t\t * |     | h0 |     |    |\n\t\t\t * ------------------    -------x\n\t\t\t * | hmm |    | hpm |\n\t\t\t * ------------------\n\t\t\t */\n\t\t\thmm = a[s00-ny2-2];\n\t\t\thpm = a[s00+ny2-2];\n\t\t\thmp = a[s00-ny2+2];\n\t\t\thpp = a[s00+ny2+2];\n\t\t\th0  = a[s00];\n\t\t\t/*\n\t\t\t * diff = 64 * hc value that would match h0 in neighboring zones\n\t\t\t */\n\t\t\tdiff = hpp + hmm - hmp - hpm;\n\t\t\t/*\n\t\t\t * 2 times x,y slopes in this zone\n\t\t\t */\n\t\t\thx2 = a[s10  ]<<1;\n\t\t\thy2 = a[s00+1]<<1;\n\t\t\t/*\n\t\t\t * monotonicity constraints on diff\n\t\t\t */\n\t\t\tm1 = min(max(hpp-h0,0)-hx2-hy2, max(h0-hpm,0)+hx2-hy2);\n\t\t\tm2 = min(max(h0-hmp,0)-hx2+hy2, max(hmm-h0,0)+hx2+hy2);\n\t\t\tdmax = min(m1,m2) << 4;\n\t\t\tm1 = max(min(hpp-h0,0)-hx2-hy2, min(h0-hpm,0)+hx2-hy2);\n\t\t\tm2 = max(min(h0-hmp,0)-hx2+hy2, min(hmm-h0,0)+hx2+hy2);\n\t\t\tdmin = max(m1,m2) << 4;\n\t\t\t/*\n\t\t\t * if monotonicity would set slope = 0 then don't change hc.\n\t\t\t * note dmax>=0, dmin<=0.\n\t\t\t */\n\t\t\tif (dmin < dmax) {\n\t\t\t\tdiff = max( min(diff, dmax), dmin);\n\t\t\t\t/*\n\t\t\t\t * Compute change in slope limited to range +/- smax.\n\t\t\t\t * Careful with rounding negative numbers when using\n\t\t\t\t * shift for divide by 64.\n\t\t\t\t */\n\t\t\t\ts = diff-(a[s10+1]<<6);\n\t\t\t\ts = (s>=0) ? (s>>6) : ((s+63)>>6) ;\n\t\t\t\ts = max( min(s, smax), -smax);\n\t\t\t\ta[s10+1] = a[s10+1]+s;\n\t\t\t}\n\t\t\ts00 += 2;\n\t\t\ts10 += 2;\n\t\t}\n\t}\n}\n\n\n/*  ############################################################################  */\n/*  ############################################################################  */\n/* Copyright (c) 1993 Association of Universities for Research \n * in Astronomy. All rights reserved. Produced under National   \n * Aeronautics and Space Administration Contract No. NAS5-26555.\n */\n/* undigitize.c\t\tundigitize H-transform\n *\n * Programmer: R. White\t\tDate: 9 May 1991\n */\n\n/*  ############################################################################  */\nstatic void\nundigitize(int a[], int nx, int ny, int scale)\n{\nint *p;\n\n\t/*\n\t * multiply by scale\n\t */\n\tif (scale <= 1) return;\n\tfor (p=a; p <= &a[nx*ny-1]; p++) *p = (*p)*scale;\n}\n/*  ############################################################################  */\nstatic void\nundigitize64(LONGLONG a[], int nx, int ny, int scale)\n{\nLONGLONG *p, scale64;\n\n\t/*\n\t * multiply by scale\n\t */\n\tif (scale <= 1) return;\n\tscale64 = (LONGLONG) scale;   /* use a 64-bit int for efficiency in the big loop */\n\t\n\tfor (p=a; p <= &a[nx*ny-1]; p++) *p = (*p)*scale64;\n}\n\n/*  ############################################################################  */\n/*  ############################################################################  */\n/* Copyright (c) 1993 Association of Universities for Research \n * in Astronomy. All rights reserved. Produced under National   \n * Aeronautics and Space Administration Contract No. NAS5-26555.\n */\n/* decode.c\t\tread codes from infile and construct array\n *\n * Programmer: R. White\t\tDate: 2 February 1994\n */\n\n\nstatic char code_magic[2] = { (char)0xDD, (char)0x99 };\n\n/*  ############################################################################  */\nstatic int decode(unsigned char *infile, int *a, int *nx, int *ny, int *scale)\n/*\nchar *infile;\t\t\t\t input file\t\t\t\t\t\t\t\nint  *a;\t\t\t\t address of output array [nx][ny]\t\t\nint  *nx,*ny;\t\t\t\t size of output array\t\t\t\t\t\nint  *scale;\t\t\t\t scale factor for digitization\t\t\n*/\n{\nLONGLONG sumall;\nint stat;\nunsigned char nbitplanes[3];\nchar tmagic[2];\n\n\t/* initialize the byte read position to the beginning of the array */;\n\tnextchar = 0;\n\t\n\t/*\n\t * File starts either with special 2-byte magic code or with\n\t * FITS keyword \"SIMPLE  =\"\n\t */\n\tqread(infile, tmagic, sizeof(tmagic));\n\t/*\n\t * check for correct magic code value\n\t */\n\tif (memcmp(tmagic,code_magic,sizeof(code_magic)) != 0) {\n\t\tffpmsg(\"bad file format\");\n\t\treturn(DATA_DECOMPRESSION_ERR);\n\t}\n\t*nx =readint(infile);\t\t\t\t/* x size of image\t\t\t*/\n\t*ny =readint(infile);\t\t\t\t/* y size of image\t\t\t*/\n\t*scale=readint(infile);\t\t\t\t/* scale factor for digitization\t*/\n\t\n\t/* sum of all pixels\t*/\n\tsumall=readlonglong(infile);\n\t/* # bits in quadrants\t*/\n\n\tqread(infile, (char *) nbitplanes, sizeof(nbitplanes));\n\n\tstat = dodecode(infile, a, *nx, *ny, nbitplanes);\n\t/*\n\t * put sum of all pixels back into pixel 0\n\t */\n\ta[0] = (int) sumall;\n\treturn(stat);\n}\n/*  ############################################################################  */\nstatic int decode64(unsigned char *infile, LONGLONG *a, int *nx, int *ny, int *scale)\n/*\nchar *infile;\t\t\t\t input file\t\t\t\t\t\t\t\nLONGLONG  *a;\t\t\t\t address of output array [nx][ny]\t\t\nint  *nx,*ny;\t\t\t\t size of output array\t\t\t\t\t\nint  *scale;\t\t\t\t scale factor for digitization\t\t\n*/\n{\nint stat;\nLONGLONG sumall;\nunsigned char nbitplanes[3];\nchar tmagic[2];\n\n\t/* initialize the byte read position to the beginning of the array */;\n\tnextchar = 0;\n\t\n\t/*\n\t * File starts either with special 2-byte magic code or with\n\t * FITS keyword \"SIMPLE  =\"\n\t */\n\tqread(infile, tmagic, sizeof(tmagic));\n\t/*\n\t * check for correct magic code value\n\t */\n\tif (memcmp(tmagic,code_magic,sizeof(code_magic)) != 0) {\n\t\tffpmsg(\"bad file format\");\n\t\treturn(DATA_DECOMPRESSION_ERR);\n\t}\n\t*nx =readint(infile);\t\t\t\t/* x size of image\t\t\t*/\n\t*ny =readint(infile);\t\t\t\t/* y size of image\t\t\t*/\n\t*scale=readint(infile);\t\t\t\t/* scale factor for digitization\t*/\n\t\n\t/* sum of all pixels\t*/\n\tsumall=readlonglong(infile);\n\t/* # bits in quadrants\t*/\n\n\tqread(infile, (char *) nbitplanes, sizeof(nbitplanes));\n\n\tstat = dodecode64(infile, a, *nx, *ny, nbitplanes);\n\t/*\n\t * put sum of all pixels back into pixel 0\n\t */\n\ta[0] = sumall;\n\n\treturn(stat);\n}\n\n\n/*  ############################################################################  */\n/*  ############################################################################  */\n/* Copyright (c) 1993 Association of Universities for Research \n * in Astronomy. All rights reserved. Produced under National   \n * Aeronautics and Space Administration Contract No. NAS5-26555.\n */\n/* dodecode.c\tDecode stream of characters on infile and return array\n *\n * This version encodes the different quadrants separately\n *\n * Programmer: R. White\t\tDate: 9 May 1991\n */\n\n/*  ############################################################################  */\nstatic int\ndodecode(unsigned char *infile, int a[], int nx, int ny, unsigned char nbitplanes[3])\n\n/* int a[];\t\t\t\t\t \t\t\t\n   int nx,ny;\t\t\t\t\t Array dimensions are [nx][ny]\t\t\n   unsigned char nbitplanes[3];\t\t Number of bit planes in quadrants\n*/\n{\nint i, nel, nx2, ny2, stat;\n\n\tnel = nx*ny;\n\tnx2 = (nx+1)/2;\n\tny2 = (ny+1)/2;\n\n\t/*\n\t * initialize a to zero\n\t */\n\tfor (i=0; i<nel; i++) a[i] = 0;\n\t/*\n\t * Initialize bit input\n\t */\n\tstart_inputing_bits();\n\t/*\n\t * read bit planes for each quadrant\n\t */\n\tstat = qtree_decode(infile, &a[0],          ny, nx2,  ny2,  nbitplanes[0]);\n        if (stat) return(stat);\n\t\n\tstat = qtree_decode(infile, &a[ny2],        ny, nx2,  ny/2, nbitplanes[1]);\n        if (stat) return(stat);\n\t\n\tstat = qtree_decode(infile, &a[ny*nx2],     ny, nx/2, ny2,  nbitplanes[1]);\n        if (stat) return(stat);\n\t\n\tstat = qtree_decode(infile, &a[ny*nx2+ny2], ny, nx/2, ny/2, nbitplanes[2]);\n        if (stat) return(stat);\n\t\n\t/*\n\t * make sure there is an EOF symbol (nybble=0) at end\n\t */\n\tif (input_nybble(infile) != 0) {\n\t\tffpmsg(\"dodecode: bad bit plane values\");\n\t\treturn(DATA_DECOMPRESSION_ERR);\n\t}\n\t/*\n\t * now get the sign bits\n\t * Re-initialize bit input\n\t */\n\tstart_inputing_bits();\n\tfor (i=0; i<nel; i++) {\n\t\tif (a[i]) {\n\t\t\t/* tried putting the input_bit code in-line here, instead of */\n\t\t\t/* calling the function, but it made no difference in the speed */\n\t\t\tif (input_bit(infile)) a[i] = -a[i];\n\t\t}\n\t}\n\treturn(0);\n}\n/*  ############################################################################  */\nstatic int\ndodecode64(unsigned char *infile, LONGLONG a[], int nx, int ny, unsigned char nbitplanes[3])\n\n/* LONGLONG a[];\t\t\t\t\t \t\t\t\n   int nx,ny;\t\t\t\t\t Array dimensions are [nx][ny]\t\t\n   unsigned char nbitplanes[3];\t\t Number of bit planes in quadrants\n*/\n{\nint i, nel, nx2, ny2, stat;\n\n\tnel = nx*ny;\n\tnx2 = (nx+1)/2;\n\tny2 = (ny+1)/2;\n\n\t/*\n\t * initialize a to zero\n\t */\n\tfor (i=0; i<nel; i++) a[i] = 0;\n\t/*\n\t * Initialize bit input\n\t */\n\tstart_inputing_bits();\n\t/*\n\t * read bit planes for each quadrant\n\t */\n\tstat = qtree_decode64(infile, &a[0],          ny, nx2,  ny2,  nbitplanes[0]);\n        if (stat) return(stat);\n\t\n\tstat = qtree_decode64(infile, &a[ny2],        ny, nx2,  ny/2, nbitplanes[1]);\n        if (stat) return(stat);\n\t\n\tstat = qtree_decode64(infile, &a[ny*nx2],     ny, nx/2, ny2,  nbitplanes[1]);\n        if (stat) return(stat);\n\t\n\tstat = qtree_decode64(infile, &a[ny*nx2+ny2], ny, nx/2, ny/2, nbitplanes[2]);\n        if (stat) return(stat);\n\t\n\t/*\n\t * make sure there is an EOF symbol (nybble=0) at end\n\t */\n\tif (input_nybble(infile) != 0) {\n\t\tffpmsg(\"dodecode64: bad bit plane values\");\n\t\treturn(DATA_DECOMPRESSION_ERR);\n\t}\n\t/*\n\t * now get the sign bits\n\t * Re-initialize bit input\n\t */\n\tstart_inputing_bits();\n\tfor (i=0; i<nel; i++) {\n\t\tif (a[i]) {\n\t\t\tif (input_bit(infile) != 0) a[i] = -a[i];\n\t\t}\n\t}\n\treturn(0);\n}\n\n/*  ############################################################################  */\n/*  ############################################################################  */\n/* Copyright (c) 1993 Association of Universities for Research \n * in Astronomy. All rights reserved. Produced under National   \n * Aeronautics and Space Administration Contract No. NAS5-26555.\n */\n/* qtree_decode.c\tRead stream of codes from infile and construct bit planes\n *\t\t\t\t\tin quadrant of 2-D array using binary quadtree coding\n *\n * Programmer: R. White\t\tDate: 7 May 1991\n */\n\n/*  ############################################################################  */\nstatic int\nqtree_decode(unsigned char *infile, int a[], int n, int nqx, int nqy, int nbitplanes)\n\n/*\nchar *infile;\nint a[];\t\t\t\t a is 2-D array with dimensions (n,n)\t\nint n;\t\t\t\t\t length of full row in a\t\t\t\t\nint nqx;\t\t\t\t partial length of row to decode\t\t\nint nqy;\t\t\t\t partial length of column (<=n)\t\t\nint nbitplanes;\t\t\t\t number of bitplanes to decode\t\t\n*/\n{\nint log2n, k, bit, b, nqmax;\nint nx,ny,nfx,nfy,c;\nint nqx2, nqy2;\nunsigned char *scratch;\n\n\t/*\n\t * log2n is log2 of max(nqx,nqy) rounded up to next power of 2\n\t */\n\tnqmax = (nqx>nqy) ? nqx : nqy;\n\tlog2n = (int) (log((float) nqmax)/log(2.0)+0.5);\n\tif (nqmax > (1<<log2n)) {\n\t\tlog2n += 1;\n\t}\n\t/*\n\t * allocate scratch array for working space\n\t */\n\tnqx2=(nqx+1)/2;\n\tnqy2=(nqy+1)/2;\n\tscratch = (unsigned char *) malloc(nqx2*nqy2);\n\tif (scratch == (unsigned char *) NULL) {\n\t\tffpmsg(\"qtree_decode: insufficient memory\");\n\t\treturn(DATA_DECOMPRESSION_ERR);\n\t}\n\t/*\n\t * now decode each bit plane, starting at the top\n\t * A is assumed to be initialized to zero\n\t */\n\tfor (bit = nbitplanes-1; bit >= 0; bit--) {\n\t\t/*\n\t\t * Was bitplane was quadtree-coded or written directly?\n\t\t */\n\t\tb = input_nybble(infile);\n\n\t\tif(b == 0) {\n\t\t\t/*\n\t\t\t * bit map was written directly\n\t\t\t */\n\t\t\tread_bdirect(infile,a,n,nqx,nqy,scratch,bit);\n\t\t} else if (b != 0xf) {\n\t\t\tffpmsg(\"qtree_decode: bad format code\");\n\t\t\treturn(DATA_DECOMPRESSION_ERR);\n\t\t} else {\n\t\t\t/*\n\t\t\t * bitmap was quadtree-coded, do log2n expansions\n\t\t\t *\n\t\t\t * read first code\n\t\t\t */\n\t\t\tscratch[0] = input_huffman(infile);\n\t\t\t/*\n\t\t\t * now do log2n expansions, reading codes from file as necessary\n\t\t\t */\n\t\t\tnx = 1;\n\t\t\tny = 1;\n\t\t\tnfx = nqx;\n\t\t\tnfy = nqy;\n\t\t\tc = 1<<log2n;\n\t\t\tfor (k = 1; k<log2n; k++) {\n\t\t\t\t/*\n\t\t\t\t * this somewhat cryptic code generates the sequence\n\t\t\t\t * n[k-1] = (n[k]+1)/2 where n[log2n]=nqx or nqy\n\t\t\t\t */\n\t\t\t\tc = c>>1;\n\t\t\t\tnx = nx<<1;\n\t\t\t\tny = ny<<1;\n\t\t\t\tif (nfx <= c) { nx -= 1; } else { nfx -= c; }\n\t\t\t\tif (nfy <= c) { ny -= 1; } else { nfy -= c; }\n\t\t\t\tqtree_expand(infile,scratch,nx,ny,scratch);\n\t\t\t}\n\t\t\t/*\n\t\t\t * now copy last set of 4-bit codes to bitplane bit of array a\n\t\t\t */\n\t\t\tqtree_bitins(scratch,nqx,nqy,a,n,bit);\n\t\t}\n\t}\n\tfree(scratch);\n\treturn(0);\n}\n/*  ############################################################################  */\nstatic int\nqtree_decode64(unsigned char *infile, LONGLONG a[], int n, int nqx, int nqy, int nbitplanes)\n\n/*\nchar *infile;\nLONGLONG a[];\t\t\t\t a is 2-D array with dimensions (n,n)\t\nint n;\t\t\t\t\t length of full row in a\t\t\t\t\nint nqx;\t\t\t\t partial length of row to decode\t\t\nint nqy;\t\t\t\t partial length of column (<=n)\t\t\nint nbitplanes;\t\t\t\t number of bitplanes to decode\t\t\n*/\n{\nint log2n, k, bit, b, nqmax;\nint nx,ny,nfx,nfy,c;\nint nqx2, nqy2;\nunsigned char *scratch;\n\n\t/*\n\t * log2n is log2 of max(nqx,nqy) rounded up to next power of 2\n\t */\n\tnqmax = (nqx>nqy) ? nqx : nqy;\n\tlog2n = (int) (log((float) nqmax)/log(2.0)+0.5);\n\tif (nqmax > (1<<log2n)) {\n\t\tlog2n += 1;\n\t}\n\t/*\n\t * allocate scratch array for working space\n\t */\n\tnqx2=(nqx+1)/2;\n\tnqy2=(nqy+1)/2;\n\tscratch = (unsigned char *) malloc(nqx2*nqy2);\n\tif (scratch == (unsigned char *) NULL) {\n\t\tffpmsg(\"qtree_decode64: insufficient memory\");\n\t\treturn(DATA_DECOMPRESSION_ERR);\n\t}\n\t/*\n\t * now decode each bit plane, starting at the top\n\t * A is assumed to be initialized to zero\n\t */\n\tfor (bit = nbitplanes-1; bit >= 0; bit--) {\n\t\t/*\n\t\t * Was bitplane was quadtree-coded or written directly?\n\t\t */\n\t\tb = input_nybble(infile);\n\n\t\tif(b == 0) {\n\t\t\t/*\n\t\t\t * bit map was written directly\n\t\t\t */\n\t\t\tread_bdirect64(infile,a,n,nqx,nqy,scratch,bit);\n\t\t} else if (b != 0xf) {\n\t\t\tffpmsg(\"qtree_decode64: bad format code\");\n\t\t\treturn(DATA_DECOMPRESSION_ERR);\n\t\t} else {\n\t\t\t/*\n\t\t\t * bitmap was quadtree-coded, do log2n expansions\n\t\t\t *\n\t\t\t * read first code\n\t\t\t */\n\t\t\tscratch[0] = input_huffman(infile);\n\t\t\t/*\n\t\t\t * now do log2n expansions, reading codes from file as necessary\n\t\t\t */\n\t\t\tnx = 1;\n\t\t\tny = 1;\n\t\t\tnfx = nqx;\n\t\t\tnfy = nqy;\n\t\t\tc = 1<<log2n;\n\t\t\tfor (k = 1; k<log2n; k++) {\n\t\t\t\t/*\n\t\t\t\t * this somewhat cryptic code generates the sequence\n\t\t\t\t * n[k-1] = (n[k]+1)/2 where n[log2n]=nqx or nqy\n\t\t\t\t */\n\t\t\t\tc = c>>1;\n\t\t\t\tnx = nx<<1;\n\t\t\t\tny = ny<<1;\n\t\t\t\tif (nfx <= c) { nx -= 1; } else { nfx -= c; }\n\t\t\t\tif (nfy <= c) { ny -= 1; } else { nfy -= c; }\n\t\t\t\tqtree_expand(infile,scratch,nx,ny,scratch);\n\t\t\t}\n\t\t\t/*\n\t\t\t * now copy last set of 4-bit codes to bitplane bit of array a\n\t\t\t */\n\t\t\tqtree_bitins64(scratch,nqx,nqy,a,n,bit);\n\t\t}\n\t}\n\tfree(scratch);\n\treturn(0);\n}\n\n\n/*  ############################################################################  */\n/*\n * do one quadtree expansion step on array a[(nqx+1)/2,(nqy+1)/2]\n * results put into b[nqx,nqy] (which may be the same as a)\n */\nstatic void\nqtree_expand(unsigned char *infile, unsigned char a[], int nx, int ny, unsigned char b[])\n{\nint i;\n\n\t/*\n\t * first copy a to b, expanding each 4-bit value\n\t */\n\tqtree_copy(a,nx,ny,b,ny);\n\t/*\n\t * now read new 4-bit values into b for each non-zero element\n\t */\n\tfor (i = nx*ny-1; i >= 0; i--) {\n\t\tif (b[i]) b[i] = input_huffman(infile);\n\t}\n}\n\n/*  ############################################################################  */\n/*\n * copy 4-bit values from a[(nx+1)/2,(ny+1)/2] to b[nx,ny], expanding\n * each value to 2x2 pixels\n * a,b may be same array\n */\nstatic void\nqtree_copy(unsigned char a[], int nx, int ny, unsigned char b[], int n)\n/*   int n;\t\tdeclared y dimension of b */\n{\nint i, j, k, nx2, ny2;\nint s00, s10;\n\n\t/*\n\t * first copy 4-bit values to b\n\t * start at end in case a,b are same array\n\t */\n\tnx2 = (nx+1)/2;\n\tny2 = (ny+1)/2;\n\tk = ny2*(nx2-1)+ny2-1;\t\t\t/* k   is index of a[i,j]\t\t*/\n\tfor (i = nx2-1; i >= 0; i--) {\n\t\ts00 = 2*(n*i+ny2-1);\t\t/* s00 is index of b[2*i,2*j]\t\t*/\n\t\tfor (j = ny2-1; j >= 0; j--) {\n\t\t\tb[s00] = a[k];\n\t\t\tk -= 1;\n\t\t\ts00 -= 2;\n\t\t}\n\t}\n\t/*\n\t * now expand each 2x2 block\n\t */\n\tfor (i = 0; i<nx-1; i += 2) {\n\n  /* Note:\n     Unlike the case in qtree_bitins, this code runs faster on a 32-bit linux\n     machine using the s10 intermediate variable, rather that using s00+n. \n     Go figure!\n  */\n\t\ts00 = n*i;\t\t\t\t/* s00 is index of b[i,j]\t*/\n\t\ts10 = s00+n;\t\t\t\t/* s10 is index of b[i+1,j]\t*/\n\n\t\tfor (j = 0; j<ny-1; j += 2) {\n\n\t\t    switch (b[s00]) {\n\t\t    case(0):\n\t\t\tb[s10+1] = 0;\n\t\t\tb[s10  ] = 0;\n\t\t\tb[s00+1] = 0;\n\t\t\tb[s00  ] = 0;\n\n\t\t\tbreak;\n\t\t    case(1):\n\t\t\tb[s10+1] = 1;\n\t\t\tb[s10  ] = 0;\n\t\t\tb[s00+1] = 0;\n\t\t\tb[s00  ] = 0;\n\n\t\t\tbreak;\n\t\t    case(2):\n\t\t\tb[s10+1] = 0;\n\t\t\tb[s10  ] = 1;\n\t\t\tb[s00+1] = 0;\n\t\t\tb[s00  ] = 0;\n\n\t\t\tbreak;\n\t\t    case(3):\n\t\t\tb[s10+1] = 1;\n\t\t\tb[s10  ] = 1;\n\t\t\tb[s00+1] = 0;\n\t\t\tb[s00  ] = 0;\n\n\t\t\tbreak;\n\t\t    case(4):\n\t\t\tb[s10+1] = 0;\n\t\t\tb[s10  ] = 0;\n\t\t\tb[s00+1] = 1;\n\t\t\tb[s00  ] = 0;\n\n\t\t\tbreak;\n\t\t    case(5):\n\t\t\tb[s10+1] = 1;\n\t\t\tb[s10  ] = 0;\n\t\t\tb[s00+1] = 1;\n\t\t\tb[s00  ] = 0;\n\n\t\t\tbreak;\n\t\t    case(6):\n\t\t\tb[s10+1] = 0;\n\t\t\tb[s10  ] = 1;\n\t\t\tb[s00+1] = 1;\n\t\t\tb[s00  ] = 0;\n\n\t\t\tbreak;\n\t\t    case(7):\n\t\t\tb[s10+1] = 1;\n\t\t\tb[s10  ] = 1;\n\t\t\tb[s00+1] = 1;\n\t\t\tb[s00  ] = 0;\n\n\t\t\tbreak;\n\t\t    case(8):\n\t\t\tb[s10+1] = 0;\n\t\t\tb[s10  ] = 0;\n\t\t\tb[s00+1] = 0;\n\t\t\tb[s00  ] = 1;\n\n\t\t\tbreak;\n\t\t    case(9):\n\t\t\tb[s10+1] = 1;\n\t\t\tb[s10  ] = 0;\n\t\t\tb[s00+1] = 0;\n\t\t\tb[s00  ] = 1;\n\t\t\tbreak;\n\t\t    case(10):\n\t\t\tb[s10+1] = 0;\n\t\t\tb[s10  ] = 1;\n\t\t\tb[s00+1] = 0;\n\t\t\tb[s00  ] = 1;\n\n\t\t\tbreak;\n\t\t    case(11):\n\t\t\tb[s10+1] = 1;\n\t\t\tb[s10  ] = 1;\n\t\t\tb[s00+1] = 0;\n\t\t\tb[s00  ] = 1;\n\n\t\t\tbreak;\n\t\t    case(12):\n\t\t\tb[s10+1] = 0;\n\t\t\tb[s10  ] = 0;\n\t\t\tb[s00+1] = 1;\n\t\t\tb[s00  ] = 1;\n\n\t\t\tbreak;\n\t\t    case(13):\n\t\t\tb[s10+1] = 1;\n\t\t\tb[s10  ] = 0;\n\t\t\tb[s00+1] = 1;\n\t\t\tb[s00  ] = 1;\n\n\t\t\tbreak;\n\t\t    case(14):\n\t\t\tb[s10+1] = 0;\n\t\t\tb[s10  ] = 1;\n\t\t\tb[s00+1] = 1;\n\t\t\tb[s00  ] = 1;\n\n\t\t\tbreak;\n\t\t    case(15):\n\t\t\tb[s10+1] = 1;\n\t\t\tb[s10  ] = 1;\n\t\t\tb[s00+1] = 1;\n\t\t\tb[s00  ] = 1;\n\n\t\t\tbreak;\n\t\t    }\n/*\n\t\t\tb[s10+1] =  b[s00]     & 1;\n\t\t\tb[s10  ] = (b[s00]>>1) & 1;\n\t\t\tb[s00+1] = (b[s00]>>2) & 1;\n\t\t\tb[s00  ] = (b[s00]>>3) & 1;\n*/\n\n\t\t\ts00 += 2;\n\t\t\ts10 += 2;\n\t\t}\n\n\t\tif (j < ny) {\n\t\t\t/*\n\t\t\t * row size is odd, do last element in row\n\t\t\t * s00+1, s10+1 are off edge\n\t\t\t */\n                        /* not worth converting this to use 16 case statements */\n\t\t\tb[s10  ] = (b[s00]>>1) & 1;\n\t\t\tb[s00  ] = (b[s00]>>3) & 1;\n\t\t}\n\t}\n\tif (i < nx) {\n\t\t/*\n\t\t * column size is odd, do last row\n\t\t * s10, s10+1 are off edge\n\t\t */\n\t\ts00 = n*i;\n\t\tfor (j = 0; j<ny-1; j += 2) {\n                        /* not worth converting this to use 16 case statements */\n\t\t\tb[s00+1] = (b[s00]>>2) & 1;\n\t\t\tb[s00  ] = (b[s00]>>3) & 1;\n\t\t\ts00 += 2;\n\t\t}\n\t\tif (j < ny) {\n\t\t\t/*\n\t\t\t * both row and column size are odd, do corner element\n\t\t\t * s00+1, s10, s10+1 are off edge\n\t\t\t */\n                        /* not worth converting this to use 16 case statements */\n\t\t\tb[s00  ] = (b[s00]>>3) & 1;\n\t\t}\n\t}\n}\n\n/*  ############################################################################  */\n/*\n * Copy 4-bit values from a[(nx+1)/2,(ny+1)/2] to b[nx,ny], expanding\n * each value to 2x2 pixels and inserting into bitplane BIT of B.\n * A,B may NOT be same array (it wouldn't make sense to be inserting\n * bits into the same array anyway.)\n */\nstatic void\nqtree_bitins(unsigned char a[], int nx, int ny, int b[], int n, int bit)\n/*\n   int n;\t\tdeclared y dimension of b\n*/\n{\nint i, j, k;\nint s00;\nint plane_val;\n\n\tplane_val = 1 << bit;\n\t\n\t/*\n\t * expand each 2x2 block\n\t */\n\tk = 0;\t\t\t\t\t\t/* k   is index of a[i/2,j/2]\t*/\n\tfor (i = 0; i<nx-1; i += 2) {\n\t\ts00 = n*i;\t\t\t\t/* s00 is index of b[i,j]\t*/\n\n  /* Note:\n     this code appears to run very slightly faster on a 32-bit linux\n     machine using s00+n rather than the s10 intermediate variable\n  */\n  /*\t\ts10 = s00+n;\t*/\t\t\t/* s10 is index of b[i+1,j]\t*/\n\t\tfor (j = 0; j<ny-1; j += 2) {\n\n\t\t    switch (a[k]) {\n\t\t    case(0):\n\t\t\tbreak;\n\t\t    case(1):\n\t\t\tb[s00+n+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(2):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(3):\n\t\t\tb[s00+n+1] |= plane_val;\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(4):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(5):\n\t\t\tb[s00+n+1] |= plane_val;\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(6):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(7):\n\t\t\tb[s00+n+1] |= plane_val;\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(8):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(9):\n\t\t\tb[s00+n+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(10):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(11):\n\t\t\tb[s00+n+1] |= plane_val;\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(12):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(13):\n\t\t\tb[s00+n+1] |= plane_val;\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(14):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(15):\n\t\t\tb[s00+n+1] |= plane_val;\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    }\n\n/*\n\t\t\tb[s10+1] |= ( a[k]     & 1) << bit;\n\t\t\tb[s10  ] |= ((a[k]>>1) & 1) << bit;\n\t\t\tb[s00+1] |= ((a[k]>>2) & 1) << bit;\n\t\t\tb[s00  ] |= ((a[k]>>3) & 1) << bit;\n*/\n\t\t\ts00 += 2;\n/*\t\t\ts10 += 2; */\n\t\t\tk += 1;\n\t\t}\n\t\tif (j < ny) {\n\t\t\t/*\n\t\t\t * row size is odd, do last element in row\n\t\t\t * s00+1, s10+1 are off edge\n\t\t\t */\n\n\t\t    switch (a[k]) {\n\t\t    case(0):\n\t\t\tbreak;\n\t\t    case(1):\n\t\t\tbreak;\n\t\t    case(2):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(3):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(4):\n\t\t\tbreak;\n\t\t    case(5):\n\t\t\tbreak;\n\t\t    case(6):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(7):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(8):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(9):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(10):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(11):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(12):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(13):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(14):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(15):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    }\n\n/*\n\t\t\tb[s10  ] |= ((a[k]>>1) & 1) << bit;\n\t\t\tb[s00  ] |= ((a[k]>>3) & 1) << bit;\n*/\n\t\t\tk += 1;\n\t\t}\n\t}\n\tif (i < nx) {\n\t\t/*\n\t\t * column size is odd, do last row\n\t\t * s10, s10+1 are off edge\n\t\t */\n\t\ts00 = n*i;\n\t\tfor (j = 0; j<ny-1; j += 2) {\n\n\t\t    switch (a[k]) {\n\t\t    case(0):\n\t\t\tbreak;\n\t\t    case(1):\n\t\t\tbreak;\n\t\t    case(2):\n\t\t\tbreak;\n\t\t    case(3):\n\t\t\tbreak;\n\t\t    case(4):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(5):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(6):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(7):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(8):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(9):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(10):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(11):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(12):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(13):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(14):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(15):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    }\n\n/*\n\t\t\tb[s00+1] |= ((a[k]>>2) & 1) << bit;\n\t\t\tb[s00  ] |= ((a[k]>>3) & 1) << bit;\n*/\n\n\t\t\ts00 += 2;\n\t\t\tk += 1;\n\t\t}\n\t\tif (j < ny) {\n\t\t\t/*\n\t\t\t * both row and column size are odd, do corner element\n\t\t\t * s00+1, s10, s10+1 are off edge\n\t\t\t */\n\n\t\t    switch (a[k]) {\n\t\t    case(0):\n\t\t\tbreak;\n\t\t    case(1):\n\t\t\tbreak;\n\t\t    case(2):\n\t\t\tbreak;\n\t\t    case(3):\n\t\t\tbreak;\n\t\t    case(4):\n\t\t\tbreak;\n\t\t    case(5):\n\t\t\tbreak;\n\t\t    case(6):\n\t\t\tbreak;\n\t\t    case(7):\n\t\t\tbreak;\n\t\t    case(8):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(9):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(10):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(11):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(12):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(13):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(14):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(15):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    }\n\n/*\n\t\t\tb[s00  ] |= ((a[k]>>3) & 1) << bit;\n*/\n\t\t\tk += 1;\n\t\t}\n\t}\n}\n/*  ############################################################################  */\n/*\n * Copy 4-bit values from a[(nx+1)/2,(ny+1)/2] to b[nx,ny], expanding\n * each value to 2x2 pixels and inserting into bitplane BIT of B.\n * A,B may NOT be same array (it wouldn't make sense to be inserting\n * bits into the same array anyway.)\n */\nstatic void\nqtree_bitins64(unsigned char a[], int nx, int ny, LONGLONG b[], int n, int bit)\n/*\n   int n;\t\tdeclared y dimension of b\n*/\n{\nint i, j, k;\nint s00;\nLONGLONG plane_val;\n\n\tplane_val = ((LONGLONG) 1) << bit;\n\n\t/*\n\t * expand each 2x2 block\n\t */\n\tk = 0;\t\t\t\t\t\t\t/* k   is index of a[i/2,j/2]\t*/\n\tfor (i = 0; i<nx-1; i += 2) {\n\t\ts00 = n*i;\t\t\t\t\t/* s00 is index of b[i,j]\t\t*/\n\n  /* Note:\n     this code appears to run very slightly faster on a 32-bit linux\n     machine using s00+n rather than the s10 intermediate variable\n  */\n  /*\t\ts10 = s00+n;\t*/\t\t\t/* s10 is index of b[i+1,j]\t*/\n\t\tfor (j = 0; j<ny-1; j += 2) {\n\n\t\t    switch (a[k]) {\n\t\t    case(0):\n\t\t\tbreak;\n\t\t    case(1):\n\t\t\tb[s00+n+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(2):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(3):\n\t\t\tb[s00+n+1] |= plane_val;\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(4):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(5):\n\t\t\tb[s00+n+1] |= plane_val;\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(6):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(7):\n\t\t\tb[s00+n+1] |= plane_val;\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(8):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(9):\n\t\t\tb[s00+n+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(10):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(11):\n\t\t\tb[s00+n+1] |= plane_val;\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(12):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(13):\n\t\t\tb[s00+n+1] |= plane_val;\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(14):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(15):\n\t\t\tb[s00+n+1] |= plane_val;\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    }\n\n/*\n\t\t\tb[s10+1] |= ((LONGLONG) ( a[k]     & 1)) << bit;\n\t\t\tb[s10  ] |= ((((LONGLONG)a[k])>>1) & 1) << bit;\n\t\t\tb[s00+1] |= ((((LONGLONG)a[k])>>2) & 1) << bit;\n\t\t\tb[s00  ] |= ((((LONGLONG)a[k])>>3) & 1) << bit;\n*/\n\t\t\ts00 += 2;\n/*\t\t\ts10 += 2;  */\n\t\t\tk += 1;\n\t\t}\n\t\tif (j < ny) {\n\t\t\t/*\n\t\t\t * row size is odd, do last element in row\n\t\t\t * s00+1, s10+1 are off edge\n\t\t\t */\n\n\t\t    switch (a[k]) {\n\t\t    case(0):\n\t\t\tbreak;\n\t\t    case(1):\n\t\t\tbreak;\n\t\t    case(2):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(3):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(4):\n\t\t\tbreak;\n\t\t    case(5):\n\t\t\tbreak;\n\t\t    case(6):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(7):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(8):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(9):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(10):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(11):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(12):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(13):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(14):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(15):\n\t\t\tb[s00+n  ] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    }\n/*\n\t\t\tb[s10  ] |= ((((LONGLONG)a[k])>>1) & 1) << bit;\n\t\t\tb[s00  ] |= ((((LONGLONG)a[k])>>3) & 1) << bit;\n*/\n\t\t\tk += 1;\n\t\t}\n\t}\n\tif (i < nx) {\n\t\t/*\n\t\t * column size is odd, do last row\n\t\t * s10, s10+1 are off edge\n\t\t */\n\t\ts00 = n*i;\n\t\tfor (j = 0; j<ny-1; j += 2) {\n\n\t\t    switch (a[k]) {\n\t\t    case(0):\n\t\t\tbreak;\n\t\t    case(1):\n\t\t\tbreak;\n\t\t    case(2):\n\t\t\tbreak;\n\t\t    case(3):\n\t\t\tbreak;\n\t\t    case(4):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(5):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(6):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(7):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tbreak;\n\t\t    case(8):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(9):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(10):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(11):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(12):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(13):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(14):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(15):\n\t\t\tb[s00+1] |= plane_val;\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    }\n\n/*\n\t\t\tb[s00+1] |= ((((LONGLONG)a[k])>>2) & 1) << bit;\n\t\t\tb[s00  ] |= ((((LONGLONG)a[k])>>3) & 1) << bit;\n*/\n\t\t\ts00 += 2;\n\t\t\tk += 1;\n\t\t}\n\t\tif (j < ny) {\n\t\t\t/*\n\t\t\t * both row and column size are odd, do corner element\n\t\t\t * s00+1, s10, s10+1 are off edge\n\t\t\t */\n\n\t\t    switch (a[k]) {\n\t\t    case(0):\n\t\t\tbreak;\n\t\t    case(1):\n\t\t\tbreak;\n\t\t    case(2):\n\t\t\tbreak;\n\t\t    case(3):\n\t\t\tbreak;\n\t\t    case(4):\n\t\t\tbreak;\n\t\t    case(5):\n\t\t\tbreak;\n\t\t    case(6):\n\t\t\tbreak;\n\t\t    case(7):\n\t\t\tbreak;\n\t\t    case(8):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(9):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(10):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(11):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(12):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(13):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(14):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    case(15):\n\t\t\tb[s00  ] |= plane_val;\n\t\t\tbreak;\n\t\t    }\n/*\n\t\t\tb[s00  ] |= ((((LONGLONG)a[k])>>3) & 1) << bit;\n*/\n\t\t\tk += 1;\n\t\t}\n\t}\n}\n\n/*  ############################################################################  */\nstatic void\nread_bdirect(unsigned char *infile, int a[], int n, int nqx, int nqy, unsigned char scratch[], int bit)\n{\n\t/*\n\t * read bit image packed 4 pixels/nybble\n\t */\n/*\nint i;\n\tfor (i = 0; i < ((nqx+1)/2) * ((nqy+1)/2); i++) {\n\t\tscratch[i] = input_nybble(infile);\n\t}\n*/\n        input_nnybble(infile, ((nqx+1)/2) * ((nqy+1)/2), scratch);\n\t\n\t/*\n\t * insert in bitplane BIT of image A\n\t */\n\tqtree_bitins(scratch,nqx,nqy,a,n,bit);\n}\n/*  ############################################################################  */\nstatic void\nread_bdirect64(unsigned char *infile, LONGLONG a[], int n, int nqx, int nqy, unsigned char scratch[], int bit)\n{\n\t/*\n\t * read bit image packed 4 pixels/nybble\n\t */\n/*\nint i;\n\tfor (i = 0; i < ((nqx+1)/2) * ((nqy+1)/2); i++) {\n\t\tscratch[i] = input_nybble(infile);\n\t}\n*/\n        input_nnybble(infile, ((nqx+1)/2) * ((nqy+1)/2), scratch);\n\n\t/*\n\t * insert in bitplane BIT of image A\n\t */\n\tqtree_bitins64(scratch,nqx,nqy,a,n,bit);\n}\n\n/*  ############################################################################  */\n/*\n * Huffman decoding for fixed codes\n *\n * Coded values range from 0-15\n *\n * Huffman code values (hex):\n *\n *\t3e, 00, 01, 08, 02, 09, 1a, 1b,\n *\t03, 1c, 0a, 1d, 0b, 1e, 3f, 0c\n *\n * and number of bits in each code:\n *\n *\t6,  3,  3,  4,  3,  4,  5,  5,\n *\t3,  5,  4,  5,  4,  5,  6,  4\n */\nstatic int input_huffman(unsigned char *infile)\n{\nint c;\n\n\t/*\n\t * get first 3 bits to start\n\t */\n\tc = input_nbits(infile,3);\n\tif (c < 4) {\n\t\t/*\n\t\t * this is all we need\n\t\t * return 1,2,4,8 for c=0,1,2,3\n\t\t */\n\t\treturn(1<<c);\n\t}\n\t/*\n\t * get the next bit\n\t */\n\tc = input_bit(infile) | (c<<1);\n\tif (c < 13) {\n\t\t/*\n\t\t * OK, 4 bits is enough\n\t\t */\n\t\tswitch (c) {\n\t\t\tcase  8 : return(3);\n\t\t\tcase  9 : return(5);\n\t\t\tcase 10 : return(10);\n\t\t\tcase 11 : return(12);\n\t\t\tcase 12 : return(15);\n\t\t}\n\t}\n\t/*\n\t * get yet another bit\n\t */\n\tc = input_bit(infile) | (c<<1);\n\tif (c < 31) {\n\t\t/*\n\t\t * OK, 5 bits is enough\n\t\t */\n\t\tswitch (c) {\n\t\t\tcase 26 : return(6);\n\t\t\tcase 27 : return(7);\n\t\t\tcase 28 : return(9);\n\t\t\tcase 29 : return(11);\n\t\t\tcase 30 : return(13);\n\t\t}\n\t}\n\t/*\n\t * need the 6th bit\n\t */\n\tc = input_bit(infile) | (c<<1);\n\tif (c == 62) {\n\t\treturn(0);\n\t} else {\n\t\treturn(14);\n\t}\n}\n\n/*  ############################################################################  */\n/*  ############################################################################  */\n/* Copyright (c) 1993 Association of Universities for Research \n * in Astronomy. All rights reserved. Produced under National   \n * Aeronautics and Space Administration Contract No. NAS5-26555.\n */\n/* qread.c\tRead binary data\n *\n * Programmer: R. White\t\tDate: 11 March 1991\n */\n\nstatic int readint(unsigned char *infile)\n{\nint a,i;\nunsigned char b[4];\n\n\t/* Read integer A one byte at a time from infile.\n\t *\n\t * This is portable from Vax to Sun since it eliminates the\n\t * need for byte-swapping.\n\t *\n         *  This routine is only called to read the first 3 values\n\t *  in the compressed file, so it doesn't have to be \n\t *  super-efficient\n\t */\n\tfor (i=0; i<4; i++) qread(infile,(char *) &b[i],1);\n\ta = b[0];\n\tfor (i=1; i<4; i++) a = (a<<8) + b[i];\n\treturn(a);\n}\n\n/*  ############################################################################  */\nstatic LONGLONG readlonglong(unsigned char *infile)\n{\nint i;\nLONGLONG a;\nunsigned char b[8];\n\n\t/* Read integer A one byte at a time from infile.\n\t *\n\t * This is portable from Vax to Sun since it eliminates the\n\t * need for byte-swapping.\n\t *\n         *  This routine is only called to read the first 3 values\n\t *  in the compressed file, so it doesn't have to be \n\t *  super-efficient\n\t */\n\tfor (i=0; i<8; i++) qread(infile,(char *) &b[i],1);\n\ta = b[0];\n\tfor (i=1; i<8; i++) a = (a<<8) + b[i];\n\treturn(a);\n}\n\n/*  ############################################################################  */\nstatic void qread(unsigned char *file, char buffer[], int n)\n{\n    /*\n     * read n bytes from file into buffer\n     *\n     */\n\n    memcpy(buffer, &file[nextchar], n);\n    nextchar += n;\n}\n\n/*  ############################################################################  */\n/*  ############################################################################  */\n/* Copyright (c) 1993 Association of Universities for Research\n * in Astronomy. All rights reserved. Produced under National\n * Aeronautics and Space Administration Contract No. NAS5-26555.\n */\n\n/* BIT INPUT ROUTINES */\n\n/* THE BIT BUFFER */\n\nstatic int buffer2;\t\t\t/* Bits waiting to be input\t*/\nstatic int bits_to_go;\t\t\t/* Number of bits still in buffer */\n\n/* INITIALIZE BIT INPUT */\n\n/*  ############################################################################  */\nstatic void start_inputing_bits(void)\n{\n\t/*\n\t * Buffer starts out with no bits in it\n\t */\n\tbits_to_go = 0;\n}\n\n/*  ############################################################################  */\n/* INPUT A BIT */\n\nstatic int input_bit(unsigned char *infile)\n{\n\tif (bits_to_go == 0) {\t\t\t/* Read the next byte if no\t*/\n\n\t\tbuffer2 = infile[nextchar];\n\t\tnextchar++;\n\t\t\n\t\tbits_to_go = 8;\n\t}\n\t/*\n\t * Return the next bit\n\t */\n\tbits_to_go -= 1;\n\treturn((buffer2>>bits_to_go) & 1);\n}\n\n/*  ############################################################################  */\n/* INPUT N BITS (N must be <= 8) */\n\nstatic int input_nbits(unsigned char *infile, int n)\n{\n    /* AND mask for retreiving the right-most n bits */\n    static int mask[9] = {0, 1, 3, 7, 15, 31, 63, 127, 255};\n\n\tif (bits_to_go < n) {\n\t\t/*\n\t\t * need another byte's worth of bits\n\t\t */\n\n\t\tbuffer2 = (buffer2<<8) | (int) infile[nextchar];\n\t\tnextchar++;\n\t\tbits_to_go += 8;\n\t}\n\t/*\n\t * now pick off the first n bits\n\t */\n\tbits_to_go -= n;\n\n        /* there was a slight gain in speed by replacing the following line */\n/*\treturn( (buffer2>>bits_to_go) & ((1<<n)-1) ); */\n\treturn( (buffer2>>bits_to_go) & (*(mask+n)) ); \n}\n/*  ############################################################################  */\n/* INPUT 4 BITS  */\n\nstatic int input_nybble(unsigned char *infile)\n{\n\tif (bits_to_go < 4) {\n\t\t/*\n\t\t * need another byte's worth of bits\n\t\t */\n\n\t\tbuffer2 = (buffer2<<8) | (int) infile[nextchar];\n\t\tnextchar++;\n\t\tbits_to_go += 8;\n\t}\n\t/*\n\t * now pick off the first 4 bits\n\t */\n\tbits_to_go -= 4;\n\n\treturn( (buffer2>>bits_to_go) & 15 ); \n}\n/*  ############################################################################  */\n/* INPUT array of 4 BITS  */\n\nstatic int input_nnybble(unsigned char *infile, int n, unsigned char array[])\n{\n\t/* copy n 4-bit nybbles from infile to the lower 4 bits of array */\n\nint ii, kk, shift1, shift2;\n\n/*  forcing byte alignment doesn;t help, and even makes it go slightly slower\nif (bits_to_go != 8) input_nbits(infile, bits_to_go);\n*/\n\tif (n == 1) {\n\t\tarray[0] = input_nybble(infile);\n\t\treturn(0);\n\t}\n\t\n\tif (bits_to_go == 8) {\n\t\t/*\n\t\t   already have 2 full nybbles in buffer2, so \n\t\t   backspace the infile array to reuse last char\n\t\t*/\n\t\tnextchar--;\n\t\tbits_to_go = 0;\n\t}\n\t\n\t/* bits_to_go now has a value in the range 0 - 7.  After adding  */\n\t/* another byte, bits_to_go effectively will be in range 8 - 15 */\t\n\n\tshift1 = bits_to_go + 4;   /* shift1 will be in range 4 - 11 */\n\tshift2 = bits_to_go;\t   /* shift2 will be in range 0 -  7 */\n\tkk = 0;\n\n\t/* special case */\n\tif (bits_to_go == 0) \n\t{\n\t    for (ii = 0; ii < n/2; ii++) {\n\t\t/*\n\t\t * refill the buffer with next byte\n\t\t */\n\t\tbuffer2 = (buffer2<<8) | (int) infile[nextchar];\n\t\tnextchar++;\n\t\tarray[kk]     = (int) ((buffer2>>4) & 15);\n\t\tarray[kk + 1] = (int) ((buffer2) & 15);    /* no shift required */\n\t\tkk += 2;\n\t    }\n\t}\n\telse\n\t{\n\t    for (ii = 0; ii < n/2; ii++) {\n\t\t/*\n\t\t * refill the buffer with next byte\n\t\t */\n\t\tbuffer2 = (buffer2<<8) | (int) infile[nextchar];\n\t\tnextchar++;\n\t\tarray[kk]     = (int) ((buffer2>>shift1) & 15);\n\t\tarray[kk + 1] = (int) ((buffer2>>shift2) & 15);\n\t\tkk += 2;\n\t    }\n\t}\n\n\n\tif (ii * 2 != n) {  /* have to read last odd byte */\n\t\tarray[n-1] = input_nybble(infile);\n\t}\n\n\treturn( (buffer2>>bits_to_go) & 15 ); \n}\n"},{"id":16701,"name":"ricecomp.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*\n  The following code was written by Richard White at STScI and made\n  available for use in CFITSIO in July 1999.  These routines were\n  originally contained in 2 source files: rcomp.c and rdecomp.c,\n  and the 'include' file now called ricecomp.h was originally called buffer.h.\n  \n  Note that beginning with CFITSIO v3.08, EOB checking was removed to improve\n  speed, and so now the input compressed bytes buffers must have been\n  allocated big enough so that they will never be overflowed. A simple\n  rule of thumb that guarantees the buffer will be large enough is to make\n  it 1% larger than the size of the input array of pixels that are being\n  compressed.\n  \n*/\n\n/*----------------------------------------------------------*/\n/*                                                          */\n/*    START OF SOURCE FILE ORIGINALLY CALLED rcomp.c        */\n/*                                                          */\n/*----------------------------------------------------------*/\n/* @(#) rcomp.c 1.5 99/03/01 12:40:27 */\n/* rcomp.c\tCompress image line using\n *\t\t(1) Difference of adjacent pixels\n *\t\t(2) Rice algorithm coding\n *\n * Returns number of bytes written to code buffer or\n * -1 on failure\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n/*\n * nonzero_count is lookup table giving number of bits in 8-bit values not including\n * leading zeros used in fits_rdecomp, fits_rdecomp_short and fits_rdecomp_byte\n */\nstatic const int nonzero_count[256] = {\n0, \n1, \n2, 2, \n3, 3, 3, 3, \n4, 4, 4, 4, 4, 4, 4, 4, \n5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, \n6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, \n6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, \n7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, \n7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, \n7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, \n7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, \n8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, \n8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, \n8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, \n8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, \n8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, \n8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, \n8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, \n8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8};\n\ntypedef unsigned char Buffer_t;\n\ntypedef struct {\n\tint bitbuffer;\t\t/* bit buffer\t\t\t*/\n\tint bits_to_go;\t\t/* bits to go in buffer\t\t*/\n\tBuffer_t *start;\t/* start of buffer\t\t*/\n\tBuffer_t *current;\t/* current position in buffer\t*/\n\tBuffer_t *end;\t\t/* end of buffer\t\t*/\n} Buffer;\n\n#define putcbuf(c,mf) \t((*(mf->current)++ = c), 0)\n\n#include \"fitsio2.h\"\n\nstatic void start_outputing_bits(Buffer *buffer);\nstatic int done_outputing_bits(Buffer *buffer);\nstatic int output_nbits(Buffer *buffer, int bits, int n);\n\n/*  only used for diagnoistics\nstatic int case1, case2, case3;\nint fits_get_case(int *c1, int*c2, int*c3) {\n\n  *c1 = case1;\n  *c2 = case2;\n  *c3 = case3;\n  return(0);\n}\n*/\n\n/* this routine used to be called 'rcomp'  (WDP)  */\n/*---------------------------------------------------------------------------*/\n\nint fits_rcomp(int a[],\t\t/* input array\t\t\t*/\n\t  int nx,\t\t/* number of input pixels\t*/\n\t  unsigned char *c,\t/* output buffer\t\t*/\n\t  int clen,\t\t/* max length of output\t\t*/\n\t  int nblock)\t\t/* coding block size\t\t*/\n{\nBuffer bufmem, *buffer = &bufmem;\n/* int bsize;  */\nint i, j, thisblock;\nint lastpix, nextpix, pdiff;\nint v, fs, fsmask, top, fsmax, fsbits, bbits;\nint lbitbuffer, lbits_to_go;\nunsigned int psum;\ndouble pixelsum, dpsum;\nunsigned int *diff;\n\n    /*\n     * Original size of each pixel (bsize, bytes) and coding block\n     * size (nblock, pixels)\n     * Could make bsize a parameter to allow more efficient\n     * compression of short & byte images.\n     */\n/*    bsize = 4;   */\n\n/*    nblock = 32; now an input parameter*/\n    /*\n     * From bsize derive:\n     * FSBITS = # bits required to store FS\n     * FSMAX = maximum value for FS\n     * BBITS = bits/pixel for direct coding\n     */\n\n/*\n    switch (bsize) {\n    case 1:\n\tfsbits = 3;\n\tfsmax = 6;\n\tbreak;\n    case 2:\n\tfsbits = 4;\n\tfsmax = 14;\n\tbreak;\n    case 4:\n\tfsbits = 5;\n\tfsmax = 25;\n\tbreak;\n    default:\n        ffpmsg(\"rdecomp: bsize must be 1, 2, or 4 bytes\");\n\treturn(-1);\n    }\n*/\n\n    /* move out of switch block, to tweak performance */\n    fsbits = 5;\n    fsmax = 25;\n\n    bbits = 1<<fsbits;\n\n    /*\n     * Set up buffer pointers\n     */\n    buffer->start = c;\n    buffer->current = c;\n    buffer->end = c+clen;\n    buffer->bits_to_go = 8;\n    /*\n     * array for differences mapped to non-negative values\n     */\n    diff = (unsigned int *) malloc(nblock*sizeof(unsigned int));\n    if (diff == (unsigned int *) NULL) {\n        ffpmsg(\"fits_rcomp: insufficient memory\");\n\treturn(-1);\n    }\n    /*\n     * Code in blocks of nblock pixels\n     */\n    start_outputing_bits(buffer);\n\n    /* write out first int value to the first 4 bytes of the buffer */\n    if (output_nbits(buffer, a[0], 32) == EOF) {\n        ffpmsg(\"rice_encode: end of buffer\");\n        free(diff);\n        return(-1);\n    }\n\n    lastpix = a[0];  /* the first difference will always be zero */\n\n    thisblock = nblock;\n    for (i=0; i<nx; i += nblock) {\n\t/* last block may be shorter */\n\tif (nx-i < nblock) thisblock = nx-i;\n\t/*\n\t * Compute differences of adjacent pixels and map them to unsigned values.\n\t * Note that this may overflow the integer variables -- that's\n\t * OK, because we can recover when decompressing.  If we were\n\t * compressing shorts or bytes, would want to do this arithmetic\n\t * with short/byte working variables (though diff will still be\n\t * passed as an int.)\n\t *\n\t * compute sum of mapped pixel values at same time\n\t * use double precision for sum to allow 32-bit integer inputs\n\t */\n\tpixelsum = 0.0;\n\tfor (j=0; j<thisblock; j++) {\n\t    nextpix = a[i+j];\n\t    pdiff = nextpix - lastpix;\n\t    diff[j] = (unsigned int) ((pdiff<0) ? ~(pdiff<<1) : (pdiff<<1));\n\t    pixelsum += diff[j];\n\t    lastpix = nextpix;\n\t}\n\n\t/*\n\t * compute number of bits to split from sum\n\t */\n\tdpsum = (pixelsum - (thisblock/2) - 1)/thisblock;\n\tif (dpsum < 0) dpsum = 0.0;\n\tpsum = ((unsigned int) dpsum ) >> 1;\n\tfor (fs = 0; psum>0; fs++) psum >>= 1;\n\n\t/*\n\t * write the codes\n\t * fsbits ID bits used to indicate split level\n\t */\n\tif (fs >= fsmax) {\n\t    /* Special high entropy case when FS >= fsmax\n\t     * Just write pixel difference values directly, no Rice coding at all.\n\t     */\n\t    if (output_nbits(buffer, fsmax+1, fsbits) == EOF) {\n                ffpmsg(\"rice_encode: end of buffer\");\n                free(diff);\n\t\treturn(-1);\n\t    }\n\t    for (j=0; j<thisblock; j++) {\n\t\tif (output_nbits(buffer, diff[j], bbits) == EOF) {\n                    ffpmsg(\"rice_encode: end of buffer\");\n                    free(diff);\n\t\t    return(-1);\n\t\t}\n\t    }\n\t} else if (fs == 0 && pixelsum == 0) {\n\t    /*\n\t     * special low entropy case when FS = 0 and pixelsum=0 (all\n\t     * pixels in block are zero.)\n\t     * Output a 0 and return\n\t     */\n\t    if (output_nbits(buffer, 0, fsbits) == EOF) {\n                ffpmsg(\"rice_encode: end of buffer\");\n                free(diff);\n\t\treturn(-1);\n\t    }\n\t} else {\n\t    /* normal case: not either very high or very low entropy */\n\t    if (output_nbits(buffer, fs+1, fsbits) == EOF) {\n                ffpmsg(\"rice_encode: end of buffer\");\n                free(diff);\n\t\treturn(-1);\n\t    }\n\t    fsmask = (1<<fs) - 1;\n\t    /*\n\t     * local copies of bit buffer to improve optimization\n\t     */\n\t    lbitbuffer = buffer->bitbuffer;\n\t    lbits_to_go = buffer->bits_to_go;\n\t    for (j=0; j<thisblock; j++) {\n\t\tv = diff[j];\n\t\ttop = v >> fs;\n\t\t/*\n\t\t * top is coded by top zeros + 1\n\t\t */\n\t\tif (lbits_to_go >= top+1) {\n\t\t    lbitbuffer <<= top+1;\n\t\t    lbitbuffer |= 1;\n\t\t    lbits_to_go -= top+1;\n\t\t} else {\n\t\t    lbitbuffer <<= lbits_to_go;\n\t\t    putcbuf(lbitbuffer & 0xff,buffer);\n\n\t\t    for (top -= lbits_to_go; top>=8; top -= 8) {\n\t\t\tputcbuf(0, buffer);\n\t\t    }\n\t\t    lbitbuffer = 1;\n\t\t    lbits_to_go = 7-top;\n\t\t}\n\t\t/*\n\t\t * bottom FS bits are written without coding\n\t\t * code is output_nbits, moved into this routine to reduce overheads\n\t\t * This code potentially breaks if FS>24, so I am limiting\n\t\t * FS to 24 by choice of FSMAX above.\n\t\t */\n\t\tif (fs > 0) {\n\t\t    lbitbuffer <<= fs;\n\t\t    lbitbuffer |= v & fsmask;\n\t\t    lbits_to_go -= fs;\n\t\t    while (lbits_to_go <= 0) {\n\t\t\tputcbuf((lbitbuffer>>(-lbits_to_go)) & 0xff,buffer);\n\t\t\tlbits_to_go += 8;\n\t\t    }\n\t\t}\n\t    }\n\n\t    /* check if overflowed output buffer */\n\t    if (buffer->current > buffer->end) {\n                 ffpmsg(\"rice_encode: end of buffer\");\n                 free(diff);\n\t\t return(-1);\n\t    }\n\t    buffer->bitbuffer = lbitbuffer;\n\t    buffer->bits_to_go = lbits_to_go;\n\t}\n    }\n    done_outputing_bits(buffer);\n    free(diff);\n    /*\n     * return number of bytes used\n     */\n    return(buffer->current - buffer->start);\n}\n/*---------------------------------------------------------------------------*/\n\nint fits_rcomp_short(\n\t  short a[],\t\t/* input array\t\t\t*/\n\t  int nx,\t\t/* number of input pixels\t*/\n\t  unsigned char *c,\t/* output buffer\t\t*/\n\t  int clen,\t\t/* max length of output\t\t*/\n\t  int nblock)\t\t/* coding block size\t\t*/\n{\nBuffer bufmem, *buffer = &bufmem;\n/* int bsize;  */\nint i, j, thisblock;\n\n/* \nNOTE: in principle, the following 2 variable could be declared as 'short'\nbut in fact the code runs faster (on 32-bit Linux at least) as 'int'\n*/\nint lastpix, nextpix;\n/* int pdiff; */\nshort pdiff; \nint v, fs, fsmask, top, fsmax, fsbits, bbits;\nint lbitbuffer, lbits_to_go;\n/* unsigned int psum; */\nunsigned short psum;\ndouble pixelsum, dpsum;\nunsigned int *diff;\n\n    /*\n     * Original size of each pixel (bsize, bytes) and coding block\n     * size (nblock, pixels)\n     * Could make bsize a parameter to allow more efficient\n     * compression of short & byte images.\n     */\n/*    bsize = 2; */\n\n/*    nblock = 32; now an input parameter */\n    /*\n     * From bsize derive:\n     * FSBITS = # bits required to store FS\n     * FSMAX = maximum value for FS\n     * BBITS = bits/pixel for direct coding\n     */\n\n/*\n    switch (bsize) {\n    case 1:\n\tfsbits = 3;\n\tfsmax = 6;\n\tbreak;\n    case 2:\n\tfsbits = 4;\n\tfsmax = 14;\n\tbreak;\n    case 4:\n\tfsbits = 5;\n\tfsmax = 25;\n\tbreak;\n    default:\n        ffpmsg(\"rdecomp: bsize must be 1, 2, or 4 bytes\");\n\treturn(-1);\n    }\n*/\n\n    /* move these out of switch block to further tweak performance */\n    fsbits = 4;\n    fsmax = 14;\n    \n    bbits = 1<<fsbits;\n\n    /*\n     * Set up buffer pointers\n     */\n    buffer->start = c;\n    buffer->current = c;\n    buffer->end = c+clen;\n    buffer->bits_to_go = 8;\n    /*\n     * array for differences mapped to non-negative values\n     */\n    diff = (unsigned int *) malloc(nblock*sizeof(unsigned int));\n    if (diff == (unsigned int *) NULL) {\n        ffpmsg(\"fits_rcomp: insufficient memory\");\n\treturn(-1);\n    }\n    /*\n     * Code in blocks of nblock pixels\n     */\n    start_outputing_bits(buffer);\n\n    /* write out first short value to the first 2 bytes of the buffer */\n    if (output_nbits(buffer, a[0], 16) == EOF) {\n        ffpmsg(\"rice_encode: end of buffer\");\n        free(diff);\n        return(-1);\n    }\n\n    lastpix = a[0];  /* the first difference will always be zero */\n\n    thisblock = nblock;\n    for (i=0; i<nx; i += nblock) {\n\t/* last block may be shorter */\n\tif (nx-i < nblock) thisblock = nx-i;\n\t/*\n\t * Compute differences of adjacent pixels and map them to unsigned values.\n\t * Note that this may overflow the integer variables -- that's\n\t * OK, because we can recover when decompressing.  If we were\n\t * compressing shorts or bytes, would want to do this arithmetic\n\t * with short/byte working variables (though diff will still be\n\t * passed as an int.)\n\t *\n\t * compute sum of mapped pixel values at same time\n\t * use double precision for sum to allow 32-bit integer inputs\n\t */\n\tpixelsum = 0.0;\n\tfor (j=0; j<thisblock; j++) {\n\t    nextpix = a[i+j];\n\t    pdiff = nextpix - lastpix;\n\t    diff[j] = (unsigned int) ((pdiff<0) ? ~(pdiff<<1) : (pdiff<<1));\n\t    pixelsum += diff[j];\n\t    lastpix = nextpix;\n\t}\n\t/*\n\t * compute number of bits to split from sum\n\t */\n\tdpsum = (pixelsum - (thisblock/2) - 1)/thisblock;\n\tif (dpsum < 0) dpsum = 0.0;\n/*\tpsum = ((unsigned int) dpsum ) >> 1; */\n\tpsum = ((unsigned short) dpsum ) >> 1;\n\tfor (fs = 0; psum>0; fs++) psum >>= 1;\n\n\t/*\n\t * write the codes\n\t * fsbits ID bits used to indicate split level\n\t */\n\tif (fs >= fsmax) {\n/* case3++; */\n\t    /* Special high entropy case when FS >= fsmax\n\t     * Just write pixel difference values directly, no Rice coding at all.\n\t     */\n\t    if (output_nbits(buffer, fsmax+1, fsbits) == EOF) {\n                ffpmsg(\"rice_encode: end of buffer\");\n                free(diff);\n\t\treturn(-1);\n\t    }\n\t    for (j=0; j<thisblock; j++) {\n\t\tif (output_nbits(buffer, diff[j], bbits) == EOF) {\n                    ffpmsg(\"rice_encode: end of buffer\");\n                    free(diff);\n\t\t    return(-1);\n\t\t}\n\t    }\n\t} else if (fs == 0 && pixelsum == 0) {\n/* case1++; */\n\t    /*\n\t     * special low entropy case when FS = 0 and pixelsum=0 (all\n\t     * pixels in block are zero.)\n\t     * Output a 0 and return\n\t     */\n\t    if (output_nbits(buffer, 0, fsbits) == EOF) {\n                ffpmsg(\"rice_encode: end of buffer\");\n                free(diff);\n\t\treturn(-1);\n\t    }\n\t} else {\n/* case2++; */\n\t    /* normal case: not either very high or very low entropy */\n\t    if (output_nbits(buffer, fs+1, fsbits) == EOF) {\n                ffpmsg(\"rice_encode: end of buffer\");\n                free(diff);\n\t\treturn(-1);\n\t    }\n\t    fsmask = (1<<fs) - 1;\n\t    /*\n\t     * local copies of bit buffer to improve optimization\n\t     */\n\t    lbitbuffer = buffer->bitbuffer;\n\t    lbits_to_go = buffer->bits_to_go;\n\t    for (j=0; j<thisblock; j++) {\n\t\tv = diff[j];\n\t\ttop = v >> fs;\n\t\t/*\n\t\t * top is coded by top zeros + 1\n\t\t */\n\t\tif (lbits_to_go >= top+1) {\n\t\t    lbitbuffer <<= top+1;\n\t\t    lbitbuffer |= 1;\n\t\t    lbits_to_go -= top+1;\n\t\t} else {\n\t\t    lbitbuffer <<= lbits_to_go;\n\t\t    putcbuf(lbitbuffer & 0xff,buffer);\n\t\t    for (top -= lbits_to_go; top>=8; top -= 8) {\n\t\t\tputcbuf(0, buffer);\n\t\t    }\n\t\t    lbitbuffer = 1;\n\t\t    lbits_to_go = 7-top;\n\t\t}\n\t\t/*\n\t\t * bottom FS bits are written without coding\n\t\t * code is output_nbits, moved into this routine to reduce overheads\n\t\t * This code potentially breaks if FS>24, so I am limiting\n\t\t * FS to 24 by choice of FSMAX above.\n\t\t */\n\t\tif (fs > 0) {\n\t\t    lbitbuffer <<= fs;\n\t\t    lbitbuffer |= v & fsmask;\n\t\t    lbits_to_go -= fs;\n\t\t    while (lbits_to_go <= 0) {\n\t\t\tputcbuf((lbitbuffer>>(-lbits_to_go)) & 0xff,buffer);\n\t\t\tlbits_to_go += 8;\n\t\t    }\n\t\t}\n\t    }\n\t    /* check if overflowed output buffer */\n\t    if (buffer->current > buffer->end) {\n                 ffpmsg(\"rice_encode: end of buffer\");\n                 free(diff);\n\t\t return(-1);\n\t    }\n\t    buffer->bitbuffer = lbitbuffer;\n\t    buffer->bits_to_go = lbits_to_go;\n\t}\n    }\n    done_outputing_bits(buffer);\n    free(diff);\n    /*\n     * return number of bytes used\n     */\n    return(buffer->current - buffer->start);\n}\n/*---------------------------------------------------------------------------*/\n\nint fits_rcomp_byte(\n\t  signed char a[],\t\t/* input array\t\t\t*/\n\t  int nx,\t\t/* number of input pixels\t*/\n\t  unsigned char *c,\t/* output buffer\t\t*/\n\t  int clen,\t\t/* max length of output\t\t*/\n\t  int nblock)\t\t/* coding block size\t\t*/\n{\nBuffer bufmem, *buffer = &bufmem;\n/* int bsize; */\nint i, j, thisblock;\n\n/* \nNOTE: in principle, the following 2 variable could be declared as 'short'\nbut in fact the code runs faster (on 32-bit Linux at least) as 'int'\n*/\nint lastpix, nextpix;\n/* int pdiff; */\nsigned char pdiff; \nint v, fs, fsmask, top, fsmax, fsbits, bbits;\nint lbitbuffer, lbits_to_go;\n/* unsigned int psum; */\nunsigned char psum;\ndouble pixelsum, dpsum;\nunsigned int *diff;\n\n    /*\n     * Original size of each pixel (bsize, bytes) and coding block\n     * size (nblock, pixels)\n     * Could make bsize a parameter to allow more efficient\n     * compression of short & byte images.\n     */\n/*    bsize = 1;  */\n\n/*    nblock = 32; now an input parameter */\n    /*\n     * From bsize derive:\n     * FSBITS = # bits required to store FS\n     * FSMAX = maximum value for FS\n     * BBITS = bits/pixel for direct coding\n     */\n\n/*\n    switch (bsize) {\n    case 1:\n\tfsbits = 3;\n\tfsmax = 6;\n\tbreak;\n    case 2:\n\tfsbits = 4;\n\tfsmax = 14;\n\tbreak;\n    case 4:\n\tfsbits = 5;\n\tfsmax = 25;\n\tbreak;\n    default:\n        ffpmsg(\"rdecomp: bsize must be 1, 2, or 4 bytes\");\n\treturn(-1);\n    }\n*/\n\n    /* move these out of switch block to further tweak performance */\n    fsbits = 3;\n    fsmax = 6;\n    bbits = 1<<fsbits;\n\n    /*\n     * Set up buffer pointers\n     */\n    buffer->start = c;\n    buffer->current = c;\n    buffer->end = c+clen;\n    buffer->bits_to_go = 8;\n    /*\n     * array for differences mapped to non-negative values\n     */\n    diff = (unsigned int *) malloc(nblock*sizeof(unsigned int));\n    if (diff == (unsigned int *) NULL) {\n        ffpmsg(\"fits_rcomp: insufficient memory\");\n\treturn(-1);\n    }\n    /*\n     * Code in blocks of nblock pixels\n     */\n    start_outputing_bits(buffer);\n\n    /* write out first byte value to the first  byte of the buffer */\n    if (output_nbits(buffer, a[0], 8) == EOF) {\n        ffpmsg(\"rice_encode: end of buffer\");\n        free(diff);\n        return(-1);\n    }\n\n    lastpix = a[0];  /* the first difference will always be zero */\n\n    thisblock = nblock;\n    for (i=0; i<nx; i += nblock) {\n\t/* last block may be shorter */\n\tif (nx-i < nblock) thisblock = nx-i;\n\t/*\n\t * Compute differences of adjacent pixels and map them to unsigned values.\n\t * Note that this may overflow the integer variables -- that's\n\t * OK, because we can recover when decompressing.  If we were\n\t * compressing shorts or bytes, would want to do this arithmetic\n\t * with short/byte working variables (though diff will still be\n\t * passed as an int.)\n\t *\n\t * compute sum of mapped pixel values at same time\n\t * use double precision for sum to allow 32-bit integer inputs\n\t */\n\tpixelsum = 0.0;\n\tfor (j=0; j<thisblock; j++) {\n\t    nextpix = a[i+j];\n\t    pdiff = nextpix - lastpix;\n\t    diff[j] = (unsigned int) ((pdiff<0) ? ~(pdiff<<1) : (pdiff<<1));\n\t    pixelsum += diff[j];\n\t    lastpix = nextpix;\n\t}\n\t/*\n\t * compute number of bits to split from sum\n\t */\n\tdpsum = (pixelsum - (thisblock/2) - 1)/thisblock;\n\tif (dpsum < 0) dpsum = 0.0;\n/*\tpsum = ((unsigned int) dpsum ) >> 1; */\n\tpsum = ((unsigned char) dpsum ) >> 1;\n\tfor (fs = 0; psum>0; fs++) psum >>= 1;\n\n\t/*\n\t * write the codes\n\t * fsbits ID bits used to indicate split level\n\t */\n\tif (fs >= fsmax) {\n\t    /* Special high entropy case when FS >= fsmax\n\t     * Just write pixel difference values directly, no Rice coding at all.\n\t     */\n\t    if (output_nbits(buffer, fsmax+1, fsbits) == EOF) {\n                ffpmsg(\"rice_encode: end of buffer\");\n                free(diff);\n\t\treturn(-1);\n\t    }\n\t    for (j=0; j<thisblock; j++) {\n\t\tif (output_nbits(buffer, diff[j], bbits) == EOF) {\n                    ffpmsg(\"rice_encode: end of buffer\");\n                    free(diff);\n\t\t    return(-1);\n\t\t}\n\t    }\n\t} else if (fs == 0 && pixelsum == 0) {\n\t    /*\n\t     * special low entropy case when FS = 0 and pixelsum=0 (all\n\t     * pixels in block are zero.)\n\t     * Output a 0 and return\n\t     */\n\t    if (output_nbits(buffer, 0, fsbits) == EOF) {\n                ffpmsg(\"rice_encode: end of buffer\");\n                free(diff);\n\t\treturn(-1);\n\t    }\n\t} else {\n\t    /* normal case: not either very high or very low entropy */\n\t    if (output_nbits(buffer, fs+1, fsbits) == EOF) {\n                ffpmsg(\"rice_encode: end of buffer\");\n                free(diff);\n\t\treturn(-1);\n\t    }\n\t    fsmask = (1<<fs) - 1;\n\t    /*\n\t     * local copies of bit buffer to improve optimization\n\t     */\n\t    lbitbuffer = buffer->bitbuffer;\n\t    lbits_to_go = buffer->bits_to_go;\n\t    for (j=0; j<thisblock; j++) {\n\t\tv = diff[j];\n\t\ttop = v >> fs;\n\t\t/*\n\t\t * top is coded by top zeros + 1\n\t\t */\n\t\tif (lbits_to_go >= top+1) {\n\t\t    lbitbuffer <<= top+1;\n\t\t    lbitbuffer |= 1;\n\t\t    lbits_to_go -= top+1;\n\t\t} else {\n\t\t    lbitbuffer <<= lbits_to_go;\n\t\t    putcbuf(lbitbuffer & 0xff,buffer);\n\t\t    for (top -= lbits_to_go; top>=8; top -= 8) {\n\t\t\tputcbuf(0, buffer);\n\t\t    }\n\t\t    lbitbuffer = 1;\n\t\t    lbits_to_go = 7-top;\n\t\t}\n\t\t/*\n\t\t * bottom FS bits are written without coding\n\t\t * code is output_nbits, moved into this routine to reduce overheads\n\t\t * This code potentially breaks if FS>24, so I am limiting\n\t\t * FS to 24 by choice of FSMAX above.\n\t\t */\n\t\tif (fs > 0) {\n\t\t    lbitbuffer <<= fs;\n\t\t    lbitbuffer |= v & fsmask;\n\t\t    lbits_to_go -= fs;\n\t\t    while (lbits_to_go <= 0) {\n\t\t\tputcbuf((lbitbuffer>>(-lbits_to_go)) & 0xff,buffer);\n\t\t\tlbits_to_go += 8;\n\t\t    }\n\t\t}\n\t    }\n\t    /* check if overflowed output buffer */\n\t    if (buffer->current > buffer->end) {\n                 ffpmsg(\"rice_encode: end of buffer\");\n                 free(diff);\n\t\t return(-1);\n\t    }\n\t    buffer->bitbuffer = lbitbuffer;\n\t    buffer->bits_to_go = lbits_to_go;\n\t}\n    }\n    done_outputing_bits(buffer);\n    free(diff);\n    /*\n     * return number of bytes used\n     */\n    return(buffer->current - buffer->start);\n}\n/*---------------------------------------------------------------------------*/\n/* bit_output.c\n *\n * Bit output routines\n * Procedures return zero on success, EOF on end-of-buffer\n *\n * Programmer: R. White     Date: 20 July 1998\n */\n\n/* Initialize for bit output */\n\nstatic void start_outputing_bits(Buffer *buffer)\n{\n    /*\n     * Buffer is empty to start with\n     */\n    buffer->bitbuffer = 0;\n    buffer->bits_to_go = 8;\n}\n\n/*---------------------------------------------------------------------------*/\n/* Output N bits (N must be <= 32) */\n\nstatic int output_nbits(Buffer *buffer, int bits, int n)\n{\n/* local copies */\nint lbitbuffer;\nint lbits_to_go;\n    /* AND mask for the right-most n bits */\n    static unsigned int mask[33] = \n         {0,\n\t  0x1,       0x3,       0x7,       0xf,       0x1f,       0x3f,       0x7f,       0xff,\n\t  0x1ff,     0x3ff,     0x7ff,     0xfff,     0x1fff,     0x3fff,     0x7fff,     0xffff,\n\t  0x1ffff,   0x3ffff,   0x7ffff,   0xfffff,   0x1fffff,   0x3fffff,   0x7fffff,   0xffffff,\n\t  0x1ffffff, 0x3ffffff, 0x7ffffff, 0xfffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff};\n\n    /*\n     * insert bits at end of bitbuffer\n     */\n    lbitbuffer = buffer->bitbuffer;\n    lbits_to_go = buffer->bits_to_go;\n    if (lbits_to_go+n > 32) {\n\t/*\n\t * special case for large n: put out the top lbits_to_go bits first\n\t * note that 0 < lbits_to_go <= 8\n\t */\n\tlbitbuffer <<= lbits_to_go;\n/*\tlbitbuffer |= (bits>>(n-lbits_to_go)) & ((1<<lbits_to_go)-1); */\n\tlbitbuffer |= (bits>>(n-lbits_to_go)) & *(mask+lbits_to_go);\n\tputcbuf(lbitbuffer & 0xff,buffer);\n\tn -= lbits_to_go;\n\tlbits_to_go = 8;\n    }\n    lbitbuffer <<= n;\n/*    lbitbuffer |= ( bits & ((1<<n)-1) ); */\n    lbitbuffer |= ( bits & *(mask+n) );\n    lbits_to_go -= n;\n    while (lbits_to_go <= 0) {\n\t/*\n\t * bitbuffer full, put out top 8 bits\n\t */\n\tputcbuf((lbitbuffer>>(-lbits_to_go)) & 0xff,buffer);\n\tlbits_to_go += 8;\n    }\n    buffer->bitbuffer = lbitbuffer;\n    buffer->bits_to_go = lbits_to_go;\n    return(0);\n}\n/*---------------------------------------------------------------------------*/\n/* Flush out the last bits */\n\nstatic int done_outputing_bits(Buffer *buffer)\n{\n    if(buffer->bits_to_go < 8) {\n\tputcbuf(buffer->bitbuffer<<buffer->bits_to_go,buffer);\n\t\n/*\tif (putcbuf(buffer->bitbuffer<<buffer->bits_to_go,buffer) == EOF)\n\t    return(EOF);\n*/\n    }\n    return(0);\n}\n/*---------------------------------------------------------------------------*/\n/*----------------------------------------------------------*/\n/*                                                          */\n/*    START OF SOURCE FILE ORIGINALLY CALLED rdecomp.c      */\n/*                                                          */\n/*----------------------------------------------------------*/\n\n/* @(#) rdecomp.c 1.4 99/03/01 12:38:41 */\n/* rdecomp.c\tDecompress image line using\n *\t\t(1) Difference of adjacent pixels\n *\t\t(2) Rice algorithm coding\n *\n * Returns 0 on success or 1 on failure\n */\n\n/*    moved these 'includes' to the beginning of the file (WDP)\n#include <stdio.h>\n#include <stdlib.h>\n*/\n\n/*---------------------------------------------------------------------------*/\n/* this routine used to be called 'rdecomp'  (WDP)  */\n\nint fits_rdecomp (unsigned char *c,\t\t/* input buffer\t\t\t*/\n\t     int clen,\t\t\t/* length of input\t\t*/\n\t     unsigned int array[],\t/* output array\t\t\t*/\n\t     int nx,\t\t\t/* number of output pixels\t*/\n\t     int nblock)\t\t/* coding block size\t\t*/\n{\n/* int bsize;  */\nint i, k, imax;\nint nbits, nzero, fs;\nunsigned char *cend, bytevalue;\nunsigned int b, diff, lastpix;\nint fsmax, fsbits, bbits;\nextern const int nonzero_count[];\n\n   /*\n     * Original size of each pixel (bsize, bytes) and coding block\n     * size (nblock, pixels)\n     * Could make bsize a parameter to allow more efficient\n     * compression of short & byte images.\n     */\n/*    bsize = 4; */\n\n/*    nblock = 32; now an input parameter */\n    /*\n     * From bsize derive:\n     * FSBITS = # bits required to store FS\n     * FSMAX = maximum value for FS\n     * BBITS = bits/pixel for direct coding\n     */\n\n/*\n    switch (bsize) {\n    case 1:\n\tfsbits = 3;\n\tfsmax = 6;\n\tbreak;\n    case 2:\n\tfsbits = 4;\n\tfsmax = 14;\n\tbreak;\n    case 4:\n\tfsbits = 5;\n\tfsmax = 25;\n\tbreak;\n    default:\n        ffpmsg(\"rdecomp: bsize must be 1, 2, or 4 bytes\");\n\treturn 1;\n    }\n*/\n\n    /* move out of switch block, to tweak performance */\n    fsbits = 5;\n    fsmax = 25;\n\n    bbits = 1<<fsbits;\n\n    /*\n     * Decode in blocks of nblock pixels\n     */\n\n    /* first 4 bytes of input buffer contain the value of the first */\n    /* 4 byte integer value, without any encoding */\n    \n    lastpix = 0;\n    bytevalue = c[0];\n    lastpix = lastpix | (bytevalue<<24);\n    bytevalue = c[1];\n    lastpix = lastpix | (bytevalue<<16);\n    bytevalue = c[2];\n    lastpix = lastpix | (bytevalue<<8);\n    bytevalue = c[3];\n    lastpix = lastpix | bytevalue;\n\n    c += 4;  \n    cend = c + clen - 4;\n\n    b = *c++;\t\t    /* bit buffer\t\t\t*/\n    nbits = 8;\t\t    /* number of bits remaining in b\t*/\n    for (i = 0; i<nx; ) {\n\t/* get the FS value from first fsbits */\n\tnbits -= fsbits;\n\twhile (nbits < 0) {\n\t    b = (b<<8) | (*c++);\n\t    nbits += 8;\n\t}\n\tfs = (b >> nbits) - 1;\n\n\tb &= (1<<nbits)-1;\n\t/* loop over the next block */\n\timax = i + nblock;\n\tif (imax > nx) imax = nx;\n\tif (fs<0) {\n\t    /* low-entropy case, all zero differences */\n\t    for ( ; i<imax; i++) array[i] = lastpix;\n\t} else if (fs==fsmax) {\n\t    /* high-entropy case, directly coded pixel values */\n\t    for ( ; i<imax; i++) {\n\t\tk = bbits - nbits;\n\t\tdiff = b<<k;\n\t\tfor (k -= 8; k >= 0; k -= 8) {\n\t\t    b = *c++;\n\t\t    diff |= b<<k;\n\t\t}\n\t\tif (nbits>0) {\n\t\t    b = *c++;\n\t\t    diff |= b>>(-k);\n\t\t    b &= (1<<nbits)-1;\n\t\t} else {\n\t\t    b = 0;\n\t\t}\n\t\t/*\n\t\t * undo mapping and differencing\n\t\t * Note that some of these operations will overflow the\n\t\t * unsigned int arithmetic -- that's OK, it all works\n\t\t * out to give the right answers in the output file.\n\t\t */\n\t\tif ((diff & 1) == 0) {\n\t\t    diff = diff>>1;\n\t\t} else {\n\t\t    diff = ~(diff>>1);\n\t\t}\n\t\tarray[i] = diff+lastpix;\n\t\tlastpix = array[i];\n\t    }\n\t} else {\n\t    /* normal case, Rice coding */\n\t    for ( ; i<imax; i++) {\n\t\t/* count number of leading zeros */\n\t\twhile (b == 0) {\n\t\t    nbits += 8;\n\t\t    b = *c++;\n\t\t}\n\t\tnzero = nbits - nonzero_count[b];\n\t\tnbits -= nzero+1;\n\t\t/* flip the leading one-bit */\n\t\tb ^= 1<<nbits;\n\t\t/* get the FS trailing bits */\n\t\tnbits -= fs;\n\t\twhile (nbits < 0) {\n\t\t    b = (b<<8) | (*c++);\n\t\t    nbits += 8;\n\t\t}\n\t\tdiff = (nzero<<fs) | (b>>nbits);\n\t\tb &= (1<<nbits)-1;\n\n\t\t/* undo mapping and differencing */\n\t\tif ((diff & 1) == 0) {\n\t\t    diff = diff>>1;\n\t\t} else {\n\t\t    diff = ~(diff>>1);\n\t\t}\n\t\tarray[i] = diff+lastpix;\n\t\tlastpix = array[i];\n\t    }\n\t}\n\tif (c > cend) {\n            ffpmsg(\"decompression error: hit end of compressed byte stream\");\n\t    return 1;\n\t}\n    }\n    if (c < cend) {\n        ffpmsg(\"decompression warning: unused bytes at end of compressed buffer\");\n    }\n    return 0;\n}\n/*---------------------------------------------------------------------------*/\n/* this routine used to be called 'rdecomp'  (WDP)  */\n\nint fits_rdecomp_short (unsigned char *c,\t\t/* input buffer\t\t\t*/\n\t     int clen,\t\t\t/* length of input\t\t*/\n\t     unsigned short array[],  \t/* output array\t\t\t*/\n\t     int nx,\t\t\t/* number of output pixels\t*/\n\t     int nblock)\t\t/* coding block size\t\t*/\n{\nint i, imax;\n/* int bsize; */\nint k;\nint nbits, nzero, fs;\nunsigned char *cend, bytevalue;\nunsigned int b, diff, lastpix;\nint fsmax, fsbits, bbits;\nextern const int nonzero_count[];\n\n   /*\n     * Original size of each pixel (bsize, bytes) and coding block\n     * size (nblock, pixels)\n     * Could make bsize a parameter to allow more efficient\n     * compression of short & byte images.\n     */\n\n/*    bsize = 2; */\n    \n/*    nblock = 32; now an input parameter */\n    /*\n     * From bsize derive:\n     * FSBITS = # bits required to store FS\n     * FSMAX = maximum value for FS\n     * BBITS = bits/pixel for direct coding\n     */\n\n/*\n    switch (bsize) {\n    case 1:\n\tfsbits = 3;\n\tfsmax = 6;\n\tbreak;\n    case 2:\n\tfsbits = 4;\n\tfsmax = 14;\n\tbreak;\n    case 4:\n\tfsbits = 5;\n\tfsmax = 25;\n\tbreak;\n    default:\n        ffpmsg(\"rdecomp: bsize must be 1, 2, or 4 bytes\");\n\treturn 1;\n    }\n*/\n\n    /* move out of switch block, to tweak performance */\n    fsbits = 4;\n    fsmax = 14;\n\n    bbits = 1<<fsbits;\n\n    /*\n     * Decode in blocks of nblock pixels\n     */\n\n    /* first 2 bytes of input buffer contain the value of the first */\n    /* 2 byte integer value, without any encoding */\n    \n    lastpix = 0;\n    bytevalue = c[0];\n    lastpix = lastpix | (bytevalue<<8);\n    bytevalue = c[1];\n    lastpix = lastpix | bytevalue;\n\n    c += 2;  \n    cend = c + clen - 2;\n\n    b = *c++;\t\t    /* bit buffer\t\t\t*/\n    nbits = 8;\t\t    /* number of bits remaining in b\t*/\n    for (i = 0; i<nx; ) {\n\t/* get the FS value from first fsbits */\n\tnbits -= fsbits;\n\twhile (nbits < 0) {\n\t    b = (b<<8) | (*c++);\n\t    nbits += 8;\n\t}\n\tfs = (b >> nbits) - 1;\n\n\tb &= (1<<nbits)-1;\n\t/* loop over the next block */\n\timax = i + nblock;\n\tif (imax > nx) imax = nx;\n\tif (fs<0) {\n\t    /* low-entropy case, all zero differences */\n\t    for ( ; i<imax; i++) array[i] = lastpix;\n\t} else if (fs==fsmax) {\n\t    /* high-entropy case, directly coded pixel values */\n\t    for ( ; i<imax; i++) {\n\t\tk = bbits - nbits;\n\t\tdiff = b<<k;\n\t\tfor (k -= 8; k >= 0; k -= 8) {\n\t\t    b = *c++;\n\t\t    diff |= b<<k;\n\t\t}\n\t\tif (nbits>0) {\n\t\t    b = *c++;\n\t\t    diff |= b>>(-k);\n\t\t    b &= (1<<nbits)-1;\n\t\t} else {\n\t\t    b = 0;\n\t\t}\n   \n\t\t/*\n\t\t * undo mapping and differencing\n\t\t * Note that some of these operations will overflow the\n\t\t * unsigned int arithmetic -- that's OK, it all works\n\t\t * out to give the right answers in the output file.\n\t\t */\n\t\tif ((diff & 1) == 0) {\n\t\t    diff = diff>>1;\n\t\t} else {\n\t\t    diff = ~(diff>>1);\n\t\t}\n\t\tarray[i] = diff+lastpix;\n\t\tlastpix = array[i];\n\t    }\n\t} else {\n\t    /* normal case, Rice coding */\n\t    for ( ; i<imax; i++) {\n\t\t/* count number of leading zeros */\n\t\twhile (b == 0) {\n\t\t    nbits += 8;\n\t\t    b = *c++;\n\t\t}\n\t\tnzero = nbits - nonzero_count[b];\n\t\tnbits -= nzero+1;\n\t\t/* flip the leading one-bit */\n\t\tb ^= 1<<nbits;\n\t\t/* get the FS trailing bits */\n\t\tnbits -= fs;\n\t\twhile (nbits < 0) {\n\t\t    b = (b<<8) | (*c++);\n\t\t    nbits += 8;\n\t\t}\n\t\tdiff = (nzero<<fs) | (b>>nbits);\n\t\tb &= (1<<nbits)-1;\n\n\t\t/* undo mapping and differencing */\n\t\tif ((diff & 1) == 0) {\n\t\t    diff = diff>>1;\n\t\t} else {\n\t\t    diff = ~(diff>>1);\n\t\t}\n\t\tarray[i] = diff+lastpix;\n\t\tlastpix = array[i];\n\t    }\n\t}\n\tif (c > cend) {\n            ffpmsg(\"decompression error: hit end of compressed byte stream\");\n\t    return 1;\n\t}\n    }\n    if (c < cend) {\n        ffpmsg(\"decompression warning: unused bytes at end of compressed buffer\");\n    }\n    return 0;\n}\n/*---------------------------------------------------------------------------*/\n/* this routine used to be called 'rdecomp'  (WDP)  */\n\nint fits_rdecomp_byte (unsigned char *c,\t\t/* input buffer\t\t\t*/\n\t     int clen,\t\t\t/* length of input\t\t*/\n\t     unsigned char array[],  \t/* output array\t\t\t*/\n\t     int nx,\t\t\t/* number of output pixels\t*/\n\t     int nblock)\t\t/* coding block size\t\t*/\n{\nint i, imax;\n/* int bsize; */\nint k;\nint nbits, nzero, fs;\nunsigned char *cend;\nunsigned int b, diff, lastpix;\nint fsmax, fsbits, bbits;\nextern const int nonzero_count[];\n\n   /*\n     * Original size of each pixel (bsize, bytes) and coding block\n     * size (nblock, pixels)\n     * Could make bsize a parameter to allow more efficient\n     * compression of short & byte images.\n     */\n\n/*    bsize = 1; */\n    \n/*    nblock = 32; now an input parameter */\n    /*\n     * From bsize derive:\n     * FSBITS = # bits required to store FS\n     * FSMAX = maximum value for FS\n     * BBITS = bits/pixel for direct coding\n     */\n\n/*\n    switch (bsize) {\n    case 1:\n\tfsbits = 3;\n\tfsmax = 6;\n\tbreak;\n    case 2:\n\tfsbits = 4;\n\tfsmax = 14;\n\tbreak;\n    case 4:\n\tfsbits = 5;\n\tfsmax = 25;\n\tbreak;\n    default:\n        ffpmsg(\"rdecomp: bsize must be 1, 2, or 4 bytes\");\n\treturn 1;\n    }\n*/\n\n    /* move out of switch block, to tweak performance */\n    fsbits = 3;\n    fsmax = 6;\n\n    bbits = 1<<fsbits;\n\n    /*\n     * Decode in blocks of nblock pixels\n     */\n\n    /* first byte of input buffer contain the value of the first */\n    /* byte integer value, without any encoding */\n    \n    lastpix = c[0];\n    c += 1;  \n    cend = c + clen - 1;\n\n    b = *c++;\t\t    /* bit buffer\t\t\t*/\n    nbits = 8;\t\t    /* number of bits remaining in b\t*/\n    for (i = 0; i<nx; ) {\n\t/* get the FS value from first fsbits */\n\tnbits -= fsbits;\n\twhile (nbits < 0) {\n\t    b = (b<<8) | (*c++);\n\t    nbits += 8;\n\t}\n\tfs = (b >> nbits) - 1;\n\n\tb &= (1<<nbits)-1;\n\t/* loop over the next block */\n\timax = i + nblock;\n\tif (imax > nx) imax = nx;\n\tif (fs<0) {\n\t    /* low-entropy case, all zero differences */\n\t    for ( ; i<imax; i++) array[i] = lastpix;\n\t} else if (fs==fsmax) {\n\t    /* high-entropy case, directly coded pixel values */\n\t    for ( ; i<imax; i++) {\n\t\tk = bbits - nbits;\n\t\tdiff = b<<k;\n\t\tfor (k -= 8; k >= 0; k -= 8) {\n\t\t    b = *c++;\n\t\t    diff |= b<<k;\n\t\t}\n\t\tif (nbits>0) {\n\t\t    b = *c++;\n\t\t    diff |= b>>(-k);\n\t\t    b &= (1<<nbits)-1;\n\t\t} else {\n\t\t    b = 0;\n\t\t}\n   \n\t\t/*\n\t\t * undo mapping and differencing\n\t\t * Note that some of these operations will overflow the\n\t\t * unsigned int arithmetic -- that's OK, it all works\n\t\t * out to give the right answers in the output file.\n\t\t */\n\t\tif ((diff & 1) == 0) {\n\t\t    diff = diff>>1;\n\t\t} else {\n\t\t    diff = ~(diff>>1);\n\t\t}\n\t\tarray[i] = diff+lastpix;\n\t\tlastpix = array[i];\n\t    }\n\t} else {\n\t    /* normal case, Rice coding */\n\t    for ( ; i<imax; i++) {\n\t\t/* count number of leading zeros */\n\t\twhile (b == 0) {\n\t\t    nbits += 8;\n\t\t    b = *c++;\n\t\t}\n\t\tnzero = nbits - nonzero_count[b];\n\t\tnbits -= nzero+1;\n\t\t/* flip the leading one-bit */\n\t\tb ^= 1<<nbits;\n\t\t/* get the FS trailing bits */\n\t\tnbits -= fs;\n\t\twhile (nbits < 0) {\n\t\t    b = (b<<8) | (*c++);\n\t\t    nbits += 8;\n\t\t}\n\t\tdiff = (nzero<<fs) | (b>>nbits);\n\t\tb &= (1<<nbits)-1;\n\n\t\t/* undo mapping and differencing */\n\t\tif ((diff & 1) == 0) {\n\t\t    diff = diff>>1;\n\t\t} else {\n\t\t    diff = ~(diff>>1);\n\t\t}\n\t\tarray[i] = diff+lastpix;\n\t\tlastpix = array[i];\n\t    }\n\t}\n\tif (c > cend) {\n            ffpmsg(\"decompression error: hit end of compressed byte stream\");\n\t    return 1;\n\t}\n    }\n    if (c < cend) {\n        ffpmsg(\"decompression warning: unused bytes at end of compressed buffer\");\n    }\n    return 0;\n}\n"},{"id":16702,"name":"wcssub.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint fits_read_wcstab(\n   fitsfile   *fptr, /* I - FITS file pointer           */\n   int  nwtb,        /* Number of arrays to be read from the binary table(s) */\n   wtbarr *wtb,      /* Address of the first element of an array of wtbarr\n                         typedefs.  This wtbarr typedef is defined below to\n                         match the wtbarr struct defined in WCSLIB.  An array\n                         of such structs returned by the WCSLIB function\n                         wcstab(). */\n   int  *status)\n\n/*\n*   Author: Mark Calabretta, Australia Telescope National Facility\n*   http://www.atnf.csiro.au/~mcalabre/index.html\n*\n*   fits_read_wcstab() extracts arrays from a binary table required in\n*   constructing -TAB coordinates.  This helper routine is intended for\n*   use by routines in the WCSLIB library when dealing with the -TAB table\n*   look up WCS convention.\n*/\n\n{\n   int  anynul, colnum, hdunum, iwtb, m, naxis, nostat;\n   long *naxes = 0, nelem;\n   wtbarr *wtbp;\n\n\n   if (*status) return *status;\n\n   if (fptr == 0) {\n      return (*status = NULL_INPUT_PTR);\n   }\n\n   if (nwtb == 0) return 0;\n\n   /* Zero the array pointers. */\n   wtbp = wtb;\n   for (iwtb = 0; iwtb < nwtb; iwtb++, wtbp++) {\n     *wtbp->arrayp = 0x0;\n   }\n\n   /* Save HDU number so that we can move back to it later. */\n   fits_get_hdu_num(fptr, &hdunum);\n\n   wtbp = wtb;\n   for (iwtb = 0; iwtb < nwtb; iwtb++, wtbp++) {\n      /* Move to the required binary table extension. */\n      if (fits_movnam_hdu(fptr, BINARY_TBL, (char *)(wtbp->extnam),\n          wtbp->extver, status)) {\n         goto cleanup;\n      }\n\n      /* Locate the table column. */\n      if (fits_get_colnum(fptr, CASEINSEN, (char *)(wtbp->ttype), &colnum,\n          status)) {\n         goto cleanup;\n      }\n\n      /* Get the array dimensions and check for consistency. */\n      if (wtbp->ndim < 1) {\n         *status = NEG_AXIS;\n         goto cleanup;\n      }\n\n      if (!(naxes = calloc(wtbp->ndim, sizeof(long)))) {\n         *status = MEMORY_ALLOCATION;\n         goto cleanup;\n      }\n\n      if (fits_read_tdim(fptr, colnum, wtbp->ndim, &naxis, naxes, status)) {\n         goto cleanup;\n      }\n\n      if (naxis != wtbp->ndim) {\n         if (wtbp->kind == 'c' && wtbp->ndim == 2) {\n            /* Allow TDIMn to be omitted for degenerate coordinate arrays. */\n            naxis = 2;\n            naxes[1] = naxes[0];\n            naxes[0] = 1;\n         } else {\n            *status = BAD_TDIM;\n            goto cleanup;\n         }\n      }\n\n      if (wtbp->kind == 'c') {\n         /* Coordinate array; calculate the array size. */\n         nelem = naxes[0];\n         for (m = 0; m < naxis-1; m++) {\n            *(wtbp->dimlen + m) = naxes[m+1];\n            nelem *= naxes[m+1];\n         }\n      } else {\n         /* Index vector; check length. */\n         if ((nelem = naxes[0]) != *(wtbp->dimlen)) {\n            /* N.B. coordinate array precedes the index vectors. */\n            *status = BAD_TDIM;\n            goto cleanup;\n         }\n      }\n\n      free(naxes);\n      naxes = 0;\n\n      /* Allocate memory for the array. */\n      if (!(*wtbp->arrayp = calloc((size_t)nelem, sizeof(double)))) {\n         *status = MEMORY_ALLOCATION;\n         goto cleanup;\n      }\n\n      /* Read the array from the table. */\n      if (fits_read_col_dbl(fptr, colnum, wtbp->row, 1L, nelem, 0.0,\n          *wtbp->arrayp, &anynul, status)) {\n         goto cleanup;\n      }\n   }\n\ncleanup:\n   /* Move back to the starting HDU. */\n   nostat = 0;\n   fits_movabs_hdu(fptr, hdunum, 0, &nostat);\n\n   /* Release allocated memory. */\n   if (naxes) free(naxes);\n   if (*status) {\n      wtbp = wtb;\n      for (iwtb = 0; iwtb < nwtb; iwtb++, wtbp++) {\n         if (*wtbp->arrayp) free(*wtbp->arrayp);\n      }\n   }\n\n   return *status;\n}\n/*--------------------------------------------------------------------------*/\nint ffgiwcs(fitsfile *fptr,  /* I - FITS file pointer                    */\n           char **header,   /* O - pointer to the WCS related keywords  */\n           int *status)     /* IO - error status                        */\n/*\n  int fits_get_image_wcs_keys \n  return a string containing all the image WCS header keywords.\n  This string is then used as input to the wcsinit WCSlib routine.\n  \n  THIS ROUTINE IS DEPRECATED. USE fits_hdr2str INSTEAD\n*/\n{\n    int hdutype;\n\n    if (*status > 0)\n        return(*status);\n\n    fits_get_hdu_type(fptr, &hdutype, status);\n    if (hdutype != IMAGE_HDU)\n    {\n      ffpmsg(\n     \"Error in ffgiwcs. This HDU is not an image. Can't read WCS keywords\");\n      return(*status = NOT_IMAGE);\n    }\n\n    /* read header keywords into a long string of chars */\n    if (ffh2st(fptr, header, status) > 0)\n    {\n        ffpmsg(\"error creating string of image WCS keywords (ffgiwcs)\");\n        return(*status);\n    }\n\n    return(*status);\n}\n\n/*--------------------------------------------------------------------------*/\nint ffgics(fitsfile *fptr,    /* I - FITS file pointer           */\n           double *xrval,     /* O - X reference value           */\n           double *yrval,     /* O - Y reference value           */\n           double *xrpix,     /* O - X reference pixel           */\n           double *yrpix,     /* O - Y reference pixel           */\n           double *xinc,      /* O - X increment per pixel       */\n           double *yinc,      /* O - Y increment per pixel       */\n           double *rot,       /* O - rotation angle (degrees)    */\n           char *type,        /* O - type of projection ('-tan') */\n           int *status)       /* IO - error status               */\n/*\n       read the values of the celestial coordinate system keywords.\n       These values may be used as input to the subroutines that\n       calculate celestial coordinates. (ffxypx, ffwldp)\n\n       Modified in Nov 1999 to convert the CD matrix keywords back\n       to the old CDELTn form, and to swap the axes if the dec-like\n       axis is given first, and to assume default values if any of the\n       keywords are not present.\n*/\n{\n    int tstat = 0, cd_exists = 0, pc_exists = 0;\n    char ctype[FLEN_VALUE];\n    double cd11 = 0.0, cd21 = 0.0, cd22 = 0.0, cd12 = 0.0;\n    double pc11 = 1.0, pc21 = 0.0, pc22 = 1.0, pc12 = 0.0;\n    double pi =  3.1415926535897932;\n    double phia, phib, temp;\n    double toler = .0002;  /* tolerance for angles to agree (radians) */\n                           /*   (= approximately 0.01 degrees) */\n\n    if (*status > 0)\n       return(*status);\n\n    tstat = 0;\n    if (ffgkyd(fptr, \"CRVAL1\", xrval, NULL, &tstat))\n       *xrval = 0.;\n\n    tstat = 0;\n    if (ffgkyd(fptr, \"CRVAL2\", yrval, NULL, &tstat))\n       *yrval = 0.;\n\n    tstat = 0;\n    if (ffgkyd(fptr, \"CRPIX1\", xrpix, NULL, &tstat))\n        *xrpix = 0.;\n\n    tstat = 0;\n    if (ffgkyd(fptr, \"CRPIX2\", yrpix, NULL, &tstat))\n        *yrpix = 0.;\n\n    /* look for CDELTn first, then CDi_j keywords */\n    tstat = 0;\n    if (ffgkyd(fptr, \"CDELT1\", xinc, NULL, &tstat))\n    {\n        /* CASE 1: no CDELTn keyword, so look for the CD matrix */\n        tstat = 0;\n        if (ffgkyd(fptr, \"CD1_1\", &cd11, NULL, &tstat))\n            tstat = 0;  /* reset keyword not found error */\n        else\n            cd_exists = 1;  /* found at least 1 CD_ keyword */\n\n        if (ffgkyd(fptr, \"CD2_1\", &cd21, NULL, &tstat))\n            tstat = 0;  /* reset keyword not found error */\n        else\n            cd_exists = 1;  /* found at least 1 CD_ keyword */\n\n        if (ffgkyd(fptr, \"CD1_2\", &cd12, NULL, &tstat))\n            tstat = 0;  /* reset keyword not found error */\n        else\n            cd_exists = 1;  /* found at least 1 CD_ keyword */\n\n        if (ffgkyd(fptr, \"CD2_2\", &cd22, NULL, &tstat))\n            tstat = 0;  /* reset keyword not found error */\n        else\n            cd_exists = 1;  /* found at least 1 CD_ keyword */\n\n        if (cd_exists)  /* convert CDi_j back to CDELTn */\n        {\n            /* there are 2 ways to compute the angle: */\n            phia = atan2( cd21, cd11);\n            phib = atan2(-cd12, cd22);\n\n            /* ensure that phia <= phib */\n            temp = minvalue(phia, phib);\n            phib = maxvalue(phia, phib);\n            phia = temp;\n\n            /* there is a possible 180 degree ambiguity in the angles */\n            /* so add 180 degress to the smaller value if the values  */\n            /* differ by more than 90 degrees = pi/2 radians.         */\n            /* (Later, we may decide to take the other solution by    */\n            /* subtracting 180 degrees from the larger value).        */\n\n            if ((phib - phia) > (pi / 2.))\n               phia += pi;\n\n            if (fabs(phia - phib) > toler) \n            {\n               /* angles don't agree, so looks like there is some skewness */\n               /* between the axes.  Return with an error to be safe. */\n               *status = APPROX_WCS_KEY;\n            }\n      \n            phia = (phia + phib) /2.;  /* use the average of the 2 values */\n            *xinc = cd11 / cos(phia);\n            *yinc = cd22 / cos(phia);\n            *rot = phia * 180. / pi;\n\n            /* common usage is to have a positive yinc value.  If it is */\n            /* negative, then subtract 180 degrees from rot and negate  */\n            /* both xinc and yinc.  */\n\n            if (*yinc < 0)\n            {\n                *xinc = -(*xinc);\n                *yinc = -(*yinc);\n                *rot = *rot - 180.;\n            }\n        }\n        else   /* no CD matrix keywords either */\n        {\n            *xinc = 1.;\n\n            /* there was no CDELT1 keyword, but check for CDELT2 just in case */\n            tstat = 0;\n            if (ffgkyd(fptr, \"CDELT2\", yinc, NULL, &tstat))\n                *yinc = 1.;\n\n            tstat = 0;\n            if (ffgkyd(fptr, \"CROTA2\", rot, NULL, &tstat))\n                *rot=0.;\n        }\n    }\n    else  /* Case 2: CDELTn + optional PC matrix */\n    {\n        if (ffgkyd(fptr, \"CDELT2\", yinc, NULL, &tstat))\n            *yinc = 1.;\n\n        tstat = 0;\n        if (ffgkyd(fptr, \"CROTA2\", rot, NULL, &tstat))\n        {\n            *rot=0.;\n\n            /* no CROTA2 keyword, so look for the PC matrix */\n            tstat = 0;\n            if (ffgkyd(fptr, \"PC1_1\", &pc11, NULL, &tstat))\n                tstat = 0;  /* reset keyword not found error */\n            else\n                pc_exists = 1;  /* found at least 1 PC_ keyword */\n\n            if (ffgkyd(fptr, \"PC2_1\", &pc21, NULL, &tstat))\n                tstat = 0;  /* reset keyword not found error */\n            else\n                pc_exists = 1;  /* found at least 1 PC_ keyword */\n\n            if (ffgkyd(fptr, \"PC1_2\", &pc12, NULL, &tstat))\n                tstat = 0;  /* reset keyword not found error */\n            else\n                pc_exists = 1;  /* found at least 1 PC_ keyword */\n\n            if (ffgkyd(fptr, \"PC2_2\", &pc22, NULL, &tstat))\n                tstat = 0;  /* reset keyword not found error */\n            else\n                pc_exists = 1;  /* found at least 1 PC_ keyword */\n\n            if (pc_exists)  /* convert PCi_j back to CDELTn */\n            {\n                /* there are 2 ways to compute the angle: */\n                phia = atan2( pc21, pc11);\n                phib = atan2(-pc12, pc22);\n\n                /* ensure that phia <= phib */\n                temp = minvalue(phia, phib);\n                phib = maxvalue(phia, phib);\n                phia = temp;\n\n                /* there is a possible 180 degree ambiguity in the angles */\n                /* so add 180 degress to the smaller value if the values  */\n                /* differ by more than 90 degrees = pi/2 radians.         */\n                /* (Later, we may decide to take the other solution by    */\n                /* subtracting 180 degrees from the larger value).        */\n\n                if ((phib - phia) > (pi / 2.))\n                   phia += pi;\n\n                if (fabs(phia - phib) > toler) \n                {\n                  /* angles don't agree, so looks like there is some skewness */\n                  /* between the axes.  Return with an error to be safe. */\n                  *status = APPROX_WCS_KEY;\n                }\n      \n                phia = (phia + phib) /2.;  /* use the average of the 2 values */\n                *rot = phia * 180. / pi;\n            }\n        }\n    }\n\n    /* get the type of projection, if any */\n    tstat = 0;\n    if (ffgkys(fptr, \"CTYPE1\", ctype, NULL, &tstat))\n         type[0] = '\\0';\n    else\n    {\n        /* copy the projection type string */\n        strncpy(type, &ctype[4], 4);\n        type[4] = '\\0';\n\n        /* check if RA and DEC are inverted */\n        if (!strncmp(ctype, \"DEC-\", 4) || !strncmp(ctype+1, \"LAT\", 3))\n        {\n            /* the latitudinal axis is given first, so swap them */\n\n/*\n this case was removed on 12/9.  Apparently not correct.\n\n            if ((*xinc / *yinc) < 0. )  \n                *rot = -90. - (*rot);\n            else\n*/\n            *rot = 90. - (*rot);\n\n            /* Empirical tests with ds9 show the y-axis sign must be negated */\n            /* and the xinc and yinc values must NOT be swapped. */\n            *yinc = -(*yinc);\n\n            temp = *xrval;\n            *xrval = *yrval;\n            *yrval = temp;\n        }   \n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgicsa(fitsfile *fptr,    /* I - FITS file pointer           */\n           char version,      /* I - character code of desired version */\n\t                      /*     A - Z or blank */\n           double *xrval,     /* O - X reference value           */\n           double *yrval,     /* O - Y reference value           */\n           double *xrpix,     /* O - X reference pixel           */\n           double *yrpix,     /* O - Y reference pixel           */\n           double *xinc,      /* O - X increment per pixel       */\n           double *yinc,      /* O - Y increment per pixel       */\n           double *rot,       /* O - rotation angle (degrees)    */\n           char *type,        /* O - type of projection ('-tan') */\n           int *status)       /* IO - error status               */\n/*\n       read the values of the celestial coordinate system keywords.\n       These values may be used as input to the subroutines that\n       calculate celestial coordinates. (ffxypx, ffwldp)\n\n       Modified in Nov 1999 to convert the CD matrix keywords back\n       to the old CDELTn form, and to swap the axes if the dec-like\n       axis is given first, and to assume default values if any of the\n       keywords are not present.\n*/\n{\n    int tstat = 0, cd_exists = 0, pc_exists = 0;\n    char ctype[FLEN_VALUE], keyname[FLEN_VALUE], alt[2];\n    double cd11 = 0.0, cd21 = 0.0, cd22 = 0.0, cd12 = 0.0;\n    double pc11 = 1.0, pc21 = 0.0, pc22 = 1.0, pc12 = 0.0;\n    double pi =  3.1415926535897932;\n    double phia, phib, temp;\n    double toler = .0002;  /* tolerance for angles to agree (radians) */\n                           /*   (= approximately 0.01 degrees) */\n\n    if (*status > 0)\n       return(*status);\n\n    if (version == ' ') {\n      ffgics(fptr, xrval, yrval, xrpix, yrpix, xinc, yinc, rot, type, status);\n      return (*status);\n    }\n\n    if (version > 'Z' || version < 'A') {\n      ffpmsg(\"ffgicsa: illegal WCS version code (must be A - Z or blank)\");\n      return(*status = WCS_ERROR);\n    }\n\n    alt[0] = version;\n    alt[1] = '\\0';\n    \n    tstat = 0;\n    strcpy(keyname, \"CRVAL1\");\n    strcat(keyname, alt);\n    if (ffgkyd(fptr, keyname, xrval, NULL, &tstat))\n       *xrval = 0.;\n\n    tstat = 0;\n    strcpy(keyname, \"CRVAL2\");\n    strcat(keyname, alt);\n    if (ffgkyd(fptr, keyname, yrval, NULL, &tstat))\n       *yrval = 0.;\n\n    tstat = 0;\n    strcpy(keyname, \"CRPIX1\");\n    strcat(keyname, alt);\n    if (ffgkyd(fptr, keyname, xrpix, NULL, &tstat))\n        *xrpix = 0.;\n\n    tstat = 0;\n    strcpy(keyname, \"CRPIX2\");\n    strcat(keyname, alt);\n     if (ffgkyd(fptr, keyname, yrpix, NULL, &tstat))\n        *yrpix = 0.;\n\n    /* look for CDELTn first, then CDi_j keywords */\n    tstat = 0;\n    strcpy(keyname, \"CDELT1\");\n    strcat(keyname, alt);\n    if (ffgkyd(fptr, keyname, xinc, NULL, &tstat))\n    {\n        /* CASE 1: no CDELTn keyword, so look for the CD matrix */\n        tstat = 0;\n        strcpy(keyname, \"CD1_1\");\n        strcat(keyname, alt);\n        if (ffgkyd(fptr, keyname, &cd11, NULL, &tstat))\n            tstat = 0;  /* reset keyword not found error */\n        else\n            cd_exists = 1;  /* found at least 1 CD_ keyword */\n\n        strcpy(keyname, \"CD2_1\");\n        strcat(keyname, alt);\n        if (ffgkyd(fptr, keyname, &cd21, NULL, &tstat))\n            tstat = 0;  /* reset keyword not found error */\n        else\n            cd_exists = 1;  /* found at least 1 CD_ keyword */\n\n        strcpy(keyname, \"CD1_2\");\n        strcat(keyname, alt);\n        if (ffgkyd(fptr, keyname, &cd12, NULL, &tstat))\n            tstat = 0;  /* reset keyword not found error */\n        else\n            cd_exists = 1;  /* found at least 1 CD_ keyword */\n\n        strcpy(keyname, \"CD2_2\");\n        strcat(keyname, alt);\n        if (ffgkyd(fptr, keyname, &cd22, NULL, &tstat))\n            tstat = 0;  /* reset keyword not found error */\n        else\n            cd_exists = 1;  /* found at least 1 CD_ keyword */\n\n        if (cd_exists)  /* convert CDi_j back to CDELTn */\n        {\n            /* there are 2 ways to compute the angle: */\n            phia = atan2( cd21, cd11);\n            phib = atan2(-cd12, cd22);\n\n            /* ensure that phia <= phib */\n            temp = minvalue(phia, phib);\n            phib = maxvalue(phia, phib);\n            phia = temp;\n\n            /* there is a possible 180 degree ambiguity in the angles */\n            /* so add 180 degress to the smaller value if the values  */\n            /* differ by more than 90 degrees = pi/2 radians.         */\n            /* (Later, we may decide to take the other solution by    */\n            /* subtracting 180 degrees from the larger value).        */\n\n            if ((phib - phia) > (pi / 2.))\n               phia += pi;\n\n            if (fabs(phia - phib) > toler) \n            {\n               /* angles don't agree, so looks like there is some skewness */\n               /* between the axes.  Return with an error to be safe. */\n               *status = APPROX_WCS_KEY;\n            }\n      \n            phia = (phia + phib) /2.;  /* use the average of the 2 values */\n            *xinc = cd11 / cos(phia);\n            *yinc = cd22 / cos(phia);\n            *rot = phia * 180. / pi;\n\n            /* common usage is to have a positive yinc value.  If it is */\n            /* negative, then subtract 180 degrees from rot and negate  */\n            /* both xinc and yinc.  */\n\n            if (*yinc < 0)\n            {\n                *xinc = -(*xinc);\n                *yinc = -(*yinc);\n                *rot = *rot - 180.;\n            }\n        }\n        else   /* no CD matrix keywords either */\n        {\n            *xinc = 1.;\n\n            /* there was no CDELT1 keyword, but check for CDELT2 just in case */\n            tstat = 0;\n            strcpy(keyname, \"CDELT2\");\n            strcat(keyname, alt);\n            if (ffgkyd(fptr, keyname, yinc, NULL, &tstat))\n                *yinc = 1.;\n\n            tstat = 0;\n            strcpy(keyname, \"CROTA2\");\n            strcat(keyname, alt);\n            if (ffgkyd(fptr, keyname, rot, NULL, &tstat))\n                *rot=0.;\n        }\n    }\n    else  /* Case 2: CDELTn + optional PC matrix */\n    {\n        strcpy(keyname, \"CDELT2\");\n        strcat(keyname, alt);\n        if (ffgkyd(fptr, keyname, yinc, NULL, &tstat))\n            *yinc = 1.;\n\n        tstat = 0;\n        strcpy(keyname, \"CROTA2\");\n        strcat(keyname, alt);\n        if (ffgkyd(fptr, keyname, rot, NULL, &tstat))\n        {\n            *rot=0.;\n\n            /* no CROTA2 keyword, so look for the PC matrix */\n            tstat = 0;\n            strcpy(keyname, \"PC1_1\");\n            strcat(keyname, alt);\n            if (ffgkyd(fptr, keyname, &pc11, NULL, &tstat))\n                tstat = 0;  /* reset keyword not found error */\n            else\n                pc_exists = 1;  /* found at least 1 PC_ keyword */\n\n            strcpy(keyname, \"PC2_1\");\n            strcat(keyname, alt);\n            if (ffgkyd(fptr, keyname, &pc21, NULL, &tstat))\n                tstat = 0;  /* reset keyword not found error */\n            else\n                pc_exists = 1;  /* found at least 1 PC_ keyword */\n\n            strcpy(keyname, \"PC1_2\");\n            strcat(keyname, alt);\n            if (ffgkyd(fptr, keyname, &pc12, NULL, &tstat))\n                tstat = 0;  /* reset keyword not found error */\n            else\n                pc_exists = 1;  /* found at least 1 PC_ keyword */\n\n            strcpy(keyname, \"PC2_2\");\n            strcat(keyname, alt);\n            if (ffgkyd(fptr, keyname, &pc22, NULL, &tstat))\n                tstat = 0;  /* reset keyword not found error */\n            else\n                pc_exists = 1;  /* found at least 1 PC_ keyword */\n\n            if (pc_exists)  /* convert PCi_j back to CDELTn */\n            {\n                /* there are 2 ways to compute the angle: */\n                phia = atan2( pc21, pc11);\n                phib = atan2(-pc12, pc22);\n\n                /* ensure that phia <= phib */\n                temp = minvalue(phia, phib);\n                phib = maxvalue(phia, phib);\n                phia = temp;\n\n                /* there is a possible 180 degree ambiguity in the angles */\n                /* so add 180 degress to the smaller value if the values  */\n                /* differ by more than 90 degrees = pi/2 radians.         */\n                /* (Later, we may decide to take the other solution by    */\n                /* subtracting 180 degrees from the larger value).        */\n\n                if ((phib - phia) > (pi / 2.))\n                   phia += pi;\n\n                if (fabs(phia - phib) > toler) \n                {\n                  /* angles don't agree, so looks like there is some skewness */\n                  /* between the axes.  Return with an error to be safe. */\n                  *status = APPROX_WCS_KEY;\n                }\n      \n                phia = (phia + phib) /2.;  /* use the average of the 2 values */\n                *rot = phia * 180. / pi;\n            }\n        }\n    }\n\n    /* get the type of projection, if any */\n    tstat = 0;\n    strcpy(keyname, \"CTYPE1\");\n    strcat(keyname, alt);\n    if (ffgkys(fptr, keyname, ctype, NULL, &tstat))\n         type[0] = '\\0';\n    else\n    {\n        /* copy the projection type string */\n        strncpy(type, &ctype[4], 4);\n        type[4] = '\\0';\n\n        /* check if RA and DEC are inverted */\n        if (!strncmp(ctype, \"DEC-\", 4) || !strncmp(ctype+1, \"LAT\", 3))\n        {\n            /* the latitudinal axis is given first, so swap them */\n\n            *rot = 90. - (*rot);\n\n            /* Empirical tests with ds9 show the y-axis sign must be negated */\n            /* and the xinc and yinc values must NOT be swapped. */\n            *yinc = -(*yinc);\n\n            temp = *xrval;\n            *xrval = *yrval;\n            *yrval = temp;\n        }   \n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgtcs(fitsfile *fptr,    /* I - FITS file pointer           */\n           int xcol,          /* I - column containing the RA coordinate  */\n           int ycol,          /* I - column containing the DEC coordinate */\n           double *xrval,     /* O - X reference value           */\n           double *yrval,     /* O - Y reference value           */\n           double *xrpix,     /* O - X reference pixel           */\n           double *yrpix,     /* O - Y reference pixel           */\n           double *xinc,      /* O - X increment per pixel       */\n           double *yinc,      /* O - Y increment per pixel       */\n           double *rot,       /* O - rotation angle (degrees)    */\n           char *type,        /* O - type of projection ('-sin') */\n           int *status)       /* IO - error status               */\n/*\n       read the values of the celestial coordinate system keywords\n       from a FITS table where the X and Y or RA and DEC coordinates\n       are stored in separate column.  Do this by converting the\n       table to a temporary FITS image, then reading the keywords\n       from the image file.\n       These values may be used as input to the subroutines that\n       calculate celestial coordinates. (ffxypx, ffwldp)\n*/\n{\n    int colnum[2];\n    long naxes[2];\n    fitsfile *tptr;\n\n    if (*status > 0)\n       return(*status);\n\n    colnum[0] = xcol;\n    colnum[1] = ycol;\n    naxes[0] = 10;\n    naxes[1] = 10;\n\n    /* create temporary  FITS file, in memory */\n    ffinit(&tptr, \"mem://\", status);\n    \n    /* create a temporary image; the datatype and size are not important */\n    ffcrim(tptr, 32, 2, naxes, status);\n    \n    /* now copy the relevant keywords from the table to the image */\n    fits_copy_pixlist2image(fptr, tptr, 9, 2, colnum, status);\n\n    /* write default WCS keywords, if they are not present */\n    fits_write_keys_histo(fptr, tptr, 2, colnum, status);\n\n    if (*status > 0)\n       return(*status);\n         \n    /* read the WCS keyword values from the temporary image */\n    ffgics(tptr, xrval, yrval, xrpix, yrpix, xinc, yinc, rot, type, status); \n\n    if (*status > 0)\n    {\n      ffpmsg\n      (\"ffgtcs could not find all the celestial coordinate keywords\");\n      return(*status = NO_WCS_KEY); \n    }\n\n    /* delete the temporary file */\n    fits_delete_file(tptr, status);\n    \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgtwcs(fitsfile *fptr,  /* I - FITS file pointer              */\n           int xcol,        /* I - column number for the X column  */\n           int ycol,        /* I - column number for the Y column  */\n           char **header,   /* O - string of all the WCS keywords  */\n           int *status)     /* IO - error status                   */\n/*\n  int fits_get_table_wcs_keys\n  Return string containing all the WCS keywords appropriate for the \n  pair of X and Y columns containing the coordinate\n  of each event in an event list table.  This string may then be passed\n  to Doug Mink's WCS library wcsinit routine, to create and initialize the\n  WCS structure.  The calling routine must free the header character string\n  when it is no longer needed. \n\n  THIS ROUTINE IS DEPRECATED. USE fits_hdr2str INSTEAD\n*/\n{\n    int hdutype, ncols, tstatus, length;\n    int naxis1 = 1, naxis2 = 1;\n    long tlmin, tlmax;\n    char keyname[FLEN_KEYWORD];\n    char valstring[FLEN_VALUE];\n    char comm[2];\n    char *cptr;\n    /*  construct a string of 80 blanks, for adding fill to the keywords */\n                 /*  12345678901234567890123456789012345678901234567890123456789012345678901234567890 */\n    char blanks[] = \"                                                                                \";\n\n    if (*status > 0)\n        return(*status);\n\n    fits_get_hdu_type(fptr, &hdutype, status);\n    if (hdutype == IMAGE_HDU)\n    {\n        ffpmsg(\"Can't read table WSC keywords. This HDU is not a table\");\n        return(*status = NOT_TABLE);\n    }\n\n    fits_get_num_cols(fptr, &ncols, status);\n    \n    if (xcol < 1 || xcol > ncols)\n    {\n        ffpmsg(\"illegal X axis column number in fftwcs\");\n        return(*status = BAD_COL_NUM);\n    }\n\n    if (ycol < 1 || ycol > ncols)\n    {\n        ffpmsg(\"illegal Y axis column number in fftwcs\");\n        return(*status = BAD_COL_NUM);\n    }\n\n    /* allocate character string for all the WCS keywords */\n    *header = calloc(1, 2401);  /* room for up to 30 keywords */\n    if (*header == 0)\n    {\n        ffpmsg(\"error allocating memory for WCS header keywords (fftwcs)\");\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    cptr = *header;\n    comm[0] = '\\0';\n    \n    tstatus = 0;\n    ffkeyn(\"TLMIN\",xcol,keyname,status);\n    ffgkyj(fptr,keyname, &tlmin,NULL,&tstatus);\n\n    if (!tstatus)\n    {\n        ffkeyn(\"TLMAX\",xcol,keyname,status);\n        ffgkyj(fptr,keyname, &tlmax,NULL,&tstatus);\n    }\n\n    if (!tstatus)\n    {\n        naxis1 = tlmax - tlmin + 1;\n    }\n\n    tstatus = 0;\n    ffkeyn(\"TLMIN\",ycol,keyname,status);\n    ffgkyj(fptr,keyname, &tlmin,NULL,&tstatus);\n\n    if (!tstatus)\n    {\n        ffkeyn(\"TLMAX\",ycol,keyname,status);\n        ffgkyj(fptr,keyname, &tlmax,NULL,&tstatus);\n    }\n\n    if (!tstatus)\n    {\n        naxis2 = tlmax - tlmin + 1;\n    }\n\n    /*            123456789012345678901234567890    */\n    strcat(cptr, \"NAXIS   =                    2\");\n    strncat(cptr, blanks, 50);\n    cptr += 80;\n\n    ffi2c(naxis1, valstring, status);   /* convert to formatted string */\n    ffmkky(\"NAXIS1\", valstring, comm, cptr, status);  /* construct the keyword*/\n    strncat(cptr, blanks, 50);  /* pad with blanks */\n    cptr += 80;\n\n    strcpy(keyname, \"NAXIS2\");\n    ffi2c(naxis2, valstring, status);   /* convert to formatted string */\n    ffmkky(keyname, valstring, comm, cptr, status);  /* construct the keyword*/\n    strncat(cptr, blanks, 50);  /* pad with blanks */\n    cptr += 80;\n\n    /* read the required header keywords (use defaults if not found) */\n\n    /*  CTYPE1 keyword */\n    tstatus = 0;\n    ffkeyn(\"TCTYP\",xcol,keyname,status);\n    if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) )\n       valstring[0] =  '\\0';\n    ffmkky(\"CTYPE1\", valstring, comm, cptr, status);  /* construct the keyword*/\n    length = strlen(cptr);\n    strncat(cptr, blanks, 80 - length);  /* pad with blanks */\n    cptr += 80;\n\n    /*  CTYPE2 keyword */\n    tstatus = 0;\n    ffkeyn(\"TCTYP\",ycol,keyname,status);\n    if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) )\n       valstring[0] =  '\\0';\n    ffmkky(\"CTYPE2\", valstring, comm, cptr, status);  /* construct the keyword*/\n    length = strlen(cptr);\n    strncat(cptr, blanks, 80 - length);  /* pad with blanks */\n    cptr += 80;\n\n    /*  CRPIX1 keyword */\n    tstatus = 0;\n    ffkeyn(\"TCRPX\",xcol,keyname,status);\n    if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) )\n       strcpy(valstring, \"1\");\n    ffmkky(\"CRPIX1\", valstring, comm, cptr, status);  /* construct the keyword*/\n    strncat(cptr, blanks, 50);  /* pad with blanks */\n    cptr += 80;\n\n    /*  CRPIX2 keyword */\n    tstatus = 0;\n    ffkeyn(\"TCRPX\",ycol,keyname,status);\n    if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) )\n       strcpy(valstring, \"1\");\n    ffmkky(\"CRPIX2\", valstring, comm, cptr, status);  /* construct the keyword*/\n    strncat(cptr, blanks, 50);  /* pad with blanks */\n    cptr += 80;\n\n    /*  CRVAL1 keyword */\n    tstatus = 0;\n    ffkeyn(\"TCRVL\",xcol,keyname,status);\n    if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) )\n       strcpy(valstring, \"1\");\n    ffmkky(\"CRVAL1\", valstring, comm, cptr, status);  /* construct the keyword*/\n    strncat(cptr, blanks, 50);  /* pad with blanks */\n    cptr += 80;\n\n    /*  CRVAL2 keyword */\n    tstatus = 0;\n    ffkeyn(\"TCRVL\",ycol,keyname,status);\n    if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) )\n       strcpy(valstring, \"1\");\n    ffmkky(\"CRVAL2\", valstring, comm, cptr, status);  /* construct the keyword*/\n    strncat(cptr, blanks, 50);  /* pad with blanks */\n    cptr += 80;\n\n    /*  CDELT1 keyword */\n    tstatus = 0;\n    ffkeyn(\"TCDLT\",xcol,keyname,status);\n    if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) )\n       strcpy(valstring, \"1\");\n    ffmkky(\"CDELT1\", valstring, comm, cptr, status);  /* construct the keyword*/\n    strncat(cptr, blanks, 50);  /* pad with blanks */\n    cptr += 80;\n\n    /*  CDELT2 keyword */\n    tstatus = 0;\n    ffkeyn(\"TCDLT\",ycol,keyname,status);\n    if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) )\n       strcpy(valstring, \"1\");\n    ffmkky(\"CDELT2\", valstring, comm, cptr, status);  /* construct the keyword*/\n    strncat(cptr, blanks, 50);  /* pad with blanks */\n    cptr += 80;\n\n    /* the following keywords may not exist */\n\n    /*  CROTA2 keyword */\n    tstatus = 0;\n    ffkeyn(\"TCROT\",ycol,keyname,status);\n    if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) == 0 )\n    {\n        ffmkky(\"CROTA2\", valstring, comm, cptr, status);  /* construct keyword*/\n        strncat(cptr, blanks, 50);  /* pad with blanks */\n        cptr += 80;\n    }\n\n    /*  EPOCH keyword */\n    tstatus = 0;\n    if (ffgkey(fptr, \"EPOCH\", valstring, NULL, &tstatus) == 0 )\n    {\n        ffmkky(\"EPOCH\", valstring, comm, cptr, status);  /* construct keyword*/\n        length = strlen(cptr);\n        strncat(cptr, blanks, 80 - length);  /* pad with blanks */\n        cptr += 80;\n    }\n\n    /*  EQUINOX keyword */\n    tstatus = 0;\n    if (ffgkey(fptr, \"EQUINOX\", valstring, NULL, &tstatus) == 0 )\n    {\n        ffmkky(\"EQUINOX\", valstring, comm, cptr, status); /* construct keyword*/\n        length = strlen(cptr);\n        strncat(cptr, blanks, 80 - length);  /* pad with blanks */\n        cptr += 80;\n    }\n\n    /*  RADECSYS keyword */\n    tstatus = 0;\n    if (ffgkey(fptr, \"RADECSYS\", valstring, NULL, &tstatus) == 0 )\n    {\n        ffmkky(\"RADECSYS\", valstring, comm, cptr, status); /*construct keyword*/\n        length = strlen(cptr);\n        strncat(cptr, blanks, 80 - length);  /* pad with blanks */\n        cptr += 80;\n    }\n\n    /*  TELESCOPE keyword */\n    tstatus = 0;\n    if (ffgkey(fptr, \"TELESCOP\", valstring, NULL, &tstatus) == 0 )\n    {\n        ffmkky(\"TELESCOP\", valstring, comm, cptr, status); \n        length = strlen(cptr);\n        strncat(cptr, blanks, 80 - length);  /* pad with blanks */\n        cptr += 80;\n    }\n\n    /*  INSTRUME keyword */\n    tstatus = 0;\n    if (ffgkey(fptr, \"INSTRUME\", valstring, NULL, &tstatus) == 0 )\n    {\n        ffmkky(\"INSTRUME\", valstring, comm, cptr, status);  \n        length = strlen(cptr);\n        strncat(cptr, blanks, 80 - length);  /* pad with blanks */\n        cptr += 80;\n    }\n\n    /*  DETECTOR keyword */\n    tstatus = 0;\n    if (ffgkey(fptr, \"DETECTOR\", valstring, NULL, &tstatus) == 0 )\n    {\n        ffmkky(\"DETECTOR\", valstring, comm, cptr, status);  \n        length = strlen(cptr);\n        strncat(cptr, blanks, 80 - length);  /* pad with blanks */\n        cptr += 80;\n    }\n\n    /*  MJD-OBS keyword */\n    tstatus = 0;\n    if (ffgkey(fptr, \"MJD-OBS\", valstring, NULL, &tstatus) == 0 )\n    {\n        ffmkky(\"MJD-OBS\", valstring, comm, cptr, status);  \n        length = strlen(cptr);\n        strncat(cptr, blanks, 80 - length);  /* pad with blanks */\n        cptr += 80;\n    }\n\n    /*  DATE-OBS keyword */\n    tstatus = 0;\n    if (ffgkey(fptr, \"DATE-OBS\", valstring, NULL, &tstatus) == 0 )\n    {\n        ffmkky(\"DATE-OBS\", valstring, comm, cptr, status);  \n        length = strlen(cptr);\n        strncat(cptr, blanks, 80 - length);  /* pad with blanks */\n        cptr += 80;\n    }\n\n    /*  DATE keyword */\n    tstatus = 0;\n    if (ffgkey(fptr, \"DATE\", valstring, NULL, &tstatus) == 0 )\n    {\n        ffmkky(\"DATE\", valstring, comm, cptr, status);  \n        length = strlen(cptr);\n        strncat(cptr, blanks, 80 - length);  /* pad with blanks */\n        cptr += 80;\n    }\n\n    strcat(cptr, \"END\");\n    strncat(cptr, blanks, 77);\n\n    return(*status);\n}\n"},{"id":16703,"name":"getcolb.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, getcolb.c, contains routines that read data elements from   */\n/*  a FITS image or table, with unsigned char (unsigned byte) data type.   */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <math.h>\n#include <stdlib.h>\n#include <limits.h>\n#include <string.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffgpvb( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            unsigned char nulval, /* I - value for undefined pixels          */\n            unsigned char *array, /* O - array of values that are returned   */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Undefined elements will be set equal to NULVAL, unless NULVAL=0\n  in which case no checking for undefined values will be performed.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    char cdummy;\n    int nullcheck = 1;\n    unsigned char nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n         nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_pixels(fptr, TBYTE, firstelem, nelem,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclb(fptr, 2, row, firstelem, nelem, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgpfb( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            unsigned char *array, /* O - array of values that are returned   */\n            char *nularray,   /* O - array of null pixel flags               */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Any undefined pixels in the returned array will be set = 0 and the \n  corresponding nularray value will be set = 1.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    int nullcheck = 2;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_read_compressed_pixels(fptr, TBYTE, firstelem, nelem,\n            nullcheck, NULL, array, nularray, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclb(fptr, 2, row, firstelem, nelem, 1, 2, 0,\n               array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg2db(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           unsigned char nulval, /* set undefined pixels equal to this     */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           unsigned char *array, /* O - array to be filled and returned    */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    /* call the 3D reading routine, with the 3rd dimension = 1 */\n\n    ffg3db(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, \n           anynul, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg3db(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           unsigned char nulval, /* set undefined pixels equal to this     */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  nrows,     /* I - number of rows in each plane of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           LONGLONG  naxis3,    /* I - FITS image NAXIS3 value                 */\n           unsigned char *array, /* O - array to be filled and returned    */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 3-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    long tablerow, ii, jj;\n    LONGLONG narray, nfits;\n    char cdummy;\n    int  nullcheck = 1;\n    long inc[] = {1,1,1};\n    LONGLONG fpixel[] = {1,1,1};\n    LONGLONG lpixel[3];\n    unsigned char nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        lpixel[0] = ncols;\n        lpixel[1] = nrows;\n        lpixel[2] = naxis3;\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TBYTE, fpixel, lpixel, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n       /* all the image pixels are contiguous, so read all at once */\n       ffgclb(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n       return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to read */\n    narray = 0;  /* next pixel in output array to be filled */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* reading naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffgclb(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval,\n          &array[narray], &cdummy, anynul, status) > 0)\n          return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsvb(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           unsigned char nulval, /* I - value to set undefined pixels       */\n           unsigned char *array, /* O - array to be filled and returned     */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii, i0, i1, i2, i3, i4, i5, i6, i7, i8, row, rstr, rstp, rinc;\n    long str[9], stp[9], incr[9], dir[9];\n    long nelem, nultyp, ninc, numcol;\n    LONGLONG felem, dsize[10], blcll[9], trcll[9];\n    int hdutype, anyf;\n    char ldummy, msg[FLEN_ERRMSG];\n    int  nullcheck = 1;\n    unsigned char nullvalue;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvb is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TBYTE, blcll, trcll, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 1;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n        dir[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        if (hdutype == IMAGE_HDU)\n        {\n           dir[ii] = -1;\n        }\n        else\n        {\n          snprintf(msg, FLEN_ERRMSG,\"ffgsvb: illegal range specified for axis %ld\", ii + 1);\n          ffpmsg(msg);\n          return(*status = BAD_PIX_NUM);\n        }\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n      dsize[ii] = dsize[ii] * dir[ii];\n    }\n    dsize[naxis] = dsize[naxis] * dir[naxis];\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0]*dir[0] - str[0]*dir[0]) / inc[0] + 1;\n      ninc = incr[0] * dir[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]*dir[8]; i8 <= stp[8]*dir[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]*dir[7]; i7 <= stp[7]*dir[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]*dir[6]; i6 <= stp[6]*dir[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]*dir[5]; i5 <= stp[5]*dir[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]*dir[4]; i4 <= stp[4]*dir[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]*dir[3]; i3 <= stp[3]*dir[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]*dir[2]; i2 <= stp[2]*dir[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]*dir[1]; i1 <= stp[1]*dir[1]; i1 += incr[1])\n            {\n\n              felem=str[0] + (i1 - dir[1]) * dsize[1] + (i2 - dir[2]) * dsize[2] + \n                             (i3 - dir[3]) * dsize[3] + (i4 - dir[4]) * dsize[4] +\n                             (i5 - dir[5]) * dsize[5] + (i6 - dir[6]) * dsize[6] +\n                             (i7 - dir[7]) * dsize[7] + (i8 - dir[8]) * dsize[8];\n\n              if ( ffgclb(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &ldummy, &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsfb(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           unsigned char *array, /* O - array to be filled and returned     */\n           char *flagval,  /* O - set to 1 if corresponding value is null   */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dsize[10];\n    LONGLONG blcll[9], trcll[9];\n    long felem, nelem, nultyp, ninc, numcol;\n    int hdutype, anyf;\n    unsigned char nulval = 0;\n    char msg[FLEN_ERRMSG];\n    int  nullcheck = 2;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvb is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        fits_read_compressed_img(fptr, TBYTE, blcll, trcll, inc,\n            nullcheck, NULL, array, flagval, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 2;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        snprintf(msg, FLEN_ERRMSG,\"ffgsvb: illegal range specified for axis %ld\", ii + 1);\n        ffpmsg(msg);\n        return(*status = BAD_PIX_NUM);\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n    }\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0] - str[0]) / inc[0] + 1;\n      ninc = incr[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1])\n            {\n              felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + \n                             (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] +\n                             (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] +\n                             (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8];\n\n              if ( ffgclb(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &flagval[i0], &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffggpb( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            long  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            long  nelem,      /* I - number of values to read                */\n            unsigned char *array, /* O - array of values that are returned   */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of group parameters from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n*/\n{\n    long row;\n    int idummy;\n    char cdummy;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclb(fptr, 1, row, firstelem, nelem, 1, 1, 0,\n               array, &cdummy, &idummy, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcvb(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           unsigned char nulval, /* I - value for null pixels               */\n           unsigned char *array, /* O - array of values that are read       */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Any undefined pixels will be set equal to the value of 'nulval' unless\n  nulval = 0 in which case no checks for undefined pixels will be made.\n*/\n{\n    char cdummy;\n\n    ffgclb(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval,\n           array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcfb(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           unsigned char *array, /* O - array of values that are read       */\n           char *nularray,   /* O - array of flags: 1 if null pixel; else 0 */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Nularray will be set = 1 if the corresponding array pixel is undefined, \n  otherwise nularray will = 0.\n*/\n{\n    unsigned char dummy = 0;\n\n    ffgclb(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy,\n           array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgclb( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            long  elemincre,  /* I - pixel increment; e.g., 2 = every other  */\n            int   nultyp,     /* I - null value handling code:               */\n                              /*     1: set undefined pixels = nulval        */\n                              /*     2: set nularray=1 for undefined pixels  */\n            unsigned char nulval, /* I - value for null pixels if nultyp = 1 */\n            unsigned char *array, /* O - array of values that are read       */\n            char *nularray,   /* O - array of flags = 1 if nultyp = 2        */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer be a virtual column in a 1 or more grouped FITS primary\n  array or image extension.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The output array of values will be converted from the datatype of the column \n  and will be scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    double scale, zero, power = 1., dtemp;\n    int tcode, maxelem2, hdutype, xcode, decimals;\n    long twidth, incre, ntodo;\n    long ii, xwidth;\n    int convert, nulcheck, readcheck = 16; /* see note below on readcheck */\n    LONGLONG repeat, startpos, elemnum, readptr, tnull;\n    LONGLONG rowlen, rownum, remain, next, rowincre, maxelem;\n    char tform[20];\n    char message[FLEN_ERRMSG];\n    char snull[20];   /*  the FITS null value if reading from ASCII table  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    union u_tag {\n       char charval;\n       unsigned char ucharval;\n    } u;\n\n    if (*status > 0 || nelem == 0)  /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    if (anynul)\n        *anynul = 0;\n\n    if (nultyp == 2)      \n       memset(nularray, 0, (size_t) nelem);   /* initialize nullarray */\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (elemincre < 0)\n        readcheck -= 1;  /* don't do range checking in this case */\n\n    /* IMPORTANT NOTE: that the special case of using this subroutine\n       to read bytes from a character column are handled internally\n       by the call to ffgcprll() below.  It will adjust the effective\n       *tcode, repeats, etc, to appear as a TBYTE column. */\n\n    /* Note that readcheck = 16 is equivalent to readcheck = 0 \n       and readcheck = 15 is equivalent to readcheck = -1, \n       but either of those settings allow TSTRINGS to be \n       treated as TBYTE vectors, but with full error checking */\n\n    ffgcprll( fptr, colnum, firstrow, firstelem, nelem, readcheck, &scale, &zero,\n         tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre,\n         &repeat, &rowlen, &hdutype, &tnull, snull, status);\n    maxelem = maxelem2;\n\n    /* special case */\n    if (tcode == TLOGICAL && elemincre == 1)\n    {\n        u.ucharval = nulval;\n        ffgcll(fptr, colnum, firstrow, firstelem, nelem, nultyp,\n               u.charval, (char *) array, nularray, anynul, status);\n\n        return(*status);\n    }\n\n    if (*status > 0)\n        return(*status);\n        \n    incre *= elemincre;   /* multiply incre to just get every nth pixel */\n\n    if (tcode == TSTRING && hdutype == ASCII_TBL) /* setup for ASCII tables */\n    {\n      /* get the number of implied decimal places if no explicit decmal point */\n      ffasfm(tform, &xcode, &xwidth, &decimals, status); \n      for(ii = 0; ii < decimals; ii++)\n        power *= 10.;\n    }\n    /*------------------------------------------------------------------*/\n    /*  Decide whether to check for null values in the input FITS file: */\n    /*------------------------------------------------------------------*/\n    nulcheck = nultyp; /* by default, check for null values in the FITS file */\n\n    if (nultyp == 1 && nulval == 0)\n       nulcheck = 0;    /* calling routine does not want to check for nulls */\n\n    else if (tcode%10 == 1 &&        /* if reading an integer column, and  */ \n            tnull == NULL_UNDEFINED) /* if a null value is not defined,    */\n            nulcheck = 0;            /* then do not check for null values. */\n\n    else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TBYTE && (tnull > 255 || tnull < 0) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED)\n         nulcheck = 0;\n\n    /*----------------------------------------------------------------------*/\n    /*  If FITS column and output data array have same datatype, then we do */\n    /*  not need to use a temporary buffer to store intermediate datatype.  */\n    /*----------------------------------------------------------------------*/\n    convert = 1;\n    if (tcode == TBYTE) /* Special Case:                        */\n    {                             /* no type convertion required, so read */\n                                  /* data directly into output buffer.    */\n\n        if (nelem < (LONGLONG)INT32_MAX) {\n            maxelem = nelem;\n        } else {\n            maxelem = INT32_MAX;\n        }\n\n        if (nulcheck == 0 && scale == 1. && zero == 0.)\n            convert = 0;  /* no need to scale data or find nulls */\n    }\n\n    /*---------------------------------------------------------------------*/\n    /*  Now read the pixels from the FITS column. If the column does not   */\n    /*  have the same datatype as the output array, then we have to read   */\n    /*  the raw values into a temporary buffer (of limited size).  In      */\n    /*  the case of a vector colum read only 1 vector of values at a time  */\n    /*  then skip to the next row if more values need to be read.          */\n    /*  After reading the raw values, then call the fffXXYY routine to (1) */\n    /*  test for undefined values, (2) convert the datatype if necessary,  */\n    /*  and (3) scale the values by the FITS TSCALn and TZEROn linear      */\n    /*  scaling parameters.                                                */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to read */\n    next = 0;                 /* next element in array to be read   */\n    rownum = 0;               /* row number, relative to firstrow   */\n\n    while (remain)\n    {\n        /* limit the number of pixels to read at one time to the number that\n           will fit in the buffer or to the number of pixels that remain in\n           the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);\n        if (elemincre >= 0)\n        {\n          ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1));\n        }\n        else\n        {\n          ntodo = (long) minvalue(ntodo, (elemnum/(-elemincre) +1));\n        }\n\n        readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre));\n\n        switch (tcode) \n        {\n            case (TBYTE):\n                ffgi1b(fptr, readptr, ntodo, incre, &array[next], status);\n                if (convert)\n                    fffi1i1(&array[next], ntodo, scale, zero, nulcheck, \n                    (unsigned char) tnull, nulval, &nularray[next], anynul, \n                           &array[next], status);\n                break;\n            case (TSHORT):\n                ffgi2b(fptr, readptr, ntodo, incre, (short *) buffer, status);\n                fffi2i1((short  *) buffer, ntodo, scale, zero, nulcheck, \n                       (short) tnull, nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TLONG):\n                ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) buffer,\n                       status);\n                fffi4i1((INT32BIT *) buffer, ntodo, scale, zero, nulcheck, \n                       (INT32BIT) tnull, nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TLONGLONG):\n                ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status);\n                fffi8i1( (LONGLONG *) buffer, ntodo, scale, zero, \n                           nulcheck, tnull, nulval, &nularray[next], \n                            anynul, &array[next], status);\n                break;\n            case (TFLOAT):\n                ffgr4b(fptr, readptr, ntodo, incre, (float  *) buffer, status);\n                fffr4i1((float  *) buffer, ntodo, scale, zero, nulcheck, \n                       nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TDOUBLE):\n                ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status);\n                fffr8i1((double *) buffer, ntodo, scale, zero, nulcheck, \n                          nulval, &nularray[next], anynul, \n                          &array[next], status);\n                break;\n            case (TSTRING):\n                ffmbyt(fptr, readptr, REPORT_EOF, status);\n       \n                if (incre == twidth)    /* contiguous bytes */\n                     ffgbyt(fptr, ntodo * twidth, buffer, status);\n                else\n                     ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                               status);\n\n                /* interpret the string as an ASCII formated number */\n                fffstri1((char *) buffer, ntodo, scale, zero, twidth, power,\n                      nulcheck, snull, nulval, &nularray[next], anynul,\n                      &array[next], status);\n                break;\n\n            default:  /*  error trap for invalid column format */\n                snprintf(message, FLEN_ERRMSG,\n                   \"Cannot read bytes from column %d which has format %s\",\n                    colnum, tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous read operation */\n        {\n\t  dtemp = (double) next;\n          if (hdutype > 0)\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgclb).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from image (ffgclb).\",\n              dtemp+1., dtemp+ntodo);\n\n         ffpmsg(message);\n         return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum = elemnum + (ntodo * elemincre);\n\n            if (elemnum >= repeat)  /* completed a row; start on later row */\n            {\n                rowincre = elemnum / repeat;\n                rownum += rowincre;\n                elemnum = elemnum - (rowincre * repeat);\n            }\n            else if (elemnum < 0)  /* completed a row; start on a previous row */\n            {\n                rowincre = (-elemnum - 1) / repeat + 1;\n                rownum -= rowincre;\n                elemnum = (rowincre * repeat) + elemnum;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while reading FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgextn( fitsfile *fptr,        /* I - FITS file pointer                        */\n            LONGLONG  offset,      /* I - byte offset from start of extension data */\n            LONGLONG  nelem,       /* I - number of elements to read               */\n            void *buffer,          /* I - stream of bytes to read                  */\n            int  *status)          /* IO - error status                            */\n/*\n  Read a stream of bytes from the current FITS HDU.  This primative routine is mainly\n  for reading non-standard \"conforming\" extensions and should not be used\n  for standard IMAGE, TABLE or BINTABLE extensions.\n*/\n{\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    /* rescan header if data structure is undefined */\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n    /* move to write position */\n    ffmbyt(fptr, (fptr->Fptr)->datastart+ offset, IGNORE_EOF, status);\n    \n    /* read the buffer */\n    ffgbyt(fptr, nelem, buffer, status); \n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi1i1(unsigned char *input, /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char tnull,  /* I - value of FITS TNULLn keyword if any */\n            unsigned char nullval,/* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            unsigned char *output,/* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {              /* this routine is normally not called in this case */\n           memmove(output, input, ntodo );\n        }\n        else             /* must scale the data */\n        {                \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUCHAR_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UCHAR_MAX;\n                }\n                else\n                    output[ii] = (unsigned char) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UCHAR_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned char) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi2i1(short *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short tnull,          /* I - value of FITS TNULLn keyword if any */\n            unsigned char nullval,/* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            unsigned char *output,/* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (input[ii] > UCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UCHAR_MAX;\n                }\n                else\n                    output[ii] = (unsigned char) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUCHAR_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UCHAR_MAX;\n                }\n                else\n                    output[ii] = (unsigned char) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n\n                else\n                {\n                    if (input[ii] < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (input[ii] > UCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UCHAR_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned char) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UCHAR_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned char) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi4i1(INT32BIT *input,          /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            INT32BIT tnull,       /* I - value of FITS TNULLn keyword if any */\n            unsigned char nullval,/* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            unsigned char *output,/* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (input[ii] > UCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UCHAR_MAX;\n                }\n                else\n                    output[ii] = (unsigned char) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUCHAR_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UCHAR_MAX;\n                }\n                else\n                    output[ii] = (unsigned char) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    if (input[ii] < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (input[ii] > UCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UCHAR_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned char) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UCHAR_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned char) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi8i1(LONGLONG *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            LONGLONG tnull,       /* I - value of FITS TNULLn keyword if any */\n            unsigned char nullval,/* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            unsigned char *output,/* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    ULONGLONG ulltemp;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of adding 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                if (ulltemp > UCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UCHAR_MAX;\n                }\n                else\n                    output[ii] = (unsigned char) ulltemp;\n            }\n        }\n        else if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (input[ii] > UCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UCHAR_MAX;\n                }\n                else\n                    output[ii] = (unsigned char) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUCHAR_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UCHAR_MAX;\n                }\n                else\n                    output[ii] = (unsigned char) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of adding 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                    if (ulltemp > UCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UCHAR_MAX;\n                    }\n                    else\n\t\t    {\n                        output[ii] = (unsigned char) ulltemp;\n\t\t    }\n                }\n            }\n        }\n        else if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    if (input[ii] < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (input[ii] > UCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UCHAR_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned char) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UCHAR_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned char) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr4i1(float *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char nullval,/* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            unsigned char *output,/* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DUCHAR_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (input[ii] > DUCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UCHAR_MAX;\n                }\n                else\n                    output[ii] = (unsigned char) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUCHAR_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UCHAR_MAX;\n                }\n                else\n                    output[ii] = (unsigned char) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr++;       /* point to MSBs */\n#endif\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              /* use redundant boolean logic in following statement */\n              /* to suppress irritating Borland compiler warning message */\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DUCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (input[ii] > DUCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UCHAR_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned char) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  {\n                    if (zero < DUCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (zero > DUCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UCHAR_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned char) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UCHAR_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned char) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr8i1(double *input,        /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char nullval,/* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            unsigned char *output,/* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DUCHAR_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (input[ii] > DUCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UCHAR_MAX;\n                }\n                else\n                    output[ii] = (unsigned char) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DUCHAR_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DUCHAR_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UCHAR_MAX;\n                }\n                else\n                    output[ii] = (unsigned char) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr += 3;       /* point to MSBs */\n#endif\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DUCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (input[ii] > DUCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UCHAR_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned char) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  {\n                    if (zero < DUCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (zero > DUCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UCHAR_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned char) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DUCHAR_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DUCHAR_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UCHAR_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned char) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffstri1(char *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            long twidth,          /* I - width of each substring of chars    */\n            double implipower,    /* I - power of 10 of implied decimal      */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            char  *snull,         /* I - value of FITS null string, if any   */\n            unsigned char nullval, /* I - set null pixels, if nullcheck = 1  */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            unsigned char *output, /* O - array of converted pixels          */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file. Check\n  for null values and do scaling if required. The nullcheck code value\n  determines how any null values in the input array are treated. A null\n  value is an input pixel that is equal to snull.  If nullcheck= 0, then\n  no special checking for nulls is performed.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    int  nullen;\n    long ii;\n    double dvalue;\n    char *cstring, message[FLEN_ERRMSG];\n    char *cptr, *tpos;\n    char tempstore, chrzero = '0';\n    double val, power;\n    int exponent, sign, esign, decpt;\n\n    nullen = strlen(snull);\n    cptr = input;  /* pointer to start of input string */\n    for (ii = 0; ii < ntodo; ii++)\n    {\n      cstring = cptr;\n      /* temporarily insert a null terminator at end of the string */\n      tpos = cptr + twidth;\n      tempstore = *tpos;\n      *tpos = 0;\n\n      /* check if null value is defined, and if the    */\n      /* column string is identical to the null string */\n      if (snull[0] != ASCII_NULL_UNDEFINED && \n         !strncmp(snull, cptr, nullen) )\n      {\n        if (nullcheck)  \n        {\n          *anynull = 1;    \n          if (nullcheck == 1)\n            output[ii] = nullval;\n          else\n            nullarray[ii] = 1;\n        }\n        cptr += twidth;\n      }\n      else\n      {\n        /* value is not the null value, so decode it */\n        /* remove any embedded blank characters from the string */\n\n        decpt = 0;\n        sign = 1;\n        val  = 0.;\n        power = 1.;\n        exponent = 0;\n        esign = 1;\n\n        while (*cptr == ' ')               /* skip leading blanks */\n           cptr++;\n\n        if (*cptr == '-' || *cptr == '+')  /* check for leading sign */\n        {\n          if (*cptr == '-')\n             sign = -1;\n\n          cptr++;\n\n          while (*cptr == ' ')         /* skip blanks between sign and value */\n            cptr++;\n        }\n\n        while (*cptr >= '0' && *cptr <= '9')\n        {\n          val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n          cptr++;\n\n          while (*cptr == ' ')         /* skip embedded blanks in the value */\n            cptr++;\n        }\n\n        if (*cptr == '.' || *cptr == ',')       /* check for decimal point */\n        {\n          decpt = 1;\n          cptr++;\n          while (*cptr == ' ')         /* skip any blanks */\n            cptr++;\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n            power = power * 10.;\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks in the value */\n              cptr++;\n          }\n        }\n\n        if (*cptr == 'E' || *cptr == 'D')  /* check for exponent */\n        {\n          cptr++;\n          while (*cptr == ' ')         /* skip blanks */\n              cptr++;\n  \n          if (*cptr == '-' || *cptr == '+')  /* check for exponent sign */\n          {\n            if (*cptr == '-')\n               esign = -1;\n\n            cptr++;\n\n            while (*cptr == ' ')        /* skip blanks between sign and exp */\n              cptr++;\n          }\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            exponent = exponent * 10 + *cptr - chrzero;  /* accumulate exp */\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks */\n              cptr++;\n          }\n        }\n\n        if (*cptr  != 0)  /* should end up at the null terminator */\n        {\n          snprintf(message, FLEN_ERRMSG,\"Cannot read number from ASCII table\");\n          ffpmsg(message);\n          snprintf(message, FLEN_ERRMSG,\"Column field = %s.\", cstring);\n          ffpmsg(message);\n          /* restore the char that was overwritten by the null */\n          *tpos = tempstore;\n          return(*status = BAD_C2D);\n        }\n\n        if (!decpt)  /* if no explicit decimal, use implied */\n           power = implipower;\n\n        dvalue = (sign * val / power) * pow(10., (double) (esign * exponent));\n\n        dvalue = dvalue * scale + zero;   /* apply the scaling */\n\n        if (dvalue < DUCHAR_MIN)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = 0;\n        }\n        else if (dvalue > DUCHAR_MAX)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = UCHAR_MAX;\n        }\n        else\n            output[ii] = (unsigned char) dvalue;\n      }\n      /* restore the char that was overwritten by the null */\n      *tpos = tempstore;\n    }\n    return(*status);\n}\n"},{"id":16704,"name":"getcoluj.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, getcoluj.c, contains routines that read data elements from  */\n/*  a FITS image or table, with unsigned long data type.                   */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <math.h>\n#include <stdlib.h>\n#include <limits.h>\n#include <string.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffgpvuj(fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n   unsigned long  nulval,     /* I - value for undefined pixels              */\n   unsigned long  *array,     /* O - array of values that are returned       */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Undefined elements will be set equal to NULVAL, unless NULVAL=0\n  in which case no checking for undefined values will be performed.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    char cdummy;\n    int nullcheck = 1;\n    unsigned long nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_pixels(fptr, TULONG, firstelem, nelem,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcluj(fptr, 2, row, firstelem, nelem, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgpfuj(fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n   unsigned long  *array,     /* O - array of values that are returned       */\n            char *nularray,   /* O - array of null pixel flags               */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Any undefined pixels in the returned array will be set = 0 and the \n  corresponding nularray value will be set = 1.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    int nullcheck = 2;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_read_compressed_pixels(fptr, TULONG, firstelem, nelem,\n            nullcheck, NULL, array, nularray, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcluj(fptr, 2, row, firstelem, nelem, 1, 2, 0L,\n               array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg2duj(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n  unsigned long  nulval,    /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n  unsigned long  *array,    /* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    /* call the 3D reading routine, with the 3rd dimension = 1 */\n\n    ffg3duj(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, \n           anynul, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg3duj(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n  unsigned long  nulval,    /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  nrows,     /* I - number of rows in each plane of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           LONGLONG  naxis3,    /* I - FITS image NAXIS3 value                 */\n  unsigned long  *array,    /* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 3-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    long tablerow, ii, jj;\n    char cdummy;\n    int nullcheck = 1;\n    long inc[] = {1,1,1};\n    LONGLONG fpixel[] = {1,1,1}, nfits, narray;\n    LONGLONG lpixel[3];\n    unsigned long nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        lpixel[0] = ncols;\n        lpixel[1] = nrows;\n        lpixel[2] = naxis3;\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TULONG, fpixel, lpixel, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n       /* all the image pixels are contiguous, so read all at once */\n       ffgcluj(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n       return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to read */\n    narray = 0;  /* next pixel in output array to be filled */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* reading naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffgcluj(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval,\n          &array[narray], &cdummy, anynul, status) > 0)\n          return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsvuj(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n  unsigned long nulval,    /* I - value to set undefined pixels             */\n  unsigned long *array,    /* O - array to be filled and returned           */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9];\n    long nelem, nultyp, ninc, numcol;\n    LONGLONG felem, dsize[10], blcll[9], trcll[9];\n    int hdutype, anyf;\n    char ldummy, msg[FLEN_ERRMSG];\n    int nullcheck = 1;\n    unsigned long nullvalue;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvuj is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TULONG, blcll, trcll, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 1;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        snprintf(msg, FLEN_ERRMSG,\"ffgsvuj: illegal range specified for axis %ld\", ii + 1);\n        ffpmsg(msg);\n        return(*status = BAD_PIX_NUM);\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n    }\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0] - str[0]) / inc[0] + 1;\n      ninc = incr[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1])\n            {\n              felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + \n                             (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] +\n                             (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] +\n                             (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8];\n\n              if ( ffgcluj(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &ldummy, &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsfuj(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n  unsigned long *array,    /* O - array to be filled and returned           */\n           char *flagval,  /* O - set to 1 if corresponding value is null   */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dsize[10];\n    LONGLONG blcll[9], trcll[9];\n    long felem, nelem, nultyp, ninc, numcol;\n    unsigned long nulval = 0;\n    int hdutype, anyf;\n    char msg[FLEN_ERRMSG];\n    int nullcheck = 2;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvj is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        fits_read_compressed_img(fptr, TULONG, blcll, trcll, inc,\n            nullcheck, NULL, array, flagval, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 2;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        snprintf(msg, FLEN_ERRMSG,\"ffgsvj: illegal range specified for axis %ld\", ii + 1);\n        ffpmsg(msg);\n        return(*status = BAD_PIX_NUM);\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n    }\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0] - str[0]) / inc[0] + 1;\n      ninc = incr[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1])\n            {\n              felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + \n                             (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] +\n                             (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] +\n                             (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8];\n\n              if ( ffgcluj(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &flagval[i0], &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffggpuj(fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            long  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            long  nelem,      /* I - number of values to read                */\n   unsigned long  *array,     /* O - array of values that are returned       */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of group parameters from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n*/\n{\n    long row;\n    int idummy;\n    char cdummy;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcluj(fptr, 1, row, firstelem, nelem, 1, 1, 0L,\n               array, &cdummy, &idummy, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcvuj(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n  unsigned long  nulval,     /* I - value for null pixels                   */\n  unsigned long *array,      /* O - array of values that are read           */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Any undefined pixels will be set equal to the value of 'nulval' unless\n  nulval = 0 in which case no checks for undefined pixels will be made.\n*/\n{\n    char cdummy;\n\n    ffgcluj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval,\n           array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcfuj(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n  unsigned long  *array,     /* O - array of values that are read           */\n           char *nularray,   /* O - array of flags: 1 if null pixel; else 0 */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Nularray will be set = 1 if the corresponding array pixel is undefined, \n  otherwise nularray will = 0.\n*/\n{\n    unsigned long dummy = 0;\n\n    ffgcluj(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy,\n           array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcluj(fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG  firstelem, /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            long  elemincre,  /* I - pixel increment; e.g., 2 = every other  */\n            int   nultyp,     /* I - null value handling code:               */\n                              /*     1: set undefined pixels = nulval        */\n                              /*     2: set nularray=1 for undefined pixels  */\n   unsigned long  nulval,     /* I - value for null pixels if nultyp = 1     */\n   unsigned long  *array,     /* O - array of values that are read           */\n            char *nularray,   /* O - array of flags = 1 if nultyp = 2        */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer be a virtual column in a 1 or more grouped FITS primary\n  array or image extension.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The output array of values will be converted from the datatype of the column \n  and will be scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    double scale, zero, power = 1., dtemp;\n    int tcode, maxelem2, hdutype, xcode, decimals;\n    long twidth, incre;\n    long ii, xwidth, ntodo;\n    int nulcheck;\n    LONGLONG repeat, startpos, elemnum, readptr, tnull;\n    LONGLONG rowlen, rownum, remain, next, rowincre, maxelem;\n    char tform[20];\n    char message[FLEN_ERRMSG];\n    char snull[20];   /*  the FITS null value if reading from ASCII table  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0 || nelem == 0)  /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    if (anynul)\n        *anynul = 0;\n\n    if (nultyp == 2)\n        memset(nularray, 0, (size_t) nelem);   /* initialize nullarray */\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if ( ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 0, &scale, &zero,\n         tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre,\n         &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 )\n         return(*status);\n    maxelem = maxelem2;\n\n    incre *= elemincre;   /* multiply incre to just get every nth pixel */\n\n    if (tcode == TSTRING)    /* setup for ASCII tables */\n    {\n      /* get the number of implied decimal places if no explicit decmal point */\n      ffasfm(tform, &xcode, &xwidth, &decimals, status); \n      for(ii = 0; ii < decimals; ii++)\n        power *= 10.;\n    }\n    /*------------------------------------------------------------------*/\n    /*  Decide whether to check for null values in the input FITS file: */\n    /*------------------------------------------------------------------*/\n    nulcheck = nultyp; /* by default check for null values in the FITS file */\n\n    if (nultyp == 1 && nulval == 0)\n       nulcheck = 0;    /* calling routine does not want to check for nulls */\n\n    else if (tcode%10 == 1 &&        /* if reading an integer column, and  */ \n            tnull == NULL_UNDEFINED) /* if a null value is not defined,    */\n            nulcheck = 0;            /* then do not check for null values. */\n\n    else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TBYTE && (tnull > 255 || tnull < 0) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED)\n         nulcheck = 0;\n\n    /*----------------------------------------------------------------------*/\n    /*  If FITS column and output data array have same datatype, then we do */\n    /*  not need to use a temporary buffer to store intermediate datatype.  */\n    /*----------------------------------------------------------------------*/\n    if ((tcode == TLONG) && (LONGSIZE == 32))  /* Special Case:                        */\n    {                             /* no type convertion required, so read */\n                                  /* data directly into output buffer.    */\n\n        if (nelem < (LONGLONG)INT32_MAX/4) {\n            maxelem = nelem;\n        } else {\n            maxelem = INT32_MAX/4;\n        }\n    }\n\n    /*---------------------------------------------------------------------*/\n    /*  Now read the pixels from the FITS column. If the column does not   */\n    /*  have the same datatype as the output array, then we have to read   */\n    /*  the raw values into a temporary buffer (of limited size).  In      */\n    /*  the case of a vector colum read only 1 vector of values at a time  */\n    /*  then skip to the next row if more values need to be read.          */\n    /*  After reading the raw values, then call the fffXXYY routine to (1) */\n    /*  test for undefined values, (2) convert the datatype if necessary,  */\n    /*  and (3) scale the values by the FITS TSCALn and TZEROn linear      */\n    /*  scaling parameters.                                                */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to read */\n    next = 0;                 /* next element in array to be read   */\n    rownum = 0;               /* row number, relative to firstrow   */\n\n    while (remain)\n    {\n        /* limit the number of pixels to read at one time to the number that\n           will fit in the buffer or to the number of pixels that remain in\n           the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);      \n        ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1));\n\n        readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre));\n\n        switch (tcode) \n        {\n            case (TLONG):\n\t      if (LONGSIZE == 32) {\n                ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) &array[next],\n                       status);\n                fffi4u4((INT32BIT *) &array[next], ntodo, scale, zero,\n                         nulcheck, (INT32BIT) tnull, nulval, &nularray[next],\n                         anynul, &array[next], status);\n\t      } else { /* case where sizeof(long) = 8 */\n                ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) buffer,\n                       status);\n                fffi4u4((INT32BIT *) buffer, ntodo, scale, zero,\n                         nulcheck, (INT32BIT) tnull, nulval, &nularray[next],\n                         anynul, &array[next], status);\n\t      }\n\n\n                break;\n            case (TLONGLONG):\n\n                ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status);\n                fffi8u4( (LONGLONG *) buffer, ntodo, scale, zero, \n                           nulcheck, tnull, nulval, &nularray[next], \n                            anynul, &array[next], status);\n                break;\n            case (TBYTE):\n                ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer,\n                       status);\n                fffi1u4((unsigned char *) buffer, ntodo, scale, zero, nulcheck, \n                     (unsigned char) tnull, nulval, &nularray[next], anynul, \n                     &array[next], status);\n                break;\n            case (TSHORT):\n                ffgi2b(fptr, readptr, ntodo, incre, (short  *) buffer, status);\n                fffi2u4((short  *) buffer, ntodo, scale, zero, nulcheck, \n                      (short) tnull, nulval, &nularray[next], anynul, \n                      &array[next], status);\n                break;\n            case (TFLOAT):\n                ffgr4b(fptr, readptr, ntodo, incre, (float  *) buffer, status);\n                fffr4u4((float  *) buffer, ntodo, scale, zero, nulcheck, \n                       nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TDOUBLE):\n                ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status);\n                fffr8u4((double *) buffer, ntodo, scale, zero, nulcheck, \n                          nulval, &nularray[next], anynul, \n                          &array[next], status);\n                break;\n            case (TSTRING):\n                ffmbyt(fptr, readptr, REPORT_EOF, status);\n       \n                if (incre == twidth)    /* contiguous bytes */\n                     ffgbyt(fptr, ntodo * twidth, buffer, status);\n                else\n                     ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                               status);\n\n                fffstru4((char *) buffer, ntodo, scale, zero, twidth, power,\n                     nulcheck, snull, nulval, &nularray[next], anynul,\n                     &array[next], status);\n                break;\n\n            default:  /*  error trap for invalid column format */\n                snprintf(message,FLEN_ERRMSG, \n                   \"Cannot read numbers from column %d which has format %s\",\n                    colnum, tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous read operation */\n        {\n\t  dtemp = (double) next;\n          if (hdutype > 0)\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgcluj).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from image (ffgcluj).\",\n              dtemp+1., dtemp+ntodo);\n\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum = elemnum + (ntodo * elemincre);\n\n            if (elemnum >= repeat)  /* completed a row; start on later row */\n            {\n                rowincre = elemnum / repeat;\n                rownum += rowincre;\n                elemnum = elemnum - (rowincre * repeat);\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while reading FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi1u4(unsigned char *input, /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char tnull,  /* I - value of FITS TNULLn keyword if any */\n   unsigned long nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned long *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (unsigned long) input[ii];  /* copy input */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DULONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DULONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = ULONG_MAX;\n                }\n                else\n                    output[ii] = (unsigned long) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (unsigned long) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DULONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DULONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = ULONG_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned long) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi2u4(short *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short tnull,          /* I - value of FITS TNULLn keyword if any */\n   unsigned long nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned long *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else\n                    output[ii] = (unsigned long) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DULONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DULONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = ULONG_MAX;\n                }\n                else\n                    output[ii] = (unsigned long) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    if (input[ii] < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else\n                        output[ii] = (unsigned long) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DULONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DULONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = ULONG_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned long) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi4u4(INT32BIT *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            INT32BIT tnull,       /* I - value of FITS TNULLn keyword if any */\n   unsigned long nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned long *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 2147483648.)\n        {       \n           /* Instead of adding 2147483648, it is more efficient */\n           /* to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n               output[ii] =  ( *(unsigned int *) &input[ii] ) ^ 0x80000000;\n\t    }\n        }\n        else if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else\n                    output[ii] = (unsigned long) input[ii]; /* copy input */\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DULONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DULONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = ULONG_MAX;\n                }\n                else\n                    output[ii] = (unsigned long) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 2147483648.) \n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                   output[ii] =  ( *(unsigned int *) &input[ii] ) ^ 0x80000000;\n            }\n        }\n        else if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else if (input[ii] < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else\n                    output[ii] = (unsigned long) input[ii]; /* copy input */\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DULONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DULONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = ULONG_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned long) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi8u4(LONGLONG *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            LONGLONG tnull,       /* I - value of FITS TNULLn keyword if any */\n   unsigned long nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned long *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    ULONGLONG ulltemp;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of adding 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                if (ulltemp > ULONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = ULONG_MAX;\n                }\n                else\n                    output[ii] = (unsigned long) ulltemp;\n            }\n        }\n        else if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (input[ii] > ULONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = ULONG_MAX;\n                }\n                else\n                    output[ii] = (unsigned long) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DULONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DULONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = ULONG_MAX;\n                }\n                else\n                    output[ii] = (unsigned long) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of adding 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                    if (ulltemp > ULONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = ULONG_MAX;\n                    }\n                    else\n\t\t    {\n                        output[ii] = (unsigned long) ulltemp;\n\t\t    }\n                }\n            }\n        }\n        else if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    if (input[ii] < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (input[ii] > ULONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = ULONG_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned long) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DULONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DULONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = ULONG_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned long) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr4u4(float *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n   unsigned long nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned long *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DULONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (input[ii] > DULONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = ULONG_MAX;\n                }\n                else\n                    output[ii] = (unsigned long) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DULONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DULONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = ULONG_MAX;\n                }\n                else\n                    output[ii] = (unsigned long) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr++;       /* point to MSBs */\n#endif\n\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DULONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (input[ii] > DULONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = ULONG_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned long) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  { \n                    if (zero < DULONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (zero > DULONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = ULONG_MAX;\n                    }\n                    else\n                      output[ii] = (unsigned long) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DULONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DULONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = ULONG_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned long) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr8u4(double *input,        /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n   unsigned long nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned long *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DULONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (input[ii] > DULONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = ULONG_MAX;\n                }\n                else\n                    output[ii] = (unsigned long) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DULONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DULONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = ULONG_MAX;\n                }\n                else\n                    output[ii] = (unsigned long) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr += 3;       /* point to MSBs */\n#endif\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DULONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (input[ii] > DULONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = ULONG_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned long) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  { \n                    if (zero < DULONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (zero > DULONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = ULONG_MAX;\n                    }\n                    else\n                      output[ii] = (unsigned long) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DULONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DULONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = ULONG_MAX;\n                    }\n                    else\n                        output[ii] = (unsigned long) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffstru4(char *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            long twidth,          /* I - width of each substring of chars    */\n            double implipower,    /* I - power of 10 of implied decimal      */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            char  *snull,         /* I - value of FITS null string, if any   */\n   unsigned long nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n   unsigned long *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file. Check\n  for null values and do scaling if required. The nullcheck code value\n  determines how any null values in the input array are treated. A null\n  value is an input pixel that is equal to snull.  If nullcheck= 0, then\n  no special checking for nulls is performed.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    int nullen;\n    long ii;\n    double dvalue;\n    char *cstring, message[FLEN_ERRMSG];\n    char *cptr, *tpos;\n    char tempstore, chrzero = '0';\n    double val, power;\n    int exponent, sign, esign, decpt;\n\n    nullen = strlen(snull);\n    cptr = input;  /* pointer to start of input string */\n    for (ii = 0; ii < ntodo; ii++)\n    {\n      cstring = cptr;\n      /* temporarily insert a null terminator at end of the string */\n      tpos = cptr + twidth;\n      tempstore = *tpos;\n      *tpos = 0;\n\n      /* check if null value is defined, and if the    */\n      /* column string is identical to the null string */\n      if (snull[0] != ASCII_NULL_UNDEFINED && \n         !strncmp(snull, cptr, nullen) )\n      {\n        if (nullcheck)  \n        {\n          *anynull = 1;    \n          if (nullcheck == 1)\n            output[ii] = nullval;\n          else\n            nullarray[ii] = 1;\n        }\n        cptr += twidth;\n      }\n      else\n      {\n        /* value is not the null value, so decode it */\n        /* remove any embedded blank characters from the string */\n\n        decpt = 0;\n        sign = 1;\n        val  = 0.;\n        power = 1.;\n        exponent = 0;\n        esign = 1;\n\n        while (*cptr == ' ')               /* skip leading blanks */\n           cptr++;\n\n        if (*cptr == '-' || *cptr == '+')  /* check for leading sign */\n        {\n          if (*cptr == '-')\n             sign = -1;\n\n          cptr++;\n\n          while (*cptr == ' ')         /* skip blanks between sign and value */\n            cptr++;\n        }\n\n        while (*cptr >= '0' && *cptr <= '9')\n        {\n          val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n          cptr++;\n\n          while (*cptr == ' ')         /* skip embedded blanks in the value */\n            cptr++;\n        }\n\n        if (*cptr == '.' || *cptr == ',')       /* check for decimal point */\n        {\n          decpt = 1;       /* set flag to show there was a decimal point */\n          cptr++;\n          while (*cptr == ' ')         /* skip any blanks */\n            cptr++;\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n            power = power * 10.;\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks in the value */\n              cptr++;\n          }\n        }\n\n        if (*cptr == 'E' || *cptr == 'D')  /* check for exponent */\n        {\n          cptr++;\n          while (*cptr == ' ')         /* skip blanks */\n              cptr++;\n  \n          if (*cptr == '-' || *cptr == '+')  /* check for exponent sign */\n          {\n            if (*cptr == '-')\n               esign = -1;\n\n            cptr++;\n\n            while (*cptr == ' ')        /* skip blanks between sign and exp */\n              cptr++;\n          }\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            exponent = exponent * 10 + *cptr - chrzero;  /* accumulate exp */\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks */\n              cptr++;\n          }\n        }\n\n        if (*cptr  != 0)  /* should end up at the null terminator */\n        {\n          snprintf(message, FLEN_ERRMSG,\"Cannot read number from ASCII table\");\n          ffpmsg(message);\n          snprintf(message, FLEN_ERRMSG,\"Column field = %s.\", cstring);\n          ffpmsg(message);\n          /* restore the char that was overwritten by the null */\n          *tpos = tempstore;\n          return(*status = BAD_C2D);\n        }\n\n        if (!decpt)  /* if no explicit decimal, use implied */\n           power = implipower;\n\n        dvalue = (sign * val / power) * pow(10., (double) (esign * exponent));\n\n        dvalue = dvalue * scale + zero;   /* apply the scaling */\n\n        if (dvalue < DULONG_MIN)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = 0;\n        }\n        else if (dvalue > DULONG_MAX)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = ULONG_MAX;\n        }\n        else\n            output[ii] = (unsigned long) dvalue;\n      }\n      /* restore the char that was overwritten by the null */\n      *tpos = tempstore;\n    }\n    return(*status);\n}\n\n/* ======================================================================== */\n/*      the following routines support the 'long long' data type            */\n/* ======================================================================== */\n\n/*--------------------------------------------------------------------------*/\nint ffgpvujj(fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            ULONGLONG  nulval, /* I - value for undefined pixels              */\n            ULONGLONG  *array, /* O - array of values that are returned       */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Undefined elements will be set equal to NULVAL, unless NULVAL=0\n  in which case no checking for undefined values will be performed.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    char cdummy;\n    int nullcheck = 1;\n    ULONGLONG nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n         nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_pixels(fptr, TULONGLONG, firstelem, nelem,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclujj(fptr, 2, row, firstelem, nelem, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgpfujj(fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            ULONGLONG  *array, /* O - array of values that are returned       */\n            char *nularray,   /* O - array of null pixel flags               */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Any undefined pixels in the returned array will be set = 0 and the \n  corresponding nularray value will be set = 1.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    int nullcheck = 2;\n    ULONGLONG dummy = 0;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_read_compressed_pixels(fptr, TULONGLONG, firstelem, nelem,\n            nullcheck, NULL, array, nularray, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclujj(fptr, 2, row, firstelem, nelem, 1, 2, dummy,\n               array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg2dujj(fitsfile *fptr, /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           ULONGLONG nulval ,/* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           ULONGLONG  *array,/* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    /* call the 3D reading routine, with the 3rd dimension = 1 */\n\n    ffg3dujj(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, \n           anynul, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg3dujj(fitsfile *fptr, /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           ULONGLONG nulval, /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  nrows,     /* I - number of rows in each plane of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           LONGLONG  naxis3,    /* I - FITS image NAXIS3 value                 */\n           ULONGLONG  *array,/* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 3-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    long tablerow, ii, jj;\n    char cdummy;\n    int nullcheck = 1;\n    long inc[] = {1,1,1};\n    LONGLONG fpixel[] = {1,1,1}, nfits, narray;\n    LONGLONG lpixel[3];\n    ULONGLONG nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        lpixel[0] = ncols;\n        lpixel[1] = nrows;\n        lpixel[2] = naxis3;\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TULONGLONG, fpixel, lpixel, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n       /* all the image pixels are contiguous, so read all at once */\n       ffgclujj(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n       return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to read */\n    narray = 0;  /* next pixel in output array to be filled */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* reading naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffgclujj(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval,\n          &array[narray], &cdummy, anynul, status) > 0)\n          return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsvujj(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           ULONGLONG nulval,/* I - value to set undefined pixels             */\n           ULONGLONG *array,/* O - array to be filled and returned           */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dir[9];\n    long nelem, nultyp, ninc, numcol;\n    LONGLONG felem, dsize[10], blcll[9], trcll[9];\n    int hdutype, anyf;\n    char ldummy, msg[FLEN_ERRMSG];\n    int nullcheck = 1;\n    ULONGLONG nullvalue;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG, \"NAXIS = %d in call to ffgsvj is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TULONGLONG, blcll, trcll, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 1;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n        dir[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        if (hdutype == IMAGE_HDU)\n        {\n           dir[ii] = -1;\n        }\n        else\n        {\n          snprintf(msg, FLEN_ERRMSG,\"ffgsvj: illegal range specified for axis %ld\", ii + 1);\n          ffpmsg(msg);\n          return(*status = BAD_PIX_NUM);\n        }\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n      dsize[ii] = dsize[ii] * dir[ii];\n    }\n    dsize[naxis] = dsize[naxis] * dir[naxis];\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0]*dir[0] - str[0]*dir[0]) / inc[0] + 1;\n      ninc = incr[0] * dir[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]*dir[8]; i8 <= stp[8]*dir[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]*dir[7]; i7 <= stp[7]*dir[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]*dir[6]; i6 <= stp[6]*dir[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]*dir[5]; i5 <= stp[5]*dir[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]*dir[4]; i4 <= stp[4]*dir[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]*dir[3]; i3 <= stp[3]*dir[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]*dir[2]; i2 <= stp[2]*dir[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]*dir[1]; i1 <= stp[1]*dir[1]; i1 += incr[1])\n            {\n\n              felem=str[0] + (i1 - dir[1]) * dsize[1] + (i2 - dir[2]) * dsize[2] + \n                             (i3 - dir[3]) * dsize[3] + (i4 - dir[4]) * dsize[4] +\n                             (i5 - dir[5]) * dsize[5] + (i6 - dir[6]) * dsize[6] +\n                             (i7 - dir[7]) * dsize[7] + (i8 - dir[8]) * dsize[8];\n\n              if ( ffgclujj(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &ldummy, &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsfujj(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           ULONGLONG *array,/* O - array to be filled and returned           */\n           char *flagval,  /* O - set to 1 if corresponding value is null   */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dsize[10];\n    LONGLONG blcll[9], trcll[9];\n    long felem, nelem, nultyp, ninc, numcol;\n    ULONGLONG nulval = 0;\n    int hdutype, anyf;\n    char msg[FLEN_ERRMSG];\n    int nullcheck = 2;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvj is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n         fits_read_compressed_img(fptr, TULONGLONG, blcll, trcll, inc,\n            nullcheck, NULL, array, flagval, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 2;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        snprintf(msg, FLEN_ERRMSG,\"ffgsvujj: illegal range specified for axis %ld\", ii + 1);\n        ffpmsg(msg);\n        return(*status = BAD_PIX_NUM);\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n    }\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0] - str[0]) / inc[0] + 1;\n      ninc = incr[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1])\n            {\n              felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + \n                             (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] +\n                             (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] +\n                             (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8];\n\n              if ( ffgclujj(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &flagval[i0], &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffggpujj(fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            long  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            long  nelem,      /* I - number of values to read                */\n            ULONGLONG  *array, /* O - array of values that are returned       */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of group parameters from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n*/\n{\n    long row;\n    int idummy;\n    char cdummy;\n    ULONGLONG dummy = 0;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclujj(fptr, 1, row, firstelem, nelem, 1, 1, dummy,\n               array, &cdummy, &idummy, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcvujj(fitsfile *fptr,  /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           ULONGLONG  nulval, /* I - value for null pixels                   */\n           ULONGLONG *array,  /* O - array of values that are read           */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Any undefined pixels will be set equal to the value of 'nulval' unless\n  nulval = 0 in which case no checks for undefined pixels will be made.\n*/\n{\n    char cdummy;\n\n    ffgclujj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval,\n           array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcfujj(fitsfile *fptr,  /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           ULONGLONG  *array, /* O - array of values that are read           */\n           char *nularray,   /* O - array of flags: 1 if null pixel; else 0 */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Nularray will be set = 1 if the corresponding array pixel is undefined, \n  otherwise nularray will = 0.\n*/\n{\n    ULONGLONG dummy = 0;\n\n    ffgclujj(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy,\n           array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgclujj( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            long  elemincre,  /* I - pixel increment; e.g., 2 = every other  */\n            int   nultyp,     /* I - null value handling code:               */\n                              /*     1: set undefined pixels = nulval        */\n                              /*     2: set nularray=1 for undefined pixels  */\n            ULONGLONG  nulval, /* I - value for null pixels if nultyp = 1     */\n            ULONGLONG  *array, /* O - array of values that are read           */\n            char *nularray,   /* O - array of flags = 1 if nultyp = 2        */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer be a virtual column in a 1 or more grouped FITS primary\n  array or image extension.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The output array of values will be converted from the datatype of the column \n  and will be scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    double scale, zero, power = 1., dtemp;\n    int tcode, maxelem2, hdutype, xcode, decimals;\n    long twidth, incre;\n    long ii, xwidth, ntodo;\n    int convert, nulcheck, readcheck = 0;\n    LONGLONG repeat, startpos, elemnum, readptr, tnull;\n    LONGLONG rowlen, rownum, remain, next, rowincre, maxelem;\n    char tform[20];\n    char message[81];\n    char snull[20];   /*  the FITS null value if reading from ASCII table  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0 || nelem == 0)  /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    if (anynul)\n        *anynul = 0;\n\n    if (nultyp == 2)\n        memset(nularray, 0, (size_t) nelem);   /* initialize nullarray */\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (elemincre < 0)\n        readcheck = -1;  /* don't do range checking in this case */\n\n    if (ffgcprll(fptr, colnum, firstrow, firstelem, nelem, readcheck, &scale, &zero,\n         tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre,\n         &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 )\n         return(*status);\n    maxelem = maxelem2;\n\n    incre *= elemincre;   /* multiply incre to just get every nth pixel */\n\n    if (tcode == TSTRING)    /* setup for ASCII tables */\n    {\n      /* get the number of implied decimal places if no explicit decmal point */\n      ffasfm(tform, &xcode, &xwidth, &decimals, status); \n      for(ii = 0; ii < decimals; ii++)\n        power *= 10.;\n    }\n    /*------------------------------------------------------------------*/\n    /*  Decide whether to check for null values in the input FITS file: */\n    /*------------------------------------------------------------------*/\n    nulcheck = nultyp; /* by default check for null values in the FITS file */\n\n    if (nultyp == 1 && nulval == 0)\n       nulcheck = 0;    /* calling routine does not want to check for nulls */\n\n    else if (tcode%10 == 1 &&        /* if reading an integer column, and  */ \n            tnull == NULL_UNDEFINED) /* if a null value is not defined,    */\n            nulcheck = 0;            /* then do not check for null values. */\n\n    else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TBYTE && (tnull > 255 || tnull < 0) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED)\n         nulcheck = 0;\n\n    convert = 1;\n\n    /*---------------------------------------------------------------------*/\n    /*  Now read the pixels from the FITS column. If the column does not   */\n    /*  have the same datatype as the output array, then we have to read   */\n    /*  the raw values into a temporary buffer (of limited size).  In      */\n    /*  the case of a vector colum read only 1 vector of values at a time  */\n    /*  then skip to the next row if more values need to be read.          */\n    /*  After reading the raw values, then call the fffXXYY routine to (1) */\n    /*  test for undefined values, (2) convert the datatype if necessary,  */\n    /*  and (3) scale the values by the FITS TSCALn and TZEROn linear      */\n    /*  scaling parameters.                                                */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to read */\n    next = 0;                 /* next element in array to be read   */\n    rownum = 0;               /* row number, relative to firstrow   */\n\n    while (remain)\n    {\n        /* limit the number of pixels to read at one time to the number that\n           will fit in the buffer or to the number of pixels that remain in\n           the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);\n        if (elemincre >= 0)\n        {\n          ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1));\n        }\n        else\n        {\n          ntodo = (long) minvalue(ntodo, (elemnum/(-elemincre) +1));\n        }\n\n        readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre));\n\n        switch (tcode) \n        {\n            case (TLONGLONG):\n                ffgi8b(fptr, readptr, ntodo, incre, (long *) &array[next],\n                       status);\n                fffi8u8((LONGLONG *) &array[next], ntodo, scale, zero, \n                           nulcheck, tnull, nulval, &nularray[next], \n                           anynul, &array[next], status);\n                break;\n            case (TLONG):\n                ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) buffer,\n                       status);\n                fffi4u8((INT32BIT *) buffer, ntodo, scale, zero, \n                        nulcheck, (INT32BIT) tnull, nulval, &nularray[next], \n                        anynul, &array[next], status);\n                break;\n            case (TBYTE):\n                ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer,\n                       status);\n                fffi1u8((unsigned char *) buffer, ntodo, scale, zero, nulcheck, \n                     (unsigned char) tnull, nulval, &nularray[next], anynul, \n                     &array[next], status);\n                break;\n            case (TSHORT):\n                ffgi2b(fptr, readptr, ntodo, incre, (short  *) buffer, status);\n                fffi2u8((short  *) buffer, ntodo, scale, zero, nulcheck, \n                      (short) tnull, nulval, &nularray[next], anynul, \n                      &array[next], status);\n                break;\n            case (TFLOAT):\n                ffgr4b(fptr, readptr, ntodo, incre, (float  *) buffer, status);\n                fffr4u8((float  *) buffer, ntodo, scale, zero, nulcheck, \n                       nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TDOUBLE):\n                ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status);\n                fffr8u8((double *) buffer, ntodo, scale, zero, nulcheck, \n                          nulval, &nularray[next], anynul, \n                          &array[next], status);\n                break;\n            case (TSTRING):\n                ffmbyt(fptr, readptr, REPORT_EOF, status);\n       \n                if (incre == twidth)    /* contiguous bytes */\n                     ffgbyt(fptr, ntodo * twidth, buffer, status);\n                else\n                     ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                               status);\n\n                fffstru8((char *) buffer, ntodo, scale, zero, twidth, power,\n                     nulcheck, snull, nulval, &nularray[next], anynul,\n                     &array[next], status);\n                break;\n\n            default:  /*  error trap for invalid column format */\n                snprintf(message, 81, \n                   \"Cannot read numbers from column %d which has format %s\",\n                    colnum, tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous read operation */\n        {\n\t  dtemp = (double) next;\n          if (hdutype > 0)\n            snprintf(message, 81,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgclj).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            snprintf(message, 81,\n            \"Error reading elements %.0f thru %.0f from image (ffgclj).\",\n              dtemp+1., dtemp+ntodo);\n\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum = elemnum + (ntodo * elemincre);\n\n            if (elemnum >= repeat)  /* completed a row; start on later row */\n            {\n                rowincre = elemnum / repeat;\n                rownum += rowincre;\n                elemnum = elemnum - (rowincre * repeat);\n            }\n            else if (elemnum < 0)  /* completed a row; start on a previous row */\n            {\n                rowincre = (-elemnum - 1) / repeat + 1;\n                rownum -= rowincre;\n                elemnum = (rowincre * repeat) + elemnum;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while reading FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi1u8(unsigned char *input, /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char tnull,  /* I - value of FITS TNULLn keyword if any */\n            ULONGLONG nullval,     /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            ULONGLONG *output,     /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n\t    {\n\t        if (input[ii] < 0) \n\t\t{\n                   *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n\t\telse\n\t\t{\n                    output[ii] = (ULONGLONG) input[ii];  /* copy input to output */\n\t\t}\n\t    }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DULONGLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UINT64_MAX;\n                }\n                else\n                    output[ii] = (ULONGLONG) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else if (input[ii] < 0) \n\t\t{\n                   *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n\t\telse\n                    output[ii] = (ULONGLONG) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DULONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT64_MAX;\n                    }\n                    else\n                        output[ii] = (ULONGLONG) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi2u8(short *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short tnull,          /* I - value of FITS TNULLn keyword if any */\n            ULONGLONG nullval,     /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            ULONGLONG *output,     /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n\t    {\n\t        if (input[ii] < 0) \n\t\t{\n                   *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n\t\telse\n\t\t{\n                    output[ii] = (ULONGLONG) input[ii];   /* copy input to output */\n                }\n\t    }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DLONGLONG_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MIN;\n                }\n                else if (dvalue > DLONGLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = LONGLONG_MAX;\n                }\n                else\n                    output[ii] = (LONGLONG) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (LONGLONG) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DLONGLONG_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MIN;\n                    }\n                    else if (dvalue > DLONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = LONGLONG_MAX;\n                    }\n                    else\n                        output[ii] = (LONGLONG) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi4u8(INT32BIT *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            INT32BIT tnull,       /* I - value of FITS TNULLn keyword if any */\n            ULONGLONG nullval,     /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            ULONGLONG *output,     /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n\t    {\n\t        if (input[ii] < 0) \n\t\t{\n                   *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n\t\telse\n\t\t{\n                   output[ii] = (ULONGLONG) input[ii];   /* copy input to output */\n\t\t}\n\t    }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DULONGLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UINT64_MAX;\n                }\n                else\n                    output[ii] = (LONGLONG) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n\t        else if (input[ii] < 0) \n\t\t{\n                   *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else\n\t\t{\n                    output[ii] = (ULONGLONG) input[ii];\n\t\t}\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DULONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT64_MAX;\n                    }\n                    else\n                        output[ii] = (ULONGLONG) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi8u8(LONGLONG *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            LONGLONG tnull,       /* I - value of FITS TNULLn keyword if any */\n            ULONGLONG nullval,     /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            ULONGLONG *output,     /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of adding 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n                output[ii] = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n            }\n        }\n        else        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n\t    {\n\t    \tif (input[ii] < 0) \n\t\t{\n                   *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n\t\telse\n\t\t{\n                    output[ii] =  input[ii];   /* copy input to output */\n\t\t}\n\t    }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DULONGLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UINT64_MAX;\n                }\n                else\n                    output[ii] = (ULONGLONG) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of adding 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                   output[ii] = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n                }\n            }\n        }\n        else if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n\t\t{\n \t    \t    if (input[ii] < 0) \n\t\t    {\n                       *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n\t\t    else\n\t\t    {\n                        output[ii] =  input[ii];   /* copy input to output */\n\t\t    }\n\t\t}\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DULONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT64_MAX;\n                    }\n                    else\n                        output[ii] = (ULONGLONG) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr4u8(float *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            ULONGLONG nullval,     /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            ULONGLONG *output,     /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (input[ii] > DULONGLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UINT64_MAX;\n                }\n                else\n                    output[ii] = (ULONGLONG) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DULONGLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UINT64_MAX;\n                }\n                else\n                    output[ii] = (ULONGLONG) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr++;       /* point to MSBs */\n#endif\n\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (input[ii] > DULONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT64_MAX;\n                    }\n                    else\n                        output[ii] = (ULONGLONG) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  {\n                    if (zero < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (zero > DULONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT64_MAX;\n                    }\n                    else\n                        output[ii] = (ULONGLONG) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DULONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT64_MAX;\n                    }\n                    else\n                        output[ii] = (ULONGLONG) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr8u8(double *input,        /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            ULONGLONG nullval,     /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            ULONGLONG *output,     /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (input[ii] > DULONGLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UINT64_MAX;\n                }\n                else\n                    output[ii] = (ULONGLONG) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < 0)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = 0;\n                }\n                else if (dvalue > DULONGLONG_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = UINT64_MAX;\n                }\n                else\n                    output[ii] = (ULONGLONG) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr += 3;       /* point to MSBs */\n#endif\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (input[ii] > DULONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT64_MAX;\n                    }\n                    else\n                        output[ii] = (ULONGLONG) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  {\n                    if (zero < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (zero > DULONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT64_MAX;\n                    }\n                    else\n                        output[ii] = (ULONGLONG) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < 0)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = 0;\n                    }\n                    else if (dvalue > DULONGLONG_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = UINT64_MAX;\n                    }\n                    else\n                        output[ii] = (ULONGLONG) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffstru8(char *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            long twidth,          /* I - width of each substring of chars    */\n            double implipower,    /* I - power of 10 of implied decimal      */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            char  *snull,         /* I - value of FITS null string, if any   */\n            ULONGLONG nullval,     /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            ULONGLONG *output,     /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file. Check\n  for null values and do scaling if required. The nullcheck code value\n  determines how any null values in the input array are treated. A null\n  value is an input pixel that is equal to snull.  If nullcheck= 0, then\n  no special checking for nulls is performed.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    int nullen;\n    long ii;\n    double dvalue;\n    char *cstring, message[81];\n    char *cptr, *tpos;\n    char tempstore, chrzero = '0';\n    double val, power;\n    int exponent, sign, esign, decpt;\n\n    nullen = strlen(snull);\n    cptr = input;  /* pointer to start of input string */\n    for (ii = 0; ii < ntodo; ii++)\n    {\n      cstring = cptr;\n      /* temporarily insert a null terminator at end of the string */\n      tpos = cptr + twidth;\n      tempstore = *tpos;\n      *tpos = 0;\n\n      /* check if null value is defined, and if the    */\n      /* column string is identical to the null string */\n      if (snull[0] != ASCII_NULL_UNDEFINED && \n         !strncmp(snull, cptr, nullen) )\n      {\n        if (nullcheck)  \n        {\n          *anynull = 1;    \n          if (nullcheck == 1)\n            output[ii] = nullval;\n          else\n            nullarray[ii] = 1;\n        }\n        cptr += twidth;\n      }\n      else\n      {\n        /* value is not the null value, so decode it */\n        /* remove any embedded blank characters from the string */\n\n        decpt = 0;\n        sign = 1;\n        val  = 0.;\n        power = 1.;\n        exponent = 0;\n        esign = 1;\n\n        while (*cptr == ' ')               /* skip leading blanks */\n           cptr++;\n\n        if (*cptr == '-' || *cptr == '+')  /* check for leading sign */\n        {\n          if (*cptr == '-')\n             sign = -1;\n\n          cptr++;\n\n          while (*cptr == ' ')         /* skip blanks between sign and value */\n            cptr++;\n        }\n\n        while (*cptr >= '0' && *cptr <= '9')\n        {\n          val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n          cptr++;\n\n          while (*cptr == ' ')         /* skip embedded blanks in the value */\n            cptr++;\n        }\n\n        if (*cptr == '.' || *cptr == ',')    /* check for decimal point */\n        {\n          decpt = 1;       /* set flag to show there was a decimal point */\n          cptr++;\n          while (*cptr == ' ')         /* skip any blanks */\n            cptr++;\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n            power = power * 10.;\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks in the value */\n              cptr++;\n          }\n        }\n\n        if (*cptr == 'E' || *cptr == 'D')  /* check for exponent */\n        {\n          cptr++;\n          while (*cptr == ' ')         /* skip blanks */\n              cptr++;\n  \n          if (*cptr == '-' || *cptr == '+')  /* check for exponent sign */\n          {\n            if (*cptr == '-')\n               esign = -1;\n\n            cptr++;\n\n            while (*cptr == ' ')        /* skip blanks between sign and exp */\n              cptr++;\n          }\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            exponent = exponent * 10 + *cptr - chrzero;  /* accumulate exp */\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks */\n              cptr++;\n          }\n        }\n\n        if (*cptr  != 0)  /* should end up at the null terminator */\n        {\n          sprintf(message, \"Cannot read number from ASCII table\");\n          ffpmsg(message);\n          snprintf(message, 81, \"Column field = %s.\", cstring);\n          ffpmsg(message);\n          /* restore the char that was overwritten by the null */\n          *tpos = tempstore;\n          return(*status = BAD_C2D);\n        }\n\n        if (!decpt)  /* if no explicit decimal, use implied */\n           power = implipower;\n\n        dvalue = (sign * val / power) * pow(10., (double) (esign * exponent));\n\n        dvalue = dvalue * scale + zero;   /* apply the scaling */\n\n        if (dvalue < 0)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = 0;\n        }\n        else if (dvalue > DULONGLONG_MAX)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = UINT64_MAX;\n        }\n        else\n            output[ii] = (ULONGLONG) dvalue;\n      }\n      /* restore the char that was overwritten by the null */\n      *tpos = tempstore;\n    }\n    return(*status);\n}\n"},{"id":16705,"name":"getcolk.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, getcolk.c, contains routines that read data elements from   */\n/*  a FITS image or table, with 'int' data type.                           */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <math.h>\n#include <stdlib.h>\n#include <limits.h>\n#include <string.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffgpvk( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            int   nulval,     /* I - value for undefined pixels              */\n            int   *array,     /* O - array of values that are returned       */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Undefined elements will be set equal to NULVAL, unless NULVAL=0\n  in which case no checking for undefined values will be performed.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    char cdummy;\n    int nullcheck = 1;\n    int nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n         nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_pixels(fptr, TINT, firstelem, nelem,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclk(fptr, 2, row, firstelem, nelem, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgpfk( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            int   *array,     /* O - array of values that are returned       */\n            char *nularray,   /* O - array of null pixel flags               */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Any undefined pixels in the returned array will be set = 0 and the \n  corresponding nularray value will be set = 1.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    int nullcheck = 2;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_read_compressed_pixels(fptr, TINT, firstelem, nelem,\n            nullcheck, NULL, array, nularray, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclk(fptr, 2, row, firstelem, nelem, 1, 2, 0L,\n               array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg2dk(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           int  nulval,    /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           int  *array,    /* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    /* call the 3D reading routine, with the 3rd dimension = 1 */\n\n    ffg3dk(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, \n           anynul, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg3dk(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           int   nulval,    /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  nrows,     /* I - number of rows in each plane of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           LONGLONG  naxis3,    /* I - FITS image NAXIS3 value                 */\n           int   *array,    /* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 3-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    long tablerow, ii, jj;\n    char cdummy;\n    int nullcheck = 1;\n    long inc[] = {1,1,1};\n    LONGLONG fpixel[] = {1,1,1}, nfits, narray;\n    LONGLONG lpixel[3];\n    int nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        lpixel[0] = ncols;\n        lpixel[1] = nrows;\n        lpixel[2] = naxis3;\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TINT, fpixel, lpixel, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n       /* all the image pixels are contiguous, so read all at once */\n       ffgclk(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n       return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to read */\n    narray = 0;  /* next pixel in output array to be filled */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* reading naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffgclk(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval,\n          &array[narray], &cdummy, anynul, status) > 0)\n          return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsvk(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           int  nulval,    /* I - value to set undefined pixels             */\n           int  *array,    /* O - array to be filled and returned           */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dir[9];\n    long nelem, nultyp, ninc, numcol;\n    LONGLONG felem, dsize[10], blcll[9], trcll[9];\n    int hdutype, anyf;\n    char ldummy, msg[FLEN_ERRMSG];\n    int nullcheck = 1;\n    int nullvalue;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvj is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TINT, blcll, trcll, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 1;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n        dir[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        if (hdutype == IMAGE_HDU)\n        {\n           dir[ii] = -1;\n        }\n        else\n        {\n          snprintf(msg, FLEN_ERRMSG,\"ffgsvk: illegal range specified for axis %ld\", ii + 1);\n          ffpmsg(msg);\n          return(*status = BAD_PIX_NUM);\n        }\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n      dsize[ii] = dsize[ii] * dir[ii];\n    }\n    dsize[naxis] = dsize[naxis] * dir[naxis];\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0]*dir[0] - str[0]*dir[0]) / inc[0] + 1;\n      ninc = incr[0] * dir[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]*dir[8]; i8 <= stp[8]*dir[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]*dir[7]; i7 <= stp[7]*dir[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]*dir[6]; i6 <= stp[6]*dir[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]*dir[5]; i5 <= stp[5]*dir[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]*dir[4]; i4 <= stp[4]*dir[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]*dir[3]; i3 <= stp[3]*dir[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]*dir[2]; i2 <= stp[2]*dir[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]*dir[1]; i1 <= stp[1]*dir[1]; i1 += incr[1])\n            {\n\n              felem=str[0] + (i1 - dir[1]) * dsize[1] + (i2 - dir[2]) * dsize[2] + \n                             (i3 - dir[3]) * dsize[3] + (i4 - dir[4]) * dsize[4] +\n                             (i5 - dir[5]) * dsize[5] + (i6 - dir[6]) * dsize[6] +\n                             (i7 - dir[7]) * dsize[7] + (i8 - dir[8]) * dsize[8];\n\n              if ( ffgclk(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &ldummy, &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsfk(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           int  *array,    /* O - array to be filled and returned           */\n           char *flagval,  /* O - set to 1 if corresponding value is null   */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dsize[10];\n    LONGLONG blcll[9], trcll[9];\n    long felem, nelem, nultyp, ninc, numcol;\n    long nulval = 0;\n    int hdutype, anyf;\n    char msg[FLEN_ERRMSG];\n    int nullcheck = 2;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvj is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        fits_read_compressed_img(fptr, TINT, blcll, trcll, inc,\n            nullcheck, NULL, array, flagval, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 2;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        snprintf(msg, FLEN_ERRMSG,\"ffgsvj: illegal range specified for axis %ld\", ii + 1);\n        ffpmsg(msg);\n        return(*status = BAD_PIX_NUM);\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n    }\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0] - str[0]) / inc[0] + 1;\n      ninc = incr[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1])\n            {\n              felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + \n                             (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] +\n                             (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] +\n                             (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8];\n\n              if ( ffgclk(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &flagval[i0], &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffggpk( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            long  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            long  nelem,      /* I - number of values to read                */\n            int  *array,     /* O - array of values that are returned       */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of group parameters from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n*/\n{\n    long row;\n    int idummy;\n    char cdummy;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgclk(fptr, 1, row, firstelem, nelem, 1, 1, 0L,\n               array, &cdummy, &idummy, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcvk(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           int   nulval,     /* I - value for null pixels                   */\n           int  *array,      /* O - array of values that are read           */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Any undefined pixels will be set equal to the value of 'nulval' unless\n  nulval = 0 in which case no checks for undefined pixels will be made.\n*/\n{\n    char cdummy;\n\n    ffgclk(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval,\n           array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcfk(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           int   *array,     /* O - array of values that are read           */\n           char *nularray,   /* O - array of flags: 1 if null pixel; else 0 */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Nularray will be set = 1 if the corresponding array pixel is undefined, \n  otherwise nularray will = 0.\n*/\n{\n    int dummy = 0;\n\n    ffgclk(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy,\n           array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgclk( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            long  elemincre,  /* I - pixel increment; e.g., 2 = every other  */\n            int   nultyp,     /* I - null value handling code:               */\n                              /*     1: set undefined pixels = nulval        */\n                              /*     2: set nularray=1 for undefined pixels  */\n            int   nulval,     /* I - value for null pixels if nultyp = 1     */\n            int  *array,      /* O - array of values that are read           */\n            char *nularray,   /* O - array of flags = 1 if nultyp = 2        */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer be a virtual column in a 1 or more grouped FITS primary\n  array or image extension.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The output array of values will be converted from the datatype of the column \n  and will be scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    double scale, zero, power, dtemp;\n    int tcode, maxelem2, hdutype, xcode, decimals;\n    long twidth, incre;\n    long ii, xwidth, ntodo;\n    int convert, nulcheck, readcheck = 0;\n    LONGLONG repeat, startpos, elemnum, readptr, tnull;\n    LONGLONG rowlen, rownum, remain, next, rowincre, maxelem;\n    char tform[20];\n    char message[FLEN_ERRMSG];\n    char snull[20];   /*  the FITS null value if reading from ASCII table  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0 || nelem == 0)  /* inherit input status value if > 0 */\n        return(*status);\n\n    /* call the 'short' or 'long' version of this routine, if possible */\n    if (sizeof(int) == sizeof(short))\n        ffgcli(fptr, colnum, firstrow, firstelem, nelem, elemincre, nultyp,\n              (short) nulval, (short *) array, nularray, anynul, status);\n    else if (sizeof(int) == sizeof(long))\n        ffgclj(fptr, colnum, firstrow, firstelem, nelem, elemincre, nultyp,\n              (long) nulval, (long *) array, nularray, anynul, status);\n    else\n    {\n    /*\n      This is a special case: sizeof(int) is not equal to sizeof(short) or\n      sizeof(long).  This occurs on Alpha OSF systems where short = 2 bytes,\n      int = 4 bytes, and long = 8 bytes.\n    */\n\n    buffer = cbuff;\n    power = 1.;\n\n    if (anynul)\n        *anynul = 0;\n\n    if (nultyp == 2)\n        memset(nularray, 0, (size_t) nelem);   /* initialize nullarray */\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (elemincre < 0)\n        readcheck = -1;  /* don't do range checking in this case */\n\n    if ( ffgcprll( fptr, colnum, firstrow, firstelem, nelem, readcheck, &scale, &zero,\n         tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre,\n         &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 )\n         return(*status);\n    maxelem = maxelem2;\n\n    incre *= elemincre;   /* multiply incre to just get every nth pixel */\n\n    if (tcode == TSTRING)    /* setup for ASCII tables */\n    {\n      /* get the number of implied decimal places if no explicit decmal point */\n      ffasfm(tform, &xcode, &xwidth, &decimals, status); \n      for(ii = 0; ii < decimals; ii++)\n        power *= 10.;\n    }\n    /*------------------------------------------------------------------*/\n    /*  Decide whether to check for null values in the input FITS file: */\n    /*------------------------------------------------------------------*/\n    nulcheck = nultyp; /* by default check for null values in the FITS file */\n\n    if (nultyp == 1 && nulval == 0)\n       nulcheck = 0;    /* calling routine does not want to check for nulls */\n\n    else if (tcode%10 == 1 &&        /* if reading an integer column, and  */ \n            tnull == NULL_UNDEFINED) /* if a null value is not defined,    */\n            nulcheck = 0;            /* then do not check for null values. */\n\n    else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TBYTE && (tnull > 255 || tnull < 0) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED)\n         nulcheck = 0;\n\n    /*----------------------------------------------------------------------*/\n    /*  If FITS column and output data array have same datatype, then we do */\n    /*  not need to use a temporary buffer to store intermediate datatype.  */\n    /*----------------------------------------------------------------------*/\n    convert = 1;\n    if (tcode == TLONG)           /* Special Case:                        */\n    {                             /* no type convertion required, so read */\n                                  /* data directly into output buffer.    */\n\n        if (nelem < (LONGLONG)INT32_MAX/4) {\n            maxelem = nelem;\n        } else {\n            maxelem = INT32_MAX/4;\n        }\n\n        if (nulcheck == 0 && scale == 1. && zero == 0.)\n            convert = 0;  /* no need to scale data or find nulls */\n    }\n\n    /*---------------------------------------------------------------------*/\n    /*  Now read the pixels from the FITS column. If the column does not   */\n    /*  have the same datatype as the output array, then we have to read   */\n    /*  the raw values into a temporary buffer (of limited size).  In      */\n    /*  the case of a vector colum read only 1 vector of values at a time  */\n    /*  then skip to the next row if more values need to be read.          */\n    /*  After reading the raw values, then call the fffXXYY routine to (1) */\n    /*  test for undefined values, (2) convert the datatype if necessary,  */\n    /*  and (3) scale the values by the FITS TSCALn and TZEROn linear      */\n    /*  scaling parameters.                                                */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to read */\n    next = 0;                 /* next element in array to be read   */\n    rownum = 0;               /* row number, relative to firstrow   */\n\n    while (remain)\n    {\n        /* limit the number of pixels to read at one time to the number that\n           will fit in the buffer or to the number of pixels that remain in\n           the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);\n        if (elemincre >= 0)\n        {\n          ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1));\n        }\n        else\n        {\n          ntodo = (long) minvalue(ntodo, (elemnum/(-elemincre) +1));\n        }\n\n        readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre));\n\n        switch (tcode) \n        {\n            case (TLONG):\n                ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) &array[next],\n                       status);\n                if (convert)\n                    fffi4int((INT32BIT *) &array[next], ntodo, scale, zero, \n                             nulcheck, (INT32BIT) tnull, nulval,\n                             &nularray[next], anynul, &array[next], status);\n                break;\n            case (TLONGLONG):\n\n                ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status);\n                fffi8int( (LONGLONG *) buffer, ntodo, scale, zero, \n                           nulcheck, tnull, nulval, &nularray[next], \n                            anynul, &array[next], status);\n                break;\n            case (TBYTE):\n                ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer,\n                       status);\n                fffi1int((unsigned char *) buffer, ntodo, scale, zero, nulcheck,\n                     (unsigned char) tnull, nulval, &nularray[next], anynul, \n                     &array[next], status);\n                break;\n            case (TSHORT):\n                ffgi2b(fptr, readptr, ntodo, incre, (short  *) buffer, status);\n                fffi2int((short  *) buffer, ntodo, scale, zero, nulcheck, \n                      (short) tnull, nulval, &nularray[next], anynul, \n                      &array[next], status);\n                break;\n            case (TFLOAT):\n                ffgr4b(fptr, readptr, ntodo, incre, (float  *) buffer, status);\n                fffr4int((float  *) buffer, ntodo, scale, zero, nulcheck, \n                       nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TDOUBLE):\n                ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status);\n                fffr8int((double *) buffer, ntodo, scale, zero, nulcheck, \n                          nulval, &nularray[next], anynul, \n                          &array[next], status);\n                break;\n            case (TSTRING):\n                ffmbyt(fptr, readptr, REPORT_EOF, status);\n       \n                if (incre == twidth)    /* contiguous bytes */\n                     ffgbyt(fptr, ntodo * twidth, buffer, status);\n                else\n                     ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                               status);\n\n                fffstrint((char *) buffer, ntodo, scale, zero, twidth, power,\n                     nulcheck, snull, nulval, &nularray[next], anynul,\n                     &array[next], status);\n                break;\n\n            default:  /*  error trap for invalid column format */\n                snprintf(message, FLEN_ERRMSG,\n                   \"Cannot read numbers from column %d which has format %s\",\n                    colnum, tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous read operation */\n        {\n\t  dtemp = (double) next;\n          if (hdutype > 0)\n            snprintf(message, FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgclk).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            snprintf(message, FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from image (ffgclk).\",\n              dtemp+1., dtemp+ntodo);\n\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum = elemnum + (ntodo * elemincre);\n\n            if (elemnum >= repeat)  /* completed a row; start on later row */\n            {\n                rowincre = elemnum / repeat;\n                rownum += rowincre;\n                elemnum = elemnum - (rowincre * repeat);\n            }\n            else if (elemnum < 0)  /* completed a row; start on a previous row */\n            {\n                rowincre = (-elemnum - 1) / repeat + 1;\n                rownum -= rowincre;\n                elemnum = (rowincre * repeat) + elemnum;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while reading FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    }  /* end of DEC Alpha special case */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi1int(unsigned char *input,/* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char tnull,  /* I - value of FITS TNULLn keyword if any */\n            int  nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            int  *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (int) input[ii];  /* copy input to output */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DINT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MIN;\n                }\n                else if (dvalue > DINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MAX;\n                }\n                else\n                    output[ii] = (int) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (int) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MIN;\n                    }\n                    else if (dvalue > DINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MAX;\n                    }\n                    else\n                        output[ii] = (int) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi2int(short *input,        /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short tnull,          /* I - value of FITS TNULLn keyword if any */\n            int  nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            int  *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (int) input[ii];   /* copy input to output */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DINT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MIN;\n                }\n                else if (dvalue > DINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MAX;\n                }\n                else\n                    output[ii] = (int) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (int) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MIN;\n                    }\n                    else if (dvalue > DINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MAX;\n                    }\n                    else\n                        output[ii] = (int) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi4int(INT32BIT *input,     /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            INT32BIT tnull,       /* I - value of FITS TNULLn keyword if any */\n            int  nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            int  *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (int) input[ii];   /* copy input to output */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DINT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MIN;\n                }\n                else if (dvalue > DINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MAX;\n                }\n                else\n                    output[ii] = (int) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (int) input[ii];\n\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MIN;\n                    }\n                    else if (dvalue > DINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MAX;\n                    }\n                    else\n                        output[ii] = (int) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi8int(LONGLONG *input,     /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            LONGLONG tnull,       /* I - value of FITS TNULLn keyword if any */\n            int  nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            int  *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    ULONGLONG ulltemp;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of adding 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                if (ulltemp > INT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MAX;\n                }\n                else\n\t\t{\n                    output[ii] = (int) ulltemp;\n\t\t}\n            }\n        }\n        else if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < INT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MIN;\n                }\n                else if (input[ii] > INT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MAX;\n                }\n                else\n                    output[ii] = (int) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DINT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MIN;\n                }\n                else if (dvalue > DINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MAX;\n                }\n                else\n                    output[ii] = (int) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of subtracting 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n\t\t{\n                    ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                    if (ulltemp > INT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MAX;\n                    }\n                    else\n\t\t    {\n                        output[ii] = (int) ulltemp;\n\t\t    }\n                }\n            }\n        }\n        else if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    if (input[ii] < INT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MIN;\n                    }\n                    else if (input[ii] > INT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MAX;\n                    }\n                    else\n                        output[ii] = (int) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MIN;\n                    }\n                    else if (dvalue > DINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MAX;\n                    }\n                    else\n                        output[ii] = (int) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr4int(float *input,        /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            int  nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            int  *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DINT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MIN;\n                }\n                else if (input[ii] > DINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MAX;\n                }\n                else\n                    output[ii] = (int) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DINT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MIN;\n                }\n                else if (dvalue > DINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MAX;\n                }\n                else\n                    output[ii] = (int) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr++;       /* point to MSBs */\n#endif\n\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MIN;\n                    }\n                    else if (input[ii] > DINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MAX;\n                    }\n                    else\n                        output[ii] = (int) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  { \n                    if (zero < DINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MIN;\n                    }\n                    else if (zero > DINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MAX;\n                    }\n                    else\n                      output[ii] = (int) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MIN;\n                    }\n                    else if (dvalue > DINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MAX;\n                    }\n                    else\n                        output[ii] = (int) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr8int(double *input,       /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            int  nullval,         /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            int  *output,         /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DINT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MIN;\n                }\n                else if (input[ii] > DINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MAX;\n                }\n                else\n                    output[ii] = (int) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DINT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MIN;\n                }\n                else if (dvalue > DINT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = INT_MAX;\n                }\n                else\n                    output[ii] = (int) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr += 3;       /* point to MSBs */\n#endif\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MIN;\n                    }\n                    else if (input[ii] > DINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MAX;\n                    }\n                    else\n                        output[ii] = (int) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  { \n                    if (zero < DINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MIN;\n                    }\n                    else if (zero > DINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MAX;\n                    }\n                    else\n                      output[ii] = (int) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DINT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MIN;\n                    }\n                    else if (dvalue > DINT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = INT_MAX;\n                    }\n                    else\n                        output[ii] = (int) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffstrint(char *input,        /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            long twidth,          /* I - width of each substring of chars    */\n            double implipower,    /* I - power of 10 of implied decimal      */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            char  *snull,         /* I - value of FITS null string, if any   */\n            int nullval,          /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            int *output,          /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file. Check\n  for null values and do scaling if required. The nullcheck code value\n  determines how any null values in the input array are treated. A null\n  value is an input pixel that is equal to snull.  If nullcheck= 0, then\n  no special checking for nulls is performed.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    int nullen;\n    long ii;\n    double dvalue;\n    char *cstring, message[FLEN_ERRMSG];\n    char *cptr, *tpos;\n    char tempstore, chrzero = '0';\n    double val, power;\n    int exponent, sign, esign, decpt;\n\n    nullen = strlen(snull);\n    cptr = input;  /* pointer to start of input string */\n    for (ii = 0; ii < ntodo; ii++)\n    {\n      cstring = cptr;\n      /* temporarily insert a null terminator at end of the string */\n      tpos = cptr + twidth;\n      tempstore = *tpos;\n      *tpos = 0;\n\n      /* check if null value is defined, and if the    */\n      /* column string is identical to the null string */\n      if (snull[0] != ASCII_NULL_UNDEFINED && \n         !strncmp(snull, cptr, nullen) )\n      {\n        if (nullcheck)  \n        {\n          *anynull = 1;    \n          if (nullcheck == 1)\n            output[ii] = nullval;\n          else\n            nullarray[ii] = 1;\n        }\n        cptr += twidth;\n      }\n      else\n      {\n        /* value is not the null value, so decode it */\n        /* remove any embedded blank characters from the string */\n\n        decpt = 0;\n        sign = 1;\n        val  = 0.;\n        power = 1.;\n        exponent = 0;\n        esign = 1;\n\n        while (*cptr == ' ')               /* skip leading blanks */\n           cptr++;\n\n        if (*cptr == '-' || *cptr == '+')  /* check for leading sign */\n        {\n          if (*cptr == '-')\n             sign = -1;\n\n          cptr++;\n\n          while (*cptr == ' ')         /* skip blanks between sign and value */\n            cptr++;\n        }\n\n        while (*cptr >= '0' && *cptr <= '9')\n        {\n          val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n          cptr++;\n\n          while (*cptr == ' ')         /* skip embedded blanks in the value */\n            cptr++;\n        }\n\n        if (*cptr == '.' || *cptr == ',')       /* check for decimal point */\n        {\n          decpt = 1;       /* set flag to show there was a decimal point */\n          cptr++;\n          while (*cptr == ' ')         /* skip any blanks */\n            cptr++;\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n            power = power * 10.;\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks in the value */\n              cptr++;\n          }\n        }\n\n        if (*cptr == 'E' || *cptr == 'D')  /* check for exponent */\n        {\n          cptr++;\n          while (*cptr == ' ')         /* skip blanks */\n              cptr++;\n  \n          if (*cptr == '-' || *cptr == '+')  /* check for exponent sign */\n          {\n            if (*cptr == '-')\n               esign = -1;\n\n            cptr++;\n\n            while (*cptr == ' ')        /* skip blanks between sign and exp */\n              cptr++;\n          }\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            exponent = exponent * 10 + *cptr - chrzero;  /* accumulate exp */\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks */\n              cptr++;\n          }\n        }\n\n        if (*cptr  != 0)  /* should end up at the null terminator */\n        {\n          snprintf(message, FLEN_ERRMSG,\"Cannot read number from ASCII table\");\n          ffpmsg(message);\n          snprintf(message, FLEN_ERRMSG,\"Column field = %s.\", cstring);\n          ffpmsg(message);\n          /* restore the char that was overwritten by the null */\n          *tpos = tempstore;\n          return(*status = BAD_C2D);\n        }\n\n        if (!decpt)  /* if no explicit decimal, use implied */\n           power = implipower;\n\n        dvalue = (sign * val / power) * pow(10., (double) (esign * exponent));\n\n        dvalue = dvalue * scale + zero;   /* apply the scaling */\n\n        if (dvalue < DINT_MIN)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = INT_MIN;\n        }\n        else if (dvalue > DINT_MAX)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = INT_MAX;\n        }\n        else\n            output[ii] = (long) dvalue;\n      }\n      /* restore the char that was overwritten by the null */\n      *tpos = tempstore;\n    }\n    return(*status);\n}\n"},{"col":4,"comment":"\n        Plot gridlines for both coordinates.\n\n        Standard matplotlib appearance options (color, alpha, etc.) can be\n        passed as keyword arguments. This behaves like `matplotlib.axes.Axes`\n        except that if no arguments are specified, the grid is shown rather\n        than toggled.\n\n        Parameters\n        ----------\n        b : bool\n            Whether to show the gridlines.\n        axis : 'both', 'x', 'y'\n            Which axis to turn the gridlines on/off for.\n        which : str\n            Currently only ``'major'`` is supported.\n        ","endLoc":670,"header":"def grid(self, b=None, axis='both', *, which='major', **kwargs)","id":16706,"name":"grid","nodeType":"Function","startLoc":637,"text":"def grid(self, b=None, axis='both', *, which='major', **kwargs):\n        \"\"\"\n        Plot gridlines for both coordinates.\n\n        Standard matplotlib appearance options (color, alpha, etc.) can be\n        passed as keyword arguments. This behaves like `matplotlib.axes.Axes`\n        except that if no arguments are specified, the grid is shown rather\n        than toggled.\n\n        Parameters\n        ----------\n        b : bool\n            Whether to show the gridlines.\n        axis : 'both', 'x', 'y'\n            Which axis to turn the gridlines on/off for.\n        which : str\n            Currently only ``'major'`` is supported.\n        \"\"\"\n\n        if not hasattr(self, 'coords'):\n            return\n\n        if which != 'major':\n            raise NotImplementedError('Plotting the grid for the minor ticks is '\n                                      'not supported.')\n\n        if axis == 'both':\n            self.coords.grid(draw_grid=b, **kwargs)\n        elif axis == 'x':\n            self.coords[0].grid(draw_grid=b, **kwargs)\n        elif axis == 'y':\n            self.coords[1].grid(draw_grid=b, **kwargs)\n        else:\n            raise ValueError('axis should be one of x/y/both')"},{"id":16707,"name":"region.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <ctype.h>\n#include \"fitsio2.h\"\n#include \"region.h\"\nstatic int Pt_in_Poly( double x, double y, int nPts, double *Pts );\n\n/*---------------------------------------------------------------------------*/\nint fits_read_rgnfile( const char *filename,\n            WCSdata    *wcs,\n            SAORegion  **Rgn,\n            int        *status )\n/*  Read regions from either a FITS or ASCII region file and return the information     */\n/*  in the \"SAORegion\" structure.  If it is nonNULL, use wcs to convert the  */\n/*  region coordinates to pixels.  Return an error if region is in degrees   */\n/*  but no WCS data is provided.                                             */\n/*---------------------------------------------------------------------------*/\n{\n  fitsfile *fptr;\n  int tstatus = 0;\n\n  if( *status ) return( *status );\n\n  /* try to open as a FITS file - if that doesn't work treat as an ASCII file */\n\n  fits_write_errmark();\n  if ( ffopen(&fptr, filename, READONLY, &tstatus) ) {\n    fits_clear_errmark();\n    fits_read_ascii_region(filename, wcs, Rgn, status);\n  } else {\n    fits_read_fits_region(fptr, wcs, Rgn, status);\n  }\n\n  return(*status);\n\n}\n/*---------------------------------------------------------------------------*/\nint fits_read_ascii_region( const char *filename,\n\t\t\t    WCSdata    *wcs,\n\t\t\t    SAORegion  **Rgn,\n\t\t\t    int        *status )\n/*  Read regions from a SAO-style region file and return the information     */\n/*  in the \"SAORegion\" structure.  If it is nonNULL, use wcs to convert the  */\n/*  region coordinates to pixels.  Return an error if region is in degrees   */\n/*  but no WCS data is provided.                                             */\n/*---------------------------------------------------------------------------*/\n{\n   char     *currLine;\n   char     *namePtr, *paramPtr, *currLoc;\n   char     *pX, *pY, *endp;\n   long     allocLen, lineLen, hh, mm, dd;\n   double   *coords, X, Y, x, y, ss, div, xsave= 0., ysave= 0.;\n   int      nParams, nCoords, negdec;\n   int      i, done;\n   FILE     *rgnFile;\n   coordFmt cFmt;\n   SAORegion *aRgn;\n   RgnShape *newShape, *tmpShape;\n\n   if( *status ) return( *status );\n\n   aRgn = (SAORegion *)malloc( sizeof(SAORegion) );\n   if( ! aRgn ) {\n      ffpmsg(\"Couldn't allocate memory to hold Region file contents.\");\n      return(*status = MEMORY_ALLOCATION );\n   }\n   aRgn->nShapes    =    0;\n   aRgn->Shapes     = NULL;\n   if( wcs && wcs->exists )\n      aRgn->wcs = *wcs;\n   else\n      aRgn->wcs.exists = 0;\n\n   cFmt = pixel_fmt; /* set default format */\n\n   /*  Allocate Line Buffer  */\n\n   allocLen = 512;\n   currLine = (char *)malloc( allocLen * sizeof(char) );\n   if( !currLine ) {\n      free( aRgn );\n      ffpmsg(\"Couldn't allocate memory to hold Region file contents.\");\n      return(*status = MEMORY_ALLOCATION );\n   }\n\n   /*  Open Region File  */\n\n   if( (rgnFile = fopen( filename, \"r\" ))==NULL ) {\n      snprintf(currLine,allocLen,\"Could not open Region file %s.\",filename);\n      ffpmsg( currLine );\n      free( currLine );\n      free( aRgn );\n      return( *status = FILE_NOT_OPENED );\n   }\n   \n   /*  Read in file, line by line  */\n   /*  First, set error status in case file is empty */ \n   *status = FILE_NOT_OPENED;\n\n   while( fgets(currLine,allocLen,rgnFile) != NULL ) {\n\n      /* reset status if we got here */\n      *status = 0;\n\n      /*  Make sure we have a full line of text  */\n\n      lineLen = strlen(currLine);\n      while( lineLen==allocLen-1 && currLine[lineLen-1]!='\\n' ) {\n         currLoc = (char *)realloc( currLine, 2 * allocLen * sizeof(char) );\n         if( !currLoc ) {\n            ffpmsg(\"Couldn't allocate memory to hold Region file contents.\");\n            *status = MEMORY_ALLOCATION;\n            goto error;\n         } else {\n            currLine = currLoc;\n         }\n         fgets( currLine+lineLen, allocLen+1, rgnFile );\n         allocLen += allocLen;\n         lineLen  += strlen(currLine+lineLen);\n      }\n\n      currLoc = currLine;\n      if( *currLoc == '#' ) {\n\n         /*  Look to see if it is followed by a format statement...  */\n         /*  if not skip line                                        */\n\n         currLoc++;\n         while( isspace(*currLoc) ) currLoc++;\n         if( !fits_strncasecmp( currLoc, \"format:\", 7 ) ) {\n            if( aRgn->nShapes ) {\n               ffpmsg(\"Format code encountered after reading 1 or more shapes.\");\n               *status = PARSE_SYNTAX_ERR;\n               goto error;\n            }\n            currLoc += 7;\n            while( isspace(*currLoc) ) currLoc++;\n            if( !fits_strncasecmp( currLoc, \"pixel\", 5 ) ) {\n               cFmt = pixel_fmt;\n            } else if( !fits_strncasecmp( currLoc, \"degree\", 6 ) ) {\n               cFmt = degree_fmt;\n            } else if( !fits_strncasecmp( currLoc, \"hhmmss\", 6 ) ) {\n               cFmt = hhmmss_fmt;\n            } else if( !fits_strncasecmp( currLoc, \"hms\", 3 ) ) {\n               cFmt = hhmmss_fmt;\n            } else {\n               ffpmsg(\"Unknown format code encountered in region file.\");\n               *status = PARSE_SYNTAX_ERR;\n               goto error;\n            }\n         }\n\n      } else if( !fits_strncasecmp( currLoc, \"glob\", 4 ) ) {\n\t\t  /* skip lines that begin with the word 'global' */\n\n      } else {\n\n         while( *currLoc != '\\0' ) {\n\n            namePtr  = currLoc;\n            paramPtr = NULL;\n            nParams  = 1;\n\n            /*  Search for closing parenthesis  */\n\n            done = 0;\n            while( !done && !*status && *currLoc ) {\n               switch (*currLoc) {\n               case '(':\n                  *currLoc = '\\0';\n                  currLoc++;\n                  if( paramPtr )   /* Can't have two '(' in a region! */\n                     *status = 1;\n                  else\n                     paramPtr = currLoc;\n                  break;\n               case ')':\n                  *currLoc = '\\0';\n                  currLoc++;\n                  if( !paramPtr )  /* Can't have a ')' without a '(' first */\n                     *status = 1;\n                  else\n                     done = 1;\n                  break;\n               case '#':\n               case '\\n':\n                  *currLoc = '\\0';\n                  if( !paramPtr )  /* Allow for a blank line */\n                     done = 1;\n                  break;\n               case ':':  \n                  currLoc++;\n                  if ( paramPtr ) cFmt = hhmmss_fmt; /* set format if parameter has : */\n                  break;\n               case 'd':\n                  currLoc++;\n                  if ( paramPtr ) cFmt = degree_fmt; /* set format if parameter has d */  \n                  break;\n               case ',':\n                  nParams++;  /* Fall through to default */\n               default:\n                  currLoc++;\n                  break;\n               }\n            }\n            if( *status || !done ) {\n               ffpmsg( \"Error reading Region file\" );\n               *status = PARSE_SYNTAX_ERR;\n               goto error;\n            }\n\n            /*  Skip white space in region name  */\n\n            while( isspace(*namePtr) ) namePtr++;\n\n            /*  Was this a blank line? Or the end of the current one  */\n\n            if( ! *namePtr && ! paramPtr ) continue;\n\n            /*  Check for format code at beginning of the line */\n\n            if( !fits_strncasecmp( namePtr, \"image;\", 6 ) ) {\n\t\t\t\tnamePtr += 6;\n\t\t\t\tcFmt = pixel_fmt;\n            } else if( !fits_strncasecmp( namePtr, \"physical;\", 9 ) ) {\n                                namePtr += 9;\n                                cFmt = pixel_fmt;\n            } else if( !fits_strncasecmp( namePtr, \"linear;\", 7 ) ) {\n                                namePtr += 7;\n                                cFmt = pixel_fmt;\n            } else if( !fits_strncasecmp( namePtr, \"fk4;\", 4 ) ) {\n\t\t\t\tnamePtr += 4;\n\t\t\t\tcFmt = degree_fmt;\n            } else if( !fits_strncasecmp( namePtr, \"fk5;\", 4 ) ) {\n\t\t\t\tnamePtr += 4;\n\t\t\t\tcFmt = degree_fmt;\n            } else if( !fits_strncasecmp( namePtr, \"icrs;\", 5 ) ) {\n\t\t\t\tnamePtr += 5;\n\t\t\t\tcFmt = degree_fmt;\n\n            /* the following 5 cases support region files created by POW \n\t       (or ds9 Version 4.x) which\n               may have lines containing  only a format code, not followed\n               by a ';' (and with no region specifier on the line).  We use\n               the 'continue' statement to jump to the end of the loop and\n               then continue reading the next line of the region file. */\n\n            } else if( !fits_strncasecmp( namePtr, \"fk5\", 3 ) ) {\n\t\t\t\tcFmt = degree_fmt;\n                                continue;  /* supports POW region file format */\n            } else if( !fits_strncasecmp( namePtr, \"fk4\", 3 ) ) {\n\t\t\t\tcFmt = degree_fmt;\n                                continue;  /* supports POW region file format */\n            } else if( !fits_strncasecmp( namePtr, \"icrs\", 4 ) ) {\n\t\t\t\tcFmt = degree_fmt;\n                                continue;  /* supports POW region file format */\n            } else if( !fits_strncasecmp( namePtr, \"image\", 5 ) ) {\n\t\t\t\tcFmt = pixel_fmt;\n                                continue;  /* supports POW region file format */\n            } else if( !fits_strncasecmp( namePtr, \"physical\", 8 ) ) {\n\t\t\t\tcFmt = pixel_fmt;\n                                continue;  /* supports POW region file format */\n\n\n            } else if( !fits_strncasecmp( namePtr, \"galactic;\", 9 ) ) {\n               ffpmsg( \"Galactic region coordinates not supported\" );\n               ffpmsg( namePtr );\n               *status = PARSE_SYNTAX_ERR;\n               goto error;\n            } else if( !fits_strncasecmp( namePtr, \"ecliptic;\", 9 ) ) {\n               ffpmsg( \"ecliptic region coordinates not supported\" );\n               ffpmsg( namePtr );\n               *status = PARSE_SYNTAX_ERR;\n               goto error;\n            }\n\n            /**************************************************/\n            /*  We've apparently found a region... Set it up  */\n            /**************************************************/\n\n            if( !(aRgn->nShapes % 10) ) {\n               if( aRgn->Shapes )\n                  tmpShape = (RgnShape *)realloc( aRgn->Shapes,\n                                                  (10+aRgn->nShapes)\n                                                  * sizeof(RgnShape) );\n               else\n                  tmpShape = (RgnShape *) malloc( 10 * sizeof(RgnShape) );\n               if( tmpShape ) {\n                  aRgn->Shapes = tmpShape;\n               } else {\n                  ffpmsg( \"Failed to allocate memory for Region data\");\n                  *status = MEMORY_ALLOCATION;\n                  goto error;\n               }\n\n            }\n            newShape        = &aRgn->Shapes[aRgn->nShapes++];\n            newShape->sign  = 1;\n            newShape->shape = point_rgn;\n\t    for (i=0; i<8; i++) newShape->param.gen.p[i] = 0.0;\n\t    newShape->param.gen.a = 0.0;\n\t    newShape->param.gen.b = 0.0;\n\t    newShape->param.gen.sinT = 0.0;\n\t    newShape->param.gen.cosT = 0.0;\n\n            while( isspace(*namePtr) ) namePtr++;\n            \n\t\t\t/*  Check for the shape's sign  */\n\n            if( *namePtr=='+' ) {\n               namePtr++;\n            } else if( *namePtr=='-' ) {\n               namePtr++;\n               newShape->sign = 0;\n            }\n\n            /* Skip white space in region name */\n\n            while( isspace(*namePtr) ) namePtr++;\n            if( *namePtr=='\\0' ) {\n               ffpmsg( \"Error reading Region file\" );\n               *status = PARSE_SYNTAX_ERR;\n               goto error;\n            }\n            lineLen = strlen( namePtr ) - 1;\n            while( isspace(namePtr[lineLen]) ) namePtr[lineLen--] = '\\0';\n\n            /*  Now identify the region  */\n\n            if(        !fits_strcasecmp( namePtr, \"circle\"  ) ) {\n               newShape->shape = circle_rgn;\n               if( nParams != 3 )\n                  *status = PARSE_SYNTAX_ERR;\n               nCoords = 2;\n            } else if( !fits_strcasecmp( namePtr, \"annulus\" ) ) {\n               newShape->shape = annulus_rgn;\n               if( nParams != 4 )\n                  *status = PARSE_SYNTAX_ERR;\n               nCoords = 2;\n            } else if( !fits_strcasecmp( namePtr, \"ellipse\" ) ) {\n               if( nParams < 4 || nParams > 8 ) {\n                  *status = PARSE_SYNTAX_ERR;\n\t       } else if ( nParams < 6 ) {\n\t\t newShape->shape = ellipse_rgn;\n\t\t newShape->param.gen.p[4] = 0.0;\n\t       } else {\n\t\t newShape->shape = elliptannulus_rgn;\n\t\t newShape->param.gen.p[6] = 0.0;\n\t\t newShape->param.gen.p[7] = 0.0;\n\t       }\n               nCoords = 2;\n            } else if( !fits_strcasecmp( namePtr, \"elliptannulus\" ) ) {\n               newShape->shape = elliptannulus_rgn;\n               if( !( nParams==8 || nParams==6 ) )\n                  *status = PARSE_SYNTAX_ERR;\n               newShape->param.gen.p[6] = 0.0;\n               newShape->param.gen.p[7] = 0.0;\n               nCoords = 2;\n            } else if( !fits_strcasecmp( namePtr, \"box\"    ) \n                    || !fits_strcasecmp( namePtr, \"rotbox\" ) ) {\n\t       if( nParams < 4 || nParams > 8 ) {\n\t\t *status = PARSE_SYNTAX_ERR;\n\t       } else if ( nParams < 6 ) {\n\t\t newShape->shape = box_rgn;\n\t\t newShape->param.gen.p[4] = 0.0;\n\t       } else {\n\t\t  newShape->shape = boxannulus_rgn;\n\t\t  newShape->param.gen.p[6] = 0.0;\n\t\t  newShape->param.gen.p[7] = 0.0;\n\t       }\n\t       nCoords = 2;\n            } else if( !fits_strcasecmp( namePtr, \"rectangle\"    )\n                    || !fits_strcasecmp( namePtr, \"rotrectangle\" ) ) {\n               newShape->shape = rectangle_rgn;\n               if( nParams < 4 || nParams > 5 )\n                  *status = PARSE_SYNTAX_ERR;\n               newShape->param.gen.p[4] = 0.0;\n               nCoords = 4;\n            } else if( !fits_strcasecmp( namePtr, \"diamond\"    )\n                    || !fits_strcasecmp( namePtr, \"rotdiamond\" )\n                    || !fits_strcasecmp( namePtr, \"rhombus\"    )\n                    || !fits_strcasecmp( namePtr, \"rotrhombus\" ) ) {\n               newShape->shape = diamond_rgn;\n               if( nParams < 4 || nParams > 5 )\n                  *status = PARSE_SYNTAX_ERR;\n               newShape->param.gen.p[4] = 0.0;\n               nCoords = 2;\n            } else if( !fits_strcasecmp( namePtr, \"sector\"  )\n                    || !fits_strcasecmp( namePtr, \"pie\"     ) ) {\n               newShape->shape = sector_rgn;\n               if( nParams != 4 )\n                  *status = PARSE_SYNTAX_ERR;\n               nCoords = 2;\n            } else if( !fits_strcasecmp( namePtr, \"point\"   ) ) {\n               newShape->shape = point_rgn;\n               if( nParams != 2 )\n                  *status = PARSE_SYNTAX_ERR;\n               nCoords = 2;\n            } else if( !fits_strcasecmp( namePtr, \"line\"    ) ) {\n               newShape->shape = line_rgn;\n               if( nParams != 4 )\n                  *status = PARSE_SYNTAX_ERR;\n               nCoords = 4;\n            } else if( !fits_strcasecmp( namePtr, \"polygon\" ) ) {\n               newShape->shape = poly_rgn;\n               if( nParams < 6 || (nParams&1) )\n                  *status = PARSE_SYNTAX_ERR;\n               nCoords = nParams;\n            } else if( !fits_strcasecmp( namePtr, \"panda\" ) ) {\n               newShape->shape = panda_rgn;\n               if( nParams != 8 )\n                  *status = PARSE_SYNTAX_ERR;\n               nCoords = 2;\n            } else if( !fits_strcasecmp( namePtr, \"epanda\" ) ) {\n               newShape->shape = epanda_rgn;\n               if( nParams < 10 || nParams > 11 )\n                  *status = PARSE_SYNTAX_ERR;\n               newShape->param.gen.p[10] = 0.0;\n               nCoords = 2;\n            } else if( !fits_strcasecmp( namePtr, \"bpanda\" ) ) {\n               newShape->shape = bpanda_rgn;\n               if( nParams < 10 || nParams > 11 )\n                  *status = PARSE_SYNTAX_ERR;\n               newShape->param.gen.p[10] = 0.0;\n               nCoords = 2;\n            } else {\n               ffpmsg( \"Unrecognized region found in region file:\" );\n               ffpmsg( namePtr );\n               *status = PARSE_SYNTAX_ERR;\n               goto error;\n            }\n            if( *status ) {\n               ffpmsg( \"Wrong number of parameters found for region\" );\n               ffpmsg( namePtr );\n               goto error;\n            }\n\n            /*  Parse Parameter string... convert to pixels if necessary  */\n\n            if( newShape->shape==poly_rgn ) {\n               newShape->param.poly.Pts = (double *)malloc( nParams\n                                                            * sizeof(double) );\n               if( !newShape->param.poly.Pts ) {\n                  ffpmsg(\n                      \"Could not allocate memory to hold polygon parameters\" );\n                  *status = MEMORY_ALLOCATION;\n                  goto error;\n               }\n               newShape->param.poly.nPts = nParams;\n               coords = newShape->param.poly.Pts;\n            } else\n               coords = newShape->param.gen.p;\n\n            /*  Parse the initial \"WCS?\" coordinates  */\n            for( i=0; i<nCoords; i+=2 ) {\n\n               pX = paramPtr;\n               while( *paramPtr!=',' ) paramPtr++;\n               *(paramPtr++) = '\\0';\n\n               pY = paramPtr;\n               while( *paramPtr!=',' && *paramPtr != '\\0' ) paramPtr++;\n               *(paramPtr++) = '\\0';\n\n               if( strchr(pX, ':' ) ) {\n                  /*  Read in special format & convert to decimal degrees  */\n                  cFmt = hhmmss_fmt;\n                  mm = 0;\n                  ss = 0.;\n                  hh = strtol(pX, &endp, 10);\n                  if (endp && *endp==':') {\n                      pX = endp + 1;\n                      mm = strtol(pX, &endp, 10);\n                      if (endp && *endp==':') {\n                          pX = endp + 1;\n                          ss = atof( pX );\n                      }\n                  }\n                  X = 15. * (hh + mm/60. + ss/3600.); /* convert to degrees */\n\n                  mm = 0;\n                  ss = 0.;\n                  negdec = 0;\n\n                  while( isspace(*pY) ) pY++;\n                  if (*pY=='-') {\n                      negdec = 1;\n                      pY++;\n                  }\n                  dd = strtol(pY, &endp, 10);\n                  if (endp && *endp==':') {\n                      pY = endp + 1;\n                      mm = strtol(pY, &endp, 10);\n                      if (endp && *endp==':') {\n                          pY = endp + 1;\n                          ss = atof( pY );\n                      }\n                  }\n                  if (negdec)\n                     Y = -dd - mm/60. - ss/3600.; /* convert to degrees */\n                  else\n                     Y = dd + mm/60. + ss/3600.;\n\n               } else {\n                  X = atof( pX );\n                  Y = atof( pY );\n               }\n               if (i==0) {   /* save 1st coord. in case needed later */\n                   xsave = X;\n                   ysave = Y;\n               }\n\n               if( cFmt!=pixel_fmt ) {\n                  /*  Convert to pixels  */\n                  if( wcs==NULL || ! wcs->exists ) {\n                     ffpmsg(\"WCS information needed to convert region coordinates.\");\n                     *status = NO_WCS_KEY;\n                     goto error;\n                  }\n                  \n                  if( ffxypx(  X,  Y, wcs->xrefval, wcs->yrefval,\n                                      wcs->xrefpix, wcs->yrefpix,\n                                      wcs->xinc,    wcs->yinc,\n                                      wcs->rot,     wcs->type,\n                              &x, &y, status ) ) {\n                     ffpmsg(\"Error converting region to pixel coordinates.\");\n                     goto error;\n                  }\n                  X = x; Y = y;\n               }\n               coords[i]   = X;\n               coords[i+1] = Y;\n\n            }\n\n            /*  Read in remaining parameters...  */\n\n            for( ; i<nParams; i++ ) {\n               pX = paramPtr;\n               while( *paramPtr!=',' && *paramPtr != '\\0' ) paramPtr++;\n               *(paramPtr++) = '\\0';\n               coords[i] = strtod( pX, &endp );\n\n\t       if (endp && (*endp=='\"' || *endp=='\\'' || *endp=='d') ) {\n\t\t  div = 1.0;\n\t\t  if ( *endp=='\"' ) div = 3600.0;\n\t\t  if ( *endp=='\\'' ) div = 60.0;\n\t\t  /* parameter given in arcsec so convert to pixels. */\n\t\t  /* Increment first Y coordinate by this amount then calc */\n\t\t  /* the distance in pixels from the original coordinate. */\n\t\t  /* NOTE: This assumes the pixels are square!! */\n\t\t  if (ysave < 0.)\n\t\t     Y = ysave + coords[i]/div;  /* don't exceed -90 */\n\t\t  else\n\t\t     Y = ysave - coords[i]/div;  /* don't exceed +90 */\n\n\t\t  X = xsave;\n\t\t  if( ffxypx(  X,  Y, wcs->xrefval, wcs->yrefval,\n\t\t\t       wcs->xrefpix, wcs->yrefpix,\n\t\t\t       wcs->xinc,    wcs->yinc,\n\t\t\t       wcs->rot,     wcs->type,\n                               &x, &y, status ) ) {\n\t\t     ffpmsg(\"Error converting region to pixel coordinates.\");\n\t\t     goto error;\n\t\t  }\n\t\t \n\t\t  coords[i] = sqrt( pow(x-coords[0],2) + pow(y-coords[1],2) );\n\n               }\n            }\n\n\t    /* special case for elliptannulus and boxannulus if only one angle\n\t       was given */\n\n\t    if ( (newShape->shape == elliptannulus_rgn || \n\t\t  newShape->shape == boxannulus_rgn ) && nParams == 7 ) {\n\t      coords[7] = coords[6];\n\t    }\n\n            /* Also, correct the position angle for any WCS rotation:  */\n            /*    If regions are specified in WCS coordintes, then the angles */\n            /*    are relative to the WCS system, not the pixel X,Y system */\n\n\t    if( cFmt!=pixel_fmt ) {\t    \n\t      switch( newShape->shape ) {\n\t      case sector_rgn:\n\t      case panda_rgn:\n\t\tcoords[2] += (wcs->rot);\n\t\tcoords[3] += (wcs->rot);\n\t\tbreak;\n\t      case box_rgn:\n\t      case rectangle_rgn:\n\t      case diamond_rgn:\n\t      case ellipse_rgn:\n\t\tcoords[4] += (wcs->rot);\n\t\tbreak;\n\t      case boxannulus_rgn:\n\t      case elliptannulus_rgn:\n\t\tcoords[6] += (wcs->rot);\n\t\tcoords[7] += (wcs->rot);\n\t\tbreak;\n\t      case epanda_rgn:\n\t      case bpanda_rgn:\n\t\tcoords[2] += (wcs->rot);\n\t\tcoords[3] += (wcs->rot);\n\t\tcoords[10] += (wcs->rot);\n              default:\n                break;\n\t      }\n\t    }\n\n\t    /* do some precalculations to speed up tests */\n\n\t    fits_setup_shape(newShape);\n\n         }  /* End of while( *currLoc ) */\n/*\n  if (coords)printf(\"%.8f %.8f %.8f %.8f %.8f\\n\",\n   coords[0],coords[1],coords[2],coords[3],coords[4]); \n*/\n      }  /* End of if...else parse line */\n   }   /* End of while( fgets(rgnFile) ) */\n\n   /* set up component numbers */\n\n   fits_set_region_components( aRgn );\n\nerror:\n\n   if( *status ) {\n      fits_free_region( aRgn );\n   } else {\n      *Rgn = aRgn;\n   }\n\n   fclose( rgnFile );\n   free( currLine );\n\n   return( *status );\n}\n\n/*---------------------------------------------------------------------------*/\nint fits_in_region( double    X,\n            double    Y,\n            SAORegion *Rgn )\n/*  Test if the given point is within the region described by Rgn.  X and    */\n/*  Y are in pixel coordinates.                                              */\n/*---------------------------------------------------------------------------*/\n{\n   double x, y, dx, dy, xprime, yprime, r, th;\n   RgnShape *Shapes;\n   int i, cur_comp;\n   int result, comp_result;\n\n   Shapes = Rgn->Shapes;\n\n   result = 0;\n   comp_result = 0;\n   cur_comp = Rgn->Shapes[0].comp;\n\n   for( i=0; i<Rgn->nShapes; i++, Shapes++ ) {\n\n     /* if this region has a different component number to the last one  */\n     /*\tthen replace the accumulated selection logical with the union of */\n     /*\tthe current logical and the total logical. Reinitialize the      */\n     /* temporary logical.                                               */\n\n     if ( i==0 || Shapes->comp != cur_comp ) {\n       result = result || comp_result;\n       cur_comp = Shapes->comp;\n       /* if an excluded region is given first, then implicitly   */\n       /* assume a previous shape that includes the entire image. */\n       comp_result = !Shapes->sign;\n     }\n\n    /* only need to test if  */\n    /*   the point is not already included and this is an include region, */\n    /* or the point is included and this is an excluded region */\n\n    if ( (!comp_result && Shapes->sign) || (comp_result && !Shapes->sign) ) { \n\n      comp_result = 1;\n\n      switch( Shapes->shape ) {\n\n      case box_rgn:\n         /*  Shift origin to center of region  */\n         xprime = X - Shapes->param.gen.p[0];\n         yprime = Y - Shapes->param.gen.p[1];\n\n         /*  Rotate point to region's orientation  */\n         x =  xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT;\n         y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT;\n\n         dx = 0.5 * Shapes->param.gen.p[2];\n         dy = 0.5 * Shapes->param.gen.p[3];\n         if( (x < -dx) || (x > dx) || (y < -dy) || (y > dy) )\n            comp_result = 0;\n         break;\n\n      case boxannulus_rgn:\n         /*  Shift origin to center of region  */\n         xprime = X - Shapes->param.gen.p[0];\n         yprime = Y - Shapes->param.gen.p[1];\n\n         /*  Rotate point to region's orientation  */\n         x =  xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT;\n         y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT;\n\n         dx = 0.5 * Shapes->param.gen.p[4];\n         dy = 0.5 * Shapes->param.gen.p[5];\n         if( (x < -dx) || (x > dx) || (y < -dy) || (y > dy) ) {\n\t   comp_result = 0;\n\t } else {\n\t   /* Repeat test for inner box */\n\t   x =  xprime * Shapes->param.gen.b + yprime * Shapes->param.gen.a;\n\t   y = -xprime * Shapes->param.gen.a + yprime * Shapes->param.gen.b;\n\t   \n\t   dx = 0.5 * Shapes->param.gen.p[2];\n\t   dy = 0.5 * Shapes->param.gen.p[3];\n\t   if( (x >= -dx) && (x <= dx) && (y >= -dy) && (y <= dy) )\n\t     comp_result = 0;\n\t }\n         break;\n\n      case rectangle_rgn:\n         /*  Shift origin to center of region  */\n         xprime = X - Shapes->param.gen.p[5];\n         yprime = Y - Shapes->param.gen.p[6];\n\n         /*  Rotate point to region's orientation  */\n         x =  xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT;\n         y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT;\n\n         dx = Shapes->param.gen.a;\n         dy = Shapes->param.gen.b;\n         if( (x < -dx) || (x > dx) || (y < -dy) || (y > dy) )\n            comp_result = 0;\n         break;\n\n      case diamond_rgn:\n         /*  Shift origin to center of region  */\n         xprime = X - Shapes->param.gen.p[0];\n         yprime = Y - Shapes->param.gen.p[1];\n\n         /*  Rotate point to region's orientation  */\n         x =  xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT;\n         y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT;\n\n         dx = 0.5 * Shapes->param.gen.p[2];\n         dy = 0.5 * Shapes->param.gen.p[3];\n         r  = fabs(x/dx) + fabs(y/dy);\n         if( r > 1 )\n            comp_result = 0;\n         break;\n\n      case circle_rgn:\n         /*  Shift origin to center of region  */\n         x = X - Shapes->param.gen.p[0];\n         y = Y - Shapes->param.gen.p[1];\n\n         r  = x*x + y*y;\n         if ( r > Shapes->param.gen.a )\n            comp_result = 0;\n         break;\n\n      case annulus_rgn:\n         /*  Shift origin to center of region  */\n         x = X - Shapes->param.gen.p[0];\n         y = Y - Shapes->param.gen.p[1];\n\n         r = x*x + y*y;\n         if ( r < Shapes->param.gen.a || r > Shapes->param.gen.b )\n            comp_result = 0;\n         break;\n\n      case sector_rgn:\n         /*  Shift origin to center of region  */\n         x = X - Shapes->param.gen.p[0];\n         y = Y - Shapes->param.gen.p[1];\n\n         if( x || y ) {\n            r = atan2( y, x ) * RadToDeg;\n            if( Shapes->param.gen.p[2] <= Shapes->param.gen.p[3] ) {\n               if( r < Shapes->param.gen.p[2] || r > Shapes->param.gen.p[3] )\n                  comp_result = 0;\n            } else {\n               if( r < Shapes->param.gen.p[2] && r > Shapes->param.gen.p[3] )\n                  comp_result = 0;\n            }\n         }\n         break;\n\n      case ellipse_rgn:\n         /*  Shift origin to center of region  */\n         xprime = X - Shapes->param.gen.p[0];\n         yprime = Y - Shapes->param.gen.p[1];\n\n         /*  Rotate point to region's orientation  */\n         x =  xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT;\n         y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT;\n\n         x /= Shapes->param.gen.p[2];\n         y /= Shapes->param.gen.p[3];\n         r = x*x + y*y;\n         if( r>1.0 )\n            comp_result = 0;\n         break;\n\n      case elliptannulus_rgn:\n         /*  Shift origin to center of region  */\n         xprime = X - Shapes->param.gen.p[0];\n         yprime = Y - Shapes->param.gen.p[1];\n\n         /*  Rotate point to outer ellipse's orientation  */\n         x =  xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT;\n         y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT;\n\n         x /= Shapes->param.gen.p[4];\n         y /= Shapes->param.gen.p[5];\n         r = x*x + y*y;\n         if( r>1.0 )\n            comp_result = 0;\n         else {\n            /*  Repeat test for inner ellipse  */\n            x =  xprime * Shapes->param.gen.b + yprime * Shapes->param.gen.a;\n            y = -xprime * Shapes->param.gen.a + yprime * Shapes->param.gen.b;\n\n            x /= Shapes->param.gen.p[2];\n            y /= Shapes->param.gen.p[3];\n            r = x*x + y*y;\n            if( r<1.0 )\n               comp_result = 0;\n         }\n         break;\n\n      case line_rgn:\n         /*  Shift origin to first point of line  */\n         xprime = X - Shapes->param.gen.p[0];\n         yprime = Y - Shapes->param.gen.p[1];\n\n         /*  Rotate point to line's orientation  */\n         x =  xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT;\n         y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT;\n\n         if( (y < -0.5) || (y >= 0.5) || (x < -0.5)\n             || (x >= Shapes->param.gen.a) )\n            comp_result = 0;\n         break;\n\n      case point_rgn:\n         /*  Shift origin to center of region  */\n         x = X - Shapes->param.gen.p[0];\n         y = Y - Shapes->param.gen.p[1];\n\n         if ( (x<-0.5) || (x>=0.5) || (y<-0.5) || (y>=0.5) )\n            comp_result = 0;\n         break;\n\n      case poly_rgn:\n         if( X<Shapes->xmin || X>Shapes->xmax\n             || Y<Shapes->ymin || Y>Shapes->ymax )\n            comp_result = 0;\n         else\n            comp_result = Pt_in_Poly( X, Y, Shapes->param.poly.nPts,\n                                       Shapes->param.poly.Pts );\n         break;\n\n      case panda_rgn:\n         /*  Shift origin to center of region  */\n         x = X - Shapes->param.gen.p[0];\n         y = Y - Shapes->param.gen.p[1];\n\n         r = x*x + y*y;\n         if ( r < Shapes->param.gen.a || r > Shapes->param.gen.b ) {\n\t   comp_result = 0;\n\t } else {\n\t   if( x || y ) {\n\t     th = atan2( y, x ) * RadToDeg;\n\t     if( Shapes->param.gen.p[2] <= Shapes->param.gen.p[3] ) {\n               if( th < Shapes->param.gen.p[2] || th > Shapes->param.gen.p[3] )\n\t\t comp_result = 0;\n\t     } else {\n               if( th < Shapes->param.gen.p[2] && th > Shapes->param.gen.p[3] )\n\t\t comp_result = 0;\n\t     }\n\t   }\n         }\n         break;\n\n      case epanda_rgn:\n         /*  Shift origin to center of region  */\n         xprime = X - Shapes->param.gen.p[0];\n         yprime = Y - Shapes->param.gen.p[1];\n\n         /*  Rotate point to region's orientation  */\n         x =  xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT;\n         y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT;\n\t xprime = x;\n\t yprime = y;\n\n\t /* outer region test */\n         x = xprime/Shapes->param.gen.p[7];\n         y = yprime/Shapes->param.gen.p[8];\n         r = x*x + y*y;\n\t if ( r>1.0 )\n\t   comp_result = 0;\n\t else {\n\t   /* inner region test */\n\t   x = xprime/Shapes->param.gen.p[5];\n\t   y = yprime/Shapes->param.gen.p[6];\n\t   r = x*x + y*y;\n\t   if ( r<1.0 )\n\t     comp_result = 0;\n\t   else {\n\t     /* angle test */\n\t     if( xprime || yprime ) {\n\t       th = atan2( yprime, xprime ) * RadToDeg;\n\t       if( Shapes->param.gen.p[2] <= Shapes->param.gen.p[3] ) {\n\t\t if( th < Shapes->param.gen.p[2] || th > Shapes->param.gen.p[3] )\n\t\t   comp_result = 0;\n\t       } else {\n\t\t if( th < Shapes->param.gen.p[2] && th > Shapes->param.gen.p[3] )\n\t\t   comp_result = 0;\n\t       }\n\t     }\n\t   }\n\t }\n         break;\n\n      case bpanda_rgn:\n         /*  Shift origin to center of region  */\n         xprime = X - Shapes->param.gen.p[0];\n         yprime = Y - Shapes->param.gen.p[1];\n\n         /*  Rotate point to region's orientation  */\n         x =  xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT;\n         y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT;\n\n\t /* outer box test */\n         dx = 0.5 * Shapes->param.gen.p[7];\n         dy = 0.5 * Shapes->param.gen.p[8];\n         if( (x < -dx) || (x > dx) || (y < -dy) || (y > dy) )\n\t   comp_result = 0;\n\t else {\n\t   /* inner box test */\n\t   dx = 0.5 * Shapes->param.gen.p[5];\n\t   dy = 0.5 * Shapes->param.gen.p[6];\n\t   if( (x >= -dx) && (x <= dx) && (y >= -dy) && (y <= dy) )\n\t     comp_result = 0;\n\t   else {\n\t     /* angle test */\n\t     if( x || y ) {\n\t       th = atan2( y, x ) * RadToDeg;\n\t       if( Shapes->param.gen.p[2] <= Shapes->param.gen.p[3] ) {\n\t\t if( th < Shapes->param.gen.p[2] || th > Shapes->param.gen.p[3] )\n\t\t   comp_result = 0;\n\t       } else {\n\t\t if( th < Shapes->param.gen.p[2] && th > Shapes->param.gen.p[3] )\n\t\t   comp_result = 0;\n\t       }\n\t     }\n\t   }\n\t }\n         break;\n      }\n\n      if( !Shapes->sign ) comp_result = !comp_result;\n\n     } \n\n   }\n\n   result = result || comp_result;\n   \n   return( result );\n}\n\n/*---------------------------------------------------------------------------*/\nvoid fits_free_region( SAORegion *Rgn )\n/*   Free up memory allocated to hold the region data.                       \n   This is more complicated for the case of polygons, which may be sharing\n   points arrays due to shallow copying (in fits_set_region_components) of\n   'exluded' regions.  We must ensure that these arrays are only freed once.       \n\n/*---------------------------------------------------------------------------*/\n{\n   int i,j;\n   \n   int nFreedPoly=0;\n   int nPolyArraySize=10;\n   double **freedPolyPtrs=0;\n   double *ptsToFree=0;\n   int isAlreadyFreed=0;\n   \n   freedPolyPtrs = (double**)malloc(nPolyArraySize*sizeof(double*));\n\n   for( i=0; i<Rgn->nShapes; i++ )\n      if( Rgn->Shapes[i].shape == poly_rgn )\n      {\n         /* No shared arrays for 'include' polygons */\n         if (Rgn->Shapes[i].sign)\n            free(Rgn->Shapes[i].param.poly.Pts);\n         else\n         {\n            ptsToFree = Rgn->Shapes[i].param.poly.Pts;\n            isAlreadyFreed = 0;\n            for (j=0; j<nFreedPoly && !isAlreadyFreed; j++)\n            {\n               if (freedPolyPtrs[j] == ptsToFree)\n                  isAlreadyFreed = 1;\n            }\n            if (!isAlreadyFreed)\n            {\n               free(ptsToFree);\n               /* Now add pointer to array of freed points */\n               if (nFreedPoly == nPolyArraySize)\n               {\n                  nPolyArraySize *= 2;\n                  freedPolyPtrs = (double **)realloc(freedPolyPtrs, \n                          nPolyArraySize*sizeof(double*));\n               }\n               freedPolyPtrs[nFreedPoly] = ptsToFree;\n               ++nFreedPoly;\n            }\n         }\n      }\n   if( Rgn->Shapes )\n      free( Rgn->Shapes );\n   free( Rgn );\n   \n   free(freedPolyPtrs);\n}\n\n/*---------------------------------------------------------------------------*/\nstatic int Pt_in_Poly( double x,\n                       double y,\n                       int nPts,\n                       double *Pts )\n/*  Internal routine for testing whether the coordinate x,y is within the    */\n/*  polygon region traced out by the array Pts.                              */\n/*---------------------------------------------------------------------------*/\n{\n   int i, j, flag=0;\n   double prevX, prevY;\n   double nextX, nextY;\n   double dx, dy, Dy;\n\n   nextX = Pts[nPts-2];\n   nextY = Pts[nPts-1];\n\n   for( i=0; i<nPts; i+=2 ) {\n      prevX = nextX;\n      prevY = nextY;\n\n      nextX = Pts[i];\n      nextY = Pts[i+1];\n\n      if( (y>prevY && y>=nextY) || (y<prevY && y<=nextY)\n          || (x>prevX && x>=nextX) )\n         continue;\n      \n      /* Check to see if x,y lies right on the segment */\n\n      if( x>=prevX || x>nextX ) {\n         dy = y - prevY;\n         Dy = nextY - prevY;\n\n         if( fabs(Dy)<1e-10 ) {\n            if( fabs(dy)<1e-10 )\n               return( 1 );\n            else\n               continue;\n         }\n\n         dx = prevX + ( (nextX-prevX)/(Dy) ) * dy - x;\n         if( dx < -1e-10 )\n            continue;\n         if( dx <  1e-10 )\n            return( 1 );\n      }\n\n      /* There is an intersection! Make sure it isn't a V point.  */\n\n      if( y != prevY ) {\n         flag = 1 - flag;\n      } else {\n         j = i+1;  /* Point to Y component */\n         do {\n            if( j>1 )\n               j -= 2;\n            else\n               j = nPts-1;\n         } while( y == Pts[j] );\n\n         if( (nextY-y)*(y-Pts[j]) > 0 )\n            flag = 1-flag;\n      }\n\n   }\n   return( flag );\n}\n/*---------------------------------------------------------------------------*/\nvoid fits_set_region_components ( SAORegion *aRgn )\n{\n/* \n   Internal routine to turn a collection of regions read from an ascii file into\n   the more complex structure that is allowed by the FITS REGION extension with\n   multiple components. Regions are anded within components and ored between them\n   ie for a pixel to be selected it must be selected by at least one component\n   and to be selected by a component it must be selected by all that component's\n   shapes.\n\n   The algorithm is to replicate every exclude region after every include\n   region before it in the list. eg reg1, reg2, -reg3, reg4, -reg5 becomes\n   (reg1, -reg3, -reg5), (reg2, -reg5, -reg3), (reg4, -reg5) where the\n   parentheses designate components.\n*/\n\n  int i, j, k, icomp;\n\n/* loop round shapes */\n\n  i = 0;\n  while ( i<aRgn->nShapes ) {\n\n    /* first do the case of an exclude region */\n\n    if ( !aRgn->Shapes[i].sign ) {\n\n      /* we need to run back through the list copying the current shape as\n\t required. start by findin the first include shape before this exclude */\n\n      j = i-1;\n      while ( j > 0 && !aRgn->Shapes[j].sign ) j--;\n\n      /* then go back one more shape */\n\n      j--;\n\n      /* and loop back through the regions */\n\n      while ( j >= 0 ) {\n\n\t/* if this is an include region then insert a copy of the exclude\n\t   region immediately after it */\n           \n        /* Note that this makes shallow copies of a polygon's dynamically\n        allocated Pts array -- the memory is shared.  This must be checked\n        when freeing in fits_free_region. */\n\n\tif ( aRgn->Shapes[j].sign ) {\n\n\t  aRgn->Shapes = (RgnShape *) realloc (aRgn->Shapes,(1+aRgn->nShapes)*sizeof(RgnShape));\n\t  aRgn->nShapes++;\n\t  for (k=aRgn->nShapes-1; k>j+1; k--) aRgn->Shapes[k] = aRgn->Shapes[k-1];\n\n\t  i++;\n\t  aRgn->Shapes[j+1] = aRgn->Shapes[i];\n\n\t}\n\n\tj--;\n\n      }\n\n    }\n\n    i++;\n\n  }\n\n  /* now set the component numbers */\n\n  icomp = 0;\n  for ( i=0; i<aRgn->nShapes; i++ ) {\n    if ( aRgn->Shapes[i].sign ) icomp++;\n    aRgn->Shapes[i].comp = icomp;\n\n    /*\n    printf(\"i = %d, shape = %d, sign = %d, comp = %d\\n\", i, aRgn->Shapes[i].shape, aRgn->Shapes[i].sign, aRgn->Shapes[i].comp);\n    */\n\n  }\n\n  return;\n\n}\n\n/*---------------------------------------------------------------------------*/\nvoid fits_setup_shape ( RgnShape *newShape)\n{\n/* Perform some useful calculations now to speed up filter later             */\n\n  double X, Y, R;\n  double *coords;\n  int i;\n\n  if ( newShape->shape == poly_rgn ) {\n    coords = newShape->param.poly.Pts;\n  } else {\n    coords = newShape->param.gen.p;\n  }\n\n  switch( newShape->shape ) {\n  case circle_rgn:\n    newShape->param.gen.a = coords[2] * coords[2];\n    break;\n  case annulus_rgn:\n    newShape->param.gen.a = coords[2] * coords[2];\n    newShape->param.gen.b = coords[3] * coords[3];\n    break;\n  case sector_rgn:\n    while( coords[2]> 180.0 ) coords[2] -= 360.0;\n    while( coords[2]<=-180.0 ) coords[2] += 360.0;\n    while( coords[3]> 180.0 ) coords[3] -= 360.0;\n    while( coords[3]<=-180.0 ) coords[3] += 360.0;\n    break;\n  case ellipse_rgn:\n    newShape->param.gen.sinT = sin( myPI * (coords[4] / 180.0) );\n    newShape->param.gen.cosT = cos( myPI * (coords[4] / 180.0) );\n    break;\n  case elliptannulus_rgn:\n    newShape->param.gen.a    = sin( myPI * (coords[6] / 180.0) );\n    newShape->param.gen.b    = cos( myPI * (coords[6] / 180.0) );\n    newShape->param.gen.sinT = sin( myPI * (coords[7] / 180.0) );\n    newShape->param.gen.cosT = cos( myPI * (coords[7] / 180.0) );\n    break;\n  case box_rgn:\n    newShape->param.gen.sinT = sin( myPI * (coords[4] / 180.0) );\n    newShape->param.gen.cosT = cos( myPI * (coords[4] / 180.0) );\n    break;\n  case boxannulus_rgn:\n    newShape->param.gen.a    = sin( myPI * (coords[6] / 180.0) );\n    newShape->param.gen.b    = cos( myPI * (coords[6] / 180.0) );\n    newShape->param.gen.sinT = sin( myPI * (coords[7] / 180.0) );\n    newShape->param.gen.cosT = cos( myPI * (coords[7] / 180.0) );\n    break;\n  case rectangle_rgn:\n    newShape->param.gen.sinT = sin( myPI * (coords[4] / 180.0) );\n    newShape->param.gen.cosT = cos( myPI * (coords[4] / 180.0) );\n    X = 0.5 * ( coords[2]-coords[0] );\n    Y = 0.5 * ( coords[3]-coords[1] );\n    newShape->param.gen.a = fabs( X * newShape->param.gen.cosT\n\t\t\t\t  + Y * newShape->param.gen.sinT );\n    newShape->param.gen.b = fabs( Y * newShape->param.gen.cosT\n\t\t\t\t  - X * newShape->param.gen.sinT );\n    newShape->param.gen.p[5] = 0.5 * ( coords[2]+coords[0] );\n    newShape->param.gen.p[6] = 0.5 * ( coords[3]+coords[1] );\n    break;\n  case diamond_rgn:\n    newShape->param.gen.sinT = sin( myPI * (coords[4] / 180.0) );\n    newShape->param.gen.cosT = cos( myPI * (coords[4] / 180.0) );\n    break;\n  case line_rgn:\n    X = coords[2] - coords[0];\n    Y = coords[3] - coords[1];\n    R = sqrt( X*X + Y*Y );\n    newShape->param.gen.sinT = ( R ? Y/R : 0.0 );\n    newShape->param.gen.cosT = ( R ? X/R : 1.0 );\n    newShape->param.gen.a    = R + 0.5;\n    break;\n  case panda_rgn:\n    while( coords[2]> 180.0 ) coords[2] -= 360.0;\n    while( coords[2]<=-180.0 ) coords[2] += 360.0;\n    while( coords[3]> 180.0 ) coords[3] -= 360.0;\n    while( coords[3]<=-180.0 ) coords[3] += 360.0;\n    newShape->param.gen.a = newShape->param.gen.p[5]*newShape->param.gen.p[5];\n    newShape->param.gen.b = newShape->param.gen.p[6]*newShape->param.gen.p[6];\n    break;\n  case epanda_rgn:\n  case bpanda_rgn:\n    while( coords[2]> 180.0 ) coords[2] -= 360.0;\n    while( coords[2]<=-180.0 ) coords[2] += 360.0;\n    while( coords[3]> 180.0 ) coords[3] -= 360.0;\n    while( coords[3]<=-180.0 ) coords[3] += 360.0;\n    newShape->param.gen.sinT = sin( myPI * (coords[10] / 180.0) );\n    newShape->param.gen.cosT = cos( myPI * (coords[10] / 180.0) );\n    break;\n  default:\n    break;\n  }\n\n  /*  Set the xmin, xmax, ymin, ymax elements of the RgnShape structure */\n\n  /* For everything which has first two parameters as center position just */\n  /* find a circle that encompasses the region and use it to set the       */\n  /* bounding box                                                          */\n\n  R = -1.0;\n\n  switch ( newShape->shape ) {\n\n  case circle_rgn:\n    R = coords[2];\n    break;\n\n  case annulus_rgn:\n    R = coords[3];\n    break;\n\n  case ellipse_rgn:\n    if ( coords[2] > coords[3] ) {\n      R = coords[2];\n    } else {\n      R = coords[3];\n    }\n    break;\n\n  case elliptannulus_rgn:\n    if ( coords[4] > coords[5] ) {\n      R = coords[4];\n    } else {\n      R = coords[5];\n    }\n    break;\n\n  case box_rgn:\n    R = sqrt(coords[2]*coords[2]+\n\t     coords[3]*coords[3])/2.0;\n    break;\n\n  case boxannulus_rgn:\n    R = sqrt(coords[4]*coords[5]+\n\t     coords[4]*coords[5])/2.0;\n    break;\n\n  case diamond_rgn:\n    if ( coords[2] > coords[3] ) {\n      R = coords[2]/2.0;\n    } else {\n      R = coords[3]/2.0;\n    }\n    break;\n    \n  case point_rgn:\n    R = 1.0;\n    break;\n\n  case panda_rgn:\n    R = coords[6];\n    break;\n\n  case epanda_rgn:\n    if ( coords[7] > coords[8] ) {\n      R = coords[7];\n    } else {\n      R = coords[8];\n    }\n    break;\n\n  case bpanda_rgn:\n    R = sqrt(coords[7]*coords[8]+\n\t     coords[7]*coords[8])/2.0;\n    break;\n\n  default:\n    break;\n  }\n\n  if ( R > 0.0 ) {\n\n    newShape->xmin = coords[0] - R;\n    newShape->xmax = coords[0] + R;\n    newShape->ymin = coords[1] - R;\n    newShape->ymax = coords[1] + R;\n\n    return;\n\n  }\n\n  /* Now do the rest of the shapes that require individual methods */\n\n  switch ( newShape->shape ) {\n\n  case rectangle_rgn:\n    R = sqrt((coords[5]-coords[0])*(coords[5]-coords[0])+\n\t     (coords[6]-coords[1])*(coords[6]-coords[1]));\n    newShape->xmin = coords[5] - R;\n    newShape->xmax = coords[5] + R;\n    newShape->ymin = coords[6] - R;\n    newShape->ymax = coords[6] + R;\n    break;\n\n  case poly_rgn:\n    newShape->xmin = coords[0];\n    newShape->xmax = coords[0];\n    newShape->ymin = coords[1];\n    newShape->ymax = coords[1];\n    for( i=2; i < newShape->param.poly.nPts; ) {\n      if( newShape->xmin > coords[i] ) /* Min X */\n\tnewShape->xmin = coords[i];\n      if( newShape->xmax < coords[i] ) /* Max X */\n\tnewShape->xmax = coords[i];\n      i++;\n      if( newShape->ymin > coords[i] ) /* Min Y */\n\tnewShape->ymin = coords[i];\n      if( newShape->ymax < coords[i] ) /* Max Y */\n\tnewShape->ymax = coords[i];\n      i++;\n    }\n    break;\n\n  case line_rgn:\n    if ( coords[0] > coords[2] ) {\n      newShape->xmin = coords[2];\n      newShape->xmax = coords[0];\n    } else {\n      newShape->xmin = coords[0];\n      newShape->xmax = coords[2];\n    }\n    if ( coords[1] > coords[3] ) {\n      newShape->ymin = coords[3];\n      newShape->ymax = coords[1];\n    } else {\n      newShape->ymin = coords[1];\n      newShape->ymax = coords[3];\n    }\n\n    break;\n\n    /* sector doesn't have min and max so indicate by setting max < min */\n\n  case sector_rgn:\n    newShape->xmin = 1.0;\n    newShape->xmax = -1.0;\n    newShape->ymin = 1.0;\n    newShape->ymax = -1.0;\n    break;\n\n  default:\n    break;\n  }\n\n  return;\n\n}\n\n/*---------------------------------------------------------------------------*/\nint fits_read_fits_region ( fitsfile *fptr, \n\t\t\t    WCSdata *wcs, \n\t\t\t    SAORegion **Rgn, \n\t\t\t    int *status)\n/*  Read regions from a FITS region extension and return the information     */\n/*  in the \"SAORegion\" structure.  If it is nonNULL, use wcs to convert the  */\n/*  region coordinates to pixels.  Return an error if region is in degrees   */\n/*  but no WCS data is provided.                                             */\n/*---------------------------------------------------------------------------*/\n{\n\n  int i, j, icol[6], idum, anynul, npos;\n  int dotransform, got_component = 1, tstatus;\n  long icsize[6];\n  double X, Y, Theta, Xsave = 0, Ysave = 0, Xpos, Ypos;\n  double *coords;\n  char *cvalue, *cvalue2;\n  char comment[FLEN_COMMENT];\n  char colname[6][FLEN_VALUE] = {\"X\", \"Y\", \"SHAPE\", \"R\", \"ROTANG\", \"COMPONENT\"};\n  char shapename[17][FLEN_VALUE] = {\"POINT\",\"CIRCLE\",\"ELLIPSE\",\"ANNULUS\",\n\t\t\t\t    \"ELLIPTANNULUS\",\"BOX\",\"ROTBOX\",\"BOXANNULUS\",\n\t\t\t\t    \"RECTANGLE\",\"ROTRECTANGLE\",\"POLYGON\",\"PIE\",\n\t\t\t\t    \"SECTOR\",\"DIAMOND\",\"RHOMBUS\",\"ROTDIAMOND\",\n\t\t\t\t    \"ROTRHOMBUS\"};\n  int shapetype[17] = {point_rgn, circle_rgn, ellipse_rgn, annulus_rgn, \n\t\t       elliptannulus_rgn, box_rgn, box_rgn, boxannulus_rgn, \n\t\t       rectangle_rgn, rectangle_rgn, poly_rgn, sector_rgn, \n\t\t       sector_rgn, diamond_rgn, diamond_rgn, diamond_rgn, \n\t\t       diamond_rgn};\n  SAORegion *aRgn;\n  RgnShape *newShape;\n  WCSdata *regwcs = 0;\n\n  if ( *status ) return( *status );\n\n  aRgn = (SAORegion *)malloc( sizeof(SAORegion) );\n  if( ! aRgn ) {\n    ffpmsg(\"Couldn't allocate memory to hold Region file contents.\");\n    return(*status = MEMORY_ALLOCATION );\n  }\n  aRgn->nShapes    =    0;\n  aRgn->Shapes     = NULL;\n  if( wcs && wcs->exists )\n    aRgn->wcs = *wcs;\n  else\n    aRgn->wcs.exists = 0;\n\n  /* See if we are already positioned to a region extension, else */\n  /* move to the REGION extension (file is already open). */\n\n  tstatus = 0;\n  for (i=0; i<5; i++) {\n    ffgcno(fptr, CASEINSEN, colname[i], &icol[i], &tstatus);\n  }\n\n  if (tstatus) {\n    /* couldn't find the required columns, so search for \"REGION\" extension */\n    if ( ffmnhd(fptr, BINARY_TBL, \"REGION\", 1, status) ) {\n      ffpmsg(\"Could not move to REGION extension.\");\n      goto error;\n    }\n  }\n\n  /* get the number of shapes and allocate memory */\n\n  if ( ffgky(fptr, TINT, \"NAXIS2\", &aRgn->nShapes, comment, status) ) {\n    ffpmsg(\"Could not read NAXIS2 keyword.\");\n    goto error;\n  }\n\n  aRgn->Shapes = (RgnShape *) malloc(aRgn->nShapes * sizeof(RgnShape));\n  if ( !aRgn->Shapes ) {\n    ffpmsg( \"Failed to allocate memory for Region data\");\n    *status = MEMORY_ALLOCATION;\n    goto error;\n  }\n\n  /* get the required column numbers */\n\n  for (i=0; i<5; i++) {\n    if ( ffgcno(fptr, CASEINSEN, colname[i], &icol[i], status) ) {\n      ffpmsg(\"Could not find column.\");\n      goto error;\n    }\n  }\n\n  /* try to get the optional column numbers */\n\n  if ( ffgcno(fptr, CASEINSEN, colname[5], &icol[5], status) ) {\n       got_component = 0;\n  }\n\n  /* if there was input WCS then read the WCS info for the region in case they */\n  /* are different and we have to transform */\n\n  dotransform = 0;\n  if ( aRgn->wcs.exists ) {\n    regwcs = (WCSdata *) malloc ( sizeof(WCSdata) );\n    if ( !regwcs ) {\n      ffpmsg( \"Failed to allocate memory for Region WCS data\");\n      *status = MEMORY_ALLOCATION;\n      goto error;\n    }\n\n    regwcs->exists = 1;\n    if ( ffgtcs(fptr, icol[0], icol[1], &regwcs->xrefval,  &regwcs->yrefval,\n\t\t&regwcs->xrefpix, &regwcs->yrefpix, &regwcs->xinc, &regwcs->yinc,\n\t\t&regwcs->rot, regwcs->type, status) ) {\n      regwcs->exists = 0;\n      *status = 0;\n    }\n\n    if ( regwcs->exists && wcs->exists ) {\n      if ( fabs(regwcs->xrefval-wcs->xrefval) > 1.0e-6 ||\n\t   fabs(regwcs->yrefval-wcs->yrefval) > 1.0e-6 ||\n\t   fabs(regwcs->xrefpix-wcs->xrefpix) > 1.0e-6 ||\n\t   fabs(regwcs->yrefpix-wcs->yrefpix) > 1.0e-6 ||\n\t   fabs(regwcs->xinc-wcs->xinc) > 1.0e-6 ||\n\t   fabs(regwcs->yinc-wcs->yinc) > 1.0e-6 ||\n\t   fabs(regwcs->rot-wcs->rot) > 1.0e-6 ||\n\t   !strcmp(regwcs->type,wcs->type) ) dotransform = 1;\n    }\n  }\n\n  /* get the sizes of the X, Y, R, and ROTANG vectors */\n\n  for (i=0; i<6; i++) {\n    if ( ffgtdm(fptr, icol[i], 1, &idum, &icsize[i], status) ) {\n      ffpmsg(\"Could not find vector size of column.\");\n      goto error;\n    }\n  }\n\n  cvalue = (char *) malloc ((FLEN_VALUE+1)*sizeof(char));\n\n  /* loop over the shapes - note 1-based counting for rows in FITS files */\n\n  for (i=1; i<=aRgn->nShapes; i++) {\n\n    newShape = &aRgn->Shapes[i-1];\n    for (j=0; j<8; j++) newShape->param.gen.p[j] = 0.0;\n    newShape->param.gen.a = 0.0;\n    newShape->param.gen.b = 0.0;\n    newShape->param.gen.sinT = 0.0;\n    newShape->param.gen.cosT = 0.0;\n\n    /* get the shape */\n\n    if ( ffgcvs(fptr, icol[2], i, 1, 1, \" \", &cvalue, &anynul, status) ) {\n      ffpmsg(\"Could not read shape.\");\n      goto error;\n    }\n\n    /* set include or exclude */\n\n    newShape->sign = 1;\n    cvalue2 = cvalue;\n    if ( !strncmp(cvalue,\"!\",1) ) {\n      newShape->sign = 0;\n      cvalue2++;\n    }\n\n    /* set the shape type */\n\n    for (j=0; j<17; j++) {\n      if ( !strcmp(cvalue2, shapename[j]) ) newShape->shape = shapetype[j];\n    }\n\n    /* allocate memory for polygon case and set coords pointer */\n\n    if ( newShape->shape == poly_rgn ) {\n      newShape->param.poly.Pts = (double *) calloc (2*icsize[0], sizeof(double));\n      if ( !newShape->param.poly.Pts ) {\n\tffpmsg(\"Could not allocate memory to hold polygon parameters\" );\n\t*status = MEMORY_ALLOCATION;\n\tgoto error;\n      }\n      newShape->param.poly.nPts = 2*icsize[0];\n      coords = newShape->param.poly.Pts;\n    } else {\n      coords = newShape->param.gen.p;\n    }\n\n\n  /* read X and Y. Polygon and Rectangle require special cases */\n\n    npos = 1;\n    if ( newShape->shape == poly_rgn ) npos = newShape->param.poly.nPts/2;\n    if ( newShape->shape == rectangle_rgn ) npos = 2;\n\n    for (j=0; j<npos; j++) {\n      if ( ffgcvd(fptr, icol[0], i, j+1, 1, DOUBLENULLVALUE, coords, &anynul, status) ) {\n\tffpmsg(\"Failed to read X column for polygon region\");\n\tgoto error;\n      }\n      if (*coords == DOUBLENULLVALUE) {  /* check for null value end of array marker */\n        npos = j;\n\tnewShape->param.poly.nPts = npos * 2;\n\tbreak;\n      }\n      coords++;\n      \n      if ( ffgcvd(fptr, icol[1], i, j+1, 1, DOUBLENULLVALUE, coords, &anynul, status) ) {\n\tffpmsg(\"Failed to read Y column for polygon region\");\n\tgoto error;\n      }\n      if (*coords == DOUBLENULLVALUE) { /* check for null value end of array marker */\n        npos = j;\n\tnewShape->param.poly.nPts = npos * 2;\n        coords--;\n\tbreak;\n      }\n      coords++;\n \n      if (j == 0) {  /* save the first X and Y coordinate */\n        Xsave = *(coords - 2);\n\tYsave = *(coords - 1);\n      } else if ((Xsave == *(coords - 2)) && (Ysave == *(coords - 1)) ) {\n        /* if point has same coordinate as first point, this marks the end of the array */\n        npos = j + 1;\n\tnewShape->param.poly.nPts = npos * 2;\n\tbreak;\n      }\n    }\n\n    /* transform positions if the region and input wcs differ */\n\n    if ( dotransform ) {\n\n      coords -= npos*2;\n      Xsave = coords[0];\n      Ysave = coords[1];\n      for (j=0; j<npos; j++) {\n\tffwldp(coords[2*j], coords[2*j+1], regwcs->xrefval, regwcs->yrefval, regwcs->xrefpix,\n\t       regwcs->yrefpix, regwcs->xinc, regwcs->yinc, regwcs->rot,\n\t       regwcs->type, &Xpos, &Ypos, status);\n\tffxypx(Xpos, Ypos, wcs->xrefval, wcs->yrefval, wcs->xrefpix,\n\t       wcs->yrefpix, wcs->xinc, wcs->yinc, wcs->rot,\n\t       wcs->type, &coords[2*j], &coords[2*j+1], status);\n\tif ( *status ) {\n\t  ffpmsg(\"Failed to transform coordinates\");\n\t  goto error;\n\t}\n      }\n      coords += npos*2;\n    }\n\n  /* read R. Circle requires one number; Box, Diamond, Ellipse, Annulus, Sector \n     and Panda two; Boxannulus and Elliptannulus four; Point, Rectangle and \n     Polygon none. */\n\n    npos = 0;\n    switch ( newShape->shape ) {\n    case circle_rgn: \n      npos = 1;\n      break;\n    case box_rgn:\n    case diamond_rgn:\n    case ellipse_rgn:\n    case annulus_rgn:\n    case sector_rgn:\n      npos = 2;\n      break;\n    case boxannulus_rgn:\n    case elliptannulus_rgn:\n      npos = 4;\n      break;\n    default:\n      break;\n    }\n\n    if ( npos > 0 ) {\n      if ( ffgcvd(fptr, icol[3], i, 1, npos, 0.0, coords, &anynul, status) ) {\n\tffpmsg(\"Failed to read R column for region\");\n\tgoto error;\n      }\n\n    /* transform lengths if the region and input wcs differ */\n\n      if ( dotransform ) {\n\tfor (j=0; j<npos; j++) {\n\t  Y = Ysave + (*coords);\n\t  X = Xsave;\n\t  ffwldp(X, Y, regwcs->xrefval, regwcs->yrefval, regwcs->xrefpix,\n\t\t regwcs->yrefpix, regwcs->xinc, regwcs->yinc, regwcs->rot,\n\t\t regwcs->type, &Xpos, &Ypos, status);\n\t  ffxypx(Xpos, Ypos, wcs->xrefval, wcs->yrefval, wcs->xrefpix,\n\t\t wcs->yrefpix, wcs->xinc, wcs->yinc, wcs->rot,\n\t\t wcs->type, &X, &Y, status);\n\t  if ( *status ) {\n\t    ffpmsg(\"Failed to transform coordinates\");\n\t    goto error;\n\t  }\n\t  *(coords++) = sqrt(pow(X-newShape->param.gen.p[0],2)+pow(Y-newShape->param.gen.p[1],2));\n\t}\n      } else {\n\tcoords += npos;\n      }\n    }\n\n  /* read ROTANG. Requires two values for Boxannulus, Elliptannulus, Sector, \n     Panda; one for Box, Diamond, Ellipse; and none for Circle, Point, Annulus, \n     Rectangle, Polygon */\n\n    npos = 0;\n    switch ( newShape->shape ) {\n    case box_rgn:\n    case diamond_rgn:\n    case ellipse_rgn:\n      npos = 1;\n      break;\n    case boxannulus_rgn:\n    case elliptannulus_rgn:\n    case sector_rgn:\n      npos = 2;\n      break;\n    default:\n     break;\n    }\n\n    if ( npos > 0 ) {\n      if ( ffgcvd(fptr, icol[4], i, 1, npos, 0.0, coords, &anynul, status) ) {\n\tffpmsg(\"Failed to read ROTANG column for region\");\n\tgoto error;\n      }\n\n    /* transform angles if the region and input wcs differ */\n\n      if ( dotransform ) {\n\tTheta = (wcs->rot) - (regwcs->rot);\n\tfor (j=0; j<npos; j++) *(coords++) += Theta;\n      } else {\n\tcoords += npos;\n      }\n    }\n\n  /* read the component number */\n\n    if (got_component) {\n      if ( ffgcv(fptr, TINT, icol[5], i, 1, 1, 0, &newShape->comp, &anynul, status) ) {\n        ffpmsg(\"Failed to read COMPONENT column for region\");\n        goto error;\n      }\n    } else {\n      newShape->comp = 1;\n    }\n\n\n    /* do some precalculations to speed up tests */\n\n    fits_setup_shape(newShape);\n\n    /* end loop over shapes */\n\n  }\n\nerror:\n\n   if( *status )\n      fits_free_region( aRgn );\n   else\n      *Rgn = aRgn;\n\n   ffclos(fptr, status);\n\n   return( *status );\n}\n\n"},{"id":16708,"name":"drvrfile.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, drvrfile.c contains driver routines for disk files.         */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n#include \"group.h\"  /* needed for fits_get_cwd in file_create */\n\n#if defined(unix) || defined(__unix__)  || defined(__unix)\n#include <pwd.h>         /* needed in file_openfile */\n\n#ifdef REPLACE_LINKS\n#include <sys/types.h>\n#include <sys/stat.h>\n#endif\n\n#endif\n\n#ifdef HAVE_FTRUNCATE\n#if defined(unix) || defined(__unix__)  || defined(__unix) || defined(HAVE_UNISTD_H)\n#include <unistd.h>  /* needed for getcwd prototype on unix machines */\n#endif\n#endif\n\n#define IO_SEEK 0        /* last file I/O operation was a seek */\n#define IO_READ 1        /* last file I/O operation was a read */\n#define IO_WRITE 2       /* last file I/O operation was a write */\n\nstatic char file_outfile[FLEN_FILENAME];\n\ntypedef struct    /* structure containing disk file structure */ \n{\n    FILE *fileptr;\n    LONGLONG currentpos;\n    int last_io_op;\n} diskdriver;\n\nstatic diskdriver handleTable[NMAXFILES]; /* allocate diskfile handle tables */\n\n/*--------------------------------------------------------------------------*/\nint file_init(void)\n{\n    int ii;\n\n    for (ii = 0; ii < NMAXFILES; ii++) /* initialize all empty slots in table */\n    {\n       handleTable[ii].fileptr = 0;\n    }\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint file_setoptions(int options)\n{\n  /* do something with the options argument, to stop compiler warning */\n  options = 0;\n  return(options);\n}\n/*--------------------------------------------------------------------------*/\nint file_getoptions(int *options)\n{\n  *options = 0;\n  return(0);\n}\n/*--------------------------------------------------------------------------*/\nint file_getversion(int *version)\n{\n    *version = 10;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint file_shutdown(void)\n{\n  return(0);\n}\n/*--------------------------------------------------------------------------*/\nint file_open(char *filename, int rwmode, int *handle)\n{\n    FILE *diskfile;\n    int copyhandle, ii, status;\n    char recbuf[2880];\n    size_t nread;\n\n    /*\n       if an output filename has been specified as part of the input\n       file, as in \"inputfile.fits(outputfile.fit)\" then we have to\n       create the output file, copy the input to it, then reopen the\n       the new copy.\n    */\n\n    if (*file_outfile)\n    {\n      /* open the original file, with readonly access */\n      status = file_openfile(filename, READONLY, &diskfile);\n      if (status) {\n        file_outfile[0] = '\\0';\n        return(status);\n      }\n      \n      /* create the output file */\n      status =  file_create(file_outfile,handle);\n      if (status)\n      {\n        ffpmsg(\"Unable to create output file for copy of input file:\");\n        ffpmsg(file_outfile);\n        file_outfile[0] = '\\0';\n        return(status);\n      }\n\n      /* copy the file from input to output */\n      while(0 != (nread = fread(recbuf,1,2880, diskfile)))\n      {\n        status = file_write(*handle, recbuf, nread);\n        if (status) {\n\t   file_outfile[0] = '\\0';\n           return(status);\n        }\n      }\n\n      /* close both files */\n      fclose(diskfile);\n      copyhandle = *handle;\n      file_close(*handle);\n      *handle = copyhandle;  /* reuse the old file handle */\n\n      /* reopen the new copy, with correct rwmode */\n      status = file_openfile(file_outfile, rwmode, &diskfile);\n      file_outfile[0] = '\\0';\n    }\n    else\n    {\n      *handle = -1;\n      for (ii = 0; ii < NMAXFILES; ii++)  /* find empty slot in table */\n      {\n        if (handleTable[ii].fileptr == 0)\n        {\n            *handle = ii;\n            break;\n        }\n      }\n\n      if (*handle == -1)\n       return(TOO_MANY_FILES);    /* too many files opened */\n\n      /*open the file */\n      status = file_openfile(filename, rwmode, &diskfile);\n    }\n\n    handleTable[*handle].fileptr = diskfile;\n    handleTable[*handle].currentpos = 0;\n    handleTable[*handle].last_io_op = IO_SEEK;\n\n    return(status);\n}\n/*--------------------------------------------------------------------------*/\nint file_openfile(char *filename, int rwmode, FILE **diskfile)\n/*\n   lowest level routine to physically open a disk file\n*/\n{\n    char mode[4];\n\n#if defined(unix) || defined(__unix__) || defined(__unix)\n    char tempname[1024], *cptr, user[80];\n    struct passwd *pwd;\n    int ii = 0;\n\n#if defined(REPLACE_LINKS)\n    struct stat stbuf;\n    int success = 0;\n    size_t n;\n    FILE *f1, *f2;\n    char buf[BUFSIZ];\n#endif\n\n#endif\n\n    if (rwmode == READWRITE)\n    {\n          strcpy(mode, \"r+b\");    /* open existing file with read-write */\n    }\n    else\n    {\n          strcpy(mode, \"rb\");     /* open existing file readonly */\n    }\n\n#if MACHINE == ALPHAVMS || MACHINE == VAXVMS\n        /* specify VMS record structure: fixed format, 2880 byte records */\n        /* but force stream mode access to enable random I/O access      */\n    *diskfile = fopen(filename, mode, \"rfm=fix\", \"mrs=2880\", \"ctx=stm\"); \n\n#elif defined(unix) || defined(__unix__) || defined(__unix)\n\n    /* support the ~user/file.fits or ~/file.fits filenames in UNIX */\n\n    if (*filename == '~')\n    {\n        if (filename[1] == '/')\n        {\n            cptr = getenv(\"HOME\");\n            if (cptr)\n            {\n                 if (strlen(cptr) + strlen(filename+1) > 1023)\n\t\t      return(FILE_NOT_OPENED); \n\n                 strcpy(tempname, cptr);\n                 strcat(tempname, filename+1);\n            }\n            else\n            {\n                 if (strlen(filename) > 1023)\n\t\t      return(FILE_NOT_OPENED); \n\n                 strcpy(tempname, filename);\n            }\n        }\n        else\n        {\n            /* copy user name */\n            cptr = filename+1;\n            while (*cptr && (*cptr != '/'))\n            {\n                user[ii] = *cptr;\n                cptr++;\n                ii++;\n            }\n            user[ii] = '\\0';\n\n            /* get structure that includes name of user's home directory */\n            pwd = getpwnam(user);\n\n            /* copy user's home directory */\n            if (strlen(pwd->pw_dir) + strlen(cptr) > 1023)\n\t\t      return(FILE_NOT_OPENED); \n\n            strcpy(tempname, pwd->pw_dir);\n            strcat(tempname, cptr);\n        }\n\n        *diskfile = fopen(tempname, mode); \n    }\n    else\n    {\n        /* don't need to expand the input file name */\n        *diskfile = fopen(filename, mode); \n\n#if defined(REPLACE_LINKS)\n\n        if (!(*diskfile) && (rwmode == READWRITE))  \n        {\n           /* failed to open file with READWRITE privilege.  Test if  */\n           /* the file we are trying to open is a soft link to a file that */\n           /* doesn't have write privilege.  */\n\n           lstat(filename, &stbuf);\n           if ((stbuf.st_mode & S_IFMT) == S_IFLNK) /* is this a soft link? */\n           {\n              if ((f1 = fopen(filename, \"rb\")) != 0) /* try opening READONLY */\n              {\n\n                 if (strlen(filename) + 7 > 1023)\n\t\t      return(FILE_NOT_OPENED); \n\n                 strcpy(tempname, filename);\n                 strcat(tempname, \".TmxFil\");\n                 if ((f2 = fopen(tempname, \"wb\")) != 0) /* create temp file */\n                 {\n                    success = 1;\n                    while ((n = fread(buf, 1, BUFSIZ, f1)) > 0)\n                    {\n                       /* copy linked file to local temporary file */\n                       if (fwrite(buf, 1, n, f2) != n) \n                       {\n                          success = 0;\n                          break;\n                       } \n                    }\n                    fclose(f2);\n                 }\n                 fclose(f1);\n  \n                 if (success)\n                 {\n                    /* delete link and rename temp file to previous link name */\n                    remove(filename);\n                    rename(tempname, filename);\n\n                    /* try once again to open the file with write access */\n                    *diskfile = fopen(filename, mode); \n                 }\n                 else\n                    remove(tempname);  /* clean up the failed copy */\n              }\n           }\n        }\n#endif\n\n    }\n\n#else\n\n    /* other non-UNIX machines */\n    *diskfile = fopen(filename, mode); \n\n#endif\n\n    if (!(*diskfile))           /* couldn't open file */\n    {\n            return(FILE_NOT_OPENED); \n    }\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint file_create(char *filename, int *handle)\n{\n    FILE *diskfile;\n    int ii;\n    char mode[4];\n \n    int status = 0, rootlen, rootlen2, slen;\n    char *cptr, *cpos;\n    char cwd[FLEN_FILENAME], absURL[FLEN_FILENAME];\n    char rootstring[256], rootstring2[256];\n    char username[FLEN_FILENAME], userroot[FLEN_FILENAME], userroot2[FLEN_FILENAME];\n\n    cptr = getenv(\"HERA_DATA_DIRECTORY\");\n    if (cptr) {\n\t/* This environment variable is defined in the Hera data analysis environment. */\n\t/* It specifies the root directory path to the users data directories.  */\n\t/* CFITSIO will verify that the path to the file that is to be created */\n\t/* is within this root directory + the user's home directory name. */\n\n/*\nprintf(\"env = %s\\n\",cptr);\n*/\t\n        if (strlen(cptr) > 200)  /* guard against possible string overflows */\n\t    return(FILE_NOT_CREATED); \n\n\t/* environment variable has the form \"path/one/;/path/two/\" where the */\n\t/* second path is optional */\n\n\tstrcpy(rootstring, cptr);\n\tcpos = strchr(rootstring, ';');\n\tif (cpos) {\n\t    *cpos = '\\0';\n\t    cpos++;\n\t    strcpy(rootstring2, cpos);\n\t} else {\n\t  *rootstring2 = '\\0';\n\t}\n/*\nprintf(\"%s, %s\\n\", rootstring, rootstring2);\nprintf(\"CWD = %s\\n\", cwd); \nprintf(\"rootstring=%s, cwd=%s.\\n\", rootstring, cwd);\n*/\n\t/* Get the current working directory */\n\tfits_get_cwd(cwd, &status);  \n\tslen = strlen(cwd);\n\tif ((slen < FLEN_FILENAME) && cwd[slen-1] != '/') strcat(cwd,\"/\"); /* make sure the CWD ends with slash */\n\n\n\t/* check that CWD string matches the rootstring */\n\trootlen = strlen(rootstring);\n\tif (strncmp(rootstring, cwd, rootlen)) {\n\t    ffpmsg(\"invalid CWD: does not match root data directory\");\n\t    return(FILE_NOT_CREATED); \n\t} else {\n\n\t    /* get the user name from CWD (it follows the root string) */\n\t    strncpy(username, cwd+rootlen, 50);  /* limit length of user name */\n            username[50]=0;\n\t    cpos=strchr(username, '/');\n\t    if (!cpos) {\n               ffpmsg(\"invalid CWD: not equal to root data directory + username\");\n               return(FILE_NOT_CREATED); \n\t    } else {\n\t        *(cpos+1) = '\\0';   /* truncate user name string */\n\n\t\t/* construct full user root name */\n\t\tstrcpy(userroot, rootstring);\n\t\tstrcat(userroot, username);\n\t\trootlen = strlen(userroot);\n\n\t\t/* construct alternate full user root name */\n\t\tstrcpy(userroot2, rootstring2);\n\t\tstrcat(userroot2, username);\n\t\trootlen2 = strlen(userroot2);\n\n\t\t/* convert the input filename to absolute path relative to the CWD */\n\t\tfits_relurl2url(cwd,  filename,  absURL, &status);\n\n/*\nprintf(\"username = %s\\n\", username);\nprintf(\"userroot = %s\\n\", userroot);\nprintf(\"userroot2 = %s\\n\", userroot2);\nprintf(\"filename = %s\\n\", filename);\nprintf(\"ABS = %s\\n\", absURL);\n*/\n\t\t/* check that CWD string matches the rootstring or alternate root string */\n\n\t\tif ( strncmp(userroot,  absURL, rootlen)  &&\n\t\t   strncmp(userroot2, absURL, rootlen2) ) {\n\t\t   ffpmsg(\"invalid filename: path not within user directory\");\n\t\t   return(FILE_NOT_CREATED); \n\t\t}\n\t    }\n\t}\n\t/* if we got here, then the input filename appears to be valid */\n    }\n    \n    *handle = -1;\n    for (ii = 0; ii < NMAXFILES; ii++)  /* find empty slot in table */\n    {\n        if (handleTable[ii].fileptr == 0)\n        {\n            *handle = ii;\n            break;\n        }\n    }\n    if (*handle == -1)\n       return(TOO_MANY_FILES);    /* too many files opened */\n\n    strcpy(mode, \"w+b\");    /* create new file with read-write */\n\n    diskfile = fopen(filename, \"r\"); /* does file already exist? */\n\n    if (diskfile)\n    {\n        fclose(diskfile);         /* close file and exit with error */\n        return(FILE_NOT_CREATED); \n    }\n\n#if MACHINE == ALPHAVMS || MACHINE == VAXVMS\n        /* specify VMS record structure: fixed format, 2880 byte records */\n        /* but force stream mode access to enable random I/O access      */\n    diskfile = fopen(filename, mode, \"rfm=fix\", \"mrs=2880\", \"ctx=stm\"); \n#else\n    diskfile = fopen(filename, mode); \n#endif\n\n    if (!(diskfile))           /* couldn't create file */\n    {\n            return(FILE_NOT_CREATED); \n    }\n\n    handleTable[ii].fileptr = diskfile;\n    handleTable[ii].currentpos = 0;\n    handleTable[ii].last_io_op = IO_SEEK;\n\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint file_truncate(int handle, LONGLONG filesize)\n/*\n  truncate the diskfile to a new smaller size\n*/\n{\n\n#ifdef HAVE_FTRUNCATE\n    int fdesc;\n\n    fdesc = fileno(handleTable[handle].fileptr);\n    ftruncate(fdesc, (OFF_T) filesize);\n    file_seek(handle, filesize);\n\n    handleTable[handle].currentpos = filesize;\n    handleTable[handle].last_io_op = IO_SEEK;\n\n#endif\n\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint file_size(int handle, LONGLONG *filesize)\n/*\n  return the size of the file in bytes\n*/\n{\n    OFF_T position1,position2;\n    FILE *diskfile;\n\n    diskfile = handleTable[handle].fileptr;\n\n#if defined(_MSC_VER) && (_MSC_VER >= 1400)\n \n/* call the VISUAL C++ version of the routines which support */\n/*  Large Files (> 2GB) if they are supported (since VC 8.0)  */\n\n    position1 = _ftelli64(diskfile);   /* save current postion */\n    if (position1 < 0)\n        return(SEEK_ERROR);\n\n    if (_fseeki64(diskfile, 0, 2) != 0)  /* seek to end of file */\n        return(SEEK_ERROR);\n\n    position2 = _ftelli64(diskfile);     /* get file size */\n    if (position2 < 0)\n        return(SEEK_ERROR);\n\n    if (_fseeki64(diskfile, position1, 0) != 0)  /* seek back to original pos */\n        return(SEEK_ERROR);\n\n#elif _FILE_OFFSET_BITS - 0 == 64\n\n/* call the newer ftello and fseeko routines , which support */\n/*  Large Files (> 2GB) if they are supported.  */\n\n    position1 = ftello(diskfile);   /* save current postion */\n    if (position1 < 0)\n        return(SEEK_ERROR);\n\n    if (fseeko(diskfile, 0, 2) != 0)  /* seek to end of file */\n        return(SEEK_ERROR);\n\n    position2 = ftello(diskfile);     /* get file size */\n    if (position2 < 0)\n        return(SEEK_ERROR);\n\n    if (fseeko(diskfile, position1, 0) != 0)  /* seek back to original pos */\n        return(SEEK_ERROR);\n\n#else\n\n    position1 = ftell(diskfile);   /* save current postion */\n    if (position1 < 0)\n        return(SEEK_ERROR);\n\n    if (fseek(diskfile, 0, 2) != 0)  /* seek to end of file */\n        return(SEEK_ERROR);\n\n    position2 = ftell(diskfile);     /* get file size */\n    if (position2 < 0)\n        return(SEEK_ERROR);\n\n    if (fseek(diskfile, position1, 0) != 0)  /* seek back to original pos */\n        return(SEEK_ERROR);\n\n#endif\n\n    *filesize = (LONGLONG) position2;\n    \n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint file_close(int handle)\n/*\n  close the file\n*/\n{\n    \n    if (fclose(handleTable[handle].fileptr) )\n        return(FILE_NOT_CLOSED);\n\n    handleTable[handle].fileptr = 0;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint file_remove(char *filename)\n/*\n  delete the file from disk\n*/\n{\n    remove(filename);\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint file_flush(int handle)\n/*\n  flush the file\n*/\n{\n    if (fflush(handleTable[handle].fileptr) )\n        return(WRITE_ERROR);\n\n    /* The flush operation is not supposed to move the internal */\n    /* file pointer, but it does on some Windows-95 compilers and */\n    /* perhaps others, so seek to original position to be sure. */\n    /* This seek will do no harm on other systems.   */\n\n#if MACHINE == IBMPC\n\n    if (file_seek(handle, handleTable[handle].currentpos))\n            return(SEEK_ERROR);\n\n#endif\n\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint file_seek(int handle, LONGLONG offset)\n/*\n  seek to position relative to start of the file\n*/\n{\n\n#if defined(_MSC_VER) && (_MSC_VER >= 1400)\n    \n     /* Microsoft visual studio C++ */\n     /* _fseeki64 supported beginning with version 8.0 */\n \n    if (_fseeki64(handleTable[handle].fileptr, (OFF_T) offset, 0) != 0)\n        return(SEEK_ERROR);\n\t\n#elif _FILE_OFFSET_BITS - 0 == 64\n\n    if (fseeko(handleTable[handle].fileptr, (OFF_T) offset, 0) != 0)\n        return(SEEK_ERROR);\n\n#else\n\n    if (fseek(handleTable[handle].fileptr, (OFF_T) offset, 0) != 0)\n        return(SEEK_ERROR);\n\n#endif\n\n    handleTable[handle].currentpos = offset;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint file_read(int hdl, void *buffer, long nbytes)\n/*\n  read bytes from the current position in the file\n*/\n{\n    long nread;\n    char *cptr;\n\n    if (handleTable[hdl].last_io_op == IO_WRITE)\n    {\n        if (file_seek(hdl, handleTable[hdl].currentpos))\n            return(SEEK_ERROR);\n    }\n  \n    nread = (long) fread(buffer, 1, nbytes, handleTable[hdl].fileptr);\n\n    if (nread == 1)\n    {\n         cptr = (char *) buffer;\n\n         /* some editors will add a single end-of-file character to a file */\n         /* Ignore it if the character is a zero, 10, or 32 */\n         if (*cptr == 0 || *cptr == 10 || *cptr == 32)\n             return(END_OF_FILE);\n         else\n             return(READ_ERROR);\n    }\n    else if (nread != nbytes)\n    {\n        return(READ_ERROR);\n    }\n\n    handleTable[hdl].currentpos += nbytes;\n    handleTable[hdl].last_io_op = IO_READ;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint file_write(int hdl, void *buffer, long nbytes)\n/*\n  write bytes at the current position in the file\n*/\n{\n    if (handleTable[hdl].last_io_op == IO_READ) \n    {\n        if (file_seek(hdl, handleTable[hdl].currentpos))\n            return(SEEK_ERROR);\n    }\n\n    if((long) fwrite(buffer, 1, nbytes, handleTable[hdl].fileptr) != nbytes)\n        return(WRITE_ERROR);\n\n    handleTable[hdl].currentpos += nbytes;\n    handleTable[hdl].last_io_op = IO_WRITE;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint file_compress_open(char *filename, int rwmode, int *hdl)\n/*\n  This routine opens the compressed diskfile by creating a new uncompressed\n  file then opening it.  The input file name (the name of the compressed\n  file) gets replaced with the name of the uncompressed file, which is\n  initially stored in the global file_outfile string.   file_outfile\n  then gets set to a null string.\n*/\n{\n    FILE *indiskfile, *outdiskfile;\n    int status;\n    char *cptr;\n\n    /* open the compressed disk file */\n    status = file_openfile(filename, READONLY, &indiskfile);\n    if (status)\n    {\n        ffpmsg(\"failed to open compressed disk file (file_compress_open)\");\n        ffpmsg(filename);\n        return(status);\n    }\n\n    /* name of the output uncompressed file is stored in the */\n    /* global variable called 'file_outfile'.                */\n\n    cptr = file_outfile;\n    if (*cptr == '!')\n    {\n        /* clobber any existing file with the same name */\n        cptr++;\n        remove(cptr);\n    }\n    else\n    {\n        outdiskfile = fopen(file_outfile, \"r\"); /* does file already exist? */\n\n        if (outdiskfile)\n        {\n          ffpmsg(\"uncompressed file already exists: (file_compress_open)\");\n          ffpmsg(file_outfile);\n          fclose(outdiskfile);         /* close file and exit with error */\n\t  file_outfile[0] = '\\0';\n          return(FILE_NOT_CREATED); \n        }\n    }\n\n    outdiskfile = fopen(cptr, \"w+b\"); /* create new file */\n    if (!outdiskfile)\n    {\n        ffpmsg(\"could not create uncompressed file: (file_compress_open)\");\n        ffpmsg(file_outfile);\n\tfile_outfile[0] = '\\0';\n        return(FILE_NOT_CREATED); \n    }\n\n    /* uncompress file into another file */\n    uncompress2file(filename, indiskfile, outdiskfile, &status);\n    fclose(indiskfile);\n    fclose(outdiskfile);\n\n    if (status)\n    {\n        ffpmsg(\"error in file_compress_open: failed to uncompressed file:\");\n        ffpmsg(filename);\n        ffpmsg(\" into new output file:\");\n        ffpmsg(file_outfile);\n\tfile_outfile[0] = '\\0';\n        return(status);\n    }\n\n    strcpy(filename, cptr);  /* switch the names */\n    file_outfile[0] = '\\0';\n\n    status = file_open(filename, rwmode, hdl);\n\n    return(status);\n}\n/*--------------------------------------------------------------------------*/\nint file_is_compressed(char *filename) /* I - FITS file name          */\n/*\n  Test if the disk file is compressed.  Returns 1 if compressed, 0 if not.\n  This may modify the filename string by appending a compression suffex.\n*/\n{\n    FILE *diskfile;\n    unsigned char buffer[2];\n    char tmpfilename[FLEN_FILENAME];\n\n    /* Open file.  Try various suffix combinations */  \n    if (file_openfile(filename, 0, &diskfile))\n    {\n      if (strlen(filename) > FLEN_FILENAME - 5)\n          return(0);\n\n      strcpy(tmpfilename,filename);\n      strcat(filename,\".gz\");\n      if (file_openfile(filename, 0, &diskfile))\n      {\n#if HAVE_BZIP2\n        strcpy(filename,tmpfilename);\n        strcat(filename,\".bz2\");\n        if (file_openfile(filename, 0, &diskfile))\n        {\n#endif\n        strcpy(filename, tmpfilename);\n        strcat(filename,\".Z\");\n        if (file_openfile(filename, 0, &diskfile))\n        {\n          strcpy(filename, tmpfilename);\n          strcat(filename,\".z\");   /* it's often lower case on CDROMs */\n          if (file_openfile(filename, 0, &diskfile))\n          {\n            strcpy(filename, tmpfilename);\n            strcat(filename,\".zip\");\n            if (file_openfile(filename, 0, &diskfile))\n            {\n              strcpy(filename, tmpfilename);\n              strcat(filename,\"-z\");      /* VMS suffix */\n              if (file_openfile(filename, 0, &diskfile))\n              {\n                strcpy(filename, tmpfilename);\n                strcat(filename,\"-gz\");    /* VMS suffix */\n                if (file_openfile(filename, 0, &diskfile))\n                {\n                  strcpy(filename,tmpfilename);  /* restore original name */\n                  return(0);    /* file not found */\n                }\n              }\n            }\n          }\n        }\n#if HAVE_BZIP2\n        }\n#endif\n      }\n    }\n\n    if (fread(buffer, 1, 2, diskfile) != 2)  /* read 2 bytes */\n    {\n        fclose(diskfile);   /* error reading file so just return */\n        return(0);\n    }\n\n    fclose(diskfile);\n\n       /* see if the 2 bytes have the magic values for a compressed file */\n    if ( (memcmp(buffer, \"\\037\\213\", 2) == 0) ||  /* GZIP  */\n         (memcmp(buffer, \"\\120\\113\", 2) == 0) ||  /* PKZIP */\n         (memcmp(buffer, \"\\037\\036\", 2) == 0) ||  /* PACK  */\n         (memcmp(buffer, \"\\037\\235\", 2) == 0) ||  /* LZW   */\n#if HAVE_BZIP2\n         (memcmp(buffer, \"BZ\",       2) == 0) ||  /* BZip2 */\n#endif\n         (memcmp(buffer, \"\\037\\240\", 2) == 0))  /* LZH   */\n        {\n            return(1);  /* this is a compressed file */\n        }\n    else\n        {\n            return(0);  /* not a compressed file */\n        }\n}\n/*--------------------------------------------------------------------------*/\nint file_checkfile (char *urltype, char *infile, char *outfile) \n{\n    /* special case: if file:// driver, check if the file is compressed */\n    if ( file_is_compressed(infile) )\n    {\n      /* if output file has been specified, save the name for future use: */\n      /* This is the name of the uncompressed file to be created on disk. */\n      if (strlen(outfile))\n      {\n        if (!strncmp(outfile, \"mem:\", 4) )\n        {\n           /* uncompress the file in memory, with READ and WRITE access */\n           strcpy(urltype, \"compressmem://\");  /* use special driver */\n           *file_outfile = '\\0';  \n        }\n        else\n        {\n          strcpy(urltype, \"compressfile://\");  /* use special driver */\n\n          /* don't copy the \"file://\" prefix, if present.  */\n          if (!strncmp(outfile, \"file://\", 7) )\n             strcpy(file_outfile,outfile+7);\n          else\n             strcpy(file_outfile,outfile);\n        }\n      }\n      else\n      {\n        /* uncompress the file in memory */\n        strcpy(urltype, \"compress://\");  /* use special driver */\n        *file_outfile = '\\0';  /* no output file was specified */\n      }\n    }\n    else  /* an ordinary, uncompressed FITS file on disk */\n    {\n        /* save the output file name for later use when opening the file. */\n        /* In this case, the file to be opened will be opened READONLY,   */\n        /* and copied to this newly created output file.  The original file */\n        /* will be closed, and the copy will be opened by CFITSIO for     */\n        /* subsequent processing (possibly with READWRITE access).        */\n        if (strlen(outfile)) {\n\t    file_outfile[0] = '\\0';\n            strncat(file_outfile,outfile,FLEN_FILENAME-1);\n        }\n    }\n\n    return 0;\n}\n/**********************************************************************/\n/**********************************************************************/\n/**********************************************************************/\n\n/****  driver routines for stream//: device (stdin or stdout)  ********/\n\n\n/*--------------------------------------------------------------------------*/\nint stream_open(char *filename, int rwmode, int *handle)\n{\n    /*\n        read from stdin\n    */\n    if (filename)\n      rwmode = 1;  /* dummy statement to suppress unused parameter compiler warning */\n\n    *handle = 1;     /*  1 = stdin */   \n\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint stream_create(char *filename, int *handle)\n{\n    /*\n        write to stdout\n    */\n\n    if (filename)  /* dummy statement to suppress unused parameter compiler warning */\n       *handle = 2;\n    else\n       *handle = 2;         /*  2 = stdout */       \n\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint stream_size(int handle, LONGLONG *filesize)\n/*\n  return the size of the file in bytes\n*/\n{\n    handle = 0;  /* suppress unused parameter compiler warning */\n    \n    /* this operation is not supported in a stream; return large value */\n    *filesize = LONG_MAX;\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint stream_close(int handle)\n/*\n     don't have to close stdin or stdout \n*/\n{\n    handle = 0;  /* suppress unused parameter compiler warning */\n    \n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint stream_flush(int handle)\n/*\n  flush the file\n*/\n{\n    if (handle == 2)\n       fflush(stdout);  \n\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint stream_seek(int handle, LONGLONG offset)\n   /* \n      seeking is not allowed in a stream\n   */\n{\n    offset = handle;  /* suppress unused parameter compiler warning */\n    return(1);\n}\n/*--------------------------------------------------------------------------*/\nint stream_read(int hdl, void *buffer, long nbytes)\n/*\n     reading from stdin stream \n*/\n\n{\n    long nread;\n    \n    if (hdl != 1)\n       return(1);  /* can only read from stdin */\n\n    nread = (long) fread(buffer, 1, nbytes, stdin);\n\n    if (nread != nbytes)\n    {\n/*        return(READ_ERROR); */\n        return(END_OF_FILE);\n    }\n\n    return(0);\n}\n/*--------------------------------------------------------------------------*/\nint stream_write(int hdl, void *buffer, long nbytes)\n/*\n  write bytes at the current position in the file\n*/\n{\n    if (hdl != 2)\n       return(1);  /* can only write to stdout */\n\n    if((long) fwrite(buffer, 1, nbytes, stdout) != nbytes)\n        return(WRITE_ERROR);\n\n    return(0);\n}\n\n\n\n\n"},{"id":16709,"name":"putcolsb.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, putcolsb.c, contains routines that write data elements to   */\n/*  a FITS image or table with signed char (signed byte) datatype.         */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <limits.h>\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffpprsb( fitsfile *fptr,  /* I - FITS file pointer                      */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            signed char *array, /* I - array of values that are written     */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n    signed char nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_pixels(fptr, TSBYTE, firstelem, nelem,\n            0, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpclsb(fptr, 2, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffppnsb( fitsfile *fptr,  /* I - FITS file pointer                      */\n            long  group,     /* I - group to write(1 = 1st group)           */\n            LONGLONG  firstelem, /* I - first vector element to write(1 = 1st)  */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            signed char *array, /* I - array of values that are written     */\n            signed char nulval, /* I - undefined pixel value                */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).  Any array values\n  that are equal to the value of nulval will be replaced with the null\n  pixel value that is appropriate for this column.\n*/\n{\n    long row;\n    signed char nullvalue;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        nullvalue = nulval;  /* set local variable */\n        fits_write_compressed_pixels(fptr, TSBYTE, firstelem, nelem,\n            1, array, &nullvalue, status);\n        return(*status);\n    }\n\n    row=maxvalue(1,group);\n\n    ffpcnsb(fptr, 2, row, firstelem, nelem, array, nulval, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp2dsb(fitsfile *fptr,   /* I - FITS file pointer                    */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           signed char *array, /* I - array to be written                 */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    /* call the 3D writing routine, with the 3rd dimension = 1 */\n\n    ffp3dsb(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffp3dsb(fitsfile *fptr,   /* I - FITS file pointer                    */\n           long  group,      /* I - group to write(1 = 1st group)         */\n           LONGLONG  ncols,      /* I - number of pixels in each row of array */\n           LONGLONG  nrows,      /* I - number of rows in each plane of array */\n           LONGLONG  naxis1,     /* I - FITS image NAXIS1 value               */\n           LONGLONG  naxis2,     /* I - FITS image NAXIS2 value               */\n           LONGLONG  naxis3,     /* I - FITS image NAXIS3 value               */\n           signed char *array, /* I - array to be written                 */\n           int  *status)     /* IO - error status                         */\n/*\n  Write an entire 3-D cube of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being written).\n*/\n{\n    long tablerow, ii, jj;\n    long fpixel[3]= {1,1,1}, lpixel[3];\n    LONGLONG nfits, narray;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n           \n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n        lpixel[0] = (long) ncols;\n        lpixel[1] = (long) nrows;\n        lpixel[2] = (long) naxis3;\n       \n        fits_write_compressed_img(fptr, TSBYTE, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n      /* all the image pixels are contiguous, so write all at once */\n      ffpclsb(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status);\n      return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to write to */\n    narray = 0;  /* next pixel in input array to be written */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* writing naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffpclsb(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0)\n         return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpsssb(fitsfile *fptr,   /* I - FITS file pointer                      */\n           long  group,      /* I - group to write(1 = 1st group)           */\n           long  naxis,      /* I - number of data axes in array            */\n           long  *naxes,     /* I - size of each FITS axis                  */\n           long  *fpixel,    /* I - 1st pixel in each axis to write (1=1st) */\n           long  *lpixel,    /* I - last pixel in each axis to write        */\n           signed char *array, /* I - array to be written                   */\n           int  *status)     /* IO - error status                           */\n/*\n  Write a subsection of pixels to the primary array or image.\n  A subsection is defined to be any contiguous rectangular\n  array of pixels within the n-dimensional FITS data file.\n  Data conversion and scaling will be performed if necessary \n  (e.g, if the datatype of the FITS array is not the same as\n  the array being written).\n*/\n{\n    long tablerow;\n    LONGLONG fpix[7], dimen[7], astart, pstart;\n    LONGLONG off2, off3, off4, off5, off6, off7;\n    LONGLONG st10, st20, st30, st40, st50, st60, st70;\n    LONGLONG st1, st2, st3, st4, st5, st6, st7;\n    long ii, i1, i2, i3, i4, i5, i6, i7, irange[7];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_write_compressed_img(fptr, TSBYTE, fpixel, lpixel,\n            0,  array, NULL, status);\n    \n        return(*status);\n    }\n\n    if (naxis < 1 || naxis > 7)\n      return(*status = BAD_DIMEN);\n\n    tablerow=maxvalue(1,group);\n\n     /* calculate the size and number of loops to perform in each dimension */\n    for (ii = 0; ii < 7; ii++)\n    {\n      fpix[ii]=1;\n      irange[ii]=1;\n      dimen[ii]=1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {    \n      fpix[ii]=fpixel[ii];\n      irange[ii]=lpixel[ii]-fpixel[ii]+1;\n      dimen[ii]=naxes[ii];\n    }\n\n    i1=irange[0];\n\n    /* compute the pixel offset between each dimension */\n    off2 =     dimen[0];\n    off3 = off2 * dimen[1];\n    off4 = off3 * dimen[2];\n    off5 = off4 * dimen[3];\n    off6 = off5 * dimen[4];\n    off7 = off6 * dimen[5];\n\n    st10 = fpix[0];\n    st20 = (fpix[1] - 1) * off2;\n    st30 = (fpix[2] - 1) * off3;\n    st40 = (fpix[3] - 1) * off4;\n    st50 = (fpix[4] - 1) * off5;\n    st60 = (fpix[5] - 1) * off6;\n    st70 = (fpix[6] - 1) * off7;\n\n    /* store the initial offset in each dimension */\n    st1 = st10;\n    st2 = st20;\n    st3 = st30;\n    st4 = st40;\n    st5 = st50;\n    st6 = st60;\n    st7 = st70;\n\n    astart = 0;\n\n    for (i7 = 0; i7 < irange[6]; i7++)\n    {\n     for (i6 = 0; i6 < irange[5]; i6++)\n     {\n      for (i5 = 0; i5 < irange[4]; i5++)\n      {\n       for (i4 = 0; i4 < irange[3]; i4++)\n       {\n        for (i3 = 0; i3 < irange[2]; i3++)\n        {\n         pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7;\n\n         for (i2 = 0; i2 < irange[1]; i2++)\n         {\n           if (ffpclsb(fptr, 2, tablerow, pstart, i1, &array[astart],\n              status) > 0)\n              return(*status);\n\n           astart += i1;\n           pstart += off2;\n         }\n         st2 = st20;\n         st3 = st3+off3;    \n        }\n        st3 = st30;\n        st4 = st4+off4;\n       }\n       st4 = st40;\n       st5 = st5+off5;\n      }\n      st5 = st50;\n      st6 = st6+off6;\n     }\n     st6 = st60;\n     st7 = st7+off7;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpgpsb( fitsfile *fptr,   /* I - FITS file pointer                     */\n            long  group,      /* I - group to write(1 = 1st group)          */\n            long  firstelem,  /* I - first vector element to write(1 = 1st) */\n            long  nelem,      /* I - number of values to write              */\n            signed char *array, /* I - array of values that are written     */\n            int  *status)     /* IO - error status                          */\n/*\n  Write an array of group parameters to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being written).\n*/\n{\n    long row;\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffpclsb(fptr, 1L, row, firstelem, nelem, array, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpclsb( fitsfile *fptr,  /* I - FITS file pointer                      */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            signed char *array, /* I - array of values to write             */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of values to a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer to a virtual column in a 1 or more grouped FITS primary\n  array.  FITSIO treats a primary array as a binary table with\n  2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    int tcode, maxelem, hdutype;\n    long twidth, incre;\n    long ntodo;\n    LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull;\n    double scale, zero;\n    char tform[20], cform[20];\n    char message[FLEN_ERRMSG];\n\n    char snull[20];   /*  the FITS null value  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n\n    if (tcode == TSTRING)   \n         ffcfmt(tform, cform);     /* derive C format for writing strings */\n\n    /*---------------------------------------------------------------------*/\n    /*  Now write the pixels to the FITS column.                           */\n    /*  First call the ffXXfYY routine to  (1) convert the datatype        */\n    /*  if necessary, and (2) scale the values by the FITS TSCALn and      */\n    /*  TZEROn linear scaling parameters into a temporary buffer.          */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to write  */\n    next = 0;                 /* next element in array to be written  */\n    rownum = 0;               /* row number, relative to firstrow     */\n\n    while (remain)\n    {\n        /* limit the number of pixels to process a one time to the number that\n           will fit in the buffer space or to the number of pixels that remain\n           in the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);      \n        ntodo = (long) minvalue(ntodo, (repeat - elemnum));\n\n        wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre);\n        ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */\n\n        switch (tcode) \n        {\n            case (TBYTE):\n\n                /* convert the raw data before writing to FITS file */\n                ffs1fi1(&array[next], ntodo, scale, zero,\n                        (unsigned char *) buffer, status);\n                ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status);\n\n              break;\n\n            case (TLONGLONG):\n\n                ffs1fi8(&array[next], ntodo, scale, zero,\n                        (LONGLONG *) buffer, status);\n                ffpi8b(fptr, ntodo, incre, (long *) buffer, status);\n                break;\n\n            case (TSHORT):\n \n                ffs1fi2(&array[next], ntodo, scale, zero,\n                        (short *) buffer, status);\n                ffpi2b(fptr, ntodo, incre, (short *) buffer, status);\n                break;\n\n            case (TLONG):\n\n                ffs1fi4(&array[next], ntodo, scale, zero,\n                        (INT32BIT *) buffer, status);\n                ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status);\n                break;\n\n            case (TFLOAT):\n\n                ffs1fr4(&array[next], ntodo, scale, zero,\n                        (float *)  buffer, status);\n                ffpr4b(fptr, ntodo, incre, (float *) buffer, status);\n                break;\n\n            case (TDOUBLE):\n                ffs1fr8(&array[next], ntodo, scale, zero,\n                        (double *) buffer, status);\n                ffpr8b(fptr, ntodo, incre, (double *) buffer, status);\n                break;\n\n            case (TSTRING):  /* numerical column in an ASCII table */\n\n                if (strchr(tform,'A'))\n                {\n                    /* write raw input bytes without conversion        */\n                    /* This case is a hack to let users write a stream */\n                    /* of bytes directly to the 'A' format column      */\n\n                    if (incre == twidth)\n                        ffpbyt(fptr, ntodo, &array[next], status);\n                    else\n                        ffpbytoff(fptr, twidth, ntodo/twidth, incre - twidth, \n                                &array[next], status);\n                    break;\n                }\n                else if (cform[1] != 's')  /*  \"%s\" format is a string */\n                {\n                  ffs1fstr(&array[next], ntodo, scale, zero, cform,\n                          twidth, (char *) buffer, status);\n\n                  if (incre == twidth)    /* contiguous bytes */\n                     ffpbyt(fptr, ntodo * twidth, buffer, status);\n                  else\n                     ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                            status);\n                  break;\n                }\n                /* can't write to string column, so fall thru to default: */\n\n            default:  /*  error trap  */\n                snprintf(message, FLEN_ERRMSG,\n                       \"Cannot write numbers to column %d which has format %s\",\n                        colnum,tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous write operation */\n        {\n          snprintf(message,FLEN_ERRMSG,\n          \"Error writing elements %.0f thru %.0f of input data array (ffpclsb).\",\n              (double) (next+1), (double) (next+ntodo));\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum += ntodo;\n            if (elemnum == repeat)  /* completed a row; start on next row */\n            {\n                elemnum = 0;\n                rownum++;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n      ffpmsg(\n      \"Numerical overflow during type conversion while writing FITS data.\");\n      *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcnsb( fitsfile *fptr,  /* I - FITS file pointer                      */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            signed char *array,   /* I - array of values to write           */\n            signed char nulvalue, /* I - flag for undefined pixels          */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of elements to the specified column of a table.  Any input\n  pixels equal to the value of nulvalue will be replaced by the appropriate\n  null value in the output FITS file. \n\n  The input array of values will be converted to the datatype of the column \n  and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary\n*/\n{\n    tcolumn *colptr;\n    LONGLONG  ngood = 0, nbad = 0, ii;\n    LONGLONG repeat, first, fstelm, fstrow;\n    int tcode, overflow = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n    }\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n\n    tcode  = colptr->tdatatype;\n\n    if (tcode > 0)\n       repeat = colptr->trepeat;  /* repeat count for this column */\n    else\n       repeat = firstelem -1 + nelem;  /* variable length arrays */\n\n    /* if variable length array, first write the whole input vector, \n       then go back and fill in the nulls */\n    if (tcode < 0) {\n      if (ffpclsb(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) {\n        if (*status == NUM_OVERFLOW) \n\t{\n\t  /* ignore overflows, which are possibly the null pixel values */\n\t  /*  overflow = 1;   */\n\t  *status = 0;\n\t} else { \n          return(*status);\n\t}\n      }\n    }\n\n    /* absolute element number in the column */\n    first = (firstrow - 1) * repeat + firstelem;\n\n    for (ii = 0; ii < nelem; ii++)\n    {\n      if (array[ii] != nulvalue)  /* is this a good pixel? */\n      {\n         if (nbad)  /* write previous string of bad pixels */\n         {\n            fstelm = ii - nbad + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0)\n                return(*status);\n\n            nbad=0;\n         }\n\n         ngood = ngood + 1;  /* the consecutive number of good pixels */\n      }\n      else\n      {\n         if (ngood)  /* write previous string of good pixels */\n         {\n            fstelm = ii - ngood + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (tcode > 0) {  /* variable length arrays have already been written */\n              if (ffpclsb(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood],\n                status) > 0) {\n\t\tif (*status == NUM_OVERFLOW) \n\t\t{\n\t\t  overflow = 1;\n\t\t  *status = 0;\n\t\t} else { \n                  return(*status);\n\t\t}\n\t      }\n\t    }\n            ngood=0;\n         }\n\n         nbad = nbad + 1;  /* the consecutive number of bad pixels */\n      }\n    }\n\n    /* finished loop;  now just write the last set of pixels */\n\n    if (ngood)  /* write last string of good pixels */\n    {\n      fstelm = ii - ngood + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      if (tcode > 0) {  /* variable length arrays have already been written */\n        ffpclsb(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status);\n      }\n    }\n    else if (nbad) /* write last string of bad pixels */\n    {\n      fstelm = ii - nbad + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      ffpclu(fptr, colnum, fstrow, fstelm, nbad, status);\n    }\n\n    if (*status <= 0) {\n      if (overflow) {\n        *status = NUM_OVERFLOW;\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffs1fi1(signed char *input,    /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            unsigned char *output, /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == -128.)\n    {\n        /* Instead of adding 128, it is more efficient */\n        /* to just flip the sign bit with the XOR operator */\n\n        for (ii = 0; ii < ntodo; ii++)\n             output[ii] =  ( *(unsigned char *) &input[ii] ) ^ 0x80;\n    }\n    else if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n            if (input[ii] < 0)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else\n                output[ii] = (unsigned char) input[ii];\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = ( ((double) input[ii]) - zero) / scale;\n\n            if (dvalue < DUCHAR_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = 0;\n            }\n            else if (dvalue > DUCHAR_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = UCHAR_MAX;\n            }\n            else\n                output[ii] = (unsigned char) (dvalue + .5);\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffs1fi2(signed char *input,    /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            short *output,         /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = input[ii];   /* just copy input to output */\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (((double) input[ii]) - zero) / scale;\n\n            if (dvalue < DSHRT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MIN;\n            }\n            else if (dvalue > DSHRT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = SHRT_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (short) (dvalue + .5);\n                else\n                    output[ii] = (short) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffs1fi4(signed char *input,    /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            INT32BIT *output,      /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (INT32BIT) input[ii];   /* copy input to output */\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (((double) input[ii]) - zero) / scale;\n\n            if (dvalue < DINT_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MIN;\n            }\n            else if (dvalue > DINT_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = INT32_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (INT32BIT) (dvalue + .5);\n                else\n                    output[ii] = (INT32BIT) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffs1fi8(signed char *input,   /* I - array of values to be converted  */\n            long ntodo,           /* I - number of elements in the array  */\n            double scale,         /* I - FITS TSCALn or BSCALE value      */\n            double zero,          /* I - FITS TZEROn or BZERO  value      */\n            LONGLONG *output,     /* O - output array of converted values */\n            int *status)          /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (scale == 1. && zero ==  9223372036854775808.)\n    {       \n        /* Writing to unsigned long long column. Input values must not be negative */\n        /* Instead of subtracting 9223372036854775808, it is more efficient */\n        /* and more precise to just flip the sign bit with the XOR operator */\n\n        for (ii = 0; ii < ntodo; ii++) {\n           if (input[ii] < 0) {\n              *status = OVERFLOW_ERR;\n              output[ii] = LONGLONG_MIN;\n           } else {\n              output[ii] =  ((LONGLONG) input[ii]) ^ 0x8000000000000000;\n           }\n        }\n    }\n    else if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n            dvalue = (input[ii] - zero) / scale;\n\n            if (dvalue < DLONGLONG_MIN)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MIN;\n            }\n            else if (dvalue > DLONGLONG_MAX)\n            {\n                *status = OVERFLOW_ERR;\n                output[ii] = LONGLONG_MAX;\n            }\n            else\n            {\n                if (dvalue >= 0)\n                    output[ii] = (LONGLONG) (dvalue + .5);\n                else\n                    output[ii] = (LONGLONG) (dvalue - .5);\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffs1fr4(signed char *input,    /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            float *output,         /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (float) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = (float) (( ( (double) input[ii] ) - zero) / scale);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffs1fr8(signed char *input,    /* I - array of values to be converted  */\n            long ntodo,            /* I - number of elements in the array  */\n            double scale,          /* I - FITS TSCALn or BSCALE value      */\n            double zero,           /* I - FITS TZEROn or BZERO  value      */\n            double *output,        /* O - output array of converted values */\n            int *status)           /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do datatype conversion and scaling if required.\n*/\n{\n    long ii;\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (double) input[ii];\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n            output[ii] = ( ( (double) input[ii] ) - zero) / scale;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffs1fstr(signed char *input, /* I - array of values to be converted  */\n            long ntodo,        /* I - number of elements in the array  */\n            double scale,      /* I - FITS TSCALn or BSCALE value      */\n            double zero,       /* I - FITS TZEROn or BZERO  value      */\n            char *cform,       /* I - format for output string values  */\n            long twidth,       /* I - width of each field, in chars    */\n            char *output,      /* O - output array of converted values */\n            int *status)       /* IO - error status                    */\n/*\n  Copy input to output prior to writing output to a FITS file.\n  Do scaling if required.\n*/\n{\n    long ii;\n    double dvalue;\n    char *cptr;\n    \n    cptr = output;\n\n\n    if (scale == 1. && zero == 0.)\n    {       \n        for (ii = 0; ii < ntodo; ii++)\n        {\n           sprintf(output, cform, (double) input[ii]);\n           output += twidth;\n\n           if (*output)  /* if this char != \\0, then overflow occurred */\n              *status = OVERFLOW_ERR;\n        }\n    }\n    else\n    {\n        for (ii = 0; ii < ntodo; ii++)\n        {\n          dvalue = ((double) input[ii] - zero) / scale;\n          sprintf(output, cform, dvalue);\n          output += twidth;\n\n          if (*output)  /* if this char != \\0, then overflow occurred */\n            *status = OVERFLOW_ERR;\n        }\n    }\n\n    /* replace any commas with periods (e.g., in French locale) */\n    while ((cptr = strchr(cptr, ','))) *cptr = '.';\n    \n    return(*status);\n}\n"},{"id":16710,"name":"pliocomp.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/* stdlib is needed for the abs function */\n#include <stdlib.h>\n/*\n   The following prototype code was provided by Doug Tody, NRAO, for\n   performing conversion between pixel arrays and line lists.  The\n   compression technique is used in IRAF.\n*/\nint pl_p2li (int *pxsrc, int xs, short *lldst, int npix);\nint pl_l2pi (short *ll_src, int xs, int *px_dst, int npix);\n\n\n/*\n * PL_P2L -- Convert a pixel array to a line list.  The length of the list is\n * returned as the function value.\n *\n * Translated from the SPP version using xc -f, f2c.  8Sep99 DCT.\n */\n\n#ifndef min\n#define min(a,b)        (((a)<(b))?(a):(b))\n#endif\n#ifndef max\n#define max(a,b)        (((a)>(b))?(a):(b))\n#endif\n\nint pl_p2li (int *pxsrc, int xs, short *lldst, int npix)\n/* int *pxsrc;                      input pixel array */\n/* int xs;                          starting index in pxsrc (?) */\n/* short *lldst;                    encoded line list */\n/* int npix;                        number of pixels to convert */\n{\n    /* System generated locals */\n    int ret_val, i__1, i__2, i__3;\n\n    /* Local variables */\n    int zero, v, x1, hi, ip, dv, xe, np, op, iz, nv = 0, pv, nz;\n\n    /* Parameter adjustments */\n    --lldst;\n    --pxsrc;\n\n    /* Function Body */\n    if (! (npix <= 0)) {\n        goto L110;\n    }\n    ret_val = 0;\n    goto L100;\nL110:\n    lldst[3] = -100;\n    lldst[2] = 7;\n    lldst[1] = 0;\n    lldst[6] = 0;\n    lldst[7] = 0;\n    xe = xs + npix - 1;\n    op = 8;\n    zero = 0;\n/* Computing MAX */\n    i__1 = zero, i__2 = pxsrc[xs];\n    pv = max(i__1,i__2);\n    x1 = xs;\n    iz = xs;\n    hi = 1;\n    i__1 = xe;\n    for (ip = xs; ip <= i__1; ++ip) {\n        if (! (ip < xe)) {\n            goto L130;\n        }\n/* Computing MAX */\n        i__2 = zero, i__3 = pxsrc[ip + 1];\n        nv = max(i__2,i__3);\n        if (! (nv == pv)) {\n            goto L140;\n        }\n        goto L120;\nL140:\n        if (! (pv == 0)) {\n            goto L150;\n        }\n        pv = nv;\n        x1 = ip + 1;\n        goto L120;\nL150:\n        goto L131;\nL130:\n        if (! (pv == 0)) {\n            goto L160;\n        }\n        x1 = xe + 1;\nL160:\nL131:\n        np = ip - x1 + 1;\n        nz = x1 - iz;\n        if (! (pv > 0)) {\n            goto L170;\n        }\n        dv = pv - hi;\n        if (! (dv != 0)) {\n            goto L180;\n        }\n        hi = pv;\n        if (! (abs(dv) > 4095)) {\n            goto L190;\n        }\n        lldst[op] = (short) ((pv & 4095) + 4096);\n        ++op;\n        lldst[op] = (short) (pv / 4096);\n        ++op;\n        goto L191;\nL190:\n        if (! (dv < 0)) {\n            goto L200;\n        }\n        lldst[op] = (short) (-dv + 12288);\n        goto L201;\nL200:\n        lldst[op] = (short) (dv + 8192);\nL201:\n        ++op;\n        if (! (np == 1 && nz == 0)) {\n            goto L210;\n        }\n        v = lldst[op - 1];\n        lldst[op - 1] = (short) (v | 16384);\n        goto L91;\nL210:\nL191:\nL180:\nL170:\n        if (! (nz > 0)) {\n            goto L220;\n        }\nL230:\n        if (! (nz > 0)) {\n            goto L232;\n        }\n        lldst[op] = (short) min(4095,nz);\n        ++op;\n/* L231: */\n        nz += -4095;\n        goto L230;\nL232:\n        if (! (np == 1 && pv > 0)) {\n            goto L240;\n        }\n        lldst[op - 1] = (short) (lldst[op - 1] + 20481);\n        goto L91;\nL240:\nL220:\nL250:\n        if (! (np > 0)) {\n            goto L252;\n        }\n        lldst[op] = (short) (min(4095,np) + 16384);\n        ++op;\n/* L251: */\n        np += -4095;\n        goto L250;\nL252:\nL91:\n        x1 = ip + 1;\n        iz = x1;\n        pv = nv;\nL120:\n        ;\n    }\n/* L121: */\n    lldst[4] = (short) ((op - 1) % 32768);\n    lldst[5] = (short) ((op - 1) / 32768);\n    ret_val = op - 1;\n    goto L100;\nL100:\n    return ret_val;\n} /* plp2li_ */\n\n/*\n * PL_L2PI -- Translate a PLIO line list into an integer pixel array.\n * The number of pixels output (always npix) is returned as the function\n * value.\n *\n * Translated from the SPP version using xc -f, f2c.  8Sep99 DCT.\n */\n\nint pl_l2pi (short *ll_src, int xs, int *px_dst, int npix)\n/* short *ll_src;                   encoded line list */\n/* int xs;                          starting index in ll_src */\n/* int *px_dst;                    output pixel array */\n/* int npix;                       number of pixels to convert */\n{\n    /* System generated locals */\n    int ret_val, i__1, i__2;\n\n    /* Local variables */\n    int data, sw0001, otop, i__, lllen, i1, i2, x1, x2, ip, xe, np,\n             op, pv, opcode, llfirt;\n    int skipwd;\n\n    /* Parameter adjustments */\n    --px_dst;\n    --ll_src;\n\n    /* Function Body */\n    if (! (ll_src[3] > 0)) {\n        goto L110;\n    }\n    lllen = ll_src[3];\n    llfirt = 4;\n    goto L111;\nL110:\n    lllen = (ll_src[5] << 15) + ll_src[4];\n    llfirt = ll_src[2] + 1;\nL111:\n    if (! (npix <= 0 || lllen <= 0)) {\n        goto L120;\n    }\n    ret_val = 0;\n    goto L100;\nL120:\n    xe = xs + npix - 1;\n    skipwd = 0;\n    op = 1;\n    x1 = 1;\n    pv = 1;\n    i__1 = lllen;\n    for (ip = llfirt; ip <= i__1; ++ip) {\n        if (! skipwd) {\n            goto L140;\n        }\n        skipwd = 0;\n        goto L130;\nL140:\n        opcode = ll_src[ip] / 4096;\n        data = ll_src[ip] & 4095;\n        sw0001 = opcode;\n        goto L150;\nL160:\n        x2 = x1 + data - 1;\n        i1 = max(x1,xs);\n        i2 = min(x2,xe);\n        np = i2 - i1 + 1;\n        if (! (np > 0)) {\n            goto L170;\n        }\n        otop = op + np - 1;\n        if (! (opcode == 4)) {\n            goto L180;\n        }\n        i__2 = otop;\n        for (i__ = op; i__ <= i__2; ++i__) {\n            px_dst[i__] = pv;\n/* L190: */\n        }\n/* L191: */\n        goto L181;\nL180:\n        i__2 = otop;\n        for (i__ = op; i__ <= i__2; ++i__) {\n            px_dst[i__] = 0;\n/* L200: */\n        }\n/* L201: */\n        if (! (opcode == 5 && i2 == x2)) {\n            goto L210;\n        }\n        px_dst[otop] = pv;\nL210:\nL181:\n        op = otop + 1;\nL170:\n        x1 = x2 + 1;\n        goto L151;\nL220:\n        pv = (ll_src[ip + 1] << 12) + data;\n        skipwd = 1;\n        goto L151;\nL230:\n        pv += data;\n        goto L151;\nL240:\n        pv -= data;\n        goto L151;\nL250:\n        pv += data;\n        goto L91;\nL260:\n        pv -= data;\nL91:\n        if (! (x1 >= xs && x1 <= xe)) {\n            goto L270;\n        }\n        px_dst[op] = pv;\n        ++op;\nL270:\n        ++x1;\n        goto L151;\nL150:\n        ++sw0001;\n        if (sw0001 < 1 || sw0001 > 8) {\n            goto L151;\n        }\n        switch ((int)sw0001) {\n            case 1:  goto L160;\n            case 2:  goto L220;\n            case 3:  goto L230;\n            case 4:  goto L240;\n            case 5:  goto L160;\n            case 6:  goto L160;\n            case 7:  goto L250;\n            case 8:  goto L260;\n        }\nL151:\n        if (! (x1 > xe)) {\n            goto L280;\n        }\n        goto L131;\nL280:\nL130:\n        ;\n    }\nL131:\n    i__1 = npix;\n    for (i__ = op; i__ <= i__1; ++i__) {\n        px_dst[i__] = 0;\n/* L290: */\n    }\n/* L291: */\n    ret_val = npix;\n    goto L100;\nL100:\n    return ret_val;\n} /* pll2pi_ */\n\n"},{"id":16711,"name":"getcoli.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, getcoli.c, contains routines that read data elements from   */\n/*  a FITS image or table, with short datatype.                            */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <math.h>\n#include <stdlib.h>\n#include <limits.h>\n#include <string.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffgpvi( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            short nulval,     /* I - value for undefined pixels              */\n            short *array,     /* O - array of values that are returned       */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Undefined elements will be set equal to NULVAL, unless NULVAL=0\n  in which case no checking for undefined values will be performed.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    char cdummy;\n    int nullcheck = 1;\n    short nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n         nullvalue = nulval;  /* set local variable */\n        fits_read_compressed_pixels(fptr, TSHORT, firstelem, nelem,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcli(fptr, 2, row, firstelem, nelem, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgpfi( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            short *array,     /* O - array of values that are returned       */\n            char *nularray,   /* O - array of null pixel flags               */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Any undefined pixels in the returned array will be set = 0 and the \n  corresponding nularray value will be set = 1.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    long row;\n    int nullcheck = 2;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_read_compressed_pixels(fptr, TSHORT, firstelem, nelem,\n            nullcheck, NULL, array, nularray, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcli(fptr, 2, row, firstelem, nelem, 1, 2, 0,\n               array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg2di(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           short nulval,    /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           short *array,    /* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 2-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    /* call the 3D reading routine, with the 3rd dimension = 1 */\n\n    ffg3di(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, \n           anynul, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffg3di(fitsfile *fptr,  /* I - FITS file pointer                       */\n           long  group,     /* I - group to read (1 = 1st group)           */\n           short nulval,    /* set undefined pixels equal to this          */\n           LONGLONG  ncols,     /* I - number of pixels in each row of array   */\n           LONGLONG  nrows,     /* I - number of rows in each plane of array   */\n           LONGLONG  naxis1,    /* I - FITS image NAXIS1 value                 */\n           LONGLONG  naxis2,    /* I - FITS image NAXIS2 value                 */\n           LONGLONG  naxis3,    /* I - FITS image NAXIS3 value                 */\n           short *array,    /* O - array to be filled and returned         */\n           int  *anynul,    /* O - set to 1 if any values are null; else 0 */\n           int  *status)    /* IO - error status                           */\n/*\n  Read an entire 3-D array of values to the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of the\n  FITS array is not the same as the array being read).  Any null\n  values in the array will be set equal to the value of nulval, unless\n  nulval = 0 in which case no null checking will be performed.\n*/\n{\n    long tablerow, ii, jj;\n    LONGLONG nfits, narray;\n    char cdummy;\n    int nullcheck = 1;\n    long inc[] = {1,1,1};\n    LONGLONG fpixel[] = {1,1,1};\n    LONGLONG lpixel[3];\n    short nullvalue;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        lpixel[0] = ncols;\n        lpixel[1] = nrows;\n        lpixel[2] = naxis3;\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TSHORT, fpixel, lpixel, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n    tablerow=maxvalue(1,group);\n\n    if (ncols == naxis1 && nrows == naxis2)  /* arrays have same size? */\n    {\n       /* all the image pixels are contiguous, so read all at once */\n       ffgcli(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval,\n               array, &cdummy, anynul, status);\n       return(*status);\n    }\n\n    if (ncols < naxis1 || nrows < naxis2)\n       return(*status = BAD_DIMEN);\n\n    nfits = 1;   /* next pixel in FITS image to read */\n    narray = 0;  /* next pixel in output array to be filled */\n\n    /* loop over naxis3 planes in the data cube */\n    for (jj = 0; jj < naxis3; jj++)\n    {\n      /* loop over the naxis2 rows in the FITS image, */\n      /* reading naxis1 pixels to each row            */\n\n      for (ii = 0; ii < naxis2; ii++)\n      {\n       if (ffgcli(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval,\n          &array[narray], &cdummy, anynul, status) > 0)\n          return(*status);\n\n       nfits += naxis1;\n       narray += ncols;\n      }\n      narray += (nrows - naxis2) * ncols;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsvi(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           short nulval,   /* I - value to set undefined pixels             */\n           short *array,   /* O - array to be filled and returned           */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dir[9];\n    long nelem, nultyp, ninc, numcol;\n    LONGLONG felem, dsize[10], blcll[9], trcll[9];\n    int hdutype, anyf;\n    char ldummy, msg[FLEN_ERRMSG];\n    int nullcheck = 1;\n    short nullvalue;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg,FLEN_ERRMSG, \"NAXIS = %d in call to ffgsvi is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        nullvalue = nulval;  /* set local variable */\n\n        fits_read_compressed_img(fptr, TSHORT, blcll, trcll, inc,\n            nullcheck, &nullvalue, array, NULL, anynul, status);\n\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 1;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n        dir[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        if (hdutype == IMAGE_HDU)\n        {\n           dir[ii] = -1;\n        }\n        else\n        {\n          snprintf(msg, FLEN_ERRMSG,\"ffgsvi: illegal range specified for axis %ld\", ii + 1);\n          ffpmsg(msg);\n          return(*status = BAD_PIX_NUM);\n        }\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n      dsize[ii] = dsize[ii] * dir[ii];\n    }\n    dsize[naxis] = dsize[naxis] * dir[naxis];\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0]*dir[0] - str[0]*dir[0]) / inc[0] + 1;\n      ninc = incr[0] * dir[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]*dir[8]; i8 <= stp[8]*dir[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]*dir[7]; i7 <= stp[7]*dir[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]*dir[6]; i6 <= stp[6]*dir[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]*dir[5]; i5 <= stp[5]*dir[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]*dir[4]; i4 <= stp[4]*dir[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]*dir[3]; i3 <= stp[3]*dir[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]*dir[2]; i2 <= stp[2]*dir[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]*dir[1]; i1 <= stp[1]*dir[1]; i1 += incr[1])\n            {\n\n              felem=str[0] + (i1 - dir[1]) * dsize[1] + (i2 - dir[2]) * dsize[2] + \n                             (i3 - dir[3]) * dsize[3] + (i4 - dir[4]) * dsize[4] +\n                             (i5 - dir[5]) * dsize[5] + (i6 - dir[6]) * dsize[6] +\n                             (i7 - dir[7]) * dsize[7] + (i8 - dir[8]) * dsize[8];\n\n              if ( ffgcli(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &ldummy, &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsfi(fitsfile *fptr, /* I - FITS file pointer                         */\n           int  colnum,    /* I - number of the column to read (1 = 1st)    */\n           int naxis,      /* I - number of dimensions in the FITS array    */\n           long  *naxes,   /* I - size of each dimension                    */\n           long  *blc,     /* I - 'bottom left corner' of the subsection    */\n           long  *trc,     /* I - 'top right corner' of the subsection      */\n           long  *inc,     /* I - increment to be applied in each dimension */\n           short *array,   /* O - array to be filled and returned           */\n           char *flagval,  /* O - set to 1 if corresponding value is null   */\n           int  *anynul,   /* O - set to 1 if any values are null; else 0   */\n           int  *status)   /* IO - error status                             */\n/*\n  Read a subsection of data values from an image or a table column.\n  This routine is set up to handle a maximum of nine dimensions.\n*/\n{\n    long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc;\n    long str[9],stp[9],incr[9],dsize[10];\n    LONGLONG blcll[9], trcll[9];\n    long felem, nelem, nultyp, ninc, numcol;\n    int hdutype, anyf;\n    short nulval = 0;\n    char msg[FLEN_ERRMSG];\n    int nullcheck = 2;\n\n    if (naxis < 1 || naxis > 9)\n    {\n        snprintf(msg, FLEN_ERRMSG,\"NAXIS = %d in call to ffgsvi is out of range\", naxis);\n        ffpmsg(msg);\n        return(*status = BAD_DIMEN);\n    }\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        for (ii=0; ii < naxis; ii++) {\n\t    blcll[ii] = blc[ii];\n\t    trcll[ii] = trc[ii];\n\t}\n\n        fits_read_compressed_img(fptr, TSHORT, blcll, trcll, inc,\n            nullcheck, NULL, array, flagval, anynul, status);\n        return(*status);\n    }\n\n/*\n    if this is a primary array, then the input COLNUM parameter should\n    be interpreted as the row number, and we will alway read the image\n    data from column 2 (any group parameters are in column 1).\n*/\n    if (ffghdt(fptr, &hdutype, status) > 0)\n        return(*status);\n\n    if (hdutype == IMAGE_HDU)\n    {\n        /* this is a primary array, or image extension */\n        if (colnum == 0)\n        {\n            rstr = 1;\n            rstp = 1;\n        }\n        else\n        {\n            rstr = colnum;\n            rstp = colnum;\n        }\n        rinc = 1;\n        numcol = 2;\n    }\n    else\n    {\n        /* this is a table, so the row info is in the (naxis+1) elements */\n        rstr = blc[naxis];\n        rstp = trc[naxis];\n        rinc = inc[naxis];\n        numcol = colnum;\n    }\n\n    nultyp = 2;\n    if (anynul)\n        *anynul = FALSE;\n\n    i0 = 0;\n    for (ii = 0; ii < 9; ii++)\n    {\n        str[ii] = 1;\n        stp[ii] = 1;\n        incr[ii] = 1;\n        dsize[ii] = 1;\n    }\n\n    for (ii = 0; ii < naxis; ii++)\n    {\n      if (trc[ii] < blc[ii])\n      {\n        snprintf(msg, FLEN_ERRMSG,\"ffgsvi: illegal range specified for axis %ld\", ii + 1);\n        ffpmsg(msg);\n        return(*status = BAD_PIX_NUM);\n      }\n\n      str[ii] = blc[ii];\n      stp[ii] = trc[ii];\n      incr[ii] = inc[ii];\n      dsize[ii + 1] = dsize[ii] * naxes[ii];\n    }\n\n    if (naxis == 1 && naxes[0] == 1)\n    {\n      /* This is not a vector column, so read all the rows at once */\n      nelem = (rstp - rstr) / rinc + 1;\n      ninc = rinc;\n      rstp = rstr;\n    }\n    else\n    {\n      /* have to read each row individually, in all dimensions */\n      nelem = (stp[0] - str[0]) / inc[0] + 1;\n      ninc = incr[0];\n    }\n\n    for (row = rstr; row <= rstp; row += rinc)\n    {\n     for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8])\n     {\n      for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7])\n      {\n       for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6])\n       {\n        for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5])\n        {\n         for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4])\n         {\n          for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3])\n          {\n           for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2])\n           {\n            for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1])\n            {\n              felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + \n                             (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] +\n                             (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] +\n                             (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8];\n\n              if ( ffgcli(fptr, numcol, row, felem, nelem, ninc, nultyp,\n                   nulval, &array[i0], &flagval[i0], &anyf, status) > 0)\n                   return(*status);\n\n              if (anyf && anynul)\n                  *anynul = TRUE;\n\n              i0 += nelem;\n            }\n           }\n          }\n         }\n        }\n       }\n      }\n     }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffggpi( fitsfile *fptr,   /* I - FITS file pointer                       */\n            long  group,      /* I - group to read (1 = 1st group)           */\n            long  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            long  nelem,      /* I - number of values to read                */\n            short *array,     /* O - array of values that are returned       */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of group parameters from the primary array. Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n*/\n{\n    long row;\n    int idummy;\n    char cdummy;\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    row=maxvalue(1,group);\n\n    ffgcli(fptr, 1, row, firstelem, nelem, 1, 1, 0,\n               array, &cdummy, &idummy, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcvi(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           short nulval,     /* I - value for null pixels                   */\n           short *array,     /* O - array of values that are read           */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Any undefined pixels will be set equal to the value of 'nulval' unless\n  nulval = 0 in which case no checks for undefined pixels will be made.\n*/\n{\n    char cdummy;\n\n    ffgcli(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval,\n           array, &cdummy, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcfi(fitsfile *fptr,   /* I - FITS file pointer                       */\n           int  colnum,      /* I - number of column to read (1 = 1st col)  */\n           LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n           LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n           LONGLONG  nelem,      /* I - number of values to read                */\n           short *array,     /* O - array of values that are read           */\n           char *nularray,   /* O - array of flags: 1 if null pixel; else 0 */\n           int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n           int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU. Automatic\n  datatype conversion will be performed if the datatype of the column does not\n  match the datatype of the array parameter. The output values will be scaled \n  by the FITS TSCALn and TZEROn values if these values have been defined.\n  Nularray will be set = 1 if the corresponding array pixel is undefined, \n  otherwise nularray will = 0.\n*/\n{\n    short dummy = 0;\n\n    ffgcli(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy,\n           array, nularray, anynul, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcli( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  colnum,      /* I - number of column to read (1 = 1st col)  */\n            LONGLONG  firstrow,   /* I - first row to read (1 = 1st row)         */\n            LONGLONG  firstelem, /* I - first vector element to read (1 = 1st)  */\n            LONGLONG  nelem,      /* I - number of values to read                */\n            long  elemincre,  /* I - pixel increment; e.g., 2 = every other  */\n            int   nultyp,     /* I - null value handling code:               */\n                              /*     1: set undefined pixels = nulval        */\n                              /*     2: set nularray=1 for undefined pixels  */\n            short nulval,     /* I - value for null pixels if nultyp = 1     */\n            short *array,     /* O - array of values that are read           */\n            char *nularray,   /* O - array of flags = 1 if nultyp = 2        */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a column in the current FITS HDU.\n  The column number may refer to a real column in an ASCII or binary table, \n  or it may refer be a virtual column in a 1 or more grouped FITS primary\n  array or image extension.  FITSIO treats a primary array as a binary table\n  with 2 vector columns: the first column contains the group parameters (often\n  with length = 0) and the second column contains the array of image pixels.\n  Each row of the table represents a group in the case of multigroup FITS\n  images.\n\n  The output array of values will be converted from the datatype of the column \n  and will be scaled by the FITS TSCALn and TZEROn values if necessary.\n*/\n{\n    double scale, zero, power = 1., dtemp;\n    int tcode, maxelem2, hdutype, xcode, decimals;\n    long twidth, incre;\n    long ii, xwidth, ntodo;\n    int convert, nulcheck, readcheck = 0;\n    LONGLONG repeat, startpos, elemnum, readptr, tnull;\n    LONGLONG rowlen, rownum, remain, next, rowincre, maxelem;\n    char tform[20];\n    char message[FLEN_ERRMSG];\n    char snull[20];   /*  the FITS null value if reading from ASCII table  */\n\n    double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */\n    void *buffer;\n\n    if (*status > 0 || nelem == 0)  /* inherit input status value if > 0 */\n        return(*status);\n\n    buffer = cbuff;\n\n    if (anynul)\n        *anynul = 0;\n\n    if (nultyp == 2)\n        memset(nularray, 0, (size_t) nelem);   /* initialize nullarray */\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (elemincre < 0)\n        readcheck = -1;  /* don't do range checking in this case */\n\n    if ( ffgcprll( fptr, colnum, firstrow, firstelem, nelem, readcheck, &scale, &zero,\n         tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre,\n         &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 )\n         return(*status);\n    maxelem = maxelem2;\n\n    incre *= elemincre;   /* multiply incre to just get every nth pixel */\n\n    if (tcode == TSTRING)    /* setup for ASCII tables */\n    {\n      /* get the number of implied decimal places if no explicit decmal point */\n      ffasfm(tform, &xcode, &xwidth, &decimals, status); \n      for(ii = 0; ii < decimals; ii++)\n        power *= 10.;\n    }\n    /*------------------------------------------------------------------*/\n    /*  Decide whether to check for null values in the input FITS file: */\n    /*------------------------------------------------------------------*/\n    nulcheck = nultyp; /* by default check for null values in the FITS file */\n\n    if (nultyp == 1 && nulval == 0)\n       nulcheck = 0;    /* calling routine does not want to check for nulls */\n\n    else if (tcode%10 == 1 &&        /* if reading an integer column, and  */ \n            tnull == NULL_UNDEFINED) /* if a null value is not defined,    */\n            nulcheck = 0;            /* then do not check for null values. */\n\n    else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TBYTE && (tnull > 255 || tnull < 0) )\n            nulcheck = 0;            /* Impossible null value */\n\n    else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED)\n         nulcheck = 0;\n\n    /*----------------------------------------------------------------------*/\n    /*  If FITS column and output data array have same datatype, then we do */\n    /*  not need to use a temporary buffer to store intermediate datatype.  */\n    /*----------------------------------------------------------------------*/\n    convert = 1;\n    if (tcode == TSHORT) /* Special Case:                        */\n    {                             /* no type convertion required, so read */\n                                  /* data directly into output buffer.    */\n\n        if (nelem < (LONGLONG)INT32_MAX/2) {\n            maxelem = nelem;\n        } else {\n            maxelem = INT32_MAX/2;\n        }\n\n        if (nulcheck == 0 && scale == 1. && zero == 0.)\n            convert = 0;  /* no need to scale data or find nulls */\n    }\n\n    /*---------------------------------------------------------------------*/\n    /*  Now read the pixels from the FITS column. If the column does not   */\n    /*  have the same datatype as the output array, then we have to read   */\n    /*  the raw values into a temporary buffer (of limited size).  In      */\n    /*  the case of a vector colum read only 1 vector of values at a time  */\n    /*  then skip to the next row if more values need to be read.          */\n    /*  After reading the raw values, then call the fffXXYY routine to (1) */\n    /*  test for undefined values, (2) convert the datatype if necessary,  */\n    /*  and (3) scale the values by the FITS TSCALn and TZEROn linear      */\n    /*  scaling parameters.                                                */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to read */\n    next = 0;                 /* next element in array to be read   */\n    rownum = 0;               /* row number, relative to firstrow   */\n\n    while (remain)\n    {\n        /* limit the number of pixels to read at one time to the number that\n           will fit in the buffer or to the number of pixels that remain in\n           the current vector, which ever is smaller.\n        */\n        ntodo = (long) minvalue(remain, maxelem);\n        if (elemincre >= 0)\n        {\n          ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1));\n        }\n        else\n        {\n          ntodo = (long) minvalue(ntodo, (elemnum/(-elemincre) +1));\n        }\n\n        readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre));\n\n        switch (tcode) \n        {\n            case (TSHORT):\n                ffgi2b(fptr, readptr, ntodo, incre, &array[next], status);\n                if (convert)\n                    fffi2i2(&array[next], ntodo, scale, zero, nulcheck, \n                           (short) tnull, nulval, &nularray[next], anynul, \n                           &array[next], status);\n                break;\n            case (TLONGLONG):\n\n                ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status);\n                fffi8i2( (LONGLONG *) buffer, ntodo, scale, zero, \n                           nulcheck, tnull, nulval, &nularray[next], \n                            anynul, &array[next], status);\n                break;\n            case (TBYTE):\n                ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer,\n                      status);\n                fffi1i2((unsigned char *) buffer, ntodo, scale, zero, nulcheck, \n                    (unsigned char) tnull, nulval, &nularray[next], anynul, \n                    &array[next], status);\n                break;\n            case (TLONG):\n                ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) buffer,\n                       status);\n                fffi4i2((INT32BIT *) buffer, ntodo, scale, zero, nulcheck, \n                       (INT32BIT) tnull, nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TFLOAT):\n                ffgr4b(fptr, readptr, ntodo, incre, (float  *) buffer, status);\n                fffr4i2((float  *) buffer, ntodo, scale, zero, nulcheck, \n                       nulval, &nularray[next], anynul, \n                       &array[next], status);\n                break;\n            case (TDOUBLE):\n                ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status);\n                fffr8i2((double *) buffer, ntodo, scale, zero, nulcheck, \n                          nulval, &nularray[next], anynul, \n                          &array[next], status);\n                break;\n            case (TSTRING):\n                ffmbyt(fptr, readptr, REPORT_EOF, status);\n       \n                if (incre == twidth)    /* contiguous bytes */\n                     ffgbyt(fptr, ntodo * twidth, buffer, status);\n                else\n                     ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer,\n                               status);\n\n                fffstri2((char *) buffer, ntodo, scale, zero, twidth, power,\n                     nulcheck, snull, nulval, &nularray[next], anynul,\n                     &array[next], status);\n                break;\n\n            default:  /*  error trap for invalid column format */\n                snprintf(message, FLEN_ERRMSG,\n                   \"Cannot read numbers from column %d which has format %s\",\n                    colnum, tform);\n                ffpmsg(message);\n                if (hdutype == ASCII_TBL)\n                    return(*status = BAD_ATABLE_FORMAT);\n                else\n                    return(*status = BAD_BTABLE_FORMAT);\n\n        } /* End of switch block */\n\n        /*-------------------------*/\n        /*  Check for fatal error  */\n        /*-------------------------*/\n        if (*status > 0)  /* test for error during previous read operation */\n        {\n\t  dtemp = (double) next;\n          if (hdutype > 0)\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgcli).\",\n              dtemp+1, dtemp+ntodo, colnum);\n          else\n            snprintf(message,FLEN_ERRMSG,\n            \"Error reading elements %.0f thru %.0f from image (ffgcli).\",\n              dtemp+1, dtemp+ntodo);\n\n          ffpmsg(message);\n          return(*status);\n        }\n\n        /*--------------------------------------------*/\n        /*  increment the counters for the next loop  */\n        /*--------------------------------------------*/\n        remain -= ntodo;\n        if (remain)\n        {\n            next += ntodo;\n            elemnum = elemnum + (ntodo * elemincre);\n\n            if (elemnum >= repeat)  /* completed a row; start on later row */\n            {\n                rowincre = elemnum / repeat;\n                rownum += rowincre;\n                elemnum = elemnum - (rowincre * repeat);\n            }\n            else if (elemnum < 0) /* completed a row; start on a previous row */\n            {\n                rowincre = (-elemnum - 1) / repeat + 1;\n                rownum -= rowincre;\n                elemnum = (rowincre * repeat) + elemnum;\n            }\n        }\n    }  /*  End of main while Loop  */\n\n\n    /*--------------------------------*/\n    /*  check for numerical overflow  */\n    /*--------------------------------*/\n    if (*status == OVERFLOW_ERR)\n    {\n        ffpmsg(\n        \"Numerical overflow during type conversion while reading FITS data.\");\n        *status = NUM_OVERFLOW;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi1i2(unsigned char *input, /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            unsigned char tnull,  /* I - value of FITS TNULLn keyword if any */\n            short nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            short *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n                output[ii] = (short) input[ii];  /* copy input to output */\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DSHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MIN;\n                }\n                else if (dvalue > DSHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MAX;\n                }\n                else\n                    output[ii] = (short) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = (short) input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MIN;\n                    }\n                    else if (dvalue > DSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MAX;\n                    }\n                    else\n                        output[ii] = (short) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi2i2(short *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short tnull,          /* I - value of FITS TNULLn keyword if any */\n            short nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            short *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            memmove(output, input, ntodo * sizeof(short) );\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DSHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MIN;\n                }\n                else if (dvalue > DSHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MAX;\n                }\n                else\n                    output[ii] = (short) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                    output[ii] = input[ii];\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MIN;\n                    }\n                    else if (dvalue > DSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MAX;\n                    }\n                    else\n                        output[ii] = (short) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi4i2(INT32BIT *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            INT32BIT tnull,       /* I - value of FITS TNULLn keyword if any */\n            short nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            short *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < SHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MIN;\n                }\n                else if (input[ii] > SHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MAX;\n                }\n                else\n                    output[ii] = (short) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DSHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MIN;\n                }\n                else if (dvalue > DSHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MAX;\n                }\n                else\n                    output[ii] = (short) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    if (input[ii] < SHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MIN;\n                    }\n                    else if (input[ii] > SHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MAX;\n                    }\n                    else\n                        output[ii] = (short) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MIN;\n                    }\n                    else if (dvalue > DSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MAX;\n                    }\n                    else\n                        output[ii] = (short) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffi8i2(LONGLONG *input,      /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            LONGLONG tnull,       /* I - value of FITS TNULLn keyword if any */\n            short nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            short *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to tnull.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    ULONGLONG ulltemp;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of adding 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                if (ulltemp > SHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MAX;\n                }\n                else\n\t\t{\n                    output[ii] = (short) ulltemp;\n\t\t}\n            }\n        }\n        else if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < SHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MIN;\n                }\n                else if (input[ii] > SHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MAX;\n                }\n                else\n                    output[ii] = (short) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DSHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MIN;\n                }\n                else if (dvalue > DSHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MAX;\n                }\n                else\n                    output[ii] = (short) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        if (scale == 1. && zero ==  9223372036854775808.)\n        {       \n            /* The column we read contains unsigned long long values. */\n            /* Instead of subtracting 9223372036854775808, it is more efficient */\n            /* and more precise to just flip the sign bit with the XOR operator */\n\n            for (ii = 0; ii < ntodo; ii++) {\n \n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n\t\t{\n                    ulltemp = (ULONGLONG) (((LONGLONG) input[ii]) ^ 0x8000000000000000);\n\n                    if (ulltemp > SHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MAX;\n                    }\n                    else\n\t\t    {\n                        output[ii] = (short) ulltemp;\n\t\t    }\n                }\n            }\n        }\n        else if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    if (input[ii] < SHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MIN;\n                    }\n                    else if (input[ii] > SHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MAX;\n                    }\n                    else\n                        output[ii] = (short) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] == tnull)\n                {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                }\n                else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MIN;\n                    }\n                    else if (dvalue > DSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MAX;\n                    }\n                    else\n                        output[ii] = (short) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr4i2(float *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            short *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DSHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MIN;\n                }\n                else if (input[ii] > DSHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MAX;\n                }\n                else\n                    output[ii] = (short) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DSHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MIN;\n                }\n                else if (dvalue > DSHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MAX;\n                }\n                else\n                    output[ii] = (short) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr++;       /* point to MSBs */\n#endif\n\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MIN;\n                    }\n                    else if (input[ii] > DSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MAX;\n                    }\n                    else\n                        output[ii] = (short) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 2)\n            {\n              if (0 != (iret = fnan(*sptr) ) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  {\n                    if (zero < DSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MIN;\n                    }\n                    else if (zero > DSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MAX;\n                    }\n                    else\n                        output[ii] = (short) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MIN;\n                    }\n                    else if (dvalue > DSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MAX;\n                    }\n                    else\n                        output[ii] = (short) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffr8i2(double *input,        /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            short nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            short *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file.\n  Check for null values and do datatype conversion and scaling if required.\n  The nullcheck code value determines how any null values in the input array\n  are treated.  A null value is an input pixel that is equal to NaN.  If \n  nullcheck = 0, then no checking for nulls is performed and any null values\n  will be transformed just like any other pixel.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    long ii;\n    double dvalue;\n    short *sptr, iret;\n\n    if (nullcheck == 0)     /* no null checking required */\n    {\n        if (scale == 1. && zero == 0.)      /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++)\n            {\n                if (input[ii] < DSHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MIN;\n                }\n                else if (input[ii] > DSHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MAX;\n                }\n                else\n                    output[ii] = (short) input[ii];\n            }\n        }\n        else             /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++)\n            {\n                dvalue = input[ii] * scale + zero;\n\n                if (dvalue < DSHRT_MIN)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MIN;\n                }\n                else if (dvalue > DSHRT_MAX)\n                {\n                    *status = OVERFLOW_ERR;\n                    output[ii] = SHRT_MAX;\n                }\n                else\n                    output[ii] = (short) dvalue;\n            }\n        }\n    }\n    else        /* must check for null values */\n    {\n        sptr = (short *) input;\n\n#if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS\n        sptr += 3;       /* point to MSBs */\n#endif\n        if (scale == 1. && zero == 0.)  /* no scaling */\n        {       \n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {\n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                     output[ii] = 0;\n              }\n              else\n                {\n                    if (input[ii] < DSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MIN;\n                    }\n                    else if (input[ii] > DSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MAX;\n                    }\n                    else\n                        output[ii] = (short) input[ii];\n                }\n            }\n        }\n        else                  /* must scale the data */\n        {\n            for (ii = 0; ii < ntodo; ii++, sptr += 4)\n            {\n              if (0 != (iret = dnan(*sptr)) )  /* test for NaN or underflow */\n              {\n                  if (iret == 1)  /* is it a NaN? */\n                  {  \n                    *anynull = 1;\n                    if (nullcheck == 1)\n                        output[ii] = nullval;\n                    else\n                        nullarray[ii] = 1;\n                  }\n                  else            /* it's an underflow */\n                  {\n                    if (zero < DSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MIN;\n                    }\n                    else if (zero > DSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MAX;\n                    }\n                    else\n                        output[ii] = (short) zero;\n                  }\n              }\n              else\n                {\n                    dvalue = input[ii] * scale + zero;\n\n                    if (dvalue < DSHRT_MIN)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MIN;\n                    }\n                    else if (dvalue > DSHRT_MAX)\n                    {\n                        *status = OVERFLOW_ERR;\n                        output[ii] = SHRT_MAX;\n                    }\n                    else\n                        output[ii] = (short) dvalue;\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fffstri2(char *input,         /* I - array of values to be converted     */\n            long ntodo,           /* I - number of elements in the array     */\n            double scale,         /* I - FITS TSCALn or BSCALE value         */\n            double zero,          /* I - FITS TZEROn or BZERO  value         */\n            long twidth,          /* I - width of each substring of chars    */\n            double implipower,    /* I - power of 10 of implied decimal      */\n            int nullcheck,        /* I - null checking code; 0 = don't check */\n                                  /*     1:set null pixels = nullval         */\n                                  /*     2: if null pixel, set nullarray = 1 */\n            char  *snull,         /* I - value of FITS null string, if any   */\n            short nullval,        /* I - set null pixels, if nullcheck = 1   */\n            char *nullarray,      /* I - bad pixel array, if nullcheck = 2   */\n            int  *anynull,        /* O - set to 1 if any pixels are null     */\n            short *output,        /* O - array of converted pixels           */\n            int *status)          /* IO - error status                       */\n/*\n  Copy input to output following reading of the input from a FITS file. Check\n  for null values and do scaling if required. The nullcheck code value\n  determines how any null values in the input array are treated. A null\n  value is an input pixel that is equal to snull.  If nullcheck= 0, then\n  no special checking for nulls is performed.  If nullcheck = 1, then the\n  output pixel will be set = nullval if the corresponding input pixel is null.\n  If nullcheck = 2, then if the pixel is null then the corresponding value of\n  nullarray will be set to 1; the value of nullarray for non-null pixels \n  will = 0.  The anynull parameter will be set = 1 if any of the returned\n  pixels are null, otherwise anynull will be returned with a value = 0;\n*/\n{\n    int nullen;\n    long ii;\n    double dvalue;\n    char *cstring, message[FLEN_ERRMSG];\n    char *cptr, *tpos;\n    char tempstore, chrzero = '0';\n    double val, power;\n    int exponent, sign, esign, decpt;\n\n    nullen = strlen(snull);\n    cptr = input;  /* pointer to start of input string */\n    for (ii = 0; ii < ntodo; ii++)\n    {\n      cstring = cptr;\n      /* temporarily insert a null terminator at end of the string */\n      tpos = cptr + twidth;\n      tempstore = *tpos;\n      *tpos = 0;\n\n      /* check if null value is defined, and if the    */\n      /* column string is identical to the null string */\n      if (snull[0] != ASCII_NULL_UNDEFINED && \n         !strncmp(snull, cptr, nullen) )\n      {\n        if (nullcheck)  \n        {\n          *anynull = 1;    \n          if (nullcheck == 1)\n            output[ii] = nullval;\n          else\n            nullarray[ii] = 1;\n        }\n        cptr += twidth;\n      }\n      else\n      {\n        /* value is not the null value, so decode it */\n        /* remove any embedded blank characters from the string */\n\n        decpt = 0;\n        sign = 1;\n        val  = 0.;\n        power = 1.;\n        exponent = 0;\n        esign = 1;\n\n        while (*cptr == ' ')               /* skip leading blanks */\n           cptr++;\n\n        if (*cptr == '-' || *cptr == '+')  /* check for leading sign */\n        {\n          if (*cptr == '-')\n             sign = -1;\n\n          cptr++;\n\n          while (*cptr == ' ')         /* skip blanks between sign and value */\n            cptr++;\n        }\n\n        while (*cptr >= '0' && *cptr <= '9')\n        {\n          val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n          cptr++;\n\n          while (*cptr == ' ')         /* skip embedded blanks in the value */\n            cptr++;\n        }\n\n        if (*cptr == '.' || *cptr == ',')       /* check for decimal point */\n        {\n          decpt = 1;       /* set flag to show there was a decimal point */\n          cptr++;\n          while (*cptr == ' ')         /* skip any blanks */\n            cptr++;\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            val = val * 10. + *cptr - chrzero;  /* accumulate the value */\n            power = power * 10.;\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks in the value */\n              cptr++;\n          }\n        }\n\n        if (*cptr == 'E' || *cptr == 'D')  /* check for exponent */\n        {\n          cptr++;\n          while (*cptr == ' ')         /* skip blanks */\n              cptr++;\n  \n          if (*cptr == '-' || *cptr == '+')  /* check for exponent sign */\n          {\n            if (*cptr == '-')\n               esign = -1;\n\n            cptr++;\n\n            while (*cptr == ' ')        /* skip blanks between sign and exp */\n              cptr++;\n          }\n\n          while (*cptr >= '0' && *cptr <= '9')\n          {\n            exponent = exponent * 10 + *cptr - chrzero;  /* accumulate exp */\n            cptr++;\n\n            while (*cptr == ' ')         /* skip embedded blanks */\n              cptr++;\n          }\n        }\n\n        if (*cptr  != 0)  /* should end up at the null terminator */\n        {\n          snprintf(message, FLEN_ERRMSG,\"Cannot read number from ASCII table\");\n          ffpmsg(message);\n          snprintf(message, FLEN_ERRMSG,\"Column field = %s.\", cstring);\n          ffpmsg(message);\n          /* restore the char that was overwritten by the null */\n          *tpos = tempstore;\n          return(*status = BAD_C2D);\n        }\n\n        if (!decpt)  /* if no explicit decimal, use implied */\n           power = implipower;\n\n        dvalue = (sign * val / power) * pow(10., (double) (esign * exponent));\n\n        dvalue = dvalue * scale + zero;   /* apply the scaling */\n\n        if (dvalue < DSHRT_MIN)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = SHRT_MIN;\n        }\n        else if (dvalue > DSHRT_MAX)\n        {\n            *status = OVERFLOW_ERR;\n            output[ii] = SHRT_MAX;\n        }\n        else\n            output[ii] = (short) dvalue;\n      }\n      /* restore the char that was overwritten by the null */\n      *tpos = tempstore;\n    }\n    return(*status);\n}\n"},{"id":16712,"name":"simplerng.h","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/* \n   Simple Random Number Generators\n       - getuniform - uniform deviate [0,1]\n       - getnorm    - gaussian (normal) deviate (mean=0, stddev=1)\n       - getpoisson - poisson deviate for given expected mean lambda\n\n   This code is adapted from SimpleRNG by John D Cook, which is\n   provided in the public domain.\n\n   The original C++ code is found here:\n   http://www.johndcook.com/cpp_random_number_generation.html\n\n   This code has been modified in the following ways compared to the\n   original.\n     1. convert to C from C++\n     2. keep only uniform, gaussian and poisson deviates\n     3. state variables are module static instead of class variables\n     4. provide an srand() equivalent to initialize the state\n*/\n\nextern void simplerng_setstate(unsigned int u, unsigned int v);\nextern void simplerng_getstate(unsigned int *u, unsigned int *v);\nextern void simplerng_srand(unsigned int seed);\nextern double simplerng_getuniform(void);\nextern double simplerng_getnorm(void);\nextern int simplerng_getpoisson(double lambda);\nextern double simplerng_logfactorial(int n);\n"},{"id":16713,"name":"fitsio2.h","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"#ifndef _FITSIO2_H\n#define _FITSIO2_H\n \n#include \"fitsio.h\"\n\n/* \n    Threading support using POSIX threads programming interface\n    (supplied by Bruce O'Neel) \n\n    All threaded programs MUST have the \n\n    -D_REENTRANT\n\n    on the compile line and must link with -lpthread.  This means that\n    when one builds cfitsio for threads you must have -D_REENTRANT on the\n    gcc or cc command line.\n*/\n\n#ifdef _REENTRANT\n#include <pthread.h>\n/*  #include <assert.h>  not needed any more */\nextern pthread_mutex_t Fitsio_Lock;\nextern int Fitsio_Pthread_Status;\n\n#define FFLOCK1(lockname)   (Fitsio_Pthread_Status = pthread_mutex_lock(&lockname))\n#define FFUNLOCK1(lockname) (Fitsio_Pthread_Status = pthread_mutex_unlock(&lockname))\n#define FFLOCK   FFLOCK1(Fitsio_Lock)\n#define FFUNLOCK FFUNLOCK1(Fitsio_Lock)\n#define ffstrtok(str, tok, save) strtok_r(str, tok, save)\n\n#else\n#define FFLOCK\n#define FFUNLOCK\n#define ffstrtok(str, tok, save) strtok(str, tok)\n#endif\n\n/*\n  If REPLACE_LINKS is defined, then whenever CFITSIO fails to open\n  a file with write access because it is a soft link to a file that\n  only has read access, then CFITSIO will attempt to replace\n  the link with a local copy of the file, with write access.  This\n  feature was originally added to support the ftools in the Hera\n  environment, where many of the user's data file are soft links.\n*/\n#if defined(BUILD_HERA)\n#define REPLACE_LINKS 1\n#endif\n\n#define USE_LARGE_VALUE -99  /* flag used when writing images */\n\n#define DBUFFSIZE 28800 /* size of data buffer in bytes */\n\n#define NMAXFILES  10000   /* maximum number of FITS files that can be opened */\n        /* CFITSIO will allocate (NMAXFILES * 80) bytes of memory */\n\t/* plus each file that is opened will use NIOBUF * 2880 bytes of memeory */\n\t/* where NIOBUF is defined in fitio.h and has a default value of 40 */\n\n#define MINDIRECT 8640   /* minimum size for direct reads and writes */\n                         /* MINDIRECT must have a value >= 8640 */\n\n/*   it is useful to identify certain specific types of machines   */\n#define NATIVE             0 /* machine that uses non-byteswapped IEEE formats */\n#define OTHERTYPE          1  /* any other type of machine */\n#define VAXVMS             3  /* uses an odd floating point format */\n#define ALPHAVMS           4  /* uses an odd floating point format */\n#define IBMPC              5  /* used in drvrfile.c to work around a bug on PCs */\n#define CRAY               6  /* requires a special NaN test algorithm */\n\n#define GFLOAT             1  /* used for VMS */\n#define IEEEFLOAT          2  /* used for VMS */\n\n/* ======================================================================= */\n/* The following logic is used to determine the type machine,              */\n/*  whether the bytes are swapped, and the number of bits in a long value  */\n/* ======================================================================= */\n\n/*   The following platforms have sizeof(long) == 8               */\n/*   This block of code should match a similar block in fitsio.h  */\n/*   and the block of code at the beginning of f77_wrap.h         */\n\n#if defined(__alpha) && ( defined(__unix__) || defined(__NetBSD__) )\n                                  /* old Dec Alpha platforms running OSF */\n#define BYTESWAPPED TRUE\n#define LONGSIZE 64\n\n#elif defined(__sparcv9) || (defined(__sparc__) && defined(__arch64__))\n                               /*  SUN Solaris7 in 64-bit mode */\n#define BYTESWAPPED FALSE\n#define MACHINE NATIVE\n#define LONGSIZE 64   \n\n                            /* IBM System z mainframe support */ \n#elif defined(__s390x__)\n#define BYTESWAPPED FALSE\n#define LONGSIZE 64\n\n#elif defined(__s390__)\n#define BYTESWAPPED FALSE\n#define LONGSIZE 32\n\n#elif defined(__ia64__)  || defined(__x86_64__) || defined(__AARCH64EL__)\n                  /*  Intel itanium 64-bit PC, or AMD opteron 64-bit PC */\n#define BYTESWAPPED TRUE\n#define LONGSIZE 64   \n\n#elif defined(_SX)             /* Nec SuperUx */\n\n#define BYTESWAPPED FALSE\n#define MACHINE NATIVE\n#define LONGSIZE 64\n\n#elif defined(__powerpc64__) || defined(__64BIT__) || defined(__AARCH64EB__)  /* IBM 64-bit AIX powerpc*/\n                              /* could also test for __ppc64__ or __PPC64 */\n\n#  if defined(__LITTLE_ENDIAN__)\n#   define BYTESWAPPED TRUE\n#  else\n#   define BYTESWAPPED FALSE\n#   define MACHINE NATIVE\n#  endif\n#  define LONGSIZE 64\n\n#elif defined(_MIPS_SZLONG)\n\n#  if defined(MIPSEL)\n#    define BYTESWAPPED TRUE\n#  else\n#    define BYTESWAPPED FALSE\n#    define MACHINE NATIVE\n#  endif\n\n#  if _MIPS_SZLONG == 32\n#    define LONGSIZE 32\n#  elif _MIPS_SZLONG == 64\n#    define LONGSIZE 64\n#  else\n#    error \"can't handle long size given by _MIPS_SZLONG\"\n#  endif\n\n#elif defined(__riscv)\n\n/* RISC-V is always little endian */\n\n#define BYTESWAPPED TRUE\n\n#  if __riscv_xlen == 32\n#    define LONGSIZE 32\n#  elif __riscv_xlen == 64\n#    define LONGSIZE 64\n#  else\n#    error \"can't handle long size given by __riscv_xlen\"\n#  endif\n\n/* ============================================================== */\n/*  the following are all 32-bit byteswapped platforms            */\n\n#elif defined(vax) && defined(VMS)\n \n#define MACHINE VAXVMS\n#define BYTESWAPPED TRUE\n \n#elif defined(__alpha) && defined(__VMS)\n\n#if (__D_FLOAT == TRUE)\n\n/* this float option is the same as for VAX/VMS machines. */\n#define MACHINE VAXVMS\n#define BYTESWAPPED TRUE\n \n#elif  (__G_FLOAT == TRUE)\n \n/*  G_FLOAT is the default for ALPHA VMS systems */\n#define MACHINE ALPHAVMS\n#define BYTESWAPPED TRUE\n#define FLOATTYPE GFLOAT\n \n#elif  (__IEEE_FLOAT == TRUE)\n \n#define MACHINE ALPHAVMS\n#define BYTESWAPPED TRUE\n#define FLOATTYPE IEEEFLOAT\n\n#endif  /* end of alpha VMS case */\n\n#elif defined(ultrix) && defined(unix)\n /* old Dec ultrix machines */\n#define BYTESWAPPED TRUE\n \n#elif defined(__i386) || defined(__i386__) || defined(__i486__) || defined(__i586__) \\\n  || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__TURBOC__) \\\n  || defined(_NI_mswin_) || defined(__EMX__)\n\n/*  generic 32-bit IBM PC */\n#define MACHINE IBMPC\n#define BYTESWAPPED TRUE\n\n#elif defined(__arm__)\n\n/* This assumes all ARM are little endian.  In the future, it might be  */\n/* necessary to use  \"if defined(__ARMEL__)\"  to distinguish little from big. */\n/* (__ARMEL__ would be defined on little-endian, but not on big-endian). */\n\n#define BYTESWAPPED TRUE\n \n#elif defined(__tile__)\n\n/*  64-core 8x8-architecture Tile64 platform */\n\n#define BYTESWAPPED TRUE\n\n#elif defined(__sh__)\n\n/* SuperH CPU can be used in both little and big endian modes */\n\n#if defined(__LITTLE_ENDIAN__)\n#define BYTESWAPPED TRUE\n#else\n#define BYTESWAPPED FALSE\n#endif\n\n#else\n\n/*  assume all other machine uses the same IEEE formats as used in FITS files */\n/*  e.g., Macs fall into this category  */\n\n#define MACHINE NATIVE\n#define BYTESWAPPED FALSE\n \n#endif\n\n#ifndef MACHINE\n#define MACHINE  OTHERTYPE\n#endif\n\n/*  assume longs are 4 bytes long, unless previously set otherwise */\n#ifndef LONGSIZE\n#define LONGSIZE 32\n#endif\n\n/*       end of block that determine long size and byte swapping        */ \n/* ==================================================================== */\n \n#define IGNORE_EOF 1\n#define REPORT_EOF 0\n#define DATA_UNDEFINED -1\n#define NULL_UNDEFINED 1234554321\n#define ASCII_NULL_UNDEFINED 1   /* indicate no defined null value */\n \n#define maxvalue(A,B) ((A) > (B) ? (A) : (B))\n#define minvalue(A,B) ((A) < (B) ? (A) : (B))\n\n/* faster string comparison macros */\n#define FSTRCMP(a,b)     ((a)[0]<(b)[0]? -1:(a)[0]>(b)[0]?1:strcmp((a),(b)))\n#define FSTRNCMP(a,b,n)  ((a)[0]<(b)[0]?-1:(a)[0]>(b)[0]?1:strncmp((a),(b),(n)))\n\n#if defined(__VMS) || defined(VMS)\n \n#define FNANMASK   0xFFFF /* mask all bits  */\n#define DNANMASK   0xFFFF /* mask all bits  */\n \n#else\n \n#define FNANMASK   0x7F80 /* mask bits 1 - 8; all set on NaNs */\n                                     /* all 0 on underflow  or 0. */\n \n#define DNANMASK   0x7FF0 /* mask bits 1 - 11; all set on NaNs */\n                                     /* all 0 on underflow  or 0. */\n \n#endif\n \n#if MACHINE == CRAY\n    /*\n      Cray machines:   the large negative integer corresponds\n      to the 3 most sig digits set to 1.   If these\n      3 bits are set in a floating point number (64 bits), then it represents\n      a reserved value (i.e., a NaN)\n    */\n#define fnan(L) ( (L) >= 0xE000000000000000 ? 1 : 0) )\n \n#else\n    /* these functions work for both big and little endian machines */\n    /* that use the IEEE floating point format for internal numbers */\n \n   /* These functions tests whether the float value is a reserved IEEE     */\n   /* value such as a Not-a-Number (NaN), or underflow, overflow, or       */\n   /* infinity.   The functions returns 1 if the value is a NaN, overflow  */\n   /* or infinity; it returns 2 if the value is an denormalized underflow  */\n   /* value; otherwise it returns 0. fnan tests floats, dnan tests doubles */\n \n#define fnan(L) \\\n      ( (L & FNANMASK) == FNANMASK ?  1 : (L & FNANMASK) == 0 ? 2 : 0)\n \n#define dnan(L) \\\n      ( (L & DNANMASK) == DNANMASK ?  1 : (L & DNANMASK) == 0 ? 2 : 0)\n \n#endif\n\n#define DSCHAR_MAX  127.49 /* max double value that fits in an signed char */\n#define DSCHAR_MIN -128.49 /* min double value that fits in an signed char */\n#define DUCHAR_MAX  255.49 /* max double value that fits in an unsigned char */\n#define DUCHAR_MIN -0.49   /* min double value that fits in an unsigned char */\n#define DUSHRT_MAX  65535.49 /* max double value that fits in a unsigned short*/\n#define DUSHRT_MIN -0.49   /* min double value that fits in an unsigned short */\n#define DSHRT_MAX  32767.49 /* max double value that fits in a short */\n#define DSHRT_MIN -32768.49 /* min double value that fits in a short */\n\n#if LONGSIZE == 32\n#  define DLONG_MAX  2147483647.49 /* max double value that fits in a long */\n#  define DLONG_MIN -2147483648.49 /* min double value that fits in a long */\n#  define DULONG_MAX 4294967295.49 /* max double that fits in a unsigned long */\n#else\n#  define DLONG_MAX   9.2233720368547752E18 /* max double value  long */\n#  define DLONG_MIN  -9.2233720368547752E18 /* min double value  long */\n#  define DULONG_MAX 1.84467440737095504E19 /* max double value  ulong */\n#endif\n\n#define DULONG_MIN -0.49   /* min double value that fits in an unsigned long */\n#define DULONGLONG_MAX 18446744073709551615. /* max unsigned  longlong */\n#define DULONGLONG_MIN -0.49\n#define DLONGLONG_MAX  9.2233720368547755807E18 /* max double value  longlong */\n#define DLONGLONG_MIN -9.2233720368547755808E18 /* min double value  longlong */\n#define DUINT_MAX 4294967295.49 /* max dbl that fits in a unsigned 4-byte int */\n#define DUINT_MIN -0.49   /* min dbl that fits in an unsigned 4-byte int */\n#define DINT_MAX  2147483647.49 /* max double value that fits in a 4-byte int */\n#define DINT_MIN -2147483648.49 /* min double value that fits in a 4-byte int */\n\n#ifndef UINT64_MAX\n#define UINT64_MAX 18446744073709551615U /* max unsigned 64-bit integer */\n#endif\n#ifndef UINT32_MAX\n#define UINT32_MAX 4294967295U /* max unsigned 32-bit integer */\n#endif\n#ifndef INT32_MAX\n#define INT32_MAX  2147483647 /* max 32-bit integer */\n#endif\n#ifndef INT32_MIN\n#define INT32_MIN (-INT32_MAX -1) /* min 32-bit integer */\n#endif\n\n\n#define COMPRESS_NULL_VALUE -2147483647\n#define N_RANDOM 10000  /* DO NOT CHANGE THIS;  used when quantizing real numbers */\n\nint ffgnky(fitsfile *fptr, char *card, int *status);\nvoid ffcfmt(char *tform, char *cform);\nvoid ffcdsp(char *tform, char *cform);\nvoid ffswap2(short *values, long nvalues);\nvoid ffswap4(INT32BIT *values, long nvalues);\nvoid ffswap8(double *values, long nvalues);\nint ffi2c(LONGLONG ival, char *cval, int *status);\nint ffu2c(ULONGLONG ival, char *cval, int *status);\nint ffl2c(int lval, char *cval, int *status);\nint ffs2c(const char *instr, char *outstr, int *status);\nint ffr2f(float fval, int decim, char *cval, int *status);\nint ffr2e(float fval, int decim, char *cval, int *status);\nint ffd2f(double dval, int decim, char *cval, int *status);\nint ffd2e(double dval, int decim, char *cval, int *status);\nint ffc2ii(const char *cval, long *ival, int *status);\nint ffc2jj(const char *cval, LONGLONG *ival, int *status);\nint ffc2ujj(const char *cval, ULONGLONG *ival, int *status);\nint ffc2ll(const char *cval, int *lval, int *status);\nint ffc2rr(const char *cval, float *fval, int *status);\nint ffc2dd(const char *cval, double *dval, int *status);\nint ffc2x(const char *cval, char *dtype, long *ival, int *lval, char *sval,\n          double *dval, int *status);\nint ffc2xx(const char *cval, char *dtype, LONGLONG *ival, int *lval, char *sval,\n          double *dval, int *status);\nint ffc2uxx(const char *cval, char *dtype, ULONGLONG *ival, int *lval, char *sval,\n          double *dval, int *status);\nint ffc2s(const char *instr, char *outstr, int *status);\nint ffc2i(const char *cval, long *ival, int *status);\nint ffc2j(const char *cval, LONGLONG *ival, int *status);\nint ffc2uj(const char *cval, ULONGLONG *ival, int *status);\nint ffc2r(const char *cval, float *fval, int *status);\nint ffc2d(const char *cval, double *dval, int *status);\nint ffc2l(const char *cval, int *lval, int *status);\nvoid ffxmsg(int action, char *err_message);\nint ffgcnt(fitsfile *fptr, char *value, char *comm, int *status);\nint ffgtkn(fitsfile *fptr, int numkey, char *keyname, long *value, int *status);\nint ffgtknjj(fitsfile *fptr, int numkey, char *keyname, LONGLONG *value, int *status);\nint fftkyn(fitsfile *fptr, int numkey, char *keyname, char *value, int *status);\nint ffgphd(fitsfile *fptr, int maxdim, int *simple, int *bitpix, int *naxis,\n        LONGLONG naxes[], long *pcount, long *gcount, int *extend, double *bscale,\n          double *bzero, LONGLONG *blank, int *nspace, int *status);\nint ffgttb(fitsfile *fptr, LONGLONG *rowlen, LONGLONG *nrows, LONGLONG *pcount,\n          long *tfield, int *status);\n \nint ffmkey(fitsfile *fptr, const char *card, int *status);\n \n/*  ffmbyt has been moved to fitsio.h */\nint ffgbyt(fitsfile *fptr, LONGLONG nbytes, void *buffer, int *status);\nint ffpbyt(fitsfile *fptr, LONGLONG nbytes, void *buffer, int *status);\nint ffgbytoff(fitsfile *fptr, long gsize, long ngroups, long offset, \n           void *buffer, int *status);\nint ffpbytoff(fitsfile *fptr, long gsize, long ngroups, long offset,\n           void *buffer, int *status);\nint ffldrc(fitsfile *fptr, long record, int err_mode, int *status);\nint ffwhbf(fitsfile *fptr, int *nbuff);\nint ffbfeof(fitsfile *fptr, int *status);\nint ffbfwt(FITSfile *Fptr, int nbuff, int *status);\nint ffpxsz(int datatype);\n\nint ffourl(char *url, char *urltype, char *outfile, char *tmplfile,\n            char *compspec, int *status);\nint ffparsecompspec(fitsfile *fptr, char *compspec, int *status);\nint ffoptplt(fitsfile *fptr, const char *tempname, int *status);\nint fits_is_this_a_copy(char *urltype);\nint fits_store_Fptr(FITSfile *Fptr, int *status);\nint fits_clear_Fptr(FITSfile *Fptr, int *status);\nint fits_already_open(fitsfile **fptr, char *url, \n    char *urltype, char *infile, char *extspec, char *rowfilter,\n    char *binspec, char *colspec, int  mode, int noextsyn,\n    int  *isopen, int  *status);\nint ffedit_columns(fitsfile **fptr, char *outfile, char *expr, int *status);\nint fits_get_col_minmax(fitsfile *fptr, int colnum, double *datamin, \n                     double *datamax, int *status);\nint ffwritehisto(long totaln, long offset, long firstn, long nvalues,\n             int narrays, iteratorCol *imagepars, void *userPointer);\nint ffcalchist(long totalrows, long offset, long firstrow, long nrows,\n             int ncols, iteratorCol *colpars, void *userPointer);\nint ffpinit(fitsfile *fptr, int *status);\nint ffainit(fitsfile *fptr, int *status);\nint ffbinit(fitsfile *fptr, int *status);\nint ffchdu(fitsfile *fptr, int *status);\nint ffwend(fitsfile *fptr, int *status);\nint ffpdfl(fitsfile *fptr, int *status);\nint ffuptf(fitsfile *fptr, int *status);\n\nint ffdblk(fitsfile *fptr, long nblocks, int *status);\nint ffgext(fitsfile *fptr, int moveto, int *exttype, int *status);\nint ffgtbc(fitsfile *fptr, LONGLONG *totalwidth, int *status);\nint ffgtbp(fitsfile *fptr, char *name, char *value, int *status);\nint ffiblk(fitsfile *fptr, long nblock, int headdata, int *status);\nint ffshft(fitsfile *fptr, LONGLONG firstbyte, LONGLONG nbytes, LONGLONG nshift,\n    int *status);\n \n int ffgcprll(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, int writemode, double *scale, double *zero, char *tform,\n           long *twidth, int *tcode, int *maxelem, LONGLONG *startpos,\n           LONGLONG *elemnum, long *incre, LONGLONG *repeat, LONGLONG *rowlen,\n           int *hdutype, LONGLONG *tnull, char *snull, int *status);\n\t   \nint ffflushx(FITSfile *fptr);\nint ffseek(FITSfile *fptr, LONGLONG position);\nint ffread(FITSfile *fptr, long nbytes, void *buffer,\n            int *status);\nint ffwrite(FITSfile *fptr, long nbytes, void *buffer,\n            int *status);\nint fftrun(fitsfile *fptr, LONGLONG filesize, int *status);\n\nint ffpcluc(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, int *status);\n\t   \nint ffgcll(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, int nultyp, char nulval, char *array, char *nularray,\n           int *anynul, int *status);\nint ffgcls(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, int nultyp, char *nulval,\n           char **array, char *nularray, int *anynul, int  *status);\nint ffgcls2(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, int nultyp, char *nulval,\n           char **array, char *nularray, int *anynul, int  *status);\nint ffgclb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, long  elemincre, int nultyp, unsigned char nulval,\n           unsigned char *array, char *nularray, int *anynul, int  *status);\nint ffgclsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, long  elemincre, int nultyp, signed char nulval,\n           signed char *array, char *nularray, int *anynul, int  *status);\nint ffgclui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, long  elemincre, int nultyp, unsigned short nulval,\n           unsigned short *array, char *nularray, int *anynul, int  *status);\nint ffgcli(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, long  elemincre, int nultyp, short nulval,\n           short *array, char *nularray, int *anynul, int  *status);\nint ffgcluj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, long elemincre, int nultyp, unsigned long nulval,\n           unsigned long *array, char *nularray, int *anynul, int  *status);\nint ffgclujj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, long elemincre, int nultyp, ULONGLONG nulval, \n           ULONGLONG *array, char *nularray, int *anynul, int  *status);\nint ffgcljj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, long elemincre, int nultyp, LONGLONG nulval, \n           LONGLONG *array, char *nularray, int *anynul, int  *status);\nint ffgclj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, long elemincre, int nultyp, long nulval, long *array,\n           char *nularray, int *anynul, int  *status);\nint ffgcluk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, long elemincre, int nultyp, unsigned int nulval,\n           unsigned int *array, char *nularray, int *anynul, int  *status);\nint ffgclk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, long elemincre, int nultyp, int nulval, int *array,\n           char *nularray, int *anynul, int  *status);\nint ffgcle(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, long elemincre, int nultyp,  float nulval, float *array,\n           char *nularray, int *anynul, int  *status);\nint ffgcld(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,\n           LONGLONG nelem, long elemincre, int nultyp, double nulval,\n           double *array, char *nularray, int *anynul, int  *status);\n \nint ffpi1b(fitsfile *fptr, long nelem, long incre, unsigned char *buffer,\n           int *status);\nint ffpi2b(fitsfile *fptr, long nelem, long incre, short *buffer, int *status);\nint ffpi4b(fitsfile *fptr, long nelem, long incre, INT32BIT *buffer,\n           int *status);\nint ffpi8b(fitsfile *fptr, long nelem, long incre, long *buffer, int *status);\nint ffpr4b(fitsfile *fptr, long nelem, long incre, float *buffer, int *status);\nint ffpr8b(fitsfile *fptr, long nelem, long incre, double *buffer, int *status);\n \nint ffgi1b(fitsfile *fptr, LONGLONG pos, long nelem, long incre,\n          unsigned char *buffer, int *status);\nint ffgi2b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, short *buffer,\n          int *status);\nint ffgi4b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, INT32BIT *buffer,\n          int *status);\nint ffgi8b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, long *buffer,\n          int *status);\nint ffgr4b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, float *buffer,\n          int *status);\nint ffgr8b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, double *buffer,\n          int *status);\n \nint ffcins(fitsfile *fptr, LONGLONG naxis1, LONGLONG naxis2, LONGLONG nbytes,\n           LONGLONG bytepos, int *status);\nint ffcdel(fitsfile *fptr, LONGLONG naxis1, LONGLONG naxis2, LONGLONG nbytes,\n           LONGLONG bytepos, int *status);\nint ffkshf(fitsfile *fptr, int firstcol, int tfields, int nshift, int *status);\nint fffvcl(fitsfile *fptr, int *nvarcols, int *colnums, int *status);\n \nint fffi1i1(unsigned char *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned char tnull, unsigned char nullval, char\n             *nullarray, int *anynull, unsigned char *output, int *status);\nint fffi2i1(short *input, long ntodo, double scale, double zero,\n            int nullcheck, short tnull, unsigned char nullval, char *nullarray,\n            int *anynull, unsigned char *output, int *status);\nint fffi4i1(INT32BIT *input, long ntodo, double scale, double zero,\n            int nullcheck, INT32BIT tnull, unsigned char nullval, char *nullarray,\n            int *anynull, unsigned char *output, int *status);\nint fffi8i1(LONGLONG *input, long ntodo, double scale, double zero,\n            int nullcheck, LONGLONG tnull, unsigned char nullval, char *nullarray,\n            int *anynull, unsigned char *output, int *status);\nint fffr4i1(float *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned char nullval, char *nullarray,\n            int *anynull, unsigned char *output, int *status);\nint fffr8i1(double *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned char nullval, char *nullarray,\n            int *anynull, unsigned char *output, int *status);\nint fffstri1(char *input, long ntodo, double scale, double zero,\n            long twidth, double power, int nullcheck, char *snull,\n            unsigned char nullval, char *nullarray, int *anynull,\n            unsigned char *output, int *status);\n \nint fffi1s1(unsigned char *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned char tnull, signed char nullval, char\n             *nullarray, int *anynull, signed char *output, int *status);\nint fffi2s1(short *input, long ntodo, double scale, double zero,\n            int nullcheck, short tnull, signed char nullval, char *nullarray,\n            int *anynull, signed char *output, int *status);\nint fffi4s1(INT32BIT *input, long ntodo, double scale, double zero,\n            int nullcheck, INT32BIT tnull, signed char nullval, char *nullarray,\n            int *anynull, signed char *output, int *status);\nint fffi8s1(LONGLONG *input, long ntodo, double scale, double zero,\n            int nullcheck, LONGLONG tnull, signed char nullval, char *nullarray,\n            int *anynull, signed char *output, int *status);\nint fffr4s1(float *input, long ntodo, double scale, double zero,\n            int nullcheck, signed char nullval, char *nullarray,\n            int *anynull, signed char *output, int *status);\nint fffr8s1(double *input, long ntodo, double scale, double zero,\n            int nullcheck, signed char nullval, char *nullarray,\n            int *anynull, signed char *output, int *status);\nint fffstrs1(char *input, long ntodo, double scale, double zero,\n            long twidth, double power, int nullcheck, char *snull,\n            signed char nullval, char *nullarray, int *anynull,\n            signed char *output, int *status);\n\nint fffi1u2(unsigned char *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned char tnull, unsigned short nullval, \n            char *nullarray,\n            int *anynull, unsigned short *output, int *status);\nint fffi2u2(short *input, long ntodo, double scale, double zero,\n            int nullcheck, short tnull, unsigned short nullval, char *nullarray,\n            int *anynull, unsigned short *output, int *status);\nint fffi4u2(INT32BIT *input, long ntodo, double scale, double zero,\n            int nullcheck, INT32BIT tnull, unsigned short nullval, char *nullarray,\n            int *anynull, unsigned short *output, int *status);\nint fffi8u2(LONGLONG *input, long ntodo, double scale, double zero,\n            int nullcheck, LONGLONG tnull, unsigned short nullval, char *nullarray,\n            int *anynull, unsigned short *output, int *status);\nint fffr4u2(float *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned short nullval, char *nullarray,\n            int *anynull, unsigned short *output, int *status);\nint fffr8u2(double *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned short nullval, char *nullarray,\n            int *anynull, unsigned short *output, int *status);\nint fffstru2(char *input, long ntodo, double scale, double zero,\n            long twidth, double power, int nullcheck, char *snull,\n            unsigned short nullval, char *nullarray, int  *anynull, \n            unsigned short *output, int *status);\n\nint fffi1i2(unsigned char *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned char tnull, short nullval, char *nullarray,\n            int *anynull, short *output, int *status);\nint fffi2i2(short *input, long ntodo, double scale, double zero,\n            int nullcheck, short tnull, short nullval, char *nullarray,\n            int *anynull, short *output, int *status);\nint fffi4i2(INT32BIT *input, long ntodo, double scale, double zero,\n            int nullcheck, INT32BIT tnull, short nullval, char *nullarray,\n            int *anynull, short *output, int *status);\nint fffi8i2(LONGLONG *input, long ntodo, double scale, double zero,\n            int nullcheck, LONGLONG tnull, short nullval, char *nullarray,\n            int *anynull, short *output, int *status);\nint fffr4i2(float *input, long ntodo, double scale, double zero,\n            int nullcheck, short nullval, char *nullarray,\n            int *anynull, short *output, int *status);\nint fffr8i2(double *input, long ntodo, double scale, double zero,\n            int nullcheck, short nullval, char *nullarray,\n            int *anynull, short *output, int *status);\nint fffstri2(char *input, long ntodo, double scale, double zero,\n            long twidth, double power, int nullcheck, char *snull,\n            short nullval, char *nullarray, int  *anynull, short *output,\n            int *status);\n\nint fffi1u4(unsigned char *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned char tnull, unsigned long nullval,\n            char *nullarray,\n            int *anynull, unsigned long *output, int *status);\nint fffi2u4(short *input, long ntodo, double scale, double zero,\n            int nullcheck, short tnull, unsigned long nullval, char *nullarray,\n            int *anynull, unsigned long *output, int *status);\nint fffi4u4(INT32BIT *input, long ntodo, double scale, double zero,\n            int nullcheck, INT32BIT tnull, unsigned long nullval, char *nullarray,\n            int *anynull, unsigned long *output, int *status);\nint fffi8u4(LONGLONG *input, long ntodo, double scale, double zero,\n            int nullcheck, LONGLONG tnull, unsigned long nullval, char *nullarray,\n            int *anynull, unsigned long *output, int *status);\nint fffr4u4(float *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned long nullval, char *nullarray,\n            int *anynull, unsigned long *output, int *status);\nint fffr8u4(double *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned long nullval, char *nullarray,\n            int *anynull, unsigned long *output, int *status);\nint fffstru4(char *input, long ntodo, double scale, double zero,\n            long twidth, double power, int nullcheck, char *snull,\n            unsigned long nullval, char *nullarray, int *anynull,\n            unsigned long *output, int *status);\n \nint fffi1i4(unsigned char *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned char tnull, long nullval, char *nullarray,\n            int *anynull, long *output, int *status);\nint fffi2i4(short *input, long ntodo, double scale, double zero,\n            int nullcheck, short tnull, long nullval, char *nullarray,\n            int *anynull, long *output, int *status);\nint fffi4i4(INT32BIT *input, long ntodo, double scale, double zero,\n            int nullcheck, INT32BIT tnull, long nullval, char *nullarray,\n            int *anynull, long *output, int *status);\nint fffi8i4(LONGLONG *input, long ntodo, double scale, double zero,\n            int nullcheck, LONGLONG tnull, long nullval, char *nullarray,\n            int *anynull, long *output, int *status);\nint fffr4i4(float *input, long ntodo, double scale, double zero,\n            int nullcheck, long nullval, char *nullarray,\n            int *anynull, long *output, int *status);\nint fffr8i4(double *input, long ntodo, double scale, double zero,\n            int nullcheck, long nullval, char *nullarray,\n            int *anynull, long *output, int *status);\nint fffstri4(char *input, long ntodo, double scale, double zero,\n            long twidth, double power, int nullcheck, char *snull,\n            long nullval, char *nullarray, int *anynull, long *output,\n            int *status);\n \nint fffi1int(unsigned char *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned char tnull, int nullval, char *nullarray,\n            int *anynull, int *output, int *status);\nint fffi2int(short *input, long ntodo, double scale, double zero,\n            int nullcheck, short tnull, int nullval, char *nullarray,\n            int *anynull, int *output, int *status);\nint fffi4int(INT32BIT *input, long ntodo, double scale, double zero,\n            int nullcheck, INT32BIT tnull, int nullval, char *nullarray,\n            int *anynull, int *output, int *status);\nint fffi8int(LONGLONG *input, long ntodo, double scale, double zero,\n            int nullcheck, LONGLONG tnull, int nullval, char *nullarray,\n            int *anynull, int *output, int *status);\nint fffr4int(float *input, long ntodo, double scale, double zero,\n            int nullcheck, int nullval, char *nullarray,\n            int *anynull, int *output, int *status);\nint fffr8int(double *input, long ntodo, double scale, double zero,\n            int nullcheck, int nullval, char *nullarray,\n            int *anynull, int *output, int *status);\nint fffstrint(char *input, long ntodo, double scale, double zero,\n            long twidth, double power, int nullcheck, char *snull,\n            int nullval, char *nullarray, int *anynull, int *output,\n            int *status);\n \nint fffi1uint(unsigned char *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned char tnull, unsigned int nullval,\n            char *nullarray, int *anynull, unsigned int *output, int *status);\nint fffi2uint(short *input, long ntodo, double scale, double zero,\n            int nullcheck, short tnull, unsigned int nullval, char *nullarray,\n            int *anynull, unsigned int *output, int *status);\nint fffi4uint(INT32BIT *input, long ntodo, double scale, double zero,\n            int nullcheck, INT32BIT tnull, unsigned int nullval, char *nullarray,\n            int *anynull, unsigned int *output, int *status);\nint fffi8uint(LONGLONG *input, long ntodo, double scale, double zero,\n            int nullcheck, LONGLONG tnull, unsigned int nullval, char *nullarray,\n            int *anynull, unsigned int *output, int *status);\nint fffr4uint(float *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned int nullval, char *nullarray,\n            int *anynull, unsigned int *output, int *status);\nint fffr8uint(double *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned int nullval, char *nullarray,\n            int *anynull, unsigned int *output, int *status);\nint fffstruint(char *input, long ntodo, double scale, double zero,\n            long twidth, double power, int nullcheck, char *snull,\n            unsigned int nullval, char *nullarray, int *anynull,\n            unsigned int *output, int *status);\n \nint fffi1i8(unsigned char *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned char tnull, LONGLONG nullval, \n            char *nullarray, int *anynull, LONGLONG *output, int *status);\nint fffi2i8(short *input, long ntodo, double scale, double zero,\n            int nullcheck, short tnull, LONGLONG nullval, char *nullarray,\n            int *anynull, LONGLONG *output, int *status);\nint fffi4i8(INT32BIT *input, long ntodo, double scale, double zero,\n            int nullcheck, INT32BIT tnull, LONGLONG nullval, char *nullarray,\n            int *anynull, LONGLONG *output, int *status);\nint fffi8i8(LONGLONG *input, long ntodo, double scale, double zero,\n            int nullcheck, LONGLONG tnull, LONGLONG nullval, char *nullarray,\n            int *anynull, LONGLONG *output, int *status);\nint fffr4i8(float *input, long ntodo, double scale, double zero,\n            int nullcheck, LONGLONG nullval, char *nullarray,\n            int *anynull, LONGLONG *output, int *status);\nint fffr8i8(double *input, long ntodo, double scale, double zero,\n            int nullcheck, LONGLONG nullval, char *nullarray,\n            int *anynull, LONGLONG *output, int *status);\nint fffstri8(char *input, long ntodo, double scale, double zero,\n            long twidth, double power, int nullcheck, char *snull,\n            LONGLONG nullval, char *nullarray, int *anynull, LONGLONG *output,\n            int *status);\n\nint fffi1u8(unsigned char *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned char tnull, ULONGLONG nullval, \n            char *nullarray, int *anynull, ULONGLONG *output, int *status);\nint fffi2u8(short *input, long ntodo, double scale, double zero,\n            int nullcheck, short tnull, ULONGLONG nullval, char *nullarray,\n            int *anynull, ULONGLONG *output, int *status);\nint fffi4u8(INT32BIT *input, long ntodo, double scale, double zero,\n            int nullcheck, INT32BIT tnull, ULONGLONG nullval, char *nullarray,\n            int *anynull, ULONGLONG *output, int *status);\nint fffi8u8(LONGLONG *input, long ntodo, double scale, double zero,\n            int nullcheck, LONGLONG tnull, ULONGLONG nullval, char *nullarray,\n            int *anynull, ULONGLONG *output, int *status);\nint fffr4u8(float *input, long ntodo, double scale, double zero,\n            int nullcheck, ULONGLONG nullval, char *nullarray,\n            int *anynull, ULONGLONG *output, int *status);\nint fffr8u8(double *input, long ntodo, double scale, double zero,\n            int nullcheck, ULONGLONG nullval, char *nullarray,\n            int *anynull, ULONGLONG *output, int *status);\nint fffstru8(char *input, long ntodo, double scale, double zero,\n            long twidth, double power, int nullcheck, char *snull,\n            ULONGLONG nullval, char *nullarray, int *anynull, ULONGLONG *output,\n            int *status);\n\n\nint fffi1r4(unsigned char *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned char tnull, float nullval, char *nullarray,\n            int *anynull, float *output, int *status);\nint fffi2r4(short *input, long ntodo, double scale, double zero,\n            int nullcheck, short tnull, float nullval, char *nullarray,\n            int *anynull, float *output, int *status);\nint fffi4r4(INT32BIT *input, long ntodo, double scale, double zero,\n            int nullcheck, INT32BIT tnull, float nullval, char *nullarray,\n            int *anynull, float *output, int *status);\nint fffi8r4(LONGLONG *input, long ntodo, double scale, double zero,\n            int nullcheck, LONGLONG tnull, float nullval, char *nullarray,\n            int *anynull, float *output, int *status);\nint fffr4r4(float *input, long ntodo, double scale, double zero,\n            int nullcheck, float nullval, char *nullarray,\n            int *anynull, float *output, int *status);\nint fffr8r4(double *input, long ntodo, double scale, double zero,\n            int nullcheck, float nullval, char *nullarray,\n            int *anynull, float *output, int *status);\nint fffstrr4(char *input, long ntodo, double scale, double zero,\n            long twidth, double power, int nullcheck, char *snull,\n            float nullval, char *nullarray, int *anynull, float *output,\n            int *status);\n \nint fffi1r8(unsigned char *input, long ntodo, double scale, double zero,\n            int nullcheck, unsigned char tnull, double nullval, char *nullarray,\n            int *anynull, double *output, int *status);\nint fffi2r8(short *input, long ntodo, double scale, double zero,\n            int nullcheck, short tnull, double nullval, char *nullarray,\n            int *anynull, double *output, int *status);\nint fffi4r8(INT32BIT *input, long ntodo, double scale, double zero,\n            int nullcheck, INT32BIT tnull, double nullval, char *nullarray,\n            int *anynull, double *output, int *status);\nint fffi8r8(LONGLONG *input, long ntodo, double scale, double zero,\n            int nullcheck, LONGLONG tnull, double nullval, char *nullarray,\n            int *anynull, double *output, int *status);\nint fffr4r8(float *input, long ntodo, double scale, double zero,\n            int nullcheck, double nullval, char *nullarray,\n            int *anynull, double *output, int *status);\nint fffr8r8(double *input, long ntodo, double scale, double zero,\n            int nullcheck, double nullval, char *nullarray,\n            int *anynull, double *output, int *status);\nint fffstrr8(char *input, long ntodo, double scale, double zero,\n            long twidth, double power, int nullcheck, char *snull,\n            double nullval, char *nullarray, int *anynull, double *output,\n            int *status);\n \nint ffi1fi1(unsigned char *array, long ntodo, double scale, double zero,\n            unsigned char *buffer, int *status);\nint ffs1fi1(signed char *array, long ntodo, double scale, double zero,\n            unsigned char *buffer, int *status);\nint ffu2fi1(unsigned short *array, long ntodo, double scale, double zero,\n            unsigned char *buffer, int *status);\nint ffi2fi1(short *array, long ntodo, double scale, double zero,\n            unsigned char *buffer, int *status);\nint ffu4fi1(unsigned long *array, long ntodo, double scale, double zero,\n            unsigned char *buffer, int *status);\nint ffi4fi1(long *array, long ntodo, double scale, double zero,\n            unsigned char *buffer, int *status);\nint ffu8fi1(ULONGLONG *array, long ntodo, double scale, double zero,\n            unsigned char *buffer, int *status);\nint ffi8fi1(LONGLONG *array, long ntodo, double scale, double zero,\n            unsigned char *buffer, int *status);\nint ffuintfi1(unsigned int *array, long ntodo, double scale, double zero,\n            unsigned char *buffer, int *status);\nint ffintfi1(int *array, long ntodo, double scale, double zero,\n            unsigned char *buffer, int *status);\nint ffr4fi1(float *array, long ntodo, double scale, double zero,\n            unsigned char *buffer, int *status);\nint ffr8fi1(double *array, long ntodo, double scale, double zero,\n            unsigned char *buffer, int *status);\n \nint ffi1fi2(unsigned char *array, long ntodo, double scale, double zero,\n            short *buffer, int *status);\nint ffs1fi2(signed char *array, long ntodo, double scale, double zero,\n            short *buffer, int *status);\nint ffu2fi2(unsigned short *array, long ntodo, double scale, double zero,\n            short *buffer, int *status);\nint ffi2fi2(short *array, long ntodo, double scale, double zero,\n            short *buffer, int *status);\nint ffu4fi2(unsigned long *array, long ntodo, double scale, double zero,\n            short *buffer, int *status);\nint ffi4fi2(long *array, long ntodo, double scale, double zero,\n            short *buffer, int *status);\nint ffu8fi2(ULONGLONG *array, long ntodo, double scale, double zero,\n            short *buffer, int *status);\nint ffi8fi2(LONGLONG *array, long ntodo, double scale, double zero,\n            short *buffer, int *status);\nint ffuintfi2(unsigned int *array, long ntodo, double scale, double zero,\n            short *buffer, int *status);\nint ffintfi2(int *array, long ntodo, double scale, double zero,\n            short *buffer, int *status);\nint ffr4fi2(float *array, long ntodo, double scale, double zero,\n            short *buffer, int *status);\nint ffr8fi2(double *array, long ntodo, double scale, double zero,\n            short *buffer, int *status);\n \nint ffi1fi4(unsigned char *array, long ntodo, double scale, double zero,\n            INT32BIT *buffer, int *status);\nint ffs1fi4(signed char *array, long ntodo, double scale, double zero,\n            INT32BIT *buffer, int *status);\nint ffu2fi4(unsigned short *array, long ntodo, double scale, double zero,\n            INT32BIT *buffer, int *status);\nint ffi2fi4(short *array, long ntodo, double scale, double zero,\n            INT32BIT *buffer, int *status);\nint ffu4fi4(unsigned long *array, long ntodo, double scale, double zero,\n            INT32BIT *buffer, int *status);\nint ffu8fi4(ULONGLONG *array, long ntodo, double scale, double zero,\n            INT32BIT *buffer, int *status);\nint ffi4fi4(long *array, long ntodo, double scale, double zero,\n            INT32BIT *buffer, int *status);\nint ffi8fi4(LONGLONG *array, long ntodo, double scale, double zero,\n            INT32BIT *buffer, int *status);\nint ffuintfi4(unsigned int *array, long ntodo, double scale, double zero,\n            INT32BIT *buffer, int *status);\nint ffintfi4(int *array, long ntodo, double scale, double zero,\n            INT32BIT *buffer, int *status);\nint ffr4fi4(float *array, long ntodo, double scale, double zero,\n            INT32BIT *buffer, int *status);\nint ffr8fi4(double *array, long ntodo, double scale, double zero,\n            INT32BIT *buffer, int *status);\n\nint ffi4fi8(long *array, long ntodo, double scale, double zero,\n            LONGLONG *buffer, int *status);\nint ffi8fi8(LONGLONG *array, long ntodo, double scale, double zero,\n            LONGLONG *buffer, int *status);\nint ffi2fi8(short *array, long ntodo, double scale, double zero,\n            LONGLONG *buffer, int *status);\nint ffi1fi8(unsigned char *array, long ntodo, double scale, double zero,\n            LONGLONG *buffer, int *status);\nint ffs1fi8(signed char *array, long ntodo, double scale, double zero,\n            LONGLONG *buffer, int *status);\nint ffr4fi8(float *array, long ntodo, double scale, double zero,\n            LONGLONG *buffer, int *status);\nint ffr8fi8(double *array, long ntodo, double scale, double zero,\n            LONGLONG *buffer, int *status);\nint ffintfi8(int *array, long ntodo, double scale, double zero,\n            LONGLONG *buffer, int *status);\nint ffu2fi8(unsigned short *array, long ntodo, double scale, double zero,\n            LONGLONG *buffer, int *status);\nint ffu4fi8(unsigned long *array, long ntodo, double scale, double zero,\n            LONGLONG *buffer, int *status);\nint ffu8fi8(ULONGLONG *array, long ntodo, double scale, double zero,\n            LONGLONG *buffer, int *status);\nint ffuintfi8(unsigned int *array, long ntodo, double scale, double zero,\n            LONGLONG *buffer, int *status);\n\nint ffi1fr4(unsigned char *array, long ntodo, double scale, double zero,\n            float *buffer, int *status);\nint ffs1fr4(signed char *array, long ntodo, double scale, double zero,\n            float *buffer, int *status);\nint ffu2fr4(unsigned short *array, long ntodo, double scale, double zero,\n            float *buffer, int *status);\nint ffi2fr4(short *array, long ntodo, double scale, double zero,\n            float *buffer, int *status);\nint ffu4fr4(unsigned long *array, long ntodo, double scale, double zero,\n            float *buffer, int *status);\nint ffi4fr4(long *array, long ntodo, double scale, double zero,\n            float *buffer, int *status);\nint ffu8fr4(ULONGLONG *array, long ntodo, double scale, double zero,\n            float *buffer, int *status);\nint ffi8fr4(LONGLONG *array, long ntodo, double scale, double zero,\n            float *buffer, int *status);\nint ffuintfr4(unsigned int *array, long ntodo, double scale, double zero,\n            float *buffer, int *status);\nint ffintfr4(int *array, long ntodo, double scale, double zero,\n            float *buffer, int *status);\nint ffr4fr4(float *array, long ntodo, double scale, double zero,\n            float *buffer, int *status);\nint ffr8fr4(double *array, long ntodo, double scale, double zero,\n            float *buffer, int *status);\n \nint ffi1fr8(unsigned char *array, long ntodo, double scale, double zero,\n            double *buffer, int *status);\nint ffs1fr8(signed char *array, long ntodo, double scale, double zero,\n            double *buffer, int *status);\nint ffu2fr8(unsigned short *array, long ntodo, double scale, double zero,\n            double *buffer, int *status);\nint ffi2fr8(short *array, long ntodo, double scale, double zero,\n            double *buffer, int *status);\nint ffu4fr8(unsigned long *array, long ntodo, double scale, double zero,\n            double *buffer, int *status);\nint ffi4fr8(long *array, long ntodo, double scale, double zero,\n            double *buffer, int *status);\nint ffu8fr8(ULONGLONG *array, long ntodo, double scale, double zero,\n            double *buffer, int *status);\nint ffi8fr8(LONGLONG *array, long ntodo, double scale, double zero,\n            double *buffer, int *status);\nint ffuintfr8(unsigned int *array, long ntodo, double scale, double zero,\n            double *buffer, int *status);\nint ffintfr8(int *array, long ntodo, double scale, double zero,\n            double *buffer, int *status);\nint ffr4fr8(float *array, long ntodo, double scale, double zero,\n            double *buffer, int *status);\nint ffr8fr8(double *array, long ntodo, double scale, double zero,\n            double *buffer, int *status);\n\nint ffi1fstr(unsigned char *input, long ntodo, double scale, double zero,\n            char *cform, long twidth, char *output, int *status);\nint ffs1fstr(signed char *input, long ntodo, double scale, double zero,\n            char *cform, long twidth, char *output, int *status);\nint ffu2fstr(unsigned short *input, long ntodo, double scale, double zero,\n            char *cform, long twidth, char *output, int *status);\nint ffi2fstr(short *input, long ntodo, double scale, double zero,\n            char *cform, long twidth, char *output, int *status);\nint ffu4fstr(unsigned long *input, long ntodo, double scale, double zero,\n            char *cform, long twidth, char *output, int *status);\nint ffi4fstr(long *input, long ntodo, double scale, double zero,\n            char *cform, long twidth, char *output, int *status);\nint ffu8fstr(ULONGLONG *input, long ntodo, double scale, double zero,\n            char *cform, long twidth, char *output, int *status);\nint ffi8fstr(LONGLONG *input, long ntodo, double scale, double zero,\n            char *cform, long twidth, char *output, int *status);\nint ffintfstr(int *input, long ntodo, double scale, double zero,\n            char *cform, long twidth, char *output, int *status);\nint ffuintfstr(unsigned int *input, long ntodo, double scale, double zero,\n            char *cform, long twidth, char *output, int *status);\nint ffr4fstr(float *input, long ntodo, double scale, double zero,\n            char *cform, long twidth, char *output, int *status);\nint ffr8fstr(double *input, long ntodo, double scale, double zero,\n            char *cform, long twidth, char *output, int *status);\n\n/*  the following 4 routines are VMS macros used on VAX or Alpha VMS */\nvoid ieevpd(double *inarray, double *outarray, long *nvals);\nvoid ieevud(double *inarray, double *outarray, long *nvals);\nvoid ieevpr(float *inarray, float *outarray, long *nvals);\nvoid ieevur(float *inarray, float *outarray, long *nvals);\n\n/*  routines related to the lexical parser  */\nint  ffselect_table(fitsfile **fptr, char *outfile, char *expr,  int *status);\nint  ffiprs( fitsfile *fptr, int compressed, char *expr, int maxdim,\n\t     int *datatype, long *nelem, int *naxis, long *naxes,\n\t     int *status );\nvoid ffcprs( void );\nint  ffcvtn( int inputType, void *input, char *undef, long ntodo,\n\t     int outputType, void *nulval, void *output,\n\t     int *anynull, int *status );\nint  parse_data( long totalrows, long offset, long firstrow,\n                 long nrows, int nCols, iteratorCol *colData,\n                 void *userPtr );\nint  uncompress_hkdata( fitsfile *fptr, long ntimes, \n                        double *times, int *status );\nint  ffffrw_work( long totalrows, long offset, long firstrow,\n                  long nrows, int nCols, iteratorCol *colData,\n                  void *userPtr );\n\nint fits_translate_pixkeyword(char *inrec, char *outrec,char *patterns[][2],\n    int npat, int naxis, int *colnum, int *pat_num, int *i,\n      int *j, int *n, int *m, int *l, int *status);\n\n/*  image compression routines */\nint fits_write_compressed_img(fitsfile *fptr, \n            int  datatype, long  *fpixel, long *lpixel,   \n            int nullcheck, void *array,  void *nulval,\n            int  *status);\nint fits_write_compressed_pixels(fitsfile *fptr, \n            int  datatype, LONGLONG  fpixel, LONGLONG npixels,   \n            int nullcheck,  void *array, void *nulval,\n            int  *status);\nint fits_write_compressed_img_plane(fitsfile *fptr, int  datatype, \n      int  bytesperpixel,  long   nplane, long *firstcoord, long *lastcoord, \n      long *naxes,  int  nullcheck, \n      void *array,  void *nullval, long *nread, int  *status);\n\nint imcomp_init_table(fitsfile *outfptr,\n        int bitpix, int naxis,long *naxes, int writebitpix, int *status);\nint imcomp_calc_max_elem (int comptype, int nx, int zbitpix, int blocksize);\nint imcomp_copy_imheader(fitsfile *infptr, fitsfile *outfptr,\n                int *status);\nint imcomp_copy_img2comp(fitsfile *infptr, fitsfile *outfptr, int *status);\nint imcomp_copy_comp2img(fitsfile *infptr, fitsfile *outfptr, \n                          int norec, int *status);\nint imcomp_copy_prime2img(fitsfile *infptr, fitsfile *outfptr, int *status);\nint imcomp_compress_image (fitsfile *infptr, fitsfile *outfptr,\n                 int *status);\nint imcomp_compress_tile (fitsfile *outfptr, long row, \n    int datatype,  void *tiledata, long tilelen, long nx, long ny,\n    int nullcheck, void *nullval, int *status);\nint imcomp_nullscale(int *idata, long tilelen, int nullflagval, int nullval,\n     double scale, double zero, int * status);\nint imcomp_nullvalues(int *idata, long tilelen, int nullflagval, int nullval,\n     int * status);\nint imcomp_scalevalues(int *idata, long tilelen, double scale, double zero,\n     int * status);\nint imcomp_nullscalefloats(float *fdata, long tilelen, int *idata, \n    double scale, double zero, int nullcheck, float nullflagval, int nullval,\n    int *status);\nint imcomp_nullfloats(float *fdata, long tilelen, int *idata, int nullcheck,\n    float nullflagval, int nullval, int *status);\nint imcomp_nullscaledoubles(double *fdata, long tilelen, int *idata, \n    double scale, double zero, int nullcheck, double nullflagval, int nullval,\n    int *status);\nint imcomp_nulldoubles(double *fdata, long tilelen, int *idata, int nullcheck,\n    double nullflagval, int nullval, int *status);\n    \n \n/*  image decompression routines */\nint fits_read_compressed_img(fitsfile *fptr, \n            int  datatype, LONGLONG  *fpixel,LONGLONG  *lpixel,long *inc,   \n            int nullcheck, void *nulval,  void *array, char *nullarray,\n            int  *anynul, int  *status);\nint fits_read_compressed_pixels(fitsfile *fptr, \n            int  datatype, LONGLONG  fpixel, LONGLONG npixels,   \n            int nullcheck, void *nulval,  void *array, char *nullarray,\n            int  *anynul, int  *status);\nint fits_read_compressed_img_plane(fitsfile *fptr, int  datatype, \n      int  bytesperpixel,  long   nplane, LONGLONG *firstcoord, LONGLONG *lastcoord, \n      long *inc,  long *naxes,  int  nullcheck,  void *nullval, \n      void *array, char *nullarray, int  *anynul, long *nread, int  *status);\n\nint imcomp_get_compressed_image_par(fitsfile *infptr, int *status);\nint imcomp_decompress_tile (fitsfile *infptr,\n          int nrow, int tilesize, int datatype, int nullcheck,\n          void *nulval, void *buffer, char *bnullarray, int *anynul,\n          int *status);\nint imcomp_copy_overlap (char *tile, int pixlen, int ndim,\n         long *tfpixel, long *tlpixel, char *bnullarray, char *image,\n         long *fpixel, long *lpixel, long *inc, int nullcheck, char *nullarray,\n         int *status);\nint imcomp_test_overlap (int ndim, long *tfpixel, long *tlpixel, \n         long *fpixel, long *lpixel, long *inc, int *status);\nint imcomp_merge_overlap (char *tile, int pixlen, int ndim,\n         long *tfpixel, long *tlpixel, char *bnullarray, char *image,\n         long *fpixel, long *lpixel, int nullcheck, int *status);\nint imcomp_decompress_img(fitsfile *infptr, fitsfile *outfptr, int datatype,\n         int  *status);\nint fits_quantize_float (long row, float fdata[], long nx, long ny, int nullcheck,\n         float in_null_value, float quantize_level, \n           int dither_method, int idata[], double *bscale, double *bzero,\n           int *iminval, int *imaxval);\nint fits_quantize_double (long row, double fdata[], long nx, long ny, int nullcheck,\n         double in_null_value, float quantize_level,\n           int dither_method, int idata[], double *bscale, double *bzero,\n           int *iminval, int *imaxval);\nint fits_rcomp(int a[], int nx, unsigned char *c, int clen,int nblock);\nint fits_rcomp_short(short a[], int nx, unsigned char *c, int clen,int nblock);\nint fits_rcomp_byte(signed char a[], int nx, unsigned char *c, int clen,int nblock);\nint fits_rdecomp (unsigned char *c, int clen, unsigned int array[], int nx,\n             int nblock);\nint fits_rdecomp_short (unsigned char *c, int clen, unsigned short array[], int nx,\n             int nblock);\nint fits_rdecomp_byte (unsigned char *c, int clen, unsigned char array[], int nx,\n             int nblock);\nint pl_p2li (int *pxsrc, int xs, short *lldst, int npix);\nint pl_l2pi (short *ll_src, int xs, int *px_dst, int npix);\nint fits_init_randoms(void);\nint fits_unset_compression_param( fitsfile *fptr, int *status);\nint fits_unset_compression_request( fitsfile *fptr, int *status);\nint fitsio_init_lock(void);\n\n/* general driver routines */\n\nint urltype2driver(char *urltype, int *driver);\n\nvoid fits_dwnld_prog_bar(int flag);\nint fits_net_timeout(int sec);\n\nint fits_register_driver( char *prefix,\n\tint (*init)(void),\n\tint (*fitsshutdown)(void),\n\tint (*setoptions)(int option),\n\tint (*getoptions)(int *options),\n\tint (*getversion)(int *version),\n\tint (*checkfile) (char *urltype, char *infile, char *outfile),\n\tint (*fitsopen)(char *filename, int rwmode, int *driverhandle),\n\tint (*fitscreate)(char *filename, int *driverhandle),\n\tint (*fitstruncate)(int driverhandle, LONGLONG filesize),\n\tint (*fitsclose)(int driverhandle),\n\tint (*fremove)(char *filename),\n        int (*size)(int driverhandle, LONGLONG *sizex),\n\tint (*flush)(int driverhandle),\n\tint (*seek)(int driverhandle, LONGLONG offset),\n\tint (*fitsread) (int driverhandle, void *buffer, long nbytes),\n\tint (*fitswrite)(int driverhandle, void *buffer, long nbytes));\n\n/* file driver I/O routines */\n\nint file_init(void);\nint file_setoptions(int options);\nint file_getoptions(int *options);\nint file_getversion(int *version);\nint file_shutdown(void);\nint file_checkfile(char *urltype, char *infile, char *outfile);\nint file_open(char *filename, int rwmode, int *driverhandle);\nint file_compress_open(char *filename, int rwmode, int *hdl);\nint file_openfile(char *filename, int rwmode, FILE **diskfile);\nint file_create(char *filename, int *driverhandle);\nint file_truncate(int driverhandle, LONGLONG filesize);\nint file_size(int driverhandle, LONGLONG *filesize);\nint file_close(int driverhandle);\nint file_remove(char *filename);\nint file_flush(int driverhandle);\nint file_seek(int driverhandle, LONGLONG offset);\nint file_read (int driverhandle, void *buffer, long nbytes);\nint file_write(int driverhandle, void *buffer, long nbytes);\nint file_is_compressed(char *filename);\n\n/* stream driver I/O routines */\n\nint stream_open(char *filename, int rwmode, int *driverhandle);\nint stream_create(char *filename, int *driverhandle);\nint stream_size(int driverhandle, LONGLONG *filesize);\nint stream_close(int driverhandle);\nint stream_flush(int driverhandle);\nint stream_seek(int driverhandle, LONGLONG offset);\nint stream_read (int driverhandle, void *buffer, long nbytes);\nint stream_write(int driverhandle, void *buffer, long nbytes);\n\n/* memory driver I/O routines */\n\nint mem_init(void);\nint mem_setoptions(int options);\nint mem_getoptions(int *options);\nint mem_getversion(int *version);\nint mem_shutdown(void);\nint mem_create(char *filename, int *handle);\nint mem_create_comp(char *filename, int *handle);\nint mem_openmem(void **buffptr, size_t *buffsize, size_t deltasize,\n                void *(*memrealloc)(void *p, size_t newsize), int *handle);\nint mem_createmem(size_t memsize, int *handle);\nint stdin_checkfile(char *urltype, char *infile, char *outfile);\nint stdin_open(char *filename, int rwmode, int *handle);\nint stdin2mem(int hd);\nint stdin2file(int hd);\nint stdout_close(int handle);\nint mem_compress_openrw(char *filename, int rwmode, int *hdl);\nint mem_compress_open(char *filename, int rwmode, int *hdl);\nint mem_compress_stdin_open(char *filename, int rwmode, int *hdl);\nint mem_iraf_open(char *filename, int rwmode, int *hdl);\nint mem_rawfile_open(char *filename, int rwmode, int *hdl);\nint mem_size(int handle, LONGLONG *filesize);\nint mem_truncate(int handle, LONGLONG filesize);\nint mem_close_free(int handle);\nint mem_close_keep(int handle);\nint mem_close_comp(int handle);\nint mem_seek(int handle, LONGLONG offset);\nint mem_read(int hdl, void *buffer, long nbytes);\nint mem_write(int hdl, void *buffer, long nbytes);\nint mem_uncompress2mem(char *filename, FILE *diskfile, int hdl);\n\nint iraf2mem(char *filename, char **buffptr, size_t *buffsize, \n      size_t *filesize, int *status);\n\n/* root driver I/O routines */\n\nint root_init(void);\nint root_setoptions(int options);\nint root_getoptions(int *options);\nint root_getversion(int *version);\nint root_shutdown(void);\nint root_open(char *filename, int rwmode, int *driverhandle);\nint root_create(char *filename, int *driverhandle);\nint root_close(int driverhandle);\nint root_flush(int driverhandle);\nint root_seek(int driverhandle, LONGLONG offset);\nint root_read (int driverhandle, void *buffer, long nbytes);\nint root_write(int driverhandle, void *buffer, long nbytes);\nint root_size(int handle, LONGLONG *filesize);\n\n/* http driver I/O routines */\n\nint http_checkfile(char *urltype, char *infile, char *outfile);\nint http_open(char *filename, int rwmode, int *driverhandle);\nint http_file_open(char *filename, int rwmode, int *driverhandle);\nint http_compress_open(char *filename, int rwmode, int *driverhandle);\n\n/* https driver I/O routines */\nint https_checkfile(char* urltype, char *infile, char *outfile);\nint https_open(char *filename, int rwmode, int *driverhandle);\nint https_file_open(char *filename, int rwmode, int *driverhandle);\nvoid https_set_verbose(int flag);\n\n/* ftps driver I/O routines */\nint ftps_checkfile(char* urltype, char *infile, char *outfile);\nint ftps_open(char *filename, int rwmode, int *handle);\nint ftps_file_open(char *filename, int rwmode, int *handle);\nint ftps_compress_open(char *filename, int rwmode, int *driverhandle);\n\n/* ftp driver I/O routines */\n\nint ftp_checkfile(char *urltype, char *infile, char *outfile);\nint ftp_open(char *filename, int rwmode, int *driverhandle);\nint ftp_file_open(char *filename, int rwmode, int *driverhandle);\nint ftp_compress_open(char *filename, int rwmode, int *driverhandle);\n\nint uncompress2mem(char *filename, FILE *diskfile,\n             char **buffptr, size_t *buffsize,\n             void *(*mem_realloc)(void *p, size_t newsize),\n             size_t *filesize, int *status);\n\nint uncompress2mem_from_mem(                                                \n             char *inmemptr,     \n             size_t inmemsize, \n             char **buffptr,  \n             size_t *buffsize,  \n             void *(*mem_realloc)(void *p, size_t newsize), \n             size_t *filesize,  \n             int *status);\n\nint uncompress2file(char *filename, \n             FILE *indiskfile, \n             FILE *outdiskfile, \n             int *status);\n\nint compress2mem_from_mem(                                                \n             char *inmemptr,     \n             size_t inmemsize, \n             char **buffptr,  \n             size_t *buffsize,  \n             void *(*mem_realloc)(void *p, size_t newsize), \n             size_t *filesize,  \n             int *status);\n\nint compress2file_from_mem(                                                \n             char *inmemptr,     \n             size_t inmemsize, \n             FILE *outdiskfile, \n             size_t *filesize,   /* O - size of file, in bytes              */\n             int *status);\n\n\n#ifdef HAVE_GSIFTP\n/* prototypes for gsiftp driver I/O routines */\n#include \"drvrgsiftp.h\"\n#endif\n\n#ifdef HAVE_SHMEM_SERVICES\n/* prototypes for shared memory driver I/O routines  */\n#include \"drvrsmem.h\"\n#endif\n\n/* A hack for nonunix machines, which lack strcasecmp and strncasecmp */\n/* these functions are in fitscore.c */\nint fits_strcasecmp (const char *s1, const char *s2       );\nint fits_strncasecmp(const char *s1, const char *s2, size_t n);\n\n/* end of the entire \"ifndef _FITSIO2_H\" block */\n#endif\n"},{"id":16714,"name":"swapproc.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, swapproc.c, contains general utility routines that are      */\n/*  used by other FITSIO routines to swap bytes.                           */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n/* The fast SSE2 and SSSE3 functions were provided by Julian Taylor, ESO */\n\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n\n/* bswap builtin is available since GCC 4.3 */\n#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)\n#define HAVE_BSWAP\n#endif\n\n#ifdef __SSSE3__\n#include <tmmintrin.h>\n/* swap 16 bytes according to mask, values must be 16 byte aligned */\nstatic inline void swap_ssse3(char * values, __m128i mask)\n{\n    __m128i v = _mm_load_si128((__m128i *)values);\n    __m128i s = _mm_shuffle_epi8(v, mask);\n    _mm_store_si128((__m128i*)values, s);\n}\n#endif\n#ifdef __SSE2__\n#include <emmintrin.h>\n/* swap 8 shorts, values must be 16 byte aligned\n * faster than ssse3 variant for shorts */\nstatic inline void swap2_sse2(char * values)\n{\n    __m128i r1 = _mm_load_si128((__m128i *)values);\n    __m128i r2 = r1;\n    r1 = _mm_srli_epi16(r1, 8);\n    r2 = _mm_slli_epi16(r2, 8);\n    r1 = _mm_or_si128(r1, r2);\n    _mm_store_si128((__m128i*)values, r1);\n}\n/* the three shuffles required for 4 and 8 byte variants make\n * SSE2 slower than bswap */\n\n\n/* get number of elements to peel to reach alignment */\nstatic inline size_t get_peel(void * addr, size_t esize, size_t nvals,\n                              size_t alignment)\n{\n    const size_t offset = (size_t)addr % alignment;\n    size_t peel = offset ? (alignment - offset) / esize : 0;\n    peel = nvals < peel ? nvals : peel;\n    return peel;\n}\n#endif\n\n/*--------------------------------------------------------------------------*/\nstatic void ffswap2_slow(short *svalues, long nvals)\n{\n    register long ii;\n    unsigned short * usvalues;\n\n    usvalues = (unsigned short *) svalues;\n\n    for (ii = 0; ii < nvals; ii++)\n    {\n        usvalues[ii] = (usvalues[ii]>>8) | (usvalues[ii]<<8);\n    }\n}\n/*--------------------------------------------------------------------------*/\n#if __SSE2__\nvoid ffswap2(short *svalues,  /* IO - pointer to shorts to be swapped    */\n             long nvals)     /* I  - number of shorts to be swapped     */\n/*\n  swap the bytes in the input short integers: ( 0 1 -> 1 0 )\n*/\n{\n    if ((long)svalues % 2 != 0) { /* should not happen */\n        ffswap2_slow(svalues, nvals);\n        return;\n    }\n\n    long ii;\n    size_t peel = get_peel((void*)&svalues[0], sizeof(svalues[0]), nvals, 16);\n\n    ffswap2_slow(svalues, peel);\n    for (ii = peel; ii < (nvals - peel - (nvals - peel) % 8); ii+=8) {\n        swap2_sse2((char*)&svalues[ii]);\n    }\n    ffswap2_slow(&svalues[ii], nvals - ii);\n}\n#else\nvoid ffswap2(short *svalues,  /* IO - pointer to shorts to be swapped    */\n             long nvals)     /* I  - number of shorts to be swapped     */\n/*\n  swap the bytes in the input 4-byte integer: ( 0 1 2 3 -> 3 2 1 0 )\n*/\n{\n    ffswap2_slow(svalues, nvals);\n}\n#endif\n/*--------------------------------------------------------------------------*/\nstatic void ffswap4_slow(INT32BIT *ivalues, long nvals)\n{\n    register long ii;\n\n#if defined(HAVE_BSWAP)\n    for (ii = 0; ii < nvals; ii++)\n    {\n        ivalues[ii] = __builtin_bswap32(ivalues[ii]);\n    }\n#elif defined(_MSC_VER) && (_MSC_VER >= 1400)\n    /* intrinsic byte swapping function in Microsoft Visual C++ 8.0 and later */\n    unsigned int* uivalues = (unsigned int *) ivalues;\n\n    /* intrinsic byte swapping function in Microsoft Visual C++ */\n    for (ii = 0; ii < nvals; ii++)\n    {\n        uivalues[ii] = _byteswap_ulong(uivalues[ii]);\n    }\n#else\n    char *cvalues, tmp;\n\n    for (ii = 0; ii < nvals; ii++)\n    {\n        cvalues = (char *)&ivalues[ii];\n        tmp = cvalues[0];\n        cvalues[0] = cvalues[3];\n        cvalues[3] = tmp;\n        tmp = cvalues[1];\n        cvalues[1] = cvalues[2];\n        cvalues[2] = tmp;\n    }\n#endif\n}\n/*--------------------------------------------------------------------------*/\n#ifdef __SSSE3__\nvoid ffswap4(INT32BIT *ivalues,  /* IO - pointer to INT*4 to be swapped    */\n                 long nvals)     /* I  - number of floats to be swapped     */\n/*\n  swap the bytes in the input 4-byte integer: ( 0 1 2 3 -> 3 2 1 0 )\n*/\n{\n    if ((long)ivalues % 4 != 0) { /* should not happen */\n        ffswap4_slow(ivalues, nvals);\n        return;\n    }\n\n    long ii;\n    const __m128i cmask4 = _mm_set_epi8(12, 13, 14, 15,\n                                        8, 9, 10, 11,\n                                        4, 5, 6, 7,\n                                        0, 1, 2 ,3);\n    size_t peel = get_peel((void*)&ivalues[0], sizeof(ivalues[0]), nvals, 16);\n    ffswap4_slow(ivalues, peel);\n    for (ii = peel; ii < (nvals - peel - (nvals - peel) % 4); ii+=4) {\n        swap_ssse3((char*)&ivalues[ii], cmask4);\n    }\n    ffswap4_slow(&ivalues[ii], nvals - ii);\n}\n#else\nvoid ffswap4(INT32BIT *ivalues,  /* IO - pointer to INT*4 to be swapped    */\n                 long nvals)     /* I  - number of floats to be swapped     */\n/*\n  swap the bytes in the input 4-byte integer: ( 0 1 2 3 -> 3 2 1 0 )\n*/\n{\n    ffswap4_slow(ivalues, nvals);\n}\n#endif\n/*--------------------------------------------------------------------------*/\nstatic void ffswap8_slow(double *dvalues, long nvals)\n{\n    register long ii;\n#ifdef HAVE_BSWAP\n    LONGLONG * llvalues = (LONGLONG*)dvalues;\n\n    for (ii = 0; ii < nvals; ii++) {\n        llvalues[ii] = __builtin_bswap64(llvalues[ii]);\n    }\n#elif defined(_MSC_VER) && (_MSC_VER >= 1400)\n    /* intrinsic byte swapping function in Microsoft Visual C++ 8.0 and later */\n    unsigned __int64 * llvalues = (unsigned __int64 *) dvalues;\n\n    for (ii = 0; ii < nvals; ii++)\n    {\n        llvalues[ii] = _byteswap_uint64(llvalues[ii]);\n    }\n#else\n    register char *cvalues;\n    register char temp;\n\n    cvalues = (char *) dvalues;      /* copy the pointer value */\n\n    for (ii = 0; ii < nvals*8; ii += 8)\n    {\n        temp = cvalues[ii];\n        cvalues[ii] = cvalues[ii+7];\n        cvalues[ii+7] = temp;\n\n        temp = cvalues[ii+1];\n        cvalues[ii+1] = cvalues[ii+6];\n        cvalues[ii+6] = temp;\n\n        temp = cvalues[ii+2];\n        cvalues[ii+2] = cvalues[ii+5];\n        cvalues[ii+5] = temp;\n\n        temp = cvalues[ii+3];\n        cvalues[ii+3] = cvalues[ii+4];\n        cvalues[ii+4] = temp;\n    }\n#endif\n}\n/*--------------------------------------------------------------------------*/\n#ifdef __SSSE3__\nvoid ffswap8(double *dvalues,  /* IO - pointer to doubles to be swapped     */\n             long nvals)       /* I  - number of doubles to be swapped      */\n/*\n  swap the bytes in the input doubles: ( 01234567  -> 76543210 )\n*/\n{\n    if ((long)dvalues % 8 != 0) { /* should not happen on amd64 */\n        ffswap8_slow(dvalues, nvals);\n        return;\n    }\n\n    long ii;\n    const __m128i cmask8 = _mm_set_epi8(8, 9, 10, 11, 12, 13, 14, 15,\n                                        0, 1, 2 ,3, 4, 5, 6, 7);\n    size_t peel = get_peel((void*)&dvalues[0], sizeof(dvalues[0]), nvals, 16);\n    ffswap8_slow(dvalues, peel);\n    for (ii = peel; ii < (nvals - peel - (nvals - peel) % 2); ii+=2) {\n        swap_ssse3((char*)&dvalues[ii], cmask8);\n    }\n    ffswap8_slow(&dvalues[ii], nvals - ii);\n}\n#else\nvoid ffswap8(double *dvalues,  /* IO - pointer to doubles to be swapped     */\n             long nvals)       /* I  - number of doubles to be swapped      */\n/*\n  swap the bytes in the input doubles: ( 01234567  -> 76543210 )\n*/\n{\n    ffswap8_slow(dvalues, nvals);\n}\n#endif\n"},{"id":16715,"name":"simplerng.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/* \n   Simple Random Number Generators\n       - getuniform - uniform deviate [0,1]\n       - getnorm    - gaussian (normal) deviate (mean=0, stddev=1)\n       - getpoisson - poisson deviate for given expected mean lambda\n\n   This code is adapted from SimpleRNG by John D Cook, which is\n   provided in the public domain.\n\n   The original C++ code is found here:\n   http://www.johndcook.com/cpp_random_number_generation.html\n\n   This code has been modified in the following ways compared to the\n   original.\n     1. convert to C from C++\n     2. keep only uniform, gaussian and poisson deviates\n     3. state variables are module static instead of class variables\n     4. provide an srand() equivalent to initialize the state\n*/\n#include <math.h>\n#include <stdlib.h>\n\n#define PI 3.1415926535897932384626433832795\n\n/* Use the standard system rand() library routine if it provides\n   enough bits of information, since it probably has better randomness\n   than the toy algorithm in this module. */\n#if defined(RAND_MAX) && RAND_MAX > 1000000000\n#define USE_SYSTEM_RAND\n#endif\n\nint simplerng_poisson_small(double lambda);\nint simplerng_poisson_large(double lambda);\ndouble simplerng_getuniform_pr(unsigned int *u, unsigned int *v);\nunsigned int simplerng_getuint_pr(unsigned int *u, unsigned int *v);\ndouble simplerng_logfactorial(int n);\n\n/*\n  These values are not magical, just the default values Marsaglia used.\n  Any unit should work.\n*/\nstatic unsigned int m_u = 521288629, m_v = 362436069;\n\n/* Set u and v state variables */\nvoid simplerng_setstate(unsigned int u, unsigned int v)\n{\n    m_u = u;\n    m_v = v;\n}\n\n/* Retrieve u and v state variables */\nvoid simplerng_getstate(unsigned int *u, unsigned int *v)\n{\n    *u = m_u;\n    *v = m_v;\n}\n\n/* srand() equivalent to seed the two state variables */\nvoid simplerng_srand(unsigned int seed)\n{\n#ifdef USE_SYSTEM_RAND\n  srand(seed);\n#else\n  simplerng_setstate(seed ^ 521288629, seed ^ 362436069);\n#endif\n}\n\n/* Private routine to get uniform deviate */\ndouble simplerng_getuniform_pr(unsigned int *u, unsigned int *v)\n{\n  /* 0 <= u <= 2^32 */\n  unsigned int z = simplerng_getuint_pr(u, v);\n  /* The magic number is 1/(2^32) and so result is positive and less than 1. */\n  return z*2.328306435996595e-10;\n}\n\n/* Private routine to get unsigned integer */\n/* Marsaglia multiply-with-carry algorithm (MWC) */\nunsigned int simplerng_getuint_pr(unsigned int *u, unsigned int *v)\n{\n  *v = 36969*((*v) & 65535) + ((*v) >> 16);\n  *u = 18000*((*u) & 65535) + ((*u) >> 16);\n  return ((*v) << 16) + (*u);\n}\n\n/* Get uniform deviate [0,1] */\ndouble simplerng_getuniform(void)\n{\n#ifdef USE_SYSTEM_RAND\n  return rand()*(1.0 / ((double)RAND_MAX + 1));\n#else\n  return simplerng_getuniform_pr(&m_u, &m_v);\n#endif\n}\n\n/* Get unsigned integer [0, UINT_MAX] */\nunsigned int simplerng_getuint()\n{\n  /* WARNING: no option for calling rand() here.  Will need to provide\n     a scalar to make the uint in the [0,UINT_MAX] range */\n  return simplerng_getuint_pr(&m_u, &m_v);\n}\n    \n/* Get normal (Gaussian) random sample with mean=0, stddev=1 */\ndouble simplerng_getnorm()\n{\n  double u1, u2, r, theta;\n  static int saved = 0;\n  static double y;\n\n  /* Since you get two deviates for \"free\" with each calculation, save\n     one of them for later */\n\n  if (saved == 0) {\n    /* Use Box-Muller algorithm */\n    u1 = simplerng_getuniform();\n    u2 = simplerng_getuniform();\n    r = sqrt( -2.0*log(u1) );\n    theta = 2.0*PI*u2;\n    /* save second value for next call */\n    y = r*cos(theta);\n    saved = 1;\n    return r*sin(theta);\n\n  } else {\n    /* We already saved a value from the last call so use it */\n    saved = 0;\n    return y;\n  }\n}\n\n/* Poisson deviate for expected mean value lambda.\n   lambda should be in the range [0, infinity]\n   \n   For small lambda, a simple rejection method is used\n   For large lambda, an approximation is used\n*/\nint simplerng_getpoisson(double lambda)\n{\n  if (lambda < 0) lambda = 0;\n  return ((lambda < 15.0) \n\t  ? simplerng_poisson_small(lambda) \n\t  : simplerng_poisson_large(lambda));\n}\n\nint simplerng_poisson_small(double lambda)\n{\n  /* Algorithm due to Donald Knuth, 1969. */\n  double p = 1.0, L = exp(-lambda);\n  int k = 0;\n  do {\n    k++;\n    p *= simplerng_getuniform();\n  }\n  while (p > L);\n  return k - 1;\n}\n\nint simplerng_poisson_large(double lambda)\n{\n  /* \"Rejection method PA\" from \"The Computer Generation of Poisson Random Variables\" by A. C. Atkinson\n     Journal of the Royal Statistical Society Series C (Applied Statistics) Vol. 28, No. 1. (1979)\n     The article is on pages 29-35. The algorithm given here is on page 32. */\n  static double beta, alpha, k;\n  static double old_lambda = -999999.;\n\n  if (lambda != old_lambda) {\n    double c = 0.767 - 3.36/lambda;\n    beta = PI/sqrt(3.0*lambda);\n    alpha = beta*lambda;\n    k = log(c) - lambda - log(beta);\n    old_lambda = lambda;\n  }\n\n  for(;;) { /* forever */\n    double u, x, v, y, temp, lhs, rhs;\n    int n;\n\n    u = simplerng_getuniform();\n    x = (alpha - log((1.0 - u)/u))/beta;\n    n = (int) floor(x + 0.5);\n    if (n < 0) continue;\n\n    v = simplerng_getuniform();\n    y = alpha - beta*x;\n    temp = 1.0 + exp(y);\n    lhs = y + log(v/(temp*temp));\n    rhs = k + n*log(lambda) - simplerng_logfactorial(n);\n    if (lhs <= rhs) return n;\n  }\n\n}\n\n/* Lookup table for log-gamma function */\nstatic double lf[] = {\n            0.000000000000000,\n            0.000000000000000,\n            0.693147180559945,\n            1.791759469228055,\n            3.178053830347946,\n            4.787491742782046,\n            6.579251212010101,\n            8.525161361065415,\n            10.604602902745251,\n            12.801827480081469,\n            15.104412573075516,\n            17.502307845873887,\n            19.987214495661885,\n            22.552163853123421,\n            25.191221182738683,\n            27.899271383840894,\n            30.671860106080675,\n            33.505073450136891,\n            36.395445208033053,\n            39.339884187199495,\n            42.335616460753485,\n            45.380138898476908,\n            48.471181351835227,\n            51.606675567764377,\n            54.784729398112319,\n            58.003605222980518,\n            61.261701761002001,\n            64.557538627006323,\n            67.889743137181526,\n            71.257038967168000,\n            74.658236348830158,\n            78.092223553315307,\n            81.557959456115029,\n            85.054467017581516,\n            88.580827542197682,\n            92.136175603687079,\n            95.719694542143202,\n            99.330612454787428,\n            102.968198614513810,\n            106.631760260643450,\n            110.320639714757390,\n            114.034211781461690,\n            117.771881399745060,\n            121.533081515438640,\n            125.317271149356880,\n            129.123933639127240,\n            132.952575035616290,\n            136.802722637326350,\n            140.673923648234250,\n            144.565743946344900,\n            148.477766951773020,\n            152.409592584497350,\n            156.360836303078800,\n            160.331128216630930,\n            164.320112263195170,\n            168.327445448427650,\n            172.352797139162820,\n            176.395848406997370,\n            180.456291417543780,\n            184.533828861449510,\n            188.628173423671600,\n            192.739047287844900,\n            196.866181672889980,\n            201.009316399281570,\n            205.168199482641200,\n            209.342586752536820,\n            213.532241494563270,\n            217.736934113954250,\n            221.956441819130360,\n            226.190548323727570,\n            230.439043565776930,\n            234.701723442818260,\n            238.978389561834350,\n            243.268849002982730,\n            247.572914096186910,\n            251.890402209723190,\n            256.221135550009480,\n            260.564940971863220,\n            264.921649798552780,\n            269.291097651019810,\n            273.673124285693690,\n            278.067573440366120,\n            282.474292687630400,\n            286.893133295426990,\n            291.323950094270290,\n            295.766601350760600,\n            300.220948647014100,\n            304.686856765668720,\n            309.164193580146900,\n            313.652829949878990,\n            318.152639620209300,\n            322.663499126726210,\n            327.185287703775200,\n            331.717887196928470,\n            336.261181979198450,\n            340.815058870798960,\n            345.379407062266860,\n            349.954118040770250,\n            354.539085519440790,\n            359.134205369575340,\n            363.739375555563470,\n            368.354496072404690,\n            372.979468885689020,\n            377.614197873918670,\n            382.258588773060010,\n            386.912549123217560,\n            391.575988217329610,\n            396.248817051791490,\n            400.930948278915760,\n            405.622296161144900,\n            410.322776526937280,\n            415.032306728249580,\n            419.750805599544780,\n            424.478193418257090,\n            429.214391866651570,\n            433.959323995014870,\n            438.712914186121170,\n            443.475088120918940,\n            448.245772745384610,\n            453.024896238496130,\n            457.812387981278110,\n            462.608178526874890,\n            467.412199571608080,\n            472.224383926980520,\n            477.044665492585580,\n            481.872979229887900,\n            486.709261136839360,\n            491.553448223298010,\n            496.405478487217580,\n            501.265290891579240,\n            506.132825342034830,\n            511.008022665236070,\n            515.890824587822520,\n            520.781173716044240,\n            525.679013515995050,\n            530.584288294433580,\n            535.496943180169520,\n            540.416924105997740,\n            545.344177791154950,\n            550.278651724285620,\n            555.220294146894960,\n            560.169054037273100,\n            565.124881094874350,\n            570.087725725134190,\n            575.057539024710200,\n            580.034272767130800,\n            585.017879388839220,\n            590.008311975617860,\n            595.005524249382010,\n            600.009470555327430,\n            605.020105849423770,\n            610.037385686238740,\n            615.061266207084940,\n            620.091704128477430,\n            625.128656730891070,\n            630.172081847810200,\n            635.221937855059760,\n            640.278183660408100,\n            645.340778693435030,\n            650.409682895655240,\n            655.484856710889060,\n            660.566261075873510,\n            665.653857411105950,\n            670.747607611912710,\n            675.847474039736880,\n            680.953419513637530,\n            686.065407301994010,\n            691.183401114410800,\n            696.307365093814040,\n            701.437263808737160,\n            706.573062245787470,\n            711.714725802289990,\n            716.862220279103440,\n            722.015511873601330,\n            727.174567172815840,\n            732.339353146739310,\n            737.509837141777440,\n            742.685986874351220,\n            747.867770424643370,\n            753.055156230484160,\n            758.248113081374300,\n            763.446610112640200,\n            768.650616799717000,\n            773.860102952558460,\n            779.075038710167410,\n            784.295394535245690,\n            789.521141208958970,\n            794.752249825813460,\n            799.988691788643450,\n            805.230438803703120,\n            810.477462875863580,\n            815.729736303910160,\n            820.987231675937890,\n            826.249921864842800,\n            831.517780023906310,\n            836.790779582469900,\n            842.068894241700490,\n            847.352097970438420,\n            852.640365001133090,\n            857.933669825857460,\n            863.231987192405430,\n            868.535292100464630,\n            873.843559797865740,\n            879.156765776907600,\n            884.474885770751830,\n            889.797895749890240,\n            895.125771918679900,\n            900.458490711945270,\n            905.796028791646340,\n            911.138363043611210,\n            916.485470574328820,\n            921.837328707804890,\n            927.193914982476710,\n            932.555207148186240,\n            937.921183163208070,\n            943.291821191335660,\n            948.667099599019820,\n            954.046996952560450,\n            959.431492015349480,\n            964.820563745165940,\n            970.214191291518320,\n            975.612353993036210,\n            981.015031374908400,\n            986.422203146368590,\n            991.833849198223450,\n            997.249949600427840,\n            1002.670484599700300,\n            1008.095434617181700,\n            1013.524780246136200,\n            1018.958502249690200,\n            1024.396581558613400,\n            1029.838999269135500,\n            1035.285736640801600,\n            1040.736775094367400,\n            1046.192096209724900,\n            1051.651681723869200,\n            1057.115513528895000,\n            1062.583573670030100,\n            1068.055844343701400,\n            1073.532307895632800,\n            1079.012946818975000,\n            1084.497743752465600,\n            1089.986681478622400,\n            1095.479742921962700,\n            1100.976911147256000,\n            1106.478169357800900,\n            1111.983500893733000,\n            1117.492889230361000,\n            1123.006317976526100,\n            1128.523770872990800,\n            1134.045231790853000,\n            1139.570684729984800,\n            1145.100113817496100,\n            1150.633503306223700,\n            1156.170837573242400,\n};\n\ndouble simplerng_logfactorial(int n)\n{\n  if (n < 0) return 0;\n  if (n > 254) {\n    double x = n + 1;\n    return (x - 0.5)*log(x) - x + 0.5*log(2*PI) + 1.0/(12.0*x);\n  }\n  return lf[n];\n}\n"},{"id":16716,"name":"getcol.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"\n/*  This file, getcol.c, contains routines that read data elements from    */\n/*  a FITS image or table.  There are generic datatype routines.           */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <stdlib.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffgpxv( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  datatype,    /* I - datatype of the value                   */\n            long *firstpix,   /* I - coord of first pixel to read (1s based) */\n            LONGLONG nelem,   /* I - number of values to read                */\n            void *nulval,     /* I - value for undefined pixels              */\n            void *array,      /* O - array of values that are returned       */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. The datatype of the\n  input array is defined by the 2nd argument.  Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Undefined elements will be set equal to NULVAL, unless NULVAL=0\n  in which case no checking for undefined values will be performed.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    LONGLONG tfirstpix[99];\n    int naxis, ii;\n\n    if (*status > 0 || nelem == 0)   /* inherit input status value if > 0 */\n        return(*status);\n\n    /* get the size of the image */\n    ffgidm(fptr, &naxis, status);\n    \n    for (ii=0; ii < naxis; ii++)\n       tfirstpix[ii] = firstpix[ii];\n\n    ffgpxvll(fptr, datatype, tfirstpix, nelem, nulval, array, anynul, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgpxvll( fitsfile *fptr, /* I - FITS file pointer                       */\n            int  datatype,    /* I - datatype of the value                   */\n            LONGLONG *firstpix, /* I - coord of first pixel to read (1s based) */\n            LONGLONG nelem,   /* I - number of values to read                */\n            void *nulval,     /* I - value for undefined pixels              */\n            void *array,      /* O - array of values that are returned       */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. The datatype of the\n  input array is defined by the 2nd argument.  Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Undefined elements will be set equal to NULVAL, unless NULVAL=0\n  in which case no checking for undefined values will be performed.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    int naxis, ii;\n    char cdummy;\n    int nullcheck = 1;\n    LONGLONG naxes[9], trc[9]= {1,1,1,1,1,1,1,1,1};\n    long inc[9]= {1,1,1,1,1,1,1,1,1};\n    LONGLONG dimsize = 1, firstelem;\n\n    if (*status > 0 || nelem == 0)   /* inherit input status value if > 0 */\n        return(*status);\n\n    /* get the size of the image */\n    ffgidm(fptr, &naxis, status);\n\n    ffgiszll(fptr, 9, naxes, status);\n\n    if (naxis == 0 || naxes[0] == 0) {\n       *status = BAD_DIMEN;\n       return(*status);\n    }\n\n    /* calculate the position of the first element in the array */\n    firstelem = 0;\n    for (ii=0; ii < naxis; ii++)\n    {\n        firstelem += ((firstpix[ii] - 1) * dimsize);\n        dimsize *= naxes[ii];\n        trc[ii] = firstpix[ii];\n    }\n    firstelem++;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        /* test for special case of reading an integral number of */\n        /* rows in a 2D or 3D image (which includes reading the whole image */\n\n\tif (naxis > 1 && naxis < 4 && firstpix[0] == 1 &&\n            (nelem / naxes[0]) * naxes[0] == nelem) {\n\n                /* calculate coordinate of last pixel */\n\t\ttrc[0] = naxes[0];  /* reading whole rows */\n\t\ttrc[1] = firstpix[1] + (nelem / naxes[0] - 1);\n                while (trc[1] > naxes[1])  {\n\t\t    trc[1] = trc[1] - naxes[1];\n\t\t    trc[2] = trc[2] + 1;  /* increment to next plane of cube */\n                }\n\n                fits_read_compressed_img(fptr, datatype, firstpix, trc, inc,\n                   1, nulval, array, NULL, anynul, status);\n\n        } else {\n\n                fits_read_compressed_pixels(fptr, datatype, firstelem,\n                   nelem, nullcheck, nulval, array, NULL, anynul, status);\n        }\n\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (datatype == TBYTE)\n    {\n      if (nulval == 0)\n        ffgclb(fptr, 2, 1, firstelem, nelem, 1, 1, 0,\n               (unsigned char *) array, &cdummy, anynul, status);\n      else\n        ffgclb(fptr, 2, 1, firstelem, nelem, 1, 1, *(unsigned char *) nulval,\n               (unsigned char *) array, &cdummy, anynul, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n      if (nulval == 0)\n        ffgclsb(fptr, 2, 1, firstelem, nelem, 1, 1, 0,\n               (signed char *) array, &cdummy, anynul, status);\n      else\n        ffgclsb(fptr, 2, 1, firstelem, nelem, 1, 1, *(signed char *) nulval,\n               (signed char *) array, &cdummy, anynul, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n      if (nulval == 0)\n        ffgclui(fptr, 2, 1, firstelem, nelem, 1, 1, 0,\n               (unsigned short *) array, &cdummy, anynul, status);\n      else\n        ffgclui(fptr, 2, 1, firstelem, nelem, 1, 1, *(unsigned short *) nulval,\n               (unsigned short *) array, &cdummy, anynul, status);\n    }\n    else if (datatype == TSHORT)\n    {\n      if (nulval == 0)\n        ffgcli(fptr, 2, 1, firstelem, nelem, 1, 1, 0,\n               (short *) array, &cdummy, anynul, status);\n      else\n        ffgcli(fptr, 2, 1, firstelem, nelem, 1, 1, *(short *) nulval,\n               (short *) array, &cdummy, anynul, status);\n    }\n    else if (datatype == TUINT)\n    {\n      if (nulval == 0)\n        ffgcluk(fptr, 2, 1, firstelem, nelem, 1, 1, 0,\n               (unsigned int *) array, &cdummy, anynul, status);\n      else\n        ffgcluk(fptr, 2, 1, firstelem, nelem, 1, 1, *(unsigned int *) nulval,\n               (unsigned int *) array, &cdummy, anynul, status);\n    }\n    else if (datatype == TINT)\n    {\n      if (nulval == 0)\n        ffgclk(fptr, 2, 1, firstelem, nelem, 1, 1, 0,\n               (int *) array, &cdummy, anynul, status);\n      else\n        ffgclk(fptr, 2, 1, firstelem, nelem, 1, 1, *(int *) nulval,\n               (int *) array, &cdummy, anynul, status);\n    }\n    else if (datatype == TULONG)\n    {\n      if (nulval == 0)\n        ffgcluj(fptr, 2, 1, firstelem, nelem, 1, 1, 0,\n               (unsigned long *) array, &cdummy, anynul, status);\n      else\n        ffgcluj(fptr, 2, 1, firstelem, nelem, 1, 1, *(unsigned long *) nulval,\n               (unsigned long *) array, &cdummy, anynul, status);\n    }\n    else if (datatype == TLONG)\n    {\n      if (nulval == 0)\n        ffgclj(fptr, 2, 1, firstelem, nelem, 1, 1, 0,\n               (long *) array, &cdummy, anynul, status);\n      else\n        ffgclj(fptr, 2, 1, firstelem, nelem, 1, 1, *(long *) nulval,\n               (long *) array, &cdummy, anynul, status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n      if (nulval == 0)\n        ffgclujj(fptr, 2, 1, firstelem, nelem, 1, 1, 0,\n               (ULONGLONG *) array, &cdummy, anynul, status);\n      else\n        ffgclujj(fptr, 2, 1, firstelem, nelem, 1, 1, *(ULONGLONG *) nulval,\n               (ULONGLONG *) array, &cdummy, anynul, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n      if (nulval == 0)\n        ffgcljj(fptr, 2, 1, firstelem, nelem, 1, 1, 0,\n               (LONGLONG *) array, &cdummy, anynul, status);\n      else\n        ffgcljj(fptr, 2, 1, firstelem, nelem, 1, 1, *(LONGLONG *) nulval,\n               (LONGLONG *) array, &cdummy, anynul, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n      if (nulval == 0)\n        ffgcle(fptr, 2, 1, firstelem, nelem, 1, 1, 0,\n               (float *) array, &cdummy, anynul, status);\n      else\n        ffgcle(fptr, 2, 1, firstelem, nelem, 1, 1, *(float *) nulval,\n               (float *) array, &cdummy, anynul, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n      if (nulval == 0)\n        ffgcld(fptr, 2, 1, firstelem, nelem, 1, 1, 0,\n               (double *) array, &cdummy, anynul, status);\n      else\n        ffgcld(fptr, 2, 1, firstelem, nelem, 1, 1, *(double *) nulval,\n               (double *) array, &cdummy, anynul, status);\n    }\n    else\n      *status = BAD_DATATYPE;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgpxf( fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  datatype,    /* I - datatype of the value                   */\n            long *firstpix,   /* I - coord of first pixel to read (1s based) */\n            LONGLONG nelem,       /* I - number of values to read            */\n            void *array,      /* O - array of values that are returned       */\n            char *nullarray,  /* O - returned array of null value flags      */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. The datatype of the\n  input array is defined by the 2nd argument.  Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  The nullarray values will = 1 if the corresponding array value is null.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    LONGLONG tfirstpix[99];\n    int naxis, ii;\n\n    if (*status > 0 || nelem == 0)   /* inherit input status value if > 0 */\n        return(*status);\n\n    /* get the size of the image */\n    ffgidm(fptr, &naxis, status);\n\n    for (ii=0; ii < naxis; ii++)\n       tfirstpix[ii] = firstpix[ii];\n\n    ffgpxfll(fptr, datatype, tfirstpix, nelem, array, nullarray, anynul, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgpxfll( fitsfile *fptr, /* I - FITS file pointer                       */\n            int  datatype,    /* I - datatype of the value                   */\n            LONGLONG *firstpix, /* I - coord of first pixel to read (1s based) */\n            LONGLONG nelem,       /* I - number of values to read              */\n            void *array,      /* O - array of values that are returned       */\n            char *nullarray,  /* O - returned array of null value flags      */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. The datatype of the\n  input array is defined by the 2nd argument.  Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  The nullarray values will = 1 if the corresponding array value is null.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    int naxis, ii;\n    int nullcheck = 2;\n    LONGLONG naxes[9];\n    LONGLONG dimsize = 1, firstelem;\n\n    if (*status > 0 || nelem == 0)   /* inherit input status value if > 0 */\n        return(*status);\n\n    /* get the size of the image */\n    ffgidm(fptr, &naxis, status);\n    ffgiszll(fptr, 9, naxes, status);\n\n    /* calculate the position of the first element in the array */\n    firstelem = 0;\n    for (ii=0; ii < naxis; ii++)\n    {\n        firstelem += ((firstpix[ii] - 1) * dimsize);\n        dimsize *= naxes[ii];\n    }\n    firstelem++;\n\n    if (fits_is_compressed_image(fptr, status))\n    {\n        /* this is a compressed image in a binary table */\n\n        fits_read_compressed_pixels(fptr, datatype, firstelem, nelem,\n            nullcheck, NULL, array, nullarray, anynul, status);\n        return(*status);\n    }\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (datatype == TBYTE)\n    {\n        ffgclb(fptr, 2, 1, firstelem, nelem, 1, 2, 0,\n               (unsigned char *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n        ffgclsb(fptr, 2, 1, firstelem, nelem, 1, 2, 0,\n               (signed char *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n        ffgclui(fptr, 2, 1, firstelem, nelem, 1, 2, 0,\n               (unsigned short *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TSHORT)\n    {\n        ffgcli(fptr, 2, 1, firstelem, nelem, 1, 2, 0,\n               (short *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TUINT)\n    {\n        ffgcluk(fptr, 2, 1, firstelem, nelem, 1, 2, 0,\n               (unsigned int *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TINT)\n    {\n        ffgclk(fptr, 2, 1, firstelem, nelem, 1, 2, 0,\n               (int *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TULONG)\n    {\n        ffgcluj(fptr, 2, 1, firstelem, nelem, 1, 2, 0,\n               (unsigned long *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TLONG)\n    {\n        ffgclj(fptr, 2, 1, firstelem, nelem, 1, 2, 0,\n               (long *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n        ffgclujj(fptr, 2, 1, firstelem, nelem, 1, 2, 0,\n               (ULONGLONG *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n        ffgcljj(fptr, 2, 1, firstelem, nelem, 1, 2, 0,\n               (LONGLONG *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n        ffgcle(fptr, 2, 1, firstelem, nelem, 1, 2, 0,\n               (float *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n        ffgcld(fptr, 2, 1, firstelem, nelem, 1, 2, 0,\n               (double *) array, nullarray, anynul, status);\n    }\n    else\n      *status = BAD_DATATYPE;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsv(  fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  datatype,    /* I - datatype of the value                   */\n            long *blc,        /* I - 'bottom left corner' of the subsection  */\n            long *trc ,       /* I - 'top right corner' of the subsection    */\n            long *inc,        /* I - increment to be applied in each dim.    */\n            void *nulval,     /* I - value for undefined pixels              */\n            void *array,      /* O - array of values that are returned       */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an section of values from the primary array. The datatype of the\n  input array is defined by the 2nd argument.  Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Undefined elements will be set equal to NULVAL, unless NULVAL=0\n  in which case no checking for undefined values will be performed.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n    int naxis, ii;\n    long naxes[9];\n    LONGLONG nelem = 1;\n\n    if (*status > 0)   /* inherit input status value if > 0 */\n        return(*status);\n\n    /* get the size of the image */\n    ffgidm(fptr, &naxis, status);\n    ffgisz(fptr, 9, naxes, status);\n\n    /* test for the important special case where we are reading the whole image */\n    /* this is only useful for images that are not tile-compressed */\n    if (!fits_is_compressed_image(fptr, status)) {\n        for (ii = 0; ii < naxis; ii++) {\n            if (inc[ii] != 1 || blc[ii] !=1 || trc[ii] != naxes[ii])\n                break;\n\n            nelem = nelem * naxes[ii];\n        }\n\n        if (ii == naxis) {\n            /* read the whole image more efficiently */\n            ffgpxv(fptr, datatype, blc, nelem, nulval, array, anynul, status);\n            return(*status);\n        }\n    }\n\n    if (datatype == TBYTE)\n    {\n      if (nulval == 0)\n        ffgsvb(fptr, 1, naxis, naxes, blc, trc, inc, 0,\n               (unsigned char *) array, anynul, status);\n      else\n        ffgsvb(fptr, 1, naxis, naxes, blc, trc, inc, *(unsigned char *) nulval,\n               (unsigned char *) array, anynul, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n      if (nulval == 0)\n        ffgsvsb(fptr, 1, naxis, naxes, blc, trc, inc, 0,\n               (signed char *) array, anynul, status);\n      else\n        ffgsvsb(fptr, 1, naxis, naxes, blc, trc, inc, *(signed char *) nulval,\n               (signed char *) array, anynul, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n      if (nulval == 0)\n        ffgsvui(fptr, 1, naxis, naxes, blc, trc, inc, 0,\n               (unsigned short *) array, anynul, status);\n      else\n        ffgsvui(fptr, 1, naxis, naxes,blc, trc, inc, *(unsigned short *) nulval,\n               (unsigned short *) array, anynul, status);\n    }\n    else if (datatype == TSHORT)\n    {\n      if (nulval == 0)\n        ffgsvi(fptr, 1, naxis, naxes, blc, trc, inc, 0,\n               (short *) array, anynul, status);\n      else\n        ffgsvi(fptr, 1, naxis, naxes, blc, trc, inc, *(short *) nulval,\n               (short *) array, anynul, status);\n    }\n    else if (datatype == TUINT)\n    {\n      if (nulval == 0)\n        ffgsvuk(fptr, 1, naxis, naxes, blc, trc, inc, 0,\n               (unsigned int *) array, anynul, status);\n      else\n        ffgsvuk(fptr, 1, naxis, naxes, blc, trc, inc, *(unsigned int *) nulval,\n               (unsigned int *) array, anynul, status);\n    }\n    else if (datatype == TINT)\n    {\n      if (nulval == 0)\n        ffgsvk(fptr, 1, naxis, naxes, blc, trc, inc, 0,\n               (int *) array, anynul, status);\n      else\n        ffgsvk(fptr, 1, naxis, naxes, blc, trc, inc, *(int *) nulval,\n               (int *) array, anynul, status);\n    }\n    else if (datatype == TULONG)\n    {\n      if (nulval == 0)\n        ffgsvuj(fptr, 1, naxis, naxes, blc, trc, inc, 0,\n               (unsigned long *) array, anynul, status);\n      else\n        ffgsvuj(fptr, 1, naxis, naxes, blc, trc, inc, *(unsigned long *) nulval,\n               (unsigned long *) array, anynul, status);\n    }\n    else if (datatype == TLONG)\n    {\n      if (nulval == 0)\n        ffgsvj(fptr, 1, naxis, naxes, blc, trc, inc, 0,\n               (long *) array, anynul, status);\n      else\n        ffgsvj(fptr, 1, naxis, naxes, blc, trc, inc, *(long *) nulval,\n               (long *) array, anynul, status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n      if (nulval == 0)\n        ffgsvujj(fptr, 1, naxis, naxes, blc, trc, inc, 0,\n               (ULONGLONG *) array, anynul, status);\n      else\n        ffgsvujj(fptr, 1, naxis, naxes, blc, trc, inc, *(ULONGLONG *) nulval,\n               (ULONGLONG *) array, anynul, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n      if (nulval == 0)\n        ffgsvjj(fptr, 1, naxis, naxes, blc, trc, inc, 0,\n               (LONGLONG *) array, anynul, status);\n      else\n        ffgsvjj(fptr, 1, naxis, naxes, blc, trc, inc, *(LONGLONG *) nulval,\n               (LONGLONG *) array, anynul, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n      if (nulval == 0)\n        ffgsve(fptr, 1, naxis, naxes, blc, trc, inc, 0,\n               (float *) array, anynul, status);\n      else\n        ffgsve(fptr, 1, naxis, naxes, blc, trc, inc, *(float *) nulval,\n               (float *) array, anynul, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n      if (nulval == 0)\n        ffgsvd(fptr, 1, naxis, naxes, blc, trc, inc, 0,\n               (double *) array, anynul, status);\n      else\n        ffgsvd(fptr, 1, naxis, naxes, blc, trc, inc, *(double *) nulval,\n               (double *) array, anynul, status);\n    }\n    else\n      *status = BAD_DATATYPE;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgpv(  fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  datatype,    /* I - datatype of the value                   */\n            LONGLONG firstelem,   /* I - first vector element to read (1 = 1st)  */\n            LONGLONG nelem,       /* I - number of values to read                */\n            void *nulval,     /* I - value for undefined pixels              */\n            void *array,      /* O - array of values that are returned       */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. The datatype of the\n  input array is defined by the 2nd argument.  Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Undefined elements will be set equal to NULVAL, unless NULVAL=0\n  in which case no checking for undefined values will be performed.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n\n    if (*status > 0 || nelem == 0)   /* inherit input status value if > 0 */\n        return(*status);\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (datatype == TBYTE)\n    {\n      if (nulval == 0)\n        ffgpvb(fptr, 1, firstelem, nelem, 0,\n               (unsigned char *) array, anynul, status);\n      else\n        ffgpvb(fptr, 1, firstelem, nelem, *(unsigned char *) nulval,\n               (unsigned char *) array, anynul, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n      if (nulval == 0)\n        ffgpvsb(fptr, 1, firstelem, nelem, 0,\n               (signed char *) array, anynul, status);\n      else\n        ffgpvsb(fptr, 1, firstelem, nelem, *(signed char *) nulval,\n               (signed char *) array, anynul, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n      if (nulval == 0)\n        ffgpvui(fptr, 1, firstelem, nelem, 0,\n               (unsigned short *) array, anynul, status);\n      else\n        ffgpvui(fptr, 1, firstelem, nelem, *(unsigned short *) nulval,\n               (unsigned short *) array, anynul, status);\n    }\n    else if (datatype == TSHORT)\n    {\n      if (nulval == 0)\n        ffgpvi(fptr, 1, firstelem, nelem, 0,\n               (short *) array, anynul, status);\n      else\n        ffgpvi(fptr, 1, firstelem, nelem, *(short *) nulval,\n               (short *) array, anynul, status);\n    }\n    else if (datatype == TUINT)\n    {\n      if (nulval == 0)\n        ffgpvuk(fptr, 1, firstelem, nelem, 0,\n               (unsigned int *) array, anynul, status);\n      else\n        ffgpvuk(fptr, 1, firstelem, nelem, *(unsigned int *) nulval,\n               (unsigned int *) array, anynul, status);\n    }\n    else if (datatype == TINT)\n    {\n      if (nulval == 0)\n        ffgpvk(fptr, 1, firstelem, nelem, 0,\n               (int *) array, anynul, status);\n      else\n        ffgpvk(fptr, 1, firstelem, nelem, *(int *) nulval,\n               (int *) array, anynul, status);\n    }\n    else if (datatype == TULONG)\n    {\n      if (nulval == 0)\n        ffgpvuj(fptr, 1, firstelem, nelem, 0,\n               (unsigned long *) array, anynul, status);\n      else\n        ffgpvuj(fptr, 1, firstelem, nelem, *(unsigned long *) nulval,\n               (unsigned long *) array, anynul, status);\n    }\n    else if (datatype == TLONG)\n    {\n      if (nulval == 0)\n        ffgpvj(fptr, 1, firstelem, nelem, 0,\n               (long *) array, anynul, status);\n      else\n        ffgpvj(fptr, 1, firstelem, nelem, *(long *) nulval,\n               (long *) array, anynul, status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n      if (nulval == 0)\n        ffgpvujj(fptr, 1, firstelem, nelem, 0,\n               (ULONGLONG *) array, anynul, status);\n      else\n        ffgpvujj(fptr, 1, firstelem, nelem, *(ULONGLONG *) nulval,\n               (ULONGLONG *) array, anynul, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n      if (nulval == 0)\n        ffgpvjj(fptr, 1, firstelem, nelem, 0,\n               (LONGLONG *) array, anynul, status);\n      else\n        ffgpvjj(fptr, 1, firstelem, nelem, *(LONGLONG *) nulval,\n               (LONGLONG *) array, anynul, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n      if (nulval == 0)\n        ffgpve(fptr, 1, firstelem, nelem, 0,\n               (float *) array, anynul, status);\n      else\n        ffgpve(fptr, 1, firstelem, nelem, *(float *) nulval,\n               (float *) array, anynul, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n      if (nulval == 0)\n        ffgpvd(fptr, 1, firstelem, nelem, 0,\n               (double *) array, anynul, status);\n      else\n      {\n        ffgpvd(fptr, 1, firstelem, nelem, *(double *) nulval,\n               (double *) array, anynul, status);\n      }\n    }\n    else\n      *status = BAD_DATATYPE;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgpf(  fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  datatype,    /* I - datatype of the value                   */\n            LONGLONG firstelem,   /* I - first vector element to read (1 = 1st)  */\n            LONGLONG nelem,       /* I - number of values to read                */\n            void *array,      /* O - array of values that are returned       */\n            char *nullarray,  /* O - array of null value flags               */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from the primary array. The datatype of the\n  input array is defined by the 2nd argument.  Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  The nullarray values will = 1 if the corresponding array value is null.\n  ANYNUL is returned with a value of .true. if any pixels are undefined.\n*/\n{\n\n    if (*status > 0 || nelem == 0)   /* inherit input status value if > 0 */\n        return(*status);\n\n    /*\n      the primary array is represented as a binary table:\n      each group of the primary array is a row in the table,\n      where the first column contains the group parameters\n      and the second column contains the image itself.\n    */\n\n    if (datatype == TBYTE)\n    {\n        ffgpfb(fptr, 1, firstelem, nelem, \n               (unsigned char *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n        ffgpfsb(fptr, 1, firstelem, nelem, \n               (signed char *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n        ffgpfui(fptr, 1, firstelem, nelem, \n               (unsigned short *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TSHORT)\n    {\n        ffgpfi(fptr, 1, firstelem, nelem, \n               (short *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TUINT)\n    {\n        ffgpfuk(fptr, 1, firstelem, nelem, \n               (unsigned int *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TINT)\n    {\n        ffgpfk(fptr, 1, firstelem, nelem, \n               (int *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TULONG)\n    {\n        ffgpfuj(fptr, 1, firstelem, nelem, \n               (unsigned long *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TLONG)\n    {\n        ffgpfj(fptr, 1, firstelem, nelem,\n               (long *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n        ffgpfujj(fptr, 1, firstelem, nelem,\n               (ULONGLONG *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n        ffgpfjj(fptr, 1, firstelem, nelem,\n               (LONGLONG *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n        ffgpfe(fptr, 1, firstelem, nelem, \n               (float *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n        ffgpfd(fptr, 1, firstelem, nelem,\n               (double *) array, nullarray, anynul, status);\n    }\n    else\n      *status = BAD_DATATYPE;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcv(  fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  datatype,    /* I - datatype of the value                   */\n            int  colnum,      /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,   /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG nelem,       /* I - number of values to read                */\n            void *nulval,     /* I - value for undefined pixels              */\n            void *array,      /* O - array of values that are returned       */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a table column. The datatype of the\n  input array is defined by the 2nd argument.  Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  Undefined elements will be set equal to NULVAL, unless NULVAL=0\n  in which case no checking for undefined values will be performed.\n  ANYNUL is returned with a value of true if any pixels are undefined.\n*/\n{\n    char cdummy[2];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (datatype == TBIT)\n    {\n      ffgcx(fptr, colnum, firstrow, firstelem, nelem, (char *) array, status);\n    }\n    else if (datatype == TBYTE)\n    {\n      if (nulval == 0)\n        ffgclb(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,\n              (unsigned char *) array, cdummy, anynul, status);\n      else\n       ffgclb(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(unsigned char *)\n              nulval, (unsigned char *) array, cdummy, anynul, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n      if (nulval == 0)\n        ffgclsb(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,\n              (signed char *) array, cdummy, anynul, status);\n      else\n       ffgclsb(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(signed char *)\n              nulval, (signed char *) array, cdummy, anynul, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n      if (nulval == 0)\n        ffgclui(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,\n               (unsigned short *) array, cdummy, anynul, status);\n      else\n        ffgclui(fptr, colnum, firstrow, firstelem, nelem, 1, 1,\n               *(unsigned short *) nulval,\n               (unsigned short *) array, cdummy, anynul, status);\n    }\n    else if (datatype == TSHORT)\n    {\n      if (nulval == 0)\n        ffgcli(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,\n              (short *) array, cdummy, anynul, status);\n      else\n        ffgcli(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(short *)\n              nulval, (short *) array, cdummy, anynul, status);\n    }\n    else if (datatype == TUINT)\n    {\n      if (nulval == 0)\n        ffgcluk(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,\n              (unsigned int *) array, cdummy, anynul, status);\n      else\n        ffgcluk(fptr, colnum, firstrow, firstelem, nelem, 1, 1,\n         *(unsigned int *) nulval, (unsigned int *) array, cdummy, anynul,\n         status);\n    }\n    else if (datatype == TINT)\n    {\n      if (nulval == 0)\n        ffgclk(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,\n              (int *) array, cdummy, anynul, status);\n      else\n        ffgclk(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(int *)\n            nulval, (int *) array, cdummy, anynul, status);\n    }\n    else if (datatype == TULONG)\n    {\n      if (nulval == 0)\n        ffgcluj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,\n               (unsigned long *) array, cdummy, anynul, status);\n      else\n        ffgcluj(fptr, colnum, firstrow, firstelem, nelem, 1, 1,\n               *(unsigned long *) nulval, \n               (unsigned long *) array, cdummy, anynul, status);\n    }\n    else if (datatype == TLONG)\n    {\n      if (nulval == 0)\n        ffgclj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,\n              (long *) array, cdummy, anynul, status);\n      else\n        ffgclj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(long *)\n              nulval, (long *) array, cdummy, anynul, status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n      if (nulval == 0)\n        ffgclujj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,\n              (ULONGLONG *) array, cdummy, anynul, status);\n      else\n        ffgclujj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(ULONGLONG *)\n              nulval, (ULONGLONG *) array, cdummy, anynul, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n      if (nulval == 0)\n        ffgcljj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,\n              (LONGLONG *) array, cdummy, anynul, status);\n      else\n        ffgcljj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(LONGLONG *)\n              nulval, (LONGLONG *) array, cdummy, anynul, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n      if (nulval == 0)\n        ffgcle(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0.,\n              (float *) array, cdummy, anynul, status);\n      else\n      ffgcle(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(float *)\n               nulval,(float *) array, cdummy, anynul, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n      if (nulval == 0)\n        ffgcld(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0.,\n              (double *) array, cdummy, anynul, status);\n      else\n        ffgcld(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(double *)\n              nulval, (double *) array, cdummy, anynul, status);\n    }\n    else if (datatype == TCOMPLEX)\n    {\n      if (nulval == 0)\n        ffgcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2,\n           1, 1, 0., (float *) array, cdummy, anynul, status);\n      else\n        ffgcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2,\n           1, 1, *(float *) nulval, (float *) array, cdummy, anynul, status);\n    }\n    else if (datatype == TDBLCOMPLEX)\n    {\n      if (nulval == 0)\n        ffgcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, \n         1, 1, 0., (double *) array, cdummy, anynul, status);\n      else\n        ffgcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, \n         1, 1, *(double *) nulval, (double *) array, cdummy, anynul, status);\n    }\n\n    else if (datatype == TLOGICAL)\n    {\n      if (nulval == 0)\n        ffgcll(fptr, colnum, firstrow, firstelem, nelem, 1, 0,\n          (char *) array, cdummy, anynul, status);\n      else\n        ffgcll(fptr, colnum, firstrow, firstelem, nelem, 1, *(char *) nulval,\n          (char *) array, cdummy, anynul, status);\n    }\n    else if (datatype == TSTRING)\n    {\n      if (nulval == 0)\n      {\n        cdummy[0] = '\\0';\n        ffgcls(fptr, colnum, firstrow, firstelem, nelem, 1, \n             cdummy, (char **) array, cdummy, anynul, status);\n      }\n      else\n        ffgcls(fptr, colnum, firstrow, firstelem, nelem, 1, (char *)\n             nulval, (char **) array, cdummy, anynul, status);\n    }\n    else\n      *status = BAD_DATATYPE;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgcf(  fitsfile *fptr,   /* I - FITS file pointer                       */\n            int  datatype,    /* I - datatype of the value                   */\n            int  colnum,      /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,   /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem,  /* I - first vector element to read (1 = 1st)  */\n            LONGLONG nelem,       /* I - number of values to read                */\n            void *array,      /* O - array of values that are returned       */\n            char *nullarray,  /* O - array of null value flags               */\n            int  *anynul,     /* O - set to 1 if any values are null; else 0 */\n            int  *status)     /* IO - error status                           */\n/*\n  Read an array of values from a table column. The datatype of the\n  input array is defined by the 2nd argument.  Data conversion\n  and scaling will be performed if necessary (e.g, if the datatype of\n  the FITS array is not the same as the array being read).\n  ANYNUL is returned with a value of true if any pixels are undefined.\n*/\n{\n    double nulval = 0.;\n    char cnulval[2];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (datatype == TBIT)\n    {\n      ffgcx(fptr, colnum, firstrow, firstelem, nelem, (char *) array, status);\n    }\n    else if (datatype == TBYTE)\n    {\n       ffgclb(fptr, colnum, firstrow, firstelem, nelem, 1, 2, (unsigned char )\n              nulval, (unsigned char *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n       ffgclsb(fptr, colnum, firstrow, firstelem, nelem, 1, 2, (signed char )\n              nulval, (signed char *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n        ffgclui(fptr, colnum, firstrow, firstelem, nelem, 1, 2,\n               (unsigned short ) nulval,\n               (unsigned short *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TSHORT)\n    {\n        ffgcli(fptr, colnum, firstrow, firstelem, nelem, 1, 2, (short )\n              nulval, (short *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TUINT)\n    {\n        ffgcluk(fptr, colnum, firstrow, firstelem, nelem, 1, 2,\n         (unsigned int ) nulval, (unsigned int *) array, nullarray, anynul,\n         status);\n    }\n    else if (datatype == TINT)\n    {\n        ffgclk(fptr, colnum, firstrow, firstelem, nelem, 1, 2, (int )\n            nulval, (int *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TULONG)\n    {\n        ffgcluj(fptr, colnum, firstrow, firstelem, nelem, 1, 2,\n               (unsigned long ) nulval, \n               (unsigned long *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TLONG)\n    {\n        ffgclj(fptr, colnum, firstrow, firstelem, nelem, 1, 2, (long )\n              nulval, (long *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n        ffgclujj(fptr, colnum, firstrow, firstelem, nelem, 1, 2, (ULONGLONG )\n              nulval, (ULONGLONG *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n        ffgcljj(fptr, colnum, firstrow, firstelem, nelem, 1, 2, (LONGLONG )\n              nulval, (LONGLONG *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n      ffgcle(fptr, colnum, firstrow, firstelem, nelem, 1, 2, (float )\n               nulval,(float *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n        ffgcld(fptr, colnum, firstrow, firstelem, nelem, 1, 2, \n              nulval, (double *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TCOMPLEX)\n    {\n        ffgcfc(fptr, colnum, firstrow, firstelem, nelem,\n           (float *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TDBLCOMPLEX)\n    {\n        ffgcfm(fptr, colnum, firstrow, firstelem, nelem, \n           (double *) array, nullarray, anynul, status);\n    }\n\n    else if (datatype == TLOGICAL)\n    {\n        ffgcll(fptr, colnum, firstrow, firstelem, nelem, 2, (char ) nulval,\n          (char *) array, nullarray, anynul, status);\n    }\n    else if (datatype == TSTRING)\n    {\n        ffgcls(fptr, colnum, firstrow, firstelem, nelem, 2, \n             cnulval, (char **) array, nullarray, anynul, status);\n    }\n    else\n      *status = BAD_DATATYPE;\n\n    return(*status);\n}\n\n"},{"id":16717,"name":"putcoll.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, putcoll.c, contains routines that write data elements to    */\n/*  a FITS image or table, with logical datatype.                          */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <string.h>\n#include <stdlib.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffpcll( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            char *array,     /* I - array of values to write                */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of logical values to a column in the current FITS HDU.\n*/\n{\n    int tcode, maxelem, hdutype;\n    long twidth, incre;\n    LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull;\n    double scale, zero;\n    char tform[20], ctrue = 'T', cfalse = 'F';\n    char message[FLEN_ERRMSG];\n    char snull[20];   /*  the FITS null value  */\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero,\n        tform, &twidth, &tcode, &maxelem, &startpos,  &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n\n    if (tcode != TLOGICAL)   \n        return(*status = NOT_LOGICAL_COL);\n\n    /*---------------------------------------------------------------------*/\n    /*  Now write the logical values one at a time to the FITS column.     */\n    /*---------------------------------------------------------------------*/\n    remain = nelem;           /* remaining number of values to write  */\n    next = 0;                 /* next element in array to be written  */\n    rownum = 0;               /* row number, relative to firstrow     */\n\n    while (remain)\n    {\n      wrtptr = startpos + (rowlen * rownum) + (elemnum * incre);\n\n      ffmbyt(fptr, wrtptr, IGNORE_EOF, status);  /* move to write position */\n\n      if (array[next])\n         ffpbyt(fptr, 1, &ctrue, status);\n      else\n         ffpbyt(fptr, 1, &cfalse, status);\n\n      if (*status > 0)  /* test for error during previous write operation */\n      {\n        snprintf(message,FLEN_ERRMSG,\n           \"Error writing element %.0f of input array of logicals (ffpcll).\",\n            (double) (next+1));\n        ffpmsg(message);\n        return(*status);\n      }\n\n      /*--------------------------------------------*/\n      /*  increment the counters for the next loop  */\n      /*--------------------------------------------*/\n      remain--;\n      if (remain)\n      {\n        next++;\n        elemnum++;\n        if (elemnum == repeat)  /* completed a row; start on next row */\n        {\n           elemnum = 0;\n           rownum++;\n        }\n      }\n\n    }  /*  End of main while Loop  */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpcnl( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  firstrow,  /* I - first row to write (1 = 1st row)        */\n            LONGLONG  firstelem, /* I - first vector element to write (1 = 1st) */\n            LONGLONG  nelem,     /* I - number of values to write               */\n            char  *array,    /* I - array of values to write                */\n            char  nulvalue,  /* I - array flagging undefined pixels if true */\n            int  *status)    /* IO - error status                           */\n/*\n  Write an array of elements to the specified column of a table.  Any input\n  pixels flagged as null will be replaced by the appropriate\n  null value in the output FITS file. \n*/\n{\n    tcolumn *colptr;\n    LONGLONG  ngood = 0, nbad = 0, ii;\n    LONGLONG repeat, first, fstelm, fstrow;\n    int tcode;\n\n    if (*status > 0)\n        return(*status);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n    {\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    }\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n    {\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n    }\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n\n    tcode  = colptr->tdatatype;\n\n    if (tcode > 0)\n       repeat = colptr->trepeat;  /* repeat count for this column */\n    else\n       repeat = firstelem -1 + nelem;  /* variable length arrays */\n\n    /* first write the whole input vector, then go back and fill in the nulls */\n    if (ffpcll(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0)\n          return(*status);\n\n    /* absolute element number in the column */\n    first = (firstrow - 1) * repeat + firstelem;\n\n    for (ii = 0; ii < nelem; ii++)\n    {\n      if (array[ii] != nulvalue)  /* is this a good pixel? */\n      {\n         if (nbad)  /* write previous string of bad pixels */\n         {\n            fstelm = ii - nbad + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n            if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0)\n                return(*status);\n\n            nbad=0;\n         }\n\n         ngood = ngood +1;  /* the consecutive number of good pixels */\n      }\n      else\n      {\n         if (ngood)  /* write previous string of good pixels */\n         {\n            fstelm = ii - ngood + first;  /* absolute element number */\n            fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n            fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n/*  good values have already been written\n            if (ffpcll(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood],\n                status) > 0)\n                return(*status);\n*/\n            ngood=0;\n         }\n\n         nbad = nbad +1;  /* the consecutive number of bad pixels */\n      }\n    }\n\n    /* finished loop;  now just write the last set of pixels */\n\n    if (ngood)  /* write last string of good pixels */\n    {\n      fstelm = ii - ngood + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n/*  these have already been written\n      ffpcll(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status);\n*/\n    }\n    else if (nbad) /* write last string of bad pixels */\n    {\n      fstelm = ii - nbad + first;  /* absolute element number */\n      fstrow = (fstelm - 1) / repeat + 1;  /* starting row number */\n      fstelm = fstelm - (fstrow - 1) * repeat;  /* relative number */\n\n      ffpclu(fptr, colnum, fstrow, fstelm, nbad, status);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpclx( fitsfile *fptr,  /* I - FITS file pointer                       */\n            int  colnum,     /* I - number of column to write (1 = 1st col) */\n            LONGLONG  frow,      /* I - first row to write (1 = 1st row)        */\n            long  fbit,      /* I - first bit to write (1 = 1st)            */\n            long  nbit,      /* I - number of bits to write                 */\n            char *larray,    /* I - array of logicals corresponding to bits */\n            int  *status)    /* IO - error status                           */\n/*\n  write an array of logical values to a specified bit or byte\n  column of the binary table.   If larray is TRUE, then the corresponding\n  bit is set to 1, otherwise it is set to 0.\n  The binary table column being written to must have datatype 'B' or 'X'. \n*/\n{\n    LONGLONG offset, bstart, repeat, rowlen, elemnum, rstart, estart, tnull;\n    long fbyte, lbyte, nbyte, bitloc, ndone;\n    long ii, twidth, incre;\n    int tcode, descrp, maxelem, hdutype;\n    double dummyd;\n    char tform[12], snull[12];\n    unsigned char cbuff;\n    static unsigned char onbit[8] = {128,  64,  32,  16,   8,   4,   2,   1};\n    static unsigned char offbit[8] = {127, 191, 223, 239, 247, 251, 253, 254};\n    LONGLONG heapoffset, lrepeat;\n    tcolumn *colptr;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /*  check input parameters */\n    if (nbit < 1)\n        return(*status);\n    else if (frow < 1)\n        return(*status = BAD_ROW_NUM);\n    else if (fbit < 1)\n        return(*status = BAD_ELEM_NUM);\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    /* rescan header if data structure is undefined */\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               \n            return(*status);\n\n    fbyte = (fbit + 7) / 8;\n    lbyte = (fbit + nbit + 6) / 8;\n    nbyte = lbyte - fbyte +1;\n\n    /* Save the current heapsize; ffgcprll will increment the value if */\n    /* we are writing to a variable length column. */\n    offset = (fptr->Fptr)->heapsize;\n\n    /* call ffgcprll in case we are writing beyond the current end of   */\n    /* the table; it will allocate more space and shift any following */\n    /* HDU's.  Otherwise, we have little use for most of the returned */\n    /* parameters, therefore just use dummy parameters.               */\n\n    if (ffgcprll( fptr, colnum, frow, fbyte, nbyte, 1, &dummyd, &dummyd,\n        tform, &twidth, &tcode, &maxelem, &bstart, &elemnum, &incre,\n        &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0)\n        return(*status);\n\n    bitloc = fbit - 1 - ((fbit - 1) / 8 * 8);\n    ndone = 0;\n    rstart = frow - 1;\n    estart = fbyte - 1;\n\n    colptr  = (fptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n\n    tcode = colptr->tdatatype;\n\n    if (abs(tcode) > TBYTE)\n        return(*status = NOT_LOGICAL_COL); /* not correct datatype column */\n\n    if (tcode > 0)\n    {\n        descrp = FALSE;  /* not a variable length descriptor column */\n        repeat = colptr->trepeat;\n\n        if (tcode == TBIT)\n            repeat = (repeat + 7) / 8; /* convert from bits to bytes */\n\n        if (fbyte > repeat)\n            return(*status = BAD_ELEM_NUM);\n\n        /* calc the i/o pointer location to start of sequence of pixels */\n        bstart = (fptr->Fptr)->datastart + ((fptr->Fptr)->rowlength * rstart) +\n               colptr->tbcol + estart;\n    }\n    else\n    {\n        descrp = TRUE;  /* a variable length descriptor column */\n        /* only bit arrays (tform = 'X') are supported for variable */\n        /* length arrays.  REPEAT is the number of BITS in the array. */\n\n        repeat = fbit + nbit -1;\n\n        /* write the number of elements and the starting offset.    */\n        /* Note: ffgcprll previous wrote the descripter, but with the */\n        /* wrong repeat value  (gave bytes instead of bits).        */\n        /* Make sure to not change the current heap offset value!  */\n\n        if (tcode == -TBIT) {\n            ffgdesll(fptr, colnum, frow, &lrepeat, &heapoffset, status);\n            ffpdes(  fptr, colnum, frow, (long) repeat, heapoffset, status);\n\t}\n\n        /* Calc the i/o pointer location to start of sequence of pixels.   */\n        /* ffgcprll has already calculated a value for bstart that         */\n        /* points to the first element of the vector; we just have to      */\n        /* increment it to point to the first element we want to write to. */\n        /* Note: ffgcprll also already updated the size of the heap, so we */\n        /* don't have to do that again here.                               */\n\n        bstart += estart;\n    }\n\n    /* move the i/o pointer to the start of the pixel sequence */\n    ffmbyt(fptr, bstart, IGNORE_EOF, status);\n\n    /* read the next byte (we may only be modifying some of the bits) */\n    while (1)\n    {\n      if (ffgbyt(fptr, 1, &cbuff, status) == END_OF_FILE)\n      {\n        /* hit end of file trying to read the byte, so just set byte = 0 */\n        *status = 0;\n        cbuff = 0;\n      }\n\n      /* move back, to be able to overwrite the byte */\n      ffmbyt(fptr, bstart, IGNORE_EOF, status);\n \n      for (ii = bitloc; (ii < 8) && (ndone < nbit); ii++, ndone++)\n      {\n        if(larray[ndone])\n          cbuff = cbuff | onbit[ii];\n        else\n          cbuff = cbuff & offbit[ii];\n      }\n\n      ffpbyt(fptr, 1, &cbuff, status); /* write the modified byte */\n      if (ndone == nbit)  /* finished all the bits */\n        return(*status);\n\n      /* not done, so get the next byte */\n      bstart++;\n      if (!descrp)\n      {\n        estart++;\n        if (estart == repeat)\n        {\n          /* move the i/o pointer to the next row of pixels */\n          estart = 0;\n          rstart = rstart + 1;\n          bstart = (fptr->Fptr)->datastart + ((fptr->Fptr)->rowlength * rstart) +\n               colptr->tbcol;\n\n          ffmbyt(fptr, bstart, IGNORE_EOF, status);\n        }\n      }\n      bitloc = 0;\n    }\n}\n\n"},{"id":16718,"name":"cfileio.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, cfileio.c, contains the low-level file access routines.     */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#include <ctype.h>\n#include <errno.h>\n#include <stddef.h>  /* apparently needed to define size_t */\n#include \"fitsio2.h\"\n#include \"group.h\"\n#ifdef CFITSIO_HAVE_CURL\n  #include <curl/curl.h>\n#endif\n\n#define MAX_PREFIX_LEN 20  /* max length of file type prefix (e.g. 'http://') */\n#define MAX_DRIVERS 31     /* max number of file I/O drivers */\n\ntypedef struct    /* structure containing pointers to I/O driver functions */ \n{   char prefix[MAX_PREFIX_LEN];\n    int (*init)(void);\n    int (*shutdown)(void);\n    int (*setoptions)(int option);\n    int (*getoptions)(int *options);\n    int (*getversion)(int *version);\n    int (*checkfile)(char *urltype, char *infile, char *outfile);\n    int (*open)(char *filename, int rwmode, int *driverhandle);\n    int (*create)(char *filename, int *drivehandle);\n    int (*truncate)(int drivehandle, LONGLONG size);\n    int (*close)(int drivehandle);\n    int (*remove)(char *filename);\n    int (*size)(int drivehandle, LONGLONG *size);\n    int (*flush)(int drivehandle);\n    int (*seek)(int drivehandle, LONGLONG offset);\n    int (*read)(int drivehandle, void *buffer, long nbytes);\n    int (*write)(int drivehandle, void *buffer, long nbytes);\n} fitsdriver;\n\nfitsdriver driverTable[MAX_DRIVERS];  /* allocate driver tables */\n\nFITSfile *FptrTable[NMAXFILES];  /* this table of Fptr pointers is */\n                                 /* used by fits_already_open */\n\nint need_to_initialize = 1;    /* true if CFITSIO has not been initialized */\nint no_of_drivers = 0;         /* number of currently defined I/O drivers */\n\nstatic int pixel_filter_helper(fitsfile **fptr, char *outfile,\n\t\t\t\tchar *expr,  int *status);\nstatic int find_quote(char **string);\nstatic int find_doublequote(char **string);\nstatic int find_paren(char **string);\nstatic int find_bracket(char **string);\nstatic int find_curlybracket(char **string);\nstatic int standardize_path(char *fullpath, int *status);\nint comma2semicolon(char *string);\n\n#ifdef _REENTRANT\n\npthread_mutex_t Fitsio_InitLock = PTHREAD_MUTEX_INITIALIZER;\n\n#endif\n\n/*--------------------------------------------------------------------------*/\nint fitsio_init_lock(void)\n{\n  int status = 0;\n  \n#ifdef _REENTRANT\n\n  static int need_to_init = 1;\n\n  pthread_mutexattr_t mutex_init;\n\n  FFLOCK1(Fitsio_InitLock);\n\n  if (need_to_init) {\n\n    /* Init the main fitsio lock here since we need a a recursive lock */\n\n    status = pthread_mutexattr_init(&mutex_init);\n    if (status) {\n        ffpmsg(\"pthread_mutexattr_init failed (fitsio_init_lock)\");\n        return(status);\n    }\n\n#ifdef __GLIBC__\n    status = pthread_mutexattr_settype(&mutex_init,\n\t\t\t\t     PTHREAD_MUTEX_RECURSIVE_NP);\n#else\n    status = pthread_mutexattr_settype(&mutex_init,\n\t\t\t\t     PTHREAD_MUTEX_RECURSIVE);\n#endif\n    if (status) {\n        ffpmsg(\"pthread_mutexattr_settype failed (fitsio_init_lock)\");\n        return(status);\n    }\n\n    status = pthread_mutex_init(&Fitsio_Lock,&mutex_init);\n    if (status) {\n        ffpmsg(\"pthread_mutex_init failed (fitsio_init_lock)\");\n        return(status);\n    }\n\n    need_to_init = 0;\n  }\n\n  FFUNLOCK1(Fitsio_InitLock);\n\n#endif\n\n    return(status);\n}\n/*--------------------------------------------------------------------------*/\nint ffomem(fitsfile **fptr,      /* O - FITS file pointer                   */ \n           const char *name,     /* I - name of file to open                */\n           int mode,             /* I - 0 = open readonly; 1 = read/write   */\n           void **buffptr,       /* I - address of memory pointer           */\n           size_t *buffsize,     /* I - size of buffer, in bytes            */\n           size_t deltasize,     /* I - increment for future realloc's      */\n           void *(*mem_realloc)(void *p, size_t newsize), /* function       */\n           int *status)          /* IO - error status                       */\n/*\n  Open an existing FITS file in core memory.  This is a specialized version\n  of ffopen.\n*/\n{\n    int ii, driver, handle, hdutyp, slen, movetotype, extvers, extnum;\n    char extname[FLEN_VALUE];\n    LONGLONG filesize;\n    char urltype[MAX_PREFIX_LEN], infile[FLEN_FILENAME], outfile[FLEN_FILENAME];\n    char extspec[FLEN_FILENAME], rowfilter[FLEN_FILENAME];\n    char binspec[FLEN_FILENAME], colspec[FLEN_FILENAME];\n    char imagecolname[FLEN_VALUE], rowexpress[FLEN_FILENAME];\n    char *url, errmsg[FLEN_ERRMSG];\n    char *hdtype[3] = {\"IMAGE\", \"TABLE\", \"BINTABLE\"};\n\n    if (*status > 0)\n        return(*status);\n\n    *fptr = 0;                   /* initialize null file pointer */\n\n    if (need_to_initialize)           /* this is called only once */\n    {\n        *status = fits_init_cfitsio();\n\n        if (*status > 0)\n            return(*status);\n    }\n\n    url = (char *) name;\n    while (*url == ' ')  /* ignore leading spaces in the file spec */\n        url++;\n\n        /* parse the input file specification */\n    fits_parse_input_url(url, urltype, infile, outfile, extspec,\n              rowfilter, binspec, colspec, status);\n\n    strcpy(urltype, \"memkeep://\");   /* URL type for pre-existing memory file */\n\n    *status = urltype2driver(urltype, &driver);\n\n    if (*status > 0)\n    {\n        ffpmsg(\"could not find driver for pre-existing memory file: (ffomem)\");\n        return(*status);\n    }\n\n    /* call driver routine to open the memory file */\n    FFLOCK;  /* lock this while searching for vacant handle */\n    *status =   mem_openmem( buffptr, buffsize,deltasize,\n                            mem_realloc,  &handle);\n    FFUNLOCK;\n\n    if (*status > 0)\n    {\n         ffpmsg(\"failed to open pre-existing memory file: (ffomem)\");\n         return(*status);\n    }\n\n        /* get initial file size */\n    *status = (*driverTable[driver].size)(handle, &filesize);\n\n    if (*status > 0)\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed get the size of the memory file: (ffomem)\");\n        return(*status);\n    }\n\n        /* allocate fitsfile structure and initialize = 0 */\n    *fptr = (fitsfile *) calloc(1, sizeof(fitsfile));\n\n    if (!(*fptr))\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate structure for following file: (ffomem)\");\n        ffpmsg(url);\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n        /* allocate FITSfile structure and initialize = 0 */\n    (*fptr)->Fptr = (FITSfile *) calloc(1, sizeof(FITSfile));\n\n    if (!((*fptr)->Fptr))\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate structure for following file: (ffomem)\");\n        ffpmsg(url);\n        free(*fptr);\n        *fptr = 0;       \n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    slen = strlen(url) + 1;\n    slen = maxvalue(slen, 32); /* reserve at least 32 chars */ \n    ((*fptr)->Fptr)->filename = (char *) malloc(slen); /* mem for file name */\n\n    if ( !(((*fptr)->Fptr)->filename) )\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate memory for filename: (ffomem)\");\n        ffpmsg(url);\n        free((*fptr)->Fptr);\n        free(*fptr);\n        *fptr = 0;              /* return null file pointer */\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    /* mem for headstart array */\n    ((*fptr)->Fptr)->headstart = (LONGLONG *) calloc(1001, sizeof(LONGLONG)); \n\n    if ( !(((*fptr)->Fptr)->headstart) )\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate memory for headstart array: (ffomem)\");\n        ffpmsg(url);\n        free( ((*fptr)->Fptr)->filename);\n        free((*fptr)->Fptr);\n        free(*fptr);\n        *fptr = 0;              /* return null file pointer */\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    /* mem for file I/O buffers */\n    ((*fptr)->Fptr)->iobuffer = (char *) calloc(NIOBUF, IOBUFLEN);\n\n    if ( !(((*fptr)->Fptr)->iobuffer) )\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate memory for iobuffer array: (ffomem)\");\n        ffpmsg(url);\n        free( ((*fptr)->Fptr)->headstart);    /* free memory for headstart array */\n        free( ((*fptr)->Fptr)->filename);\n        free((*fptr)->Fptr);\n        free(*fptr);\n        *fptr = 0;              /* return null file pointer */\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    /* initialize the ageindex array (relative age of the I/O buffers) */\n    /* and initialize the bufrecnum array as being empty */\n    for (ii = 0; ii < NIOBUF; ii++)  {\n        ((*fptr)->Fptr)->ageindex[ii] = ii;\n        ((*fptr)->Fptr)->bufrecnum[ii] = -1;\n    }\n\n        /* store the parameters describing the file */\n    ((*fptr)->Fptr)->MAXHDU = 1000;              /* initial size of headstart */\n    ((*fptr)->Fptr)->filehandle = handle;        /* file handle */\n    ((*fptr)->Fptr)->driver = driver;            /* driver number */\n    strcpy(((*fptr)->Fptr)->filename, url);      /* full input filename */\n    ((*fptr)->Fptr)->filesize = filesize;        /* physical file size */\n    ((*fptr)->Fptr)->logfilesize = filesize;     /* logical file size */\n    ((*fptr)->Fptr)->writemode = mode;      /* read-write mode    */\n    ((*fptr)->Fptr)->datastart = DATA_UNDEFINED; /* unknown start of data */\n    ((*fptr)->Fptr)->curbuf = -1;             /* undefined current IO buffer */\n    ((*fptr)->Fptr)->open_count = 1;     /* structure is currently used once */\n    ((*fptr)->Fptr)->validcode = VALIDSTRUC; /* flag denoting valid structure */\n    ((*fptr)->Fptr)->noextsyntax = 0;  /* extended syntax can be used in filename */\n\n    ffldrc(*fptr, 0, REPORT_EOF, status);     /* load first record */\n\n    fits_store_Fptr( (*fptr)->Fptr, status);  /* store Fptr address */\n\n    if (ffrhdu(*fptr, &hdutyp, status) > 0)  /* determine HDU structure */\n    {\n        ffpmsg(\n          \"ffomem could not interpret primary array header of file: (ffomem)\");\n        ffpmsg(url);\n\n        if (*status == UNKNOWN_REC)\n           ffpmsg(\"This does not look like a FITS file.\");\n\n        ffclos(*fptr, status);\n        *fptr = 0;              /* return null file pointer */\n    }\n\n    /* ---------------------------------------------------------- */\n    /* move to desired extension, if specified as part of the URL */\n    /* ---------------------------------------------------------- */\n\n    imagecolname[0] = '\\0';\n    rowexpress[0] = '\\0';\n\n    if (*extspec)\n    {\n       /* parse the extension specifier into individual parameters */\n       ffexts(extspec, &extnum, \n         extname, &extvers, &movetotype, imagecolname, rowexpress, status);\n\n\n      if (*status > 0)\n          return(*status);\n\n      if (extnum)\n      {\n        ffmahd(*fptr, extnum + 1, &hdutyp, status);\n      }\n      else if (*extname) /* move to named extension, if specified */\n      {\n        ffmnhd(*fptr, movetotype, extname, extvers, status);\n      }\n\n      if (*status > 0)\n      {\n        ffpmsg(\"ffomem could not move to the specified extension:\");\n        if (extnum > 0)\n        {\n          snprintf(errmsg, FLEN_ERRMSG,\n          \" extension number %d doesn't exist or couldn't be opened.\",extnum);\n          ffpmsg(errmsg);\n        }\n        else\n        {\n          snprintf(errmsg, FLEN_ERRMSG,\n          \" extension with EXTNAME = %s,\", extname);\n          ffpmsg(errmsg);\n\n          if (extvers)\n          {\n             snprintf(errmsg, FLEN_ERRMSG,\n             \"           and with EXTVERS = %d,\", extvers);\n             ffpmsg(errmsg);\n          }\n\n          if (movetotype != ANY_HDU)\n          {\n             snprintf(errmsg, FLEN_ERRMSG,\n             \"           and with XTENSION = %s,\", hdtype[movetotype]);\n             ffpmsg(errmsg);\n          }\n\n          ffpmsg(\" doesn't exist or couldn't be opened.\");\n        }\n        return(*status);\n      }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffdkopn(fitsfile **fptr,      /* O - FITS file pointer                   */ \n           const char *name,     /* I - full name of file to open           */\n           int mode,             /* I - 0 = open readonly; 1 = read/write   */\n           int *status)          /* IO - error status                       */\n/*\n  Open an existing FITS file on magnetic disk with either readonly or \n  read/write access.  The routine does not support CFITSIO's extended\n  filename syntax and simply uses the entire input 'name' string as\n  the name of the file.\n*/\n{\n    if (*status > 0)\n        return(*status);\n\n    *status = OPEN_DISK_FILE;\n\n    ffopen(fptr, name, mode, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffdopn(fitsfile **fptr,      /* O - FITS file pointer                   */ \n           const char *name,     /* I - full name of file to open           */\n           int mode,             /* I - 0 = open readonly; 1 = read/write   */\n           int *status)          /* IO - error status                       */\n/*\n  Open an existing FITS file with either readonly or read/write access. and\n  move to the first HDU that contains 'interesting' data, if the primary\n  array contains a null image (i.e., NAXIS = 0). \n*/\n{\n    if (*status > 0)\n        return(*status);\n\n    *status = SKIP_NULL_PRIMARY;\n\n    ffopen(fptr, name, mode, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffeopn(fitsfile **fptr,      /* O - FITS file pointer                   */ \n           const char *name,     /* I - full name of file to open           */\n           int mode,             /* I - 0 = open readonly; 1 = read/write   */\n           char *extlist,        /* I - list of 'good' extensions to move to */\n           int *hdutype,         /* O - type of extension that is moved to  */\n           int *status)          /* IO - error status                       */\n/*\n  Open an existing FITS file with either readonly or read/write access. and\n  if the primary array contains a null image (i.e., NAXIS = 0) then attempt to\n  move to the first extension named in the extlist of extension names. If\n  none are found, then simply move to the 2nd extension.\n*/\n{\n    int hdunum, naxis = 0, thdutype, gotext=0;\n    char *ext, *textlist;\n    char *saveptr;\n  \n    if (*status > 0)\n        return(*status);\n\n    if (ffopen(fptr, name, mode, status) > 0)\n        return(*status);\n\n    fits_get_hdu_num(*fptr, &hdunum);\n    fits_get_hdu_type(*fptr, &thdutype, status);\n    if (hdunum == 1 && thdutype == IMAGE_HDU) {\n      fits_get_img_dim(*fptr, &naxis, status);\n    }\n\n    /* We are in the \"default\" primary extension */\n    /* look through the extension list */\n    if( (hdunum == 1) && (naxis == 0) ){ \n      if( extlist ){\n        gotext = 0;\n\ttextlist = malloc(strlen(extlist) + 1);\n\tif (!textlist) {\n\t    *status = MEMORY_ALLOCATION;\n\t    return(*status);\n\t}\n\n        strcpy(textlist, extlist);\n        for(ext=(char *)ffstrtok(textlist, \" \",&saveptr); ext != NULL; \n\t    ext=(char *)ffstrtok(NULL,\" \",&saveptr)){\n\t    fits_movnam_hdu(*fptr, ANY_HDU, ext, 0, status);\n\t    if( *status == 0 ){\n\t      gotext = 1;\n\t      break;\n\t    } else {\n\t      *status = 0;\n\t    }\n        }\n        free(textlist);      \n      }\n      if( !gotext ){\n        /* if all else fails, move to extension #2 and hope for the best */\n        fits_movabs_hdu(*fptr, 2, &thdutype, status);\n      }\n    }\n    if (hdutype) {\n      fits_get_hdu_type(*fptr, hdutype, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fftopn(fitsfile **fptr,      /* O - FITS file pointer                   */ \n           const char *name,     /* I - full name of file to open           */\n           int mode,             /* I - 0 = open readonly; 1 = read/write   */\n           int *status)          /* IO - error status                       */\n/*\n  Open an existing FITS file with either readonly or read/write access. and\n  move to the first HDU that contains 'interesting' table (not an image). \n*/\n{\n    int hdutype;\n\n    if (*status > 0)\n        return(*status);\n\n    *status = SKIP_IMAGE;\n\n    ffopen(fptr, name, mode, status);\n\n    if (ffghdt(*fptr, &hdutype, status) <= 0) {\n        if (hdutype == IMAGE_HDU)\n            *status = NOT_TABLE;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffiopn(fitsfile **fptr,      /* O - FITS file pointer                   */ \n           const char *name,     /* I - full name of file to open           */\n           int mode,             /* I - 0 = open readonly; 1 = read/write   */\n           int *status)          /* IO - error status                       */\n/*\n  Open an existing FITS file with either readonly or read/write access. and\n  move to the first HDU that contains 'interesting' image (not an table). \n*/\n{\n    int hdutype;\n\n    if (*status > 0)\n        return(*status);\n\n    *status = SKIP_TABLE;\n\n    ffopen(fptr, name, mode, status);\n\n    if (ffghdt(*fptr, &hdutype, status) <= 0) {\n        if (hdutype != IMAGE_HDU)\n            *status = NOT_IMAGE;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffopentest(int soname,       /* I - CFITSIO shared library version     */\n                                 /*     application program (fitsio.h file) */\n           fitsfile **fptr,      /* O - FITS file pointer                   */ \n           const char *name,     /* I - full name of file to open           */\n           int mode,             /* I - 0 = open readonly; 1 = read/write   */\n           int *status)          /* IO - error status                       */\n/*\n  Open an existing FITS file with either readonly or read/write access.\n  First test that the SONAME of fitsio.h used to build the CFITSIO library\n  is the same as was used in compiling the application program that\n  links to the library.\n*/\n{ \n    if (soname != CFITSIO_SONAME)\n    {\n        printf(\"\\nERROR: Mismatch in the CFITSIO_SONAME value in the fitsio.h include file\\n\");\n\tprintf(\"that was used to build the CFITSIO library, and the value in the include file\\n\");\n\tprintf(\"that was used when compiling the application program:\\n\");\n\tprintf(\"   Version used to build the CFITSIO library   = %d\\n\",CFITSIO_SONAME);\n\tprintf(\"   Version included by the application program = %d\\n\",soname);\n\tprintf(\"\\nFix this by recompiling and then relinking this application program \\n\");\n\tprintf(\"with the CFITSIO library.\\n\");\n\n        *status = FILE_NOT_OPENED;\n\treturn(*status);\n    }\n\n    /* now call the normal file open routine */\n    ffopen(fptr, name, mode, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffopen(fitsfile **fptr,      /* O - FITS file pointer                   */ \n           const char *name,     /* I - full name of file to open           */\n           int mode,             /* I - 0 = open readonly; 1 = read/write   */\n           int *status)          /* IO - error status                       */\n/*\n  Open an existing FITS file with either readonly or read/write access.\n*/\n{\n    fitsfile *newptr;\n    int  ii, driver, hdutyp, hdunum, slen, writecopy, isopen;\n    LONGLONG filesize;\n    long rownum, nrows, goodrows;\n    int extnum, extvers, handle, movetotype, tstatus = 0, only_one = 0;\n    char urltype[MAX_PREFIX_LEN], infile[FLEN_FILENAME], outfile[FLEN_FILENAME];\n    char origurltype[MAX_PREFIX_LEN], extspec[FLEN_FILENAME];\n    char extname[FLEN_VALUE], rowfilter[FLEN_FILENAME], tblname[FLEN_VALUE];\n    char imagecolname[FLEN_VALUE], rowexpress[FLEN_FILENAME];\n    char binspec[FLEN_FILENAME], colspec[FLEN_FILENAME], pixfilter[FLEN_FILENAME];\n    char histfilename[FLEN_FILENAME];\n    char filtfilename[FLEN_FILENAME], compspec[FLEN_FILENAME];\n    char wtcol[FLEN_VALUE];\n    char minname[4][FLEN_VALUE], maxname[4][FLEN_VALUE];\n    char binname[4][FLEN_VALUE];\n\n    char *url;\n    double minin[4], maxin[4], binsizein[4], weight;\n    int imagetype, naxis = 1, haxis, recip;\n    int skip_null = 0, skip_image = 0, skip_table = 0, open_disk_file = 0;\n    char colname[4][FLEN_VALUE];\n    char errmsg[FLEN_ERRMSG];\n    char *hdtype[3] = {\"IMAGE\", \"TABLE\", \"BINTABLE\"};\n    char *rowselect = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    if (*status == SKIP_NULL_PRIMARY)\n    {\n      /* this special status value is used as a flag by ffdopn to tell */\n      /* ffopen to skip over a null primary array when opening the file. */\n\n       skip_null = 1;\n       *status = 0;\n    }\n    else if (*status == SKIP_IMAGE)\n    {\n      /* this special status value is used as a flag by fftopn to tell */\n      /* ffopen to move to 1st significant table when opening the file. */\n\n       skip_image = 1;\n       *status = 0;\n    }\n    else if (*status == SKIP_TABLE)\n    {\n      /* this special status value is used as a flag by ffiopn to tell */\n      /* ffopen to move to 1st significant image when opening the file. */\n\n       skip_table = 1;\n       *status = 0;\n    }\n    else if (*status == OPEN_DISK_FILE)\n    {\n      /* this special status value is used as a flag by ffdkopn to tell */\n      /* ffopen to not interpret the input filename using CFITSIO's    */\n      /* extended filename syntax, and simply open the specified disk file */\n\n       open_disk_file = 1;\n       *status = 0;\n    }\n    \n    *fptr = 0;              /* initialize null file pointer */\n    writecopy = 0;  /* have we made a write-able copy of the input file? */\n\n    if (need_to_initialize) {          /* this is called only once */\n       *status = fits_init_cfitsio();\n    }\n    \n    if (*status > 0)\n        return(*status);\n\n    url = (char *) name;\n    while (*url == ' ')  /* ignore leading spaces in the filename */\n        url++;\n\n    if (*url == '\\0')\n    {\n        ffpmsg(\"Name of file to open is blank. (ffopen)\");\n        return(*status = FILE_NOT_OPENED);\n    }\n\n    if (open_disk_file)\n    {\n      /* treat the input URL literally as the name of the file to open */\n      /* and don't try to parse the URL using the extended filename syntax */\n      \n        if (strlen(url) > FLEN_FILENAME - 1) {\n            ffpmsg(\"Name of file to open is too long. (ffopen)\");\n            return(*status = FILE_NOT_OPENED);\n        }\n\n        strcpy(infile,url);\n        strcpy(urltype, \"file://\");\n        outfile[0] = '\\0';\n        extspec[0] = '\\0';\n        binspec[0] = '\\0';\n        colspec[0] = '\\0';\n        rowfilter[0] = '\\0';\n        pixfilter[0] = '\\0';\n        compspec[0] = '\\0';\n    }\n    else\n    {\n        /* parse the input file specification */\n\n        /* NOTE: This routine tests that all the strings do not */\n\t/* overflow the standard buffer sizes (FLEN_FILENAME, etc.) */\n\t/* therefore in general we do not have to worry about buffer */\n\t/* overflow of any of the returned strings. */\n\t\n        /* call the newer version of this parsing routine that supports 'compspec' */\n        ffifile2(url, urltype, infile, outfile, extspec,\n              rowfilter, binspec, colspec, pixfilter, compspec, status);\n    }\n    \n    if (*status > 0)\n    {\n        ffpmsg(\"could not parse the input filename: (ffopen)\");\n        ffpmsg(url);\n        return(*status);\n    }\n\n    imagecolname[0] = '\\0';\n    rowexpress[0] = '\\0';\n\n    if (*extspec)\n    {\n       slen = strlen(extspec);\n       if (extspec[slen - 1] == '#') {  /* special symbol to mean only copy this extension */\n           extspec[slen - 1] = '\\0';\n\t   only_one = 1;\n       }\n\n       /* parse the extension specifier into individual parameters */\n       ffexts(extspec, &extnum, \n         extname, &extvers, &movetotype, imagecolname, rowexpress, status);\n\n      if (*status > 0)\n          return(*status);\n    }\n\n    /*-------------------------------------------------------------------*/\n    /* special cases:                                                    */\n    /*-------------------------------------------------------------------*/\n\n    histfilename[0] = '\\0';\n    filtfilename[0] = '\\0';\n    if (*outfile && (*binspec || *imagecolname || *pixfilter))\n    {\n        /* if binspec or imagecolumn are specified, then the  */\n        /* output file name is intended for the final image,  */\n        /* and not a copy of the input file.                  */\n\n        strcpy(histfilename, outfile);\n        outfile[0] = '\\0';\n    }\n    else if (*outfile && (*rowfilter || *colspec))\n    {\n        /* if rowfilter or colspece are specified, then the    */\n        /* output file name is intended for the filtered file  */\n        /* and not a copy of the input file.                   */\n\n        strcpy(filtfilename, outfile);\n        outfile[0] = '\\0';\n    }\n\n    /*-------------------------------------------------------------------*/\n    /* check if this same file is already open, and if so, attach to it  */\n    /*-------------------------------------------------------------------*/\n\n    FFLOCK;\n    if (fits_already_open(fptr, url, urltype, infile, extspec, rowfilter,\n            binspec, colspec, mode, open_disk_file, &isopen, status) > 0)\n    {\n        FFUNLOCK;\n        return(*status);\n    }\n    FFUNLOCK;\n\n    if (isopen) {\n       goto move2hdu;  \n    }\n\n    /* get the driver number corresponding to this urltype */\n    *status = urltype2driver(urltype, &driver);\n\n    if (*status > 0)\n    {\n        ffpmsg(\"could not find driver for this file: (ffopen)\");\n        ffpmsg(urltype);\n        ffpmsg(url);\n        return(*status);\n    }\n\n    /*-------------------------------------------------------------------\n        deal with all those messy special cases which may require that\n        a different driver be used:\n            - is disk file compressed?\n            - are ftp:, gsiftp:, or http: files compressed?\n            - has user requested that a local copy be made of\n              the ftp or http file?\n      -------------------------------------------------------------------*/\n\n    if (driverTable[driver].checkfile)\n    {\n        strcpy(origurltype,urltype);  /* Save the urltype */\n\n        /* 'checkfile' may modify the urltype, infile and outfile strings */\n        *status =  (*driverTable[driver].checkfile)(urltype, infile, outfile);\n\n        if (*status)\n        {\n            ffpmsg(\"checkfile failed for this file: (ffopen)\");\n            ffpmsg(url);\n            return(*status);\n        }\n\n        if (strcmp(origurltype, urltype))  /* did driver changed on us? */\n        {\n            *status = urltype2driver(urltype, &driver);\n            if (*status > 0)\n            {\n                ffpmsg(\"could not change driver for this file: (ffopen)\");\n                ffpmsg(url);\n                ffpmsg(urltype);\n                return(*status);\n            }\n        }\n    }\n\n    /* call appropriate driver to open the file */\n    if (driverTable[driver].open)\n    {\n        FFLOCK;  /* lock this while searching for vacant handle */\n        *status =  (*driverTable[driver].open)(infile, mode, &handle);\n        FFUNLOCK;\n        if (*status > 0)\n        {\n            ffpmsg(\"failed to find or open the following file: (ffopen)\");\n            ffpmsg(url);\n            return(*status);\n       }\n    }\n    else\n    {\n        ffpmsg(\"cannot open an existing file of this type: (ffopen)\");\n        ffpmsg(url);\n        return(*status = FILE_NOT_OPENED);\n    }\n\n        /* get initial file size */\n    *status = (*driverTable[driver].size)(handle, &filesize);\n    if (*status > 0)\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed get the size of the following file: (ffopen)\");\n        ffpmsg(url);\n        return(*status);\n    }\n\n        /* allocate fitsfile structure and initialize = 0 */\n    *fptr = (fitsfile *) calloc(1, sizeof(fitsfile));\n\n    if (!(*fptr))\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate structure for following file: (ffopen)\");\n        ffpmsg(url);\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n        /* allocate FITSfile structure and initialize = 0 */\n    (*fptr)->Fptr = (FITSfile *) calloc(1, sizeof(FITSfile));\n\n    if (!((*fptr)->Fptr))\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate structure for following file: (ffopen)\");\n        ffpmsg(url);\n        free(*fptr);\n        *fptr = 0;       \n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    slen = strlen(url) + 1;\n    slen = maxvalue(slen, 32); /* reserve at least 32 chars */ \n    ((*fptr)->Fptr)->filename = (char *) malloc(slen); /* mem for file name */\n\n    if ( !(((*fptr)->Fptr)->filename) )\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate memory for filename: (ffopen)\");\n        ffpmsg(url);\n        free((*fptr)->Fptr);\n        free(*fptr);\n        *fptr = 0;              /* return null file pointer */\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    /* mem for headstart array */\n    ((*fptr)->Fptr)->headstart = (LONGLONG *) calloc(1001, sizeof(LONGLONG));\n\n    if ( !(((*fptr)->Fptr)->headstart) )\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate memory for headstart array: (ffopen)\");\n        ffpmsg(url);\n        free( ((*fptr)->Fptr)->filename);\n        free((*fptr)->Fptr);\n        free(*fptr);\n        *fptr = 0;              /* return null file pointer */\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    /* mem for file I/O buffers */\n    ((*fptr)->Fptr)->iobuffer = (char *) calloc(NIOBUF, IOBUFLEN);\n\n    if ( !(((*fptr)->Fptr)->iobuffer) )\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate memory for iobuffer array: (ffopen)\");\n        ffpmsg(url);\n        free( ((*fptr)->Fptr)->headstart);    /* free memory for headstart array */\n        free( ((*fptr)->Fptr)->filename);\n        free((*fptr)->Fptr);\n        free(*fptr);\n        *fptr = 0;              /* return null file pointer */\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    /* initialize the ageindex array (relative age of the I/O buffers) */\n    /* and initialize the bufrecnum array as being empty */\n    for (ii = 0; ii < NIOBUF; ii++)  {\n        ((*fptr)->Fptr)->ageindex[ii] = ii;\n        ((*fptr)->Fptr)->bufrecnum[ii] = -1;\n    }\n\n        /* store the parameters describing the file */\n    ((*fptr)->Fptr)->MAXHDU = 1000;              /* initial size of headstart */\n    ((*fptr)->Fptr)->filehandle = handle;        /* file handle */\n    ((*fptr)->Fptr)->driver = driver;            /* driver number */\n    strcpy(((*fptr)->Fptr)->filename, url);      /* full input filename */\n    ((*fptr)->Fptr)->filesize = filesize;        /* physical file size */\n    ((*fptr)->Fptr)->logfilesize = filesize;     /* logical file size */\n    ((*fptr)->Fptr)->writemode = mode;           /* read-write mode    */\n    ((*fptr)->Fptr)->datastart = DATA_UNDEFINED; /* unknown start of data */\n    ((*fptr)->Fptr)->curbuf = -1;            /* undefined current IO buffer */\n    ((*fptr)->Fptr)->open_count = 1;      /* structure is currently used once */\n    ((*fptr)->Fptr)->validcode = VALIDSTRUC; /* flag denoting valid structure */\n    ((*fptr)->Fptr)->only_one = only_one; /* flag denoting only copy single extension */\n    ((*fptr)->Fptr)->noextsyntax = open_disk_file; /* true if extended syntax is disabled */\n\n    ffldrc(*fptr, 0, REPORT_EOF, status);     /* load first record */\n\n    fits_store_Fptr( (*fptr)->Fptr, status);  /* store Fptr address */\n\n    if (ffrhdu(*fptr, &hdutyp, status) > 0)  /* determine HDU structure */\n    {\n        ffpmsg(\n          \"ffopen could not interpret primary array header of file: \");\n        ffpmsg(url);\n\n        if (*status == UNKNOWN_REC)\n           ffpmsg(\"This does not look like a FITS file.\");\n\n        ffclos(*fptr, status);\n        *fptr = 0;              /* return null file pointer */\n        return(*status);\n    }\n\n    /* ------------------------------------------------------------- */\n    /* At this point, the input file has been opened. If outfile was */\n    /* specified, then we have opened a copy of the file, not the    */\n    /* original file so it is safe to modify it if necessary         */\n    /* ------------------------------------------------------------- */\n\n    if (*outfile)\n        writecopy = 1;  \n\nmove2hdu:\n\n    /* ---------------------------------------------------------- */\n    /* move to desired extension, if specified as part of the URL */\n    /* ---------------------------------------------------------- */\n\n    if (*extspec)\n    {\n      if (extnum)  /* extension number was specified */\n      {\n        ffmahd(*fptr, extnum + 1, &hdutyp, status);\n      }\n      else if (*extname) /* move to named extension, if specified */\n      {\n        ffmnhd(*fptr, movetotype, extname, extvers, status);\n      }\n\n      if (*status > 0)  /* clean up after error */\n      {\n        ffpmsg(\"ffopen could not move to the specified extension:\");\n        if (extnum > 0)\n        {\n          snprintf(errmsg, FLEN_ERRMSG,\n          \" extension number %d doesn't exist or couldn't be opened.\",extnum);\n          ffpmsg(errmsg);\n        }\n        else\n        {\n          snprintf(errmsg, FLEN_ERRMSG,\n          \" extension with EXTNAME = %s,\", extname);\n          ffpmsg(errmsg);\n\n          if (extvers)\n          {\n             snprintf(errmsg, FLEN_ERRMSG,\n             \"           and with EXTVERS = %d,\", extvers);\n             ffpmsg(errmsg);\n          }\n\n          if (movetotype != ANY_HDU)\n          {\n             snprintf(errmsg, FLEN_ERRMSG,\n             \"           and with XTENSION = %s,\", hdtype[movetotype]);\n             ffpmsg(errmsg);\n          }\n\n          ffpmsg(\" doesn't exist or couldn't be opened.\");\n        }\n\n        ffclos(*fptr, status);\n        *fptr = 0;              /* return null file pointer */\n        return(*status);\n      }\n    }\n    else if (skip_null || skip_image || skip_table ||\n            (*imagecolname || *colspec || *rowfilter || *binspec))\n    {\n      /* ------------------------------------------------------------------\n\n      If no explicit extension specifier is given as part of the file\n      name, and, if a) skip_null is true (set if ffopen is called by\n      ffdopn) or b) skip_image or skip_table is true (set if ffopen is\n      called by fftopn or ffdopn) or c) other file filters are\n      specified, then CFITSIO will attempt to move to the first\n      'interesting' HDU after opening an existing FITS file (or to\n      first interesting table HDU if skip_image is true);\n\n      An 'interesting' HDU is defined to be either an image with NAXIS\n      > 0 (i.e., not a null array) or a table which has an EXTNAME\n      value which does not contain any of the following strings:\n         'GTI'  - Good Time Interval extension\n         'OBSTABLE'  - used in Beppo SAX data files\n\n      The main purpose for this is to allow CFITSIO to skip over a null\n      primary and other non-interesting HDUs when opening an existing\n      file, and move directly to the first extension that contains\n      significant data.\n      ------------------------------------------------------------------ */\n\n      fits_get_hdu_num(*fptr, &hdunum);\n      if (hdunum == 1) {\n\n        fits_get_img_dim(*fptr, &naxis, status);\n\n        if (naxis == 0 || skip_image) /* skip primary array */\n        {\n          while(1) \n          {\n            /* see if the next HDU is 'interesting' */\n            if (fits_movrel_hdu(*fptr, 1, &hdutyp, status))\n            {\n               if (*status == END_OF_FILE)\n                  *status = 0;  /* reset expected error */\n\n               /* didn't find an interesting HDU so move back to beginning */\n               fits_movabs_hdu(*fptr, 1, &hdutyp, status);\n               break;\n            }\n\n            if (hdutyp == IMAGE_HDU && skip_image) {\n\n                continue;   /* skip images */\n\n            } else if (hdutyp != IMAGE_HDU && skip_table) {\n\n                continue;   /* skip tables */\n\n            } else if (hdutyp == IMAGE_HDU) {\n\n               fits_get_img_dim(*fptr, &naxis, status);\n               if (naxis > 0)\n                  break;  /* found a non-null image */\n\n            } else {\n\n               tstatus = 0;\n               tblname[0] = '\\0';\n               fits_read_key(*fptr, TSTRING, \"EXTNAME\", tblname, NULL,&tstatus);\n\n               if ( (!strstr(tblname, \"GTI\") && !strstr(tblname, \"gti\")) &&\n                    fits_strncasecmp(tblname, \"OBSTABLE\", 8) )\n                  break;  /* found an interesting table */\n            }\n          }  /* end while */\n        }\n      } /* end if (hdunum==1) */\n    }\n\n    if (*imagecolname)\n    {\n       /* ----------------------------------------------------------------- */\n       /* we need to open an image contained in a single table cell         */\n       /* First, determine which row of the table to use.                   */\n       /* ----------------------------------------------------------------- */\n\n       if (isdigit((int) *rowexpress))  /* is the row specification a number? */\n       {\n          sscanf(rowexpress, \"%ld\", &rownum);\n          if (rownum < 1)\n          {\n             ffpmsg(\"illegal rownum for image cell:\");\n             ffpmsg(rowexpress);\n             ffpmsg(\"Could not open the following image in a table cell:\");\n             ffpmsg(extspec);\n             ffclos(*fptr, status);\n             *fptr = 0;              /* return null file pointer */\n             return(*status = BAD_ROW_NUM);\n          }\n       }\n       else if (fits_find_first_row(*fptr, rowexpress, &rownum, status) > 0)\n       {\n          ffpmsg(\"Failed to find row matching this expression:\");\n          ffpmsg(rowexpress);\n          ffpmsg(\"Could not open the following image in a table cell:\");\n          ffpmsg(extspec);\n          ffclos(*fptr, status);\n          *fptr = 0;              /* return null file pointer */\n          return(*status);\n       }\n\n       if (rownum == 0)\n       {\n          ffpmsg(\"row satisfying this expression doesn't exist::\");\n          ffpmsg(rowexpress);\n          ffpmsg(\"Could not open the following image in a table cell:\");\n          ffpmsg(extspec);\n          ffclos(*fptr, status);\n          *fptr = 0;              /* return null file pointer */\n          return(*status = BAD_ROW_NUM);\n       }\n\n       /* determine the name of the new file to contain copy of the image */\n       if (*histfilename && !(*pixfilter) )\n           strcpy(outfile, histfilename); /* the original outfile name */\n       else\n           strcpy(outfile, \"mem://_1\");  /* create image file in memory */\n\n       /* Copy the image into new primary array and open it as the current */\n       /* fptr.  This will close the table that contains the original image. */\n\n       /* create new empty file to hold copy of the image */\n       if (ffinit(&newptr, outfile, status) > 0)\n       {\n          ffpmsg(\"failed to create file for copy of image in table cell:\");\n          ffpmsg(outfile);\n          return(*status);\n       }\n      \n       if (fits_copy_cell2image(*fptr, newptr, imagecolname, rownum,\n                                status) > 0)\n       {\n          ffpmsg(\"Failed to copy table cell to new primary array:\");\n          ffpmsg(extspec);\n          ffclos(*fptr, status);\n          *fptr = 0;              /* return null file pointer */\n          return(*status);\n       }\n\n       /* close the original file and set fptr to the new image */\n       ffclos(*fptr, status);\n\n       *fptr = newptr; /* reset the pointer to the new table */\n\n       writecopy = 1;  /* we are now dealing with a copy of the original file */\n\n       \n       /*  leave it up to calling routine to write any HISTORY keywords */\n    }\n\n    /* --------------------------------------------------------------------- */\n    /* edit columns (and/or keywords) in the table, if specified in the URL  */\n    /* --------------------------------------------------------------------- */\n \n    if (*colspec)\n    {\n       /* the column specifier will modify the file, so make sure */\n       /* we are already dealing with a copy, or else make a new copy */\n\n       if (!writecopy)  /* Is the current file already a copy? */\n           writecopy = fits_is_this_a_copy(urltype);\n\n       if (!writecopy)\n       {\n           if (*filtfilename && *outfile == '\\0')\n               strcpy(outfile, filtfilename); /* the original outfile name */\n           else\n               strcpy(outfile, \"mem://_1\");   /* will create copy in memory */\n\n           writecopy = 1;\n       }\n       else\n       {\n           ((*fptr)->Fptr)->writemode = READWRITE; /* we have write access */\n           outfile[0] = '\\0';\n       }\n\n       if (ffedit_columns(fptr, outfile, colspec, status) > 0)\n       {\n           ffpmsg(\"editing columns in input table failed (ffopen)\");\n           ffpmsg(\" while trying to perform the following operation:\");\n           ffpmsg(colspec);\n           ffclos(*fptr, status);\n           *fptr = 0;              /* return null file pointer */\n           return(*status);\n       }\n    }\n\n    /* ------------------------------------------------------------------- */\n    /* select rows from the table, if specified in the URL                 */\n    /* or select a subimage (if this is an image HDU and not a table)      */\n    /* ------------------------------------------------------------------- */\n \n    if (*rowfilter)\n    {\n     fits_get_hdu_type(*fptr, &hdutyp, status);  /* get type of HDU */\n     if (hdutyp == IMAGE_HDU)\n     {\n        /* this is an image so 'rowfilter' is an image section specification */\n\n        if (*filtfilename && *outfile == '\\0')\n            strcpy(outfile, filtfilename); /* the original outfile name */\n        else if (*outfile == '\\0') /* output file name not already defined? */\n            strcpy(outfile, \"mem://_2\");  /* will create file in memory */\n\n        /* create new file containing the image section, plus a copy of */\n        /* any other HDUs that exist in the input file.  This routine   */\n        /* will close the original image file and return a pointer      */\n        /* to the new file. */\n\n        if (fits_select_image_section(fptr, outfile, rowfilter, status) > 0)\n        {\n           ffpmsg(\"on-the-fly selection of image section failed (ffopen)\");\n           ffpmsg(\" while trying to use the following section filter:\");\n           ffpmsg(rowfilter);\n           ffclos(*fptr, status);\n           *fptr = 0;              /* return null file pointer */\n           return(*status);\n        }\n     }\n     else\n     {\n       /* this is a table HDU, so the rowfilter is really a row filter */\n\n      if (*binspec)\n      {\n        /*  since we are going to make a histogram of the selected rows,   */\n        /*  it would be a waste of time and memory to make a whole copy of */\n        /*  the selected rows.  Instead, just construct an array of TRUE   */\n        /*  or FALSE values that indicate which rows are to be included    */\n        /*  in the histogram and pass that to the histogram generating     */\n        /*  routine                                                        */\n\n        fits_get_num_rows(*fptr, &nrows, status);  /* get no. of rows */\n\n        rowselect = (char *) calloc(nrows, 1);\n        if (!rowselect)\n        {\n           ffpmsg(\n           \"failed to allocate memory for selected columns array (ffopen)\");\n           ffpmsg(\" while trying to select rows with the following filter:\");\n           ffpmsg(rowfilter);\n           ffclos(*fptr, status);\n           *fptr = 0;              /* return null file pointer */\n           return(*status = MEMORY_ALLOCATION);\n        }\n\n        if (fits_find_rows(*fptr, rowfilter, 1L, nrows, &goodrows,\n            rowselect, status) > 0)\n        {\n           ffpmsg(\"selection of rows in input table failed (ffopen)\");\n           ffpmsg(\" while trying to select rows with the following filter:\");\n           ffpmsg(rowfilter);\n           free(rowselect);\n           ffclos(*fptr, status);\n           *fptr = 0;              /* return null file pointer */\n           return(*status);\n        }\n      }\n      else\n      {\n        if (!writecopy)  /* Is the current file already a copy? */\n           writecopy = fits_is_this_a_copy(urltype);\n\n        if (!writecopy)\n        {\n           if (*filtfilename && *outfile == '\\0')\n               strcpy(outfile, filtfilename); /* the original outfile name */\n           else if (*outfile == '\\0') /* output filename not already defined? */\n               strcpy(outfile, \"mem://_2\");  /* will create copy in memory */\n        }\n        else\n        {\n           ((*fptr)->Fptr)->writemode = READWRITE; /* we have write access */\n           outfile[0] = '\\0';\n        }\n\n        /* select rows in the table.  If a copy of the input file has */\n        /* not already been made, then this routine will make a copy */\n        /* and then close the input file, so that the modifications will */\n        /* only be made on the copy, not the original */\n\n        if (ffselect_table(fptr, outfile, rowfilter, status) > 0)\n        {\n          ffpmsg(\"on-the-fly selection of rows in input table failed (ffopen)\");\n           ffpmsg(\" while trying to select rows with the following filter:\");\n           ffpmsg(rowfilter);\n           ffclos(*fptr, status);\n           *fptr = 0;              /* return null file pointer */\n           return(*status);\n        }\n\n        /* write history records */\n        ffphis(*fptr, \n        \"CFITSIO used the following filtering expression to create this table:\",\n        status);\n        ffphis(*fptr, name, status);\n\n      }   /* end of no binspec case */\n     }   /* end of table HDU case */\n    }  /* end of rowfilter exists case */\n\n    /* ------------------------------------------------------------------- */\n    /* make an image histogram by binning columns, if specified in the URL */\n    /* ------------------------------------------------------------------- */\n \n    if (*binspec)\n    {\n       if (*histfilename  && !(*pixfilter) )\n           strcpy(outfile, histfilename); /* the original outfile name */\n       else\n           strcpy(outfile, \"mem://_3\");  /* create histogram in memory */\n                                         /* if not already copied the file */ \n\n       /* parse the binning specifier into individual parameters */\n       ffbins(binspec, &imagetype, &haxis, colname, \n                          minin, maxin, binsizein, \n                          minname, maxname, binname,\n                          &weight, wtcol, &recip, status);\n\n       /* Create the histogram primary array and open it as the current fptr */\n       /* This will close the table that was used to create the histogram. */\n       ffhist2(fptr, outfile, imagetype, haxis, colname, minin, maxin,\n              binsizein, minname, maxname, binname,\n              weight, wtcol, recip, rowselect, status);\n\n       if (rowselect)\n          free(rowselect);\n\n       if (*status > 0)\n       {\n      ffpmsg(\"on-the-fly histogramming of input table failed (ffopen)\");\n      ffpmsg(\" while trying to execute the following histogram specification:\");\n      ffpmsg(binspec);\n           ffclos(*fptr, status);\n           *fptr = 0;              /* return null file pointer */\n           return(*status);\n       }\n\n        /* write history records */\n        ffphis(*fptr,\n        \"CFITSIO used the following expression to create this histogram:\", \n        status);\n        ffphis(*fptr, name, status);\n    }\n\n    if (*pixfilter)\n    {\n       if (*histfilename)\n           strcpy(outfile, histfilename); /* the original outfile name */\n       else\n           strcpy(outfile, \"mem://_4\");  /* create in memory */\n                                         /* if not already copied the file */ \n\n       /* Ensure type of HDU is consistent with pixel filtering */\n       fits_get_hdu_type(*fptr, &hdutyp, status);  /* get type of HDU */\n       if (hdutyp == IMAGE_HDU) {\n\n          pixel_filter_helper(fptr, outfile, pixfilter, status);\n\n          if (*status > 0) {\n             ffpmsg(\"pixel filtering of input image failed (ffopen)\");\n             ffpmsg(\" while trying to execute the following:\");\n             ffpmsg(pixfilter);\n             ffclos(*fptr, status);\n             *fptr = 0;              /* return null file pointer */\n             return(*status);\n          }\n\n          /* write history records */\n          ffphis(*fptr,\n          \"CFITSIO used the following expression to create this image:\",\n          status);\n          ffphis(*fptr, name, status);\n       }\n       else\n       {\n          ffpmsg(\"cannot use pixel filter on non-IMAGE HDU\");\n          ffpmsg(pixfilter);\n          ffclos(*fptr, status);\n          *fptr = 0;              /* return null file pointer */\n          *status = NOT_IMAGE;\n          return(*status);\n       }\n    }\n\n   /* parse and save image compression specification, if given */\n   if (*compspec) {\n      ffparsecompspec(*fptr, compspec, status);\n   }\n \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffreopen(fitsfile *openfptr, /* I - FITS file pointer to open file  */ \n             fitsfile **newfptr,  /* O - pointer to new re opened file   */\n             int *status)        /* IO - error status                   */\n/*\n  Reopen an existing FITS file with either readonly or read/write access.\n  The reopened file shares the same FITSfile structure but may point to a\n  different HDU within the file.\n*/\n{\n    if (*status > 0)\n        return(*status);\n\n    /* check that the open file pointer is valid */\n    if (!openfptr)\n        return(*status = NULL_INPUT_PTR);\n    else if ((openfptr->Fptr)->validcode != VALIDSTRUC) /* check magic value */\n        return(*status = BAD_FILEPTR); \n\n        /* allocate fitsfile structure and initialize = 0 */\n    *newfptr = (fitsfile *) calloc(1, sizeof(fitsfile));\n\n    (*newfptr)->Fptr = openfptr->Fptr; /* both point to the same structure */\n    (*newfptr)->HDUposition = 0;  /* set initial position to primary array */\n    (((*newfptr)->Fptr)->open_count)++;   /* increment the file usage counter */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_store_Fptr(FITSfile *Fptr,  /* O - FITS file pointer               */ \n           int *status)              /* IO - error status                   */\n/*\n   store the new Fptr address for future use by fits_already_open \n*/\n{\n    int ii;\n\n    if (*status > 0)\n        return(*status);\n\n    FFLOCK;\n    for (ii = 0; ii < NMAXFILES; ii++) {\n        if (FptrTable[ii] == 0) {\n            FptrTable[ii] = Fptr;\n            break;\n        }\n    }\n    FFUNLOCK;\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_clear_Fptr(FITSfile *Fptr,  /* O - FITS file pointer               */ \n           int *status)              /* IO - error status                   */\n/*\n   clear the Fptr address from the Fptr Table  \n*/\n{\n    int ii;\n\n    FFLOCK;\n    for (ii = 0; ii < NMAXFILES; ii++) {\n        if (FptrTable[ii] == Fptr) {\n            FptrTable[ii] = 0;\n            break;\n        }\n    }\n    FFUNLOCK;\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_already_open(fitsfile **fptr, /* I/O - FITS file pointer       */ \n           char *url, \n           char *urltype, \n           char *infile, \n           char *extspec, \n           char *rowfilter,\n           char *binspec, \n           char *colspec, \n           int  mode,             /* I - 0 = open readonly; 1 = read/write   */\n           int  noextsyn, /* I - 0 = ext syntax may be used; 1 = ext syntax disabled */\n           int  *isopen,          /* O - 1 = file is already open            */\n           int  *status)          /* IO - error status                       */\n/*\n  Check if the file to be opened is already open.  If so, then attach to it.\n*/\n\n   /* the input strings must not exceed the standard lengths */\n   /* of FLEN_FILENAME, MAX_PREFIX_LEN, etc. */\n\n     /*\n       this function was changed so that for files of access method FILE://\n       the file paths are compared using standard URL syntax and absolute\n       paths (as opposed to relative paths). This eliminates some instances\n       where a file is already opened but it is not realized because it\n       was opened with another file path. For instance, if the CWD is\n       /a/b/c and I open /a/b/c/foo.fits then open ./foo.fits the previous\n       version of this function would not have reconized that the two files\n       were the same. This version does recognize that the two files are\n       the same.\n     */\n{\n    FITSfile *oldFptr;\n    int ii, iMatch=-1;\n    char oldurltype[MAX_PREFIX_LEN], oldinfile[FLEN_FILENAME];\n    char oldextspec[FLEN_FILENAME], oldoutfile[FLEN_FILENAME];\n    char oldrowfilter[FLEN_FILENAME];\n    char oldbinspec[FLEN_FILENAME], oldcolspec[FLEN_FILENAME];\n    char cwd[FLEN_FILENAME];\n    char tmpStr[FLEN_FILENAME];\n    char tmpinfile[FLEN_FILENAME]; \n    \n    *isopen = 0;\n\n/*  When opening a file with readonly access then we simply let\n    the operating system open the file again, instead of using the CFITSIO\n    trick of attaching to the previously opened file.  This is required\n    if CFITSIO is running in a multi-threaded environment, because 2 different\n    threads cannot share the same FITSfile pointer.\n    \n    If the file is opened/reopened with write access, then the file MUST\n    only be physically opened once..\n*/ \n    if (mode == 0)\n        return(*status);\n\n    strcpy(tmpinfile, infile);\n    if(fits_strcasecmp(urltype,\"FILE://\") == 0)\n    {\n       if (standardize_path(tmpinfile, status))\n          return(*status);          \n    }\n\n    for (ii = 0; ii < NMAXFILES; ii++)   /* check every buffer */\n    {\n        if (FptrTable[ii] != 0)\n        {\n          oldFptr = FptrTable[ii];\n          \n          if (oldFptr->noextsyntax)\n          {\n            /* old urltype must be \"file://\" */\n            if (fits_strcasecmp(urltype,\"FILE://\") == 0)\n            {\n               /* compare tmpinfile to adjusted oldFptr->filename */\n               \n               /* This shouldn't be possible, but check anyway */\n               if (strlen(oldFptr->filename) > FLEN_FILENAME-1)        \n               {\n                  ffpmsg(\"Name of old file is too long. (fits_already_open)\");\n                  return (*status = FILE_NOT_OPENED);\n               }\n               strcpy(oldinfile, oldFptr->filename);\n               if (standardize_path(oldinfile, status))\n                  return(*status);\n                              \n               if (!strcmp(tmpinfile, oldinfile))\n               {\n                  /* if infile is not noextsyn, must check that it is not\n                     using filters of any kind */\n                  if (noextsyn || (!rowfilter[0] && !binspec[0] && !colspec[0])) \n                  {\n                     if (mode == READWRITE && oldFptr->writemode == READONLY)\n                     {\n                       /*\n                         cannot assume that a file previously opened with READONLY\n                         can now be written to (e.g., files on CDROM, or over the\n                         the network, or STDIN), so return with an error.\n                       */\n\n                       ffpmsg(\n                   \"cannot reopen file READWRITE when previously opened READONLY\");\n                       ffpmsg(url);\n                       return(*status = FILE_NOT_OPENED);\n                     }\n                     iMatch = ii;\n                  }  \n               }\n             }            \n          } /* end if old file has disabled extended syntax */\n          else\n          {\n             fits_parse_input_url(oldFptr->filename, oldurltype, \n                       oldinfile, oldoutfile, oldextspec, oldrowfilter, \n                       oldbinspec, oldcolspec, status);\n\n             if (*status > 0)\n             {\n               ffpmsg(\"could not parse the previously opened filename: (ffopen)\");\n               ffpmsg(oldFptr->filename);\n               return(*status);\n             }\n             \n             if(fits_strcasecmp(oldurltype,\"FILE://\") == 0)\n               {\n                 if (standardize_path(oldinfile, status))\n                    return(*status);\n               }\n\n             if (!strcmp(urltype, oldurltype) && !strcmp(tmpinfile, oldinfile) )\n             {\n                 /* identical type of file and root file name */\n\n                 if ( (!rowfilter[0] && !oldrowfilter[0] &&\n                       !binspec[0]   && !oldbinspec[0] &&\n                       !colspec[0]   && !oldcolspec[0])\n\n                     /* no filtering or binning specs for either file, so */\n                     /* this is a case where the same file is being reopened. */\n                     /* It doesn't matter if the extensions are different */\n\n                         ||   /* or */\n\n                     (!strcmp(rowfilter, oldrowfilter) &&\n                      !strcmp(binspec, oldbinspec)     &&\n                      !strcmp(colspec, oldcolspec)     &&\n                      !strcmp(extspec, oldextspec) ) )\n\n                     /* filtering specs are given and are identical, and */\n                     /* the same extension is specified */\n\n                 {\n                     if (mode == READWRITE && oldFptr->writemode == READONLY)\n                     {\n                       /*\n                         cannot assume that a file previously opened with READONLY\n                         can now be written to (e.g., files on CDROM, or over the\n                         the network, or STDIN), so return with an error.\n                       */\n\n                       ffpmsg(\n                   \"cannot reopen file READWRITE when previously opened READONLY\");\n                       ffpmsg(url);\n                       return(*status = FILE_NOT_OPENED);\n                     }\n                     iMatch = ii;\n\n                  }\n              }\n          } /* end if old file recognizes extended syntax */\n      } /* end if old fptr exists */\n    } /* end loop over NMAXFILES */\n    if (iMatch >= 0)\n    {\n       oldFptr = FptrTable[iMatch];\n       *fptr = (fitsfile *) calloc(1, sizeof(fitsfile));\n\n       if (!(*fptr))\n       {\n          ffpmsg(\n        \"failed to allocate structure for following file: (ffopen)\");\n          ffpmsg(url);\n          return(*status = MEMORY_ALLOCATION);\n       }\n\n       (*fptr)->Fptr = oldFptr; /* point to the structure */\n       (*fptr)->HDUposition = 0;     /* set initial position */\n       (((*fptr)->Fptr)->open_count)++;  /* increment usage counter */\n\n       if (binspec[0])  /* if binning specified, don't move */\n           extspec[0] = '\\0';\n\n       /* all the filtering has already been applied, so ignore */\n       rowfilter[0] = '\\0';\n       binspec[0] = '\\0';\n       colspec[0] = '\\0';\n\n       *isopen = 1;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint standardize_path(char *fullpath, int* status)\n{\n   /* Utility function for common operation in fits_already_open \n      fullpath:  I/O string to be standardized. Assume len = FLEN_FILENAME */\n    \n   char tmpPath[FLEN_FILENAME];\n   char cwd [FLEN_FILENAME];\n    \n   if (fits_path2url(fullpath, FLEN_FILENAME, tmpPath, status))\n      return(*status);\n   \n   if (tmpPath[0] != '/')\n   {\n      fits_get_cwd(cwd,status);\n      if (strlen(cwd) + strlen(tmpPath) + 1 > FLEN_FILENAME-1) {\n\t    ffpmsg(\"Tile name is too long. (standardize_path)\");\n            return(*status = FILE_NOT_OPENED);\n      }\n      strcat(cwd,\"/\");\n      strcat(cwd,tmpPath);\n      fits_clean_url(cwd,tmpPath,status);\n   }\n   \n   strcpy(fullpath, tmpPath);\n      \n   return (*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_is_this_a_copy(char *urltype) /* I - type of file */\n/*\n  specialized routine that returns 1 if the file is known to be a temporary\n  copy of the originally opened file.  Otherwise it returns 0.\n*/\n{\n  int iscopy;\n\n  if (!strncmp(urltype, \"mem\", 3) )\n     iscopy = 1;    /* file copy is in memory */\n  else if (!strncmp(urltype, \"compress\", 8) )\n     iscopy = 1;    /* compressed diskfile that is uncompressed in memory */\n  else if (!strncmp(urltype, \"http\", 4) )\n     iscopy = 1;    /* copied file using http protocol */\n  else if (!strncmp(urltype, \"ftp\", 3) )\n     iscopy = 1;    /* copied file using ftp protocol */\n  else if (!strncmp(urltype, \"gsiftp\", 6) )\n     iscopy = 1;    /* copied file using gsiftp protocol */\n  else if (!strncpy(urltype, \"stdin\", 5) )\n     iscopy = 1;    /* piped stdin has been copied to memory */\n  else\n     iscopy = 0;    /* file is not known to be a copy */\n \n    return(iscopy);\n}\n/*--------------------------------------------------------------------------*/\nstatic int find_quote(char **string)\n\n/*  \n    look for the closing single quote character in the input string\n*/\n{\n    char *tstr;\n\n    tstr = *string;\n\n    while (*tstr) {\n        if (*tstr == '\\'') { /* found the closing quote */\n           *string = tstr + 1;  /* set pointer to next char */\n           return(0); \n        } else {  /* skip over any other character */\n           tstr++;\n        }\n    }\n    return(1);  /* opps, didn't find the closing character */\n}\n/*--------------------------------------------------------------------------*/\nstatic int find_doublequote(char **string)\n\n/*  \n    look for the closing double quote character in the input string\n*/\n{\n    char *tstr;\n\n    tstr = *string;\n\n    while (*tstr) {\n        if (*tstr == '\"') { /* found the closing quote */\n           *string = tstr + 1;  /* set pointer to next char */\n           return(0); \n        } else {  /* skip over any other character */\n           tstr++;\n        }\n    }\n    return(1);  /* opps, didn't find the closing character */\n}\n\n/*--------------------------------------------------------------------------*/\nstatic int find_paren(char **string)\n\n/*  \n    look for the closing parenthesis character in the input string\n*/\n{\n    char *tstr;\n\n    tstr = *string;\n\n    while (*tstr) {\n\n        if (*tstr == ')') { /* found the closing parens */\n           *string = tstr + 1;  /* set pointer to next char */\n           return(0); \n        } else if (*tstr == '(') { /* found another level of parens */\n           tstr++;\n           if (find_paren(&tstr)) return(1); \n        } else if (*tstr == '[') { \n           tstr++;\n           if (find_bracket(&tstr)) return(1);\n        } else if (*tstr == '{') { \n           tstr++;\n           if (find_curlybracket(&tstr)) return(1);\n        } else if (*tstr == '\"') { \n           tstr++;\n           if (find_doublequote(&tstr)) return(1);\n        } else if (*tstr == '\\'') { \n           tstr++;\n           if (find_quote(&tstr)) return(1);\n        } else { \n           tstr++;\n        }\n    }\n    return(1);  /* opps, didn't find the closing character */\n}\n/*--------------------------------------------------------------------------*/\nstatic int find_bracket(char **string)\n\n/*  \n    look for the closing bracket character in the input string\n*/\n{\n    char *tstr;\n\n    tstr = *string;\n\n    while (*tstr) {\n        if (*tstr == ']') { /* found the closing bracket */\n           *string = tstr + 1;  /* set pointer to next char */\n           return(0); \n        } else if (*tstr == '(') { /* found another level of parens */\n           tstr++;\n           if (find_paren(&tstr)) return(1); \n        } else if (*tstr == '[') { \n           tstr++;\n           if (find_bracket(&tstr)) return(1);\n        } else if (*tstr == '{') { \n           tstr++;\n           if (find_curlybracket(&tstr)) return(1);\n        } else if (*tstr == '\"') { \n           tstr++;\n           if (find_doublequote(&tstr)) return(1);\n        } else if (*tstr == '\\'') { \n           tstr++;\n           if (find_quote(&tstr)) return(1);\n        } else { \n           tstr++;\n        }\n    }\n    return(1);  /* opps, didn't find the closing character */\n}\n/*--------------------------------------------------------------------------*/\nstatic int find_curlybracket(char **string)\n\n/*  \n    look for the closing curly bracket character in the input string\n*/\n{\n    char *tstr;\n\n    tstr = *string;\n\n    while (*tstr) {\n        if (*tstr == '}') { /* found the closing curly bracket */\n           *string = tstr + 1;  /* set pointer to next char */\n           return(0); \n        } else if (*tstr == '(') { /* found another level of parens */\n           tstr++;\n           if (find_paren(&tstr)) return(1); \n        } else if (*tstr == '[') { \n           tstr++;\n           if (find_bracket(&tstr)) return(1);\n        } else if (*tstr == '{') { \n           tstr++;\n           if (find_curlybracket(&tstr)) return(1);\n        } else if (*tstr == '\"') { \n           tstr++;\n           if (find_doublequote(&tstr)) return(1);\n        } else if (*tstr == '\\'') { \n           tstr++;\n           if (find_quote(&tstr)) return(1);\n        } else { \n           tstr++;\n        }\n    }\n    return(1);  /* opps, didn't find the closing character */\n}\n/*--------------------------------------------------------------------------*/\nint comma2semicolon(char *string)\n\n/*  \n    replace commas with semicolons, unless the comma is within a quoted or bracketed expression \n*/\n{\n    char *tstr;\n\n    tstr = string;\n\n    while (*tstr) {\n\n        if (*tstr == ',') { /* found a comma */\n           *tstr = ';';\n           tstr++;\n        } else if (*tstr == '(') { /* found another level of parens */\n           tstr++;\n           if (find_paren(&tstr)) return(1); \n        } else if (*tstr == '[') { \n           tstr++;\n           if (find_bracket(&tstr)) return(1);\n        } else if (*tstr == '{') { \n           tstr++;\n           if (find_curlybracket(&tstr)) return(1);\n        } else if (*tstr == '\"') { \n           tstr++;\n           if (find_doublequote(&tstr)) return(1);\n        } else if (*tstr == '\\'') { \n           tstr++;\n           if (find_quote(&tstr)) return(1);\n        } else { \n           tstr++;\n        }\n    }\n    return(0);  /* reached end of string */\n}\n/*--------------------------------------------------------------------------*/\nint ffedit_columns(\n           fitsfile **fptr,  /* IO - pointer to input table; on output it  */\n                             /*      points to the new selected rows table */\n           char *outfile,    /* I - name for output file */\n           char *expr,       /* I - column edit expression    */\n           int *status)\n/*\n   modify columns in a table and/or header keywords in the HDU\n*/\n{\n    fitsfile *newptr;\n    int ii, hdunum, slen, colnum = -1, testnum, deletecol = 0, savecol = 0;\n    int numcols = 0, *colindex = 0, tstatus = 0;\n    char *tstbuff=0, *cptr, *cptr2, *cptr3, *clause = NULL, keyname[FLEN_KEYWORD];\n    char colname[FLEN_VALUE], oldname[FLEN_VALUE], colformat[FLEN_VALUE];\n    char *file_expr = NULL, testname[FLEN_VALUE], card[FLEN_CARD];\n\n    if (*outfile)\n    {\n      /* create new empty file in to hold the selected rows */\n      if (ffinit(&newptr, outfile, status) > 0)\n      {\n        ffpmsg(\"failed to create file for copy (ffedit_columns)\");\n        return(*status);\n      }\n\n      fits_get_hdu_num(*fptr, &hdunum);  /* current HDU number in input file */\n\n      /* copy all HDUs to the output copy, if the 'only_one' flag is not set */\n      if (!((*fptr)->Fptr)->only_one) {\n        for (ii = 1; 1; ii++)\n        {\n          if (fits_movabs_hdu(*fptr, ii, NULL, status) > 0)\n            break;\n\n          fits_copy_hdu(*fptr, newptr, 0, status);\n        }\n\n        if (*status == END_OF_FILE)\n        {\n          *status = 0;              /* got the expected EOF error; reset = 0  */\n        }\n        else if (*status > 0)\n        {\n          ffclos(newptr, status);\n          ffpmsg(\"failed to copy all HDUs from input file (ffedit_columns)\");\n          return(*status);\n        }\n\n\n      } else {\n        /* only copy the primary array and the designated table extension */\n\tfits_movabs_hdu(*fptr, 1, NULL, status);\n\tfits_copy_hdu(*fptr, newptr, 0, status);\n\tfits_movabs_hdu(*fptr, hdunum, NULL, status);\n\tfits_copy_hdu(*fptr, newptr, 0, status);\n        if (*status > 0)\n        {\n          ffclos(newptr, status);\n          ffpmsg(\"failed to copy all HDUs from input file (ffedit_columns)\");\n          return(*status);\n        }\n        hdunum = 2;\n      }\n\n      /* close the original file and return ptr to the new image */\n      ffclos(*fptr, status);\n\n      *fptr = newptr; /* reset the pointer to the new table */\n\n      /* move back to the selected table HDU */\n      if (fits_movabs_hdu(*fptr, hdunum, NULL, status) > 0)\n      {\n         ffpmsg(\"failed to copy the input file (ffedit_columns)\");\n         return(*status);\n      }\n    }\n\n    /* remove the \"col \" from the beginning of the column edit expression */\n    cptr = expr + 4;\n\n    while (*cptr == ' ')\n         cptr++;         /* skip leading white space */\n   \n    /* Check if need to import expression from a file */\n\n    if( *cptr=='@' ) {\n       if( ffimport_file( cptr+1, &file_expr, status ) ) return(*status);\n       cptr = file_expr;\n       while (*cptr == ' ')\n          cptr++;         /* skip leading white space... again */\n    }\n\n    tstatus = 0;\n    ffgncl(*fptr, &numcols, &tstatus);  /* get initial # of cols */\n\n    /* as of July 2012, the CFITSIO column filter syntax was modified */\n    /* so that commas may be used to separate clauses, as well as semi-colons. */\n    /* This was done because users cannot enter the semi-colon in the HEASARC's */\n    /* Hera on-line data processing system for computer security reasons.  */\n    /* Therefore, we must convert those commas back to semi-colons here, but we */\n    /* must not convert any columns that occur within parenthesies.  */\n\n    if (comma2semicolon(cptr)) {\n         ffpmsg(\"parsing error in column filter expression\");\n         ffpmsg(cptr);\n         if( file_expr ) free( file_expr );\n         *status = PARSE_SYNTAX_ERR;\n         return(*status);\n    }\n\n    /* parse expression and get first clause, if more than 1 */\n    while ((slen = fits_get_token2(&cptr, \";\", &clause, NULL, status)) > 0 )\n    {\n        if( *cptr==';' ) cptr++;\n        clause[slen] = '\\0';\n\n        if (clause[0] == '!' || clause[0] == '-')\n        {\n\t    char *clause1 = clause+1;\n\t    int clen = clause1[0] ? strlen(clause1) : 0;\n            /* ===================================== */\n            /* Case I. delete this column or keyword */\n            /* ===================================== */\n\n\t    /* Case Ia. delete column names with 0-or-more wildcard\n\t            -COLNAME+ - delete repeated columns with exact name\n\t\t    -COLNAM*+ - delete columns matching patterns\n\t    */\n\t    if (*status == 0 &&\n\t\tclen > 1 && clause1[0] != '#' &&\n\t\tclause1[clen-1] == '+') {\n\n\t      clause1[clen-1] = 0; clen--;\n\n\t      /* Note that this is a delete 0 or more specification,\n\t\t which means that no matching columns is not an error. */\n\t      do {\n\t\tint status_del = 0;\n\n\t\t/* Have to set status=0 so we can reset the search at\n\t\t   start column.  Because we are deleting columns on\n\t\t   the fly here, we have to reset the search every\n\t\t   time. The only penalty here is execution time\n\t\t   because leaving *status == COL_NOT_UNIQUE is merely\n\t\t   an optimization for tables assuming the tables do\n\t\t   not change from one call to the next. (an\n\t\t   assumption broken in this loop) */\n\t\t*status = 0; \n\t\tffgcno(*fptr, CASEINSEN, clause1, &colnum, status);\n\t\t/* ffgcno returns COL_NOT_UNIQUE if there are multiple columns,\n\t\t   and COL_NOT_FOUND after the last column is found, and \n\t\t   COL_NOT_FOUND if no matches were found */\n\t\tif (*status != 0 && *status != COL_NOT_UNIQUE) break;\n\t\t\n                if (ffdcol(*fptr, colnum, &status_del) > 0) {\n\t\t  ffpmsg(\"failed to delete column in input file:\");\n\t\t  ffpmsg(clause);\n\t\t  if( colindex ) free( colindex );\n\t\t  if( file_expr ) free( file_expr );\n\t\t  if( clause ) free(clause);\n\t\t  return (*status = status_del);\n\t\t}\n                deletecol = 1; /* set flag that at least one col was deleted */\n                numcols--;\n\t      } while (*status == COL_NOT_UNIQUE);\n\n\t      *status = 0; /* No matches are still successful */\n\t      colnum = -1; /* Ignore the column we found */\n\n\t    /* Case Ib. delete column names with wildcard or not\n\t            -COLNAME  - deleted exact column\n\t\t    -COLNAM*  - delete first column that matches pattern\n\t       Note no leading '#'\n\t    */\n\t    } else if (clause1[0] && clause1[0] != '#' &&\n\t\t       ((ffgcno(*fptr, CASEINSEN, clause1, &colnum, status) <= 0) ||\n\t\t\t*status == COL_NOT_UNIQUE))\n            {\n                /* a column with this name exists, so try to delete it */\n\t        *status = 0; /* Clear potential status=COL_NOT_UNIQUE */\n                if (ffdcol(*fptr, colnum, status) > 0)\n                {\n                    ffpmsg(\"failed to delete column in input file:\");\n                    ffpmsg(clause);\n                    if( colindex ) free( colindex );\n                    if( file_expr ) free( file_expr );\n\t\t    if( clause ) free(clause);\n                    return(*status);\n                }\n                deletecol = 1; /* set flag that at least one col was deleted */\n                numcols--;\n                colnum = -1;\n            }\n\t    /* Case Ic. delete keyword(s)\n\t            -KEYNAME,#KEYNAME  - delete exact keyword (first match)\n\t\t    -KEYNAM*,#KEYNAM*  - delete first matching keyword\n\t\t    -KEYNAME+,-#KEYNAME+ - delete 0-or-more exact matches of exact keyword\n\t\t    -KEYNAM*+,-#KEYNAM*+ - delete 0-or-more wildcard matches \n\t       Note the preceding # is optional if no conflicting column name exists\n\t       and that wildcard patterns are described in \"colfilter\" section of\n\t       documentation.\n\t    */\n            else\n            {\n\t      int delall = 0;\n\t      int haswild = 0;\n\t        ffcmsg();   /* clear previous error message from ffgcno */\n                /* try deleting a keyword with this name */\n                *status = 0;\n\t\t/* skip past leading '#' if any */\n\t\tif (clause1[0] == '#') clause1++;\n\t\tclen = strlen(clause1);\n\n\t\t/* Repeat deletion of keyword if requested with trailing '+' */\n\t\tif (clen > 1 && clause1[clen-1] == '+') {\n\t\t  delall = 1;\n\t\t  clause1[clen-1] = 0;\n\t\t}\n\t\t/* Determine if this pattern has wildcards */\n\t\tif (strchr(clause1,'?') || strchr(clause1,'*') || strchr(clause1,'#')) {\n\t\t  haswild = 1;\n\t\t}\n\n\t\tif (haswild) {\n\t\t  /* ffdkey() behaves differently if the pattern has a wildcard:\n\t\t     it only checks from the \"current\" header position to the end, and doesn't\n\t\t     check before the \"current\" header position.  Therefore, for the\n\t\t     case of wildcards we will have to reset to the beginning. */\n\t\t  ffmaky(*fptr, 1, status);  /* reset pointer to beginning of header */\n\t\t}\n\n\t\t/* Single or repeated deletions until done */\n\t\tdo {\n\t\t  if (ffdkey(*fptr, clause1, status) > 0)\n\t\t    {\n\t\t      if (delall && *status == KEY_NO_EXIST) {\n\t\t\t/* Found last wildcard item. Stop deleting */\n\t\t\tffcmsg();\n\t\t\t*status = 0;\n\t\t\tdelall = 0; /* Force end of this loop */\n\t\t      } else {\n\t\t\t/* This was not a wildcard deletion, or it resulted in\n\t\t\t   another kind of error */\n\t\t\tffpmsg(\"column or keyword to be deleted does not exist:\");\n\t\t\tffpmsg(clause1);\n\t\t\tif( colindex ) free( colindex );\n\t\t\tif( file_expr ) free( file_expr );\n\t\t\tif( clause ) free(clause);\n\t\t\treturn(*status);\n\t\t      }\n\t\t    }\n\t\t} while(delall); /* end do{} */\n            }\n        }\n        else\n        {\n            /* ===================================================== */\n            /* Case II:\n\t       this is either a column name, (case 1) \n\n               or a new column name followed by double = (\"==\") followed\n               by the old name which is to be renamed. (case 2A)\n\n               or a column or keyword name followed by a single \"=\" and a\n\t       calculation expression (case 2B) */\n            /* ===================================================== */\n            cptr2 = clause;\n            slen = fits_get_token2(&cptr2, \"( =\", &tstbuff, NULL, status);\n\n            if (slen == 0 || *status)\n            {\n                ffpmsg(\"error: column or keyword name is blank (ffedit_columns):\");\n                ffpmsg(clause);\n                if( colindex ) free( colindex );\n                if( file_expr ) free( file_expr );\n\t\tif (clause) free(clause);\n                if (*status==0)\n                   *status=URL_PARSE_ERROR;\n                return(*status);\n            }\n            if (strlen(tstbuff) > FLEN_VALUE-1)\n            {\n                ffpmsg(\"error: column or keyword name is too long (ffedit_columns):\");\n                ffpmsg(clause);\n                if( colindex ) free( colindex );\n                if( file_expr ) free( file_expr );\n\t\tif (clause) free(clause);\n                free(tstbuff);\n                return(*status= URL_PARSE_ERROR);\n            }\n            strcpy(colname, tstbuff);\n            free(tstbuff);\n            tstbuff=0;\n\n\t    /* If this is a keyword of the form \n\t         #KEYWORD# \n\t       then transform to the form\n\t         #KEYWORDn\n\t       where n is the previously used column number \n\t    */\n\t    if (colname[0] == '#' &&\n\t\tstrstr(colname+1, \"#\") == (colname + strlen(colname) - 1)) \n\t    {\n\t\tif (colnum <= 0) \n\t\t  {\n\t\t    ffpmsg(\"The keyword name:\");\n\t\t    ffpmsg(colname);\n\t\t    ffpmsg(\"is invalid unless a column has been previously\");\n\t\t    ffpmsg(\"created or editted by a calculator command\");\n                    if( file_expr ) free( file_expr );\n\t\t    if (clause) free(clause);\n\t\t    return(*status = URL_PARSE_ERROR);\n\t\t  }\n\t\tcolname[strlen(colname)-1] = '\\0';\n\t\t/* Make keyword name and put it in oldname */\n\t\tffkeyn(colname+1, colnum, oldname, status);\n\t\tif (*status) return (*status);\n\t\t/* Re-copy back into colname */\n\t\tstrcpy(colname+1,oldname);\n\t    }\n            else if  (strstr(colname, \"#\") == (colname + strlen(colname) - 1)) \n\t    {\n\t        /*  colname is of the form \"NAME#\";  if\n\t\t      a) colnum is defined, and\n\t\t      b) a column with literal name \"NAME#\" does not exist, and\n\t\t      c) a keyword with name \"NAMEn\" (where n=colnum) exists, then\n\t\t    transfrom the colname string to \"NAMEn\", otherwise\n\t\t    do nothing.\n\t\t*/\n\t\tif (colnum > 0) {  /* colnum must be defined */\n\t\t  tstatus = 0;\n                  ffgcno(*fptr, CASEINSEN, colname, &testnum, &tstatus);\n\t\t  if (tstatus != 0 && tstatus != COL_NOT_UNIQUE) \n\t\t  {  \n\t\t    /* OK, column doesn't exist, now see if keyword exists */\n\t\t    ffcmsg();   /* clear previous error message from ffgcno */\n\t\t    strcpy(testname, colname);\n \t\t    testname[strlen(testname)-1] = '\\0';\n\t\t    /* Make keyword name and put it in oldname */\n\t\t    ffkeyn(testname, colnum, oldname, status);\n\t\t    if (*status) {\n                      if( file_expr ) free( file_expr );\n\t\t      if (clause) free(clause);\n\t\t      return (*status);\n\t\t    }\n\n\t\t    tstatus = 0;\n\t\t    if (!fits_read_card(*fptr, oldname, card, &tstatus)) {\n\t\t      /* Keyword does exist; copy real name back into colname */\n\t\t      strcpy(colname,oldname);\n\t\t    }\n\t\t  }\n                }\n\t    }\n\n            /* if we encountered an opening parenthesis, then we need to */\n            /* find the closing parenthesis, and concatinate the 2 strings */\n            /* This supports expressions like:\n                [col #EXTNAME(Extension name)=\"GTI\"]\n            */\n            if (*cptr2  == '(')\n            {\n                if (fits_get_token2(&cptr2, \")\", &tstbuff, NULL, status)==0)\n                {\n                   strcat(colname,\")\");\n                }\n                else\n                {\n                   if ((strlen(tstbuff) + strlen(colname) + 1) >\n                        FLEN_VALUE-1)\n                   {\n                      ffpmsg(\"error: column name is too long (ffedit_columns):\");\n                      if( file_expr ) free( file_expr );\n\t\t      if (clause) free(clause);\n                      free(tstbuff);\n                      *status=URL_PARSE_ERROR;\n\t\t      return (*status);\n                   }\n                   strcat(colname, tstbuff);\n                   strcat(colname, \")\");\n                   free(tstbuff);\n                   tstbuff=0;\n                }\n                cptr2++;\n            }\n\n            while (*cptr2 == ' ')\n                 cptr2++;         /* skip white space */\n\n            if (*cptr2 != '=')\n            {\n              /* ------------------------------------ */\n              /* case 1 - simply the name of a column */\n              /* ------------------------------------ */\n\n              /* look for matching column */\n              ffgcno(*fptr, CASEINSEN, colname, &testnum, status);\n\t      \n              while (*status == COL_NOT_UNIQUE) \n              {\n                 /* the column name contained wild cards, and it */\n                 /* matches more than one column in the table. */\n\t\t \n\t\t colnum = testnum;\n\n                 /* keep this column in the output file */\n                 savecol = 1;\n\n                 if (!colindex)\n                    colindex = (int *) calloc(999, sizeof(int));\n\n                 colindex[colnum - 1] = 1;  /* flag this column number */\n\n                 /* look for other matching column names */\n                 ffgcno(*fptr, CASEINSEN, colname, &testnum, status);\n\n                 if (*status == COL_NOT_FOUND)\n                    *status = 999;  /* temporary status flag value */\n              }\n\n              if (*status <= 0)\n              {\n\t         colnum = testnum;\n\t\t \n                 /* keep this column in the output file */\n                 savecol = 1;\n\n                 if (!colindex)\n                    colindex = (int *) calloc(999, sizeof(int));\n\n                 colindex[colnum - 1] = 1;  /* flag this column number */\n              }\n              else if (*status == 999)\n              {\n                  /* this special flag value does not represent an error */\n                  *status = 0;  \n              }\n              else\n              {\n               ffpmsg(\"Syntax error in columns specifier in input URL:\");\n               ffpmsg(cptr2);\n               if( colindex ) free( colindex );\n               if( file_expr ) free( file_expr );\n\t       if (clause) free(clause);\n               return(*status = URL_PARSE_ERROR);\n              }\n            }\n            else\n            {\n              /* ----------------------------------------------- */\n              /* case 2 where the token ends with an equals sign */\n              /* ----------------------------------------------- */\n\n              cptr2++;   /* skip over the first '=' */\n\n              if (*cptr2 == '=')\n              {\n                /*................................................. */\n                /*  Case A:  rename a column or keyword;  syntax is\n                    \"new_name == old_name\"  */\n                /*................................................. */\n\n                cptr2++;  /* skip the 2nd '=' */\n                while (*cptr2 == ' ')\n                      cptr2++;       /* skip white space */\n\n                if (fits_get_token2(&cptr2, \" \", &tstbuff, NULL, status)==0)\n                {\n                   oldname[0]=0;\n                }\n                else\n                {\n                   if (strlen(tstbuff) > FLEN_VALUE-1)\n                   {\n                      ffpmsg(\"error: column name syntax is too long (ffedit_columns):\");\n                      if( file_expr ) free( file_expr );\n\t\t      if (clause) free(clause);\n                      free(tstbuff);\n                      *status=URL_PARSE_ERROR;\n\t\t      return (*status);\n                   }\n                   strcpy(oldname, tstbuff);\n                   free(tstbuff);\n                   tstbuff=0;\n                }\n                /* get column number of the existing column */\n                if (ffgcno(*fptr, CASEINSEN, oldname, &colnum, status) <= 0)\n                {\n                    /* modify the TTYPEn keyword value with the new name */\n                    ffkeyn(\"TTYPE\", colnum, keyname, status);\n\n                    if (ffmkys(*fptr, keyname, colname, NULL, status) > 0)\n                    {\n                      ffpmsg(\"failed to rename column in input file\");\n                      ffpmsg(\" oldname =\");\n                      ffpmsg(oldname);\n                      ffpmsg(\" newname =\");\n                      ffpmsg(colname);\n                      if( colindex ) free( colindex );\n                      if( file_expr ) free( file_expr );\n\t              if (clause) free(clause);\n                      return(*status);\n                    }\n                    /* keep this column in the output file */\n                    savecol = 1;\n                    if (!colindex)\n                       colindex = (int *) calloc(999, sizeof(int));\n\n                    colindex[colnum - 1] = 1;  /* flag this column number */\n                }\n                else\n                {\n                    /* try renaming a keyword */\n\t\t    ffcmsg();   /* clear error message stack */\n                    *status = 0;\n                    if (ffmnam(*fptr, oldname, colname, status) > 0)\n                    {\n                      ffpmsg(\"column or keyword to be renamed does not exist:\");\n                        ffpmsg(clause);\n                        if( colindex ) free( colindex );\n                        if( file_expr ) free( file_expr );\n\t\t\tif (clause) free(clause);\n                        return(*status);\n                    }\n                }\n              }  \n              else\n              {\n                /*...................................................... */\n                /* Case B: */\n                /* this must be a general column/keyword calc expression */\n                /* \"name = expression\" or \"colname(TFORM) = expression\" */\n                /*...................................................... */\n\n                /* parse the name and TFORM values, if present */\n                colformat[0] = '\\0';\n                cptr3 = colname;\n\n                if (fits_get_token2(&cptr3, \"(\", &tstbuff, NULL, status)==0)\n                {\n                   oldname[0]=0;\n                }\n                else\n                {\n                   if (strlen(tstbuff) > FLEN_VALUE-1)\n                   {\n                         ffpmsg(\"column expression is too long (ffedit_columns)\");\n                         if( colindex ) free( colindex );\n                         if( file_expr ) free( file_expr );\n\t\t         if (clause) free(clause);\n                         free(tstbuff);\n                         *status=URL_PARSE_ERROR;\n                         return(*status);\n                   }\n                   strcpy(oldname, tstbuff);\n                   free(tstbuff);\n                   tstbuff=0;\n                }\n                if (cptr3[0] == '(' )\n                {\n                   cptr3++;  /* skip the '(' */\n                   if (fits_get_token2(&cptr3, \")\", &tstbuff, NULL, status)==0)\n                   {\n                      colformat[0]=0;\n                   }\n                   else\n                   {\n                      if (strlen(tstbuff) > FLEN_VALUE-1)\n                      {\n                            ffpmsg(\"column expression is too long (ffedit_columns)\");\n                            if( colindex ) free( colindex );\n                            if( file_expr ) free( file_expr );\n\t\t            if (clause) free(clause);\n                            free(tstbuff);\n                            *status=URL_PARSE_ERROR;\n                            return(*status);\n                      }\n                      strcpy(colformat, tstbuff);\n                      free(tstbuff);\n                      tstbuff=0;\n                   }\n                }\n\n                /* calculate values for the column or keyword */\n                /*   cptr2 = the expression to be calculated */\n                /*   oldname = name of the column or keyword */\n                /*   colformat = column format, or keyword comment string */\n                if (fits_calculator(*fptr, cptr2, *fptr, oldname, colformat,\n       \t                        status) > 0) {\n\t\t\t\t\n                        ffpmsg(\"Unable to calculate expression\");\n                        if( colindex ) free( colindex );\n                        if( file_expr ) free( file_expr );\n\t\t\tif (clause) free(clause);\n                         return(*status);\n                }\n\n                /* test if this is a column and not a keyword */\n                tstatus = 0;\n                ffgcno(*fptr, CASEINSEN, oldname, &testnum, &tstatus);\n                if (tstatus == 0)\n                {\n                    /* keep this column in the output file */\n\t\t    colnum = testnum;\n                    savecol = 1;\n\n                    if (!colindex)\n                      colindex = (int *) calloc(999, sizeof(int));\n\n                    colindex[colnum - 1] = 1;\n                    if (colnum > numcols)numcols++;\n                }\n\t\telse\n\t\t{\n\t\t   ffcmsg();  /* clear the error message stack */\n\t\t}\n              }\n            }\n        }\n\tif (clause) free(clause);  /* free old clause before getting new one */\n        clause = NULL;\n    }\n\n    if (savecol && !deletecol)\n    {\n       /* need to delete all but the specified columns */\n       for (ii = numcols; ii > 0; ii--)\n       {\n         if (!colindex[ii-1])  /* delete this column */\n         {\n           if (ffdcol(*fptr, ii, status) > 0)\n           {\n             ffpmsg(\"failed to delete column in input file:\");\n             ffpmsg(clause);\n             if( colindex ) free( colindex );\n             if( file_expr ) free( file_expr );\n\t     if (clause) free(clause);\n             return(*status);\n           }\n         }\n       }\n    }\n\n    if( colindex ) free( colindex );\n    if( file_expr ) free( file_expr );\n    if (clause) free(clause);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_copy_cell2image(\n\t   fitsfile *fptr,   /* I - point to input table */\n\t   fitsfile *newptr, /* O - existing output file; new image HDU\n\t\t\t\t    will be appended to it */\n           char *colname,    /* I - column name / number containing the image*/\n           long rownum,      /* I - number of the row containing the image */\n           int *status)      /* IO - error status */\n\n/*\n  Copy a table cell of a given row and column into an image extension.\n  The output file must already have been created.  A new image\n  extension will be created in that file.\n  \n  This routine was written by Craig Markwardt, GSFC\n*/\n\n{\n    unsigned char buffer[30000];\n    int hdutype, colnum, typecode, bitpix, naxis, maxelem, tstatus;\n    LONGLONG naxes[9], nbytes, firstbyte, ntodo;\n    LONGLONG repeat, startpos, elemnum, rowlen, tnull;\n    long twidth, incre;\n    double scale, zero;\n    char tform[20];\n    char card[FLEN_CARD];\n    char templt[FLEN_CARD] = \"\";\n\n    /* Table-to-image keyword translation table  */\n    /*                        INPUT      OUTPUT  */\n    /*                       01234567   01234567 */\n    char *patterns[][2] = {{\"TSCALn\",  \"BSCALE\"  },  /* Standard FITS keywords */\n\t\t\t   {\"TZEROn\",  \"BZERO\"   },\n\t\t\t   {\"TUNITn\",  \"BUNIT\"   },\n\t\t\t   {\"TNULLn\",  \"BLANK\"   },\n\t\t\t   {\"TDMINn\",  \"DATAMIN\" },\n\t\t\t   {\"TDMAXn\",  \"DATAMAX\" },\n\t\t\t   {\"iCTYPn\",  \"CTYPEi\"  },  /* Coordinate labels */\n\t\t\t   {\"iCTYna\",  \"CTYPEia\" },\n\t\t\t   {\"iCUNIn\",  \"CUNITi\"  },  /* Coordinate units */\n\t\t\t   {\"iCUNna\",  \"CUNITia\" },\n\t\t\t   {\"iCRVLn\",  \"CRVALi\"  },  /* WCS keywords */\n\t\t\t   {\"iCRVna\",  \"CRVALia\" },\n\t\t\t   {\"iCDLTn\",  \"CDELTi\"  },\n\t\t\t   {\"iCDEna\",  \"CDELTia\" },\n\t\t\t   {\"iCRPXn\",  \"CRPIXi\"  },\n\t\t\t   {\"iCRPna\",  \"CRPIXia\" },\n\t\t\t   {\"ijPCna\",  \"PCi_ja\"  },\n\t\t\t   {\"ijCDna\",  \"CDi_ja\"  },\n\t\t\t   {\"iVn_ma\",  \"PVi_ma\"  },\n\t\t\t   {\"iSn_ma\",  \"PSi_ma\"  },\n\t\t\t   {\"iCRDna\",  \"CRDERia\" },\n\t\t\t   {\"iCSYna\",  \"CSYERia\" },\n\t\t\t   {\"iCROTn\",  \"CROTAi\"  },\n\t\t\t   {\"WCAXna\",  \"WCSAXESa\"},\n\t\t\t   {\"WCSNna\",  \"WCSNAMEa\"},\n\n\t\t\t   {\"LONPna\",  \"LONPOLEa\"},\n\t\t\t   {\"LATPna\",  \"LATPOLEa\"},\n\t\t\t   {\"EQUIna\",  \"EQUINOXa\"},\n\t\t\t   {\"MJDOBn\",  \"MJD-OBS\" },\n\t\t\t   {\"MJDAn\",   \"MJD-AVG\" },\n\t\t\t   {\"RADEna\",  \"RADESYSa\"},\n\t\t\t   {\"iCNAna\",  \"CNAMEia\" },\n\t\t\t   {\"DAVGn\",   \"DATE-AVG\"},\n\n                           /* Delete table keywords related to other columns */\n\t\t\t   {\"T????#a\", \"-\"       }, \n \t\t\t   {\"TC??#a\",  \"-\"       },\n \t\t\t   {\"TWCS#a\",  \"-\"       },\n\t\t\t   {\"TDIM#\",   \"-\"       }, \n\t\t\t   {\"iCTYPm\",  \"-\"       },\n\t\t\t   {\"iCUNIm\",  \"-\"       },\n\t\t\t   {\"iCRVLm\",  \"-\"       },\n\t\t\t   {\"iCDLTm\",  \"-\"       },\n\t\t\t   {\"iCRPXm\",  \"-\"       },\n\t\t\t   {\"iCTYma\",  \"-\"       },\n\t\t\t   {\"iCUNma\",  \"-\"       },\n\t\t\t   {\"iCRVma\",  \"-\"       },\n\t\t\t   {\"iCDEma\",  \"-\"       },\n\t\t\t   {\"iCRPma\",  \"-\"       },\n\t\t\t   {\"ijPCma\",  \"-\"       },\n\t\t\t   {\"ijCDma\",  \"-\"       },\n\t\t\t   {\"iVm_ma\",  \"-\"       },\n\t\t\t   {\"iSm_ma\",  \"-\"       },\n\t\t\t   {\"iCRDma\",  \"-\"       },\n\t\t\t   {\"iCSYma\",  \"-\"       },\n\t\t\t   {\"iCROTm\",  \"-\"       },\n\t\t\t   {\"WCAXma\",  \"-\"       },\n\t\t\t   {\"WCSNma\",  \"-\"       },\n\n\t\t\t   {\"LONPma\",  \"-\"       },\n\t\t\t   {\"LATPma\",  \"-\"       },\n\t\t\t   {\"EQUIma\",  \"-\"       },\n\t\t\t   {\"MJDOBm\",  \"-\"       },\n\t\t\t   {\"MJDAm\",   \"-\"       },\n\t\t\t   {\"RADEma\",  \"-\"       },\n\t\t\t   {\"iCNAma\",  \"-\"       },\n\t\t\t   {\"DAVGm\",   \"-\"       },\n\n\t\t\t   {\"EXTNAME\", \"-\"       },  /* Remove structural keywords*/\n\t\t\t   {\"EXTVER\",  \"-\"       },\n\t\t\t   {\"EXTLEVEL\",\"-\"       },\n\t\t\t   {\"CHECKSUM\",\"-\"       },\n\t\t\t   {\"DATASUM\", \"-\"       },\n\t\t\t   \n\t\t\t   {\"*\",       \"+\"       }}; /* copy all other keywords */\n    int npat;\n\n    if (*status > 0)\n        return(*status);\n\n    /* get column number */\n    if (ffgcno(fptr, CASEINSEN, colname, &colnum, status) > 0)\n    {\n        ffpmsg(\"column containing image in table cell does not exist:\");\n        ffpmsg(colname);\n        return(*status);\n    }\n\n    /*---------------------------------------------------*/\n    /*  Check input and get parameters about the column: */\n    /*---------------------------------------------------*/\n    if ( ffgcprll(fptr, colnum, rownum, 1L, 1L, 0, &scale, &zero,\n         tform, &twidth, &typecode, &maxelem, &startpos, &elemnum, &incre,\n         &repeat, &rowlen, &hdutype, &tnull, (char *) buffer, status) > 0 )\n         return(*status);\n\n     /* get the actual column name, in case a column number was given */\n    ffkeyn(\"\", colnum, templt, &tstatus);\n    ffgcnn(fptr, CASEINSEN, templt, colname, &colnum, &tstatus);\n\n    if (hdutype != BINARY_TBL)\n    {\n        ffpmsg(\"This extension is not a binary table.\");\n        ffpmsg(\" Cannot open the image in a binary table cell.\");\n        return(*status = NOT_BTABLE);\n    }\n\n    if (typecode < 0)\n    {\n        /* variable length array */\n        typecode *= -1;  \n\n        /* variable length arrays are 1-dimensional by default */\n        naxis = 1;\n        naxes[0] = repeat;\n    }\n    else\n    {\n        /* get the dimensions of the image */\n        ffgtdmll(fptr, colnum, 9, &naxis, naxes, status);\n    }\n\n    if (*status > 0)\n    {\n        ffpmsg(\"Error getting the dimensions of the image\");\n        return(*status);\n    }\n\n    /* determine BITPIX value for the image */\n    if (typecode == TBYTE)\n    {\n        bitpix = BYTE_IMG;\n        nbytes = repeat;\n    }\n    else if (typecode == TSHORT)\n    {\n        bitpix = SHORT_IMG;\n        nbytes = repeat * 2;\n    }\n    else if (typecode == TLONG)\n    {\n        bitpix = LONG_IMG;\n        nbytes = repeat * 4;\n    }\n    else if (typecode == TFLOAT)\n    {\n        bitpix = FLOAT_IMG;\n        nbytes = repeat * 4;\n    }\n    else if (typecode == TDOUBLE)\n    {\n        bitpix = DOUBLE_IMG;\n        nbytes = repeat * 8;\n    }\n    else if (typecode == TLONGLONG)\n    {\n        bitpix = LONGLONG_IMG;\n        nbytes = repeat * 8;\n    }\n    else if (typecode == TLOGICAL)\n    {\n        bitpix = BYTE_IMG;\n        nbytes = repeat;\n    }\n    else\n    {\n        ffpmsg(\"Error: the following image column has invalid datatype:\");\n        ffpmsg(colname);\n        ffpmsg(tform);\n        ffpmsg(\"Cannot open an image in a single row of this column.\");\n        return(*status = BAD_TFORM);\n    }\n\n    /* create new image in output file */\n    if (ffcrimll(newptr, bitpix, naxis, naxes, status) > 0)\n    {\n        ffpmsg(\"failed to write required primary array keywords in the output file\");\n        return(*status);\n    }\n\n    npat = sizeof(patterns)/sizeof(patterns[0][0])/2;\n    \n    /* skip over the first 8 keywords, starting just after TFIELDS */\n    fits_translate_keywords(fptr, newptr, 9, patterns, npat,\n\t\t\t    colnum, 0, 0, status);\n\n    /* add some HISTORY  */\n    snprintf(card,FLEN_CARD,\"HISTORY  This image was copied from row %ld of column '%s',\",\n            rownum, colname);\n/* disable this; leave it up to the caller to write history if needed.    \n    ffprec(newptr, card, status);\n*/\n    /* the use of ffread routine, below, requires that any 'dirty' */\n    /* buffers in memory be flushed back to the file first */\n    \n    ffflsh(fptr, FALSE, status);\n\n    /* finally, copy the data, one buffer size at a time */\n    ffmbyt(fptr, startpos, TRUE, status);\n    firstbyte = 1; \n\n    /* the upper limit on the number of bytes must match the declaration */\n    /* read up to the first 30000 bytes in the normal way with ffgbyt */\n\n    ntodo = minvalue(30000, nbytes);\n    ffgbyt(fptr, ntodo, buffer, status);\n    ffptbb(newptr, 1, firstbyte, ntodo, buffer, status);\n\n    nbytes    -= ntodo;\n    firstbyte += ntodo;\n\n    /* read any additional bytes with low-level ffread routine, for speed */\n    while (nbytes && (*status <= 0) )\n    {\n        ntodo = minvalue(30000, nbytes);\n        ffread((fptr)->Fptr, (long) ntodo, buffer, status);\n        ffptbb(newptr, 1, firstbyte, ntodo, buffer, status);\n        nbytes    -= ntodo;\n        firstbyte += ntodo;\n    }\n\n    /* Re-scan the header so that CFITSIO knows about all the new keywords */\n    ffrdef(newptr,status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_copy_image2cell(\n\t   fitsfile *fptr,   /* I - pointer to input image extension */\n\t   fitsfile *newptr, /* I - pointer to output table */\n           char *colname,    /* I - name of column containing the image    */\n           long rownum,      /* I - number of the row containing the image */\n           int copykeyflag,  /* I - controls which keywords to copy */\n           int *status)      /* IO - error status */\n\n/* \n   Copy an image extension into a table cell at a given row and\n   column.  The table must have already been created.  If the \"colname\"\n   column exists, it will be used, otherwise a new column will be created\n   in the table.\n\n   The \"copykeyflag\" parameter controls which keywords to copy from the \n   input image to the output table header (with any appropriate translation).\n \n   copykeyflag = 0  -- no keywords will be copied\n   copykeyflag = 1  -- essentially all keywords will be copied\n   copykeyflag = 2  -- copy only the WCS related keywords \n   \n  This routine was written by Craig Markwardt, GSFC\n\n*/\n{\n    tcolumn *colptr;\n    unsigned char buffer[30000];\n    int ii, hdutype, colnum, typecode, bitpix, naxis, ncols, hdunum;\n    char tformchar, tform[20], card[FLEN_CARD];\n    LONGLONG imgstart, naxes[9], nbytes, repeat, ntodo,firstbyte;\n    char filename[FLEN_FILENAME+20];\n\n    int npat;\n\n    int naxis1;\n    LONGLONG naxes1[9] = {0,0,0,0,0,0,0,0,0}, repeat1, width1;\n    int typecode1;\n    unsigned char dummy = 0;\n\n    LONGLONG headstart, datastart, dataend;\n\n    /* Image-to-table keyword translation table  */\n    /*                        INPUT      OUTPUT  */\n    /*                       01234567   01234567 */\n    char *patterns[][2] = {{\"BSCALE\",  \"TSCALn\"  },  /* Standard FITS keywords */\n\t\t\t   {\"BZERO\",   \"TZEROn\"  },\n\t\t\t   {\"BUNIT\",   \"TUNITn\"  },\n\t\t\t   {\"BLANK\",   \"TNULLn\"  },\n\t\t\t   {\"DATAMIN\", \"TDMINn\"  },\n\t\t\t   {\"DATAMAX\", \"TDMAXn\"  },\n\t\t\t   {\"CTYPEi\",  \"iCTYPn\"  },  /* Coordinate labels */\n\t\t\t   {\"CTYPEia\", \"iCTYna\"  },\n\t\t\t   {\"CUNITi\",  \"iCUNIn\"  },  /* Coordinate units */\n\t\t\t   {\"CUNITia\", \"iCUNna\"  },\n\t\t\t   {\"CRVALi\",  \"iCRVLn\"  },  /* WCS keywords */\n\t\t\t   {\"CRVALia\", \"iCRVna\"  },\n\t\t\t   {\"CDELTi\",  \"iCDLTn\"  },\n\t\t\t   {\"CDELTia\", \"iCDEna\"  },\n\t\t\t   {\"CRPIXj\",  \"jCRPXn\"  },\n\t\t\t   {\"CRPIXja\", \"jCRPna\"  },\n\t\t\t   {\"PCi_ja\",  \"ijPCna\"  },\n\t\t\t   {\"CDi_ja\",  \"ijCDna\"  },\n\t\t\t   {\"PVi_ma\",  \"iVn_ma\"  },\n\t\t\t   {\"PSi_ma\",  \"iSn_ma\"  },\n\t\t\t   {\"WCSAXESa\",\"WCAXna\"  },\n\t\t\t   {\"WCSNAMEa\",\"WCSNna\"  },\n\t\t\t   {\"CRDERia\", \"iCRDna\"  },\n\t\t\t   {\"CSYERia\", \"iCSYna\"  },\n\t\t\t   {\"CROTAi\",  \"iCROTn\"  },\n\n\t\t\t   {\"LONPOLEa\",\"LONPna\"},\n\t\t\t   {\"LATPOLEa\",\"LATPna\"},\n\t\t\t   {\"EQUINOXa\",\"EQUIna\"},\n\t\t\t   {\"MJD-OBS\", \"MJDOBn\" },\n\t\t\t   {\"MJD-AVG\", \"MJDAn\" },\n\t\t\t   {\"RADESYSa\",\"RADEna\"},\n\t\t\t   {\"CNAMEia\", \"iCNAna\"  },\n\t\t\t   {\"DATE-AVG\",\"DAVGn\"},\n\n\t\t\t   {\"NAXISi\",  \"-\"       },  /* Remove structural keywords*/\n\t\t\t   {\"PCOUNT\",  \"-\"       },\n\t\t\t   {\"GCOUNT\",  \"-\"       },\n\t\t\t   {\"EXTEND\",  \"-\"       },\n\t\t\t   {\"EXTNAME\", \"-\"       },\n\t\t\t   {\"EXTVER\",  \"-\"       },\n\t\t\t   {\"EXTLEVEL\",\"-\"       },\n\t\t\t   {\"CHECKSUM\",\"-\"       },\n\t\t\t   {\"DATASUM\", \"-\"       },\n\t\t\t   {\"*\",       \"+\"       }}; /* copy all other keywords */\n\n    \n    if (*status > 0)\n        return(*status);\n\n    if (fptr == 0 || newptr == 0) return (*status = NULL_INPUT_PTR);\n\n    if (ffghdt(fptr, &hdutype, status) > 0) {\n      ffpmsg(\"could not get input HDU type\");\n      return (*status);\n    }\n\n    if (hdutype != IMAGE_HDU) {\n        ffpmsg(\"The input extension is not an image.\");\n        ffpmsg(\" Cannot open the image.\");\n        return(*status = NOT_IMAGE);\n    }\n\n    if (ffghdt(newptr, &hdutype, status) > 0) {\n      ffpmsg(\"could not get output HDU type\");\n      return (*status);\n    }\n\n    if (hdutype != BINARY_TBL) {\n        ffpmsg(\"The output extension is not a table.\");\n        return(*status = NOT_BTABLE);\n    }\n\n\n    if (ffgiprll(fptr, 9, &bitpix, &naxis, naxes, status) > 0) {\n      ffpmsg(\"Could not read image parameters.\");\n      return (*status);\n    }\n\n    /* Determine total number of pixels in the image */\n    repeat = 1;\n    for (ii = 0; ii < naxis; ii++) repeat *= naxes[ii];\n\n    /* Determine the TFORM value for the table cell */\n    if (bitpix == BYTE_IMG) {\n      typecode = TBYTE;\n      tformchar = 'B';\n      nbytes = repeat;\n    } else if (bitpix == SHORT_IMG) {\n      typecode = TSHORT;\n      tformchar = 'I';\n      nbytes = repeat*2;\n    } else if (bitpix == LONG_IMG) {\n      typecode = TLONG;\n      tformchar = 'J';\n      nbytes = repeat*4;\n    } else if (bitpix == FLOAT_IMG) {\n      typecode = TFLOAT;\n      tformchar = 'E';\n      nbytes = repeat*4;\n    } else if (bitpix == DOUBLE_IMG) {\n      typecode = TDOUBLE;\n      tformchar = 'D';\n      nbytes = repeat*8;\n    } else if (bitpix == LONGLONG_IMG) {\n      typecode = TLONGLONG;\n      tformchar = 'K';\n      nbytes = repeat*8;\n    } else {\n      ffpmsg(\"Error: the image has an invalid datatype.\");\n      return (*status = BAD_BITPIX);\n    }\n\n    /* get column number */\n    ffpmrk();\n    ffgcno(newptr, CASEINSEN, colname, &colnum, status);\n    ffcmrk();\n\n    /* Column does not exist; create it */\n    if (*status) {\n\n      *status = 0;\n      snprintf(tform, 20, \"%.0f%c\", (double) repeat, tformchar);\n      ffgncl(newptr, &ncols, status);\n      colnum = ncols+1;\n      fficol(newptr, colnum, colname, tform, status);\n      ffptdmll(newptr, colnum, naxis, naxes, status);\n      \n      if (*status) {\n\tffpmsg(\"Could not insert new column into output table.\");\n\treturn *status;\n      }\n\n    } else {\n\n      ffgtdmll(newptr, colnum, 9, &naxis1, naxes1, status);\n      if (*status > 0 || naxis != naxis1) {\n\tffpmsg(\"Input image dimensions and output table cell dimensions do not match.\");\n\treturn (*status = BAD_DIMEN);\n      }\n      for (ii=0; ii<naxis; ii++) if (naxes[ii] != naxes1[ii]) {\n\tffpmsg(\"Input image dimensions and output table cell dimensions do not match.\");\n\treturn (*status = BAD_DIMEN);\n      }\n\n      ffgtclll(newptr, colnum, &typecode1, &repeat1, &width1, status);\n      if ((*status > 0) || (typecode1 != typecode) || (repeat1 != repeat)) {\n\tffpmsg(\"Input image data type does not match output table cell type.\");\n\treturn (*status = BAD_TFORM);\n      }\n    }\n\n    /* copy keywords from input image to output table, if required */\n    \n    if (copykeyflag) {\n    \n      npat = sizeof(patterns)/sizeof(patterns[0][0])/2;\n\n      if (copykeyflag == 2) {   /* copy only the WCS-related keywords */\n\tpatterns[npat-1][1] = \"-\";\n      }\n\n      /* The 3rd parameter value = 5 means skip the first 4 keywords in the image */\n      fits_translate_keywords(fptr, newptr, 5, patterns, npat,\n\t\t\t      colnum, 0, 0, status);\n    }\n\n    /* Here is all the code to compute offsets:\n     *     * byte offset from start of row to column (dest table)\n     *     * byte offset from start of file to image data (source image)\n     */   \n \n    /* Force the writing of the row of the table by writing the last byte of\n        the array, which grows the table, and/or shifts following extensions */\n    ffpcl(newptr, TBYTE, colnum, rownum, repeat, 1, &dummy, status);\n\n    /* byte offset within the row to the start of the image column */\n    colptr  = (newptr->Fptr)->tableptr;   /* point to first column */\n    colptr += (colnum - 1);     /* offset to correct column structure */\n    firstbyte = colptr->tbcol + 1; \n\n    /* get starting address of input image to be read */\n    ffghadll(fptr, &headstart, &datastart, &dataend, status);\n    imgstart = datastart;\n\n    snprintf(card, FLEN_CARD, \"HISTORY  Table column '%s' row %ld copied from image\",\n\t    colname, rownum);\n/*\n  Don't automatically write History keywords; leave this up to the caller. \n    ffprec(newptr, card, status);\n*/\n\n    /* write HISTORY keyword with the file name (this is now disabled)*/\n\n    filename[0] = '\\0'; hdunum = 0;\n    strcpy(filename, \"HISTORY   \");\n    ffflnm(fptr, filename+strlen(filename), status);\n    ffghdn(fptr, &hdunum);\n    snprintf(filename+strlen(filename),FLEN_FILENAME+20-strlen(filename),\"[%d]\", hdunum-1);\n/*\n    ffprec(newptr, filename, status);\n*/\n\n    /* the use of ffread routine, below, requires that any 'dirty' */\n    /* buffers in memory be flushed back to the file first */\n    \n    ffflsh(fptr, FALSE, status);\n\n    /* move to the first byte of the input image */\n    ffmbyt(fptr, imgstart, TRUE, status);\n\n    ntodo = minvalue(30000L, nbytes);\n    ffgbyt(fptr, ntodo, buffer, status);  /* read input image */\n    ffptbb(newptr, rownum, firstbyte, ntodo, buffer, status); /* write to table */\n\n    nbytes    -= ntodo;\n    firstbyte += ntodo;\n\n\n    /* read any additional bytes with low-level ffread routine, for speed */\n    while (nbytes && (*status <= 0) )\n    {\n        ntodo = minvalue(30000L, nbytes);\n        ffread(fptr->Fptr, (long) ntodo, buffer, status);\n        ffptbb(newptr, rownum, firstbyte, ntodo, buffer, status);\n        nbytes    -= ntodo;\n        firstbyte += ntodo;\n    }\n\n    /* Re-scan the header so that CFITSIO knows about all the new keywords */\n    ffrdef(newptr,status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_select_image_section(\n           fitsfile **fptr,  /* IO - pointer to input image; on output it  */\n                             /*      points to the new subimage */\n           char *outfile,    /* I - name for output file        */\n           char *expr,       /* I - Image section expression    */\n           int *status)\n{\n  /*\n     copies an image section from the input file to a new output file.\n     Any HDUs preceding or following the image are also copied to the\n     output file.\n  */\n\n    fitsfile *newptr;\n    int ii, hdunum;\n\n    /* create new empty file to hold the image section */\n    if (ffinit(&newptr, outfile, status) > 0)\n    {\n        ffpmsg(\n         \"failed to create output file for image section:\");\n        ffpmsg(outfile);\n        return(*status);\n    }\n\n    fits_get_hdu_num(*fptr, &hdunum);  /* current HDU number in input file */\n\n    /* copy all preceding extensions to the output file, if 'only_one' flag not set */\n    if (!(((*fptr)->Fptr)->only_one)) {\n      for (ii = 1; ii < hdunum; ii++)\n      {\n        fits_movabs_hdu(*fptr, ii, NULL, status);\n        if (fits_copy_hdu(*fptr, newptr, 0, status) > 0)\n        {\n            ffclos(newptr, status);\n            return(*status);\n        }\n      }\n\n      /* move back to the original HDU position */\n      fits_movabs_hdu(*fptr, hdunum, NULL, status);\n    }\n\n    if (fits_copy_image_section(*fptr, newptr, expr, status) > 0)\n    {\n        ffclos(newptr, status);\n        return(*status);\n    }\n\n    /* copy any remaining HDUs to the output file, if 'only_one' flag not set */\n\n    if (!(((*fptr)->Fptr)->only_one)) {\n      for (ii = hdunum + 1; 1; ii++)\n      {\n        if (fits_movabs_hdu(*fptr, ii, NULL, status) > 0)\n            break;\n\n        fits_copy_hdu(*fptr, newptr, 0, status);\n      }\n\n      if (*status == END_OF_FILE)   \n        *status = 0;              /* got the expected EOF error; reset = 0  */\n      else if (*status > 0)\n      {\n        ffclos(newptr, status);\n        return(*status);\n      }\n    } else {\n      ii = hdunum + 1;  /* this value of ii is required below */\n    }\n\n    /* close the original file and return ptr to the new image */\n    ffclos(*fptr, status);\n\n    *fptr = newptr; /* reset the pointer to the new table */\n\n    /* move back to the image subsection */\n    if (ii - 1 != hdunum)\n        fits_movabs_hdu(*fptr, hdunum, NULL, status);\n    else\n    {\n        /* may have to reset BSCALE and BZERO pixel scaling, */\n        /* since the keywords were previously turned off */\n\n        if (ffrdef(*fptr, status) > 0)  \n        {\n            ffclos(*fptr, status);\n            return(*status);\n        }\n\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_copy_image_section(\n           fitsfile *fptr,  /* I - pointer to input image */\n           fitsfile *newptr,  /* I - pointer to output image */\n           char *expr,       /* I - Image section expression    */\n           int *status)\n{\n  /*\n     copies an image section from the input file to a new output HDU\n  */\n\n    int bitpix, naxis, numkeys, nkey;\n    long naxes[] = {1,1,1,1,1,1,1,1,1}, smin, smax, sinc;\n    long fpixels[] = {1,1,1,1,1,1,1,1,1};\n    long lpixels[] = {1,1,1,1,1,1,1,1,1};\n    long incs[] = {1,1,1,1,1,1,1,1,1};\n    char *cptr, keyname[FLEN_KEYWORD], card[FLEN_CARD];\n    int ii, tstatus, anynull;\n    long minrow, maxrow, minslice, maxslice, mincube, maxcube;\n    long firstpix;\n    long ncubeiter, nsliceiter, nrowiter, kiter, jiter, iiter;\n    int klen, kk, jj;\n    long outnaxes[9], outsize, buffsize;\n    double *buffer, crpix, cdelt;\n\n    if (*status > 0)\n        return(*status);\n\n    /* get the size of the input image */\n    fits_get_img_type(fptr, &bitpix, status);\n    fits_get_img_dim(fptr, &naxis, status);\n    if (fits_get_img_size(fptr, naxis, naxes, status) > 0)\n        return(*status);\n\n    if (naxis < 1 || naxis > 4)\n    {\n        ffpmsg(\n        \"Input image either had NAXIS = 0 (NULL image) or has > 4 dimensions\");\n        return(*status = BAD_NAXIS);\n    }\n\n    /* create output image with same size and type as the input image */\n    /*  Will update the size later */\n    fits_create_img(newptr, bitpix, naxis, naxes, status);\n\n    /* copy all other non-structural keywords from the input to output file */\n    fits_get_hdrspace(fptr, &numkeys, NULL, status);\n\n    for (nkey = 4; nkey <= numkeys; nkey++) /* skip the first few keywords */\n    {\n        fits_read_record(fptr, nkey, card, status);\n\n        if (fits_get_keyclass(card) > TYP_CMPRS_KEY)\n        {\n            /* write the record to the output file */\n            fits_write_record(newptr, card, status);\n        }\n    }\n\n    if (*status > 0)\n    {\n         ffpmsg(\"error copying header from input image to output image\");\n         return(*status);\n    }\n\n    /* parse the section specifier to get min, max, and inc for each axis */\n    /* and the size of each output image axis */\n\n    cptr = expr;\n    for (ii=0; ii < naxis; ii++)\n    {\n       if (fits_get_section_range(&cptr, &smin, &smax, &sinc, status) > 0)\n       {\n          ffpmsg(\"error parsing the following image section specifier:\");\n          ffpmsg(expr);\n          return(*status);\n       }\n\n       if (smax == 0)\n          smax = naxes[ii];   /* use whole axis  by default */\n       else if (smin == 0)\n          smin = naxes[ii];   /* use inverted whole axis */\n\n       if (smin > naxes[ii] || smax > naxes[ii])\n       {\n          ffpmsg(\"image section exceeds dimensions of input image:\");\n          ffpmsg(expr);\n          return(*status = BAD_NAXIS);\n       }\n\n       fpixels[ii] = smin;\n       lpixels[ii] = smax;\n       incs[ii] = sinc;\n\n       if (smin <= smax)\n           outnaxes[ii] = (smax - smin + sinc) / sinc;\n       else\n           outnaxes[ii] = (smin - smax + sinc) / sinc;\n\n       /* modify the NAXISn keyword */\n       fits_make_keyn(\"NAXIS\", ii + 1, keyname, status);\n       fits_modify_key_lng(newptr, keyname, outnaxes[ii], NULL, status);\n\n       /* modify the WCS keywords if necessary */\n\n       if (fpixels[ii] != 1 || incs[ii] != 1)\n       {\n            for (kk=-1;kk<26; kk++)  /* modify any alternate WCS keywords */\n\t{\n         /* read the CRPIXn keyword if it exists in the input file */\n         fits_make_keyn(\"CRPIX\", ii + 1, keyname, status);\n\t \n         if (kk != -1) {\n\t   klen = strlen(keyname);\n\t   keyname[klen]='A' + kk;\n\t   keyname[klen + 1] = '\\0';\n\t }\n\n         tstatus = 0;\n         if (fits_read_key(fptr, TDOUBLE, keyname, \n             &crpix, NULL, &tstatus) == 0)\n         {\n           /* calculate the new CRPIXn value */\n           if (fpixels[ii] <= lpixels[ii]) {\n             crpix = (crpix - (fpixels[ii])) / incs[ii] + 1.0;\n              /*  crpix = (crpix - (fpixels[ii] - 1.0) - .5) / incs[ii] + 0.5; */\n           } else {\n             crpix = (fpixels[ii] - crpix)  / incs[ii] + 1.0;\n             /* crpix = (fpixels[ii] - (crpix - 1.0) - .5) / incs[ii] + 0.5; */\n           }\n\n           /* modify the value in the output file */\n           fits_modify_key_dbl(newptr, keyname, crpix, 15, NULL, status);\n\n           if (incs[ii] != 1 || fpixels[ii] > lpixels[ii])\n           {\n             /* read the CDELTn keyword if it exists in the input file */\n             fits_make_keyn(\"CDELT\", ii + 1, keyname, status);\n\n             if (kk != -1) {\n\t       klen = strlen(keyname);\n\t       keyname[klen]='A' + kk;\n\t       keyname[klen + 1] = '\\0';\n\t     }\n\n             tstatus = 0;\n             if (fits_read_key(fptr, TDOUBLE, keyname, \n                 &cdelt, NULL, &tstatus) == 0)\n             {\n               /* calculate the new CDELTn value */\n               if (fpixels[ii] <= lpixels[ii])\n                 cdelt = cdelt * incs[ii];\n               else\n                 cdelt = cdelt * (-incs[ii]);\n              \n               /* modify the value in the output file */\n               fits_modify_key_dbl(newptr, keyname, cdelt, 15, NULL, status);\n             }\n\n             /* modify the CDi_j keywords if they exist in the input file */\n\n             fits_make_keyn(\"CD1_\", ii + 1, keyname, status);\n\n             if (kk != -1) {\n\t       klen = strlen(keyname);\n\t       keyname[klen]='A' + kk;\n\t       keyname[klen + 1] = '\\0';\n\t     }\n\n             for (jj=0; jj < 9; jj++)   /* look for up to 9 dimensions */\n\t     {\n\t       keyname[2] = '1' + jj;\n\t       \n               tstatus = 0;\n               if (fits_read_key(fptr, TDOUBLE, keyname, \n                 &cdelt, NULL, &tstatus) == 0)\n               {\n                 /* calculate the new CDi_j value */\n                 if (fpixels[ii] <= lpixels[ii])\n                   cdelt = cdelt * incs[ii];\n                 else\n                   cdelt = cdelt * (-incs[ii]);\n              \n                 /* modify the value in the output file */\n                 fits_modify_key_dbl(newptr, keyname, cdelt, 15, NULL, status);\n               }\n\t     }\n\t     \n           } /* end of if (incs[ii]... loop */\n         }   /* end of fits_read_key loop */\n\t}    /* end of for (kk  loop */\n       }\n    }  /* end of main NAXIS loop */\n\n    if (ffrdef(newptr, status) > 0)  /* force the header to be scanned */\n    {\n        return(*status);\n    }\n\n    /* turn off any scaling of the pixel values */\n    fits_set_bscale(fptr,  1.0, 0.0, status);\n    fits_set_bscale(newptr, 1.0, 0.0, status);\n\n    /* to reduce memory foot print, just read/write image 1 row at a time */\n\n    outsize = outnaxes[0];\n    buffsize = (abs(bitpix) / 8) * outsize;\n\n    buffer = (double *) malloc(buffsize); /* allocate memory for the image row */\n    if (!buffer)\n    {\n        ffpmsg(\"fits_copy_image_section: no memory for image section\");\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    /* read the image section then write it to the output file */\n\n    minrow = fpixels[1];\n    maxrow = lpixels[1];\n    if (minrow > maxrow) {\n        nrowiter = (minrow - maxrow + incs[1]) / incs[1];\n    } else {\n        nrowiter = (maxrow - minrow + incs[1]) / incs[1];\n    }\n\n    minslice = fpixels[2];\n    maxslice = lpixels[2];\n    if (minslice > maxslice) {\n        nsliceiter = (minslice - maxslice + incs[2]) / incs[2];\n    } else {\n        nsliceiter = (maxslice - minslice + incs[2]) / incs[2];\n    }\n\n    mincube = fpixels[3];\n    maxcube = lpixels[3];\n    if (mincube > maxcube) {\n        ncubeiter = (mincube - maxcube + incs[3]) / incs[3];\n    } else {\n        ncubeiter = (maxcube - mincube + incs[3]) / incs[3];\n    }\n\n    firstpix = 1;\n    for (kiter = 0; kiter < ncubeiter; kiter++)\n    {\n      if (mincube > maxcube) {\n\t fpixels[3] = mincube - (kiter * incs[3]);\n      } else {\n\t fpixels[3] = mincube + (kiter * incs[3]);\n      }\n      \n      lpixels[3] = fpixels[3];\n\n      for (jiter = 0; jiter < nsliceiter; jiter++)\n      {\n        if (minslice > maxslice) {\n\t    fpixels[2] = minslice - (jiter * incs[2]);\n        } else {\n\t    fpixels[2] = minslice + (jiter * incs[2]);\n        }\n\n\tlpixels[2] = fpixels[2];\n\n        for (iiter = 0; iiter < nrowiter; iiter++)\n        {\n            if (minrow > maxrow) {\n\t       fpixels[1] = minrow - (iiter * incs[1]);\n\t    } else {\n\t       fpixels[1] = minrow + (iiter * incs[1]);\n            }\n\n\t    lpixels[1] = fpixels[1];\n\n\t    if (bitpix == 8)\n\t    {\n\t        ffgsvb(fptr, 1, naxis, naxes, fpixels, lpixels, incs, 0,\n\t            (unsigned char *) buffer, &anynull, status);\n\n\t        ffpprb(newptr, 1, firstpix, outsize, (unsigned char *) buffer, status);\n\t    }\n\t    else if (bitpix == 16)\n\t    {\n\t        ffgsvi(fptr, 1, naxis, naxes, fpixels, lpixels, incs, 0,\n\t            (short *) buffer, &anynull, status);\n\n\t        ffppri(newptr, 1, firstpix, outsize, (short *) buffer, status);\n\t    }\n\t    else if (bitpix == 32)\n\t    {\n\t        ffgsvk(fptr, 1, naxis, naxes, fpixels, lpixels, incs, 0,\n\t            (int *) buffer, &anynull, status);\n\n\t        ffpprk(newptr, 1, firstpix, outsize, (int *) buffer, status);\n\t    }\n\t    else if (bitpix == -32)\n\t    {\n\t        ffgsve(fptr, 1, naxis, naxes, fpixels, lpixels, incs, FLOATNULLVALUE,\n\t            (float *) buffer, &anynull, status);\n\n\t        ffppne(newptr, 1, firstpix, outsize, (float *) buffer, FLOATNULLVALUE, status);\n\t    }\n\t    else if (bitpix == -64)\n\t    {\n\t        ffgsvd(fptr, 1, naxis, naxes, fpixels, lpixels, incs, DOUBLENULLVALUE,\n\t             buffer, &anynull, status);\n\n\t        ffppnd(newptr, 1, firstpix, outsize, buffer, DOUBLENULLVALUE,\n\t               status);\n\t    }\n\t    else if (bitpix == 64)\n\t    {\n\t        ffgsvjj(fptr, 1, naxis, naxes, fpixels, lpixels, incs, 0,\n\t            (LONGLONG *) buffer, &anynull, status);\n\n\t        ffpprjj(newptr, 1, firstpix, outsize, (LONGLONG *) buffer, status);\n\t    }\n\n            firstpix += outsize;\n        }\n      }\n    }\n\n    free(buffer);  /* finished with the memory */\n\n    if (*status > 0)\n    {\n        ffpmsg(\"fits_copy_image_section: error copying image section\");\n        return(*status);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_get_section_range(char **ptr, \n                   long *secmin,\n                   long *secmax, \n                   long *incre,\n                   int *status)\n/*\n   Parse the input image section specification string, returning \n   the  min, max and increment values.\n   Typical string =   \"1:512:2\"  or \"1:512\"\n*/\n{\n    int slen, isanumber;\n    char token[FLEN_VALUE], *tstbuff=0;\n\n    if (*status > 0)\n        return(*status);\n\n    slen = fits_get_token2(ptr, \" ,:\", &tstbuff, &isanumber, status); /* get 1st token */\n    if (slen==0)\n    {\n       /* support [:2,:2] type syntax, where the leading * is implied */\n       strcpy(token,\"*\");\n    }\n    else\n    {\n       if (strlen(tstbuff) > FLEN_VALUE-1)\n       {\n          ffpmsg(\"Error: image section string too long (fits_get_section_range)\");\n          free(tstbuff);\n          *status = URL_PARSE_ERROR;\n          return(*status);\n       }\n       strcpy(token, tstbuff);\n       free(tstbuff);\n       tstbuff=0;\n    }\n\n    if (*token == '*')  /* wild card means to use the whole range */\n    {\n       *secmin = 1;\n       *secmax = 0;\n    }\n    else if (*token == '-' && *(token+1) == '*' )  /* invert the whole range */\n    {\n       *secmin = 0;\n       *secmax = 1;\n    }\n    else\n    {\n      if (slen == 0 || !isanumber || **ptr != ':')\n        return(*status = URL_PARSE_ERROR);   \n\n      /* the token contains the min value */\n      *secmin = atol(token);\n\n      (*ptr)++;  /* skip the colon between the min and max values */\n      slen = fits_get_token2(ptr, \" ,:\", &tstbuff, &isanumber, status); /* get token */\n      if (slen == 0 || !isanumber)\n      {\n        if (tstbuff)\n           free(tstbuff);\n        return(*status = URL_PARSE_ERROR);  \n      } \n      if (strlen(tstbuff) > FLEN_VALUE-1)\n      {\n         ffpmsg(\"Error: image section string too long (fits_get_section_range)\");\n         free(tstbuff);\n         *status = URL_PARSE_ERROR;\n         return(*status);\n      }\n      strcpy(token, tstbuff);\n      free(tstbuff);\n      tstbuff=0;\n\n      /* the token contains the max value */\n      *secmax = atol(token);\n    }\n\n    if (**ptr == ':')\n    {\n        (*ptr)++;  /* skip the colon between the max and incre values */\n        slen = fits_get_token2(ptr, \" ,\", &tstbuff, &isanumber, status); /* get token */\n        if (slen == 0 || !isanumber)\n        {\n            if (tstbuff)\n               free(tstbuff);\n            return(*status = URL_PARSE_ERROR); \n        }  \n        if (strlen(tstbuff) > FLEN_VALUE-1)\n        {\n           ffpmsg(\"Error: image section string too long (fits_get_section_range)\");\n           free(tstbuff);\n           *status = URL_PARSE_ERROR;\n           return(*status);\n        }\n        strcpy(token, tstbuff);\n        free(tstbuff);\n        tstbuff=0;\n\n\n        *incre = atol(token);\n    }\n    else\n        *incre = 1;  /* default increment if none is supplied */\n\n    if (**ptr == ',')\n        (*ptr)++;\n\n    while (**ptr == ' ')   /* skip any trailing blanks */\n         (*ptr)++;\n\n    if (*secmin < 0 || *secmax < 0 || *incre < 1)\n        *status = URL_PARSE_ERROR;\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffselect_table(\n           fitsfile **fptr,  /* IO - pointer to input table; on output it  */\n                             /*      points to the new selected rows table */\n           char *outfile,    /* I - name for output file */\n           char *expr,       /* I - Boolean expression    */\n           int *status)\n{\n    fitsfile *newptr;\n    int ii, hdunum;\n\n    if (*outfile)\n    {\n      /* create new empty file in to hold the selected rows */\n      if (ffinit(&newptr, outfile, status) > 0)\n      {\n        ffpmsg(\n         \"failed to create file for selected rows from input table\");\n        ffpmsg(outfile);\n        return(*status);\n      }\n\n      fits_get_hdu_num(*fptr, &hdunum);  /* current HDU number in input file */\n\n      /* copy all preceding extensions to the output file, if the 'only_one' flag is not set */\n      if (!((*fptr)->Fptr)->only_one) {\n        for (ii = 1; ii < hdunum; ii++)\n        {\n          fits_movabs_hdu(*fptr, ii, NULL, status);\n          if (fits_copy_hdu(*fptr, newptr, 0, status) > 0)\n          {\n            ffclos(newptr, status);\n            return(*status);\n          }\n        }\n      } else {\n          /* just copy the primary array */\n          fits_movabs_hdu(*fptr, 1, NULL, status);\n          if (fits_copy_hdu(*fptr, newptr, 0, status) > 0)\n          {\n            ffclos(newptr, status);\n            return(*status);\n          }\n      }\n      \n      fits_movabs_hdu(*fptr, hdunum, NULL, status);\n\n      /* copy all the header keywords from the input to output file */\n      if (fits_copy_header(*fptr, newptr, status) > 0)\n      {\n        ffclos(newptr, status);\n        return(*status);\n      }\n\n      /* set number of rows = 0 */\n      fits_modify_key_lng(newptr, \"NAXIS2\", 0, NULL,status);\n      (newptr->Fptr)->numrows = 0;\n      (newptr->Fptr)->origrows = 0;\n\n      if (ffrdef(newptr, status) > 0)  /* force the header to be scanned */\n      {\n        ffclos(newptr, status);\n        return(*status);\n      }\n    }\n    else\n        newptr = *fptr;  /* will delete rows in place in the table */\n\n    /* copy rows which satisfy the selection expression to the output table */\n    /* or delete the nonqualifying rows if *fptr = newptr.   */\n    if (fits_select_rows(*fptr, newptr, expr, status) > 0)\n    {\n        if (*outfile)\n            ffclos(newptr, status);\n\n        return(*status);\n    }\n\n    if (*outfile)\n    {\n      /* copy any remaining HDUs to the output copy */\n\n      if (!((*fptr)->Fptr)->only_one) {\n        for (ii = hdunum + 1; 1; ii++)\n        {\n          if (fits_movabs_hdu(*fptr, ii, NULL, status) > 0)\n            break;\n\n          fits_copy_hdu(*fptr, newptr, 0, status);\n        }\n\n        if (*status == END_OF_FILE)   \n          *status = 0;              /* got the expected EOF error; reset = 0  */\n        else if (*status > 0)\n        {\n          ffclos(newptr, status);\n          return(*status);\n        }\n      } else {\n        hdunum = 2;\n      }\n\n      /* close the original file and return ptr to the new image */\n      ffclos(*fptr, status);\n\n      *fptr = newptr; /* reset the pointer to the new table */\n\n      /* move back to the selected table HDU */\n      fits_movabs_hdu(*fptr, hdunum, NULL, status);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffparsecompspec(fitsfile *fptr,  /* I - FITS file pointer               */\n           char *compspec,     /* I - image compression specification */\n           int *status)          /* IO - error status                       */\n/*\n  Parse the image compression specification that was give in square brackets\n  following the output FITS file name, as in these examples:\n\n    myfile.fits[compress]  - default Rice compression, row by row \n    myfile.fits[compress TYPE] -  the first letter of TYPE defines the\n                                  compression algorithm:\n                                   R = Rice\n                                   G = GZIP\n                                   H = HCOMPRESS\n                                   HS = HCOMPRESS (with smoothing)\n\t\t\t\t   B - BZIP2\n                                   P = PLIO\n\n    myfile.fits[compress TYPE 100,100] - the numbers give the dimensions\n                                         of the compression tiles.  Default\n                                         is NAXIS1, 1, 1, ...\n\n       other optional parameters may be specified following a semi-colon \n       \n    myfile.fits[compress; q 8.0]          q specifies the floating point \n    mufile.fits[compress TYPE; q -.0002]        quantization level;\n    myfile.fits[compress TYPE 100,100; q 10, s 25]  s specifies the HCOMPRESS\n                                                     integer scaling parameter\n\nThe compression parameters are saved in the fptr->Fptr structure for use\nwhen writing FITS images.\n\n*/\n{\n    char *ptr1;\n\n    /* initialize with default values */\n    int ii, compresstype = RICE_1, smooth = 0;\n    int quantize_method = SUBTRACTIVE_DITHER_1;\n    long tilesize[MAX_COMPRESS_DIM] = {0,0,0,0,0,0};\n    float qlevel = -99., scale = 0.;\n    \n    ptr1 = compspec;\n    while (*ptr1 == ' ')    /* ignore leading blanks */\n           ptr1++;\n\n    if (strncmp(ptr1, \"compress\", 8) && strncmp(ptr1, \"COMPRESS\", 8) )\n    {\n       /* apparently this string does not specify compression parameters */\n       return(*status = URL_PARSE_ERROR);\n    }\n\n    ptr1 += 8;\n    while (*ptr1 == ' ')    /* ignore leading blanks */\n           ptr1++;\n\n    /* ========================= */\n    /* look for compression type */\n    /* ========================= */\n\n    if (*ptr1 == 'r' || *ptr1 == 'R')\n    {\n        compresstype = RICE_1;\n        while (*ptr1 != ' ' && *ptr1 != ';' && *ptr1 != '\\0') \n           ptr1++;\n    }\n    else if (*ptr1 == 'g' || *ptr1 == 'G')\n    {\n        compresstype = GZIP_1;\n        while (*ptr1 != ' ' && *ptr1 != ';' && *ptr1 != '\\0') \n           ptr1++;\n\n    }\n/*\n    else if (*ptr1 == 'b' || *ptr1 == 'B')\n    {\n        compresstype = BZIP2_1;\n        while (*ptr1 != ' ' && *ptr1 != ';' && *ptr1 != '\\0') \n           ptr1++;\n\n    }\n*/\n    else if (*ptr1 == 'p' || *ptr1 == 'P')\n    {\n        compresstype = PLIO_1;\n        while (*ptr1 != ' ' && *ptr1 != ';' && *ptr1 != '\\0') \n           ptr1++;\n    }\n    else if (*ptr1 == 'h' || *ptr1 == 'H')\n    {\n        compresstype = HCOMPRESS_1;\n        ptr1++;\n        if (*ptr1 == 's' || *ptr1 == 'S')\n           smooth = 1;  /* apply smoothing when uncompressing HCOMPRESSed image */\n\n        while (*ptr1 != ' ' && *ptr1 != ';' && *ptr1 != '\\0') \n           ptr1++;\n    }\n\n    /* ======================== */\n    /* look for tile dimensions */\n    /* ======================== */\n\n    while (*ptr1 == ' ')    /* ignore leading blanks */\n           ptr1++;\n\n    ii = 0;\n    while (isdigit( (int) *ptr1) && ii < 9)\n    {\n       tilesize[ii] = atol(ptr1);  /* read the integer value */\n       ii++;\n\n       while (isdigit((int) *ptr1))    /* skip over the integer */\n           ptr1++;\n\n       if (*ptr1 == ',')\n           ptr1++;   /* skip over the comma */\n          \n       while (*ptr1 == ' ')    /* ignore leading blanks */\n           ptr1++;\n    }\n\n    /* ========================================================= */\n    /* look for semi-colon, followed by other optional parameters */\n    /* ========================================================= */\n\n    if (*ptr1 == ';') {\n        ptr1++;\n        while (*ptr1 == ' ')    /* ignore leading blanks */\n           ptr1++;\n\n          while (*ptr1 != 0) {  /* haven't reached end of string yet */\n\n              if (*ptr1 == 's' || *ptr1 == 'S') {\n                  /* this should be the HCOMPRESS \"scale\" parameter; default = 1 */\n\t   \n                  ptr1++;\n                  while (*ptr1 == ' ')    /* ignore leading blanks */\n                      ptr1++;\n\n                  scale = (float) strtod(ptr1, &ptr1);\n\n                  while (*ptr1 == ' ' || *ptr1 == ',') /* skip over blanks or comma */\n                     ptr1++;\n\n            } else if (*ptr1 == 'q' || *ptr1 == 'Q') {\n                /* this should be the floating point quantization parameter */\n\n                  ptr1++;\n                  if (*ptr1 == 'z' || *ptr1 == 'Z') {\n                      /* use the subtractive_dither_2 option */\n                      quantize_method = SUBTRACTIVE_DITHER_2;\n                      ptr1++;\n\t\t  } else if (*ptr1 == '0') {\n                      /* do not dither */\n                      quantize_method = NO_DITHER;\n                      ptr1++;\n\t\t  }\n\n                  while (*ptr1 == ' ')    /* ignore leading blanks */\n                      ptr1++;\n\n                  qlevel = (float) strtod(ptr1, &ptr1);\n\n                  while (*ptr1 == ' ' || *ptr1 == ',') /* skip over blanks or comma */\n                     ptr1++;\n\n            } else {\n                return(*status = URL_PARSE_ERROR);\n            }\n        }\n    }\n\n    /* ================================= */\n    /* finished parsing; save the values */\n    /* ================================= */\n\n    fits_set_compression_type(fptr, compresstype, status);\n    fits_set_tile_dim(fptr, MAX_COMPRESS_DIM, tilesize, status);\n \n    if (compresstype == HCOMPRESS_1) {\n        fits_set_hcomp_scale (fptr, scale,  status);\n        fits_set_hcomp_smooth(fptr, smooth, status);\n    }\n\n    if (qlevel != -99.) {\n        fits_set_quantize_level(fptr, qlevel, status);\n        fits_set_quantize_method(fptr, quantize_method, status);\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffdkinit(fitsfile **fptr,      /* O - FITS file pointer                   */\n           const char *name,     /* I - name of file to create              */\n           int *status)          /* IO - error status                       */\n/*\n  Create and initialize a new FITS file on disk.  This routine differs\n  from ffinit in that the input 'name' is literally taken as the name\n  of the disk file to be created, and it does not support CFITSIO's \n  extended filename syntax.\n*/\n{\n    *fptr = 0;              /* initialize null file pointer, */\n                            /* regardless of the value of *status */\n    if (*status > 0)\n        return(*status);\n\n    *status = CREATE_DISK_FILE;\n\n    ffinit(fptr, name,status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffinit(fitsfile **fptr,      /* O - FITS file pointer                   */\n           const char *name,     /* I - name of file to create              */\n           int *status)          /* IO - error status                       */\n/*\n  Create and initialize a new FITS file.\n*/\n{\n    int ii, driver, slen, clobber = 0;\n    char *url;\n    char urltype[MAX_PREFIX_LEN], outfile[FLEN_FILENAME];\n    char tmplfile[FLEN_FILENAME], compspec[80];\n    int handle, create_disk_file = 0;\n\n    *fptr = 0;              /* initialize null file pointer, */\n                            /* regardless of the value of *status */\n    if (*status > 0)\n        return(*status);\n\n    if (*status == CREATE_DISK_FILE)\n    {\n       create_disk_file = 1;\n       *status = 0;\n    }\n\n    if (need_to_initialize)  {          /* this is called only once */\n        *status = fits_init_cfitsio();\n    }\n\n    if (*status > 0)\n        return(*status);\n\n    url = (char *) name;\n    while (*url == ' ')  /* ignore leading spaces in the filename */\n        url++;\n\n    if (*url == '\\0')\n    {\n        ffpmsg(\"Name of file to create is blank. (ffinit)\");\n        return(*status = FILE_NOT_CREATED);\n    }\n\n    if (create_disk_file)\n    {\n       if (strlen(url) > FLEN_FILENAME - 1)\n       {\n           ffpmsg(\"Filename is too long. (ffinit)\");\n           return(*status = FILE_NOT_CREATED);\n       }\n\n       strcpy(outfile, url);\n       strcpy(urltype, \"file://\");\n       tmplfile[0] = '\\0';\n       compspec[0] = '\\0';\n    }\n    else\n    {\n       \n      /* check for clobber symbol, i.e,  overwrite existing file */\n      if (*url == '!')\n      {\n          clobber = TRUE;\n          url++;\n      }\n      else\n          clobber = FALSE;\n\n        /* parse the output file specification */\n\t/* this routine checks that the strings will not overflow */\n      ffourl(url, urltype, outfile, tmplfile, compspec, status);\n\n      if (*status > 0)\n      {\n        ffpmsg(\"could not parse the output filename: (ffinit)\");\n        ffpmsg(url);\n        return(*status);\n      }\n    }\n    \n        /* find which driver corresponds to the urltype */\n    *status = urltype2driver(urltype, &driver);\n\n    if (*status)\n    {\n        ffpmsg(\"could not find driver for this file: (ffinit)\");\n        ffpmsg(url);\n        return(*status);\n    }\n\n        /* delete pre-existing file, if asked to do so */\n    if (clobber)\n    {\n        if (driverTable[driver].remove)\n             (*driverTable[driver].remove)(outfile);\n    }\n\n        /* call appropriate driver to create the file */\n    if (driverTable[driver].create)\n    {\n\n        FFLOCK;  /* lock this while searching for vacant handle */\n        *status = (*driverTable[driver].create)(outfile, &handle);\n        FFUNLOCK;\n\n        if (*status)\n        {\n            ffpmsg(\"failed to create new file (already exists?):\");\n            ffpmsg(url);\n            return(*status);\n       }\n    }\n    else\n    {\n        ffpmsg(\"cannot create a new file of this type: (ffinit)\");\n        ffpmsg(url);\n        return(*status = FILE_NOT_CREATED);\n    }\n\n        /* allocate fitsfile structure and initialize = 0 */\n    *fptr = (fitsfile *) calloc(1, sizeof(fitsfile));\n\n    if (!(*fptr))\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate structure for following file: (ffopen)\");\n        ffpmsg(url);\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n        /* allocate FITSfile structure and initialize = 0 */\n    (*fptr)->Fptr = (FITSfile *) calloc(1, sizeof(FITSfile));\n\n    if (!((*fptr)->Fptr))\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate structure for following file: (ffopen)\");\n        ffpmsg(url);\n        free(*fptr);\n        *fptr = 0;       \n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    slen = strlen(url) + 1;\n    slen = maxvalue(slen, 32); /* reserve at least 32 chars */ \n    ((*fptr)->Fptr)->filename = (char *) malloc(slen); /* mem for file name */\n\n    if ( !(((*fptr)->Fptr)->filename) )\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate memory for filename: (ffinit)\");\n        ffpmsg(url);\n        free((*fptr)->Fptr);\n        free(*fptr);\n        *fptr = 0;              /* return null file pointer */\n        return(*status = FILE_NOT_CREATED);\n    }\n\n    /* mem for headstart array */\n    ((*fptr)->Fptr)->headstart = (LONGLONG *) calloc(1001, sizeof(LONGLONG)); \n\n    if ( !(((*fptr)->Fptr)->headstart) )\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate memory for headstart array: (ffinit)\");\n        ffpmsg(url);\n        free( ((*fptr)->Fptr)->filename);\n        free((*fptr)->Fptr);\n        free(*fptr);\n        *fptr = 0;              /* return null file pointer */\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    /* mem for file I/O buffers */\n    ((*fptr)->Fptr)->iobuffer = (char *) calloc(NIOBUF, IOBUFLEN);\n\n    if ( !(((*fptr)->Fptr)->iobuffer) )\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate memory for iobuffer array: (ffinit)\");\n        ffpmsg(url);\n        free( ((*fptr)->Fptr)->headstart);    /* free memory for headstart array */\n        free( ((*fptr)->Fptr)->filename);\n        free((*fptr)->Fptr);\n        free(*fptr);\n        *fptr = 0;              /* return null file pointer */\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    /* initialize the ageindex array (relative age of the I/O buffers) */\n    /* and initialize the bufrecnum array as being empty */\n    for (ii = 0; ii < NIOBUF; ii++)  {\n        ((*fptr)->Fptr)->ageindex[ii] = ii;\n        ((*fptr)->Fptr)->bufrecnum[ii] = -1;\n    }\n\n        /* store the parameters describing the file */\n    ((*fptr)->Fptr)->MAXHDU = 1000;              /* initial size of headstart */\n    ((*fptr)->Fptr)->filehandle = handle;        /* store the file pointer */\n    ((*fptr)->Fptr)->driver = driver;            /*  driver number         */\n    strcpy(((*fptr)->Fptr)->filename, url);      /* full input filename    */\n    ((*fptr)->Fptr)->filesize = 0;               /* physical file size     */\n    ((*fptr)->Fptr)->logfilesize = 0;            /* logical file size      */\n    ((*fptr)->Fptr)->writemode = 1;              /* read-write mode        */\n    ((*fptr)->Fptr)->datastart = DATA_UNDEFINED; /* unknown start of data  */\n    ((*fptr)->Fptr)->curbuf = -1;         /* undefined current IO buffer   */\n    ((*fptr)->Fptr)->open_count = 1;      /* structure is currently used once */\n    ((*fptr)->Fptr)->validcode = VALIDSTRUC; /* flag denoting valid structure */\n    ((*fptr)->Fptr)->noextsyntax = create_disk_file; /* true if extended syntax is disabled */\n\n    ffldrc(*fptr, 0, IGNORE_EOF, status);     /* initialize first record */\n\n    fits_store_Fptr( (*fptr)->Fptr, status);  /* store Fptr address */\n\n    /* if template file was given, use it to define structure of new file */\n\n    if (tmplfile[0])\n        ffoptplt(*fptr, tmplfile, status);\n\n    /* parse and save image compression specification, if given */\n    if (compspec[0])\n        ffparsecompspec(*fptr, compspec, status);\n\n    return(*status);                       /* successful return */\n}\n/*--------------------------------------------------------------------------*/\n/* ffimem == fits_create_memfile */\n\nint ffimem(fitsfile **fptr,      /* O - FITS file pointer                   */ \n           void **buffptr,       /* I - address of memory pointer           */\n           size_t *buffsize,     /* I - size of buffer, in bytes            */\n           size_t deltasize,     /* I - increment for future realloc's      */\n           void *(*mem_realloc)(void *p, size_t newsize), /* function       */\n           int *status)          /* IO - error status                       */\n\n/*\n  Create and initialize a new FITS file in memory\n*/\n{\n    int ii, driver, slen;\n    char urltype[MAX_PREFIX_LEN];\n    int handle;\n\n    if (*status > 0)\n        return(*status);\n\n    *fptr = 0;              /* initialize null file pointer */\n\n    if (need_to_initialize)    {        /* this is called only once */\n       *status = fits_init_cfitsio();\n    }\n    \n    if (*status > 0)\n        return(*status);\n\n    strcpy(urltype, \"memkeep://\"); /* URL type for pre-existing memory file */\n\n    *status = urltype2driver(urltype, &driver);\n\n    if (*status > 0)\n    {\n        ffpmsg(\"could not find driver for pre-existing memory file: (ffimem)\");\n        return(*status);\n    }\n\n    /* call driver routine to \"open\" the memory file */\n    FFLOCK;  /* lock this while searching for vacant handle */\n    *status =   mem_openmem( buffptr, buffsize, deltasize,\n                            mem_realloc,  &handle);\n    FFUNLOCK;\n\n    if (*status > 0)\n    {\n         ffpmsg(\"failed to open pre-existing memory file: (ffimem)\");\n         return(*status);\n    }\n\n        /* allocate fitsfile structure and initialize = 0 */\n    *fptr = (fitsfile *) calloc(1, sizeof(fitsfile));\n\n    if (!(*fptr))\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate structure for memory file: (ffimem)\");\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n        /* allocate FITSfile structure and initialize = 0 */\n    (*fptr)->Fptr = (FITSfile *) calloc(1, sizeof(FITSfile));\n\n    if (!((*fptr)->Fptr))\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate structure for memory file: (ffimem)\");\n        free(*fptr);\n        *fptr = 0;       \n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    slen = 32; /* reserve at least 32 chars */ \n    ((*fptr)->Fptr)->filename = (char *) malloc(slen); /* mem for file name */\n\n    if ( !(((*fptr)->Fptr)->filename) )\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate memory for filename: (ffimem)\");\n        free((*fptr)->Fptr);\n        free(*fptr);\n        *fptr = 0;              /* return null file pointer */\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    /* mem for headstart array */\n    ((*fptr)->Fptr)->headstart = (LONGLONG *) calloc(1001, sizeof(LONGLONG)); \n\n    if ( !(((*fptr)->Fptr)->headstart) )\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate memory for headstart array: (ffimem)\");\n        free( ((*fptr)->Fptr)->filename);\n        free((*fptr)->Fptr);\n        free(*fptr);\n        *fptr = 0;              /* return null file pointer */\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    /* mem for file I/O buffers */\n    ((*fptr)->Fptr)->iobuffer = (char *) calloc(NIOBUF, IOBUFLEN);\n\n    if ( !(((*fptr)->Fptr)->iobuffer) )\n    {\n        (*driverTable[driver].close)(handle);  /* close the file */\n        ffpmsg(\"failed to allocate memory for iobuffer array: (ffimem)\");\n        free( ((*fptr)->Fptr)->headstart);    /* free memory for headstart array */\n        free( ((*fptr)->Fptr)->filename);\n        free((*fptr)->Fptr);\n        free(*fptr);\n        *fptr = 0;              /* return null file pointer */\n        return(*status = MEMORY_ALLOCATION);\n    }\n\n    /* initialize the ageindex array (relative age of the I/O buffers) */\n    /* and initialize the bufrecnum array as being empty */\n    for (ii = 0; ii < NIOBUF; ii++)  {\n        ((*fptr)->Fptr)->ageindex[ii] = ii;\n        ((*fptr)->Fptr)->bufrecnum[ii] = -1;\n    }\n\n        /* store the parameters describing the file */\n    ((*fptr)->Fptr)->MAXHDU = 1000;              /* initial size of headstart */\n    ((*fptr)->Fptr)->filehandle = handle;        /* file handle */\n    ((*fptr)->Fptr)->driver = driver;            /* driver number */\n    strcpy(((*fptr)->Fptr)->filename, \"memfile\"); /* dummy filename */\n    ((*fptr)->Fptr)->filesize = *buffsize;        /* physical file size */\n    ((*fptr)->Fptr)->logfilesize = *buffsize;     /* logical file size */\n    ((*fptr)->Fptr)->writemode = 1;               /* read-write mode    */\n    ((*fptr)->Fptr)->datastart = DATA_UNDEFINED;  /* unknown start of data */\n    ((*fptr)->Fptr)->curbuf = -1;             /* undefined current IO buffer */\n    ((*fptr)->Fptr)->open_count = 1;     /* structure is currently used once */\n    ((*fptr)->Fptr)->validcode = VALIDSTRUC; /* flag denoting valid structure */\n    ((*fptr)->Fptr)->noextsyntax = 0;  /* extended syntax can be used in filename */\n\n    ffldrc(*fptr, 0, IGNORE_EOF, status);     /* initialize first record */\n    fits_store_Fptr( (*fptr)->Fptr, status);  /* store Fptr address */\n    return(*status); \n}\n/*--------------------------------------------------------------------------*/\nint fits_init_cfitsio(void)\n/*\n  initialize anything that is required before using the CFITSIO routines\n*/\n{\n    int status;\n\n    union u_tag {\n      short ival;\n      char cval[2];\n    } u;\n\n    fitsio_init_lock();\n\n    FFLOCK;   /* lockout other threads while executing this critical */\n              /* section of code  */\n\n    if (need_to_initialize == 0) { /* already initialized? */\n      FFUNLOCK;\n      return(0);\n    }\n\n    /*   test for correct byteswapping.   */\n\n    u.ival = 1;\n    if  ((BYTESWAPPED && u.cval[0] != 1) ||\n         (BYTESWAPPED == FALSE && u.cval[1] != 1) )\n    {\n      printf (\"\\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\\n\");\n      printf(\" Byteswapping is not being done correctly on this system.\\n\");\n      printf(\" Check the MACHINE and BYTESWAPPED definitions in fitsio2.h\\n\");\n      printf(\" Please report this problem to the CFITSIO developers.\\n\");\n      printf(  \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\\n\");\n      FFUNLOCK;\n      return(1);\n    }\n    \n    \n    /*  test that LONGLONG is an 8 byte integer */\n    \n    if (sizeof(LONGLONG) != 8)\n    {\n      printf (\"\\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\\n\");\n      printf(\" CFITSIO did not find an 8-byte long integer data type.\\n\");\n      printf(\"   sizeof(LONGLONG) = %d\\n\",(int)sizeof(LONGLONG));\n      printf(\" Please report this problem to the CFITSIO developers.\\n\");\n      printf(  \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\\n\");\n      FFUNLOCK;\n      return(1);\n    }\n\n    /* register the standard I/O drivers that are always available */\n\n    /* 1--------------------disk file driver-----------------------*/\n    status = fits_register_driver(\"file://\", \n            file_init,\n            file_shutdown,\n            file_setoptions,\n            file_getoptions, \n            file_getversion,\n\t    file_checkfile,\n            file_open,\n            file_create,\n#ifdef HAVE_FTRUNCATE\n            file_truncate,\n#else\n            NULL,   /* no file truncate function */\n#endif\n            file_close,\n            file_remove,\n            file_size,\n            file_flush,\n            file_seek,\n            file_read,\n            file_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the file:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 2------------ output temporary memory file driver ----------------*/\n    status = fits_register_driver(\"mem://\", \n            mem_init,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            NULL,            /* checkfile not needed */\n            NULL,            /* open function not allowed */\n            mem_create, \n            mem_truncate,\n            mem_close_free,\n            NULL,            /* remove function not required */\n            mem_size,\n            NULL,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the mem:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 3--------------input pre-existing memory file driver----------------*/\n    status = fits_register_driver(\"memkeep://\", \n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            NULL,            /* checkfile not needed */\n            NULL,            /* file open driver function is not used */\n            NULL,            /* create function not allowed */\n            mem_truncate,\n            mem_close_keep,\n            NULL,            /* remove function not required */\n            mem_size,\n            NULL,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the memkeep:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n   /* 4-------------------stdin stream driver----------------------*/\n   /*  the stdin stream is copied to memory then opened in memory */\n\n    status = fits_register_driver(\"stdin://\", \n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            stdin_checkfile, \n            stdin_open,\n            NULL,            /* create function not allowed */\n            mem_truncate,\n            mem_close_free,\n            NULL,            /* remove function not required */\n            mem_size,\n            NULL,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the stdin:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n   /* 5-------------------stdin file stream driver----------------------*/\n   /*  the stdin stream is copied to a disk file then the disk file is opened */\n\n    status = fits_register_driver(\"stdinfile://\", \n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            NULL,            /* checkfile not needed */ \n            stdin_open,\n            NULL,            /* create function not allowed */\n#ifdef HAVE_FTRUNCATE\n            file_truncate,\n#else\n            NULL,   /* no file truncate function */\n#endif\n            file_close,\n            file_remove,\n            file_size,\n            file_flush,\n            file_seek,\n            file_read,\n            file_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the stdinfile:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n\n    /* 6-----------------------stdout stream driver------------------*/\n    status = fits_register_driver(\"stdout://\",\n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            NULL,            /* checkfile not needed */ \n            NULL,            /* open function not required */\n            mem_create, \n            mem_truncate,\n            stdout_close,\n            NULL,            /* remove function not required */\n            mem_size,\n            NULL,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the stdout:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 7------------------iraf disk file to memory driver -----------*/\n    status = fits_register_driver(\"irafmem://\",\n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            NULL,            /* checkfile not needed */ \n            mem_iraf_open,\n            NULL,            /* create function not required */\n            mem_truncate,\n            mem_close_free,\n            NULL,            /* remove function not required */\n            mem_size,\n            NULL,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the irafmem:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 8------------------raw binary file to memory driver -----------*/\n    status = fits_register_driver(\"rawfile://\",\n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            NULL,            /* checkfile not needed */ \n            mem_rawfile_open,\n            NULL,            /* create function not required */\n            mem_truncate,\n            mem_close_free,\n            NULL,            /* remove function not required */\n            mem_size,\n            NULL,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the rawfile:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 9------------------compressed disk file to memory driver -----------*/\n    status = fits_register_driver(\"compress://\",\n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            NULL,            /* checkfile not needed */ \n            mem_compress_open,\n            NULL,            /* create function not required */\n            mem_truncate,\n            mem_close_free,\n            NULL,            /* remove function not required */\n            mem_size,\n            NULL,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the compress:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 10------------------compressed disk file to memory driver -----------*/\n    /*  Identical to compress://, except it allows READWRITE access      */\n\n    status = fits_register_driver(\"compressmem://\",\n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            NULL,            /* checkfile not needed */ \n            mem_compress_openrw,\n            NULL,            /* create function not required */\n            mem_truncate,\n            mem_close_free,\n            NULL,            /* remove function not required */\n            mem_size,\n            NULL,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the compressmem:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 11------------------compressed disk file to disk file driver -------*/\n    status = fits_register_driver(\"compressfile://\",\n            NULL,\n            file_shutdown,\n            file_setoptions,\n            file_getoptions, \n            file_getversion,\n            NULL,            /* checkfile not needed */ \n            file_compress_open,\n            file_create,\n#ifdef HAVE_FTRUNCATE\n            file_truncate,\n#else\n            NULL,   /* no file truncate function */\n#endif\n            file_close,\n            file_remove,\n            file_size,\n            file_flush,\n            file_seek,\n            file_read,\n            file_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the compressfile:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 12---create file in memory, then compress it to disk file on close--*/\n    status = fits_register_driver(\"compressoutfile://\", \n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            NULL,            /* checkfile not needed */\n            NULL,            /* open function not allowed */\n            mem_create_comp, \n            mem_truncate,\n            mem_close_comp,\n            file_remove,     /* delete existing compressed disk file */\n            mem_size,\n            NULL,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n\n    if (status)\n    {\n        ffpmsg(\n        \"failed to register the compressoutfile:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* Register Optional drivers */\n\n#ifdef HAVE_NET_SERVICES\n\n    /* 13--------------------root driver-----------------------*/\n\n    status = fits_register_driver(\"root://\",\n\t\t\t\t  root_init,\n\t\t\t\t  root_shutdown,\n\t\t\t\t  root_setoptions,\n\t\t\t\t  root_getoptions, \n\t\t\t\t  root_getversion,\n\t\t\t\t  NULL,            /* checkfile not needed */ \n\t\t\t\t  root_open,\n\t\t\t\t  root_create,\n\t\t\t\t  NULL,  /* No truncate possible */\n\t\t\t\t  root_close,\n\t\t\t\t  NULL,  /* No remove possible */\n\t\t\t\t  root_size,  /* no size possible */\n\t\t\t\t  root_flush,\n\t\t\t\t  root_seek, /* Though will always succeed */\n\t\t\t\t  root_read,\n\t\t\t\t  root_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the root:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 14--------------------http  driver-----------------------*/\n    status = fits_register_driver(\"http://\",\n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            http_checkfile,\n            http_open,\n            NULL,            /* create function not required */\n            mem_truncate,\n            mem_close_free,\n            NULL,            /* remove function not required */\n            mem_size,\n            NULL,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the http:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 15--------------------http file driver-----------------------*/\n\n    status = fits_register_driver(\"httpfile://\",\n            NULL,\n            file_shutdown,\n            file_setoptions,\n            file_getoptions, \n            file_getversion,\n            NULL,            /* checkfile not needed */ \n            http_file_open,\n            file_create,\n#ifdef HAVE_FTRUNCATE\n            file_truncate,\n#else\n            NULL,   /* no file truncate function */\n#endif\n            file_close,\n            file_remove,\n            file_size,\n            file_flush,\n            file_seek,\n            file_read,\n            file_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the httpfile:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 16--------------------http memory driver-----------------------*/\n    /*  same as http:// driver, except memory file can be opened READWRITE */\n    status = fits_register_driver(\"httpmem://\",\n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            http_checkfile,\n            http_file_open,  /* this will simply call http_open */\n            NULL,            /* create function not required */\n            mem_truncate,\n            mem_close_free,\n            NULL,            /* remove function not required */\n            mem_size,\n            NULL,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the httpmem:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 17--------------------httpcompress file driver-----------------------*/\n\n    status = fits_register_driver(\"httpcompress://\",\n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            NULL,            /* checkfile not needed */ \n            http_compress_open,\n            NULL,            /* create function not required */\n            mem_truncate,\n            mem_close_free,\n            NULL,            /* remove function not required */\n            mem_size,\n            NULL,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the httpcompress:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n\n    /* 18--------------------ftp driver-----------------------*/\n    status = fits_register_driver(\"ftp://\",\n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            ftp_checkfile,\n            ftp_open,\n            NULL,            /* create function not required */\n            mem_truncate,\n            mem_close_free,\n            NULL,            /* remove function not required */\n            mem_size,\n            NULL,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the ftp:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 19--------------------ftp file driver-----------------------*/\n    status = fits_register_driver(\"ftpfile://\",\n            NULL,\n            file_shutdown,\n            file_setoptions,\n            file_getoptions, \n            file_getversion,\n            NULL,            /* checkfile not needed */ \n            ftp_file_open,\n            file_create,\n#ifdef HAVE_FTRUNCATE\n            file_truncate,\n#else\n            NULL,   /* no file truncate function */\n#endif\n            file_close,\n            file_remove,\n            file_size,\n            file_flush,\n            file_seek,\n            file_read,\n            file_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the ftpfile:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 20--------------------ftp mem driver-----------------------*/\n    /*  same as ftp:// driver, except memory file can be opened READWRITE */\n    status = fits_register_driver(\"ftpmem://\",\n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            ftp_checkfile,\n            ftp_file_open,   /* this will simply call ftp_open */\n            NULL,            /* create function not required */\n            mem_truncate,\n            mem_close_free,\n            NULL,            /* remove function not required */\n            mem_size,\n            NULL,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the ftpmem:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 21--------------------ftp compressed file driver------------------*/\n    status = fits_register_driver(\"ftpcompress://\",\n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            NULL,            /* checkfile not needed */ \n            ftp_compress_open,\n            0,            /* create function not required */\n            mem_truncate,\n            mem_close_free,\n            0,            /* remove function not required */\n            mem_size,\n            0,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the ftpcompress:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n      /* === End of net drivers section === */  \n#endif\n\n/* ==================== SHARED MEMORY DRIVER SECTION ======================= */\n\n#ifdef HAVE_SHMEM_SERVICES\n\n    /* 22--------------------shared memory driver-----------------------*/\n    status = fits_register_driver(\"shmem://\", \n            smem_init,\n            smem_shutdown,\n            smem_setoptions,\n            smem_getoptions, \n            smem_getversion,\n            NULL,            /* checkfile not needed */ \n            smem_open,\n            smem_create,\n            NULL,            /* truncate file not supported yet */ \n            smem_close,\n            smem_remove,\n            smem_size,\n            smem_flush,\n            smem_seek,\n            smem_read,\n            smem_write );\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the shmem:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n#endif\n/* ==================== END OF SHARED MEMORY DRIVER SECTION ================ */\n\n\n#ifdef HAVE_GSIFTP\n    /* 23--------------------gsiftp driver-----------------------*/\n    status = fits_register_driver(\"gsiftp://\",\n            gsiftp_init,\n            gsiftp_shutdown,\n            gsiftp_setoptions,\n            gsiftp_getoptions, \n            gsiftp_getversion,\n            gsiftp_checkfile,\n            gsiftp_open,\n            gsiftp_create,\n#ifdef HAVE_FTRUNCATE\n            gsiftp_truncate,\n#else\n            NULL,\n#endif\n            gsiftp_close,\n            NULL,            /* remove function not yet implemented */\n            gsiftp_size,\n            gsiftp_flush,\n            gsiftp_seek,\n            gsiftp_read,\n            gsiftp_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the gsiftp:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n#endif\n\n    /* 24---------------stdin and stdout stream driver-------------------*/\n    status = fits_register_driver(\"stream://\", \n            NULL,\n            NULL,\n            NULL,\n            NULL, \n            NULL,\n\t    NULL,\n            stream_open,\n            stream_create,\n            NULL,   /* no stream truncate function */\n            stream_close,\n            NULL,   /* no stream remove */\n            stream_size,\n            stream_flush,\n            stream_seek,\n            stream_read,\n            stream_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the stream:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n#ifdef HAVE_NET_SERVICES\n\n    /* 25--------------------https  driver-----------------------*/\n    status = fits_register_driver(\"https://\",\n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            https_checkfile,\n            https_open,\n            NULL,            /* create function not required */\n            mem_truncate,\n            mem_close_free,\n            NULL,            /* remove function not required */\n            mem_size,\n            NULL,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the https:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 26--------------------https file driver-----------------------*/\n\n    status = fits_register_driver(\"httpsfile://\",\n            NULL,\n            file_shutdown,\n            file_setoptions,\n            file_getoptions, \n            file_getversion,\n            NULL,            /* checkfile not needed */ \n            https_file_open,\n            file_create,\n#ifdef HAVE_FTRUNCATE\n            file_truncate,\n#else\n            NULL,   /* no file truncate function */\n#endif\n            file_close,\n            file_remove,\n            file_size,\n            file_flush,\n            file_seek,\n            file_read,\n            file_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the httpsfile:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 27--------------------https memory driver-----------------------*/\n    /*  same as https:// driver, except memory file can be opened READWRITE */\n    status = fits_register_driver(\"httpsmem://\",\n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            https_checkfile,\n            https_file_open,  /* this will simply call https_open */\n            NULL,            /* create function not required */\n            mem_truncate,\n            mem_close_free,\n            NULL,            /* remove function not required */\n            mem_size,\n            NULL,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the httpsmem:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n      /* === End of https net drivers section === */  \n\n    /* 28--------------------ftps  driver-----------------------*/\n    status = fits_register_driver(\"ftps://\",\n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            ftps_checkfile,\n            ftps_open,\n            NULL,            \n            mem_truncate,\n            mem_close_free,\n            NULL,            \n            mem_size,\n            NULL,            \n            mem_seek,\n            mem_read,\n            mem_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the ftps:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 29--------------------ftps file driver-----------------------*/\n\n    status = fits_register_driver(\"ftpsfile://\",\n            NULL,\n            file_shutdown,\n            file_setoptions,\n            file_getoptions, \n            file_getversion,\n            NULL,             \n            ftps_file_open,\n            file_create,\n#ifdef HAVE_FTRUNCATE\n            file_truncate,\n#else\n            NULL,   \n#endif\n            file_close,\n            file_remove,\n            file_size,\n            file_flush,\n            file_seek,\n            file_read,\n            file_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the ftpsfile:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 30--------------------ftps memory driver-----------------------*/\n    /*  same as ftps:// driver, except memory file can be opened READWRITE */\n    status = fits_register_driver(\"ftpsmem://\",\n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            ftps_checkfile,\n            ftps_file_open,  \n            NULL,            \n            mem_truncate,\n            mem_close_free,\n            NULL,           \n            mem_size,\n            NULL,            \n            mem_seek,\n            mem_read,\n            mem_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the ftpsmem:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n\n    /* 31--------------------ftps compressed file driver------------------*/\n    status = fits_register_driver(\"ftpscompress://\",\n            NULL,\n            mem_shutdown,\n            mem_setoptions,\n            mem_getoptions, \n            mem_getversion,\n            NULL,            /* checkfile not needed */ \n            ftps_compress_open,\n            0,            /* create function not required */\n            mem_truncate,\n            mem_close_free,\n            0,            /* remove function not required */\n            mem_size,\n            0,            /* flush function not required */\n            mem_seek,\n            mem_read,\n            mem_write);\n\n    if (status)\n    {\n        ffpmsg(\"failed to register the ftpscompress:// driver (init_cfitsio)\");\n        FFUNLOCK;\n        return(status);\n    }\n#endif\n\n\n    /* reset flag.  Any other threads will now not need to call this routine */\n    need_to_initialize = 0;\n\n    FFUNLOCK;\n    return(status);\n}\n/*--------------------------------------------------------------------------*/\nint fits_register_driver(char *prefix,\n\tint (*init)(void),\n\tint (*shutdown)(void),\n\tint (*setoptions)(int option),\n\tint (*getoptions)(int *options),\n\tint (*getversion)(int *version),\n\tint (*checkfile) (char *urltype, char *infile, char *outfile),\n\tint (*open)(char *filename, int rwmode, int *driverhandle),\n\tint (*create)(char *filename, int *driverhandle),\n\tint (*truncate)(int driverhandle, LONGLONG filesize),\n\tint (*close)(int driverhandle),\n\tint (*fremove)(char *filename),\n        int (*size)(int driverhandle, LONGLONG *sizex),\n\tint (*flush)(int driverhandle),\n\tint (*seek)(int driverhandle, LONGLONG offset),\n\tint (*read) (int driverhandle, void *buffer, long nbytes),\n\tint (*write)(int driverhandle, void *buffer, long nbytes) )\n/*\n  register all the functions needed to support an I/O driver\n*/\n{\n    int status;\n \n    if (no_of_drivers < 0 ) {\n\t  /* This is bad. looks like memory has been corrupted. */\n\t  ffpmsg(\"Vital CFITSIO parameters held in memory have been corrupted!!\");\n\t  ffpmsg(\"Fatal condition detected in fits_register_driver.\");\n\t  return(TOO_MANY_DRIVERS);\n    }\n\n    if (no_of_drivers + 1 > MAX_DRIVERS)\n        return(TOO_MANY_DRIVERS);\n\n    if (prefix  == NULL)\n        return(BAD_URL_PREFIX);\n   \n\n    if (init != NULL)\t\t\n    { \n        status = (*init)();  /* initialize the driver */\n        if (status)\n            return(status);\n    }\n\n    \t/*  fill in data in table */\n    strncpy(driverTable[no_of_drivers].prefix, prefix, MAX_PREFIX_LEN);\n    driverTable[no_of_drivers].prefix[MAX_PREFIX_LEN - 1] = 0;\n    driverTable[no_of_drivers].init = init;\n    driverTable[no_of_drivers].shutdown = shutdown;\n    driverTable[no_of_drivers].setoptions = setoptions;\n    driverTable[no_of_drivers].getoptions = getoptions;\n    driverTable[no_of_drivers].getversion = getversion;\n    driverTable[no_of_drivers].checkfile = checkfile;\n    driverTable[no_of_drivers].open = open;\n    driverTable[no_of_drivers].create = create;\n    driverTable[no_of_drivers].truncate = truncate;\n    driverTable[no_of_drivers].close = close;\n    driverTable[no_of_drivers].remove = fremove;\n    driverTable[no_of_drivers].size = size;\n    driverTable[no_of_drivers].flush = flush;\n    driverTable[no_of_drivers].seek = seek;\n    driverTable[no_of_drivers].read = read;\n    driverTable[no_of_drivers].write = write;\n\n    no_of_drivers++;      /* increment the number of drivers */\n    return(0);\n }\n/*--------------------------------------------------------------------------*/\n/* fits_parse_input_url */\nint ffiurl(char *url,               /* input filename */\n           char *urltype,    /* e.g., 'file://', 'http://', 'mem://' */\n           char *infilex,    /* root filename (may be complete path) */\n           char *outfile,    /* optional output file name            */\n           char *extspec,    /* extension spec: +n or [extname, extver]  */\n           char *rowfilterx, /* boolean row filter expression */\n           char *binspec,    /* histogram binning specifier   */\n           char *colspec,    /* column or keyword modifier expression */\n           int *status)\n/*\n   parse the input URL into its basic components.\n   This routine does not support the pixfilter or compspec components.\n*/\n{\n\treturn ffifile2(url, urltype, infilex, outfile,\n               extspec, rowfilterx, binspec, colspec, 0, 0, status);\n}\n/*--------------------------------------------------------------------------*/\n/* fits_parse_input_file */\nint ffifile(char *url,       /* input filename */\n           char *urltype,    /* e.g., 'file://', 'http://', 'mem://' */\n           char *infilex,    /* root filename (may be complete path) */\n           char *outfile,    /* optional output file name            */\n           char *extspec,    /* extension spec: +n or [extname, extver]  */\n           char *rowfilterx, /* boolean row filter expression */\n           char *binspec,    /* histogram binning specifier   */\n           char *colspec,    /* column or keyword modifier expression */\n           char *pixfilter,  /* pixel filter expression */\n           int *status)\n/*\n   fits_parse_input_filename\n   parse the input URL into its basic components.\n   This routine does not support the compspec component.\n*/\n{\n\treturn ffifile2(url, urltype, infilex, outfile,\n               extspec, rowfilterx, binspec, colspec, pixfilter, 0, status);\n\n} \n/*--------------------------------------------------------------------------*/\nint ffifile2(char *url,       /* input filename */\n           char *urltype,    /* e.g., 'file://', 'http://', 'mem://' */\n           char *infilex,    /* root filename (may be complete path) */\n           char *outfile,    /* optional output file name            */\n           char *extspec,    /* extension spec: +n or [extname, extver]  */\n           char *rowfilterx, /* boolean row filter expression */\n           char *binspec,    /* histogram binning specifier   */\n           char *colspec,    /* column or keyword modifier expression */\n           char *pixfilter,  /* pixel filter expression */\n           char *compspec,   /* image compression specification */\n           int *status)\n/*\n   fits_parse_input_filename\n   parse the input URL into its basic components.\n   This routine is big and ugly and should be redesigned someday!\n*/\n{ \n    int ii, jj, slen, infilelen, plus_ext = 0, collen;\n    char *ptr1, *ptr2, *ptr3, *ptr4, *tmptr;\n    int hasAt, hasDot, hasOper, followingOper, spaceTerm, rowFilter;\n    int colStart, binStart, pixStart, compStart;\n\n    /* must have temporary variable for these, in case inputs are NULL */\n    char *infile;\n    char *rowfilter;\n    char *tmpstr;\n\n    if (*status > 0)\n        return(*status);\n\n    /* Initialize null strings */\n    if (infilex) *infilex  = '\\0';\n    if (urltype) *urltype = '\\0';\n    if (outfile) *outfile = '\\0';\n    if (extspec) *extspec = '\\0';\n    if (binspec) *binspec = '\\0';\n    if (colspec) *colspec = '\\0';\n    if (rowfilterx) *rowfilterx = '\\0';\n    if (pixfilter) *pixfilter = '\\0';\n    if (compspec) *compspec = '\\0';\n    slen = strlen(url);\n\n    if (slen == 0)       /* blank filename ?? */\n        return(*status);\n\n    /* allocate memory for 3 strings, each as long as the input url */\n    infile = (char *) calloc(3,  slen + 1);\n    if (!infile)\n       return(*status = MEMORY_ALLOCATION);\n\n    rowfilter = &infile[slen + 1];\n    tmpstr = &rowfilter[slen + 1];\n\n    ptr1 = url;\n\n    /* -------------------------------------------------------- */\n    /*  get urltype (e.g., file://, ftp://, http://, etc.)  */\n    /* --------------------------------------------------------- */\n\n    if (*ptr1 == '-' && ( *(ptr1 +1) ==  0   || *(ptr1 +1) == ' '  || \n                          *(ptr1 +1) == '['  || *(ptr1 +1) == '(' ) )\n    {\n        /* \"-\" means read file from stdin. Also support \"- \",        */\n        /* \"-[extname]\" and '-(outfile.fits)\" but exclude disk file  */\n        /* names that begin with a minus sign, e.g., \"-55d33m.fits\"  */\n\n        if (urltype)\n            strcat(urltype, \"stdin://\");\n        ptr1++;\n    }\n    else if (!fits_strncasecmp(ptr1, \"stdin\", 5))\n    {\n        if (urltype)\n            strcat(urltype, \"stdin://\");\n        ptr1 = ptr1 + 5;\n    }\n    else\n    {\n        ptr2 = strstr(ptr1, \"://\");\n        ptr3 = strstr(ptr1, \"(\" );\n\n        if (ptr3 && (ptr3 < ptr2) )\n        {\n           /* the urltype follows a '(' character, so it must apply */\n           /* to the output file, and is not the urltype of the input file */\n           ptr2 = 0;   /* so reset pointer to zero */\n        }\n        \n        if (ptr2)            /* copy the explicit urltype string */ \n        {\n            if (ptr2-ptr1+3 >= MAX_PREFIX_LEN)\n            {\n               ffpmsg(\"Name of urltype is too long.\");\n               return(*status = URL_PARSE_ERROR);\n            }\n            if (urltype)\n                 strncat(urltype, ptr1, ptr2 - ptr1 + 3);\n            ptr1 = ptr2 + 3;\n        }\n        else if (!strncmp(ptr1, \"ftp:\", 4) )\n        {                              /* the 2 //'s are optional */\n            if (urltype)\n                strcat(urltype, \"ftp://\");\n            ptr1 += 4;\n        }\n        else if (!strncmp(ptr1, \"gsiftp:\", 7) )\n        {                              /* the 2 //'s are optional */\n            if (urltype)\n                strcat(urltype, \"gsiftp://\");\n            ptr1 += 7;\n        }\n        else if (!strncmp(ptr1, \"http:\", 5) )\n        {                              /* the 2 //'s are optional */\n            if (urltype)\n                strcat(urltype, \"http://\");\n            ptr1 += 5;\n        }\n        else if (!strncmp(ptr1, \"mem:\", 4) )\n        {                              /* the 2 //'s are optional */\n            if (urltype)\n                strcat(urltype, \"mem://\");\n            ptr1 += 4;\n        }\n        else if (!strncmp(ptr1, \"shmem:\", 6) )\n        {                              /* the 2 //'s are optional */\n            if (urltype)\n                strcat(urltype, \"shmem://\");\n            ptr1 += 6;\n        }\n        else if (!strncmp(ptr1, \"file:\", 5) )\n        {                              /* the 2 //'s are optional */\n            if (urltype)\n                strcat(urltype, \"file://\");\n            ptr1 += 5;\n        }\n        else                       /* assume file driver    */\n        {\n            if (urltype)\n                strcat(urltype, \"file://\");\n        }\n    }\n\n    /* ----------------------------------------------------------    \n       If this is a http:// type file, then the cgi file name could\n       include the '[' character, which should not be interpreted\n       as part of CFITSIO's Extended File Name Syntax.  Test for this\n       case by seeing if the last character is a ']' or ')'.  If it \n       is not, then just treat the whole input string as the file name\n       and do not attempt to interprete the name using the extended\n       filename syntax.\n     ----------------------------------------------------------- */\n\n    if (urltype && !strncmp(urltype, \"http://\", 7) )\n    {\n        /* test for opening parenthesis or bracket in the file name */\n        if( strchr(ptr1, '(' ) || strchr(ptr1, '[' ) )\n        {\n            slen = strlen(ptr1);\n            ptr3 = ptr1 + slen - 1;\n            while (*ptr3 == ' ')    /* ignore trailing blanks */\n                ptr3--;\n\n            if (*ptr3 != ']' && *ptr3 != ')' )\n            {\n                /* name doesn't end with a ']' or ')' so don't try */\n                /* to parse this unusual string (may be cgi string)  */\n                if (infilex) {\n\n                    if (strlen(ptr1) > FLEN_FILENAME - 1) {\n                        ffpmsg(\"Name of file is too long.\");\n                        return(*status = URL_PARSE_ERROR);\n                    }\n\t\t    \n                    strcpy(infilex, ptr1);\n                }\n\n                free(infile);\n                return(*status);\n            }\n        }\n    }\n\n    /* ----------------------------------------------------------    \n       Look for VMS style filenames like: \n            disk:[directory.subdirectory]filename.ext, or\n                 [directory.subdirectory]filename.ext\n\n       Check if the first character is a '[' and urltype != stdin\n       or if there is a ':[' string in the remaining url string. If\n       so, then need to move past this bracket character before\n       search for the opening bracket of a filter specification.\n     ----------------------------------------------------------- */\n\n    tmptr = ptr1;\n    if (*ptr1 == '[')\n    {\n      if (*url != '-') \n        tmptr = ptr1 + 1; /* this bracket encloses a VMS directory name */\n    }\n    else\n    {\n       tmptr = strstr(ptr1, \":[\");\n       if (tmptr) /* these 2 chars are part of the VMS disk and directory */\n          tmptr += 2; \n       else\n          tmptr = ptr1;\n    }\n\n    /* ------------------------ */\n    /*  get the input file name */\n    /* ------------------------ */\n\n    ptr2 = strchr(tmptr, '(');   /* search for opening parenthesis ( */\n    ptr3 = strchr(tmptr, '[');   /* search for opening bracket [ */\n    if (ptr2)\n    {\n       ptr4 = strchr(ptr2, ')'); /* search for closing parenthesis ) */\n       while (ptr4 && ptr2)\n       {\n          do {\n             ++ptr4;\n          } while (*ptr4 == ' '); /* find next non-blank char after ')' */\n          if (*ptr4 == 0 || *ptr4 == '[')\n             break;\n          ptr2 = strchr(ptr2+1, '(');\n          ptr4 = strchr(ptr4, ')');\n       }\n    }\n\n    if (ptr2 == ptr3)  /* simple case: no [ or ( in the file name */\n    {\n        strcat(infile, ptr1);\n    }\n    else if (!ptr3 ||         /* no bracket, so () enclose output file name */\n         (ptr2 && (ptr2 < ptr3)) ) /* () enclose output name before bracket */\n    {\n        strncat(infile, ptr1, ptr2 - ptr1);\n        ptr2++;\n\n        ptr1 = strchr(ptr2, ')' );   /* search for closing ) */\n        if (!ptr1)\n        {\n            free(infile);\n            return(*status = URL_PARSE_ERROR);  /* error, no closing ) */\n        }\n\n        if (outfile) {\n\t\n\t    if (ptr1 - ptr2 > FLEN_FILENAME - 1)\n\t    {\n                 free(infile);\n                 return(*status = URL_PARSE_ERROR);\n            }\n\n            strncat(outfile, ptr2, ptr1 - ptr2);\n        }\n\t\n        /* the opening [ could have been part of output name,    */\n        /*      e.g., file(out[compress])[3][#row > 5]           */\n        /* so search again for opening bracket following the closing ) */\n        ptr3 = strchr(ptr1, '[');\n\n    }\n    else    /*   bracket comes first, so there is no output name */\n    {\n        strncat(infile, ptr1, ptr3 - ptr1);\n    }\n\n   /* strip off any trailing blanks in the names */\n\n    slen = strlen(infile);\n    while ( (--slen) > 0  && infile[slen] == ' ') \n         infile[slen] = '\\0';\n\n    if (outfile)\n    {\n        slen = strlen(outfile);\n        while ( (--slen) > 0  && outfile[slen] == ' ') \n            outfile[slen] = '\\0';\n    }\n\n    /* --------------------------------------------- */\n    /* check if this is an IRAF file (.imh extension */\n    /* --------------------------------------------- */\n\n    ptr4 = strstr(infile, \".imh\");\n\n    /* did the infile name end with \".imh\" ? */\n    if (ptr4 && (*(ptr4 + 4) == '\\0'))\n    {\n        if (urltype)\n            strcpy(urltype, \"irafmem://\");\n    }\n\n    /* --------------------------------------------- */\n    /* check if the 'filename+n' convention has been */\n    /* used to specifiy which HDU number to open     */ \n    /* --------------------------------------------- */\n\n    jj = strlen(infile);\n\n    for (ii = jj - 1; ii >= 0; ii--)\n    {\n        if (infile[ii] == '+')    /* search backwards for '+' sign */\n            break;\n    }\n\n    if (ii > 0 && (jj - ii) < 7)  /* limit extension numbers to 5 digits */\n    {\n        infilelen = ii;\n        ii++;\n        ptr1 = infile+ii;   /* pointer to start of sequence */\n\n        for (; ii < jj; ii++)\n        {\n            if (!isdigit((int) infile[ii] ) ) /* are all the chars digits? */\n                break;\n        }\n\n        if (ii == jj)      \n        {\n             /* yes, the '+n' convention was used.  Copy */\n             /* the digits to the output extspec string. */\n             plus_ext = 1;\n\n             if (extspec) {\n\t         if (jj - infilelen > FLEN_FILENAME - 1)\n\t         {\n                     free(infile);\n                     return(*status = URL_PARSE_ERROR);\n                 }\n\n                 strncpy(extspec, ptr1, jj - infilelen);\n             }\n\t     \n             infile[infilelen] = '\\0'; /* delete the extension number */\n        }\n    }\n\n    /* -------------------------------------------------------------------- */\n    /* if '*' was given for the output name expand it to the root file name */\n    /* -------------------------------------------------------------------- */\n\n    if (outfile && outfile[0] == '*')\n    {\n        /* scan input name backwards to the first '/' character */\n        for (ii = jj - 1; ii >= 0; ii--)\n        {\n            if (infile[ii] == '/' || ii == 0)\n            {\n\t      if (strlen(&infile[ii + 1]) > FLEN_FILENAME - 1)\n\t      {\n                 free(infile);\n                 return(*status = URL_PARSE_ERROR);\n              }\n\n                strcpy(outfile, &infile[ii + 1]);\n                break;\n            }\n        }\n    }\n\n    /* ------------------------------------------ */\n    /* copy strings from local copy to the output */\n    /* ------------------------------------------ */\n    if (infilex) {\n\tif (strlen(infile) > FLEN_FILENAME - 1)\n\t{\n                 free(infile);\n                 return(*status = URL_PARSE_ERROR);\n        }\n\n        strcpy(infilex, infile);\n    }\n    /* ---------------------------------------------------------- */\n    /* if no '[' character in the input string, then we are done. */\n    /* ---------------------------------------------------------- */\n    if (!ptr3) \n    {\n        free(infile);\n        return(*status);\n    }\n\n    /* ------------------------------------------- */\n    /* see if [ extension specification ] is given */\n    /* ------------------------------------------- */\n\n    if (!plus_ext) /* extension no. not already specified?  Then      */\n                   /* first brackets must enclose extension name or # */\n                   /* or it encloses a image subsection specification */\n                   /* or a raw binary image specifier */\n                   /* or a image compression specifier */\n\n                   /* Or, the extension specification may have been */\n                   /* omitted and we have to guess what the user intended */\n    {\n       ptr1 = ptr3 + 1;    /* pointer to first char after the [ */\n\n       ptr2 = strchr(ptr1, ']' );   /* search for closing ] */\n       if (!ptr2)\n       {\n            ffpmsg(\"input file URL is missing closing bracket ']'\");\n            free(infile);\n            return(*status = URL_PARSE_ERROR);  /* error, no closing ] */\n       }\n\n       /* ---------------------------------------------- */\n       /* First, test if this is a rawfile specifier     */\n       /* which looks something like: '[ib512,512:2880]' */\n       /* Test if first character is b,i,j,d,r,f, or u,  */\n       /* and optional second character is b or l,       */\n       /* followed by one or more digits,                */\n       /* finally followed by a ',', ':', or ']'         */\n       /* ---------------------------------------------- */\n\n       if (*ptr1 == 'b' || *ptr1 == 'B' || *ptr1 == 'i' || *ptr1 == 'I' ||\n           *ptr1 == 'j' || *ptr1 == 'J' || *ptr1 == 'd' || *ptr1 == 'D' ||\n           *ptr1 == 'r' || *ptr1 == 'R' || *ptr1 == 'f' || *ptr1 == 'F' ||\n           *ptr1 == 'u' || *ptr1 == 'U')\n       {\n           /* next optional character may be a b or l (for Big or Little) */\n           ptr1++;\n           if (*ptr1 == 'b' || *ptr1 == 'B' || *ptr1 == 'l' || *ptr1 == 'L')\n              ptr1++;\n\n           if (isdigit((int) *ptr1))  /* must have at least 1 digit */\n           {\n             while (isdigit((int) *ptr1))\n              ptr1++;             /* skip over digits */\n\n             if (*ptr1 == ',' || *ptr1 == ':' || *ptr1 == ']' )\n             {\n               /* OK, this looks like a rawfile specifier */\n\n               if (urltype)\n               {\n                 if (strstr(urltype, \"stdin\") )\n                   strcpy(urltype, \"rawstdin://\");\n                 else\n                   strcpy(urltype, \"rawfile://\");\n               }\n\n               /* append the raw array specifier to infilex */\n               if (infilex)\n               {\n\n\t         if (strlen(infilex) + strlen(ptr3) > FLEN_FILENAME - 1)\n\t         {\n                    free(infile);\n                    return(*status = URL_PARSE_ERROR);\n                 }\n\n                 strcat(infilex, ptr3);\n                 ptr1 = strchr(infilex, ']'); /* find the closing ] char */\n                 if (ptr1)\n                   *(ptr1 + 1) = '\\0';  /* terminate string after the ] */\n               }\n\n               if (extspec)\n                  strcpy(extspec, \"0\"); /* the 0 ext number is implicit */\n\n               tmptr = strchr(ptr2 + 1, '[' ); /* search for another [ char */ \n\n               /* copy any remaining characters into rowfilterx  */\n               if (tmptr && rowfilterx)\n               {\n\n\n\t         if (strlen(rowfilterx) + strlen(tmptr + 1) > FLEN_FILENAME -1)\n\t         {\n                    free(infile);\n                    return(*status = URL_PARSE_ERROR);\n                 }\n\n                 strcat(rowfilterx, tmptr + 1);\n\n                 tmptr = strchr(rowfilterx, ']' );   /* search for closing ] */\n                 if (tmptr)\n                   *tmptr = '\\0'; /* overwrite the ] with null terminator */\n               }\n\n               free(infile);        /* finished parsing, so return */\n               return(*status);\n             }\n           }   \n       }        /* end of rawfile specifier test */\n\n       /* -------------------------------------------------------- */\n       /* Not a rawfile, so next, test if this is an image section */\n       /* i.e., an integer followed by a ':' or a '*' or '-*'      */\n       /* -------------------------------------------------------- */\n \n       ptr1 = ptr3 + 1;    /* reset pointer to first char after the [ */\n       tmptr = ptr1;\n\n       while (*tmptr == ' ')\n          tmptr++;   /* skip leading blanks */\n\n       while (isdigit((int) *tmptr))\n          tmptr++;             /* skip over leading digits */\n\n       if (*tmptr == ':' || *tmptr == '*' || *tmptr == '-')\n       {\n           /* this is an image section specifier */\n           strcat(rowfilter, ptr3);\n/*\n  don't want to assume 0 extension any more; may imply an image extension.\n           if (extspec)\n              strcpy(extspec, \"0\");\n*/\n       }\n       else\n       {\n       /* ----------------------------------------------------------------- \n         Not an image section or rawfile spec so may be an extension spec. \n\n         Examples of valid extension specifiers:\n            [3]                - 3rd extension; 0 = primary array\n            [events]           - events extension\n            [events, 2]        - events extension, with EXTVER = 2\n            [events,2]         - spaces are optional\n            [events, 3, b]     - same as above, plus XTENSION = 'BINTABLE'\n            [PICS; colName(12)] - an image in row 12 of the colName column\n                                      in the PICS table extension             \n            [PICS; colName(exposure > 1000)] - as above, but find image in\n                          first row with with exposure column value > 1000.\n            [Rate Table] - extension name can contain spaces!\n            [Rate Table;colName(exposure>1000)]\n\n         Examples of other types of specifiers (Not extension specifiers)\n\n            [bin]  !!! this is ambiguous, and can't be distinguished from\n                       a valid extension specifier\n            [bini X=1:512:16]  (also binb, binj, binr, and bind are allowed)\n            [binr (X,Y) = 5]\n            [bin @binfilter.txt]\n\n            [col Time;rate]\n            [col PI=PHA * 1.1]\n            [col -Time; status]\n\n            [X > 5]\n            [X>5]\n            [@filter.txt]\n            [StatusCol]  !!! this is ambiguous, and can't be distinguished\n                       from a valid extension specifier\n            [StatusCol==0]\n            [StatusCol || x>6]\n            [gtifilter()]\n            [regfilter(\"region.reg\")]\n\n            [compress Rice]\n\n         There will always be some ambiguity between an extension name and \n         a boolean row filtering expression, (as in a couple of the above\n         examples).  If there is any doubt, the expression should be treated\n         as an extension specification;  The user can always add an explicit\n         expression specifier to override this interpretation.\n\n         The following decision logic will be used:\n\n         1) locate the first token, terminated with a space, comma, \n            semi-colon, or closing bracket.\n\n         2) the token is not part of an extension specifier if any of\n            the following is true:\n\n            - if the token begins with '@' and contains a '.'\n            - if the token contains an operator: = > < || && \n            - if the token begins with \"gtifilter(\" or \"regfilter(\" \n            - if the token is terminated by a space and is followed by\n               additional characters (not a ']')  AND any of the following:\n                 - the token is 'col'\n                 - the token is 3 or 4 chars long and begins with 'bin'\n                 - the second token begins with an operator:\n                     ! = < > | & + - * / %\n                 \n\n         3) otherwise, the string is assumed to be an extension specifier\n\n         ----------------------------------------------------------------- */\n\n           tmptr = ptr1;\n           while(*tmptr == ' ')\n               tmptr++;\n\n           hasAt = 0;\n           hasDot = 0;\n           hasOper = 0;\n           followingOper = 0;\n           spaceTerm = 0;\n           rowFilter = 0;\n           colStart = 0;\n           binStart = 0;\n           pixStart = 0;\n           compStart = 0;\n\n           if (*tmptr == '@')  /* test for leading @ symbol */\n               hasAt = 1;\n\n           if ( !fits_strncasecmp(tmptr, \"col \", 4) )\n              colStart = 1;\n\n           if ( !fits_strncasecmp(tmptr, \"bin\", 3) )\n              binStart = 1;\n\n           if ( !fits_strncasecmp(tmptr, \"pix\", 3) )\n              pixStart = 1;\n\n           if ( !fits_strncasecmp(tmptr, \"compress \", 9) ||\n                !fits_strncasecmp(tmptr, \"compress]\", 9) )\n              compStart = 1;\n\n           if ( !fits_strncasecmp(tmptr, \"gtifilter(\", 10) ||\n                !fits_strncasecmp(tmptr, \"regfilter(\", 10) )\n           {\n               rowFilter = 1;\n           }\n           else\n           {\n             /* parse the first token of the expression */\n             for (ii = 0; ii < ptr2 - ptr1 + 1; ii++, tmptr++)\n             {\n               if (*tmptr == '.')\n                   hasDot = 1;\n               else if (*tmptr == '=' || *tmptr == '>' || *tmptr == '<' ||\n                   (*tmptr == '|' && *(tmptr+1) == '|') ||\n                   (*tmptr == '&' && *(tmptr+1) == '&') )\n                   hasOper = 1;\n\n               else if (*tmptr == ',' || *tmptr == ';' || *tmptr == ']')\n               {\n                  break;\n               }\n               else if (*tmptr == ' ')   /* a space char? */\n               {\n                  while(*tmptr == ' ')  /* skip spaces */\n                    tmptr++;\n\n                  if (*tmptr == ']') /* is this the end? */\n                     break;  \n\n                  spaceTerm = 1; /* 1st token is terminated by space */\n\n                  /* test if this is a column or binning specifier */\n                  if (colStart || (ii <= 4 && (binStart || pixStart)) )\n                     rowFilter = 1;\n                  else\n                  {\n  \n                    /* check if next character is an operator */\n                    if (*tmptr == '=' || *tmptr == '>' || *tmptr == '<' ||\n                      *tmptr == '|' || *tmptr == '&' || *tmptr == '!' ||\n                      *tmptr == '+' || *tmptr == '-' || *tmptr == '*' ||\n                      *tmptr == '/' || *tmptr == '%')\n                       followingOper = 1;\n                  }\n                  break;\n               }\n             }\n           }\n\n           /* test if this is NOT an extension specifier */\n           if ( rowFilter || (pixStart && spaceTerm) ||\n                (hasAt && hasDot) ||\n                hasOper ||\n                compStart ||\n                (spaceTerm && followingOper) )\n           {\n               /* this is (probably) not an extension specifier */\n               /* so copy all chars to filter spec string */\n               strcat(rowfilter, ptr3);\n           }\n           else\n           {\n               /* this appears to be a legit extension specifier */\n               /* copy the extension specification */\n               if (extspec) {\n                   if (ptr2 - ptr1 > FLEN_FILENAME - 1) {\n                       free(infile);\n                       return(*status = URL_PARSE_ERROR);\n\t\t   }\n                   strncat(extspec, ptr1, ptr2 - ptr1);\n               }\n\n               /* copy any remaining chars to filter spec string */\n               strcat(rowfilter, ptr2 + 1);\n           }\n       }\n    }      /* end of  if (!plus_ext)     */\n    else   \n    {\n      /* ------------------------------------------------------------------ */\n      /* already have extension, so this must be a filter spec of some sort */\n      /* ------------------------------------------------------------------ */\n\n        strcat(rowfilter, ptr3);\n    }\n\n    /* strip off any trailing blanks from filter */\n    slen = strlen(rowfilter);\n    while ( (--slen) >= 0  && rowfilter[slen] == ' ') \n         rowfilter[slen] = '\\0';\n\n    if (!rowfilter[0])\n    {\n        free(infile);\n        return(*status);      /* nothing left to parse */\n    }\n\n    /* ------------------------------------------------ */\n    /* does the filter contain a binning specification? */\n    /* ------------------------------------------------ */\n\n    ptr1 = strstr(rowfilter, \"[bin\");      /* search for \"[bin\" */\n    if (!ptr1)\n        ptr1 = strstr(rowfilter, \"[BIN\");      /* search for \"[BIN\" */\n    if (!ptr1)\n        ptr1 = strstr(rowfilter, \"[Bin\");      /* search for \"[Bin\" */\n\n    if (ptr1)\n    {\n      ptr2 = ptr1 + 4;     /* end of the '[bin' string */\n      if (*ptr2 == 'b' || *ptr2 == 'i' || *ptr2 == 'j' ||\n          *ptr2 == 'r' || *ptr2 == 'd')\n         ptr2++;  /* skip the datatype code letter */\n\n\n      if ( *ptr2 != ' ' && *ptr2 != ']')\n        ptr1 = NULL;   /* bin string must be followed by space or ] */\n    }\n\n    if (ptr1)\n    {\n        /* found the binning string */\n        if (binspec)\n        {\n\t    if (strlen(ptr1 +1) > FLEN_FILENAME - 1)\n\t    {\n                    free(infile);\n                    return(*status = URL_PARSE_ERROR);\n            }\n\n            strcpy(binspec, ptr1 + 1);       \n            ptr2 = strchr(binspec, ']');\n\n            if (ptr2)      /* terminate the binning filter */\n            {\n                *ptr2 = '\\0';\n\n                if ( *(--ptr2) == ' ')  /* delete trailing spaces */\n                    *ptr2 = '\\0';\n            }\n            else\n            {\n                ffpmsg(\"input file URL is missing closing bracket ']'\");\n                ffpmsg(rowfilter);\n                free(infile);\n                return(*status = URL_PARSE_ERROR);  /* error, no closing ] */\n            }\n        }\n\n        /* delete the binning spec from the row filter string */\n        ptr2 = strchr(ptr1, ']');\n        strcpy(tmpstr, ptr2+1);  /* copy any chars after the binspec */\n        strcpy(ptr1, tmpstr);    /* overwrite binspec */\n    }\n\n    /* --------------------------------------------------------- */\n    /* does the filter contain a column selection specification? */\n    /* --------------------------------------------------------- */\n\n    ptr1 = strstr(rowfilter, \"[col \");\n    if (!ptr1)\n    {\n        ptr1 = strstr(rowfilter, \"[COL \");\n\n        if (!ptr1)\n            ptr1 = strstr(rowfilter, \"[Col \");\n    }\n\n    hasAt = 0;\n    while (ptr1) {\n\n        /* find the end of the column specifier */\n        ptr2 = ptr1 + 5;\n\t/* Scan past any whitespace and check for @filename */\n\twhile (*ptr2 == ' ') ptr2++;\n\tif (*ptr2 == '@') hasAt = 1;\n\n        while (*ptr2 != ']') {\n\n            if (*ptr2 == '\\0')\n            {\n                ffpmsg(\"input file URL is missing closing bracket ']'\");\n                free(infile);\n                return(*status = URL_PARSE_ERROR);  /* error, no closing ] */\n            }\n\n            if (*ptr2 == '\\'')  /* start of a literal string */\n            {\n                ptr2 = strchr(ptr2 + 1, '\\'');  /* find closing quote */\n                if (!ptr2)\n                {\n                  ffpmsg\n          (\"literal string in input file URL is missing closing single quote\");\n                  free(infile);\n                  return(*status = URL_PARSE_ERROR);  /* error, no closing ] */\n                }\n            }\n\n            if (*ptr2 == '[')  /* set of nested square brackets */\n            {\n                ptr2 = strchr(ptr2 + 1, ']');  /* find closing bracket */\n                if (!ptr2)\n                {\n                  ffpmsg\n          (\"nested brackets in input file URL is missing closing bracket\");\n                  free(infile);\n                  return(*status = URL_PARSE_ERROR);  /* error, no closing ] */\n                }\n            }\n\n            ptr2++;  /* continue search for the closing bracket character */\n        } \n\n        collen = ptr2 - ptr1 - 1;\n\n        if (colspec) {   /* copy the column specifier to output string */\n\n            if (collen + strlen(colspec) > FLEN_FILENAME - 1) {\n\t        free(infile);\n\t        return(*status = URL_PARSE_ERROR);\n            }\n\t    \n\t    if (*colspec == 0) {\n\t        strncpy(colspec, ptr1 + 1, collen);\n\t        colspec[collen] = '\\0';\n\t    } else { /* Pre-existing colspec, append with \";\" */\n\t        strcat(colspec, \";\");\n\t        strncat(colspec, ptr1 + 5, collen-4); \n\t\t/* Note that strncat always null-terminates the destination string */\n\n\t\t/* Special error checking here.  We can't allow there to be a\n\t\t   col @filename.txt includes if there are multiple col expressions */\n\t\tif (hasAt) {\n\t\t  ffpmsg(\"input URL multiple column filter cannot use @filename.txt\");\n\t\t  free(infile);\n\t\t  return(*status = URL_PARSE_ERROR);\n\t\t}\n\n\t    }\n\n\t    collen = strlen(colspec);\n            while (colspec[--collen] == ' ')\n                colspec[collen] = '\\0';  /* strip trailing blanks */\n        }\n\n        /* delete the column selection spec from the row filter string */\n        strcpy(tmpstr, ptr2 + 1);  /* copy any chars after the colspec */\n        strcpy(ptr1, tmpstr);      /* overwrite binspec */\n\n\t/* Check for additional column specifiers */\n\tptr1 = strstr(rowfilter, \"[col \");\n\tif (!ptr1) ptr1 = strstr(rowfilter, \"[COL \");\n\tif (!ptr1) ptr1 = strstr(rowfilter, \"[Col \");\n    }\n\n    /* --------------------------------------------------------- */\n    /* does the filter contain a pixel filter specification?     */\n    /* --------------------------------------------------------- */\n\n    ptr1 = strstr(rowfilter, \"[pix\");\n    if (!ptr1)\n    {\n        ptr1 = strstr(rowfilter, \"[PIX\");\n\n        if (!ptr1)\n            ptr1 = strstr(rowfilter, \"[Pix\");\n    }\n\n    if (ptr1)\n    {\n      ptr2 = ptr1 + 4;     /* end of the '[pix' string */\n      if (*ptr2 == 'b' || *ptr2 == 'i' || *ptr2 == 'j' || *ptr2 == 'B' ||\n          *ptr2 == 'I' || *ptr2 == 'J' || *ptr2 == 'r' || *ptr2 == 'd' ||\n           *ptr2 == 'R' || *ptr2 == 'D')\n         ptr2++;  /* skip the datatype code letter */\n\n      if (*ptr2 == '1')\n         ptr2++;   /* skip the single HDU indicator */\n\n      if ( *ptr2 != ' ')\n        ptr1 = NULL;   /* pix string must be followed by space */\n    }\n\n    if (ptr1)\n    {           /* find the end of the pixel filter */\n        while (*ptr2 != ']')\n        {\n            if (*ptr2 == '\\0')\n            {\n                ffpmsg(\"input file URL is missing closing bracket ']'\");\n                free(infile);\n                return(*status = URL_PARSE_ERROR);  /* error, no closing ] */\n            }\n\n            if (*ptr2 == '\\'')  /* start of a literal string */\n            {\n                ptr2 = strchr(ptr2 + 1, '\\'');  /* find closing quote */\n                if (!ptr2)\n                {\n                  ffpmsg\n          (\"literal string in input file URL is missing closing single quote\");\n                  free(infile);\n                  return(*status = URL_PARSE_ERROR);  /* error, no closing ] */\n                }\n            }\n\n            if (*ptr2 == '[')  /* set of nested square brackets */\n            {\n                ptr2 = strchr(ptr2 + 1, ']');  /* find closing bracket */\n                if (!ptr2)\n                {\n                  ffpmsg\n          (\"nested brackets in input file URL is missing closing bracket\");\n                  free(infile);\n                  return(*status = URL_PARSE_ERROR);  /* error, no closing ] */\n                }\n            }\n\n            ptr2++;  /* continue search for the closing bracket character */\n        } \n\n        collen = ptr2 - ptr1 - 1;\n\n        if (pixfilter)    /* copy the column specifier to output string */\n        {\n            if (collen > FLEN_FILENAME - 1) {\n                       free(infile);\n                       return(*status = URL_PARSE_ERROR);\n            }\n\n            strncpy(pixfilter, ptr1 + 1, collen);       \n            pixfilter[collen] = '\\0';\n \n            while (pixfilter[--collen] == ' ')\n                pixfilter[collen] = '\\0';  /* strip trailing blanks */\n        }\n\n        /* delete the pixel filter from the row filter string */\n        strcpy(tmpstr, ptr2 + 1);  /* copy any chars after the pixel filter */\n        strcpy(ptr1, tmpstr);      /* overwrite binspec */\n    }\n\n    /* ------------------------------------------------------------ */\n    /* does the filter contain an image compression specification?  */\n    /* ------------------------------------------------------------ */\n\n    ptr1 = strstr(rowfilter, \"[compress\");\n\n    if (ptr1)\n    {\n      ptr2 = ptr1 + 9;     /* end of the '[compress' string */\n\n      if ( *ptr2 != ' ' && *ptr2 != ']')\n        ptr1 = NULL;   /* compress string must be followed by space or ] */\n    }\n\n    if (ptr1)\n    {\n        /* found the compress string */\n        if (compspec)\n        {\n\t    if (strlen(ptr1 +1) > FLEN_FILENAME - 1)\n\t    {\n                    free(infile);\n                    return(*status = URL_PARSE_ERROR);\n            }\n\n            strcpy(compspec, ptr1 + 1);       \n            ptr2 = strchr(compspec, ']');\n\n            if (ptr2)      /* terminate the binning filter */\n            {\n                *ptr2 = '\\0';\n\n                if ( *(--ptr2) == ' ')  /* delete trailing spaces */\n                    *ptr2 = '\\0';\n            }\n            else\n            {\n                ffpmsg(\"input file URL is missing closing bracket ']'\");\n                ffpmsg(rowfilter);\n                free(infile);\n                return(*status = URL_PARSE_ERROR);  /* error, no closing ] */\n            }\n        }\n\n        /* delete the compression spec from the row filter string */\n        ptr2 = strchr(ptr1, ']');\n        strcpy(tmpstr, ptr2+1);  /* copy any chars after the binspec */\n        strcpy(ptr1, tmpstr);    /* overwrite binspec */\n    }\n   \n    /* copy the remaining string to the rowfilter output... should only */\n    /* contain a rowfilter expression of the form \"[expr]\"              */\n\n    if (rowfilterx && rowfilter[0]) {\n      hasAt = 0;\n\n      /* Check for multiple expressions, which would appear as \"[expr][expr]...\" */\n      ptr1 = rowfilter;\n      while((*ptr1 == '[') && (ptr2 = strstr(rowfilter,\"][\"))-ptr1 > 2) {\n\t /* Advance past any white space */\n\t ptr3 = ptr1+1;\n\t while (*ptr3 == ' ') ptr3++;\n\t /* Check for @filename.txt */\n\t if (*ptr3 == '@') hasAt = 1;\n\n\t /* Add expression of the form \"((expr))&&\", note the addition of 6 characters */\n\t if ((strlen(rowfilterx) + (ptr2-ptr1) + 6) > FLEN_FILENAME - 1) {\n\t   free(infile);\n\t   return (*status = URL_PARSE_ERROR);\n\t }\n\n\t /* Special error checking here.  We can't allow there to be a\n\t    @filename.txt includes if there are multiple row expressions */\n\t if (*rowfilterx && hasAt) {\n\t   ffpmsg(\"input URL multiple row filter cannot use @filename.txt\");\n\t   free(infile);\n\t   return(*status = URL_PARSE_ERROR);\n\t }\n\n\t /* Append the expression */\n\t strcat(rowfilterx, \"((\");\n\t strncat(rowfilterx, ptr1+1, (ptr2-ptr1-1));\n\t /* Note that strncat always null-terminates the destination string */\n\t strcat(rowfilterx, \"))&&\");\n\n\t /* Advance to next expression */\n\t ptr1 = ptr2 + 1;\n      }\n\n      /* At final iteration, ptr1 points to beginning [ and ptr2 to ending ] */\n      ptr2 = rowfilter + strlen(rowfilter) - 1;\n      if( *ptr1=='[' && *ptr2==']' ) {\n\t  /* Check for @include in final position */\n\t  ptr3 = ptr1 + 1;\n\t  while (*ptr3 == ' ') ptr3++;\n\t  if (*ptr3 == '@') hasAt = 1;\n\n\t  /* Check for overflow; add extra 4 characters if we have pre-existing expression */\n  \t  if (strlen(rowfilterx) + (ptr2-ptr1 + (*rowfilterx)?4:0) > FLEN_FILENAME - 1) {\n\t      free(infile);\n\t      return(*status = URL_PARSE_ERROR);\n\t  }\n\n\t  /* Special error checking here.  We can't allow there to be a\n\t     @filename.txt includes if there are multiple row expressions */\n\t  if (*rowfilterx && hasAt) {\n\t    ffpmsg(\"input URL multiple row filter cannot use @filename.txt\");\n\t    free(infile);\n\t    return(*status = URL_PARSE_ERROR);\n\t  }\n\n\t  if (*rowfilterx) {\n\t    /* A pre-existing row filter: we bracket by ((expr)) to be sure */\n\t    strcat(rowfilterx, \"((\");\n\t    strncat(rowfilterx, ptr1+1, (ptr2-ptr1-1));\n\t    strcat(rowfilterx, \"))\");\n\n\t  } else {\n\t    /* We have only one filter, so just copy the expression alone.\n\t       This will be the most typical case */\n\t    strncat(rowfilterx, ptr1+1, (ptr2-ptr1-1));\n\t  }\n\n       } else {\n          ffpmsg(\"input file URL lacks valid row filter expression\");\n          *status = URL_PARSE_ERROR;\n       }\n    }\n\n    free(infile);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffexist(const char *infile, /* I - input filename or URL */\n            int *exists,        /* O -  2 = a compressed version of file exists */\n\t                        /*      1 = yes, disk file exists               */\n\t                        /*      0 = no, disk file could not be found    */\n\t\t\t\t/*     -1 = infile is not a disk file (could    */\n\t\t\t\t/*   be a http, ftp, gsiftp, smem, or stdin file) */\n            int *status)        /* I/O  status  */\n\n/*\n   test if the input file specifier is an existing file on disk\n   If the specified file can't be found, it then searches for a \n   compressed version of the file.\n*/\n{\n    FILE *diskfile;\n    char rootname[FLEN_FILENAME];\n    char *ptr1;\n    \n    if (*status > 0)\n        return(*status);\n\n    /* strip off any extname or filters from the name */\n    ffrtnm( (char *)infile, rootname, status);\n\n    ptr1 = strstr(rootname, \"://\");\n    \n    if (ptr1 || *rootname == '-') {\n        if (!strncmp(rootname, \"file\", 4) ) {\n\t    ptr1 = ptr1 + 3;   /* pointer to start of the disk file name */\n\t} else {\n\t    *exists = -1;   /* this is not a disk file */\n\t    return (*status);\n\t}\n    } else {\n        ptr1 = rootname;\n    }\n    \n    /* see if the disk file exists */\n    if (file_openfile(ptr1, 0, &diskfile)) {\n    \n        /* no, couldn't open file, so see if there is a compressed version */\n        if (file_is_compressed(ptr1) ) {\n           *exists = 2;  /* a compressed version of the file exists */\n        } else {\n\t   *exists = 0;  /* neither file nor compressed version exist */\n\t}\n\t\n    } else {\n    \n        /* yes, file exists */\n        *exists = 1; \n\tfclose(diskfile);\n    }\n    \t   \n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffrtnm(char *url, \n           char *rootname,\n           int *status)\n/*\n   parse the input URL, returning the root name (filetype://basename).\n*/\n\n{ \n    int ii, jj, slen, infilelen;\n    char *ptr1, *ptr2, *ptr3, *ptr4;\n    char urltype[MAX_PREFIX_LEN];\n    char infile[FLEN_FILENAME];\n\n    if (*status > 0)\n        return(*status);\n\n    ptr1 = url;\n    *rootname = '\\0';\n    *urltype = '\\0';\n    *infile  = '\\0';\n\n    /*  get urltype (e.g., file://, ftp://, http://, etc.)  */\n    if (*ptr1 == '-')        /* \"-\" means read file from stdin */\n    {\n        strcat(urltype, \"-\");\n        ptr1++;\n    }\n    else if (!strncmp(ptr1, \"stdin\", 5) || !strncmp(ptr1, \"STDIN\", 5))\n    {\n        strcat(urltype, \"-\");\n        ptr1 = ptr1 + 5;\n    }\n    else\n    {\n        ptr2 = strstr(ptr1, \"://\");\n        ptr3 = strstr(ptr1, \"(\" );\n\n        if (ptr3 && (ptr3 < ptr2) )\n        {\n           /* the urltype follows a '(' character, so it must apply */\n           /* to the output file, and is not the urltype of the input file */\n           ptr2 = 0;   /* so reset pointer to zero */\n        }\n\n\n        if (ptr2)                  /* copy the explicit urltype string */ \n        {\n\n\t   if (ptr2 - ptr1 + 3 > MAX_PREFIX_LEN - 1)\n\t   {\n               return(*status = URL_PARSE_ERROR);\n           }\n            strncat(urltype, ptr1, ptr2 - ptr1 + 3);\n            ptr1 = ptr2 + 3;\n        }\n        else if (!strncmp(ptr1, \"ftp:\", 4) )\n        {                              /* the 2 //'s are optional */\n            strcat(urltype, \"ftp://\");\n            ptr1 += 4;\n        }\n        else if (!strncmp(ptr1, \"gsiftp:\", 7) )\n        {                              /* the 2 //'s are optional */\n            strcat(urltype, \"gsiftp://\");\n            ptr1 += 7;\n        }\n        else if (!strncmp(ptr1, \"http:\", 5) )\n        {                              /* the 2 //'s are optional */\n            strcat(urltype, \"http://\");\n            ptr1 += 5;\n        }\n        else if (!strncmp(ptr1, \"mem:\", 4) )\n        {                              /* the 2 //'s are optional */\n            strcat(urltype, \"mem://\");\n            ptr1 += 4;\n        }\n        else if (!strncmp(ptr1, \"shmem:\", 6) )\n        {                              /* the 2 //'s are optional */\n            strcat(urltype, \"shmem://\");\n            ptr1 += 6;\n        }\n        else if (!strncmp(ptr1, \"file:\", 5) )\n        {                              /* the 2 //'s are optional */\n            ptr1 += 5;\n        }\n\n        /* else assume file driver    */\n    }\n \n       /*  get the input file name  */\n    ptr2 = strchr(ptr1, '(');   /* search for opening parenthesis ( */\n    ptr3 = strchr(ptr1, '[');   /* search for opening bracket [ */\n    if (ptr2)\n    {\n       ptr4 = strchr(ptr2, ')');\n       while (ptr4 && ptr2)\n       {\n          do {\n             ++ptr4;\n          }  while (*ptr4 == ' ');\n          if (*ptr4 == 0 || *ptr4 == '[')\n             break;\n          ptr2 = strchr(ptr2+1, '(');\n          ptr4 = strchr(ptr4, ')');\n       }\n    }\n\n    if (ptr2 == ptr3)  /* simple case: no [ or ( in the file name */\n    {\n\n\tif (strlen(ptr1) > FLEN_FILENAME - 1)\n        {\n            return(*status = URL_PARSE_ERROR);\n        }\n\n        strcat(infile, ptr1);\n    }\n    else if (!ptr3)     /* no bracket, so () enclose output file name */\n    {\n\n\tif (ptr2 - ptr1 > FLEN_FILENAME - 1)\n        {\n            return(*status = URL_PARSE_ERROR);\n        }\n\n        strncat(infile, ptr1, ptr2 - ptr1);\n        ptr2++;\n\n        ptr1 = strchr(ptr2, ')' );   /* search for closing ) */\n        if (!ptr1)\n            return(*status = URL_PARSE_ERROR);  /* error, no closing ) */\n\n    }\n    else if (ptr2 && (ptr2 < ptr3)) /* () enclose output name before bracket */\n    {\n\n\tif (ptr2 - ptr1 > FLEN_FILENAME - 1)\n        {\n            return(*status = URL_PARSE_ERROR); \n        }\n\n        strncat(infile, ptr1, ptr2 - ptr1);\n        ptr2++;\n\n        ptr1 = strchr(ptr2, ')' );   /* search for closing ) */\n        if (!ptr1)\n            return(*status = URL_PARSE_ERROR);  /* error, no closing ) */\n    }\n    else    /*   bracket comes first, so there is no output name */\n    {\n\tif (ptr3 - ptr1 > FLEN_FILENAME - 1)\n        {\n            return(*status = URL_PARSE_ERROR); \n        }\n\n        strncat(infile, ptr1, ptr3 - ptr1);\n    }\n\n       /* strip off any trailing blanks in the names */\n    slen = strlen(infile);\n    for (ii = slen - 1; ii > 0; ii--)   \n    {\n        if (infile[ii] == ' ')\n            infile[ii] = '\\0';\n        else\n            break;\n    }\n\n    /* --------------------------------------------- */\n    /* check if the 'filename+n' convention has been */\n    /* used to specifiy which HDU number to open     */ \n    /* --------------------------------------------- */\n\n    jj = strlen(infile);\n\n    for (ii = jj - 1; ii >= 0; ii--)\n    {\n        if (infile[ii] == '+')    /* search backwards for '+' sign */\n            break;\n    }\n\n    if (ii > 0 && (jj - ii) < 5)  /* limit extension numbers to 4 digits */\n    {\n        infilelen = ii;\n        ii++;\n\n\n        for (; ii < jj; ii++)\n        {\n            if (!isdigit((int) infile[ii] ) ) /* are all the chars digits? */\n                break;\n        }\n\n        if (ii == jj)      \n        {\n             /* yes, the '+n' convention was used.  */\n\n             infile[infilelen] = '\\0'; /* delete the extension number */\n        }\n    }\n\n    if (strlen(urltype) + strlen(infile) > FLEN_FILENAME - 1)\n    {\n            return(*status = URL_PARSE_ERROR); \n    }\n\n    strcat(rootname, urltype);  /* construct the root name */\n    strcat(rootname, infile);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffourl(char *url,             /* I - full input URL   */\n           char *urltype,          /* O - url type         */\n           char *outfile,          /* O - base file name   */\n           char *tpltfile,         /* O - template file name, if any */\n           char *compspec,         /* O - compression specification, if any */\n           int *status)\n/*\n   parse the output URL into its basic components.\n*/\n\n{ \n    char *ptr1, *ptr2, *ptr3;\n\n    if (*status > 0)\n        return(*status);\n\n    if (urltype)\n      *urltype = '\\0';\n    if (outfile)\n      *outfile = '\\0';\n    if (tpltfile)\n      *tpltfile = '\\0';\n    if (compspec)\n      *compspec = '\\0';\n\n    ptr1 = url;\n    while (*ptr1 == ' ')    /* ignore leading blanks */\n           ptr1++;\n\n    if ( ( (*ptr1 == '-') &&  ( *(ptr1 +1) ==  0   || *(ptr1 +1) == ' ' ) )\n         ||  !strcmp(ptr1, \"stdout\")\n         ||  !strcmp(ptr1, \"STDOUT\"))\n\n         /* \"-\" means write to stdout;  also support \"- \"            */\n         /* but exclude disk file names that begin with a minus sign */\n         /* e.g., \"-55d33m.fits\"   */\n    {\n      if (urltype)\n        strcpy(urltype, \"stdout://\");\n    }\n    else\n    {\n        /* not writing to stdout */\n        /*  get urltype (e.g., file://, ftp://, http://, etc.)  */\n\n        ptr2 = strstr(ptr1, \"://\");\n        if (ptr2)                  /* copy the explicit urltype string */ \n        {\n          if (urltype) {\n\t    if (ptr2 - ptr1 + 3 > MAX_PREFIX_LEN - 1)\n\t    {\n                return(*status = URL_PARSE_ERROR); \n            }\n\n            strncat(urltype, ptr1, ptr2 - ptr1 + 3);\n          }\n\n          ptr1 = ptr2 + 3;\n        }\n        else                       /* assume file driver    */\n        {\n          if (urltype)\n             strcat(urltype, \"file://\");\n        }\n\n        /* look for template file name, enclosed in parenthesis */\n        ptr2 = strchr(ptr1, '('); \n\n        /* look for image compression parameters, enclosed in sq. brackets */\n        ptr3 = strchr(ptr1, '['); \n\n        if (outfile)\n        {\n          if (ptr2) {  /* template file was specified  */\n\t     if (ptr2 - ptr1 > FLEN_FILENAME - 1)\n\t     {\n                return(*status = URL_PARSE_ERROR); \n             }\n \n             strncat(outfile, ptr1, ptr2 - ptr1);\n          } else if (ptr3) {  /* compression was specified  */\n\t     if (ptr3 - ptr1 > FLEN_FILENAME - 1)\n\t     {\n                return(*status = URL_PARSE_ERROR); \n             }\n             strncat(outfile, ptr1, ptr3 - ptr1);\n\n          } else { /* no template file or compression */\n\t     if (strlen(ptr1) > FLEN_FILENAME - 1)\n\t     {\n                return(*status = URL_PARSE_ERROR); \n             }\n             strcpy(outfile, ptr1);\n          }\n        }\n\n\n        if (ptr2)   /* template file was specified  */\n        {\n            ptr2++;\n\n            ptr1 = strchr(ptr2, ')' );   /* search for closing ) */\n\n            if (!ptr1)\n            {\n                return(*status = URL_PARSE_ERROR);  /* error, no closing ) */\n            }\n\n            if (tpltfile) {\n\t        if (ptr1 - ptr2 > FLEN_FILENAME - 1)\n\t        {\n                   return(*status = URL_PARSE_ERROR); \n                }\n                 strncat(tpltfile, ptr2, ptr1 - ptr2);\n            }\n        }\n        \n        if (ptr3)   /* compression was specified  */\n        {\n            ptr3++;\n\n            ptr1 = strchr(ptr3, ']' );   /* search for closing ] */\n\n            if (!ptr1)\n            {\n                return(*status = URL_PARSE_ERROR);  /* error, no closing ] */\n            }\n\n            if (compspec) {\n\n\t        if (ptr1 - ptr3 > FLEN_FILENAME - 1)\n\t        {\n                   return(*status = URL_PARSE_ERROR); \n                }\n \n                strncat(compspec, ptr3, ptr1 - ptr3);\n            }\n        }\n\n        /* check if a .gz compressed output file is to be created */\n        /* by seeing if the filename ends in '.gz'   */\n        if (urltype && outfile)\n        {\n            if (!strcmp(urltype, \"file://\") )\n            {\n                ptr1 = strstr(outfile, \".gz\");\n                if (ptr1)\n                {    /* make sure the \".gz\" is at the end of the file name */\n                   ptr1 += 3;\n                   if (*ptr1 ==  0  || *ptr1 == ' '  )\n                      strcpy(urltype, \"compressoutfile://\");\n                }\n            }\n        }\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffexts(char *extspec, \n                       int *extnum, \n                       char *extname,\n                       int *extvers,\n                       int *hdutype,\n                       char *imagecolname,\n                       char *rowexpress,\n                       int *status)\n{\n/*\n   Parse the input extension specification string, returning either the\n   extension number or the values of the EXTNAME, EXTVERS, and XTENSION\n   keywords in desired extension. Also return the name of the column containing\n   an image, and an expression to be used to determine which row to use,\n   if present.\n*/\n    char *ptr1, *ptr2;\n    int slen, nvals;\n    int notint = 1; /* initially assume specified extname is not an integer */\n    char tmpname[FLEN_VALUE], *loc;\n\n    *extnum = 0;\n    *extname = '\\0';\n    *extvers = 0;\n    *hdutype = ANY_HDU;\n    *imagecolname = '\\0';\n    *rowexpress = '\\0';\n\n    if (*status > 0)\n        return(*status);\n\n    ptr1 = extspec;       /* pointer to first char */\n\n    while (*ptr1 == ' ')  /* skip over any leading blanks */\n        ptr1++;\n\n    if (isdigit((int) *ptr1))  /* is the extension specification a number? */\n    {\n        notint = 0;  /* looks like extname may actually be the ext. number */\n        errno = 0;  /* reset this prior to calling strtol */\n        *extnum = strtol(ptr1, &loc, 10);  /* read the string as an integer */\n\n        while (*loc == ' ')  /* skip over trailing blanks */\n           loc++;\n\n        /* check for read error, or junk following the integer */\n        if ((*loc != '\\0' && *loc != ';' ) || (errno == ERANGE) )\n        {\n           *extnum = 0;\n           notint = 1;  /* no, extname was not a simple integer after all */\n           errno = 0;  /* reset error condition flag if it was set */\n        }\n\n        if ( *extnum < 0 || *extnum > 99999)\n        {\n            *extnum = 0;   /* this is not a reasonable extension number */\n            ffpmsg(\"specified extension number is out of range:\");\n            ffpmsg(extspec);\n            return(*status = URL_PARSE_ERROR); \n        }\n    }\n\n\n/*  This logic was too simple, and failed on extnames like '1000TEMP' \n    where it would try to move to the 1000th extension\n\n    if (isdigit((int) *ptr1))  \n    {\n        sscanf(ptr1, \"%d\", extnum);\n        if (*extnum < 0 || *extnum > 9999)\n        {\n            *extnum = 0;   \n            ffpmsg(\"specified extension number is out of range:\");\n            ffpmsg(extspec);\n            return(*status = URL_PARSE_ERROR); \n        }\n    }\n*/\n\n    if (notint)\n    {\n           /* not a number, so EXTNAME must be specified, followed by */\n           /* optional EXTVERS and XTENSION  values */\n\n           /* don't use space char as end indicator, because there */\n           /* may be imbedded spaces in the EXTNAME value */\n           slen = strcspn(ptr1, \",:;\");   /* length of EXTNAME */\n\n\t   if (slen > FLEN_VALUE - 1)\n\t   {\n                return(*status = URL_PARSE_ERROR); \n           }\n \n           strncat(extname, ptr1, slen);  /* EXTNAME value */\n\n           /* now remove any trailing blanks */\n           while (slen > 0 && *(extname + slen -1) == ' ')\n           {\n               *(extname + slen -1) = '\\0';\n               slen--;\n           }\n\n           ptr1 += slen;\n           slen = strspn(ptr1, \" ,:\");  /* skip delimiter characters */\n           ptr1 += slen;\n\n           slen = strcspn(ptr1, \" ,:;\");   /* length of EXTVERS */\n           if (slen)\n           {\n               nvals = sscanf(ptr1, \"%d\", extvers);  /* EXTVERS value */\n               if (nvals != 1)\n               {\n                   ffpmsg(\"illegal EXTVER value in input URL:\");\n                   ffpmsg(extspec);\n                   return(*status = URL_PARSE_ERROR);\n               }\n\n               ptr1 += slen;\n               slen = strspn(ptr1, \" ,:\");  /* skip delimiter characters */\n               ptr1 += slen;\n\n               slen = strcspn(ptr1, \";\");   /* length of HDUTYPE */\n               if (slen)\n               {\n                 if (*ptr1 == 'b' || *ptr1 == 'B')\n                     *hdutype = BINARY_TBL;  \n                 else if (*ptr1 == 't' || *ptr1 == 'T' ||\n                          *ptr1 == 'a' || *ptr1 == 'A')\n                     *hdutype = ASCII_TBL;\n                 else if (*ptr1 == 'i' || *ptr1 == 'I')\n                     *hdutype = IMAGE_HDU;\n                 else\n                 {\n                     ffpmsg(\"unknown type of HDU in input URL:\");\n                     ffpmsg(extspec);\n                     return(*status = URL_PARSE_ERROR);\n                 }\n               }\n           }\n           else\n           {\n                strcpy(tmpname, extname);\n                ffupch(tmpname);\n                if (!strcmp(tmpname, \"PRIMARY\") || !strcmp(tmpname, \"P\") )\n                    *extname = '\\0';  /* return extnum = 0 */\n           }\n    }\n\n    ptr1 = strchr(ptr1, ';');\n    if (ptr1)\n    {\n        /* an image is to be opened; the image is contained in a single */\n        /* cell of a binary table.  A column name and an expression to  */\n        /* determine which row to use has been entered.                 */\n\n        ptr1++;  /* skip over the ';' delimiter */\n        while (*ptr1 == ' ')  /* skip over any leading blanks */\n            ptr1++;\n\n        ptr2 = strchr(ptr1, '(');\n        if (!ptr2)\n        {\n            ffpmsg(\"illegal specification of image in table cell in input URL:\");\n            ffpmsg(\" did not find a row expression enclosed in ( )\");\n            ffpmsg(extspec);\n            return(*status = URL_PARSE_ERROR);\n        }\n\n\tif (ptr2 - ptr1 > FLEN_FILENAME - 1)\n\t{\n            return(*status = URL_PARSE_ERROR); \n        }\n\n        strncat(imagecolname, ptr1, ptr2 - ptr1); /* copy column name */\n\n        ptr2++;  /* skip over the '(' delimiter */\n        while (*ptr2 == ' ')  /* skip over any leading blanks */\n            ptr2++;\n\n\n        ptr1 = strchr(ptr2, ')');\n        if (!ptr1)\n        {\n            ffpmsg(\"illegal specification of image in table cell in input URL:\");\n            ffpmsg(\" missing closing ')' character in row expression\");\n            ffpmsg(extspec);\n            return(*status = URL_PARSE_ERROR);\n        }\n\n\tif (ptr1 - ptr2 > FLEN_FILENAME - 1)\n        {\n                return(*status = URL_PARSE_ERROR); \n        }\n \n        strncat(rowexpress, ptr2, ptr1 - ptr2); /* row expression */\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffextn(char *url,           /* I - input filename/URL  */\n           int *extension_num,  /* O - returned extension number */\n           int *status)\n{\n/*\n   Parse the input url string and return the number of the extension that\n   CFITSIO would automatically move to if CFITSIO were to open this input URL.\n   The extension numbers are one's based, so 1 = the primary array, 2 = the\n   first extension, etc.\n\n   The extension number that gets returned is determined by the following \n   algorithm:\n\n   1. If the input URL includes a binning specification (e.g.\n   'myfile.fits[3][bin X,Y]') then the returned extension number\n   will always = 1, since CFITSIO would create a temporary primary\n   image on the fly in this case.  The same is true if an image\n   within a single cell of a binary table is opened.\n\n   2.  Else if the input URL specifies an extension number (e.g.,\n   'myfile.fits[3]' or 'myfile.fits+3') then the specified extension\n   number (+ 1) is returned.  \n\n   3.  Else if the extension name is specified in brackets\n   (e.g., this 'myfile.fits[EVENTS]') then the file will be opened and searched\n   for the extension number.  If the input URL is '-'  (reading from the stdin\n   file stream) this is not possible and an error will be returned.\n\n   4.  Else if the URL does not specify an extension (e.g. 'myfile.fits') then\n   a special extension number = -99 will be returned to signal that no\n   extension was specified.  This feature is mainly for compatibility with\n   existing FTOOLS software.  CFITSIO would open the primary array by default\n   (extension_num = 1) in this case.\n\n*/\n    fitsfile *fptr;\n    char urltype[20];\n    char infile[FLEN_FILENAME];\n    char outfile[FLEN_FILENAME]; \n    char extspec[FLEN_FILENAME];\n    char extname[FLEN_FILENAME];\n    char rowfilter[FLEN_FILENAME];\n    char binspec[FLEN_FILENAME];\n    char colspec[FLEN_FILENAME];\n    char imagecolname[FLEN_VALUE], rowexpress[FLEN_FILENAME];\n    char *cptr;\n    int extnum, extvers, hdutype, tstatus = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    /*  parse the input URL into its basic components  */\n    fits_parse_input_url(url, urltype, infile, outfile,\n             extspec, rowfilter,binspec, colspec, status);\n\n    if (*status > 0)\n        return(*status);\n\n    if (*binspec)   /* is there a binning specification? */\n    {\n       *extension_num = 1; /* a temporary primary array image is created */\n       return(*status);\n    }\n\n    if (*extspec)   /* is an extension specified? */\n    {\n       ffexts(extspec, &extnum, \n         extname, &extvers, &hdutype, imagecolname, rowexpress, status);\n\n      if (*status > 0)\n        return(*status);\n\n      if (*imagecolname)   /* is an image within a table cell being opened? */\n      {\n         *extension_num = 1; /* a temporary primary array image is created */\n         return(*status);\n      }\n\n      if (*extname)\n      {\n         /* have to open the file to search for the extension name (curses!) */\n\n         if (!strcmp(urltype, \"stdin://\"))\n            /* opening stdin would destroying it! */\n            return(*status = URL_PARSE_ERROR); \n\n         /* First, strip off any filtering specification */\n         infile[0] = '\\0';\n\t strncat(infile, url, FLEN_FILENAME -1);\n\t \n         cptr = strchr(infile, ']');  /* locate the closing bracket */\n         if (!cptr)\n         {\n             return(*status = URL_PARSE_ERROR);\n         }\n         else\n         {\n             cptr++;\n             *cptr = '\\0'; /* terminate URl after the extension spec */\n         }\n\n         if (ffopen(&fptr, infile, READONLY, status) > 0) /* open the file */\n         {\n            ffclos(fptr, &tstatus);\n            return(*status);\n         }\n\n         ffghdn(fptr, &extnum);    /* where am I in the file? */\n         *extension_num = extnum;\n         ffclos(fptr, status);\n\n         return(*status);\n      }\n      else\n      {\n         *extension_num = extnum + 1;  /* return the specified number (+ 1) */\n         return(*status);\n      }\n    }\n    else\n    {\n         *extension_num = -99;  /* no specific extension was specified */\n                                /* defaults to primary array */\n         return(*status);\n    }\n}\n/*--------------------------------------------------------------------------*/\n\nint ffurlt(fitsfile *fptr, char *urlType, int *status)\n/*\n   return the prefix string associated with the driver in use by the\n   fitsfile pointer fptr\n*/\n\n{ \n  strcpy(urlType, driverTable[fptr->Fptr->driver].prefix);\n  return(*status);\n}\n\n/*--------------------------------------------------------------------------*/\nint ffimport_file( char *filename,   /* Text file to read                   */\n                   char **contents,  /* Pointer to pointer to hold file     */\n                   int *status )     /* CFITSIO error code                  */\n/*\n   Read and concatenate all the lines from the given text file.  User\n   must free the pointer returned in contents.  Pointer is guaranteed\n   to hold 2 characters more than the length of the text... allows the\n   calling routine to append (or prepend) a newline (or quotes?) without\n   reallocating memory.\n*/\n{\n   int allocLen, totalLen, llen, eoline = 1;\n   char *lines,line[256];\n   FILE *aFile;\n\n   if( *status > 0 ) return( *status );\n\n   totalLen =    0;\n   allocLen = 1024;\n   lines    = (char *)malloc( allocLen * sizeof(char) );\n   if( !lines ) {\n      ffpmsg(\"Couldn't allocate memory to hold ASCII file contents.\");\n      return(*status = MEMORY_ALLOCATION );\n   }\n   lines[0] = '\\0';\n\n   if( (aFile = fopen( filename, \"r\" ))==NULL ) {\n      snprintf(line,256,\"Could not open ASCII file %s.\",filename);\n      ffpmsg(line);\n      free( lines );\n      return(*status = FILE_NOT_OPENED);\n   }\n\n   while( fgets(line,256,aFile)!=NULL ) {\n      llen = strlen(line);\n      if ( eoline && (llen > 1) && (line[0] == '/' && line[1] == '/'))\n          continue;       /* skip comment lines begging with // */\n\n      eoline = 0;\n\n      /* replace CR and newline chars at end of line with nulls */\n      if ((llen > 0) && (line[llen-1]=='\\n' || line[llen-1] == '\\r')) {\n          line[--llen] = '\\0';\n          eoline = 1;   /* found an end of line character */\n\n          if ((llen > 0) && (line[llen-1]=='\\n' || line[llen-1] == '\\r')) {\n                 line[--llen] = '\\0';\n          }\n      }\n\n      if( totalLen + llen + 3 >= allocLen ) {\n         allocLen += 256;\n         lines = (char *)realloc(lines, allocLen * sizeof(char) );\n         if( ! lines ) {\n            ffpmsg(\"Couldn't allocate memory to hold ASCII file contents.\");\n            *status = MEMORY_ALLOCATION;\n            break;\n         }\n      }\n      strcpy( lines+totalLen, line );\n      totalLen += llen;\n\n      if (eoline) {\n         strcpy( lines+totalLen, \" \"); /* add a space between lines */\n         totalLen += 1;\n      }\n   }\n   fclose(aFile);\n\n   *contents = lines;\n   return( *status );\n}\n\n/*--------------------------------------------------------------------------*/\nint fits_get_token(char **ptr, \n                   char *delimiter,\n                   char *token,\n                   int *isanumber)   /* O - is this token a number? */\n/*\n   parse off the next token, delimited by a character in 'delimiter',\n   from the input ptr string;  increment *ptr to the end of the token.\n   Returns the length of the token, not including the delimiter char;\n*/\n{\n    char *loc, tval[73];\n    int slen;\n    double dval;\n    \n    *token = '\\0';\n\n    while (**ptr == ' ')  /* skip over leading blanks */\n        (*ptr)++;\n\n    slen = strcspn(*ptr, delimiter);  /* length of next token */\n    if (slen)\n    {\n        strncat(token, *ptr, slen);       /* copy token */\n\n        (*ptr) += slen;                   /* skip over the token */\n\n        if (isanumber)  /* check if token is a number */\n        {\n            *isanumber = 1;\n\n\t    if (strchr(token, 'D'))  {\n\t        strncpy(tval, token, 72);\n\t\ttval[72] = '\\0';\n\n\t        /*  The C language does not support a 'D'; replace with 'E' */\n\t        if ((loc = strchr(tval, 'D'))) *loc = 'E';\n\n\t        dval =  strtod(tval, &loc);\n\t    } else {\n\t        dval =  strtod(token, &loc);\n \t    }\n\n\t    /* check for read error, or junk following the value */\n\t    if (*loc != '\\0' && *loc != ' ' ) *isanumber = 0;\n\t    if (errno == ERANGE) *isanumber = 0;\n        }\n    }\n\n    return(slen);\n}\n/*--------------------------------------------------------------------------*/\nint fits_get_token2(char **ptr, \n                   char *delimiter,\n                   char **token,\n                   int *isanumber,  /* O - is this token a number? */\n\t\t   int *status)\n\n/*\n   parse off the next token, delimited by a character in 'delimiter',\n   from the input ptr string;  increment *ptr to the end of the token.\n   Returns the length of the token, not including the delimiter char;\n\n   This routine allocates the *token string;  the calling routine must free it \n*/\n{\n    char *loc, tval[73];\n    int slen;\n    double dval;\n    \n    if (*status)\n        return(0);\n\t\n    while (**ptr == ' ')  /* skip over leading blanks */\n        (*ptr)++;\n\n    slen = strcspn(*ptr, delimiter);  /* length of next token */\n    if (slen)\n    {\n\t*token = (char *) calloc(slen + 1, 1); \n\tif (!(*token)) {\n          ffpmsg(\"Couldn't allocate memory to hold token string (fits_get_token2).\");\n          *status = MEMORY_ALLOCATION ;\n\t  return(0);\n        }\n \n        strncat(*token, *ptr, slen);       /* copy token */\n        (*ptr) += slen;                   /* skip over the token */\n\n        if (isanumber)  /* check if token is a number */\n        {\n            *isanumber = 1;\n\n\t    if (strchr(*token, 'D'))  {\n\t        strncpy(tval, *token, 72);\n\t\ttval[72] = '\\0';\n\n\t        /*  The C language does not support a 'D'; replace with 'E' */\n\t        if ((loc = strchr(tval, 'D'))) *loc = 'E';\n\n\t        dval =  strtod(tval, &loc);\n\t    } else {\n\t        dval =  strtod(*token, &loc);\n \t    }\n\n\t    /* check for read error, or junk following the value */\n\t    if (*loc != '\\0' && *loc != ' ' ) *isanumber = 0;\n\t    if (errno == ERANGE) *isanumber = 0;\n        }\n    }\n\n    return(slen);\n}\n/*---------------------------------------------------------------------------*/\nchar *fits_split_names(\n   char *list)   /* I   - input list of names */\n{\n/*  \n   A sequence of calls to fits_split_names will split the input string\n   into name tokens.  The string typically contains a list of file or\n   column names.  The names must be delimited by a comma and/or spaces.\n   This routine ignores spaces and commas that occur within parentheses,\n   brackets, or curly brackets.  It also strips any leading and trailing\n   blanks from the returned name.\n\n   This routine is similar to the ANSI C 'strtok' function:\n\n   The first call to fits_split_names has a non-null input string.\n   It finds the first name in the string and terminates it by\n   overwriting the next character of the string with a '\\0' and returns\n   a pointer to the name.  Each subsequent call, indicated by a NULL\n   value of the input string, returns the next name, searching from\n   just past the end of the previous name.  It returns NULL when no\n   further names are found.\n\n   The following line illustrates how a string would be split into 3 names:\n    myfile[1][bin (x,y)=4], file2.fits  file3.fits\n    ^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^  ^^^^^^^^^^\n      1st name               2nd name    3rd name\n\n\nNOTE:  This routine is not thread-safe.  \nThis routine is simply provided as a utility routine for other external\nsoftware. It is not used by any CFITSIO routine.\n\n*/\n    int depth = 0;\n    char *start;\n    static char *ptr;\n\n    if (list)  /* reset ptr if a string is given */\n        ptr = list;\n\n    while (*ptr == ' ')ptr++;  /* skip leading white space */\n\n    if (*ptr == '\\0')return(0);  /* no remaining file names */\n\n    start = ptr;\n\n    while (*ptr != '\\0') {\n       if ((*ptr == '[') || (*ptr == '(') || (*ptr == '{')) depth ++;\n       else if ((*ptr == '}') || (*ptr == ')') || (*ptr == ']')) depth --;\n       else if ((depth == 0) && (*ptr == ','  || *ptr == ' ')) {\n          *ptr = '\\0';  /* terminate the filename here */\n          ptr++;  /* save pointer to start of next filename */\n          break;  \n       }\n       ptr++;\n    }\n    \n    return(start);\n}\n/*--------------------------------------------------------------------------*/\nint urltype2driver(char *urltype, int *driver)\n/*\n   compare input URL with list of known drivers, returning the\n   matching driver numberL.\n*/\n\n{ \n    int ii;\n\n       /* find matching driver; search most recent drivers first */\n\n    for (ii=no_of_drivers - 1; ii >= 0; ii--)\n    {\n        if (0 == strcmp(driverTable[ii].prefix, urltype))\n        { \n             *driver = ii;\n             return(0);\n        }\n    }\n\n    return(NO_MATCHING_DRIVER);   \n}\n/*--------------------------------------------------------------------------*/\nint ffclos(fitsfile *fptr,      /* I - FITS file pointer */\n           int *status)         /* IO - error status     */\n/*\n  close the FITS file by completing the current HDU, flushing it to disk,\n  then calling the system dependent routine to physically close the FITS file\n*/   \n{\n    int tstatus = NO_CLOSE_ERROR, zerostatus = 0;\n\n    if (!fptr)\n        return(*status = NULL_INPUT_PTR);\n    else if ((fptr->Fptr)->validcode != VALIDSTRUC) /* check for magic value */\n        return(*status = BAD_FILEPTR); \n\n    /* close and flush the current HDU */\n    if (*status > 0)\n       ffchdu(fptr, &tstatus);  /* turn off the error message from ffchdu */\n    else\n       ffchdu(fptr, status);         \n\n    ((fptr->Fptr)->open_count)--;           /* decrement usage counter */\n\n    if ((fptr->Fptr)->open_count == 0)  /* if no other files use structure */\n    {\n        ffflsh(fptr, TRUE, status);   /* flush and disassociate IO buffers */\n\n        /* call driver function to actually close the file */\n        if ((*driverTable[(fptr->Fptr)->driver].close)((fptr->Fptr)->filehandle))\n        {\n            if (*status <= 0)\n            {\n              *status = FILE_NOT_CLOSED;  /* report if no previous error */\n\n              ffpmsg(\"failed to close the following file: (ffclos)\");\n              ffpmsg((fptr->Fptr)->filename);\n            }\n        }\n\n        fits_clear_Fptr( fptr->Fptr, status);  /* clear Fptr address */\n        free((fptr->Fptr)->iobuffer);    /* free memory for I/O buffers */\n        free((fptr->Fptr)->headstart);    /* free memory for headstart array */\n        free((fptr->Fptr)->filename);     /* free memory for the filename */\n        (fptr->Fptr)->filename = 0;\n        (fptr->Fptr)->validcode = 0; /* magic value to indicate invalid fptr */\n        free(fptr->Fptr);         /* free memory for the FITS file structure */\n        free(fptr);               /* free memory for the FITS file structure */\n    }\n    else\n    {\n        /*\n           to minimize the fallout from any previous error (e.g., trying to \n           open a non-existent extension in a already opened file), \n           always call ffflsh with status = 0.\n        */\n        /* just flush the buffers, don't disassociate them */\n        if (*status > 0)\n            ffflsh(fptr, FALSE, &zerostatus); \n        else\n            ffflsh(fptr, FALSE, status); \n\n        free(fptr);               /* free memory for the FITS file structure */\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffdelt(fitsfile *fptr,      /* I - FITS file pointer */\n           int *status)         /* IO - error status     */\n/*\n  close and DELETE the FITS file. \n*/\n{\n    char *basename;\n    int slen, tstatus = NO_CLOSE_ERROR, zerostatus = 0;\n\n    if (!fptr)\n        return(*status = NULL_INPUT_PTR);\n    else if ((fptr->Fptr)->validcode != VALIDSTRUC) /* check for magic value */\n        return(*status = BAD_FILEPTR); \n\n    if (*status > 0)\n       ffchdu(fptr, &tstatus);  /* turn off the error message from ffchdu */\n    else\n        ffchdu(fptr, status);  \n\n    ffflsh(fptr, TRUE, status);     /* flush and disassociate IO buffers */\n\n        /* call driver function to actually close the file */\n    if ( (*driverTable[(fptr->Fptr)->driver].close)((fptr->Fptr)->filehandle) )\n    {\n        if (*status <= 0)\n        {\n            *status = FILE_NOT_CLOSED;  /* report error if no previous error */\n\n            ffpmsg(\"failed to close the following file: (ffdelt)\");\n            ffpmsg((fptr->Fptr)->filename);\n        }\n    }\n\n    /* call driver function to actually delete the file */\n    if ( (driverTable[(fptr->Fptr)->driver].remove) )\n    {\n        /* parse the input URL to get the base filename */\n        slen = strlen((fptr->Fptr)->filename);\n        basename = (char *) malloc(slen +1);\n        if (!basename)\n            return(*status = MEMORY_ALLOCATION);\n    \n        fits_parse_input_url((fptr->Fptr)->filename, NULL, basename, NULL, NULL, NULL, NULL,\n               NULL, &zerostatus);\n\n       if ((*driverTable[(fptr->Fptr)->driver].remove)(basename))\n        {\n            ffpmsg(\"failed to delete the following file: (ffdelt)\");\n            ffpmsg((fptr->Fptr)->filename);\n            if (!(*status))\n                *status = FILE_NOT_CLOSED;\n        }\n        free(basename);\n    }\n\n    fits_clear_Fptr( fptr->Fptr, status);  /* clear Fptr address */\n    free((fptr->Fptr)->iobuffer);    /* free memory for I/O buffers */\n    free((fptr->Fptr)->headstart);    /* free memory for headstart array */\n    free((fptr->Fptr)->filename);     /* free memory for the filename */\n    (fptr->Fptr)->filename = 0;\n    (fptr->Fptr)->validcode = 0;      /* magic value to indicate invalid fptr */\n    free(fptr->Fptr);              /* free memory for the FITS file structure */\n    free(fptr);                    /* free memory for the FITS file structure */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fftrun( fitsfile *fptr,    /* I - FITS file pointer           */\n             LONGLONG filesize,   /* I - size to truncate the file   */\n             int *status)      /* O - error status                */\n/*\n  low level routine to truncate a file to a new smaller size.\n*/\n{\n  if (driverTable[(fptr->Fptr)->driver].truncate)\n  {\n    ffflsh(fptr, FALSE, status);  /* flush all the buffers first */\n    (fptr->Fptr)->filesize = filesize;\n    (fptr->Fptr)->io_pos = filesize;\n    (fptr->Fptr)->logfilesize = filesize;\n    (fptr->Fptr)->bytepos = filesize;\n    ffbfeof(fptr, status);   /* eliminate any buffers beyond current EOF */\n    return (*status = \n     (*driverTable[(fptr->Fptr)->driver].truncate)((fptr->Fptr)->filehandle,\n     filesize) );\n  }\n  else\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffflushx( FITSfile *fptr)     /* I - FITS file pointer                  */\n/*\n  low level routine to flush internal file buffers to the file.\n*/\n{\n    if (driverTable[fptr->driver].flush)\n        return ( (*driverTable[fptr->driver].flush)(fptr->filehandle) );\n    else\n        return(0);    /* no flush function defined for this driver */\n}\n/*--------------------------------------------------------------------------*/\nint ffseek( FITSfile *fptr,   /* I - FITS file pointer              */\n            LONGLONG position)   /* I - byte position to seek to       */\n/*\n  low level routine to seek to a position in a file.\n*/\n{\n    return( (*driverTable[fptr->driver].seek)(fptr->filehandle, position) );\n}\n/*--------------------------------------------------------------------------*/\nint ffwrite( FITSfile *fptr,   /* I - FITS file pointer              */\n             long nbytes,      /* I - number of bytes to write       */\n             void *buffer,     /* I - buffer to write                */\n             int *status)      /* O - error status                   */\n/*\n  low level routine to write bytes to a file.\n*/\n{\n    if ( (*driverTable[fptr->driver].write)(fptr->filehandle, buffer, nbytes) )\n    {\n        ffpmsg(\"Error writing data buffer to file:\");\n\tffpmsg(fptr->filename);\n\n        *status = WRITE_ERROR;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffread( FITSfile *fptr,   /* I - FITS file pointer              */\n            long nbytes,      /* I - number of bytes to read        */\n            void *buffer,     /* O - buffer to read into            */\n            int *status)      /* O - error status                   */\n/*\n  low level routine to read bytes from a file.\n*/\n{\n    int readstatus;\n\n    readstatus = (*driverTable[fptr->driver].read)(fptr->filehandle, \n        buffer, nbytes);\n\n    if (readstatus == END_OF_FILE)\n        *status = END_OF_FILE;\n    else if (readstatus > 0)\n    {\n        ffpmsg(\"Error reading data buffer from file:\");\n\tffpmsg(fptr->filename);\n\n        *status = READ_ERROR;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint fftplt(fitsfile **fptr,      /* O - FITS file pointer                   */\n           const char *filename, /* I - name of file to create              */\n           const char *tempname, /* I - name of template file               */\n           int *status)          /* IO - error status                       */\n/*\n  Create and initialize a new FITS file  based on a template file.\n  Uses C fopen and fgets functions.\n*/\n{\n    *fptr = 0;              /* initialize null file pointer, */\n                            /* regardless of the value of *status */\n    if (*status > 0)\n        return(*status);\n\n    if ( ffinit(fptr, filename, status) )  /* create empty file */\n        return(*status);\n\n    ffoptplt(*fptr, tempname, status);  /* open and use template */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffoptplt(fitsfile *fptr,      /* O - FITS file pointer                   */\n            const char *tempname, /* I - name of template file               */\n            int *status)          /* IO - error status                       */\n/*\n  open template file and use it to create new file\n*/\n{\n    fitsfile *tptr;\n    int tstatus = 0, nkeys, nadd, ii;\n    char card[FLEN_CARD];\n\n    if (*status > 0)\n        return(*status);\n\n    if (tempname == NULL || *tempname == '\\0')     /* no template file? */\n        return(*status);\n\n    /* try opening template */\n    ffopen(&tptr, (char *) tempname, READONLY, &tstatus); \n\n    if (tstatus)  /* not a FITS file, so treat it as an ASCII template */\n    {\n        ffxmsg(2, card);  /* clear the  error message */\n        fits_execute_template(fptr, (char *) tempname, status);\n\n        ffmahd(fptr, 1, 0, status);   /* move back to the primary array */\n        return(*status);\n    }\n    else  /* template is a valid FITS file */\n    {\n        ffmahd(tptr, 1, NULL, status); /* make sure we are at the beginning */\n        while (*status <= 0)\n        {\n           ffghsp(tptr, &nkeys, &nadd, status); /* get no. of keywords */\n\n           for (ii = 1; ii <= nkeys; ii++)   /* copy keywords */\n           {\n              ffgrec(tptr,  ii, card, status);\n\n              /* must reset the PCOUNT keyword to zero in the new output file */\n              if (strncmp(card, \"PCOUNT  \",8) == 0) { /* the PCOUNT keyword? */\n\t         if (strncmp(card+25, \"    0\", 5)) {  /* non-zero value? */\n\t\t    strncpy(card, \"PCOUNT  =                    0\", 30);\n\t\t }\n\t      }   \n \n              ffprec(fptr, card, status);\n           }\n\n           ffmrhd(tptr, 1, 0, status); /* move to next HDU until error */\n           ffcrhd(fptr, status);  /* create empty new HDU in output file */\n        }\n\n        if (*status == END_OF_FILE)\n        {\n           *status = 0;              /* expected error condition */\n        }\n        ffclos(tptr, status);       /* close the template file */\n    }\n\n    ffmahd(fptr, 1, 0, status);   /* move to the primary array */\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nvoid ffrprt( FILE *stream, int status)\n/* \n   Print out report of cfitsio error status and messages on the error stack.\n   Uses C FILE stream.\n*/\n{\n    char status_str[FLEN_STATUS], errmsg[FLEN_ERRMSG];\n  \n    if (status)\n    {\n\n      fits_get_errstatus(status, status_str);  /* get the error description */\n      fprintf(stream, \"\\nFITSIO status = %d: %s\\n\", status, status_str);\n\n      while ( fits_read_errmsg(errmsg) )  /* get error stack messages */\n             fprintf(stream, \"%s\\n\", errmsg);\n    }\n    return; \n}\n/*--------------------------------------------------------------------------*/\nint pixel_filter_helper(\n           fitsfile **fptr,  /* IO - pointer to input image; on output it  */\n                             /*      points to the new image */\n           char *outfile,    /* I - name for output file        */\n           char *expr,       /* I - Image filter expression    */\n           int *status)\n{\n\tPixelFilter filter = { 0 };\n\tchar * DEFAULT_TAG = \"X\";\n\tint ii, hdunum;\n        int singleHDU = 0;\n\n\tfilter.count = 1;\n\tfilter.ifptr = fptr;\n\tfilter.tag = &DEFAULT_TAG;\n\n    /* create new empty file for result */\n    if (ffinit(&filter.ofptr, outfile, status) > 0)\n    {\n        ffpmsg(\"failed to create output file for pixel filter:\");\n        ffpmsg(outfile);\n        return(*status);\n    }\n\n    fits_get_hdu_num(*fptr, &hdunum);  /* current HDU number in input file */\n\n    expr += 3; /* skip 'pix' */\n    switch (expr[0]) {\n       case 'b': \n       case 'B': filter.bitpix = BYTE_IMG; break;\n       case 'i':\n       case 'I': filter.bitpix = SHORT_IMG; break;\n       case 'j':\n       case 'J': filter.bitpix = LONG_IMG; break;\n       case 'r':\n       case 'R': filter.bitpix = FLOAT_IMG; break;\n       case 'd':\n       case 'D': filter.bitpix = DOUBLE_IMG; break;\n    }\n    if (filter.bitpix) /* skip bitpix indicator */\n       ++expr;\n\n    if (*expr == '1') {\n       ++expr;\n       singleHDU = 1;\n    }\n\n    if (((*fptr)->Fptr)->only_one)\n       singleHDU = 1;\n\n    if (*expr != ' ') {\n       ffpmsg(\"pixel filtering expression not space separated:\");\n       ffpmsg(expr);\n    }\n    while (*expr == ' ')\n       ++expr;\n\n    /* copy all preceding extensions to the output file */\n    for (ii = 1; !singleHDU && ii < hdunum; ii++)\n    {\n        fits_movabs_hdu(*fptr, ii, NULL, status);\n        if (fits_copy_hdu(*fptr, filter.ofptr, 0, status) > 0)\n        {\n            ffclos(filter.ofptr, status);\n            return(*status);\n        }\n    }\n\n    /* move back to the original HDU position */\n    fits_movabs_hdu(*fptr, hdunum, NULL, status);\n\n\tfilter.expression = expr;\n    if (fits_pixel_filter(&filter, status)) {\n        ffpmsg(\"failed to execute image filter:\");\n        ffpmsg(expr);\n        ffclos(filter.ofptr, status);\n        return(*status);\n    }\n\n\n    /* copy any remaining HDUs to the output file */\n\n    for (ii = hdunum + 1; !singleHDU; ii++)\n    {\n        if (fits_movabs_hdu(*fptr, ii, NULL, status) > 0)\n            break;\n\n        fits_copy_hdu(*fptr, filter.ofptr, 0, status);\n    }\n\n    if (*status == END_OF_FILE)   \n        *status = 0;              /* got the expected EOF error; reset = 0  */\n    else if (*status > 0)\n    {\n        ffclos(filter.ofptr, status);\n        return(*status);\n    }\n\n    /* close the original file and return ptr to the new image */\n    ffclos(*fptr, status);\n\n    *fptr = filter.ofptr; /* reset the pointer to the new table */\n\n    /* move back to the image subsection */\n    if (ii - 1 != hdunum)\n        fits_movabs_hdu(*fptr, hdunum, NULL, status);\n\n    return(*status);\n}\n\n/*-------------------------------------------------------------------*/\nint ffihtps(void)\n{\n   /* Wrapper function for global initialization of curl library.\n      This is NOT THREAD-SAFE */\n   int status=0;\n#ifdef CFITSIO_HAVE_CURL\n   if (curl_global_init(CURL_GLOBAL_ALL))\n      /* Do we want to define a new CFITSIO error code for this? */\n      status = -1;\n#endif\n   return status;\n}\n\n/*-------------------------------------------------------------------*/\nint ffchtps(void)\n{\n   /* Wrapper function for global cleanup of curl library.\n      This is NOT THREAD-SAFE */\n#ifdef CFITSIO_HAVE_CURL\n   curl_global_cleanup();\n#endif\n   return 0;\n}\n\n/*-------------------------------------------------------------------*/\nvoid ffvhtps(int flag)\n{\n   /* Turn libcurl's verbose output on (1) or off (0). \n      This is NOT THREAD-SAFE */\n#ifdef HAVE_NET_SERVICES\n\n   https_set_verbose(flag);\n#endif\n}\n\n/*-------------------------------------------------------------------*/\nvoid ffshdwn(int flag)\n{\n   /* Display download status bar (to stderr), where applicable.\n      This is NOT THREAD-SAFE */\n#ifdef HAVE_NET_SERVICES\n   fits_dwnld_prog_bar(flag);\n#endif\n}\n\n/*-------------------------------------------------------------------*/\nint ffgtmo(void)\n{\n   int timeout=0;\n#ifdef HAVE_NET_SERVICES\n   timeout = fits_net_timeout(-1);\n#endif\n   return timeout;\n}\n\n/*-------------------------------------------------------------------*/\nint ffstmo(int sec, int *status)\n{\n   if (*status > 0)\n      return (*status);\n\n#ifdef HAVE_NET_SERVICES\n   if (sec <= 0)\n   {\n      *status = BAD_NETTIMEOUT;\n      ffpmsg(\"Bad value for net timeout setting (fits_set_timeout).\");\n      return(*status);\n   }\n   fits_net_timeout(sec);\n#endif\n   return(*status);   \n}\n"},{"id":16719,"name":"cextern/cfitsio/zlib","nodeType":"Package"},{"id":16720,"name":"infback.c","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* infback.c -- inflate using a call-back interface\n * Copyright (C) 1995-2009 Mark Adler\n * For conditions of distribution and use, see copyright notice in zlib.h\n */\n\n/*\n   This code is largely copied from inflate.c.  Normally either infback.o or\n   inflate.o would be linked into an application--not both.  The interface\n   with inffast.c is retained so that optimized assembler-coded versions of\n   inflate_fast() can be used with either inflate.c or infback.c.\n */\n\n#include \"zutil.h\"\n#include \"inftrees.h\"\n#include \"inflate.h\"\n#include \"inffast.h\"\n\n/* function prototypes */\nlocal void fixedtables OF((struct inflate_state FAR *state));\n\n/*\n   strm provides memory allocation functions in zalloc and zfree, or\n   Z_NULL to use the library memory allocation functions.\n\n   windowBits is in the range 8..15, and window is a user-supplied\n   window and output buffer that is 2**windowBits bytes.\n */\nint ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)\nz_streamp strm;\nint windowBits;\nunsigned char FAR *window;\nconst char *version;\nint stream_size;\n{\n    struct inflate_state FAR *state;\n\n    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||\n        stream_size != (int)(sizeof(z_stream)))\n        return Z_VERSION_ERROR;\n    if (strm == Z_NULL || window == Z_NULL ||\n        windowBits < 8 || windowBits > 15)\n        return Z_STREAM_ERROR;\n    strm->msg = Z_NULL;                 /* in case we return an error */\n    if (strm->zalloc == (alloc_func)0) {\n        strm->zalloc = zcalloc;\n        strm->opaque = (voidpf)0;\n    }\n    if (strm->zfree == (free_func)0) strm->zfree = zcfree;\n    state = (struct inflate_state FAR *)ZALLOC(strm, 1,\n                                               sizeof(struct inflate_state));\n    if (state == Z_NULL) return Z_MEM_ERROR;\n    Tracev((stderr, \"inflate: allocated\\n\"));\n    strm->state = (struct internal_state FAR *)state;\n    state->dmax = 32768U;\n    state->wbits = windowBits;\n    state->wsize = 1U << windowBits;\n    state->window = window;\n    state->wnext = 0;\n    state->whave = 0;\n    return Z_OK;\n}\n\n/*\n   Return state with length and distance decoding tables and index sizes set to\n   fixed code decoding.  Normally this returns fixed tables from inffixed.h.\n   If BUILDFIXED is defined, then instead this routine builds the tables the\n   first time it's called, and returns those tables the first time and\n   thereafter.  This reduces the size of the code by about 2K bytes, in\n   exchange for a little execution time.  However, BUILDFIXED should not be\n   used for threaded applications, since the rewriting of the tables and virgin\n   may not be thread-safe.\n */\nlocal void fixedtables(state)\nstruct inflate_state FAR *state;\n{\n#ifdef BUILDFIXED\n    static int virgin = 1;\n    static code *lenfix, *distfix;\n    static code fixed[544];\n\n    /* build fixed huffman tables if first call (may not be thread safe) */\n    if (virgin) {\n        unsigned sym, bits;\n        static code *next;\n\n        /* literal/length table */\n        sym = 0;\n        while (sym < 144) state->lens[sym++] = 8;\n        while (sym < 256) state->lens[sym++] = 9;\n        while (sym < 280) state->lens[sym++] = 7;\n        while (sym < 288) state->lens[sym++] = 8;\n        next = fixed;\n        lenfix = next;\n        bits = 9;\n        inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);\n\n        /* distance table */\n        sym = 0;\n        while (sym < 32) state->lens[sym++] = 5;\n        distfix = next;\n        bits = 5;\n        inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);\n\n        /* do this just once */\n        virgin = 0;\n    }\n#else /* !BUILDFIXED */\n#   include \"inffixed.h\"\n#endif /* BUILDFIXED */\n    state->lencode = lenfix;\n    state->lenbits = 9;\n    state->distcode = distfix;\n    state->distbits = 5;\n}\n\n/* Macros for inflateBack(): */\n\n/* Load returned state from inflate_fast() */\n#define LOAD() \\\n    do { \\\n        put = strm->next_out; \\\n        left = strm->avail_out; \\\n        next = strm->next_in; \\\n        have = strm->avail_in; \\\n        hold = state->hold; \\\n        bits = state->bits; \\\n    } while (0)\n\n/* Set state from registers for inflate_fast() */\n#define RESTORE() \\\n    do { \\\n        strm->next_out = put; \\\n        strm->avail_out = left; \\\n        strm->next_in = next; \\\n        strm->avail_in = have; \\\n        state->hold = hold; \\\n        state->bits = bits; \\\n    } while (0)\n\n/* Clear the input bit accumulator */\n#define INITBITS() \\\n    do { \\\n        hold = 0; \\\n        bits = 0; \\\n    } while (0)\n\n/* Assure that some input is available.  If input is requested, but denied,\n   then return a Z_BUF_ERROR from inflateBack(). */\n#define PULL() \\\n    do { \\\n        if (have == 0) { \\\n            have = in(in_desc, &next); \\\n            if (have == 0) { \\\n                next = Z_NULL; \\\n                ret = Z_BUF_ERROR; \\\n                goto inf_leave; \\\n            } \\\n        } \\\n    } while (0)\n\n/* Get a byte of input into the bit accumulator, or return from inflateBack()\n   with an error if there is no input available. */\n#define PULLBYTE() \\\n    do { \\\n        PULL(); \\\n        have--; \\\n        hold += (unsigned long)(*next++) << bits; \\\n        bits += 8; \\\n    } while (0)\n\n/* Assure that there are at least n bits in the bit accumulator.  If there is\n   not enough available input to do that, then return from inflateBack() with\n   an error. */\n#define NEEDBITS(n) \\\n    do { \\\n        while (bits < (unsigned)(n)) \\\n            PULLBYTE(); \\\n    } while (0)\n\n/* Return the low n bits of the bit accumulator (n < 16) */\n#define BITS(n) \\\n    ((unsigned)hold & ((1U << (n)) - 1))\n\n/* Remove n bits from the bit accumulator */\n#define DROPBITS(n) \\\n    do { \\\n        hold >>= (n); \\\n        bits -= (unsigned)(n); \\\n    } while (0)\n\n/* Remove zero to seven bits as needed to go to a byte boundary */\n#define BYTEBITS() \\\n    do { \\\n        hold >>= bits & 7; \\\n        bits -= bits & 7; \\\n    } while (0)\n\n/* Assure that some output space is available, by writing out the window\n   if it's full.  If the write fails, return from inflateBack() with a\n   Z_BUF_ERROR. */\n#define ROOM() \\\n    do { \\\n        if (left == 0) { \\\n            put = state->window; \\\n            left = state->wsize; \\\n            state->whave = left; \\\n            if (out(out_desc, put, left)) { \\\n                ret = Z_BUF_ERROR; \\\n                goto inf_leave; \\\n            } \\\n        } \\\n    } while (0)\n\n/*\n   strm provides the memory allocation functions and window buffer on input,\n   and provides information on the unused input on return.  For Z_DATA_ERROR\n   returns, strm will also provide an error message.\n\n   in() and out() are the call-back input and output functions.  When\n   inflateBack() needs more input, it calls in().  When inflateBack() has\n   filled the window with output, or when it completes with data in the\n   window, it calls out() to write out the data.  The application must not\n   change the provided input until in() is called again or inflateBack()\n   returns.  The application must not change the window/output buffer until\n   inflateBack() returns.\n\n   in() and out() are called with a descriptor parameter provided in the\n   inflateBack() call.  This parameter can be a structure that provides the\n   information required to do the read or write, as well as accumulated\n   information on the input and output such as totals and check values.\n\n   in() should return zero on failure.  out() should return non-zero on\n   failure.  If either in() or out() fails, than inflateBack() returns a\n   Z_BUF_ERROR.  strm->next_in can be checked for Z_NULL to see whether it\n   was in() or out() that caused in the error.  Otherwise,  inflateBack()\n   returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format\n   error, or Z_MEM_ERROR if it could not allocate memory for the state.\n   inflateBack() can also return Z_STREAM_ERROR if the input parameters\n   are not correct, i.e. strm is Z_NULL or the state was not initialized.\n */\nint ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)\nz_streamp strm;\nin_func in;\nvoid FAR *in_desc;\nout_func out;\nvoid FAR *out_desc;\n{\n    struct inflate_state FAR *state;\n    unsigned char FAR *next;    /* next input */\n    unsigned char FAR *put;     /* next output */\n    unsigned have, left;        /* available input and output */\n    unsigned long hold;         /* bit buffer */\n    unsigned bits;              /* bits in bit buffer */\n    unsigned copy;              /* number of stored or match bytes to copy */\n    unsigned char FAR *from;    /* where to copy match bytes from */\n    code here;                  /* current decoding table entry */\n    code last;                  /* parent table entry */\n    unsigned len;               /* length to copy for repeats, bits to drop */\n    int ret;                    /* return code */\n    static const unsigned short order[19] = /* permutation of code lengths */\n        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};\n\n    /* Check that the strm exists and that the state was initialized */\n    if (strm == Z_NULL || strm->state == Z_NULL)\n        return Z_STREAM_ERROR;\n    state = (struct inflate_state FAR *)strm->state;\n\n    /* Reset the state */\n    strm->msg = Z_NULL;\n    state->mode = TYPE;\n    state->last = 0;\n    state->whave = 0;\n    next = strm->next_in;\n    have = next != Z_NULL ? strm->avail_in : 0;\n    hold = 0;\n    bits = 0;\n    put = state->window;\n    left = state->wsize;\n\n    /* Inflate until end of block marked as last */\n    for (;;)\n        switch (state->mode) {\n        case TYPE:\n            /* determine and dispatch block type */\n            if (state->last) {\n                BYTEBITS();\n                state->mode = DONE;\n                break;\n            }\n            NEEDBITS(3);\n            state->last = BITS(1);\n            DROPBITS(1);\n            switch (BITS(2)) {\n            case 0:                             /* stored block */\n                Tracev((stderr, \"inflate:     stored block%s\\n\",\n                        state->last ? \" (last)\" : \"\"));\n                state->mode = STORED;\n                break;\n            case 1:                             /* fixed block */\n                fixedtables(state);\n                Tracev((stderr, \"inflate:     fixed codes block%s\\n\",\n                        state->last ? \" (last)\" : \"\"));\n                state->mode = LEN;              /* decode codes */\n                break;\n            case 2:                             /* dynamic block */\n                Tracev((stderr, \"inflate:     dynamic codes block%s\\n\",\n                        state->last ? \" (last)\" : \"\"));\n                state->mode = TABLE;\n                break;\n            case 3:\n                strm->msg = (char *)\"invalid block type\";\n                state->mode = BAD;\n            }\n            DROPBITS(2);\n            break;\n\n        case STORED:\n            /* get and verify stored block length */\n            BYTEBITS();                         /* go to byte boundary */\n            NEEDBITS(32);\n            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {\n                strm->msg = (char *)\"invalid stored block lengths\";\n                state->mode = BAD;\n                break;\n            }\n            state->length = (unsigned)hold & 0xffff;\n            Tracev((stderr, \"inflate:       stored length %u\\n\",\n                    state->length));\n            INITBITS();\n\n            /* copy stored block from input to output */\n            while (state->length != 0) {\n                copy = state->length;\n                PULL();\n                ROOM();\n                if (copy > have) copy = have;\n                if (copy > left) copy = left;\n                zmemcpy(put, next, copy);\n                have -= copy;\n                next += copy;\n                left -= copy;\n                put += copy;\n                state->length -= copy;\n            }\n            Tracev((stderr, \"inflate:       stored end\\n\"));\n            state->mode = TYPE;\n            break;\n\n        case TABLE:\n            /* get dynamic table entries descriptor */\n            NEEDBITS(14);\n            state->nlen = BITS(5) + 257;\n            DROPBITS(5);\n            state->ndist = BITS(5) + 1;\n            DROPBITS(5);\n            state->ncode = BITS(4) + 4;\n            DROPBITS(4);\n#ifndef PKZIP_BUG_WORKAROUND\n            if (state->nlen > 286 || state->ndist > 30) {\n                strm->msg = (char *)\"too many length or distance symbols\";\n                state->mode = BAD;\n                break;\n            }\n#endif\n            Tracev((stderr, \"inflate:       table sizes ok\\n\"));\n\n            /* get code length code lengths (not a typo) */\n            state->have = 0;\n            while (state->have < state->ncode) {\n                NEEDBITS(3);\n                state->lens[order[state->have++]] = (unsigned short)BITS(3);\n                DROPBITS(3);\n            }\n            while (state->have < 19)\n                state->lens[order[state->have++]] = 0;\n            state->next = state->codes;\n            state->lencode = (code const FAR *)(state->next);\n            state->lenbits = 7;\n            ret = inflate_table(CODES, state->lens, 19, &(state->next),\n                                &(state->lenbits), state->work);\n            if (ret) {\n                strm->msg = (char *)\"invalid code lengths set\";\n                state->mode = BAD;\n                break;\n            }\n            Tracev((stderr, \"inflate:       code lengths ok\\n\"));\n\n            /* get length and distance code code lengths */\n            state->have = 0;\n            while (state->have < state->nlen + state->ndist) {\n                for (;;) {\n                    here = state->lencode[BITS(state->lenbits)];\n                    if ((unsigned)(here.bits) <= bits) break;\n                    PULLBYTE();\n                }\n                if (here.val < 16) {\n                    NEEDBITS(here.bits);\n                    DROPBITS(here.bits);\n                    state->lens[state->have++] = here.val;\n                }\n                else {\n                    if (here.val == 16) {\n                        NEEDBITS(here.bits + 2);\n                        DROPBITS(here.bits);\n                        if (state->have == 0) {\n                            strm->msg = (char *)\"invalid bit length repeat\";\n                            state->mode = BAD;\n                            break;\n                        }\n                        len = (unsigned)(state->lens[state->have - 1]);\n                        copy = 3 + BITS(2);\n                        DROPBITS(2);\n                    }\n                    else if (here.val == 17) {\n                        NEEDBITS(here.bits + 3);\n                        DROPBITS(here.bits);\n                        len = 0;\n                        copy = 3 + BITS(3);\n                        DROPBITS(3);\n                    }\n                    else {\n                        NEEDBITS(here.bits + 7);\n                        DROPBITS(here.bits);\n                        len = 0;\n                        copy = 11 + BITS(7);\n                        DROPBITS(7);\n                    }\n                    if (state->have + copy > state->nlen + state->ndist) {\n                        strm->msg = (char *)\"invalid bit length repeat\";\n                        state->mode = BAD;\n                        break;\n                    }\n                    while (copy--)\n                        state->lens[state->have++] = (unsigned short)len;\n                }\n            }\n\n            /* handle error breaks in while */\n            if (state->mode == BAD) break;\n\n            /* check for end-of-block code (better have one) */\n            if (state->lens[256] == 0) {\n                strm->msg = (char *)\"invalid code -- missing end-of-block\";\n                state->mode = BAD;\n                break;\n            }\n\n            /* build code tables -- note: do not change the lenbits or distbits\n               values here (9 and 6) without reading the comments in inftrees.h\n               concerning the ENOUGH constants, which depend on those values */\n            state->next = state->codes;\n            state->lencode = (code const FAR *)(state->next);\n            state->lenbits = 9;\n            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),\n                                &(state->lenbits), state->work);\n            if (ret) {\n                strm->msg = (char *)\"invalid literal/lengths set\";\n                state->mode = BAD;\n                break;\n            }\n            state->distcode = (code const FAR *)(state->next);\n            state->distbits = 6;\n            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,\n                            &(state->next), &(state->distbits), state->work);\n            if (ret) {\n                strm->msg = (char *)\"invalid distances set\";\n                state->mode = BAD;\n                break;\n            }\n            Tracev((stderr, \"inflate:       codes ok\\n\"));\n            state->mode = LEN;\n\n        case LEN:\n            /* use inflate_fast() if we have enough input and output */\n            if (have >= 6 && left >= 258) {\n                RESTORE();\n                if (state->whave < state->wsize)\n                    state->whave = state->wsize - left;\n                inflate_fast(strm, state->wsize);\n                LOAD();\n                break;\n            }\n\n            /* get a literal, length, or end-of-block code */\n            for (;;) {\n                here = state->lencode[BITS(state->lenbits)];\n                if ((unsigned)(here.bits) <= bits) break;\n                PULLBYTE();\n            }\n            if (here.op && (here.op & 0xf0) == 0) {\n                last = here;\n                for (;;) {\n                    here = state->lencode[last.val +\n                            (BITS(last.bits + last.op) >> last.bits)];\n                    if ((unsigned)(last.bits + here.bits) <= bits) break;\n                    PULLBYTE();\n                }\n                DROPBITS(last.bits);\n            }\n            DROPBITS(here.bits);\n            state->length = (unsigned)here.val;\n\n            /* process literal */\n            if (here.op == 0) {\n                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n                        \"inflate:         literal '%c'\\n\" :\n                        \"inflate:         literal 0x%02x\\n\", here.val));\n                ROOM();\n                *put++ = (unsigned char)(state->length);\n                left--;\n                state->mode = LEN;\n                break;\n            }\n\n            /* process end of block */\n            if (here.op & 32) {\n                Tracevv((stderr, \"inflate:         end of block\\n\"));\n                state->mode = TYPE;\n                break;\n            }\n\n            /* invalid code */\n            if (here.op & 64) {\n                strm->msg = (char *)\"invalid literal/length code\";\n                state->mode = BAD;\n                break;\n            }\n\n            /* length code -- get extra bits, if any */\n            state->extra = (unsigned)(here.op) & 15;\n            if (state->extra != 0) {\n                NEEDBITS(state->extra);\n                state->length += BITS(state->extra);\n                DROPBITS(state->extra);\n            }\n            Tracevv((stderr, \"inflate:         length %u\\n\", state->length));\n\n            /* get distance code */\n            for (;;) {\n                here = state->distcode[BITS(state->distbits)];\n                if ((unsigned)(here.bits) <= bits) break;\n                PULLBYTE();\n            }\n            if ((here.op & 0xf0) == 0) {\n                last = here;\n                for (;;) {\n                    here = state->distcode[last.val +\n                            (BITS(last.bits + last.op) >> last.bits)];\n                    if ((unsigned)(last.bits + here.bits) <= bits) break;\n                    PULLBYTE();\n                }\n                DROPBITS(last.bits);\n            }\n            DROPBITS(here.bits);\n            if (here.op & 64) {\n                strm->msg = (char *)\"invalid distance code\";\n                state->mode = BAD;\n                break;\n            }\n            state->offset = (unsigned)here.val;\n\n            /* get distance extra bits, if any */\n            state->extra = (unsigned)(here.op) & 15;\n            if (state->extra != 0) {\n                NEEDBITS(state->extra);\n                state->offset += BITS(state->extra);\n                DROPBITS(state->extra);\n            }\n            if (state->offset > state->wsize - (state->whave < state->wsize ?\n                                                left : 0)) {\n                strm->msg = (char *)\"invalid distance too far back\";\n                state->mode = BAD;\n                break;\n            }\n            Tracevv((stderr, \"inflate:         distance %u\\n\", state->offset));\n\n            /* copy match from window to output */\n            do {\n                ROOM();\n                copy = state->wsize - state->offset;\n                if (copy < left) {\n                    from = put + copy;\n                    copy = left - copy;\n                }\n                else {\n                    from = put - state->offset;\n                    copy = left;\n                }\n                if (copy > state->length) copy = state->length;\n                state->length -= copy;\n                left -= copy;\n                do {\n                    *put++ = *from++;\n                } while (--copy);\n            } while (state->length != 0);\n            break;\n\n        case DONE:\n            /* inflate stream terminated properly -- write leftover output */\n            ret = Z_STREAM_END;\n            if (left < state->wsize) {\n                if (out(out_desc, state->window, state->wsize - left))\n                    ret = Z_BUF_ERROR;\n            }\n            goto inf_leave;\n\n        case BAD:\n            ret = Z_DATA_ERROR;\n            goto inf_leave;\n\n        default:                /* can't happen, but makes compilers happy */\n            ret = Z_STREAM_ERROR;\n            goto inf_leave;\n        }\n\n    /* Return unused input */\n  inf_leave:\n    strm->next_in = next;\n    strm->avail_in = have;\n    return ret;\n}\n\nint ZEXPORT inflateBackEnd(strm)\nz_streamp strm;\n{\n    if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)\n        return Z_STREAM_ERROR;\n    ZFREE(strm, strm->state);\n    strm->state = Z_NULL;\n    Tracev((stderr, \"inflate: end\\n\"));\n    return Z_OK;\n}\n"},{"col":4,"comment":"null","endLoc":172,"header":"def _hide_parent_artists(self)","id":16721,"name":"_hide_parent_artists","nodeType":"Function","startLoc":165,"text":"def _hide_parent_artists(self):\n        # Turn off spines and current axes\n        for s in self.spines.values():\n            s.set_visible(False)\n\n        self.xaxis.set_visible(False)\n        if self.frame_class is not RectangularFrame1D:\n            self.yaxis.set_visible(False)"},{"id":16722,"name":"inffast.c","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* inffast.c -- fast decoding\n * Copyright (C) 1995-2008, 2010 Mark Adler\n * For conditions of distribution and use, see copyright notice in zlib.h\n */\n\n#include \"zutil.h\"\n#include \"inftrees.h\"\n#include \"inflate.h\"\n#include \"inffast.h\"\n\n#ifndef ASMINF\n\n/* Allow machine dependent optimization for post-increment or pre-increment.\n   Based on testing to date,\n   Pre-increment preferred for:\n   - PowerPC G3 (Adler)\n   - MIPS R5000 (Randers-Pehrson)\n   Post-increment preferred for:\n   - none\n   No measurable difference:\n   - Pentium III (Anderson)\n   - M68060 (Nikl)\n */\n#ifdef POSTINC\n#  define OFF 0\n#  define PUP(a) *(a)++\n#else\n#  define OFF 1\n#  define PUP(a) *++(a)\n#endif\n\n/*\n   Decode literal, length, and distance codes and write out the resulting\n   literal and match bytes until either not enough input or output is\n   available, an end-of-block is encountered, or a data error is encountered.\n   When large enough input and output buffers are supplied to inflate(), for\n   example, a 16K input buffer and a 64K output buffer, more than 95% of the\n   inflate execution time is spent in this routine.\n\n   Entry assumptions:\n\n        state->mode == LEN\n        strm->avail_in >= 6\n        strm->avail_out >= 258\n        start >= strm->avail_out\n        state->bits < 8\n\n   On return, state->mode is one of:\n\n        LEN -- ran out of enough output space or enough available input\n        TYPE -- reached end of block code, inflate() to interpret next block\n        BAD -- error in block data\n\n   Notes:\n\n    - The maximum input bits used by a length/distance pair is 15 bits for the\n      length code, 5 bits for the length extra, 15 bits for the distance code,\n      and 13 bits for the distance extra.  This totals 48 bits, or six bytes.\n      Therefore if strm->avail_in >= 6, then there is enough input to avoid\n      checking for available input while decoding.\n\n    - The maximum bytes that a single length/distance pair can output is 258\n      bytes, which is the maximum length that can be coded.  inflate_fast()\n      requires strm->avail_out >= 258 for each loop to avoid checking for\n      output space.\n */\nvoid ZLIB_INTERNAL inflate_fast(strm, start)\nz_streamp strm;\nunsigned start;         /* inflate()'s starting value for strm->avail_out */\n{\n    struct inflate_state FAR *state;\n    unsigned char FAR *in;      /* local strm->next_in */\n    unsigned char FAR *last;    /* while in < last, enough input available */\n    unsigned char FAR *out;     /* local strm->next_out */\n    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */\n    unsigned char FAR *end;     /* while out < end, enough space available */\n#ifdef INFLATE_STRICT\n    unsigned dmax;              /* maximum distance from zlib header */\n#endif\n    unsigned wsize;             /* window size or zero if not using window */\n    unsigned whave;             /* valid bytes in the window */\n    unsigned wnext;             /* window write index */\n    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */\n    unsigned long hold;         /* local strm->hold */\n    unsigned bits;              /* local strm->bits */\n    code const FAR *lcode;      /* local strm->lencode */\n    code const FAR *dcode;      /* local strm->distcode */\n    unsigned lmask;             /* mask for first level of length codes */\n    unsigned dmask;             /* mask for first level of distance codes */\n    code here;                  /* retrieved table entry */\n    unsigned op;                /* code bits, operation, extra bits, or */\n                                /*  window position, window bytes to copy */\n    unsigned len;               /* match length, unused bytes */\n    unsigned dist;              /* match distance */\n    unsigned char FAR *from;    /* where to copy match from */\n\n    /* copy state to local variables */\n    state = (struct inflate_state FAR *)strm->state;\n    in = strm->next_in - OFF;\n    last = in + (strm->avail_in - 5);\n    out = strm->next_out - OFF;\n    beg = out - (start - strm->avail_out);\n    end = out + (strm->avail_out - 257);\n#ifdef INFLATE_STRICT\n    dmax = state->dmax;\n#endif\n    wsize = state->wsize;\n    whave = state->whave;\n    wnext = state->wnext;\n    window = state->window;\n    hold = state->hold;\n    bits = state->bits;\n    lcode = state->lencode;\n    dcode = state->distcode;\n    lmask = (1U << state->lenbits) - 1;\n    dmask = (1U << state->distbits) - 1;\n\n    /* decode literals and length/distances until end-of-block or not enough\n       input data or output space */\n    do {\n        if (bits < 15) {\n            hold += (unsigned long)(PUP(in)) << bits;\n            bits += 8;\n            hold += (unsigned long)(PUP(in)) << bits;\n            bits += 8;\n        }\n        here = lcode[hold & lmask];\n      dolen:\n        op = (unsigned)(here.bits);\n        hold >>= op;\n        bits -= op;\n        op = (unsigned)(here.op);\n        if (op == 0) {                          /* literal */\n            Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n                    \"inflate:         literal '%c'\\n\" :\n                    \"inflate:         literal 0x%02x\\n\", here.val));\n            PUP(out) = (unsigned char)(here.val);\n        }\n        else if (op & 16) {                     /* length base */\n            len = (unsigned)(here.val);\n            op &= 15;                           /* number of extra bits */\n            if (op) {\n                if (bits < op) {\n                    hold += (unsigned long)(PUP(in)) << bits;\n                    bits += 8;\n                }\n                len += (unsigned)hold & ((1U << op) - 1);\n                hold >>= op;\n                bits -= op;\n            }\n            Tracevv((stderr, \"inflate:         length %u\\n\", len));\n            if (bits < 15) {\n                hold += (unsigned long)(PUP(in)) << bits;\n                bits += 8;\n                hold += (unsigned long)(PUP(in)) << bits;\n                bits += 8;\n            }\n            here = dcode[hold & dmask];\n          dodist:\n            op = (unsigned)(here.bits);\n            hold >>= op;\n            bits -= op;\n            op = (unsigned)(here.op);\n            if (op & 16) {                      /* distance base */\n                dist = (unsigned)(here.val);\n                op &= 15;                       /* number of extra bits */\n                if (bits < op) {\n                    hold += (unsigned long)(PUP(in)) << bits;\n                    bits += 8;\n                    if (bits < op) {\n                        hold += (unsigned long)(PUP(in)) << bits;\n                        bits += 8;\n                    }\n                }\n                dist += (unsigned)hold & ((1U << op) - 1);\n#ifdef INFLATE_STRICT\n                if (dist > dmax) {\n                    strm->msg = (char *)\"invalid distance too far back\";\n                    state->mode = BAD;\n                    break;\n                }\n#endif\n                hold >>= op;\n                bits -= op;\n                Tracevv((stderr, \"inflate:         distance %u\\n\", dist));\n                op = (unsigned)(out - beg);     /* max distance in output */\n                if (dist > op) {                /* see if copy from window */\n                    op = dist - op;             /* distance back in window */\n                    if (op > whave) {\n                        if (state->sane) {\n                            strm->msg =\n                                (char *)\"invalid distance too far back\";\n                            state->mode = BAD;\n                            break;\n                        }\n#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n                        if (len <= op - whave) {\n                            do {\n                                PUP(out) = 0;\n                            } while (--len);\n                            continue;\n                        }\n                        len -= op - whave;\n                        do {\n                            PUP(out) = 0;\n                        } while (--op > whave);\n                        if (op == 0) {\n                            from = out - dist;\n                            do {\n                                PUP(out) = PUP(from);\n                            } while (--len);\n                            continue;\n                        }\n#endif\n                    }\n                    from = window - OFF;\n                    if (wnext == 0) {           /* very common case */\n                        from += wsize - op;\n                        if (op < len) {         /* some from window */\n                            len -= op;\n                            do {\n                                PUP(out) = PUP(from);\n                            } while (--op);\n                            from = out - dist;  /* rest from output */\n                        }\n                    }\n                    else if (wnext < op) {      /* wrap around window */\n                        from += wsize + wnext - op;\n                        op -= wnext;\n                        if (op < len) {         /* some from end of window */\n                            len -= op;\n                            do {\n                                PUP(out) = PUP(from);\n                            } while (--op);\n                            from = window - OFF;\n                            if (wnext < len) {  /* some from start of window */\n                                op = wnext;\n                                len -= op;\n                                do {\n                                    PUP(out) = PUP(from);\n                                } while (--op);\n                                from = out - dist;      /* rest from output */\n                            }\n                        }\n                    }\n                    else {                      /* contiguous in window */\n                        from += wnext - op;\n                        if (op < len) {         /* some from window */\n                            len -= op;\n                            do {\n                                PUP(out) = PUP(from);\n                            } while (--op);\n                            from = out - dist;  /* rest from output */\n                        }\n                    }\n                    while (len > 2) {\n                        PUP(out) = PUP(from);\n                        PUP(out) = PUP(from);\n                        PUP(out) = PUP(from);\n                        len -= 3;\n                    }\n                    if (len) {\n                        PUP(out) = PUP(from);\n                        if (len > 1)\n                            PUP(out) = PUP(from);\n                    }\n                }\n                else {\n                    from = out - dist;          /* copy direct from output */\n                    do {                        /* minimum length is three */\n                        PUP(out) = PUP(from);\n                        PUP(out) = PUP(from);\n                        PUP(out) = PUP(from);\n                        len -= 3;\n                    } while (len > 2);\n                    if (len) {\n                        PUP(out) = PUP(from);\n                        if (len > 1)\n                            PUP(out) = PUP(from);\n                    }\n                }\n            }\n            else if ((op & 64) == 0) {          /* 2nd level distance code */\n                here = dcode[here.val + (hold & ((1U << op) - 1))];\n                goto dodist;\n            }\n            else {\n                strm->msg = (char *)\"invalid distance code\";\n                state->mode = BAD;\n                break;\n            }\n        }\n        else if ((op & 64) == 0) {              /* 2nd level length code */\n            here = lcode[here.val + (hold & ((1U << op) - 1))];\n            goto dolen;\n        }\n        else if (op & 32) {                     /* end-of-block */\n            Tracevv((stderr, \"inflate:         end of block\\n\"));\n            state->mode = TYPE;\n            break;\n        }\n        else {\n            strm->msg = (char *)\"invalid literal/length code\";\n            state->mode = BAD;\n            break;\n        }\n    } while (in < last && out < end);\n\n    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n    len = bits >> 3;\n    in -= len;\n    bits -= len << 3;\n    hold &= (1U << bits) - 1;\n\n    /* update state and return */\n    strm->next_in = in + OFF;\n    strm->next_out = out + OFF;\n    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));\n    strm->avail_out = (unsigned)(out < end ?\n                                 257 + (end - out) : 257 - (out - end));\n    state->hold = hold;\n    state->bits = bits;\n    return;\n}\n\n/*\n   inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):\n   - Using bit fields for code structure\n   - Different op definition to avoid & for extra bits (do & for table bits)\n   - Three separate decoding do-loops for direct, window, and wnext == 0\n   - Special case for distance > 1 copies to do overlapped load and store copy\n   - Explicit branch predictions (based on measured branch probabilities)\n   - Deferring match copy and interspersed it with decoding subsequent codes\n   - Swapping literal/length else\n   - Swapping window/direct else\n   - Larger unrolled copy loops (three is about right)\n   - Moving len -= 3 statement into middle of loop\n */\n\n#endif /* !ASMINF */\n"},{"id":16723,"name":"cextern/cfitsio/docs","nodeType":"Package"},{"id":16724,"name":"changes.txt","nodeType":"TextFile","path":"cextern/cfitsio/docs","text":"                   Log of Changes Made to CFITSIO\n                   \nVersion 4.0.0 - May 2021                   \n\n  - Removed separate directory for zlib/gzip code, and updated\n    configuration to check for zlib on the user's system (required).\n    When use of cURL is enabled, it may also pull in zlib such\n    that user applications may not need to link with it separately.\n\n  - Changed version numbering to 3-field format.\n      \n  - Added new calculator functions SETNULL(x,y) to allow substitution of\n    NULL values into tables, and GTIOVERLAP() for calculating the amount\n    of GTI overlap exposure for a time bin.\n    \n  - Fix added for proper handling of string columns with zero repeat\n    count.\n    \n  - Fix to column filtering expressions which write #NULL values to\n    columns of type (J) format.\n    \n  - Fix to memory clearing when using polygon shapes in region files.\n     \n  - Fix to fits_str2time function so that it now flags a particular case\n    of bad syntax which was previously getting through.\n    \n  - In ffgclb and ffpclb (read/write byte columns), the \"undocumented\"\n    feature of being able to transfer columns 'A' string columnss as\n    byte arrays is now handled correctly, with improved error checking\n    via updates to ffgcprll.  More documentation on string handling is\n    in cfitsio.tex.\n\n  - Fix bug in 'colfilter' functionality.  When performing a\n    column deletion of the form -COLNAM*, and multiple matches\n    existed, then none of the matches got deleted.  Now the\n    first is deleted as expected.\n    \n  - Improved handling of corner case in ffpkn functions.\n\n  - In ffgky, modified TULONG case to allow it to read unsigned\n    values greater than the 8-byte signed limit.\n    \n  - Fix to parsing of corner case of extended file syntax.\n\n  - Major updates to CMake configuration.\n\t\t   \nVersion 3.49 - Aug 2020\n\n  - Fix to imcompress.c.  It now turns off quantization if ZSCALE\n    and ZZERO columns are missing.  Treatment will be the same as\n    if ZQUANTIZ were set to 'NONE', even if ZQUANTIZ is present\n    and set to something else.\n\n  - Added mutex to fits_execute_template() function so that the\n    creation of files using ASCII templates will be thread safe.\n    \t\t   \n  - In fpack when using -table flag, replaced warning message with a\n    more detailed description mentioning FITS format update.\n\t\t   \n  - Added flag to CMake builds to disable curl dependency.  Also\n    only add CURL_LIBRARIES to CMake link target if curl is found.\n\t\t   \n  - Minor adjustment to download progress output.\n                   \nVersion 3.48 - Mar 2020\n\n  - Now can handle parentheses in path names rather than automatically\n    interpreting them as output file specifiers.  \n\n  - Fixed bug in imcompress.c that wasn't properly handling conversion\n    between float and double types when reading from a gzip compressed\n    float or double image.\n    \n  - Fixed bug that was preventing use of bracket and parentheses symbols\n    in pathnames when opening multiple READWRITE files, even when \n    requesting no-extended-syntax usage. *This fix necessitates a \n    library interface version number change.\n    \n  - Fixed bug in ffmnhd / fits_movnam_hdu to properly handle wildcard\n    syntax.\n\n  - Fixed bug in fits_open_extlist to handle filename[EXT] syntax\n    properly.  The hdutype parameter may now be null.  More documentaion\n    for this function is in cfitsio.tex.\n\n  - Added new function fits_copy_hdutab to create a new table with the same\n    structure as an existing table.\n\n  - fits_copy_col / ffcpcl handles long long integer data types more\n    natively to prevent precision loss.\n\n  - histo.c routines now recognize integer columns that have been scaled by\n    TSCALn keywords and may be closer to floating point type.\n                   \n  - Added backward compatibility for very old Rice compressed files which\n    were not using the ZVAL2 keyword in the way that later became standard.\n\n  - Change made to cfitsio.pc.in to prevent forcing downstream libraries\n    to link against cfitsio's dependencies when using pkgconfig.\n\nVersion 3.47 - May 2019\n\n  - Added set of drivers for performing ftps file transfers.\n\n  - Tile sizes for compression may now be specified for any pair of\n    axes, where previously 2D tiles where limited to just X and y.\n    \n  - Fix to ffgsky and ffgkls functions for case of keyword with long\n    string values where the final CONTINUE statement ended with '&'.\n    If the final CONTINUE also contained a comment, it was being \n    repeated twice when passed back through the 'comm' argument.\n      \n  - Fix made to ffedit_columns() for case of multiple col filters\n    containing wildcards.  Only the first filter was being searched.\n                     \n  - fits_copy_rows (ffcprw) can now handle 'P'-type variable-length \n    columns.\n    \n  - Fix made to an obscure case in fits_modify_vector_len, where a \n    wrongly issued EOF error may occur.\n                   \n  - Added internal fffvcl() function.\n                   \nVersion 3.46 - Oct 2018 (Ftools release)\n                   \n  - Improved the algorithm for ensuring no tile dimensions are smaller \n    than 4 pixels for HCOMPRESS compression.\n                   \n  - Added new functions intended to assist in diagnosing (primarily \n    https) download issues: fits_show_download_progress,\n    fits_get_timeout, fits_set_timeout.\n\n  - Added the '-O <file>' option to fpack, which previously existed only\n    for funpack.  Also added fpack/funpack auto-removal of .bz2 suffix \n    equivalent to what existed for .gz.\n\n  - For the fpack '-table' cases, warning message is now sent to stderr \n    instead of stdout.  This is to allow users to pipe the results from\n    stdout in valid FITS format.  (The warning message is otherwise placed\n    at the start of the FITS file and therefore corrupts it.)\n\n  - Fix made to the '-P' file prefix option in funpack.\n\n  - Added wildcard deletion syntax for columns, i.e. -COLNAM* will delete\n    the first matching column as always; -COLNAM*+ will delete all matching\n    columns (or none); exact symmetry with the keyword deletion syntax.\n\nVersion 3.45 - May 2018\n                   \n  - New support for reading and writing unsigned long long datatypes.\n    This includes 'implicit datatype conversion' between the unsigned long\n    long datatype and all the other datatypes.\n    \n  - Increased the hardcoded NMAXFILES setting for maximum number of\n    open files from 1000 to 10000.\n                   \n  - Bug fix to fits_calc_binning wrapper function, which wasn't filling\n    in the returned float variables.\n    \n  - Fixed a parsing bug for image subsection and column binning range\n    specifiers that was introduced in v3.44.\n\nVersion 3.44 - April 2018\n\n  - This release primarily patches security vulnerabilities.  We\n    strongly encourage this upgrade, particularly for those running \n    CFITSIO in web accessible applications.\n    \n    In addition, the following enhancements and fixes were made: \n\n  - Enhancement to 'template' and 'colfilter' functionality.  It is now\n    possible to delete multiple keywords using wildcard syntax. See\n    \"Column and Keyword Filtering Specification\" section of manual for\n    details.\n  \n  - histo.c uses double precision internally for all floating point\n    binning; new double-precision subroutines fits_calc_binningd(),\n    fits_rebin_wcsd(), and fits_make_histd(); existing\n    single-precision histogram functions still work but convert values\n    to double-precision internally.\n\n  - new subroutine fits_copy_cols() / ffccls() to copy multiple columns\n  \n  - Fix in imcompress.c for HCOMPRESS and PLIO compression of unsigned\n    short integers.\n  \n  - Fix to fits_insert_card(ffikey).  It had wrongly been capitalizing\n    letters that appeared before an '=' sign on a CONTINUE line.\n                   \nVersion 3.43 - March 2018\n                   \nThe NASA security team requires the following warning to all users of \nCFITSIO:\n\n   =====\n   The CFITSIO open source software project contains vulnerabilities \n   that could allow a remote, unauthenticated attacker to take control\n   of a server running the CFITSIO software.  These vulnerabilities \n   affect all servers and products running the CFITSIO software.\n\n   The CFITSIO team has released software updates to address these \n   vulnerabilities.  There are no workarounds to address these \n   vulnerabilities.  In all cases, the CFITSIO team is recommending an \n   immediate update to resolve the issues.\n   =====\n\n  - Fixed security vulnerabilities.   \n \n  - Calls to https driver functions in cfileio.c need to be macro-\n     protected by the HAVE_NET_SERVICES variable (as are the http and\n     ftp driver function calls).  Otherwise CMake builds on native\n     Windows will fail since drvrnet.o is left empty.\n                   \n   - Bug fix to ffmvec function.  Should be resetting a local colptr\n     variable after making a call to ffiblk (which can reallocate Ftpr->\n     tableptr).  Originally reported by Willem van Straten.\n     \n   - Ignore any attempted request to not quantize an image before\n     compressing it if the image has integer datatype pixels.\n     \n   - Improved error message construction throughout CFITSIO.\n                   \nVersion 3.42 - August 2017 (Stand-alone release)\n                   \n   - added https support to the collection of drivers handled in cfileio.c\n     and drvrnet.c.  This also handles the case where http transfers are \n     rerouted to https.  Note that this enhancement introduces a dependency\n     on the libcurl development package.  If this package is absent, CFITSIO\n     will still build but will not have https capability.\n                   \n   - made fix to imcomp_init_table function in imcompress.c.  It now writes\n     ZSIMPLE keyword only to a compressed image that will be placed in the\n     primary header.\n     \n   - fix made to fits_get_col_display_width for case of a vector column\n     of strings. \n\nVersion 3.42 - March 2017 (Ftools release only)\n\n   - in ftp_open_network and in ftp_file_exist, added code to repeatedly\n     attempt to make a ftp connection if the ftp server does not respond\n     to the first request. (some ftp servers don't appear to be 100% reliable).\n\n   - in drvrnet.c added many calls to 'fclose' to close unneeded files,\n     to avoid exceeding the maximum allowed number of files that can be \n     open at once.\n     \n   - made substantial changes to the ftp_checkfile and http_checkfile routines\n     to streamline the process of checking for the existence of a .gz or .Z\n     compressed version of the file before opening the uncompressed file\n     (when using http or ftp to open the file). \n\n   - modified the code in ftp_open_network to send \"\\r\\n\" as end-of-line\n     characters instead of just \"\\n\".  Some ftp servers (in particular,\n     at heasarc.gsfc.nasa.gov) now require both characters, otherwise the\n     network connection simply hangs.\n     \n   - modified the http_open_network routine to handle HTTP 301 or 302 redirects\n     to a FTP url.  This is needed to support the new configuration on\n     the heasarc HTTP server which sometimes redirects http URLS to a ftp URL.\n\nVersion 3.41 - November 2016\n\n   - The change made in version 3.40 to include strings.h caused problems on\n     Windows (and other) platforms, so this change was backed out. The reason\n     for including it was to define the strcasecmp and strcasencmp functions, so\n     as an alternative, new equivalent functions called fits_strcasecmp and\n     fits_strncasecmp have been added to CFITSIO.as a substitute. All the\n     previous calls to the str[n]casecmp functions have been changed to\n     now call fits_str[n]casecmp. In addition, the previously defined \n     ngp_strcasecmp function (in grparser.c) has been removed and the calls to\n     it have been changed to fits_strcasecmp.\n     \n   - The speed.c utility program was changed to correctly call \n     the gettimeofday function with a NULL second arguement. \n\nVersion 3.40 - October 2016\n\n   - fixed a bug when writing long string keywords with the CONTINUE convention\n     which caused the CONTINUE'd strings to only be 16 characters long, instead\n     of using up all the available space in the 80-character header record.\n\n   - fixed a missing 'defined' keyword in fitsio.h.\n\n   - replaced all calls to strtok (which is not threadsafe) with a new ffstrtok\n     function which internally calls the threadsafe strtok_r function.  One \n     byproduct of this change is that <strings.h> must also be included\n     in several of the C source code files.\n\n   - modified the ffphbn function in putkey.c to support TFORM specifiers that\n     use lowercase 'p' (instead of uppercase) when referring to a variable-length\n     array column.\n\n   - modified the lexical parser in eval.y and eval_y.c to support bit array \n     columns (with TFORMn = 'X') with greater than 256 elements. Fix to bitcmp \n     function:  The internal 'stream' array is now\n     allocated dynamically rather than statically fixed at size 256.\n     This was failing when users attempted a row filtering of a bitcol\n     that was wider than 256X. In bitlgte, bitand, and bitor functions, replaced \n     static stream[256] array allocation with dynamic allocation.  \n\n   - modified the ffiter function in putcol.c to fix a problem which could\n     cause the iterator function to incorrectly deal with null values.  This\n     only affected TLONG type columns in cases where sizeof(long) = 8, as well\n     as for TLONGLONG type columns.\n\n   - Fix made to uncompress2mem function in zcomprss.c for case where output\n     uncompressed file expands to over the 2^32 (4Gb) limit.  It now\n     checks for this case at the start, and implements a 4Gb paging\n     system through the output buffer.  The problem was specifically\n     caused by the d_stream.avail_out member being of 4-byte type uInt,\n     and thus unable to handle any memory position values above 4Gb. \n\n   - fixed a bug in fpackutil.c when using the -i2f (integer to float) option\n     in fpack to compress an integer image that is scaled with non-default values\n     for BSCALE and BZERO. This required an additional call to ffrhdu to reset\n     the internal structures that describe the input FITS file.\n\n   - modified fits_uncompress_table in imcompress.c to silently ignore the\n     ZTILELEN keyword value if it larger than the number of rows in the table\n     \n   - Tweak strcasecmp/strncasecmp ifdefs to exclude 64-bit MINGW\n     environment, as it does not lack those functions. (eval_l.c,\n     fitsio2.h)\n\n   - CMakeLists.txt: Set M_LIB to \"\" for MINGW build environment (in\n     addition to MSVC).\n\n   - Makefile.in: Add *.dSYM (non-XCode gcc leftovers on Macs) to\n     clean list.  Install libs by name rather than using a wildcard.\n\n   - configure: Fix rpath token usage for XCode vs. non-XCode gcc on Macs.\n\n\nVersion 3.39 - April 2016\n\n   - added 2 new routines suggested by Eric Mandel:\n      ffhisto3 is similar to ffhisto2, except that it does not close the\n         original file.\n      fits_open_extlist is similar to fits_open_data except that it opens\n         the FITS file and then moves to the first extension in the user-input\n\t list of 'interesting' extensions.\n\n   - in ffpsvc and ffprec, it is necessary to treat CONTINUE, COMMENT, HISTORY,\n     and blank name keywords as a special case which must be treated differently\n     from other keywords because they have no value field and, by definition,\n     have keyword names that are strictly limited in length.\n     \n   - added the Fortran wrapper routines for the 2 new string keyword reading\n     routines (FTGSKY and FTGKSL), and documented all the routines in the\n     FITSIO and CFITSIO users guides.\n\n   - in ffinttyp, added explicit initialization of the input 'negative' \n     argument to 0.\n\n   - added new routine to return the length of the keyword value string:\n         fits_get_key_strlen / ffgksl.  \n     This is primarily intended for use with string keywords\n     that use the CONTINUE convention to continue the\n     value over multiple header records, but this routine can be used\n     to get the length of the value string for any type keyword.\n\n   - added new routine to read string-valued keywords:\n          fits_read_string_key / ffgsky\n     This routine supports normal string keywords as well as long string\n     keywords that use the CONTINUE convention. In many cases this routine\n     may be more convenient to use then the older fits_read_key_longstr\n     routine.\n\n   - changed the prototype of fits_register_driver in fitsio2.h so that the\n     pointer definition argument does not have the same name as the pointer\n     itself (to work around a bug in the pgcc compiler).\n     \n   - added the missing FTDTDM fortran wrapper definition to f77_wrap3.c.\n   \n   - modified Makefile.in and configure.in to add LDFLAGS_BIN for task linker\n     flages, which will be the same as LDFLAGS except on newer Mac OS X where\n     an rpath flag is added.\n\n   - modified Makefile.in to add a new \"make utils\" command which will build\n     fpack, funpack, cookbook, fitscopy, imcopy, smem, speed, and testprog.\n     These programs will be installed into $prfix/bin.\n\n   - fixed a bug when attempting to modify the values in a variable-length\n     bit (\"X\") column in a binary table.\n\n   - reinstated the ability to write HIERARCH keywords that contain characters\n     that would not be allowed in a normal 8-character keyword name, which had\n     been disabled in the previous release.\n\nVersion 3.38 - February 2016\n\n   - CRITICAL BUG FIX:\n     The Intel 15 and 16 compilers (and potentially other compilers) may silently\n     produce incorrect assembly code when compiling CFITSIO with the -O2 (or\n     higher) optimization flag. In particular, this problem could cause  CFITSIO\n     to incorrectly read the values of arrays of 32-bit integers in a  FITS file\n     (i.e., images with BITPIX = 32 or table columns with TFORM = 'J')  when the\n     array is being read into a 'long' integer array in cases where the long\n     array elements are 8 bytes long. \n\n     One way to test if a particular system is affected by this problem is to\n     compile CFITSIO V3.37 (or earlier) with optimization enabled, and then\n     compare the output of the testprog.c program with the testprog.out file\n     that is distributed with CFITSIO. If there are any  differences in the\n     files, then this system might be affected by this bug. Further tests \n     should be performed to determine the exact cause.\n\n     The root cause of this problem was traced to the fact that CFITSIO was\n     aliasing an array of 32-bit integers and an array of 64-bit integers to the\n     same memory location in order to obtain better data I/O efficiency when\n     reading FITS files.  When CFITSIO modified the values in these arrays, it\n     was essential that the processing be done in strict sequential order from\n     one end of the array to the other end, as was implicit in the C code\n     algorithm. In this case, however, the compiler adopted certain  loop\n     optimization techniques that produced assembly code that violated  this\n     assumption.  Technically, the CFITSIO code violates the \"strict aliasing\"\n     assumption in ANSI C99, therefore the affected CFITSIO routines have been\n     modified so that the aliasing of different data types to the same memory\n     location no longer occurs.\n\n   - fixed problem in configure and configure.in which caused the programs that\n     are distributed with CFITSIO (most notably, fack and funpack) to be build\n     without using any compiler optimization options, which could make them\n     run more slowly than expected.\n\n   - in imcompress.c, fixed bug where the rowspertile variable (declared as 'long')\n     was mistakenly declared as a TLONGLONG variable in a call to fits_write_key.\n     This could have caused the ZTILELEN keyword to be written incorrectly in\n     the header of tile-compressed FITS tables on systems where sizeof(long) = 4.\n\n   - in imcompress.c, implemented a new set of routines that safely convert\n     shorter integer arrays into a longer integer arrays (e.g. short to int)\n     where both arrays are aliased to the same memory location.  These\n     special routines were needed to guard against certain compiler optimization\n     techniques that could produce incorrect code.\n \n   - modified the 4 FnNoise5_(type) routines in quantize.c to correctly \n     count the number of non-null pixels in the input array.  Previously the\n     count could be inaccurate if the image mainly consisted of null pixels.\n     This could have caused certain floating point image tiles to be \n     quantized during the image compression process, when in fact the tile\n     did not satisfy all the criteria to be safely quantized.\n     \n   - in imcomp_copy_comp2img, added THEAP to the list of binary table \n     keywords that may be present in the header of a compressed image \n     and should not be copied to the uncompressed image header.\n \n   - modified fits_copy_col to check that when copying a vector column, the\n     vector length in the output column is the same as in the input column.\n     Also modified the code to support the case where a column is being copied\n     to an earlier position in the same table (which shifts the input column\n     over 1 space).\n\n   - added configure option (--with-bzip2) to support reading bzip2 compressed \n     FITS files.  This also required modifications to drvrmem.c and drvrfile.c\n     This depends on having the bzlib library installed on the \n     local machine.  This patch was submitted by Dustin Lang.\n     \n   - replaced calls to 'memcpy' by 'memmove' in getcolb.c, getcold.c,\n     getcole.c, and getcoli.c to support cases where the 2 memory areas \n     overlap. (submitted by Aurelien Jarno)\n\n   - modified the FITS keyword reading and writing routines to potentially\n     support keywords with names longer than 8-characters.  This was implemented\n     in anticipation of a new experimental FITS convention which allows longer \n     keyword names.\n\n   - in fits_quantize_double in quantize.c, test if iseed == N_RANDOM,\n     to avoid the (unlikely) possibility of overflowing the random number\n     array bounds. (The corresponding fits_quantize_float routine already\n     performed this test).\n\n   - in the FnNoise5_short routine in quantize.c, change the first 'if' \n     statement from \"if (nx < 5)\" to \"if )nx < 9)\", in order to support the\n     (very rare) case where the tile is from 5 to 8 pixels wide.  Also make \n     the same change in the 3 other similar FnNoise5_* routines.\n\n   - in the qtree_bitins64 routine in fits_hdecompress.c, must declare the\n     plane_val variable as 'LONGLONG' instead of int.  This bug could have \n     caused integer overflow errors when uncompressing integer*4 images that\n     had been compressed with the Hcompress algorithm, but only in cases\n     where the image contains large regions of pixels whose values are close\n     to the maximum integer*4 value of 2**31. \n\n   - in fits_hcompress.c, call the calloc function instead of malloc when\n     allocating the signbits array, to eliminate the need to individually\n     set each byte to zero.\n\n   - in the ffinit routine, and in a couple other routines that call ffinit,\n     initialize the *fptr input parameter to NULL, even if the input\n     status parameter value is greater than zero.  This helps prevent\n     errors later on if that fptr value is passed to ffclos.\n\n   - modified ftcopy, in edithdu.c, to only abort if status > 0 rather\n     than if status != 0. This had caused a problem in funpack in rare\n     circumstances.\n\n   - in imcompress.c changed all the calls to ffgdes to ffgdesll, to support\n     compressed files greater than 2.1 GB in size.\n\n   - fixed bug in ffeqtyll when it is called with 4th and 5th arguments \n     set to NULL.\n\n   - in fitsio.h, added the standard C++ guard around the declaration of the\n     function fits_read_wcstab.  (reported by Tammo Jan Dijkema, Astron.)\n\n   - in fitsio.h, changed the prototype variable name \"zero\" to \"zeroval\" to\n     avoid conflict in code that uses a literal definition of 'zero' to mean 0.\n\n   - tweaked Makefile.in and configure.in to use LDFLAGS instead of CFLAGS \n     for linking, use Macros for library name, and let fpack and funpack \n     link with shared library.\n\n   - modified an 'ifdef' statement in cfileio.c to test for '__GLIBC__'\n     instead of 'linux' when initializing support for multi-threading.\n\n   - modified ffeqtyll to return an effective column data type of TDOUBLE\n     in the case of a 'K' (64-bit integer) column that has non-integer\n     TSCALn or TZEROn keywords.\n     \n   - modified ffgcls (which returns the value in a column as a formatted string)\n     so that when reading a 'K' (TLONGLONG) column it returns a long long integer\n     value if the column is not scaled, but returns a double floating point\n     value if the column has non-integer TSCALn or TZEROn values.\n\n   - modified fitsio.h to correctly define \"OFF_T long long\" when using\n     the Borland compiler\n\n   - converted the 'end of line' characters in simplerng.c file to the unix\n     style, instead of PC DOS.\n\n   - updated CMakeLists.txt CMake build file which is primarily used to\n     build CFITSIO on Windows machines.\n\n   - modified fits_get_keyclass to recognize ZQUANTIZ and ZDITHER0 as\n     TYP_CMPRS_KEY type keywords, i.e., keywords used in tile compressed\n     image files.\n\n   - added test to see if HAVE_UNISTD_H is defined, as a condition for \n     including unistd.h in drvrfile.c drvrnet.c, drvrsmem.c, and group.c.\n\n   - modified the CMakelist.txt file to fix several issues (primarily for\n     building CFITSIO on Windows machines)..\n\n   - fixed bug when reading tile-compressed images that were compressed with\n     the IRAF PLIO algorithm.  This bug did not affect fpack or funpack, but\n     other software that reads the compressed image could be affected.  The \n     bug would cause the data values to be offset by 32768 from the actual \n     pixel values.\n\nVersion 3.37 - 3 June 2014\n\n   - replaced the random Gaussian and Poissonian distribution functions with\n     new code written by Craig Markwardt derived from public domain C++ functions \n     written by John D Cook.\n\n   - patched fitsio2.h to support CFITSIO on AArch64 (64-bit ARM)\n     architecture (both big and little endian).  Supplied by\n     Marcin Juszkiewicz and Sergio Pascual Ramirez, with further update\n     by Michel Normand.\n     \n   - fixed bug in fpackutil.c that caused fpack to exit prematurely if\n     the FZALGOR directive keyword was present in the HDU header.\n\nVersion 3.36 - 6 December 2013\n\n   - added 9 Dec: small change to the fileseek function in drvrfile.c to\n     support large files > 2 GB when building CFITSIO with MinGW on Windows\n\n   - reorganized the CFITSIO code directory structure; added a 'docs'\n     subdirectory for all the documentation, and a 'zlib' directory\n     for the zlib/gzip file compression code.\n\n   - made major changes to the compression code for FITS binary table\n     to support all types of columns, including variable-length arrays.\n     This code is mainly used via the fpack and funpack programs.\n\n   - increased the number of FITS files that can be opened as one\n     time to 1000, as defined by NMAXFILES in fitsio2.h.\n\n   - made small configuration changes to configure.in, configure,\n     fitsio.h, and drvrfile.c to support large files (64-bit file \n     offsets} when using the mingw-w64 compiler (provided by \n     Benjamin Gilbert).\n\n   - made small change to fits_delete_file to more completely ignore\n     any non-zero input status value.\n\n   - fixed a logic error in a 'if' test when parsing a keyword name\n     in the ngp_keyword_is_write function in grparser.c (provided\n     by David Binderman).\n\n   - when specifying the image compression parameters as part of the\n     compressed image file name (using the \"[compress]\" qualifier\n     after the name of the file), the quantization level value, if\n     specified, was not being recognized by the CFITSIO compression\n     routines. The image would always be compressed with the default\n     quantization level of 4.0, regardless of what was specified.  This\n     affected the imcopy program, and potentially other user-generated\n     application programs that used this method to specify the\n     compression parameters.  This bug did not affect fpack or\n     funpack.   This was fixed in the imcomp_get_compressed_image_par\n     routine in the imcompress.c file. (reported by Sean Peters)\n\n   - defined a new CFITS_API macro in fitsio.h which is used to export the\n     public symbols when building CFITSIO on Windows systems with CMake. This\n     works in conjunction with the new Windows CMake build procedure that\n     is described in the README.win32 file. This complete revamping of the\n     way CFITSIO is built under Windows now supports building 64-bit\n     versions of the library.  Thanks to Daniel Kaneider (Luminance HDR\n     Team) for providing these new  CMake build procedures.\n\n   - modified the way that the low-level file_create routine works when\n     running in the Hera environment to ensure that the FITS file that is \n     created is within the allow user data disk area.\n\n   - modified fits_get_compression_type so that it does not return an error\n     if the HDU is a normal FITS IMAGE extension, and is not a tile-compressed\n     image.\n\n   - modified the low-level ffgcl* and ffpcl* routines to ensure that they\n     never try ro read or write more than 2**31 bytes from disk at one time,\n     as might happen with very large images, to avoid integer overflow errors.\n     Fix kindly provided by Fred Gutsche at NanoFocus AG (www.nanofocus.de).\n     \n   - modified Makefile.in so that doing 'make distclean' does not delete\n     new config.sub and config.guess files that were recently added.\n\n   - adopted a patch from Debian in zcompress.c to \"define\" the values of\n     GZBUFSIZE and BUFFINCR, instead of exporting the symbols as 'int's.\n\nVersion 3.35 - 26 June 2013  (1st beta release was on 24 May)\n\t\t   \n   - fixed problem with the default tile size when compressing images with\n     fpack using the Hcompress algorithm.\n\n   - fixed returned value (\"status\" instead of \"*status\") \n\n   - in imcompress.c, declared some arrays that are used to store the dimensions\n     of the image from 'int' to 'long', to support very large images (at least\n     on systems where sizeof(long) = 8),\n\n   - modified the routines that convert a string value to a float or double\n     to prevent them from returning a NaN or Inf value if the\n     string is \"NaN\" or \"Inf\" (as can happen with gcc implementation of the\n     strtod function).\n\n   - removed/replaced the use of the assert() functions when locking or\n     unlocking threads because they did not work correctly if NDEBUG is\n     defined.\n\n   - made modifications to the way the command-line file filters are parsed to\n     1) remove the 1024-character limit when specifying a column filter,\n     2) fixed a potential character buffer-overflow risk in fits_get_token, and\n     3) improved the parsing logic to remove any possible of confusing\n     2 slash characters (\"//\") in the string as the beginning of a \n     comment string.\n\n   - modified configure and Makefile.in so that when building CFITSIO\n     as a shared library on linux or Mac platforms, it will use the SONAME\n     convention to indicate whether each new release of the CFITSIO\n     library is binary-compatible with the previous version.  Application\n     programs that link with the shared library will not need to be\n     recompiled as long as the versions are compatible.  In practice,\n     this means that the shared library binary file that is created (on\n     Linux systems) will have a name like 'libcfitsio.so.I.J.K', where I is the\n     SONAME version number, J is the major CFITSIO version number (e.g. 3),\n     and K is the minor CFITSIO version number (e.g., 34).  Two link\n     files will also be created such that\n       libcfitsio.so -> libcfitsio.so.I, and\n       libcfitsio.so.I -> libcfitsio.I.J.K\n     Application programs will still run correctly with the new version of\n     CFITSIO as long as the 'I' version number remains the same, but the\n     applications will fail to run if the 'I' number changes, thus alerting\n     the user that the application must be rebuilt.\n\n   - fixed bug in fits_insert_col when computing the new table row width\n     when inserting a '1Q' variable length array column.\n\n  - modified the image compression routines so that the output compressed\n     image (stored in a FITS binary table) uses the '1Q' variable length\n     array format (instead of '1P') when the input file is larger than 4 GB.\n\n   - added support for \"compression directive\" keywords which indicate how\n     that HDU should be compressed (e.g., which compression algorithm to use,\n     what tiling pattern to use, etc.).  The values of these keywords will\n     override the compression parameters that were specified on the command \n     line when running the fpack FITS file compression program.\n\n   - globally changed the variable and/or subroutine name \"dither_offset\" \n     to \"dither_seed\" and \"quantize_dither\" to \"quantize_method\" so\n     that the names more accurately reflects their purpose.\n\n   - added support for a new SUBTRACTIVE_DITHER_2 method when compressing\n     floating point images.  The only difference with the previous method\n     is that pixels with a value exactly equal to 0.0 will not be dithered,\n     and instead will be exactly preserved when the image is compressed.\n\n   - added support for an alias of \"RICE_ONE\" for \"RICE_1\" as the value\n     of the ZCMPTYPE keyword, which gives the name of the image compression\n     algorithm.  This alias is used if the new SUBTRACTIVE_DITHER_2 option\n     is used, to prevent old versions of funpack from creating a corrupted\n     uncompressed image file.  Only newer versions of funpack will recognize\n     this alias and be able to uncompress the image. \n   \n   - made performance improvement to fits_read_compressed_img so that \n     when reading a section of an compressed image that includes only \n     every nth pixel in some dimension, it will only uncompressed a tile \n     if there are actually any pixels of interest in that tile.\n\n   - fixed several issues with the beta FITS binary table compression code\n     that is used by fpack:  added support for zero-length vector columns,\n     made improvements to the output report when using the -T option in fpack,\n     changed the default table compression method to 'Rice' instead of \n     'Best', and now writes the 'ZTILELEN' keyword to document the number\n     of table rows in each tile.\n\n   - fixed error in ffbinit in calculating the total length of the binary\n     table extension if the THEAP keyword was used to override the\n     default starting location of the heap.\n\nVersion 3.34 - 20 March 2013\n\n   - modified configure and configure.in to support cross-compiled cfitsio \n     as a static library for Windows on a Linux platform using MXE \n     (http://mxe.cc) - a build environment for mingw32. (contributed by \n     Niels Kristian Bech Jensen)\n\n   - added conditional compilation statementsfor the mingw32 environment in \n     drvrfile.c because mingw32 does not include the ftello and fseeko functions. \n     (contributed by Niels Kristian Bech Jensen)\n\n   - fixed a potential bug in ffcpcl (routine to copy a column from one table\n     to another table) when dealing with the rare case of a '0X' column (zero\n     length bit column).\n\n   - fixed an issue in the routines that update or modify string-valued\n     keyword values, as a result of the change to ffc2s in the previous \n     release.  These routines would exit with a 204 error status if the \n     current value of the keyword to be updated or modified is null.\n\n   - fixed typo in the previous modification that was intended to ignore\n     numerical overflows in Hcompress when decompressing an image.\n\n   - moved the 'startcol' static variable out of the ffgcnn routine and\n     instead added it as a member of the 'FITSfile' structure that is defined\n     in fitsio.h.  This removes a possible race condition in ffgcnn in \n     multi-threaded environments.\n\nVersion 3.33 - 14 Feb 2013\n\n   - modified the imcomp_decompress_tile routine to ignore any numerical \n     overflows that might occur when using Hcompress to decompress the\n     image.  If Hcompress is used in its 'lossy' mode, the uncompressed\n     image pixel values may slightly exceed the range of an integer*2 \n     variable. This is generally of no consequence, so we can safely ignore\n     any overflows in this case and just clip the values to the legal range.\n\n   - the default tiling pattern when writing a tile-compressed image\n     has been changed.  The old behavior was to compress the whole image\n     as one single large tile.  This is often not optimal when dealing\n     with large images, so the new default behavior is to treat each\n     row of the image as one tile.  This is the same default behavior\n     as in the standalone fpack program.  The default tile size can\n     be overridden by calling fits_set_tile_dim.\n\n   - fixed bug that resulted in a corrupted output FITS image when\n     attempting to write a float or double array of values to a \n     tile-compressed integer data type image.  CFITSIO does not support\n     implicit data type conversion in this case and now correctly\n     returns an appropriate error status. \n\n   - modified ricecomp.c to define the nonzero_count lookup table as an \n     external variable, rather then dynamically allocating it within the\n     3 routines that use it.  This simplifies the code and eliminates the\n     need for special thread locking and unlocking statements. (Thanks to\n     Lars Kr. Lundin for this suggestion). \n\n   - modified how the uncompressed size of a gzipped file is computed in the\n     mem_compress_open routine in drvrmem.c.  Since gzip only uses 4 bytes\n     in the compressed file header to store the original file size, one may\n     need to apply a modulo 2^32 byte correction in some cases.  The logic\n     here was modified to allow for corner cases (e.g., very small files, and \n     when running on 32-bit platforms that do not support files larger than\n     2^31 bytes in size). \n\n   - added new public routine to construct a 80 keyword record from the 3 input\n     component strings, i.e, the keyword name string, the value string, and\n     the comment string: fits_make_key/ffmkky.  (This was already an undocumented\n     internal routine in previous versions of CFITSIO).\n\n   - modified ffc2s so that if the input keyword value string is a null string,\n     then it will return a VALUE_UNDEFINED (204) status value.  This makes it\n     consistent with the behavior when attempting to read a null keyword \n     (which has no value) as a logical or as a number (which also returns\n     the 204 error).  This should only affect cases where the header keyword\n     does not have an equal sign followed by a space character in columns 9\n     and 10 of the header record.\n\n   - Changed the \"char *\" parameter declarations to \"const char *\" in many \n     of the routines (mainly the routines that modify or update keywords) to\n     avoid compiler warnings or errors from C++ programs that tend to be more\n     rigorous about using \"const char *\" when appropriate.\n\n   - added support for caching uncompressed image tiles, so that the tile does\n     not need to be uncompressed again if the application program wants \n     to read more data from the same tile. This required changes to the\n     main FITS file structure that is defined in fitsio.h, as well as\n     changes to imcompress.c.\n\n   - enhanced the previous modification to drvrfile.c to handle additional user\n     cases when running in the HEASARC's Hera environment.\n\nVersion 3.32 - Oct 2012\n\n   - fixed flaw in the way logical columns (TFORM = 'L') in binary tables \n     were read which caused an illegal value of 1 in the column to be interpreted\n     as a 'T' (TRUE) value.\n\n   - extended the column filtering syntax in the CFITSIO file name parser to\n     enable users and scripts to append new COMMENT or HISTORY keyword into the\n     header of the filtered file (provided by Craig Markwardt).  For example,\n     fcopy \"infile.fits[col #HISTORY='Processed on 2012-10-05']\" outfile.fits\n     will append this header keyword: \"HISTORY Processed on 2012-10-05\"\n\n   - small change to the code that opens and reads an ASCII region file to\n     return an error if the file is empty.\n\n   - fixed obscure sign propagation error when attempting to read the\n     uncompressed size of a gzipped FITS file.  This resulted in a memory\n     allocation error if the gzipped file had an uncompressed file\n     size between 2^31 and 2^32 bytes.  Fix supplied by Gudlaugur Johannesson \n     (Stanford).\n\nVersion 3.31 - 18 July 2012\n\n   - enhanced the CFITSIO column filtering syntax to allow the comma, in addition\n     to the semi-colon, to be used to separate clauses, for example:\n     [col X,Y;Z = max(X,Y)].  This was done because users are not allowed to\n     enter the semi-colon character in the on-line Hera data processing\n     system due to computer security concerns.\n\n   - enhanced the CFITSIO extended filename syntax to allow specifying image\n     compression parameters (e.g. '[compress Rice]') when opening an existing\n     FITS file with write access.  The specified compression parameters will\n     be used by default if more images are appended to the existing file.\n\n   - modified drvrfile.c to do additional file security checks when CFITSIO\n     is running within the HEASARC's Hera software system.  In this case\n     CFITSIO will not allow FITS files to be created outside of the user's\n     individual Hera data directory area.\n\n   - fixed an issue in fpack and funpack on Windows machines, caused by\n     the fact that the 'rename' function behaves differently on Windows\n     in that it does not clobber an existing file, as it does on Unix\n     platforms.\n\n   - fixed bug in the way byte-swapping was being performed when writing \n     integer*8 null values to an image or binary table column.  \n\n   - added the missing macro definition for fffree to fitsio.h.\n\n   - modified the low level table read and write functions in getcol*.c and \n     putcol*.c to remove the 32-bit limitation on the number of elements. \n     These routines now support reading and writing more than 2**31 elements\n     at one time. Thanks to Keh-Cheng Chu (Stanford U.) for the patch.\n\n   - modified Makefile.in so that the shared libcfitsio.so is linked against \n     pthreads and libm.\n\nVersion 3.30 - 11 April 2012\n\n  Enhancements\n\n   - Added new routine called fits_is_reentrant which returns 1 or 0 depending on\n     whether or not CFITSIO was compiled with the -D_REENTRANT directive.  This can\n     be used to determine if it is safe to use CFITSIO in multi-threaded programs.\n\n   - Implemented much faster byte-swapping algorithms in swapproc.c based on code\n     provided by Julian Taylor at ESO, Garching.  These routines significantly \n     improve the FITS image read and write speed (by more than a factor of 2 in \n     some cases) on little-endian machines (e.g., Linux and Microsoft Windows and\n     Macs running on x86 CPUs) where byte-swapping is required when reading and \n     writing data in FITS files.  This has no effect on big-endian machines \n     (e.g. Motorola CPUs and some IBM systems).  Even faster byte-swapping\n     performance can be achieved in some cases by invoking the new \"--enable-sse2\" \n     or \"--enable-ssse3\" configure options when building CFITSIO on machines that\n     have CPUs and compilers that support the SSE2 and SSSE3 machine instructions.\n\n   - added additional support for implicit data type conversion in cases where\n     the floating point image has been losslessly compressed with gzip.  The\n     pixels in these compressed images can now be read back as arrays of short, \n     int, and long integers as well as single and double precision floating-point.\n\n   - modified fitsio2.h and f77_wrap.h to recognize IBM System z mainframes by\n     testing if __s390x__ or __s390__ is defined.\n\n   - small change to ffgcrd in getkey.c so that it supports reading a blank\n     keyword (e.g., a keyword whose name simply contains 8 space characters).\n\n   Bug Fixes\n\n   - fixed a bug in imcomp_decompress_tile that caused the tile-compressed image \n     to be uncompressed incorrectly (even though the tile-compressed image itself\n     was written correctly) under the following specific conditions:\n      - the original FITS image has a \"float\" datatype (R*4) \n      - one or more of the image tiles cannot be compressed using the standard\n        quantization method  and instead are losslessly compressed with gzip\n      - the pixels in these tiles are not all equal to zero (this bug does\n        affect tiles where all the pixels are equal to zero)\n      - the program that is reading the compressed image uses CFITSIO's\n        \"implicit datatype conversion\" feature to read the \"float\" image\n        back into an array of \"double\" pixel values.\n      If all these conditions are met, then the returned pixel values in the\n      affected image tiles will be garbage, with values often ranging \n      up to 10**34.  Note that this bug does not affect the fpack/funpack\n      programs, because funpack does not use CFITSIO's implicit datatype\n      conversion feature when uncompressing the image.\n\nVersion 3.29 - 2 December 2011\n\n  Enhancements\n\n   - modified Makefile.in to allow configure to override the lib and include\n     destination directories.\n\t\t   \n   - added (or restored actually) support for tile compression of 1-byte integer \n     images in imcomp_compress_tile.  Support for that data type was overlooked\n     during recent updates to this routine.\n\n   - modified the fits_get_token command-line parsing routine to perform more\n     rigorous checks to determine if the token can be interpreted as a number \n     or not.\n\n   - made small modification to fpack.c to not allow the -i2f option (convert\n     image from integer to floating point) with the \"-g -q 0\" option (do lossless \n     gzip compression).  It is more efficient to simply use the -g option alone.\n\n   - made modifications to fitsio.h and drvrfile.c to support reading and\n     writing large FITS files (> 2.1 GB) when building CFITSIO using \n     Microsoft Visual C++ on Windows platforms.\n\n   - added new WCS routine (ffgicsa) which returns the WCS keyword values\n     for a particular WCS version ('A' - 'Z').\n\n   Bug Fixes\n\n   - fixed a problem with multi-threaded apps that open/close FITS files\n     simultaneously by putting mutex locks around the call to\n     fits_already_open and in fits_clear_Fptr.\n\n   - fixed a bug when using the 'regfilter' function to select a subset of the\n     rows in a FITS table that have coordinates that lie within a specified\n     spatial region on the sky.  This bug only affects the rarely used panda\n     (and epanda and bpanda) region shapes in which the region is defined by\n     the intersection of an annulus  and a pie-shaped wedge.  The previous code\n     (starting with version 3.181 of CFITSIO where support for the panda region\n     was first introduced) only worked correctly if the 2 angles that define\n     the wedge have values between -180 and +180.  If not, then fewer rows than\n     expected may have been selected from the table.\n\n   - fixed the extended filename parser so that when creating a histogram by\n     binning 2 table columns, if a keyword or column name is given as the\n     weighting factor,  then the output histogram image will have a floating\n     point datatype, not the default integer datatype as is the case when no\n     weight is specified (e.g. with a filename like \n     \"myfile.fits[bin x,y; weight_column]\"\n\n   - added fix to the code in imcompress.c to work around a problem with\n     dereferencing the value of a pointer, in cases where the address of \n     that pointer has not been defined (e.g., the nulval variable).\n\n    - modified the byte shuffling algorithm in fits_shuffle_8bytes to work\n     around a strange bug in the proprietary SunStudioExpress C compiler\n     under OpenSolaris.\n\n   - removed spurious messages on the CFITSIO error stack when opening a\n     FITS file with FTP (in drvrnet.c);\n\nVersion 3.28 - 12 May 2011\n\n   - added an enhancement to the tiled-image compression method when compressing\n     floating-point image using the standard (lossy) quantization method.  In \n     cases where an image tile cannot be quantized,  The floating-point pixel values\n     will be losslessly compressed with gzip before writing them to the tile-\n     compressed file.  Previously, the uncompressed pixel values would have\n     been written to the file, which obviously requires more disk space. \n\n   - made significant internal changes to the structure of the tile compression\n     and uncompression routines in imcompress.c to make them more modular and\n     easier to maintain.\n\n   - modified configure.in and configure to force it to build a Universal \n     binary on Mac OS X.\n\n   - modified the ffiter function in putcol.c to properly clean up allocated\n     memory if an error occurs.\n     \n   - in quantize.c, when searching for the min and max values in a float array,\n     initialize the max value to -FLT_MAX instead of FLT_MIN (and similarly\n     for double array). \n\nVersion 3.27 - 3 March 2011\n\n  Enhancements\n\n    - added new routines fits_read_str and fits_delete_str which read or\n      delete, respectively, a header keyword record that contains a specified \n      character string.\n\n    - added a new routine called fits_free_memory which frees the memory\n      that fits_read_key_longstr allocated for the long string keyword value.\n\n    - enhanced the ffmkky routine in fitscore.c to not put a space before the\n      equals sign when writing long string-valued keywords using the ESO\n      HIERARCH keyword convention, if that extra character is needed to\n      fit the length of the keyword name + value string within the 80-character\n      FITS keyword record.\n\n    - made small change to fits_translate_keyword to support translation of\n      blank keywords (where the name = 8 blank characters)\n\n    - modified fpack so that it uses the minimum of the 2nd, 3rd, and 5th order\n      MAD noise values when quantizing and compressing a floating point image.\n      This is more conservative than just using the 3rd order MAD value alone.\n\n    - added new routine imcomp_copy_prime2img to imcompress.c that is used by\n      funpack to copy any keywords that may have been added to the primary\n      array of the compressed image file (a null image) back into the header of \n      the uncompressed image.\n\n    - enhanced the fits_quantize_float and fits_quantize_double routines in\n      quantize.c to also compress the tile if it is completely filled with\n      null values.  Previously, this type of tile would have been written \n      to the output compressed image without any compression.\n\n    - enhanced imcomp_decompress_tile to support implicit datatype conversion\n      when reading a losslessly compressed (with gzip) real*4 image into an\n      array of real*8 values.  \n\n    - in imcompress.c, removed possible attempt to free memory that had not \n      been allocated.\n\n\nVersion 3.26 - 30 December 2010\n\n  Enhancements\n\n   - defined 2 new macros in fitsio.h:  \n       #define CFITSIO_MAJOR 3\n       #define CFITSIO_MINOR 26\n     These may be used within other macros to detect the CFITSIO\n     version number at compile time.\n     \n   - modified group.c to initialize the output URL to a null string in \n     fits_url2relurl.  Also added more robust tests to see if 2 file\n     pointers point to the same file.\n\n   - enhanced the template keyword parsing code in grparser.c to support\n     the 'D' exponent character in the ASCII representation of floating\n     point keyword values (as in TVAL = 1.23D03).  Previously, the parser\n     would have written this keyword with a string value (TVAL = '1.23D03').\n\n   - modified the low-level routines that write a keyword record to a FITS \n     header so that they silently replace any illegal characters (ASCII \n     values less than 32 or greater than 126) with an ASCII space character.\n     Previously, these routines would have returned with an error when\n     encountering these illegal characters in the keyword record (most commonly \n     tab, carriage return, and line feed characters).\n\n   - made substantial internal changes to imcompress.c in preparation for\n     possible future support for compression methods for FITS tables analogous\n     to the tiled image compression method.\n\n   - replaced all the source code in CFITSIO that was distributed under the\n     GNU General Public License with freely available code.  In particular,\n     the  gzip file compression and uncompression code was replaced by the\n     zlib compression library.  Thus, beginning with this version 3.26 of CFITSIO,\n     other software applications may freely use CFITSIO without necessarily\n     incurring any GNU licensing requirement.  See the License.txt file for\n     the CFITSIO licensing requirements.\n\n   - added support for using cfitsio in different 'locales' which use a\n     comma, not a period, as the decimal point character in ASCII \n     representation of a floating point number (e.g., France).  This\n     affects how floating point keyword values and floating point numbers\n     in ASCII tables are read and written with the 'printf' and 'strtod'\n     functions.\n\n   - added a new utility routine called fits_copy_rows/ffcprw that copies\n     a specified range of rows from one table to another.\n\n   - enhanced the test for illegal ASCII characters in a header (fftrec) to\n     print out the name of the offending character (e.g TAB or Line Feed) as\n     well as the Hex value of the character.\n     \n   - modified ffgtbc (in fitscore.c) to support nonstandard vector variable\n     length array columns in binary tables (e.g. with TFORMn = 2000PE(500)').\n     \n   - modified the configure file to add \"-lm\" when linking CFITSIO on\n     Solaris machines.\n     \n   - added new routine, fits_get_inttype, to parse an integer keyword value\n     string and return the minimum integer datatype (TBYTE, TSHORT, TLONG, \n     TLONGLONG) required to store the integer value.\n\n   - added new routine, fits_convert_hdr2str, which is similar to fits_hdr2str\n     except that if the input HDU is a tile compressed image (stored \n     in a binary table) then it will first convert that header back to \n     that of a normal uncompressed FITS image before concatenating the header\n     keyword records.\n\n   - modified the file template reading routine (ngp_line_from_file in \n     grparser.c) so that it ignores any carriage return characters (\\r)\n     in the line, that might be present, e.g. if the file was created on a \n     Windows machine that uses \\r\\n as end of line characters.\n\n   - modified the ffoptplt routine in cfileio.c to check if the PCOUNT\n     keyword in the template file has a non-zero value, and if so, resets\n     it to zero in the newly created file.\n\n   Bug Fixes\n   \n   - fixed a bug when uncompressing floating-point images that contain Nan\n     values on some 64-bit platforms.\n     \n   - fixed a bug when updating the value of the CRPIXn world coordinate \n     system keywords when extracting a subimage from larger FITS image, using the\n     extended CFITSIO syntax (e.g.  myimage[1:500:2, 1:500:2]).  This bug only \n     affects cases where the pixel increment value is not equal to 1, and caused\n     the coordinate grid to be shifted by between 0.25 pixels (in the case of\n     a pixel increment of 2) and 0.5 pixels (for large pixel increment values).\n\n   - fixed a potential string buffer overflow error in the ffmkls routine\n     that modifies the value and comment strings in a keyword that uses\n     the HEASARC long string keyword convention. \n\n   - fixed a bug in imcompress.c that could cause programs to abort on 64-bit \n     machines when using gzip to tile-compress images.  Changed the declaration\n     of clen in imcomp_compress_tile from int to size_t.\n\nVersion 3.25 - 9 June 2010\n\n   - fixed bug that was introduced in version 3.13 that broke the ability\n     to reverse an image section along the y-axis with an image section\n     specifier like this: myimage.fits[*,-*].  This bug caused the output\n     image to be filled with zeros.\n\n   - fixed typo in the definition of the ftgprh Fortran wrapper routine\n     in f77_wrap3.c.\n\n   - modified the cfitsio.pc.in configuration file to make the lib path\n     a variable instead of hard coding the path.   The provides more\n     flexibility for projects such as suse and fedora when building CFITSIO.\n\n   - fixed bug in imcomp_compress_tile in imcompress.c which caused\n     null pixel values to be written incorrectly in the rare case where \n     the floating-point tile of pixels could not be quantized into integers.\n\n   - modified imcompress.c to add a new specialized routine to uncompress\n     an input image and then write it to a output image on a tile by tile basis.\n     This appears to be faster than the old method of uncompressing the\n     whole image into memory before writing it out.  It also supports\n     large images with more than 2**31 pixels.\n\n   - made trivial changes to 2 statements in drvrfile.c to suppress \n     nuisance compiler warnings.\n\n   - some compilers define CLOCKS_PER_SEC as a double instead of an integer,\n     so added an explicit integer type conversion to 2 statements in\n     imcompress.c that used this macro.\n     \n   - removed debugging printf statements in drvrnet.c (15 July)\n\nVersion 3.24 - 26 January 2010\n\n   - modified fits_translate_keywords so that it silently ignores any\n     illegal ASCII characters in the value or comment fields of the input\n     FITS file. Otherwise, fpack would abort without compressing input\n     files that contained this minor violation of the FITS rules.\n\n   - added support for Super H cpu in fitsio2.h\n   \n   - updated funpack to correctly handle the -S option, and to use a\n     more robust algorithm for creating temporary output files.\n   \n   - modified the imcomp_compress_tile routine to support the NOCOMPRESS\n     debugging option for real*4 images.\n\nVersion 3.23 - 7 January 2010\n\n   - reduced the default value for the floating point image quantization\n     parameter (q) from 16 to 4.  This parameter is used when tile compressing\n     floating point images.  This change will increase the average compression\n     ratio for floating point images from about 4.6 to about 6.5 without losing \n     any significant information in the image.\n     \n   - enhanced the template keyword parsing routine to reject a header\n     template string that only contains a sequence of dashes.\n\n   - enhanced the ASCII region file reading routine to allow tabs as well\n     as spaces between fields in the file.\n\n   - got rid of bogus error message when calling fits_update_key_longstr\n\n   - Made the error message more explicit when CFITSIO tries to write\n     to a GZIP compressed file.  Instead of just stating \"cannot write\n     to a READONLY file\", it will say \"cannot write to a GZIP compressed\n     file\".\n\nVersion 3.22 - 28 October 2009\n\n   - added an option (in imcompress.c) to losslessly compress floating\n     point images, rather than using the default integer scaling method.\n     This option is almost never useful in practice for astronomical \n     images (because the amount of compression is so poor), but it has \n     been added for test comparison purposes.\n\n   - enhanced the dithering option when quantizing and compressing\n     floating point images so that a random dithering starting point\n     is used, so that the same dithering pattern does not get used for\n     every image.\n\n   - modified the architecture setup section of fitsio2.h to support the\n     64-core 8x8-architecture Tile64 platform (thanks to Ken Mighell, NOAO)\n\n   Fixes\n\n   - fixed a problem that was introduced in version 3.13 of CFITSIO\n     in cases where a program writes it own END keyword to the header\n     instead of letting CFITSIO do it, as is strongly recommended.  In\n     one case this caused CFITSIO to rewrite the END keyword and any\n     blank fill keywords in the header many times, causing a \n     noticeable slow-down in the FITS file writing speed.\n\nVersion 3.21 - 24 September 2009\n\n   - fixed bug in cfileio.c  that caused CFITSIO to crash with a bus error\n     on Mac OS X if CFITSIO was compiled with multi-threaded support (with\n     the  --enable-reentrant configure option). The Mac requires an\n     additional thread initialization step that is not required on Linux\n     machines.  Even with this fix, occasional bus errors have been seen on\n     some Mac platforms, The bus errors are seen when running the\n     thread_test.c program.  The bus errors are very intermittent, and occur\n     less than about 1% of the time, on the affected platforms. \n     These bus errors have not been seen on Linux platforms. \n\n   - fixed invalid C comment delimiter (\"//*\" should have been \"/*\")\n     in imcompress.c.\n\n   - Increased the CFITSIO version number string length\n     in fpackutil.c, to fix problem on some platforms when running\n     fpack -V or funpack -V.   Also modified the output format of the\n     fpack -L command.\n\nVersion 3.20 - 31 August 2009\n\n   - modified configure.in and configure so that it will build the Fortran\n     interface routines by default, even if no Fortran compiler is found\n     in the user's path. Building the interface routines may be disabled \n     by specifying FC=\"none\".  This was done at the request of users who\n     obtained CFITSIO from some other standard linux distributions, where\n     CFITSIO was apparently built in an environment that had no Fortran \n     compiler and hence did not build the Fortran wrappers.\n\n   - modified ffchdu (close HDU) so that it calls the routine to update\n     the maximum length of variable length table columns in the TFORM\n     values in all cases  where the values may have changed.  Previously\n     it would not update the values if a value was already specified in\n     the TFORM value.\n\n   - added 2 new string manipulation functions to the CFITSIO parser \n     (contributed by Craig Markwardt): strmid extracts a substring\n     from a string, and strstr searches for a substring within a string.\n\n   - removed the code in quantize.c that treated \"floating-point integer\" \n     images as a special case (it would just do a datatype conversion from\n     float to int, and not otherwise quantize the pixel values).  This \n     caused complications with the new subtractive dithering feature.\n\n   - enhanced the code for converting floating point images to quantized\n     scaled integer prior to tile-compressing them, to apply a random\n     subtractive dithering, which improves the photometric accuracy\n     of the compressed images.\n   \n   - added new internal routine, iraf_delete_file, for use by fpack to\n     delete a pair of IRAF format header and pixel files.\n\n   - small change in cfileio.c in the way it recognizes an IRAF format\n     .imh file.  Instead of just requiring that the filename contain the\n     \".imh\" string, that string must occur at the end of the file name.\n\n   - fixed bug in the code that is used when tile-compressing real*4 FITS \n     images, which quantizes the floating point pixel values into\n     integer levels.  The bug would only appear in the fairly rare\n     circumstance of tile compressing a floating point image that contains\n     null pixels (NaNs) and only when using the lossy Hcompress algorithm\n     (with the s parameter not equal to 1).  This could cause underflow of\n     low valued pixels, causing them to appear as very large pixel values\n     (e.g., > 10**30)  in the compressed image\n\n   - changed the \"if defined\" blocks in fitsio.h, fitsio2.h and f77_wrap.h\n     to correctly set the length of long variables on sparc64 machines.\n     Patch contributed by Matthew Truch (U. Penn).\n\n   - modified the HTTP file access code in drvrnet.c to support basic\n     HTTP authentication, where the user supplies a user name and\n     password.  The CFITSIO filename format in this case is:\n     \"http://username:password@hostname/...\"\n     Thanks to Jochen Liske (ESO) for the suggestion and the code.\n\nVersion 3.181 (BETA) - 12 May 2009\n\n   - modified region.c and region.h to add support for additional\n     types of region shapes that are supported by ds9: panda, epanda,\n     and bpanda.\n\n   - fixed compiler error when using the new _REENTRANT flag, having to \n     do with the an attempted static definition of Fitsio_Lock in \n     several source files, after declaring it to be non-static in fitsio2.h.\n    \nVersion 3.18 (BETA) - 10 April 2009\n\n   - Made extensive changes to make CFITSIO thread safe.  Previously,\n     all opened FITS files shared a common pool of memory to store\n     the most recently read or written FITS records in the files.\n     In a multi-threaded environment different threads could \n     simultaneously read or write to this common area causing\n     unpredictable results. This was changed so that every opened\n     FITS file has its own private memory area for buffering the\n     file. Most of the changes were in buffers.c, fitsio.h, and\n     fitsio2.h. Additional changes were made to cfileio.c, mainly\n     to put locks around small sections of code when setting up the\n     low-level drivers to read or write the FITS file.  Also, locks\n     were needed around the GZIP compression and uncompression code\n     in compress.c.,  the error message stack access routine in\n     fitscore.c, the encode and decode routines in fits_hcompress.c\n     and  fits_hdecompress.c, in ricecomp.c,  and  the table row\n     selection and table calculator functions. Also, removed the\n     'static' declaration of the local variables in pliocomp.c\n     which did not appeared to be required and prevented the\n     routines from being thread safe.\n\n     As a consequence of having a separate memory buffer for every\n     FITS file (by default, about 115 kB per file), CFITSIO may now\n     allocate more memory than previously when an application\n     program opens multiple FITS files at once.  The read and write\n     speed may also be slightly faster, since the buffers are not\n     shared between files.\n\n   - Added new families of Fortran wrapper routines to read and\n     write values to large tables that have more than 2**31 rows. \n     The arguments that define the first row and first element to\n     read or write must be I*8 integers, not ordinary I*4\n     integers.  The names of these new routines have 'LL' appended\n     to them, so for example, ftgcvb becomes ftgcvbll.\n\n   Fixes\n   \n   - Corrected an obscure bug in imcompress.c that would have incorrectly \n     written the null values only in the rare case of writing a signed \n     byte array that is then tile compressed using the Hcompress or PLIO\n     algorithm.\n\nVersion 3.14 - 18 March 2009\n\n  Enhancements\n\n   - modified the tiled-image compression and uncompression code to\n     support compressing unsigned 16-bit integer images with PLIO.\n     FITS unsigned integer arrays are offset by -32768, but the PLIO\n     algorithm does not work with negative integer values.  In this\n     case, an offset of 32768 is added to the array before compression,\n     and then subtracted again when reading the compressed array.\n     IMPORTANT NOTE:  This change is not backward compatible, so\n     these PLIO compressed unsigned 16-bit integer images will not be\n     read correctly by previous versions of CFITSIO; the pixel values\n     will have an offset of +32768.\n\n   - minor changes to the fpack utility to print out more complete\n     version information with the -V option, and format the report\n     produced by the -T option more compactly.\n\n  Fixes\n  \n   - Modified imcomp_compress_image (which is called by fpack) so that\n     it will preserve any null values (NaNs) if the input image has\n     a floating point datatype (BITPIX = -32 or -64).  Null values in\n     integer datatype images are handled correctly.\n\n   - Modified imcomp_copy_comp2img so that it does not copy the\n     ZBLANK keyword, if present, from the compressed image header\n     when uncompressing the image.\n     \n   - Fixed typo in the Fortran wrapper macro for the ftexist function.\n\nVersion 3.13 -  5 January 2009\n\n  Enhancements\n\n   - updated the typedef of LONGLONG in fitsio.h and cfortran.h to\n     support the Borland compiler which uses the  __int64 data type.\n     \n   - added new feature to the extended filename syntax so that when\n     performing a filtering operation on specified HDU, if you add\n     a '#' character after the name or number of the HDU, then ONLY\n     that HDU (and the primary array if the HDU is a table) will be\n     copied into the filtered version of the file in memory.  Otherwise,\n     by default CFITSIO copies all the HDUs from the input file into\n     memory.\n     \n   - when specifying a section, if the specified number of dimensions\n     is less than the number of dimensions in the image, then CFITSIO\n     will use the entire dimension, as if a '*' had been specified.\n     Thus [1:100] is equivalent to [1:100,*] when specifying a section\n     of 2 dimensional image.\n\n   - modified fits_copy_image_section to read/write the section 1 row\n     at a time, instead of the whole section, to reduce memory usage.\n\n   - added new stream:// drivers for reading/writing to stdin/stdout.\n     This driver is somewhat fragile, but for simple FITS read and\n     write operations this driver streams the FITS file on stdin\n     or stdout without first copying the entire file in memory, as is\n     done when specifying the file name as \"-\".\n   \n   - slight modification to ffcopy to make sure that the END keyword\n     is correctly written before copying the data.  This is required\n     by the new stream driver.\n     \n   - modified ffgcprll, so that when writing data to an HDU, it first\n     checks that the END keyword has been written to the correct place.\n     This is required by the new stream driver.\n\n  Fixes\n   \n   - fixed bug in ffgcls2 when reading an ASCII string column in binary\n     tables in cases where the width of the column is greater than 2880 \n     characters and when reading more than 1 row at a time.  Similar \n     change was made to ffpcls to fix same problem with writing to \n     columns wider than 2880 characters.\n     \n   - updated the source files listed in makepc.bat so that it can be\n     used to build CFITSIO with the Borland C++ compiler.\n     \n   - fixed overflow error in ffiblk that could cause writing to Large Files\n     (> 2.1 GB) to fail with an error status.\n      \n   - fixed a bug in the spatial region code (region.c) with the annulus \n     region.   This bug only affected specialized applications which\n     directly use the internal region structure; it does not affect\n     any CFITSIO functions directly.\n\n   - fixed memory corruption bug in region.c that was triggered if the\n     region file contained a large number of excluded regions.\n\n   - got rid of a harmless error message that would appear if filtering\n     a FITS table with a GTI file that has zero rows. (eval_f.c)\n\n   - modified fits_read_rgnfile so that it removes the error messages\n     from the error stack if it is unable to open the region file as\n     a FITS file. (region.c)\n     \nVersion 3.12 - 8 October 2008\n\n   - modified the histogramming code so that the first pixel in the binned\n     array is chosen as the reference pixel by default, if no other\n     value is previously defined.\n\n   - modified ffitab and ffibin to allow a null pointer to the \n     EXTNAME string, when inserting a table with no name.\n\nVersion 3.11 - 19 September 2008\n\n   - optimized the code when tile compressing real*4 images (which get\n     scaled to integers).  This produced a modest speed increase.  For \n     best performance, one must specify the absolute q quantization \n     parameter, rather than relative to the noise in the tile (which\n     is expensive to compute).\n\n   - modified the FITS region file reading code to check for NaN values,\n     which signify the end of the array of points in a polygon region.\n\n   - removed the test for LONGSIZE == 64 from fitsio.h, since it may \n     not be defined.\n\n   - modified imcompress.c to support unconventional floating point FITS \n     images that also have BSCALE and BZERO keywords.  The compressed\n     floating point images are linearly scaled twice in this case.\n\nVersion 3.10 - 20 August 2008\n\n   - fixed a number of cases, mainly dealing with long input file names\n     (> 1024 char), where unsafe usage of strcat and strcpy could have caused\n     buffer overflows.  These buffer overflows could cause the application\n     to crash, and at least theoretically, could be exploited by a\n     malicious user to execute arbitrary code.  There are no known instances\n     of this type of malicious attack on CFITSIO applications, and the\n     likelihood of such an attack seems remote.  None the less, it would\n     be prudent for CFITSIO users to upgrade to this new version to guard\n     against this possibility.\n\n   - modified some of the routines to define input character string\n     parameters as \"const char *\" rather than just \"char *\" to eliminate\n     some compiler warnings when the calling routine passes a constant\n     string to the CFITSIO routine.  Most of the changes were to the\n     keyword name argument in the many routines that read or write keywords.\n\n   - fixed bug when tile-compressing a FITS image which caused all the \n     completely blank keywords in the input header to be deleted from \n     the output compressed image.  Also added a feature to preserve any\n     empty FITS blocks in the header (reserved space for future keywords)\n     when compressing or uncompressing an image.\n\n   - fixed small bug in the way the default tile size is set in imcompress.c.\n     (Fix sent in by Paul Price).\n\n   - added support for reading FITS format region files (in addition\n     to the ASCII format that was previously supported).  Thanks to\n     Keith Arnaud for modifying region.c to do this.\n\nVersion 3.09 - 12 June 2008\n\n   - fixed bug in the calculator function, parse_data, that evaluates \n     expressions then selecting rows or modifying values in table columns.\n     This bug only appeared in unusual circumstances\n     where the calculated value has a null value (= TNULLn).  The bug\n     could cause elements to not be flagged as having a null value, or\n     in rare cases could cause valid elements to be flagged as null. This\n     only appears to have affected 64-bit platforms (where size(long) = 8).\n   \n   - fixed typo in imcomp_decompress_tile: call to fffi2r8 should have \n     been to fffi4r8.\n     \n   - in the imcopy_copy_comp2img routine, moved the call to \n     fits_translate_keywords outside of the 'if' statement.  This could \n     affect reading compressed images that did not have a EXTNAME keyword\n     in the header.\n     \n   - fixed imcomp_compress_tile in imcompress.c to properly support\n     writing unsigned integers, in place, to tile compressed images.\n\n   - modified fits_read_compressed_img so that if the calling routine\n     specifies nullval = 0, then it will not check for null-valued\n     pixels in the compressed FITS image.  This mimics the same\n     behavior when reading normal uncompressed FITS images.\n\nVersion 3.08 - 15 April 2008 \n\n   - fixed backwards compatibility issue when uncompressing a Rice\n     compressed image that was created with previous versions of \n     CFITSIO (this late fix was added on May 18).\n\n   - small change to cfortran.h to add \"extern\" to the common block \n     definition.  This was done for compatibility with the version\n     of cfortran.h that is distributed by the Debian project.\n   \n   - relaxed the requirement that a string valued keyword must have a\n     closing quote character.  If the quote is missing, CFITSIO will silently\n     append a quote at the end of the keyword record.  This change was made\n     because otherwise it is very difficult to correct the keyword\n     because CFITSIO would exit with an error before making the fix.\n   \n   - added a new BYTEPIX compression parameter when tile-compressing \n     images with the Rice algorithm.\n\n   - cached the NAXIS and NAXISn keyword values in the fitsio structure\n     for efficiency, to eliminate duplicates reads of these keywords.\n   \n   - added variants of the Rice compression and uncompression routines to\n     support short int images (in addition to the routines that support int).\n\n   - moved the definition of LONGLONG_MIN and LONGLONG_MAX from fitsio2.h\n     to fitsio.h, to make it accessible to application programs.\n\n   - make efficiency improvements to fitscore.c, to avoid needless searches\n     through the entire header when reading the required keywords that must\n     be near the beginning of the header.\n     \n   - made several improvements to getcol.c to optimize reading of compressed\n     and uncompressed images.\n\n   - changed the compression level in the gzip code from 6 to 1.  In most\n     cases this will provide nearly the same amount of compression, but is\n     significantly faster in some cases.\n\t   \n   - added new \"helper routines' to imcompress.c to allow applications to\n     specified the \"quantize level\" and Hcompress scaling and smoothing \n     parameters\n\n   - modified the extended filename syntax to support the \"quantize level\"\n     and Hcompress scaling and smoothing parameters.  The parser in \n     cfileio.c was extensively modified.\n\n   - extensive changes to quantize.c:\n       - replace the \"nbits\" parameter with \"quantize level\"\n       - the quantize level is now relative to the RMS noise in the image\n       - the HCOMPRESS scale factor is now relative to the RMS noise\n       - added routines to calculate RMS noise in image \n      (these changes require a change to the main file structure in fitsio.h)\n\n   - initialize errno = 0 before the call to strtol in ffext, in case errno\n     has previously been set by an unrelated error condition.\n\n   - added the corresponding long name for the ffgkyjj routine to longnam.h.\t\t   \n\n   - changed imcomp_copy_comp2img (in imcompress.c) to not require the\n     presence of the EXTNAME keyword in the input compressed image header.\n\n   - modified imcompress.c to only write the UNCOMPRESSED_DATA column\n     in tile-compressed images if it is actually needed.  This eliminates\n     the need to subsequently delete the column if it is not used \n     (which is almost always the case).\n\n   - found that it is necessary to seek to the EOF of a file after \n     truncating the size of the file, to reestablish a definite\n     current location in the file.  The required small changes to 3\n     routines: file_truncate (to seek to EOF) and fftrun (to set io_pos) \n     and the truncation routine in drvrmem.c.\n\n   - improved the efficiency when compressing integer images with\n     gzip.  Previously, the image was always represented using integer*4\n     pixels, which were then compressed.  Now, if the range of pixel\n     values can be represented with integer*2 pixels or integer*1 pixels, \n     then that is used.  This change is backward compatible with any \n     compressed images that used the previous method.\n\n   - changed the default tiling pattern when using Hcompress from \n     large squares (200 to 600 pixels wide) to 16 rows of the image.\n     This generally requires less memory, compresses faster, and is more\n     consistent with the default row by row tiling when using the other\n     compression methods.\n\n   - modified imcomp_init_table in imcompress.c to enforce a restriction\n     when using the Hcompress algorithm that the 1st 2 dimensions of sll\n     image tiles must be at least 4 pixels long.  Hcompress becomes very\n     inefficient for smaller dimensions, and does not work at all with\n     1D images.\n     \n   - fixed bug in the Hcompress compression algorithm that could affect\n     compression of I*4 images, using non-square compression tiles\n     (in the encode64 routine).\n\nVersion 3.07 - 6 December 2007  (internal release)\n\n   - fixed bug with the PLIO image compression routine which silently\n     produced a corrupted compressed image if the uncompressed image pixels\n     were not all in the range 0 to 2**24.  (fixed in November)\n     \n   - fixed several 'for' loops in imcompress.c which were exceeding the\n     bounds of an array by 1.  (fixed in November)\n\n   - fixed a possible, but unlikely, memory overflow issue in iraffits.c.\n   \n   - added a clarification to the cfortran.doc file that cfortran.h\n     may be used and distributed under the terms of the GNU Library\n     General Public License.\n   \n   - fixed bug in the fits_modify_vector_len routine when modifying\n     the vector length of a 'X' bit column.\n\t   \nVersion 3.06 - 27 August 2007  \n\n   - modified the imcopy.c utility program (to tile-compress images)\n     so that it writes the default EXTNAME = 'COMPRESSED_IMAGE'\n     keyword in the compressed images, to preserve the behavior of\n     earlier versions of imcopy.\n\n   - modified the angsep function in the FITS calculator (in eval.y)\n     to use haversines, instead of the 'law of cosines', to provide\n     more precision at small angles (< 0.1 arcsec).\n\nVersion 3.05 -  July 2007 (internal release only)\n\n   - extensive changes to imcompress.c to fully support implicit data\n     type conversion when reading and writing arrays of data to FITS\n     images, where the data type of the array is not the same as the\n     data type of the FITS image.  This includes support for null pixels,\n     and data scaling via the BSCALE and BZERO keywords.\n\n   - rewrote the fits_read_tbl_coord routine in wcssub.c, that gets the \n     standard set of WCS keywords appropriate to a pair of columns in a\n     table, to better support the full set of officially approved WCS keywords.  \n     \n   - made significant changes to histo.c, which creates an image by binning\n     columns of a table, to better translate the WCS keywords in the table\n     header into the WCS keywords that are appropriate for an image HDU.\n\n   - modified imcompress.c so that when pixels are written to a \n     tile-compressed image, the appropriate BSCALE and BZERO values of\n     that image are applied.  This fixes a bug in which writing to\n     an unsigned integer datatype image (with BZERO = 32768) was not\n     done correctly.\n     \nVersion 3.04 - 3 April 2007\n\n   - The various table calculator routines (fits_select_rows, etc.) implicitly\n     assumed that the input table has not been modified immediately prior to\n     the call.   To cover cases where the table has been modified a call to \n     ffrdef has been added to ffprs.  IN UNUSUAL CASES THIS CHANGE COULD \n     CAUSE CFITSIO TO BEHAVE DIFFERENTLY THAN IN PREVIOUS VERSIONS.  For\n     example, opening a FITS table with this column-editing virtual file\n     expression:\n         myfile.fits[3][col A==X; B = sqrt(X)]\n     no longer works, because the X column does not exist when the \n     sqrt expression is evaluated.  The correct expression in this case is\n         myfile.fits[3][col A==X; B = sqrt(A)]\n     \n   - modified putkey.c to support USHORT_IMG when calling fits_create_img\n     to create a signed byte datatype image.\n     \n   - enhanced the column histogramming function to propagate any TCn_k and\n     TPn_k keywords in the table header to the corresponding CDi_j and PCi_j \n     keywords in the image header.\n     \n   - enhanced the random, randomn, and randomp functions in the lexical\n     parser to take a vector column name argument to specify the length\n     of the vector of random numbers that should be generated (provided by\n     Craig Markwardt, GSFC)\n\n   - enhanced the ffmcrd routine (to modify an existing header card) to\n     support long string keywords so that any CONTINUE keywords associated\n     with the previous keyword will be deleted.\n\n   - modified the ffgtbp routine to recognize the TDIMn keyword for \n     ASCII string columns in a binary table.  The first dimension is\n     taken to be the size of a unit string.   (The TFORMn = 'rAw'\n     syntax may also be used to specify the unit string size).\n     \n   - in fits_img_decompress, the fits_get_img_param function was called\n     with an invalid dimension size, which caused a fatal error on at\n     least 1 platform.\n\n   - in ffopentest, set the status value before returning in case of error.\n   \n   - in the drvrnet.c file, the string terminators needed to be changed\n     from \"\\n\" to \"\\r\\n\" to support the strict interpretation of the\n     http and ftp standard that is enforced by some newer web servers.\n\nVersion 3.03 - 11 December 2006\n\n  New Routine\n  \n  - fits_write_hdu writes the current HDU to a FILE stream (e.g. stdout).\n  \n  Changes\n  \n  - modified the region parsing code to support region files where the\n    keyword \"physical\" is on a separate line preceding the region shape\n    token. (However, \"physical\" coordinates are not fully supported, and\n    are treated identically to \"image\" coordinates).\n    \n  - enhanced the iterator routines to support calculations on 64-bit\n    integer columns and images.  Currently, the values are cast to\n    double precision when doing the calculations, which can cause a\n    loss of precision for integer values greater than about 2**52.\n\n  - added support for accessing FITS files on the computational grid.\n    Giuliano Taffoni and Andrea Barisani, at INAF, University of Trieste,\n    Italy, implemented the necessary I/O driver routines in drvrgsiftp.c.\n\n  - modified the tiled image compression/uncompression routines to \n    preserve/restore the original CHECKSUM and DATASUM keywords if they\n    exist. (saved as ZHECKSUM and ZDATASUM in the compressed image)\n  \n  - split fits_select_image_section into 2 routines: a higher level routine\n    that creates the output file and copies other HDUs from the input file\n    to the output file, and a lower level routine that extracts the image\n    section from the input image into an output image HDU.\n    \n  - Improved the error messages that get generated if one tries to \n    use the lexical parser to perform calculations on variable-length\n    array columns.\n\n  - added \"#define MACHINE NATIVE\" in fitsio2.h for all machines where\n    BYTESWAPPED == FALSE.  This may improve the file writing performance\n    by eliminating the need to allocate a temporary buffer in some cases.\n\n  - modified the configure.in and configure script to fix problems with\n    testing if network services are available, which affects the definition\n    of the HAVE_NET_SERVICES flag.\n\n  - added explicit type casting to all malloc statements, and deleted \n    declarations of unreferenced variables in the image compression code \n    to suppress compiler warnings.\n    \n  - fixed incorrect logic in fitsio2.h in the way it determined if numerical\n    values are byteswapped or not on MIPS and ARM architectures.\n\n  - added __BORLANDC__ to the list of environments in fitsio.h that don't\n    use %lld in printf for longlong integers\n    \n  - added \"#if defined(unix)\" around \"#include <usistd.h>\" statements in\n    several C source files, to make them compatible with Windows.\n    \n\nVersion 3.02 - 18 Sept 2006\n\n  - applied the security patch to the gzip code, available at\n    http://security.FreeBSD.org/patches/SA-06:21/gzip.patch\n    The insufficient bounds checks in buffer use can cause gzip to crash,\n    and may permit the execution of arbitrary code.  The NULL pointer\n    deference can cause gzip to crash.  The infinite loop can cause a\n    Denial-of-Service situation where gzip uses all available CPU time.\n\n  - added HCOMPRESS as one of the compression algorithm options in the\n    tiled image compression code.  (code provided by Richard White (STScI))\n    Made other improvements to preserve the exact header structure in the \n    compressed image file so that the compressed-and-then-uncompressed FITS \n    image will be as identical as possible to the original FITS image file.  \n\n  New Routines\t\t   \n\n  - the following new routines were added to support reading and writing\n    non-standard extension types:\n     fits_write_exthdr - write required keywords for a conforming extension\n     fits_write_ext - write data to the extension\n     fits_read_ext  - read data from the extension\n     \n  - added new routines to compute the RMS noise in the background pixels\n    of an image: fits_rms_float and fits_rms_short  (take an input\n    array of floats or shorts, respectively).\n\n  Fixes\n\n  - added the missing 64-bit integer case to set of \"if (datatype)\" \n    statements in the routine that returns information about a \n    particular column (ffgbclll).\n    \n  - fixed a parsing error in ffexts in cases where an extension number\n    is followed by a semi-colon and then the column and row number of an\n    array in a binary table.  Also removed an extraneous HISTORY keyword\n    that was being written when specifying an input image in a table cel.\n  \n  - modified the routine that reads a table column returning a string\n    value (ffgcls) so that if the displayed numerical value is too\n    wide to fit in the specified length string, then it will return\n    a string of \"*\" characters instead of the number string.\n\n  - small change to fitsio.h to support a particular Fortran and C\n    compiler combination on a SGI Altix system\n    \n  - added a test in the gunzip code to prevent seg. fault when trying\n    to uncompress a corrupted file (at least in some cases).\n\n  - fixed a rarely-occurring bug in the routine that copies a table\n    cell into an image; had to call the ffflsh call a few lines earlier.\n\nVersion 3.01 - (in FTOOLS 6.1 release)\n\n  - modified fits_copy_image2cell to correctly copy all the appropriate\n    header keywords when copying an image into a table cell\n\n  - in eval.y, explicitly included the code for the lgamma function \n    instead of assuming it is available in a system library (e.g., the\n    lgamma function is currently not included in MS Visual++ libraries)\n\n  - modified the logic in fits_pixel_filter so that the default data\n    type of the output image will be promoted to at least BITPIX = -32\n    (a single precision floating point) if the expression that is being\n    evaluated resolves to a floating point result.  If the expression \n    resolves to an integer result, the output image will have the same\n    BITPIX as the input image.\n\n  - in fits_copy_cell2image, added 5 more WCS keywords to the list of\n    keywords related to other columns that should be deleted in the\n    output image header.\n\n  - disabled code in cfileio.c that would write HISTORY keywords to the\n    output file in fits_copy_image2cell and cell2image, because some tasks\n    would not want these extraneous HISTORY keywords.\n\n  - added 2 new random number functions to the CFITSIO parser\n    RANDOMN() - produces a normal deviate (mean=0, stddev=1)\n    RANDOMP(X) - produces a Poisson deviate for an expected # of counts X\n\n  - in f77_wrap.h, removed the restriction that \"g77Fortran\" must be \n    defined on 64-bit Itanium machines before assuming that \n    sizeof(long) = 8.  It appears that \"long\"s are always\n    8 bytes long on this machine, regardless of what compilers are used.\n\n  - added test in fitsio.h so that LONGLONG cannot be multiply defined\n  \n  - modified longnam.h so that both \"fits_write_nulrows\" and \n    \"fits_write_nullrows\"  get replace by the string \"ffprwu\".  This\n    fixes a documentation error regarding the long name of this\n    routine.\n\n   Bug fixes\n\n  - fixed a potential null character string dereferencing error in the\n    the ffphtb and ffphbn routines that write the FITS table keywords.\n    This concerned the optional TUNITn keywords.\n\n  - fixed a few issues in fits_copy_cell2image and fits_copy_image2cell\n    related to converting some WCS keyword between the image extension\n    form and the table cell form of the keyword. (cfileio.c)\n\n  - fixed bug in fits_translate_keyword (fitscore.c) that, e.g.,  caused \n   'EQUINOX' to be translated to EQUINOXA' if the pattern is 'EQUINOXa'\n\n  - fixed 2 bugs that could affect 'tile compressed' floating point\n    images that contain NaN pixels (null pixels).  First, the\n    ZBLANK keyword was not being written, and second, an integer\n    overflow could occur when computing the BZERO offset in the\n    compressed array.  (quantize.c and imcompress.c)\n\nVersion 3.006 - 20 February 2006  -(first full release of v3)\n\n  - enhanced the 'col' extended filename syntax to support keyword name\n    expressions like\n       [col error=sqrt(rate); #TUNIT# = 'counts/s'], \n    in which the trailing '#' will be replaced by the column number\n    of the most recently referenced column.\n    \n  - fixed bug in the parse_data iterator work function that caused it\n    to fail to return a value of -1 in cases where only a selected\n    set of rows were to be processed. (affected Fv)\n\n  - added code to fitsio.h and cfortran.h to typedef LONGLONG to\n    the appropriate 8-byte integer data type.  Most compilers now\n    support the 'long long' data type, but older MS Visual C++\n    compilers used '__int64' instead.\n\n  - made several small changes based on testing by Martin Reinecke:\n    o in  eval.y, change 'int undef' to 'long undef'\n    o in getcold.c and getcole.c, fixed a couple format conversion \n      specifiers when displaying the value of long long variables.\n    o in fitsio.h, modified the definition of USE_LL_SUFFIX in the\n      case of Athon64 machines.\n    o in fitsio2.h,  defined BYTESWAPPED in the case of SGI machines.\n    o in group.c, added 'include unistd.h' to get rid of compiler warning.\n      \nVersion 3.005 - 20 December 2005  (beta)\n\n  - cfortran.h has been enhanced to support 64-bit integer parameters\n    when calling C routines from Fortran.  This modification was kindly \n    provided by Martin Reinecke (MPE, Garching).  \n    \n  - Many new Fortran wrapper routines have been added to support reading\n    and writing 64-bit integer values in FITS files.  These new routines\n    are documented in the updated version of the 'FITSIO User's Guide' \n    for Fortran programmers.\n\n  - fixed a problem in the fits_get_keyclass routine that caused it\n    to not recognize the special COMMENT keywords at the beginning\n    of most FITS files that defines the FITS format.\n\n  - added a new check to the ffifile routine that parses the \n    input extended file name, to distinguish between a FITS extension\n    name that begins with 'pix', and a pixel filtering operator that \n    begins with the 'pix' keyword.\n\n  - small change to the WCSLIB interface routine, fits_read_wcstab, to\n    be more permissive in allowing the TDIMn keyword to be omitted for\n    degenerate coordinate array.\n\nVersion 3.004 - 16 September 2005 (3rd public beta release)\n\n  - a major enhancement to the CFITSIO virtual file parser was provided\n    by Robert Wiegand (GSFC).  One can now specify filtering operations\n    that will be applied on the fly to the pixel values in a FITS image. \n    For example [pix sqrt(X)] will create a virtual FITS image where the\n    pixel values are the square root of the input image pixels.\n\n  - modified region.c so that it interprets the position angles of regions\n    in a SAO style region file in the same way as DS9.  In particular, if\n    the region parameters are given in WCS units, then the position angle\n    should be relative to the WCS coordinates of the image (increasing CCW\n    from West) instead of relative to the X/Y pixel coordinate system.\n    This only affects rotated images (e.g. with non-zero CROTA2 keyword)\n    with elliptical or rectangular regions.\n\n  - cleaned up fitsio.h and fitsio2.h to make the definition of LONGLONG\n    and BYTESWAPPED and MACHINE more logical.\n    \n  - removed HAVE_LONGLONG everywhere since it is no longer needed (the \n    compiler now must have an 8-byte integer datatype to build CFITSIO).\n    \n  - added support for the 64-bit IBM AIX platform\n\n  - modified eval.y so that the circle, ellipse, box, and near functions\n    can operate on vectors as well as scalars.  This allows region filtering\n    on images that are stored in a vector cell in a binary table. \n    (provided by Craig Markwardt, GSFC)\n\n  New Routines\n  \n  - added new fits_read_wcstab routine that serves as an interface to\n    Mark Calabretta's wcslib library for reading WCS information when\n    the -TAB table lookup convention is used in the FITS file.\n\n  - added new fits_write_nullrows routine, which writes null values into\n    every column of a specified range of rows in a FITS table.\n\n  - added the fits_translate_keyword and fits_translate_keywords utility\n    routines for converting the names of keywords when moving columns and\n    images around.\n    \n  - added fits_copy_cell2image and fits_copy_image2cell routines for\n    copying an image extension (or primary array) to or from a cell\n    in a binary table vector column. \n  \n  Bug fixes\n  \n  - fixed a memory leak in eval.y;  was fixed by changing a call to malloc\n    to cmalloc instead.\n\n  - changed the definition of several global variables at the beginning\n    of buffers.c to make them 'static' and thus invisible to applications\n    programs.\n\n  - in fits_copy_image_cell, added a call to flush the internal buffers\n    before reading from the file, in case any records had been modified.\n\nVersion 3.003 - 28 July 2005 - 2nd public beta release (used in HEASOFT)\n\n  Enhancements\n  \n  - enhanced the string column reading routing fits_get_col_str to \n    support cases where the user enters a null pointer (rather than\n    a null string) as the nulval parameter.\n\n  - modified the low level ffread and ffwrite routines that physically\n    read and write data from the FITS file so that they write the name\n    of the file to the CFITSIO error stack if an error occurs.\n\n  - changed the definition of fits_open_file into a macro that will test\n    that the version of the fitsio.h include file that was used to \n    build the CFITSIO library is the same version as included when\n    compiling the application program.\n\n  - made a simple modification to region.c to support regions files\n    of type \"linear\", for compatibility with ds9 and fv.\n    \n  - modified the internal ffgpr routine (and renamed it ffgprll) so\n    that it returns the TNULL value as a LONGLONG parameter instead\n    of 'long'.\n    \n  - in fits_get_col_display_width, added support for TFORM = 'k'\n  \n  - modified fitsio.h, fitsio2.h, and f77_wrap.h to add test for (_SX)\n    to identify NEC SX supercomputers.\n\n  - modified eval_f.c to treat table columns of TULONG  (unsigned long)\n    as a double.  Also added support for TLONGLONG (8-byte integers) as\n    a double, which is only a temporary fix, since doubles only have about\n    52 bits of precision.\n\n  - changed the 'blank' parameter in the internal ffgphd function to\n    to type LONGLONG to support integer*8 FITS images.\n\n  - when reading the TNULL keyword value, now use ffc2jj instead of\n    ffc2ii, to support integer*8 values.\n\n  Bug fixes\n\n  - fixed a significant bug when writing character strings to a variable\n    length array column of a binary table. This bug would result in some\n    unused space in the variable length heap, making the heap somewhat\n    larger than necessary.  This in itself is usually a minor issue, since\n    the FITS files are perfectly valid, and other software should have\n    no problems reading back the characters strings. In some cases, however,\n    this problem could cause the program that is writing the table\n    to exit with a status = 108 disk read error.\n\n  - modified the standalone imcopy.c utility program to fix a memory allocation\n    bug when running on 64-bit platforms where sizeof(long) = 8 bytes.\n\n  - added an immediate 'return' statement to ffgtcl if the input status >0, \n    to prevent a segfault on some platforms.\n\nVersion 3.002 - 15 April 2005 - first public beta release\n\n  - in drvrfile.c, if it fails to open the file for some reason, then\n    it should reset file_outfile to a null string, to avoid errors on\n    a subsequent call to open a file.\n \n  - updated fits_get_keyclass to recognize most of the WCS keywords\n    defined in the WCS Papers I and II.\n\nVersion 3.001 - 15 March 2005  - released with HEASOFT 6.0\n\n  - numerous minor changes to the code to get rid of compiler warning\n    messages, mainly dealing with numerical data type casting and the\n    subsequent possible loss of precision in the result.\n\nVersion 3.000 - 1 March 2005 (internal beta release)\n\n  Enhancements:\n\n   - Made major changes to many of the CFITSIO routines to more generally \n     support Large Files (> 2.1 GB).  These changes are intended to \n     be 100% backward compatible with software that used the previous \n     versions of CFITSIO.  The datatype of many of the integer parameters \n     in the CFITSIO functions has been changed from 'long' to 'LONGLONG', \n     which is typedef'ed to be equivalent to an 8-byte integer datatype on \n     each platform. With these changes, CFITSIO supports the following:\n        - integer FITS keywords with absolute values > 2**31\n        - FITS files with total sizes > 2**31 bytes\n\t- FITS tables in which the number of rows, the row width, or\n\t  the size of the heap is > 2**31 bytes\n\t- FITS images with dimensions > 2**31 bytes (support is still \n\t  somewhat limited, with full support to be added later).\n\n   - added another lexical parser function (thanks to Craig Markwardt,\n     GSFC): angsep computes the angular separation between 2 positions\n     on the celestial sphere.\n  \n   - modified the image subset extraction code (e.g., when specifying\n     an image subregion when opening the file, such as \n     'myimage.fits[21:40, 81:90]') so that in addition to\n     updating the values of the primary WCS keywords CRPIXk, CDELTi, and\n     CDj_i in the extracted/binned image, it also looks for and updates \n     any secondary WCS keywords (e.g., 'CRPIX1P').\n\n   - made cosmetic change to group.c, so that when a group table is\n     copied, any extra columns will be appended after the last existing\n     column, instead of being inserted before the last column.\n     \n   - modified the routines that read tile compressed images to support\n     NULL as the input value for the 'anynul' parameter (meaning the\n     calling program does not want the value of 'anynul' returned to it).\n      \n   - when constructing or parsing a year/month/day character string,\n     (e.g, when writing the DATE keyword) the routines now rigorously\n     verify that the input day value is valid for the given month \n     (including leap years).\n\n   - added some checks in cfileio.c to detect if some vital parameters\n     that are stored in memory have been corrupted.  This can occur if\n     a user's program writes to areas of memory that it did not allocate.\n\n   - added the wcsutil_alternate.c source code file which contains\n     non-working stubs for the 2 Classic AIPS world coordinate\n     conversion routines that are distributed under the GNU General\n     Public License.  Users who are unwilling or unable to distribute\n     their software under the General Public License may use this \n     alternate source file which has no GPL restrictions, instead\n     of wcsutil.c.  This will have no effect on programs that use \n     CFITSIO as long as they do not call the fits_pix_to_world/ffwldp\n     or fits_world_to_pix/ffxypx routines.\n     \n   Bug Fixes\n   \n   - in ffdtdm (which parses the TDIMn keyword value), the check for\n     consistency between the length of the array defined by TDIMn and\n     the size of the TFORMn repeat value, is now not performed for variable\n     length array columns (which always have repeat = 1).\n\n   - fixed byteswapping problem when writing null values to non-standard\n     long integer FITS images with BITPIX = 64 and FITS table columns with\n     TFORMn = 'K'.\n\n   - fixed buffer overflow problem in fits_parse_template/ffgthd that\n     occurred only if the input template keyword value string was much\n     longer than can fit in an 80-char header record.\n     \nVersion 2.510 - 2 December 2004\n\n  New Routines:\n  \n   - added fits_open_diskfile and fits_create_diskfile routines that simply\n     open or create a FITS file with a specified name.  CFITSIO does not\n     try to parse the name using the extended filename syntax.\n     \n   - 2 new C functions, CFITS2Unit and CUnit2FITS, were added to convert\n     between the C fitsfile pointer value and the Fortran unit number.\n     These functions may be useful in mixed language C and Fortran programs.   \n   \n  Enhancements:\n  \n   - added the ability to recognize and open a compressed FITS file\n     (compressed with gzip or unix compress) on the stdin standard input\n     stream.\n  \n   - Craig Markwardt (GSFC) provided 2 more lexical parser functions:\n     accum(x) and seqdiff(x) that compute the cumulative sum and the\n     sequential difference of the values of x.\n  \n   - modified putcole.c and putcold.c so that when writing arrays of\n     pixels to the FITS image or column that contain null values, and\n     there are also numerical overflows when converting some of the\n     non-null values to the FITS values, CFITSIO will now ignore the\n     overflow error until after all the data have been written. Previously,\n     in some circumstances CFITSIO would have simply stopped writing any\n     data after the first overflow error.     \n      \n   - modified fitsio2.h to try to eliminate compiler warning messages\n     on some platforms about the use of 'long long' constants when \n     defining the value of LONGLONG_MAX (whether to use L or LL\n     suffix).\n\n   - modified region.c to support 'physical' regions in addition to\n     'image', 'fk4', etc.\n\n   - modified ffiurl (input filename parsing routine) to increase the \n     maximum allowed extension number that can be specified from 9999 \n     to 99999 (e.g. 'myfile.fits+99999')\n\n  Bug Fixes:\n  \n   - added check to fits_create_template to force it to start with\n     the primary array in the template file, in case an extension\n     number was specified as part of the template FITS file name.\n      \nVersion 2.500 - 28 & 30 July 2004\n\n  New Routine:  \n  \n   - fits_file_exists tests whether the specified input file, or a \n     compressed version of the file, exists on disk.\n\n  Enhancements:\n\n   - modified the way CFITSIO reads and writes data in COMPLEX ('C') and\n     DBLCOMPLEX 'M' columns.  Now, in all cases, when referring to the\n     number of elements in the vector, or the value of the offset to a \n     particular element within the vector, CFITSIO considers each pair of\n     numbers (the imaginary and real parts) as a single element instead of\n     treating each single number as an element. In particular, this changes\n     the behavior of fits_write_col_null when writing to complex columns.  \n     It also changes the length of the 'nullarray' vector in the\n     fits_read_colnull routine;  it is now only 1/2 as long as before.\n     Each element of the nullarray is set = 1 if either the real or \n     imaginary parts of the corresponding complex value have a null\n     value.(this change was added to version 2.500 on 30 July).\n\n   - Craig Markwardt, at GSFC, provided a number of significant enhancements\n     to the CFITSIO lexical parser that is used to evaluate expressions:\n     \n       - the parser now can operate on bit columns ('X') in a similar\n         way as for other numeric columns (e.g., 'B' or 'I' columns)\n\t \n       - range checking has been implemented, so that the following \n         conditions return a Null value, rather than returning an error:\n\t divide by zero, sqrt(negative),  arccos(>1), arcsin(>1),\n\t log(negative), log10(negative)\n\t \n       - new vector functions:  MEDIAN, AVERAGE, STDDEV, and \n         NVALID (returns the number of non-null values in the vector)\n\n       - all the new functions (and SUM, MIN and MAX) ignore null values\n       \n   - modified the iterator to support variable-length array columns\n\n   - modified configure to support AIX systems that have flock in a non-\n     standard location.\n     \n   - modified configure to remove the -D_FILE_OFFSET_BITS flag when running\n     on Mac Darwin systems.  This caused conflicts with the Fortran\n     wrappers, and should only be needed in any case when using CFITSIO\n     to read/write FITS files greater than 2.1 GB in size.\n\n   - modified fitsio2.h to support compilers that define LONG_LONG_MAX.\n\n   - modified ffrsim (resize an existing image) so that it supports changing\n     the datatype to an unsigned integer image using the USHORT_IMG and\n     ULONG_IMG definitions.\n\n   - modified the disk file driver (drvrfile.c) so that if an output\n     file is specified when opening an ordinary file (e.g. with the syntax\n     'myfile.fits(outputfile.fits)' then it will make a copy of the file,\n     close the original file and open the copy.  Previously, the\n     specified output file would be ignored unless the file was compressed.\n\n   - modified f77_wrap.h and f77_wrap3.c to support the Fortran wrappers\n     on 64-bit AMD Opteron machines\n\n  Bug fixes:\n\n   - made small change to ffsrow in eval_f.c to avoid potential array \n     bounds overflow.\n     \n   - made small change to group.c to fix problem where an 'int' was\n     incorrectly being cast to a 'long'.\n\n   - corrected a memory allocation error in the new fits_hdr2str routine\n     that was added in version 2.48\n\n   - The on-the-fly row-selection filtering would fail with a segfault\n     if the length of a table row (NAXIS1 value) was greater than\n     500000 bytes.  A small change to eval_f.c was required to fix this.\n\nVersion 2.490 - 11 February 2004\n\n  Bug fixes:\n\n  - fixed a bug that was introduced in the previous release, which caused\n    the CFITSIO parser to no longer move to a named extension when opening\n    a FITS file, e.g., when opening myfile.fit[events] CFITSIO would just\n    open the primary array instead of moving to the EVENTS extension.\n\n  - new group.c file from the INTEGRAL Science Data Center.  It fixes\n    a problem when you attach a child to a parent and they are both\n    is the same file, but, that parent contains groups in other files.\n    In certain cases the attach would not happen because it seemed that\n    the new child was already in the parent group.\n\n  - fixed bug in fits_calculator_rng when performing a calculation\n    on a range of rows in a table, so that it does not reset the\n    value in all the other rows that are not in the range = 0.\n\n  - modified fits_write_chksum so that it updates the TFORMn \n    keywords for any variable length vector table columns BEFORE \n    calculating the CHECKSUM values.  Otherwise the CHECKSUM\n    value is invalidated when the HDU is subsequently closed.\n\nVersion 2.480 - 28 January 2004\n\n  New Routines:\n\n  - fits_get_img_equivtype - just like fits_get_img_type, except in\n    the case of scaled integer images, it returns the 'equivalent' \n    data type that is necessary to store the scaled data values.  \n\n  - fits_hdr2str copies all the header keywords in the current HDU\n    into a single long character string.  This is a convenient method\n    of passing the header information to other subroutines.\n    The user may exclude any specified keywords from the list.\n\n  Enhancements:\n\n  - modified the filename parser so that it accepts extension\n    names that begin with digits, as in 'myfile.fits[123TEST]'.\n    In this case CFITSIO will try to open the extension with\n    EXTNAME = '123TEST' instead of trying to move to the 123rd\n    extension in the file.\n\n  - the template keyword parser now preserves the comments on the\n    the mandatory FITS keywords if present, otherwise a standard\n    default comment is provided.\n\n  - modified the ftp driver file (drvrnet.c) to overcome a timeout\n    or hangup problem caused by some firewall software at the user's\n    end (Thanks to Bruce O'Neel for this fix).\n\n  - modified iraffits.c to incorporate Doug Mink's latest changes to\n    his wcstools library routines.  The biggest change is that now\n    the actual image dimensions, rather than the physically stored\n    dimensions, are used when converting an IRAF file to FITS.\n\n  Bug fixes:\n\n  - when writing to ASCII FITS tables, the 'elemnum' parameter was\n    supposed to be ignored if it did not have the default value of 1.\n    In some cases however setting elemnum to a value other than 1 \n    could cause the wrong number of rows to be produced in the output\n    table.\n\n  - If a cfitsio calculator expression was imported from a text file\n    (e.g. using the extended filename syntax 'file.fits[col @file.calc]')\n    and if any individual lines in that text file were greater than \n    255 characters long, then a space character would be inserted\n    after the 255th character.  This could corrupt the line if the space\n    was inserted within a column name or keyword name token.\n\nVersion 2.480beta  (used in the FTOOLS 5.3 release, 1 Nov 2003)\n\n  New Routines:\n\n  - fits_get_eqcoltype - just like fits_get_coltype, except in the\n    case of scaled integer columns, it returns the 'equivalent' \n    data type that is necessary to store the scaled data values.  \n\n  - fits_split_names - splits an input string containing a comma or\n    space delimited list of names (typically file names or column\n    names) into individual name tokens.\n\n  Enhancements:\n\n  - changed fhist in histo.c so that it can make histograms of ASCII\n    table columns as well as binary table columns (as long as they\n    contain numeric data).\n\n  Bug fixes:\n\n  - removed an erroneous reference to listhead.c in makefile.vcc, that is\n    used to build the cfitsio dll under Windows.  This caused a 'main'\n    routine to be added to the library, which causes problems when linking\n    fortran programs to cfitsio under windows.\n\n  - if an error occurs when opening for a 2nd time (with ffopen) a file that\n    is already open (e.g., the specified extension doesn't exist), and\n    if the file had been modified before attempting to reopen it, then\n    the modified buffers may not get written to disk and the internal\n    state of the file may become corrupted.  ffclos was modified to\n    always set status=0 before calling ffflsh if the file has been \n    concurrently opened more than once.\n\nVersion 2.470 - 18 August 2003\n\n  Enhancements:\n\n  - defined 'TSBYTE' to represent the 'signed char' datatype (similar to\n    'TBYTE' that represents the 'unsigned char' datatype) and added\n    support for this datatype to all the routines that read or write\n    data to a FITS image or table.   This was implemented by adding 2\n    new C source code files to the package: getcolsb.c and putcolsb.c.\n\n  - Defined a new '1S' shorthand data code for a signed byte column in\n    a binary table.  CFITSIO will write TFORMn = '1B' and\n    TZEROn = -128 in this case, which is the convention used to\n    store signed byte values in a 'B' type column.\n\n  - in fitsio2.h, added test of whether  `__x86_64__` is defined, to \n    support the new AMD Opteron 64-bit processor\n\n  - modified configure to not use the -fast compiler flag on Solaris\n    platforms when using the proprietary Solaris cc compiler.  This\n    flag causes compilation problems in eval_y.c (compiler just\n    hangs forever).\n\n  Bug fixes:\n\n  - In the special case of writing 0 elements to a vector table column\n    that contains 0 rows, ffgcpr no longer adds a blank row to the table.\n    \n  - added error checking code for cases where a ASCII string column\n    in a binary table is greater than 28800 characters wide, to avoid\n    going into an infinite loop.\n\n  - the fits_get_col_display_width routine was incorrectly returning\n    width = 0 for a 'A' binary table column that did not have an \n    explicit vector length character.\n\nVersion 2.460 - 20 May 2003\n\n  Enhancements:\n\n  - modified the HTTP driver in drvrnet.c so that CFITSIO can read\n    FITS files via a proxy HTTP server.  (This code was contributed by\n    Philippe Prugniel, Obs. de Lyon).  To use this feature, the \n    'http_proxy' environment variable must be defined with the\n    address (URL) and port number of the proxy server, i.e.,\n      > setenv http_proxy http://heasarc.gsfc.nasa.gov:3128\n    will use port 3128 on heasarc.gsfc.nasa.gov\n\n  - suppressed some compiler warnings by casting a variable of \n    type 'size_t' to type 'int' in fftkey (in fitscore.c) and\n    iraftofits and irafrdimge (in iraffits.c).\n\nVersion 2.450 - 30 April 2003\n\n  Enhancements:\n\n  - modified the WCS keyword reading routine (ffgics) to support cases\n    where some of the CDi_j keywords are omitted (with an assumed \n    value = 0).\n\n  - Made a change to http_open_network in drvrnet.c to add a 'Host: '\n    string to the open request.  This is required by newer HTTP 1.1\n    servers (so-called virtual servers).\n\n  - modified ffgcll (read logical table column) to return the illegal\n    character value itself if the FITS file contains a logical value that is\n    not equal to T, F or zero.  Previously it treated this case the\n    same as if the FITS file value was = 0.\n\n  - modified fits_movnam_hdu (ffmnhd) so that it will move to a tile-\n    compressed image (that is stored in a binary table) if the input\n    desired HDU type is BINARY_TBL as well as if the HDU type = IMAGE_HDU.\n\n  Bug fixes:\n\n  - in the routine that checks the data fill bytes (ffcdfl), the call\n    to ffmbyt should not ignore an EOF error when trying to read the bytes.\n    This is a little-used routine that is not called by any other CFITSIO\n    routine.\n\n  - fits_copy_file was not reporting an error if it hit the End Of File\n    while copying the last extension in the input file to the output file.\n\n  - fixed inconsistencies in the virtual file column filter parser\n    (ffedit_columns) to properly support expressions which create or\n    modify a keyword, instead of a column.  Previously it was only possible\n    to modify keywords in a table extension (not an image), and the \n    keyword filtering could cause some of the table columns to not\n    get propagated into the virtual file.  Also, spaces are now\n    allowed within the specified keyword comment field.\n\n  - ffdtyp was incorrectly returning the data type of FITS keyword\n    values of the form '1E-09' (i.e., an exponential value without\n    a decimal point) as integer rather than floating point.\n\n  - The enhancement in the previous 2.440 release to allow more files to be\n    opened at one time introduced a bug: if ffclos is called with\n    a non-zero status value, then any subsequent call to ffopen will likely\n    cause a segmentation fault.  The fits_clear_Fptr routine was modified\n    to fix this.\n\n  - rearranged the order of some computations in fits_resize_img so as\n    to not exceed the range of a 32-bit integer when dealing with \n    large images.\n\n  - the template parser routine, ngp_read_xtension, was testing for\n    \"ASCIITABLE\" instead of \"TABLE\" as the XTENSION value of an ASCII\n    table, and it did not allow for optional trailing spaces in the IMAGE\"\n    or \"TABLE\" string value.\n\nVersion 2.440 - 8 January 2003\n\n  Enhancements:\n\n  - modified the iterator function, ffiter, to operate on random\n    groups files.\n\n  - decoupled the NIOBUF (= 40) parameter from the limit on the number\n    FITS files that can be opened, so that more files may be opened\n    without the overhead of having to increase the number of NIOBUF\n    buffers.  A new NMAXFILES parameter is defined in fitsio2.h which sets\n    the maximum number of opened FITS files.  It is set = 300 by default.\n    Note however, that the underlying compiler or operating system may\n    not allow this many files to be opened at one time.\n\n  - updated the version of cfortran.h that is distributed with CFITSIO from \n    version 3.9 to version 4.4.  This required changes to f77_wrap.h\n    and f77_wrap3.c.  The original cfortran.h v4.4 file was modified\n    slightly to support CFITSIO and ftools (see comments in the header\n    of cfortran.h).\n\n  - modified ffhist so that it copies all the non-structural keywords from\n    the original binary table header to the binned image header.\n\n  - modified fits_get_keyclass so that it recognizes EXTNAME =\n    COMPRESSED_IMAGE as a special tile compression keyword.\n\n  - modified Makefile.in to support the standard --prefix convention\n    for specifying the install target directory.\n\n  Bug fixes:\n\n  - in fits_decompress_img, needed to add a call to ffpscl to turn\n    off the BZERO and BSCALE scaling when reading the compressed image.\n\nVersion 2.430 - 4 November 2002\n\n  Enhancements:\n\n  - modified fits_create_hdu/ffcrhd so that it returns without doing\n    anything and does not generate an error if the current HDU is \n    already an empty HDU.  There is no need in this case to append\n    a new empty HDU to the file.\n\n  - new version of group.c (supplied by B. O'Neel at the ISDC) fixes 2\n    limitations:  1 - Groups now have 256 characters rather than 160\n    for the path lengths in the group tables. - ISDC SPR 1720.  2 -\n    Groups now can have backpointers longer than 68 chars using the long\n    string convention. - ISDC SPR 1738.\n\n  - small change to f77_wrap.h and f77_wrap3.c to support the fortran\n    wrappers on SUN solaris 64-bit sparc systems (see also change to v2.033)\n\n  - small change to find_column in  eval_f.c to support unsigned long\n    columns in binary tables (with TZEROn = 2147483648.0)\n\n  - small modification to cfortran.h to support Mac OS-X, (Darwin)\n\n  Bug fixes:\n\n  - When reading tile-compress images, the BSCALE and BZERO scaling\n    keywords were not being applied, if present.\n\n  - Previous changes to the error message stack code caused the\n    tile compressed image routines to not clean up spurious error\n    messages properly.\n\n  - fits_open_image was not skipping over null primary arrays.\n\nVersion 2.420 - 19 July 2002\n\n  Enhancements:\n\n  - modified the virtual filename parser to support exponential notation\n    when specifying the min, max or binsize in a binning specifier, as in:\n    myfile.fits[binr X=1:10:1.0E-01, Y=1:10:1.0E-01]\n\n  - removed the limitation on the maximum number of HDUs in a FITS file \n    (limit used to be 1000 HDUs per file).  Now any number of HDUs\n    can be written/read in a FITS file. (BUT files that have huge numbers\n    of HDUs can be difficult to manage and are not recommended);\n\n  - modified grparser.c to support HIERARCH keywords, based on \n    code supplied by Richard Mathar (Max-Planck)\n\n  - moved the ffflsh (fits_flush_buffer) from the private to the\n    public interface, since this routine may be useful for some  \n    applications.  It is much faster than ffflus.\n\n  - small change to the definition of OFF_T in fitsio.h to support\n    large files on IBM AIX operating systems.\n\n  Bug fixes:\n\n  - fixed potential problem reading beyond array bounds in ffpkls.  This\n    would not have affected the content of any previously generated FITS\n    files.\n\n  - in the net driver code in drvrnet.c, the requested protocol string\n    was changed from \"http/1.0\" to \"HTTP/1.0\" to support apache 1.3.26.\n\n  - When using the virtual file syntax to open a vector cell in a binary\n    table as if it were a primary array image, there was a bug\n    in fits_copy_image_cell which garbled the data if the vector\n    was more than 30000 bytes long.\n\n  - fixed problem that caused fits_report_error to crash under Visual\n    C++ on Windows systems.  The fix is to use the '/MD' switch\n    on the cl command line, or, in Visual Studio, under project\n    settings / C++ select use runtime library multithreaded DLL\n\n  - modified ffpscl so it does not attempt to reset the scaling values\n    in the internal structure if the image is tile-compressed.\n\n  - fixed multiple bugs in mem_rawfile_open which affected the case\n    where a raw binary file is read and converted on the fly into\n    a FITS file.\n\n  - several small changes to group.c to suppress compiler warnings.\n\nVersion 2.410 - 22 April 2002 (used in the FTOOLS 5.2 release)\n\n  New Routines:\n\n  - fits_open_data behaves similarly to fits_open_file except that it\n    also will move to the first HDU containing significant data if\n    and an explicit HDU name or number to open was not specified.\n    This is useful for automatically skipping over a null primary\n    array when opening the file.\n\n  - fits_open_table and fits_open_image behaves similarly to \n    fits_open_data, except they move to the first table or image\n    HDU in the file, respectively.\n\n  - fits_write_errmark and fits_clear_errmark routines can be use\n    to write an invisible marker to the CFITSIO error stack, and\n    then clear any more recent messages on the stack, back to \n    that mark.  This preserves any older messages on the stack.\n\n  - fits_parse_range utility routine parses a row list string\n    and returns integer arrays giving the min and max row in each\n    range.\n\n  - fits_delete_rowrange deletes a specified list of rows or row\n    ranges.\n\n  - fits_copy_file copies all or part of the HDUs in the input file\n    to the output file.\n\n  - added fits_insert_card/ffikey to the publicly defined set\n    of routines (previously, it was a private routine).\n\n  Enhancements:\n\n  - changed the default numeric display format in ffgkys from 'E' format\n    to 'G' format, and changed the format for 'X' columns to a \n    string of 8 1s or 0s representing each bit value.\n\n  - modified ffflsh so the system 'fflush' call is not made in cases\n    where the file was opened with 'READONLY' access.\n\n  - modified the output filename parser so the \"-.gz\", and \"stdout.gz\"\n    now cause the output file to be initially created in memory,\n    and then compressed and written out to the stdout stream when\n    the file is closed.\n\n  - modified the routines that delete rows from a table to also \n    update the variable length array heap, to remove any orphaned\n    data from the heap.\n\n  - modified ffedit_columns so that wild card characters may be\n    used when specifying column names in the 'col' file filter\n    specifier (e.g.,  file.fits[col TIME; *RAW] will create a\n    virtual table contain only the TIME column and any other columns\n    whose name ends with 'RAW').\n\n  - modified the keyword classifier utility, fits_get_keyclass, to\n    support cases where the input string is just the keyword name,\n    not the entire 80-character card.\n\n  - modified configure.in and configure to see if a proprietary\n    C compiler is available (e.g. 'cc'), and only use 'gcc' if not.\n\n  - modified ffcpcl (copy columns from one table to another) so that\n    it also copies any WCS keywords related to that column.\n\n  - included an alternate source file that can be used to replace\n    compress.c, which is distributed under the GNU General Public\n    License.  The alternate file contains non-functional stubs for\n    the compression routines, which can be used to make a version of\n    CFITSIO that does not have the GPL restrictions (and is also less\n    functional since it cannot read or write compressed FITS files).\n\n  - modifications to the iterator routine (ffiter) to support writing\n    tile compressed output images.\n\n  - modified ffourl to support the [compress] qualifier when specifying\n    the optional output file name. E.g., file.fit(out.file[compress])[3]\n\n  - modified imcomp_compress_tile to fully support implicit data type\n    conversion when writing to tile-compressed images.  Previously,\n    one could not write a floating point array to an integer compressed\n    image.\n\n  - increased the number of internal 2880-byte I/O buffers allocated\n    by CFITSIO from 25 to 40, in recognition of the larger amount\n    of memory available on typical machines today compared with\n    a few years ago.  The number of buffers can be set by the user\n    with the NIOBUF parameter in fitsio2.h.  (Setting this too large\n    can actually hurt performance).\n\n  - modified the #if statements in fitsio2.h, f77_wrap.h and f77_wrap1.c\n    to support the new Itanium 64-bit Intel PC.\n\n  - a couple minor modifications to fitsio.h needed to support the off_t\n    datatype on Debian linux systems.\n\n  - increased internal buffer sizes in ffshft and ffsrow to improve\n    the I/O performance.\n\n  Bug fixes:\n\n  - fits_get_keyclass could sometimes try to append to an unterminated \n    string, causing an overflow of a string array.   \n\n  - fits_create_template no longer worked because of improvements made\n    to other routines.  Had to modify ffghdt to not try to rescan\n    the header keywords if the file is still empty and contains no\n    keywords yet.\n\n  - ffrtnm, which returns the root filename, sometimes did not work \n    properly when testing if the 'filename+n' convention was used for\n    specifying an extension number.\n\n  - fixed minor problem in the keyword template parsing routine, ffgthd\n    which in rare cases could cause an improperly terminated string to\n    be returned.\n\n  - the routine to compare 2 strings, ffcmps, failed to find a match \n    in comparing strings like \"*R\" and \"ERROR\" where the match occurs\n    on the last character, but where the same matching character occurs\n    previously in the 2nd string.\n\n  - the region file reading routine (ffrrgn) did not work correctly if\n    the region file (created by POW and perhaps other programs) had an\n    'exclude' region (beginning with a '-' sign) as the first region \n    in the file.  In this case all points outside the excluded region\n    should be accepted, but in fact no points were being accepted\n    in this case.\n\nVersion 2.401 - 28 Jan 2002\n\n  - added the imcopy example program to the release (and Makefile)\n\n  Bug fixes:\n\n  - fixed typo in the imcompress code which affected compression\n    of 3D datacubes.\n\n  - made small change to fficls (insert column) to allow colums with\n    TFORMn = '1PU' and '1PV' to be inserted in a binary table.  The\n    'U' and 'V' are codes only used within CFITSIO to represent unsigned\n    16-bit and 32-bit integers; They get replaced by '1PI' and '1PJ'\n    respectively in the FITS table header, along with the appropriate\n    TZEROn keyword.\n\nVersion 2.400 - 18 Jan 2002\n\n  (N.B.: Application programs must be recompiled, not just relinked \n     with the new CFITSIO library because of changes made to fitsio.h)\n\n  New Routines:\n\n  - fits_write_subset/ffpss writes a rectangular subset (or the whole\n    image) to a FITS image.\n\n  - added a whole new family of routines to read and write arrays of \n    'long long' integers (64-bit) to FITS images or table columns.  The\n    new routine names all end in 'jj':  ffpprjj, ffppnjj, ffp2djj,\n    ffp3djj, ffppssjj, ffpgpjj, ffpcljj, ffpcnjj. ffgpvjj, ffgpfjj,\n    ffg2djj, ffg3djj, ffgsvjj, ffgsfjj, ffggpjj, ffgcvjj, and ffgcfjj.\n\n  - added a set of helper routines that are used in conjunction with\n    the new support for tiled image compression.  3 routines set the\n    parameters that should be used when CFITSIO compresses an image:\n        fits_set_compression_type\n        fits_set_tile_dim\n        fits_set_noise_bits\n\n      3 corresponding routines report back the current settings:\n        fits_get_compression_type\n        fits_get_tile_dim\n        fits_get_noise_bits\n\n  Enhancements:\n\n  - major enhancement was made to support writing to tile-compressed\n    images.  In this format, the image is divided up into a rectangular\n    grid of tiles, and each tile of pixels is compressed individually\n    and stored in a row of a variable-length array column in a binary\n    table.  CFITSIO has been able to transparently read this compressed\n    image format ever since version 2.1.  Now all the CFITSIO image\n    writing routines also transparently support this format.  There are\n    2 ways to force CFITSIO to write compressed images: 1) call the\n    fits_set_compression_type routine before writing the image header\n    keywords, or 2), specify that the image should be compressed when\n    entering the name of the output FITS file, using a new extended\n    filename syntax.  (examples: \"myfile.fits[compress]\" will use the\n    default compression parameters, and \"myfile.fits[compress GZIP\n    100,100] will use the GZIP compression algorithm with 100 x 100\n    pixel tiles.\n\n  - added new driver to support creating output .gz compressed fits\n    files.  If the name of the output FITS file to be created ends with\n    '.gz' then CFITSIO will initially write the FITS file in memory and\n    then, when the FITS file is closed, CFITSIO will gzip the entire\n    file before writing it out to disk.\n\n  - when over-writing vectors in a variable length array in a binary\n    table, if the new vector to be written is less than or equal to\n    the length of the previously written vector, then CFITSIO will now\n    reuse the existing space in the heap, rather than always appending\n    the new array to the end of the heap.\n\n  - modified configure.in to support building cfitsio as a dynamic \n    library on Mac OS X. Use 'make shared' like on other UNIX platforms,\n    but a .dylib file will be created instead of .so.  If installed in a \n    nonstandard location, add its location to the DYLD_LIBRARY_PATH \n    environment variable so that the library can be found at run time.\n\n  - made various modifications to better support the  8-byte long integer\n    datatype on more platforms.  The 'LONGLONG' datatype is typedef'ed\n    to equal 'long long' on most Unix platforms and MacOS, and equal\n    to '__int64' on Windows machines.\n\n  - modified configure.in and makefile.in to better support cases \n    where the system has no Fortran compiler and thus the f77 wrapper\n    routines should not be compiled.\n\n  - made small modification to eval.y and eval_y.f to get rid of warning\n    on some platforms about redefinition of the 'alloca'.\n\n  Bug fixes:\n\n  - other recent bug fixes in ffdblk (delete blocks) caused ffdhdu (delete\n    HDU) to fail when trying to replace the primary array with a null\n    primary array.\n\n  - fixed bug that prevented inserting a new variable length column\n    into a table that already contained variable length data.\n\n  - modified fits_delete_file so that it will delete the file even if\n    the input status value is not equal to zero.\n\n  - in fits_resize_image, it was sometimes necessary to call ffrdef to\n    force the image structure to be defined.\n\n  - modified the filename parser to support input files with names like:\n    \"myfile.fits.gz(mem://tmp)\" in which the url type is specified for\n    the output file but not for the input file itself.  This required\n    modifications to ffiurl and ffrtnm.\n\nVersion 2.301 -   7 Dec 2001\n\n  Enhancements:\n\n   - modified the http file driver so that if the filename to be opened\n     contains a '?' character (most likely a cgi related string) then it\n     will not attempt to append a .gz or .Z as it would normally do.\n\n   - added support for the '!' clobber character when specifying\n     the output disk file name in CFITSIO's extended filename syntax, e.g.,\n     'http://a.b.c.d/myfile.fits.gz(!outfile.fits)'\n\n   - added new device driver which is used when opening a compressed FITS\n     file on disk by uncompressing it into memory with READWRITE\n     access.  This happens when specifying an output filename\n     'mem://'.\n\n   - added 2 other device drivers to open http and ftp files in memory\n     with write access.\n\n   - improved the error trapping and reporting in cases where program\n     attempts to write to a READONLY file (especially in cases where the\n    'file' resides in memory, as is the case when opening an ftp or http\n     file.\n\n   - modified the extended filename parser so that it is does not confuse\n     the bracket character '[' which is sometimes used in the root name\n     of files of type 'http://', as the start of an extname or row filter\n     expression.  If the file is of type 'http://', the parser now\n     checks to see if the last character in the extended file name is\n     a ')' or ']'.  If not, it does not try to parse the file name\n     any further.\n\n   - improved the efficiency when writing FITS files in memory, by\n     initially allocating enough memory for the entire HDU when it is\n     created, rather than incrementally reallocing memory 2880 bytes\n     at a time (modified ffrhdu and mem_truncate).  This change also\n     means that the program will fail much sooner if it cannot allocate\n     enough memory to hold the entire FITS HDU.\n\n  Bug fixes:\n\n   - There was an error in the definition of the Fortran ftphtb wrapper\n     routine (writes required ASCII table header keywords) that caused\n     it to fail on DEC OSF and other platforms where sizeof(long) = 8.\n\nVersion 2.300 - 23 Oct 2001\n\n  New Routines:\n\n   - fits_comp_img and fits_decomp_img are now fully supported and\n     documented.  These routine compress and decompress, respective,\n     a FITS image using a new algorithm in which the image is first\n     divided into a grid of rectangular tiles, then the compressed byte\n     stream from each tile is stored in a row of a binary table.\n     CFITSIO can transparently read FITS images stored in this\n     compressed format.  Compression ratios of 3 - 6 are typically\n     achieved.  Large compression ratios are achieved for floating\n     point images by throwing away non-significant noise bits in the\n     pixel values.\n\n   - fits_test_heap tests the integrity of the binary table heap and\n     returns statistics on the amount of unused space in the heap and\n     the amount of space that is pointed to by more than 1 descriptor.\n\n   - fits_compress_heap which will reorder the arrays in the binary\n     table heap, recovering any unused space.\n\n  Enhancements:\n\n   - made substantial internal changes to the code to support FITS\n     files containing 64-bit integer data values.  These files have\n     BITPIX = 64 or TFORMn = 'K'.  This new feature in CFITSIO is\n     currently only enabled if SUPPORT_64BIT_INTEGERS is defined = 1 in\n     the beginning of the fitsio2.h file.  By default support for\n     64-bit integers is not enabled.\n\n   - improved the ability to read and return a table column value as a\n     formatted string by supporting quasi-legal TDISPn values which\n     have a lowercase format code letter, and by completely ignoring\n     other unrecognizable TDISPn values.  Previously, unrecognized\n     TDISPn values could cause zero length strings to be returned.\n\n   - made fits_write_key_longstr more efficient when writing keywords\n     using the long string CONTINUE convention.  It previously did not\n     use all the available space on each card when the string to be\n     written contained many single quote characters.\n\n   - added a new \"CFITSIO Quick Start Guide\" which provides all the\n     basic information needed to write C programs using CFITSIO.\n\n   - updated the standard COMMENT keywords that are written at the \n     beginning of every primary array to refer to the newly published\n     FITS Standard document in Astronomy and Astrophysics.\n     Note: because of this change, any FITS file created with this\n     version of CFITSIO will not be identical to the same file written\n     with a previous version of CFITSIO.\n\n   - replaced the 2 routines in pliocomp.c with new versions provided by\n     D Tody and N Zarate.  These routines compress/uncompress image pixels\n     using the IRAF pixel list compression algorithm.\n\n   - modified fits_copy_hdu so that when copying a Primary Array\n     to an Image extension, the COMMENT cards which give the reference\n     to the A&A journal article about FITS are not copied.  In the\n     inverse case the COMMENT keywords are inserted in the header.\n     \n   - modified configure and Makefile.in to add capability to build a\n     shared version of the CFITSIO library.  Type 'make shared' or \n     'make libcfitsio.so' to invoke this option.\n\n   - disabled some uninformative error messages on the error stack:\n       1) when calling ffclos (and then ffchdu) with input status > 0\n       2) when ffmahd tries to move beyond the end of file.\n     The returned status value remains the same as before, but the\n     annoying error messages no longer get written to the error stack.\n\n   - The syntax for column filtering has been modified so that\n     if one only specifies a list of column names, then only those\n     columns will be copied into the output file.  This provides a simple\n     way to make a copy of a table containing only a specified list of\n     columns.  If the column specifier explicitly deletes a column, however,\n     than all the other columns will be copied to the filtered input\n     file, regardless of whether the columns were listed or not.\n     Similarly, if the expression specifies only a column to be modified\n     or created, then all the other columns in the table will be\n     copied.\n\n      mytable.fit[1][col Time;Rate]  - only the Time and Rate\n        columns will be copied to the filtered input file.\n\n      mytable.fit[1][col -Time ] - all but the Time column are copied\n        to the filtered input file.\n\n      mytable.fit[1][col Rate;-Time] - same as above.\n\n   - changed a '#if defined' statement in f77_wrap.h and f77_wrap1.c \n     to support the fortran wrappers on 64-bit IBM/RS6000 systems\n\n   - modified group.c so that when attaching one group (the child) to \n     another (the parent), check in each file for the existence of a \n     pointer to the other before adding the link. This is to prevent\n     multiple links from forming under all circumstances.\n\n   - modified the filename parser to accept 'STDIN', 'stdin', \n     'STDOUT' and 'stdout' in addition to '-' to mean read the\n     file from standard input or write to standard output.\n\n   - Added support for reversing an axis when reading a subsection\n     of a compressed image using the extended filename syntax, as in\n     myfile.fits+1[-*, *] or myfile.fits+1[600:501,501:600]\n\n   - When copying a compressed image to a uncompressed image, the\n     EXTNAME keyword is no longer copied if the value is equal to\n     'COMPRESSED_IMAGE'.\n\n   - slight change to the comment field of the DATE keyword to reflect\n     the fact that the Unix system date and time is not true UTC time.\n\n  Bug fixes:\n\n   - fits_write_key_longstr was not writing the keyword if a null\n     input string value was given.\n\n   - writing data to a variable length column, if that binary table is not\n     the last HDU in the FITS file, might overwrite the following HDU.\n     Fixed this by changing the order of a couple operations in ffgcpr.\n\n   - deleting a column from a table containing variable length columns\n     could cause the last few FITS blocks of the file to be reset = 0.\n     This bug occurred as a result of modifications to ffdblk in v2.202.\n     This mainly affects users of the 'compress_fits' utility\n     program.\n\n   - fixed obscure problem when writing bits to a variable length 'B' \n     column.\n\n   - when reading a subsection of an image, the BSCALE and BZERO pixel\n     scaling may not have been applied when reading image pixel values\n     (even though the scaling keywords were properly written in the\n     header).\n\n   - fits_get_keyclass was not returning 'TYP_STRUCT_KEY' for the\n     END keyword.\n\nVersion 2.204 - 26 July 2001 \n\n  Bug fixes:\n\n   - Re-write of fits_clean_url in group.c to solve various problems\n     with invalid bounds checking.\n\nVersion 2.203 -  19 July 2001 (version in FTOOLS v5.1)\n\n  Enhancements:\n\n   - When a row selection or calculator expression is written in\n     an external file (and read by CFITSIO with the '@filename' syntax)\n     the file can now contain comment lines.  The comment line must\n     begin with 2 slash characters as the first 2 characters on the\n     line.  CFITSIO will ignore the entire line when reading the\n     expression.\n\n  Bug fixes:\n\n   - With previous versions of CFITSIO, the pixel values in a FITS\n     image could be read incorrectly in the following case: when\n     opening a subset of a FITS image (using the\n     'filename.fits[Xmin:Xmax,Ymin:Ymax]' notation) on a PC linux, PC\n     Windows, or DEC OSF machine (but not on a SUN or Mac).  This\n     problem only occurs when reading more than 8640 bytes of data\n     (2160 4-byte integers) at a time, and usually only occurs if the\n     reading program reads the pixel data immediately after opening the\n     file, without first reading any header keywords.  This error would\n     cause strips of zero valued pixels to appear at semi-random\n     positions in the image, where each strip usually would be 2880\n     bytes long.  This problem does not affect cases where the input\n     subsetted image is simply copied to a new output FITS file.\n\n\nVersion 2.202 -  22 May 2001\n\n  Enhancements:\n\n   - revised the logic in the routine that tests if a point is\n     within a region:  if the first region is an excluded region,\n     then it implicitly assumes a prior include region covering\n     the entire detector.  It also now supports cases where a \n     smaller include region is within a prior exclude region.\n\n   - made enhancement to ffgclb (read bytes) so that it can\n     also read values from a logical column, returning an array\n     of 1s and 0s.  \n\n   - defined 2 new grouping error status values (349, 350) in \n     cfitsio.h and made minor changes to group.c to use these new\n     status values.\n\n   - modified fits_open_file so that if it encounters an error while\n     trying to move to a user-specified extension (or select a subset\n     of the rows in an input table, or make a histogram of the\n     column values) it will close the input file instead of leaving\n     it open.\n\n   - when using the extended filename syntax to filter the rows in\n     an input table, or create a histogram image from the values in\n     a table column, CFITSIO now writes HISTORY keywords in the \n     output file to document the filtering expression that was used.\n\n  Bug fixes:\n\n   - ffdblk (called by ffdrow) could overwrite the last FITS block(s) in \n     the file in some cases where one writes data to a variable length\n     column and then calls ffdrow to delete rows in the table.  This\n     bug was similar to the ffiblk bug that was fixed in v2.033.\n\n   - modified fits_write_col_null to fix a problem which under unusual\n     circumstances would cause a End-of-File error when trying to\n     read back the value in an ASCII string column, after initializing\n     if by writing a null value to it. \n\n   - fixed obscure bug in the calculator function that caused an\n     error when trying to modify the value of a keyword in a HDU\n     that does not have a NAXIS2 keyword (e.g., a null primary array).\n\n   - the iterator function (in putcol.c) had a bug when calculating\n     the optimum number rows to process in the case where the table\n     has very wide rows (>33120 bytes) and the calculator expression\n     involves columns from more than one FITS table.  This could\n     cause an infinite loop in calls to the ffcalc calculator function.\n\n   - fixed bug in ffmvec, which modifies the length of an \n     existing vector column in a binary table.  If the vector\n     was reduced in length, the FITS file could sometimes be left\n     in a corrupted state, and in all cases the values in the remaining\n     vector elements of that column would be altered.\n\n   - in drvrfile.c, replaced calls to fsetpos and fgetpos with\n     fseek and ftell (or fseeko and ftello) because the fpos_t\n     filetype used in fsetpos is incompatible with the off_t\n     filetype used in fseek, at least on some platforms (Linux 7.0).\n     (This fix was inserted into the V2.201 release on April 4).\n\n   - added \"#define fits_write_pixnull ffppxn\" to longnam.h\n\nVersion 2.201 - 15 March 2001\n\n  Enhancements\n\n   - enhanced the keyword reading routines so that they will do\n     implicit datatype conversion from a string keyword value\n     to a numeric keyword value, if the string consist of a\n     valid number enclosed in quotes.  For example, the keyword\n     mykey = '37.5' can be read by ffgkye.\n\n   - modified ffiimg so that it is possible to insert a new\n     primary array at the beginning of the file.  The original\n     primary array is then converted into an IMAGE extension.\n\n   - modified ffcpdt (copy data unit) to support the case where \n     the data unit is being copied between 2 HDUs in the same file.\n\n   - enhanced the fits_read_pix and fits_read_pixnull routines so\n     that they support the tiled image compression format that the\n     other image reading routines also support.\n\n   - modified the Extended File Name syntax to also accept a \n     minus sign (-) as well as an exclamation point (!) as\n     the leading character when specifying a column or or keyword\n     to be deleted, as in [col -time] will delete the TIME column.\n\n   - now completely support reading subimages, including pixel\n     increments in each dimension, for tile-compressed images\n     (where the compressed image tiles are stored in a binary\n      table).\n\n  Bug fixes:\n\n   - fixed confusion in the use of the fpos_t and off_t datatypes\n     in the fgetpos and fsetpos routines in drvrfile.c which caused\n     problems with the Windows VC++ compiler.  (fpos_t is not \n     necessarily identical to off_t)\n\n   - fixed a typo in the fits_get_url function in group.c which \n     caused problems when determining the relative URL to a compressed\n     FITS file.\n\n   - included fitsio.h in the shared memory utility program,\n     smem.c, in order to define OFF_T. \n\n   - fixed typo in the datatype of 'nullvalue' in ffgsvi, which caused\n     attempts to read subsections of a short integer tiled compressed\n     image to fail with a bus error.    \n\n   - fixed bug in ffdkey which sometimes worked incorrectly if one \n     tried to delete a nonexistent keyword beyond the end of the header.\n\n   - fixed problem in fits_select_image_section when it writes a dummy\n     value to the last pixel of the section.  If the image contains\n     scaled integer pixels, then in some cases the pixel value could end\n     up out of range.\n\n   - fixed obscure bug in the ffpcn_ family of routines which gave\n     a floating exception when trying to write zero number of pixels to\n     a zero length array  (why would anyone do this?)\n\nVersion 2.200 - 26 Jan 2001\n\n  Enhancements\n\n   - updated the region filtering code to support the latest region\n     file formats that are generated by the POW, SAOtng and ds9\n     programs.  Region positions may now be given in HH:MM:SS.s,\n     DD:MM:SS.s format, and region sizes may be given arcsec or arcmin\n     instead of only in pixel units.  Also changed the logic so that if\n     multiple 'include' regions are specified in the region file, they\n     are ORed together, instead of ANDed, so that the filtering keeps\n     points that are located within any of the 'include' regions, not\n     just the intersection of the regions.\n\n   - added support for reading raw binary data arrays by converting\n     them on the fly into virtual FITS files.\n\n   - modified ffpmsg, which writes error messages to CFITSIO's internal\n     error stack, so that messages > 80 characters long will be wrapped\n     around into multiple 80 character messages, instead of just\n     being truncated at 80 characters.\n\n   - modified the CFITSIO parser so that expression which involve\n     scaled integer columns get cast to double rather than int.\n\n   - Modified the keyword template parsing routine, ffgthd, to\n     support the HIERARCH keyword.\n\n   - modified ffainit and ffbinit so that they don't unnecessarily\n     allocate 0 bytes of memory if there are no columns (TFIELDS = 0)\n     in the table that is being opened.\n\n   - modified fitsio2.h to support NetBSD on Alpha OSF platforms\n     (NetBSD does not define the '__unix__' symbol).\n\n   - changed the way OFF_T is defined in fitsio.h for greater\n     portability.\n\n   - changed drvrsmem.c so it is compiled only when HAVE_SHMEM_SERVICES\n     is defined in order to removed the conditional logic from the Makefile\n\n   - reorganized the CFITSIO User's guide to make it\n     clearer and easier for new users to learn the basic routines.\n\n   - fixed ffhdef (which reserves space for more header keywords) so\n     that is also updates the start position of the next HDU.  This\n     affected the offset values returned by ffghof.\n\nVersion 2.100 - 18 Oct 2000\n\n  Enhancements\n\n   - made substantial modification to the code to support Large files,\n     i.e., files larger than 2**31 bytes = 2.1GB.  FITS files up to\n     6 terabytes in size may now be read and written on platforms\n     that support Large files (currently only Solaris).\n\n   - modified ffpcom and ffphis, which write COMMENT and HISTORY \n     keywords, respectively, so that they now use columns 9 - 80, \n     instead of only columns 11 - 80.  Previously, these routines\n     avoided using columns 9 and 10, but this is was unnecessarily\n     restrictive.\n\n   - modified ffdhdu so that instead of refusing to delete the \n     primary array, it will replace the current primary array \n     with a null primary array containing the bare minimum of\n     required keywords and no data.\n\n  New Routines\n\n   - fits_read_pix, fits_read_pixnull, fits_read_subset, and fits_write_pix\n     routines were added to enable reading and writing of Large images,\n     with more than 2.1e9 pixels.  These new routines are now recommended\n     as the basic routines for reading and writing all images.\n\n   - fits_get_hduoff returns the byte offset in the file to\n     the start and end of the current HDU.  This routine replaces the\n     now obsolete fits_get_hduaddr routine;  it uses 'off_t' instead of\n     'long' as the datatype of the arguments and can support offsets\n     in files greater than 2.1GB in size.\n\n  Bug fixes:\n\n   - fixed bug in fits_select_image_section that caused an integer\n     overflow when reading very large image sections (bigger than\n     8192 x 8192 4-byte pixels).\n\n   - improved ffptbb, the low-level table writing routine, so that \n     it will insert additional rows in the table if the table is\n     not already big enough.  Previously it would have just over-\n     written any HDUs following the table in the FITS file.\n\n   - fixed a bug in the  fits_write_col_bit/ffpclx routine which\n     could not write to a bit 'X' column if that was the first column\n     in the table to be written to.  This bug would not appear if\n     any other datatype column was written to first.\n\n   - non-sensible (but still formally legal) binary table TFORM values\n     such as '8A15', or '1A8' or 'A8' would confuse CFITSIO and cause it\n     to return a 308 error.  When parsing the TFORMn = 'rAw' value,\n     the ffbnfm routine has been modified to ignore the 'w' value in cases \n     where w > r.\n\n   - fixed bug in the blsearch routine in iraffits.c which sometimes\n     caused an out-of-bounds string pointer to be returned when searching\n     for blank space in the header just before the 'END' keyword.\n\n   - fixed minor problem in ffgtcr in group.c, which sometimes failed\n     while trying to move to the end of file before appending a\n     grouping table.\n\n   - on Solaris, with Sun CC 5.0, one must check for '__unix' rather\n     than '__unix__' or 'unix' as it's symbol.  Needed to modify this\n     in drvrfile.c in 3 places.\n\n   - in ffextn, the FITS file would be left open if the named\n     extension doesn't exist, thus preventing the file from being\n     opened again later with write access.\n\n   - fixed bug in ffiimg that would cause attempts to insert a new\n     image extension following a table extension, and in front of any\n     other type of extension, to fail.\n\nVersion 2.037 - 6 July 2000\n\n  Enhancements\n\n   - added support in the extended filename syntax for flipping\n     an image along any axis either by specifying a starting \n     section pixel number greater than the ending pixel number,\n     or by using '-*' to flip the whole axis.  Examples:\n     \"myfile.fits[1:100, 50:10]\" or \"myfile.fits[-*,*]\".\n\n   - when reading a section of an image with the extended filename\n     syntax (e.g. image.fits[1:100:2, 1:100:2), any CDi_j WCS keywords\n     will be updated if necessary to transfer the world coordinate\n     system from the input image to the output image section.\n\n   - on UNIX platforms, added support for filenames that begin\n     with \"~/\" or \"~user/\".  The \"~\" symbol will get expanded\n     into a string that gives the user's home directory.\n\n   - changed the filename parser to support disk file names that\n     begin with a minus sign.  Previously, the leading minus sign would\n     cause CFITSIO to try to read/write the file from/to stdin/stdout.\n\n   - modified the general fits_update_key routine, which writes\n     or updates a keyword value, to use the 'G' display format\n     instead of the 'E' format for floating point keyword values.\n     This will eliminate trailing zeros from appearing in the value.\n\n   - added support for the \"-CAR\" celestial coordinate projection\n     in the ffwldp and ffxypx routines.  The \"-CAR\" projection is\n     the default simplest possible linear projection.\n\n   - added new fits_create_memfile/ffimem routine to create a new\n     fits file at a designated memory location.\n\n   - ported f77_wrap.h and f77_wrap1.c so that the Fortran interface\n     wrappers work correctly on 64-bit SGI operating systems.  In this\n     environment, C 'long's  are 8-bytes long, but Fortran 'integers'\n     are still only 4-bytes long, so the words have to be converted\n     by the wrappers.\n\n   - minor modification to cfortran.h to automatically detect when it\n     is running on a linux platform, and then define f2cFortran in that\n     case.  This eliminates the need to define -Df2cFortran on the\n     command line.\n\n   - modified group.c to support multiple \"/\" characters in\n     the path name of the file to be opened/created.\n\n   - minor modifications to the parser (eval.y, eval_f.c, eval_y.c)\n     to a) add the unary '+' operator, and b) support copying the\n     TDIMn keyword from the input to the output image under certain\n     circumstances.\n\n   - modified the lexical parser in eval_l.y and eval_l.c to\n     support #NULL and #SNULL constants which act to set the\n     value to Null.  Support was also added for the C-conditional\n     expression: 'Boolean ? trueVal : falseVal'.\n\n   - small modification to eval_f.c to write an error message to\n     the error stack if numerical overflow occurs when evaluating\n     an expression.\n\n   - configure and configure.in now support the egcs g77 compiler\n     on Linux platforms.\n\n  Bug fixes:\n\n   - fixed a significant bug when using the extended filename binning\n     syntax to generate a 2-dimensional image from a histogram of the\n     values in 2 table columns.  This bug would cause table events that\n     should have been located in the row just below the bottom row of\n     the image (and thus should have been excluded from the histogram)\n     to be instead added into the first row of the image.  Similarly,\n     the first plane of a 3-D or 4-D data cube would include the events\n     that should have been excluded as falling in the previous plane of\n     the cube.\n\n   - fixed minor bug when parsing an extended filename that contains\n     nested pairs of square brackets (e.g., '[col newcol=oldcol[9]]').\n\n   - fixed bug when reading unsigned integer values from a table or\n     image with fits_read_col_uint/ffgcvuk.  This bug only occurred on\n     systems like Digital Unix (now Tru64 Unix) in which 'long'\n     integers are 8 bytes long, and only when reading more than 7200\n     elements at a time.  This bug would generally cause the program to\n     crash with a segmentation fault.\n\n   - modified ffgcpr to update 'heapstart' as well as 'numrows' when\n     writing more rows beyond the end of the table.  heapstart\n     is needed to calculate if more space needs to be inserted in the\n     table when inserting columns into the table.\n\n   - modified fficls (insert column), ffmvec, ffdrow and ffdcol to \n     not use the value of the NAXIS2 keyword as the number of rows\n     in the table, and instead use the value that is stored in\n     an internal structure, because the keyword value may not\n     be up to date.\n\n   - Fixed bug in the iterator function that affected the handling\n     of null values in string columns in ASCII and binary tables.\n\n   - Reading a subsample of pixels in very large images, (e.g., \n     file = myfile.fits[1:10000:10,1:10000:10],  could cause a\n     long integer overflow (value > 2**31) in the computation of the\n     starting byte offset in the file, and cause a return error status\n     = 304 (negative byte address).  This was fixed by changing the\n     order of the arithmetic operations in calculating the value of\n     'readptr' in the ffgcli, ffgclj, ffgcle, ffgcld, etc. routines.\n\n   - In version 2.031, a fix to prevent compressed files from being\n     opened with write privilege was implemented incorrectly.  The fix\n     was intended to not allow a compressed FITS file to be opened\n     except when a local uncompressed copy of the file is being\n     produced (then the copy is opened with write access), but in fact\n     the opposite behavior occurred:  Compressed files could be opened\n     with write access, EXCEPT when a local copy is produced.   This\n     has been fixed in the mem_compress_open and file_compress_open\n     routines.\n\n   - in iraffits.c, a global variable called 'val' caused multiply\n     defined symbols warning when linking cfitsio and IRAF libraries.\n     This was fixed by making 'val' a local variable within the\n     routine.\n\nVersion 2.036 - 1 Feb 2000\n\n   - added 2 new generic routines, ffgpf and ffgcf which are analogous\n     to ffgpv and ffgcv but return an array of null flag values instead\n     of setting null pixels to a reserved value.\n\n   - minor change to eval_y.c and eval.y to \"define alloca malloc\"\n     on all platforms, not just VMS.\n\n   - added support for the unsigned int datatype (TUINT) in the\n     generic ffuky routine and changed ffpky so that unsigned ints\n     are cast to double instead of long before being written to \n     the header. \n\n   - modified ffs2c so that if a null string is given as input then\n     a null FITS string (2 successive single quotes) will be returned.\n     Previously this routine would just return a string with a single\n     quote, which could cause an illegal keyword record to be written.\n\n   - The file flush operation on Windows platforms apparently\n     changes the internal file position pointer (!) in violation of the\n     C standard.  Put a patch into the file_flush routine to explicitly\n     seek back to the original file position.\n\n   - changed the name of imcomp_get_compressed_image_parms to\n     imcomp_get_compressed_image_par to not exceed the 31 character\n     limit on some compilers.\n\n   - modified the filename parser (which is used when moving to a\n     named HDU) to support EXTNAME values which contain embedded blanks.\n\n   - modified drvrnet.c to deal with ftp compressed files better so\n     that even fits files returned from cgi queries which have the wrong\n     mime types and/or wrong types of file names should still decompress.\n\n   - modified ffgics to reduce the tolerance for acceptable skewness\n     between the axes, and added a new warning return status = \n     APPROX_WCS_KEY in cases where there is significant skewness\n     between the axes.\n\n   - fixed bug in ffgics that affected cases where the first coordinate\n     axis was DEC, not RA, and the image was a mirror image of the sky.\n\n   - fixed bug in ffhist when trying to read the default binning\n     factor keyword, TDBIN.\n\n   - modified ffhist so that is correctly computes the rotation angle\n     in a 2-D image if the first histogram column has a CROTA type\n     keyword but the 2nd column does not.\n\n   - modified ffcpcl so that it preserves the comment fields on the\n     TTYPE and TFORM keywords when the column is copied to a new file.\n\n   - make small change to configure.in to support FreeBSD Linux \n     by setting CFLAGS = -Df2cFortran instead of -Dg77Fortran. Then\n     regenerated configure with autoconf 2.13 instead of 2.12.     \n\nVersion 2.035 - 7 Dec 1999 (internal release only, FTOOLS 5.0.2)\n\n   - added new routine called fits_get_keyclass/ffgkcl that returns\n     the general class of the keyword, e.g., required structural \n     keyword, WCS keyword, Comment keyword, etc.  15 classes of\n     keywords have been defined in fitsio.h\n\n   - added new routine called fits_get_img_parm/ffgipr that is similar\n     to ffgphd but it only return the bitpix, naxis, and naxisn values.\n\n   - added 3 new routines that support the long string keyword\n     convention: fits_insert_key_longstr, fits_modify_key_longstr\n     fits_update_key_longstr.\n\n   - modified ffgphd which reads image header keywords to support\n     the new experimental compressed image format.\n\n   - when opening a .Z compressed file, CFITSIO tries to allocate\n     memory equal to 3 times the file size, which may be excessive\n     in some cases.  This was changed so that if the allocation fails,\n     then CFITSIO will try again to allocate only enough memory\n     equal to 1 times the file size.  More memory will be allocated\n     later if this turns out to be too small.\n\n   - improved the error checking in the fits_insert_key routine\n     to check for illegal characters in the keyword.\n\nVersion 2.034 - 23 Nov 1999\n\n   - enhanced support for the new 'CD' matrix world coordinate system\n     keywords in the ffigics routine.  This routine has been enhanced\n     to look for the new 'CD' keywords, if present, and convert them\n     back to the old CDELTn and CROTAn values, which are then returned.  \n     The routine will also swap the WCS parameters for the 2 axes if\n     the declination-like axis is the first WCS axis.\n\n   - modified ffphbn in putkey.c to support the 'U' and 'V\" TFORM characters\n     (which represent unsigned short and unsigned int columns) in variable\n     length array columns.  (previously only supported these types in\n     fixed length columns).\n\n   - added checks when reading gzipped files to detect unexpected EOF.\n     Previously, the 'inflate_codes' routine would just sit in an infinite \n     loop if the file ended unexpectedly.\n\n   - modified fits_verify_chksum/ffvcks so that checksum keywords with\n     a blank value string are treated as undefined, the same as\n     if the keyword did not exist at all.\n\n   - fixed ffghtb and ffghbn so that they return the extname value \n     in cases where there are no columns in the table.\n\n   - fixed bug in the ffgtwcs routine (this is a little utility \n     routine to aid in interfacing to Doug Mink's WCS routines);\n     it was not correctly padding the length of string-valued keywords\n     in the returned string.\n\n   - fixed bug in 'iraffits.c' that prevented Type-2 IRAF images from\n     being correctly byte-swapped on PCs and DEC-OSF machines.\n\n   - fixed tiny memory leak in irafncmp in iraffits.c.  Only relevant when\n     reading IRAF .imh files.\n\n   - fixed a bug (introduced in version 2.027) that caused the keyword\n     reading routines to sometimes not find a matching keyword if the\n     input name template used the '*' wildcard as the last character.\n     (e.g., if input name = 'COMMENT*' then it would not find the\n     'COMMENT' keywords.  (It would have found longer keywords like\n     'COMMENTX' correctly). The fix required a minor change to ffgcrd\n     in getkey.c\n\n   - modified the routine (ffswap8) that does byteswapping of\n     double precision numbers.  Some linux systems have reported floating\n     point exceptions because they were trying to interpret the bytes\n     as a double before the bytes had been swapped.\n\n   - fixed bug in the calculation of the position of the last byte\n     in the string of bits to be read in ffgcxuk and ffgcxui.  This\n     bug generally caused no harm, but could cause the routine to\n     exit with an invalid error message about trying to read\n     beyond the size of the field.\n\n   - If a unix machine did not have '__unix__', 'unix', or  '__unix'\n     C preprocessor symbols defined, then CFITSIO would correctly open\n     one FITS file, but would not correctly open subsequent files. Instead\n     it would think that the same file was being opened multiple times.\n     This problem has only been seen on an IBM/AIX machine. The fits_path2url\n     and fits_url2path routines in group.c were modified to fix the problem.\n\n   - fixed bug in group.c, which affected WINDOWS platforms only, that \n     caused programs to go into infinite loop when trying to open\n     certain files.\n\n   - the ftrsim Fortran wrapper routine to ffrsim was not defined\n     correctly, which caused the naxis(2) value to be passed incorrectly\n     on Dec OSF machines, where sizeof(long) != sizeof(int).\n\nVersion 2.033 - 17 Sept 1999\n\n   - New Feature: enhanced the row selection parser so that comparisons\n     between values in different rows of the table are allowed, and the\n     string comparisons with <, >, <=, and >= are supported.\n\n   - added new routine the returns the name of the keyword in the\n     input keyword record string.  The name is usually the first\n     8 characters of the record, except if the HIERARCH convention\n     is being used in which case the name may be up to 67 characters\n     long.\n\n   - added new routine called fits_null_check/ffnchk that checks to\n     see if the current header contains any null (ASCII 0) characters.\n     These characters are illegal in FITS headers, but they go undetected\n     by the other CFITSIO routines that read the header keywords.\n\n   - the group.c file has been replaced with a new version as supplied\n     by the ISDC.  The changes are mainly to support partial URLs and\n     absolute URLs more robustly.  Host dependent directory paths are\n     now converted to true URLs before being read from/written to\n     grouping tables.\n\n   - modified ffnmhd slightly so that it will move to the first extension\n     in which either the EXTNAME or the HDUNAME keyword is equal to the\n     user-specified name.  Previously, it only checked for HDUNAME if\n     the EXTNAME keyword did not exist.\n\n   - made small change to drvrnet.c so that it uncompress files \n     which end in .Z and .gz just as for ftp files.\n\n   - rewrote ffcphd (copy header) to handle the case where the\n     input and output HDU are in the same physical FITS file.\n\n   - fixed bug in how long string keyword values (using the CONTINUE\n     convention) were read.  If the string keyword value ended in an\n     '&' character, then fits_read_key_longstr, fits_modify_key_str,\n     and fits_delete_key would interpret the following keyword as\n     a continuation, regardless of whether that keyword name was\n     'CONTINUE' as required by this convention.  There was also a bug\n     in that if the string keyword value was all blanks, then \n     fits_modify_key_str could in certain unusual cases think\n     that the keyword ended in an '&' and go into an infinite loop.\n\n   - modified ffgpv so that it calls the higher level ffgpv_ routine\n     rather than directly calling the lower level ffgcl_ routine. This\n     change is needed to eventually support reading compressed images.\n\n   - added 3 new routines to get the image datatype, image dimensions,\n     and image axes length.  These support the case where the image is\n     compressed and stored in a binary table.\n\n   - fixed bug in ffiblk that could sometimes cause it to insert a\n     new block in a file somewhere in the middle of the data, instead\n     of at the end of the HDU.  This fortunately is a rare problem,\n     mainly only occurring in certain cases when  inserting rows in a binary \n     table that contains variable length array data (i.e., has a heap).\n\n   - modified fits_write_tdim so that it double checks the TFORMn\n     value directly if the column repeat count stored in the internal\n     structure is not equal to the product of all the dimensions.\n\n   - fixed bug that prevented ffitab or ffibin from inserting a new\n     table after a null primary array (can't read NAXIS2 keyword).\n     Required a small change to ffrdef.\n\n   - modified testprog.c so that it will continue to run even if\n     it cannot open or process the template file testprog.tpt.\n\n   - modified the logic in lines 1182-1185 of grparser.c so that\n     it returns the correct status value in case of an error.\n\n   - added test in fitsio2.h to see if __sparcv9 is defined; this\n     identifies a machine running Solaris 7 in 64-bit mode where\n     long integers are 64 bits long.\n\nVersion 2.032 - 25 May 1999\n\n   - the distribution .tar file was changed so that all the files\n     will be untarred into a  subdirectory by default instead of\n     into the current directory.\n\n   - modified ffclos so that it always frees the space allocated by\n     the fptr pointer, even when another fptr points to the same file.\n\n   - plugged a potential (but rare in practice) memory leak in ffpinit\n\n   - fixed bug in all the ffp3d_ and ffg3d_ routines in cases where\n     the data cube that has been allocated in memory has more planes\n     than the data cube in the FITS file.\n\n   - modified drvrsmem.c so that it allocates a small shared\n     memory segment only if CFITSIO tries to read or write a\n     FITS file in shared memory.  Previously it always allocated\n     the segment whether it was needed or not.  Also, this small\n     segment is removed if 0 shared memory segments remain in \n     the system.\n\n   - put \"static\" in front of 7 DECLARE macros in compress.c\n     because these global variables were causing conflicts with other\n     applications programs that had variables with the same names.\n\n   - modified ffasfm to return datatype = TDOUBLE instead of TFLOAT\n     if the ASCII table column has TFORMn = 'Ew.d' with d > 6.\n\n   - modified the column reading routines to a) print out the offending\n     entry if an error occurs when trying to read a numeric ASCII table\n     column, and b) print out the column number that had the error\n     (the messages are written to CFITSIOs error stack)\n\n   - major updates to the Fortran FITSIO User's Guide to include many\n     new functions that have been added to CFITSIO in the past year.\n\n   - modified fitsio2.h so that the test for __D_FLOAT etc. is only\n     made on Alpha VMS machines, to avoid syntax errors on some other\n     platforms.\n\n   - modified ffgthd so that it recognizes a floating point value\n     that uses the 'd' or 'D' exponent character.\n\n   - removed the range check in fftm2s that returned an error if\n     'decimals' was less than zero.  A negative value is OK and is\n     used to return only the date and not the time in the string.\n\nVersion 2.031 - 31 Mar 1999\n\n   - moved the code that updates the NAXIS2 and PCOUNT keywords from\n     ffchdu into the lower lever ffrdef routine.  This ensures that\n     other routines which call ffrdef will correctly update these 2\n     keywords if required.  Otherwise, for instance, calling \n     fits_write_checksum before closing the HDU could cause the NAXIS2\n     keyword (number of rows in the table) to not be updated.\n\n   - fixed bug (introduced in version 2.030) when writing null values\n     to a primary array or image extension.  If trying to set more\n     than 1 pixel to null at a time, then typically only 1 null would\n     be written.  Also fixed related bug when writing null values to\n     rows in a table that are beyond the currently defined size of the\n     table (the size of the table was not being expanded properly).\n\n   - enhanced the extended filename parser to support '*' in image\n     section specifiers, to mean use the whole range of the axis.\n     myfile.fits[*,1:100] means use the whole range of the first\n     axis and pixels 1 to 100 in the second axis.  Also supports\n     an increment, as in myfile.fits[*:2, *:2] to use just the\n     odd numbered rows and columns.\n\n   - modified fitscore.c to set the initial max size of the header, when\n     first reading it, to the current size of the file, rather than to \n     2 x 10**9 to avoid rare cases where CFITSIO ends up writing a huge \n     file to disk.\n\n   - modified file_compress_open so that it will not allow a compressed\n     FITS file to be opened with write access.  Otherwise, a program\n     could write to the temporary copy of the uncompressed file, but\n     the modification would be lost when the program exits.\n\nVersion 2.030 - 24 Feb 1999\n\n   - fixed bug in ffpclu when trying to write a null value to a row\n     beyond the current size of the table (wouldn't append new rows\n     like it should).\n\n   - major new feature:  enhanced the routines that read ASCII string\n     columns in tables so that they can read any table column, including\n     logical and numeric valued columns.  The column values are returned\n     as a formatted string.  The format is determined by the TDISPn\n     keyword if present, otherwise a default format based on the\n     datatype of the column is used.\n\n  -  new routine:  fits_get_col_display_width/ffgcdw returns the length\n     of the formatted strings that will be returned by the routines that\n     read table columns as strings. \n\n   - major new feature:  added support for specifying an 'image section'\n     when opening an image:  e.g,  myfile.fits[1:512:2,2:512:2] to \n     open a 256x256 pixel image consisting of the odd columns and the \n     even numbered rows of the input image.\n\n   - added supporting project files and instructions for building \n     CFITSIO under Windows NT with the Microsoft Visual C++ compiler.\n\n   - changed the variable 'template' to 'templt' in testprog.c since\n     it conflicted with a reserved word on some compilers.\n\n   - modified group.c to conditionally include sys/stat.h only on\n     unix platforms\n\n   - fixed bug in the ffiter iterator function that caused it to always\n     pass 'firstn' = 1 to the work function when reading from the\n     primary array or IMAGE extension. It worked correctly for tables.\n\n   - fixed bug in the template header keyword parser (ffgthd) in cases\n     where the input template line contains a logical valued keyword\n     (T or F) without any following comment string.  It was previously\n     interpreting this as a string-valued keyword.\n\n   - modified ffrhdu that reads and opens a new HDU, so that it\n     ignores any leading blank characters in the XTENSION name, e.g.,\n     XTENSION= '  BINTABLE' will not cause any errors, even though\n     this technically violates the FITS Standard.\n\n   - modified ffgtbp that reads the required table keywords to make\n     it more lenient and not exit with an error if the THEAP keyword\n     in binary tables cannot be read as an integer.  Now it will\n     simply ignore this keyword if it cannot be read.\n\n   - added test for 'WIN32' as well as '__WIN32__' in fitsio2.h,\n     eval.l and eval_l.c in a preprocessor statement.\n\n   - changed definition of strcasecmp and strncasecmp in fitsio2.h,\n     eval.l and eval_l.c to conform to the function prototypes under\n     the Alpha VMS v7.1 compiler.\n\n   - corrected the long function names in longnam.h for the new WCS \n     utility functions in wcssubs.c\n\nVersion 2.029 - 11 Feb 1999\n\n   - fixed bug in the way NANs and underflows were being detected on\n     VAX and Alpha VMS machines.\n\n   - enhanced the filename parser to distinguish between a VMS-style\n     directory name (e.g.  disk:[directory]myfile.fits) and a CFITSIO\n     filter specifier at the end of the name.\n\n   - modified ffgthd to support the HIERARCH convention for keyword\n     names that are longer than 8 characters or contain characters\n     that would be illegal in standard FITS keyword names.\n\n   - modified the include statements in grparser.c so that malloc.h \n     and memory.h are only included on the few platforms that really\n     need them.\n\n   - modified the file_read routine in drvrfile.c to ignore the last\n     record in the FITS file it it only contains a single character that\n     is equal to 0, 10 or 32.  Text editors sometimes append a character\n     like this to the end of the file, so CFITSIO will ignore it and\n     treat it as if it had reached the end of file.\n\n   - minor modifications to fitsio.h to help support the ROOT environment.\n\n   - installed new version of group.c and group.h; the main change\n     is to support relative paths (e.g.  \"../filename\") in the URLs\n\n   - modified the histogramming routines so that it looks for the\n     default preferred column axes in a keyword of the form\n     CPREF = 'Xcol, Ycol'\n     instead of separate keywords of the form\n     CPREF1 = 'Xcol'\n     CPREF2 = 'Ycol'\n\n   - fixed bug so that if the binning spec is just a single integer,\n     as in  [bin 4] then this will be interpreted as meaning to make\n     a 2D histogram using the preferred or default axes, with the\n     integer taken as the binning factor in both axes.\n\nVersion 2.028 - 27 Jan 1999\n\n   - if the TNULLn keyword value was outside the range of a 'I' or 'B'\n     column, an overflow would occur when setting the short or char \n     to the TNULLn value, leading to incorrect values being flagged as\n     being undefined.  This has been fixed so that CFITSIO will ignore\n     TNULLn values that are beyond the range of the column data type.\n\n   - changed a few instances of the string {\"\\0\"} to {'\\0'} in the\n     file groups.c\n\n   - installed new version of the grparser.c file from the ISDC\n\n   - added new WCS support routines (in wcssub.c) which make it easier\n     to call Doug Mink's WCSlib routines for converting between plate\n     and sky coordinates.   The CFITSIO routines themselves never\n     call a WCSlib routine, so CFITSIO is not dependent on WCSlib.\n\n   - modified  ffopen so that if you use the extended filename\n     syntax to both select rows in a table and then bin columns into\n     a histogram, then CFITSIO will simply construct an array listing\n     the good row numbers to be used when making the histogram,\n     instead of making a whole new temporary FITS file containing\n     the selected rows.\n\n   - modified ffgphd which parses the primary array header keywords\n     when opening a file, to not choke on minor format errors in \n     optional keywords.  Otherwise, this prevents CFITSIO from\n     even opening the file.\n\n   - changed a few more variable declarations in compress.c from global\n     to static.\n\nVersion 2.027 - 12 Jan 1999\n\n   - modified the usage of the output filename specifier so that it,\n       a) gives the name of the binned image, if specified, else,\n       b) gives the name of column filtered and/or row filtered table, if \n          specified, else\n       c) is the name for a local copy of the ftp or http file, else,\n       d) is the name for the local uncompressed version of the compressed\n          FITS file, else,\n       e) the output filename is ignored.\n\n   - fixed minor bug in ffcmps, when comparing 2 strings while using\n     a '*' wild card character.\n\n   - fixed bug in ftgthd that affected cases where the template string\n     started with a minus sign and contained 2 tokens (to rename a\n     keyword).\n\n   - added support for the HIERARCH keyword convention for reading \n     and writing keywords longer than 8 characters or that contain\n     ASCII characters not allowed in normal FITS keywords. \n\n   - modified the extended filename syntax to support opening images\n     that are contained in a single cell of a binary table with syntax:\n     filename.fits[extname; col_name(row_expression)]\n\nVersion 2.026 - 23 Dec 1998\n\n   - modified the group parser to:\n     a) support CFITSIO_INCLUDE_FILES environment variable, which can\n     point to the location of template files, and, \n     b) the FITS file parameter passed to the parser no longer has to point\n     to an empty file.  If there are already HDUs in the file, then the\n     parser appends new HDUs to the end of the file.\n\n   - make a small change to the drvrnet.c file to accommodate creating\n     a static version of the CFITSIO library.\n\n   - added 2 new routines to read consecutive bits as an unsigned integer \n     from a Bit 'X' or Byte 'B' column (ffgcxui and ffgcxuk).\n\n   - modified the logic for determining histogram boundaries in ffhisto\n     to add one more bin by default, to catch values that are right on\n     the upper boundary of the histogram, or are in the last partial bin.\n\n   - modified cfitsio2.h to support the new Solaris 7 64-bit mode operating\n     system.\n\n   - Add utility routine, CFits2Unit, to the Fortran wrappers which searches\n     the gFitsFiles array for a fptr, returning its element (Fortran unit\n     number), or allocating a new element if one doesn't already\n     exists... for C calling Fortran calling CFITSIO.\n\n   - modified configure so that it does not use the compiler optimizer\n     when using gcc 2.8.x on Linux\n\n   - (re)added the fitsio.* documentation files that describe the\n     Fortran-callable FITSIO interface to the C routines.\n\n   - modified the lexical parser in eval_f.c to fix bug in null detections\n     and bug in ffsrow when nrows = 0.\n\n   - modified ffcalc so that it creates a TNULLn keyword if appropriate \n     when a new column is created.  Also fixed detection of OVERFLOWs\n     so that it ignores null values.\n\n   - added hyperbolic trig and rounding functions to\n     the lexical parser in the eval* files.\n\n   - improved error message that gets written when the group number is\n     out of range when reading a 'random groups' array.\n\n   - added description of shared memory, grouping, and template parsing\n     error messages to ffgerr and to the User's Guide.  Moved the error\n     code definitions from drvsmem.h to fitsio.h.\n\n   - modified grparser.c to compile correctly on Alpha/OSF machines\n\n   - modified drvrnet.c to eliminate compiler warnings\n\n   - Modified Makefile.in to include targets for building all the sample\n     programs that are included with CFITSIO.\n\nVersion 2.025 - 1 Dec 1998\n\n   - modified ffgphd and ffgtbp so that they ignores BLANK and TNULLn keywords\n     that  do not have a valid integer value.  Also, any error while reading\n     the BSCALE, BZERO, TSCALn, or TZEROn keywords will be ignored.  \n     Previously, CFITSIO would have simply refused to read an HDU that had \n     such an invalid keyword.\n\n   - modified the parser in eval_f.c to accept out of order times in GTIs\n\n   - updated cfitsio_mac.sit.hqx to fix bad target parameters for Mac's\n     speed test program\n\n   - modified template parser in grparser.c to: 1) not write GRPNAME keyword\n     twice, and 2) assign correct value for EXTVERS keyword.\n\n   - fixed minor bugs in group.c; mainly would only affect users of the\n     INTEGRAL Data Access Layer.\n\n   - temporarily removed the prototype for ffiwcs from fitsio.h until\n     full WCS support is added to CFITSIO in the near future.\n\n   - modified the HTTP driver to send a User-Agent string:\n     HEASARC/CFITSIO/<version number>\n\n   - declared local variables in compress.c as 'static' to avoid\n     conflicts with other libraries.\n\nVersion 2.024 - 9 Nov 1998\n\n   - added new function fits_url_type which returns the driver prefix string\n     associated with a particular FITS file pointer.\n\nVersion 2.023 - 1 Nov 1998 - first full release of CFITSIO 2.0\n\n   - slightly modified the way real keyword values are formatted, to ensure\n     that it includes a decimal point.  E.g.,  '1.0E-09' instead of '1E-09'\n\n   - added new function to support template files when creating new FITS files.\n\n   - support the TCROTn WCS keyword in tables, when reading the WCS keywords.\n\n   - modified the iterator to support null values in logical columns in\n     binary tables.\n\n   - fixed bug in iterator to support null values in integer columns in\n     ASCII tables.\n\n   - changed the values for FLOATNULLVALUE and DOUBLENULLVALUE to make them\n     less likely to duplicate actual values in the data.\n\n   - fixed major bug when freeing memory in the iterator function.  It caused\n     mysterious crashes on a few platforms, but had no effect on most others.\n\n   - added support for reading IRAF format image (.imh files)\n\n   - added more error checking to return an error if the size of the FITS\n     file exceeds the largest value of a long integer (2.1 GB on 32-bit\n     platforms).\n\n   - CFITSIO now will automatically insert space for additional table rows\n     or add space to the data heap, if one writes beyond the current end\n     of the table or heap.  This prevents any HDUs which might follow\n     the current HDU from being overwritten.  It is thus no longer necessary\n     to explicitly call fits_insert_rows before writing new rows of data\n     to the FITS file.\n\n   - CFITSIO now automatically keeps track of the number of rows that have\n     been written to a FITS table, and updates the NAXIS2 keyword accordingly\n     when the table is closed.  It is no longer necessary for the application\n     program to updated NAXIS2.  \n\n   - When reading from a FITS table, CFITSIO will now return an error if the\n     application tries to read beyond the end of the table. \n\n   - added 2 routines to get the number of rows or columns in a table.\n\n   - improved the undocumented feature that allows a '20A' column to be\n     read as though it were a '20B' column by fits_read_col_byt.  \n\n   - added overflow error checking when reading keywords.  Previously, the\n     returned value could be silently truncated to the maximum allowed value\n     for that data type.  Now an error status is returned whenever an \n     overflow occurs.\n\n   - added new set of routines dealing with hierarchical groups of files.\n     These were provided by Don Jennings of the INTEGRAL Science Data Center.\n\n   - added new URL parsing routines.\n\n   - changed the calling sequence to ffghad (get HDU address) from\n     ffghad(fitsfile *fptr, > long *headstart, long *dataend) to\n     ffghad(fitsfile *fptr, > long *headstart, long datastart, \n            long *dataend, int *status) \n\n   - major modification to support opening the same FITS file more\n     than once.  Now one can open the same file multiple times and\n     read and write simultaneously to different HDUs within the file.\n     fits_open_file automatically detects if the file is already opened.\n\n   - added the ability to clobber/overwrite an existing file\n     with the same name when creating a new output file.  Just\n     precede the output file name with '!' (an exclamation mark)\n\n   - changed the ffpdat routine which writes the DATE keyword\n     to use the new 'YYYY-MM-DDThh:mm:ss' format.\n\n   - added several new routines to create or parse the new date/time\n     format string.\n\n   - changed ifdef for DECFortran in f77_wrap.h and f77_wrap1.c:\n     expanded to recognize Linux/Alpha\n\n   - added new lexical parsing routines (from Peter Wilson):\n     eval_l.c, eval_y.c, eval_f.c, eval_defs.h, and eval_tab.h.\n     These are used when doing on-the-fly table row selections.\n\n   - added new family of routines to support reading and writing\n     'unsigned int' data type values in keywords, images or tables.\n\n   - restructured all the putcol and getcol routines to provide\n     simpler and more robust support for machines which have\n     sizeof(long) = 8.  Defined a new datatype INT32BIT which is\n     always 32 bits long (platform independent) and is used internally\n     in CFITSIO when reading or writing BITPIX = 32 images or 'J'\n     columns.  This eliminated the need for specialize routines like\n     ffswaplong, ffunswaplong, and ffpacklong.\n\n   - overhauled cfileio.c (and other files) to use loadable drivers for\n     doing data I/O to different devices.  Now CFITSIO support network \n     access to ftp:// and http:// files, and to shared memory files.\n\n   - removed the ffsmem routine and replaced it with ffomem.  This will\n     only affect software that reads an existing file in core memory.\n     (written there by some other process).\n\n   - modified all the ffgkn[] routines (get an array of keywords) so\n     that the 'nfound' parameter is = the number of keywords returned,\n     not the highest index value on the returned keywords.  This makes\n     no difference if the starting index value to look for = 1.\n     This change is not backward compatible with previous versions\n     of CFITSIO, but is the way that FITSIO behaved.\n\n   - added new error code = 1 for any application error external\n     to CFITSIO.  Also reports \"unknown error status\" if the\n     value doesn't match a known CFITSIO error.\n\nVersion 1.42 - 30 April 1998 (included in FTOOLS 4.1 release)\n\n   - modified the routines which read a FITS float values into\n     a float array, or read FITS double values into a double array,\n     so that the array value is also explicitly set in addition\n     to setting the array of flag values, if the FITS value is a NaN.\n     This ensures that no NaN values get passed back to the calling\n     program, which can cause serious problems on some platforms (OSF).\n\n   - added calls to ffrdef at the beginning of the insert\n     or delete rows or columns routines in editcol.c to make sure\n     that CFITSIO has correctly initialized the HDU information.\n\n   - added new routine ffdrws to delete a list of rows in a table\n\n   - added ffcphd to copy the header keywords from one hdu to another\n\n   - made the anynul parameter in the ffgcl* routines optional\n     by first checking to see if the pointer is not null before\n     initializing it.\n\n   - modified ffbinit and ffainit to ignore minor format\n     errors in header keywords so that cfitsio can at least\n     move to an extension that contains illegal keywords.\n\n   - modified all the ffgcl* routines to simply return without\n     error if nelem = 0.\n\n   - added check to ffclose to check the validity of the fitsfile\n     pointer before closing it.  This should prevent program crashes\n     when someone tries to close the same file more than once.\n\n   - replaced calls to strcmp and strncmp with macros FSTRCMP and\n     FSTRNCMP in a few places to improve performance when reading\n     header keywords (suggested by Mike Noble)\n\n  Bug Fixes:\n\n   - fixed typo in macro definition of error 504 in the file fitsio.h.\n\n   - in ffopen, reserved space for 4 more characters in the input\n     file name in case a '.zip' suffix needs to be added.\n\n   - small changes to ffpclx to fix problems when writing bit (X) data\n     columns beyond the current end of file.\n\n   - fixed small bug in ffcrhd where a dummy pointer was not initialized\n\n   - initialized the dummy variable in ffgcfe and ffgcfd which\n     was causing crashes under OSF in some cases.\n\n   - increased the length of the allocated string ffgkls by 2\n     to support the case of reading a numeric keyword as a string\n     which doesn't have the enclosing quote characters.\n\nVersion 1.4 - 6 Feb 1998 \n\n   - major restructuring of the CFITSIO User's Guide\n\n   - added the new 'iterator' function.  The fortran wrapper is\n     in f77_iter.c for now.\n\n   - enhanced ffcrtb so that it writes a dummy primary array\n     if none currently exists before appending the table.\n\n   - removed the ffgcl routine and replaced it with ffgcvl \n\n   - modified ffpcnl to just take a single input null value instead\n     of an entire array of null value flags.\n\n   - modified ffcmps and ffgnxk so that, for example, the string 'rate' \n     is not considered a match to the string 'rate2', and 'rate*'\n     is a match to the string 'rate'.\n\n   - modified ffgrsz to also work with images, in which case\n     it returns the optimum number of pixels to process at\n     one time.\n\n   - modified ffgthd to support null valued keywords\n\n   - added a new source file 'f77_wrap.c' that includes all the\n     Fortran77 wrapper routines for calling CFITSIO.  This will\n     eventually replace the Fortran FITSIO library.\n\n   - added new routines:\n     ffppn - generic write primary array with null values\n     ffpprn - write null values to primary array\n\n     ffuky - 'update' a keyword value, with any specified datatype.\n\n     ffrprt - write out report of error status and error messages\n     ffiter - apply a user function iteratively to all the rows of a table\n     ffpkyc - write complex-valued keyword\n     ffpkym - write double complex-valued keyword\n     ffpkfc - write complex-valued keyword in fixed format\n     ffpkfm - write double complex-valued keyword in fixed format\n\n     ffgkyc - read complex-valued keyword\n     ffgkym - read double complex-valued keyword\n\n     ffmkyc - modify complex-valued keyword\n     ffmkym - modify double complex-valued keyword\n     ffmkfc - modify complex-valued keyword in fixed format\n     ffmkfm - modify double complex-valued keyword in fixed format\n\n     ffukyc - update complex-valued keyword\n     ffukym - update double complex-valued keyword\n     ffukfc - update complex-valued keyword in fixed format\n     ffukfm - update double complex-valued keyword in fixed format\n\n     ffikyc - insert complex-valued keyword\n     ffikym - insert double complex-valued keyword\n     ffikfc - insert complex-valued keyword in fixed format\n     ffikfm - insert double complex-valued keyword in fixed format\n\n     ffpktp - write or modify keywords using ASCII template file\n     ffcpcl - copy a column from one table to another\n     ffcpky - copy an indexed keyword from one HDU to another\n     ffpcnl - write logical values, including nulls, to binary table\n     ffpcns - write string values,  including nulls, to table\n     ffmnhd - move to HDU with given exttype, EXTNAME and EXTVERS values\n     ffthdu - return the total number of HDUs in the file\n     ffghdt - return the type of the  CHDU\n     ffflnm - return the name of the open FITS file\n     ffflmd - return the mode of the file (READONLY or READWRITE)\n\n   - modified ffmahd and ffmrhd (to move to a new extension) so that\n     a null pointer may be given for the returned HDUTYPE argument.\n\n   - worked around a bug in the Mac CWpro2 compiler by changing all\n     the statements like \"#if BYTESWAPPED == TRUE\" to \"if BYTESWAPPED\".\n\n   - modified ffitab (insert new ASCII table) to allow tables with\n     zero number of columns\n\n   - modified Makefile.in and configure to define the -Dg77Fortran\n     CFLAGS variable on Linux platforms.  This is needed to \n     compile the new f77_wrap.c file (which includes cfortran.h)\n\n  Bug Fixes:\n\n   - fixed small bug in ffgrz (get optimum row size) which sometimes\n     caused it to return slightly less than the maximum optimum size.\n     This bug would have done no harm to application programs.\n\n   - fixed bug in ffpclk and ffgclk to add an 'else' case\n     if size of int is not equal to size of short or size of long.\n\n   - added test to ffgkls to check if the input string is not null before\n     allocating memory for it.\n\nVersion 1.32 - 21 November 1997 (internal release only)\n\n   - fixed bug in the memory deallocation (free) statements\n     in the ffopen routine in the cfileio.c file.\n\n   - modified ffgphd to tolerate minor violations of the FITS \n     standard in the format of the XTENSION = 'IMAGE   '\n     keyword when reading FITS files.  Extra trailing spaces\n     are now allowed in the keyword value.  (FITS standard\n     will be changed so that this is not a violation).\n\nVersion 1.31 - 4 November 1997 (internal release only)\n\n  Enhancements:\n\n   - added support for directly reading compressed FITS files\n     by copying the algorithms from the gzip program. This \n     supports the Unix compress, gzip and pkzip algorithms.\n\n   - modified ffiimg, ffitab, and ffibin (insert HDUs into\n     a FITS file) so that if the inserted HDU is at the end of\n     the FITS file, then it simply appends a new empty HDU\n     and writes the required keywords.  This allows space\n     to be reserved for additional keywords in the header\n     if desired.\n\n   - added the ffchfl and ffcdfl routines to check the header and\n     data fill values, for compatibility with the Fortran FITSIO\n     library.\n\n   - added the ffgsdt routine to return the system date\n     for compatibility with the Fortran FITSIO library.\n\n   - added a diagnostic error message (written to the error stack)\n     if the routines that read data from image or column fail.\n\n   - modified ffgclb so that it simply copies the bytes from \n     an ASCII 'nA' or 'An' format column into the user's byte\n     array.  Previously, CFITSIO would return an error when \n     trying to read an 'A' column with ffgclb.\n\n   - modified ffpclb so that it simply copies the input array \n     of bytes to an ASCII 'nA' or 'An' format column.\n     Previously, CFITSIO would return an error when \n     trying to write to an 'A' column with ffpclb.\n\n  Bug Fixes:\n\n   - ffgkls was allocating one too few bytes when reading continued\n     string keyword values. \n\n   - in testprog.c added code to properly free the memory that\n     had been allocated for string arrays.\n\n   - corrected typographical errors in the User's Guide.\n\nVersion 1.30 - 11 September 1997\n\n   - major overhaul to support reading and writing FITS files\n     in memory.   The new routines fits_set_mem_buff and \n     fits_write_mem_buff have been added to initialize and\n     copy out the memory buffer, respectively.\n\n   - added support for reading FITS files piped in on 'stdin'\n     and piped out on 'stdout'.  Just specify the file name as '-'\n     when opening or creating the FITS file.\n\n   - added support for 64-bit SGI IRIX machines.  This required\n     adding routines to pack and unpack 32-bit integers into\n     64-bit integers.\n\n   - cleaned up the code that supports G_FLOAT and IEEE_FLOAT\n     on Alpha VMS systems.  Now, the type of float is determined\n     at compile time, not run time.\n\n  Bug Fixes:\n\n   - replaced the malloc calls in the error message stack routines\n     with a static fixed size array.  The malloc's cause more\n     problems than they solved, and were prone to cause memory\n     leaks if users don't clear the error message stack when\n     closing the FITS file.\n\n   - when writing float or double keywords, test that the value\n     is not a special IEEE value such as a NaN.  Some\n     compilers would write the string 'NaN' in this case into\n     the output value string.\n\n   - fixed bug in ffiblk, to ignore EOF status return if it is\n     inserting blocks at the end of the file.\n\n   - removed the 'l' from printf format string that is constructed\n     in the ffcfmt routine.  This 'l' is non-standard and causes problems\n     with the Metrowerks compiler on a Mac.\n\n   - the default null value in images was mistakenly being set\n     equal to NO_NULL = 314, rather than NULL_UNDEFINED = 1234554321\n     in the ffgphd routine.\n\n   - check status value in ffgkls to make sure the keyword exists\n     before allocating memory for the value string.\n\n   - fixed the support for writing and reading unsigned long integer\n     keyword values in ffpky and ffgky by internally treating\n     the values as doubles.  This required changes to ffc2r and\n     ffc2d as well.\n\n   - added explicit cast to 'double' in one place in putcolb.c and\n     6 places in pubcolui.c, to get rid of warning messages issued\n     by one compiler.\n\n   - in ffbinit and ffainit, it is necessary to test that tfield > 0\n     before trying to allocate memory with calloc.  Otherwise, some\n     compilers return a null pointer which CFITSIO interprets to \n     mean the memory allocation failed.\n\n   - had to explicitly cast the null buffer pointer to a char\n     pointer (cptr = (char *)buffer;) in 4 places in the buffers.c\n     file to satisfy a picky C++ compiler.\n\n   - changed the test for an ALPHA VMS system to see if\n     '__VMS' is defined, rather than 'VMS'.  The latter\n     is not defined by at least one C++ compiler.\n\n   - modified ffpcls so that it can write a null string to\n     a variable length string column, without going into\n     an infinite loop.\n\n   - fixed bug in ffgcfl that caused the 'next' variable to be\n     incremented twice.\n\n   - fixed bug in ffgcpr that caused it write 2x the number of\n     complex elements into the descriptor when writing to\n     a complex or double complex variable length array column.\n\n   - added call to ffrdef at the end of ffrsim to ensure that\n     the internal structures are updated to correspond to the\n     modified header keywords\n\nVersion 1.25 - 7 July 1997\n\n   - improved the efficiency of the ffiblk routine, when inserting\n     more than one block into the file.\n\n   - fixed bug in ffwend that in rare instances caused the beginning\n     of the following extension to be overwritten by blank fill.\n\n   - added new routine to modify the size of an existing primary\n     array or image extension: fits_resize_img/ffrsim.\n\n   - added support for null-valued keywords, e.g., keywords that\n     have no defined value.  These keywords have an equal sign and\n     space in columns 9-10, but have not value string.  Example:\n     KEYNAME =                      / null-valued keyword\n     Support for this feature required the following changes:\n       - modified ffpsvc to return a null value string without error\n       - modified ffc2[ilrd] to return error VALUE_UNDEFINED in this case\n       - modified ffgkn[sljed] to continue reading additional keywords\n         even if one or more keywords have undefined values.\n       - added 4 new routines:  ffpkyu, ffikyu, ffmkyu, ffukyu to\n         write, insert, modify, or update an undefined keyword\n\n   - a new makefile.os2 file was added, for building CFITSIO\n     on OS/2 systems.\n\n   - modified ffgtkn so that if it finds an unexpected keyword\n     name, the returned error status = BAD_ORDER instead of\n     NOT_POS_INT.\n\n   - added 2 new routines, fits_write_key_unit/ffpunt and\n     fits_read_key_unit/ffgunt to write/read the physical\n     units of a keyword value.  These routines use a local\n     FITS convention for storing the units in square brackets\n     following the '/' comment field separator, as in:\n     VELOCITY=                   12 / [km/s] orbit speed \n     The testprog.c program was modified to test these\n     new routines.\n\n   - in the test of Alpha OSF/1 machines in fitsio2.h,\n     change 'defined(unix)' to 'defined(__unix__)' which\n     appears to be a more robust test.\n\n   - remove test for linux environment variable from fitsio2.h\n\nVersion 1.24 - 2 May 1997\n\n   - fixed bug in ffpbyt that incorrectly computed the current\n     location in the FITS file when writing > 10000 bytes.\n\n   - changed the datatype of the 'nbytes' parameter in ffpbyt \n     from 'int' to 'long'.   Made corresponding datatype change\n     to some internal variables in ffshft.\n\n   - changed '(unsigned short *)' to '(short *)' in getcolui.c, and\n     changed '(unsigned long *)'  to '(long *)'  in getcoluj.c, to\n     work around problem with the VAX/VMS cc compiler.\n\nVersion 1.23 - 24 April 1997\n\n   - modified ffcins and ffdins (in editcol.c) to simply return \n     without error if there are no (zero) rows in the table.\n\nVersion 1.22 - 18 April 1997\n\n   - fixed bug in ffgcpr that caused it to think that all values were\n     undefined in ASCII tables columns that have TNULLn = '        '\n     (i.e., the TNULLn keyword value is a string of blanks.\n\n   - fixed bug in the ffgcl[bdeijk,ui,uj] family of routines\n     when parsing a numeric value in an ASCII table.  The\n     returned values would have the decimal place shifted to\n     the left if the table field contained an explicit decimal\n     point followed by blanks.  Example:  in an F5.2 column,\n     the value '16.  ' would be returned as 0.16.  If the\n     trailing zeros were present, then cfitsio returned the\n     correct value (e.g.,  '16.00' returns 16.).\n\n   - fixed another bug in the ffgcl[bdeijk,ui,uj] family of routines\n     that caused them to misread values in an ASCII table in rows\n     following an undefined value when all the values were read\n     at once in a single call to the routine.\n\nVersion 1.21 - 26 March 1997\n\n   - added general support for reading and writing unsigned integer\n     keywords, images, and binary table column values.\n\n   - fixed bug in the way the column number was used in ffgsve and\n     similar routines.  This bug caused cfitsio to read (colnum - 1)\n     rather than the desired column.\n\n   - fixed a bug in ftgkls that prevented it from reading more than one\n     continuation line of a long string keyword value.\n\n   - fixed the definition of fits_write_longwarn in longnam.h\n\nVersion 1.20 - 29 Jan 1997\n\n   - when creating a binary table with variable length vector columns, if the\n     calling routine does not specify a value for the maximum length of\n     the vector (e.g.,  TFORMn = '1PE(400)')  then cfitsio will automatically\n     calculate the maximum value and append it to the TFORM value\n     when the binary table is first closed.\n\n   - added the set of routines to do coordinate system transformations\n\n   - added support for wildcards ('*', '?', and '#') in the input\n     keyword name when reading, modifying, or deleting keywords.\n\n   - added new general keyword reading routine, ffgnxk, to return\n     the next keyword whose name matches a list of template names,\n     but does not match any names on a second template list.\n\n   - modified ftgrec so that it simply moves to the beginning\n     of the header if the input keyword number = 0\n\n   - added check in ffdelt to make sure the input fits file pointer is\n     not already null\n\n   - added check in ffcopy to make sure the output HDU does not\n     already contain any keywords (it must be empty).\n\n   - modified ffgcls so that it does not test if each string column\n     value equals the null string value if the null string value\n     is longer than the width of the column.\n\n   - fixed bug in ftgtdm that caused it to fail if the TDIMn \n     keyword did not exist in the FITS file\n\n   - modified testprog.c to include tests of keyword wildcards\n     and the WCS coordinate transformation routines.\n\n   - added a test for 'EMX' in fitsio2.h so that cfitsio builds \n     correctly on a PC running OS/2.\n\nVersion 1.11 - 04 Dec 1996\n\n   - modified the testprog.c program that is included with the\n     distribution, so that the output FITS file is identical to\n     that produced by the Fortran FITSIO test program.\n\n   - changed all instances of the 'extname' variable to 'extnm'\n     to avoid a conflict with the -Dextname switch in cfortran.h\n     on HP machines.\n\n   - in all the routines like ffi4fi1, which convert an array\n     of values to integers just prior to writing them to the FITS\n     file, the integer value is now rounded to the nearest integer\n     rather than truncated. (ffi4fi1, ffi4fi2, ffi4fi4, etc)\n\n   - changed ffgcfl (and hence ffgcl) so that the input value\n     of the logical array element is not changed if the corresponding\n     FITS value is undefined.\n\n   - in ffgacl, the returned value of TBCOL was off by 1 (too small)\n\n   - fixed the comment of EXTNAME keyword to read 'binary table'\n     instead of 'ASCII table' in the header of binary tables.\n\nVersion 1.101 - 17 Nov 1996\n\n   - Made major I/O efficiency improvements by adding internal buffers\n     rather than directly reading or writing to disk.  Access to \n     columns in binary tables is now 50 - 150 times faster.  Access to\n     FITS image is also slightly faster.\n\n   - made significant speed improvements when reading numerical data\n     in FITS ASCII tables by writing my own number parsing routines\n     rather than using the sscanf C library routine.  This change\n     requires that the -lm argument now be included when linking\n     a program that calls cfitsio (under UNIX).\n\n   - regrouped the source files into logically related sets of routines.\n     The Makefile now runs much faster since every single routine is\n     not split into a separate file.\n\n   - now use the memcpy function, rather than a 'for' loop in several\n     places for added efficiency\n\n   - redesigned the low-level binary table read and write routines\n     (ffpbytoff and ffgbytoff) for greater efficiency.\n\n   - added a new error status: 103 = too many open FITS files.\n\n   - added a 'extern \"C\"' statement around the function prototypes\n     in fitsio.h, to support use of cfitsio by C++ compilers.\n\n   - fixed routines for writing or reading fixed-length substrings\n     within a binary table ASCII column, with TFORM values of\n     of the form 'rAw' where 'r' is the total width of the ASCII\n     column and 'w' is the width of a substring within the column.\n\n   - no longer automatically rewrite the END card and following fill\n     values if they are already correct.\n\n   - all the 'get keyword value and comment' routines have been changed \n     so that the comment is not returned if the input pointer is NULL.\n\n   - added new routine to return the optimum number of tables rows\n     that should be read or written at one time for optimum efficiency.\n\n   - modified the way numerical values in ASCII tables are parsed so\n     that embedded spaces in the value are ignored, and implicit\n     decimal points are now supported.   (e.g, the string '123E 12'\n     in a 'E10.2' format column will be interpreted as 1.23 * 10**12).\n\n   - modified ffpcl and ffgcl to support binary table columns of\n     all datatype (added logical, bit, complex, and double complex)\n\n   - when writing numerical data to ASCII table columns, the ffpcl_\n     routines now return an overflow error if a value is too large\n     to be expressed in the column format.\n\n   - closed small memory leak in ffpcls.\n\n   - initialized the 'incre' variable in ffgcpr to eliminate compiler warning.\n\nVersion 1.04 - 17 Sept 1996\n\n   - added README.MacOS and cfitsio_mac.sit.hqx to the distribution\n     to support the Mac platforms.\n\n   - fixed bug in ffpdfl that caused an EOF error (107) when a program\n     creates a new extension that is an exact multiple of 2880 bytes long,\n     AND the program does not write a value to the last element\n     in the table or image.\n\n   - fixed bug in all the ffgsf* and ffgcv* routines which caused\n     core dumps when reading null values in a table.\n\nVersion 1.03 - 20 August 1996\n\n   - added full support for reading and writing the C 'int'\n     data type.  This was a problem on Alpha/OSF where short,\n     int, and long datatypes are 2, 4, and 8 bytes long, respectively.\n\n   - cleaned up the code in the byte-swapping routines.\n\n   - renamed the file 'longname.h' to 'longnam.h' to avoid conflict\n     with a file with the same name in another unrelated package.\n\nVersion 1.02 - 15 August 1996\n\n   - ffgtbp was not correctly reading the THEAP keyword, hence would\n     not correctly read variable length data in binary tables if\n     the heap was not at the default starting location (i.e., \n     starting immediately after the fixed length table).\n\n   - now force the cbuff variable in ffpcl_ and ffgcl_ to be\n     aligned on a double word boundary.  Non-alignment can\n     cause program to crash on some systems.\n\nVersion 1.01 - 12 August 1996\n\n   - initial public release\n"},{"id":16725,"name":"trees.c","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* trees.c -- output deflated data using Huffman coding\n * Copyright (C) 1995-2010 Jean-loup Gailly\n * detect_data_type() function provided freely by Cosmin Truta, 2006\n * For conditions of distribution and use, see copyright notice in zlib.h\n */\n\n/*\n *  ALGORITHM\n *\n *      The \"deflation\" process uses several Huffman trees. The more\n *      common source values are represented by shorter bit sequences.\n *\n *      Each code tree is stored in a compressed form which is itself\n * a Huffman encoding of the lengths of all the code strings (in\n * ascending order by source values).  The actual code strings are\n * reconstructed from the lengths in the inflate process, as described\n * in the deflate specification.\n *\n *  REFERENCES\n *\n *      Deutsch, L.P.,\"'Deflate' Compressed Data Format Specification\".\n *      Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc\n *\n *      Storer, James A.\n *          Data Compression:  Methods and Theory, pp. 49-50.\n *          Computer Science Press, 1988.  ISBN 0-7167-8156-5.\n *\n *      Sedgewick, R.\n *          Algorithms, p290.\n *          Addison-Wesley, 1983. ISBN 0-201-06672-6.\n */\n\n/* #define GEN_TREES_H */\n\n#include \"deflate.h\"\n\n#ifdef DEBUG\n#  include <ctype.h>\n#endif\n\n/* ===========================================================================\n * Constants\n */\n\n#define MAX_BL_BITS 7\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\n#define END_BLOCK 256\n/* end of block literal code */\n\n#define REP_3_6      16\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\n#define REPZ_3_10    17\n/* repeat a zero length 3-10 times  (3 bits of repeat count) */\n\n#define REPZ_11_138  18\n/* repeat a zero length 11-138 times  (7 bits of repeat count) */\n\nlocal const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */\n   = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};\n\nlocal const int extra_dbits[D_CODES] /* extra bits for each distance code */\n   = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};\n\nlocal const int extra_blbits[BL_CODES]/* extra bits for each bit length code */\n   = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};\n\nlocal const uch bl_order[BL_CODES]\n   = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n#define Buf_size (8 * 2*sizeof(char))\n/* Number of bits used within bi_buf. (bi_buf might be implemented on\n * more than 16 bits on some systems.)\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n#define DIST_CODE_LEN  512 /* see definition of array dist_code below */\n\n#if defined(GEN_TREES_H) || !defined(STDC)\n/* non ANSI compilers may not accept trees.h */\n\nlocal ct_data static_ltree[L_CODES+2];\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nlocal ct_data static_dtree[D_CODES];\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nuch _dist_code[DIST_CODE_LEN];\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nuch _length_code[MAX_MATCH-MIN_MATCH+1];\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nlocal int base_length[LENGTH_CODES];\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nlocal int base_dist[D_CODES];\n/* First normalized distance for each code (0 = distance of 1) */\n\n#else\n#  include \"trees.h\"\n#endif /* GEN_TREES_H */\n\nstruct static_tree_desc_s {\n    const ct_data *static_tree;  /* static tree or NULL */\n    const intf *extra_bits;      /* extra bits for each code or NULL */\n    int     extra_base;          /* base index for extra_bits */\n    int     elems;               /* max number of elements in the tree */\n    int     max_length;          /* max bit length for the codes */\n};\n\nlocal static_tree_desc  static_l_desc =\n{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};\n\nlocal static_tree_desc  static_d_desc =\n{static_dtree, extra_dbits, 0,          D_CODES, MAX_BITS};\n\nlocal static_tree_desc  static_bl_desc =\n{(const ct_data *)0, extra_blbits, 0,   BL_CODES, MAX_BL_BITS};\n\n/* ===========================================================================\n * Local (static) routines in this file.\n */\n\nlocal void tr_static_init OF((void));\nlocal void init_block     OF((deflate_state *s));\nlocal void pqdownheap     OF((deflate_state *s, ct_data *tree, int k));\nlocal void gen_bitlen     OF((deflate_state *s, tree_desc *desc));\nlocal void gen_codes      OF((ct_data *tree, int max_code, ushf *bl_count));\nlocal void build_tree     OF((deflate_state *s, tree_desc *desc));\nlocal void scan_tree      OF((deflate_state *s, ct_data *tree, int max_code));\nlocal void send_tree      OF((deflate_state *s, ct_data *tree, int max_code));\nlocal int  build_bl_tree  OF((deflate_state *s));\nlocal void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,\n                              int blcodes));\nlocal void compress_block OF((deflate_state *s, ct_data *ltree,\n                              ct_data *dtree));\nlocal int  detect_data_type OF((deflate_state *s));\nlocal unsigned bi_reverse OF((unsigned value, int length));\nlocal void bi_windup      OF((deflate_state *s));\nlocal void bi_flush       OF((deflate_state *s));\nlocal void copy_block     OF((deflate_state *s, charf *buf, unsigned len,\n                              int header));\n\n#ifdef GEN_TREES_H\nlocal void gen_trees_header OF((void));\n#endif\n\n#ifndef DEBUG\n#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)\n   /* Send a code of the given tree. c and tree must not have side effects */\n\n#else /* DEBUG */\n#  define send_code(s, c, tree) \\\n     { if (z_verbose>2) fprintf(stderr,\"\\ncd %3d \",(c)); \\\n       send_bits(s, tree[c].Code, tree[c].Len); }\n#endif\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\n#define put_short(s, w) { \\\n    put_byte(s, (uch)((w) & 0xff)); \\\n    put_byte(s, (uch)((ush)(w) >> 8)); \\\n}\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\n#ifdef DEBUG\nlocal void send_bits      OF((deflate_state *s, int value, int length));\n\nlocal void send_bits(s, value, length)\n    deflate_state *s;\n    int value;  /* value to send */\n    int length; /* number of bits */\n{\n    Tracevv((stderr,\" l %2d v %4x \", length, value));\n    Assert(length > 0 && length <= 15, \"invalid length\");\n    s->bits_sent += (ulg)length;\n\n    /* If not enough room in bi_buf, use (valid) bits from bi_buf and\n     * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))\n     * unused bits in value.\n     */\n    if (s->bi_valid > (int)Buf_size - length) {\n        s->bi_buf |= (ush)value << s->bi_valid;\n        put_short(s, s->bi_buf);\n        s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);\n        s->bi_valid += length - Buf_size;\n    } else {\n        s->bi_buf |= (ush)value << s->bi_valid;\n        s->bi_valid += length;\n    }\n}\n#else /* !DEBUG */\n\n#define send_bits(s, value, length) \\\n{ int len = length;\\\n  if (s->bi_valid > (int)Buf_size - len) {\\\n    int val = value;\\\n    s->bi_buf |= (ush)val << s->bi_valid;\\\n    put_short(s, s->bi_buf);\\\n    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\\\n    s->bi_valid += len - Buf_size;\\\n  } else {\\\n    s->bi_buf |= (ush)(value) << s->bi_valid;\\\n    s->bi_valid += len;\\\n  }\\\n}\n#endif /* DEBUG */\n\n\n/* the arguments must not have side effects */\n\n/* ===========================================================================\n * Initialize the various 'constant' tables.\n */\nlocal void tr_static_init()\n{\n#if defined(GEN_TREES_H) || !defined(STDC)\n    static int static_init_done = 0;\n    int n;        /* iterates over tree elements */\n    int bits;     /* bit counter */\n    int length;   /* length value */\n    int code;     /* code value */\n    int dist;     /* distance index */\n    ush bl_count[MAX_BITS+1];\n    /* number of codes at each bit length for an optimal tree */\n\n    if (static_init_done) return;\n\n    /* For some embedded targets, global variables are not initialized: */\n#ifdef NO_INIT_GLOBAL_POINTERS\n    static_l_desc.static_tree = static_ltree;\n    static_l_desc.extra_bits = extra_lbits;\n    static_d_desc.static_tree = static_dtree;\n    static_d_desc.extra_bits = extra_dbits;\n    static_bl_desc.extra_bits = extra_blbits;\n#endif\n\n    /* Initialize the mapping length (0..255) -> length code (0..28) */\n    length = 0;\n    for (code = 0; code < LENGTH_CODES-1; code++) {\n        base_length[code] = length;\n        for (n = 0; n < (1<<extra_lbits[code]); n++) {\n            _length_code[length++] = (uch)code;\n        }\n    }\n    Assert (length == 256, \"tr_static_init: length != 256\");\n    /* Note that the length 255 (match length 258) can be represented\n     * in two different ways: code 284 + 5 bits or code 285, so we\n     * overwrite length_code[255] to use the best encoding:\n     */\n    _length_code[length-1] = (uch)code;\n\n    /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n    dist = 0;\n    for (code = 0 ; code < 16; code++) {\n        base_dist[code] = dist;\n        for (n = 0; n < (1<<extra_dbits[code]); n++) {\n            _dist_code[dist++] = (uch)code;\n        }\n    }\n    Assert (dist == 256, \"tr_static_init: dist != 256\");\n    dist >>= 7; /* from now on, all distances are divided by 128 */\n    for ( ; code < D_CODES; code++) {\n        base_dist[code] = dist << 7;\n        for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {\n            _dist_code[256 + dist++] = (uch)code;\n        }\n    }\n    Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n    /* Construct the codes of the static literal tree */\n    for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;\n    n = 0;\n    while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;\n    while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;\n    while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;\n    while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;\n    /* Codes 286 and 287 do not exist, but we must include them in the\n     * tree construction to get a canonical Huffman tree (longest code\n     * all ones)\n     */\n    gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);\n\n    /* The static distance tree is trivial: */\n    for (n = 0; n < D_CODES; n++) {\n        static_dtree[n].Len = 5;\n        static_dtree[n].Code = bi_reverse((unsigned)n, 5);\n    }\n    static_init_done = 1;\n\n#  ifdef GEN_TREES_H\n    gen_trees_header();\n#  endif\n#endif /* defined(GEN_TREES_H) || !defined(STDC) */\n}\n\n/* ===========================================================================\n * Genererate the file trees.h describing the static trees.\n */\n#ifdef GEN_TREES_H\n#  ifndef DEBUG\n#    include <stdio.h>\n#  endif\n\n#  define SEPARATOR(i, last, width) \\\n      ((i) == (last)? \"\\n};\\n\\n\" :    \\\n       ((i) % (width) == (width)-1 ? \",\\n\" : \", \"))\n\nvoid gen_trees_header()\n{\n    FILE *header = fopen(\"trees.h\", \"w\");\n    int i;\n\n    Assert (header != NULL, \"Can't open trees.h\");\n    fprintf(header,\n            \"/* header created automatically with -DGEN_TREES_H */\\n\\n\");\n\n    fprintf(header, \"local const ct_data static_ltree[L_CODES+2] = {\\n\");\n    for (i = 0; i < L_CODES+2; i++) {\n        fprintf(header, \"{{%3u},{%3u}}%s\", static_ltree[i].Code,\n                static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));\n    }\n\n    fprintf(header, \"local const ct_data static_dtree[D_CODES] = {\\n\");\n    for (i = 0; i < D_CODES; i++) {\n        fprintf(header, \"{{%2u},{%2u}}%s\", static_dtree[i].Code,\n                static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));\n    }\n\n    fprintf(header, \"const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\\n\");\n    for (i = 0; i < DIST_CODE_LEN; i++) {\n        fprintf(header, \"%2u%s\", _dist_code[i],\n                SEPARATOR(i, DIST_CODE_LEN-1, 20));\n    }\n\n    fprintf(header,\n        \"const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\\n\");\n    for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {\n        fprintf(header, \"%2u%s\", _length_code[i],\n                SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));\n    }\n\n    fprintf(header, \"local const int base_length[LENGTH_CODES] = {\\n\");\n    for (i = 0; i < LENGTH_CODES; i++) {\n        fprintf(header, \"%1u%s\", base_length[i],\n                SEPARATOR(i, LENGTH_CODES-1, 20));\n    }\n\n    fprintf(header, \"local const int base_dist[D_CODES] = {\\n\");\n    for (i = 0; i < D_CODES; i++) {\n        fprintf(header, \"%5u%s\", base_dist[i],\n                SEPARATOR(i, D_CODES-1, 10));\n    }\n\n    fclose(header);\n}\n#endif /* GEN_TREES_H */\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nvoid ZLIB_INTERNAL _tr_init(s)\n    deflate_state *s;\n{\n    tr_static_init();\n\n    s->l_desc.dyn_tree = s->dyn_ltree;\n    s->l_desc.stat_desc = &static_l_desc;\n\n    s->d_desc.dyn_tree = s->dyn_dtree;\n    s->d_desc.stat_desc = &static_d_desc;\n\n    s->bl_desc.dyn_tree = s->bl_tree;\n    s->bl_desc.stat_desc = &static_bl_desc;\n\n    s->bi_buf = 0;\n    s->bi_valid = 0;\n    s->last_eob_len = 8; /* enough lookahead for inflate */\n#ifdef DEBUG\n    s->compressed_len = 0L;\n    s->bits_sent = 0L;\n#endif\n\n    /* Initialize the first block of the first file: */\n    init_block(s);\n}\n\n/* ===========================================================================\n * Initialize a new block.\n */\nlocal void init_block(s)\n    deflate_state *s;\n{\n    int n; /* iterates over tree elements */\n\n    /* Initialize the trees. */\n    for (n = 0; n < L_CODES;  n++) s->dyn_ltree[n].Freq = 0;\n    for (n = 0; n < D_CODES;  n++) s->dyn_dtree[n].Freq = 0;\n    for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;\n\n    s->dyn_ltree[END_BLOCK].Freq = 1;\n    s->opt_len = s->static_len = 0L;\n    s->last_lit = s->matches = 0;\n}\n\n#define SMALLEST 1\n/* Index within the heap array of least frequent node in the Huffman tree */\n\n\n/* ===========================================================================\n * Remove the smallest element from the heap and recreate the heap with\n * one less element. Updates heap and heap_len.\n */\n#define pqremove(s, tree, top) \\\n{\\\n    top = s->heap[SMALLEST]; \\\n    s->heap[SMALLEST] = s->heap[s->heap_len--]; \\\n    pqdownheap(s, tree, SMALLEST); \\\n}\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\n#define smaller(tree, n, m, depth) \\\n   (tree[n].Freq < tree[m].Freq || \\\n   (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nlocal void pqdownheap(s, tree, k)\n    deflate_state *s;\n    ct_data *tree;  /* the tree to restore */\n    int k;               /* node to move down */\n{\n    int v = s->heap[k];\n    int j = k << 1;  /* left son of k */\n    while (j <= s->heap_len) {\n        /* Set j to the smallest of the two sons: */\n        if (j < s->heap_len &&\n            smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {\n            j++;\n        }\n        /* Exit if v is smaller than both sons */\n        if (smaller(tree, v, s->heap[j], s->depth)) break;\n\n        /* Exchange v with the smallest son */\n        s->heap[k] = s->heap[j];  k = j;\n\n        /* And continue down the tree, setting j to the left son of k */\n        j <<= 1;\n    }\n    s->heap[k] = v;\n}\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n *    above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n *     array bl_count contains the frequencies for each bit length.\n *     The length opt_len is updated; static_len is also updated if stree is\n *     not null.\n */\nlocal void gen_bitlen(s, desc)\n    deflate_state *s;\n    tree_desc *desc;    /* the tree descriptor */\n{\n    ct_data *tree        = desc->dyn_tree;\n    int max_code         = desc->max_code;\n    const ct_data *stree = desc->stat_desc->static_tree;\n    const intf *extra    = desc->stat_desc->extra_bits;\n    int base             = desc->stat_desc->extra_base;\n    int max_length       = desc->stat_desc->max_length;\n    int h;              /* heap index */\n    int n, m;           /* iterate over the tree elements */\n    int bits;           /* bit length */\n    int xbits;          /* extra bits */\n    ush f;              /* frequency */\n    int overflow = 0;   /* number of elements with bit length too large */\n\n    for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;\n\n    /* In a first pass, compute the optimal bit lengths (which may\n     * overflow in the case of the bit length tree).\n     */\n    tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */\n\n    for (h = s->heap_max+1; h < HEAP_SIZE; h++) {\n        n = s->heap[h];\n        bits = tree[tree[n].Dad].Len + 1;\n        if (bits > max_length) bits = max_length, overflow++;\n        tree[n].Len = (ush)bits;\n        /* We overwrite tree[n].Dad which is no longer needed */\n\n        if (n > max_code) continue; /* not a leaf node */\n\n        s->bl_count[bits]++;\n        xbits = 0;\n        if (n >= base) xbits = extra[n-base];\n        f = tree[n].Freq;\n        s->opt_len += (ulg)f * (bits + xbits);\n        if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);\n    }\n    if (overflow == 0) return;\n\n    Trace((stderr,\"\\nbit length overflow\\n\"));\n    /* This happens for example on obj2 and pic of the Calgary corpus */\n\n    /* Find the first bit length which could increase: */\n    do {\n        bits = max_length-1;\n        while (s->bl_count[bits] == 0) bits--;\n        s->bl_count[bits]--;      /* move one leaf down the tree */\n        s->bl_count[bits+1] += 2; /* move one overflow item as its brother */\n        s->bl_count[max_length]--;\n        /* The brother of the overflow item also moves one step up,\n         * but this does not affect bl_count[max_length]\n         */\n        overflow -= 2;\n    } while (overflow > 0);\n\n    /* Now recompute all bit lengths, scanning in increasing frequency.\n     * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n     * lengths instead of fixing only the wrong ones. This idea is taken\n     * from 'ar' written by Haruhiko Okumura.)\n     */\n    for (bits = max_length; bits != 0; bits--) {\n        n = s->bl_count[bits];\n        while (n != 0) {\n            m = s->heap[--h];\n            if (m > max_code) continue;\n            if ((unsigned) tree[m].Len != (unsigned) bits) {\n                Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n                s->opt_len += ((long)bits - (long)tree[m].Len)\n                              *(long)tree[m].Freq;\n                tree[m].Len = (ush)bits;\n            }\n            n--;\n        }\n    }\n}\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n *     zero code length.\n */\nlocal void gen_codes (tree, max_code, bl_count)\n    ct_data *tree;             /* the tree to decorate */\n    int max_code;              /* largest code with non zero frequency */\n    ushf *bl_count;            /* number of codes at each bit length */\n{\n    ush next_code[MAX_BITS+1]; /* next code value for each bit length */\n    ush code = 0;              /* running code value */\n    int bits;                  /* bit index */\n    int n;                     /* code index */\n\n    /* The distribution counts are first used to generate the code values\n     * without bit reversal.\n     */\n    for (bits = 1; bits <= MAX_BITS; bits++) {\n        next_code[bits] = code = (code + bl_count[bits-1]) << 1;\n    }\n    /* Check that the bit counts in bl_count are consistent. The last code\n     * must be all ones.\n     */\n    Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,\n            \"inconsistent bit counts\");\n    Tracev((stderr,\"\\ngen_codes: max_code %d \", max_code));\n\n    for (n = 0;  n <= max_code; n++) {\n        int len = tree[n].Len;\n        if (len == 0) continue;\n        /* Now reverse the bits */\n        tree[n].Code = bi_reverse(next_code[len]++, len);\n\n        Tracecv(tree != static_ltree, (stderr,\"\\nn %3d %c l %2d c %4x (%x) \",\n             n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));\n    }\n}\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n *     and corresponding code. The length opt_len is updated; static_len is\n *     also updated if stree is not null. The field max_code is set.\n */\nlocal void build_tree(s, desc)\n    deflate_state *s;\n    tree_desc *desc; /* the tree descriptor */\n{\n    ct_data *tree         = desc->dyn_tree;\n    const ct_data *stree  = desc->stat_desc->static_tree;\n    int elems             = desc->stat_desc->elems;\n    int n, m;          /* iterate over heap elements */\n    int max_code = -1; /* largest code with non zero frequency */\n    int node;          /* new node being created */\n\n    /* Construct the initial heap, with least frequent element in\n     * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n     * heap[0] is not used.\n     */\n    s->heap_len = 0, s->heap_max = HEAP_SIZE;\n\n    for (n = 0; n < elems; n++) {\n        if (tree[n].Freq != 0) {\n            s->heap[++(s->heap_len)] = max_code = n;\n            s->depth[n] = 0;\n        } else {\n            tree[n].Len = 0;\n        }\n    }\n\n    /* The pkzip format requires that at least one distance code exists,\n     * and that at least one bit should be sent even if there is only one\n     * possible code. So to avoid special checks later on we force at least\n     * two codes of non zero frequency.\n     */\n    while (s->heap_len < 2) {\n        node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);\n        tree[node].Freq = 1;\n        s->depth[node] = 0;\n        s->opt_len--; if (stree) s->static_len -= stree[node].Len;\n        /* node is 0 or 1 so it does not have extra bits */\n    }\n    desc->max_code = max_code;\n\n    /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n     * establish sub-heaps of increasing lengths:\n     */\n    for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);\n\n    /* Construct the Huffman tree by repeatedly combining the least two\n     * frequent nodes.\n     */\n    node = elems;              /* next internal node of the tree */\n    do {\n        pqremove(s, tree, n);  /* n = node of least frequency */\n        m = s->heap[SMALLEST]; /* m = node of next least frequency */\n\n        s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */\n        s->heap[--(s->heap_max)] = m;\n\n        /* Create a new node father of n and m */\n        tree[node].Freq = tree[n].Freq + tree[m].Freq;\n        s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?\n                                s->depth[n] : s->depth[m]) + 1);\n        tree[n].Dad = tree[m].Dad = (ush)node;\n#ifdef DUMP_BL_TREE\n        if (tree == s->bl_tree) {\n            fprintf(stderr,\"\\nnode %d(%d), sons %d(%d) %d(%d)\",\n                    node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);\n        }\n#endif\n        /* and insert the new node in the heap */\n        s->heap[SMALLEST] = node++;\n        pqdownheap(s, tree, SMALLEST);\n\n    } while (s->heap_len >= 2);\n\n    s->heap[--(s->heap_max)] = s->heap[SMALLEST];\n\n    /* At this point, the fields freq and dad are set. We can now\n     * generate the bit lengths.\n     */\n    gen_bitlen(s, (tree_desc *)desc);\n\n    /* The field len is now set, we can generate the bit codes */\n    gen_codes ((ct_data *)tree, max_code, s->bl_count);\n}\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nlocal void scan_tree (s, tree, max_code)\n    deflate_state *s;\n    ct_data *tree;   /* the tree to be scanned */\n    int max_code;    /* and its largest code of non zero frequency */\n{\n    int n;                     /* iterates over all tree elements */\n    int prevlen = -1;          /* last emitted length */\n    int curlen;                /* length of current code */\n    int nextlen = tree[0].Len; /* length of next code */\n    int count = 0;             /* repeat count of the current code */\n    int max_count = 7;         /* max repeat count */\n    int min_count = 4;         /* min repeat count */\n\n    if (nextlen == 0) max_count = 138, min_count = 3;\n    tree[max_code+1].Len = (ush)0xffff; /* guard */\n\n    for (n = 0; n <= max_code; n++) {\n        curlen = nextlen; nextlen = tree[n+1].Len;\n        if (++count < max_count && curlen == nextlen) {\n            continue;\n        } else if (count < min_count) {\n            s->bl_tree[curlen].Freq += count;\n        } else if (curlen != 0) {\n            if (curlen != prevlen) s->bl_tree[curlen].Freq++;\n            s->bl_tree[REP_3_6].Freq++;\n        } else if (count <= 10) {\n            s->bl_tree[REPZ_3_10].Freq++;\n        } else {\n            s->bl_tree[REPZ_11_138].Freq++;\n        }\n        count = 0; prevlen = curlen;\n        if (nextlen == 0) {\n            max_count = 138, min_count = 3;\n        } else if (curlen == nextlen) {\n            max_count = 6, min_count = 3;\n        } else {\n            max_count = 7, min_count = 4;\n        }\n    }\n}\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nlocal void send_tree (s, tree, max_code)\n    deflate_state *s;\n    ct_data *tree; /* the tree to be scanned */\n    int max_code;       /* and its largest code of non zero frequency */\n{\n    int n;                     /* iterates over all tree elements */\n    int prevlen = -1;          /* last emitted length */\n    int curlen;                /* length of current code */\n    int nextlen = tree[0].Len; /* length of next code */\n    int count = 0;             /* repeat count of the current code */\n    int max_count = 7;         /* max repeat count */\n    int min_count = 4;         /* min repeat count */\n\n    /* tree[max_code+1].Len = -1; */  /* guard already set */\n    if (nextlen == 0) max_count = 138, min_count = 3;\n\n    for (n = 0; n <= max_code; n++) {\n        curlen = nextlen; nextlen = tree[n+1].Len;\n        if (++count < max_count && curlen == nextlen) {\n            continue;\n        } else if (count < min_count) {\n            do { send_code(s, curlen, s->bl_tree); } while (--count != 0);\n\n        } else if (curlen != 0) {\n            if (curlen != prevlen) {\n                send_code(s, curlen, s->bl_tree); count--;\n            }\n            Assert(count >= 3 && count <= 6, \" 3_6?\");\n            send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);\n\n        } else if (count <= 10) {\n            send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);\n\n        } else {\n            send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);\n        }\n        count = 0; prevlen = curlen;\n        if (nextlen == 0) {\n            max_count = 138, min_count = 3;\n        } else if (curlen == nextlen) {\n            max_count = 6, min_count = 3;\n        } else {\n            max_count = 7, min_count = 4;\n        }\n    }\n}\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nlocal int build_bl_tree(s)\n    deflate_state *s;\n{\n    int max_blindex;  /* index of last bit length code of non zero freq */\n\n    /* Determine the bit length frequencies for literal and distance trees */\n    scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);\n    scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);\n\n    /* Build the bit length tree: */\n    build_tree(s, (tree_desc *)(&(s->bl_desc)));\n    /* opt_len now includes the length of the tree representations, except\n     * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n     */\n\n    /* Determine the number of bit length codes to send. The pkzip format\n     * requires that at least 4 bit length codes be sent. (appnote.txt says\n     * 3 but the actual value used is 4.)\n     */\n    for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {\n        if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;\n    }\n    /* Update opt_len to include the bit length tree and counts */\n    s->opt_len += 3*(max_blindex+1) + 5+5+4;\n    Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n            s->opt_len, s->static_len));\n\n    return max_blindex;\n}\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nlocal void send_all_trees(s, lcodes, dcodes, blcodes)\n    deflate_state *s;\n    int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n    int rank;                    /* index in bl_order */\n\n    Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n    Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n            \"too many codes\");\n    Tracev((stderr, \"\\nbl counts: \"));\n    send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */\n    send_bits(s, dcodes-1,   5);\n    send_bits(s, blcodes-4,  4); /* not -3 as stated in appnote.txt */\n    for (rank = 0; rank < blcodes; rank++) {\n        Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n        send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);\n    }\n    Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n    send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */\n    Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n    send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */\n    Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n}\n\n/* ===========================================================================\n * Send a stored block\n */\nvoid ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)\n    deflate_state *s;\n    charf *buf;       /* input block */\n    ulg stored_len;   /* length of input block */\n    int last;         /* one if this is the last block for a file */\n{\n    send_bits(s, (STORED_BLOCK<<1)+last, 3);    /* send block type */\n#ifdef DEBUG\n    s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;\n    s->compressed_len += (stored_len + 4) << 3;\n#endif\n    copy_block(s, buf, (unsigned)stored_len, 1); /* with header */\n}\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n * The current inflate code requires 9 bits of lookahead. If the\n * last two codes for the previous block (real code plus EOB) were coded\n * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode\n * the last real code. In this case we send two empty static blocks instead\n * of one. (There are no problems if the previous block is stored or fixed.)\n * To simplify the code, we assume the worst case of last real code encoded\n * on one bit only.\n */\nvoid ZLIB_INTERNAL _tr_align(s)\n    deflate_state *s;\n{\n    send_bits(s, STATIC_TREES<<1, 3);\n    send_code(s, END_BLOCK, static_ltree);\n#ifdef DEBUG\n    s->compressed_len += 10L; /* 3 for block type, 7 for EOB */\n#endif\n    bi_flush(s);\n    /* Of the 10 bits for the empty block, we have already sent\n     * (10 - bi_valid) bits. The lookahead for the last real code (before\n     * the EOB of the previous block) was thus at least one plus the length\n     * of the EOB plus what we have just sent of the empty static block.\n     */\n    if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {\n        send_bits(s, STATIC_TREES<<1, 3);\n        send_code(s, END_BLOCK, static_ltree);\n#ifdef DEBUG\n        s->compressed_len += 10L;\n#endif\n        bi_flush(s);\n    }\n    s->last_eob_len = 7;\n}\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nvoid ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)\n    deflate_state *s;\n    charf *buf;       /* input block, or NULL if too old */\n    ulg stored_len;   /* length of input block */\n    int last;         /* one if this is the last block for a file */\n{\n    ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n    int max_blindex = 0;  /* index of last bit length code of non zero freq */\n\n    /* Build the Huffman trees unless a stored block is forced */\n    if (s->level > 0) {\n\n        /* Check if the file is binary or text */\n        if (s->strm->data_type == Z_UNKNOWN)\n            s->strm->data_type = detect_data_type(s);\n\n        /* Construct the literal and distance trees */\n        build_tree(s, (tree_desc *)(&(s->l_desc)));\n        Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n                s->static_len));\n\n        build_tree(s, (tree_desc *)(&(s->d_desc)));\n        Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n                s->static_len));\n        /* At this point, opt_len and static_len are the total bit lengths of\n         * the compressed block data, excluding the tree representations.\n         */\n\n        /* Build the bit length tree for the above two trees, and get the index\n         * in bl_order of the last bit length code to send.\n         */\n        max_blindex = build_bl_tree(s);\n\n        /* Determine the best encoding. Compute the block lengths in bytes. */\n        opt_lenb = (s->opt_len+3+7)>>3;\n        static_lenb = (s->static_len+3+7)>>3;\n\n        Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n                opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n                s->last_lit));\n\n        if (static_lenb <= opt_lenb) opt_lenb = static_lenb;\n\n    } else {\n        Assert(buf != (char*)0, \"lost buf\");\n        opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n    }\n\n#ifdef FORCE_STORED\n    if (buf != (char*)0) { /* force stored block */\n#else\n    if (stored_len+4 <= opt_lenb && buf != (char*)0) {\n                       /* 4: two words for the lengths */\n#endif\n        /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n         * Otherwise we can't have processed more than WSIZE input bytes since\n         * the last block flush, because compression would have been\n         * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n         * transform a block into a stored block.\n         */\n        _tr_stored_block(s, buf, stored_len, last);\n\n#ifdef FORCE_STATIC\n    } else if (static_lenb >= 0) { /* force static trees */\n#else\n    } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {\n#endif\n        send_bits(s, (STATIC_TREES<<1)+last, 3);\n        compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);\n#ifdef DEBUG\n        s->compressed_len += 3 + s->static_len;\n#endif\n    } else {\n        send_bits(s, (DYN_TREES<<1)+last, 3);\n        send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,\n                       max_blindex+1);\n        compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);\n#ifdef DEBUG\n        s->compressed_len += 3 + s->opt_len;\n#endif\n    }\n    Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n    /* The above check is made mod 2^32, for files larger than 512 MB\n     * and uLong implemented on 32 bits.\n     */\n    init_block(s);\n\n    if (last) {\n        bi_windup(s);\n#ifdef DEBUG\n        s->compressed_len += 7;  /* align on byte boundary */\n#endif\n    }\n    Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n           s->compressed_len-7*last));\n}\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nint ZLIB_INTERNAL _tr_tally (s, dist, lc)\n    deflate_state *s;\n    unsigned dist;  /* distance of matched string */\n    unsigned lc;    /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n    s->d_buf[s->last_lit] = (ush)dist;\n    s->l_buf[s->last_lit++] = (uch)lc;\n    if (dist == 0) {\n        /* lc is the unmatched char */\n        s->dyn_ltree[lc].Freq++;\n    } else {\n        s->matches++;\n        /* Here, lc is the match length - MIN_MATCH */\n        dist--;             /* dist = match distance - 1 */\n        Assert((ush)dist < (ush)MAX_DIST(s) &&\n               (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n               (ush)d_code(dist) < (ush)D_CODES,  \"_tr_tally: bad match\");\n\n        s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;\n        s->dyn_dtree[d_code(dist)].Freq++;\n    }\n\n#ifdef TRUNCATE_BLOCK\n    /* Try to guess if it is profitable to stop the current block here */\n    if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {\n        /* Compute an upper bound for the compressed length */\n        ulg out_length = (ulg)s->last_lit*8L;\n        ulg in_length = (ulg)((long)s->strstart - s->block_start);\n        int dcode;\n        for (dcode = 0; dcode < D_CODES; dcode++) {\n            out_length += (ulg)s->dyn_dtree[dcode].Freq *\n                (5L+extra_dbits[dcode]);\n        }\n        out_length >>= 3;\n        Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n               s->last_lit, in_length, out_length,\n               100L - out_length*100L/in_length));\n        if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;\n    }\n#endif\n    return (s->last_lit == s->lit_bufsize-1);\n    /* We avoid equality with lit_bufsize because of wraparound at 64K\n     * on 16 bit machines and because stored blocks are restricted to\n     * 64K-1 bytes.\n     */\n}\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nlocal void compress_block(s, ltree, dtree)\n    deflate_state *s;\n    ct_data *ltree; /* literal tree */\n    ct_data *dtree; /* distance tree */\n{\n    unsigned dist;      /* distance of matched string */\n    int lc;             /* match length or unmatched char (if dist == 0) */\n    unsigned lx = 0;    /* running index in l_buf */\n    unsigned code;      /* the code to send */\n    int extra;          /* number of extra bits to send */\n\n    if (s->last_lit != 0) do {\n        dist = s->d_buf[lx];\n        lc = s->l_buf[lx++];\n        if (dist == 0) {\n            send_code(s, lc, ltree); /* send a literal byte */\n            Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n        } else {\n            /* Here, lc is the match length - MIN_MATCH */\n            code = _length_code[lc];\n            send_code(s, code+LITERALS+1, ltree); /* send the length code */\n            extra = extra_lbits[code];\n            if (extra != 0) {\n                lc -= base_length[code];\n                send_bits(s, lc, extra);       /* send the extra length bits */\n            }\n            dist--; /* dist is now the match distance - 1 */\n            code = d_code(dist);\n            Assert (code < D_CODES, \"bad d_code\");\n\n            send_code(s, code, dtree);       /* send the distance code */\n            extra = extra_dbits[code];\n            if (extra != 0) {\n                dist -= base_dist[code];\n                send_bits(s, dist, extra);   /* send the extra distance bits */\n            }\n        } /* literal or match pair ? */\n\n        /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n        Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n               \"pendingBuf overflow\");\n\n    } while (lx < s->last_lit);\n\n    send_code(s, END_BLOCK, ltree);\n    s->last_eob_len = ltree[END_BLOCK].Len;\n}\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n *    a) There are no non-portable control characters belonging to the\n *       \"black list\" (0..6, 14..25, 28..31).\n *    b) There is at least one printable character belonging to the\n *       \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n *   \"gray list\" that is ignored in this detection algorithm:\n *   (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nlocal int detect_data_type(s)\n    deflate_state *s;\n{\n    /* black_mask is the bit mask of black-listed bytes\n     * set bits 0..6, 14..25, and 28..31\n     * 0xf3ffc07f = binary 11110011111111111100000001111111\n     */\n    unsigned long black_mask = 0xf3ffc07fUL;\n    int n;\n\n    /* Check for non-textual (\"black-listed\") bytes. */\n    for (n = 0; n <= 31; n++, black_mask >>= 1)\n        if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0))\n            return Z_BINARY;\n\n    /* Check for textual (\"white-listed\") bytes. */\n    if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0\n            || s->dyn_ltree[13].Freq != 0)\n        return Z_TEXT;\n    for (n = 32; n < LITERALS; n++)\n        if (s->dyn_ltree[n].Freq != 0)\n            return Z_TEXT;\n\n    /* There are no \"black-listed\" or \"white-listed\" bytes:\n     * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n     */\n    return Z_BINARY;\n}\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nlocal unsigned bi_reverse(code, len)\n    unsigned code; /* the value to invert */\n    int len;       /* its bit length */\n{\n    register unsigned res = 0;\n    do {\n        res |= code & 1;\n        code >>= 1, res <<= 1;\n    } while (--len > 0);\n    return res >> 1;\n}\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nlocal void bi_flush(s)\n    deflate_state *s;\n{\n    if (s->bi_valid == 16) {\n        put_short(s, s->bi_buf);\n        s->bi_buf = 0;\n        s->bi_valid = 0;\n    } else if (s->bi_valid >= 8) {\n        put_byte(s, (Byte)s->bi_buf);\n        s->bi_buf >>= 8;\n        s->bi_valid -= 8;\n    }\n}\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nlocal void bi_windup(s)\n    deflate_state *s;\n{\n    if (s->bi_valid > 8) {\n        put_short(s, s->bi_buf);\n    } else if (s->bi_valid > 0) {\n        put_byte(s, (Byte)s->bi_buf);\n    }\n    s->bi_buf = 0;\n    s->bi_valid = 0;\n#ifdef DEBUG\n    s->bits_sent = (s->bits_sent+7) & ~7;\n#endif\n}\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nlocal void copy_block(s, buf, len, header)\n    deflate_state *s;\n    charf    *buf;    /* the input data */\n    unsigned len;     /* its length */\n    int      header;  /* true if block header must be written */\n{\n    bi_windup(s);        /* align on byte boundary */\n    s->last_eob_len = 8; /* enough lookahead for inflate */\n\n    if (header) {\n        put_short(s, (ush)len);\n        put_short(s, (ush)~len);\n#ifdef DEBUG\n        s->bits_sent += 2*16;\n#endif\n    }\n#ifdef DEBUG\n    s->bits_sent += (ulg)len<<3;\n#endif\n    while (len--) {\n        put_byte(s, *buf++);\n    }\n}\n"},{"id":16726,"name":"inflate.c","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* inflate.c -- zlib decompression\n * Copyright (C) 1995-2010 Mark Adler\n * For conditions of distribution and use, see copyright notice in zlib.h\n */\n\n/*\n * Change history:\n *\n * 1.2.beta0    24 Nov 2002\n * - First version -- complete rewrite of inflate to simplify code, avoid\n *   creation of window when not needed, minimize use of window when it is\n *   needed, make inffast.c even faster, implement gzip decoding, and to\n *   improve code readability and style over the previous zlib inflate code\n *\n * 1.2.beta1    25 Nov 2002\n * - Use pointers for available input and output checking in inffast.c\n * - Remove input and output counters in inffast.c\n * - Change inffast.c entry and loop from avail_in >= 7 to >= 6\n * - Remove unnecessary second byte pull from length extra in inffast.c\n * - Unroll direct copy to three copies per loop in inffast.c\n *\n * 1.2.beta2    4 Dec 2002\n * - Change external routine names to reduce potential conflicts\n * - Correct filename to inffixed.h for fixed tables in inflate.c\n * - Make hbuf[] unsigned char to match parameter type in inflate.c\n * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset)\n *   to avoid negation problem on Alphas (64 bit) in inflate.c\n *\n * 1.2.beta3    22 Dec 2002\n * - Add comments on state->bits assertion in inffast.c\n * - Add comments on op field in inftrees.h\n * - Fix bug in reuse of allocated window after inflateReset()\n * - Remove bit fields--back to byte structure for speed\n * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths\n * - Change post-increments to pre-increments in inflate_fast(), PPC biased?\n * - Add compile time option, POSTINC, to use post-increments instead (Intel?)\n * - Make MATCH copy in inflate() much faster for when inflate_fast() not used\n * - Use local copies of stream next and avail values, as well as local bit\n *   buffer and bit count in inflate()--for speed when inflate_fast() not used\n *\n * 1.2.beta4    1 Jan 2003\n * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings\n * - Move a comment on output buffer sizes from inffast.c to inflate.c\n * - Add comments in inffast.c to introduce the inflate_fast() routine\n * - Rearrange window copies in inflate_fast() for speed and simplification\n * - Unroll last copy for window match in inflate_fast()\n * - Use local copies of window variables in inflate_fast() for speed\n * - Pull out common wnext == 0 case for speed in inflate_fast()\n * - Make op and len in inflate_fast() unsigned for consistency\n * - Add FAR to lcode and dcode declarations in inflate_fast()\n * - Simplified bad distance check in inflate_fast()\n * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new\n *   source file infback.c to provide a call-back interface to inflate for\n *   programs like gzip and unzip -- uses window as output buffer to avoid\n *   window copying\n *\n * 1.2.beta5    1 Jan 2003\n * - Improved inflateBack() interface to allow the caller to provide initial\n *   input in strm.\n * - Fixed stored blocks bug in inflateBack()\n *\n * 1.2.beta6    4 Jan 2003\n * - Added comments in inffast.c on effectiveness of POSTINC\n * - Typecasting all around to reduce compiler warnings\n * - Changed loops from while (1) or do {} while (1) to for (;;), again to\n *   make compilers happy\n * - Changed type of window in inflateBackInit() to unsigned char *\n *\n * 1.2.beta7    27 Jan 2003\n * - Changed many types to unsigned or unsigned short to avoid warnings\n * - Added inflateCopy() function\n *\n * 1.2.0        9 Mar 2003\n * - Changed inflateBack() interface to provide separate opaque descriptors\n *   for the in() and out() functions\n * - Changed inflateBack() argument and in_func typedef to swap the length\n *   and buffer address return values for the input function\n * - Check next_in and next_out for Z_NULL on entry to inflate()\n *\n * The history for versions after 1.2.0 are in ChangeLog in zlib distribution.\n */\n\n#include \"zutil.h\"\n#include \"inftrees.h\"\n#include \"inflate.h\"\n#include \"inffast.h\"\n\n#ifdef MAKEFIXED\n#  ifndef BUILDFIXED\n#    define BUILDFIXED\n#  endif\n#endif\n\n/* function prototypes */\nlocal void fixedtables OF((struct inflate_state FAR *state));\nlocal int updatewindow OF((z_streamp strm, unsigned out));\n#ifdef BUILDFIXED\n   void makefixed OF((void));\n#endif\nlocal unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf,\n                              unsigned len));\n\nint ZEXPORT inflateReset(strm)\nz_streamp strm;\n{\n    struct inflate_state FAR *state;\n\n    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;\n    state = (struct inflate_state FAR *)strm->state;\n    strm->total_in = strm->total_out = state->total = 0;\n    strm->msg = Z_NULL;\n    strm->adler = 1;        /* to support ill-conceived Java test suite */\n    state->mode = HEAD;\n    state->last = 0;\n    state->havedict = 0;\n    state->dmax = 32768U;\n    state->head = Z_NULL;\n    state->wsize = 0;\n    state->whave = 0;\n    state->wnext = 0;\n    state->hold = 0;\n    state->bits = 0;\n    state->lencode = state->distcode = state->next = state->codes;\n    state->sane = 1;\n    state->back = -1;\n    Tracev((stderr, \"inflate: reset\\n\"));\n    return Z_OK;\n}\n\nint ZEXPORT inflateReset2(strm, windowBits)\nz_streamp strm;\nint windowBits;\n{\n    int wrap;\n    struct inflate_state FAR *state;\n\n    /* get the state */\n    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;\n    state = (struct inflate_state FAR *)strm->state;\n\n    /* extract wrap request from windowBits parameter */\n    if (windowBits < 0) {\n        wrap = 0;\n        windowBits = -windowBits;\n    }\n    else {\n        wrap = (windowBits >> 4) + 1;\n#ifdef GUNZIP\n        if (windowBits < 48)\n            windowBits &= 15;\n#endif\n    }\n\n    /* set number of window bits, free window if different */\n    if (windowBits && (windowBits < 8 || windowBits > 15))\n        return Z_STREAM_ERROR;\n    if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {\n        ZFREE(strm, state->window);\n        state->window = Z_NULL;\n    }\n\n    /* update state and reset the rest of it */\n    state->wrap = wrap;\n    state->wbits = (unsigned)windowBits;\n    return inflateReset(strm);\n}\n\nint ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)\nz_streamp strm;\nint windowBits;\nconst char *version;\nint stream_size;\n{\n    int ret;\n    struct inflate_state FAR *state;\n\n    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||\n        stream_size != (int)(sizeof(z_stream)))\n        return Z_VERSION_ERROR;\n    if (strm == Z_NULL) return Z_STREAM_ERROR;\n    strm->msg = Z_NULL;                 /* in case we return an error */\n    if (strm->zalloc == (alloc_func)0) {\n        strm->zalloc = zcalloc;\n        strm->opaque = (voidpf)0;\n    }\n    if (strm->zfree == (free_func)0) strm->zfree = zcfree;\n    state = (struct inflate_state FAR *)\n            ZALLOC(strm, 1, sizeof(struct inflate_state));\n    if (state == Z_NULL) return Z_MEM_ERROR;\n    Tracev((stderr, \"inflate: allocated\\n\"));\n    strm->state = (struct internal_state FAR *)state;\n    state->window = Z_NULL;\n    ret = inflateReset2(strm, windowBits);\n    if (ret != Z_OK) {\n        ZFREE(strm, state);\n        strm->state = Z_NULL;\n    }\n    return ret;\n}\n\nint ZEXPORT inflateInit_(strm, version, stream_size)\nz_streamp strm;\nconst char *version;\nint stream_size;\n{\n    return inflateInit2_(strm, DEF_WBITS, version, stream_size);\n}\n\nint ZEXPORT inflatePrime(strm, bits, value)\nz_streamp strm;\nint bits;\nint value;\n{\n    struct inflate_state FAR *state;\n\n    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;\n    state = (struct inflate_state FAR *)strm->state;\n    if (bits < 0) {\n        state->hold = 0;\n        state->bits = 0;\n        return Z_OK;\n    }\n    if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;\n    value &= (1L << bits) - 1;\n    state->hold += value << state->bits;\n    state->bits += bits;\n    return Z_OK;\n}\n\n/*\n   Return state with length and distance decoding tables and index sizes set to\n   fixed code decoding.  Normally this returns fixed tables from inffixed.h.\n   If BUILDFIXED is defined, then instead this routine builds the tables the\n   first time it's called, and returns those tables the first time and\n   thereafter.  This reduces the size of the code by about 2K bytes, in\n   exchange for a little execution time.  However, BUILDFIXED should not be\n   used for threaded applications, since the rewriting of the tables and virgin\n   may not be thread-safe.\n */\nlocal void fixedtables(state)\nstruct inflate_state FAR *state;\n{\n#ifdef BUILDFIXED\n    static int virgin = 1;\n    static code *lenfix, *distfix;\n    static code fixed[544];\n\n    /* build fixed huffman tables if first call (may not be thread safe) */\n    if (virgin) {\n        unsigned sym, bits;\n        static code *next;\n\n        /* literal/length table */\n        sym = 0;\n        while (sym < 144) state->lens[sym++] = 8;\n        while (sym < 256) state->lens[sym++] = 9;\n        while (sym < 280) state->lens[sym++] = 7;\n        while (sym < 288) state->lens[sym++] = 8;\n        next = fixed;\n        lenfix = next;\n        bits = 9;\n        inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);\n\n        /* distance table */\n        sym = 0;\n        while (sym < 32) state->lens[sym++] = 5;\n        distfix = next;\n        bits = 5;\n        inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);\n\n        /* do this just once */\n        virgin = 0;\n    }\n#else /* !BUILDFIXED */\n#   include \"inffixed.h\"\n#endif /* BUILDFIXED */\n    state->lencode = lenfix;\n    state->lenbits = 9;\n    state->distcode = distfix;\n    state->distbits = 5;\n}\n\n#ifdef MAKEFIXED\n#include <stdio.h>\n\n/*\n   Write out the inffixed.h that is #include'd above.  Defining MAKEFIXED also\n   defines BUILDFIXED, so the tables are built on the fly.  makefixed() writes\n   those tables to stdout, which would be piped to inffixed.h.  A small program\n   can simply call makefixed to do this:\n\n    void makefixed(void);\n\n    int main(void)\n    {\n        makefixed();\n        return 0;\n    }\n\n   Then that can be linked with zlib built with MAKEFIXED defined and run:\n\n    a.out > inffixed.h\n */\nvoid makefixed()\n{\n    unsigned low, size;\n    struct inflate_state state;\n\n    fixedtables(&state);\n    puts(\"    /* inffixed.h -- table for decoding fixed codes\");\n    puts(\"     * Generated automatically by makefixed().\");\n    puts(\"     */\");\n    puts(\"\");\n    puts(\"    /* WARNING: this file should *not* be used by applications.\");\n    puts(\"       It is part of the implementation of this library and is\");\n    puts(\"       subject to change. Applications should only use zlib.h.\");\n    puts(\"     */\");\n    puts(\"\");\n    size = 1U << 9;\n    printf(\"    static const code lenfix[%u] = {\", size);\n    low = 0;\n    for (;;) {\n        if ((low % 7) == 0) printf(\"\\n        \");\n        printf(\"{%u,%u,%d}\", state.lencode[low].op, state.lencode[low].bits,\n               state.lencode[low].val);\n        if (++low == size) break;\n        putchar(',');\n    }\n    puts(\"\\n    };\");\n    size = 1U << 5;\n    printf(\"\\n    static const code distfix[%u] = {\", size);\n    low = 0;\n    for (;;) {\n        if ((low % 6) == 0) printf(\"\\n        \");\n        printf(\"{%u,%u,%d}\", state.distcode[low].op, state.distcode[low].bits,\n               state.distcode[low].val);\n        if (++low == size) break;\n        putchar(',');\n    }\n    puts(\"\\n    };\");\n}\n#endif /* MAKEFIXED */\n\n/*\n   Update the window with the last wsize (normally 32K) bytes written before\n   returning.  If window does not exist yet, create it.  This is only called\n   when a window is already in use, or when output has been written during this\n   inflate call, but the end of the deflate stream has not been reached yet.\n   It is also called to create a window for dictionary data when a dictionary\n   is loaded.\n\n   Providing output buffers larger than 32K to inflate() should provide a speed\n   advantage, since only the last 32K of output is copied to the sliding window\n   upon return from inflate(), and since all distances after the first 32K of\n   output will fall in the output data, making match copies simpler and faster.\n   The advantage may be dependent on the size of the processor's data caches.\n */\nlocal int updatewindow(strm, out)\nz_streamp strm;\nunsigned out;\n{\n    struct inflate_state FAR *state;\n    unsigned copy, dist;\n\n    state = (struct inflate_state FAR *)strm->state;\n\n    /* if it hasn't been done already, allocate space for the window */\n    if (state->window == Z_NULL) {\n        state->window = (unsigned char FAR *)\n                        ZALLOC(strm, 1U << state->wbits,\n                               sizeof(unsigned char));\n        if (state->window == Z_NULL) return 1;\n    }\n\n    /* if window not in use yet, initialize */\n    if (state->wsize == 0) {\n        state->wsize = 1U << state->wbits;\n        state->wnext = 0;\n        state->whave = 0;\n    }\n\n    /* copy state->wsize or less output bytes into the circular window */\n    copy = out - strm->avail_out;\n    if (copy >= state->wsize) {\n        zmemcpy(state->window, strm->next_out - state->wsize, state->wsize);\n        state->wnext = 0;\n        state->whave = state->wsize;\n    }\n    else {\n        dist = state->wsize - state->wnext;\n        if (dist > copy) dist = copy;\n        zmemcpy(state->window + state->wnext, strm->next_out - copy, dist);\n        copy -= dist;\n        if (copy) {\n            zmemcpy(state->window, strm->next_out - copy, copy);\n            state->wnext = copy;\n            state->whave = state->wsize;\n        }\n        else {\n            state->wnext += dist;\n            if (state->wnext == state->wsize) state->wnext = 0;\n            if (state->whave < state->wsize) state->whave += dist;\n        }\n    }\n    return 0;\n}\n\n/* Macros for inflate(): */\n\n/* check function to use adler32() for zlib or crc32() for gzip */\n#ifdef GUNZIP\n#  define UPDATE(check, buf, len) \\\n    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))\n#else\n#  define UPDATE(check, buf, len) adler32(check, buf, len)\n#endif\n\n/* check macros for header crc */\n#ifdef GUNZIP\n#  define CRC2(check, word) \\\n    do { \\\n        hbuf[0] = (unsigned char)(word); \\\n        hbuf[1] = (unsigned char)((word) >> 8); \\\n        check = crc32(check, hbuf, 2); \\\n    } while (0)\n\n#  define CRC4(check, word) \\\n    do { \\\n        hbuf[0] = (unsigned char)(word); \\\n        hbuf[1] = (unsigned char)((word) >> 8); \\\n        hbuf[2] = (unsigned char)((word) >> 16); \\\n        hbuf[3] = (unsigned char)((word) >> 24); \\\n        check = crc32(check, hbuf, 4); \\\n    } while (0)\n#endif\n\n/* Load registers with state in inflate() for speed */\n#define LOAD() \\\n    do { \\\n        put = strm->next_out; \\\n        left = strm->avail_out; \\\n        next = strm->next_in; \\\n        have = strm->avail_in; \\\n        hold = state->hold; \\\n        bits = state->bits; \\\n    } while (0)\n\n/* Restore state from registers in inflate() */\n#define RESTORE() \\\n    do { \\\n        strm->next_out = put; \\\n        strm->avail_out = left; \\\n        strm->next_in = next; \\\n        strm->avail_in = have; \\\n        state->hold = hold; \\\n        state->bits = bits; \\\n    } while (0)\n\n/* Clear the input bit accumulator */\n#define INITBITS() \\\n    do { \\\n        hold = 0; \\\n        bits = 0; \\\n    } while (0)\n\n/* Get a byte of input into the bit accumulator, or return from inflate()\n   if there is no input available. */\n#define PULLBYTE() \\\n    do { \\\n        if (have == 0) goto inf_leave; \\\n        have--; \\\n        hold += (unsigned long)(*next++) << bits; \\\n        bits += 8; \\\n    } while (0)\n\n/* Assure that there are at least n bits in the bit accumulator.  If there is\n   not enough available input to do that, then return from inflate(). */\n#define NEEDBITS(n) \\\n    do { \\\n        while (bits < (unsigned)(n)) \\\n            PULLBYTE(); \\\n    } while (0)\n\n/* Return the low n bits of the bit accumulator (n < 16) */\n#define BITS(n) \\\n    ((unsigned)hold & ((1U << (n)) - 1))\n\n/* Remove n bits from the bit accumulator */\n#define DROPBITS(n) \\\n    do { \\\n        hold >>= (n); \\\n        bits -= (unsigned)(n); \\\n    } while (0)\n\n/* Remove zero to seven bits as needed to go to a byte boundary */\n#define BYTEBITS() \\\n    do { \\\n        hold >>= bits & 7; \\\n        bits -= bits & 7; \\\n    } while (0)\n\n/* Reverse the bytes in a 32-bit value */\n#define REVERSE(q) \\\n    ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \\\n     (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))\n\n/*\n   inflate() uses a state machine to process as much input data and generate as\n   much output data as possible before returning.  The state machine is\n   structured roughly as follows:\n\n    for (;;) switch (state) {\n    ...\n    case STATEn:\n        if (not enough input data or output space to make progress)\n            return;\n        ... make progress ...\n        state = STATEm;\n        break;\n    ...\n    }\n\n   so when inflate() is called again, the same case is attempted again, and\n   if the appropriate resources are provided, the machine proceeds to the\n   next state.  The NEEDBITS() macro is usually the way the state evaluates\n   whether it can proceed or should return.  NEEDBITS() does the return if\n   the requested bits are not available.  The typical use of the BITS macros\n   is:\n\n        NEEDBITS(n);\n        ... do something with BITS(n) ...\n        DROPBITS(n);\n\n   where NEEDBITS(n) either returns from inflate() if there isn't enough\n   input left to load n bits into the accumulator, or it continues.  BITS(n)\n   gives the low n bits in the accumulator.  When done, DROPBITS(n) drops\n   the low n bits off the accumulator.  INITBITS() clears the accumulator\n   and sets the number of available bits to zero.  BYTEBITS() discards just\n   enough bits to put the accumulator on a byte boundary.  After BYTEBITS()\n   and a NEEDBITS(8), then BITS(8) would return the next byte in the stream.\n\n   NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return\n   if there is no input available.  The decoding of variable length codes uses\n   PULLBYTE() directly in order to pull just enough bytes to decode the next\n   code, and no more.\n\n   Some states loop until they get enough input, making sure that enough\n   state information is maintained to continue the loop where it left off\n   if NEEDBITS() returns in the loop.  For example, want, need, and keep\n   would all have to actually be part of the saved state in case NEEDBITS()\n   returns:\n\n    case STATEw:\n        while (want < need) {\n            NEEDBITS(n);\n            keep[want++] = BITS(n);\n            DROPBITS(n);\n        }\n        state = STATEx;\n    case STATEx:\n\n   As shown above, if the next state is also the next case, then the break\n   is omitted.\n\n   A state may also return if there is not enough output space available to\n   complete that state.  Those states are copying stored data, writing a\n   literal byte, and copying a matching string.\n\n   When returning, a \"goto inf_leave\" is used to update the total counters,\n   update the check value, and determine whether any progress has been made\n   during that inflate() call in order to return the proper return code.\n   Progress is defined as a change in either strm->avail_in or strm->avail_out.\n   When there is a window, goto inf_leave will update the window with the last\n   output written.  If a goto inf_leave occurs in the middle of decompression\n   and there is no window currently, goto inf_leave will create one and copy\n   output to the window for the next call of inflate().\n\n   In this implementation, the flush parameter of inflate() only affects the\n   return code (per zlib.h).  inflate() always writes as much as possible to\n   strm->next_out, given the space available and the provided input--the effect\n   documented in zlib.h of Z_SYNC_FLUSH.  Furthermore, inflate() always defers\n   the allocation of and copying into a sliding window until necessary, which\n   provides the effect documented in zlib.h for Z_FINISH when the entire input\n   stream available.  So the only thing the flush parameter actually does is:\n   when flush is set to Z_FINISH, inflate() cannot return Z_OK.  Instead it\n   will return Z_BUF_ERROR if it has not reached the end of the stream.\n */\n\nint ZEXPORT inflate(strm, flush)\nz_streamp strm;\nint flush;\n{\n    struct inflate_state FAR *state;\n    unsigned char FAR *next;    /* next input */\n    unsigned char FAR *put;     /* next output */\n    unsigned have, left;        /* available input and output */\n    unsigned long hold;         /* bit buffer */\n    unsigned bits;              /* bits in bit buffer */\n    unsigned in, out;           /* save starting available input and output */\n    unsigned copy;              /* number of stored or match bytes to copy */\n    unsigned char FAR *from;    /* where to copy match bytes from */\n    code here;                  /* current decoding table entry */\n    code last;                  /* parent table entry */\n    unsigned len;               /* length to copy for repeats, bits to drop */\n    int ret;                    /* return code */\n#ifdef GUNZIP\n    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */\n#endif\n    static const unsigned short order[19] = /* permutation of code lengths */\n        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};\n\n    if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL ||\n        (strm->next_in == Z_NULL && strm->avail_in != 0))\n        return Z_STREAM_ERROR;\n\n    state = (struct inflate_state FAR *)strm->state;\n    if (state->mode == TYPE) state->mode = TYPEDO;      /* skip check */\n    LOAD();\n    in = have;\n    out = left;\n    ret = Z_OK;\n    for (;;)\n        switch (state->mode) {\n        case HEAD:\n            if (state->wrap == 0) {\n                state->mode = TYPEDO;\n                break;\n            }\n            NEEDBITS(16);\n#ifdef GUNZIP\n            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */\n                state->check = crc32(0L, Z_NULL, 0);\n                CRC2(state->check, hold);\n                INITBITS();\n                state->mode = FLAGS;\n                break;\n            }\n            state->flags = 0;           /* expect zlib header */\n            if (state->head != Z_NULL)\n                state->head->done = -1;\n            if (!(state->wrap & 1) ||   /* check if zlib header allowed */\n#else\n            if (\n#endif\n                ((BITS(8) << 8) + (hold >> 8)) % 31) {\n                strm->msg = (char *)\"incorrect header check\";\n                state->mode = BAD;\n                break;\n            }\n            if (BITS(4) != Z_DEFLATED) {\n                strm->msg = (char *)\"unknown compression method\";\n                state->mode = BAD;\n                break;\n            }\n            DROPBITS(4);\n            len = BITS(4) + 8;\n            if (state->wbits == 0)\n                state->wbits = len;\n            else if (len > state->wbits) {\n                strm->msg = (char *)\"invalid window size\";\n                state->mode = BAD;\n                break;\n            }\n            state->dmax = 1U << len;\n            Tracev((stderr, \"inflate:   zlib header ok\\n\"));\n            strm->adler = state->check = adler32(0L, Z_NULL, 0);\n            state->mode = hold & 0x200 ? DICTID : TYPE;\n            INITBITS();\n            break;\n#ifdef GUNZIP\n        case FLAGS:\n            NEEDBITS(16);\n            state->flags = (int)(hold);\n            if ((state->flags & 0xff) != Z_DEFLATED) {\n                strm->msg = (char *)\"unknown compression method\";\n                state->mode = BAD;\n                break;\n            }\n            if (state->flags & 0xe000) {\n                strm->msg = (char *)\"unknown header flags set\";\n                state->mode = BAD;\n                break;\n            }\n            if (state->head != Z_NULL)\n                state->head->text = (int)((hold >> 8) & 1);\n            if (state->flags & 0x0200) CRC2(state->check, hold);\n            INITBITS();\n            state->mode = TIME;\n        case TIME:\n            NEEDBITS(32);\n            if (state->head != Z_NULL)\n                state->head->time = hold;\n            if (state->flags & 0x0200) CRC4(state->check, hold);\n            INITBITS();\n            state->mode = OS;\n        case OS:\n            NEEDBITS(16);\n            if (state->head != Z_NULL) {\n                state->head->xflags = (int)(hold & 0xff);\n                state->head->os = (int)(hold >> 8);\n            }\n            if (state->flags & 0x0200) CRC2(state->check, hold);\n            INITBITS();\n            state->mode = EXLEN;\n        case EXLEN:\n            if (state->flags & 0x0400) {\n                NEEDBITS(16);\n                state->length = (unsigned)(hold);\n                if (state->head != Z_NULL)\n                    state->head->extra_len = (unsigned)hold;\n                if (state->flags & 0x0200) CRC2(state->check, hold);\n                INITBITS();\n            }\n            else if (state->head != Z_NULL)\n                state->head->extra = Z_NULL;\n            state->mode = EXTRA;\n        case EXTRA:\n            if (state->flags & 0x0400) {\n                copy = state->length;\n                if (copy > have) copy = have;\n                if (copy) {\n                    if (state->head != Z_NULL &&\n                        state->head->extra != Z_NULL) {\n                        len = state->head->extra_len - state->length;\n                        zmemcpy(state->head->extra + len, next,\n                                len + copy > state->head->extra_max ?\n                                state->head->extra_max - len : copy);\n                    }\n                    if (state->flags & 0x0200)\n                        state->check = crc32(state->check, next, copy);\n                    have -= copy;\n                    next += copy;\n                    state->length -= copy;\n                }\n                if (state->length) goto inf_leave;\n            }\n            state->length = 0;\n            state->mode = NAME;\n        case NAME:\n            if (state->flags & 0x0800) {\n                if (have == 0) goto inf_leave;\n                copy = 0;\n                do {\n                    len = (unsigned)(next[copy++]);\n                    if (state->head != Z_NULL &&\n                            state->head->name != Z_NULL &&\n                            state->length < state->head->name_max)\n                        state->head->name[state->length++] = len;\n                } while (len && copy < have);\n                if (state->flags & 0x0200)\n                    state->check = crc32(state->check, next, copy);\n                have -= copy;\n                next += copy;\n                if (len) goto inf_leave;\n            }\n            else if (state->head != Z_NULL)\n                state->head->name = Z_NULL;\n            state->length = 0;\n            state->mode = COMMENT;\n        case COMMENT:\n            if (state->flags & 0x1000) {\n                if (have == 0) goto inf_leave;\n                copy = 0;\n                do {\n                    len = (unsigned)(next[copy++]);\n                    if (state->head != Z_NULL &&\n                            state->head->comment != Z_NULL &&\n                            state->length < state->head->comm_max)\n                        state->head->comment[state->length++] = len;\n                } while (len && copy < have);\n                if (state->flags & 0x0200)\n                    state->check = crc32(state->check, next, copy);\n                have -= copy;\n                next += copy;\n                if (len) goto inf_leave;\n            }\n            else if (state->head != Z_NULL)\n                state->head->comment = Z_NULL;\n            state->mode = HCRC;\n        case HCRC:\n            if (state->flags & 0x0200) {\n                NEEDBITS(16);\n                if (hold != (state->check & 0xffff)) {\n                    strm->msg = (char *)\"header crc mismatch\";\n                    state->mode = BAD;\n                    break;\n                }\n                INITBITS();\n            }\n            if (state->head != Z_NULL) {\n                state->head->hcrc = (int)((state->flags >> 9) & 1);\n                state->head->done = 1;\n            }\n            strm->adler = state->check = crc32(0L, Z_NULL, 0);\n            state->mode = TYPE;\n            break;\n#endif\n        case DICTID:\n            NEEDBITS(32);\n            strm->adler = state->check = REVERSE(hold);\n            INITBITS();\n            state->mode = DICT;\n        case DICT:\n            if (state->havedict == 0) {\n                RESTORE();\n                return Z_NEED_DICT;\n            }\n            strm->adler = state->check = adler32(0L, Z_NULL, 0);\n            state->mode = TYPE;\n        case TYPE:\n            if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;\n        case TYPEDO:\n            if (state->last) {\n                BYTEBITS();\n                state->mode = CHECK;\n                break;\n            }\n            NEEDBITS(3);\n            state->last = BITS(1);\n            DROPBITS(1);\n            switch (BITS(2)) {\n            case 0:                             /* stored block */\n                Tracev((stderr, \"inflate:     stored block%s\\n\",\n                        state->last ? \" (last)\" : \"\"));\n                state->mode = STORED;\n                break;\n            case 1:                             /* fixed block */\n                fixedtables(state);\n                Tracev((stderr, \"inflate:     fixed codes block%s\\n\",\n                        state->last ? \" (last)\" : \"\"));\n                state->mode = LEN_;             /* decode codes */\n                if (flush == Z_TREES) {\n                    DROPBITS(2);\n                    goto inf_leave;\n                }\n                break;\n            case 2:                             /* dynamic block */\n                Tracev((stderr, \"inflate:     dynamic codes block%s\\n\",\n                        state->last ? \" (last)\" : \"\"));\n                state->mode = TABLE;\n                break;\n            case 3:\n                strm->msg = (char *)\"invalid block type\";\n                state->mode = BAD;\n            }\n            DROPBITS(2);\n            break;\n        case STORED:\n            BYTEBITS();                         /* go to byte boundary */\n            NEEDBITS(32);\n            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {\n                strm->msg = (char *)\"invalid stored block lengths\";\n                state->mode = BAD;\n                break;\n            }\n            state->length = (unsigned)hold & 0xffff;\n            Tracev((stderr, \"inflate:       stored length %u\\n\",\n                    state->length));\n            INITBITS();\n            state->mode = COPY_;\n            if (flush == Z_TREES) goto inf_leave;\n        case COPY_:\n            state->mode = COPY;\n        case COPY:\n            copy = state->length;\n            if (copy) {\n                if (copy > have) copy = have;\n                if (copy > left) copy = left;\n                if (copy == 0) goto inf_leave;\n                zmemcpy(put, next, copy);\n                have -= copy;\n                next += copy;\n                left -= copy;\n                put += copy;\n                state->length -= copy;\n                break;\n            }\n            Tracev((stderr, \"inflate:       stored end\\n\"));\n            state->mode = TYPE;\n            break;\n        case TABLE:\n            NEEDBITS(14);\n            state->nlen = BITS(5) + 257;\n            DROPBITS(5);\n            state->ndist = BITS(5) + 1;\n            DROPBITS(5);\n            state->ncode = BITS(4) + 4;\n            DROPBITS(4);\n#ifndef PKZIP_BUG_WORKAROUND\n            if (state->nlen > 286 || state->ndist > 30) {\n                strm->msg = (char *)\"too many length or distance symbols\";\n                state->mode = BAD;\n                break;\n            }\n#endif\n            Tracev((stderr, \"inflate:       table sizes ok\\n\"));\n            state->have = 0;\n            state->mode = LENLENS;\n        case LENLENS:\n            while (state->have < state->ncode) {\n                NEEDBITS(3);\n                state->lens[order[state->have++]] = (unsigned short)BITS(3);\n                DROPBITS(3);\n            }\n            while (state->have < 19)\n                state->lens[order[state->have++]] = 0;\n            state->next = state->codes;\n            state->lencode = (code const FAR *)(state->next);\n            state->lenbits = 7;\n            ret = inflate_table(CODES, state->lens, 19, &(state->next),\n                                &(state->lenbits), state->work);\n            if (ret) {\n                strm->msg = (char *)\"invalid code lengths set\";\n                state->mode = BAD;\n                break;\n            }\n            Tracev((stderr, \"inflate:       code lengths ok\\n\"));\n            state->have = 0;\n            state->mode = CODELENS;\n        case CODELENS:\n            while (state->have < state->nlen + state->ndist) {\n                for (;;) {\n                    here = state->lencode[BITS(state->lenbits)];\n                    if ((unsigned)(here.bits) <= bits) break;\n                    PULLBYTE();\n                }\n                if (here.val < 16) {\n                    NEEDBITS(here.bits);\n                    DROPBITS(here.bits);\n                    state->lens[state->have++] = here.val;\n                }\n                else {\n                    if (here.val == 16) {\n                        NEEDBITS(here.bits + 2);\n                        DROPBITS(here.bits);\n                        if (state->have == 0) {\n                            strm->msg = (char *)\"invalid bit length repeat\";\n                            state->mode = BAD;\n                            break;\n                        }\n                        len = state->lens[state->have - 1];\n                        copy = 3 + BITS(2);\n                        DROPBITS(2);\n                    }\n                    else if (here.val == 17) {\n                        NEEDBITS(here.bits + 3);\n                        DROPBITS(here.bits);\n                        len = 0;\n                        copy = 3 + BITS(3);\n                        DROPBITS(3);\n                    }\n                    else {\n                        NEEDBITS(here.bits + 7);\n                        DROPBITS(here.bits);\n                        len = 0;\n                        copy = 11 + BITS(7);\n                        DROPBITS(7);\n                    }\n                    if (state->have + copy > state->nlen + state->ndist) {\n                        strm->msg = (char *)\"invalid bit length repeat\";\n                        state->mode = BAD;\n                        break;\n                    }\n                    while (copy--)\n                        state->lens[state->have++] = (unsigned short)len;\n                }\n            }\n\n            /* handle error breaks in while */\n            if (state->mode == BAD) break;\n\n            /* check for end-of-block code (better have one) */\n            if (state->lens[256] == 0) {\n                strm->msg = (char *)\"invalid code -- missing end-of-block\";\n                state->mode = BAD;\n                break;\n            }\n\n            /* build code tables -- note: do not change the lenbits or distbits\n               values here (9 and 6) without reading the comments in inftrees.h\n               concerning the ENOUGH constants, which depend on those values */\n            state->next = state->codes;\n            state->lencode = (code const FAR *)(state->next);\n            state->lenbits = 9;\n            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),\n                                &(state->lenbits), state->work);\n            if (ret) {\n                strm->msg = (char *)\"invalid literal/lengths set\";\n                state->mode = BAD;\n                break;\n            }\n            state->distcode = (code const FAR *)(state->next);\n            state->distbits = 6;\n            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,\n                            &(state->next), &(state->distbits), state->work);\n            if (ret) {\n                strm->msg = (char *)\"invalid distances set\";\n                state->mode = BAD;\n                break;\n            }\n            Tracev((stderr, \"inflate:       codes ok\\n\"));\n            state->mode = LEN_;\n            if (flush == Z_TREES) goto inf_leave;\n        case LEN_:\n            state->mode = LEN;\n        case LEN:\n            if (have >= 6 && left >= 258) {\n                RESTORE();\n                inflate_fast(strm, out);\n                LOAD();\n                if (state->mode == TYPE)\n                    state->back = -1;\n                break;\n            }\n            state->back = 0;\n            for (;;) {\n                here = state->lencode[BITS(state->lenbits)];\n                if ((unsigned)(here.bits) <= bits) break;\n                PULLBYTE();\n            }\n            if (here.op && (here.op & 0xf0) == 0) {\n                last = here;\n                for (;;) {\n                    here = state->lencode[last.val +\n                            (BITS(last.bits + last.op) >> last.bits)];\n                    if ((unsigned)(last.bits + here.bits) <= bits) break;\n                    PULLBYTE();\n                }\n                DROPBITS(last.bits);\n                state->back += last.bits;\n            }\n            DROPBITS(here.bits);\n            state->back += here.bits;\n            state->length = (unsigned)here.val;\n            if ((int)(here.op) == 0) {\n                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n                        \"inflate:         literal '%c'\\n\" :\n                        \"inflate:         literal 0x%02x\\n\", here.val));\n                state->mode = LIT;\n                break;\n            }\n            if (here.op & 32) {\n                Tracevv((stderr, \"inflate:         end of block\\n\"));\n                state->back = -1;\n                state->mode = TYPE;\n                break;\n            }\n            if (here.op & 64) {\n                strm->msg = (char *)\"invalid literal/length code\";\n                state->mode = BAD;\n                break;\n            }\n            state->extra = (unsigned)(here.op) & 15;\n            state->mode = LENEXT;\n        case LENEXT:\n            if (state->extra) {\n                NEEDBITS(state->extra);\n                state->length += BITS(state->extra);\n                DROPBITS(state->extra);\n                state->back += state->extra;\n            }\n            Tracevv((stderr, \"inflate:         length %u\\n\", state->length));\n            state->was = state->length;\n            state->mode = DIST;\n        case DIST:\n            for (;;) {\n                here = state->distcode[BITS(state->distbits)];\n                if ((unsigned)(here.bits) <= bits) break;\n                PULLBYTE();\n            }\n            if ((here.op & 0xf0) == 0) {\n                last = here;\n                for (;;) {\n                    here = state->distcode[last.val +\n                            (BITS(last.bits + last.op) >> last.bits)];\n                    if ((unsigned)(last.bits + here.bits) <= bits) break;\n                    PULLBYTE();\n                }\n                DROPBITS(last.bits);\n                state->back += last.bits;\n            }\n            DROPBITS(here.bits);\n            state->back += here.bits;\n            if (here.op & 64) {\n                strm->msg = (char *)\"invalid distance code\";\n                state->mode = BAD;\n                break;\n            }\n            state->offset = (unsigned)here.val;\n            state->extra = (unsigned)(here.op) & 15;\n            state->mode = DISTEXT;\n        case DISTEXT:\n            if (state->extra) {\n                NEEDBITS(state->extra);\n                state->offset += BITS(state->extra);\n                DROPBITS(state->extra);\n                state->back += state->extra;\n            }\n#ifdef INFLATE_STRICT\n            if (state->offset > state->dmax) {\n                strm->msg = (char *)\"invalid distance too far back\";\n                state->mode = BAD;\n                break;\n            }\n#endif\n            Tracevv((stderr, \"inflate:         distance %u\\n\", state->offset));\n            state->mode = MATCH;\n        case MATCH:\n            if (left == 0) goto inf_leave;\n            copy = out - left;\n            if (state->offset > copy) {         /* copy from window */\n                copy = state->offset - copy;\n                if (copy > state->whave) {\n                    if (state->sane) {\n                        strm->msg = (char *)\"invalid distance too far back\";\n                        state->mode = BAD;\n                        break;\n                    }\n#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n                    Trace((stderr, \"inflate.c too far\\n\"));\n                    copy -= state->whave;\n                    if (copy > state->length) copy = state->length;\n                    if (copy > left) copy = left;\n                    left -= copy;\n                    state->length -= copy;\n                    do {\n                        *put++ = 0;\n                    } while (--copy);\n                    if (state->length == 0) state->mode = LEN;\n                    break;\n#endif\n                }\n                if (copy > state->wnext) {\n                    copy -= state->wnext;\n                    from = state->window + (state->wsize - copy);\n                }\n                else\n                    from = state->window + (state->wnext - copy);\n                if (copy > state->length) copy = state->length;\n            }\n            else {                              /* copy from output */\n                from = put - state->offset;\n                copy = state->length;\n            }\n            if (copy > left) copy = left;\n            left -= copy;\n            state->length -= copy;\n            do {\n                *put++ = *from++;\n            } while (--copy);\n            if (state->length == 0) state->mode = LEN;\n            break;\n        case LIT:\n            if (left == 0) goto inf_leave;\n            *put++ = (unsigned char)(state->length);\n            left--;\n            state->mode = LEN;\n            break;\n        case CHECK:\n            if (state->wrap) {\n                NEEDBITS(32);\n                out -= left;\n                strm->total_out += out;\n                state->total += out;\n                if (out)\n                    strm->adler = state->check =\n                        UPDATE(state->check, put - out, out);\n                out = left;\n                if ((\n#ifdef GUNZIP\n                     state->flags ? hold :\n#endif\n                     REVERSE(hold)) != state->check) {\n                    strm->msg = (char *)\"incorrect data check\";\n                    state->mode = BAD;\n                    break;\n                }\n                INITBITS();\n                Tracev((stderr, \"inflate:   check matches trailer\\n\"));\n            }\n#ifdef GUNZIP\n            state->mode = LENGTH;\n        case LENGTH:\n            if (state->wrap && state->flags) {\n                NEEDBITS(32);\n                if (hold != (state->total & 0xffffffffUL)) {\n                    strm->msg = (char *)\"incorrect length check\";\n                    state->mode = BAD;\n                    break;\n                }\n                INITBITS();\n                Tracev((stderr, \"inflate:   length matches trailer\\n\"));\n            }\n#endif\n            state->mode = DONE;\n        case DONE:\n            ret = Z_STREAM_END;\n            goto inf_leave;\n        case BAD:\n            ret = Z_DATA_ERROR;\n            goto inf_leave;\n        case MEM:\n            return Z_MEM_ERROR;\n        case SYNC:\n        default:\n            return Z_STREAM_ERROR;\n        }\n\n    /*\n       Return from inflate(), updating the total counts and the check value.\n       If there was no progress during the inflate() call, return a buffer\n       error.  Call updatewindow() to create and/or update the window state.\n       Note: a memory error from inflate() is non-recoverable.\n     */\n  inf_leave:\n    RESTORE();\n    if (state->wsize || (state->mode < CHECK && out != strm->avail_out))\n        if (updatewindow(strm, out)) {\n            state->mode = MEM;\n            return Z_MEM_ERROR;\n        }\n    in -= strm->avail_in;\n    out -= strm->avail_out;\n    strm->total_in += in;\n    strm->total_out += out;\n    state->total += out;\n    if (state->wrap && out)\n        strm->adler = state->check =\n            UPDATE(state->check, strm->next_out - out, out);\n    strm->data_type = state->bits + (state->last ? 64 : 0) +\n                      (state->mode == TYPE ? 128 : 0) +\n                      (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);\n    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)\n        ret = Z_BUF_ERROR;\n    return ret;\n}\n\nint ZEXPORT inflateEnd(strm)\nz_streamp strm;\n{\n    struct inflate_state FAR *state;\n    if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)\n        return Z_STREAM_ERROR;\n    state = (struct inflate_state FAR *)strm->state;\n    if (state->window != Z_NULL) ZFREE(strm, state->window);\n    ZFREE(strm, strm->state);\n    strm->state = Z_NULL;\n    Tracev((stderr, \"inflate: end\\n\"));\n    return Z_OK;\n}\n\nint ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)\nz_streamp strm;\nconst Bytef *dictionary;\nuInt dictLength;\n{\n    struct inflate_state FAR *state;\n    unsigned long id;\n\n    /* check state */\n    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;\n    state = (struct inflate_state FAR *)strm->state;\n    if (state->wrap != 0 && state->mode != DICT)\n        return Z_STREAM_ERROR;\n\n    /* check for correct dictionary id */\n    if (state->mode == DICT) {\n        id = adler32(0L, Z_NULL, 0);\n        id = adler32(id, dictionary, dictLength);\n        if (id != state->check)\n            return Z_DATA_ERROR;\n    }\n\n    /* copy dictionary to window */\n    if (updatewindow(strm, strm->avail_out)) {\n        state->mode = MEM;\n        return Z_MEM_ERROR;\n    }\n    if (dictLength > state->wsize) {\n        zmemcpy(state->window, dictionary + dictLength - state->wsize,\n                state->wsize);\n        state->whave = state->wsize;\n    }\n    else {\n        zmemcpy(state->window + state->wsize - dictLength, dictionary,\n                dictLength);\n        state->whave = dictLength;\n    }\n    state->havedict = 1;\n    Tracev((stderr, \"inflate:   dictionary set\\n\"));\n    return Z_OK;\n}\n\nint ZEXPORT inflateGetHeader(strm, head)\nz_streamp strm;\ngz_headerp head;\n{\n    struct inflate_state FAR *state;\n\n    /* check state */\n    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;\n    state = (struct inflate_state FAR *)strm->state;\n    if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;\n\n    /* save header structure */\n    state->head = head;\n    head->done = 0;\n    return Z_OK;\n}\n\n/*\n   Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff.  Return when found\n   or when out of input.  When called, *have is the number of pattern bytes\n   found in order so far, in 0..3.  On return *have is updated to the new\n   state.  If on return *have equals four, then the pattern was found and the\n   return value is how many bytes were read including the last byte of the\n   pattern.  If *have is less than four, then the pattern has not been found\n   yet and the return value is len.  In the latter case, syncsearch() can be\n   called again with more data and the *have state.  *have is initialized to\n   zero for the first call.\n */\nlocal unsigned syncsearch(have, buf, len)\nunsigned FAR *have;\nunsigned char FAR *buf;\nunsigned len;\n{\n    unsigned got;\n    unsigned next;\n\n    got = *have;\n    next = 0;\n    while (next < len && got < 4) {\n        if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))\n            got++;\n        else if (buf[next])\n            got = 0;\n        else\n            got = 4 - got;\n        next++;\n    }\n    *have = got;\n    return next;\n}\n\nint ZEXPORT inflateSync(strm)\nz_streamp strm;\n{\n    unsigned len;               /* number of bytes to look at or looked at */\n    unsigned long in, out;      /* temporary to save total_in and total_out */\n    unsigned char buf[4];       /* to restore bit buffer to byte string */\n    struct inflate_state FAR *state;\n\n    /* check parameters */\n    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;\n    state = (struct inflate_state FAR *)strm->state;\n    if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;\n\n    /* if first time, start search in bit buffer */\n    if (state->mode != SYNC) {\n        state->mode = SYNC;\n        state->hold <<= state->bits & 7;\n        state->bits -= state->bits & 7;\n        len = 0;\n        while (state->bits >= 8) {\n            buf[len++] = (unsigned char)(state->hold);\n            state->hold >>= 8;\n            state->bits -= 8;\n        }\n        state->have = 0;\n        syncsearch(&(state->have), buf, len);\n    }\n\n    /* search available input */\n    len = syncsearch(&(state->have), strm->next_in, strm->avail_in);\n    strm->avail_in -= len;\n    strm->next_in += len;\n    strm->total_in += len;\n\n    /* return no joy or set up to restart inflate() on a new block */\n    if (state->have != 4) return Z_DATA_ERROR;\n    in = strm->total_in;  out = strm->total_out;\n    inflateReset(strm);\n    strm->total_in = in;  strm->total_out = out;\n    state->mode = TYPE;\n    return Z_OK;\n}\n\n/*\n   Returns true if inflate is currently at the end of a block generated by\n   Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP\n   implementation to provide an additional safety check. PPP uses\n   Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored\n   block. When decompressing, PPP checks that at the end of input packet,\n   inflate is waiting for these length bytes.\n */\nint ZEXPORT inflateSyncPoint(strm)\nz_streamp strm;\n{\n    struct inflate_state FAR *state;\n\n    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;\n    state = (struct inflate_state FAR *)strm->state;\n    return state->mode == STORED && state->bits == 0;\n}\n\nint ZEXPORT inflateCopy(dest, source)\nz_streamp dest;\nz_streamp source;\n{\n    struct inflate_state FAR *state;\n    struct inflate_state FAR *copy;\n    unsigned char FAR *window;\n    unsigned wsize;\n\n    /* check input */\n    if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||\n        source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)\n        return Z_STREAM_ERROR;\n    state = (struct inflate_state FAR *)source->state;\n\n    /* allocate space */\n    copy = (struct inflate_state FAR *)\n           ZALLOC(source, 1, sizeof(struct inflate_state));\n    if (copy == Z_NULL) return Z_MEM_ERROR;\n    window = Z_NULL;\n    if (state->window != Z_NULL) {\n        window = (unsigned char FAR *)\n                 ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));\n        if (window == Z_NULL) {\n            ZFREE(source, copy);\n            return Z_MEM_ERROR;\n        }\n    }\n\n    /* copy state */\n    zmemcpy(dest, source, sizeof(z_stream));\n    zmemcpy(copy, state, sizeof(struct inflate_state));\n    if (state->lencode >= state->codes &&\n        state->lencode <= state->codes + ENOUGH - 1) {\n        copy->lencode = copy->codes + (state->lencode - state->codes);\n        copy->distcode = copy->codes + (state->distcode - state->codes);\n    }\n    copy->next = copy->codes + (state->next - state->codes);\n    if (window != Z_NULL) {\n        wsize = 1U << state->wbits;\n        zmemcpy(window, state->window, wsize);\n    }\n    copy->window = window;\n    dest->state = (struct internal_state FAR *)copy;\n    return Z_OK;\n}\n\nint ZEXPORT inflateUndermine(strm, subvert)\nz_streamp strm;\nint subvert;\n{\n    struct inflate_state FAR *state;\n\n    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;\n    state = (struct inflate_state FAR *)strm->state;\n    state->sane = !subvert;\n#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n    return Z_OK;\n#else\n    state->sane = 1;\n    return Z_DATA_ERROR;\n#endif\n}\n\nlong ZEXPORT inflateMark(strm)\nz_streamp strm;\n{\n    struct inflate_state FAR *state;\n\n    if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;\n    state = (struct inflate_state FAR *)strm->state;\n    return ((long)(state->back) << 16) +\n        (state->mode == COPY ? state->length :\n            (state->mode == MATCH ? state->was - state->length : 0));\n}\n"},{"id":16727,"name":"crc32.c","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* crc32.c -- compute the CRC-32 of a data stream\n * Copyright (C) 1995-2006, 2010 Mark Adler\n * For conditions of distribution and use, see copyright notice in zlib.h\n *\n * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster\n * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing\n * tables for updating the shift register in one step with three exclusive-ors\n * instead of four steps with four exclusive-ors.  This results in about a\n * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.\n */\n\n/*\n  Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore\n  protection on the static variables used to control the first-use generation\n  of the crc tables.  Therefore, if you #define DYNAMIC_CRC_TABLE, you should\n  first call get_crc_table() to initialize the tables before allowing more than\n  one thread to use crc32().\n */\n\n#ifdef MAKECRCH\n#  include <stdio.h>\n#  ifndef DYNAMIC_CRC_TABLE\n#    define DYNAMIC_CRC_TABLE\n#  endif /* !DYNAMIC_CRC_TABLE */\n#endif /* MAKECRCH */\n\n#include \"zutil.h\"      /* for STDC and FAR definitions */\n\n#define local static\n\n/* Find a four-byte integer type for crc32_little() and crc32_big(). */\n#ifndef NOBYFOUR\n#  ifdef STDC           /* need ANSI C limits.h to determine sizes */\n#    include <limits.h>\n#    define BYFOUR\n#    if (UINT_MAX == 0xffffffffUL)\n       typedef unsigned int u4;\n#    else\n#      if (ULONG_MAX == 0xffffffffUL)\n         typedef unsigned long u4;\n#      else\n#        if (USHRT_MAX == 0xffffffffUL)\n           typedef unsigned short u4;\n#        else\n#          undef BYFOUR     /* can't find a four-byte integer type! */\n#        endif\n#      endif\n#    endif\n#  endif /* STDC */\n#endif /* !NOBYFOUR */\n\n/* Definitions for doing the crc four data bytes at a time. */\n#ifdef BYFOUR\n#  define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \\\n                (((w)&0xff00)<<8)+(((w)&0xff)<<24))\n   local unsigned long crc32_little OF((unsigned long,\n                        const unsigned char FAR *, unsigned));\n   local unsigned long crc32_big OF((unsigned long,\n                        const unsigned char FAR *, unsigned));\n#  define TBLS 8\n#else\n#  define TBLS 1\n#endif /* BYFOUR */\n\n/* Local functions for crc concatenation */\nlocal unsigned long gf2_matrix_times OF((unsigned long *mat,\n                                         unsigned long vec));\nlocal void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));\nlocal uLong crc32_combine_(uLong crc1, uLong crc2, z_off64_t len2);\n\n\n#ifdef DYNAMIC_CRC_TABLE\n\nlocal volatile int crc_table_empty = 1;\nlocal unsigned long FAR crc_table[TBLS][256];\nlocal void make_crc_table OF((void));\n#ifdef MAKECRCH\n   local void write_table OF((FILE *, const unsigned long FAR *));\n#endif /* MAKECRCH */\n/*\n  Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:\n  x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.\n\n  Polynomials over GF(2) are represented in binary, one bit per coefficient,\n  with the lowest powers in the most significant bit.  Then adding polynomials\n  is just exclusive-or, and multiplying a polynomial by x is a right shift by\n  one.  If we call the above polynomial p, and represent a byte as the\n  polynomial q, also with the lowest power in the most significant bit (so the\n  byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,\n  where a mod b means the remainder after dividing a by b.\n\n  This calculation is done using the shift-register method of multiplying and\n  taking the remainder.  The register is initialized to zero, and for each\n  incoming bit, x^32 is added mod p to the register if the bit is a one (where\n  x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by\n  x (which is shifting right by one and adding x^32 mod p if the bit shifted\n  out is a one).  We start with the highest power (least significant bit) of\n  q and repeat for all eight bits of q.\n\n  The first table is simply the CRC of all possible eight bit values.  This is\n  all the information needed to generate CRCs on data a byte at a time for all\n  combinations of CRC register values and incoming bytes.  The remaining tables\n  allow for word-at-a-time CRC calculation for both big-endian and little-\n  endian machines, where a word is four bytes.\n*/\nlocal void make_crc_table()\n{\n    unsigned long c;\n    int n, k;\n    unsigned long poly;                 /* polynomial exclusive-or pattern */\n    /* terms of polynomial defining this crc (except x^32): */\n    static volatile int first = 1;      /* flag to limit concurrent making */\n    static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};\n\n    /* See if another task is already doing this (not thread-safe, but better\n       than nothing -- significantly reduces duration of vulnerability in\n       case the advice about DYNAMIC_CRC_TABLE is ignored) */\n    if (first) {\n        first = 0;\n\n        /* make exclusive-or pattern from polynomial (0xedb88320UL) */\n        poly = 0UL;\n        for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)\n            poly |= 1UL << (31 - p[n]);\n\n        /* generate a crc for every 8-bit value */\n        for (n = 0; n < 256; n++) {\n            c = (unsigned long)n;\n            for (k = 0; k < 8; k++)\n                c = c & 1 ? poly ^ (c >> 1) : c >> 1;\n            crc_table[0][n] = c;\n        }\n\n#ifdef BYFOUR\n        /* generate crc for each value followed by one, two, and three zeros,\n           and then the byte reversal of those as well as the first table */\n        for (n = 0; n < 256; n++) {\n            c = crc_table[0][n];\n            crc_table[4][n] = REV(c);\n            for (k = 1; k < 4; k++) {\n                c = crc_table[0][c & 0xff] ^ (c >> 8);\n                crc_table[k][n] = c;\n                crc_table[k + 4][n] = REV(c);\n            }\n        }\n#endif /* BYFOUR */\n\n        crc_table_empty = 0;\n    }\n    else {      /* not first */\n        /* wait for the other guy to finish (not efficient, but rare) */\n        while (crc_table_empty)\n            ;\n    }\n\n#ifdef MAKECRCH\n    /* write out CRC tables to crc32.h */\n    {\n        FILE *out;\n\n        out = fopen(\"crc32.h\", \"w\");\n        if (out == NULL) return;\n        fprintf(out, \"/* crc32.h -- tables for rapid CRC calculation\\n\");\n        fprintf(out, \" * Generated automatically by crc32.c\\n */\\n\\n\");\n        fprintf(out, \"local const unsigned long FAR \");\n        fprintf(out, \"crc_table[TBLS][256] =\\n{\\n  {\\n\");\n        write_table(out, crc_table[0]);\n#  ifdef BYFOUR\n        fprintf(out, \"#ifdef BYFOUR\\n\");\n        for (k = 1; k < 8; k++) {\n            fprintf(out, \"  },\\n  {\\n\");\n            write_table(out, crc_table[k]);\n        }\n        fprintf(out, \"#endif\\n\");\n#  endif /* BYFOUR */\n        fprintf(out, \"  }\\n};\\n\");\n        fclose(out);\n    }\n#endif /* MAKECRCH */\n}\n\n#ifdef MAKECRCH\nlocal void write_table(out, table)\n    FILE *out;\n    const unsigned long FAR *table;\n{\n    int n;\n\n    for (n = 0; n < 256; n++)\n        fprintf(out, \"%s0x%08lxUL%s\", n % 5 ? \"\" : \"    \", table[n],\n                n == 255 ? \"\\n\" : (n % 5 == 4 ? \",\\n\" : \", \"));\n}\n#endif /* MAKECRCH */\n\n#else /* !DYNAMIC_CRC_TABLE */\n/* ========================================================================\n * Tables of CRC-32s of all single-byte values, made by make_crc_table().\n */\n#include \"crc32.h\"\n#endif /* DYNAMIC_CRC_TABLE */\n\n/* =========================================================================\n * This function can be used by asm versions of crc32()\n */\nconst unsigned long FAR * ZEXPORT get_crc_table()\n{\n#ifdef DYNAMIC_CRC_TABLE\n    if (crc_table_empty)\n        make_crc_table();\n#endif /* DYNAMIC_CRC_TABLE */\n    return (const unsigned long FAR *)crc_table;\n}\n\n/* ========================================================================= */\n#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)\n#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1\n\n/* ========================================================================= */\nunsigned long ZEXPORT crc32(crc, buf, len)\n    unsigned long crc;\n    const unsigned char FAR *buf;\n    uInt len;\n{\n    if (buf == Z_NULL) return 0UL;\n\n#ifdef DYNAMIC_CRC_TABLE\n    if (crc_table_empty)\n        make_crc_table();\n#endif /* DYNAMIC_CRC_TABLE */\n\n#ifdef BYFOUR\n    if (sizeof(void *) == sizeof(ptrdiff_t)) {\n        u4 endian;\n\n        endian = 1;\n        if (*((unsigned char *)(&endian)))\n            return crc32_little(crc, buf, len);\n        else\n            return crc32_big(crc, buf, len);\n    }\n#endif /* BYFOUR */\n    crc = crc ^ 0xffffffffUL;\n    while (len >= 8) {\n        DO8;\n        len -= 8;\n    }\n    if (len) do {\n        DO1;\n    } while (--len);\n    return crc ^ 0xffffffffUL;\n}\n\n#ifdef BYFOUR\n\n/* ========================================================================= */\n#define DOLIT4 c ^= *buf4++; \\\n        c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \\\n            crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]\n#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4\n\n/* ========================================================================= */\nlocal unsigned long crc32_little(crc, buf, len)\n    unsigned long crc;\n    const unsigned char FAR *buf;\n    unsigned len;\n{\n    register u4 c;\n    register const u4 FAR *buf4;\n\n    c = (u4)crc;\n    c = ~c;\n    while (len && ((ptrdiff_t)buf & 3)) {\n        c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);\n        len--;\n    }\n\n    buf4 = (const u4 FAR *)(const void FAR *)buf;\n    while (len >= 32) {\n        DOLIT32;\n        len -= 32;\n    }\n    while (len >= 4) {\n        DOLIT4;\n        len -= 4;\n    }\n    buf = (const unsigned char FAR *)buf4;\n\n    if (len) do {\n        c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);\n    } while (--len);\n    c = ~c;\n    return (unsigned long)c;\n}\n\n/* ========================================================================= */\n#define DOBIG4 c ^= *++buf4; \\\n        c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \\\n            crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]\n#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4\n\n/* ========================================================================= */\nlocal unsigned long crc32_big(crc, buf, len)\n    unsigned long crc;\n    const unsigned char FAR *buf;\n    unsigned len;\n{\n    register u4 c;\n    register const u4 FAR *buf4;\n\n    c = REV((u4)crc);\n    c = ~c;\n    while (len && ((ptrdiff_t)buf & 3)) {\n        c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);\n        len--;\n    }\n\n    buf4 = (const u4 FAR *)(const void FAR *)buf;\n    buf4--;\n    while (len >= 32) {\n        DOBIG32;\n        len -= 32;\n    }\n    while (len >= 4) {\n        DOBIG4;\n        len -= 4;\n    }\n    buf4++;\n    buf = (const unsigned char FAR *)buf4;\n\n    if (len) do {\n        c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);\n    } while (--len);\n    c = ~c;\n    return (unsigned long)(REV(c));\n}\n\n#endif /* BYFOUR */\n\n#define GF2_DIM 32      /* dimension of GF(2) vectors (length of CRC) */\n\n/* ========================================================================= */\nlocal unsigned long gf2_matrix_times(mat, vec)\n    unsigned long *mat;\n    unsigned long vec;\n{\n    unsigned long sum;\n\n    sum = 0;\n    while (vec) {\n        if (vec & 1)\n            sum ^= *mat;\n        vec >>= 1;\n        mat++;\n    }\n    return sum;\n}\n\n/* ========================================================================= */\nlocal void gf2_matrix_square(square, mat)\n    unsigned long *square;\n    unsigned long *mat;\n{\n    int n;\n\n    for (n = 0; n < GF2_DIM; n++)\n        square[n] = gf2_matrix_times(mat, mat[n]);\n}\n\n/* ========================================================================= */\nlocal uLong crc32_combine_(crc1, crc2, len2)\n    uLong crc1;\n    uLong crc2;\n    z_off64_t len2;\n{\n    int n;\n    unsigned long row;\n    unsigned long even[GF2_DIM];    /* even-power-of-two zeros operator */\n    unsigned long odd[GF2_DIM];     /* odd-power-of-two zeros operator */\n\n    /* degenerate case (also disallow negative lengths) */\n    if (len2 <= 0)\n        return crc1;\n\n    /* put operator for one zero bit in odd */\n    odd[0] = 0xedb88320UL;          /* CRC-32 polynomial */\n    row = 1;\n    for (n = 1; n < GF2_DIM; n++) {\n        odd[n] = row;\n        row <<= 1;\n    }\n\n    /* put operator for two zero bits in even */\n    gf2_matrix_square(even, odd);\n\n    /* put operator for four zero bits in odd */\n    gf2_matrix_square(odd, even);\n\n    /* apply len2 zeros to crc1 (first square will put the operator for one\n       zero byte, eight zero bits, in even) */\n    do {\n        /* apply zeros operator for this bit of len2 */\n        gf2_matrix_square(even, odd);\n        if (len2 & 1)\n            crc1 = gf2_matrix_times(even, crc1);\n        len2 >>= 1;\n\n        /* if no more bits set, then done */\n        if (len2 == 0)\n            break;\n\n        /* another iteration of the loop with odd and even swapped */\n        gf2_matrix_square(odd, even);\n        if (len2 & 1)\n            crc1 = gf2_matrix_times(odd, crc1);\n        len2 >>= 1;\n\n        /* if no more bits set, then done */\n    } while (len2 != 0);\n\n    /* return combined crc */\n    crc1 ^= crc2;\n    return crc1;\n}\n\n/* ========================================================================= */\nuLong ZEXPORT crc32_combine(crc1, crc2, len2)\n    uLong crc1;\n    uLong crc2;\n    z_off_t len2;\n{\n    return crc32_combine_(crc1, crc2, len2);\n}\n\nuLong ZEXPORT crc32_combine64(crc1, crc2, len2)\n    uLong crc1;\n    uLong crc2;\n    z_off64_t len2;\n{\n    return crc32_combine_(crc1, crc2, len2);\n}\n"},{"id":16728,"name":"putkey.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/*  This file, putkey.c, contains routines that write keywords to          */\n/*  a FITS header.                                                         */\n\n/*  The FITSIO software was written by William Pence at the High Energy    */\n/*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */\n/*  Goddard Space Flight Center.                                           */\n\n#include <string.h>\n#include <stdlib.h>\n#include <ctype.h>\n#include <time.h>\n/* stddef.h is apparently needed to define size_t */\n#include <stddef.h>\n#include \"fitsio2.h\"\n\n/*--------------------------------------------------------------------------*/\nint ffcrim(fitsfile *fptr,      /* I - FITS file pointer           */\n           int bitpix,          /* I - bits per pixel              */\n           int naxis,           /* I - number of axes in the array */\n           long *naxes,         /* I - size of each axis           */\n           int *status)         /* IO - error status               */\n/*\n  create an IMAGE extension following the current HDU. If the\n  current HDU is empty (contains no header keywords), then simply\n  write the required image (or primary array) keywords to the current\n  HDU. \n*/\n{\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    /* create new extension if current header is not empty */\n    if ((fptr->Fptr)->headend != (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] )\n        ffcrhd(fptr, status);\n\n    /* write the required header keywords */\n    ffphpr(fptr, TRUE, bitpix, naxis, naxes, 0, 1, TRUE, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffcrimll(fitsfile *fptr,    /* I - FITS file pointer           */\n           int bitpix,          /* I - bits per pixel              */\n           int naxis,           /* I - number of axes in the array */\n           LONGLONG *naxes,     /* I - size of each axis           */\n           int *status)         /* IO - error status               */\n/*\n  create an IMAGE extension following the current HDU. If the\n  current HDU is empty (contains no header keywords), then simply\n  write the required image (or primary array) keywords to the current\n  HDU. \n*/\n{\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    /* create new extension if current header is not empty */\n    if ((fptr->Fptr)->headend != (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] )\n        ffcrhd(fptr, status);\n\n    /* write the required header keywords */\n    ffphprll(fptr, TRUE, bitpix, naxis, naxes, 0, 1, TRUE, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffcrtb(fitsfile *fptr,  /* I - FITS file pointer                        */\n           int tbltype,     /* I - type of table to create                  */\n           LONGLONG naxis2, /* I - number of rows in the table              */\n           int tfields,     /* I - number of columns in the table           */\n           char **ttype,    /* I - name of each column                      */\n           char **tform,    /* I - value of TFORMn keyword for each column  */\n           char **tunit,    /* I - value of TUNITn keyword for each column  */\n           const char *extnm, /* I - value of EXTNAME keyword, if any         */\n           int *status)     /* IO - error status                            */\n/*\n  Create a table extension in a FITS file. \n*/\n{\n    LONGLONG naxis1 = 0;\n    long *tbcol = 0;\n\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    /* create new extension if current header is not empty */\n    if ((fptr->Fptr)->headend != (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] )\n        ffcrhd(fptr, status);\n\n    if ((fptr->Fptr)->curhdu == 0)  /* have to create dummy primary array */\n    {\n       ffcrim(fptr, 16, 0, tbcol, status);\n       ffcrhd(fptr, status);\n    }\n    \n    if (tbltype == BINARY_TBL)\n    {\n      /* write the required header keywords. This will write PCOUNT = 0 */\n      ffphbn(fptr, naxis2, tfields, ttype, tform, tunit, extnm, 0, status);\n    }\n    else if (tbltype == ASCII_TBL)\n    {\n      /* write the required header keywords */\n      /* default values for naxis1 and tbcol will be calculated */\n      ffphtb(fptr, naxis1, naxis2, tfields, ttype, tbcol, tform, tunit,\n             extnm, status);\n    }\n    else\n      *status = NOT_TABLE;\n\n    return(*status);\n}\n/*-------------------------------------------------------------------------*/\nint ffpktp(fitsfile *fptr,       /* I - FITS file pointer       */\n           const char *filename, /* I - name of template file   */\n           int *status)          /* IO - error status           */\n/*\n  read keywords from template file and append to the FITS file\n*/\n{\n    FILE *diskfile;\n    char card[FLEN_CARD], template[161];\n    char keyname[FLEN_KEYWORD], newname[FLEN_KEYWORD];\n    int keytype;\n    size_t slen;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    diskfile = fopen(filename,\"r\"); \n    if (!diskfile)          /* couldn't open file */\n    {\n            ffpmsg(\"ffpktp could not open the following template file:\");\n            ffpmsg(filename);\n            return(*status = FILE_NOT_OPENED); \n    }\n\n    while (fgets(template, 160, diskfile) )  /* get next template line */\n    {\n      template[160] = '\\0';      /* make sure string is terminated */\n      slen = strlen(template);   /* get string length */\n      template[slen - 1] = '\\0';  /* over write the 'newline' char */\n\n      if (ffgthd(template, card, &keytype, status) > 0) /* parse template */\n         break;\n\n      strncpy(keyname, card, 8);\n      keyname[8] = '\\0';\n\n      if (keytype == -2)            /* rename the card */\n      {\n         strncpy(newname, &card[40], 8);\n         newname[8] = '\\0';\n\n         ffmnam(fptr, keyname, newname, status); \n      }\n      else if (keytype == -1)      /* delete the card */\n      {\n         ffdkey(fptr, keyname, status);\n      }\n      else if (keytype == 0)       /* update the card */\n      {\n         ffucrd(fptr, keyname, card, status);\n      }\n      else if (keytype == 1)      /* append the card */\n      {\n         ffprec(fptr, card, status);\n      }\n      else    /* END card; stop here */\n      {\n         break; \n      }\n    }\n\n    fclose(diskfile);   /* close the template file */\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpky( fitsfile *fptr,     /* I - FITS file pointer        */\n           int  datatype,      /* I - datatype of the value    */\n           const char *keyname,/* I - name of keyword to write */\n           void *value,        /* I - keyword value            */\n           const char *comm,   /* I - keyword comment          */\n           int  *status)       /* IO - error status            */\n/*\n  Write (put) the keyword, value and comment into the FITS header.\n  Writes a keyword value with the datatype specified by the 2nd argument.\n*/\n{\n    char errmsg[FLEN_ERRMSG];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (datatype == TSTRING)\n    {\n        ffpkys(fptr, keyname, (char *) value, comm, status);\n    }\n    else if (datatype == TBYTE)\n    {\n        ffpkyj(fptr, keyname, (LONGLONG) *(unsigned char *) value, comm, status);\n    }\n    else if (datatype == TSBYTE)\n    {\n        ffpkyj(fptr, keyname, (LONGLONG) *(signed char *) value, comm, status);\n    }\n    else if (datatype == TUSHORT)\n    {\n        ffpkyj(fptr, keyname, (LONGLONG) *(unsigned short *) value, comm, status);\n    }\n    else if (datatype == TSHORT)\n    {\n        ffpkyj(fptr, keyname, (LONGLONG) *(short *) value, comm, status);\n    }\n    else if (datatype == TUINT)\n    {\n        ffpkyg(fptr, keyname, (double) *(unsigned int *) value, 0,\n               comm, status);\n    }\n    else if (datatype == TINT)\n    {\n        ffpkyj(fptr, keyname, (LONGLONG) *(int *) value, comm, status);\n    }\n    else if (datatype == TLOGICAL)\n    {\n        ffpkyl(fptr, keyname, *(int *) value, comm, status);\n    }\n    else if (datatype == TULONG)\n    {\n        ffpkyuj(fptr, keyname, (ULONGLONG) *(unsigned long *) value,\n               comm, status);\n    }\n    else if (datatype == TULONGLONG)\n    {\n        ffpkyuj(fptr, keyname, (ULONGLONG) *(ULONGLONG *) value,\n               comm, status);\n    }\n    else if (datatype == TLONG)\n    {\n        ffpkyj(fptr, keyname, (LONGLONG) *(long *) value, comm, status);\n    }\n    else if (datatype == TLONGLONG)\n    {\n        ffpkyj(fptr, keyname, *(LONGLONG *) value, comm, status);\n    }\n    else if (datatype == TFLOAT)\n    {\n        ffpkye(fptr, keyname, *(float *) value, -7, comm, status);\n    }\n    else if (datatype == TDOUBLE)\n    {\n        ffpkyd(fptr, keyname, *(double *) value, -15, comm, status);\n    }\n    else if (datatype == TCOMPLEX)\n    {\n        ffpkyc(fptr, keyname, (float *) value, -7, comm, status);\n    }\n    else if (datatype == TDBLCOMPLEX)\n    {\n        ffpkym(fptr, keyname, (double *) value, -15, comm, status);\n    }\n    else\n    {\n        snprintf(errmsg, FLEN_ERRMSG,\"Bad keyword datatype code: %d (ffpky)\", datatype);\n        ffpmsg(errmsg);\n        *status = BAD_DATATYPE;\n    }\n\n    return(*status);\n} \n/*-------------------------------------------------------------------------*/\nint ffprec(fitsfile *fptr,     /* I - FITS file pointer        */\n           const char *card,   /* I - string to be written     */\n           int *status)        /* IO - error status            */\n/*\n  write a keyword record (80 bytes long) to the end of the header\n*/\n{\n    char tcard[FLEN_CARD];\n    size_t len, ii;\n    long nblocks;\n    int keylength;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if ( ((fptr->Fptr)->datastart - (fptr->Fptr)->headend) == 80) /* no room */\n    {\n        nblocks = 1;\n        if (ffiblk(fptr, nblocks, 0, status) > 0) /* insert 2880-byte block */\n            return(*status);  \n    }\n\n    strncpy(tcard,card,80);\n    tcard[80] = '\\0';\n\n    len = strlen(tcard);\n\n    /* silently replace any illegal characters with a space */\n    for (ii=0; ii < len; ii++)   \n        if (tcard[ii] < ' ' || tcard[ii] > 126) tcard[ii] = ' ';\n\n    for (ii=len; ii < 80; ii++)    /* fill card with spaces if necessary */\n        tcard[ii] = ' ';\n\n    keylength = strcspn(tcard, \"=\");   /* support for free-format keywords */\n    if (keylength == 80) keylength = 8;\n    \n    /* test for the common commentary keywords which by definition have 8-char names */\n    if ( !fits_strncasecmp( \"COMMENT \", tcard, 8) || !fits_strncasecmp( \"HISTORY \", tcard, 8) ||\n         !fits_strncasecmp( \"        \", tcard, 8) || !fits_strncasecmp( \"CONTINUE\", tcard, 8) )\n\t keylength = 8;\n\n    for (ii=0; ii < keylength; ii++)       /* make sure keyword name is uppercase */\n        tcard[ii] = toupper(tcard[ii]);\n\n    fftkey(tcard, status);        /* test keyword name contains legal chars */\n\n/*  no need to do this any more, since any illegal characters have been removed\n    fftrec(tcard, status);  */        /* test rest of keyword for legal chars */\n\n    ffmbyt(fptr, (fptr->Fptr)->headend, IGNORE_EOF, status); /* move to end */\n\n    ffpbyt(fptr, 80, tcard, status);   /* write the 80 byte card */\n\n    if (*status <= 0)\n       (fptr->Fptr)->headend += 80;    /* update end-of-header position */\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpkyu( fitsfile *fptr,     /* I - FITS file pointer        */\n            const char *keyname,/* I - name of keyword to write */\n            const char *comm,   /* I - keyword comment          */\n            int  *status)       /* IO - error status            */\n/*\n  Write (put) a null-valued keyword and comment into the FITS header.  \n*/\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    strcpy(valstring,\" \");  /* create a dummy value string */\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword */\n    ffprec(fptr, card, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpkys( fitsfile *fptr,     /* I - FITS file pointer        */\n            const char *keyname,/* I - name of keyword to write */\n            const char *value,  /* I - keyword value            */\n            const char *comm,   /* I - keyword comment          */\n            int  *status)       /* IO - error status            */\n/*\n  Write (put) the keyword, value and comment into the FITS header.\n  The value string will be truncated at 68 characters which is the\n  maximum length that will fit on a single FITS keyword.\n*/\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffs2c(value, valstring, status);   /* put quotes around the string */\n\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword */\n    ffprec(fptr, card, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpkls( fitsfile *fptr,     /* I - FITS file pointer        */\n            const char *keyname,/* I - name of keyword to write */\n            const char *value,  /* I - keyword value            */\n            const char *comm,   /* I - keyword comment          */\n            int  *status)       /* IO - error status            */\n/*\n  Write (put) the keyword, value and comment into the FITS header.\n  This routine is a modified version of ffpkys which supports the\n  HEASARC long string convention and can write arbitrarily long string\n  keyword values.  The value is continued over multiple keywords that\n  have the name COMTINUE without an equal sign in column 9 of the card.\n  This routine also supports simple string keywords which are less than\n  69 characters in length.\n*/\n{\n    char valstring[FLEN_CARD];\n    char card[FLEN_CARD], tmpkeyname[FLEN_CARD];\n    char tstring[FLEN_CARD], *cptr;\n    int next, remain, vlen, nquote, nchar, namelen, contin, tstatus = -1;\n    int commlen=0, nocomment = 0;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    remain = maxvalue(strlen(value), 1); /* no. of chars to write (at least 1) */  \n    if (comm) { \n       commlen = strlen(comm);\n       if (commlen > 47) commlen = 47;  /* only guarantee preserving the first 47 characters */\n    }\n\n    /* count the number of single quote characters are in the string */\n    tstring[0] = '\\0';\n    strncat(tstring, value, 68); /* copy 1st part of string to temp buff */\n    nquote = 0;\n    cptr = strchr(tstring, '\\'');   /* search for quote character */\n    while (cptr)  /* search for quote character */\n    {\n        nquote++;            /*  increment no. of quote characters  */\n        cptr++;              /*  increment pointer to next character */\n        cptr = strchr(cptr, '\\'');  /* search for another quote char */\n    }\n\n    strncpy(tmpkeyname, keyname, 80);\n    tmpkeyname[80] = '\\0';\n    \n    cptr = tmpkeyname;\n    while(*cptr == ' ')   /* skip over leading spaces in name */\n        cptr++;\n\n    /* determine the number of characters that will fit on the line */\n    /* Note: each quote character is expanded to 2 quotes */\n\n    namelen = strlen(cptr);\n    if (namelen <= 8 && (fftkey(cptr, &tstatus) <= 0) )\n    {\n        /* This a normal 8-character FITS keyword */\n        nchar = 68 - nquote; /*  max of 68 chars fit in a FITS string value */\n    }\n    else\n    {\n\t   nchar = 80 - nquote - namelen - 5;\n    }\n\n    contin = 0;\n    next = 0;                  /* pointer to next character to write */\n\n    while (remain > 0)\n    {\n        tstring[0] = '\\0';\n        strncat(tstring, &value[next], nchar); /* copy string to temp buff */\n        ffs2c(tstring, valstring, status);  /* expand quotes, and put quotes around the string */\n\n        if (remain > nchar)   /* if string is continued, put & as last char */\n        {\n            vlen = strlen(valstring);\n            nchar -= 1;        /* outputting one less character now */\n\n            if (valstring[vlen-2] != '\\'')\n                valstring[vlen-2] = '&';  /*  over write last char with &  */\n            else\n            { /* last char was a pair of single quotes, so over write both */\n                valstring[vlen-3] = '&';\n                valstring[vlen-1] = '\\0';\n            }\n        }\n\n        if (contin)           /* This is a CONTINUEd keyword */\n        {\n           if (nocomment) {\n               ffmkky(\"CONTINUE\", valstring, NULL, card, status); /* make keyword w/o comment */\n           } else {\n               ffmkky(\"CONTINUE\", valstring, comm, card, status); /* make keyword */\n\t   }\n           strncpy(&card[8], \"   \",  2);  /* overwrite the '=' */\n        }\n        else\n        {\n           ffmkky(keyname, valstring, comm, card, status);  /* make keyword */\n        }\n\n        ffprec(fptr, card, status);  /* write the keyword */\n\n        contin = 1;\n        remain -= nchar;\n        next  += nchar;\n        nocomment = 0;\n\n        if (remain > 0) \n        {\n           /* count the number of single quote characters in next section */\n           tstring[0] = '\\0';\n           strncat(tstring, &value[next], 68); /* copy next part of string */\n           nquote = 0;\n           cptr = strchr(tstring, '\\'');   /* search for quote character */\n           while (cptr)  /* search for quote character */\n           {\n               nquote++;            /*  increment no. of quote characters  */\n               cptr++;              /*  increment pointer to next character */\n               cptr = strchr(cptr, '\\'');  /* search for another quote char */\n           }\n           nchar = 68 - nquote;  /* max number of chars to write this time */\n        }\n\n        /* make adjustment if necessary to allow reasonable room for a comment on last CONTINUE card \n\t   only need to do this if \n\t     a) there is a comment string, and\n\t     b) the remaining value string characters could all fit on the next CONTINUE card, and\n\t     c) there is not enough room on the next CONTINUE card for both the remaining value\n\t        characters, and at least 47 characters of the comment string.\n\t*/\n\t\n        if (commlen > 0 && remain + nquote < 69 && remain + nquote + commlen > 65) \n\t{\n            if (nchar > 18) { /* only false if there are a rediculous number of quotes in the string */\n\t        nchar = remain - 15;  /* force continuation onto another card, so that */\n\t\t                      /* there is room for a comment up to 47 chara long */\n                nocomment = 1;  /* don't write the comment string this time */\n            }\n\t}\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffplsw( fitsfile *fptr,     /* I - FITS file pointer  */\n            int  *status)       /* IO - error status       */\n/*\n  Write the LONGSTRN keyword and a series of related COMMENT keywords\n  which document that this FITS header may contain long string keyword\n  values which are continued over multiple keywords using the HEASARC\n  long string keyword convention.  If the LONGSTRN keyword already exists\n  then this routine simple returns without doing anything.\n*/\n{\n    char valstring[FLEN_VALUE], comm[FLEN_COMMENT];\n    int tstatus;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    tstatus = 0;\n    if (ffgkys(fptr, \"LONGSTRN\", valstring, comm, &tstatus) == 0)\n        return(*status);     /* keyword already exists, so just return */\n\n    ffpkys(fptr, \"LONGSTRN\", \"OGIP 1.0\", \n       \"The HEASARC Long String Convention may be used.\", status);\n\n    ffpcom(fptr,\n    \"  This FITS file may contain long string keyword values that are\", status);\n\n    ffpcom(fptr,\n    \"  continued over multiple keywords.  The HEASARC convention uses the &\",\n    status);\n\n    ffpcom(fptr,\n    \"  character at the end of each substring which is then continued\", status);\n\n    ffpcom(fptr,\n    \"  on the next keyword which has the name CONTINUE.\", status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpkyl( fitsfile *fptr,     /* I - FITS file pointer        */\n            const char *keyname,/* I - name of keyword to write */\n            int  value,         /* I - keyword value            */\n            const char *comm,   /* I - keyword comment          */\n            int  *status)       /* IO - error status            */\n/*\n  Write (put) the keyword, value and comment into the FITS header.\n  Values equal to 0 will result in a False FITS keyword; any other\n  non-zero value will result in a True FITS keyword.\n*/\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffl2c(value, valstring, status);   /* convert to formatted string */\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffprec(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpkyj( fitsfile *fptr,     /* I - FITS file pointer        */\n            const char *keyname,/* I - name of keyword to write */\n            LONGLONG value,     /* I - keyword value            */\n            const char *comm,   /* I - keyword comment          */\n            int  *status)       /* IO - error status            */\n/*\n  Write (put) the keyword, value and comment into the FITS header.\n  Writes an integer keyword value.\n*/\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffi2c(value, valstring, status);   /* convert to formatted string */\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffprec(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpkyuj( fitsfile *fptr,     /* I - FITS file pointer        */\n            const char *keyname,/* I - name of keyword to write */\n            ULONGLONG value,     /* I - keyword value            */\n            const char *comm,   /* I - keyword comment          */\n            int  *status)       /* IO - error status            */\n/*\n  Write (put) the keyword, value and comment into the FITS header.\n  Writes an integer keyword value.\n*/\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffu2c(value, valstring, status);   /* convert to formatted string */\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffprec(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpkyf( fitsfile *fptr,      /* I - FITS file pointer                   */\n            const char  *keyname,/* I - name of keyword to write            */\n            float value,         /* I - keyword value                       */\n            int   decim,         /* I - number of decimal places to display */\n            const char  *comm,   /* I - keyword comment                     */\n            int   *status)       /* IO - error status                       */\n/*\n  Write (put) the keyword, value and comment into the FITS header.\n  Writes a fixed float keyword value.\n*/\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffr2f(value, decim, valstring, status);   /* convert to formatted string */\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffprec(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpkye( fitsfile *fptr,      /* I - FITS file pointer                   */\n            const char  *keyname,/* I - name of keyword to write            */\n            float value,         /* I - keyword value                       */\n            int   decim,         /* I - number of decimal places to display */\n            const char  *comm,   /* I - keyword comment                     */\n            int   *status)       /* IO - error status                       */\n/*\n  Write (put) the keyword, value and comment into the FITS header.\n  Writes an exponential float keyword value.\n*/\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffr2e(value, decim, valstring, status);   /* convert to formatted string */\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffprec(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpkyg( fitsfile *fptr,      /* I - FITS file pointer                   */\n            const char  *keyname,/* I - name of keyword to write            */\n            double value,        /* I - keyword value                       */\n            int   decim,         /* I - number of decimal places to display */\n            const char  *comm,   /* I - keyword comment                     */\n            int   *status)       /* IO - error status                       */\n/*\n  Write (put) the keyword, value and comment into the FITS header.\n  Writes a fixed double keyword value.*/\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffd2f(value, decim, valstring, status);  /* convert to formatted string */\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffprec(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpkyd( fitsfile *fptr,      /* I - FITS file pointer                   */\n            const char  *keyname,/* I - name of keyword to write            */\n            double value,        /* I - keyword value                       */\n            int   decim,         /* I - number of decimal places to display */\n            const char  *comm,   /* I - keyword comment                     */\n            int   *status)       /* IO - error status                       */\n/*\n  Write (put) the keyword, value and comment into the FITS header.\n  Writes an exponential double keyword value.*/\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffd2e(value, decim, valstring, status);  /* convert to formatted string */\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffprec(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpkyc( fitsfile *fptr,      /* I - FITS file pointer                   */\n            const char  *keyname,/* I - name of keyword to write            */\n            float *value,        /* I - keyword value (real, imaginary)     */\n            int   decim,         /* I - number of decimal places to display */\n            const char  *comm,   /* I - keyword comment                     */\n            int   *status)       /* IO - error status                       */\n/*\n  Write (put) the keyword, value and comment into the FITS header.\n  Writes an complex float keyword value. Format = (realvalue, imagvalue)\n*/\n{\n    char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    strcpy(valstring, \"(\" );\n    ffr2e(value[0], decim, tmpstring, status); /* convert to string */\n    if (strlen(valstring)+strlen(tmpstring)+2 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"Error converting complex to string (ffpkyc)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffr2e(value[1], decim, tmpstring, status); /* convert to string */\n    if (strlen(valstring)+strlen(tmpstring)+1 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"Error converting complex to string (ffpkyc)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \")\");\n\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffprec(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpkym( fitsfile *fptr,      /* I - FITS file pointer                   */\n            const char  *keyname,/* I - name of keyword to write            */\n            double *value,       /* I - keyword value (real, imaginary)     */\n            int   decim,         /* I - number of decimal places to display */\n            const char  *comm,   /* I - keyword comment                     */\n            int   *status)       /* IO - error status                       */\n/*\n  Write (put) the keyword, value and comment into the FITS header.\n  Writes an complex double keyword value. Format = (realvalue, imagvalue)\n*/\n{\n    char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    strcpy(valstring, \"(\" );\n    ffd2e(value[0], decim, tmpstring, status); /* convert to string */\n    if (strlen(valstring)+strlen(tmpstring)+2 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"Error converting complex to string (ffpkym)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffd2e(value[1], decim, tmpstring, status); /* convert to string */\n    if (strlen(valstring)+strlen(tmpstring)+1 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"Error converting complex to string (ffpkym)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \")\");\n\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffprec(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpkfc( fitsfile *fptr,      /* I - FITS file pointer                   */\n            const char  *keyname,/* I - name of keyword to write            */\n            float *value,        /* I - keyword value (real, imaginary)     */\n            int   decim,         /* I - number of decimal places to display */\n            const char  *comm,   /* I - keyword comment                     */\n            int   *status)       /* IO - error status                       */\n/*\n  Write (put) the keyword, value and comment into the FITS header.\n  Writes an complex float keyword value. Format = (realvalue, imagvalue)\n*/\n{\n    char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    strcpy(valstring, \"(\" );\n    ffr2f(value[0], decim, tmpstring, status); /* convert to string */\n    if (strlen(valstring)+strlen(tmpstring)+2 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"Error converting complex to string (ffpkfc)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffr2f(value[1], decim, tmpstring, status); /* convert to string */\n    if (strlen(valstring)+strlen(tmpstring)+1 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"Error converting complex to string (ffpkfc)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \")\");\n\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffprec(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpkfm( fitsfile *fptr,      /* I - FITS file pointer                   */\n            const char  *keyname,/* I - name of keyword to write            */\n            double *value,       /* I - keyword value (real, imaginary)     */\n            int   decim,         /* I - number of decimal places to display */\n            const char  *comm,   /* I - keyword comment                     */\n            int   *status)       /* IO - error status                       */\n/*\n  Write (put) the keyword, value and comment into the FITS header.\n  Writes an complex double keyword value. Format = (realvalue, imagvalue)\n*/\n{\n    char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    strcpy(valstring, \"(\" );\n    ffd2f(value[0], decim, tmpstring, status); /* convert to string */\n    if (strlen(valstring)+strlen(tmpstring)+2 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"Error converting complex to string (ffpkfm)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffd2f(value[1], decim, tmpstring, status); /* convert to string */\n    if (strlen(valstring)+strlen(tmpstring)+1 > FLEN_VALUE-1)\n    {\n       ffpmsg(\"Error converting complex to string (ffpkfm)\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, tmpstring);\n    strcat(valstring, \")\");\n\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffprec(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpkyt( fitsfile *fptr,      /* I - FITS file pointer        */\n            const char  *keyname,/* I - name of keyword to write */\n            long  intval,        /* I - integer part of value    */\n            double fraction,     /* I - fractional part of value */\n            const char  *comm,   /* I - keyword comment          */\n            int   *status)       /* IO - error status            */\n/*\n  Write (put) a 'triple' precision keyword where the integer and\n  fractional parts of the value are passed in separate parameters to\n  increase the total amount of numerical precision.\n*/\n{\n    char valstring[FLEN_VALUE];\n    char card[FLEN_CARD];\n    char fstring[20], *cptr;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (fraction > 1. || fraction < 0.)\n    {\n        ffpmsg(\"fraction must be between 0. and 1. (ffpkyt)\");\n        return(*status = BAD_F2C);\n    }\n\n    ffi2c(intval, valstring, status);  /* convert integer to string */\n    ffd2f(fraction, 16, fstring, status);  /* convert to 16 decimal string */\n\n    cptr = strchr(fstring, '.');    /* find the decimal point */\n    if (strlen(valstring)+strlen(cptr) > FLEN_VALUE-1)\n    {\n       ffpmsg(\"converted numerical string too long\");\n       return(*status=BAD_F2C);\n    }\n    strcat(valstring, cptr);    /* append the fraction to the integer */\n\n    ffmkky(keyname, valstring, comm, card, status);  /* construct the keyword*/\n    ffprec(fptr, card, status);  /* write the keyword*/\n\n    return(*status);\n}\n/*-----------------------------------------------------------------*/\nint ffpcom( fitsfile *fptr,      /* I - FITS file pointer   */\n            const char  *comm,   /* I - comment string      */\n            int   *status)       /* IO - error status       */\n/*\n  Write 1 or more COMMENT keywords.  If the comment string is too\n  long to fit on a single keyword (72 chars) then it will automatically\n  be continued on multiple CONTINUE keywords.\n*/\n{\n    char card[FLEN_CARD];\n    int len, ii;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    len = strlen(comm);\n    ii = 0;\n\n    for (; len > 0; len -= 72)\n    {\n        strcpy(card, \"COMMENT \");\n        strncat(card, &comm[ii], 72);\n        ffprec(fptr, card, status);\n        ii += 72;\n    }\n\n    return(*status);\n}\n/*-----------------------------------------------------------------*/\nint ffphis( fitsfile *fptr,      /* I - FITS file pointer  */\n            const char *history, /* I - history string     */\n            int   *status)       /* IO - error status      */\n/*\n  Write 1 or more HISTORY keywords.  If the history string is too\n  long to fit on a single keyword (72 chars) then it will automatically\n  be continued on multiple HISTORY keywords.\n*/\n{\n    char card[FLEN_CARD];\n    int len, ii;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    len = strlen(history);\n    ii = 0;\n\n    for (; len > 0; len -= 72)\n    {\n        strcpy(card, \"HISTORY \");\n        strncat(card, &history[ii], 72);\n        ffprec(fptr, card, status);\n        ii += 72;\n    }\n\n    return(*status);\n}\n/*-----------------------------------------------------------------*/\nint ffpdat( fitsfile *fptr,      /* I - FITS file pointer  */\n            int   *status)       /* IO - error status      */\n/*\n  Write the DATE keyword into the FITS header.  If the keyword already\n  exists then the date will simply be updated in the existing keyword.\n*/\n{\n    int timeref;\n    char date[30], tmzone[10], card[FLEN_CARD];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    ffgstm(date, &timeref, status);\n\n    if (timeref)           /* GMT not available on this machine */\n        strcpy(tmzone, \" Local\");    \n    else\n        strcpy(tmzone, \" UT\");    \n\n    strcpy(card, \"DATE    = '\");\n    strcat(card, date);\n    strcat(card, \"' / file creation date (YYYY-MM-DDThh:mm:ss\");\n    strcat(card, tmzone);\n    strcat(card, \")\");\n\n    ffucrd(fptr, \"DATE\", card, status);\n\n    return(*status);\n}\n/*-------------------------------------------------------------------*/\nint ffverifydate(int year,          /* I - year (0 - 9999)           */\n                 int month,         /* I - month (1 - 12)            */\n                 int day,           /* I - day (1 - 31)              */\n                 int   *status)     /* IO - error status             */\n/*\n  Verify that the date is valid\n*/\n{\n    int ndays[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};\n    char errmsg[FLEN_ERRMSG];\n    \n\n    if (year < 0 || year > 9999)\n    {\n       snprintf(errmsg, FLEN_ERRMSG,\n       \"input year value = %d is out of range 0 - 9999\", year);\n       ffpmsg(errmsg);\n       return(*status = BAD_DATE);\n    }\n    else if (month < 1 || month > 12)\n    {\n       snprintf(errmsg, FLEN_ERRMSG,\n       \"input month value = %d is out of range 1 - 12\", month);\n       ffpmsg(errmsg);\n       return(*status = BAD_DATE);\n    }\n    \n    if (ndays[month] == 31) {\n        if (day < 1 || day > 31)\n        {\n           snprintf(errmsg, FLEN_ERRMSG,\n           \"input day value = %d is out of range 1 - 31 for month %d\", day, month);\n           ffpmsg(errmsg);\n           return(*status = BAD_DATE);\n        }\n    } else if (ndays[month] == 30) {\n        if (day < 1 || day > 30)\n        {\n           snprintf(errmsg, FLEN_ERRMSG,\n           \"input day value = %d is out of range 1 - 30 for month %d\", day, month);\n           ffpmsg(errmsg);\n           return(*status = BAD_DATE);\n        }\n    } else {\n        if (day < 1 || day > 28)\n        {\n            if (day == 29)\n            {\n\t      /* year is a leap year if it is divisible by 4 but not by 100,\n\t         except years divisible by 400 are leap years\n\t      */\n\t        if ((year % 4 == 0 && year % 100 != 0 ) || year % 400 == 0)\n\t\t   return (*status);\n\t\t   \n \t        snprintf(errmsg, FLEN_ERRMSG,\n           \"input day value = %d is out of range 1 - 28 for February %d (not leap year)\", day, year);\n                ffpmsg(errmsg);\n\t    } else {\n                snprintf(errmsg, FLEN_ERRMSG,\n                \"input day value = %d is out of range 1 - 28 (or 29) for February\", day);\n                ffpmsg(errmsg);\n\t    }\n\t    \n            return(*status = BAD_DATE);\n        }\n    }\n    return(*status);\n}\n/*-----------------------------------------------------------------*/\nint ffgstm( char *timestr,   /* O  - returned system date and time string  */\n            int  *timeref,   /* O - GMT = 0, Local time = 1  */\n            int   *status)   /* IO - error status      */\n/*\n  Returns the current date and time in format 'yyyy-mm-ddThh:mm:ss'.\n*/\n{\n    time_t tp;\n    struct tm *ptr;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    time(&tp);\n    ptr = gmtime(&tp);         /* get GMT (= UTC) time */\n\n    if (timeref)\n    {\n        if (ptr)\n            *timeref = 0;   /* returning GMT */\n        else\n            *timeref = 1;   /* returning local time */\n    }\n\n    if (!ptr)                  /* GMT not available on this machine */\n        ptr = localtime(&tp); \n\n    strftime(timestr, 25, \"%Y-%m-%dT%H:%M:%S\", ptr);\n\n    return(*status);\n}\n/*-----------------------------------------------------------------*/\nint ffdt2s(int year,          /* I - year (0 - 9999)           */\n           int month,         /* I - month (1 - 12)            */\n           int day,           /* I - day (1 - 31)              */\n           char *datestr,     /* O - date string: \"YYYY-MM-DD\" */\n           int   *status)     /* IO - error status             */\n/*\n  Construct a date character string\n*/\n{\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    *datestr = '\\0';\n    \n    if (ffverifydate(year, month, day, status) > 0)\n    {\n        ffpmsg(\"invalid date (ffdt2s)\");\n        return(*status);\n    }\n\n    if (year >= 1900 && year <= 1998)  /* use old 'dd/mm/yy' format */\n        sprintf(datestr, \"%.2d/%.2d/%.2d\", day, month, year - 1900);\n\n    else  /* use the new 'YYYY-MM-DD' format */\n        sprintf(datestr, \"%.4d-%.2d-%.2d\", year, month, day);\n\n    return(*status);\n}\n/*-----------------------------------------------------------------*/\nint ffs2dt(char *datestr,   /* I - date string: \"YYYY-MM-DD\" or \"dd/mm/yy\" */\n           int *year,       /* O - year (0 - 9999)                         */\n           int *month,      /* O - month (1 - 12)                          */\n           int *day,        /* O - day (1 - 31)                            */\n           int   *status)   /* IO - error status                           */\n/*\n  Parse a date character string into year, month, and day values\n*/\n{\n    int slen, lyear, lmonth, lday;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (year)\n        *year = 0;\n    if (month)\n        *month = 0;\n    if (day)\n        *day   = 0;\n\n    if (!datestr)\n    {\n        ffpmsg(\"error: null input date string (ffs2dt)\");\n        return(*status = BAD_DATE);   /* Null datestr pointer ??? */\n    }\n\n    slen = strlen(datestr);\n\n    if (slen == 8 && datestr[2] == '/' && datestr[5] == '/')\n    {\n        if (isdigit((int) datestr[0]) && isdigit((int) datestr[1])\n         && isdigit((int) datestr[3]) && isdigit((int) datestr[4])\n         && isdigit((int) datestr[6]) && isdigit((int) datestr[7]) )\n        {\n            /* this is an old format string: \"dd/mm/yy\" */\n            lyear  = atoi(&datestr[6]) + 1900;\n            lmonth = atoi(&datestr[3]);\n\t    lday   = atoi(datestr);\n\t    \n            if (year)\n                *year = lyear;\n            if (month)\n                *month = lmonth;\n            if (day)\n                *day   = lday;\n        }\n        else\n        {\n            ffpmsg(\"input date string has illegal format (ffs2dt):\");\n            ffpmsg(datestr);\n            return(*status = BAD_DATE);\n        }\n    }\n    else if (slen >= 10 && datestr[4] == '-' && datestr[7] == '-')\n        {\n        if (isdigit((int) datestr[0]) && isdigit((int) datestr[1])\n         && isdigit((int) datestr[2]) && isdigit((int) datestr[3])\n         && isdigit((int) datestr[5]) && isdigit((int) datestr[6])\n         && isdigit((int) datestr[8]) && isdigit((int) datestr[9]) )\n        {\n            if (slen > 10 && datestr[10] != 'T')\n            {\n                ffpmsg(\"input date string has illegal format (ffs2dt):\");\n                ffpmsg(datestr);\n                return(*status = BAD_DATE);\n            }\n\n            /* this is a new format string: \"yyyy-mm-dd\" */\n            lyear  = atoi(datestr);\n            lmonth = atoi(&datestr[5]);\n            lday   = atoi(&datestr[8]);\n\n            if (year)\n               *year  = lyear;\n            if (month)\n               *month = lmonth;\n            if (day)\n               *day   = lday;\n        }\n        else\n        {\n                ffpmsg(\"input date string has illegal format (ffs2dt):\");\n                ffpmsg(datestr);\n                return(*status = BAD_DATE);\n        }\n    }\n    else\n    {\n                ffpmsg(\"input date string has illegal format (ffs2dt):\");\n                ffpmsg(datestr);\n                return(*status = BAD_DATE);\n    }\n\n\n    if (ffverifydate(lyear, lmonth, lday, status) > 0)\n    {\n        ffpmsg(\"invalid date (ffs2dt)\");\n    }\n\n    return(*status);\n}\n/*-----------------------------------------------------------------*/\nint fftm2s(int year,          /* I - year (0 - 9999)           */\n           int month,         /* I - month (1 - 12)            */\n           int day,           /* I - day (1 - 31)              */\n           int hour,          /* I - hour (0 - 23)             */\n           int minute,        /* I - minute (0 - 59)           */\n           double second,     /* I - second (0. - 60.9999999)  */\n           int decimals,      /* I - number of decimal points to write      */\n           char *datestr,     /* O - date string: \"YYYY-MM-DDThh:mm:ss.ddd\" */\n                              /*   or \"hh:mm:ss.ddd\" if year, month day = 0 */\n           int   *status)     /* IO - error status             */\n/*\n  Construct a date and time character string\n*/\n{\n    int width;\n    char errmsg[FLEN_ERRMSG];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    *datestr='\\0';\n\n    if (year != 0 || month != 0 || day !=0)\n    { \n        if (ffverifydate(year, month, day, status) > 0)\n\t{\n            ffpmsg(\"invalid date (fftm2s)\");\n            return(*status);\n        }\n    }\n\n    if (hour < 0 || hour > 23)\n    {\n       snprintf(errmsg, FLEN_ERRMSG,\n       \"input hour value is out of range 0 - 23: %d (fftm2s)\", hour);\n       ffpmsg(errmsg);\n       return(*status = BAD_DATE);\n    }\n    else if (minute < 0 || minute > 59)\n    {\n       snprintf(errmsg, FLEN_ERRMSG,\n       \"input minute value is out of range 0 - 59: %d (fftm2s)\", minute);\n       ffpmsg(errmsg);\n       return(*status = BAD_DATE);\n    }\n    else if (second < 0. || second >= 61)\n    {\n       snprintf(errmsg, FLEN_ERRMSG,\n       \"input second value is out of range 0 - 60.999: %f (fftm2s)\", second);\n       ffpmsg(errmsg);\n       return(*status = BAD_DATE);\n    }\n    else if (decimals > 25)\n    {\n       snprintf(errmsg, FLEN_ERRMSG,\n       \"input decimals value is out of range 0 - 25: %d (fftm2s)\", decimals);\n       ffpmsg(errmsg);\n       return(*status = BAD_DATE);\n    }\n\n    if (decimals == 0)\n       width = 2;\n    else\n       width = decimals + 3;\n\n    if (decimals < 0)\n    {\n        /* a negative decimals value means return only the date, not time */\n        sprintf(datestr, \"%.4d-%.2d-%.2d\", year, month, day);\n    }\n    else if (year == 0 && month == 0 && day == 0)\n    {\n        /* return only the time, not the date */\n        sprintf(datestr, \"%.2d:%.2d:%0*.*f\",\n            hour, minute, width, decimals, second);\n    }\n    else\n    {\n        /* return both the time and date */\n        sprintf(datestr, \"%.4d-%.2d-%.2dT%.2d:%.2d:%0*.*f\",\n            year, month, day, hour, minute, width, decimals, second);\n    }\n    return(*status);\n}\n/*-----------------------------------------------------------------*/\nint ffs2tm(char *datestr,     /* I - date string: \"YYYY-MM-DD\"    */\n                              /*     or \"YYYY-MM-DDThh:mm:ss.ddd\" */\n                              /*     or \"dd/mm/yy\"                */\n           int *year,         /* O - year (0 - 9999)              */\n           int *month,        /* O - month (1 - 12)               */\n           int *day,          /* O - day (1 - 31)                 */\n           int *hour,          /* I - hour (0 - 23)                */\n           int *minute,        /* I - minute (0 - 59)              */\n           double *second,     /* I - second (0. - 60.9999999)     */\n           int   *status)     /* IO - error status                */\n/*\n  Parse a date character string into date and time values\n*/\n{\n    int slen;\n    char errmsg[FLEN_ERRMSG];\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (year)\n       *year   = 0;\n    if (month)\n       *month  = 0;\n    if (day)\n       *day    = 0;\n    if (hour)\n       *hour   = 0;\n    if (minute)\n       *minute = 0;\n    if (second)\n       *second = 0.;\n\n    if (!datestr)\n    {\n        ffpmsg(\"error: null input date string (ffs2tm)\");\n        return(*status = BAD_DATE);   /* Null datestr pointer ??? */\n    }\n\n    if (datestr[2] == '/' || datestr[4] == '-')\n    {\n        /*  Parse the year, month, and date */\n        if (ffs2dt(datestr, year, month, day, status) > 0)\n            return(*status);\n\n        slen = strlen(datestr);\n        if (slen == 8 || slen == 10)\n            return(*status);               /* OK, no time fields */\n        else if (slen < 19) \n        {\n            ffpmsg(\"input date string has illegal format:\");\n            ffpmsg(datestr);\n            return(*status = BAD_DATE);\n        }\n\n        else if (datestr[10] == 'T')\n        {\n          if (datestr[13] == ':' && datestr[16] == ':') {\n            if (isdigit((int) datestr[11]) && isdigit((int) datestr[12])\n             && isdigit((int) datestr[14]) && isdigit((int) datestr[15])\n             && isdigit((int) datestr[17]) && isdigit((int) datestr[18]) )\n             {\n                if (slen > 19 && datestr[19] != '.')\n                {\n                  ffpmsg(\"input date string has illegal format:\");\n                  ffpmsg(datestr);\n                  return(*status = BAD_DATE);\n                }\n\n                /* this is a new format string: \"yyyy-mm-ddThh:mm:ss.dddd\" */\n                if (hour)\n                    *hour   = atoi(&datestr[11]);\n\n                if (minute)\n                    *minute = atoi(&datestr[14]);\n\n                if (second)\n                    *second = atof(&datestr[17]);\n             }\n             else\n             {\n                  ffpmsg(\"input date string has illegal format:\");\n                  ffpmsg(datestr);\n                  return(*status = BAD_DATE);\n             }\n\n          }\n          else\n          {\n               ffpmsg(\"input date string has illegal format:\");\n               ffpmsg(datestr);\n               return(*status = BAD_DATE);\n          }\n        }\n    }\n    else   /* no date fields */\n    {\n        if (datestr[2] == ':' && datestr[5] == ':')   /* time string */\n        {\n            if (isdigit((int) datestr[0]) && isdigit((int) datestr[1])\n             && isdigit((int) datestr[3]) && isdigit((int) datestr[4])\n             && isdigit((int) datestr[6]) && isdigit((int) datestr[7]) )\n            {\n                 /* this is a time string: \"hh:mm:ss.dddd\" */\n                 if (hour)\n                    *hour   = atoi(&datestr[0]);\n\n                 if (minute)\n                    *minute = atoi(&datestr[3]);\n\n                if (second)\n                    *second = atof(&datestr[6]);\n            }\n            else\n            {\n                  ffpmsg(\"input date string has illegal format:\");\n                  ffpmsg(datestr);\n                  return(*status = BAD_DATE);\n            }\n\n        }\n        else\n        {\n                  ffpmsg(\"input date string has illegal format:\");\n                  ffpmsg(datestr);\n                  return(*status = BAD_DATE);\n        }\n\n    }\n\n    if (hour)\n       if (*hour < 0 || *hour > 23)\n       {\n          snprintf(errmsg,FLEN_ERRMSG, \n          \"hour value is out of range 0 - 23: %d (ffs2tm)\", *hour);\n          ffpmsg(errmsg);\n          return(*status = BAD_DATE);\n       }\n\n    if (minute)\n       if (*minute < 0 || *minute > 59)\n       {\n          snprintf(errmsg, FLEN_ERRMSG,\n          \"minute value is out of range 0 - 59: %d (ffs2tm)\", *minute);\n          ffpmsg(errmsg);\n          return(*status = BAD_DATE);\n       }\n\n    if (second)\n       if (*second < 0 || *second >= 61.)\n       {\n          snprintf(errmsg, FLEN_ERRMSG,\n          \"second value is out of range 0 - 60.9999: %f (ffs2tm)\", *second);\n          ffpmsg(errmsg);\n          return(*status = BAD_DATE);\n       }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffgsdt( int *day, int *month, int *year, int *status )\n{  \n/*\n      This routine is included for backward compatibility\n            with the Fortran FITSIO library.\n\n   ffgsdt : Get current System DaTe (GMT if available)\n\n      Return integer values of the day, month, and year\n\n         Function parameters:\n            day      Day of the month\n            month    Numerical month (1=Jan, etc.)\n            year     Year (1999, 2000, etc.)\n            status   output error status\n\n*/\n   time_t now;\n   struct tm *date;\n\n   now = time( NULL );\n   date = gmtime(&now);         /* get GMT (= UTC) time */\n\n   if (!date)                  /* GMT not available on this machine */\n   {\n       date = localtime(&now); \n   }\n\n   *day = date->tm_mday;\n   *month = date->tm_mon + 1;\n   *year = date->tm_year + 1900;  /* tm_year is defined as years since 1900 */\n   return( *status );\n}\n/*--------------------------------------------------------------------------*/\nint ffpkns( fitsfile *fptr,     /* I - FITS file pointer                    */\n            const char *keyroot,      /* I - root name of keywords to write       */\n            int  nstart,        /* I - starting index number                */\n            int  nkey,          /* I - number of keywords to write          */\n            char *value[],      /* I - array of pointers to keyword values  */\n            char *comm[],       /* I - array of pointers to keyword comment */\n            int  *status)       /* IO - error status                        */\n/*\n  Write (put) an indexed array of keywords with index numbers between\n  NSTART and (NSTART + NKEY -1) inclusive.  Writes string keywords.\n  The value strings will be truncated at 68 characters, and the HEASARC\n  long string keyword convention is not supported by this routine.\n*/\n{\n    char keyname[FLEN_KEYWORD], tcomment[FLEN_COMMENT];\n    int ii, jj, repeat, len;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* check if first comment string is to be repeated for all the keywords */\n    /* by looking to see if the last non-blank character is a '&' char      */\n\n    repeat = 0;\n\n    if (comm)\n    {\n      len = strlen(comm[0]);\n\n      while (len > 0  && comm[0][len - 1] == ' ')\n        len--;                               /* ignore trailing blanks */\n\n      if (len > 0 && comm[0][len - 1] == '&')\n      {\n        len = minvalue(len, FLEN_COMMENT);\n        tcomment[0] = '\\0';\n        strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */\n        repeat = 1;\n      }\n    }\n    else\n    {\n      repeat = 1;\n      tcomment[0] = '\\0';\n    }\n\n    for (ii=0, jj=nstart; ii < nkey; ii++, jj++)\n    {\n        ffkeyn(keyroot, jj, keyname, status);\n        if (repeat)\n            ffpkys(fptr, keyname, value[ii], tcomment, status);\n        else\n            ffpkys(fptr, keyname, value[ii], comm[ii], status);\n\n        if (*status > 0)\n            return(*status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpknl( fitsfile *fptr,     /* I - FITS file pointer                    */\n            const char *keyroot,      /* I - root name of keywords to write       */\n            int  nstart,        /* I - starting index number                */\n            int  nkey,          /* I - number of keywords to write          */\n            int  *value,        /* I - array of keyword values              */\n            char *comm[],       /* I - array of pointers to keyword comment */\n            int  *status)       /* IO - error status                        */\n/*\n  Write (put) an indexed array of keywords with index numbers between\n  NSTART and (NSTART + NKEY -1) inclusive.  Writes logical keywords\n  Values equal to zero will be written as a False FITS keyword value; any\n  other non-zero value will result in a True FITS keyword.\n*/\n{\n    char keyname[FLEN_KEYWORD], tcomment[FLEN_COMMENT];\n    int ii, jj, repeat, len;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* check if first comment string is to be repeated for all the keywords */\n    /* by looking to see if the last non-blank character is a '&' char      */\n\n    repeat = 0;\n    if (comm)\n    {\n      len = strlen(comm[0]);\n\n      while (len > 0  && comm[0][len - 1] == ' ')\n        len--;                               /* ignore trailing blanks */\n\n      if (len > 0 && comm[0][len - 1] == '&')\n      {\n        len = minvalue(len, FLEN_COMMENT);\n        tcomment[0] = '\\0';\n        strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */\n        repeat = 1;\n      }\n    }\n    else\n    {\n      repeat = 1;\n      tcomment[0] = '\\0';\n    }\n\n\n    for (ii=0, jj=nstart; ii < nkey; ii++, jj++)\n    {\n        ffkeyn(keyroot, jj, keyname, status);\n\n        if (repeat)\n            ffpkyl(fptr, keyname, value[ii], tcomment, status);\n        else\n            ffpkyl(fptr, keyname, value[ii], comm[ii], status);\n\n        if (*status > 0)\n            return(*status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpknj( fitsfile *fptr,     /* I - FITS file pointer                    */\n            const char *keyroot,      /* I - root name of keywords to write       */\n            int  nstart,        /* I - starting index number                */\n            int  nkey,          /* I - number of keywords to write          */\n            long *value,        /* I - array of keyword values              */\n            char *comm[],       /* I - array of pointers to keyword comment */\n            int  *status)       /* IO - error status                        */\n/*\n  Write (put) an indexed array of keywords with index numbers between\n  NSTART and (NSTART + NKEY -1) inclusive.  Write integer keywords\n*/\n{\n    char keyname[FLEN_KEYWORD], tcomment[FLEN_COMMENT];\n    int ii, jj, repeat, len;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* check if first comment string is to be repeated for all the keywords */\n    /* by looking to see if the last non-blank character is a '&' char      */\n\n    repeat = 0;\n\n    if (comm)\n    {\n      len = strlen(comm[0]);\n\n      while (len > 0  && comm[0][len - 1] == ' ')\n        len--;                               /* ignore trailing blanks */\n\n      if (len > 0 && comm[0][len - 1] == '&')\n      {\n        len = minvalue(len, FLEN_COMMENT);\n        tcomment[0] = '\\0';\n        strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */\n        repeat = 1;\n      }\n    }\n    else\n    {\n      repeat = 1;\n      tcomment[0] = '\\0';\n    }\n\n    for (ii=0, jj=nstart; ii < nkey; ii++, jj++)\n    {\n        ffkeyn(keyroot, jj, keyname, status);\n        if (repeat)\n            ffpkyj(fptr, keyname, value[ii], tcomment, status);\n        else\n            ffpkyj(fptr, keyname, value[ii], comm[ii], status);\n\n        if (*status > 0)\n            return(*status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpknjj( fitsfile *fptr,    /* I - FITS file pointer                    */\n            const char *keyroot,      /* I - root name of keywords to write       */\n            int  nstart,        /* I - starting index number                */\n            int  nkey,          /* I - number of keywords to write          */\n            LONGLONG *value,    /* I - array of keyword values              */\n            char *comm[],       /* I - array of pointers to keyword comment */\n            int  *status)       /* IO - error status                        */\n/*\n  Write (put) an indexed array of keywords with index numbers between\n  NSTART and (NSTART + NKEY -1) inclusive.  Write integer keywords\n*/\n{\n    char keyname[FLEN_KEYWORD], tcomment[FLEN_COMMENT];\n    int ii, jj, repeat, len;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* check if first comment string is to be repeated for all the keywords */\n    /* by looking to see if the last non-blank character is a '&' char      */\n\n    repeat = 0;\n\n    if (comm)\n    {\n      len = strlen(comm[0]);\n\n      while (len > 0  && comm[0][len - 1] == ' ')\n        len--;                               /* ignore trailing blanks */\n\n      if (len > 0 && comm[0][len - 1] == '&')\n      {\n        len = minvalue(len, FLEN_COMMENT);\n        tcomment[0] = '\\0';\n        strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */\n        repeat = 1;\n      }\n    }\n    else\n    {\n      repeat = 1;\n      tcomment[0] = '\\0';\n    }\n\n    for (ii=0, jj=nstart; ii < nkey; ii++, jj++)\n    {\n        ffkeyn(keyroot, jj, keyname, status);\n        if (repeat)\n            ffpkyj(fptr, keyname, value[ii], tcomment, status);\n        else\n            ffpkyj(fptr, keyname, value[ii], comm[ii], status);\n\n        if (*status > 0)\n            return(*status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpknf( fitsfile *fptr,     /* I - FITS file pointer                    */\n            const char *keyroot,      /* I - root name of keywords to write       */\n            int  nstart,        /* I - starting index number                */\n            int  nkey,          /* I - number of keywords to write          */\n            float *value,       /* I - array of keyword values              */\n            int decim,          /* I - number of decimals to display        */\n            char *comm[],       /* I - array of pointers to keyword comment */\n            int  *status)       /* IO - error status                        */\n/*\n  Write (put) an indexed array of keywords with index numbers between\n  NSTART and (NSTART + NKEY -1) inclusive.  Writes fixed float values.\n*/\n{\n    char keyname[FLEN_KEYWORD], tcomment[FLEN_COMMENT];\n    int ii, jj, repeat, len;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* check if first comment string is to be repeated for all the keywords */\n    /* by looking to see if the last non-blank character is a '&' char      */\n\n    repeat = 0;\n\n    if (comm)\n    {\n      len = strlen(comm[0]);\n\n      while (len > 0  && comm[0][len - 1] == ' ')\n        len--;                               /* ignore trailing blanks */\n\n      if (len > 0 && comm[0][len - 1] == '&')\n      {\n        len = minvalue(len, FLEN_COMMENT);\n        tcomment[0] = '\\0';\n        strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */\n        repeat = 1;\n      }\n    }\n    else\n    {\n      repeat = 1;\n      tcomment[0] = '\\0';\n    }\n\n    for (ii=0, jj=nstart; ii < nkey; ii++, jj++)\n    {\n        ffkeyn(keyroot, jj, keyname, status);\n        if (repeat)\n            ffpkyf(fptr, keyname, value[ii], decim, tcomment, status);\n        else\n            ffpkyf(fptr, keyname, value[ii], decim, comm[ii], status);\n\n        if (*status > 0)\n            return(*status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpkne( fitsfile *fptr,     /* I - FITS file pointer                    */\n            const char *keyroot,      /* I - root name of keywords to write       */\n            int  nstart,        /* I - starting index number                */\n            int  nkey,          /* I - number of keywords to write          */\n            float *value,       /* I - array of keyword values              */\n            int decim,          /* I - number of decimals to display        */\n            char *comm[],       /* I - array of pointers to keyword comment */\n            int  *status)       /* IO - error status                        */\n/*\n  Write (put) an indexed array of keywords with index numbers between\n  NSTART and (NSTART + NKEY -1) inclusive.  Writes exponential float values.\n*/\n{\n    char keyname[FLEN_KEYWORD], tcomment[FLEN_COMMENT];\n    int ii, jj, repeat, len;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* check if first comment string is to be repeated for all the keywords */\n    /* by looking to see if the last non-blank character is a '&' char      */\n\n    repeat = 0;\n\n    if (comm)\n    {\n      len = strlen(comm[0]);\n\n      while (len > 0  && comm[0][len - 1] == ' ')\n        len--;                               /* ignore trailing blanks */\n\n      if (len > 0 && comm[0][len - 1] == '&')\n      {\n        len = minvalue(len, FLEN_COMMENT);\n        tcomment[0] = '\\0';\n        strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */\n        repeat = 1;\n      }\n    }\n    else\n    {\n      repeat = 1;\n      tcomment[0] = '\\0';\n    }\n\n    for (ii=0, jj=nstart; ii < nkey; ii++, jj++)\n    {\n        ffkeyn(keyroot, jj, keyname, status);\n        if (repeat)\n            ffpkye(fptr, keyname, value[ii], decim, tcomment, status);\n        else\n            ffpkye(fptr, keyname, value[ii], decim, comm[ii], status);\n\n        if (*status > 0)\n            return(*status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpkng( fitsfile *fptr,     /* I - FITS file pointer                    */\n            const char *keyroot,      /* I - root name of keywords to write       */\n            int  nstart,        /* I - starting index number                */\n            int  nkey,          /* I - number of keywords to write          */\n            double *value,      /* I - array of keyword values              */\n            int decim,          /* I - number of decimals to display        */\n            char *comm[],       /* I - array of pointers to keyword comment */\n            int  *status)       /* IO - error status                        */\n/*\n  Write (put) an indexed array of keywords with index numbers between\n  NSTART and (NSTART + NKEY -1) inclusive.  Writes fixed double values.\n*/\n{\n    char keyname[FLEN_KEYWORD], tcomment[FLEN_COMMENT];\n    int ii, jj, repeat, len;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* check if first comment string is to be repeated for all the keywords */\n    /* by looking to see if the last non-blank character is a '&' char      */\n\n    repeat = 0;\n\n    if (comm)\n    {\n      len = strlen(comm[0]);\n\n      while (len > 0  && comm[0][len - 1] == ' ')\n        len--;                               /* ignore trailing blanks */\n\n      if (len > 0 && comm[0][len - 1] == '&')\n      {\n        len = minvalue(len, FLEN_COMMENT);\n        tcomment[0] = '\\0';\n        strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */\n        repeat = 1;\n      }\n    }\n    else\n    {\n      repeat = 1;\n      tcomment[0] = '\\0';\n    }\n\n    for (ii=0, jj=nstart; ii < nkey; ii++, jj++)\n    {\n        ffkeyn(keyroot, jj, keyname, status);\n        if (repeat)\n            ffpkyg(fptr, keyname, value[ii], decim, tcomment, status);\n        else\n            ffpkyg(fptr, keyname, value[ii], decim, comm[ii], status);\n\n        if (*status > 0)\n            return(*status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffpknd( fitsfile *fptr,     /* I - FITS file pointer                    */\n            const char *keyroot,      /* I - root name of keywords to write       */\n            int  nstart,        /* I - starting index number                */\n            int  nkey,          /* I - number of keywords to write          */\n            double *value,      /* I - array of keyword values              */\n            int decim,          /* I - number of decimals to display        */\n            char *comm[],       /* I - array of pointers to keyword comment */\n            int  *status)       /* IO - error status                        */\n/*\n  Write (put) an indexed array of keywords with index numbers between\n  NSTART and (NSTART + NKEY -1) inclusive.  Writes exponential double values.\n*/\n{\n    char keyname[FLEN_KEYWORD], tcomment[FLEN_COMMENT];\n    int ii, jj, repeat, len;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    /* check if first comment string is to be repeated for all the keywords */\n    /* by looking to see if the last non-blank character is a '&' char      */\n\n    repeat = 0;\n\n    if (comm)\n    {\n      len = strlen(comm[0]);\n\n      while (len > 0  && comm[0][len - 1] == ' ')\n        len--;                               /* ignore trailing blanks */\n\n      if (len > 0 && comm[0][len - 1] == '&')\n      {\n        len = minvalue(len, FLEN_COMMENT);\n        tcomment[0] = '\\0';\n        strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */\n        repeat = 1;\n      }\n    }\n    else\n    {\n      repeat = 1;\n      tcomment[0] = '\\0';\n    }\n\n    for (ii=0, jj=nstart; ii < nkey; ii++, jj++)\n    {\n        ffkeyn(keyroot, jj, keyname, status);\n        if (repeat)\n            ffpkyd(fptr, keyname, value[ii], decim, tcomment, status);\n        else\n            ffpkyd(fptr, keyname, value[ii], decim, comm[ii], status);\n\n        if (*status > 0)\n            return(*status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffptdm( fitsfile *fptr, /* I - FITS file pointer                        */\n            int colnum,     /* I - column number                            */\n            int naxis,      /* I - number of axes in the data array         */\n            long naxes[],   /* I - length of each data axis                 */\n            int *status)    /* IO - error status                            */\n/*\n  write the TDIMnnn keyword describing the dimensionality of a column\n*/\n{\n    char keyname[FLEN_KEYWORD], tdimstr[FLEN_VALUE], comm[FLEN_COMMENT];\n    char value[80], message[FLEN_ERRMSG];\n    int ii;\n    long totalpix = 1, repeat;\n    tcolumn *colptr;\n\n    if (*status > 0)\n        return(*status);\n\n    if (colnum < 1 || colnum > 999)\n    {\n        ffpmsg(\"column number is out of range 1 - 999 (ffptdm)\");\n        return(*status = BAD_COL_NUM);\n    }\n\n    if (naxis < 1)\n    {\n        ffpmsg(\"naxis is less than 1 (ffptdm)\");\n        return(*status = BAD_DIMEN);\n    }\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    if ( (fptr->Fptr)->hdutype != BINARY_TBL)\n    {\n       ffpmsg(\n    \"Error: The TDIMn keyword is only allowed in BINTABLE extensions (ffptdm)\");\n       return(*status = NOT_BTABLE);\n    }\n\n    strcpy(tdimstr, \"(\");            /* start constructing the TDIM value */   \n\n    for (ii = 0; ii < naxis; ii++)\n    {\n        if (ii > 0)\n            strcat(tdimstr, \",\");   /* append the comma separator */\n\n        if (naxes[ii] < 0)\n        {\n            ffpmsg(\"one or more TDIM values are less than 0 (ffptdm)\");\n            return(*status = BAD_TDIM);\n        }\n\n        snprintf(value, 80,\"%ld\", naxes[ii]);\n        /* This will either be followed by a ',' or ')'. */\n        if (strlen(tdimstr)+strlen(value)+1 > FLEN_VALUE-1)\n        {\n            ffpmsg(\"TDIM string too long (ffptdm)\");\n            return(*status = BAD_TDIM);\n        }\n        strcat(tdimstr, value);     /* append the axis size */\n\n        totalpix *= naxes[ii];\n    }\n\n    colptr = (fptr->Fptr)->tableptr;  /* point to first column structure */\n    colptr += (colnum - 1);      /* point to the specified column number */\n\n    if ((long) colptr->trepeat != totalpix)\n    {\n      /* There is an apparent inconsistency between TDIMn and TFORMn. */\n      /* The colptr->trepeat value may be out of date, so re-read     */\n      /* the TFORMn keyword to be sure.                               */\n\n      ffkeyn(\"TFORM\", colnum, keyname, status);   /* construct TFORMn name  */\n      ffgkys(fptr, keyname, value, NULL, status); /* read TFORMn keyword    */\n      ffbnfm(value, NULL, &repeat, NULL, status); /* parse the repeat count */\n\n      if (*status > 0 || repeat != totalpix)\n      {\n        snprintf(message,FLEN_ERRMSG,\n        \"column vector length, %ld, does not equal TDIMn array size, %ld\",\n        (long) colptr->trepeat, totalpix);\n        ffpmsg(message);\n        return(*status = BAD_TDIM);\n      }\n    }\n\n    strcat(tdimstr, \")\" );            /* append the closing parenthesis */\n\n    strcpy(comm, \"size of the multidimensional array\");\n    ffkeyn(\"TDIM\", colnum, keyname, status);      /* construct TDIMn name */\n    ffpkys(fptr, keyname, tdimstr, comm, status);  /* write the keyword */\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffptdmll( fitsfile *fptr, /* I - FITS file pointer                      */\n            int colnum,     /* I - column number                            */\n            int naxis,      /* I - number of axes in the data array         */\n            LONGLONG naxes[], /* I - length of each data axis               */\n            int *status)    /* IO - error status                            */\n/*\n  write the TDIMnnn keyword describing the dimensionality of a column\n*/\n{\n    char keyname[FLEN_KEYWORD], tdimstr[FLEN_VALUE], comm[FLEN_COMMENT];\n    char value[80], message[81];\n    int ii;\n    LONGLONG totalpix = 1, repeat;\n    tcolumn *colptr;\n\n    if (*status > 0)\n        return(*status);\n\n    if (colnum < 1 || colnum > 999)\n    {\n        ffpmsg(\"column number is out of range 1 - 999 (ffptdm)\");\n        return(*status = BAD_COL_NUM);\n    }\n\n    if (naxis < 1)\n    {\n        ffpmsg(\"naxis is less than 1 (ffptdm)\");\n        return(*status = BAD_DIMEN);\n    }\n\n    /* reset position to the correct HDU if necessary */\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n    else if ((fptr->Fptr)->datastart == DATA_UNDEFINED)\n        if ( ffrdef(fptr, status) > 0)               /* rescan header */\n            return(*status);\n\n    if ( (fptr->Fptr)->hdutype != BINARY_TBL)\n    {\n       ffpmsg(\n    \"Error: The TDIMn keyword is only allowed in BINTABLE extensions (ffptdm)\");\n       return(*status = NOT_BTABLE);\n    }\n\n    strcpy(tdimstr, \"(\");            /* start constructing the TDIM value */   \n\n    for (ii = 0; ii < naxis; ii++)\n    {\n        if (ii > 0)\n            strcat(tdimstr, \",\");   /* append the comma separator */\n\n        if (naxes[ii] < 0)\n        {\n            ffpmsg(\"one or more TDIM values are less than 0 (ffptdm)\");\n            return(*status = BAD_TDIM);\n        }\n\n        /* cast to double because the 64-bit int conversion character in */\n        /* sprintf is platform dependent ( %lld, %ld, %I64d )            */\n\n        snprintf(value, 80, \"%.0f\", (double) naxes[ii]);\n        \n        if (strlen(tdimstr)+strlen(value)+1 > FLEN_VALUE-1)\n        {\n            ffpmsg(\"TDIM string too long (ffptdmll)\");\n            return(*status = BAD_TDIM);\n        }\n        strcat(tdimstr, value);     /* append the axis size */\n\n        totalpix *= naxes[ii];\n    }\n\n    colptr = (fptr->Fptr)->tableptr;  /* point to first column structure */\n    colptr += (colnum - 1);      /* point to the specified column number */\n\n    if ( colptr->trepeat != totalpix)\n    {\n      /* There is an apparent inconsistency between TDIMn and TFORMn. */\n      /* The colptr->trepeat value may be out of date, so re-read     */\n      /* the TFORMn keyword to be sure.                               */\n\n      ffkeyn(\"TFORM\", colnum, keyname, status);   /* construct TFORMn name  */\n      ffgkys(fptr, keyname, value, NULL, status); /* read TFORMn keyword    */\n      ffbnfmll(value, NULL, &repeat, NULL, status); /* parse the repeat count */\n\n      if (*status > 0 || repeat != totalpix)\n      {\n        snprintf(message,FLEN_ERRMSG,\n        \"column vector length, %.0f, does not equal TDIMn array size, %.0f\",\n        (double) (colptr->trepeat), (double) totalpix);\n        ffpmsg(message);\n        return(*status = BAD_TDIM);\n      }\n    }\n\n    strcat(tdimstr, \")\" );            /* append the closing parenthesis */\n\n    strcpy(comm, \"size of the multidimensional array\");\n    ffkeyn(\"TDIM\", colnum, keyname, status);      /* construct TDIMn name */\n    ffpkys(fptr, keyname, tdimstr, comm, status);  /* write the keyword */\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffphps( fitsfile *fptr, /* I - FITS file pointer                        */\n            int bitpix,     /* I - number of bits per data value pixel      */\n            int naxis,      /* I - number of axes in the data array         */\n            long naxes[],   /* I - length of each data axis                 */\n            int *status)    /* IO - error status                            */\n/*\n  write STANDARD set of required primary header keywords\n*/\n{\n    int simple = 1;     /* does file conform to FITS standard? 1/0  */\n    long pcount = 0;    /* number of group parameters (usually 0)   */\n    long gcount = 1;    /* number of random groups (usually 1 or 0) */\n    int extend = 1;     /* may FITS file have extensions?           */\n\n    ffphpr(fptr, simple, bitpix, naxis, naxes, pcount, gcount, extend, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffphpsll( fitsfile *fptr, /* I - FITS file pointer                        */\n            int bitpix,     /* I - number of bits per data value pixel      */\n            int naxis,      /* I - number of axes in the data array         */\n            LONGLONG naxes[],   /* I - length of each data axis                 */\n            int *status)    /* IO - error status                            */\n/*\n  write STANDARD set of required primary header keywords\n*/\n{\n    int simple = 1;     /* does file conform to FITS standard? 1/0  */\n    LONGLONG pcount = 0;    /* number of group parameters (usually 0)   */\n    LONGLONG gcount = 1;    /* number of random groups (usually 1 or 0) */\n    int extend = 1;     /* may FITS file have extensions?           */\n\n    ffphprll(fptr, simple, bitpix, naxis, naxes, pcount, gcount, extend, status);\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffphpr( fitsfile *fptr, /* I - FITS file pointer                        */\n            int simple,     /* I - does file conform to FITS standard? 1/0  */\n            int bitpix,     /* I - number of bits per data value pixel      */\n            int naxis,      /* I - number of axes in the data array         */\n            long naxes[],   /* I - length of each data axis                 */\n            LONGLONG pcount, /* I - number of group parameters (usually 0)   */\n            LONGLONG gcount, /* I - number of random groups (usually 1 or 0) */\n            int extend,     /* I - may FITS file have extensions?           */\n            int *status)    /* IO - error status                            */\n/*\n  write required primary header keywords\n*/\n{\n    int ii;\n    LONGLONG naxesll[20];\n   \n    for (ii = 0; (ii < naxis) && (ii < 20); ii++)\n       naxesll[ii] = naxes[ii];\n\n    ffphprll(fptr, simple, bitpix, naxis, naxesll, pcount, gcount,\n             extend, status);\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffphprll( fitsfile *fptr, /* I - FITS file pointer                        */\n            int simple,     /* I - does file conform to FITS standard? 1/0  */\n            int bitpix,     /* I - number of bits per data value pixel      */\n            int naxis,      /* I - number of axes in the data array         */\n            LONGLONG naxes[], /* I - length of each data axis                 */\n            LONGLONG pcount,  /* I - number of group parameters (usually 0)   */\n            LONGLONG gcount,  /* I - number of random groups (usually 1 or 0) */\n            int extend,     /* I - may FITS file have extensions?           */\n            int *status)    /* IO - error status                            */\n/*\n  write required primary header keywords\n*/\n{\n    int ii;\n    long longbitpix, tnaxes[20];\n    char name[FLEN_KEYWORD], comm[FLEN_COMMENT], message[FLEN_ERRMSG];\n    char card[FLEN_CARD];\n\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if ((fptr->Fptr)->headend != (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] )\n        return(*status = HEADER_NOT_EMPTY);\n\n    if (naxis != 0)   /* never try to compress a null image */\n    {\n      if ( (fptr->Fptr)->request_compress_type )\n      {\n      \n       for (ii = 0; ii < naxis; ii++)\n           tnaxes[ii] = (long) naxes[ii];\n\t   \n        /* write header for a compressed image */\n        imcomp_init_table(fptr, bitpix, naxis, tnaxes, 1, status);\n        return(*status);\n      }\n    }  \n\n    if ((fptr->Fptr)->curhdu == 0)\n    {                /* write primary array header */\n        if (simple)\n            strcpy(comm, \"file does conform to FITS standard\");\n        else\n            strcpy(comm, \"file does not conform to FITS standard\");\n\n        ffpkyl(fptr, \"SIMPLE\", simple, comm, status);\n    }\n    else\n    {               /* write IMAGE extension header */\n        strcpy(comm, \"IMAGE extension\");\n        ffpkys(fptr, \"XTENSION\", \"IMAGE\", comm, status);\n    }\n\n    longbitpix = bitpix;\n\n    /* test for the 3 special cases that represent unsigned integers */\n    if (longbitpix == USHORT_IMG)\n        longbitpix = SHORT_IMG;\n    else if (longbitpix == ULONG_IMG)\n        longbitpix = LONG_IMG;\n    else if (longbitpix == ULONGLONG_IMG)\n        longbitpix = LONGLONG_IMG;\n    else if (longbitpix == SBYTE_IMG)\n        longbitpix = BYTE_IMG;\n\n    if (longbitpix != BYTE_IMG && longbitpix != SHORT_IMG && \n        longbitpix != LONG_IMG && longbitpix != LONGLONG_IMG &&\n        longbitpix != FLOAT_IMG && longbitpix != DOUBLE_IMG)\n    {\n        snprintf(message,FLEN_ERRMSG,\n        \"Illegal value for BITPIX keyword: %d\", bitpix);\n        ffpmsg(message);\n        return(*status = BAD_BITPIX);\n    }\n\n    strcpy(comm, \"number of bits per data pixel\");\n    if (ffpkyj(fptr, \"BITPIX\", longbitpix, comm, status) > 0)\n        return(*status);\n\n    if (naxis < 0 || naxis > 999)\n    {\n        snprintf(message,FLEN_ERRMSG,\n        \"Illegal value for NAXIS keyword: %d\", naxis);\n        ffpmsg(message);\n        return(*status = BAD_NAXIS);\n    }\n\n    strcpy(comm, \"number of data axes\");\n    ffpkyj(fptr, \"NAXIS\", naxis, comm, status);\n\n    strcpy(comm, \"length of data axis \");\n    for (ii = 0; ii < naxis; ii++)\n    {\n        if (naxes[ii] < 0)\n        {\n            snprintf(message,FLEN_ERRMSG,\n            \"Illegal negative value for NAXIS%d keyword: %.0f\", ii + 1, (double) (naxes[ii]));\n            ffpmsg(message);\n            return(*status = BAD_NAXES);\n        }\n\n        snprintf(&comm[20], FLEN_COMMENT-20,\"%d\", ii + 1);\n        ffkeyn(\"NAXIS\", ii + 1, name, status);\n        ffpkyj(fptr, name, naxes[ii], comm, status);\n    }\n\n    if ((fptr->Fptr)->curhdu == 0)  /* the primary array */\n    {\n        if (extend)\n        {\n            /* only write EXTEND keyword if value = true */\n            strcpy(comm, \"FITS dataset may contain extensions\");\n            ffpkyl(fptr, \"EXTEND\", extend, comm, status);\n        }\n\n        if (pcount < 0)\n        {\n            ffpmsg(\"pcount value is less than 0\");\n            return(*status = BAD_PCOUNT);\n        }\n\n        else if (gcount < 1)\n        {\n            ffpmsg(\"gcount value is less than 1\");\n            return(*status = BAD_GCOUNT);\n        }\n\n        else if (pcount > 0 || gcount > 1)\n        {\n            /* only write these keyword if non-standard values */\n            strcpy(comm, \"random group records are present\");\n            ffpkyl(fptr, \"GROUPS\", 1, comm, status);\n\n            strcpy(comm, \"number of random group parameters\");\n            ffpkyj(fptr, \"PCOUNT\", pcount, comm, status);\n  \n            strcpy(comm, \"number of random groups\");\n            ffpkyj(fptr, \"GCOUNT\", gcount, comm, status);\n        }\n\n      /* write standard block of self-documentating comments */\n      ffprec(fptr,\n      \"COMMENT   FITS (Flexible Image Transport System) format is defined in 'Astronomy\",\n      status);\n      ffprec(fptr,\n      \"COMMENT   and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H\",\n      status);\n    }\n\n    else  /* an IMAGE extension */\n\n    {   /* image extension; cannot have random groups */\n        if (pcount != 0)\n        {\n            ffpmsg(\"image extensions must have pcount = 0\");\n            *status = BAD_PCOUNT;\n        }\n\n        else if (gcount != 1)\n        {\n            ffpmsg(\"image extensions must have gcount = 1\");\n            *status = BAD_GCOUNT;\n        }\n\n        else\n        {\n            strcpy(comm, \"required keyword; must = 0\");\n            ffpkyj(fptr, \"PCOUNT\", 0, comm, status);\n  \n            strcpy(comm, \"required keyword; must = 1\");\n            ffpkyj(fptr, \"GCOUNT\", 1, comm, status);\n        }\n    }\n\n    /* Write the BSCALE and BZERO keywords, if an unsigned integer image */\n    if (bitpix == USHORT_IMG)\n    {\n        strcpy(comm, \"offset data range to that of unsigned short\");\n        ffpkyg(fptr, \"BZERO\", 32768., 0, comm, status);\n        strcpy(comm, \"default scaling factor\");\n        ffpkyg(fptr, \"BSCALE\", 1.0, 0, comm, status);\n    }\n    else if (bitpix == ULONG_IMG)\n    {\n        strcpy(comm, \"offset data range to that of unsigned long\");\n        ffpkyg(fptr, \"BZERO\", 2147483648., 0, comm, status);\n        strcpy(comm, \"default scaling factor\");\n        ffpkyg(fptr, \"BSCALE\", 1.0, 0, comm, status);\n    }\n    else if (bitpix == ULONGLONG_IMG)\n    {\n        strcpy(card,\"BZERO   =  9223372036854775808 / offset data range to that of unsigned long long\");\n        ffprec(fptr, card, status);\n        strcpy(comm, \"default scaling factor\");\n        ffpkyg(fptr, \"BSCALE\", 1.0, 0, comm, status);\n    }\n    else if (bitpix == SBYTE_IMG)\n    {\n        strcpy(comm, \"offset data range to that of signed byte\");\n        ffpkyg(fptr, \"BZERO\", -128., 0, comm, status);\n        strcpy(comm, \"default scaling factor\");\n        ffpkyg(fptr, \"BSCALE\", 1.0, 0, comm, status);\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffphtb(fitsfile *fptr,  /* I - FITS file pointer                        */\n           LONGLONG naxis1,     /* I - width of row in the table                */\n           LONGLONG naxis2,     /* I - number of rows in the table              */\n           int tfields,     /* I - number of columns in the table           */\n           char **ttype,    /* I - name of each column                      */\n           long *tbcol,     /* I - byte offset in row to each column        */\n           char **tform,    /* I - value of TFORMn keyword for each column  */\n           char **tunit,    /* I - value of TUNITn keyword for each column  */\n           const char *extnmx,   /* I - value of EXTNAME keyword, if any         */\n           int *status)     /* IO - error status                            */\n/*\n  Put required Header keywords into the ASCII TaBle:\n*/\n{\n    int ii, ncols, gotmem = 0;\n    long rowlen; /* must be 'long' because it is passed to ffgabc */\n    char tfmt[30], name[FLEN_KEYWORD], comm[FLEN_COMMENT], extnm[FLEN_VALUE];\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if (*status > 0)\n        return(*status);\n    else if ((fptr->Fptr)->headend != (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] )\n        return(*status = HEADER_NOT_EMPTY);\n    else if (naxis1 < 0)\n        return(*status = NEG_WIDTH);\n    else if (naxis2 < 0)\n        return(*status = NEG_ROWS);\n    else if (tfields < 0 || tfields > 999)\n        return(*status = BAD_TFIELDS);\n    \n    extnm[0] = '\\0';\n    if (extnmx)\n        strncat(extnm, extnmx, FLEN_VALUE-1);\n\n    rowlen = (long) naxis1;\n\n    if (!tbcol || !tbcol[0] || (!naxis1 && tfields)) /* spacing not defined? */\n    {\n      /* allocate mem for tbcol; malloc can have problems allocating small */\n      /* arrays, so allocate at least 20 bytes */\n\n      ncols = maxvalue(5, tfields);\n      tbcol = (long *) calloc(ncols, sizeof(long));\n\n      if (tbcol)\n      {\n        gotmem = 1;\n\n        /* calculate width of a row and starting position of each column. */\n        /* Each column will be separated by 1 blank space */\n        ffgabc(tfields, tform, 1, &rowlen, tbcol, status);\n      }\n    }\n    ffpkys(fptr, \"XTENSION\", \"TABLE\", \"ASCII table extension\", status);\n    ffpkyj(fptr, \"BITPIX\", 8, \"8-bit ASCII characters\", status);\n    ffpkyj(fptr, \"NAXIS\", 2, \"2-dimensional ASCII table\", status);\n    ffpkyj(fptr, \"NAXIS1\", rowlen, \"width of table in characters\", status);\n    ffpkyj(fptr, \"NAXIS2\", naxis2, \"number of rows in table\", status);\n    ffpkyj(fptr, \"PCOUNT\", 0, \"no group parameters (required keyword)\", status);\n    ffpkyj(fptr, \"GCOUNT\", 1, \"one data group (required keyword)\", status);\n    ffpkyj(fptr, \"TFIELDS\", tfields, \"number of fields in each row\", status);\n\n    for (ii = 0; ii < tfields; ii++) /* loop over every column */\n    {\n        if ( *(ttype[ii]) )  /* optional TTYPEn keyword */\n        {\n          snprintf(comm, FLEN_COMMENT,\"label for field %3d\", ii + 1);\n          ffkeyn(\"TTYPE\", ii + 1, name, status);\n          ffpkys(fptr, name, ttype[ii], comm, status);\n        }\n\n        if (tbcol[ii] < 1 || tbcol[ii] > rowlen)\n           *status = BAD_TBCOL;\n\n        snprintf(comm, FLEN_COMMENT,\"beginning column of field %3d\", ii + 1);\n        ffkeyn(\"TBCOL\", ii + 1, name, status);\n        ffpkyj(fptr, name, tbcol[ii], comm, status);\n\n        if (strlen(tform[ii]) > 29)\n        {\n          ffpmsg(\"Error: ASCII table TFORM code is too long (ffphtb)\");\n          *status = BAD_TFORM;\n          break;\n        }\n        strcpy(tfmt, tform[ii]);  /* required TFORMn keyword */\n        ffupch(tfmt);\n        ffkeyn(\"TFORM\", ii + 1, name, status);\n        ffpkys(fptr, name, tfmt, \"Fortran-77 format of field\", status);\n\n        if (tunit)\n        {\n         if (tunit[ii] && *(tunit[ii]) )  /* optional TUNITn keyword */\n         {\n          ffkeyn(\"TUNIT\", ii + 1, name, status);\n          ffpkys(fptr, name, tunit[ii], \"physical unit of field\", status) ;\n         }\n        }\n\n        if (*status > 0)\n            break;       /* abort loop on error */\n    }\n\n    if (extnm[0])       /* optional EXTNAME keyword */\n        ffpkys(fptr, \"EXTNAME\", extnm,\n               \"name of this ASCII table extension\", status);\n\n    if (*status > 0)\n        ffpmsg(\"Failed to write ASCII table header keywords (ffphtb)\");\n\n    if (gotmem)\n        free(tbcol); \n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffphbn(fitsfile *fptr,  /* I - FITS file pointer                        */\n           LONGLONG naxis2,     /* I - number of rows in the table              */\n           int tfields,     /* I - number of columns in the table           */\n           char **ttype,    /* I - name of each column                      */\n           char **tform,    /* I - value of TFORMn keyword for each column  */\n           char **tunit,    /* I - value of TUNITn keyword for each column  */\n           const char *extnmx,   /* I - value of EXTNAME keyword, if any         */\n           LONGLONG pcount,     /* I - size of the variable length heap area    */\n           int *status)     /* IO - error status                            */\n/*\n  Put required Header keywords into the Binary Table:\n*/\n{\n    int ii, datatype, iread = 0;\n    long repeat, width;\n    LONGLONG naxis1;\n\n    char tfmt[30], name[FLEN_KEYWORD], comm[FLEN_COMMENT], extnm[FLEN_VALUE];\n    char *cptr, card[FLEN_CARD];\n    tcolumn *colptr;\n\n    if (*status > 0)\n        return(*status);\n\n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if ((fptr->Fptr)->headend != (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] )\n        return(*status = HEADER_NOT_EMPTY);\n    else if (naxis2 < 0)\n        return(*status = NEG_ROWS);\n    else if (pcount < 0)\n        return(*status = BAD_PCOUNT);\n    else if (tfields < 0 || tfields > 999)\n        return(*status = BAD_TFIELDS);\n\n    extnm[0] = '\\0';\n    if (extnmx)\n        strncat(extnm, extnmx, FLEN_VALUE-1);\n\n    ffpkys(fptr, \"XTENSION\", \"BINTABLE\", \"binary table extension\", status);\n    ffpkyj(fptr, \"BITPIX\", 8, \"8-bit bytes\", status);\n    ffpkyj(fptr, \"NAXIS\", 2, \"2-dimensional binary table\", status);\n\n    naxis1 = 0;\n    for (ii = 0; ii < tfields; ii++)  /* sum the width of each field */\n    {\n        ffbnfm(tform[ii], &datatype, &repeat, &width, status);\n\n        if (datatype == TSTRING)\n            naxis1 += repeat;   /* one byte per char */\n        else if (datatype == TBIT)\n            naxis1 += (repeat + 7) / 8;\n        else if (datatype > 0)\n            naxis1 += repeat * (datatype / 10);\n        else if (tform[ii][0] == 'P' || tform[ii][1] == 'P'||\n                 tform[ii][0] == 'p' || tform[ii][1] == 'p')\n           /* this is a 'P' variable length descriptor (neg. datatype) */\n            naxis1 += 8;\n        else\n           /* this is a 'Q' variable length descriptor (neg. datatype) */\n            naxis1 += 16;\n\n        if (*status > 0)\n            break;       /* abort loop on error */\n    }\n\n    ffpkyj(fptr, \"NAXIS1\", naxis1, \"width of table in bytes\", status);\n    ffpkyj(fptr, \"NAXIS2\", naxis2, \"number of rows in table\", status);\n\n    /*\n      the initial value of PCOUNT (= size of the variable length array heap)\n      should always be zero.  If any variable length data is written, then\n      the value of PCOUNT will be updated when the HDU is closed\n    */\n    ffpkyj(fptr, \"PCOUNT\", 0, \"size of special data area\", status);\n    ffpkyj(fptr, \"GCOUNT\", 1, \"one data group (required keyword)\", status);\n    ffpkyj(fptr, \"TFIELDS\", tfields, \"number of fields in each row\", status);\n\n    for (ii = 0; ii < tfields; ii++) /* loop over every column */\n    {\n        if ( *(ttype[ii]) )  /* optional TTYPEn keyword */\n        {\n          snprintf(comm, FLEN_COMMENT,\"label for field %3d\", ii + 1);\n          ffkeyn(\"TTYPE\", ii + 1, name, status);\n          ffpkys(fptr, name, ttype[ii], comm, status);\n        }\n\n        if (strlen(tform[ii]) > 29)\n        {\n          ffpmsg(\"Error: BIN table TFORM code is too long (ffphbn)\");\n          *status = BAD_TFORM;\n          break;\n        }\n        strcpy(tfmt, tform[ii]);  /* required TFORMn keyword */\n        ffupch(tfmt);\n\n        ffkeyn(\"TFORM\", ii + 1, name, status);\n        strcpy(comm, \"data format of field\");\n\n        ffbnfm(tfmt, &datatype, &repeat, &width, status);\n\n        if (datatype == TSTRING)\n        {\n            strcat(comm, \": ASCII Character\");\n\n            /* Do sanity check to see if an ASCII table format was used,  */\n            /* e.g., 'A8' instead of '8A', or a bad unit width eg '8A9'.  */\n            /* Don't want to return an error status, so write error into  */\n            /* the keyword comment.  */\n\n            cptr = strchr(tfmt,'A');\n            cptr++;\n\n            if (cptr)\n               iread = sscanf(cptr,\"%ld\", &width);\n\n            if (iread == 1 && (width > repeat)) \n            {\n              if (repeat == 1)\n                strcpy(comm, \"ERROR??  USING ASCII TABLE SYNTAX BY MISTAKE??\");\n              else\n                strcpy(comm, \"rAw FORMAT ERROR! UNIT WIDTH w > COLUMN WIDTH r\");\n            }\n        }\n        else if (datatype == TBIT)\n           strcat(comm, \": BIT\");\n        else if (datatype == TBYTE)\n           strcat(comm, \": BYTE\");\n        else if (datatype == TLOGICAL)\n           strcat(comm, \": 1-byte LOGICAL\");\n        else if (datatype == TSHORT)\n           strcat(comm, \": 2-byte INTEGER\");\n        else if (datatype == TUSHORT)\n           strcat(comm, \": 2-byte INTEGER\");\n        else if (datatype == TLONG)\n           strcat(comm, \": 4-byte INTEGER\");\n        else if (datatype == TLONGLONG)\n           strcat(comm, \": 8-byte INTEGER\");\n        else if (datatype == TULONG)\n           strcat(comm, \": 4-byte INTEGER\");\n        else if (datatype == TULONGLONG)\n           strcat(comm, \": 8-byte INTEGER\");\n        else if (datatype == TFLOAT)\n           strcat(comm, \": 4-byte REAL\");\n        else if (datatype == TDOUBLE)\n           strcat(comm, \": 8-byte DOUBLE\");\n        else if (datatype == TCOMPLEX)\n           strcat(comm, \": COMPLEX\");\n        else if (datatype == TDBLCOMPLEX)\n           strcat(comm, \": DOUBLE COMPLEX\");\n        else if (datatype < 0)\n           strcat(comm, \": variable length array\");\n\n        if (abs(datatype) == TSBYTE) /* signed bytes */\n        {\n           /* Replace the 'S' with an 'B' in the TFORMn code */\n           cptr = tfmt;\n           while (*cptr != 'S') \n              cptr++;\n\n           *cptr = 'B';\n           ffpkys(fptr, name, tfmt, comm, status);\n\n           /* write the TZEROn and TSCALn keywords */\n           ffkeyn(\"TZERO\", ii + 1, name, status);\n           strcpy(comm, \"offset for signed bytes\");\n\n           ffpkyg(fptr, name, -128., 0, comm, status);\n\n           ffkeyn(\"TSCAL\", ii + 1, name, status);\n           strcpy(comm, \"data are not scaled\");\n           ffpkyg(fptr, name, 1., 0, comm, status);\n        }\n        else if (abs(datatype) == TUSHORT) \n        {\n           /* Replace the 'U' with an 'I' in the TFORMn code */\n           cptr = tfmt;\n           while (*cptr != 'U') \n              cptr++;\n\n           *cptr = 'I';\n           ffpkys(fptr, name, tfmt, comm, status);\n\n           /* write the TZEROn and TSCALn keywords */\n           ffkeyn(\"TZERO\", ii + 1, name, status);\n           strcpy(comm, \"offset for unsigned integers\");\n\n           ffpkyg(fptr, name, 32768., 0, comm, status);\n\n           ffkeyn(\"TSCAL\", ii + 1, name, status);\n           strcpy(comm, \"data are not scaled\");\n           ffpkyg(fptr, name, 1., 0, comm, status);\n        }\n        else if (abs(datatype) == TULONG) \n        {\n           /* Replace the 'V' with an 'J' in the TFORMn code */\n           cptr = tfmt;\n           while (*cptr != 'V') \n              cptr++;\n\n           *cptr = 'J';\n           ffpkys(fptr, name, tfmt, comm, status);\n\n           /* write the TZEROn and TSCALn keywords */\n           ffkeyn(\"TZERO\", ii + 1, name, status);\n           strcpy(comm, \"offset for unsigned integers\");\n\n           ffpkyg(fptr, name, 2147483648., 0, comm, status);\n\n           ffkeyn(\"TSCAL\", ii + 1, name, status);\n           strcpy(comm, \"data are not scaled\");\n           ffpkyg(fptr, name, 1., 0, comm, status);\n        }\n        else if (abs(datatype) == TULONGLONG) \n        {\t   \n           /* Replace the 'W' with an 'K' in the TFORMn code */\n           cptr = tfmt;\n           while (*cptr != 'W') \n              cptr++;\n\n           *cptr = 'K';\n           ffpkys(fptr, name, tfmt, comm, status);\n\n           /* write the TZEROn and TSCALn keywords */\n           ffkeyn(\"TZERO\", ii + 1, card, status);\n           strcat(card, \"     \");  /* make sure name is >= 8 chars long */\n           *(card+8) = '\\0';\n\t   strcat(card, \"=  9223372036854775808 / offset for unsigned integers\");\n\t   fits_write_record(fptr, card, status);\n\n           ffkeyn(\"TSCAL\", ii + 1, name, status);\n           strcpy(comm, \"data are not scaled\");\n           ffpkyg(fptr, name, 1., 0, comm, status);\n        }\n        else\n        {\n           ffpkys(fptr, name, tfmt, comm, status);\n        }\n\n        if (tunit)\n        {\n         if (tunit[ii] && *(tunit[ii]) ) /* optional TUNITn keyword */\n         {\n          ffkeyn(\"TUNIT\", ii + 1, name, status);\n          ffpkys(fptr, name, tunit[ii],\n             \"physical unit of field\", status);\n         }\n        }\n\n        if (*status > 0)\n            break;       /* abort loop on error */\n    }\n\n    if (extnm[0])       /* optional EXTNAME keyword */\n        ffpkys(fptr, \"EXTNAME\", extnm,\n               \"name of this binary table extension\", status);\n\n    if (*status > 0)\n        ffpmsg(\"Failed to write binary table header keywords (ffphbn)\");\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffphext(fitsfile *fptr,  /* I - FITS file pointer                       */\n           const char *xtensionx,   /* I - value for the XTENSION keyword          */\n           int bitpix,       /* I - value for the BIXPIX keyword            */\n           int naxis,        /* I - value for the NAXIS keyword             */\n           long naxes[],     /* I - value for the NAXISn keywords           */\n           LONGLONG pcount,  /* I - value for the PCOUNT keyword            */\n           LONGLONG gcount,  /* I - value for the GCOUNT keyword            */\n           int *status)      /* IO - error status                           */\n/*\n  Put required Header keywords into a conforming extension:\n*/\n{\n    char message[FLEN_ERRMSG],comm[81], name[20], xtension[FLEN_VALUE];\n    int ii;\n \n    if (fptr->HDUposition != (fptr->Fptr)->curhdu)\n        ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);\n\n    if (*status > 0)\n        return(*status);\n    else if ((fptr->Fptr)->headend != (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] )\n        return(*status = HEADER_NOT_EMPTY);\n\n    if (naxis < 0 || naxis > 999)\n    {\n        snprintf(message,FLEN_ERRMSG,\n        \"Illegal value for NAXIS keyword: %d\", naxis);\n        ffpmsg(message);\n        return(*status = BAD_NAXIS);\n    }\n\n    xtension[0] = '\\0';\n    strncat(xtension, xtensionx, FLEN_VALUE-1);\n\n    ffpkys(fptr, \"XTENSION\", xtension, \"extension type\", status);\n    ffpkyj(fptr, \"BITPIX\",   bitpix,   \"number of bits per data pixel\", status);\n    ffpkyj(fptr, \"NAXIS\",    naxis,    \"number of data axes\", status);\n\n    strcpy(comm, \"length of data axis \");\n    for (ii = 0; ii < naxis; ii++)\n    {\n        if (naxes[ii] < 0)\n        {\n            snprintf(message,FLEN_ERRMSG,\n            \"Illegal negative value for NAXIS%d keyword: %.0f\", ii + 1, (double) (naxes[ii]));\n            ffpmsg(message);\n            return(*status = BAD_NAXES);\n        }\n\n        snprintf(&comm[20], 61, \"%d\", ii + 1);\n        ffkeyn(\"NAXIS\", ii + 1, name, status);\n        ffpkyj(fptr, name, naxes[ii], comm, status);\n    }\n\n\n    ffpkyj(fptr, \"PCOUNT\", pcount, \" \", status);\n    ffpkyj(fptr, \"GCOUNT\", gcount, \" \", status);\n\n    if (*status > 0)\n        ffpmsg(\"Failed to write extension header keywords (ffphext)\");\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffi2c(LONGLONG ival,  /* I - value to be converted to a string */\n          char *cval,     /* O - character string representation of the value */\n          int *status)    /* IO - error status */\n/*\n  convert  value to a null-terminated formatted string.\n*/\n{\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    cval[0] = '\\0';\n\n#if defined(_MSC_VER)\n    /* Microsoft Visual C++ 6.0 uses '%I64d' syntax  for 8-byte integers */\n    if (sprintf(cval, \"%I64d\", ival) < 0)\n\n#elif (USE_LL_SUFFIX == 1)\n    if (sprintf(cval, \"%lld\", ival) < 0)\n#else\n    if (sprintf(cval, \"%ld\", ival) < 0)\n#endif\n    {\n        ffpmsg(\"Error in ffi2c converting integer to string\");\n        *status = BAD_I2C;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffu2c(ULONGLONG ival,  /* I - value to be converted to a string */\n          char *cval,     /* O - character string representation of the value */\n          int *status)    /* IO - error status */\n/*\n  convert  value to a null-terminated formatted string.\n*/\n{\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    cval[0] = '\\0';\n\n#if defined(_MSC_VER)\n    /* Microsoft Visual C++ 6.0 uses '%I64d' syntax  for 8-byte integers */\n    if (sprintf(cval, \"%I64u\", ival) < 0)\n\n#elif (USE_LL_SUFFIX == 1)\n    if (sprintf(cval, \"%llu\", ival) < 0)\n#else\n    if (sprintf(cval, \"%lu\", ival) < 0)\n#endif\n    {\n        ffpmsg(\"Error in ffu2c converting integer to string\");\n        *status = BAD_I2C;\n    }\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffl2c(int lval,    /* I - value to be converted to a string */\n          char *cval,  /* O - character string representation of the value */\n          int *status) /* IO - error status ) */\n/*\n  convert logical value to a null-terminated formatted string.  If the\n  input value == 0, then the output character is the letter F, else\n  the output character is the letter T.  The output string is null terminated.\n*/\n{\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (lval)\n        strcpy(cval,\"T\");\n    else\n        strcpy(cval,\"F\");\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffs2c(const char *instr, /* I - null terminated input string  */\n          char *outstr,      /* O - null terminated quoted output string */\n          int *status)       /* IO - error status */\n/*\n  convert an input string to a quoted string. Leading spaces \n  are significant.  FITS string keyword values must be at least \n  8 chars long so pad out string with spaces if necessary.\n      Example:   km/s ==> 'km/s    '\n  Single quote characters in the input string will be replace by\n  two single quote characters. e.g., o'brian ==> 'o''brian'\n*/\n{\n    size_t len, ii, jj;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    if (!instr)            /* a null input pointer?? */\n    {\n       strcpy(outstr, \"''\");   /* a null FITS string */\n       return(*status);\n    }\n\n    outstr[0] = '\\'';      /* start output string with a quote */\n\n    len = strlen(instr);\n    if (len > 68)\n        len = 68;    /* limit input string to 68 chars */\n\n    for (ii=0, jj=1; ii < len && jj < 69; ii++, jj++)\n    {\n        outstr[jj] = instr[ii];  /* copy each char from input to output */\n        if (instr[ii] == '\\'')\n        {\n            jj++;\n            outstr[jj]='\\'';   /* duplicate any apostrophies in the input */\n        }\n    }\n\n    for (; jj < 9; jj++)       /* pad string so it is at least 8 chars long */\n        outstr[jj] = ' ';\n\n    if (jj == 70)   /* only occurs if the last char of string was a quote */\n        outstr[69] = '\\0';\n    else\n    {\n        outstr[jj] = '\\'';         /* append closing quote character */\n        outstr[jj+1] = '\\0';          /* terminate the string */\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffr2f(float fval,   /* I - value to be converted to a string */\n          int  decim,   /* I - number of decimal places to display */\n          char *cval,   /* O - character string representation of the value */\n          int  *status) /* IO - error status */\n/*\n  convert float value to a null-terminated F format string\n*/\n{\n    char *cptr;\n        \n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    cval[0] = '\\0';\n\n    if (decim < 0)\n    {\n        ffpmsg(\"Error in ffr2f:  no. of decimal places < 0\");\n        return(*status = BAD_DECIM);\n    }\n\n    if (snprintf(cval, FLEN_VALUE,\"%.*f\", decim, fval) < 0)\n    {\n        ffpmsg(\"Error in ffr2f converting float to string\");\n        *status = BAD_F2C;\n    }\n\n    /* replace comma with a period (e.g. in French locale) */\n    if ( (cptr = strchr(cval, ','))) *cptr = '.';\n\n    /* test if output string is 'NaN', 'INDEF', or 'INF' */\n    if (strchr(cval, 'N'))\n    {\n        ffpmsg(\"Error in ffr2f: float value is a NaN or INDEF\");\n        *status = BAD_F2C;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffr2e(float fval,  /* I - value to be converted to a string */\n         int decim,    /* I - number of decimal places to display */\n         char *cval,   /* O - character string representation of the value */\n         int *status)  /* IO - error status */\n/*\n  convert float value to a null-terminated exponential format string\n*/\n{\n    char *cptr;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    cval[0] = '\\0';\n\n    if (decim < 0)\n    {   /* use G format if decim is negative */\n        if ( snprintf(cval, FLEN_VALUE,\"%.*G\", -decim, fval) < 0)\n        {\n            ffpmsg(\"Error in ffr2e converting float to string\");\n            *status = BAD_F2C;\n        }\n        else\n        {\n            /* test if E format was used, and there is no displayed decimal */\n            if ( !strchr(cval, '.') && strchr(cval,'E') )\n            {\n                /* reformat value with a decimal point and single zero */\n                if ( snprintf(cval, FLEN_VALUE,\"%.1E\", fval) < 0)\n                {\n                    ffpmsg(\"Error in ffr2e converting float to string\");\n                    *status = BAD_F2C;\n                }\n\n                return(*status);  \n            }\n        }\n    }\n    else\n    {\n        if ( snprintf(cval, FLEN_VALUE,\"%.*E\", decim, fval) < 0)\n        {\n            ffpmsg(\"Error in ffr2e converting float to string\");\n            *status = BAD_F2C;\n        }\n    }\n\n    if (*status <= 0)\n    {\n        /* replace comma with a period (e.g. in French locale) */\n        if ( (cptr = strchr(cval, ','))) *cptr = '.';\n\n        /* test if output string is 'NaN', 'INDEF', or 'INF' */\n        if (strchr(cval, 'N'))\n        {\n            ffpmsg(\"Error in ffr2e: float value is a NaN or INDEF\");\n            *status = BAD_F2C;\n        }\n        else if ( !strchr(cval, '.') && !strchr(cval,'E') && strlen(cval) < FLEN_VALUE-1 )\n        {\n            /* add decimal point if necessary to distinquish from integer */\n            strcat(cval, \".\");\n        }\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffd2f(double dval,  /* I - value to be converted to a string */\n          int decim,    /* I - number of decimal places to display */\n          char *cval,   /* O - character string representation of the value */\n          int *status)  /* IO - error status */\n/*\n  convert double value to a null-terminated F format string\n*/\n{\n    char *cptr;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    cval[0] = '\\0';\n\n    if (decim < 0)\n    {\n        ffpmsg(\"Error in ffd2f:  no. of decimal places < 0\");\n        return(*status = BAD_DECIM);\n    }\n\n    if (snprintf(cval, FLEN_VALUE,\"%.*f\", decim, dval) < 0)\n    {\n        ffpmsg(\"Error in ffd2f converting double to string\");\n        *status = BAD_F2C;\n    }\n\n    /* replace comma with a period (e.g. in French locale) */\n    if ( (cptr = strchr(cval, ','))) *cptr = '.';\n\n    /* test if output string is 'NaN', 'INDEF', or 'INF' */\n    if (strchr(cval, 'N'))\n    {\n        ffpmsg(\"Error in ffd2f: double value is a NaN or INDEF\");\n        *status = BAD_F2C;\n    }\n\n    return(*status);\n}\n/*--------------------------------------------------------------------------*/\nint ffd2e(double dval,  /* I - value to be converted to a string */\n          int decim,    /* I - number of decimal places to display */\n          char *cval,   /* O - character string representation of the value */\n          int *status)  /* IO - error status */\n/*\n  convert double value to a null-terminated exponential format string.\n*/\n{\n    char *cptr;\n\n    if (*status > 0)           /* inherit input status value if > 0 */\n        return(*status);\n\n    cval[0] = '\\0';\n\n    if (decim < 0)\n    {   /* use G format if decim is negative */\n        if ( snprintf(cval, FLEN_VALUE,\"%.*G\", -decim, dval) < 0)\n        {\n            ffpmsg(\"Error in ffd2e converting float to string\");\n            *status = BAD_F2C;\n        }\n        else\n        {\n            /* test if E format was used, and there is no displayed decimal */\n            if ( !strchr(cval, '.') && strchr(cval,'E') )\n            {\n                /* reformat value with a decimal point and single zero */\n                if ( snprintf(cval, FLEN_VALUE,\"%.1E\", dval) < 0)\n                {\n                    ffpmsg(\"Error in ffd2e converting float to string\");\n                    *status = BAD_F2C;\n                }\n\n                return(*status);  \n            }\n        }\n    }\n    else\n    {\n        if ( snprintf(cval, FLEN_VALUE,\"%.*E\", decim, dval) < 0)\n        {\n            ffpmsg(\"Error in ffd2e converting float to string\");\n            *status = BAD_F2C;\n        }\n    }\n\n    if (*status <= 0)\n    {\n        /* replace comma with a period (e.g. in French locale) */\n        if ( (cptr = strchr(cval, ','))) *cptr = '.';\n\n        /* test if output string is 'NaN', 'INDEF', or 'INF' */\n        if (strchr(cval, 'N'))\n        {\n            ffpmsg(\"Error in ffd2e: double value is a NaN or INDEF\");\n            *status = BAD_F2C;\n        }\n        else if ( !strchr(cval, '.') && !strchr(cval,'E') && strlen(cval) < FLEN_VALUE-1)\n        {\n            /* add decimal point if necessary to distinquish from integer */\n            strcat(cval, \".\");\n        }\n    }\n\n    return(*status);\n}\n\n"},{"id":16729,"name":"inffast.h","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* inffast.h -- header to use inffast.c\n * Copyright (C) 1995-2003, 2010 Mark Adler\n * For conditions of distribution and use, see copyright notice in zlib.h\n */\n\n/* WARNING: this file should *not* be used by applications. It is\n   part of the implementation of the compression library and is\n   subject to change. Applications should only use zlib.h.\n */\n\nvoid ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));\n"},{"id":16730,"name":"zconf.h","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* zconf.h -- configuration of the zlib compression library\n * Copyright (C) 1995-2010 Jean-loup Gailly.\n * For conditions of distribution and use, see copyright notice in zlib.h\n */\n\n#ifndef ZCONF_H\n#define ZCONF_H\n\n/*\n * If you *really* need a unique prefix for all types and library functions,\n * compile with -DZ_PREFIX. The \"standard\" zlib should be compiled without it.\n * Even better than compiling with -DZ_PREFIX would be to use configure to set\n * this permanently in zconf.h using \"./configure --zprefix\".\n */\n#ifdef Z_PREFIX     /* may be set to #if 1 by ./configure */\n\n/* all linked symbols */\n#  define _dist_code            z__dist_code\n#  define _length_code          z__length_code\n#  define _tr_align             z__tr_align\n#  define _tr_flush_block       z__tr_flush_block\n#  define _tr_init              z__tr_init\n#  define _tr_stored_block      z__tr_stored_block\n#  define _tr_tally             z__tr_tally\n#  define adler32               z_adler32\n#  define adler32_combine       z_adler32_combine\n#  define adler32_combine64     z_adler32_combine64\n#  define compress              z_compress\n#  define compress2             z_compress2\n#  define compressBound         z_compressBound\n#  define crc32                 z_crc32\n#  define crc32_combine         z_crc32_combine\n#  define crc32_combine64       z_crc32_combine64\n#  define deflate               z_deflate\n#  define deflateBound          z_deflateBound\n#  define deflateCopy           z_deflateCopy\n#  define deflateEnd            z_deflateEnd\n#  define deflateInit2_         z_deflateInit2_\n#  define deflateInit_          z_deflateInit_\n#  define deflateParams         z_deflateParams\n#  define deflatePrime          z_deflatePrime\n#  define deflateReset          z_deflateReset\n#  define deflateSetDictionary  z_deflateSetDictionary\n#  define deflateSetHeader      z_deflateSetHeader\n#  define deflateTune           z_deflateTune\n#  define deflate_copyright     z_deflate_copyright\n#  define get_crc_table         z_get_crc_table\n#  define gz_error              z_gz_error\n#  define gz_intmax             z_gz_intmax\n#  define gz_strwinerror        z_gz_strwinerror\n#  define gzbuffer              z_gzbuffer\n#  define gzclearerr            z_gzclearerr\n#  define gzclose               z_gzclose\n#  define gzclose_r             z_gzclose_r\n#  define gzclose_w             z_gzclose_w\n#  define gzdirect              z_gzdirect\n#  define gzdopen               z_gzdopen\n#  define gzeof                 z_gzeof\n#  define gzerror               z_gzerror\n#  define gzflush               z_gzflush\n#  define gzgetc                z_gzgetc\n#  define gzgets                z_gzgets\n#  define gzoffset              z_gzoffset\n#  define gzoffset64            z_gzoffset64\n#  define gzopen                z_gzopen\n#  define gzopen64              z_gzopen64\n#  define gzprintf              z_gzprintf\n#  define gzputc                z_gzputc\n#  define gzputs                z_gzputs\n#  define gzread                z_gzread\n#  define gzrewind              z_gzrewind\n#  define gzseek                z_gzseek\n#  define gzseek64              z_gzseek64\n#  define gzsetparams           z_gzsetparams\n#  define gztell                z_gztell\n#  define gztell64              z_gztell64\n#  define gzungetc              z_gzungetc\n#  define gzwrite               z_gzwrite\n#  define inflate               z_inflate\n#  define inflateBack           z_inflateBack\n#  define inflateBackEnd        z_inflateBackEnd\n#  define inflateBackInit_      z_inflateBackInit_\n#  define inflateCopy           z_inflateCopy\n#  define inflateEnd            z_inflateEnd\n#  define inflateGetHeader      z_inflateGetHeader\n#  define inflateInit2_         z_inflateInit2_\n#  define inflateInit_          z_inflateInit_\n#  define inflateMark           z_inflateMark\n#  define inflatePrime          z_inflatePrime\n#  define inflateReset          z_inflateReset\n#  define inflateReset2         z_inflateReset2\n#  define inflateSetDictionary  z_inflateSetDictionary\n#  define inflateSync           z_inflateSync\n#  define inflateSyncPoint      z_inflateSyncPoint\n#  define inflateUndermine      z_inflateUndermine\n#  define inflate_copyright     z_inflate_copyright\n#  define inflate_fast          z_inflate_fast\n#  define inflate_table         z_inflate_table\n#  define uncompress            z_uncompress\n#  define zError                z_zError\n#  define zcalloc               z_zcalloc\n#  define zcfree                z_zcfree\n#  define zlibCompileFlags      z_zlibCompileFlags\n#  define zlibVersion           z_zlibVersion\n\n/* all zlib typedefs in zlib.h and zconf.h */\n#  define Byte                  z_Byte\n#  define Bytef                 z_Bytef\n#  define alloc_func            z_alloc_func\n#  define charf                 z_charf\n#  define free_func             z_free_func\n#  define gzFile                z_gzFile\n#  define gz_header             z_gz_header\n#  define gz_headerp            z_gz_headerp\n#  define in_func               z_in_func\n#  define intf                  z_intf\n#  define out_func              z_out_func\n#  define uInt                  z_uInt\n#  define uIntf                 z_uIntf\n#  define uLong                 z_uLong\n#  define uLongf                z_uLongf\n#  define voidp                 z_voidp\n#  define voidpc                z_voidpc\n#  define voidpf                z_voidpf\n\n/* all zlib structs in zlib.h and zconf.h */\n#  define gz_header_s           z_gz_header_s\n#  define internal_state        z_internal_state\n\n#endif\n\n#if defined(__MSDOS__) && !defined(MSDOS)\n#  define MSDOS\n#endif\n#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)\n#  define OS2\n#endif\n#if defined(_WINDOWS) && !defined(WINDOWS)\n#  define WINDOWS\n#endif\n#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)\n#  ifndef WIN32\n#    define WIN32\n#  endif\n#endif\n#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)\n#  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)\n#    ifndef SYS16BIT\n#      define SYS16BIT\n#    endif\n#  endif\n#endif\n\n/*\n * Compile with -DMAXSEG_64K if the alloc function cannot allocate more\n * than 64k bytes at a time (needed on systems with 16-bit int).\n */\n#ifdef SYS16BIT\n#  define MAXSEG_64K\n#endif\n#ifdef MSDOS\n#  define UNALIGNED_OK\n#endif\n\n#ifdef __STDC_VERSION__\n#  ifndef STDC\n#    define STDC\n#  endif\n#  if __STDC_VERSION__ >= 199901L\n#    ifndef STDC99\n#      define STDC99\n#    endif\n#  endif\n#endif\n#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))\n#  define STDC\n#endif\n#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))\n#  define STDC\n#endif\n#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))\n#  define STDC\n#endif\n#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))\n#  define STDC\n#endif\n\n#if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */\n#  define STDC\n#endif\n\n#ifndef STDC\n#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */\n#    define const       /* note: need a more gentle solution here */\n#  endif\n#endif\n\n/* Some Mac compilers merge all .h files incorrectly: */\n#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)\n#  define NO_DUMMY_DECL\n#endif\n\n/* Maximum value for memLevel in deflateInit2 */\n#ifndef MAX_MEM_LEVEL\n#  ifdef MAXSEG_64K\n#    define MAX_MEM_LEVEL 8\n#  else\n#    define MAX_MEM_LEVEL 9\n#  endif\n#endif\n\n/* Maximum value for windowBits in deflateInit2 and inflateInit2.\n * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files\n * created by gzip. (Files created by minigzip can still be extracted by\n * gzip.)\n */\n#ifndef MAX_WBITS\n#  define MAX_WBITS   15 /* 32K LZ77 window */\n#endif\n\n/* The memory requirements for deflate are (in bytes):\n            (1 << (windowBits+2)) +  (1 << (memLevel+9))\n that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)\n plus a few kilobytes for small objects. For example, if you want to reduce\n the default memory requirements from 256K to 128K, compile with\n     make CFLAGS=\"-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7\"\n Of course this will generally degrade compression (there's no free lunch).\n\n   The memory requirements for inflate are (in bytes) 1 << windowBits\n that is, 32K for windowBits=15 (default value) plus a few kilobytes\n for small objects.\n*/\n\n                        /* Type declarations */\n\n#ifndef OF /* function prototypes */\n#  ifdef STDC\n#    define OF(args)  args\n#  else\n#    define OF(args)  ()\n#  endif\n#endif\n\n/* The following definitions for FAR are needed only for MSDOS mixed\n * model programming (small or medium model with some far allocations).\n * This was tested only with MSC; for other MSDOS compilers you may have\n * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,\n * just define FAR to be empty.\n */\n#ifdef SYS16BIT\n#  if defined(M_I86SM) || defined(M_I86MM)\n     /* MSC small or medium model */\n#    define SMALL_MEDIUM\n#    ifdef _MSC_VER\n#      define FAR _far\n#    else\n#      define FAR far\n#    endif\n#  endif\n#  if (defined(__SMALL__) || defined(__MEDIUM__))\n     /* Turbo C small or medium model */\n#    define SMALL_MEDIUM\n#    ifdef __BORLANDC__\n#      define FAR _far\n#    else\n#      define FAR far\n#    endif\n#  endif\n#endif\n\n#if defined(WINDOWS) || defined(WIN32)\n   /* If building or using zlib as a DLL, define ZLIB_DLL.\n    * This is not mandatory, but it offers a little performance increase.\n    */\n#  ifdef ZLIB_DLL\n#    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))\n#      ifdef ZLIB_INTERNAL\n#        define ZEXTERN extern __declspec(dllexport)\n#      else\n#        define ZEXTERN extern __declspec(dllimport)\n#      endif\n#    endif\n#  endif  /* ZLIB_DLL */\n   /* If building or using zlib with the WINAPI/WINAPIV calling convention,\n    * define ZLIB_WINAPI.\n    * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.\n    */\n#  ifdef ZLIB_WINAPI\n#    ifdef FAR\n#      undef FAR\n#    endif\n#    include <windows.h>\n     /* No need for _export, use ZLIB.DEF instead. */\n     /* For complete Windows compatibility, use WINAPI, not __stdcall. */\n#    define ZEXPORT WINAPI\n#    ifdef WIN32\n#      define ZEXPORTVA WINAPIV\n#    else\n#      define ZEXPORTVA FAR CDECL\n#    endif\n#  endif\n#endif\n\n#if defined (__BEOS__)\n#  ifdef ZLIB_DLL\n#    ifdef ZLIB_INTERNAL\n#      define ZEXPORT   __declspec(dllexport)\n#      define ZEXPORTVA __declspec(dllexport)\n#    else\n#      define ZEXPORT   __declspec(dllimport)\n#      define ZEXPORTVA __declspec(dllimport)\n#    endif\n#  endif\n#endif\n\n#ifndef ZEXTERN\n#  define ZEXTERN extern\n#endif\n#ifndef ZEXPORT\n#  define ZEXPORT\n#endif\n#ifndef ZEXPORTVA\n#  define ZEXPORTVA\n#endif\n\n#ifndef FAR\n#  define FAR\n#endif\n\n#if !defined(__MACTYPES__)\ntypedef unsigned char  Byte;  /* 8 bits */\n#endif\ntypedef unsigned int   uInt;  /* 16 bits or more */\ntypedef unsigned long  uLong; /* 32 bits or more */\n\n#ifdef SMALL_MEDIUM\n   /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */\n#  define Bytef Byte FAR\n#else\n   typedef Byte  FAR Bytef;\n#endif\ntypedef char  FAR charf;\ntypedef int   FAR intf;\ntypedef uInt  FAR uIntf;\ntypedef uLong FAR uLongf;\n\n#ifdef STDC\n   typedef void const *voidpc;\n   typedef void FAR   *voidpf;\n   typedef void       *voidp;\n#else\n   typedef Byte const *voidpc;\n   typedef Byte FAR   *voidpf;\n   typedef Byte       *voidp;\n#endif\n\n#if !defined(MSDOS) && !defined(WINDOWS) && !defined(WIN32)\n#  define Z_HAVE_UNISTD_H\n#endif\n\n#ifdef STDC\n#  include <sys/types.h>    /* for off_t */\n#endif\n\n/* a little trick to accommodate both \"#define _LARGEFILE64_SOURCE\" and\n * \"#define _LARGEFILE64_SOURCE 1\" as requesting 64-bit operations, (even\n * though the former does not conform to the LFS document), but considering\n * both \"#undef _LARGEFILE64_SOURCE\" and \"#define _LARGEFILE64_SOURCE 0\" as\n * equivalently requesting no 64-bit operations\n */\n#if -_LARGEFILE64_SOURCE - -1 == 1\n#  undef _LARGEFILE64_SOURCE\n#endif\n\n#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)\n#  include <unistd.h>       /* for SEEK_* and off_t */\n#  ifdef VMS\n#    include <unixio.h>     /* for off_t */\n#  endif\n#  ifndef z_off_t\n#    define z_off_t off_t\n#  endif\n#endif\n\n#ifndef SEEK_SET\n#  define SEEK_SET        0       /* Seek from beginning of file.  */\n#  define SEEK_CUR        1       /* Seek from current position.  */\n#  define SEEK_END        2       /* Set file pointer to EOF plus \"offset\" */\n#endif\n\n#ifndef z_off_t\n#  define z_off_t long\n#endif\n\n#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0\n#  define z_off64_t off64_t\n#else\n#  define z_off64_t z_off_t\n#endif\n\n#if defined(__OS400__)\n#  define NO_vsnprintf\n#endif\n\n#if defined(__MVS__)\n#  define NO_vsnprintf\n#endif\n\n/* MVS linker does not support external names larger than 8 bytes */\n#if defined(__MVS__)\n  #pragma map(deflateInit_,\"DEIN\")\n  #pragma map(deflateInit2_,\"DEIN2\")\n  #pragma map(deflateEnd,\"DEEND\")\n  #pragma map(deflateBound,\"DEBND\")\n  #pragma map(inflateInit_,\"ININ\")\n  #pragma map(inflateInit2_,\"ININ2\")\n  #pragma map(inflateEnd,\"INEND\")\n  #pragma map(inflateSync,\"INSY\")\n  #pragma map(inflateSetDictionary,\"INSEDI\")\n  #pragma map(compressBound,\"CMBND\")\n  #pragma map(inflate_table,\"INTABL\")\n  #pragma map(inflate_fast,\"INFA\")\n  #pragma map(inflate_copyright,\"INCOPY\")\n#endif\n\n#endif /* ZCONF_H */\n"},{"id":16731,"name":"trees.h","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* header created automatically with -DGEN_TREES_H */\n\nlocal const ct_data static_ltree[L_CODES+2] = {\n{{ 12},{  8}}, {{140},{  8}}, {{ 76},{  8}}, {{204},{  8}}, {{ 44},{  8}},\n{{172},{  8}}, {{108},{  8}}, {{236},{  8}}, {{ 28},{  8}}, {{156},{  8}},\n{{ 92},{  8}}, {{220},{  8}}, {{ 60},{  8}}, {{188},{  8}}, {{124},{  8}},\n{{252},{  8}}, {{  2},{  8}}, {{130},{  8}}, {{ 66},{  8}}, {{194},{  8}},\n{{ 34},{  8}}, {{162},{  8}}, {{ 98},{  8}}, {{226},{  8}}, {{ 18},{  8}},\n{{146},{  8}}, {{ 82},{  8}}, {{210},{  8}}, {{ 50},{  8}}, {{178},{  8}},\n{{114},{  8}}, {{242},{  8}}, {{ 10},{  8}}, {{138},{  8}}, {{ 74},{  8}},\n{{202},{  8}}, {{ 42},{  8}}, {{170},{  8}}, {{106},{  8}}, {{234},{  8}},\n{{ 26},{  8}}, {{154},{  8}}, {{ 90},{  8}}, {{218},{  8}}, {{ 58},{  8}},\n{{186},{  8}}, {{122},{  8}}, {{250},{  8}}, {{  6},{  8}}, {{134},{  8}},\n{{ 70},{  8}}, {{198},{  8}}, {{ 38},{  8}}, {{166},{  8}}, {{102},{  8}},\n{{230},{  8}}, {{ 22},{  8}}, {{150},{  8}}, {{ 86},{  8}}, {{214},{  8}},\n{{ 54},{  8}}, {{182},{  8}}, {{118},{  8}}, {{246},{  8}}, {{ 14},{  8}},\n{{142},{  8}}, {{ 78},{  8}}, {{206},{  8}}, {{ 46},{  8}}, {{174},{  8}},\n{{110},{  8}}, {{238},{  8}}, {{ 30},{  8}}, {{158},{  8}}, {{ 94},{  8}},\n{{222},{  8}}, {{ 62},{  8}}, {{190},{  8}}, {{126},{  8}}, {{254},{  8}},\n{{  1},{  8}}, {{129},{  8}}, {{ 65},{  8}}, {{193},{  8}}, {{ 33},{  8}},\n{{161},{  8}}, {{ 97},{  8}}, {{225},{  8}}, {{ 17},{  8}}, {{145},{  8}},\n{{ 81},{  8}}, {{209},{  8}}, {{ 49},{  8}}, {{177},{  8}}, {{113},{  8}},\n{{241},{  8}}, {{  9},{  8}}, {{137},{  8}}, {{ 73},{  8}}, {{201},{  8}},\n{{ 41},{  8}}, {{169},{  8}}, {{105},{  8}}, {{233},{  8}}, {{ 25},{  8}},\n{{153},{  8}}, {{ 89},{  8}}, {{217},{  8}}, {{ 57},{  8}}, {{185},{  8}},\n{{121},{  8}}, {{249},{  8}}, {{  5},{  8}}, {{133},{  8}}, {{ 69},{  8}},\n{{197},{  8}}, {{ 37},{  8}}, {{165},{  8}}, {{101},{  8}}, {{229},{  8}},\n{{ 21},{  8}}, {{149},{  8}}, {{ 85},{  8}}, {{213},{  8}}, {{ 53},{  8}},\n{{181},{  8}}, {{117},{  8}}, {{245},{  8}}, {{ 13},{  8}}, {{141},{  8}},\n{{ 77},{  8}}, {{205},{  8}}, {{ 45},{  8}}, {{173},{  8}}, {{109},{  8}},\n{{237},{  8}}, {{ 29},{  8}}, {{157},{  8}}, {{ 93},{  8}}, {{221},{  8}},\n{{ 61},{  8}}, {{189},{  8}}, {{125},{  8}}, {{253},{  8}}, {{ 19},{  9}},\n{{275},{  9}}, {{147},{  9}}, {{403},{  9}}, {{ 83},{  9}}, {{339},{  9}},\n{{211},{  9}}, {{467},{  9}}, {{ 51},{  9}}, {{307},{  9}}, {{179},{  9}},\n{{435},{  9}}, {{115},{  9}}, {{371},{  9}}, {{243},{  9}}, {{499},{  9}},\n{{ 11},{  9}}, {{267},{  9}}, {{139},{  9}}, {{395},{  9}}, {{ 75},{  9}},\n{{331},{  9}}, {{203},{  9}}, {{459},{  9}}, {{ 43},{  9}}, {{299},{  9}},\n{{171},{  9}}, {{427},{  9}}, {{107},{  9}}, {{363},{  9}}, {{235},{  9}},\n{{491},{  9}}, {{ 27},{  9}}, {{283},{  9}}, {{155},{  9}}, {{411},{  9}},\n{{ 91},{  9}}, {{347},{  9}}, {{219},{  9}}, {{475},{  9}}, {{ 59},{  9}},\n{{315},{  9}}, {{187},{  9}}, {{443},{  9}}, {{123},{  9}}, {{379},{  9}},\n{{251},{  9}}, {{507},{  9}}, {{  7},{  9}}, {{263},{  9}}, {{135},{  9}},\n{{391},{  9}}, {{ 71},{  9}}, {{327},{  9}}, {{199},{  9}}, {{455},{  9}},\n{{ 39},{  9}}, {{295},{  9}}, {{167},{  9}}, {{423},{  9}}, {{103},{  9}},\n{{359},{  9}}, {{231},{  9}}, {{487},{  9}}, {{ 23},{  9}}, {{279},{  9}},\n{{151},{  9}}, {{407},{  9}}, {{ 87},{  9}}, {{343},{  9}}, {{215},{  9}},\n{{471},{  9}}, {{ 55},{  9}}, {{311},{  9}}, {{183},{  9}}, {{439},{  9}},\n{{119},{  9}}, {{375},{  9}}, {{247},{  9}}, {{503},{  9}}, {{ 15},{  9}},\n{{271},{  9}}, {{143},{  9}}, {{399},{  9}}, {{ 79},{  9}}, {{335},{  9}},\n{{207},{  9}}, {{463},{  9}}, {{ 47},{  9}}, {{303},{  9}}, {{175},{  9}},\n{{431},{  9}}, {{111},{  9}}, {{367},{  9}}, {{239},{  9}}, {{495},{  9}},\n{{ 31},{  9}}, {{287},{  9}}, {{159},{  9}}, {{415},{  9}}, {{ 95},{  9}},\n{{351},{  9}}, {{223},{  9}}, {{479},{  9}}, {{ 63},{  9}}, {{319},{  9}},\n{{191},{  9}}, {{447},{  9}}, {{127},{  9}}, {{383},{  9}}, {{255},{  9}},\n{{511},{  9}}, {{  0},{  7}}, {{ 64},{  7}}, {{ 32},{  7}}, {{ 96},{  7}},\n{{ 16},{  7}}, {{ 80},{  7}}, {{ 48},{  7}}, {{112},{  7}}, {{  8},{  7}},\n{{ 72},{  7}}, {{ 40},{  7}}, {{104},{  7}}, {{ 24},{  7}}, {{ 88},{  7}},\n{{ 56},{  7}}, {{120},{  7}}, {{  4},{  7}}, {{ 68},{  7}}, {{ 36},{  7}},\n{{100},{  7}}, {{ 20},{  7}}, {{ 84},{  7}}, {{ 52},{  7}}, {{116},{  7}},\n{{  3},{  8}}, {{131},{  8}}, {{ 67},{  8}}, {{195},{  8}}, {{ 35},{  8}},\n{{163},{  8}}, {{ 99},{  8}}, {{227},{  8}}\n};\n\nlocal const ct_data static_dtree[D_CODES] = {\n{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},\n{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},\n{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},\n{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},\n{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},\n{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}\n};\n\nconst uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n 0,  1,  2,  3,  4,  4,  5,  5,  6,  6,  6,  6,  7,  7,  7,  7,  8,  8,  8,  8,\n 8,  8,  8,  8,  9,  9,  9,  9,  9,  9,  9,  9, 10, 10, 10, 10, 10, 10, 10, 10,\n10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,\n11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,\n12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,\n13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,\n13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\n14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\n14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\n14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,\n15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,\n15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,\n15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,  0,  0, 16, 17,\n18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,\n23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\n24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,\n26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,\n26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,\n27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,\n27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,\n28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,\n28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,\n28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,\n29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,\n29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,\n29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29\n};\n\nconst uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n 0,  1,  2,  3,  4,  5,  6,  7,  8,  8,  9,  9, 10, 10, 11, 11, 12, 12, 12, 12,\n13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,\n17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,\n19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,\n22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,\n23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\n24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\n25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,\n25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,\n26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,\n26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,\n27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28\n};\n\nlocal const int base_length[LENGTH_CODES] = {\n0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,\n64, 80, 96, 112, 128, 160, 192, 224, 0\n};\n\nlocal const int base_dist[D_CODES] = {\n    0,     1,     2,     3,     4,     6,     8,    12,    16,    24,\n   32,    48,    64,    96,   128,   192,   256,   384,   512,   768,\n 1024,  1536,  2048,  3072,  4096,  6144,  8192, 12288, 16384, 24576\n};\n\n"},{"id":16732,"name":"inftrees.h","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* inftrees.h -- header to use inftrees.c\n * Copyright (C) 1995-2005, 2010 Mark Adler\n * For conditions of distribution and use, see copyright notice in zlib.h\n */\n\n/* WARNING: this file should *not* be used by applications. It is\n   part of the implementation of the compression library and is\n   subject to change. Applications should only use zlib.h.\n */\n\n/* Structure for decoding tables.  Each entry provides either the\n   information needed to do the operation requested by the code that\n   indexed that table entry, or it provides a pointer to another\n   table that indexes more bits of the code.  op indicates whether\n   the entry is a pointer to another table, a literal, a length or\n   distance, an end-of-block, or an invalid code.  For a table\n   pointer, the low four bits of op is the number of index bits of\n   that table.  For a length or distance, the low four bits of op\n   is the number of extra bits to get after the code.  bits is\n   the number of bits in this code or part of the code to drop off\n   of the bit buffer.  val is the actual byte to output in the case\n   of a literal, the base length or distance, or the offset from\n   the current table to the next table.  Each entry is four bytes. */\ntypedef struct {\n    unsigned char op;           /* operation, extra bits, table bits */\n    unsigned char bits;         /* bits in this part of the code */\n    unsigned short val;         /* offset in table or code value */\n} code;\n\n/* op values as set by inflate_table():\n    00000000 - literal\n    0000tttt - table link, tttt != 0 is the number of table index bits\n    0001eeee - length or distance, eeee is the number of extra bits\n    01100000 - end of block\n    01000000 - invalid code\n */\n\n/* Maximum size of the dynamic table.  The maximum number of code structures is\n   1444, which is the sum of 852 for literal/length codes and 592 for distance\n   codes.  These values were found by exhaustive searches using the program\n   examples/enough.c found in the zlib distribtution.  The arguments to that\n   program are the number of symbols, the initial root table size, and the\n   maximum bit length of a code.  \"enough 286 9 15\" for literal/length codes\n   returns returns 852, and \"enough 30 6 15\" for distance codes returns 592.\n   The initial root table size (9 or 6) is found in the fifth argument of the\n   inflate_table() calls in inflate.c and infback.c.  If the root table size is\n   changed, then these maximum sizes would be need to be recalculated and\n   updated. */\n#define ENOUGH_LENS 852\n#define ENOUGH_DISTS 592\n#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)\n\n/* Type of code to build for inflate_table() */\ntypedef enum {\n    CODES,\n    LENS,\n    DISTS\n} codetype;\n\nint ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,\n                             unsigned codes, code FAR * FAR *table,\n                             unsigned FAR *bits, unsigned short FAR *work));\n"},{"id":16733,"name":"inffixed.h","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"    /* inffixed.h -- table for decoding fixed codes\n     * Generated automatically by makefixed().\n     */\n\n    /* WARNING: this file should *not* be used by applications. It\n       is part of the implementation of the compression library and\n       is subject to change. Applications should only use zlib.h.\n     */\n\n    static const code lenfix[512] = {\n        {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},\n        {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},\n        {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},\n        {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},\n        {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},\n        {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},\n        {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},\n        {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},\n        {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},\n        {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},\n        {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},\n        {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},\n        {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},\n        {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},\n        {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},\n        {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},\n        {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},\n        {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},\n        {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},\n        {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},\n        {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},\n        {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},\n        {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},\n        {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},\n        {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},\n        {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},\n        {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},\n        {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},\n        {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},\n        {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},\n        {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},\n        {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},\n        {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},\n        {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},\n        {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},\n        {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},\n        {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},\n        {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},\n        {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},\n        {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},\n        {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},\n        {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},\n        {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},\n        {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},\n        {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},\n        {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},\n        {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},\n        {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},\n        {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},\n        {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},\n        {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},\n        {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},\n        {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},\n        {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},\n        {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},\n        {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},\n        {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},\n        {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},\n        {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},\n        {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},\n        {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},\n        {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},\n        {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},\n        {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},\n        {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},\n        {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},\n        {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},\n        {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},\n        {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},\n        {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},\n        {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},\n        {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},\n        {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},\n        {0,9,255}\n    };\n\n    static const code distfix[32] = {\n        {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},\n        {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},\n        {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},\n        {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},\n        {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},\n        {22,5,193},{64,5,0}\n    };\n"},{"id":16734,"name":"uncompr.c","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* uncompr.c -- decompress a memory buffer\n * Copyright (C) 1995-2003, 2010 Jean-loup Gailly.\n * For conditions of distribution and use, see copyright notice in zlib.h\n */\n\n#define ZLIB_INTERNAL\n#include \"zlib.h\"\n\n/* ===========================================================================\n     Decompresses the source buffer into the destination buffer.  sourceLen is\n   the byte length of the source buffer. Upon entry, destLen is the total\n   size of the destination buffer, which must be large enough to hold the\n   entire uncompressed data. (The size of the uncompressed data must have\n   been saved previously by the compressor and transmitted to the decompressor\n   by some mechanism outside the scope of this compression library.)\n   Upon exit, destLen is the actual size of the compressed buffer.\n\n     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not\n   enough memory, Z_BUF_ERROR if there was not enough room in the output\n   buffer, or Z_DATA_ERROR if the input data was corrupted.\n*/\nint ZEXPORT uncompress (dest, destLen, source, sourceLen)\n    Bytef *dest;\n    uLongf *destLen;\n    const Bytef *source;\n    uLong sourceLen;\n{\n    z_stream stream;\n    int err;\n\n    stream.next_in = (Bytef*)source;\n    stream.avail_in = (uInt)sourceLen;\n    /* Check for source > 64K on 16-bit machine: */\n    if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;\n\n    stream.next_out = dest;\n    stream.avail_out = (uInt)*destLen;\n    if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;\n\n    stream.zalloc = (alloc_func)0;\n    stream.zfree = (free_func)0;\n\n    err = inflateInit(&stream);\n    if (err != Z_OK) return err;\n\n    err = inflate(&stream, Z_FINISH);\n    if (err != Z_STREAM_END) {\n        inflateEnd(&stream);\n        if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))\n            return Z_DATA_ERROR;\n        return err;\n    }\n    *destLen = stream.total_out;\n\n    err = inflateEnd(&stream);\n    return err;\n}\n"},{"id":16735,"name":"crc32.h","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* crc32.h -- tables for rapid CRC calculation\n * Generated automatically by crc32.c\n */\n\nlocal const unsigned long FAR crc_table[TBLS][256] =\n{\n  {\n    0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,\n    0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,\n    0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,\n    0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,\n    0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,\n    0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,\n    0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,\n    0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,\n    0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,\n    0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,\n    0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,\n    0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,\n    0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,\n    0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,\n    0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,\n    0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,\n    0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,\n    0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,\n    0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,\n    0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,\n    0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,\n    0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,\n    0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,\n    0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,\n    0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,\n    0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,\n    0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,\n    0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,\n    0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,\n    0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,\n    0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,\n    0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,\n    0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,\n    0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,\n    0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,\n    0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,\n    0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,\n    0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,\n    0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,\n    0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,\n    0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,\n    0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,\n    0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,\n    0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,\n    0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,\n    0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,\n    0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,\n    0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,\n    0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,\n    0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,\n    0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,\n    0x2d02ef8dUL\n#ifdef BYFOUR\n  },\n  {\n    0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,\n    0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,\n    0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,\n    0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,\n    0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,\n    0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,\n    0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,\n    0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,\n    0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,\n    0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,\n    0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,\n    0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,\n    0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,\n    0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,\n    0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,\n    0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,\n    0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,\n    0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,\n    0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,\n    0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,\n    0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,\n    0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,\n    0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,\n    0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,\n    0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,\n    0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,\n    0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,\n    0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,\n    0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,\n    0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,\n    0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,\n    0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,\n    0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,\n    0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,\n    0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,\n    0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,\n    0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,\n    0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,\n    0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,\n    0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,\n    0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,\n    0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,\n    0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,\n    0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,\n    0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,\n    0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,\n    0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,\n    0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,\n    0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,\n    0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,\n    0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,\n    0x9324fd72UL\n  },\n  {\n    0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,\n    0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,\n    0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,\n    0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,\n    0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,\n    0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,\n    0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,\n    0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,\n    0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,\n    0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,\n    0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,\n    0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,\n    0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,\n    0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,\n    0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,\n    0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,\n    0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,\n    0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,\n    0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,\n    0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,\n    0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,\n    0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,\n    0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,\n    0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,\n    0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,\n    0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,\n    0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,\n    0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,\n    0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,\n    0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,\n    0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,\n    0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,\n    0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,\n    0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,\n    0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,\n    0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,\n    0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,\n    0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,\n    0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,\n    0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,\n    0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,\n    0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,\n    0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,\n    0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,\n    0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,\n    0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,\n    0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,\n    0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,\n    0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,\n    0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,\n    0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,\n    0xbe9834edUL\n  },\n  {\n    0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,\n    0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,\n    0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,\n    0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,\n    0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,\n    0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,\n    0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,\n    0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,\n    0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,\n    0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,\n    0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,\n    0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,\n    0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,\n    0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,\n    0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,\n    0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,\n    0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,\n    0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,\n    0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,\n    0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,\n    0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,\n    0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,\n    0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,\n    0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,\n    0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,\n    0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,\n    0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,\n    0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,\n    0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,\n    0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,\n    0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,\n    0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,\n    0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,\n    0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,\n    0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,\n    0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,\n    0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,\n    0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,\n    0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,\n    0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,\n    0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,\n    0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,\n    0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,\n    0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,\n    0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,\n    0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,\n    0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,\n    0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,\n    0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,\n    0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,\n    0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,\n    0xde0506f1UL\n  },\n  {\n    0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,\n    0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,\n    0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,\n    0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,\n    0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,\n    0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,\n    0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,\n    0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,\n    0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,\n    0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,\n    0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,\n    0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,\n    0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,\n    0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,\n    0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,\n    0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,\n    0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,\n    0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,\n    0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,\n    0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,\n    0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,\n    0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,\n    0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,\n    0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,\n    0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,\n    0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,\n    0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,\n    0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,\n    0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,\n    0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,\n    0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,\n    0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,\n    0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,\n    0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,\n    0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,\n    0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,\n    0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,\n    0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,\n    0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,\n    0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,\n    0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,\n    0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,\n    0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,\n    0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,\n    0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,\n    0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,\n    0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,\n    0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,\n    0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,\n    0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,\n    0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,\n    0x8def022dUL\n  },\n  {\n    0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,\n    0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,\n    0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,\n    0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,\n    0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,\n    0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,\n    0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,\n    0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,\n    0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,\n    0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,\n    0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,\n    0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,\n    0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,\n    0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,\n    0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,\n    0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,\n    0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,\n    0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,\n    0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,\n    0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,\n    0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,\n    0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,\n    0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,\n    0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,\n    0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,\n    0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,\n    0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,\n    0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,\n    0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,\n    0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,\n    0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,\n    0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,\n    0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,\n    0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,\n    0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,\n    0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,\n    0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,\n    0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,\n    0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,\n    0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,\n    0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,\n    0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,\n    0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,\n    0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,\n    0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,\n    0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,\n    0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,\n    0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,\n    0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,\n    0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,\n    0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,\n    0x72fd2493UL\n  },\n  {\n    0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,\n    0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,\n    0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,\n    0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,\n    0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,\n    0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,\n    0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,\n    0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,\n    0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,\n    0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,\n    0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,\n    0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,\n    0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,\n    0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,\n    0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,\n    0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,\n    0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,\n    0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,\n    0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,\n    0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,\n    0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,\n    0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,\n    0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,\n    0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,\n    0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,\n    0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,\n    0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,\n    0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,\n    0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,\n    0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,\n    0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,\n    0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,\n    0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,\n    0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,\n    0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,\n    0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,\n    0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,\n    0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,\n    0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,\n    0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,\n    0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,\n    0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,\n    0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,\n    0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,\n    0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,\n    0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,\n    0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,\n    0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,\n    0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,\n    0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,\n    0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,\n    0xed3498beUL\n  },\n  {\n    0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,\n    0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,\n    0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,\n    0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,\n    0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,\n    0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,\n    0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,\n    0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,\n    0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,\n    0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,\n    0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,\n    0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,\n    0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,\n    0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,\n    0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,\n    0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,\n    0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,\n    0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,\n    0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,\n    0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,\n    0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,\n    0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,\n    0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,\n    0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,\n    0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,\n    0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,\n    0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,\n    0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,\n    0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,\n    0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,\n    0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,\n    0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,\n    0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,\n    0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,\n    0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,\n    0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,\n    0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,\n    0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,\n    0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,\n    0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,\n    0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,\n    0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,\n    0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,\n    0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,\n    0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,\n    0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,\n    0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,\n    0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,\n    0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,\n    0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,\n    0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,\n    0xf10605deUL\n#endif\n  }\n};\n"},{"id":16736,"name":"zlib.h","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* zlib.h -- interface of the 'zlib' general purpose compression library\n  version 1.2.5, April 19th, 2010\n\n  Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler\n\n  This software is provided 'as-is', without any express or implied\n  warranty.  In no event will the authors be held liable for any damages\n  arising from the use of this software.\n\n  Permission is granted to anyone to use this software for any purpose,\n  including commercial applications, and to alter it and redistribute it\n  freely, subject to the following restrictions:\n\n  1. The origin of this software must not be misrepresented; you must not\n     claim that you wrote the original software. If you use this software\n     in a product, an acknowledgment in the product documentation would be\n     appreciated but is not required.\n  2. Altered source versions must be plainly marked as such, and must not be\n     misrepresented as being the original software.\n  3. This notice may not be removed or altered from any source distribution.\n\n  Jean-loup Gailly        Mark Adler\n  jloup@gzip.org          madler@alumni.caltech.edu\n\n\n  The data format used by the zlib library is described by RFCs (Request for\n  Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt\n  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).\n*/\n\n#ifndef ZLIB_H\n#define ZLIB_H\n\n#include \"zconf.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define ZLIB_VERSION \"1.2.5\"\n#define ZLIB_VERNUM 0x1250\n#define ZLIB_VER_MAJOR 1\n#define ZLIB_VER_MINOR 2\n#define ZLIB_VER_REVISION 5\n#define ZLIB_VER_SUBREVISION 0\n\n/*\n    The 'zlib' compression library provides in-memory compression and\n  decompression functions, including integrity checks of the uncompressed data.\n  This version of the library supports only one compression method (deflation)\n  but other algorithms will be added later and will have the same stream\n  interface.\n\n    Compression can be done in a single step if the buffers are large enough,\n  or can be done by repeated calls of the compression function.  In the latter\n  case, the application must provide more input and/or consume the output\n  (providing more output space) before each call.\n\n    The compressed data format used by default by the in-memory functions is\n  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped\n  around a deflate stream, which is itself documented in RFC 1951.\n\n    The library also supports reading and writing files in gzip (.gz) format\n  with an interface similar to that of stdio using the functions that start\n  with \"gz\".  The gzip format is different from the zlib format.  gzip is a\n  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.\n\n    This library can optionally read and write gzip streams in memory as well.\n\n    The zlib format was designed to be compact and fast for use in memory\n  and on communications channels.  The gzip format was designed for single-\n  file compression on file systems, has a larger header than zlib to maintain\n  directory information, and uses a different, slower check method than zlib.\n\n    The library does not install any signal handler.  The decoder checks\n  the consistency of the compressed data, so the library should never crash\n  even in case of corrupted input.\n*/\n\ntypedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));\ntypedef void   (*free_func)  OF((voidpf opaque, voidpf address));\n\nstruct internal_state;\n\ntypedef struct z_stream_s {\n    Bytef    *next_in;  /* next input byte */\n    uInt     avail_in;  /* number of bytes available at next_in */\n    uLong    total_in;  /* total nb of input bytes read so far */\n\n    Bytef    *next_out; /* next output byte should be put there */\n    uInt     avail_out; /* remaining free space at next_out */\n    uLong    total_out; /* total nb of bytes output so far */\n\n    char     *msg;      /* last error message, NULL if no error */\n    struct internal_state FAR *state; /* not visible by applications */\n\n    alloc_func zalloc;  /* used to allocate the internal state */\n    free_func  zfree;   /* used to free the internal state */\n    voidpf     opaque;  /* private data object passed to zalloc and zfree */\n\n    int     data_type;  /* best guess about the data type: binary or text */\n    uLong   adler;      /* adler32 value of the uncompressed data */\n    uLong   reserved;   /* reserved for future use */\n} z_stream;\n\ntypedef z_stream FAR *z_streamp;\n\n/*\n     gzip header information passed to and from zlib routines.  See RFC 1952\n  for more details on the meanings of these fields.\n*/\ntypedef struct gz_header_s {\n    int     text;       /* true if compressed data believed to be text */\n    uLong   time;       /* modification time */\n    int     xflags;     /* extra flags (not used when writing a gzip file) */\n    int     os;         /* operating system */\n    Bytef   *extra;     /* pointer to extra field or Z_NULL if none */\n    uInt    extra_len;  /* extra field length (valid if extra != Z_NULL) */\n    uInt    extra_max;  /* space at extra (only when reading header) */\n    Bytef   *name;      /* pointer to zero-terminated file name or Z_NULL */\n    uInt    name_max;   /* space at name (only when reading header) */\n    Bytef   *comment;   /* pointer to zero-terminated comment or Z_NULL */\n    uInt    comm_max;   /* space at comment (only when reading header) */\n    int     hcrc;       /* true if there was or will be a header crc */\n    int     done;       /* true when done reading gzip header (not used\n                           when writing a gzip file) */\n} gz_header;\n\ntypedef gz_header FAR *gz_headerp;\n\n/*\n     The application must update next_in and avail_in when avail_in has dropped\n   to zero.  It must update next_out and avail_out when avail_out has dropped\n   to zero.  The application must initialize zalloc, zfree and opaque before\n   calling the init function.  All other fields are set by the compression\n   library and must not be updated by the application.\n\n     The opaque value provided by the application will be passed as the first\n   parameter for calls of zalloc and zfree.  This can be useful for custom\n   memory management.  The compression library attaches no meaning to the\n   opaque value.\n\n     zalloc must return Z_NULL if there is not enough memory for the object.\n   If zlib is used in a multi-threaded application, zalloc and zfree must be\n   thread safe.\n\n     On 16-bit systems, the functions zalloc and zfree must be able to allocate\n   exactly 65536 bytes, but will not be required to allocate more than this if\n   the symbol MAXSEG_64K is defined (see zconf.h).  WARNING: On MSDOS, pointers\n   returned by zalloc for objects of exactly 65536 bytes *must* have their\n   offset normalized to zero.  The default allocation function provided by this\n   library ensures this (see zutil.c).  To reduce memory requirements and avoid\n   any allocation of 64K objects, at the expense of compression ratio, compile\n   the library with -DMAX_WBITS=14 (see zconf.h).\n\n     The fields total_in and total_out can be used for statistics or progress\n   reports.  After compression, total_in holds the total size of the\n   uncompressed data and may be saved for use in the decompressor (particularly\n   if the decompressor wants to decompress everything in a single step).\n*/\n\n                        /* constants */\n\n#define Z_NO_FLUSH      0\n#define Z_PARTIAL_FLUSH 1\n#define Z_SYNC_FLUSH    2\n#define Z_FULL_FLUSH    3\n#define Z_FINISH        4\n#define Z_BLOCK         5\n#define Z_TREES         6\n/* Allowed flush values; see deflate() and inflate() below for details */\n\n#define Z_OK            0\n#define Z_STREAM_END    1\n#define Z_NEED_DICT     2\n#define Z_ERRNO        (-1)\n#define Z_STREAM_ERROR (-2)\n#define Z_DATA_ERROR   (-3)\n#define Z_MEM_ERROR    (-4)\n#define Z_BUF_ERROR    (-5)\n#define Z_VERSION_ERROR (-6)\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n\n#define Z_NO_COMPRESSION         0\n#define Z_BEST_SPEED             1\n#define Z_BEST_COMPRESSION       9\n#define Z_DEFAULT_COMPRESSION  (-1)\n/* compression levels */\n\n#define Z_FILTERED            1\n#define Z_HUFFMAN_ONLY        2\n#define Z_RLE                 3\n#define Z_FIXED               4\n#define Z_DEFAULT_STRATEGY    0\n/* compression strategy; see deflateInit2() below for details */\n\n#define Z_BINARY   0\n#define Z_TEXT     1\n#define Z_ASCII    Z_TEXT   /* for compatibility with 1.2.2 and earlier */\n#define Z_UNKNOWN  2\n/* Possible values of the data_type field (though see inflate()) */\n\n#define Z_DEFLATED   8\n/* The deflate compression method (the only one supported in this version) */\n\n#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */\n\n#define zlib_version zlibVersion()\n/* for compatibility with versions < 1.0.2 */\n\n\n                        /* basic functions */\n\nZEXTERN const char * ZEXPORT zlibVersion OF((void));\n/* The application can compare zlibVersion and ZLIB_VERSION for consistency.\n   If the first character differs, the library code actually used is not\n   compatible with the zlib.h header file used by the application.  This check\n   is automatically made by deflateInit and inflateInit.\n */\n\n/*\nZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));\n\n     Initializes the internal stream state for compression.  The fields\n   zalloc, zfree and opaque must be initialized before by the caller.  If\n   zalloc and zfree are set to Z_NULL, deflateInit updates them to use default\n   allocation functions.\n\n     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:\n   1 gives best speed, 9 gives best compression, 0 gives no compression at all\n   (the input data is simply copied a block at a time).  Z_DEFAULT_COMPRESSION\n   requests a default compromise between speed and compression (currently\n   equivalent to level 6).\n\n     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough\n   memory, Z_STREAM_ERROR if level is not a valid compression level, or\n   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible\n   with the version assumed by the caller (ZLIB_VERSION).  msg is set to null\n   if there is no error message.  deflateInit does not perform any compression:\n   this will be done by deflate().\n*/\n\n\nZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));\n/*\n    deflate compresses as much data as possible, and stops when the input\n  buffer becomes empty or the output buffer becomes full.  It may introduce\n  some output latency (reading input without producing any output) except when\n  forced to flush.\n\n    The detailed semantics are as follows.  deflate performs one or both of the\n  following actions:\n\n  - Compress more input starting at next_in and update next_in and avail_in\n    accordingly.  If not all input can be processed (because there is not\n    enough room in the output buffer), next_in and avail_in are updated and\n    processing will resume at this point for the next call of deflate().\n\n  - Provide more output starting at next_out and update next_out and avail_out\n    accordingly.  This action is forced if the parameter flush is non zero.\n    Forcing flush frequently degrades the compression ratio, so this parameter\n    should be set only when necessary (in interactive applications).  Some\n    output may be provided even if flush is not set.\n\n    Before the call of deflate(), the application should ensure that at least\n  one of the actions is possible, by providing more input and/or consuming more\n  output, and updating avail_in or avail_out accordingly; avail_out should\n  never be zero before the call.  The application can consume the compressed\n  output when it wants, for example when the output buffer is full (avail_out\n  == 0), or after each call of deflate().  If deflate returns Z_OK and with\n  zero avail_out, it must be called again after making room in the output\n  buffer because there might be more output pending.\n\n    Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to\n  decide how much data to accumulate before producing output, in order to\n  maximize compression.\n\n    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is\n  flushed to the output buffer and the output is aligned on a byte boundary, so\n  that the decompressor can get all input data available so far.  (In\n  particular avail_in is zero after the call if enough output space has been\n  provided before the call.) Flushing may degrade compression for some\n  compression algorithms and so it should be used only when necessary.  This\n  completes the current deflate block and follows it with an empty stored block\n  that is three bits plus filler bits to the next byte, followed by four bytes\n  (00 00 ff ff).\n\n    If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the\n  output buffer, but the output is not aligned to a byte boundary.  All of the\n  input data so far will be available to the decompressor, as for Z_SYNC_FLUSH.\n  This completes the current deflate block and follows it with an empty fixed\n  codes block that is 10 bits long.  This assures that enough bytes are output\n  in order for the decompressor to finish the block before the empty fixed code\n  block.\n\n    If flush is set to Z_BLOCK, a deflate block is completed and emitted, as\n  for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to\n  seven bits of the current block are held to be written as the next byte after\n  the next deflate block is completed.  In this case, the decompressor may not\n  be provided enough bits at this point in order to complete decompression of\n  the data provided so far to the compressor.  It may need to wait for the next\n  block to be emitted.  This is for advanced applications that need to control\n  the emission of deflate blocks.\n\n    If flush is set to Z_FULL_FLUSH, all output is flushed as with\n  Z_SYNC_FLUSH, and the compression state is reset so that decompression can\n  restart from this point if previous compressed data has been damaged or if\n  random access is desired.  Using Z_FULL_FLUSH too often can seriously degrade\n  compression.\n\n    If deflate returns with avail_out == 0, this function must be called again\n  with the same value of the flush parameter and more output space (updated\n  avail_out), until the flush is complete (deflate returns with non-zero\n  avail_out).  In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that\n  avail_out is greater than six to avoid repeated flush markers due to\n  avail_out == 0 on return.\n\n    If the parameter flush is set to Z_FINISH, pending input is processed,\n  pending output is flushed and deflate returns with Z_STREAM_END if there was\n  enough output space; if deflate returns with Z_OK, this function must be\n  called again with Z_FINISH and more output space (updated avail_out) but no\n  more input data, until it returns with Z_STREAM_END or an error.  After\n  deflate has returned Z_STREAM_END, the only possible operations on the stream\n  are deflateReset or deflateEnd.\n\n    Z_FINISH can be used immediately after deflateInit if all the compression\n  is to be done in a single step.  In this case, avail_out must be at least the\n  value returned by deflateBound (see below).  If deflate does not return\n  Z_STREAM_END, then it must be called again as described above.\n\n    deflate() sets strm->adler to the adler32 checksum of all input read\n  so far (that is, total_in bytes).\n\n    deflate() may update strm->data_type if it can make a good guess about\n  the input data type (Z_BINARY or Z_TEXT).  In doubt, the data is considered\n  binary.  This field is only for information purposes and does not affect the\n  compression algorithm in any manner.\n\n    deflate() returns Z_OK if some progress has been made (more input\n  processed or more output produced), Z_STREAM_END if all input has been\n  consumed and all output has been produced (only when flush is set to\n  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example\n  if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible\n  (for example avail_in or avail_out was zero).  Note that Z_BUF_ERROR is not\n  fatal, and deflate() can be called again with more input and more output\n  space to continue compressing.\n*/\n\n\nZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));\n/*\n     All dynamically allocated data structures for this stream are freed.\n   This function discards any unprocessed input and does not flush any pending\n   output.\n\n     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the\n   stream state was inconsistent, Z_DATA_ERROR if the stream was freed\n   prematurely (some input or output was discarded).  In the error case, msg\n   may be set but then points to a static string (which must not be\n   deallocated).\n*/\n\n\n/*\nZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));\n\n     Initializes the internal stream state for decompression.  The fields\n   next_in, avail_in, zalloc, zfree and opaque must be initialized before by\n   the caller.  If next_in is not Z_NULL and avail_in is large enough (the\n   exact value depends on the compression method), inflateInit determines the\n   compression method from the zlib header and allocates all data structures\n   accordingly; otherwise the allocation will be deferred to the first call of\n   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to\n   use default allocation functions.\n\n     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough\n   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the\n   version assumed by the caller, or Z_STREAM_ERROR if the parameters are\n   invalid, such as a null pointer to the structure.  msg is set to null if\n   there is no error message.  inflateInit does not perform any decompression\n   apart from possibly reading the zlib header if present: actual decompression\n   will be done by inflate().  (So next_in and avail_in may be modified, but\n   next_out and avail_out are unused and unchanged.) The current implementation\n   of inflateInit() does not process any header information -- that is deferred\n   until inflate() is called.\n*/\n\n\nZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));\n/*\n    inflate decompresses as much data as possible, and stops when the input\n  buffer becomes empty or the output buffer becomes full.  It may introduce\n  some output latency (reading input without producing any output) except when\n  forced to flush.\n\n  The detailed semantics are as follows.  inflate performs one or both of the\n  following actions:\n\n  - Decompress more input starting at next_in and update next_in and avail_in\n    accordingly.  If not all input can be processed (because there is not\n    enough room in the output buffer), next_in is updated and processing will\n    resume at this point for the next call of inflate().\n\n  - Provide more output starting at next_out and update next_out and avail_out\n    accordingly.  inflate() provides as much output as possible, until there is\n    no more input data or no more space in the output buffer (see below about\n    the flush parameter).\n\n    Before the call of inflate(), the application should ensure that at least\n  one of the actions is possible, by providing more input and/or consuming more\n  output, and updating the next_* and avail_* values accordingly.  The\n  application can consume the uncompressed output when it wants, for example\n  when the output buffer is full (avail_out == 0), or after each call of\n  inflate().  If inflate returns Z_OK and with zero avail_out, it must be\n  called again after making room in the output buffer because there might be\n  more output pending.\n\n    The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH,\n  Z_BLOCK, or Z_TREES.  Z_SYNC_FLUSH requests that inflate() flush as much\n  output as possible to the output buffer.  Z_BLOCK requests that inflate()\n  stop if and when it gets to the next deflate block boundary.  When decoding\n  the zlib or gzip format, this will cause inflate() to return immediately\n  after the header and before the first block.  When doing a raw inflate,\n  inflate() will go ahead and process the first block, and will return when it\n  gets to the end of that block, or when it runs out of data.\n\n    The Z_BLOCK option assists in appending to or combining deflate streams.\n  Also to assist in this, on return inflate() will set strm->data_type to the\n  number of unused bits in the last byte taken from strm->next_in, plus 64 if\n  inflate() is currently decoding the last block in the deflate stream, plus\n  128 if inflate() returned immediately after decoding an end-of-block code or\n  decoding the complete header up to just before the first byte of the deflate\n  stream.  The end-of-block will not be indicated until all of the uncompressed\n  data from that block has been written to strm->next_out.  The number of\n  unused bits may in general be greater than seven, except when bit 7 of\n  data_type is set, in which case the number of unused bits will be less than\n  eight.  data_type is set as noted here every time inflate() returns for all\n  flush options, and so can be used to determine the amount of currently\n  consumed input in bits.\n\n    The Z_TREES option behaves as Z_BLOCK does, but it also returns when the\n  end of each deflate block header is reached, before any actual data in that\n  block is decoded.  This allows the caller to determine the length of the\n  deflate block header for later use in random access within a deflate block.\n  256 is added to the value of strm->data_type when inflate() returns\n  immediately after reaching the end of the deflate block header.\n\n    inflate() should normally be called until it returns Z_STREAM_END or an\n  error.  However if all decompression is to be performed in a single step (a\n  single call of inflate), the parameter flush should be set to Z_FINISH.  In\n  this case all pending input is processed and all pending output is flushed;\n  avail_out must be large enough to hold all the uncompressed data.  (The size\n  of the uncompressed data may have been saved by the compressor for this\n  purpose.) The next operation on this stream must be inflateEnd to deallocate\n  the decompression state.  The use of Z_FINISH is never required, but can be\n  used to inform inflate that a faster approach may be used for the single\n  inflate() call.\n\n     In this implementation, inflate() always flushes as much output as\n  possible to the output buffer, and always uses the faster approach on the\n  first call.  So the only effect of the flush parameter in this implementation\n  is on the return value of inflate(), as noted below, or when it returns early\n  because Z_BLOCK or Z_TREES is used.\n\n     If a preset dictionary is needed after this call (see inflateSetDictionary\n  below), inflate sets strm->adler to the adler32 checksum of the dictionary\n  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets\n  strm->adler to the adler32 checksum of all output produced so far (that is,\n  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described\n  below.  At the end of the stream, inflate() checks that its computed adler32\n  checksum is equal to that saved by the compressor and returns Z_STREAM_END\n  only if the checksum is correct.\n\n    inflate() can decompress and check either zlib-wrapped or gzip-wrapped\n  deflate data.  The header type is detected automatically, if requested when\n  initializing with inflateInit2().  Any information contained in the gzip\n  header is not retained, so applications that need that information should\n  instead use raw inflate, see inflateInit2() below, or inflateBack() and\n  perform their own processing of the gzip header and trailer.\n\n    inflate() returns Z_OK if some progress has been made (more input processed\n  or more output produced), Z_STREAM_END if the end of the compressed data has\n  been reached and all uncompressed output has been produced, Z_NEED_DICT if a\n  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was\n  corrupted (input stream not conforming to the zlib format or incorrect check\n  value), Z_STREAM_ERROR if the stream structure was inconsistent (for example\n  next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory,\n  Z_BUF_ERROR if no progress is possible or if there was not enough room in the\n  output buffer when Z_FINISH is used.  Note that Z_BUF_ERROR is not fatal, and\n  inflate() can be called again with more input and more output space to\n  continue decompressing.  If Z_DATA_ERROR is returned, the application may\n  then call inflateSync() to look for a good compression block if a partial\n  recovery of the data is desired.\n*/\n\n\nZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));\n/*\n     All dynamically allocated data structures for this stream are freed.\n   This function discards any unprocessed input and does not flush any pending\n   output.\n\n     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state\n   was inconsistent.  In the error case, msg may be set but then points to a\n   static string (which must not be deallocated).\n*/\n\n\n                        /* Advanced functions */\n\n/*\n    The following functions are needed only in some special applications.\n*/\n\n/*\nZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,\n                                     int  level,\n                                     int  method,\n                                     int  windowBits,\n                                     int  memLevel,\n                                     int  strategy));\n\n     This is another version of deflateInit with more compression options.  The\n   fields next_in, zalloc, zfree and opaque must be initialized before by the\n   caller.\n\n     The method parameter is the compression method.  It must be Z_DEFLATED in\n   this version of the library.\n\n     The windowBits parameter is the base two logarithm of the window size\n   (the size of the history buffer).  It should be in the range 8..15 for this\n   version of the library.  Larger values of this parameter result in better\n   compression at the expense of memory usage.  The default value is 15 if\n   deflateInit is used instead.\n\n     windowBits can also be -8..-15 for raw deflate.  In this case, -windowBits\n   determines the window size.  deflate() will then generate raw deflate data\n   with no zlib header or trailer, and will not compute an adler32 check value.\n\n     windowBits can also be greater than 15 for optional gzip encoding.  Add\n   16 to windowBits to write a simple gzip header and trailer around the\n   compressed data instead of a zlib wrapper.  The gzip header will have no\n   file name, no extra data, no comment, no modification time (set to zero), no\n   header crc, and the operating system will be set to 255 (unknown).  If a\n   gzip stream is being written, strm->adler is a crc32 instead of an adler32.\n\n     The memLevel parameter specifies how much memory should be allocated\n   for the internal compression state.  memLevel=1 uses minimum memory but is\n   slow and reduces compression ratio; memLevel=9 uses maximum memory for\n   optimal speed.  The default value is 8.  See zconf.h for total memory usage\n   as a function of windowBits and memLevel.\n\n     The strategy parameter is used to tune the compression algorithm.  Use the\n   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a\n   filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no\n   string match), or Z_RLE to limit match distances to one (run-length\n   encoding).  Filtered data consists mostly of small values with a somewhat\n   random distribution.  In this case, the compression algorithm is tuned to\n   compress them better.  The effect of Z_FILTERED is to force more Huffman\n   coding and less string matching; it is somewhat intermediate between\n   Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY.  Z_RLE is designed to be almost as\n   fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data.  The\n   strategy parameter only affects the compression ratio but not the\n   correctness of the compressed output even if it is not set appropriately.\n   Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler\n   decoder for special applications.\n\n     deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough\n   memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid\n   method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is\n   incompatible with the version assumed by the caller (ZLIB_VERSION).  msg is\n   set to null if there is no error message.  deflateInit2 does not perform any\n   compression: this will be done by deflate().\n*/\n\nZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,\n                                             const Bytef *dictionary,\n                                             uInt  dictLength));\n/*\n     Initializes the compression dictionary from the given byte sequence\n   without producing any compressed output.  This function must be called\n   immediately after deflateInit, deflateInit2 or deflateReset, before any call\n   of deflate.  The compressor and decompressor must use exactly the same\n   dictionary (see inflateSetDictionary).\n\n     The dictionary should consist of strings (byte sequences) that are likely\n   to be encountered later in the data to be compressed, with the most commonly\n   used strings preferably put towards the end of the dictionary.  Using a\n   dictionary is most useful when the data to be compressed is short and can be\n   predicted with good accuracy; the data can then be compressed better than\n   with the default empty dictionary.\n\n     Depending on the size of the compression data structures selected by\n   deflateInit or deflateInit2, a part of the dictionary may in effect be\n   discarded, for example if the dictionary is larger than the window size\n   provided in deflateInit or deflateInit2.  Thus the strings most likely to be\n   useful should be put at the end of the dictionary, not at the front.  In\n   addition, the current implementation of deflate will use at most the window\n   size minus 262 bytes of the provided dictionary.\n\n     Upon return of this function, strm->adler is set to the adler32 value\n   of the dictionary; the decompressor may later use this value to determine\n   which dictionary has been used by the compressor.  (The adler32 value\n   applies to the whole dictionary even if only a subset of the dictionary is\n   actually used by the compressor.) If a raw deflate was requested, then the\n   adler32 value is not computed and strm->adler is not set.\n\n     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a\n   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is\n   inconsistent (for example if deflate has already been called for this stream\n   or if the compression method is bsort).  deflateSetDictionary does not\n   perform any compression: this will be done by deflate().\n*/\n\nZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,\n                                    z_streamp source));\n/*\n     Sets the destination stream as a complete copy of the source stream.\n\n     This function can be useful when several compression strategies will be\n   tried, for example when there are several ways of pre-processing the input\n   data with a filter.  The streams that will be discarded should then be freed\n   by calling deflateEnd.  Note that deflateCopy duplicates the internal\n   compression state which can be quite large, so this strategy is slow and can\n   consume lots of memory.\n\n     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not\n   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent\n   (such as zalloc being Z_NULL).  msg is left unchanged in both source and\n   destination.\n*/\n\nZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));\n/*\n     This function is equivalent to deflateEnd followed by deflateInit,\n   but does not free and reallocate all the internal compression state.  The\n   stream will keep the same compression level and any other attributes that\n   may have been set by deflateInit2.\n\n     deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source\n   stream state was inconsistent (such as zalloc or state being Z_NULL).\n*/\n\nZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,\n                                      int level,\n                                      int strategy));\n/*\n     Dynamically update the compression level and compression strategy.  The\n   interpretation of level and strategy is as in deflateInit2.  This can be\n   used to switch between compression and straight copy of the input data, or\n   to switch to a different kind of input data requiring a different strategy.\n   If the compression level is changed, the input available so far is\n   compressed with the old level (and may be flushed); the new level will take\n   effect only at the next call of deflate().\n\n     Before the call of deflateParams, the stream state must be set as for\n   a call of deflate(), since the currently available input may have to be\n   compressed and flushed.  In particular, strm->avail_out must be non-zero.\n\n     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source\n   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if\n   strm->avail_out was zero.\n*/\n\nZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,\n                                    int good_length,\n                                    int max_lazy,\n                                    int nice_length,\n                                    int max_chain));\n/*\n     Fine tune deflate's internal compression parameters.  This should only be\n   used by someone who understands the algorithm used by zlib's deflate for\n   searching for the best matching string, and even then only by the most\n   fanatic optimizer trying to squeeze out the last compressed bit for their\n   specific input data.  Read the deflate.c source code for the meaning of the\n   max_lazy, good_length, nice_length, and max_chain parameters.\n\n     deflateTune() can be called after deflateInit() or deflateInit2(), and\n   returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.\n */\n\nZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,\n                                       uLong sourceLen));\n/*\n     deflateBound() returns an upper bound on the compressed size after\n   deflation of sourceLen bytes.  It must be called after deflateInit() or\n   deflateInit2(), and after deflateSetHeader(), if used.  This would be used\n   to allocate an output buffer for deflation in a single pass, and so would be\n   called before deflate().\n*/\n\nZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,\n                                     int bits,\n                                     int value));\n/*\n     deflatePrime() inserts bits in the deflate output stream.  The intent\n   is that this function is used to start off the deflate output with the bits\n   leftover from a previous deflate stream when appending to it.  As such, this\n   function can only be used for raw deflate, and must be used before the first\n   deflate() call after a deflateInit2() or deflateReset().  bits must be less\n   than or equal to 16, and that many of the least significant bits of value\n   will be inserted in the output.\n\n     deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source\n   stream state was inconsistent.\n*/\n\nZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,\n                                         gz_headerp head));\n/*\n     deflateSetHeader() provides gzip header information for when a gzip\n   stream is requested by deflateInit2().  deflateSetHeader() may be called\n   after deflateInit2() or deflateReset() and before the first call of\n   deflate().  The text, time, os, extra field, name, and comment information\n   in the provided gz_header structure are written to the gzip header (xflag is\n   ignored -- the extra flags are set according to the compression level).  The\n   caller must assure that, if not Z_NULL, name and comment are terminated with\n   a zero byte, and that if extra is not Z_NULL, that extra_len bytes are\n   available there.  If hcrc is true, a gzip header crc is included.  Note that\n   the current versions of the command-line version of gzip (up through version\n   1.3.x) do not support header crc's, and will report that it is a \"multi-part\n   gzip file\" and give up.\n\n     If deflateSetHeader is not used, the default gzip header has text false,\n   the time set to zero, and os set to 255, with no extra, name, or comment\n   fields.  The gzip header is returned to the default state by deflateReset().\n\n     deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source\n   stream state was inconsistent.\n*/\n\n/*\nZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,\n                                     int  windowBits));\n\n     This is another version of inflateInit with an extra parameter.  The\n   fields next_in, avail_in, zalloc, zfree and opaque must be initialized\n   before by the caller.\n\n     The windowBits parameter is the base two logarithm of the maximum window\n   size (the size of the history buffer).  It should be in the range 8..15 for\n   this version of the library.  The default value is 15 if inflateInit is used\n   instead.  windowBits must be greater than or equal to the windowBits value\n   provided to deflateInit2() while compressing, or it must be equal to 15 if\n   deflateInit2() was not used.  If a compressed stream with a larger window\n   size is given as input, inflate() will return with the error code\n   Z_DATA_ERROR instead of trying to allocate a larger window.\n\n     windowBits can also be zero to request that inflate use the window size in\n   the zlib header of the compressed stream.\n\n     windowBits can also be -8..-15 for raw inflate.  In this case, -windowBits\n   determines the window size.  inflate() will then process raw deflate data,\n   not looking for a zlib or gzip header, not generating a check value, and not\n   looking for any check values for comparison at the end of the stream.  This\n   is for use with other formats that use the deflate compressed data format\n   such as zip.  Those formats provide their own check values.  If a custom\n   format is developed using the raw deflate format for compressed data, it is\n   recommended that a check value such as an adler32 or a crc32 be applied to\n   the uncompressed data as is done in the zlib, gzip, and zip formats.  For\n   most applications, the zlib format should be used as is.  Note that comments\n   above on the use in deflateInit2() applies to the magnitude of windowBits.\n\n     windowBits can also be greater than 15 for optional gzip decoding.  Add\n   32 to windowBits to enable zlib and gzip decoding with automatic header\n   detection, or add 16 to decode only the gzip format (the zlib format will\n   return a Z_DATA_ERROR).  If a gzip stream is being decoded, strm->adler is a\n   crc32 instead of an adler32.\n\n     inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough\n   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the\n   version assumed by the caller, or Z_STREAM_ERROR if the parameters are\n   invalid, such as a null pointer to the structure.  msg is set to null if\n   there is no error message.  inflateInit2 does not perform any decompression\n   apart from possibly reading the zlib header if present: actual decompression\n   will be done by inflate().  (So next_in and avail_in may be modified, but\n   next_out and avail_out are unused and unchanged.) The current implementation\n   of inflateInit2() does not process any header information -- that is\n   deferred until inflate() is called.\n*/\n\nZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,\n                                             const Bytef *dictionary,\n                                             uInt  dictLength));\n/*\n     Initializes the decompression dictionary from the given uncompressed byte\n   sequence.  This function must be called immediately after a call of inflate,\n   if that call returned Z_NEED_DICT.  The dictionary chosen by the compressor\n   can be determined from the adler32 value returned by that call of inflate.\n   The compressor and decompressor must use exactly the same dictionary (see\n   deflateSetDictionary).  For raw inflate, this function can be called\n   immediately after inflateInit2() or inflateReset() and before any call of\n   inflate() to set the dictionary.  The application must insure that the\n   dictionary that was used for compression is provided.\n\n     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a\n   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is\n   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the\n   expected one (incorrect adler32 value).  inflateSetDictionary does not\n   perform any decompression: this will be done by subsequent calls of\n   inflate().\n*/\n\nZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));\n/*\n     Skips invalid compressed data until a full flush point (see above the\n   description of deflate with Z_FULL_FLUSH) can be found, or until all\n   available input is skipped.  No output is provided.\n\n     inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR\n   if no more input was provided, Z_DATA_ERROR if no flush point has been\n   found, or Z_STREAM_ERROR if the stream structure was inconsistent.  In the\n   success case, the application may save the current current value of total_in\n   which indicates where valid compressed data was found.  In the error case,\n   the application may repeatedly call inflateSync, providing more input each\n   time, until success or end of the input data.\n*/\n\nZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,\n                                    z_streamp source));\n/*\n     Sets the destination stream as a complete copy of the source stream.\n\n     This function can be useful when randomly accessing a large stream.  The\n   first pass through the stream can periodically record the inflate state,\n   allowing restarting inflate at those points when randomly accessing the\n   stream.\n\n     inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not\n   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent\n   (such as zalloc being Z_NULL).  msg is left unchanged in both source and\n   destination.\n*/\n\nZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));\n/*\n     This function is equivalent to inflateEnd followed by inflateInit,\n   but does not free and reallocate all the internal decompression state.  The\n   stream will keep attributes that may have been set by inflateInit2.\n\n     inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source\n   stream state was inconsistent (such as zalloc or state being Z_NULL).\n*/\n\nZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,\n                                      int windowBits));\n/*\n     This function is the same as inflateReset, but it also permits changing\n   the wrap and window size requests.  The windowBits parameter is interpreted\n   the same as it is for inflateInit2.\n\n     inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source\n   stream state was inconsistent (such as zalloc or state being Z_NULL), or if\n   the windowBits parameter is invalid.\n*/\n\nZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,\n                                     int bits,\n                                     int value));\n/*\n     This function inserts bits in the inflate input stream.  The intent is\n   that this function is used to start inflating at a bit position in the\n   middle of a byte.  The provided bits will be used before any bytes are used\n   from next_in.  This function should only be used with raw inflate, and\n   should be used before the first inflate() call after inflateInit2() or\n   inflateReset().  bits must be less than or equal to 16, and that many of the\n   least significant bits of value will be inserted in the input.\n\n     If bits is negative, then the input stream bit buffer is emptied.  Then\n   inflatePrime() can be called again to put bits in the buffer.  This is used\n   to clear out bits leftover after feeding inflate a block description prior\n   to feeding inflate codes.\n\n     inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source\n   stream state was inconsistent.\n*/\n\nZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));\n/*\n     This function returns two values, one in the lower 16 bits of the return\n   value, and the other in the remaining upper bits, obtained by shifting the\n   return value down 16 bits.  If the upper value is -1 and the lower value is\n   zero, then inflate() is currently decoding information outside of a block.\n   If the upper value is -1 and the lower value is non-zero, then inflate is in\n   the middle of a stored block, with the lower value equaling the number of\n   bytes from the input remaining to copy.  If the upper value is not -1, then\n   it is the number of bits back from the current bit position in the input of\n   the code (literal or length/distance pair) currently being processed.  In\n   that case the lower value is the number of bytes already emitted for that\n   code.\n\n     A code is being processed if inflate is waiting for more input to complete\n   decoding of the code, or if it has completed decoding but is waiting for\n   more output space to write the literal or match data.\n\n     inflateMark() is used to mark locations in the input data for random\n   access, which may be at bit positions, and to note those cases where the\n   output of a code may span boundaries of random access blocks.  The current\n   location in the input stream can be determined from avail_in and data_type\n   as noted in the description for the Z_BLOCK flush parameter for inflate.\n\n     inflateMark returns the value noted above or -1 << 16 if the provided\n   source stream state was inconsistent.\n*/\n\nZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,\n                                         gz_headerp head));\n/*\n     inflateGetHeader() requests that gzip header information be stored in the\n   provided gz_header structure.  inflateGetHeader() may be called after\n   inflateInit2() or inflateReset(), and before the first call of inflate().\n   As inflate() processes the gzip stream, head->done is zero until the header\n   is completed, at which time head->done is set to one.  If a zlib stream is\n   being decoded, then head->done is set to -1 to indicate that there will be\n   no gzip header information forthcoming.  Note that Z_BLOCK or Z_TREES can be\n   used to force inflate() to return immediately after header processing is\n   complete and before any actual data is decompressed.\n\n     The text, time, xflags, and os fields are filled in with the gzip header\n   contents.  hcrc is set to true if there is a header CRC.  (The header CRC\n   was valid if done is set to one.) If extra is not Z_NULL, then extra_max\n   contains the maximum number of bytes to write to extra.  Once done is true,\n   extra_len contains the actual extra field length, and extra contains the\n   extra field, or that field truncated if extra_max is less than extra_len.\n   If name is not Z_NULL, then up to name_max characters are written there,\n   terminated with a zero unless the length is greater than name_max.  If\n   comment is not Z_NULL, then up to comm_max characters are written there,\n   terminated with a zero unless the length is greater than comm_max.  When any\n   of extra, name, or comment are not Z_NULL and the respective field is not\n   present in the header, then that field is set to Z_NULL to signal its\n   absence.  This allows the use of deflateSetHeader() with the returned\n   structure to duplicate the header.  However if those fields are set to\n   allocated memory, then the application will need to save those pointers\n   elsewhere so that they can be eventually freed.\n\n     If inflateGetHeader is not used, then the header information is simply\n   discarded.  The header is always checked for validity, including the header\n   CRC if present.  inflateReset() will reset the process to discard the header\n   information.  The application would need to call inflateGetHeader() again to\n   retrieve the header from the next gzip stream.\n\n     inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source\n   stream state was inconsistent.\n*/\n\n/*\nZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,\n                                        unsigned char FAR *window));\n\n     Initialize the internal stream state for decompression using inflateBack()\n   calls.  The fields zalloc, zfree and opaque in strm must be initialized\n   before the call.  If zalloc and zfree are Z_NULL, then the default library-\n   derived memory allocation routines are used.  windowBits is the base two\n   logarithm of the window size, in the range 8..15.  window is a caller\n   supplied buffer of that size.  Except for special applications where it is\n   assured that deflate was used with small window sizes, windowBits must be 15\n   and a 32K byte window must be supplied to be able to decompress general\n   deflate streams.\n\n     See inflateBack() for the usage of these routines.\n\n     inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of\n   the paramaters are invalid, Z_MEM_ERROR if the internal state could not be\n   allocated, or Z_VERSION_ERROR if the version of the library does not match\n   the version of the header file.\n*/\n\ntypedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));\ntypedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));\n\nZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,\n                                    in_func in, void FAR *in_desc,\n                                    out_func out, void FAR *out_desc));\n/*\n     inflateBack() does a raw inflate with a single call using a call-back\n   interface for input and output.  This is more efficient than inflate() for\n   file i/o applications in that it avoids copying between the output and the\n   sliding window by simply making the window itself the output buffer.  This\n   function trusts the application to not change the output buffer passed by\n   the output function, at least until inflateBack() returns.\n\n     inflateBackInit() must be called first to allocate the internal state\n   and to initialize the state with the user-provided window buffer.\n   inflateBack() may then be used multiple times to inflate a complete, raw\n   deflate stream with each call.  inflateBackEnd() is then called to free the\n   allocated state.\n\n     A raw deflate stream is one with no zlib or gzip header or trailer.\n   This routine would normally be used in a utility that reads zip or gzip\n   files and writes out uncompressed files.  The utility would decode the\n   header and process the trailer on its own, hence this routine expects only\n   the raw deflate stream to decompress.  This is different from the normal\n   behavior of inflate(), which expects either a zlib or gzip header and\n   trailer around the deflate stream.\n\n     inflateBack() uses two subroutines supplied by the caller that are then\n   called by inflateBack() for input and output.  inflateBack() calls those\n   routines until it reads a complete deflate stream and writes out all of the\n   uncompressed data, or until it encounters an error.  The function's\n   parameters and return types are defined above in the in_func and out_func\n   typedefs.  inflateBack() will call in(in_desc, &buf) which should return the\n   number of bytes of provided input, and a pointer to that input in buf.  If\n   there is no input available, in() must return zero--buf is ignored in that\n   case--and inflateBack() will return a buffer error.  inflateBack() will call\n   out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].  out()\n   should return zero on success, or non-zero on failure.  If out() returns\n   non-zero, inflateBack() will return with an error.  Neither in() nor out()\n   are permitted to change the contents of the window provided to\n   inflateBackInit(), which is also the buffer that out() uses to write from.\n   The length written by out() will be at most the window size.  Any non-zero\n   amount of input may be provided by in().\n\n     For convenience, inflateBack() can be provided input on the first call by\n   setting strm->next_in and strm->avail_in.  If that input is exhausted, then\n   in() will be called.  Therefore strm->next_in must be initialized before\n   calling inflateBack().  If strm->next_in is Z_NULL, then in() will be called\n   immediately for input.  If strm->next_in is not Z_NULL, then strm->avail_in\n   must also be initialized, and then if strm->avail_in is not zero, input will\n   initially be taken from strm->next_in[0 ..  strm->avail_in - 1].\n\n     The in_desc and out_desc parameters of inflateBack() is passed as the\n   first parameter of in() and out() respectively when they are called.  These\n   descriptors can be optionally used to pass any information that the caller-\n   supplied in() and out() functions need to do their job.\n\n     On return, inflateBack() will set strm->next_in and strm->avail_in to\n   pass back any unused input that was provided by the last in() call.  The\n   return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR\n   if in() or out() returned an error, Z_DATA_ERROR if there was a format error\n   in the deflate stream (in which case strm->msg is set to indicate the nature\n   of the error), or Z_STREAM_ERROR if the stream was not properly initialized.\n   In the case of Z_BUF_ERROR, an input or output error can be distinguished\n   using strm->next_in which will be Z_NULL only if in() returned an error.  If\n   strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning\n   non-zero.  (in() will always be called before out(), so strm->next_in is\n   assured to be defined if out() returns non-zero.) Note that inflateBack()\n   cannot return Z_OK.\n*/\n\nZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));\n/*\n     All memory allocated by inflateBackInit() is freed.\n\n     inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream\n   state was inconsistent.\n*/\n\nZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));\n/* Return flags indicating compile-time options.\n\n    Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:\n     1.0: size of uInt\n     3.2: size of uLong\n     5.4: size of voidpf (pointer)\n     7.6: size of z_off_t\n\n    Compiler, assembler, and debug options:\n     8: DEBUG\n     9: ASMV or ASMINF -- use ASM code\n     10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention\n     11: 0 (reserved)\n\n    One-time table building (smaller code, but not thread-safe if true):\n     12: BUILDFIXED -- build static block decoding tables when needed\n     13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed\n     14,15: 0 (reserved)\n\n    Library content (indicates missing functionality):\n     16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking\n                          deflate code when not needed)\n     17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect\n                    and decode gzip streams (to avoid linking crc code)\n     18-19: 0 (reserved)\n\n    Operation variations (changes in library functionality):\n     20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate\n     21: FASTEST -- deflate algorithm with only one, lowest compression level\n     22,23: 0 (reserved)\n\n    The sprintf variant used by gzprintf (zero is best):\n     24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format\n     25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!\n     26: 0 = returns value, 1 = void -- 1 means inferred string length returned\n\n    Remainder:\n     27-31: 0 (reserved)\n */\n\n\n                        /* utility functions */\n\n/*\n     The following utility functions are implemented on top of the basic\n   stream-oriented functions.  To simplify the interface, some default options\n   are assumed (compression level and memory usage, standard memory allocation\n   functions).  The source code of these utility functions can be modified if\n   you need special options.\n*/\n\nZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,\n                                 const Bytef *source, uLong sourceLen));\n/*\n     Compresses the source buffer into the destination buffer.  sourceLen is\n   the byte length of the source buffer.  Upon entry, destLen is the total size\n   of the destination buffer, which must be at least the value returned by\n   compressBound(sourceLen).  Upon exit, destLen is the actual size of the\n   compressed buffer.\n\n     compress returns Z_OK if success, Z_MEM_ERROR if there was not\n   enough memory, Z_BUF_ERROR if there was not enough room in the output\n   buffer.\n*/\n\nZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,\n                                  const Bytef *source, uLong sourceLen,\n                                  int level));\n/*\n     Compresses the source buffer into the destination buffer.  The level\n   parameter has the same meaning as in deflateInit.  sourceLen is the byte\n   length of the source buffer.  Upon entry, destLen is the total size of the\n   destination buffer, which must be at least the value returned by\n   compressBound(sourceLen).  Upon exit, destLen is the actual size of the\n   compressed buffer.\n\n     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough\n   memory, Z_BUF_ERROR if there was not enough room in the output buffer,\n   Z_STREAM_ERROR if the level parameter is invalid.\n*/\n\nZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));\n/*\n     compressBound() returns an upper bound on the compressed size after\n   compress() or compress2() on sourceLen bytes.  It would be used before a\n   compress() or compress2() call to allocate the destination buffer.\n*/\n\nZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,\n                                   const Bytef *source, uLong sourceLen));\n/*\n     Decompresses the source buffer into the destination buffer.  sourceLen is\n   the byte length of the source buffer.  Upon entry, destLen is the total size\n   of the destination buffer, which must be large enough to hold the entire\n   uncompressed data.  (The size of the uncompressed data must have been saved\n   previously by the compressor and transmitted to the decompressor by some\n   mechanism outside the scope of this compression library.) Upon exit, destLen\n   is the actual size of the uncompressed buffer.\n\n     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not\n   enough memory, Z_BUF_ERROR if there was not enough room in the output\n   buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.\n*/\n\n\n                        /* gzip file access functions */\n\n/*\n     This library supports reading and writing files in gzip (.gz) format with\n   an interface similar to that of stdio, using the functions that start with\n   \"gz\".  The gzip format is different from the zlib format.  gzip is a gzip\n   wrapper, documented in RFC 1952, wrapped around a deflate stream.\n*/\n\ntypedef voidp gzFile;       /* opaque gzip file descriptor */\n\n/*\nZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));\n\n     Opens a gzip (.gz) file for reading or writing.  The mode parameter is as\n   in fopen (\"rb\" or \"wb\") but can also include a compression level (\"wb9\") or\n   a strategy: 'f' for filtered data as in \"wb6f\", 'h' for Huffman-only\n   compression as in \"wb1h\", 'R' for run-length encoding as in \"wb1R\", or 'F'\n   for fixed code compression as in \"wb9F\".  (See the description of\n   deflateInit2 for more information about the strategy parameter.) Also \"a\"\n   can be used instead of \"w\" to request that the gzip stream that will be\n   written be appended to the file.  \"+\" will result in an error, since reading\n   and writing to the same gzip file is not supported.\n\n     gzopen can be used to read a file which is not in gzip format; in this\n   case gzread will directly read from the file without decompression.\n\n     gzopen returns NULL if the file could not be opened, if there was\n   insufficient memory to allocate the gzFile state, or if an invalid mode was\n   specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).\n   errno can be checked to determine if the reason gzopen failed was that the\n   file could not be opened.\n*/\n\nZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));\n/*\n     gzdopen associates a gzFile with the file descriptor fd.  File descriptors\n   are obtained from calls like open, dup, creat, pipe or fileno (if the file\n   has been previously opened with fopen).  The mode parameter is as in gzopen.\n\n     The next call of gzclose on the returned gzFile will also close the file\n   descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor\n   fd.  If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,\n   mode);.  The duplicated descriptor should be saved to avoid a leak, since\n   gzdopen does not close fd if it fails.\n\n     gzdopen returns NULL if there was insufficient memory to allocate the\n   gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not\n   provided, or '+' was provided), or if fd is -1.  The file descriptor is not\n   used until the next gz* read, write, seek, or close operation, so gzdopen\n   will not detect if fd is invalid (unless fd is -1).\n*/\n\nZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));\n/*\n     Set the internal buffer size used by this library's functions.  The\n   default buffer size is 8192 bytes.  This function must be called after\n   gzopen() or gzdopen(), and before any other calls that read or write the\n   file.  The buffer memory allocation is always deferred to the first read or\n   write.  Two buffers are allocated, either both of the specified size when\n   writing, or one of the specified size and the other twice that size when\n   reading.  A larger buffer size of, for example, 64K or 128K bytes will\n   noticeably increase the speed of decompression (reading).\n\n     The new buffer size also affects the maximum length for gzprintf().\n\n     gzbuffer() returns 0 on success, or -1 on failure, such as being called\n   too late.\n*/\n\nZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));\n/*\n     Dynamically update the compression level or strategy.  See the description\n   of deflateInit2 for the meaning of these parameters.\n\n     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not\n   opened for writing.\n*/\n\nZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));\n/*\n     Reads the given number of uncompressed bytes from the compressed file.  If\n   the input file was not in gzip format, gzread copies the given number of\n   bytes into the buffer.\n\n     After reaching the end of a gzip stream in the input, gzread will continue\n   to read, looking for another gzip stream, or failing that, reading the rest\n   of the input file directly without decompression.  The entire input file\n   will be read if gzread is called until it returns less than the requested\n   len.\n\n     gzread returns the number of uncompressed bytes actually read, less than\n   len for end of file, or -1 for error.\n*/\n\nZEXTERN int ZEXPORT gzwrite OF((gzFile file,\n                                voidpc buf, unsigned len));\n/*\n     Writes the given number of uncompressed bytes into the compressed file.\n   gzwrite returns the number of uncompressed bytes written or 0 in case of\n   error.\n*/\n\nZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));\n/*\n     Converts, formats, and writes the arguments to the compressed file under\n   control of the format string, as in fprintf.  gzprintf returns the number of\n   uncompressed bytes actually written, or 0 in case of error.  The number of\n   uncompressed bytes written is limited to 8191, or one less than the buffer\n   size given to gzbuffer().  The caller should assure that this limit is not\n   exceeded.  If it is exceeded, then gzprintf() will return an error (0) with\n   nothing written.  In this case, there may also be a buffer overflow with\n   unpredictable consequences, which is possible only if zlib was compiled with\n   the insecure functions sprintf() or vsprintf() because the secure snprintf()\n   or vsnprintf() functions were not available.  This can be determined using\n   zlibCompileFlags().\n*/\n\nZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));\n/*\n     Writes the given null-terminated string to the compressed file, excluding\n   the terminating null character.\n\n     gzputs returns the number of characters written, or -1 in case of error.\n*/\n\nZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));\n/*\n     Reads bytes from the compressed file until len-1 characters are read, or a\n   newline character is read and transferred to buf, or an end-of-file\n   condition is encountered.  If any characters are read or if len == 1, the\n   string is terminated with a null character.  If no characters are read due\n   to an end-of-file or len < 1, then the buffer is left untouched.\n\n     gzgets returns buf which is a null-terminated string, or it returns NULL\n   for end-of-file or in case of error.  If there was an error, the contents at\n   buf are indeterminate.\n*/\n\nZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));\n/*\n     Writes c, converted to an unsigned char, into the compressed file.  gzputc\n   returns the value that was written, or -1 in case of error.\n*/\n\nZEXTERN int ZEXPORT gzgetc OF((gzFile file));\n/*\n     Reads one byte from the compressed file.  gzgetc returns this byte or -1\n   in case of end of file or error.\n*/\n\nZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));\n/*\n     Push one character back onto the stream to be read as the first character\n   on the next read.  At least one character of push-back is allowed.\n   gzungetc() returns the character pushed, or -1 on failure.  gzungetc() will\n   fail if c is -1, and may fail if a character has been pushed but not read\n   yet.  If gzungetc is used immediately after gzopen or gzdopen, at least the\n   output buffer size of pushed characters is allowed.  (See gzbuffer above.)\n   The pushed character will be discarded if the stream is repositioned with\n   gzseek() or gzrewind().\n*/\n\nZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));\n/*\n     Flushes all pending output into the compressed file.  The parameter flush\n   is as in the deflate() function.  The return value is the zlib error number\n   (see function gzerror below).  gzflush is only permitted when writing.\n\n     If the flush parameter is Z_FINISH, the remaining data is written and the\n   gzip stream is completed in the output.  If gzwrite() is called again, a new\n   gzip stream will be started in the output.  gzread() is able to read such\n   concatented gzip streams.\n\n     gzflush should be called only when strictly necessary because it will\n   degrade compression if called too often.\n*/\n\n/*\nZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,\n                                   z_off_t offset, int whence));\n\n     Sets the starting position for the next gzread or gzwrite on the given\n   compressed file.  The offset represents a number of bytes in the\n   uncompressed data stream.  The whence parameter is defined as in lseek(2);\n   the value SEEK_END is not supported.\n\n     If the file is opened for reading, this function is emulated but can be\n   extremely slow.  If the file is opened for writing, only forward seeks are\n   supported; gzseek then compresses a sequence of zeroes up to the new\n   starting position.\n\n     gzseek returns the resulting offset location as measured in bytes from\n   the beginning of the uncompressed stream, or -1 in case of error, in\n   particular if the file is opened for writing and the new starting position\n   would be before the current position.\n*/\n\nZEXTERN int ZEXPORT    gzrewind OF((gzFile file));\n/*\n     Rewinds the given file. This function is supported only for reading.\n\n     gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)\n*/\n\n/*\nZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));\n\n     Returns the starting position for the next gzread or gzwrite on the given\n   compressed file.  This position represents a number of bytes in the\n   uncompressed data stream, and is zero when starting, even if appending or\n   reading a gzip stream from the middle of a file using gzdopen().\n\n     gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)\n*/\n\n/*\nZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));\n\n     Returns the current offset in the file being read or written.  This offset\n   includes the count of bytes that precede the gzip stream, for example when\n   appending or when using gzdopen() for reading.  When reading, the offset\n   does not include as yet unused buffered input.  This information can be used\n   for a progress indicator.  On error, gzoffset() returns -1.\n*/\n\nZEXTERN int ZEXPORT gzeof OF((gzFile file));\n/*\n     Returns true (1) if the end-of-file indicator has been set while reading,\n   false (0) otherwise.  Note that the end-of-file indicator is set only if the\n   read tried to go past the end of the input, but came up short.  Therefore,\n   just like feof(), gzeof() may return false even if there is no more data to\n   read, in the event that the last read request was for the exact number of\n   bytes remaining in the input file.  This will happen if the input file size\n   is an exact multiple of the buffer size.\n\n     If gzeof() returns true, then the read functions will return no more data,\n   unless the end-of-file indicator is reset by gzclearerr() and the input file\n   has grown since the previous end of file was detected.\n*/\n\nZEXTERN int ZEXPORT gzdirect OF((gzFile file));\n/*\n     Returns true (1) if file is being copied directly while reading, or false\n   (0) if file is a gzip stream being decompressed.  This state can change from\n   false to true while reading the input file if the end of a gzip stream is\n   reached, but is followed by data that is not another gzip stream.\n\n     If the input file is empty, gzdirect() will return true, since the input\n   does not contain a gzip stream.\n\n     If gzdirect() is used immediately after gzopen() or gzdopen() it will\n   cause buffers to be allocated to allow reading the file to determine if it\n   is a gzip file.  Therefore if gzbuffer() is used, it should be called before\n   gzdirect().\n*/\n\nZEXTERN int ZEXPORT    gzclose OF((gzFile file));\n/*\n     Flushes all pending output if necessary, closes the compressed file and\n   deallocates the (de)compression state.  Note that once file is closed, you\n   cannot call gzerror with file, since its structures have been deallocated.\n   gzclose must not be called more than once on the same file, just as free\n   must not be called more than once on the same allocation.\n\n     gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a\n   file operation error, or Z_OK on success.\n*/\n\nZEXTERN int ZEXPORT gzclose_r OF((gzFile file));\nZEXTERN int ZEXPORT gzclose_w OF((gzFile file));\n/*\n     Same as gzclose(), but gzclose_r() is only for use when reading, and\n   gzclose_w() is only for use when writing or appending.  The advantage to\n   using these instead of gzclose() is that they avoid linking in zlib\n   compression or decompression code that is not used when only reading or only\n   writing respectively.  If gzclose() is used, then both compression and\n   decompression code will be included the application when linking to a static\n   zlib library.\n*/\n\nZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));\n/*\n     Returns the error message for the last error which occurred on the given\n   compressed file.  errnum is set to zlib error number.  If an error occurred\n   in the file system and not in the compression library, errnum is set to\n   Z_ERRNO and the application may consult errno to get the exact error code.\n\n     The application must not modify the returned string.  Future calls to\n   this function may invalidate the previously returned string.  If file is\n   closed, then the string previously returned by gzerror will no longer be\n   available.\n\n     gzerror() should be used to distinguish errors from end-of-file for those\n   functions above that do not distinguish those cases in their return values.\n*/\n\nZEXTERN void ZEXPORT gzclearerr OF((gzFile file));\n/*\n     Clears the error and end-of-file flags for file.  This is analogous to the\n   clearerr() function in stdio.  This is useful for continuing to read a gzip\n   file that is being written concurrently.\n*/\n\n\n                        /* checksum functions */\n\n/*\n     These functions are not related to compression but are exported\n   anyway because they might be useful in applications using the compression\n   library.\n*/\n\nZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));\n/*\n     Update a running Adler-32 checksum with the bytes buf[0..len-1] and\n   return the updated checksum.  If buf is Z_NULL, this function returns the\n   required initial value for the checksum.\n\n     An Adler-32 checksum is almost as reliable as a CRC32 but can be computed\n   much faster.\n\n   Usage example:\n\n     uLong adler = adler32(0L, Z_NULL, 0);\n\n     while (read_buffer(buffer, length) != EOF) {\n       adler = adler32(adler, buffer, length);\n     }\n     if (adler != original_adler) error();\n*/\n\n/*\nZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,\n                                          z_off_t len2));\n\n     Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1\n   and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for\n   each, adler1 and adler2.  adler32_combine() returns the Adler-32 checksum of\n   seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.\n*/\n\nZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));\n/*\n     Update a running CRC-32 with the bytes buf[0..len-1] and return the\n   updated CRC-32.  If buf is Z_NULL, this function returns the required\n   initial value for the for the crc.  Pre- and post-conditioning (one's\n   complement) is performed within this function so it shouldn't be done by the\n   application.\n\n   Usage example:\n\n     uLong crc = crc32(0L, Z_NULL, 0);\n\n     while (read_buffer(buffer, length) != EOF) {\n       crc = crc32(crc, buffer, length);\n     }\n     if (crc != original_crc) error();\n*/\n\n/*\nZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));\n\n     Combine two CRC-32 check values into one.  For two sequences of bytes,\n   seq1 and seq2 with lengths len1 and len2, CRC-32 check values were\n   calculated for each, crc1 and crc2.  crc32_combine() returns the CRC-32\n   check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and\n   len2.\n*/\n\n\n                        /* various hacks, don't look :) */\n\n/* deflateInit and inflateInit are macros to allow checking the zlib version\n * and the compiler's view of z_stream:\n */\nZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,\n                                     const char *version, int stream_size));\nZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,\n                                     const char *version, int stream_size));\nZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,\n                                      int windowBits, int memLevel,\n                                      int strategy, const char *version,\n                                      int stream_size));\nZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,\n                                      const char *version, int stream_size));\nZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,\n                                         unsigned char FAR *window,\n                                         const char *version,\n                                         int stream_size));\n#define deflateInit(strm, level) \\\n        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))\n#define inflateInit(strm) \\\n        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))\n#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \\\n        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\\\n                      (strategy),           ZLIB_VERSION, sizeof(z_stream))\n#define inflateInit2(strm, windowBits) \\\n        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))\n#define inflateBackInit(strm, windowBits, window) \\\n        inflateBackInit_((strm), (windowBits), (window), \\\n                                            ZLIB_VERSION, sizeof(z_stream))\n\n/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or\n * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if\n * both are true, the application gets the *64 functions, and the regular\n * functions are changed to 64 bits) -- in case these are set on systems\n * without large file support, _LFS64_LARGEFILE must also be true\n */\n#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0\n   ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));\n   ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));\n   ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));\n   ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));\n   ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));\n   ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));\n#endif\n\n#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0\n#  define gzopen gzopen64\n#  define gzseek gzseek64\n#  define gztell gztell64\n#  define gzoffset gzoffset64\n#  define adler32_combine adler32_combine64\n#  define crc32_combine crc32_combine64\n#  ifdef _LARGEFILE64_SOURCE\n     ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));\n     ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));\n     ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));\n     ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));\n     ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));\n     ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));\n#  endif\n#else\n   ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));\n   ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));\n   ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));\n   ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));\n   ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));\n   ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));\n#endif\n\n/* hack for buggy compilers */\n#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)\n    struct internal_state {int dummy;};\n#endif\n\n/* undocumented functions */\nZEXTERN const char   * ZEXPORT zError           OF((int));\nZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp));\nZEXTERN const uLongf * ZEXPORT get_crc_table    OF((void));\nZEXTERN int            ZEXPORT inflateUndermine OF((z_streamp, int));\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* ZLIB_H */\n"},{"id":16737,"name":"zutil.h","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* zutil.h -- internal interface and configuration of the compression library\n * Copyright (C) 1995-2010 Jean-loup Gailly.\n * For conditions of distribution and use, see copyright notice in zlib.h\n */\n\n/* WARNING: this file should *not* be used by applications. It is\n   part of the implementation of the compression library and is\n   subject to change. Applications should only use zlib.h.\n */\n\n#ifndef ZUTIL_H\n#define ZUTIL_H\n\n#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)\n#  define ZLIB_INTERNAL __attribute__((visibility (\"hidden\")))\n#else\n#  define ZLIB_INTERNAL\n#endif\n\n#include \"zlib.h\"\n\n#ifdef STDC\n#  if !(defined(_WIN32_WCE) && defined(_MSC_VER))\n#    include <stddef.h>\n#  endif\n#  include <string.h>\n#  include <stdlib.h>\n#endif\n\n#ifndef local\n#  define local static\n#endif\n/* compile with -Dlocal if your debugger can't find static symbols */\n\ntypedef unsigned char  uch;\ntypedef uch FAR uchf;\ntypedef unsigned short ush;\ntypedef ush FAR ushf;\ntypedef unsigned long  ulg;\n\nextern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */\n/* (size given to avoid silly warnings with Visual C++) */\n\n#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]\n\n#define ERR_RETURN(strm,err) \\\n  return (strm->msg = (char*)ERR_MSG(err), (err))\n/* To be used only when the state is known to be valid */\n\n        /* common constants */\n\n#ifndef DEF_WBITS\n#  define DEF_WBITS MAX_WBITS\n#endif\n/* default windowBits for decompression. MAX_WBITS is for compression only */\n\n#if MAX_MEM_LEVEL >= 8\n#  define DEF_MEM_LEVEL 8\n#else\n#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL\n#endif\n/* default memLevel */\n\n#define STORED_BLOCK 0\n#define STATIC_TREES 1\n#define DYN_TREES    2\n/* The three kinds of block type */\n\n#define MIN_MATCH  3\n#define MAX_MATCH  258\n/* The minimum and maximum match lengths */\n\n#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */\n\n        /* target dependencies */\n\n#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))\n#  define OS_CODE  0x00\n#  if defined(__TURBOC__) || defined(__BORLANDC__)\n#    if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))\n       /* Allow compilation with ANSI keywords only enabled */\n       void _Cdecl farfree( void *block );\n       void *_Cdecl farmalloc( unsigned long nbytes );\n#    else\n#      include <alloc.h>\n#    endif\n#  else /* MSC or DJGPP */\n#    include <malloc.h>\n#  endif\n#endif\n\n#ifdef AMIGA\n#  define OS_CODE  0x01\n#endif\n\n#if defined(VAXC) || defined(VMS)\n#  define OS_CODE  0x02\n#  define F_OPEN(name, mode) \\\n     fopen((name), (mode), \"mbc=60\", \"ctx=stm\", \"rfm=fix\", \"mrs=512\")\n#endif\n\n#if defined(ATARI) || defined(atarist)\n#  define OS_CODE  0x05\n#endif\n\n#ifdef OS2\n#  define OS_CODE  0x06\n#  ifdef M_I86\n#    include <malloc.h>\n#  endif\n#endif\n\n#if defined(MACOS) || defined(TARGET_OS_MAC)\n#  define OS_CODE  0x07\n#  if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os\n#    include <unix.h> /* for fdopen */\n#  else\n#    ifndef fdopen\n#      define fdopen(fd,mode) NULL /* No fdopen() */\n#    endif\n#  endif\n#endif\n\n#ifdef TOPS20\n#  define OS_CODE  0x0a\n#endif\n\n#ifdef WIN32\n#  ifndef __CYGWIN__  /* Cygwin is Unix, not Win32 */\n#    define OS_CODE  0x0b\n#  endif\n#endif\n\n#ifdef __50SERIES /* Prime/PRIMOS */\n#  define OS_CODE  0x0f\n#endif\n\n#if defined(_BEOS_) || defined(RISCOS)\n#  define fdopen(fd,mode) NULL /* No fdopen() */\n#endif\n\n#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX\n#  if defined(_WIN32_WCE)\n#    define fdopen(fd,mode) NULL /* No fdopen() */\n#    ifndef _PTRDIFF_T_DEFINED\n       typedef int ptrdiff_t;\n#      define _PTRDIFF_T_DEFINED\n#    endif\n#  else\n#    define fdopen(fd,type)  _fdopen(fd,type)\n#  endif\n#endif\n\n#if defined(__BORLANDC__)\n  #pragma warn -8004\n  #pragma warn -8008\n  #pragma warn -8066\n#endif\n\n/* provide prototypes for these when building zlib without LFS */\n#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0\n    ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));\n    ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));\n#endif\n\n        /* common defaults */\n\n#ifndef OS_CODE\n#  define OS_CODE  0x03  /* assume Unix */\n#endif\n\n#ifndef F_OPEN\n#  define F_OPEN(name, mode) fopen((name), (mode))\n#endif\n\n         /* functions */\n\n#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)\n#  ifndef HAVE_VSNPRINTF\n#    define HAVE_VSNPRINTF\n#  endif\n#endif\n#if defined(__CYGWIN__)\n#  ifndef HAVE_VSNPRINTF\n#    define HAVE_VSNPRINTF\n#  endif\n#endif\n#ifndef HAVE_VSNPRINTF\n#  ifdef MSDOS\n     /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),\n        but for now we just assume it doesn't. */\n#    define NO_vsnprintf\n#  endif\n#  ifdef __TURBOC__\n#    define NO_vsnprintf\n#  endif\n#  ifdef WIN32\n     /* In Win32, vsnprintf is available as the \"non-ANSI\" _vsnprintf. */\n#    if !defined(vsnprintf) && !defined(NO_vsnprintf)\n#      if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )\n#         define vsnprintf _vsnprintf\n#      endif\n#    endif\n#  endif\n#  ifdef __SASC\n#    define NO_vsnprintf\n#  endif\n#endif\n#ifdef VMS\n#  define NO_vsnprintf\n#endif\n\n#if defined(pyr)\n#  define NO_MEMCPY\n#endif\n#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)\n /* Use our own functions for small and medium model with MSC <= 5.0.\n  * You may have to use the same strategy for Borland C (untested).\n  * The __SC__ check is for Symantec.\n  */\n#  define NO_MEMCPY\n#endif\n#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)\n#  define HAVE_MEMCPY\n#endif\n#ifdef HAVE_MEMCPY\n#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */\n#    define zmemcpy _fmemcpy\n#    define zmemcmp _fmemcmp\n#    define zmemzero(dest, len) _fmemset(dest, 0, len)\n#  else\n#    define zmemcpy memcpy\n#    define zmemcmp memcmp\n#    define zmemzero(dest, len) memset(dest, 0, len)\n#  endif\n#else\n   void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));\n   int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));\n   void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));\n#endif\n\n/* Diagnostic functions */\n#ifdef DEBUG\n#  include <stdio.h>\n   extern int ZLIB_INTERNAL z_verbose;\n   extern void ZLIB_INTERNAL z_error OF((char *m));\n#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}\n#  define Trace(x) {if (z_verbose>=0) fprintf x ;}\n#  define Tracev(x) {if (z_verbose>0) fprintf x ;}\n#  define Tracevv(x) {if (z_verbose>1) fprintf x ;}\n#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}\n#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}\n#else\n#  define Assert(cond,msg)\n#  define Trace(x)\n#  define Tracev(x)\n#  define Tracevv(x)\n#  define Tracec(c,x)\n#  define Tracecv(c,x)\n#endif\n\n\nvoidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,\n                        unsigned size));\nvoid ZLIB_INTERNAL zcfree  OF((voidpf opaque, voidpf ptr));\n\n#define ZALLOC(strm, items, size) \\\n           (*((strm)->zalloc))((strm)->opaque, (items), (size))\n#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))\n#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}\n\n#endif /* ZUTIL_H */\n"},{"id":16738,"name":"inflate.h","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* inflate.h -- internal inflate state definition\n * Copyright (C) 1995-2009 Mark Adler\n * For conditions of distribution and use, see copyright notice in zlib.h\n */\n\n/* WARNING: this file should *not* be used by applications. It is\n   part of the implementation of the compression library and is\n   subject to change. Applications should only use zlib.h.\n */\n\n/* define NO_GZIP when compiling if you want to disable gzip header and\n   trailer decoding by inflate().  NO_GZIP would be used to avoid linking in\n   the crc code when it is not needed.  For shared libraries, gzip decoding\n   should be left enabled. */\n#ifndef NO_GZIP\n#  define GUNZIP\n#endif\n\n/* Possible inflate modes between inflate() calls */\ntypedef enum {\n    HEAD,       /* i: waiting for magic header */\n    FLAGS,      /* i: waiting for method and flags (gzip) */\n    TIME,       /* i: waiting for modification time (gzip) */\n    OS,         /* i: waiting for extra flags and operating system (gzip) */\n    EXLEN,      /* i: waiting for extra length (gzip) */\n    EXTRA,      /* i: waiting for extra bytes (gzip) */\n    NAME,       /* i: waiting for end of file name (gzip) */\n    COMMENT,    /* i: waiting for end of comment (gzip) */\n    HCRC,       /* i: waiting for header crc (gzip) */\n    DICTID,     /* i: waiting for dictionary check value */\n    DICT,       /* waiting for inflateSetDictionary() call */\n        TYPE,       /* i: waiting for type bits, including last-flag bit */\n        TYPEDO,     /* i: same, but skip check to exit inflate on new block */\n        STORED,     /* i: waiting for stored size (length and complement) */\n        COPY_,      /* i/o: same as COPY below, but only first time in */\n        COPY,       /* i/o: waiting for input or output to copy stored block */\n        TABLE,      /* i: waiting for dynamic block table lengths */\n        LENLENS,    /* i: waiting for code length code lengths */\n        CODELENS,   /* i: waiting for length/lit and distance code lengths */\n            LEN_,       /* i: same as LEN below, but only first time in */\n            LEN,        /* i: waiting for length/lit/eob code */\n            LENEXT,     /* i: waiting for length extra bits */\n            DIST,       /* i: waiting for distance code */\n            DISTEXT,    /* i: waiting for distance extra bits */\n            MATCH,      /* o: waiting for output space to copy string */\n            LIT,        /* o: waiting for output space to write literal */\n    CHECK,      /* i: waiting for 32-bit check value */\n    LENGTH,     /* i: waiting for 32-bit length (gzip) */\n    DONE,       /* finished check, done -- remain here until reset */\n    BAD,        /* got a data error -- remain here until reset */\n    MEM,        /* got an inflate() memory error -- remain here until reset */\n    SYNC        /* looking for synchronization bytes to restart inflate() */\n} inflate_mode;\n\n/*\n    State transitions between above modes -\n\n    (most modes can go to BAD or MEM on error -- not shown for clarity)\n\n    Process header:\n        HEAD -> (gzip) or (zlib) or (raw)\n        (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT ->\n                  HCRC -> TYPE\n        (zlib) -> DICTID or TYPE\n        DICTID -> DICT -> TYPE\n        (raw) -> TYPEDO\n    Read deflate blocks:\n            TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK\n            STORED -> COPY_ -> COPY -> TYPE\n            TABLE -> LENLENS -> CODELENS -> LEN_\n            LEN_ -> LEN\n    Read deflate codes in fixed or dynamic block:\n                LEN -> LENEXT or LIT or TYPE\n                LENEXT -> DIST -> DISTEXT -> MATCH -> LEN\n                LIT -> LEN\n    Process trailer:\n        CHECK -> LENGTH -> DONE\n */\n\n/* state maintained between inflate() calls.  Approximately 10K bytes. */\nstruct inflate_state {\n    inflate_mode mode;          /* current inflate mode */\n    int last;                   /* true if processing last block */\n    int wrap;                   /* bit 0 true for zlib, bit 1 true for gzip */\n    int havedict;               /* true if dictionary provided */\n    int flags;                  /* gzip header method and flags (0 if zlib) */\n    unsigned dmax;              /* zlib header max distance (INFLATE_STRICT) */\n    unsigned long check;        /* protected copy of check value */\n    unsigned long total;        /* protected copy of output count */\n    gz_headerp head;            /* where to save gzip header information */\n        /* sliding window */\n    unsigned wbits;             /* log base 2 of requested window size */\n    unsigned wsize;             /* window size or zero if not using window */\n    unsigned whave;             /* valid bytes in the window */\n    unsigned wnext;             /* window write index */\n    unsigned char FAR *window;  /* allocated sliding window, if needed */\n        /* bit accumulator */\n    unsigned long hold;         /* input bit accumulator */\n    unsigned bits;              /* number of bits in \"in\" */\n        /* for string and stored block copying */\n    unsigned length;            /* literal or length of data to copy */\n    unsigned offset;            /* distance back to copy string from */\n        /* for table and code decoding */\n    unsigned extra;             /* extra bits needed */\n        /* fixed and dynamic code tables */\n    code const FAR *lencode;    /* starting table for length/literal codes */\n    code const FAR *distcode;   /* starting table for distance codes */\n    unsigned lenbits;           /* index bits for lencode */\n    unsigned distbits;          /* index bits for distcode */\n        /* dynamic table building */\n    unsigned ncode;             /* number of code length code lengths */\n    unsigned nlen;              /* number of length code lengths */\n    unsigned ndist;             /* number of distance code lengths */\n    unsigned have;              /* number of code lengths in lens[] */\n    code FAR *next;             /* next available space in codes[] */\n    unsigned short lens[320];   /* temporary storage for code lengths */\n    unsigned short work[288];   /* work area for code table building */\n    code codes[ENOUGH];         /* space for code tables */\n    int sane;                   /* if false, allow invalid distance too far */\n    int back;                   /* bits back of last unprocessed length/lit */\n    unsigned was;               /* initial length of match */\n};\n"},{"col":4,"comment":"null","endLoc":157,"header":"def _display_world_coords(self, x, y)","id":16739,"name":"_display_world_coords","nodeType":"Function","startLoc":129,"text":"def _display_world_coords(self, x, y):\n\n        if not self._drawn:\n            return \"\"\n\n        if self._display_coords_index == -1:\n            return f\"{x} {y} (pixel)\"\n\n        pixel = np.array([x, y])\n\n        coords = self._all_coords[self._display_coords_index]\n\n        world = coords._transform.transform(np.array([pixel]))[0]\n\n        coord_strings = []\n        for idx, coord in enumerate(coords):\n            if coord.coord_index is not None:\n                coord_strings.append(coord.format_coord(world[coord.coord_index], format='ascii'))\n\n        coord_string = ' '.join(coord_strings)\n\n        if self._display_coords_index == 0:\n            system = \"world\"\n        else:\n            system = f\"world, overlay {self._display_coords_index}\"\n\n        coord_string = f\"{coord_string} ({system})\"\n\n        return coord_string"},{"id":16740,"name":"eval_y.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"/* A Bison parser, made by GNU Bison 3.7.4.  */\n\n/* Bison implementation for Yacc-like parsers in C\n\n   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,\n   Inc.\n\n   This program is free software: you can redistribute it and/or modify\n   it under the terms of the GNU General Public License as published by\n   the Free Software Foundation, either version 3 of the License, or\n   (at your option) any later version.\n\n   This program is distributed in the hope that it will be useful,\n   but WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n   GNU General Public License for more details.\n\n   You should have received a copy of the GNU General Public License\n   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */\n\n/* As a special exception, you may create a larger work that contains\n   part or all of the Bison parser skeleton and distribute that work\n   under terms of your choice, so long as that work isn't itself a\n   parser generator using the skeleton or a modified version thereof\n   as a parser skeleton.  Alternatively, if you modify or redistribute\n   the parser skeleton itself, you may (at your option) remove this\n   special exception, which will cause the skeleton and the resulting\n   Bison output files to be licensed under the GNU General Public\n   License without this special exception.\n\n   This special exception was added by the Free Software Foundation in\n   version 2.2 of Bison.  */\n\n/* C LALR(1) parser skeleton written by Richard Stallman, by\n   simplifying the original so-called \"semantic\" parser.  */\n\n/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,\n   especially those whose name start with FF_ or ff_.  They are\n   private implementation details that can be changed or removed.  */\n\n/* All symbols defined below should begin with ff or FF, to avoid\n   infringing on user name space.  This should be done even for local\n   variables, as they might otherwise be expanded by user macros.\n   There are some unavoidable exceptions within include files to\n   define necessary library symbols; they are noted \"INFRINGES ON\n   USER NAME SPACE\" below.  */\n\n/* Identify Bison output, and Bison version.  */\n#define FFBISON 30704\n\n/* Bison version string.  */\n#define FFBISON_VERSION \"3.7.4\"\n\n/* Skeleton name.  */\n#define FFSKELETON_NAME \"yacc.c\"\n\n/* Pure parsers.  */\n#define FFPURE 0\n\n/* Push parsers.  */\n#define FFPUSH 0\n\n/* Pull parsers.  */\n#define FFPULL 1\n\n\n\n\n/* First part of user prologue.  */\n#line 1 \"eval.y\"\n\n/************************************************************************/\n/*                                                                      */\n/*                       CFITSIO Lexical Parser                         */\n/*                                                                      */\n/* This file is one of 3 files containing code which parses an          */\n/* arithmetic expression and evaluates it in the context of an input    */\n/* FITS file table extension.  The CFITSIO lexical parser is divided    */\n/* into the following 3 parts/files: the CFITSIO \"front-end\",           */\n/* eval_f.c, contains the interface between the user/CFITSIO and the    */\n/* real core of the parser; the FLEX interpreter, eval_l.c, takes the   */\n/* input string and parses it into tokens and identifies the FITS       */\n/* information required to evaluate the expression (ie, keywords and    */\n/* columns); and, the BISON grammar and evaluation routines, eval_y.c,  */\n/* receives the FLEX output and determines and performs the actual      */\n/* operations.  The files eval_l.c and eval_y.c are produced from       */\n/* running flex and bison on the files eval.l and eval.y, respectively. */\n/* (flex and bison are available from any GNU archive: see www.gnu.org) */\n/*                                                                      */\n/* The grammar rules, rather than evaluating the expression in situ,    */\n/* builds a tree, or Nodal, structure mapping out the order of          */\n/* operations and expression dependencies.  This \"compilation\" process  */\n/* allows for much faster processing of multiple rows.  This technique  */\n/* was developed by Uwe Lammers of the XMM Science Analysis System,     */\n/* although the CFITSIO implementation is entirely code original.       */\n/*                                                                      */\n/*                                                                      */\n/* Modification History:                                                */\n/*                                                                      */\n/*   Kent Blackburn      c1992  Original parser code developed for the  */\n/*                              FTOOLS software package, in particular, */\n/*                              the fselect task.                       */\n/*   Kent Blackburn      c1995  BIT column support added                */\n/*   Peter D Wilson   Feb 1998  Vector column support added             */\n/*   Peter D Wilson   May 1998  Ported to CFITSIO library.  User        */\n/*                              interface routines written, in essence  */\n/*                              making fselect, fcalc, and maketime     */\n/*                              capabilities available to all tools     */\n/*                              via single function calls.              */\n/*   Peter D Wilson   Jun 1998  Major rewrite of parser core, so as to  */\n/*                              create a run-time evaluation tree,      */\n/*                              inspired by the work of Uwe Lammers,    */\n/*                              resulting in a speed increase of        */\n/*                              10-100 times.                           */\n/*   Peter D Wilson   Jul 1998  gtifilter(a,b,c,d) function added       */\n/*   Peter D Wilson   Aug 1998  regfilter(a,b,c,d) function added       */\n/*   Peter D Wilson   Jul 1999  Make parser fitsfile-independent,       */\n/*                              allowing a purely vector-based usage    */\n/*  Craig B Markwardt Jun 2004  Add MEDIAN() function                   */\n/*  Craig B Markwardt Jun 2004  Add SUM(), and MIN/MAX() for bit arrays */\n/*  Craig B Markwardt Jun 2004  Allow subscripting of nX bit arrays     */\n/*  Craig B Markwardt Jun 2004  Implement statistical functions         */\n/*                              NVALID(), AVERAGE(), and STDDEV()       */\n/*                              for integer and floating point vectors  */\n/*  Craig B Markwardt Jun 2004  Use NULL values for range errors instead*/\n/*                              of throwing a parse error               */\n/*  Craig B Markwardt Oct 2004  Add ACCUM() and SEQDIFF() functions     */\n/*  Craig B Markwardt Feb 2005  Add ANGSEP() function                   */\n/*  Craig B Markwardt Aug 2005  CIRCLE, BOX, ELLIPSE, NEAR and REGFILTER*/\n/*                              functions now accept vector arguments   */\n/*  Craig B Markwardt Sum 2006  Add RANDOMN() and RANDOMP() functions   */\n/*  Craig B Markwardt Mar 2007  Allow arguments to RANDOM and RANDOMN to*/\n/*                              determine the output dimensions         */\n/*  Craig B Markwardt Aug 2009  Add substring STRMID() and string search*/\n/*                              STRSTR() functions; more overflow checks*/\n/*  Craig B Markwardt Dec 2019  Add bit/hex/oct literal strings and     */\n/*                              bitwise operatiosn between integers     */\n/*  Craig B Markwardt Mar 2021  Add SETNULL() function                  */\n/*                                                                      */\n/************************************************************************/\n\n#define  APPROX 1.0e-7\n#include \"eval_defs.h\"\n#include \"region.h\"\n#include <time.h>\n\n#include <stdlib.h>\n\n#ifndef alloca\n#define alloca malloc\n#endif\n\n/* Random number generators for various distributions */\n#include \"simplerng.h\"\n\n   /*  Shrink the initial stack depth to keep local data <32K (mac limit)  */\n   /*  yacc will allocate more space if needed, though.                    */\n#define  FFINITDEPTH   100\n\n/***************************************************************/\n/*  Replace Bison's BACKUP macro with one that fixes a bug --  */\n/*  must update state after popping the stack -- and allows    */\n/*  popping multiple terms at one time.                        */\n/***************************************************************/\n\n#define FFNEWBACKUP(token, value)                               \\\n   do\t\t\t\t\t\t\t\t\\\n     if (ffchar == FFEMPTY )   \t\t\t\t\t\\\n       { ffchar = (token);                                      \\\n         memcpy( &fflval, &(value), sizeof(value) );            \\\n         ffchar1 = FFTRANSLATE (ffchar);\t\t\t\\\n         while (fflen--) FFPOPSTACK;\t\t\t\t\\\n         ffstate = *ffssp;\t\t\t\t\t\\\n         goto ffbackup;\t\t\t\t\t\t\\\n       }\t\t\t\t\t\t\t\\\n     else\t\t\t\t\t\t\t\\\n       { fferror (\"syntax error: cannot back up\"); FFERROR; }\t\\\n   while (0)\n\n/***************************************************************/\n/*  Useful macros for accessing/testing Nodes                  */\n/***************************************************************/\n\n#define TEST(a)        if( (a)<0 ) FFERROR\n#define SIZE(a)        gParse.Nodes[ a ].value.nelem\n#define TYPE(a)        gParse.Nodes[ a ].type\n#define OPER(a)        gParse.Nodes[ a ].operation\n#define PROMOTE(a,b)   if( TYPE(a) > TYPE(b) )                  \\\n                          b = New_Unary( TYPE(a), 0, b );       \\\n                       else if( TYPE(a) < TYPE(b) )             \\\n\t                  a = New_Unary( TYPE(b), 0, a );\n\n/*****  Internal functions  *****/\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nstatic int  Alloc_Node    ( void );\nstatic void Free_Last_Node( void );\nstatic void Evaluate_Node ( int thisNode );\n\nstatic int  New_Const ( int returnType, void *value, long len );\nstatic int  New_Column( int ColNum );\nstatic int  New_Offset( int ColNum, int offset );\nstatic int  New_Unary ( int returnType, int Op, int Node1 );\nstatic int  New_BinOp ( int returnType, int Node1, int Op, int Node2 );\nstatic int  New_Func  ( int returnType, funcOp Op, int nNodes,\n\t\t\tint Node1, int Node2, int Node3, int Node4, \n\t\t\tint Node5, int Node6, int Node7 );\nstatic int  New_FuncSize( int returnType, funcOp Op, int nNodes,\n\t\t\tint Node1, int Node2, int Node3, int Node4, \n\t\t\t  int Node5, int Node6, int Node7, int Size);\nstatic int  New_Deref ( int Var,  int nDim,\n\t\t\tint Dim1, int Dim2, int Dim3, int Dim4, int Dim5 );\nstatic int  New_GTI   ( funcOp Op, char *fname, int Node1, int Node2, char *start, char *stop );\nstatic int  New_REG   ( char *fname, int NodeX, int NodeY, char *colNames );\nstatic int  New_Vector( int subNode );\nstatic int  Close_Vec ( int vecNode );\nstatic int  Locate_Col( Node *this );\nstatic int  Test_Dims ( int Node1, int Node2 );\nstatic void Copy_Dims ( int Node1, int Node2 );\n\nstatic void Allocate_Ptrs( Node *this );\nstatic void Do_Unary     ( Node *this );\nstatic void Do_Offset    ( Node *this );\nstatic void Do_BinOp_bit ( Node *this );\nstatic void Do_BinOp_str ( Node *this );\nstatic void Do_BinOp_log ( Node *this );\nstatic void Do_BinOp_lng ( Node *this );\nstatic void Do_BinOp_dbl ( Node *this );\nstatic void Do_Func      ( Node *this );\nstatic void Do_Deref     ( Node *this );\nstatic void Do_GTI       ( Node *this );\nstatic void Do_GTI_Over  ( Node *this );\nstatic void Do_REG       ( Node *this );\nstatic void Do_Vector    ( Node *this );\n\nstatic long Search_GTI   ( double evtTime, long nGTI, double *start,\n\t\t\t   double *stop, int ordered, long *nextGTI );\nstatic double GTI_Over(double evtStart, double evtStop,\n\t\t       long nGTI, double *start, double *stop,\n\t\t       long *gtiout);\n\nstatic char  saobox (double xcen, double ycen, double xwid, double ywid,\n\t\t     double rot,  double xcol, double ycol);\nstatic char  ellipse(double xcen, double ycen, double xrad, double yrad,\n\t\t     double rot, double xcol, double ycol);\nstatic char  circle (double xcen, double ycen, double rad,\n\t\t     double xcol, double ycol);\nstatic char  bnear  (double x, double y, double tolerance);\nstatic char  bitcmp (char *bitstrm1, char *bitstrm2);\nstatic char  bitlgte(char *bits1, int oper, char *bits2);\n\nstatic void  bitand(char *result, char *bitstrm1, char *bitstrm2);\nstatic void  bitor (char *result, char *bitstrm1, char *bitstrm2);\nstatic void  bitnot(char *result, char *bits);\nstatic int cstrmid(char *dest_str, int dest_len,\n\t\t   char *src_str,  int src_len, int pos);\n\nstatic void  fferror(char *msg);\n\n#ifdef __cplusplus\n    }\n#endif\n\n\n#line 269 \"y.tab.c\"\n\n# ifndef FF_CAST\n#  ifdef __cplusplus\n#   define FF_CAST(Type, Val) static_cast<Type> (Val)\n#   define FF_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)\n#  else\n#   define FF_CAST(Type, Val) ((Type) (Val))\n#   define FF_REINTERPRET_CAST(Type, Val) ((Type) (Val))\n#  endif\n# endif\n# ifndef FF_NULLPTR\n#  if defined __cplusplus\n#   if 201103L <= __cplusplus\n#    define FF_NULLPTR nullptr\n#   else\n#    define FF_NULLPTR 0\n#   endif\n#  else\n#   define FF_NULLPTR ((void*)0)\n#  endif\n# endif\n\n/* Use api.header.include to #include this header\n   instead of duplicating it here.  */\n#ifndef FF_FF_Y_TAB_H_INCLUDED\n# define FF_FF_Y_TAB_H_INCLUDED\n/* Debug traces.  */\n#ifndef FFDEBUG\n# define FFDEBUG 0\n#endif\n#if FFDEBUG\nextern int ffdebug;\n#endif\n\n/* Token kinds.  */\n#ifndef FFTOKENTYPE\n# define FFTOKENTYPE\n  enum fftokentype\n  {\n    FFEMPTY = -2,\n    FFEOF = 0,                     /* \"end of file\"  */\n    FFerror = 256,                 /* error  */\n    FFUNDEF = 257,                 /* \"invalid token\"  */\n    BOOLEAN = 258,                 /* BOOLEAN  */\n    LONG = 259,                    /* LONG  */\n    DOUBLE = 260,                  /* DOUBLE  */\n    STRING = 261,                  /* STRING  */\n    BITSTR = 262,                  /* BITSTR  */\n    FUNCTION = 263,                /* FUNCTION  */\n    BFUNCTION = 264,               /* BFUNCTION  */\n    IFUNCTION = 265,               /* IFUNCTION  */\n    GTIFILTER = 266,               /* GTIFILTER  */\n    GTIOVERLAP = 267,              /* GTIOVERLAP  */\n    REGFILTER = 268,               /* REGFILTER  */\n    COLUMN = 269,                  /* COLUMN  */\n    BCOLUMN = 270,                 /* BCOLUMN  */\n    SCOLUMN = 271,                 /* SCOLUMN  */\n    BITCOL = 272,                  /* BITCOL  */\n    ROWREF = 273,                  /* ROWREF  */\n    NULLREF = 274,                 /* NULLREF  */\n    SNULLREF = 275,                /* SNULLREF  */\n    OR = 276,                      /* OR  */\n    AND = 277,                     /* AND  */\n    EQ = 278,                      /* EQ  */\n    NE = 279,                      /* NE  */\n    GT = 280,                      /* GT  */\n    LT = 281,                      /* LT  */\n    LTE = 282,                     /* LTE  */\n    GTE = 283,                     /* GTE  */\n    XOR = 284,                     /* XOR  */\n    POWER = 285,                   /* POWER  */\n    NOT = 286,                     /* NOT  */\n    INTCAST = 287,                 /* INTCAST  */\n    FLTCAST = 288,                 /* FLTCAST  */\n    UMINUS = 289,                  /* UMINUS  */\n    ACCUM = 290,                   /* ACCUM  */\n    DIFF = 291                     /* DIFF  */\n  };\n  typedef enum fftokentype fftoken_kind_t;\n#endif\n/* Token kinds.  */\n#define FFEMPTY -2\n#define FFEOF 0\n#define FFerror 256\n#define FFUNDEF 257\n#define BOOLEAN 258\n#define LONG 259\n#define DOUBLE 260\n#define STRING 261\n#define BITSTR 262\n#define FUNCTION 263\n#define BFUNCTION 264\n#define IFUNCTION 265\n#define GTIFILTER 266\n#define GTIOVERLAP 267\n#define REGFILTER 268\n#define COLUMN 269\n#define BCOLUMN 270\n#define SCOLUMN 271\n#define BITCOL 272\n#define ROWREF 273\n#define NULLREF 274\n#define SNULLREF 275\n#define OR 276\n#define AND 277\n#define EQ 278\n#define NE 279\n#define GT 280\n#define LT 281\n#define LTE 282\n#define GTE 283\n#define XOR 284\n#define POWER 285\n#define NOT 286\n#define INTCAST 287\n#define FLTCAST 288\n#define UMINUS 289\n#define ACCUM 290\n#define DIFF 291\n\n/* Value type.  */\n#if ! defined FFSTYPE && ! defined FFSTYPE_IS_DECLARED\nunion FFSTYPE\n{\n#line 199 \"eval.y\"\n\n    int    Node;        /* Index of Node */\n    double dbl;         /* real value    */\n    long   lng;         /* integer value */\n    char   log;         /* logical value */\n    char   str[MAX_STRLEN];    /* string value  */\n\n#line 402 \"y.tab.c\"\n\n};\ntypedef union FFSTYPE FFSTYPE;\n# define FFSTYPE_IS_TRIVIAL 1\n# define FFSTYPE_IS_DECLARED 1\n#endif\n\n\nextern FFSTYPE fflval;\n\nint ffparse (void);\n\n#endif /* !FF_FF_Y_TAB_H_INCLUDED  */\n/* Symbol kind.  */\nenum ffsymbol_kind_t\n{\n  FFSYMBOL_FFEMPTY = -2,\n  FFSYMBOL_FFEOF = 0,                      /* \"end of file\"  */\n  FFSYMBOL_FFerror = 1,                    /* error  */\n  FFSYMBOL_FFUNDEF = 2,                    /* \"invalid token\"  */\n  FFSYMBOL_BOOLEAN = 3,                    /* BOOLEAN  */\n  FFSYMBOL_LONG = 4,                       /* LONG  */\n  FFSYMBOL_DOUBLE = 5,                     /* DOUBLE  */\n  FFSYMBOL_STRING = 6,                     /* STRING  */\n  FFSYMBOL_BITSTR = 7,                     /* BITSTR  */\n  FFSYMBOL_FUNCTION = 8,                   /* FUNCTION  */\n  FFSYMBOL_BFUNCTION = 9,                  /* BFUNCTION  */\n  FFSYMBOL_IFUNCTION = 10,                 /* IFUNCTION  */\n  FFSYMBOL_GTIFILTER = 11,                 /* GTIFILTER  */\n  FFSYMBOL_GTIOVERLAP = 12,                /* GTIOVERLAP  */\n  FFSYMBOL_REGFILTER = 13,                 /* REGFILTER  */\n  FFSYMBOL_COLUMN = 14,                    /* COLUMN  */\n  FFSYMBOL_BCOLUMN = 15,                   /* BCOLUMN  */\n  FFSYMBOL_SCOLUMN = 16,                   /* SCOLUMN  */\n  FFSYMBOL_BITCOL = 17,                    /* BITCOL  */\n  FFSYMBOL_ROWREF = 18,                    /* ROWREF  */\n  FFSYMBOL_NULLREF = 19,                   /* NULLREF  */\n  FFSYMBOL_SNULLREF = 20,                  /* SNULLREF  */\n  FFSYMBOL_21_ = 21,                       /* ','  */\n  FFSYMBOL_22_ = 22,                       /* '='  */\n  FFSYMBOL_23_ = 23,                       /* ':'  */\n  FFSYMBOL_24_ = 24,                       /* '{'  */\n  FFSYMBOL_25_ = 25,                       /* '}'  */\n  FFSYMBOL_26_ = 26,                       /* '?'  */\n  FFSYMBOL_OR = 27,                        /* OR  */\n  FFSYMBOL_AND = 28,                       /* AND  */\n  FFSYMBOL_EQ = 29,                        /* EQ  */\n  FFSYMBOL_NE = 30,                        /* NE  */\n  FFSYMBOL_31_ = 31,                       /* '~'  */\n  FFSYMBOL_GT = 32,                        /* GT  */\n  FFSYMBOL_LT = 33,                        /* LT  */\n  FFSYMBOL_LTE = 34,                       /* LTE  */\n  FFSYMBOL_GTE = 35,                       /* GTE  */\n  FFSYMBOL_36_ = 36,                       /* '+'  */\n  FFSYMBOL_37_ = 37,                       /* '-'  */\n  FFSYMBOL_38_ = 38,                       /* '%'  */\n  FFSYMBOL_39_ = 39,                       /* '*'  */\n  FFSYMBOL_40_ = 40,                       /* '/'  */\n  FFSYMBOL_41_ = 41,                       /* '|'  */\n  FFSYMBOL_42_ = 42,                       /* '&'  */\n  FFSYMBOL_XOR = 43,                       /* XOR  */\n  FFSYMBOL_POWER = 44,                     /* POWER  */\n  FFSYMBOL_NOT = 45,                       /* NOT  */\n  FFSYMBOL_INTCAST = 46,                   /* INTCAST  */\n  FFSYMBOL_FLTCAST = 47,                   /* FLTCAST  */\n  FFSYMBOL_UMINUS = 48,                    /* UMINUS  */\n  FFSYMBOL_49_ = 49,                       /* '['  */\n  FFSYMBOL_ACCUM = 50,                     /* ACCUM  */\n  FFSYMBOL_DIFF = 51,                      /* DIFF  */\n  FFSYMBOL_52_n_ = 52,                     /* '\\n'  */\n  FFSYMBOL_53_ = 53,                       /* ']'  */\n  FFSYMBOL_54_ = 54,                       /* '('  */\n  FFSYMBOL_55_ = 55,                       /* ')'  */\n  FFSYMBOL_FFACCEPT = 56,                  /* $accept  */\n  FFSYMBOL_lines = 57,                     /* lines  */\n  FFSYMBOL_line = 58,                      /* line  */\n  FFSYMBOL_bvector = 59,                   /* bvector  */\n  FFSYMBOL_vector = 60,                    /* vector  */\n  FFSYMBOL_expr = 61,                      /* expr  */\n  FFSYMBOL_bexpr = 62,                     /* bexpr  */\n  FFSYMBOL_bits = 63,                      /* bits  */\n  FFSYMBOL_sexpr = 64                      /* sexpr  */\n};\ntypedef enum ffsymbol_kind_t ffsymbol_kind_t;\n\n\n\n\n#ifdef short\n# undef short\n#endif\n\n/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure\n   <limits.h> and (if available) <stdint.h> are included\n   so that the code can choose integer types of a good width.  */\n\n#ifndef __PTRDIFF_MAX__\n# include <limits.h> /* INFRINGES ON USER NAME SPACE */\n# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__\n#  include <stdint.h> /* INFRINGES ON USER NAME SPACE */\n#  define FF_STDINT_H\n# endif\n#endif\n\n/* Narrow types that promote to a signed type and that can represent a\n   signed or unsigned integer of at least N bits.  In tables they can\n   save space and decrease cache pressure.  Promoting to a signed type\n   helps avoid bugs in integer arithmetic.  */\n\n#ifdef __INT_LEAST8_MAX__\ntypedef __INT_LEAST8_TYPE__ fftype_int8;\n#elif defined FF_STDINT_H\ntypedef int_least8_t fftype_int8;\n#else\ntypedef signed char fftype_int8;\n#endif\n\n#ifdef __INT_LEAST16_MAX__\ntypedef __INT_LEAST16_TYPE__ fftype_int16;\n#elif defined FF_STDINT_H\ntypedef int_least16_t fftype_int16;\n#else\ntypedef short fftype_int16;\n#endif\n\n#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__\ntypedef __UINT_LEAST8_TYPE__ fftype_uint8;\n#elif (!defined __UINT_LEAST8_MAX__ && defined FF_STDINT_H \\\n       && UINT_LEAST8_MAX <= INT_MAX)\ntypedef uint_least8_t fftype_uint8;\n#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX\ntypedef unsigned char fftype_uint8;\n#else\ntypedef short fftype_uint8;\n#endif\n\n#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__\ntypedef __UINT_LEAST16_TYPE__ fftype_uint16;\n#elif (!defined __UINT_LEAST16_MAX__ && defined FF_STDINT_H \\\n       && UINT_LEAST16_MAX <= INT_MAX)\ntypedef uint_least16_t fftype_uint16;\n#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX\ntypedef unsigned short fftype_uint16;\n#else\ntypedef int fftype_uint16;\n#endif\n\n#ifndef FFPTRDIFF_T\n# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__\n#  define FFPTRDIFF_T __PTRDIFF_TYPE__\n#  define FFPTRDIFF_MAXIMUM __PTRDIFF_MAX__\n# elif defined PTRDIFF_MAX\n#  ifndef ptrdiff_t\n#   include <stddef.h> /* INFRINGES ON USER NAME SPACE */\n#  endif\n#  define FFPTRDIFF_T ptrdiff_t\n#  define FFPTRDIFF_MAXIMUM PTRDIFF_MAX\n# else\n#  define FFPTRDIFF_T long\n#  define FFPTRDIFF_MAXIMUM LONG_MAX\n# endif\n#endif\n\n#ifndef FFSIZE_T\n# ifdef __SIZE_TYPE__\n#  define FFSIZE_T __SIZE_TYPE__\n# elif defined size_t\n#  define FFSIZE_T size_t\n# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__\n#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */\n#  define FFSIZE_T size_t\n# else\n#  define FFSIZE_T unsigned\n# endif\n#endif\n\n#define FFSIZE_MAXIMUM                                  \\\n  FF_CAST (FFPTRDIFF_T,                                 \\\n           (FFPTRDIFF_MAXIMUM < FF_CAST (FFSIZE_T, -1)  \\\n            ? FFPTRDIFF_MAXIMUM                         \\\n            : FF_CAST (FFSIZE_T, -1)))\n\n#define FFSIZEOF(X) FF_CAST (FFPTRDIFF_T, sizeof (X))\n\n\n/* Stored state numbers (used for stacks). */\ntypedef fftype_int16 ff_state_t;\n\n/* State numbers in computations.  */\ntypedef int ff_state_fast_t;\n\n#ifndef FF_\n# if defined FFENABLE_NLS && FFENABLE_NLS\n#  if ENABLE_NLS\n#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */\n#   define FF_(Msgid) dgettext (\"bison-runtime\", Msgid)\n#  endif\n# endif\n# ifndef FF_\n#  define FF_(Msgid) Msgid\n# endif\n#endif\n\n\n#ifndef FF_ATTRIBUTE_PURE\n# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)\n#  define FF_ATTRIBUTE_PURE __attribute__ ((__pure__))\n# else\n#  define FF_ATTRIBUTE_PURE\n# endif\n#endif\n\n#ifndef FF_ATTRIBUTE_UNUSED\n# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)\n#  define FF_ATTRIBUTE_UNUSED __attribute__ ((__unused__))\n# else\n#  define FF_ATTRIBUTE_UNUSED\n# endif\n#endif\n\n/* Suppress unused-variable warnings by \"using\" E.  */\n#if ! defined lint || defined __GNUC__\n# define FFUSE(E) ((void) (E))\n#else\n# define FFUSE(E) /* empty */\n#endif\n\n#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__\n/* Suppress an incorrect diagnostic about fflval being uninitialized.  */\n# define FF_IGNORE_MAYBE_UNINITIALIZED_BEGIN                            \\\n    _Pragma (\"GCC diagnostic push\")                                     \\\n    _Pragma (\"GCC diagnostic ignored \\\"-Wuninitialized\\\"\")              \\\n    _Pragma (\"GCC diagnostic ignored \\\"-Wmaybe-uninitialized\\\"\")\n# define FF_IGNORE_MAYBE_UNINITIALIZED_END      \\\n    _Pragma (\"GCC diagnostic pop\")\n#else\n# define FF_INITIAL_VALUE(Value) Value\n#endif\n#ifndef FF_IGNORE_MAYBE_UNINITIALIZED_BEGIN\n# define FF_IGNORE_MAYBE_UNINITIALIZED_BEGIN\n# define FF_IGNORE_MAYBE_UNINITIALIZED_END\n#endif\n#ifndef FF_INITIAL_VALUE\n# define FF_INITIAL_VALUE(Value) /* Nothing. */\n#endif\n\n#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__\n# define FF_IGNORE_USELESS_CAST_BEGIN                          \\\n    _Pragma (\"GCC diagnostic push\")                            \\\n    _Pragma (\"GCC diagnostic ignored \\\"-Wuseless-cast\\\"\")\n# define FF_IGNORE_USELESS_CAST_END            \\\n    _Pragma (\"GCC diagnostic pop\")\n#endif\n#ifndef FF_IGNORE_USELESS_CAST_BEGIN\n# define FF_IGNORE_USELESS_CAST_BEGIN\n# define FF_IGNORE_USELESS_CAST_END\n#endif\n\n\n#define FF_ASSERT(E) ((void) (0 && (E)))\n\n#if !defined ffoverflow\n\n/* The parser invokes alloca or malloc; define the necessary symbols.  */\n\n# ifdef FFSTACK_USE_ALLOCA\n#  if FFSTACK_USE_ALLOCA\n#   ifdef __GNUC__\n#    define FFSTACK_ALLOC __builtin_alloca\n#   elif defined __BUILTIN_VA_ARG_INCR\n#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */\n#   elif defined _AIX\n#    define FFSTACK_ALLOC __alloca\n#   elif defined _MSC_VER\n#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */\n#    define alloca _alloca\n#   else\n#    define FFSTACK_ALLOC alloca\n#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS\n#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */\n      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */\n#     ifndef EXIT_SUCCESS\n#      define EXIT_SUCCESS 0\n#     endif\n#    endif\n#   endif\n#  endif\n# endif\n\n# ifdef FFSTACK_ALLOC\n   /* Pacify GCC's 'empty if-body' warning.  */\n#  define FFSTACK_FREE(Ptr) do { /* empty */; } while (0)\n#  ifndef FFSTACK_ALLOC_MAXIMUM\n    /* The OS might guarantee only one guard page at the bottom of the stack,\n       and a page size can be as small as 4096 bytes.  So we cannot safely\n       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number\n       to allow for a few compiler-allocated temporary stack slots.  */\n#   define FFSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */\n#  endif\n# else\n#  define FFSTACK_ALLOC FFMALLOC\n#  define FFSTACK_FREE FFFREE\n#  ifndef FFSTACK_ALLOC_MAXIMUM\n#   define FFSTACK_ALLOC_MAXIMUM FFSIZE_MAXIMUM\n#  endif\n#  if (defined __cplusplus && ! defined EXIT_SUCCESS \\\n       && ! ((defined FFMALLOC || defined malloc) \\\n             && (defined FFFREE || defined free)))\n#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */\n#   ifndef EXIT_SUCCESS\n#    define EXIT_SUCCESS 0\n#   endif\n#  endif\n#  ifndef FFMALLOC\n#   define FFMALLOC malloc\n#   if ! defined malloc && ! defined EXIT_SUCCESS\nvoid *malloc (FFSIZE_T); /* INFRINGES ON USER NAME SPACE */\n#   endif\n#  endif\n#  ifndef FFFREE\n#   define FFFREE free\n#   if ! defined free && ! defined EXIT_SUCCESS\nvoid free (void *); /* INFRINGES ON USER NAME SPACE */\n#   endif\n#  endif\n# endif\n#endif /* !defined ffoverflow */\n\n#if (! defined ffoverflow \\\n     && (! defined __cplusplus \\\n         || (defined FFSTYPE_IS_TRIVIAL && FFSTYPE_IS_TRIVIAL)))\n\n/* A type that is properly aligned for any stack member.  */\nunion ffalloc\n{\n  ff_state_t ffss_alloc;\n  FFSTYPE ffvs_alloc;\n};\n\n/* The size of the maximum gap between one aligned stack and the next.  */\n# define FFSTACK_GAP_MAXIMUM (FFSIZEOF (union ffalloc) - 1)\n\n/* The size of an array large to enough to hold all stacks, each with\n   N elements.  */\n# define FFSTACK_BYTES(N) \\\n     ((N) * (FFSIZEOF (ff_state_t) + FFSIZEOF (FFSTYPE)) \\\n      + FFSTACK_GAP_MAXIMUM)\n\n# define FFCOPY_NEEDED 1\n\n/* Relocate STACK from its old location to the new one.  The\n   local variables FFSIZE and FFSTACKSIZE give the old and new number of\n   elements in the stack, and FFPTR gives the new location of the\n   stack.  Advance FFPTR to a properly aligned location for the next\n   stack.  */\n# define FFSTACK_RELOCATE(Stack_alloc, Stack)                           \\\n    do                                                                  \\\n      {                                                                 \\\n        FFPTRDIFF_T ffnewbytes;                                         \\\n        FFCOPY (&ffptr->Stack_alloc, Stack, ffsize);                    \\\n        Stack = &ffptr->Stack_alloc;                                    \\\n        ffnewbytes = ffstacksize * FFSIZEOF (*Stack) + FFSTACK_GAP_MAXIMUM; \\\n        ffptr += ffnewbytes / FFSIZEOF (*ffptr);                        \\\n      }                                                                 \\\n    while (0)\n\n#endif\n\n#if defined FFCOPY_NEEDED && FFCOPY_NEEDED\n/* Copy COUNT objects from SRC to DST.  The source and destination do\n   not overlap.  */\n# ifndef FFCOPY\n#  if defined __GNUC__ && 1 < __GNUC__\n#   define FFCOPY(Dst, Src, Count) \\\n      __builtin_memcpy (Dst, Src, FF_CAST (FFSIZE_T, (Count)) * sizeof (*(Src)))\n#  else\n#   define FFCOPY(Dst, Src, Count)              \\\n      do                                        \\\n        {                                       \\\n          FFPTRDIFF_T ffi;                      \\\n          for (ffi = 0; ffi < (Count); ffi++)   \\\n            (Dst)[ffi] = (Src)[ffi];            \\\n        }                                       \\\n      while (0)\n#  endif\n# endif\n#endif /* !FFCOPY_NEEDED */\n\n/* FFFINAL -- State number of the termination state.  */\n#define FFFINAL  2\n/* FFLAST -- Last index in FFTABLE.  */\n#define FFLAST   1725\n\n/* FFNTOKENS -- Number of terminals.  */\n#define FFNTOKENS  56\n/* FFNNTS -- Number of nonterminals.  */\n#define FFNNTS  9\n/* FFNRULES -- Number of rules.  */\n#define FFNRULES  130\n/* FFNSTATES -- Number of states.  */\n#define FFNSTATES  308\n\n/* FFMAXUTOK -- Last valid token kind.  */\n#define FFMAXUTOK   291\n\n\n/* FFTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM\n   as returned by fflex, with out-of-bounds checking.  */\n#define FFTRANSLATE(FFX)                                \\\n  (0 <= (FFX) && (FFX) <= FFMAXUTOK                     \\\n   ? FF_CAST (ffsymbol_kind_t, fftranslate[FFX])        \\\n   : FFSYMBOL_FFUNDEF)\n\n/* FFTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM\n   as returned by fflex.  */\nstatic const fftype_int8 fftranslate[] =\n{\n       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n      52,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,    38,    42,     2,\n      54,    55,    39,    36,    21,    37,     2,    40,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,    23,     2,\n       2,    22,     2,    26,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,    49,     2,    53,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,    24,    41,    25,    31,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,\n       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,\n      15,    16,    17,    18,    19,    20,    27,    28,    29,    30,\n      32,    33,    34,    35,    43,    44,    45,    46,    47,    48,\n      50,    51\n};\n\n#if FFDEBUG\n  /* FFRLINE[FFN] -- Source line where rule number FFN was defined.  */\nstatic const fftype_int16 ffrline[] =\n{\n       0,   252,   252,   253,   256,   257,   263,   269,   275,   281,\n     284,   286,   299,   301,   314,   325,   339,   343,   347,   351,\n     353,   362,   365,   368,   377,   379,   381,   383,   385,   387,\n     390,   394,   396,   398,   400,   409,   411,   413,   416,   419,\n     422,   425,   428,   437,   446,   455,   458,   460,   462,   464,\n     468,   472,   491,   510,   529,   540,   554,   566,   597,   692,\n     700,   761,   785,   787,   789,   791,   793,   795,   797,   799,\n     801,   805,   807,   809,   818,   821,   824,   827,   830,   833,\n     836,   839,   842,   845,   848,   851,   854,   857,   860,   863,\n     866,   869,   872,   875,   877,   879,   881,   884,   891,   908,\n     921,   934,   945,   961,   985,  1013,  1050,  1054,  1058,  1061,\n    1066,  1069,  1074,  1078,  1081,  1085,  1087,  1089,  1091,  1093,\n    1095,  1097,  1101,  1104,  1106,  1115,  1117,  1119,  1128,  1147,\n    1166\n};\n#endif\n\n/** Accessing symbol of state STATE.  */\n#define FF_ACCESSING_SYMBOL(State) FF_CAST (ffsymbol_kind_t, ffstos[State])\n\n#if FFDEBUG || 0\n/* The user-facing name of the symbol whose (internal) number is\n   FFSYMBOL.  No bounds checking.  */\nstatic const char *ffsymbol_name (ffsymbol_kind_t ffsymbol) FF_ATTRIBUTE_UNUSED;\n\n/* FFTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.\n   First, the terminals, then, starting at FFNTOKENS, nonterminals.  */\nstatic const char *const fftname[] =\n{\n  \"\\\"end of file\\\"\", \"error\", \"\\\"invalid token\\\"\", \"BOOLEAN\", \"LONG\",\n  \"DOUBLE\", \"STRING\", \"BITSTR\", \"FUNCTION\", \"BFUNCTION\", \"IFUNCTION\",\n  \"GTIFILTER\", \"GTIOVERLAP\", \"REGFILTER\", \"COLUMN\", \"BCOLUMN\", \"SCOLUMN\",\n  \"BITCOL\", \"ROWREF\", \"NULLREF\", \"SNULLREF\", \"','\", \"'='\", \"':'\", \"'{'\",\n  \"'}'\", \"'?'\", \"OR\", \"AND\", \"EQ\", \"NE\", \"'~'\", \"GT\", \"LT\", \"LTE\", \"GTE\",\n  \"'+'\", \"'-'\", \"'%'\", \"'*'\", \"'/'\", \"'|'\", \"'&'\", \"XOR\", \"POWER\", \"NOT\",\n  \"INTCAST\", \"FLTCAST\", \"UMINUS\", \"'['\", \"ACCUM\", \"DIFF\", \"'\\\\n'\", \"']'\",\n  \"'('\", \"')'\", \"$accept\", \"lines\", \"line\", \"bvector\", \"vector\", \"expr\",\n  \"bexpr\", \"bits\", \"sexpr\", FF_NULLPTR\n};\n\nstatic const char *\nffsymbol_name (ffsymbol_kind_t ffsymbol)\n{\n  return fftname[ffsymbol];\n}\n#endif\n\n#ifdef FFPRINT\n/* FFTOKNUM[NUM] -- (External) token number corresponding to the\n   (internal) symbol number NUM (which must be that of a token).  */\nstatic const fftype_int16 fftoknum[] =\n{\n       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,\n     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,\n     275,    44,    61,    58,   123,   125,    63,   276,   277,   278,\n     279,   126,   280,   281,   282,   283,    43,    45,    37,    42,\n      47,   124,    38,   284,   285,   286,   287,   288,   289,    91,\n     290,   291,    10,    93,    40,    41\n};\n#endif\n\n#define FFPACT_NINF (-40)\n\n#define ffpact_value_is_default(Yyn) \\\n  ((Yyn) == FFPACT_NINF)\n\n#define FFTABLE_NINF (-1)\n\n#define fftable_value_is_error(Yyn) \\\n  0\n\n  /* FFPACT[STATE-NUM] -- Index in FFTABLE of the portion describing\n     STATE-NUM.  */\nstatic const fftype_int16 ffpact[] =\n{\n     -40,   337,   -40,   -39,   -40,   -40,   -40,   -40,   -40,   389,\n     442,   442,    -5,    21,    29,    17,    25,    44,    45,   -40,\n     -40,   -40,   442,   442,   442,   442,   442,   442,   -40,   442,\n     -40,   -15,    19,  1159,   443,  1584,  1605,   -40,   -40,   276,\n     -10,   330,   133,   469,   144,  1647,   248,  1526,   209,  1689,\n     -19,   -40,    49,   -18,   442,   442,   442,   442,  1526,   209,\n     294,    -6,    -6,    24,    26,    -6,    24,    -6,    24,   671,\n    1186,   382,  1544,   442,   -40,   442,   -40,   442,   442,   442,\n     442,   442,   442,   442,   442,   442,   442,   442,   442,   442,\n     442,   442,   442,   442,   442,   -40,   442,   442,   442,   442,\n     442,   442,   442,   -40,    -3,    -3,    -3,    -3,    -3,    -3,\n      -3,    -3,    -3,   442,   -40,   442,   442,   442,   442,   442,\n     442,   442,   -40,   442,   -40,   442,   -40,   -40,   442,   -40,\n     442,   -40,   -40,   -40,   442,   442,   -40,   442,   442,   -40,\n    1388,  1411,  1434,  1457,   -40,   -40,   -40,   -40,  1526,   209,\n    1526,   209,  1480,  1665,  1665,  1665,    22,    22,    22,    22,\n     203,   203,   203,   148,    24,   148,   -37,   -37,   -37,   -37,\n     784,  1503,  1558,  1619,    18,    69,   -34,   -34,   148,   809,\n      -3,    -3,   111,   111,   111,   111,   111,   111,   -11,    26,\n      26,   834,   406,   406,    58,    58,    58,    58,   -40,   498,\n    1191,  1221,  1560,  1245,  1576,   527,  1269,  1293,   -40,   -40,\n     -40,   -40,   442,   442,   -40,   442,   442,   442,   442,   -40,\n      26,    68,   442,   -40,   442,   -40,   -40,   442,   -40,   442,\n     -40,    90,   -40,   442,   442,  1629,   859,  1629,   209,  1629,\n     209,   294,   884,   909,  1317,   699,   556,    76,   585,   614,\n     442,   -40,   442,   -40,   442,   -40,   442,   -40,   442,   -40,\n      96,    97,   -40,    99,   -40,   934,   959,   984,   727,  1341,\n      51,    92,    56,   442,   -40,   442,   -40,   442,   -40,   -40,\n     442,   -40,   108,   -40,  1009,  1034,  1059,   643,    65,   442,\n     -40,   442,   -40,   442,   -40,   442,   -40,   -40,  1084,  1109,\n    1134,  1365,   -40,   -40,   -40,   442,   755,   -40\n};\n\n  /* FFDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.\n     Performed when FFTABLE does not specify something else to do.  Zero\n     means the default is an error.  */\nstatic const fftype_uint8 ffdefact[] =\n{\n       2,     0,     1,     0,    71,    31,    32,   122,    18,     0,\n       0,     0,     0,     0,     0,    33,    72,   123,    19,    35,\n      36,   125,     0,     0,     0,     0,     0,     0,     4,     0,\n       3,     0,     0,     0,     0,     0,     0,     9,    54,     0,\n       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\n       0,   106,     0,     0,     0,     0,     0,     0,    12,    10,\n       0,    46,    47,   120,    29,    67,    68,    69,    70,     0,\n       0,     0,     0,     0,    17,     0,    16,     0,     0,     0,\n       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\n       0,     0,     0,     0,     0,     5,     0,     0,     0,     0,\n       0,     0,     0,     6,     0,     0,     0,     0,     0,     0,\n       0,     0,     0,     0,     8,     0,     0,     0,     0,     0,\n       0,     0,     7,     0,    58,     0,    55,    57,     0,    56,\n       0,    99,   100,   101,     0,     0,   107,     0,     0,   112,\n       0,     0,     0,     0,    48,   121,    30,   126,    15,    11,\n      13,    14,     0,    85,    86,    84,    80,    81,    83,    82,\n      38,    39,    37,    40,    49,    41,    43,    42,    44,    45,\n       0,     0,     0,     0,    94,    93,    95,    96,    50,     0,\n       0,     0,    74,    75,    78,    76,    77,    79,    23,    22,\n      21,     0,    87,    88,    89,    91,    92,    90,   127,     0,\n       0,     0,     0,     0,     0,     0,     0,     0,    34,    73,\n     124,    20,     0,     0,    62,     0,     0,     0,     0,   115,\n      29,     0,     0,    24,     0,    60,   102,     0,   129,     0,\n      59,     0,   108,     0,     0,    97,     0,    51,    53,    52,\n      98,   128,     0,     0,     0,     0,     0,     0,     0,     0,\n       0,    63,     0,   116,     0,    25,     0,   130,     0,   103,\n       0,     0,   110,     0,   113,     0,     0,     0,     0,     0,\n       0,     0,     0,     0,    64,     0,   117,     0,    26,    61,\n       0,   109,     0,   114,     0,     0,     0,     0,     0,     0,\n      65,     0,   118,     0,    27,     0,   104,   111,     0,     0,\n       0,     0,    66,   119,    28,     0,     0,   105\n};\n\n  /* FFPGOTO[NTERM-NUM].  */\nstatic const fftype_int16 ffpgoto[] =\n{\n     -40,   -40,   -40,   -40,   -40,    -1,   106,   155,    23\n};\n\n  /* FFDEFGOTO[NTERM-NUM].  */\nstatic const fftype_int8 ffdefgoto[] =\n{\n      -1,     1,    30,    31,    32,    47,    48,    45,    60\n};\n\n  /* FFTABLE[FFPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If\n     positive, shift that token.  If negative, reduce the rule whose\n     number is the opposite.  If FFTABLE_NINF, syntax error.  */\nstatic const fftype_int16 fftable[] =\n{\n      33,    50,   135,   138,     8,   101,    73,    93,    39,    43,\n      74,   125,    94,    37,    18,   102,    96,    97,    98,    99,\n     100,    58,    61,    62,    36,    65,    67,    52,    69,   101,\n     111,   112,    42,    46,    49,    53,   136,   139,   113,   102,\n      75,    54,   180,    94,    76,   126,    98,    99,   100,    55,\n      51,   181,    72,   140,   141,   142,   143,   101,    85,    86,\n      87,    88,    89,    90,    91,    92,    93,   102,    56,    57,\n     137,    94,   148,   102,   150,   113,   152,   153,   154,   155,\n     156,   157,   158,   159,   160,   161,   162,   163,   165,   166,\n     167,   168,   169,   170,   121,   171,   247,   260,    99,   100,\n     178,   179,   270,   271,   110,   272,   281,    34,   101,   111,\n     112,   283,   191,   282,   288,    40,    44,   113,   102,   173,\n     297,     0,   199,   146,     0,     0,     0,   201,    59,   203,\n       0,    63,    66,    68,   205,    70,   206,   207,   192,   193,\n     194,   195,   196,   197,   198,     0,     0,   110,     0,     0,\n       0,   202,   111,   112,   128,     0,    35,   204,     0,     0,\n     113,     0,   115,   116,    41,   117,   118,   119,   120,   121,\n      96,    97,    98,    99,   100,     0,     0,     0,     0,   149,\n      64,   151,     0,   101,    71,     0,     0,     0,   129,    90,\n      91,    92,    93,   102,   164,     0,     0,    94,     0,   132,\n       0,     0,   172,   174,   175,   176,   177,     0,     0,     0,\n       0,   235,   236,     0,   237,   239,     0,   242,     0,     0,\n       0,   243,     0,   244,     0,     0,   245,     0,   246,     0,\n       0,   200,   248,   249,     0,    96,    97,    98,    99,   100,\n     241,     0,    88,    89,    90,    91,    92,    93,   101,   265,\n       0,   266,    94,   267,     0,   268,     0,   269,   102,   182,\n     183,   184,   185,   186,   187,   188,   189,   190,     0,     0,\n       0,     0,   284,     0,   285,     0,   286,   115,   116,   287,\n     117,   118,   119,   120,   121,     0,     0,     0,   298,     0,\n     299,     0,   300,     0,   301,     0,     0,   123,    77,     0,\n       0,     0,     0,   133,   306,    78,    79,    80,    81,    82,\n      83,    84,    85,    86,    87,    88,    89,    90,    91,    92,\n      93,   238,   240,   115,   116,    94,   117,   118,   119,   120,\n     121,   124,     0,     0,     0,   220,   221,     2,     3,     0,\n       4,     5,     6,     7,     8,     9,    10,    11,    12,    13,\n      14,    15,    16,    17,    18,    19,    20,    21,     0,   104,\n     105,    22,   106,   107,   108,   109,   110,     0,     0,     0,\n       0,   111,   112,    23,    24,     0,     0,     0,     0,   113,\n       0,     0,    25,    26,    27,   127,     0,     0,     0,    28,\n       0,    29,     4,     5,     6,     7,     8,     9,    10,    11,\n      12,    13,    14,    15,    16,    17,    18,    19,    20,    21,\n       0,   104,   105,    22,   106,   107,   108,   109,   110,     0,\n       0,     0,     0,   111,   112,    23,    24,     0,     0,     0,\n       0,   113,     0,     0,    25,    26,    27,   146,   117,   118,\n     119,   120,   121,    29,    38,     4,     5,     6,     7,     8,\n       9,    10,    11,    12,    13,    14,    15,    16,    17,    18,\n      19,    20,    21,     0,     0,     0,    22,     0,     0,    96,\n      97,    98,    99,   100,     0,     0,     0,     0,    23,    24,\n       0,     0,   101,     0,     0,     0,     0,    25,    26,    27,\n     130,    77,   102,     0,     0,   103,    29,     0,    78,    79,\n      80,    81,    82,    83,    84,    85,    86,    87,    88,    89,\n      90,    91,    92,    93,     0,     0,     0,     0,    94,   224,\n      77,     0,     0,     0,   131,     0,     0,    78,    79,    80,\n      81,    82,    83,    84,    85,    86,    87,    88,    89,    90,\n      91,    92,    93,     0,     0,     0,     0,    94,   231,    77,\n       0,     0,     0,   225,     0,     0,    78,    79,    80,    81,\n      82,    83,    84,    85,    86,    87,    88,    89,    90,    91,\n      92,    93,     0,     0,     0,     0,    94,   258,    77,     0,\n       0,     0,   232,     0,     0,    78,    79,    80,    81,    82,\n      83,    84,    85,    86,    87,    88,    89,    90,    91,    92,\n      93,     0,     0,     0,     0,    94,   261,    77,     0,     0,\n       0,   259,     0,     0,    78,    79,    80,    81,    82,    83,\n      84,    85,    86,    87,    88,    89,    90,    91,    92,    93,\n       0,     0,     0,     0,    94,   263,    77,     0,     0,     0,\n     262,     0,     0,    78,    79,    80,    81,    82,    83,    84,\n      85,    86,    87,    88,    89,    90,    91,    92,    93,     0,\n       0,     0,     0,    94,   295,    77,     0,     0,     0,   264,\n       0,     0,    78,    79,    80,    81,    82,    83,    84,    85,\n      86,    87,    88,    89,    90,    91,    92,    93,     0,     0,\n       0,     0,    94,    77,     0,     0,     0,     0,   296,     0,\n      78,    79,    80,    81,    82,    83,    84,    85,    86,    87,\n      88,    89,    90,    91,    92,    93,     0,     0,     0,     0,\n      94,    77,     0,     0,     0,     0,   144,     0,    78,    79,\n      80,    81,    82,    83,    84,    85,    86,    87,    88,    89,\n      90,    91,    92,    93,     0,     0,     0,     0,    94,    77,\n       0,     0,     0,     0,   257,     0,    78,    79,    80,    81,\n      82,    83,    84,    85,    86,    87,    88,    89,    90,    91,\n      92,    93,     0,     0,     0,     0,    94,    77,     0,     0,\n       0,     0,   279,     0,    78,    79,    80,    81,    82,    83,\n      84,    85,    86,    87,    88,    89,    90,    91,    92,    93,\n       0,     0,     0,     0,    94,   213,    77,     0,     0,     0,\n     307,     0,     0,    78,    79,    80,    81,    82,    83,    84,\n      85,    86,    87,    88,    89,    90,    91,    92,    93,     0,\n     218,    77,     0,    94,     0,     0,     0,   214,    78,    79,\n      80,    81,    82,    83,    84,    85,    86,    87,    88,    89,\n      90,    91,    92,    93,     0,   222,    77,     0,    94,     0,\n       0,     0,   219,    78,    79,    80,    81,    82,    83,    84,\n      85,    86,    87,    88,    89,    90,    91,    92,    93,     0,\n     250,    77,     0,    94,     0,     0,     0,   223,    78,    79,\n      80,    81,    82,    83,    84,    85,    86,    87,    88,    89,\n      90,    91,    92,    93,     0,   252,    77,     0,    94,     0,\n       0,     0,   251,    78,    79,    80,    81,    82,    83,    84,\n      85,    86,    87,    88,    89,    90,    91,    92,    93,     0,\n     254,    77,     0,    94,     0,     0,     0,   253,    78,    79,\n      80,    81,    82,    83,    84,    85,    86,    87,    88,    89,\n      90,    91,    92,    93,     0,   273,    77,     0,    94,     0,\n       0,     0,   255,    78,    79,    80,    81,    82,    83,    84,\n      85,    86,    87,    88,    89,    90,    91,    92,    93,     0,\n     275,    77,     0,    94,     0,     0,     0,   274,    78,    79,\n      80,    81,    82,    83,    84,    85,    86,    87,    88,    89,\n      90,    91,    92,    93,     0,   277,    77,     0,    94,     0,\n       0,     0,   276,    78,    79,    80,    81,    82,    83,    84,\n      85,    86,    87,    88,    89,    90,    91,    92,    93,     0,\n     289,    77,     0,    94,     0,     0,     0,   278,    78,    79,\n      80,    81,    82,    83,    84,    85,    86,    87,    88,    89,\n      90,    91,    92,    93,     0,   291,    77,     0,    94,     0,\n       0,     0,   290,    78,    79,    80,    81,    82,    83,    84,\n      85,    86,    87,    88,    89,    90,    91,    92,    93,     0,\n     293,    77,     0,    94,     0,     0,     0,   292,    78,    79,\n      80,    81,    82,    83,    84,    85,    86,    87,    88,    89,\n      90,    91,    92,    93,     0,     0,    77,     0,    94,     0,\n       0,     0,   294,    78,    79,    80,    81,    82,    83,    84,\n      85,    86,    87,    88,    89,    90,    91,    92,    93,     0,\n       0,    77,     0,    94,     0,     0,     0,   302,    78,    79,\n      80,    81,    82,    83,    84,    85,    86,    87,    88,    89,\n      90,    91,    92,    93,     0,     0,    77,     0,    94,     0,\n       0,     0,   303,    78,    79,    80,    81,    82,    83,    84,\n      85,    86,    87,    88,    89,    90,    91,    92,    93,     0,\n       0,    77,     0,    94,     0,     0,     0,   304,    78,    79,\n      80,    81,    82,    83,    84,    85,    86,    87,    88,    89,\n      90,    91,    92,    93,     0,     0,     0,     0,    94,     0,\n       0,    95,    96,    97,    98,    99,   100,    96,    97,    98,\n      99,   100,     0,     0,     0,   101,     0,     0,     0,     0,\n     101,     0,     0,     0,     0,   102,     0,     0,     0,     0,\n     102,   145,   227,    77,     0,     0,   226,     0,     0,     0,\n      78,    79,    80,    81,    82,    83,    84,    85,    86,    87,\n      88,    89,    90,    91,    92,    93,   229,    77,     0,     0,\n      94,     0,     0,     0,    78,    79,    80,    81,    82,    83,\n      84,    85,    86,    87,    88,    89,    90,    91,    92,    93,\n     233,    77,     0,     0,    94,     0,     0,     0,    78,    79,\n      80,    81,    82,    83,    84,    85,    86,    87,    88,    89,\n      90,    91,    92,    93,   234,    77,     0,     0,    94,     0,\n       0,     0,    78,    79,    80,    81,    82,    83,    84,    85,\n      86,    87,    88,    89,    90,    91,    92,    93,   256,    77,\n       0,     0,    94,     0,     0,     0,    78,    79,    80,    81,\n      82,    83,    84,    85,    86,    87,    88,    89,    90,    91,\n      92,    93,   280,    77,     0,     0,    94,     0,     0,     0,\n      78,    79,    80,    81,    82,    83,    84,    85,    86,    87,\n      88,    89,    90,    91,    92,    93,   305,    77,     0,     0,\n      94,     0,     0,     0,    78,    79,    80,    81,    82,    83,\n      84,    85,    86,    87,    88,    89,    90,    91,    92,    93,\n      77,     0,     0,   208,    94,     0,     0,    78,    79,    80,\n      81,    82,    83,    84,    85,    86,    87,    88,    89,    90,\n      91,    92,    93,    77,     0,     0,   209,    94,     0,     0,\n      78,    79,    80,    81,    82,    83,    84,    85,    86,    87,\n      88,    89,    90,    91,    92,    93,    77,     0,     0,   210,\n      94,     0,     0,    78,    79,    80,    81,    82,    83,    84,\n      85,    86,    87,    88,    89,    90,    91,    92,    93,    77,\n       0,     0,   211,    94,     0,     0,    78,    79,    80,    81,\n      82,    83,    84,    85,    86,    87,    88,    89,    90,    91,\n      92,    93,    77,   212,     0,     0,    94,     0,     0,    78,\n      79,    80,    81,    82,    83,    84,    85,    86,    87,    88,\n      89,    90,    91,    92,    93,    77,   215,     0,     0,    94,\n       0,     0,    78,    79,    80,    81,    82,    83,    84,    85,\n      86,    87,    88,    89,    90,    91,    92,    93,    77,     0,\n       0,     0,    94,     0,     0,    78,    79,    80,    81,    82,\n      83,    84,    85,    86,    87,    88,    89,    90,    91,    92,\n      93,     0,     0,   115,   116,    94,   117,   118,   119,   120,\n     121,   216,     0,     0,    96,    97,    98,    99,   100,   115,\n     116,     0,   117,   118,   119,   120,   121,   101,     0,   147,\n       0,     0,     0,     0,     0,   115,   116,   102,   117,   118,\n     119,   120,   121,   104,   105,   228,   106,   107,   108,   109,\n     110,     0,     0,     0,     0,   111,   112,     0,     0,     0,\n       0,   230,     0,   113,   115,   116,   114,   117,   118,   119,\n     120,   121,   217,     0,     0,     0,     0,     0,   115,   116,\n       0,   117,   118,   119,   120,   121,     0,   122,    78,    79,\n      80,    81,    82,    83,    84,    85,    86,    87,    88,    89,\n      90,    91,    92,    93,     0,     0,   104,   105,    94,   106,\n     107,   108,   109,   110,     0,     0,     0,     0,   111,   112,\n       0,     0,     0,     0,     0,     0,   113,    81,    82,    83,\n      84,    85,    86,    87,    88,    89,    90,    91,    92,    93,\n     134,     0,     0,     0,    94,     0,     0,     0,   115,   116,\n       0,   117,   118,   119,   120,   121\n};\n\nstatic const fftype_int16 ffcheck[] =\n{\n       1,     6,    21,    21,     7,    39,    21,    44,     9,    10,\n      25,    21,    49,    52,    17,    49,    26,    27,    28,    29,\n      30,    22,    23,    24,     1,    26,    27,     6,    29,    39,\n      41,    42,     9,    10,    11,     6,    55,    55,    49,    49,\n      21,    24,    45,    49,    25,    55,    28,    29,    30,    24,\n      55,    54,    29,    54,    55,    56,    57,    39,    36,    37,\n      38,    39,    40,    41,    42,    43,    44,    49,    24,    24,\n      21,    49,    73,    49,    75,    49,    77,    78,    79,    80,\n      81,    82,    83,    84,    85,    86,    87,    88,    89,    90,\n      91,    92,    93,    94,    36,    96,     6,    21,    29,    30,\n     101,   102,     6,     6,    36,     6,    55,     1,    39,    41,\n      42,    55,   113,    21,     6,     9,    10,    49,    49,    96,\n      55,    -1,   123,    55,    -1,    -1,    -1,   128,    22,   130,\n      -1,    25,    26,    27,   135,    29,   137,   138,   115,   116,\n     117,   118,   119,   120,   121,    -1,    -1,    36,    -1,    -1,\n      -1,   128,    41,    42,    21,    -1,     1,   134,    -1,    -1,\n      49,    -1,    29,    30,     9,    32,    33,    34,    35,    36,\n      26,    27,    28,    29,    30,    -1,    -1,    -1,    -1,    73,\n      25,    75,    -1,    39,    29,    -1,    -1,    -1,    55,    41,\n      42,    43,    44,    49,    88,    -1,    -1,    49,    -1,    55,\n      -1,    -1,    96,    97,    98,    99,   100,    -1,    -1,    -1,\n      -1,   212,   213,    -1,   215,   216,    -1,   218,    -1,    -1,\n      -1,   222,    -1,   224,    -1,    -1,   227,    -1,   229,    -1,\n      -1,   125,   233,   234,    -1,    26,    27,    28,    29,    30,\n     217,    -1,    39,    40,    41,    42,    43,    44,    39,   250,\n      -1,   252,    49,   254,    -1,   256,    -1,   258,    49,   104,\n     105,   106,   107,   108,   109,   110,   111,   112,    -1,    -1,\n      -1,    -1,   273,    -1,   275,    -1,   277,    29,    30,   280,\n      32,    33,    34,    35,    36,    -1,    -1,    -1,   289,    -1,\n     291,    -1,   293,    -1,   295,    -1,    -1,    21,    22,    -1,\n      -1,    -1,    -1,    55,   305,    29,    30,    31,    32,    33,\n      34,    35,    36,    37,    38,    39,    40,    41,    42,    43,\n      44,   215,   216,    29,    30,    49,    32,    33,    34,    35,\n      36,    55,    -1,    -1,    -1,   180,   181,     0,     1,    -1,\n       3,     4,     5,     6,     7,     8,     9,    10,    11,    12,\n      13,    14,    15,    16,    17,    18,    19,    20,    -1,    29,\n      30,    24,    32,    33,    34,    35,    36,    -1,    -1,    -1,\n      -1,    41,    42,    36,    37,    -1,    -1,    -1,    -1,    49,\n      -1,    -1,    45,    46,    47,    55,    -1,    -1,    -1,    52,\n      -1,    54,     3,     4,     5,     6,     7,     8,     9,    10,\n      11,    12,    13,    14,    15,    16,    17,    18,    19,    20,\n      -1,    29,    30,    24,    32,    33,    34,    35,    36,    -1,\n      -1,    -1,    -1,    41,    42,    36,    37,    -1,    -1,    -1,\n      -1,    49,    -1,    -1,    45,    46,    47,    55,    32,    33,\n      34,    35,    36,    54,    55,     3,     4,     5,     6,     7,\n       8,     9,    10,    11,    12,    13,    14,    15,    16,    17,\n      18,    19,    20,    -1,    -1,    -1,    24,    -1,    -1,    26,\n      27,    28,    29,    30,    -1,    -1,    -1,    -1,    36,    37,\n      -1,    -1,    39,    -1,    -1,    -1,    -1,    45,    46,    47,\n      21,    22,    49,    -1,    -1,    52,    54,    -1,    29,    30,\n      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,\n      41,    42,    43,    44,    -1,    -1,    -1,    -1,    49,    21,\n      22,    -1,    -1,    -1,    55,    -1,    -1,    29,    30,    31,\n      32,    33,    34,    35,    36,    37,    38,    39,    40,    41,\n      42,    43,    44,    -1,    -1,    -1,    -1,    49,    21,    22,\n      -1,    -1,    -1,    55,    -1,    -1,    29,    30,    31,    32,\n      33,    34,    35,    36,    37,    38,    39,    40,    41,    42,\n      43,    44,    -1,    -1,    -1,    -1,    49,    21,    22,    -1,\n      -1,    -1,    55,    -1,    -1,    29,    30,    31,    32,    33,\n      34,    35,    36,    37,    38,    39,    40,    41,    42,    43,\n      44,    -1,    -1,    -1,    -1,    49,    21,    22,    -1,    -1,\n      -1,    55,    -1,    -1,    29,    30,    31,    32,    33,    34,\n      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,\n      -1,    -1,    -1,    -1,    49,    21,    22,    -1,    -1,    -1,\n      55,    -1,    -1,    29,    30,    31,    32,    33,    34,    35,\n      36,    37,    38,    39,    40,    41,    42,    43,    44,    -1,\n      -1,    -1,    -1,    49,    21,    22,    -1,    -1,    -1,    55,\n      -1,    -1,    29,    30,    31,    32,    33,    34,    35,    36,\n      37,    38,    39,    40,    41,    42,    43,    44,    -1,    -1,\n      -1,    -1,    49,    22,    -1,    -1,    -1,    -1,    55,    -1,\n      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,\n      39,    40,    41,    42,    43,    44,    -1,    -1,    -1,    -1,\n      49,    22,    -1,    -1,    -1,    -1,    55,    -1,    29,    30,\n      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,\n      41,    42,    43,    44,    -1,    -1,    -1,    -1,    49,    22,\n      -1,    -1,    -1,    -1,    55,    -1,    29,    30,    31,    32,\n      33,    34,    35,    36,    37,    38,    39,    40,    41,    42,\n      43,    44,    -1,    -1,    -1,    -1,    49,    22,    -1,    -1,\n      -1,    -1,    55,    -1,    29,    30,    31,    32,    33,    34,\n      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,\n      -1,    -1,    -1,    -1,    49,    21,    22,    -1,    -1,    -1,\n      55,    -1,    -1,    29,    30,    31,    32,    33,    34,    35,\n      36,    37,    38,    39,    40,    41,    42,    43,    44,    -1,\n      21,    22,    -1,    49,    -1,    -1,    -1,    53,    29,    30,\n      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,\n      41,    42,    43,    44,    -1,    21,    22,    -1,    49,    -1,\n      -1,    -1,    53,    29,    30,    31,    32,    33,    34,    35,\n      36,    37,    38,    39,    40,    41,    42,    43,    44,    -1,\n      21,    22,    -1,    49,    -1,    -1,    -1,    53,    29,    30,\n      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,\n      41,    42,    43,    44,    -1,    21,    22,    -1,    49,    -1,\n      -1,    -1,    53,    29,    30,    31,    32,    33,    34,    35,\n      36,    37,    38,    39,    40,    41,    42,    43,    44,    -1,\n      21,    22,    -1,    49,    -1,    -1,    -1,    53,    29,    30,\n      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,\n      41,    42,    43,    44,    -1,    21,    22,    -1,    49,    -1,\n      -1,    -1,    53,    29,    30,    31,    32,    33,    34,    35,\n      36,    37,    38,    39,    40,    41,    42,    43,    44,    -1,\n      21,    22,    -1,    49,    -1,    -1,    -1,    53,    29,    30,\n      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,\n      41,    42,    43,    44,    -1,    21,    22,    -1,    49,    -1,\n      -1,    -1,    53,    29,    30,    31,    32,    33,    34,    35,\n      36,    37,    38,    39,    40,    41,    42,    43,    44,    -1,\n      21,    22,    -1,    49,    -1,    -1,    -1,    53,    29,    30,\n      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,\n      41,    42,    43,    44,    -1,    21,    22,    -1,    49,    -1,\n      -1,    -1,    53,    29,    30,    31,    32,    33,    34,    35,\n      36,    37,    38,    39,    40,    41,    42,    43,    44,    -1,\n      21,    22,    -1,    49,    -1,    -1,    -1,    53,    29,    30,\n      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,\n      41,    42,    43,    44,    -1,    -1,    22,    -1,    49,    -1,\n      -1,    -1,    53,    29,    30,    31,    32,    33,    34,    35,\n      36,    37,    38,    39,    40,    41,    42,    43,    44,    -1,\n      -1,    22,    -1,    49,    -1,    -1,    -1,    53,    29,    30,\n      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,\n      41,    42,    43,    44,    -1,    -1,    22,    -1,    49,    -1,\n      -1,    -1,    53,    29,    30,    31,    32,    33,    34,    35,\n      36,    37,    38,    39,    40,    41,    42,    43,    44,    -1,\n      -1,    22,    -1,    49,    -1,    -1,    -1,    53,    29,    30,\n      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,\n      41,    42,    43,    44,    -1,    -1,    -1,    -1,    49,    -1,\n      -1,    52,    26,    27,    28,    29,    30,    26,    27,    28,\n      29,    30,    -1,    -1,    -1,    39,    -1,    -1,    -1,    -1,\n      39,    -1,    -1,    -1,    -1,    49,    -1,    -1,    -1,    -1,\n      49,    55,    21,    22,    -1,    -1,    55,    -1,    -1,    -1,\n      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,\n      39,    40,    41,    42,    43,    44,    21,    22,    -1,    -1,\n      49,    -1,    -1,    -1,    29,    30,    31,    32,    33,    34,\n      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,\n      21,    22,    -1,    -1,    49,    -1,    -1,    -1,    29,    30,\n      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,\n      41,    42,    43,    44,    21,    22,    -1,    -1,    49,    -1,\n      -1,    -1,    29,    30,    31,    32,    33,    34,    35,    36,\n      37,    38,    39,    40,    41,    42,    43,    44,    21,    22,\n      -1,    -1,    49,    -1,    -1,    -1,    29,    30,    31,    32,\n      33,    34,    35,    36,    37,    38,    39,    40,    41,    42,\n      43,    44,    21,    22,    -1,    -1,    49,    -1,    -1,    -1,\n      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,\n      39,    40,    41,    42,    43,    44,    21,    22,    -1,    -1,\n      49,    -1,    -1,    -1,    29,    30,    31,    32,    33,    34,\n      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,\n      22,    -1,    -1,    25,    49,    -1,    -1,    29,    30,    31,\n      32,    33,    34,    35,    36,    37,    38,    39,    40,    41,\n      42,    43,    44,    22,    -1,    -1,    25,    49,    -1,    -1,\n      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,\n      39,    40,    41,    42,    43,    44,    22,    -1,    -1,    25,\n      49,    -1,    -1,    29,    30,    31,    32,    33,    34,    35,\n      36,    37,    38,    39,    40,    41,    42,    43,    44,    22,\n      -1,    -1,    25,    49,    -1,    -1,    29,    30,    31,    32,\n      33,    34,    35,    36,    37,    38,    39,    40,    41,    42,\n      43,    44,    22,    23,    -1,    -1,    49,    -1,    -1,    29,\n      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,\n      40,    41,    42,    43,    44,    22,    23,    -1,    -1,    49,\n      -1,    -1,    29,    30,    31,    32,    33,    34,    35,    36,\n      37,    38,    39,    40,    41,    42,    43,    44,    22,    -1,\n      -1,    -1,    49,    -1,    -1,    29,    30,    31,    32,    33,\n      34,    35,    36,    37,    38,    39,    40,    41,    42,    43,\n      44,    -1,    -1,    29,    30,    49,    32,    33,    34,    35,\n      36,    23,    -1,    -1,    26,    27,    28,    29,    30,    29,\n      30,    -1,    32,    33,    34,    35,    36,    39,    -1,    55,\n      -1,    -1,    -1,    -1,    -1,    29,    30,    49,    32,    33,\n      34,    35,    36,    29,    30,    55,    32,    33,    34,    35,\n      36,    -1,    -1,    -1,    -1,    41,    42,    -1,    -1,    -1,\n      -1,    55,    -1,    49,    29,    30,    52,    32,    33,    34,\n      35,    36,    23,    -1,    -1,    -1,    -1,    -1,    29,    30,\n      -1,    32,    33,    34,    35,    36,    -1,    52,    29,    30,\n      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,\n      41,    42,    43,    44,    -1,    -1,    29,    30,    49,    32,\n      33,    34,    35,    36,    -1,    -1,    -1,    -1,    41,    42,\n      -1,    -1,    -1,    -1,    -1,    -1,    49,    32,    33,    34,\n      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,\n      21,    -1,    -1,    -1,    49,    -1,    -1,    -1,    29,    30,\n      -1,    32,    33,    34,    35,    36\n};\n\n  /* FFSTOS[STATE-NUM] -- The (internal number of the) accessing\n     symbol of state STATE-NUM.  */\nstatic const fftype_int8 ffstos[] =\n{\n       0,    57,     0,     1,     3,     4,     5,     6,     7,     8,\n       9,    10,    11,    12,    13,    14,    15,    16,    17,    18,\n      19,    20,    24,    36,    37,    45,    46,    47,    52,    54,\n      58,    59,    60,    61,    62,    63,    64,    52,    55,    61,\n      62,    63,    64,    61,    62,    63,    64,    61,    62,    64,\n       6,    55,     6,     6,    24,    24,    24,    24,    61,    62,\n      64,    61,    61,    62,    63,    61,    62,    61,    62,    61,\n      62,    63,    64,    21,    25,    21,    25,    22,    29,    30,\n      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,\n      41,    42,    43,    44,    49,    52,    26,    27,    28,    29,\n      30,    39,    49,    52,    29,    30,    32,    33,    34,    35,\n      36,    41,    42,    49,    52,    29,    30,    32,    33,    34,\n      35,    36,    52,    21,    55,    21,    55,    55,    21,    55,\n      21,    55,    55,    55,    21,    21,    55,    21,    21,    55,\n      61,    61,    61,    61,    55,    55,    55,    55,    61,    62,\n      61,    62,    61,    61,    61,    61,    61,    61,    61,    61,\n      61,    61,    61,    61,    62,    61,    61,    61,    61,    61,\n      61,    61,    62,    64,    62,    62,    62,    62,    61,    61,\n      45,    54,    63,    63,    63,    63,    63,    63,    63,    63,\n      63,    61,    64,    64,    64,    64,    64,    64,    64,    61,\n      62,    61,    64,    61,    64,    61,    61,    61,    25,    25,\n      25,    25,    23,    21,    53,    23,    23,    23,    21,    53,\n      63,    63,    21,    53,    21,    55,    55,    21,    55,    21,\n      55,    21,    55,    21,    21,    61,    61,    61,    62,    61,\n      62,    64,    61,    61,    61,    61,    61,     6,    61,    61,\n      21,    53,    21,    53,    21,    53,    21,    55,    21,    55,\n      21,    21,    55,    21,    55,    61,    61,    61,    61,    61,\n       6,     6,     6,    21,    53,    21,    53,    21,    53,    55,\n      21,    55,    21,    55,    61,    61,    61,    61,     6,    21,\n      53,    21,    53,    21,    53,    21,    55,    55,    61,    61,\n      61,    61,    53,    53,    53,    21,    61,    55\n};\n\n  /* FFR1[FFN] -- Symbol number of symbol that rule FFN derives.  */\nstatic const fftype_int8 ffr1[] =\n{\n       0,    56,    57,    57,    58,    58,    58,    58,    58,    58,\n      59,    59,    60,    60,    60,    60,    61,    62,    63,    63,\n      63,    63,    63,    63,    63,    63,    63,    63,    63,    63,\n      63,    61,    61,    61,    61,    61,    61,    61,    61,    61,\n      61,    61,    61,    61,    61,    61,    61,    61,    61,    61,\n      61,    61,    61,    61,    61,    61,    61,    61,    61,    61,\n      61,    61,    61,    61,    61,    61,    61,    61,    61,    61,\n      61,    62,    62,    62,    62,    62,    62,    62,    62,    62,\n      62,    62,    62,    62,    62,    62,    62,    62,    62,    62,\n      62,    62,    62,    62,    62,    62,    62,    62,    62,    62,\n      62,    62,    62,    62,    62,    62,    62,    62,    62,    62,\n      62,    62,    62,    62,    62,    62,    62,    62,    62,    62,\n      62,    62,    64,    64,    64,    64,    64,    64,    64,    64,\n      64\n};\n\n  /* FFR2[FFN] -- Number of symbols on the right hand side of rule FFN.  */\nstatic const fftype_int8 ffr2[] =\n{\n       0,     2,     0,     2,     1,     2,     2,     2,     2,     2,\n       2,     3,     2,     3,     3,     3,     2,     2,     1,     1,\n       4,     3,     3,     3,     4,     6,     8,    10,    12,     2,\n       3,     1,     1,     1,     4,     1,     1,     3,     3,     3,\n       3,     3,     3,     3,     3,     3,     2,     2,     3,     3,\n       3,     5,     5,     5,     2,     3,     3,     3,     3,     5,\n       5,     9,     4,     6,     8,    10,    12,     2,     2,     2,\n       2,     1,     1,     4,     3,     3,     3,     3,     3,     3,\n       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,\n       3,     3,     3,     3,     3,     3,     3,     5,     5,     3,\n       3,     3,     5,     7,    11,    15,     2,     3,     5,     9,\n       7,    11,     3,     7,     9,     4,     6,     8,    10,    12,\n       2,     3,     1,     1,     4,     1,     3,     3,     5,     5,\n       7\n};\n\n\nenum { FFENOMEM = -2 };\n\n#define fferrok         (fferrstatus = 0)\n#define ffclearin       (ffchar = FFEMPTY)\n\n#define FFACCEPT        goto ffacceptlab\n#define FFABORT         goto ffabortlab\n#define FFERROR         goto fferrorlab\n\n\n#define FFRECOVERING()  (!!fferrstatus)\n\n#define FFBACKUP(Token, Value)                                    \\\n  do                                                              \\\n    if (ffchar == FFEMPTY)                                        \\\n      {                                                           \\\n        ffchar = (Token);                                         \\\n        fflval = (Value);                                         \\\n        FFPOPSTACK (fflen);                                       \\\n        ffstate = *ffssp;                                         \\\n        goto ffbackup;                                            \\\n      }                                                           \\\n    else                                                          \\\n      {                                                           \\\n        fferror (FF_(\"syntax error: cannot back up\")); \\\n        FFERROR;                                                  \\\n      }                                                           \\\n  while (0)\n\n/* Backward compatibility with an undocumented macro.\n   Use FFerror or FFUNDEF. */\n#define FFERRCODE FFUNDEF\n\n\n/* Enable debugging if requested.  */\n#if FFDEBUG\n\n# ifndef FFFPRINTF\n#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */\n#  define FFFPRINTF fprintf\n# endif\n\n# define FFDPRINTF(Args)                        \\\ndo {                                            \\\n  if (ffdebug)                                  \\\n    FFFPRINTF Args;                             \\\n} while (0)\n\n/* This macro is provided for backward compatibility. */\n# ifndef FF_LOCATION_PRINT\n#  define FF_LOCATION_PRINT(File, Loc) ((void) 0)\n# endif\n\n\n# define FF_SYMBOL_PRINT(Title, Kind, Value, Location)                    \\\ndo {                                                                      \\\n  if (ffdebug)                                                            \\\n    {                                                                     \\\n      FFFPRINTF (stderr, \"%s \", Title);                                   \\\n      ff_symbol_print (stderr,                                            \\\n                  Kind, Value); \\\n      FFFPRINTF (stderr, \"\\n\");                                           \\\n    }                                                                     \\\n} while (0)\n\n\n/*-----------------------------------.\n| Print this symbol's value on FFO.  |\n`-----------------------------------*/\n\nstatic void\nff_symbol_value_print (FILE *ffo,\n                       ffsymbol_kind_t ffkind, FFSTYPE const * const ffvaluep)\n{\n  FILE *ffoutput = ffo;\n  FFUSE (ffoutput);\n  if (!ffvaluep)\n    return;\n# ifdef FFPRINT\n  if (ffkind < FFNTOKENS)\n    FFPRINT (ffo, fftoknum[ffkind], *ffvaluep);\n# endif\n  FF_IGNORE_MAYBE_UNINITIALIZED_BEGIN\n  FFUSE (ffkind);\n  FF_IGNORE_MAYBE_UNINITIALIZED_END\n}\n\n\n/*---------------------------.\n| Print this symbol on FFO.  |\n`---------------------------*/\n\nstatic void\nff_symbol_print (FILE *ffo,\n                 ffsymbol_kind_t ffkind, FFSTYPE const * const ffvaluep)\n{\n  FFFPRINTF (ffo, \"%s %s (\",\n             ffkind < FFNTOKENS ? \"token\" : \"nterm\", ffsymbol_name (ffkind));\n\n  ff_symbol_value_print (ffo, ffkind, ffvaluep);\n  FFFPRINTF (ffo, \")\");\n}\n\n/*------------------------------------------------------------------.\n| ff_stack_print -- Print the state stack from its BOTTOM up to its |\n| TOP (included).                                                   |\n`------------------------------------------------------------------*/\n\nstatic void\nff_stack_print (ff_state_t *ffbottom, ff_state_t *fftop)\n{\n  FFFPRINTF (stderr, \"Stack now\");\n  for (; ffbottom <= fftop; ffbottom++)\n    {\n      int ffbot = *ffbottom;\n      FFFPRINTF (stderr, \" %d\", ffbot);\n    }\n  FFFPRINTF (stderr, \"\\n\");\n}\n\n# define FF_STACK_PRINT(Bottom, Top)                            \\\ndo {                                                            \\\n  if (ffdebug)                                                  \\\n    ff_stack_print ((Bottom), (Top));                           \\\n} while (0)\n\n\n/*------------------------------------------------.\n| Report that the FFRULE is going to be reduced.  |\n`------------------------------------------------*/\n\nstatic void\nff_reduce_print (ff_state_t *ffssp, FFSTYPE *ffvsp,\n                 int ffrule)\n{\n  int fflno = ffrline[ffrule];\n  int ffnrhs = ffr2[ffrule];\n  int ffi;\n  FFFPRINTF (stderr, \"Reducing stack by rule %d (line %d):\\n\",\n             ffrule - 1, fflno);\n  /* The symbols being reduced.  */\n  for (ffi = 0; ffi < ffnrhs; ffi++)\n    {\n      FFFPRINTF (stderr, \"   $%d = \", ffi + 1);\n      ff_symbol_print (stderr,\n                       FF_ACCESSING_SYMBOL (+ffssp[ffi + 1 - ffnrhs]),\n                       &ffvsp[(ffi + 1) - (ffnrhs)]);\n      FFFPRINTF (stderr, \"\\n\");\n    }\n}\n\n# define FF_REDUCE_PRINT(Rule)          \\\ndo {                                    \\\n  if (ffdebug)                          \\\n    ff_reduce_print (ffssp, ffvsp, Rule); \\\n} while (0)\n\n/* Nonzero means print parse trace.  It is left uninitialized so that\n   multiple parsers can coexist.  */\nint ffdebug;\n#else /* !FFDEBUG */\n# define FFDPRINTF(Args) ((void) 0)\n# define FF_SYMBOL_PRINT(Title, Kind, Value, Location)\n# define FF_STACK_PRINT(Bottom, Top)\n# define FF_REDUCE_PRINT(Rule)\n#endif /* !FFDEBUG */\n\n\n/* FFINITDEPTH -- initial size of the parser's stacks.  */\n#ifndef FFINITDEPTH\n# define FFINITDEPTH 200\n#endif\n\n/* FFMAXDEPTH -- maximum size the stacks can grow to (effective only\n   if the built-in stack extension method is used).\n\n   Do not make this value too large; the results are undefined if\n   FFSTACK_ALLOC_MAXIMUM < FFSTACK_BYTES (FFMAXDEPTH)\n   evaluated with infinite-precision integer arithmetic.  */\n\n#ifndef FFMAXDEPTH\n# define FFMAXDEPTH 10000\n#endif\n\n\n\n\n\n\n/*-----------------------------------------------.\n| Release the memory associated to this symbol.  |\n`-----------------------------------------------*/\n\nstatic void\nffdestruct (const char *ffmsg,\n            ffsymbol_kind_t ffkind, FFSTYPE *ffvaluep)\n{\n  FFUSE (ffvaluep);\n  if (!ffmsg)\n    ffmsg = \"Deleting\";\n  FF_SYMBOL_PRINT (ffmsg, ffkind, ffvaluep, fflocationp);\n\n  FF_IGNORE_MAYBE_UNINITIALIZED_BEGIN\n  FFUSE (ffkind);\n  FF_IGNORE_MAYBE_UNINITIALIZED_END\n}\n\n\n/* Lookahead token kind.  */\nint ffchar;\n\n/* The semantic value of the lookahead symbol.  */\nFFSTYPE fflval;\n/* Number of syntax errors so far.  */\nint ffnerrs;\n\n\n\n\n/*----------.\n| ffparse.  |\n`----------*/\n\nint\nffparse (void)\n{\n    ff_state_fast_t ffstate = 0;\n    /* Number of tokens to shift before error messages enabled.  */\n    int fferrstatus = 0;\n\n    /* Refer to the stacks through separate pointers, to allow ffoverflow\n       to reallocate them elsewhere.  */\n\n    /* Their size.  */\n    FFPTRDIFF_T ffstacksize = FFINITDEPTH;\n\n    /* The state stack: array, bottom, top.  */\n    ff_state_t ffssa[FFINITDEPTH];\n    ff_state_t *ffss = ffssa;\n    ff_state_t *ffssp = ffss;\n\n    /* The semantic value stack: array, bottom, top.  */\n    FFSTYPE ffvsa[FFINITDEPTH];\n    FFSTYPE *ffvs = ffvsa;\n    FFSTYPE *ffvsp = ffvs;\n\n  int ffn;\n  /* The return value of ffparse.  */\n  int ffresult;\n  /* Lookahead symbol kind.  */\n  ffsymbol_kind_t fftoken = FFSYMBOL_FFEMPTY;\n  /* The variables used to return semantic value and location from the\n     action routines.  */\n  FFSTYPE ffval;\n\n\n\n#define FFPOPSTACK(N)   (ffvsp -= (N), ffssp -= (N))\n\n  /* The number of symbols on the RHS of the reduced rule.\n     Keep to zero when no symbol should be popped.  */\n  int fflen = 0;\n\n  FFDPRINTF ((stderr, \"Starting parse\\n\"));\n\n  ffchar = FFEMPTY; /* Cause a token to be read.  */\n  goto ffsetstate;\n\n\n/*------------------------------------------------------------.\n| ffnewstate -- push a new state, which is found in ffstate.  |\n`------------------------------------------------------------*/\nffnewstate:\n  /* In all cases, when you get here, the value and location stacks\n     have just been pushed.  So pushing a state here evens the stacks.  */\n  ffssp++;\n\n\n/*--------------------------------------------------------------------.\n| ffsetstate -- set current state (the top of the stack) to ffstate.  |\n`--------------------------------------------------------------------*/\nffsetstate:\n  FFDPRINTF ((stderr, \"Entering state %d\\n\", ffstate));\n  FF_ASSERT (0 <= ffstate && ffstate < FFNSTATES);\n  FF_IGNORE_USELESS_CAST_BEGIN\n  *ffssp = FF_CAST (ff_state_t, ffstate);\n  FF_IGNORE_USELESS_CAST_END\n  FF_STACK_PRINT (ffss, ffssp);\n\n  if (ffss + ffstacksize - 1 <= ffssp)\n#if !defined ffoverflow && !defined FFSTACK_RELOCATE\n    goto ffexhaustedlab;\n#else\n    {\n      /* Get the current used size of the three stacks, in elements.  */\n      FFPTRDIFF_T ffsize = ffssp - ffss + 1;\n\n# if defined ffoverflow\n      {\n        /* Give user a chance to reallocate the stack.  Use copies of\n           these so that the &'s don't force the real ones into\n           memory.  */\n        ff_state_t *ffss1 = ffss;\n        FFSTYPE *ffvs1 = ffvs;\n\n        /* Each stack pointer address is followed by the size of the\n           data in use in that stack, in bytes.  This used to be a\n           conditional around just the two extra args, but that might\n           be undefined if ffoverflow is a macro.  */\n        ffoverflow (FF_(\"memory exhausted\"),\n                    &ffss1, ffsize * FFSIZEOF (*ffssp),\n                    &ffvs1, ffsize * FFSIZEOF (*ffvsp),\n                    &ffstacksize);\n        ffss = ffss1;\n        ffvs = ffvs1;\n      }\n# else /* defined FFSTACK_RELOCATE */\n      /* Extend the stack our own way.  */\n      if (FFMAXDEPTH <= ffstacksize)\n        goto ffexhaustedlab;\n      ffstacksize *= 2;\n      if (FFMAXDEPTH < ffstacksize)\n        ffstacksize = FFMAXDEPTH;\n\n      {\n        ff_state_t *ffss1 = ffss;\n        union ffalloc *ffptr =\n          FF_CAST (union ffalloc *,\n                   FFSTACK_ALLOC (FF_CAST (FFSIZE_T, FFSTACK_BYTES (ffstacksize))));\n        if (! ffptr)\n          goto ffexhaustedlab;\n        FFSTACK_RELOCATE (ffss_alloc, ffss);\n        FFSTACK_RELOCATE (ffvs_alloc, ffvs);\n#  undef FFSTACK_RELOCATE\n        if (ffss1 != ffssa)\n          FFSTACK_FREE (ffss1);\n      }\n# endif\n\n      ffssp = ffss + ffsize - 1;\n      ffvsp = ffvs + ffsize - 1;\n\n      FF_IGNORE_USELESS_CAST_BEGIN\n      FFDPRINTF ((stderr, \"Stack size increased to %ld\\n\",\n                  FF_CAST (long, ffstacksize)));\n      FF_IGNORE_USELESS_CAST_END\n\n      if (ffss + ffstacksize - 1 <= ffssp)\n        FFABORT;\n    }\n#endif /* !defined ffoverflow && !defined FFSTACK_RELOCATE */\n\n  if (ffstate == FFFINAL)\n    FFACCEPT;\n\n  goto ffbackup;\n\n\n/*-----------.\n| ffbackup.  |\n`-----------*/\nffbackup:\n  /* Do appropriate processing given the current state.  Read a\n     lookahead token if we need one and don't already have one.  */\n\n  /* First try to decide what to do without reference to lookahead token.  */\n  ffn = ffpact[ffstate];\n  if (ffpact_value_is_default (ffn))\n    goto ffdefault;\n\n  /* Not known => get a lookahead token if don't already have one.  */\n\n  /* FFCHAR is either empty, or end-of-input, or a valid lookahead.  */\n  if (ffchar == FFEMPTY)\n    {\n      FFDPRINTF ((stderr, \"Reading a token\\n\"));\n      ffchar = fflex ();\n    }\n\n  if (ffchar <= FFEOF)\n    {\n      ffchar = FFEOF;\n      fftoken = FFSYMBOL_FFEOF;\n      FFDPRINTF ((stderr, \"Now at end of input.\\n\"));\n    }\n  else if (ffchar == FFerror)\n    {\n      /* The scanner already issued an error message, process directly\n         to error recovery.  But do not keep the error token as\n         lookahead, it is too special and may lead us to an endless\n         loop in error recovery. */\n      ffchar = FFUNDEF;\n      fftoken = FFSYMBOL_FFerror;\n      goto fferrlab1;\n    }\n  else\n    {\n      fftoken = FFTRANSLATE (ffchar);\n      FF_SYMBOL_PRINT (\"Next token is\", fftoken, &fflval, &fflloc);\n    }\n\n  /* If the proper action on seeing token FFTOKEN is to reduce or to\n     detect an error, take that action.  */\n  ffn += fftoken;\n  if (ffn < 0 || FFLAST < ffn || ffcheck[ffn] != fftoken)\n    goto ffdefault;\n  ffn = fftable[ffn];\n  if (ffn <= 0)\n    {\n      if (fftable_value_is_error (ffn))\n        goto fferrlab;\n      ffn = -ffn;\n      goto ffreduce;\n    }\n\n  /* Count tokens shifted since error; after three, turn off error\n     status.  */\n  if (fferrstatus)\n    fferrstatus--;\n\n  /* Shift the lookahead token.  */\n  FF_SYMBOL_PRINT (\"Shifting\", fftoken, &fflval, &fflloc);\n  ffstate = ffn;\n  FF_IGNORE_MAYBE_UNINITIALIZED_BEGIN\n  *++ffvsp = fflval;\n  FF_IGNORE_MAYBE_UNINITIALIZED_END\n\n  /* Discard the shifted token.  */\n  ffchar = FFEMPTY;\n  goto ffnewstate;\n\n\n/*-----------------------------------------------------------.\n| ffdefault -- do the default action for the current state.  |\n`-----------------------------------------------------------*/\nffdefault:\n  ffn = ffdefact[ffstate];\n  if (ffn == 0)\n    goto fferrlab;\n  goto ffreduce;\n\n\n/*-----------------------------.\n| ffreduce -- do a reduction.  |\n`-----------------------------*/\nffreduce:\n  /* ffn is the number of a rule to reduce with.  */\n  fflen = ffr2[ffn];\n\n  /* If FFLEN is nonzero, implement the default value of the action:\n     '$$ = $1'.\n\n     Otherwise, the following line sets FFVAL to garbage.\n     This behavior is undocumented and Bison\n     users should not rely upon it.  Assigning to FFVAL\n     unconditionally makes the parser a bit smaller, and it avoids a\n     GCC warning that FFVAL may be used uninitialized.  */\n  ffval = ffvsp[1-fflen];\n\n\n  FF_REDUCE_PRINT (ffn);\n  switch (ffn)\n    {\n  case 4: /* line: '\\n'  */\n#line 256 \"eval.y\"\n                     {}\n#line 1913 \"y.tab.c\"\n    break;\n\n  case 5: /* line: expr '\\n'  */\n#line 258 \"eval.y\"\n                { if( (ffvsp[-1].Node)<0 ) {\n\t\t     fferror(\"Couldn't build node structure: out of memory?\");\n\t\t     FFERROR;  }\n                  gParse.resultNode = (ffvsp[-1].Node);\n\t\t}\n#line 1923 \"y.tab.c\"\n    break;\n\n  case 6: /* line: bexpr '\\n'  */\n#line 264 \"eval.y\"\n                { if( (ffvsp[-1].Node)<0 ) {\n\t\t     fferror(\"Couldn't build node structure: out of memory?\");\n\t\t     FFERROR;  }\n                  gParse.resultNode = (ffvsp[-1].Node);\n\t\t}\n#line 1933 \"y.tab.c\"\n    break;\n\n  case 7: /* line: sexpr '\\n'  */\n#line 270 \"eval.y\"\n                { if( (ffvsp[-1].Node)<0 ) {\n\t\t     fferror(\"Couldn't build node structure: out of memory?\");\n\t\t     FFERROR;  } \n                  gParse.resultNode = (ffvsp[-1].Node);\n\t\t}\n#line 1943 \"y.tab.c\"\n    break;\n\n  case 8: /* line: bits '\\n'  */\n#line 276 \"eval.y\"\n                { if( (ffvsp[-1].Node)<0 ) {\n\t\t     fferror(\"Couldn't build node structure: out of memory?\");\n\t\t     FFERROR;  }\n                  gParse.resultNode = (ffvsp[-1].Node);\n\t\t}\n#line 1953 \"y.tab.c\"\n    break;\n\n  case 9: /* line: error '\\n'  */\n#line 281 \"eval.y\"\n                     {  fferrok;  }\n#line 1959 \"y.tab.c\"\n    break;\n\n  case 10: /* bvector: '{' bexpr  */\n#line 285 \"eval.y\"\n                { (ffval.Node) = New_Vector( (ffvsp[0].Node) ); TEST((ffval.Node)); }\n#line 1965 \"y.tab.c\"\n    break;\n\n  case 11: /* bvector: bvector ',' bexpr  */\n#line 287 \"eval.y\"\n                {\n                  if( gParse.Nodes[(ffvsp[-2].Node)].nSubNodes >= MAXSUBS ) {\n\t\t     (ffvsp[-2].Node) = Close_Vec( (ffvsp[-2].Node) ); TEST((ffvsp[-2].Node));\n\t\t     (ffval.Node) = New_Vector( (ffvsp[-2].Node) ); TEST((ffval.Node));\n                  } else {\n                     (ffval.Node) = (ffvsp[-2].Node);\n                  }\n\t\t  gParse.Nodes[(ffval.Node)].SubNodes[ gParse.Nodes[(ffval.Node)].nSubNodes++ ]\n\t\t     = (ffvsp[0].Node);\n                }\n#line 1980 \"y.tab.c\"\n    break;\n\n  case 12: /* vector: '{' expr  */\n#line 300 \"eval.y\"\n                { (ffval.Node) = New_Vector( (ffvsp[0].Node) ); TEST((ffval.Node)); }\n#line 1986 \"y.tab.c\"\n    break;\n\n  case 13: /* vector: vector ',' expr  */\n#line 302 \"eval.y\"\n                {\n                  if( TYPE((ffvsp[-2].Node)) < TYPE((ffvsp[0].Node)) )\n                     TYPE((ffvsp[-2].Node)) = TYPE((ffvsp[0].Node));\n                  if( gParse.Nodes[(ffvsp[-2].Node)].nSubNodes >= MAXSUBS ) {\n\t\t     (ffvsp[-2].Node) = Close_Vec( (ffvsp[-2].Node) ); TEST((ffvsp[-2].Node));\n\t\t     (ffval.Node) = New_Vector( (ffvsp[-2].Node) ); TEST((ffval.Node));\n                  } else {\n                     (ffval.Node) = (ffvsp[-2].Node);\n                  }\n\t\t  gParse.Nodes[(ffval.Node)].SubNodes[ gParse.Nodes[(ffval.Node)].nSubNodes++ ]\n\t\t     = (ffvsp[0].Node);\n                }\n#line 2003 \"y.tab.c\"\n    break;\n\n  case 14: /* vector: vector ',' bexpr  */\n#line 315 \"eval.y\"\n                {\n                  if( gParse.Nodes[(ffvsp[-2].Node)].nSubNodes >= MAXSUBS ) {\n\t\t     (ffvsp[-2].Node) = Close_Vec( (ffvsp[-2].Node) ); TEST((ffvsp[-2].Node));\n\t\t     (ffval.Node) = New_Vector( (ffvsp[-2].Node) ); TEST((ffval.Node));\n                  } else {\n                     (ffval.Node) = (ffvsp[-2].Node);\n                  }\n\t\t  gParse.Nodes[(ffval.Node)].SubNodes[ gParse.Nodes[(ffval.Node)].nSubNodes++ ]\n\t\t     = (ffvsp[0].Node);\n                }\n#line 2018 \"y.tab.c\"\n    break;\n\n  case 15: /* vector: bvector ',' expr  */\n#line 326 \"eval.y\"\n                {\n                  TYPE((ffvsp[-2].Node)) = TYPE((ffvsp[0].Node));\n                  if( gParse.Nodes[(ffvsp[-2].Node)].nSubNodes >= MAXSUBS ) {\n\t\t     (ffvsp[-2].Node) = Close_Vec( (ffvsp[-2].Node) ); TEST((ffvsp[-2].Node));\n\t\t     (ffval.Node) = New_Vector( (ffvsp[-2].Node) ); TEST((ffval.Node));\n                  } else {\n                     (ffval.Node) = (ffvsp[-2].Node);\n                  }\n\t\t  gParse.Nodes[(ffval.Node)].SubNodes[ gParse.Nodes[(ffval.Node)].nSubNodes++ ]\n\t\t     = (ffvsp[0].Node);\n                }\n#line 2034 \"y.tab.c\"\n    break;\n\n  case 16: /* expr: vector '}'  */\n#line 340 \"eval.y\"\n                { (ffval.Node) = Close_Vec( (ffvsp[-1].Node) ); TEST((ffval.Node)); }\n#line 2040 \"y.tab.c\"\n    break;\n\n  case 17: /* bexpr: bvector '}'  */\n#line 344 \"eval.y\"\n                { (ffval.Node) = Close_Vec( (ffvsp[-1].Node) ); TEST((ffval.Node)); }\n#line 2046 \"y.tab.c\"\n    break;\n\n  case 18: /* bits: BITSTR  */\n#line 348 \"eval.y\"\n                {\n                  (ffval.Node) = New_Const( BITSTR, (ffvsp[0].str), strlen((ffvsp[0].str))+1 ); TEST((ffval.Node));\n\t\t  SIZE((ffval.Node)) = strlen((ffvsp[0].str)); }\n#line 2054 \"y.tab.c\"\n    break;\n\n  case 19: /* bits: BITCOL  */\n#line 352 \"eval.y\"\n                { (ffval.Node) = New_Column( (ffvsp[0].lng) ); TEST((ffval.Node)); }\n#line 2060 \"y.tab.c\"\n    break;\n\n  case 20: /* bits: BITCOL '{' expr '}'  */\n#line 354 \"eval.y\"\n                {\n                  if( TYPE((ffvsp[-1].Node)) != LONG\n\t\t      || OPER((ffvsp[-1].Node)) != CONST_OP ) {\n\t\t     fferror(\"Offset argument must be a constant integer\");\n\t\t     FFERROR;\n\t\t  }\n                  (ffval.Node) = New_Offset( (ffvsp[-3].lng), (ffvsp[-1].Node) ); TEST((ffval.Node));\n                }\n#line 2073 \"y.tab.c\"\n    break;\n\n  case 21: /* bits: bits '&' bits  */\n#line 363 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BITSTR, (ffvsp[-2].Node), '&', (ffvsp[0].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = ( SIZE((ffvsp[-2].Node))>SIZE((ffvsp[0].Node)) ? SIZE((ffvsp[-2].Node)) : SIZE((ffvsp[0].Node)) );  }\n#line 2080 \"y.tab.c\"\n    break;\n\n  case 22: /* bits: bits '|' bits  */\n#line 366 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BITSTR, (ffvsp[-2].Node), '|', (ffvsp[0].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = ( SIZE((ffvsp[-2].Node))>SIZE((ffvsp[0].Node)) ? SIZE((ffvsp[-2].Node)) : SIZE((ffvsp[0].Node)) );  }\n#line 2087 \"y.tab.c\"\n    break;\n\n  case 23: /* bits: bits '+' bits  */\n#line 369 \"eval.y\"\n                { \n\t\t  if (SIZE((ffvsp[-2].Node))+SIZE((ffvsp[0].Node)) >= MAX_STRLEN) {\n\t\t    fferror(\"Combined bit string size exceeds \" MAX_STRLEN_S \" bits\");\n\t\t    FFERROR;\n\t\t  }\n\t\t  (ffval.Node) = New_BinOp( BITSTR, (ffvsp[-2].Node), '+', (ffvsp[0].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = SIZE((ffvsp[-2].Node)) + SIZE((ffvsp[0].Node)); \n\t\t}\n#line 2100 \"y.tab.c\"\n    break;\n\n  case 24: /* bits: bits '[' expr ']'  */\n#line 378 \"eval.y\"\n                { (ffval.Node) = New_Deref( (ffvsp[-3].Node), 1, (ffvsp[-1].Node),  0,  0,  0,   0 ); TEST((ffval.Node)); }\n#line 2106 \"y.tab.c\"\n    break;\n\n  case 25: /* bits: bits '[' expr ',' expr ']'  */\n#line 380 \"eval.y\"\n                { (ffval.Node) = New_Deref( (ffvsp[-5].Node), 2, (ffvsp[-3].Node), (ffvsp[-1].Node),  0,  0,   0 ); TEST((ffval.Node)); }\n#line 2112 \"y.tab.c\"\n    break;\n\n  case 26: /* bits: bits '[' expr ',' expr ',' expr ']'  */\n#line 382 \"eval.y\"\n                { (ffval.Node) = New_Deref( (ffvsp[-7].Node), 3, (ffvsp[-5].Node), (ffvsp[-3].Node), (ffvsp[-1].Node),  0,   0 ); TEST((ffval.Node)); }\n#line 2118 \"y.tab.c\"\n    break;\n\n  case 27: /* bits: bits '[' expr ',' expr ',' expr ',' expr ']'  */\n#line 384 \"eval.y\"\n                { (ffval.Node) = New_Deref( (ffvsp[-9].Node), 4, (ffvsp[-7].Node), (ffvsp[-5].Node), (ffvsp[-3].Node), (ffvsp[-1].Node),   0 ); TEST((ffval.Node)); }\n#line 2124 \"y.tab.c\"\n    break;\n\n  case 28: /* bits: bits '[' expr ',' expr ',' expr ',' expr ',' expr ']'  */\n#line 386 \"eval.y\"\n                { (ffval.Node) = New_Deref( (ffvsp[-11].Node), 5, (ffvsp[-9].Node), (ffvsp[-7].Node), (ffvsp[-5].Node), (ffvsp[-3].Node), (ffvsp[-1].Node) ); TEST((ffval.Node)); }\n#line 2130 \"y.tab.c\"\n    break;\n\n  case 29: /* bits: NOT bits  */\n#line 388 \"eval.y\"\n                { (ffval.Node) = New_Unary( BITSTR, NOT, (ffvsp[0].Node) ); TEST((ffval.Node));     }\n#line 2136 \"y.tab.c\"\n    break;\n\n  case 30: /* bits: '(' bits ')'  */\n#line 391 \"eval.y\"\n                { (ffval.Node) = (ffvsp[-1].Node); }\n#line 2142 \"y.tab.c\"\n    break;\n\n  case 31: /* expr: LONG  */\n#line 395 \"eval.y\"\n                { (ffval.Node) = New_Const( LONG,   &((ffvsp[0].lng)), sizeof(long)   ); TEST((ffval.Node)); }\n#line 2148 \"y.tab.c\"\n    break;\n\n  case 32: /* expr: DOUBLE  */\n#line 397 \"eval.y\"\n                { (ffval.Node) = New_Const( DOUBLE, &((ffvsp[0].dbl)), sizeof(double) ); TEST((ffval.Node)); }\n#line 2154 \"y.tab.c\"\n    break;\n\n  case 33: /* expr: COLUMN  */\n#line 399 \"eval.y\"\n                { (ffval.Node) = New_Column( (ffvsp[0].lng) ); TEST((ffval.Node)); }\n#line 2160 \"y.tab.c\"\n    break;\n\n  case 34: /* expr: COLUMN '{' expr '}'  */\n#line 401 \"eval.y\"\n                {\n                  if( TYPE((ffvsp[-1].Node)) != LONG\n\t\t      || OPER((ffvsp[-1].Node)) != CONST_OP ) {\n\t\t     fferror(\"Offset argument must be a constant integer\");\n\t\t     FFERROR;\n\t\t  }\n                  (ffval.Node) = New_Offset( (ffvsp[-3].lng), (ffvsp[-1].Node) ); TEST((ffval.Node));\n                }\n#line 2173 \"y.tab.c\"\n    break;\n\n  case 35: /* expr: ROWREF  */\n#line 410 \"eval.y\"\n                { (ffval.Node) = New_Func( LONG, row_fct,  0, 0, 0, 0, 0, 0, 0, 0 ); }\n#line 2179 \"y.tab.c\"\n    break;\n\n  case 36: /* expr: NULLREF  */\n#line 412 \"eval.y\"\n                { (ffval.Node) = New_Func( LONG, null_fct, 0, 0, 0, 0, 0, 0, 0, 0 ); }\n#line 2185 \"y.tab.c\"\n    break;\n\n  case 37: /* expr: expr '%' expr  */\n#line 414 \"eval.y\"\n                { PROMOTE((ffvsp[-2].Node),(ffvsp[0].Node)); (ffval.Node) = New_BinOp( TYPE((ffvsp[-2].Node)), (ffvsp[-2].Node), '%', (ffvsp[0].Node) );\n\t\t  TEST((ffval.Node));                                                }\n#line 2192 \"y.tab.c\"\n    break;\n\n  case 38: /* expr: expr '+' expr  */\n#line 417 \"eval.y\"\n                { PROMOTE((ffvsp[-2].Node),(ffvsp[0].Node)); (ffval.Node) = New_BinOp( TYPE((ffvsp[-2].Node)), (ffvsp[-2].Node), '+', (ffvsp[0].Node) );\n\t\t  TEST((ffval.Node));                                                }\n#line 2199 \"y.tab.c\"\n    break;\n\n  case 39: /* expr: expr '-' expr  */\n#line 420 \"eval.y\"\n                { PROMOTE((ffvsp[-2].Node),(ffvsp[0].Node)); (ffval.Node) = New_BinOp( TYPE((ffvsp[-2].Node)), (ffvsp[-2].Node), '-', (ffvsp[0].Node) ); \n\t\t  TEST((ffval.Node));                                                }\n#line 2206 \"y.tab.c\"\n    break;\n\n  case 40: /* expr: expr '*' expr  */\n#line 423 \"eval.y\"\n                { PROMOTE((ffvsp[-2].Node),(ffvsp[0].Node)); (ffval.Node) = New_BinOp( TYPE((ffvsp[-2].Node)), (ffvsp[-2].Node), '*', (ffvsp[0].Node) ); \n\t\t  TEST((ffval.Node));                                                }\n#line 2213 \"y.tab.c\"\n    break;\n\n  case 41: /* expr: expr '/' expr  */\n#line 426 \"eval.y\"\n                { PROMOTE((ffvsp[-2].Node),(ffvsp[0].Node)); (ffval.Node) = New_BinOp( TYPE((ffvsp[-2].Node)), (ffvsp[-2].Node), '/', (ffvsp[0].Node) ); \n\t\t  TEST((ffval.Node));                                                }\n#line 2220 \"y.tab.c\"\n    break;\n\n  case 42: /* expr: expr '&' expr  */\n#line 429 \"eval.y\"\n                { \n                   if (TYPE((ffvsp[-2].Node)) != LONG ||\n\t\t       TYPE((ffvsp[0].Node)) != LONG) {\n                     fferror(\"Bitwise operations with incompatible types; only (bit OP bit) and (int OP int) are allowed\");\n                      FFERROR;\n                   }\n                   (ffval.Node) = New_BinOp( TYPE((ffvsp[-2].Node)), (ffvsp[-2].Node), '&', (ffvsp[0].Node) );\n                }\n#line 2233 \"y.tab.c\"\n    break;\n\n  case 43: /* expr: expr '|' expr  */\n#line 438 \"eval.y\"\n                { \n                   if (TYPE((ffvsp[-2].Node)) != LONG ||\n\t\t       TYPE((ffvsp[0].Node)) != LONG) {\n                     fferror(\"Bitwise operations with incompatible types; only (bit OP bit) and (int OP int) are allowed\");\n                      FFERROR;\n                   }\n                   (ffval.Node) = New_BinOp( TYPE((ffvsp[-2].Node)), (ffvsp[-2].Node), '|', (ffvsp[0].Node) );\n                }\n#line 2246 \"y.tab.c\"\n    break;\n\n  case 44: /* expr: expr XOR expr  */\n#line 447 \"eval.y\"\n                { \n                   if (TYPE((ffvsp[-2].Node)) != LONG ||\n\t\t       TYPE((ffvsp[0].Node)) != LONG) {\n                     fferror(\"Bitwise operations with incompatible types; only (bit OP bit) and (int OP int) are allowed\");\n                      FFERROR;\n                   }\n                   (ffval.Node) = New_BinOp( TYPE((ffvsp[-2].Node)), (ffvsp[-2].Node), '^', (ffvsp[0].Node) );\n                }\n#line 2259 \"y.tab.c\"\n    break;\n\n  case 45: /* expr: expr POWER expr  */\n#line 456 \"eval.y\"\n                { PROMOTE((ffvsp[-2].Node),(ffvsp[0].Node)); (ffval.Node) = New_BinOp( TYPE((ffvsp[-2].Node)), (ffvsp[-2].Node), POWER, (ffvsp[0].Node) );\n\t\t  TEST((ffval.Node));                                                }\n#line 2266 \"y.tab.c\"\n    break;\n\n  case 46: /* expr: '+' expr  */\n#line 459 \"eval.y\"\n                { (ffval.Node) = (ffvsp[0].Node); }\n#line 2272 \"y.tab.c\"\n    break;\n\n  case 47: /* expr: '-' expr  */\n#line 461 \"eval.y\"\n                { (ffval.Node) = New_Unary( TYPE((ffvsp[0].Node)), UMINUS, (ffvsp[0].Node) ); TEST((ffval.Node)); }\n#line 2278 \"y.tab.c\"\n    break;\n\n  case 48: /* expr: '(' expr ')'  */\n#line 463 \"eval.y\"\n                { (ffval.Node) = (ffvsp[-1].Node); }\n#line 2284 \"y.tab.c\"\n    break;\n\n  case 49: /* expr: expr '*' bexpr  */\n#line 465 \"eval.y\"\n                { (ffvsp[0].Node) = New_Unary( TYPE((ffvsp[-2].Node)), 0, (ffvsp[0].Node) );\n                  (ffval.Node) = New_BinOp( TYPE((ffvsp[-2].Node)), (ffvsp[-2].Node), '*', (ffvsp[0].Node) ); \n\t\t  TEST((ffval.Node));                                }\n#line 2292 \"y.tab.c\"\n    break;\n\n  case 50: /* expr: bexpr '*' expr  */\n#line 469 \"eval.y\"\n                { (ffvsp[-2].Node) = New_Unary( TYPE((ffvsp[0].Node)), 0, (ffvsp[-2].Node) );\n                  (ffval.Node) = New_BinOp( TYPE((ffvsp[0].Node)), (ffvsp[-2].Node), '*', (ffvsp[0].Node) );\n                  TEST((ffval.Node));                                }\n#line 2300 \"y.tab.c\"\n    break;\n\n  case 51: /* expr: bexpr '?' expr ':' expr  */\n#line 473 \"eval.y\"\n                {\n                  PROMOTE((ffvsp[-2].Node),(ffvsp[0].Node));\n                  if( ! Test_Dims((ffvsp[-2].Node),(ffvsp[0].Node)) ) {\n                     fferror(\"Incompatible dimensions in '?:' arguments\");\n\t\t     FFERROR;\n                  }\n                  (ffval.Node) = New_Func( 0, ifthenelse_fct, 3, (ffvsp[-2].Node), (ffvsp[0].Node), (ffvsp[-4].Node),\n                                 0, 0, 0, 0 );\n                  TEST((ffval.Node));\n                  if( SIZE((ffvsp[-2].Node))<SIZE((ffvsp[0].Node)) )  Copy_Dims((ffval.Node), (ffvsp[0].Node));\n                  TYPE((ffvsp[-4].Node)) = TYPE((ffvsp[-2].Node));\n                  if( ! Test_Dims((ffvsp[-4].Node),(ffval.Node)) ) {\n                     fferror(\"Incompatible dimensions in '?:' condition\");\n\t\t     FFERROR;\n                  }\n                  TYPE((ffvsp[-4].Node)) = BOOLEAN;\n                  if( SIZE((ffval.Node))<SIZE((ffvsp[-4].Node)) )  Copy_Dims((ffval.Node), (ffvsp[-4].Node));\n                }\n#line 2323 \"y.tab.c\"\n    break;\n\n  case 52: /* expr: bexpr '?' bexpr ':' expr  */\n#line 492 \"eval.y\"\n                {\n                  PROMOTE((ffvsp[-2].Node),(ffvsp[0].Node));\n                  if( ! Test_Dims((ffvsp[-2].Node),(ffvsp[0].Node)) ) {\n                     fferror(\"Incompatible dimensions in '?:' arguments\");\n\t\t     FFERROR;\n                  }\n                  (ffval.Node) = New_Func( 0, ifthenelse_fct, 3, (ffvsp[-2].Node), (ffvsp[0].Node), (ffvsp[-4].Node),\n                                 0, 0, 0, 0 );\n                  TEST((ffval.Node));\n                  if( SIZE((ffvsp[-2].Node))<SIZE((ffvsp[0].Node)) )  Copy_Dims((ffval.Node), (ffvsp[0].Node));\n                  TYPE((ffvsp[-4].Node)) = TYPE((ffvsp[-2].Node));\n                  if( ! Test_Dims((ffvsp[-4].Node),(ffval.Node)) ) {\n                     fferror(\"Incompatible dimensions in '?:' condition\");\n\t\t     FFERROR;\n                  }\n                  TYPE((ffvsp[-4].Node)) = BOOLEAN;\n                  if( SIZE((ffval.Node))<SIZE((ffvsp[-4].Node)) )  Copy_Dims((ffval.Node), (ffvsp[-4].Node));\n                }\n#line 2346 \"y.tab.c\"\n    break;\n\n  case 53: /* expr: bexpr '?' expr ':' bexpr  */\n#line 511 \"eval.y\"\n                {\n                  PROMOTE((ffvsp[-2].Node),(ffvsp[0].Node));\n                  if( ! Test_Dims((ffvsp[-2].Node),(ffvsp[0].Node)) ) {\n                     fferror(\"Incompatible dimensions in '?:' arguments\");\n\t\t     FFERROR;\n                  }\n                  (ffval.Node) = New_Func( 0, ifthenelse_fct, 3, (ffvsp[-2].Node), (ffvsp[0].Node), (ffvsp[-4].Node),\n                                 0, 0, 0, 0 );\n                  TEST((ffval.Node));\n                  if( SIZE((ffvsp[-2].Node))<SIZE((ffvsp[0].Node)) )  Copy_Dims((ffval.Node), (ffvsp[0].Node));\n                  TYPE((ffvsp[-4].Node)) = TYPE((ffvsp[-2].Node));\n                  if( ! Test_Dims((ffvsp[-4].Node),(ffval.Node)) ) {\n                     fferror(\"Incompatible dimensions in '?:' condition\");\n\t\t     FFERROR;\n                  }\n                  TYPE((ffvsp[-4].Node)) = BOOLEAN;\n                  if( SIZE((ffval.Node))<SIZE((ffvsp[-4].Node)) )  Copy_Dims((ffval.Node), (ffvsp[-4].Node));\n                }\n#line 2369 \"y.tab.c\"\n    break;\n\n  case 54: /* expr: FUNCTION ')'  */\n#line 530 \"eval.y\"\n                { if (FSTRCMP((ffvsp[-1].str),\"RANDOM(\") == 0) {  /* Scalar RANDOM() */\n                     (ffval.Node) = New_Func( DOUBLE, rnd_fct, 0, 0, 0, 0, 0, 0, 0, 0 );\n\t\t  } else if (FSTRCMP((ffvsp[-1].str),\"RANDOMN(\") == 0) {/*Scalar RANDOMN()*/\n\t\t     (ffval.Node) = New_Func( DOUBLE, gasrnd_fct, 0, 0, 0, 0, 0, 0, 0, 0 );\n                  } else {\n                     fferror(\"Function() not supported\");\n\t\t     FFERROR;\n\t\t  }\n                  TEST((ffval.Node)); \n                }\n#line 2384 \"y.tab.c\"\n    break;\n\n  case 55: /* expr: FUNCTION bexpr ')'  */\n#line 541 \"eval.y\"\n                { if (FSTRCMP((ffvsp[-2].str),\"SUM(\") == 0) {\n\t\t     (ffval.Node) = New_Func( LONG, sum_fct, 1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n                  } else if (FSTRCMP((ffvsp[-2].str),\"NELEM(\") == 0) {\n                     (ffval.Node) = New_Const( LONG, &( SIZE((ffvsp[-1].Node)) ), sizeof(long) );\n                  } else if (FSTRCMP((ffvsp[-2].str),\"ACCUM(\") == 0) {\n\t\t    long zero = 0;\n\t\t    (ffval.Node) = New_BinOp( LONG , (ffvsp[-1].Node), ACCUM, New_Const( LONG, &zero, sizeof(zero) ));\n\t\t  } else {\n                     fferror(\"Function(bool) not supported\");\n\t\t     FFERROR;\n\t\t  }\n                  TEST((ffval.Node)); \n\t\t}\n#line 2402 \"y.tab.c\"\n    break;\n\n  case 56: /* expr: FUNCTION sexpr ')'  */\n#line 555 \"eval.y\"\n                { if (FSTRCMP((ffvsp[-2].str),\"NELEM(\") == 0) {\n                     (ffval.Node) = New_Const( LONG, &( SIZE((ffvsp[-1].Node)) ), sizeof(long) );\n\t\t  } else if (FSTRCMP((ffvsp[-2].str),\"NVALID(\") == 0) {\n\t\t     (ffval.Node) = New_Func( LONG, nonnull_fct, 1, (ffvsp[-1].Node),\n\t\t\t\t    0, 0, 0, 0, 0, 0 );\n\t\t  } else {\n                     fferror(\"Function(str) not supported\");\n\t\t     FFERROR;\n\t\t  }\n                  TEST((ffval.Node)); \n\t\t}\n#line 2418 \"y.tab.c\"\n    break;\n\n  case 57: /* expr: FUNCTION bits ')'  */\n#line 567 \"eval.y\"\n                { if (FSTRCMP((ffvsp[-2].str),\"NELEM(\") == 0) {\n                     (ffval.Node) = New_Const( LONG, &( SIZE((ffvsp[-1].Node)) ), sizeof(long) );\n\t\t} else if (FSTRCMP((ffvsp[-2].str),\"NVALID(\") == 0) { /* Bit arrays do not have NULL */\n                     (ffval.Node) = New_Const( LONG, &( SIZE((ffvsp[-1].Node)) ), sizeof(long) );\n\t\t} else if (FSTRCMP((ffvsp[-2].str),\"SUM(\") == 0) {\n\t\t     (ffval.Node) = New_Func( LONG, sum_fct, 1, (ffvsp[-1].Node),\n\t\t\t\t    0, 0, 0, 0, 0, 0 );\n\t\t} else if (FSTRCMP((ffvsp[-2].str),\"MIN(\") == 0) {\n\t\t     (ffval.Node) = New_Func( TYPE((ffvsp[-1].Node)),  /* Force 1D result */\n\t\t\t\t    min1_fct, 1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     /* Note: $2 is a vector so the result can never\n\t\t        be a constant.  Therefore it will never be set\n\t\t        inside New_Func(), and it is safe to set SIZE() */\n\t\t     SIZE((ffval.Node)) = 1;\n\t\t} else if (FSTRCMP((ffvsp[-2].str),\"ACCUM(\") == 0) {\n\t\t    long zero = 0;\n\t\t    (ffval.Node) = New_BinOp( LONG , (ffvsp[-1].Node), ACCUM, New_Const( LONG, &zero, sizeof(zero) ));\n\t\t} else if (FSTRCMP((ffvsp[-2].str),\"MAX(\") == 0) {\n\t\t     (ffval.Node) = New_Func( TYPE((ffvsp[-1].Node)),  /* Force 1D result */\n\t\t\t\t    max1_fct, 1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     /* Note: $2 is a vector so the result can never\n\t\t        be a constant.  Therefore it will never be set\n\t\t        inside New_Func(), and it is safe to set SIZE() */\n\t\t     SIZE((ffval.Node)) = 1;\n\t\t} else {\n                     fferror(\"Function(bits) not supported\");\n\t\t     FFERROR;\n\t\t  }\n                  TEST((ffval.Node)); \n\t\t}\n#line 2453 \"y.tab.c\"\n    break;\n\n  case 58: /* expr: FUNCTION expr ')'  */\n#line 598 \"eval.y\"\n                { if (FSTRCMP((ffvsp[-2].str),\"SUM(\") == 0)\n\t\t     (ffval.Node) = New_Func( TYPE((ffvsp[-1].Node)), sum_fct, 1, (ffvsp[-1].Node),\n\t\t\t\t    0, 0, 0, 0, 0, 0 );\n\t\t  else if (FSTRCMP((ffvsp[-2].str),\"AVERAGE(\") == 0)\n\t\t     (ffval.Node) = New_Func( DOUBLE, average_fct, 1, (ffvsp[-1].Node),\n\t\t\t\t    0, 0, 0, 0, 0, 0 );\n\t\t  else if (FSTRCMP((ffvsp[-2].str),\"STDDEV(\") == 0)\n\t\t     (ffval.Node) = New_Func( DOUBLE, stddev_fct, 1, (ffvsp[-1].Node),\n\t\t\t\t    0, 0, 0, 0, 0, 0 );\n\t\t  else if (FSTRCMP((ffvsp[-2].str),\"MEDIAN(\") == 0)\n\t\t     (ffval.Node) = New_Func( TYPE((ffvsp[-1].Node)), median_fct, 1, (ffvsp[-1].Node),\n\t\t\t\t    0, 0, 0, 0, 0, 0 );\n\t\t  else if (FSTRCMP((ffvsp[-2].str),\"NELEM(\") == 0)\n                     (ffval.Node) = New_Const( LONG, &( SIZE((ffvsp[-1].Node)) ), sizeof(long) );\n\t\t  else if (FSTRCMP((ffvsp[-2].str),\"NVALID(\") == 0)\n\t\t     (ffval.Node) = New_Func( LONG, nonnull_fct, 1, (ffvsp[-1].Node),\n\t\t\t\t    0, 0, 0, 0, 0, 0 );\n\t\t  else if   ((FSTRCMP((ffvsp[-2].str),\"ACCUM(\") == 0) && (TYPE((ffvsp[-1].Node)) == LONG)) {\n\t\t    long zero = 0;\n\t\t    (ffval.Node) = New_BinOp( LONG ,   (ffvsp[-1].Node), ACCUM, New_Const( LONG,   &zero, sizeof(zero) ));\n\t\t  } else if ((FSTRCMP((ffvsp[-2].str),\"ACCUM(\") == 0) && (TYPE((ffvsp[-1].Node)) == DOUBLE)) {\n\t\t    double zero = 0;\n\t\t    (ffval.Node) = New_BinOp( DOUBLE , (ffvsp[-1].Node), ACCUM, New_Const( DOUBLE, &zero, sizeof(zero) ));\n\t\t  } else if ((FSTRCMP((ffvsp[-2].str),\"SEQDIFF(\") == 0) && (TYPE((ffvsp[-1].Node)) == LONG)) {\n\t\t    long zero = 0;\n\t\t    (ffval.Node) = New_BinOp( LONG ,   (ffvsp[-1].Node), DIFF, New_Const( LONG,   &zero, sizeof(zero) ));\n\t\t  } else if ((FSTRCMP((ffvsp[-2].str),\"SEQDIFF(\") == 0) && (TYPE((ffvsp[-1].Node)) == DOUBLE)) {\n\t\t    double zero = 0;\n\t\t    (ffval.Node) = New_BinOp( DOUBLE , (ffvsp[-1].Node), DIFF, New_Const( DOUBLE, &zero, sizeof(zero) ));\n\t\t  } else if (FSTRCMP((ffvsp[-2].str),\"ABS(\") == 0)\n\t\t     (ffval.Node) = New_Func( 0, abs_fct, 1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n \t\t  else if (FSTRCMP((ffvsp[-2].str),\"MIN(\") == 0)\n\t\t     (ffval.Node) = New_Func( TYPE((ffvsp[-1].Node)),  /* Force 1D result */\n\t\t\t\t    min1_fct, 1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t  else if (FSTRCMP((ffvsp[-2].str),\"MAX(\") == 0)\n\t\t     (ffval.Node) = New_Func( TYPE((ffvsp[-1].Node)),  /* Force 1D result */\n\t\t\t\t    max1_fct, 1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t  else if (FSTRCMP((ffvsp[-2].str),\"RANDOM(\") == 0) { /* Vector RANDOM() */\n                     (ffval.Node) = New_Func( 0, rnd_fct, 1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     TEST((ffval.Node));\n\t\t     TYPE((ffval.Node)) = DOUBLE;\n\t\t  } else if (FSTRCMP((ffvsp[-2].str),\"RANDOMN(\") == 0) {\n\t\t     (ffval.Node) = New_Func( 0, gasrnd_fct, 1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     TEST((ffval.Node));\n\t\t     TYPE((ffval.Node)) = DOUBLE;\n                  } \n  \t\t  else {  /*  These all take DOUBLE arguments  */\n\t\t     if( TYPE((ffvsp[-1].Node)) != DOUBLE ) (ffvsp[-1].Node) = New_Unary( DOUBLE, 0, (ffvsp[-1].Node) );\n                     if (FSTRCMP((ffvsp[-2].str),\"SIN(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, sin_fct,  1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[-2].str),\"COS(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, cos_fct,  1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[-2].str),\"TAN(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, tan_fct,  1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[-2].str),\"ARCSIN(\") == 0\n\t\t\t      || FSTRCMP((ffvsp[-2].str),\"ASIN(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, asin_fct, 1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[-2].str),\"ARCCOS(\") == 0\n\t\t\t      || FSTRCMP((ffvsp[-2].str),\"ACOS(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, acos_fct, 1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[-2].str),\"ARCTAN(\") == 0\n\t\t\t      || FSTRCMP((ffvsp[-2].str),\"ATAN(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, atan_fct, 1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[-2].str),\"SINH(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, sinh_fct,  1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[-2].str),\"COSH(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, cosh_fct,  1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[-2].str),\"TANH(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, tanh_fct,  1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[-2].str),\"EXP(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, exp_fct,  1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[-2].str),\"LOG(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, log_fct,  1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[-2].str),\"LOG10(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, log10_fct, 1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[-2].str),\"SQRT(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, sqrt_fct, 1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[-2].str),\"ROUND(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, round_fct, 1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[-2].str),\"FLOOR(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, floor_fct, 1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[-2].str),\"CEIL(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, ceil_fct, 1, (ffvsp[-1].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[-2].str),\"RANDOMP(\") == 0) {\n\t\t       (ffval.Node) = New_Func( 0, poirnd_fct, 1, (ffvsp[-1].Node), \n\t\t\t\t      0, 0, 0, 0, 0, 0 );\n\t\t       TYPE((ffval.Node)) = LONG;\n\t\t     } else {\n\t\t\tfferror(\"Function(expr) not supported\");\n\t\t\tFFERROR;\n\t\t     }\n\t\t  }\n                  TEST((ffval.Node)); \n                }\n#line 2552 \"y.tab.c\"\n    break;\n\n  case 59: /* expr: IFUNCTION sexpr ',' sexpr ')'  */\n#line 693 \"eval.y\"\n                { \n\t\t  if (FSTRCMP((ffvsp[-4].str),\"STRSTR(\") == 0) {\n\t\t    (ffval.Node) = New_Func( LONG, strpos_fct, 2, (ffvsp[-3].Node), (ffvsp[-1].Node), 0, \n\t\t\t\t   0, 0, 0, 0 );\n\t\t    TEST((ffval.Node));\n\t\t  }\n                }\n#line 2564 \"y.tab.c\"\n    break;\n\n  case 60: /* expr: FUNCTION expr ',' expr ')'  */\n#line 701 \"eval.y\"\n                { \n\t\t   if (FSTRCMP((ffvsp[-4].str),\"DEFNULL(\") == 0) {\n\t\t      if( SIZE((ffvsp[-3].Node))>=SIZE((ffvsp[-1].Node)) && Test_Dims( (ffvsp[-3].Node), (ffvsp[-1].Node) ) ) {\n\t\t\t PROMOTE((ffvsp[-3].Node),(ffvsp[-1].Node));\n\t\t\t (ffval.Node) = New_Func( 0, defnull_fct, 2, (ffvsp[-3].Node), (ffvsp[-1].Node), 0,\n\t\t\t\t\t0, 0, 0, 0 );\n\t\t\t TEST((ffval.Node)); \n\t\t      } else {\n\t\t\t fferror(\"Dimensions of DEFNULL arguments \"\n\t\t\t\t \"are not compatible\");\n\t\t\t FFERROR;\n\t\t      }\n\t\t   } else if (FSTRCMP((ffvsp[-4].str),\"ARCTAN2(\") == 0) {\n\t\t     if( TYPE((ffvsp[-3].Node)) != DOUBLE ) (ffvsp[-3].Node) = New_Unary( DOUBLE, 0, (ffvsp[-3].Node) );\n\t\t     if( TYPE((ffvsp[-1].Node)) != DOUBLE ) (ffvsp[-1].Node) = New_Unary( DOUBLE, 0, (ffvsp[-1].Node) );\n\t\t     if( Test_Dims( (ffvsp[-3].Node), (ffvsp[-1].Node) ) ) {\n\t\t\t(ffval.Node) = New_Func( 0, atan2_fct, 2, (ffvsp[-3].Node), (ffvsp[-1].Node), 0, 0, 0, 0, 0 );\n\t\t\tTEST((ffval.Node)); \n\t\t\tif( SIZE((ffvsp[-3].Node))<SIZE((ffvsp[-1].Node)) ) Copy_Dims((ffval.Node), (ffvsp[-1].Node));\n\t\t     } else {\n\t\t\tfferror(\"Dimensions of arctan2 arguments \"\n\t\t\t\t\"are not compatible\");\n\t\t\tFFERROR;\n\t\t     }\n\t\t   } else if (FSTRCMP((ffvsp[-4].str),\"MIN(\") == 0) {\n\t\t      PROMOTE( (ffvsp[-3].Node), (ffvsp[-1].Node) );\n\t\t      if( Test_Dims( (ffvsp[-3].Node), (ffvsp[-1].Node) ) ) {\n\t\t\t(ffval.Node) = New_Func( 0, min2_fct, 2, (ffvsp[-3].Node), (ffvsp[-1].Node), 0, 0, 0, 0, 0 );\n\t\t\tTEST((ffval.Node));\n\t\t\tif( SIZE((ffvsp[-3].Node))<SIZE((ffvsp[-1].Node)) ) Copy_Dims((ffval.Node), (ffvsp[-1].Node));\n\t\t      } else {\n\t\t\tfferror(\"Dimensions of min(a,b) arguments \"\n\t\t\t\t\"are not compatible\");\n\t\t\tFFERROR;\n\t\t      }\n\t\t   } else if (FSTRCMP((ffvsp[-4].str),\"MAX(\") == 0) {\n\t\t      PROMOTE( (ffvsp[-3].Node), (ffvsp[-1].Node) );\n\t\t      if( Test_Dims( (ffvsp[-3].Node), (ffvsp[-1].Node) ) ) {\n\t\t\t(ffval.Node) = New_Func( 0, max2_fct, 2, (ffvsp[-3].Node), (ffvsp[-1].Node), 0, 0, 0, 0, 0 );\n\t\t\tTEST((ffval.Node));\n\t\t\tif( SIZE((ffvsp[-3].Node))<SIZE((ffvsp[-1].Node)) ) Copy_Dims((ffval.Node), (ffvsp[-1].Node));\n\t\t      } else {\n\t\t\tfferror(\"Dimensions of max(a,b) arguments \"\n\t\t\t\t\"are not compatible\");\n\t\t\tFFERROR;\n\t\t      }\n\t\t   } else if (FSTRCMP((ffvsp[-4].str),\"SETNULL(\") == 0) {\n\t\t     if (OPER((ffvsp[-3].Node)) != CONST_OP\n\t\t\t || SIZE((ffvsp[-3].Node)) != 1) {\n\t\t       fferror(\"SETNULL first argument must be a scalar constant\");\n\t\t       FFERROR;\n\t\t     }\n\t\t     /* Make sure first arg is same type as second arg */\n\t\t     if ( TYPE((ffvsp[-3].Node)) != TYPE((ffvsp[-1].Node)) ) (ffvsp[-3].Node) = New_Unary( TYPE((ffvsp[-1].Node)), 0, (ffvsp[-3].Node) );\n\t\t     (ffval.Node) = New_Func( 0, setnull_fct, 2, (ffvsp[-1].Node), (ffvsp[-3].Node), 0, 0, 0, 0, 0 );\n\t\t   } else {\n\t\t      fferror(\"Function(expr,expr) not supported\");\n\t\t      FFERROR;\n\t\t   }\n                }\n#line 2629 \"y.tab.c\"\n    break;\n\n  case 61: /* expr: FUNCTION expr ',' expr ',' expr ',' expr ')'  */\n#line 762 \"eval.y\"\n                { \n\t\t  if (FSTRCMP((ffvsp[-8].str),\"ANGSEP(\") == 0) {\n\t\t    if( TYPE((ffvsp[-7].Node)) != DOUBLE ) (ffvsp[-7].Node) = New_Unary( DOUBLE, 0, (ffvsp[-7].Node) );\n\t\t    if( TYPE((ffvsp[-5].Node)) != DOUBLE ) (ffvsp[-5].Node) = New_Unary( DOUBLE, 0, (ffvsp[-5].Node) );\n\t\t    if( TYPE((ffvsp[-3].Node)) != DOUBLE ) (ffvsp[-3].Node) = New_Unary( DOUBLE, 0, (ffvsp[-3].Node) );\n\t\t    if( TYPE((ffvsp[-1].Node)) != DOUBLE ) (ffvsp[-1].Node) = New_Unary( DOUBLE, 0, (ffvsp[-1].Node) );\n\t\t    if( Test_Dims( (ffvsp[-7].Node), (ffvsp[-5].Node) ) && Test_Dims( (ffvsp[-5].Node), (ffvsp[-3].Node) ) && \n\t\t\tTest_Dims( (ffvsp[-3].Node), (ffvsp[-1].Node) ) ) {\n\t\t      (ffval.Node) = New_Func( 0, angsep_fct, 4, (ffvsp[-7].Node), (ffvsp[-5].Node), (ffvsp[-3].Node), (ffvsp[-1].Node),0,0,0 );\n\t\t      TEST((ffval.Node)); \n\t\t      if( SIZE((ffvsp[-7].Node))<SIZE((ffvsp[-5].Node)) ) Copy_Dims((ffval.Node), (ffvsp[-5].Node));\n\t\t      if( SIZE((ffvsp[-5].Node))<SIZE((ffvsp[-3].Node)) ) Copy_Dims((ffval.Node), (ffvsp[-3].Node));\n\t\t      if( SIZE((ffvsp[-3].Node))<SIZE((ffvsp[-1].Node)) ) Copy_Dims((ffval.Node), (ffvsp[-1].Node));\n\t\t    } else {\n\t\t      fferror(\"Dimensions of ANGSEP arguments \"\n\t\t\t      \"are not compatible\");\n\t\t      FFERROR;\n\t\t    }\n\t\t   } else {\n\t\t      fferror(\"Function(expr,expr,expr,expr) not supported\");\n\t\t      FFERROR;\n\t\t   }\n                }\n#line 2657 \"y.tab.c\"\n    break;\n\n  case 62: /* expr: expr '[' expr ']'  */\n#line 786 \"eval.y\"\n                { (ffval.Node) = New_Deref( (ffvsp[-3].Node), 1, (ffvsp[-1].Node),  0,  0,  0,   0 ); TEST((ffval.Node)); }\n#line 2663 \"y.tab.c\"\n    break;\n\n  case 63: /* expr: expr '[' expr ',' expr ']'  */\n#line 788 \"eval.y\"\n                { (ffval.Node) = New_Deref( (ffvsp[-5].Node), 2, (ffvsp[-3].Node), (ffvsp[-1].Node),  0,  0,   0 ); TEST((ffval.Node)); }\n#line 2669 \"y.tab.c\"\n    break;\n\n  case 64: /* expr: expr '[' expr ',' expr ',' expr ']'  */\n#line 790 \"eval.y\"\n                { (ffval.Node) = New_Deref( (ffvsp[-7].Node), 3, (ffvsp[-5].Node), (ffvsp[-3].Node), (ffvsp[-1].Node),  0,   0 ); TEST((ffval.Node)); }\n#line 2675 \"y.tab.c\"\n    break;\n\n  case 65: /* expr: expr '[' expr ',' expr ',' expr ',' expr ']'  */\n#line 792 \"eval.y\"\n                { (ffval.Node) = New_Deref( (ffvsp[-9].Node), 4, (ffvsp[-7].Node), (ffvsp[-5].Node), (ffvsp[-3].Node), (ffvsp[-1].Node),   0 ); TEST((ffval.Node)); }\n#line 2681 \"y.tab.c\"\n    break;\n\n  case 66: /* expr: expr '[' expr ',' expr ',' expr ',' expr ',' expr ']'  */\n#line 794 \"eval.y\"\n                { (ffval.Node) = New_Deref( (ffvsp[-11].Node), 5, (ffvsp[-9].Node), (ffvsp[-7].Node), (ffvsp[-5].Node), (ffvsp[-3].Node), (ffvsp[-1].Node) ); TEST((ffval.Node)); }\n#line 2687 \"y.tab.c\"\n    break;\n\n  case 67: /* expr: INTCAST expr  */\n#line 796 \"eval.y\"\n                { (ffval.Node) = New_Unary( LONG,   INTCAST, (ffvsp[0].Node) );  TEST((ffval.Node));  }\n#line 2693 \"y.tab.c\"\n    break;\n\n  case 68: /* expr: INTCAST bexpr  */\n#line 798 \"eval.y\"\n                { (ffval.Node) = New_Unary( LONG,   INTCAST, (ffvsp[0].Node) );  TEST((ffval.Node));  }\n#line 2699 \"y.tab.c\"\n    break;\n\n  case 69: /* expr: FLTCAST expr  */\n#line 800 \"eval.y\"\n                { (ffval.Node) = New_Unary( DOUBLE, FLTCAST, (ffvsp[0].Node) );  TEST((ffval.Node));  }\n#line 2705 \"y.tab.c\"\n    break;\n\n  case 70: /* expr: FLTCAST bexpr  */\n#line 802 \"eval.y\"\n                { (ffval.Node) = New_Unary( DOUBLE, FLTCAST, (ffvsp[0].Node) );  TEST((ffval.Node));  }\n#line 2711 \"y.tab.c\"\n    break;\n\n  case 71: /* bexpr: BOOLEAN  */\n#line 806 \"eval.y\"\n                { (ffval.Node) = New_Const( BOOLEAN, &((ffvsp[0].log)), sizeof(char) ); TEST((ffval.Node)); }\n#line 2717 \"y.tab.c\"\n    break;\n\n  case 72: /* bexpr: BCOLUMN  */\n#line 808 \"eval.y\"\n                { (ffval.Node) = New_Column( (ffvsp[0].lng) ); TEST((ffval.Node)); }\n#line 2723 \"y.tab.c\"\n    break;\n\n  case 73: /* bexpr: BCOLUMN '{' expr '}'  */\n#line 810 \"eval.y\"\n                {\n                  if( TYPE((ffvsp[-1].Node)) != LONG\n\t\t      || OPER((ffvsp[-1].Node)) != CONST_OP ) {\n\t\t     fferror(\"Offset argument must be a constant integer\");\n\t\t     FFERROR;\n\t\t  }\n                  (ffval.Node) = New_Offset( (ffvsp[-3].lng), (ffvsp[-1].Node) ); TEST((ffval.Node));\n                }\n#line 2736 \"y.tab.c\"\n    break;\n\n  case 74: /* bexpr: bits EQ bits  */\n#line 819 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), EQ,  (ffvsp[0].Node) ); TEST((ffval.Node));\n\t\t  SIZE((ffval.Node)) = 1;                                     }\n#line 2743 \"y.tab.c\"\n    break;\n\n  case 75: /* bexpr: bits NE bits  */\n#line 822 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), NE,  (ffvsp[0].Node) ); TEST((ffval.Node)); \n\t\t  SIZE((ffval.Node)) = 1;                                     }\n#line 2750 \"y.tab.c\"\n    break;\n\n  case 76: /* bexpr: bits LT bits  */\n#line 825 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), LT,  (ffvsp[0].Node) ); TEST((ffval.Node)); \n\t\t  SIZE((ffval.Node)) = 1;                                     }\n#line 2757 \"y.tab.c\"\n    break;\n\n  case 77: /* bexpr: bits LTE bits  */\n#line 828 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), LTE, (ffvsp[0].Node) ); TEST((ffval.Node)); \n\t\t  SIZE((ffval.Node)) = 1;                                     }\n#line 2764 \"y.tab.c\"\n    break;\n\n  case 78: /* bexpr: bits GT bits  */\n#line 831 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), GT,  (ffvsp[0].Node) ); TEST((ffval.Node)); \n\t\t  SIZE((ffval.Node)) = 1;                                     }\n#line 2771 \"y.tab.c\"\n    break;\n\n  case 79: /* bexpr: bits GTE bits  */\n#line 834 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), GTE, (ffvsp[0].Node) ); TEST((ffval.Node)); \n\t\t  SIZE((ffval.Node)) = 1;                                     }\n#line 2778 \"y.tab.c\"\n    break;\n\n  case 80: /* bexpr: expr GT expr  */\n#line 837 \"eval.y\"\n                { PROMOTE((ffvsp[-2].Node),(ffvsp[0].Node)); (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), GT,  (ffvsp[0].Node) );\n                  TEST((ffval.Node));                                               }\n#line 2785 \"y.tab.c\"\n    break;\n\n  case 81: /* bexpr: expr LT expr  */\n#line 840 \"eval.y\"\n                { PROMOTE((ffvsp[-2].Node),(ffvsp[0].Node)); (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), LT,  (ffvsp[0].Node) );\n                  TEST((ffval.Node));                                               }\n#line 2792 \"y.tab.c\"\n    break;\n\n  case 82: /* bexpr: expr GTE expr  */\n#line 843 \"eval.y\"\n                { PROMOTE((ffvsp[-2].Node),(ffvsp[0].Node)); (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), GTE, (ffvsp[0].Node) );\n                  TEST((ffval.Node));                                               }\n#line 2799 \"y.tab.c\"\n    break;\n\n  case 83: /* bexpr: expr LTE expr  */\n#line 846 \"eval.y\"\n                { PROMOTE((ffvsp[-2].Node),(ffvsp[0].Node)); (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), LTE, (ffvsp[0].Node) );\n                  TEST((ffval.Node));                                               }\n#line 2806 \"y.tab.c\"\n    break;\n\n  case 84: /* bexpr: expr '~' expr  */\n#line 849 \"eval.y\"\n                { PROMOTE((ffvsp[-2].Node),(ffvsp[0].Node)); (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), '~', (ffvsp[0].Node) );\n                  TEST((ffval.Node));                                               }\n#line 2813 \"y.tab.c\"\n    break;\n\n  case 85: /* bexpr: expr EQ expr  */\n#line 852 \"eval.y\"\n                { PROMOTE((ffvsp[-2].Node),(ffvsp[0].Node)); (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), EQ,  (ffvsp[0].Node) );\n                  TEST((ffval.Node));                                               }\n#line 2820 \"y.tab.c\"\n    break;\n\n  case 86: /* bexpr: expr NE expr  */\n#line 855 \"eval.y\"\n                { PROMOTE((ffvsp[-2].Node),(ffvsp[0].Node)); (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), NE,  (ffvsp[0].Node) );\n                  TEST((ffval.Node));                                               }\n#line 2827 \"y.tab.c\"\n    break;\n\n  case 87: /* bexpr: sexpr EQ sexpr  */\n#line 858 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), EQ,  (ffvsp[0].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = 1; }\n#line 2834 \"y.tab.c\"\n    break;\n\n  case 88: /* bexpr: sexpr NE sexpr  */\n#line 861 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), NE,  (ffvsp[0].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = 1; }\n#line 2841 \"y.tab.c\"\n    break;\n\n  case 89: /* bexpr: sexpr GT sexpr  */\n#line 864 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), GT,  (ffvsp[0].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = 1; }\n#line 2848 \"y.tab.c\"\n    break;\n\n  case 90: /* bexpr: sexpr GTE sexpr  */\n#line 867 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), GTE, (ffvsp[0].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = 1; }\n#line 2855 \"y.tab.c\"\n    break;\n\n  case 91: /* bexpr: sexpr LT sexpr  */\n#line 870 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), LT,  (ffvsp[0].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = 1; }\n#line 2862 \"y.tab.c\"\n    break;\n\n  case 92: /* bexpr: sexpr LTE sexpr  */\n#line 873 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), LTE, (ffvsp[0].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = 1; }\n#line 2869 \"y.tab.c\"\n    break;\n\n  case 93: /* bexpr: bexpr AND bexpr  */\n#line 876 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), AND, (ffvsp[0].Node) ); TEST((ffval.Node)); }\n#line 2875 \"y.tab.c\"\n    break;\n\n  case 94: /* bexpr: bexpr OR bexpr  */\n#line 878 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), OR,  (ffvsp[0].Node) ); TEST((ffval.Node)); }\n#line 2881 \"y.tab.c\"\n    break;\n\n  case 95: /* bexpr: bexpr EQ bexpr  */\n#line 880 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), EQ,  (ffvsp[0].Node) ); TEST((ffval.Node)); }\n#line 2887 \"y.tab.c\"\n    break;\n\n  case 96: /* bexpr: bexpr NE bexpr  */\n#line 882 \"eval.y\"\n                { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), NE,  (ffvsp[0].Node) ); TEST((ffval.Node)); }\n#line 2893 \"y.tab.c\"\n    break;\n\n  case 97: /* bexpr: expr '=' expr ':' expr  */\n#line 885 \"eval.y\"\n                { PROMOTE((ffvsp[-4].Node),(ffvsp[-2].Node)); PROMOTE((ffvsp[-4].Node),(ffvsp[0].Node)); PROMOTE((ffvsp[-2].Node),(ffvsp[0].Node));\n\t\t  (ffvsp[-2].Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), LTE, (ffvsp[-4].Node) );\n                  (ffvsp[0].Node) = New_BinOp( BOOLEAN, (ffvsp[-4].Node), LTE, (ffvsp[0].Node) );\n                  (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[-2].Node), AND, (ffvsp[0].Node) );\n                  TEST((ffval.Node));                                         }\n#line 2903 \"y.tab.c\"\n    break;\n\n  case 98: /* bexpr: bexpr '?' bexpr ':' bexpr  */\n#line 892 \"eval.y\"\n                {\n                  if( ! Test_Dims((ffvsp[-2].Node),(ffvsp[0].Node)) ) {\n                     fferror(\"Incompatible dimensions in '?:' arguments\");\n\t\t     FFERROR;\n                  }\n                  (ffval.Node) = New_Func( 0, ifthenelse_fct, 3, (ffvsp[-2].Node), (ffvsp[0].Node), (ffvsp[-4].Node),\n                                 0, 0, 0, 0 );\n                  TEST((ffval.Node));\n                  if( SIZE((ffvsp[-2].Node))<SIZE((ffvsp[0].Node)) )  Copy_Dims((ffval.Node), (ffvsp[0].Node));\n                  if( ! Test_Dims((ffvsp[-4].Node),(ffval.Node)) ) {\n                     fferror(\"Incompatible dimensions in '?:' condition\");\n\t\t     FFERROR;\n                  }\n                  if( SIZE((ffval.Node))<SIZE((ffvsp[-4].Node)) )  Copy_Dims((ffval.Node), (ffvsp[-4].Node));\n                }\n#line 2923 \"y.tab.c\"\n    break;\n\n  case 99: /* bexpr: BFUNCTION expr ')'  */\n#line 909 \"eval.y\"\n                {\n\t\t   if (FSTRCMP((ffvsp[-2].str),\"ISNULL(\") == 0) {\n\t\t      (ffval.Node) = New_Func( 0, isnull_fct, 1, (ffvsp[-1].Node), 0, 0,\n\t\t\t\t     0, 0, 0, 0 );\n\t\t      TEST((ffval.Node)); \n                      /* Use expression's size, but return BOOLEAN */\n\t\t      TYPE((ffval.Node)) = BOOLEAN;\n\t\t   } else {\n\t\t      fferror(\"Boolean Function(expr) not supported\");\n\t\t      FFERROR;\n\t\t   }\n\t\t}\n#line 2940 \"y.tab.c\"\n    break;\n\n  case 100: /* bexpr: BFUNCTION bexpr ')'  */\n#line 922 \"eval.y\"\n                {\n\t\t   if (FSTRCMP((ffvsp[-2].str),\"ISNULL(\") == 0) {\n\t\t      (ffval.Node) = New_Func( 0, isnull_fct, 1, (ffvsp[-1].Node), 0, 0,\n\t\t\t\t     0, 0, 0, 0 );\n\t\t      TEST((ffval.Node)); \n                      /* Use expression's size, but return BOOLEAN */\n\t\t      TYPE((ffval.Node)) = BOOLEAN;\n\t\t   } else {\n\t\t      fferror(\"Boolean Function(expr) not supported\");\n\t\t      FFERROR;\n\t\t   }\n\t\t}\n#line 2957 \"y.tab.c\"\n    break;\n\n  case 101: /* bexpr: BFUNCTION sexpr ')'  */\n#line 935 \"eval.y\"\n                {\n\t\t   if (FSTRCMP((ffvsp[-2].str),\"ISNULL(\") == 0) {\n\t\t      (ffval.Node) = New_Func( BOOLEAN, isnull_fct, 1, (ffvsp[-1].Node), 0, 0,\n\t\t\t\t     0, 0, 0, 0 );\n\t\t      TEST((ffval.Node)); \n\t\t   } else {\n\t\t      fferror(\"Boolean Function(expr) not supported\");\n\t\t      FFERROR;\n\t\t   }\n\t\t}\n#line 2972 \"y.tab.c\"\n    break;\n\n  case 102: /* bexpr: FUNCTION bexpr ',' bexpr ')'  */\n#line 946 \"eval.y\"\n                {\n\t\t   if (FSTRCMP((ffvsp[-4].str),\"DEFNULL(\") == 0) {\n\t\t      if( SIZE((ffvsp[-3].Node))>=SIZE((ffvsp[-1].Node)) && Test_Dims( (ffvsp[-3].Node), (ffvsp[-1].Node) ) ) {\n\t\t\t (ffval.Node) = New_Func( 0, defnull_fct, 2, (ffvsp[-3].Node), (ffvsp[-1].Node), 0,\n\t\t\t\t\t0, 0, 0, 0 );\n\t\t\t TEST((ffval.Node)); \n\t\t      } else {\n\t\t\t fferror(\"Dimensions of DEFNULL arguments are not compatible\");\n\t\t\t FFERROR;\n\t\t      }\n\t\t   } else {\n\t\t      fferror(\"Boolean Function(expr,expr) not supported\");\n\t\t      FFERROR;\n\t\t   }\n\t\t}\n#line 2992 \"y.tab.c\"\n    break;\n\n  case 103: /* bexpr: BFUNCTION expr ',' expr ',' expr ')'  */\n#line 962 \"eval.y\"\n                {\n\t\t   if( TYPE((ffvsp[-5].Node)) != DOUBLE ) (ffvsp[-5].Node) = New_Unary( DOUBLE, 0, (ffvsp[-5].Node) );\n\t\t   if( TYPE((ffvsp[-3].Node)) != DOUBLE ) (ffvsp[-3].Node) = New_Unary( DOUBLE, 0, (ffvsp[-3].Node) );\n\t\t   if( TYPE((ffvsp[-1].Node)) != DOUBLE ) (ffvsp[-1].Node) = New_Unary( DOUBLE, 0, (ffvsp[-1].Node) );\n\t\t   if( ! (Test_Dims( (ffvsp[-5].Node), (ffvsp[-3].Node) ) && Test_Dims( (ffvsp[-3].Node), (ffvsp[-1].Node) ) ) ) {\n\t\t       fferror(\"Dimensions of NEAR arguments \"\n\t\t\t       \"are not compatible\");\n\t\t       FFERROR;\n\t\t   } else {\n\t\t     if (FSTRCMP((ffvsp[-6].str),\"NEAR(\") == 0) {\n\t\t       (ffval.Node) = New_Func( BOOLEAN, near_fct, 3, (ffvsp[-5].Node), (ffvsp[-3].Node), (ffvsp[-1].Node),\n\t\t\t\t      0, 0, 0, 0 );\n\t\t     } else {\n\t\t       fferror(\"Boolean Function not supported\");\n\t\t       FFERROR;\n\t\t     }\n\t\t     TEST((ffval.Node)); \n\n\t\t     if( SIZE((ffval.Node))<SIZE((ffvsp[-5].Node)) )  Copy_Dims((ffval.Node), (ffvsp[-5].Node));\n\t\t     if( SIZE((ffvsp[-5].Node))<SIZE((ffvsp[-3].Node)) )  Copy_Dims((ffval.Node), (ffvsp[-3].Node));\n\t\t     if( SIZE((ffvsp[-3].Node))<SIZE((ffvsp[-1].Node)) )  Copy_Dims((ffval.Node), (ffvsp[-1].Node));\n\t\t   }\n\t\t}\n#line 3020 \"y.tab.c\"\n    break;\n\n  case 104: /* bexpr: BFUNCTION expr ',' expr ',' expr ',' expr ',' expr ')'  */\n#line 986 \"eval.y\"\n                {\n\t\t   if( TYPE((ffvsp[-9].Node)) != DOUBLE ) (ffvsp[-9].Node) = New_Unary( DOUBLE, 0, (ffvsp[-9].Node) );\n\t\t   if( TYPE((ffvsp[-7].Node)) != DOUBLE ) (ffvsp[-7].Node) = New_Unary( DOUBLE, 0, (ffvsp[-7].Node) );\n\t\t   if( TYPE((ffvsp[-5].Node)) != DOUBLE ) (ffvsp[-5].Node) = New_Unary( DOUBLE, 0, (ffvsp[-5].Node) );\n\t\t   if( TYPE((ffvsp[-3].Node)) != DOUBLE ) (ffvsp[-3].Node) = New_Unary( DOUBLE, 0, (ffvsp[-3].Node) );\n\t\t   if( TYPE((ffvsp[-1].Node))!= DOUBLE ) (ffvsp[-1].Node)= New_Unary( DOUBLE, 0, (ffvsp[-1].Node));\n\t\t   if( ! (Test_Dims( (ffvsp[-9].Node), (ffvsp[-7].Node) ) && Test_Dims( (ffvsp[-7].Node), (ffvsp[-5].Node) ) && \n\t\t\t  Test_Dims( (ffvsp[-5].Node), (ffvsp[-3].Node) ) && Test_Dims( (ffvsp[-3].Node), (ffvsp[-1].Node) )) ) {\n\t\t     fferror(\"Dimensions of CIRCLE arguments \"\n\t\t\t     \"are not compatible\");\n\t\t     FFERROR;\n\t\t   } else {\n\t\t     if (FSTRCMP((ffvsp[-10].str),\"CIRCLE(\") == 0) {\n\t\t       (ffval.Node) = New_Func( BOOLEAN, circle_fct, 5, (ffvsp[-9].Node), (ffvsp[-7].Node), (ffvsp[-5].Node), (ffvsp[-3].Node),\n\t\t\t\t      (ffvsp[-1].Node), 0, 0 );\n\t\t     } else {\n\t\t       fferror(\"Boolean Function not supported\");\n\t\t       FFERROR;\n\t\t     }\n\t\t     TEST((ffval.Node)); \n\t\t     if( SIZE((ffval.Node))<SIZE((ffvsp[-9].Node)) )  Copy_Dims((ffval.Node), (ffvsp[-9].Node));\n\t\t     if( SIZE((ffvsp[-9].Node))<SIZE((ffvsp[-7].Node)) )  Copy_Dims((ffval.Node), (ffvsp[-7].Node));\n\t\t     if( SIZE((ffvsp[-7].Node))<SIZE((ffvsp[-5].Node)) )  Copy_Dims((ffval.Node), (ffvsp[-5].Node));\n\t\t     if( SIZE((ffvsp[-5].Node))<SIZE((ffvsp[-3].Node)) )  Copy_Dims((ffval.Node), (ffvsp[-3].Node));\n\t\t     if( SIZE((ffvsp[-3].Node))<SIZE((ffvsp[-1].Node)) ) Copy_Dims((ffval.Node), (ffvsp[-1].Node));\n\t\t   }\n\t\t}\n#line 3052 \"y.tab.c\"\n    break;\n\n  case 105: /* bexpr: BFUNCTION expr ',' expr ',' expr ',' expr ',' expr ',' expr ',' expr ')'  */\n#line 1014 \"eval.y\"\n                {\n\t\t   if( TYPE((ffvsp[-13].Node)) != DOUBLE ) (ffvsp[-13].Node) = New_Unary( DOUBLE, 0, (ffvsp[-13].Node) );\n\t\t   if( TYPE((ffvsp[-11].Node)) != DOUBLE ) (ffvsp[-11].Node) = New_Unary( DOUBLE, 0, (ffvsp[-11].Node) );\n\t\t   if( TYPE((ffvsp[-9].Node)) != DOUBLE ) (ffvsp[-9].Node) = New_Unary( DOUBLE, 0, (ffvsp[-9].Node) );\n\t\t   if( TYPE((ffvsp[-7].Node)) != DOUBLE ) (ffvsp[-7].Node) = New_Unary( DOUBLE, 0, (ffvsp[-7].Node) );\n\t\t   if( TYPE((ffvsp[-5].Node))!= DOUBLE ) (ffvsp[-5].Node)= New_Unary( DOUBLE, 0, (ffvsp[-5].Node));\n\t\t   if( TYPE((ffvsp[-3].Node))!= DOUBLE ) (ffvsp[-3].Node)= New_Unary( DOUBLE, 0, (ffvsp[-3].Node));\n\t\t   if( TYPE((ffvsp[-1].Node))!= DOUBLE ) (ffvsp[-1].Node)= New_Unary( DOUBLE, 0, (ffvsp[-1].Node));\n\t\t   if( ! (Test_Dims( (ffvsp[-13].Node), (ffvsp[-11].Node) ) && Test_Dims( (ffvsp[-11].Node), (ffvsp[-9].Node) ) && \n\t\t\t  Test_Dims( (ffvsp[-9].Node), (ffvsp[-7].Node) ) && Test_Dims( (ffvsp[-7].Node), (ffvsp[-5].Node) ) &&\n\t\t\t  Test_Dims((ffvsp[-5].Node),(ffvsp[-3].Node) ) && Test_Dims((ffvsp[-3].Node), (ffvsp[-1].Node) ) ) ) {\n\t\t     fferror(\"Dimensions of BOX or ELLIPSE arguments \"\n\t\t\t     \"are not compatible\");\n\t\t     FFERROR;\n\t\t   } else {\n\t\t     if (FSTRCMP((ffvsp[-14].str),\"BOX(\") == 0) {\n\t\t       (ffval.Node) = New_Func( BOOLEAN, box_fct, 7, (ffvsp[-13].Node), (ffvsp[-11].Node), (ffvsp[-9].Node), (ffvsp[-7].Node),\n\t\t\t\t      (ffvsp[-5].Node), (ffvsp[-3].Node), (ffvsp[-1].Node) );\n\t\t     } else if (FSTRCMP((ffvsp[-14].str),\"ELLIPSE(\") == 0) {\n\t\t       (ffval.Node) = New_Func( BOOLEAN, elps_fct, 7, (ffvsp[-13].Node), (ffvsp[-11].Node), (ffvsp[-9].Node), (ffvsp[-7].Node),\n\t\t\t\t      (ffvsp[-5].Node), (ffvsp[-3].Node), (ffvsp[-1].Node) );\n\t\t     } else {\n\t\t       fferror(\"SAO Image Function not supported\");\n\t\t       FFERROR;\n\t\t     }\n\t\t     TEST((ffval.Node)); \n\t\t     if( SIZE((ffval.Node))<SIZE((ffvsp[-13].Node)) )  Copy_Dims((ffval.Node), (ffvsp[-13].Node));\n\t\t     if( SIZE((ffvsp[-13].Node))<SIZE((ffvsp[-11].Node)) )  Copy_Dims((ffval.Node), (ffvsp[-11].Node));\n\t\t     if( SIZE((ffvsp[-11].Node))<SIZE((ffvsp[-9].Node)) )  Copy_Dims((ffval.Node), (ffvsp[-9].Node));\n\t\t     if( SIZE((ffvsp[-9].Node))<SIZE((ffvsp[-7].Node)) )  Copy_Dims((ffval.Node), (ffvsp[-7].Node));\n\t\t     if( SIZE((ffvsp[-7].Node))<SIZE((ffvsp[-5].Node)) ) Copy_Dims((ffval.Node), (ffvsp[-5].Node));\n\t\t     if( SIZE((ffvsp[-5].Node))<SIZE((ffvsp[-3].Node)) ) Copy_Dims((ffval.Node), (ffvsp[-3].Node));\n\t\t     if( SIZE((ffvsp[-3].Node))<SIZE((ffvsp[-1].Node)) ) Copy_Dims((ffval.Node), (ffvsp[-1].Node));\n\t\t   }\n\t\t}\n#line 3092 \"y.tab.c\"\n    break;\n\n  case 106: /* bexpr: GTIFILTER ')'  */\n#line 1051 \"eval.y\"\n                { /* Use defaults for all elements */\n\t\t   (ffval.Node) = New_GTI(gtifilt_fct,  \"\", -99, -99, \"*START*\", \"*STOP*\" );\n                   TEST((ffval.Node));                                        }\n#line 3100 \"y.tab.c\"\n    break;\n\n  case 107: /* bexpr: GTIFILTER STRING ')'  */\n#line 1055 \"eval.y\"\n                { /* Use defaults for all except filename */\n\t\t  (ffval.Node) = New_GTI(gtifilt_fct,  (ffvsp[-1].str), -99, -99, \"*START*\", \"*STOP*\" );\n                   TEST((ffval.Node));                                        }\n#line 3108 \"y.tab.c\"\n    break;\n\n  case 108: /* bexpr: GTIFILTER STRING ',' expr ')'  */\n#line 1059 \"eval.y\"\n                {  (ffval.Node) = New_GTI(gtifilt_fct,  (ffvsp[-3].str), (ffvsp[-1].Node), -99, \"*START*\", \"*STOP*\" );\n                   TEST((ffval.Node));                                        }\n#line 3115 \"y.tab.c\"\n    break;\n\n  case 109: /* bexpr: GTIFILTER STRING ',' expr ',' STRING ',' STRING ')'  */\n#line 1062 \"eval.y\"\n                {  (ffval.Node) = New_GTI(gtifilt_fct,  (ffvsp[-7].str), (ffvsp[-5].Node), -99, (ffvsp[-3].str), (ffvsp[-1].str) );\n                   TEST((ffval.Node));                                        }\n#line 3122 \"y.tab.c\"\n    break;\n\n  case 110: /* bexpr: GTIOVERLAP STRING ',' expr ',' expr ')'  */\n#line 1067 \"eval.y\"\n                {  (ffval.Node) = New_GTI(gtiover_fct,  (ffvsp[-5].str), (ffvsp[-3].Node), (ffvsp[-1].Node), \"*START*\", \"*STOP*\");\n                   TEST((ffval.Node));                                        }\n#line 3129 \"y.tab.c\"\n    break;\n\n  case 111: /* bexpr: GTIOVERLAP STRING ',' expr ',' expr ',' STRING ',' STRING ')'  */\n#line 1070 \"eval.y\"\n                {  (ffval.Node) = New_GTI(gtiover_fct,  (ffvsp[-9].str), (ffvsp[-7].Node), (ffvsp[-5].Node), (ffvsp[-3].str), (ffvsp[-1].str) );\n                   TEST((ffval.Node));                                        }\n#line 3136 \"y.tab.c\"\n    break;\n\n  case 112: /* bexpr: REGFILTER STRING ')'  */\n#line 1075 \"eval.y\"\n                { /* Use defaults for all except filename */\n                   (ffval.Node) = New_REG( (ffvsp[-1].str), -99, -99, \"\" );\n                   TEST((ffval.Node));                                        }\n#line 3144 \"y.tab.c\"\n    break;\n\n  case 113: /* bexpr: REGFILTER STRING ',' expr ',' expr ')'  */\n#line 1079 \"eval.y\"\n                {  (ffval.Node) = New_REG( (ffvsp[-5].str), (ffvsp[-3].Node), (ffvsp[-1].Node), \"\" );\n                   TEST((ffval.Node));                                        }\n#line 3151 \"y.tab.c\"\n    break;\n\n  case 114: /* bexpr: REGFILTER STRING ',' expr ',' expr ',' STRING ')'  */\n#line 1082 \"eval.y\"\n                {  (ffval.Node) = New_REG( (ffvsp[-7].str), (ffvsp[-5].Node), (ffvsp[-3].Node), (ffvsp[-1].str) );\n                   TEST((ffval.Node));                                        }\n#line 3158 \"y.tab.c\"\n    break;\n\n  case 115: /* bexpr: bexpr '[' expr ']'  */\n#line 1086 \"eval.y\"\n                { (ffval.Node) = New_Deref( (ffvsp[-3].Node), 1, (ffvsp[-1].Node),  0,  0,  0,   0 ); TEST((ffval.Node)); }\n#line 3164 \"y.tab.c\"\n    break;\n\n  case 116: /* bexpr: bexpr '[' expr ',' expr ']'  */\n#line 1088 \"eval.y\"\n                { (ffval.Node) = New_Deref( (ffvsp[-5].Node), 2, (ffvsp[-3].Node), (ffvsp[-1].Node),  0,  0,   0 ); TEST((ffval.Node)); }\n#line 3170 \"y.tab.c\"\n    break;\n\n  case 117: /* bexpr: bexpr '[' expr ',' expr ',' expr ']'  */\n#line 1090 \"eval.y\"\n                { (ffval.Node) = New_Deref( (ffvsp[-7].Node), 3, (ffvsp[-5].Node), (ffvsp[-3].Node), (ffvsp[-1].Node),  0,   0 ); TEST((ffval.Node)); }\n#line 3176 \"y.tab.c\"\n    break;\n\n  case 118: /* bexpr: bexpr '[' expr ',' expr ',' expr ',' expr ']'  */\n#line 1092 \"eval.y\"\n                { (ffval.Node) = New_Deref( (ffvsp[-9].Node), 4, (ffvsp[-7].Node), (ffvsp[-5].Node), (ffvsp[-3].Node), (ffvsp[-1].Node),   0 ); TEST((ffval.Node)); }\n#line 3182 \"y.tab.c\"\n    break;\n\n  case 119: /* bexpr: bexpr '[' expr ',' expr ',' expr ',' expr ',' expr ']'  */\n#line 1094 \"eval.y\"\n                { (ffval.Node) = New_Deref( (ffvsp[-11].Node), 5, (ffvsp[-9].Node), (ffvsp[-7].Node), (ffvsp[-5].Node), (ffvsp[-3].Node), (ffvsp[-1].Node) ); TEST((ffval.Node)); }\n#line 3188 \"y.tab.c\"\n    break;\n\n  case 120: /* bexpr: NOT bexpr  */\n#line 1096 \"eval.y\"\n                { (ffval.Node) = New_Unary( BOOLEAN, NOT, (ffvsp[0].Node) ); TEST((ffval.Node)); }\n#line 3194 \"y.tab.c\"\n    break;\n\n  case 121: /* bexpr: '(' bexpr ')'  */\n#line 1098 \"eval.y\"\n                { (ffval.Node) = (ffvsp[-1].Node); }\n#line 3200 \"y.tab.c\"\n    break;\n\n  case 122: /* sexpr: STRING  */\n#line 1102 \"eval.y\"\n                { (ffval.Node) = New_Const( STRING, (ffvsp[0].str), strlen((ffvsp[0].str))+1 ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = strlen((ffvsp[0].str)); }\n#line 3207 \"y.tab.c\"\n    break;\n\n  case 123: /* sexpr: SCOLUMN  */\n#line 1105 \"eval.y\"\n                { (ffval.Node) = New_Column( (ffvsp[0].lng) ); TEST((ffval.Node)); }\n#line 3213 \"y.tab.c\"\n    break;\n\n  case 124: /* sexpr: SCOLUMN '{' expr '}'  */\n#line 1107 \"eval.y\"\n                {\n                  if( TYPE((ffvsp[-1].Node)) != LONG\n\t\t      || OPER((ffvsp[-1].Node)) != CONST_OP ) {\n\t\t     fferror(\"Offset argument must be a constant integer\");\n\t\t     FFERROR;\n\t\t  }\n                  (ffval.Node) = New_Offset( (ffvsp[-3].lng), (ffvsp[-1].Node) ); TEST((ffval.Node));\n                }\n#line 3226 \"y.tab.c\"\n    break;\n\n  case 125: /* sexpr: SNULLREF  */\n#line 1116 \"eval.y\"\n                { (ffval.Node) = New_Func( STRING, null_fct, 0, 0, 0, 0, 0, 0, 0, 0 ); }\n#line 3232 \"y.tab.c\"\n    break;\n\n  case 126: /* sexpr: '(' sexpr ')'  */\n#line 1118 \"eval.y\"\n                { (ffval.Node) = (ffvsp[-1].Node); }\n#line 3238 \"y.tab.c\"\n    break;\n\n  case 127: /* sexpr: sexpr '+' sexpr  */\n#line 1120 \"eval.y\"\n                { \n\t\t  if (SIZE((ffvsp[-2].Node))+SIZE((ffvsp[0].Node)) >= MAX_STRLEN) {\n\t\t    fferror(\"Combined string size exceeds \" MAX_STRLEN_S \" characters\");\n\t\t    FFERROR;\n\t\t  }\n\t\t  (ffval.Node) = New_BinOp( STRING, (ffvsp[-2].Node), '+', (ffvsp[0].Node) );  TEST((ffval.Node));\n\t\t  SIZE((ffval.Node)) = SIZE((ffvsp[-2].Node)) + SIZE((ffvsp[0].Node));\n\t\t}\n#line 3251 \"y.tab.c\"\n    break;\n\n  case 128: /* sexpr: bexpr '?' sexpr ':' sexpr  */\n#line 1129 \"eval.y\"\n                {\n\t\t  int outSize;\n                  if( SIZE((ffvsp[-4].Node))!=1 ) {\n                     fferror(\"Cannot have a vector string column\");\n\t\t     FFERROR;\n                  }\n\t\t  /* Since the output can be calculated now, as a constant\n\t\t     scalar, we must precalculate the output size, in\n\t\t     order to avoid an overflow. */\n\t\t  outSize = SIZE((ffvsp[-2].Node));\n\t\t  if (SIZE((ffvsp[0].Node)) > outSize) outSize = SIZE((ffvsp[0].Node));\n                  (ffval.Node) = New_FuncSize( 0, ifthenelse_fct, 3, (ffvsp[-2].Node), (ffvsp[0].Node), (ffvsp[-4].Node),\n\t\t\t\t     0, 0, 0, 0, outSize);\n\t\t  \n                  TEST((ffval.Node));\n                  if( SIZE((ffvsp[-2].Node))<SIZE((ffvsp[0].Node)) )  Copy_Dims((ffval.Node), (ffvsp[0].Node));\n                }\n#line 3273 \"y.tab.c\"\n    break;\n\n  case 129: /* sexpr: FUNCTION sexpr ',' sexpr ')'  */\n#line 1148 \"eval.y\"\n                { \n\t\t  if (FSTRCMP((ffvsp[-4].str),\"DEFNULL(\") == 0) {\n\t\t     int outSize;\n\t\t     /* Since the output can be calculated now, as a constant\n\t\t\tscalar, we must precalculate the output size, in\n\t\t\torder to avoid an overflow. */\n\t\t     outSize = SIZE((ffvsp[-3].Node));\n\t\t     if (SIZE((ffvsp[-1].Node)) > outSize) outSize = SIZE((ffvsp[-1].Node));\n\t\t     \n\t\t     (ffval.Node) = New_FuncSize( 0, defnull_fct, 2, (ffvsp[-3].Node), (ffvsp[-1].Node), 0,\n\t\t\t\t\t0, 0, 0, 0, outSize );\n\t\t     TEST((ffval.Node)); \n\t\t     if( SIZE((ffvsp[-1].Node))>SIZE((ffvsp[-3].Node)) ) SIZE((ffval.Node)) = SIZE((ffvsp[-1].Node));\n\t\t  } else {\n\t\t     fferror(\"Function(string,string) not supported\");\n\t\t     FFERROR;\n\t\t  }\n\t\t}\n#line 3296 \"y.tab.c\"\n    break;\n\n  case 130: /* sexpr: FUNCTION sexpr ',' expr ',' expr ')'  */\n#line 1167 \"eval.y\"\n                { \n\t\t  if (FSTRCMP((ffvsp[-6].str),\"STRMID(\") == 0) {\n\t\t    int len;\n\t\t    if( TYPE((ffvsp[-3].Node)) != LONG || SIZE((ffvsp[-3].Node)) != 1 ||\n\t\t\tTYPE((ffvsp[-1].Node)) != LONG || SIZE((ffvsp[-1].Node)) != 1) {\n\t\t      fferror(\"When using STRMID(S,P,N), P and N must be integers (and not vector columns)\");\n\t\t      FFERROR;\n\t\t    }\n\t\t    if (OPER((ffvsp[-1].Node)) == CONST_OP) {\n\t\t      /* Constant value: use that directly */\n\t\t      len = (gParse.Nodes[(ffvsp[-1].Node)].value.data.lng);\n\t\t    } else {\n\t\t      /* Variable value: use the maximum possible (from $2) */\n\t\t      len = SIZE((ffvsp[-5].Node));\n\t\t    }\n\t\t    if (len <= 0 || len >= MAX_STRLEN) {\n\t\t      fferror(\"STRMID(S,P,N), N must be 1-\" MAX_STRLEN_S);\n\t\t      FFERROR;\n\t\t    }\n\t\t    (ffval.Node) = New_FuncSize( 0, strmid_fct, 3, (ffvsp[-5].Node), (ffvsp[-3].Node),(ffvsp[-1].Node),0,0,0,0,len);\n\t\t    TEST((ffval.Node));\n\t\t  } else {\n\t\t     fferror(\"Function(string,expr,expr) not supported\");\n\t\t     FFERROR;\n\t\t  }\n\t\t}\n#line 3327 \"y.tab.c\"\n    break;\n\n\n#line 3331 \"y.tab.c\"\n\n      default: break;\n    }\n  /* User semantic actions sometimes alter ffchar, and that requires\n     that fftoken be updated with the new translation.  We take the\n     approach of translating immediately before every use of fftoken.\n     One alternative is translating here after every semantic action,\n     but that translation would be missed if the semantic action invokes\n     FFABORT, FFACCEPT, or FFERROR immediately after altering ffchar or\n     if it invokes FFBACKUP.  In the case of FFABORT or FFACCEPT, an\n     incorrect destructor might then be invoked immediately.  In the\n     case of FFERROR or FFBACKUP, subsequent parser actions might lead\n     to an incorrect destructor call or verbose syntax error message\n     before the lookahead is translated.  */\n  FF_SYMBOL_PRINT (\"-> $$ =\", FF_CAST (ffsymbol_kind_t, ffr1[ffn]), &ffval, &ffloc);\n\n  FFPOPSTACK (fflen);\n  fflen = 0;\n\n  *++ffvsp = ffval;\n\n  /* Now 'shift' the result of the reduction.  Determine what state\n     that goes to, based on the state we popped back to and the rule\n     number reduced by.  */\n  {\n    const int fflhs = ffr1[ffn] - FFNTOKENS;\n    const int ffi = ffpgoto[fflhs] + *ffssp;\n    ffstate = (0 <= ffi && ffi <= FFLAST && ffcheck[ffi] == *ffssp\n               ? fftable[ffi]\n               : ffdefgoto[fflhs]);\n  }\n\n  goto ffnewstate;\n\n\n/*--------------------------------------.\n| fferrlab -- here on detecting error.  |\n`--------------------------------------*/\nfferrlab:\n  /* Make sure we have latest lookahead translation.  See comments at\n     user semantic actions for why this is necessary.  */\n  fftoken = ffchar == FFEMPTY ? FFSYMBOL_FFEMPTY : FFTRANSLATE (ffchar);\n  /* If not already recovering from an error, report this error.  */\n  if (!fferrstatus)\n    {\n      ++ffnerrs;\n      fferror (FF_(\"syntax error\"));\n    }\n\n  if (fferrstatus == 3)\n    {\n      /* If just tried and failed to reuse lookahead token after an\n         error, discard it.  */\n\n      if (ffchar <= FFEOF)\n        {\n          /* Return failure if at end of input.  */\n          if (ffchar == FFEOF)\n            FFABORT;\n        }\n      else\n        {\n          ffdestruct (\"Error: discarding\",\n                      fftoken, &fflval);\n          ffchar = FFEMPTY;\n        }\n    }\n\n  /* Else will try to reuse lookahead token after shifting the error\n     token.  */\n  goto fferrlab1;\n\n\n/*---------------------------------------------------.\n| fferrorlab -- error raised explicitly by FFERROR.  |\n`---------------------------------------------------*/\nfferrorlab:\n  /* Pacify compilers when the user code never invokes FFERROR and the\n     label fferrorlab therefore never appears in user code.  */\n  if (0)\n    FFERROR;\n\n  /* Do not reclaim the symbols of the rule whose action triggered\n     this FFERROR.  */\n  FFPOPSTACK (fflen);\n  fflen = 0;\n  FF_STACK_PRINT (ffss, ffssp);\n  ffstate = *ffssp;\n  goto fferrlab1;\n\n\n/*-------------------------------------------------------------.\n| fferrlab1 -- common code for both syntax error and FFERROR.  |\n`-------------------------------------------------------------*/\nfferrlab1:\n  fferrstatus = 3;      /* Each real token shifted decrements this.  */\n\n  /* Pop stack until we find a state that shifts the error token.  */\n  for (;;)\n    {\n      ffn = ffpact[ffstate];\n      if (!ffpact_value_is_default (ffn))\n        {\n          ffn += FFSYMBOL_FFerror;\n          if (0 <= ffn && ffn <= FFLAST && ffcheck[ffn] == FFSYMBOL_FFerror)\n            {\n              ffn = fftable[ffn];\n              if (0 < ffn)\n                break;\n            }\n        }\n\n      /* Pop the current state because it cannot handle the error token.  */\n      if (ffssp == ffss)\n        FFABORT;\n\n\n      ffdestruct (\"Error: popping\",\n                  FF_ACCESSING_SYMBOL (ffstate), ffvsp);\n      FFPOPSTACK (1);\n      ffstate = *ffssp;\n      FF_STACK_PRINT (ffss, ffssp);\n    }\n\n  FF_IGNORE_MAYBE_UNINITIALIZED_BEGIN\n  *++ffvsp = fflval;\n  FF_IGNORE_MAYBE_UNINITIALIZED_END\n\n\n  /* Shift the error token.  */\n  FF_SYMBOL_PRINT (\"Shifting\", FF_ACCESSING_SYMBOL (ffn), ffvsp, fflsp);\n\n  ffstate = ffn;\n  goto ffnewstate;\n\n\n/*-------------------------------------.\n| ffacceptlab -- FFACCEPT comes here.  |\n`-------------------------------------*/\nffacceptlab:\n  ffresult = 0;\n  goto ffreturn;\n\n\n/*-----------------------------------.\n| ffabortlab -- FFABORT comes here.  |\n`-----------------------------------*/\nffabortlab:\n  ffresult = 1;\n  goto ffreturn;\n\n\n#if !defined ffoverflow\n/*-------------------------------------------------.\n| ffexhaustedlab -- memory exhaustion comes here.  |\n`-------------------------------------------------*/\nffexhaustedlab:\n  fferror (FF_(\"memory exhausted\"));\n  ffresult = 2;\n  goto ffreturn;\n#endif\n\n\n/*-------------------------------------------------------.\n| ffreturn -- parsing is finished, clean up and return.  |\n`-------------------------------------------------------*/\nffreturn:\n  if (ffchar != FFEMPTY)\n    {\n      /* Make sure we have latest lookahead translation.  See comments at\n         user semantic actions for why this is necessary.  */\n      fftoken = FFTRANSLATE (ffchar);\n      ffdestruct (\"Cleanup: discarding lookahead\",\n                  fftoken, &fflval);\n    }\n  /* Do not reclaim the symbols of the rule whose action triggered\n     this FFABORT or FFACCEPT.  */\n  FFPOPSTACK (fflen);\n  FF_STACK_PRINT (ffss, ffssp);\n  while (ffssp != ffss)\n    {\n      ffdestruct (\"Cleanup: popping\",\n                  FF_ACCESSING_SYMBOL (+*ffssp), ffvsp);\n      FFPOPSTACK (1);\n    }\n#ifndef ffoverflow\n  if (ffss != ffssa)\n    FFSTACK_FREE (ffss);\n#endif\n\n  return ffresult;\n}\n\n#line 1196 \"eval.y\"\n\n\n/*************************************************************************/\n/*  Start of \"New\" routines which build the expression Nodal structure   */\n/*************************************************************************/\n\nstatic int Alloc_Node( void )\n{\n                      /* Use this for allocation to guarantee *Nodes */\n   Node *newNodePtr;  /* survives on failure, making it still valid  */\n                      /* while working our way out of this error     */\n\n   if( gParse.nNodes == gParse.nNodesAlloc ) {\n      if( gParse.Nodes ) {\n\t gParse.nNodesAlloc += gParse.nNodesAlloc;\n\t newNodePtr = (Node *)realloc( gParse.Nodes,\n\t\t\t\t       sizeof(Node)*gParse.nNodesAlloc );\n      } else {\n\t gParse.nNodesAlloc = 100;\n\t newNodePtr = (Node *)malloc ( sizeof(Node)*gParse.nNodesAlloc );\n      }\t \n\n      if( newNodePtr ) {\n\t gParse.Nodes = newNodePtr;\n      } else {\n\t gParse.status = MEMORY_ALLOCATION;\n\t return( -1 );\n      }\n   }\n\n   return ( gParse.nNodes++ );\n}\n\nstatic void Free_Last_Node( void )\n{\n   if( gParse.nNodes ) gParse.nNodes--;\n}\n\nstatic int New_Const( int returnType, void *value, long len )\n{\n   Node *this;\n   int n;\n\n   n = Alloc_Node();\n   if( n>=0 ) {\n      this             = gParse.Nodes + n;\n      this->operation  = CONST_OP;             /* Flag a constant */\n      this->DoOp       = NULL;\n      this->nSubNodes  = 0;\n      this->type       = returnType;\n      memcpy( &(this->value.data), value, len );\n      this->value.undef = NULL;\n      this->value.nelem = 1;\n      this->value.naxis = 1;\n      this->value.naxes[0] = 1;\n   }\n   return(n);\n}\n\nstatic int New_Column( int ColNum )\n{\n   Node *this;\n   int  n, i;\n\n   n = Alloc_Node();\n   if( n>=0 ) {\n      this              = gParse.Nodes + n;\n      this->operation   = -ColNum;\n      this->DoOp        = NULL;\n      this->nSubNodes   = 0;\n      this->type        = gParse.varData[ColNum].type;\n      this->value.nelem = gParse.varData[ColNum].nelem;\n      this->value.naxis = gParse.varData[ColNum].naxis;\n      for( i=0; i<gParse.varData[ColNum].naxis; i++ )\n\t this->value.naxes[i] = gParse.varData[ColNum].naxes[i];\n   }\n   return(n);\n}\n\nstatic int New_Offset( int ColNum, int offsetNode )\n{\n   Node *this;\n   int  n, i, colNode;\n\n   colNode = New_Column( ColNum );\n   if( colNode<0 ) return(-1);\n\n   n = Alloc_Node();\n   if( n>=0 ) {\n      this              = gParse.Nodes + n;\n      this->operation   = '{';\n      this->DoOp        = Do_Offset;\n      this->nSubNodes   = 2;\n      this->SubNodes[0] = colNode;\n      this->SubNodes[1] = offsetNode;\n      this->type        = gParse.varData[ColNum].type;\n      this->value.nelem = gParse.varData[ColNum].nelem;\n      this->value.naxis = gParse.varData[ColNum].naxis;\n      for( i=0; i<gParse.varData[ColNum].naxis; i++ )\n\t this->value.naxes[i] = gParse.varData[ColNum].naxes[i];\n   }\n   return(n);\n}\n\nstatic int New_Unary( int returnType, int Op, int Node1 )\n{\n   Node *this, *that;\n   int  i,n;\n\n   if( Node1<0 ) return(-1);\n   that = gParse.Nodes + Node1;\n\n   if( !Op ) Op = returnType;\n\n   if( (Op==DOUBLE || Op==FLTCAST) && that->type==DOUBLE  ) return( Node1 );\n   if( (Op==LONG   || Op==INTCAST) && that->type==LONG    ) return( Node1 );\n   if( (Op==BOOLEAN              ) && that->type==BOOLEAN ) return( Node1 );\n   \n   n = Alloc_Node();\n   if( n>=0 ) {\n      this              = gParse.Nodes + n;\n      this->operation   = Op;\n      this->DoOp        = Do_Unary;\n      this->nSubNodes   = 1;\n      this->SubNodes[0] = Node1;\n      this->type        = returnType;\n\n      that              = gParse.Nodes + Node1; /* Reset in case .Nodes mv'd */\n      this->value.nelem = that->value.nelem;\n      this->value.naxis = that->value.naxis;\n      for( i=0; i<that->value.naxis; i++ )\n\t this->value.naxes[i] = that->value.naxes[i];\n\n      if( that->operation==CONST_OP ) this->DoOp( this );\n   }\n   return( n );\n}\n\nstatic int New_BinOp( int returnType, int Node1, int Op, int Node2 )\n{\n   Node *this,*that1,*that2;\n   int  n,i,constant;\n\n   if( Node1<0 || Node2<0 ) return(-1);\n\n   n = Alloc_Node();\n   if( n>=0 ) {\n      this             = gParse.Nodes + n;\n      this->operation  = Op;\n      this->nSubNodes  = 2;\n      this->SubNodes[0]= Node1;\n      this->SubNodes[1]= Node2;\n      this->type       = returnType;\n\n      that1            = gParse.Nodes + Node1;\n      that2            = gParse.Nodes + Node2;\n      constant         = (that1->operation==CONST_OP\n                          && that2->operation==CONST_OP);\n      if( that1->type!=STRING && that1->type!=BITSTR )\n\t if( !Test_Dims( Node1, Node2 ) ) {\n\t    Free_Last_Node();\n\t    fferror(\"Array sizes/dims do not match for binary operator\");\n\t    return(-1);\n\t }\n      if( that1->value.nelem == 1 ) that1 = that2;\n\n      this->value.nelem = that1->value.nelem;\n      this->value.naxis = that1->value.naxis;\n      for( i=0; i<that1->value.naxis; i++ )\n\t this->value.naxes[i] = that1->value.naxes[i];\n\n      if ( Op == ACCUM && that1->type == BITSTR ) {\n\t/* ACCUM is rank-reducing on bit strings */\n\tthis->value.nelem = 1;\n\tthis->value.naxis = 1;\n\tthis->value.naxes[0] = 1;\n      }\n\n      /*  Both subnodes should be of same time  */\n      switch( that1->type ) {\n      case BITSTR:  this->DoOp = Do_BinOp_bit;  break;\n      case STRING:  this->DoOp = Do_BinOp_str;  break;\n      case BOOLEAN: this->DoOp = Do_BinOp_log;  break;\n      case LONG:    this->DoOp = Do_BinOp_lng;  break;\n      case DOUBLE:  this->DoOp = Do_BinOp_dbl;  break;\n      }\n      if( constant ) this->DoOp( this );\n   }\n   return( n );\n}\n\nstatic int New_Func( int returnType, funcOp Op, int nNodes,\n\t\t     int Node1, int Node2, int Node3, int Node4, \n\t\t     int Node5, int Node6, int Node7 )\n{\n  return New_FuncSize(returnType, Op, nNodes,\n\t\t      Node1, Node2, Node3, Node4, \n\t\t      Node5, Node6, Node7, 0);\n}\n\nstatic int New_FuncSize( int returnType, funcOp Op, int nNodes,\n\t\t     int Node1, int Node2, int Node3, int Node4, \n\t\t\t int Node5, int Node6, int Node7, int Size )\n/* If returnType==0 , use Node1's type and vector sizes as returnType, */\n/* else return a single value of type returnType                       */\n{\n   Node *this, *that;\n   int  i,n,constant;\n\n   if( Node1<0 || Node2<0 || Node3<0 || Node4<0 || \n       Node5<0 || Node6<0 || Node7<0 ) return(-1);\n\n   n = Alloc_Node();\n   if( n>=0 ) {\n      this              = gParse.Nodes + n;\n      this->operation   = (int)Op;\n      this->DoOp        = Do_Func;\n      this->nSubNodes   = nNodes;\n      this->SubNodes[0] = Node1;\n      this->SubNodes[1] = Node2;\n      this->SubNodes[2] = Node3;\n      this->SubNodes[3] = Node4;\n      this->SubNodes[4] = Node5;\n      this->SubNodes[5] = Node6;\n      this->SubNodes[6] = Node7;\n      i = constant = nNodes;    /* Functions with zero params are not const */\n      if (Op == poirnd_fct) constant = 0; /* Nor is Poisson deviate */\n\n      while( i-- )\n\tconstant = ( constant && OPER(this->SubNodes[i]) == CONST_OP );\n      \n      if( returnType ) {\n\t this->type           = returnType;\n\t this->value.nelem    = 1;\n\t this->value.naxis    = 1;\n\t this->value.naxes[0] = 1;\n      } else {\n\t that              = gParse.Nodes + Node1;\n\t this->type        = that->type;\n\t this->value.nelem = that->value.nelem;\n\t this->value.naxis = that->value.naxis;\n\t for( i=0; i<that->value.naxis; i++ )\n\t    this->value.naxes[i] = that->value.naxes[i];\n      }\n      /* Force explicit size before evaluating */\n      if (Size > 0) this->value.nelem = Size;\n\n      if( constant ) this->DoOp( this );\n   }\n   return( n );\n}\n\nstatic int New_Deref( int Var,  int nDim,\n\t\t      int Dim1, int Dim2, int Dim3, int Dim4, int Dim5 )\n{\n   int n, idx, constant;\n   long elem=0;\n   Node *this, *theVar, *theDim[MAXDIMS];\n\n   if( Var<0 || Dim1<0 || Dim2<0 || Dim3<0 || Dim4<0 || Dim5<0 ) return(-1);\n\n   theVar = gParse.Nodes + Var;\n   if( theVar->operation==CONST_OP || theVar->value.nelem==1 ) {\n      fferror(\"Cannot index a scalar value\");\n      return(-1);\n   }\n\n   n = Alloc_Node();\n   if( n>=0 ) {\n      this              = gParse.Nodes + n;\n      this->nSubNodes   = nDim+1;\n      theVar            = gParse.Nodes + (this->SubNodes[0]=Var);\n      theDim[0]         = gParse.Nodes + (this->SubNodes[1]=Dim1);\n      theDim[1]         = gParse.Nodes + (this->SubNodes[2]=Dim2);\n      theDim[2]         = gParse.Nodes + (this->SubNodes[3]=Dim3);\n      theDim[3]         = gParse.Nodes + (this->SubNodes[4]=Dim4);\n      theDim[4]         = gParse.Nodes + (this->SubNodes[5]=Dim5);\n      constant          = theVar->operation==CONST_OP;\n      for( idx=0; idx<nDim; idx++ )\n\t constant = (constant && theDim[idx]->operation==CONST_OP);\n\n      for( idx=0; idx<nDim; idx++ )\n\t if( theDim[idx]->value.nelem>1 ) {\n\t    Free_Last_Node();\n\t    fferror(\"Cannot use an array as an index value\");\n\t    return(-1);\n\t } else if( theDim[idx]->type!=LONG ) {\n\t    Free_Last_Node();\n\t    fferror(\"Index value must be an integer type\");\n\t    return(-1);\n\t }\n\n      this->operation   = '[';\n      this->DoOp        = Do_Deref;\n      this->type        = theVar->type;\n\n      if( theVar->value.naxis == nDim ) { /* All dimensions specified */\n\t this->value.nelem    = 1;\n\t this->value.naxis    = 1;\n\t this->value.naxes[0] = 1;\n      } else if( nDim==1 ) { /* Dereference only one dimension */\n\t elem=1;\n\t this->value.naxis = theVar->value.naxis-1;\n\t for( idx=0; idx<this->value.naxis; idx++ ) {\n\t    elem *= ( this->value.naxes[idx] = theVar->value.naxes[idx] );\n\t }\n\t this->value.nelem = elem;\n      } else {\n\t Free_Last_Node();\n\t fferror(\"Must specify just one or all indices for vector\");\n\t return(-1);\n      }\n      if( constant ) this->DoOp( this );\n   }\n   return(n);\n}\n\nextern int ffGetVariable( char *varName, FFSTYPE *varVal );\n\nstatic int New_GTI( funcOp Op, char *fname, int Node1, int Node2, char *start, char *stop )\n{\n   fitsfile *fptr;\n   Node *this, *that0, *that1, *that2;\n   int  type,i,n, startCol, stopCol, Node0;\n   int  hdutype, hdunum, evthdu, samefile, extvers, movetotype, tstat;\n   char extname[100];\n   long nrows;\n   double timeZeroI[2], timeZeroF[2], dt, timeSpan;\n   char xcol[20], xexpr[20];\n   FFSTYPE colVal;\n\n   if( Op == gtifilt_fct && Node1==-99 ) {\n      type = ffGetVariable( \"TIME\", &colVal );\n      if( type==COLUMN ) {\n\t Node1 = New_Column( (int)colVal.lng );\n      } else {\n\t fferror(\"Could not build TIME column for GTIFILTER\");\n\t return(-1);\n      }\n   }\n\n   if (Op == gtiover_fct) {\n     if (Node1 == -99 || Node2 == -99) {\n       fferror(\"startExpr and stopExpr values must be defined for GTIOVERLAP\");\n       return(-1);\n     }\n     /* Also case TIME_STOP to double precision */\n     Node2 = New_Unary( DOUBLE, 0, Node2 );\n     if (Node2 < 0) return(-1);\n\n   }\n\n   /* Type cast TIME to double precision */\n   Node1 = New_Unary( DOUBLE, 0, Node1 );\n   Node0 = Alloc_Node(); /* This will hold the START/STOP times */\n   if( Node1<0 || Node0<0 ) return(-1);\n\n   /*  Record current HDU number in case we need to move within this file  */\n\n   fptr = gParse.def_fptr;\n   ffghdn( fptr, &evthdu );\n\n   /*  Look for TIMEZERO keywords in current extension  */\n\n   tstat = 0;\n   if( ffgkyd( fptr, \"TIMEZERO\", timeZeroI, NULL, &tstat ) ) {\n      tstat = 0;\n      if( ffgkyd( fptr, \"TIMEZERI\", timeZeroI, NULL, &tstat ) ) {\n\t timeZeroI[0] = timeZeroF[0] = 0.0;\n      } else if( ffgkyd( fptr, \"TIMEZERF\", timeZeroF, NULL, &tstat ) ) {\n\t timeZeroF[0] = 0.0;\n      }\n   } else {\n      timeZeroF[0] = 0.0;\n   }\n\n   /*  Resolve filename parameter  */\n\n   switch( fname[0] ) {\n   case '\\0':\n      samefile = 1;\n      hdunum = 1;\n      break;\n   case '[':\n      samefile = 1;\n      i = 1;\n      while( fname[i] != '\\0' && fname[i] != ']' ) i++;\n      if( fname[i] ) {\n\t fname[i] = '\\0';\n\t fname++;\n\t ffexts( fname, &hdunum, extname, &extvers, &movetotype,\n\t\t xcol, xexpr, &gParse.status );\n         if( *extname ) {\n\t    ffmnhd( fptr, movetotype, extname, extvers, &gParse.status );\n\t    ffghdn( fptr, &hdunum );\n\t } else if( hdunum ) {\n\t    ffmahd( fptr, ++hdunum, &hdutype, &gParse.status );\n\t } else if( !gParse.status ) {\n\t    fferror(\"Cannot use primary array for GTI filter\");\n\t    return( -1 );\n\t }\n      } else {\n\t fferror(\"File extension specifier lacks closing ']'\");\n\t return( -1 );\n      }\n      break;\n   case '+':\n      samefile = 1;\n      hdunum = atoi( fname ) + 1;\n      if( hdunum>1 )\n\t ffmahd( fptr, hdunum, &hdutype, &gParse.status );\n      else {\n\t fferror(\"Cannot use primary array for GTI filter\");\n\t return( -1 );\n      }\n      break;\n   default:\n      samefile = 0;\n      if( ! ffopen( &fptr, fname, READONLY, &gParse.status ) )\n\t ffghdn( fptr, &hdunum );\n      break;\n   }\n   if( gParse.status ) return(-1);\n\n   /*  If at primary, search for GTI extension  */\n\n   if( hdunum==1 ) {\n      while( 1 ) {\n\t hdunum++;\n\t if( ffmahd( fptr, hdunum, &hdutype, &gParse.status ) ) break;\n\t if( hdutype==IMAGE_HDU ) continue;\n\t tstat = 0;\n\t if( ffgkys( fptr, \"EXTNAME\", extname, NULL, &tstat ) ) continue;\n\t ffupch( extname );\n\t if( strstr( extname, \"GTI\" ) ) break;\n      }\n      if( gParse.status ) {\n\t if( gParse.status==END_OF_FILE )\n\t    fferror(\"GTI extension not found in this file\");\n\t return(-1);\n      }\n   }\n\n   /*  Locate START/STOP Columns  */\n\n   ffgcno( fptr, CASEINSEN, start, &startCol, &gParse.status );\n   ffgcno( fptr, CASEINSEN, stop,  &stopCol,  &gParse.status );\n   if( gParse.status ) return(-1);\n\n   /*  Look for TIMEZERO keywords in GTI extension  */\n\n   tstat = 0;\n   if( ffgkyd( fptr, \"TIMEZERO\", timeZeroI+1, NULL, &tstat ) ) {\n      tstat = 0;\n      if( ffgkyd( fptr, \"TIMEZERI\", timeZeroI+1, NULL, &tstat ) ) {\n\t timeZeroI[1] = timeZeroF[1] = 0.0;\n      } else if( ffgkyd( fptr, \"TIMEZERF\", timeZeroF+1, NULL, &tstat ) ) {\n\t timeZeroF[1] = 0.0;\n      }\n   } else {\n      timeZeroF[1] = 0.0;\n   }\n\n   n = Alloc_Node();\n   if( n >= 0 ) {\n      this                 = gParse.Nodes + n;\n      this->SubNodes[1]    = Node1;\n      this->operation      = (int) Op;\n      if (Op == gtifilt_fct) {\n\tthis->nSubNodes      = 2;\n\tthis->DoOp           = Do_GTI;\n\tthis->type           = BOOLEAN;\n      } else {\n\tthis->nSubNodes      = 3;\n\tthis->DoOp           = Do_GTI_Over;\n\tthis->type           = DOUBLE;\n      }\n      that1                = gParse.Nodes + Node1;\n      this->value.nelem    = that1->value.nelem;\n      this->value.naxis    = that1->value.naxis;\n      for( i=0; i < that1->value.naxis; i++ )\n\t this->value.naxes[i] = that1->value.naxes[i];\n      if (Op == gtiover_fct) {\n\tthis->SubNodes[2]  = Node2;\n\tthat2 = gParse.Nodes + Node2;\n\tif (that1->value.nelem != that2->value.nelem) {\n\t  fferror(\"Dimensions of TIME and TIME_STOP must match for GTIOVERLAP\");\n\t  return(-1);\n\t}\n      }\n\n      /* Init START/STOP node to be treated as a \"constant\" */\n\n      this->SubNodes[0]    = Node0;\n      that0                = gParse.Nodes + Node0;\n      that0->operation     = CONST_OP;\n      that0->DoOp          = NULL;\n      that0->value.data.ptr= NULL;\n\n      /*  Read in START/STOP times  */\n\n      if( ffgkyj( fptr, \"NAXIS2\", &nrows, NULL, &gParse.status ) )\n\t return(-1);\n      that0->value.nelem = nrows;\n      if( nrows ) {\n\n\t that0->value.data.dblptr = (double*)malloc( 2*nrows*sizeof(double) );\n\t if( !that0->value.data.dblptr ) {\n\t    gParse.status = MEMORY_ALLOCATION;\n\t    return(-1);\n\t }\n\t \n\t ffgcvd( fptr, startCol, 1L, 1L, nrows, 0.0,\n\t\t that0->value.data.dblptr, &i, &gParse.status );\n\t ffgcvd( fptr, stopCol, 1L, 1L, nrows, 0.0,\n\t\t that0->value.data.dblptr+nrows, &i, &gParse.status );\n\t if( gParse.status ) {\n\t    free( that0->value.data.dblptr );\n\t    return(-1);\n\t }\n\n\t /*  Test for fully time-ordered GTI... both START && STOP  */\n\n\t that0->type = 1; /*  Assume yes  */\n\t i = nrows;\n\t while( --i )\n\t    if(    that0->value.data.dblptr[i-1]\n                   >= that0->value.data.dblptr[i]\n\t\t|| that0->value.data.dblptr[i-1+nrows]\n\t\t   >= that0->value.data.dblptr[i+nrows] ) {\n\t       that0->type = 0;\n\t       break;\n\t    }\n\n\t /* GTIOVERLAP() requires ordered GTI */\n\t if (that0->type != 1 && Op == gtiover_fct) {\n\t   fferror(\"Input GTI must be time-ordered for GTIOVERLAP\");\n\t   return(-1);\n\t }\n\t \n\t /*  Handle TIMEZERO offset, if any  */\n\t \n\t dt = (timeZeroI[1] - timeZeroI[0]) + (timeZeroF[1] - timeZeroF[0]);\n\t timeSpan = that0->value.data.dblptr[nrows+nrows-1]\n\t    - that0->value.data.dblptr[0];\n\t \n\t if( fabs( dt / timeSpan ) > 1e-12 ) {\n\t    for( i=0; i<(nrows+nrows); i++ )\n\t       that0->value.data.dblptr[i] += dt;\n\t }\n      }\n      /* If Node1 is constant (gtifilt_fct) or\n\t Node1 and Node2 are constant (gtiover_fct), then evaluate now */\n      if( OPER(Node1)==CONST_OP && (Op == gtifilt_fct || OPER(Node2)==CONST_OP)) {\n\tthis->DoOp( this );\n      }\n   }\n\n   if( samefile )\n      ffmahd( fptr, evthdu, &hdutype, &gParse.status );\n   else\n      ffclos( fptr, &gParse.status );\n\n   return( n );\n}\n\nstatic int New_REG( char *fname, int NodeX, int NodeY, char *colNames )\n{\n   Node *this, *that0;\n   int  type, n, Node0;\n   int  Xcol, Ycol, tstat;\n   WCSdata wcs;\n   SAORegion *Rgn;\n   char *cX, *cY;\n   FFSTYPE colVal;\n\n   if( NodeX==-99 ) {\n      type = ffGetVariable( \"X\", &colVal );\n      if( type==COLUMN ) {\n\t NodeX = New_Column( (int)colVal.lng );\n      } else {\n\t fferror(\"Could not build X column for REGFILTER\");\n\t return(-1);\n      }\n   }\n   if( NodeY==-99 ) {\n      type = ffGetVariable( \"Y\", &colVal );\n      if( type==COLUMN ) {\n\t NodeY = New_Column( (int)colVal.lng );\n      } else {\n\t fferror(\"Could not build Y column for REGFILTER\");\n\t return(-1);\n      }\n   }\n   NodeX = New_Unary( DOUBLE, 0, NodeX );\n   NodeY = New_Unary( DOUBLE, 0, NodeY );\n   Node0 = Alloc_Node(); /* This will hold the Region Data */\n   if( NodeX<0 || NodeY<0 || Node0<0 ) return(-1);\n\n   if( ! (Test_Dims( NodeX, NodeY ) ) ) {\n     fferror(\"Dimensions of REGFILTER arguments are not compatible\");\n     return (-1);\n   }\n\n   n = Alloc_Node();\n   if( n >= 0 ) {\n      this                 = gParse.Nodes + n;\n      this->nSubNodes      = 3;\n      this->SubNodes[0]    = Node0;\n      this->SubNodes[1]    = NodeX;\n      this->SubNodes[2]    = NodeY;\n      this->operation      = (int)regfilt_fct;\n      this->DoOp           = Do_REG;\n      this->type           = BOOLEAN;\n      this->value.nelem    = 1;\n      this->value.naxis    = 1;\n      this->value.naxes[0] = 1;\n      \n      Copy_Dims(n, NodeX);\n      if( SIZE(NodeX)<SIZE(NodeY) )  Copy_Dims(n, NodeY);\n\n      /* Init Region node to be treated as a \"constant\" */\n\n      that0                = gParse.Nodes + Node0;\n      that0->operation     = CONST_OP;\n      that0->DoOp          = NULL;\n\n      /*  Identify what columns to use for WCS information  */\n\n      Xcol = Ycol = 0;\n      if( *colNames ) {\n\t /*  Use the column names in this string for WCS info  */\n\t while( *colNames==' ' ) colNames++;\n\t cX = cY = colNames;\n\t while( *cY && *cY!=' ' && *cY!=',' ) cY++;\n\t if( *cY )\n\t    *(cY++) = '\\0';\n\t while( *cY==' ' ) cY++;\n\t if( !*cY ) {\n\t    fferror(\"Could not extract valid pair of column names from REGFILTER\");\n\t    Free_Last_Node();\n\t    return( -1 );\n\t }\n\t fits_get_colnum( gParse.def_fptr, CASEINSEN, cX, &Xcol,\n\t\t\t  &gParse.status );\n\t fits_get_colnum( gParse.def_fptr, CASEINSEN, cY, &Ycol,\n\t\t\t  &gParse.status );\n\t if( gParse.status ) {\n\t    fferror(\"Could not locate columns indicated for WCS info\");\n\t    Free_Last_Node();\n\t    return( -1 );\n\t }\n\n      } else {\n\t /*  Try to find columns used in X/Y expressions  */\n\t Xcol = Locate_Col( gParse.Nodes + NodeX );\n\t Ycol = Locate_Col( gParse.Nodes + NodeY );\n\t if( Xcol<0 || Ycol<0 ) {\n\t    fferror(\"Found multiple X/Y column references in REGFILTER\");\n\t    Free_Last_Node();\n\t    return( -1 );\n\t }\n      }\n\n      /*  Now, get the WCS info, if it exists, from the indicated columns  */\n      wcs.exists = 0;\n      if( Xcol>0 && Ycol>0 ) {\n\t tstat = 0;\n\t ffgtcs( gParse.def_fptr, Xcol, Ycol,\n\t\t &wcs.xrefval, &wcs.yrefval,\n\t\t &wcs.xrefpix, &wcs.yrefpix,\n\t\t &wcs.xinc,    &wcs.yinc,\n\t\t &wcs.rot,      wcs.type,\n\t\t &tstat );\n\t if( tstat==NO_WCS_KEY ) {\n\t    wcs.exists = 0;\n\t } else if( tstat ) {\n\t    gParse.status = tstat;\n\t    Free_Last_Node();\n\t    return( -1 );\n\t } else {\n\t    wcs.exists = 1;\n\t }\n      }\n\n      /*  Read in Region file  */\n\n      fits_read_rgnfile( fname, &wcs, &Rgn, &gParse.status );\n      if( gParse.status ) {\n\t Free_Last_Node();\n\t return( -1 );\n      }\n\n      that0->value.data.ptr = Rgn;\n\n      if( OPER(NodeX)==CONST_OP && OPER(NodeY)==CONST_OP )\n\t this->DoOp( this );\n   }\n\n   return( n );\n}\n\nstatic int New_Vector( int subNode )\n{\n   Node *this, *that;\n   int n;\n\n   n = Alloc_Node();\n   if( n >= 0 ) {\n      this              = gParse.Nodes + n;\n      that              = gParse.Nodes + subNode;\n      this->type        = that->type;\n      this->nSubNodes   = 1;\n      this->SubNodes[0] = subNode;\n      this->operation   = '{';\n      this->DoOp        = Do_Vector;\n   }\n\n   return( n );\n}\n\nstatic int Close_Vec( int vecNode )\n{\n   Node *this;\n   int n, nelem=0;\n\n   this = gParse.Nodes + vecNode;\n   for( n=0; n < this->nSubNodes; n++ ) {\n      if( TYPE( this->SubNodes[n] ) != this->type ) {\n\t this->SubNodes[n] = New_Unary( this->type, 0, this->SubNodes[n] );\n\t if( this->SubNodes[n]<0 ) return(-1);\n      }\n      nelem += SIZE(this->SubNodes[n]);\n   }\n   this->value.naxis    = 1;\n   this->value.nelem    = nelem;\n   this->value.naxes[0] = nelem;\n\n   return( vecNode );\n}\n\nstatic int Locate_Col( Node *this )\n/*  Locate the TABLE column number of any columns in \"this\" calculation.  */\n/*  Return ZERO if none found, or negative if more than 1 found.          */\n{\n   Node *that;\n   int  i, col=0, newCol, nfound=0;\n   \n   if( this->nSubNodes==0\n       && this->operation<=0 && this->operation!=CONST_OP )\n      return gParse.colData[ - this->operation].colnum;\n\n   for( i=0; i<this->nSubNodes; i++ ) {\n      that = gParse.Nodes + this->SubNodes[i];\n      if( that->operation>0 ) {\n\t newCol = Locate_Col( that );\n\t if( newCol<=0 ) {\n\t    nfound += -newCol;\n\t } else {\n\t    if( !nfound ) {\n\t       col = newCol;\n\t       nfound++;\n\t    } else if( col != newCol ) {\n\t       nfound++;\n\t    }\n\t }\n      } else if( that->operation!=CONST_OP ) {\n\t /*  Found a Column  */\n\t newCol = gParse.colData[- that->operation].colnum;\n\t if( !nfound ) {\n\t    col = newCol;\n\t    nfound++;\n\t } else if( col != newCol ) {\n\t    nfound++;\n\t }\n      }\n   }\n   if( nfound!=1 )\n      return( - nfound );\n   else\n      return( col );\n}\n\nstatic int Test_Dims( int Node1, int Node2 )\n{\n   Node *that1, *that2;\n   int valid, i;\n\n   if( Node1<0 || Node2<0 ) return(0);\n\n   that1 = gParse.Nodes + Node1;\n   that2 = gParse.Nodes + Node2;\n\n   if( that1->value.nelem==1 || that2->value.nelem==1 )\n      valid = 1;\n   else if( that1->type==that2->type\n\t    && that1->value.nelem==that2->value.nelem\n\t    && that1->value.naxis==that2->value.naxis ) {\n      valid = 1;\n      for( i=0; i<that1->value.naxis; i++ ) {\n\t if( that1->value.naxes[i]!=that2->value.naxes[i] )\n\t    valid = 0;\n      }\n   } else\n      valid = 0;\n   return( valid );\n}   \n\nstatic void Copy_Dims( int Node1, int Node2 )\n{\n   Node *that1, *that2;\n   int i;\n\n   if( Node1<0 || Node2<0 ) return;\n\n   that1 = gParse.Nodes + Node1;\n   that2 = gParse.Nodes + Node2;\n\n   that1->value.nelem = that2->value.nelem;\n   that1->value.naxis = that2->value.naxis;\n   for( i=0; i<that2->value.naxis; i++ )\n      that1->value.naxes[i] = that2->value.naxes[i];\n}\n\n/********************************************************************/\n/*    Routines for actually evaluating the expression start here    */\n/********************************************************************/\n\nvoid Evaluate_Parser( long firstRow, long nRows )\n    /***********************************************************************/\n    /*  Reset the parser for processing another batch of data...           */\n    /*    firstRow:  Row number of the first element to evaluate           */\n    /*    nRows:     Number of rows to be processed                        */\n    /*  Initialize each COLUMN node so that its UNDEF and DATA pointers    */\n    /*  point to the appropriate column arrays.                            */\n    /*  Finally, call Evaluate_Node for final node.                        */\n    /***********************************************************************/\n{\n   int     i, column;\n   long    offset, rowOffset;\n   static int rand_initialized = 0;\n\n   /* Initialize the random number generator once and only once */\n   if (rand_initialized == 0) {\n     simplerng_srand( (unsigned int) time(NULL) );\n     rand_initialized = 1;\n   }\n\n   gParse.firstRow = firstRow;\n   gParse.nRows    = nRows;\n\n   /*  Reset Column Nodes' pointers to point to right data and UNDEF arrays  */\n\n   rowOffset = firstRow - gParse.firstDataRow;\n   for( i=0; i<gParse.nNodes; i++ ) {\n     if(    OPER(i) >  0 || OPER(i) == CONST_OP ) continue;\n\n      column = -OPER(i);\n      offset = gParse.varData[column].nelem * rowOffset;\n\n      gParse.Nodes[i].value.undef = gParse.varData[column].undef + offset;\n\n      switch( gParse.Nodes[i].type ) {\n      case BITSTR:\n\t gParse.Nodes[i].value.data.strptr =\n\t    (char**)gParse.varData[column].data + rowOffset;\n\t gParse.Nodes[i].value.undef       = NULL;\n\t break;\n      case STRING:\n\t gParse.Nodes[i].value.data.strptr = \n\t    (char**)gParse.varData[column].data + rowOffset;\n\t gParse.Nodes[i].value.undef = gParse.varData[column].undef + rowOffset;\n\t break;\n      case BOOLEAN:\n\t gParse.Nodes[i].value.data.logptr = \n\t    (char*)gParse.varData[column].data + offset;\n\t break;\n      case LONG:\n\t gParse.Nodes[i].value.data.lngptr = \n\t    (long*)gParse.varData[column].data + offset;\n\t break;\n      case DOUBLE:\n\t gParse.Nodes[i].value.data.dblptr = \n\t    (double*)gParse.varData[column].data + offset;\n\t break;\n      }\n   }\n\n   Evaluate_Node( gParse.resultNode );\n}\n\nstatic void Evaluate_Node( int thisNode )\n    /**********************************************************************/\n    /*  Recursively evaluate thisNode's subNodes, then call one of the    */\n    /*  Do_<Action> functions pointed to by thisNode's DoOp element.      */\n    /**********************************************************************/\n{\n   Node *this;\n   int i;\n   \n   if( gParse.status ) return;\n\n   this = gParse.Nodes + thisNode;\n   if( this->operation>0 ) {  /* <=0 indicate constants and columns */\n      i = this->nSubNodes;\n      while( i-- ) {\n\t Evaluate_Node( this->SubNodes[i] );\n\t if( gParse.status ) return;\n      }\n      this->DoOp( this );\n   }\n}\n\nstatic void Allocate_Ptrs( Node *this )\n{\n   long elem, row, size;\n\n   if( this->type==BITSTR || this->type==STRING ) {\n\n      this->value.data.strptr = (char**)malloc( gParse.nRows\n\t\t\t\t\t\t* sizeof(char*) );\n      if( this->value.data.strptr ) {\n\t this->value.data.strptr[0] = (char*)malloc( gParse.nRows\n\t\t\t\t\t\t     * (this->value.nelem+2)\n\t\t\t\t\t\t     * sizeof(char) );\n\t if( this->value.data.strptr[0] ) {\n\t    row = 0;\n\t    while( (++row)<gParse.nRows ) {\n\t       this->value.data.strptr[row] =\n\t\t  this->value.data.strptr[row-1] + this->value.nelem+1;\n\t    }\n\t    if( this->type==STRING ) {\n\t       this->value.undef = this->value.data.strptr[row-1]\n                                   + this->value.nelem+1;\n\t    } else {\n\t       this->value.undef = NULL;  /* BITSTRs don't use undef array */\n\t    }\n\t } else {\n\t    gParse.status = MEMORY_ALLOCATION;\n\t    free( this->value.data.strptr );\n\t }\n      } else {\n\t gParse.status = MEMORY_ALLOCATION;\n      }\n\n   } else {\n\n      elem = this->value.nelem * gParse.nRows;\n      switch( this->type ) {\n      case DOUBLE:  size = sizeof( double ); break;\n      case LONG:    size = sizeof( long   ); break;\n      case BOOLEAN: size = sizeof( char   ); break;\n      default:      size = 1;                break;\n      }\n\n      this->value.data.ptr = calloc(size+1, elem);\n\n      if( this->value.data.ptr==NULL ) {\n\t gParse.status = MEMORY_ALLOCATION;\n      } else {\n\t this->value.undef = (char *)this->value.data.ptr + elem*size;\n      }\n   }\n}\n\nstatic void Do_Unary( Node *this )\n{\n   Node *that;\n   long elem;\n\n   that = gParse.Nodes + this->SubNodes[0];\n\n   if( that->operation==CONST_OP ) {  /* Operating on a constant! */\n      switch( this->operation ) {\n      case DOUBLE:\n      case FLTCAST:\n\t if( that->type==LONG )\n\t    this->value.data.dbl = (double)that->value.data.lng;\n\t else if( that->type==BOOLEAN )\n\t    this->value.data.dbl = ( that->value.data.log ? 1.0 : 0.0 );\n\t break;\n      case LONG:\n      case INTCAST:\n\t if( that->type==DOUBLE )\n\t    this->value.data.lng = (long)that->value.data.dbl;\n\t else if( that->type==BOOLEAN )\n\t    this->value.data.lng = ( that->value.data.log ? 1L : 0L );\n\t break;\n      case BOOLEAN:\n\t if( that->type==DOUBLE )\n\t    this->value.data.log = ( that->value.data.dbl != 0.0 );\n\t else if( that->type==LONG )\n\t    this->value.data.log = ( that->value.data.lng != 0L );\n\t break;\n      case UMINUS:\n\t if( that->type==DOUBLE )\n\t    this->value.data.dbl = - that->value.data.dbl;\n\t else if( that->type==LONG )\n\t    this->value.data.lng = - that->value.data.lng;\n\t break;\n      case NOT:\n\t if( that->type==BOOLEAN )\n\t    this->value.data.log = ( ! that->value.data.log );\n\t else if( that->type==BITSTR )\n\t    bitnot( this->value.data.str, that->value.data.str );\n\t break;\n      }\n      this->operation = CONST_OP;\n\n   } else {\n\n      Allocate_Ptrs( this );\n\n      if( !gParse.status ) {\n\n\t if( this->type!=BITSTR ) {\n\t    elem = gParse.nRows;\n\t    if( this->type!=STRING )\n\t       elem *= this->value.nelem;\n\t    while( elem-- )\n\t       this->value.undef[elem] = that->value.undef[elem];\n\t }\n\n\t elem = gParse.nRows * this->value.nelem;\n\n\t switch( this->operation ) {\n\n\t case BOOLEAN:\n\t    if( that->type==DOUBLE )\n\t       while( elem-- )\n\t\t  this->value.data.logptr[elem] =\n\t\t     ( that->value.data.dblptr[elem] != 0.0 );\n\t    else if( that->type==LONG )\n\t       while( elem-- )\n\t\t  this->value.data.logptr[elem] =\n\t\t     ( that->value.data.lngptr[elem] != 0L );\n\t    break;\n\n\t case DOUBLE:\n\t case FLTCAST:\n\t    if( that->type==LONG )\n\t       while( elem-- )\n\t\t  this->value.data.dblptr[elem] =\n\t\t     (double)that->value.data.lngptr[elem];\n\t    else if( that->type==BOOLEAN )\n\t       while( elem-- )\n\t\t  this->value.data.dblptr[elem] =\n\t\t     ( that->value.data.logptr[elem] ? 1.0 : 0.0 );\n\t    break;\n\n\t case LONG:\n\t case INTCAST:\n\t    if( that->type==DOUBLE )\n\t       while( elem-- )\n\t\t  this->value.data.lngptr[elem] =\n\t\t     (long)that->value.data.dblptr[elem];\n\t    else if( that->type==BOOLEAN )\n\t       while( elem-- )\n\t\t  this->value.data.lngptr[elem] =\n\t\t     ( that->value.data.logptr[elem] ? 1L : 0L );\n\t    break;\n\n\t case UMINUS:\n\t    if( that->type==DOUBLE ) {\n\t       while( elem-- )\n\t\t  this->value.data.dblptr[elem] =\n\t\t     - that->value.data.dblptr[elem];\n\t    } else if( that->type==LONG ) {\n\t       while( elem-- )\n\t\t  this->value.data.lngptr[elem] =\n\t\t     - that->value.data.lngptr[elem];\n\t    }\n\t    break;\n\n\t case NOT:\n\t    if( that->type==BOOLEAN ) {\n\t       while( elem-- )\n\t\t  this->value.data.logptr[elem] =\n\t\t     ( ! that->value.data.logptr[elem] );\n\t    } else if( that->type==BITSTR ) {\n\t       elem = gParse.nRows;\n\t       while( elem-- )\n\t\t  bitnot( this->value.data.strptr[elem],\n\t\t\t  that->value.data.strptr[elem] );\n\t    }\n\t    break;\n\t }\n      }\n   }\n\n   if( that->operation>0 ) {\n      free( that->value.data.ptr );\n   }\n}\n\nstatic void Do_Offset( Node *this )\n{\n   Node *col;\n   long fRow, nRowOverlap, nRowReload, rowOffset;\n   long nelem, elem, offset, nRealElem;\n   int status;\n\n   col       = gParse.Nodes + this->SubNodes[0];\n   rowOffset = gParse.Nodes[  this->SubNodes[1] ].value.data.lng;\n\n   Allocate_Ptrs( this );\n\n   fRow   = gParse.firstRow + rowOffset;\n   if( this->type==STRING || this->type==BITSTR )\n      nRealElem = 1;\n   else\n      nRealElem = this->value.nelem;\n\n   nelem = nRealElem;\n\n   if( fRow < gParse.firstDataRow ) {\n\n      /* Must fill in data at start of array */\n\n      nRowReload = gParse.firstDataRow - fRow;\n      if( nRowReload > gParse.nRows ) nRowReload = gParse.nRows;\n      nRowOverlap = gParse.nRows - nRowReload;\n\n      offset = 0;\n\n      /*  NULLify any values falling out of bounds  */\n\n      while( fRow<1 && nRowReload>0 ) {\n\t if( this->type == BITSTR ) {\n\t    nelem = this->value.nelem;\n\t    this->value.data.strptr[offset][ nelem ] = '\\0';\n\t    while( nelem-- ) this->value.data.strptr[offset][nelem] = '0';\n\t    offset++;\n\t } else {\n\t    while( nelem-- )\n\t       this->value.undef[offset++] = 1;\n\t }\n\t nelem = nRealElem;\n\t fRow++;\n\t nRowReload--;\n      }\n\n   } else if( fRow + gParse.nRows > gParse.firstDataRow + gParse.nDataRows ) {\n\n      /* Must fill in data at end of array */\n\n      nRowReload = (fRow+gParse.nRows) - (gParse.firstDataRow+gParse.nDataRows);\n      if( nRowReload>gParse.nRows ) {\n\t nRowReload = gParse.nRows;\n      } else {\n\t fRow = gParse.firstDataRow + gParse.nDataRows;\n      }\n      nRowOverlap = gParse.nRows - nRowReload;\n\n      offset = nRowOverlap * nelem;\n\n      /*  NULLify any values falling out of bounds  */\n\n      elem = gParse.nRows * nelem;\n      while( fRow+nRowReload>gParse.totalRows && nRowReload>0 ) {\n\t if( this->type == BITSTR ) {\n\t    nelem = this->value.nelem;\n\t    elem--;\n\t    this->value.data.strptr[elem][ nelem ] = '\\0';\n\t    while( nelem-- ) this->value.data.strptr[elem][nelem] = '0';\n\t } else {\n\t    while( nelem-- )\n\t       this->value.undef[--elem] = 1;\n\t }\n\t nelem = nRealElem;\n\t nRowReload--;\n      }\n\n   } else {\n\n      nRowReload  = 0;\n      nRowOverlap = gParse.nRows;\n      offset      = 0;\n\n   }\n\n   if( nRowReload>0 ) {\n      switch( this->type ) {\n      case BITSTR:\n      case STRING:\n\t status = (*gParse.loadData)( -col->operation, fRow, nRowReload,\n\t\t\t\t      this->value.data.strptr+offset,\n\t\t\t\t      this->value.undef+offset );\n\t break;\n      case BOOLEAN:\n\t status = (*gParse.loadData)( -col->operation, fRow, nRowReload,\n\t\t\t\t      this->value.data.logptr+offset,\n\t\t\t\t      this->value.undef+offset );\n\t break;\n      case LONG:\n\t status = (*gParse.loadData)( -col->operation, fRow, nRowReload,\n\t\t\t\t      this->value.data.lngptr+offset,\n\t\t\t\t      this->value.undef+offset );\n\t break;\n      case DOUBLE:\n\t status = (*gParse.loadData)( -col->operation, fRow, nRowReload,\n\t\t\t\t      this->value.data.dblptr+offset,\n\t\t\t\t      this->value.undef+offset );\n\t break;\n      }\n   }\n\n   /*  Now copy over the overlapping region, if any  */\n\n   if( nRowOverlap <= 0 ) return;\n\n   if( rowOffset>0 )\n      elem = nRowOverlap * nelem;\n   else\n      elem = gParse.nRows * nelem;\n\n   offset = nelem * rowOffset;\n   while( nRowOverlap-- && !gParse.status ) {\n      while( nelem-- && !gParse.status ) {\n\t elem--;\n\t if( this->type != BITSTR )\n\t    this->value.undef[elem] = col->value.undef[elem+offset];\n\t switch( this->type ) {\n\t case BITSTR:\n\t    strcpy( this->value.data.strptr[elem       ],\n                     col->value.data.strptr[elem+offset] );\n\t    break;\n\t case STRING:\n\t    strcpy( this->value.data.strptr[elem       ],\n                     col->value.data.strptr[elem+offset] );\n\t    break;\n\t case BOOLEAN:\n\t    this->value.data.logptr[elem] = col->value.data.logptr[elem+offset];\n\t    break;\n\t case LONG:\n\t    this->value.data.lngptr[elem] = col->value.data.lngptr[elem+offset];\n\t    break;\n\t case DOUBLE:\n\t    this->value.data.dblptr[elem] = col->value.data.dblptr[elem+offset];\n\t    break;\n\t }\n      }\n      nelem = nRealElem;\n   }\n}\n\nstatic void Do_BinOp_bit( Node *this )\n{\n   Node *that1, *that2;\n   char *sptr1=NULL, *sptr2=NULL;\n   int  const1, const2;\n   long rows;\n\n   that1 = gParse.Nodes + this->SubNodes[0];\n   that2 = gParse.Nodes + this->SubNodes[1];\n\n   const1 = ( that1->operation==CONST_OP );\n   const2 = ( that2->operation==CONST_OP );\n   sptr1  = ( const1 ? that1->value.data.str : NULL );\n   sptr2  = ( const2 ? that2->value.data.str : NULL );\n\n   if( const1 && const2 ) {\n      switch( this->operation ) {\n      case NE:\n\t this->value.data.log = !bitcmp( sptr1, sptr2 );\n\t break;\n      case EQ:\n\t this->value.data.log =  bitcmp( sptr1, sptr2 );\n\t break;\n      case GT:\n      case LT:\n      case LTE:\n      case GTE:\n\t this->value.data.log = bitlgte( sptr1, this->operation, sptr2 );\n\t break;\n      case '|': \n\t bitor( this->value.data.str, sptr1, sptr2 );\n\t break;\n      case '&': \n\t bitand( this->value.data.str, sptr1, sptr2 );\n\t break;\n      case '+':\n\t strcpy( this->value.data.str, sptr1 );\n\t strcat( this->value.data.str, sptr2 );\n\t break;\n      case ACCUM:\n\tthis->value.data.lng = 0;\n\twhile( *sptr1 ) {\n\t  if ( *sptr1 == '1' ) this->value.data.lng ++;\n\t  sptr1 ++;\n\t}\n\tbreak;\n\t\n      }\n      this->operation = CONST_OP;\n\n   } else {\n\n      Allocate_Ptrs( this );\n\n      if( !gParse.status ) {\n\t rows  = gParse.nRows;\n\t switch( this->operation ) {\n\n\t    /*  BITSTR comparisons  */\n\n\t case NE:\n\t case EQ:\n\t case GT:\n\t case LT:\n\t case LTE:\n\t case GTE:\n\t    while( rows-- ) {\n\t       if( !const1 )\n\t\t  sptr1 = that1->value.data.strptr[rows];\n\t       if( !const2 )\n\t\t  sptr2 = that2->value.data.strptr[rows];\n\t       switch( this->operation ) {\n\t       case NE:  this->value.data.logptr[rows] = \n                                                      !bitcmp( sptr1, sptr2 );\n                         break;\n\t       case EQ:  this->value.data.logptr[rows] = \n                                                       bitcmp( sptr1, sptr2 );\n                         break;\n\t       case GT:\n\t       case LT:\n\t       case LTE:\n\t       case GTE: this->value.data.logptr[rows] = \n                                     bitlgte( sptr1, this->operation, sptr2 );\n\t                 break;\n\t       }\n\t       this->value.undef[rows] = 0;\n\t    }\n\t    break;\n\t \n\t    /*  BITSTR AND/ORs ...  no UNDEFS in or out */\n      \n\t case '|': \n\t case '&': \n\t case '+':\n\t    while( rows-- ) {\n\t       if( !const1 )\n\t\t  sptr1 = that1->value.data.strptr[rows];\n\t       if( !const2 )\n\t\t  sptr2 = that2->value.data.strptr[rows];\n\t       if( this->operation=='|' )\n\t\t  bitor(  this->value.data.strptr[rows], sptr1, sptr2 );\n\t       else if( this->operation=='&' )\n\t\t  bitand( this->value.data.strptr[rows], sptr1, sptr2 );\n\t       else {\n\t\t  strcpy( this->value.data.strptr[rows], sptr1 );\n\t\t  strcat( this->value.data.strptr[rows], sptr2 );\n\t       }\n\t    }\n\t    break;\n\n\t    /* Accumulate 1 bits */\n\t case ACCUM:\n\t   { \n\t     long i, previous, curr;\n\n\t     previous = that2->value.data.lng;\n\t     \n\t      /* Cumulative sum of this chunk */\n\t     for (i=0; i<rows; i++) {\n\t       sptr1 = that1->value.data.strptr[i];\n\t       for (curr = 0; *sptr1; sptr1 ++) {\n\t\t if ( *sptr1 == '1' ) curr ++;\n\t       }\n\t       previous += curr;\n\t       this->value.data.lngptr[i] = previous;\n\t       this->value.undef[i] = 0;\n\t     }\n\t     \n\t      /* Store final cumulant for next pass */\n\t     that2->value.data.lng = previous;\n\t   }\n\t }\n      }\n   }\n\n   if( that1->operation>0 ) {\n      free( that1->value.data.strptr[0] );\n      free( that1->value.data.strptr    );\n   }\n   if( that2->operation>0 ) {\n      free( that2->value.data.strptr[0] );\n      free( that2->value.data.strptr    );\n   }\n}\n\nstatic void Do_BinOp_str( Node *this )\n{\n   Node *that1, *that2;\n   char *sptr1, *sptr2, null1=0, null2=0;\n   int const1, const2, val;\n   long rows;\n\n   that1 = gParse.Nodes + this->SubNodes[0];\n   that2 = gParse.Nodes + this->SubNodes[1];\n\n   const1 = ( that1->operation==CONST_OP );\n   const2 = ( that2->operation==CONST_OP );\n   sptr1  = ( const1 ? that1->value.data.str : NULL );\n   sptr2  = ( const2 ? that2->value.data.str : NULL );\n\n   if( const1 && const2 ) {  /*  Result is a constant  */\n      switch( this->operation ) {\n\n\t /*  Compare Strings  */\n\n      case NE:\n      case EQ:\n\t val = ( FSTRCMP( sptr1, sptr2 ) == 0 );\n\t this->value.data.log = ( this->operation==EQ ? val : !val );\n\t break;\n      case GT:\n\t this->value.data.log = ( FSTRCMP( sptr1, sptr2 ) > 0 );\n\t break;\n      case LT:\n\t this->value.data.log = ( FSTRCMP( sptr1, sptr2 ) < 0 );\n\t break;\n      case GTE:\n\t this->value.data.log = ( FSTRCMP( sptr1, sptr2 ) >= 0 );\n\t break;\n      case LTE:\n\t this->value.data.log = ( FSTRCMP( sptr1, sptr2 ) <= 0 );\n\t break;\n\n\t /*  Concat Strings  */\n\n      case '+':\n\t strcpy( this->value.data.str, sptr1 );\n\t strcat( this->value.data.str, sptr2 );\n\t break;\n      }\n      this->operation = CONST_OP;\n\n   } else {  /*  Not a constant  */\n\n      Allocate_Ptrs( this );\n\n      if( !gParse.status ) {\n\n\t rows = gParse.nRows;\n\t switch( this->operation ) {\n\n\t    /*  Compare Strings  */\n\n\t case NE:\n\t case EQ:\n\t    while( rows-- ) {\n\t       if( !const1 ) null1 = that1->value.undef[rows];\n\t       if( !const2 ) null2 = that2->value.undef[rows];\n\t       this->value.undef[rows] = (null1 || null2);\n\t       if( ! this->value.undef[rows] ) {\n\t\t  if( !const1 ) sptr1  = that1->value.data.strptr[rows];\n\t\t  if( !const2 ) sptr2  = that2->value.data.strptr[rows];\n\t\t  val = ( FSTRCMP( sptr1, sptr2 ) == 0 );\n\t\t  this->value.data.logptr[rows] =\n\t\t     ( this->operation==EQ ? val : !val );\n\t       }\n\t    }\n\t    break;\n\t    \n\t case GT:\n\t case LT:\n\t    while( rows-- ) {\n\t       if( !const1 ) null1 = that1->value.undef[rows];\n\t       if( !const2 ) null2 = that2->value.undef[rows];\n\t       this->value.undef[rows] = (null1 || null2);\n\t       if( ! this->value.undef[rows] ) {\n\t\t  if( !const1 ) sptr1  = that1->value.data.strptr[rows];\n\t\t  if( !const2 ) sptr2  = that2->value.data.strptr[rows];\n\t\t  val = ( FSTRCMP( sptr1, sptr2 ) );\n\t\t  this->value.data.logptr[rows] =\n\t\t     ( this->operation==GT ? val>0 : val<0 );\n\t       }\n\t    }\n\t    break;\n\n\t case GTE:\n\t case LTE:\n\t    while( rows-- ) {\n\t       if( !const1 ) null1 = that1->value.undef[rows];\n\t       if( !const2 ) null2 = that2->value.undef[rows];\n\t       this->value.undef[rows] = (null1 || null2);\n\t       if( ! this->value.undef[rows] ) {\n\t\t  if( !const1 ) sptr1  = that1->value.data.strptr[rows];\n\t\t  if( !const2 ) sptr2  = that2->value.data.strptr[rows];\n\t\t  val = ( FSTRCMP( sptr1, sptr2 ) );\n\t\t  this->value.data.logptr[rows] =\n\t\t     ( this->operation==GTE ? val>=0 : val<=0 );\n\t       }\n\t    }\n\t    break;\n\n\t    /*  Concat Strings  */\n\t    \n\t case '+':\n\t    while( rows-- ) {\n\t       if( !const1 ) null1 = that1->value.undef[rows];\n\t       if( !const2 ) null2 = that2->value.undef[rows];\n\t       this->value.undef[rows] = (null1 || null2);\n\t       if( ! this->value.undef[rows] ) {\n\t\t  if( !const1 ) sptr1  = that1->value.data.strptr[rows];\n\t\t  if( !const2 ) sptr2  = that2->value.data.strptr[rows];\n\t\t  strcpy( this->value.data.strptr[rows], sptr1 );\n\t\t  strcat( this->value.data.strptr[rows], sptr2 );\n\t       }\n\t    }\n\t    break;\n\t }\n      }\n   }\n\n   if( that1->operation>0 ) {\n      free( that1->value.data.strptr[0] );\n      free( that1->value.data.strptr );\n   }\n   if( that2->operation>0 ) {\n      free( that2->value.data.strptr[0] );\n      free( that2->value.data.strptr );\n   }\n}\n\nstatic void Do_BinOp_log( Node *this )\n{\n   Node *that1, *that2;\n   int vector1, vector2;\n   char val1=0, val2=0, null1=0, null2=0;\n   long rows, nelem, elem;\n\n   that1 = gParse.Nodes + this->SubNodes[0];\n   that2 = gParse.Nodes + this->SubNodes[1];\n\n   vector1 = ( that1->operation!=CONST_OP );\n   if( vector1 )\n      vector1 = that1->value.nelem;\n   else {\n      val1  = that1->value.data.log;\n   }\n\n   vector2 = ( that2->operation!=CONST_OP );\n   if( vector2 )\n      vector2 = that2->value.nelem;\n   else {\n      val2  = that2->value.data.log;\n   }\n\n   if( !vector1 && !vector2 ) {  /*  Result is a constant  */\n      switch( this->operation ) {\n      case OR:\n\t this->value.data.log = (val1 || val2);\n\t break;\n      case AND:\n\t this->value.data.log = (val1 && val2);\n\t break;\n      case EQ:\n\t this->value.data.log = ( (val1 && val2) || (!val1 && !val2) );\n\t break;\n      case NE:\n\t this->value.data.log = ( (val1 && !val2) || (!val1 && val2) );\n\t break;\n      case ACCUM:\n\t this->value.data.lng = val1;\n\t break;\n      }\n      this->operation=CONST_OP;\n   } else if (this->operation == ACCUM) {\n      long i, previous, curr;\n      rows  = gParse.nRows;\n      nelem = this->value.nelem;\n      elem  = this->value.nelem * rows;\n      \n      Allocate_Ptrs( this );\n      \n      if( !gParse.status ) {\n\tprevious = that2->value.data.lng;\n\t\n\t/* Cumulative sum of this chunk */\n\tfor (i=0; i<elem; i++) {\n\t  if (!that1->value.undef[i]) {\n\t    curr = that1->value.data.logptr[i];\n\t    previous += curr;\n\t  }\n\t  this->value.data.lngptr[i] = previous;\n\t  this->value.undef[i] = 0;\n\t}\n\t\n\t/* Store final cumulant for next pass */\n\tthat2->value.data.lng = previous;\n      }\n      \n   } else {\n      rows  = gParse.nRows;\n      nelem = this->value.nelem;\n      elem  = this->value.nelem * rows;\n\n      Allocate_Ptrs( this );\n\n      if( !gParse.status ) {\n\t\n\t if (this->operation == ACCUM) {\n\t   long i, previous, curr;\n\t   \n\t   previous = that2->value.data.lng;\n\t   \n\t   /* Cumulative sum of this chunk */\n\t   for (i=0; i<elem; i++) {\n\t     if (!that1->value.undef[i]) {\n\t       curr = that1->value.data.logptr[i];\n\t       previous += curr;\n\t     }\n\t     this->value.data.lngptr[i] = previous;\n\t     this->value.undef[i] = 0;\n\t   }\n\t   \n\t   /* Store final cumulant for next pass */\n\t   that2->value.data.lng = previous;\n\t }\n\t\n\t while( rows-- ) {\n\t    while( nelem-- ) {\n\t       elem--;\n\n\t       if( vector1>1 ) {\n\t\t  val1  = that1->value.data.logptr[elem];\n\t\t  null1 = that1->value.undef[elem];\n\t       } else if( vector1 ) {\n\t\t  val1  = that1->value.data.logptr[rows];\n\t\t  null1 = that1->value.undef[rows];\n\t       }\n\n\t       if( vector2>1 ) {\n\t\t  val2  = that2->value.data.logptr[elem];\n\t\t  null2 = that2->value.undef[elem];\n\t       } else if( vector2 ) {\n\t\t  val2  = that2->value.data.logptr[rows];\n\t\t  null2 = that2->value.undef[rows];\n\t       }\n\n\t       this->value.undef[elem] = (null1 || null2);\n\t       switch( this->operation ) {\n\n\t       case OR:\n\t\t  /*  This is more complicated than others to suppress UNDEFs */\n\t\t  /*  in those cases where the other argument is DEF && TRUE  */\n\n\t\t  if( !null1 && !null2 ) {\n\t\t     this->value.data.logptr[elem] = (val1 || val2);\n\t\t  } else if( (null1 && !null2 && val2)\n\t\t\t     || ( !null1 && null2 && val1 ) ) {\n\t\t     this->value.data.logptr[elem] = 1;\n\t\t     this->value.undef[elem] = 0;\n\t\t  }\n\t\t  break;\n\n\t       case AND:\n\t\t  /*  This is more complicated than others to suppress UNDEFs */\n\t\t  /*  in those cases where the other argument is DEF && FALSE */\n\n\t\t  if( !null1 && !null2 ) {\n\t\t     this->value.data.logptr[elem] = (val1 && val2);\n\t\t  } else if( (null1 && !null2 && !val2)\n\t\t\t     || ( !null1 && null2 && !val1 ) ) {\n\t\t     this->value.data.logptr[elem] = 0;\n\t\t     this->value.undef[elem] = 0;\n\t\t  }\n\t\t  break;\n\n\t       case EQ:\n\t\t  this->value.data.logptr[elem] = \n\t\t     ( (val1 && val2) || (!val1 && !val2) );\n\t\t  break;\n\n\t       case NE:\n\t\t  this->value.data.logptr[elem] =\n\t\t     ( (val1 && !val2) || (!val1 && val2) );\n\t\t  break;\n\t       }\n\t    }\n\t    nelem = this->value.nelem;\n\t }\n      }\n   }\n\n   if( that1->operation>0 ) {\n      free( that1->value.data.ptr );\n   }\n   if( that2->operation>0 ) {\n      free( that2->value.data.ptr );\n   }\n}\n\nstatic void Do_BinOp_lng( Node *this )\n{\n   Node *that1, *that2;\n   int  vector1, vector2;\n   long val1=0, val2=0;\n   char null1=0, null2=0;\n   long rows, nelem, elem;\n\n   that1 = gParse.Nodes + this->SubNodes[0];\n   that2 = gParse.Nodes + this->SubNodes[1];\n\n   vector1 = ( that1->operation!=CONST_OP );\n   if( vector1 )\n      vector1 = that1->value.nelem;\n   else {\n      val1  = that1->value.data.lng;\n   }\n\n   vector2 = ( that2->operation!=CONST_OP );\n   if( vector2 )\n      vector2 = that2->value.nelem;\n   else {\n      val2  = that2->value.data.lng;\n   }\n\n   if( !vector1 && !vector2 ) {  /*  Result is a constant  */\n\n      switch( this->operation ) {\n      case '~':   /* Treat as == for LONGS */\n      case EQ:    this->value.data.log = (val1 == val2);   break;\n      case NE:    this->value.data.log = (val1 != val2);   break;\n      case GT:    this->value.data.log = (val1 >  val2);   break;\n      case LT:    this->value.data.log = (val1 <  val2);   break;\n      case LTE:   this->value.data.log = (val1 <= val2);   break;\n      case GTE:   this->value.data.log = (val1 >= val2);   break;\n\n      case '+':   this->value.data.lng = (val1  + val2);   break;\n      case '-':   this->value.data.lng = (val1  - val2);   break;\n      case '*':   this->value.data.lng = (val1  * val2);   break;\n\n      case '&':   this->value.data.lng = (val1  & val2);   break;\n      case '|':   this->value.data.lng = (val1  | val2);   break;\n      case '^':   this->value.data.lng = (val1  ^ val2);   break;\n\n      case '%':\n\t if( val2 ) this->value.data.lng = (val1 % val2);\n\t else       fferror(\"Divide by Zero\");\n\t break;\n      case '/': \n\t if( val2 ) this->value.data.lng = (val1 / val2); \n\t else       fferror(\"Divide by Zero\");\n\t break;\n      case POWER:\n\t this->value.data.lng = (long)pow((double)val1,(double)val2);\n\t break;\n      case ACCUM:\n\t this->value.data.lng = val1;\n\t break;\n      case DIFF:\n\t this->value.data.lng = 0;\n\t break;\n      }\n      this->operation=CONST_OP;\n\n   } else if ((this->operation == ACCUM) || (this->operation == DIFF)) {\n      long i, previous, curr;\n      long undef;\n      rows  = gParse.nRows;\n      nelem = this->value.nelem;\n      elem  = this->value.nelem * rows;\n      \n      Allocate_Ptrs( this );\n      \n      if( !gParse.status ) {\n\tprevious = that2->value.data.lng;\n\tundef    = (long) that2->value.undef;\n\t\n\tif (this->operation == ACCUM) {\n\t  /* Cumulative sum of this chunk */\n\t  for (i=0; i<elem; i++) {\n\t    if (!that1->value.undef[i]) {\n\t      curr = that1->value.data.lngptr[i];\n\t      previous += curr;\n\t    }\n\t    this->value.data.lngptr[i] = previous;\n\t    this->value.undef[i] = 0;\n\t  }\n\t} else {\n\t  /* Sequential difference for this chunk */\n\t  for (i=0; i<elem; i++) {\n\t    curr = that1->value.data.lngptr[i];\n\t    if (that1->value.undef[i] || undef) {\n\t      /* Either this, or previous, value was undefined */\n\t      this->value.data.lngptr[i] = 0;\n\t      this->value.undef[i] = 1;\n\t    } else {\n\t      /* Both defined, we are okay! */\n\t      this->value.data.lngptr[i] = curr - previous;\n\t      this->value.undef[i] = 0;\n\t    }\n\n\t    previous = curr;\n\t    undef = that1->value.undef[i];\n\t  }\n\t}\t  \n\t\n\t/* Store final cumulant for next pass */\n\tthat2->value.data.lng = previous;\n\tthat2->value.undef    = (char *) undef; /* XXX evil, but no harm here */\n      }\n      \n   } else {\n\n      rows  = gParse.nRows;\n      nelem = this->value.nelem;\n      elem  = this->value.nelem * rows;\n\n      Allocate_Ptrs( this );\n\n      while( rows-- && !gParse.status ) {\n\t while( nelem-- && !gParse.status ) {\n\t    elem--;\n\n\t    if( vector1>1 ) {\n\t       val1  = that1->value.data.lngptr[elem];\n\t       null1 = that1->value.undef[elem];\n\t    } else if( vector1 ) {\n\t       val1  = that1->value.data.lngptr[rows];\n\t       null1 = that1->value.undef[rows];\n\t    }\n\n\t    if( vector2>1 ) {\n\t       val2  = that2->value.data.lngptr[elem];\n\t       null2 = that2->value.undef[elem];\n\t    } else if( vector2 ) {\n\t       val2  = that2->value.data.lngptr[rows];\n\t       null2 = that2->value.undef[rows];\n\t    }\n\n\t    this->value.undef[elem] = (null1 || null2);\n\t    switch( this->operation ) {\n\t    case '~':   /* Treat as == for LONGS */\n\t    case EQ:   this->value.data.logptr[elem] = (val1 == val2);   break;\n\t    case NE:   this->value.data.logptr[elem] = (val1 != val2);   break;\n\t    case GT:   this->value.data.logptr[elem] = (val1 >  val2);   break;\n\t    case LT:   this->value.data.logptr[elem] = (val1 <  val2);   break;\n\t    case LTE:  this->value.data.logptr[elem] = (val1 <= val2);   break;\n\t    case GTE:  this->value.data.logptr[elem] = (val1 >= val2);   break;\n\t       \n\t    case '+':  this->value.data.lngptr[elem] = (val1  + val2);   break;\n\t    case '-':  this->value.data.lngptr[elem] = (val1  - val2);   break;\n\t    case '*':  this->value.data.lngptr[elem] = (val1  * val2);   break;\n\n\t    case '&':  this->value.data.lngptr[elem] = (val1  & val2);   break;\n\t    case '|':  this->value.data.lngptr[elem] = (val1  | val2);   break;\n\t    case '^':  this->value.data.lngptr[elem] = (val1  ^ val2);   break;\n\n\t    case '%':   \n\t       if( val2 ) this->value.data.lngptr[elem] = (val1 % val2);\n\t       else {\n\t\t this->value.data.lngptr[elem] = 0;\n\t\t this->value.undef[elem] = 1;\n\t       }\n\t       break;\n\t    case '/': \n\t       if( val2 ) this->value.data.lngptr[elem] = (val1 / val2); \n\t       else {\n\t\t this->value.data.lngptr[elem] = 0;\n\t\t this->value.undef[elem] = 1;\n\t       }\n\t       break;\n\t    case POWER:\n\t       this->value.data.lngptr[elem] = (long)pow((double)val1,(double)val2);\n\t       break;\n\t    }\n\t }\n\t nelem = this->value.nelem;\n      }\n   }\n\n   if( that1->operation>0 ) {\n      free( that1->value.data.ptr );\n   }\n   if( that2->operation>0 ) {\n      free( that2->value.data.ptr );\n   }\n}\n\nstatic void Do_BinOp_dbl( Node *this )\n{\n   Node   *that1, *that2;\n   int    vector1, vector2;\n   double val1=0.0, val2=0.0;\n   char   null1=0, null2=0;\n   long   rows, nelem, elem;\n\n   that1 = gParse.Nodes + this->SubNodes[0];\n   that2 = gParse.Nodes + this->SubNodes[1];\n\n   vector1 = ( that1->operation!=CONST_OP );\n   if( vector1 )\n      vector1 = that1->value.nelem;\n   else {\n      val1  = that1->value.data.dbl;\n   }\n\n   vector2 = ( that2->operation!=CONST_OP );\n   if( vector2 )\n      vector2 = that2->value.nelem;\n   else {\n      val2  = that2->value.data.dbl;\n   } \n\n   if( !vector1 && !vector2 ) {  /*  Result is a constant  */\n\n      switch( this->operation ) {\n      case '~':   this->value.data.log = ( fabs(val1-val2) < APPROX );   break;\n      case EQ:    this->value.data.log = (val1 == val2);   break;\n      case NE:    this->value.data.log = (val1 != val2);   break;\n      case GT:    this->value.data.log = (val1 >  val2);   break;\n      case LT:    this->value.data.log = (val1 <  val2);   break;\n      case LTE:   this->value.data.log = (val1 <= val2);   break;\n      case GTE:   this->value.data.log = (val1 >= val2);   break;\n\n      case '+':   this->value.data.dbl = (val1  + val2);   break;\n      case '-':   this->value.data.dbl = (val1  - val2);   break;\n      case '*':   this->value.data.dbl = (val1  * val2);   break;\n\n      case '%':\n\t if( val2 ) this->value.data.dbl = val1 - val2*((int)(val1/val2));\n\t else       fferror(\"Divide by Zero\");\n\t break;\n      case '/': \n\t if( val2 ) this->value.data.dbl = (val1 / val2); \n\t else       fferror(\"Divide by Zero\");\n\t break;\n      case POWER:\n\t this->value.data.dbl = (double)pow(val1,val2);\n\t break;\n      case ACCUM:\n\t this->value.data.dbl = val1;\n\t break;\n      case DIFF:\n\tthis->value.data.dbl = 0;\n\t break;\n      }\n      this->operation=CONST_OP;\n\n   } else if ((this->operation == ACCUM) || (this->operation == DIFF)) {\n      long i;\n      long undef;\n      double previous, curr;\n      rows  = gParse.nRows;\n      nelem = this->value.nelem;\n      elem  = this->value.nelem * rows;\n      \n      Allocate_Ptrs( this );\n      \n      if( !gParse.status ) {\n\tprevious = that2->value.data.dbl;\n\tundef    = (long) that2->value.undef;\n\t\n\tif (this->operation == ACCUM) {\n\t  /* Cumulative sum of this chunk */\n\t  for (i=0; i<elem; i++) {\n\t    if (!that1->value.undef[i]) {\n\t      curr = that1->value.data.dblptr[i];\n\t      previous += curr;\n\t    }\n\t    this->value.data.dblptr[i] = previous;\n\t    this->value.undef[i] = 0;\n\t  }\n\t} else {\n\t  /* Sequential difference for this chunk */\n\t  for (i=0; i<elem; i++) {\n\t    curr = that1->value.data.dblptr[i];\n\t    if (that1->value.undef[i] || undef) {\n\t      /* Either this, or previous, value was undefined */\n\t      this->value.data.dblptr[i] = 0;\n\t      this->value.undef[i] = 1;\n\t    } else {\n\t      /* Both defined, we are okay! */\n\t      this->value.data.dblptr[i] = curr - previous;\n\t      this->value.undef[i] = 0;\n\t    }\n\n\t    previous = curr;\n\t    undef = that1->value.undef[i];\n\t  }\n\t}\t  \n\t\n\t/* Store final cumulant for next pass */\n\tthat2->value.data.dbl = previous;\n\tthat2->value.undef    = (char *) undef; /* XXX evil, but no harm here */\n      }\n      \n   } else {\n\n      rows  = gParse.nRows;\n      nelem = this->value.nelem;\n      elem  = this->value.nelem * rows;\n\n      Allocate_Ptrs( this );\n\n      while( rows-- && !gParse.status ) {\n\t while( nelem-- && !gParse.status ) {\n\t    elem--;\n\n\t    if( vector1>1 ) {\n\t       val1  = that1->value.data.dblptr[elem];\n\t       null1 = that1->value.undef[elem];\n\t    } else if( vector1 ) {\n\t       val1  = that1->value.data.dblptr[rows];\n\t       null1 = that1->value.undef[rows];\n\t    }\n\n\t    if( vector2>1 ) {\n\t       val2  = that2->value.data.dblptr[elem];\n\t       null2 = that2->value.undef[elem];\n\t    } else if( vector2 ) {\n\t       val2  = that2->value.data.dblptr[rows];\n\t       null2 = that2->value.undef[rows];\n\t    }\n\n\t    this->value.undef[elem] = (null1 || null2);\n\t    switch( this->operation ) {\n\t    case '~':   this->value.data.logptr[elem] =\n                                          ( fabs(val1-val2) < APPROX );   break;\n\t    case EQ:    this->value.data.logptr[elem] = (val1 == val2);   break;\n\t    case NE:    this->value.data.logptr[elem] = (val1 != val2);   break;\n\t    case GT:    this->value.data.logptr[elem] = (val1 >  val2);   break;\n\t    case LT:    this->value.data.logptr[elem] = (val1 <  val2);   break;\n\t    case LTE:   this->value.data.logptr[elem] = (val1 <= val2);   break;\n\t    case GTE:   this->value.data.logptr[elem] = (val1 >= val2);   break;\n\t       \n\t    case '+':   this->value.data.dblptr[elem] = (val1  + val2);   break;\n\t    case '-':   this->value.data.dblptr[elem] = (val1  - val2);   break;\n\t    case '*':   this->value.data.dblptr[elem] = (val1  * val2);   break;\n\n\t    case '%':\n\t       if( val2 ) this->value.data.dblptr[elem] =\n                                val1 - val2*((int)(val1/val2));\n\t       else {\n\t\t this->value.data.dblptr[elem] = 0.0;\n\t\t this->value.undef[elem] = 1;\n\t       }\n\t       break;\n\t    case '/': \n\t       if( val2 ) this->value.data.dblptr[elem] = (val1 / val2); \n\t       else {\n\t\t this->value.data.dblptr[elem] = 0.0;\n\t\t this->value.undef[elem] = 1;\n\t       }\n\t       break;\n\t    case POWER:\n\t       this->value.data.dblptr[elem] = (double)pow(val1,val2);\n\t       break;\n\t    }\n\t }\n\t nelem = this->value.nelem;\n      }\n   }\n\n   if( that1->operation>0 ) {\n      free( that1->value.data.ptr );\n   }\n   if( that2->operation>0 ) {\n      free( that2->value.data.ptr );\n   }\n}\n\n/*\n *  This Quickselect routine is based on the algorithm described in\n *  \"Numerical recipes in C\", Second Edition,\n *  Cambridge University Press, 1992, Section 8.5, ISBN 0-521-43108-5\n *  This code by Nicolas Devillard - 1998. Public domain.\n * http://ndevilla.free.fr/median/median/src/quickselect.c\n */\n\n#define ELEM_SWAP(a,b) { register long t=(a);(a)=(b);(b)=t; }\n\n/* \n * qselect_median_lng - select the median value of a long array\n *\n * This routine selects the median value of the long integer array\n * arr[].  If there are an even number of elements, the \"lower median\"\n * is selected.\n *\n * The array arr[] is scrambled, so users must operate on a scratch\n * array if they wish the values to be preserved.\n *\n * long arr[] - array of values\n * int n - number of elements in arr\n *\n * RETURNS: the lower median value of arr[]\n *\n */\nlong qselect_median_lng(long arr[], int n)\n{\n    int low, high ;\n    int median;\n    int middle, ll, hh;\n\n    low = 0 ; high = n-1 ; median = (low + high) / 2;\n    for (;;) {\n\n        if (high <= low) { /* One element only */\n\t  return arr[median];\t  \n\t}\n\n        if (high == low + 1) {  /* Two elements only */\n            if (arr[low] > arr[high])\n                ELEM_SWAP(arr[low], arr[high]) ;\n\t    return arr[median];\n        }\n\n    /* Find median of low, middle and high items; swap into position low */\n    middle = (low + high) / 2;\n    if (arr[middle] > arr[high])    ELEM_SWAP(arr[middle], arr[high]) ;\n    if (arr[low] > arr[high])       ELEM_SWAP(arr[low], arr[high]) ;\n    if (arr[middle] > arr[low])     ELEM_SWAP(arr[middle], arr[low]) ;\n\n    /* Swap low item (now in position middle) into position (low+1) */\n    ELEM_SWAP(arr[middle], arr[low+1]) ;\n\n    /* Nibble from each end towards middle, swapping items when stuck */\n    ll = low + 1;\n    hh = high;\n    for (;;) {\n        do ll++; while (arr[low] > arr[ll]) ;\n        do hh--; while (arr[hh]  > arr[low]) ;\n\n        if (hh < ll)\n        break;\n\n        ELEM_SWAP(arr[ll], arr[hh]) ;\n    }\n\n    /* Swap middle item (in position low) back into correct position */\n    ELEM_SWAP(arr[low], arr[hh]) ;\n\n    /* Re-set active partition */\n    if (hh <= median)\n        low = ll;\n        if (hh >= median)\n        high = hh - 1;\n    }\n}\n\n#undef ELEM_SWAP\n\n#define ELEM_SWAP(a,b) { register double t=(a);(a)=(b);(b)=t; }\n\n/* \n * qselect_median_dbl - select the median value of a double array\n *\n * This routine selects the median value of the double array\n * arr[].  If there are an even number of elements, the \"lower median\"\n * is selected.\n *\n * The array arr[] is scrambled, so users must operate on a scratch\n * array if they wish the values to be preserved.\n *\n * double arr[] - array of values\n * int n - number of elements in arr\n *\n * RETURNS: the lower median value of arr[]\n *\n */\ndouble qselect_median_dbl(double arr[], int n)\n{\n    int low, high ;\n    int median;\n    int middle, ll, hh;\n\n    low = 0 ; high = n-1 ; median = (low + high) / 2;\n    for (;;) {\n        if (high <= low) { /* One element only */\n            return arr[median] ;\n\t}\n\n        if (high == low + 1) {  /* Two elements only */\n            if (arr[low] > arr[high])\n                ELEM_SWAP(arr[low], arr[high]) ;\n            return arr[median] ;\n        }\n\n    /* Find median of low, middle and high items; swap into position low */\n    middle = (low + high) / 2;\n    if (arr[middle] > arr[high])    ELEM_SWAP(arr[middle], arr[high]) ;\n    if (arr[low] > arr[high])       ELEM_SWAP(arr[low], arr[high]) ;\n    if (arr[middle] > arr[low])     ELEM_SWAP(arr[middle], arr[low]) ;\n\n    /* Swap low item (now in position middle) into position (low+1) */\n    ELEM_SWAP(arr[middle], arr[low+1]) ;\n\n    /* Nibble from each end towards middle, swapping items when stuck */\n    ll = low + 1;\n    hh = high;\n    for (;;) {\n        do ll++; while (arr[low] > arr[ll]) ;\n        do hh--; while (arr[hh]  > arr[low]) ;\n\n        if (hh < ll)\n        break;\n\n        ELEM_SWAP(arr[ll], arr[hh]) ;\n    }\n\n    /* Swap middle item (in position low) back into correct position */\n    ELEM_SWAP(arr[low], arr[hh]) ;\n\n    /* Re-set active partition */\n    if (hh <= median)\n        low = ll;\n        if (hh >= median)\n        high = hh - 1;\n    }\n}\n\n#undef ELEM_SWAP\n\n/*\n * angsep_calc - compute angular separation between celestial coordinates\n *   \n * This routine computes the angular separation between to coordinates\n * on the celestial sphere (i.e. RA and Dec).  Note that all units are\n * in DEGREES, unlike the other trig functions in the calculator.\n *\n * double ra1, dec1 - RA and Dec of the first position in degrees\n * double ra2, dec2 - RA and Dec of the second position in degrees\n * \n * RETURNS: (double) angular separation in degrees\n *\n */\ndouble angsep_calc(double ra1, double dec1, double ra2, double dec2)\n{\n/*  double cd;  */\n  static double deg = 0;\n  double a, sdec, sra;\n  \n  if (deg == 0) deg = ((double)4)*atan((double)1)/((double)180);\n  /* deg = 1.0; **** UNCOMMENT IF YOU WANT RADIANS */\n\n  /* The algorithm is the law of Haversines.  This algorithm is\n     stable even when the points are close together.  The normal\n     Law of Cosines fails for angles around 0.1 arcsec. */\n\n  sra  = sin( (ra2 - ra1)*deg / 2 );\n  sdec = sin( (dec2 - dec1)*deg / 2);\n  a = sdec*sdec + cos(dec1*deg)*cos(dec2*deg)*sra*sra;\n\n  /* Sanity checking to avoid a range error in the sqrt()'s below */\n  if (a < 0) { a = 0; }\n  if (a > 1) { a = 1; }\n\n  return 2.0*atan2(sqrt(a), sqrt(1.0 - a)) / deg;\n}\n\nstatic void Do_Func( Node *this )\n{\n   Node *theParams[MAXSUBS];\n   int  vector[MAXSUBS], allConst;\n   lval pVals[MAXSUBS];\n   char pNull[MAXSUBS];\n   long   ival;\n   double dval;\n   int  i, valInit;\n   long row, elem, nelem;\n\n   i = this->nSubNodes;\n   allConst = 1;\n   while( i-- ) {\n      theParams[i] = gParse.Nodes + this->SubNodes[i];\n      vector[i]   = ( theParams[i]->operation!=CONST_OP );\n      if( vector[i] ) {\n\t allConst = 0;\n\t vector[i] = theParams[i]->value.nelem;\n      } else {\n\t if( theParams[i]->type==DOUBLE ) {\n\t    pVals[i].data.dbl = theParams[i]->value.data.dbl;\n\t } else if( theParams[i]->type==LONG ) {\n\t    pVals[i].data.lng = theParams[i]->value.data.lng;\n\t } else if( theParams[i]->type==BOOLEAN ) {\n\t    pVals[i].data.log = theParams[i]->value.data.log;\n\t } else\n\t    strcpy(pVals[i].data.str, theParams[i]->value.data.str);\n\t pNull[i] = 0;\n      }\n   }\n\n   if( this->nSubNodes==0 ) allConst = 0; /* These do produce scalars */\n   /* Random numbers are *never* constant !! */\n   if( this->operation == poirnd_fct ) allConst = 0;\n   if( this->operation == gasrnd_fct ) allConst = 0;\n   if( this->operation == rnd_fct ) allConst = 0;\n\n   if( allConst ) {\n\n      switch( this->operation ) {\n\n\t    /* Non-Trig single-argument functions */\n\n\t case sum_fct:\n\t    if( theParams[0]->type==BOOLEAN )\n\t       this->value.data.lng = ( pVals[0].data.log ? 1 : 0 );\n\t    else if( theParams[0]->type==LONG )\n\t       this->value.data.lng = pVals[0].data.lng;\n\t    else if( theParams[0]->type==DOUBLE )\n\t       this->value.data.dbl = pVals[0].data.dbl;\n\t    else if( theParams[0]->type==BITSTR )\n\t      strcpy(this->value.data.str, pVals[0].data.str);\n\t    break;\n         case average_fct:\n\t    if( theParams[0]->type==LONG )\n\t       this->value.data.dbl = pVals[0].data.lng;\n\t    else if( theParams[0]->type==DOUBLE )\n\t       this->value.data.dbl = pVals[0].data.dbl;\n\t    break;\n         case stddev_fct:\n\t    this->value.data.dbl = 0;  /* Standard deviation of a constant = 0 */\n\t    break;\n\t case median_fct:\n\t    if( theParams[0]->type==BOOLEAN )\n\t       this->value.data.lng = ( pVals[0].data.log ? 1 : 0 );\n\t    else if( theParams[0]->type==LONG )\n\t       this->value.data.lng = pVals[0].data.lng;\n\t    else\n\t       this->value.data.dbl = pVals[0].data.dbl;\n\t    break;\n\n\t case poirnd_fct:\n\t    if( theParams[0]->type==DOUBLE )\n\t      this->value.data.lng = simplerng_getpoisson(pVals[0].data.dbl);\n\t    else\n\t      this->value.data.lng = simplerng_getpoisson(pVals[0].data.lng);\n\t    break;\n\n\t case abs_fct:\n\t    if( theParams[0]->type==DOUBLE ) {\n\t       dval = pVals[0].data.dbl;\n\t       this->value.data.dbl = (dval>0.0 ? dval : -dval);\n\t    } else {\n\t       ival = pVals[0].data.lng;\n\t       this->value.data.lng = (ival> 0  ? ival : -ival);\n\t    }\n\t    break;\n\n            /* Special Null-Handling Functions */\n\n         case nonnull_fct:\n\t    this->value.data.lng = 1; /* Constants are always 1-element and defined */\n\t    break;\n         case isnull_fct:  /* Constants are always defined */\n\t    this->value.data.log = 0;\n\t    break;\n         case defnull_fct:\n\t    if( this->type==BOOLEAN )\n\t       this->value.data.log = pVals[0].data.log;\n            else if( this->type==LONG )\n\t       this->value.data.lng = pVals[0].data.lng;\n            else if( this->type==DOUBLE )\n\t       this->value.data.dbl = pVals[0].data.dbl;\n            else if( this->type==STRING )\n\t       strcpy(this->value.data.str,pVals[0].data.str);\n\t    break;\n        case setnull_fct: /* Only defined for numeric expressions */\n            if( this->type==LONG )\n \t      this->value.data.lng = pVals[0].data.lng;\n            else if( this->type==DOUBLE )\n\t       this->value.data.dbl = pVals[0].data.dbl;\n\t    break;\n\n\t    /* Math functions with 1 double argument */\n\n\t case sin_fct:\n\t    this->value.data.dbl = sin( pVals[0].data.dbl );\n\t    break;\n\t case cos_fct:\n\t    this->value.data.dbl = cos( pVals[0].data.dbl );\n\t    break;\n\t case tan_fct:\n\t    this->value.data.dbl = tan( pVals[0].data.dbl );\n\t    break;\n\t case asin_fct:\n\t    dval = pVals[0].data.dbl;\n\t    if( dval<-1.0 || dval>1.0 )\n\t       fferror(\"Out of range argument to arcsin\");\n\t    else\n\t       this->value.data.dbl = asin( dval );\n\t    break;\n\t case acos_fct:\n\t    dval = pVals[0].data.dbl;\n\t    if( dval<-1.0 || dval>1.0 )\n\t       fferror(\"Out of range argument to arccos\");\n\t    else\n\t       this->value.data.dbl = acos( dval );\n\t    break;\n\t case atan_fct:\n\t    this->value.data.dbl = atan( pVals[0].data.dbl );\n\t    break;\n\t case sinh_fct:\n\t    this->value.data.dbl = sinh( pVals[0].data.dbl );\n\t    break;\n\t case cosh_fct:\n\t    this->value.data.dbl = cosh( pVals[0].data.dbl );\n\t    break;\n\t case tanh_fct:\n\t    this->value.data.dbl = tanh( pVals[0].data.dbl );\n\t    break;\n\t case exp_fct:\n\t    this->value.data.dbl = exp( pVals[0].data.dbl );\n\t    break;\n\t case log_fct:\n\t    dval = pVals[0].data.dbl;\n\t    if( dval<=0.0 )\n\t       fferror(\"Out of range argument to log\");\n\t    else\n\t       this->value.data.dbl = log( dval );\n\t    break;\n\t case log10_fct:\n\t    dval = pVals[0].data.dbl;\n\t    if( dval<=0.0 )\n\t       fferror(\"Out of range argument to log10\");\n\t    else\n\t       this->value.data.dbl = log10( dval );\n\t    break;\n\t case sqrt_fct:\n\t    dval = pVals[0].data.dbl;\n\t    if( dval<0.0 )\n\t       fferror(\"Out of range argument to sqrt\");\n\t    else\n\t       this->value.data.dbl = sqrt( dval );\n\t    break;\n\t case ceil_fct:\n\t    this->value.data.dbl = ceil( pVals[0].data.dbl );\n\t    break;\n\t case floor_fct:\n\t    this->value.data.dbl = floor( pVals[0].data.dbl );\n\t    break;\n\t case round_fct:\n\t    this->value.data.dbl = floor( pVals[0].data.dbl + 0.5 );\n\t    break;\n\n\t    /* Two-argument Trig Functions */\n\n\t case atan2_fct:\n\t    this->value.data.dbl =\n\t       atan2( pVals[0].data.dbl, pVals[1].data.dbl );\n\t    break;\n\n\t    /* Four-argument ANGSEP function */\n         case angsep_fct:\n\t    this->value.data.dbl = \n\t      angsep_calc(pVals[0].data.dbl, pVals[1].data.dbl,\n\t\t\t  pVals[2].data.dbl, pVals[3].data.dbl);\n\n\t    /*  Min/Max functions taking 1 or 2 arguments  */\n\n         case min1_fct:\n\t    /* No constant vectors! */\n\t    if( this->type == DOUBLE )\n\t       this->value.data.dbl = pVals[0].data.dbl;\n\t    else if( this->type == LONG )\n\t       this->value.data.lng = pVals[0].data.lng;\n\t    else if( this->type == BITSTR )\n\t      strcpy(this->value.data.str, pVals[0].data.str);\n\t    break;\n         case min2_fct:\n\t    if( this->type == DOUBLE )\n\t       this->value.data.dbl =\n\t\t  minvalue( pVals[0].data.dbl, pVals[1].data.dbl );\n\t    else if( this->type == LONG )\n\t       this->value.data.lng =\n\t\t  minvalue( pVals[0].data.lng, pVals[1].data.lng );\n\t    break;\n         case max1_fct:\n\t    /* No constant vectors! */\n\t    if( this->type == DOUBLE )\n\t       this->value.data.dbl = pVals[0].data.dbl;\n\t    else if( this->type == LONG )\n\t       this->value.data.lng = pVals[0].data.lng;\n\t    else if( this->type == BITSTR )\n\t      strcpy(this->value.data.str, pVals[0].data.str);\n\t    break;\n         case max2_fct:\n\t    if( this->type == DOUBLE )\n\t       this->value.data.dbl =\n\t\t  maxvalue( pVals[0].data.dbl, pVals[1].data.dbl );\n\t    else if( this->type == LONG )\n\t       this->value.data.lng =\n\t\t  maxvalue( pVals[0].data.lng, pVals[1].data.lng );\n\t    break;\n\n\t    /* Boolean SAO region Functions... scalar or vector dbls */\n\n\t case near_fct:\n\t    this->value.data.log = bnear( pVals[0].data.dbl, pVals[1].data.dbl,\n\t\t\t\t\t  pVals[2].data.dbl );\n\t    break;\n\t case circle_fct:\n\t    this->value.data.log = circle( pVals[0].data.dbl, pVals[1].data.dbl,\n\t\t\t\t\t   pVals[2].data.dbl, pVals[3].data.dbl,\n\t\t\t\t\t   pVals[4].data.dbl );\n\t    break;\n\t case box_fct:\n\t    this->value.data.log = saobox( pVals[0].data.dbl, pVals[1].data.dbl,\n\t\t\t\t\t   pVals[2].data.dbl, pVals[3].data.dbl,\n\t\t\t\t\t   pVals[4].data.dbl, pVals[5].data.dbl,\n\t\t\t\t\t   pVals[6].data.dbl );\n\t    break;\n\t case elps_fct:\n\t    this->value.data.log =\n                               ellipse( pVals[0].data.dbl, pVals[1].data.dbl,\n\t\t\t\t\tpVals[2].data.dbl, pVals[3].data.dbl,\n\t\t\t\t\tpVals[4].data.dbl, pVals[5].data.dbl,\n\t\t\t\t\tpVals[6].data.dbl );\n\t    break;\n\n            /* C Conditional expression:  bool ? expr : expr */\n\n         case ifthenelse_fct:\n            switch( this->type ) {\n            case BOOLEAN:\n               this->value.data.log = ( pVals[2].data.log ?\n                                        pVals[0].data.log : pVals[1].data.log );\n               break;\n            case LONG:\n               this->value.data.lng = ( pVals[2].data.log ?\n                                        pVals[0].data.lng : pVals[1].data.lng );\n               break;\n            case DOUBLE:\n               this->value.data.dbl = ( pVals[2].data.log ?\n                                        pVals[0].data.dbl : pVals[1].data.dbl );\n               break;\n            case STRING:\n\t       strcpy(this->value.data.str, ( pVals[2].data.log ?\n                                              pVals[0].data.str :\n                                              pVals[1].data.str ) );\n               break;\n            }\n            break;\n\n\t    /* String functions */\n         case strmid_fct:\n\t   cstrmid(this->value.data.str, this->value.nelem, \n\t\t   pVals[0].data.str,    pVals[0].nelem,\n\t\t   pVals[1].data.lng);\n\t   break;\n         case strpos_fct:\n\t   {\n\t     char *res = strstr(pVals[0].data.str, pVals[1].data.str);\n\t     if (res == NULL) {\n\t       this->value.data.lng = 0; \n\t     } else {\n\t       this->value.data.lng = (res - pVals[0].data.str) + 1;\n\t     }\n\t     break;\n\t   }\n\n      }\n      this->operation = CONST_OP;\n\n   } else {\n\n      Allocate_Ptrs( this );\n\n      row  = gParse.nRows;\n      elem = row * this->value.nelem;\n\n      if( !gParse.status ) {\n\t switch( this->operation ) {\n\n\t    /* Special functions with no arguments */\n\n\t case row_fct:\n\t    while( row-- ) {\n\t       this->value.data.lngptr[row] = gParse.firstRow + row;\n\t       this->value.undef[row] = 0;\n\t    }\n\t    break;\n\t case null_fct:\n            if( this->type==LONG ) {\n               while( row-- ) {\n                  this->value.data.lngptr[row] = 0;\n                  this->value.undef[row] = 1;\n               }\n            } else if( this->type==STRING ) {\n               while( row-- ) {\n                  this->value.data.strptr[row][0] = '\\0';\n                  this->value.undef[row] = 1;\n               }\n            }\n\t    break;\n\t case rnd_fct:\n\t   while( elem-- ) {\n\t     this->value.data.dblptr[elem] = simplerng_getuniform();\n\t     this->value.undef[elem] = 0;\n\t    }\n\t    break;\n\n\t case gasrnd_fct:\n\t    while( elem-- ) {\n\t       this->value.data.dblptr[elem] = simplerng_getnorm();\n\t       this->value.undef[elem] = 0;\n\t    }\n\t    break;\n\n\t case poirnd_fct:\n\t   if( theParams[0]->type==DOUBLE ) {\n\t      if (theParams[0]->operation == CONST_OP) {\n\t\twhile( elem-- ) {\n\t\t  this->value.undef[elem] = (pVals[0].data.dbl < 0);\n\t\t  if (! this->value.undef[elem]) {\n\t\t    this->value.data.lngptr[elem] = simplerng_getpoisson(pVals[0].data.dbl);\n\t\t  }\n\t\t} \n\t      } else {\n\t\twhile( elem-- ) {\n\t\t  this->value.undef[elem] = theParams[0]->value.undef[elem];\n\t\t  if (theParams[0]->value.data.dblptr[elem] < 0) \n\t\t    this->value.undef[elem] = 1;\n\t\t  if (! this->value.undef[elem]) {\n\t\t    this->value.data.lngptr[elem] = \n\t\t      simplerng_getpoisson(theParams[0]->value.data.dblptr[elem]);\n\t\t  }\n\t\t} /* while */\n\t      } /* ! CONST_OP */\n\t   } else {\n\t     /* LONG */\n\t      if (theParams[0]->operation == CONST_OP) {\n\t\twhile( elem-- ) {\n\t\t  this->value.undef[elem] = (pVals[0].data.lng < 0);\n\t\t  if (! this->value.undef[elem]) {\n\t\t    this->value.data.lngptr[elem] = simplerng_getpoisson(pVals[0].data.lng);\n\t\t  }\n\t\t} \n\t      } else {\n\t\twhile( elem-- ) {\n\t\t  this->value.undef[elem] = theParams[0]->value.undef[elem];\n\t\t  if (theParams[0]->value.data.lngptr[elem] < 0) \n\t\t    this->value.undef[elem] = 1;\n\t\t  if (! this->value.undef[elem]) {\n\t\t    this->value.data.lngptr[elem] = \n\t\t      simplerng_getpoisson(theParams[0]->value.data.lngptr[elem]);\n\t\t  }\n\t\t} /* while */\n\t      } /* ! CONST_OP */\n\t   } /* END LONG */\n\t   break;\n\n\n\t    /* Non-Trig single-argument functions */\n\t    \n\t case sum_fct:\n\t    elem = row * theParams[0]->value.nelem;\n\t    if( theParams[0]->type==BOOLEAN ) {\n\t       while( row-- ) {\n\t\t  this->value.data.lngptr[row] = 0;\n\t\t  /* Default is UNDEF until a defined value is found */\n\t\t  this->value.undef[row] = 1;\n\t\t  nelem = theParams[0]->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     if ( ! theParams[0]->value.undef[elem] ) {\n\t\t       this->value.data.lngptr[row] +=\n\t\t\t ( theParams[0]->value.data.logptr[elem] ? 1 : 0 );\n\t\t       this->value.undef[row] = 0;\n\t\t     }\n\t\t  }\n\t       }\n\t    } else if( theParams[0]->type==LONG ) {\n\t       while( row-- ) {\n\t\t  this->value.data.lngptr[row] = 0;\n\t\t  /* Default is UNDEF until a defined value is found */\n\t\t  this->value.undef[row] = 1;\n\t\t  nelem = theParams[0]->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     if ( ! theParams[0]->value.undef[elem] ) {\n\t\t       this->value.data.lngptr[row] +=\n\t\t\t theParams[0]->value.data.lngptr[elem];\n\t\t       this->value.undef[row] = 0;\n\t\t     }\n\t\t  }\n\t       }\t\t  \n\t    } else if( theParams[0]->type==DOUBLE ){\n\t       while( row-- ) {\n\t\t  this->value.data.dblptr[row] = 0.0;\n\t\t  /* Default is UNDEF until a defined value is found */\n\t\t  this->value.undef[row] = 1;\n\t\t  nelem = theParams[0]->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     if ( ! theParams[0]->value.undef[elem] ) {\n\t\t       this->value.data.dblptr[row] +=\n\t\t\t theParams[0]->value.data.dblptr[elem];\n\t\t       this->value.undef[row] = 0;\n\t\t     }\n\t\t  }\n\t       }\t\t  \n\t    } else { /* BITSTR */\n\t       nelem = theParams[0]->value.nelem;\n\t       while( row-- ) {\n\t\t  char *sptr1 = theParams[0]->value.data.strptr[row];\n\t\t  this->value.data.lngptr[row] = 0;\n\t\t  this->value.undef[row] = 0;\n\t\t  while (*sptr1) {\n\t\t    if (*sptr1 == '1') this->value.data.lngptr[row] ++;\n\t\t    sptr1++;\n\t\t  }\n\t       }\t\t  \n\t    }\n\t    break;\n\n\t case average_fct:\n\t    elem = row * theParams[0]->value.nelem;\n\t    if( theParams[0]->type==LONG ) {\n\t       while( row-- ) {\n\t\t  int count = 0;\n\t\t  this->value.data.dblptr[row] = 0;\n\t\t  nelem = theParams[0]->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     if (theParams[0]->value.undef[elem] == 0) {\n\t\t       this->value.data.dblptr[row] +=\n\t\t\t theParams[0]->value.data.lngptr[elem];\n\t\t       count ++;\n\t\t     }\n\t\t  }\n\t\t  if (count == 0) {\n\t\t    this->value.undef[row] = 1;\n\t\t  } else {\n\t\t    this->value.undef[row] = 0;\n\t\t    this->value.data.dblptr[row] /= count;\n\t\t  }\n\t       }\t\t  \n\t    } else if( theParams[0]->type==DOUBLE ){\n\t       while( row-- ) {\n\t\t  int count = 0;\n\t\t  this->value.data.dblptr[row] = 0;\n\t\t  nelem = theParams[0]->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     if (theParams[0]->value.undef[elem] == 0) {\n\t\t       this->value.data.dblptr[row] +=\n\t\t\t theParams[0]->value.data.dblptr[elem];\n\t\t       count ++;\n\t\t     }\n\t\t  }\n\t\t  if (count == 0) {\n\t\t    this->value.undef[row] = 1;\n\t\t  } else {\n\t\t    this->value.undef[row] = 0;\n\t\t    this->value.data.dblptr[row] /= count;\n\t\t  }\n\t       }\t\t  \n\t    }\n\t    break;\n\t case stddev_fct:\n\t    elem = row * theParams[0]->value.nelem;\n\t    if( theParams[0]->type==LONG ) {\n\n\t       /* Compute the mean value */\n\t       while( row-- ) {\n\t\t  int count = 0;\n\t\t  double sum = 0, sum2 = 0;\n\n\t\t  nelem = theParams[0]->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     if (theParams[0]->value.undef[elem] == 0) {\n\t\t       sum += theParams[0]->value.data.lngptr[elem];\n\t\t       count ++;\n\t\t     }\n\t\t  }\n\t\t  if (count > 1) {\n\t\t    sum /= count;\n\n\t\t    /* Compute the sum of squared deviations */\n\t\t    nelem = theParams[0]->value.nelem;\n\t\t    elem += nelem;  /* Reset elem for second pass */\n\t\t    while( nelem-- ) {\n\t\t      elem--;\n\t\t      if (theParams[0]->value.undef[elem] == 0) {\n\t\t\tdouble dx = (theParams[0]->value.data.lngptr[elem] - sum);\n\t\t\tsum2 += (dx*dx);\n\t\t      }\n\t\t    }\n\n\t\t    sum2 /= (double)count-1;\n\n\t\t    this->value.undef[row] = 0;\n\t\t    this->value.data.dblptr[row] = sqrt(sum2);\n\t\t  } else {\n\t\t    this->value.undef[row] = 0;       /* STDDEV => 0 */\n\t\t    this->value.data.dblptr[row] = 0;\n\t\t  }\n\t       }\n\t    } else if( theParams[0]->type==DOUBLE ){\n\n\t       /* Compute the mean value */\n\t       while( row-- ) {\n\t\t  int count = 0;\n\t\t  double sum = 0, sum2 = 0;\n\n\t\t  nelem = theParams[0]->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     if (theParams[0]->value.undef[elem] == 0) {\n\t\t       sum += theParams[0]->value.data.dblptr[elem];\n\t\t       count ++;\n\t\t     }\n\t\t  }\n\t\t  if (count > 1) {\n\t\t    sum /= count;\n\n\t\t    /* Compute the sum of squared deviations */\n\t\t    nelem = theParams[0]->value.nelem;\n\t\t    elem += nelem;  /* Reset elem for second pass */\n\t\t    while( nelem-- ) {\n\t\t      elem--;\n\t\t      if (theParams[0]->value.undef[elem] == 0) {\n\t\t\tdouble dx = (theParams[0]->value.data.dblptr[elem] - sum);\n\t\t\tsum2 += (dx*dx);\n\t\t      }\n\t\t    }\n\n\t\t    sum2 /= (double)count-1;\n\n\t\t    this->value.undef[row] = 0;\n\t\t    this->value.data.dblptr[row] = sqrt(sum2);\n\t\t  } else {\n\t\t    this->value.undef[row] = 0;       /* STDDEV => 0 */\n\t\t    this->value.data.dblptr[row] = 0;\n\t\t  }\n\t       }\n\t    }\n\t    break;\n\n\t case median_fct:\n\t   elem = row * theParams[0]->value.nelem;\n\t   nelem = theParams[0]->value.nelem;\n\t   if( theParams[0]->type==LONG ) {\n\t       long *dptr = theParams[0]->value.data.lngptr;\n\t       char *uptr = theParams[0]->value.undef;\n\t       long *mptr = (long *) malloc(sizeof(long)*nelem);\n\t       int irow;\n\n\t       /* Allocate temporary storage for this row, since the\n                  quickselect function will scramble the contents */\n\t       if (mptr == 0) {\n\t\t fferror(\"Could not allocate temporary memory in median function\");\n\t\t free( this->value.data.ptr );\n\t\t break;\n\t       }\n\n\t       for (irow=0; irow<row; irow++) {\n\t\t  long *p = mptr;\n\t\t  int nelem1 = nelem;\n\n\n\t\t  while ( nelem1-- ) { \n\t\t    if (*uptr == 0) {\n\t\t      *p++ = *dptr;   /* Only advance the dest pointer if we copied */\n\t\t    }\n\t\t    dptr ++;  /* Advance the source pointer ... */\n\t\t    uptr ++;  /* ... and source \"undef\" pointer */\n\t\t  }\n\t\t  \n\t\t  nelem1 = (p - mptr);  /* Number of accepted data points */\n\t\t  if (nelem1 > 0) {\n\t\t    this->value.undef[irow] = 0;\n\t\t    this->value.data.lngptr[irow] = qselect_median_lng(mptr, nelem1);\n\t\t  } else {\n\t\t    this->value.undef[irow] = 1;\n\t\t    this->value.data.lngptr[irow] = 0;\n\t\t  }\n\t\t    \n\t       }\t\t  \n\n\t       free(mptr);\n\t    } else {\n\t       double *dptr = theParams[0]->value.data.dblptr;\n\t       char   *uptr = theParams[0]->value.undef;\n\t       double *mptr = (double *) malloc(sizeof(double)*nelem);\n\t       int irow;\n\n\t       /* Allocate temporary storage for this row, since the\n                  quickselect function will scramble the contents */\n\t       if (mptr == 0) {\n\t\t fferror(\"Could not allocate temporary memory in median function\");\n\t\t free( this->value.data.ptr );\n\t\t break;\n\t       }\n\n\t       for (irow=0; irow<row; irow++) {\n\t\t  double *p = mptr;\n\t\t  int nelem1 = nelem;\n\n\t\t  while ( nelem1-- ) { \n\t\t    if (*uptr == 0) {\n\t\t      *p++ = *dptr;   /* Only advance the dest pointer if we copied */\n\t\t    }\n\t\t    dptr ++;  /* Advance the source pointer ... */\n\t\t    uptr ++;  /* ... and source \"undef\" pointer */\n\t\t  }\n\n\t\t  nelem1 = (p - mptr);  /* Number of accepted data points */\n\t\t  if (nelem1 > 0) {\n\t\t    this->value.undef[irow] = 0;\n\t\t    this->value.data.dblptr[irow] = qselect_median_dbl(mptr, nelem1);\n\t\t  } else {\n\t\t    this->value.undef[irow] = 1;\n\t\t    this->value.data.dblptr[irow] = 0;\n\t\t  }\n\n\t       }\n\t       free(mptr);\n\t    }\n\t    break;\n\t case abs_fct:\n\t    if( theParams[0]->type==DOUBLE )\n\t       while( elem-- ) {\n\t\t  dval = theParams[0]->value.data.dblptr[elem];\n\t\t  this->value.data.dblptr[elem] = (dval>0.0 ? dval : -dval);\n\t\t  this->value.undef[elem] = theParams[0]->value.undef[elem];\n\t       }\n\t    else\n\t       while( elem-- ) {\n\t\t  ival = theParams[0]->value.data.lngptr[elem];\n\t\t  this->value.data.lngptr[elem] = (ival> 0  ? ival : -ival);\n\t\t  this->value.undef[elem] = theParams[0]->value.undef[elem];\n\t       }\n\t    break;\n\n            /* Special Null-Handling Functions */\n\n\t case nonnull_fct:\n\t   nelem = theParams[0]->value.nelem;\n\t   if ( theParams[0]->type==STRING ) nelem = 1;\n\t   elem = row * nelem;\n\t   while( row-- ) {\n\t     int nelem1 = nelem;\n\n\t     this->value.undef[row] = 0;        /* Initialize to 0 (defined) */\n\t     this->value.data.lngptr[row] = 0;\n\t     while( nelem1-- ) {\t\n\t       elem --;\n\t       if ( theParams[0]->value.undef[elem] == 0 ) this->value.data.lngptr[row] ++;\n\t     }\n\t   }\n\t   break;\n\t case isnull_fct:\n\t    if( theParams[0]->type==STRING ) elem = row;\n\t    while( elem-- ) {\n\t       this->value.data.logptr[elem] = theParams[0]->value.undef[elem];\n\t       this->value.undef[elem] = 0;\n\t    }\n\t    break;\n         case defnull_fct:\n\t    switch( this->type ) {\n\t    case BOOLEAN:\n\t       while( row-- ) {\n\t\t  nelem = this->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     i=2; while( i-- )\n\t\t\tif( vector[i]>1 ) {\n\t\t\t   pNull[i] = theParams[i]->value.undef[elem];\n\t\t\t   pVals[i].data.log =\n\t\t\t      theParams[i]->value.data.logptr[elem];\n\t\t\t} else if( vector[i] ) {\n\t\t\t   pNull[i] = theParams[i]->value.undef[row];\n\t\t\t   pVals[i].data.log =\n\t\t\t      theParams[i]->value.data.logptr[row];\n\t\t\t}\n\t\t     if( pNull[0] ) {\n\t\t\tthis->value.undef[elem] = pNull[1];\n\t\t\tthis->value.data.logptr[elem] = pVals[1].data.log;\n\t\t     } else {\n\t\t\tthis->value.undef[elem] = 0;\n\t\t\tthis->value.data.logptr[elem] = pVals[0].data.log;\n\t\t     }\n\t\t  }\n\t       }\n\t       break;\n\t    case LONG:\n\t       while( row-- ) {\n\t\t  nelem = this->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     i=2; while( i-- )\n\t\t\tif( vector[i]>1 ) {\n\t\t\t   pNull[i] = theParams[i]->value.undef[elem];\n\t\t\t   pVals[i].data.lng =\n\t\t\t      theParams[i]->value.data.lngptr[elem];\n\t\t\t} else if( vector[i] ) {\n\t\t\t   pNull[i] = theParams[i]->value.undef[row];\n\t\t\t   pVals[i].data.lng =\n\t\t\t      theParams[i]->value.data.lngptr[row];\n\t\t\t}\n\t\t     if( pNull[0] ) {\n\t\t\tthis->value.undef[elem] = pNull[1];\n\t\t\tthis->value.data.lngptr[elem] = pVals[1].data.lng;\n\t\t     } else {\n\t\t\tthis->value.undef[elem] = 0;\n\t\t\tthis->value.data.lngptr[elem] = pVals[0].data.lng;\n\t\t     }\n\t\t  }\n\t       }\n\t       break;\n\t    case DOUBLE:\n\t       while( row-- ) {\n\t\t  nelem = this->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     i=2; while( i-- )\n\t\t\tif( vector[i]>1 ) {\n\t\t\t   pNull[i] = theParams[i]->value.undef[elem];\n\t\t\t   pVals[i].data.dbl =\n\t\t\t      theParams[i]->value.data.dblptr[elem];\n\t\t\t} else if( vector[i] ) {\n\t\t\t   pNull[i] = theParams[i]->value.undef[row];\n\t\t\t   pVals[i].data.dbl =\n\t\t\t      theParams[i]->value.data.dblptr[row];\n\t\t\t}\n\t\t     if( pNull[0] ) {\n\t\t\tthis->value.undef[elem] = pNull[1];\n\t\t\tthis->value.data.dblptr[elem] = pVals[1].data.dbl;\n\t\t     } else {\n\t\t\tthis->value.undef[elem] = 0;\n\t\t\tthis->value.data.dblptr[elem] = pVals[0].data.dbl;\n\t\t     }\n\t\t  }\n\t       }\n\t       break;\n\t    case STRING:\n\t       while( row-- ) {\n\t\t  i=2; while( i-- )\n\t\t     if( vector[i] ) {\n\t\t\tpNull[i] = theParams[i]->value.undef[row];\n\t\t\tstrcpy(pVals[i].data.str,\n\t\t\t       theParams[i]->value.data.strptr[row]);\n\t\t     }\n\t\t  if( pNull[0] ) {\n\t\t     this->value.undef[row] = pNull[1];\n\t\t     strcpy(this->value.data.strptr[row],pVals[1].data.str);\n\t\t  } else {\n\t\t     this->value.undef[elem] = 0;\n\t\t     strcpy(this->value.data.strptr[row],pVals[0].data.str);\n\t\t  }\n\t       }\n\t    }\n\t    break;\n         case setnull_fct:\n\t    switch( this->type ) {\n\t    case LONG:\n\t      while( elem-- ) {\n\t\tif ( theParams[1]->value.data.lng == \n\t\t     theParams[0]->value.data.lngptr[elem] ) {\n\t\t  this->value.data.lngptr[elem] = 0;\n\t\t  this->value.undef[elem] = 1;\n\t\t} else {\n\t\t  this->value.data.lngptr[elem] = theParams[0]->value.data.lngptr[elem];\n\t\t  this->value.undef[elem] = theParams[0]->value.undef[elem];\n\t\t}\n\t      }\n\t      break;\n\t    case DOUBLE:\n\t      while( elem-- ) {\n\t\tif ( theParams[1]->value.data.dbl == \n\t\t     theParams[0]->value.data.dblptr[elem] ) {\n\t\t  this->value.data.dblptr[elem] = 0;\n\t\t  this->value.undef[elem] = 1;\n\t\t} else {\n\t\t  this->value.data.dblptr[elem] = theParams[0]->value.data.dblptr[elem];\n\t\t  this->value.undef[elem] = theParams[0]->value.undef[elem];\n\t\t}\n\t      }\n\t      break;\n\t    }\n\t    break;\n\n\t    /* Math functions with 1 double argument */\n\n\t case sin_fct:\n\t    while( elem-- )\n\t       if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) {\n\t\t  this->value.data.dblptr[elem] = \n\t\t     sin( theParams[0]->value.data.dblptr[elem] );\n\t       }\n\t    break;\n\t case cos_fct:\n\t    while( elem-- )\n\t       if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) {\n\t\t  this->value.data.dblptr[elem] = \n\t\t     cos( theParams[0]->value.data.dblptr[elem] );\n\t       }\n\t    break;\n\t case tan_fct:\n\t    while( elem-- )\n\t       if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) {\n\t\t  this->value.data.dblptr[elem] = \n\t\t     tan( theParams[0]->value.data.dblptr[elem] );\n\t       }\n\t    break;\n\t case asin_fct:\n\t    while( elem-- )\n\t       if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) {\n\t\t  dval = theParams[0]->value.data.dblptr[elem];\n\t\t  if( dval<-1.0 || dval>1.0 ) {\n\t\t     this->value.data.dblptr[elem] = 0.0;\n\t\t     this->value.undef[elem] = 1;\n\t\t  } else\n\t\t     this->value.data.dblptr[elem] = asin( dval );\n\t       }\n\t    break;\n\t case acos_fct:\n\t    while( elem-- )\n\t       if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) {\n\t\t  dval = theParams[0]->value.data.dblptr[elem];\n\t\t  if( dval<-1.0 || dval>1.0 ) {\n\t\t     this->value.data.dblptr[elem] = 0.0;\n\t\t     this->value.undef[elem] = 1;\n\t\t  } else\n\t\t     this->value.data.dblptr[elem] = acos( dval );\n\t       }\n\t    break;\n\t case atan_fct:\n\t    while( elem-- )\n\t       if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) {\n\t\t  dval = theParams[0]->value.data.dblptr[elem];\n\t\t  this->value.data.dblptr[elem] = atan( dval );\n\t       }\n\t    break;\n\t case sinh_fct:\n\t    while( elem-- )\n\t       if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) {\n\t\t  this->value.data.dblptr[elem] = \n\t\t     sinh( theParams[0]->value.data.dblptr[elem] );\n\t       }\n\t    break;\n\t case cosh_fct:\n\t    while( elem-- )\n\t       if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) {\n\t\t  this->value.data.dblptr[elem] = \n\t\t     cosh( theParams[0]->value.data.dblptr[elem] );\n\t       }\n\t    break;\n\t case tanh_fct:\n\t    while( elem-- )\n\t       if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) {\n\t\t  this->value.data.dblptr[elem] = \n\t\t     tanh( theParams[0]->value.data.dblptr[elem] );\n\t       }\n\t    break;\n\t case exp_fct:\n\t    while( elem-- )\n\t       if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) {\n\t\t  dval = theParams[0]->value.data.dblptr[elem];\n\t\t  this->value.data.dblptr[elem] = exp( dval );\n\t       }\n\t    break;\n\t case log_fct:\n\t    while( elem-- )\n\t       if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) {\n\t\t  dval = theParams[0]->value.data.dblptr[elem];\n\t\t  if( dval<=0.0 ) {\n\t\t     this->value.data.dblptr[elem] = 0.0;\n\t\t     this->value.undef[elem] = 1;\n\t\t  } else\n\t\t     this->value.data.dblptr[elem] = log( dval );\n\t       }\n\t    break;\n\t case log10_fct:\n\t    while( elem-- )\n\t       if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) {\n\t\t  dval = theParams[0]->value.data.dblptr[elem];\n\t\t  if( dval<=0.0 ) {\n\t\t     this->value.data.dblptr[elem] = 0.0;\n\t\t     this->value.undef[elem] = 1;\n\t\t  } else\n\t\t     this->value.data.dblptr[elem] = log10( dval );\n\t       }\n\t    break;\n\t case sqrt_fct:\n\t    while( elem-- )\n\t       if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) {\n\t\t  dval = theParams[0]->value.data.dblptr[elem];\n\t\t  if( dval<0.0 ) {\n\t\t     this->value.data.dblptr[elem] = 0.0;\n\t\t     this->value.undef[elem] = 1;\n\t\t  } else\n\t\t     this->value.data.dblptr[elem] = sqrt( dval );\n\t       }\n\t    break;\n\t case ceil_fct:\n\t    while( elem-- )\n\t       if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) {\n\t\t  this->value.data.dblptr[elem] = \n\t\t     ceil( theParams[0]->value.data.dblptr[elem] );\n\t       }\n\t    break;\n\t case floor_fct:\n\t    while( elem-- )\n\t       if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) {\n\t\t  this->value.data.dblptr[elem] = \n\t\t     floor( theParams[0]->value.data.dblptr[elem] );\n\t       }\n\t    break;\n\t case round_fct:\n\t    while( elem-- )\n\t       if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) {\n\t\t  this->value.data.dblptr[elem] = \n\t\t     floor( theParams[0]->value.data.dblptr[elem] + 0.5);\n\t       }\n\t    break;\n\n\t    /* Two-argument Trig Functions */\n\t    \n\t case atan2_fct:\n\t    while( row-- ) {\n\t       nelem = this->value.nelem;\n\t       while( nelem-- ) {\n\t\t  elem--;\n\t\t  i=2; while( i-- )\n\t\t     if( vector[i]>1 ) {\n\t\t\tpVals[i].data.dbl =\n\t\t\t   theParams[i]->value.data.dblptr[elem];\n\t\t\tpNull[i] = theParams[i]->value.undef[elem];\n\t\t     } else if( vector[i] ) {\n\t\t\tpVals[i].data.dbl =\n\t\t\t   theParams[i]->value.data.dblptr[row];\n\t\t\tpNull[i] = theParams[i]->value.undef[row];\n\t\t     }\n\t\t  if( !(this->value.undef[elem] = (pNull[0] || pNull[1]) ) )\n\t\t     this->value.data.dblptr[elem] =\n\t\t\tatan2( pVals[0].data.dbl, pVals[1].data.dbl );\n\t       }\n\t    }\n\t    break;\n\n\t    /* Four-argument ANGSEP Function */\n\t    \n\t case angsep_fct:\n\t    while( row-- ) {\n\t       nelem = this->value.nelem;\n\t       while( nelem-- ) {\n\t\t  elem--;\n\t\t  i=4; while( i-- )\n\t\t     if( vector[i]>1 ) {\n\t\t\tpVals[i].data.dbl =\n\t\t\t   theParams[i]->value.data.dblptr[elem];\n\t\t\tpNull[i] = theParams[i]->value.undef[elem];\n\t\t     } else if( vector[i] ) {\n\t\t\tpVals[i].data.dbl =\n\t\t\t   theParams[i]->value.data.dblptr[row];\n\t\t\tpNull[i] = theParams[i]->value.undef[row];\n\t\t     }\n\t\t  if( !(this->value.undef[elem] = (pNull[0] || pNull[1] ||\n\t\t\t\t\t\t   pNull[2] || pNull[3]) ) )\n\t\t     this->value.data.dblptr[elem] =\n\t\t       angsep_calc(pVals[0].data.dbl, pVals[1].data.dbl,\n\t\t\t\t   pVals[2].data.dbl, pVals[3].data.dbl);\n\t       }\n\t    }\n\t    break;\n\n\n\n\t    /*  Min/Max functions taking 1 or 2 arguments  */\n\n         case min1_fct:\n\t    elem = row * theParams[0]->value.nelem;\n\t    if( this->type==LONG ) {\n\t       long minVal=0;\n\t       while( row-- ) {\n\t\t  valInit = 1;\n\t\t  this->value.undef[row] = 1;\n\t\t  nelem = theParams[0]->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     if ( !theParams[0]->value.undef[elem] ) {\n\t\t       if ( valInit ) {\n\t\t\t valInit = 0;\n\t\t\t minVal  = theParams[0]->value.data.lngptr[elem];\n\t\t       } else {\n\t\t\t minVal  = minvalue( minVal,\n\t\t\t\t\t     theParams[0]->value.data.lngptr[elem] );\n\t\t       }\n\t\t       this->value.undef[row] = 0;\n\t\t     }\n\t\t  }  \n\t\t  this->value.data.lngptr[row] = minVal;\n\t       }\t\t  \n\t    } else if( this->type==DOUBLE ) {\n\t       double minVal=0.0;\n\t       while( row-- ) {\n\t\t  valInit = 1;\n\t\t  this->value.undef[row] = 1;\n\t\t  nelem = theParams[0]->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     if ( !theParams[0]->value.undef[elem] ) {\n\t\t       if ( valInit ) {\n\t\t\t valInit = 0;\n\t\t\t minVal  = theParams[0]->value.data.dblptr[elem];\n\t\t       } else {\n\t\t\t minVal  = minvalue( minVal,\n\t\t\t\t\t     theParams[0]->value.data.dblptr[elem] );\n\t\t       }\n\t\t       this->value.undef[row] = 0;\n\t\t     }\n\t\t  }  \n\t\t  this->value.data.dblptr[row] = minVal;\n\t       }\t\t  \n\t    } else if( this->type==BITSTR ) {\n\t       char minVal;\n\t       while( row-- ) {\n\t\t  char *sptr1 = theParams[0]->value.data.strptr[row];\n\t\t  minVal = '1';\n\t\t  while (*sptr1) {\n\t\t    if (*sptr1 == '0') minVal = '0';\n\t\t    sptr1++;\n\t\t  }\n\t\t  this->value.data.strptr[row][0] = minVal;\n\t\t  this->value.data.strptr[row][1] = 0;     /* Null terminate */\n\t       }\t\t  \n\t    }\n\t    break;\n         case min2_fct:\n\t    if( this->type==LONG ) {\n\t       while( row-- ) {\n\t\t  nelem = this->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     i=2; while( i-- )\n\t\t\tif( vector[i]>1 ) {\n\t\t\t   pVals[i].data.lng =\n\t\t\t      theParams[i]->value.data.lngptr[elem];\n\t\t\t   pNull[i] = theParams[i]->value.undef[elem];\n\t\t\t} else if( vector[i] ) {\n\t\t\t   pVals[i].data.lng =\n\t\t\t      theParams[i]->value.data.lngptr[row];\n\t\t\t   pNull[i] = theParams[i]->value.undef[row];\n\t\t\t}\n\t\t     if( pNull[0] && pNull[1] ) {\n\t\t       this->value.undef[elem] = 1;\n\t\t       this->value.data.lngptr[elem] = 0;\n\t\t     } else if (pNull[0]) {\n\t\t       this->value.undef[elem] = 0;\n\t\t       this->value.data.lngptr[elem] = pVals[1].data.lng;\n\t\t     } else if (pNull[1]) {\n\t\t       this->value.undef[elem] = 0;\n\t\t       this->value.data.lngptr[elem] = pVals[0].data.lng;\n\t\t     } else {\n\t\t       this->value.undef[elem] = 0;\n\t\t       this->value.data.lngptr[elem] =\n\t\t\t minvalue( pVals[0].data.lng, pVals[1].data.lng );\n\t\t     }\n\t\t  }\n\t       }\n\t    } else if( this->type==DOUBLE ) {\n\t       while( row-- ) {\n\t\t  nelem = this->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     i=2; while( i-- )\n\t\t\tif( vector[i]>1 ) {\n\t\t\t   pVals[i].data.dbl =\n\t\t\t      theParams[i]->value.data.dblptr[elem];\n\t\t\t   pNull[i] = theParams[i]->value.undef[elem];\n\t\t\t} else if( vector[i] ) {\n\t\t\t   pVals[i].data.dbl =\n\t\t\t      theParams[i]->value.data.dblptr[row];\n\t\t\t   pNull[i] = theParams[i]->value.undef[row];\n\t\t\t}\n\t\t     if( pNull[0] && pNull[1] ) {\n\t\t       this->value.undef[elem] = 1;\n\t\t       this->value.data.dblptr[elem] = 0;\n\t\t     } else if (pNull[0]) {\n\t\t       this->value.undef[elem] = 0;\n\t\t       this->value.data.dblptr[elem] = pVals[1].data.dbl;\n\t\t     } else if (pNull[1]) {\n\t\t       this->value.undef[elem] = 0;\n\t\t       this->value.data.dblptr[elem] = pVals[0].data.dbl;\n\t\t     } else {\n\t\t       this->value.undef[elem] = 0;\n\t\t       this->value.data.dblptr[elem] =\n\t\t\t minvalue( pVals[0].data.dbl, pVals[1].data.dbl );\n\t\t     }\n\t\t  }\n \t       }\n\t    }\n\t    break;\n\n         case max1_fct:\n\t    elem = row * theParams[0]->value.nelem;\n\t    if( this->type==LONG ) {\n\t       long maxVal=0;\n\t       while( row-- ) {\n\t\t  valInit = 1;\n\t\t  this->value.undef[row] = 1;\n\t\t  nelem = theParams[0]->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     if ( !theParams[0]->value.undef[elem] ) {\n\t\t       if ( valInit ) {\n\t\t\t valInit = 0;\n\t\t\t maxVal  = theParams[0]->value.data.lngptr[elem];\n\t\t       } else {\n\t\t\t maxVal  = maxvalue( maxVal,\n\t\t\t\t\t     theParams[0]->value.data.lngptr[elem] );\n\t\t       }\n\t\t       this->value.undef[row] = 0;\n\t\t     }\n\t\t  }\n\t\t  this->value.data.lngptr[row] = maxVal;\n\t       }\t\t  \n\t    } else if( this->type==DOUBLE ) {\n\t       double maxVal=0.0;\n\t       while( row-- ) {\n\t\t  valInit = 1;\n\t\t  this->value.undef[row] = 1;\n\t\t  nelem = theParams[0]->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     if ( !theParams[0]->value.undef[elem] ) {\n\t\t       if ( valInit ) {\n\t\t\t valInit = 0;\n\t\t\t maxVal  = theParams[0]->value.data.dblptr[elem];\n\t\t       } else {\n\t\t\t maxVal  = maxvalue( maxVal,\n\t\t\t\t\t     theParams[0]->value.data.dblptr[elem] );\n\t\t       }\n\t\t       this->value.undef[row] = 0;\n\t\t     }\n\t\t  }\n\t\t  this->value.data.dblptr[row] = maxVal;\n\t       }\t\t  \n\t    } else if( this->type==BITSTR ) {\n\t       char maxVal;\n\t       while( row-- ) {\n\t\t  char *sptr1 = theParams[0]->value.data.strptr[row];\n\t\t  maxVal = '0';\n\t\t  while (*sptr1) {\n\t\t    if (*sptr1 == '1') maxVal = '1';\n\t\t    sptr1++;\n\t\t  }\n\t\t  this->value.data.strptr[row][0] = maxVal;\n\t\t  this->value.data.strptr[row][1] = 0;     /* Null terminate */\n\t       }\t\t  \n\t    }\n\t    break;\n         case max2_fct:\n\t    if( this->type==LONG ) {\n\t       while( row-- ) {\n\t\t  nelem = this->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     i=2; while( i-- )\n\t\t\tif( vector[i]>1 ) {\n\t\t\t   pVals[i].data.lng =\n\t\t\t      theParams[i]->value.data.lngptr[elem];\n\t\t\t   pNull[i] = theParams[i]->value.undef[elem];\n\t\t\t} else if( vector[i] ) {\n\t\t\t   pVals[i].data.lng =\n\t\t\t      theParams[i]->value.data.lngptr[row];\n\t\t\t   pNull[i] = theParams[i]->value.undef[row];\n\t\t\t}\n\t\t     if( pNull[0] && pNull[1] ) {\n\t\t       this->value.undef[elem] = 1;\n\t\t       this->value.data.lngptr[elem] = 0;\n\t\t     } else if (pNull[0]) {\n\t\t       this->value.undef[elem] = 0;\n\t\t       this->value.data.lngptr[elem] = pVals[1].data.lng;\n\t\t     } else if (pNull[1]) {\n\t\t       this->value.undef[elem] = 0;\n\t\t       this->value.data.lngptr[elem] = pVals[0].data.lng;\n\t\t     } else {\n\t\t       this->value.undef[elem] = 0;\n\t\t       this->value.data.lngptr[elem] =\n\t\t\t maxvalue( pVals[0].data.lng, pVals[1].data.lng );\n\t\t     }\n\t\t  }\n\t       }\n\t    } else if( this->type==DOUBLE ) {\n\t       while( row-- ) {\n\t\t  nelem = this->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n\t\t     i=2; while( i-- )\n\t\t\tif( vector[i]>1 ) {\n\t\t\t   pVals[i].data.dbl =\n\t\t\t      theParams[i]->value.data.dblptr[elem];\n\t\t\t   pNull[i] = theParams[i]->value.undef[elem];\n\t\t\t} else if( vector[i] ) {\n\t\t\t   pVals[i].data.dbl =\n\t\t\t      theParams[i]->value.data.dblptr[row];\n\t\t\t   pNull[i] = theParams[i]->value.undef[row];\n\t\t\t}\n\t\t     if( pNull[0] && pNull[1] ) {\n\t\t       this->value.undef[elem] = 1;\n\t\t       this->value.data.dblptr[elem] = 0;\n\t\t     } else if (pNull[0]) {\n\t\t       this->value.undef[elem] = 0;\n\t\t       this->value.data.dblptr[elem] = pVals[1].data.dbl;\n\t\t     } else if (pNull[1]) {\n\t\t       this->value.undef[elem] = 0;\n\t\t       this->value.data.dblptr[elem] = pVals[0].data.dbl;\n\t\t     } else {\n\t\t       this->value.undef[elem] = 0;\n\t\t       this->value.data.dblptr[elem] =\n\t\t\t maxvalue( pVals[0].data.dbl, pVals[1].data.dbl );\n\t\t     }\n\t\t  }\n\t       }\n\t    }\n\t    break;\n\n\t    /* Boolean SAO region Functions... scalar or vector dbls */\n\n\t case near_fct:\n\t    while( row-- ) {\n\t       nelem = this->value.nelem;\n\t       while( nelem-- ) {\n\t\t  elem--;\n\t\t  i=3; while( i-- )\n\t\t     if( vector[i]>1 ) {\n\t\t\tpVals[i].data.dbl =\n\t\t\t   theParams[i]->value.data.dblptr[elem];\n\t\t\tpNull[i] = theParams[i]->value.undef[elem];\n\t\t     } else if( vector[i] ) {\n\t\t\tpVals[i].data.dbl =\n\t\t\t   theParams[i]->value.data.dblptr[row];\n\t\t\tpNull[i] = theParams[i]->value.undef[row];\n\t\t     }\n\t\t  if( !(this->value.undef[elem] = (pNull[0] || pNull[1] ||\n\t\t\t\t\t\t   pNull[2]) ) )\n\t\t    this->value.data.logptr[elem] =\n\t\t      bnear( pVals[0].data.dbl, pVals[1].data.dbl,\n\t\t\t     pVals[2].data.dbl );\n\t       }\n\t    }\n\t    break;\n\n\t case circle_fct:\n\t    while( row-- ) {\n\t       nelem = this->value.nelem;\n\t       while( nelem-- ) {\n\t\t  elem--;\n\t\t  i=5; while( i-- )\n\t\t     if( vector[i]>1 ) {\n\t\t\tpVals[i].data.dbl =\n\t\t\t   theParams[i]->value.data.dblptr[elem];\n\t\t\tpNull[i] = theParams[i]->value.undef[elem];\n\t\t     } else if( vector[i] ) {\n\t\t\tpVals[i].data.dbl =\n\t\t\t   theParams[i]->value.data.dblptr[row];\n\t\t\tpNull[i] = theParams[i]->value.undef[row];\n\t\t     }\n\t\t  if( !(this->value.undef[elem] = (pNull[0] || pNull[1] ||\n\t\t\t\t\t\t   pNull[2] || pNull[3] ||\n\t\t\t\t\t\t   pNull[4]) ) )\n\t\t    this->value.data.logptr[elem] =\n\t\t     circle( pVals[0].data.dbl, pVals[1].data.dbl,\n\t\t\t     pVals[2].data.dbl, pVals[3].data.dbl,\n\t\t\t     pVals[4].data.dbl );\n\t       }\n\t    }\n\t    break;\n\n\t case box_fct:\n\t    while( row-- ) {\n\t       nelem = this->value.nelem;\n\t       while( nelem-- ) {\n\t\t  elem--;\n\t\t  i=7; while( i-- )\n\t\t     if( vector[i]>1 ) {\n\t\t\tpVals[i].data.dbl =\n\t\t\t   theParams[i]->value.data.dblptr[elem];\n\t\t\tpNull[i] = theParams[i]->value.undef[elem];\n\t\t     } else if( vector[i] ) {\n\t\t\tpVals[i].data.dbl =\n\t\t\t   theParams[i]->value.data.dblptr[row];\n\t\t\tpNull[i] = theParams[i]->value.undef[row];\n\t\t     }\n\t\t  if( !(this->value.undef[elem] = (pNull[0] || pNull[1] ||\n\t\t\t\t\t\t   pNull[2] || pNull[3] ||\n\t\t\t\t\t\t   pNull[4] || pNull[5] ||\n\t\t\t\t\t\t   pNull[6] ) ) )\n\t\t    this->value.data.logptr[elem] =\n\t\t     saobox( pVals[0].data.dbl, pVals[1].data.dbl,\n\t\t\t     pVals[2].data.dbl, pVals[3].data.dbl,\n\t\t\t     pVals[4].data.dbl, pVals[5].data.dbl,\n\t\t\t     pVals[6].data.dbl );\t\n\t       }\n\t    }\n\t    break;\n\n\t case elps_fct:\n\t    while( row-- ) {\n\t       nelem = this->value.nelem;\n\t       while( nelem-- ) {\n\t\t  elem--;\n\t\t  i=7; while( i-- )\n\t\t     if( vector[i]>1 ) {\n\t\t\tpVals[i].data.dbl =\n\t\t\t   theParams[i]->value.data.dblptr[elem];\n\t\t\tpNull[i] = theParams[i]->value.undef[elem];\n\t\t     } else if( vector[i] ) {\n\t\t\tpVals[i].data.dbl =\n\t\t\t   theParams[i]->value.data.dblptr[row];\n\t\t\tpNull[i] = theParams[i]->value.undef[row];\n\t\t     }\n\t\t  if( !(this->value.undef[elem] = (pNull[0] || pNull[1] ||\n\t\t\t\t\t\t   pNull[2] || pNull[3] ||\n\t\t\t\t\t\t   pNull[4] || pNull[5] ||\n\t\t\t\t\t\t   pNull[6] ) ) )\n\t\t    this->value.data.logptr[elem] =\n\t\t     ellipse( pVals[0].data.dbl, pVals[1].data.dbl,\n\t\t\t      pVals[2].data.dbl, pVals[3].data.dbl,\n\t\t\t      pVals[4].data.dbl, pVals[5].data.dbl,\n\t\t\t      pVals[6].data.dbl );\n\t       }\n\t    }\n\t    break;\n\n            /* C Conditional expression:  bool ? expr : expr */\n\n         case ifthenelse_fct:\n            switch( this->type ) {\n            case BOOLEAN:\n\t       while( row-- ) {\n\t\t  nelem = this->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n                     if( vector[2]>1 ) {\n                        pVals[2].data.log =\n                           theParams[2]->value.data.logptr[elem];\n                        pNull[2] = theParams[2]->value.undef[elem];\n                     } else if( vector[2] ) {\n                        pVals[2].data.log =\n                           theParams[2]->value.data.logptr[row];\n                        pNull[2] = theParams[2]->value.undef[row];\n                     }\n\t\t     i=2; while( i-- )\n\t\t\tif( vector[i]>1 ) {\n\t\t\t   pVals[i].data.log =\n\t\t\t      theParams[i]->value.data.logptr[elem];\n\t\t\t   pNull[i] = theParams[i]->value.undef[elem];\n\t\t\t} else if( vector[i] ) {\n\t\t\t   pVals[i].data.log =\n\t\t\t      theParams[i]->value.data.logptr[row];\n\t\t\t   pNull[i] = theParams[i]->value.undef[row];\n\t\t\t}\n\t\t     if( !(this->value.undef[elem] = pNull[2]) ) {\n                        if( pVals[2].data.log ) {\n                           this->value.data.logptr[elem] = pVals[0].data.log;\n                           this->value.undef[elem]       = pNull[0];\n                        } else {\n                           this->value.data.logptr[elem] = pVals[1].data.log;\n                           this->value.undef[elem]       = pNull[1];\n                        }\n                     }\n\t\t  }\n\t       }\n               break;\n            case LONG:\n\t       while( row-- ) {\n\t\t  nelem = this->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n                     if( vector[2]>1 ) {\n                        pVals[2].data.log =\n                           theParams[2]->value.data.logptr[elem];\n                        pNull[2] = theParams[2]->value.undef[elem];\n                     } else if( vector[2] ) {\n                        pVals[2].data.log =\n                           theParams[2]->value.data.logptr[row];\n                        pNull[2] = theParams[2]->value.undef[row];\n                     }\n\t\t     i=2; while( i-- )\n\t\t\tif( vector[i]>1 ) {\n\t\t\t   pVals[i].data.lng =\n\t\t\t      theParams[i]->value.data.lngptr[elem];\n\t\t\t   pNull[i] = theParams[i]->value.undef[elem];\n\t\t\t} else if( vector[i] ) {\n\t\t\t   pVals[i].data.lng =\n\t\t\t      theParams[i]->value.data.lngptr[row];\n\t\t\t   pNull[i] = theParams[i]->value.undef[row];\n\t\t\t}\n\t\t     if( !(this->value.undef[elem] = pNull[2]) ) {\n                        if( pVals[2].data.log ) {\n                           this->value.data.lngptr[elem] = pVals[0].data.lng;\n                           this->value.undef[elem]       = pNull[0];\n                        } else {\n                           this->value.data.lngptr[elem] = pVals[1].data.lng;\n                           this->value.undef[elem]       = pNull[1];\n                        }\n                     }\n\t\t  }\n\t       }\n               break;\n            case DOUBLE:\n\t       while( row-- ) {\n\t\t  nelem = this->value.nelem;\n\t\t  while( nelem-- ) {\n\t\t     elem--;\n                     if( vector[2]>1 ) {\n                        pVals[2].data.log =\n                           theParams[2]->value.data.logptr[elem];\n                        pNull[2] = theParams[2]->value.undef[elem];\n                     } else if( vector[2] ) {\n                        pVals[2].data.log =\n                           theParams[2]->value.data.logptr[row];\n                        pNull[2] = theParams[2]->value.undef[row];\n                     }\n\t\t     i=2; while( i-- )\n\t\t\tif( vector[i]>1 ) {\n\t\t\t   pVals[i].data.dbl =\n\t\t\t      theParams[i]->value.data.dblptr[elem];\n\t\t\t   pNull[i] = theParams[i]->value.undef[elem];\n\t\t\t} else if( vector[i] ) {\n\t\t\t   pVals[i].data.dbl =\n\t\t\t      theParams[i]->value.data.dblptr[row];\n\t\t\t   pNull[i] = theParams[i]->value.undef[row];\n\t\t\t}\n\t\t     if( !(this->value.undef[elem] = pNull[2]) ) {\n                        if( pVals[2].data.log ) {\n                           this->value.data.dblptr[elem] = pVals[0].data.dbl;\n                           this->value.undef[elem]       = pNull[0];\n                        } else {\n                           this->value.data.dblptr[elem] = pVals[1].data.dbl;\n                           this->value.undef[elem]       = pNull[1];\n                        }\n                     }\n\t\t  }\n\t       }\n               break;\n            case STRING:\n\t       while( row-- ) {\n                  if( vector[2] ) {\n                     pVals[2].data.log = theParams[2]->value.data.logptr[row];\n                     pNull[2] = theParams[2]->value.undef[row];\n                  }\n                  i=2; while( i-- )\n                     if( vector[i] ) {\n                        strcpy( pVals[i].data.str,\n                                theParams[i]->value.data.strptr[row] );\n                        pNull[i] = theParams[i]->value.undef[row];\n                     }\n                  if( !(this->value.undef[row] = pNull[2]) ) {\n                     if( pVals[2].data.log ) {\n                        strcpy( this->value.data.strptr[row],\n                                pVals[0].data.str );\n                        this->value.undef[row]       = pNull[0];\n                     } else {\n                        strcpy( this->value.data.strptr[row],\n                                pVals[1].data.str );\n                        this->value.undef[row]       = pNull[1];\n                     }\n                  } else {\n                     this->value.data.strptr[row][0] = '\\0';\n                  }\n\t       }\n               break;\n\n            }\n            break;\n\n\t    /* String functions */\n            case strmid_fct:\n\t      {\n\t\tint strconst = theParams[0]->operation == CONST_OP;\n\t\tint posconst = theParams[1]->operation == CONST_OP;\n\t\tint lenconst = theParams[2]->operation == CONST_OP;\n\t\tint dest_len = this->value.nelem;\n\t\tint src_len  = theParams[0]->value.nelem;\n\n\t\twhile (row--) {\n\t\t  int pos;\n\t\t  int len;\n\t\t  char *str;\n\t\t  int undef = 0;\n\n\t\t  if (posconst) {\n\t\t    pos = theParams[1]->value.data.lng;\n\t\t  } else {\n\t\t    pos = theParams[1]->value.data.lngptr[row];\n\t\t    if (theParams[1]->value.undef[row]) undef = 1;\n\t\t  }\n\t\t  if (strconst) {\n\t\t    str = theParams[0]->value.data.str;\n\t\t    if (src_len == 0) src_len = strlen(str);\n\t\t  } else {\n\t\t    str = theParams[0]->value.data.strptr[row];\n\t\t    if (theParams[0]->value.undef[row]) undef = 1;\n\t\t  }\n\t\t  if (lenconst) {\n\t\t    len = dest_len;\n\t\t  } else {\n\t\t    len = theParams[2]->value.data.lngptr[row];\n\t\t    if (theParams[2]->value.undef[row]) undef = 1;\n\t\t  }\n\t\t  this->value.data.strptr[row][0] = '\\0';\n\t\t  if (pos == 0) undef = 1;\n\t\t  if (! undef ) {\n\t\t    if (cstrmid(this->value.data.strptr[row], len,\n\t\t\t\tstr, src_len, pos) < 0) break;\n\t\t  }\n\t\t  this->value.undef[row] = undef;\n\t\t}\n\t      }\t\t      \n\t      break;\n\n\t    /* String functions */\n            case strpos_fct:\n\t      {\n\t\tint const1 = theParams[0]->operation == CONST_OP;\n\t\tint const2 = theParams[1]->operation == CONST_OP;\n\n\t\twhile (row--) {\n\t\t  char *str1, *str2;\n\t\t  int undef = 0;\n\n\t\t  if (const1) {\n\t\t    str1 = theParams[0]->value.data.str;\n\t\t  } else {\n\t\t    str1 = theParams[0]->value.data.strptr[row];\n\t\t    if (theParams[0]->value.undef[row]) undef = 1;\n\t\t  }\n\t\t  if (const2) {\n\t\t    str2 = theParams[1]->value.data.str;\n\t\t  } else {\n\t\t    str2 = theParams[1]->value.data.strptr[row];\n\t\t    if (theParams[1]->value.undef[row]) undef = 1;\n\t\t  }\n\t\t  this->value.data.lngptr[row] = 0;\n\t\t  if (! undef ) {\n\t\t    char *res = strstr(str1, str2);\n\t\t    if (res == NULL) {\n\t\t      undef = 1;\n\t\t      this->value.data.lngptr[row] = 0; \n\t\t    } else {\n\t\t      this->value.data.lngptr[row] = (res - str1) + 1;\n\t\t    }\n\t\t  }\n\t\t  this->value.undef[row] = undef;\n\t\t}\n\t      }\n\t      break;\n\n\t\t    \n\t } /* End switch(this->operation) */\n      } /* End if (!gParse.status) */\n   } /* End non-constant operations */\n\n   i = this->nSubNodes;\n   while( i-- ) {\n      if( theParams[i]->operation>0 ) {\n\t /*  Currently only numeric params allowed  */\n\t free( theParams[i]->value.data.ptr );\n      }\n   }\n}\n\nstatic void Do_Deref( Node *this )\n{\n   Node *theVar, *theDims[MAXDIMS];\n   int  isConst[MAXDIMS], allConst;\n   long dimVals[MAXDIMS];\n   int  i, nDims;\n   long row, elem, dsize;\n\n   theVar = gParse.Nodes + this->SubNodes[0];\n\n   i = nDims = this->nSubNodes-1;\n   allConst = 1;\n   while( i-- ) {\n      theDims[i] = gParse.Nodes + this->SubNodes[i+1];\n      isConst[i] = ( theDims[i]->operation==CONST_OP );\n      if( isConst[i] )\n\t dimVals[i] = theDims[i]->value.data.lng;\n      else\n\t allConst = 0;\n   }\n\n   if( this->type==DOUBLE ) {\n      dsize = sizeof( double );\n   } else if( this->type==LONG ) {\n      dsize = sizeof( long );\n   } else if( this->type==BOOLEAN ) {\n      dsize = sizeof( char );\n   } else\n      dsize = 0;\n\n   Allocate_Ptrs( this );\n\n   if( !gParse.status ) {\n\n      if( allConst && theVar->value.naxis==nDims ) {\n\n\t /* Dereference completely using constant indices */\n\n\t elem = 0;\n\t i    = nDims;\n\t while( i-- ) {\n\t    if( dimVals[i]<1 || dimVals[i]>theVar->value.naxes[i] ) break;\n\t    elem = theVar->value.naxes[i]*elem + dimVals[i]-1;\n\t }\n\t if( i<0 ) {\n\t    for( row=0; row<gParse.nRows; row++ ) {\n\t       if( this->type==STRING )\n\t\t this->value.undef[row] = theVar->value.undef[row];\n\t       else if( this->type==BITSTR ) \n\t\t this->value.undef;  /* Dummy - BITSTRs do not have undefs */\n\t       else \n\t\t this->value.undef[row] = theVar->value.undef[elem];\n\n\t       if( this->type==DOUBLE )\n\t\t  this->value.data.dblptr[row] = \n\t\t     theVar->value.data.dblptr[elem];\n\t       else if( this->type==LONG )\n\t\t  this->value.data.lngptr[row] = \n\t\t     theVar->value.data.lngptr[elem];\n\t       else if( this->type==BOOLEAN )\n\t\t  this->value.data.logptr[row] = \n\t\t     theVar->value.data.logptr[elem];\n\t       else {\n\t\t /* XXX Note, the below expression uses knowledge of\n                    the layout of the string format, namely (nelem+1)\n                    characters per string, followed by (nelem+1)\n                    \"undef\" values. */\n\t\t  this->value.data.strptr[row][0] = \n\t\t     theVar->value.data.strptr[0][elem+row];\n\t\t  this->value.data.strptr[row][1] = 0;  /* Null terminate */\n\t       }\n\t       elem += theVar->value.nelem;\n\t    }\n\t } else {\n\t    fferror(\"Index out of range\");\n\t    free( this->value.data.ptr );\n\t }\n\t \n      } else if( allConst && nDims==1 ) {\n\t \n\t /* Reduce dimensions by 1, using a constant index */\n\t \n\t if( dimVals[0] < 1 ||\n\t     dimVals[0] > theVar->value.naxes[ theVar->value.naxis-1 ] ) {\n\t    fferror(\"Index out of range\");\n\t    free( this->value.data.ptr );\n\t } else if ( this->type == BITSTR || this->type == STRING ) {\n\t    elem = this->value.nelem * (dimVals[0]-1);\n\t    for( row=0; row<gParse.nRows; row++ ) {\n\t      if (this->value.undef) \n\t\tthis->value.undef[row] = theVar->value.undef[row];\n\t      memcpy( (char*)this->value.data.strptr[0]\n\t\t      + row*sizeof(char)*(this->value.nelem+1),\n\t\t      (char*)theVar->value.data.strptr[0] + elem*sizeof(char),\n\t\t      this->value.nelem * sizeof(char) );\n\t      /* Null terminate */\n\t      this->value.data.strptr[row][this->value.nelem] = 0;\n\t      elem += theVar->value.nelem+1;\n\t    }\t       \n\t } else {\n\t    elem = this->value.nelem * (dimVals[0]-1);\n\t    for( row=0; row<gParse.nRows; row++ ) {\n\t       memcpy( this->value.undef + row*this->value.nelem,\n\t\t       theVar->value.undef + elem,\n\t\t       this->value.nelem * sizeof(char) );\n\t       memcpy( (char*)this->value.data.ptr\n\t\t       + row*dsize*this->value.nelem,\n\t\t       (char*)theVar->value.data.ptr + elem*dsize,\n\t\t       this->value.nelem * dsize );\n\t       elem += theVar->value.nelem;\n\t    }\t       \n\t }\n      \n      } else if( theVar->value.naxis==nDims ) {\n\n\t /* Dereference completely using an expression for the indices */\n\n\t for( row=0; row<gParse.nRows; row++ ) {\n\n\t    for( i=0; i<nDims; i++ ) {\n\t       if( !isConst[i] ) {\n\t\t  if( theDims[i]->value.undef[row] ) {\n\t\t     fferror(\"Null encountered as vector index\");\n\t\t     free( this->value.data.ptr );\n\t\t     break;\n\t\t  } else\n\t\t     dimVals[i] = theDims[i]->value.data.lngptr[row];\n\t       }\n\t    }\n\t    if( gParse.status ) break;\n\n\t    elem = 0;\n\t    i    = nDims;\n\t    while( i-- ) {\n\t       if( dimVals[i]<1 || dimVals[i]>theVar->value.naxes[i] ) break;\n\t       elem = theVar->value.naxes[i]*elem + dimVals[i]-1;\n\t    }\n\t    if( i<0 ) {\n\t       elem += row*theVar->value.nelem;\n\n\t       if( this->type==STRING )\n\t\t this->value.undef[row] = theVar->value.undef[row];\n\t       else if( this->type==BITSTR ) \n\t\t this->value.undef;  /* Dummy - BITSTRs do not have undefs */\n\t       else \n\t\t this->value.undef[row] = theVar->value.undef[elem];\n\n\t       if( this->type==DOUBLE )\n\t\t  this->value.data.dblptr[row] = \n\t\t     theVar->value.data.dblptr[elem];\n\t       else if( this->type==LONG )\n\t\t  this->value.data.lngptr[row] = \n\t\t     theVar->value.data.lngptr[elem];\n\t       else if( this->type==BOOLEAN )\n\t\t  this->value.data.logptr[row] = \n\t\t     theVar->value.data.logptr[elem];\n\t       else {\n\t\t /* XXX Note, the below expression uses knowledge of\n                    the layout of the string format, namely (nelem+1)\n                    characters per string, followed by (nelem+1)\n                    \"undef\" values. */\n\t\t  this->value.data.strptr[row][0] = \n\t\t     theVar->value.data.strptr[0][elem+row];\n\t\t  this->value.data.strptr[row][1] = 0;  /* Null terminate */\n\t       }\n\t    } else {\n\t       fferror(\"Index out of range\");\n\t       free( this->value.data.ptr );\n\t    }\n\t }\n\n      } else {\n\n\t /* Reduce dimensions by 1, using a nonconstant expression */\n\n\t for( row=0; row<gParse.nRows; row++ ) {\n\n\t    /* Index cannot be a constant */\n\n\t    if( theDims[0]->value.undef[row] ) {\n\t       fferror(\"Null encountered as vector index\");\n\t       free( this->value.data.ptr );\n\t       break;\n\t    } else\n\t       dimVals[0] = theDims[0]->value.data.lngptr[row];\n\n\t    if( dimVals[0] < 1 ||\n\t\tdimVals[0] > theVar->value.naxes[ theVar->value.naxis-1 ] ) {\n\t       fferror(\"Index out of range\");\n\t       free( this->value.data.ptr );\n\t    } else if ( this->type == BITSTR || this->type == STRING ) {\n\t      elem = this->value.nelem * (dimVals[0]-1);\n\t      elem += row*(theVar->value.nelem+1);\n\t      if (this->value.undef) \n\t\tthis->value.undef[row] = theVar->value.undef[row];\n\t      memcpy( (char*)this->value.data.strptr[0]\n\t\t      + row*sizeof(char)*(this->value.nelem+1),\n\t\t      (char*)theVar->value.data.strptr[0] + elem*sizeof(char),\n\t\t      this->value.nelem * sizeof(char) );\n\t      /* Null terminate */\n\t      this->value.data.strptr[row][this->value.nelem] = 0;\n\t    } else {\n\t       elem  = this->value.nelem * (dimVals[0]-1);\n\t       elem += row*theVar->value.nelem;\n\t       memcpy( this->value.undef + row*this->value.nelem,\n\t\t       theVar->value.undef + elem,\n\t\t       this->value.nelem * sizeof(char) );\n\t       memcpy( (char*)this->value.data.ptr\n\t\t       + row*dsize*this->value.nelem,\n\t\t       (char*)theVar->value.data.ptr + elem*dsize,\n\t\t       this->value.nelem * dsize );\n\t    }\n\t }\n      }\n   }\n\n   if( theVar->operation>0 ) {\n     if (theVar->type == STRING || theVar->type == BITSTR) \n       free(theVar->value.data.strptr[0] );\n     else \n       free( theVar->value.data.ptr );\n   }\n   for( i=0; i<nDims; i++ )\n      if( theDims[i]->operation>0 ) {\n\t free( theDims[i]->value.data.ptr );\n      }\n}\n\nstatic void Do_GTI( Node *this )\n{\n   Node *theExpr, *theTimes;\n   double *start, *stop, *times;\n   long elem, nGTI, gti;\n   int ordered;\n\n   theTimes = gParse.Nodes + this->SubNodes[0];\n   theExpr  = gParse.Nodes + this->SubNodes[1];\n\n   nGTI    = theTimes->value.nelem;\n   start   = theTimes->value.data.dblptr;\n   stop    = theTimes->value.data.dblptr + nGTI;\n   ordered = theTimes->type;\n\n   if( theExpr->operation==CONST_OP ) {\n\n      this->value.data.log = \n\t(Search_GTI( theExpr->value.data.dbl, nGTI, start, stop, ordered, 0 )>=0);\n      this->operation      = CONST_OP;\n\n   } else {\n\n      Allocate_Ptrs( this );\n\n      times = theExpr->value.data.dblptr;\n      if( !gParse.status ) {\n\n\t elem = gParse.nRows * this->value.nelem;\n\t if( nGTI ) {\n\t    gti = -1;\n\t    while( elem-- ) {\n\t       if( (this->value.undef[elem] = theExpr->value.undef[elem]) )\n\t\t  continue;\n\n            /*  Before searching entire GTI, check the GTI found last time  */\n\t       if( gti<0 || times[elem]<start[gti] || times[elem]>stop[gti] ) {\n\t\t gti = Search_GTI( times[elem], nGTI, start, stop, ordered, 0 );\n\t       }\n\t       this->value.data.logptr[elem] = ( gti>=0 );\n\t    }\n\t } else\n\t    while( elem-- ) {\n\t       this->value.data.logptr[elem] = 0;\n\t       this->value.undef[elem]       = 0;\n\t    }\n      }\n   }\n\n   if( theExpr->operation>0 )\n      free( theExpr->value.data.ptr );\n}\n\nstatic void Do_GTI_Over( Node *this )\n{\n   Node *theTimes, *theStart, *theStop;\n   double *gtiStart, *gtiStop;\n   double *evtStart, *evtStop;\n   long elem, nGTI, gti, nextGTI;\n   int ordered;\n\n   theTimes = gParse.Nodes + this->SubNodes[0]; /* GTI times */\n   theStop  = gParse.Nodes + this->SubNodes[2]; /* User start time */\n   theStart = gParse.Nodes + this->SubNodes[1]; /* User stop time */\n\n   nGTI     = theTimes->value.nelem;\n   gtiStart = theTimes->value.data.dblptr;        /* GTI start */\n   gtiStop  = theTimes->value.data.dblptr + nGTI; /* GTI stop */\n\n   if( theStart->operation==CONST_OP && theStop->operation==CONST_OP) {\n\n      this->value.data.dbl = \n\t(GTI_Over( theStart->value.data.dbl, theStop->value.data.dbl,\n\t\t   nGTI, gtiStart, gtiStop, &gti));\n      this->operation      = CONST_OP;\n\n   } else {\n      char undefStart = 0, undefStop = 0; /* Input values are undef? */\n      double uStart, uStop;       /* User start/stop values */\n      if (theStart->operation==CONST_OP) uStart = theStart->value.data.dbl;\n      if (theStop ->operation==CONST_OP) uStop  = theStop ->value.data.dbl;\n\n      Allocate_Ptrs( this );\n\n      evtStart = theStart->value.data.dblptr;\n      evtStop  = theStop ->value.data.dblptr;\n      if( !gParse.status ) {\n\n\t elem = gParse.nRows * this->value.nelem;\n\t if( nGTI ) {\n\t    double toverlap = 0.0;\n\t    gti = -1;\n\t    while( elem-- ) {\n\t      if (theStart->operation!=CONST_OP) {\n\t\tundefStart = theStart->value.undef[elem];\n\t\tuStart     = evtStart[elem];\n\t      }\n\t      if (theStop->operation!=CONST_OP) {\n\t\tundefStop  = theStop ->value.undef[elem];\n\t\tuStop      = evtStop[elem];\n\t      }\n\t      /* This works because at least one of the values is not const */\n\t      if( (this->value.undef[elem] = (undefStart||undefStop)) )\n\t\t  continue;\n\n            /*  Before searching entire GTI, check the GTI found last time  */\n\t       if( gti<0 || \n\t\t   uStart<gtiStart[gti] || uStart>gtiStop[gti] ||\n\t\t   uStop <gtiStart[gti] || uStop >gtiStop[gti]) {\n\t\t /* Nope, need to recalculate */\n\t\t toverlap = GTI_Over(uStart, uStop, \n\t\t\t\t     nGTI, gtiStart, gtiStop, \n\t\t\t\t     &gti);\n\t       } else {\n\t\t /* We are in same GTI, the overlap is just stop-start of user range */\n\t\t toverlap = (uStop-uStart);\n\t       }\n\n\t       /* This works because at least one of the values is not const */\n\t       this->value.data.dblptr[elem] = toverlap;\n\t    }\n\t } else\n\t    /* nGTI == 0; there is no overlap so set all values to 0.0 */\n\t    while( elem-- ) {\n\t       this->value.data.dblptr[elem] = 0.0;\n\t       this->value.undef[elem]       = 0;\n\t    }\n      }\n   }\n\n   if( theStart->operation>0 ) {\n     free( theStart->value.data.ptr );\n   }\n   if( theStop->operation>0 ) {\n     free( theStop->value.data.ptr );\n   }\n}\n\nstatic double GTI_Over(double evtStart, double evtStop,\n\t\t       long nGTI, double *start, double *stop,\n\t\t       long *gtiout)\n{\n  long gti1, gti2, nextGTI1, nextGTI2;\n  long gti, nMax;\n  double overlap = 0.0;\n\n  *gtiout = -1L;\n  /* Zero or negative bin size */\n  if (evtStop <= evtStart) return 0.0;\n\n  /* Locate adjacent GTIs for evtStart and evtStop */\n  gti1 = Search_GTI(evtStart, nGTI, start, stop, 1, &nextGTI1);\n  gti2 = Search_GTI(evtStop,  nGTI, start, stop, 1, &nextGTI2);\n\n  /* evtStart is in gti1, we return that for future processing */\n  if (gti1 >= 0) *gtiout = gti1;\n\n  /* Both evtStart/evtStop are beyond the last GTI */\n  if (nextGTI1 < 0 && nextGTI2 < 0) return 0.0;\n\n  /* Both evtStart/evtStop are in the same gap between GTIs */\n  if (gti1 < 0 && gti2 < 0 && nextGTI1 == nextGTI2) return 0.0;\n\n  /* Both evtStart/evtStop are in the same GTI */\n  if (gti1 >= 0 && gti1 == gti2) return (evtStop-evtStart);\n\n  /* Count through the remaining GTIs; there will be at least one */\n  /* The largest GTI to consider is either nextGTI2-1, if it exists,\n     or nGTI-1 */\n  if (nextGTI2 < 0) nMax = nGTI-1;\n  else if (gti2 >= 0) nMax = nextGTI2;\n  else nMax = nextGTI2-1;\n  for (gti = nextGTI1; gti <= nMax; gti++) {\n    double starti = start[gti], stopi = stop[gti];\n    /* Trim the GTI by actual evtStart/Stop times */\n    if (evtStart > starti) starti = evtStart;\n    if (evtStop  < stopi ) stopi  = evtStop;\n    overlap += (stopi - starti);\n  }\n    \n  return overlap;\n}\n\n/*\n * Search_GTI - search GTI for requested evtTime\n * \n * double evtTime - requested event time\n * long nGTI - number of entries in start[] and stop[]\n * double start[], stop[] - start and stop of each GTI\n * int ordered - set to 1 if time-ordered\n * long *nextGTI0 - upon return, *nextGTI0 is either\n *                   the GTI evtTime is inside\n *                   the next GTI if evtTime is not inside\n *                   -1L if there is no next GTI\n *                   not set if nextGTI0 is a null pointer\n *\n * NOTE: for *nextGTI to be well-defined, the GTI must\n *   be ordered.  This is true when called by Do_GTI.\n *\n * RETURNS: gti index that evtTime is located inside, or -1L\n */\nstatic long Search_GTI( double evtTime, long nGTI, double *start,\n\t\t\tdouble *stop, int ordered, long *nextGTI0 )\n{\n   long gti, nextGTI = -1L, step;\n                             \n   if( ordered && nGTI>15 ) { /*  If time-ordered and lots of GTIs,   */\n                              /*  use \"FAST\" Binary search algorithm  */\n      if( evtTime>=start[0] && evtTime<=stop[nGTI-1] ) {\n\t gti = step = (nGTI >> 1);\n\t while(1) {\n\t    if( step>1L ) step >>= 1;\n\t    \n\t    if( evtTime>stop[gti] ) {\n\t       if( evtTime>=start[gti+1] )\n\t\t  gti += step;\n\t       else {\n\t\t  nextGTI = gti+1;\n\t\t  gti = -1L;\n\t\t  break;\n\t       }\n\t    } else if( evtTime<start[gti] ) {\n\t       if( evtTime<=stop[gti-1] )\n\t\t  gti -= step;\n\t       else {\n\t\t  nextGTI = gti;\n\t\t  gti = -1L;\n\t\t  break;\n\t       }\n\t    } else {\n\t       nextGTI = gti;\n\t       break;\n\t    }\n\t }\n      } else {\n\t if (start[0] > evtTime) nextGTI = 0;\n\t gti = -1L;\n      }\n      \n   } else { /*  Use \"SLOW\" linear search.  Not required to be \n\t        ordered, so we have to search the whole table\n\t\tno matter what.\n\t    */\n      gti = nGTI;\n      while( gti-- ) {\n\tif( stop[gti] >= evtTime ) nextGTI = gti;\n\tif( evtTime>=start[gti] && evtTime<=stop[gti] )\n\t    break;\n      }\n   }\n\n   if (nextGTI >= nGTI) nextGTI = -1;\n   if (nextGTI0) *nextGTI0 = nextGTI;\n\n   return( gti );\n}\n\nstatic void Do_REG( Node *this )\n{\n   Node *theRegion, *theX, *theY;\n   double Xval=0.0, Yval=0.0;\n   char   Xnull=0, Ynull=0;\n   int    Xvector, Yvector;\n   long   nelem, elem, rows;\n\n   theRegion = gParse.Nodes + this->SubNodes[0];\n   theX      = gParse.Nodes + this->SubNodes[1];\n   theY      = gParse.Nodes + this->SubNodes[2];\n\n   Xvector = ( theX->operation!=CONST_OP );\n   if( Xvector )\n      Xvector = theX->value.nelem;\n   else {\n      Xval  = theX->value.data.dbl;\n   }\n\n   Yvector = ( theY->operation!=CONST_OP );\n   if( Yvector )\n      Yvector = theY->value.nelem;\n   else {\n      Yval  = theY->value.data.dbl;\n   } \n\n   if( !Xvector && !Yvector ) {\n\n      this->value.data.log =\n\t ( fits_in_region( Xval, Yval, (SAORegion *)theRegion->value.data.ptr )\n\t   != 0 );\n      this->operation      = CONST_OP;\n\n   } else {\n\n      Allocate_Ptrs( this );\n\n      if( !gParse.status ) {\n\n\t rows  = gParse.nRows;\n\t nelem = this->value.nelem;\n\t elem  = rows*nelem;\n\n\t while( rows-- ) {\n\t    while( nelem-- ) {\n\t       elem--;\n\n\t       if( Xvector>1 ) {\n\t\t  Xval  = theX->value.data.dblptr[elem];\n\t\t  Xnull = theX->value.undef[elem];\n\t       } else if( Xvector ) {\n\t\t  Xval  = theX->value.data.dblptr[rows];\n\t\t  Xnull = theX->value.undef[rows];\n\t       }\n\n\t       if( Yvector>1 ) {\n\t\t  Yval  = theY->value.data.dblptr[elem];\n\t\t  Ynull = theY->value.undef[elem];\n\t       } else if( Yvector ) {\n\t\t  Yval  = theY->value.data.dblptr[rows];\n\t\t  Ynull = theY->value.undef[rows];\n\t       }\n\n\t       this->value.undef[elem] = ( Xnull || Ynull );\n\t       if( this->value.undef[elem] )\n\t\t  continue;\n\n\t       this->value.data.logptr[elem] = \n\t\t  ( fits_in_region( Xval, Yval,\n\t\t\t\t    (SAORegion *)theRegion->value.data.ptr )\n\t\t    != 0 );\n\t    }\n\t    nelem = this->value.nelem;\n\t }\n      }\n   }\n\n   if( theX->operation>0 )\n      free( theX->value.data.ptr );\n   if( theY->operation>0 )\n      free( theY->value.data.ptr );\n}\n\nstatic void Do_Vector( Node *this )\n{\n   Node *that;\n   long row, elem, idx, jdx, offset=0;\n   int node;\n\n   Allocate_Ptrs( this );\n\n   if( !gParse.status ) {\n\n      for( node=0; node<this->nSubNodes; node++ ) {\n\n\t that = gParse.Nodes + this->SubNodes[node];\n\n\t if( that->operation == CONST_OP ) {\n\n\t    idx = gParse.nRows*this->value.nelem + offset;\n\t    while( (idx-=this->value.nelem)>=0 ) {\n\t       \n\t       this->value.undef[idx] = 0;\n\n\t       switch( this->type ) {\n\t       case BOOLEAN:\n\t\t  this->value.data.logptr[idx] = that->value.data.log;\n\t\t  break;\n\t       case LONG:\n\t\t  this->value.data.lngptr[idx] = that->value.data.lng;\n\t\t  break;\n\t       case DOUBLE:\n\t\t  this->value.data.dblptr[idx] = that->value.data.dbl;\n\t\t  break;\n\t       }\n\t    }\n\t    \n\t } else {\n\t       \n\t    row  = gParse.nRows;\n\t    idx  = row * that->value.nelem;\n\t    while( row-- ) {\n\t       elem = that->value.nelem;\n\t       jdx = row*this->value.nelem + offset;\n\t       while( elem-- ) {\n\t\t  this->value.undef[jdx+elem] =\n\t\t     that->value.undef[--idx];\n\n\t\t  switch( this->type ) {\n\t\t  case BOOLEAN:\n\t\t     this->value.data.logptr[jdx+elem] =\n\t\t\tthat->value.data.logptr[idx];\n\t\t     break;\n\t\t  case LONG:\n\t\t     this->value.data.lngptr[jdx+elem] =\n\t\t\tthat->value.data.lngptr[idx];\n\t\t     break;\n\t\t  case DOUBLE:\n\t\t     this->value.data.dblptr[jdx+elem] =\n\t\t\tthat->value.data.dblptr[idx];\n\t\t     break;\n\t\t  }\n\t       }\n\t    }\n\t }\n\t offset += that->value.nelem;\n      }\n\n   }\n\n   for( node=0; node < this->nSubNodes; node++ )\n     if( OPER(this->SubNodes[node])>0 )\n       free( gParse.Nodes[this->SubNodes[node]].value.data.ptr );\n}\n\n/*****************************************************************************/\n/*  Utility routines which perform the calculations on bits and SAO regions  */\n/*****************************************************************************/\n\nstatic char bitlgte(char *bits1, int oper, char *bits2)\n{\n int val1, val2, nextbit;\n char result;\n int i, l1, l2, length, ldiff;\n char *stream=0;\n char chr1, chr2;\n\n l1 = strlen(bits1);\n l2 = strlen(bits2);\n length = (l1 > l2) ? l1 : l2;\n stream = (char *)malloc(sizeof(char)*(length+1));\n if (l1 < l2)\n   {\n    ldiff = l2 - l1;\n    i=0;\n    while( ldiff-- ) stream[i++] = '0';\n    while( l1--    ) stream[i++] = *(bits1++);\n    stream[i] = '\\0';\n    bits1 = stream;\n   }\n else if (l2 < l1)\n   {\n    ldiff = l1 - l2;\n    i=0;\n    while( ldiff-- ) stream[i++] = '0';\n    while( l2--    ) stream[i++] = *(bits2++);\n    stream[i] = '\\0';\n    bits2 = stream;\n   }\n\n val1 = val2 = 0;\n nextbit = 1;\n\n while( length-- )\n    {\n     chr1 = bits1[length];\n     chr2 = bits2[length];\n     if ((chr1 != 'x')&&(chr1 != 'X')&&(chr2 != 'x')&&(chr2 != 'X'))\n       {\n        if (chr1 == '1') val1 += nextbit;\n        if (chr2 == '1') val2 += nextbit;\n        nextbit *= 2;\n       }\n    }\n result = 0;\n switch (oper)\n       {\n        case LT:\n             if (val1 < val2) result = 1;\n             break;\n        case LTE:\n             if (val1 <= val2) result = 1;\n             break;\n        case GT:\n             if (val1 > val2) result = 1;\n             break;\n        case GTE:\n             if (val1 >= val2) result = 1;\n             break;\n       }\n free(stream);\n return (result);\n}\n\nstatic void bitand(char *result,char *bitstrm1,char *bitstrm2)\n{\n int i, l1, l2, ldiff, largestStream;\n char *stream=0;\n char chr1, chr2;\n\n l1 = strlen(bitstrm1);\n l2 = strlen(bitstrm2);\n largestStream = (l1 > l2) ? l1 : l2;\n stream = (char *)malloc(sizeof(char)*(largestStream+1));\n if (l1 < l2)\n   {\n    ldiff = l2 - l1;\n    i=0;\n    while( ldiff-- ) stream[i++] = '0';\n    while( l1--    ) stream[i++] = *(bitstrm1++);\n    stream[i] = '\\0';\n    bitstrm1 = stream;\n   }\n else if (l2 < l1)\n   {\n    ldiff = l1 - l2;\n    i=0;\n    while( ldiff-- ) stream[i++] = '0';\n    while( l2--    ) stream[i++] = *(bitstrm2++);\n    stream[i] = '\\0';\n    bitstrm2 = stream;\n   }\n while ( (chr1 = *(bitstrm1++)) ) \n    {\n       chr2 = *(bitstrm2++);\n       if ((chr1 == 'x') || (chr2 == 'x'))\n          *result = 'x';\n       else if ((chr1 == '1') && (chr2 == '1'))\n          *result = '1';\n       else\n          *result = '0';\n       result++;\n    }\n free(stream);\n *result = '\\0';\n}\n\nstatic void bitor(char *result,char *bitstrm1,char *bitstrm2)\n{\n int i, l1, l2, ldiff, largestStream;\n char *stream=0;\n char chr1, chr2;\n\n l1 = strlen(bitstrm1);\n l2 = strlen(bitstrm2);\n largestStream = (l1 > l2) ? l1 : l2;\n stream = (char *)malloc(sizeof(char)*(largestStream+1));\n if (l1 < l2)\n   {\n    ldiff = l2 - l1;\n    i=0;\n    while( ldiff-- ) stream[i++] = '0';\n    while( l1--    ) stream[i++] = *(bitstrm1++);\n    stream[i] = '\\0';\n    bitstrm1 = stream;\n   }\n else if (l2 < l1)\n   {\n    ldiff = l1 - l2;\n    i=0;\n    while( ldiff-- ) stream[i++] = '0';\n    while( l2--    ) stream[i++] = *(bitstrm2++);\n    stream[i] = '\\0';\n    bitstrm2 = stream;\n   }\n while ( (chr1 = *(bitstrm1++)) ) \n    {\n       chr2 = *(bitstrm2++);\n       if ((chr1 == '1') || (chr2 == '1'))\n          *result = '1';\n       else if ((chr1 == '0') || (chr2 == '0'))\n          *result = '0';\n       else\n          *result = 'x';\n       result++;\n    }\n free(stream);\n *result = '\\0';\n}\n\nstatic void bitnot(char *result,char *bits)\n{\n   int length;\n   char chr;\n\n   length = strlen(bits);\n   while( length-- ) {\n      chr = *(bits++);\n      *(result++) = ( chr=='1' ? '0' : ( chr=='0' ? '1' : chr ) );\n   }\n   *result = '\\0';\n}\n\nstatic char bitcmp(char *bitstrm1, char *bitstrm2)\n{\n int i, l1, l2, ldiff, largestStream;\n char *stream=0;\n char chr1, chr2;\n\n l1 = strlen(bitstrm1);\n l2 = strlen(bitstrm2);\n largestStream = (l1 > l2) ? l1 : l2;\n stream = (char *)malloc(sizeof(char)*(largestStream+1));\n if (l1 < l2)\n   {\n    ldiff = l2 - l1;\n    i=0;\n    while( ldiff-- ) stream[i++] = '0';\n    while( l1--    ) stream[i++] = *(bitstrm1++);\n    stream[i] = '\\0';\n    bitstrm1 = stream;\n   }\n else if (l2 < l1)\n   {\n    ldiff = l1 - l2;\n    i=0;\n    while( ldiff-- ) stream[i++] = '0';\n    while( l2--    ) stream[i++] = *(bitstrm2++);\n    stream[i] = '\\0';\n    bitstrm2 = stream;\n   }\n while( (chr1 = *(bitstrm1++)) )\n    {\n       chr2 = *(bitstrm2++);\n       if ( ((chr1 == '0') && (chr2 == '1'))\n\t    || ((chr1 == '1') && (chr2 == '0')) )\n       {\n          free(stream);\n\t  return( 0 );\n       }\n    }\n free(stream);\n return( 1 );\n}\n\nstatic char bnear(double x, double y, double tolerance)\n{\n if (fabs(x - y) < tolerance)\n   return ( 1 );\n else\n   return ( 0 );\n}\n\nstatic char saobox(double xcen, double ycen, double xwid, double ywid,\n\t\t   double rot,  double xcol, double ycol)\n{\n double x,y,xprime,yprime,xmin,xmax,ymin,ymax,theta;\n\n theta = (rot / 180.0) * myPI;\n xprime = xcol - xcen;\n yprime = ycol - ycen;\n x =  xprime * cos(theta) + yprime * sin(theta);\n y = -xprime * sin(theta) + yprime * cos(theta);\n xmin = - 0.5 * xwid; xmax = 0.5 * xwid;\n ymin = - 0.5 * ywid; ymax = 0.5 * ywid;\n if ((x >= xmin) && (x <= xmax) && (y >= ymin) && (y <= ymax))\n   return ( 1 );\n else\n   return ( 0 );\n}\n\nstatic char circle(double xcen, double ycen, double rad,\n\t\t   double xcol, double ycol)\n{\n double r2,dx,dy,dlen;\n\n dx = xcol - xcen;\n dy = ycol - ycen;\n dx *= dx; dy *= dy;\n dlen = dx + dy;\n r2 = rad * rad;\n if (dlen <= r2)\n   return ( 1 );\n else\n   return ( 0 );\n}\n\nstatic char ellipse(double xcen, double ycen, double xrad, double yrad,\n\t\t    double rot, double xcol, double ycol)\n{\n double x,y,xprime,yprime,dx,dy,dlen,theta;\n\n theta = (rot / 180.0) * myPI;\n xprime = xcol - xcen;\n yprime = ycol - ycen;\n x =  xprime * cos(theta) + yprime * sin(theta);\n y = -xprime * sin(theta) + yprime * cos(theta);\n dx = x / xrad; dy = y / yrad;\n dx *= dx; dy *= dy;\n dlen = dx + dy;\n if (dlen <= 1.0)\n   return ( 1 );\n else\n   return ( 0 );\n}\n\n/*\n * Extract substring\n */\nint cstrmid(char *dest_str, int dest_len,\n\t    char *src_str,  int src_len,\n\t    int pos)\n{\n  /* char fill_char = ' '; */\n  char fill_char = '\\0';\n  if (src_len == 0) { src_len = strlen(src_str); } /* .. if constant */\n\n  /* Fill destination with blanks */\n  if (pos < 0) { \n    fferror(\"STRMID(S,P,N) P must be 0 or greater\");\n    return -1;\n  }\n  if (pos > src_len || pos == 0) {\n    /* pos==0: blank string requested */\n    memset(dest_str, fill_char, dest_len);\n  } else if (pos+dest_len > src_len) {\n    /* Copy a subset */\n    int nsub = src_len-pos+1;\n    int npad = dest_len - nsub;\n    memcpy(dest_str, src_str+pos-1, nsub);\n    /* Fill remaining string with blanks */\n    memset(dest_str+nsub, fill_char, npad);\n  } else {\n    /* Full string copy */\n    memcpy(dest_str, src_str+pos-1, dest_len);\n  }\n  dest_str[dest_len] = '\\0'; /* Null-terminate */\n\n  return 0;\n}\n\n\nstatic void fferror(char *s)\n{\n    char msg[80];\n\n    if( !gParse.status ) gParse.status = PARSE_SYNTAX_ERR;\n\n    strncpy(msg, s, 80);\n    msg[79] = '\\0';\n    ffpmsg(msg);\n}\n"},{"id":16741,"name":"deflate.h","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* deflate.h -- internal compression state\n * Copyright (C) 1995-2010 Jean-loup Gailly\n * For conditions of distribution and use, see copyright notice in zlib.h\n */\n\n/* WARNING: this file should *not* be used by applications. It is\n   part of the implementation of the compression library and is\n   subject to change. Applications should only use zlib.h.\n */\n\n#ifndef DEFLATE_H\n#define DEFLATE_H\n\n#include \"zutil.h\"\n\n/* define NO_GZIP when compiling if you want to disable gzip header and\n   trailer creation by deflate().  NO_GZIP would be used to avoid linking in\n   the crc code when it is not needed.  For shared libraries, gzip encoding\n   should be left enabled. */\n#ifndef NO_GZIP\n#  define GZIP\n#endif\n\n/* ===========================================================================\n * Internal compression state.\n */\n\n#define LENGTH_CODES 29\n/* number of length codes, not counting the special END_BLOCK code */\n\n#define LITERALS  256\n/* number of literal bytes 0..255 */\n\n#define L_CODES (LITERALS+1+LENGTH_CODES)\n/* number of Literal or Length codes, including the END_BLOCK code */\n\n#define D_CODES   30\n/* number of distance codes */\n\n#define BL_CODES  19\n/* number of codes used to transfer the bit lengths */\n\n#define HEAP_SIZE (2*L_CODES+1)\n/* maximum heap size */\n\n#define MAX_BITS 15\n/* All codes must not exceed MAX_BITS bits */\n\n#define INIT_STATE    42\n#define EXTRA_STATE   69\n#define NAME_STATE    73\n#define COMMENT_STATE 91\n#define HCRC_STATE   103\n#define BUSY_STATE   113\n#define FINISH_STATE 666\n/* Stream status */\n\n\n/* Data structure describing a single value and its code string. */\ntypedef struct ct_data_s {\n    union {\n        ush  freq;       /* frequency count */\n        ush  code;       /* bit string */\n    } fc;\n    union {\n        ush  dad;        /* father node in Huffman tree */\n        ush  len;        /* length of bit string */\n    } dl;\n} FAR ct_data;\n\n#define Freq fc.freq\n#define Code fc.code\n#define Dad  dl.dad\n#define Len  dl.len\n\ntypedef struct static_tree_desc_s  static_tree_desc;\n\ntypedef struct tree_desc_s {\n    ct_data *dyn_tree;           /* the dynamic tree */\n    int     max_code;            /* largest code with non zero frequency */\n    static_tree_desc *stat_desc; /* the corresponding static tree */\n} FAR tree_desc;\n\ntypedef ush Pos;\ntypedef Pos FAR Posf;\ntypedef unsigned IPos;\n\n/* A Pos is an index in the character window. We use short instead of int to\n * save space in the various tables. IPos is used only for parameter passing.\n */\n\ntypedef struct internal_state {\n    z_streamp strm;      /* pointer back to this zlib stream */\n    int   status;        /* as the name implies */\n    Bytef *pending_buf;  /* output still pending */\n    ulg   pending_buf_size; /* size of pending_buf */\n    Bytef *pending_out;  /* next pending byte to output to the stream */\n    uInt   pending;      /* nb of bytes in the pending buffer */\n    int   wrap;          /* bit 0 true for zlib, bit 1 true for gzip */\n    gz_headerp  gzhead;  /* gzip header information to write */\n    uInt   gzindex;      /* where in extra, name, or comment */\n    Byte  method;        /* STORED (for zip only) or DEFLATED */\n    int   last_flush;    /* value of flush param for previous deflate call */\n\n                /* used by deflate.c: */\n\n    uInt  w_size;        /* LZ77 window size (32K by default) */\n    uInt  w_bits;        /* log2(w_size)  (8..16) */\n    uInt  w_mask;        /* w_size - 1 */\n\n    Bytef *window;\n    /* Sliding window. Input bytes are read into the second half of the window,\n     * and move to the first half later to keep a dictionary of at least wSize\n     * bytes. With this organization, matches are limited to a distance of\n     * wSize-MAX_MATCH bytes, but this ensures that IO is always\n     * performed with a length multiple of the block size. Also, it limits\n     * the window size to 64K, which is quite useful on MSDOS.\n     * To do: use the user input buffer as sliding window.\n     */\n\n    ulg window_size;\n    /* Actual size of window: 2*wSize, except when the user input buffer\n     * is directly used as sliding window.\n     */\n\n    Posf *prev;\n    /* Link to older string with same hash index. To limit the size of this\n     * array to 64K, this link is maintained only for the last 32K strings.\n     * An index in this array is thus a window index modulo 32K.\n     */\n\n    Posf *head; /* Heads of the hash chains or NIL. */\n\n    uInt  ins_h;          /* hash index of string to be inserted */\n    uInt  hash_size;      /* number of elements in hash table */\n    uInt  hash_bits;      /* log2(hash_size) */\n    uInt  hash_mask;      /* hash_size-1 */\n\n    uInt  hash_shift;\n    /* Number of bits by which ins_h must be shifted at each input\n     * step. It must be such that after MIN_MATCH steps, the oldest\n     * byte no longer takes part in the hash key, that is:\n     *   hash_shift * MIN_MATCH >= hash_bits\n     */\n\n    long block_start;\n    /* Window position at the beginning of the current output block. Gets\n     * negative when the window is moved backwards.\n     */\n\n    uInt match_length;           /* length of best match */\n    IPos prev_match;             /* previous match */\n    int match_available;         /* set if previous match exists */\n    uInt strstart;               /* start of string to insert */\n    uInt match_start;            /* start of matching string */\n    uInt lookahead;              /* number of valid bytes ahead in window */\n\n    uInt prev_length;\n    /* Length of the best match at previous step. Matches not greater than this\n     * are discarded. This is used in the lazy match evaluation.\n     */\n\n    uInt max_chain_length;\n    /* To speed up deflation, hash chains are never searched beyond this\n     * length.  A higher limit improves compression ratio but degrades the\n     * speed.\n     */\n\n    uInt max_lazy_match;\n    /* Attempt to find a better match only when the current match is strictly\n     * smaller than this value. This mechanism is used only for compression\n     * levels >= 4.\n     */\n#   define max_insert_length  max_lazy_match\n    /* Insert new strings in the hash table only if the match length is not\n     * greater than this length. This saves time but degrades compression.\n     * max_insert_length is used only for compression levels <= 3.\n     */\n\n    int level;    /* compression level (1..9) */\n    int strategy; /* favor or force Huffman coding*/\n\n    uInt good_match;\n    /* Use a faster search when the previous match is longer than this */\n\n    int nice_match; /* Stop searching when current match exceeds this */\n\n                /* used by trees.c: */\n    /* Didn't use ct_data typedef below to supress compiler warning */\n    struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */\n    struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n    struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */\n\n    struct tree_desc_s l_desc;               /* desc. for literal tree */\n    struct tree_desc_s d_desc;               /* desc. for distance tree */\n    struct tree_desc_s bl_desc;              /* desc. for bit length tree */\n\n    ush bl_count[MAX_BITS+1];\n    /* number of codes at each bit length for an optimal tree */\n\n    int heap[2*L_CODES+1];      /* heap used to build the Huffman trees */\n    int heap_len;               /* number of elements in the heap */\n    int heap_max;               /* element of largest frequency */\n    /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n     * The same heap array is used to build all trees.\n     */\n\n    uch depth[2*L_CODES+1];\n    /* Depth of each subtree used as tie breaker for trees of equal frequency\n     */\n\n    uchf *l_buf;          /* buffer for literals or lengths */\n\n    uInt  lit_bufsize;\n    /* Size of match buffer for literals/lengths.  There are 4 reasons for\n     * limiting lit_bufsize to 64K:\n     *   - frequencies can be kept in 16 bit counters\n     *   - if compression is not successful for the first block, all input\n     *     data is still in the window so we can still emit a stored block even\n     *     when input comes from standard input.  (This can also be done for\n     *     all blocks if lit_bufsize is not greater than 32K.)\n     *   - if compression is not successful for a file smaller than 64K, we can\n     *     even emit a stored file instead of a stored block (saving 5 bytes).\n     *     This is applicable only for zip (not gzip or zlib).\n     *   - creating new Huffman trees less frequently may not provide fast\n     *     adaptation to changes in the input data statistics. (Take for\n     *     example a binary file with poorly compressible code followed by\n     *     a highly compressible string table.) Smaller buffer sizes give\n     *     fast adaptation but have of course the overhead of transmitting\n     *     trees more frequently.\n     *   - I can't count above 4\n     */\n\n    uInt last_lit;      /* running index in l_buf */\n\n    ushf *d_buf;\n    /* Buffer for distances. To simplify the code, d_buf and l_buf have\n     * the same number of elements. To use different lengths, an extra flag\n     * array would be necessary.\n     */\n\n    ulg opt_len;        /* bit length of current block with optimal trees */\n    ulg static_len;     /* bit length of current block with static trees */\n    uInt matches;       /* number of string matches in current block */\n    int last_eob_len;   /* bit length of EOB code for last block */\n\n#ifdef DEBUG\n    ulg compressed_len; /* total bit length of compressed file mod 2^32 */\n    ulg bits_sent;      /* bit length of compressed data sent mod 2^32 */\n#endif\n\n    ush bi_buf;\n    /* Output buffer. bits are inserted starting at the bottom (least\n     * significant bits).\n     */\n    int bi_valid;\n    /* Number of valid bits in bi_buf.  All bits above the last valid bit\n     * are always zero.\n     */\n\n    ulg high_water;\n    /* High water mark offset in window for initialized bytes -- bytes above\n     * this are set to zero in order to avoid memory check warnings when\n     * longest match routines access bytes past the input.  This is then\n     * updated to the new high water mark.\n     */\n\n} FAR deflate_state;\n\n/* Output a byte on the stream.\n * IN assertion: there is enough room in pending_buf.\n */\n#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}\n\n\n#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)\n/* Minimum amount of lookahead, except at the end of the input file.\n * See deflate.c for comments about the MIN_MATCH+1.\n */\n\n#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)\n/* In order to simplify the code, particularly on 16 bit machines, match\n * distances are limited to MAX_DIST instead of WSIZE.\n */\n\n#define WIN_INIT MAX_MATCH\n/* Number of bytes after end of data in window to initialize in order to avoid\n   memory checker errors from longest match routines */\n\n        /* in trees.c */\nvoid ZLIB_INTERNAL _tr_init OF((deflate_state *s));\nint ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));\nvoid ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,\n                        ulg stored_len, int last));\nvoid ZLIB_INTERNAL _tr_align OF((deflate_state *s));\nvoid ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,\n                        ulg stored_len, int last));\n\n#define d_code(dist) \\\n   ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])\n/* Mapping from a distance to a distance code. dist is the distance - 1 and\n * must not have side effects. _dist_code[256] and _dist_code[257] are never\n * used.\n */\n\n#ifndef DEBUG\n/* Inline versions of _tr_tally for speed: */\n\n#if defined(GEN_TREES_H) || !defined(STDC)\n  extern uch ZLIB_INTERNAL _length_code[];\n  extern uch ZLIB_INTERNAL _dist_code[];\n#else\n  extern const uch ZLIB_INTERNAL _length_code[];\n  extern const uch ZLIB_INTERNAL _dist_code[];\n#endif\n\n# define _tr_tally_lit(s, c, flush) \\\n  { uch cc = (c); \\\n    s->d_buf[s->last_lit] = 0; \\\n    s->l_buf[s->last_lit++] = cc; \\\n    s->dyn_ltree[cc].Freq++; \\\n    flush = (s->last_lit == s->lit_bufsize-1); \\\n   }\n# define _tr_tally_dist(s, distance, length, flush) \\\n  { uch len = (length); \\\n    ush dist = (distance); \\\n    s->d_buf[s->last_lit] = dist; \\\n    s->l_buf[s->last_lit++] = len; \\\n    dist--; \\\n    s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \\\n    s->dyn_dtree[d_code(dist)].Freq++; \\\n    flush = (s->last_lit == s->lit_bufsize-1); \\\n  }\n#else\n# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)\n# define _tr_tally_dist(s, distance, length, flush) \\\n              flush = _tr_tally(s, distance, length)\n#endif\n\n#endif /* DEFLATE_H */\n"},{"id":16742,"name":"deflate.c","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* deflate.c -- compress data using the deflation algorithm\n * Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler\n * For conditions of distribution and use, see copyright notice in zlib.h\n */\n\n/*\n *  ALGORITHM\n *\n *      The \"deflation\" process depends on being able to identify portions\n *      of the input text which are identical to earlier input (within a\n *      sliding window trailing behind the input currently being processed).\n *\n *      The most straightforward technique turns out to be the fastest for\n *      most input files: try all possible matches and select the longest.\n *      The key feature of this algorithm is that insertions into the string\n *      dictionary are very simple and thus fast, and deletions are avoided\n *      completely. Insertions are performed at each input character, whereas\n *      string matches are performed only when the previous match ends. So it\n *      is preferable to spend more time in matches to allow very fast string\n *      insertions and avoid deletions. The matching algorithm for small\n *      strings is inspired from that of Rabin & Karp. A brute force approach\n *      is used to find longer strings when a small match has been found.\n *      A similar algorithm is used in comic (by Jan-Mark Wams) and freeze\n *      (by Leonid Broukhis).\n *         A previous version of this file used a more sophisticated algorithm\n *      (by Fiala and Greene) which is guaranteed to run in linear amortized\n *      time, but has a larger average cost, uses more memory and is patented.\n *      However the F&G algorithm may be faster for some highly redundant\n *      files if the parameter max_chain_length (described below) is too large.\n *\n *  ACKNOWLEDGEMENTS\n *\n *      The idea of lazy evaluation of matches is due to Jan-Mark Wams, and\n *      I found it in 'freeze' written by Leonid Broukhis.\n *      Thanks to many people for bug reports and testing.\n *\n *  REFERENCES\n *\n *      Deutsch, L.P.,\"DEFLATE Compressed Data Format Specification\".\n *      Available in http://www.ietf.org/rfc/rfc1951.txt\n *\n *      A description of the Rabin and Karp algorithm is given in the book\n *         \"Algorithms\" by R. Sedgewick, Addison-Wesley, p252.\n *\n *      Fiala,E.R., and Greene,D.H.\n *         Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595\n *\n */\n\n#include \"deflate.h\"\n\nconst char deflate_copyright[] =\n   \" deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler \";\n/*\n  If you use the zlib library in a product, an acknowledgment is welcome\n  in the documentation of your product. If for some reason you cannot\n  include such an acknowledgment, I would appreciate that you keep this\n  copyright string in the executable of your product.\n */\n\n/* ===========================================================================\n *  Function prototypes.\n */\ntypedef enum {\n    need_more,      /* block not completed, need more input or more output */\n    block_done,     /* block flush performed */\n    finish_started, /* finish started, need only more output at next deflate */\n    finish_done     /* finish done, accept no more input or output */\n} block_state;\n\ntypedef block_state (*compress_func) OF((deflate_state *s, int flush));\n/* Compression function. Returns the block state after the call. */\n\nlocal void fill_window    OF((deflate_state *s));\nlocal block_state deflate_stored OF((deflate_state *s, int flush));\nlocal block_state deflate_fast   OF((deflate_state *s, int flush));\n#ifndef FASTEST\nlocal block_state deflate_slow   OF((deflate_state *s, int flush));\n#endif\nlocal block_state deflate_rle    OF((deflate_state *s, int flush));\nlocal block_state deflate_huff   OF((deflate_state *s, int flush));\nlocal void lm_init        OF((deflate_state *s));\nlocal void putShortMSB    OF((deflate_state *s, uInt b));\nlocal void flush_pending  OF((z_streamp strm));\nlocal int read_buf        OF((z_streamp strm, Bytef *buf, unsigned size));\n#ifdef ASMV\n      void match_init OF((void)); /* asm code initialization */\n      uInt longest_match  OF((deflate_state *s, IPos cur_match));\n#else\nlocal uInt longest_match  OF((deflate_state *s, IPos cur_match));\n#endif\n\n#ifdef DEBUG\nlocal  void check_match OF((deflate_state *s, IPos start, IPos match,\n                            int length));\n#endif\n\n/* ===========================================================================\n * Local data\n */\n\n#define NIL 0\n/* Tail of hash chains */\n\n#ifndef TOO_FAR\n#  define TOO_FAR 4096\n#endif\n/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\ntypedef struct config_s {\n   ush good_length; /* reduce lazy search above this match length */\n   ush max_lazy;    /* do not perform lazy search above this match length */\n   ush nice_length; /* quit search above this match length */\n   ush max_chain;\n   compress_func func;\n} config;\n\n#ifdef FASTEST\nlocal const config configuration_table[2] = {\n/*      good lazy nice chain */\n/* 0 */ {0,    0,  0,    0, deflate_stored},  /* store only */\n/* 1 */ {4,    4,  8,    4, deflate_fast}}; /* max speed, no lazy matches */\n#else\nlocal const config configuration_table[10] = {\n/*      good lazy nice chain */\n/* 0 */ {0,    0,  0,    0, deflate_stored},  /* store only */\n/* 1 */ {4,    4,  8,    4, deflate_fast}, /* max speed, no lazy matches */\n/* 2 */ {4,    5, 16,    8, deflate_fast},\n/* 3 */ {4,    6, 32,   32, deflate_fast},\n\n/* 4 */ {4,    4, 16,   16, deflate_slow},  /* lazy matches */\n/* 5 */ {8,   16, 32,   32, deflate_slow},\n/* 6 */ {8,   16, 128, 128, deflate_slow},\n/* 7 */ {8,   32, 128, 256, deflate_slow},\n/* 8 */ {32, 128, 258, 1024, deflate_slow},\n/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */\n#endif\n\n/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4\n * For deflate_fast() (levels <= 3) good is ignored and lazy has a different\n * meaning.\n */\n\n#define EQUAL 0\n/* result of memcmp for equal strings */\n\n#ifndef NO_DUMMY_DECL\nstruct static_tree_desc_s {int dummy;}; /* for buggy compilers */\n#endif\n\n/* ===========================================================================\n * Update a hash value with the given input byte\n * IN  assertion: all calls to to UPDATE_HASH are made with consecutive\n *    input characters, so that a running hash key can be computed from the\n *    previous key instead of complete recalculation each time.\n */\n#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)\n\n\n/* ===========================================================================\n * Insert string str in the dictionary and set match_head to the previous head\n * of the hash chain (the most recent string with same hash key). Return\n * the previous length of the hash chain.\n * If this file is compiled with -DFASTEST, the compression level is forced\n * to 1, and no hash chains are maintained.\n * IN  assertion: all calls to to INSERT_STRING are made with consecutive\n *    input characters and the first MIN_MATCH bytes of str are valid\n *    (except for the last MIN_MATCH-1 bytes of the input file).\n */\n#ifdef FASTEST\n#define INSERT_STRING(s, str, match_head) \\\n   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \\\n    match_head = s->head[s->ins_h], \\\n    s->head[s->ins_h] = (Pos)(str))\n#else\n#define INSERT_STRING(s, str, match_head) \\\n   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \\\n    match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \\\n    s->head[s->ins_h] = (Pos)(str))\n#endif\n\n/* ===========================================================================\n * Initialize the hash table (avoiding 64K overflow for 16 bit systems).\n * prev[] will be initialized on the fly.\n */\n#define CLEAR_HASH(s) \\\n    s->head[s->hash_size-1] = NIL; \\\n    zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));\n\n/* ========================================================================= */\nint ZEXPORT deflateInit_(strm, level, version, stream_size)\n    z_streamp strm;\n    int level;\n    const char *version;\n    int stream_size;\n{\n    return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,\n                         Z_DEFAULT_STRATEGY, version, stream_size);\n    /* To do: ignore strm->next_in if we use it as window */\n}\n\n/* ========================================================================= */\nint ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,\n                  version, stream_size)\n    z_streamp strm;\n    int  level;\n    int  method;\n    int  windowBits;\n    int  memLevel;\n    int  strategy;\n    const char *version;\n    int stream_size;\n{\n    deflate_state *s;\n    int wrap = 1;\n    static const char my_version[] = ZLIB_VERSION;\n\n    ushf *overlay;\n    /* We overlay pending_buf and d_buf+l_buf. This works since the average\n     * output size for (length,distance) codes is <= 24 bits.\n     */\n\n    if (version == Z_NULL || version[0] != my_version[0] ||\n        stream_size != sizeof(z_stream)) {\n        return Z_VERSION_ERROR;\n    }\n    if (strm == Z_NULL) return Z_STREAM_ERROR;\n\n    strm->msg = Z_NULL;\n    if (strm->zalloc == (alloc_func)0) {\n        strm->zalloc = zcalloc;\n        strm->opaque = (voidpf)0;\n    }\n    if (strm->zfree == (free_func)0) strm->zfree = zcfree;\n\n#ifdef FASTEST\n    if (level != 0) level = 1;\n#else\n    if (level == Z_DEFAULT_COMPRESSION) level = 6;\n#endif\n\n    if (windowBits < 0) { /* suppress zlib wrapper */\n        wrap = 0;\n        windowBits = -windowBits;\n    }\n#ifdef GZIP\n    else if (windowBits > 15) {\n        wrap = 2;       /* write gzip wrapper instead */\n        windowBits -= 16;\n    }\n#endif\n    if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||\n        windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n        strategy < 0 || strategy > Z_FIXED) {\n        return Z_STREAM_ERROR;\n    }\n    if (windowBits == 8) windowBits = 9;  /* until 256-byte window bug fixed */\n    s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));\n    if (s == Z_NULL) return Z_MEM_ERROR;\n    strm->state = (struct internal_state FAR *)s;\n    s->strm = strm;\n\n    s->wrap = wrap;\n    s->gzhead = Z_NULL;\n    s->w_bits = windowBits;\n    s->w_size = 1 << s->w_bits;\n    s->w_mask = s->w_size - 1;\n\n    s->hash_bits = memLevel + 7;\n    s->hash_size = 1 << s->hash_bits;\n    s->hash_mask = s->hash_size - 1;\n    s->hash_shift =  ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);\n\n    s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));\n    s->prev   = (Posf *)  ZALLOC(strm, s->w_size, sizeof(Pos));\n    s->head   = (Posf *)  ZALLOC(strm, s->hash_size, sizeof(Pos));\n\n    s->high_water = 0;      /* nothing written to s->window yet */\n\n    s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n    overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n    s->pending_buf = (uchf *) overlay;\n    s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);\n\n    if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||\n        s->pending_buf == Z_NULL) {\n        s->status = FINISH_STATE;\n        strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);\n        deflateEnd (strm);\n        return Z_MEM_ERROR;\n    }\n    s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n    s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n\n    s->level = level;\n    s->strategy = strategy;\n    s->method = (Byte)method;\n\n    return deflateReset(strm);\n}\n\n/* ========================================================================= */\nint ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)\n    z_streamp strm;\n    const Bytef *dictionary;\n    uInt  dictLength;\n{\n    deflate_state *s;\n    uInt length = dictLength;\n    uInt n;\n    IPos hash_head = 0;\n\n    if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||\n        strm->state->wrap == 2 ||\n        (strm->state->wrap == 1 && strm->state->status != INIT_STATE))\n        return Z_STREAM_ERROR;\n\n    s = strm->state;\n    if (s->wrap)\n        strm->adler = adler32(strm->adler, dictionary, dictLength);\n\n    if (length < MIN_MATCH) return Z_OK;\n    if (length > s->w_size) {\n        length = s->w_size;\n        dictionary += dictLength - length; /* use the tail of the dictionary */\n    }\n    zmemcpy(s->window, dictionary, length);\n    s->strstart = length;\n    s->block_start = (long)length;\n\n    /* Insert all strings in the hash table (except for the last two bytes).\n     * s->lookahead stays null, so s->ins_h will be recomputed at the next\n     * call of fill_window.\n     */\n    s->ins_h = s->window[0];\n    UPDATE_HASH(s, s->ins_h, s->window[1]);\n    for (n = 0; n <= length - MIN_MATCH; n++) {\n        INSERT_STRING(s, n, hash_head);\n    }\n    if (hash_head) hash_head = 0;  /* to make compiler happy */\n    return Z_OK;\n}\n\n/* ========================================================================= */\nint ZEXPORT deflateReset (strm)\n    z_streamp strm;\n{\n    deflate_state *s;\n\n    if (strm == Z_NULL || strm->state == Z_NULL ||\n        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {\n        return Z_STREAM_ERROR;\n    }\n\n    strm->total_in = strm->total_out = 0;\n    strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */\n    strm->data_type = Z_UNKNOWN;\n\n    s = (deflate_state *)strm->state;\n    s->pending = 0;\n    s->pending_out = s->pending_buf;\n\n    if (s->wrap < 0) {\n        s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */\n    }\n    s->status = s->wrap ? INIT_STATE : BUSY_STATE;\n    strm->adler =\n#ifdef GZIP\n        s->wrap == 2 ? crc32(0L, Z_NULL, 0) :\n#endif\n        adler32(0L, Z_NULL, 0);\n    s->last_flush = Z_NO_FLUSH;\n\n    _tr_init(s);\n    lm_init(s);\n\n    return Z_OK;\n}\n\n/* ========================================================================= */\nint ZEXPORT deflateSetHeader (strm, head)\n    z_streamp strm;\n    gz_headerp head;\n{\n    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;\n    if (strm->state->wrap != 2) return Z_STREAM_ERROR;\n    strm->state->gzhead = head;\n    return Z_OK;\n}\n\n/* ========================================================================= */\nint ZEXPORT deflatePrime (strm, bits, value)\n    z_streamp strm;\n    int bits;\n    int value;\n{\n    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;\n    strm->state->bi_valid = bits;\n    strm->state->bi_buf = (ush)(value & ((1 << bits) - 1));\n    return Z_OK;\n}\n\n/* ========================================================================= */\nint ZEXPORT deflateParams(strm, level, strategy)\n    z_streamp strm;\n    int level;\n    int strategy;\n{\n    deflate_state *s;\n    compress_func func;\n    int err = Z_OK;\n\n    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;\n    s = strm->state;\n\n#ifdef FASTEST\n    if (level != 0) level = 1;\n#else\n    if (level == Z_DEFAULT_COMPRESSION) level = 6;\n#endif\n    if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {\n        return Z_STREAM_ERROR;\n    }\n    func = configuration_table[s->level].func;\n\n    if ((strategy != s->strategy || func != configuration_table[level].func) &&\n        strm->total_in != 0) {\n        /* Flush the last buffer: */\n        err = deflate(strm, Z_BLOCK);\n    }\n    if (s->level != level) {\n        s->level = level;\n        s->max_lazy_match   = configuration_table[level].max_lazy;\n        s->good_match       = configuration_table[level].good_length;\n        s->nice_match       = configuration_table[level].nice_length;\n        s->max_chain_length = configuration_table[level].max_chain;\n    }\n    s->strategy = strategy;\n    return err;\n}\n\n/* ========================================================================= */\nint ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)\n    z_streamp strm;\n    int good_length;\n    int max_lazy;\n    int nice_length;\n    int max_chain;\n{\n    deflate_state *s;\n\n    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;\n    s = strm->state;\n    s->good_match = good_length;\n    s->max_lazy_match = max_lazy;\n    s->nice_match = nice_length;\n    s->max_chain_length = max_chain;\n    return Z_OK;\n}\n\n/* =========================================================================\n * For the default windowBits of 15 and memLevel of 8, this function returns\n * a close to exact, as well as small, upper bound on the compressed size.\n * They are coded as constants here for a reason--if the #define's are\n * changed, then this function needs to be changed as well.  The return\n * value for 15 and 8 only works for those exact settings.\n *\n * For any setting other than those defaults for windowBits and memLevel,\n * the value returned is a conservative worst case for the maximum expansion\n * resulting from using fixed blocks instead of stored blocks, which deflate\n * can emit on compressed data for some combinations of the parameters.\n *\n * This function could be more sophisticated to provide closer upper bounds for\n * every combination of windowBits and memLevel.  But even the conservative\n * upper bound of about 14% expansion does not seem onerous for output buffer\n * allocation.\n */\nuLong ZEXPORT deflateBound(strm, sourceLen)\n    z_streamp strm;\n    uLong sourceLen;\n{\n    deflate_state *s;\n    uLong complen, wraplen;\n    Bytef *str;\n\n    /* conservative upper bound for compressed data */\n    complen = sourceLen +\n              ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5;\n\n    /* if can't get parameters, return conservative bound plus zlib wrapper */\n    if (strm == Z_NULL || strm->state == Z_NULL)\n        return complen + 6;\n\n    /* compute wrapper length */\n    s = strm->state;\n    switch (s->wrap) {\n    case 0:                                 /* raw deflate */\n        wraplen = 0;\n        break;\n    case 1:                                 /* zlib wrapper */\n        wraplen = 6 + (s->strstart ? 4 : 0);\n        break;\n    case 2:                                 /* gzip wrapper */\n        wraplen = 18;\n        if (s->gzhead != Z_NULL) {          /* user-supplied gzip header */\n            if (s->gzhead->extra != Z_NULL)\n                wraplen += 2 + s->gzhead->extra_len;\n            str = s->gzhead->name;\n            if (str != Z_NULL)\n                do {\n                    wraplen++;\n                } while (*str++);\n            str = s->gzhead->comment;\n            if (str != Z_NULL)\n                do {\n                    wraplen++;\n                } while (*str++);\n            if (s->gzhead->hcrc)\n                wraplen += 2;\n        }\n        break;\n    default:                                /* for compiler happiness */\n        wraplen = 6;\n    }\n\n    /* if not default parameters, return conservative bound */\n    if (s->w_bits != 15 || s->hash_bits != 8 + 7)\n        return complen + wraplen;\n\n    /* default settings: return tight bound for that case */\n    return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +\n           (sourceLen >> 25) + 13 - 6 + wraplen;\n}\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nlocal void putShortMSB (s, b)\n    deflate_state *s;\n    uInt b;\n{\n    put_byte(s, (Byte)(b >> 8));\n    put_byte(s, (Byte)(b & 0xff));\n}\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->next_out buffer and copying into it.\n * (See also read_buf()).\n */\nlocal void flush_pending(strm)\n    z_streamp strm;\n{\n    unsigned len = strm->state->pending;\n\n    if (len > strm->avail_out) len = strm->avail_out;\n    if (len == 0) return;\n\n    zmemcpy(strm->next_out, strm->state->pending_out, len);\n    strm->next_out  += len;\n    strm->state->pending_out  += len;\n    strm->total_out += len;\n    strm->avail_out  -= len;\n    strm->state->pending -= len;\n    if (strm->state->pending == 0) {\n        strm->state->pending_out = strm->state->pending_buf;\n    }\n}\n\n/* ========================================================================= */\nint ZEXPORT deflate (strm, flush)\n    z_streamp strm;\n    int flush;\n{\n    int old_flush; /* value of flush param for previous deflate call */\n    deflate_state *s;\n\n    if (strm == Z_NULL || strm->state == Z_NULL ||\n        flush > Z_BLOCK || flush < 0) {\n        return Z_STREAM_ERROR;\n    }\n    s = strm->state;\n\n    if (strm->next_out == Z_NULL ||\n        (strm->next_in == Z_NULL && strm->avail_in != 0) ||\n        (s->status == FINISH_STATE && flush != Z_FINISH)) {\n        ERR_RETURN(strm, Z_STREAM_ERROR);\n    }\n    if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);\n\n    s->strm = strm; /* just in case */\n    old_flush = s->last_flush;\n    s->last_flush = flush;\n\n    /* Write the header */\n    if (s->status == INIT_STATE) {\n#ifdef GZIP\n        if (s->wrap == 2) {\n            strm->adler = crc32(0L, Z_NULL, 0);\n            put_byte(s, 31);\n            put_byte(s, 139);\n            put_byte(s, 8);\n            if (s->gzhead == Z_NULL) {\n                put_byte(s, 0);\n                put_byte(s, 0);\n                put_byte(s, 0);\n                put_byte(s, 0);\n                put_byte(s, 0);\n                put_byte(s, s->level == 9 ? 2 :\n                            (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?\n                             4 : 0));\n                put_byte(s, OS_CODE);\n                s->status = BUSY_STATE;\n            }\n            else {\n                put_byte(s, (s->gzhead->text ? 1 : 0) +\n                            (s->gzhead->hcrc ? 2 : 0) +\n                            (s->gzhead->extra == Z_NULL ? 0 : 4) +\n                            (s->gzhead->name == Z_NULL ? 0 : 8) +\n                            (s->gzhead->comment == Z_NULL ? 0 : 16)\n                        );\n                put_byte(s, (Byte)(s->gzhead->time & 0xff));\n                put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff));\n                put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff));\n                put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff));\n                put_byte(s, s->level == 9 ? 2 :\n                            (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?\n                             4 : 0));\n                put_byte(s, s->gzhead->os & 0xff);\n                if (s->gzhead->extra != Z_NULL) {\n                    put_byte(s, s->gzhead->extra_len & 0xff);\n                    put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);\n                }\n                if (s->gzhead->hcrc)\n                    strm->adler = crc32(strm->adler, s->pending_buf,\n                                        s->pending);\n                s->gzindex = 0;\n                s->status = EXTRA_STATE;\n            }\n        }\n        else\n#endif\n        {\n            uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;\n            uInt level_flags;\n\n            if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)\n                level_flags = 0;\n            else if (s->level < 6)\n                level_flags = 1;\n            else if (s->level == 6)\n                level_flags = 2;\n            else\n                level_flags = 3;\n            header |= (level_flags << 6);\n            if (s->strstart != 0) header |= PRESET_DICT;\n            header += 31 - (header % 31);\n\n            s->status = BUSY_STATE;\n            putShortMSB(s, header);\n\n            /* Save the adler32 of the preset dictionary: */\n            if (s->strstart != 0) {\n                putShortMSB(s, (uInt)(strm->adler >> 16));\n                putShortMSB(s, (uInt)(strm->adler & 0xffff));\n            }\n            strm->adler = adler32(0L, Z_NULL, 0);\n        }\n    }\n#ifdef GZIP\n    if (s->status == EXTRA_STATE) {\n        if (s->gzhead->extra != Z_NULL) {\n            uInt beg = s->pending;  /* start of bytes to update crc */\n\n            while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {\n                if (s->pending == s->pending_buf_size) {\n                    if (s->gzhead->hcrc && s->pending > beg)\n                        strm->adler = crc32(strm->adler, s->pending_buf + beg,\n                                            s->pending - beg);\n                    flush_pending(strm);\n                    beg = s->pending;\n                    if (s->pending == s->pending_buf_size)\n                        break;\n                }\n                put_byte(s, s->gzhead->extra[s->gzindex]);\n                s->gzindex++;\n            }\n            if (s->gzhead->hcrc && s->pending > beg)\n                strm->adler = crc32(strm->adler, s->pending_buf + beg,\n                                    s->pending - beg);\n            if (s->gzindex == s->gzhead->extra_len) {\n                s->gzindex = 0;\n                s->status = NAME_STATE;\n            }\n        }\n        else\n            s->status = NAME_STATE;\n    }\n    if (s->status == NAME_STATE) {\n        if (s->gzhead->name != Z_NULL) {\n            uInt beg = s->pending;  /* start of bytes to update crc */\n            int val;\n\n            do {\n                if (s->pending == s->pending_buf_size) {\n                    if (s->gzhead->hcrc && s->pending > beg)\n                        strm->adler = crc32(strm->adler, s->pending_buf + beg,\n                                            s->pending - beg);\n                    flush_pending(strm);\n                    beg = s->pending;\n                    if (s->pending == s->pending_buf_size) {\n                        val = 1;\n                        break;\n                    }\n                }\n                val = s->gzhead->name[s->gzindex++];\n                put_byte(s, val);\n            } while (val != 0);\n            if (s->gzhead->hcrc && s->pending > beg)\n                strm->adler = crc32(strm->adler, s->pending_buf + beg,\n                                    s->pending - beg);\n            if (val == 0) {\n                s->gzindex = 0;\n                s->status = COMMENT_STATE;\n            }\n        }\n        else\n            s->status = COMMENT_STATE;\n    }\n    if (s->status == COMMENT_STATE) {\n        if (s->gzhead->comment != Z_NULL) {\n            uInt beg = s->pending;  /* start of bytes to update crc */\n            int val;\n\n            do {\n                if (s->pending == s->pending_buf_size) {\n                    if (s->gzhead->hcrc && s->pending > beg)\n                        strm->adler = crc32(strm->adler, s->pending_buf + beg,\n                                            s->pending - beg);\n                    flush_pending(strm);\n                    beg = s->pending;\n                    if (s->pending == s->pending_buf_size) {\n                        val = 1;\n                        break;\n                    }\n                }\n                val = s->gzhead->comment[s->gzindex++];\n                put_byte(s, val);\n            } while (val != 0);\n            if (s->gzhead->hcrc && s->pending > beg)\n                strm->adler = crc32(strm->adler, s->pending_buf + beg,\n                                    s->pending - beg);\n            if (val == 0)\n                s->status = HCRC_STATE;\n        }\n        else\n            s->status = HCRC_STATE;\n    }\n    if (s->status == HCRC_STATE) {\n        if (s->gzhead->hcrc) {\n            if (s->pending + 2 > s->pending_buf_size)\n                flush_pending(strm);\n            if (s->pending + 2 <= s->pending_buf_size) {\n                put_byte(s, (Byte)(strm->adler & 0xff));\n                put_byte(s, (Byte)((strm->adler >> 8) & 0xff));\n                strm->adler = crc32(0L, Z_NULL, 0);\n                s->status = BUSY_STATE;\n            }\n        }\n        else\n            s->status = BUSY_STATE;\n    }\n#endif\n\n    /* Flush as much pending output as possible */\n    if (s->pending != 0) {\n        flush_pending(strm);\n        if (strm->avail_out == 0) {\n            /* Since avail_out is 0, deflate will be called again with\n             * more output space, but possibly with both pending and\n             * avail_in equal to zero. There won't be anything to do,\n             * but this is not an error situation so make sure we\n             * return OK instead of BUF_ERROR at next call of deflate:\n             */\n            s->last_flush = -1;\n            return Z_OK;\n        }\n\n    /* Make sure there is something to do and avoid duplicate consecutive\n     * flushes. For repeated and useless calls with Z_FINISH, we keep\n     * returning Z_STREAM_END instead of Z_BUF_ERROR.\n     */\n    } else if (strm->avail_in == 0 && flush <= old_flush &&\n               flush != Z_FINISH) {\n        ERR_RETURN(strm, Z_BUF_ERROR);\n    }\n\n    /* User must not provide more input after the first FINISH: */\n    if (s->status == FINISH_STATE && strm->avail_in != 0) {\n        ERR_RETURN(strm, Z_BUF_ERROR);\n    }\n\n    /* Start a new block or continue the current one.\n     */\n    if (strm->avail_in != 0 || s->lookahead != 0 ||\n        (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {\n        block_state bstate;\n\n        bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :\n                    (s->strategy == Z_RLE ? deflate_rle(s, flush) :\n                        (*(configuration_table[s->level].func))(s, flush));\n\n        if (bstate == finish_started || bstate == finish_done) {\n            s->status = FINISH_STATE;\n        }\n        if (bstate == need_more || bstate == finish_started) {\n            if (strm->avail_out == 0) {\n                s->last_flush = -1; /* avoid BUF_ERROR next call, see above */\n            }\n            return Z_OK;\n            /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n             * of deflate should use the same flush parameter to make sure\n             * that the flush is complete. So we don't have to output an\n             * empty block here, this will be done at next call. This also\n             * ensures that for a very small output buffer, we emit at most\n             * one empty block.\n             */\n        }\n        if (bstate == block_done) {\n            if (flush == Z_PARTIAL_FLUSH) {\n                _tr_align(s);\n            } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\n                _tr_stored_block(s, (char*)0, 0L, 0);\n                /* For a full flush, this empty block will be recognized\n                 * as a special marker by inflate_sync().\n                 */\n                if (flush == Z_FULL_FLUSH) {\n                    CLEAR_HASH(s);             /* forget history */\n                    if (s->lookahead == 0) {\n                        s->strstart = 0;\n                        s->block_start = 0L;\n                    }\n                }\n            }\n            flush_pending(strm);\n            if (strm->avail_out == 0) {\n              s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n              return Z_OK;\n            }\n        }\n    }\n    Assert(strm->avail_out > 0, \"bug2\");\n\n    if (flush != Z_FINISH) return Z_OK;\n    if (s->wrap <= 0) return Z_STREAM_END;\n\n    /* Write the trailer */\n#ifdef GZIP\n    if (s->wrap == 2) {\n        put_byte(s, (Byte)(strm->adler & 0xff));\n        put_byte(s, (Byte)((strm->adler >> 8) & 0xff));\n        put_byte(s, (Byte)((strm->adler >> 16) & 0xff));\n        put_byte(s, (Byte)((strm->adler >> 24) & 0xff));\n        put_byte(s, (Byte)(strm->total_in & 0xff));\n        put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));\n        put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));\n        put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));\n    }\n    else\n#endif\n    {\n        putShortMSB(s, (uInt)(strm->adler >> 16));\n        putShortMSB(s, (uInt)(strm->adler & 0xffff));\n    }\n    flush_pending(strm);\n    /* If avail_out is zero, the application will call deflate again\n     * to flush the rest.\n     */\n    if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */\n    return s->pending != 0 ? Z_OK : Z_STREAM_END;\n}\n\n/* ========================================================================= */\nint ZEXPORT deflateEnd (strm)\n    z_streamp strm;\n{\n    int status;\n\n    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;\n\n    status = strm->state->status;\n    if (status != INIT_STATE &&\n        status != EXTRA_STATE &&\n        status != NAME_STATE &&\n        status != COMMENT_STATE &&\n        status != HCRC_STATE &&\n        status != BUSY_STATE &&\n        status != FINISH_STATE) {\n      return Z_STREAM_ERROR;\n    }\n\n    /* Deallocate in reverse order of allocations: */\n    TRY_FREE(strm, strm->state->pending_buf);\n    TRY_FREE(strm, strm->state->head);\n    TRY_FREE(strm, strm->state->prev);\n    TRY_FREE(strm, strm->state->window);\n\n    ZFREE(strm, strm->state);\n    strm->state = Z_NULL;\n\n    return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;\n}\n\n/* =========================================================================\n * Copy the source state to the destination state.\n * To simplify the source, this is not supported for 16-bit MSDOS (which\n * doesn't have enough memory anyway to duplicate compression states).\n */\nint ZEXPORT deflateCopy (dest, source)\n    z_streamp dest;\n    z_streamp source;\n{\n#ifdef MAXSEG_64K\n    return Z_STREAM_ERROR;\n#else\n    deflate_state *ds;\n    deflate_state *ss;\n    ushf *overlay;\n\n\n    if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {\n        return Z_STREAM_ERROR;\n    }\n\n    ss = source->state;\n\n    zmemcpy(dest, source, sizeof(z_stream));\n\n    ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));\n    if (ds == Z_NULL) return Z_MEM_ERROR;\n    dest->state = (struct internal_state FAR *) ds;\n    zmemcpy(ds, ss, sizeof(deflate_state));\n    ds->strm = dest;\n\n    ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));\n    ds->prev   = (Posf *)  ZALLOC(dest, ds->w_size, sizeof(Pos));\n    ds->head   = (Posf *)  ZALLOC(dest, ds->hash_size, sizeof(Pos));\n    overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);\n    ds->pending_buf = (uchf *) overlay;\n\n    if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||\n        ds->pending_buf == Z_NULL) {\n        deflateEnd (dest);\n        return Z_MEM_ERROR;\n    }\n    /* following zmemcpy do not work for 16-bit MSDOS */\n    zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));\n    zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos));\n    zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos));\n    zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);\n\n    ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);\n    ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);\n    ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;\n\n    ds->l_desc.dyn_tree = ds->dyn_ltree;\n    ds->d_desc.dyn_tree = ds->dyn_dtree;\n    ds->bl_desc.dyn_tree = ds->bl_tree;\n\n    return Z_OK;\n#endif /* MAXSEG_64K */\n}\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read.  All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->next_in buffer and copying from it.\n * (See also flush_pending()).\n */\nlocal int read_buf(strm, buf, size)\n    z_streamp strm;\n    Bytef *buf;\n    unsigned size;\n{\n    unsigned len = strm->avail_in;\n\n    if (len > size) len = size;\n    if (len == 0) return 0;\n\n    strm->avail_in  -= len;\n\n    if (strm->state->wrap == 1) {\n        strm->adler = adler32(strm->adler, strm->next_in, len);\n    }\n#ifdef GZIP\n    else if (strm->state->wrap == 2) {\n        strm->adler = crc32(strm->adler, strm->next_in, len);\n    }\n#endif\n    zmemcpy(buf, strm->next_in, len);\n    strm->next_in  += len;\n    strm->total_in += len;\n\n    return (int)len;\n}\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nlocal void lm_init (s)\n    deflate_state *s;\n{\n    s->window_size = (ulg)2L*s->w_size;\n\n    CLEAR_HASH(s);\n\n    /* Set the default configuration parameters:\n     */\n    s->max_lazy_match   = configuration_table[s->level].max_lazy;\n    s->good_match       = configuration_table[s->level].good_length;\n    s->nice_match       = configuration_table[s->level].nice_length;\n    s->max_chain_length = configuration_table[s->level].max_chain;\n\n    s->strstart = 0;\n    s->block_start = 0L;\n    s->lookahead = 0;\n    s->match_length = s->prev_length = MIN_MATCH-1;\n    s->match_available = 0;\n    s->ins_h = 0;\n#ifndef FASTEST\n#ifdef ASMV\n    match_init(); /* initialize the asm code */\n#endif\n#endif\n}\n\n#ifndef FASTEST\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n *   string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\n#ifndef ASMV\n/* For 80x86 and 680x0, an optimized version will be provided in match.asm or\n * match.S. The code will be functionally equivalent.\n */\nlocal uInt longest_match(s, cur_match)\n    deflate_state *s;\n    IPos cur_match;                             /* current match */\n{\n    unsigned chain_length = s->max_chain_length;/* max hash chain length */\n    register Bytef *scan = s->window + s->strstart; /* current string */\n    register Bytef *match;                       /* matched string */\n    register int len;                           /* length of current match */\n    int best_len = s->prev_length;              /* best match length so far */\n    int nice_match = s->nice_match;             /* stop if match long enough */\n    IPos limit = s->strstart > (IPos)MAX_DIST(s) ?\n        s->strstart - (IPos)MAX_DIST(s) : NIL;\n    /* Stop when cur_match becomes <= limit. To simplify the code,\n     * we prevent matches with the string of window index 0.\n     */\n    Posf *prev = s->prev;\n    uInt wmask = s->w_mask;\n\n#ifdef UNALIGNED_OK\n    /* Compare two bytes at a time. Note: this is not always beneficial.\n     * Try with and without -DUNALIGNED_OK to check.\n     */\n    register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;\n    register ush scan_start = *(ushf*)scan;\n    register ush scan_end   = *(ushf*)(scan+best_len-1);\n#else\n    register Bytef *strend = s->window + s->strstart + MAX_MATCH;\n    register Byte scan_end1  = scan[best_len-1];\n    register Byte scan_end   = scan[best_len];\n#endif\n\n    /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n     * It is easy to get rid of this optimization if necessary.\n     */\n    Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n    /* Do not waste too much time if we already have a good match: */\n    if (s->prev_length >= s->good_match) {\n        chain_length >>= 2;\n    }\n    /* Do not look for matches beyond the end of the input. This is necessary\n     * to make deflate deterministic.\n     */\n    if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;\n\n    Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n    do {\n        Assert(cur_match < s->strstart, \"no future\");\n        match = s->window + cur_match;\n\n        /* Skip to next match if the match length cannot increase\n         * or if the match length is less than 2.  Note that the checks below\n         * for insufficient lookahead only occur occasionally for performance\n         * reasons.  Therefore uninitialized memory will be accessed, and\n         * conditional jumps will be made that depend on those values.\n         * However the length of the match is limited to the lookahead, so\n         * the output of deflate is not affected by the uninitialized values.\n         */\n#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)\n        /* This code assumes sizeof(unsigned short) == 2. Do not use\n         * UNALIGNED_OK if your compiler uses a different size.\n         */\n        if (*(ushf*)(match+best_len-1) != scan_end ||\n            *(ushf*)match != scan_start) continue;\n\n        /* It is not necessary to compare scan[2] and match[2] since they are\n         * always equal when the other bytes match, given that the hash keys\n         * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at\n         * strstart+3, +5, ... up to strstart+257. We check for insufficient\n         * lookahead only every 4th comparison; the 128th check will be made\n         * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is\n         * necessary to put more guard bytes at the end of the window, or\n         * to check more often for insufficient lookahead.\n         */\n        Assert(scan[2] == match[2], \"scan[2]?\");\n        scan++, match++;\n        do {\n        } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&\n                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&\n                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&\n                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&\n                 scan < strend);\n        /* The funny \"do {}\" generates better code on most compilers */\n\n        /* Here, scan <= window+strstart+257 */\n        Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n        if (*scan == *match) scan++;\n\n        len = (MAX_MATCH - 1) - (int)(strend-scan);\n        scan = strend - (MAX_MATCH-1);\n\n#else /* UNALIGNED_OK */\n\n        if (match[best_len]   != scan_end  ||\n            match[best_len-1] != scan_end1 ||\n            *match            != *scan     ||\n            *++match          != scan[1])      continue;\n\n        /* The check at best_len-1 can be removed because it will be made\n         * again later. (This heuristic is not always a win.)\n         * It is not necessary to compare scan[2] and match[2] since they\n         * are always equal when the other bytes match, given that\n         * the hash keys are equal and that HASH_BITS >= 8.\n         */\n        scan += 2, match++;\n        Assert(*scan == *match, \"match[2]?\");\n\n        /* We check for insufficient lookahead only every 8th comparison;\n         * the 256th check will be made at strstart+258.\n         */\n        do {\n        } while (*++scan == *++match && *++scan == *++match &&\n                 *++scan == *++match && *++scan == *++match &&\n                 *++scan == *++match && *++scan == *++match &&\n                 *++scan == *++match && *++scan == *++match &&\n                 scan < strend);\n\n        Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n        len = MAX_MATCH - (int)(strend - scan);\n        scan = strend - MAX_MATCH;\n\n#endif /* UNALIGNED_OK */\n\n        if (len > best_len) {\n            s->match_start = cur_match;\n            best_len = len;\n            if (len >= nice_match) break;\n#ifdef UNALIGNED_OK\n            scan_end = *(ushf*)(scan+best_len-1);\n#else\n            scan_end1  = scan[best_len-1];\n            scan_end   = scan[best_len];\n#endif\n        }\n    } while ((cur_match = prev[cur_match & wmask]) > limit\n             && --chain_length != 0);\n\n    if ((uInt)best_len <= s->lookahead) return (uInt)best_len;\n    return s->lookahead;\n}\n#endif /* ASMV */\n\n#else /* FASTEST */\n\n/* ---------------------------------------------------------------------------\n * Optimized version for FASTEST only\n */\nlocal uInt longest_match(s, cur_match)\n    deflate_state *s;\n    IPos cur_match;                             /* current match */\n{\n    register Bytef *scan = s->window + s->strstart; /* current string */\n    register Bytef *match;                       /* matched string */\n    register int len;                           /* length of current match */\n    register Bytef *strend = s->window + s->strstart + MAX_MATCH;\n\n    /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n     * It is easy to get rid of this optimization if necessary.\n     */\n    Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n    Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n    Assert(cur_match < s->strstart, \"no future\");\n\n    match = s->window + cur_match;\n\n    /* Return failure if the match length is less than 2:\n     */\n    if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;\n\n    /* The check at best_len-1 can be removed because it will be made\n     * again later. (This heuristic is not always a win.)\n     * It is not necessary to compare scan[2] and match[2] since they\n     * are always equal when the other bytes match, given that\n     * the hash keys are equal and that HASH_BITS >= 8.\n     */\n    scan += 2, match += 2;\n    Assert(*scan == *match, \"match[2]?\");\n\n    /* We check for insufficient lookahead only every 8th comparison;\n     * the 256th check will be made at strstart+258.\n     */\n    do {\n    } while (*++scan == *++match && *++scan == *++match &&\n             *++scan == *++match && *++scan == *++match &&\n             *++scan == *++match && *++scan == *++match &&\n             *++scan == *++match && *++scan == *++match &&\n             scan < strend);\n\n    Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n    len = MAX_MATCH - (int)(strend - scan);\n\n    if (len < MIN_MATCH) return MIN_MATCH - 1;\n\n    s->match_start = cur_match;\n    return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;\n}\n\n#endif /* FASTEST */\n\n#ifdef DEBUG\n/* ===========================================================================\n * Check that the match at match_start is indeed a match.\n */\nlocal void check_match(s, start, match, length)\n    deflate_state *s;\n    IPos start, match;\n    int length;\n{\n    /* check that the match is indeed a match */\n    if (zmemcmp(s->window + match,\n                s->window + start, length) != EQUAL) {\n        fprintf(stderr, \" start %u, match %u, length %d\\n\",\n                start, match, length);\n        do {\n            fprintf(stderr, \"%c%c\", s->window[match++], s->window[start++]);\n        } while (--length != 0);\n        z_error(\"invalid match\");\n    }\n    if (z_verbose > 1) {\n        fprintf(stderr,\"\\\\[%d,%d]\", start-match, length);\n        do { putc(s->window[start++], stderr); } while (--length != 0);\n    }\n}\n#else\n#  define check_match(s, start, match, length)\n#endif /* DEBUG */\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n *    At least one byte has been read, or avail_in == 0; reads are\n *    performed for at least two bytes (required for the zip translate_eol\n *    option -- not supported here).\n */\nlocal void fill_window(s)\n    deflate_state *s;\n{\n    register unsigned n, m;\n    register Posf *p;\n    unsigned more;    /* Amount of free space at the end of the window. */\n    uInt wsize = s->w_size;\n\n    do {\n        more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);\n\n        /* Deal with !@#$% 64K limit: */\n        if (sizeof(int) <= 2) {\n            if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n                more = wsize;\n\n            } else if (more == (unsigned)(-1)) {\n                /* Very unlikely, but possible on 16 bit machine if\n                 * strstart == 0 && lookahead == 1 (input done a byte at time)\n                 */\n                more--;\n            }\n        }\n\n        /* If the window is almost full and there is insufficient lookahead,\n         * move the upper half to the lower one to make room in the upper half.\n         */\n        if (s->strstart >= wsize+MAX_DIST(s)) {\n\n            zmemcpy(s->window, s->window+wsize, (unsigned)wsize);\n            s->match_start -= wsize;\n            s->strstart    -= wsize; /* we now have strstart >= MAX_DIST */\n            s->block_start -= (long) wsize;\n\n            /* Slide the hash table (could be avoided with 32 bit values\n               at the expense of memory usage). We slide even when level == 0\n               to keep the hash table consistent if we switch back to level > 0\n               later. (Using level 0 permanently is not an optimal usage of\n               zlib, so we don't care about this pathological case.)\n             */\n            n = s->hash_size;\n            p = &s->head[n];\n            do {\n                m = *--p;\n                *p = (Pos)(m >= wsize ? m-wsize : NIL);\n            } while (--n);\n\n            n = wsize;\n#ifndef FASTEST\n            p = &s->prev[n];\n            do {\n                m = *--p;\n                *p = (Pos)(m >= wsize ? m-wsize : NIL);\n                /* If n is not on any hash chain, prev[n] is garbage but\n                 * its value will never be used.\n                 */\n            } while (--n);\n#endif\n            more += wsize;\n        }\n        if (s->strm->avail_in == 0) return;\n\n        /* If there was no sliding:\n         *    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n         *    more == window_size - lookahead - strstart\n         * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n         * => more >= window_size - 2*WSIZE + 2\n         * In the BIG_MEM or MMAP case (not yet supported),\n         *   window_size == input_size + MIN_LOOKAHEAD  &&\n         *   strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n         * Otherwise, window_size == 2*WSIZE so more >= 2.\n         * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n         */\n        Assert(more >= 2, \"more < 2\");\n\n        n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);\n        s->lookahead += n;\n\n        /* Initialize the hash value now that we have some input: */\n        if (s->lookahead >= MIN_MATCH) {\n            s->ins_h = s->window[s->strstart];\n            UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);\n#if MIN_MATCH != 3\n            Call UPDATE_HASH() MIN_MATCH-3 more times\n#endif\n        }\n        /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n         * but this is not important since only literal bytes will be emitted.\n         */\n\n    } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);\n\n    /* If the WIN_INIT bytes after the end of the current data have never been\n     * written, then zero those bytes in order to avoid memory check reports of\n     * the use of uninitialized (or uninitialised as Julian writes) bytes by\n     * the longest match routines.  Update the high water mark for the next\n     * time through here.  WIN_INIT is set to MAX_MATCH since the longest match\n     * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n     */\n    if (s->high_water < s->window_size) {\n        ulg curr = s->strstart + (ulg)(s->lookahead);\n        ulg init;\n\n        if (s->high_water < curr) {\n            /* Previous high water mark below current data -- zero WIN_INIT\n             * bytes or up to end of window, whichever is less.\n             */\n            init = s->window_size - curr;\n            if (init > WIN_INIT)\n                init = WIN_INIT;\n            zmemzero(s->window + curr, (unsigned)init);\n            s->high_water = curr + init;\n        }\n        else if (s->high_water < (ulg)curr + WIN_INIT) {\n            /* High water mark at or above current data, but below current data\n             * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n             * to end of window, whichever is less.\n             */\n            init = (ulg)curr + WIN_INIT - s->high_water;\n            if (init > s->window_size - s->high_water)\n                init = s->window_size - s->high_water;\n            zmemzero(s->window + s->high_water, (unsigned)init);\n            s->high_water += init;\n        }\n    }\n}\n\n/* ===========================================================================\n * Flush the current block, with given end-of-file flag.\n * IN assertion: strstart is set to the end of the current match.\n */\n#define FLUSH_BLOCK_ONLY(s, last) { \\\n   _tr_flush_block(s, (s->block_start >= 0L ? \\\n                   (charf *)&s->window[(unsigned)s->block_start] : \\\n                   (charf *)Z_NULL), \\\n                (ulg)((long)s->strstart - s->block_start), \\\n                (last)); \\\n   s->block_start = s->strstart; \\\n   flush_pending(s->strm); \\\n   Tracev((stderr,\"[FLUSH]\")); \\\n}\n\n/* Same but force premature exit if necessary. */\n#define FLUSH_BLOCK(s, last) { \\\n   FLUSH_BLOCK_ONLY(s, last); \\\n   if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \\\n}\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nlocal block_state deflate_stored(s, flush)\n    deflate_state *s;\n    int flush;\n{\n    /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n     * to pending_buf_size, and each stored block has a 5 byte header:\n     */\n    ulg max_block_size = 0xffff;\n    ulg max_start;\n\n    if (max_block_size > s->pending_buf_size - 5) {\n        max_block_size = s->pending_buf_size - 5;\n    }\n\n    /* Copy as much as possible from input to output: */\n    for (;;) {\n        /* Fill the window as much as possible: */\n        if (s->lookahead <= 1) {\n\n            Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n                   s->block_start >= (long)s->w_size, \"slide too late\");\n\n            fill_window(s);\n            if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;\n\n            if (s->lookahead == 0) break; /* flush the current block */\n        }\n        Assert(s->block_start >= 0L, \"block gone\");\n\n        s->strstart += s->lookahead;\n        s->lookahead = 0;\n\n        /* Emit a stored block if pending_buf will be full: */\n        max_start = s->block_start + max_block_size;\n        if (s->strstart == 0 || (ulg)s->strstart >= max_start) {\n            /* strstart == 0 is possible when wraparound on 16-bit machine */\n            s->lookahead = (uInt)(s->strstart - max_start);\n            s->strstart = (uInt)max_start;\n            FLUSH_BLOCK(s, 0);\n        }\n        /* Flush if we may have to slide, otherwise block_start may become\n         * negative and the data will be gone:\n         */\n        if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {\n            FLUSH_BLOCK(s, 0);\n        }\n    }\n    FLUSH_BLOCK(s, flush == Z_FINISH);\n    return flush == Z_FINISH ? finish_done : block_done;\n}\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nlocal block_state deflate_fast(s, flush)\n    deflate_state *s;\n    int flush;\n{\n    IPos hash_head;       /* head of the hash chain */\n    int bflush;           /* set if current block must be flushed */\n\n    for (;;) {\n        /* Make sure that we always have enough lookahead, except\n         * at the end of the input file. We need MAX_MATCH bytes\n         * for the next match, plus MIN_MATCH bytes to insert the\n         * string following the next match.\n         */\n        if (s->lookahead < MIN_LOOKAHEAD) {\n            fill_window(s);\n            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {\n                return need_more;\n            }\n            if (s->lookahead == 0) break; /* flush the current block */\n        }\n\n        /* Insert the string window[strstart .. strstart+2] in the\n         * dictionary, and set hash_head to the head of the hash chain:\n         */\n        hash_head = NIL;\n        if (s->lookahead >= MIN_MATCH) {\n            INSERT_STRING(s, s->strstart, hash_head);\n        }\n\n        /* Find the longest match, discarding those <= prev_length.\n         * At this point we have always match_length < MIN_MATCH\n         */\n        if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {\n            /* To simplify the code, we prevent matches with the string\n             * of window index 0 (in particular we have to avoid a match\n             * of the string with itself at the start of the input file).\n             */\n            s->match_length = longest_match (s, hash_head);\n            /* longest_match() sets match_start */\n        }\n        if (s->match_length >= MIN_MATCH) {\n            check_match(s, s->strstart, s->match_start, s->match_length);\n\n            _tr_tally_dist(s, s->strstart - s->match_start,\n                           s->match_length - MIN_MATCH, bflush);\n\n            s->lookahead -= s->match_length;\n\n            /* Insert new strings in the hash table only if the match length\n             * is not too large. This saves time but degrades compression.\n             */\n#ifndef FASTEST\n            if (s->match_length <= s->max_insert_length &&\n                s->lookahead >= MIN_MATCH) {\n                s->match_length--; /* string at strstart already in table */\n                do {\n                    s->strstart++;\n                    INSERT_STRING(s, s->strstart, hash_head);\n                    /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n                     * always MIN_MATCH bytes ahead.\n                     */\n                } while (--s->match_length != 0);\n                s->strstart++;\n            } else\n#endif\n            {\n                s->strstart += s->match_length;\n                s->match_length = 0;\n                s->ins_h = s->window[s->strstart];\n                UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);\n#if MIN_MATCH != 3\n                Call UPDATE_HASH() MIN_MATCH-3 more times\n#endif\n                /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n                 * matter since it will be recomputed at next deflate call.\n                 */\n            }\n        } else {\n            /* No match, output a literal byte */\n            Tracevv((stderr,\"%c\", s->window[s->strstart]));\n            _tr_tally_lit (s, s->window[s->strstart], bflush);\n            s->lookahead--;\n            s->strstart++;\n        }\n        if (bflush) FLUSH_BLOCK(s, 0);\n    }\n    FLUSH_BLOCK(s, flush == Z_FINISH);\n    return flush == Z_FINISH ? finish_done : block_done;\n}\n\n#ifndef FASTEST\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nlocal block_state deflate_slow(s, flush)\n    deflate_state *s;\n    int flush;\n{\n    IPos hash_head;          /* head of hash chain */\n    int bflush;              /* set if current block must be flushed */\n\n    /* Process the input block. */\n    for (;;) {\n        /* Make sure that we always have enough lookahead, except\n         * at the end of the input file. We need MAX_MATCH bytes\n         * for the next match, plus MIN_MATCH bytes to insert the\n         * string following the next match.\n         */\n        if (s->lookahead < MIN_LOOKAHEAD) {\n            fill_window(s);\n            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {\n                return need_more;\n            }\n            if (s->lookahead == 0) break; /* flush the current block */\n        }\n\n        /* Insert the string window[strstart .. strstart+2] in the\n         * dictionary, and set hash_head to the head of the hash chain:\n         */\n        hash_head = NIL;\n        if (s->lookahead >= MIN_MATCH) {\n            INSERT_STRING(s, s->strstart, hash_head);\n        }\n\n        /* Find the longest match, discarding those <= prev_length.\n         */\n        s->prev_length = s->match_length, s->prev_match = s->match_start;\n        s->match_length = MIN_MATCH-1;\n\n        if (hash_head != NIL && s->prev_length < s->max_lazy_match &&\n            s->strstart - hash_head <= MAX_DIST(s)) {\n            /* To simplify the code, we prevent matches with the string\n             * of window index 0 (in particular we have to avoid a match\n             * of the string with itself at the start of the input file).\n             */\n            s->match_length = longest_match (s, hash_head);\n            /* longest_match() sets match_start */\n\n            if (s->match_length <= 5 && (s->strategy == Z_FILTERED\n#if TOO_FAR <= 32767\n                || (s->match_length == MIN_MATCH &&\n                    s->strstart - s->match_start > TOO_FAR)\n#endif\n                )) {\n\n                /* If prev_match is also MIN_MATCH, match_start is garbage\n                 * but we will ignore the current match anyway.\n                 */\n                s->match_length = MIN_MATCH-1;\n            }\n        }\n        /* If there was a match at the previous step and the current\n         * match is not better, output the previous match:\n         */\n        if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {\n            uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;\n            /* Do not insert strings in hash table beyond this. */\n\n            check_match(s, s->strstart-1, s->prev_match, s->prev_length);\n\n            _tr_tally_dist(s, s->strstart -1 - s->prev_match,\n                           s->prev_length - MIN_MATCH, bflush);\n\n            /* Insert in hash table all strings up to the end of the match.\n             * strstart-1 and strstart are already inserted. If there is not\n             * enough lookahead, the last two strings are not inserted in\n             * the hash table.\n             */\n            s->lookahead -= s->prev_length-1;\n            s->prev_length -= 2;\n            do {\n                if (++s->strstart <= max_insert) {\n                    INSERT_STRING(s, s->strstart, hash_head);\n                }\n            } while (--s->prev_length != 0);\n            s->match_available = 0;\n            s->match_length = MIN_MATCH-1;\n            s->strstart++;\n\n            if (bflush) FLUSH_BLOCK(s, 0);\n\n        } else if (s->match_available) {\n            /* If there was no match at the previous position, output a\n             * single literal. If there was a match but the current match\n             * is longer, truncate the previous match to a single literal.\n             */\n            Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n            _tr_tally_lit(s, s->window[s->strstart-1], bflush);\n            if (bflush) {\n                FLUSH_BLOCK_ONLY(s, 0);\n            }\n            s->strstart++;\n            s->lookahead--;\n            if (s->strm->avail_out == 0) return need_more;\n        } else {\n            /* There is no previous match to compare with, wait for\n             * the next step to decide.\n             */\n            s->match_available = 1;\n            s->strstart++;\n            s->lookahead--;\n        }\n    }\n    Assert (flush != Z_NO_FLUSH, \"no flush?\");\n    if (s->match_available) {\n        Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n        _tr_tally_lit(s, s->window[s->strstart-1], bflush);\n        s->match_available = 0;\n    }\n    FLUSH_BLOCK(s, flush == Z_FINISH);\n    return flush == Z_FINISH ? finish_done : block_done;\n}\n#endif /* FASTEST */\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one.  Do not maintain a hash table.  (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nlocal block_state deflate_rle(s, flush)\n    deflate_state *s;\n    int flush;\n{\n    int bflush;             /* set if current block must be flushed */\n    uInt prev;              /* byte at distance one to match */\n    Bytef *scan, *strend;   /* scan goes up to strend for length of run */\n\n    for (;;) {\n        /* Make sure that we always have enough lookahead, except\n         * at the end of the input file. We need MAX_MATCH bytes\n         * for the longest encodable run.\n         */\n        if (s->lookahead < MAX_MATCH) {\n            fill_window(s);\n            if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) {\n                return need_more;\n            }\n            if (s->lookahead == 0) break; /* flush the current block */\n        }\n\n        /* See how many times the previous byte repeats */\n        s->match_length = 0;\n        if (s->lookahead >= MIN_MATCH && s->strstart > 0) {\n            scan = s->window + s->strstart - 1;\n            prev = *scan;\n            if (prev == *++scan && prev == *++scan && prev == *++scan) {\n                strend = s->window + s->strstart + MAX_MATCH;\n                do {\n                } while (prev == *++scan && prev == *++scan &&\n                         prev == *++scan && prev == *++scan &&\n                         prev == *++scan && prev == *++scan &&\n                         prev == *++scan && prev == *++scan &&\n                         scan < strend);\n                s->match_length = MAX_MATCH - (int)(strend - scan);\n                if (s->match_length > s->lookahead)\n                    s->match_length = s->lookahead;\n            }\n        }\n\n        /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n        if (s->match_length >= MIN_MATCH) {\n            check_match(s, s->strstart, s->strstart - 1, s->match_length);\n\n            _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush);\n\n            s->lookahead -= s->match_length;\n            s->strstart += s->match_length;\n            s->match_length = 0;\n        } else {\n            /* No match, output a literal byte */\n            Tracevv((stderr,\"%c\", s->window[s->strstart]));\n            _tr_tally_lit (s, s->window[s->strstart], bflush);\n            s->lookahead--;\n            s->strstart++;\n        }\n        if (bflush) FLUSH_BLOCK(s, 0);\n    }\n    FLUSH_BLOCK(s, flush == Z_FINISH);\n    return flush == Z_FINISH ? finish_done : block_done;\n}\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches.  Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nlocal block_state deflate_huff(s, flush)\n    deflate_state *s;\n    int flush;\n{\n    int bflush;             /* set if current block must be flushed */\n\n    for (;;) {\n        /* Make sure that we have a literal to write. */\n        if (s->lookahead == 0) {\n            fill_window(s);\n            if (s->lookahead == 0) {\n                if (flush == Z_NO_FLUSH)\n                    return need_more;\n                break;      /* flush the current block */\n            }\n        }\n\n        /* Output a literal byte */\n        s->match_length = 0;\n        Tracevv((stderr,\"%c\", s->window[s->strstart]));\n        _tr_tally_lit (s, s->window[s->strstart], bflush);\n        s->lookahead--;\n        s->strstart++;\n        if (bflush) FLUSH_BLOCK(s, 0);\n    }\n    FLUSH_BLOCK(s, flush == Z_FINISH);\n    return flush == Z_FINISH ? finish_done : block_done;\n}\n"},{"id":16743,"name":"inftrees.c","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* inftrees.c -- generate Huffman trees for efficient decoding\n * Copyright (C) 1995-2010 Mark Adler\n * For conditions of distribution and use, see copyright notice in zlib.h\n */\n\n#include \"zutil.h\"\n#include \"inftrees.h\"\n\n#define MAXBITS 15\n\nconst char inflate_copyright[] =\n   \" inflate 1.2.5 Copyright 1995-2010 Mark Adler \";\n/*\n  If you use the zlib library in a product, an acknowledgment is welcome\n  in the documentation of your product. If for some reason you cannot\n  include such an acknowledgment, I would appreciate that you keep this\n  copyright string in the executable of your product.\n */\n\n/*\n   Build a set of tables to decode the provided canonical Huffman code.\n   The code lengths are lens[0..codes-1].  The result starts at *table,\n   whose indices are 0..2^bits-1.  work is a writable array of at least\n   lens shorts, which is used as a work area.  type is the type of code\n   to be generated, CODES, LENS, or DISTS.  On return, zero is success,\n   -1 is an invalid code, and +1 means that ENOUGH isn't enough.  table\n   on return points to the next available entry's address.  bits is the\n   requested root table index bits, and on return it is the actual root\n   table index bits.  It will differ if the request is greater than the\n   longest code or if it is less than the shortest code.\n */\nint ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work)\ncodetype type;\nunsigned short FAR *lens;\nunsigned codes;\ncode FAR * FAR *table;\nunsigned FAR *bits;\nunsigned short FAR *work;\n{\n    unsigned len;               /* a code's length in bits */\n    unsigned sym;               /* index of code symbols */\n    unsigned min, max;          /* minimum and maximum code lengths */\n    unsigned root;              /* number of index bits for root table */\n    unsigned curr;              /* number of index bits for current table */\n    unsigned drop;              /* code bits to drop for sub-table */\n    int left;                   /* number of prefix codes available */\n    unsigned used;              /* code entries in table used */\n    unsigned huff;              /* Huffman code */\n    unsigned incr;              /* for incrementing code, index */\n    unsigned fill;              /* index for replicating entries */\n    unsigned low;               /* low bits for current root entry */\n    unsigned mask;              /* mask for low root bits */\n    code here;                  /* table entry for duplication */\n    code FAR *next;             /* next available space in table */\n    const unsigned short FAR *base;     /* base value table to use */\n    const unsigned short FAR *extra;    /* extra bits table to use */\n    int end;                    /* use base and extra for symbol > end */\n    unsigned short count[MAXBITS+1];    /* number of codes of each length */\n    unsigned short offs[MAXBITS+1];     /* offsets in table for each length */\n    static const unsigned short lbase[31] = { /* Length codes 257..285 base */\n        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};\n    static const unsigned short lext[31] = { /* Length codes 257..285 extra */\n        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 195};\n    static const unsigned short dbase[32] = { /* Distance codes 0..29 base */\n        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n        8193, 12289, 16385, 24577, 0, 0};\n    static const unsigned short dext[32] = { /* Distance codes 0..29 extra */\n        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n        28, 28, 29, 29, 64, 64};\n\n    /*\n       Process a set of code lengths to create a canonical Huffman code.  The\n       code lengths are lens[0..codes-1].  Each length corresponds to the\n       symbols 0..codes-1.  The Huffman code is generated by first sorting the\n       symbols by length from short to long, and retaining the symbol order\n       for codes with equal lengths.  Then the code starts with all zero bits\n       for the first code of the shortest length, and the codes are integer\n       increments for the same length, and zeros are appended as the length\n       increases.  For the deflate format, these bits are stored backwards\n       from their more natural integer increment ordering, and so when the\n       decoding tables are built in the large loop below, the integer codes\n       are incremented backwards.\n\n       This routine assumes, but does not check, that all of the entries in\n       lens[] are in the range 0..MAXBITS.  The caller must assure this.\n       1..MAXBITS is interpreted as that code length.  zero means that that\n       symbol does not occur in this code.\n\n       The codes are sorted by computing a count of codes for each length,\n       creating from that a table of starting indices for each length in the\n       sorted table, and then entering the symbols in order in the sorted\n       table.  The sorted table is work[], with that space being provided by\n       the caller.\n\n       The length counts are used for other purposes as well, i.e. finding\n       the minimum and maximum length codes, determining if there are any\n       codes at all, checking for a valid set of lengths, and looking ahead\n       at length counts to determine sub-table sizes when building the\n       decoding tables.\n     */\n\n    /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n    for (len = 0; len <= MAXBITS; len++)\n        count[len] = 0;\n    for (sym = 0; sym < codes; sym++)\n        count[lens[sym]]++;\n\n    /* bound code lengths, force root to be within code lengths */\n    root = *bits;\n    for (max = MAXBITS; max >= 1; max--)\n        if (count[max] != 0) break;\n    if (root > max) root = max;\n    if (max == 0) {                     /* no symbols to code at all */\n        here.op = (unsigned char)64;    /* invalid code marker */\n        here.bits = (unsigned char)1;\n        here.val = (unsigned short)0;\n        *(*table)++ = here;             /* make a table to force an error */\n        *(*table)++ = here;\n        *bits = 1;\n        return 0;     /* no symbols, but wait for decoding to report error */\n    }\n    for (min = 1; min < max; min++)\n        if (count[min] != 0) break;\n    if (root < min) root = min;\n\n    /* check for an over-subscribed or incomplete set of lengths */\n    left = 1;\n    for (len = 1; len <= MAXBITS; len++) {\n        left <<= 1;\n        left -= count[len];\n        if (left < 0) return -1;        /* over-subscribed */\n    }\n    if (left > 0 && (type == CODES || max != 1))\n        return -1;                      /* incomplete set */\n\n    /* generate offsets into symbol table for each length for sorting */\n    offs[1] = 0;\n    for (len = 1; len < MAXBITS; len++)\n        offs[len + 1] = offs[len] + count[len];\n\n    /* sort symbols by length, by symbol order within each length */\n    for (sym = 0; sym < codes; sym++)\n        if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;\n\n    /*\n       Create and fill in decoding tables.  In this loop, the table being\n       filled is at next and has curr index bits.  The code being used is huff\n       with length len.  That code is converted to an index by dropping drop\n       bits off of the bottom.  For codes where len is less than drop + curr,\n       those top drop + curr - len bits are incremented through all values to\n       fill the table with replicated entries.\n\n       root is the number of index bits for the root table.  When len exceeds\n       root, sub-tables are created pointed to by the root entry with an index\n       of the low root bits of huff.  This is saved in low to check for when a\n       new sub-table should be started.  drop is zero when the root table is\n       being filled, and drop is root when sub-tables are being filled.\n\n       When a new sub-table is needed, it is necessary to look ahead in the\n       code lengths to determine what size sub-table is needed.  The length\n       counts are used for this, and so count[] is decremented as codes are\n       entered in the tables.\n\n       used keeps track of how many table entries have been allocated from the\n       provided *table space.  It is checked for LENS and DIST tables against\n       the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n       the initial root table size constants.  See the comments in inftrees.h\n       for more information.\n\n       sym increments through all symbols, and the loop terminates when\n       all codes of length max, i.e. all codes, have been processed.  This\n       routine permits incomplete codes, so another loop after this one fills\n       in the rest of the decoding tables with invalid code markers.\n     */\n\n    /* set up for code type */\n    switch (type) {\n    case CODES:\n        base = extra = work;    /* dummy value--not used */\n        end = 19;\n        break;\n    case LENS:\n        base = lbase;\n        base -= 257;\n        extra = lext;\n        extra -= 257;\n        end = 256;\n        break;\n    default:            /* DISTS */\n        base = dbase;\n        extra = dext;\n        end = -1;\n    }\n\n    /* initialize state for loop */\n    huff = 0;                   /* starting code */\n    sym = 0;                    /* starting code symbol */\n    len = min;                  /* starting code length */\n    next = *table;              /* current table to fill in */\n    curr = root;                /* current table index bits */\n    drop = 0;                   /* current bits to drop from code for index */\n    low = (unsigned)(-1);       /* trigger new sub-table when len > root */\n    used = 1U << root;          /* use root table entries */\n    mask = used - 1;            /* mask for comparing low */\n\n    /* check available table space */\n    if ((type == LENS && used >= ENOUGH_LENS) ||\n        (type == DISTS && used >= ENOUGH_DISTS))\n        return 1;\n\n    /* process all codes and make table entries */\n    for (;;) {\n        /* create table entry */\n        here.bits = (unsigned char)(len - drop);\n        if ((int)(work[sym]) < end) {\n            here.op = (unsigned char)0;\n            here.val = work[sym];\n        }\n        else if ((int)(work[sym]) > end) {\n            here.op = (unsigned char)(extra[work[sym]]);\n            here.val = base[work[sym]];\n        }\n        else {\n            here.op = (unsigned char)(32 + 64);         /* end of block */\n            here.val = 0;\n        }\n\n        /* replicate for those indices with low len bits equal to huff */\n        incr = 1U << (len - drop);\n        fill = 1U << curr;\n        min = fill;                 /* save offset to next table */\n        do {\n            fill -= incr;\n            next[(huff >> drop) + fill] = here;\n        } while (fill != 0);\n\n        /* backwards increment the len-bit code huff */\n        incr = 1U << (len - 1);\n        while (huff & incr)\n            incr >>= 1;\n        if (incr != 0) {\n            huff &= incr - 1;\n            huff += incr;\n        }\n        else\n            huff = 0;\n\n        /* go to next symbol, update count, len */\n        sym++;\n        if (--(count[len]) == 0) {\n            if (len == max) break;\n            len = lens[work[sym]];\n        }\n\n        /* create new sub-table if needed */\n        if (len > root && (huff & mask) != low) {\n            /* if first time, transition to sub-tables */\n            if (drop == 0)\n                drop = root;\n\n            /* increment past last table */\n            next += min;            /* here min is 1 << curr */\n\n            /* determine length of next table */\n            curr = len - drop;\n            left = (int)(1 << curr);\n            while (curr + drop < max) {\n                left -= count[curr + drop];\n                if (left <= 0) break;\n                curr++;\n                left <<= 1;\n            }\n\n            /* check for enough space */\n            used += 1U << curr;\n            if ((type == LENS && used >= ENOUGH_LENS) ||\n                (type == DISTS && used >= ENOUGH_DISTS))\n                return 1;\n\n            /* point entry in root table to sub-table */\n            low = huff & mask;\n            (*table)[low].op = (unsigned char)curr;\n            (*table)[low].bits = (unsigned char)root;\n            (*table)[low].val = (unsigned short)(next - *table);\n        }\n    }\n\n    /*\n       Fill in rest of table for incomplete codes.  This loop is similar to the\n       loop above in incrementing huff for table indices.  It is assumed that\n       len is equal to curr + drop, so there is no loop needed to increment\n       through high index bits.  When the current sub-table is filled, the loop\n       drops back to the root table to fill in any remaining entries there.\n     */\n    here.op = (unsigned char)64;                /* invalid code marker */\n    here.bits = (unsigned char)(len - drop);\n    here.val = (unsigned short)0;\n    while (huff != 0) {\n        /* when done with sub-table, drop back to root table */\n        if (drop != 0 && (huff & mask) != low) {\n            drop = 0;\n            len = root;\n            next = *table;\n            here.bits = (unsigned char)len;\n        }\n\n        /* put invalid code marker in table */\n        next[huff >> drop] = here;\n\n        /* backwards increment the len-bit code huff */\n        incr = 1U << (len - 1);\n        while (huff & incr)\n            incr >>= 1;\n        if (incr != 0) {\n            huff &= incr - 1;\n            huff += incr;\n        }\n        else\n            huff = 0;\n    }\n\n    /* set return parameters */\n    *table += used;\n    *bits = root;\n    return 0;\n}\n"},{"id":16744,"name":"adler32.c","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* adler32.c -- compute the Adler-32 checksum of a data stream\n * Copyright (C) 1995-2007 Mark Adler\n * For conditions of distribution and use, see copyright notice in zlib.h\n */\n\n#include \"zutil.h\"\n\n#define local static\n\nlocal uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2);\n\n#define BASE 65521UL    /* largest prime smaller than 65536 */\n#define NMAX 5552\n/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */\n\n#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}\n#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);\n#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);\n#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);\n#define DO16(buf)   DO8(buf,0); DO8(buf,8);\n\n/* use NO_DIVIDE if your processor does not do division in hardware */\n#ifdef NO_DIVIDE\n#  define MOD(a) \\\n    do { \\\n        if (a >= (BASE << 16)) a -= (BASE << 16); \\\n        if (a >= (BASE << 15)) a -= (BASE << 15); \\\n        if (a >= (BASE << 14)) a -= (BASE << 14); \\\n        if (a >= (BASE << 13)) a -= (BASE << 13); \\\n        if (a >= (BASE << 12)) a -= (BASE << 12); \\\n        if (a >= (BASE << 11)) a -= (BASE << 11); \\\n        if (a >= (BASE << 10)) a -= (BASE << 10); \\\n        if (a >= (BASE << 9)) a -= (BASE << 9); \\\n        if (a >= (BASE << 8)) a -= (BASE << 8); \\\n        if (a >= (BASE << 7)) a -= (BASE << 7); \\\n        if (a >= (BASE << 6)) a -= (BASE << 6); \\\n        if (a >= (BASE << 5)) a -= (BASE << 5); \\\n        if (a >= (BASE << 4)) a -= (BASE << 4); \\\n        if (a >= (BASE << 3)) a -= (BASE << 3); \\\n        if (a >= (BASE << 2)) a -= (BASE << 2); \\\n        if (a >= (BASE << 1)) a -= (BASE << 1); \\\n        if (a >= BASE) a -= BASE; \\\n    } while (0)\n#  define MOD4(a) \\\n    do { \\\n        if (a >= (BASE << 4)) a -= (BASE << 4); \\\n        if (a >= (BASE << 3)) a -= (BASE << 3); \\\n        if (a >= (BASE << 2)) a -= (BASE << 2); \\\n        if (a >= (BASE << 1)) a -= (BASE << 1); \\\n        if (a >= BASE) a -= BASE; \\\n    } while (0)\n#else\n#  define MOD(a) a %= BASE\n#  define MOD4(a) a %= BASE\n#endif\n\n/* ========================================================================= */\nuLong ZEXPORT adler32(adler, buf, len)\n    uLong adler;\n    const Bytef *buf;\n    uInt len;\n{\n    unsigned long sum2;\n    unsigned n;\n\n    /* split Adler-32 into component sums */\n    sum2 = (adler >> 16) & 0xffff;\n    adler &= 0xffff;\n\n    /* in case user likes doing a byte at a time, keep it fast */\n    if (len == 1) {\n        adler += buf[0];\n        if (adler >= BASE)\n            adler -= BASE;\n        sum2 += adler;\n        if (sum2 >= BASE)\n            sum2 -= BASE;\n        return adler | (sum2 << 16);\n    }\n\n    /* initial Adler-32 value (deferred check for len == 1 speed) */\n    if (buf == Z_NULL)\n        return 1L;\n\n    /* in case short lengths are provided, keep it somewhat fast */\n    if (len < 16) {\n        while (len--) {\n            adler += *buf++;\n            sum2 += adler;\n        }\n        if (adler >= BASE)\n            adler -= BASE;\n        MOD4(sum2);             /* only added so many BASE's */\n        return adler | (sum2 << 16);\n    }\n\n    /* do length NMAX blocks -- requires just one modulo operation */\n    while (len >= NMAX) {\n        len -= NMAX;\n        n = NMAX / 16;          /* NMAX is divisible by 16 */\n        do {\n            DO16(buf);          /* 16 sums unrolled */\n            buf += 16;\n        } while (--n);\n        MOD(adler);\n        MOD(sum2);\n    }\n\n    /* do remaining bytes (less than NMAX, still just one modulo) */\n    if (len) {                  /* avoid modulos if none remaining */\n        while (len >= 16) {\n            len -= 16;\n            DO16(buf);\n            buf += 16;\n        }\n        while (len--) {\n            adler += *buf++;\n            sum2 += adler;\n        }\n        MOD(adler);\n        MOD(sum2);\n    }\n\n    /* return recombined sums */\n    return adler | (sum2 << 16);\n}\n\n/* ========================================================================= */\nlocal uLong adler32_combine_(adler1, adler2, len2)\n    uLong adler1;\n    uLong adler2;\n    z_off64_t len2;\n{\n    unsigned long sum1;\n    unsigned long sum2;\n    unsigned rem;\n\n    /* the derivation of this formula is left as an exercise for the reader */\n    rem = (unsigned)(len2 % BASE);\n    sum1 = adler1 & 0xffff;\n    sum2 = rem * sum1;\n    MOD(sum2);\n    sum1 += (adler2 & 0xffff) + BASE - 1;\n    sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;\n    if (sum1 >= BASE) sum1 -= BASE;\n    if (sum1 >= BASE) sum1 -= BASE;\n    if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1);\n    if (sum2 >= BASE) sum2 -= BASE;\n    return sum1 | (sum2 << 16);\n}\n\n/* ========================================================================= */\nuLong ZEXPORT adler32_combine(adler1, adler2, len2)\n    uLong adler1;\n    uLong adler2;\n    z_off_t len2;\n{\n    return adler32_combine_(adler1, adler2, len2);\n}\n\nuLong ZEXPORT adler32_combine64(adler1, adler2, len2)\n    uLong adler1;\n    uLong adler2;\n    z_off64_t len2;\n{\n    return adler32_combine_(adler1, adler2, len2);\n}\n"},{"id":16745,"name":"examples/io","nodeType":"Package"},{"fileName":"create-mef.py","filePath":"examples/io","id":16746,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n\"\"\"\n=====================================================\nCreate a multi-extension FITS (MEF) file from scratch\n=====================================================\n\nThis example demonstrates how to create a multi-extension FITS (MEF)\nfile from scratch using `astropy.io.fits`.\n\n\n*By: Erik Bray*\n\n*License: BSD*\n\n\n\"\"\"\n\nimport os\n\n##############################################################################\n# HDUList objects are used to hold all the HDUs in a FITS file. This\n# ``HDUList`` class is a subclass of Python's builtin `list`. and can be\n# created from scratch. For example, to create a FITS file with\n# three extensions:\n\nfrom astropy.io import fits\nnew_hdul = fits.HDUList()\nnew_hdul.append(fits.ImageHDU())\nnew_hdul.append(fits.ImageHDU())\n\n##############################################################################\n# Write out the new file to disk:\n\nnew_hdul.writeto('test.fits')\n\n##############################################################################\n# Alternatively, the HDU instances can be created first (or read from an\n# existing FITS file).\n#\n# Create a multi-extension FITS file with two empty IMAGE extensions (a\n# default PRIMARY HDU is prepended automatically if one is not specified;\n# we use ``overwrite=True`` to overwrite the file if it already exists):\n\nhdu1 = fits.PrimaryHDU()\nhdu2 = fits.ImageHDU()\nnew_hdul = fits.HDUList([hdu1, hdu2])\nnew_hdul.writeto('test.fits', overwrite=True)\n\n##############################################################################\n# Finally, we'll remove the file we created:\n\nos.remove('test.fits')\n"},{"fileName":"split-jpeg-to-fits.py","filePath":"examples/io","id":16747,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n\"\"\"\n=====================================================\nConvert a 3-color image (JPG) to separate FITS images\n=====================================================\n\nThis example opens an RGB JPEG image and writes out each channel as a separate\nFITS (image) file.\n\nThis example uses `pillow <https://python-pillow.org>`_ to read the image,\n`matplotlib.pyplot` to display the image, and `astropy.io.fits` to save FITS files.\n\n\n*By: Erik Bray, Adrian Price-Whelan*\n\n*License: BSD*\n\n\n\"\"\"\n\nimport numpy as np\nfrom PIL import Image\nfrom astropy.io import fits\n\n##############################################################################\n# Set up matplotlib and use a nicer set of plot parameters\n\nimport matplotlib.pyplot as plt\nfrom astropy.visualization import astropy_mpl_style\nplt.style.use(astropy_mpl_style)\n\n##############################################################################\n# Load and display the original 3-color jpeg image:\n\nimage = Image.open('Hs-2009-14-a-web.jpg')\nxsize, ysize = image.size\nprint(f\"Image size: {ysize} x {xsize}\")\nprint(f\"Image bands: {image.getbands()}\")\nax = plt.imshow(image)\n\n##############################################################################\n# Split the three channels (RGB) and get the data as Numpy arrays. The arrays\n# are flattened, so they are 1-dimensional:\n\nr, g, b = image.split()\nr_data = np.array(r.getdata()) # data is now an array of length ysize*xsize\ng_data = np.array(g.getdata())\nb_data = np.array(b.getdata())\nprint(r_data.shape)\n\n##############################################################################\n# Reshape the image arrays to be 2-dimensional:\n\nr_data = r_data.reshape(ysize, xsize) # data is now a matrix (ysize, xsize)\ng_data = g_data.reshape(ysize, xsize)\nb_data = b_data.reshape(ysize, xsize)\nprint(r_data.shape)\n\n##############################################################################\n# Write out the channels as separate FITS images.\n# Add and visualize header info\n\nred = fits.PrimaryHDU(data=r_data)\nred.header['LATOBS'] = \"32:11:56\" # add spurious header info\nred.header['LONGOBS'] = \"110:56\"\nred.writeto('red.fits')\n\ngreen = fits.PrimaryHDU(data=g_data)\ngreen.header['LATOBS'] = \"32:11:56\"\ngreen.header['LONGOBS'] = \"110:56\"\ngreen.writeto('green.fits')\n\nblue = fits.PrimaryHDU(data=b_data)\nblue.header['LATOBS'] = \"32:11:56\"\nblue.header['LONGOBS'] = \"110:56\"\nblue.writeto('blue.fits')\n\nfrom pprint import pprint\npprint(red.header)\n\n##############################################################################\n# Delete the files created\nimport os\nos.remove('red.fits')\nos.remove('green.fits')\nos.remove('blue.fits')\n"},{"attributeType":"HDUList","col":0,"comment":"null","endLoc":27,"id":16748,"name":"new_hdul","nodeType":"Attribute","startLoc":27,"text":"new_hdul"},{"col":4,"comment":"null","endLoc":163,"header":"def _set_cursor_prefs(self, event, **kwargs)","id":16749,"name":"_set_cursor_prefs","nodeType":"Function","startLoc":159,"text":"def _set_cursor_prefs(self, event, **kwargs):\n        if event.key == 'w':\n            self._display_coords_index += 1\n            if self._display_coords_index + 1 > len(self._all_coords):\n                self._display_coords_index = -1"},{"attributeType":"null","col":16,"comment":"null","endLoc":21,"id":16750,"name":"np","nodeType":"Attribute","startLoc":21,"text":"np"},{"col":4,"comment":"\n        Wrapper to Matplotlib's :meth:`~matplotlib.axes.Axes.imshow`.\n\n        If an RGB image is passed as a PIL object, it will be flipped\n        vertically and ``origin`` will be set to ``lower``, since WCS\n        transformations - like FITS files - assume that the origin is the lower\n        left pixel of the image (whereas RGB images have the origin in the top\n        left).\n\n        All arguments are passed to :meth:`~matplotlib.axes.Axes.imshow`.\n        ","endLoc":211,"header":"def imshow(self, X, *args, **kwargs)","id":16751,"name":"imshow","nodeType":"Function","startLoc":177,"text":"def imshow(self, X, *args, **kwargs):\n        \"\"\"\n        Wrapper to Matplotlib's :meth:`~matplotlib.axes.Axes.imshow`.\n\n        If an RGB image is passed as a PIL object, it will be flipped\n        vertically and ``origin`` will be set to ``lower``, since WCS\n        transformations - like FITS files - assume that the origin is the lower\n        left pixel of the image (whereas RGB images have the origin in the top\n        left).\n\n        All arguments are passed to :meth:`~matplotlib.axes.Axes.imshow`.\n        \"\"\"\n\n        origin = kwargs.pop('origin', 'lower')\n\n        # plt.imshow passes origin as None, which we should default to lower.\n        if origin is None:\n            origin = 'lower'\n        elif origin == 'upper':\n            raise ValueError(\"Cannot use images with origin='upper' in WCSAxes.\")\n\n        # To check whether the image is a PIL image we can check if the data\n        # has a 'getpixel' attribute - this is what Matplotlib's AxesImage does\n\n        try:\n            from PIL.Image import Image, FLIP_TOP_BOTTOM\n        except ImportError:\n            # We don't need to worry since PIL is not installed, so user cannot\n            # have passed RGB image.\n            pass\n        else:\n            if isinstance(X, Image) or hasattr(X, 'getpixel'):\n                X = X.transpose(FLIP_TOP_BOTTOM)\n\n        return super().imshow(X, *args, origin=origin, **kwargs)"},{"attributeType":"null","col":28,"comment":"null","endLoc":28,"id":16752,"name":"plt","nodeType":"Attribute","startLoc":28,"text":"plt"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":16753,"name":"image","nodeType":"Attribute","startLoc":35,"text":"image"},{"id":16754,"name":"zutil.c","nodeType":"TextFile","path":"cextern/cfitsio/zlib","text":"/* zutil.c -- target dependent utility functions for the compression library\n * Copyright (C) 1995-2005, 2010 Jean-loup Gailly.\n * For conditions of distribution and use, see copyright notice in zlib.h\n */\n\n#include \"zutil.h\"\n\n#ifndef NO_DUMMY_DECL\nstruct internal_state      {int dummy;}; /* for buggy compilers */\n#endif\n\nconst char * const z_errmsg[10] = {\n\"need dictionary\",     /* Z_NEED_DICT       2  */\n\"stream end\",          /* Z_STREAM_END      1  */\n\"\",                    /* Z_OK              0  */\n\"file error\",          /* Z_ERRNO         (-1) */\n\"stream error\",        /* Z_STREAM_ERROR  (-2) */\n\"data error\",          /* Z_DATA_ERROR    (-3) */\n\"insufficient memory\", /* Z_MEM_ERROR     (-4) */\n\"buffer error\",        /* Z_BUF_ERROR     (-5) */\n\"incompatible version\",/* Z_VERSION_ERROR (-6) */\n\"\"};\n\n\nconst char * ZEXPORT zlibVersion()\n{\n    return ZLIB_VERSION;\n}\n\nuLong ZEXPORT zlibCompileFlags()\n{\n    uLong flags;\n\n    flags = 0;\n    switch ((int)(sizeof(uInt))) {\n    case 2:     break;\n    case 4:     flags += 1;     break;\n    case 8:     flags += 2;     break;\n    default:    flags += 3;\n    }\n    switch ((int)(sizeof(uLong))) {\n    case 2:     break;\n    case 4:     flags += 1 << 2;        break;\n    case 8:     flags += 2 << 2;        break;\n    default:    flags += 3 << 2;\n    }\n    switch ((int)(sizeof(voidpf))) {\n    case 2:     break;\n    case 4:     flags += 1 << 4;        break;\n    case 8:     flags += 2 << 4;        break;\n    default:    flags += 3 << 4;\n    }\n    switch ((int)(sizeof(z_off_t))) {\n    case 2:     break;\n    case 4:     flags += 1 << 6;        break;\n    case 8:     flags += 2 << 6;        break;\n    default:    flags += 3 << 6;\n    }\n#ifdef DEBUG\n    flags += 1 << 8;\n#endif\n#if defined(ASMV) || defined(ASMINF)\n    flags += 1 << 9;\n#endif\n#ifdef ZLIB_WINAPI\n    flags += 1 << 10;\n#endif\n#ifdef BUILDFIXED\n    flags += 1 << 12;\n#endif\n#ifdef DYNAMIC_CRC_TABLE\n    flags += 1 << 13;\n#endif\n#ifdef NO_GZCOMPRESS\n    flags += 1L << 16;\n#endif\n#ifdef NO_GZIP\n    flags += 1L << 17;\n#endif\n#ifdef PKZIP_BUG_WORKAROUND\n    flags += 1L << 20;\n#endif\n#ifdef FASTEST\n    flags += 1L << 21;\n#endif\n#ifdef STDC\n#  ifdef NO_vsnprintf\n        flags += 1L << 25;\n#    ifdef HAS_vsprintf_void\n        flags += 1L << 26;\n#    endif\n#  else\n#    ifdef HAS_vsnprintf_void\n        flags += 1L << 26;\n#    endif\n#  endif\n#else\n        flags += 1L << 24;\n#  ifdef NO_snprintf\n        flags += 1L << 25;\n#    ifdef HAS_sprintf_void\n        flags += 1L << 26;\n#    endif\n#  else\n#    ifdef HAS_snprintf_void\n        flags += 1L << 26;\n#    endif\n#  endif\n#endif\n    return flags;\n}\n\n#ifdef DEBUG\n\n#  ifndef verbose\n#    define verbose 0\n#  endif\nint ZLIB_INTERNAL z_verbose = verbose;\n\nvoid ZLIB_INTERNAL z_error (m)\n    char *m;\n{\n    fprintf(stderr, \"%s\\n\", m);\n    exit(1);\n}\n#endif\n\n/* exported to allow conversion of error code to string for compress() and\n * uncompress()\n */\nconst char * ZEXPORT zError(err)\n    int err;\n{\n    return ERR_MSG(err);\n}\n\n#if defined(_WIN32_WCE)\n    /* The Microsoft C Run-Time Library for Windows CE doesn't have\n     * errno.  We define it as a global variable to simplify porting.\n     * Its value is always 0 and should not be used.\n     */\n    int errno = 0;\n#endif\n\n#ifndef HAVE_MEMCPY\n\nvoid ZLIB_INTERNAL zmemcpy(dest, source, len)\n    Bytef* dest;\n    const Bytef* source;\n    uInt  len;\n{\n    if (len == 0) return;\n    do {\n        *dest++ = *source++; /* ??? to be unrolled */\n    } while (--len != 0);\n}\n\nint ZLIB_INTERNAL zmemcmp(s1, s2, len)\n    const Bytef* s1;\n    const Bytef* s2;\n    uInt  len;\n{\n    uInt j;\n\n    for (j = 0; j < len; j++) {\n        if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;\n    }\n    return 0;\n}\n\nvoid ZLIB_INTERNAL zmemzero(dest, len)\n    Bytef* dest;\n    uInt  len;\n{\n    if (len == 0) return;\n    do {\n        *dest++ = 0;  /* ??? to be unrolled */\n    } while (--len != 0);\n}\n#endif\n\n\n#ifdef SYS16BIT\n\n#ifdef __TURBOC__\n/* Turbo C in 16-bit mode */\n\n#  define MY_ZCALLOC\n\n/* Turbo C malloc() does not allow dynamic allocation of 64K bytes\n * and farmalloc(64K) returns a pointer with an offset of 8, so we\n * must fix the pointer. Warning: the pointer must be put back to its\n * original form in order to free it, use zcfree().\n */\n\n#define MAX_PTR 10\n/* 10*64K = 640K */\n\nlocal int next_ptr = 0;\n\ntypedef struct ptr_table_s {\n    voidpf org_ptr;\n    voidpf new_ptr;\n} ptr_table;\n\nlocal ptr_table table[MAX_PTR];\n/* This table is used to remember the original form of pointers\n * to large buffers (64K). Such pointers are normalized with a zero offset.\n * Since MSDOS is not a preemptive multitasking OS, this table is not\n * protected from concurrent access. This hack doesn't work anyway on\n * a protected system like OS/2. Use Microsoft C instead.\n */\n\nvoidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)\n{\n    voidpf buf = opaque; /* just to make some compilers happy */\n    ulg bsize = (ulg)items*size;\n\n    /* If we allocate less than 65520 bytes, we assume that farmalloc\n     * will return a usable pointer which doesn't have to be normalized.\n     */\n    if (bsize < 65520L) {\n        buf = farmalloc(bsize);\n        if (*(ush*)&buf != 0) return buf;\n    } else {\n        buf = farmalloc(bsize + 16L);\n    }\n    if (buf == NULL || next_ptr >= MAX_PTR) return NULL;\n    table[next_ptr].org_ptr = buf;\n\n    /* Normalize the pointer to seg:0 */\n    *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;\n    *(ush*)&buf = 0;\n    table[next_ptr++].new_ptr = buf;\n    return buf;\n}\n\nvoid ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)\n{\n    int n;\n    if (*(ush*)&ptr != 0) { /* object < 64K */\n        farfree(ptr);\n        return;\n    }\n    /* Find the original pointer */\n    for (n = 0; n < next_ptr; n++) {\n        if (ptr != table[n].new_ptr) continue;\n\n        farfree(table[n].org_ptr);\n        while (++n < next_ptr) {\n            table[n-1] = table[n];\n        }\n        next_ptr--;\n        return;\n    }\n    ptr = opaque; /* just to make some compilers happy */\n    Assert(0, \"zcfree: ptr not found\");\n}\n\n#endif /* __TURBOC__ */\n\n\n#ifdef M_I86\n/* Microsoft C in 16-bit mode */\n\n#  define MY_ZCALLOC\n\n#if (!defined(_MSC_VER) || (_MSC_VER <= 600))\n#  define _halloc  halloc\n#  define _hfree   hfree\n#endif\n\nvoidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)\n{\n    if (opaque) opaque = 0; /* to make compiler happy */\n    return _halloc((long)items, size);\n}\n\nvoid ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)\n{\n    if (opaque) opaque = 0; /* to make compiler happy */\n    _hfree(ptr);\n}\n\n#endif /* M_I86 */\n\n#endif /* SYS16BIT */\n\n\n#ifndef MY_ZCALLOC /* Any system without a special alloc function */\n\n#ifndef STDC\nextern voidp  malloc OF((uInt size));\nextern voidp  calloc OF((uInt items, uInt size));\nextern void   free   OF((voidpf ptr));\n#endif\n\nvoidpf ZLIB_INTERNAL zcalloc (opaque, items, size)\n    voidpf opaque;\n    unsigned items;\n    unsigned size;\n{\n    if (opaque) items += size - size; /* make compiler happy */\n    return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :\n                              (voidpf)calloc(items, size);\n}\n\nvoid ZLIB_INTERNAL zcfree (opaque, ptr)\n    voidpf opaque;\n    voidpf ptr;\n{\n    free(ptr);\n    if (opaque) return; /* make compiler happy */\n}\n\n#endif /* MY_ZCALLOC */\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":36,"id":16755,"name":"xsize","nodeType":"Attribute","startLoc":36,"text":"xsize"},{"attributeType":"null","col":7,"comment":"null","endLoc":36,"id":16756,"name":"ysize","nodeType":"Attribute","startLoc":36,"text":"ysize"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":16757,"name":"ax","nodeType":"Attribute","startLoc":39,"text":"ax"},{"fileName":"fits-tables.py","filePath":"examples/io","id":16758,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n\"\"\"\n=====================================================================\nAccessing data stored as a table in a multi-extension FITS (MEF) file\n=====================================================================\n\nFITS files can often contain large amount of multi-dimensional data and\ntables. This example opens a FITS file with information\nfrom Chandra's HETG-S instrument.\n\nThe example uses `astropy.utils.data` to download multi-extension FITS (MEF)\nfile, `astropy.io.fits` to investigate the header, and\n`astropy.table.Table` to explore the data.\n\n\n*By: Lia Corrales, Adrian Price-Whelan, and Kelle Cruz*\n\n*License: BSD*\n\n\n\"\"\"\n\n##############################################################################\n# Use `astropy.utils.data` subpackage to download the FITS file used in this\n# example. Also import `~astropy.table.Table` from the `astropy.table` subpackage\n# and `astropy.io.fits`\n\nfrom astropy.utils.data import get_pkg_data_filename\nfrom astropy.table import Table\nfrom astropy.io import fits\n\n##############################################################################\n# Download a FITS file\n\nevent_filename = get_pkg_data_filename('tutorials/FITS-tables/chandra_events.fits')\n\n##############################################################################\n# Display information about the contents of the FITS file.\n\nfits.info(event_filename)\n\n##############################################################################\n# Extension 1, EVENTS, is a Table that contains information about each X-ray\n# photon that hit Chandra's HETG-S detector.\n#\n# Use `~astropy.table.Table` to read the table\n\nevents = Table.read(event_filename, hdu=1)\n\n##############################################################################\n# Print the column names of the Events Table.\n\nprint(events.columns)\n\n##############################################################################\n# If a column contains unit information, it will have an associated\n# `astropy.units` object.\n\nprint(events['energy'].unit)\n\n##############################################################################\n# Print the data stored in the Energy column.\n\nprint(events['energy'])\n"},{"fileName":"modify-fits-header.py","filePath":"examples/io","id":16759,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n\"\"\"\n==================\nEdit a FITS header\n==================\n\nThis example describes how to edit a value in a FITS header\nusing `astropy.io.fits`.\n\n\n*By: Adrian Price-Whelan*\n\n*License: BSD*\n\n\n\"\"\"\n\nfrom astropy.io import fits\n\n##############################################################################\n# Download a FITS file:\n\nfrom astropy.utils.data import get_pkg_data_filename\n\nfits_file = get_pkg_data_filename('tutorials/FITS-Header/input_file.fits')\n\n##############################################################################\n# Look at contents of the FITS file\n\nfits.info(fits_file)\n\n##############################################################################\n# Look at the headers of the two extensions:\n\nprint(\"Before modifications:\")\nprint()\nprint(\"Extension 0:\")\nprint(repr(fits.getheader(fits_file, 0)))\nprint()\nprint(\"Extension 1:\")\nprint(repr(fits.getheader(fits_file, 1)))\n\n##############################################################################\n# `astropy.io.fits` provides an object-oriented interface for reading and\n# interacting with FITS files, but for small operations (like this example) it\n# is often easier to use the\n# `convenience functions <https://docs.astropy.org/en/latest/io/fits/index.html#convenience-functions>`_.\n#\n# To edit a single header value in the header for extension 0, use the\n# `~astropy.io.fits.setval()` function. For example, set the OBJECT keyword\n# to 'M31':\n\nfits.setval(fits_file, 'OBJECT', value='M31')\n\n##############################################################################\n# With no extra arguments, this will modify the header for extension 0, but\n# this can be changed using the ``ext`` keyword argument. For example, we can\n# specify extension 1 instead:\n\nfits.setval(fits_file, 'OBJECT', value='M31', ext=1)\n\n##############################################################################\n# This can also be used to create a new keyword-value pair (\"card\" in FITS\n# lingo):\n\nfits.setval(fits_file, 'ANEWKEY', value='some value')\n\n##############################################################################\n# Again, this is useful for one-off modifications, but can be inefficient\n# for operations like editing multiple headers in the same file\n# because `~astropy.io.fits.setval()` loads the whole file each time it\n# is called. To make several modifications, it's better to load the file once:\n\nwith fits.open(fits_file, 'update') as f:\n    for hdu in f:\n        hdu.header['OBJECT'] = 'CAT'\n\nprint(\"After modifications:\")\nprint()\nprint(\"Extension 0:\")\nprint(repr(fits.getheader(fits_file, 0)))\nprint()\nprint(\"Extension 1:\")\nprint(repr(fits.getheader(fits_file, 1)))\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":45,"id":16760,"name":"r","nodeType":"Attribute","startLoc":45,"text":"r"},{"attributeType":"PrimaryHDU","col":0,"comment":"null","endLoc":44,"id":16761,"name":"hdu1","nodeType":"Attribute","startLoc":44,"text":"hdu1"},{"attributeType":"null","col":3,"comment":"null","endLoc":45,"id":16762,"name":"g","nodeType":"Attribute","startLoc":45,"text":"g"},{"col":4,"comment":"\n        Plot contours.\n\n        This is a custom implementation of :meth:`~matplotlib.axes.Axes.contour`\n        which applies the transform (if specified) to all contours in one go for\n        performance rather than to each contour line individually. All\n        positional and keyword arguments are the same as for\n        :meth:`~matplotlib.axes.Axes.contour`.\n        ","endLoc":243,"header":"def contour(self, *args, **kwargs)","id":16763,"name":"contour","nodeType":"Function","startLoc":213,"text":"def contour(self, *args, **kwargs):\n        \"\"\"\n        Plot contours.\n\n        This is a custom implementation of :meth:`~matplotlib.axes.Axes.contour`\n        which applies the transform (if specified) to all contours in one go for\n        performance rather than to each contour line individually. All\n        positional and keyword arguments are the same as for\n        :meth:`~matplotlib.axes.Axes.contour`.\n        \"\"\"\n\n        # In Matplotlib, when calling contour() with a transform, each\n        # individual path in the contour map is transformed separately. However,\n        # this is much too slow for us since each call to the transforms results\n        # in an Astropy coordinate transformation, which has a non-negligible\n        # overhead - therefore a better approach is to override contour(), call\n        # the Matplotlib one with no transform, then apply the transform in one\n        # go to all the segments that make up the contour map.\n\n        transform = kwargs.pop('transform', None)\n\n        cset = super().contour(*args, **kwargs)\n\n        if transform is not None:\n            # The transform passed to self.contour will normally include\n            # a transData component at the end, but we can remove that since\n            # we are already working in data space.\n            transform = transform - self.transData\n            transform_contour_set_inplace(cset, transform)\n\n        return cset"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":16764,"name":"fits_file","nodeType":"Attribute","startLoc":25,"text":"fits_file"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":16765,"name":"event_filename","nodeType":"Attribute","startLoc":35,"text":"event_filename"},{"attributeType":"null","col":6,"comment":"null","endLoc":45,"id":16766,"name":"b","nodeType":"Attribute","startLoc":45,"text":"b"},{"attributeType":"null","col":0,"comment":"null","endLoc":46,"id":16767,"name":"r_data","nodeType":"Attribute","startLoc":46,"text":"r_data"},{"attributeType":"null","col":0,"comment":"null","endLoc":47,"id":16768,"name":"g_data","nodeType":"Attribute","startLoc":47,"text":"g_data"},{"col":4,"comment":"\n        Plot filled contours.\n\n        This is a custom implementation of :meth:`~matplotlib.axes.Axes.contourf`\n        which applies the transform (if specified) to all contours in one go for\n        performance rather than to each contour line individually. All\n        positional and keyword arguments are the same as for\n        :meth:`~matplotlib.axes.Axes.contourf`.\n        ","endLoc":269,"header":"def contourf(self, *args, **kwargs)","id":16769,"name":"contourf","nodeType":"Function","startLoc":245,"text":"def contourf(self, *args, **kwargs):\n        \"\"\"\n        Plot filled contours.\n\n        This is a custom implementation of :meth:`~matplotlib.axes.Axes.contourf`\n        which applies the transform (if specified) to all contours in one go for\n        performance rather than to each contour line individually. All\n        positional and keyword arguments are the same as for\n        :meth:`~matplotlib.axes.Axes.contourf`.\n        \"\"\"\n\n        # See notes for contour above.\n\n        transform = kwargs.pop('transform', None)\n\n        cset = super().contourf(*args, **kwargs)\n\n        if transform is not None:\n            # The transform passed to self.contour will normally include\n            # a transData component at the end, but we can remove that since\n            # we are already working in data space.\n            transform = transform - self.transData\n            transform_contour_set_inplace(cset, transform)\n\n        return cset"},{"attributeType":"null","col":0,"comment":"null","endLoc":48,"id":16770,"name":"b_data","nodeType":"Attribute","startLoc":48,"text":"b_data"},{"attributeType":"HDUList","col":39,"comment":"null","endLoc":74,"id":16771,"name":"f","nodeType":"Attribute","startLoc":74,"text":"f"},{"attributeType":"null","col":0,"comment":"null","endLoc":48,"id":16772,"name":"events","nodeType":"Attribute","startLoc":48,"text":"events"},{"attributeType":"null","col":0,"comment":"null","endLoc":54,"id":16773,"name":"r_data","nodeType":"Attribute","startLoc":54,"text":"r_data"},{"col":4,"comment":"\n        Plot `~astropy.coordinates.SkyCoord` or\n        `~astropy.coordinates.BaseCoordinateFrame` objects onto the axes.\n\n        The first argument to\n        :meth:`~astropy.visualization.wcsaxes.WCSAxes.plot_coord` should be a\n        coordinate, which will then be converted to the first two parameters to\n        `matplotlib.axes.Axes.plot`. All other arguments are the same as\n        `matplotlib.axes.Axes.plot`. If not specified a ``transform`` keyword\n        argument will be created based on the coordinate.\n\n        Parameters\n        ----------\n        coordinate : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate object to plot on the axes. This is converted to the\n            first two arguments to `matplotlib.axes.Axes.plot`.\n\n        See Also\n        --------\n        matplotlib.axes.Axes.plot :\n            This method is called from this function with all arguments passed to it.\n\n        ","endLoc":326,"header":"def plot_coord(self, *args, **kwargs)","id":16774,"name":"plot_coord","nodeType":"Function","startLoc":271,"text":"def plot_coord(self, *args, **kwargs):\n        \"\"\"\n        Plot `~astropy.coordinates.SkyCoord` or\n        `~astropy.coordinates.BaseCoordinateFrame` objects onto the axes.\n\n        The first argument to\n        :meth:`~astropy.visualization.wcsaxes.WCSAxes.plot_coord` should be a\n        coordinate, which will then be converted to the first two parameters to\n        `matplotlib.axes.Axes.plot`. All other arguments are the same as\n        `matplotlib.axes.Axes.plot`. If not specified a ``transform`` keyword\n        argument will be created based on the coordinate.\n\n        Parameters\n        ----------\n        coordinate : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate object to plot on the axes. This is converted to the\n            first two arguments to `matplotlib.axes.Axes.plot`.\n\n        See Also\n        --------\n        matplotlib.axes.Axes.plot :\n            This method is called from this function with all arguments passed to it.\n\n        \"\"\"\n\n        if isinstance(args[0], (SkyCoord, BaseCoordinateFrame)):\n\n            # Extract the frame from the first argument.\n            frame0 = args[0]\n            if isinstance(frame0, SkyCoord):\n                frame0 = frame0.frame\n\n            native_frame = self._transform_pixel2world.frame_out\n            # Transform to the native frame of the plot\n            frame0 = frame0.transform_to(native_frame)\n\n            plot_data = []\n            for coord in self.coords:\n                if coord.coord_type == 'longitude':\n                    plot_data.append(frame0.spherical.lon.to_value(u.deg))\n                elif coord.coord_type == 'latitude':\n                    plot_data.append(frame0.spherical.lat.to_value(u.deg))\n                else:\n                    raise NotImplementedError(\"Coordinates cannot be plotted with this \"\n                                              \"method because the WCS does not represent longitude/latitude.\")\n\n            if 'transform' in kwargs.keys():\n                raise TypeError(\"The 'transform' keyword argument is not allowed,\"\n                                \" as it is automatically determined by the input coordinate frame.\")\n\n            transform = self.get_transform(native_frame)\n            kwargs.update({'transform': transform})\n\n            args = tuple(plot_data) + args[1:]\n\n        return super().plot(*args, **kwargs)"},{"attributeType":"null","col":0,"comment":"null","endLoc":55,"id":16775,"name":"g_data","nodeType":"Attribute","startLoc":55,"text":"g_data"},{"attributeType":"null","col":0,"comment":"null","endLoc":56,"id":16776,"name":"b_data","nodeType":"Attribute","startLoc":56,"text":"b_data"},{"attributeType":"PrimaryHDU","col":0,"comment":"null","endLoc":63,"id":16777,"name":"red","nodeType":"Attribute","startLoc":63,"text":"red"},{"col":0,"comment":"","endLoc":21,"header":"fits-tables.py#<anonymous>","id":16778,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n=====================================================================\nAccessing data stored as a table in a multi-extension FITS (MEF) file\n=====================================================================\n\nFITS files can often contain large amount of multi-dimensional data and\ntables. This example opens a FITS file with information\nfrom Chandra's HETG-S instrument.\n\nThe example uses `astropy.utils.data` to download multi-extension FITS (MEF)\nfile, `astropy.io.fits` to investigate the header, and\n`astropy.table.Table` to explore the data.\n\n\n*By: Lia Corrales, Adrian Price-Whelan, and Kelle Cruz*\n\n*License: BSD*\n\n\n\"\"\"\n\nevent_filename = get_pkg_data_filename('tutorials/FITS-tables/chandra_events.fits')\n\nfits.info(event_filename)\n\nevents = Table.read(event_filename, hdu=1)\n\nprint(events.columns)\n\nprint(events['energy'].unit)\n\nprint(events['energy'])"},{"id":16779,"name":"README.txt","nodeType":"TextFile","path":"examples/io","text":".. _example-gallery-io:\n\nastropy.io\n----------\n\nGeneral examples of the ``astropy.io`` subpackages.\n"},{"fileName":"plot_fits-image.py","filePath":"examples/io","id":16780,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n\"\"\"\n=======================================\nRead and plot an image from a FITS file\n=======================================\n\nThis example opens an image stored in a FITS file and displays it to the screen.\n\nThis example uses `astropy.utils.data` to download the file, `astropy.io.fits` to open\nthe file, and `matplotlib.pyplot` to display the image.\n\n\n*By: Lia R. Corrales, Adrian Price-Whelan, Kelle Cruz*\n\n*License: BSD*\n\n\n\"\"\"\n\n##############################################################################\n# Set up matplotlib and use a nicer set of plot parameters\n\nimport matplotlib.pyplot as plt\nfrom astropy.visualization import astropy_mpl_style\nplt.style.use(astropy_mpl_style)\n\n##############################################################################\n# Download the example FITS files used by this example:\n\nfrom astropy.utils.data import get_pkg_data_filename\nfrom astropy.io import fits\n\nimage_file = get_pkg_data_filename('tutorials/FITS-images/HorseHead.fits')\n\n##############################################################################\n# Use `astropy.io.fits.info()` to display the structure of the file:\n\nfits.info(image_file)\n\n##############################################################################\n# Generally the image information is located in the Primary HDU, also known\n# as extension 0. Here, we use `astropy.io.fits.getdata()` to read the image\n# data from this first extension using the keyword argument ``ext=0``:\n\nimage_data = fits.getdata(image_file, ext=0)\n\n##############################################################################\n# The data is now stored as a 2D numpy array. Print the dimensions using the\n# shape attribute:\n\nprint(image_data.shape)\n\n##############################################################################\n# Display the image data:\n\nplt.figure()\nplt.imshow(image_data, cmap='gray')\nplt.colorbar()\n"},{"attributeType":"null","col":28,"comment":"null","endLoc":23,"id":16781,"name":"plt","nodeType":"Attribute","startLoc":23,"text":"plt"},{"attributeType":"null","col":8,"comment":"null","endLoc":75,"id":16782,"name":"hdu","nodeType":"Attribute","startLoc":75,"text":"hdu"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":16783,"name":"image_file","nodeType":"Attribute","startLoc":33,"text":"image_file"},{"attributeType":"PrimaryHDU","col":0,"comment":"null","endLoc":68,"id":16784,"name":"green","nodeType":"Attribute","startLoc":68,"text":"green"},{"col":0,"comment":"","endLoc":16,"header":"modify-fits-header.py#<anonymous>","id":16785,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n==================\nEdit a FITS header\n==================\n\nThis example describes how to edit a value in a FITS header\nusing `astropy.io.fits`.\n\n\n*By: Adrian Price-Whelan*\n\n*License: BSD*\n\n\n\"\"\"\n\nfits_file = get_pkg_data_filename('tutorials/FITS-Header/input_file.fits')\n\nfits.info(fits_file)\n\nprint(\"Before modifications:\")\n\nprint()\n\nprint(\"Extension 0:\")\n\nprint(repr(fits.getheader(fits_file, 0)))\n\nprint()\n\nprint(\"Extension 1:\")\n\nprint(repr(fits.getheader(fits_file, 1)))\n\nfits.setval(fits_file, 'OBJECT', value='M31')\n\nfits.setval(fits_file, 'OBJECT', value='M31', ext=1)\n\nfits.setval(fits_file, 'ANEWKEY', value='some value')\n\nwith fits.open(fits_file, 'update') as f:\n    for hdu in f:\n        hdu.header['OBJECT'] = 'CAT'\n\nprint(\"After modifications:\")\n\nprint()\n\nprint(\"Extension 0:\")\n\nprint(repr(fits.getheader(fits_file, 0)))\n\nprint()\n\nprint(\"Extension 1:\")\n\nprint(repr(fits.getheader(fits_file, 1)))"},{"attributeType":"null","col":0,"comment":"null","endLoc":45,"id":16786,"name":"image_data","nodeType":"Attribute","startLoc":45,"text":"image_data"},{"attributeType":"PrimaryHDU","col":0,"comment":"null","endLoc":73,"id":16787,"name":"blue","nodeType":"Attribute","startLoc":73,"text":"blue"},{"fileName":"skip_create-large-fits.py","filePath":"examples/io","id":16788,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n\"\"\"\n==========================================\nCreate a very large FITS file from scratch\n==========================================\n\nThis example demonstrates how to create a large file (larger than will fit in\nmemory) from scratch using `astropy.io.fits`.\n\n\n*By: Erik Bray*\n\n*License: BSD*\n\n\"\"\"\n\n##############################################################################\n#  Normally to create a single image FITS file one would do something like:\n\nimport os\nimport numpy as np\nfrom astropy.io import fits\ndata = np.zeros((40000, 40000), dtype=np.float64)\nhdu = fits.PrimaryHDU(data=data)\n\n##############################################################################\n# Then use the `astropy.io.fits.writeto()` method to write out the new\n# file to disk\n\nhdu.writeto('large.fits')\n\n##############################################################################\n# However, a 40000 x 40000 array of doubles is nearly twelve gigabytes! Most\n# systems won't be able to create that in memory just to write out to disk. In\n# order to create such a large file efficiently requires a little extra work,\n# and a few assumptions.\n#\n# First, it is helpful to anticipate about how large (as in, how many keywords)\n# the header will have in it. FITS headers must be written in 2880 byte\n# blocks, large enough for 36 keywords per block (including the END keyword in\n# the final block). Typical headers have somewhere between 1 and 4 blocks,\n# though sometimes more.\n#\n# Since the first thing we write to a FITS file is the header, we want to write\n# enough header blocks so that there is plenty of padding in which to add new\n# keywords without having to resize the whole file. Say you want the header to\n# use 4 blocks by default. Then, excluding the END card which Astropy will add\n# automatically, create the header and pad it out to 36 * 4 cards.\n#\n# Create a stub array to initialize the HDU; its\n# exact size is irrelevant, as long as it has the desired number of\n# dimensions\n\ndata = np.zeros((100, 100), dtype=np.float64)\nhdu = fits.PrimaryHDU(data=data)\nheader = hdu.header\nwhile len(header) < (36 * 4 - 1):\n    header.append()  # Adds a blank card to the end\n\n##############################################################################\n# Now adjust the NAXISn keywords to the desired size of the array, and write\n# only the header out to a file. Using the ``hdu.writeto()`` method will cause\n# astropy to \"helpfully\" reset the NAXISn keywords to match the size of the\n# dummy array. That is because it works hard to ensure that only valid FITS\n# files are written. Instead, we can write just the header to a file using the\n# `astropy.io.fits.Header.tofile` method:\n\nheader['NAXIS1'] = 40000\nheader['NAXIS2'] = 40000\nheader.tofile('large.fits')\n\n##############################################################################\n# Finally, grow out the end of the file to match the length of the\n# data (plus the length of the header). This can be done very efficiently on\n# most systems by seeking past the end of the file and writing a single byte,\n# like so:\n\nwith open('large.fits', 'rb+') as fobj:\n    # Seek past the length of the header, plus the length of the\n    # Data we want to write.\n    # 8 is the number of bytes per value, i.e. abs(header['BITPIX'])/8\n    # (this example is assuming a 64-bit float)\n    # The -1 is to account for the final byte that we are about to\n    # write:\n    fobj.seek(len(header.tostring()) + (40000 * 40000 * 8) - 1)\n    fobj.write(b'\\0')\n\n##############################################################################\n# More generally, this can be written:\n\nshape = tuple(header[f'NAXIS{ii}'] for ii in range(1, header['NAXIS']+1))\nwith open('large.fits', 'rb+') as fobj:\n    fobj.seek(len(header.tostring()) + (np.product(shape) * np.abs(header['BITPIX']//8)) - 1)\n    fobj.write(b'\\0')\n\n##############################################################################\n# On modern operating systems this will cause the file (past the header) to be\n# filled with zeros out to the ~12GB needed to hold a 40000 x 40000 image. On\n# filesystems that support sparse file creation (most Linux filesystems, but not\n# the HFS+ filesystem used by most Macs) this is a very fast, efficient\n# operation. On other systems your mileage may vary.\n#\n# This isn't the only way to build up a large file, but probably one of the\n# safest. This method can also be used to create large multi-extension FITS\n# files, with a little care.\n\n##############################################################################\n# Finally, we'll remove the file we created:\n\nos.remove('large.fits')\n"},{"col":0,"comment":"","endLoc":18,"header":"plot_fits-image.py#<anonymous>","id":16789,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n=======================================\nRead and plot an image from a FITS file\n=======================================\n\nThis example opens an image stored in a FITS file and displays it to the screen.\n\nThis example uses `astropy.utils.data` to download the file, `astropy.io.fits` to open\nthe file, and `matplotlib.pyplot` to display the image.\n\n\n*By: Lia R. Corrales, Adrian Price-Whelan, Kelle Cruz*\n\n*License: BSD*\n\n\n\"\"\"\n\nplt.style.use(astropy_mpl_style)\n\nimage_file = get_pkg_data_filename('tutorials/FITS-images/HorseHead.fits')\n\nfits.info(image_file)\n\nimage_data = fits.getdata(image_file, ext=0)\n\nprint(image_data.shape)\n\nplt.figure()\n\nplt.imshow(image_data, cmap='gray')\n\nplt.colorbar()"},{"col":0,"comment":"","endLoc":19,"header":"split-jpeg-to-fits.py#<anonymous>","id":16790,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n=====================================================\nConvert a 3-color image (JPG) to separate FITS images\n=====================================================\n\nThis example opens an RGB JPEG image and writes out each channel as a separate\nFITS (image) file.\n\nThis example uses `pillow <https://python-pillow.org>`_ to read the image,\n`matplotlib.pyplot` to display the image, and `astropy.io.fits` to save FITS files.\n\n\n*By: Erik Bray, Adrian Price-Whelan*\n\n*License: BSD*\n\n\n\"\"\"\n\nplt.style.use(astropy_mpl_style)\n\nimage = Image.open('Hs-2009-14-a-web.jpg')\n\nxsize, ysize = image.size\n\nprint(f\"Image size: {ysize} x {xsize}\")\n\nprint(f\"Image bands: {image.getbands()}\")\n\nax = plt.imshow(image)\n\nr, g, b = image.split()\n\nr_data = np.array(r.getdata()) # data is now an array of length ysize*xsize\n\ng_data = np.array(g.getdata())\n\nb_data = np.array(b.getdata())\n\nprint(r_data.shape)\n\nr_data = r_data.reshape(ysize, xsize) # data is now a matrix (ysize, xsize)\n\ng_data = g_data.reshape(ysize, xsize)\n\nb_data = b_data.reshape(ysize, xsize)\n\nprint(r_data.shape)\n\nred = fits.PrimaryHDU(data=r_data)\n\nred.header['LATOBS'] = \"32:11:56\" # add spurious header info\n\nred.header['LONGOBS'] = \"110:56\"\n\nred.writeto('red.fits')\n\ngreen = fits.PrimaryHDU(data=g_data)\n\ngreen.header['LATOBS'] = \"32:11:56\"\n\ngreen.header['LONGOBS'] = \"110:56\"\n\ngreen.writeto('green.fits')\n\nblue = fits.PrimaryHDU(data=b_data)\n\nblue.header['LATOBS'] = \"32:11:56\"\n\nblue.header['LONGOBS'] = \"110:56\"\n\nblue.writeto('blue.fits')\n\npprint(red.header)\n\nos.remove('red.fits')\n\nos.remove('green.fits')\n\nos.remove('blue.fits')"},{"attributeType":"null","col":16,"comment":"null","endLoc":21,"id":16791,"name":"np","nodeType":"Attribute","startLoc":21,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":16792,"name":"data","nodeType":"Attribute","startLoc":23,"text":"data"},{"attributeType":"PrimaryHDU","col":0,"comment":"null","endLoc":24,"id":16793,"name":"hdu","nodeType":"Attribute","startLoc":24,"text":"hdu"},{"id":16794,"name":"examples/template","nodeType":"Package"},{"fileName":"example-template.py","filePath":"examples/template","id":16795,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n\"\"\"\n========================\nTitle of Example\n========================\n\nThis example <verb> <active tense> <does something>.\n\nThe example uses <packages> to <do something> and <other package> to <do other\nthing>. Include links to referenced packages like this: `astropy.io.fits` to\nshow the astropy.io.fits or like this `~astropy.io.fits`to show just 'fits'\n\n\n*By: <names>*\n\n*License: BSD*\n\n\n\"\"\"\n\n##############################################################################\n# Make print work the same in all versions of Python, set up numpy,\n# matplotlib, and use a nicer set of plot parameters:\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom astropy.visualization import astropy_mpl_style\nplt.style.use(astropy_mpl_style)\n# uncomment if including figures:\n# import matplotlib.pyplot as plt\n# from astropy.visualization import astropy_mpl_style\n# plt.style.use(astropy_mpl_style)\n\n##############################################################################\n# This code block is executed, although it produces no output. Lines starting\n# with a simple hash are code comment and get treated as part of the code\n# block. To include this new comment string we started the new block with a\n# long line of hashes.\n#\n# The sphinx-gallery parser will assume everything after this splitter and that\n# continues to start with a **comment hash and space** (respecting code style)\n# is text that has to be rendered in\n# html format. Keep in mind to always keep your comments always together by\n# comment hashes. That means to break a paragraph you still need to comment\n# that line break.\n#\n# In this example the next block of code produces some plotable data. Code is\n# executed, figure is saved and then code is presented next, followed by the\n# inlined figure.\n\nx = np.linspace(-np.pi, np.pi, 300)\nxx, yy = np.meshgrid(x, x)\nz = np.cos(xx) + np.cos(yy)\n\nplt.figure()\nplt.imshow(z)\nplt.colorbar()\nplt.xlabel('$x$')\nplt.ylabel('$y$')\n\n###########################################################################\n# Again it is possible to continue the discussion with a new Python string. This\n# time to introduce the next code block generates 2 separate figures.\n\nplt.figure()\nplt.imshow(z, cmap=plt.cm.get_cmap('hot'))\nplt.figure()\nplt.imshow(z, cmap=plt.cm.get_cmap('Spectral'), interpolation='none')\n\n##########################################################################\n# There's some subtle differences between rendered html rendered comment\n# strings and code comment strings which I'll demonstrate below. (Some of this\n# only makes sense if you look at the\n# :download:`raw Python script <plot_notebook.py>`)\n#\n# Comments in comment blocks remain nested in the text.\n\n\ndef dummy():\n    \"\"\"Dummy function to make sure docstrings don't get rendered as text\"\"\"\n    pass\n\n\n# Code comments not preceded by the hash splitter are left in code blocks.\n\nstring = \"\"\"\nTriple-quoted string which tries to break parser but doesn't.\n\"\"\"\n\n############################################################################\n# Output of the script is captured:\n\nprint('Some output from Python')\n\n############################################################################\n# Finally, I'll call ``show`` at the end just so someone running the Python\n# code directly will see the plots; this is not necessary for creating the docs\n\nplt.show()\n"},{"col":0,"comment":"Dummy function to make sure docstrings don't get rendered as text","endLoc":81,"header":"def dummy()","id":16796,"name":"dummy","nodeType":"Function","startLoc":79,"text":"def dummy():\n    \"\"\"Dummy function to make sure docstrings don't get rendered as text\"\"\"\n    pass"},{"attributeType":"null","col":16,"comment":"null","endLoc":25,"id":16797,"name":"np","nodeType":"Attribute","startLoc":25,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":54,"id":16798,"name":"data","nodeType":"Attribute","startLoc":54,"text":"data"},{"attributeType":"PrimaryHDU","col":0,"comment":"null","endLoc":55,"id":16799,"name":"hdu","nodeType":"Attribute","startLoc":55,"text":"hdu"},{"id":16800,"name":"examples/coordinates","nodeType":"Package"},{"fileName":"plot_obs-planning.py","filePath":"examples/coordinates","id":16801,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n\"\"\"\n===================================================================\nDetermining and plotting the altitude/azimuth of a celestial object\n===================================================================\n\nThis example demonstrates coordinate transformations and the creation of\nvisibility curves to assist with observing run planning.\n\nIn this example, we make a `~astropy.coordinates.SkyCoord` instance for M33.\nThe altitude-azimuth coordinates are then found using\n`astropy.coordinates.EarthLocation` and `astropy.time.Time` objects.\n\nThis example is meant to demonstrate the capabilities of the\n`astropy.coordinates` package. For more convenient and/or complex observation\nplanning, consider the `astroplan <https://astroplan.readthedocs.org/>`_\npackage.\n\n\n*By: Erik Tollerud, Kelle Cruz*\n\n*License: BSD*\n\n\n\"\"\"\n\n##############################################################################\n# Let's suppose you are planning to visit picturesque Bear Mountain State Park\n# in New York, USA. You're bringing your telescope with you (of course), and\n# someone told you M33 is a great target to observe there. You happen to know\n# you're free at 11:00 pm local time, and you want to know if it will be up.\n# Astropy can answer that.\n#\n# Import numpy and matplotlib. For the latter, use a nicer set of plot\n# parameters and set up support for plotting/converting quantities.\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom astropy.visualization import astropy_mpl_style, quantity_support\nplt.style.use(astropy_mpl_style)\nquantity_support()\n\n\n##############################################################################\n# Import the packages necessary for finding coordinates and making\n# coordinate transformations\n\nimport astropy.units as u\nfrom astropy.time import Time\nfrom astropy.coordinates import SkyCoord, EarthLocation, AltAz\n\n##############################################################################\n# `astropy.coordinates.SkyCoord.from_name` uses Simbad to resolve object\n# names and retrieve coordinates.\n#\n# Get the coordinates of M33:\n\nm33 = SkyCoord.from_name('M33')\n\n##############################################################################\n# Use `astropy.coordinates.EarthLocation` to provide the location of Bear\n# Mountain and set the time to 11pm EDT on 2012 July 12:\n\nbear_mountain = EarthLocation(lat=41.3*u.deg, lon=-74*u.deg, height=390*u.m)\nutcoffset = -4*u.hour  # Eastern Daylight Time\ntime = Time('2012-7-12 23:00:00') - utcoffset\n\n##############################################################################\n# `astropy.coordinates.EarthLocation.get_site_names` and\n# `~astropy.coordinates.EarthLocation.get_site_names` can be used to get\n# locations of major observatories.\n#\n# Use `astropy.coordinates` to find the Alt, Az coordinates of M33 at as\n# observed from Bear Mountain at 11pm on 2012 July 12.\n\nm33altaz = m33.transform_to(AltAz(obstime=time,location=bear_mountain))\nprint(f\"M33's Altitude = {m33altaz.alt:.2}\")\n\n##############################################################################\n# This is helpful since it turns out M33 is barely above the horizon at this\n# time. It's more informative to find M33's airmass over the course of\n# the night.\n#\n# Find the alt,az coordinates of M33 at 100 times evenly spaced between 10pm\n# and 7am EDT:\n\nmidnight = Time('2012-7-13 00:00:00') - utcoffset\ndelta_midnight = np.linspace(-2, 10, 100)*u.hour\nframe_July13night = AltAz(obstime=midnight+delta_midnight,\n                          location=bear_mountain)\nm33altazs_July13night = m33.transform_to(frame_July13night)\n\n##############################################################################\n# convert alt, az to airmass with `~astropy.coordinates.AltAz.secz` attribute:\n\nm33airmasss_July13night = m33altazs_July13night.secz\n\n##############################################################################\n# Plot the airmass as a function of time:\n\nplt.plot(delta_midnight, m33airmasss_July13night)\nplt.xlim(-2, 10)\nplt.ylim(1, 4)\nplt.xlabel('Hours from EDT Midnight')\nplt.ylabel('Airmass [Sec(z)]')\nplt.show()\n\n##############################################################################\n# Use  `~astropy.coordinates.get_sun` to find the location of the Sun at 1000\n# evenly spaced times between noon on July 12 and noon on July 13:\n\nfrom astropy.coordinates import get_sun\ndelta_midnight = np.linspace(-12, 12, 1000)*u.hour\ntimes_July12_to_13 = midnight + delta_midnight\nframe_July12_to_13 = AltAz(obstime=times_July12_to_13, location=bear_mountain)\nsunaltazs_July12_to_13 = get_sun(times_July12_to_13).transform_to(frame_July12_to_13)\n\n\n##############################################################################\n# Do the same with `~astropy.coordinates.get_moon` to find when the moon is\n# up. Be aware that this will need to download a 10MB file from the internet\n# to get a precise location of the moon.\n\nfrom astropy.coordinates import get_moon\nmoon_July12_to_13 = get_moon(times_July12_to_13)\nmoonaltazs_July12_to_13 = moon_July12_to_13.transform_to(frame_July12_to_13)\n\n##############################################################################\n# Find the alt,az coordinates of M33 at those same times:\n\nm33altazs_July12_to_13 = m33.transform_to(frame_July12_to_13)\n\n##############################################################################\n# Make a beautiful figure illustrating nighttime and the altitudes of M33 and\n# the Sun over that time:\n\nplt.plot(delta_midnight, sunaltazs_July12_to_13.alt, color='r', label='Sun')\nplt.plot(delta_midnight, moonaltazs_July12_to_13.alt, color=[0.75]*3, ls='--', label='Moon')\nplt.scatter(delta_midnight, m33altazs_July12_to_13.alt,\n            c=m33altazs_July12_to_13.az, label='M33', lw=0, s=8,\n            cmap='viridis')\nplt.fill_between(delta_midnight, 0*u.deg, 90*u.deg,\n                 sunaltazs_July12_to_13.alt < -0*u.deg, color='0.5', zorder=0)\nplt.fill_between(delta_midnight, 0*u.deg, 90*u.deg,\n                 sunaltazs_July12_to_13.alt < -18*u.deg, color='k', zorder=0)\nplt.colorbar().set_label('Azimuth [deg]')\nplt.legend(loc='upper left')\nplt.xlim(-12*u.hour, 12*u.hour)\nplt.xticks((np.arange(13)*2-12)*u.hour)\nplt.ylim(0*u.deg, 90*u.deg)\nplt.xlabel('Hours from EDT Midnight')\nplt.ylabel('Altitude [deg]')\nplt.show()\n"},{"attributeType":"null","col":28,"comment":"null","endLoc":26,"id":16802,"name":"plt","nodeType":"Attribute","startLoc":26,"text":"plt"},{"attributeType":"null","col":0,"comment":"null","endLoc":51,"id":16803,"name":"x","nodeType":"Attribute","startLoc":51,"text":"x"},{"attributeType":"ImageHDU","col":0,"comment":"null","endLoc":45,"id":16804,"name":"hdu2","nodeType":"Attribute","startLoc":45,"text":"hdu2"},{"attributeType":"null","col":0,"comment":"null","endLoc":56,"id":16805,"name":"header","nodeType":"Attribute","startLoc":56,"text":"header"},{"attributeType":"null","col":34,"comment":"null","endLoc":78,"id":16806,"name":"fobj","nodeType":"Attribute","startLoc":78,"text":"fobj"},{"attributeType":"null","col":0,"comment":"null","endLoc":91,"id":16807,"name":"shape","nodeType":"Attribute","startLoc":91,"text":"shape"},{"attributeType":"null","col":39,"comment":"null","endLoc":91,"id":16808,"name":"ii","nodeType":"Attribute","startLoc":91,"text":"ii"},{"attributeType":"HDUList","col":0,"comment":"null","endLoc":46,"id":16809,"name":"new_hdul","nodeType":"Attribute","startLoc":46,"text":"new_hdul"},{"attributeType":"null","col":34,"comment":"null","endLoc":92,"id":16810,"name":"fobj","nodeType":"Attribute","startLoc":92,"text":"fobj"},{"col":0,"comment":"","endLoc":15,"header":"skip_create-large-fits.py#<anonymous>","id":16811,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n==========================================\nCreate a very large FITS file from scratch\n==========================================\n\nThis example demonstrates how to create a large file (larger than will fit in\nmemory) from scratch using `astropy.io.fits`.\n\n\n*By: Erik Bray*\n\n*License: BSD*\n\n\"\"\"\n\ndata = np.zeros((40000, 40000), dtype=np.float64)\n\nhdu = fits.PrimaryHDU(data=data)\n\nhdu.writeto('large.fits')\n\ndata = np.zeros((100, 100), dtype=np.float64)\n\nhdu = fits.PrimaryHDU(data=data)\n\nheader = hdu.header\n\nwhile len(header) < (36 * 4 - 1):\n    header.append()  # Adds a blank card to the end\n\nheader['NAXIS1'] = 40000\n\nheader['NAXIS2'] = 40000\n\nheader.tofile('large.fits')\n\nwith open('large.fits', 'rb+') as fobj:\n    # Seek past the length of the header, plus the length of the\n    # Data we want to write.\n    # 8 is the number of bytes per value, i.e. abs(header['BITPIX'])/8\n    # (this example is assuming a 64-bit float)\n    # The -1 is to account for the final byte that we are about to\n    # write:\n    fobj.seek(len(header.tostring()) + (40000 * 40000 * 8) - 1)\n    fobj.write(b'\\0')\n\nshape = tuple(header[f'NAXIS{ii}'] for ii in range(1, header['NAXIS']+1))\n\nwith open('large.fits', 'rb+') as fobj:\n    fobj.seek(len(header.tostring()) + (np.product(shape) * np.abs(header['BITPIX']//8)) - 1)\n    fobj.write(b'\\0')\n\nos.remove('large.fits')"},{"attributeType":"null","col":16,"comment":"null","endLoc":37,"id":16812,"name":"np","nodeType":"Attribute","startLoc":37,"text":"np"},{"col":0,"comment":"","endLoc":16,"header":"create-mef.py#<anonymous>","id":16813,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n=====================================================\nCreate a multi-extension FITS (MEF) file from scratch\n=====================================================\n\nThis example demonstrates how to create a multi-extension FITS (MEF)\nfile from scratch using `astropy.io.fits`.\n\n\n*By: Erik Bray*\n\n*License: BSD*\n\n\n\"\"\"\n\nnew_hdul = fits.HDUList()\n\nnew_hdul.append(fits.ImageHDU())\n\nnew_hdul.append(fits.ImageHDU())\n\nnew_hdul.writeto('test.fits')\n\nhdu1 = fits.PrimaryHDU()\n\nhdu2 = fits.ImageHDU()\n\nnew_hdul = fits.HDUList([hdu1, hdu2])\n\nnew_hdul.writeto('test.fits', overwrite=True)\n\nos.remove('test.fits')"},{"attributeType":"null","col":28,"comment":"null","endLoc":38,"id":16814,"name":"plt","nodeType":"Attribute","startLoc":38,"text":"plt"},{"attributeType":"null","col":24,"comment":"null","endLoc":48,"id":16815,"name":"u","nodeType":"Attribute","startLoc":48,"text":"u"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":58,"id":16816,"name":"m33","nodeType":"Attribute","startLoc":58,"text":"m33"},{"fileName":"rv-to-gsr.py","filePath":"examples/coordinates","id":16817,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n\"\"\"\n================================================================\nConvert a radial velocity to the Galactic Standard of Rest (GSR)\n================================================================\n\nRadial or line-of-sight velocities of sources are often reported in a\nHeliocentric or Solar-system barycentric reference frame. A common\ntransformation incorporates the projection of the Sun's motion along the\nline-of-sight to the target, hence transforming it to a Galactic rest frame\ninstead (sometimes referred to as the Galactic Standard of Rest, GSR). This\ntransformation depends on the assumptions about the orientation of the Galactic\nframe relative to the bary- or Heliocentric frame. It also depends on the\nassumed solar velocity vector. Here we'll demonstrate how to perform this\ntransformation using a sky position and barycentric radial-velocity.\n\n\n*By: Adrian Price-Whelan*\n\n*License: BSD*\n\n\n\"\"\"\n\n################################################################################\n# Make print work the same in all versions of Python and import the required\n# Astropy packages:\nimport astropy.units as u\nimport astropy.coordinates as coord\n\n################################################################################\n# Use the latest convention for the Galactocentric coordinates\ncoord.galactocentric_frame_defaults.set('latest')\n\n################################################################################\n# For this example, let's work with the coordinates and barycentric radial\n# velocity of the star HD 155967, as obtained from\n# `Simbad <https://simbad.u-strasbg.fr/simbad/>`_:\nicrs = coord.SkyCoord(ra=258.58356362*u.deg, dec=14.55255619*u.deg,\n                      radial_velocity=-16.1*u.km/u.s, frame='icrs')\n\n################################################################################\n# We next need to decide on the velocity of the Sun in the assumed GSR frame.\n# We'll use the same velocity vector as used in the\n# `~astropy.coordinates.Galactocentric` frame, and convert it to a\n# `~astropy.coordinates.CartesianRepresentation` object using the\n# ``.to_cartesian()`` method of the\n# `~astropy.coordinates.CartesianDifferential` object ``galcen_v_sun``:\nv_sun = coord.Galactocentric().galcen_v_sun.to_cartesian()\n\n################################################################################\n# We now need to get a unit vector in the assumed Galactic frame from the sky\n# position in the ICRS frame above. We'll use this unit vector to project the\n# solar velocity onto the line-of-sight:\ngal = icrs.transform_to(coord.Galactic)\ncart_data = gal.data.to_cartesian()\nunit_vector = cart_data / cart_data.norm()\n\n################################################################################\n# Now we project the solar velocity using this unit vector:\nv_proj = v_sun.dot(unit_vector)\n\n################################################################################\n# Finally, we add the projection of the solar velocity to the radial velocity\n# to get a GSR radial velocity:\nrv_gsr = icrs.radial_velocity + v_proj\nprint(rv_gsr)\n\n\n################################################################################\n# We could wrap this in a function so we can control the solar velocity and\n# re-use the above code:\ndef rv_to_gsr(c, v_sun=None):\n    \"\"\"Transform a barycentric radial velocity to the Galactic Standard of Rest\n    (GSR).\n\n    The input radial velocity must be passed in as a\n\n    Parameters\n    ----------\n    c : `~astropy.coordinates.BaseCoordinateFrame` subclass instance\n        The radial velocity, associated with a sky coordinates, to be\n        transformed.\n    v_sun : `~astropy.units.Quantity`, optional\n        The 3D velocity of the solar system barycenter in the GSR frame.\n        Defaults to the same solar motion as in the\n        `~astropy.coordinates.Galactocentric` frame.\n\n    Returns\n    -------\n    v_gsr : `~astropy.units.Quantity`\n        The input radial velocity transformed to a GSR frame.\n\n    \"\"\"\n    if v_sun is None:\n        v_sun = coord.Galactocentric().galcen_v_sun.to_cartesian()\n\n    gal = c.transform_to(coord.Galactic)\n    cart_data = gal.data.to_cartesian()\n    unit_vector = cart_data / cart_data.norm()\n\n    v_proj = v_sun.dot(unit_vector)\n\n    return c.radial_velocity + v_proj\n\n\nrv_gsr = rv_to_gsr(icrs)\nprint(rv_gsr)\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":52,"id":16818,"name":"xx","nodeType":"Attribute","startLoc":52,"text":"xx"},{"id":16819,"name":"README.txt","nodeType":"TextFile","path":"examples/coordinates","text":".. _example-gallery-coordinates:\n\nastropy.coordinates\n-------------------\n\nGeneral examples of the `astropy.coordinates` subpackage.\n"},{"col":0,"comment":"Transform a barycentric radial velocity to the Galactic Standard of Rest\n    (GSR).\n\n    The input radial velocity must be passed in as a\n\n    Parameters\n    ----------\n    c : `~astropy.coordinates.BaseCoordinateFrame` subclass instance\n        The radial velocity, associated with a sky coordinates, to be\n        transformed.\n    v_sun : `~astropy.units.Quantity`, optional\n        The 3D velocity of the solar system barycenter in the GSR frame.\n        Defaults to the same solar motion as in the\n        `~astropy.coordinates.Galactocentric` frame.\n\n    Returns\n    -------\n    v_gsr : `~astropy.units.Quantity`\n        The input radial velocity transformed to a GSR frame.\n\n    ","endLoc":104,"header":"def rv_to_gsr(c, v_sun=None)","id":16820,"name":"rv_to_gsr","nodeType":"Function","startLoc":73,"text":"def rv_to_gsr(c, v_sun=None):\n    \"\"\"Transform a barycentric radial velocity to the Galactic Standard of Rest\n    (GSR).\n\n    The input radial velocity must be passed in as a\n\n    Parameters\n    ----------\n    c : `~astropy.coordinates.BaseCoordinateFrame` subclass instance\n        The radial velocity, associated with a sky coordinates, to be\n        transformed.\n    v_sun : `~astropy.units.Quantity`, optional\n        The 3D velocity of the solar system barycenter in the GSR frame.\n        Defaults to the same solar motion as in the\n        `~astropy.coordinates.Galactocentric` frame.\n\n    Returns\n    -------\n    v_gsr : `~astropy.units.Quantity`\n        The input radial velocity transformed to a GSR frame.\n\n    \"\"\"\n    if v_sun is None:\n        v_sun = coord.Galactocentric().galcen_v_sun.to_cartesian()\n\n    gal = c.transform_to(coord.Galactic)\n    cart_data = gal.data.to_cartesian()\n    unit_vector = cart_data / cart_data.norm()\n\n    v_proj = v_sun.dot(unit_vector)\n\n    return c.radial_velocity + v_proj"},{"fileName":"plot_galactocentric-frame.py","filePath":"examples/coordinates","id":16821,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n\"\"\"\n========================================================================\nTransforming positions and velocities to and from a Galactocentric frame\n========================================================================\n\nThis document shows a few examples of how to use and customize the\n`~astropy.coordinates.Galactocentric` frame to transform Heliocentric sky\npositions, distance, proper motions, and radial velocities to a Galactocentric,\nCartesian frame, and the same in reverse.\n\nThe main configurable parameters of the `~astropy.coordinates.Galactocentric`\nframe control the position and velocity of the solar system barycenter within\nthe Galaxy. These are specified by setting the ICRS coordinates of the\nGalactic center, the distance to the Galactic center (the sun-galactic center\nline is always assumed to be the x-axis of the Galactocentric frame), and the\nCartesian 3-velocity of the sun in the Galactocentric frame. We'll first\ndemonstrate how to customize these values, then show how to set the solar motion\ninstead by inputting the proper motion of Sgr A*.\n\nNote that, for brevity, we may refer to the solar system barycenter as just \"the\nsun\" in the examples below.\n\n\n*By: Adrian Price-Whelan*\n\n*License: BSD*\n\n\n\"\"\"\n\n##############################################################################\n# Make `print` work the same in all versions of Python, set up numpy,\n# matplotlib, and use a nicer set of plot parameters:\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom astropy.visualization import astropy_mpl_style\nplt.style.use(astropy_mpl_style)\n\n\n##############################################################################\n# Import the necessary astropy subpackages\n\nimport astropy.coordinates as coord\nimport astropy.units as u\n\n##############################################################################\n# Let's first define a barycentric coordinate and velocity in the ICRS frame.\n# We'll use the data for the star HD 39881 from the `Simbad\n# <https://simbad.u-strasbg.fr/simbad/>`_ database:\n\nc1 = coord.SkyCoord(ra=89.014303*u.degree, dec=13.924912*u.degree,\n                    distance=(37.59*u.mas).to(u.pc, u.parallax()),\n                    pm_ra_cosdec=372.72*u.mas/u.yr,\n                    pm_dec=-483.69*u.mas/u.yr,\n                    radial_velocity=0.37*u.km/u.s,\n                    frame='icrs')\n\n##############################################################################\n# This is a high proper-motion star; suppose we'd like to transform its position\n# and velocity to a Galactocentric frame to see if it has a large 3D velocity\n# as well. To use the Astropy default solar position and motion parameters, we\n# can simply do:\n\ngc1 = c1.transform_to(coord.Galactocentric)\n\n##############################################################################\n# From here, we can access the components of the resulting\n# `~astropy.coordinates.Galactocentric` instance to see the 3D Cartesian\n# velocity components:\n\nprint(gc1.v_x, gc1.v_y, gc1.v_z)\n\n##############################################################################\n# The default parameters for the `~astropy.coordinates.Galactocentric` frame\n# are detailed in the linked documentation, but we can modify the most commonly\n# changes values using the keywords ``galcen_distance``, ``galcen_v_sun``, and\n# ``z_sun`` which set the sun-Galactic center distance, the 3D velocity vector\n# of the sun, and the height of the sun above the Galactic midplane,\n# respectively. The velocity of the sun can be specified as an\n# `~astropy.units.Quantity` object with velocity units and is interpreted as a\n# Cartesian velocity, as in the example below. Note that, as with the positions,\n# the Galactocentric frame is a right-handed system (i.e., the Sun is at negative\n# x values) so ``v_x`` is opposite of the Galactocentric radial velocity:\n\nv_sun = [11.1, 244, 7.25] * (u.km / u.s)  # [vx, vy, vz]\ngc_frame = coord.Galactocentric(\n    galcen_distance=8*u.kpc,\n    galcen_v_sun=v_sun,\n    z_sun=0*u.pc)\n\n##############################################################################\n# We can then transform to this frame instead, with our custom parameters:\n\ngc2 = c1.transform_to(gc_frame)\nprint(gc2.v_x, gc2.v_y, gc2.v_z)\n\n##############################################################################\n# It's sometimes useful to specify the solar motion using the `proper motion\n# of Sgr A* <https://arxiv.org/abs/astro-ph/0408107>`_ instead of Cartesian\n# velocity components. With an assumed distance, we can convert proper motion\n# components to Cartesian velocity components using `astropy.units`:\n\ngalcen_distance = 8*u.kpc\npm_gal_sgrA = [-6.379, -0.202] * u.mas/u.yr # from Reid & Brunthaler 2004\nvy, vz = -(galcen_distance * pm_gal_sgrA).to(u.km/u.s, u.dimensionless_angles())\n\n##############################################################################\n# We still have to assume a line-of-sight velocity for the Galactic center,\n# which we will again take to be 11 km/s:\nvx = 11.1 * u.km/u.s\nv_sun2 = u.Quantity([vx, vy, vz])  # List of Quantity -> a single Quantity\n\ngc_frame2 = coord.Galactocentric(galcen_distance=galcen_distance,\n                                 galcen_v_sun=v_sun2,\n                                 z_sun=0*u.pc)\ngc3 = c1.transform_to(gc_frame2)\nprint(gc3.v_x, gc3.v_y, gc3.v_z)\n\n##############################################################################\n# The transformations also work in the opposite direction. This can be useful\n# for transforming simulated or theoretical data to observable quantities. As\n# an example, we'll generate 4 theoretical circular orbits at different\n# Galactocentric radii with the same circular velocity, and transform them to\n# Heliocentric coordinates:\n\nring_distances = np.arange(10, 25+1, 5) * u.kpc\ncirc_velocity = 220 * u.km/u.s\n\nphi_grid = np.linspace(90, 270, 512) * u.degree # grid of azimuths\nring_rep = coord.CylindricalRepresentation(\n    rho=ring_distances[:,np.newaxis],\n    phi=phi_grid[np.newaxis],\n    z=np.zeros_like(ring_distances)[:,np.newaxis])\n\nangular_velocity = (-circ_velocity / ring_distances).to(u.mas/u.yr,\n                                                        u.dimensionless_angles())\nring_dif = coord.CylindricalDifferential(\n    d_rho=np.zeros(phi_grid.shape)[np.newaxis]*u.km/u.s,\n    d_phi=angular_velocity[:,np.newaxis],\n    d_z=np.zeros(phi_grid.shape)[np.newaxis]*u.km/u.s\n)\n\nring_rep = ring_rep.with_differentials(ring_dif)\ngc_rings = coord.SkyCoord(ring_rep, frame=coord.Galactocentric)\n\n##############################################################################\n# First, let's visualize the geometry in Galactocentric coordinates. Here are\n# the positions and velocities of the rings; note that in the velocity plot,\n# the velocities of the 4 rings are identical and thus overlaid under the same\n# curve:\nfig,axes = plt.subplots(1, 2, figsize=(12,6))\n\n# Positions\naxes[0].plot(gc_rings.x.T, gc_rings.y.T, marker='None', linewidth=3)\naxes[0].text(-8., 0, r'$\\odot$', fontsize=20)\n\naxes[0].set_xlim(-30, 30)\naxes[0].set_ylim(-30, 30)\n\naxes[0].set_xlabel('$x$ [kpc]')\naxes[0].set_ylabel('$y$ [kpc]')\n\n# Velocities\naxes[1].plot(gc_rings.v_x.T, gc_rings.v_y.T, marker='None', linewidth=3)\n\naxes[1].set_xlim(-250, 250)\naxes[1].set_ylim(-250, 250)\n\naxes[1].set_xlabel(f\"$v_x$ [{(u.km / u.s).to_string('latex_inline')}]\")\naxes[1].set_ylabel(f\"$v_y$ [{(u.km / u.s).to_string('latex_inline')}]\")\n\nfig.tight_layout()\n\nplt.show()\n\n##############################################################################\n# Now we can transform to Galactic coordinates and visualize the rings in\n# observable coordinates:\ngal_rings = gc_rings.transform_to(coord.Galactic)\n\nfig, ax = plt.subplots(1, 1, figsize=(8, 6))\nfor i in range(len(ring_distances)):\n    ax.plot(gal_rings[i].l.degree, gal_rings[i].pm_l_cosb.value,\n            label=str(ring_distances[i]), marker='None', linewidth=3)\n\nax.set_xlim(360, 0)\n\nax.set_xlabel('$l$ [deg]')\nax.set_ylabel(fr'$\\mu_l \\, \\cos b$ [{(u.mas/u.yr).to_string(\"latex_inline\")}]')\n\nax.legend()\n\nplt.show()\n"},{"attributeType":"null","col":16,"comment":"null","endLoc":36,"id":16822,"name":"np","nodeType":"Attribute","startLoc":36,"text":"np"},{"attributeType":"null","col":28,"comment":"null","endLoc":37,"id":16823,"name":"plt","nodeType":"Attribute","startLoc":37,"text":"plt"},{"attributeType":"null","col":30,"comment":"null","endLoc":45,"id":16824,"name":"coord","nodeType":"Attribute","startLoc":45,"text":"coord"},{"attributeType":"null","col":24,"comment":"null","endLoc":46,"id":16825,"name":"u","nodeType":"Attribute","startLoc":46,"text":"u"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":53,"id":16826,"name":"c1","nodeType":"Attribute","startLoc":53,"text":"c1"},{"col":4,"comment":"\n        Return a transform from the specified frame to display coordinates.\n\n        This does not include the transData transformation\n\n        Parameters\n        ----------\n        frame : :class:`~astropy.wcs.WCS` or :class:`~matplotlib.transforms.Transform` or str\n            The ``frame`` parameter can have several possible types:\n                * :class:`~astropy.wcs.WCS` instance: assumed to be a\n                  transformation from pixel to world coordinates, where the\n                  world coordinates are the same as those in the WCS\n                  transformation used for this ``WCSAxes`` instance. This is\n                  used for example to show contours, since this involves\n                  plotting an array in pixel coordinates that are not the\n                  final data coordinate and have to be transformed to the\n                  common world coordinate system first.\n                * :class:`~matplotlib.transforms.Transform` instance: it is\n                  assumed to be a transform to the world coordinates that are\n                  part of the WCS used to instantiate this ``WCSAxes``\n                  instance.\n                * ``'pixel'`` or ``'world'``: return a transformation that\n                  allows users to plot in pixel/data coordinates (essentially\n                  an identity transform) and ``world`` (the default\n                  world-to-pixel transformation used to instantiate the\n                  ``WCSAxes`` instance).\n                * ``'fk5'`` or ``'galactic'``: return a transformation from\n                  the specified frame to the pixel/data coordinates.\n                * :class:`~astropy.coordinates.BaseCoordinateFrame` instance.\n        ","endLoc":571,"header":"def get_transform(self, frame)","id":16827,"name":"get_transform","nodeType":"Function","startLoc":540,"text":"def get_transform(self, frame):\n        \"\"\"\n        Return a transform from the specified frame to display coordinates.\n\n        This does not include the transData transformation\n\n        Parameters\n        ----------\n        frame : :class:`~astropy.wcs.WCS` or :class:`~matplotlib.transforms.Transform` or str\n            The ``frame`` parameter can have several possible types:\n                * :class:`~astropy.wcs.WCS` instance: assumed to be a\n                  transformation from pixel to world coordinates, where the\n                  world coordinates are the same as those in the WCS\n                  transformation used for this ``WCSAxes`` instance. This is\n                  used for example to show contours, since this involves\n                  plotting an array in pixel coordinates that are not the\n                  final data coordinate and have to be transformed to the\n                  common world coordinate system first.\n                * :class:`~matplotlib.transforms.Transform` instance: it is\n                  assumed to be a transform to the world coordinates that are\n                  part of the WCS used to instantiate this ``WCSAxes``\n                  instance.\n                * ``'pixel'`` or ``'world'``: return a transformation that\n                  allows users to plot in pixel/data coordinates (essentially\n                  an identity transform) and ``world`` (the default\n                  world-to-pixel transformation used to instantiate the\n                  ``WCSAxes`` instance).\n                * ``'fk5'`` or ``'galactic'``: return a transformation from\n                  the specified frame to the pixel/data coordinates.\n                * :class:`~astropy.coordinates.BaseCoordinateFrame` instance.\n        \"\"\"\n        return self._get_transform_no_transdata(frame).inverted() + self.transData"},{"col":4,"comment":"\n        Return a transform from data to the specified frame\n        ","endLoc":617,"header":"def _get_transform_no_transdata(self, frame)","id":16828,"name":"_get_transform_no_transdata","nodeType":"Function","startLoc":573,"text":"def _get_transform_no_transdata(self, frame):\n        \"\"\"\n        Return a transform from data to the specified frame\n        \"\"\"\n\n        if isinstance(frame, (BaseLowLevelWCS, BaseHighLevelWCS)):\n            if isinstance(frame, BaseHighLevelWCS):\n                frame = frame.low_level_wcs\n\n            transform, coord_meta = transform_coord_meta_from_wcs(frame, self.frame_class)\n            transform_world2pixel = transform.inverted()\n\n            if self._transform_pixel2world.frame_out == transform_world2pixel.frame_in:\n\n                return self._transform_pixel2world + transform_world2pixel\n\n            else:\n\n                return (self._transform_pixel2world +\n                        CoordinateTransform(self._transform_pixel2world.frame_out,\n                                            transform_world2pixel.frame_in) +\n                        transform_world2pixel)\n\n        elif isinstance(frame, str) and frame == 'pixel':\n\n            return Affine2D()\n\n        elif isinstance(frame, Transform):\n\n            return self._transform_pixel2world + frame\n\n        else:\n\n            if isinstance(frame, str) and frame == 'world':\n\n                return self._transform_pixel2world\n\n            else:\n\n                coordinate_transform = CoordinateTransform(self._transform_pixel2world.frame_out, frame)\n\n                if coordinate_transform.same_frames:\n                    return self._transform_pixel2world\n                else:\n                    return self._transform_pixel2world + coordinate_transform"},{"col":4,"comment":"null","endLoc":430,"header":"def draw_wcsaxes(self, renderer)","id":16829,"name":"draw_wcsaxes","nodeType":"Function","startLoc":398,"text":"def draw_wcsaxes(self, renderer):\n        if not self.axison:\n            return\n        # Here need to find out range of all coordinates, and update range for\n        # each coordinate axis. For now, just assume it covers the whole sky.\n\n        self._bboxes = []\n        # This generates a structure like [coords][axis] = [...]\n        ticklabels_bbox = defaultdict(partial(defaultdict, list))\n\n        visible_ticks = []\n\n        for coords in self._all_coords:\n\n            coords.frame.update()\n            for coord in coords:\n                coord._draw_grid(renderer)\n\n        for coords in self._all_coords:\n\n            for coord in coords:\n                coord._draw_ticks(renderer, bboxes=self._bboxes,\n                                  ticklabels_bbox=ticklabels_bbox[coord])\n                visible_ticks.extend(coord.ticklabels.get_visible_axes())\n\n        for coords in self._all_coords:\n\n            for coord in coords:\n                coord._draw_axislabels(renderer, bboxes=self._bboxes,\n                                       ticklabels_bbox=ticklabels_bbox,\n                                       visible_ticks=visible_ticks)\n\n        self.coords.frame.draw(renderer)"},{"attributeType":"EarthLocation","col":0,"comment":"null","endLoc":64,"id":16830,"name":"bear_mountain","nodeType":"Attribute","startLoc":64,"text":"bear_mountain"},{"attributeType":"null","col":4,"comment":"null","endLoc":52,"id":16831,"name":"yy","nodeType":"Attribute","startLoc":52,"text":"yy"},{"attributeType":"null","col":24,"comment":"null","endLoc":28,"id":16832,"name":"u","nodeType":"Attribute","startLoc":28,"text":"u"},{"attributeType":"null","col":30,"comment":"null","endLoc":29,"id":16833,"name":"coord","nodeType":"Attribute","startLoc":29,"text":"coord"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":39,"id":16834,"name":"icrs","nodeType":"Attribute","startLoc":39,"text":"icrs"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":16835,"name":"z","nodeType":"Attribute","startLoc":53,"text":"z"},{"attributeType":"null","col":0,"comment":"null","endLoc":86,"id":16836,"name":"string","nodeType":"Attribute","startLoc":86,"text":"string"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":66,"id":16837,"name":"gc1","nodeType":"Attribute","startLoc":66,"text":"gc1"},{"col":0,"comment":"","endLoc":19,"header":"example-template.py#<anonymous>","id":16838,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n========================\nTitle of Example\n========================\n\nThis example <verb> <active tense> <does something>.\n\nThe example uses <packages> to <do something> and <other package> to <do other\nthing>. Include links to referenced packages like this: `astropy.io.fits` to\nshow the astropy.io.fits or like this `~astropy.io.fits`to show just 'fits'\n\n\n*By: <names>*\n\n*License: BSD*\n\n\n\"\"\"\n\nplt.style.use(astropy_mpl_style)\n\nx = np.linspace(-np.pi, np.pi, 300)\n\nxx, yy = np.meshgrid(x, x)\n\nz = np.cos(xx) + np.cos(yy)\n\nplt.figure()\n\nplt.imshow(z)\n\nplt.colorbar()\n\nplt.xlabel('$x$')\n\nplt.ylabel('$y$')\n\nplt.figure()\n\nplt.imshow(z, cmap=plt.cm.get_cmap('hot'))\n\nplt.figure()\n\nplt.imshow(z, cmap=plt.cm.get_cmap('Spectral'), interpolation='none')\n\nstring = \"\"\"\nTriple-quoted string which tries to break parser but doesn't.\n\"\"\"\n\nprint('Some output from Python')\n\nplt.show()"},{"col":4,"comment":"Draw the axes.","endLoc":466,"header":"def draw(self, renderer, **kwargs)","id":16839,"name":"draw","nodeType":"Function","startLoc":432,"text":"def draw(self, renderer, **kwargs):\n        \"\"\"Draw the axes.\"\"\"\n\n        # Before we do any drawing, we need to remove any existing grid lines\n        # drawn with contours, otherwise if we try and remove the contours\n        # part way through drawing, we end up with the issue mentioned in\n        # https://github.com/astropy/astropy/issues/12446\n        for coords in self._all_coords:\n            for coord in coords:\n                coord._clear_grid_contour()\n\n        # In Axes.draw, the following code can result in the xlim and ylim\n        # values changing, so we need to force call this here to make sure that\n        # the limits are correct before we update the patch.\n        locator = self.get_axes_locator()\n        if locator:\n            pos = locator(self, renderer)\n            self.apply_aspect(pos)\n        else:\n            self.apply_aspect()\n\n        if self._axisbelow is True:\n            self._wcsaxesartist.set_zorder(0.5)\n        elif self._axisbelow is False:\n            self._wcsaxesartist.set_zorder(2.5)\n        else:\n            # 'line': above patches, below lines\n            self._wcsaxesartist.set_zorder(1.5)\n\n        # We need to make sure that that frame path is up to date\n        self.coords.frame._update_patch_path()\n\n        super().draw(renderer, **kwargs)\n\n        self._drawn = True"},{"attributeType":"null","col":0,"comment":"null","endLoc":65,"id":16840,"name":"utcoffset","nodeType":"Attribute","startLoc":65,"text":"utcoffset"},{"attributeType":"null","col":0,"comment":"null","endLoc":87,"id":16841,"name":"v_sun","nodeType":"Attribute","startLoc":87,"text":"v_sun"},{"attributeType":"null","col":0,"comment":"null","endLoc":49,"id":16842,"name":"v_sun","nodeType":"Attribute","startLoc":49,"text":"v_sun"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":55,"id":16843,"name":"gal","nodeType":"Attribute","startLoc":55,"text":"gal"},{"attributeType":"Galactocentric","col":0,"comment":"null","endLoc":88,"id":16844,"name":"gc_frame","nodeType":"Attribute","startLoc":88,"text":"gc_frame"},{"fileName":"plot_sgr-coordinate-frame.py","filePath":"examples/coordinates","id":16845,"nodeType":"File","text":"# -*- coding: utf-8 -*-\nr\"\"\"\n==========================================================\nCreate a new coordinate class (for the Sagittarius stream)\n==========================================================\n\nThis document describes in detail how to subclass and define a custom spherical\ncoordinate frame, as discussed in :ref:`astropy:astropy-coordinates-design` and\nthe docstring for `~astropy.coordinates.BaseCoordinateFrame`. In this example,\nwe will define a coordinate system defined by the plane of orbit of the\nSagittarius Dwarf Galaxy (hereafter Sgr; as defined in Majewski et al. 2003).\nThe Sgr coordinate system is often referred to in terms of two angular\ncoordinates, :math:`\\Lambda,B`.\n\nTo do this, we need to define a subclass of\n`~astropy.coordinates.BaseCoordinateFrame` that knows the names and units of the\ncoordinate system angles in each of the supported representations.  In this case\nwe support `~astropy.coordinates.SphericalRepresentation` with \"Lambda\" and\n\"Beta\". Then we have to define the transformation from this coordinate system to\nsome other built-in system. Here we will use Galactic coordinates, represented\nby the `~astropy.coordinates.Galactic` class.\n\nSee Also\n--------\n\n* The `gala package <http://gala.adrian.pw/>`_, which defines a number of\n  Astropy coordinate frames for stellar stream coordinate systems.\n* Majewski et al. 2003, \"A Two Micron All Sky Survey View of the Sagittarius\n  Dwarf Galaxy. I. Morphology of the Sagittarius Core and Tidal Arms\",\n  https://arxiv.org/abs/astro-ph/0304198\n* Law & Majewski 2010, \"The Sagittarius Dwarf Galaxy: A Model for Evolution in a\n  Triaxial Milky Way Halo\", https://arxiv.org/abs/1003.1132\n* David Law's Sgr info page https://www.stsci.edu/~dlaw/Sgr/\n\n\n*By: Adrian Price-Whelan, Erik Tollerud*\n\n*License: BSD*\n\n\n\"\"\"\n\n##############################################################################\n# Make `print` work the same in all versions of Python, set up numpy,\n# matplotlib, and use a nicer set of plot parameters:\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom astropy.visualization import astropy_mpl_style\nplt.style.use(astropy_mpl_style)\n\n\n##############################################################################\n# Import the packages necessary for coordinates\n\nfrom astropy.coordinates import frame_transform_graph\nfrom astropy.coordinates.matrix_utilities import rotation_matrix, matrix_product, matrix_transpose\nimport astropy.coordinates as coord\nimport astropy.units as u\n\n##############################################################################\n# The first step is to create a new class, which we'll call\n# ``Sagittarius`` and make it a subclass of\n# `~astropy.coordinates.BaseCoordinateFrame`:\n\n\nclass Sagittarius(coord.BaseCoordinateFrame):\n    \"\"\"\n    A Heliocentric spherical coordinate system defined by the orbit\n    of the Sagittarius dwarf galaxy, as described in\n        https://ui.adsabs.harvard.edu/abs/2003ApJ...599.1082M\n    and further explained in\n        https://www.stsci.edu/~dlaw/Sgr/.\n\n    Parameters\n    ----------\n    representation : `~astropy.coordinates.BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n    Lambda : `~astropy.coordinates.Angle`, optional, must be keyword\n        The longitude-like angle corresponding to Sagittarius' orbit.\n    Beta : `~astropy.coordinates.Angle`, optional, must be keyword\n        The latitude-like angle corresponding to Sagittarius' orbit.\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n    pm_Lambda_cosBeta : `~astropy.units.Quantity`, optional, must be keyword\n        The proper motion along the stream in ``Lambda`` (including the\n        ``cos(Beta)`` factor) for this object (``pm_Beta`` must also be given).\n    pm_Beta : `~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in Declination for this object (``pm_ra_cosdec`` must\n        also be given).\n    radial_velocity : `~astropy.units.Quantity`, optional, keyword-only\n        The radial velocity of this object.\n\n    \"\"\"\n\n    default_representation = coord.SphericalRepresentation\n    default_differential = coord.SphericalCosLatDifferential\n\n    frame_specific_representation_info = {\n        coord.SphericalRepresentation: [\n            coord.RepresentationMapping('lon', 'Lambda'),\n            coord.RepresentationMapping('lat', 'Beta'),\n            coord.RepresentationMapping('distance', 'distance')]\n    }\n\n\n##############################################################################\n# Breaking this down line-by-line, we define the class as a subclass of\n# `~astropy.coordinates.BaseCoordinateFrame`. Then we include a descriptive\n# docstring.  The final lines are class-level attributes that specify the\n# default representation for the data, default differential for the velocity\n# information, and mappings from the attribute names used by representation\n# objects to the names that are to be used by the ``Sagittarius`` frame. In this\n# case we override the names in the spherical representations but don't do\n# anything with other representations like cartesian or cylindrical.\n#\n# Next we have to define the transformation from this coordinate system to some\n# other built-in coordinate system; we will use Galactic coordinates. We can do\n# this by defining functions that return transformation matrices, or by simply\n# defining a function that accepts a coordinate and returns a new coordinate in\n# the new system. Because the transformation to the Sagittarius coordinate\n# system is just a spherical rotation from Galactic coordinates, we'll just\n# define a function that returns this matrix. We'll start by constructing the\n# transformation matrix using pre-determined Euler angles and the\n# ``rotation_matrix`` helper function:\n\nSGR_PHI = (180 + 3.75) * u.degree # Euler angles (from Law & Majewski 2010)\nSGR_THETA = (90 - 13.46) * u.degree\nSGR_PSI = (180 + 14.111534) * u.degree\n\n# Generate the rotation matrix using the x-convention (see Goldstein)\nD = rotation_matrix(SGR_PHI, \"z\")\nC = rotation_matrix(SGR_THETA, \"x\")\nB = rotation_matrix(SGR_PSI, \"z\")\nA = np.diag([1.,1.,-1.])\nSGR_MATRIX = matrix_product(A, B, C, D)\n\n\n##############################################################################\n# Since we already constructed the transformation (rotation) matrix above, and\n# the inverse of a rotation matrix is just its transpose, the required\n# transformation functions are very simple:\n\n@frame_transform_graph.transform(coord.StaticMatrixTransform, coord.Galactic, Sagittarius)\ndef galactic_to_sgr():\n    \"\"\" Compute the transformation matrix from Galactic spherical to\n        heliocentric Sgr coordinates.\n    \"\"\"\n    return SGR_MATRIX\n\n\n##############################################################################\n# The decorator ``@frame_transform_graph.transform(coord.StaticMatrixTransform,\n# coord.Galactic, Sagittarius)``  registers this function on the\n# ``frame_transform_graph`` as a coordinate transformation. Inside the function,\n# we simply return the previously defined rotation matrix.\n#\n# We then register the inverse transformation by using the transpose of the\n# rotation matrix (which is faster to compute than the inverse):\n\n@frame_transform_graph.transform(coord.StaticMatrixTransform, Sagittarius, coord.Galactic)\ndef sgr_to_galactic():\n    \"\"\" Compute the transformation matrix from heliocentric Sgr coordinates to\n        spherical Galactic.\n    \"\"\"\n    return matrix_transpose(SGR_MATRIX)\n\n\n##############################################################################\n# Now that we've registered these transformations between ``Sagittarius`` and\n# `~astropy.coordinates.Galactic`, we can transform between *any* coordinate\n# system and ``Sagittarius`` (as long as the other system has a path to\n# transform to `~astropy.coordinates.Galactic`). For example, to transform from\n# ICRS coordinates to ``Sagittarius``, we would do:\n\nicrs = coord.SkyCoord(280.161732*u.degree, 11.91934*u.degree, frame='icrs')\nsgr = icrs.transform_to(Sagittarius)\nprint(sgr)\n\n##############################################################################\n# Or, to transform from the ``Sagittarius`` frame to ICRS coordinates (in this\n# case, a line along the ``Sagittarius`` x-y plane):\n\nsgr = coord.SkyCoord(Lambda=np.linspace(0, 2*np.pi, 128)*u.radian,\n                     Beta=np.zeros(128)*u.radian, frame='sagittarius')\nicrs = sgr.transform_to(coord.ICRS)\nprint(icrs)\n\n##############################################################################\n# As an example, we'll now plot the points in both coordinate systems:\n\nfig, axes = plt.subplots(2, 1, figsize=(8, 10),\n                         subplot_kw={'projection': 'aitoff'})\n\naxes[0].set_title(\"Sagittarius\")\naxes[0].plot(sgr.Lambda.wrap_at(180*u.deg).radian, sgr.Beta.radian,\n             linestyle='none', marker='.')\n\naxes[1].set_title(\"ICRS\")\naxes[1].plot(icrs.ra.wrap_at(180*u.deg).radian, icrs.dec.radian,\n             linestyle='none', marker='.')\n\nplt.show()\n\n##############################################################################\n# This particular transformation is just a spherical rotation, which is a\n# special case of an Affine transformation with no vector offset. The\n# transformation of velocity components is therefore natively supported as\n# well:\n\nsgr = coord.SkyCoord(Lambda=np.linspace(0, 2*np.pi, 128)*u.radian,\n                     Beta=np.zeros(128)*u.radian,\n                     pm_Lambda_cosBeta=np.random.uniform(-5, 5, 128)*u.mas/u.yr,\n                     pm_Beta=np.zeros(128)*u.mas/u.yr,\n                     frame='sagittarius')\nicrs = sgr.transform_to(coord.ICRS)\nprint(icrs)\n\nfig, axes = plt.subplots(3, 1, figsize=(8, 10), sharex=True)\n\naxes[0].set_title(\"Sagittarius\")\naxes[0].plot(sgr.Lambda.degree,\n             sgr.pm_Lambda_cosBeta.value,\n             linestyle='none', marker='.')\naxes[0].set_xlabel(r\"$\\Lambda$ [deg]\")\naxes[0].set_ylabel(\n    fr\"$\\mu_\\Lambda \\, \\cos B$ [{sgr.pm_Lambda_cosBeta.unit.to_string('latex_inline')}]\")\n\naxes[1].set_title(\"ICRS\")\naxes[1].plot(icrs.ra.degree, icrs.pm_ra_cosdec.value,\n             linestyle='none', marker='.')\naxes[1].set_ylabel(\n    fr\"$\\mu_\\alpha \\, \\cos\\delta$ [{icrs.pm_ra_cosdec.unit.to_string('latex_inline')}]\")\n\naxes[2].set_title(\"ICRS\")\naxes[2].plot(icrs.ra.degree, icrs.pm_dec.value,\n             linestyle='none', marker='.')\naxes[2].set_xlabel(\"RA [deg]\")\naxes[2].set_ylabel(\n    fr\"$\\mu_\\delta$ [{icrs.pm_dec.unit.to_string('latex_inline')}]\")\n\nplt.show()\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":56,"id":16846,"name":"cart_data","nodeType":"Attribute","startLoc":56,"text":"cart_data"},{"col":4,"comment":"Set x-label.","endLoc":479,"header":"def set_xlabel(self, xlabel=None, labelpad=1, loc=None, **kwargs)","id":16847,"name":"set_xlabel","nodeType":"Function","startLoc":469,"text":"def set_xlabel(self, xlabel=None, labelpad=1, loc=None, **kwargs):\n        \"\"\"Set x-label.\"\"\"\n        if xlabel is None:\n            xlabel = kwargs.pop('label', None)\n            if xlabel is None:\n                raise TypeError(\"set_xlabel() missing 1 required positional argument: 'xlabel'\")\n        for coord in self.coords:\n            if ('b' in coord.axislabels.get_visible_axes() or\n                'h' in coord.axislabels.get_visible_axes()):\n                coord.set_axislabel(xlabel, minpad=labelpad, **kwargs)\n                break"},{"attributeType":"null","col":0,"comment":"null","endLoc":57,"id":16848,"name":"unit_vector","nodeType":"Attribute","startLoc":57,"text":"unit_vector"},{"attributeType":"null","col":0,"comment":"null","endLoc":61,"id":16849,"name":"v_proj","nodeType":"Attribute","startLoc":61,"text":"v_proj"},{"className":"Sagittarius","col":0,"comment":"\n    A Heliocentric spherical coordinate system defined by the orbit\n    of the Sagittarius dwarf galaxy, as described in\n        https://ui.adsabs.harvard.edu/abs/2003ApJ...599.1082M\n    and further explained in\n        https://www.stsci.edu/~dlaw/Sgr/.\n\n    Parameters\n    ----------\n    representation : `~astropy.coordinates.BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n    Lambda : `~astropy.coordinates.Angle`, optional, must be keyword\n        The longitude-like angle corresponding to Sagittarius' orbit.\n    Beta : `~astropy.coordinates.Angle`, optional, must be keyword\n        The latitude-like angle corresponding to Sagittarius' orbit.\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n    pm_Lambda_cosBeta : `~astropy.units.Quantity`, optional, must be keyword\n        The proper motion along the stream in ``Lambda`` (including the\n        ``cos(Beta)`` factor) for this object (``pm_Beta`` must also be given).\n    pm_Beta : `~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in Declination for this object (``pm_ra_cosdec`` must\n        also be given).\n    radial_velocity : `~astropy.units.Quantity`, optional, keyword-only\n        The radial velocity of this object.\n\n    ","endLoc":104,"id":16850,"nodeType":"Class","startLoc":67,"text":"class Sagittarius(coord.BaseCoordinateFrame):\n    \"\"\"\n    A Heliocentric spherical coordinate system defined by the orbit\n    of the Sagittarius dwarf galaxy, as described in\n        https://ui.adsabs.harvard.edu/abs/2003ApJ...599.1082M\n    and further explained in\n        https://www.stsci.edu/~dlaw/Sgr/.\n\n    Parameters\n    ----------\n    representation : `~astropy.coordinates.BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n    Lambda : `~astropy.coordinates.Angle`, optional, must be keyword\n        The longitude-like angle corresponding to Sagittarius' orbit.\n    Beta : `~astropy.coordinates.Angle`, optional, must be keyword\n        The latitude-like angle corresponding to Sagittarius' orbit.\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n    pm_Lambda_cosBeta : `~astropy.units.Quantity`, optional, must be keyword\n        The proper motion along the stream in ``Lambda`` (including the\n        ``cos(Beta)`` factor) for this object (``pm_Beta`` must also be given).\n    pm_Beta : `~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in Declination for this object (``pm_ra_cosdec`` must\n        also be given).\n    radial_velocity : `~astropy.units.Quantity`, optional, keyword-only\n        The radial velocity of this object.\n\n    \"\"\"\n\n    default_representation = coord.SphericalRepresentation\n    default_differential = coord.SphericalCosLatDifferential\n\n    frame_specific_representation_info = {\n        coord.SphericalRepresentation: [\n            coord.RepresentationMapping('lon', 'Lambda'),\n            coord.RepresentationMapping('lat', 'Beta'),\n            coord.RepresentationMapping('distance', 'distance')]\n    }"},{"attributeType":"null","col":0,"comment":"null","endLoc":66,"id":16851,"name":"rv_gsr","nodeType":"Attribute","startLoc":66,"text":"rv_gsr"},{"attributeType":"null","col":0,"comment":"null","endLoc":107,"id":16852,"name":"rv_gsr","nodeType":"Attribute","startLoc":107,"text":"rv_gsr"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":96,"id":16853,"name":"gc2","nodeType":"Attribute","startLoc":96,"text":"gc2"},{"col":0,"comment":"","endLoc":23,"header":"rv-to-gsr.py#<anonymous>","id":16854,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n================================================================\nConvert a radial velocity to the Galactic Standard of Rest (GSR)\n================================================================\n\nRadial or line-of-sight velocities of sources are often reported in a\nHeliocentric or Solar-system barycentric reference frame. A common\ntransformation incorporates the projection of the Sun's motion along the\nline-of-sight to the target, hence transforming it to a Galactic rest frame\ninstead (sometimes referred to as the Galactic Standard of Rest, GSR). This\ntransformation depends on the assumptions about the orientation of the Galactic\nframe relative to the bary- or Heliocentric frame. It also depends on the\nassumed solar velocity vector. Here we'll demonstrate how to perform this\ntransformation using a sky position and barycentric radial-velocity.\n\n\n*By: Adrian Price-Whelan*\n\n*License: BSD*\n\n\n\"\"\"\n\ncoord.galactocentric_frame_defaults.set('latest')\n\nicrs = coord.SkyCoord(ra=258.58356362*u.deg, dec=14.55255619*u.deg,\n                      radial_velocity=-16.1*u.km/u.s, frame='icrs')\n\nv_sun = coord.Galactocentric().galcen_v_sun.to_cartesian()\n\ngal = icrs.transform_to(coord.Galactic)\n\ncart_data = gal.data.to_cartesian()\n\nunit_vector = cart_data / cart_data.norm()\n\nv_proj = v_sun.dot(unit_vector)\n\nrv_gsr = icrs.radial_velocity + v_proj\n\nprint(rv_gsr)\n\nrv_gsr = rv_to_gsr(icrs)\n\nprint(rv_gsr)"},{"attributeType":"SphericalRepresentation","col":4,"comment":"null","endLoc":96,"id":16855,"name":"default_representation","nodeType":"Attribute","startLoc":96,"text":"default_representation"},{"id":16856,"name":".pyinstaller/hooks","nodeType":"Package"},{"fileName":"hook-skyfield.py","filePath":".pyinstaller/hooks","id":16857,"nodeType":"File","text":"# NOTE: this hook should be added to\n# https://github.com/pyinstaller/pyinstaller-hooks-contrib\n# once that repository is ready for pull requests\nfrom PyInstaller.utils.hooks import collect_data_files\n\ndatas = collect_data_files('skyfield')\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":16858,"name":"datas","nodeType":"Attribute","startLoc":6,"text":"datas"},{"col":0,"comment":"","endLoc":4,"header":"hook-skyfield.py#<anonymous>","id":16859,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"datas = collect_data_files('skyfield')"},{"col":4,"comment":"Set y-label","endLoc":495,"header":"def set_ylabel(self, ylabel=None, labelpad=1, loc=None, **kwargs)","id":16860,"name":"set_ylabel","nodeType":"Function","startLoc":481,"text":"def set_ylabel(self, ylabel=None, labelpad=1, loc=None, **kwargs):\n        \"\"\"Set y-label\"\"\"\n        if ylabel is None:\n            ylabel = kwargs.pop('label', None)\n            if ylabel is None:\n                raise TypeError(\"set_ylabel() missing 1 required positional argument: 'ylabel'\")\n\n        if self.frame_class is RectangularFrame1D:\n            return super().set_ylabel(ylabel, labelpad=labelpad, **kwargs)\n\n        for coord in self.coords:\n            if ('l' in coord.axislabels.get_visible_axes() or\n                'c' in coord.axislabels.get_visible_axes()):\n                coord.set_axislabel(ylabel, minpad=labelpad, **kwargs)\n                break"},{"attributeType":"SphericalCosLatDifferential","col":4,"comment":"null","endLoc":97,"id":16861,"name":"default_differential","nodeType":"Attribute","startLoc":97,"text":"default_differential"},{"attributeType":"null","col":0,"comment":"null","endLoc":105,"id":16862,"name":"galcen_distance","nodeType":"Attribute","startLoc":105,"text":"galcen_distance"},{"col":4,"comment":"null","endLoc":871,"header":"def _update_grid_lines_1d(self)","id":16863,"name":"_update_grid_lines_1d","nodeType":"Function","startLoc":860,"text":"def _update_grid_lines_1d(self):\n        if self.coord_index is None:\n            return\n\n        x_ticks_pos = [a[0] for a in self.ticks.pixel['b']]\n\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        self.grid_lines = []\n        for x_coord in x_ticks_pos:\n            pixel = [[x_coord, ymin], [x_coord, ymax]]\n            self.grid_lines.append(Path(pixel))"},{"attributeType":"null","col":0,"comment":"null","endLoc":66,"id":16864,"name":"time","nodeType":"Attribute","startLoc":66,"text":"time"},{"attributeType":"null","col":0,"comment":"null","endLoc":106,"id":16865,"name":"pm_gal_sgrA","nodeType":"Attribute","startLoc":106,"text":"pm_gal_sgrA"},{"attributeType":"null","col":0,"comment":"null","endLoc":107,"id":16866,"name":"vy","nodeType":"Attribute","startLoc":107,"text":"vy"},{"attributeType":"null","col":4,"comment":"null","endLoc":107,"id":16867,"name":"vz","nodeType":"Attribute","startLoc":107,"text":"vz"},{"attributeType":"null","col":0,"comment":"null","endLoc":112,"id":16868,"name":"vx","nodeType":"Attribute","startLoc":112,"text":"vx"},{"col":4,"comment":"null","endLoc":921,"header":"def _update_grid_lines(self)","id":16869,"name":"_update_grid_lines","nodeType":"Function","startLoc":873,"text":"def _update_grid_lines(self):\n\n        # For 3-d WCS with a correlated third axis, the *proper* way of\n        # drawing a grid should be to find the world coordinates of all pixels\n        # and drawing contours. What we are doing here assumes that we can\n        # define the grid lines with just two of the coordinates (and\n        # therefore assumes that the other coordinates are fixed and set to\n        # the value in the slice). Here we basically assume that if the WCS\n        # had a third axis, it has been abstracted away in the transformation.\n\n        if self.coord_index is None:\n            return\n\n        coord_range = self.parent_map.get_coord_range()\n\n        tick_world_coordinates, spacing = self.locator(*coord_range[self.coord_index])\n        tick_world_coordinates_values = tick_world_coordinates.to_value(self.coord_unit)\n\n        n_coord = len(tick_world_coordinates_values)\n\n        from . import conf\n        n_samples = conf.grid_samples\n\n        xy_world = np.zeros((n_samples * n_coord, 2))\n\n        self.grid_lines = []\n\n        for iw, w in enumerate(tick_world_coordinates_values):\n            subset = slice(iw * n_samples, (iw + 1) * n_samples)\n            if self.coord_index == 0:\n                xy_world[subset, 0] = np.repeat(w, n_samples)\n                xy_world[subset, 1] = np.linspace(coord_range[1][0], coord_range[1][1], n_samples)\n            else:\n                xy_world[subset, 0] = np.linspace(coord_range[0][0], coord_range[0][1], n_samples)\n                xy_world[subset, 1] = np.repeat(w, n_samples)\n\n        # We now convert all the world coordinates to pixel coordinates in a\n        # single go rather than doing this in the gridline to path conversion\n        # to fully benefit from vectorized coordinate transformations.\n\n        # Transform line to pixel coordinates\n        pixel = self.transform.inverted().transform(xy_world)\n\n        # Create round-tripped values for checking\n        xy_world_round = self.transform.transform(pixel)\n\n        for iw in range(n_coord):\n            subset = slice(iw * n_samples, (iw + 1) * n_samples)\n            self.grid_lines.append(self._get_gridline(xy_world[subset], pixel[subset], xy_world_round[subset]))"},{"col":4,"comment":"null","endLoc":501,"header":"def get_xlabel(self)","id":16870,"name":"get_xlabel","nodeType":"Function","startLoc":497,"text":"def get_xlabel(self):\n        for coord in self.coords:\n            if ('b' in coord.axislabels.get_visible_axes() or\n                'h' in coord.axislabels.get_visible_axes()):\n                return coord.get_axislabel()"},{"attributeType":"null","col":4,"comment":"null","endLoc":99,"id":16871,"name":"frame_specific_representation_info","nodeType":"Attribute","startLoc":99,"text":"frame_specific_representation_info"},{"col":0,"comment":" Compute the transformation matrix from Galactic spherical to\n        heliocentric Sgr coordinates.\n    ","endLoc":149,"header":"@frame_transform_graph.transform(coord.StaticMatrixTransform, coord.Galactic, Sagittarius)\ndef galactic_to_sgr()","id":16872,"name":"galactic_to_sgr","nodeType":"Function","startLoc":144,"text":"@frame_transform_graph.transform(coord.StaticMatrixTransform, coord.Galactic, Sagittarius)\ndef galactic_to_sgr():\n    \"\"\" Compute the transformation matrix from Galactic spherical to\n        heliocentric Sgr coordinates.\n    \"\"\"\n    return SGR_MATRIX"},{"col":4,"comment":"null","endLoc":510,"header":"def get_ylabel(self)","id":16873,"name":"get_ylabel","nodeType":"Function","startLoc":503,"text":"def get_ylabel(self):\n        if self.frame_class is RectangularFrame1D:\n            return super().get_ylabel()\n\n        for coord in self.coords:\n            if ('l' in coord.axislabels.get_visible_axes() or\n                'c' in coord.axislabels.get_visible_axes()):\n                return coord.get_axislabel()"},{"attributeType":"Quantity","col":0,"comment":"null","endLoc":113,"id":16874,"name":"v_sun2","nodeType":"Attribute","startLoc":113,"text":"v_sun2"},{"col":4,"comment":"null","endLoc":538,"header":"def get_coords_overlay(self, frame, coord_meta=None)","id":16875,"name":"get_coords_overlay","nodeType":"Function","startLoc":512,"text":"def get_coords_overlay(self, frame, coord_meta=None):\n\n        # Here we can't use get_transform because that deals with\n        # pixel-to-pixel transformations when passing a WCS object.\n        if isinstance(frame, WCS):\n            transform, coord_meta = transform_coord_meta_from_wcs(frame, self.frame_class)\n        else:\n            transform = self._get_transform_no_transdata(frame)\n\n        if coord_meta is None:\n            coord_meta = get_coord_meta(frame)\n\n        coords = CoordinatesMap(self, transform=transform,\n                                coord_meta=coord_meta,\n                                frame_class=self.frame_class)\n\n        self._all_coords.append(coords)\n\n        # Common settings for overlay\n        coords[0].set_axislabel_position('t')\n        coords[1].set_axislabel_position('r')\n        coords[0].set_ticklabel_position('t')\n        coords[1].set_ticklabel_position('r')\n\n        self.overlay_coords = coords\n\n        return coords"},{"col":4,"comment":"null","endLoc":927,"header":"def _get_gridline(self, xy_world, pixel, xy_world_round)","id":16876,"name":"_get_gridline","nodeType":"Function","startLoc":923,"text":"def _get_gridline(self, xy_world, pixel, xy_world_round):\n        if self.coord_type == 'scalar':\n            return get_gridline_path(xy_world, pixel)\n        else:\n            return get_lon_lat_path(xy_world, pixel, xy_world_round)"},{"attributeType":"Galactocentric","col":0,"comment":"null","endLoc":115,"id":16877,"name":"gc_frame2","nodeType":"Attribute","startLoc":115,"text":"gc_frame2"},{"col":4,"comment":"null","endLoc":635,"header":"def get_tightbbox(self, renderer, *args, **kwargs)","id":16878,"name":"get_tightbbox","nodeType":"Function","startLoc":619,"text":"def get_tightbbox(self, renderer, *args, **kwargs):\n\n        # FIXME: we should determine what to do with the extra arguments here.\n        # Note that the expected signature of this method is different in\n        # Matplotlib 3.x compared to 2.x, but we only support 3.x now.\n\n        if not self.get_visible():\n            return\n\n        bb = [b for b in self._bboxes if b and (b.width != 0 or b.height != 0)]\n        bb.append(super().get_tightbbox(renderer, *args, **kwargs))\n\n        if bb:\n            _bbox = Bbox.union(bb)\n            return _bbox\n        else:\n            return self.get_window_extent(renderer)"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":76,"id":16879,"name":"m33altaz","nodeType":"Attribute","startLoc":76,"text":"m33altaz"},{"col":4,"comment":"null","endLoc":978,"header":"def _update_grid_contour(self)","id":16880,"name":"_update_grid_contour","nodeType":"Function","startLoc":934,"text":"def _update_grid_contour(self):\n\n        if self.coord_index is None:\n            return\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        from . import conf\n        res = conf.contour_grid_samples\n\n        x, y = np.meshgrid(np.linspace(xmin, xmax, res),\n                           np.linspace(ymin, ymax, res))\n        pixel = np.array([x.ravel(), y.ravel()]).T\n        world = self.transform.transform(pixel)\n        field = world[:, self.coord_index].reshape(res, res).T\n\n        coord_range = self.parent_map.get_coord_range()\n\n        tick_world_coordinates, spacing = self.locator(*coord_range[self.coord_index])\n\n        # tick_world_coordinates is a Quantities array and we only needs its values\n        tick_world_coordinates_values = tick_world_coordinates.value\n\n        if self.coord_type == 'longitude':\n\n            # Find biggest gap in tick_world_coordinates and wrap in middle\n            # For now just assume spacing is equal, so any mid-point will do\n            mid = 0.5 * (tick_world_coordinates_values[0] + tick_world_coordinates_values[1])\n            field = wrap_angle_at(field, mid)\n            tick_world_coordinates_values = wrap_angle_at(tick_world_coordinates_values, mid)\n\n            # Replace wraps by NaN\n            with np.errstate(invalid='ignore'):\n                reset = (np.abs(np.diff(field[:, :-1], axis=0)) > 180) | (np.abs(np.diff(field[:-1, :], axis=1)) > 180)\n            field[:-1, :-1][reset] = np.nan\n            field[1:, :-1][reset] = np.nan\n            field[:-1, 1:][reset] = np.nan\n            field[1:, 1:][reset] = np.nan\n\n        if len(tick_world_coordinates_values) > 0:\n            with np.errstate(invalid='ignore'):\n                self._grid = self.parent_axes.contour(x, y, field.transpose(), levels=np.sort(tick_world_coordinates_values))\n        else:\n            self._grid = None"},{"col":0,"comment":" Compute the transformation matrix from heliocentric Sgr coordinates to\n        spherical Galactic.\n    ","endLoc":166,"header":"@frame_transform_graph.transform(coord.StaticMatrixTransform, Sagittarius, coord.Galactic)\ndef sgr_to_galactic()","id":16881,"name":"sgr_to_galactic","nodeType":"Function","startLoc":161,"text":"@frame_transform_graph.transform(coord.StaticMatrixTransform, Sagittarius, coord.Galactic)\ndef sgr_to_galactic():\n    \"\"\" Compute the transformation matrix from heliocentric Sgr coordinates to\n        spherical Galactic.\n    \"\"\"\n    return matrix_transpose(SGR_MATRIX)"},{"attributeType":"null","col":16,"comment":"null","endLoc":47,"id":16882,"name":"np","nodeType":"Attribute","startLoc":47,"text":"np"},{"attributeType":"null","col":28,"comment":"null","endLoc":48,"id":16883,"name":"plt","nodeType":"Attribute","startLoc":48,"text":"plt"},{"attributeType":"null","col":30,"comment":"null","endLoc":58,"id":16884,"name":"coord","nodeType":"Attribute","startLoc":58,"text":"coord"},{"attributeType":"null","col":24,"comment":"null","endLoc":59,"id":16885,"name":"u","nodeType":"Attribute","startLoc":59,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":127,"id":16886,"name":"SGR_PHI","nodeType":"Attribute","startLoc":127,"text":"SGR_PHI"},{"attributeType":"null","col":0,"comment":"null","endLoc":128,"id":16887,"name":"SGR_THETA","nodeType":"Attribute","startLoc":128,"text":"SGR_THETA"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":118,"id":16888,"name":"gc3","nodeType":"Attribute","startLoc":118,"text":"gc3"},{"attributeType":"null","col":0,"comment":"null","endLoc":129,"id":16889,"name":"SGR_PSI","nodeType":"Attribute","startLoc":129,"text":"SGR_PSI"},{"attributeType":"null","col":0,"comment":"null","endLoc":87,"id":16890,"name":"midnight","nodeType":"Attribute","startLoc":87,"text":"midnight"},{"attributeType":"null","col":0,"comment":"null","endLoc":128,"id":16891,"name":"ring_distances","nodeType":"Attribute","startLoc":128,"text":"ring_distances"},{"attributeType":"null","col":0,"comment":"null","endLoc":132,"id":16892,"name":"D","nodeType":"Attribute","startLoc":132,"text":"D"},{"col":4,"comment":"\n        Method to set the tick and tick label parameters in the same way as the\n        :meth:`~matplotlib.axes.Axes.tick_params` method in Matplotlib.\n\n        This is provided for convenience, but the recommended API is to use\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticks`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticklabel`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticks_position`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticklabel_position`,\n        and :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.grid`.\n\n        Parameters\n        ----------\n        axis : int or str, optional\n            Which axis to apply the parameters to. This defaults to 'both'\n            but this can also be set to an `int` or `str` that refers to the\n            axis to apply it to, following the valid values that can index\n            ``ax.coords``. Note that ``'x'`` and ``'y``' are also accepted in\n            the case of rectangular axes.\n        which : {'both', 'major', 'minor'}, optional\n            Which ticks to apply the settings to. By default, setting are\n            applied to both major and minor ticks. Note that if ``'minor'`` is\n            specified, only the length of the ticks can be set currently.\n        direction : {'in', 'out'}, optional\n            Puts ticks inside the axes, or outside the axes.\n        length : float, optional\n            Tick length in points.\n        width : float, optional\n            Tick width in points.\n        color : color, optional\n            Tick color (accepts any valid Matplotlib color)\n        pad : float, optional\n            Distance in points between tick and label.\n        labelsize : float or str, optional\n            Tick label font size in points or as a string (e.g., 'large').\n        labelcolor : color, optional\n            Tick label color (accepts any valid Matplotlib color)\n        colors : color, optional\n            Changes the tick color and the label color to the same value\n             (accepts any valid Matplotlib color).\n        bottom, top, left, right : bool, optional\n            Where to draw the ticks. Note that this can only be given if a\n            specific coordinate is specified via the ``axis`` argument, and it\n            will not work correctly if the frame is not rectangular.\n        labelbottom, labeltop, labelleft, labelright : bool, optional\n            Where to draw the tick labels. Note that this can only be given if a\n            specific coordinate is specified via the ``axis`` argument, and it\n            will not work correctly if the frame is not rectangular.\n        grid_color : color, optional\n            The color of the grid lines (accepts any valid Matplotlib color).\n        grid_alpha : float, optional\n            Transparency of grid lines: 0 (transparent) to 1 (opaque).\n        grid_linewidth : float, optional\n            Width of grid lines in points.\n        grid_linestyle : str, optional\n            The style of the grid lines (accepts any valid Matplotlib line\n            style).\n        ","endLoc":758,"header":"def tick_params(self, axis='both', **kwargs)","id":16893,"name":"tick_params","nodeType":"Function","startLoc":672,"text":"def tick_params(self, axis='both', **kwargs):\n        \"\"\"\n        Method to set the tick and tick label parameters in the same way as the\n        :meth:`~matplotlib.axes.Axes.tick_params` method in Matplotlib.\n\n        This is provided for convenience, but the recommended API is to use\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticks`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticklabel`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticks_position`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticklabel_position`,\n        and :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.grid`.\n\n        Parameters\n        ----------\n        axis : int or str, optional\n            Which axis to apply the parameters to. This defaults to 'both'\n            but this can also be set to an `int` or `str` that refers to the\n            axis to apply it to, following the valid values that can index\n            ``ax.coords``. Note that ``'x'`` and ``'y``' are also accepted in\n            the case of rectangular axes.\n        which : {'both', 'major', 'minor'}, optional\n            Which ticks to apply the settings to. By default, setting are\n            applied to both major and minor ticks. Note that if ``'minor'`` is\n            specified, only the length of the ticks can be set currently.\n        direction : {'in', 'out'}, optional\n            Puts ticks inside the axes, or outside the axes.\n        length : float, optional\n            Tick length in points.\n        width : float, optional\n            Tick width in points.\n        color : color, optional\n            Tick color (accepts any valid Matplotlib color)\n        pad : float, optional\n            Distance in points between tick and label.\n        labelsize : float or str, optional\n            Tick label font size in points or as a string (e.g., 'large').\n        labelcolor : color, optional\n            Tick label color (accepts any valid Matplotlib color)\n        colors : color, optional\n            Changes the tick color and the label color to the same value\n             (accepts any valid Matplotlib color).\n        bottom, top, left, right : bool, optional\n            Where to draw the ticks. Note that this can only be given if a\n            specific coordinate is specified via the ``axis`` argument, and it\n            will not work correctly if the frame is not rectangular.\n        labelbottom, labeltop, labelleft, labelright : bool, optional\n            Where to draw the tick labels. Note that this can only be given if a\n            specific coordinate is specified via the ``axis`` argument, and it\n            will not work correctly if the frame is not rectangular.\n        grid_color : color, optional\n            The color of the grid lines (accepts any valid Matplotlib color).\n        grid_alpha : float, optional\n            Transparency of grid lines: 0 (transparent) to 1 (opaque).\n        grid_linewidth : float, optional\n            Width of grid lines in points.\n        grid_linestyle : str, optional\n            The style of the grid lines (accepts any valid Matplotlib line\n            style).\n        \"\"\"\n\n        if not hasattr(self, 'coords'):\n            # Axes haven't been fully initialized yet, so just ignore, as\n            # Axes.__init__ calls this method\n            return\n\n        if axis == 'both':\n\n            for pos in ('bottom', 'left', 'top', 'right'):\n                if pos in kwargs:\n                    raise ValueError(f\"Cannot specify {pos}= when axis='both'\")\n                if 'label' + pos in kwargs:\n                    raise ValueError(f\"Cannot specify label{pos}= when axis='both'\")\n\n            for coord in self.coords:\n                coord.tick_params(**kwargs)\n\n        elif axis in self.coords:\n\n            self.coords[axis].tick_params(**kwargs)\n\n        elif axis in ('x', 'y') and self.frame_class is RectangularFrame:\n\n            spine = 'b' if axis == 'x' else 'l'\n\n            for coord in self.coords:\n                if spine in coord.axislabels.get_visible_axes():\n                    coord.tick_params(**kwargs)"},{"attributeType":"null","col":0,"comment":"null","endLoc":129,"id":16894,"name":"circ_velocity","nodeType":"Attribute","startLoc":129,"text":"circ_velocity"},{"attributeType":"null","col":0,"comment":"null","endLoc":131,"id":16895,"name":"phi_grid","nodeType":"Attribute","startLoc":131,"text":"phi_grid"},{"attributeType":"CylindricalRepresentation","col":0,"comment":"null","endLoc":132,"id":16896,"name":"ring_rep","nodeType":"Attribute","startLoc":132,"text":"ring_rep"},{"attributeType":"null","col":0,"comment":"null","endLoc":88,"id":16897,"name":"delta_midnight","nodeType":"Attribute","startLoc":88,"text":"delta_midnight"},{"attributeType":"AltAz","col":0,"comment":"null","endLoc":89,"id":16898,"name":"frame_July13night","nodeType":"Attribute","startLoc":89,"text":"frame_July13night"},{"attributeType":"null","col":0,"comment":"null","endLoc":133,"id":16899,"name":"C","nodeType":"Attribute","startLoc":133,"text":"C"},{"col":4,"comment":"\n        Draw all ticks and ticklabels.\n        ","endLoc":605,"header":"def _draw_ticks(self, renderer, bboxes, ticklabels_bbox)","id":16900,"name":"_draw_ticks","nodeType":"Function","startLoc":594,"text":"def _draw_ticks(self, renderer, bboxes, ticklabels_bbox):\n        \"\"\"\n        Draw all ticks and ticklabels.\n        \"\"\"\n\n        renderer.open_group('ticks')\n        self.ticks.draw(renderer)\n        self.ticklabels.draw(renderer, bboxes=bboxes,\n                             ticklabels_bbox=ticklabels_bbox,\n                             tick_out_size=self.ticks.out_size)\n\n        renderer.close_group('ticks')"},{"attributeType":"null","col":0,"comment":"null","endLoc":134,"id":16901,"name":"B","nodeType":"Attribute","startLoc":134,"text":"B"},{"attributeType":"null","col":0,"comment":"null","endLoc":137,"id":16902,"name":"angular_velocity","nodeType":"Attribute","startLoc":137,"text":"angular_velocity"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":91,"id":16903,"name":"m33altazs_July13night","nodeType":"Attribute","startLoc":91,"text":"m33altazs_July13night"},{"attributeType":"null","col":0,"comment":"null","endLoc":135,"id":16904,"name":"A","nodeType":"Attribute","startLoc":135,"text":"A"},{"attributeType":"null","col":0,"comment":"null","endLoc":136,"id":16905,"name":"SGR_MATRIX","nodeType":"Attribute","startLoc":136,"text":"SGR_MATRIX"},{"attributeType":"null","col":0,"comment":"null","endLoc":96,"id":16906,"name":"m33airmasss_July13night","nodeType":"Attribute","startLoc":96,"text":"m33airmasss_July13night"},{"attributeType":"None","col":8,"comment":"null","endLoc":377,"id":16907,"name":"_transform_pixel2world","nodeType":"Attribute","startLoc":377,"text":"self._transform_pixel2world"},{"attributeType":"null","col":0,"comment":"null","endLoc":113,"id":16908,"name":"delta_midnight","nodeType":"Attribute","startLoc":113,"text":"delta_midnight"},{"attributeType":"null","col":12,"comment":"null","endLoc":336,"id":16909,"name":"wcs","nodeType":"Attribute","startLoc":336,"text":"self.wcs"},{"col":4,"comment":"null","endLoc":620,"header":"def _draw_axislabels(self, renderer, bboxes, ticklabels_bbox, visible_ticks)","id":16910,"name":"_draw_axislabels","nodeType":"Function","startLoc":607,"text":"def _draw_axislabels(self, renderer, bboxes, ticklabels_bbox, visible_ticks):\n        # Render the default axis label if no axis label is set.\n        if self._auto_axislabel and not self.get_axislabel():\n            self.set_axislabel(self._get_default_axislabel())\n\n        renderer.open_group('axis labels')\n\n        self.axislabels.draw(renderer, bboxes=bboxes,\n                             ticklabels_bbox=ticklabels_bbox,\n                             coord_ticklabels_bbox=ticklabels_bbox[self],\n                             ticks_locs=self.ticks.ticks_locs,\n                             visible_ticks=visible_ticks)\n\n        renderer.close_group('axis labels')"},{"attributeType":"CylindricalDifferential","col":0,"comment":"null","endLoc":139,"id":16911,"name":"ring_dif","nodeType":"Attribute","startLoc":139,"text":"ring_dif"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":176,"id":16912,"name":"icrs","nodeType":"Attribute","startLoc":176,"text":"icrs"},{"attributeType":"null","col":0,"comment":"null","endLoc":114,"id":16913,"name":"times_July12_to_13","nodeType":"Attribute","startLoc":114,"text":"times_July12_to_13"},{"attributeType":"AltAz","col":0,"comment":"null","endLoc":115,"id":16914,"name":"frame_July12_to_13","nodeType":"Attribute","startLoc":115,"text":"frame_July12_to_13"},{"attributeType":"null","col":0,"comment":"null","endLoc":116,"id":16915,"name":"sunaltazs_July12_to_13","nodeType":"Attribute","startLoc":116,"text":"sunaltazs_July12_to_13"},{"attributeType":"null","col":0,"comment":"null","endLoc":125,"id":16916,"name":"moon_July12_to_13","nodeType":"Attribute","startLoc":125,"text":"moon_July12_to_13"},{"attributeType":"_WCSAxesArtist","col":8,"comment":"null","endLoc":125,"id":16917,"name":"_wcsaxesartist","nodeType":"Attribute","startLoc":125,"text":"self._wcsaxesartist"},{"attributeType":"CoordinatesMap","col":8,"comment":"null","endLoc":536,"id":16918,"name":"overlay_coords","nodeType":"Attribute","startLoc":536,"text":"self.overlay_coords"},{"attributeType":"null","col":0,"comment":"null","endLoc":145,"id":16919,"name":"ring_rep","nodeType":"Attribute","startLoc":145,"text":"ring_rep"},{"attributeType":"null","col":0,"comment":"null","endLoc":126,"id":16920,"name":"moonaltazs_July12_to_13","nodeType":"Attribute","startLoc":126,"text":"moonaltazs_July12_to_13"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":131,"id":16921,"name":"m33altazs_July12_to_13","nodeType":"Attribute","startLoc":131,"text":"m33altazs_July12_to_13"},{"attributeType":"null","col":8,"comment":"null","endLoc":124,"id":16922,"name":"patch","nodeType":"Attribute","startLoc":124,"text":"self.patch"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":146,"id":16923,"name":"gc_rings","nodeType":"Attribute","startLoc":146,"text":"gc_rings"},{"col":0,"comment":"","endLoc":25,"header":"plot_obs-planning.py#<anonymous>","id":16924,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n===================================================================\nDetermining and plotting the altitude/azimuth of a celestial object\n===================================================================\n\nThis example demonstrates coordinate transformations and the creation of\nvisibility curves to assist with observing run planning.\n\nIn this example, we make a `~astropy.coordinates.SkyCoord` instance for M33.\nThe altitude-azimuth coordinates are then found using\n`astropy.coordinates.EarthLocation` and `astropy.time.Time` objects.\n\nThis example is meant to demonstrate the capabilities of the\n`astropy.coordinates` package. For more convenient and/or complex observation\nplanning, consider the `astroplan <https://astroplan.readthedocs.org/>`_\npackage.\n\n\n*By: Erik Tollerud, Kelle Cruz*\n\n*License: BSD*\n\n\n\"\"\"\n\nplt.style.use(astropy_mpl_style)\n\nquantity_support()\n\nm33 = SkyCoord.from_name('M33')\n\nbear_mountain = EarthLocation(lat=41.3*u.deg, lon=-74*u.deg, height=390*u.m)\n\nutcoffset = -4*u.hour  # Eastern Daylight Time\n\ntime = Time('2012-7-12 23:00:00') - utcoffset\n\nm33altaz = m33.transform_to(AltAz(obstime=time,location=bear_mountain))\n\nprint(f\"M33's Altitude = {m33altaz.alt:.2}\")\n\nmidnight = Time('2012-7-13 00:00:00') - utcoffset\n\ndelta_midnight = np.linspace(-2, 10, 100)*u.hour\n\nframe_July13night = AltAz(obstime=midnight+delta_midnight,\n                          location=bear_mountain)\n\nm33altazs_July13night = m33.transform_to(frame_July13night)\n\nm33airmasss_July13night = m33altazs_July13night.secz\n\nplt.plot(delta_midnight, m33airmasss_July13night)\n\nplt.xlim(-2, 10)\n\nplt.ylim(1, 4)\n\nplt.xlabel('Hours from EDT Midnight')\n\nplt.ylabel('Airmass [Sec(z)]')\n\nplt.show()\n\ndelta_midnight = np.linspace(-12, 12, 1000)*u.hour\n\ntimes_July12_to_13 = midnight + delta_midnight\n\nframe_July12_to_13 = AltAz(obstime=times_July12_to_13, location=bear_mountain)\n\nsunaltazs_July12_to_13 = get_sun(times_July12_to_13).transform_to(frame_July12_to_13)\n\nmoon_July12_to_13 = get_moon(times_July12_to_13)\n\nmoonaltazs_July12_to_13 = moon_July12_to_13.transform_to(frame_July12_to_13)\n\nm33altazs_July12_to_13 = m33.transform_to(frame_July12_to_13)\n\nplt.plot(delta_midnight, sunaltazs_July12_to_13.alt, color='r', label='Sun')\n\nplt.plot(delta_midnight, moonaltazs_July12_to_13.alt, color=[0.75]*3, ls='--', label='Moon')\n\nplt.scatter(delta_midnight, m33altazs_July12_to_13.alt,\n            c=m33altazs_July12_to_13.az, label='M33', lw=0, s=8,\n            cmap='viridis')\n\nplt.fill_between(delta_midnight, 0*u.deg, 90*u.deg,\n                 sunaltazs_July12_to_13.alt < -0*u.deg, color='0.5', zorder=0)\n\nplt.fill_between(delta_midnight, 0*u.deg, 90*u.deg,\n                 sunaltazs_July12_to_13.alt < -18*u.deg, color='k', zorder=0)\n\nplt.colorbar().set_label('Azimuth [deg]')\n\nplt.legend(loc='upper left')\n\nplt.xlim(-12*u.hour, 12*u.hour)\n\nplt.xticks((np.arange(13)*2-12)*u.hour)\n\nplt.ylim(0*u.deg, 90*u.deg)\n\nplt.xlabel('Hours from EDT Midnight')\n\nplt.ylabel('Altitude [deg]')\n\nplt.show()"},{"col":4,"comment":"\n        Display minor ticks for this coordinate.\n\n        Parameters\n        ----------\n        display_minor_ticks : bool\n            Whether or not to display minor ticks.\n        ","endLoc":844,"header":"def display_minor_ticks(self, display_minor_ticks)","id":16925,"name":"display_minor_ticks","nodeType":"Function","startLoc":835,"text":"def display_minor_ticks(self, display_minor_ticks):\n        \"\"\"\n        Display minor ticks for this coordinate.\n\n        Parameters\n        ----------\n        display_minor_ticks : bool\n            Whether or not to display minor ticks.\n        \"\"\"\n        self.ticks.display_minor_ticks(display_minor_ticks)"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":177,"id":16926,"name":"sgr","nodeType":"Attribute","startLoc":177,"text":"sgr"},{"col":4,"comment":"\n        Set the frequency of minor ticks per major ticks.\n\n        Parameters\n        ----------\n        frequency : int\n            The number of minor ticks per major ticks.\n        ","endLoc":858,"header":"def set_minor_frequency(self, frequency)","id":16927,"name":"set_minor_frequency","nodeType":"Function","startLoc":849,"text":"def set_minor_frequency(self, frequency):\n        \"\"\"\n        Set the frequency of minor ticks per major ticks.\n\n        Parameters\n        ----------\n        frequency : int\n            The number of minor ticks per major ticks.\n        \"\"\"\n        self.minor_frequency = frequency"},{"col":4,"comment":"null","endLoc":932,"header":"def _clear_grid_contour(self)","id":16928,"name":"_clear_grid_contour","nodeType":"Function","startLoc":929,"text":"def _clear_grid_contour(self):\n        if hasattr(self, '_grid') and self._grid:\n            for line in self._grid.collections:\n                line.remove()"},{"attributeType":"null","col":0,"comment":"null","endLoc":153,"id":16929,"name":"fig","nodeType":"Attribute","startLoc":153,"text":"fig"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":184,"id":16930,"name":"sgr","nodeType":"Attribute","startLoc":184,"text":"sgr"},{"col":4,"comment":"\n        Method to set the tick and tick label parameters in the same way as the\n        :meth:`~matplotlib.axes.Axes.tick_params` method in Matplotlib.\n\n        This is provided for convenience, but the recommended API is to use\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticks`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticklabel`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticks_position`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticklabel_position`,\n        and :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.grid`.\n\n        Parameters\n        ----------\n        which : {'both', 'major', 'minor'}, optional\n            Which ticks to apply the settings to. By default, setting are\n            applied to both major and minor ticks. Note that if ``'minor'`` is\n            specified, only the length of the ticks can be set currently.\n        direction : {'in', 'out'}, optional\n            Puts ticks inside the axes, or outside the axes.\n        length : float, optional\n            Tick length in points.\n        width : float, optional\n            Tick width in points.\n        color : color, optional\n            Tick color (accepts any valid Matplotlib color)\n        pad : float, optional\n            Distance in points between tick and label.\n        labelsize : float or str, optional\n            Tick label font size in points or as a string (e.g., 'large').\n        labelcolor : color, optional\n            Tick label color (accepts any valid Matplotlib color)\n        colors : color, optional\n            Changes the tick color and the label color to the same value\n             (accepts any valid Matplotlib color).\n        bottom, top, left, right : bool, optional\n            Where to draw the ticks. Note that this will not work correctly if\n            the frame is not rectangular.\n        labelbottom, labeltop, labelleft, labelright : bool, optional\n            Where to draw the tick labels. Note that this will not work\n            correctly if the frame is not rectangular.\n        grid_color : color, optional\n            The color of the grid lines (accepts any valid Matplotlib color).\n        grid_alpha : float, optional\n            Transparency of grid lines: 0 (transparent) to 1 (opaque).\n        grid_linewidth : float, optional\n            Width of grid lines in points.\n        grid_linestyle : str, optional\n            The style of the grid lines (accepts any valid Matplotlib line\n            style).\n        ","endLoc":1098,"header":"def tick_params(self, which='both', **kwargs)","id":16931,"name":"tick_params","nodeType":"Function","startLoc":980,"text":"def tick_params(self, which='both', **kwargs):\n        \"\"\"\n        Method to set the tick and tick label parameters in the same way as the\n        :meth:`~matplotlib.axes.Axes.tick_params` method in Matplotlib.\n\n        This is provided for convenience, but the recommended API is to use\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticks`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticklabel`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticks_position`,\n        :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.set_ticklabel_position`,\n        and :meth:`~astropy.visualization.wcsaxes.CoordinateHelper.grid`.\n\n        Parameters\n        ----------\n        which : {'both', 'major', 'minor'}, optional\n            Which ticks to apply the settings to. By default, setting are\n            applied to both major and minor ticks. Note that if ``'minor'`` is\n            specified, only the length of the ticks can be set currently.\n        direction : {'in', 'out'}, optional\n            Puts ticks inside the axes, or outside the axes.\n        length : float, optional\n            Tick length in points.\n        width : float, optional\n            Tick width in points.\n        color : color, optional\n            Tick color (accepts any valid Matplotlib color)\n        pad : float, optional\n            Distance in points between tick and label.\n        labelsize : float or str, optional\n            Tick label font size in points or as a string (e.g., 'large').\n        labelcolor : color, optional\n            Tick label color (accepts any valid Matplotlib color)\n        colors : color, optional\n            Changes the tick color and the label color to the same value\n             (accepts any valid Matplotlib color).\n        bottom, top, left, right : bool, optional\n            Where to draw the ticks. Note that this will not work correctly if\n            the frame is not rectangular.\n        labelbottom, labeltop, labelleft, labelright : bool, optional\n            Where to draw the tick labels. Note that this will not work\n            correctly if the frame is not rectangular.\n        grid_color : color, optional\n            The color of the grid lines (accepts any valid Matplotlib color).\n        grid_alpha : float, optional\n            Transparency of grid lines: 0 (transparent) to 1 (opaque).\n        grid_linewidth : float, optional\n            Width of grid lines in points.\n        grid_linestyle : str, optional\n            The style of the grid lines (accepts any valid Matplotlib line\n            style).\n        \"\"\"\n\n        # First do some sanity checking on the keyword arguments\n\n        # colors= is a fallback default for color and labelcolor\n        if 'colors' in kwargs:\n            if 'color' not in kwargs:\n                kwargs['color'] = kwargs['colors']\n            if 'labelcolor' not in kwargs:\n                kwargs['labelcolor'] = kwargs['colors']\n\n        # The only property that can be set *specifically* for minor ticks is\n        # the length. In future we could consider having a separate Ticks instance\n        # for minor ticks so that e.g. the color can be set separately.\n        if which == 'minor':\n            if len(set(kwargs) - {'length'}) > 0:\n                raise ValueError(\"When setting which='minor', the only \"\n                                 \"property that can be set at the moment is \"\n                                 \"'length' (the minor tick length)\")\n            else:\n                if 'length' in kwargs:\n                    self.ticks.set_minor_ticksize(kwargs['length'])\n            return\n\n        # At this point, we can now ignore the 'which' argument.\n\n        # Set the tick arguments\n        self.set_ticks(size=kwargs.get('length'),\n                       width=kwargs.get('width'),\n                       color=kwargs.get('color'),\n                       direction=kwargs.get('direction'))\n\n        # Set the tick position\n        position = None\n        for arg in ('bottom', 'left', 'top', 'right'):\n            if arg in kwargs and position is None:\n                position = ''\n            if kwargs.get(arg):\n                position += arg[0]\n        if position is not None:\n            self.set_ticks_position(position)\n\n        # Set the tick label arguments.\n        self.set_ticklabel(color=kwargs.get('labelcolor'),\n                           size=kwargs.get('labelsize'),\n                           pad=kwargs.get('pad'))\n\n        # Set the tick label position\n        position = None\n        for arg in ('bottom', 'left', 'top', 'right'):\n            if 'label' + arg in kwargs and position is None:\n                position = ''\n            if kwargs.get('label' + arg):\n                position += arg[0]\n        if position is not None:\n            self.set_ticklabel_position(position)\n\n        # And the grid settings\n        if 'grid_color' in kwargs:\n            self.grid_lines_kwargs['edgecolor'] = kwargs['grid_color']\n        if 'grid_alpha' in kwargs:\n            self.grid_lines_kwargs['alpha'] = kwargs['grid_alpha']\n        if 'grid_linewidth' in kwargs:\n            self.grid_lines_kwargs['linewidth'] = kwargs['grid_linewidth']\n        if 'grid_linestyle' in kwargs:\n            if kwargs['grid_linestyle'] in LINES_TO_PATCHES_LINESTYLE:\n                self.grid_lines_kwargs['linestyle'] = LINES_TO_PATCHES_LINESTYLE[kwargs['grid_linestyle']]\n            else:\n                self.grid_lines_kwargs['linestyle'] = kwargs['grid_linestyle']"},{"attributeType":"null","col":8,"comment":"null","endLoc":104,"id":16932,"name":"_bboxes","nodeType":"Attribute","startLoc":104,"text":"self._bboxes"},{"attributeType":"null","col":8,"comment":"null","endLoc":122,"id":16933,"name":"_display_coords_index","nodeType":"Attribute","startLoc":122,"text":"self._display_coords_index"},{"attributeType":"null","col":4,"comment":"null","endLoc":153,"id":16934,"name":"axes","nodeType":"Attribute","startLoc":153,"text":"axes"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":181,"id":16935,"name":"gal_rings","nodeType":"Attribute","startLoc":181,"text":"gal_rings"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":186,"id":16936,"name":"icrs","nodeType":"Attribute","startLoc":186,"text":"icrs"},{"attributeType":"null","col":8,"comment":"null","endLoc":127,"id":16937,"name":"_drawn","nodeType":"Attribute","startLoc":127,"text":"self._drawn"},{"attributeType":"null","col":8,"comment":"null","endLoc":383,"id":16938,"name":"_all_coords","nodeType":"Attribute","startLoc":383,"text":"self._all_coords"},{"attributeType":"null","col":12,"comment":"null","endLoc":117,"id":16939,"name":"transData","nodeType":"Attribute","startLoc":117,"text":"self.transData"},{"attributeType":"function","col":8,"comment":"null","endLoc":121,"id":16940,"name":"format_coord","nodeType":"Attribute","startLoc":121,"text":"self.format_coord"},{"attributeType":"null","col":0,"comment":"null","endLoc":192,"id":16941,"name":"fig","nodeType":"Attribute","startLoc":192,"text":"fig"},{"attributeType":"null","col":5,"comment":"null","endLoc":192,"id":16942,"name":"axes","nodeType":"Attribute","startLoc":192,"text":"axes"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":211,"id":16943,"name":"sgr","nodeType":"Attribute","startLoc":211,"text":"sgr"},{"attributeType":"CoordinatesMap","col":8,"comment":"null","endLoc":371,"id":16944,"name":"coords","nodeType":"Attribute","startLoc":371,"text":"self.coords"},{"attributeType":"RectangularFrame","col":12,"comment":"null","endLoc":112,"id":16945,"name":"frame_class","nodeType":"Attribute","startLoc":112,"text":"self.frame_class"},{"className":"WCSAxesSubplot","col":0,"comment":"\n    A subclass class for WCSAxes\n    ","endLoc":770,"id":16946,"nodeType":"Class","startLoc":766,"text":"class WCSAxesSubplot(subplot_class_factory(WCSAxes)):\n    \"\"\"\n    A subclass class for WCSAxes\n    \"\"\"\n    pass"},{"attributeType":"null","col":16,"comment":"null","endLoc":6,"id":16947,"name":"np","nodeType":"Attribute","startLoc":6,"text":"np"},{"attributeType":"null","col":24,"comment":"null","endLoc":13,"id":16948,"name":"u","nodeType":"Attribute","startLoc":13,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":16949,"name":"__all__","nodeType":"Attribute","startLoc":25,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":16950,"name":"VISUAL_PROPERTIES","nodeType":"Attribute","startLoc":27,"text":"VISUAL_PROPERTIES"},{"col":0,"comment":"","endLoc":3,"header":"core.py#<anonymous>","id":16951,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['WCSAxes', 'WCSAxesSubplot']\n\nVISUAL_PROPERTIES = ['facecolor', 'edgecolor', 'linewidth', 'alpha', 'linestyle']"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":216,"id":16952,"name":"icrs","nodeType":"Attribute","startLoc":216,"text":"icrs"},{"attributeType":"null","col":12,"comment":"null","endLoc":99,"id":16953,"name":"_auto_axislabel","nodeType":"Attribute","startLoc":99,"text":"self._auto_axislabel"},{"attributeType":"null","col":12,"comment":"null","endLoc":193,"id":16954,"name":"coord_wrap","nodeType":"Attribute","startLoc":193,"text":"self.coord_wrap"},{"attributeType":"null","col":12,"comment":"null","endLoc":163,"id":16955,"name":"_grid_type","nodeType":"Attribute","startLoc":163,"text":"self._grid_type"},{"attributeType":"null","col":0,"comment":"null","endLoc":183,"id":16956,"name":"fig","nodeType":"Attribute","startLoc":183,"text":"fig"},{"attributeType":"null","col":8,"comment":"null","endLoc":90,"id":16957,"name":"coord_index","nodeType":"Attribute","startLoc":90,"text":"self.coord_index"},{"attributeType":"null","col":5,"comment":"null","endLoc":183,"id":16958,"name":"ax","nodeType":"Attribute","startLoc":183,"text":"ax"},{"attributeType":"null","col":0,"comment":"null","endLoc":219,"id":16959,"name":"fig","nodeType":"Attribute","startLoc":219,"text":"fig"},{"attributeType":"null","col":4,"comment":"null","endLoc":184,"id":16960,"name":"i","nodeType":"Attribute","startLoc":184,"text":"i"},{"attributeType":"null","col":32,"comment":"null","endLoc":638,"id":16961,"name":"_fl_spacing","nodeType":"Attribute","startLoc":638,"text":"self._fl_spacing"},{"attributeType":"null","col":5,"comment":"null","endLoc":219,"id":16962,"name":"axes","nodeType":"Attribute","startLoc":219,"text":"axes"},{"col":0,"comment":"","endLoc":30,"header":"plot_galactocentric-frame.py#<anonymous>","id":16963,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n========================================================================\nTransforming positions and velocities to and from a Galactocentric frame\n========================================================================\n\nThis document shows a few examples of how to use and customize the\n`~astropy.coordinates.Galactocentric` frame to transform Heliocentric sky\npositions, distance, proper motions, and radial velocities to a Galactocentric,\nCartesian frame, and the same in reverse.\n\nThe main configurable parameters of the `~astropy.coordinates.Galactocentric`\nframe control the position and velocity of the solar system barycenter within\nthe Galaxy. These are specified by setting the ICRS coordinates of the\nGalactic center, the distance to the Galactic center (the sun-galactic center\nline is always assumed to be the x-axis of the Galactocentric frame), and the\nCartesian 3-velocity of the sun in the Galactocentric frame. We'll first\ndemonstrate how to customize these values, then show how to set the solar motion\ninstead by inputting the proper motion of Sgr A*.\n\nNote that, for brevity, we may refer to the solar system barycenter as just \"the\nsun\" in the examples below.\n\n\n*By: Adrian Price-Whelan*\n\n*License: BSD*\n\n\n\"\"\"\n\nplt.style.use(astropy_mpl_style)\n\nc1 = coord.SkyCoord(ra=89.014303*u.degree, dec=13.924912*u.degree,\n                    distance=(37.59*u.mas).to(u.pc, u.parallax()),\n                    pm_ra_cosdec=372.72*u.mas/u.yr,\n                    pm_dec=-483.69*u.mas/u.yr,\n                    radial_velocity=0.37*u.km/u.s,\n                    frame='icrs')\n\ngc1 = c1.transform_to(coord.Galactocentric)\n\nprint(gc1.v_x, gc1.v_y, gc1.v_z)\n\nv_sun = [11.1, 244, 7.25] * (u.km / u.s)  # [vx, vy, vz]\n\ngc_frame = coord.Galactocentric(\n    galcen_distance=8*u.kpc,\n    galcen_v_sun=v_sun,\n    z_sun=0*u.pc)\n\ngc2 = c1.transform_to(gc_frame)\n\nprint(gc2.v_x, gc2.v_y, gc2.v_z)\n\ngalcen_distance = 8*u.kpc\n\npm_gal_sgrA = [-6.379, -0.202] * u.mas/u.yr # from Reid & Brunthaler 2004\n\nvy, vz = -(galcen_distance * pm_gal_sgrA).to(u.km/u.s, u.dimensionless_angles())\n\nvx = 11.1 * u.km/u.s\n\nv_sun2 = u.Quantity([vx, vy, vz])  # List of Quantity -> a single Quantity\n\ngc_frame2 = coord.Galactocentric(galcen_distance=galcen_distance,\n                                 galcen_v_sun=v_sun2,\n                                 z_sun=0*u.pc)\n\ngc3 = c1.transform_to(gc_frame2)\n\nprint(gc3.v_x, gc3.v_y, gc3.v_z)\n\nring_distances = np.arange(10, 25+1, 5) * u.kpc\n\ncirc_velocity = 220 * u.km/u.s\n\nphi_grid = np.linspace(90, 270, 512) * u.degree # grid of azimuths\n\nring_rep = coord.CylindricalRepresentation(\n    rho=ring_distances[:,np.newaxis],\n    phi=phi_grid[np.newaxis],\n    z=np.zeros_like(ring_distances)[:,np.newaxis])\n\nangular_velocity = (-circ_velocity / ring_distances).to(u.mas/u.yr,\n                                                        u.dimensionless_angles())\n\nring_dif = coord.CylindricalDifferential(\n    d_rho=np.zeros(phi_grid.shape)[np.newaxis]*u.km/u.s,\n    d_phi=angular_velocity[:,np.newaxis],\n    d_z=np.zeros(phi_grid.shape)[np.newaxis]*u.km/u.s\n)\n\nring_rep = ring_rep.with_differentials(ring_dif)\n\ngc_rings = coord.SkyCoord(ring_rep, frame=coord.Galactocentric)\n\nfig,axes = plt.subplots(1, 2, figsize=(12,6))\n\naxes[0].plot(gc_rings.x.T, gc_rings.y.T, marker='None', linewidth=3)\n\naxes[0].text(-8., 0, r'$\\odot$', fontsize=20)\n\naxes[0].set_xlim(-30, 30)\n\naxes[0].set_ylim(-30, 30)\n\naxes[0].set_xlabel('$x$ [kpc]')\n\naxes[0].set_ylabel('$y$ [kpc]')\n\naxes[1].plot(gc_rings.v_x.T, gc_rings.v_y.T, marker='None', linewidth=3)\n\naxes[1].set_xlim(-250, 250)\n\naxes[1].set_ylim(-250, 250)\n\naxes[1].set_xlabel(f\"$v_x$ [{(u.km / u.s).to_string('latex_inline')}]\")\n\naxes[1].set_ylabel(f\"$v_y$ [{(u.km / u.s).to_string('latex_inline')}]\")\n\nfig.tight_layout()\n\nplt.show()\n\ngal_rings = gc_rings.transform_to(coord.Galactic)\n\nfig, ax = plt.subplots(1, 1, figsize=(8, 6))\n\nfor i in range(len(ring_distances)):\n    ax.plot(gal_rings[i].l.degree, gal_rings[i].pm_l_cosb.value,\n            label=str(ring_distances[i]), marker='None', linewidth=3)\n\nax.set_xlim(360, 0)\n\nax.set_xlabel('$l$ [deg]')\n\nax.set_ylabel(fr'$\\mu_l \\, \\cos b$ [{(u.mas/u.yr).to_string(\"latex_inline\")}]')\n\nax.legend()\n\nplt.show()"},{"attributeType":"null","col":12,"comment":"null","endLoc":203,"id":16964,"name":"_formatter_locator","nodeType":"Attribute","startLoc":203,"text":"self._formatter_locator"},{"attributeType":"null","col":16,"comment":"null","endLoc":976,"id":16965,"name":"_grid","nodeType":"Attribute","startLoc":976,"text":"self._grid"},{"col":0,"comment":"","endLoc":41,"header":"plot_sgr-coordinate-frame.py#<anonymous>","id":16966,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"r\"\"\"\n==========================================================\nCreate a new coordinate class (for the Sagittarius stream)\n==========================================================\n\nThis document describes in detail how to subclass and define a custom spherical\ncoordinate frame, as discussed in :ref:`astropy:astropy-coordinates-design` and\nthe docstring for `~astropy.coordinates.BaseCoordinateFrame`. In this example,\nwe will define a coordinate system defined by the plane of orbit of the\nSagittarius Dwarf Galaxy (hereafter Sgr; as defined in Majewski et al. 2003).\nThe Sgr coordinate system is often referred to in terms of two angular\ncoordinates, :math:`\\Lambda,B`.\n\nTo do this, we need to define a subclass of\n`~astropy.coordinates.BaseCoordinateFrame` that knows the names and units of the\ncoordinate system angles in each of the supported representations.  In this case\nwe support `~astropy.coordinates.SphericalRepresentation` with \"Lambda\" and\n\"Beta\". Then we have to define the transformation from this coordinate system to\nsome other built-in system. Here we will use Galactic coordinates, represented\nby the `~astropy.coordinates.Galactic` class.\n\nSee Also\n--------\n\n* The `gala package <http://gala.adrian.pw/>`_, which defines a number of\n  Astropy coordinate frames for stellar stream coordinate systems.\n* Majewski et al. 2003, \"A Two Micron All Sky Survey View of the Sagittarius\n  Dwarf Galaxy. I. Morphology of the Sagittarius Core and Tidal Arms\",\n  https://arxiv.org/abs/astro-ph/0304198\n* Law & Majewski 2010, \"The Sagittarius Dwarf Galaxy: A Model for Evolution in a\n  Triaxial Milky Way Halo\", https://arxiv.org/abs/1003.1132\n* David Law's Sgr info page https://www.stsci.edu/~dlaw/Sgr/\n\n\n*By: Adrian Price-Whelan, Erik Tollerud*\n\n*License: BSD*\n\n\n\"\"\"\n\nplt.style.use(astropy_mpl_style)\n\nSGR_PHI = (180 + 3.75) * u.degree # Euler angles (from Law & Majewski 2010)\n\nSGR_THETA = (90 - 13.46) * u.degree\n\nSGR_PSI = (180 + 14.111534) * u.degree\n\nD = rotation_matrix(SGR_PHI, \"z\")\n\nC = rotation_matrix(SGR_THETA, \"x\")\n\nB = rotation_matrix(SGR_PSI, \"z\")\n\nA = np.diag([1.,1.,-1.])\n\nSGR_MATRIX = matrix_product(A, B, C, D)\n\nicrs = coord.SkyCoord(280.161732*u.degree, 11.91934*u.degree, frame='icrs')\n\nsgr = icrs.transform_to(Sagittarius)\n\nprint(sgr)\n\nsgr = coord.SkyCoord(Lambda=np.linspace(0, 2*np.pi, 128)*u.radian,\n                     Beta=np.zeros(128)*u.radian, frame='sagittarius')\n\nicrs = sgr.transform_to(coord.ICRS)\n\nprint(icrs)\n\nfig, axes = plt.subplots(2, 1, figsize=(8, 10),\n                         subplot_kw={'projection': 'aitoff'})\n\naxes[0].set_title(\"Sagittarius\")\n\naxes[0].plot(sgr.Lambda.wrap_at(180*u.deg).radian, sgr.Beta.radian,\n             linestyle='none', marker='.')\n\naxes[1].set_title(\"ICRS\")\n\naxes[1].plot(icrs.ra.wrap_at(180*u.deg).radian, icrs.dec.radian,\n             linestyle='none', marker='.')\n\nplt.show()\n\nsgr = coord.SkyCoord(Lambda=np.linspace(0, 2*np.pi, 128)*u.radian,\n                     Beta=np.zeros(128)*u.radian,\n                     pm_Lambda_cosBeta=np.random.uniform(-5, 5, 128)*u.mas/u.yr,\n                     pm_Beta=np.zeros(128)*u.mas/u.yr,\n                     frame='sagittarius')\n\nicrs = sgr.transform_to(coord.ICRS)\n\nprint(icrs)\n\nfig, axes = plt.subplots(3, 1, figsize=(8, 10), sharex=True)\n\naxes[0].set_title(\"Sagittarius\")\n\naxes[0].plot(sgr.Lambda.degree,\n             sgr.pm_Lambda_cosBeta.value,\n             linestyle='none', marker='.')\n\naxes[0].set_xlabel(r\"$\\Lambda$ [deg]\")\n\naxes[0].set_ylabel(\n    fr\"$\\mu_\\Lambda \\, \\cos B$ [{sgr.pm_Lambda_cosBeta.unit.to_string('latex_inline')}]\")\n\naxes[1].set_title(\"ICRS\")\n\naxes[1].plot(icrs.ra.degree, icrs.pm_ra_cosdec.value,\n             linestyle='none', marker='.')\n\naxes[1].set_ylabel(\n    fr\"$\\mu_\\alpha \\, \\cos\\delta$ [{icrs.pm_ra_cosdec.unit.to_string('latex_inline')}]\")\n\naxes[2].set_title(\"ICRS\")\n\naxes[2].plot(icrs.ra.degree, icrs.pm_dec.value,\n             linestyle='none', marker='.')\n\naxes[2].set_xlabel(\"RA [deg]\")\n\naxes[2].set_ylabel(\n    fr\"$\\mu_\\delta$ [{icrs.pm_dec.unit.to_string('latex_inline')}]\")\n\nplt.show()"},{"attributeType":"null","col":8,"comment":"null","endLoc":92,"id":16967,"name":"_format_unit","nodeType":"Attribute","startLoc":92,"text":"self._format_unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":89,"id":16968,"name":"transform","nodeType":"Attribute","startLoc":89,"text":"self.transform"},{"attributeType":"null","col":8,"comment":"null","endLoc":190,"id":16969,"name":"coord_type","nodeType":"Attribute","startLoc":190,"text":"self.coord_type"},{"attributeType":"null","col":8,"comment":"null","endLoc":121,"id":16970,"name":"grid_lines","nodeType":"Attribute","startLoc":121,"text":"self.grid_lines"},{"attributeType":"null","col":8,"comment":"null","endLoc":651,"id":16971,"name":"lbl_world","nodeType":"Attribute","startLoc":651,"text":"self.lbl_world"},{"attributeType":"null","col":8,"comment":"null","endLoc":650,"id":16972,"name":"lblinfo","nodeType":"Attribute","startLoc":650,"text":"self.lblinfo"},{"attributeType":"null","col":8,"comment":"null","endLoc":105,"id":16973,"name":"offset_transform","nodeType":"Attribute","startLoc":105,"text":"self.offset_transform"},{"attributeType":"null","col":8,"comment":"null","endLoc":91,"id":16974,"name":"coord_unit","nodeType":"Attribute","startLoc":91,"text":"self.coord_unit"},{"attributeType":"WCSAxes","col":8,"comment":"null","endLoc":87,"id":16975,"name":"parent_axes","nodeType":"Attribute","startLoc":87,"text":"self.parent_axes"},{"attributeType":"null","col":8,"comment":"null","endLoc":116,"id":16976,"name":"axislabels","nodeType":"Attribute","startLoc":116,"text":"self.axislabels"},{"attributeType":"null","col":8,"comment":"null","endLoc":125,"id":16977,"name":"grid_lines_kwargs","nodeType":"Attribute","startLoc":125,"text":"self.grid_lines_kwargs"},{"attributeType":"null","col":8,"comment":"null","endLoc":109,"id":16978,"name":"ticklabels","nodeType":"Attribute","startLoc":109,"text":"self.ticklabels"},{"attributeType":"null","col":8,"comment":"null","endLoc":106,"id":16979,"name":"ticks","nodeType":"Attribute","startLoc":106,"text":"self.ticks"},{"attributeType":"CoordinatesMap","col":8,"comment":"null","endLoc":88,"id":16980,"name":"parent_map","nodeType":"Attribute","startLoc":88,"text":"self.parent_map"},{"attributeType":"null","col":8,"comment":"null","endLoc":113,"id":16981,"name":"minor_frequency","nodeType":"Attribute","startLoc":113,"text":"self.minor_frequency"},{"attributeType":"null","col":12,"comment":"null","endLoc":202,"id":16982,"name":"_coord_scale_to_deg","nodeType":"Attribute","startLoc":202,"text":"self._coord_scale_to_deg"},{"attributeType":"null","col":8,"comment":"null","endLoc":104,"id":16983,"name":"dpi_transform","nodeType":"Attribute","startLoc":104,"text":"self.dpi_transform"},{"attributeType":"null","col":8,"comment":"null","endLoc":94,"id":16984,"name":"default_label","nodeType":"Attribute","startLoc":94,"text":"self.default_label"},{"attributeType":"null","col":8,"comment":"null","endLoc":93,"id":16985,"name":"frame","nodeType":"Attribute","startLoc":93,"text":"self.frame"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.visualization.wcsaxes`.\n    ","endLoc":38,"id":16986,"nodeType":"Class","startLoc":21,"text":"class Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.visualization.wcsaxes`.\n    \"\"\"\n\n    coordinate_range_samples = _config.ConfigItem(50,\n        'The number of samples along each image axis when determining '\n        'the range of coordinates in a plot.')\n\n    frame_boundary_samples = _config.ConfigItem(1000,\n        'How many points to sample along the axes when determining '\n        'tick locations.')\n\n    grid_samples = _config.ConfigItem(1000,\n        'How many points to sample along grid lines.')\n\n    contour_grid_samples = _config.ConfigItem(200,\n        'The grid size to use when drawing a grid using contours')"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":26,"id":16987,"name":"coordinate_range_samples","nodeType":"Attribute","startLoc":26,"text":"coordinate_range_samples"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":30,"id":16988,"name":"frame_boundary_samples","nodeType":"Attribute","startLoc":30,"text":"frame_boundary_samples"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":34,"id":16989,"name":"grid_samples","nodeType":"Attribute","startLoc":34,"text":"grid_samples"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":37,"id":16990,"name":"contour_grid_samples","nodeType":"Attribute","startLoc":37,"text":"contour_grid_samples"},{"attributeType":"null","col":30,"comment":"null","endLoc":18,"id":16991,"name":"_config","nodeType":"Attribute","startLoc":18,"text":"_config"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":41,"id":16992,"name":"conf","nodeType":"Attribute","startLoc":41,"text":"conf"},{"col":0,"comment":"","endLoc":11,"header":"__init__.py#<anonymous>","id":16993,"name":"<anonymous>","nodeType":"Function","startLoc":6,"text":"try:\n    import pytest\n    pytest.importorskip(\"matplotlib\")\n    del pytest\nexcept ImportError:\n    pass\n\nconf = Conf()"}]}